From: support Date: Thu, 15 Dec 2022 16:33:03 +0000 (+0000) Subject: Built motion from commit c738b9ac.|2.6.25 X-Git-Url: http://repos.xcallymotion.com/base/%22./banner.jpg//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=c72e514e465dd20f42e682d6ed4c164c2367ac7c;p=motion2.git Built motion from commit c738b9ac.|2.6.25 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f2aabf3..a007b24 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-12-12T11:59:54.992Z", + "time": "2022-12-15T16:25:26.484Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 3634c12..86b7021 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-12-12T11:59:54.992Z", + "time": "2022-12-15T16:25:26.484Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 3bcaa63..6833ea8 100644 --- a/server/api/action/action.attributes.js +++ b/server/api/action/action.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72a4=['jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','action','STRING','contactManager','integration'];(function(_0x2aa34a,_0x4c8fe2){var _0x1ffe88=function(_0x127172){while(--_0x127172){_0x2aa34a['push'](_0x2aa34a['shift']());}};_0x1ffe88(++_0x4c8fe2);}(_0x72a4,0x1c5));var _0x472a=function(_0x21a9cf,_0x51f954){_0x21a9cf=_0x21a9cf-0x0;var _0x5d4ba7=_0x72a4[_0x21a9cf];return _0x5d4ba7;};'use strict';var Sequelize=require('sequelize');module[_0x472a('0x0')]={'name':{'type':Sequelize[_0x472a('0x1')],'get':function(_0x305d3e){return this['getDataValue'](_0x472a('0x2'));}},'action':{'type':Sequelize[_0x472a('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x472a('0x4'),_0x472a('0x5'),'motionbar',_0x472a('0x6'),_0x472a('0x7'),_0x472a('0x8'),'bot',_0x472a('0x9')]],'msg':_0x472a('0xa')}},'comment':_0x472a('0xa')},'data1':{'type':Sequelize[_0x472a('0x3')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x472a('0xb')},'data3':{'type':Sequelize[_0x472a('0x3')](0x1000),'comment':_0x472a('0xc')},'data4':{'type':Sequelize[_0x472a('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x472a('0xd')},'data6':{'type':Sequelize['STRING'],'comments':_0x472a('0xe')},'data7':{'type':Sequelize[_0x472a('0xf')],'comments':_0x472a('0x10')}}; \ No newline at end of file +var _0x68c2=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','exports','VIRTUAL','action','STRING','contactManager','integration','jscripty','browser'];(function(_0x43df41,_0x28c7eb){var _0x1aab78=function(_0x22180f){while(--_0x22180f){_0x43df41['push'](_0x43df41['shift']());}};_0x1aab78(++_0x28c7eb);}(_0x68c2,0x1e8));var _0x268c=function(_0x18f82b,_0x3ea7a0){_0x18f82b=_0x18f82b-0x0;var _0x5d8128=_0x68c2[_0x18f82b];return _0x5d8128;};'use strict';var Sequelize=require('sequelize');module[_0x268c('0x0')]={'name':{'type':Sequelize[_0x268c('0x1')],'get':function(_0x5f2a7b){return this['getDataValue'](_0x268c('0x2'));}},'action':{'type':Sequelize[_0x268c('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x268c('0x4'),_0x268c('0x5'),'motionbar',_0x268c('0x6'),'urlForward',_0x268c('0x7'),'bot',_0x268c('0x8')]],'msg':_0x268c('0x9')}},'comment':_0x268c('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x268c('0xa')},'data2':{'type':Sequelize[_0x268c('0x3')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x268c('0x3')](0x1000),'comment':_0x268c('0xb')},'data4':{'type':Sequelize[_0x268c('0x3')](0x1000),'comments':_0x268c('0xc')},'data5':{'type':Sequelize[_0x268c('0x3')](0x1000),'comments':_0x268c('0xd')},'data6':{'type':Sequelize[_0x268c('0x3')],'comments':_0x268c('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':_0x268c('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 86edeb2..7358f9c 100644 --- a/server/api/action/action.controller.js +++ b/server/api/action/action.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x205b=['rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','stack','name','send','body','Action','find','params','catch','eml-format'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x205b,0x1ee));var _0xb205=function(_0x2770fe,_0x4e02ab){_0x2770fe=_0x2770fe-0x0;var _0x11c6cd=_0x205b[_0x2770fe];return _0x11c6cd;};'use strict';var emlformat=require(_0xb205('0x0'));var rimraf=require(_0xb205('0x1'));var zipdir=require(_0xb205('0x2'));var jsonpatch=require(_0xb205('0x3'));var rp=require('request-promise');var moment=require(_0xb205('0x4'));var BPromise=require(_0xb205('0x5'));var Mustache=require('mustache');var util=require(_0xb205('0x6'));var path=require('path');var sox=require(_0xb205('0x7'));var csv=require(_0xb205('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb205('0x9'));var squel=require(_0xb205('0xa'));var crypto=require(_0xb205('0xb'));var jsforce=require(_0xb205('0xc'));var deskjs=require(_0xb205('0xd'));var toCsv=require(_0xb205('0x8'));var querystring=require('querystring');var Papa=require(_0xb205('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb205('0xf'));var as=require(_0xb205('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb205('0x11'))(_0xb205('0x12'));var utils=require(_0xb205('0x13'));var config=require(_0xb205('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb205('0x15'))['db'];function respondWithStatusCode(_0x4df8fb,_0x2955d4){_0x2955d4=_0x2955d4||0xcc;return function(_0x9d4e59){if(_0x9d4e59){return _0x4df8fb['sendStatus'](_0x2955d4);}return _0x4df8fb['status'](_0x2955d4)['end']();};}function respondWithResult(_0x17ad85,_0x341a43){_0x341a43=_0x341a43||0xc8;return function(_0x208c38){if(_0x208c38){return _0x17ad85[_0xb205('0x16')](_0x341a43)[_0xb205('0x17')](_0x208c38);}};}function respondWithFilteredResult(_0x230bd7,_0x272463){return function(_0x53b122){if(_0x53b122){var _0x5588b5=typeof _0x272463['offset']===_0xb205('0x18')&&typeof _0x272463[_0xb205('0x19')]===_0xb205('0x18');var _0x3647ba=_0x53b122[_0xb205('0x1a')];var _0x3a656d=_0x5588b5?0x0:_0x272463[_0xb205('0x1b')];var _0x25b53c=_0x5588b5?_0x53b122[_0xb205('0x1a')]:_0x272463[_0xb205('0x1b')]+_0x272463['limit'];var _0x55c01d;if(_0x25b53c>=_0x3647ba){_0x25b53c=_0x3647ba;_0x55c01d=0xc8;}else{_0x55c01d=0xce;}_0x230bd7['status'](_0x55c01d);return _0x230bd7[_0xb205('0x1c')](_0xb205('0x1d'),_0x3a656d+'-'+_0x25b53c+'/'+_0x3647ba)[_0xb205('0x17')](_0x53b122);}return null;};}function patchUpdates(_0x1b88b3){return function(_0x223a2e){try{jsonpatch['apply'](_0x223a2e,_0x1b88b3,!![]);}catch(_0x26efaf){return BPromise[_0xb205('0x1e')](_0x26efaf);}return _0x223a2e[_0xb205('0x1f')]();};}function saveUpdates(_0x22cd68,_0xb784a9){return function(_0x56c1a8){if(_0x56c1a8){return _0x56c1a8[_0xb205('0x20')](_0x22cd68)['then'](function(_0x406cbf){return _0x406cbf;});}return null;};}function removeEntity(_0xaac8f3,_0x19ed30){return function(_0x110b03){if(_0x110b03){return _0x110b03[_0xb205('0x21')]()[_0xb205('0x22')](function(){_0xaac8f3['status'](0xcc)[_0xb205('0x23')]();});}};}function handleEntityNotFound(_0xea3ff3,_0x326f2a){return function(_0x109098){if(!_0x109098){_0xea3ff3[_0xb205('0x24')](0x194);}return _0x109098;};}function handleError(_0x27ac7a,_0x3767c0){_0x3767c0=_0x3767c0||0x1f4;return function(_0x47c51){logger['error'](_0x47c51[_0xb205('0x25')]);if(_0x47c51[_0xb205('0x26')]){delete _0x47c51[_0xb205('0x26')];}_0x27ac7a[_0xb205('0x16')](_0x3767c0)[_0xb205('0x27')](_0x47c51);};}exports[_0xb205('0x20')]=function(_0x5d41f3,_0x10f114){if(_0x5d41f3[_0xb205('0x28')]['id']){delete _0x5d41f3['body']['id'];}return db[_0xb205('0x29')][_0xb205('0x2a')]({'where':{'id':_0x5d41f3[_0xb205('0x2b')]['id']}})[_0xb205('0x22')](handleEntityNotFound(_0x10f114,null))[_0xb205('0x22')](saveUpdates(_0x5d41f3['body'],null))[_0xb205('0x22')](respondWithResult(_0x10f114,null))[_0xb205('0x2c')](handleError(_0x10f114,null));};exports[_0xb205('0x21')]=function(_0x4d1b3b,_0x2b2b8a){return db[_0xb205('0x29')][_0xb205('0x2a')]({'where':{'id':_0x4d1b3b[_0xb205('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2b2b8a,null))[_0xb205('0x22')](removeEntity(_0x2b2b8a,null))[_0xb205('0x2c')](handleError(_0x2b2b8a,null));}; \ No newline at end of file +var _0xf526=['count','limit','apply','update','then','error','stack','name','send','body','Action','find','params','destroy','catch','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x10b2f1,_0x46c79d){var _0x1041b2=function(_0x1ca766){while(--_0x1ca766){_0x10b2f1['push'](_0x10b2f1['shift']());}};_0x1041b2(++_0x46c79d);}(_0xf526,0x143));var _0x6f52=function(_0xe91467,_0x21708a){_0xe91467=_0xe91467-0x0;var _0x5a19d8=_0xf526[_0xe91467];return _0x5a19d8;};'use strict';var emlformat=require(_0x6f52('0x0'));var rimraf=require(_0x6f52('0x1'));var zipdir=require(_0x6f52('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f52('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6f52('0x4'));var util=require('util');var path=require(_0x6f52('0x5'));var sox=require(_0x6f52('0x6'));var csv=require(_0x6f52('0x7'));var ejs=require(_0x6f52('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6f52('0x9'));var crypto=require(_0x6f52('0xa'));var jsforce=require(_0x6f52('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6f52('0x7'));var querystring=require(_0x6f52('0xc'));var Papa=require(_0x6f52('0xd'));var Redis=require(_0x6f52('0xe'));var authService=require(_0x6f52('0xf'));var qs=require(_0x6f52('0x10'));var as=require(_0x6f52('0x11'));var hardwareService=require(_0x6f52('0x12'));var logger=require(_0x6f52('0x13'))(_0x6f52('0x14'));var utils=require(_0x6f52('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6f52('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x347e24,_0x4da636){_0x4da636=_0x4da636||0xcc;return function(_0x1892cc){if(_0x1892cc){return _0x347e24[_0x6f52('0x17')](_0x4da636);}return _0x347e24[_0x6f52('0x18')](_0x4da636)[_0x6f52('0x19')]();};}function respondWithResult(_0x2e100e,_0x519859){_0x519859=_0x519859||0xc8;return function(_0x282287){if(_0x282287){return _0x2e100e[_0x6f52('0x18')](_0x519859)[_0x6f52('0x1a')](_0x282287);}};}function respondWithFilteredResult(_0x2e0666,_0x38eeef){return function(_0x6f51d3){if(_0x6f51d3){var _0x5588a6=typeof _0x38eeef[_0x6f52('0x1b')]===_0x6f52('0x1c')&&typeof _0x38eeef['limit']===_0x6f52('0x1c');var _0x328b45=_0x6f51d3['count'];var _0x5da93=_0x5588a6?0x0:_0x38eeef[_0x6f52('0x1b')];var _0x33abca=_0x5588a6?_0x6f51d3[_0x6f52('0x1d')]:_0x38eeef[_0x6f52('0x1b')]+_0x38eeef[_0x6f52('0x1e')];var _0x3b8590;if(_0x33abca>=_0x328b45){_0x33abca=_0x328b45;_0x3b8590=0xc8;}else{_0x3b8590=0xce;}_0x2e0666['status'](_0x3b8590);return _0x2e0666['set']('Content-Range',_0x5da93+'-'+_0x33abca+'/'+_0x328b45)[_0x6f52('0x1a')](_0x6f51d3);}return null;};}function patchUpdates(_0x5ed183){return function(_0x5d65f1){try{jsonpatch[_0x6f52('0x1f')](_0x5d65f1,_0x5ed183,!![]);}catch(_0x769162){return BPromise['reject'](_0x769162);}return _0x5d65f1['save']();};}function saveUpdates(_0x54bf01,_0x4d9911){return function(_0x15a9b1){if(_0x15a9b1){return _0x15a9b1[_0x6f52('0x20')](_0x54bf01)[_0x6f52('0x21')](function(_0x55f9cc){return _0x55f9cc;});}return null;};}function removeEntity(_0x2d6a0e,_0x20eb3c){return function(_0x65bc8f){if(_0x65bc8f){return _0x65bc8f['destroy']()['then'](function(){_0x2d6a0e[_0x6f52('0x18')](0xcc)[_0x6f52('0x19')]();});}};}function handleEntityNotFound(_0x5446fe,_0x61e5ad){return function(_0x43a2b5){if(!_0x43a2b5){_0x5446fe['sendStatus'](0x194);}return _0x43a2b5;};}function handleError(_0x507fb5,_0x11ec08){_0x11ec08=_0x11ec08||0x1f4;return function(_0x5c61fb){logger[_0x6f52('0x22')](_0x5c61fb[_0x6f52('0x23')]);if(_0x5c61fb[_0x6f52('0x24')]){delete _0x5c61fb[_0x6f52('0x24')];}_0x507fb5['status'](_0x11ec08)[_0x6f52('0x25')](_0x5c61fb);};}exports['update']=function(_0x257b20,_0x5a5842){if(_0x257b20[_0x6f52('0x26')]['id']){delete _0x257b20[_0x6f52('0x26')]['id'];}return db[_0x6f52('0x27')][_0x6f52('0x28')]({'where':{'id':_0x257b20[_0x6f52('0x29')]['id']}})[_0x6f52('0x21')](handleEntityNotFound(_0x5a5842,null))[_0x6f52('0x21')](saveUpdates(_0x257b20[_0x6f52('0x26')],null))[_0x6f52('0x21')](respondWithResult(_0x5a5842,null))['catch'](handleError(_0x5a5842,null));};exports[_0x6f52('0x2a')]=function(_0x4ec39f,_0x445ec8){return db[_0x6f52('0x27')][_0x6f52('0x28')]({'where':{'id':_0x4ec39f[_0x6f52('0x29')]['id']}})[_0x6f52('0x21')](handleEntityNotFound(_0x445ec8,null))['then'](removeEntity(_0x445ec8,null))[_0x6f52('0x2b')](handleError(_0x445ec8,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index cf3dc05..a84e81f 100644 --- a/server/api/action/action.model.js +++ b/server/api/action/action.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe211=['exports','define','Action','tools_actions','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes'];(function(_0x183b3c,_0x34db3b){var _0x30e020=function(_0x4985ff){while(--_0x4985ff){_0x183b3c['push'](_0x183b3c['shift']());}};_0x30e020(++_0x34db3b);}(_0xe211,0xfb));var _0x1e21=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe211[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e21('0x0'));var util=require(_0x1e21('0x1'));var logger=require('../../config/logger')(_0x1e21('0x2'));var moment=require(_0x1e21('0x3'));var BPromise=require(_0x1e21('0x4'));var rp=require(_0x1e21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e21('0x6'));var config=require(_0x1e21('0x7'));var attributes=require(_0x1e21('0x8'));module[_0x1e21('0x9')]=function(_0x21df74,_0x14f996){return _0x21df74[_0x1e21('0xa')](_0x1e21('0xb'),attributes,{'tableName':_0x1e21('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed60=['util','api','moment','request-promise','path','./action.attributes','exports','Action','tools_actions','lodash'];(function(_0x5227ab,_0x514da4){var _0x3dc702=function(_0x592b15){while(--_0x592b15){_0x5227ab['push'](_0x5227ab['shift']());}};_0x3dc702(++_0x514da4);}(_0xed60,0x81));var _0x0ed6=function(_0x25d126,_0x3294c3){_0x25d126=_0x25d126-0x0;var _0x2c997f=_0xed60[_0x25d126];return _0x2c997f;};'use strict';var _=require(_0x0ed6('0x0'));var util=require(_0x0ed6('0x1'));var logger=require('../../config/logger')(_0x0ed6('0x2'));var moment=require(_0x0ed6('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ed6('0x4'));var fs=require('fs');var path=require(_0x0ed6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ed6('0x6'));module[_0x0ed6('0x7')]=function(_0x453996,_0x12d9da){return _0x453996['define'](_0x0ed6('0x8'),attributes,{'tableName':_0x0ed6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index a1195dd..530769d 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x814b,0x1a2));var _0xb814=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x814b[_0x2e3545];return _0xcf18f;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x7217,0x19e));var _0x7721=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7217[_0x934425];return _0x31d596;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 432e009..9cf0cd1 100644 --- a/server/api/action/index.js +++ b/server/api/action/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5016=['../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','/:id','destroy','multer','util','path','Router','fs-extra'];(function(_0x13b774,_0x20ee63){var _0x17da42=function(_0x234a4f){while(--_0x234a4f){_0x13b774['push'](_0x13b774['shift']());}};_0x17da42(++_0x20ee63);}(_0x5016,0x8a));var _0x6501=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x5016[_0x3cae69];return _0x3128eb;};'use strict';var multer=require(_0x6501('0x0'));var util=require(_0x6501('0x1'));var path=require(_0x6501('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6501('0x3')]();var fs_extra=require(_0x6501('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6501('0x5'));var config=require(_0x6501('0x6'));var controller=require(_0x6501('0x7'));router['put']('/:id',auth[_0x6501('0x8')](),controller['update']);router['delete'](_0x6501('0x9'),auth[_0x6501('0x8')](),controller[_0x6501('0xa')]);module['exports']=router; \ No newline at end of file +var _0x0740=['delete','isAuthenticated','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','update'];(function(_0x1945a5,_0x50de54){var _0x5817a5=function(_0x2a5a93){while(--_0x2a5a93){_0x1945a5['push'](_0x1945a5['shift']());}};_0x5817a5(++_0x50de54);}(_0x0740,0x112));var _0x0074=function(_0x231304,_0x5e462b){_0x231304=_0x231304-0x0;var _0x377e30=_0x0740[_0x231304];return _0x377e30;};'use strict';var multer=require('multer');var util=require(_0x0074('0x0'));var path=require(_0x0074('0x1'));var timeout=require('connect-timeout');var express=require(_0x0074('0x2'));var router=express[_0x0074('0x3')]();var fs_extra=require(_0x0074('0x4'));var auth=require(_0x0074('0x5'));var interaction=require(_0x0074('0x6'));var config=require('../../config/environment');var controller=require(_0x0074('0x7'));router[_0x0074('0x8')](_0x0074('0x9'),auth['isAuthenticated'](),controller[_0x0074('0xa')]);router[_0x0074('0xb')](_0x0074('0x9'),auth[_0x0074('0xc')](),controller[_0x0074('0xd')]);module[_0x0074('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 3c2b8d7..c8b6eb7 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x55e2a7,_0x99e395){var _0x5599d5=function(_0x1025bd){while(--_0x1025bd){_0x55e2a7['push'](_0x55e2a7['shift']());}};_0x5599d5(++_0x99e395);}(_0xd8fb,0x99));var _0xbd8f=function(_0x39ba52,_0x852186){_0x39ba52=_0x39ba52-0x0;var _0x3859e2=_0xd8fb[_0x39ba52];return _0x3859e2;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file +var _0x207c=['STRING','TEXT','exports'];(function(_0x59aca0,_0x8d0799){var _0x1a650f=function(_0x31c5cd){while(--_0x31c5cd){_0x59aca0['push'](_0x59aca0['shift']());}};_0x1a650f(++_0x8d0799);}(_0x207c,0x1e8));var _0xc207=function(_0x3b3362,_0x202631){_0x3b3362=_0x3b3362-0x0;var _0x223f5b=_0x207c[_0x3b3362];return _0x223f5b;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'name':{'type':Sequelize[_0xc207('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc207('0x1')]},'parent':{'type':Sequelize[_0xc207('0x1')]},'table':{'type':Sequelize[_0xc207('0x1')]},'conditions':{'type':Sequelize[_0xc207('0x2')]},'joins':{'type':Sequelize[_0xc207('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 324591c..a9691e6 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.controller.js +++ b/server/api/analyticCustomReport/analyticCustomReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3e7=['value','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','UNIX_TIMESTAMP(%s)','operator','getFields','Sequelize','metric','DESC','web','fullPath','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','COUNT(DISTINCT\x20%s)','IS\x20EMPTY','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','Content-Range','apply','reject','then','destroy','CustomReports','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition'];(function(_0x3fc287,_0x5c3f36){var _0x33af9f=function(_0x27cfc6){while(--_0x27cfc6){_0x3fc287['push'](_0x3fc287['shift']());}};_0x33af9f(++_0x5c3f36);}(_0xe3e7,0xe0));var _0x7e3e=function(_0x4a3f01,_0x20687d){_0x4a3f01=_0x4a3f01-0x0;var _0x14fd54=_0xe3e7[_0x4a3f01];return _0x14fd54;};'use strict';var emlformat=require(_0x7e3e('0x0'));var rimraf=require(_0x7e3e('0x1'));var zipdir=require(_0x7e3e('0x2'));var jsonpatch=require(_0x7e3e('0x3'));var rp=require(_0x7e3e('0x4'));var moment=require(_0x7e3e('0x5'));var BPromise=require(_0x7e3e('0x6'));var Mustache=require('mustache');var util=require(_0x7e3e('0x7'));var path=require(_0x7e3e('0x8'));var sox=require(_0x7e3e('0x9'));var csv=require(_0x7e3e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e3e('0xb'));var _=require(_0x7e3e('0xc'));var squel=require(_0x7e3e('0xd'));var crypto=require(_0x7e3e('0xe'));var jsforce=require(_0x7e3e('0xf'));var deskjs=require(_0x7e3e('0x10'));var toCsv=require(_0x7e3e('0xa'));var querystring=require(_0x7e3e('0x11'));var Papa=require(_0x7e3e('0x12'));var Redis=require(_0x7e3e('0x13'));var authService=require(_0x7e3e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7e3e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e3e('0x16'))(_0x7e3e('0x17'));var utils=require(_0x7e3e('0x18'));var config=require(_0x7e3e('0x19'));var licenseUtil=require(_0x7e3e('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7e3e('0x1b'))['dbH'];function respondWithStatusCode(_0x29d33e,_0x4e65a5){_0x4e65a5=_0x4e65a5||0xcc;return function(_0x3005e9){if(_0x3005e9){return _0x29d33e['sendStatus'](_0x4e65a5);}return _0x29d33e['status'](_0x4e65a5)['end']();};}function respondWithResult(_0xd7edff,_0x59d785){_0x59d785=_0x59d785||0xc8;return function(_0xc0f7ca){if(_0xc0f7ca){return _0xd7edff[_0x7e3e('0x1c')](_0x59d785)[_0x7e3e('0x1d')](_0xc0f7ca);}};}function respondWithFilteredResult(_0x3c7313,_0xa62ace){return function(_0x4757fe){if(_0x4757fe){var _0x5bf61e=typeof _0xa62ace[_0x7e3e('0x1e')]===_0x7e3e('0x1f')&&typeof _0xa62ace['limit']==='undefined';var _0x47c04c=_0x4757fe[_0x7e3e('0x20')];var _0x368288=_0x5bf61e?0x0:_0xa62ace[_0x7e3e('0x1e')];var _0x15fba6=_0x5bf61e?_0x4757fe[_0x7e3e('0x20')]:_0xa62ace[_0x7e3e('0x1e')]+_0xa62ace['limit'];var _0x272cff;if(_0x15fba6>=_0x47c04c){_0x15fba6=_0x47c04c;_0x272cff=0xc8;}else{_0x272cff=0xce;}_0x3c7313[_0x7e3e('0x1c')](_0x272cff);return _0x3c7313['set'](_0x7e3e('0x21'),_0x368288+'-'+_0x15fba6+'/'+_0x47c04c)[_0x7e3e('0x1d')](_0x4757fe);}return null;};}function patchUpdates(_0x172997){return function(_0x47b832){try{jsonpatch[_0x7e3e('0x22')](_0x47b832,_0x172997,!![]);}catch(_0x18d1a9){return BPromise[_0x7e3e('0x23')](_0x18d1a9);}return _0x47b832['save']();};}function saveUpdates(_0x2b94a7,_0x4a3a6f){return function(_0x506e5c){if(_0x506e5c){return _0x506e5c['update'](_0x2b94a7)[_0x7e3e('0x24')](function(_0x353f30){return _0x353f30;});}return null;};}function removeEntity(_0x1a1854,_0x3a723f){return function(_0x1e82ab){if(_0x1e82ab){return _0x1e82ab[_0x7e3e('0x25')]()[_0x7e3e('0x24')](function(){var _0x11deea=_0x1e82ab['get']({'plain':!![]});var _0x3fb5d3=_0x7e3e('0x26');return db[_0x7e3e('0x27')]['destroy']({'where':{'type':_0x3fb5d3,'resourceId':_0x11deea['id']}})[_0x7e3e('0x24')](function(){return _0x1e82ab;});})[_0x7e3e('0x24')](function(){_0x1a1854[_0x7e3e('0x1c')](0xcc)[_0x7e3e('0x28')]();});}};}function handleEntityNotFound(_0x567040,_0x16361d){return function(_0x1fefc0){if(!_0x1fefc0){_0x567040[_0x7e3e('0x29')](0x194);}return _0x1fefc0;};}function handleError(_0x5e38de,_0x4f44a0){_0x4f44a0=_0x4f44a0||0x1f4;return function(_0x1bd40e){logger[_0x7e3e('0x2a')](_0x1bd40e[_0x7e3e('0x2b')]);if(_0x1bd40e[_0x7e3e('0x2c')]){delete _0x1bd40e['name'];}_0x5e38de[_0x7e3e('0x1c')](_0x4f44a0)[_0x7e3e('0x2d')](_0x1bd40e);};}exports[_0x7e3e('0x2e')]=function(_0x4a4b7d,_0x4e2d89){var _0x3e75ab={},_0x72a15f={},_0x34b68f={'count':0x0,'rows':[]};var _0x1624a4=_[_0x7e3e('0x2f')](db[_0x7e3e('0x30')][_0x7e3e('0x31')],function(_0x417585){return{'name':_0x417585[_0x7e3e('0x32')],'type':_0x417585['type'][_0x7e3e('0x33')]};});_0x72a15f[_0x7e3e('0x34')]=_[_0x7e3e('0x2f')](_0x1624a4,_0x7e3e('0x2c'));_0x72a15f[_0x7e3e('0x35')]=_[_0x7e3e('0x36')](_0x4a4b7d[_0x7e3e('0x35')]);_0x72a15f[_0x7e3e('0x37')]=_[_0x7e3e('0x38')](_0x72a15f[_0x7e3e('0x34')],_0x72a15f['query']);_0x3e75ab['attributes']=_['intersection'](_0x72a15f[_0x7e3e('0x34')],qs[_0x7e3e('0x39')](_0x4a4b7d[_0x7e3e('0x35')]['fields']));_0x3e75ab['attributes']=_0x3e75ab['attributes']['length']?_0x3e75ab[_0x7e3e('0x3a')]:_0x72a15f[_0x7e3e('0x34')];if(!_0x4a4b7d[_0x7e3e('0x35')][_0x7e3e('0x3b')](_0x7e3e('0x3c'))){_0x3e75ab[_0x7e3e('0x3d')]=qs[_0x7e3e('0x3d')](_0x4a4b7d['query'][_0x7e3e('0x3d')]);_0x3e75ab[_0x7e3e('0x1e')]=qs[_0x7e3e('0x1e')](_0x4a4b7d[_0x7e3e('0x35')][_0x7e3e('0x1e')]);}_0x3e75ab[_0x7e3e('0x3e')]=qs[_0x7e3e('0x3f')](_0x4a4b7d[_0x7e3e('0x35')][_0x7e3e('0x3f')]);_0x3e75ab[_0x7e3e('0x40')]=qs[_0x7e3e('0x37')](_['pick'](_0x4a4b7d[_0x7e3e('0x35')],_0x72a15f[_0x7e3e('0x37')]),_0x1624a4);if(_0x4a4b7d[_0x7e3e('0x35')][_0x7e3e('0x41')]){_0x3e75ab[_0x7e3e('0x40')]=_[_0x7e3e('0x42')](_0x3e75ab[_0x7e3e('0x40')],{'$or':_[_0x7e3e('0x2f')](_0x1624a4,function(_0x5a16bc){if(_0x5a16bc[_0x7e3e('0x43')]!==_0x7e3e('0x44')){var _0x4e91c0={};_0x4e91c0[_0x5a16bc['name']]={'$like':'%'+_0x4a4b7d[_0x7e3e('0x35')]['filter']+'%'};return _0x4e91c0;}})});}_0x3e75ab=_['merge']({},_0x3e75ab,_0x4a4b7d[_0x7e3e('0x45')]);var _0x1dedc9={'where':_0x3e75ab[_0x7e3e('0x40')]};return db[_0x7e3e('0x30')][_0x7e3e('0x20')](_0x1dedc9)[_0x7e3e('0x24')](function(_0x871427){_0x34b68f['count']=_0x871427;if(_0x4a4b7d[_0x7e3e('0x35')]['includeAll']){_0x3e75ab[_0x7e3e('0x46')]=[{'all':!![]}];}return db[_0x7e3e('0x30')][_0x7e3e('0x47')](_0x3e75ab);})[_0x7e3e('0x24')](function(_0x2662a9){_0x34b68f[_0x7e3e('0x48')]=_0x2662a9;return _0x34b68f;})[_0x7e3e('0x24')](respondWithFilteredResult(_0x4e2d89,_0x3e75ab))[_0x7e3e('0x49')](handleError(_0x4e2d89,null));};exports['show']=function(_0x557f10,_0x5158a0){var _0x5f44bd={'raw':![],'where':{'id':_0x557f10[_0x7e3e('0x4a')]['id']}},_0x37729f={};_0x37729f[_0x7e3e('0x34')]=_['keys'](db['AnalyticCustomReport'][_0x7e3e('0x31')]);_0x37729f[_0x7e3e('0x35')]=_['keys'](_0x557f10[_0x7e3e('0x35')]);_0x37729f[_0x7e3e('0x37')]=_[_0x7e3e('0x38')](_0x37729f[_0x7e3e('0x34')],_0x37729f[_0x7e3e('0x35')]);_0x5f44bd[_0x7e3e('0x3a')]=_['intersection'](_0x37729f[_0x7e3e('0x34')],qs[_0x7e3e('0x39')](_0x557f10[_0x7e3e('0x35')][_0x7e3e('0x39')]));_0x5f44bd['attributes']=_0x5f44bd['attributes']['length']?_0x5f44bd['attributes']:_0x37729f[_0x7e3e('0x34')];if(_0x557f10['query'][_0x7e3e('0x4b')]){_0x5f44bd[_0x7e3e('0x46')]=[{'all':!![]}];}_0x5f44bd=_[_0x7e3e('0x42')]({},_0x5f44bd,_0x557f10['options']);return db[_0x7e3e('0x30')][_0x7e3e('0x4c')](_0x5f44bd)[_0x7e3e('0x24')](handleEntityNotFound(_0x5158a0,null))[_0x7e3e('0x24')](respondWithResult(_0x5158a0,null))['catch'](handleError(_0x5158a0,null));};exports['create']=function(_0x436743,_0x3144a6){return db[_0x7e3e('0x30')][_0x7e3e('0x4d')](_0x436743[_0x7e3e('0x4e')],{})[_0x7e3e('0x24')](function(_0x561501){var _0x42b7f7=_0x436743[_0x7e3e('0x4f')][_0x7e3e('0x50')]({'plain':!![]});if(!_0x42b7f7)throw new Error(_0x7e3e('0x51'));if(_0x42b7f7['role']===_0x7e3e('0x4f')){var _0x745c6d=_0x561501[_0x7e3e('0x50')]({'plain':!![]});var _0x199f0c=_0x7e3e('0x52');return db[_0x7e3e('0x53')][_0x7e3e('0x4c')]({'where':{'name':_0x199f0c,'userProfileId':_0x42b7f7['userProfileId']},'raw':!![]})[_0x7e3e('0x24')](function(_0x3f1caf){if(_0x3f1caf&&_0x3f1caf[_0x7e3e('0x54')]===0x0){return db[_0x7e3e('0x27')][_0x7e3e('0x4d')]({'name':_0x745c6d[_0x7e3e('0x2c')],'resourceId':_0x745c6d['id'],'type':_0x7e3e('0x26'),'sectionId':_0x3f1caf['id']},{})['then'](function(){return _0x561501;});}else{return _0x561501;}})[_0x7e3e('0x49')](function(_0x1ce5b2){logger[_0x7e3e('0x2a')](_0x7e3e('0x55'),_0x1ce5b2);throw _0x1ce5b2;});}return _0x561501;})['then'](respondWithResult(_0x3144a6,0xc9))[_0x7e3e('0x49')](handleError(_0x3144a6,null));};exports['update']=function(_0x48aaf8,_0x472679){if(_0x48aaf8['body']['id']){delete _0x48aaf8[_0x7e3e('0x4e')]['id'];}return db[_0x7e3e('0x30')][_0x7e3e('0x4c')]({'where':{'id':_0x48aaf8[_0x7e3e('0x4a')]['id']}})[_0x7e3e('0x24')](handleEntityNotFound(_0x472679,null))['then'](saveUpdates(_0x48aaf8[_0x7e3e('0x4e')],null))[_0x7e3e('0x24')](respondWithResult(_0x472679,null))[_0x7e3e('0x49')](handleError(_0x472679,null));};exports['destroy']=function(_0x371844,_0x5bc668){return db[_0x7e3e('0x30')][_0x7e3e('0x4c')]({'where':{'id':_0x371844['params']['id']}})[_0x7e3e('0x24')](handleEntityNotFound(_0x5bc668,null))['then'](removeEntity(_0x5bc668,null))['catch'](handleError(_0x5bc668,null));};exports['preview']=function(_0x3a650c,_0x277577){var _0x523360=0xa;var _0x18c115=[_0x7e3e('0x56'),'left_join',_0x7e3e('0x57'),_0x7e3e('0x58')];var _0x504896={'SUM':_0x7e3e('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7e3e('0x5a'),'MIN':_0x7e3e('0x5b'),'AVG':_0x7e3e('0x5c'),'GROUP_CONCAT':_0x7e3e('0x5d'),'GROUP_CONCAT ASC':_0x7e3e('0x5e'),'GROUP_CONCAT DESC':_0x7e3e('0x5f')};var _0x15273a={'SEC_TO_TIME':_0x7e3e('0x60'),'DATE':_0x7e3e('0x61'),'HOUR':_0x7e3e('0x62'),'ROUND':_0x7e3e('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x416cc7=function(_0x145889){return!_[_0x7e3e('0x64')]([_0x7e3e('0x65'),_0x7e3e('0x66'),'IS\x20EMPTY',_0x7e3e('0x67')],_0x145889);};var _0x263f72=function(_0x778929){if(!_0x778929||!_0x778929[_0x7e3e('0x68')][_0x7e3e('0x69')]){return'';}for(var _0x1a5ad6='(',_0x27d987=0x0;_0x27d987<_0x778929[_0x7e3e('0x68')][_0x7e3e('0x69')];_0x27d987+=0x1){_0x27d987>0x0&&(_0x1a5ad6+='\x20'+_0x778929['operator']+'\x20');_0x1a5ad6+=_0x778929[_0x7e3e('0x68')][_0x27d987][_0x7e3e('0x6a')]?_0x263f72(_0x778929[_0x7e3e('0x68')][_0x27d987][_0x7e3e('0x6a')]):_0x778929['rules'][_0x27d987]['field']+'\x20'+_0x778929[_0x7e3e('0x68')][_0x27d987][_0x7e3e('0x6b')]+(_0x416cc7(_0x778929[_0x7e3e('0x68')][_0x27d987][_0x7e3e('0x6b')])?'\x20'+_0x778929[_0x7e3e('0x68')][_0x27d987][_0x7e3e('0x6c')]:'');}return _0x1a5ad6+')';};var _0x4881d3={'where':{'id':_0x3a650c[_0x7e3e('0x4a')]['id']}},_0x243f98,_0xa2f3c0,_0x544cd3,_0x37efac,_0x31dcc3;_0x4881d3=_[_0x7e3e('0x42')]({},_0x4881d3,_0x3a650c[_0x7e3e('0x45')]);return db[_0x7e3e('0x30')]['find'](_0x4881d3)[_0x7e3e('0x24')](function(_0x57ceb9){if(_0x57ceb9){_0x243f98=_0x57ceb9;return _0x57ceb9['getFields']();}return null;})[_0x7e3e('0x24')](function(_0xa3c747){if(_0xa3c747){if(!_0xa3c747[_0x7e3e('0x69')]){throw new db['Sequelize'][(_0x7e3e('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa2f3c0=_0xa3c747;return db[_0x7e3e('0x6e')][_0x7e3e('0x47')]({'raw':!![]});}return null;})[_0x7e3e('0x24')](function(_0x7074ee){if(_0x7074ee){_0x544cd3=_[_0x7e3e('0x6f')](_0x7074ee,'id');var _0x1ef028;var _0x2d6f44=squel[_0x7e3e('0x70')]();_0x2d6f44[_0x7e3e('0x71')](_0x243f98[_0x7e3e('0x72')]);for(var _0x31328f=0x0;_0x31328f<_0xa2f3c0[_0x7e3e('0x69')];_0x31328f+=0x1){_0x1ef028=_0xa2f3c0[_0x31328f][_0x7e3e('0x73')]?_0x544cd3[_0xa2f3c0[_0x31328f][_0x7e3e('0x73')]]['metric']:_0xa2f3c0[_0x31328f][_0x7e3e('0x74')];_0x1ef028=_0xa2f3c0[_0x31328f][_0x7e3e('0x75')]?_[_0x7e3e('0x76')](_0x504896[_0xa2f3c0[_0x31328f][_0x7e3e('0x75')]],'%s',_0x1ef028):_0x1ef028;_0x1ef028=_0xa2f3c0[_0x31328f]['format']?_['replace'](_0x15273a[_0xa2f3c0[_0x31328f][_0x7e3e('0x77')]],'%s',_0x1ef028):_0x1ef028;if(_0xa2f3c0[_0x31328f][_0x7e3e('0x78')]){_0x2d6f44[_0x7e3e('0x6a')](_0x1ef028);}_0xa2f3c0[_0x31328f][_0x7e3e('0x79')]&&_0x2d6f44[_0x7e3e('0x3e')](_0x1ef028,_0xa2f3c0[_0x31328f]['orderBy']==='DESC'?![]:!![]);_0x2d6f44['field'](_0x1ef028,_0xa2f3c0[_0x31328f][_0x7e3e('0x7a')]||_0x1ef028);}if(_0x243f98['joins']){_0x243f98[_0x7e3e('0x7b')]=JSON[_0x7e3e('0x7c')](_0x243f98['joins']);for(var _0x4b2296=0x0;_0x4b2296<_0x243f98[_0x7e3e('0x7b')][_0x7e3e('0x69')];_0x4b2296+=0x1){if(_0x243f98[_0x7e3e('0x7b')][_0x4b2296]['type']&&_[_0x7e3e('0x64')](_0x18c115,_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x43')])&&_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x7d')]&&_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x7e')]&&_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x7f')]){_0x2d6f44[_0x243f98['joins'][_0x4b2296]['type']](_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x7e')],null,util[_0x7e3e('0x77')](_0x7e3e('0x80'),_0x243f98[_0x7e3e('0x72')],_0x243f98['joins'][_0x4b2296][_0x7e3e('0x7d')],_0x243f98[_0x7e3e('0x7b')][_0x4b2296]['foreignTable'],_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x7f')]));}}}if(_0x243f98[_0x7e3e('0x81')]){_0x243f98[_0x7e3e('0x81')]=JSON['parse'](_0x243f98[_0x7e3e('0x81')]);_0x2d6f44[_0x7e3e('0x40')](_0x263f72(_0x243f98[_0x7e3e('0x81')][_0x7e3e('0x6a')]));}_0x31dcc3=_0x2d6f44[_0x7e3e('0x82')]();_0x2d6f44[_0x7e3e('0x3d')](_0x523360);_0x2d6f44[_0x7e3e('0x1e')](0x0);logger['debug']('Limited\x20Query:',_0x2d6f44[_0x7e3e('0x83')]());return dbH[_0x7e3e('0x84')][_0x7e3e('0x35')](_0x2d6f44['toString'](),{'type':dbH['sequelize'][_0x7e3e('0x85')][_0x7e3e('0x86')]});}})[_0x7e3e('0x24')](respondWithResult(_0x277577,null))[_0x7e3e('0x49')](handleError(_0x277577,null));};function runReport(_0x5ac425,_0x3bb96d,_0x3ec1c2){var _0x31ff60=_0x3bb96d['name'];var _0x3a6056=0xa;var _0x57939b=['join','left_join','right_join',_0x7e3e('0x58')];var _0x111cd0={'SUM':_0x7e3e('0x59'),'COUNT':_0x7e3e('0x87'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7e3e('0x5a'),'MIN':_0x7e3e('0x5b'),'AVG':_0x7e3e('0x5c'),'GROUP_CONCAT':_0x7e3e('0x5d'),'GROUP_CONCAT ASC':_0x7e3e('0x5e'),'GROUP_CONCAT DESC':_0x7e3e('0x5f')};var _0x443439={'SEC_TO_TIME':_0x7e3e('0x60'),'DATE':'DATE(%s)','HOUR':_0x7e3e('0x62'),'ROUND':_0x7e3e('0x63'),'UNIX_TIMESTAMP':_0x7e3e('0x88')};var _0x2f7659=function(_0x11529c){return!_[_0x7e3e('0x64')]([_0x7e3e('0x65'),_0x7e3e('0x66'),'IS\x20EMPTY',_0x7e3e('0x67')],_0x11529c);};var _0x3c6988=function(_0x57bb00){if(!_0x57bb00||!_0x57bb00[_0x7e3e('0x68')]['length']){return'';}for(var _0x5a767e='(',_0x283f4f=0x0;_0x283f4f<_0x57bb00[_0x7e3e('0x68')][_0x7e3e('0x69')];_0x283f4f+=0x1){_0x283f4f>0x0&&(_0x5a767e+='\x20'+_0x57bb00[_0x7e3e('0x89')]+'\x20');_0x5a767e+=_0x57bb00[_0x7e3e('0x68')][_0x283f4f]['group']?_0x3c6988(_0x57bb00[_0x7e3e('0x68')][_0x283f4f]['group']):_0x57bb00[_0x7e3e('0x68')][_0x283f4f][_0x7e3e('0x74')]+'\x20'+_0x57bb00[_0x7e3e('0x68')][_0x283f4f][_0x7e3e('0x6b')]+(_0x2f7659(_0x57bb00[_0x7e3e('0x68')][_0x283f4f][_0x7e3e('0x6b')])?'\x20'+_0x57bb00[_0x7e3e('0x68')][_0x283f4f]['value']:'');}return _0x5a767e+')';};var _0xa1e13e={'where':{'id':_0x5ac425['id']}},_0x36df4b,_0x251633,_0x3f0eec,_0x3bc987,_0x3fc085;_0xa1e13e=_[_0x7e3e('0x42')]({},_0xa1e13e,_0x3ec1c2);return db[_0x7e3e('0x30')]['find'](_0xa1e13e)[_0x7e3e('0x24')](function(_0x44a558){if(_0x44a558){_0x36df4b=_0x44a558;return _0x44a558[_0x7e3e('0x8a')]();}return null;})[_0x7e3e('0x24')](function(_0x39bf5e){if(_0x39bf5e){if(!_0x39bf5e[_0x7e3e('0x69')]){throw new db[(_0x7e3e('0x8b'))][(_0x7e3e('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x251633=_0x39bf5e;return db['AnalyticMetric'][_0x7e3e('0x47')]({'raw':!![]});}return null;})[_0x7e3e('0x24')](function(_0x5492e6){if(_0x5492e6){_0x3f0eec=_[_0x7e3e('0x6f')](_0x5492e6,'id');var _0x10b209;var _0x3a91d4=squel[_0x7e3e('0x70')]();_0x3a91d4['from'](_0x36df4b[_0x7e3e('0x72')]);for(var _0x369ae4=0x0;_0x369ae4<_0x251633[_0x7e3e('0x69')];_0x369ae4+=0x1){_0x10b209=_0x251633[_0x369ae4]['MetricId']?_0x3f0eec[_0x251633[_0x369ae4][_0x7e3e('0x73')]][_0x7e3e('0x8c')]:_0x251633[_0x369ae4]['field'];_0x10b209=_0x251633[_0x369ae4][_0x7e3e('0x75')]?_[_0x7e3e('0x76')](_0x111cd0[_0x251633[_0x369ae4][_0x7e3e('0x75')]],'%s',_0x10b209):_0x10b209;_0x10b209=_0x251633[_0x369ae4][_0x7e3e('0x77')]?_['replace'](_0x443439[_0x251633[_0x369ae4]['format']],'%s',_0x10b209):_0x10b209;if(_0x251633[_0x369ae4]['groupBy']){_0x3a91d4[_0x7e3e('0x6a')](_0x10b209);}_0x251633[_0x369ae4][_0x7e3e('0x79')]&&_0x3a91d4['order'](_0x10b209,_0x251633[_0x369ae4]['orderBy']===_0x7e3e('0x8d')?![]:!![]);_0x3a91d4[_0x7e3e('0x74')](_0x10b209,_0x251633[_0x369ae4][_0x7e3e('0x7a')]||_0x10b209);}if(_0x36df4b[_0x7e3e('0x7b')]){_0x36df4b[_0x7e3e('0x7b')]=JSON[_0x7e3e('0x7c')](_0x36df4b['joins']);for(var _0x4fabcc=0x0;_0x4fabcc<_0x36df4b[_0x7e3e('0x7b')]['length'];_0x4fabcc+=0x1){if(_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x43')]&&_[_0x7e3e('0x64')](_0x57939b,_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x43')])&&_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7d')]&&_0x36df4b['joins'][_0x4fabcc][_0x7e3e('0x7e')]&&_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7f')]){_0x3a91d4[_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x43')]](_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7e')],null,util['format'](_0x7e3e('0x80'),_0x36df4b[_0x7e3e('0x72')],_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7d')],_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7e')],_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7f')]));}}}if(_0x36df4b[_0x7e3e('0x81')]){_0x36df4b['conditions']=JSON[_0x7e3e('0x7c')](_0x36df4b[_0x7e3e('0x81')]);_0x3a91d4[_0x7e3e('0x40')](_0x3c6988(_0x36df4b[_0x7e3e('0x81')][_0x7e3e('0x6a')]));}_0x3fc085=_0x3a91d4[_0x7e3e('0x82')]();_0x3a91d4[_0x7e3e('0x3d')](_0x3a6056);_0x3a91d4[_0x7e3e('0x1e')](0x0);return;}})[_0x7e3e('0x24')](function(){if(_0x3bb96d['output']===_0x7e3e('0x8e')){return null;}var _0xb76605=_[_0x7e3e('0x42')](_0x3bb96d,{'name':_0x3bb96d[_0x7e3e('0x8f')]||_0x3bb96d[_0x7e3e('0x2c')]||_0x36df4b[_0x7e3e('0x2c')],'basename':_0x31ff60,'savename':util[_0x7e3e('0x77')]('%s-%s.%s',_0x3bb96d[_0x7e3e('0x2c')]||_0x36df4b['name'],require(_0x7e3e('0x90'))[_0x7e3e('0x91')](0x4),_0x3bb96d[_0x7e3e('0x92')]||_0x7e3e('0x93')),'reportId':_0x36df4b['id'],'reportType':_0x7e3e('0x94')});return db[_0x7e3e('0x95')][_0x7e3e('0x4d')](_0xb76605,{'raw':!![]});})[_0x7e3e('0x24')](function(_0x49d1ac){if(_0x36df4b[_0x7e3e('0x72')]===_0x7e3e('0x96')){_0x3fc085['where'](_0x36df4b['table']+_0x7e3e('0x97'),_0x3bb96d[_0x7e3e('0x98')],_0x3bb96d['endDate']);}else{_0x3fc085[_0x7e3e('0x40')](_0x36df4b[_0x7e3e('0x72')]+_0x7e3e('0x99'),_0x3bb96d[_0x7e3e('0x98')],_0x3bb96d[_0x7e3e('0x9a')]);}if(_0x49d1ac){logger[_0x7e3e('0x9b')](_0x7e3e('0x9c'),_0x3fc085[_0x7e3e('0x83')]());require(_0x7e3e('0x9d'))[_0x7e3e('0x9e')](path[_0x7e3e('0x56')](__dirname,'../../components/export/',_0x49d1ac[_0x7e3e('0x92')]),[_0x49d1ac['id'],_0x3fc085[_0x7e3e('0x83')](),path[_0x7e3e('0x56')](__dirname,_0x7e3e('0x9f'),_0x49d1ac[_0x7e3e('0xa0')]),_0x31ff60]);return _0x49d1ac;}else{var _0x53ce02=squel[_0x7e3e('0x70')]();_0x53ce02[_0x7e3e('0x71')]('('+_0x3fc085[_0x7e3e('0x83')]()+')',_0x7e3e('0xa1'));_0x53ce02['field'](_0x7e3e('0xa2'),_0x7e3e('0x20'));_0x3fc085['limit'](_0x3bb96d[_0x7e3e('0x3d')]||_0x3a6056);_0x3fc085[_0x7e3e('0x1e')](_0x3bb96d['offset']||0x0);return dbH[_0x7e3e('0x84')][_0x7e3e('0x35')](_0x53ce02[_0x7e3e('0x83')](),{'type':dbH[_0x7e3e('0x84')][_0x7e3e('0x85')][_0x7e3e('0x86')]})[_0x7e3e('0x24')](function(_0x302003){if(!_0x302003['length']){_0x3bc987=0x0;}else{_0x3bc987=_0x302003[0x0][_0x7e3e('0x20')]||0x0;}return dbH[_0x7e3e('0x84')][_0x7e3e('0x35')](_0x3fc085[_0x7e3e('0x83')](),{'type':dbH[_0x7e3e('0x84')]['QueryTypes'][_0x7e3e('0x86')]});})[_0x7e3e('0x24')](function(_0x422aa7){return{'rows':_0x422aa7||[],'count':_0x3bc987};});}});}exports[_0x7e3e('0xa3')]=function(_0x31b506,_0x1d73a6){return runReport(_0x31b506[_0x7e3e('0x4a')],_0x31b506[_0x7e3e('0x35')],_0x31b506[_0x7e3e('0x45')])[_0x7e3e('0x24')](respondWithResult(_0x1d73a6,null))[_0x7e3e('0x49')](handleError(_0x1d73a6,null));};exports['runReport']=runReport;exports[_0x7e3e('0x35')]=function(_0x498fab,_0x1d5200){var _0x572f3f=0xa;var _0x29fe13=[_0x7e3e('0x56'),'left_join',_0x7e3e('0x57'),_0x7e3e('0x58')];var _0x370e92={'SUM':_0x7e3e('0x59'),'COUNT':_0x7e3e('0x87'),'COUNT DISTINCT':_0x7e3e('0xa4'),'MAX':_0x7e3e('0x5a'),'MIN':_0x7e3e('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7e3e('0x5d'),'GROUP_CONCAT ASC':_0x7e3e('0x5e'),'GROUP_CONCAT DESC':_0x7e3e('0x5f')};var _0xc221f={'SEC_TO_TIME':_0x7e3e('0x60'),'DATE':_0x7e3e('0x61'),'HOUR':_0x7e3e('0x62'),'ROUND':_0x7e3e('0x63'),'UNIX_TIMESTAMP':_0x7e3e('0x88')};var _0x221511=function(_0x1020c6){return!_[_0x7e3e('0x64')]([_0x7e3e('0x65'),_0x7e3e('0x66'),_0x7e3e('0xa5'),_0x7e3e('0x67')],_0x1020c6);};var _0x53afe7=function(_0x32d65c){if(!_0x32d65c||!_0x32d65c['rules'][_0x7e3e('0x69')]){return'';}for(var _0x90fcd2='(',_0x48ed9e=0x0;_0x48ed9e<_0x32d65c[_0x7e3e('0x68')]['length'];_0x48ed9e+=0x1){_0x48ed9e>0x0&&(_0x90fcd2+='\x20'+_0x32d65c[_0x7e3e('0x89')]+'\x20');_0x90fcd2+=_0x32d65c['rules'][_0x48ed9e]['group']?_0x53afe7(_0x32d65c[_0x7e3e('0x68')][_0x48ed9e][_0x7e3e('0x6a')]):_0x32d65c[_0x7e3e('0x68')][_0x48ed9e][_0x7e3e('0x74')]+'\x20'+_0x32d65c[_0x7e3e('0x68')][_0x48ed9e][_0x7e3e('0x6b')]+(_0x221511(_0x32d65c['rules'][_0x48ed9e][_0x7e3e('0x6b')])?'\x20'+_0x32d65c['rules'][_0x48ed9e]['value']:'');}return _0x90fcd2+')';};var _0x460b07={'where':{'id':_0x498fab[_0x7e3e('0x4a')]['id']}},_0x17f769,_0x27b1a8,_0x14b123,_0x238495,_0x1dd59e;_0x460b07=_[_0x7e3e('0x42')]({},_0x460b07,_0x498fab[_0x7e3e('0x45')]);return db[_0x7e3e('0x30')][_0x7e3e('0x4c')](_0x460b07)[_0x7e3e('0x24')](function(_0x2edc81){if(_0x2edc81){_0x17f769=_0x2edc81;return _0x2edc81[_0x7e3e('0x8a')]();}return null;})['then'](function(_0x280031){if(_0x280031){if(!_0x280031[_0x7e3e('0x69')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x27b1a8=_0x280031;return db[_0x7e3e('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x7e3e('0x24')](function(_0x4dc56e){if(_0x4dc56e){_0x14b123=_['keyBy'](_0x4dc56e,'id');var _0x26133f;var _0x492aaa=squel[_0x7e3e('0x70')]();_0x492aaa['from'](_0x17f769[_0x7e3e('0x72')]);for(var _0xf21490=0x0;_0xf21490<_0x27b1a8[_0x7e3e('0x69')];_0xf21490+=0x1){_0x26133f=_0x27b1a8[_0xf21490][_0x7e3e('0x73')]?_0x14b123[_0x27b1a8[_0xf21490][_0x7e3e('0x73')]][_0x7e3e('0x8c')]:_0x27b1a8[_0xf21490][_0x7e3e('0x74')];_0x26133f=_0x27b1a8[_0xf21490]['function']?_[_0x7e3e('0x76')](_0x370e92[_0x27b1a8[_0xf21490][_0x7e3e('0x75')]],'%s',_0x26133f):_0x26133f;_0x26133f=_0x27b1a8[_0xf21490]['format']?_[_0x7e3e('0x76')](_0xc221f[_0x27b1a8[_0xf21490]['format']],'%s',_0x26133f):_0x26133f;if(_0x27b1a8[_0xf21490][_0x7e3e('0x78')]){_0x492aaa[_0x7e3e('0x6a')](_0x26133f);}_0x27b1a8[_0xf21490][_0x7e3e('0x79')]&&_0x492aaa['order'](_0x26133f,_0x27b1a8[_0xf21490][_0x7e3e('0x79')]===_0x7e3e('0x8d')?![]:!![]);_0x492aaa[_0x7e3e('0x74')](_0x26133f,_0x27b1a8[_0xf21490][_0x7e3e('0x7a')]||_0x26133f);}if(_0x17f769[_0x7e3e('0x7b')]){_0x17f769[_0x7e3e('0x7b')]=JSON[_0x7e3e('0x7c')](_0x17f769[_0x7e3e('0x7b')]);for(var _0x123e20=0x0;_0x123e20<_0x17f769['joins']['length'];_0x123e20+=0x1){if(_0x17f769['joins'][_0x123e20][_0x7e3e('0x43')]&&_['includes'](_0x29fe13,_0x17f769['joins'][_0x123e20][_0x7e3e('0x43')])&&_0x17f769[_0x7e3e('0x7b')][_0x123e20][_0x7e3e('0x7d')]&&_0x17f769[_0x7e3e('0x7b')][_0x123e20][_0x7e3e('0x7e')]&&_0x17f769['joins'][_0x123e20][_0x7e3e('0x7f')]){_0x492aaa[_0x17f769[_0x7e3e('0x7b')][_0x123e20][_0x7e3e('0x43')]](_0x17f769[_0x7e3e('0x7b')][_0x123e20]['foreignTable'],null,util[_0x7e3e('0x77')](_0x7e3e('0x80'),_0x17f769[_0x7e3e('0x72')],_0x17f769[_0x7e3e('0x7b')][_0x123e20][_0x7e3e('0x7d')],_0x17f769[_0x7e3e('0x7b')][_0x123e20]['foreignTable'],_0x17f769[_0x7e3e('0x7b')][_0x123e20][_0x7e3e('0x7f')]));}}}if(_0x17f769[_0x7e3e('0x81')]){_0x17f769[_0x7e3e('0x81')]=JSON['parse'](_0x17f769['conditions']);_0x492aaa[_0x7e3e('0x40')](_0x53afe7(_0x17f769[_0x7e3e('0x81')][_0x7e3e('0x6a')]));}_0x1dd59e=_0x492aaa[_0x7e3e('0x82')]();_0x492aaa[_0x7e3e('0x3d')](_0x572f3f);_0x492aaa['offset'](0x0);logger['debug']('Limited\x20Query:',_0x492aaa[_0x7e3e('0x83')]());return dbH[_0x7e3e('0x84')][_0x7e3e('0x35')](_0x492aaa[_0x7e3e('0x83')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x7e3e('0x24')](function(){return{'sql':_0x1dd59e[_0x7e3e('0x83')]()};})[_0x7e3e('0x24')](respondWithResult(_0x1d5200,null))[_0x7e3e('0x49')](handleError(_0x1d5200,null));}; \ No newline at end of file +var _0xe45c=['order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','CustomReports','error','body','preview','join','left_join','right_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','cross_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NULL','getFields','Please\x20insert\x20at\x20least\x20one\x20field','select','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','status','json','offset','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','sendStatus','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x449b54,_0x3776f3){var _0x32d6b9=function(_0xbce7c4){while(--_0xbce7c4){_0x449b54['push'](_0x449b54['shift']());}};_0x32d6b9(++_0x3776f3);}(_0xe45c,0x6d));var _0xce45=function(_0x4c6a2e,_0xd6b681){_0x4c6a2e=_0x4c6a2e-0x0;var _0x1e5a1a=_0xe45c[_0x4c6a2e];return _0x1e5a1a;};'use strict';var emlformat=require(_0xce45('0x0'));var rimraf=require(_0xce45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce45('0x2'));var rp=require(_0xce45('0x3'));var moment=require(_0xce45('0x4'));var BPromise=require(_0xce45('0x5'));var Mustache=require(_0xce45('0x6'));var util=require(_0xce45('0x7'));var path=require(_0xce45('0x8'));var sox=require(_0xce45('0x9'));var csv=require(_0xce45('0xa'));var ejs=require(_0xce45('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce45('0xc'));var squel=require(_0xce45('0xd'));var crypto=require(_0xce45('0xe'));var jsforce=require(_0xce45('0xf'));var deskjs=require(_0xce45('0x10'));var toCsv=require(_0xce45('0xa'));var querystring=require(_0xce45('0x11'));var Papa=require(_0xce45('0x12'));var Redis=require(_0xce45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xce45('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce45('0x15'));var logger=require('../../config/logger')(_0xce45('0x16'));var utils=require(_0xce45('0x17'));var config=require(_0xce45('0x18'));var licenseUtil=require(_0xce45('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0xce45('0x1a'))[_0xce45('0x1b')];function respondWithStatusCode(_0x3846bf,_0x5f5917){_0x5f5917=_0x5f5917||0xcc;return function(_0x2798ed){if(_0x2798ed){return _0x3846bf['sendStatus'](_0x5f5917);}return _0x3846bf['status'](_0x5f5917)[_0xce45('0x1c')]();};}function respondWithResult(_0x3dac2a,_0x44dbca){_0x44dbca=_0x44dbca||0xc8;return function(_0xb90750){if(_0xb90750){return _0x3dac2a[_0xce45('0x1d')](_0x44dbca)[_0xce45('0x1e')](_0xb90750);}};}function respondWithFilteredResult(_0x4906f8,_0x34e196){return function(_0xdef3cc){if(_0xdef3cc){var _0x318037=typeof _0x34e196[_0xce45('0x1f')]==='undefined'&&typeof _0x34e196[_0xce45('0x20')]==='undefined';var _0x263393=_0xdef3cc[_0xce45('0x21')];var _0x358c7e=_0x318037?0x0:_0x34e196['offset'];var _0x2fad74=_0x318037?_0xdef3cc[_0xce45('0x21')]:_0x34e196[_0xce45('0x1f')]+_0x34e196[_0xce45('0x20')];var _0x4a24eb;if(_0x2fad74>=_0x263393){_0x2fad74=_0x263393;_0x4a24eb=0xc8;}else{_0x4a24eb=0xce;}_0x4906f8[_0xce45('0x1d')](_0x4a24eb);return _0x4906f8[_0xce45('0x22')](_0xce45('0x23'),_0x358c7e+'-'+_0x2fad74+'/'+_0x263393)['json'](_0xdef3cc);}return null;};}function patchUpdates(_0x3dbdc4){return function(_0x1700f9){try{jsonpatch['apply'](_0x1700f9,_0x3dbdc4,!![]);}catch(_0x523044){return BPromise['reject'](_0x523044);}return _0x1700f9['save']();};}function saveUpdates(_0x35a6bb,_0x1d73d9){return function(_0x24deb6){if(_0x24deb6){return _0x24deb6[_0xce45('0x24')](_0x35a6bb)[_0xce45('0x25')](function(_0x135dae){return _0x135dae;});}return null;};}function removeEntity(_0x60a333,_0x3af291){return function(_0x509795){if(_0x509795){return _0x509795[_0xce45('0x26')]()[_0xce45('0x25')](function(){var _0xc84907=_0x509795[_0xce45('0x27')]({'plain':!![]});var _0x311e8b='CustomReports';return db[_0xce45('0x28')][_0xce45('0x26')]({'where':{'type':_0x311e8b,'resourceId':_0xc84907['id']}})['then'](function(){return _0x509795;});})[_0xce45('0x25')](function(){_0x60a333[_0xce45('0x1d')](0xcc)[_0xce45('0x1c')]();});}};}function handleEntityNotFound(_0x3d0b4f,_0x46cb73){return function(_0x6b4121){if(!_0x6b4121){_0x3d0b4f[_0xce45('0x29')](0x194);}return _0x6b4121;};}function handleError(_0x190ee6,_0x2ccff1){_0x2ccff1=_0x2ccff1||0x1f4;return function(_0x4535ed){logger['error'](_0x4535ed['stack']);if(_0x4535ed[_0xce45('0x2a')]){delete _0x4535ed[_0xce45('0x2a')];}_0x190ee6['status'](_0x2ccff1)['send'](_0x4535ed);};}exports[_0xce45('0x2b')]=function(_0x3ca283,_0x97d1d4){var _0x4d43bf={},_0x3c0a77={},_0x54397c={'count':0x0,'rows':[]};var _0x19612d=_[_0xce45('0x2c')](db[_0xce45('0x2d')][_0xce45('0x2e')],function(_0x1db44d){return{'name':_0x1db44d[_0xce45('0x2f')],'type':_0x1db44d[_0xce45('0x30')][_0xce45('0x31')]};});_0x3c0a77['model']=_[_0xce45('0x2c')](_0x19612d,_0xce45('0x2a'));_0x3c0a77[_0xce45('0x32')]=_[_0xce45('0x33')](_0x3ca283['query']);_0x3c0a77['filters']=_[_0xce45('0x34')](_0x3c0a77[_0xce45('0x35')],_0x3c0a77[_0xce45('0x32')]);_0x4d43bf['attributes']=_[_0xce45('0x34')](_0x3c0a77[_0xce45('0x35')],qs['fields'](_0x3ca283['query'][_0xce45('0x36')]));_0x4d43bf[_0xce45('0x37')]=_0x4d43bf[_0xce45('0x37')][_0xce45('0x38')]?_0x4d43bf[_0xce45('0x37')]:_0x3c0a77['model'];if(!_0x3ca283[_0xce45('0x32')][_0xce45('0x39')]('nolimit')){_0x4d43bf[_0xce45('0x20')]=qs[_0xce45('0x20')](_0x3ca283[_0xce45('0x32')][_0xce45('0x20')]);_0x4d43bf[_0xce45('0x1f')]=qs[_0xce45('0x1f')](_0x3ca283[_0xce45('0x32')][_0xce45('0x1f')]);}_0x4d43bf[_0xce45('0x3a')]=qs[_0xce45('0x3b')](_0x3ca283[_0xce45('0x32')][_0xce45('0x3b')]);_0x4d43bf[_0xce45('0x3c')]=qs[_0xce45('0x3d')](_['pick'](_0x3ca283['query'],_0x3c0a77['filters']),_0x19612d);if(_0x3ca283[_0xce45('0x32')][_0xce45('0x3e')]){_0x4d43bf[_0xce45('0x3c')]=_['merge'](_0x4d43bf[_0xce45('0x3c')],{'$or':_[_0xce45('0x2c')](_0x19612d,function(_0x345267){if(_0x345267[_0xce45('0x30')]!==_0xce45('0x3f')){var _0x2d73dd={};_0x2d73dd[_0x345267[_0xce45('0x2a')]]={'$like':'%'+_0x3ca283[_0xce45('0x32')][_0xce45('0x3e')]+'%'};return _0x2d73dd;}})});}_0x4d43bf=_[_0xce45('0x40')]({},_0x4d43bf,_0x3ca283[_0xce45('0x41')]);var _0x1532c8={'where':_0x4d43bf[_0xce45('0x3c')]};return db['AnalyticCustomReport'][_0xce45('0x21')](_0x1532c8)[_0xce45('0x25')](function(_0x431112){_0x54397c[_0xce45('0x21')]=_0x431112;if(_0x3ca283[_0xce45('0x32')][_0xce45('0x42')]){_0x4d43bf[_0xce45('0x43')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xce45('0x44')](_0x4d43bf);})[_0xce45('0x25')](function(_0x5eb2b8){_0x54397c[_0xce45('0x45')]=_0x5eb2b8;return _0x54397c;})[_0xce45('0x25')](respondWithFilteredResult(_0x97d1d4,_0x4d43bf))['catch'](handleError(_0x97d1d4,null));};exports['show']=function(_0x5cd778,_0x484b8f){var _0x4326d2={'raw':![],'where':{'id':_0x5cd778[_0xce45('0x46')]['id']}},_0x246df6={};_0x246df6[_0xce45('0x35')]=_[_0xce45('0x33')](db[_0xce45('0x2d')][_0xce45('0x2e')]);_0x246df6[_0xce45('0x32')]=_[_0xce45('0x33')](_0x5cd778[_0xce45('0x32')]);_0x246df6[_0xce45('0x3d')]=_[_0xce45('0x34')](_0x246df6[_0xce45('0x35')],_0x246df6['query']);_0x4326d2['attributes']=_[_0xce45('0x34')](_0x246df6['model'],qs['fields'](_0x5cd778['query'][_0xce45('0x36')]));_0x4326d2[_0xce45('0x37')]=_0x4326d2['attributes'][_0xce45('0x38')]?_0x4326d2[_0xce45('0x37')]:_0x246df6[_0xce45('0x35')];if(_0x5cd778[_0xce45('0x32')][_0xce45('0x42')]){_0x4326d2['include']=[{'all':!![]}];}_0x4326d2=_['merge']({},_0x4326d2,_0x5cd778[_0xce45('0x41')]);return db[_0xce45('0x2d')]['find'](_0x4326d2)[_0xce45('0x25')](handleEntityNotFound(_0x484b8f,null))['then'](respondWithResult(_0x484b8f,null))[_0xce45('0x47')](handleError(_0x484b8f,null));};exports[_0xce45('0x48')]=function(_0x346f71,_0x5c6688){return db[_0xce45('0x2d')][_0xce45('0x48')](_0x346f71['body'],{})[_0xce45('0x25')](function(_0x221d89){var _0x573771=_0x346f71[_0xce45('0x49')][_0xce45('0x27')]({'plain':!![]});if(!_0x573771)throw new Error(_0xce45('0x4a'));if(_0x573771[_0xce45('0x4b')]==='user'){var _0x648320=_0x221d89[_0xce45('0x27')]({'plain':!![]});var _0x5c3663=_0xce45('0x4c');return db['UserProfileSection'][_0xce45('0x4d')]({'where':{'name':_0x5c3663,'userProfileId':_0x573771[_0xce45('0x4e')]},'raw':!![]})[_0xce45('0x25')](function(_0x72df){if(_0x72df&&_0x72df[_0xce45('0x4f')]===0x0){return db[_0xce45('0x28')][_0xce45('0x48')]({'name':_0x648320[_0xce45('0x2a')],'resourceId':_0x648320['id'],'type':_0xce45('0x50'),'sectionId':_0x72df['id']},{})[_0xce45('0x25')](function(){return _0x221d89;});}else{return _0x221d89;}})[_0xce45('0x47')](function(_0x35cc5a){logger[_0xce45('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35cc5a);throw _0x35cc5a;});}return _0x221d89;})[_0xce45('0x25')](respondWithResult(_0x5c6688,0xc9))[_0xce45('0x47')](handleError(_0x5c6688,null));};exports[_0xce45('0x24')]=function(_0x221c46,_0x432a84){if(_0x221c46['body']['id']){delete _0x221c46[_0xce45('0x52')]['id'];}return db[_0xce45('0x2d')][_0xce45('0x4d')]({'where':{'id':_0x221c46[_0xce45('0x46')]['id']}})[_0xce45('0x25')](handleEntityNotFound(_0x432a84,null))['then'](saveUpdates(_0x221c46[_0xce45('0x52')],null))[_0xce45('0x25')](respondWithResult(_0x432a84,null))[_0xce45('0x47')](handleError(_0x432a84,null));};exports['destroy']=function(_0x4e5a05,_0x599bdd){return db[_0xce45('0x2d')][_0xce45('0x4d')]({'where':{'id':_0x4e5a05[_0xce45('0x46')]['id']}})['then'](handleEntityNotFound(_0x599bdd,null))[_0xce45('0x25')](removeEntity(_0x599bdd,null))['catch'](handleError(_0x599bdd,null));};exports[_0xce45('0x53')]=function(_0x51f925,_0x2f6356){var _0x3e3ab6=0xa;var _0x49c032=[_0xce45('0x54'),_0xce45('0x55'),_0xce45('0x56'),'cross_join'];var _0x312ca7={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xce45('0x57'),'MAX':_0xce45('0x58'),'MIN':_0xce45('0x59'),'AVG':_0xce45('0x5a'),'GROUP_CONCAT':_0xce45('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4be7c2={'SEC_TO_TIME':_0xce45('0x5c'),'DATE':_0xce45('0x5d'),'HOUR':_0xce45('0x5e'),'ROUND':_0xce45('0x5f'),'UNIX_TIMESTAMP':_0xce45('0x60')};var _0x36bd68=function(_0x1ebcd1){return!_[_0xce45('0x61')](['IS\x20NULL',_0xce45('0x62'),_0xce45('0x63'),_0xce45('0x64')],_0x1ebcd1);};var _0x2f03d3=function(_0x537807){if(!_0x537807||!_0x537807['rules'][_0xce45('0x38')]){return'';}for(var _0x27a925='(',_0x2f885c=0x0;_0x2f885c<_0x537807['rules'][_0xce45('0x38')];_0x2f885c+=0x1){_0x2f885c>0x0&&(_0x27a925+='\x20'+_0x537807[_0xce45('0x65')]+'\x20');_0x27a925+=_0x537807['rules'][_0x2f885c]['group']?_0x2f03d3(_0x537807[_0xce45('0x66')][_0x2f885c][_0xce45('0x67')]):_0x537807['rules'][_0x2f885c][_0xce45('0x68')]+'\x20'+_0x537807[_0xce45('0x66')][_0x2f885c][_0xce45('0x69')]+(_0x36bd68(_0x537807[_0xce45('0x66')][_0x2f885c][_0xce45('0x69')])?'\x20'+_0x537807[_0xce45('0x66')][_0x2f885c][_0xce45('0x6a')]:'');}return _0x27a925+')';};var _0x4c4d63={'where':{'id':_0x51f925[_0xce45('0x46')]['id']}},_0x3e8f22,_0x460871,_0x411342,_0x1dbe16,_0x3ba720;_0x4c4d63=_[_0xce45('0x40')]({},_0x4c4d63,_0x51f925[_0xce45('0x41')]);return db[_0xce45('0x2d')][_0xce45('0x4d')](_0x4c4d63)[_0xce45('0x25')](function(_0x5c484a){if(_0x5c484a){_0x3e8f22=_0x5c484a;return _0x5c484a['getFields']();}return null;})[_0xce45('0x25')](function(_0x1e501e){if(_0x1e501e){if(!_0x1e501e[_0xce45('0x38')]){throw new db[(_0xce45('0x6b'))][(_0xce45('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x460871=_0x1e501e;return db[_0xce45('0x6d')][_0xce45('0x44')]({'raw':!![]});}return null;})['then'](function(_0x49c1d4){if(_0x49c1d4){_0x411342=_[_0xce45('0x6e')](_0x49c1d4,'id');var _0x2eb198;var _0x58eb10=squel['select']();_0x58eb10[_0xce45('0x6f')](_0x3e8f22[_0xce45('0x70')]);for(var _0x1dddd2=0x0;_0x1dddd2<_0x460871[_0xce45('0x38')];_0x1dddd2+=0x1){_0x2eb198=_0x460871[_0x1dddd2][_0xce45('0x71')]?_0x411342[_0x460871[_0x1dddd2][_0xce45('0x71')]][_0xce45('0x72')]:_0x460871[_0x1dddd2]['field'];_0x2eb198=_0x460871[_0x1dddd2][_0xce45('0x73')]?_['replace'](_0x312ca7[_0x460871[_0x1dddd2]['function']],'%s',_0x2eb198):_0x2eb198;_0x2eb198=_0x460871[_0x1dddd2][_0xce45('0x74')]?_[_0xce45('0x75')](_0x4be7c2[_0x460871[_0x1dddd2][_0xce45('0x74')]],'%s',_0x2eb198):_0x2eb198;if(_0x460871[_0x1dddd2][_0xce45('0x76')]){_0x58eb10[_0xce45('0x67')](_0x2eb198);}_0x460871[_0x1dddd2][_0xce45('0x77')]&&_0x58eb10[_0xce45('0x3a')](_0x2eb198,_0x460871[_0x1dddd2][_0xce45('0x77')]===_0xce45('0x78')?![]:!![]);_0x58eb10[_0xce45('0x68')](_0x2eb198,_0x460871[_0x1dddd2][_0xce45('0x79')]||_0x2eb198);}if(_0x3e8f22[_0xce45('0x7a')]){_0x3e8f22['joins']=JSON[_0xce45('0x7b')](_0x3e8f22[_0xce45('0x7a')]);for(var _0x22c67a=0x0;_0x22c67a<_0x3e8f22[_0xce45('0x7a')][_0xce45('0x38')];_0x22c67a+=0x1){if(_0x3e8f22['joins'][_0x22c67a]['type']&&_['includes'](_0x49c032,_0x3e8f22[_0xce45('0x7a')][_0x22c67a][_0xce45('0x30')])&&_0x3e8f22[_0xce45('0x7a')][_0x22c67a][_0xce45('0x7c')]&&_0x3e8f22['joins'][_0x22c67a][_0xce45('0x7d')]&&_0x3e8f22[_0xce45('0x7a')][_0x22c67a][_0xce45('0x7e')]){_0x58eb10[_0x3e8f22[_0xce45('0x7a')][_0x22c67a][_0xce45('0x30')]](_0x3e8f22[_0xce45('0x7a')][_0x22c67a][_0xce45('0x7d')],null,util[_0xce45('0x74')]('%s.%s\x20=\x20%s.%s',_0x3e8f22[_0xce45('0x70')],_0x3e8f22[_0xce45('0x7a')][_0x22c67a][_0xce45('0x7c')],_0x3e8f22[_0xce45('0x7a')][_0x22c67a][_0xce45('0x7d')],_0x3e8f22[_0xce45('0x7a')][_0x22c67a][_0xce45('0x7e')]));}}}if(_0x3e8f22['conditions']){_0x3e8f22[_0xce45('0x7f')]=JSON[_0xce45('0x7b')](_0x3e8f22[_0xce45('0x7f')]);_0x58eb10[_0xce45('0x3c')](_0x2f03d3(_0x3e8f22[_0xce45('0x7f')][_0xce45('0x67')]));}_0x3ba720=_0x58eb10[_0xce45('0x80')]();_0x58eb10[_0xce45('0x20')](_0x3e3ab6);_0x58eb10[_0xce45('0x1f')](0x0);logger[_0xce45('0x81')](_0xce45('0x82'),_0x58eb10[_0xce45('0x83')]());return dbH[_0xce45('0x84')][_0xce45('0x32')](_0x58eb10[_0xce45('0x83')](),{'type':dbH[_0xce45('0x84')]['QueryTypes'][_0xce45('0x85')]});}})['then'](respondWithResult(_0x2f6356,null))['catch'](handleError(_0x2f6356,null));};function runReport(_0x307a85,_0x1b868f,_0x381b90){var _0x1d4abb=_0x1b868f[_0xce45('0x2a')];var _0x5b02ed=0xa;var _0x4e8899=[_0xce45('0x54'),_0xce45('0x55'),_0xce45('0x56'),_0xce45('0x86')];var _0x3dc50e={'SUM':_0xce45('0x87'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xce45('0x58'),'MIN':_0xce45('0x59'),'AVG':_0xce45('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xce45('0x88'),'GROUP_CONCAT DESC':_0xce45('0x89')};var _0x3c88e8={'SEC_TO_TIME':_0xce45('0x5c'),'DATE':_0xce45('0x5d'),'HOUR':_0xce45('0x5e'),'ROUND':_0xce45('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x38e72a=function(_0x127ddf){return!_[_0xce45('0x61')]([_0xce45('0x8a'),_0xce45('0x62'),_0xce45('0x63'),'IS\x20NOT\x20EMPTY'],_0x127ddf);};var _0x40ed47=function(_0x2ac7d0){if(!_0x2ac7d0||!_0x2ac7d0['rules']['length']){return'';}for(var _0x478c5b='(',_0x1cb6c8=0x0;_0x1cb6c8<_0x2ac7d0['rules'][_0xce45('0x38')];_0x1cb6c8+=0x1){_0x1cb6c8>0x0&&(_0x478c5b+='\x20'+_0x2ac7d0[_0xce45('0x65')]+'\x20');_0x478c5b+=_0x2ac7d0[_0xce45('0x66')][_0x1cb6c8][_0xce45('0x67')]?_0x40ed47(_0x2ac7d0['rules'][_0x1cb6c8][_0xce45('0x67')]):_0x2ac7d0['rules'][_0x1cb6c8][_0xce45('0x68')]+'\x20'+_0x2ac7d0[_0xce45('0x66')][_0x1cb6c8][_0xce45('0x69')]+(_0x38e72a(_0x2ac7d0[_0xce45('0x66')][_0x1cb6c8][_0xce45('0x69')])?'\x20'+_0x2ac7d0['rules'][_0x1cb6c8]['value']:'');}return _0x478c5b+')';};var _0x3f41f7={'where':{'id':_0x307a85['id']}},_0x40e72a,_0x5c4b16,_0x4bbb2e,_0x4d9a76,_0x53718d;_0x3f41f7=_[_0xce45('0x40')]({},_0x3f41f7,_0x381b90);return db[_0xce45('0x2d')]['find'](_0x3f41f7)[_0xce45('0x25')](function(_0x5c7787){if(_0x5c7787){_0x40e72a=_0x5c7787;return _0x5c7787[_0xce45('0x8b')]();}return null;})[_0xce45('0x25')](function(_0x3abd3e){if(_0x3abd3e){if(!_0x3abd3e[_0xce45('0x38')]){throw new db[(_0xce45('0x6b'))][(_0xce45('0x6c'))](_0xce45('0x8c'),0x193);}_0x5c4b16=_0x3abd3e;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xce45('0x25')](function(_0x116389){if(_0x116389){_0x4bbb2e=_[_0xce45('0x6e')](_0x116389,'id');var _0x1f2020;var _0x1f48eb=squel[_0xce45('0x8d')]();_0x1f48eb[_0xce45('0x6f')](_0x40e72a[_0xce45('0x70')]);for(var _0x4bfcf8=0x0;_0x4bfcf8<_0x5c4b16[_0xce45('0x38')];_0x4bfcf8+=0x1){_0x1f2020=_0x5c4b16[_0x4bfcf8][_0xce45('0x71')]?_0x4bbb2e[_0x5c4b16[_0x4bfcf8][_0xce45('0x71')]]['metric']:_0x5c4b16[_0x4bfcf8][_0xce45('0x68')];_0x1f2020=_0x5c4b16[_0x4bfcf8]['function']?_['replace'](_0x3dc50e[_0x5c4b16[_0x4bfcf8][_0xce45('0x73')]],'%s',_0x1f2020):_0x1f2020;_0x1f2020=_0x5c4b16[_0x4bfcf8][_0xce45('0x74')]?_['replace'](_0x3c88e8[_0x5c4b16[_0x4bfcf8][_0xce45('0x74')]],'%s',_0x1f2020):_0x1f2020;if(_0x5c4b16[_0x4bfcf8][_0xce45('0x76')]){_0x1f48eb['group'](_0x1f2020);}_0x5c4b16[_0x4bfcf8][_0xce45('0x77')]&&_0x1f48eb[_0xce45('0x3a')](_0x1f2020,_0x5c4b16[_0x4bfcf8][_0xce45('0x77')]===_0xce45('0x78')?![]:!![]);_0x1f48eb[_0xce45('0x68')](_0x1f2020,_0x5c4b16[_0x4bfcf8]['alias']||_0x1f2020);}if(_0x40e72a[_0xce45('0x7a')]){_0x40e72a[_0xce45('0x7a')]=JSON[_0xce45('0x7b')](_0x40e72a[_0xce45('0x7a')]);for(var _0x4a06aa=0x0;_0x4a06aa<_0x40e72a[_0xce45('0x7a')][_0xce45('0x38')];_0x4a06aa+=0x1){if(_0x40e72a[_0xce45('0x7a')][_0x4a06aa][_0xce45('0x30')]&&_[_0xce45('0x61')](_0x4e8899,_0x40e72a[_0xce45('0x7a')][_0x4a06aa][_0xce45('0x30')])&&_0x40e72a[_0xce45('0x7a')][_0x4a06aa][_0xce45('0x7c')]&&_0x40e72a[_0xce45('0x7a')][_0x4a06aa]['foreignTable']&&_0x40e72a[_0xce45('0x7a')][_0x4a06aa][_0xce45('0x7e')]){_0x1f48eb[_0x40e72a['joins'][_0x4a06aa][_0xce45('0x30')]](_0x40e72a[_0xce45('0x7a')][_0x4a06aa][_0xce45('0x7d')],null,util[_0xce45('0x74')](_0xce45('0x8e'),_0x40e72a[_0xce45('0x70')],_0x40e72a[_0xce45('0x7a')][_0x4a06aa]['parentKey'],_0x40e72a['joins'][_0x4a06aa][_0xce45('0x7d')],_0x40e72a[_0xce45('0x7a')][_0x4a06aa]['foreignKey']));}}}if(_0x40e72a[_0xce45('0x7f')]){_0x40e72a['conditions']=JSON['parse'](_0x40e72a[_0xce45('0x7f')]);_0x1f48eb[_0xce45('0x3c')](_0x40ed47(_0x40e72a[_0xce45('0x7f')][_0xce45('0x67')]));}_0x53718d=_0x1f48eb[_0xce45('0x80')]();_0x1f48eb[_0xce45('0x20')](_0x5b02ed);_0x1f48eb[_0xce45('0x1f')](0x0);return;}})[_0xce45('0x25')](function(){if(_0x1b868f[_0xce45('0x8f')]===_0xce45('0x90')){return null;}var _0x543227=_[_0xce45('0x40')](_0x1b868f,{'name':_0x1b868f[_0xce45('0x91')]||_0x1b868f[_0xce45('0x2a')]||_0x40e72a[_0xce45('0x2a')],'basename':_0x1d4abb,'savename':util[_0xce45('0x74')](_0xce45('0x92'),_0x1b868f[_0xce45('0x2a')]||_0x40e72a[_0xce45('0x2a')],require('randomstring')[_0xce45('0x93')](0x4),_0x1b868f['output']||_0xce45('0x94')),'reportId':_0x40e72a['id'],'reportType':_0xce45('0x95')});return db[_0xce45('0x96')][_0xce45('0x48')](_0x543227,{'raw':!![]});})[_0xce45('0x25')](function(_0x30476e){if(_0x40e72a[_0xce45('0x70')]===_0xce45('0x97')){_0x53718d[_0xce45('0x3c')](_0x40e72a[_0xce45('0x70')]+_0xce45('0x98'),_0x1b868f[_0xce45('0x99')],_0x1b868f[_0xce45('0x9a')]);}else{_0x53718d[_0xce45('0x3c')](_0x40e72a[_0xce45('0x70')]+_0xce45('0x9b'),_0x1b868f[_0xce45('0x99')],_0x1b868f[_0xce45('0x9a')]);}if(_0x30476e){logger[_0xce45('0x9c')](_0xce45('0x9d'),_0x53718d['toString']());require(_0xce45('0x9e'))[_0xce45('0x9f')](path[_0xce45('0x54')](__dirname,_0xce45('0xa0'),_0x30476e[_0xce45('0x8f')]),[_0x30476e['id'],_0x53718d[_0xce45('0x83')](),path[_0xce45('0x54')](__dirname,_0xce45('0xa1'),_0x30476e['savename']),_0x1d4abb]);return _0x30476e;}else{var _0xa977cb=squel['select']();_0xa977cb[_0xce45('0x6f')]('('+_0x53718d[_0xce45('0x83')]()+')',_0xce45('0xa2'));_0xa977cb[_0xce45('0x68')](_0xce45('0xa3'),_0xce45('0x21'));_0x53718d['limit'](_0x1b868f[_0xce45('0x20')]||_0x5b02ed);_0x53718d[_0xce45('0x1f')](_0x1b868f[_0xce45('0x1f')]||0x0);return dbH['sequelize'][_0xce45('0x32')](_0xa977cb[_0xce45('0x83')](),{'type':dbH[_0xce45('0x84')][_0xce45('0xa4')][_0xce45('0x85')]})[_0xce45('0x25')](function(_0x5584b5){if(!_0x5584b5[_0xce45('0x38')]){_0x4d9a76=0x0;}else{_0x4d9a76=_0x5584b5[0x0][_0xce45('0x21')]||0x0;}return dbH[_0xce45('0x84')][_0xce45('0x32')](_0x53718d[_0xce45('0x83')](),{'type':dbH[_0xce45('0x84')][_0xce45('0xa4')][_0xce45('0x85')]});})[_0xce45('0x25')](function(_0x5afae9){return{'rows':_0x5afae9||[],'count':_0x4d9a76};});}});}exports[_0xce45('0xa5')]=function(_0x26719e,_0x4405c0){return runReport(_0x26719e[_0xce45('0x46')],_0x26719e[_0xce45('0x32')],_0x26719e['options'])['then'](respondWithResult(_0x4405c0,null))[_0xce45('0x47')](handleError(_0x4405c0,null));};exports[_0xce45('0xa6')]=runReport;exports[_0xce45('0x32')]=function(_0x2f8ee5,_0x2a31d2){var _0xeaff6c=0xa;var _0x5d3f41=['join',_0xce45('0x55'),_0xce45('0x56'),_0xce45('0x86')];var _0x319098={'SUM':_0xce45('0x87'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xce45('0x58'),'MIN':'MIN(%s)','AVG':_0xce45('0x5a'),'GROUP_CONCAT':_0xce45('0x5b'),'GROUP_CONCAT ASC':_0xce45('0x88'),'GROUP_CONCAT DESC':_0xce45('0x89')};var _0x13f789={'SEC_TO_TIME':_0xce45('0x5c'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xce45('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x26516e=function(_0x179126){return!_[_0xce45('0x61')]([_0xce45('0x8a'),'IS\x20NOT\x20NULL',_0xce45('0x63'),_0xce45('0x64')],_0x179126);};var _0x1e875b=function(_0x29846f){if(!_0x29846f||!_0x29846f['rules'][_0xce45('0x38')]){return'';}for(var _0x53a96c='(',_0x913fd2=0x0;_0x913fd2<_0x29846f['rules'][_0xce45('0x38')];_0x913fd2+=0x1){_0x913fd2>0x0&&(_0x53a96c+='\x20'+_0x29846f[_0xce45('0x65')]+'\x20');_0x53a96c+=_0x29846f[_0xce45('0x66')][_0x913fd2][_0xce45('0x67')]?_0x1e875b(_0x29846f[_0xce45('0x66')][_0x913fd2]['group']):_0x29846f[_0xce45('0x66')][_0x913fd2]['field']+'\x20'+_0x29846f[_0xce45('0x66')][_0x913fd2][_0xce45('0x69')]+(_0x26516e(_0x29846f[_0xce45('0x66')][_0x913fd2][_0xce45('0x69')])?'\x20'+_0x29846f['rules'][_0x913fd2]['value']:'');}return _0x53a96c+')';};var _0x33789b={'where':{'id':_0x2f8ee5['params']['id']}},_0x1a67fb,_0x15bfc5,_0x80a0dc,_0x20f0bf,_0x1bf228;_0x33789b=_[_0xce45('0x40')]({},_0x33789b,_0x2f8ee5['options']);return db[_0xce45('0x2d')][_0xce45('0x4d')](_0x33789b)[_0xce45('0x25')](function(_0x3eb583){if(_0x3eb583){_0x1a67fb=_0x3eb583;return _0x3eb583[_0xce45('0x8b')]();}return null;})[_0xce45('0x25')](function(_0x13201e){if(_0x13201e){if(!_0x13201e[_0xce45('0x38')]){throw new db[(_0xce45('0x6b'))][(_0xce45('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x15bfc5=_0x13201e;return db[_0xce45('0x6d')][_0xce45('0x44')]({'raw':!![]});}return null;})[_0xce45('0x25')](function(_0x2650dd){if(_0x2650dd){_0x80a0dc=_[_0xce45('0x6e')](_0x2650dd,'id');var _0x4194d5;var _0x2ee1af=squel[_0xce45('0x8d')]();_0x2ee1af['from'](_0x1a67fb['table']);for(var _0x31e867=0x0;_0x31e867<_0x15bfc5[_0xce45('0x38')];_0x31e867+=0x1){_0x4194d5=_0x15bfc5[_0x31e867]['MetricId']?_0x80a0dc[_0x15bfc5[_0x31e867]['MetricId']][_0xce45('0x72')]:_0x15bfc5[_0x31e867][_0xce45('0x68')];_0x4194d5=_0x15bfc5[_0x31e867][_0xce45('0x73')]?_[_0xce45('0x75')](_0x319098[_0x15bfc5[_0x31e867]['function']],'%s',_0x4194d5):_0x4194d5;_0x4194d5=_0x15bfc5[_0x31e867]['format']?_['replace'](_0x13f789[_0x15bfc5[_0x31e867]['format']],'%s',_0x4194d5):_0x4194d5;if(_0x15bfc5[_0x31e867][_0xce45('0x76')]){_0x2ee1af[_0xce45('0x67')](_0x4194d5);}_0x15bfc5[_0x31e867][_0xce45('0x77')]&&_0x2ee1af['order'](_0x4194d5,_0x15bfc5[_0x31e867][_0xce45('0x77')]===_0xce45('0x78')?![]:!![]);_0x2ee1af['field'](_0x4194d5,_0x15bfc5[_0x31e867][_0xce45('0x79')]||_0x4194d5);}if(_0x1a67fb[_0xce45('0x7a')]){_0x1a67fb['joins']=JSON[_0xce45('0x7b')](_0x1a67fb[_0xce45('0x7a')]);for(var _0x1ae026=0x0;_0x1ae026<_0x1a67fb[_0xce45('0x7a')][_0xce45('0x38')];_0x1ae026+=0x1){if(_0x1a67fb['joins'][_0x1ae026]['type']&&_['includes'](_0x5d3f41,_0x1a67fb[_0xce45('0x7a')][_0x1ae026][_0xce45('0x30')])&&_0x1a67fb[_0xce45('0x7a')][_0x1ae026][_0xce45('0x7c')]&&_0x1a67fb[_0xce45('0x7a')][_0x1ae026]['foreignTable']&&_0x1a67fb[_0xce45('0x7a')][_0x1ae026][_0xce45('0x7e')]){_0x2ee1af[_0x1a67fb[_0xce45('0x7a')][_0x1ae026]['type']](_0x1a67fb[_0xce45('0x7a')][_0x1ae026][_0xce45('0x7d')],null,util[_0xce45('0x74')]('%s.%s\x20=\x20%s.%s',_0x1a67fb[_0xce45('0x70')],_0x1a67fb[_0xce45('0x7a')][_0x1ae026][_0xce45('0x7c')],_0x1a67fb['joins'][_0x1ae026][_0xce45('0x7d')],_0x1a67fb[_0xce45('0x7a')][_0x1ae026]['foreignKey']));}}}if(_0x1a67fb[_0xce45('0x7f')]){_0x1a67fb[_0xce45('0x7f')]=JSON[_0xce45('0x7b')](_0x1a67fb['conditions']);_0x2ee1af['where'](_0x1e875b(_0x1a67fb[_0xce45('0x7f')][_0xce45('0x67')]));}_0x1bf228=_0x2ee1af[_0xce45('0x80')]();_0x2ee1af['limit'](_0xeaff6c);_0x2ee1af[_0xce45('0x1f')](0x0);logger[_0xce45('0x81')](_0xce45('0x82'),_0x2ee1af[_0xce45('0x83')]());return dbH[_0xce45('0x84')][_0xce45('0x32')](_0x2ee1af[_0xce45('0x83')](),{'type':dbH[_0xce45('0x84')][_0xce45('0xa4')]['SELECT']});}})[_0xce45('0x25')](function(){return{'sql':_0x1bf228[_0xce45('0x83')]()};})[_0xce45('0x25')](respondWithResult(_0x2a31d2,null))['catch'](handleError(_0x2a31d2,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 56d1def..aafc91a 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.model.js +++ b/server/api/analyticCustomReport/analyticCustomReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd502=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','../../config/logger','moment'];(function(_0x597e6c,_0x37ddaa){var _0x10bc1c=function(_0x1a5fda){while(--_0x1a5fda){_0x597e6c['push'](_0x597e6c['shift']());}};_0x10bc1c(++_0x37ddaa);}(_0xd502,0x135));var _0x2d50=function(_0x5c8628,_0x2fc5f5){_0x5c8628=_0x5c8628-0x0;var _0xcbd50e=_0xd502[_0x5c8628];return _0xcbd50e;};'use strict';var _=require(_0x2d50('0x0'));var util=require('util');var logger=require(_0x2d50('0x1'))('api');var moment=require(_0x2d50('0x2'));var BPromise=require(_0x2d50('0x3'));var rp=require(_0x2d50('0x4'));var fs=require('fs');var path=require(_0x2d50('0x5'));var rimraf=require(_0x2d50('0x6'));var config=require(_0x2d50('0x7'));var attributes=require(_0x2d50('0x8'));module[_0x2d50('0x9')]=function(_0x137dce,_0x1e6624){return _0x137dce[_0x2d50('0xa')](_0x2d50('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bf3=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4bf3,0x19d));var _0x34bf=function(_0x2df698,_0x1ec0d2){_0x2df698=_0x2df698-0x0;var _0x178879=_0x4bf3[_0x2df698];return _0x178879;};'use strict';var _=require(_0x34bf('0x0'));var util=require('util');var logger=require(_0x34bf('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bf('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34bf('0x3'));module[_0x34bf('0x4')]=function(_0x792727,_0x537791){return _0x792727[_0x34bf('0x5')](_0x34bf('0x6'),attributes,{'tableName':_0x34bf('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index b738d66..2cab7c2 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.rpc.js +++ b/server/api/analyticCustomReport/analyticCustomReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf37=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf37,0xfd));var _0x7bf3=function(_0x105a77,_0x39b87b){_0x105a77=_0x105a77-0x0;var _0x3e8155=_0xbf37[_0x105a77];return _0x3e8155;};'use strict';var _=require(_0x7bf3('0x0'));var util=require(_0x7bf3('0x1'));var moment=require(_0x7bf3('0x2'));var BPromise=require(_0x7bf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bf3('0x4'));var db=require(_0x7bf3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bf3('0x6'))(_0x7bf3('0x7'));var config=require('../../config/environment');var jayson=require(_0x7bf3('0x8'));var client=jayson[_0x7bf3('0x9')][_0x7bf3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x386b07,_0x2da045,_0x2ed1de){return new BPromise(function(_0x39a35f,_0x5a5063){return client['request'](_0x386b07,_0x2ed1de)[_0x7bf3('0xb')](function(_0x248bcf){logger[_0x7bf3('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2da045,'request\x20sent');logger['debug'](_0x7bf3('0xd'),_0x2da045,_0x7bf3('0xe'),JSON['stringify'](_0x248bcf));if(_0x248bcf[_0x7bf3('0xf')]){if(_0x248bcf[_0x7bf3('0xf')][_0x7bf3('0x10')]===0x1f4){logger[_0x7bf3('0xf')](_0x7bf3('0x11'),_0x2da045,_0x248bcf[_0x7bf3('0xf')][_0x7bf3('0x12')]);return _0x5a5063(_0x248bcf[_0x7bf3('0xf')][_0x7bf3('0x12')]);}logger[_0x7bf3('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2da045,_0x248bcf[_0x7bf3('0xf')][_0x7bf3('0x12')]);return _0x39a35f(_0x248bcf['error'][_0x7bf3('0x12')]);}else{logger[_0x7bf3('0xc')](_0x7bf3('0x11'),_0x2da045,_0x7bf3('0xe'));_0x39a35f(_0x248bcf[_0x7bf3('0x13')]['message']);}})[_0x7bf3('0x14')](function(_0x81a9eb){logger[_0x7bf3('0xf')](_0x7bf3('0x11'),_0x2da045,_0x81a9eb);_0x5a5063(_0x81a9eb);});});} \ No newline at end of file +var _0xfdd4=['http','request','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x55b481,_0x59cdc1){var _0x2d25a5=function(_0x1936c6){while(--_0x1936c6){_0x55b481['push'](_0x55b481['shift']());}};_0x2d25a5(++_0x59cdc1);}(_0xfdd4,0x1d4));var _0x4fdd=function(_0x3fcc5,_0x5771ad){_0x3fcc5=_0x3fcc5-0x0;var _0x3977fc=_0xfdd4[_0x3fcc5];return _0x3977fc;};'use strict';var _=require(_0x4fdd('0x0'));var util=require(_0x4fdd('0x1'));var moment=require(_0x4fdd('0x2'));var BPromise=require(_0x4fdd('0x3'));var rs=require(_0x4fdd('0x4'));var fs=require('fs');var Redis=require(_0x4fdd('0x5'));var db=require(_0x4fdd('0x6'))['db'];var utils=require(_0x4fdd('0x7'));var logger=require(_0x4fdd('0x8'))(_0x4fdd('0x9'));var config=require(_0x4fdd('0xa'));var jayson=require(_0x4fdd('0xb'));var client=jayson['client'][_0x4fdd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d7059,_0x2156b1,_0x2a0884){return new BPromise(function(_0x1102a6,_0x41ce79){return client[_0x4fdd('0xd')](_0x5d7059,_0x2a0884)['then'](function(_0x49fbf7){logger[_0x4fdd('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2156b1,'request\x20sent');logger[_0x4fdd('0xf')](_0x4fdd('0x10'),_0x2156b1,'request\x20sent',JSON[_0x4fdd('0x11')](_0x49fbf7));if(_0x49fbf7[_0x4fdd('0x12')]){if(_0x49fbf7[_0x4fdd('0x12')][_0x4fdd('0x13')]===0x1f4){logger[_0x4fdd('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2156b1,_0x49fbf7[_0x4fdd('0x12')][_0x4fdd('0x14')]);return _0x41ce79(_0x49fbf7[_0x4fdd('0x12')][_0x4fdd('0x14')]);}logger[_0x4fdd('0x12')](_0x4fdd('0x15'),_0x2156b1,_0x49fbf7['error'][_0x4fdd('0x14')]);return _0x1102a6(_0x49fbf7[_0x4fdd('0x12')][_0x4fdd('0x14')]);}else{logger[_0x4fdd('0xe')](_0x4fdd('0x15'),_0x2156b1,_0x4fdd('0x16'));_0x1102a6(_0x49fbf7['result'][_0x4fdd('0x14')]);}})[_0x4fdd('0x17')](function(_0x283996){logger['error'](_0x4fdd('0x15'),_0x2156b1,_0x283996);_0x41ce79(_0x283996);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 4c80a16..be4a352 100644 --- a/server/api/analyticCustomReport/index.js +++ b/server/api/analyticCustomReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4134=['get','show','preview','isAuthenticated','run','query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0x4134,0x139));var _0x4413=function(_0x13056b,_0x14fe2b){_0x13056b=_0x13056b-0x0;var _0x38b789=_0x4134[_0x13056b];return _0x38b789;};'use strict';var multer=require(_0x4413('0x0'));var util=require(_0x4413('0x1'));var path=require(_0x4413('0x2'));var timeout=require(_0x4413('0x3'));var express=require(_0x4413('0x4'));var router=express['Router']();var fs_extra=require(_0x4413('0x5'));var auth=require(_0x4413('0x6'));var interaction=require(_0x4413('0x7'));var config=require('../../config/environment');var controller=require(_0x4413('0x8'));router[_0x4413('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4413('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4413('0xa')]);router[_0x4413('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x4413('0xb')]);router[_0x4413('0x9')]('/:id/run',auth[_0x4413('0xc')](),controller[_0x4413('0xd')]);router[_0x4413('0x9')]('/:id/query',auth[_0x4413('0xc')](),controller[_0x4413('0xe')]);router[_0x4413('0xf')]('/',auth[_0x4413('0xc')](),controller[_0x4413('0x10')]);router[_0x4413('0x11')](_0x4413('0x12'),auth[_0x4413('0xc')](),controller[_0x4413('0x13')]);router[_0x4413('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4413('0x15')]);module[_0x4413('0x16')]=router; \ No newline at end of file +var _0x20b3=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','/:id/preview','isAuthenticated','preview','run','/:id/query','query','post','create','put','update','delete','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x20b3,0x159));var _0x320b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20b3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x320b('0x0'));var util=require(_0x320b('0x1'));var path=require('path');var timeout=require(_0x320b('0x2'));var express=require(_0x320b('0x3'));var router=express['Router']();var fs_extra=require(_0x320b('0x4'));var auth=require(_0x320b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x320b('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x320b('0x7')]('/',auth['isAuthenticated'](),controller[_0x320b('0x8')]);router[_0x320b('0x7')](_0x320b('0x9'),auth['isAuthenticated'](),controller[_0x320b('0xa')]);router[_0x320b('0x7')](_0x320b('0xb'),auth[_0x320b('0xc')](),controller[_0x320b('0xd')]);router[_0x320b('0x7')]('/:id/run',auth['isAuthenticated'](),controller[_0x320b('0xe')]);router[_0x320b('0x7')](_0x320b('0xf'),auth[_0x320b('0xc')](),controller[_0x320b('0x10')]);router[_0x320b('0x11')]('/',auth[_0x320b('0xc')](),controller[_0x320b('0x12')]);router[_0x320b('0x13')](_0x320b('0x9'),auth[_0x320b('0xc')](),controller[_0x320b('0x14')]);router[_0x320b('0x15')](_0x320b('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x320b('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index ea522e1..aba0cef 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x038b=['exports','STRING','TEXT'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x038b,0x114));var _0xb038=function(_0x31ffde,_0x212061){_0x31ffde=_0x31ffde-0x0;var _0x4ea5dc=_0x038b[_0x31ffde];return _0x4ea5dc;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb038('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb038('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file +var _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x32874f,_0x2b45c6){var _0x5a89c6=function(_0xce908){while(--_0xce908){_0x32874f['push'](_0x32874f['shift']());}};_0x5a89c6(++_0x2b45c6);}(_0x5fab,0x177));var _0xb5fa=function(_0xcd9ece,_0x33ff67){_0xcd9ece=_0xcd9ece-0x0;var _0x36f54f=_0x5fab[_0xcd9ece];return _0x36f54f;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index e68b6cb..7ccdb9e 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','limit','undefined','count','offset','set','json','save','update','then','get','destroy','error','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','order','sort','filter','where','merge','options','includeAll','rows','catch','include','create','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','IS\x20EMPTY','operator','AnalyticMetric','function','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','savename','select','countTable','QueryTypes','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x39f11f,_0xa18250){var _0x387198=function(_0x4d0b1f){while(--_0x4d0b1f){_0x39f11f['push'](_0x39f11f['shift']());}};_0x387198(++_0xa18250);}(_0x187d,0x93));var _0xd187=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x187d[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];var dbH=require(_0xd187('0x1a'))[_0xd187('0x1b')];function respondWithStatusCode(_0x59ee4a,_0x33e3d5){_0x33e3d5=_0x33e3d5||0xcc;return function(_0x18ce42){if(_0x18ce42){return _0x59ee4a[_0xd187('0x1c')](_0x33e3d5);}return _0x59ee4a[_0xd187('0x1d')](_0x33e3d5)['end']();};}function respondWithResult(_0x39a927,_0x2050d5){_0x2050d5=_0x2050d5||0xc8;return function(_0x45ab10){if(_0x45ab10){return _0x39a927[_0xd187('0x1d')](_0x2050d5)['json'](_0x45ab10);}};}function respondWithFilteredResult(_0x245d3e,_0x52a208){return function(_0x5cf218){if(_0x5cf218){var _0x40ed84=typeof _0x52a208['offset']==='undefined'&&typeof _0x52a208[_0xd187('0x1e')]===_0xd187('0x1f');var _0x374fe0=_0x5cf218[_0xd187('0x20')];var _0x21df74=_0x40ed84?0x0:_0x52a208[_0xd187('0x21')];var _0x12b388=_0x40ed84?_0x5cf218[_0xd187('0x20')]:_0x52a208[_0xd187('0x21')]+_0x52a208[_0xd187('0x1e')];var _0x170d5c;if(_0x12b388>=_0x374fe0){_0x12b388=_0x374fe0;_0x170d5c=0xc8;}else{_0x170d5c=0xce;}_0x245d3e[_0xd187('0x1d')](_0x170d5c);return _0x245d3e[_0xd187('0x22')]('Content-Range',_0x21df74+'-'+_0x12b388+'/'+_0x374fe0)[_0xd187('0x23')](_0x5cf218);}return null;};}function patchUpdates(_0x81b988){return function(_0xc5bba5){try{jsonpatch['apply'](_0xc5bba5,_0x81b988,!![]);}catch(_0x5a0360){return BPromise['reject'](_0x5a0360);}return _0xc5bba5[_0xd187('0x24')]();};}function saveUpdates(_0x33741d,_0x249a82){return function(_0x4f62c8){if(_0x4f62c8){return _0x4f62c8[_0xd187('0x25')](_0x33741d)['then'](function(_0x145771){return _0x145771;});}return null;};}function removeEntity(_0x5a7a23,_0x1047f4){return function(_0x54f340){if(_0x54f340){return _0x54f340['destroy']()[_0xd187('0x26')](function(){var _0x4d992b=_0x54f340[_0xd187('0x27')]({'plain':!![]});var _0x598aa4='DefaultReports';return db['UserProfileResource'][_0xd187('0x28')]({'where':{'type':_0x598aa4,'resourceId':_0x4d992b['id']}})[_0xd187('0x26')](function(){return _0x54f340;});})[_0xd187('0x26')](function(){_0x5a7a23[_0xd187('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20ed,_0x2875c8){return function(_0x5c8e52){if(!_0x5c8e52){_0x2a20ed[_0xd187('0x1c')](0x194);}return _0x5c8e52;};}function handleError(_0x1c87ee,_0x34febe){_0x34febe=_0x34febe||0x1f4;return function(_0x4c50a5){logger[_0xd187('0x29')](_0x4c50a5['stack']);if(_0x4c50a5[_0xd187('0x2a')]){delete _0x4c50a5[_0xd187('0x2a')];}_0x1c87ee[_0xd187('0x1d')](_0x34febe)[_0xd187('0x2b')](_0x4c50a5);};}exports['index']=function(_0x140e54,_0xb38778){var _0x5bba10={},_0x4cc587={},_0x1a1922={'count':0x0,'rows':[]};var _0x1836cf=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x2d8843){return{'name':_0x2d8843[_0xd187('0x2f')],'type':_0x2d8843[_0xd187('0x30')]['key']};});_0x4cc587[_0xd187('0x31')]=_[_0xd187('0x2c')](_0x1836cf,_0xd187('0x2a'));_0x4cc587['query']=_[_0xd187('0x32')](_0x140e54['query']);_0x4cc587[_0xd187('0x33')]=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],_0x4cc587['query']);_0x5bba10['attributes']=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],qs['fields'](_0x140e54[_0xd187('0x35')][_0xd187('0x36')]));_0x5bba10[_0xd187('0x37')]=_0x5bba10['attributes']['length']?_0x5bba10[_0xd187('0x37')]:_0x4cc587[_0xd187('0x31')];if(!_0x140e54['query']['hasOwnProperty']('nolimit')){_0x5bba10[_0xd187('0x1e')]=qs['limit'](_0x140e54[_0xd187('0x35')][_0xd187('0x1e')]);_0x5bba10['offset']=qs[_0xd187('0x21')](_0x140e54['query'][_0xd187('0x21')]);}_0x5bba10[_0xd187('0x38')]=qs['sort'](_0x140e54[_0xd187('0x35')][_0xd187('0x39')]);_0x5bba10['where']=qs[_0xd187('0x33')](_['pick'](_0x140e54['query'],_0x4cc587[_0xd187('0x33')]),_0x1836cf);if(_0x140e54[_0xd187('0x35')][_0xd187('0x3a')]){_0x5bba10[_0xd187('0x3b')]=_[_0xd187('0x3c')](_0x5bba10['where'],{'$or':_[_0xd187('0x2c')](_0x1836cf,function(_0xe090ad){if(_0xe090ad[_0xd187('0x30')]!=='VIRTUAL'){var _0x4b121c={};_0x4b121c[_0xe090ad['name']]={'$like':'%'+_0x140e54['query'][_0xd187('0x3a')]+'%'};return _0x4b121c;}})});}_0x5bba10=_[_0xd187('0x3c')]({},_0x5bba10,_0x140e54[_0xd187('0x3d')]);var _0x367303={'where':_0x5bba10[_0xd187('0x3b')]};return db[_0xd187('0x2d')][_0xd187('0x20')](_0x367303)[_0xd187('0x26')](function(_0x526060){_0x1a1922[_0xd187('0x20')]=_0x526060;if(_0x140e54[_0xd187('0x35')][_0xd187('0x3e')]){_0x5bba10['include']=[{'all':!![]}];}return db[_0xd187('0x2d')]['findAll'](_0x5bba10);})[_0xd187('0x26')](function(_0x406d29){_0x1a1922[_0xd187('0x3f')]=_0x406d29;return _0x1a1922;})[_0xd187('0x26')](respondWithFilteredResult(_0xb38778,_0x5bba10))[_0xd187('0x40')](handleError(_0xb38778,null));};exports['show']=function(_0x3f0484,_0x3d9e60){var _0x3215b1={'raw':!![],'where':{'id':_0x3f0484['params']['id']}},_0x3fa19c={};_0x3fa19c[_0xd187('0x31')]=_[_0xd187('0x32')](db['AnalyticDefaultReport'][_0xd187('0x2e')]);_0x3fa19c[_0xd187('0x35')]=_['keys'](_0x3f0484['query']);_0x3fa19c[_0xd187('0x33')]=_[_0xd187('0x34')](_0x3fa19c['model'],_0x3fa19c['query']);_0x3215b1['attributes']=_[_0xd187('0x34')](_0x3fa19c[_0xd187('0x31')],qs[_0xd187('0x36')](_0x3f0484[_0xd187('0x35')][_0xd187('0x36')]));_0x3215b1[_0xd187('0x37')]=_0x3215b1[_0xd187('0x37')]['length']?_0x3215b1[_0xd187('0x37')]:_0x3fa19c[_0xd187('0x31')];if(_0x3f0484[_0xd187('0x35')][_0xd187('0x3e')]){_0x3215b1[_0xd187('0x41')]=[{'all':!![]}];}_0x3215b1=_[_0xd187('0x3c')]({},_0x3215b1,_0x3f0484[_0xd187('0x3d')]);return db[_0xd187('0x2d')]['find'](_0x3215b1)[_0xd187('0x26')](handleEntityNotFound(_0x3d9e60,null))[_0xd187('0x26')](respondWithResult(_0x3d9e60,null))[_0xd187('0x40')](handleError(_0x3d9e60,null));};exports[_0xd187('0x42')]=function(_0x36b99d,_0x5ad646){return db[_0xd187('0x2d')][_0xd187('0x42')](_0x36b99d['body'],{})[_0xd187('0x26')](function(_0xd9635d){var _0x55fac6=_0x36b99d['user']['get']({'plain':!![]});if(!_0x55fac6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55fac6[_0xd187('0x43')]===_0xd187('0x44')){var _0x12d448=_0xd9635d[_0xd187('0x27')]({'plain':!![]});var _0x460202=_0xd187('0x45');return db[_0xd187('0x46')]['find']({'where':{'name':_0x460202,'userProfileId':_0x55fac6[_0xd187('0x47')]},'raw':!![]})[_0xd187('0x26')](function(_0x1b12c4){if(_0x1b12c4&&_0x1b12c4[_0xd187('0x48')]===0x0){return db['UserProfileResource'][_0xd187('0x42')]({'name':_0x12d448['name'],'resourceId':_0x12d448['id'],'type':'DefaultReports','sectionId':_0x1b12c4['id']},{})[_0xd187('0x26')](function(){return _0xd9635d;});}else{return _0xd9635d;}})['catch'](function(_0x1a1252){logger[_0xd187('0x29')](_0xd187('0x49'),_0x1a1252);throw _0x1a1252;});}return _0xd9635d;})[_0xd187('0x26')](respondWithResult(_0x5ad646,0xc9))[_0xd187('0x40')](handleError(_0x5ad646,null));};exports[_0xd187('0x25')]=function(_0x3c7ba6,_0x2b4f9d){if(_0x3c7ba6[_0xd187('0x4a')]['id']){delete _0x3c7ba6['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x4b')]({'where':{'id':_0x3c7ba6['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x2b4f9d,null))[_0xd187('0x26')](saveUpdates(_0x3c7ba6[_0xd187('0x4a')],null))['then'](respondWithResult(_0x2b4f9d,null))[_0xd187('0x40')](handleError(_0x2b4f9d,null));};exports[_0xd187('0x28')]=function(_0x50073d,_0x457da1){return db[_0xd187('0x2d')]['find']({'where':{'id':_0x50073d[_0xd187('0x4c')]['id']}})['then'](handleEntityNotFound(_0x457da1,null))[_0xd187('0x26')](removeEntity(_0x457da1,null))[_0xd187('0x40')](handleError(_0x457da1,null));};exports[_0xd187('0x4d')]=function(_0x508866,_0x100d64){var _0x2265fb=0xa;var _0x1675d9=['join',_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x56b36b={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':_0xd187('0x58'),'GROUP_CONCAT DESC':_0xd187('0x59')};var _0x2c7dd9={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':_0xd187('0x5b'),'HOUR':_0xd187('0x5c'),'ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0xaff1e6=function(_0x42fb32){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x42fb32);};var _0x48c82d=function(_0x13d118){if(!_0x13d118||!_0x13d118[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x4225e6='(',_0x51fbdb=0x0;_0x51fbdb<_0x13d118[_0xd187('0x63')][_0xd187('0x64')];_0x51fbdb+=0x1){_0x51fbdb>0x0&&(_0x4225e6+='\x20'+_0x13d118['operator']+'\x20');_0x4225e6+=_0x13d118['rules'][_0x51fbdb][_0xd187('0x65')]?_0x48c82d(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x65')]):_0x13d118[_0xd187('0x63')][_0x51fbdb]['field']+'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb]['condition']+(_0xaff1e6(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x66')])?'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x67')]:'');}return _0x4225e6+')';};var _0x57cad7={'where':{'id':_0x508866['params']['id']}},_0x2409a8,_0xaea7e0,_0xd12560,_0x9e82c,_0x151f3c;_0x57cad7=_['merge']({},_0x57cad7,_0x508866[_0xd187('0x3d')]);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x57cad7)[_0xd187('0x26')](function(_0x13e05a){if(_0x13e05a){_0x2409a8=_0x13e05a;return _0x13e05a[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1291cc){if(_0x1291cc){if(!_0x1291cc[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0xaea7e0=_0x1291cc;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x54e908){if(_0x54e908){_0xd12560=_[_0xd187('0x6d')](_0x54e908,'id');var _0x1a9979;var _0x4bec3e=squel['select']();_0x4bec3e[_0xd187('0x6e')](_0x2409a8[_0xd187('0x6f')]);for(var _0x2ac56f=0x0;_0x2ac56f<_0xaea7e0[_0xd187('0x64')];_0x2ac56f+=0x1){_0x1a9979=_0xaea7e0[_0x2ac56f]['MetricId']?_0xd12560[_0xaea7e0[_0x2ac56f][_0xd187('0x70')]][_0xd187('0x71')]:_0xaea7e0[_0x2ac56f]['field'];_0x1a9979=_0xaea7e0[_0x2ac56f]['function']?_[_0xd187('0x72')](_0x56b36b[_0xaea7e0[_0x2ac56f]['function']],'%s',_0x1a9979):_0x1a9979;_0x1a9979=_0xaea7e0[_0x2ac56f][_0xd187('0x73')]?_[_0xd187('0x72')](_0x2c7dd9[_0xaea7e0[_0x2ac56f]['format']],'%s',_0x1a9979):_0x1a9979;if(_0xaea7e0[_0x2ac56f][_0xd187('0x74')]){_0x4bec3e['group'](_0x1a9979);}_0xaea7e0[_0x2ac56f][_0xd187('0x75')]&&_0x4bec3e['order'](_0x1a9979,_0xaea7e0[_0x2ac56f]['orderBy']==='DESC'?![]:!![]);_0x4bec3e[_0xd187('0x76')](_0x1a9979,_0xaea7e0[_0x2ac56f][_0xd187('0x77')]||_0x1a9979);}if(_0x2409a8[_0xd187('0x78')]){_0x2409a8[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x78')]);for(var _0x11858e=0x0;_0x11858e<_0x2409a8[_0xd187('0x78')]['length'];_0x11858e+=0x1){if(_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x1675d9,_0x2409a8['joins'][_0x11858e][_0xd187('0x30')])&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7a')]&&_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable']&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7b')]){_0x4bec3e[_0x2409a8['joins'][_0x11858e][_0xd187('0x30')]](_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7c')],null,util[_0xd187('0x73')]('%s.%s\x20=\x20%s.%s',_0x2409a8[_0xd187('0x6f')],_0x2409a8[_0xd187('0x78')][_0x11858e]['parentKey'],_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable'],_0x2409a8['joins'][_0x11858e]['foreignKey']));}}}if(_0x2409a8[_0xd187('0x7d')]){_0x2409a8[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x7d')]);_0x4bec3e[_0xd187('0x3b')](_0x48c82d(_0x2409a8[_0xd187('0x7d')]['group']));}_0x151f3c=_0x4bec3e[_0xd187('0x7e')]();_0x4bec3e[_0xd187('0x1e')](_0x2265fb);_0x4bec3e['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x4bec3e[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x4bec3e[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes'][_0xd187('0x82')]});}})[_0xd187('0x26')](respondWithResult(_0x100d64,null))[_0xd187('0x40')](handleError(_0x100d64,null));};function runReport(_0xbc650f,_0x1da684,_0x2879ff){var _0x1982cd=_0x1da684[_0xd187('0x2a')];var _0x3d9b2f=0xa;var _0xf31fac=[_0xd187('0x83'),_0xd187('0x4e'),'right_join','cross_join'];var _0x3d7e97={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x520f86={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd187('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x1ccb17=function(_0x432995){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x84'),_0xd187('0x62')],_0x432995);};var _0x395e45=function(_0x1e8839){if(!_0x1e8839||!_0x1e8839[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x2101a3='(',_0x25fc08=0x0;_0x25fc08<_0x1e8839['rules'][_0xd187('0x64')];_0x25fc08+=0x1){_0x25fc08>0x0&&(_0x2101a3+='\x20'+_0x1e8839[_0xd187('0x85')]+'\x20');_0x2101a3+=_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x65')]?_0x395e45(_0x1e8839['rules'][_0x25fc08][_0xd187('0x65')]):_0x1e8839[_0xd187('0x63')][_0x25fc08]['field']+'\x20'+_0x1e8839['rules'][_0x25fc08][_0xd187('0x66')]+(_0x1ccb17(_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x66')])?'\x20'+_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x67')]:'');}return _0x2101a3+')';};var _0x475ea9={'where':{'id':_0xbc650f['id']}},_0x4dd0c7,_0x22900,_0x22424d,_0x5b7870,_0x3244dd;_0x475ea9=_[_0xd187('0x3c')]({},_0x475ea9,_0x2879ff);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x475ea9)['then'](function(_0x5be1c9){if(_0x5be1c9){_0x4dd0c7=_0x5be1c9;return _0x5be1c9[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1cd0d2){if(_0x1cd0d2){if(!_0x1cd0d2['length']){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x22900=_0x1cd0d2;return db[_0xd187('0x86')]['findAll']({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x4efb9f){if(_0x4efb9f){_0x22424d=_['keyBy'](_0x4efb9f,'id');var _0x4a9310;var _0x54bf98=squel['select']();_0x54bf98['from'](_0x4dd0c7['table']);for(var _0x323311=0x0;_0x323311<_0x22900[_0xd187('0x64')];_0x323311+=0x1){_0x4a9310=_0x22900[_0x323311]['MetricId']?_0x22424d[_0x22900[_0x323311][_0xd187('0x70')]][_0xd187('0x71')]:_0x22900[_0x323311][_0xd187('0x76')];_0x4a9310=_0x22900[_0x323311][_0xd187('0x87')]?_[_0xd187('0x72')](_0x3d7e97[_0x22900[_0x323311]['function']],'%s',_0x4a9310):_0x4a9310;_0x4a9310=_0x22900[_0x323311][_0xd187('0x73')]?_['replace'](_0x520f86[_0x22900[_0x323311][_0xd187('0x73')]],'%s',_0x4a9310):_0x4a9310;if(_0x22900[_0x323311][_0xd187('0x74')]){_0x54bf98[_0xd187('0x65')](_0x4a9310);}_0x22900[_0x323311][_0xd187('0x75')]&&_0x54bf98[_0xd187('0x38')](_0x4a9310,_0x22900[_0x323311][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x54bf98['field'](_0x4a9310,_0x22900[_0x323311][_0xd187('0x77')]||_0x4a9310);}if(_0x4dd0c7[_0xd187('0x78')]){_0x4dd0c7['joins']=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x78')]);for(var _0x5df926=0x0;_0x5df926<_0x4dd0c7[_0xd187('0x78')][_0xd187('0x64')];_0x5df926+=0x1){if(_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0xf31fac,_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')])&&_0x4dd0c7[_0xd187('0x78')][_0x5df926]['parentKey']&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')]&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]){_0x54bf98[_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]](_0x4dd0c7['joins'][_0x5df926]['foreignTable'],null,util[_0xd187('0x73')](_0xd187('0x89'),_0x4dd0c7['table'],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7a')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]));}}}if(_0x4dd0c7['conditions']){_0x4dd0c7[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x7d')]);_0x54bf98[_0xd187('0x3b')](_0x395e45(_0x4dd0c7[_0xd187('0x7d')][_0xd187('0x65')]));}_0x3244dd=_0x54bf98[_0xd187('0x7e')]();_0x54bf98[_0xd187('0x1e')](_0x3d9b2f);_0x54bf98[_0xd187('0x21')](0x0);return;}})['then'](function(){if(_0x1da684[_0xd187('0x8a')]===_0xd187('0x8b')){return null;}var _0x25a053=_['merge'](_0x1da684,{'name':_0x1da684[_0xd187('0x8c')]||_0x1da684[_0xd187('0x2a')]||_0x4dd0c7[_0xd187('0x2a')],'basename':_0x1982cd,'savename':util[_0xd187('0x73')](_0xd187('0x8d'),_0x1da684[_0xd187('0x2a')]||_0x4dd0c7['name'],require(_0xd187('0x8e'))[_0xd187('0x8f')](0x4),_0x1da684[_0xd187('0x8a')]||'csv'),'reportId':_0x4dd0c7['id'],'reportType':_0xd187('0x90')});return db[_0xd187('0x91')][_0xd187('0x42')](_0x25a053,{'raw':!![]});})[_0xd187('0x26')](function(_0x12599e){if(_0x4dd0c7[_0xd187('0x6f')]==='cdr'){_0x3244dd[_0xd187('0x3b')](_0x4dd0c7[_0xd187('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1da684[_0xd187('0x92')],_0x1da684[_0xd187('0x93')]);}else{_0x3244dd['where'](_0x4dd0c7[_0xd187('0x6f')]+_0xd187('0x94'),_0x1da684['startDate'],_0x1da684[_0xd187('0x93')]);}if(_0x12599e){logger[_0xd187('0x95')]('Run\x20Query:',_0x3244dd[_0xd187('0x80')]());require('child_process')[_0xd187('0x96')](path[_0xd187('0x83')](__dirname,_0xd187('0x97'),_0x12599e[_0xd187('0x8a')]),[_0x12599e['id'],_0x3244dd[_0xd187('0x80')](),path['join'](__dirname,'../../files/reports',_0x12599e[_0xd187('0x98')]),_0x1982cd]);return _0x12599e;}else{var _0x2a2c7f=squel[_0xd187('0x99')]();_0x2a2c7f[_0xd187('0x6e')]('('+_0x3244dd[_0xd187('0x80')]()+')',_0xd187('0x9a'));_0x2a2c7f[_0xd187('0x76')]('COUNT(*)',_0xd187('0x20'));_0x3244dd[_0xd187('0x1e')](_0x1da684[_0xd187('0x1e')]||_0x3d9b2f);_0x3244dd[_0xd187('0x21')](_0x1da684[_0xd187('0x21')]||0x0);return dbH[_0xd187('0x81')]['query'](_0x2a2c7f[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')][_0xd187('0x82')]})[_0xd187('0x26')](function(_0x38a7cd){if(!_0x38a7cd[_0xd187('0x64')]){_0x5b7870=0x0;}else{_0x5b7870=_0x38a7cd[0x0][_0xd187('0x20')]||0x0;}return dbH['sequelize'][_0xd187('0x35')](_0x3244dd['toString'](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')]['SELECT']});})[_0xd187('0x26')](function(_0x254e0a){return{'rows':_0x254e0a||[],'count':_0x5b7870};});}});}exports['run']=function(_0x1776c1,_0x497a94){return runReport(_0x1776c1[_0xd187('0x4c')],_0x1776c1['query'],_0x1776c1['options'])[_0xd187('0x26')](respondWithResult(_0x497a94,null))[_0xd187('0x40')](handleError(_0x497a94,null));};exports[_0xd187('0x9c')]=runReport;exports[_0xd187('0x35')]=function(_0x568f72,_0x357526){var _0x13ee40=0xa;var _0x20c269=[_0xd187('0x83'),_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x25ff89={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x28798f={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x56fcde=function(_0x37b1b0){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x37b1b0);};var _0x428e6c=function(_0x4524c3){if(!_0x4524c3||!_0x4524c3[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x3a2937='(',_0xf03f9a=0x0;_0xf03f9a<_0x4524c3['rules'][_0xd187('0x64')];_0xf03f9a+=0x1){_0xf03f9a>0x0&&(_0x3a2937+='\x20'+_0x4524c3['operator']+'\x20');_0x3a2937+=_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']?_0x428e6c(_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']):_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x76')]+'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a]['condition']+(_0x56fcde(_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x66')])?'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x67')]:'');}return _0x3a2937+')';};var _0x37405d={'where':{'id':_0x568f72[_0xd187('0x4c')]['id']}},_0xe84f78,_0x12b4a4,_0x3d09a6,_0x5acea7,_0x2a756f;_0x37405d=_[_0xd187('0x3c')]({},_0x37405d,_0x568f72['options']);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x37405d)[_0xd187('0x26')](function(_0x110af6){if(_0x110af6){_0xe84f78=_0x110af6;return _0x110af6[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x2e4db4){if(_0x2e4db4){if(!_0x2e4db4[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x12b4a4=_0x2e4db4;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x50d5b8){if(_0x50d5b8){_0x3d09a6=_[_0xd187('0x6d')](_0x50d5b8,'id');var _0x48ef98;var _0x2008e9=squel['select']();_0x2008e9[_0xd187('0x6e')](_0xe84f78[_0xd187('0x6f')]);for(var _0x9b8840=0x0;_0x9b8840<_0x12b4a4[_0xd187('0x64')];_0x9b8840+=0x1){_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x70')]?_0x3d09a6[_0x12b4a4[_0x9b8840]['MetricId']][_0xd187('0x71')]:_0x12b4a4[_0x9b8840][_0xd187('0x76')];_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x87')]?_[_0xd187('0x72')](_0x25ff89[_0x12b4a4[_0x9b8840][_0xd187('0x87')]],'%s',_0x48ef98):_0x48ef98;_0x48ef98=_0x12b4a4[_0x9b8840]['format']?_[_0xd187('0x72')](_0x28798f[_0x12b4a4[_0x9b8840][_0xd187('0x73')]],'%s',_0x48ef98):_0x48ef98;if(_0x12b4a4[_0x9b8840][_0xd187('0x74')]){_0x2008e9['group'](_0x48ef98);}_0x12b4a4[_0x9b8840]['orderBy']&&_0x2008e9[_0xd187('0x38')](_0x48ef98,_0x12b4a4[_0x9b8840][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x2008e9[_0xd187('0x76')](_0x48ef98,_0x12b4a4[_0x9b8840]['alias']||_0x48ef98);}if(_0xe84f78[_0xd187('0x78')]){_0xe84f78[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0xe84f78[_0xd187('0x78')]);for(var _0x4bff96=0x0;_0x4bff96<_0xe84f78[_0xd187('0x78')]['length'];_0x4bff96+=0x1){if(_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x20c269,_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')])&&_0xe84f78['joins'][_0x4bff96][_0xd187('0x7a')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96]['foreignKey']){_0x2008e9[_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]](_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],null,util[_0xd187('0x73')](_0xd187('0x89'),_0xe84f78[_0xd187('0x6f')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7a')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7b')]));}}}if(_0xe84f78['conditions']){_0xe84f78[_0xd187('0x7d')]=JSON['parse'](_0xe84f78[_0xd187('0x7d')]);_0x2008e9['where'](_0x428e6c(_0xe84f78[_0xd187('0x7d')][_0xd187('0x65')]));}_0x2a756f=_0x2008e9[_0xd187('0x7e')]();_0x2008e9[_0xd187('0x1e')](_0x13ee40);_0x2008e9['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x2008e9[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x2008e9[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes']['SELECT']});}})[_0xd187('0x26')](function(){return{'sql':_0x2a756f[_0xd187('0x80')]()};})[_0xd187('0x26')](respondWithResult(_0x357526,null))['catch'](handleError(_0x357526,null));}; \ No newline at end of file +var _0x187d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','limit','undefined','count','offset','set','json','save','update','then','get','destroy','error','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','order','sort','filter','where','merge','options','includeAll','rows','catch','include','create','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','IS\x20EMPTY','operator','AnalyticMetric','function','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','savename','select','countTable','QueryTypes','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x5bd78b,_0x393076){var _0xecd930=function(_0x2a0b40){while(--_0x2a0b40){_0x5bd78b['push'](_0x5bd78b['shift']());}};_0xecd930(++_0x393076);}(_0x187d,0x93));var _0xd187=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x187d[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];var dbH=require(_0xd187('0x1a'))[_0xd187('0x1b')];function respondWithStatusCode(_0x59ee4a,_0x33e3d5){_0x33e3d5=_0x33e3d5||0xcc;return function(_0x18ce42){if(_0x18ce42){return _0x59ee4a[_0xd187('0x1c')](_0x33e3d5);}return _0x59ee4a[_0xd187('0x1d')](_0x33e3d5)['end']();};}function respondWithResult(_0x39a927,_0x2050d5){_0x2050d5=_0x2050d5||0xc8;return function(_0x45ab10){if(_0x45ab10){return _0x39a927[_0xd187('0x1d')](_0x2050d5)['json'](_0x45ab10);}};}function respondWithFilteredResult(_0x245d3e,_0x52a208){return function(_0x5cf218){if(_0x5cf218){var _0x40ed84=typeof _0x52a208['offset']==='undefined'&&typeof _0x52a208[_0xd187('0x1e')]===_0xd187('0x1f');var _0x374fe0=_0x5cf218[_0xd187('0x20')];var _0x21df74=_0x40ed84?0x0:_0x52a208[_0xd187('0x21')];var _0x12b388=_0x40ed84?_0x5cf218[_0xd187('0x20')]:_0x52a208[_0xd187('0x21')]+_0x52a208[_0xd187('0x1e')];var _0x170d5c;if(_0x12b388>=_0x374fe0){_0x12b388=_0x374fe0;_0x170d5c=0xc8;}else{_0x170d5c=0xce;}_0x245d3e[_0xd187('0x1d')](_0x170d5c);return _0x245d3e[_0xd187('0x22')]('Content-Range',_0x21df74+'-'+_0x12b388+'/'+_0x374fe0)[_0xd187('0x23')](_0x5cf218);}return null;};}function patchUpdates(_0x81b988){return function(_0xc5bba5){try{jsonpatch['apply'](_0xc5bba5,_0x81b988,!![]);}catch(_0x5a0360){return BPromise['reject'](_0x5a0360);}return _0xc5bba5[_0xd187('0x24')]();};}function saveUpdates(_0x33741d,_0x249a82){return function(_0x4f62c8){if(_0x4f62c8){return _0x4f62c8[_0xd187('0x25')](_0x33741d)['then'](function(_0x145771){return _0x145771;});}return null;};}function removeEntity(_0x5a7a23,_0x1047f4){return function(_0x54f340){if(_0x54f340){return _0x54f340['destroy']()[_0xd187('0x26')](function(){var _0x4d992b=_0x54f340[_0xd187('0x27')]({'plain':!![]});var _0x598aa4='DefaultReports';return db['UserProfileResource'][_0xd187('0x28')]({'where':{'type':_0x598aa4,'resourceId':_0x4d992b['id']}})[_0xd187('0x26')](function(){return _0x54f340;});})[_0xd187('0x26')](function(){_0x5a7a23[_0xd187('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20ed,_0x2875c8){return function(_0x5c8e52){if(!_0x5c8e52){_0x2a20ed[_0xd187('0x1c')](0x194);}return _0x5c8e52;};}function handleError(_0x1c87ee,_0x34febe){_0x34febe=_0x34febe||0x1f4;return function(_0x4c50a5){logger[_0xd187('0x29')](_0x4c50a5['stack']);if(_0x4c50a5[_0xd187('0x2a')]){delete _0x4c50a5[_0xd187('0x2a')];}_0x1c87ee[_0xd187('0x1d')](_0x34febe)[_0xd187('0x2b')](_0x4c50a5);};}exports['index']=function(_0x140e54,_0xb38778){var _0x5bba10={},_0x4cc587={},_0x1a1922={'count':0x0,'rows':[]};var _0x1836cf=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x2d8843){return{'name':_0x2d8843[_0xd187('0x2f')],'type':_0x2d8843[_0xd187('0x30')]['key']};});_0x4cc587[_0xd187('0x31')]=_[_0xd187('0x2c')](_0x1836cf,_0xd187('0x2a'));_0x4cc587['query']=_[_0xd187('0x32')](_0x140e54['query']);_0x4cc587[_0xd187('0x33')]=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],_0x4cc587['query']);_0x5bba10['attributes']=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],qs['fields'](_0x140e54[_0xd187('0x35')][_0xd187('0x36')]));_0x5bba10[_0xd187('0x37')]=_0x5bba10['attributes']['length']?_0x5bba10[_0xd187('0x37')]:_0x4cc587[_0xd187('0x31')];if(!_0x140e54['query']['hasOwnProperty']('nolimit')){_0x5bba10[_0xd187('0x1e')]=qs['limit'](_0x140e54[_0xd187('0x35')][_0xd187('0x1e')]);_0x5bba10['offset']=qs[_0xd187('0x21')](_0x140e54['query'][_0xd187('0x21')]);}_0x5bba10[_0xd187('0x38')]=qs['sort'](_0x140e54[_0xd187('0x35')][_0xd187('0x39')]);_0x5bba10['where']=qs[_0xd187('0x33')](_['pick'](_0x140e54['query'],_0x4cc587[_0xd187('0x33')]),_0x1836cf);if(_0x140e54[_0xd187('0x35')][_0xd187('0x3a')]){_0x5bba10[_0xd187('0x3b')]=_[_0xd187('0x3c')](_0x5bba10['where'],{'$or':_[_0xd187('0x2c')](_0x1836cf,function(_0xe090ad){if(_0xe090ad[_0xd187('0x30')]!=='VIRTUAL'){var _0x4b121c={};_0x4b121c[_0xe090ad['name']]={'$like':'%'+_0x140e54['query'][_0xd187('0x3a')]+'%'};return _0x4b121c;}})});}_0x5bba10=_[_0xd187('0x3c')]({},_0x5bba10,_0x140e54[_0xd187('0x3d')]);var _0x367303={'where':_0x5bba10[_0xd187('0x3b')]};return db[_0xd187('0x2d')][_0xd187('0x20')](_0x367303)[_0xd187('0x26')](function(_0x526060){_0x1a1922[_0xd187('0x20')]=_0x526060;if(_0x140e54[_0xd187('0x35')][_0xd187('0x3e')]){_0x5bba10['include']=[{'all':!![]}];}return db[_0xd187('0x2d')]['findAll'](_0x5bba10);})[_0xd187('0x26')](function(_0x406d29){_0x1a1922[_0xd187('0x3f')]=_0x406d29;return _0x1a1922;})[_0xd187('0x26')](respondWithFilteredResult(_0xb38778,_0x5bba10))[_0xd187('0x40')](handleError(_0xb38778,null));};exports['show']=function(_0x3f0484,_0x3d9e60){var _0x3215b1={'raw':!![],'where':{'id':_0x3f0484['params']['id']}},_0x3fa19c={};_0x3fa19c[_0xd187('0x31')]=_[_0xd187('0x32')](db['AnalyticDefaultReport'][_0xd187('0x2e')]);_0x3fa19c[_0xd187('0x35')]=_['keys'](_0x3f0484['query']);_0x3fa19c[_0xd187('0x33')]=_[_0xd187('0x34')](_0x3fa19c['model'],_0x3fa19c['query']);_0x3215b1['attributes']=_[_0xd187('0x34')](_0x3fa19c[_0xd187('0x31')],qs[_0xd187('0x36')](_0x3f0484[_0xd187('0x35')][_0xd187('0x36')]));_0x3215b1[_0xd187('0x37')]=_0x3215b1[_0xd187('0x37')]['length']?_0x3215b1[_0xd187('0x37')]:_0x3fa19c[_0xd187('0x31')];if(_0x3f0484[_0xd187('0x35')][_0xd187('0x3e')]){_0x3215b1[_0xd187('0x41')]=[{'all':!![]}];}_0x3215b1=_[_0xd187('0x3c')]({},_0x3215b1,_0x3f0484[_0xd187('0x3d')]);return db[_0xd187('0x2d')]['find'](_0x3215b1)[_0xd187('0x26')](handleEntityNotFound(_0x3d9e60,null))[_0xd187('0x26')](respondWithResult(_0x3d9e60,null))[_0xd187('0x40')](handleError(_0x3d9e60,null));};exports[_0xd187('0x42')]=function(_0x36b99d,_0x5ad646){return db[_0xd187('0x2d')][_0xd187('0x42')](_0x36b99d['body'],{})[_0xd187('0x26')](function(_0xd9635d){var _0x55fac6=_0x36b99d['user']['get']({'plain':!![]});if(!_0x55fac6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55fac6[_0xd187('0x43')]===_0xd187('0x44')){var _0x12d448=_0xd9635d[_0xd187('0x27')]({'plain':!![]});var _0x460202=_0xd187('0x45');return db[_0xd187('0x46')]['find']({'where':{'name':_0x460202,'userProfileId':_0x55fac6[_0xd187('0x47')]},'raw':!![]})[_0xd187('0x26')](function(_0x1b12c4){if(_0x1b12c4&&_0x1b12c4[_0xd187('0x48')]===0x0){return db['UserProfileResource'][_0xd187('0x42')]({'name':_0x12d448['name'],'resourceId':_0x12d448['id'],'type':'DefaultReports','sectionId':_0x1b12c4['id']},{})[_0xd187('0x26')](function(){return _0xd9635d;});}else{return _0xd9635d;}})['catch'](function(_0x1a1252){logger[_0xd187('0x29')](_0xd187('0x49'),_0x1a1252);throw _0x1a1252;});}return _0xd9635d;})[_0xd187('0x26')](respondWithResult(_0x5ad646,0xc9))[_0xd187('0x40')](handleError(_0x5ad646,null));};exports[_0xd187('0x25')]=function(_0x3c7ba6,_0x2b4f9d){if(_0x3c7ba6[_0xd187('0x4a')]['id']){delete _0x3c7ba6['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x4b')]({'where':{'id':_0x3c7ba6['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x2b4f9d,null))[_0xd187('0x26')](saveUpdates(_0x3c7ba6[_0xd187('0x4a')],null))['then'](respondWithResult(_0x2b4f9d,null))[_0xd187('0x40')](handleError(_0x2b4f9d,null));};exports[_0xd187('0x28')]=function(_0x50073d,_0x457da1){return db[_0xd187('0x2d')]['find']({'where':{'id':_0x50073d[_0xd187('0x4c')]['id']}})['then'](handleEntityNotFound(_0x457da1,null))[_0xd187('0x26')](removeEntity(_0x457da1,null))[_0xd187('0x40')](handleError(_0x457da1,null));};exports[_0xd187('0x4d')]=function(_0x508866,_0x100d64){var _0x2265fb=0xa;var _0x1675d9=['join',_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x56b36b={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':_0xd187('0x58'),'GROUP_CONCAT DESC':_0xd187('0x59')};var _0x2c7dd9={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':_0xd187('0x5b'),'HOUR':_0xd187('0x5c'),'ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0xaff1e6=function(_0x42fb32){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x42fb32);};var _0x48c82d=function(_0x13d118){if(!_0x13d118||!_0x13d118[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x4225e6='(',_0x51fbdb=0x0;_0x51fbdb<_0x13d118[_0xd187('0x63')][_0xd187('0x64')];_0x51fbdb+=0x1){_0x51fbdb>0x0&&(_0x4225e6+='\x20'+_0x13d118['operator']+'\x20');_0x4225e6+=_0x13d118['rules'][_0x51fbdb][_0xd187('0x65')]?_0x48c82d(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x65')]):_0x13d118[_0xd187('0x63')][_0x51fbdb]['field']+'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb]['condition']+(_0xaff1e6(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x66')])?'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x67')]:'');}return _0x4225e6+')';};var _0x57cad7={'where':{'id':_0x508866['params']['id']}},_0x2409a8,_0xaea7e0,_0xd12560,_0x9e82c,_0x151f3c;_0x57cad7=_['merge']({},_0x57cad7,_0x508866[_0xd187('0x3d')]);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x57cad7)[_0xd187('0x26')](function(_0x13e05a){if(_0x13e05a){_0x2409a8=_0x13e05a;return _0x13e05a[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1291cc){if(_0x1291cc){if(!_0x1291cc[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0xaea7e0=_0x1291cc;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x54e908){if(_0x54e908){_0xd12560=_[_0xd187('0x6d')](_0x54e908,'id');var _0x1a9979;var _0x4bec3e=squel['select']();_0x4bec3e[_0xd187('0x6e')](_0x2409a8[_0xd187('0x6f')]);for(var _0x2ac56f=0x0;_0x2ac56f<_0xaea7e0[_0xd187('0x64')];_0x2ac56f+=0x1){_0x1a9979=_0xaea7e0[_0x2ac56f]['MetricId']?_0xd12560[_0xaea7e0[_0x2ac56f][_0xd187('0x70')]][_0xd187('0x71')]:_0xaea7e0[_0x2ac56f]['field'];_0x1a9979=_0xaea7e0[_0x2ac56f]['function']?_[_0xd187('0x72')](_0x56b36b[_0xaea7e0[_0x2ac56f]['function']],'%s',_0x1a9979):_0x1a9979;_0x1a9979=_0xaea7e0[_0x2ac56f][_0xd187('0x73')]?_[_0xd187('0x72')](_0x2c7dd9[_0xaea7e0[_0x2ac56f]['format']],'%s',_0x1a9979):_0x1a9979;if(_0xaea7e0[_0x2ac56f][_0xd187('0x74')]){_0x4bec3e['group'](_0x1a9979);}_0xaea7e0[_0x2ac56f][_0xd187('0x75')]&&_0x4bec3e['order'](_0x1a9979,_0xaea7e0[_0x2ac56f]['orderBy']==='DESC'?![]:!![]);_0x4bec3e[_0xd187('0x76')](_0x1a9979,_0xaea7e0[_0x2ac56f][_0xd187('0x77')]||_0x1a9979);}if(_0x2409a8[_0xd187('0x78')]){_0x2409a8[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x78')]);for(var _0x11858e=0x0;_0x11858e<_0x2409a8[_0xd187('0x78')]['length'];_0x11858e+=0x1){if(_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x1675d9,_0x2409a8['joins'][_0x11858e][_0xd187('0x30')])&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7a')]&&_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable']&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7b')]){_0x4bec3e[_0x2409a8['joins'][_0x11858e][_0xd187('0x30')]](_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7c')],null,util[_0xd187('0x73')]('%s.%s\x20=\x20%s.%s',_0x2409a8[_0xd187('0x6f')],_0x2409a8[_0xd187('0x78')][_0x11858e]['parentKey'],_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable'],_0x2409a8['joins'][_0x11858e]['foreignKey']));}}}if(_0x2409a8[_0xd187('0x7d')]){_0x2409a8[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x7d')]);_0x4bec3e[_0xd187('0x3b')](_0x48c82d(_0x2409a8[_0xd187('0x7d')]['group']));}_0x151f3c=_0x4bec3e[_0xd187('0x7e')]();_0x4bec3e[_0xd187('0x1e')](_0x2265fb);_0x4bec3e['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x4bec3e[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x4bec3e[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes'][_0xd187('0x82')]});}})[_0xd187('0x26')](respondWithResult(_0x100d64,null))[_0xd187('0x40')](handleError(_0x100d64,null));};function runReport(_0xbc650f,_0x1da684,_0x2879ff){var _0x1982cd=_0x1da684[_0xd187('0x2a')];var _0x3d9b2f=0xa;var _0xf31fac=[_0xd187('0x83'),_0xd187('0x4e'),'right_join','cross_join'];var _0x3d7e97={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x520f86={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd187('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x1ccb17=function(_0x432995){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x84'),_0xd187('0x62')],_0x432995);};var _0x395e45=function(_0x1e8839){if(!_0x1e8839||!_0x1e8839[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x2101a3='(',_0x25fc08=0x0;_0x25fc08<_0x1e8839['rules'][_0xd187('0x64')];_0x25fc08+=0x1){_0x25fc08>0x0&&(_0x2101a3+='\x20'+_0x1e8839[_0xd187('0x85')]+'\x20');_0x2101a3+=_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x65')]?_0x395e45(_0x1e8839['rules'][_0x25fc08][_0xd187('0x65')]):_0x1e8839[_0xd187('0x63')][_0x25fc08]['field']+'\x20'+_0x1e8839['rules'][_0x25fc08][_0xd187('0x66')]+(_0x1ccb17(_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x66')])?'\x20'+_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x67')]:'');}return _0x2101a3+')';};var _0x475ea9={'where':{'id':_0xbc650f['id']}},_0x4dd0c7,_0x22900,_0x22424d,_0x5b7870,_0x3244dd;_0x475ea9=_[_0xd187('0x3c')]({},_0x475ea9,_0x2879ff);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x475ea9)['then'](function(_0x5be1c9){if(_0x5be1c9){_0x4dd0c7=_0x5be1c9;return _0x5be1c9[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1cd0d2){if(_0x1cd0d2){if(!_0x1cd0d2['length']){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x22900=_0x1cd0d2;return db[_0xd187('0x86')]['findAll']({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x4efb9f){if(_0x4efb9f){_0x22424d=_['keyBy'](_0x4efb9f,'id');var _0x4a9310;var _0x54bf98=squel['select']();_0x54bf98['from'](_0x4dd0c7['table']);for(var _0x323311=0x0;_0x323311<_0x22900[_0xd187('0x64')];_0x323311+=0x1){_0x4a9310=_0x22900[_0x323311]['MetricId']?_0x22424d[_0x22900[_0x323311][_0xd187('0x70')]][_0xd187('0x71')]:_0x22900[_0x323311][_0xd187('0x76')];_0x4a9310=_0x22900[_0x323311][_0xd187('0x87')]?_[_0xd187('0x72')](_0x3d7e97[_0x22900[_0x323311]['function']],'%s',_0x4a9310):_0x4a9310;_0x4a9310=_0x22900[_0x323311][_0xd187('0x73')]?_['replace'](_0x520f86[_0x22900[_0x323311][_0xd187('0x73')]],'%s',_0x4a9310):_0x4a9310;if(_0x22900[_0x323311][_0xd187('0x74')]){_0x54bf98[_0xd187('0x65')](_0x4a9310);}_0x22900[_0x323311][_0xd187('0x75')]&&_0x54bf98[_0xd187('0x38')](_0x4a9310,_0x22900[_0x323311][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x54bf98['field'](_0x4a9310,_0x22900[_0x323311][_0xd187('0x77')]||_0x4a9310);}if(_0x4dd0c7[_0xd187('0x78')]){_0x4dd0c7['joins']=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x78')]);for(var _0x5df926=0x0;_0x5df926<_0x4dd0c7[_0xd187('0x78')][_0xd187('0x64')];_0x5df926+=0x1){if(_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0xf31fac,_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')])&&_0x4dd0c7[_0xd187('0x78')][_0x5df926]['parentKey']&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')]&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]){_0x54bf98[_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]](_0x4dd0c7['joins'][_0x5df926]['foreignTable'],null,util[_0xd187('0x73')](_0xd187('0x89'),_0x4dd0c7['table'],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7a')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]));}}}if(_0x4dd0c7['conditions']){_0x4dd0c7[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x7d')]);_0x54bf98[_0xd187('0x3b')](_0x395e45(_0x4dd0c7[_0xd187('0x7d')][_0xd187('0x65')]));}_0x3244dd=_0x54bf98[_0xd187('0x7e')]();_0x54bf98[_0xd187('0x1e')](_0x3d9b2f);_0x54bf98[_0xd187('0x21')](0x0);return;}})['then'](function(){if(_0x1da684[_0xd187('0x8a')]===_0xd187('0x8b')){return null;}var _0x25a053=_['merge'](_0x1da684,{'name':_0x1da684[_0xd187('0x8c')]||_0x1da684[_0xd187('0x2a')]||_0x4dd0c7[_0xd187('0x2a')],'basename':_0x1982cd,'savename':util[_0xd187('0x73')](_0xd187('0x8d'),_0x1da684[_0xd187('0x2a')]||_0x4dd0c7['name'],require(_0xd187('0x8e'))[_0xd187('0x8f')](0x4),_0x1da684[_0xd187('0x8a')]||'csv'),'reportId':_0x4dd0c7['id'],'reportType':_0xd187('0x90')});return db[_0xd187('0x91')][_0xd187('0x42')](_0x25a053,{'raw':!![]});})[_0xd187('0x26')](function(_0x12599e){if(_0x4dd0c7[_0xd187('0x6f')]==='cdr'){_0x3244dd[_0xd187('0x3b')](_0x4dd0c7[_0xd187('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1da684[_0xd187('0x92')],_0x1da684[_0xd187('0x93')]);}else{_0x3244dd['where'](_0x4dd0c7[_0xd187('0x6f')]+_0xd187('0x94'),_0x1da684['startDate'],_0x1da684[_0xd187('0x93')]);}if(_0x12599e){logger[_0xd187('0x95')]('Run\x20Query:',_0x3244dd[_0xd187('0x80')]());require('child_process')[_0xd187('0x96')](path[_0xd187('0x83')](__dirname,_0xd187('0x97'),_0x12599e[_0xd187('0x8a')]),[_0x12599e['id'],_0x3244dd[_0xd187('0x80')](),path['join'](__dirname,'../../files/reports',_0x12599e[_0xd187('0x98')]),_0x1982cd]);return _0x12599e;}else{var _0x2a2c7f=squel[_0xd187('0x99')]();_0x2a2c7f[_0xd187('0x6e')]('('+_0x3244dd[_0xd187('0x80')]()+')',_0xd187('0x9a'));_0x2a2c7f[_0xd187('0x76')]('COUNT(*)',_0xd187('0x20'));_0x3244dd[_0xd187('0x1e')](_0x1da684[_0xd187('0x1e')]||_0x3d9b2f);_0x3244dd[_0xd187('0x21')](_0x1da684[_0xd187('0x21')]||0x0);return dbH[_0xd187('0x81')]['query'](_0x2a2c7f[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')][_0xd187('0x82')]})[_0xd187('0x26')](function(_0x38a7cd){if(!_0x38a7cd[_0xd187('0x64')]){_0x5b7870=0x0;}else{_0x5b7870=_0x38a7cd[0x0][_0xd187('0x20')]||0x0;}return dbH['sequelize'][_0xd187('0x35')](_0x3244dd['toString'](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')]['SELECT']});})[_0xd187('0x26')](function(_0x254e0a){return{'rows':_0x254e0a||[],'count':_0x5b7870};});}});}exports['run']=function(_0x1776c1,_0x497a94){return runReport(_0x1776c1[_0xd187('0x4c')],_0x1776c1['query'],_0x1776c1['options'])[_0xd187('0x26')](respondWithResult(_0x497a94,null))[_0xd187('0x40')](handleError(_0x497a94,null));};exports[_0xd187('0x9c')]=runReport;exports[_0xd187('0x35')]=function(_0x568f72,_0x357526){var _0x13ee40=0xa;var _0x20c269=[_0xd187('0x83'),_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x25ff89={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x28798f={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x56fcde=function(_0x37b1b0){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x37b1b0);};var _0x428e6c=function(_0x4524c3){if(!_0x4524c3||!_0x4524c3[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x3a2937='(',_0xf03f9a=0x0;_0xf03f9a<_0x4524c3['rules'][_0xd187('0x64')];_0xf03f9a+=0x1){_0xf03f9a>0x0&&(_0x3a2937+='\x20'+_0x4524c3['operator']+'\x20');_0x3a2937+=_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']?_0x428e6c(_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']):_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x76')]+'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a]['condition']+(_0x56fcde(_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x66')])?'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x67')]:'');}return _0x3a2937+')';};var _0x37405d={'where':{'id':_0x568f72[_0xd187('0x4c')]['id']}},_0xe84f78,_0x12b4a4,_0x3d09a6,_0x5acea7,_0x2a756f;_0x37405d=_[_0xd187('0x3c')]({},_0x37405d,_0x568f72['options']);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x37405d)[_0xd187('0x26')](function(_0x110af6){if(_0x110af6){_0xe84f78=_0x110af6;return _0x110af6[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x2e4db4){if(_0x2e4db4){if(!_0x2e4db4[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x12b4a4=_0x2e4db4;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x50d5b8){if(_0x50d5b8){_0x3d09a6=_[_0xd187('0x6d')](_0x50d5b8,'id');var _0x48ef98;var _0x2008e9=squel['select']();_0x2008e9[_0xd187('0x6e')](_0xe84f78[_0xd187('0x6f')]);for(var _0x9b8840=0x0;_0x9b8840<_0x12b4a4[_0xd187('0x64')];_0x9b8840+=0x1){_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x70')]?_0x3d09a6[_0x12b4a4[_0x9b8840]['MetricId']][_0xd187('0x71')]:_0x12b4a4[_0x9b8840][_0xd187('0x76')];_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x87')]?_[_0xd187('0x72')](_0x25ff89[_0x12b4a4[_0x9b8840][_0xd187('0x87')]],'%s',_0x48ef98):_0x48ef98;_0x48ef98=_0x12b4a4[_0x9b8840]['format']?_[_0xd187('0x72')](_0x28798f[_0x12b4a4[_0x9b8840][_0xd187('0x73')]],'%s',_0x48ef98):_0x48ef98;if(_0x12b4a4[_0x9b8840][_0xd187('0x74')]){_0x2008e9['group'](_0x48ef98);}_0x12b4a4[_0x9b8840]['orderBy']&&_0x2008e9[_0xd187('0x38')](_0x48ef98,_0x12b4a4[_0x9b8840][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x2008e9[_0xd187('0x76')](_0x48ef98,_0x12b4a4[_0x9b8840]['alias']||_0x48ef98);}if(_0xe84f78[_0xd187('0x78')]){_0xe84f78[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0xe84f78[_0xd187('0x78')]);for(var _0x4bff96=0x0;_0x4bff96<_0xe84f78[_0xd187('0x78')]['length'];_0x4bff96+=0x1){if(_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x20c269,_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')])&&_0xe84f78['joins'][_0x4bff96][_0xd187('0x7a')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96]['foreignKey']){_0x2008e9[_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]](_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],null,util[_0xd187('0x73')](_0xd187('0x89'),_0xe84f78[_0xd187('0x6f')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7a')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7b')]));}}}if(_0xe84f78['conditions']){_0xe84f78[_0xd187('0x7d')]=JSON['parse'](_0xe84f78[_0xd187('0x7d')]);_0x2008e9['where'](_0x428e6c(_0xe84f78[_0xd187('0x7d')][_0xd187('0x65')]));}_0x2a756f=_0x2008e9[_0xd187('0x7e')]();_0x2008e9[_0xd187('0x1e')](_0x13ee40);_0x2008e9['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x2008e9[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x2008e9[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes']['SELECT']});}})[_0xd187('0x26')](function(){return{'sql':_0x2a756f[_0xd187('0x80')]()};})[_0xd187('0x26')](respondWithResult(_0x357526,null))['catch'](handleError(_0x357526,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index aedc5a1..ab3437c 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.model.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b10=['analytics_default_reports','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport'];(function(_0xd31621,_0x17b567){var _0x2e7ac0=function(_0x3c5a8d){while(--_0x3c5a8d){_0xd31621['push'](_0xd31621['shift']());}};_0x2e7ac0(++_0x17b567);}(_0x6b10,0x115));var _0x06b1=function(_0x1bac6b,_0x4891cd){_0x1bac6b=_0x1bac6b-0x0;var _0x6a71be=_0x6b10[_0x1bac6b];return _0x6a71be;};'use strict';var _=require(_0x06b1('0x0'));var util=require('util');var logger=require(_0x06b1('0x1'))('api');var moment=require(_0x06b1('0x2'));var BPromise=require(_0x06b1('0x3'));var rp=require(_0x06b1('0x4'));var fs=require('fs');var path=require(_0x06b1('0x5'));var rimraf=require(_0x06b1('0x6'));var config=require(_0x06b1('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x06b1('0x8')]=function(_0x53fbff,_0x1a0334){return _0x53fbff[_0x06b1('0x9')](_0x06b1('0xa'),attributes,{'tableName':_0x06b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7973=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x447d73,_0x50f8c7){var _0x343b07=function(_0x467a77){while(--_0x467a77){_0x447d73['push'](_0x447d73['shift']());}};_0x343b07(++_0x50f8c7);}(_0x7973,0x152));var _0x3797=function(_0x554336,_0x5dc9bf){_0x554336=_0x554336-0x0;var _0x372341=_0x7973[_0x554336];return _0x372341;};'use strict';var _=require(_0x3797('0x0'));var util=require(_0x3797('0x1'));var logger=require(_0x3797('0x2'))('api');var moment=require(_0x3797('0x3'));var BPromise=require(_0x3797('0x4'));var rp=require(_0x3797('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3797('0x6'));var config=require(_0x3797('0x7'));var attributes=require(_0x3797('0x8'));module[_0x3797('0x9')]=function(_0x2999e5,_0x25857a){return _0x2999e5[_0x3797('0xa')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index a41a2a3..68cc152 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c00=['jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x3c00,0x1d4));var _0x03c0=function(_0x86782f,_0x436231){_0x86782f=_0x86782f-0x0;var _0x2d50b5=_0x3c00[_0x86782f];return _0x2d50b5;};'use strict';var _=require('lodash');var util=require(_0x03c0('0x0'));var moment=require(_0x03c0('0x1'));var BPromise=require(_0x03c0('0x2'));var rs=require(_0x03c0('0x3'));var fs=require('fs');var Redis=require(_0x03c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x03c0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x03c0('0x6'));var jayson=require(_0x03c0('0x7'));var client=jayson[_0x03c0('0x8')][_0x03c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b4827,_0x2bbb03,_0x3dd539){return new BPromise(function(_0x2bdb2e,_0x22730b){return client[_0x03c0('0xa')](_0x1b4827,_0x3dd539)[_0x03c0('0xb')](function(_0x4e5048){logger[_0x03c0('0xc')](_0x03c0('0xd'),_0x2bbb03,'request\x20sent');logger[_0x03c0('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2bbb03,'request\x20sent',JSON['stringify'](_0x4e5048));if(_0x4e5048['error']){if(_0x4e5048[_0x03c0('0xf')][_0x03c0('0x10')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2bbb03,_0x4e5048['error']['message']);return _0x22730b(_0x4e5048[_0x03c0('0xf')][_0x03c0('0x11')]);}logger[_0x03c0('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2bbb03,_0x4e5048[_0x03c0('0xf')][_0x03c0('0x11')]);return _0x2bdb2e(_0x4e5048['error'][_0x03c0('0x11')]);}else{logger[_0x03c0('0xc')](_0x03c0('0xd'),_0x2bbb03,_0x03c0('0x12'));_0x2bdb2e(_0x4e5048['result']['message']);}})['catch'](function(_0x18d3ca){logger[_0x03c0('0xf')](_0x03c0('0xd'),_0x2bbb03,_0x18d3ca);_0x22730b(_0x18d3ca);});});} \ No newline at end of file +var _0x89f7=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x379e0f,_0x3eca39){var _0x5959b9=function(_0x1b65d4){while(--_0x1b65d4){_0x379e0f['push'](_0x379e0f['shift']());}};_0x5959b9(++_0x3eca39);}(_0x89f7,0xa9));var _0x789f=function(_0x269c42,_0xeed101){_0x269c42=_0x269c42-0x0;var _0x4dad76=_0x89f7[_0x269c42];return _0x4dad76;};'use strict';var _=require(_0x789f('0x0'));var util=require(_0x789f('0x1'));var moment=require('moment');var BPromise=require(_0x789f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x789f('0x3'));var db=require(_0x789f('0x4'))['db'];var utils=require(_0x789f('0x5'));var logger=require(_0x789f('0x6'))(_0x789f('0x7'));var config=require(_0x789f('0x8'));var jayson=require(_0x789f('0x9'));var client=jayson[_0x789f('0xa')][_0x789f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51838c,_0x4551d2,_0x14d537){return new BPromise(function(_0x316016,_0x47db73){return client[_0x789f('0xc')](_0x51838c,_0x14d537)[_0x789f('0xd')](function(_0x550675){logger[_0x789f('0xe')](_0x789f('0xf'),_0x4551d2,_0x789f('0x10'));logger[_0x789f('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4551d2,_0x789f('0x10'),JSON[_0x789f('0x12')](_0x550675));if(_0x550675[_0x789f('0x13')]){if(_0x550675['error'][_0x789f('0x14')]===0x1f4){logger[_0x789f('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4551d2,_0x550675[_0x789f('0x13')][_0x789f('0x15')]);return _0x47db73(_0x550675[_0x789f('0x13')]['message']);}logger['error'](_0x789f('0xf'),_0x4551d2,_0x550675[_0x789f('0x13')][_0x789f('0x15')]);return _0x316016(_0x550675[_0x789f('0x13')][_0x789f('0x15')]);}else{logger[_0x789f('0xe')](_0x789f('0xf'),_0x4551d2,_0x789f('0x10'));_0x316016(_0x550675[_0x789f('0x16')][_0x789f('0x15')]);}})[_0x789f('0x17')](function(_0x1c2989){logger['error'](_0x789f('0xf'),_0x4551d2,_0x1c2989);_0x47db73(_0x1c2989);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 516b22f..a64b237 100644 --- a/server/api/analyticDefaultReport/index.js +++ b/server/api/analyticDefaultReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb344=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','/:id','show','get','run','query','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5b6983,_0x53d5f9){var _0x1e2978=function(_0x44f668){while(--_0x44f668){_0x5b6983['push'](_0x5b6983['shift']());}};_0x1e2978(++_0x53d5f9);}(_0xb344,0x152));var _0x4b34=function(_0x59aecc,_0x255014){_0x59aecc=_0x59aecc-0x0;var _0x46b112=_0xb344[_0x59aecc];return _0x46b112;};'use strict';var multer=require(_0x4b34('0x0'));var util=require(_0x4b34('0x1'));var path=require(_0x4b34('0x2'));var timeout=require(_0x4b34('0x3'));var express=require(_0x4b34('0x4'));var router=express[_0x4b34('0x5')]();var fs_extra=require(_0x4b34('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4b34('0x7'));var config=require(_0x4b34('0x8'));var controller=require(_0x4b34('0x9'));router['get']('/',auth[_0x4b34('0xa')](),controller[_0x4b34('0xb')]);router['get'](_0x4b34('0xc'),auth['isAuthenticated'](),controller[_0x4b34('0xd')]);router[_0x4b34('0xe')]('/:id/preview',auth[_0x4b34('0xa')](),controller['preview']);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0x4b34('0xf')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x4b34('0x10')]);router[_0x4b34('0x11')]('/',auth[_0x4b34('0xa')](),controller[_0x4b34('0x12')]);router[_0x4b34('0x13')](_0x4b34('0xc'),auth[_0x4b34('0xa')](),controller[_0x4b34('0x14')]);router[_0x4b34('0x15')](_0x4b34('0xc'),auth[_0x4b34('0xa')](),controller['destroy']);module[_0x4b34('0x16')]=router; \ No newline at end of file +var _0xfcb9=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util'];(function(_0x5abe28,_0x34f1ae){var _0x40bb6b=function(_0x1c7b9e){while(--_0x1c7b9e){_0x5abe28['push'](_0x5abe28['shift']());}};_0x40bb6b(++_0x34f1ae);}(_0xfcb9,0x14e));var _0x9fcb=function(_0x19c05f,_0x3c729a){_0x19c05f=_0x19c05f-0x0;var _0x28f808=_0xfcb9[_0x19c05f];return _0x28f808;};'use strict';var multer=require(_0x9fcb('0x0'));var util=require(_0x9fcb('0x1'));var path=require(_0x9fcb('0x2'));var timeout=require(_0x9fcb('0x3'));var express=require(_0x9fcb('0x4'));var router=express[_0x9fcb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9fcb('0x6'));var interaction=require(_0x9fcb('0x7'));var config=require(_0x9fcb('0x8'));var controller=require(_0x9fcb('0x9'));router[_0x9fcb('0xa')]('/',auth[_0x9fcb('0xb')](),controller[_0x9fcb('0xc')]);router['get'](_0x9fcb('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9fcb('0xa')](_0x9fcb('0xe'),auth[_0x9fcb('0xb')](),controller['preview']);router[_0x9fcb('0xa')]('/:id/run',auth[_0x9fcb('0xb')](),controller[_0x9fcb('0xf')]);router['get'](_0x9fcb('0x10'),auth[_0x9fcb('0xb')](),controller[_0x9fcb('0x11')]);router['post']('/',auth[_0x9fcb('0xb')](),controller[_0x9fcb('0x12')]);router[_0x9fcb('0x13')](_0x9fcb('0xd'),auth[_0x9fcb('0xb')](),controller[_0x9fcb('0x14')]);router[_0x9fcb('0x15')](_0x9fcb('0xd'),auth[_0x9fcb('0xb')](),controller[_0x9fcb('0x16')]);module[_0x9fcb('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index c55b90d..e021341 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbed8=['csv','pdf','xlsx','DATE','Loading','scheduled','manual','UNSIGNED','sequelize','moment','STRING','ENUM'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbed8,0x80));var _0x8bed=function(_0x398d85,_0x2465d7){_0x398d85=_0x398d85-0x0;var _0x33c2bb=_0xbed8[_0x398d85];return _0x33c2bb;};'use strict';var Sequelize=require(_0x8bed('0x0'));var moment=require(_0x8bed('0x1'));module['exports']={'name':{'type':Sequelize[_0x8bed('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x8bed('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x8bed('0x3')](_0x8bed('0x4'),_0x8bed('0x5'),_0x8bed('0x6')),'allowNull':![],'defaultValue':_0x8bed('0x4')},'savename':{'type':Sequelize[_0x8bed('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8bed('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x8bed('0x8')},'type':{'type':Sequelize[_0x8bed('0x3')]('manual',_0x8bed('0x9')),'allowNull':![],'defaultValue':_0x8bed('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x8bed('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x10be=['moment','STRING','ENUM','DATE','manual','scheduled','INTEGER'];(function(_0x387440,_0x5e5ff3){var _0x359d8e=function(_0x3dad05){while(--_0x3dad05){_0x387440['push'](_0x387440['shift']());}};_0x359d8e(++_0x5e5ff3);}(_0x10be,0x103));var _0xe10b=function(_0x4a356c,_0x2cbf99){_0x4a356c=_0x4a356c-0x0;var _0x59b298=_0x10be[_0x4a356c];return _0x59b298;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe10b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xe10b('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xe10b('0x2')]('csv','pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xe10b('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xe10b('0x3')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xe10b('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xe10b('0x2')](_0xe10b('0x4'),_0xe10b('0x5')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xe10b('0x6')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index c14ef58..ac0ea24 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57f4=['set','apply','reject','update','then','destroy','get','ExtractedReports','error','stack','name','send','index','AnalyticExtractedReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','download','params','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','root','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit'];(function(_0x8f4ca2,_0xc4ac52){var _0x126663=function(_0x1eebee){while(--_0x1eebee){_0x8f4ca2['push'](_0x8f4ca2['shift']());}};_0x126663(++_0xc4ac52);}(_0x57f4,0x1b6));var _0x457f=function(_0x5b872c,_0x521dc6){_0x5b872c=_0x5b872c-0x0;var _0x4ffc94=_0x57f4[_0x5b872c];return _0x4ffc94;};'use strict';var emlformat=require(_0x457f('0x0'));var rimraf=require(_0x457f('0x1'));var zipdir=require(_0x457f('0x2'));var jsonpatch=require(_0x457f('0x3'));var rp=require(_0x457f('0x4'));var moment=require(_0x457f('0x5'));var BPromise=require(_0x457f('0x6'));var Mustache=require(_0x457f('0x7'));var util=require(_0x457f('0x8'));var path=require('path');var sox=require(_0x457f('0x9'));var csv=require('to-csv');var ejs=require(_0x457f('0xa'));var fs=require('fs');var fs_extra=require(_0x457f('0xb'));var _=require(_0x457f('0xc'));var squel=require('squel');var crypto=require(_0x457f('0xd'));var jsforce=require(_0x457f('0xe'));var deskjs=require(_0x457f('0xf'));var toCsv=require(_0x457f('0x10'));var querystring=require(_0x457f('0x11'));var Papa=require(_0x457f('0x12'));var Redis=require(_0x457f('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x457f('0x14'));var logger=require(_0x457f('0x15'))('api');var utils=require(_0x457f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x457f('0x17'))['db'];function respondWithStatusCode(_0x59d093,_0x561e52){_0x561e52=_0x561e52||0xcc;return function(_0x1ffc30){if(_0x1ffc30){return _0x59d093[_0x457f('0x18')](_0x561e52);}return _0x59d093[_0x457f('0x19')](_0x561e52)[_0x457f('0x1a')]();};}function respondWithResult(_0x1acb6a,_0x492708){_0x492708=_0x492708||0xc8;return function(_0x36d745){if(_0x36d745){return _0x1acb6a[_0x457f('0x19')](_0x492708)[_0x457f('0x1b')](_0x36d745);}};}function respondWithFilteredResult(_0x2499a9,_0x5d7d0f){return function(_0x476838){if(_0x476838){var _0x92b8e0=typeof _0x5d7d0f['offset']===_0x457f('0x1c')&&typeof _0x5d7d0f['limit']===_0x457f('0x1c');var _0x12c6bd=_0x476838[_0x457f('0x1d')];var _0x47b349=_0x92b8e0?0x0:_0x5d7d0f[_0x457f('0x1e')];var _0x2abd3f=_0x92b8e0?_0x476838[_0x457f('0x1d')]:_0x5d7d0f[_0x457f('0x1e')]+_0x5d7d0f[_0x457f('0x1f')];var _0xc6b218;if(_0x2abd3f>=_0x12c6bd){_0x2abd3f=_0x12c6bd;_0xc6b218=0xc8;}else{_0xc6b218=0xce;}_0x2499a9[_0x457f('0x19')](_0xc6b218);return _0x2499a9[_0x457f('0x20')]('Content-Range',_0x47b349+'-'+_0x2abd3f+'/'+_0x12c6bd)[_0x457f('0x1b')](_0x476838);}return null;};}function patchUpdates(_0xfc9273){return function(_0x202183){try{jsonpatch[_0x457f('0x21')](_0x202183,_0xfc9273,!![]);}catch(_0x1ac777){return BPromise[_0x457f('0x22')](_0x1ac777);}return _0x202183['save']();};}function saveUpdates(_0x436cdd,_0x2b555c){return function(_0x496cf1){if(_0x496cf1){return _0x496cf1[_0x457f('0x23')](_0x436cdd)[_0x457f('0x24')](function(_0x2319d7){return _0x2319d7;});}return null;};}function removeEntity(_0x471fac,_0xe44762){return function(_0x111aeb){if(_0x111aeb){return _0x111aeb[_0x457f('0x25')]()[_0x457f('0x24')](function(){var _0x18447a=_0x111aeb[_0x457f('0x26')]({'plain':!![]});var _0x1753af=_0x457f('0x27');return db['UserProfileResource'][_0x457f('0x25')]({'where':{'type':_0x1753af,'resourceId':_0x18447a['id']}})['then'](function(){return _0x111aeb;});})[_0x457f('0x24')](function(){_0x471fac[_0x457f('0x19')](0xcc)[_0x457f('0x1a')]();});}};}function handleEntityNotFound(_0x5c951b,_0x4a4364){return function(_0x1e6e81){if(!_0x1e6e81){_0x5c951b['sendStatus'](0x194);}return _0x1e6e81;};}function handleError(_0x2148a5,_0x16b947){_0x16b947=_0x16b947||0x1f4;return function(_0xd330e4){logger[_0x457f('0x28')](_0xd330e4[_0x457f('0x29')]);if(_0xd330e4[_0x457f('0x2a')]){delete _0xd330e4[_0x457f('0x2a')];}_0x2148a5['status'](_0x16b947)[_0x457f('0x2b')](_0xd330e4);};}exports[_0x457f('0x2c')]=function(_0x41bda9,_0x28f3d3){var _0x57f9de={},_0x3def51={},_0xe96095={'count':0x0,'rows':[]};var _0x21a148=_['map'](db[_0x457f('0x2d')]['rawAttributes'],function(_0x3354af){return{'name':_0x3354af['fieldName'],'type':_0x3354af[_0x457f('0x2e')][_0x457f('0x2f')]};});_0x3def51[_0x457f('0x30')]=_['map'](_0x21a148,_0x457f('0x2a'));_0x3def51[_0x457f('0x31')]=_[_0x457f('0x32')](_0x41bda9[_0x457f('0x31')]);_0x3def51[_0x457f('0x33')]=_[_0x457f('0x34')](_0x3def51[_0x457f('0x30')],_0x3def51['query']);_0x57f9de[_0x457f('0x35')]=_[_0x457f('0x34')](_0x3def51[_0x457f('0x30')],qs[_0x457f('0x36')](_0x41bda9[_0x457f('0x31')][_0x457f('0x36')]));_0x57f9de['attributes']=_0x57f9de[_0x457f('0x35')][_0x457f('0x37')]?_0x57f9de[_0x457f('0x35')]:_0x3def51['model'];if(!_0x41bda9[_0x457f('0x31')][_0x457f('0x38')](_0x457f('0x39'))){_0x57f9de['limit']=qs['limit'](_0x41bda9[_0x457f('0x31')][_0x457f('0x1f')]);_0x57f9de[_0x457f('0x1e')]=qs[_0x457f('0x1e')](_0x41bda9[_0x457f('0x31')][_0x457f('0x1e')]);}_0x57f9de[_0x457f('0x3a')]=qs[_0x457f('0x3b')](_0x41bda9[_0x457f('0x31')][_0x457f('0x3b')]);_0x57f9de[_0x457f('0x3c')]=qs[_0x457f('0x33')](_[_0x457f('0x3d')](_0x41bda9[_0x457f('0x31')],_0x3def51[_0x457f('0x33')]),_0x21a148);if(_0x41bda9['query'][_0x457f('0x3e')]){_0x57f9de[_0x457f('0x3c')]=_[_0x457f('0x3f')](_0x57f9de['where'],{'$or':_[_0x457f('0x40')](_0x21a148,function(_0x4c7126){if(_0x4c7126[_0x457f('0x2e')]!==_0x457f('0x41')){var _0x34e466={};_0x34e466[_0x4c7126['name']]={'$like':'%'+_0x41bda9[_0x457f('0x31')][_0x457f('0x3e')]+'%'};return _0x34e466;}})});}_0x57f9de=_[_0x457f('0x3f')]({},_0x57f9de,_0x41bda9[_0x457f('0x42')]);var _0x1fbf17={'where':_0x57f9de[_0x457f('0x3c')]};return db[_0x457f('0x2d')]['count'](_0x1fbf17)['then'](function(_0x27eadb){_0xe96095[_0x457f('0x1d')]=_0x27eadb;if(_0x41bda9['query'][_0x457f('0x43')]){_0x57f9de['include']=[{'all':!![]}];}return db[_0x457f('0x2d')][_0x457f('0x44')](_0x57f9de);})[_0x457f('0x24')](function(_0x320154){_0xe96095['rows']=_0x320154;return _0xe96095;})[_0x457f('0x24')](respondWithFilteredResult(_0x28f3d3,_0x57f9de))[_0x457f('0x45')](handleError(_0x28f3d3,null));};exports[_0x457f('0x46')]=function(_0x1d7d5d,_0x5483d2){var _0x27bb2f={'raw':!![],'where':{'id':_0x1d7d5d['params']['id']}},_0x2d448e={};_0x2d448e[_0x457f('0x30')]=_[_0x457f('0x32')](db['AnalyticExtractedReport']['rawAttributes']);_0x2d448e[_0x457f('0x31')]=_[_0x457f('0x32')](_0x1d7d5d[_0x457f('0x31')]);_0x2d448e['filters']=_[_0x457f('0x34')](_0x2d448e[_0x457f('0x30')],_0x2d448e['query']);_0x27bb2f['attributes']=_['intersection'](_0x2d448e[_0x457f('0x30')],qs[_0x457f('0x36')](_0x1d7d5d[_0x457f('0x31')][_0x457f('0x36')]));_0x27bb2f[_0x457f('0x35')]=_0x27bb2f[_0x457f('0x35')]['length']?_0x27bb2f[_0x457f('0x35')]:_0x2d448e[_0x457f('0x30')];if(_0x1d7d5d['query']['includeAll']){_0x27bb2f[_0x457f('0x47')]=[{'all':!![]}];}_0x27bb2f=_[_0x457f('0x3f')]({},_0x27bb2f,_0x1d7d5d[_0x457f('0x42')]);return db['AnalyticExtractedReport'][_0x457f('0x48')](_0x27bb2f)[_0x457f('0x24')](handleEntityNotFound(_0x5483d2,null))[_0x457f('0x24')](respondWithResult(_0x5483d2,null))[_0x457f('0x45')](handleError(_0x5483d2,null));};exports['create']=function(_0x5ae21c,_0x1174d6){return db[_0x457f('0x2d')][_0x457f('0x49')](_0x5ae21c[_0x457f('0x4a')],{})[_0x457f('0x24')](function(_0x132b40){var _0x3a4fa3=_0x5ae21c[_0x457f('0x4b')]['get']({'plain':!![]});if(!_0x3a4fa3)throw new Error(_0x457f('0x4c'));if(_0x3a4fa3['role']===_0x457f('0x4b')){var _0x4ec2d8=_0x132b40['get']({'plain':!![]});var _0x236464=_0x457f('0x27');return db[_0x457f('0x4d')][_0x457f('0x48')]({'where':{'name':_0x236464,'userProfileId':_0x3a4fa3[_0x457f('0x4e')]},'raw':!![]})[_0x457f('0x24')](function(_0x13ff08){if(_0x13ff08&&_0x13ff08[_0x457f('0x4f')]===0x0){return db[_0x457f('0x50')]['create']({'name':_0x4ec2d8[_0x457f('0x2a')],'resourceId':_0x4ec2d8['id'],'type':_0x13ff08[_0x457f('0x2a')],'sectionId':_0x13ff08['id']},{})['then'](function(){return _0x132b40;});}else{return _0x132b40;}})[_0x457f('0x45')](function(_0x1dea73){logger[_0x457f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dea73);throw _0x1dea73;});}return _0x132b40;})['then'](respondWithResult(_0x1174d6,0xc9))[_0x457f('0x45')](handleError(_0x1174d6,null));};exports[_0x457f('0x23')]=function(_0x4aa58b,_0x160dce){if(_0x4aa58b[_0x457f('0x4a')]['id']){delete _0x4aa58b[_0x457f('0x4a')]['id'];}return db[_0x457f('0x2d')][_0x457f('0x48')]({'where':{'id':_0x4aa58b['params']['id']}})['then'](handleEntityNotFound(_0x160dce,null))[_0x457f('0x24')](saveUpdates(_0x4aa58b[_0x457f('0x4a')],null))[_0x457f('0x24')](respondWithResult(_0x160dce,null))[_0x457f('0x45')](handleError(_0x160dce,null));};exports[_0x457f('0x25')]=function(_0x1044e9,_0x6e2881){return db['AnalyticExtractedReport'][_0x457f('0x48')]({'where':{'id':_0x1044e9['params']['id']}})[_0x457f('0x24')](handleEntityNotFound(_0x6e2881,null))[_0x457f('0x24')](removeEntity(_0x6e2881,null))[_0x457f('0x45')](handleError(_0x6e2881,null));};exports[_0x457f('0x51')]=function(_0x4b673b,_0x5680d5,_0x5173d2){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4b673b[_0x457f('0x52')]['id']},'attributes':[_0x457f('0x2a'),_0x457f('0x53'),_0x457f('0x54'),_0x457f('0x55')],'raw':!![]})[_0x457f('0x24')](handleEntityNotFound(_0x5680d5,null))[_0x457f('0x24')](function(_0x2683f2){if(_0x2683f2){if(!fs[_0x457f('0x56')](path[_0x457f('0x57')](config['root'],_0x457f('0x58'),_0x2683f2['savename']))){throw new db[(_0x457f('0x59'))][(_0x457f('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x4b673b['query']['exists']){return _0x5680d5[_0x457f('0x18')](0xc8);}return _0x5680d5[_0x457f('0x51')](path[_0x457f('0x57')](config[_0x457f('0x5b')],_0x457f('0x58'),_0x2683f2[_0x457f('0x54')]),util[_0x457f('0x5c')](_0x457f('0x5d'),_0x2683f2['basename']||_0x2683f2[_0x457f('0x2a')],_0x2683f2[_0x457f('0x55')]['toLowerCase']()));}})['catch'](handleError(_0x5680d5,null));}; \ No newline at end of file +var _0xd31d=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','length','create','body','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','download','basename','savename','output','existsSync','join','root','Sequelize','ValidationError','exists','server/files/reports','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','then','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','model','query','keys','filters','intersection','attributes'];(function(_0x5a104c,_0x4c20bd){var _0x4c92cc=function(_0x13602a){while(--_0x13602a){_0x5a104c['push'](_0x5a104c['shift']());}};_0x4c92cc(++_0x4c20bd);}(_0xd31d,0x1b3));var _0xdd31=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xd31d[_0x999b85];return _0x1d7124;};'use strict';var emlformat=require(_0xdd31('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd31('0x1'));var jsonpatch=require(_0xdd31('0x2'));var rp=require(_0xdd31('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdd31('0x4'));var util=require(_0xdd31('0x5'));var path=require(_0xdd31('0x6'));var sox=require(_0xdd31('0x7'));var csv=require(_0xdd31('0x8'));var ejs=require(_0xdd31('0x9'));var fs=require('fs');var fs_extra=require(_0xdd31('0xa'));var _=require(_0xdd31('0xb'));var squel=require(_0xdd31('0xc'));var crypto=require('crypto');var jsforce=require(_0xdd31('0xd'));var deskjs=require(_0xdd31('0xe'));var toCsv=require(_0xdd31('0x8'));var querystring=require(_0xdd31('0xf'));var Papa=require(_0xdd31('0x10'));var Redis=require(_0xdd31('0x11'));var authService=require(_0xdd31('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdd31('0x13'));var hardwareService=require(_0xdd31('0x14'));var logger=require(_0xdd31('0x15'))(_0xdd31('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdd31('0x17'));var db=require(_0xdd31('0x18'))['db'];function respondWithStatusCode(_0x4f737d,_0x4b5a95){_0x4b5a95=_0x4b5a95||0xcc;return function(_0x18262e){if(_0x18262e){return _0x4f737d['sendStatus'](_0x4b5a95);}return _0x4f737d['status'](_0x4b5a95)[_0xdd31('0x19')]();};}function respondWithResult(_0x228b43,_0x27dfb1){_0x27dfb1=_0x27dfb1||0xc8;return function(_0x5cf482){if(_0x5cf482){return _0x228b43[_0xdd31('0x1a')](_0x27dfb1)['json'](_0x5cf482);}};}function respondWithFilteredResult(_0x1e59de,_0x405bc6){return function(_0x2c1083){if(_0x2c1083){var _0x148ab5=typeof _0x405bc6[_0xdd31('0x1b')]===_0xdd31('0x1c')&&typeof _0x405bc6[_0xdd31('0x1d')]===_0xdd31('0x1c');var _0x23ddd8=_0x2c1083[_0xdd31('0x1e')];var _0x5a7370=_0x148ab5?0x0:_0x405bc6['offset'];var _0x521e55=_0x148ab5?_0x2c1083[_0xdd31('0x1e')]:_0x405bc6['offset']+_0x405bc6[_0xdd31('0x1d')];var _0x23df87;if(_0x521e55>=_0x23ddd8){_0x521e55=_0x23ddd8;_0x23df87=0xc8;}else{_0x23df87=0xce;}_0x1e59de[_0xdd31('0x1a')](_0x23df87);return _0x1e59de[_0xdd31('0x1f')](_0xdd31('0x20'),_0x5a7370+'-'+_0x521e55+'/'+_0x23ddd8)[_0xdd31('0x21')](_0x2c1083);}return null;};}function patchUpdates(_0x45145c){return function(_0x36db28){try{jsonpatch[_0xdd31('0x22')](_0x36db28,_0x45145c,!![]);}catch(_0x33713a){return BPromise['reject'](_0x33713a);}return _0x36db28[_0xdd31('0x23')]();};}function saveUpdates(_0x1c28bc,_0x4c5b31){return function(_0x24a03a){if(_0x24a03a){return _0x24a03a['update'](_0x1c28bc)['then'](function(_0x5baa38){return _0x5baa38;});}return null;};}function removeEntity(_0x475d8e,_0x551d43){return function(_0x2d4478){if(_0x2d4478){return _0x2d4478[_0xdd31('0x24')]()[_0xdd31('0x25')](function(){var _0x52aa2c=_0x2d4478['get']({'plain':!![]});var _0x1d5a71=_0xdd31('0x26');return db[_0xdd31('0x27')][_0xdd31('0x24')]({'where':{'type':_0x1d5a71,'resourceId':_0x52aa2c['id']}})['then'](function(){return _0x2d4478;});})[_0xdd31('0x25')](function(){_0x475d8e[_0xdd31('0x1a')](0xcc)[_0xdd31('0x19')]();});}};}function handleEntityNotFound(_0x26baf0,_0x2a1593){return function(_0x203ae0){if(!_0x203ae0){_0x26baf0[_0xdd31('0x28')](0x194);}return _0x203ae0;};}function handleError(_0xd9dce0,_0x290548){_0x290548=_0x290548||0x1f4;return function(_0x2de6bb){logger[_0xdd31('0x29')](_0x2de6bb[_0xdd31('0x2a')]);if(_0x2de6bb[_0xdd31('0x2b')]){delete _0x2de6bb[_0xdd31('0x2b')];}_0xd9dce0['status'](_0x290548)[_0xdd31('0x2c')](_0x2de6bb);};}exports[_0xdd31('0x2d')]=function(_0x1ad662,_0x2d13b5){var _0x296906={},_0x53232c={},_0x142652={'count':0x0,'rows':[]};var _0xf60b90=_[_0xdd31('0x2e')](db[_0xdd31('0x2f')]['rawAttributes'],function(_0x195e71){return{'name':_0x195e71[_0xdd31('0x30')],'type':_0x195e71['type']['key']};});_0x53232c[_0xdd31('0x31')]=_[_0xdd31('0x2e')](_0xf60b90,_0xdd31('0x2b'));_0x53232c[_0xdd31('0x32')]=_[_0xdd31('0x33')](_0x1ad662[_0xdd31('0x32')]);_0x53232c[_0xdd31('0x34')]=_[_0xdd31('0x35')](_0x53232c[_0xdd31('0x31')],_0x53232c[_0xdd31('0x32')]);_0x296906[_0xdd31('0x36')]=_[_0xdd31('0x35')](_0x53232c[_0xdd31('0x31')],qs['fields'](_0x1ad662[_0xdd31('0x32')]['fields']));_0x296906[_0xdd31('0x36')]=_0x296906[_0xdd31('0x36')]['length']?_0x296906['attributes']:_0x53232c['model'];if(!_0x1ad662['query'][_0xdd31('0x37')](_0xdd31('0x38'))){_0x296906[_0xdd31('0x1d')]=qs['limit'](_0x1ad662[_0xdd31('0x32')][_0xdd31('0x1d')]);_0x296906[_0xdd31('0x1b')]=qs[_0xdd31('0x1b')](_0x1ad662['query']['offset']);}_0x296906['order']=qs[_0xdd31('0x39')](_0x1ad662[_0xdd31('0x32')][_0xdd31('0x39')]);_0x296906[_0xdd31('0x3a')]=qs[_0xdd31('0x34')](_[_0xdd31('0x3b')](_0x1ad662[_0xdd31('0x32')],_0x53232c['filters']),_0xf60b90);if(_0x1ad662[_0xdd31('0x32')][_0xdd31('0x3c')]){_0x296906[_0xdd31('0x3a')]=_[_0xdd31('0x3d')](_0x296906[_0xdd31('0x3a')],{'$or':_['map'](_0xf60b90,function(_0x19e92d){if(_0x19e92d[_0xdd31('0x3e')]!==_0xdd31('0x3f')){var _0x5992ab={};_0x5992ab[_0x19e92d[_0xdd31('0x2b')]]={'$like':'%'+_0x1ad662[_0xdd31('0x32')]['filter']+'%'};return _0x5992ab;}})});}_0x296906=_['merge']({},_0x296906,_0x1ad662[_0xdd31('0x40')]);var _0x1c9d58={'where':_0x296906['where']};return db[_0xdd31('0x2f')][_0xdd31('0x1e')](_0x1c9d58)[_0xdd31('0x25')](function(_0x7492f3){_0x142652[_0xdd31('0x1e')]=_0x7492f3;if(_0x1ad662[_0xdd31('0x32')][_0xdd31('0x41')]){_0x296906[_0xdd31('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xdd31('0x43')](_0x296906);})['then'](function(_0x2d973b){_0x142652[_0xdd31('0x44')]=_0x2d973b;return _0x142652;})[_0xdd31('0x25')](respondWithFilteredResult(_0x2d13b5,_0x296906))[_0xdd31('0x45')](handleError(_0x2d13b5,null));};exports[_0xdd31('0x46')]=function(_0x13c986,_0x1ab8b7){var _0x2aa4eb={'raw':!![],'where':{'id':_0x13c986['params']['id']}},_0x4871cb={};_0x4871cb[_0xdd31('0x31')]=_[_0xdd31('0x33')](db['AnalyticExtractedReport'][_0xdd31('0x47')]);_0x4871cb[_0xdd31('0x32')]=_[_0xdd31('0x33')](_0x13c986[_0xdd31('0x32')]);_0x4871cb[_0xdd31('0x34')]=_[_0xdd31('0x35')](_0x4871cb['model'],_0x4871cb[_0xdd31('0x32')]);_0x2aa4eb['attributes']=_[_0xdd31('0x35')](_0x4871cb[_0xdd31('0x31')],qs[_0xdd31('0x48')](_0x13c986[_0xdd31('0x32')][_0xdd31('0x48')]));_0x2aa4eb[_0xdd31('0x36')]=_0x2aa4eb[_0xdd31('0x36')][_0xdd31('0x49')]?_0x2aa4eb[_0xdd31('0x36')]:_0x4871cb[_0xdd31('0x31')];if(_0x13c986[_0xdd31('0x32')][_0xdd31('0x41')]){_0x2aa4eb[_0xdd31('0x42')]=[{'all':!![]}];}_0x2aa4eb=_['merge']({},_0x2aa4eb,_0x13c986[_0xdd31('0x40')]);return db[_0xdd31('0x2f')]['find'](_0x2aa4eb)[_0xdd31('0x25')](handleEntityNotFound(_0x1ab8b7,null))['then'](respondWithResult(_0x1ab8b7,null))[_0xdd31('0x45')](handleError(_0x1ab8b7,null));};exports[_0xdd31('0x4a')]=function(_0x915cb7,_0x38b440){return db['AnalyticExtractedReport'][_0xdd31('0x4a')](_0x915cb7[_0xdd31('0x4b')],{})[_0xdd31('0x25')](function(_0xbf73ce){var _0xb3e7c=_0x915cb7['user'][_0xdd31('0x4c')]({'plain':!![]});if(!_0xb3e7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb3e7c['role']==='user'){var _0x32c50e=_0xbf73ce[_0xdd31('0x4c')]({'plain':!![]});var _0x3306ad='ExtractedReports';return db[_0xdd31('0x4d')][_0xdd31('0x4e')]({'where':{'name':_0x3306ad,'userProfileId':_0xb3e7c[_0xdd31('0x4f')]},'raw':!![]})['then'](function(_0x8a936b){if(_0x8a936b&&_0x8a936b[_0xdd31('0x50')]===0x0){return db[_0xdd31('0x27')]['create']({'name':_0x32c50e['name'],'resourceId':_0x32c50e['id'],'type':_0x8a936b['name'],'sectionId':_0x8a936b['id']},{})[_0xdd31('0x25')](function(){return _0xbf73ce;});}else{return _0xbf73ce;}})[_0xdd31('0x45')](function(_0x2be25b){logger['error'](_0xdd31('0x51'),_0x2be25b);throw _0x2be25b;});}return _0xbf73ce;})['then'](respondWithResult(_0x38b440,0xc9))['catch'](handleError(_0x38b440,null));};exports[_0xdd31('0x52')]=function(_0x66277f,_0x5eca28){if(_0x66277f[_0xdd31('0x4b')]['id']){delete _0x66277f[_0xdd31('0x4b')]['id'];}return db[_0xdd31('0x2f')]['find']({'where':{'id':_0x66277f['params']['id']}})[_0xdd31('0x25')](handleEntityNotFound(_0x5eca28,null))[_0xdd31('0x25')](saveUpdates(_0x66277f['body'],null))[_0xdd31('0x25')](respondWithResult(_0x5eca28,null))[_0xdd31('0x45')](handleError(_0x5eca28,null));};exports[_0xdd31('0x24')]=function(_0x3085fd,_0x483cb5){return db[_0xdd31('0x2f')][_0xdd31('0x4e')]({'where':{'id':_0x3085fd[_0xdd31('0x53')]['id']}})['then'](handleEntityNotFound(_0x483cb5,null))[_0xdd31('0x25')](removeEntity(_0x483cb5,null))[_0xdd31('0x45')](handleError(_0x483cb5,null));};exports[_0xdd31('0x54')]=function(_0x883938,_0x132e2c,_0x2de559){return db[_0xdd31('0x2f')][_0xdd31('0x4e')]({'where':{'id':_0x883938[_0xdd31('0x53')]['id']},'attributes':['name',_0xdd31('0x55'),_0xdd31('0x56'),_0xdd31('0x57')],'raw':!![]})[_0xdd31('0x25')](handleEntityNotFound(_0x132e2c,null))[_0xdd31('0x25')](function(_0x3cf8b2){if(_0x3cf8b2){if(!fs[_0xdd31('0x58')](path[_0xdd31('0x59')](config[_0xdd31('0x5a')],'server/files/reports',_0x3cf8b2[_0xdd31('0x56')]))){throw new db[(_0xdd31('0x5b'))][(_0xdd31('0x5c'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x883938[_0xdd31('0x32')][_0xdd31('0x5d')]){return _0x132e2c[_0xdd31('0x28')](0xc8);}return _0x132e2c['download'](path['join'](config['root'],_0xdd31('0x5e'),_0x3cf8b2['savename']),util[_0xdd31('0x5f')](_0xdd31('0x60'),_0x3cf8b2[_0xdd31('0x55')]||_0x3cf8b2[_0xdd31('0x2b')],_0x3cf8b2[_0xdd31('0x57')][_0xdd31('0x61')]()));}})[_0xdd31('0x45')](handleError(_0x132e2c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index e4dbdc4..64142fc 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.model.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab3a=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x39d711,_0xe11eb7){var _0xee1d0c=function(_0x457e08){while(--_0x457e08){_0x39d711['push'](_0x39d711['shift']());}};_0xee1d0c(++_0xe11eb7);}(_0xab3a,0xb9));var _0xaab3=function(_0x4452a1,_0x1d50fa){_0x4452a1=_0x4452a1-0x0;var _0x2e5604=_0xab3a[_0x4452a1];return _0x2e5604;};'use strict';var _=require(_0xaab3('0x0'));var util=require('util');var logger=require(_0xaab3('0x1'))(_0xaab3('0x2'));var moment=require(_0xaab3('0x3'));var BPromise=require('bluebird');var rp=require(_0xaab3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaab3('0x5'));var config=require(_0xaab3('0x6'));var attributes=require(_0xaab3('0x7'));module[_0xaab3('0x8')]=function(_0x30a442,_0x315675){return _0x30a442[_0xaab3('0x9')](_0xaab3('0xa'),attributes,{'tableName':_0xaab3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb23d=['../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0xb23d,0x84));var _0xdb23=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0xb23d[_0x5ecadc];return _0x565037;};'use strict';var _=require(_0xdb23('0x0'));var util=require(_0xdb23('0x1'));var logger=require(_0xdb23('0x2'))('api');var moment=require(_0xdb23('0x3'));var BPromise=require(_0xdb23('0x4'));var rp=require(_0xdb23('0x5'));var fs=require('fs');var path=require(_0xdb23('0x6'));var rimraf=require(_0xdb23('0x7'));var config=require(_0xdb23('0x8'));var attributes=require(_0xdb23('0x9'));module[_0xdb23('0xa')]=function(_0x29df6a,_0x312a42){return _0x29df6a[_0xdb23('0xb')](_0xdb23('0xc'),attributes,{'tableName':_0xdb23('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 6bf1bb6..f3157e9 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87ed=['message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x17bb5b,_0x36806f){var _0x3dddc8=function(_0x3084d4){while(--_0x3084d4){_0x17bb5b['push'](_0x17bb5b['shift']());}};_0x3dddc8(++_0x36806f);}(_0x87ed,0x88));var _0xd87e=function(_0x16946b,_0x5ea65a){_0x16946b=_0x16946b-0x0;var _0x322ea3=_0x87ed[_0x16946b];return _0x322ea3;};'use strict';var _=require(_0xd87e('0x0'));var util=require(_0xd87e('0x1'));var moment=require(_0xd87e('0x2'));var BPromise=require('bluebird');var rs=require(_0xd87e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd87e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd87e('0x5'));var jayson=require(_0xd87e('0x6'));var client=jayson['client'][_0xd87e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c43f2,_0x22073e,_0x275705){return new BPromise(function(_0x52d938,_0x55bbf3){return client[_0xd87e('0x8')](_0x4c43f2,_0x275705)['then'](function(_0x436bb6){logger[_0xd87e('0x9')](_0xd87e('0xa'),_0x22073e,_0xd87e('0xb'));logger[_0xd87e('0xc')](_0xd87e('0xd'),_0x22073e,_0xd87e('0xb'),JSON['stringify'](_0x436bb6));if(_0x436bb6[_0xd87e('0xe')]){if(_0x436bb6['error'][_0xd87e('0xf')]===0x1f4){logger[_0xd87e('0xe')](_0xd87e('0xa'),_0x22073e,_0x436bb6['error'][_0xd87e('0x10')]);return _0x55bbf3(_0x436bb6['error'][_0xd87e('0x10')]);}logger['error'](_0xd87e('0xa'),_0x22073e,_0x436bb6[_0xd87e('0xe')][_0xd87e('0x10')]);return _0x52d938(_0x436bb6[_0xd87e('0xe')][_0xd87e('0x10')]);}else{logger['info'](_0xd87e('0xa'),_0x22073e,_0xd87e('0xb'));_0x52d938(_0x436bb6[_0xd87e('0x11')]['message']);}})[_0xd87e('0x12')](function(_0xed36a4){logger[_0xd87e('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x22073e,_0xed36a4);_0x55bbf3(_0xed36a4);});});} \ No newline at end of file +var _0xc5a8=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x496af1,_0x2d5f59){var _0x5700b3=function(_0x4e346a){while(--_0x4e346a){_0x496af1['push'](_0x496af1['shift']());}};_0x5700b3(++_0x2d5f59);}(_0xc5a8,0x144));var _0x8c5a=function(_0x170c9e,_0x303595){_0x170c9e=_0x170c9e-0x0;var _0x849fc0=_0xc5a8[_0x170c9e];return _0x849fc0;};'use strict';var _=require(_0x8c5a('0x0'));var util=require(_0x8c5a('0x1'));var moment=require('moment');var BPromise=require(_0x8c5a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c5a('0x3'));var db=require(_0x8c5a('0x4'))['db'];var utils=require(_0x8c5a('0x5'));var logger=require(_0x8c5a('0x6'))(_0x8c5a('0x7'));var config=require(_0x8c5a('0x8'));var jayson=require(_0x8c5a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5447a9,_0x59c420,_0x402b90){return new BPromise(function(_0x26de35,_0x3a1648){return client[_0x8c5a('0xa')](_0x5447a9,_0x402b90)[_0x8c5a('0xb')](function(_0x4be2a4){logger[_0x8c5a('0xc')](_0x8c5a('0xd'),_0x59c420,'request\x20sent');logger[_0x8c5a('0xe')](_0x8c5a('0xf'),_0x59c420,'request\x20sent',JSON[_0x8c5a('0x10')](_0x4be2a4));if(_0x4be2a4['error']){if(_0x4be2a4[_0x8c5a('0x11')][_0x8c5a('0x12')]===0x1f4){logger[_0x8c5a('0x11')](_0x8c5a('0xd'),_0x59c420,_0x4be2a4[_0x8c5a('0x11')]['message']);return _0x3a1648(_0x4be2a4[_0x8c5a('0x11')][_0x8c5a('0x13')]);}logger[_0x8c5a('0x11')](_0x8c5a('0xd'),_0x59c420,_0x4be2a4[_0x8c5a('0x11')][_0x8c5a('0x13')]);return _0x26de35(_0x4be2a4[_0x8c5a('0x11')][_0x8c5a('0x13')]);}else{logger[_0x8c5a('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x59c420,_0x8c5a('0x14'));_0x26de35(_0x4be2a4[_0x8c5a('0x15')][_0x8c5a('0x13')]);}})['catch'](function(_0x49bd7d){logger[_0x8c5a('0x11')](_0x8c5a('0xd'),_0x59c420,_0x49bd7d);_0x3a1648(_0x49bd7d);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 067c981..5b10e31 100644 --- a/server/api/analyticExtractedReport/index.js +++ b/server/api/analyticExtractedReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeca1=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller'];(function(_0x28449c,_0x40bdbd){var _0x96cc9e=function(_0x15667b){while(--_0x15667b){_0x28449c['push'](_0x28449c['shift']());}};_0x96cc9e(++_0x40bdbd);}(_0xeca1,0x85));var _0x1eca=function(_0x40724e,_0x23f01c){_0x40724e=_0x40724e-0x0;var _0x42b101=_0xeca1[_0x40724e];return _0x42b101;};'use strict';var multer=require(_0x1eca('0x0'));var util=require(_0x1eca('0x1'));var path=require(_0x1eca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1eca('0x3'));var auth=require(_0x1eca('0x4'));var interaction=require(_0x1eca('0x5'));var config=require('../../config/environment');var controller=require(_0x1eca('0x6'));router[_0x1eca('0x7')]('/',auth[_0x1eca('0x8')](),controller[_0x1eca('0x9')]);router[_0x1eca('0x7')](_0x1eca('0xa'),auth[_0x1eca('0x8')](),controller[_0x1eca('0xb')]);router[_0x1eca('0x7')](_0x1eca('0xc'),auth['isAuthenticated'](),controller[_0x1eca('0xd')]);router[_0x1eca('0xe')]('/',auth[_0x1eca('0x8')](),controller[_0x1eca('0xf')]);router[_0x1eca('0x10')](_0x1eca('0xa'),auth['isAuthenticated'](),controller[_0x1eca('0x11')]);router['delete'](_0x1eca('0xa'),auth['isAuthenticated'](),controller[_0x1eca('0x12')]);module[_0x1eca('0x13')]=router; \ No newline at end of file +var _0x8561=['../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','download','post','put','update','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4c30c8,_0x1e34ff){var _0xc66228=function(_0x159165){while(--_0x159165){_0x4c30c8['push'](_0x4c30c8['shift']());}};_0xc66228(++_0x1e34ff);}(_0x8561,0xba));var _0x1856=function(_0x1334aa,_0x2a09c9){_0x1334aa=_0x1334aa-0x0;var _0x1062f9=_0x8561[_0x1334aa];return _0x1062f9;};'use strict';var multer=require(_0x1856('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1856('0x1'));var router=express[_0x1856('0x2')]();var fs_extra=require(_0x1856('0x3'));var auth=require(_0x1856('0x4'));var interaction=require(_0x1856('0x5'));var config=require(_0x1856('0x6'));var controller=require(_0x1856('0x7'));router[_0x1856('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1856('0x8')](_0x1856('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1856('0x8')]('/:id/download',auth[_0x1856('0xa')](),controller[_0x1856('0xb')]);router[_0x1856('0xc')]('/',auth[_0x1856('0xa')](),controller['create']);router[_0x1856('0xd')](_0x1856('0x9'),auth[_0x1856('0xa')](),controller[_0x1856('0xe')]);router['delete'](_0x1856('0x9'),auth[_0x1856('0xa')](),controller[_0x1856('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index afaec42..130376e 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf80=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x42004d,_0x127961){var _0xb47cd4=function(_0x5a3b8d){while(--_0x5a3b8d){_0x42004d['push'](_0x42004d['shift']());}};_0xb47cd4(++_0x127961);}(_0xaf80,0x92));var _0x0af8=function(_0x1f12a9,_0x3457fc){_0x1f12a9=_0x1f12a9-0x0;var _0x1e3b99=_0xaf80[_0x1f12a9];return _0x1e3b99;};'use strict';var Sequelize=require(_0x0af8('0x0'));module['exports']={'field':{'type':Sequelize[_0x0af8('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x0af8('0x2')]},'format':{'type':Sequelize[_0x0af8('0x2')]},'groupBy':{'type':Sequelize[_0x0af8('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0af8('0x2')]},'custom':{'type':Sequelize[_0x0af8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7104=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4ef68f,_0x2dca6d){var _0x24c902=function(_0x30f9d0){while(--_0x30f9d0){_0x4ef68f['push'](_0x4ef68f['shift']());}};_0x24c902(++_0x2dca6d);}(_0x7104,0xbd));var _0x4710=function(_0x366804,_0x14fae9){_0x366804=_0x366804-0x0;var _0x29e66a=_0x7104[_0x366804];return _0x29e66a;};'use strict';var Sequelize=require(_0x4710('0x0'));module[_0x4710('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x4710('0x2')]},'function':{'type':Sequelize[_0x4710('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x4710('0x2')]},'custom':{'type':Sequelize[_0x4710('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index f8f2293..1b65ece 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.controller.js +++ b/server/api/analyticFieldReport/analyticFieldReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebd5=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','bulkCreate','body','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','save','then','destroy','error','name','send','index','map','AnalyticFieldReport'];(function(_0x1d4934,_0x273e2b){var _0x3603f7=function(_0x41f762){while(--_0x41f762){_0x1d4934['push'](_0x1d4934['shift']());}};_0x3603f7(++_0x273e2b);}(_0xebd5,0x71));var _0x5ebd=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xebd5[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x5ebd('0x0'));var rimraf=require(_0x5ebd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ebd('0x2'));var moment=require(_0x5ebd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5ebd('0x4'));var path=require(_0x5ebd('0x5'));var sox=require(_0x5ebd('0x6'));var csv=require('to-csv');var ejs=require(_0x5ebd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ebd('0x8'));var squel=require('squel');var crypto=require(_0x5ebd('0x9'));var jsforce=require(_0x5ebd('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ebd('0xb'));var Papa=require(_0x5ebd('0xc'));var Redis=require(_0x5ebd('0xd'));var authService=require(_0x5ebd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5ebd('0xf'));var hardwareService=require(_0x5ebd('0x10'));var logger=require('../../config/logger')(_0x5ebd('0x11'));var utils=require(_0x5ebd('0x12'));var config=require(_0x5ebd('0x13'));var licenseUtil=require(_0x5ebd('0x14'));var db=require(_0x5ebd('0x15'))['db'];function respondWithStatusCode(_0x315f39,_0x30c24f){_0x30c24f=_0x30c24f||0xcc;return function(_0x5c9925){if(_0x5c9925){return _0x315f39[_0x5ebd('0x16')](_0x30c24f);}return _0x315f39['status'](_0x30c24f)[_0x5ebd('0x17')]();};}function respondWithResult(_0x3d6b1a,_0x3481db){_0x3481db=_0x3481db||0xc8;return function(_0x4ce10a){if(_0x4ce10a){return _0x3d6b1a['status'](_0x3481db)[_0x5ebd('0x18')](_0x4ce10a);}};}function respondWithFilteredResult(_0x12c306,_0x3f9ab3){return function(_0x981d23){if(_0x981d23){var _0x47a85c=typeof _0x3f9ab3[_0x5ebd('0x19')]===_0x5ebd('0x1a')&&typeof _0x3f9ab3['limit']===_0x5ebd('0x1a');var _0x155e88=_0x981d23[_0x5ebd('0x1b')];var _0x18217f=_0x47a85c?0x0:_0x3f9ab3[_0x5ebd('0x19')];var _0x28308d=_0x47a85c?_0x981d23[_0x5ebd('0x1b')]:_0x3f9ab3[_0x5ebd('0x19')]+_0x3f9ab3[_0x5ebd('0x1c')];var _0x2a06e8;if(_0x28308d>=_0x155e88){_0x28308d=_0x155e88;_0x2a06e8=0xc8;}else{_0x2a06e8=0xce;}_0x12c306[_0x5ebd('0x1d')](_0x2a06e8);return _0x12c306[_0x5ebd('0x1e')](_0x5ebd('0x1f'),_0x18217f+'-'+_0x28308d+'/'+_0x155e88)[_0x5ebd('0x18')](_0x981d23);}return null;};}function patchUpdates(_0x30547b){return function(_0xdac639){try{jsonpatch['apply'](_0xdac639,_0x30547b,!![]);}catch(_0x55be72){return BPromise['reject'](_0x55be72);}return _0xdac639[_0x5ebd('0x20')]();};}function saveUpdates(_0x43e542,_0x39eff1){return function(_0x151ffa){if(_0x151ffa){return _0x151ffa['update'](_0x43e542)[_0x5ebd('0x21')](function(_0x338f97){return _0x338f97;});}return null;};}function removeEntity(_0x4ddcc2,_0x160509){return function(_0x6e869b){if(_0x6e869b){return _0x6e869b[_0x5ebd('0x22')]()[_0x5ebd('0x21')](function(){_0x4ddcc2[_0x5ebd('0x1d')](0xcc)[_0x5ebd('0x17')]();});}};}function handleEntityNotFound(_0x59cc2e,_0x547f35){return function(_0x35f1c4){if(!_0x35f1c4){_0x59cc2e[_0x5ebd('0x16')](0x194);}return _0x35f1c4;};}function handleError(_0x3ebc2c,_0x4614f1){_0x4614f1=_0x4614f1||0x1f4;return function(_0x25e6f9){logger[_0x5ebd('0x23')](_0x25e6f9['stack']);if(_0x25e6f9[_0x5ebd('0x24')]){delete _0x25e6f9[_0x5ebd('0x24')];}_0x3ebc2c['status'](_0x4614f1)[_0x5ebd('0x25')](_0x25e6f9);};}exports[_0x5ebd('0x26')]=function(_0x4fd9bd,_0x3e8e28){var _0x7128e9={},_0x2ed99b={},_0x11c38a={'count':0x0,'rows':[]};var _0x1128b5=_[_0x5ebd('0x27')](db[_0x5ebd('0x28')]['rawAttributes'],function(_0x5665a9){return{'name':_0x5665a9[_0x5ebd('0x29')],'type':_0x5665a9[_0x5ebd('0x2a')]['key']};});_0x2ed99b[_0x5ebd('0x2b')]=_['map'](_0x1128b5,_0x5ebd('0x24'));_0x2ed99b[_0x5ebd('0x2c')]=_[_0x5ebd('0x2d')](_0x4fd9bd['query']);_0x2ed99b[_0x5ebd('0x2e')]=_[_0x5ebd('0x2f')](_0x2ed99b['model'],_0x2ed99b[_0x5ebd('0x2c')]);_0x7128e9[_0x5ebd('0x30')]=_[_0x5ebd('0x2f')](_0x2ed99b[_0x5ebd('0x2b')],qs[_0x5ebd('0x31')](_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x31')]));_0x7128e9[_0x5ebd('0x30')]=_0x7128e9[_0x5ebd('0x30')]['length']?_0x7128e9[_0x5ebd('0x30')]:_0x2ed99b[_0x5ebd('0x2b')];if(!_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x32')](_0x5ebd('0x33'))){_0x7128e9['limit']=qs['limit'](_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x1c')]);_0x7128e9['offset']=qs[_0x5ebd('0x19')](_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x19')]);}_0x7128e9[_0x5ebd('0x34')]=qs['sort'](_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x35')]);_0x7128e9[_0x5ebd('0x36')]=qs['filters'](_[_0x5ebd('0x37')](_0x4fd9bd['query'],_0x2ed99b[_0x5ebd('0x2e')]),_0x1128b5);if(_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x38')]){_0x7128e9[_0x5ebd('0x36')]=_[_0x5ebd('0x39')](_0x7128e9['where'],{'$or':_[_0x5ebd('0x27')](_0x1128b5,function(_0x380310){if(_0x380310[_0x5ebd('0x2a')]!==_0x5ebd('0x3a')){var _0x247f04={};_0x247f04[_0x380310['name']]={'$like':'%'+_0x4fd9bd['query'][_0x5ebd('0x38')]+'%'};return _0x247f04;}})});}_0x7128e9=_[_0x5ebd('0x39')]({},_0x7128e9,_0x4fd9bd[_0x5ebd('0x3b')]);var _0x5970a0={'where':_0x7128e9[_0x5ebd('0x36')]};return db[_0x5ebd('0x28')][_0x5ebd('0x1b')](_0x5970a0)[_0x5ebd('0x21')](function(_0x45fe2f){_0x11c38a[_0x5ebd('0x1b')]=_0x45fe2f;if(_0x4fd9bd['query'][_0x5ebd('0x3c')]){_0x7128e9[_0x5ebd('0x3d')]=[{'all':!![]}];}return db[_0x5ebd('0x28')]['findAll'](_0x7128e9);})[_0x5ebd('0x21')](function(_0x108cf8){_0x11c38a[_0x5ebd('0x3e')]=_0x108cf8;return _0x11c38a;})[_0x5ebd('0x21')](respondWithFilteredResult(_0x3e8e28,_0x7128e9))[_0x5ebd('0x3f')](handleError(_0x3e8e28,null));};exports[_0x5ebd('0x40')]=function(_0x20be2d,_0x25d7c7){var _0x58f29b={'raw':![],'where':{'id':_0x20be2d[_0x5ebd('0x41')]['id']}},_0x130c42={};_0x130c42[_0x5ebd('0x2b')]=_[_0x5ebd('0x2d')](db['AnalyticFieldReport'][_0x5ebd('0x42')]);_0x130c42['query']=_['keys'](_0x20be2d[_0x5ebd('0x2c')]);_0x130c42[_0x5ebd('0x2e')]=_[_0x5ebd('0x2f')](_0x130c42[_0x5ebd('0x2b')],_0x130c42['query']);_0x58f29b[_0x5ebd('0x30')]=_[_0x5ebd('0x2f')](_0x130c42[_0x5ebd('0x2b')],qs[_0x5ebd('0x31')](_0x20be2d['query'][_0x5ebd('0x31')]));_0x58f29b['attributes']=_0x58f29b['attributes']['length']?_0x58f29b['attributes']:_0x130c42['model'];if(_0x20be2d['query'][_0x5ebd('0x3c')]){_0x58f29b[_0x5ebd('0x3d')]=[{'all':!![]}];}_0x58f29b=_[_0x5ebd('0x39')]({},_0x58f29b,_0x20be2d['options']);return db[_0x5ebd('0x28')][_0x5ebd('0x43')](_0x58f29b)['then'](handleEntityNotFound(_0x25d7c7,null))['then'](respondWithResult(_0x25d7c7,null))[_0x5ebd('0x3f')](handleError(_0x25d7c7,null));};exports[_0x5ebd('0x44')]=function(_0x1cd137,_0x33f94d){return db[_0x5ebd('0x28')][_0x5ebd('0x44')](_0x1cd137['body'],{})[_0x5ebd('0x21')](respondWithResult(_0x33f94d,0xc9))['catch'](handleError(_0x33f94d,null));};exports['bulkCreate']=function(_0x758bfa,_0x2bf8f5){return db[_0x5ebd('0x28')][_0x5ebd('0x45')](_0x758bfa[_0x5ebd('0x46')],{'raw':![],'individualHooks':!![]})[_0x5ebd('0x21')](respondWithResult(_0x2bf8f5,0xc9))[_0x5ebd('0x3f')](handleError(_0x2bf8f5,null));};exports['update']=function(_0xaad01,_0x288a92){if(_0xaad01[_0x5ebd('0x46')]['id']){delete _0xaad01[_0x5ebd('0x46')]['id'];}return db[_0x5ebd('0x28')][_0x5ebd('0x43')]({'where':{'id':_0xaad01['params']['id']}})[_0x5ebd('0x21')](handleEntityNotFound(_0x288a92,null))[_0x5ebd('0x21')](saveUpdates(_0xaad01[_0x5ebd('0x46')],null))['then'](respondWithResult(_0x288a92,null))['catch'](handleError(_0x288a92,null));};exports[_0x5ebd('0x22')]=function(_0x42c793,_0x1b96c0){return db['AnalyticFieldReport'][_0x5ebd('0x43')]({'where':{'id':_0x42c793[_0x5ebd('0x41')]['id']}})[_0x5ebd('0x21')](handleEntityNotFound(_0x1b96c0,null))[_0x5ebd('0x21')](removeEntity(_0x1b96c0,null))[_0x5ebd('0x3f')](handleError(_0x1b96c0,null));};exports['bulkDestroy']=function(_0x3812a3,_0x20b6b7){return db[_0x5ebd('0x28')][_0x5ebd('0x22')]({'where':{'id':_0x3812a3[_0x5ebd('0x2c')][_0x5ebd('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x5ebd('0x21')](respondWithResult(_0x20b6b7,0xcc))['catch'](handleError(_0x20b6b7,null));};exports[_0x5ebd('0x48')]=function(_0x3edf69,_0x52223a,_0xe92951){return db[_0x5ebd('0x49')]['findOne']({'where':{'id':_0x3edf69['params']['id']}})[_0x5ebd('0x21')](handleEntityNotFound(_0x52223a,null))['then'](function(_0x456a99){if(_0x456a99){return db[_0x5ebd('0x4a')][_0x5ebd('0x4b')](function(_0x2d3bac){return db[_0x5ebd('0x28')]['destroy']({'where':{'CustomReportId':_0x3edf69[_0x5ebd('0x41')]['id']},'transaction':_0x2d3bac})['then'](function(_0x43c1a3){var _0x2c3f2f=_[_0x5ebd('0x27')](_0x3edf69[_0x5ebd('0x46')],function(_0x125e32){delete _0x125e32['id'];_0x125e32[_0x5ebd('0x4c')]=_0x3edf69[_0x5ebd('0x41')]['id'];return _0x125e32;});return db[_0x5ebd('0x28')][_0x5ebd('0x45')](_0x2c3f2f,{'transaction':_0x2d3bac});});})['then'](function(){return db[_0x5ebd('0x28')]['findAll']({'where':{'CustomReportId':_0x3edf69['params']['id']}});});}})[_0x5ebd('0x21')](respondWithResult(_0x52223a,null))[_0x5ebd('0x3f')](handleError(_0x52223a,null));}; \ No newline at end of file +var _0xf767=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','merge','find','create','body','bulkCreate','update','bulkDestroy','destroy','ids','AnalyticCustomReport','findOne','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','count','limit','status','set','json','apply','save','then','error','stack','name','map','AnalyticFieldReport','fieldName','type','key','query'];(function(_0x4cc113,_0x1efdf7){var _0x490b11=function(_0x15f024){while(--_0x15f024){_0x4cc113['push'](_0x4cc113['shift']());}};_0x490b11(++_0x1efdf7);}(_0xf767,0x76));var _0x7f76=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0xf767[_0x51ac09];return _0x3f827d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f76('0x0'));var zipdir=require(_0x7f76('0x1'));var jsonpatch=require(_0x7f76('0x2'));var rp=require(_0x7f76('0x3'));var moment=require(_0x7f76('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f76('0x5'));var util=require(_0x7f76('0x6'));var path=require(_0x7f76('0x7'));var sox=require(_0x7f76('0x8'));var csv=require('to-csv');var ejs=require(_0x7f76('0x9'));var fs=require('fs');var fs_extra=require(_0x7f76('0xa'));var _=require(_0x7f76('0xb'));var squel=require(_0x7f76('0xc'));var crypto=require(_0x7f76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f76('0xe'));var toCsv=require(_0x7f76('0xf'));var querystring=require(_0x7f76('0x10'));var Papa=require(_0x7f76('0x11'));var Redis=require('ioredis');var authService=require(_0x7f76('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f76('0x13'));var hardwareService=require(_0x7f76('0x14'));var logger=require(_0x7f76('0x15'))(_0x7f76('0x16'));var utils=require(_0x7f76('0x17'));var config=require(_0x7f76('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f76('0x19'))['db'];function respondWithStatusCode(_0x2cd1b3,_0x47403b){_0x47403b=_0x47403b||0xcc;return function(_0x32392b){if(_0x32392b){return _0x2cd1b3[_0x7f76('0x1a')](_0x47403b);}return _0x2cd1b3['status'](_0x47403b)[_0x7f76('0x1b')]();};}function respondWithResult(_0x4d8de0,_0x42a9d3){_0x42a9d3=_0x42a9d3||0xc8;return function(_0x256f79){if(_0x256f79){return _0x4d8de0['status'](_0x42a9d3)['json'](_0x256f79);}};}function respondWithFilteredResult(_0x58d2f3,_0xe81aa9){return function(_0x2df2db){if(_0x2df2db){var _0x286e96=typeof _0xe81aa9['offset']===_0x7f76('0x1c')&&typeof _0xe81aa9['limit']===_0x7f76('0x1c');var _0x3ceb6a=_0x2df2db[_0x7f76('0x1d')];var _0x4802ff=_0x286e96?0x0:_0xe81aa9['offset'];var _0x494537=_0x286e96?_0x2df2db['count']:_0xe81aa9['offset']+_0xe81aa9[_0x7f76('0x1e')];var _0xdb1407;if(_0x494537>=_0x3ceb6a){_0x494537=_0x3ceb6a;_0xdb1407=0xc8;}else{_0xdb1407=0xce;}_0x58d2f3[_0x7f76('0x1f')](_0xdb1407);return _0x58d2f3[_0x7f76('0x20')]('Content-Range',_0x4802ff+'-'+_0x494537+'/'+_0x3ceb6a)[_0x7f76('0x21')](_0x2df2db);}return null;};}function patchUpdates(_0x557c0f){return function(_0x38c4d6){try{jsonpatch[_0x7f76('0x22')](_0x38c4d6,_0x557c0f,!![]);}catch(_0x5a28b0){return BPromise['reject'](_0x5a28b0);}return _0x38c4d6[_0x7f76('0x23')]();};}function saveUpdates(_0xb647d8,_0x5efed5){return function(_0x3f2536){if(_0x3f2536){return _0x3f2536['update'](_0xb647d8)[_0x7f76('0x24')](function(_0x333056){return _0x333056;});}return null;};}function removeEntity(_0x31993d,_0x3deb00){return function(_0x3eea75){if(_0x3eea75){return _0x3eea75['destroy']()[_0x7f76('0x24')](function(){_0x31993d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197519,_0x45f1c9){return function(_0x3492f4){if(!_0x3492f4){_0x197519['sendStatus'](0x194);}return _0x3492f4;};}function handleError(_0xbe6ac1,_0x1347bf){_0x1347bf=_0x1347bf||0x1f4;return function(_0x3e624d){logger[_0x7f76('0x25')](_0x3e624d[_0x7f76('0x26')]);if(_0x3e624d['name']){delete _0x3e624d[_0x7f76('0x27')];}_0xbe6ac1[_0x7f76('0x1f')](_0x1347bf)['send'](_0x3e624d);};}exports['index']=function(_0xe459de,_0x58829a){var _0x1dd664={},_0x3542e3={},_0xd5ba7={'count':0x0,'rows':[]};var _0x393bdd=_[_0x7f76('0x28')](db[_0x7f76('0x29')]['rawAttributes'],function(_0x3570ec){return{'name':_0x3570ec[_0x7f76('0x2a')],'type':_0x3570ec[_0x7f76('0x2b')][_0x7f76('0x2c')]};});_0x3542e3['model']=_[_0x7f76('0x28')](_0x393bdd,_0x7f76('0x27'));_0x3542e3[_0x7f76('0x2d')]=_['keys'](_0xe459de[_0x7f76('0x2d')]);_0x3542e3[_0x7f76('0x2e')]=_[_0x7f76('0x2f')](_0x3542e3[_0x7f76('0x30')],_0x3542e3[_0x7f76('0x2d')]);_0x1dd664[_0x7f76('0x31')]=_[_0x7f76('0x2f')](_0x3542e3[_0x7f76('0x30')],qs[_0x7f76('0x32')](_0xe459de[_0x7f76('0x2d')][_0x7f76('0x32')]));_0x1dd664[_0x7f76('0x31')]=_0x1dd664[_0x7f76('0x31')]['length']?_0x1dd664[_0x7f76('0x31')]:_0x3542e3[_0x7f76('0x30')];if(!_0xe459de[_0x7f76('0x2d')][_0x7f76('0x33')](_0x7f76('0x34'))){_0x1dd664[_0x7f76('0x1e')]=qs[_0x7f76('0x1e')](_0xe459de[_0x7f76('0x2d')]['limit']);_0x1dd664[_0x7f76('0x35')]=qs['offset'](_0xe459de['query'][_0x7f76('0x35')]);}_0x1dd664['order']=qs[_0x7f76('0x36')](_0xe459de[_0x7f76('0x2d')]['sort']);_0x1dd664[_0x7f76('0x37')]=qs['filters'](_['pick'](_0xe459de[_0x7f76('0x2d')],_0x3542e3[_0x7f76('0x2e')]),_0x393bdd);if(_0xe459de[_0x7f76('0x2d')][_0x7f76('0x38')]){_0x1dd664[_0x7f76('0x37')]=_['merge'](_0x1dd664[_0x7f76('0x37')],{'$or':_[_0x7f76('0x28')](_0x393bdd,function(_0x4edf74){if(_0x4edf74['type']!==_0x7f76('0x39')){var _0x4ea167={};_0x4ea167[_0x4edf74[_0x7f76('0x27')]]={'$like':'%'+_0xe459de[_0x7f76('0x2d')][_0x7f76('0x38')]+'%'};return _0x4ea167;}})});}_0x1dd664=_['merge']({},_0x1dd664,_0xe459de[_0x7f76('0x3a')]);var _0x26b537={'where':_0x1dd664[_0x7f76('0x37')]};return db[_0x7f76('0x29')][_0x7f76('0x1d')](_0x26b537)[_0x7f76('0x24')](function(_0x58649f){_0xd5ba7['count']=_0x58649f;if(_0xe459de[_0x7f76('0x2d')][_0x7f76('0x3b')]){_0x1dd664[_0x7f76('0x3c')]=[{'all':!![]}];}return db[_0x7f76('0x29')][_0x7f76('0x3d')](_0x1dd664);})[_0x7f76('0x24')](function(_0x401284){_0xd5ba7[_0x7f76('0x3e')]=_0x401284;return _0xd5ba7;})[_0x7f76('0x24')](respondWithFilteredResult(_0x58829a,_0x1dd664))[_0x7f76('0x3f')](handleError(_0x58829a,null));};exports[_0x7f76('0x40')]=function(_0x313d37,_0x3229b9){var _0x391d04={'raw':![],'where':{'id':_0x313d37[_0x7f76('0x41')]['id']}},_0x2a43f1={};_0x2a43f1[_0x7f76('0x30')]=_[_0x7f76('0x42')](db['AnalyticFieldReport'][_0x7f76('0x43')]);_0x2a43f1[_0x7f76('0x2d')]=_[_0x7f76('0x42')](_0x313d37['query']);_0x2a43f1['filters']=_[_0x7f76('0x2f')](_0x2a43f1['model'],_0x2a43f1[_0x7f76('0x2d')]);_0x391d04['attributes']=_['intersection'](_0x2a43f1[_0x7f76('0x30')],qs[_0x7f76('0x32')](_0x313d37[_0x7f76('0x2d')][_0x7f76('0x32')]));_0x391d04[_0x7f76('0x31')]=_0x391d04[_0x7f76('0x31')][_0x7f76('0x44')]?_0x391d04[_0x7f76('0x31')]:_0x2a43f1[_0x7f76('0x30')];if(_0x313d37[_0x7f76('0x2d')][_0x7f76('0x3b')]){_0x391d04[_0x7f76('0x3c')]=[{'all':!![]}];}_0x391d04=_[_0x7f76('0x45')]({},_0x391d04,_0x313d37[_0x7f76('0x3a')]);return db['AnalyticFieldReport'][_0x7f76('0x46')](_0x391d04)['then'](handleEntityNotFound(_0x3229b9,null))[_0x7f76('0x24')](respondWithResult(_0x3229b9,null))[_0x7f76('0x3f')](handleError(_0x3229b9,null));};exports[_0x7f76('0x47')]=function(_0x39bbef,_0x487b1f){return db[_0x7f76('0x29')][_0x7f76('0x47')](_0x39bbef[_0x7f76('0x48')],{})[_0x7f76('0x24')](respondWithResult(_0x487b1f,0xc9))['catch'](handleError(_0x487b1f,null));};exports[_0x7f76('0x49')]=function(_0xd87fe7,_0x53f77a){return db[_0x7f76('0x29')][_0x7f76('0x49')](_0xd87fe7[_0x7f76('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x53f77a,0xc9))[_0x7f76('0x3f')](handleError(_0x53f77a,null));};exports[_0x7f76('0x4a')]=function(_0x19d7dd,_0x12127d){if(_0x19d7dd[_0x7f76('0x48')]['id']){delete _0x19d7dd[_0x7f76('0x48')]['id'];}return db[_0x7f76('0x29')][_0x7f76('0x46')]({'where':{'id':_0x19d7dd[_0x7f76('0x41')]['id']}})[_0x7f76('0x24')](handleEntityNotFound(_0x12127d,null))[_0x7f76('0x24')](saveUpdates(_0x19d7dd[_0x7f76('0x48')],null))['then'](respondWithResult(_0x12127d,null))[_0x7f76('0x3f')](handleError(_0x12127d,null));};exports['destroy']=function(_0x3d23b4,_0x3bcd59){return db[_0x7f76('0x29')]['find']({'where':{'id':_0x3d23b4[_0x7f76('0x41')]['id']}})[_0x7f76('0x24')](handleEntityNotFound(_0x3bcd59,null))['then'](removeEntity(_0x3bcd59,null))[_0x7f76('0x3f')](handleError(_0x3bcd59,null));};exports[_0x7f76('0x4b')]=function(_0x470ca2,_0x2e7a61){return db[_0x7f76('0x29')][_0x7f76('0x4c')]({'where':{'id':_0x470ca2[_0x7f76('0x2d')][_0x7f76('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x7f76('0x24')](respondWithResult(_0x2e7a61,0xcc))['catch'](handleError(_0x2e7a61,null));};exports['addFields']=function(_0xcdca96,_0x273884,_0x119a56){return db[_0x7f76('0x4e')][_0x7f76('0x4f')]({'where':{'id':_0xcdca96[_0x7f76('0x41')]['id']}})[_0x7f76('0x24')](handleEntityNotFound(_0x273884,null))[_0x7f76('0x24')](function(_0xd49945){if(_0xd49945){return db['sequelize'][_0x7f76('0x50')](function(_0x2aca95){return db[_0x7f76('0x29')][_0x7f76('0x4c')]({'where':{'CustomReportId':_0xcdca96[_0x7f76('0x41')]['id']},'transaction':_0x2aca95})[_0x7f76('0x24')](function(_0x3bf79a){var _0x50651c=_[_0x7f76('0x28')](_0xcdca96['body'],function(_0x6913a1){delete _0x6913a1['id'];_0x6913a1[_0x7f76('0x51')]=_0xcdca96[_0x7f76('0x41')]['id'];return _0x6913a1;});return db[_0x7f76('0x29')][_0x7f76('0x49')](_0x50651c,{'transaction':_0x2aca95});});})[_0x7f76('0x24')](function(){return db[_0x7f76('0x29')][_0x7f76('0x3d')]({'where':{'CustomReportId':_0xcdca96['params']['id']}});});}})['then'](respondWithResult(_0x273884,null))[_0x7f76('0x3f')](handleError(_0x273884,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ede983f..aef292d 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.model.js +++ b/server/api/analyticFieldReport/analyticFieldReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20c3=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c179f,_0x4b6186){var _0x500640=function(_0x1e486b){while(--_0x1e486b){_0x4c179f['push'](_0x4c179f['shift']());}};_0x500640(++_0x4b6186);}(_0x20c3,0x70));var _0x320c=function(_0x220253,_0x408ef7){_0x220253=_0x220253-0x0;var _0x1ce4a0=_0x20c3[_0x220253];return _0x1ce4a0;};'use strict';var _=require(_0x320c('0x0'));var util=require(_0x320c('0x1'));var logger=require(_0x320c('0x2'))(_0x320c('0x3'));var moment=require(_0x320c('0x4'));var BPromise=require(_0x320c('0x5'));var rp=require(_0x320c('0x6'));var fs=require('fs');var path=require(_0x320c('0x7'));var rimraf=require(_0x320c('0x8'));var config=require(_0x320c('0x9'));var attributes=require(_0x320c('0xa'));module[_0x320c('0xb')]=function(_0x19832e,_0x525ebd){return _0x19832e[_0x320c('0xc')](_0x320c('0xd'),attributes,{'tableName':_0x320c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa022=['../../config/environment','define','AnalyticFieldReport','analytics_report_fields','lodash','api','request-promise','path','rimraf'];(function(_0x2e8c8a,_0x73d0f6){var _0x1455e6=function(_0x72356a){while(--_0x72356a){_0x2e8c8a['push'](_0x2e8c8a['shift']());}};_0x1455e6(++_0x73d0f6);}(_0xa022,0x94));var _0x2a02=function(_0x4474c6,_0x288938){_0x4474c6=_0x4474c6-0x0;var _0x345fab=_0xa022[_0x4474c6];return _0x345fab;};'use strict';var _=require(_0x2a02('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2a02('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2a02('0x2'));var fs=require('fs');var path=require(_0x2a02('0x3'));var rimraf=require(_0x2a02('0x4'));var config=require(_0x2a02('0x5'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x16a121,_0x38e6f4){return _0x16a121[_0x2a02('0x6')](_0x2a02('0x7'),attributes,{'tableName':_0x2a02('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index c7cc69a..73b41ea 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.rpc.js +++ b/server/api/analyticFieldReport/analyticFieldReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabcc=['request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x7e6cf7,_0x4c8e23){var _0x18d4ee=function(_0x14b2fc){while(--_0x14b2fc){_0x7e6cf7['push'](_0x7e6cf7['shift']());}};_0x18d4ee(++_0x4c8e23);}(_0xabcc,0x7b));var _0xcabc=function(_0x1f2941,_0x3544ce){_0x1f2941=_0x1f2941-0x0;var _0x31e313=_0xabcc[_0x1f2941];return _0x31e313;};'use strict';var _=require('lodash');var util=require(_0xcabc('0x0'));var moment=require(_0xcabc('0x1'));var BPromise=require(_0xcabc('0x2'));var rs=require(_0xcabc('0x3'));var fs=require('fs');var Redis=require(_0xcabc('0x4'));var db=require(_0xcabc('0x5'))['db'];var utils=require(_0xcabc('0x6'));var logger=require(_0xcabc('0x7'))(_0xcabc('0x8'));var config=require(_0xcabc('0x9'));var jayson=require(_0xcabc('0xa'));var client=jayson[_0xcabc('0xb')][_0xcabc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5df19b,_0x6f7393,_0x596ef9){return new BPromise(function(_0x234d01,_0x23fb36){return client[_0xcabc('0xd')](_0x5df19b,_0x596ef9)['then'](function(_0xe97cd2){logger['info'](_0xcabc('0xe'),_0x6f7393,'request\x20sent');logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x6f7393,_0xcabc('0xf'),JSON[_0xcabc('0x10')](_0xe97cd2));if(_0xe97cd2[_0xcabc('0x11')]){if(_0xe97cd2[_0xcabc('0x11')][_0xcabc('0x12')]===0x1f4){logger[_0xcabc('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x6f7393,_0xe97cd2[_0xcabc('0x11')]['message']);return _0x23fb36(_0xe97cd2[_0xcabc('0x11')][_0xcabc('0x13')]);}logger[_0xcabc('0x11')](_0xcabc('0xe'),_0x6f7393,_0xe97cd2[_0xcabc('0x11')]['message']);return _0x234d01(_0xe97cd2[_0xcabc('0x11')][_0xcabc('0x13')]);}else{logger[_0xcabc('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x6f7393,_0xcabc('0xf'));_0x234d01(_0xe97cd2[_0xcabc('0x15')]['message']);}})[_0xcabc('0x16')](function(_0x4d9738){logger[_0xcabc('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x6f7393,_0x4d9738);_0x23fb36(_0x4d9738);});});} \ No newline at end of file +var _0x3b31=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then'];(function(_0x375522,_0xba9a07){var _0x3de250=function(_0x13bb46){while(--_0x13bb46){_0x375522['push'](_0x375522['shift']());}};_0x3de250(++_0xba9a07);}(_0x3b31,0xfa));var _0x13b3=function(_0x2a2325,_0x3fc0b7){_0x2a2325=_0x2a2325-0x0;var _0x297285=_0x3b31[_0x2a2325];return _0x297285;};'use strict';var _=require(_0x13b3('0x0'));var util=require(_0x13b3('0x1'));var moment=require(_0x13b3('0x2'));var BPromise=require(_0x13b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13b3('0x4'))['db'];var utils=require(_0x13b3('0x5'));var logger=require('../../config/logger')(_0x13b3('0x6'));var config=require('../../config/environment');var jayson=require(_0x13b3('0x7'));var client=jayson[_0x13b3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53d0dd,_0x2f0a8d,_0x3f6106){return new BPromise(function(_0x201c82,_0xeaff1a){return client['request'](_0x53d0dd,_0x3f6106)[_0x13b3('0x9')](function(_0x3ab43b){logger[_0x13b3('0xa')](_0x13b3('0xb'),_0x2f0a8d,_0x13b3('0xc'));logger[_0x13b3('0xd')](_0x13b3('0xe'),_0x2f0a8d,_0x13b3('0xc'),JSON[_0x13b3('0xf')](_0x3ab43b));if(_0x3ab43b[_0x13b3('0x10')]){if(_0x3ab43b[_0x13b3('0x10')][_0x13b3('0x11')]===0x1f4){logger[_0x13b3('0x10')](_0x13b3('0xb'),_0x2f0a8d,_0x3ab43b[_0x13b3('0x10')][_0x13b3('0x12')]);return _0xeaff1a(_0x3ab43b['error'][_0x13b3('0x12')]);}logger[_0x13b3('0x10')](_0x13b3('0xb'),_0x2f0a8d,_0x3ab43b['error'][_0x13b3('0x12')]);return _0x201c82(_0x3ab43b[_0x13b3('0x10')][_0x13b3('0x12')]);}else{logger[_0x13b3('0xa')](_0x13b3('0xb'),_0x2f0a8d,_0x13b3('0xc'));_0x201c82(_0x3ab43b['result']['message']);}})[_0x13b3('0x13')](function(_0x4173ac){logger['error'](_0x13b3('0xb'),_0x2f0a8d,_0x4173ac);_0xeaff1a(_0x4173ac);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 367c0e2..068f23f 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x13bbf5,_0x3c3cc2){var _0x2d9e20=function(_0x31ff82){while(--_0x31ff82){_0x13bbf5['push'](_0x13bbf5['shift']());}};_0x2d9e20(++_0x3c3cc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x3bac74,_0x525272){var _0x385d69=function(_0x35e2c3){while(--_0x35e2c3){_0x3bac74['push'](_0x3bac74['shift']());}};_0x385d69(++_0x525272);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index cecb3d4..8b52cb8 100644 --- a/server/api/analyticMetric/analyticMetric.attributes.js +++ b/server/api/analyticMetric/analyticMetric.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbee0=['STRING','name','TEXT','exports'];(function(_0x204774,_0x572ffc){var _0x9f6e47=function(_0x590321){while(--_0x590321){_0x204774['push'](_0x204774['shift']());}};_0x9f6e47(++_0x572ffc);}(_0xbee0,0x147));var _0x0bee=function(_0x3fa4ec,_0x3387d3){_0x3fa4ec=_0x3fa4ec-0x0;var _0x4df5f0=_0xbee0[_0x3fa4ec];return _0x4df5f0;};'use strict';var Sequelize=require('sequelize');module[_0x0bee('0x0')]={'name':{'type':Sequelize[_0x0bee('0x1')],'allowNull':![],'unique':_0x0bee('0x2')},'table':{'type':Sequelize[_0x0bee('0x1')]},'metric':{'type':Sequelize[_0x0bee('0x3')]},'description':{'type':Sequelize[_0x0bee('0x1')]}}; \ No newline at end of file +var _0xaa1b=['sequelize','exports','STRING'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xbaa1('0x0'));module[_0xbaa1('0x1')]={'name':{'type':Sequelize[_0xbaa1('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xbaa1('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xbaa1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7e9f8e0..7fe5a47 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc187f4,_0x406145){var _0x1dc539=function(_0x48fc22){while(--_0x48fc22){_0xc187f4['push'](_0xc187f4['shift']());}};_0x1dc539(++_0x406145);}(_0x8ef6,0xf2));var _0x68ef=function(_0x57f20c,_0x33aa60){_0x57f20c=_0x57f20c-0x0;var _0x3e36e9=_0x8ef6[_0x57f20c];return _0x3e36e9;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file +var _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x1a7fbe,_0x1d0032){var _0x4a4789=function(_0x11edd6){while(--_0x11edd6){_0x1a7fbe['push'](_0x1a7fbe['shift']());}};_0x4a4789(++_0x1d0032);}(_0x46ed,0x168));var _0xd46e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x46ed[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2d2f477..91a9e69 100644 --- a/server/api/analyticMetric/analyticMetric.model.js +++ b/server/api/analyticMetric/analyticMetric.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb091=['moment','request-promise','../../config/environment','./analyticMetric.attributes','define','analytics_metrics','util','../../config/logger','api'];(function(_0x2d0057,_0x24db80){var _0x2881ca=function(_0x42c8a4){while(--_0x42c8a4){_0x2d0057['push'](_0x2d0057['shift']());}};_0x2881ca(++_0x24db80);}(_0xb091,0x16e));var _0x1b09=function(_0x486876,_0x76fa8a){_0x486876=_0x486876-0x0;var _0x1dc1c2=_0xb091[_0x486876];return _0x1dc1c2;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('AnalyticMetric',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49fe=['request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','moment','bluebird'];(function(_0x30d2a5,_0x13516b){var _0x12f6c6=function(_0x53d40d){while(--_0x53d40d){_0x30d2a5['push'](_0x30d2a5['shift']());}};_0x12f6c6(++_0x13516b);}(_0x49fe,0x75));var _0xe49f=function(_0x53b44c,_0x460abf){_0x53b44c=_0x53b44c-0x0;var _0x42c2b5=_0x49fe[_0x53b44c];return _0x42c2b5;};'use strict';var _=require(_0xe49f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe49f('0x1'));var BPromise=require(_0xe49f('0x2'));var rp=require(_0xe49f('0x3'));var fs=require('fs');var path=require(_0xe49f('0x4'));var rimraf=require(_0xe49f('0x5'));var config=require(_0xe49f('0x6'));var attributes=require(_0xe49f('0x7'));module[_0xe49f('0x8')]=function(_0x3e984c,_0x2f3f9f){return _0x3e984c[_0xe49f('0x9')](_0xe49f('0xa'),attributes,{'tableName':_0xe49f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 4007d93..f2b7872 100644 --- a/server/api/analyticMetric/analyticMetric.rpc.js +++ b/server/api/analyticMetric/analyticMetric.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3f8=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','AnalyticMetric,\x20%s,\x20%s','message','lodash','bluebird','randomstring','ioredis'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xa3f8,0x1df));var _0x8a3f=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0xa3f8[_0x55fb83];return _0x59a87a;};'use strict';var _=require(_0x8a3f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a3f('0x1'));var rs=require(_0x8a3f('0x2'));var fs=require('fs');var Redis=require(_0x8a3f('0x3'));var db=require(_0x8a3f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a3f('0x5'))(_0x8a3f('0x6'));var config=require(_0x8a3f('0x7'));var jayson=require(_0x8a3f('0x8'));var client=jayson[_0x8a3f('0x9')][_0x8a3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8c8a81,_0x3f5cc9,_0x1c457a){return new BPromise(function(_0x19b46f,_0x1a7a3a){return client[_0x8a3f('0xb')](_0x8c8a81,_0x1c457a)[_0x8a3f('0xc')](function(_0x315b7c){logger[_0x8a3f('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x3f5cc9,_0x8a3f('0xe'));logger[_0x8a3f('0xf')](_0x8a3f('0x10'),_0x3f5cc9,_0x8a3f('0xe'),JSON['stringify'](_0x315b7c));if(_0x315b7c[_0x8a3f('0x11')]){if(_0x315b7c[_0x8a3f('0x11')][_0x8a3f('0x12')]===0x1f4){logger[_0x8a3f('0x11')](_0x8a3f('0x13'),_0x3f5cc9,_0x315b7c[_0x8a3f('0x11')][_0x8a3f('0x14')]);return _0x1a7a3a(_0x315b7c[_0x8a3f('0x11')][_0x8a3f('0x14')]);}logger[_0x8a3f('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x3f5cc9,_0x315b7c['error']['message']);return _0x19b46f(_0x315b7c[_0x8a3f('0x11')][_0x8a3f('0x14')]);}else{logger[_0x8a3f('0xd')](_0x8a3f('0x13'),_0x3f5cc9,'request\x20sent');_0x19b46f(_0x315b7c['result'][_0x8a3f('0x14')]);}})['catch'](function(_0x33e575){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3f5cc9,_0x33e575);_0x1a7a3a(_0x33e575);});});} \ No newline at end of file +var _0xa819=['../../mysqldb','../../config/utils','../../config/environment','client','request','then','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x394dd0,_0x372e2f){var _0x25caf5=function(_0x4e7bf5){while(--_0x4e7bf5){_0x394dd0['push'](_0x394dd0['shift']());}};_0x25caf5(++_0x372e2f);}(_0xa819,0x1f3));var _0x9a81=function(_0x4212fa,_0x56d028){_0x4212fa=_0x4212fa-0x0;var _0x2f8bc8=_0xa819[_0x4212fa];return _0x2f8bc8;};'use strict';var _=require(_0x9a81('0x0'));var util=require(_0x9a81('0x1'));var moment=require(_0x9a81('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a81('0x3'));var fs=require('fs');var Redis=require(_0x9a81('0x4'));var db=require(_0x9a81('0x5'))['db'];var utils=require(_0x9a81('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9a81('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9a81('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f1128,_0x3fbe40,_0x528a38){return new BPromise(function(_0x4f121d,_0x4dcf2e){return client[_0x9a81('0x9')](_0x5f1128,_0x528a38)[_0x9a81('0xa')](function(_0x3997e3){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x3fbe40,_0x9a81('0xb'));logger['debug'](_0x9a81('0xc'),_0x3fbe40,_0x9a81('0xb'),JSON[_0x9a81('0xd')](_0x3997e3));if(_0x3997e3['error']){if(_0x3997e3[_0x9a81('0xe')][_0x9a81('0xf')]===0x1f4){logger[_0x9a81('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x3fbe40,_0x3997e3['error']['message']);return _0x4dcf2e(_0x3997e3[_0x9a81('0xe')][_0x9a81('0x10')]);}logger[_0x9a81('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x3fbe40,_0x3997e3[_0x9a81('0xe')]['message']);return _0x4f121d(_0x3997e3[_0x9a81('0xe')][_0x9a81('0x10')]);}else{logger[_0x9a81('0x11')](_0x9a81('0x12'),_0x3fbe40,_0x9a81('0xb'));_0x4f121d(_0x3997e3[_0x9a81('0x13')][_0x9a81('0x10')]);}})[_0x9a81('0x14')](function(_0x3a62b6){logger[_0x9a81('0xe')](_0x9a81('0x12'),_0x3fbe40,_0x3a62b6);_0x4dcf2e(_0x3a62b6);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b7d5b2e..f1da998 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf7=['fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xf9a547,_0x40ab32){var _0x573d08=function(_0x4b23ef){while(--_0x4b23ef){_0xf9a547['push'](_0xf9a547['shift']());}};_0x573d08(++_0x40ab32);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x188ee2,_0xb845f6){_0x188ee2=_0x188ee2-0x0;var _0x336576=_0xdbf7[_0x188ee2];return _0x336576;};'use strict';var multer=require(_0x7dbf('0x0'));var util=require(_0x7dbf('0x1'));var path=require(_0x7dbf('0x2'));var timeout=require(_0x7dbf('0x3'));var express=require(_0x7dbf('0x4'));var router=express[_0x7dbf('0x5')]();var fs_extra=require(_0x7dbf('0x6'));var auth=require(_0x7dbf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7dbf('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x7dbf('0x9')](),controller[_0x7dbf('0xa')]);router[_0x7dbf('0xb')](_0x7dbf('0xc'),auth[_0x7dbf('0x9')](),controller[_0x7dbf('0xd')]);router[_0x7dbf('0xe')]('/',auth[_0x7dbf('0x9')](),controller[_0x7dbf('0xf')]);router[_0x7dbf('0x10')](_0x7dbf('0xc'),auth[_0x7dbf('0x9')](),controller[_0x7dbf('0x11')]);router[_0x7dbf('0x12')](_0x7dbf('0xc'),auth['isAuthenticated'](),controller[_0x7dbf('0x13')]);module[_0x7dbf('0x14')]=router; \ No newline at end of file +var _0xeda8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','update','delete','/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x58cb73,_0x1472a9){var _0x2f23e9=function(_0x489ff9){while(--_0x489ff9){_0x58cb73['push'](_0x58cb73['shift']());}};_0x2f23e9(++_0x1472a9);}(_0xeda8,0x104));var _0x8eda=function(_0x518f82,_0x533e12){_0x518f82=_0x518f82-0x0;var _0x5d2e09=_0xeda8[_0x518f82];return _0x5d2e09;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/:id',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xe')]('/',auth[_0x8eda('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')](_0x8eda('0x11'),auth['isAuthenticated'](),controller[_0x8eda('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index beac5fb..c46485a 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c08=['sequelize','exports','TEXT'];(function(_0x47d69f,_0x460801){var _0xd1a4b5=function(_0x51a661){while(--_0x51a661){_0x47d69f['push'](_0x47d69f['shift']());}};_0xd1a4b5(++_0x460801);}(_0x9c08,0x147));var _0x89c0=function(_0x5c425d,_0x12caad){_0x5c425d=_0x5c425d-0x0;var _0x21b646=_0x9c08[_0x5c425d];return _0x21b646;};'use strict';var Sequelize=require(_0x89c0('0x0'));module[_0x89c0('0x1')]={'tree':{'type':Sequelize[_0x89c0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2c2a=['TEXT','sequelize'];(function(_0x438a37,_0x30e65e){var _0x38b013=function(_0x4dc7ca){while(--_0x4dc7ca){_0x438a37['push'](_0x438a37['shift']());}};_0x38b013(++_0x30e65e);}(_0x2c2a,0x73));var _0xa2c2=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x2c2a[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0xa2c2('0x0'));module['exports']={'tree':{'type':Sequelize[_0xa2c2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 3296c61..d7fe0d9 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.controller.js +++ b/server/api/analyticTreeReport/analyticTreeReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd64f=['body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','update','destroy','then','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','options','includeAll','include','findAll','catch','show','params','keys','create'];(function(_0x33e5fe,_0x307a4b){var _0x195b9a=function(_0x48c555){while(--_0x48c555){_0x33e5fe['push'](_0x33e5fe['shift']());}};_0x195b9a(++_0x307a4b);}(_0xd64f,0x1ac));var _0xfd64=function(_0x1492f9,_0xfe7389){_0x1492f9=_0x1492f9-0x0;var _0x1dc8a8=_0xd64f[_0x1492f9];return _0x1dc8a8;};'use strict';var emlformat=require(_0xfd64('0x0'));var rimraf=require(_0xfd64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd64('0x2'));var rp=require(_0xfd64('0x3'));var moment=require(_0xfd64('0x4'));var BPromise=require(_0xfd64('0x5'));var Mustache=require(_0xfd64('0x6'));var util=require(_0xfd64('0x7'));var path=require(_0xfd64('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd64('0x9'));var squel=require('squel');var crypto=require(_0xfd64('0xa'));var jsforce=require(_0xfd64('0xb'));var deskjs=require(_0xfd64('0xc'));var toCsv=require(_0xfd64('0xd'));var querystring=require(_0xfd64('0xe'));var Papa=require(_0xfd64('0xf'));var Redis=require(_0xfd64('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfd64('0x11'));var as=require(_0xfd64('0x12'));var hardwareService=require(_0xfd64('0x13'));var logger=require(_0xfd64('0x14'))('api');var utils=require(_0xfd64('0x15'));var config=require(_0xfd64('0x16'));var licenseUtil=require(_0xfd64('0x17'));var db=require(_0xfd64('0x18'))['db'];function respondWithStatusCode(_0x5cf0d7,_0x47017f){_0x47017f=_0x47017f||0xcc;return function(_0x329a4a){if(_0x329a4a){return _0x5cf0d7[_0xfd64('0x19')](_0x47017f);}return _0x5cf0d7['status'](_0x47017f)[_0xfd64('0x1a')]();};}function respondWithResult(_0xcb3cb3,_0x198a75){_0x198a75=_0x198a75||0xc8;return function(_0x3d700d){if(_0x3d700d){return _0xcb3cb3[_0xfd64('0x1b')](_0x198a75)[_0xfd64('0x1c')](_0x3d700d);}};}function respondWithFilteredResult(_0x3ab6d8,_0x36d48a){return function(_0x3f7217){if(_0x3f7217){var _0xadf334=typeof _0x36d48a['offset']==='undefined'&&typeof _0x36d48a[_0xfd64('0x1d')]===_0xfd64('0x1e');var _0x366944=_0x3f7217[_0xfd64('0x1f')];var _0x136990=_0xadf334?0x0:_0x36d48a[_0xfd64('0x20')];var _0x4cc9c2=_0xadf334?_0x3f7217[_0xfd64('0x1f')]:_0x36d48a['offset']+_0x36d48a[_0xfd64('0x1d')];var _0x19cac7;if(_0x4cc9c2>=_0x366944){_0x4cc9c2=_0x366944;_0x19cac7=0xc8;}else{_0x19cac7=0xce;}_0x3ab6d8[_0xfd64('0x1b')](_0x19cac7);return _0x3ab6d8['set'](_0xfd64('0x21'),_0x136990+'-'+_0x4cc9c2+'/'+_0x366944)[_0xfd64('0x1c')](_0x3f7217);}return null;};}function patchUpdates(_0x5ab395){return function(_0x95d98f){try{jsonpatch[_0xfd64('0x22')](_0x95d98f,_0x5ab395,!![]);}catch(_0x447a04){return BPromise['reject'](_0x447a04);}return _0x95d98f['save']();};}function saveUpdates(_0x694a83,_0x1ec056){return function(_0x5c8fd){if(_0x5c8fd){return _0x5c8fd[_0xfd64('0x23')](_0x694a83)['then'](function(_0x853463){return _0x853463;});}return null;};}function removeEntity(_0x45dba0,_0x1a33f7){return function(_0x2d2273){if(_0x2d2273){return _0x2d2273[_0xfd64('0x24')]()[_0xfd64('0x25')](function(){_0x45dba0['status'](0xcc)[_0xfd64('0x1a')]();});}};}function handleEntityNotFound(_0x47e6fd,_0x1eb6f9){return function(_0x52218a){if(!_0x52218a){_0x47e6fd[_0xfd64('0x19')](0x194);}return _0x52218a;};}function handleError(_0x2cba05,_0x323f62){_0x323f62=_0x323f62||0x1f4;return function(_0x104e77){logger[_0xfd64('0x26')](_0x104e77[_0xfd64('0x27')]);if(_0x104e77['name']){delete _0x104e77[_0xfd64('0x28')];}_0x2cba05[_0xfd64('0x1b')](_0x323f62)['send'](_0x104e77);};}exports[_0xfd64('0x29')]=function(_0x237e6d,_0x41da45){var _0x211501={},_0x2ea267={},_0x49b43a={'count':0x0,'rows':[]};var _0x15dd5f=_[_0xfd64('0x2a')](db[_0xfd64('0x2b')][_0xfd64('0x2c')],function(_0x4ab988){return{'name':_0x4ab988['fieldName'],'type':_0x4ab988['type']['key']};});_0x2ea267['model']=_['map'](_0x15dd5f,_0xfd64('0x28'));_0x2ea267[_0xfd64('0x2d')]=_['keys'](_0x237e6d[_0xfd64('0x2d')]);_0x2ea267[_0xfd64('0x2e')]=_[_0xfd64('0x2f')](_0x2ea267[_0xfd64('0x30')],_0x2ea267[_0xfd64('0x2d')]);_0x211501[_0xfd64('0x31')]=_[_0xfd64('0x2f')](_0x2ea267['model'],qs[_0xfd64('0x32')](_0x237e6d['query']['fields']));_0x211501['attributes']=_0x211501[_0xfd64('0x31')][_0xfd64('0x33')]?_0x211501['attributes']:_0x2ea267['model'];if(!_0x237e6d['query'][_0xfd64('0x34')]('nolimit')){_0x211501['limit']=qs[_0xfd64('0x1d')](_0x237e6d[_0xfd64('0x2d')][_0xfd64('0x1d')]);_0x211501[_0xfd64('0x20')]=qs[_0xfd64('0x20')](_0x237e6d[_0xfd64('0x2d')]['offset']);}_0x211501[_0xfd64('0x35')]=qs[_0xfd64('0x36')](_0x237e6d['query'][_0xfd64('0x36')]);_0x211501['where']=qs['filters'](_[_0xfd64('0x37')](_0x237e6d[_0xfd64('0x2d')],_0x2ea267[_0xfd64('0x2e')]),_0x15dd5f);if(_0x237e6d[_0xfd64('0x2d')][_0xfd64('0x38')]){_0x211501['where']=_[_0xfd64('0x39')](_0x211501[_0xfd64('0x3a')],{'$or':_[_0xfd64('0x2a')](_0x15dd5f,function(_0x5ac6a5){if(_0x5ac6a5[_0xfd64('0x3b')]!=='VIRTUAL'){var _0x314080={};_0x314080[_0x5ac6a5[_0xfd64('0x28')]]={'$like':'%'+_0x237e6d[_0xfd64('0x2d')][_0xfd64('0x38')]+'%'};return _0x314080;}})});}_0x211501=_['merge']({},_0x211501,_0x237e6d[_0xfd64('0x3c')]);var _0x21abbc={'where':_0x211501[_0xfd64('0x3a')]};return db[_0xfd64('0x2b')][_0xfd64('0x1f')](_0x21abbc)['then'](function(_0x44340a){_0x49b43a[_0xfd64('0x1f')]=_0x44340a;if(_0x237e6d['query'][_0xfd64('0x3d')]){_0x211501[_0xfd64('0x3e')]=[{'all':!![]}];}return db[_0xfd64('0x2b')][_0xfd64('0x3f')](_0x211501);})[_0xfd64('0x25')](function(_0x5876e0){_0x49b43a['rows']=_0x5876e0;return _0x49b43a;})['then'](respondWithFilteredResult(_0x41da45,_0x211501))[_0xfd64('0x40')](handleError(_0x41da45,null));};exports[_0xfd64('0x41')]=function(_0xd49fc9,_0x14506a){var _0x24f2a2={'raw':!![],'where':{'id':_0xd49fc9[_0xfd64('0x42')]['id']}},_0xa6a7d0={};_0xa6a7d0['model']=_[_0xfd64('0x43')](db[_0xfd64('0x2b')]['rawAttributes']);_0xa6a7d0['query']=_[_0xfd64('0x43')](_0xd49fc9[_0xfd64('0x2d')]);_0xa6a7d0['filters']=_['intersection'](_0xa6a7d0[_0xfd64('0x30')],_0xa6a7d0['query']);_0x24f2a2['attributes']=_[_0xfd64('0x2f')](_0xa6a7d0[_0xfd64('0x30')],qs['fields'](_0xd49fc9['query'][_0xfd64('0x32')]));_0x24f2a2['attributes']=_0x24f2a2[_0xfd64('0x31')][_0xfd64('0x33')]?_0x24f2a2[_0xfd64('0x31')]:_0xa6a7d0[_0xfd64('0x30')];if(_0xd49fc9[_0xfd64('0x2d')][_0xfd64('0x3d')]){_0x24f2a2[_0xfd64('0x3e')]=[{'all':!![]}];}_0x24f2a2=_[_0xfd64('0x39')]({},_0x24f2a2,_0xd49fc9['options']);return db[_0xfd64('0x2b')]['find'](_0x24f2a2)[_0xfd64('0x25')](handleEntityNotFound(_0x14506a,null))['then'](respondWithResult(_0x14506a,null))[_0xfd64('0x40')](handleError(_0x14506a,null));};exports[_0xfd64('0x44')]=function(_0x3d0f97,_0xe2dd37){return db[_0xfd64('0x2b')]['create'](_0x3d0f97[_0xfd64('0x45')],{})[_0xfd64('0x25')](respondWithResult(_0xe2dd37,0xc9))[_0xfd64('0x40')](handleError(_0xe2dd37,null));};exports[_0xfd64('0x23')]=function(_0x54dcb9,_0xa69fba){if(_0x54dcb9['body']['id']){delete _0x54dcb9[_0xfd64('0x45')]['id'];}return db[_0xfd64('0x2b')][_0xfd64('0x46')]({'where':{'id':_0x54dcb9[_0xfd64('0x42')]['id']}})[_0xfd64('0x25')](handleEntityNotFound(_0xa69fba,null))[_0xfd64('0x25')](saveUpdates(_0x54dcb9[_0xfd64('0x45')],null))[_0xfd64('0x25')](respondWithResult(_0xa69fba,null))[_0xfd64('0x40')](handleError(_0xa69fba,null));};exports[_0xfd64('0x24')]=function(_0x4f97e2,_0x5d4ff1){return db['AnalyticTreeReport'][_0xfd64('0x46')]({'where':{'id':_0x4f97e2['params']['id']}})[_0xfd64('0x25')](handleEntityNotFound(_0x5d4ff1,null))[_0xfd64('0x25')](removeEntity(_0x5d4ff1,null))['catch'](handleError(_0x5d4ff1,null));}; \ No newline at end of file +var _0xdd67=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','lodash','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x10f2ad,_0x256d6){var _0x432110=function(_0x522bb4){while(--_0x522bb4){_0x10f2ad['push'](_0x10f2ad['shift']());}};_0x432110(++_0x256d6);}(_0xdd67,0x106));var _0x7dd6=function(_0x1f8a5d,_0x447149){_0x1f8a5d=_0x1f8a5d-0x0;var _0x2c1e27=_0xdd67[_0x1f8a5d];return _0x2c1e27;};'use strict';var emlformat=require(_0x7dd6('0x0'));var rimraf=require(_0x7dd6('0x1'));var zipdir=require(_0x7dd6('0x2'));var jsonpatch=require(_0x7dd6('0x3'));var rp=require(_0x7dd6('0x4'));var moment=require('moment');var BPromise=require(_0x7dd6('0x5'));var Mustache=require('mustache');var util=require(_0x7dd6('0x6'));var path=require(_0x7dd6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dd6('0x8'));var squel=require(_0x7dd6('0x9'));var crypto=require(_0x7dd6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7dd6('0xb'));var toCsv=require(_0x7dd6('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7dd6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x7dd6('0xe'));var hardwareService=require(_0x7dd6('0xf'));var logger=require('../../config/logger')(_0x7dd6('0x10'));var utils=require(_0x7dd6('0x11'));var config=require(_0x7dd6('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x7dd6('0x13'))['db'];function respondWithStatusCode(_0x3d3aef,_0x4b9366){_0x4b9366=_0x4b9366||0xcc;return function(_0x362cd2){if(_0x362cd2){return _0x3d3aef['sendStatus'](_0x4b9366);}return _0x3d3aef[_0x7dd6('0x14')](_0x4b9366)[_0x7dd6('0x15')]();};}function respondWithResult(_0x482a28,_0x424e1d){_0x424e1d=_0x424e1d||0xc8;return function(_0x3ba4aa){if(_0x3ba4aa){return _0x482a28[_0x7dd6('0x14')](_0x424e1d)['json'](_0x3ba4aa);}};}function respondWithFilteredResult(_0xbeabdf,_0x240391){return function(_0x29579b){if(_0x29579b){var _0x49c5d5=typeof _0x240391[_0x7dd6('0x16')]===_0x7dd6('0x17')&&typeof _0x240391[_0x7dd6('0x18')]===_0x7dd6('0x17');var _0x371432=_0x29579b[_0x7dd6('0x19')];var _0x1e42da=_0x49c5d5?0x0:_0x240391[_0x7dd6('0x16')];var _0x1edfa1=_0x49c5d5?_0x29579b[_0x7dd6('0x19')]:_0x240391[_0x7dd6('0x16')]+_0x240391[_0x7dd6('0x18')];var _0x54951e;if(_0x1edfa1>=_0x371432){_0x1edfa1=_0x371432;_0x54951e=0xc8;}else{_0x54951e=0xce;}_0xbeabdf[_0x7dd6('0x14')](_0x54951e);return _0xbeabdf[_0x7dd6('0x1a')](_0x7dd6('0x1b'),_0x1e42da+'-'+_0x1edfa1+'/'+_0x371432)[_0x7dd6('0x1c')](_0x29579b);}return null;};}function patchUpdates(_0x5d84f5){return function(_0xf303f7){try{jsonpatch[_0x7dd6('0x1d')](_0xf303f7,_0x5d84f5,!![]);}catch(_0x56ee64){return BPromise[_0x7dd6('0x1e')](_0x56ee64);}return _0xf303f7[_0x7dd6('0x1f')]();};}function saveUpdates(_0x2bfd34,_0x371545){return function(_0x2fe40e){if(_0x2fe40e){return _0x2fe40e[_0x7dd6('0x20')](_0x2bfd34)['then'](function(_0x11a28b){return _0x11a28b;});}return null;};}function removeEntity(_0x37ca73,_0x51d908){return function(_0x46fc27){if(_0x46fc27){return _0x46fc27['destroy']()[_0x7dd6('0x21')](function(){_0x37ca73[_0x7dd6('0x14')](0xcc)[_0x7dd6('0x15')]();});}};}function handleEntityNotFound(_0x1c9d8b,_0xcd3794){return function(_0x22e53c){if(!_0x22e53c){_0x1c9d8b[_0x7dd6('0x22')](0x194);}return _0x22e53c;};}function handleError(_0x4141f0,_0x348bf6){_0x348bf6=_0x348bf6||0x1f4;return function(_0x116d23){logger[_0x7dd6('0x23')](_0x116d23['stack']);if(_0x116d23[_0x7dd6('0x24')]){delete _0x116d23[_0x7dd6('0x24')];}_0x4141f0[_0x7dd6('0x14')](_0x348bf6)[_0x7dd6('0x25')](_0x116d23);};}exports[_0x7dd6('0x26')]=function(_0x7985e9,_0x4ec647){var _0x34be95={},_0x5ce095={},_0x5590c9={'count':0x0,'rows':[]};var _0x338153=_[_0x7dd6('0x27')](db[_0x7dd6('0x28')][_0x7dd6('0x29')],function(_0x27562e){return{'name':_0x27562e[_0x7dd6('0x2a')],'type':_0x27562e[_0x7dd6('0x2b')][_0x7dd6('0x2c')]};});_0x5ce095[_0x7dd6('0x2d')]=_[_0x7dd6('0x27')](_0x338153,'name');_0x5ce095[_0x7dd6('0x2e')]=_[_0x7dd6('0x2f')](_0x7985e9[_0x7dd6('0x2e')]);_0x5ce095['filters']=_[_0x7dd6('0x30')](_0x5ce095[_0x7dd6('0x2d')],_0x5ce095['query']);_0x34be95[_0x7dd6('0x31')]=_[_0x7dd6('0x30')](_0x5ce095['model'],qs[_0x7dd6('0x32')](_0x7985e9['query']['fields']));_0x34be95[_0x7dd6('0x31')]=_0x34be95[_0x7dd6('0x31')][_0x7dd6('0x33')]?_0x34be95[_0x7dd6('0x31')]:_0x5ce095['model'];if(!_0x7985e9[_0x7dd6('0x2e')]['hasOwnProperty'](_0x7dd6('0x34'))){_0x34be95[_0x7dd6('0x18')]=qs[_0x7dd6('0x18')](_0x7985e9[_0x7dd6('0x2e')][_0x7dd6('0x18')]);_0x34be95[_0x7dd6('0x16')]=qs[_0x7dd6('0x16')](_0x7985e9[_0x7dd6('0x2e')][_0x7dd6('0x16')]);}_0x34be95[_0x7dd6('0x35')]=qs[_0x7dd6('0x36')](_0x7985e9['query']['sort']);_0x34be95['where']=qs[_0x7dd6('0x37')](_[_0x7dd6('0x38')](_0x7985e9[_0x7dd6('0x2e')],_0x5ce095[_0x7dd6('0x37')]),_0x338153);if(_0x7985e9['query']['filter']){_0x34be95[_0x7dd6('0x39')]=_['merge'](_0x34be95[_0x7dd6('0x39')],{'$or':_[_0x7dd6('0x27')](_0x338153,function(_0x46494e){if(_0x46494e[_0x7dd6('0x2b')]!==_0x7dd6('0x3a')){var _0x3de296={};_0x3de296[_0x46494e['name']]={'$like':'%'+_0x7985e9[_0x7dd6('0x2e')]['filter']+'%'};return _0x3de296;}})});}_0x34be95=_[_0x7dd6('0x3b')]({},_0x34be95,_0x7985e9[_0x7dd6('0x3c')]);var _0x318c7e={'where':_0x34be95[_0x7dd6('0x39')]};return db[_0x7dd6('0x28')][_0x7dd6('0x19')](_0x318c7e)[_0x7dd6('0x21')](function(_0x40ea59){_0x5590c9[_0x7dd6('0x19')]=_0x40ea59;if(_0x7985e9['query'][_0x7dd6('0x3d')]){_0x34be95[_0x7dd6('0x3e')]=[{'all':!![]}];}return db[_0x7dd6('0x28')][_0x7dd6('0x3f')](_0x34be95);})[_0x7dd6('0x21')](function(_0x501983){_0x5590c9[_0x7dd6('0x40')]=_0x501983;return _0x5590c9;})['then'](respondWithFilteredResult(_0x4ec647,_0x34be95))[_0x7dd6('0x41')](handleError(_0x4ec647,null));};exports['show']=function(_0x2dc23f,_0x29badd){var _0x18ae43={'raw':!![],'where':{'id':_0x2dc23f[_0x7dd6('0x42')]['id']}},_0x416786={};_0x416786['model']=_[_0x7dd6('0x2f')](db[_0x7dd6('0x28')][_0x7dd6('0x29')]);_0x416786['query']=_[_0x7dd6('0x2f')](_0x2dc23f[_0x7dd6('0x2e')]);_0x416786[_0x7dd6('0x37')]=_[_0x7dd6('0x30')](_0x416786[_0x7dd6('0x2d')],_0x416786[_0x7dd6('0x2e')]);_0x18ae43[_0x7dd6('0x31')]=_[_0x7dd6('0x30')](_0x416786[_0x7dd6('0x2d')],qs[_0x7dd6('0x32')](_0x2dc23f[_0x7dd6('0x2e')]['fields']));_0x18ae43['attributes']=_0x18ae43[_0x7dd6('0x31')]['length']?_0x18ae43[_0x7dd6('0x31')]:_0x416786[_0x7dd6('0x2d')];if(_0x2dc23f[_0x7dd6('0x2e')][_0x7dd6('0x3d')]){_0x18ae43[_0x7dd6('0x3e')]=[{'all':!![]}];}_0x18ae43=_[_0x7dd6('0x3b')]({},_0x18ae43,_0x2dc23f[_0x7dd6('0x3c')]);return db[_0x7dd6('0x28')][_0x7dd6('0x43')](_0x18ae43)[_0x7dd6('0x21')](handleEntityNotFound(_0x29badd,null))['then'](respondWithResult(_0x29badd,null))[_0x7dd6('0x41')](handleError(_0x29badd,null));};exports[_0x7dd6('0x44')]=function(_0x4e8c99,_0x2c310a){return db['AnalyticTreeReport']['create'](_0x4e8c99[_0x7dd6('0x45')],{})[_0x7dd6('0x21')](respondWithResult(_0x2c310a,0xc9))[_0x7dd6('0x41')](handleError(_0x2c310a,null));};exports[_0x7dd6('0x20')]=function(_0x57dddf,_0x2c137c){if(_0x57dddf['body']['id']){delete _0x57dddf[_0x7dd6('0x45')]['id'];}return db[_0x7dd6('0x28')]['find']({'where':{'id':_0x57dddf['params']['id']}})[_0x7dd6('0x21')](handleEntityNotFound(_0x2c137c,null))[_0x7dd6('0x21')](saveUpdates(_0x57dddf[_0x7dd6('0x45')],null))[_0x7dd6('0x21')](respondWithResult(_0x2c137c,null))['catch'](handleError(_0x2c137c,null));};exports[_0x7dd6('0x46')]=function(_0xd87f2,_0x2d6878){return db[_0x7dd6('0x28')][_0x7dd6('0x43')]({'where':{'id':_0xd87f2['params']['id']}})['then'](handleEntityNotFound(_0x2d6878,null))[_0x7dd6('0x21')](removeEntity(_0x2d6878,null))['catch'](handleError(_0x2d6878,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 0995fc8..15b3ef0 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.model.js +++ b/server/api/analyticTreeReport/analyticTreeReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11f3=['../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3828e2,_0x2ef6d6){var _0x2fa385=function(_0x2b8040){while(--_0x2b8040){_0x3828e2['push'](_0x3828e2['shift']());}};_0x2fa385(++_0x2ef6d6);}(_0x11f3,0x118));var _0x311f=function(_0x3a7bdf,_0x58bdd8){_0x3a7bdf=_0x3a7bdf-0x0;var _0x35a9a8=_0x11f3[_0x3a7bdf];return _0x35a9a8;};'use strict';var _=require(_0x311f('0x0'));var util=require('util');var logger=require(_0x311f('0x1'))(_0x311f('0x2'));var moment=require(_0x311f('0x3'));var BPromise=require(_0x311f('0x4'));var rp=require(_0x311f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x311f('0x6'));var attributes=require(_0x311f('0x7'));module['exports']=function(_0x49d494,_0x1539be){return _0x49d494[_0x311f('0x8')](_0x311f('0x9'),attributes,{'tableName':_0x311f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75e5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./analyticTreeReport.attributes','exports','define','analytics_report_trees'];(function(_0x2046dd,_0x40a9ab){var _0x2eb055=function(_0x1c65e8){while(--_0x1c65e8){_0x2046dd['push'](_0x2046dd['shift']());}};_0x2eb055(++_0x40a9ab);}(_0x75e5,0x160));var _0x575e=function(_0x1e182d,_0x4f35c2){_0x1e182d=_0x1e182d-0x0;var _0x5627c6=_0x75e5[_0x1e182d];return _0x5627c6;};'use strict';var _=require(_0x575e('0x0'));var util=require(_0x575e('0x1'));var logger=require(_0x575e('0x2'))(_0x575e('0x3'));var moment=require(_0x575e('0x4'));var BPromise=require(_0x575e('0x5'));var rp=require(_0x575e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x575e('0x7'));module[_0x575e('0x8')]=function(_0x13223d,_0x493105){return _0x13223d[_0x575e('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x575e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 2711899..d2ed2f0 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0xad82c8,_0x5bc74a){_0xad82c8=_0xad82c8-0x0;var _0x43b405=_0x7a54[_0xad82c8];return _0x43b405;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x1101d7,_0x409c83){_0x1101d7=_0x1101d7-0x0;var _0x5015cb=_0x7a54[_0x1101d7];return _0x5015cb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 424d726..4faba83 100644 --- a/server/api/analyticTreeReport/index.js +++ b/server/api/analyticTreeReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe81f=['../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','put','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe81f,0x126));var _0xfe81=function(_0x3071b5,_0xa4b97d){_0x3071b5=_0x3071b5-0x0;var _0x43af37=_0xe81f[_0x3071b5];return _0x43af37;};'use strict';var multer=require(_0xfe81('0x0'));var util=require('util');var path=require(_0xfe81('0x1'));var timeout=require(_0xfe81('0x2'));var express=require('express');var router=express[_0xfe81('0x3')]();var fs_extra=require(_0xfe81('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfe81('0x5'));var config=require(_0xfe81('0x6'));var controller=require(_0xfe81('0x7'));router[_0xfe81('0x8')]('/',auth[_0xfe81('0x9')](),controller['index']);router[_0xfe81('0x8')](_0xfe81('0xa'),auth[_0xfe81('0x9')](),controller[_0xfe81('0xb')]);router['post']('/',auth[_0xfe81('0x9')](),controller['create']);router[_0xfe81('0xc')](_0xfe81('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xfe81('0xd')](_0xfe81('0xa'),auth['isAuthenticated'](),controller[_0xfe81('0xe')]);module['exports']=router; \ No newline at end of file +var _0xaeca=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','isAuthenticated','get','show','create','put','/:id','update','delete','exports'];(function(_0x52660e,_0x4bae6b){var _0x2fd1a3=function(_0x2caaaf){while(--_0x2caaaf){_0x52660e['push'](_0x52660e['shift']());}};_0x2fd1a3(++_0x4bae6b);}(_0xaeca,0x140));var _0xaaec=function(_0x9c0817,_0x50058d){_0x9c0817=_0x9c0817-0x0;var _0x396086=_0xaeca[_0x9c0817];return _0x396086;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaaec('0x0'));var timeout=require(_0xaaec('0x1'));var express=require(_0xaaec('0x2'));var router=express['Router']();var fs_extra=require(_0xaaec('0x3'));var auth=require(_0xaaec('0x4'));var interaction=require(_0xaaec('0x5'));var config=require('../../config/environment');var controller=require(_0xaaec('0x6'));router['get']('/',auth[_0xaaec('0x7')](),controller['index']);router[_0xaaec('0x8')]('/:id',auth[_0xaaec('0x7')](),controller[_0xaaec('0x9')]);router['post']('/',auth[_0xaaec('0x7')](),controller[_0xaaec('0xa')]);router[_0xaaec('0xb')](_0xaaec('0xc'),auth['isAuthenticated'](),controller[_0xaaec('0xd')]);router[_0xaaec('0xe')](_0xaaec('0xc'),auth[_0xaaec('0x7')](),controller['destroy']);module[_0xaaec('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b408ea1..6523bbb 100644 --- a/server/api/attachment/attachment.attributes.js +++ b/server/api/attachment/attachment.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8135=['STRING','exports'];(function(_0x1b22b3,_0x99ea09){var _0x1678f1=function(_0x4fc986){while(--_0x4fc986){_0x1b22b3['push'](_0x1b22b3['shift']());}};_0x1678f1(++_0x99ea09);}(_0x8135,0x99));var _0x5813=function(_0x3725fc,_0x98ba1e){_0x3725fc=_0x3725fc-0x0;var _0xe49d8d=_0x8135[_0x3725fc];return _0xe49d8d;};'use strict';var Sequelize=require('sequelize');module[_0x5813('0x0')]={'name':{'type':Sequelize[_0x5813('0x1')]},'basename':{'type':Sequelize[_0x5813('0x1')]},'type':{'type':Sequelize[_0x5813('0x1')]}}; \ No newline at end of file +var _0x2b84=['STRING','sequelize'];(function(_0x22ae7c,_0x1d3152){var _0x286eb5=function(_0x5a641f){while(--_0x5a641f){_0x22ae7c['push'](_0x22ae7c['shift']());}};_0x286eb5(++_0x1d3152);}(_0x2b84,0x105));var _0x42b8=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x2b84[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x42b8('0x0'));module['exports']={'name':{'type':Sequelize[_0x42b8('0x1')]},'basename':{'type':Sequelize[_0x42b8('0x1')]},'type':{'type':Sequelize[_0x42b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 0cb9d55..fcd6fd9 100644 --- a/server/api/attachment/attachment.controller.js +++ b/server/api/attachment/attachment.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefb5=['show','params','rawAttributes','find','omit','body','create','file','originalname','type','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','Attachment','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x278111,_0x44e763){var _0x34edb0=function(_0x585faf){while(--_0x585faf){_0x278111['push'](_0x278111['shift']());}};_0x34edb0(++_0x44e763);}(_0xefb5,0x10b));var _0x5efb=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xefb5[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0x5efb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5efb('0x1'));var jsonpatch=require(_0x5efb('0x2'));var rp=require(_0x5efb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5efb('0x4'));var util=require('util');var path=require(_0x5efb('0x5'));var sox=require(_0x5efb('0x6'));var csv=require(_0x5efb('0x7'));var ejs=require(_0x5efb('0x8'));var fs=require('fs');var fs_extra=require(_0x5efb('0x9'));var _=require('lodash');var squel=require(_0x5efb('0xa'));var crypto=require(_0x5efb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5efb('0xc'));var toCsv=require(_0x5efb('0x7'));var querystring=require(_0x5efb('0xd'));var Papa=require(_0x5efb('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5efb('0xf'));var as=require(_0x5efb('0x10'));var hardwareService=require(_0x5efb('0x11'));var logger=require(_0x5efb('0x12'))(_0x5efb('0x13'));var utils=require('../../config/utils');var config=require(_0x5efb('0x14'));var licenseUtil=require(_0x5efb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16351f,_0x5cd8f8){_0x5cd8f8=_0x5cd8f8||0xcc;return function(_0x4e8c2a){if(_0x4e8c2a){return _0x16351f[_0x5efb('0x16')](_0x5cd8f8);}return _0x16351f[_0x5efb('0x17')](_0x5cd8f8)[_0x5efb('0x18')]();};}function respondWithResult(_0x2641ef,_0x5c1732){_0x5c1732=_0x5c1732||0xc8;return function(_0x4b0328){if(_0x4b0328){return _0x2641ef[_0x5efb('0x17')](_0x5c1732)[_0x5efb('0x19')](_0x4b0328);}};}function respondWithFilteredResult(_0x255365,_0xf415f0){return function(_0xc49129){if(_0xc49129){var _0x2b0ab9=typeof _0xf415f0[_0x5efb('0x1a')]===_0x5efb('0x1b')&&typeof _0xf415f0[_0x5efb('0x1c')]===_0x5efb('0x1b');var _0x324f4d=_0xc49129[_0x5efb('0x1d')];var _0x2a591a=_0x2b0ab9?0x0:_0xf415f0[_0x5efb('0x1a')];var _0x35ff7d=_0x2b0ab9?_0xc49129[_0x5efb('0x1d')]:_0xf415f0[_0x5efb('0x1a')]+_0xf415f0[_0x5efb('0x1c')];var _0x3c3e7a;if(_0x35ff7d>=_0x324f4d){_0x35ff7d=_0x324f4d;_0x3c3e7a=0xc8;}else{_0x3c3e7a=0xce;}_0x255365[_0x5efb('0x17')](_0x3c3e7a);return _0x255365[_0x5efb('0x1e')](_0x5efb('0x1f'),_0x2a591a+'-'+_0x35ff7d+'/'+_0x324f4d)[_0x5efb('0x19')](_0xc49129);}return null;};}function patchUpdates(_0x3da8d7){return function(_0xc9a640){try{jsonpatch[_0x5efb('0x20')](_0xc9a640,_0x3da8d7,!![]);}catch(_0xf8a70c){return BPromise[_0x5efb('0x21')](_0xf8a70c);}return _0xc9a640['save']();};}function saveUpdates(_0x4f3b80,_0x4badd8){return function(_0xee5caf){if(_0xee5caf){return _0xee5caf[_0x5efb('0x22')](_0x4f3b80)['then'](function(_0x58247a){return _0x58247a;});}return null;};}function removeEntity(_0x267932,_0xe5de8a){return function(_0x2e1f09){if(_0x2e1f09){return _0x2e1f09[_0x5efb('0x23')]()[_0x5efb('0x24')](function(){_0x267932[_0x5efb('0x17')](0xcc)[_0x5efb('0x18')]();});}};}function handleEntityNotFound(_0x5714fd,_0x1411b0){return function(_0x2f4a17){if(!_0x2f4a17){_0x5714fd['sendStatus'](0x194);}return _0x2f4a17;};}function handleError(_0x240189,_0x4ed1b7){_0x4ed1b7=_0x4ed1b7||0x1f4;return function(_0xc0d95f){logger['error'](_0xc0d95f[_0x5efb('0x25')]);if(_0xc0d95f[_0x5efb('0x26')]){delete _0xc0d95f[_0x5efb('0x26')];}_0x240189[_0x5efb('0x17')](_0x4ed1b7)[_0x5efb('0x27')](_0xc0d95f);};}exports[_0x5efb('0x28')]=function(_0x2886cd,_0x6cc841){var _0xc560b1={},_0x208bfe={},_0x6b0356={'count':0x0,'rows':[]};var _0x4dfc2c=_['map'](db[_0x5efb('0x29')]['rawAttributes'],function(_0x3c88ba){return{'name':_0x3c88ba['fieldName'],'type':_0x3c88ba['type'][_0x5efb('0x2a')]};});_0x208bfe[_0x5efb('0x2b')]=_[_0x5efb('0x2c')](_0x4dfc2c,'name');_0x208bfe[_0x5efb('0x2d')]=_[_0x5efb('0x2e')](_0x2886cd['query']);_0x208bfe[_0x5efb('0x2f')]=_['intersection'](_0x208bfe['model'],_0x208bfe[_0x5efb('0x2d')]);_0xc560b1[_0x5efb('0x30')]=_[_0x5efb('0x31')](_0x208bfe[_0x5efb('0x2b')],qs[_0x5efb('0x32')](_0x2886cd[_0x5efb('0x2d')][_0x5efb('0x32')]));_0xc560b1[_0x5efb('0x30')]=_0xc560b1['attributes'][_0x5efb('0x33')]?_0xc560b1['attributes']:_0x208bfe[_0x5efb('0x2b')];if(!_0x2886cd[_0x5efb('0x2d')]['hasOwnProperty'](_0x5efb('0x34'))){_0xc560b1[_0x5efb('0x1c')]=qs[_0x5efb('0x1c')](_0x2886cd[_0x5efb('0x2d')][_0x5efb('0x1c')]);_0xc560b1[_0x5efb('0x1a')]=qs[_0x5efb('0x1a')](_0x2886cd[_0x5efb('0x2d')][_0x5efb('0x1a')]);}_0xc560b1[_0x5efb('0x35')]=qs[_0x5efb('0x36')](_0x2886cd['query'][_0x5efb('0x36')]);_0xc560b1[_0x5efb('0x37')]=qs[_0x5efb('0x2f')](_[_0x5efb('0x38')](_0x2886cd[_0x5efb('0x2d')],_0x208bfe[_0x5efb('0x2f')]),_0x4dfc2c);if(_0x2886cd[_0x5efb('0x2d')][_0x5efb('0x39')]){_0xc560b1[_0x5efb('0x37')]=_[_0x5efb('0x3a')](_0xc560b1[_0x5efb('0x37')],{'$or':_[_0x5efb('0x2c')](_0x4dfc2c,function(_0x2a68f6){if(_0x2a68f6['type']!==_0x5efb('0x3b')){var _0x5718ff={};_0x5718ff[_0x2a68f6[_0x5efb('0x26')]]={'$like':'%'+_0x2886cd['query'][_0x5efb('0x39')]+'%'};return _0x5718ff;}})});}_0xc560b1=_[_0x5efb('0x3a')]({},_0xc560b1,_0x2886cd[_0x5efb('0x3c')]);var _0x127163={'where':_0xc560b1['where']};return db[_0x5efb('0x29')]['count'](_0x127163)['then'](function(_0x3b9602){_0x6b0356[_0x5efb('0x1d')]=_0x3b9602;if(_0x2886cd[_0x5efb('0x2d')][_0x5efb('0x3d')]){_0xc560b1[_0x5efb('0x3e')]=[{'all':!![]}];}return db[_0x5efb('0x29')][_0x5efb('0x3f')](_0xc560b1);})[_0x5efb('0x24')](function(_0xb4c804){_0x6b0356['rows']=_0xb4c804;return _0x6b0356;})[_0x5efb('0x24')](respondWithFilteredResult(_0x6cc841,_0xc560b1))[_0x5efb('0x40')](handleError(_0x6cc841,null));};exports[_0x5efb('0x41')]=function(_0x4c6fa0,_0x172f53){var _0x2e91c7={'raw':!![],'where':{'id':_0x4c6fa0[_0x5efb('0x42')]['id']}},_0x30d9f0={};_0x30d9f0['model']=_['keys'](db['Attachment'][_0x5efb('0x43')]);_0x30d9f0[_0x5efb('0x2d')]=_['keys'](_0x4c6fa0[_0x5efb('0x2d')]);_0x30d9f0[_0x5efb('0x2f')]=_[_0x5efb('0x31')](_0x30d9f0[_0x5efb('0x2b')],_0x30d9f0['query']);_0x2e91c7['attributes']=_['intersection'](_0x30d9f0[_0x5efb('0x2b')],qs[_0x5efb('0x32')](_0x4c6fa0[_0x5efb('0x2d')][_0x5efb('0x32')]));_0x2e91c7['attributes']=_0x2e91c7[_0x5efb('0x30')][_0x5efb('0x33')]?_0x2e91c7[_0x5efb('0x30')]:_0x30d9f0[_0x5efb('0x2b')];if(_0x4c6fa0[_0x5efb('0x2d')][_0x5efb('0x3d')]){_0x2e91c7[_0x5efb('0x3e')]=[{'all':!![]}];}_0x2e91c7=_[_0x5efb('0x3a')]({},_0x2e91c7,_0x4c6fa0[_0x5efb('0x3c')]);return db[_0x5efb('0x29')]['find'](_0x2e91c7)[_0x5efb('0x24')](handleEntityNotFound(_0x172f53,null))[_0x5efb('0x24')](respondWithResult(_0x172f53,null))[_0x5efb('0x40')](handleError(_0x172f53,null));};exports['clone']=function(_0x195bd2,_0x3058ae){var _0x1ab7aa={'where':{'id':_0x195bd2[_0x5efb('0x42')]['id']}},_0x5370b2={};_0x5370b2[_0x5efb('0x2b')]=_[_0x5efb('0x2e')](db[_0x5efb('0x29')][_0x5efb('0x43')]);_0x1ab7aa['attributes']=_[_0x5efb('0x31')](_0x5370b2['model'],qs['fields'](_0x195bd2['query'][_0x5efb('0x32')]));_0x1ab7aa[_0x5efb('0x30')]=_0x1ab7aa[_0x5efb('0x30')][_0x5efb('0x33')]?_0x1ab7aa['attributes']:_0x5370b2[_0x5efb('0x2b')];if(_0x195bd2[_0x5efb('0x2d')]['includeAll']){_0x1ab7aa['include']=[{'all':!![]}];}_0x1ab7aa=_[_0x5efb('0x3a')]({},_0x1ab7aa,_0x195bd2['options']);return db['Attachment'][_0x5efb('0x44')](_0x1ab7aa)[_0x5efb('0x24')](handleEntityNotFound(_0x3058ae,null))[_0x5efb('0x24')](function(_0x204433){if(_0x204433){var _0x25fc97=_0x204433['get']({'plain':!![]});_0x25fc97=qs[_0x5efb('0x45')](_0x25fc97,['id','createdAt','updatedAt']);_0x195bd2['body']=_[_0x5efb('0x45')](_0x195bd2[_0x5efb('0x46')],['id','createdAt','updatedAt']);return db[_0x5efb('0x29')][_0x5efb('0x47')](_[_0x5efb('0x3a')](_0x25fc97,_0x195bd2[_0x5efb('0x46')]),{'include':_0x195bd2['query'][_0x5efb('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3058ae,0xc9))[_0x5efb('0x40')](handleError(_0x3058ae,null));};exports[_0x5efb('0x22')]=function(_0x134a96,_0x479720){if(_0x134a96[_0x5efb('0x46')]['id']){delete _0x134a96['body']['id'];}return db[_0x5efb('0x29')][_0x5efb('0x44')]({'where':{'id':_0x134a96['params']['id']}})[_0x5efb('0x24')](handleEntityNotFound(_0x479720,null))[_0x5efb('0x24')](saveUpdates(_0x134a96[_0x5efb('0x46')],null))[_0x5efb('0x24')](respondWithResult(_0x479720,null))['catch'](handleError(_0x479720,null));};exports[_0x5efb('0x23')]=function(_0xc8ed46,_0x33639e){return db[_0x5efb('0x29')][_0x5efb('0x44')]({'where':{'id':_0xc8ed46[_0x5efb('0x42')]['id']}})[_0x5efb('0x24')](handleEntityNotFound(_0x33639e,null))[_0x5efb('0x24')](removeEntity(_0x33639e,null))[_0x5efb('0x40')](handleError(_0x33639e,null));};exports['create']=function(_0x3b8516,_0x12eac6,_0x3c1c24){_0x3b8516['body'][_0x5efb('0x26')]=_0x3b8516[_0x5efb('0x48')][_0x5efb('0x49')];_0x3b8516[_0x5efb('0x46')]['basename']=_0x3b8516['file']['filename'];_0x3b8516[_0x5efb('0x46')][_0x5efb('0x4a')]=_0x3b8516[_0x5efb('0x48')][_0x5efb('0x4b')];return db[_0x5efb('0x29')][_0x5efb('0x47')](_0x3b8516['body'])[_0x5efb('0x24')](respondWithResult(_0x12eac6,0xc9))['catch'](handleError(_0x12eac6,null));};exports[_0x5efb('0x4c')]=function(_0x549309,_0x5be08f,_0xf96c67){return db['Attachment'][_0x5efb('0x4d')]({'where':{'id':_0x549309[_0x5efb('0x42')]['id']},'raw':!![]})[_0x5efb('0x24')](handleEntityNotFound(_0x5be08f,null))['then'](function(_0x22a3da){if(_0x22a3da){var _0x2f587e=_0x22a3da[_0x5efb('0x4e')]!==null;var _0xfe62ec=path[_0x5efb('0x4f')](config['root'],_0x5efb('0x50'));if(_0x2f587e){_0xfe62ec=path[_0x5efb('0x4f')](_0xfe62ec,_0x5efb('0x51'));}var _0x250f19=path[_0x5efb('0x4f')](_0xfe62ec,_0x22a3da[_0x5efb('0x52')]);return _0x5be08f[_0x5efb('0x4c')](_0x250f19);}})[_0x5efb('0x40')](handleError(_0x5be08f,null));}; \ No newline at end of file +var _0xbcb8=['include','findAll','rows','catch','show','params','includeAll','find','clone','length','omit','createdAt','body','create','destroy','file','originalname','basename','filename','type','mimetype','download','ChatOfflineMessageId','join','offline-chat/','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','save','update','then','stack','name','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x41064d,_0x4ead45){var _0x23ee30=function(_0x151d50){while(--_0x151d50){_0x41064d['push'](_0x41064d['shift']());}};_0x23ee30(++_0x4ead45);}(_0xbcb8,0x1b8));var _0x8bcb=function(_0x54a73b,_0x1993f2){_0x54a73b=_0x54a73b-0x0;var _0x4ebec2=_0xbcb8[_0x54a73b];return _0x4ebec2;};'use strict';var emlformat=require(_0x8bcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8bcb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8bcb('0x2'));var moment=require('moment');var BPromise=require(_0x8bcb('0x3'));var Mustache=require(_0x8bcb('0x4'));var util=require(_0x8bcb('0x5'));var path=require('path');var sox=require(_0x8bcb('0x6'));var csv=require(_0x8bcb('0x7'));var ejs=require(_0x8bcb('0x8'));var fs=require('fs');var fs_extra=require(_0x8bcb('0x9'));var _=require('lodash');var squel=require(_0x8bcb('0xa'));var crypto=require(_0x8bcb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8bcb('0xc'));var toCsv=require(_0x8bcb('0x7'));var querystring=require(_0x8bcb('0xd'));var Papa=require('papaparse');var Redis=require(_0x8bcb('0xe'));var authService=require(_0x8bcb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8bcb('0x10'));var hardwareService=require(_0x8bcb('0x11'));var logger=require(_0x8bcb('0x12'))(_0x8bcb('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8bcb('0x14'));var db=require(_0x8bcb('0x15'))['db'];function respondWithStatusCode(_0x49a5e0,_0x393ff9){_0x393ff9=_0x393ff9||0xcc;return function(_0x3bfdbd){if(_0x3bfdbd){return _0x49a5e0[_0x8bcb('0x16')](_0x393ff9);}return _0x49a5e0['status'](_0x393ff9)[_0x8bcb('0x17')]();};}function respondWithResult(_0x226b03,_0x26f2f1){_0x26f2f1=_0x26f2f1||0xc8;return function(_0x46b89a){if(_0x46b89a){return _0x226b03[_0x8bcb('0x18')](_0x26f2f1)[_0x8bcb('0x19')](_0x46b89a);}};}function respondWithFilteredResult(_0x544dd9,_0x4b8858){return function(_0x58801f){if(_0x58801f){var _0x152f56=typeof _0x4b8858[_0x8bcb('0x1a')]==='undefined'&&typeof _0x4b8858[_0x8bcb('0x1b')]==='undefined';var _0x3818eb=_0x58801f[_0x8bcb('0x1c')];var _0x4ed1e8=_0x152f56?0x0:_0x4b8858[_0x8bcb('0x1a')];var _0x221f4f=_0x152f56?_0x58801f[_0x8bcb('0x1c')]:_0x4b8858[_0x8bcb('0x1a')]+_0x4b8858['limit'];var _0x27fad0;if(_0x221f4f>=_0x3818eb){_0x221f4f=_0x3818eb;_0x27fad0=0xc8;}else{_0x27fad0=0xce;}_0x544dd9[_0x8bcb('0x18')](_0x27fad0);return _0x544dd9['set'](_0x8bcb('0x1d'),_0x4ed1e8+'-'+_0x221f4f+'/'+_0x3818eb)['json'](_0x58801f);}return null;};}function patchUpdates(_0x26a2e1){return function(_0x26297a){try{jsonpatch[_0x8bcb('0x1e')](_0x26297a,_0x26a2e1,!![]);}catch(_0xc02234){return BPromise['reject'](_0xc02234);}return _0x26297a[_0x8bcb('0x1f')]();};}function saveUpdates(_0x560cfa,_0x22b2e2){return function(_0x541266){if(_0x541266){return _0x541266[_0x8bcb('0x20')](_0x560cfa)[_0x8bcb('0x21')](function(_0x29ee6a){return _0x29ee6a;});}return null;};}function removeEntity(_0xf25c79,_0x400703){return function(_0x5f1d00){if(_0x5f1d00){return _0x5f1d00['destroy']()[_0x8bcb('0x21')](function(){_0xf25c79[_0x8bcb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c128b,_0x315001){return function(_0x4c60c4){if(!_0x4c60c4){_0x1c128b[_0x8bcb('0x16')](0x194);}return _0x4c60c4;};}function handleError(_0x5b2b39,_0x556cb3){_0x556cb3=_0x556cb3||0x1f4;return function(_0x42374b){logger['error'](_0x42374b[_0x8bcb('0x22')]);if(_0x42374b[_0x8bcb('0x23')]){delete _0x42374b[_0x8bcb('0x23')];}_0x5b2b39[_0x8bcb('0x18')](_0x556cb3)['send'](_0x42374b);};}exports['index']=function(_0x18f9de,_0x2b484c){var _0xdab036={},_0x469436={},_0x2dfa22={'count':0x0,'rows':[]};var _0x183fc7=_[_0x8bcb('0x24')](db[_0x8bcb('0x25')][_0x8bcb('0x26')],function(_0x2813da){return{'name':_0x2813da[_0x8bcb('0x27')],'type':_0x2813da['type'][_0x8bcb('0x28')]};});_0x469436[_0x8bcb('0x29')]=_['map'](_0x183fc7,_0x8bcb('0x23'));_0x469436[_0x8bcb('0x2a')]=_[_0x8bcb('0x2b')](_0x18f9de[_0x8bcb('0x2a')]);_0x469436[_0x8bcb('0x2c')]=_[_0x8bcb('0x2d')](_0x469436[_0x8bcb('0x29')],_0x469436['query']);_0xdab036[_0x8bcb('0x2e')]=_['intersection'](_0x469436[_0x8bcb('0x29')],qs[_0x8bcb('0x2f')](_0x18f9de[_0x8bcb('0x2a')][_0x8bcb('0x2f')]));_0xdab036[_0x8bcb('0x2e')]=_0xdab036[_0x8bcb('0x2e')]['length']?_0xdab036[_0x8bcb('0x2e')]:_0x469436['model'];if(!_0x18f9de[_0x8bcb('0x2a')][_0x8bcb('0x30')](_0x8bcb('0x31'))){_0xdab036[_0x8bcb('0x1b')]=qs[_0x8bcb('0x1b')](_0x18f9de['query'][_0x8bcb('0x1b')]);_0xdab036[_0x8bcb('0x1a')]=qs[_0x8bcb('0x1a')](_0x18f9de[_0x8bcb('0x2a')][_0x8bcb('0x1a')]);}_0xdab036[_0x8bcb('0x32')]=qs[_0x8bcb('0x33')](_0x18f9de['query'][_0x8bcb('0x33')]);_0xdab036['where']=qs[_0x8bcb('0x2c')](_[_0x8bcb('0x34')](_0x18f9de[_0x8bcb('0x2a')],_0x469436[_0x8bcb('0x2c')]),_0x183fc7);if(_0x18f9de[_0x8bcb('0x2a')][_0x8bcb('0x35')]){_0xdab036[_0x8bcb('0x36')]=_[_0x8bcb('0x37')](_0xdab036[_0x8bcb('0x36')],{'$or':_[_0x8bcb('0x24')](_0x183fc7,function(_0x476fa8){if(_0x476fa8['type']!==_0x8bcb('0x38')){var _0x57dda7={};_0x57dda7[_0x476fa8[_0x8bcb('0x23')]]={'$like':'%'+_0x18f9de['query'][_0x8bcb('0x35')]+'%'};return _0x57dda7;}})});}_0xdab036=_[_0x8bcb('0x37')]({},_0xdab036,_0x18f9de[_0x8bcb('0x39')]);var _0x56c44c={'where':_0xdab036[_0x8bcb('0x36')]};return db[_0x8bcb('0x25')][_0x8bcb('0x1c')](_0x56c44c)['then'](function(_0x4a2314){_0x2dfa22['count']=_0x4a2314;if(_0x18f9de[_0x8bcb('0x2a')]['includeAll']){_0xdab036[_0x8bcb('0x3a')]=[{'all':!![]}];}return db[_0x8bcb('0x25')][_0x8bcb('0x3b')](_0xdab036);})[_0x8bcb('0x21')](function(_0x583154){_0x2dfa22[_0x8bcb('0x3c')]=_0x583154;return _0x2dfa22;})[_0x8bcb('0x21')](respondWithFilteredResult(_0x2b484c,_0xdab036))[_0x8bcb('0x3d')](handleError(_0x2b484c,null));};exports[_0x8bcb('0x3e')]=function(_0x20848d,_0x2f2805){var _0x16c444={'raw':!![],'where':{'id':_0x20848d[_0x8bcb('0x3f')]['id']}},_0x398b1b={};_0x398b1b[_0x8bcb('0x29')]=_[_0x8bcb('0x2b')](db[_0x8bcb('0x25')][_0x8bcb('0x26')]);_0x398b1b['query']=_[_0x8bcb('0x2b')](_0x20848d[_0x8bcb('0x2a')]);_0x398b1b[_0x8bcb('0x2c')]=_[_0x8bcb('0x2d')](_0x398b1b[_0x8bcb('0x29')],_0x398b1b[_0x8bcb('0x2a')]);_0x16c444[_0x8bcb('0x2e')]=_[_0x8bcb('0x2d')](_0x398b1b[_0x8bcb('0x29')],qs[_0x8bcb('0x2f')](_0x20848d[_0x8bcb('0x2a')][_0x8bcb('0x2f')]));_0x16c444['attributes']=_0x16c444[_0x8bcb('0x2e')]['length']?_0x16c444['attributes']:_0x398b1b[_0x8bcb('0x29')];if(_0x20848d[_0x8bcb('0x2a')][_0x8bcb('0x40')]){_0x16c444[_0x8bcb('0x3a')]=[{'all':!![]}];}_0x16c444=_[_0x8bcb('0x37')]({},_0x16c444,_0x20848d['options']);return db[_0x8bcb('0x25')][_0x8bcb('0x41')](_0x16c444)['then'](handleEntityNotFound(_0x2f2805,null))['then'](respondWithResult(_0x2f2805,null))[_0x8bcb('0x3d')](handleError(_0x2f2805,null));};exports[_0x8bcb('0x42')]=function(_0x5b6ee8,_0x29d03c){var _0x2b2762={'where':{'id':_0x5b6ee8[_0x8bcb('0x3f')]['id']}},_0x438406={};_0x438406['model']=_['keys'](db['Attachment'][_0x8bcb('0x26')]);_0x2b2762['attributes']=_[_0x8bcb('0x2d')](_0x438406[_0x8bcb('0x29')],qs[_0x8bcb('0x2f')](_0x5b6ee8[_0x8bcb('0x2a')][_0x8bcb('0x2f')]));_0x2b2762['attributes']=_0x2b2762[_0x8bcb('0x2e')][_0x8bcb('0x43')]?_0x2b2762[_0x8bcb('0x2e')]:_0x438406['model'];if(_0x5b6ee8[_0x8bcb('0x2a')][_0x8bcb('0x40')]){_0x2b2762[_0x8bcb('0x3a')]=[{'all':!![]}];}_0x2b2762=_[_0x8bcb('0x37')]({},_0x2b2762,_0x5b6ee8[_0x8bcb('0x39')]);return db[_0x8bcb('0x25')][_0x8bcb('0x41')](_0x2b2762)[_0x8bcb('0x21')](handleEntityNotFound(_0x29d03c,null))[_0x8bcb('0x21')](function(_0x46a774){if(_0x46a774){var _0x7d2777=_0x46a774['get']({'plain':!![]});_0x7d2777=qs[_0x8bcb('0x44')](_0x7d2777,['id',_0x8bcb('0x45'),'updatedAt']);_0x5b6ee8[_0x8bcb('0x46')]=_[_0x8bcb('0x44')](_0x5b6ee8[_0x8bcb('0x46')],['id',_0x8bcb('0x45'),'updatedAt']);return db['Attachment'][_0x8bcb('0x47')](_[_0x8bcb('0x37')](_0x7d2777,_0x5b6ee8[_0x8bcb('0x46')]),{'include':_0x5b6ee8[_0x8bcb('0x2a')][_0x8bcb('0x40')]?[{'all':!![]}]:undefined});}})[_0x8bcb('0x21')](respondWithResult(_0x29d03c,0xc9))[_0x8bcb('0x3d')](handleError(_0x29d03c,null));};exports[_0x8bcb('0x20')]=function(_0x5dd5c0,_0x403800){if(_0x5dd5c0[_0x8bcb('0x46')]['id']){delete _0x5dd5c0[_0x8bcb('0x46')]['id'];}return db[_0x8bcb('0x25')][_0x8bcb('0x41')]({'where':{'id':_0x5dd5c0['params']['id']}})[_0x8bcb('0x21')](handleEntityNotFound(_0x403800,null))[_0x8bcb('0x21')](saveUpdates(_0x5dd5c0[_0x8bcb('0x46')],null))[_0x8bcb('0x21')](respondWithResult(_0x403800,null))[_0x8bcb('0x3d')](handleError(_0x403800,null));};exports[_0x8bcb('0x48')]=function(_0x5146ab,_0x780eee){return db[_0x8bcb('0x25')][_0x8bcb('0x41')]({'where':{'id':_0x5146ab[_0x8bcb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x780eee,null))[_0x8bcb('0x21')](removeEntity(_0x780eee,null))[_0x8bcb('0x3d')](handleError(_0x780eee,null));};exports[_0x8bcb('0x47')]=function(_0x4c9e77,_0x37ef0a,_0x237437){_0x4c9e77[_0x8bcb('0x46')]['name']=_0x4c9e77[_0x8bcb('0x49')][_0x8bcb('0x4a')];_0x4c9e77[_0x8bcb('0x46')][_0x8bcb('0x4b')]=_0x4c9e77[_0x8bcb('0x49')][_0x8bcb('0x4c')];_0x4c9e77[_0x8bcb('0x46')][_0x8bcb('0x4d')]=_0x4c9e77['file'][_0x8bcb('0x4e')];return db[_0x8bcb('0x25')][_0x8bcb('0x47')](_0x4c9e77[_0x8bcb('0x46')])[_0x8bcb('0x21')](respondWithResult(_0x37ef0a,0xc9))['catch'](handleError(_0x37ef0a,null));};exports[_0x8bcb('0x4f')]=function(_0x1c732c,_0x3d9d4f,_0x5654c1){return db[_0x8bcb('0x25')]['findOne']({'where':{'id':_0x1c732c[_0x8bcb('0x3f')]['id']},'raw':!![]})[_0x8bcb('0x21')](handleEntityNotFound(_0x3d9d4f,null))['then'](function(_0x57c6b5){if(_0x57c6b5){var _0x2f0a77=_0x57c6b5[_0x8bcb('0x50')]!==null;var _0x34766e=path[_0x8bcb('0x51')](config['root'],'server/files/attachments/');if(_0x2f0a77){_0x34766e=path[_0x8bcb('0x51')](_0x34766e,_0x8bcb('0x52'));}var _0x4fddad=path[_0x8bcb('0x51')](_0x34766e,_0x57c6b5[_0x8bcb('0x4b')]);return _0x3d9d4f[_0x8bcb('0x4f')](_0x4fddad);}})[_0x8bcb('0x3d')](handleError(_0x3d9d4f,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8455976..18b4db2 100644 --- a/server/api/attachment/attachment.model.js +++ b/server/api/attachment/attachment.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e1a=['api','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define','attachments','lodash','util','../../config/logger'];(function(_0x1f9c93,_0x533398){var _0x226ac2=function(_0x24412c){while(--_0x24412c){_0x1f9c93['push'](_0x1f9c93['shift']());}};_0x226ac2(++_0x533398);}(_0x7e1a,0x195));var _0xa7e1=function(_0x316da5,_0x34ddb6){_0x316da5=_0x316da5-0x0;var _0xbd1248=_0x7e1a[_0x316da5];return _0xbd1248;};'use strict';var _=require(_0xa7e1('0x0'));var util=require(_0xa7e1('0x1'));var logger=require(_0xa7e1('0x2'))(_0xa7e1('0x3'));var moment=require('moment');var BPromise=require(_0xa7e1('0x4'));var rp=require(_0xa7e1('0x5'));var fs=require('fs');var path=require(_0xa7e1('0x6'));var rimraf=require(_0xa7e1('0x7'));var config=require('../../config/environment');var attributes=require(_0xa7e1('0x8'));module[_0xa7e1('0x9')]=function(_0x334c92,_0x49e036){return _0x334c92[_0xa7e1('0xa')]('Attachment',attributes,{'tableName':_0xa7e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa31d=['../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','../../config/logger','api','moment','bluebird','path'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0xa31d,0x1d4));var _0xda31=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0xa31d[_0x5d5bcb];return _0x4ea5eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xda31('0x0'))(_0xda31('0x1'));var moment=require(_0xda31('0x2'));var BPromise=require(_0xda31('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda31('0x4'));var rimraf=require('rimraf');var config=require(_0xda31('0x5'));var attributes=require(_0xda31('0x6'));module[_0xda31('0x7')]=function(_0xe94201,_0x5878e2){return _0xe94201[_0xda31('0x8')](_0xda31('0x9'),attributes,{'tableName':_0xda31('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index fc78d03..bc11a93 100644 --- a/server/api/attachment/attachment.rpc.js +++ b/server/api/attachment/attachment.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fef=['debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','raw'];(function(_0x569b7a,_0x377a61){var _0x39d00a=function(_0x1ee0bc){while(--_0x1ee0bc){_0x569b7a['push'](_0x569b7a['shift']());}};_0x39d00a(++_0x377a61);}(_0x4fef,0x10f));var _0xf4fe=function(_0x196b4b,_0x41613f){_0x196b4b=_0x196b4b-0x0;var _0xefe3b0=_0x4fef[_0x196b4b];return _0xefe3b0;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require('moment');var BPromise=require(_0xf4fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4fe('0x3'));var db=require(_0xf4fe('0x4'))['db'];var utils=require(_0xf4fe('0x5'));var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson[_0xf4fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363096,_0x3e844d,_0x4805b0){return new BPromise(function(_0x23b761,_0x1e858f){return client[_0xf4fe('0xb')](_0x363096,_0x4805b0)[_0xf4fe('0xc')](function(_0xdec534){logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,_0xf4fe('0xf'));logger['debug'](_0xf4fe('0x10'),_0x3e844d,'request\x20sent',JSON[_0xf4fe('0x11')](_0xdec534));if(_0xdec534[_0xf4fe('0x12')]){if(_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x13')]===0x1f4){logger[_0xf4fe('0x12')]('Attachment,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x1e858f(_0xdec534[_0xf4fe('0x12')]['message']);}logger[_0xf4fe('0x12')]('Attachment,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x23b761(_0xdec534[_0xf4fe('0x12')]['message']);}else{logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,'request\x20sent');_0x23b761(_0xdec534[_0xf4fe('0x15')][_0xf4fe('0x14')]);}})[_0xf4fe('0x16')](function(_0x565dc6){logger['error'](_0xf4fe('0xe'),_0x3e844d,_0x565dc6);_0x1e858f(_0x565dc6);});});}exports[_0xf4fe('0x17')]=function(_0x5ad86c){var _0x519f1d=this;return new Promise(function(_0x24c818,_0x2b58dd){return db[_0xf4fe('0x18')][_0xf4fe('0x19')](_0x5ad86c[_0xf4fe('0x1a')],{'raw':_0x5ad86c[_0xf4fe('0x1b')]?_0x5ad86c[_0xf4fe('0x1b')][_0xf4fe('0x1c')]===undefined?!![]:![]:!![]})[_0xf4fe('0xc')](function(_0x223676){logger[_0xf4fe('0xd')](_0xf4fe('0x17'),_0x5ad86c);logger[_0xf4fe('0x1d')](_0xf4fe('0x17'),_0x5ad86c,JSON['stringify'](_0x223676));_0x24c818(_0x223676);})[_0xf4fe('0x16')](function(_0x5e8e18){logger['error']('CreateAttachment',_0x5e8e18[_0xf4fe('0x14')],_0x5ad86c);_0x2b58dd(_0x519f1d['error'](0x1f4,_0x5e8e18['message']));});});}; \ No newline at end of file +var _0x12fd=['options','raw','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','Attachment,\x20%s,\x20%s','result','catch','CreateAttachment','Attachment'];(function(_0x4ab11f,_0x22687d){var _0x5e4885=function(_0x50aa){while(--_0x50aa){_0x4ab11f['push'](_0x4ab11f['shift']());}};_0x5e4885(++_0x22687d);}(_0x12fd,0x199));var _0xd12f=function(_0x269979,_0x54a6c3){_0x269979=_0x269979-0x0;var _0x4c45ca=_0x12fd[_0x269979];return _0x4c45ca;};'use strict';var _=require(_0xd12f('0x0'));var util=require(_0xd12f('0x1'));var moment=require(_0xd12f('0x2'));var BPromise=require(_0xd12f('0x3'));var rs=require(_0xd12f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd12f('0x5'))['db'];var utils=require(_0xd12f('0x6'));var logger=require(_0xd12f('0x7'))(_0xd12f('0x8'));var config=require(_0xd12f('0x9'));var jayson=require(_0xd12f('0xa'));var client=jayson['client'][_0xd12f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ca6e6,_0x285abf,_0x193e89){return new BPromise(function(_0x62de68,_0x40aaf8){return client['request'](_0x5ca6e6,_0x193e89)[_0xd12f('0xc')](function(_0x539473){logger[_0xd12f('0xd')]('Attachment,\x20%s,\x20%s',_0x285abf,'request\x20sent');logger['debug'](_0xd12f('0xe'),_0x285abf,_0xd12f('0xf'),JSON['stringify'](_0x539473));if(_0x539473['error']){if(_0x539473['error']['code']===0x1f4){logger[_0xd12f('0x10')]('Attachment,\x20%s,\x20%s',_0x285abf,_0x539473[_0xd12f('0x10')][_0xd12f('0x11')]);return _0x40aaf8(_0x539473['error'][_0xd12f('0x11')]);}logger[_0xd12f('0x10')]('Attachment,\x20%s,\x20%s',_0x285abf,_0x539473['error']['message']);return _0x62de68(_0x539473[_0xd12f('0x10')][_0xd12f('0x11')]);}else{logger[_0xd12f('0xd')](_0xd12f('0x12'),_0x285abf,_0xd12f('0xf'));_0x62de68(_0x539473[_0xd12f('0x13')][_0xd12f('0x11')]);}})[_0xd12f('0x14')](function(_0x4769a2){logger['error']('Attachment,\x20%s,\x20%s',_0x285abf,_0x4769a2);_0x40aaf8(_0x4769a2);});});}exports[_0xd12f('0x15')]=function(_0x45ff4d){var _0x58a653=this;return new Promise(function(_0x14c619,_0x12c884){return db[_0xd12f('0x16')]['create'](_0x45ff4d['body'],{'raw':_0x45ff4d[_0xd12f('0x17')]?_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x18')]===undefined?!![]:![]:!![]})[_0xd12f('0xc')](function(_0x410073){logger[_0xd12f('0xd')]('CreateAttachment',_0x45ff4d);logger[_0xd12f('0x19')](_0xd12f('0x15'),_0x45ff4d,JSON[_0xd12f('0x1a')](_0x410073));_0x14c619(_0x410073);})[_0xd12f('0x14')](function(_0x3a0c41){logger[_0xd12f('0x10')](_0xd12f('0x15'),_0x3a0c41[_0xd12f('0x11')],_0x45ff4d);_0x12c884(_0x58a653[_0xd12f('0x10')](0x1f4,_0x3a0c41[_0xd12f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ba61bc8..1b184cd 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x28fd8c,_0x6826b2){var _0x26bd61=function(_0x3d717b){while(--_0x3d717b){_0x28fd8c['push'](_0x28fd8c['shift']());}};_0x26bd61(++_0x6826b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x595151,_0x1f1f72){_0x595151=_0x595151-0x0;var _0x5776df=_0xb10b[_0x595151];return _0x5776df;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x431c42,_0x336574){var _0x16f9df=function(_0x3956fd){while(--_0x3956fd){_0x431c42['push'](_0x431c42['shift']());}};_0x16f9df(++_0x336574);}(_0xadb5,0xad));var _0x5adb=function(_0x19c2de,_0x5318bd){_0x19c2de=_0x19c2de-0x0;var _0x226c87=_0xadb5[_0x19c2de];return _0x226c87;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index f2de981..5fbcdd9 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7355=['role','json','online','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','Error\x20authenticate\x20%s:\x20%s','inspect','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','findOne','name','password','salt','blocked','blockedAt','admin','user','agent','then','disabled','add','getLicense','catch','send','message','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x2000c8,_0x4550cc){var _0x39e30c=function(_0x2d79a4){while(--_0x2d79a4){_0x2000c8['push'](_0x2000c8['shift']());}};_0x39e30c(++_0x4550cc);}(_0x7355,0x91));var _0x5735=function(_0x1035c3,_0x1072dc){_0x1035c3=_0x1035c3-0x0;var _0x2aeba6=_0x7355[_0x1035c3];return _0x2aeba6;};'use strict';var passport=require(_0x5735('0x0'));var LocalStrategy=require(_0x5735('0x1'))[_0x5735('0x2')];var moment=require(_0x5735('0x3'));var ActiveDirectory=require(_0x5735('0x4'));var BPromise=require(_0x5735('0x5'));var util=require('util');var db=require(_0x5735('0x6'))['db'];var authService=require(_0x5735('0x7'));var utils=require(_0x5735('0x8'));var config=require(_0x5735('0x9'));var logger=require(_0x5735('0xa'))(_0x5735('0xb'));function isActiveDirectoryConfigured(_0x2c1aa3){var _0x186b2a=![];if(typeof _0x2c1aa3[_0x5735('0xc')]!==_0x5735('0xd')){_0x186b2a=_0x2c1aa3[_0x5735('0xc')][_0x5735('0xe')]&&_0x2c1aa3[_0x5735('0xc')]['url']&&_0x2c1aa3['activedirectory'][_0x5735('0xf')];}return _0x186b2a;}function adAuthenticate(_0x391f7d,_0x1cd8dd,_0x257a8e){return new BPromise(function(_0x52967e,_0x38b5f3){try{var _0x5c9bd9=new ActiveDirectory(_0x391f7d);_0x5c9bd9['authenticate'](_0x1cd8dd,_0x257a8e,function(_0x520186,_0x51172a){if(_0x520186){logger['error'](_0x5735('0x10'),_0x1cd8dd,util[_0x5735('0x11')](_0x520186,{'showHidden':![],'depth':null}));_0x38b5f3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x51172a){logger[_0x5735('0x12')](_0x5735('0x13'),_0x1cd8dd);_0x38b5f3(_0x5735('0x14'));}else{_0x52967e(_0x51172a);}});}catch(_0x25f5d1){_0x38b5f3(_0x25f5d1);}});}function ActiveDirectoryAuthenticate(_0x377850,_0x1d4793,_0x2b5988,_0x12e200){var _0x295472,_0x184e0b;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x5735('0x15'),_0x1d4793);return _0x12e200(null,![],{'message':_0x5735('0x14')});}return db[_0x5735('0x16')]['findOne']({'where':{'id':0x1},'attributes':[_0x5735('0x17'),_0x5735('0x18')],'raw':!![]})['then'](function(_0x24314a){_0x295472=_0x24314a;if(!_0x295472[_0x5735('0x17')]){logger[_0x5735('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x1d4793);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x377850[_0x5735('0x19')]({'attributes':['id',_0x5735('0x1a'),_0x5735('0x1b'),_0x5735('0x1c'),'role','disabled',_0x5735('0x1d'),_0x5735('0x1e'),'online'],'where':{'name':_0x1d4793,'role':{'$or':[_0x5735('0x1f'),_0x5735('0x20'),_0x5735('0x21')]},'adSsoEnabled':!![]}});})[_0x5735('0x22')](function(_0x1838eb){if(!_0x1838eb||_0x1838eb&&_0x1838eb['name']!==_0x1d4793){throw new Error(_0x5735('0x14'));}_0x184e0b=_0x1838eb;var _0x4b1242=_0x184e0b['name']+'@'+config[_0x5735('0xc')][_0x5735('0xf')];return adAuthenticate(config[_0x5735('0xc')],_0x4b1242,_0x2b5988);})[_0x5735('0x22')](function(_0x5d855a){if(_0x184e0b[_0x5735('0x23')]){throw new Error(_0x5735('0x14'));}if(_0x295472[_0x5735('0x18')]>0x0){if(_0x184e0b[_0x5735('0x1d')]){if(moment(_0x184e0b['blockedAt'])[_0x5735('0x24')](_0x295472[_0x5735('0x18')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x184e0b,0x0,![],null)['then'](function(){return utils[_0x5735('0x25')](_0x184e0b);})[_0x5735('0x22')](function(){return _0x12e200(null,_0x184e0b);});}else{return utils['getLicense'](_0x184e0b)[_0x5735('0x22')](function(){return _0x12e200(null,_0x184e0b);});}}else{return utils[_0x5735('0x25')](_0x184e0b)[_0x5735('0x22')](function(){return _0x12e200(null,_0x184e0b);});}})[_0x5735('0x26')](function(_0x315e1f){return _0x12e200(null,![],_0x315e1f);});}function handleError(_0x45f6b0,_0x37a04b,_0x384f53){return _0x45f6b0['status'](_0x37a04b||0x1f4)[_0x5735('0x27')]({'message':_0x384f53?_0x384f53[_0x5735('0x28')]||_0x384f53:''});}exports['login']=function(_0x185627,_0x11c6f6,_0x55c3e9){passport[_0x5735('0x29')]('ad-login',function(_0x1d70b2,_0x5dbf35,_0x552349){var _0x5bcf77=_0x1d70b2||_0x552349;if(_0x5bcf77){return handleError(_0x11c6f6,0x191,_0x5bcf77);}if(!_0x5dbf35){return handleError(_0x11c6f6,0x194,{'message':_0x5735('0x2a')});}else{var _0x5303af={'payload':{'id':_0x5dbf35['id'],'role':_0x5dbf35[_0x5735('0x2b')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5303af)[_0x5735('0x22')](function(_0x8e2547){_0x11c6f6[_0x5735('0x2c')]({'id':_0x5dbf35['id'],'token':_0x8e2547,'statusCall':'','isAlreadyLogged':_0x5dbf35[_0x5735('0x2d')]});});}})(_0x185627,_0x11c6f6,_0x55c3e9);};passport['use']('ad-login',new LocalStrategy({'usernameField':_0x5735('0x1a'),'passwordField':_0x5735('0x1b')},function(_0x18e17f,_0x35fb01,_0x5a383a){return ActiveDirectoryAuthenticate(db[_0x5735('0x2e')],_0x18e17f,_0x35fb01,_0x5a383a);})); \ No newline at end of file +var _0xbb6b=['url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','blockedAt','online','admin','user','agent','disabled','blocked','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','signToken','use','User','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0xbb6b,0xea));var _0xbbb6=function(_0x5f5913,_0x2f50d1){_0x5f5913=_0x5f5913-0x0;var _0x377199=_0xbb6b[_0x5f5913];return _0x377199;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xbbb6('0x0'))[_0xbbb6('0x1')];var moment=require('moment');var ActiveDirectory=require(_0xbbb6('0x2'));var BPromise=require(_0xbbb6('0x3'));var util=require(_0xbbb6('0x4'));var db=require(_0xbbb6('0x5'))['db'];var authService=require(_0xbbb6('0x6'));var utils=require(_0xbbb6('0x7'));var config=require(_0xbbb6('0x8'));var logger=require('../../config/logger')(_0xbbb6('0x9'));function isActiveDirectoryConfigured(_0x1b7052){var _0x5e3c3c=![];if(typeof _0x1b7052[_0xbbb6('0xa')]!=='undefined'){_0x5e3c3c=_0x1b7052[_0xbbb6('0xa')]['baseDN']&&_0x1b7052[_0xbbb6('0xa')][_0xbbb6('0xb')]&&_0x1b7052[_0xbbb6('0xa')][_0xbbb6('0xc')];}return _0x5e3c3c;}function adAuthenticate(_0x5cd12d,_0x457fdd,_0x14c0c6){return new BPromise(function(_0x193cc6,_0x162f58){try{var _0x4a1ef3=new ActiveDirectory(_0x5cd12d);_0x4a1ef3[_0xbbb6('0xd')](_0x457fdd,_0x14c0c6,function(_0x15c180,_0x25f9ca){if(_0x15c180){logger['error'](_0xbbb6('0xe'),_0x457fdd,util[_0xbbb6('0xf')](_0x15c180,{'showHidden':![],'depth':null}));_0x162f58(_0xbbb6('0x10'));}else if(!_0x25f9ca){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x457fdd);_0x162f58('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x193cc6(_0x25f9ca);}});}catch(_0x4b83ca){_0x162f58(_0x4b83ca);}});}function ActiveDirectoryAuthenticate(_0x517bc9,_0x2b3dbc,_0x19a15c,_0x1c12b3){var _0x22a70c,_0x4a4a03;if(!isActiveDirectoryConfigured(config)){logger[_0xbbb6('0x11')](_0xbbb6('0x12'),_0x2b3dbc);return _0x1c12b3(null,![],{'message':_0xbbb6('0x10')});}return db[_0xbbb6('0x13')]['findOne']({'where':{'id':0x1},'attributes':[_0xbbb6('0x14'),_0xbbb6('0x15')],'raw':!![]})[_0xbbb6('0x16')](function(_0xa17a76){_0x22a70c=_0xa17a76;if(!_0x22a70c['adSsoEnabled']){logger[_0xbbb6('0x11')](_0xbbb6('0x17'),_0x2b3dbc);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x517bc9[_0xbbb6('0x18')]({'attributes':['id',_0xbbb6('0x19'),_0xbbb6('0x1a'),_0xbbb6('0x1b'),_0xbbb6('0x1c'),'disabled','blocked',_0xbbb6('0x1d'),_0xbbb6('0x1e')],'where':{'name':_0x2b3dbc,'role':{'$or':[_0xbbb6('0x1f'),_0xbbb6('0x20'),_0xbbb6('0x21')]},'adSsoEnabled':!![]}});})[_0xbbb6('0x16')](function(_0x33eaf4){if(!_0x33eaf4||_0x33eaf4&&_0x33eaf4[_0xbbb6('0x19')]!==_0x2b3dbc){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x4a4a03=_0x33eaf4;var _0x269900=_0x4a4a03[_0xbbb6('0x19')]+'@'+config[_0xbbb6('0xa')][_0xbbb6('0xc')];return adAuthenticate(config[_0xbbb6('0xa')],_0x269900,_0x19a15c);})[_0xbbb6('0x16')](function(_0x19dafa){if(_0x4a4a03[_0xbbb6('0x22')]){throw new Error(_0xbbb6('0x10'));}if(_0x22a70c[_0xbbb6('0x15')]>0x0){if(_0x4a4a03[_0xbbb6('0x23')]){if(moment(_0x4a4a03[_0xbbb6('0x1d')])[_0xbbb6('0x24')](_0x22a70c[_0xbbb6('0x15')],_0xbbb6('0x25'))>moment()){throw new Error(_0xbbb6('0x10'));}return utils[_0xbbb6('0x26')](_0x4a4a03,0x0,![],null)[_0xbbb6('0x16')](function(){return utils[_0xbbb6('0x27')](_0x4a4a03);})[_0xbbb6('0x16')](function(){return _0x1c12b3(null,_0x4a4a03);});}else{return utils[_0xbbb6('0x27')](_0x4a4a03)['then'](function(){return _0x1c12b3(null,_0x4a4a03);});}}else{return utils[_0xbbb6('0x27')](_0x4a4a03)['then'](function(){return _0x1c12b3(null,_0x4a4a03);});}})[_0xbbb6('0x28')](function(_0x290fba){return _0x1c12b3(null,![],_0x290fba);});}function handleError(_0x436d86,_0x426852,_0x447acd){return _0x436d86[_0xbbb6('0x29')](_0x426852||0x1f4)[_0xbbb6('0x2a')]({'message':_0x447acd?_0x447acd[_0xbbb6('0x2b')]||_0x447acd:''});}exports[_0xbbb6('0x2c')]=function(_0x3cdf21,_0x396178,_0x2ace40){passport['authenticate'](_0xbbb6('0x2d'),function(_0x4f4c89,_0x3171a0,_0xbf84fc){var _0x237458=_0x4f4c89||_0xbf84fc;if(_0x237458){return handleError(_0x396178,0x191,_0x237458);}if(!_0x3171a0){return handleError(_0x396178,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4637f8={'payload':{'id':_0x3171a0['id'],'role':_0x3171a0['role']},'options':{'expiresIn':0x15180}};return authService[_0xbbb6('0x2e')](_0x4637f8)[_0xbbb6('0x16')](function(_0x277c33){_0x396178['json']({'id':_0x3171a0['id'],'token':_0x277c33,'statusCall':'','isAlreadyLogged':_0x3171a0[_0xbbb6('0x1e')]});});}})(_0x3cdf21,_0x396178,_0x2ace40);};passport[_0xbbb6('0x2f')](_0xbbb6('0x2d'),new LocalStrategy({'usernameField':_0xbbb6('0x19'),'passwordField':'password'},function(_0x54986b,_0x2af4cb,_0x349613){return ActiveDirectoryAuthenticate(db[_0xbbb6('0x30')],_0x54986b,_0x2af4cb,_0x349613);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index d55faba..f2674aa 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81c3=['./authActiveDirectory.controller','post','exports','express'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x81c3,0x18b));var _0x381c=function(_0x5d9b60,_0x11579a){_0x5d9b60=_0x5d9b60-0x0;var _0x8b8632=_0x81c3[_0x5d9b60];return _0x8b8632;};'use strict';var express=require(_0x381c('0x0'));var router=express['Router']();var controller=require(_0x381c('0x1'));router[_0x381c('0x2')]('/',controller['login']);module[_0x381c('0x3')]=router; \ No newline at end of file +var _0x20b5=['./authActiveDirectory.controller','post','login','exports','express'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x20b5,0x13a));var _0x520b=function(_0x21cb42,_0x4a9d87){_0x21cb42=_0x21cb42-0x0;var _0x4d847b=_0x20b5[_0x21cb42];return _0x4d847b;};'use strict';var express=require(_0x520b('0x0'));var router=express['Router']();var controller=require(_0x520b('0x1'));router[_0x520b('0x2')]('/',controller[_0x520b('0x3')]);module[_0x520b('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index c730952..579f05f 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x7a54,0x106));var _0x47a5=function(_0x26db4b,_0x314d28){_0x26db4b=_0x26db4b-0x0;var _0x1f64c9=_0x7a54[_0x26db4b];return _0x1f64c9;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x7a54,0x106));var _0x47a5=function(_0x389dc6,_0x1d2f0b){_0x389dc6=_0x389dc6-0x0;var _0x59a020=_0x7a54[_0x389dc6];return _0x59a020;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 842fc58..1bf1f3a 100644 --- a/server/api/authGoogle/index.js +++ b/server/api/authGoogle/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d5d=['login','isMiddleware','setTokenCookie','exports','express','passport','./authGoogle.controller','../../components/auth/service','get'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x9d5d,0x1bd));var _0xd9d5=function(_0x38ca9d,_0x3118ff){_0x38ca9d=_0x38ca9d-0x0;var _0x573132=_0x9d5d[_0x38ca9d];return _0x573132;};'use strict';var express=require(_0xd9d5('0x0'));var passport=require(_0xd9d5('0x1'));var router=express['Router']();var controller=require(_0xd9d5('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xd9d5('0x3'));router[_0xd9d5('0x4')]('/',controller[_0xd9d5('0x5')]);router['get']('/callback',controller['callback'],authService[_0xd9d5('0x6')],userController[_0xd9d5('0x5')],authService[_0xd9d5('0x7')]);module[_0xd9d5('0x8')]=router; \ No newline at end of file +var _0x80ea=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x1ec25a,_0x4e81ca){var _0x55855f=function(_0x3b7aba){while(--_0x3b7aba){_0x1ec25a['push'](_0x1ec25a['shift']());}};_0x55855f(++_0x4e81ca);}(_0x80ea,0x15c));var _0xa80e=function(_0x59734a,_0x40a9b4){_0x59734a=_0x59734a-0x0;var _0xc5bdb4=_0x80ea[_0x59734a];return _0xc5bdb4;};'use strict';var express=require(_0xa80e('0x0'));var passport=require(_0xa80e('0x1'));var router=express[_0xa80e('0x2')]();var controller=require(_0xa80e('0x3'));var userController=require(_0xa80e('0x4'));var authService=require(_0xa80e('0x5'));router[_0xa80e('0x6')]('/',controller[_0xa80e('0x7')]);router[_0xa80e('0x6')](_0xa80e('0x8'),controller[_0xa80e('0x9')],authService[_0xa80e('0xa')],userController[_0xa80e('0x7')],authService[_0xa80e('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 787edd2..0a1f6a7 100644 --- a/server/api/authLocal/authLocal.controller.js +++ b/server/api/authLocal/authLocal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94e1=['body','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','allowedLoginAttempts','blockDuration','findOne','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','then','add','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','status','send','local-login','signToken','forgot','generate'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x94e1,0x1e1));var _0x194e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x94e1[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x194e('0x0'));var passport=require(_0x194e('0x1'));var LocalStrategy=require(_0x194e('0x2'))[_0x194e('0x3')];var jayson=require(_0x194e('0x4'));var _=require(_0x194e('0x5'));var rs=require(_0x194e('0x6'));var moment=require(_0x194e('0x7'));var db=require(_0x194e('0x8'))['db'];var authService=require(_0x194e('0x9'));var utils=require('../../config/utils');var client=jayson[_0x194e('0xa')]['http']({'port':0x232b});function localAuthenticate(_0xebafa0,_0x118a27,_0x51c941,_0x3d99cd){var _0x56007b,_0x3c065a;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x194e('0xb'),_0x194e('0xc')],'raw':!![]})['then'](function(_0x1d647b){_0x56007b=_0x1d647b;return _0xebafa0[_0x194e('0xd')]({'attributes':['id',_0x194e('0xe'),_0x194e('0xf'),'salt',_0x194e('0x10'),_0x194e('0x11'),_0x194e('0x12'),_0x194e('0x13'),_0x194e('0x14')],'where':{'name':_0x118a27,'role':{'$or':[_0x194e('0x15'),_0x194e('0x16'),'agent']}}});})['then'](function(_0xcb40f4){if(!_0xcb40f4||_0xcb40f4&&_0xcb40f4[_0x194e('0xe')]!==_0x118a27){throw new Error(_0x194e('0x17'));}else{_0x3c065a=_0xcb40f4;return _0x3c065a;}})['then'](function(){_0x3c065a[_0x194e('0x18')](_0x51c941,function(_0x5adcf8,_0x2f26a1){var _0x131b15=_0x3c065a[_0x194e('0x14')]+0x1;if(_0x5adcf8){return _0x3d99cd(_0x5adcf8);}else if(!_0x2f26a1){if(_0x3c065a[_0x194e('0x11')]){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}else if(_0x56007b[_0x194e('0xb')]>0x0){if(_0x3c065a[_0x194e('0x12')]){if(_0x56007b[_0x194e('0xc')]>0x0){if(moment(_0x3c065a[_0x194e('0x13')])['add'](_0x56007b['blockDuration'],_0x194e('0x19'))>moment()){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}else{return utils[_0x194e('0x1a')](_0x3c065a,_0x131b15,![],null)['then'](function(){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});});}}else{return _0x3d99cd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x131b15>=_0x56007b[_0x194e('0xb')]){return utils[_0x194e('0x1a')](_0x3c065a,0x0,!![],moment())[_0x194e('0x1b')](function(){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});});}else{return utils[_0x194e('0x1a')](_0x3c065a,_0x131b15,![],null)[_0x194e('0x1b')](function(){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});});}}}else{return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}}else{if(_0x3c065a[_0x194e('0x11')]){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}else if(_0x56007b[_0x194e('0xb')]>0x0){if(_0x3c065a[_0x194e('0x12')]){if(_0x56007b[_0x194e('0xc')]>0x0){if(moment(_0x3c065a[_0x194e('0x13')])[_0x194e('0x1c')](_0x56007b['blockDuration'],'minutes')>moment()){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}else{return utils[_0x194e('0x1a')](_0x3c065a,0x0,![],null)[_0x194e('0x1b')](function(){return utils[_0x194e('0x1d')](_0x3c065a);})['then'](function(){return _0x3d99cd(null,_0x3c065a);});}}else{return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}}else{return utils['clearBlockUser'](_0x3c065a,0x0,![],null)[_0x194e('0x1b')](function(){return utils[_0x194e('0x1d')](_0x3c065a);})['then'](function(){return _0x3d99cd(null,_0x3c065a);})[_0x194e('0x1e')](function(_0x30fae9){return _0x3d99cd(null,![],_0x30fae9);});}}else{if(_0x3c065a[_0x194e('0x12')]){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}else{return utils[_0x194e('0x1d')](_0x3c065a)[_0x194e('0x1b')](function(){return _0x3d99cd(null,_0x3c065a);});}}}});})[_0x194e('0x1e')](function(_0x271c23){return _0x3d99cd(null,![],_0x271c23);});}function sendServiceMail(_0x250a37){return db['MailAccount'][_0x194e('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x194e('0xe'),_0x194e('0x20')],'include':[{'model':db[_0x194e('0x21')],'as':_0x194e('0x22'),'include':[{'model':db[_0x194e('0x23')],'as':'CloudProvider'}]}]})[_0x194e('0x1b')](function(_0x1871f5){if(!_0x1871f5){throw new Error(_0x194e('0x24'));}var _0x14c06c=_0x1871f5[_0x194e('0x25')]();var _0x572753={'account':_0x14c06c,'message':_['merge']({'from':util[_0x194e('0x26')](_0x194e('0x27'),_0x1871f5[_0x194e('0xe')],_0x1871f5[_0x194e('0x20')]||_0x1871f5[_0x194e('0x22')][_0x194e('0x16')])},_0x250a37)};return client[_0x194e('0x28')](_0x194e('0x29'),_0x572753);})[_0x194e('0x1b')](function(_0x1b4a09){if(_0x1b4a09['error']){throw new Error(util[_0x194e('0x26')](_0x194e('0x2a'),_0x1b4a09[_0x194e('0x2b')][_0x194e('0x2c')]||JSON['stringify'](_0x1b4a09['error'])));}return!![];});}function handleError(_0x2e10f5,_0x3a1c49,_0x3c4e79){return _0x2e10f5[_0x194e('0x2d')](_0x3a1c49||0x1f4)[_0x194e('0x2e')]({'message':_0x3c4e79?_0x3c4e79['message']||_0x3c4e79:''});}exports['login']=function(_0x4d50b3,_0x4cca9b,_0x25add5){passport[_0x194e('0x18')](_0x194e('0x2f'),function(_0x2e69d5,_0x590292,_0x25d138){var _0x1565de=_0x2e69d5||_0x25d138;if(_0x1565de){return handleError(_0x4cca9b,0x191,_0x1565de);}if(!_0x590292){return handleError(_0x4cca9b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x117a1b={'payload':{'id':_0x590292['id'],'role':_0x590292[_0x194e('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x194e('0x30')](_0x117a1b)[_0x194e('0x1b')](function(_0xc3c53e){_0x4cca9b['json']({'id':_0x590292['id'],'token':_0xc3c53e,'statusCall':'','isAlreadyLogged':_0x590292['online']});});}})(_0x4d50b3,_0x4cca9b,_0x25add5);};exports[_0x194e('0x31')]=function(_0x30c2a9,_0x2c54b5){if(!_0x30c2a9['body'][_0x194e('0x20')]){return handleError(_0x2c54b5,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x1abdf9=rs[_0x194e('0x32')]();_0x30c2a9['body'][_0x194e('0x20')]=_0x30c2a9[_0x194e('0x33')][_0x194e('0x20')]['trim']()[_0x194e('0x34')]();var _0x3f2e26;return db[_0x194e('0x35')][_0x194e('0xd')]({'where':{'id':0x1},'attributes':[_0x194e('0xb'),_0x194e('0xc')],'raw':!![]})[_0x194e('0x1b')](function(_0x5ad9ba){_0x3f2e26=_0x5ad9ba;return db[_0x194e('0x36')][_0x194e('0x1f')]({'where':{'email':_0x30c2a9[_0x194e('0x33')][_0x194e('0x20')]}});})[_0x194e('0x1b')](function(_0x33b01b){if(!_0x33b01b){throw new Error(_0x194e('0x37'));}if(_0x33b01b[_0x194e('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x33b01b['blocked']){if(moment(_0x33b01b[_0x194e('0x13')])['add'](_0x3f2e26['blockDuration'],_0x194e('0x19'))>moment()){throw new Error(_0x194e('0x38'));}else{_0x33b01b[_0x194e('0x12')]=![];_0x33b01b['blockedAt']=null;}}_0x33b01b['resetPasswordToken']=_0x1abdf9;_0x33b01b[_0x194e('0x39')]=Date[_0x194e('0x3a')]()+0x36ee80;return _0x33b01b[_0x194e('0x3b')]();})[_0x194e('0x1b')](function(){return sendServiceMail({'to':_0x30c2a9[_0x194e('0x33')][_0x194e('0x20')],'subject':_0x194e('0x3c'),'text':_0x194e('0x3d')+_0x194e('0x3e')+_0x194e('0x3f')+_0x30c2a9['headers']['host']+_0x194e('0x40')+_0x1abdf9+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x194e('0x1b')](function(){_0x2c54b5['status'](0xc8)[_0x194e('0x2e')]({'message':_0x194e('0x41')});})['catch'](function(_0x474dd1){return handleError(_0x2c54b5,0x1f4,_0x474dd1);});};exports['reset']=function(_0x12e97b,_0x526790){return db[_0x194e('0x36')]['find']({'where':{'resetPasswordToken':_0x12e97b[_0x194e('0x42')][_0x194e('0x43')],'resetPasswordExpires':{'$gt':Date[_0x194e('0x3a')]()}}})[_0x194e('0x1b')](function(_0x1aad56){if(!_0x1aad56){throw new Error(_0x194e('0x44'));}return db[_0x194e('0x35')][_0x194e('0xd')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x194e('0x45')]})[_0x194e('0x1b')](function(_0x190443){if(_0x190443[_0x194e('0x46')])authService[_0x194e('0x47')](_0x12e97b[_0x194e('0x33')][_0x194e('0xf')]);if(!_0x190443[_0x194e('0x48')]||!_0x1aad56[_0x194e('0x49')])return _0x1aad56;authService['validatePasswordHistory'](_0x12e97b[_0x194e('0x33')][_0x194e('0xf')],_0x1aad56[_0x194e('0x49')],_0x190443[_0x194e('0x45')]);return _0x1aad56;})['then'](function(){_0x1aad56[_0x194e('0xf')]=_0x12e97b[_0x194e('0x33')][_0x194e('0xf')];_0x1aad56['resetPasswordToken']=null;_0x1aad56['resetPasswordExpires']=null;return _0x1aad56[_0x194e('0x3b')]();});})['then'](function(){_0x526790[_0x194e('0x2d')](0xc8)[_0x194e('0x2e')]({'message':_0x194e('0x4a')});})[_0x194e('0x1e')](function(_0x369310){return handleError(_0x526790,0x1f4,_0x369310);});};passport[_0x194e('0x4b')](_0x194e('0x2f'),new LocalStrategy({'usernameField':_0x194e('0xe'),'passwordField':_0x194e('0xf')},function(_0x57b09c,_0x7c3dd0,_0x1ae8a0){return localAuthenticate(db['User'],_0x57b09c,_0x7c3dd0,_0x1ae8a0);})); \ No newline at end of file +var _0x9a44=['now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','password','save','status','Password\x20reset!','use','local-login','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','salt','role','disabled','blocked','loginAttempts','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','getLicense','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','send','login','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires'];(function(_0x3e3780,_0x4b826e){var _0x338739=function(_0x80cd87){while(--_0x80cd87){_0x3e3780['push'](_0x3e3780['shift']());}};_0x338739(++_0x4b826e);}(_0x9a44,0x106));var _0x49a4=function(_0x32bbf1,_0x56976f){_0x32bbf1=_0x32bbf1-0x0;var _0x57c25b=_0x9a44[_0x32bbf1];return _0x57c25b;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x49a4('0x0'))[_0x49a4('0x1')];var jayson=require(_0x49a4('0x2'));var _=require('lodash');var rs=require(_0x49a4('0x3'));var moment=require(_0x49a4('0x4'));var db=require(_0x49a4('0x5'))['db'];var authService=require(_0x49a4('0x6'));var utils=require(_0x49a4('0x7'));var client=jayson[_0x49a4('0x8')][_0x49a4('0x9')]({'port':0x232b});function localAuthenticate(_0x11842c,_0x452566,_0x40e3c9,_0x3b5d8a){var _0x3c24d4,_0x3aeb3d;return db[_0x49a4('0xa')][_0x49a4('0xb')]({'where':{'id':0x1},'attributes':[_0x49a4('0xc'),_0x49a4('0xd')],'raw':!![]})['then'](function(_0xbb51a5){_0x3c24d4=_0xbb51a5;return _0x11842c[_0x49a4('0xb')]({'attributes':['id',_0x49a4('0xe'),'password',_0x49a4('0xf'),_0x49a4('0x10'),_0x49a4('0x11'),_0x49a4('0x12'),'blockedAt',_0x49a4('0x13')],'where':{'name':_0x452566,'role':{'$or':['admin',_0x49a4('0x14'),_0x49a4('0x15')]}}});})[_0x49a4('0x16')](function(_0x169785){if(!_0x169785||_0x169785&&_0x169785[_0x49a4('0xe')]!==_0x452566){throw new Error(_0x49a4('0x17'));}else{_0x3aeb3d=_0x169785;return _0x3aeb3d;}})['then'](function(){_0x3aeb3d[_0x49a4('0x18')](_0x40e3c9,function(_0x36787c,_0x2422df){var _0x54d47e=_0x3aeb3d[_0x49a4('0x13')]+0x1;if(_0x36787c){return _0x3b5d8a(_0x36787c);}else if(!_0x2422df){if(_0x3aeb3d[_0x49a4('0x11')]){return _0x3b5d8a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3c24d4[_0x49a4('0xc')]>0x0){if(_0x3aeb3d[_0x49a4('0x12')]){if(_0x3c24d4[_0x49a4('0xd')]>0x0){if(moment(_0x3aeb3d[_0x49a4('0x19')])[_0x49a4('0x1a')](_0x3c24d4[_0x49a4('0xd')],_0x49a4('0x1b'))>moment()){return _0x3b5d8a(null,![],{'message':_0x49a4('0x17')});}else{return utils[_0x49a4('0x1c')](_0x3aeb3d,_0x54d47e,![],null)[_0x49a4('0x16')](function(){return _0x3b5d8a(null,![],{'message':_0x49a4('0x17')});});}}else{return _0x3b5d8a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x54d47e>=_0x3c24d4[_0x49a4('0xc')]){return utils[_0x49a4('0x1c')](_0x3aeb3d,0x0,!![],moment())['then'](function(){return _0x3b5d8a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x49a4('0x1c')](_0x3aeb3d,_0x54d47e,![],null)['then'](function(){return _0x3b5d8a(null,![],{'message':_0x49a4('0x17')});});}}}else{return _0x3b5d8a(null,![],{'message':_0x49a4('0x17')});}}else{if(_0x3aeb3d['disabled']){return _0x3b5d8a(null,![],{'message':_0x49a4('0x17')});}else if(_0x3c24d4[_0x49a4('0xc')]>0x0){if(_0x3aeb3d[_0x49a4('0x12')]){if(_0x3c24d4['blockDuration']>0x0){if(moment(_0x3aeb3d[_0x49a4('0x19')])[_0x49a4('0x1a')](_0x3c24d4[_0x49a4('0xd')],_0x49a4('0x1b'))>moment()){return _0x3b5d8a(null,![],{'message':_0x49a4('0x17')});}else{return utils[_0x49a4('0x1c')](_0x3aeb3d,0x0,![],null)[_0x49a4('0x16')](function(){return utils[_0x49a4('0x1d')](_0x3aeb3d);})[_0x49a4('0x16')](function(){return _0x3b5d8a(null,_0x3aeb3d);});}}else{return _0x3b5d8a(null,![],{'message':_0x49a4('0x17')});}}else{return utils[_0x49a4('0x1c')](_0x3aeb3d,0x0,![],null)['then'](function(){return utils[_0x49a4('0x1d')](_0x3aeb3d);})[_0x49a4('0x16')](function(){return _0x3b5d8a(null,_0x3aeb3d);})['catch'](function(_0x3e7224){return _0x3b5d8a(null,![],_0x3e7224);});}}else{if(_0x3aeb3d[_0x49a4('0x12')]){return _0x3b5d8a(null,![],{'message':_0x49a4('0x17')});}else{return utils['getLicense'](_0x3aeb3d)[_0x49a4('0x16')](function(){return _0x3b5d8a(null,_0x3aeb3d);});}}}});})['catch'](function(_0xa61fbc){return _0x3b5d8a(null,![],_0xa61fbc);});}function sendServiceMail(_0x3116a4){return db[_0x49a4('0x1e')][_0x49a4('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x49a4('0xe'),_0x49a4('0x20')],'include':[{'model':db[_0x49a4('0x21')],'as':_0x49a4('0x22'),'include':[{'model':db[_0x49a4('0x23')],'as':_0x49a4('0x23')}]}]})[_0x49a4('0x16')](function(_0x4200b1){if(!_0x4200b1){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1d51ef=_0x4200b1[_0x49a4('0x24')]();var _0x2bd4ff={'account':_0x1d51ef,'message':_['merge']({'from':util[_0x49a4('0x25')](_0x49a4('0x26'),_0x4200b1['name'],_0x4200b1[_0x49a4('0x20')]||_0x4200b1[_0x49a4('0x22')]['user'])},_0x3116a4)};return client[_0x49a4('0x27')](_0x49a4('0x28'),_0x2bd4ff);})[_0x49a4('0x16')](function(_0x6caf7e){if(_0x6caf7e['error']){throw new Error(util[_0x49a4('0x25')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x6caf7e[_0x49a4('0x29')][_0x49a4('0x2a')]||JSON[_0x49a4('0x2b')](_0x6caf7e[_0x49a4('0x29')])));}return!![];});}function handleError(_0x1d6366,_0x152fec,_0x12246b){return _0x1d6366['status'](_0x152fec||0x1f4)[_0x49a4('0x2c')]({'message':_0x12246b?_0x12246b['message']||_0x12246b:''});}exports[_0x49a4('0x2d')]=function(_0x2122ee,_0x2f8c5b,_0x5753b4){passport[_0x49a4('0x18')]('local-login',function(_0x19faaf,_0xc5f366,_0x305886){var _0x480a4=_0x19faaf||_0x305886;if(_0x480a4){return handleError(_0x2f8c5b,0x191,_0x480a4);}if(!_0xc5f366){return handleError(_0x2f8c5b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3a219d={'payload':{'id':_0xc5f366['id'],'role':_0xc5f366[_0x49a4('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x49a4('0x2e')](_0x3a219d)['then'](function(_0x2b8a88){_0x2f8c5b['json']({'id':_0xc5f366['id'],'token':_0x2b8a88,'statusCall':'','isAlreadyLogged':_0xc5f366[_0x49a4('0x2f')]});});}})(_0x2122ee,_0x2f8c5b,_0x5753b4);};exports[_0x49a4('0x30')]=function(_0x82646b,_0x1ac5a1){if(!_0x82646b[_0x49a4('0x31')][_0x49a4('0x20')]){return handleError(_0x1ac5a1,0x1f4,{'message':_0x49a4('0x32')});}var _0x3c5c88=rs[_0x49a4('0x33')]();_0x82646b[_0x49a4('0x31')][_0x49a4('0x20')]=_0x82646b['body'][_0x49a4('0x20')][_0x49a4('0x34')]()[_0x49a4('0x35')]();var _0x2d4292;return db[_0x49a4('0xa')][_0x49a4('0xb')]({'where':{'id':0x1},'attributes':[_0x49a4('0xc'),_0x49a4('0xd')],'raw':!![]})['then'](function(_0x3cf8e4){_0x2d4292=_0x3cf8e4;return db[_0x49a4('0x36')][_0x49a4('0x1f')]({'where':{'email':_0x82646b[_0x49a4('0x31')][_0x49a4('0x20')]}});})[_0x49a4('0x16')](function(_0x4f2616){if(!_0x4f2616){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x4f2616[_0x49a4('0x11')]){throw new Error(_0x49a4('0x37'));}if(_0x4f2616[_0x49a4('0x12')]){if(moment(_0x4f2616['blockedAt'])[_0x49a4('0x1a')](_0x2d4292[_0x49a4('0xd')],_0x49a4('0x1b'))>moment()){throw new Error(_0x49a4('0x38'));}else{_0x4f2616[_0x49a4('0x12')]=![];_0x4f2616['blockedAt']=null;}}_0x4f2616['resetPasswordToken']=_0x3c5c88;_0x4f2616[_0x49a4('0x39')]=Date[_0x49a4('0x3a')]()+0x36ee80;return _0x4f2616['save']();})['then'](function(){return sendServiceMail({'to':_0x82646b[_0x49a4('0x31')][_0x49a4('0x20')],'subject':_0x49a4('0x3b'),'text':_0x49a4('0x3c')+_0x49a4('0x3d')+_0x49a4('0x3e')+_0x82646b['headers'][_0x49a4('0x3f')]+_0x49a4('0x40')+_0x3c5c88+'\x0a\x0a'+_0x49a4('0x41')});})[_0x49a4('0x16')](function(){_0x1ac5a1['status'](0xc8)[_0x49a4('0x2c')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x33e910){return handleError(_0x1ac5a1,0x1f4,_0x33e910);});};exports['reset']=function(_0x102c0b,_0x2bdb50){return db[_0x49a4('0x36')][_0x49a4('0x1f')]({'where':{'resetPasswordToken':_0x102c0b[_0x49a4('0x42')][_0x49a4('0x43')],'resetPasswordExpires':{'$gt':Date[_0x49a4('0x3a')]()}}})['then'](function(_0x50ae3a){if(!_0x50ae3a){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x49a4('0xa')][_0x49a4('0xb')]({'attributes':['id',_0x49a4('0x44'),_0x49a4('0x45'),_0x49a4('0x46')]})[_0x49a4('0x16')](function(_0x3344e0){if(_0x3344e0[_0x49a4('0x44')])authService[_0x49a4('0x47')](_0x102c0b[_0x49a4('0x31')]['password']);if(!_0x3344e0[_0x49a4('0x45')]||!_0x50ae3a[_0x49a4('0x48')])return _0x50ae3a;authService[_0x49a4('0x49')](_0x102c0b[_0x49a4('0x31')][_0x49a4('0x4a')],_0x50ae3a[_0x49a4('0x48')],_0x3344e0[_0x49a4('0x46')]);return _0x50ae3a;})[_0x49a4('0x16')](function(){_0x50ae3a[_0x49a4('0x4a')]=_0x102c0b[_0x49a4('0x31')][_0x49a4('0x4a')];_0x50ae3a['resetPasswordToken']=null;_0x50ae3a[_0x49a4('0x39')]=null;return _0x50ae3a[_0x49a4('0x4b')]();});})['then'](function(){_0x2bdb50[_0x49a4('0x4c')](0xc8)[_0x49a4('0x2c')]({'message':_0x49a4('0x4d')});})['catch'](function(_0x19b11f){return handleError(_0x2bdb50,0x1f4,_0x19b11f);});};passport[_0x49a4('0x4e')](_0x49a4('0x4f'),new LocalStrategy({'usernameField':'name','passwordField':_0x49a4('0x4a')},function(_0x5dac02,_0x29c6bd,_0x1d83cc){return localAuthenticate(db['User'],_0x5dac02,_0x29c6bd,_0x1d83cc);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 93efb4b..46dca26 100644 --- a/server/api/authLocal/index.js +++ b/server/api/authLocal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd335=['/reset/:token','exports','express','Router','login','post','/forgot','forgot'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0xd335,0x19a));var _0x5d33=function(_0x229b9e,_0x4e863a){_0x229b9e=_0x229b9e-0x0;var _0x3ae42d=_0xd335[_0x229b9e];return _0x3ae42d;};'use strict';var express=require(_0x5d33('0x0'));var router=express[_0x5d33('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0x5d33('0x2')]);router[_0x5d33('0x3')](_0x5d33('0x4'),controller[_0x5d33('0x5')]);router[_0x5d33('0x3')](_0x5d33('0x6'),controller['reset']);module[_0x5d33('0x7')]=router; \ No newline at end of file +var _0x8ff5=['Router','./authLocal.controller','post','/forgot','/reset/:token','reset','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ff5,0xd1));var _0x58ff=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8ff5[_0x5d6456];return _0x4d66c1;};'use strict';var express=require(_0x58ff('0x0'));var router=express[_0x58ff('0x1')]();var controller=require(_0x58ff('0x2'));router[_0x58ff('0x3')]('/',controller['login']);router[_0x58ff('0x3')](_0x58ff('0x4'),controller['forgot']);router['post'](_0x58ff('0x5'),controller[_0x58ff('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 34246f7..03dbb26 100644 --- a/server/api/automation/automation.attributes.js +++ b/server/api/automation/automation.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x062a=['INTEGER','STRING'];(function(_0x3fd7ab,_0x3dd0bc){var _0x56cb4b=function(_0x2cd862){while(--_0x2cd862){_0x3fd7ab['push'](_0x3fd7ab['shift']());}};_0x56cb4b(++_0x3dd0bc);}(_0x062a,0x16b));var _0xa062=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x062a[_0x1ed116];return _0x574066;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa062('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xa062('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa062('0x1')],'defaultValue':0xa}}; \ No newline at end of file +var _0x8b80=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x44a895,_0x4d65a2){var _0x591a86=function(_0x2468b8){while(--_0x2468b8){_0x44a895['push'](_0x44a895['shift']());}};_0x591a86(++_0x4d65a2);}(_0x8b80,0x73));var _0x08b8=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0x8b80[_0x307bf6];return _0x2878fc;};'use strict';var Sequelize=require(_0x08b8('0x0'));module[_0x08b8('0x1')]={'name':{'type':Sequelize[_0x08b8('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x08b8('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x08b8('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x08b8('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index cdcd911..211b836 100644 --- a/server/api/automation/automation.controller.js +++ b/server/api/automation/automation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe545=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','keys','intersection','query','attributes','fields','model','nolimit','order','sort','where','pick','filters','merge','options','count','includeAll','include','findAll','catch','params','length','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','filter','hasOwnProperty','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe545,0x17f));var _0x5e54=function(_0x3e3ba7,_0x531288){_0x3e3ba7=_0x3e3ba7-0x0;var _0x2f6d9d=_0xe545[_0x3e3ba7];return _0x2f6d9d;};'use strict';var emlformat=require(_0x5e54('0x0'));var rimraf=require(_0x5e54('0x1'));var zipdir=require(_0x5e54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e54('0x3'));var moment=require(_0x5e54('0x4'));var BPromise=require(_0x5e54('0x5'));var Mustache=require(_0x5e54('0x6'));var util=require(_0x5e54('0x7'));var path=require('path');var sox=require(_0x5e54('0x8'));var csv=require('to-csv');var ejs=require(_0x5e54('0x9'));var fs=require('fs');var fs_extra=require(_0x5e54('0xa'));var _=require('lodash');var squel=require(_0x5e54('0xb'));var crypto=require(_0x5e54('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5e54('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5e54('0xe'));var Papa=require(_0x5e54('0xf'));var Redis=require(_0x5e54('0x10'));var authService=require(_0x5e54('0x11'));var qs=require(_0x5e54('0x12'));var as=require(_0x5e54('0x13'));var hardwareService=require(_0x5e54('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5e54('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dc37a,_0x1acb17){_0x1acb17=_0x1acb17||0xcc;return function(_0x3dee05){if(_0x3dee05){return _0x1dc37a[_0x5e54('0x16')](_0x1acb17);}return _0x1dc37a[_0x5e54('0x17')](_0x1acb17)[_0x5e54('0x18')]();};}function respondWithResult(_0x1053e1,_0x4cba04){_0x4cba04=_0x4cba04||0xc8;return function(_0x1bfaa5){if(_0x1bfaa5){return _0x1053e1[_0x5e54('0x17')](_0x4cba04)['json'](_0x1bfaa5);}};}function respondWithFilteredResult(_0x2c1a3b,_0x31dc8c){return function(_0x538336){if(_0x538336){var _0x29ee90=typeof _0x31dc8c[_0x5e54('0x19')]===_0x5e54('0x1a')&&typeof _0x31dc8c['limit']==='undefined';var _0x1af620=_0x538336['count'];var _0x35d1b5=_0x29ee90?0x0:_0x31dc8c[_0x5e54('0x19')];var _0x4b5625=_0x29ee90?_0x538336['count']:_0x31dc8c[_0x5e54('0x19')]+_0x31dc8c[_0x5e54('0x1b')];var _0x4fa4f3;if(_0x4b5625>=_0x1af620){_0x4b5625=_0x1af620;_0x4fa4f3=0xc8;}else{_0x4fa4f3=0xce;}_0x2c1a3b['status'](_0x4fa4f3);return _0x2c1a3b['set'](_0x5e54('0x1c'),_0x35d1b5+'-'+_0x4b5625+'/'+_0x1af620)[_0x5e54('0x1d')](_0x538336);}return null;};}function patchUpdates(_0x1b7d06){return function(_0x438fdf){try{jsonpatch[_0x5e54('0x1e')](_0x438fdf,_0x1b7d06,!![]);}catch(_0x5a6967){return BPromise[_0x5e54('0x1f')](_0x5a6967);}return _0x438fdf['save']();};}function saveUpdates(_0x506afe,_0x4f0b65){return function(_0x3b0772){if(_0x3b0772){return _0x3b0772[_0x5e54('0x20')](_0x506afe)[_0x5e54('0x21')](function(_0x3f9c62){return _0x3f9c62;});}return null;};}function removeEntity(_0x4e1ed7,_0x353570){return function(_0x444c9c){if(_0x444c9c){return _0x444c9c[_0x5e54('0x22')]()[_0x5e54('0x21')](function(){_0x4e1ed7[_0x5e54('0x17')](0xcc)[_0x5e54('0x18')]();});}};}function handleEntityNotFound(_0x441f25,_0x10a9f6){return function(_0x15c738){if(!_0x15c738){_0x441f25[_0x5e54('0x16')](0x194);}return _0x15c738;};}function handleError(_0x555716,_0x27b073){_0x27b073=_0x27b073||0x1f4;return function(_0x46a02f){logger[_0x5e54('0x23')](_0x46a02f[_0x5e54('0x24')]);if(_0x46a02f['name']){delete _0x46a02f[_0x5e54('0x25')];}_0x555716['status'](_0x27b073)[_0x5e54('0x26')](_0x46a02f);};}exports[_0x5e54('0x27')]=function(_0x284ed8,_0x4ee581){var _0x1ab497={},_0x2bb8e2={},_0x5b303d={'count':0x0,'rows':[]};var _0x2d28c0=_[_0x5e54('0x28')](db[_0x5e54('0x29')][_0x5e54('0x2a')],function(_0x17bb90){return{'name':_0x17bb90[_0x5e54('0x2b')],'type':_0x17bb90[_0x5e54('0x2c')]['key']};});_0x2bb8e2['model']=_['map'](_0x2d28c0,_0x5e54('0x25'));_0x2bb8e2['query']=_[_0x5e54('0x2d')](_0x284ed8['query']);_0x2bb8e2['filters']=_[_0x5e54('0x2e')](_0x2bb8e2['model'],_0x2bb8e2[_0x5e54('0x2f')]);_0x1ab497[_0x5e54('0x30')]=_['intersection'](_0x2bb8e2['model'],qs[_0x5e54('0x31')](_0x284ed8['query'][_0x5e54('0x31')]));_0x1ab497[_0x5e54('0x30')]=_0x1ab497[_0x5e54('0x30')]['length']?_0x1ab497[_0x5e54('0x30')]:_0x2bb8e2[_0x5e54('0x32')];if(!_0x284ed8[_0x5e54('0x2f')]['hasOwnProperty'](_0x5e54('0x33'))){_0x1ab497[_0x5e54('0x1b')]=qs[_0x5e54('0x1b')](_0x284ed8['query']['limit']);_0x1ab497[_0x5e54('0x19')]=qs[_0x5e54('0x19')](_0x284ed8[_0x5e54('0x2f')][_0x5e54('0x19')]);}_0x1ab497[_0x5e54('0x34')]=qs['sort'](_0x284ed8['query'][_0x5e54('0x35')]);_0x1ab497[_0x5e54('0x36')]=qs['filters'](_[_0x5e54('0x37')](_0x284ed8[_0x5e54('0x2f')],_0x2bb8e2[_0x5e54('0x38')]),_0x2d28c0);if(_0x284ed8['query']['filter']){_0x1ab497[_0x5e54('0x36')]=_[_0x5e54('0x39')](_0x1ab497[_0x5e54('0x36')],{'$or':_[_0x5e54('0x28')](_0x2d28c0,function(_0x5e49d8){if(_0x5e49d8['type']!=='VIRTUAL'){var _0x2e9752={};_0x2e9752[_0x5e49d8[_0x5e54('0x25')]]={'$like':'%'+_0x284ed8[_0x5e54('0x2f')]['filter']+'%'};return _0x2e9752;}})});}_0x1ab497=_['merge']({},_0x1ab497,_0x284ed8[_0x5e54('0x3a')]);var _0x1173cd={'where':_0x1ab497['where']};return db[_0x5e54('0x29')][_0x5e54('0x3b')](_0x1173cd)[_0x5e54('0x21')](function(_0x218c11){_0x5b303d[_0x5e54('0x3b')]=_0x218c11;if(_0x284ed8[_0x5e54('0x2f')][_0x5e54('0x3c')]){_0x1ab497[_0x5e54('0x3d')]=[{'all':!![]}];}return db[_0x5e54('0x29')][_0x5e54('0x3e')](_0x1ab497);})[_0x5e54('0x21')](function(_0x523487){_0x5b303d['rows']=_0x523487;return _0x5b303d;})[_0x5e54('0x21')](respondWithFilteredResult(_0x4ee581,_0x1ab497))[_0x5e54('0x3f')](handleError(_0x4ee581,null));};exports['show']=function(_0x55aa73,_0x3a89fc){var _0x22f4a5={'raw':![],'where':{'id':_0x55aa73[_0x5e54('0x40')]['id']}},_0x7a288b={};_0x7a288b[_0x5e54('0x32')]=_[_0x5e54('0x2d')](db[_0x5e54('0x29')][_0x5e54('0x2a')]);_0x7a288b[_0x5e54('0x2f')]=_[_0x5e54('0x2d')](_0x55aa73[_0x5e54('0x2f')]);_0x7a288b[_0x5e54('0x38')]=_[_0x5e54('0x2e')](_0x7a288b[_0x5e54('0x32')],_0x7a288b[_0x5e54('0x2f')]);_0x22f4a5[_0x5e54('0x30')]=_[_0x5e54('0x2e')](_0x7a288b[_0x5e54('0x32')],qs[_0x5e54('0x31')](_0x55aa73[_0x5e54('0x2f')]['fields']));_0x22f4a5[_0x5e54('0x30')]=_0x22f4a5[_0x5e54('0x30')][_0x5e54('0x41')]?_0x22f4a5['attributes']:_0x7a288b['model'];if(_0x55aa73[_0x5e54('0x2f')][_0x5e54('0x3c')]){_0x22f4a5[_0x5e54('0x3d')]=[{'all':!![]}];}_0x22f4a5=_[_0x5e54('0x39')]({},_0x22f4a5,_0x55aa73[_0x5e54('0x3a')]);return db[_0x5e54('0x29')][_0x5e54('0x42')](_0x22f4a5)['then'](handleEntityNotFound(_0x3a89fc,null))[_0x5e54('0x21')](respondWithResult(_0x3a89fc,null))['catch'](handleError(_0x3a89fc,null));};exports[_0x5e54('0x43')]=function(_0xa70f22,_0x40412c){return db[_0x5e54('0x29')][_0x5e54('0x43')](_0xa70f22[_0x5e54('0x44')],{})['then'](respondWithResult(_0x40412c,0xc9))[_0x5e54('0x3f')](handleError(_0x40412c,null));};exports[_0x5e54('0x20')]=function(_0x4312b2,_0x54cdd1){if(_0x4312b2[_0x5e54('0x44')]['id']){delete _0x4312b2[_0x5e54('0x44')]['id'];}return db['Automation']['find']({'where':{'id':_0x4312b2['params']['id']}})[_0x5e54('0x21')](handleEntityNotFound(_0x54cdd1,null))[_0x5e54('0x21')](saveUpdates(_0x4312b2[_0x5e54('0x44')],null))[_0x5e54('0x21')](respondWithResult(_0x54cdd1,null))['catch'](handleError(_0x54cdd1,null));};exports[_0x5e54('0x22')]=function(_0x41d468,_0x558891){return db[_0x5e54('0x29')]['find']({'where':{'id':_0x41d468[_0x5e54('0x40')]['id']}})[_0x5e54('0x21')](handleEntityNotFound(_0x558891,null))['then'](removeEntity(_0x558891,null))[_0x5e54('0x3f')](handleError(_0x558891,null));};exports[_0x5e54('0x45')]=function(_0x78cbc2,_0x5cb661,_0xebdee1){return db[_0x5e54('0x46')]['find']({'where':{'id':_0x78cbc2[_0x5e54('0x40')]['id']}})[_0x5e54('0x21')](handleEntityNotFound(_0x5cb661,null))[_0x5e54('0x21')](function(_0x4633bf){if(_0x4633bf){return _0x4633bf[_0x5e54('0x45')](_0x78cbc2[_0x5e54('0x44')][_0x5e54('0x47')],_[_0x5e54('0x48')](_0x78cbc2[_0x5e54('0x44')],[_0x5e54('0x47'),'id'])||{});}})[_0x5e54('0x21')](respondWithResult(_0x5cb661,null))['catch'](handleError(_0x5cb661,null));};exports[_0x5e54('0x49')]=function(_0x327216,_0x28c193,_0x108224){var _0x12ad30={};var _0x7547b2={};var _0x29d410;var _0x154537;return db[_0x5e54('0x29')][_0x5e54('0x4a')]({'where':{'id':_0x327216[_0x5e54('0x40')]['id']}})['then'](handleEntityNotFound(_0x28c193,null))['then'](function(_0x2e0fe7){if(_0x2e0fe7){_0x29d410=_0x2e0fe7;_0x7547b2[_0x5e54('0x32')]=_[_0x5e54('0x2d')](db[_0x5e54('0x46')][_0x5e54('0x2a')]);_0x7547b2[_0x5e54('0x2f')]=_['keys'](_0x327216[_0x5e54('0x2f')]);_0x7547b2['filters']=_[_0x5e54('0x2e')](_0x7547b2['model'],_0x7547b2['query']);_0x12ad30[_0x5e54('0x30')]=_['intersection'](_0x7547b2['model'],qs[_0x5e54('0x31')](_0x327216[_0x5e54('0x2f')][_0x5e54('0x31')]));_0x12ad30[_0x5e54('0x30')]=_0x12ad30[_0x5e54('0x30')]['length']?_0x12ad30[_0x5e54('0x30')]:_0x7547b2[_0x5e54('0x32')];_0x12ad30[_0x5e54('0x34')]=qs[_0x5e54('0x35')](_0x327216[_0x5e54('0x2f')][_0x5e54('0x35')]);_0x12ad30[_0x5e54('0x36')]=qs['filters'](_[_0x5e54('0x37')](_0x327216['query'],_0x7547b2['filters']));if(_0x327216[_0x5e54('0x2f')][_0x5e54('0x4b')]){_0x12ad30[_0x5e54('0x36')]=_['merge'](_0x12ad30[_0x5e54('0x36')],{'$or':_[_0x5e54('0x28')](_0x12ad30['attributes'],function(_0x1e5192){var _0x2cefb1={};_0x2cefb1[_0x1e5192]={'$like':'%'+_0x327216[_0x5e54('0x2f')]['filter']+'%'};return _0x2cefb1;})});}_0x12ad30=_[_0x5e54('0x39')]({},_0x12ad30,_0x327216[_0x5e54('0x3a')]);return _0x29d410[_0x5e54('0x49')](_0x12ad30);}})[_0x5e54('0x21')](function(_0x1e1eee){if(_0x1e1eee){_0x154537=_0x1e1eee[_0x5e54('0x41')];if(!_0x327216[_0x5e54('0x2f')][_0x5e54('0x4c')](_0x5e54('0x33'))){_0x12ad30[_0x5e54('0x1b')]=qs['limit'](_0x327216[_0x5e54('0x2f')]['limit']);_0x12ad30[_0x5e54('0x19')]=qs[_0x5e54('0x19')](_0x327216[_0x5e54('0x2f')]['offset']);}return _0x29d410[_0x5e54('0x49')](_0x12ad30);}})[_0x5e54('0x21')](function(_0x213898){if(_0x213898){return _0x213898?{'count':_0x154537,'rows':_0x213898}:null;}})['then'](respondWithResult(_0x28c193,null))[_0x5e54('0x3f')](handleError(_0x28c193,null));};exports[_0x5e54('0x4d')]=function(_0x62770f,_0x59796c,_0x80ca22){return db[_0x5e54('0x4e')][_0x5e54('0x42')]({'where':{'id':_0x62770f[_0x5e54('0x40')]['id']}})['then'](handleEntityNotFound(_0x59796c,null))[_0x5e54('0x21')](function(_0x563c05){if(_0x563c05){return _0x563c05[_0x5e54('0x4d')](_0x62770f[_0x5e54('0x44')][_0x5e54('0x47')],_[_0x5e54('0x48')](_0x62770f['body'],[_0x5e54('0x47'),'id'])||{});}})['then'](respondWithResult(_0x59796c,null))[_0x5e54('0x3f')](handleError(_0x59796c,null));};exports[_0x5e54('0x4f')]=function(_0x5c0794,_0x48f8fc,_0x11ef9f){var _0x5170e9={};var _0x18942d={};var _0x331eab;var _0x2b4536;return db[_0x5e54('0x29')][_0x5e54('0x4a')]({'where':{'id':_0x5c0794[_0x5e54('0x40')]['id']}})[_0x5e54('0x21')](handleEntityNotFound(_0x48f8fc,null))[_0x5e54('0x21')](function(_0x2ae7a1){if(_0x2ae7a1){_0x331eab=_0x2ae7a1;_0x18942d[_0x5e54('0x32')]=_[_0x5e54('0x2d')](db['Action'][_0x5e54('0x2a')]);_0x18942d[_0x5e54('0x2f')]=_['keys'](_0x5c0794[_0x5e54('0x2f')]);_0x18942d[_0x5e54('0x38')]=_[_0x5e54('0x2e')](_0x18942d[_0x5e54('0x32')],_0x18942d[_0x5e54('0x2f')]);_0x5170e9['attributes']=_['intersection'](_0x18942d['model'],qs['fields'](_0x5c0794['query']['fields']));_0x5170e9[_0x5e54('0x30')]=_0x5170e9[_0x5e54('0x30')][_0x5e54('0x41')]?_0x5170e9[_0x5e54('0x30')]:_0x18942d[_0x5e54('0x32')];_0x5170e9[_0x5e54('0x34')]=qs[_0x5e54('0x35')](_0x5c0794[_0x5e54('0x2f')][_0x5e54('0x35')]);_0x5170e9[_0x5e54('0x36')]=qs['filters'](_['pick'](_0x5c0794[_0x5e54('0x2f')],_0x18942d[_0x5e54('0x38')]));if(_0x5c0794[_0x5e54('0x2f')][_0x5e54('0x4b')]){_0x5170e9[_0x5e54('0x36')]=_[_0x5e54('0x39')](_0x5170e9[_0x5e54('0x36')],{'$or':_[_0x5e54('0x28')](_0x5170e9['attributes'],function(_0x467847){var _0x1df71f={};_0x1df71f[_0x467847]={'$like':'%'+_0x5c0794['query'][_0x5e54('0x4b')]+'%'};return _0x1df71f;})});}_0x5170e9=_['merge']({},_0x5170e9,_0x5c0794[_0x5e54('0x3a')]);return _0x331eab[_0x5e54('0x4f')](_0x5170e9);}})[_0x5e54('0x21')](function(_0x1d8118){if(_0x1d8118){_0x2b4536=_0x1d8118['length'];if(!_0x5c0794[_0x5e54('0x2f')][_0x5e54('0x4c')](_0x5e54('0x33'))){_0x5170e9[_0x5e54('0x1b')]=qs['limit'](_0x5c0794[_0x5e54('0x2f')]['limit']);_0x5170e9[_0x5e54('0x19')]=qs[_0x5e54('0x19')](_0x5c0794[_0x5e54('0x2f')][_0x5e54('0x19')]);}return _0x331eab[_0x5e54('0x4f')](_0x5170e9);}})['then'](function(_0x2226c4){if(_0x2226c4){return _0x2226c4?{'count':_0x2b4536,'rows':_0x2226c4}:null;}})['then'](respondWithResult(_0x48f8fc,null))[_0x5e54('0x3f')](handleError(_0x48f8fc,null));}; \ No newline at end of file +var _0x5262=['../../config/logger','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','Automation','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','keys','create','body','find','addConditions','omit','ids','getConditions','Condition','order','Action','addActions','getActions','findOne','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xadf939,_0x482184){var _0x232c43=function(_0x26c854){while(--_0x26c854){_0xadf939['push'](_0xadf939['shift']());}};_0x232c43(++_0x482184);}(_0x5262,0x90));var _0x2526=function(_0x66b6fc,_0x53d699){_0x66b6fc=_0x66b6fc-0x0;var _0xec117d=_0x5262[_0x66b6fc];return _0xec117d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2526('0x0'));var jsonpatch=require(_0x2526('0x1'));var rp=require(_0x2526('0x2'));var moment=require(_0x2526('0x3'));var BPromise=require(_0x2526('0x4'));var Mustache=require(_0x2526('0x5'));var util=require(_0x2526('0x6'));var path=require(_0x2526('0x7'));var sox=require(_0x2526('0x8'));var csv=require(_0x2526('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2526('0xa'));var _=require(_0x2526('0xb'));var squel=require('squel');var crypto=require(_0x2526('0xc'));var jsforce=require(_0x2526('0xd'));var deskjs=require(_0x2526('0xe'));var toCsv=require(_0x2526('0x9'));var querystring=require(_0x2526('0xf'));var Papa=require(_0x2526('0x10'));var Redis=require(_0x2526('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2526('0x12'));var hardwareService=require(_0x2526('0x13'));var logger=require(_0x2526('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2526('0x15'))['db'];function respondWithStatusCode(_0x3f3e8b,_0x29b96b){_0x29b96b=_0x29b96b||0xcc;return function(_0x1f596e){if(_0x1f596e){return _0x3f3e8b[_0x2526('0x16')](_0x29b96b);}return _0x3f3e8b['status'](_0x29b96b)[_0x2526('0x17')]();};}function respondWithResult(_0x5978ec,_0x313d73){_0x313d73=_0x313d73||0xc8;return function(_0x275c1d){if(_0x275c1d){return _0x5978ec[_0x2526('0x18')](_0x313d73)[_0x2526('0x19')](_0x275c1d);}};}function respondWithFilteredResult(_0x11eb92,_0x535816){return function(_0x38a2fe){if(_0x38a2fe){var _0x526693=typeof _0x535816[_0x2526('0x1a')]===_0x2526('0x1b')&&typeof _0x535816['limit']==='undefined';var _0x2ff929=_0x38a2fe['count'];var _0x57d312=_0x526693?0x0:_0x535816[_0x2526('0x1a')];var _0x15f2ad=_0x526693?_0x38a2fe['count']:_0x535816[_0x2526('0x1a')]+_0x535816[_0x2526('0x1c')];var _0x5091af;if(_0x15f2ad>=_0x2ff929){_0x15f2ad=_0x2ff929;_0x5091af=0xc8;}else{_0x5091af=0xce;}_0x11eb92[_0x2526('0x18')](_0x5091af);return _0x11eb92[_0x2526('0x1d')](_0x2526('0x1e'),_0x57d312+'-'+_0x15f2ad+'/'+_0x2ff929)[_0x2526('0x19')](_0x38a2fe);}return null;};}function patchUpdates(_0x4d8ac4){return function(_0x252867){try{jsonpatch[_0x2526('0x1f')](_0x252867,_0x4d8ac4,!![]);}catch(_0x372279){return BPromise[_0x2526('0x20')](_0x372279);}return _0x252867[_0x2526('0x21')]();};}function saveUpdates(_0x8aaa91,_0x281de1){return function(_0x2839d5){if(_0x2839d5){return _0x2839d5['update'](_0x8aaa91)['then'](function(_0x5bf480){return _0x5bf480;});}return null;};}function removeEntity(_0x5378b6,_0x2b570b){return function(_0x335012){if(_0x335012){return _0x335012[_0x2526('0x22')]()[_0x2526('0x23')](function(){_0x5378b6[_0x2526('0x18')](0xcc)[_0x2526('0x17')]();});}};}function handleEntityNotFound(_0x53831c,_0x355fda){return function(_0x36f7f0){if(!_0x36f7f0){_0x53831c['sendStatus'](0x194);}return _0x36f7f0;};}function handleError(_0x3c163f,_0x5afb85){_0x5afb85=_0x5afb85||0x1f4;return function(_0x527b4d){logger[_0x2526('0x24')](_0x527b4d[_0x2526('0x25')]);if(_0x527b4d[_0x2526('0x26')]){delete _0x527b4d[_0x2526('0x26')];}_0x3c163f['status'](_0x5afb85)['send'](_0x527b4d);};}exports[_0x2526('0x27')]=function(_0x2eb4d9,_0x5177cf){var _0x2af91d={},_0xd154dc={},_0x5aa9b2={'count':0x0,'rows':[]};var _0x37f29c=_[_0x2526('0x28')](db[_0x2526('0x29')]['rawAttributes'],function(_0x6c9e90){return{'name':_0x6c9e90['fieldName'],'type':_0x6c9e90[_0x2526('0x2a')][_0x2526('0x2b')]};});_0xd154dc['model']=_[_0x2526('0x28')](_0x37f29c,_0x2526('0x26'));_0xd154dc[_0x2526('0x2c')]=_['keys'](_0x2eb4d9[_0x2526('0x2c')]);_0xd154dc['filters']=_[_0x2526('0x2d')](_0xd154dc[_0x2526('0x2e')],_0xd154dc[_0x2526('0x2c')]);_0x2af91d[_0x2526('0x2f')]=_['intersection'](_0xd154dc['model'],qs[_0x2526('0x30')](_0x2eb4d9[_0x2526('0x2c')]['fields']));_0x2af91d[_0x2526('0x2f')]=_0x2af91d[_0x2526('0x2f')][_0x2526('0x31')]?_0x2af91d[_0x2526('0x2f')]:_0xd154dc['model'];if(!_0x2eb4d9[_0x2526('0x2c')][_0x2526('0x32')](_0x2526('0x33'))){_0x2af91d[_0x2526('0x1c')]=qs[_0x2526('0x1c')](_0x2eb4d9[_0x2526('0x2c')]['limit']);_0x2af91d[_0x2526('0x1a')]=qs[_0x2526('0x1a')](_0x2eb4d9[_0x2526('0x2c')][_0x2526('0x1a')]);}_0x2af91d['order']=qs[_0x2526('0x34')](_0x2eb4d9['query']['sort']);_0x2af91d[_0x2526('0x35')]=qs['filters'](_[_0x2526('0x36')](_0x2eb4d9['query'],_0xd154dc[_0x2526('0x37')]),_0x37f29c);if(_0x2eb4d9[_0x2526('0x2c')][_0x2526('0x38')]){_0x2af91d[_0x2526('0x35')]=_[_0x2526('0x39')](_0x2af91d[_0x2526('0x35')],{'$or':_[_0x2526('0x28')](_0x37f29c,function(_0x191ace){if(_0x191ace[_0x2526('0x2a')]!==_0x2526('0x3a')){var _0x984980={};_0x984980[_0x191ace['name']]={'$like':'%'+_0x2eb4d9[_0x2526('0x2c')][_0x2526('0x38')]+'%'};return _0x984980;}})});}_0x2af91d=_[_0x2526('0x39')]({},_0x2af91d,_0x2eb4d9[_0x2526('0x3b')]);var _0x27cf41={'where':_0x2af91d[_0x2526('0x35')]};return db['Automation'][_0x2526('0x3c')](_0x27cf41)[_0x2526('0x23')](function(_0x56ca2f){_0x5aa9b2[_0x2526('0x3c')]=_0x56ca2f;if(_0x2eb4d9['query']['includeAll']){_0x2af91d[_0x2526('0x3d')]=[{'all':!![]}];}return db[_0x2526('0x29')][_0x2526('0x3e')](_0x2af91d);})[_0x2526('0x23')](function(_0x253a92){_0x5aa9b2[_0x2526('0x3f')]=_0x253a92;return _0x5aa9b2;})['then'](respondWithFilteredResult(_0x5177cf,_0x2af91d))[_0x2526('0x40')](handleError(_0x5177cf,null));};exports[_0x2526('0x41')]=function(_0x56a927,_0x15651e){var _0x5f327a={'raw':![],'where':{'id':_0x56a927[_0x2526('0x42')]['id']}},_0x156e03={};_0x156e03[_0x2526('0x2e')]=_['keys'](db['Automation'][_0x2526('0x43')]);_0x156e03[_0x2526('0x2c')]=_[_0x2526('0x44')](_0x56a927[_0x2526('0x2c')]);_0x156e03[_0x2526('0x37')]=_['intersection'](_0x156e03[_0x2526('0x2e')],_0x156e03[_0x2526('0x2c')]);_0x5f327a[_0x2526('0x2f')]=_['intersection'](_0x156e03['model'],qs[_0x2526('0x30')](_0x56a927[_0x2526('0x2c')][_0x2526('0x30')]));_0x5f327a[_0x2526('0x2f')]=_0x5f327a[_0x2526('0x2f')][_0x2526('0x31')]?_0x5f327a[_0x2526('0x2f')]:_0x156e03[_0x2526('0x2e')];if(_0x56a927['query']['includeAll']){_0x5f327a['include']=[{'all':!![]}];}_0x5f327a=_['merge']({},_0x5f327a,_0x56a927[_0x2526('0x3b')]);return db[_0x2526('0x29')]['find'](_0x5f327a)[_0x2526('0x23')](handleEntityNotFound(_0x15651e,null))[_0x2526('0x23')](respondWithResult(_0x15651e,null))[_0x2526('0x40')](handleError(_0x15651e,null));};exports[_0x2526('0x45')]=function(_0x4c2e97,_0x36420e){return db[_0x2526('0x29')][_0x2526('0x45')](_0x4c2e97[_0x2526('0x46')],{})[_0x2526('0x23')](respondWithResult(_0x36420e,0xc9))[_0x2526('0x40')](handleError(_0x36420e,null));};exports['update']=function(_0x4170f6,_0x25e616){if(_0x4170f6['body']['id']){delete _0x4170f6['body']['id'];}return db[_0x2526('0x29')][_0x2526('0x47')]({'where':{'id':_0x4170f6[_0x2526('0x42')]['id']}})[_0x2526('0x23')](handleEntityNotFound(_0x25e616,null))['then'](saveUpdates(_0x4170f6[_0x2526('0x46')],null))[_0x2526('0x23')](respondWithResult(_0x25e616,null))['catch'](handleError(_0x25e616,null));};exports['destroy']=function(_0x123ec8,_0x2dd703){return db['Automation']['find']({'where':{'id':_0x123ec8[_0x2526('0x42')]['id']}})[_0x2526('0x23')](handleEntityNotFound(_0x2dd703,null))[_0x2526('0x23')](removeEntity(_0x2dd703,null))[_0x2526('0x40')](handleError(_0x2dd703,null));};exports[_0x2526('0x48')]=function(_0x3214d6,_0x207370,_0x3818f7){return db['Condition'][_0x2526('0x47')]({'where':{'id':_0x3214d6[_0x2526('0x42')]['id']}})[_0x2526('0x23')](handleEntityNotFound(_0x207370,null))[_0x2526('0x23')](function(_0xa2f0a3){if(_0xa2f0a3){return _0xa2f0a3[_0x2526('0x48')](_0x3214d6[_0x2526('0x46')]['ids'],_[_0x2526('0x49')](_0x3214d6[_0x2526('0x46')],[_0x2526('0x4a'),'id'])||{});}})[_0x2526('0x23')](respondWithResult(_0x207370,null))[_0x2526('0x40')](handleError(_0x207370,null));};exports[_0x2526('0x4b')]=function(_0x51b7fc,_0x55fd31,_0x2f9334){var _0x5e91a4={};var _0x22e193={};var _0x455512;var _0x2847ab;return db[_0x2526('0x29')]['findOne']({'where':{'id':_0x51b7fc['params']['id']}})['then'](handleEntityNotFound(_0x55fd31,null))['then'](function(_0x2e6f2b){if(_0x2e6f2b){_0x455512=_0x2e6f2b;_0x22e193[_0x2526('0x2e')]=_[_0x2526('0x44')](db[_0x2526('0x4c')][_0x2526('0x43')]);_0x22e193[_0x2526('0x2c')]=_[_0x2526('0x44')](_0x51b7fc[_0x2526('0x2c')]);_0x22e193[_0x2526('0x37')]=_[_0x2526('0x2d')](_0x22e193[_0x2526('0x2e')],_0x22e193[_0x2526('0x2c')]);_0x5e91a4[_0x2526('0x2f')]=_[_0x2526('0x2d')](_0x22e193[_0x2526('0x2e')],qs[_0x2526('0x30')](_0x51b7fc[_0x2526('0x2c')][_0x2526('0x30')]));_0x5e91a4[_0x2526('0x2f')]=_0x5e91a4[_0x2526('0x2f')][_0x2526('0x31')]?_0x5e91a4[_0x2526('0x2f')]:_0x22e193['model'];_0x5e91a4[_0x2526('0x4d')]=qs[_0x2526('0x34')](_0x51b7fc[_0x2526('0x2c')][_0x2526('0x34')]);_0x5e91a4['where']=qs[_0x2526('0x37')](_[_0x2526('0x36')](_0x51b7fc[_0x2526('0x2c')],_0x22e193['filters']));if(_0x51b7fc['query'][_0x2526('0x38')]){_0x5e91a4[_0x2526('0x35')]=_['merge'](_0x5e91a4[_0x2526('0x35')],{'$or':_[_0x2526('0x28')](_0x5e91a4['attributes'],function(_0x177869){var _0x58c9db={};_0x58c9db[_0x177869]={'$like':'%'+_0x51b7fc[_0x2526('0x2c')][_0x2526('0x38')]+'%'};return _0x58c9db;})});}_0x5e91a4=_[_0x2526('0x39')]({},_0x5e91a4,_0x51b7fc['options']);return _0x455512['getConditions'](_0x5e91a4);}})[_0x2526('0x23')](function(_0x4edc5d){if(_0x4edc5d){_0x2847ab=_0x4edc5d['length'];if(!_0x51b7fc['query'][_0x2526('0x32')](_0x2526('0x33'))){_0x5e91a4['limit']=qs['limit'](_0x51b7fc['query'][_0x2526('0x1c')]);_0x5e91a4['offset']=qs[_0x2526('0x1a')](_0x51b7fc[_0x2526('0x2c')]['offset']);}return _0x455512[_0x2526('0x4b')](_0x5e91a4);}})['then'](function(_0x169ab8){if(_0x169ab8){return _0x169ab8?{'count':_0x2847ab,'rows':_0x169ab8}:null;}})[_0x2526('0x23')](respondWithResult(_0x55fd31,null))[_0x2526('0x40')](handleError(_0x55fd31,null));};exports['addActions']=function(_0x14dbbb,_0x2afd48,_0x49e2c0){return db[_0x2526('0x4e')][_0x2526('0x47')]({'where':{'id':_0x14dbbb['params']['id']}})[_0x2526('0x23')](handleEntityNotFound(_0x2afd48,null))[_0x2526('0x23')](function(_0x1c3481){if(_0x1c3481){return _0x1c3481[_0x2526('0x4f')](_0x14dbbb[_0x2526('0x46')][_0x2526('0x4a')],_[_0x2526('0x49')](_0x14dbbb['body'],['ids','id'])||{});}})[_0x2526('0x23')](respondWithResult(_0x2afd48,null))['catch'](handleError(_0x2afd48,null));};exports[_0x2526('0x50')]=function(_0x569075,_0x332c61,_0x4e2b31){var _0x17cb16={};var _0x1b84f3={};var _0x76f6bf;var _0x1976bd;return db[_0x2526('0x29')][_0x2526('0x51')]({'where':{'id':_0x569075[_0x2526('0x42')]['id']}})[_0x2526('0x23')](handleEntityNotFound(_0x332c61,null))['then'](function(_0x3ac2dc){if(_0x3ac2dc){_0x76f6bf=_0x3ac2dc;_0x1b84f3['model']=_['keys'](db[_0x2526('0x4e')][_0x2526('0x43')]);_0x1b84f3[_0x2526('0x2c')]=_[_0x2526('0x44')](_0x569075[_0x2526('0x2c')]);_0x1b84f3[_0x2526('0x37')]=_[_0x2526('0x2d')](_0x1b84f3[_0x2526('0x2e')],_0x1b84f3[_0x2526('0x2c')]);_0x17cb16[_0x2526('0x2f')]=_[_0x2526('0x2d')](_0x1b84f3[_0x2526('0x2e')],qs[_0x2526('0x30')](_0x569075[_0x2526('0x2c')][_0x2526('0x30')]));_0x17cb16[_0x2526('0x2f')]=_0x17cb16[_0x2526('0x2f')][_0x2526('0x31')]?_0x17cb16[_0x2526('0x2f')]:_0x1b84f3[_0x2526('0x2e')];_0x17cb16['order']=qs['sort'](_0x569075['query'][_0x2526('0x34')]);_0x17cb16['where']=qs[_0x2526('0x37')](_['pick'](_0x569075[_0x2526('0x2c')],_0x1b84f3[_0x2526('0x37')]));if(_0x569075[_0x2526('0x2c')]['filter']){_0x17cb16['where']=_['merge'](_0x17cb16[_0x2526('0x35')],{'$or':_['map'](_0x17cb16[_0x2526('0x2f')],function(_0x3f52b5){var _0x3c79d5={};_0x3c79d5[_0x3f52b5]={'$like':'%'+_0x569075[_0x2526('0x2c')][_0x2526('0x38')]+'%'};return _0x3c79d5;})});}_0x17cb16=_[_0x2526('0x39')]({},_0x17cb16,_0x569075[_0x2526('0x3b')]);return _0x76f6bf[_0x2526('0x50')](_0x17cb16);}})[_0x2526('0x23')](function(_0x72e26f){if(_0x72e26f){_0x1976bd=_0x72e26f[_0x2526('0x31')];if(!_0x569075[_0x2526('0x2c')][_0x2526('0x32')](_0x2526('0x33'))){_0x17cb16[_0x2526('0x1c')]=qs[_0x2526('0x1c')](_0x569075[_0x2526('0x2c')][_0x2526('0x1c')]);_0x17cb16[_0x2526('0x1a')]=qs[_0x2526('0x1a')](_0x569075['query']['offset']);}return _0x76f6bf['getActions'](_0x17cb16);}})[_0x2526('0x23')](function(_0x3e72d2){if(_0x3e72d2){return _0x3e72d2?{'count':_0x1976bd,'rows':_0x3e72d2}:null;}})[_0x2526('0x23')](respondWithResult(_0x332c61,null))['catch'](handleError(_0x332c61,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 4ba50cd..68a370b 100644 --- a/server/api/automation/automation.model.js +++ b/server/api/automation/automation.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ea7=['lodash','../../config/logger','request-promise','path','../../config/environment','./automation.attributes','define'];(function(_0x288a14,_0x5300db){var _0x1e15f2=function(_0x30fb34){while(--_0x30fb34){_0x288a14['push'](_0x288a14['shift']());}};_0x1e15f2(++_0x5300db);}(_0x9ea7,0x165));var _0x79ea=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x9ea7[_0x2afbb0];return _0x411ff2;};'use strict';var _=require(_0x79ea('0x0'));var util=require('util');var logger=require(_0x79ea('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x79ea('0x2'));var fs=require('fs');var path=require(_0x79ea('0x3'));var rimraf=require('rimraf');var config=require(_0x79ea('0x4'));var attributes=require(_0x79ea('0x5'));module['exports']=function(_0x32938b,_0x5cd579){return _0x32938b[_0x79ea('0x6')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b38=['rimraf','../../config/environment','./automation.attributes','define','Automation','util','../../config/logger','api','moment','bluebird'];(function(_0x4a8b2a,_0x5639ac){var _0x412976=function(_0x28dac1){while(--_0x28dac1){_0x4a8b2a['push'](_0x4a8b2a['shift']());}};_0x412976(++_0x5639ac);}(_0x5b38,0x73));var _0x85b3=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5b38[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0x85b3('0x0'));var logger=require(_0x85b3('0x1'))(_0x85b3('0x2'));var moment=require(_0x85b3('0x3'));var BPromise=require(_0x85b3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x85b3('0x5'));var config=require(_0x85b3('0x6'));var attributes=require(_0x85b3('0x7'));module['exports']=function(_0x5a581a,_0x44766d){return _0x5a581a[_0x85b3('0x8')](_0x85b3('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 1abe74d..f00c761 100644 --- a/server/api/automation/automation.rpc.js +++ b/server/api/automation/automation.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1410=['jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1410,0x130));var _0x0141=function(_0x39153c,_0x293109){_0x39153c=_0x39153c-0x0;var _0x246bac=_0x1410[_0x39153c];return _0x246bac;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var moment=require(_0x0141('0x2'));var BPromise=require(_0x0141('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0141('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0141('0x5'));var logger=require('../../config/logger')(_0x0141('0x6'));var config=require(_0x0141('0x7'));var jayson=require(_0x0141('0x8'));var client=jayson[_0x0141('0x9')][_0x0141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f701,_0x22b566,_0x25511f){return new BPromise(function(_0x2d8f15,_0x57cfbb){return client[_0x0141('0xb')](_0x24f701,_0x25511f)[_0x0141('0xc')](function(_0x2b4f13){logger[_0x0141('0xd')](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));logger[_0x0141('0x10')](_0x0141('0x11'),_0x22b566,'request\x20sent',JSON[_0x0141('0x12')](_0x2b4f13));if(_0x2b4f13[_0x0141('0x13')]){if(_0x2b4f13[_0x0141('0x13')][_0x0141('0x14')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x57cfbb(_0x2b4f13['error'][_0x0141('0x15')]);}logger[_0x0141('0x13')](_0x0141('0xe'),_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x2d8f15(_0x2b4f13['error'][_0x0141('0x15')]);}else{logger['info'](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));_0x2d8f15(_0x2b4f13[_0x0141('0x16')][_0x0141('0x15')]);}})[_0x0141('0x17')](function(_0x3c91e8){logger['error']('Automation,\x20%s,\x20%s',_0x22b566,_0x3c91e8);_0x57cfbb(_0x3c91e8);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x17edef,_0x3a08b1){var _0x8fb2e9=function(_0x1b7143){while(--_0x1b7143){_0x17edef['push'](_0x17edef['shift']());}};_0x8fb2e9(++_0x3a08b1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50a200,_0x107e3b){_0x50a200=_0x50a200-0x0;var _0x209610=_0x5f2f[_0x50a200];return _0x209610;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5ee12f0..b334699 100644 --- a/server/api/automation/index.js +++ b/server/api/automation/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbb8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','addActions','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x51d26e,_0x5bc3ae){var _0x10c10a=function(_0x21a675){while(--_0x21a675){_0x51d26e['push'](_0x51d26e['shift']());}};_0x10c10a(++_0x5bc3ae);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x113dfd,_0x48eae8){_0x113dfd=_0x113dfd-0x0;var _0xb7a4ed=_0xbbb8[_0x113dfd];return _0xb7a4ed;};'use strict';var multer=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var path=require('path');var timeout=require(_0x8bbb('0x2'));var express=require(_0x8bbb('0x3'));var router=express['Router']();var fs_extra=require(_0x8bbb('0x4'));var auth=require(_0x8bbb('0x5'));var interaction=require(_0x8bbb('0x6'));var config=require(_0x8bbb('0x7'));var controller=require(_0x8bbb('0x8'));router[_0x8bbb('0x9')]('/',auth[_0x8bbb('0xa')](),controller[_0x8bbb('0xb')]);router[_0x8bbb('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8bbb('0x9')](_0x8bbb('0xc'),auth[_0x8bbb('0xa')](),controller[_0x8bbb('0xd')]);router[_0x8bbb('0x9')](_0x8bbb('0xe'),auth[_0x8bbb('0xa')](),controller[_0x8bbb('0xf')]);router['post']('/',auth[_0x8bbb('0xa')](),controller[_0x8bbb('0x10')]);router[_0x8bbb('0x11')]('/:id/conditions',auth[_0x8bbb('0xa')](),controller[_0x8bbb('0x12')]);router[_0x8bbb('0x11')]('/:id/actions',auth[_0x8bbb('0xa')](),controller[_0x8bbb('0x13')]);router[_0x8bbb('0x14')](_0x8bbb('0x15'),auth['isAuthenticated'](),controller[_0x8bbb('0x16')]);router[_0x8bbb('0x17')]('/:id',auth[_0x8bbb('0xa')](),controller[_0x8bbb('0x18')]);module[_0x8bbb('0x19')]=router; \ No newline at end of file +var _0x6b19=['show','/:id/conditions','getConditions','/:id/actions','getActions','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','get'];(function(_0x2ee8b2,_0x26a81a){var _0x5de665=function(_0x73b664){while(--_0x73b664){_0x2ee8b2['push'](_0x2ee8b2['shift']());}};_0x5de665(++_0x26a81a);}(_0x6b19,0xe8));var _0x96b1=function(_0x573a82,_0x4939d2){_0x573a82=_0x573a82-0x0;var _0x5bf900=_0x6b19[_0x573a82];return _0x5bf900;};'use strict';var multer=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var path=require('path');var timeout=require(_0x96b1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x96b1('0x3'));var auth=require(_0x96b1('0x4'));var interaction=require(_0x96b1('0x5'));var config=require(_0x96b1('0x6'));var controller=require(_0x96b1('0x7'));router['get']('/',auth[_0x96b1('0x8')](),controller['index']);router[_0x96b1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x96b1('0xa')]);router['get'](_0x96b1('0xb'),auth['isAuthenticated'](),controller[_0x96b1('0xc')]);router[_0x96b1('0x9')](_0x96b1('0xd'),auth[_0x96b1('0x8')](),controller[_0x96b1('0xe')]);router[_0x96b1('0xf')]('/',auth[_0x96b1('0x8')](),controller['create']);router['post'](_0x96b1('0xb'),auth['isAuthenticated'](),controller['addConditions']);router[_0x96b1('0xf')](_0x96b1('0xd'),auth[_0x96b1('0x8')](),controller['addActions']);router[_0x96b1('0x10')](_0x96b1('0x11'),auth[_0x96b1('0x8')](),controller[_0x96b1('0x12')]);router[_0x96b1('0x13')]('/:id',auth[_0x96b1('0x8')](),controller[_0x96b1('0x14')]);module[_0x96b1('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e75626f..6450aee 100644 --- a/server/api/campaign/campaign.attributes.js +++ b/server/api/campaign/campaign.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x048e=['Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen'];(function(_0x2f1696,_0x429c06){var _0x2f08e4=function(_0x36bef6){while(--_0x36bef6){_0x2f1696['push'](_0x2f1696['shift']());}};_0x2f08e4(++_0x429c06);}(_0x048e,0x1aa));var _0xe048=function(_0x59dfe7,_0x925008){_0x59dfe7=_0x59dfe7-0x0;var _0x572f2e=_0x048e[_0x59dfe7];return _0x572f2e;};'use strict';var Sequelize=require(_0xe048('0x0'));module['exports']={'name':{'type':Sequelize[_0xe048('0x1')],'unique':_0xe048('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe048('0x3')](_0xe048('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xe048('0x1')]},'active':{'type':Sequelize[_0xe048('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xe048('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xe048('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe048('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe048('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe048('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xe048('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe048('0xe')},'dialTimezone':{'type':Sequelize[_0xe048('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe048('0x1')],'defaultValue':_0xe048('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xe048('0x10'),'never',_0xe048('0x11')),'defaultValue':_0xe048('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe048('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xe048('0x9')](0x9)[_0xe048('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe048('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xe048('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe048('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe048('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe048('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe048('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe048('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xe048('0x9')](0x9)[_0xe048('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe048('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe048('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe048('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe048('0x9')](0x9)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe048('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe048('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe048('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe048('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe048('0x3')](_0xe048('0x1c'),_0xe048('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xe048('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xe048('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xe048('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe048('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe048('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe048('0x24')}}; \ No newline at end of file +var _0x784c=['#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x359186,_0x110e27){var _0xb83111=function(_0x1d80c3){while(--_0x1d80c3){_0x359186['push'](_0x359186['shift']());}};_0xb83111(++_0x110e27);}(_0x784c,0x78));var _0xc784=function(_0x3b5f06,_0x42190e){_0x3b5f06=_0x3b5f06-0x0;var _0x46afd5=_0x784c[_0x3b5f06];return _0x46afd5;};'use strict';var Sequelize=require(_0xc784('0x0'));module[_0xc784('0x1')]={'name':{'type':Sequelize[_0xc784('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc784('0x3')]('ivr'),'allowNull':![],'defaultValue':_0xc784('0x4')},'description':{'type':Sequelize[_0xc784('0x2')]},'active':{'type':Sequelize[_0xc784('0x5')],'defaultValue':0x0,'comment':_0xc784('0x6')},'limitCalls':{'type':Sequelize[_0xc784('0x7')](0x4)[_0xc784('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc784('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc784('0x7')](0x3)[_0xc784('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc784('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc784('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc784('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc784('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc784('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xc784('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc784('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc784('0x7')](0x5)[_0xc784('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc784('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc784('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc784('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc784('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc784('0x7')](0x3)[_0xc784('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc784('0x10')},'dialTimezone':{'type':Sequelize[_0xc784('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc784('0x2')],'defaultValue':_0xc784('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xc784('0x3')]('always',_0xc784('0x12'),_0xc784('0x13')),'defaultValue':_0xc784('0x14')},'dialAMDActive':{'type':Sequelize[_0xc784('0x5')],'defaultValue':0x0,'comment':_0xc784('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0xc784('0x7')](0x9)[_0xc784('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc784('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xc784('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc784('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc784('0x7')](0x9)[_0xc784('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc784('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc784('0x7')](0x9)[_0xc784('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc784('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc784('0x7')](0x9)[_0xc784('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc784('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc784('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc784('0x7')](0x5)[_0xc784('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc784('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc784('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc784('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc784('0x3')](_0xc784('0x1d'),_0xc784('0x1e')),'defaultValue':_0xc784('0x1d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc784('0x7')](0x3)[_0xc784('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc784('0x1f')},'dialCutDigit':{'type':Sequelize[_0xc784('0x7')](0x3)[_0xc784('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc784('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc784('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc784('0x7')](0x5)[_0xc784('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xc784('0x7')](0x3)[_0xc784('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc784('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xc784('0x7')](0x5)[_0xc784('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc784('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc784('0x7')](0x3)[_0xc784('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc784('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc784('0x7')](0x5)[_0xc784('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc784('0x7')](0x3)[_0xc784('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc784('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc784('0x7')](0x5)[_0xc784('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc784('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc784('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc784('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc784('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4ef6578..b1017a4 100644 --- a/server/api/campaign/campaign.controller.js +++ b/server/api/campaign/campaign.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7543=['createdAt','updatedAt','role','userProfileId','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','include','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','into','cm_hopper','scheduledAt','ContactId','ListId','select','field','phone','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','insert','fromQuery','NOW()','ListId\x20=\x20?','cmHopperId','OrderBy','ci.OrderBY','cm_contact_has_items','join','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','status','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','Campaign','includeAll','rows','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7543,0xca));var _0x3754=function(_0x2052cc,_0x4f76dc){_0x2052cc=_0x2052cc-0x0;var _0x58609f=_0x7543[_0x2052cc];return _0x58609f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3754('0x0'));var zipdir=require(_0x3754('0x1'));var jsonpatch=require(_0x3754('0x2'));var rp=require(_0x3754('0x3'));var moment=require(_0x3754('0x4'));var BPromise=require(_0x3754('0x5'));var Mustache=require(_0x3754('0x6'));var util=require(_0x3754('0x7'));var path=require(_0x3754('0x8'));var sox=require(_0x3754('0x9'));var csv=require(_0x3754('0xa'));var ejs=require(_0x3754('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3754('0xc'));var squel=require(_0x3754('0xd'));var crypto=require(_0x3754('0xe'));var jsforce=require(_0x3754('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3754('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3754('0x10'));var authService=require(_0x3754('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3754('0x12'));var hardwareService=require(_0x3754('0x13'));var logger=require(_0x3754('0x14'))(_0x3754('0x15'));var utils=require(_0x3754('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3754('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x318523,_0x416fd8){_0x416fd8=_0x416fd8||0xcc;return function(_0x4879da){if(_0x4879da){return _0x318523['sendStatus'](_0x416fd8);}return _0x318523['status'](_0x416fd8)['end']();};}function respondWithResult(_0x367e4a,_0x5c5152){_0x5c5152=_0x5c5152||0xc8;return function(_0x46d0e3){if(_0x46d0e3){return _0x367e4a['status'](_0x5c5152)[_0x3754('0x18')](_0x46d0e3);}};}function respondWithFilteredResult(_0x24a2a5,_0x5cb2a5){return function(_0x89d91f){if(_0x89d91f){var _0x5ce0d0=typeof _0x5cb2a5[_0x3754('0x19')]===_0x3754('0x1a')&&typeof _0x5cb2a5[_0x3754('0x1b')]===_0x3754('0x1a');var _0x208200=_0x89d91f[_0x3754('0x1c')];var _0x571225=_0x5ce0d0?0x0:_0x5cb2a5[_0x3754('0x19')];var _0x4983cc=_0x5ce0d0?_0x89d91f[_0x3754('0x1c')]:_0x5cb2a5['offset']+_0x5cb2a5[_0x3754('0x1b')];var _0x36f2b1;if(_0x4983cc>=_0x208200){_0x4983cc=_0x208200;_0x36f2b1=0xc8;}else{_0x36f2b1=0xce;}_0x24a2a5['status'](_0x36f2b1);return _0x24a2a5[_0x3754('0x1d')](_0x3754('0x1e'),_0x571225+'-'+_0x4983cc+'/'+_0x208200)[_0x3754('0x18')](_0x89d91f);}return null;};}function patchUpdates(_0x5762cc){return function(_0x31999f){try{jsonpatch[_0x3754('0x1f')](_0x31999f,_0x5762cc,!![]);}catch(_0xbe0cfc){return BPromise[_0x3754('0x20')](_0xbe0cfc);}return _0x31999f['save']();};}function saveUpdates(_0x1d3f2f,_0x24bd78){return function(_0x20ed49){if(_0x20ed49){return _0x20ed49[_0x3754('0x21')](_0x1d3f2f)[_0x3754('0x22')](function(_0x41e49d){return _0x41e49d;});}return null;};}function removeEntity(_0x17ce16,_0x4ff03d){return function(_0x2751f1){if(_0x2751f1){return _0x2751f1[_0x3754('0x23')]()['then'](function(){var _0x43a878=_0x2751f1[_0x3754('0x24')]({'plain':!![]});var _0x1ca092=_0x3754('0x25');return db[_0x3754('0x26')][_0x3754('0x23')]({'where':{'type':_0x1ca092,'resourceId':_0x43a878['id']}})[_0x3754('0x22')](function(){return _0x2751f1;});})['then'](function(){_0x17ce16[_0x3754('0x27')](0xcc)[_0x3754('0x28')]();});}};}function handleEntityNotFound(_0x78f082,_0x16d172){return function(_0x510783){if(!_0x510783){_0x78f082[_0x3754('0x29')](0x194);}return _0x510783;};}function handleError(_0x29c3b9,_0x2a4d0c){_0x2a4d0c=_0x2a4d0c||0x1f4;return function(_0x27a327){logger[_0x3754('0x2a')](_0x27a327[_0x3754('0x2b')]);if(_0x27a327['name']){delete _0x27a327[_0x3754('0x2c')];}_0x29c3b9[_0x3754('0x27')](_0x2a4d0c)[_0x3754('0x2d')](_0x27a327);};}exports[_0x3754('0x2e')]=function(_0x335f4e,_0x181977){var _0x5311a6={},_0x578958={},_0x2fe498={'count':0x0,'rows':[]};var _0x1688eb=_[_0x3754('0x2f')](db['Campaign'][_0x3754('0x30')],function(_0x48426c){return{'name':_0x48426c[_0x3754('0x31')],'type':_0x48426c[_0x3754('0x32')][_0x3754('0x33')]};});_0x578958[_0x3754('0x34')]=_[_0x3754('0x2f')](_0x1688eb,_0x3754('0x2c'));_0x578958[_0x3754('0x35')]=_['keys'](_0x335f4e[_0x3754('0x35')]);_0x578958['filters']=_[_0x3754('0x36')](_0x578958['model'],_0x578958[_0x3754('0x35')]);_0x5311a6[_0x3754('0x37')]=_[_0x3754('0x36')](_0x578958[_0x3754('0x34')],qs[_0x3754('0x38')](_0x335f4e['query'][_0x3754('0x38')]));_0x5311a6[_0x3754('0x37')]=_0x5311a6[_0x3754('0x37')][_0x3754('0x39')]?_0x5311a6[_0x3754('0x37')]:_0x578958[_0x3754('0x34')];if(!_0x335f4e[_0x3754('0x35')][_0x3754('0x3a')](_0x3754('0x3b'))){_0x5311a6[_0x3754('0x1b')]=qs[_0x3754('0x1b')](_0x335f4e['query'][_0x3754('0x1b')]);_0x5311a6[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x335f4e[_0x3754('0x35')][_0x3754('0x19')]);}_0x5311a6[_0x3754('0x3c')]=qs[_0x3754('0x3d')](_0x335f4e[_0x3754('0x35')][_0x3754('0x3d')]);_0x5311a6[_0x3754('0x3e')]=qs[_0x3754('0x3f')](_[_0x3754('0x40')](_0x335f4e[_0x3754('0x35')],_0x578958[_0x3754('0x3f')]),_0x1688eb);if(_0x335f4e[_0x3754('0x35')]['filter']){_0x5311a6[_0x3754('0x3e')]=_[_0x3754('0x41')](_0x5311a6[_0x3754('0x3e')],{'$or':_['map'](_0x1688eb,function(_0xa95b07){if(_0xa95b07['type']!=='VIRTUAL'){var _0x55c205={};_0x55c205[_0xa95b07['name']]={'$like':'%'+_0x335f4e[_0x3754('0x35')][_0x3754('0x42')]+'%'};return _0x55c205;}})});}_0x5311a6=_[_0x3754('0x41')]({},_0x5311a6,_0x335f4e[_0x3754('0x43')]);var _0x3a60c5={'where':_0x5311a6[_0x3754('0x3e')]};return db[_0x3754('0x44')][_0x3754('0x1c')](_0x3a60c5)['then'](function(_0x54bd3a){_0x2fe498[_0x3754('0x1c')]=_0x54bd3a;if(_0x335f4e[_0x3754('0x35')][_0x3754('0x45')]){_0x5311a6['include']=[{'all':!![]}];}return db[_0x3754('0x44')]['findAll'](_0x5311a6);})[_0x3754('0x22')](function(_0x5e41c4){_0x2fe498[_0x3754('0x46')]=_0x5e41c4;return _0x2fe498;})[_0x3754('0x22')](respondWithFilteredResult(_0x181977,_0x5311a6))['catch'](handleError(_0x181977,null));};exports['show']=function(_0x1b4f9c,_0x3e54b7){var _0x3b881e={'raw':![],'where':{'id':_0x1b4f9c[_0x3754('0x47')]['id']}},_0x2b06e1={};_0x2b06e1[_0x3754('0x34')]=_[_0x3754('0x48')](db[_0x3754('0x44')][_0x3754('0x30')]);_0x2b06e1['query']=_['keys'](_0x1b4f9c[_0x3754('0x35')]);_0x2b06e1[_0x3754('0x3f')]=_[_0x3754('0x36')](_0x2b06e1['model'],_0x2b06e1[_0x3754('0x35')]);_0x3b881e['attributes']=_[_0x3754('0x36')](_0x2b06e1[_0x3754('0x34')],qs[_0x3754('0x38')](_0x1b4f9c[_0x3754('0x35')][_0x3754('0x38')]));_0x3b881e[_0x3754('0x37')]=_0x3b881e[_0x3754('0x37')][_0x3754('0x39')]?_0x3b881e[_0x3754('0x37')]:_0x2b06e1[_0x3754('0x34')];if(_0x1b4f9c[_0x3754('0x35')][_0x3754('0x45')]){_0x3b881e['include']=[{'all':!![]}];}_0x3b881e=_['merge']({},_0x3b881e,_0x1b4f9c[_0x3754('0x43')]);return db['Campaign'][_0x3754('0x49')](_0x3b881e)[_0x3754('0x22')](handleEntityNotFound(_0x3e54b7,null))['then'](respondWithResult(_0x3e54b7,null))[_0x3754('0x4a')](handleError(_0x3e54b7,null));};exports[_0x3754('0x4b')]=function(_0xad7f3a,_0x4d9d89){return db[_0x3754('0x44')]['create'](_0xad7f3a[_0x3754('0x4c')],{})[_0x3754('0x22')](function(_0x4648d1){var _0x440893=_0xad7f3a[_0x3754('0x4d')][_0x3754('0x24')]({'plain':!![]});if(!_0x440893)throw new Error(_0x3754('0x4e'));if(_0x440893['role']==='user'){var _0x42ab00=_0x4648d1[_0x3754('0x24')]({'plain':!![]});var _0x218b7b='IvrCampaigns';return db[_0x3754('0x4f')][_0x3754('0x49')]({'where':{'name':_0x218b7b,'userProfileId':_0x440893['userProfileId']},'raw':!![]})[_0x3754('0x22')](function(_0x38a4f7){if(_0x38a4f7&&_0x38a4f7[_0x3754('0x50')]===0x0){return db[_0x3754('0x26')]['create']({'name':_0x42ab00[_0x3754('0x2c')],'resourceId':_0x42ab00['id'],'type':_0x38a4f7[_0x3754('0x2c')],'sectionId':_0x38a4f7['id']},{})[_0x3754('0x22')](function(){return _0x4648d1;});}else{return _0x4648d1;}})[_0x3754('0x4a')](function(_0x4a6f88){logger[_0x3754('0x2a')](_0x3754('0x51'),_0x4a6f88);throw _0x4a6f88;});}return _0x4648d1;})[_0x3754('0x22')](respondWithResult(_0x4d9d89,0xc9))[_0x3754('0x4a')](handleError(_0x4d9d89,null));};exports[_0x3754('0x52')]=function(_0x284e8e,_0x4e2cbd){var _0x5deb09={'where':{'id':_0x284e8e['params']['id']}},_0x38e1fc={};_0x38e1fc['model']=_[_0x3754('0x48')](db[_0x3754('0x44')][_0x3754('0x30')]);_0x5deb09[_0x3754('0x37')]=_[_0x3754('0x36')](_0x38e1fc[_0x3754('0x34')],qs['fields'](_0x284e8e[_0x3754('0x35')][_0x3754('0x38')]));_0x5deb09['attributes']=_0x5deb09[_0x3754('0x37')][_0x3754('0x39')]?_0x5deb09[_0x3754('0x37')]:_0x38e1fc['model'];if(_0x284e8e[_0x3754('0x35')]['includeAll']){_0x5deb09['include']=[{'all':!![]}];}_0x5deb09=_[_0x3754('0x41')]({},_0x5deb09,_0x284e8e['options']);return db[_0x3754('0x44')][_0x3754('0x49')](_0x5deb09)[_0x3754('0x22')](handleEntityNotFound(_0x4e2cbd,null))[_0x3754('0x22')](function(_0x1d683b){if(_0x1d683b){var _0x3f4540=_0x1d683b[_0x3754('0x24')]({'plain':!![]});_0x3f4540=qs[_0x3754('0x53')](_0x3f4540,['id',_0x3754('0x54'),_0x3754('0x55')]);_0x284e8e['body']=_[_0x3754('0x53')](_0x284e8e['body'],['id',_0x3754('0x54'),_0x3754('0x55')]);return db['Campaign']['create'](_[_0x3754('0x41')](_0x3f4540,_0x284e8e[_0x3754('0x4c')]),{'include':_0x284e8e[_0x3754('0x35')][_0x3754('0x45')]?[{'all':!![]}]:undefined})[_0x3754('0x22')](function(_0x12e47f){var _0x1cf88c=_0x284e8e['user']['get']({'plain':!![]});if(!_0x1cf88c)throw new Error(_0x3754('0x4e'));if(_0x1cf88c[_0x3754('0x56')]===_0x3754('0x4d')){var _0x36922e=_0x12e47f['get']({'plain':!![]});var _0x584d40=_0x3754('0x25');return db[_0x3754('0x4f')]['find']({'where':{'name':_0x584d40,'userProfileId':_0x1cf88c[_0x3754('0x57')]},'raw':!![]})[_0x3754('0x22')](function(_0x4915f9){if(_0x4915f9&&_0x4915f9[_0x3754('0x50')]===0x0){return db['UserProfileResource'][_0x3754('0x4b')]({'name':_0x36922e['name'],'resourceId':_0x36922e['id'],'type':_0x4915f9[_0x3754('0x2c')],'sectionId':_0x4915f9['id']},{})[_0x3754('0x22')](function(){return _0x12e47f;});}else{return _0x12e47f;}})[_0x3754('0x4a')](function(_0x56edc8){logger[_0x3754('0x2a')](_0x3754('0x51'),_0x56edc8);throw _0x56edc8;});}return _0x12e47f;});}})[_0x3754('0x22')](respondWithResult(_0x4e2cbd,0xc9))[_0x3754('0x4a')](handleError(_0x4e2cbd,null));};exports[_0x3754('0x21')]=function(_0x3ac683,_0x307ade){if(_0x3ac683[_0x3754('0x4c')]['id']){delete _0x3ac683['body']['id'];}return db[_0x3754('0x44')][_0x3754('0x49')]({'where':{'id':_0x3ac683[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x307ade,null))['then'](saveUpdates(_0x3ac683[_0x3754('0x4c')],null))[_0x3754('0x22')](respondWithResult(_0x307ade,null))[_0x3754('0x4a')](handleError(_0x307ade,null));};exports['destroy']=function(_0x19670a,_0x298ef1){return db[_0x3754('0x44')][_0x3754('0x49')]({'where':{'id':_0x19670a[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x298ef1,null))['then'](removeEntity(_0x298ef1,null))[_0x3754('0x4a')](handleError(_0x298ef1,null));};exports[_0x3754('0x58')]=function(_0x2f9418,_0x59ca00,_0xda5db3){var _0x46ec64={'raw':!![],'where':{}};var _0x4d6db2={};var _0x1832e9={'count':0x0,'rows':[]};return db[_0x3754('0x44')][_0x3754('0x59')]({'where':{'id':_0x2f9418[_0x3754('0x47')]['id']}})['then'](handleEntityNotFound(_0x59ca00,null))[_0x3754('0x22')](function(_0x395760){if(_0x395760){_0x4d6db2[_0x3754('0x34')]=_[_0x3754('0x48')](db[_0x3754('0x5a')][_0x3754('0x30')]);_0x4d6db2['query']=_[_0x3754('0x48')](_0x2f9418[_0x3754('0x35')]);_0x4d6db2[_0x3754('0x3f')]=_[_0x3754('0x36')](_0x4d6db2[_0x3754('0x34')],_0x4d6db2[_0x3754('0x35')]);_0x46ec64[_0x3754('0x37')]=_['intersection'](_0x4d6db2[_0x3754('0x34')],qs[_0x3754('0x38')](_0x2f9418['query'][_0x3754('0x38')]));_0x46ec64[_0x3754('0x37')]=_0x46ec64[_0x3754('0x37')][_0x3754('0x39')]?_0x46ec64['attributes']:_0x4d6db2[_0x3754('0x34')];if(!_0x2f9418[_0x3754('0x35')][_0x3754('0x3a')](_0x3754('0x3b'))){_0x46ec64['limit']=qs[_0x3754('0x1b')](_0x2f9418[_0x3754('0x35')][_0x3754('0x1b')]);_0x46ec64[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x2f9418['query'][_0x3754('0x19')]);}_0x46ec64[_0x3754('0x3c')]=qs['sort'](_0x2f9418[_0x3754('0x35')]['sort']);_0x46ec64['where']=qs['filters'](_[_0x3754('0x40')](_0x2f9418[_0x3754('0x35')],_0x4d6db2['filters']));_0x46ec64[_0x3754('0x3e')][_0x3754('0x5b')]=_0x395760['id'];if(_0x2f9418[_0x3754('0x35')][_0x3754('0x42')]){_0x46ec64[_0x3754('0x3e')]=_[_0x3754('0x41')](_0x46ec64['where'],{'$or':_[_0x3754('0x2f')](_0x46ec64[_0x3754('0x37')],function(_0x546d3a){var _0x4edcc={};_0x4edcc[_0x546d3a]={'$like':'%'+_0x2f9418[_0x3754('0x35')][_0x3754('0x42')]+'%'};return _0x4edcc;})});}_0x46ec64=_[_0x3754('0x41')]({},_0x46ec64,_0x2f9418['options']);return db[_0x3754('0x5a')][_0x3754('0x1c')]({'where':_0x46ec64[_0x3754('0x3e')]})[_0x3754('0x22')](function(_0x33236c){_0x1832e9[_0x3754('0x1c')]=_0x33236c;if(_0x2f9418['query'][_0x3754('0x45')]){_0x46ec64['include']=[{'all':!![]}];}return db[_0x3754('0x5a')][_0x3754('0x5c')](_0x46ec64);})['then'](function(_0x57d507){_0x1832e9['rows']=_0x57d507;return _0x1832e9;});}})[_0x3754('0x22')](respondWithFilteredResult(_0x59ca00,_0x46ec64))['catch'](handleError(_0x59ca00,null));};exports[_0x3754('0x5d')]=function(_0x5dda69,_0x2c3733,_0x4668a3){var _0xeeffed={'raw':!![],'where':{}};var _0x3a4d3e={};var _0x2df519={'count':0x0,'rows':[]};return db['Campaign'][_0x3754('0x59')]({'where':{'id':_0x5dda69[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x2c3733,null))[_0x3754('0x22')](function(_0x287028){if(_0x287028){_0x3a4d3e['model']=_[_0x3754('0x48')](db['CmHopperHistory']['rawAttributes']);_0x3a4d3e[_0x3754('0x35')]=_[_0x3754('0x48')](_0x5dda69['query']);_0x3a4d3e['filters']=_[_0x3754('0x36')](_0x3a4d3e['model'],_0x3a4d3e[_0x3754('0x35')]);_0xeeffed['attributes']=_[_0x3754('0x36')](_0x3a4d3e['model'],qs[_0x3754('0x38')](_0x5dda69[_0x3754('0x35')][_0x3754('0x38')]));_0xeeffed[_0x3754('0x37')]=_0xeeffed['attributes']['length']?_0xeeffed['attributes']:_0x3a4d3e[_0x3754('0x34')];if(!_0x5dda69['query']['hasOwnProperty']('nolimit')){_0xeeffed['limit']=qs[_0x3754('0x1b')](_0x5dda69[_0x3754('0x35')][_0x3754('0x1b')]);_0xeeffed[_0x3754('0x19')]=qs['offset'](_0x5dda69[_0x3754('0x35')][_0x3754('0x19')]);}_0xeeffed[_0x3754('0x3c')]=qs[_0x3754('0x3d')](_0x5dda69[_0x3754('0x35')][_0x3754('0x3d')]);_0xeeffed['where']=qs['filters'](_[_0x3754('0x40')](_0x5dda69[_0x3754('0x35')],_0x3a4d3e[_0x3754('0x3f')]));_0xeeffed[_0x3754('0x3e')]['CampaignId']=_0x287028['id'];if(_0x5dda69[_0x3754('0x35')][_0x3754('0x42')]){_0xeeffed[_0x3754('0x3e')]=_['merge'](_0xeeffed[_0x3754('0x3e')],{'$or':_['map'](_0xeeffed[_0x3754('0x37')],function(_0x30499e){var _0x4c4e86={};_0x4c4e86[_0x30499e]={'$like':'%'+_0x5dda69[_0x3754('0x35')][_0x3754('0x42')]+'%'};return _0x4c4e86;})});}_0xeeffed=_[_0x3754('0x41')]({},_0xeeffed,_0x5dda69[_0x3754('0x43')]);return db[_0x3754('0x5e')][_0x3754('0x1c')]({'where':_0xeeffed[_0x3754('0x3e')]})[_0x3754('0x22')](function(_0x491261){_0x2df519[_0x3754('0x1c')]=_0x491261;if(_0x5dda69[_0x3754('0x35')]['includeAll']){_0xeeffed['include']=[{'all':!![]}];}return db[_0x3754('0x5e')]['findAll'](_0xeeffed);})[_0x3754('0x22')](function(_0x2f65bd){_0x2df519['rows']=_0x2f65bd;return _0x2df519;});}})['then'](respondWithFilteredResult(_0x2c3733,_0xeeffed))[_0x3754('0x4a')](handleError(_0x2c3733,null));};exports[_0x3754('0x5f')]=function(_0x2ceb89,_0x5d96f2,_0x66703f){var _0x2c90d1={'raw':!![],'where':{}};var _0x136107={};var _0x11516e={'count':0x0,'rows':[]};return db[_0x3754('0x44')][_0x3754('0x59')]({'where':{'id':_0x2ceb89[_0x3754('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d96f2,null))[_0x3754('0x22')](function(_0x3409ed){if(_0x3409ed){_0x136107['model']=_['keys'](db[_0x3754('0x60')][_0x3754('0x30')]);_0x136107[_0x3754('0x35')]=_[_0x3754('0x48')](_0x2ceb89[_0x3754('0x35')]);_0x136107[_0x3754('0x3f')]=_[_0x3754('0x36')](_0x136107[_0x3754('0x34')],_0x136107[_0x3754('0x35')]);_0x2c90d1[_0x3754('0x37')]=_[_0x3754('0x36')](_0x136107[_0x3754('0x34')],qs[_0x3754('0x38')](_0x2ceb89[_0x3754('0x35')]['fields']));_0x2c90d1['attributes']=_0x2c90d1[_0x3754('0x37')][_0x3754('0x39')]?_0x2c90d1[_0x3754('0x37')]:_0x136107[_0x3754('0x34')];if(!_0x2ceb89[_0x3754('0x35')][_0x3754('0x3a')](_0x3754('0x3b'))){_0x2c90d1[_0x3754('0x1b')]=qs[_0x3754('0x1b')](_0x2ceb89[_0x3754('0x35')]['limit']);_0x2c90d1[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x2ceb89[_0x3754('0x35')][_0x3754('0x19')]);}_0x2c90d1[_0x3754('0x3c')]=qs[_0x3754('0x3d')](_0x2ceb89[_0x3754('0x35')]['sort']);_0x2c90d1[_0x3754('0x3e')]=qs['filters'](_[_0x3754('0x40')](_0x2ceb89[_0x3754('0x35')],_0x136107[_0x3754('0x3f')]));_0x2c90d1[_0x3754('0x3e')][_0x3754('0x5b')]=_0x3409ed['id'];if(_0x2ceb89[_0x3754('0x35')][_0x3754('0x42')]){_0x2c90d1[_0x3754('0x3e')]=_['merge'](_0x2c90d1['where'],{'$or':_['map'](_0x2c90d1[_0x3754('0x37')],function(_0x2f6b4e){var _0x4afb7e={};_0x4afb7e[_0x2f6b4e]={'$like':'%'+_0x2ceb89[_0x3754('0x35')]['filter']+'%'};return _0x4afb7e;})});}_0x2c90d1=_[_0x3754('0x41')]({},_0x2c90d1,_0x2ceb89[_0x3754('0x43')]);return db[_0x3754('0x60')][_0x3754('0x1c')]({'where':_0x2c90d1[_0x3754('0x3e')]})['then'](function(_0x4025e0){_0x11516e['count']=_0x4025e0;if(_0x2ceb89[_0x3754('0x35')][_0x3754('0x45')]){_0x2c90d1[_0x3754('0x61')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3754('0x5c')](_0x2c90d1);})[_0x3754('0x22')](function(_0x53d0b7){_0x11516e['rows']=_0x53d0b7;return _0x11516e;});}})[_0x3754('0x22')](respondWithFilteredResult(_0x5d96f2,_0x2c90d1))[_0x3754('0x4a')](handleError(_0x5d96f2,null));};exports['getHopperBlacks']=function(_0x5665d5,_0x2a48ce,_0x5f1a4d){var _0x23b949={'raw':!![],'where':{}};var _0x3b2249={};var _0x50b74a={'count':0x0,'rows':[]};return db['Campaign'][_0x3754('0x59')]({'where':{'id':_0x5665d5['params']['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x2a48ce,null))[_0x3754('0x22')](function(_0x4b3810){if(_0x4b3810){_0x3b2249[_0x3754('0x34')]=_[_0x3754('0x48')](db['CmHopperBlack'][_0x3754('0x30')]);_0x3b2249[_0x3754('0x35')]=_[_0x3754('0x48')](_0x5665d5[_0x3754('0x35')]);_0x3b2249[_0x3754('0x3f')]=_[_0x3754('0x36')](_0x3b2249[_0x3754('0x34')],_0x3b2249['query']);_0x23b949[_0x3754('0x37')]=_[_0x3754('0x36')](_0x3b2249[_0x3754('0x34')],qs[_0x3754('0x38')](_0x5665d5[_0x3754('0x35')][_0x3754('0x38')]));_0x23b949['attributes']=_0x23b949[_0x3754('0x37')][_0x3754('0x39')]?_0x23b949[_0x3754('0x37')]:_0x3b2249[_0x3754('0x34')];if(!_0x5665d5['query'][_0x3754('0x3a')]('nolimit')){_0x23b949[_0x3754('0x1b')]=qs[_0x3754('0x1b')](_0x5665d5[_0x3754('0x35')][_0x3754('0x1b')]);_0x23b949[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x5665d5['query'][_0x3754('0x19')]);}_0x23b949['order']=qs[_0x3754('0x3d')](_0x5665d5[_0x3754('0x35')][_0x3754('0x3d')]);_0x23b949[_0x3754('0x3e')]=qs['filters'](_['pick'](_0x5665d5['query'],_0x3b2249[_0x3754('0x3f')]));_0x23b949[_0x3754('0x3e')][_0x3754('0x5b')]=_0x4b3810['id'];if(_0x5665d5[_0x3754('0x35')]['filter']){_0x23b949[_0x3754('0x3e')]=_['merge'](_0x23b949['where'],{'$or':_[_0x3754('0x2f')](_0x23b949[_0x3754('0x37')],function(_0x1b43d9){var _0x51374c={};_0x51374c[_0x1b43d9]={'$like':'%'+_0x5665d5[_0x3754('0x35')][_0x3754('0x42')]+'%'};return _0x51374c;})});}_0x23b949=_[_0x3754('0x41')]({},_0x23b949,_0x5665d5[_0x3754('0x43')]);return db[_0x3754('0x62')][_0x3754('0x1c')]({'where':_0x23b949['where']})[_0x3754('0x22')](function(_0x239b57){_0x50b74a[_0x3754('0x1c')]=_0x239b57;if(_0x5665d5['query'][_0x3754('0x45')]){_0x23b949[_0x3754('0x61')]=[{'all':!![]}];}return db[_0x3754('0x62')][_0x3754('0x5c')](_0x23b949);})[_0x3754('0x22')](function(_0x40c5f9){_0x50b74a[_0x3754('0x46')]=_0x40c5f9;return _0x50b74a;});}})['then'](respondWithFilteredResult(_0x2a48ce,_0x23b949))[_0x3754('0x4a')](handleError(_0x2a48ce,null));};exports[_0x3754('0x63')]=function(_0x27a6a2,_0x5adb27,_0x4501fc){var _0x9aa437={};var _0x4f8ade={};var _0x239a2d;var _0x480e8b;return db[_0x3754('0x44')][_0x3754('0x59')]({'where':{'id':_0x27a6a2[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x5adb27,null))['then'](function(_0xc1a9){if(_0xc1a9){_0x239a2d=_0xc1a9;_0x4f8ade[_0x3754('0x34')]=_['keys'](db[_0x3754('0x64')][_0x3754('0x30')]);_0x4f8ade[_0x3754('0x35')]=_[_0x3754('0x48')](_0x27a6a2[_0x3754('0x35')]);_0x4f8ade[_0x3754('0x3f')]=_['intersection'](_0x4f8ade[_0x3754('0x34')],_0x4f8ade['query']);_0x9aa437[_0x3754('0x37')]=_[_0x3754('0x36')](_0x4f8ade['model'],qs['fields'](_0x27a6a2[_0x3754('0x35')]['fields']));_0x9aa437['attributes']=_0x9aa437[_0x3754('0x37')][_0x3754('0x39')]?_0x9aa437[_0x3754('0x37')]:_0x4f8ade['model'];_0x9aa437[_0x3754('0x3c')]=qs[_0x3754('0x3d')](_0x27a6a2[_0x3754('0x35')][_0x3754('0x3d')]);_0x9aa437['where']=qs['filters'](_[_0x3754('0x40')](_0x27a6a2[_0x3754('0x35')],_0x4f8ade[_0x3754('0x3f')]));if(_0x27a6a2['query'][_0x3754('0x42')]){_0x9aa437['where']=_[_0x3754('0x41')](_0x9aa437[_0x3754('0x3e')],{'$or':_[_0x3754('0x2f')](_0x9aa437[_0x3754('0x37')],function(_0x24398c){var _0x33ee06={};_0x33ee06[_0x24398c]={'$like':'%'+_0x27a6a2[_0x3754('0x35')][_0x3754('0x42')]+'%'};return _0x33ee06;})});}_0x9aa437=_['merge']({},_0x9aa437,_0x27a6a2[_0x3754('0x43')]);return _0x239a2d[_0x3754('0x63')](_0x9aa437);}})[_0x3754('0x22')](function(_0x35c428){if(_0x35c428){_0x480e8b=_0x35c428[_0x3754('0x39')];if(!_0x27a6a2[_0x3754('0x35')][_0x3754('0x3a')]('nolimit')){_0x9aa437[_0x3754('0x1b')]=qs[_0x3754('0x1b')](_0x27a6a2[_0x3754('0x35')][_0x3754('0x1b')]);_0x9aa437[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x27a6a2[_0x3754('0x35')]['offset']);}return _0x239a2d[_0x3754('0x63')](_0x9aa437);}})[_0x3754('0x22')](function(_0x454664){if(_0x454664){return _0x454664?{'count':_0x480e8b,'rows':_0x454664}:null;}})[_0x3754('0x22')](respondWithResult(_0x5adb27,null))[_0x3754('0x4a')](handleError(_0x5adb27,null));};exports[_0x3754('0x65')]=function(_0x459c3d,_0xb4a03b,_0x56947a){var _0x3f6b0c,_0xf4d907;var _0x1d906a=[];var _0x18f7fa=moment()[_0x3754('0x66')](_0x3754('0x67'));return db['Campaign']['find']({'where':{'id':_0x459c3d[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0xb4a03b,null))[_0x3754('0x22')](function(_0x13bed4){if(_0x13bed4){_0xf4d907=_0x13bed4;return _0x13bed4[_0x3754('0x65')](_0x459c3d[_0x3754('0x4c')]['ids'],_[_0x3754('0x53')](_0x459c3d[_0x3754('0x4c')],[_0x3754('0x68'),'id'])||{});}return null;})[_0x3754('0x69')](function(_0x5a4e12){var _0x24e85a;var _0x487f75;_0x3f6b0c=_0x5a4e12||[];var _0x101fa8=[];if(_0x5a4e12){for(var _0x4f4a9f=0x0;_0x4f4a9f<_0x5a4e12['length'];_0x4f4a9f+=0x1){var _0x472e03=_0x5a4e12[_0x4f4a9f]['get']({'plain':!![]});_0xf4d907['dialCheckDuplicateType']=_0x459c3d[_0x3754('0x4c')]['dialCheckDuplicateType']?_0x459c3d[_0x3754('0x4c')][_0x3754('0x6a')]:_0xf4d907[_0x3754('0x6a')];switch(_0xf4d907[_0x3754('0x6a')]){case'always':_0x24e85a=squel['insert']()[_0x3754('0x6b')](_0x3754('0x6c'))['fromQuery'](['phone',_0x3754('0x6d'),_0x3754('0x6e'),_0x3754('0x6f'),_0x3754('0x5b'),_0x3754('0x54'),_0x3754('0x55')],squel[_0x3754('0x70')]()[_0x3754('0x71')](_0x3754('0x72'),'phone')[_0x3754('0x71')]('NOW()','scheduledAt')[_0x3754('0x71')]('id',_0x3754('0x6e'))[_0x3754('0x71')](_0x472e03[_0x3754('0x73')][_0x3754('0x74')](),_0x3754('0x6f'))[_0x3754('0x71')](_0x459c3d[_0x3754('0x47')]['id'][_0x3754('0x74')](),_0x3754('0x5b'))[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27','createdAt')['field']('\x27'+_0x18f7fa+'\x27',_0x3754('0x55'))[_0x3754('0x75')](_0x3754('0x76'))[_0x3754('0x3e')](_0x3754('0x77'))[_0x3754('0x3e')]('ListId\x20=\x20?',_0x472e03[_0x3754('0x73')][_0x3754('0x74')]())[_0x3754('0x3e')](_0x3754('0x78'))['where'](_0x3754('0x79'),squel['select']()[_0x3754('0x71')](_0x3754('0x7a'))[_0x3754('0x75')](_0x3754('0x7b'))[_0x3754('0x3e')]('CampaignId\x20=\x20?',_0x459c3d['params']['id']['toString']()))[_0x3754('0x3e')](_0x3754('0x79'),squel['select']()[_0x3754('0x71')](_0x3754('0x7c'))[_0x3754('0x75')](_0x3754('0x6c'))[_0x3754('0x3e')]('CampaignId\x20=\x20?',_0x459c3d[_0x3754('0x47')]['id'][_0x3754('0x74')]())))[_0x3754('0x74')]();break;case'onlyIfOpen':_0x24e85a=squel[_0x3754('0x7d')]()[_0x3754('0x6b')]('cm_hopper')[_0x3754('0x7e')]([_0x3754('0x72'),_0x3754('0x6d'),_0x3754('0x6e'),_0x3754('0x6f'),_0x3754('0x5b'),_0x3754('0x54'),_0x3754('0x55')],squel[_0x3754('0x70')]()['field'](_0x3754('0x72'),_0x3754('0x72'))[_0x3754('0x71')](_0x3754('0x7f'),'scheduledAt')['field']('id',_0x3754('0x6e'))['field'](_0x472e03['CmListId'][_0x3754('0x74')](),_0x3754('0x6f'))[_0x3754('0x71')](_0x459c3d[_0x3754('0x47')]['id']['toString'](),'CampaignId')[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27',_0x3754('0x54'))['field']('\x27'+_0x18f7fa+'\x27',_0x3754('0x55'))[_0x3754('0x75')](_0x3754('0x76'))[_0x3754('0x3e')](_0x3754('0x77'))[_0x3754('0x3e')](_0x3754('0x80'),_0x472e03[_0x3754('0x73')]['toString']())[_0x3754('0x3e')](_0x3754('0x78'))[_0x3754('0x3e')](_0x3754('0x79'),squel[_0x3754('0x70')]()[_0x3754('0x71')](_0x3754('0x7c'))['from'](_0x3754('0x6c'))[_0x3754('0x3e')]('CampaignId\x20=\x20?',_0x459c3d['params']['id'][_0x3754('0x74')]())))[_0x3754('0x74')]();break;default:_0x24e85a=squel[_0x3754('0x7d')]()[_0x3754('0x6b')](_0x3754('0x6c'))['fromQuery']([_0x3754('0x72'),_0x3754('0x6d'),_0x3754('0x6e'),_0x3754('0x6f'),_0x3754('0x5b'),'createdAt',_0x3754('0x55')],squel['select']()[_0x3754('0x71')](_0x3754('0x72'),_0x3754('0x72'))['field'](_0x3754('0x7f'),_0x3754('0x6d'))[_0x3754('0x71')]('id','ContactId')['field'](_0x472e03[_0x3754('0x73')]['toString'](),_0x3754('0x6f'))['field'](_0x459c3d['params']['id'][_0x3754('0x74')](),_0x3754('0x5b'))[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27',_0x3754('0x54'))[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27',_0x3754('0x55'))[_0x3754('0x75')](_0x3754('0x76'))[_0x3754('0x3e')]('deletedAt\x20IS\x20NULL')[_0x3754('0x3e')](_0x3754('0x80'),_0x472e03['CmListId'][_0x3754('0x74')]())['where'](_0x3754('0x78')))[_0x3754('0x74')]();}_0x487f75=squel[_0x3754('0x7d')]()[_0x3754('0x6b')]('cm_hopper_additional_phones')['fromQuery']([_0x3754('0x81'),_0x3754('0x6d'),_0x3754('0x72'),_0x3754('0x82'),'createdAt','updatedAt'],squel[_0x3754('0x70')]()[_0x3754('0x71')]('h.id','id')[_0x3754('0x71')](_0x3754('0x7f'),'scheduledAt')['field']('ci.item',_0x3754('0x72'))[_0x3754('0x71')](_0x3754('0x83'),_0x3754('0x82'))[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27',_0x3754('0x54'))[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27',_0x3754('0x55'))[_0x3754('0x75')](_0x3754('0x84'),'ci')[_0x3754('0x85')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x3754('0x3e')]('h.ListId\x20=\x20?',_0x472e03[_0x3754('0x73')][_0x3754('0x74')]())[_0x3754('0x3e')](_0x3754('0x86'),_0x459c3d[_0x3754('0x47')]['id']['toString']())[_0x3754('0x3e')](_0x3754('0x87'),_0x18f7fa))[_0x3754('0x74')]();_0x101fa8[_0x3754('0x88')](db[_0x3754('0x89')][_0x3754('0x35')](_0x24e85a));_0x1d906a[_0x3754('0x88')](db[_0x3754('0x89')][_0x3754('0x35')](_0x487f75));}return BPromise['all'](_0x101fa8);}})[_0x3754('0x22')](function(){return BPromise[_0x3754('0x8a')](_0x1d906a);})[_0x3754('0x22')](function(){return _0x3f6b0c;})['then'](respondWithResult(_0xb4a03b,null))[_0x3754('0x4a')](handleError(_0xb4a03b,null));};exports['removeLists']=function(_0xed1e23,_0x33f9ac,_0x104c22){return db[_0x3754('0x44')][_0x3754('0x49')]({'where':{'id':_0xed1e23['params']['id']}})['then'](handleEntityNotFound(_0x33f9ac,null))[_0x3754('0x22')](function(_0x4f2436){if(_0x4f2436){return _0x4f2436['removeLists'](_0xed1e23[_0x3754('0x35')][_0x3754('0x68')]);}})[_0x3754('0x22')](function(_0x5580a0){if(_0x5580a0){return db[_0x3754('0x5a')]['destroy']({'where':{'ListId':_0xed1e23[_0x3754('0x35')][_0x3754('0x68')],'CampaignId':_0xed1e23['params']['id']}})[_0x3754('0x22')](function(){return _0x5580a0;});}})[_0x3754('0x22')](respondWithStatusCode(_0x33f9ac,null))[_0x3754('0x4a')](handleError(_0x33f9ac,null));};exports['getBlackLists']=function(_0x32a77e,_0x332db5,_0x4c5979){var _0x49c99b={};var _0x337729={};var _0x54edb3;var _0x59c5f3;return db[_0x3754('0x44')][_0x3754('0x59')]({'where':{'id':_0x32a77e[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x332db5,null))['then'](function(_0x3820ef){if(_0x3820ef){_0x54edb3=_0x3820ef;_0x337729[_0x3754('0x34')]=_[_0x3754('0x48')](db[_0x3754('0x64')][_0x3754('0x30')]);_0x337729[_0x3754('0x35')]=_[_0x3754('0x48')](_0x32a77e[_0x3754('0x35')]);_0x337729[_0x3754('0x3f')]=_['intersection'](_0x337729[_0x3754('0x34')],_0x337729[_0x3754('0x35')]);_0x49c99b[_0x3754('0x37')]=_['intersection'](_0x337729[_0x3754('0x34')],qs[_0x3754('0x38')](_0x32a77e[_0x3754('0x35')][_0x3754('0x38')]));_0x49c99b[_0x3754('0x37')]=_0x49c99b['attributes'][_0x3754('0x39')]?_0x49c99b['attributes']:_0x337729['model'];_0x49c99b[_0x3754('0x3c')]=qs[_0x3754('0x3d')](_0x32a77e[_0x3754('0x35')][_0x3754('0x3d')]);_0x49c99b[_0x3754('0x3e')]=qs['filters'](_[_0x3754('0x40')](_0x32a77e['query'],_0x337729['filters']));if(_0x32a77e['query'][_0x3754('0x42')]){_0x49c99b[_0x3754('0x3e')]=_[_0x3754('0x41')](_0x49c99b['where'],{'$or':_['map'](_0x49c99b[_0x3754('0x37')],function(_0x3f2448){var _0x275cc0={};_0x275cc0[_0x3f2448]={'$like':'%'+_0x32a77e['query'][_0x3754('0x42')]+'%'};return _0x275cc0;})});}_0x49c99b=_[_0x3754('0x41')]({},_0x49c99b,_0x32a77e[_0x3754('0x43')]);return _0x54edb3[_0x3754('0x8b')](_0x49c99b);}})[_0x3754('0x22')](function(_0x47f680){if(_0x47f680){_0x59c5f3=_0x47f680['length'];if(!_0x32a77e['query'][_0x3754('0x3a')](_0x3754('0x3b'))){_0x49c99b[_0x3754('0x1b')]=qs[_0x3754('0x1b')](_0x32a77e[_0x3754('0x35')][_0x3754('0x1b')]);_0x49c99b[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x32a77e[_0x3754('0x35')][_0x3754('0x19')]);}return _0x54edb3[_0x3754('0x8b')](_0x49c99b);}})['then'](function(_0x349e62){if(_0x349e62){return _0x349e62?{'count':_0x59c5f3,'rows':_0x349e62}:null;}})[_0x3754('0x22')](respondWithResult(_0x332db5,null))[_0x3754('0x4a')](handleError(_0x332db5,null));};exports[_0x3754('0x8c')]=function(_0x15dbd4,_0x3ca8f2,_0x1d5560){var _0x1d4776,_0xdebc6c;var _0x5edf22=[];var _0x1a8d1d=moment()[_0x3754('0x66')](_0x3754('0x67'));return db[_0x3754('0x44')][_0x3754('0x49')]({'where':{'id':_0x15dbd4[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x3ca8f2,null))[_0x3754('0x22')](function(_0x9357c2){if(_0x9357c2){_0xdebc6c=_0x9357c2;return _0x9357c2[_0x3754('0x8c')](_0x15dbd4[_0x3754('0x4c')][_0x3754('0x68')],_[_0x3754('0x53')](_0x15dbd4[_0x3754('0x4c')],['ids','id'])||{});}return null;})['spread'](function(_0x5215bc){var _0x2ccd63;var _0x39c621;_0x1d4776=_0x5215bc||[];var _0x5150fc=[];if(_0x5215bc){for(var _0xd77e01=0x0;_0xd77e01<_0x5215bc[_0x3754('0x39')];_0xd77e01+=0x1){var _0x31e5f4=_0x5215bc[_0xd77e01][_0x3754('0x24')]({'plain':!![]});_0x2ccd63=squel['insert']()[_0x3754('0x6b')](_0x3754('0x8d'))['fromQuery'](['phone','ContactId','ListId',_0x3754('0x5b'),'createdAt',_0x3754('0x55')],squel[_0x3754('0x70')]()['field'](_0x3754('0x72'),'phone')[_0x3754('0x71')]('id',_0x3754('0x6e'))[_0x3754('0x71')](_0x31e5f4['CmListId']['toString'](),_0x3754('0x6f'))[_0x3754('0x71')](_0x15dbd4[_0x3754('0x47')]['id'][_0x3754('0x74')](),'CampaignId')[_0x3754('0x71')](_0x3754('0x7f'),_0x3754('0x54'))[_0x3754('0x71')](_0x3754('0x7f'),'updatedAt')[_0x3754('0x75')](_0x3754('0x76'))['where'](_0x3754('0x77'))[_0x3754('0x3e')](_0x3754('0x80'),_0x31e5f4['CmListId']['toString']())['where'](_0x3754('0x78')))[_0x3754('0x74')]();_0x5150fc[_0x3754('0x88')](db[_0x3754('0x89')][_0x3754('0x35')](_0x2ccd63));}return BPromise['all'](_0x5150fc);}})[_0x3754('0x22')](function(){return _0x1d4776;})['then'](respondWithResult(_0x3ca8f2,null))[_0x3754('0x4a')](handleError(_0x3ca8f2,null));};exports[_0x3754('0x8e')]=function(_0x4fa2fa,_0x294b20,_0x526138){return db['Campaign']['find']({'where':{'id':_0x4fa2fa['params']['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x294b20,null))[_0x3754('0x22')](function(_0x2aff7c){if(_0x2aff7c){return _0x2aff7c[_0x3754('0x8e')](_0x4fa2fa[_0x3754('0x35')][_0x3754('0x68')]);}})[_0x3754('0x22')](function(_0x5f04f0){if(_0x5f04f0){return db['CmHopperBlack'][_0x3754('0x23')]({'where':{'ListId':_0x4fa2fa[_0x3754('0x35')][_0x3754('0x68')],'CampaignId':_0x4fa2fa['params']['id']}})[_0x3754('0x22')](function(){return _0x5f04f0;});}})[_0x3754('0x22')](respondWithStatusCode(_0x294b20,null))['catch'](handleError(_0x294b20,null));}; \ No newline at end of file +var _0x0431=['path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','sendStatus','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','role','IvrCampaigns','userProfileId','autoAssociation','UserProfileResource','clone','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','ids','omit','dialCheckDuplicateType','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x5d1b3c,_0x41945e){var _0x45176a=function(_0x3a3789){while(--_0x3a3789){_0x5d1b3c['push'](_0x5d1b3c['shift']());}};_0x45176a(++_0x41945e);}(_0x0431,0x11d));var _0x1043=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x0431[_0x57486e];return _0x5f110b;};'use strict';var emlformat=require(_0x1043('0x0'));var rimraf=require(_0x1043('0x1'));var zipdir=require(_0x1043('0x2'));var jsonpatch=require(_0x1043('0x3'));var rp=require(_0x1043('0x4'));var moment=require('moment');var BPromise=require(_0x1043('0x5'));var Mustache=require(_0x1043('0x6'));var util=require('util');var path=require(_0x1043('0x7'));var sox=require(_0x1043('0x8'));var csv=require(_0x1043('0x9'));var ejs=require(_0x1043('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1043('0xb'));var squel=require('squel');var crypto=require(_0x1043('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1043('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1043('0xe'));var Papa=require(_0x1043('0xf'));var Redis=require(_0x1043('0x10'));var authService=require(_0x1043('0x11'));var qs=require(_0x1043('0x12'));var as=require(_0x1043('0x13'));var hardwareService=require(_0x1043('0x14'));var logger=require(_0x1043('0x15'))('api');var utils=require(_0x1043('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1043('0x17'))['db'];function respondWithStatusCode(_0x17676f,_0x1f5d6a){_0x1f5d6a=_0x1f5d6a||0xcc;return function(_0x42a054){if(_0x42a054){return _0x17676f['sendStatus'](_0x1f5d6a);}return _0x17676f[_0x1043('0x18')](_0x1f5d6a)[_0x1043('0x19')]();};}function respondWithResult(_0x58408b,_0x55f143){_0x55f143=_0x55f143||0xc8;return function(_0x5759fe){if(_0x5759fe){return _0x58408b[_0x1043('0x18')](_0x55f143)[_0x1043('0x1a')](_0x5759fe);}};}function respondWithFilteredResult(_0xbdf462,_0x4255a7){return function(_0x2bb5ca){if(_0x2bb5ca){var _0x12535a=typeof _0x4255a7[_0x1043('0x1b')]===_0x1043('0x1c')&&typeof _0x4255a7[_0x1043('0x1d')]==='undefined';var _0x4a1b59=_0x2bb5ca['count'];var _0x16510a=_0x12535a?0x0:_0x4255a7[_0x1043('0x1b')];var _0x1a58e0=_0x12535a?_0x2bb5ca['count']:_0x4255a7[_0x1043('0x1b')]+_0x4255a7['limit'];var _0x284725;if(_0x1a58e0>=_0x4a1b59){_0x1a58e0=_0x4a1b59;_0x284725=0xc8;}else{_0x284725=0xce;}_0xbdf462[_0x1043('0x18')](_0x284725);return _0xbdf462[_0x1043('0x1e')](_0x1043('0x1f'),_0x16510a+'-'+_0x1a58e0+'/'+_0x4a1b59)[_0x1043('0x1a')](_0x2bb5ca);}return null;};}function patchUpdates(_0x5dbf75){return function(_0x490fba){try{jsonpatch[_0x1043('0x20')](_0x490fba,_0x5dbf75,!![]);}catch(_0x1fc51c){return BPromise[_0x1043('0x21')](_0x1fc51c);}return _0x490fba[_0x1043('0x22')]();};}function saveUpdates(_0x57e612,_0x3f53b8){return function(_0x484180){if(_0x484180){return _0x484180[_0x1043('0x23')](_0x57e612)['then'](function(_0x128941){return _0x128941;});}return null;};}function removeEntity(_0xedc199,_0x2853d4){return function(_0xdfc1d6){if(_0xdfc1d6){return _0xdfc1d6[_0x1043('0x24')]()[_0x1043('0x25')](function(){var _0x568ae0=_0xdfc1d6[_0x1043('0x26')]({'plain':!![]});var _0x46edf4='IvrCampaigns';return db['UserProfileResource'][_0x1043('0x24')]({'where':{'type':_0x46edf4,'resourceId':_0x568ae0['id']}})['then'](function(){return _0xdfc1d6;});})[_0x1043('0x25')](function(){_0xedc199[_0x1043('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2453ed,_0x36590b){return function(_0xb9b548){if(!_0xb9b548){_0x2453ed[_0x1043('0x27')](0x194);}return _0xb9b548;};}function handleError(_0x15adf3,_0x286e5e){_0x286e5e=_0x286e5e||0x1f4;return function(_0x3d5426){logger[_0x1043('0x28')](_0x3d5426[_0x1043('0x29')]);if(_0x3d5426[_0x1043('0x2a')]){delete _0x3d5426[_0x1043('0x2a')];}_0x15adf3[_0x1043('0x18')](_0x286e5e)[_0x1043('0x2b')](_0x3d5426);};}exports[_0x1043('0x2c')]=function(_0x1fe638,_0x20fd56){var _0x5496ea={},_0x5de70c={},_0x1865e5={'count':0x0,'rows':[]};var _0x4624ae=_[_0x1043('0x2d')](db[_0x1043('0x2e')][_0x1043('0x2f')],function(_0xe51897){return{'name':_0xe51897[_0x1043('0x30')],'type':_0xe51897[_0x1043('0x31')][_0x1043('0x32')]};});_0x5de70c[_0x1043('0x33')]=_[_0x1043('0x2d')](_0x4624ae,_0x1043('0x2a'));_0x5de70c[_0x1043('0x34')]=_[_0x1043('0x35')](_0x1fe638[_0x1043('0x34')]);_0x5de70c[_0x1043('0x36')]=_[_0x1043('0x37')](_0x5de70c[_0x1043('0x33')],_0x5de70c[_0x1043('0x34')]);_0x5496ea[_0x1043('0x38')]=_['intersection'](_0x5de70c[_0x1043('0x33')],qs[_0x1043('0x39')](_0x1fe638[_0x1043('0x34')][_0x1043('0x39')]));_0x5496ea[_0x1043('0x38')]=_0x5496ea[_0x1043('0x38')][_0x1043('0x3a')]?_0x5496ea['attributes']:_0x5de70c['model'];if(!_0x1fe638['query'][_0x1043('0x3b')](_0x1043('0x3c'))){_0x5496ea[_0x1043('0x1d')]=qs['limit'](_0x1fe638[_0x1043('0x34')][_0x1043('0x1d')]);_0x5496ea[_0x1043('0x1b')]=qs[_0x1043('0x1b')](_0x1fe638[_0x1043('0x34')]['offset']);}_0x5496ea[_0x1043('0x3d')]=qs[_0x1043('0x3e')](_0x1fe638[_0x1043('0x34')]['sort']);_0x5496ea[_0x1043('0x3f')]=qs[_0x1043('0x36')](_[_0x1043('0x40')](_0x1fe638[_0x1043('0x34')],_0x5de70c[_0x1043('0x36')]),_0x4624ae);if(_0x1fe638[_0x1043('0x34')][_0x1043('0x41')]){_0x5496ea[_0x1043('0x3f')]=_[_0x1043('0x42')](_0x5496ea[_0x1043('0x3f')],{'$or':_[_0x1043('0x2d')](_0x4624ae,function(_0x28cfad){if(_0x28cfad[_0x1043('0x31')]!=='VIRTUAL'){var _0x2b502e={};_0x2b502e[_0x28cfad[_0x1043('0x2a')]]={'$like':'%'+_0x1fe638[_0x1043('0x34')][_0x1043('0x41')]+'%'};return _0x2b502e;}})});}_0x5496ea=_['merge']({},_0x5496ea,_0x1fe638['options']);var _0x44aaa9={'where':_0x5496ea['where']};return db[_0x1043('0x2e')]['count'](_0x44aaa9)[_0x1043('0x25')](function(_0x39d04a){_0x1865e5[_0x1043('0x43')]=_0x39d04a;if(_0x1fe638[_0x1043('0x34')][_0x1043('0x44')]){_0x5496ea[_0x1043('0x45')]=[{'all':!![]}];}return db['Campaign'][_0x1043('0x46')](_0x5496ea);})['then'](function(_0x4c5cfb){_0x1865e5[_0x1043('0x47')]=_0x4c5cfb;return _0x1865e5;})['then'](respondWithFilteredResult(_0x20fd56,_0x5496ea))[_0x1043('0x48')](handleError(_0x20fd56,null));};exports['show']=function(_0x354d30,_0x293fc2){var _0x497c18={'raw':![],'where':{'id':_0x354d30[_0x1043('0x49')]['id']}},_0x445d79={};_0x445d79[_0x1043('0x33')]=_[_0x1043('0x35')](db[_0x1043('0x2e')][_0x1043('0x2f')]);_0x445d79[_0x1043('0x34')]=_[_0x1043('0x35')](_0x354d30[_0x1043('0x34')]);_0x445d79['filters']=_[_0x1043('0x37')](_0x445d79['model'],_0x445d79['query']);_0x497c18['attributes']=_['intersection'](_0x445d79[_0x1043('0x33')],qs[_0x1043('0x39')](_0x354d30[_0x1043('0x34')]['fields']));_0x497c18[_0x1043('0x38')]=_0x497c18[_0x1043('0x38')]['length']?_0x497c18[_0x1043('0x38')]:_0x445d79[_0x1043('0x33')];if(_0x354d30[_0x1043('0x34')][_0x1043('0x44')]){_0x497c18[_0x1043('0x45')]=[{'all':!![]}];}_0x497c18=_[_0x1043('0x42')]({},_0x497c18,_0x354d30[_0x1043('0x4a')]);return db[_0x1043('0x2e')][_0x1043('0x4b')](_0x497c18)['then'](handleEntityNotFound(_0x293fc2,null))[_0x1043('0x25')](respondWithResult(_0x293fc2,null))[_0x1043('0x48')](handleError(_0x293fc2,null));};exports[_0x1043('0x4c')]=function(_0x3db714,_0x133ee7){return db['Campaign'][_0x1043('0x4c')](_0x3db714[_0x1043('0x4d')],{})[_0x1043('0x25')](function(_0x580fd1){var _0x2ec7dc=_0x3db714[_0x1043('0x4e')][_0x1043('0x26')]({'plain':!![]});if(!_0x2ec7dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ec7dc[_0x1043('0x4f')]===_0x1043('0x4e')){var _0x19b65b=_0x580fd1[_0x1043('0x26')]({'plain':!![]});var _0x144820=_0x1043('0x50');return db['UserProfileSection'][_0x1043('0x4b')]({'where':{'name':_0x144820,'userProfileId':_0x2ec7dc[_0x1043('0x51')]},'raw':!![]})[_0x1043('0x25')](function(_0x216d71){if(_0x216d71&&_0x216d71[_0x1043('0x52')]===0x0){return db[_0x1043('0x53')][_0x1043('0x4c')]({'name':_0x19b65b[_0x1043('0x2a')],'resourceId':_0x19b65b['id'],'type':_0x216d71[_0x1043('0x2a')],'sectionId':_0x216d71['id']},{})[_0x1043('0x25')](function(){return _0x580fd1;});}else{return _0x580fd1;}})[_0x1043('0x48')](function(_0x50ec41){logger[_0x1043('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ec41);throw _0x50ec41;});}return _0x580fd1;})[_0x1043('0x25')](respondWithResult(_0x133ee7,0xc9))[_0x1043('0x48')](handleError(_0x133ee7,null));};exports[_0x1043('0x54')]=function(_0x3909d3,_0x4aff90){var _0x4bcd21={'where':{'id':_0x3909d3[_0x1043('0x49')]['id']}},_0x1e5d49={};_0x1e5d49[_0x1043('0x33')]=_[_0x1043('0x35')](db[_0x1043('0x2e')][_0x1043('0x2f')]);_0x4bcd21['attributes']=_[_0x1043('0x37')](_0x1e5d49[_0x1043('0x33')],qs[_0x1043('0x39')](_0x3909d3[_0x1043('0x34')][_0x1043('0x39')]));_0x4bcd21[_0x1043('0x38')]=_0x4bcd21[_0x1043('0x38')][_0x1043('0x3a')]?_0x4bcd21['attributes']:_0x1e5d49['model'];if(_0x3909d3[_0x1043('0x34')][_0x1043('0x44')]){_0x4bcd21[_0x1043('0x45')]=[{'all':!![]}];}_0x4bcd21=_[_0x1043('0x42')]({},_0x4bcd21,_0x3909d3[_0x1043('0x4a')]);return db[_0x1043('0x2e')][_0x1043('0x4b')](_0x4bcd21)[_0x1043('0x25')](handleEntityNotFound(_0x4aff90,null))[_0x1043('0x25')](function(_0x5464b0){if(_0x5464b0){var _0x1bac61=_0x5464b0['get']({'plain':!![]});_0x1bac61=qs['omit'](_0x1bac61,['id',_0x1043('0x55'),_0x1043('0x56')]);_0x3909d3['body']=_['omit'](_0x3909d3[_0x1043('0x4d')],['id','createdAt',_0x1043('0x56')]);return db[_0x1043('0x2e')][_0x1043('0x4c')](_[_0x1043('0x42')](_0x1bac61,_0x3909d3[_0x1043('0x4d')]),{'include':_0x3909d3[_0x1043('0x34')][_0x1043('0x44')]?[{'all':!![]}]:undefined})[_0x1043('0x25')](function(_0x3b6f4e){var _0x1d1997=_0x3909d3[_0x1043('0x4e')][_0x1043('0x26')]({'plain':!![]});if(!_0x1d1997)throw new Error(_0x1043('0x57'));if(_0x1d1997[_0x1043('0x4f')]===_0x1043('0x4e')){var _0x352504=_0x3b6f4e[_0x1043('0x26')]({'plain':!![]});var _0x354ff0=_0x1043('0x50');return db[_0x1043('0x58')][_0x1043('0x4b')]({'where':{'name':_0x354ff0,'userProfileId':_0x1d1997['userProfileId']},'raw':!![]})['then'](function(_0x1ed4ba){if(_0x1ed4ba&&_0x1ed4ba['autoAssociation']===0x0){return db[_0x1043('0x53')][_0x1043('0x4c')]({'name':_0x352504[_0x1043('0x2a')],'resourceId':_0x352504['id'],'type':_0x1ed4ba[_0x1043('0x2a')],'sectionId':_0x1ed4ba['id']},{})[_0x1043('0x25')](function(){return _0x3b6f4e;});}else{return _0x3b6f4e;}})[_0x1043('0x48')](function(_0x3801d7){logger[_0x1043('0x28')](_0x1043('0x59'),_0x3801d7);throw _0x3801d7;});}return _0x3b6f4e;});}})[_0x1043('0x25')](respondWithResult(_0x4aff90,0xc9))[_0x1043('0x48')](handleError(_0x4aff90,null));};exports['update']=function(_0x34e449,_0x246eaf){if(_0x34e449[_0x1043('0x4d')]['id']){delete _0x34e449['body']['id'];}return db[_0x1043('0x2e')]['find']({'where':{'id':_0x34e449[_0x1043('0x49')]['id']}})['then'](handleEntityNotFound(_0x246eaf,null))[_0x1043('0x25')](saveUpdates(_0x34e449[_0x1043('0x4d')],null))[_0x1043('0x25')](respondWithResult(_0x246eaf,null))[_0x1043('0x48')](handleError(_0x246eaf,null));};exports[_0x1043('0x24')]=function(_0x533fe7,_0x2980fb){return db[_0x1043('0x2e')][_0x1043('0x4b')]({'where':{'id':_0x533fe7[_0x1043('0x49')]['id']}})[_0x1043('0x25')](handleEntityNotFound(_0x2980fb,null))[_0x1043('0x25')](removeEntity(_0x2980fb,null))[_0x1043('0x48')](handleError(_0x2980fb,null));};exports[_0x1043('0x5a')]=function(_0x437126,_0x5e959e,_0x36c5ae){var _0x5a14d5={'raw':!![],'where':{}};var _0x47028f={};var _0x2142c4={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x437126[_0x1043('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e959e,null))[_0x1043('0x25')](function(_0x41719a){if(_0x41719a){_0x47028f[_0x1043('0x33')]=_['keys'](db[_0x1043('0x5b')][_0x1043('0x2f')]);_0x47028f[_0x1043('0x34')]=_['keys'](_0x437126[_0x1043('0x34')]);_0x47028f['filters']=_[_0x1043('0x37')](_0x47028f[_0x1043('0x33')],_0x47028f[_0x1043('0x34')]);_0x5a14d5[_0x1043('0x38')]=_[_0x1043('0x37')](_0x47028f['model'],qs[_0x1043('0x39')](_0x437126['query'][_0x1043('0x39')]));_0x5a14d5['attributes']=_0x5a14d5[_0x1043('0x38')][_0x1043('0x3a')]?_0x5a14d5[_0x1043('0x38')]:_0x47028f['model'];if(!_0x437126[_0x1043('0x34')]['hasOwnProperty'](_0x1043('0x3c'))){_0x5a14d5['limit']=qs['limit'](_0x437126[_0x1043('0x34')][_0x1043('0x1d')]);_0x5a14d5['offset']=qs[_0x1043('0x1b')](_0x437126[_0x1043('0x34')][_0x1043('0x1b')]);}_0x5a14d5[_0x1043('0x3d')]=qs[_0x1043('0x3e')](_0x437126[_0x1043('0x34')]['sort']);_0x5a14d5[_0x1043('0x3f')]=qs[_0x1043('0x36')](_['pick'](_0x437126[_0x1043('0x34')],_0x47028f[_0x1043('0x36')]));_0x5a14d5['where'][_0x1043('0x5c')]=_0x41719a['id'];if(_0x437126[_0x1043('0x34')][_0x1043('0x41')]){_0x5a14d5[_0x1043('0x3f')]=_[_0x1043('0x42')](_0x5a14d5[_0x1043('0x3f')],{'$or':_[_0x1043('0x2d')](_0x5a14d5['attributes'],function(_0xe110d){var _0xec60dc={};_0xec60dc[_0xe110d]={'$like':'%'+_0x437126[_0x1043('0x34')][_0x1043('0x41')]+'%'};return _0xec60dc;})});}_0x5a14d5=_[_0x1043('0x42')]({},_0x5a14d5,_0x437126[_0x1043('0x4a')]);return db[_0x1043('0x5b')][_0x1043('0x43')]({'where':_0x5a14d5['where']})[_0x1043('0x25')](function(_0x15aef0){_0x2142c4[_0x1043('0x43')]=_0x15aef0;if(_0x437126[_0x1043('0x34')][_0x1043('0x44')]){_0x5a14d5[_0x1043('0x45')]=[{'all':!![]}];}return db[_0x1043('0x5b')][_0x1043('0x46')](_0x5a14d5);})[_0x1043('0x25')](function(_0x5d4afb){_0x2142c4[_0x1043('0x47')]=_0x5d4afb;return _0x2142c4;});}})[_0x1043('0x25')](respondWithFilteredResult(_0x5e959e,_0x5a14d5))[_0x1043('0x48')](handleError(_0x5e959e,null));};exports[_0x1043('0x5d')]=function(_0x4f31d1,_0x5b33b0,_0x205fcc){var _0x1a276e={'raw':!![],'where':{}};var _0x9123bd={};var _0x78a6f2={'count':0x0,'rows':[]};return db[_0x1043('0x2e')][_0x1043('0x5e')]({'where':{'id':_0x4f31d1[_0x1043('0x49')]['id']}})[_0x1043('0x25')](handleEntityNotFound(_0x5b33b0,null))[_0x1043('0x25')](function(_0x31fec4){if(_0x31fec4){_0x9123bd[_0x1043('0x33')]=_[_0x1043('0x35')](db[_0x1043('0x5f')][_0x1043('0x2f')]);_0x9123bd[_0x1043('0x34')]=_[_0x1043('0x35')](_0x4f31d1[_0x1043('0x34')]);_0x9123bd['filters']=_[_0x1043('0x37')](_0x9123bd[_0x1043('0x33')],_0x9123bd[_0x1043('0x34')]);_0x1a276e['attributes']=_[_0x1043('0x37')](_0x9123bd['model'],qs[_0x1043('0x39')](_0x4f31d1[_0x1043('0x34')]['fields']));_0x1a276e[_0x1043('0x38')]=_0x1a276e[_0x1043('0x38')][_0x1043('0x3a')]?_0x1a276e[_0x1043('0x38')]:_0x9123bd[_0x1043('0x33')];if(!_0x4f31d1[_0x1043('0x34')][_0x1043('0x3b')](_0x1043('0x3c'))){_0x1a276e['limit']=qs['limit'](_0x4f31d1[_0x1043('0x34')][_0x1043('0x1d')]);_0x1a276e[_0x1043('0x1b')]=qs['offset'](_0x4f31d1[_0x1043('0x34')][_0x1043('0x1b')]);}_0x1a276e[_0x1043('0x3d')]=qs[_0x1043('0x3e')](_0x4f31d1[_0x1043('0x34')]['sort']);_0x1a276e['where']=qs[_0x1043('0x36')](_[_0x1043('0x40')](_0x4f31d1[_0x1043('0x34')],_0x9123bd[_0x1043('0x36')]));_0x1a276e['where'][_0x1043('0x5c')]=_0x31fec4['id'];if(_0x4f31d1[_0x1043('0x34')][_0x1043('0x41')]){_0x1a276e['where']=_['merge'](_0x1a276e[_0x1043('0x3f')],{'$or':_[_0x1043('0x2d')](_0x1a276e[_0x1043('0x38')],function(_0x21f9ac){var _0x5b2f49={};_0x5b2f49[_0x21f9ac]={'$like':'%'+_0x4f31d1[_0x1043('0x34')]['filter']+'%'};return _0x5b2f49;})});}_0x1a276e=_[_0x1043('0x42')]({},_0x1a276e,_0x4f31d1[_0x1043('0x4a')]);return db['CmHopperHistory'][_0x1043('0x43')]({'where':_0x1a276e['where']})[_0x1043('0x25')](function(_0x4151f6){_0x78a6f2[_0x1043('0x43')]=_0x4151f6;if(_0x4f31d1[_0x1043('0x34')][_0x1043('0x44')]){_0x1a276e['include']=[{'all':!![]}];}return db[_0x1043('0x5f')][_0x1043('0x46')](_0x1a276e);})['then'](function(_0x266d46){_0x78a6f2['rows']=_0x266d46;return _0x78a6f2;});}})[_0x1043('0x25')](respondWithFilteredResult(_0x5b33b0,_0x1a276e))[_0x1043('0x48')](handleError(_0x5b33b0,null));};exports[_0x1043('0x60')]=function(_0x27bfbe,_0x1b168f,_0x54c80c){var _0x171913={'raw':!![],'where':{}};var _0x488344={};var _0x1f5e07={'count':0x0,'rows':[]};return db['Campaign'][_0x1043('0x5e')]({'where':{'id':_0x27bfbe[_0x1043('0x49')]['id']}})[_0x1043('0x25')](handleEntityNotFound(_0x1b168f,null))[_0x1043('0x25')](function(_0x155792){if(_0x155792){_0x488344['model']=_[_0x1043('0x35')](db[_0x1043('0x61')][_0x1043('0x2f')]);_0x488344[_0x1043('0x34')]=_[_0x1043('0x35')](_0x27bfbe[_0x1043('0x34')]);_0x488344[_0x1043('0x36')]=_['intersection'](_0x488344[_0x1043('0x33')],_0x488344[_0x1043('0x34')]);_0x171913[_0x1043('0x38')]=_[_0x1043('0x37')](_0x488344[_0x1043('0x33')],qs[_0x1043('0x39')](_0x27bfbe['query'][_0x1043('0x39')]));_0x171913[_0x1043('0x38')]=_0x171913['attributes'][_0x1043('0x3a')]?_0x171913[_0x1043('0x38')]:_0x488344[_0x1043('0x33')];if(!_0x27bfbe[_0x1043('0x34')][_0x1043('0x3b')](_0x1043('0x3c'))){_0x171913['limit']=qs[_0x1043('0x1d')](_0x27bfbe[_0x1043('0x34')]['limit']);_0x171913[_0x1043('0x1b')]=qs[_0x1043('0x1b')](_0x27bfbe[_0x1043('0x34')]['offset']);}_0x171913[_0x1043('0x3d')]=qs[_0x1043('0x3e')](_0x27bfbe['query'][_0x1043('0x3e')]);_0x171913[_0x1043('0x3f')]=qs['filters'](_[_0x1043('0x40')](_0x27bfbe[_0x1043('0x34')],_0x488344[_0x1043('0x36')]));_0x171913['where']['CampaignId']=_0x155792['id'];if(_0x27bfbe[_0x1043('0x34')]['filter']){_0x171913[_0x1043('0x3f')]=_[_0x1043('0x42')](_0x171913['where'],{'$or':_[_0x1043('0x2d')](_0x171913[_0x1043('0x38')],function(_0x20eeba){var _0x40f3d0={};_0x40f3d0[_0x20eeba]={'$like':'%'+_0x27bfbe[_0x1043('0x34')][_0x1043('0x41')]+'%'};return _0x40f3d0;})});}_0x171913=_[_0x1043('0x42')]({},_0x171913,_0x27bfbe[_0x1043('0x4a')]);return db[_0x1043('0x61')][_0x1043('0x43')]({'where':_0x171913[_0x1043('0x3f')]})[_0x1043('0x25')](function(_0x1a3546){_0x1f5e07[_0x1043('0x43')]=_0x1a3546;if(_0x27bfbe['query'][_0x1043('0x44')]){_0x171913[_0x1043('0x45')]=[{'all':!![]}];}return db[_0x1043('0x61')][_0x1043('0x46')](_0x171913);})['then'](function(_0x41f51b){_0x1f5e07[_0x1043('0x47')]=_0x41f51b;return _0x1f5e07;});}})[_0x1043('0x25')](respondWithFilteredResult(_0x1b168f,_0x171913))['catch'](handleError(_0x1b168f,null));};exports[_0x1043('0x62')]=function(_0x2cb8c0,_0x4a886b,_0x364732){var _0x11524d={'raw':!![],'where':{}};var _0xb85a7e={};var _0x1e733f={'count':0x0,'rows':[]};return db[_0x1043('0x2e')]['findOne']({'where':{'id':_0x2cb8c0[_0x1043('0x49')]['id']}})[_0x1043('0x25')](handleEntityNotFound(_0x4a886b,null))[_0x1043('0x25')](function(_0x9ae26c){if(_0x9ae26c){_0xb85a7e[_0x1043('0x33')]=_['keys'](db[_0x1043('0x63')][_0x1043('0x2f')]);_0xb85a7e[_0x1043('0x34')]=_[_0x1043('0x35')](_0x2cb8c0['query']);_0xb85a7e[_0x1043('0x36')]=_[_0x1043('0x37')](_0xb85a7e[_0x1043('0x33')],_0xb85a7e[_0x1043('0x34')]);_0x11524d['attributes']=_[_0x1043('0x37')](_0xb85a7e[_0x1043('0x33')],qs[_0x1043('0x39')](_0x2cb8c0[_0x1043('0x34')][_0x1043('0x39')]));_0x11524d['attributes']=_0x11524d[_0x1043('0x38')][_0x1043('0x3a')]?_0x11524d[_0x1043('0x38')]:_0xb85a7e[_0x1043('0x33')];if(!_0x2cb8c0[_0x1043('0x34')][_0x1043('0x3b')](_0x1043('0x3c'))){_0x11524d['limit']=qs[_0x1043('0x1d')](_0x2cb8c0['query']['limit']);_0x11524d[_0x1043('0x1b')]=qs[_0x1043('0x1b')](_0x2cb8c0['query'][_0x1043('0x1b')]);}_0x11524d[_0x1043('0x3d')]=qs[_0x1043('0x3e')](_0x2cb8c0[_0x1043('0x34')][_0x1043('0x3e')]);_0x11524d[_0x1043('0x3f')]=qs[_0x1043('0x36')](_['pick'](_0x2cb8c0[_0x1043('0x34')],_0xb85a7e[_0x1043('0x36')]));_0x11524d['where'][_0x1043('0x5c')]=_0x9ae26c['id'];if(_0x2cb8c0[_0x1043('0x34')][_0x1043('0x41')]){_0x11524d[_0x1043('0x3f')]=_[_0x1043('0x42')](_0x11524d[_0x1043('0x3f')],{'$or':_[_0x1043('0x2d')](_0x11524d[_0x1043('0x38')],function(_0x36b51e){var _0xb1846d={};_0xb1846d[_0x36b51e]={'$like':'%'+_0x2cb8c0[_0x1043('0x34')][_0x1043('0x41')]+'%'};return _0xb1846d;})});}_0x11524d=_[_0x1043('0x42')]({},_0x11524d,_0x2cb8c0[_0x1043('0x4a')]);return db[_0x1043('0x63')][_0x1043('0x43')]({'where':_0x11524d[_0x1043('0x3f')]})[_0x1043('0x25')](function(_0x2d31bb){_0x1e733f[_0x1043('0x43')]=_0x2d31bb;if(_0x2cb8c0[_0x1043('0x34')][_0x1043('0x44')]){_0x11524d['include']=[{'all':!![]}];}return db[_0x1043('0x63')][_0x1043('0x46')](_0x11524d);})[_0x1043('0x25')](function(_0x59f790){_0x1e733f['rows']=_0x59f790;return _0x1e733f;});}})[_0x1043('0x25')](respondWithFilteredResult(_0x4a886b,_0x11524d))[_0x1043('0x48')](handleError(_0x4a886b,null));};exports[_0x1043('0x64')]=function(_0x5810a8,_0x5dd452,_0x3a14d0){var _0x34e251={};var _0x462b93={};var _0x27a43d;var _0x49095c;return db[_0x1043('0x2e')]['findOne']({'where':{'id':_0x5810a8[_0x1043('0x49')]['id']}})[_0x1043('0x25')](handleEntityNotFound(_0x5dd452,null))[_0x1043('0x25')](function(_0x324db7){if(_0x324db7){_0x27a43d=_0x324db7;_0x462b93[_0x1043('0x33')]=_['keys'](db[_0x1043('0x65')][_0x1043('0x2f')]);_0x462b93['query']=_[_0x1043('0x35')](_0x5810a8['query']);_0x462b93[_0x1043('0x36')]=_[_0x1043('0x37')](_0x462b93['model'],_0x462b93['query']);_0x34e251['attributes']=_['intersection'](_0x462b93[_0x1043('0x33')],qs[_0x1043('0x39')](_0x5810a8[_0x1043('0x34')][_0x1043('0x39')]));_0x34e251['attributes']=_0x34e251['attributes'][_0x1043('0x3a')]?_0x34e251[_0x1043('0x38')]:_0x462b93[_0x1043('0x33')];_0x34e251[_0x1043('0x3d')]=qs['sort'](_0x5810a8[_0x1043('0x34')][_0x1043('0x3e')]);_0x34e251[_0x1043('0x3f')]=qs['filters'](_[_0x1043('0x40')](_0x5810a8[_0x1043('0x34')],_0x462b93[_0x1043('0x36')]));if(_0x5810a8[_0x1043('0x34')][_0x1043('0x41')]){_0x34e251[_0x1043('0x3f')]=_['merge'](_0x34e251[_0x1043('0x3f')],{'$or':_[_0x1043('0x2d')](_0x34e251['attributes'],function(_0x2c5305){var _0x5de97a={};_0x5de97a[_0x2c5305]={'$like':'%'+_0x5810a8[_0x1043('0x34')][_0x1043('0x41')]+'%'};return _0x5de97a;})});}_0x34e251=_['merge']({},_0x34e251,_0x5810a8[_0x1043('0x4a')]);return _0x27a43d['getLists'](_0x34e251);}})[_0x1043('0x25')](function(_0x2d4b7a){if(_0x2d4b7a){_0x49095c=_0x2d4b7a[_0x1043('0x3a')];if(!_0x5810a8[_0x1043('0x34')][_0x1043('0x3b')](_0x1043('0x3c'))){_0x34e251[_0x1043('0x1d')]=qs[_0x1043('0x1d')](_0x5810a8[_0x1043('0x34')]['limit']);_0x34e251[_0x1043('0x1b')]=qs[_0x1043('0x1b')](_0x5810a8[_0x1043('0x34')][_0x1043('0x1b')]);}return _0x27a43d[_0x1043('0x64')](_0x34e251);}})[_0x1043('0x25')](function(_0x18a916){if(_0x18a916){return _0x18a916?{'count':_0x49095c,'rows':_0x18a916}:null;}})[_0x1043('0x25')](respondWithResult(_0x5dd452,null))['catch'](handleError(_0x5dd452,null));};exports['addLists']=function(_0x3d14df,_0x6b20ab,_0x2eb4d9){var _0x28c8f4,_0x3956c6;var _0xbba138=[];var _0x451194=moment()[_0x1043('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x1043('0x2e')][_0x1043('0x4b')]({'where':{'id':_0x3d14df['params']['id']}})[_0x1043('0x25')](handleEntityNotFound(_0x6b20ab,null))['then'](function(_0x10e01c){if(_0x10e01c){_0x3956c6=_0x10e01c;return _0x10e01c['addLists'](_0x3d14df['body'][_0x1043('0x67')],_[_0x1043('0x68')](_0x3d14df[_0x1043('0x4d')],[_0x1043('0x67'),'id'])||{});}return null;})['spread'](function(_0x27c71f){var _0x57dbb0;var _0x18e31b;_0x28c8f4=_0x27c71f||[];var _0x177289=[];if(_0x27c71f){for(var _0x4739fc=0x0;_0x4739fc<_0x27c71f[_0x1043('0x3a')];_0x4739fc+=0x1){var _0x6cfbf7=_0x27c71f[_0x4739fc][_0x1043('0x26')]({'plain':!![]});_0x3956c6[_0x1043('0x69')]=_0x3d14df[_0x1043('0x4d')][_0x1043('0x69')]?_0x3d14df[_0x1043('0x4d')]['dialCheckDuplicateType']:_0x3956c6[_0x1043('0x69')];switch(_0x3956c6['dialCheckDuplicateType']){case'always':_0x57dbb0=squel[_0x1043('0x6a')]()[_0x1043('0x6b')](_0x1043('0x6c'))['fromQuery']([_0x1043('0x6d'),_0x1043('0x6e'),_0x1043('0x6f'),_0x1043('0x70'),_0x1043('0x5c'),'createdAt','updatedAt'],squel[_0x1043('0x71')]()[_0x1043('0x72')]('phone',_0x1043('0x6d'))[_0x1043('0x72')](_0x1043('0x73'),_0x1043('0x6e'))['field']('id',_0x1043('0x6f'))[_0x1043('0x72')](_0x6cfbf7[_0x1043('0x74')]['toString'](),_0x1043('0x70'))[_0x1043('0x72')](_0x3d14df[_0x1043('0x49')]['id'][_0x1043('0x75')](),_0x1043('0x5c'))['field']('\x27'+_0x451194+'\x27',_0x1043('0x55'))['field']('\x27'+_0x451194+'\x27',_0x1043('0x56'))[_0x1043('0x76')](_0x1043('0x77'))[_0x1043('0x3f')](_0x1043('0x78'))['where'](_0x1043('0x79'),_0x6cfbf7[_0x1043('0x74')][_0x1043('0x75')]())['where'](_0x1043('0x7a'))[_0x1043('0x3f')](_0x1043('0x7b'),squel[_0x1043('0x71')]()[_0x1043('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0x1043('0x76')]('cm_hopper_final')[_0x1043('0x3f')](_0x1043('0x7c'),_0x3d14df[_0x1043('0x49')]['id'][_0x1043('0x75')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1043('0x71')]()[_0x1043('0x72')](_0x1043('0x7d'))['from'](_0x1043('0x6c'))[_0x1043('0x3f')](_0x1043('0x7c'),_0x3d14df[_0x1043('0x49')]['id']['toString']())))[_0x1043('0x75')]();break;case _0x1043('0x7e'):_0x57dbb0=squel[_0x1043('0x6a')]()[_0x1043('0x6b')](_0x1043('0x6c'))[_0x1043('0x7f')]([_0x1043('0x6d'),_0x1043('0x6e'),'ContactId','ListId',_0x1043('0x5c'),_0x1043('0x55'),_0x1043('0x56')],squel[_0x1043('0x71')]()[_0x1043('0x72')](_0x1043('0x6d'),_0x1043('0x6d'))['field'](_0x1043('0x73'),_0x1043('0x6e'))['field']('id',_0x1043('0x6f'))[_0x1043('0x72')](_0x6cfbf7['CmListId'][_0x1043('0x75')](),'ListId')[_0x1043('0x72')](_0x3d14df[_0x1043('0x49')]['id']['toString'](),_0x1043('0x5c'))['field']('\x27'+_0x451194+'\x27','createdAt')[_0x1043('0x72')]('\x27'+_0x451194+'\x27',_0x1043('0x56'))[_0x1043('0x76')]('cm_contacts')[_0x1043('0x3f')](_0x1043('0x78'))[_0x1043('0x3f')](_0x1043('0x79'),_0x6cfbf7[_0x1043('0x74')][_0x1043('0x75')]())['where'](_0x1043('0x7a'))[_0x1043('0x3f')](_0x1043('0x7b'),squel[_0x1043('0x71')]()[_0x1043('0x72')](_0x1043('0x7d'))[_0x1043('0x76')](_0x1043('0x6c'))[_0x1043('0x3f')](_0x1043('0x7c'),_0x3d14df[_0x1043('0x49')]['id'][_0x1043('0x75')]())))[_0x1043('0x75')]();break;default:_0x57dbb0=squel[_0x1043('0x6a')]()[_0x1043('0x6b')](_0x1043('0x6c'))[_0x1043('0x7f')]([_0x1043('0x6d'),_0x1043('0x6e'),_0x1043('0x6f'),_0x1043('0x70'),_0x1043('0x5c'),'createdAt',_0x1043('0x56')],squel[_0x1043('0x71')]()[_0x1043('0x72')](_0x1043('0x6d'),_0x1043('0x6d'))[_0x1043('0x72')](_0x1043('0x73'),'scheduledAt')[_0x1043('0x72')]('id',_0x1043('0x6f'))[_0x1043('0x72')](_0x6cfbf7[_0x1043('0x74')]['toString'](),_0x1043('0x70'))[_0x1043('0x72')](_0x3d14df[_0x1043('0x49')]['id'][_0x1043('0x75')](),_0x1043('0x5c'))['field']('\x27'+_0x451194+'\x27',_0x1043('0x55'))[_0x1043('0x72')]('\x27'+_0x451194+'\x27',_0x1043('0x56'))['from'](_0x1043('0x77'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x1043('0x79'),_0x6cfbf7[_0x1043('0x74')][_0x1043('0x75')]())[_0x1043('0x3f')](_0x1043('0x7a')))['toString']();}_0x18e31b=squel['insert']()[_0x1043('0x6b')]('cm_hopper_additional_phones')[_0x1043('0x7f')](['cmHopperId','scheduledAt',_0x1043('0x6d'),_0x1043('0x80'),_0x1043('0x55'),_0x1043('0x56')],squel[_0x1043('0x71')]()[_0x1043('0x72')](_0x1043('0x81'),'id')[_0x1043('0x72')](_0x1043('0x73'),_0x1043('0x6e'))[_0x1043('0x72')](_0x1043('0x82'),_0x1043('0x6d'))[_0x1043('0x72')](_0x1043('0x83'),_0x1043('0x80'))[_0x1043('0x72')]('\x27'+_0x451194+'\x27',_0x1043('0x55'))[_0x1043('0x72')]('\x27'+_0x451194+'\x27','updatedAt')['from'](_0x1043('0x84'),'ci')[_0x1043('0x85')](_0x1043('0x6c'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x1043('0x3f')]('h.ListId\x20=\x20?',_0x6cfbf7[_0x1043('0x74')]['toString']())['where'](_0x1043('0x86'),_0x3d14df['params']['id'][_0x1043('0x75')]())[_0x1043('0x3f')](_0x1043('0x87'),_0x451194))[_0x1043('0x75')]();_0x177289[_0x1043('0x88')](db[_0x1043('0x89')]['query'](_0x57dbb0));_0xbba138[_0x1043('0x88')](db['sequelize'][_0x1043('0x34')](_0x18e31b));}return BPromise[_0x1043('0x8a')](_0x177289);}})[_0x1043('0x25')](function(){return BPromise[_0x1043('0x8a')](_0xbba138);})['then'](function(){return _0x28c8f4;})[_0x1043('0x25')](respondWithResult(_0x6b20ab,null))[_0x1043('0x48')](handleError(_0x6b20ab,null));};exports[_0x1043('0x8b')]=function(_0x3cfd0e,_0x577fa0,_0x3636cd){return db[_0x1043('0x2e')][_0x1043('0x4b')]({'where':{'id':_0x3cfd0e[_0x1043('0x49')]['id']}})['then'](handleEntityNotFound(_0x577fa0,null))['then'](function(_0x43da65){if(_0x43da65){return _0x43da65[_0x1043('0x8b')](_0x3cfd0e['query']['ids']);}})[_0x1043('0x25')](function(_0x1cc171){if(_0x1cc171){return db[_0x1043('0x5b')]['destroy']({'where':{'ListId':_0x3cfd0e['query'][_0x1043('0x67')],'CampaignId':_0x3cfd0e[_0x1043('0x49')]['id']}})[_0x1043('0x25')](function(){return _0x1cc171;});}})['then'](respondWithStatusCode(_0x577fa0,null))[_0x1043('0x48')](handleError(_0x577fa0,null));};exports['getBlackLists']=function(_0x5a2f4a,_0x1ab0ab,_0x48a81a){var _0x3b608a={};var _0x3dc52e={};var _0x291b60;var _0x383afa;return db['Campaign'][_0x1043('0x5e')]({'where':{'id':_0x5a2f4a[_0x1043('0x49')]['id']}})['then'](handleEntityNotFound(_0x1ab0ab,null))[_0x1043('0x25')](function(_0x5d6336){if(_0x5d6336){_0x291b60=_0x5d6336;_0x3dc52e[_0x1043('0x33')]=_[_0x1043('0x35')](db[_0x1043('0x65')][_0x1043('0x2f')]);_0x3dc52e[_0x1043('0x34')]=_[_0x1043('0x35')](_0x5a2f4a[_0x1043('0x34')]);_0x3dc52e[_0x1043('0x36')]=_[_0x1043('0x37')](_0x3dc52e[_0x1043('0x33')],_0x3dc52e[_0x1043('0x34')]);_0x3b608a['attributes']=_['intersection'](_0x3dc52e['model'],qs['fields'](_0x5a2f4a['query'][_0x1043('0x39')]));_0x3b608a[_0x1043('0x38')]=_0x3b608a[_0x1043('0x38')][_0x1043('0x3a')]?_0x3b608a[_0x1043('0x38')]:_0x3dc52e['model'];_0x3b608a['order']=qs[_0x1043('0x3e')](_0x5a2f4a[_0x1043('0x34')]['sort']);_0x3b608a[_0x1043('0x3f')]=qs[_0x1043('0x36')](_['pick'](_0x5a2f4a[_0x1043('0x34')],_0x3dc52e[_0x1043('0x36')]));if(_0x5a2f4a[_0x1043('0x34')]['filter']){_0x3b608a[_0x1043('0x3f')]=_[_0x1043('0x42')](_0x3b608a[_0x1043('0x3f')],{'$or':_[_0x1043('0x2d')](_0x3b608a[_0x1043('0x38')],function(_0x14f895){var _0x493d29={};_0x493d29[_0x14f895]={'$like':'%'+_0x5a2f4a[_0x1043('0x34')]['filter']+'%'};return _0x493d29;})});}_0x3b608a=_['merge']({},_0x3b608a,_0x5a2f4a[_0x1043('0x4a')]);return _0x291b60['getBlackLists'](_0x3b608a);}})['then'](function(_0x9d61fe){if(_0x9d61fe){_0x383afa=_0x9d61fe[_0x1043('0x3a')];if(!_0x5a2f4a[_0x1043('0x34')][_0x1043('0x3b')](_0x1043('0x3c'))){_0x3b608a[_0x1043('0x1d')]=qs[_0x1043('0x1d')](_0x5a2f4a[_0x1043('0x34')][_0x1043('0x1d')]);_0x3b608a[_0x1043('0x1b')]=qs[_0x1043('0x1b')](_0x5a2f4a[_0x1043('0x34')][_0x1043('0x1b')]);}return _0x291b60[_0x1043('0x8c')](_0x3b608a);}})['then'](function(_0x4bbc07){if(_0x4bbc07){return _0x4bbc07?{'count':_0x383afa,'rows':_0x4bbc07}:null;}})[_0x1043('0x25')](respondWithResult(_0x1ab0ab,null))[_0x1043('0x48')](handleError(_0x1ab0ab,null));};exports[_0x1043('0x8d')]=function(_0x2f8a3e,_0x55a387,_0x488548){var _0x139132,_0x93844f;var _0x39c1cc=[];var _0x3b5e9=moment()[_0x1043('0x66')](_0x1043('0x8e'));return db[_0x1043('0x2e')][_0x1043('0x4b')]({'where':{'id':_0x2f8a3e[_0x1043('0x49')]['id']}})[_0x1043('0x25')](handleEntityNotFound(_0x55a387,null))[_0x1043('0x25')](function(_0x243f71){if(_0x243f71){_0x93844f=_0x243f71;return _0x243f71[_0x1043('0x8d')](_0x2f8a3e[_0x1043('0x4d')][_0x1043('0x67')],_[_0x1043('0x68')](_0x2f8a3e['body'],[_0x1043('0x67'),'id'])||{});}return null;})[_0x1043('0x8f')](function(_0x3480db){var _0x21b642;var _0x966ea4;_0x139132=_0x3480db||[];var _0x48528c=[];if(_0x3480db){for(var _0x59ca22=0x0;_0x59ca22<_0x3480db[_0x1043('0x3a')];_0x59ca22+=0x1){var _0x4375af=_0x3480db[_0x59ca22][_0x1043('0x26')]({'plain':!![]});_0x21b642=squel[_0x1043('0x6a')]()[_0x1043('0x6b')](_0x1043('0x90'))[_0x1043('0x7f')](['phone',_0x1043('0x6f'),_0x1043('0x70'),_0x1043('0x5c'),'createdAt',_0x1043('0x56')],squel[_0x1043('0x71')]()[_0x1043('0x72')](_0x1043('0x6d'),_0x1043('0x6d'))[_0x1043('0x72')]('id',_0x1043('0x6f'))['field'](_0x4375af[_0x1043('0x74')][_0x1043('0x75')](),'ListId')[_0x1043('0x72')](_0x2f8a3e[_0x1043('0x49')]['id'][_0x1043('0x75')](),_0x1043('0x5c'))[_0x1043('0x72')]('NOW()','createdAt')[_0x1043('0x72')]('NOW()','updatedAt')[_0x1043('0x76')]('cm_contacts')[_0x1043('0x3f')]('deletedAt\x20IS\x20NULL')[_0x1043('0x3f')]('ListId\x20=\x20?',_0x4375af[_0x1043('0x74')][_0x1043('0x75')]())[_0x1043('0x3f')](_0x1043('0x7a')))[_0x1043('0x75')]();_0x48528c['push'](db[_0x1043('0x89')][_0x1043('0x34')](_0x21b642));}return BPromise[_0x1043('0x8a')](_0x48528c);}})['then'](function(){return _0x139132;})[_0x1043('0x25')](respondWithResult(_0x55a387,null))[_0x1043('0x48')](handleError(_0x55a387,null));};exports[_0x1043('0x91')]=function(_0x36008d,_0x3dbaf3,_0x1fb8df){return db[_0x1043('0x2e')][_0x1043('0x4b')]({'where':{'id':_0x36008d[_0x1043('0x49')]['id']}})[_0x1043('0x25')](handleEntityNotFound(_0x3dbaf3,null))[_0x1043('0x25')](function(_0xe93e0c){if(_0xe93e0c){return _0xe93e0c['removeBlackLists'](_0x36008d[_0x1043('0x34')]['ids']);}})[_0x1043('0x25')](function(_0xff50d2){if(_0xff50d2){return db['CmHopperBlack'][_0x1043('0x24')]({'where':{'ListId':_0x36008d[_0x1043('0x34')]['ids'],'CampaignId':_0x36008d[_0x1043('0x49')]['id']}})[_0x1043('0x25')](function(){return _0xff50d2;});}})[_0x1043('0x25')](respondWithStatusCode(_0x3dbaf3,null))[_0x1043('0x48')](handleError(_0x3dbaf3,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7b48770..cd23c8c 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xb509c2,_0xc778dd){var _0x1a63e1=function(_0x29b224){while(--_0x29b224){_0xb509c2['push'](_0xb509c2['shift']());}};_0x1a63e1(++_0xc778dd);}(_0x7a54,0x106));var _0x47a5=function(_0x192b30,_0x5c7525){_0x192b30=_0x192b30-0x0;var _0x1873fb=_0x7a54[_0x192b30];return _0x1873fb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x7a54,0x106));var _0x47a5=function(_0x471a69,_0x58574c){_0x471a69=_0x471a69-0x0;var _0x5dbe66=_0x7a54[_0x471a69];return _0x5dbe66;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 112f5f9..9b835e5 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4156=['request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','GetCampaign','Campaign','raw','options','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x580843,_0x1840bb){var _0x12a1e2=function(_0x5f02c5){while(--_0x5f02c5){_0x580843['push'](_0x580843['shift']());}};_0x12a1e2(++_0x1840bb);}(_0x4156,0xf1));var _0x6415=function(_0x359055,_0x20f62d){_0x359055=_0x359055-0x0;var _0xc50b4b=_0x4156[_0x359055];return _0xc50b4b;};'use strict';var _=require(_0x6415('0x0'));var util=require(_0x6415('0x1'));var moment=require(_0x6415('0x2'));var BPromise=require(_0x6415('0x3'));var rs=require(_0x6415('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6415('0x5'))['db'];var utils=require(_0x6415('0x6'));var logger=require(_0x6415('0x7'))(_0x6415('0x8'));var config=require(_0x6415('0x9'));var jayson=require(_0x6415('0xa'));var client=jayson[_0x6415('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24cb0,_0x47ec13,_0x4045ec){return new BPromise(function(_0x266237,_0x5bc51b){return client[_0x6415('0xc')](_0x24cb0,_0x4045ec)[_0x6415('0xd')](function(_0x3383d2){logger[_0x6415('0xe')]('Campaign,\x20%s,\x20%s',_0x47ec13,_0x6415('0xf'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x47ec13,_0x6415('0xf'),JSON[_0x6415('0x10')](_0x3383d2));if(_0x3383d2[_0x6415('0x11')]){if(_0x3383d2[_0x6415('0x11')][_0x6415('0x12')]===0x1f4){logger[_0x6415('0x11')](_0x6415('0x13'),_0x47ec13,_0x3383d2['error']['message']);return _0x5bc51b(_0x3383d2[_0x6415('0x11')][_0x6415('0x14')]);}logger[_0x6415('0x11')](_0x6415('0x13'),_0x47ec13,_0x3383d2[_0x6415('0x11')]['message']);return _0x266237(_0x3383d2['error'][_0x6415('0x14')]);}else{logger[_0x6415('0xe')]('Campaign,\x20%s,\x20%s',_0x47ec13,_0x6415('0xf'));_0x266237(_0x3383d2[_0x6415('0x15')]['message']);}})['catch'](function(_0x352a04){logger[_0x6415('0x11')](_0x6415('0x13'),_0x47ec13,_0x352a04);_0x5bc51b(_0x352a04);});});}exports[_0x6415('0x16')]=function(_0x2ef73b){var _0xa3d00a=this;return new Promise(function(_0x2c74c6,_0x468dc2){return db[_0x6415('0x17')]['findAll']({'raw':_0x2ef73b['options']?_0x2ef73b['options'][_0x6415('0x18')]===undefined?!![]:![]:!![],'where':_0x2ef73b[_0x6415('0x19')]?_0x2ef73b[_0x6415('0x19')][_0x6415('0x1a')]||null:null,'attributes':_0x2ef73b['options']?_0x2ef73b[_0x6415('0x19')][_0x6415('0x1b')]||null:null,'limit':_0x2ef73b[_0x6415('0x19')]?_0x2ef73b['options'][_0x6415('0x1c')]||null:null,'include':_0x2ef73b[_0x6415('0x19')]?_0x2ef73b[_0x6415('0x19')][_0x6415('0x1d')]?_[_0x6415('0x1e')](_0x2ef73b[_0x6415('0x19')][_0x6415('0x1d')],function(_0x41c266){return{'model':db[_0x41c266[_0x6415('0x1f')]],'as':_0x41c266['as'],'attributes':_0x41c266['attributes'],'include':_0x41c266[_0x6415('0x1d')]?_[_0x6415('0x1e')](_0x41c266['include'],function(_0x15be31){return{'model':db[_0x15be31[_0x6415('0x1f')]],'as':_0x15be31['as'],'attributes':_0x15be31[_0x6415('0x1b')],'include':_0x15be31[_0x6415('0x1d')]?_[_0x6415('0x1e')](_0x15be31['include'],function(_0x30d857){return{'model':db[_0x30d857['model']],'as':_0x30d857['as'],'attributes':_0x30d857[_0x6415('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6415('0xd')](function(_0x25d459){logger['info']('GetCampaign',_0x2ef73b);logger['debug'](_0x6415('0x16'),_0x2ef73b,JSON[_0x6415('0x10')](_0x25d459));_0x2c74c6(_0x25d459);})['catch'](function(_0x5bf08d){logger[_0x6415('0x11')](_0x6415('0x16'),_0x5bf08d[_0x6415('0x14')],_0x2ef73b);_0x468dc2(_0xa3d00a[_0x6415('0x11')](0x1f4,_0x5bf08d[_0x6415('0x14')]));});});}; \ No newline at end of file +var _0xe58a=['message','info','result','catch','GetCampaign','findAll','options','raw','where','include','map','attributes','model','stringify','lodash','util','moment','randomstring','../../config/utils','../../config/environment','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error'];(function(_0x5b013e,_0x5065a3){var _0x55cda8=function(_0x463012){while(--_0x463012){_0x5b013e['push'](_0x5b013e['shift']());}};_0x55cda8(++_0x5065a3);}(_0xe58a,0x9f));var _0xae58=function(_0x462538,_0x4ae77f){_0x462538=_0x462538-0x0;var _0x19612e=_0xe58a[_0x462538];return _0x19612e;};'use strict';var _=require(_0xae58('0x0'));var util=require(_0xae58('0x1'));var moment=require(_0xae58('0x2'));var BPromise=require('bluebird');var rs=require(_0xae58('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xae58('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xae58('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xae58('0x6')][_0xae58('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2bd284,_0x2003b6,_0x703a03){return new BPromise(function(_0x7cb067,_0x20b26a){return client[_0xae58('0x8')](_0x2bd284,_0x703a03)[_0xae58('0x9')](function(_0x21d6f1){logger['info'](_0xae58('0xa'),_0x2003b6,_0xae58('0xb'));logger[_0xae58('0xc')](_0xae58('0xd'),_0x2003b6,_0xae58('0xb'),JSON['stringify'](_0x21d6f1));if(_0x21d6f1[_0xae58('0xe')]){if(_0x21d6f1[_0xae58('0xe')]['code']===0x1f4){logger[_0xae58('0xe')]('Campaign,\x20%s,\x20%s',_0x2003b6,_0x21d6f1[_0xae58('0xe')][_0xae58('0xf')]);return _0x20b26a(_0x21d6f1[_0xae58('0xe')][_0xae58('0xf')]);}logger['error'](_0xae58('0xa'),_0x2003b6,_0x21d6f1['error']['message']);return _0x7cb067(_0x21d6f1[_0xae58('0xe')][_0xae58('0xf')]);}else{logger[_0xae58('0x10')](_0xae58('0xa'),_0x2003b6,'request\x20sent');_0x7cb067(_0x21d6f1[_0xae58('0x11')][_0xae58('0xf')]);}})[_0xae58('0x12')](function(_0x2b3d7b){logger['error']('Campaign,\x20%s,\x20%s',_0x2003b6,_0x2b3d7b);_0x20b26a(_0x2b3d7b);});});}exports[_0xae58('0x13')]=function(_0x3d9b06){var _0x45a26b=this;return new Promise(function(_0x252488,_0x2e051c){return db['Campaign'][_0xae58('0x14')]({'raw':_0x3d9b06[_0xae58('0x15')]?_0x3d9b06[_0xae58('0x15')][_0xae58('0x16')]===undefined?!![]:![]:!![],'where':_0x3d9b06[_0xae58('0x15')]?_0x3d9b06[_0xae58('0x15')][_0xae58('0x17')]||null:null,'attributes':_0x3d9b06[_0xae58('0x15')]?_0x3d9b06[_0xae58('0x15')]['attributes']||null:null,'limit':_0x3d9b06['options']?_0x3d9b06[_0xae58('0x15')]['limit']||null:null,'include':_0x3d9b06[_0xae58('0x15')]?_0x3d9b06['options'][_0xae58('0x18')]?_[_0xae58('0x19')](_0x3d9b06[_0xae58('0x15')][_0xae58('0x18')],function(_0x41d2f2){return{'model':db[_0x41d2f2['model']],'as':_0x41d2f2['as'],'attributes':_0x41d2f2[_0xae58('0x1a')],'include':_0x41d2f2[_0xae58('0x18')]?_[_0xae58('0x19')](_0x41d2f2[_0xae58('0x18')],function(_0x557b6e){return{'model':db[_0x557b6e[_0xae58('0x1b')]],'as':_0x557b6e['as'],'attributes':_0x557b6e['attributes'],'include':_0x557b6e['include']?_[_0xae58('0x19')](_0x557b6e['include'],function(_0x2c3876){return{'model':db[_0x2c3876['model']],'as':_0x2c3876['as'],'attributes':_0x2c3876[_0xae58('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xae58('0x9')](function(_0x4474e8){logger['info']('GetCampaign',_0x3d9b06);logger['debug']('GetCampaign',_0x3d9b06,JSON[_0xae58('0x1c')](_0x4474e8));_0x252488(_0x4474e8);})['catch'](function(_0x551755){logger[_0xae58('0xe')](_0xae58('0x13'),_0x551755[_0xae58('0xf')],_0x3d9b06);_0x2e051c(_0x45a26b[_0xae58('0xe')](0x1f4,_0x551755[_0xae58('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7f7e6ad..b1eacb5 100644 --- a/server/api/campaign/index.js +++ b/server/api/campaign/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb722=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists','/:id/blacklists','put','update','destroy','delete','removeLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x4ca602,_0x330765){var _0xefb7f7=function(_0x2ef10a){while(--_0x2ef10a){_0x4ca602['push'](_0x4ca602['shift']());}};_0xefb7f7(++_0x330765);}(_0xb722,0x191));var _0x2b72=function(_0xf5190e,_0xad681){_0xf5190e=_0xf5190e-0x0;var _0x3d6caa=_0xb722[_0xf5190e];return _0x3d6caa;};'use strict';var multer=require(_0x2b72('0x0'));var util=require('util');var path=require(_0x2b72('0x1'));var timeout=require(_0x2b72('0x2'));var express=require(_0x2b72('0x3'));var router=express[_0x2b72('0x4')]();var fs_extra=require(_0x2b72('0x5'));var auth=require(_0x2b72('0x6'));var interaction=require(_0x2b72('0x7'));var config=require('../../config/environment');var controller=require(_0x2b72('0x8'));router[_0x2b72('0x9')]('/',auth[_0x2b72('0xa')](),controller[_0x2b72('0xb')]);router[_0x2b72('0x9')](_0x2b72('0xc'),auth[_0x2b72('0xa')](),controller[_0x2b72('0xd')]);router['get'](_0x2b72('0xe'),auth[_0x2b72('0xa')](),controller[_0x2b72('0xf')]);router[_0x2b72('0x9')](_0x2b72('0x10'),auth[_0x2b72('0xa')](),controller[_0x2b72('0x11')]);router[_0x2b72('0x9')](_0x2b72('0x12'),auth[_0x2b72('0xa')](),controller['getHopperFinals']);router[_0x2b72('0x9')](_0x2b72('0x13'),auth[_0x2b72('0xa')](),controller[_0x2b72('0x14')]);router[_0x2b72('0x9')](_0x2b72('0x15'),auth[_0x2b72('0xa')](),controller[_0x2b72('0x16')]);router[_0x2b72('0x9')]('/:id/blacklists',auth[_0x2b72('0xa')](),controller[_0x2b72('0x17')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2b72('0x18')](_0x2b72('0x19'),auth[_0x2b72('0xa')](),controller[_0x2b72('0x1a')]);router[_0x2b72('0x18')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2b72('0x1b')]);router['post'](_0x2b72('0x1c'),auth[_0x2b72('0xa')](),controller['addBlackLists']);router[_0x2b72('0x1d')](_0x2b72('0xc'),auth['isAuthenticated'](),controller[_0x2b72('0x1e')]);router['delete']('/:id',auth[_0x2b72('0xa')](),controller[_0x2b72('0x1f')]);router[_0x2b72('0x20')](_0x2b72('0x15'),auth[_0x2b72('0xa')](),controller[_0x2b72('0x21')]);router[_0x2b72('0x20')](_0x2b72('0x1c'),auth[_0x2b72('0xa')](),controller['removeBlackLists']);module[_0x2b72('0x22')]=router; \ No newline at end of file +var _0x42c8=['update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','index','/:id/hoppers','isAuthenticated','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addBlackLists','put','/:id'];(function(_0xba5e92,_0x38a184){var _0x43c82a=function(_0x4e628e){while(--_0x4e628e){_0xba5e92['push'](_0xba5e92['shift']());}};_0x43c82a(++_0x38a184);}(_0x42c8,0x116));var _0x842c=function(_0x3f78b0,_0x3e102f){_0x3f78b0=_0x3f78b0-0x0;var _0x226432=_0x42c8[_0x3f78b0];return _0x226432;};'use strict';var multer=require(_0x842c('0x0'));var util=require(_0x842c('0x1'));var path=require(_0x842c('0x2'));var timeout=require(_0x842c('0x3'));var express=require(_0x842c('0x4'));var router=express['Router']();var fs_extra=require(_0x842c('0x5'));var auth=require(_0x842c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x842c('0x7'));var controller=require(_0x842c('0x8'));router[_0x842c('0x9')]('/',auth['isAuthenticated'](),controller[_0x842c('0xa')]);router[_0x842c('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x842c('0xb'),auth[_0x842c('0xc')](),controller[_0x842c('0xd')]);router[_0x842c('0x9')]('/:id/hopper_histories',auth[_0x842c('0xc')](),controller[_0x842c('0xe')]);router[_0x842c('0x9')](_0x842c('0xf'),auth[_0x842c('0xc')](),controller[_0x842c('0x10')]);router[_0x842c('0x9')](_0x842c('0x11'),auth[_0x842c('0xc')](),controller['getHopperBlacks']);router[_0x842c('0x9')](_0x842c('0x12'),auth[_0x842c('0xc')](),controller[_0x842c('0x13')]);router['get'](_0x842c('0x14'),auth['isAuthenticated'](),controller[_0x842c('0x15')]);router[_0x842c('0x16')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x842c('0x17'),auth[_0x842c('0xc')](),controller[_0x842c('0x18')]);router[_0x842c('0x16')](_0x842c('0x12'),auth[_0x842c('0xc')](),controller['addLists']);router[_0x842c('0x16')](_0x842c('0x14'),auth[_0x842c('0xc')](),controller[_0x842c('0x19')]);router[_0x842c('0x1a')](_0x842c('0x1b'),auth[_0x842c('0xc')](),controller[_0x842c('0x1c')]);router[_0x842c('0x1d')]('/:id',auth[_0x842c('0xc')](),controller[_0x842c('0x1e')]);router[_0x842c('0x1d')](_0x842c('0x12'),auth[_0x842c('0xc')](),controller[_0x842c('0x1f')]);router[_0x842c('0x1d')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x842c('0x20')]);module[_0x842c('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 6ec1554..a7d0a38 100644 --- a/server/api/cannedAnswer/cannedAnswer.attributes.js +++ b/server/api/cannedAnswer/cannedAnswer.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0448=['key','sequelize','exports','STRING','medium','VIRTUAL','getDataValue'];(function(_0x79b25c,_0x280b81){var _0x16d6c4=function(_0x23ae51){while(--_0x23ae51){_0x79b25c['push'](_0x79b25c['shift']());}};_0x16d6c4(++_0x280b81);}(_0x0448,0x16d));var _0x8044=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x0448[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x8044('0x0'));module[_0x8044('0x1')]={'key':{'type':Sequelize[_0x8044('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x8044('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8044('0x2')]},'name':{'type':Sequelize[_0x8044('0x4')],'get':function(){return this[_0x8044('0x5')](_0x8044('0x6'));}}}; \ No newline at end of file +var _0x2206=['TEXT','medium','VIRTUAL','getDataValue','key','sequelize','STRING'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x2206,0x194));var _0x6220=function(_0xad0beb,_0x5880da){_0xad0beb=_0xad0beb-0x0;var _0x27ec66=_0x2206[_0xad0beb];return _0x27ec66;};'use strict';var Sequelize=require(_0x6220('0x0'));module['exports']={'key':{'type':Sequelize[_0x6220('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x6220('0x2')],'length':_0x6220('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6220('0x1')]},'name':{'type':Sequelize[_0x6220('0x4')],'get':function(){return this[_0x6220('0x5')](_0x6220('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 9ae4a2f..c5cecb8 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x519b=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','CannedAnswer','include','findAll','rows','catch','show','params','includeAll','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','role','UserProfileSection','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x519b,0x19d));var _0xb519=function(_0x449b54,_0x3776f3){_0x449b54=_0x449b54-0x0;var _0x32d6b9=_0x519b[_0x449b54];return _0x32d6b9;};'use strict';var emlformat=require(_0xb519('0x0'));var rimraf=require(_0xb519('0x1'));var zipdir=require(_0xb519('0x2'));var jsonpatch=require(_0xb519('0x3'));var rp=require(_0xb519('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb519('0x5'));var util=require(_0xb519('0x6'));var path=require(_0xb519('0x7'));var sox=require(_0xb519('0x8'));var csv=require(_0xb519('0x9'));var ejs=require(_0xb519('0xa'));var fs=require('fs');var fs_extra=require(_0xb519('0xb'));var _=require(_0xb519('0xc'));var squel=require(_0xb519('0xd'));var crypto=require(_0xb519('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb519('0xf'));var toCsv=require(_0xb519('0x9'));var querystring=require(_0xb519('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb519('0x11'));var qs=require(_0xb519('0x12'));var as=require(_0xb519('0x13'));var hardwareService=require(_0xb519('0x14'));var logger=require(_0xb519('0x15'))(_0xb519('0x16'));var utils=require(_0xb519('0x17'));var config=require(_0xb519('0x18'));var licenseUtil=require(_0xb519('0x19'));var db=require(_0xb519('0x1a'))['db'];function respondWithStatusCode(_0x3f99a0,_0x17d365){_0x17d365=_0x17d365||0xcc;return function(_0x4dd12a){if(_0x4dd12a){return _0x3f99a0['sendStatus'](_0x17d365);}return _0x3f99a0[_0xb519('0x1b')](_0x17d365)[_0xb519('0x1c')]();};}function respondWithResult(_0x45f63c,_0x34a076){_0x34a076=_0x34a076||0xc8;return function(_0x8e82a3){if(_0x8e82a3){return _0x45f63c[_0xb519('0x1b')](_0x34a076)[_0xb519('0x1d')](_0x8e82a3);}};}function respondWithFilteredResult(_0x276c6f,_0x224200){return function(_0x124965){if(_0x124965){var _0x44a882=typeof _0x224200[_0xb519('0x1e')]===_0xb519('0x1f')&&typeof _0x224200[_0xb519('0x20')]===_0xb519('0x1f');var _0x1258f7=_0x124965[_0xb519('0x21')];var _0x11f96c=_0x44a882?0x0:_0x224200[_0xb519('0x1e')];var _0x35cb95=_0x44a882?_0x124965[_0xb519('0x21')]:_0x224200['offset']+_0x224200[_0xb519('0x20')];var _0x4bf1a9;if(_0x35cb95>=_0x1258f7){_0x35cb95=_0x1258f7;_0x4bf1a9=0xc8;}else{_0x4bf1a9=0xce;}_0x276c6f[_0xb519('0x1b')](_0x4bf1a9);return _0x276c6f[_0xb519('0x22')](_0xb519('0x23'),_0x11f96c+'-'+_0x35cb95+'/'+_0x1258f7)[_0xb519('0x1d')](_0x124965);}return null;};}function patchUpdates(_0x4b4398){return function(_0x4a7e54){try{jsonpatch[_0xb519('0x24')](_0x4a7e54,_0x4b4398,!![]);}catch(_0x970e97){return BPromise[_0xb519('0x25')](_0x970e97);}return _0x4a7e54[_0xb519('0x26')]();};}function saveUpdates(_0x54352a,_0x13a7d1){return function(_0x182842){if(_0x182842){return _0x182842[_0xb519('0x27')](_0x54352a)[_0xb519('0x28')](function(_0xd16956){return _0xd16956;});}return null;};}function removeEntity(_0x251ef5,_0x3d4d0e){return function(_0x2bb354){if(_0x2bb354){return _0x2bb354[_0xb519('0x29')]()[_0xb519('0x28')](function(){var _0x2db1ec=_0x2bb354['get']({'plain':!![]});var _0x2b90b1=_0xb519('0x2a');return db['UserProfileResource'][_0xb519('0x29')]({'where':{'type':_0x2b90b1,'resourceId':_0x2db1ec['id']}})[_0xb519('0x28')](function(){return _0x2bb354;});})['then'](function(){_0x251ef5[_0xb519('0x1b')](0xcc)[_0xb519('0x1c')]();});}};}function handleEntityNotFound(_0x1eceb4,_0x68acef){return function(_0x5da2fb){if(!_0x5da2fb){_0x1eceb4['sendStatus'](0x194);}return _0x5da2fb;};}function handleError(_0x4a1cc4,_0x4e1fd2){_0x4e1fd2=_0x4e1fd2||0x1f4;return function(_0x52e493){logger['error'](_0x52e493['stack']);if(_0x52e493[_0xb519('0x2b')]){delete _0x52e493[_0xb519('0x2b')];}_0x4a1cc4['status'](_0x4e1fd2)[_0xb519('0x2c')](_0x52e493);};}exports[_0xb519('0x2d')]=function(_0x8f29f3,_0x4ecebb){var _0x537143={},_0x29ed43={},_0x5c3892={'count':0x0,'rows':[]};var _0x52f992=_[_0xb519('0x2e')](db['CannedAnswer'][_0xb519('0x2f')],function(_0x54118b){return{'name':_0x54118b[_0xb519('0x30')],'type':_0x54118b['type'][_0xb519('0x31')]};});_0x29ed43[_0xb519('0x32')]=_[_0xb519('0x2e')](_0x52f992,_0xb519('0x2b'));_0x29ed43['query']=_[_0xb519('0x33')](_0x8f29f3['query']);_0x29ed43['filters']=_[_0xb519('0x34')](_0x29ed43[_0xb519('0x32')],_0x29ed43[_0xb519('0x35')]);_0x537143[_0xb519('0x36')]=_['intersection'](_0x29ed43['model'],qs[_0xb519('0x37')](_0x8f29f3[_0xb519('0x35')]['fields']));_0x537143[_0xb519('0x36')]=_0x537143[_0xb519('0x36')][_0xb519('0x38')]?_0x537143[_0xb519('0x36')]:_0x29ed43['model'];if(!_0x8f29f3['query']['hasOwnProperty'](_0xb519('0x39'))){_0x537143[_0xb519('0x20')]=qs[_0xb519('0x20')](_0x8f29f3[_0xb519('0x35')][_0xb519('0x20')]);_0x537143[_0xb519('0x1e')]=qs['offset'](_0x8f29f3[_0xb519('0x35')]['offset']);}_0x537143[_0xb519('0x3a')]=qs[_0xb519('0x3b')](_0x8f29f3['query'][_0xb519('0x3b')]);_0x537143[_0xb519('0x3c')]=qs['filters'](_['pick'](_0x8f29f3[_0xb519('0x35')],_0x29ed43[_0xb519('0x3d')]),_0x52f992);if(_0x8f29f3['query'][_0xb519('0x3e')]){_0x537143['where']=_[_0xb519('0x3f')](_0x537143[_0xb519('0x3c')],{'$or':[{'key':{'$like':'%'+_0x8f29f3[_0xb519('0x35')][_0xb519('0x3e')]+'%'}},{'value':{'$like':'%'+_0x8f29f3[_0xb519('0x35')][_0xb519('0x3e')]+'%'}}]});}_0x537143=_['merge']({},_0x537143,_0x8f29f3[_0xb519('0x40')]);var _0x5030fc={'where':_0x537143[_0xb519('0x3c')]};return db[_0xb519('0x41')]['count'](_0x5030fc)[_0xb519('0x28')](function(_0x255310){_0x5c3892[_0xb519('0x21')]=_0x255310;if(_0x8f29f3[_0xb519('0x35')]['includeAll']){_0x537143[_0xb519('0x42')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb519('0x43')](_0x537143);})[_0xb519('0x28')](function(_0x5f190a){_0x5c3892[_0xb519('0x44')]=_0x5f190a;return _0x5c3892;})[_0xb519('0x28')](respondWithFilteredResult(_0x4ecebb,_0x537143))[_0xb519('0x45')](handleError(_0x4ecebb,null));};exports[_0xb519('0x46')]=function(_0x4d94d9,_0xa5d370){var _0x1c083d={'raw':!![],'where':{'id':_0x4d94d9[_0xb519('0x47')]['id']}},_0x11a4d5={};_0x11a4d5[_0xb519('0x32')]=_['keys'](db['CannedAnswer'][_0xb519('0x2f')]);_0x11a4d5[_0xb519('0x35')]=_[_0xb519('0x33')](_0x4d94d9['query']);_0x11a4d5[_0xb519('0x3d')]=_[_0xb519('0x34')](_0x11a4d5[_0xb519('0x32')],_0x11a4d5[_0xb519('0x35')]);_0x1c083d[_0xb519('0x36')]=_[_0xb519('0x34')](_0x11a4d5[_0xb519('0x32')],qs[_0xb519('0x37')](_0x4d94d9[_0xb519('0x35')][_0xb519('0x37')]));_0x1c083d[_0xb519('0x36')]=_0x1c083d[_0xb519('0x36')][_0xb519('0x38')]?_0x1c083d[_0xb519('0x36')]:_0x11a4d5[_0xb519('0x32')];if(_0x4d94d9[_0xb519('0x35')][_0xb519('0x48')]){_0x1c083d[_0xb519('0x42')]=[{'all':!![]}];}_0x1c083d=_[_0xb519('0x3f')]({},_0x1c083d,_0x4d94d9['options']);return db[_0xb519('0x41')][_0xb519('0x49')](_0x1c083d)[_0xb519('0x28')](handleEntityNotFound(_0xa5d370,null))[_0xb519('0x28')](respondWithResult(_0xa5d370,null))['catch'](handleError(_0xa5d370,null));};exports[_0xb519('0x27')]=function(_0x213c77,_0x259b90){if(_0x213c77['body']['id']){delete _0x213c77[_0xb519('0x4a')]['id'];}return db[_0xb519('0x41')][_0xb519('0x49')]({'where':{'id':_0x213c77[_0xb519('0x47')]['id']}})['then'](handleEntityNotFound(_0x259b90,null))[_0xb519('0x28')](saveUpdates(_0x213c77[_0xb519('0x4a')],null))[_0xb519('0x28')](respondWithResult(_0x259b90,null))[_0xb519('0x45')](handleError(_0x259b90,null));};exports[_0xb519('0x29')]=function(_0x85f790,_0x4b04bc){return db[_0xb519('0x41')][_0xb519('0x49')]({'where':{'id':_0x85f790['params']['id']}})['then'](handleEntityNotFound(_0x4b04bc,null))['then'](removeEntity(_0x4b04bc,null))[_0xb519('0x45')](handleError(_0x4b04bc,null));};exports['create']=function(_0xb028b7,_0xa360c6){var _0x27680f={'key':_0xb028b7[_0xb519('0x4a')][_0xb519('0x31')]};if(_0xb028b7[_0xb519('0x4a')][_0xb519('0x4b')]){_0x27680f['MailAccountId']=_0xb028b7['body'][_0xb519('0x4b')];}else if(_0xb028b7[_0xb519('0x4a')][_0xb519('0x4c')]){_0x27680f[_0xb519('0x4c')]=_0xb028b7['body']['SmsAccountId'];}else if(_0xb028b7[_0xb519('0x4a')][_0xb519('0x4d')]){_0x27680f[_0xb519('0x4d')]=_0xb028b7['body']['OpenchannelAccountId'];}else if(_0xb028b7['body'][_0xb519('0x4e')]){_0x27680f['ChatWebsiteId']=_0xb028b7[_0xb519('0x4a')][_0xb519('0x4e')];}return db[_0xb519('0x41')]['find']({'where':_0x27680f})[_0xb519('0x28')](function(_0x3c0e96){if(_0x3c0e96){throw new db['Sequelize'][(_0xb519('0x4f'))](_0xb519('0x50'));}return db[_0xb519('0x41')]['create'](_0xb028b7[_0xb519('0x4a')]);})[_0xb519('0x28')](function(_0x1afa81){var _0x3221c6=_0xb028b7[_0xb519('0x51')][_0xb519('0x52')]({'plain':!![]});if(!_0x3221c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3221c6[_0xb519('0x53')]===_0xb519('0x51')){var _0x368165=_0x1afa81[_0xb519('0x52')]({'plain':!![]});return db[_0xb519('0x54')][_0xb519('0x49')]({'where':{'name':_0xb519('0x2a'),'userProfileId':_0x3221c6[_0xb519('0x55')]},'raw':!![]})[_0xb519('0x28')](function(_0x54fd04){if(_0x54fd04&&_0x54fd04['autoAssociation']===0x0){return db['UserProfileResource'][_0xb519('0x56')]({'name':_0x368165[_0xb519('0x2b')],'resourceId':_0x368165['id'],'type':_0x54fd04[_0xb519('0x2b')],'sectionId':_0x54fd04['id']},{})[_0xb519('0x28')](function(){return _0x1afa81;});}else{return _0x1afa81;}})[_0xb519('0x45')](function(_0x166977){logger[_0xb519('0x57')](_0xb519('0x58'),_0x166977);throw _0x166977;});}return _0x1afa81;})[_0xb519('0x28')](respondWithResult(_0xa360c6,0xc9))[_0xb519('0x45')](handleError(_0xa360c6,null));}; \ No newline at end of file +var _0x79c6=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','end','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','find','body','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x208193,_0x530321){var _0x57cd36=function(_0x57d9f4){while(--_0x57d9f4){_0x208193['push'](_0x208193['shift']());}};_0x57cd36(++_0x530321);}(_0x79c6,0xb1));var _0x679c=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x79c6[_0x411017];return _0x2adeea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x679c('0x0'));var zipdir=require(_0x679c('0x1'));var jsonpatch=require(_0x679c('0x2'));var rp=require(_0x679c('0x3'));var moment=require('moment');var BPromise=require(_0x679c('0x4'));var Mustache=require(_0x679c('0x5'));var util=require(_0x679c('0x6'));var path=require('path');var sox=require(_0x679c('0x7'));var csv=require(_0x679c('0x8'));var ejs=require(_0x679c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x679c('0xa'));var squel=require(_0x679c('0xb'));var crypto=require(_0x679c('0xc'));var jsforce=require(_0x679c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x679c('0x8'));var querystring=require(_0x679c('0xe'));var Papa=require(_0x679c('0xf'));var Redis=require(_0x679c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x679c('0x11'));var as=require(_0x679c('0x12'));var hardwareService=require(_0x679c('0x13'));var logger=require(_0x679c('0x14'))(_0x679c('0x15'));var utils=require(_0x679c('0x16'));var config=require(_0x679c('0x17'));var licenseUtil=require(_0x679c('0x18'));var db=require(_0x679c('0x19'))['db'];function respondWithStatusCode(_0x1c2e04,_0x5da738){_0x5da738=_0x5da738||0xcc;return function(_0x47f311){if(_0x47f311){return _0x1c2e04[_0x679c('0x1a')](_0x5da738);}return _0x1c2e04[_0x679c('0x1b')](_0x5da738)['end']();};}function respondWithResult(_0x37e06e,_0x1430e0){_0x1430e0=_0x1430e0||0xc8;return function(_0x30df63){if(_0x30df63){return _0x37e06e[_0x679c('0x1b')](_0x1430e0)['json'](_0x30df63);}};}function respondWithFilteredResult(_0xf15701,_0x478bb4){return function(_0x582c60){if(_0x582c60){var _0x2bc10e=typeof _0x478bb4['offset']===_0x679c('0x1c')&&typeof _0x478bb4[_0x679c('0x1d')]===_0x679c('0x1c');var _0x24a65a=_0x582c60[_0x679c('0x1e')];var _0x24f946=_0x2bc10e?0x0:_0x478bb4[_0x679c('0x1f')];var _0x508bcf=_0x2bc10e?_0x582c60[_0x679c('0x1e')]:_0x478bb4[_0x679c('0x1f')]+_0x478bb4['limit'];var _0x3e9447;if(_0x508bcf>=_0x24a65a){_0x508bcf=_0x24a65a;_0x3e9447=0xc8;}else{_0x3e9447=0xce;}_0xf15701[_0x679c('0x1b')](_0x3e9447);return _0xf15701[_0x679c('0x20')]('Content-Range',_0x24f946+'-'+_0x508bcf+'/'+_0x24a65a)[_0x679c('0x21')](_0x582c60);}return null;};}function patchUpdates(_0x10b14c){return function(_0x2cc76c){try{jsonpatch['apply'](_0x2cc76c,_0x10b14c,!![]);}catch(_0x457b4d){return BPromise[_0x679c('0x22')](_0x457b4d);}return _0x2cc76c[_0x679c('0x23')]();};}function saveUpdates(_0x421f9c,_0x319c56){return function(_0x2ac9fa){if(_0x2ac9fa){return _0x2ac9fa[_0x679c('0x24')](_0x421f9c)[_0x679c('0x25')](function(_0x11771e){return _0x11771e;});}return null;};}function removeEntity(_0x5aec84,_0x38625c){return function(_0x4e3490){if(_0x4e3490){return _0x4e3490[_0x679c('0x26')]()[_0x679c('0x25')](function(){var _0x3240be=_0x4e3490['get']({'plain':!![]});var _0x299189=_0x679c('0x27');return db[_0x679c('0x28')][_0x679c('0x26')]({'where':{'type':_0x299189,'resourceId':_0x3240be['id']}})[_0x679c('0x25')](function(){return _0x4e3490;});})[_0x679c('0x25')](function(){_0x5aec84[_0x679c('0x1b')](0xcc)[_0x679c('0x29')]();});}};}function handleEntityNotFound(_0x53726e,_0x555a3c){return function(_0x4fe758){if(!_0x4fe758){_0x53726e['sendStatus'](0x194);}return _0x4fe758;};}function handleError(_0x356f69,_0x5f3866){_0x5f3866=_0x5f3866||0x1f4;return function(_0x59a3a8){logger[_0x679c('0x2a')](_0x59a3a8[_0x679c('0x2b')]);if(_0x59a3a8[_0x679c('0x2c')]){delete _0x59a3a8[_0x679c('0x2c')];}_0x356f69[_0x679c('0x1b')](_0x5f3866)['send'](_0x59a3a8);};}exports[_0x679c('0x2d')]=function(_0x18316c,_0x5229e9){var _0x1db4b7={},_0x3838d8={},_0x53a758={'count':0x0,'rows':[]};var _0x4d9734=_[_0x679c('0x2e')](db[_0x679c('0x2f')][_0x679c('0x30')],function(_0x15ff78){return{'name':_0x15ff78[_0x679c('0x31')],'type':_0x15ff78[_0x679c('0x32')]['key']};});_0x3838d8['model']=_['map'](_0x4d9734,_0x679c('0x2c'));_0x3838d8[_0x679c('0x33')]=_[_0x679c('0x34')](_0x18316c[_0x679c('0x33')]);_0x3838d8[_0x679c('0x35')]=_['intersection'](_0x3838d8[_0x679c('0x36')],_0x3838d8[_0x679c('0x33')]);_0x1db4b7[_0x679c('0x37')]=_[_0x679c('0x38')](_0x3838d8[_0x679c('0x36')],qs[_0x679c('0x39')](_0x18316c[_0x679c('0x33')][_0x679c('0x39')]));_0x1db4b7[_0x679c('0x37')]=_0x1db4b7[_0x679c('0x37')][_0x679c('0x3a')]?_0x1db4b7['attributes']:_0x3838d8[_0x679c('0x36')];if(!_0x18316c['query'][_0x679c('0x3b')]('nolimit')){_0x1db4b7[_0x679c('0x1d')]=qs[_0x679c('0x1d')](_0x18316c[_0x679c('0x33')]['limit']);_0x1db4b7[_0x679c('0x1f')]=qs[_0x679c('0x1f')](_0x18316c[_0x679c('0x33')]['offset']);}_0x1db4b7['order']=qs['sort'](_0x18316c[_0x679c('0x33')]['sort']);_0x1db4b7['where']=qs[_0x679c('0x35')](_[_0x679c('0x3c')](_0x18316c[_0x679c('0x33')],_0x3838d8['filters']),_0x4d9734);if(_0x18316c['query'][_0x679c('0x3d')]){_0x1db4b7['where']=_[_0x679c('0x3e')](_0x1db4b7[_0x679c('0x3f')],{'$or':[{'key':{'$like':'%'+_0x18316c[_0x679c('0x33')][_0x679c('0x3d')]+'%'}},{'value':{'$like':'%'+_0x18316c['query']['filter']+'%'}}]});}_0x1db4b7=_[_0x679c('0x3e')]({},_0x1db4b7,_0x18316c[_0x679c('0x40')]);var _0x1fb9d5={'where':_0x1db4b7['where']};return db['CannedAnswer'][_0x679c('0x1e')](_0x1fb9d5)[_0x679c('0x25')](function(_0x461adc){_0x53a758['count']=_0x461adc;if(_0x18316c[_0x679c('0x33')][_0x679c('0x41')]){_0x1db4b7[_0x679c('0x42')]=[{'all':!![]}];}return db[_0x679c('0x2f')][_0x679c('0x43')](_0x1db4b7);})[_0x679c('0x25')](function(_0x109425){_0x53a758[_0x679c('0x44')]=_0x109425;return _0x53a758;})[_0x679c('0x25')](respondWithFilteredResult(_0x5229e9,_0x1db4b7))[_0x679c('0x45')](handleError(_0x5229e9,null));};exports[_0x679c('0x46')]=function(_0x5c127f,_0x9a0277){var _0x5864a8={'raw':!![],'where':{'id':_0x5c127f['params']['id']}},_0x41676c={};_0x41676c[_0x679c('0x36')]=_['keys'](db[_0x679c('0x2f')][_0x679c('0x30')]);_0x41676c[_0x679c('0x33')]=_[_0x679c('0x34')](_0x5c127f[_0x679c('0x33')]);_0x41676c[_0x679c('0x35')]=_[_0x679c('0x38')](_0x41676c[_0x679c('0x36')],_0x41676c[_0x679c('0x33')]);_0x5864a8['attributes']=_['intersection'](_0x41676c[_0x679c('0x36')],qs[_0x679c('0x39')](_0x5c127f[_0x679c('0x33')][_0x679c('0x39')]));_0x5864a8[_0x679c('0x37')]=_0x5864a8[_0x679c('0x37')][_0x679c('0x3a')]?_0x5864a8[_0x679c('0x37')]:_0x41676c[_0x679c('0x36')];if(_0x5c127f[_0x679c('0x33')]['includeAll']){_0x5864a8[_0x679c('0x42')]=[{'all':!![]}];}_0x5864a8=_['merge']({},_0x5864a8,_0x5c127f[_0x679c('0x40')]);return db[_0x679c('0x2f')][_0x679c('0x47')](_0x5864a8)[_0x679c('0x25')](handleEntityNotFound(_0x9a0277,null))[_0x679c('0x25')](respondWithResult(_0x9a0277,null))[_0x679c('0x45')](handleError(_0x9a0277,null));};exports[_0x679c('0x24')]=function(_0x4ae4da,_0x441775){if(_0x4ae4da['body']['id']){delete _0x4ae4da[_0x679c('0x48')]['id'];}return db['CannedAnswer'][_0x679c('0x47')]({'where':{'id':_0x4ae4da[_0x679c('0x49')]['id']}})[_0x679c('0x25')](handleEntityNotFound(_0x441775,null))[_0x679c('0x25')](saveUpdates(_0x4ae4da[_0x679c('0x48')],null))[_0x679c('0x25')](respondWithResult(_0x441775,null))['catch'](handleError(_0x441775,null));};exports['destroy']=function(_0x394855,_0x34f60f){return db[_0x679c('0x2f')]['find']({'where':{'id':_0x394855[_0x679c('0x49')]['id']}})['then'](handleEntityNotFound(_0x34f60f,null))[_0x679c('0x25')](removeEntity(_0x34f60f,null))[_0x679c('0x45')](handleError(_0x34f60f,null));};exports[_0x679c('0x4a')]=function(_0x56324f,_0x1b8b12){var _0x353097={'key':_0x56324f[_0x679c('0x48')][_0x679c('0x4b')]};if(_0x56324f[_0x679c('0x48')][_0x679c('0x4c')]){_0x353097['MailAccountId']=_0x56324f[_0x679c('0x48')][_0x679c('0x4c')];}else if(_0x56324f[_0x679c('0x48')][_0x679c('0x4d')]){_0x353097[_0x679c('0x4d')]=_0x56324f[_0x679c('0x48')][_0x679c('0x4d')];}else if(_0x56324f[_0x679c('0x48')]['OpenchannelAccountId']){_0x353097[_0x679c('0x4e')]=_0x56324f[_0x679c('0x48')][_0x679c('0x4e')];}else if(_0x56324f[_0x679c('0x48')]['ChatWebsiteId']){_0x353097[_0x679c('0x4f')]=_0x56324f[_0x679c('0x48')][_0x679c('0x4f')];}return db['CannedAnswer']['find']({'where':_0x353097})[_0x679c('0x25')](function(_0x236501){if(_0x236501){throw new db[(_0x679c('0x50'))][(_0x679c('0x51'))](_0x679c('0x52'));}return db[_0x679c('0x2f')][_0x679c('0x4a')](_0x56324f[_0x679c('0x48')]);})[_0x679c('0x25')](function(_0x16e963){var _0x351b5b=_0x56324f[_0x679c('0x53')][_0x679c('0x54')]({'plain':!![]});if(!_0x351b5b)throw new Error(_0x679c('0x55'));if(_0x351b5b['role']===_0x679c('0x53')){var _0x4d3d4d=_0x16e963[_0x679c('0x54')]({'plain':!![]});return db[_0x679c('0x56')][_0x679c('0x47')]({'where':{'name':_0x679c('0x27'),'userProfileId':_0x351b5b['userProfileId']},'raw':!![]})['then'](function(_0x2501e4){if(_0x2501e4&&_0x2501e4['autoAssociation']===0x0){return db[_0x679c('0x28')][_0x679c('0x4a')]({'name':_0x4d3d4d[_0x679c('0x2c')],'resourceId':_0x4d3d4d['id'],'type':_0x2501e4[_0x679c('0x2c')],'sectionId':_0x2501e4['id']},{})[_0x679c('0x25')](function(){return _0x16e963;});}else{return _0x16e963;}})[_0x679c('0x45')](function(_0x4cd9c5){logger[_0x679c('0x2a')](_0x679c('0x57'),_0x4cd9c5);throw _0x4cd9c5;});}return _0x16e963;})[_0x679c('0x25')](respondWithResult(_0x1b8b12,0xc9))['catch'](handleError(_0x1b8b12,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 5eefd35..f744545 100644 --- a/server/api/cannedAnswer/cannedAnswer.model.js +++ b/server/api/cannedAnswer/cannedAnswer.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39aa=['moment','bluebird','request-promise','path','rimraf','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x47cd82,_0x526cc0){var _0x32ad55=function(_0x18ca6f){while(--_0x18ca6f){_0x47cd82['push'](_0x47cd82['shift']());}};_0x32ad55(++_0x526cc0);}(_0x39aa,0x11b));var _0xa39a=function(_0x2e846d,_0x370cd6){_0x2e846d=_0x2e846d-0x0;var _0x10a6ab=_0x39aa[_0x2e846d];return _0x10a6ab;};'use strict';var _=require(_0xa39a('0x0'));var util=require(_0xa39a('0x1'));var logger=require('../../config/logger')(_0xa39a('0x2'));var moment=require(_0xa39a('0x3'));var BPromise=require(_0xa39a('0x4'));var rp=require(_0xa39a('0x5'));var fs=require('fs');var path=require(_0xa39a('0x6'));var rimraf=require(_0xa39a('0x7'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x3dba2c,_0x911d67){return _0x3dba2c[_0xa39a('0x8')](_0xa39a('0x9'),attributes,{'tableName':_0xa39a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa39a('0xb'),'collate':_0xa39a('0xc')});}; \ No newline at end of file +var _0xbefe=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','tools_canned_answers','utf8mb4'];(function(_0x3d8088,_0x59af8b){var _0x1705a6=function(_0x44ef7b){while(--_0x44ef7b){_0x3d8088['push'](_0x3d8088['shift']());}};_0x1705a6(++_0x59af8b);}(_0xbefe,0x168));var _0xebef=function(_0x166b97,_0x2833d5){_0x166b97=_0x166b97-0x0;var _0x4d3c9a=_0xbefe[_0x166b97];return _0x4d3c9a;};'use strict';var _=require('lodash');var util=require(_0xebef('0x0'));var logger=require('../../config/logger')(_0xebef('0x1'));var moment=require(_0xebef('0x2'));var BPromise=require(_0xebef('0x3'));var rp=require(_0xebef('0x4'));var fs=require('fs');var path=require(_0xebef('0x5'));var rimraf=require(_0xebef('0x6'));var config=require(_0xebef('0x7'));var attributes=require(_0xebef('0x8'));module['exports']=function(_0x3fe404,_0x39de80){return _0x3fe404[_0xebef('0x9')]('CannedAnswer',attributes,{'tableName':_0xebef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xebef('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index d8cdc5e..6950705 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3284fd,_0x547a9e){var _0x506e20=function(_0x26cc53){while(--_0x26cc53){_0x3284fd['push'](_0x3284fd['shift']());}};_0x506e20(++_0x547a9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3b1821,_0x5e44c9){var _0x655316=function(_0x367a6d){while(--_0x367a6d){_0x3b1821['push'](_0x3b1821['shift']());}};_0x655316(++_0x5e44c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 5370a54..09a5497 100644 --- a/server/api/cannedAnswer/index.js +++ b/server/api/cannedAnswer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6717=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','destroy','exports','multer'];(function(_0x631c23,_0x3e18bc){var _0x37f536=function(_0x2a0d53){while(--_0x2a0d53){_0x631c23['push'](_0x631c23['shift']());}};_0x37f536(++_0x3e18bc);}(_0x6717,0x1ef));var _0x7671=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6717[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7671('0x0'));var util=require('util');var path=require(_0x7671('0x1'));var timeout=require(_0x7671('0x2'));var express=require('express');var router=express[_0x7671('0x3')]();var fs_extra=require(_0x7671('0x4'));var auth=require(_0x7671('0x5'));var interaction=require(_0x7671('0x6'));var config=require('../../config/environment');var controller=require(_0x7671('0x7'));router[_0x7671('0x8')]('/',auth[_0x7671('0x9')](),controller[_0x7671('0xa')]);router['get'](_0x7671('0xb'),auth[_0x7671('0x9')](),controller[_0x7671('0xc')]);router['post']('/',auth[_0x7671('0x9')](),controller[_0x7671('0xd')]);router['put'](_0x7671('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7671('0xb'),auth[_0x7671('0x9')](),controller[_0x7671('0xe')]);module[_0x7671('0xf')]=router; \ No newline at end of file +var _0x9242=['/:id','show','post','create','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','index','get'];(function(_0x48f80a,_0x3bb5d4){var _0x1327fb=function(_0x46293e){while(--_0x46293e){_0x48f80a['push'](_0x48f80a['shift']());}};_0x1327fb(++_0x3bb5d4);}(_0x9242,0x1d0));var _0x2924=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x9242[_0x4b7b69];return _0x173b4c;};'use strict';var multer=require(_0x2924('0x0'));var util=require(_0x2924('0x1'));var path=require(_0x2924('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2924('0x3')]();var fs_extra=require(_0x2924('0x4'));var auth=require(_0x2924('0x5'));var interaction=require(_0x2924('0x6'));var config=require('../../config/environment');var controller=require(_0x2924('0x7'));router['get']('/',auth[_0x2924('0x8')](),controller[_0x2924('0x9')]);router[_0x2924('0xa')](_0x2924('0xb'),auth[_0x2924('0x8')](),controller[_0x2924('0xc')]);router[_0x2924('0xd')]('/',auth[_0x2924('0x8')](),controller[_0x2924('0xe')]);router[_0x2924('0xf')](_0x2924('0xb'),auth['isAuthenticated'](),controller[_0x2924('0x10')]);router[_0x2924('0x11')](_0x2924('0xb'),auth[_0x2924('0x8')](),controller['destroy']);module[_0x2924('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 6a74431..29663d5 100644 --- a/server/api/cdr/cdr.attributes.js +++ b/server/api/cdr/cdr.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda1c=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x4c8c4d,_0x170fc3){var _0x7c72d2=function(_0x249fd1){while(--_0x249fd1){_0x4c8c4d['push'](_0x4c8c4d['shift']());}};_0x7c72d2(++_0x170fc3);}(_0xda1c,0x68));var _0xcda1=function(_0x136a97,_0x140d35){_0x136a97=_0x136a97-0x0;var _0x42f478=_0xda1c[_0x136a97];return _0x42f478;};'use strict';var Sequelize=require(_0xcda1('0x0'));module[_0xcda1('0x1')]={'calldate':{'type':Sequelize[_0xcda1('0x2')],'allowNull':![],'defaultValue':_0xcda1('0x3')},'clid':{'type':Sequelize[_0xcda1('0x4')]},'src':{'type':Sequelize[_0xcda1('0x4')]},'dst':{'type':Sequelize[_0xcda1('0x4')]},'dcontext':{'type':Sequelize[_0xcda1('0x4')]},'channel':{'type':Sequelize[_0xcda1('0x4')]},'dstchannel':{'type':Sequelize[_0xcda1('0x4')]},'lastapp':{'type':Sequelize[_0xcda1('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xcda1('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xcda1('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcda1('0x4')]},'amaflags':{'type':Sequelize[_0xcda1('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xcda1('0x4')]},'userfield':{'type':Sequelize[_0xcda1('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xcda1('0x4')]},'sequence':{'type':Sequelize[_0xcda1('0x4')]},'peeraccount':{'type':Sequelize[_0xcda1('0x4')]},'type':{'type':Sequelize[_0xcda1('0x4')]},'tag':{'type':Sequelize[_0xcda1('0x4')]}}; \ No newline at end of file +var _0xec81=['INTEGER','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0xec81,0x71));var _0x1ec8=function(_0x36d45b,_0x417426){_0x36d45b=_0x36d45b-0x0;var _0x3dc01c=_0xec81[_0x36d45b];return _0x3dc01c;};'use strict';var Sequelize=require('sequelize');module[_0x1ec8('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x1ec8('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x1ec8('0x2')]},'dst':{'type':Sequelize[_0x1ec8('0x2')]},'dcontext':{'type':Sequelize[_0x1ec8('0x2')]},'channel':{'type':Sequelize[_0x1ec8('0x2')]},'dstchannel':{'type':Sequelize[_0x1ec8('0x2')]},'lastapp':{'type':Sequelize[_0x1ec8('0x2')]},'lastdata':{'type':Sequelize[_0x1ec8('0x2')]},'duration':{'type':Sequelize[_0x1ec8('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1ec8('0x2')]},'amaflags':{'type':Sequelize[_0x1ec8('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x1ec8('0x2')]},'uniqueid':{'type':Sequelize[_0x1ec8('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x1ec8('0x2')]},'peeraccount':{'type':Sequelize[_0x1ec8('0x2')]},'type':{'type':Sequelize[_0x1ec8('0x2')]},'tag':{'type':Sequelize[_0x1ec8('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 2860f77..9184faa 100644 --- a/server/api/cdr/cdr.controller.js +++ b/server/api/cdr/cdr.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e85=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0x1dda71,_0x2bb545){var _0x5f2f56=function(_0x12b250){while(--_0x12b250){_0x1dda71['push'](_0x1dda71['shift']());}};_0x5f2f56(++_0x2bb545);}(_0x0e85,0x7c));var _0x50e8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0e85[_0x31a371];return _0x2a5bd6;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['map'](_0x126c99,'name');_0x4f0b88[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x30fedf[_0x50e8('0x2e')]);_0x4f0b88['filters']=_['intersection'](_0x4f0b88[_0x50e8('0x2d')],_0x4f0b88[_0x50e8('0x2e')]);_0x42bbef['attributes']=_[_0x50e8('0x30')](_0x4f0b88[_0x50e8('0x2d')],qs[_0x50e8('0x31')](_0x30fedf[_0x50e8('0x2e')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef['attributes'][_0x50e8('0x33')]?_0x42bbef[_0x50e8('0x32')]:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf['query'][_0x50e8('0x34')](_0x50e8('0x35'))){_0x42bbef['limit']=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1d')]);_0x42bbef[_0x50e8('0x1b')]=qs['offset'](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1b')]);}_0x42bbef[_0x50e8('0x36')]=qs[_0x50e8('0x37')](_0x30fedf['query'][_0x50e8('0x37')]);_0x42bbef[_0x50e8('0x38')]=qs[_0x50e8('0x39')](_['pick'](_0x30fedf['query'],_0x4f0b88['filters']),_0x126c99);if(_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]){_0x42bbef[_0x50e8('0x38')]=_[_0x50e8('0x3b')](_0x42bbef[_0x50e8('0x38')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0xb566c2){if(_0xb566c2[_0x50e8('0x3c')]!==_0x50e8('0x3d')){var _0x3a1b4d={};_0x3a1b4d[_0xb566c2['name']]={'$like':'%'+_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]+'%'};return _0x3a1b4d;}})});}_0x42bbef=_[_0x50e8('0x3b')]({},_0x42bbef,_0x30fedf[_0x50e8('0x3e')]);var _0x5dbbe1={'where':_0x42bbef[_0x50e8('0x38')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x5dbbe1)[_0x50e8('0x23')](function(_0x8e8a97){_0x1041b9['count']=_0x8e8a97;if(_0x30fedf['query'][_0x50e8('0x3f')]){_0x42bbef[_0x50e8('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x50e8('0x41')](_0x42bbef);})[_0x50e8('0x23')](function(_0x3db1ab){_0x1041b9[_0x50e8('0x42')]=_0x3db1ab;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x43')](handleError(_0x39c0c6,null));};exports[_0x50e8('0x44')]=function(_0x172049,_0x5e9da3){var _0x3d26bd={'raw':!![],'where':{'id':_0x172049[_0x50e8('0x45')]['id']}},_0x44e0ca={};_0x44e0ca[_0x50e8('0x2d')]=_['keys'](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x44e0ca[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x172049['query']);_0x44e0ca[_0x50e8('0x39')]=_['intersection'](_0x44e0ca['model'],_0x44e0ca['query']);_0x3d26bd[_0x50e8('0x32')]=_[_0x50e8('0x30')](_0x44e0ca['model'],qs[_0x50e8('0x31')](_0x172049[_0x50e8('0x2e')][_0x50e8('0x31')]));_0x3d26bd[_0x50e8('0x32')]=_0x3d26bd[_0x50e8('0x32')][_0x50e8('0x33')]?_0x3d26bd['attributes']:_0x44e0ca[_0x50e8('0x2d')];if(_0x172049['query'][_0x50e8('0x3f')]){_0x3d26bd[_0x50e8('0x40')]=[{'all':!![]}];}_0x3d26bd=_['merge']({},_0x3d26bd,_0x172049[_0x50e8('0x3e')]);return db['Cdr'][_0x50e8('0x46')](_0x3d26bd)[_0x50e8('0x23')](handleEntityNotFound(_0x5e9da3,null))[_0x50e8('0x23')](respondWithResult(_0x5e9da3,null))[_0x50e8('0x43')](handleError(_0x5e9da3,null));};exports[_0x50e8('0x47')]=function(_0x3f72ea,_0x229d60){return db[_0x50e8('0x29')][_0x50e8('0x47')](_0x3f72ea[_0x50e8('0x48')],{})[_0x50e8('0x23')](respondWithResult(_0x229d60,0xc9))['catch'](handleError(_0x229d60,null));};exports[_0x50e8('0x22')]=function(_0x275a1b,_0x479431){if(_0x275a1b[_0x50e8('0x48')]['id']){delete _0x275a1b['body']['id'];}return db[_0x50e8('0x29')]['find']({'where':{'id':_0x275a1b[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x479431,null))[_0x50e8('0x23')](saveUpdates(_0x275a1b[_0x50e8('0x48')],null))[_0x50e8('0x23')](respondWithResult(_0x479431,null))[_0x50e8('0x43')](handleError(_0x479431,null));};exports[_0x50e8('0x49')]=function(_0x5f256a,_0x3410f3){return db[_0x50e8('0x29')][_0x50e8('0x46')]({'where':{'id':_0x5f256a[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x3410f3,null))[_0x50e8('0x23')](removeEntity(_0x3410f3,null))['catch'](handleError(_0x3410f3,null));};exports[_0x50e8('0x4a')]=function(_0x250b28,_0xff2e24){return db[_0x50e8('0x29')]['describe']()[_0x50e8('0x23')](respondWithResult(_0xff2e24,null))[_0x50e8('0x43')](handleError(_0xff2e24,null));}; \ No newline at end of file +var _0x9206=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','Cdr','fieldName','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel'];(function(_0x51684f,_0x4f2d0d){var _0x3480ff=function(_0x58dda5){while(--_0x58dda5){_0x51684f['push'](_0x51684f['shift']());}};_0x3480ff(++_0x4f2d0d);}(_0x9206,0x176));var _0x6920=function(_0x1b2bad,_0x390b93){_0x1b2bad=_0x1b2bad-0x0;var _0x1c83ed=_0x9206[_0x1b2bad];return _0x1c83ed;};'use strict';var emlformat=require(_0x6920('0x0'));var rimraf=require(_0x6920('0x1'));var zipdir=require(_0x6920('0x2'));var jsonpatch=require(_0x6920('0x3'));var rp=require(_0x6920('0x4'));var moment=require(_0x6920('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6920('0x6'));var path=require(_0x6920('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6920('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6920('0x9'));var squel=require(_0x6920('0xa'));var crypto=require(_0x6920('0xb'));var jsforce=require(_0x6920('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6920('0xd'));var Papa=require(_0x6920('0xe'));var Redis=require(_0x6920('0xf'));var authService=require(_0x6920('0x10'));var qs=require(_0x6920('0x11'));var as=require(_0x6920('0x12'));var hardwareService=require(_0x6920('0x13'));var logger=require(_0x6920('0x14'))(_0x6920('0x15'));var utils=require(_0x6920('0x16'));var config=require(_0x6920('0x17'));var licenseUtil=require(_0x6920('0x18'));var db=require(_0x6920('0x19'))['db'];function respondWithStatusCode(_0x5ad438,_0x4f8430){_0x4f8430=_0x4f8430||0xcc;return function(_0x31730c){if(_0x31730c){return _0x5ad438[_0x6920('0x1a')](_0x4f8430);}return _0x5ad438['status'](_0x4f8430)[_0x6920('0x1b')]();};}function respondWithResult(_0xfa2823,_0x18140a){_0x18140a=_0x18140a||0xc8;return function(_0x2c3a35){if(_0x2c3a35){return _0xfa2823[_0x6920('0x1c')](_0x18140a)['json'](_0x2c3a35);}};}function respondWithFilteredResult(_0x338e5f,_0x20cdfb){return function(_0x15d8af){if(_0x15d8af){var _0xa64034=typeof _0x20cdfb[_0x6920('0x1d')]===_0x6920('0x1e')&&typeof _0x20cdfb[_0x6920('0x1f')]===_0x6920('0x1e');var _0x11ce91=_0x15d8af[_0x6920('0x20')];var _0x462500=_0xa64034?0x0:_0x20cdfb[_0x6920('0x1d')];var _0xc6e86b=_0xa64034?_0x15d8af[_0x6920('0x20')]:_0x20cdfb[_0x6920('0x1d')]+_0x20cdfb['limit'];var _0x3a0c0c;if(_0xc6e86b>=_0x11ce91){_0xc6e86b=_0x11ce91;_0x3a0c0c=0xc8;}else{_0x3a0c0c=0xce;}_0x338e5f[_0x6920('0x1c')](_0x3a0c0c);return _0x338e5f[_0x6920('0x21')](_0x6920('0x22'),_0x462500+'-'+_0xc6e86b+'/'+_0x11ce91)[_0x6920('0x23')](_0x15d8af);}return null;};}function patchUpdates(_0x16cb96){return function(_0x2cce0b){try{jsonpatch[_0x6920('0x24')](_0x2cce0b,_0x16cb96,!![]);}catch(_0xaf93ba){return BPromise[_0x6920('0x25')](_0xaf93ba);}return _0x2cce0b[_0x6920('0x26')]();};}function saveUpdates(_0x39013e,_0x1df372){return function(_0x2dd788){if(_0x2dd788){return _0x2dd788[_0x6920('0x27')](_0x39013e)[_0x6920('0x28')](function(_0x1ae686){return _0x1ae686;});}return null;};}function removeEntity(_0x3a6e48,_0xa8f55){return function(_0x258986){if(_0x258986){return _0x258986['destroy']()[_0x6920('0x28')](function(){_0x3a6e48['status'](0xcc)[_0x6920('0x1b')]();});}};}function handleEntityNotFound(_0x4dd08b,_0x72316a){return function(_0x32a6ae){if(!_0x32a6ae){_0x4dd08b[_0x6920('0x1a')](0x194);}return _0x32a6ae;};}function handleError(_0xd069c,_0x5868e1){_0x5868e1=_0x5868e1||0x1f4;return function(_0x1cab00){logger[_0x6920('0x29')](_0x1cab00[_0x6920('0x2a')]);if(_0x1cab00[_0x6920('0x2b')]){delete _0x1cab00[_0x6920('0x2b')];}_0xd069c[_0x6920('0x1c')](_0x5868e1)[_0x6920('0x2c')](_0x1cab00);};}exports[_0x6920('0x2d')]=function(_0x400894,_0x2f5ce8){var _0x6860c7={},_0x2b2cd9={},_0x548fbc={'count':0x0,'rows':[]};var _0x182f1b=_['map'](db[_0x6920('0x2e')]['rawAttributes'],function(_0x31aa90){return{'name':_0x31aa90[_0x6920('0x2f')],'type':_0x31aa90['type'][_0x6920('0x30')]};});_0x2b2cd9[_0x6920('0x31')]=_[_0x6920('0x32')](_0x182f1b,'name');_0x2b2cd9['query']=_[_0x6920('0x33')](_0x400894['query']);_0x2b2cd9['filters']=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],_0x2b2cd9[_0x6920('0x35')]);_0x6860c7[_0x6920('0x36')]=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],qs[_0x6920('0x37')](_0x400894['query'][_0x6920('0x37')]));_0x6860c7['attributes']=_0x6860c7[_0x6920('0x36')]['length']?_0x6860c7['attributes']:_0x2b2cd9[_0x6920('0x31')];if(!_0x400894[_0x6920('0x35')][_0x6920('0x38')](_0x6920('0x39'))){_0x6860c7[_0x6920('0x1f')]=qs[_0x6920('0x1f')](_0x400894[_0x6920('0x35')][_0x6920('0x1f')]);_0x6860c7[_0x6920('0x1d')]=qs[_0x6920('0x1d')](_0x400894[_0x6920('0x35')][_0x6920('0x1d')]);}_0x6860c7['order']=qs[_0x6920('0x3a')](_0x400894['query'][_0x6920('0x3a')]);_0x6860c7[_0x6920('0x3b')]=qs[_0x6920('0x3c')](_['pick'](_0x400894[_0x6920('0x35')],_0x2b2cd9[_0x6920('0x3c')]),_0x182f1b);if(_0x400894[_0x6920('0x35')][_0x6920('0x3d')]){_0x6860c7['where']=_[_0x6920('0x3e')](_0x6860c7[_0x6920('0x3b')],{'$or':_['map'](_0x182f1b,function(_0x49be52){if(_0x49be52[_0x6920('0x3f')]!==_0x6920('0x40')){var _0x56ca8f={};_0x56ca8f[_0x49be52[_0x6920('0x2b')]]={'$like':'%'+_0x400894[_0x6920('0x35')]['filter']+'%'};return _0x56ca8f;}})});}_0x6860c7=_['merge']({},_0x6860c7,_0x400894[_0x6920('0x41')]);var _0x1f0c5f={'where':_0x6860c7[_0x6920('0x3b')]};return db[_0x6920('0x2e')][_0x6920('0x20')](_0x1f0c5f)['then'](function(_0x58f0e8){_0x548fbc['count']=_0x58f0e8;if(_0x400894[_0x6920('0x35')]['includeAll']){_0x6860c7['include']=[{'all':!![]}];}return db[_0x6920('0x2e')][_0x6920('0x42')](_0x6860c7);})['then'](function(_0x3aad11){_0x548fbc['rows']=_0x3aad11;return _0x548fbc;})[_0x6920('0x28')](respondWithFilteredResult(_0x2f5ce8,_0x6860c7))[_0x6920('0x43')](handleError(_0x2f5ce8,null));};exports[_0x6920('0x44')]=function(_0x1b3ebb,_0x3a994d){var _0x55d7b5={'raw':!![],'where':{'id':_0x1b3ebb[_0x6920('0x45')]['id']}},_0x4dfa0c={};_0x4dfa0c['model']=_['keys'](db['Cdr']['rawAttributes']);_0x4dfa0c[_0x6920('0x35')]=_[_0x6920('0x33')](_0x1b3ebb[_0x6920('0x35')]);_0x4dfa0c['filters']=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],_0x4dfa0c[_0x6920('0x35')]);_0x55d7b5[_0x6920('0x36')]=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],qs['fields'](_0x1b3ebb[_0x6920('0x35')][_0x6920('0x37')]));_0x55d7b5[_0x6920('0x36')]=_0x55d7b5[_0x6920('0x36')][_0x6920('0x46')]?_0x55d7b5[_0x6920('0x36')]:_0x4dfa0c[_0x6920('0x31')];if(_0x1b3ebb[_0x6920('0x35')][_0x6920('0x47')]){_0x55d7b5[_0x6920('0x48')]=[{'all':!![]}];}_0x55d7b5=_[_0x6920('0x3e')]({},_0x55d7b5,_0x1b3ebb[_0x6920('0x41')]);return db['Cdr'][_0x6920('0x49')](_0x55d7b5)[_0x6920('0x28')](handleEntityNotFound(_0x3a994d,null))['then'](respondWithResult(_0x3a994d,null))['catch'](handleError(_0x3a994d,null));};exports[_0x6920('0x4a')]=function(_0x3c231e,_0x20fab4){return db[_0x6920('0x2e')][_0x6920('0x4a')](_0x3c231e['body'],{})[_0x6920('0x28')](respondWithResult(_0x20fab4,0xc9))[_0x6920('0x43')](handleError(_0x20fab4,null));};exports[_0x6920('0x27')]=function(_0x51b12d,_0x4d1c79){if(_0x51b12d[_0x6920('0x4b')]['id']){delete _0x51b12d[_0x6920('0x4b')]['id'];}return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x51b12d['params']['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x4d1c79,null))[_0x6920('0x28')](saveUpdates(_0x51b12d[_0x6920('0x4b')],null))[_0x6920('0x28')](respondWithResult(_0x4d1c79,null))[_0x6920('0x43')](handleError(_0x4d1c79,null));};exports['destroy']=function(_0x1c0dd9,_0x3fe81d){return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x1c0dd9[_0x6920('0x45')]['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x3fe81d,null))[_0x6920('0x28')](removeEntity(_0x3fe81d,null))[_0x6920('0x43')](handleError(_0x3fe81d,null));};exports[_0x6920('0x4c')]=function(_0x1c6bba,_0x492a02){return db[_0x6920('0x2e')][_0x6920('0x4c')]()[_0x6920('0x28')](respondWithResult(_0x492a02,null))[_0x6920('0x43')](handleError(_0x492a02,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ec10ab3..af9f16f 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3b49ee,_0x4c25f5){var _0x3e07b5=function(_0x38bed4){while(--_0x38bed4){_0x3b49ee['push'](_0x3b49ee['shift']());}};_0x3e07b5(++_0x4c25f5);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x5c1c40,_0x17c487){var _0x52f178=function(_0x8ec80e){while(--_0x8ec80e){_0x5c1c40['push'](_0x5c1c40['shift']());}};_0x52f178(++_0x17c487);}(_0x7a54,0x106));var _0x47a5=function(_0x414bd8,_0x18bdea){_0x414bd8=_0x414bd8-0x0;var _0x41a067=_0x7a54[_0x414bd8];return _0x41a067;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index eb3b12e..90fae90 100644 --- a/server/api/cdr/cdr.rpc.js +++ b/server/api/cdr/cdr.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe852=['info','request\x20sent','debug','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xe852,0x15a));var _0x2e85=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe852[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x2e85('0x0'));var util=require(_0x2e85('0x1'));var moment=require('moment');var BPromise=require(_0x2e85('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2e85('0x3'));var logger=require(_0x2e85('0x4'))(_0x2e85('0x5'));var config=require(_0x2e85('0x6'));var jayson=require(_0x2e85('0x7'));var client=jayson[_0x2e85('0x8')][_0x2e85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8907ba,_0x3778ad,_0x388fd6){return new BPromise(function(_0x520552,_0x2efc7c){return client[_0x2e85('0xa')](_0x8907ba,_0x388fd6)['then'](function(_0x2f7237){logger[_0x2e85('0xb')]('Cdr,\x20%s,\x20%s',_0x3778ad,_0x2e85('0xc'));logger[_0x2e85('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x3778ad,'request\x20sent',JSON[_0x2e85('0xe')](_0x2f7237));if(_0x2f7237[_0x2e85('0xf')]){if(_0x2f7237[_0x2e85('0xf')][_0x2e85('0x10')]===0x1f4){logger['error'](_0x2e85('0x11'),_0x3778ad,_0x2f7237['error'][_0x2e85('0x12')]);return _0x2efc7c(_0x2f7237[_0x2e85('0xf')][_0x2e85('0x12')]);}logger[_0x2e85('0xf')](_0x2e85('0x11'),_0x3778ad,_0x2f7237[_0x2e85('0xf')][_0x2e85('0x12')]);return _0x520552(_0x2f7237[_0x2e85('0xf')][_0x2e85('0x12')]);}else{logger[_0x2e85('0xb')]('Cdr,\x20%s,\x20%s',_0x3778ad,_0x2e85('0xc'));_0x520552(_0x2f7237[_0x2e85('0x13')][_0x2e85('0x12')]);}})[_0x2e85('0x14')](function(_0x18004d){logger[_0x2e85('0xf')](_0x2e85('0x11'),_0x3778ad,_0x18004d);_0x2efc7c(_0x18004d);});});} \ No newline at end of file +var _0xaeb6=['http','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','Cdr,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x18ac87,_0x1b2c42){var _0x574f01=function(_0x391bd2){while(--_0x391bd2){_0x18ac87['push'](_0x18ac87['shift']());}};_0x574f01(++_0x1b2c42);}(_0xaeb6,0x8e));var _0x6aeb=function(_0xcadf94,_0x548852){_0xcadf94=_0xcadf94-0x0;var _0x53a2c3=_0xaeb6[_0xcadf94];return _0x53a2c3;};'use strict';var _=require(_0x6aeb('0x0'));var util=require(_0x6aeb('0x1'));var moment=require(_0x6aeb('0x2'));var BPromise=require(_0x6aeb('0x3'));var rs=require(_0x6aeb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6aeb('0x5'));var logger=require(_0x6aeb('0x6'))(_0x6aeb('0x7'));var config=require('../../config/environment');var jayson=require(_0x6aeb('0x8'));var client=jayson[_0x6aeb('0x9')][_0x6aeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59ea3d,_0x5005b4,_0x475585){return new BPromise(function(_0x40f7fa,_0x1c6f88){return client['request'](_0x59ea3d,_0x475585)['then'](function(_0x57cf66){logger[_0x6aeb('0xb')]('Cdr,\x20%s,\x20%s',_0x5005b4,_0x6aeb('0xc'));logger[_0x6aeb('0xd')](_0x6aeb('0xe'),_0x5005b4,_0x6aeb('0xc'),JSON['stringify'](_0x57cf66));if(_0x57cf66['error']){if(_0x57cf66[_0x6aeb('0xf')][_0x6aeb('0x10')]===0x1f4){logger[_0x6aeb('0xf')](_0x6aeb('0x11'),_0x5005b4,_0x57cf66['error'][_0x6aeb('0x12')]);return _0x1c6f88(_0x57cf66[_0x6aeb('0xf')][_0x6aeb('0x12')]);}logger[_0x6aeb('0xf')](_0x6aeb('0x11'),_0x5005b4,_0x57cf66['error'][_0x6aeb('0x12')]);return _0x40f7fa(_0x57cf66['error'][_0x6aeb('0x12')]);}else{logger[_0x6aeb('0xb')](_0x6aeb('0x11'),_0x5005b4,_0x6aeb('0xc'));_0x40f7fa(_0x57cf66['result'][_0x6aeb('0x12')]);}})['catch'](function(_0x5a9111){logger['error'](_0x6aeb('0x11'),_0x5005b4,_0x5a9111);_0x1c6f88(_0x5a9111);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c3ee563..6b9ad1c 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x437ea9,_0x55c4cd){var _0x5c04b4=function(_0x8d7a4a){while(--_0x8d7a4a){_0x437ea9['push'](_0x437ea9['shift']());}};_0x5c04b4(++_0x55c4cd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x36d45b,_0x417426){var _0x3dc01c=function(_0x37d04b){while(--_0x37d04b){_0x36d45b['push'](_0x36d45b['shift']());}};_0x3dc01c(++_0x417426);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index cabdbdd..f5b6516 100644 --- a/server/api/chatApplication/chatApplication.attributes.js +++ b/server/api/chatApplication/chatApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x874b=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x874b,0x147));var _0xb874=function(_0x9166ea,_0x1f21b0){_0x9166ea=_0x9166ea-0x0;var _0xdceec9=_0x874b[_0x9166ea];return _0xdceec9;};'use strict';var Sequelize=require(_0xb874('0x0'));module[_0xb874('0x1')]={'priority':{'type':Sequelize[_0xb874('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb874('0x3')]()},'description':{'type':Sequelize[_0xb874('0x4')]},'interval':{'type':Sequelize[_0xb874('0x4')],'defaultValue':_0xb874('0x5')}}; \ No newline at end of file +var _0x403a=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x403a,0x1c8));var _0xa403=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x403a[_0x3ccdf8];return _0x243dab;};'use strict';var Sequelize=require(_0xa403('0x0'));module[_0xa403('0x1')]={'priority':{'type':Sequelize[_0xa403('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa403('0x3')],'defaultValue':_0xa403('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f6590ca..0011a70 100644 --- a/server/api/chatApplication/chatApplication.controller.js +++ b/server/api/chatApplication/chatApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb76=['Content-Range','apply','reject','save','then','destroy','end','error','stack','send','show','params','model','ChatApplication','query','keys','filters','attributes','intersection','fields','length','includeAll','merge','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x2a033e,_0x150109){var _0xed1d3c=function(_0x5e8c88){while(--_0x5e8c88){_0x2a033e['push'](_0x2a033e['shift']());}};_0xed1d3c(++_0x150109);}(_0xdb76,0x1be));var _0x6db7=function(_0x3de5ab,_0x40a1d8){_0x3de5ab=_0x3de5ab-0x0;var _0x28be50=_0xdb76[_0x3de5ab];return _0x28be50;};'use strict';var emlformat=require(_0x6db7('0x0'));var rimraf=require(_0x6db7('0x1'));var zipdir=require(_0x6db7('0x2'));var jsonpatch=require(_0x6db7('0x3'));var rp=require(_0x6db7('0x4'));var moment=require('moment');var BPromise=require(_0x6db7('0x5'));var Mustache=require(_0x6db7('0x6'));var util=require(_0x6db7('0x7'));var path=require(_0x6db7('0x8'));var sox=require('sox');var csv=require(_0x6db7('0x9'));var ejs=require(_0x6db7('0xa'));var fs=require('fs');var fs_extra=require(_0x6db7('0xb'));var _=require(_0x6db7('0xc'));var squel=require(_0x6db7('0xd'));var crypto=require('crypto');var jsforce=require(_0x6db7('0xe'));var deskjs=require(_0x6db7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6db7('0x10'));var Papa=require(_0x6db7('0x11'));var Redis=require(_0x6db7('0x12'));var authService=require(_0x6db7('0x13'));var qs=require(_0x6db7('0x14'));var as=require(_0x6db7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6db7('0x16'));var utils=require(_0x6db7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6db7('0x18'));var db=require(_0x6db7('0x19'))['db'];function respondWithStatusCode(_0x421d28,_0x1658dd){_0x1658dd=_0x1658dd||0xcc;return function(_0x375f4a){if(_0x375f4a){return _0x421d28[_0x6db7('0x1a')](_0x1658dd);}return _0x421d28['status'](_0x1658dd)['end']();};}function respondWithResult(_0x426d31,_0x348ccf){_0x348ccf=_0x348ccf||0xc8;return function(_0x167384){if(_0x167384){return _0x426d31[_0x6db7('0x1b')](_0x348ccf)[_0x6db7('0x1c')](_0x167384);}};}function respondWithFilteredResult(_0x28dd67,_0x144684){return function(_0x43f66c){if(_0x43f66c){var _0x1432ac=typeof _0x144684[_0x6db7('0x1d')]===_0x6db7('0x1e')&&typeof _0x144684[_0x6db7('0x1f')]==='undefined';var _0x3c97b2=_0x43f66c[_0x6db7('0x20')];var _0x331e92=_0x1432ac?0x0:_0x144684[_0x6db7('0x1d')];var _0x37ffe3=_0x1432ac?_0x43f66c[_0x6db7('0x20')]:_0x144684[_0x6db7('0x1d')]+_0x144684[_0x6db7('0x1f')];var _0x3f8575;if(_0x37ffe3>=_0x3c97b2){_0x37ffe3=_0x3c97b2;_0x3f8575=0xc8;}else{_0x3f8575=0xce;}_0x28dd67[_0x6db7('0x1b')](_0x3f8575);return _0x28dd67[_0x6db7('0x21')](_0x6db7('0x22'),_0x331e92+'-'+_0x37ffe3+'/'+_0x3c97b2)['json'](_0x43f66c);}return null;};}function patchUpdates(_0x1cae66){return function(_0x206aa2){try{jsonpatch[_0x6db7('0x23')](_0x206aa2,_0x1cae66,!![]);}catch(_0x46a383){return BPromise[_0x6db7('0x24')](_0x46a383);}return _0x206aa2[_0x6db7('0x25')]();};}function saveUpdates(_0x4a78f7,_0x1b0f04){return function(_0x2795ab){if(_0x2795ab){return _0x2795ab['update'](_0x4a78f7)[_0x6db7('0x26')](function(_0x1ba956){return _0x1ba956;});}return null;};}function removeEntity(_0x7ca54f,_0x48e3af){return function(_0x24d818){if(_0x24d818){return _0x24d818[_0x6db7('0x27')]()['then'](function(){_0x7ca54f[_0x6db7('0x1b')](0xcc)[_0x6db7('0x28')]();});}};}function handleEntityNotFound(_0x2d6fca,_0x558d58){return function(_0x559e14){if(!_0x559e14){_0x2d6fca[_0x6db7('0x1a')](0x194);}return _0x559e14;};}function handleError(_0x105b81,_0xdbd9f1){_0xdbd9f1=_0xdbd9f1||0x1f4;return function(_0x4f28e9){logger[_0x6db7('0x29')](_0x4f28e9[_0x6db7('0x2a')]);if(_0x4f28e9['name']){delete _0x4f28e9['name'];}_0x105b81[_0x6db7('0x1b')](_0xdbd9f1)[_0x6db7('0x2b')](_0x4f28e9);};}exports[_0x6db7('0x2c')]=function(_0x3890f0,_0x11185d){var _0xc4f615={'raw':!![],'where':{'id':_0x3890f0[_0x6db7('0x2d')]['id']}},_0x4fb6dd={};_0x4fb6dd[_0x6db7('0x2e')]=_['keys'](db[_0x6db7('0x2f')]['rawAttributes']);_0x4fb6dd[_0x6db7('0x30')]=_[_0x6db7('0x31')](_0x3890f0[_0x6db7('0x30')]);_0x4fb6dd[_0x6db7('0x32')]=_['intersection'](_0x4fb6dd[_0x6db7('0x2e')],_0x4fb6dd[_0x6db7('0x30')]);_0xc4f615[_0x6db7('0x33')]=_[_0x6db7('0x34')](_0x4fb6dd[_0x6db7('0x2e')],qs['fields'](_0x3890f0[_0x6db7('0x30')][_0x6db7('0x35')]));_0xc4f615[_0x6db7('0x33')]=_0xc4f615['attributes'][_0x6db7('0x36')]?_0xc4f615[_0x6db7('0x33')]:_0x4fb6dd[_0x6db7('0x2e')];if(_0x3890f0['query'][_0x6db7('0x37')]){_0xc4f615['include']=[{'all':!![]}];}_0xc4f615=_[_0x6db7('0x38')]({},_0xc4f615,_0x3890f0['options']);return db['ChatApplication'][_0x6db7('0x39')](_0xc4f615)[_0x6db7('0x26')](handleEntityNotFound(_0x11185d,null))[_0x6db7('0x26')](respondWithResult(_0x11185d,null))[_0x6db7('0x3a')](handleError(_0x11185d,null));};exports['update']=function(_0x5cfca3,_0x3f7973){if(_0x5cfca3[_0x6db7('0x3b')]['id']){delete _0x5cfca3['body']['id'];}return db[_0x6db7('0x2f')]['find']({'where':{'id':_0x5cfca3[_0x6db7('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3f7973,null))[_0x6db7('0x26')](saveUpdates(_0x5cfca3['body'],null))['then'](respondWithResult(_0x3f7973,null))[_0x6db7('0x3a')](handleError(_0x3f7973,null));};exports[_0x6db7('0x27')]=function(_0x384fbf,_0x20b875){return db[_0x6db7('0x2f')]['find']({'where':{'id':_0x384fbf[_0x6db7('0x2d')]['id']}})[_0x6db7('0x26')](handleEntityNotFound(_0x20b875,null))[_0x6db7('0x26')](removeEntity(_0x20b875,null))[_0x6db7('0x3a')](handleError(_0x20b875,null));}; \ No newline at end of file +var _0xc79f=['find','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','model','keys','ChatApplication','query','filters','intersection','fields','attributes','length','include','merge','options'];(function(_0x301855,_0x139ee5){var _0x3bcda4=function(_0x3c96f9){while(--_0x3c96f9){_0x301855['push'](_0x301855['shift']());}};_0x3bcda4(++_0x139ee5);}(_0xc79f,0x82));var _0xfc79=function(_0x18b1a0,_0x17a7c2){_0x18b1a0=_0x18b1a0-0x0;var _0x463713=_0xc79f[_0x18b1a0];return _0x463713;};'use strict';var emlformat=require(_0xfc79('0x0'));var rimraf=require(_0xfc79('0x1'));var zipdir=require(_0xfc79('0x2'));var jsonpatch=require(_0xfc79('0x3'));var rp=require(_0xfc79('0x4'));var moment=require('moment');var BPromise=require(_0xfc79('0x5'));var Mustache=require(_0xfc79('0x6'));var util=require(_0xfc79('0x7'));var path=require(_0xfc79('0x8'));var sox=require(_0xfc79('0x9'));var csv=require(_0xfc79('0xa'));var ejs=require(_0xfc79('0xb'));var fs=require('fs');var fs_extra=require(_0xfc79('0xc'));var _=require(_0xfc79('0xd'));var squel=require('squel');var crypto=require(_0xfc79('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfc79('0xf'));var toCsv=require(_0xfc79('0xa'));var querystring=require(_0xfc79('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc79('0x11'));var authService=require(_0xfc79('0x12'));var qs=require(_0xfc79('0x13'));var as=require(_0xfc79('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc79('0x15'))(_0xfc79('0x16'));var utils=require(_0xfc79('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfc79('0x18'));var db=require(_0xfc79('0x19'))['db'];function respondWithStatusCode(_0x4b7f0e,_0xc2f79){_0xc2f79=_0xc2f79||0xcc;return function(_0x493a04){if(_0x493a04){return _0x4b7f0e[_0xfc79('0x1a')](_0xc2f79);}return _0x4b7f0e[_0xfc79('0x1b')](_0xc2f79)[_0xfc79('0x1c')]();};}function respondWithResult(_0x4996b6,_0x33bf71){_0x33bf71=_0x33bf71||0xc8;return function(_0x29c937){if(_0x29c937){return _0x4996b6[_0xfc79('0x1b')](_0x33bf71)[_0xfc79('0x1d')](_0x29c937);}};}function respondWithFilteredResult(_0x895b17,_0x7ef734){return function(_0x4cb052){if(_0x4cb052){var _0x228dab=typeof _0x7ef734[_0xfc79('0x1e')]===_0xfc79('0x1f')&&typeof _0x7ef734[_0xfc79('0x20')]==='undefined';var _0x39983a=_0x4cb052[_0xfc79('0x21')];var _0x216501=_0x228dab?0x0:_0x7ef734[_0xfc79('0x1e')];var _0x489e9a=_0x228dab?_0x4cb052['count']:_0x7ef734[_0xfc79('0x1e')]+_0x7ef734['limit'];var _0x816333;if(_0x489e9a>=_0x39983a){_0x489e9a=_0x39983a;_0x816333=0xc8;}else{_0x816333=0xce;}_0x895b17[_0xfc79('0x1b')](_0x816333);return _0x895b17[_0xfc79('0x22')](_0xfc79('0x23'),_0x216501+'-'+_0x489e9a+'/'+_0x39983a)['json'](_0x4cb052);}return null;};}function patchUpdates(_0x8187e2){return function(_0x418f64){try{jsonpatch[_0xfc79('0x24')](_0x418f64,_0x8187e2,!![]);}catch(_0x3c3c54){return BPromise[_0xfc79('0x25')](_0x3c3c54);}return _0x418f64[_0xfc79('0x26')]();};}function saveUpdates(_0x287549,_0x5009d5){return function(_0x1d6551){if(_0x1d6551){return _0x1d6551[_0xfc79('0x27')](_0x287549)[_0xfc79('0x28')](function(_0x2042ee){return _0x2042ee;});}return null;};}function removeEntity(_0x44ab6b,_0x5a1c6e){return function(_0x4d8636){if(_0x4d8636){return _0x4d8636['destroy']()[_0xfc79('0x28')](function(){_0x44ab6b[_0xfc79('0x1b')](0xcc)[_0xfc79('0x1c')]();});}};}function handleEntityNotFound(_0x324191,_0x5dcf36){return function(_0x1c152){if(!_0x1c152){_0x324191['sendStatus'](0x194);}return _0x1c152;};}function handleError(_0x3bf898,_0x560ca0){_0x560ca0=_0x560ca0||0x1f4;return function(_0x82011){logger[_0xfc79('0x29')](_0x82011[_0xfc79('0x2a')]);if(_0x82011['name']){delete _0x82011[_0xfc79('0x2b')];}_0x3bf898[_0xfc79('0x1b')](_0x560ca0)[_0xfc79('0x2c')](_0x82011);};}exports[_0xfc79('0x2d')]=function(_0x2ae979,_0x158b2f){var _0x3daf63={'raw':!![],'where':{'id':_0x2ae979[_0xfc79('0x2e')]['id']}},_0x4ef0f8={};_0x4ef0f8[_0xfc79('0x2f')]=_[_0xfc79('0x30')](db[_0xfc79('0x31')]['rawAttributes']);_0x4ef0f8[_0xfc79('0x32')]=_[_0xfc79('0x30')](_0x2ae979[_0xfc79('0x32')]);_0x4ef0f8[_0xfc79('0x33')]=_[_0xfc79('0x34')](_0x4ef0f8[_0xfc79('0x2f')],_0x4ef0f8['query']);_0x3daf63['attributes']=_[_0xfc79('0x34')](_0x4ef0f8['model'],qs[_0xfc79('0x35')](_0x2ae979[_0xfc79('0x32')][_0xfc79('0x35')]));_0x3daf63[_0xfc79('0x36')]=_0x3daf63[_0xfc79('0x36')][_0xfc79('0x37')]?_0x3daf63[_0xfc79('0x36')]:_0x4ef0f8[_0xfc79('0x2f')];if(_0x2ae979[_0xfc79('0x32')]['includeAll']){_0x3daf63[_0xfc79('0x38')]=[{'all':!![]}];}_0x3daf63=_[_0xfc79('0x39')]({},_0x3daf63,_0x2ae979[_0xfc79('0x3a')]);return db[_0xfc79('0x31')][_0xfc79('0x3b')](_0x3daf63)['then'](handleEntityNotFound(_0x158b2f,null))[_0xfc79('0x28')](respondWithResult(_0x158b2f,null))[_0xfc79('0x3c')](handleError(_0x158b2f,null));};exports['update']=function(_0x4f7df6,_0x525c96){if(_0x4f7df6[_0xfc79('0x3d')]['id']){delete _0x4f7df6[_0xfc79('0x3d')]['id'];}return db[_0xfc79('0x31')][_0xfc79('0x3b')]({'where':{'id':_0x4f7df6[_0xfc79('0x2e')]['id']}})['then'](handleEntityNotFound(_0x525c96,null))[_0xfc79('0x28')](saveUpdates(_0x4f7df6[_0xfc79('0x3d')],null))[_0xfc79('0x28')](respondWithResult(_0x525c96,null))['catch'](handleError(_0x525c96,null));};exports[_0xfc79('0x3e')]=function(_0x26632a,_0x5acace){return db['ChatApplication'][_0xfc79('0x3b')]({'where':{'id':_0x26632a[_0xfc79('0x2e')]['id']}})[_0xfc79('0x28')](handleEntityNotFound(_0x5acace,null))[_0xfc79('0x28')](removeEntity(_0x5acace,null))[_0xfc79('0x3c')](handleError(_0x5acace,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4bc71df..5b4769d 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ef8=['util','api','moment','bluebird','path','rimraf','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1cf825,_0x35f9ae){var _0x3f739f=function(_0x573ca3){while(--_0x573ca3){_0x1cf825['push'](_0x1cf825['shift']());}};_0x3f739f(++_0x35f9ae);}(_0x9ef8,0x17f));var _0x89ef=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x9ef8[_0x16dbcd];return _0x34706e;};'use strict';var _=require(_0x89ef('0x0'));var util=require(_0x89ef('0x1'));var logger=require('../../config/logger')(_0x89ef('0x2'));var moment=require(_0x89ef('0x3'));var BPromise=require(_0x89ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89ef('0x5'));var rimraf=require(_0x89ef('0x6'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module['exports']=function(_0x383019,_0x2e117e){return _0x383019[_0x89ef('0x7')](_0x89ef('0x8'),attributes,{'tableName':_0x89ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x89ef('0xa'),'collate':_0x89ef('0xb')});}; \ No newline at end of file +var _0x48d7=['bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x5210e8,_0x20bb22){var _0x14fcad=function(_0x2a566e){while(--_0x2a566e){_0x5210e8['push'](_0x5210e8['shift']());}};_0x14fcad(++_0x20bb22);}(_0x48d7,0xfb));var _0x748d=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x48d7[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x748d('0x0'));var util=require(_0x748d('0x1'));var logger=require(_0x748d('0x2'))('api');var moment=require(_0x748d('0x3'));var BPromise=require(_0x748d('0x4'));var rp=require(_0x748d('0x5'));var fs=require('fs');var path=require(_0x748d('0x6'));var rimraf=require(_0x748d('0x7'));var config=require(_0x748d('0x8'));var attributes=require(_0x748d('0x9'));module[_0x748d('0xa')]=function(_0x591eb9,_0x23a5ed){return _0x591eb9[_0x748d('0xb')](_0x748d('0xc'),attributes,{'tableName':_0x748d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x748d('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 9c23ac2..d913334 100644 --- a/server/api/chatApplication/chatApplication.rpc.js +++ b/server/api/chatApplication/chatApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b51=['stringify','error','code','message','info','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x4aae6b,_0x386b16){var _0x22bc72=function(_0x309479){while(--_0x309479){_0x4aae6b['push'](_0x4aae6b['shift']());}};_0x22bc72(++_0x386b16);}(_0x1b51,0xed));var _0x11b5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1b51[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x11b5('0x0'));var util=require('util');var moment=require(_0x11b5('0x1'));var BPromise=require('bluebird');var rs=require(_0x11b5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11b5('0x3'))['db'];var utils=require(_0x11b5('0x4'));var logger=require('../../config/logger')(_0x11b5('0x5'));var config=require(_0x11b5('0x6'));var jayson=require(_0x11b5('0x7'));var client=jayson[_0x11b5('0x8')][_0x11b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2020e5,_0x1a498b,_0x8d461a){return new BPromise(function(_0x5e90d3,_0x121be4){return client['request'](_0x2020e5,_0x8d461a)[_0x11b5('0xa')](function(_0x1a6000){logger['info'](_0x11b5('0xb'),_0x1a498b,_0x11b5('0xc'));logger[_0x11b5('0xd')](_0x11b5('0xe'),_0x1a498b,_0x11b5('0xc'),JSON[_0x11b5('0xf')](_0x1a6000));if(_0x1a6000[_0x11b5('0x10')]){if(_0x1a6000[_0x11b5('0x10')][_0x11b5('0x11')]===0x1f4){logger[_0x11b5('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1a498b,_0x1a6000['error'][_0x11b5('0x12')]);return _0x121be4(_0x1a6000[_0x11b5('0x10')][_0x11b5('0x12')]);}logger['error'](_0x11b5('0xb'),_0x1a498b,_0x1a6000[_0x11b5('0x10')][_0x11b5('0x12')]);return _0x5e90d3(_0x1a6000['error']['message']);}else{logger[_0x11b5('0x13')](_0x11b5('0xb'),_0x1a498b,_0x11b5('0xc'));_0x5e90d3(_0x1a6000['result'][_0x11b5('0x12')]);}})[_0x11b5('0x14')](function(_0x47ca8e){logger[_0x11b5('0x10')](_0x11b5('0xb'),_0x1a498b,_0x47ca8e);_0x121be4(_0x47ca8e);});});} \ No newline at end of file +var _0x9e18=['request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../config/environment','jayson/promise','client'];(function(_0x1f263f,_0x56b2db){var _0x2ecbcc=function(_0x4b22d5){while(--_0x4b22d5){_0x1f263f['push'](_0x1f263f['shift']());}};_0x2ecbcc(++_0x56b2db);}(_0x9e18,0x150));var _0x89e1=function(_0x2acd64,_0x4e8ce8){_0x2acd64=_0x2acd64-0x0;var _0x3d3fce=_0x9e18[_0x2acd64];return _0x3d3fce;};'use strict';var _=require(_0x89e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x89e1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89e1('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x89e1('0x3'));var jayson=require(_0x89e1('0x4'));var client=jayson[_0x89e1('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x426bbf,_0x1eb0ea,_0x5694aa){return new BPromise(function(_0x5f2c8e,_0x267416){return client[_0x89e1('0x6')](_0x426bbf,_0x5694aa)[_0x89e1('0x7')](function(_0x2c5341){logger[_0x89e1('0x8')](_0x89e1('0x9'),_0x1eb0ea,_0x89e1('0xa'));logger[_0x89e1('0xb')](_0x89e1('0xc'),_0x1eb0ea,_0x89e1('0xa'),JSON[_0x89e1('0xd')](_0x2c5341));if(_0x2c5341['error']){if(_0x2c5341[_0x89e1('0xe')][_0x89e1('0xf')]===0x1f4){logger[_0x89e1('0xe')](_0x89e1('0x9'),_0x1eb0ea,_0x2c5341[_0x89e1('0xe')][_0x89e1('0x10')]);return _0x267416(_0x2c5341[_0x89e1('0xe')][_0x89e1('0x10')]);}logger['error'](_0x89e1('0x9'),_0x1eb0ea,_0x2c5341[_0x89e1('0xe')][_0x89e1('0x10')]);return _0x5f2c8e(_0x2c5341[_0x89e1('0xe')]['message']);}else{logger[_0x89e1('0x8')](_0x89e1('0x9'),_0x1eb0ea,_0x89e1('0xa'));_0x5f2c8e(_0x2c5341[_0x89e1('0x11')]['message']);}})[_0x89e1('0x12')](function(_0x5ba7a1){logger[_0x89e1('0xe')]('ChatApplication,\x20%s,\x20%s',_0x1eb0ea,_0x5ba7a1);_0x267416(_0x5ba7a1);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 397a97e..322f770 100644 --- a/server/api/chatApplication/index.js +++ b/server/api/chatApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd4e=['update','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd4e,0x7b));var _0xebd4=function(_0x32365c,_0x453f9f){_0x32365c=_0x32365c-0x0;var _0x34ff18=_0xbd4e[_0x32365c];return _0x34ff18;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xebd4('0x0'));var router=express[_0xebd4('0x1')]();var fs_extra=require(_0xebd4('0x2'));var auth=require(_0xebd4('0x3'));var interaction=require(_0xebd4('0x4'));var config=require(_0xebd4('0x5'));var controller=require(_0xebd4('0x6'));router[_0xebd4('0x7')](_0xebd4('0x8'),auth[_0xebd4('0x9')](),controller[_0xebd4('0xa')]);router[_0xebd4('0xb')](_0xebd4('0x8'),auth[_0xebd4('0x9')](),controller[_0xebd4('0xc')]);router['delete'](_0xebd4('0x8'),auth[_0xebd4('0x9')](),controller[_0xebd4('0xd')]);module[_0xebd4('0xe')]=router; \ No newline at end of file +var _0x5631=['/:id','isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get'];(function(_0x467622,_0x4ad91){var _0x35ca1a=function(_0x1cdb34){while(--_0x1cdb34){_0x467622['push'](_0x467622['shift']());}};_0x35ca1a(++_0x4ad91);}(_0x5631,0x85));var _0x1563=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0x5631[_0x5dc03e];return _0x466a07;};'use strict';var multer=require(_0x1563('0x0'));var util=require(_0x1563('0x1'));var path=require(_0x1563('0x2'));var timeout=require(_0x1563('0x3'));var express=require('express');var router=express[_0x1563('0x4')]();var fs_extra=require(_0x1563('0x5'));var auth=require(_0x1563('0x6'));var interaction=require(_0x1563('0x7'));var config=require(_0x1563('0x8'));var controller=require(_0x1563('0x9'));router[_0x1563('0xa')](_0x1563('0xb'),auth[_0x1563('0xc')](),controller[_0x1563('0xd')]);router[_0x1563('0xe')]('/:id',auth[_0x1563('0xc')](),controller[_0x1563('0xf')]);router[_0x1563('0x10')](_0x1563('0xb'),auth[_0x1563('0xc')](),controller['destroy']);module[_0x1563('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f916ad0..8acd65f 100644 --- a/server/api/chatGroup/chatGroup.attributes.js +++ b/server/api/chatGroup/chatGroup.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b0a=['sequelize','exports','STRING'];(function(_0x687c0a,_0x3aac82){var _0x8fdcb5=function(_0x318f0b){while(--_0x318f0b){_0x687c0a['push'](_0x687c0a['shift']());}};_0x8fdcb5(++_0x3aac82);}(_0x2b0a,0x84));var _0xa2b0=function(_0x1ac237,_0x515063){_0x1ac237=_0x1ac237-0x0;var _0x752098=_0x2b0a[_0x1ac237];return _0x752098;};'use strict';var Sequelize=require(_0xa2b0('0x0'));module[_0xa2b0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa2b0('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xbfce=['STRING','BOOLEAN','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfce,0x161));var _0xebfc=function(_0x2cc6bf,_0x4849a3){_0x2cc6bf=_0x2cc6bf-0x0;var _0x320f3c=_0xbfce[_0x2cc6bf];return _0x320f3c;};'use strict';var Sequelize=require('sequelize');module[_0xebfc('0x0')]={'name':{'type':Sequelize[_0xebfc('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xebfc('0x1')]},'write':{'type':Sequelize[_0xebfc('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 3a790ee..e3fdc06 100644 --- a/server/api/chatGroup/chatGroup.controller.js +++ b/server/api/chatGroup/chatGroup.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa114=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatGroup','includeAll','include','findAll','catch','params','keys','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','$gte','format','getMessages','eml-format'];(function(_0x1c7a62,_0x374c5b){var _0x46b20=function(_0x50c9b9){while(--_0x50c9b9){_0x1c7a62['push'](_0x1c7a62['shift']());}};_0x46b20(++_0x374c5b);}(_0xa114,0x187));var _0x4a11=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0xa114[_0x525af9];return _0x129fbf;};'use strict';var emlformat=require(_0x4a11('0x0'));var rimraf=require(_0x4a11('0x1'));var zipdir=require(_0x4a11('0x2'));var jsonpatch=require(_0x4a11('0x3'));var rp=require(_0x4a11('0x4'));var moment=require(_0x4a11('0x5'));var BPromise=require(_0x4a11('0x6'));var Mustache=require(_0x4a11('0x7'));var util=require(_0x4a11('0x8'));var path=require(_0x4a11('0x9'));var sox=require(_0x4a11('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a11('0xb'));var _=require(_0x4a11('0xc'));var squel=require('squel');var crypto=require(_0x4a11('0xd'));var jsforce=require(_0x4a11('0xe'));var deskjs=require(_0x4a11('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4a11('0x10'));var Papa=require(_0x4a11('0x11'));var Redis=require(_0x4a11('0x12'));var authService=require(_0x4a11('0x13'));var qs=require(_0x4a11('0x14'));var as=require(_0x4a11('0x15'));var hardwareService=require(_0x4a11('0x16'));var logger=require(_0x4a11('0x17'))(_0x4a11('0x18'));var utils=require(_0x4a11('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4a11('0x1a'));var db=require(_0x4a11('0x1b'))['db'];config['redis']=_['defaults'](config[_0x4a11('0x1c')],{'host':_0x4a11('0x1d'),'port':0x18eb});var socket=require(_0x4a11('0x1e'))(new Redis(config[_0x4a11('0x1c')]));require(_0x4a11('0x1f'))[_0x4a11('0x20')](socket);function respondWithStatusCode(_0x365d1c,_0x3ff435){_0x3ff435=_0x3ff435||0xcc;return function(_0x42dec9){if(_0x42dec9){return _0x365d1c[_0x4a11('0x21')](_0x3ff435);}return _0x365d1c['status'](_0x3ff435)[_0x4a11('0x22')]();};}function respondWithResult(_0x268d34,_0x3ecc29){_0x3ecc29=_0x3ecc29||0xc8;return function(_0xe336de){if(_0xe336de){return _0x268d34[_0x4a11('0x23')](_0x3ecc29)[_0x4a11('0x24')](_0xe336de);}};}function respondWithFilteredResult(_0x2bcb1d,_0x27703b){return function(_0x20a6eb){if(_0x20a6eb){var _0x43ec84=typeof _0x27703b[_0x4a11('0x25')]===_0x4a11('0x26')&&typeof _0x27703b['limit']===_0x4a11('0x26');var _0x58b9a1=_0x20a6eb['count'];var _0x25a10d=_0x43ec84?0x0:_0x27703b[_0x4a11('0x25')];var _0x4c4e65=_0x43ec84?_0x20a6eb[_0x4a11('0x27')]:_0x27703b[_0x4a11('0x25')]+_0x27703b[_0x4a11('0x28')];var _0x42f1a5;if(_0x4c4e65>=_0x58b9a1){_0x4c4e65=_0x58b9a1;_0x42f1a5=0xc8;}else{_0x42f1a5=0xce;}_0x2bcb1d[_0x4a11('0x23')](_0x42f1a5);return _0x2bcb1d[_0x4a11('0x29')](_0x4a11('0x2a'),_0x25a10d+'-'+_0x4c4e65+'/'+_0x58b9a1)[_0x4a11('0x24')](_0x20a6eb);}return null;};}function patchUpdates(_0x3015ec){return function(_0x18e393){try{jsonpatch['apply'](_0x18e393,_0x3015ec,!![]);}catch(_0x91817f){return BPromise[_0x4a11('0x2b')](_0x91817f);}return _0x18e393[_0x4a11('0x2c')]();};}function saveUpdates(_0x38dc7b,_0x56b6eb){return function(_0x429527){if(_0x429527){return _0x429527[_0x4a11('0x2d')](_0x38dc7b)[_0x4a11('0x2e')](function(_0xb3950){return _0xb3950;});}return null;};}function removeEntity(_0xd5b915,_0x3c64da){return function(_0x3614f9){if(_0x3614f9){return _0x3614f9[_0x4a11('0x2f')]()[_0x4a11('0x2e')](function(){_0xd5b915['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53367d,_0x1473bd){return function(_0x52b79d){if(!_0x52b79d){_0x53367d[_0x4a11('0x21')](0x194);}return _0x52b79d;};}function handleError(_0x3f8684,_0x2c13d4){_0x2c13d4=_0x2c13d4||0x1f4;return function(_0x2b25d9){logger[_0x4a11('0x30')](_0x2b25d9[_0x4a11('0x31')]);if(_0x2b25d9[_0x4a11('0x32')]){delete _0x2b25d9[_0x4a11('0x32')];}_0x3f8684['status'](_0x2c13d4)['send'](_0x2b25d9);};}exports[_0x4a11('0x33')]=function(_0x5e32,_0xd180ee){var _0x3a2246={},_0x2f46d2={},_0x1faed3={'count':0x0,'rows':[]};var _0x57d45f=_[_0x4a11('0x34')](db['ChatGroup'][_0x4a11('0x35')],function(_0x1f7c7a){return{'name':_0x1f7c7a['fieldName'],'type':_0x1f7c7a['type'][_0x4a11('0x36')]};});_0x2f46d2['model']=_[_0x4a11('0x34')](_0x57d45f,'name');_0x2f46d2[_0x4a11('0x37')]=_['keys'](_0x5e32['query']);_0x2f46d2[_0x4a11('0x38')]=_[_0x4a11('0x39')](_0x2f46d2[_0x4a11('0x3a')],_0x2f46d2[_0x4a11('0x37')]);_0x3a2246['attributes']=_[_0x4a11('0x39')](_0x2f46d2[_0x4a11('0x3a')],qs[_0x4a11('0x3b')](_0x5e32[_0x4a11('0x37')][_0x4a11('0x3b')]));_0x3a2246[_0x4a11('0x3c')]=_0x3a2246[_0x4a11('0x3c')][_0x4a11('0x3d')]?_0x3a2246['attributes']:_0x2f46d2['model'];if(!_0x5e32[_0x4a11('0x37')][_0x4a11('0x3e')](_0x4a11('0x3f'))){_0x3a2246[_0x4a11('0x28')]=qs[_0x4a11('0x28')](_0x5e32[_0x4a11('0x37')][_0x4a11('0x28')]);_0x3a2246[_0x4a11('0x25')]=qs[_0x4a11('0x25')](_0x5e32[_0x4a11('0x37')][_0x4a11('0x25')]);}_0x3a2246[_0x4a11('0x40')]=qs[_0x4a11('0x41')](_0x5e32[_0x4a11('0x37')]['sort']);_0x3a2246[_0x4a11('0x42')]=qs['filters'](_[_0x4a11('0x43')](_0x5e32['query'],_0x2f46d2[_0x4a11('0x38')]),_0x57d45f);if(_0x5e32['query'][_0x4a11('0x44')]){_0x3a2246[_0x4a11('0x42')]=_[_0x4a11('0x45')](_0x3a2246[_0x4a11('0x42')],{'$or':_[_0x4a11('0x34')](_0x57d45f,function(_0x58e7de){if(_0x58e7de[_0x4a11('0x46')]!==_0x4a11('0x47')){var _0x25e5ba={};_0x25e5ba[_0x58e7de[_0x4a11('0x32')]]={'$like':'%'+_0x5e32[_0x4a11('0x37')][_0x4a11('0x44')]+'%'};return _0x25e5ba;}})});}_0x3a2246=_[_0x4a11('0x45')]({},_0x3a2246,_0x5e32[_0x4a11('0x48')]);var _0x16d9f3={'where':_0x3a2246[_0x4a11('0x42')]};return db[_0x4a11('0x49')][_0x4a11('0x27')](_0x16d9f3)['then'](function(_0x5c869e){_0x1faed3['count']=_0x5c869e;if(_0x5e32['query'][_0x4a11('0x4a')]){_0x3a2246[_0x4a11('0x4b')]=[{'all':!![]}];}return db[_0x4a11('0x49')][_0x4a11('0x4c')](_0x3a2246);})[_0x4a11('0x2e')](function(_0x4291e9){_0x1faed3['rows']=_0x4291e9;return _0x1faed3;})[_0x4a11('0x2e')](respondWithFilteredResult(_0xd180ee,_0x3a2246))[_0x4a11('0x4d')](handleError(_0xd180ee,null));};exports['show']=function(_0x313041,_0x1e7603){var _0x316433={'raw':!![],'where':{'id':_0x313041[_0x4a11('0x4e')]['id']}},_0x9b7a25={};_0x9b7a25[_0x4a11('0x3a')]=_[_0x4a11('0x4f')](db[_0x4a11('0x49')]['rawAttributes']);_0x9b7a25[_0x4a11('0x37')]=_[_0x4a11('0x4f')](_0x313041[_0x4a11('0x37')]);_0x9b7a25[_0x4a11('0x38')]=_[_0x4a11('0x39')](_0x9b7a25['model'],_0x9b7a25[_0x4a11('0x37')]);_0x316433[_0x4a11('0x3c')]=_[_0x4a11('0x39')](_0x9b7a25[_0x4a11('0x3a')],qs[_0x4a11('0x3b')](_0x313041[_0x4a11('0x37')][_0x4a11('0x3b')]));_0x316433[_0x4a11('0x3c')]=_0x316433[_0x4a11('0x3c')][_0x4a11('0x3d')]?_0x316433[_0x4a11('0x3c')]:_0x9b7a25[_0x4a11('0x3a')];if(_0x313041['query'][_0x4a11('0x4a')]){_0x316433[_0x4a11('0x4b')]=[{'all':!![]}];}_0x316433=_[_0x4a11('0x45')]({},_0x316433,_0x313041['options']);return db[_0x4a11('0x49')][_0x4a11('0x50')](_0x316433)[_0x4a11('0x2e')](handleEntityNotFound(_0x1e7603,null))[_0x4a11('0x2e')](respondWithResult(_0x1e7603,null))['catch'](handleError(_0x1e7603,null));};exports[_0x4a11('0x51')]=function(_0x4fe772,_0x4db92a){return db[_0x4a11('0x49')]['create'](_0x4fe772[_0x4a11('0x52')],{})[_0x4a11('0x2e')](respondWithResult(_0x4db92a,0xc9))['catch'](handleError(_0x4db92a,null));};exports['update']=function(_0x475071,_0x5f3f67){if(_0x475071[_0x4a11('0x52')]['id']){delete _0x475071[_0x4a11('0x52')]['id'];}return db[_0x4a11('0x49')][_0x4a11('0x50')]({'where':{'id':_0x475071[_0x4a11('0x4e')]['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x5f3f67,null))[_0x4a11('0x2e')](saveUpdates(_0x475071[_0x4a11('0x52')],null))[_0x4a11('0x2e')](respondWithResult(_0x5f3f67,null))[_0x4a11('0x4d')](handleError(_0x5f3f67,null));};exports['destroy']=function(_0x5bc350,_0x2eefc2){return db[_0x4a11('0x49')][_0x4a11('0x50')]({'where':{'id':_0x5bc350[_0x4a11('0x4e')]['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x2eefc2,null))['then'](removeEntity(_0x2eefc2,null))[_0x4a11('0x4d')](handleError(_0x2eefc2,null));};exports[_0x4a11('0x53')]=function(_0x86508f,_0x83755e){return db[_0x4a11('0x49')][_0x4a11('0x53')]()[_0x4a11('0x2e')](respondWithResult(_0x83755e,null))[_0x4a11('0x4d')](handleError(_0x83755e,null));};exports[_0x4a11('0x54')]=function(_0x286818,_0x1e72c2,_0x43036f){return db[_0x4a11('0x55')][_0x4a11('0x27')]({'where':{'ChatGroupId':_0x286818[_0x4a11('0x4e')]['id'],'ToId':_0x286818[_0x4a11('0x56')]['id'],'read':![]}})[_0x4a11('0x2e')](function(_0x59e4e7){return{'id':_[_0x4a11('0x57')](_0x286818[_0x4a11('0x4e')]['id']),'count':_0x59e4e7};})['then'](respondWithResult(_0x1e72c2,null))[_0x4a11('0x4d')](handleError(_0x1e72c2,null));};exports[_0x4a11('0x58')]=function(_0x3098a9,_0x35222f,_0x291d0c){return db[_0x4a11('0x49')]['find']({'where':{'id':_0x3098a9[_0x4a11('0x4e')]['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x35222f,null))['then'](function(_0x5bc607){if(_0x5bc607){return _0x5bc607[_0x4a11('0x58')](_0x3098a9[_0x4a11('0x52')][_0x4a11('0x59')],_[_0x4a11('0x5a')](_0x3098a9['body'],[_0x4a11('0x59'),'id'])||{});}})['then'](respondWithResult(_0x35222f,null))[_0x4a11('0x4d')](handleError(_0x35222f,null));};exports[_0x4a11('0x5b')]=function(_0x2c954f,_0x327776,_0x36f3bd){var _0xd23cb4={};var _0x268eb8={};var _0x22bc2c;var _0x3d7931;return db[_0x4a11('0x49')][_0x4a11('0x5c')]({'where':{'id':_0x2c954f['params']['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x327776,null))[_0x4a11('0x2e')](function(_0x1acf1b){if(_0x1acf1b){_0x22bc2c=_0x1acf1b;_0x268eb8[_0x4a11('0x3a')]=_[_0x4a11('0x4f')](db[_0x4a11('0x5d')][_0x4a11('0x35')]);_0x268eb8[_0x4a11('0x37')]=_[_0x4a11('0x4f')](_0x2c954f[_0x4a11('0x37')]);_0x268eb8['filters']=_[_0x4a11('0x39')](_0x268eb8[_0x4a11('0x3a')],_0x268eb8[_0x4a11('0x37')]);_0xd23cb4[_0x4a11('0x3c')]=_[_0x4a11('0x39')](_0x268eb8[_0x4a11('0x3a')],qs['fields'](_0x2c954f[_0x4a11('0x37')]['fields']));_0xd23cb4[_0x4a11('0x3c')]=_0xd23cb4[_0x4a11('0x3c')][_0x4a11('0x3d')]?_0xd23cb4[_0x4a11('0x3c')]:_0x268eb8[_0x4a11('0x3a')];_0xd23cb4[_0x4a11('0x40')]=qs[_0x4a11('0x41')](_0x2c954f[_0x4a11('0x37')][_0x4a11('0x41')]);_0xd23cb4['where']=qs[_0x4a11('0x38')](_[_0x4a11('0x43')](_0x2c954f['query'],_0x268eb8[_0x4a11('0x38')]));if(_0x2c954f['query'][_0x4a11('0x44')]){_0xd23cb4[_0x4a11('0x42')]=_[_0x4a11('0x45')](_0xd23cb4[_0x4a11('0x42')],{'$or':_[_0x4a11('0x34')](_0xd23cb4['attributes'],function(_0x820267){var _0x44a502={};_0x44a502[_0x820267]={'$like':'%'+_0x2c954f['query'][_0x4a11('0x44')]+'%'};return _0x44a502;})});}_0xd23cb4=_['merge']({},_0xd23cb4,_0x2c954f[_0x4a11('0x48')]);return _0x22bc2c[_0x4a11('0x5b')](_0xd23cb4);}})[_0x4a11('0x2e')](function(_0x37ee2f){if(_0x37ee2f){_0x3d7931=_0x37ee2f['length'];if(!_0x2c954f[_0x4a11('0x37')][_0x4a11('0x3e')](_0x4a11('0x3f'))){_0xd23cb4['limit']=qs['limit'](_0x2c954f[_0x4a11('0x37')]['limit']);_0xd23cb4['offset']=qs[_0x4a11('0x25')](_0x2c954f[_0x4a11('0x37')][_0x4a11('0x25')]);}return _0x22bc2c[_0x4a11('0x5b')](_0xd23cb4);}})[_0x4a11('0x2e')](function(_0x2f6077){if(_0x2f6077){return _0x2f6077?{'count':_0x3d7931,'rows':_0x2f6077}:null;}})[_0x4a11('0x2e')](respondWithResult(_0x327776,null))[_0x4a11('0x4d')](handleError(_0x327776,null));};exports[_0x4a11('0x5e')]=function(_0x7a0364,_0x842393,_0x3a7fcd){return db['ChatGroup']['find']({'where':{'id':_0x7a0364[_0x4a11('0x4e')]['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x842393,null))[_0x4a11('0x2e')](function(_0x3b16c9){if(_0x3b16c9){return _0x3b16c9['removeMembers'](_0x7a0364[_0x4a11('0x37')]['ids']);}})[_0x4a11('0x2e')](respondWithStatusCode(_0x842393,null))[_0x4a11('0x4d')](handleError(_0x842393,null));};exports['addMessage']=function(_0x1e7eeb,_0x24ccbc,_0x54be14){if(_0x1e7eeb['body']['id']){delete _0x1e7eeb[_0x4a11('0x52')]['id'];}return db['ChatGroup'][_0x4a11('0x50')]({'where':{'id':_0x1e7eeb['params']['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x24ccbc,null))['then'](function(_0x3e07d9){if(_0x3e07d9){_0x1e7eeb[_0x4a11('0x52')]['ChatGroupId']=_0x3e07d9['id'];return db['ChatInternalMessage'][_0x4a11('0x51')](_0x1e7eeb['body']);}})['then'](respondWithResult(_0x24ccbc,null))[_0x4a11('0x4d')](handleError(_0x24ccbc,null));};exports['getMessages']=function(_0x508894,_0x231fd4,_0x298043){var _0x2efd9f={};var _0x355ef7={};var _0x3e45d5;var _0x28f43c;return db[_0x4a11('0x49')][_0x4a11('0x5c')]({'where':{'id':_0x508894['params']['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x231fd4,null))[_0x4a11('0x2e')](function(_0x350030){if(_0x350030){_0x3e45d5=_0x350030;_0x355ef7[_0x4a11('0x3a')]=_['keys'](db['ChatInternalMessage'][_0x4a11('0x35')]);_0x355ef7['query']=_['keys'](_0x508894['query']);_0x355ef7[_0x4a11('0x38')]=_[_0x4a11('0x39')](_0x355ef7[_0x4a11('0x3a')],_0x355ef7[_0x4a11('0x37')]);_0x2efd9f[_0x4a11('0x3c')]=_['intersection'](_0x355ef7[_0x4a11('0x3a')],qs[_0x4a11('0x3b')](_0x508894[_0x4a11('0x37')][_0x4a11('0x3b')]));_0x2efd9f[_0x4a11('0x3c')]=_0x2efd9f[_0x4a11('0x3c')][_0x4a11('0x3d')]?_0x2efd9f[_0x4a11('0x3c')]:_0x355ef7[_0x4a11('0x3a')];_0x2efd9f[_0x4a11('0x40')]=qs['sort'](_0x508894[_0x4a11('0x37')][_0x4a11('0x41')]);_0x2efd9f[_0x4a11('0x42')]=qs[_0x4a11('0x38')](_[_0x4a11('0x43')](_0x508894['query'],_0x355ef7['filters']));if(_0x508894[_0x4a11('0x37')][_0x4a11('0x44')]){_0x2efd9f[_0x4a11('0x42')]=_[_0x4a11('0x45')](_0x2efd9f[_0x4a11('0x42')],{'$or':_[_0x4a11('0x34')](_0x2efd9f['attributes'],function(_0x55631b){var _0x4951b9={};_0x4951b9[_0x55631b]={'$like':'%'+_0x508894[_0x4a11('0x37')][_0x4a11('0x44')]+'%'};return _0x4951b9;})});}if(_0x508894['query']['$gte']){var _0x39578f=_0x508894[_0x4a11('0x37')][_0x4a11('0x5f')]['split'](',');var _0x23166c={};_0x23166c[_0x39578f[0x0]]={'$gte':moment(_0x39578f[0x1])[_0x4a11('0x60')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2efd9f[_0x4a11('0x42')]=_[_0x4a11('0x45')](_0x2efd9f[_0x4a11('0x42')],_0x23166c);}_0x2efd9f=_[_0x4a11('0x45')]({},_0x2efd9f,_0x508894['options']);return _0x3e45d5[_0x4a11('0x61')](_0x2efd9f);}})[_0x4a11('0x2e')](function(_0x335b72){if(_0x335b72){_0x28f43c=_0x335b72[_0x4a11('0x3d')];if(!_0x508894[_0x4a11('0x37')][_0x4a11('0x3e')]('nolimit')){_0x2efd9f[_0x4a11('0x28')]=qs['limit'](_0x508894['query'][_0x4a11('0x28')]);_0x2efd9f['offset']=qs[_0x4a11('0x25')](_0x508894[_0x4a11('0x37')][_0x4a11('0x25')]);}return _0x3e45d5[_0x4a11('0x61')](_0x2efd9f);}})[_0x4a11('0x2e')](function(_0x248475){if(_0x248475){return _0x248475?{'count':_0x28f43c,'rows':_0x248475}:null;}})[_0x4a11('0x2e')](respondWithResult(_0x231fd4,null))['catch'](handleError(_0x231fd4,null));}; \ No newline at end of file +var _0x9f26=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','ChatGroup','findAll','show','includeAll','find','catch','create','body','params','getUnread','ChatInternalMessage','user','addMembers','ids','omit','findOne','pick','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x3f0362,_0x5c8421){var _0x342be3=function(_0x16e59b){while(--_0x16e59b){_0x3f0362['push'](_0x3f0362['shift']());}};_0x342be3(++_0x5c8421);}(_0x9f26,0x1c8));var _0x69f2=function(_0x54de43,_0xfb2a03){_0x54de43=_0x54de43-0x0;var _0x22cb02=_0x9f26[_0x54de43];return _0x22cb02;};'use strict';var emlformat=require(_0x69f2('0x0'));var rimraf=require(_0x69f2('0x1'));var zipdir=require(_0x69f2('0x2'));var jsonpatch=require(_0x69f2('0x3'));var rp=require(_0x69f2('0x4'));var moment=require('moment');var BPromise=require(_0x69f2('0x5'));var Mustache=require('mustache');var util=require(_0x69f2('0x6'));var path=require(_0x69f2('0x7'));var sox=require(_0x69f2('0x8'));var csv=require('to-csv');var ejs=require(_0x69f2('0x9'));var fs=require('fs');var fs_extra=require(_0x69f2('0xa'));var _=require(_0x69f2('0xb'));var squel=require('squel');var crypto=require(_0x69f2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x69f2('0xd'));var toCsv=require(_0x69f2('0xe'));var querystring=require(_0x69f2('0xf'));var Papa=require(_0x69f2('0x10'));var Redis=require('ioredis');var authService=require(_0x69f2('0x11'));var qs=require(_0x69f2('0x12'));var as=require(_0x69f2('0x13'));var hardwareService=require(_0x69f2('0x14'));var logger=require('../../config/logger')(_0x69f2('0x15'));var utils=require(_0x69f2('0x16'));var config=require(_0x69f2('0x17'));var licenseUtil=require(_0x69f2('0x18'));var db=require(_0x69f2('0x19'))['db'];config['redis']=_[_0x69f2('0x1a')](config[_0x69f2('0x1b')],{'host':_0x69f2('0x1c'),'port':0x18eb});var socket=require(_0x69f2('0x1d'))(new Redis(config[_0x69f2('0x1b')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x53a7ec,_0x3d4294){_0x3d4294=_0x3d4294||0xcc;return function(_0x54ec5f){if(_0x54ec5f){return _0x53a7ec[_0x69f2('0x1e')](_0x3d4294);}return _0x53a7ec[_0x69f2('0x1f')](_0x3d4294)[_0x69f2('0x20')]();};}function respondWithResult(_0x230bab,_0x53bfa0){_0x53bfa0=_0x53bfa0||0xc8;return function(_0x4b3c45){if(_0x4b3c45){return _0x230bab['status'](_0x53bfa0)['json'](_0x4b3c45);}};}function respondWithFilteredResult(_0x1b3f83,_0x14274c){return function(_0x540c88){if(_0x540c88){var _0x3515b1=typeof _0x14274c[_0x69f2('0x21')]===_0x69f2('0x22')&&typeof _0x14274c[_0x69f2('0x23')]===_0x69f2('0x22');var _0x3788f5=_0x540c88[_0x69f2('0x24')];var _0x54566f=_0x3515b1?0x0:_0x14274c[_0x69f2('0x21')];var _0x13f775=_0x3515b1?_0x540c88[_0x69f2('0x24')]:_0x14274c['offset']+_0x14274c[_0x69f2('0x23')];var _0x4d6c3d;if(_0x13f775>=_0x3788f5){_0x13f775=_0x3788f5;_0x4d6c3d=0xc8;}else{_0x4d6c3d=0xce;}_0x1b3f83[_0x69f2('0x1f')](_0x4d6c3d);return _0x1b3f83[_0x69f2('0x25')]('Content-Range',_0x54566f+'-'+_0x13f775+'/'+_0x3788f5)[_0x69f2('0x26')](_0x540c88);}return null;};}function patchUpdates(_0x42b4bf){return function(_0x199210){try{jsonpatch[_0x69f2('0x27')](_0x199210,_0x42b4bf,!![]);}catch(_0x1b7c12){return BPromise[_0x69f2('0x28')](_0x1b7c12);}return _0x199210['save']();};}function saveUpdates(_0x577579,_0xf24fd0){return function(_0x388599){if(_0x388599){return _0x388599[_0x69f2('0x29')](_0x577579)[_0x69f2('0x2a')](function(_0x235c1c){return _0x235c1c;});}return null;};}function removeEntity(_0x15a264,_0x104a52){return function(_0x4ac819){if(_0x4ac819){return _0x4ac819[_0x69f2('0x2b')]()[_0x69f2('0x2a')](function(){_0x15a264[_0x69f2('0x1f')](0xcc)[_0x69f2('0x20')]();});}};}function handleEntityNotFound(_0x391178,_0x579d05){return function(_0x516c08){if(!_0x516c08){_0x391178[_0x69f2('0x1e')](0x194);}return _0x516c08;};}function handleError(_0x128cb5,_0x254470){_0x254470=_0x254470||0x1f4;return function(_0x48d36c){logger[_0x69f2('0x2c')](_0x48d36c['stack']);if(_0x48d36c[_0x69f2('0x2d')]){delete _0x48d36c[_0x69f2('0x2d')];}_0x128cb5['status'](_0x254470)[_0x69f2('0x2e')](_0x48d36c);};}exports[_0x69f2('0x2f')]=function(_0xc975be,_0x5e95cf){var _0x3b661b={},_0x5df3c7={},_0xbcd257={'count':0x0,'rows':[]};var _0x180eb5=_['map'](db['ChatGroup'][_0x69f2('0x30')],function(_0x4323c6){return{'name':_0x4323c6[_0x69f2('0x31')],'type':_0x4323c6['type']['key']};});_0x5df3c7[_0x69f2('0x32')]=_[_0x69f2('0x33')](_0x180eb5,_0x69f2('0x2d'));_0x5df3c7[_0x69f2('0x34')]=_[_0x69f2('0x35')](_0xc975be[_0x69f2('0x34')]);_0x5df3c7[_0x69f2('0x36')]=_[_0x69f2('0x37')](_0x5df3c7[_0x69f2('0x32')],_0x5df3c7[_0x69f2('0x34')]);_0x3b661b['attributes']=_['intersection'](_0x5df3c7['model'],qs[_0x69f2('0x38')](_0xc975be[_0x69f2('0x34')][_0x69f2('0x38')]));_0x3b661b['attributes']=_0x3b661b['attributes'][_0x69f2('0x39')]?_0x3b661b[_0x69f2('0x3a')]:_0x5df3c7[_0x69f2('0x32')];if(!_0xc975be[_0x69f2('0x34')][_0x69f2('0x3b')](_0x69f2('0x3c'))){_0x3b661b[_0x69f2('0x23')]=qs[_0x69f2('0x23')](_0xc975be[_0x69f2('0x34')][_0x69f2('0x23')]);_0x3b661b[_0x69f2('0x21')]=qs[_0x69f2('0x21')](_0xc975be['query']['offset']);}_0x3b661b[_0x69f2('0x3d')]=qs[_0x69f2('0x3e')](_0xc975be[_0x69f2('0x34')]['sort']);_0x3b661b[_0x69f2('0x3f')]=qs[_0x69f2('0x36')](_['pick'](_0xc975be['query'],_0x5df3c7[_0x69f2('0x36')]),_0x180eb5);if(_0xc975be[_0x69f2('0x34')][_0x69f2('0x40')]){_0x3b661b[_0x69f2('0x3f')]=_[_0x69f2('0x41')](_0x3b661b[_0x69f2('0x3f')],{'$or':_['map'](_0x180eb5,function(_0x3fed5b){if(_0x3fed5b['type']!==_0x69f2('0x42')){var _0x501f70={};_0x501f70[_0x3fed5b['name']]={'$like':'%'+_0xc975be[_0x69f2('0x34')]['filter']+'%'};return _0x501f70;}})});}_0x3b661b=_['merge']({},_0x3b661b,_0xc975be[_0x69f2('0x43')]);var _0x1b9cc8={'where':_0x3b661b['where']};return db['ChatGroup']['count'](_0x1b9cc8)['then'](function(_0x218a2e){_0xbcd257[_0x69f2('0x24')]=_0x218a2e;if(_0xc975be[_0x69f2('0x34')]['includeAll']){_0x3b661b[_0x69f2('0x44')]=[{'all':!![]}];}return db[_0x69f2('0x45')][_0x69f2('0x46')](_0x3b661b);})['then'](function(_0x474817){_0xbcd257['rows']=_0x474817;return _0xbcd257;})[_0x69f2('0x2a')](respondWithFilteredResult(_0x5e95cf,_0x3b661b))['catch'](handleError(_0x5e95cf,null));};exports[_0x69f2('0x47')]=function(_0x1a50d7,_0x19edfd){var _0x3ac40e={'raw':!![],'where':{'id':_0x1a50d7['params']['id']}},_0x2eecf5={};_0x2eecf5[_0x69f2('0x32')]=_[_0x69f2('0x35')](db[_0x69f2('0x45')][_0x69f2('0x30')]);_0x2eecf5['query']=_[_0x69f2('0x35')](_0x1a50d7[_0x69f2('0x34')]);_0x2eecf5[_0x69f2('0x36')]=_[_0x69f2('0x37')](_0x2eecf5['model'],_0x2eecf5[_0x69f2('0x34')]);_0x3ac40e['attributes']=_[_0x69f2('0x37')](_0x2eecf5[_0x69f2('0x32')],qs[_0x69f2('0x38')](_0x1a50d7['query']['fields']));_0x3ac40e[_0x69f2('0x3a')]=_0x3ac40e[_0x69f2('0x3a')]['length']?_0x3ac40e[_0x69f2('0x3a')]:_0x2eecf5[_0x69f2('0x32')];if(_0x1a50d7['query'][_0x69f2('0x48')]){_0x3ac40e['include']=[{'all':!![]}];}_0x3ac40e=_[_0x69f2('0x41')]({},_0x3ac40e,_0x1a50d7[_0x69f2('0x43')]);return db[_0x69f2('0x45')][_0x69f2('0x49')](_0x3ac40e)[_0x69f2('0x2a')](handleEntityNotFound(_0x19edfd,null))['then'](respondWithResult(_0x19edfd,null))[_0x69f2('0x4a')](handleError(_0x19edfd,null));};exports[_0x69f2('0x4b')]=function(_0x4b3a3f,_0x10f78d){return db[_0x69f2('0x45')][_0x69f2('0x4b')](_0x4b3a3f[_0x69f2('0x4c')],{})[_0x69f2('0x2a')](respondWithResult(_0x10f78d,0xc9))[_0x69f2('0x4a')](handleError(_0x10f78d,null));};exports[_0x69f2('0x29')]=function(_0x3a9aeb,_0x352859){if(_0x3a9aeb['body']['id']){delete _0x3a9aeb['body']['id'];}return db[_0x69f2('0x45')][_0x69f2('0x49')]({'where':{'id':_0x3a9aeb[_0x69f2('0x4d')]['id']}})[_0x69f2('0x2a')](handleEntityNotFound(_0x352859,null))[_0x69f2('0x2a')](saveUpdates(_0x3a9aeb['body'],null))[_0x69f2('0x2a')](respondWithResult(_0x352859,null))[_0x69f2('0x4a')](handleError(_0x352859,null));};exports[_0x69f2('0x2b')]=function(_0x1954ae,_0x3e6e24){return db['ChatGroup']['find']({'where':{'id':_0x1954ae['params']['id']}})['then'](handleEntityNotFound(_0x3e6e24,null))[_0x69f2('0x2a')](removeEntity(_0x3e6e24,null))[_0x69f2('0x4a')](handleError(_0x3e6e24,null));};exports['describe']=function(_0x478081,_0x11cee9){return db['ChatGroup']['describe']()[_0x69f2('0x2a')](respondWithResult(_0x11cee9,null))[_0x69f2('0x4a')](handleError(_0x11cee9,null));};exports[_0x69f2('0x4e')]=function(_0x5f3781,_0x5cccf9,_0x181196){return db[_0x69f2('0x4f')][_0x69f2('0x24')]({'where':{'ChatGroupId':_0x5f3781[_0x69f2('0x4d')]['id'],'ToId':_0x5f3781[_0x69f2('0x50')]['id'],'read':![]}})[_0x69f2('0x2a')](function(_0x20a1b5){return{'id':_['toInteger'](_0x5f3781[_0x69f2('0x4d')]['id']),'count':_0x20a1b5};})[_0x69f2('0x2a')](respondWithResult(_0x5cccf9,null))['catch'](handleError(_0x5cccf9,null));};exports[_0x69f2('0x51')]=function(_0x17396f,_0xa3cf38,_0x53456e){return db['ChatGroup'][_0x69f2('0x49')]({'where':{'id':_0x17396f[_0x69f2('0x4d')]['id']}})[_0x69f2('0x2a')](handleEntityNotFound(_0xa3cf38,null))[_0x69f2('0x2a')](function(_0x565b1c){if(_0x565b1c){return _0x565b1c[_0x69f2('0x51')](_0x17396f[_0x69f2('0x4c')][_0x69f2('0x52')],_[_0x69f2('0x53')](_0x17396f[_0x69f2('0x4c')],[_0x69f2('0x52'),'id'])||{});}})[_0x69f2('0x2a')](respondWithResult(_0xa3cf38,null))[_0x69f2('0x4a')](handleError(_0xa3cf38,null));};exports['getMembers']=function(_0x5af4a0,_0x27e064,_0x2e5b2b){var _0x23ad22={};var _0x245914={};var _0x4aa498;var _0x3eb553;return db[_0x69f2('0x45')][_0x69f2('0x54')]({'where':{'id':_0x5af4a0[_0x69f2('0x4d')]['id']}})[_0x69f2('0x2a')](handleEntityNotFound(_0x27e064,null))['then'](function(_0xe8e18e){if(_0xe8e18e){_0x4aa498=_0xe8e18e;_0x245914[_0x69f2('0x32')]=_[_0x69f2('0x35')](db['User'][_0x69f2('0x30')]);_0x245914['query']=_[_0x69f2('0x35')](_0x5af4a0[_0x69f2('0x34')]);_0x245914[_0x69f2('0x36')]=_[_0x69f2('0x37')](_0x245914[_0x69f2('0x32')],_0x245914[_0x69f2('0x34')]);_0x23ad22['attributes']=_[_0x69f2('0x37')](_0x245914[_0x69f2('0x32')],qs['fields'](_0x5af4a0[_0x69f2('0x34')][_0x69f2('0x38')]));_0x23ad22[_0x69f2('0x3a')]=_0x23ad22[_0x69f2('0x3a')][_0x69f2('0x39')]?_0x23ad22[_0x69f2('0x3a')]:_0x245914['model'];_0x23ad22[_0x69f2('0x3d')]=qs[_0x69f2('0x3e')](_0x5af4a0[_0x69f2('0x34')][_0x69f2('0x3e')]);_0x23ad22[_0x69f2('0x3f')]=qs[_0x69f2('0x36')](_[_0x69f2('0x55')](_0x5af4a0[_0x69f2('0x34')],_0x245914[_0x69f2('0x36')]));if(_0x5af4a0[_0x69f2('0x34')][_0x69f2('0x40')]){_0x23ad22[_0x69f2('0x3f')]=_['merge'](_0x23ad22[_0x69f2('0x3f')],{'$or':_['map'](_0x23ad22['attributes'],function(_0x96ecc9){var _0x5dabde={};_0x5dabde[_0x96ecc9]={'$like':'%'+_0x5af4a0[_0x69f2('0x34')][_0x69f2('0x40')]+'%'};return _0x5dabde;})});}_0x23ad22=_[_0x69f2('0x41')]({},_0x23ad22,_0x5af4a0[_0x69f2('0x43')]);return _0x4aa498[_0x69f2('0x56')](_0x23ad22);}})[_0x69f2('0x2a')](function(_0x1bd8fb){if(_0x1bd8fb){_0x3eb553=_0x1bd8fb['length'];if(!_0x5af4a0[_0x69f2('0x34')][_0x69f2('0x3b')](_0x69f2('0x3c'))){_0x23ad22['limit']=qs[_0x69f2('0x23')](_0x5af4a0['query']['limit']);_0x23ad22['offset']=qs[_0x69f2('0x21')](_0x5af4a0[_0x69f2('0x34')][_0x69f2('0x21')]);}return _0x4aa498[_0x69f2('0x56')](_0x23ad22);}})[_0x69f2('0x2a')](function(_0x3ce000){if(_0x3ce000){return _0x3ce000?{'count':_0x3eb553,'rows':_0x3ce000}:null;}})[_0x69f2('0x2a')](respondWithResult(_0x27e064,null))['catch'](handleError(_0x27e064,null));};exports[_0x69f2('0x57')]=function(_0x1861c4,_0x3d7821,_0x2549fe){return db[_0x69f2('0x45')][_0x69f2('0x49')]({'where':{'id':_0x1861c4[_0x69f2('0x4d')]['id']}})[_0x69f2('0x2a')](handleEntityNotFound(_0x3d7821,null))[_0x69f2('0x2a')](function(_0x8aeaff){if(_0x8aeaff){return _0x8aeaff[_0x69f2('0x57')](_0x1861c4[_0x69f2('0x34')][_0x69f2('0x52')]);}})[_0x69f2('0x2a')](respondWithStatusCode(_0x3d7821,null))[_0x69f2('0x4a')](handleError(_0x3d7821,null));};exports[_0x69f2('0x58')]=function(_0x5058a2,_0x50fdd8,_0x41325e){if(_0x5058a2[_0x69f2('0x4c')]['id']){delete _0x5058a2[_0x69f2('0x4c')]['id'];}return db[_0x69f2('0x45')][_0x69f2('0x49')]({'where':{'id':_0x5058a2[_0x69f2('0x4d')]['id']}})[_0x69f2('0x2a')](handleEntityNotFound(_0x50fdd8,null))[_0x69f2('0x2a')](function(_0x1526b5){if(_0x1526b5){_0x5058a2['body'][_0x69f2('0x59')]=_0x1526b5['id'];return db[_0x69f2('0x4f')][_0x69f2('0x4b')](_0x5058a2[_0x69f2('0x4c')]);}})[_0x69f2('0x2a')](respondWithResult(_0x50fdd8,null))[_0x69f2('0x4a')](handleError(_0x50fdd8,null));};exports[_0x69f2('0x5a')]=function(_0x18d021,_0x577d3f,_0x17d308){var _0x9f1da3={};var _0x154f76={};var _0x21b472;var _0x7928fa;return db[_0x69f2('0x45')][_0x69f2('0x54')]({'where':{'id':_0x18d021[_0x69f2('0x4d')]['id']}})[_0x69f2('0x2a')](handleEntityNotFound(_0x577d3f,null))[_0x69f2('0x2a')](function(_0x2e9ba7){if(_0x2e9ba7){_0x21b472=_0x2e9ba7;_0x154f76[_0x69f2('0x32')]=_['keys'](db[_0x69f2('0x4f')][_0x69f2('0x30')]);_0x154f76[_0x69f2('0x34')]=_[_0x69f2('0x35')](_0x18d021[_0x69f2('0x34')]);_0x154f76[_0x69f2('0x36')]=_[_0x69f2('0x37')](_0x154f76[_0x69f2('0x32')],_0x154f76[_0x69f2('0x34')]);_0x9f1da3['attributes']=_[_0x69f2('0x37')](_0x154f76[_0x69f2('0x32')],qs[_0x69f2('0x38')](_0x18d021['query']['fields']));_0x9f1da3[_0x69f2('0x3a')]=_0x9f1da3[_0x69f2('0x3a')]['length']?_0x9f1da3[_0x69f2('0x3a')]:_0x154f76['model'];_0x9f1da3[_0x69f2('0x3d')]=qs[_0x69f2('0x3e')](_0x18d021['query']['sort']);_0x9f1da3[_0x69f2('0x3f')]=qs['filters'](_[_0x69f2('0x55')](_0x18d021[_0x69f2('0x34')],_0x154f76[_0x69f2('0x36')]));if(_0x18d021['query'][_0x69f2('0x40')]){_0x9f1da3[_0x69f2('0x3f')]=_['merge'](_0x9f1da3['where'],{'$or':_[_0x69f2('0x33')](_0x9f1da3[_0x69f2('0x3a')],function(_0x27dce2){var _0x4672de={};_0x4672de[_0x27dce2]={'$like':'%'+_0x18d021[_0x69f2('0x34')]['filter']+'%'};return _0x4672de;})});}if(_0x18d021[_0x69f2('0x34')][_0x69f2('0x5b')]){var _0x284fa8=_0x18d021[_0x69f2('0x34')][_0x69f2('0x5b')][_0x69f2('0x5c')](',');var _0x164da8={};_0x164da8[_0x284fa8[0x0]]={'$gte':moment(_0x284fa8[0x1])[_0x69f2('0x5d')](_0x69f2('0x5e'))};_0x9f1da3[_0x69f2('0x3f')]=_[_0x69f2('0x41')](_0x9f1da3[_0x69f2('0x3f')],_0x164da8);}_0x9f1da3=_[_0x69f2('0x41')]({},_0x9f1da3,_0x18d021[_0x69f2('0x43')]);return _0x21b472[_0x69f2('0x5a')](_0x9f1da3);}})[_0x69f2('0x2a')](function(_0x5aa13e){if(_0x5aa13e){_0x7928fa=_0x5aa13e[_0x69f2('0x39')];if(!_0x18d021[_0x69f2('0x34')][_0x69f2('0x3b')](_0x69f2('0x3c'))){_0x9f1da3[_0x69f2('0x23')]=qs[_0x69f2('0x23')](_0x18d021[_0x69f2('0x34')]['limit']);_0x9f1da3[_0x69f2('0x21')]=qs['offset'](_0x18d021['query'][_0x69f2('0x21')]);}return _0x21b472[_0x69f2('0x5a')](_0x9f1da3);}})['then'](function(_0x2f0bc4){if(_0x2f0bc4){return _0x2f0bc4?{'count':_0x7928fa,'rows':_0x2f0bc4}:null;}})[_0x69f2('0x2a')](respondWithResult(_0x577d3f,null))[_0x69f2('0x4a')](handleError(_0x577d3f,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 4052aba..e941341 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1033=['update','remove','emit','hasOwnProperty','hook','exports','ChatGroup','setMaxListeners','save'];(function(_0x2b5081,_0x45207e){var _0x5545e5=function(_0x271076){while(--_0x271076){_0x2b5081['push'](_0x2b5081['shift']());}};_0x5545e5(++_0x45207e);}(_0x1033,0x11d));var _0x3103=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x1033[_0x4792c8];return _0x35edb1;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0x3103('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x3103('0x1')](0x0);var events={'afterCreate':_0x3103('0x2'),'afterUpdate':_0x3103('0x3'),'afterDestroy':_0x3103('0x4')};function emitEvent(_0x4b7881){return function(_0x592134,_0x431007,_0x5b10c1){ChatGroupEvents['emit'](_0x4b7881+':'+_0x592134['id'],_0x592134);ChatGroupEvents[_0x3103('0x5')](_0x4b7881,_0x592134);_0x5b10c1(null);};}for(var e in events){if(events[_0x3103('0x6')](e)){var event=events[e];ChatGroup[_0x3103('0x7')](e,emitEvent(event));}}module[_0x3103('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xf628=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','emit','hasOwnProperty'];(function(_0x48fa79,_0x5d6937){var _0x19cf49=function(_0x1f46ff){while(--_0x1f46ff){_0x48fa79['push'](_0x48fa79['shift']());}};_0x19cf49(++_0x5d6937);}(_0xf628,0x7f));var _0x8f62=function(_0x2a7503,_0x56ae52){_0x2a7503=_0x2a7503-0x0;var _0x348f22=_0xf628[_0x2a7503];return _0x348f22;};'use strict';var EventEmitter=require(_0x8f62('0x0'));var ChatGroup=require(_0x8f62('0x1'))['db'][_0x8f62('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8f62('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x393c04){return function(_0x18593f,_0x1706d2,_0x2377a5){ChatGroupEvents[_0x8f62('0x4')](_0x393c04+':'+_0x18593f['id'],_0x18593f);ChatGroupEvents['emit'](_0x393c04,_0x18593f);_0x2377a5(null);};}for(var e in events){if(events[_0x8f62('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8f62('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index aecd7fc..9e54f48 100644 --- a/server/api/chatGroup/chatGroup.model.js +++ b/server/api/chatGroup/chatGroup.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e8d=['api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x4b8505,_0x52433b){var _0x592308=function(_0x311e09){while(--_0x311e09){_0x4b8505['push'](_0x4b8505['shift']());}};_0x592308(++_0x52433b);}(_0x5e8d,0x1a1));var _0xd5e8=function(_0x41b117,_0x239cfa){_0x41b117=_0x41b117-0x0;var _0x37e4ed=_0x5e8d[_0x41b117];return _0x37e4ed;};'use strict';var _=require(_0xd5e8('0x0'));var util=require(_0xd5e8('0x1'));var logger=require(_0xd5e8('0x2'))(_0xd5e8('0x3'));var moment=require(_0xd5e8('0x4'));var BPromise=require(_0xd5e8('0x5'));var rp=require(_0xd5e8('0x6'));var fs=require('fs');var path=require(_0xd5e8('0x7'));var rimraf=require(_0xd5e8('0x8'));var config=require('../../config/environment');var attributes=require(_0xd5e8('0x9'));module[_0xd5e8('0xa')]=function(_0x285f62,_0x226357){return _0x285f62[_0xd5e8('0xb')](_0xd5e8('0xc'),attributes,{'tableName':_0xd5e8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff9b=['bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api','moment'];(function(_0x3342a1,_0x1db16d){var _0x3bb43b=function(_0x16b48c){while(--_0x16b48c){_0x3342a1['push'](_0x3342a1['shift']());}};_0x3bb43b(++_0x1db16d);}(_0xff9b,0x19b));var _0xbff9=function(_0x8f0755,_0x9b2637){_0x8f0755=_0x8f0755-0x0;var _0x2b2997=_0xff9b[_0x8f0755];return _0x2b2997;};'use strict';var _=require(_0xbff9('0x0'));var util=require(_0xbff9('0x1'));var logger=require(_0xbff9('0x2'))(_0xbff9('0x3'));var moment=require(_0xbff9('0x4'));var BPromise=require(_0xbff9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbff9('0x6'));var rimraf=require(_0xbff9('0x7'));var config=require(_0xbff9('0x8'));var attributes=require(_0xbff9('0x9'));module[_0xbff9('0xa')]=function(_0x54eb18,_0x1721e0){return _0x54eb18[_0xbff9('0xb')](_0xbff9('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index bd0bd36..6e41ca1 100644 --- a/server/api/chatGroup/chatGroup.rpc.js +++ b/server/api/chatGroup/chatGroup.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14f=['then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14f,0xea));var _0xfe14=function(_0x73e513,_0x30624a){_0x73e513=_0x73e513-0x0;var _0x4a4e7a=_0xe14f[_0x73e513];return _0x4a4e7a;};'use strict';var _=require(_0xfe14('0x0'));var util=require(_0xfe14('0x1'));var moment=require(_0xfe14('0x2'));var BPromise=require(_0xfe14('0x3'));var rs=require(_0xfe14('0x4'));var fs=require('fs');var Redis=require(_0xfe14('0x5'));var db=require(_0xfe14('0x6'))['db'];var utils=require(_0xfe14('0x7'));var logger=require(_0xfe14('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe14('0x9'));var client=jayson['client'][_0xfe14('0xa')]({'port':0x232a});config[_0xfe14('0xb')]=_[_0xfe14('0xc')](config[_0xfe14('0xb')],{'host':_0xfe14('0xd'),'port':0x18eb});var socket=require(_0xfe14('0xe'))(new Redis(config[_0xfe14('0xb')]));require(_0xfe14('0xf'))[_0xfe14('0x10')](socket);function respondWithRpcPromise(_0x540586,_0x2a85b0,_0x3a8713){return new BPromise(function(_0x2bc525,_0x403478){return client[_0xfe14('0x11')](_0x540586,_0x3a8713)[_0xfe14('0x12')](function(_0x4ae9a6){logger[_0xfe14('0x13')]('ChatGroup,\x20%s,\x20%s',_0x2a85b0,_0xfe14('0x14'));logger[_0xfe14('0x15')](_0xfe14('0x16'),_0x2a85b0,_0xfe14('0x14'),JSON[_0xfe14('0x17')](_0x4ae9a6));if(_0x4ae9a6[_0xfe14('0x18')]){if(_0x4ae9a6['error']['code']===0x1f4){logger[_0xfe14('0x18')](_0xfe14('0x19'),_0x2a85b0,_0x4ae9a6[_0xfe14('0x18')]['message']);return _0x403478(_0x4ae9a6[_0xfe14('0x18')]['message']);}logger[_0xfe14('0x18')](_0xfe14('0x19'),_0x2a85b0,_0x4ae9a6[_0xfe14('0x18')][_0xfe14('0x1a')]);return _0x2bc525(_0x4ae9a6[_0xfe14('0x18')][_0xfe14('0x1a')]);}else{logger[_0xfe14('0x13')](_0xfe14('0x19'),_0x2a85b0,_0xfe14('0x14'));_0x2bc525(_0x4ae9a6['result']['message']);}})[_0xfe14('0x1b')](function(_0x44435d){logger[_0xfe14('0x18')](_0xfe14('0x19'),_0x2a85b0,_0x44435d);_0x403478(_0x44435d);});});} \ No newline at end of file +var _0x3821=['./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x58fa61,_0xc86740){var _0x1cc982=function(_0x2cb267){while(--_0x2cb267){_0x58fa61['push'](_0x58fa61['shift']());}};_0x1cc982(++_0xc86740);}(_0x3821,0xf7));var _0x1382=function(_0x2d3c35,_0x17c395){_0x2d3c35=_0x2d3c35-0x0;var _0x3ac24f=_0x3821[_0x2d3c35];return _0x3ac24f;};'use strict';var _=require(_0x1382('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1382('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1382('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1382('0x3'))(_0x1382('0x4'));var config=require(_0x1382('0x5'));var jayson=require(_0x1382('0x6'));var client=jayson[_0x1382('0x7')][_0x1382('0x8')]({'port':0x232a});config[_0x1382('0x9')]=_[_0x1382('0xa')](config[_0x1382('0x9')],{'host':_0x1382('0xb'),'port':0x18eb});var socket=require(_0x1382('0xc'))(new Redis(config['redis']));require(_0x1382('0xd'))[_0x1382('0xe')](socket);function respondWithRpcPromise(_0xe113ee,_0x525121,_0x3bf460){return new BPromise(function(_0x1fe6dc,_0x25272a){return client[_0x1382('0xf')](_0xe113ee,_0x3bf460)[_0x1382('0x10')](function(_0x30f40f){logger[_0x1382('0x11')](_0x1382('0x12'),_0x525121,_0x1382('0x13'));logger[_0x1382('0x14')](_0x1382('0x15'),_0x525121,'request\x20sent',JSON['stringify'](_0x30f40f));if(_0x30f40f[_0x1382('0x16')]){if(_0x30f40f[_0x1382('0x16')]['code']===0x1f4){logger[_0x1382('0x16')]('ChatGroup,\x20%s,\x20%s',_0x525121,_0x30f40f[_0x1382('0x16')]['message']);return _0x25272a(_0x30f40f[_0x1382('0x16')][_0x1382('0x17')]);}logger[_0x1382('0x16')](_0x1382('0x12'),_0x525121,_0x30f40f[_0x1382('0x16')][_0x1382('0x17')]);return _0x1fe6dc(_0x30f40f[_0x1382('0x16')][_0x1382('0x17')]);}else{logger[_0x1382('0x11')](_0x1382('0x12'),_0x525121,_0x1382('0x13'));_0x1fe6dc(_0x30f40f[_0x1382('0x18')]['message']);}})[_0x1382('0x19')](function(_0x37f030){logger[_0x1382('0x16')](_0x1382('0x12'),_0x525121,_0x37f030);_0x25272a(_0x37f030);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 5c328bc..111efe4 100644 --- a/server/api/chatGroup/chatGroup.socket.js +++ b/server/api/chatGroup/chatGroup.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc79f=['remove','removeListener','register','length','chatGroup:','save'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xc79f,0x15b));var _0xfc79=function(_0x31ff63,_0x15ab56){_0x31ff63=_0x31ff63-0x0;var _0x445ba1=_0xc79f[_0x31ff63];return _0x445ba1;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xfc79('0x0'),_0xfc79('0x1'),'update'];function createListener(_0x21e7aa,_0x25f1c6){return function(_0x4e2237){_0x25f1c6['emit'](_0x21e7aa,_0x4e2237);};}function removeListener(_0x448b27,_0x48e2f5){return function(){ChatGroupEvents[_0xfc79('0x2')](_0x448b27,_0x48e2f5);};}exports[_0xfc79('0x3')]=function(_0xb435a1){for(var _0x25174c=0x0,_0x1c4272=events[_0xfc79('0x4')];_0x25174c<_0x1c4272;_0x25174c++){var _0x33f788=events[_0x25174c];var _0x191acd=createListener(_0xfc79('0x5')+_0x33f788,_0xb435a1);ChatGroupEvents['on'](_0x33f788,_0x191acd);}}; \ No newline at end of file +var _0xe93e=['emit','length','./chatGroup.events','save','remove','update'];(function(_0x568af0,_0x5520fa){var _0x5979ae=function(_0x4ab544){while(--_0x4ab544){_0x568af0['push'](_0x568af0['shift']());}};_0x5979ae(++_0x5520fa);}(_0xe93e,0x8c));var _0xee93=function(_0x449166,_0x35d5c7){_0x449166=_0x449166-0x0;var _0x37916d=_0xe93e[_0x449166];return _0x37916d;};'use strict';var ChatGroupEvents=require(_0xee93('0x0'));var events=[_0xee93('0x1'),_0xee93('0x2'),_0xee93('0x3')];function createListener(_0x176c28,_0x1e5c96){return function(_0x91d4cb){_0x1e5c96[_0xee93('0x4')](_0x176c28,_0x91d4cb);};}function removeListener(_0x3fda59,_0x3a106c){return function(){ChatGroupEvents['removeListener'](_0x3fda59,_0x3a106c);};}exports['register']=function(_0xa5bf2e){for(var _0x359c47=0x0,_0x1b10ce=events[_0xee93('0x5')];_0x359c47<_0x1b10ce;_0x359c47++){var _0x126002=events[_0x359c47];var _0x6de3bb=createListener('chatGroup:'+_0x126002,_0xa5bf2e);ChatGroupEvents['on'](_0x126002,_0x6de3bb);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e39320a..861d4ed 100644 --- a/server/api/chatGroup/index.js +++ b/server/api/chatGroup/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe101=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','addMessage','destroy','removeMembers','exports','path'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xe101,0x112));var _0x1e10=function(_0x29f8dc,_0x356c82){_0x29f8dc=_0x29f8dc-0x0;var _0x5d48c4=_0xe101[_0x29f8dc];return _0x5d48c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e10('0x0'));var timeout=require(_0x1e10('0x1'));var express=require(_0x1e10('0x2'));var router=express[_0x1e10('0x3')]();var fs_extra=require(_0x1e10('0x4'));var auth=require(_0x1e10('0x5'));var interaction=require(_0x1e10('0x6'));var config=require(_0x1e10('0x7'));var controller=require('./chatGroup.controller');router[_0x1e10('0x8')]('/',auth[_0x1e10('0x9')](),controller[_0x1e10('0xa')]);router[_0x1e10('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e10('0xb')]);router['get'](_0x1e10('0xc'),auth[_0x1e10('0x9')](),controller[_0x1e10('0xd')]);router[_0x1e10('0x8')]('/:id/unread',auth[_0x1e10('0x9')](),controller[_0x1e10('0xe')]);router['get'](_0x1e10('0xf'),auth[_0x1e10('0x9')](),controller[_0x1e10('0x10')]);router[_0x1e10('0x8')]('/:id/messages',auth[_0x1e10('0x9')](),controller[_0x1e10('0x11')]);router[_0x1e10('0x12')]('/',auth['isAuthenticated'](),controller[_0x1e10('0x13')]);router[_0x1e10('0x12')](_0x1e10('0xf'),auth['isAuthenticated'](),controller[_0x1e10('0x14')]);router[_0x1e10('0x12')]('/:id/messages',auth[_0x1e10('0x9')](),controller[_0x1e10('0x15')]);router['put'](_0x1e10('0xc'),auth[_0x1e10('0x9')](),controller['update']);router['delete'](_0x1e10('0xc'),auth[_0x1e10('0x9')](),controller[_0x1e10('0x16')]);router['delete']('/:id/members',auth[_0x1e10('0x9')](),controller[_0x1e10('0x17')]);module[_0x1e10('0x18')]=router; \ No newline at end of file +var _0x8fbc=['fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getMembers','/:id/messages','getMessages','post','addMessage','put','update','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','Router'];(function(_0x47e70a,_0x1c3714){var _0x3a9900=function(_0x19ec6a){while(--_0x19ec6a){_0x47e70a['push'](_0x47e70a['shift']());}};_0x3a9900(++_0x1c3714);}(_0x8fbc,0x6b));var _0xc8fb=function(_0x3bff3c,_0x5e2ec6){_0x3bff3c=_0x3bff3c-0x0;var _0x82d3dd=_0x8fbc[_0x3bff3c];return _0x82d3dd;};'use strict';var multer=require(_0xc8fb('0x0'));var util=require('util');var path=require(_0xc8fb('0x1'));var timeout=require(_0xc8fb('0x2'));var express=require(_0xc8fb('0x3'));var router=express[_0xc8fb('0x4')]();var fs_extra=require(_0xc8fb('0x5'));var auth=require(_0xc8fb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc8fb('0x7'));var controller=require(_0xc8fb('0x8'));router[_0xc8fb('0x9')]('/',auth[_0xc8fb('0xa')](),controller[_0xc8fb('0xb')]);router[_0xc8fb('0x9')](_0xc8fb('0xc'),auth[_0xc8fb('0xa')](),controller[_0xc8fb('0xd')]);router[_0xc8fb('0x9')](_0xc8fb('0xe'),auth['isAuthenticated'](),controller[_0xc8fb('0xf')]);router[_0xc8fb('0x9')](_0xc8fb('0x10'),auth['isAuthenticated'](),controller['getUnread']);router[_0xc8fb('0x9')]('/:id/members',auth[_0xc8fb('0xa')](),controller[_0xc8fb('0x11')]);router[_0xc8fb('0x9')](_0xc8fb('0x12'),auth[_0xc8fb('0xa')](),controller[_0xc8fb('0x13')]);router['post']('/',auth[_0xc8fb('0xa')](),controller['create']);router[_0xc8fb('0x14')]('/:id/members',auth[_0xc8fb('0xa')](),controller['addMembers']);router[_0xc8fb('0x14')]('/:id/messages',auth[_0xc8fb('0xa')](),controller[_0xc8fb('0x15')]);router[_0xc8fb('0x16')](_0xc8fb('0xe'),auth[_0xc8fb('0xa')](),controller[_0xc8fb('0x17')]);router[_0xc8fb('0x18')](_0xc8fb('0xe'),auth[_0xc8fb('0xa')](),controller[_0xc8fb('0x19')]);router[_0xc8fb('0x18')]('/:id/members',auth[_0xc8fb('0xa')](),controller[_0xc8fb('0x1a')]);module[_0xc8fb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index c894be9..e4f7558 100644 --- a/server/api/chatInteraction/chatInteraction.attributes.js +++ b/server/api/chatInteraction/chatInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60a6=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','out','BOOLEAN'];(function(_0x396db1,_0x1a6cad){var _0x1b6beb=function(_0x56b3d2){while(--_0x56b3d2){_0x396db1['push'](_0x396db1['shift']());}};_0x1b6beb(++_0x1a6cad);}(_0x60a6,0xe9));var _0x660a=function(_0x54abb1,_0x2dac29){_0x54abb1=_0x54abb1-0x0;var _0x3f2ea1=_0x60a6[_0x54abb1];return _0x3f2ea1;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x660a('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x660a('0x1')]},'ratingType':{'type':Sequelize[_0x660a('0x2')](_0x660a('0x3'),_0x660a('0x4')),'defaultValue':_0x660a('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x660a('0x5')]},'mailTranscript':{'type':Sequelize[_0x660a('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x660a('0x7')]},'disposition':{'type':Sequelize[_0x660a('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x660a('0x6')]},'browserName':{'type':Sequelize[_0x660a('0x6')]},'browserVersion':{'type':Sequelize[_0x660a('0x6')]},'osName':{'type':Sequelize[_0x660a('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x660a('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x660a('0x6')]},'referer':{'type':Sequelize[_0x660a('0x5')]},'customerIp':{'type':Sequelize[_0x660a('0x6')]},'formData':{'type':Sequelize[_0x660a('0x5')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x660a('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x660a('0x2')]('in',_0x660a('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x660a('0x6')]},'customerPort':{'type':Sequelize[_0x660a('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x660a('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x660a('0x1')]}}; \ No newline at end of file +var _0x959c=['thumb','TEXT','DATE','STRING','long','out','sequelize','BOOLEAN','INTEGER','ENUM','star'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0x959c,0x1be));var _0xc959=function(_0x29aa41,_0x512deb){_0x29aa41=_0x29aa41-0x0;var _0x3947d6=_0x959c[_0x29aa41];return _0x3947d6;};'use strict';var Sequelize=require(_0xc959('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc959('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc959('0x2')]},'ratingType':{'type':Sequelize[_0xc959('0x3')](_0xc959('0x4'),_0xc959('0x5')),'defaultValue':_0xc959('0x4')},'ratingMessage':{'type':Sequelize[_0xc959('0x6')]},'pathTranscript':{'type':Sequelize[_0xc959('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc959('0x7')]},'disposition':{'type':Sequelize[_0xc959('0x8')]},'secondDisposition':{'type':Sequelize[_0xc959('0x8')]},'thirdDisposition':{'type':Sequelize[_0xc959('0x8')]},'note':{'type':Sequelize[_0xc959('0x8')]},'browserName':{'type':Sequelize[_0xc959('0x8')]},'browserVersion':{'type':Sequelize[_0xc959('0x8')]},'osName':{'type':Sequelize[_0xc959('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xc959('0x8')]},'deviceVendor':{'type':Sequelize[_0xc959('0x8')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xc959('0x6')]},'customerIp':{'type':Sequelize[_0xc959('0x8')]},'formData':{'type':Sequelize[_0xc959('0x6')](_0xc959('0x9'))},'read1stAt':{'type':Sequelize[_0xc959('0x7')]},'lastMsgAt':{'type':Sequelize[_0xc959('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xc959('0x3')]('in',_0xc959('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc959('0x8')]},'customerPort':{'type':Sequelize[_0xc959('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xc959('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xc959('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc959('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 9fec3fc..867c93f 100644 --- a/server/api/chatInteraction/chatInteraction.controller.js +++ b/server/api/chatInteraction/chatInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3acb=['value','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','end','stack','name','body','index','map','ChatInteraction','rawAttributes','fieldName','key','getOptions','findAll','chat','show','model','query','keys','filters','intersection','attributes','fields','length','include','merge','options','create','params','find','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooApiKey','user','fullname','email','contact','account','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','parse','metadata','Sequelize','ValidationError','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','filename','mimetype','Attachment','ChatOfflineMessageId','join','root','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','Messages','User','ContactId','format','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','nolimit','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','order','includeAgent','push','rows','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','Chat','N.A.','toString','closedAt','browserName','osName','referer','customerIp','customerPort','tail','createWriteStream','out','basename'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3acb,0x19a));var _0xb3ac=function(_0x4c12a8,_0x55d973){_0x4c12a8=_0x4c12a8-0x0;var _0x177947=_0x3acb[_0x4c12a8];return _0x177947;};'use strict';var rimraf=require(_0xb3ac('0x0'));var zipdir=require(_0xb3ac('0x1'));var rp=require(_0xb3ac('0x2'));var moment=require(_0xb3ac('0x3'));var BPromise=require(_0xb3ac('0x4'));var Mustache=require(_0xb3ac('0x5'));var util=require('util');var path=require(_0xb3ac('0x6'));var ejs=require(_0xb3ac('0x7'));var fs=require('fs');var _=require(_0xb3ac('0x8'));var Redis=require(_0xb3ac('0x9'));var interaction=require(_0xb3ac('0xa'));var qs=require(_0xb3ac('0xb'));var pdf=require('../../components/export/pdf');var logger=require(_0xb3ac('0xc'))(_0xb3ac('0xd'));var config=require(_0xb3ac('0xe'));var db=require(_0xb3ac('0xf'))['db'];config['redis']=_[_0xb3ac('0x10')](config[_0xb3ac('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0xb3ac('0x12'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xb3ac('0x13')](socket);var jayson=require(_0xb3ac('0x14'));var client=jayson[_0xb3ac('0x15')][_0xb3ac('0x16')]({'port':0x232b});var client9004=jayson[_0xb3ac('0x15')][_0xb3ac('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x20ab48,_0x585e2d,_0x357417,_0x3451ef){return new BPromise(function(_0x4499d1,_0x4fa2e7){var _0x4b41a5=_0x3451ef||client;return _0x4b41a5['request'](_0x20ab48,_0x357417)[_0xb3ac('0x17')](function(_0x333ec0){logger[_0xb3ac('0x18')](_0xb3ac('0x19'),_0x585e2d,_0xb3ac('0x1a'));logger[_0xb3ac('0x1b')](_0xb3ac('0x1c'),_0x585e2d,_0xb3ac('0x1a'),JSON['stringify'](_0x333ec0));if(_0x333ec0[_0xb3ac('0x1d')]){if(_0x333ec0[_0xb3ac('0x1d')]['code']===0x1f4){logger[_0xb3ac('0x1d')](_0xb3ac('0x19'),_0x585e2d,_0x333ec0[_0xb3ac('0x1d')][_0xb3ac('0x1e')]);return _0x4fa2e7(_0x333ec0[_0xb3ac('0x1d')][_0xb3ac('0x1e')]);}logger[_0xb3ac('0x1d')](_0xb3ac('0x19'),_0x585e2d,_0x333ec0['error'][_0xb3ac('0x1e')]);return _0x4499d1(_0x333ec0[_0xb3ac('0x1d')][_0xb3ac('0x1e')]);}else{logger['info'](_0xb3ac('0x19'),_0x585e2d,_0xb3ac('0x1a'));_0x4499d1(_0x333ec0[_0xb3ac('0x1f')]['message']);}})[_0xb3ac('0x20')](function(_0x54178d){logger[_0xb3ac('0x1d')](_0xb3ac('0x19'),_0x585e2d,_0x54178d);_0x4fa2e7(_0x54178d);});});}function respondWithStatusCode(_0x2dee1b,_0x5ef209){_0x5ef209=_0x5ef209||0xcc;return function(_0x5574f8){if(_0x5574f8){return _0x2dee1b[_0xb3ac('0x21')](_0x5ef209);}return _0x2dee1b[_0xb3ac('0x22')](_0x5ef209)['end']();};}function respondWithResult(_0x160453,_0x1f4479){_0x1f4479=_0x1f4479||0xc8;return function(_0x3353e6){if(_0x3353e6){return _0x160453[_0xb3ac('0x22')](_0x1f4479)[_0xb3ac('0x23')](_0x3353e6);}};}function respondWithFilteredResult(_0x2e336b,_0x50d730){return function(_0x226444){if(_0x226444){var _0x1a50d2=typeof _0x50d730[_0xb3ac('0x24')]===_0xb3ac('0x25')&&typeof _0x50d730[_0xb3ac('0x26')]===_0xb3ac('0x25');var _0x97292=_0x226444['count'];var _0x24cfd0=_0x1a50d2?0x0:_0x50d730[_0xb3ac('0x24')];var _0x24ca0c=_0x1a50d2?_0x226444[_0xb3ac('0x27')]:_0x50d730['offset']+_0x50d730[_0xb3ac('0x26')];var _0x3dec8e;if(_0x24ca0c>=_0x97292){_0x24ca0c=_0x97292;_0x3dec8e=0xc8;}else{_0x3dec8e=0xce;}_0x2e336b['status'](_0x3dec8e);return _0x2e336b[_0xb3ac('0x28')](_0xb3ac('0x29'),_0x24cfd0+'-'+_0x24ca0c+'/'+_0x97292)[_0xb3ac('0x23')](_0x226444);}return null;};}function saveUpdates(_0xa58835){return function(_0xb15e34){if(_0xb15e34){return _0xb15e34[_0xb3ac('0x2a')](_0xa58835)[_0xb3ac('0x17')](function(_0x9d2b80){return _0x9d2b80;});}return null;};}function removeEntity(_0x3138d3){return function(_0x38375c){if(_0x38375c){return _0x38375c['destroy']()[_0xb3ac('0x17')](function(){_0x3138d3[_0xb3ac('0x22')](0xcc)[_0xb3ac('0x2b')]();});}};}function handleEntityNotFound(_0x15e530){return function(_0x441c99){if(!_0x441c99){_0x15e530['sendStatus'](0x194);}return _0x441c99;};}function handleError(_0x2300e0,_0x4edf99){_0x4edf99=_0x4edf99||0x1f4;return function(_0x188a15){logger['error'](_0x188a15[_0xb3ac('0x2c')]);if(_0x188a15['name']){delete _0x188a15[_0xb3ac('0x2d')];}_0x2300e0['status'](_0x4edf99)['send'](_0x188a15);};}function getMustacheRender(_0xcd85bf,_0x4703a7){return Mustache['render'](_0xcd85bf,_['merge'](_0x4703a7[_0xb3ac('0x2e')],{'contact':_0x4703a7['contact'],'message':_0x4703a7[_0xb3ac('0x1e')],'agent':_0x4703a7['agent'],'interaction':_0x4703a7['interaction'],'account':_0x4703a7['account']}))||'';}exports[_0xb3ac('0x2f')]=function(_0x21d3c9,_0xb93fc6){var _0x28be53={};var _0x3347e0=_[_0xb3ac('0x30')](db[_0xb3ac('0x31')][_0xb3ac('0x32')],function(_0x5c28d9){return{'name':_0x5c28d9[_0xb3ac('0x33')],'type':_0x5c28d9['type'][_0xb3ac('0x34')]};});_0x28be53=qs[_0xb3ac('0x35')](_0x3347e0,_0x21d3c9);return interaction[_0xb3ac('0x36')](_0xb3ac('0x37'),_0x21d3c9['query'],_0x21d3c9['user'],_0x28be53,_0x3347e0)[_0xb3ac('0x17')](respondWithFilteredResult(_0xb93fc6,_0x28be53))[_0xb3ac('0x20')](handleError(_0xb93fc6,null));};exports[_0xb3ac('0x38')]=function(_0x21e678,_0x31bff6){var _0x229fbf={'raw':![],'where':{'id':_0x21e678['params']['id']}},_0x5972d3={};_0x5972d3[_0xb3ac('0x39')]=_['keys'](db[_0xb3ac('0x31')][_0xb3ac('0x32')]);_0x5972d3[_0xb3ac('0x3a')]=_[_0xb3ac('0x3b')](_0x21e678[_0xb3ac('0x3a')]);_0x5972d3[_0xb3ac('0x3c')]=_[_0xb3ac('0x3d')](_0x5972d3[_0xb3ac('0x39')],_0x5972d3['query']);_0x229fbf[_0xb3ac('0x3e')]=_['intersection'](_0x5972d3['model'],qs[_0xb3ac('0x3f')](_0x21e678[_0xb3ac('0x3a')][_0xb3ac('0x3f')]));_0x229fbf['attributes']=_0x229fbf[_0xb3ac('0x3e')][_0xb3ac('0x40')]?_0x229fbf[_0xb3ac('0x3e')]:_0x5972d3['model'];if(_0x21e678[_0xb3ac('0x3a')]['includeAll']){_0x229fbf[_0xb3ac('0x41')]=[{'all':!![]}];}_0x229fbf=_[_0xb3ac('0x42')]({},_0x229fbf,_0x21e678[_0xb3ac('0x43')]);return db[_0xb3ac('0x31')]['find'](_0x229fbf)[_0xb3ac('0x17')](handleEntityNotFound(_0x31bff6,null))[_0xb3ac('0x17')](respondWithResult(_0x31bff6,null))[_0xb3ac('0x20')](handleError(_0x31bff6,null));};exports[_0xb3ac('0x44')]=function(_0x10be85,_0x26f382){return db['ChatInteraction'][_0xb3ac('0x44')](_0x10be85[_0xb3ac('0x2e')],{})[_0xb3ac('0x17')](respondWithResult(_0x26f382,0xc9))[_0xb3ac('0x20')](handleError(_0x26f382,null));};exports[_0xb3ac('0x2a')]=function(_0x2ed300,_0x5bccf1){if(_0x2ed300[_0xb3ac('0x2e')]['id']){delete _0x2ed300[_0xb3ac('0x2e')]['id'];}return db[_0xb3ac('0x31')]['find']({'where':{'id':_0x2ed300[_0xb3ac('0x45')]['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x5bccf1,null))['then'](saveUpdates(_0x2ed300[_0xb3ac('0x2e')],null))[_0xb3ac('0x17')](respondWithResult(_0x5bccf1,null))[_0xb3ac('0x20')](handleError(_0x5bccf1,null));};exports['destroy']=function(_0x516d6c,_0x4112af){return db[_0xb3ac('0x31')][_0xb3ac('0x46')]({'where':{'id':_0x516d6c[_0xb3ac('0x45')]['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x4112af,null))[_0xb3ac('0x17')](removeEntity(_0x4112af,null))[_0xb3ac('0x20')](handleError(_0x4112af,null));};exports[_0xb3ac('0x47')]=function(_0x18594a,_0x4fe068){return db[_0xb3ac('0x31')]['describe']()[_0xb3ac('0x17')](respondWithResult(_0x4fe068,null))[_0xb3ac('0x20')](handleError(_0x4fe068,null));};exports['createVidaooSession']=function(_0x178e8a,_0x56d61b){var _0x6b2e32=_0x178e8a[_0xb3ac('0x45')]['id'];var _0x408551;var _0x42592c;var _0x26d748;return db[_0xb3ac('0x31')][_0xb3ac('0x48')]({'where':{'id':_0x6b2e32}})[_0xb3ac('0x17')](function(_0x58932e){_0x408551=_0x58932e;return db[_0xb3ac('0x49')][_0xb3ac('0x48')]({'where':{'id':_0x58932e[_0xb3ac('0x4a')]},'attributes':['id','vidaooApiKey',_0xb3ac('0x4b'),'vidaooTopic','vidaooNote','vidaooMetadata'],'raw':!![]});})[_0xb3ac('0x17')](function(_0x39518e){if(_0x39518e&&_0x39518e[_0xb3ac('0x4c')]&&_0x39518e[_0xb3ac('0x4b')]){_0x42592c=_0x39518e;var _0x454e13={'interaction':{'id':_0x6b2e32},'agent':{'id':_0x178e8a[_0xb3ac('0x4d')]['id'],'name':_0x178e8a['user']['name'],'fullname':_0x178e8a[_0xb3ac('0x4d')][_0xb3ac('0x4e')],'email':_0x178e8a[_0xb3ac('0x4d')][_0xb3ac('0x4f')]},'contact':_0x178e8a['body'][_0xb3ac('0x50')],'account':_0x178e8a[_0xb3ac('0x2e')][_0xb3ac('0x51')]};var _0x495f2b={'rejectUnauthorized':![],'method':'POST','url':_0xb3ac('0x52'),'headers':{'X-APIKEY':_0x39518e[_0xb3ac('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x178e8a[_0xb3ac('0x4d')][_0xb3ac('0x4f')]],'buttons':null,'topic':_0x42592c['vidaooTopic'],'note':_['isNull'](_0x42592c['vidaooNote'])?null:getMustacheRender(_0x42592c[_0xb3ac('0x53')],_0x454e13),'metadata':null},'redirect':_0xb3ac('0x54'),'json':!![]};try{if(!_[_0xb3ac('0x55')](_0x42592c['vidaooMetadata'])){var _0x11f437=getMustacheRender(_0x42592c['vidaooMetadata'],_0x454e13);var _0x12877d=JSON[_0xb3ac('0x56')](_0x11f437);_0x495f2b[_0xb3ac('0x2e')][_0xb3ac('0x57')]=_0x12877d;}}catch(_0x4c2b7c){throw new db[(_0xb3ac('0x58'))][(_0xb3ac('0x59'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x495f2b);}else{throw new db[(_0xb3ac('0x58'))][(_0xb3ac('0x59'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xb3ac('0x17')](function(_0x2ffc33){_0x26d748=_0x2ffc33;if(_0x26d748['id']){var _0x52dd94={'body':_0x26d748['join_url'],'ChatWebsiteId':_0x42592c['id'],'ChatInteractionId':_0x408551['id'],'direction':'out','UserId':_0x178e8a['user']['id']};return db[_0xb3ac('0x5a')][_0xb3ac('0x44')](_0x52dd94,{});}else{throw new db[(_0xb3ac('0x58'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xb3ac('0x17')](function(){return _0x408551[_0xb3ac('0x5b')]({'vidaooSessionId':_0x26d748['id']});})[_0xb3ac('0x17')](respondWithResult(_0x56d61b,null))[_0xb3ac('0x20')](handleError(_0x56d61b,null));};exports[_0xb3ac('0x5c')]=function(_0x55d0db,_0x4d679d){if(_0x55d0db['body']['id']){delete _0x55d0db[_0xb3ac('0x2e')]['id'];}return db[_0xb3ac('0x31')][_0xb3ac('0x46')]({'where':{'id':_0x55d0db[_0xb3ac('0x45')]['id']},'include':[{'model':db[_0xb3ac('0x5d')],'as':_0xb3ac('0x5e')}]})[_0xb3ac('0x17')](handleEntityNotFound(_0x4d679d,null))[_0xb3ac('0x17')](saveUpdates(_0x55d0db[_0xb3ac('0x2e')],null))[_0xb3ac('0x17')](respondWithResult(_0x4d679d,null))['catch'](handleError(_0x4d679d,null));};exports[_0xb3ac('0x5f')]=function(_0x3adcee,_0x43f19f){if(_0x3adcee[_0xb3ac('0x2e')]['id']){delete _0x3adcee[_0xb3ac('0x2e')]['id'];}return db[_0xb3ac('0x31')]['find']({'where':{'id':_0x3adcee[_0xb3ac('0x45')]['id']}})['then'](function(_0x3b8589){if(!_0x3b8589){logger[_0xb3ac('0x1d')](_0xb3ac('0x60'),'abandon',0x194,_0xb3ac('0x61'));_0x43f19f[_0xb3ac('0x21')](0x194);}else{if(_0x3b8589[_0xb3ac('0x62')]){throw new db[(_0xb3ac('0x58'))][(_0xb3ac('0x59'))](_0xb3ac('0x63'));}}return _0x3b8589;})[_0xb3ac('0x17')](function(_0x1967c2){if(_0x1967c2){return _0x1967c2[_0xb3ac('0x2a')]({'closed':_0x3adcee[_0xb3ac('0x2e')][_0xb3ac('0x64')],'disposition':_0x3adcee[_0xb3ac('0x2e')]['disposition']})[_0xb3ac('0x17')](function(_0x22a03a){return _0x22a03a;});}})[_0xb3ac('0x17')](function(){return respondWithRpcPromise('AbandonInteraction',_0xb3ac('0x5f'),_0x3adcee['body'],client9004);})[_0xb3ac('0x17')](respondWithResult(_0x43f19f,null))['catch'](handleError(_0x43f19f,null));};exports[_0xb3ac('0x65')]=function(_0x4ca5b3,_0xc6db11){_0x4ca5b3[_0xb3ac('0x2e')]['name']=_0x4ca5b3[_0xb3ac('0x66')][_0xb3ac('0x67')];_0x4ca5b3['body']['basename']=_0x4ca5b3[_0xb3ac('0x66')][_0xb3ac('0x68')];_0x4ca5b3['body']['type']=_0x4ca5b3[_0xb3ac('0x66')][_0xb3ac('0x69')];return db[_0xb3ac('0x6a')][_0xb3ac('0x44')](_0x4ca5b3['body'])['then'](respondWithResult(_0xc6db11,0xc9))[_0xb3ac('0x20')](handleError(_0xc6db11,null));};exports['attachmentDownload']=function(_0x42a3ac,_0x50006c){return db[_0xb3ac('0x31')][_0xb3ac('0x48')]({'where':{'id':_0x42a3ac['params']['id']},'raw':!![]})[_0xb3ac('0x17')](handleEntityNotFound(_0x50006c,null))['then'](function(_0x26a6be){if(_0x26a6be){if(_0x26a6be[_0xb3ac('0x64')]){return _0x50006c[_0xb3ac('0x22')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xb3ac('0x6a')][_0xb3ac('0x48')]({'where':{'id':_0x42a3ac['query']['attachId']},'raw':!![]})[_0xb3ac('0x17')](handleEntityNotFound(_0x50006c,null));}})['then'](function(_0x3e9d2b){if(_0x3e9d2b){var _0x1e0056=_0x3e9d2b[_0xb3ac('0x6b')]!==null;var _0x2c3271=path[_0xb3ac('0x6c')](config[_0xb3ac('0x6d')],'server/files/attachments/');if(_0x1e0056){_0x2c3271=path[_0xb3ac('0x6c')](_0x2c3271,'offline-chat/');}var _0x3a4acc=path[_0xb3ac('0x6c')](_0x2c3271,_0x3e9d2b['basename']);return _0x50006c[_0xb3ac('0x6e')](_0x3a4acc);}})['catch'](handleError(_0x50006c,null));};exports[_0xb3ac('0x6f')]=function(_0x23973b,_0x2c3af3){var _0x1b23c9=null;var _0x52811=null;var _0x1337fb=null;if(_0x23973b['body']['id']){delete _0x23973b[_0xb3ac('0x2e')]['id'];}if(_0x23973b[_0xb3ac('0x2e')][_0xb3ac('0x70')]){_0x1337fb=path[_0xb3ac('0x6c')](config[_0xb3ac('0x6d')],_0xb3ac('0x71'),util['format'](_0xb3ac('0x72'),Date[_0xb3ac('0x73')]()));_0x23973b[_0xb3ac('0x2e')]['pathTranscript']=_0x1337fb;}return db['ChatInteraction'][_0xb3ac('0x46')]({'where':{'id':_0x23973b[_0xb3ac('0x45')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xb3ac('0x74'),'include':[{'model':db[_0xb3ac('0x75')],'as':_0xb3ac('0x75')}]}]})[_0xb3ac('0x17')](handleEntityNotFound(_0x2c3af3,null))[_0xb3ac('0x17')](saveUpdates(_0x23973b[_0xb3ac('0x2e')],null))['then'](function(_0x31991c){if(_0x31991c){_0x1b23c9=_0x31991c;return db[_0xb3ac('0x49')][_0xb3ac('0x46')]({'where':{'id':_0x1b23c9[_0xb3ac('0x4a')]}});}})['then'](function(_0x27f1c4){if(_0x27f1c4){_0x52811=_0x27f1c4;return db[_0xb3ac('0x5d')][_0xb3ac('0x46')]({'where':{'id':_0x1b23c9[_0xb3ac('0x76')]}});}})[_0xb3ac('0x17')](function(_0x2579df){if(_0x2579df){if(_0x1337fb){var _0x5e5a37=null;for(var _0x3729dc=0x1;_0x3729dc<_0x1b23c9['Messages'][_0xb3ac('0x40')];++_0x3729dc){_0x5e5a37=_0x1b23c9[_0xb3ac('0x74')][_0x3729dc];var _0x198853=_0x5e5a37[_0xb3ac('0x62')]?util[_0xb3ac('0x77')](_0xb3ac('0x78'),_0x52811[_0xb3ac('0x79')],_0x5e5a37[_0xb3ac('0x62')]):_0xb3ac('0x7a');var _0x44a6b3=_0x23973b[_0xb3ac('0x2e')]['customer']||util[_0xb3ac('0x77')]('%s%d',_0xb3ac('0x7b'),_0x5e5a37[_0xb3ac('0x76')]);switch(_0x52811[_0xb3ac('0x7c')]){case _0xb3ac('0x7d'):_0x198853=_0x5e5a37[_0xb3ac('0x62')]?util[_0xb3ac('0x77')](_0xb3ac('0x78'),_0x52811[_0xb3ac('0x79')],_0x5e5a37[_0xb3ac('0x62')]):_0xb3ac('0x7a');break;case _0xb3ac('0x7e'):_0x198853=_0x5e5a37['UserId']?_0x5e5a37[_0xb3ac('0x75')]['alias']||_0x5e5a37[_0xb3ac('0x75')]['fullname']:_0xb3ac('0x7a');break;case _0xb3ac('0x7f'):_0x198853=_0x5e5a37[_0xb3ac('0x62')]?_0x5e5a37[_0xb3ac('0x75')][_0xb3ac('0x4e')]:_0xb3ac('0x7a');break;default:_0x198853=_0x5e5a37[_0xb3ac('0x62')]?util['format'](_0xb3ac('0x78'),_0x52811[_0xb3ac('0x79')],_0x5e5a37['UserId']):_0xb3ac('0x7a');}var _0x37d8bf=util[_0xb3ac('0x77')](_0xb3ac('0x80'),moment(_0x5e5a37[_0xb3ac('0x81')])[_0xb3ac('0x77')](_0xb3ac('0x82')),_0x5e5a37[_0xb3ac('0x83')]==='in'?_0x44a6b3:_0x198853,_0x5e5a37['body']);if(!_0x5e5a37[_0xb3ac('0x84')]){fs[_0xb3ac('0x85')](_0x1337fb,_0x37d8bf);}}return db[_0xb3ac('0x86')][_0xb3ac('0x48')]({'where':{'service':!![]},'include':[{'model':db[_0xb3ac('0x87')],'as':_0xb3ac('0x88'),'raw':!![],'include':[{'model':db[_0xb3ac('0x89')],'as':_0xb3ac('0x89'),'raw':!![]}]}]});}}})['then'](function(_0x1774c8){if(!_0x1774c8||!_0x1774c8[_0xb3ac('0x88')]||!_0x23973b['body'])return _0x1b23c9;var _0x132788=_0x1774c8[_0xb3ac('0x8a')]();return respondWithRpcPromise(_0xb3ac('0x8b'),'sendMail',{'account':_0x132788,'message':{'from':util[_0xb3ac('0x77')](_0xb3ac('0x8c'),_0x1774c8[_0xb3ac('0x2d')],_0x1774c8['email']||_0x1774c8[_0xb3ac('0x88')][_0xb3ac('0x4d')]),'to':_0x23973b['body'][_0xb3ac('0x70')],'subject':_0xb3ac('0x8d'),'text':util[_0xb3ac('0x77')](_0xb3ac('0x8e'),_0x23973b[_0xb3ac('0x2e')]['mailTranscript']),'attachments':[{'path':_0x1337fb}]}})[_0xb3ac('0x17')](function(){return _0x1b23c9;})[_0xb3ac('0x20')](function(_0x344255){logger['error'](_0x344255);});})[_0xb3ac('0x17')](respondWithStatusCode(_0x2c3af3,0xc8))[_0xb3ac('0x20')](handleError(_0x2c3af3,null));};exports[_0xb3ac('0x8f')]=function(_0x1518fb,_0x4cd2b7){return db['ChatMessage']['find']({'where':{'id':_0x1518fb[_0xb3ac('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cd2b7,null))[_0xb3ac('0x17')](function(_0x3976db){if(_0x3976db){return _0x3976db[_0xb3ac('0x8f')](_0x1518fb[_0xb3ac('0x2e')][_0xb3ac('0x90')],_[_0xb3ac('0x91')](_0x1518fb[_0xb3ac('0x2e')],[_0xb3ac('0x90'),'id'])||{});}})[_0xb3ac('0x17')](respondWithResult(_0x4cd2b7,null))[_0xb3ac('0x20')](handleError(_0x4cd2b7,null));};exports['getMessages']=function(_0x5d23b6,_0x2896f1){var _0xfc9245={'raw':![],'where':{}};var _0x125d90={};var _0x57ebc1={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb3ac('0x48')]({'where':{'id':_0x5d23b6[_0xb3ac('0x45')]['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x2896f1,null))['then'](function(_0x372480){if(_0x372480){_0x125d90['model']=_[_0xb3ac('0x3b')](db[_0xb3ac('0x5a')][_0xb3ac('0x32')]);_0x125d90[_0xb3ac('0x3a')]=_[_0xb3ac('0x3b')](_0x5d23b6[_0xb3ac('0x3a')]);_0x125d90[_0xb3ac('0x3c')]=_[_0xb3ac('0x3d')](_0x125d90[_0xb3ac('0x39')],_0x125d90[_0xb3ac('0x3a')]);_0xfc9245[_0xb3ac('0x3e')]=_[_0xb3ac('0x3d')](_0x125d90[_0xb3ac('0x39')],qs[_0xb3ac('0x3f')](_0x5d23b6[_0xb3ac('0x3a')]['fields']));_0xfc9245[_0xb3ac('0x3e')]=_0xfc9245[_0xb3ac('0x3e')][_0xb3ac('0x40')]?_0xfc9245[_0xb3ac('0x3e')]:_0x125d90[_0xb3ac('0x39')];if(!_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x92')](_0xb3ac('0x93'))){_0xfc9245['limit']=qs[_0xb3ac('0x26')](_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x26')]);_0xfc9245[_0xb3ac('0x24')]=qs[_0xb3ac('0x24')](_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x24')]);}_0xfc9245['order']=qs[_0xb3ac('0x94')](_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x94')]);_0xfc9245['where']=qs['filters'](_[_0xb3ac('0x95')](_0x5d23b6[_0xb3ac('0x3a')],_0x125d90['filters']));_0xfc9245[_0xb3ac('0x96')][_0xb3ac('0x97')]=_0x372480['id'];if(_0x5d23b6[_0xb3ac('0x3a')]['filter']){_0xfc9245[_0xb3ac('0x96')]=_[_0xb3ac('0x42')](_0xfc9245[_0xb3ac('0x96')],{'$or':_[_0xb3ac('0x30')](_0xfc9245[_0xb3ac('0x3e')],function(_0x1c6c41){var _0x21a76b={};_0x21a76b[_0x1c6c41]={'$like':'%'+_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x98')]+'%'};return _0x21a76b;})});}if(_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x99')]){var _0x4d1113=_0x5d23b6[_0xb3ac('0x3a')]['$gte'][_0xb3ac('0x9a')](',');var _0x5f37bb={};_0x5f37bb[_0x4d1113[0x0]]={'$gte':moment(_0x4d1113[0x1])[_0xb3ac('0x77')](_0xb3ac('0x9b'))};_0xfc9245[_0xb3ac('0x96')]=_['merge'](_0xfc9245[_0xb3ac('0x96')],_0x5f37bb);}_0xfc9245=_[_0xb3ac('0x42')]({},_0xfc9245,_0x5d23b6[_0xb3ac('0x43')]);return db[_0xb3ac('0x5a')][_0xb3ac('0x27')]({'where':_0xfc9245[_0xb3ac('0x96')]})[_0xb3ac('0x17')](function(_0x5828f5){_0x57ebc1['count']=_0x5828f5;if(_0x5d23b6['query']['includeAll']){_0xfc9245['include']=[{'all':!![]}];}return db[_0xb3ac('0x5a')]['findAll'](_0xfc9245);})[_0xb3ac('0x17')](function(_0x1a5bb4){_0x57ebc1['rows']=_0x1a5bb4;return _0x57ebc1;});}})[_0xb3ac('0x17')](respondWithFilteredResult(_0x2896f1,_0xfc9245))[_0xb3ac('0x20')](handleError(_0x2896f1,null));};exports[_0xb3ac('0x9c')]=function(_0x20e8e6,_0x539907){var _0x1f5bb2={'where':{}},_0x538f83={},_0x2eb1d5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb3ac('0x48')]({'where':{'id':_0x20e8e6[_0xb3ac('0x45')]['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x539907,null))['then'](function(_0xb0e600){if(_0xb0e600){_0x538f83[_0xb3ac('0x39')]=_['keys'](db[_0xb3ac('0x5a')][_0xb3ac('0x32')]);_0x538f83[_0xb3ac('0x3a')]=_[_0xb3ac('0x3b')](_0x20e8e6[_0xb3ac('0x3a')]);_0x538f83[_0xb3ac('0x3c')]=_[_0xb3ac('0x3d')](_0x538f83[_0xb3ac('0x39')],_0x538f83[_0xb3ac('0x3a')]);_0x1f5bb2['attributes']=_[_0xb3ac('0x3d')](_0x538f83[_0xb3ac('0x39')],qs['fields'](_0x20e8e6[_0xb3ac('0x3a')][_0xb3ac('0x3f')]));_0x1f5bb2['attributes']=_0x1f5bb2[_0xb3ac('0x3e')][_0xb3ac('0x40')]?_0x1f5bb2['attributes']:_0x538f83['model'];if(!_0x20e8e6[_0xb3ac('0x3a')]['hasOwnProperty'](_0xb3ac('0x93'))){_0x1f5bb2[_0xb3ac('0x26')]=qs['limit'](_0x20e8e6['query']['limit']);_0x1f5bb2[_0xb3ac('0x24')]=qs[_0xb3ac('0x24')](_0x20e8e6['query'][_0xb3ac('0x24')]);}_0x1f5bb2[_0xb3ac('0x9d')]=qs[_0xb3ac('0x94')](_0x20e8e6['query']['sort']);_0x1f5bb2[_0xb3ac('0x96')]=qs['filters'](_[_0xb3ac('0x95')](_0x20e8e6['query'],_0x538f83[_0xb3ac('0x3c')]));_0x1f5bb2[_0xb3ac('0x96')][_0xb3ac('0x97')]=_0xb0e600['id'];if(_0x20e8e6[_0xb3ac('0x3a')][_0xb3ac('0x98')]){_0x1f5bb2['where']=_[_0xb3ac('0x42')](_0x1f5bb2[_0xb3ac('0x96')],{'$or':_[_0xb3ac('0x30')](_0x1f5bb2[_0xb3ac('0x3e')],function(_0x4a6db7){var _0x17a267={};_0x17a267[_0x4a6db7]={'$like':'%'+_0x20e8e6['query'][_0xb3ac('0x98')]+'%'};return _0x17a267;})});}_0x1f5bb2['where'][_0xb3ac('0x84')]=![];if(_0x20e8e6['query']['id']){_0x1f5bb2[_0xb3ac('0x96')]['id']={'$gt':_0x20e8e6[_0xb3ac('0x3a')]['id']};}_0x1f5bb2=_['merge']({},_0x1f5bb2,_0x20e8e6['options']);return db['ChatMessage'][_0xb3ac('0x27')]({'where':_0x1f5bb2[_0xb3ac('0x96')]})[_0xb3ac('0x17')](function(_0x1b8dbb){_0x2eb1d5[_0xb3ac('0x27')]=_0x1b8dbb;_0x1f5bb2[_0xb3ac('0x41')]=[];if(_0x20e8e6['query'][_0xb3ac('0x9e')]){_0x1f5bb2[_0xb3ac('0x41')][_0xb3ac('0x9f')]({'model':db[_0xb3ac('0x75')],'as':_0xb3ac('0x75'),'attributes':['id','fullname','alias']});}if(_0x20e8e6[_0xb3ac('0x3a')]['includeAll']){_0x1f5bb2['include']=[{'all':!![]}];}return db[_0xb3ac('0x5a')][_0xb3ac('0x36')](_0x1f5bb2);})[_0xb3ac('0x17')](function(_0x38dedd){_0x2eb1d5[_0xb3ac('0xa0')]=_0x38dedd;return _0x2eb1d5;});}})[_0xb3ac('0x17')](respondWithFilteredResult(_0x539907,_0x1f5bb2))['catch'](handleError(_0x539907,null));};exports[_0xb3ac('0xa1')]=function(_0x456e3c,_0x5975b2){return db[_0xb3ac('0x31')]['find']({'where':{'id':_0x456e3c['params']['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x5975b2,null))['then'](function(_0x25d731){if(_0x25d731){return _0x25d731[_0xb3ac('0xa2')](_0x456e3c[_0xb3ac('0x2e')][_0xb3ac('0x90')],_[_0xb3ac('0x91')](_0x456e3c['body'],['ids','id'])||{})[_0xb3ac('0xa3')](function(){return db[_0xb3ac('0xa4')][_0xb3ac('0x36')]({'attributes':['id',_0xb3ac('0x2d'),_0xb3ac('0xa5')],'where':{'id':_0x456e3c[_0xb3ac('0x2e')][_0xb3ac('0x90')]}});})[_0xb3ac('0x17')](function(_0x40c627){socket[_0xb3ac('0xa6')](_0xb3ac('0xa7'),{'id':Number(_0x456e3c[_0xb3ac('0x45')]['id']),'tags':_0x40c627||[]});return{'id':Number(_0x456e3c[_0xb3ac('0x45')]['id']),'tags':_0x40c627||[]};});}})[_0xb3ac('0x17')](respondWithResult(_0x5975b2,null))[_0xb3ac('0x20')](handleError(_0x5975b2,null));};exports[_0xb3ac('0xa8')]=function(_0x278530,_0x4848cc){return db[_0xb3ac('0x31')][_0xb3ac('0x46')]({'where':{'id':_0x278530['params']['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x4848cc,null))[_0xb3ac('0x17')](function(_0x562411){if(_0x562411){return _0x562411['removeTags'](_0x278530[_0xb3ac('0x3a')][_0xb3ac('0x90')]);}})[_0xb3ac('0x17')](respondWithStatusCode(_0x4848cc,null))[_0xb3ac('0x20')](handleError(_0x4848cc,null));};exports[_0xb3ac('0x6e')]=function(_0x4114bb,_0x1cc0f2){var _0xcb9495=moment()[_0xb3ac('0xa9')]()['toString']();var _0x48c21e=path[_0xb3ac('0x6c')](config[_0xb3ac('0x6d')],'server',_0xb3ac('0xaa'),_0xb3ac('0xab'));var _0x32dc8d=path[_0xb3ac('0x6c')](config[_0xb3ac('0x6d')],'server','files',_0xb3ac('0xac'));var _0x1f7118=path[_0xb3ac('0x6c')](_0x48c21e,_0xcb9495);var _0x30a678=util['format'](_0xb3ac('0xad'),_0x4114bb['params']['id'],_0xcb9495);var _0x3ad17f=path[_0xb3ac('0x6c')](_0x48c21e,_0x30a678);var _0x220b35=[];_0x220b35[_0xb3ac('0x9f')]({'model':db[_0xb3ac('0x75')],'as':_0xb3ac('0x75'),'attributes':['id','fullname'],'raw':!![]});_0x220b35[_0xb3ac('0x9f')]({'model':db[_0xb3ac('0x5d')],'as':_0xb3ac('0x5e'),'attributes':['id',_0xb3ac('0xae'),_0xb3ac('0xaf')],'raw':!![]});if(_0x4114bb[_0xb3ac('0x3a')][_0xb3ac('0xac')]){_0x220b35[_0xb3ac('0x9f')]({'model':db[_0xb3ac('0x6a')],'as':_0xb3ac('0x6a'),'raw':!![]});}var _0x2d3f7a=[{'model':db[_0xb3ac('0x5a')],'as':_0xb3ac('0x74'),'attributes':['id',_0xb3ac('0x2e'),_0xb3ac('0x81'),_0xb3ac('0x83'),_0xb3ac('0x84'),_0xb3ac('0xb0')],'include':_0x220b35}];_0x2d3f7a['push']({'model':db[_0xb3ac('0x49')],'as':_0xb3ac('0xb1'),'attributes':['id',_0xb3ac('0x2d')]});_0x2d3f7a[_0xb3ac('0x9f')]({'model':db[_0xb3ac('0x75')],'as':_0xb3ac('0xb2'),'attributes':['id',_0xb3ac('0x4e')]});return db[_0xb3ac('0x31')][_0xb3ac('0x46')]({'where':{'id':_0x4114bb[_0xb3ac('0x45')]['id']},'include':_0x2d3f7a})[_0xb3ac('0x17')](handleEntityNotFound(_0x1cc0f2,null))[_0xb3ac('0x17')](function(_0x442b98){if(_0x442b98){var _0x223ee9=_0x442b98[_0xb3ac('0xb3')]({'plain':!![]});fs['mkdirSync'](_0x1f7118);var _0x426b1d={'channel':_0xb3ac('0xb4'),'account':_0x223ee9['Account'][_0xb3ac('0x2d')],'agent':_0x223ee9[_0xb3ac('0xb2')]?_0x223ee9[_0xb3ac('0xb2')][_0xb3ac('0x4e')]:_0xb3ac('0xb5'),'createdAt':moment(_0x223ee9[_0xb3ac('0x81')])[_0xb3ac('0x77')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb3ac('0xb6')](),'closedAt':_0x223ee9[_0xb3ac('0x64')]?moment(_0x223ee9[_0xb3ac('0xb7')])['format'](_0xb3ac('0x9b'))[_0xb3ac('0xb6')]():'','disposition':_0x223ee9['disposition'],'chatInfo':{'browser':_0x223ee9[_0xb3ac('0xb8')],'os':_0x223ee9[_0xb3ac('0xb9')],'referer':_0x223ee9[_0xb3ac('0xba')],'customerIp':_0x223ee9[_0xb3ac('0xbb')],'customerPort':_0x223ee9[_0xb3ac('0xbc')]?_0x223ee9[_0xb3ac('0xbc')]:_0xb3ac('0xb5')},'messages':_(_0x223ee9['Messages'])[_0xb3ac('0xbd')]()[_0xb3ac('0x98')]({'secret':![]})[_0xb3ac('0x30')](function(_0x50cb12){if(_0x50cb12[_0xb3ac('0x6a')]){var _0x3c5c85=path[_0xb3ac('0x6c')](_0x32dc8d,_0x50cb12['Attachment']['basename']);if(fs['existsSync'](_0x3c5c85)){fs['createReadStream'](_0x3c5c85)['pipe'](fs[_0xb3ac('0xbe')](path[_0xb3ac('0x6c')](_0x1f7118,_0x50cb12[_0xb3ac('0x6a')]['basename'])));}}return{'date':moment(_0x50cb12[_0xb3ac('0x81')])['format'](_0xb3ac('0x9b'))[_0xb3ac('0xb6')](),'sender':_0x50cb12['direction']===_0xb3ac('0xbf')?_0x50cb12['User']?_0x50cb12[_0xb3ac('0x75')]['fullname']:'System':_0x50cb12[_0xb3ac('0x5e')][_0xb3ac('0xae')]+(_0x50cb12['Contact'][_0xb3ac('0xaf')]?'\x20'+_0x50cb12['Contact'][_0xb3ac('0xaf')]:''),'body':_0x50cb12[_0xb3ac('0x6a')]?_0x50cb12[_0xb3ac('0x6a')][_0xb3ac('0xc0')]:_0x50cb12['body'],'direction':_0x50cb12['direction']===_0xb3ac('0xbf')?'A':'C','secret':_0x50cb12[_0xb3ac('0x84')],'read':_0x50cb12[_0xb3ac('0xb0')],'attachment':_0x50cb12['Attachment']};})[_0xb3ac('0xc1')]()};return ejs['renderFile'](path[_0xb3ac('0x6c')](config[_0xb3ac('0x6d')],_0xb3ac('0xc2'),_0xb3ac('0xc3'),_0xb3ac('0xc4')),{'interaction':_0x426b1d})[_0xb3ac('0x17')](function(_0x268a55){var _0xc23090=path['join'](_0x1f7118,_0xb3ac('0xc5')+_0x223ee9['id']+'-'+_0xcb9495+_0xb3ac('0xc6'));var _0x54bf2c={'path':_0xc23090,'channel':_0xb3ac('0xb4'),'interactionId':_0x223ee9['id']};return pdf[_0xb3ac('0xc7')](_0x268a55,_0x54bf2c);})[_0xb3ac('0x17')](function(){return new Promise(function(_0x19c6f6,_0x1fa70b){zipdir(_0x1f7118,{'saveTo':_0x3ad17f},function(_0x52b735,_0x2599da){if(_0x52b735)return _0x1fa70b(_0x52b735);return _0x19c6f6(_0x2599da);});})['then'](function(){return new BPromise(function(_0x4dbe77,_0x545f41){rimraf(_0x1f7118,function(_0x2d7a6a){if(_0x2d7a6a)_0x545f41(_0x2d7a6a);return _0x4dbe77();});});})[_0xb3ac('0x17')](function(){return _0x1cc0f2[_0xb3ac('0x6e')](_0x3ad17f,_0x30a678,function(_0x2871a9){if(_0x2871a9){logger[_0xb3ac('0x1d')](_0xb3ac('0xc8'),_0x2871a9);}else{fs['unlinkSync'](_0x3ad17f);}});});});}else{return _0x1cc0f2[_0xb3ac('0x21')](0xc8);}})[_0xb3ac('0x20')](handleError(_0x1cc0f2,null));}; \ No newline at end of file +var _0xe3ef=['api','../../config/environment','../../mysqldb','defaults','localhost','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','stack','name','merge','body','account','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','rawAttributes','keys','model','intersection','attributes','length','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','email','contact','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','secret','MailAccount','MailServerOut','Smtp','CloudProvider','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','fields','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','getMyMessages','hasOwnProperty','nolimit','order','sort','includeAgent','push','rows','addTags','Tag','color','emit','removeTags','files','server','transcript-%d-%s.zip','attachments','createdAt','read','Account','Owner','get','Chat','N.A.','closedAt','toString','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','direction','firstName','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','zip-dir','moment','bluebird','mustache','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger'];(function(_0x4e0022,_0x1253da){var _0x597a15=function(_0x1238b6){while(--_0x1238b6){_0x4e0022['push'](_0x4e0022['shift']());}};_0x597a15(++_0x1253da);}(_0xe3ef,0xc7));var _0xfe3e=function(_0x4c749f,_0x5ddc3c){_0x4c749f=_0x4c749f-0x0;var _0x388d3b=_0xe3ef[_0x4c749f];return _0x388d3b;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xfe3e('0x0'));var rp=require('request-promise');var moment=require(_0xfe3e('0x1'));var BPromise=require(_0xfe3e('0x2'));var Mustache=require(_0xfe3e('0x3'));var util=require('util');var path=require('path');var ejs=require(_0xfe3e('0x4'));var fs=require('fs');var _=require(_0xfe3e('0x5'));var Redis=require('ioredis');var interaction=require(_0xfe3e('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xfe3e('0x7'));var logger=require(_0xfe3e('0x8'))(_0xfe3e('0x9'));var config=require(_0xfe3e('0xa'));var db=require(_0xfe3e('0xb'))['db'];config['redis']=_[_0xfe3e('0xc')](config['redis'],{'host':_0xfe3e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe3e('0xe')]));require(_0xfe3e('0xf'))[_0xfe3e('0x10')](socket);var jayson=require(_0xfe3e('0x11'));var client=jayson[_0xfe3e('0x12')][_0xfe3e('0x13')]({'port':0x232b});var client9004=jayson[_0xfe3e('0x12')][_0xfe3e('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x5fe883,_0x557f63,_0x1a0d27,_0x5303cc){return new BPromise(function(_0x5aa0a4,_0x222d0d){var _0x5554a1=_0x5303cc||client;return _0x5554a1[_0xfe3e('0x14')](_0x5fe883,_0x1a0d27)['then'](function(_0x3bae61){logger[_0xfe3e('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x557f63,_0xfe3e('0x16'));logger[_0xfe3e('0x17')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x557f63,_0xfe3e('0x16'),JSON[_0xfe3e('0x18')](_0x3bae61));if(_0x3bae61[_0xfe3e('0x19')]){if(_0x3bae61[_0xfe3e('0x19')][_0xfe3e('0x1a')]===0x1f4){logger[_0xfe3e('0x19')](_0xfe3e('0x1b'),_0x557f63,_0x3bae61[_0xfe3e('0x19')][_0xfe3e('0x1c')]);return _0x222d0d(_0x3bae61[_0xfe3e('0x19')][_0xfe3e('0x1c')]);}logger[_0xfe3e('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x557f63,_0x3bae61[_0xfe3e('0x19')][_0xfe3e('0x1c')]);return _0x5aa0a4(_0x3bae61['error'][_0xfe3e('0x1c')]);}else{logger[_0xfe3e('0x15')](_0xfe3e('0x1b'),_0x557f63,_0xfe3e('0x16'));_0x5aa0a4(_0x3bae61['result'][_0xfe3e('0x1c')]);}})[_0xfe3e('0x1d')](function(_0x38e872){logger[_0xfe3e('0x19')](_0xfe3e('0x1b'),_0x557f63,_0x38e872);_0x222d0d(_0x38e872);});});}function respondWithStatusCode(_0x281621,_0x50c6eb){_0x50c6eb=_0x50c6eb||0xcc;return function(_0xee7cde){if(_0xee7cde){return _0x281621[_0xfe3e('0x1e')](_0x50c6eb);}return _0x281621[_0xfe3e('0x1f')](_0x50c6eb)[_0xfe3e('0x20')]();};}function respondWithResult(_0x2a6fac,_0x254a5a){_0x254a5a=_0x254a5a||0xc8;return function(_0x2272f8){if(_0x2272f8){return _0x2a6fac[_0xfe3e('0x1f')](_0x254a5a)['json'](_0x2272f8);}};}function respondWithFilteredResult(_0x51b6b1,_0x5be731){return function(_0x5de796){if(_0x5de796){var _0x308fec=typeof _0x5be731['offset']===_0xfe3e('0x21')&&typeof _0x5be731[_0xfe3e('0x22')]===_0xfe3e('0x21');var _0xef8938=_0x5de796[_0xfe3e('0x23')];var _0x443283=_0x308fec?0x0:_0x5be731[_0xfe3e('0x24')];var _0x38ef37=_0x308fec?_0x5de796[_0xfe3e('0x23')]:_0x5be731['offset']+_0x5be731['limit'];var _0x394fd5;if(_0x38ef37>=_0xef8938){_0x38ef37=_0xef8938;_0x394fd5=0xc8;}else{_0x394fd5=0xce;}_0x51b6b1[_0xfe3e('0x1f')](_0x394fd5);return _0x51b6b1[_0xfe3e('0x25')](_0xfe3e('0x26'),_0x443283+'-'+_0x38ef37+'/'+_0xef8938)[_0xfe3e('0x27')](_0x5de796);}return null;};}function saveUpdates(_0xce871){return function(_0x4b6528){if(_0x4b6528){return _0x4b6528[_0xfe3e('0x28')](_0xce871)[_0xfe3e('0x29')](function(_0x20d155){return _0x20d155;});}return null;};}function removeEntity(_0x5a8b24){return function(_0x2557ca){if(_0x2557ca){return _0x2557ca[_0xfe3e('0x2a')]()[_0xfe3e('0x29')](function(){_0x5a8b24['status'](0xcc)[_0xfe3e('0x20')]();});}};}function handleEntityNotFound(_0x5533b9){return function(_0x4f3713){if(!_0x4f3713){_0x5533b9['sendStatus'](0x194);}return _0x4f3713;};}function handleError(_0x313488,_0x262cd9){_0x262cd9=_0x262cd9||0x1f4;return function(_0x47e290){logger['error'](_0x47e290[_0xfe3e('0x2b')]);if(_0x47e290[_0xfe3e('0x2c')]){delete _0x47e290['name'];}_0x313488[_0xfe3e('0x1f')](_0x262cd9)['send'](_0x47e290);};}function getMustacheRender(_0x231bbb,_0x227ddf){return Mustache['render'](_0x231bbb,_[_0xfe3e('0x2d')](_0x227ddf[_0xfe3e('0x2e')],{'contact':_0x227ddf['contact'],'message':_0x227ddf[_0xfe3e('0x1c')],'agent':_0x227ddf['agent'],'interaction':_0x227ddf['interaction'],'account':_0x227ddf[_0xfe3e('0x2f')]}))||'';}exports[_0xfe3e('0x30')]=function(_0x474756,_0x4e8264){var _0x468a7b={};var _0x5c0352=_[_0xfe3e('0x31')](db[_0xfe3e('0x32')]['rawAttributes'],function(_0xcef69c){return{'name':_0xcef69c[_0xfe3e('0x33')],'type':_0xcef69c[_0xfe3e('0x34')][_0xfe3e('0x35')]};});_0x468a7b=qs[_0xfe3e('0x36')](_0x5c0352,_0x474756);return interaction[_0xfe3e('0x37')](_0xfe3e('0x38'),_0x474756[_0xfe3e('0x39')],_0x474756[_0xfe3e('0x3a')],_0x468a7b,_0x5c0352)[_0xfe3e('0x29')](respondWithFilteredResult(_0x4e8264,_0x468a7b))[_0xfe3e('0x1d')](handleError(_0x4e8264,null));};exports[_0xfe3e('0x3b')]=function(_0x1efc8b,_0x529921){var _0x2473e0={'raw':![],'where':{'id':_0x1efc8b[_0xfe3e('0x3c')]['id']}},_0x3e4a1d={};_0x3e4a1d['model']=_['keys'](db[_0xfe3e('0x32')][_0xfe3e('0x3d')]);_0x3e4a1d[_0xfe3e('0x39')]=_[_0xfe3e('0x3e')](_0x1efc8b[_0xfe3e('0x39')]);_0x3e4a1d['filters']=_['intersection'](_0x3e4a1d[_0xfe3e('0x3f')],_0x3e4a1d[_0xfe3e('0x39')]);_0x2473e0['attributes']=_[_0xfe3e('0x40')](_0x3e4a1d[_0xfe3e('0x3f')],qs['fields'](_0x1efc8b['query']['fields']));_0x2473e0['attributes']=_0x2473e0[_0xfe3e('0x41')][_0xfe3e('0x42')]?_0x2473e0['attributes']:_0x3e4a1d[_0xfe3e('0x3f')];if(_0x1efc8b['query']['includeAll']){_0x2473e0['include']=[{'all':!![]}];}_0x2473e0=_[_0xfe3e('0x2d')]({},_0x2473e0,_0x1efc8b[_0xfe3e('0x43')]);return db['ChatInteraction'][_0xfe3e('0x44')](_0x2473e0)[_0xfe3e('0x29')](handleEntityNotFound(_0x529921,null))[_0xfe3e('0x29')](respondWithResult(_0x529921,null))[_0xfe3e('0x1d')](handleError(_0x529921,null));};exports[_0xfe3e('0x45')]=function(_0x335178,_0x38d37e){return db[_0xfe3e('0x32')][_0xfe3e('0x45')](_0x335178[_0xfe3e('0x2e')],{})['then'](respondWithResult(_0x38d37e,0xc9))[_0xfe3e('0x1d')](handleError(_0x38d37e,null));};exports['update']=function(_0x408147,_0x587ca4){if(_0x408147['body']['id']){delete _0x408147['body']['id'];}return db['ChatInteraction'][_0xfe3e('0x44')]({'where':{'id':_0x408147[_0xfe3e('0x3c')]['id']}})[_0xfe3e('0x29')](handleEntityNotFound(_0x587ca4,null))['then'](saveUpdates(_0x408147['body'],null))['then'](respondWithResult(_0x587ca4,null))[_0xfe3e('0x1d')](handleError(_0x587ca4,null));};exports[_0xfe3e('0x2a')]=function(_0x28245a,_0x34a830){return db[_0xfe3e('0x32')][_0xfe3e('0x44')]({'where':{'id':_0x28245a['params']['id']}})[_0xfe3e('0x29')](handleEntityNotFound(_0x34a830,null))['then'](removeEntity(_0x34a830,null))[_0xfe3e('0x1d')](handleError(_0x34a830,null));};exports[_0xfe3e('0x46')]=function(_0x3a00c5,_0x684ca8){return db[_0xfe3e('0x32')]['describe']()[_0xfe3e('0x29')](respondWithResult(_0x684ca8,null))[_0xfe3e('0x1d')](handleError(_0x684ca8,null));};exports[_0xfe3e('0x47')]=function(_0x5c5cb0,_0x5ab735){var _0x2e5e78=_0x5c5cb0['params']['id'];var _0x39a8ab;var _0x244ffe;var _0x2e554b;return db['ChatInteraction'][_0xfe3e('0x48')]({'where':{'id':_0x2e5e78}})[_0xfe3e('0x29')](function(_0x57d076){_0x39a8ab=_0x57d076;return db[_0xfe3e('0x49')][_0xfe3e('0x48')]({'where':{'id':_0x57d076['ChatWebsiteId']},'attributes':['id',_0xfe3e('0x4a'),'vidaooEscalation',_0xfe3e('0x4b'),_0xfe3e('0x4c'),_0xfe3e('0x4d')],'raw':!![]});})['then'](function(_0x17aad0){if(_0x17aad0&&_0x17aad0['vidaooApiKey']&&_0x17aad0[_0xfe3e('0x4e')]){_0x244ffe=_0x17aad0;var _0x59d116={'interaction':{'id':_0x2e5e78},'agent':{'id':_0x5c5cb0[_0xfe3e('0x3a')]['id'],'name':_0x5c5cb0[_0xfe3e('0x3a')][_0xfe3e('0x2c')],'fullname':_0x5c5cb0[_0xfe3e('0x3a')][_0xfe3e('0x4f')],'email':_0x5c5cb0['user'][_0xfe3e('0x50')]},'contact':_0x5c5cb0[_0xfe3e('0x2e')][_0xfe3e('0x51')],'account':_0x5c5cb0['body'][_0xfe3e('0x2f')]};var _0x37793e={'rejectUnauthorized':![],'method':'POST','url':_0xfe3e('0x52'),'headers':{'X-APIKEY':_0x17aad0['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5c5cb0[_0xfe3e('0x3a')][_0xfe3e('0x50')]],'buttons':null,'topic':_0x244ffe[_0xfe3e('0x4b')],'note':_[_0xfe3e('0x53')](_0x244ffe[_0xfe3e('0x4c')])?null:getMustacheRender(_0x244ffe[_0xfe3e('0x4c')],_0x59d116),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xfe3e('0x53')](_0x244ffe['vidaooMetadata'])){var _0x485a8d=getMustacheRender(_0x244ffe[_0xfe3e('0x4d')],_0x59d116);var _0x518d57=JSON[_0xfe3e('0x54')](_0x485a8d);_0x37793e[_0xfe3e('0x2e')][_0xfe3e('0x55')]=_0x518d57;}}catch(_0x3dea80){throw new db[(_0xfe3e('0x56'))][(_0xfe3e('0x57'))](_0xfe3e('0x58'));}return rp(_0x37793e);}else{throw new db[(_0xfe3e('0x56'))][(_0xfe3e('0x57'))](_0xfe3e('0x59'));}})[_0xfe3e('0x29')](function(_0x7e57a8){_0x2e554b=_0x7e57a8;if(_0x2e554b['id']){var _0x5a9ed7={'body':_0x2e554b[_0xfe3e('0x5a')],'ChatWebsiteId':_0x244ffe['id'],'ChatInteractionId':_0x39a8ab['id'],'direction':_0xfe3e('0x5b'),'UserId':_0x5c5cb0['user']['id']};return db[_0xfe3e('0x5c')][_0xfe3e('0x45')](_0x5a9ed7,{});}else{throw new db[(_0xfe3e('0x56'))][(_0xfe3e('0x57'))](_0xfe3e('0x5d'));}})['then'](function(){return _0x39a8ab['updateAttributes']({'vidaooSessionId':_0x2e554b['id']});})[_0xfe3e('0x29')](respondWithResult(_0x5ab735,null))[_0xfe3e('0x1d')](handleError(_0x5ab735,null));};exports[_0xfe3e('0x5e')]=function(_0x23426a,_0x2d40dd){if(_0x23426a[_0xfe3e('0x2e')]['id']){delete _0x23426a[_0xfe3e('0x2e')]['id'];}return db[_0xfe3e('0x32')][_0xfe3e('0x44')]({'where':{'id':_0x23426a[_0xfe3e('0x3c')]['id']},'include':[{'model':db[_0xfe3e('0x5f')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x2d40dd,null))[_0xfe3e('0x29')](saveUpdates(_0x23426a['body'],null))[_0xfe3e('0x29')](respondWithResult(_0x2d40dd,null))[_0xfe3e('0x1d')](handleError(_0x2d40dd,null));};exports['abandon']=function(_0x4150f7,_0x4361cd){if(_0x4150f7['body']['id']){delete _0x4150f7[_0xfe3e('0x2e')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x4150f7['params']['id']}})[_0xfe3e('0x29')](function(_0x1b8c34){if(!_0x1b8c34){logger[_0xfe3e('0x19')](_0xfe3e('0x60'),_0xfe3e('0x61'),0x194,_0xfe3e('0x62'));_0x4361cd[_0xfe3e('0x1e')](0x194);}else{if(_0x1b8c34[_0xfe3e('0x63')]){throw new db[(_0xfe3e('0x56'))][(_0xfe3e('0x57'))](_0xfe3e('0x64'));}}return _0x1b8c34;})[_0xfe3e('0x29')](function(_0xad91e4){if(_0xad91e4){return _0xad91e4[_0xfe3e('0x28')]({'closed':_0x4150f7[_0xfe3e('0x2e')][_0xfe3e('0x65')],'disposition':_0x4150f7[_0xfe3e('0x2e')][_0xfe3e('0x66')]})[_0xfe3e('0x29')](function(_0x4540d0){return _0x4540d0;});}})['then'](function(){return respondWithRpcPromise(_0xfe3e('0x67'),'abandon',_0x4150f7[_0xfe3e('0x2e')],client9004);})[_0xfe3e('0x29')](respondWithResult(_0x4361cd,null))['catch'](handleError(_0x4361cd,null));};exports['attachmentUpload']=function(_0x5db298,_0x127a8e){_0x5db298[_0xfe3e('0x2e')][_0xfe3e('0x2c')]=_0x5db298[_0xfe3e('0x68')][_0xfe3e('0x69')];_0x5db298[_0xfe3e('0x2e')][_0xfe3e('0x6a')]=_0x5db298['file'][_0xfe3e('0x6b')];_0x5db298[_0xfe3e('0x2e')]['type']=_0x5db298[_0xfe3e('0x68')][_0xfe3e('0x6c')];return db[_0xfe3e('0x6d')][_0xfe3e('0x45')](_0x5db298[_0xfe3e('0x2e')])[_0xfe3e('0x29')](respondWithResult(_0x127a8e,0xc9))[_0xfe3e('0x1d')](handleError(_0x127a8e,null));};exports[_0xfe3e('0x6e')]=function(_0x1ec1c6,_0x55ec8b){return db[_0xfe3e('0x32')]['findOne']({'where':{'id':_0x1ec1c6[_0xfe3e('0x3c')]['id']},'raw':!![]})[_0xfe3e('0x29')](handleEntityNotFound(_0x55ec8b,null))['then'](function(_0x53aaf0){if(_0x53aaf0){if(_0x53aaf0[_0xfe3e('0x65')]){return _0x55ec8b[_0xfe3e('0x1f')](0x193)['json']({'status':0x193,'message':_0xfe3e('0x6f')});}return db[_0xfe3e('0x6d')][_0xfe3e('0x48')]({'where':{'id':_0x1ec1c6[_0xfe3e('0x39')]['attachId']},'raw':!![]})[_0xfe3e('0x29')](handleEntityNotFound(_0x55ec8b,null));}})['then'](function(_0x1523a0){if(_0x1523a0){var _0x41ecc8=_0x1523a0[_0xfe3e('0x70')]!==null;var _0x403520=path[_0xfe3e('0x71')](config[_0xfe3e('0x72')],_0xfe3e('0x73'));if(_0x41ecc8){_0x403520=path[_0xfe3e('0x71')](_0x403520,_0xfe3e('0x74'));}var _0xbfdf47=path[_0xfe3e('0x71')](_0x403520,_0x1523a0[_0xfe3e('0x6a')]);return _0x55ec8b[_0xfe3e('0x75')](_0xbfdf47);}})['catch'](handleError(_0x55ec8b,null));};exports[_0xfe3e('0x76')]=function(_0x40e83d,_0x18f2ae){var _0x154176=null;var _0x7bc754=null;var _0x5e3c50=null;if(_0x40e83d[_0xfe3e('0x2e')]['id']){delete _0x40e83d[_0xfe3e('0x2e')]['id'];}if(_0x40e83d['body'][_0xfe3e('0x77')]){_0x5e3c50=path['join'](config[_0xfe3e('0x72')],_0xfe3e('0x78'),util['format'](_0xfe3e('0x79'),Date[_0xfe3e('0x7a')]()));_0x40e83d[_0xfe3e('0x2e')][_0xfe3e('0x7b')]=_0x5e3c50;}return db[_0xfe3e('0x32')][_0xfe3e('0x44')]({'where':{'id':_0x40e83d['params']['id']},'include':[{'model':db[_0xfe3e('0x5c')],'as':_0xfe3e('0x7c'),'include':[{'model':db[_0xfe3e('0x7d')],'as':_0xfe3e('0x7d')}]}]})[_0xfe3e('0x29')](handleEntityNotFound(_0x18f2ae,null))[_0xfe3e('0x29')](saveUpdates(_0x40e83d[_0xfe3e('0x2e')],null))[_0xfe3e('0x29')](function(_0x5e4296){if(_0x5e4296){_0x154176=_0x5e4296;return db[_0xfe3e('0x49')][_0xfe3e('0x44')]({'where':{'id':_0x154176['ChatWebsiteId']}});}})['then'](function(_0x2fef79){if(_0x2fef79){_0x7bc754=_0x2fef79;return db[_0xfe3e('0x5f')][_0xfe3e('0x44')]({'where':{'id':_0x154176[_0xfe3e('0x7e')]}});}})[_0xfe3e('0x29')](function(_0xbb36df){if(_0xbb36df){if(_0x5e3c50){var _0x33d135=null;for(var _0xfd2edc=0x1;_0xfd2edc<_0x154176[_0xfe3e('0x7c')][_0xfe3e('0x42')];++_0xfd2edc){_0x33d135=_0x154176[_0xfe3e('0x7c')][_0xfd2edc];var _0x54a0c7=_0x33d135['UserId']?util[_0xfe3e('0x7f')](_0xfe3e('0x80'),_0x7bc754[_0xfe3e('0x81')],_0x33d135[_0xfe3e('0x63')]):_0xfe3e('0x82');var _0x4922c9=_0x40e83d[_0xfe3e('0x2e')][_0xfe3e('0x83')]||util[_0xfe3e('0x7f')]('%s%d',_0xfe3e('0x84'),_0x33d135[_0xfe3e('0x7e')]);switch(_0x7bc754[_0xfe3e('0x85')]){case _0xfe3e('0x86'):_0x54a0c7=_0x33d135[_0xfe3e('0x63')]?util['format'](_0xfe3e('0x80'),_0x7bc754[_0xfe3e('0x81')],_0x33d135['UserId']):_0xfe3e('0x82');break;case _0xfe3e('0x87'):_0x54a0c7=_0x33d135[_0xfe3e('0x63')]?_0x33d135['User'][_0xfe3e('0x88')]||_0x33d135[_0xfe3e('0x7d')][_0xfe3e('0x4f')]:'System';break;case _0xfe3e('0x89'):_0x54a0c7=_0x33d135[_0xfe3e('0x63')]?_0x33d135[_0xfe3e('0x7d')][_0xfe3e('0x4f')]:'System';break;default:_0x54a0c7=_0x33d135[_0xfe3e('0x63')]?util[_0xfe3e('0x7f')]('%s%d',_0x7bc754[_0xfe3e('0x81')],_0x33d135[_0xfe3e('0x63')]):_0xfe3e('0x82');}var _0x14a7a1=util[_0xfe3e('0x7f')]('[%s]\x20%s:\x20%s\x0a',moment(_0x33d135['createdAt'])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x33d135['direction']==='in'?_0x4922c9:_0x54a0c7,_0x33d135['body']);if(!_0x33d135[_0xfe3e('0x8a')]){fs['appendFileSync'](_0x5e3c50,_0x14a7a1);}}return db[_0xfe3e('0x8b')][_0xfe3e('0x48')]({'where':{'service':!![]},'include':[{'model':db[_0xfe3e('0x8c')],'as':_0xfe3e('0x8d'),'raw':!![],'include':[{'model':db[_0xfe3e('0x8e')],'as':_0xfe3e('0x8e'),'raw':!![]}]}]});}}})[_0xfe3e('0x29')](function(_0x11d67a){if(!_0x11d67a||!_0x11d67a[_0xfe3e('0x8d')]||!_0x40e83d['body'])return _0x154176;var _0x4db447=_0x11d67a['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xfe3e('0x8f'),{'account':_0x4db447,'message':{'from':util[_0xfe3e('0x7f')](_0xfe3e('0x90'),_0x11d67a[_0xfe3e('0x2c')],_0x11d67a['email']||_0x11d67a['Smtp']['user']),'to':_0x40e83d[_0xfe3e('0x2e')][_0xfe3e('0x77')],'subject':'Mail\x20Transcript','text':util[_0xfe3e('0x7f')](_0xfe3e('0x91'),_0x40e83d[_0xfe3e('0x2e')][_0xfe3e('0x77')]),'attachments':[{'path':_0x5e3c50}]}})['then'](function(){return _0x154176;})[_0xfe3e('0x1d')](function(_0x4054d5){logger[_0xfe3e('0x19')](_0x4054d5);});})[_0xfe3e('0x29')](respondWithStatusCode(_0x18f2ae,0xc8))[_0xfe3e('0x1d')](handleError(_0x18f2ae,null));};exports[_0xfe3e('0x92')]=function(_0x3acfc2,_0x222645){return db['ChatMessage'][_0xfe3e('0x44')]({'where':{'id':_0x3acfc2[_0xfe3e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x222645,null))[_0xfe3e('0x29')](function(_0x238335){if(_0x238335){return _0x238335[_0xfe3e('0x92')](_0x3acfc2[_0xfe3e('0x2e')][_0xfe3e('0x93')],_[_0xfe3e('0x94')](_0x3acfc2['body'],[_0xfe3e('0x93'),'id'])||{});}})[_0xfe3e('0x29')](respondWithResult(_0x222645,null))[_0xfe3e('0x1d')](handleError(_0x222645,null));};exports[_0xfe3e('0x95')]=function(_0x5a5796,_0x43ba0f){var _0x163e0c={'raw':![],'where':{}};var _0x14678f={};var _0x28a2fc={'count':0x0,'rows':[]};return db[_0xfe3e('0x32')][_0xfe3e('0x48')]({'where':{'id':_0x5a5796[_0xfe3e('0x3c')]['id']}})[_0xfe3e('0x29')](handleEntityNotFound(_0x43ba0f,null))[_0xfe3e('0x29')](function(_0x215e0d){if(_0x215e0d){_0x14678f[_0xfe3e('0x3f')]=_[_0xfe3e('0x3e')](db[_0xfe3e('0x5c')][_0xfe3e('0x3d')]);_0x14678f[_0xfe3e('0x39')]=_[_0xfe3e('0x3e')](_0x5a5796['query']);_0x14678f[_0xfe3e('0x96')]=_[_0xfe3e('0x40')](_0x14678f['model'],_0x14678f[_0xfe3e('0x39')]);_0x163e0c[_0xfe3e('0x41')]=_['intersection'](_0x14678f[_0xfe3e('0x3f')],qs[_0xfe3e('0x97')](_0x5a5796['query'][_0xfe3e('0x97')]));_0x163e0c['attributes']=_0x163e0c[_0xfe3e('0x41')][_0xfe3e('0x42')]?_0x163e0c[_0xfe3e('0x41')]:_0x14678f['model'];if(!_0x5a5796[_0xfe3e('0x39')]['hasOwnProperty']('nolimit')){_0x163e0c[_0xfe3e('0x22')]=qs[_0xfe3e('0x22')](_0x5a5796[_0xfe3e('0x39')][_0xfe3e('0x22')]);_0x163e0c[_0xfe3e('0x24')]=qs[_0xfe3e('0x24')](_0x5a5796[_0xfe3e('0x39')][_0xfe3e('0x24')]);}_0x163e0c['order']=qs['sort'](_0x5a5796[_0xfe3e('0x39')]['sort']);_0x163e0c[_0xfe3e('0x98')]=qs[_0xfe3e('0x96')](_[_0xfe3e('0x99')](_0x5a5796[_0xfe3e('0x39')],_0x14678f['filters']));_0x163e0c[_0xfe3e('0x98')][_0xfe3e('0x9a')]=_0x215e0d['id'];if(_0x5a5796[_0xfe3e('0x39')][_0xfe3e('0x9b')]){_0x163e0c[_0xfe3e('0x98')]=_['merge'](_0x163e0c[_0xfe3e('0x98')],{'$or':_[_0xfe3e('0x31')](_0x163e0c[_0xfe3e('0x41')],function(_0x21c772){var _0x287b87={};_0x287b87[_0x21c772]={'$like':'%'+_0x5a5796[_0xfe3e('0x39')]['filter']+'%'};return _0x287b87;})});}if(_0x5a5796[_0xfe3e('0x39')][_0xfe3e('0x9c')]){var _0x501f31=_0x5a5796[_0xfe3e('0x39')]['$gte'][_0xfe3e('0x9d')](',');var _0x5eb9f3={};_0x5eb9f3[_0x501f31[0x0]]={'$gte':moment(_0x501f31[0x1])[_0xfe3e('0x7f')](_0xfe3e('0x9e'))};_0x163e0c[_0xfe3e('0x98')]=_[_0xfe3e('0x2d')](_0x163e0c[_0xfe3e('0x98')],_0x5eb9f3);}_0x163e0c=_[_0xfe3e('0x2d')]({},_0x163e0c,_0x5a5796[_0xfe3e('0x43')]);return db[_0xfe3e('0x5c')]['count']({'where':_0x163e0c[_0xfe3e('0x98')]})[_0xfe3e('0x29')](function(_0x1d90b4){_0x28a2fc['count']=_0x1d90b4;if(_0x5a5796[_0xfe3e('0x39')][_0xfe3e('0x9f')]){_0x163e0c[_0xfe3e('0xa0')]=[{'all':!![]}];}return db['ChatMessage'][_0xfe3e('0x37')](_0x163e0c);})[_0xfe3e('0x29')](function(_0x47c3c5){_0x28a2fc['rows']=_0x47c3c5;return _0x28a2fc;});}})['then'](respondWithFilteredResult(_0x43ba0f,_0x163e0c))['catch'](handleError(_0x43ba0f,null));};exports[_0xfe3e('0xa1')]=function(_0x11403a,_0x24782e){var _0x36fe44={'where':{}},_0x14d791={},_0x4ff548={'count':0x0,'rows':[]};return db[_0xfe3e('0x32')][_0xfe3e('0x48')]({'where':{'id':_0x11403a['params']['id']}})[_0xfe3e('0x29')](handleEntityNotFound(_0x24782e,null))[_0xfe3e('0x29')](function(_0xac14c){if(_0xac14c){_0x14d791['model']=_[_0xfe3e('0x3e')](db[_0xfe3e('0x5c')][_0xfe3e('0x3d')]);_0x14d791[_0xfe3e('0x39')]=_[_0xfe3e('0x3e')](_0x11403a[_0xfe3e('0x39')]);_0x14d791[_0xfe3e('0x96')]=_[_0xfe3e('0x40')](_0x14d791[_0xfe3e('0x3f')],_0x14d791['query']);_0x36fe44[_0xfe3e('0x41')]=_[_0xfe3e('0x40')](_0x14d791[_0xfe3e('0x3f')],qs[_0xfe3e('0x97')](_0x11403a[_0xfe3e('0x39')][_0xfe3e('0x97')]));_0x36fe44[_0xfe3e('0x41')]=_0x36fe44[_0xfe3e('0x41')][_0xfe3e('0x42')]?_0x36fe44[_0xfe3e('0x41')]:_0x14d791[_0xfe3e('0x3f')];if(!_0x11403a[_0xfe3e('0x39')][_0xfe3e('0xa2')](_0xfe3e('0xa3'))){_0x36fe44[_0xfe3e('0x22')]=qs[_0xfe3e('0x22')](_0x11403a['query'][_0xfe3e('0x22')]);_0x36fe44[_0xfe3e('0x24')]=qs[_0xfe3e('0x24')](_0x11403a[_0xfe3e('0x39')][_0xfe3e('0x24')]);}_0x36fe44[_0xfe3e('0xa4')]=qs['sort'](_0x11403a[_0xfe3e('0x39')][_0xfe3e('0xa5')]);_0x36fe44[_0xfe3e('0x98')]=qs[_0xfe3e('0x96')](_[_0xfe3e('0x99')](_0x11403a[_0xfe3e('0x39')],_0x14d791[_0xfe3e('0x96')]));_0x36fe44['where'][_0xfe3e('0x9a')]=_0xac14c['id'];if(_0x11403a[_0xfe3e('0x39')]['filter']){_0x36fe44['where']=_[_0xfe3e('0x2d')](_0x36fe44['where'],{'$or':_[_0xfe3e('0x31')](_0x36fe44['attributes'],function(_0x5a9d3a){var _0x60c60e={};_0x60c60e[_0x5a9d3a]={'$like':'%'+_0x11403a['query']['filter']+'%'};return _0x60c60e;})});}_0x36fe44[_0xfe3e('0x98')][_0xfe3e('0x8a')]=![];if(_0x11403a[_0xfe3e('0x39')]['id']){_0x36fe44[_0xfe3e('0x98')]['id']={'$gt':_0x11403a[_0xfe3e('0x39')]['id']};}_0x36fe44=_['merge']({},_0x36fe44,_0x11403a[_0xfe3e('0x43')]);return db[_0xfe3e('0x5c')][_0xfe3e('0x23')]({'where':_0x36fe44[_0xfe3e('0x98')]})[_0xfe3e('0x29')](function(_0x2155b1){_0x4ff548['count']=_0x2155b1;_0x36fe44[_0xfe3e('0xa0')]=[];if(_0x11403a[_0xfe3e('0x39')][_0xfe3e('0xa6')]){_0x36fe44[_0xfe3e('0xa0')][_0xfe3e('0xa7')]({'model':db['User'],'as':_0xfe3e('0x7d'),'attributes':['id',_0xfe3e('0x4f'),'alias']});}if(_0x11403a[_0xfe3e('0x39')][_0xfe3e('0x9f')]){_0x36fe44[_0xfe3e('0xa0')]=[{'all':!![]}];}return db[_0xfe3e('0x5c')]['findAll'](_0x36fe44);})['then'](function(_0x4b536a){_0x4ff548[_0xfe3e('0xa8')]=_0x4b536a;return _0x4ff548;});}})[_0xfe3e('0x29')](respondWithFilteredResult(_0x24782e,_0x36fe44))['catch'](handleError(_0x24782e,null));};exports[_0xfe3e('0xa9')]=function(_0x587fc6,_0x2157ac){return db['ChatInteraction'][_0xfe3e('0x44')]({'where':{'id':_0x587fc6[_0xfe3e('0x3c')]['id']}})[_0xfe3e('0x29')](handleEntityNotFound(_0x2157ac,null))['then'](function(_0xef12c8){if(_0xef12c8){return _0xef12c8['setTags'](_0x587fc6[_0xfe3e('0x2e')][_0xfe3e('0x93')],_[_0xfe3e('0x94')](_0x587fc6[_0xfe3e('0x2e')],[_0xfe3e('0x93'),'id'])||{})['spread'](function(){return db[_0xfe3e('0xaa')]['findAll']({'attributes':['id',_0xfe3e('0x2c'),_0xfe3e('0xab')],'where':{'id':_0x587fc6['body'][_0xfe3e('0x93')]}});})[_0xfe3e('0x29')](function(_0x1995f4){socket[_0xfe3e('0xac')]('chatInteractionTags:save',{'id':Number(_0x587fc6[_0xfe3e('0x3c')]['id']),'tags':_0x1995f4||[]});return{'id':Number(_0x587fc6['params']['id']),'tags':_0x1995f4||[]};});}})[_0xfe3e('0x29')](respondWithResult(_0x2157ac,null))[_0xfe3e('0x1d')](handleError(_0x2157ac,null));};exports['removeTags']=function(_0x4c2bef,_0x22763e){return db[_0xfe3e('0x32')][_0xfe3e('0x44')]({'where':{'id':_0x4c2bef['params']['id']}})[_0xfe3e('0x29')](handleEntityNotFound(_0x22763e,null))['then'](function(_0x6e9a59){if(_0x6e9a59){return _0x6e9a59[_0xfe3e('0xad')](_0x4c2bef[_0xfe3e('0x39')][_0xfe3e('0x93')]);}})[_0xfe3e('0x29')](respondWithStatusCode(_0x22763e,null))[_0xfe3e('0x1d')](handleError(_0x22763e,null));};exports['download']=function(_0x43135f,_0xa23212){var _0xaafedc=moment()['unix']()['toString']();var _0x59146c=path[_0xfe3e('0x71')](config[_0xfe3e('0x72')],'server',_0xfe3e('0xae'),'tmp');var _0x1134d2=path[_0xfe3e('0x71')](config[_0xfe3e('0x72')],_0xfe3e('0xaf'),_0xfe3e('0xae'),'attachments');var _0x3b7cde=path[_0xfe3e('0x71')](_0x59146c,_0xaafedc);var _0x196918=util[_0xfe3e('0x7f')](_0xfe3e('0xb0'),_0x43135f[_0xfe3e('0x3c')]['id'],_0xaafedc);var _0x213bee=path[_0xfe3e('0x71')](_0x59146c,_0x196918);var _0x4469a6=[];_0x4469a6[_0xfe3e('0xa7')]({'model':db[_0xfe3e('0x7d')],'as':_0xfe3e('0x7d'),'attributes':['id','fullname'],'raw':!![]});_0x4469a6['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x43135f[_0xfe3e('0x39')][_0xfe3e('0xb1')]){_0x4469a6[_0xfe3e('0xa7')]({'model':db['Attachment'],'as':_0xfe3e('0x6d'),'raw':!![]});}var _0x22dbf9=[{'model':db['ChatMessage'],'as':_0xfe3e('0x7c'),'attributes':['id',_0xfe3e('0x2e'),_0xfe3e('0xb2'),'direction','secret',_0xfe3e('0xb3')],'include':_0x4469a6}];_0x22dbf9[_0xfe3e('0xa7')]({'model':db[_0xfe3e('0x49')],'as':_0xfe3e('0xb4'),'attributes':['id',_0xfe3e('0x2c')]});_0x22dbf9[_0xfe3e('0xa7')]({'model':db[_0xfe3e('0x7d')],'as':_0xfe3e('0xb5'),'attributes':['id',_0xfe3e('0x4f')]});return db[_0xfe3e('0x32')][_0xfe3e('0x44')]({'where':{'id':_0x43135f[_0xfe3e('0x3c')]['id']},'include':_0x22dbf9})[_0xfe3e('0x29')](handleEntityNotFound(_0xa23212,null))[_0xfe3e('0x29')](function(_0x2a4a26){if(_0x2a4a26){var _0x297fa8=_0x2a4a26[_0xfe3e('0xb6')]({'plain':!![]});fs['mkdirSync'](_0x3b7cde);var _0x17a6e7={'channel':_0xfe3e('0xb7'),'account':_0x297fa8[_0xfe3e('0xb4')][_0xfe3e('0x2c')],'agent':_0x297fa8[_0xfe3e('0xb5')]?_0x297fa8[_0xfe3e('0xb5')][_0xfe3e('0x4f')]:_0xfe3e('0xb8'),'createdAt':moment(_0x297fa8[_0xfe3e('0xb2')])[_0xfe3e('0x7f')](_0xfe3e('0x9e'))['toString'](),'closedAt':_0x297fa8[_0xfe3e('0x65')]?moment(_0x297fa8[_0xfe3e('0xb9')])[_0xfe3e('0x7f')](_0xfe3e('0x9e'))[_0xfe3e('0xba')]():'','disposition':_0x297fa8['disposition'],'chatInfo':{'browser':_0x297fa8[_0xfe3e('0xbb')],'os':_0x297fa8[_0xfe3e('0xbc')],'referer':_0x297fa8[_0xfe3e('0xbd')],'customerIp':_0x297fa8[_0xfe3e('0xbe')],'customerPort':_0x297fa8[_0xfe3e('0xbf')]?_0x297fa8[_0xfe3e('0xbf')]:_0xfe3e('0xb8')},'messages':_(_0x297fa8[_0xfe3e('0x7c')])[_0xfe3e('0xc0')]()[_0xfe3e('0x9b')]({'secret':![]})[_0xfe3e('0x31')](function(_0x3038c1){if(_0x3038c1['Attachment']){var _0x1c074d=path[_0xfe3e('0x71')](_0x1134d2,_0x3038c1[_0xfe3e('0x6d')][_0xfe3e('0x6a')]);if(fs[_0xfe3e('0xc1')](_0x1c074d)){fs[_0xfe3e('0xc2')](_0x1c074d)[_0xfe3e('0xc3')](fs[_0xfe3e('0xc4')](path[_0xfe3e('0x71')](_0x3b7cde,_0x3038c1[_0xfe3e('0x6d')][_0xfe3e('0x6a')])));}}return{'date':moment(_0x3038c1[_0xfe3e('0xb2')])[_0xfe3e('0x7f')](_0xfe3e('0x9e'))[_0xfe3e('0xba')](),'sender':_0x3038c1[_0xfe3e('0xc5')]===_0xfe3e('0x5b')?_0x3038c1[_0xfe3e('0x7d')]?_0x3038c1[_0xfe3e('0x7d')][_0xfe3e('0x4f')]:_0xfe3e('0x82'):_0x3038c1['Contact'][_0xfe3e('0xc6')]+(_0x3038c1[_0xfe3e('0xc7')]['lastName']?'\x20'+_0x3038c1[_0xfe3e('0xc7')]['lastName']:''),'body':_0x3038c1[_0xfe3e('0x6d')]?_0x3038c1[_0xfe3e('0x6d')][_0xfe3e('0x6a')]:_0x3038c1[_0xfe3e('0x2e')],'direction':_0x3038c1[_0xfe3e('0xc5')]===_0xfe3e('0x5b')?'A':'C','secret':_0x3038c1['secret'],'read':_0x3038c1[_0xfe3e('0xb3')],'attachment':_0x3038c1[_0xfe3e('0x6d')]};})[_0xfe3e('0xc8')]()};return ejs[_0xfe3e('0xc9')](path['join'](config[_0xfe3e('0x72')],'server',_0xfe3e('0xca'),_0xfe3e('0xcb')),{'interaction':_0x17a6e7})[_0xfe3e('0x29')](function(_0x24f604){var _0x584a61=path['join'](_0x3b7cde,_0xfe3e('0xcc')+_0x297fa8['id']+'-'+_0xaafedc+_0xfe3e('0xcd'));var _0x5e0c8c={'path':_0x584a61,'channel':_0xfe3e('0xb7'),'interactionId':_0x297fa8['id']};return pdf[_0xfe3e('0xce')](_0x24f604,_0x5e0c8c);})[_0xfe3e('0x29')](function(){return new Promise(function(_0x236fc7,_0x37bb37){zipdir(_0x3b7cde,{'saveTo':_0x213bee},function(_0x3587d5,_0x4ba6f1){if(_0x3587d5)return _0x37bb37(_0x3587d5);return _0x236fc7(_0x4ba6f1);});})[_0xfe3e('0x29')](function(){return new BPromise(function(_0x206760,_0x39bc8c){rimraf(_0x3b7cde,function(_0x36a3cd){if(_0x36a3cd)_0x39bc8c(_0x36a3cd);return _0x206760();});});})['then'](function(){return _0xa23212['download'](_0x213bee,_0x196918,function(_0x1a09ea){if(_0x1a09ea){logger[_0xfe3e('0x19')]('err',_0x1a09ea);}else{fs[_0xfe3e('0xcf')](_0x213bee);}});});});}else{return _0xa23212[_0xfe3e('0x1e')](0xc8);}})['catch'](handleError(_0xa23212,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 49ab354..89c3e61 100644 --- a/server/api/chatInteraction/chatInteraction.events.js +++ b/server/api/chatInteraction/chatInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbabf=['map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','setDataValue'];(function(_0x40a726,_0x1664ff){var _0x3bcb60=function(_0x11aadd){while(--_0x11aadd){_0x40a726['push'](_0x40a726['shift']());}};_0x3bcb60(++_0x1664ff);}(_0xbabf,0xbd));var _0xfbab=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xbabf[_0xc4001c];return _0x49f7bc;};'use strict';var EventEmitter=require(_0xfbab('0x0'));var ChatInteraction=require(_0xfbab('0x1'))['db'][_0xfbab('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xfbab('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xfbab('0x4')](0x0);var events={'afterCreate':_0xfbab('0x5'),'afterUpdate':'update','afterDestroy':_0xfbab('0x6')};function emitEvent(_0x4138e7){return function(_0x5ccf8d,_0x257411,_0x4a39b4){_0x5ccf8d[_0xfbab('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x178932){_0x5ccf8d[_0xfbab('0x8')]('Users',_0x178932[_0xfbab('0x9')](function(_0x2182ce){return{'id':_0x2182ce['id']};}));return ChatMessage[_0xfbab('0xa')]({'where':{'ChatInteractionId':_0x5ccf8d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfbab('0xb')](function(_0x2226bb){_0x5ccf8d['setDataValue']('unreadMessages',_0x2226bb[_0xfbab('0xc')]);ChatInteractionEvents['emit'](_0x4138e7+':'+_0x5ccf8d['id'],_0x5ccf8d);ChatInteractionEvents[_0xfbab('0xd')](_0x4138e7,_0x5ccf8d);_0x4a39b4(null);})[_0xfbab('0xe')](_0x4a39b4(null));};}for(var e in events){if(events[_0xfbab('0xf')](e)){var event=events[e];ChatInteraction[_0xfbab('0x10')](e,emitEvent(event));}}module[_0xfbab('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xd879=['exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd879,0x122));var _0x9d87=function(_0x579bc4,_0x19f3a2){_0x579bc4=_0x579bc4-0x0;var _0x2505dc=_0xd879[_0x579bc4];return _0x2505dc;};'use strict';var EventEmitter=require(_0x9d87('0x0'));var ChatInteraction=require(_0x9d87('0x1'))['db'][_0x9d87('0x2')];var ChatMessage=require(_0x9d87('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9d87('0x3')](0x0);var events={'afterCreate':_0x9d87('0x4'),'afterUpdate':'update','afterDestroy':_0x9d87('0x5')};function emitEvent(_0x57d916){return function(_0x551a75,_0x3d0b5c,_0x476a7d){_0x551a75[_0x9d87('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4c2bb8){_0x551a75[_0x9d87('0x7')]('Users',_0x4c2bb8[_0x9d87('0x8')](function(_0x3e7a1b){return{'id':_0x3e7a1b['id']};}));return ChatMessage[_0x9d87('0x9')]({'where':{'ChatInteractionId':_0x551a75['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9d87('0xa')](function(_0x3c209d){_0x551a75[_0x9d87('0x7')](_0x9d87('0xb'),_0x3c209d[_0x9d87('0xc')]);ChatInteractionEvents[_0x9d87('0xd')](_0x57d916+':'+_0x551a75['id'],_0x551a75);ChatInteractionEvents[_0x9d87('0xd')](_0x57d916,_0x551a75);_0x476a7d(null);})[_0x9d87('0xe')](_0x476a7d(null));};}for(var e in events){if(events[_0x9d87('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x9d87('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index a80d4eb..66ad7a7 100644 --- a/server/api/chatInteraction/chatInteraction.model.js +++ b/server/api/chatInteraction/chatInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11b2=['rimraf','../../config/environment','exports','define','ChatInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x11b2,0x1a2));var _0x211b=function(_0x512363,_0x44048d){_0x512363=_0x512363-0x0;var _0x38d1fd=_0x11b2[_0x512363];return _0x38d1fd;};'use strict';var _=require(_0x211b('0x0'));var util=require(_0x211b('0x1'));var logger=require(_0x211b('0x2'))('api');var moment=require(_0x211b('0x3'));var BPromise=require(_0x211b('0x4'));var rp=require(_0x211b('0x5'));var fs=require('fs');var path=require(_0x211b('0x6'));var rimraf=require(_0x211b('0x7'));var config=require(_0x211b('0x8'));var attributes=require('./chatInteraction.attributes');module[_0x211b('0x9')]=function(_0x4ca473,_0x46795f){return _0x4ca473[_0x211b('0xa')](_0x211b('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x95ea11,_0x583e18,_0x33d673){if(_0x95ea11[_0x211b('0xc')](_0x211b('0xd'))){_0x95ea11[_0x211b('0xe')]=moment()['format'](_0x211b('0xf'));}_0x33d673(null,_0x95ea11);}},'charset':_0x211b('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x078a=['./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x078a,0x1d8));var _0xa078=function(_0x1e50b6,_0x15b74d){_0x1e50b6=_0x1e50b6-0x0;var _0xc4dcb3=_0x078a[_0x1e50b6];return _0xc4dcb3;};'use strict';var _=require('lodash');var util=require(_0xa078('0x0'));var logger=require(_0xa078('0x1'))(_0xa078('0x2'));var moment=require(_0xa078('0x3'));var BPromise=require('bluebird');var rp=require(_0xa078('0x4'));var fs=require('fs');var path=require(_0xa078('0x5'));var rimraf=require(_0xa078('0x6'));var config=require(_0xa078('0x7'));var attributes=require(_0xa078('0x8'));module['exports']=function(_0x548053,_0x4dbcab){return _0x548053[_0xa078('0x9')](_0xa078('0xa'),attributes,{'tableName':_0xa078('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4eeb21,_0xa5d146,_0x33cd9d){if(_0x4eeb21['changed'](_0xa078('0xc'))){_0x4eeb21['closedAt']=moment()[_0xa078('0xd')](_0xa078('0xe'));}_0x33cd9d(null,_0x4eeb21);}},'charset':_0xa078('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index c1e1c87..550c596 100644 --- a/server/api/chatInteraction/chatInteraction.rpc.js +++ b/server/api/chatInteraction/chatInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebce=['register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','attributes','limit','AddTagsToChatInteraction','find','where','body','omit','ids','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket'];(function(_0x49c481,_0x1f5ec5){var _0x58e5d3=function(_0x5f090d){while(--_0x5f090d){_0x49c481['push'](_0x49c481['shift']());}};_0x58e5d3(++_0x1f5ec5);}(_0xebce,0x118));var _0xeebc=function(_0x4a77e4,_0x556f71){_0x4a77e4=_0x4a77e4-0x0;var _0x1c68d8=_0xebce[_0x4a77e4];return _0x1c68d8;};'use strict';var _=require('lodash');var util=require(_0xeebc('0x0'));var moment=require(_0xeebc('0x1'));var BPromise=require(_0xeebc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeebc('0x3'));var db=require(_0xeebc('0x4'))['db'];var utils=require(_0xeebc('0x5'));var logger=require(_0xeebc('0x6'))('rpc');var config=require(_0xeebc('0x7'));var jayson=require(_0xeebc('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xeebc('0x9')]=_[_0xeebc('0xa')](config['redis'],{'host':_0xeebc('0xb'),'port':0x18eb});var socket=require(_0xeebc('0xc'))(new Redis(config[_0xeebc('0x9')]));require(_0xeebc('0xd'))[_0xeebc('0xe')](socket);function respondWithRpcPromise(_0x49286d,_0x3e8cfa,_0x4f22aa){return new BPromise(function(_0x52bd87,_0x56a0be){return client[_0xeebc('0xf')](_0x49286d,_0x4f22aa)[_0xeebc('0x10')](function(_0x20cf3c){logger[_0xeebc('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x3e8cfa,_0xeebc('0x12'));logger[_0xeebc('0x13')](_0xeebc('0x14'),_0x3e8cfa,_0xeebc('0x12'),JSON[_0xeebc('0x15')](_0x20cf3c));if(_0x20cf3c[_0xeebc('0x16')]){if(_0x20cf3c['error'][_0xeebc('0x17')]===0x1f4){logger[_0xeebc('0x16')](_0xeebc('0x18'),_0x3e8cfa,_0x20cf3c[_0xeebc('0x16')][_0xeebc('0x19')]);return _0x56a0be(_0x20cf3c[_0xeebc('0x16')]['message']);}logger['error'](_0xeebc('0x18'),_0x3e8cfa,_0x20cf3c[_0xeebc('0x16')][_0xeebc('0x19')]);return _0x52bd87(_0x20cf3c[_0xeebc('0x16')]['message']);}else{logger[_0xeebc('0x11')](_0xeebc('0x18'),_0x3e8cfa,_0xeebc('0x12'));_0x52bd87(_0x20cf3c[_0xeebc('0x1a')]['message']);}})[_0xeebc('0x1b')](function(_0x232845){logger[_0xeebc('0x16')](_0xeebc('0x18'),_0x3e8cfa,_0x232845);_0x56a0be(_0x232845);});});}exports[_0xeebc('0x1c')]=function(_0x428830){var _0x385395=this;return new Promise(function(_0x3c702f,_0x2c1acc){return db[_0xeebc('0x1d')][_0xeebc('0x1e')](_0x428830['body'],{'raw':_0x428830[_0xeebc('0x1f')]?_0x428830['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x428830[_0xeebc('0x1f')]?_0x428830['options']['where']||null:null,'attributes':_0x428830['options']?_0x428830['options'][_0xeebc('0x20')]||null:null,'limit':_0x428830[_0xeebc('0x1f')]?_0x428830[_0xeebc('0x1f')][_0xeebc('0x21')]||null:null})[_0xeebc('0x10')](function(_0x5ed569){logger[_0xeebc('0x11')](_0xeebc('0x1c'),_0x428830);logger['debug'](_0xeebc('0x1c'),_0x428830,JSON['stringify'](_0x5ed569));_0x3c702f(_0x5ed569);})[_0xeebc('0x1b')](function(_0x41c2b3){logger['error'](_0xeebc('0x1c'),_0x41c2b3[_0xeebc('0x19')],_0x428830);_0x2c1acc(_0x385395[_0xeebc('0x16')](0x1f4,_0x41c2b3[_0xeebc('0x19')]));});});};exports[_0xeebc('0x22')]=function(_0x37600c){return new Promise(function(_0x4f231c,_0x162244){return db[_0xeebc('0x1d')][_0xeebc('0x23')]({'where':_0x37600c[_0xeebc('0x1f')]?_0x37600c[_0xeebc('0x1f')][_0xeebc('0x24')]||null:null})[_0xeebc('0x10')](function(_0xa687fb){if(_0xa687fb){return _0xa687fb['addTags'](_0x37600c[_0xeebc('0x25')]['ids'],_[_0xeebc('0x26')](_0x37600c['body'],[_0xeebc('0x27'),'id'])||{});}})[_0xeebc('0x28')](function(_0xb1ad6b){logger[_0xeebc('0x11')]('AddTags',_0x37600c);logger['debug'](_0xeebc('0x29'),_0x37600c,JSON['stringify'](_0xb1ad6b));_0x4f231c(_0xb1ad6b);})[_0xeebc('0x1b')](function(_0x3850eb){logger['error'](_0xeebc('0x29'),_0x3850eb[_0xeebc('0x19')],_0x37600c);_0x162244(_this[_0xeebc('0x16')](0x1f4,_0x3850eb[_0xeebc('0x19')]));});});}; \ No newline at end of file +var _0x55db=['options','where','attributes','limit','then','debug','ChatInteraction','find','addTags','body','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','update','raw'];(function(_0x10356a,_0x526f4a){var _0x38d1e8=function(_0xcf1c17){while(--_0xcf1c17){_0x10356a['push'](_0x10356a['shift']());}};_0x38d1e8(++_0x526f4a);}(_0x55db,0x13a));var _0xb55d=function(_0xc2c13a,_0x1070d3){_0xc2c13a=_0xc2c13a-0x0;var _0x2b8e2f=_0x55db[_0xc2c13a];return _0x2b8e2f;};'use strict';var _=require('lodash');var util=require(_0xb55d('0x0'));var moment=require(_0xb55d('0x1'));var BPromise=require(_0xb55d('0x2'));var rs=require(_0xb55d('0x3'));var fs=require('fs');var Redis=require(_0xb55d('0x4'));var db=require(_0xb55d('0x5'))['db'];var utils=require(_0xb55d('0x6'));var logger=require(_0xb55d('0x7'))('rpc');var config=require(_0xb55d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb55d('0x9')][_0xb55d('0xa')]({'port':0x232a});config[_0xb55d('0xb')]=_[_0xb55d('0xc')](config['redis'],{'host':_0xb55d('0xd'),'port':0x18eb});var socket=require(_0xb55d('0xe'))(new Redis(config[_0xb55d('0xb')]));require(_0xb55d('0xf'))[_0xb55d('0x10')](socket);function respondWithRpcPromise(_0x174ef1,_0x3473c8,_0x28bf54){return new BPromise(function(_0x463d3,_0xd8f113){return client[_0xb55d('0x11')](_0x174ef1,_0x28bf54)['then'](function(_0x3d0f73){logger[_0xb55d('0x12')](_0xb55d('0x13'),_0x3473c8,_0xb55d('0x14'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3473c8,'request\x20sent',JSON[_0xb55d('0x15')](_0x3d0f73));if(_0x3d0f73[_0xb55d('0x16')]){if(_0x3d0f73[_0xb55d('0x16')][_0xb55d('0x17')]===0x1f4){logger[_0xb55d('0x16')](_0xb55d('0x13'),_0x3473c8,_0x3d0f73[_0xb55d('0x16')][_0xb55d('0x18')]);return _0xd8f113(_0x3d0f73[_0xb55d('0x16')][_0xb55d('0x18')]);}logger[_0xb55d('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x3473c8,_0x3d0f73[_0xb55d('0x16')][_0xb55d('0x18')]);return _0x463d3(_0x3d0f73[_0xb55d('0x16')][_0xb55d('0x18')]);}else{logger['info'](_0xb55d('0x13'),_0x3473c8,'request\x20sent');_0x463d3(_0x3d0f73[_0xb55d('0x19')]['message']);}})[_0xb55d('0x1a')](function(_0x331cd3){logger[_0xb55d('0x16')](_0xb55d('0x13'),_0x3473c8,_0x331cd3);_0xd8f113(_0x331cd3);});});}exports[_0xb55d('0x1b')]=function(_0x48477b){var _0x29d60f=this;return new Promise(function(_0xb5adbd,_0x297a9a){return db['ChatInteraction'][_0xb55d('0x1c')](_0x48477b['body'],{'raw':_0x48477b['options']?_0x48477b['options'][_0xb55d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48477b[_0xb55d('0x1e')]?_0x48477b[_0xb55d('0x1e')][_0xb55d('0x1f')]||null:null,'attributes':_0x48477b[_0xb55d('0x1e')]?_0x48477b[_0xb55d('0x1e')][_0xb55d('0x20')]||null:null,'limit':_0x48477b[_0xb55d('0x1e')]?_0x48477b['options'][_0xb55d('0x21')]||null:null})[_0xb55d('0x22')](function(_0x2b9d12){logger[_0xb55d('0x12')](_0xb55d('0x1b'),_0x48477b);logger[_0xb55d('0x23')](_0xb55d('0x1b'),_0x48477b,JSON[_0xb55d('0x15')](_0x2b9d12));_0xb5adbd(_0x2b9d12);})[_0xb55d('0x1a')](function(_0x25e963){logger['error'](_0xb55d('0x1b'),_0x25e963[_0xb55d('0x18')],_0x48477b);_0x297a9a(_0x29d60f[_0xb55d('0x16')](0x1f4,_0x25e963[_0xb55d('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x23ce21){return new Promise(function(_0x5a74fb,_0x2ae814){return db[_0xb55d('0x24')][_0xb55d('0x25')]({'where':_0x23ce21[_0xb55d('0x1e')]?_0x23ce21[_0xb55d('0x1e')][_0xb55d('0x1f')]||null:null})[_0xb55d('0x22')](function(_0x15a4e4){if(_0x15a4e4){return _0x15a4e4[_0xb55d('0x26')](_0x23ce21[_0xb55d('0x27')][_0xb55d('0x28')],_['omit'](_0x23ce21[_0xb55d('0x27')],[_0xb55d('0x28'),'id'])||{});}})[_0xb55d('0x29')](function(_0x1525ec){logger[_0xb55d('0x12')](_0xb55d('0x2a'),_0x23ce21);logger['debug'](_0xb55d('0x2a'),_0x23ce21,JSON[_0xb55d('0x15')](_0x1525ec));_0x5a74fb(_0x1525ec);})['catch'](function(_0x5a6115){logger[_0xb55d('0x16')](_0xb55d('0x2a'),_0x5a6115[_0xb55d('0x18')],_0x23ce21);_0x2ae814(_this['error'](0x1f4,_0x5a6115['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d782db7..4e20283 100644 --- a/server/api/chatInteraction/chatInteraction.socket.js +++ b/server/api/chatInteraction/chatInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f9b=['remove','update','emit','removeListener','register','length','chatInteraction:','save'];(function(_0x4183ea,_0xeb7bb3){var _0x3873e4=function(_0x40efd6){while(--_0x40efd6){_0x4183ea['push'](_0x4183ea['shift']());}};_0x3873e4(++_0xeb7bb3);}(_0x0f9b,0xd7));var _0xb0f9=function(_0x328b7a,_0x20d32c){_0x328b7a=_0x328b7a-0x0;var _0x22e45a=_0x0f9b[_0x328b7a];return _0x22e45a;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xb0f9('0x0'),_0xb0f9('0x1'),_0xb0f9('0x2')];function createListener(_0xd0ae53,_0x3ba07b){return function(_0x17d3f3){_0x3ba07b[_0xb0f9('0x3')](_0xd0ae53,_0x17d3f3);};}function removeListener(_0x5e5ebf,_0x16dd2){return function(){ChatInteractionEvents[_0xb0f9('0x4')](_0x5e5ebf,_0x16dd2);};}exports[_0xb0f9('0x5')]=function(_0x59efb3){for(var _0x1cdacb=0x0,_0x2dc803=events[_0xb0f9('0x6')];_0x1cdacb<_0x2dc803;_0x1cdacb++){var _0x58739e=events[_0x1cdacb];var _0x3ab299=createListener(_0xb0f9('0x7')+_0x58739e,_0x59efb3);ChatInteractionEvents['on'](_0x58739e,_0x3ab299);}}; \ No newline at end of file +var _0xb27d=['update','emit','removeListener','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x41d1b5,_0x1bad55){var _0x2ee95c=function(_0x254b00){while(--_0x254b00){_0x41d1b5['push'](_0x41d1b5['shift']());}};_0x2ee95c(++_0x1bad55);}(_0xb27d,0xe5));var _0xdb27=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb27d[_0x17d9e3];return _0x14192d;};'use strict';var ChatInteractionEvents=require(_0xdb27('0x0'));var events=[_0xdb27('0x1'),_0xdb27('0x2'),_0xdb27('0x3')];function createListener(_0x5f0cf3,_0x19c801){return function(_0x99d137){_0x19c801[_0xdb27('0x4')](_0x5f0cf3,_0x99d137);};}function removeListener(_0x206206,_0x202669){return function(){ChatInteractionEvents[_0xdb27('0x5')](_0x206206,_0x202669);};}exports['register']=function(_0x4ce81b){for(var _0x98c60=0x0,_0x589465=events[_0xdb27('0x6')];_0x98c60<_0x589465;_0x98c60++){var _0x1b944c=events[_0x98c60];var _0x2772ad=createListener(_0xdb27('0x7')+_0x1b944c,_0x4ce81b);ChatInteractionEvents['on'](_0x1b944c,_0x2772ad);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 7de1e72..987a6bc 100644 --- a/server/api/chatInteraction/index.js +++ b/server/api/chatInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x942d=['file','attachmentUpload','addMessage','chat','chatinteraction:addtags','put','tracked','chatinteraction:update','update','/:id/custom_update','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMyMessages','download','post','create','/:id/vidaoo','diskStorage','join','root','format','now','originalname','replace','/:id/attachment_upload','single'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x942d,0xe2));var _0xd942=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x942d[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0xd942('0x0'));var util=require(_0xd942('0x1'));var path=require('path');var timeout=require(_0xd942('0x2'));var express=require(_0xd942('0x3'));var router=express[_0xd942('0x4')]();var fs_extra=require(_0xd942('0x5'));var auth=require(_0xd942('0x6'));var interaction=require(_0xd942('0x7'));var config=require(_0xd942('0x8'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0xd942('0x9')](),controller[_0xd942('0xa')]);router[_0xd942('0xb')](_0xd942('0xc'),auth[_0xd942('0x9')](),controller[_0xd942('0xd')]);router['get'](_0xd942('0xe'),auth[_0xd942('0xf')](),controller[_0xd942('0x10')]);router[_0xd942('0xb')](_0xd942('0x11'),auth[_0xd942('0xf')](),controller[_0xd942('0x12')]);router[_0xd942('0xb')](_0xd942('0x13'),auth[_0xd942('0x9')](),controller['getMessages']);router[_0xd942('0xb')]('/:id/my_messages',auth[_0xd942('0xf')](),controller[_0xd942('0x14')]);router[_0xd942('0xb')]('/:id/download',auth[_0xd942('0x9')](),controller[_0xd942('0x15')]);router[_0xd942('0x16')]('/',auth[_0xd942('0x9')](),controller[_0xd942('0x17')]);router['post'](_0xd942('0x18'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xd942('0x19')]({'destination':function(_0x17c6b4,_0x1f7d59,_0x3de292){_0x3de292(null,path[_0xd942('0x1a')](config[_0xd942('0x1b')],'server/files/attachments/'));},'filename':function(_0x22f6f1,_0x5a5612,_0xf423b9){_0xf423b9(null,util[_0xd942('0x1c')]('%s-%s',Date[_0xd942('0x1d')](),_0x5a5612[_0xd942('0x1e')][_0xd942('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd942('0x16')](_0xd942('0x20'),upload[_0xd942('0x21')](_0xd942('0x22')),controller[_0xd942('0x23')]);router[_0xd942('0x16')]('/:id/messages',auth[_0xd942('0xf')](),controller[_0xd942('0x24')]);router[_0xd942('0x16')]('/:id/tags',auth[_0xd942('0x9')](),interaction['tracked'](_0xd942('0x25'),_0xd942('0x26')),controller['addTags']);router[_0xd942('0x27')](_0xd942('0xe'),auth[_0xd942('0x9')](),interaction[_0xd942('0x28')](_0xd942('0x25'),_0xd942('0x29')),controller[_0xd942('0x2a')]);router[_0xd942('0x27')](_0xd942('0x2b'),controller['customUpdate']);router[_0xd942('0x27')]('/:id/abandon',auth[_0xd942('0xf')](),controller[_0xd942('0x2c')]);router[_0xd942('0x27')](_0xd942('0x2d'),controller[_0xd942('0x2e')]);router[_0xd942('0x2f')](_0xd942('0xe'),auth[_0xd942('0x9')](),interaction['tracked'](_0xd942('0x25'),_0xd942('0x30')),controller[_0xd942('0x31')]);router[_0xd942('0x2f')](_0xd942('0x32'),auth[_0xd942('0x9')](),controller['removeTags']);module[_0xd942('0x33')]=router; \ No newline at end of file +var _0x5e62=['isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/download','download','post','create','diskStorage','server/files/attachments/','%s-%s','now','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','chatinteraction:update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0xd6fcb5,_0x526523){var _0x278ac7=function(_0x3a9512){while(--_0x3a9512){_0xd6fcb5['push'](_0xd6fcb5['shift']());}};_0x278ac7(++_0x526523);}(_0x5e62,0x1d3));var _0x25e6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5e62[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require(_0x25e6('0x0'));var path=require(_0x25e6('0x1'));var timeout=require(_0x25e6('0x2'));var express=require(_0x25e6('0x3'));var router=express['Router']();var fs_extra=require(_0x25e6('0x4'));var auth=require(_0x25e6('0x5'));var interaction=require(_0x25e6('0x6'));var config=require(_0x25e6('0x7'));var controller=require('./chatInteraction.controller');router[_0x25e6('0x8')]('/',auth[_0x25e6('0x9')](),controller['index']);router[_0x25e6('0x8')](_0x25e6('0xa'),auth[_0x25e6('0x9')](),controller[_0x25e6('0xb')]);router[_0x25e6('0x8')](_0x25e6('0xc'),auth[_0x25e6('0xd')](),controller[_0x25e6('0xe')]);router[_0x25e6('0x8')](_0x25e6('0xf'),auth[_0x25e6('0xd')](),controller[_0x25e6('0x10')]);router[_0x25e6('0x8')](_0x25e6('0x11'),auth[_0x25e6('0x9')](),controller[_0x25e6('0x12')]);router[_0x25e6('0x8')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x25e6('0x8')](_0x25e6('0x13'),auth[_0x25e6('0x9')](),controller[_0x25e6('0x14')]);router[_0x25e6('0x15')]('/',auth[_0x25e6('0x9')](),controller[_0x25e6('0x16')]);router[_0x25e6('0x15')]('/:id/vidaoo',auth[_0x25e6('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x25e6('0x17')]({'destination':function(_0x153def,_0x22d19a,_0x263060){_0x263060(null,path['join'](config['root'],_0x25e6('0x18')));},'filename':function(_0x418134,_0x23260b,_0x4a3908){_0x4a3908(null,util['format'](_0x25e6('0x19'),Date[_0x25e6('0x1a')](),_0x23260b['originalname'][_0x25e6('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x25e6('0x1c'),upload['single'](_0x25e6('0x1d')),controller[_0x25e6('0x1e')]);router['post'](_0x25e6('0x11'),auth[_0x25e6('0xd')](),controller[_0x25e6('0x1f')]);router[_0x25e6('0x15')](_0x25e6('0x20'),auth['isAuthenticated'](),interaction[_0x25e6('0x21')](_0x25e6('0x22'),_0x25e6('0x23')),controller['addTags']);router['put'](_0x25e6('0xc'),auth[_0x25e6('0x9')](),interaction[_0x25e6('0x21')]('chat',_0x25e6('0x24')),controller['update']);router[_0x25e6('0x25')](_0x25e6('0x26'),controller[_0x25e6('0x27')]);router['put'](_0x25e6('0x28'),auth[_0x25e6('0xd')](),controller[_0x25e6('0x29')]);router[_0x25e6('0x25')](_0x25e6('0x2a'),controller[_0x25e6('0x2b')]);router[_0x25e6('0x2c')](_0x25e6('0xc'),auth[_0x25e6('0x9')](),interaction[_0x25e6('0x21')](_0x25e6('0x22'),'chatinteraction:destroy'),controller[_0x25e6('0x2d')]);router[_0x25e6('0x2c')](_0x25e6('0x20'),auth[_0x25e6('0x9')](),controller[_0x25e6('0x2e')]);module[_0x25e6('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 7200730..d415e3f 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6121=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x4a2183,_0x53e74d){var _0xc7c01d=function(_0x526d67){while(--_0x526d67){_0x4a2183['push'](_0x4a2183['shift']());}};_0xc7c01d(++_0x53e74d);}(_0x6121,0x1b5));var _0x1612=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6121[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x1612('0x0'));module[_0x1612('0x1')]={'body':{'type':Sequelize[_0x1612('0x2')](_0x1612('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1612('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1612('0x5')]}}; \ No newline at end of file +var _0x1662=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x1662,0x189));var _0x2166=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1662[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x2166('0x0'));module[_0x2166('0x1')]={'body':{'type':Sequelize[_0x2166('0x2')](_0x2166('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2166('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x2166('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index a59c331..0d5ec5c 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.controller.js +++ b/server/api/chatInternalMessage/chatInternalMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9708=['format','getUsers','agent','admin','user','fullname','lastLoginAt','allowmessenger','showWebBar','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','isEmpty','push','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','name','send','index','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','map','type','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','find','create','body','destroy','params','describe','messages','createdAt','lastMessageAt'];(function(_0x416bb4,_0x3e9428){var _0x27ddf6=function(_0x41eb9f){while(--_0x41eb9f){_0x416bb4['push'](_0x416bb4['shift']());}};_0x27ddf6(++_0x3e9428);}(_0x9708,0x14d));var _0x8970=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x9708[_0x100682];return _0xcb6e87;};'use strict';var emlformat=require(_0x8970('0x0'));var rimraf=require(_0x8970('0x1'));var zipdir=require(_0x8970('0x2'));var jsonpatch=require(_0x8970('0x3'));var rp=require(_0x8970('0x4'));var moment=require(_0x8970('0x5'));var BPromise=require(_0x8970('0x6'));var Mustache=require(_0x8970('0x7'));var util=require(_0x8970('0x8'));var path=require('path');var sox=require(_0x8970('0x9'));var csv=require(_0x8970('0xa'));var ejs=require(_0x8970('0xb'));var fs=require('fs');var fs_extra=require(_0x8970('0xc'));var _=require(_0x8970('0xd'));var squel=require(_0x8970('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8970('0xf'));var toCsv=require(_0x8970('0xa'));var querystring=require(_0x8970('0x10'));var Papa=require(_0x8970('0x11'));var Redis=require(_0x8970('0x12'));var authService=require(_0x8970('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8970('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8970('0x15'))(_0x8970('0x16'));var utils=require(_0x8970('0x17'));var config=require(_0x8970('0x18'));var licenseUtil=require(_0x8970('0x19'));var db=require(_0x8970('0x1a'))['db'];config[_0x8970('0x1b')]=_[_0x8970('0x1c')](config['redis'],{'host':_0x8970('0x1d'),'port':0x18eb});var socket=require(_0x8970('0x1e'))(new Redis(config[_0x8970('0x1b')]));require(_0x8970('0x1f'))[_0x8970('0x20')](socket);function respondWithStatusCode(_0x23e152,_0x513719){_0x513719=_0x513719||0xcc;return function(_0x540981){if(_0x540981){return _0x23e152[_0x8970('0x21')](_0x513719);}return _0x23e152[_0x8970('0x22')](_0x513719)[_0x8970('0x23')]();};}function respondWithResult(_0x149fdb,_0xe74c6b){_0xe74c6b=_0xe74c6b||0xc8;return function(_0x30418f){if(_0x30418f){return _0x149fdb[_0x8970('0x22')](_0xe74c6b)['json'](_0x30418f);}};}function respondWithFilteredResult(_0x32dc12,_0x485f42){return function(_0x1abd90){if(_0x1abd90){var _0x57fc41=typeof _0x485f42[_0x8970('0x24')]===_0x8970('0x25')&&typeof _0x485f42[_0x8970('0x26')]===_0x8970('0x25');var _0x536c25=_0x1abd90[_0x8970('0x27')];var _0x2155cd=_0x57fc41?0x0:_0x485f42[_0x8970('0x24')];var _0x32871e=_0x57fc41?_0x1abd90[_0x8970('0x27')]:_0x485f42[_0x8970('0x24')]+_0x485f42['limit'];var _0x1b46fa;if(_0x32871e>=_0x536c25){_0x32871e=_0x536c25;_0x1b46fa=0xc8;}else{_0x1b46fa=0xce;}_0x32dc12[_0x8970('0x22')](_0x1b46fa);return _0x32dc12['set'](_0x8970('0x28'),_0x2155cd+'-'+_0x32871e+'/'+_0x536c25)['json'](_0x1abd90);}return null;};}function patchUpdates(_0x350d51){return function(_0x5675ea){try{jsonpatch['apply'](_0x5675ea,_0x350d51,!![]);}catch(_0x5b4cb7){return BPromise[_0x8970('0x29')](_0x5b4cb7);}return _0x5675ea[_0x8970('0x2a')]();};}function saveUpdates(_0x1f39f4,_0x361d5e){return function(_0x593a25){if(_0x593a25){return _0x593a25[_0x8970('0x2b')](_0x1f39f4)['then'](function(_0x1eaa52){return _0x1eaa52;});}return null;};}function removeEntity(_0x572f0b,_0x67ebef){return function(_0x2fd3cf){if(_0x2fd3cf){return _0x2fd3cf['destroy']()[_0x8970('0x2c')](function(){_0x572f0b[_0x8970('0x22')](0xcc)[_0x8970('0x23')]();});}};}function handleEntityNotFound(_0x3e9d6c,_0x52dd03){return function(_0x344404){if(!_0x344404){_0x3e9d6c['sendStatus'](0x194);}return _0x344404;};}function handleError(_0x1f2c09,_0x317e33){_0x317e33=_0x317e33||0x1f4;return function(_0x1fb90b){logger[_0x8970('0x2d')](_0x1fb90b['stack']);if(_0x1fb90b[_0x8970('0x2e')]){delete _0x1fb90b['name'];}_0x1f2c09[_0x8970('0x22')](_0x317e33)[_0x8970('0x2f')](_0x1fb90b);};}exports[_0x8970('0x30')]=function(_0x32aab6,_0x4b7f5a){var _0x356e53={},_0x5b17a6={},_0x4cdc63={'count':0x0,'rows':[]};var _0x5e205d=_['map'](db['ChatInternalMessage'][_0x8970('0x31')],function(_0x498076){return{'name':_0x498076[_0x8970('0x32')],'type':_0x498076['type']['key']};});_0x5b17a6[_0x8970('0x33')]=_['map'](_0x5e205d,_0x8970('0x2e'));_0x5b17a6[_0x8970('0x34')]=_[_0x8970('0x35')](_0x32aab6['query']);_0x5b17a6['filters']=_[_0x8970('0x36')](_0x5b17a6[_0x8970('0x33')],_0x5b17a6[_0x8970('0x34')]);_0x356e53['attributes']=_[_0x8970('0x36')](_0x5b17a6['model'],qs[_0x8970('0x37')](_0x32aab6[_0x8970('0x34')]['fields']));_0x356e53[_0x8970('0x38')]=_0x356e53[_0x8970('0x38')][_0x8970('0x39')]?_0x356e53[_0x8970('0x38')]:_0x5b17a6[_0x8970('0x33')];if(!_0x32aab6['query']['hasOwnProperty']('nolimit')){_0x356e53['limit']=qs[_0x8970('0x26')](_0x32aab6['query'][_0x8970('0x26')]);_0x356e53[_0x8970('0x24')]=qs[_0x8970('0x24')](_0x32aab6[_0x8970('0x34')][_0x8970('0x24')]);}_0x356e53['order']=qs[_0x8970('0x3a')](_0x32aab6[_0x8970('0x34')][_0x8970('0x3a')]);_0x356e53[_0x8970('0x3b')]=qs[_0x8970('0x3c')](_[_0x8970('0x3d')](_0x32aab6[_0x8970('0x34')],_0x5b17a6[_0x8970('0x3c')]),_0x5e205d);if(_0x32aab6[_0x8970('0x34')][_0x8970('0x3e')]){_0x356e53[_0x8970('0x3b')]=_[_0x8970('0x3f')](_0x356e53[_0x8970('0x3b')],{'$or':_[_0x8970('0x40')](_0x5e205d,function(_0x4a9683){if(_0x4a9683[_0x8970('0x41')]!=='VIRTUAL'){var _0x32f810={};_0x32f810[_0x4a9683[_0x8970('0x2e')]]={'$like':'%'+_0x32aab6[_0x8970('0x34')][_0x8970('0x3e')]+'%'};return _0x32f810;}})});}_0x356e53=_['merge']({},_0x356e53,_0x32aab6[_0x8970('0x42')]);var _0xb9c3dc={'where':_0x356e53[_0x8970('0x3b')]};return db[_0x8970('0x43')]['count'](_0xb9c3dc)[_0x8970('0x2c')](function(_0x221aa6){_0x4cdc63[_0x8970('0x27')]=_0x221aa6;if(_0x32aab6[_0x8970('0x34')][_0x8970('0x44')]){_0x356e53[_0x8970('0x45')]=[{'all':!![]}];}return db[_0x8970('0x43')][_0x8970('0x46')](_0x356e53);})[_0x8970('0x2c')](function(_0x52e475){_0x4cdc63[_0x8970('0x47')]=_0x52e475;return _0x4cdc63;})[_0x8970('0x2c')](respondWithFilteredResult(_0x4b7f5a,_0x356e53))[_0x8970('0x48')](handleError(_0x4b7f5a,null));};exports[_0x8970('0x49')]=function(_0x4b322f,_0x1a7a8a){var _0x1eb453={'raw':!![],'where':{'id':_0x4b322f['params']['id']}},_0x32874c={};_0x32874c[_0x8970('0x33')]=_[_0x8970('0x35')](db[_0x8970('0x43')]['rawAttributes']);_0x32874c[_0x8970('0x34')]=_['keys'](_0x4b322f[_0x8970('0x34')]);_0x32874c[_0x8970('0x3c')]=_[_0x8970('0x36')](_0x32874c['model'],_0x32874c['query']);_0x1eb453[_0x8970('0x38')]=_[_0x8970('0x36')](_0x32874c['model'],qs['fields'](_0x4b322f[_0x8970('0x34')][_0x8970('0x37')]));_0x1eb453[_0x8970('0x38')]=_0x1eb453[_0x8970('0x38')]['length']?_0x1eb453[_0x8970('0x38')]:_0x32874c[_0x8970('0x33')];if(_0x4b322f['query'][_0x8970('0x44')]){_0x1eb453[_0x8970('0x45')]=[{'all':!![]}];}_0x1eb453=_[_0x8970('0x3f')]({},_0x1eb453,_0x4b322f[_0x8970('0x42')]);return db[_0x8970('0x43')][_0x8970('0x4a')](_0x1eb453)[_0x8970('0x2c')](handleEntityNotFound(_0x1a7a8a,null))[_0x8970('0x2c')](respondWithResult(_0x1a7a8a,null))[_0x8970('0x48')](handleError(_0x1a7a8a,null));};exports['create']=function(_0x3a155b,_0x4e028a){return db[_0x8970('0x43')][_0x8970('0x4b')](_0x3a155b[_0x8970('0x4c')],{})[_0x8970('0x2c')](respondWithResult(_0x4e028a,0xc9))[_0x8970('0x48')](handleError(_0x4e028a,null));};exports[_0x8970('0x2b')]=function(_0x370633,_0x35e5a0){if(_0x370633[_0x8970('0x4c')]['id']){delete _0x370633[_0x8970('0x4c')]['id'];}return db['ChatInternalMessage'][_0x8970('0x4a')]({'where':{'id':_0x370633['params']['id']}})[_0x8970('0x2c')](handleEntityNotFound(_0x35e5a0,null))[_0x8970('0x2c')](saveUpdates(_0x370633[_0x8970('0x4c')],null))['then'](respondWithResult(_0x35e5a0,null))['catch'](handleError(_0x35e5a0,null));};exports[_0x8970('0x4d')]=function(_0x2412f4,_0x26db24){return db[_0x8970('0x43')][_0x8970('0x4a')]({'where':{'id':_0x2412f4[_0x8970('0x4e')]['id']}})[_0x8970('0x2c')](handleEntityNotFound(_0x26db24,null))[_0x8970('0x2c')](removeEntity(_0x26db24,null))[_0x8970('0x48')](handleError(_0x26db24,null));};exports['describe']=function(_0x49f5be,_0xea9f72){return db[_0x8970('0x43')][_0x8970('0x4f')]()['then'](respondWithResult(_0xea9f72,null))[_0x8970('0x48')](handleError(_0xea9f72,null));};function wrapUser(_0x226110){return function(_0x194636){var _0x195a02=_0x226110['get']({'plain':!![]});_0x195a02[_0x8970('0x50')]=[];if(_0x194636){_0x195a02['lastMessageAt']=_0x194636[_0x8970('0x51')];_0x195a02['lastMessage']=_0x194636;}else{_0x195a02[_0x8970('0x52')]=moment(0x0)[_0x8970('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x195a02['lastMessage']={};}return _0x195a02;};}exports[_0x8970('0x54')]=function(_0x5f4e9e,_0x46e7a3,_0x77879f){var _0x338cec=[];return db['User'][_0x8970('0x46')]({'where':{'role':[_0x8970('0x55'),_0x8970('0x56'),_0x8970('0x57')]},'attributes':['id',_0x8970('0x58'),_0x8970('0x2e'),'role','userpic','internal','online',_0x8970('0x59'),_0x8970('0x5a'),_0x8970('0x5b')],'order':qs[_0x8970('0x3a')]('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id','name',_0x8970('0x41')],'through':{'attributes':[]}}]})[_0x8970('0x2c')](function(_0x45be82){if(_0x45be82){var _0x2adf9c=_0x5f4e9e[_0x8970('0x57')][_0x8970('0x5c')]({'plain':!![]});if(!_0x2adf9c)throw new Error(_0x8970('0x5d'));if(_0x2adf9c[_0x8970('0x5e')]===_0x8970('0x57')){return db[_0x8970('0x5f')][_0x8970('0x4a')]({'where':{'name':_0x8970('0x60'),'userProfileId':_0x2adf9c[_0x8970('0x61')]},'raw':!![]})[_0x8970('0x2c')](function(_0x2950f4){if(_0x2950f4){if(_0x2950f4['autoAssociation']===0x0){return db['UserProfileResource'][_0x8970('0x46')]({'where':{'sectionId':_0x2950f4['id']},'raw':!![]})[_0x8970('0x2c')](function(_0x8eb506){var _0x6ab893=[];if(_[_0x8970('0x62')](_0x8eb506)){_0x6ab893=_[_0x8970('0x3e')](_0x45be82,function(_0x451d97){if(_0x451d97[_0x8970('0x5e')]!=='agent'){return _0x451d97;}});return _0x6ab893;}else{for(var _0x12ef43=0x0;_0x12ef43<_0x45be82['length'];_0x12ef43++){var _0x18227a=_0x45be82[_0x12ef43];if(_0x18227a[_0x8970('0x5e')]==='agent'){var _0x2042bf=_[_0x8970('0x4a')](_0x8eb506,function(_0x1033f3){return _0x1033f3['resourceId']===_0x18227a['id'];});if(_0x2042bf)_0x6ab893[_0x8970('0x63')](_0x18227a);}else{_0x6ab893[_0x8970('0x63')](_0x18227a);}}return _0x6ab893;}});}else{return _0x45be82;}}else{var _0x58e892=_[_0x8970('0x3e')](_0x45be82,function(_0x509023){if(_0x509023[_0x8970('0x5e')]!==_0x8970('0x55')){return _0x509023;}});return _0x58e892;}});}else{return _0x45be82;}}})[_0x8970('0x2c')](function(_0x23c076){var _0x444a6e=[];if(_0x23c076){_0x338cec=_0x23c076;for(var _0x2ce70f=0x0;_0x2ce70f<_0x23c076[_0x8970('0x39')];_0x2ce70f+=0x1){_0x338cec[_0x2ce70f]['messages']=[];_0x444a6e[_0x8970('0x63')](db[_0x8970('0x43')][_0x8970('0x4a')]({'where':{'FromId':[_0x5f4e9e[_0x8970('0x57')]['id'],_0x23c076[_0x2ce70f]['id']],'ToId':[_0x5f4e9e['user']['id'],_0x23c076[_0x2ce70f]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x8970('0x64'),_0x8970('0x65'),_0x8970('0x4c')],'order':qs[_0x8970('0x3a')](_0x8970('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x23c076[_0x2ce70f])));}return BPromise[_0x8970('0x67')](_0x444a6e);}return[];})[_0x8970('0x2c')](function(_0x330a2e){return{'rows':_0x330a2e,'count':_0x330a2e[_0x8970('0x39')]};})[_0x8970('0x2c')](respondWithResult(_0x46e7a3,null))[_0x8970('0x48')](handleError(_0x46e7a3,null));}; \ No newline at end of file +var _0x1d9f=['findAll','rows','catch','show','params','keys','options','find','create','body','describe','get','messages','lastMessageAt','lastMessage','format','getUsers','agent','admin','fullname','role','userpic','online','lastLoginAt','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','autoAssociation','isEmpty','resourceId','push','createdAt','FromId','ToId','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','undefined','limit','count','offset','json','apply','save','update','then','destroy','name','send','index','map','ChatInternalMessage','fieldName','type','model','filters','intersection','attributes','query','fields','length','nolimit','order','sort','where','pick','filter','merge','include'];(function(_0x28f0b6,_0x290a14){var _0x44156e=function(_0x4e57de){while(--_0x4e57de){_0x28f0b6['push'](_0x28f0b6['shift']());}};_0x44156e(++_0x290a14);}(_0x1d9f,0x158));var _0xf1d9=function(_0x51b474,_0x152542){_0x51b474=_0x51b474-0x0;var _0x29e5ea=_0x1d9f[_0x51b474];return _0x29e5ea;};'use strict';var emlformat=require(_0xf1d9('0x0'));var rimraf=require(_0xf1d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf1d9('0x2'));var rp=require('request-promise');var moment=require(_0xf1d9('0x3'));var BPromise=require(_0xf1d9('0x4'));var Mustache=require(_0xf1d9('0x5'));var util=require(_0xf1d9('0x6'));var path=require(_0xf1d9('0x7'));var sox=require(_0xf1d9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1d9('0x9'));var _=require(_0xf1d9('0xa'));var squel=require(_0xf1d9('0xb'));var crypto=require('crypto');var jsforce=require(_0xf1d9('0xc'));var deskjs=require(_0xf1d9('0xd'));var toCsv=require(_0xf1d9('0xe'));var querystring=require(_0xf1d9('0xf'));var Papa=require(_0xf1d9('0x10'));var Redis=require(_0xf1d9('0x11'));var authService=require(_0xf1d9('0x12'));var qs=require(_0xf1d9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1d9('0x14'));var logger=require('../../config/logger')(_0xf1d9('0x15'));var utils=require(_0xf1d9('0x16'));var config=require(_0xf1d9('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf1d9('0x18')](config[_0xf1d9('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf1d9('0x1a'))(new Redis(config['redis']));require(_0xf1d9('0x1b'))[_0xf1d9('0x1c')](socket);function respondWithStatusCode(_0x81621d,_0x43b8b4){_0x43b8b4=_0x43b8b4||0xcc;return function(_0x1a321d){if(_0x1a321d){return _0x81621d[_0xf1d9('0x1d')](_0x43b8b4);}return _0x81621d[_0xf1d9('0x1e')](_0x43b8b4)[_0xf1d9('0x1f')]();};}function respondWithResult(_0x1e32e9,_0x40a1dd){_0x40a1dd=_0x40a1dd||0xc8;return function(_0x23a7d5){if(_0x23a7d5){return _0x1e32e9[_0xf1d9('0x1e')](_0x40a1dd)['json'](_0x23a7d5);}};}function respondWithFilteredResult(_0x4e311f,_0x27ed00){return function(_0xfa6be1){if(_0xfa6be1){var _0x50530c=typeof _0x27ed00['offset']===_0xf1d9('0x20')&&typeof _0x27ed00[_0xf1d9('0x21')]===_0xf1d9('0x20');var _0x521558=_0xfa6be1[_0xf1d9('0x22')];var _0x1e1a78=_0x50530c?0x0:_0x27ed00[_0xf1d9('0x23')];var _0x52fc28=_0x50530c?_0xfa6be1['count']:_0x27ed00[_0xf1d9('0x23')]+_0x27ed00[_0xf1d9('0x21')];var _0x26776f;if(_0x52fc28>=_0x521558){_0x52fc28=_0x521558;_0x26776f=0xc8;}else{_0x26776f=0xce;}_0x4e311f['status'](_0x26776f);return _0x4e311f['set']('Content-Range',_0x1e1a78+'-'+_0x52fc28+'/'+_0x521558)[_0xf1d9('0x24')](_0xfa6be1);}return null;};}function patchUpdates(_0x95dec8){return function(_0x2c1d5e){try{jsonpatch[_0xf1d9('0x25')](_0x2c1d5e,_0x95dec8,!![]);}catch(_0x2a8fb2){return BPromise['reject'](_0x2a8fb2);}return _0x2c1d5e[_0xf1d9('0x26')]();};}function saveUpdates(_0x383a4b,_0x1a3b7a){return function(_0x20a3dc){if(_0x20a3dc){return _0x20a3dc[_0xf1d9('0x27')](_0x383a4b)[_0xf1d9('0x28')](function(_0x247bdc){return _0x247bdc;});}return null;};}function removeEntity(_0x1062c4,_0x109bbd){return function(_0x1c4d86){if(_0x1c4d86){return _0x1c4d86[_0xf1d9('0x29')]()[_0xf1d9('0x28')](function(){_0x1062c4[_0xf1d9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe56a90,_0x5b4c77){return function(_0x26b643){if(!_0x26b643){_0xe56a90[_0xf1d9('0x1d')](0x194);}return _0x26b643;};}function handleError(_0x455500,_0x1eea39){_0x1eea39=_0x1eea39||0x1f4;return function(_0x144e68){logger['error'](_0x144e68['stack']);if(_0x144e68[_0xf1d9('0x2a')]){delete _0x144e68['name'];}_0x455500[_0xf1d9('0x1e')](_0x1eea39)[_0xf1d9('0x2b')](_0x144e68);};}exports[_0xf1d9('0x2c')]=function(_0x159f78,_0x14fbfd){var _0xb63ef2={},_0x52ecf7={},_0x476c4f={'count':0x0,'rows':[]};var _0xc0ccd2=_[_0xf1d9('0x2d')](db[_0xf1d9('0x2e')]['rawAttributes'],function(_0xfcc87b){return{'name':_0xfcc87b[_0xf1d9('0x2f')],'type':_0xfcc87b[_0xf1d9('0x30')]['key']};});_0x52ecf7[_0xf1d9('0x31')]=_[_0xf1d9('0x2d')](_0xc0ccd2,_0xf1d9('0x2a'));_0x52ecf7['query']=_['keys'](_0x159f78['query']);_0x52ecf7[_0xf1d9('0x32')]=_[_0xf1d9('0x33')](_0x52ecf7[_0xf1d9('0x31')],_0x52ecf7['query']);_0xb63ef2[_0xf1d9('0x34')]=_[_0xf1d9('0x33')](_0x52ecf7['model'],qs['fields'](_0x159f78[_0xf1d9('0x35')][_0xf1d9('0x36')]));_0xb63ef2['attributes']=_0xb63ef2[_0xf1d9('0x34')][_0xf1d9('0x37')]?_0xb63ef2[_0xf1d9('0x34')]:_0x52ecf7[_0xf1d9('0x31')];if(!_0x159f78[_0xf1d9('0x35')]['hasOwnProperty'](_0xf1d9('0x38'))){_0xb63ef2['limit']=qs[_0xf1d9('0x21')](_0x159f78[_0xf1d9('0x35')][_0xf1d9('0x21')]);_0xb63ef2[_0xf1d9('0x23')]=qs[_0xf1d9('0x23')](_0x159f78[_0xf1d9('0x35')][_0xf1d9('0x23')]);}_0xb63ef2[_0xf1d9('0x39')]=qs['sort'](_0x159f78['query'][_0xf1d9('0x3a')]);_0xb63ef2[_0xf1d9('0x3b')]=qs[_0xf1d9('0x32')](_[_0xf1d9('0x3c')](_0x159f78['query'],_0x52ecf7['filters']),_0xc0ccd2);if(_0x159f78['query'][_0xf1d9('0x3d')]){_0xb63ef2['where']=_[_0xf1d9('0x3e')](_0xb63ef2['where'],{'$or':_[_0xf1d9('0x2d')](_0xc0ccd2,function(_0x549efb){if(_0x549efb[_0xf1d9('0x30')]!=='VIRTUAL'){var _0x19f13b={};_0x19f13b[_0x549efb['name']]={'$like':'%'+_0x159f78['query'][_0xf1d9('0x3d')]+'%'};return _0x19f13b;}})});}_0xb63ef2=_[_0xf1d9('0x3e')]({},_0xb63ef2,_0x159f78['options']);var _0x4f1940={'where':_0xb63ef2[_0xf1d9('0x3b')]};return db['ChatInternalMessage']['count'](_0x4f1940)[_0xf1d9('0x28')](function(_0x53d4ae){_0x476c4f[_0xf1d9('0x22')]=_0x53d4ae;if(_0x159f78[_0xf1d9('0x35')]['includeAll']){_0xb63ef2[_0xf1d9('0x3f')]=[{'all':!![]}];}return db[_0xf1d9('0x2e')][_0xf1d9('0x40')](_0xb63ef2);})[_0xf1d9('0x28')](function(_0x48ae84){_0x476c4f[_0xf1d9('0x41')]=_0x48ae84;return _0x476c4f;})[_0xf1d9('0x28')](respondWithFilteredResult(_0x14fbfd,_0xb63ef2))[_0xf1d9('0x42')](handleError(_0x14fbfd,null));};exports[_0xf1d9('0x43')]=function(_0x49575d,_0xb010dc){var _0x30e6f8={'raw':!![],'where':{'id':_0x49575d[_0xf1d9('0x44')]['id']}},_0x44fca0={};_0x44fca0['model']=_[_0xf1d9('0x45')](db[_0xf1d9('0x2e')]['rawAttributes']);_0x44fca0[_0xf1d9('0x35')]=_['keys'](_0x49575d['query']);_0x44fca0[_0xf1d9('0x32')]=_[_0xf1d9('0x33')](_0x44fca0[_0xf1d9('0x31')],_0x44fca0[_0xf1d9('0x35')]);_0x30e6f8['attributes']=_['intersection'](_0x44fca0['model'],qs[_0xf1d9('0x36')](_0x49575d[_0xf1d9('0x35')]['fields']));_0x30e6f8['attributes']=_0x30e6f8[_0xf1d9('0x34')]['length']?_0x30e6f8[_0xf1d9('0x34')]:_0x44fca0[_0xf1d9('0x31')];if(_0x49575d[_0xf1d9('0x35')]['includeAll']){_0x30e6f8[_0xf1d9('0x3f')]=[{'all':!![]}];}_0x30e6f8=_['merge']({},_0x30e6f8,_0x49575d[_0xf1d9('0x46')]);return db[_0xf1d9('0x2e')][_0xf1d9('0x47')](_0x30e6f8)[_0xf1d9('0x28')](handleEntityNotFound(_0xb010dc,null))[_0xf1d9('0x28')](respondWithResult(_0xb010dc,null))['catch'](handleError(_0xb010dc,null));};exports[_0xf1d9('0x48')]=function(_0x5b88e9,_0x1fdfcd){return db['ChatInternalMessage'][_0xf1d9('0x48')](_0x5b88e9[_0xf1d9('0x49')],{})[_0xf1d9('0x28')](respondWithResult(_0x1fdfcd,0xc9))[_0xf1d9('0x42')](handleError(_0x1fdfcd,null));};exports[_0xf1d9('0x27')]=function(_0x5e9404,_0x26787a){if(_0x5e9404[_0xf1d9('0x49')]['id']){delete _0x5e9404['body']['id'];}return db['ChatInternalMessage'][_0xf1d9('0x47')]({'where':{'id':_0x5e9404[_0xf1d9('0x44')]['id']}})[_0xf1d9('0x28')](handleEntityNotFound(_0x26787a,null))['then'](saveUpdates(_0x5e9404['body'],null))[_0xf1d9('0x28')](respondWithResult(_0x26787a,null))[_0xf1d9('0x42')](handleError(_0x26787a,null));};exports['destroy']=function(_0x399acc,_0x4b16fc){return db['ChatInternalMessage'][_0xf1d9('0x47')]({'where':{'id':_0x399acc[_0xf1d9('0x44')]['id']}})[_0xf1d9('0x28')](handleEntityNotFound(_0x4b16fc,null))[_0xf1d9('0x28')](removeEntity(_0x4b16fc,null))[_0xf1d9('0x42')](handleError(_0x4b16fc,null));};exports[_0xf1d9('0x4a')]=function(_0x4659b9,_0x5e9d91){return db[_0xf1d9('0x2e')]['describe']()[_0xf1d9('0x28')](respondWithResult(_0x5e9d91,null))[_0xf1d9('0x42')](handleError(_0x5e9d91,null));};function wrapUser(_0x34b0cc){return function(_0x2b0c97){var _0x521281=_0x34b0cc[_0xf1d9('0x4b')]({'plain':!![]});_0x521281[_0xf1d9('0x4c')]=[];if(_0x2b0c97){_0x521281[_0xf1d9('0x4d')]=_0x2b0c97['createdAt'];_0x521281[_0xf1d9('0x4e')]=_0x2b0c97;}else{_0x521281['lastMessageAt']=moment(0x0)[_0xf1d9('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x521281[_0xf1d9('0x4e')]={};}return _0x521281;};}exports[_0xf1d9('0x50')]=function(_0x2e8fab,_0x215487,_0x3250cc){var _0x20b4c5=[];return db['User'][_0xf1d9('0x40')]({'where':{'role':[_0xf1d9('0x51'),_0xf1d9('0x52'),'user']},'attributes':['id',_0xf1d9('0x53'),'name',_0xf1d9('0x54'),_0xf1d9('0x55'),'internal',_0xf1d9('0x56'),_0xf1d9('0x57'),'allowmessenger',_0xf1d9('0x58')],'order':qs[_0xf1d9('0x3a')](_0xf1d9('0x59')),'include':[{'model':db[_0xf1d9('0x5a')],'as':'VoiceQueues','attributes':['id',_0xf1d9('0x2a'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x3e41fc){if(_0x3e41fc){var _0x381c96=_0x2e8fab['user'][_0xf1d9('0x4b')]({'plain':!![]});if(!_0x381c96)throw new Error(_0xf1d9('0x5b'));if(_0x381c96[_0xf1d9('0x54')]===_0xf1d9('0x5c')){return db[_0xf1d9('0x5d')]['find']({'where':{'name':_0xf1d9('0x5e'),'userProfileId':_0x381c96['userProfileId']},'raw':!![]})['then'](function(_0x17e5d7){if(_0x17e5d7){if(_0x17e5d7[_0xf1d9('0x5f')]===0x0){return db['UserProfileResource'][_0xf1d9('0x40')]({'where':{'sectionId':_0x17e5d7['id']},'raw':!![]})[_0xf1d9('0x28')](function(_0x1862a3){var _0x3f392e=[];if(_[_0xf1d9('0x60')](_0x1862a3)){_0x3f392e=_['filter'](_0x3e41fc,function(_0x4e8235){if(_0x4e8235[_0xf1d9('0x54')]!==_0xf1d9('0x51')){return _0x4e8235;}});return _0x3f392e;}else{for(var _0x31e0d7=0x0;_0x31e0d7<_0x3e41fc[_0xf1d9('0x37')];_0x31e0d7++){var _0xccf4a2=_0x3e41fc[_0x31e0d7];if(_0xccf4a2['role']===_0xf1d9('0x51')){var _0x3bf39b=_['find'](_0x1862a3,function(_0x1e6cbd){return _0x1e6cbd[_0xf1d9('0x61')]===_0xccf4a2['id'];});if(_0x3bf39b)_0x3f392e[_0xf1d9('0x62')](_0xccf4a2);}else{_0x3f392e[_0xf1d9('0x62')](_0xccf4a2);}}return _0x3f392e;}});}else{return _0x3e41fc;}}else{var _0x1d96ae=_['filter'](_0x3e41fc,function(_0x233261){if(_0x233261[_0xf1d9('0x54')]!==_0xf1d9('0x51')){return _0x233261;}});return _0x1d96ae;}});}else{return _0x3e41fc;}}})[_0xf1d9('0x28')](function(_0x46b61e){var _0x278622=[];if(_0x46b61e){_0x20b4c5=_0x46b61e;for(var _0x24d7df=0x0;_0x24d7df<_0x46b61e[_0xf1d9('0x37')];_0x24d7df+=0x1){_0x20b4c5[_0x24d7df][_0xf1d9('0x4c')]=[];_0x278622['push'](db[_0xf1d9('0x2e')]['find']({'where':{'FromId':[_0x2e8fab['user']['id'],_0x46b61e[_0x24d7df]['id']],'ToId':[_0x2e8fab['user']['id'],_0x46b61e[_0x24d7df]['id']],'ChatGroupId':null},'attributes':['id',_0xf1d9('0x63'),_0xf1d9('0x64'),_0xf1d9('0x65'),'read','body'],'order':qs[_0xf1d9('0x3a')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf1d9('0x28')](wrapUser(_0x46b61e[_0x24d7df])));}return BPromise['all'](_0x278622);}return[];})[_0xf1d9('0x28')](function(_0x111997){return{'rows':_0x111997,'count':_0x111997[_0xf1d9('0x37')]};})[_0xf1d9('0x28')](respondWithResult(_0x215487,null))[_0xf1d9('0x42')](handleError(_0x215487,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f059aa8..8fb92c2 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.events.js +++ b/server/api/chatInternalMessage/chatInternalMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf920=['../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x5aa04c,_0x453a5e){var _0xe2999c=function(_0x5662c2){while(--_0x5662c2){_0x5aa04c['push'](_0x5aa04c['shift']());}};_0xe2999c(++_0x453a5e);}(_0xf920,0x1e5));var _0x0f92=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0xf920[_0x59342a];return _0x17abc9;};'use strict';var EventEmitter=require(_0x0f92('0x0'));var ChatInternalMessage=require(_0x0f92('0x1'))['db'][_0x0f92('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0f92('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f92('0x4'),'afterDestroy':_0x0f92('0x5')};function emitEvent(_0x29bb21){return function(_0x768fd7,_0x28555a,_0x24caf3){ChatInternalMessageEvents['emit'](_0x29bb21+':'+_0x768fd7['id'],_0x768fd7);ChatInternalMessageEvents[_0x0f92('0x6')](_0x29bb21,_0x768fd7);_0x24caf3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x0f92('0x7')](e,emitEvent(event));}}module[_0x0f92('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x2a19=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0x2a19,0x199));var _0x92a1=function(_0x3344ad,_0xac7b45){_0x3344ad=_0x3344ad-0x0;var _0x469f58=_0x2a19[_0x3344ad];return _0x469f58;};'use strict';var EventEmitter=require(_0x92a1('0x0'));var ChatInternalMessage=require(_0x92a1('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x92a1('0x2'),'afterUpdate':_0x92a1('0x3'),'afterDestroy':_0x92a1('0x4')};function emitEvent(_0x356e40){return function(_0x315f01,_0x38ba73,_0x53eda1){ChatInternalMessageEvents[_0x92a1('0x5')](_0x356e40+':'+_0x315f01['id'],_0x315f01);ChatInternalMessageEvents[_0x92a1('0x5')](_0x356e40,_0x315f01);_0x53eda1(null);};}for(var e in events){if(events[_0x92a1('0x6')](e)){var event=events[e];ChatInternalMessage[_0x92a1('0x7')](e,emitEvent(event));}}module[_0x92a1('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b62b4b6..de1b44f 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0190=['path','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x0190,0x1e7));var _0x0019=function(_0xe1a284,_0x583d4d){_0xe1a284=_0xe1a284-0x0;var _0x25231c=_0x0190[_0xe1a284];return _0x25231c;};'use strict';var _=require(_0x0019('0x0'));var util=require('util');var logger=require(_0x0019('0x1'))(_0x0019('0x2'));var moment=require('moment');var BPromise=require(_0x0019('0x3'));var rp=require(_0x0019('0x4'));var fs=require('fs');var path=require(_0x0019('0x5'));var rimraf=require('rimraf');var config=require(_0x0019('0x6'));var attributes=require(_0x0019('0x7'));module[_0x0019('0x8')]=function(_0xa88eca,_0x1b0ad3){return _0xa88eca[_0x0019('0x9')]('ChatInternalMessage',attributes,{'tableName':_0x0019('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0019('0xb')});}; \ No newline at end of file +var _0x9a2e=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','utf8mb4'];(function(_0x56fd4c,_0x5a753c){var _0x5a3d36=function(_0x3f4be8){while(--_0x3f4be8){_0x56fd4c['push'](_0x56fd4c['shift']());}};_0x5a3d36(++_0x5a753c);}(_0x9a2e,0x17c));var _0xe9a2=function(_0x1b2ea9,_0x3bd1e1){_0x1b2ea9=_0x1b2ea9-0x0;var _0x5df608=_0x9a2e[_0x1b2ea9];return _0x5df608;};'use strict';var _=require(_0xe9a2('0x0'));var util=require(_0xe9a2('0x1'));var logger=require(_0xe9a2('0x2'))(_0xe9a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9a2('0x4'));var rimraf=require(_0xe9a2('0x5'));var config=require(_0xe9a2('0x6'));var attributes=require(_0xe9a2('0x7'));module['exports']=function(_0x2c366c,_0x4d8839){return _0x2c366c['define'](_0xe9a2('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe9a2('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e5dec98..e0f8490 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.rpc.js +++ b/server/api/chatInternalMessage/chatInternalMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5acd=['code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x172780,_0x2672e7){var _0x54df9e=function(_0x585f34){while(--_0x585f34){_0x172780['push'](_0x172780['shift']());}};_0x54df9e(++_0x2672e7);}(_0x5acd,0x1f1));var _0xd5ac=function(_0x45839f,_0x522c19){_0x45839f=_0x45839f-0x0;var _0x40de77=_0x5acd[_0x45839f];return _0x40de77;};'use strict';var _=require(_0xd5ac('0x0'));var util=require(_0xd5ac('0x1'));var moment=require(_0xd5ac('0x2'));var BPromise=require(_0xd5ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5ac('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd5ac('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd5ac('0x7')]['http']({'port':0x232a});config[_0xd5ac('0x8')]=_[_0xd5ac('0x9')](config[_0xd5ac('0x8')],{'host':_0xd5ac('0xa'),'port':0x18eb});var socket=require(_0xd5ac('0xb'))(new Redis(config[_0xd5ac('0x8')]));require(_0xd5ac('0xc'))[_0xd5ac('0xd')](socket);function respondWithRpcPromise(_0x7fe90b,_0x393f7b,_0x3a08c7){return new BPromise(function(_0x3250e1,_0x1b5c03){return client[_0xd5ac('0xe')](_0x7fe90b,_0x3a08c7)[_0xd5ac('0xf')](function(_0x3885c7){logger[_0xd5ac('0x10')](_0xd5ac('0x11'),_0x393f7b,_0xd5ac('0x12'));logger[_0xd5ac('0x13')](_0xd5ac('0x14'),_0x393f7b,_0xd5ac('0x12'),JSON[_0xd5ac('0x15')](_0x3885c7));if(_0x3885c7[_0xd5ac('0x16')]){if(_0x3885c7[_0xd5ac('0x16')][_0xd5ac('0x17')]===0x1f4){logger[_0xd5ac('0x16')](_0xd5ac('0x11'),_0x393f7b,_0x3885c7[_0xd5ac('0x16')][_0xd5ac('0x18')]);return _0x1b5c03(_0x3885c7[_0xd5ac('0x16')][_0xd5ac('0x18')]);}logger[_0xd5ac('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x393f7b,_0x3885c7['error'][_0xd5ac('0x18')]);return _0x3250e1(_0x3885c7['error']['message']);}else{logger[_0xd5ac('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x393f7b,_0xd5ac('0x12'));_0x3250e1(_0x3885c7[_0xd5ac('0x19')][_0xd5ac('0x18')]);}})['catch'](function(_0x3ca925){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x393f7b,_0x3ca925);_0x1b5c03(_0x3ca925);});});} \ No newline at end of file +var _0x0795=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3b23df,_0xe519ca){var _0x44ec02=function(_0x39a318){while(--_0x39a318){_0x3b23df['push'](_0x3b23df['shift']());}};_0x44ec02(++_0xe519ca);}(_0x0795,0x14e));var _0x5079=function(_0x4ddaba,_0x17ea5f){_0x4ddaba=_0x4ddaba-0x0;var _0x8512c5=_0x0795[_0x4ddaba];return _0x8512c5;};'use strict';var _=require(_0x5079('0x0'));var util=require(_0x5079('0x1'));var moment=require(_0x5079('0x2'));var BPromise=require(_0x5079('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5079('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5079('0x5'));var logger=require(_0x5079('0x6'))(_0x5079('0x7'));var config=require(_0x5079('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5079('0x9')][_0x5079('0xa')]({'port':0x232a});config[_0x5079('0xb')]=_[_0x5079('0xc')](config[_0x5079('0xb')],{'host':_0x5079('0xd'),'port':0x18eb});var socket=require(_0x5079('0xe'))(new Redis(config[_0x5079('0xb')]));require(_0x5079('0xf'))[_0x5079('0x10')](socket);function respondWithRpcPromise(_0x4f7e88,_0x1bf964,_0x347506){return new BPromise(function(_0x139e2d,_0x3ec287){return client[_0x5079('0x11')](_0x4f7e88,_0x347506)[_0x5079('0x12')](function(_0x2bae3a){logger[_0x5079('0x13')](_0x5079('0x14'),_0x1bf964,_0x5079('0x15'));logger[_0x5079('0x16')](_0x5079('0x17'),_0x1bf964,_0x5079('0x15'),JSON[_0x5079('0x18')](_0x2bae3a));if(_0x2bae3a[_0x5079('0x19')]){if(_0x2bae3a[_0x5079('0x19')][_0x5079('0x1a')]===0x1f4){logger[_0x5079('0x19')](_0x5079('0x14'),_0x1bf964,_0x2bae3a[_0x5079('0x19')][_0x5079('0x1b')]);return _0x3ec287(_0x2bae3a[_0x5079('0x19')]['message']);}logger[_0x5079('0x19')](_0x5079('0x14'),_0x1bf964,_0x2bae3a[_0x5079('0x19')][_0x5079('0x1b')]);return _0x139e2d(_0x2bae3a[_0x5079('0x19')][_0x5079('0x1b')]);}else{logger[_0x5079('0x13')](_0x5079('0x14'),_0x1bf964,'request\x20sent');_0x139e2d(_0x2bae3a[_0x5079('0x1c')]['message']);}})[_0x5079('0x1d')](function(_0x4c6fff){logger[_0x5079('0x19')](_0x5079('0x14'),_0x1bf964,_0x4c6fff);_0x3ec287(_0x4c6fff);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index e31dcd6..6b30e31 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.socket.js +++ b/server/api/chatInternalMessage/chatInternalMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7d2=['removeListener','register','length','./chatInternalMessage.events'];(function(_0x56402c,_0x2a8c8b){var _0x1b33da=function(_0x4af5a7){while(--_0x4af5a7){_0x56402c['push'](_0x56402c['shift']());}};_0x1b33da(++_0x2a8c8b);}(_0xe7d2,0x16b));var _0x2e7d=function(_0x825d19,_0x4fe030){_0x825d19=_0x825d19-0x0;var _0x2e7502=_0xe7d2[_0x825d19];return _0x2e7502;};'use strict';var ChatInternalMessageEvents=require(_0x2e7d('0x0'));var events=['save','remove','update'];function createListener(_0x2f72b9,_0x4b5229){return function(_0x420e3f){_0x4b5229['emit'](_0x2f72b9,_0x420e3f);};}function removeListener(_0x3871b5,_0x4c1015){return function(){ChatInternalMessageEvents[_0x2e7d('0x1')](_0x3871b5,_0x4c1015);};}exports[_0x2e7d('0x2')]=function(_0x4ddb1f){for(var _0x2ad851=0x0,_0x23fdf8=events[_0x2e7d('0x3')];_0x2ad851<_0x23fdf8;_0x2ad851++){var _0x1589b0=events[_0x2ad851];var _0x1ff055=createListener('chatInternalMessage:'+_0x1589b0,_0x4ddb1f);ChatInternalMessageEvents['on'](_0x1589b0,_0x1ff055);}}; \ No newline at end of file +var _0xb14e=['length','chatInternalMessage:','./chatInternalMessage.events','remove','update','emit','removeListener','register'];(function(_0x48d6c2,_0x1ce5d2){var _0x39eeb1=function(_0xa992a7){while(--_0xa992a7){_0x48d6c2['push'](_0x48d6c2['shift']());}};_0x39eeb1(++_0x1ce5d2);}(_0xb14e,0x15a));var _0xeb14=function(_0x342bd9,_0x172771){_0x342bd9=_0x342bd9-0x0;var _0x43705a=_0xb14e[_0x342bd9];return _0x43705a;};'use strict';var ChatInternalMessageEvents=require(_0xeb14('0x0'));var events=['save',_0xeb14('0x1'),_0xeb14('0x2')];function createListener(_0x3a204b,_0x58bcb2){return function(_0x232c62){_0x58bcb2[_0xeb14('0x3')](_0x3a204b,_0x232c62);};}function removeListener(_0x3e19d8,_0x56a566){return function(){ChatInternalMessageEvents[_0xeb14('0x4')](_0x3e19d8,_0x56a566);};}exports[_0xeb14('0x5')]=function(_0x1fa7a1){for(var _0x35255c=0x0,_0xd8e2dc=events[_0xeb14('0x6')];_0x35255c<_0xd8e2dc;_0x35255c++){var _0x477b3c=events[_0x35255c];var _0x34ae4e=createListener(_0xeb14('0x7')+_0x477b3c,_0x1fa7a1);ChatInternalMessageEvents['on'](_0x477b3c,_0x34ae4e);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index da7f147..c3ac1e3 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x361a=['isAuthenticated','getUsers','show','post','create','put','/:id','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','/describe','describe','/users'];(function(_0x2263cc,_0x2e1dc9){var _0x1ba214=function(_0x2c4fe3){while(--_0x2c4fe3){_0x2263cc['push'](_0x2263cc['shift']());}};_0x1ba214(++_0x2e1dc9);}(_0x361a,0x8e));var _0xa361=function(_0x38fc0f,_0x4658a5){_0x38fc0f=_0x38fc0f-0x0;var _0x23c7c4=_0x361a[_0x38fc0f];return _0x23c7c4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa361('0x0'));var express=require(_0xa361('0x1'));var router=express[_0xa361('0x2')]();var fs_extra=require(_0xa361('0x3'));var auth=require(_0xa361('0x4'));var interaction=require(_0xa361('0x5'));var config=require(_0xa361('0x6'));var controller=require(_0xa361('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa361('0x8')]);router['get'](_0xa361('0x9'),auth['isAuthenticated'](),controller[_0xa361('0xa')]);router['get'](_0xa361('0xb'),auth[_0xa361('0xc')](),controller[_0xa361('0xd')]);router['get']('/:id',auth[_0xa361('0xc')](),controller[_0xa361('0xe')]);router[_0xa361('0xf')]('/',auth['isAuthenticated'](),controller[_0xa361('0x10')]);router[_0xa361('0x11')](_0xa361('0x12'),controller['update']);router[_0xa361('0x13')](_0xa361('0x12'),auth[_0xa361('0xc')](),controller[_0xa361('0x14')]);module[_0xa361('0x15')]=router; \ No newline at end of file +var _0xc14d=['isAuthenticated','describe','getUsers','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x518f54,_0x44f1bc){var _0x18667b=function(_0x4add60){while(--_0x4add60){_0x518f54['push'](_0x518f54['shift']());}};_0x18667b(++_0x44f1bc);}(_0xc14d,0x1ea));var _0xdc14=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc14d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdc14('0x0'));var timeout=require(_0xdc14('0x1'));var express=require(_0xdc14('0x2'));var router=express[_0xdc14('0x3')]();var fs_extra=require(_0xdc14('0x4'));var auth=require(_0xdc14('0x5'));var interaction=require(_0xdc14('0x6'));var config=require(_0xdc14('0x7'));var controller=require(_0xdc14('0x8'));router[_0xdc14('0x9')]('/',auth[_0xdc14('0xa')](),controller['index']);router[_0xdc14('0x9')]('/describe',auth[_0xdc14('0xa')](),controller[_0xdc14('0xb')]);router[_0xdc14('0x9')]('/users',auth[_0xdc14('0xa')](),controller[_0xdc14('0xc')]);router[_0xdc14('0x9')](_0xdc14('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xdc14('0xa')](),controller[_0xdc14('0xe')]);router[_0xdc14('0xf')]('/:id',controller[_0xdc14('0x10')]);router[_0xdc14('0x11')](_0xdc14('0xd'),auth['isAuthenticated'](),controller[_0xdc14('0x12')]);module[_0xdc14('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 426671f..9f6e92f 100644 --- a/server/api/chatMessage/chatMessage.attributes.js +++ b/server/api/chatMessage/chatMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed3c=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0xeba5c0,_0x54381f){var _0x35b566=function(_0x136f70){while(--_0x136f70){_0xeba5c0['push'](_0xeba5c0['shift']());}};_0x35b566(++_0x54381f);}(_0xed3c,0x1a6));var _0xced3=function(_0x297dcf,_0x448cf5){_0x297dcf=_0x297dcf-0x0;var _0xe1699b=_0xed3c[_0x297dcf];return _0xe1699b;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'body':{'type':Sequelize[_0xced3('0x2')](_0xced3('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xced3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xced3('0x5')]('in',_0xced3('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xced3('0x7')]},'providerResponse':{'type':Sequelize[_0xced3('0x2')]}}; \ No newline at end of file +var _0x7916=['out','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x69c0c2,_0x2af0bf){var _0x3422f6=function(_0x283e41){while(--_0x283e41){_0x69c0c2['push'](_0x69c0c2['shift']());}};_0x3422f6(++_0x2af0bf);}(_0x7916,0x128));var _0x6791=function(_0x43c23b,_0x136f62){_0x43c23b=_0x43c23b-0x0;var _0x3c1613=_0x7916[_0x43c23b];return _0x3c1613;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'body':{'type':Sequelize[_0x6791('0x1')](_0x6791('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x6791('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6791('0x4')]('in',_0x6791('0x5')),'defaultValue':_0x6791('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6791('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 32be132..4b44ab1 100644 --- a/server/api/chatMessage/chatMessage.controller.js +++ b/server/api/chatMessage/chatMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x219e=['../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','find','create','body','params','describe','../../config/logger','accept','chat','readAt','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','chat-interactions','RejectMessage','sequelize','Sequelize','SELECT','formData','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','api'];(function(_0xcd3e25,_0x3778c5){var _0x7164ce=function(_0x360b82){while(--_0x360b82){_0xcd3e25['push'](_0xcd3e25['shift']());}};_0x7164ce(++_0x3778c5);}(_0x219e,0x172));var _0xe219=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x219e[_0x5f0089];return _0x193892;};'use strict';var emlformat=require(_0xe219('0x0'));var rimraf=require(_0xe219('0x1'));var zipdir=require(_0xe219('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe219('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe219('0x4'));var util=require(_0xe219('0x5'));var path=require(_0xe219('0x6'));var sox=require(_0xe219('0x7'));var csv=require('to-csv');var ejs=require(_0xe219('0x8'));var fs=require('fs');var fs_extra=require(_0xe219('0x9'));var _=require(_0xe219('0xa'));var squel=require(_0xe219('0xb'));var crypto=require('crypto');var jsforce=require(_0xe219('0xc'));var deskjs=require(_0xe219('0xd'));var toCsv=require(_0xe219('0xe'));var querystring=require(_0xe219('0xf'));var Papa=require(_0xe219('0x10'));var Redis=require(_0xe219('0x11'));var authService=require(_0xe219('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe219('0x13'));var utils=require(_0xe219('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe219('0x15'))['db'];config[_0xe219('0x16')]=_[_0xe219('0x17')](config[_0xe219('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xe219('0x18'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xe219('0x19')](socket);var jayson=require(_0xe219('0x1a'));var client=jayson[_0xe219('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xe219('0x1b')][_0xe219('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1cc791,_0x37fcc6,_0x121059,_0x1c6aea){return new BPromise(function(_0x28f9e4,_0x6ea9be){var _0x3c78ad=_0x1c6aea||client;return _0x3c78ad[_0xe219('0x1d')](_0x1cc791,_0x121059)['then'](function(_0x5adbe9){logger[_0xe219('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x37fcc6,_0xe219('0x1f'));logger[_0xe219('0x20')](_0xe219('0x21'),_0x37fcc6,'request\x20sent',JSON[_0xe219('0x22')](_0x5adbe9));if(_0x5adbe9['error']){if(_0x5adbe9[_0xe219('0x23')][_0xe219('0x24')]===0x1f4){logger['error'](_0xe219('0x25'),_0x37fcc6,_0x5adbe9[_0xe219('0x23')][_0xe219('0x26')]);return _0x6ea9be(_0x5adbe9['error'][_0xe219('0x26')]);}logger[_0xe219('0x23')](_0xe219('0x25'),_0x37fcc6,_0x5adbe9['error'][_0xe219('0x26')]);return _0x28f9e4(_0x5adbe9['error'][_0xe219('0x26')]);}else{logger[_0xe219('0x1e')](_0xe219('0x25'),_0x37fcc6,_0xe219('0x1f'));_0x28f9e4(_0x5adbe9[_0xe219('0x27')][_0xe219('0x26')]);}})[_0xe219('0x28')](function(_0x1dab92){logger['error'](_0xe219('0x25'),_0x37fcc6,_0x1dab92);_0x6ea9be(_0x1dab92);});});}function respondWithStatusCode(_0x1483b6,_0x2adb15){_0x2adb15=_0x2adb15||0xcc;return function(_0x73611e){if(_0x73611e){return _0x1483b6[_0xe219('0x29')](_0x2adb15);}return _0x1483b6[_0xe219('0x2a')](_0x2adb15)[_0xe219('0x2b')]();};}function respondWithResult(_0x319763,_0x43d2b0){_0x43d2b0=_0x43d2b0||0xc8;return function(_0x145082){if(_0x145082){return _0x319763[_0xe219('0x2a')](_0x43d2b0)[_0xe219('0x2c')](_0x145082);}};}function respondWithFilteredResult(_0x1aee9e,_0x2b042a){return function(_0x8ea90){if(_0x8ea90){var _0x4ce0bc=typeof _0x2b042a['offset']===_0xe219('0x2d')&&typeof _0x2b042a[_0xe219('0x2e')]===_0xe219('0x2d');var _0x1367b3=_0x8ea90[_0xe219('0x2f')];var _0x173e3b=_0x4ce0bc?0x0:_0x2b042a[_0xe219('0x30')];var _0x58d368=_0x4ce0bc?_0x8ea90[_0xe219('0x2f')]:_0x2b042a[_0xe219('0x30')]+_0x2b042a[_0xe219('0x2e')];var _0x4cc639;if(_0x58d368>=_0x1367b3){_0x58d368=_0x1367b3;_0x4cc639=0xc8;}else{_0x4cc639=0xce;}_0x1aee9e[_0xe219('0x2a')](_0x4cc639);return _0x1aee9e[_0xe219('0x31')](_0xe219('0x32'),_0x173e3b+'-'+_0x58d368+'/'+_0x1367b3)[_0xe219('0x2c')](_0x8ea90);}return null;};}function patchUpdates(_0x2f5b25){return function(_0x38e4fe){try{jsonpatch[_0xe219('0x33')](_0x38e4fe,_0x2f5b25,!![]);}catch(_0xab7136){return BPromise[_0xe219('0x34')](_0xab7136);}return _0x38e4fe[_0xe219('0x35')]();};}function saveUpdates(_0x29bc4b,_0x3a43de){return function(_0xd7cc54){if(_0xd7cc54){return _0xd7cc54[_0xe219('0x36')](_0x29bc4b)['then'](function(_0x3e9115){return _0x3e9115;});}return null;};}function removeEntity(_0x4120ff,_0x57b40a){return function(_0x2294a4){if(_0x2294a4){return _0x2294a4['destroy']()[_0xe219('0x37')](function(){_0x4120ff[_0xe219('0x2a')](0xcc)[_0xe219('0x2b')]();});}};}function handleEntityNotFound(_0x4462d3,_0x1d7845){return function(_0x58a4cf){if(!_0x58a4cf){_0x4462d3[_0xe219('0x29')](0x194);}return _0x58a4cf;};}function handleError(_0x4225a7,_0xe66907){_0xe66907=_0xe66907||0x1f4;return function(_0x368798){logger[_0xe219('0x23')](_0x368798[_0xe219('0x38')]);if(_0x368798[_0xe219('0x39')]){delete _0x368798['name'];}_0x4225a7[_0xe219('0x2a')](_0xe66907)['send'](_0x368798);};}exports[_0xe219('0x3a')]=function(_0x3ea303,_0x1f5ef4){var _0x409003={},_0x46d55f={},_0x35c4a8={'count':0x0,'rows':[]};var _0x5ef2ea=_[_0xe219('0x3b')](db[_0xe219('0x3c')][_0xe219('0x3d')],function(_0x2eedaf){return{'name':_0x2eedaf[_0xe219('0x3e')],'type':_0x2eedaf[_0xe219('0x3f')][_0xe219('0x40')]};});_0x46d55f[_0xe219('0x41')]=_[_0xe219('0x3b')](_0x5ef2ea,_0xe219('0x39'));_0x46d55f[_0xe219('0x42')]=_[_0xe219('0x43')](_0x3ea303[_0xe219('0x42')]);_0x46d55f[_0xe219('0x44')]=_[_0xe219('0x45')](_0x46d55f[_0xe219('0x41')],_0x46d55f[_0xe219('0x42')]);_0x409003[_0xe219('0x46')]=_[_0xe219('0x45')](_0x46d55f[_0xe219('0x41')],qs[_0xe219('0x47')](_0x3ea303[_0xe219('0x42')][_0xe219('0x47')]));_0x409003[_0xe219('0x46')]=_0x409003['attributes'][_0xe219('0x48')]?_0x409003[_0xe219('0x46')]:_0x46d55f['model'];if(!_0x3ea303[_0xe219('0x42')]['hasOwnProperty'](_0xe219('0x49'))){_0x409003['limit']=qs[_0xe219('0x2e')](_0x3ea303[_0xe219('0x42')][_0xe219('0x2e')]);_0x409003[_0xe219('0x30')]=qs[_0xe219('0x30')](_0x3ea303[_0xe219('0x42')]['offset']);}_0x409003[_0xe219('0x4a')]=qs['sort'](_0x3ea303['query'][_0xe219('0x4b')]);_0x409003[_0xe219('0x4c')]=qs[_0xe219('0x44')](_[_0xe219('0x4d')](_0x3ea303[_0xe219('0x42')],_0x46d55f[_0xe219('0x44')]),_0x5ef2ea);if(_0x3ea303['query'][_0xe219('0x4e')]){_0x409003[_0xe219('0x4c')]=_[_0xe219('0x4f')](_0x409003[_0xe219('0x4c')],{'$or':_[_0xe219('0x3b')](_0x5ef2ea,function(_0x5767c5){if(_0x5767c5[_0xe219('0x3f')]!=='VIRTUAL'){var _0x44547a={};_0x44547a[_0x5767c5[_0xe219('0x39')]]={'$like':'%'+_0x3ea303[_0xe219('0x42')][_0xe219('0x4e')]+'%'};return _0x44547a;}})});}_0x409003=_[_0xe219('0x4f')]({},_0x409003,_0x3ea303[_0xe219('0x50')]);var _0x2be226={'where':_0x409003[_0xe219('0x4c')]};return db[_0xe219('0x3c')][_0xe219('0x2f')](_0x2be226)[_0xe219('0x37')](function(_0x2675b2){_0x35c4a8[_0xe219('0x2f')]=_0x2675b2;if(_0x3ea303[_0xe219('0x42')][_0xe219('0x51')]){_0x409003[_0xe219('0x52')]=[{'all':!![]}];}return db['ChatMessage'][_0xe219('0x53')](_0x409003);})['then'](function(_0x96ae8a){_0x35c4a8['rows']=_0x96ae8a;return _0x35c4a8;})['then'](respondWithFilteredResult(_0x1f5ef4,_0x409003))[_0xe219('0x28')](handleError(_0x1f5ef4,null));};exports[_0xe219('0x54')]=function(_0x241532,_0x5e6053){var _0x35f9e5={'raw':!![],'where':{'id':_0x241532['params']['id']}},_0x56c9b9={};_0x56c9b9[_0xe219('0x41')]=_[_0xe219('0x43')](db['ChatMessage'][_0xe219('0x3d')]);_0x56c9b9[_0xe219('0x42')]=_[_0xe219('0x43')](_0x241532[_0xe219('0x42')]);_0x56c9b9[_0xe219('0x44')]=_[_0xe219('0x45')](_0x56c9b9[_0xe219('0x41')],_0x56c9b9[_0xe219('0x42')]);_0x35f9e5['attributes']=_['intersection'](_0x56c9b9[_0xe219('0x41')],qs[_0xe219('0x47')](_0x241532[_0xe219('0x42')][_0xe219('0x47')]));_0x35f9e5[_0xe219('0x46')]=_0x35f9e5[_0xe219('0x46')][_0xe219('0x48')]?_0x35f9e5[_0xe219('0x46')]:_0x56c9b9[_0xe219('0x41')];if(_0x241532[_0xe219('0x42')][_0xe219('0x51')]){_0x35f9e5[_0xe219('0x52')]=[{'all':!![]}];}_0x35f9e5=_[_0xe219('0x4f')]({},_0x35f9e5,_0x241532['options']);return db[_0xe219('0x3c')][_0xe219('0x55')](_0x35f9e5)[_0xe219('0x37')](handleEntityNotFound(_0x5e6053,null))['then'](respondWithResult(_0x5e6053,null))[_0xe219('0x28')](handleError(_0x5e6053,null));};exports[_0xe219('0x56')]=function(_0x2108b5,_0x595b49){return db['ChatMessage'][_0xe219('0x56')](_0x2108b5['body'],{})[_0xe219('0x37')](respondWithResult(_0x595b49,0xc9))[_0xe219('0x28')](handleError(_0x595b49,null));};exports['update']=function(_0x14fd8b,_0x19a671){if(_0x14fd8b[_0xe219('0x57')]['id']){delete _0x14fd8b[_0xe219('0x57')]['id'];}return db['ChatMessage'][_0xe219('0x55')]({'where':{'id':_0x14fd8b['params']['id']}})[_0xe219('0x37')](handleEntityNotFound(_0x19a671,null))[_0xe219('0x37')](saveUpdates(_0x14fd8b['body'],null))[_0xe219('0x37')](respondWithResult(_0x19a671,null))[_0xe219('0x28')](handleError(_0x19a671,null));};exports['destroy']=function(_0x4ba463,_0x4f8949){return db[_0xe219('0x3c')][_0xe219('0x55')]({'where':{'id':_0x4ba463[_0xe219('0x58')]['id']}})[_0xe219('0x37')](handleEntityNotFound(_0x4f8949,null))['then'](removeEntity(_0x4f8949,null))['catch'](handleError(_0x4f8949,null));};exports[_0xe219('0x59')]=function(_0x374db7,_0x51ba18){return db[_0xe219('0x3c')]['describe']()[_0xe219('0x37')](respondWithResult(_0x51ba18,null))[_0xe219('0x28')](handleError(_0x51ba18,null));};var interaction_log=require(_0xe219('0x5a'))('chat-interactions');exports[_0xe219('0x5b')]=function(_0x1be055,_0x54ee10,_0xf8511e){var _0x6007ae={'agent':{},'channel':_0xe219('0x5c')};if(_0x1be055[_0xe219('0x57')]['id']){delete _0x1be055['body']['id'];}_0x1be055['body']['read']=!![];_0x1be055[_0xe219('0x57')][_0xe219('0x5d')]=moment()[_0xe219('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1be055[_0xe219('0x57')][_0xe219('0x5f')]=_0x1be055[_0xe219('0x57')][_0xe219('0x5f')]||_0x1be055[_0xe219('0x60')]['id'];_0x6007ae[_0xe219('0x61')]['id']=_0x1be055[_0xe219('0x57')][_0xe219('0x5f')];return db['ChatMessage']['find']({'where':{'id':_0x1be055[_0xe219('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x54ee10,null))[_0xe219('0x37')](saveUpdates(_0x1be055[_0xe219('0x57')],null))['then'](function(_0x248d58){if(_0x248d58){_0x6007ae[_0xe219('0x26')]=_0x248d58[_0xe219('0x62')]({'plain':!![]});return db[_0xe219('0x63')][_0xe219('0x55')]({'where':{'id':_0x248d58[_0xe219('0x64')]}});}return null;})[_0xe219('0x37')](handleEntityNotFound(_0x54ee10,null))[_0xe219('0x37')](function(_0x23725e){if(_0x23725e){return _0x23725e['update']({'UserId':_0x1be055[_0xe219('0x57')][_0xe219('0x5f')],'read1stAt':_[_0xe219('0x65')](_0x23725e[_0xe219('0x66')])?moment()[_0xe219('0x5e')](_0xe219('0x67')):undefined});}return null;})['then'](function(_0x439b6a){if(_0x439b6a){_0x6007ae[_0xe219('0x68')]=_0x439b6a['get']({'plain':!![]});interaction_log[_0xe219('0x1e')](_0xe219('0x69'),_0x1be055['user']['id'],_0x1be055['user'][_0xe219('0x39')],_0x1be055[_0xe219('0x60')][_0xe219('0x6a')],_0x6007ae[_0xe219('0x68')]['id'],_0x1be055['body']?JSON[_0xe219('0x22')](_0x1be055[_0xe219('0x57')]):_0xe219('0x6b'));return respondWithRpcPromise(_0xe219('0x6c'),_0xe219('0x6d'),_0x6007ae);}return null;})[_0xe219('0x37')](function(_0x1d882b){var _0xb615ea='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1d882b[_0xe219('0x26')]['ContactId'];return db['sequelize'][_0xe219('0x42')](_0xb615ea,{'type':db['Sequelize'][_0xe219('0x6e')]['SELECT'],'raw':!![]})[_0xe219('0x37')](function(_0x24703f){return _0x24703f;});})['then'](function(_0x197878){if(_0x197878){_0x6007ae[_0xe219('0x26')][_0xe219('0x6f')]=_0x197878[0x0];if(!_0x1be055[_0xe219('0x57')][_0xe219('0x5f')])return;return db[_0xe219('0x70')][_0xe219('0x55')]({'where':{'id':_0x1be055[_0xe219('0x57')][_0xe219('0x5f')],'role':_0xe219('0x61')},'attributes':['id',_0xe219('0x39'),_0xe219('0x71'),_0xe219('0x72'),_0xe219('0x73')],'raw':!![]});}return null;})['then'](function(_0x27840a){if(!_0x27840a)return null;_0x6007ae[_0xe219('0x26')][_0xe219('0x61')]=_0x27840a;return _0x6007ae;})[_0xe219('0x37')](function(_0x20bee7){if(_0x20bee7){if(_0x1be055[_0xe219('0x57')]['manual']){_0x6007ae['message'][_0xe219('0x74')]=util[_0xe219('0x5e')](_0xe219('0x75'),_0x1be055[_0xe219('0x60')]['name']);_0x6007ae[_0xe219('0x26')][_0xe219('0x76')]=_0x6007ae['channel'];_0x6007ae['message'][_0xe219('0x77')]=_0x6007ae['channel'];_0x6007ae[_0xe219('0x26')][_0xe219('0x78')]='accept';return respondWithRpcPromise(_0xe219('0x79'),_0xe219('0x79'),{'event':_0xe219('0x7a'),'message':_[_0xe219('0x4f')](_0x6007ae['message'],JSON[_0xe219('0x7b')](_0x6007ae[_0xe219('0x68')]['formData']))},client9002)['then'](function(){return _0x6007ae;});}return _0x6007ae;}return null;})[_0xe219('0x37')](respondWithResult(_0x54ee10,null))['catch'](handleError(_0x54ee10,null));};var interaction_log=require(_0xe219('0x5a'))(_0xe219('0x7c'));exports[_0xe219('0x34')]=function(_0x5bdb8e,_0x3c9e92,_0x519d69){var _0x13a16c={'agent':{},'channel':_0xe219('0x5c')};if(_0x5bdb8e[_0xe219('0x57')]['id']){delete _0x5bdb8e[_0xe219('0x57')]['id'];}_0x5bdb8e['body'][_0xe219('0x5f')]=_0x5bdb8e['body'][_0xe219('0x5f')]||_0x5bdb8e['user']['id'];_0x13a16c[_0xe219('0x61')]['id']=_0x5bdb8e[_0xe219('0x57')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x5bdb8e[_0xe219('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c9e92,null))[_0xe219('0x37')](function(_0x329050){if(_0x329050){_0x13a16c[_0xe219('0x26')]=_0x329050[_0xe219('0x62')]({'plain':!![]});return db[_0xe219('0x63')]['find']({'where':{'id':_0x329050['ChatInteractionId']}});}return null;})[_0xe219('0x37')](handleEntityNotFound(_0x3c9e92,null))[_0xe219('0x37')](function(_0x43a2e1){if(_0x43a2e1){_0x13a16c[_0xe219('0x68')]=_0x43a2e1[_0xe219('0x62')]({'plain':!![]});interaction_log[_0xe219('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5bdb8e[_0xe219('0x60')]['id'],_0x5bdb8e[_0xe219('0x60')][_0xe219('0x39')],_0x5bdb8e[_0xe219('0x60')][_0xe219('0x6a')],_0x13a16c[_0xe219('0x68')]['id'],_0x5bdb8e[_0xe219('0x57')]?JSON[_0xe219('0x22')](_0x5bdb8e[_0xe219('0x57')]):_0xe219('0x6b'));return respondWithRpcPromise(_0xe219('0x7d'),'rejectMessage',_0x13a16c);}return null;})['then'](function(_0x49d161){var _0x4075ac='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x49d161[_0xe219('0x26')]['ContactId'];return db[_0xe219('0x7e')][_0xe219('0x42')](_0x4075ac,{'type':db[_0xe219('0x7f')][_0xe219('0x6e')][_0xe219('0x80')],'raw':!![]})['then'](function(_0x7e46cb){return _0x7e46cb;});})[_0xe219('0x37')](function(_0x47a05e){if(_0x47a05e){_0x13a16c[_0xe219('0x26')][_0xe219('0x6f')]=_0x47a05e[0x0];if(!_0x5bdb8e[_0xe219('0x57')][_0xe219('0x5f')])return;return db[_0xe219('0x70')][_0xe219('0x55')]({'where':{'id':_0x5bdb8e[_0xe219('0x57')][_0xe219('0x5f')],'role':'agent'},'attributes':['id',_0xe219('0x39'),_0xe219('0x71'),_0xe219('0x72'),_0xe219('0x73')],'raw':!![]});}return null;})[_0xe219('0x37')](function(_0x25a36c){if(!_0x25a36c)return null;_0x13a16c[_0xe219('0x26')][_0xe219('0x61')]=_0x25a36c;return _0x13a16c;})[_0xe219('0x37')](function(_0xbd40a9){if(_0xbd40a9){_0xbd40a9['message']['interface']=util[_0xe219('0x5e')]('SIP/%s',_0x5bdb8e[_0xe219('0x60')][_0xe219('0x39')]);_0xbd40a9['message'][_0xe219('0x76')]=_0x13a16c[_0xe219('0x76')];_0xbd40a9['message'][_0xe219('0x77')]=_0x13a16c[_0xe219('0x76')];_0xbd40a9[_0xe219('0x26')][_0xe219('0x78')]=_0xe219('0x34');respondWithRpcPromise(_0xe219('0x79'),'EventManager',{'event':'rejectmessage','message':_[_0xe219('0x4f')](_0x13a16c[_0xe219('0x26')],JSON[_0xe219('0x7b')](_0x13a16c[_0xe219('0x68')][_0xe219('0x81')]))},client9002);return _0x13a16c;}return null;})[_0xe219('0x37')](respondWithResult(_0x3c9e92,null))[_0xe219('0x28')](handleError(_0x3c9e92,null));}; \ No newline at end of file +var _0x06ec=['ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','ChatMessage','count','includeAll','include','findAll','rows','catch','params','create','body','find','destroy','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x06ec,0xe4));var _0xc06e=function(_0x5d3bc5,_0xd57ce){_0x5d3bc5=_0x5d3bc5-0x0;var _0x2f1d26=_0x06ec[_0x5d3bc5];return _0x2f1d26;};'use strict';var emlformat=require(_0xc06e('0x0'));var rimraf=require(_0xc06e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc06e('0x2'));var rp=require('request-promise');var moment=require(_0xc06e('0x3'));var BPromise=require(_0xc06e('0x4'));var Mustache=require(_0xc06e('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc06e('0x6'));var ejs=require(_0xc06e('0x7'));var fs=require('fs');var fs_extra=require(_0xc06e('0x8'));var _=require('lodash');var squel=require(_0xc06e('0x9'));var crypto=require('crypto');var jsforce=require(_0xc06e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc06e('0x6'));var querystring=require(_0xc06e('0xb'));var Papa=require('papaparse');var Redis=require(_0xc06e('0xc'));var authService=require(_0xc06e('0xd'));var qs=require(_0xc06e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc06e('0xf'));var logger=require(_0xc06e('0x10'))(_0xc06e('0x11'));var utils=require(_0xc06e('0x12'));var config=require(_0xc06e('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc06e('0x14'))['db'];config[_0xc06e('0x15')]=_[_0xc06e('0x16')](config[_0xc06e('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xc06e('0x17'))(new Redis(config[_0xc06e('0x15')]));require('./chatMessage.socket')[_0xc06e('0x18')](socket);var jayson=require(_0xc06e('0x19'));var client=jayson[_0xc06e('0x1a')]['http']({'port':0x232c});var client9002=jayson['client'][_0xc06e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2add23,_0x4fe60f,_0x36131a,_0x6645d8){return new BPromise(function(_0x3c0462,_0x501deb){var _0x1bb750=_0x6645d8||client;return _0x1bb750['request'](_0x2add23,_0x36131a)['then'](function(_0x26c31a){logger[_0xc06e('0x1c')](_0xc06e('0x1d'),_0x4fe60f,_0xc06e('0x1e'));logger[_0xc06e('0x1f')](_0xc06e('0x20'),_0x4fe60f,_0xc06e('0x1e'),JSON['stringify'](_0x26c31a));if(_0x26c31a[_0xc06e('0x21')]){if(_0x26c31a[_0xc06e('0x21')][_0xc06e('0x22')]===0x1f4){logger[_0xc06e('0x21')](_0xc06e('0x1d'),_0x4fe60f,_0x26c31a[_0xc06e('0x21')]['message']);return _0x501deb(_0x26c31a['error'][_0xc06e('0x23')]);}logger[_0xc06e('0x21')](_0xc06e('0x1d'),_0x4fe60f,_0x26c31a[_0xc06e('0x21')][_0xc06e('0x23')]);return _0x3c0462(_0x26c31a[_0xc06e('0x21')][_0xc06e('0x23')]);}else{logger[_0xc06e('0x1c')]('ChatMessage,\x20%s,\x20%s',_0x4fe60f,_0xc06e('0x1e'));_0x3c0462(_0x26c31a[_0xc06e('0x24')][_0xc06e('0x23')]);}})['catch'](function(_0x200ecc){logger[_0xc06e('0x21')](_0xc06e('0x1d'),_0x4fe60f,_0x200ecc);_0x501deb(_0x200ecc);});});}function respondWithStatusCode(_0x4aab55,_0x61f5dc){_0x61f5dc=_0x61f5dc||0xcc;return function(_0x5df05d){if(_0x5df05d){return _0x4aab55[_0xc06e('0x25')](_0x61f5dc);}return _0x4aab55['status'](_0x61f5dc)[_0xc06e('0x26')]();};}function respondWithResult(_0x5bf39d,_0x185e5c){_0x185e5c=_0x185e5c||0xc8;return function(_0x4a5c20){if(_0x4a5c20){return _0x5bf39d['status'](_0x185e5c)[_0xc06e('0x27')](_0x4a5c20);}};}function respondWithFilteredResult(_0x39040d,_0x4306ea){return function(_0x40176f){if(_0x40176f){var _0x4579e2=typeof _0x4306ea[_0xc06e('0x28')]===_0xc06e('0x29')&&typeof _0x4306ea[_0xc06e('0x2a')]===_0xc06e('0x29');var _0x8a0b58=_0x40176f['count'];var _0x446da7=_0x4579e2?0x0:_0x4306ea['offset'];var _0xd0e78d=_0x4579e2?_0x40176f['count']:_0x4306ea[_0xc06e('0x28')]+_0x4306ea[_0xc06e('0x2a')];var _0x2aaef6;if(_0xd0e78d>=_0x8a0b58){_0xd0e78d=_0x8a0b58;_0x2aaef6=0xc8;}else{_0x2aaef6=0xce;}_0x39040d[_0xc06e('0x2b')](_0x2aaef6);return _0x39040d[_0xc06e('0x2c')](_0xc06e('0x2d'),_0x446da7+'-'+_0xd0e78d+'/'+_0x8a0b58)[_0xc06e('0x27')](_0x40176f);}return null;};}function patchUpdates(_0x18814f){return function(_0x1d59ae){try{jsonpatch[_0xc06e('0x2e')](_0x1d59ae,_0x18814f,!![]);}catch(_0x19b355){return BPromise[_0xc06e('0x2f')](_0x19b355);}return _0x1d59ae['save']();};}function saveUpdates(_0x556ce9,_0xcd8028){return function(_0x53dabc){if(_0x53dabc){return _0x53dabc[_0xc06e('0x30')](_0x556ce9)[_0xc06e('0x31')](function(_0x68b0a5){return _0x68b0a5;});}return null;};}function removeEntity(_0x5c28c7,_0x24b451){return function(_0x282a03){if(_0x282a03){return _0x282a03['destroy']()[_0xc06e('0x31')](function(){_0x5c28c7[_0xc06e('0x2b')](0xcc)[_0xc06e('0x26')]();});}};}function handleEntityNotFound(_0x5d677d,_0x5a9702){return function(_0x3f04e4){if(!_0x3f04e4){_0x5d677d[_0xc06e('0x25')](0x194);}return _0x3f04e4;};}function handleError(_0x57b79d,_0x317080){_0x317080=_0x317080||0x1f4;return function(_0x53b855){logger[_0xc06e('0x21')](_0x53b855[_0xc06e('0x32')]);if(_0x53b855[_0xc06e('0x33')]){delete _0x53b855[_0xc06e('0x33')];}_0x57b79d[_0xc06e('0x2b')](_0x317080)[_0xc06e('0x34')](_0x53b855);};}exports[_0xc06e('0x35')]=function(_0x33182f,_0x17498d){var _0x5e0793={},_0x2e10ef={},_0x2a70a6={'count':0x0,'rows':[]};var _0x16b021=_[_0xc06e('0x36')](db['ChatMessage'][_0xc06e('0x37')],function(_0x45bcc3){return{'name':_0x45bcc3[_0xc06e('0x38')],'type':_0x45bcc3['type'][_0xc06e('0x39')]};});_0x2e10ef[_0xc06e('0x3a')]=_[_0xc06e('0x36')](_0x16b021,'name');_0x2e10ef[_0xc06e('0x3b')]=_[_0xc06e('0x3c')](_0x33182f[_0xc06e('0x3b')]);_0x2e10ef['filters']=_['intersection'](_0x2e10ef[_0xc06e('0x3a')],_0x2e10ef[_0xc06e('0x3b')]);_0x5e0793[_0xc06e('0x3d')]=_[_0xc06e('0x3e')](_0x2e10ef['model'],qs[_0xc06e('0x3f')](_0x33182f['query'][_0xc06e('0x3f')]));_0x5e0793['attributes']=_0x5e0793['attributes'][_0xc06e('0x40')]?_0x5e0793[_0xc06e('0x3d')]:_0x2e10ef['model'];if(!_0x33182f[_0xc06e('0x3b')]['hasOwnProperty'](_0xc06e('0x41'))){_0x5e0793['limit']=qs['limit'](_0x33182f[_0xc06e('0x3b')][_0xc06e('0x2a')]);_0x5e0793[_0xc06e('0x28')]=qs[_0xc06e('0x28')](_0x33182f[_0xc06e('0x3b')]['offset']);}_0x5e0793[_0xc06e('0x42')]=qs['sort'](_0x33182f[_0xc06e('0x3b')][_0xc06e('0x43')]);_0x5e0793['where']=qs[_0xc06e('0x44')](_[_0xc06e('0x45')](_0x33182f[_0xc06e('0x3b')],_0x2e10ef[_0xc06e('0x44')]),_0x16b021);if(_0x33182f[_0xc06e('0x3b')][_0xc06e('0x46')]){_0x5e0793[_0xc06e('0x47')]=_[_0xc06e('0x48')](_0x5e0793[_0xc06e('0x47')],{'$or':_['map'](_0x16b021,function(_0x2971a7){if(_0x2971a7['type']!==_0xc06e('0x49')){var _0x3f7146={};_0x3f7146[_0x2971a7['name']]={'$like':'%'+_0x33182f[_0xc06e('0x3b')][_0xc06e('0x46')]+'%'};return _0x3f7146;}})});}_0x5e0793=_[_0xc06e('0x48')]({},_0x5e0793,_0x33182f[_0xc06e('0x4a')]);var _0x4c26f9={'where':_0x5e0793['where']};return db[_0xc06e('0x4b')][_0xc06e('0x4c')](_0x4c26f9)[_0xc06e('0x31')](function(_0x1045bb){_0x2a70a6[_0xc06e('0x4c')]=_0x1045bb;if(_0x33182f['query'][_0xc06e('0x4d')]){_0x5e0793[_0xc06e('0x4e')]=[{'all':!![]}];}return db[_0xc06e('0x4b')][_0xc06e('0x4f')](_0x5e0793);})[_0xc06e('0x31')](function(_0x805c8b){_0x2a70a6[_0xc06e('0x50')]=_0x805c8b;return _0x2a70a6;})['then'](respondWithFilteredResult(_0x17498d,_0x5e0793))[_0xc06e('0x51')](handleError(_0x17498d,null));};exports['show']=function(_0x3bd50b,_0x45d284){var _0x5b0bbd={'raw':!![],'where':{'id':_0x3bd50b[_0xc06e('0x52')]['id']}},_0x11048f={};_0x11048f[_0xc06e('0x3a')]=_[_0xc06e('0x3c')](db[_0xc06e('0x4b')][_0xc06e('0x37')]);_0x11048f[_0xc06e('0x3b')]=_[_0xc06e('0x3c')](_0x3bd50b[_0xc06e('0x3b')]);_0x11048f['filters']=_[_0xc06e('0x3e')](_0x11048f['model'],_0x11048f[_0xc06e('0x3b')]);_0x5b0bbd['attributes']=_['intersection'](_0x11048f[_0xc06e('0x3a')],qs['fields'](_0x3bd50b['query'][_0xc06e('0x3f')]));_0x5b0bbd[_0xc06e('0x3d')]=_0x5b0bbd[_0xc06e('0x3d')]['length']?_0x5b0bbd[_0xc06e('0x3d')]:_0x11048f[_0xc06e('0x3a')];if(_0x3bd50b['query'][_0xc06e('0x4d')]){_0x5b0bbd[_0xc06e('0x4e')]=[{'all':!![]}];}_0x5b0bbd=_['merge']({},_0x5b0bbd,_0x3bd50b['options']);return db[_0xc06e('0x4b')]['find'](_0x5b0bbd)['then'](handleEntityNotFound(_0x45d284,null))['then'](respondWithResult(_0x45d284,null))[_0xc06e('0x51')](handleError(_0x45d284,null));};exports[_0xc06e('0x53')]=function(_0x5d607f,_0x4aebab){return db['ChatMessage'][_0xc06e('0x53')](_0x5d607f[_0xc06e('0x54')],{})[_0xc06e('0x31')](respondWithResult(_0x4aebab,0xc9))['catch'](handleError(_0x4aebab,null));};exports[_0xc06e('0x30')]=function(_0x323373,_0x60b164){if(_0x323373[_0xc06e('0x54')]['id']){delete _0x323373['body']['id'];}return db[_0xc06e('0x4b')][_0xc06e('0x55')]({'where':{'id':_0x323373[_0xc06e('0x52')]['id']}})[_0xc06e('0x31')](handleEntityNotFound(_0x60b164,null))[_0xc06e('0x31')](saveUpdates(_0x323373[_0xc06e('0x54')],null))[_0xc06e('0x31')](respondWithResult(_0x60b164,null))[_0xc06e('0x51')](handleError(_0x60b164,null));};exports[_0xc06e('0x56')]=function(_0x1e05a9,_0x431b83){return db[_0xc06e('0x4b')][_0xc06e('0x55')]({'where':{'id':_0x1e05a9[_0xc06e('0x52')]['id']}})['then'](handleEntityNotFound(_0x431b83,null))[_0xc06e('0x31')](removeEntity(_0x431b83,null))[_0xc06e('0x51')](handleError(_0x431b83,null));};exports[_0xc06e('0x57')]=function(_0x50d341,_0x2ae4c5){return db[_0xc06e('0x4b')][_0xc06e('0x57')]()[_0xc06e('0x31')](respondWithResult(_0x2ae4c5,null))[_0xc06e('0x51')](handleError(_0x2ae4c5,null));};var interaction_log=require(_0xc06e('0x10'))('chat-interactions');exports[_0xc06e('0x58')]=function(_0x2b9a47,_0x2b87f8,_0x288ee4){var _0x432154={'agent':{},'channel':_0xc06e('0x59')};if(_0x2b9a47['body']['id']){delete _0x2b9a47[_0xc06e('0x54')]['id'];}_0x2b9a47[_0xc06e('0x54')][_0xc06e('0x5a')]=!![];_0x2b9a47[_0xc06e('0x54')][_0xc06e('0x5b')]=moment()[_0xc06e('0x5c')](_0xc06e('0x5d'));_0x2b9a47['body'][_0xc06e('0x5e')]=_0x2b9a47[_0xc06e('0x54')][_0xc06e('0x5e')]||_0x2b9a47[_0xc06e('0x5f')]['id'];_0x432154[_0xc06e('0x60')]['id']=_0x2b9a47['body']['UserId'];return db[_0xc06e('0x4b')][_0xc06e('0x55')]({'where':{'id':_0x2b9a47[_0xc06e('0x52')]['id'],'UserId':null}})[_0xc06e('0x31')](handleEntityNotFound(_0x2b87f8,null))[_0xc06e('0x31')](saveUpdates(_0x2b9a47[_0xc06e('0x54')],null))['then'](function(_0x4c691e){if(_0x4c691e){_0x432154[_0xc06e('0x23')]=_0x4c691e[_0xc06e('0x61')]({'plain':!![]});return db[_0xc06e('0x62')]['find']({'where':{'id':_0x4c691e[_0xc06e('0x63')]}});}return null;})[_0xc06e('0x31')](handleEntityNotFound(_0x2b87f8,null))[_0xc06e('0x31')](function(_0x585434){if(_0x585434){return _0x585434[_0xc06e('0x30')]({'UserId':_0x2b9a47[_0xc06e('0x54')][_0xc06e('0x5e')],'read1stAt':_['isNil'](_0x585434['read1stAt'])?moment()[_0xc06e('0x5c')](_0xc06e('0x5d')):undefined});}return null;})[_0xc06e('0x31')](function(_0x29c6df){if(_0x29c6df){_0x432154[_0xc06e('0x64')]=_0x29c6df[_0xc06e('0x61')]({'plain':!![]});interaction_log[_0xc06e('0x1c')](_0xc06e('0x65'),_0x2b9a47[_0xc06e('0x5f')]['id'],_0x2b9a47[_0xc06e('0x5f')][_0xc06e('0x33')],_0x2b9a47['user'][_0xc06e('0x66')],_0x432154[_0xc06e('0x64')]['id'],_0x2b9a47[_0xc06e('0x54')]?JSON[_0xc06e('0x67')](_0x2b9a47[_0xc06e('0x54')]):_0xc06e('0x68'));return respondWithRpcPromise(_0xc06e('0x69'),_0xc06e('0x6a'),_0x432154);}return null;})[_0xc06e('0x31')](function(_0x3ecb17){var _0x34aa0e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3ecb17[_0xc06e('0x23')][_0xc06e('0x6b')];return db[_0xc06e('0x6c')][_0xc06e('0x3b')](_0x34aa0e,{'type':db[_0xc06e('0x6d')][_0xc06e('0x6e')][_0xc06e('0x6f')],'raw':!![]})['then'](function(_0xca8334){return _0xca8334;});})[_0xc06e('0x31')](function(_0x2cc4de){if(_0x2cc4de){_0x432154['message']['contact']=_0x2cc4de[0x0];if(!_0x2b9a47[_0xc06e('0x54')][_0xc06e('0x5e')])return;return db['User'][_0xc06e('0x55')]({'where':{'id':_0x2b9a47['body'][_0xc06e('0x5e')],'role':'agent'},'attributes':['id',_0xc06e('0x33'),_0xc06e('0x70'),_0xc06e('0x71'),_0xc06e('0x72')],'raw':!![]});}return null;})[_0xc06e('0x31')](function(_0x4e6613){if(!_0x4e6613)return null;_0x432154['message'][_0xc06e('0x60')]=_0x4e6613;return _0x432154;})[_0xc06e('0x31')](function(_0x5db2f5){if(_0x5db2f5){if(_0x2b9a47[_0xc06e('0x54')][_0xc06e('0x73')]){_0x432154['message'][_0xc06e('0x74')]=util['format'](_0xc06e('0x75'),_0x2b9a47['user']['name']);_0x432154['message'][_0xc06e('0x76')]=_0x432154[_0xc06e('0x76')];_0x432154[_0xc06e('0x23')][_0xc06e('0x77')]=_0x432154[_0xc06e('0x76')];_0x432154[_0xc06e('0x23')][_0xc06e('0x78')]=_0xc06e('0x58');return respondWithRpcPromise('EventManager',_0xc06e('0x79'),{'event':'acceptmessage','message':_[_0xc06e('0x48')](_0x432154[_0xc06e('0x23')],JSON[_0xc06e('0x7a')](_0x432154[_0xc06e('0x64')][_0xc06e('0x7b')]))},client9002)[_0xc06e('0x31')](function(){return _0x432154;});}return _0x432154;}return null;})[_0xc06e('0x31')](respondWithResult(_0x2b87f8,null))['catch'](handleError(_0x2b87f8,null));};var interaction_log=require(_0xc06e('0x10'))(_0xc06e('0x7c'));exports[_0xc06e('0x2f')]=function(_0xf66806,_0x3adc15,_0x1b9312){var _0x1927e1={'agent':{},'channel':_0xc06e('0x59')};if(_0xf66806['body']['id']){delete _0xf66806['body']['id'];}_0xf66806[_0xc06e('0x54')][_0xc06e('0x5e')]=_0xf66806[_0xc06e('0x54')][_0xc06e('0x5e')]||_0xf66806['user']['id'];_0x1927e1[_0xc06e('0x60')]['id']=_0xf66806[_0xc06e('0x54')]['UserId'];return db[_0xc06e('0x4b')][_0xc06e('0x55')]({'where':{'id':_0xf66806[_0xc06e('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3adc15,null))[_0xc06e('0x31')](function(_0x15ff44){if(_0x15ff44){_0x1927e1[_0xc06e('0x23')]=_0x15ff44[_0xc06e('0x61')]({'plain':!![]});return db[_0xc06e('0x62')]['find']({'where':{'id':_0x15ff44[_0xc06e('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x3adc15,null))[_0xc06e('0x31')](function(_0x5bcf0c){if(_0x5bcf0c){_0x1927e1[_0xc06e('0x64')]=_0x5bcf0c[_0xc06e('0x61')]({'plain':!![]});interaction_log['info'](_0xc06e('0x7d'),_0xf66806[_0xc06e('0x5f')]['id'],_0xf66806[_0xc06e('0x5f')][_0xc06e('0x33')],_0xf66806[_0xc06e('0x5f')]['role'],_0x1927e1[_0xc06e('0x64')]['id'],_0xf66806['body']?JSON[_0xc06e('0x67')](_0xf66806['body']):_0xc06e('0x68'));return respondWithRpcPromise(_0xc06e('0x7e'),_0xc06e('0x7f'),_0x1927e1);}return null;})[_0xc06e('0x31')](function(_0x5d981e){var _0x13125c=_0xc06e('0x80')+_0x5d981e[_0xc06e('0x23')][_0xc06e('0x6b')];return db['sequelize']['query'](_0x13125c,{'type':db[_0xc06e('0x6d')]['QueryTypes'][_0xc06e('0x6f')],'raw':!![]})[_0xc06e('0x31')](function(_0x4aa11e){return _0x4aa11e;});})[_0xc06e('0x31')](function(_0x91765f){if(_0x91765f){_0x1927e1[_0xc06e('0x23')]['contact']=_0x91765f[0x0];if(!_0xf66806[_0xc06e('0x54')]['UserId'])return;return db['User'][_0xc06e('0x55')]({'where':{'id':_0xf66806[_0xc06e('0x54')][_0xc06e('0x5e')],'role':_0xc06e('0x60')},'attributes':['id',_0xc06e('0x33'),_0xc06e('0x70'),'email',_0xc06e('0x72')],'raw':!![]});}return null;})['then'](function(_0x3f6540){if(!_0x3f6540)return null;_0x1927e1['message']['agent']=_0x3f6540;return _0x1927e1;})['then'](function(_0x1a9d8d){if(_0x1a9d8d){_0x1a9d8d[_0xc06e('0x23')][_0xc06e('0x74')]=util[_0xc06e('0x5c')](_0xc06e('0x75'),_0xf66806[_0xc06e('0x5f')][_0xc06e('0x33')]);_0x1a9d8d[_0xc06e('0x23')][_0xc06e('0x76')]=_0x1927e1['channel'];_0x1a9d8d[_0xc06e('0x23')][_0xc06e('0x77')]=_0x1927e1[_0xc06e('0x76')];_0x1a9d8d['message'][_0xc06e('0x78')]=_0xc06e('0x2f');respondWithRpcPromise(_0xc06e('0x79'),_0xc06e('0x79'),{'event':_0xc06e('0x81'),'message':_[_0xc06e('0x48')](_0x1927e1[_0xc06e('0x23')],JSON[_0xc06e('0x7a')](_0x1927e1[_0xc06e('0x64')][_0xc06e('0x7b')]))},client9002);return _0x1927e1;}return null;})[_0xc06e('0x31')](respondWithResult(_0x3adc15,null))['catch'](handleError(_0x3adc15,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 3fed642..c36cc67 100644 --- a/server/api/chatMessage/chatMessage.events.js +++ b/server/api/chatMessage/chatMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xceeb=['remove','emit','hook','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x4b9488,_0x4544d2){var _0x5f59b8=function(_0x275d00){while(--_0x275d00){_0x4b9488['push'](_0x4b9488['shift']());}};_0x5f59b8(++_0x4544d2);}(_0xceeb,0xb3));var _0xbcee=function(_0x50e38a,_0x10ae4e){_0x50e38a=_0x50e38a-0x0;var _0x1c4785=_0xceeb[_0x50e38a];return _0x1c4785;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xbcee('0x0'))['db'][_0xbcee('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbcee('0x2')](0x0);var events={'afterCreate':_0xbcee('0x3'),'afterUpdate':_0xbcee('0x4'),'afterDestroy':_0xbcee('0x5')};function emitEvent(_0x41def0){return function(_0x27ef66,_0x5295d2,_0x51ed81){ChatMessageEvents[_0xbcee('0x6')](_0x41def0+':'+_0x27ef66['id'],_0x27ef66);ChatMessageEvents[_0xbcee('0x6')](_0x41def0,_0x27ef66);_0x51ed81(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xbcee('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xa816=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x32de42,_0xc16852){var _0x1eba0f=function(_0x246d99){while(--_0x246d99){_0x32de42['push'](_0x32de42['shift']());}};_0x1eba0f(++_0xc16852);}(_0xa816,0x17a));var _0x6a81=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xa816[_0x39e283];return _0x7de89f;};'use strict';var EventEmitter=require(_0x6a81('0x0'));var ChatMessage=require(_0x6a81('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a81('0x2'),'afterUpdate':_0x6a81('0x3'),'afterDestroy':_0x6a81('0x4')};function emitEvent(_0x2cc762){return function(_0x5087d1,_0x2ce908,_0x25b962){ChatMessageEvents[_0x6a81('0x5')](_0x2cc762+':'+_0x5087d1['id'],_0x5087d1);ChatMessageEvents[_0x6a81('0x5')](_0x2cc762,_0x5087d1);_0x25b962(null);};}for(var e in events){if(events[_0x6a81('0x6')](e)){var event=events[e];ChatMessage[_0x6a81('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 2d409fd..2724080 100644 --- a/server/api/chatMessage/chatMessage.model.js +++ b/server/api/chatMessage/chatMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdade=['then','utf8mb4','lodash','api','moment','path','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId'];(function(_0x5d61e3,_0x5dd19a){var _0xc18c02=function(_0x1809c2){while(--_0x1809c2){_0x5d61e3['push'](_0x5d61e3['shift']());}};_0xc18c02(++_0x5dd19a);}(_0xdade,0x1e6));var _0xedad=function(_0x2467b8,_0x584199){_0x2467b8=_0x2467b8-0x0;var _0x5d3095=_0xdade[_0x2467b8];return _0x5d3095;};'use strict';var _=require(_0xedad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xedad('0x1'));var moment=require(_0xedad('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xedad('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xedad('0x4'));module[_0xedad('0x5')]=function(_0x3ab906,_0x4df785){return _0x3ab906['define'](_0xedad('0x6'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xedad('0x7'),'fields':[_0xedad('0x8')],'type':_0xedad('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35df2d,_0x1486a0,_0x3f913e){var _0x4f5a21=_0x3ab906[_0xedad('0xa')];var _0x46d5f5=_0x35df2d[_0xedad('0xb')]({'plain':!![]});if(_0x46d5f5[_0xedad('0xc')][_0xedad('0xd')]()==='in'||_0x46d5f5[_0xedad('0xc')][_0xedad('0xd')]()===_0xedad('0xe')&&!_0x46d5f5[_0xedad('0xf')]&&!_[_0xedad('0x10')](_0x46d5f5[_0xedad('0x11')])){_0x4f5a21['ChatInteraction'][_0xedad('0x12')]({'where':{'id':_0x46d5f5[_0xedad('0x13')]}})[_0xedad('0x14')](function(_0x46074c){if(_0x46074c){_0x46074c['update']({'lastMsgAt':_0x46d5f5['createdAt'],'lastMsgDirection':_0x46d5f5[_0xedad('0xc')]['toLowerCase']()});}})['catch'](function(_0x31b750){console['error'](_0x31b750);});}_0x3f913e();}},'charset':_0xedad('0x15'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6b38=['../../config/environment','./chatMessage.attributes','exports','fti_chat_messages','body','FULLTEXT','get','direction','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','update','createdAt','toLowerCase','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3710eb,_0x4c8a29){var _0x4106e0=function(_0xa45fc9){while(--_0xa45fc9){_0x3710eb['push'](_0x3710eb['shift']());}};_0x4106e0(++_0x4c8a29);}(_0x6b38,0x65));var _0x86b3=function(_0xa6dc22,_0x1bdca9){_0xa6dc22=_0xa6dc22-0x0;var _0x31eca1=_0x6b38[_0xa6dc22];return _0x31eca1;};'use strict';var _=require(_0x86b3('0x0'));var util=require(_0x86b3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x86b3('0x2'));var BPromise=require(_0x86b3('0x3'));var rp=require(_0x86b3('0x4'));var fs=require('fs');var path=require(_0x86b3('0x5'));var rimraf=require(_0x86b3('0x6'));var config=require(_0x86b3('0x7'));var attributes=require(_0x86b3('0x8'));module[_0x86b3('0x9')]=function(_0x243be1,_0x337125){return _0x243be1['define']('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x86b3('0xa'),'fields':[_0x86b3('0xb')],'type':_0x86b3('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32f261,_0x38342e,_0x911903){var _0x35afb5=_0x243be1['models'];var _0x4abfad=_0x32f261[_0x86b3('0xd')]({'plain':!![]});if(_0x4abfad[_0x86b3('0xe')]['toLowerCase']()==='in'||_0x4abfad[_0x86b3('0xe')]['toLowerCase']()===_0x86b3('0xf')&&!_0x4abfad[_0x86b3('0x10')]&&!_[_0x86b3('0x11')](_0x4abfad[_0x86b3('0x12')])){_0x35afb5[_0x86b3('0x13')]['findOne']({'where':{'id':_0x4abfad[_0x86b3('0x14')]}})['then'](function(_0x514e90){if(_0x514e90){_0x514e90[_0x86b3('0x15')]({'lastMsgAt':_0x4abfad[_0x86b3('0x16')],'lastMsgDirection':_0x4abfad[_0x86b3('0xe')][_0x86b3('0x17')]()});}})[_0x86b3('0x18')](function(_0x11b1da){console['error'](_0x11b1da);});}_0x911903();}},'charset':_0x86b3('0x19'),'collate':_0x86b3('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 2b5e621..2aae441 100644 --- a/server/api/chatMessage/chatMessage.rpc.js +++ b/server/api/chatMessage/chatMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf39e=['socket.io-emitter','./chatMessage.socket','register','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','then','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','defaults','redis','localhost'];(function(_0x437e08,_0x1cab6c){var _0xcf57f2=function(_0x2ef02e){while(--_0x2ef02e){_0x437e08['push'](_0x437e08['shift']());}};_0xcf57f2(++_0x1cab6c);}(_0xf39e,0x18b));var _0xef39=function(_0x258df0,_0x31ce33){_0x258df0=_0x258df0-0x0;var _0x2a96fe=_0xf39e[_0x258df0];return _0x2a96fe;};'use strict';var _=require(_0xef39('0x0'));var util=require(_0xef39('0x1'));var moment=require(_0xef39('0x2'));var BPromise=require('bluebird');var rs=require(_0xef39('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef39('0x4'))['db'];var utils=require(_0xef39('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xef39('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xef39('0x7')]['http']({'port':0x232a});config['redis']=_[_0xef39('0x8')](config[_0xef39('0x9')],{'host':_0xef39('0xa'),'port':0x18eb});var socket=require(_0xef39('0xb'))(new Redis(config[_0xef39('0x9')]));require(_0xef39('0xc'))[_0xef39('0xd')](socket);function respondWithRpcPromise(_0x475324,_0x4f5bf0,_0x22dcab){return new BPromise(function(_0x7db2cb,_0x6b306c){return client['request'](_0x475324,_0x22dcab)['then'](function(_0x236ef4){logger[_0xef39('0xe')](_0xef39('0xf'),_0x4f5bf0,'request\x20sent');logger['debug'](_0xef39('0x10'),_0x4f5bf0,_0xef39('0x11'),JSON['stringify'](_0x236ef4));if(_0x236ef4[_0xef39('0x12')]){if(_0x236ef4[_0xef39('0x12')]['code']===0x1f4){logger[_0xef39('0x12')](_0xef39('0xf'),_0x4f5bf0,_0x236ef4[_0xef39('0x12')][_0xef39('0x13')]);return _0x6b306c(_0x236ef4[_0xef39('0x12')][_0xef39('0x13')]);}logger[_0xef39('0x12')]('ChatMessage,\x20%s,\x20%s',_0x4f5bf0,_0x236ef4[_0xef39('0x12')][_0xef39('0x13')]);return _0x7db2cb(_0x236ef4['error'][_0xef39('0x13')]);}else{logger['info'](_0xef39('0xf'),_0x4f5bf0,_0xef39('0x11'));_0x7db2cb(_0x236ef4[_0xef39('0x14')][_0xef39('0x13')]);}})[_0xef39('0x15')](function(_0x56d97a){logger[_0xef39('0x12')]('ChatMessage,\x20%s,\x20%s',_0x4f5bf0,_0x56d97a);_0x6b306c(_0x56d97a);});});}exports[_0xef39('0x16')]=function(_0x79c8b2){var _0x1fec7f=this;return new Promise(function(_0x1bc3e8,_0x6ab6eb){return db[_0xef39('0x17')][_0xef39('0x18')](_0x79c8b2['body'],{'raw':_0x79c8b2[_0xef39('0x19')]?_0x79c8b2['options'][_0xef39('0x1a')]===undefined?!![]:![]:!![]})[_0xef39('0x1b')](function(_0x211abe){logger[_0xef39('0xe')](_0xef39('0x16'),_0x79c8b2);logger[_0xef39('0x1c')](_0xef39('0x16'),_0x79c8b2,JSON['stringify'](_0x211abe));_0x1bc3e8(_0x211abe);})[_0xef39('0x15')](function(_0x40a942){logger['error'](_0xef39('0x16'),_0x40a942[_0xef39('0x13')],_0x79c8b2);_0x6ab6eb(_0x1fec7f['error'](0x1f4,_0x40a942[_0xef39('0x13')]));});});}; \ No newline at end of file +var _0x5d99=['error','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3f553b,_0x49a9c2){var _0x183c4e=function(_0x873b22){while(--_0x873b22){_0x3f553b['push'](_0x3f553b['shift']());}};_0x183c4e(++_0x49a9c2);}(_0x5d99,0x1b7));var _0x95d9=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x5d99[_0x256d6a];return _0x460058;};'use strict';var _=require(_0x95d9('0x0'));var util=require(_0x95d9('0x1'));var moment=require(_0x95d9('0x2'));var BPromise=require(_0x95d9('0x3'));var rs=require(_0x95d9('0x4'));var fs=require('fs');var Redis=require(_0x95d9('0x5'));var db=require(_0x95d9('0x6'))['db'];var utils=require(_0x95d9('0x7'));var logger=require(_0x95d9('0x8'))(_0x95d9('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x95d9('0xa')][_0x95d9('0xb')]({'port':0x232a});config[_0x95d9('0xc')]=_['defaults'](config['redis'],{'host':_0x95d9('0xd'),'port':0x18eb});var socket=require(_0x95d9('0xe'))(new Redis(config['redis']));require(_0x95d9('0xf'))[_0x95d9('0x10')](socket);function respondWithRpcPromise(_0x32ed58,_0x5d5ceb,_0x626bb7){return new BPromise(function(_0x19214c,_0x563ae1){return client['request'](_0x32ed58,_0x626bb7)[_0x95d9('0x11')](function(_0x36d167){logger[_0x95d9('0x12')](_0x95d9('0x13'),_0x5d5ceb,_0x95d9('0x14'));logger[_0x95d9('0x15')](_0x95d9('0x16'),_0x5d5ceb,_0x95d9('0x14'),JSON['stringify'](_0x36d167));if(_0x36d167[_0x95d9('0x17')]){if(_0x36d167[_0x95d9('0x17')]['code']===0x1f4){logger[_0x95d9('0x17')](_0x95d9('0x13'),_0x5d5ceb,_0x36d167[_0x95d9('0x17')][_0x95d9('0x18')]);return _0x563ae1(_0x36d167[_0x95d9('0x17')]['message']);}logger[_0x95d9('0x17')](_0x95d9('0x13'),_0x5d5ceb,_0x36d167[_0x95d9('0x17')]['message']);return _0x19214c(_0x36d167[_0x95d9('0x17')][_0x95d9('0x18')]);}else{logger[_0x95d9('0x12')](_0x95d9('0x13'),_0x5d5ceb,_0x95d9('0x14'));_0x19214c(_0x36d167[_0x95d9('0x19')][_0x95d9('0x18')]);}})[_0x95d9('0x1a')](function(_0x57c94e){logger[_0x95d9('0x17')]('ChatMessage,\x20%s,\x20%s',_0x5d5ceb,_0x57c94e);_0x563ae1(_0x57c94e);});});}exports[_0x95d9('0x1b')]=function(_0x14f4f0){var _0x5e9052=this;return new Promise(function(_0x35aa6c,_0x171791){return db[_0x95d9('0x1c')][_0x95d9('0x1d')](_0x14f4f0[_0x95d9('0x1e')],{'raw':_0x14f4f0['options']?_0x14f4f0[_0x95d9('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x95d9('0x11')](function(_0x20b81d){logger[_0x95d9('0x12')](_0x95d9('0x1b'),_0x14f4f0);logger[_0x95d9('0x15')]('CreateChatMessage',_0x14f4f0,JSON[_0x95d9('0x20')](_0x20b81d));_0x35aa6c(_0x20b81d);})[_0x95d9('0x1a')](function(_0x36b5bf){logger[_0x95d9('0x17')]('CreateChatMessage',_0x36b5bf[_0x95d9('0x18')],_0x14f4f0);_0x171791(_0x5e9052[_0x95d9('0x17')](0x1f4,_0x36b5bf['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 5ee359e..a8594e0 100644 --- a/server/api/chatMessage/chatMessage.socket.js +++ b/server/api/chatMessage/chatMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x448b=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x1f5738,_0x351b9d){var _0x4e0aa3=function(_0x21614f){while(--_0x21614f){_0x1f5738['push'](_0x1f5738['shift']());}};_0x4e0aa3(++_0x351b9d);}(_0x448b,0x125));var _0xb448=function(_0x4095ab,_0x5f0de7){_0x4095ab=_0x4095ab-0x0;var _0x54dcd0=_0x448b[_0x4095ab];return _0x54dcd0;};'use strict';var ChatMessageEvents=require(_0xb448('0x0'));var events=[_0xb448('0x1'),_0xb448('0x2'),_0xb448('0x3')];function createListener(_0x422fa2,_0x51583a){return function(_0x5bf7db){_0x51583a[_0xb448('0x4')](_0x422fa2,_0x5bf7db);};}function removeListener(_0x32bcae,_0x172a89){return function(){ChatMessageEvents[_0xb448('0x5')](_0x32bcae,_0x172a89);};}exports[_0xb448('0x6')]=function(_0x276466){for(var _0x3670cb=0x0,_0x5993ad=events[_0xb448('0x7')];_0x3670cb<_0x5993ad;_0x3670cb++){var _0x2f6f82=events[_0x3670cb];var _0x2c2bdd=createListener(_0xb448('0x8')+_0x2f6f82,_0x276466);ChatMessageEvents['on'](_0x2f6f82,_0x2c2bdd);}}; \ No newline at end of file +var _0xeb0d=['removeListener','register','./chatMessage.events','emit'];(function(_0x41a93b,_0x2fc19d){var _0x220a7e=function(_0x5ecb05){while(--_0x5ecb05){_0x41a93b['push'](_0x41a93b['shift']());}};_0x220a7e(++_0x2fc19d);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x4d9ae7,_0x216573){_0x4d9ae7=_0x4d9ae7-0x0;var _0xc4e2bb=_0xeb0d[_0x4d9ae7];return _0xc4e2bb;};'use strict';var ChatMessageEvents=require(_0xdeb0('0x0'));var events=['save','remove','update'];function createListener(_0x256ce4,_0x430873){return function(_0x538fc2){_0x430873[_0xdeb0('0x1')](_0x256ce4,_0x538fc2);};}function removeListener(_0x36367c,_0xd8dd51){return function(){ChatMessageEvents[_0xdeb0('0x2')](_0x36367c,_0xd8dd51);};}exports[_0xdeb0('0x3')]=function(_0x13d486){for(var _0xc48108=0x0,_0x27ebaa=events['length'];_0xc48108<_0x27ebaa;_0xc48108++){var _0x28a1a4=events[_0xc48108];var _0x16b36b=createListener('chatMessage:'+_0x28a1a4,_0x13d486);ChatMessageEvents['on'](_0x28a1a4,_0x16b36b);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 5de8cb8..b9356f3 100644 --- a/server/api/chatMessage/index.js +++ b/server/api/chatMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x464d=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','chatmessage:create','create','update','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x177b7b,_0x319e32){var _0x54e536=function(_0x1d2f05){while(--_0x1d2f05){_0x177b7b['push'](_0x177b7b['shift']());}};_0x54e536(++_0x319e32);}(_0x464d,0x15e));var _0xd464=function(_0x2a71d2,_0x35bcda){_0x2a71d2=_0x2a71d2-0x0;var _0x200112=_0x464d[_0x2a71d2];return _0x200112;};'use strict';var multer=require('multer');var util=require(_0xd464('0x0'));var path=require(_0xd464('0x1'));var timeout=require(_0xd464('0x2'));var express=require('express');var router=express[_0xd464('0x3')]();var fs_extra=require(_0xd464('0x4'));var auth=require(_0xd464('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd464('0x6'));var controller=require(_0xd464('0x7'));router['get']('/',auth[_0xd464('0x8')](),controller[_0xd464('0x9')]);router[_0xd464('0xa')](_0xd464('0xb'),auth[_0xd464('0x8')](),controller[_0xd464('0xc')]);router[_0xd464('0xa')](_0xd464('0xd'),auth['isAuthenticated'](),controller[_0xd464('0xe')]);router['post']('/',auth[_0xd464('0x8')](),interaction[_0xd464('0xf')]('chat',_0xd464('0x10')),controller[_0xd464('0x11')]);router['put'](_0xd464('0xd'),controller[_0xd464('0x12')]);router['put']('/:id/accept',auth[_0xd464('0x8')](),controller[_0xd464('0x13')]);router['put'](_0xd464('0x14'),auth['isAuthenticated'](),controller[_0xd464('0x15')]);router[_0xd464('0x16')](_0xd464('0xd'),auth[_0xd464('0x8')](),controller[_0xd464('0x17')]);module[_0xd464('0x18')]=router; \ No newline at end of file +var _0x3c71=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','create','put','/:id/accept','accept','delete','destroy','util','path','fs-extra'];(function(_0x47bd60,_0x22f024){var _0x523729=function(_0x9b333a){while(--_0x9b333a){_0x47bd60['push'](_0x47bd60['shift']());}};_0x523729(++_0x22f024);}(_0x3c71,0x165));var _0x13c7=function(_0x399dc3,_0x1916c8){_0x399dc3=_0x399dc3-0x0;var _0x1b0ade=_0x3c71[_0x399dc3];return _0x1b0ade;};'use strict';var multer=require('multer');var util=require(_0x13c7('0x0'));var path=require(_0x13c7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x13c7('0x2'));var auth=require(_0x13c7('0x3'));var interaction=require(_0x13c7('0x4'));var config=require(_0x13c7('0x5'));var controller=require(_0x13c7('0x6'));router[_0x13c7('0x7')]('/',auth[_0x13c7('0x8')](),controller[_0x13c7('0x9')]);router[_0x13c7('0x7')]('/describe',auth[_0x13c7('0x8')](),controller['describe']);router['get'](_0x13c7('0xa'),auth['isAuthenticated'](),controller[_0x13c7('0xb')]);router[_0x13c7('0xc')]('/',auth[_0x13c7('0x8')](),interaction[_0x13c7('0xd')]('chat','chatmessage:create'),controller[_0x13c7('0xe')]);router['put']('/:id',controller['update']);router[_0x13c7('0xf')](_0x13c7('0x10'),auth[_0x13c7('0x8')](),controller[_0x13c7('0x11')]);router[_0x13c7('0xf')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x13c7('0x12')](_0x13c7('0xa'),auth[_0x13c7('0x8')](),controller[_0x13c7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 4cbefb6..094e4a5 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['medium','sequelize','TEXT'];(function(_0x1f8e45,_0x386c27){var _0x41d697=function(_0x4d213b){while(--_0x4d213b){_0x1f8e45['push'](_0x1f8e45['shift']());}};_0x41d697(++_0x386c27);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f4d7f,_0x62f4b7){_0x2f4d7f=_0x2f4d7f-0x0;var _0x147ba1=_0xb10b[_0x2f4d7f];return _0x147ba1;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0b0e,0x187));var _0xe0b0=function(_0x406fbb,_0x1093e5){_0x406fbb=_0x406fbb-0x0;var _0x8e921d=_0x0b0e[_0x406fbb];return _0x8e921d;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 222016f..2569b05 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x47561b,_0x5d97db){var _0x218acd=function(_0xd0d9ac){while(--_0xd0d9ac){_0x47561b['push'](_0x47561b['shift']());}};_0x218acd(++_0x5d97db);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x24fe80,_0x2dfff4){_0x24fe80=_0x24fe80-0x0;var _0x1cfa9a=_0x7a54[_0x24fe80];return _0x1cfa9a;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index c63d6d3..96f5dca 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd035=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x376ed9,_0x10d4c0){var _0x1cb970=function(_0xb9f837){while(--_0xb9f837){_0x376ed9['push'](_0x376ed9['shift']());}};_0x1cb970(++_0x10d4c0);}(_0xd035,0xdc));var _0x5d03=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0xd035[_0xdd0313];return _0x2bd7e8;};'use strict';var EventEmitter=require(_0x5d03('0x0'));var ChatOfflineMessage=require(_0x5d03('0x1'))['db'][_0x5d03('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x5d03('0x3')](0x0);var events={'afterCreate':_0x5d03('0x4'),'afterUpdate':_0x5d03('0x5'),'afterDestroy':_0x5d03('0x6')};function emitEvent(_0x433e55){return function(_0x112aa1,_0x3c0aba,_0x33ddd8){ChatOfflineMessageEvents[_0x5d03('0x7')](_0x433e55+':'+_0x112aa1['id'],_0x112aa1);ChatOfflineMessageEvents['emit'](_0x433e55,_0x112aa1);_0x33ddd8(null);};}for(var e in events){if(events[_0x5d03('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x5d03('0x9')](e,emitEvent(event));}}module[_0x5d03('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x7fd5=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x5595ab,_0x1ff695){var _0x5402e5=function(_0x242514){while(--_0x242514){_0x5595ab['push'](_0x5595ab['shift']());}};_0x5402e5(++_0x1ff695);}(_0x7fd5,0xa0));var _0x57fd=function(_0x455b35,_0x5d2b5e){_0x455b35=_0x455b35-0x0;var _0x1fc095=_0x7fd5[_0x455b35];return _0x1fc095;};'use strict';var EventEmitter=require(_0x57fd('0x0'));var ChatOfflineMessage=require(_0x57fd('0x1'))['db'][_0x57fd('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x57fd('0x3')](0x0);var events={'afterCreate':_0x57fd('0x4'),'afterUpdate':_0x57fd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1c7ceb){return function(_0x312cb8,_0x6572cc,_0x3d08f7){ChatOfflineMessageEvents[_0x57fd('0x6')](_0x1c7ceb+':'+_0x312cb8['id'],_0x312cb8);ChatOfflineMessageEvents[_0x57fd('0x6')](_0x1c7ceb,_0x312cb8);_0x3d08f7(null);};}for(var e in events){if(events[_0x57fd('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x57fd('0x8')](e,emitEvent(event));}}module[_0x57fd('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 48b75d2..1623841 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.model.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5c8=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf5c8,0xd1));var _0x8f5c=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0xf5c8[_0x211632];return _0x5a1da1;};'use strict';var attributes=require(_0x8f5c('0x0'));module['exports']=function(_0x52db7b){return _0x52db7b['define']('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8f5c('0x1'),'collate':_0x8f5c('0x2')});}; \ No newline at end of file +var _0xc5da=['./chatOfflineMessage.attributes','exports','define','utf8mb4_unicode_ci'];(function(_0x5bf78a,_0x380699){var _0x457c8e=function(_0x2355e9){while(--_0x2355e9){_0x5bf78a['push'](_0x5bf78a['shift']());}};_0x457c8e(++_0x380699);}(_0xc5da,0x100));var _0xac5d=function(_0x5d9322,_0x11069c){_0x5d9322=_0x5d9322-0x0;var _0x3c616c=_0xc5da[_0x5d9322];return _0x3c616c;};'use strict';var attributes=require(_0xac5d('0x0'));module[_0xac5d('0x1')]=function(_0x3b7468){return _0x3b7468[_0xac5d('0x2')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xac5d('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 7c30969..88f8508 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4c2=['http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1a9740,_0x3cfd32){var _0x383ff6=function(_0x1dd73c){while(--_0x1dd73c){_0x1a9740['push'](_0x1a9740['shift']());}};_0x383ff6(++_0x3cfd32);}(_0xa4c2,0xc1));var _0x2a4c=function(_0x246694,_0x50cae1){_0x246694=_0x246694-0x0;var _0x38f821=_0xa4c2[_0x246694];return _0x38f821;};'use strict';var _=require(_0x2a4c('0x0'));var util=require('util');var moment=require(_0x2a4c('0x1'));var BPromise=require('bluebird');var rs=require(_0x2a4c('0x2'));var fs=require('fs');var Redis=require(_0x2a4c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2a4c('0x4'))('rpc');var config=require(_0x2a4c('0x5'));var jayson=require(_0x2a4c('0x6'));var client=jayson['client'][_0x2a4c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d2511,_0x9f8993,_0x41dfad){return new BPromise(function(_0x1f86e5,_0x25f1d3){return client['request'](_0x3d2511,_0x41dfad)[_0x2a4c('0x8')](function(_0x37f2c4){logger[_0x2a4c('0x9')](_0x2a4c('0xa'),_0x9f8993,_0x2a4c('0xb'));logger[_0x2a4c('0xc')](_0x2a4c('0xd'),_0x9f8993,'request\x20sent',JSON[_0x2a4c('0xe')](_0x37f2c4));if(_0x37f2c4['error']){if(_0x37f2c4['error'][_0x2a4c('0xf')]===0x1f4){logger[_0x2a4c('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x9f8993,_0x37f2c4[_0x2a4c('0x10')][_0x2a4c('0x11')]);return _0x25f1d3(_0x37f2c4['error'][_0x2a4c('0x11')]);}logger['error'](_0x2a4c('0xa'),_0x9f8993,_0x37f2c4['error'][_0x2a4c('0x11')]);return _0x1f86e5(_0x37f2c4[_0x2a4c('0x10')]['message']);}else{logger[_0x2a4c('0x9')](_0x2a4c('0xa'),_0x9f8993,'request\x20sent');_0x1f86e5(_0x37f2c4[_0x2a4c('0x12')][_0x2a4c('0x11')]);}})[_0x2a4c('0x13')](function(_0x47921d){logger[_0x2a4c('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x9f8993,_0x47921d);_0x25f1d3(_0x47921d);});});} \ No newline at end of file +var _0x3787=['request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x283864,_0x405a20){var _0x3f7482=function(_0x22cd1b){while(--_0x22cd1b){_0x283864['push'](_0x283864['shift']());}};_0x3f7482(++_0x405a20);}(_0x3787,0xd3));var _0x7378=function(_0x5761b6,_0x417a7b){_0x5761b6=_0x5761b6-0x0;var _0x2ce497=_0x3787[_0x5761b6];return _0x2ce497;};'use strict';var _=require('lodash');var util=require(_0x7378('0x0'));var moment=require('moment');var BPromise=require(_0x7378('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7378('0x2'));var logger=require(_0x7378('0x3'))(_0x7378('0x4'));var config=require(_0x7378('0x5'));var jayson=require(_0x7378('0x6'));var client=jayson[_0x7378('0x7')][_0x7378('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ff022,_0x295076,_0x4324c5){return new BPromise(function(_0x33e391,_0x397bf9){return client[_0x7378('0x9')](_0x3ff022,_0x4324c5)[_0x7378('0xa')](function(_0x258b54){logger[_0x7378('0xb')](_0x7378('0xc'),_0x295076,'request\x20sent');logger[_0x7378('0xd')](_0x7378('0xe'),_0x295076,'request\x20sent',JSON[_0x7378('0xf')](_0x258b54));if(_0x258b54[_0x7378('0x10')]){if(_0x258b54[_0x7378('0x10')][_0x7378('0x11')]===0x1f4){logger[_0x7378('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x295076,_0x258b54['error']['message']);return _0x397bf9(_0x258b54[_0x7378('0x10')][_0x7378('0x12')]);}logger['error'](_0x7378('0xc'),_0x295076,_0x258b54[_0x7378('0x10')]['message']);return _0x33e391(_0x258b54[_0x7378('0x10')]['message']);}else{logger[_0x7378('0xb')](_0x7378('0xc'),_0x295076,_0x7378('0x13'));_0x33e391(_0x258b54[_0x7378('0x14')][_0x7378('0x12')]);}})[_0x7378('0x15')](function(_0x582ca4){logger['error'](_0x7378('0xc'),_0x295076,_0x582ca4);_0x397bf9(_0x582ca4);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index cb2edb0..289e2e6 100644 --- a/server/api/chatOfflineMessage/index.js +++ b/server/api/chatOfflineMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x824c=['create','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x342628,_0xf4352e){var _0x3affa7=function(_0x179e0c){while(--_0x179e0c){_0x342628['push'](_0x342628['shift']());}};_0x3affa7(++_0xf4352e);}(_0x824c,0x6d));var _0xc824=function(_0x2b6730,_0x1bab44){_0x2b6730=_0x2b6730-0x0;var _0x5b6403=_0x824c[_0x2b6730];return _0x5b6403;};'use strict';var multer=require(_0xc824('0x0'));var util=require(_0xc824('0x1'));var path=require(_0xc824('0x2'));var timeout=require(_0xc824('0x3'));var express=require(_0xc824('0x4'));var router=express['Router']();var fs_extra=require(_0xc824('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc824('0x6'));var config=require(_0xc824('0x7'));var controller=require(_0xc824('0x8'));router[_0xc824('0x9')]('/',auth[_0xc824('0xa')](),controller[_0xc824('0xb')]);router[_0xc824('0x9')](_0xc824('0xc'),auth[_0xc824('0xa')](),controller[_0xc824('0xd')]);router[_0xc824('0x9')](_0xc824('0xe'),auth[_0xc824('0xa')](),controller[_0xc824('0xf')]);router[_0xc824('0x10')]('/',auth[_0xc824('0xa')](),controller[_0xc824('0x11')]);router[_0xc824('0x12')](_0xc824('0xe'),auth[_0xc824('0xa')](),controller['update']);router[_0xc824('0x13')]('/:id',auth[_0xc824('0xa')](),controller[_0xc824('0x14')]);module['exports']=router; \ No newline at end of file +var _0x90e1=['/:id','post','put','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe'];(function(_0x2fd442,_0x2fe25e){var _0x2d7ae7=function(_0x3ce907){while(--_0x3ce907){_0x2fd442['push'](_0x2fd442['shift']());}};_0x2d7ae7(++_0x2fe25e);}(_0x90e1,0x8b));var _0x190e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x90e1[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x190e('0x0'));var util=require(_0x190e('0x1'));var path=require('path');var timeout=require(_0x190e('0x2'));var express=require('express');var router=express[_0x190e('0x3')]();var fs_extra=require(_0x190e('0x4'));var auth=require(_0x190e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x190e('0x6'));var controller=require(_0x190e('0x7'));router[_0x190e('0x8')]('/',auth[_0x190e('0x9')](),controller['index']);router[_0x190e('0x8')]('/describe',auth[_0x190e('0x9')](),controller[_0x190e('0xa')]);router[_0x190e('0x8')](_0x190e('0xb'),auth[_0x190e('0x9')](),controller['show']);router[_0x190e('0xc')]('/',auth[_0x190e('0x9')](),controller['create']);router[_0x190e('0xd')]('/:id',auth[_0x190e('0x9')](),controller['update']);router['delete']('/:id',auth[_0x190e('0x9')](),controller['destroy']);module[_0x190e('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index f463d89..7279fb7 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.attributes.js +++ b/server/api/chatProactiveAction/chatProactiveAction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c1f=['sequelize','exports','STRING','mouseOver','timeout','INTEGER'];(function(_0x3aa2f5,_0x286fa0){var _0x43cf17=function(_0x7695f5){while(--_0x7695f5){_0x3aa2f5['push'](_0x3aa2f5['shift']());}};_0x43cf17(++_0x286fa0);}(_0x9c1f,0xa2));var _0xf9c1=function(_0x1a6ef7,_0x6bb449){_0x1a6ef7=_0x1a6ef7-0x0;var _0x4f0d4b=_0x9c1f[_0x1a6ef7];return _0x4f0d4b;};'use strict';var Sequelize=require(_0xf9c1('0x0'));module[_0xf9c1('0x1')]={'name':{'type':Sequelize[_0xf9c1('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf9c1('0x3'),_0xf9c1('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xf9c1('0x2')]},'timeout':{'type':Sequelize[_0xf9c1('0x5')]}}; \ No newline at end of file +var _0x2a7e=['INTEGER','sequelize','exports','ENUM','mouseOver','STRING'];(function(_0x12e9af,_0x56a602){var _0x3fbb38=function(_0x41303d){while(--_0x41303d){_0x12e9af['push'](_0x12e9af['shift']());}};_0x3fbb38(++_0x56a602);}(_0x2a7e,0xf7));var _0xe2a7=function(_0x3c35fe,_0x3d6f11){_0x3c35fe=_0x3c35fe-0x0;var _0x546e20=_0x2a7e[_0x3c35fe];return _0x546e20;};'use strict';var Sequelize=require(_0xe2a7('0x0'));module[_0xe2a7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe2a7('0x2')](_0xe2a7('0x3'),'timeout'),'defaultValue':_0xe2a7('0x3')},'selector':{'type':Sequelize[_0xe2a7('0x4')]},'timeout':{'type':Sequelize[_0xe2a7('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index e6f63b3..3b1c922 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce1a=['name','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','create','body','find','params','eml-format','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce1a,0xbf));var _0xace1=function(_0xdd5f90,_0x39278f){_0xdd5f90=_0xdd5f90-0x0;var _0x1df94d=_0xce1a[_0xdd5f90];return _0x1df94d;};'use strict';var emlformat=require(_0xace1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xace1('0x1'));var moment=require(_0xace1('0x2'));var BPromise=require(_0xace1('0x3'));var Mustache=require(_0xace1('0x4'));var util=require(_0xace1('0x5'));var path=require('path');var sox=require(_0xace1('0x6'));var csv=require('to-csv');var ejs=require(_0xace1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xace1('0x8'));var squel=require(_0xace1('0x9'));var crypto=require(_0xace1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xace1('0xb'));var querystring=require('querystring');var Papa=require(_0xace1('0xc'));var Redis=require(_0xace1('0xd'));var authService=require(_0xace1('0xe'));var qs=require(_0xace1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xace1('0x10'));var logger=require(_0xace1('0x11'))('api');var utils=require(_0xace1('0x12'));var config=require(_0xace1('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d771,_0x2e1d19){_0x2e1d19=_0x2e1d19||0xcc;return function(_0x2f59f3){if(_0x2f59f3){return _0x56d771[_0xace1('0x14')](_0x2e1d19);}return _0x56d771['status'](_0x2e1d19)['end']();};}function respondWithResult(_0x4e8389,_0x319d1a){_0x319d1a=_0x319d1a||0xc8;return function(_0x18d9ce){if(_0x18d9ce){return _0x4e8389[_0xace1('0x15')](_0x319d1a)[_0xace1('0x16')](_0x18d9ce);}};}function respondWithFilteredResult(_0x248193,_0x303080){return function(_0x25114d){if(_0x25114d){var _0x6cc04e=typeof _0x303080['offset']==='undefined'&&typeof _0x303080[_0xace1('0x17')]===_0xace1('0x18');var _0x49cb73=_0x25114d[_0xace1('0x19')];var _0x162a79=_0x6cc04e?0x0:_0x303080[_0xace1('0x1a')];var _0x45541e=_0x6cc04e?_0x25114d[_0xace1('0x19')]:_0x303080['offset']+_0x303080['limit'];var _0x1781aa;if(_0x45541e>=_0x49cb73){_0x45541e=_0x49cb73;_0x1781aa=0xc8;}else{_0x1781aa=0xce;}_0x248193['status'](_0x1781aa);return _0x248193[_0xace1('0x1b')](_0xace1('0x1c'),_0x162a79+'-'+_0x45541e+'/'+_0x49cb73)[_0xace1('0x16')](_0x25114d);}return null;};}function patchUpdates(_0x4fe2ba){return function(_0x183941){try{jsonpatch[_0xace1('0x1d')](_0x183941,_0x4fe2ba,!![]);}catch(_0x4fce58){return BPromise[_0xace1('0x1e')](_0x4fce58);}return _0x183941[_0xace1('0x1f')]();};}function saveUpdates(_0xe0bda8,_0x41ab2b){return function(_0x484ac1){if(_0x484ac1){return _0x484ac1[_0xace1('0x20')](_0xe0bda8)[_0xace1('0x21')](function(_0x15f2fb){return _0x15f2fb;});}return null;};}function removeEntity(_0x324b52,_0x120c33){return function(_0x9ff8a0){if(_0x9ff8a0){return _0x9ff8a0[_0xace1('0x22')]()[_0xace1('0x21')](function(){_0x324b52[_0xace1('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e99f5,_0x49cacb){return function(_0x937188){if(!_0x937188){_0x5e99f5[_0xace1('0x14')](0x194);}return _0x937188;};}function handleError(_0x4985b2,_0xe8723c){_0xe8723c=_0xe8723c||0x1f4;return function(_0x51ab2c){logger[_0xace1('0x23')](_0x51ab2c[_0xace1('0x24')]);if(_0x51ab2c[_0xace1('0x25')]){delete _0x51ab2c[_0xace1('0x25')];}_0x4985b2['status'](_0xe8723c)['send'](_0x51ab2c);};}exports[_0xace1('0x26')]=function(_0x455286,_0x1dacd0){var _0x2677da={'raw':!![],'where':{'id':_0x455286['params']['id']}},_0x4f52a9={};_0x4f52a9[_0xace1('0x27')]=_[_0xace1('0x28')](db[_0xace1('0x29')][_0xace1('0x2a')]);_0x4f52a9[_0xace1('0x2b')]=_[_0xace1('0x28')](_0x455286[_0xace1('0x2b')]);_0x4f52a9[_0xace1('0x2c')]=_[_0xace1('0x2d')](_0x4f52a9[_0xace1('0x27')],_0x4f52a9[_0xace1('0x2b')]);_0x2677da[_0xace1('0x2e')]=_[_0xace1('0x2d')](_0x4f52a9[_0xace1('0x27')],qs['fields'](_0x455286['query'][_0xace1('0x2f')]));_0x2677da['attributes']=_0x2677da[_0xace1('0x2e')][_0xace1('0x30')]?_0x2677da[_0xace1('0x2e')]:_0x4f52a9[_0xace1('0x27')];if(_0x455286[_0xace1('0x2b')][_0xace1('0x31')]){_0x2677da['include']=[{'all':!![]}];}_0x2677da=_[_0xace1('0x32')]({},_0x2677da,_0x455286[_0xace1('0x33')]);return db[_0xace1('0x29')]['find'](_0x2677da)['then'](handleEntityNotFound(_0x1dacd0,null))[_0xace1('0x21')](respondWithResult(_0x1dacd0,null))[_0xace1('0x34')](handleError(_0x1dacd0,null));};exports[_0xace1('0x35')]=function(_0x626aea,_0x37757a){return db[_0xace1('0x29')][_0xace1('0x35')](_0x626aea[_0xace1('0x36')],{})[_0xace1('0x21')](respondWithResult(_0x37757a,0xc9))[_0xace1('0x34')](handleError(_0x37757a,null));};exports[_0xace1('0x20')]=function(_0x3b6557,_0x374a11){if(_0x3b6557['body']['id']){delete _0x3b6557['body']['id'];}return db['ChatProactiveAction'][_0xace1('0x37')]({'where':{'id':_0x3b6557[_0xace1('0x38')]['id']}})['then'](handleEntityNotFound(_0x374a11,null))[_0xace1('0x21')](saveUpdates(_0x3b6557[_0xace1('0x36')],null))[_0xace1('0x21')](respondWithResult(_0x374a11,null))[_0xace1('0x34')](handleError(_0x374a11,null));};exports[_0xace1('0x22')]=function(_0x5308da,_0x5112dc){return db['ChatProactiveAction'][_0xace1('0x37')]({'where':{'id':_0x5308da[_0xace1('0x38')]['id']}})[_0xace1('0x21')](handleEntityNotFound(_0x5112dc,null))[_0xace1('0x21')](removeEntity(_0x5112dc,null))['catch'](handleError(_0x5112dc,null));}; \ No newline at end of file +var _0x0a9f=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','show','rawAttributes','query','keys','filters','model','intersection','fields','attributes','include','merge','options','ChatProactiveAction','find','catch','create','body','params','rimraf','zip-dir','moment','mustache','ejs','fs-extra','squel','jsforce','desk.js','querystring'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x0a9f,0x64));var _0xf0a9=function(_0xde9959,_0x415b88){_0xde9959=_0xde9959-0x0;var _0x24d9d5=_0x0a9f[_0xde9959];return _0x24d9d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0a9('0x0'));var zipdir=require(_0xf0a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0a9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf0a9('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf0a9('0x4'));var fs=require('fs');var fs_extra=require(_0xf0a9('0x5'));var _=require('lodash');var squel=require(_0xf0a9('0x6'));var crypto=require('crypto');var jsforce=require(_0xf0a9('0x7'));var deskjs=require(_0xf0a9('0x8'));var toCsv=require('to-csv');var querystring=require(_0xf0a9('0x9'));var Papa=require(_0xf0a9('0xa'));var Redis=require(_0xf0a9('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xf0a9('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0a9('0xd'));var logger=require(_0xf0a9('0xe'))(_0xf0a9('0xf'));var utils=require(_0xf0a9('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xf0a9('0x11'));var db=require(_0xf0a9('0x12'))['db'];function respondWithStatusCode(_0x6a469e,_0xde853){_0xde853=_0xde853||0xcc;return function(_0x4c8877){if(_0x4c8877){return _0x6a469e['sendStatus'](_0xde853);}return _0x6a469e[_0xf0a9('0x13')](_0xde853)[_0xf0a9('0x14')]();};}function respondWithResult(_0xe27d7e,_0x24c3c9){_0x24c3c9=_0x24c3c9||0xc8;return function(_0x437a3b){if(_0x437a3b){return _0xe27d7e[_0xf0a9('0x13')](_0x24c3c9)[_0xf0a9('0x15')](_0x437a3b);}};}function respondWithFilteredResult(_0x48cffd,_0x18e6ce){return function(_0x4bb2f2){if(_0x4bb2f2){var _0x373ba8=typeof _0x18e6ce['offset']===_0xf0a9('0x16')&&typeof _0x18e6ce['limit']===_0xf0a9('0x16');var _0x43b7f3=_0x4bb2f2[_0xf0a9('0x17')];var _0xf9f800=_0x373ba8?0x0:_0x18e6ce[_0xf0a9('0x18')];var _0x37ddab=_0x373ba8?_0x4bb2f2[_0xf0a9('0x17')]:_0x18e6ce[_0xf0a9('0x18')]+_0x18e6ce[_0xf0a9('0x19')];var _0x4ecb10;if(_0x37ddab>=_0x43b7f3){_0x37ddab=_0x43b7f3;_0x4ecb10=0xc8;}else{_0x4ecb10=0xce;}_0x48cffd[_0xf0a9('0x13')](_0x4ecb10);return _0x48cffd[_0xf0a9('0x1a')](_0xf0a9('0x1b'),_0xf9f800+'-'+_0x37ddab+'/'+_0x43b7f3)['json'](_0x4bb2f2);}return null;};}function patchUpdates(_0x42e7f3){return function(_0x5c26c1){try{jsonpatch[_0xf0a9('0x1c')](_0x5c26c1,_0x42e7f3,!![]);}catch(_0x2f57e7){return BPromise['reject'](_0x2f57e7);}return _0x5c26c1[_0xf0a9('0x1d')]();};}function saveUpdates(_0x1707c2,_0xad2291){return function(_0x52b3cf){if(_0x52b3cf){return _0x52b3cf[_0xf0a9('0x1e')](_0x1707c2)[_0xf0a9('0x1f')](function(_0x132203){return _0x132203;});}return null;};}function removeEntity(_0x453307,_0x3f1013){return function(_0x41c958){if(_0x41c958){return _0x41c958[_0xf0a9('0x20')]()['then'](function(){_0x453307['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f39a3,_0x23ed63){return function(_0x1064cf){if(!_0x1064cf){_0x3f39a3['sendStatus'](0x194);}return _0x1064cf;};}function handleError(_0x3b1377,_0x12133f){_0x12133f=_0x12133f||0x1f4;return function(_0x1d93d2){logger[_0xf0a9('0x21')](_0x1d93d2[_0xf0a9('0x22')]);if(_0x1d93d2[_0xf0a9('0x23')]){delete _0x1d93d2['name'];}_0x3b1377[_0xf0a9('0x13')](_0x12133f)[_0xf0a9('0x24')](_0x1d93d2);};}exports[_0xf0a9('0x25')]=function(_0x1f24a2,_0x153a4e){var _0x4834e0={'raw':!![],'where':{'id':_0x1f24a2['params']['id']}},_0x1c2fef={};_0x1c2fef['model']=_['keys'](db['ChatProactiveAction'][_0xf0a9('0x26')]);_0x1c2fef[_0xf0a9('0x27')]=_[_0xf0a9('0x28')](_0x1f24a2['query']);_0x1c2fef[_0xf0a9('0x29')]=_['intersection'](_0x1c2fef[_0xf0a9('0x2a')],_0x1c2fef[_0xf0a9('0x27')]);_0x4834e0['attributes']=_[_0xf0a9('0x2b')](_0x1c2fef[_0xf0a9('0x2a')],qs[_0xf0a9('0x2c')](_0x1f24a2[_0xf0a9('0x27')][_0xf0a9('0x2c')]));_0x4834e0[_0xf0a9('0x2d')]=_0x4834e0['attributes']['length']?_0x4834e0['attributes']:_0x1c2fef['model'];if(_0x1f24a2[_0xf0a9('0x27')]['includeAll']){_0x4834e0[_0xf0a9('0x2e')]=[{'all':!![]}];}_0x4834e0=_[_0xf0a9('0x2f')]({},_0x4834e0,_0x1f24a2[_0xf0a9('0x30')]);return db[_0xf0a9('0x31')][_0xf0a9('0x32')](_0x4834e0)['then'](handleEntityNotFound(_0x153a4e,null))[_0xf0a9('0x1f')](respondWithResult(_0x153a4e,null))[_0xf0a9('0x33')](handleError(_0x153a4e,null));};exports[_0xf0a9('0x34')]=function(_0x573d27,_0x19e297){return db['ChatProactiveAction'][_0xf0a9('0x34')](_0x573d27[_0xf0a9('0x35')],{})[_0xf0a9('0x1f')](respondWithResult(_0x19e297,0xc9))[_0xf0a9('0x33')](handleError(_0x19e297,null));};exports[_0xf0a9('0x1e')]=function(_0x12e4ba,_0x538ebe){if(_0x12e4ba[_0xf0a9('0x35')]['id']){delete _0x12e4ba['body']['id'];}return db[_0xf0a9('0x31')][_0xf0a9('0x32')]({'where':{'id':_0x12e4ba[_0xf0a9('0x36')]['id']}})[_0xf0a9('0x1f')](handleEntityNotFound(_0x538ebe,null))[_0xf0a9('0x1f')](saveUpdates(_0x12e4ba[_0xf0a9('0x35')],null))[_0xf0a9('0x1f')](respondWithResult(_0x538ebe,null))[_0xf0a9('0x33')](handleError(_0x538ebe,null));};exports['destroy']=function(_0x5826c2,_0x42c072){return db['ChatProactiveAction'][_0xf0a9('0x32')]({'where':{'id':_0x5826c2[_0xf0a9('0x36')]['id']}})[_0xf0a9('0x1f')](handleEntityNotFound(_0x42c072,null))['then'](removeEntity(_0x42c072,null))[_0xf0a9('0x33')](handleError(_0x42c072,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6c45b58..e24bb74 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.model.js +++ b/server/api/chatProactiveAction/chatProactiveAction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x504b=['moment','request-promise','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x262baa,_0x283058){var _0x4f2257=function(_0x2cd1c6){while(--_0x2cd1c6){_0x262baa['push'](_0x262baa['shift']());}};_0x4f2257(++_0x283058);}(_0x504b,0x97));var _0xb504=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x504b[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xb504('0x0'));var util=require(_0xb504('0x1'));var logger=require(_0xb504('0x2'))('api');var moment=require(_0xb504('0x3'));var BPromise=require('bluebird');var rp=require(_0xb504('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb504('0x5'));var config=require(_0xb504('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0xb504('0x7')]=function(_0x6319e7,_0x2b6627){return _0x6319e7[_0xb504('0x8')](_0xb504('0x9'),attributes,{'tableName':_0xb504('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8eac=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x8eac,0x1cc));var _0xc8ea=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0x8eac[_0x15f8ad];return _0xc0238a;};'use strict';var _=require(_0xc8ea('0x0'));var util=require(_0xc8ea('0x1'));var logger=require(_0xc8ea('0x2'))(_0xc8ea('0x3'));var moment=require('moment');var BPromise=require(_0xc8ea('0x4'));var rp=require(_0xc8ea('0x5'));var fs=require('fs');var path=require(_0xc8ea('0x6'));var rimraf=require(_0xc8ea('0x7'));var config=require(_0xc8ea('0x8'));var attributes=require(_0xc8ea('0x9'));module[_0xc8ea('0xa')]=function(_0x48691f,_0x4e4fe0){return _0x48691f[_0xc8ea('0xb')](_0xc8ea('0xc'),attributes,{'tableName':_0xc8ea('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 2bc943e..785888e 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.rpc.js +++ b/server/api/chatProactiveAction/chatProactiveAction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x663d=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c7ee5,_0x11bc4c){var _0x202a66=function(_0x1fe31d){while(--_0x1fe31d){_0x3c7ee5['push'](_0x3c7ee5['shift']());}};_0x202a66(++_0x11bc4c);}(_0x663d,0x1d2));var _0xd663=function(_0xdb94db,_0x281c43){_0xdb94db=_0xdb94db-0x0;var _0x567bdb=_0x663d[_0xdb94db];return _0x567bdb;};'use strict';var _=require(_0xd663('0x0'));var util=require(_0xd663('0x1'));var moment=require(_0xd663('0x2'));var BPromise=require(_0xd663('0x3'));var rs=require(_0xd663('0x4'));var fs=require('fs');var Redis=require(_0xd663('0x5'));var db=require(_0xd663('0x6'))['db'];var utils=require(_0xd663('0x7'));var logger=require(_0xd663('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd663('0x9')][_0xd663('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x66a9b8,_0x2a6b93,_0x231932){return new BPromise(function(_0x407088,_0x159cc1){return client['request'](_0x66a9b8,_0x231932)[_0xd663('0xb')](function(_0x2b0244){logger[_0xd663('0xc')](_0xd663('0xd'),_0x2a6b93,_0xd663('0xe'));logger[_0xd663('0xf')](_0xd663('0x10'),_0x2a6b93,_0xd663('0xe'),JSON[_0xd663('0x11')](_0x2b0244));if(_0x2b0244[_0xd663('0x12')]){if(_0x2b0244[_0xd663('0x12')][_0xd663('0x13')]===0x1f4){logger[_0xd663('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x2a6b93,_0x2b0244[_0xd663('0x12')][_0xd663('0x14')]);return _0x159cc1(_0x2b0244[_0xd663('0x12')][_0xd663('0x14')]);}logger[_0xd663('0x12')](_0xd663('0xd'),_0x2a6b93,_0x2b0244[_0xd663('0x12')]['message']);return _0x407088(_0x2b0244[_0xd663('0x12')][_0xd663('0x14')]);}else{logger[_0xd663('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x2a6b93,_0xd663('0xe'));_0x407088(_0x2b0244[_0xd663('0x15')]['message']);}})['catch'](function(_0x59ea3d){logger[_0xd663('0x12')](_0xd663('0xd'),_0x2a6b93,_0x59ea3d);_0x159cc1(_0x59ea3d);});});} \ No newline at end of file +var _0x1be9=['debug','code','error','message','ChatProactiveAction,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','request\x20sent'];(function(_0x1f5f63,_0x14ace2){var _0xab31fa=function(_0x4a067b){while(--_0x4a067b){_0x1f5f63['push'](_0x1f5f63['shift']());}};_0xab31fa(++_0x14ace2);}(_0x1be9,0xa1));var _0x91be=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x1be9[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x91be('0x0'));var util=require(_0x91be('0x1'));var moment=require(_0x91be('0x2'));var BPromise=require(_0x91be('0x3'));var rs=require(_0x91be('0x4'));var fs=require('fs');var Redis=require(_0x91be('0x5'));var db=require(_0x91be('0x6'))['db'];var utils=require(_0x91be('0x7'));var logger=require(_0x91be('0x8'))('rpc');var config=require(_0x91be('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x91be('0xa')][_0x91be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18d3ab,_0x120de1,_0x4ade76){return new BPromise(function(_0x3f67ca,_0x5308e8){return client['request'](_0x18d3ab,_0x4ade76)[_0x91be('0xc')](function(_0x464cc4){logger[_0x91be('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x120de1,_0x91be('0xe'));logger[_0x91be('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x120de1,'request\x20sent',JSON['stringify'](_0x464cc4));if(_0x464cc4['error']){if(_0x464cc4['error'][_0x91be('0x10')]===0x1f4){logger[_0x91be('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x120de1,_0x464cc4[_0x91be('0x11')][_0x91be('0x12')]);return _0x5308e8(_0x464cc4[_0x91be('0x11')][_0x91be('0x12')]);}logger[_0x91be('0x11')](_0x91be('0x13'),_0x120de1,_0x464cc4[_0x91be('0x11')]['message']);return _0x3f67ca(_0x464cc4['error'][_0x91be('0x12')]);}else{logger[_0x91be('0xd')](_0x91be('0x13'),_0x120de1,'request\x20sent');_0x3f67ca(_0x464cc4[_0x91be('0x14')][_0x91be('0x12')]);}})[_0x91be('0x15')](function(_0x1d2592){logger['error'](_0x91be('0x13'),_0x120de1,_0x1d2592);_0x5308e8(_0x1d2592);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 6d2dfce..df31e8f 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dfd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x3d43c4,_0x3e421b){var _0x382f66=function(_0x432e65){while(--_0x432e65){_0x3d43c4['push'](_0x3d43c4['shift']());}};_0x382f66(++_0x3e421b);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0xe')]);router[_0xd7df('0xf')]('/',auth[_0xd7df('0xd')](),controller['create']);router[_0xd7df('0x10')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0x11')]);router['delete'](_0xd7df('0xc'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);module['exports']=router; \ No newline at end of file +var _0x46ed=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports'];(function(_0x14d042,_0x19eaea){var _0x28f422=function(_0x351c7c){while(--_0x351c7c){_0x14d042['push'](_0x14d042['shift']());}};_0x28f422(++_0x19eaea);}(_0x46ed,0x168));var _0xd46e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x46ed[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0xa')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller['update']);router[_0xd46e('0xf')](_0xd46e('0x9'),auth['isAuthenticated'](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 8c57c95..7966310 100644 --- a/server/api/chatQueue/chatQueue.attributes.js +++ b/server/api/chatQueue/chatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf008=['beepall','roundrobin','sequelize','exports','name','STRING','ENUM'];(function(_0x2e8f7b,_0x4121a7){var _0x398c1b=function(_0x104e13){while(--_0x104e13){_0x2e8f7b['push'](_0x2e8f7b['shift']());}};_0x398c1b(++_0x4121a7);}(_0xf008,0xfe));var _0x8f00=function(_0x2a47b5,_0x4d472c){_0x2a47b5=_0x2a47b5-0x0;var _0x1b6764=_0xf008[_0x2a47b5];return _0x1b6764;};'use strict';var Sequelize=require(_0x8f00('0x0'));module[_0x8f00('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8f00('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8f00('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8f00('0x4')]('rrmemory',_0x8f00('0x5'),_0x8f00('0x6'))}}; \ No newline at end of file +var _0x81e5=['name','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x4bdddd,_0x1a8526){var _0x35f76c=function(_0x389f2a){while(--_0x389f2a){_0x4bdddd['push'](_0x4bdddd['shift']());}};_0x35f76c(++_0x1a8526);}(_0x81e5,0x1f1));var _0x581e=function(_0x4cda62,_0x2e4792){_0x4cda62=_0x4cda62-0x0;var _0x26a668=_0x81e5[_0x4cda62];return _0x26a668;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x581e('0x0')],'unique':_0x581e('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x581e('0x2')](_0x581e('0x3'),_0x581e('0x4'),_0x581e('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 2477b0c..6664fa4 100644 --- a/server/api/chatQueue/chatQueue.controller.js +++ b/server/api/chatQueue/chatQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01f1=['updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','interface','flatMap','sequelize','forEach','userChatQueue:save','ids','select','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','removeTeams','isEmpty','removeAgents','emit','addAgents','userChatQueue:remove','getAgents','order','bluebird','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','get','error','stack','name','send','map','ChatQueue','fieldName','type','getOptions','where','findAll','catch','show','model','rawAttributes','query','keys','filters','fields','length','attributes','includeAll','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','describe','getMembers','findOne','UserChatQueue','intersection','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','User','UserId','agent','chatPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01f1,0x114));var _0x101f=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0x01f1[_0x3ff2f9];return _0x3b0913;};'use strict';var BPromise=require(_0x101f('0x0'));var util=require('util');var _=require(_0x101f('0x1'));var squel=require(_0x101f('0x2'));var Redis=require(_0x101f('0x3'));var qs=require(_0x101f('0x4'));var logger=require('../../config/logger')(_0x101f('0x5'));var config=require(_0x101f('0x6'));var db=require('../../mysqldb')['db'];config[_0x101f('0x7')]=_[_0x101f('0x8')](config[_0x101f('0x7')],{'host':_0x101f('0x9'),'port':0x18eb});var socket=require(_0x101f('0xa'))(new Redis(config[_0x101f('0x7')]));require('./chatQueue.socket')[_0x101f('0xb')](socket);function respondWithStatusCode(_0x53b4fe,_0x17388f){_0x17388f=_0x17388f||0xcc;return function(_0x250b19){if(_0x250b19){return _0x53b4fe[_0x101f('0xc')](_0x17388f);}return _0x53b4fe[_0x101f('0xd')](_0x17388f)['end']();};}function respondWithResult(_0x513695,_0x1ecc5c){_0x1ecc5c=_0x1ecc5c||0xc8;return function(_0x56d6dc){if(_0x56d6dc){return _0x513695[_0x101f('0xd')](_0x1ecc5c)[_0x101f('0xe')](_0x56d6dc);}};}function respondWithFilteredResult(_0x243808,_0x43b920){return function(_0x5cab52){if(_0x5cab52){var _0xf4cb95=typeof _0x43b920[_0x101f('0xf')]===_0x101f('0x10')&&typeof _0x43b920[_0x101f('0x11')]==='undefined';var _0x14ceea=_0x5cab52[_0x101f('0x12')];var _0x5df555=_0xf4cb95?0x0:_0x43b920[_0x101f('0xf')];var _0x5dbba4=_0xf4cb95?_0x5cab52[_0x101f('0x12')]:_0x43b920['offset']+_0x43b920[_0x101f('0x11')];var _0x598e90;if(_0x5dbba4>=_0x14ceea){_0x5dbba4=_0x14ceea;_0x598e90=0xc8;}else{_0x598e90=0xce;}_0x243808['status'](_0x598e90);return _0x243808[_0x101f('0x13')]('Content-Range',_0x5df555+'-'+_0x5dbba4+'/'+_0x14ceea)[_0x101f('0xe')](_0x5cab52);}return null;};}function saveUpdates(_0x2efa9f){return function(_0x4d4643){if(_0x4d4643){return _0x4d4643[_0x101f('0x14')](_0x2efa9f)[_0x101f('0x15')](function(_0x52fc68){return _0x52fc68;});}return null;};}function removeEntity(_0x1e10ad){return function(_0x464429){if(_0x464429){return _0x464429['destroy']()[_0x101f('0x15')](function(){var _0x30254=_0x464429[_0x101f('0x16')]({'plain':!![]});var _0x412b59='ChatQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x412b59,'resourceId':_0x30254['id']}})['then'](function(){return _0x464429;});})[_0x101f('0x15')](function(){_0x1e10ad[_0x101f('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d9cee){return function(_0x14088d){if(!_0x14088d){_0x2d9cee[_0x101f('0xc')](0x194);}return _0x14088d;};}function handleError(_0x52061a,_0x29d638){_0x29d638=_0x29d638||0x1f4;return function(_0x1d7dd9){logger[_0x101f('0x17')](_0x1d7dd9[_0x101f('0x18')]);if(_0x1d7dd9['name']){delete _0x1d7dd9[_0x101f('0x19')];}_0x52061a[_0x101f('0xd')](_0x29d638)[_0x101f('0x1a')](_0x1d7dd9);};}exports['index']=function(_0x387b0c,_0x5460de){var _0x30fd4f={};var _0x5dea3d={'count':0x0,'rows':[]};var _0x441c4c=_[_0x101f('0x1b')](db[_0x101f('0x1c')]['rawAttributes'],function(_0x2930f){return{'name':_0x2930f[_0x101f('0x1d')],'type':_0x2930f[_0x101f('0x1e')]['key']};});_0x30fd4f=qs[_0x101f('0x1f')](_0x441c4c,_0x387b0c);var _0x1945b4={'where':_0x30fd4f[_0x101f('0x20')]};return db['ChatQueue']['count'](_0x1945b4)[_0x101f('0x15')](function(_0x5bf754){_0x5dea3d[_0x101f('0x12')]=_0x5bf754;_0x30fd4f['include']=qs['include'](_0x387b0c['query']);return db[_0x101f('0x1c')][_0x101f('0x21')](_0x30fd4f);})['then'](function(_0x1e4111){_0x5dea3d['rows']=_0x1e4111;return _0x5dea3d;})['then'](respondWithFilteredResult(_0x5460de,_0x30fd4f))[_0x101f('0x22')](handleError(_0x5460de,null));};exports[_0x101f('0x23')]=function(_0x2cfa66,_0x1bb2db){var _0x4bd791={'raw':!![],'where':{'id':_0x2cfa66['params']['id']}},_0x17127a={};_0x17127a[_0x101f('0x24')]=_['keys'](db[_0x101f('0x1c')][_0x101f('0x25')]);_0x17127a[_0x101f('0x26')]=_[_0x101f('0x27')](_0x2cfa66['query']);_0x17127a[_0x101f('0x28')]=_['intersection'](_0x17127a[_0x101f('0x24')],_0x17127a[_0x101f('0x26')]);_0x4bd791['attributes']=_['intersection'](_0x17127a[_0x101f('0x24')],qs[_0x101f('0x29')](_0x2cfa66[_0x101f('0x26')][_0x101f('0x29')]));_0x4bd791['attributes']=_0x4bd791['attributes'][_0x101f('0x2a')]?_0x4bd791[_0x101f('0x2b')]:_0x17127a[_0x101f('0x24')];if(_0x2cfa66[_0x101f('0x26')][_0x101f('0x2c')]){_0x4bd791[_0x101f('0x2d')]=[{'all':!![]}];}_0x4bd791=_[_0x101f('0x2e')]({},_0x4bd791,_0x2cfa66[_0x101f('0x2f')]);return db[_0x101f('0x1c')][_0x101f('0x30')](_0x4bd791)[_0x101f('0x15')](handleEntityNotFound(_0x1bb2db,null))[_0x101f('0x15')](respondWithResult(_0x1bb2db,null))['catch'](handleError(_0x1bb2db,null));};exports[_0x101f('0x31')]=function(_0x5385fd,_0x10beea){return db[_0x101f('0x1c')][_0x101f('0x31')](_0x5385fd[_0x101f('0x32')],{})[_0x101f('0x15')](function(_0x5a7d34){var _0xa4d4fb=_0x5385fd[_0x101f('0x33')][_0x101f('0x16')]({'plain':!![]});if(!_0xa4d4fb)throw new Error(_0x101f('0x34'));if(_0xa4d4fb['role']===_0x101f('0x33')){var _0x505433=_0x5a7d34[_0x101f('0x16')]({'plain':!![]});var _0x55290e=_0x101f('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x55290e,'userProfileId':_0xa4d4fb[_0x101f('0x36')]},'raw':!![]})['then'](function(_0x2770b6){if(_0x2770b6&&_0x2770b6[_0x101f('0x37')]===0x0){return db[_0x101f('0x38')]['create']({'name':_0x505433[_0x101f('0x19')],'resourceId':_0x505433['id'],'type':_0x2770b6[_0x101f('0x19')],'sectionId':_0x2770b6['id']},{})[_0x101f('0x15')](function(){return _0x5a7d34;});}else{return _0x5a7d34;}})[_0x101f('0x22')](function(_0x5dcc14){logger[_0x101f('0x17')](_0x101f('0x39'),_0x5dcc14);throw _0x5dcc14;});}return _0x5a7d34;})[_0x101f('0x15')](respondWithResult(_0x10beea,0xc9))[_0x101f('0x22')](handleError(_0x10beea,null));};exports[_0x101f('0x14')]=function(_0x4f0bba,_0x26d86f){if(_0x4f0bba['body']['id']){delete _0x4f0bba[_0x101f('0x32')]['id'];}return db[_0x101f('0x1c')]['find']({'where':{'id':_0x4f0bba['params']['id']}})[_0x101f('0x15')](handleEntityNotFound(_0x26d86f,null))['then'](saveUpdates(_0x4f0bba[_0x101f('0x32')],null))['then'](respondWithResult(_0x26d86f,null))[_0x101f('0x22')](handleError(_0x26d86f,null));};exports[_0x101f('0x3a')]=function(_0x51ac53,_0x57a17a){return db[_0x101f('0x1c')][_0x101f('0x30')]({'where':{'id':_0x51ac53[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](handleEntityNotFound(_0x57a17a,null))[_0x101f('0x15')](removeEntity(_0x57a17a,null))[_0x101f('0x22')](handleError(_0x57a17a,null));};exports[_0x101f('0x3c')]=function(_0x23c78e,_0x5af813){return db[_0x101f('0x1c')][_0x101f('0x3c')]()[_0x101f('0x15')](respondWithResult(_0x5af813,null))[_0x101f('0x22')](handleError(_0x5af813,null));};exports[_0x101f('0x3d')]=function(_0x67dfdb,_0x354ddc){var _0x71a761={'raw':!![],'where':{}},_0x30200b={},_0xbaeb1d;return db[_0x101f('0x1c')][_0x101f('0x3e')]({'where':{'id':_0x67dfdb[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](handleEntityNotFound(_0x354ddc,null))[_0x101f('0x15')](function(_0x4c23b2){if(_0x4c23b2){_0xbaeb1d=_0x4c23b2[_0x101f('0x16')]({'plain':!![]});_0x30200b[_0x101f('0x24')]=_['keys'](db[_0x101f('0x3f')]['rawAttributes']);_0x30200b[_0x101f('0x26')]=_['keys'](_0x67dfdb[_0x101f('0x26')]);_0x30200b[_0x101f('0x28')]=_[_0x101f('0x40')](_0x30200b[_0x101f('0x24')],_0x30200b[_0x101f('0x26')]);_0x71a761[_0x101f('0x2b')]=_[_0x101f('0x40')](_0x30200b['model'],qs['fields'](_0x67dfdb['query'][_0x101f('0x29')]));_0x71a761[_0x101f('0x2b')]=_0x71a761['attributes']['length']?_0x71a761['attributes']:_0x30200b[_0x101f('0x24')];if(!_0x67dfdb[_0x101f('0x26')][_0x101f('0x41')](_0x101f('0x42'))){_0x71a761[_0x101f('0x11')]=qs['limit'](_0x67dfdb['query'][_0x101f('0x11')]);_0x71a761[_0x101f('0xf')]=qs['offset'](_0x67dfdb['query'][_0x101f('0xf')]);}_0x71a761['order']=qs[_0x101f('0x43')](_0x67dfdb[_0x101f('0x26')][_0x101f('0x43')]);_0x71a761[_0x101f('0x20')]=qs[_0x101f('0x28')](_[_0x101f('0x44')](_0x67dfdb['query'],_0x30200b[_0x101f('0x28')]));_0x71a761[_0x101f('0x20')][_0x101f('0x45')]=_0x4c23b2['id'];if(_0x67dfdb[_0x101f('0x26')][_0x101f('0x46')]){_0x71a761[_0x101f('0x20')]=_['merge'](_0x71a761[_0x101f('0x20')],{'$or':_[_0x101f('0x1b')](_0x71a761[_0x101f('0x2b')],function(_0x243741){var _0x5ad259={};_0x5ad259[_0x243741]={'$like':'%'+_0x67dfdb[_0x101f('0x26')][_0x101f('0x46')]+'%'};return _0x5ad259;})});}_0x71a761=_[_0x101f('0x2e')]({},_0x71a761,_0x67dfdb[_0x101f('0x2f')]);return db[_0x101f('0x3f')][_0x101f('0x21')](_0x71a761);}})[_0x101f('0x15')](function(_0x4c81da){if(_0x4c81da){return db[_0x101f('0x47')]['findAndCountAll']({'where':{'id':_['map'](_0x4c81da,_0x101f('0x48')),'role':_0x101f('0x49')},'attributes':['id',_0x101f('0x19'),_0x101f('0x4a'),_0x101f('0x4b'),_0x101f('0x4c')]});}})[_0x101f('0x15')](function(_0x2e5c82){if(_0x2e5c82){return{'count':_0x2e5c82[_0x101f('0x12')],'rows':_[_0x101f('0x1b')](_0x2e5c82['rows'],function(_0x444315){return{'membername':_0x444315['name'],'UserId':_0x444315['id'],'queue_name':_0xbaeb1d[_0x101f('0x19')],'ChatQueueId':_0xbaeb1d['id'],'interface':util[_0x101f('0x4d')](_0x101f('0x4e'),_0x101f('0x4f'),_0x444315[_0x101f('0x19')]),'penalty':0x0,'paused':_0x444315[_0x101f('0x4a')],'createdAt':_0x444315['createdAt'],'updatedAt':_0x444315[_0x101f('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x354ddc,_0x71a761))[_0x101f('0x22')](handleError(_0x354ddc,null));};exports[_0x101f('0x50')]=function(_0x40b82f,_0xb7db8d){var _0x3cc5a1={};var _0x7470e3={};var _0x4dad0e;var _0x432652;return db[_0x101f('0x1c')][_0x101f('0x3e')]({'where':{'id':_0x40b82f[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](handleEntityNotFound(_0xb7db8d,null))[_0x101f('0x15')](function(_0x1d20e2){if(_0x1d20e2){_0x4dad0e=_0x1d20e2;_0x7470e3['model']=_['keys'](db[_0x101f('0x51')][_0x101f('0x25')]);_0x7470e3['query']=_[_0x101f('0x27')](_0x40b82f['query']);_0x7470e3['filters']=_[_0x101f('0x40')](_0x7470e3[_0x101f('0x24')],_0x7470e3[_0x101f('0x26')]);_0x3cc5a1[_0x101f('0x2b')]=_['intersection'](_0x7470e3[_0x101f('0x24')],qs[_0x101f('0x29')](_0x40b82f[_0x101f('0x26')][_0x101f('0x29')]));_0x3cc5a1[_0x101f('0x2b')]=_0x3cc5a1[_0x101f('0x2b')]['length']?_0x3cc5a1[_0x101f('0x2b')]:_0x7470e3[_0x101f('0x24')];_0x3cc5a1['order']=qs[_0x101f('0x43')](_0x40b82f[_0x101f('0x26')][_0x101f('0x43')]);_0x3cc5a1[_0x101f('0x20')]=qs['filters'](_[_0x101f('0x44')](_0x40b82f[_0x101f('0x26')],_0x7470e3[_0x101f('0x28')]));if(_0x40b82f[_0x101f('0x26')][_0x101f('0x46')]){_0x3cc5a1[_0x101f('0x20')]=_[_0x101f('0x2e')](_0x3cc5a1['where'],{'$or':_[_0x101f('0x1b')](_0x3cc5a1[_0x101f('0x2b')],function(_0x2d9fae){var _0x3b179e={};_0x3b179e[_0x2d9fae]={'$like':'%'+_0x40b82f[_0x101f('0x26')][_0x101f('0x46')]+'%'};return _0x3b179e;})});}_0x3cc5a1=_[_0x101f('0x2e')]({},_0x3cc5a1,_0x40b82f[_0x101f('0x2f')]);return _0x4dad0e['getTeams'](_0x3cc5a1);}})[_0x101f('0x15')](function(_0xb69fff){if(_0xb69fff){_0x432652=_0xb69fff[_0x101f('0x2a')];if(!_0x40b82f[_0x101f('0x26')][_0x101f('0x41')](_0x101f('0x42'))){_0x3cc5a1[_0x101f('0x11')]=qs[_0x101f('0x11')](_0x40b82f['query'][_0x101f('0x11')]);_0x3cc5a1['offset']=qs['offset'](_0x40b82f[_0x101f('0x26')][_0x101f('0xf')]);}return _0x4dad0e['getTeams'](_0x3cc5a1);}})[_0x101f('0x15')](function(_0x1f4cf2){if(_0x1f4cf2){return _0x1f4cf2?{'count':_0x432652,'rows':_0x1f4cf2}:null;}})[_0x101f('0x15')](respondWithResult(_0xb7db8d,null))[_0x101f('0x22')](handleError(_0xb7db8d,null));};exports[_0x101f('0x52')]=function(_0x1415e9,_0x2e7a88){var _0x382fc6=_0x1415e9['body']['ids'];return db[_0x101f('0x51')][_0x101f('0x21')]({'where':{'id':_0x382fc6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x101f('0x53'),'attributes':['id',_0x101f('0x19'),_0x101f('0x54'),'voicePause',_0x101f('0x55')],'raw':!![]}]})['then'](function(_0x183a58){if(_0x183a58){var _0x47b292=_[_0x101f('0x56')](_0x183a58,function(_0xd3e3a8){var _0x431955=_0xd3e3a8[_0x101f('0x16')]({'plain':!![]});return _0x431955[_0x101f('0x53')];});return db['ChatQueue'][_0x101f('0x30')]({'where':{'id':_0x1415e9[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](function(_0x360ba8){return db[_0x101f('0x57')]['transaction'](function(_0x2c44e8){return _0x360ba8[_0x101f('0x52')](_0x382fc6,{'transaction':_0x2c44e8})[_0x101f('0x15')](function(){return BPromise['each'](_0x47b292,function(_0x4b38fc){return db[_0x101f('0x3f')]['findOrCreate']({'where':{'UserId':_0x4b38fc['id'],'ChatQueueId':_0x1415e9[_0x101f('0x3b')]['id']},'transaction':_0x2c44e8});});})[_0x101f('0x15')](function(){_0x47b292[_0x101f('0x58')](function(_0x4f4ca0){socket['emit'](_0x101f('0x59'),{'UserId':_0x4f4ca0['id'],'ChatQueueId':_0x360ba8['id']});});});});});}})['then'](respondWithStatusCode(_0x2e7a88,null))['catch'](handleError(_0x2e7a88,null));};exports['removeTeams']=function(_0x37c5d0,_0x2b3cb9){return db[_0x101f('0x51')][_0x101f('0x21')]({'where':{'id':_0x37c5d0['query'][_0x101f('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x101f('0x53'),'attributes':['id'],'raw':!![]}]})[_0x101f('0x15')](handleEntityNotFound(_0x2b3cb9,null))['then'](function(_0x2f803f){var _0x129e43=_[_0x101f('0x1b')](_0x2f803f,'id');var _0x5b9995=[];var _0x3ef2cd=[];var _0x1365f1=squel[_0x101f('0x5b')]();_0x1365f1['field']('tq.TeamId')['from'](_0x101f('0x5c'),'tq')[_0x101f('0x5d')](_0x101f('0x5e'),'ut',_0x101f('0x5f'))[_0x101f('0x20')](_0x101f('0x60'),_0x37c5d0['params']['id']);for(var _0x3856c9=0x0;_0x3856c9<_0x2f803f[_0x101f('0x2a')];_0x3856c9+=0x1){let _0x255e49=_0x2f803f[_0x3856c9];for(var _0x3894dc=0x0;_0x3894dc<_0x255e49[_0x101f('0x53')][_0x101f('0x2a')];_0x3894dc+=0x1){let _0x4e4fd0=_0x255e49[_0x101f('0x53')][_0x3894dc];var _0x5133dd=_0x1365f1[_0x101f('0x61')]();_0x5133dd[_0x101f('0x20')](_0x101f('0x62'),_0x4e4fd0['id']);_0x3ef2cd[_0x101f('0x63')](db['sequelize']['query'](_0x5133dd[_0x101f('0x64')](),{'type':db[_0x101f('0x57')][_0x101f('0x65')][_0x101f('0x66')]})[_0x101f('0x15')](function(_0x2a8123){if(_0x2a8123[_0x101f('0x2a')]===0x1){return _0x4e4fd0['id'];}else{var _0xd5ee2=_[_0x101f('0x67')](_[_0x101f('0x1b')](_0x2a8123,_0x101f('0x68')),function(_0x203347){return _['includes'](_0x129e43,_0x203347);});if(_0xd5ee2){return _0x4e4fd0['id'];}}}));}}return BPromise[_0x101f('0x69')](_0x3ef2cd)[_0x101f('0x15')](function(_0x53e7ca){_0x5b9995=_(_0x5b9995)[_0x101f('0x6a')](_0x53e7ca)[_0x101f('0x6b')]()['value']();return db[_0x101f('0x1c')]['find']({'where':{'id':_0x37c5d0[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](function(_0x1e3d08){return db[_0x101f('0x57')][_0x101f('0x6c')](function(_0x115cd9){return _0x1e3d08[_0x101f('0x6d')](_0x37c5d0['query']['ids'],{'transaction':_0x115cd9})[_0x101f('0x15')](function(){if(!_[_0x101f('0x6e')](_0x5b9995)){return _0x1e3d08[_0x101f('0x6f')](_0x5b9995,{'transaction':_0x115cd9});}})[_0x101f('0x15')](function(){_0x5b9995[_0x101f('0x58')](function(_0x44d8ee){socket[_0x101f('0x70')]('userChatQueue:remove',{'UserId':_0x44d8ee,'ChatQueueId':_0x1e3d08['id']});});});});});});})[_0x101f('0x15')](respondWithStatusCode(_0x2b3cb9,null))[_0x101f('0x22')](handleError(_0x2b3cb9,null));};exports[_0x101f('0x71')]=function(_0x26cb19,_0xbc177a){return db['ChatQueue'][_0x101f('0x30')]({'where':{'id':_0x26cb19[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](handleEntityNotFound(_0xbc177a,null))['then'](function(_0x16d8b7){if(_0x16d8b7){return _0x16d8b7[_0x101f('0x71')](_0x26cb19[_0x101f('0x32')][_0x101f('0x5a')],_['omit'](_0x26cb19[_0x101f('0x32')],[_0x101f('0x5a'),'id'])||{})['spread'](function(_0x16f83c){for(var _0x546be6=0x0;_0x546be6<_0x26cb19[_0x101f('0x32')][_0x101f('0x5a')][_0x101f('0x2a')];_0x546be6+=0x1){socket[_0x101f('0x70')](_0x101f('0x59'),{'UserId':Number(_0x26cb19[_0x101f('0x32')][_0x101f('0x5a')][_0x546be6]),'ChatQueueId':Number(_0x26cb19[_0x101f('0x3b')]['id'])});}return _0x16f83c;});}})[_0x101f('0x15')](respondWithResult(_0xbc177a,null))[_0x101f('0x22')](handleError(_0xbc177a,null));};exports['removeAgents']=function(_0x4382d,_0x135150){return db[_0x101f('0x1c')][_0x101f('0x30')]({'where':{'id':_0x4382d[_0x101f('0x3b')]['id']}})['then'](handleEntityNotFound(_0x135150,null))[_0x101f('0x15')](function(_0x2d441a){if(_0x2d441a){return _0x2d441a[_0x101f('0x6f')](_0x4382d[_0x101f('0x26')][_0x101f('0x5a')])[_0x101f('0x15')](function(){if(_['isArray'](_0x4382d[_0x101f('0x26')][_0x101f('0x5a')])){for(var _0x184964=0x0;_0x184964<_0x4382d['query'][_0x101f('0x5a')][_0x101f('0x2a')];_0x184964+=0x1){socket[_0x101f('0x70')](_0x101f('0x72'),{'UserId':Number(_0x4382d[_0x101f('0x26')][_0x101f('0x5a')][_0x184964]),'ChatQueueId':Number(_0x4382d[_0x101f('0x3b')]['id'])});}}else{socket[_0x101f('0x70')](_0x101f('0x72'),{'UserId':Number(_0x4382d['query'][_0x101f('0x5a')]),'ChatQueueId':Number(_0x4382d['params']['id'])});}});}})[_0x101f('0x15')](respondWithStatusCode(_0x135150,null))['catch'](handleError(_0x135150,null));};exports[_0x101f('0x73')]=function(_0x12234f,_0x2b1131){var _0x1a90ac={};var _0x42c31e={};var _0x2596c3;var _0x48b2c0;return db[_0x101f('0x1c')][_0x101f('0x3e')]({'where':{'id':_0x12234f[_0x101f('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2b1131,null))[_0x101f('0x15')](function(_0x439378){if(_0x439378){_0x2596c3=_0x439378;_0x42c31e[_0x101f('0x24')]=_[_0x101f('0x27')](db[_0x101f('0x47')][_0x101f('0x25')]);_0x42c31e[_0x101f('0x26')]=_[_0x101f('0x27')](_0x12234f[_0x101f('0x26')]);_0x42c31e['filters']=_['intersection'](_0x42c31e[_0x101f('0x24')],_0x42c31e[_0x101f('0x26')]);_0x1a90ac[_0x101f('0x2b')]=_['intersection'](_0x42c31e['model'],qs[_0x101f('0x29')](_0x12234f[_0x101f('0x26')][_0x101f('0x29')]));_0x1a90ac[_0x101f('0x2b')]=_0x1a90ac[_0x101f('0x2b')]['length']?_0x1a90ac[_0x101f('0x2b')]:_0x42c31e[_0x101f('0x24')];_0x1a90ac[_0x101f('0x74')]=qs['sort'](_0x12234f[_0x101f('0x26')][_0x101f('0x43')]);_0x1a90ac[_0x101f('0x20')]=qs[_0x101f('0x28')](_[_0x101f('0x44')](_0x12234f[_0x101f('0x26')],_0x42c31e[_0x101f('0x28')]));if(_0x12234f[_0x101f('0x26')]['filter']){_0x1a90ac[_0x101f('0x20')]=_[_0x101f('0x2e')](_0x1a90ac['where'],{'$or':_[_0x101f('0x1b')](_0x1a90ac[_0x101f('0x2b')],function(_0x2492f7){var _0x42c465={};_0x42c465[_0x2492f7]={'$like':'%'+_0x12234f[_0x101f('0x26')][_0x101f('0x46')]+'%'};return _0x42c465;})});}_0x1a90ac=_[_0x101f('0x2e')]({},_0x1a90ac,_0x12234f[_0x101f('0x2f')]);return _0x2596c3['getAgents'](_0x1a90ac);}})[_0x101f('0x15')](function(_0x562951){if(_0x562951){_0x48b2c0=_0x562951[_0x101f('0x2a')];if(!_0x12234f[_0x101f('0x26')][_0x101f('0x41')](_0x101f('0x42'))){_0x1a90ac[_0x101f('0x11')]=qs['limit'](_0x12234f['query']['limit']);_0x1a90ac['offset']=qs[_0x101f('0xf')](_0x12234f[_0x101f('0x26')][_0x101f('0xf')]);}return _0x2596c3['getAgents'](_0x1a90ac);}})[_0x101f('0x15')](function(_0xba2d3f){if(_0xba2d3f){return _0xba2d3f?{'count':_0x48b2c0,'rows':_0xba2d3f}:null;}})['then'](respondWithResult(_0x2b1131,null))[_0x101f('0x22')](handleError(_0x2b1131,null));}; \ No newline at end of file +var _0x046a=['every','TeamId','includes','all','compact','value','isEmpty','forEach','emit','userChatQueue:remove','addAgents','spread','removeAgents','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','status','limit','undefined','count','offset','set','Content-Range','json','update','then','destroy','get','ChatQueues','UserProfileResource','end','error','name','index','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserChatQueue','fields','hasOwnProperty','order','sort','pick','filter','map','User','findAndCountAll','UserId','agent','chatPause','updatedAt','%s/%s','createdAt','getTeams','findOne','Team','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','transaction','userChatQueue:save','removeTeams','findAll','ids','select','field','from','team_has_chat_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT'];(function(_0x2eb30f,_0x1b8d1d){var _0x27873c=function(_0x18a46d){while(--_0x18a46d){_0x2eb30f['push'](_0x2eb30f['shift']());}};_0x27873c(++_0x1b8d1d);}(_0x046a,0xfe));var _0xa046=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x046a[_0x484e36];return _0xafc85d;};'use strict';var BPromise=require(_0xa046('0x0'));var util=require(_0xa046('0x1'));var _=require(_0xa046('0x2'));var squel=require('squel');var Redis=require(_0xa046('0x3'));var qs=require(_0xa046('0x4'));var logger=require(_0xa046('0x5'))(_0xa046('0x6'));var config=require(_0xa046('0x7'));var db=require(_0xa046('0x8'))['db'];config[_0xa046('0x9')]=_[_0xa046('0xa')](config[_0xa046('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa046('0xb'))(new Redis(config[_0xa046('0x9')]));require(_0xa046('0xc'))[_0xa046('0xd')](socket);function respondWithStatusCode(_0x38d05f,_0x5a10ff){_0x5a10ff=_0x5a10ff||0xcc;return function(_0x4f486f){if(_0x4f486f){return _0x38d05f['sendStatus'](_0x5a10ff);}return _0x38d05f[_0xa046('0xe')](_0x5a10ff)['end']();};}function respondWithResult(_0x352f5e,_0x3c9db0){_0x3c9db0=_0x3c9db0||0xc8;return function(_0x3fc0e9){if(_0x3fc0e9){return _0x352f5e[_0xa046('0xe')](_0x3c9db0)['json'](_0x3fc0e9);}};}function respondWithFilteredResult(_0x28037f,_0x18b441){return function(_0x4697bc){if(_0x4697bc){var _0x1600fc=typeof _0x18b441['offset']==='undefined'&&typeof _0x18b441[_0xa046('0xf')]===_0xa046('0x10');var _0x5c0d14=_0x4697bc['count'];var _0x2fc4a6=_0x1600fc?0x0:_0x18b441['offset'];var _0x154ed0=_0x1600fc?_0x4697bc[_0xa046('0x11')]:_0x18b441[_0xa046('0x12')]+_0x18b441[_0xa046('0xf')];var _0x1bb694;if(_0x154ed0>=_0x5c0d14){_0x154ed0=_0x5c0d14;_0x1bb694=0xc8;}else{_0x1bb694=0xce;}_0x28037f[_0xa046('0xe')](_0x1bb694);return _0x28037f[_0xa046('0x13')](_0xa046('0x14'),_0x2fc4a6+'-'+_0x154ed0+'/'+_0x5c0d14)[_0xa046('0x15')](_0x4697bc);}return null;};}function saveUpdates(_0x57e898){return function(_0x25241d){if(_0x25241d){return _0x25241d[_0xa046('0x16')](_0x57e898)[_0xa046('0x17')](function(_0x347a80){return _0x347a80;});}return null;};}function removeEntity(_0x20cd98){return function(_0x8983af){if(_0x8983af){return _0x8983af[_0xa046('0x18')]()[_0xa046('0x17')](function(){var _0x35c57b=_0x8983af[_0xa046('0x19')]({'plain':!![]});var _0x5d2831=_0xa046('0x1a');return db[_0xa046('0x1b')][_0xa046('0x18')]({'where':{'type':_0x5d2831,'resourceId':_0x35c57b['id']}})[_0xa046('0x17')](function(){return _0x8983af;});})[_0xa046('0x17')](function(){_0x20cd98[_0xa046('0xe')](0xcc)[_0xa046('0x1c')]();});}};}function handleEntityNotFound(_0x21e13c){return function(_0x62819f){if(!_0x62819f){_0x21e13c['sendStatus'](0x194);}return _0x62819f;};}function handleError(_0x516f27,_0x17d99d){_0x17d99d=_0x17d99d||0x1f4;return function(_0x189534){logger[_0xa046('0x1d')](_0x189534['stack']);if(_0x189534[_0xa046('0x1e')]){delete _0x189534[_0xa046('0x1e')];}_0x516f27[_0xa046('0xe')](_0x17d99d)['send'](_0x189534);};}exports[_0xa046('0x1f')]=function(_0x183ffa,_0x487b26){var _0x29c85c={};var _0x299bcd={'count':0x0,'rows':[]};var _0x1ec6ea=_['map'](db[_0xa046('0x20')][_0xa046('0x21')],function(_0x52eba3){return{'name':_0x52eba3[_0xa046('0x22')],'type':_0x52eba3[_0xa046('0x23')][_0xa046('0x24')]};});_0x29c85c=qs[_0xa046('0x25')](_0x1ec6ea,_0x183ffa);var _0xfdf29f={'where':_0x29c85c[_0xa046('0x26')]};return db[_0xa046('0x20')][_0xa046('0x11')](_0xfdf29f)['then'](function(_0xe01259){_0x299bcd[_0xa046('0x11')]=_0xe01259;_0x29c85c[_0xa046('0x27')]=qs[_0xa046('0x27')](_0x183ffa[_0xa046('0x28')]);return db[_0xa046('0x20')]['findAll'](_0x29c85c);})[_0xa046('0x17')](function(_0x3dcd76){_0x299bcd[_0xa046('0x29')]=_0x3dcd76;return _0x299bcd;})[_0xa046('0x17')](respondWithFilteredResult(_0x487b26,_0x29c85c))[_0xa046('0x2a')](handleError(_0x487b26,null));};exports[_0xa046('0x2b')]=function(_0x378670,_0x2014e4){var _0x4ac7b0={'raw':!![],'where':{'id':_0x378670[_0xa046('0x2c')]['id']}},_0x8f36e7={};_0x8f36e7[_0xa046('0x2d')]=_[_0xa046('0x2e')](db[_0xa046('0x20')][_0xa046('0x21')]);_0x8f36e7['query']=_[_0xa046('0x2e')](_0x378670[_0xa046('0x28')]);_0x8f36e7[_0xa046('0x2f')]=_[_0xa046('0x30')](_0x8f36e7[_0xa046('0x2d')],_0x8f36e7[_0xa046('0x28')]);_0x4ac7b0['attributes']=_[_0xa046('0x30')](_0x8f36e7[_0xa046('0x2d')],qs['fields'](_0x378670[_0xa046('0x28')]['fields']));_0x4ac7b0['attributes']=_0x4ac7b0[_0xa046('0x31')][_0xa046('0x32')]?_0x4ac7b0[_0xa046('0x31')]:_0x8f36e7[_0xa046('0x2d')];if(_0x378670[_0xa046('0x28')][_0xa046('0x33')]){_0x4ac7b0[_0xa046('0x27')]=[{'all':!![]}];}_0x4ac7b0=_[_0xa046('0x34')]({},_0x4ac7b0,_0x378670[_0xa046('0x35')]);return db[_0xa046('0x20')][_0xa046('0x36')](_0x4ac7b0)[_0xa046('0x17')](handleEntityNotFound(_0x2014e4,null))[_0xa046('0x17')](respondWithResult(_0x2014e4,null))['catch'](handleError(_0x2014e4,null));};exports[_0xa046('0x37')]=function(_0x26b3c2,_0x3a7d6f){return db['ChatQueue']['create'](_0x26b3c2['body'],{})[_0xa046('0x17')](function(_0x4ecb09){var _0x101e0=_0x26b3c2[_0xa046('0x38')][_0xa046('0x19')]({'plain':!![]});if(!_0x101e0)throw new Error(_0xa046('0x39'));if(_0x101e0[_0xa046('0x3a')]==='user'){var _0x5f5caa=_0x4ecb09['get']({'plain':!![]});var _0x6bf7a0=_0xa046('0x1a');return db[_0xa046('0x3b')][_0xa046('0x36')]({'where':{'name':_0x6bf7a0,'userProfileId':_0x101e0['userProfileId']},'raw':!![]})[_0xa046('0x17')](function(_0xa4a48){if(_0xa4a48&&_0xa4a48[_0xa046('0x3c')]===0x0){return db[_0xa046('0x1b')][_0xa046('0x37')]({'name':_0x5f5caa[_0xa046('0x1e')],'resourceId':_0x5f5caa['id'],'type':_0xa4a48['name'],'sectionId':_0xa4a48['id']},{})['then'](function(){return _0x4ecb09;});}else{return _0x4ecb09;}})[_0xa046('0x2a')](function(_0x4f52a1){logger[_0xa046('0x1d')](_0xa046('0x3d'),_0x4f52a1);throw _0x4f52a1;});}return _0x4ecb09;})['then'](respondWithResult(_0x3a7d6f,0xc9))[_0xa046('0x2a')](handleError(_0x3a7d6f,null));};exports[_0xa046('0x16')]=function(_0x13faab,_0x30ff03){if(_0x13faab['body']['id']){delete _0x13faab[_0xa046('0x3e')]['id'];}return db[_0xa046('0x20')][_0xa046('0x36')]({'where':{'id':_0x13faab[_0xa046('0x2c')]['id']}})[_0xa046('0x17')](handleEntityNotFound(_0x30ff03,null))[_0xa046('0x17')](saveUpdates(_0x13faab[_0xa046('0x3e')],null))[_0xa046('0x17')](respondWithResult(_0x30ff03,null))[_0xa046('0x2a')](handleError(_0x30ff03,null));};exports['destroy']=function(_0x5604cc,_0x2254e3){return db[_0xa046('0x20')][_0xa046('0x36')]({'where':{'id':_0x5604cc[_0xa046('0x2c')]['id']}})[_0xa046('0x17')](handleEntityNotFound(_0x2254e3,null))['then'](removeEntity(_0x2254e3,null))[_0xa046('0x2a')](handleError(_0x2254e3,null));};exports['describe']=function(_0x3715f9,_0x392de2){return db[_0xa046('0x20')][_0xa046('0x3f')]()[_0xa046('0x17')](respondWithResult(_0x392de2,null))['catch'](handleError(_0x392de2,null));};exports[_0xa046('0x40')]=function(_0x4562b5,_0x524f43){var _0x1dc2b9={'raw':!![],'where':{}},_0x43ed73={},_0x2fbaa3;return db[_0xa046('0x20')]['findOne']({'where':{'id':_0x4562b5[_0xa046('0x2c')]['id']}})[_0xa046('0x17')](handleEntityNotFound(_0x524f43,null))[_0xa046('0x17')](function(_0x2cda3b){if(_0x2cda3b){_0x2fbaa3=_0x2cda3b[_0xa046('0x19')]({'plain':!![]});_0x43ed73[_0xa046('0x2d')]=_[_0xa046('0x2e')](db[_0xa046('0x41')]['rawAttributes']);_0x43ed73[_0xa046('0x28')]=_[_0xa046('0x2e')](_0x4562b5['query']);_0x43ed73['filters']=_[_0xa046('0x30')](_0x43ed73[_0xa046('0x2d')],_0x43ed73['query']);_0x1dc2b9[_0xa046('0x31')]=_['intersection'](_0x43ed73[_0xa046('0x2d')],qs['fields'](_0x4562b5[_0xa046('0x28')][_0xa046('0x42')]));_0x1dc2b9[_0xa046('0x31')]=_0x1dc2b9[_0xa046('0x31')][_0xa046('0x32')]?_0x1dc2b9['attributes']:_0x43ed73['model'];if(!_0x4562b5[_0xa046('0x28')][_0xa046('0x43')]('nolimit')){_0x1dc2b9[_0xa046('0xf')]=qs[_0xa046('0xf')](_0x4562b5[_0xa046('0x28')][_0xa046('0xf')]);_0x1dc2b9[_0xa046('0x12')]=qs['offset'](_0x4562b5[_0xa046('0x28')]['offset']);}_0x1dc2b9[_0xa046('0x44')]=qs['sort'](_0x4562b5['query'][_0xa046('0x45')]);_0x1dc2b9[_0xa046('0x26')]=qs[_0xa046('0x2f')](_[_0xa046('0x46')](_0x4562b5[_0xa046('0x28')],_0x43ed73[_0xa046('0x2f')]));_0x1dc2b9['where']['ChatQueueId']=_0x2cda3b['id'];if(_0x4562b5[_0xa046('0x28')][_0xa046('0x47')]){_0x1dc2b9[_0xa046('0x26')]=_[_0xa046('0x34')](_0x1dc2b9[_0xa046('0x26')],{'$or':_[_0xa046('0x48')](_0x1dc2b9[_0xa046('0x31')],function(_0xdd64e3){var _0x6a8ffa={};_0x6a8ffa[_0xdd64e3]={'$like':'%'+_0x4562b5[_0xa046('0x28')][_0xa046('0x47')]+'%'};return _0x6a8ffa;})});}_0x1dc2b9=_[_0xa046('0x34')]({},_0x1dc2b9,_0x4562b5['options']);return db['UserChatQueue']['findAll'](_0x1dc2b9);}})[_0xa046('0x17')](function(_0x5c5d82){if(_0x5c5d82){return db[_0xa046('0x49')][_0xa046('0x4a')]({'where':{'id':_[_0xa046('0x48')](_0x5c5d82,_0xa046('0x4b')),'role':_0xa046('0x4c')},'attributes':['id','name',_0xa046('0x4d'),_0xa046('0x4e'),'createdAt']});}})[_0xa046('0x17')](function(_0x516380){if(_0x516380){return{'count':_0x516380[_0xa046('0x11')],'rows':_[_0xa046('0x48')](_0x516380[_0xa046('0x29')],function(_0x373717){return{'membername':_0x373717[_0xa046('0x1e')],'UserId':_0x373717['id'],'queue_name':_0x2fbaa3['name'],'ChatQueueId':_0x2fbaa3['id'],'interface':util['format'](_0xa046('0x4f'),'SIP',_0x373717['name']),'penalty':0x0,'paused':_0x373717[_0xa046('0x4d')],'createdAt':_0x373717[_0xa046('0x50')],'updatedAt':_0x373717[_0xa046('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa046('0x17')](respondWithFilteredResult(_0x524f43,_0x1dc2b9))[_0xa046('0x2a')](handleError(_0x524f43,null));};exports[_0xa046('0x51')]=function(_0x166e4f,_0x4be41b){var _0x37cedf={};var _0x2dc520={};var _0x898bdb;var _0x3f0c23;return db[_0xa046('0x20')][_0xa046('0x52')]({'where':{'id':_0x166e4f[_0xa046('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4be41b,null))[_0xa046('0x17')](function(_0xf2680f){if(_0xf2680f){_0x898bdb=_0xf2680f;_0x2dc520[_0xa046('0x2d')]=_[_0xa046('0x2e')](db[_0xa046('0x53')][_0xa046('0x21')]);_0x2dc520['query']=_[_0xa046('0x2e')](_0x166e4f[_0xa046('0x28')]);_0x2dc520[_0xa046('0x2f')]=_['intersection'](_0x2dc520['model'],_0x2dc520['query']);_0x37cedf[_0xa046('0x31')]=_[_0xa046('0x30')](_0x2dc520[_0xa046('0x2d')],qs['fields'](_0x166e4f[_0xa046('0x28')][_0xa046('0x42')]));_0x37cedf[_0xa046('0x31')]=_0x37cedf[_0xa046('0x31')][_0xa046('0x32')]?_0x37cedf['attributes']:_0x2dc520['model'];_0x37cedf[_0xa046('0x44')]=qs['sort'](_0x166e4f[_0xa046('0x28')][_0xa046('0x45')]);_0x37cedf[_0xa046('0x26')]=qs[_0xa046('0x2f')](_[_0xa046('0x46')](_0x166e4f['query'],_0x2dc520[_0xa046('0x2f')]));if(_0x166e4f['query'][_0xa046('0x47')]){_0x37cedf[_0xa046('0x26')]=_['merge'](_0x37cedf[_0xa046('0x26')],{'$or':_[_0xa046('0x48')](_0x37cedf[_0xa046('0x31')],function(_0x43252a){var _0x5aca92={};_0x5aca92[_0x43252a]={'$like':'%'+_0x166e4f[_0xa046('0x28')][_0xa046('0x47')]+'%'};return _0x5aca92;})});}_0x37cedf=_[_0xa046('0x34')]({},_0x37cedf,_0x166e4f[_0xa046('0x35')]);return _0x898bdb[_0xa046('0x51')](_0x37cedf);}})[_0xa046('0x17')](function(_0x3edcb7){if(_0x3edcb7){_0x3f0c23=_0x3edcb7[_0xa046('0x32')];if(!_0x166e4f[_0xa046('0x28')][_0xa046('0x43')](_0xa046('0x54'))){_0x37cedf[_0xa046('0xf')]=qs[_0xa046('0xf')](_0x166e4f[_0xa046('0x28')]['limit']);_0x37cedf[_0xa046('0x12')]=qs[_0xa046('0x12')](_0x166e4f[_0xa046('0x28')][_0xa046('0x12')]);}return _0x898bdb[_0xa046('0x51')](_0x37cedf);}})[_0xa046('0x17')](function(_0x3bda14){if(_0x3bda14){return _0x3bda14?{'count':_0x3f0c23,'rows':_0x3bda14}:null;}})[_0xa046('0x17')](respondWithResult(_0x4be41b,null))[_0xa046('0x2a')](handleError(_0x4be41b,null));};exports[_0xa046('0x55')]=function(_0x434543,_0x157b91){var _0x3674b9=_0x434543['body']['ids'];return db[_0xa046('0x53')]['findAll']({'where':{'id':_0x3674b9},'attributes':['id'],'include':[{'model':db[_0xa046('0x49')],'as':_0xa046('0x56'),'attributes':['id',_0xa046('0x1e'),_0xa046('0x57'),_0xa046('0x58'),_0xa046('0x59')],'raw':!![]}]})[_0xa046('0x17')](function(_0x38403d){if(_0x38403d){var _0x2f60a5=_['flatMap'](_0x38403d,function(_0x329120){var _0x4feedc=_0x329120['get']({'plain':!![]});return _0x4feedc[_0xa046('0x56')];});return db[_0xa046('0x20')][_0xa046('0x36')]({'where':{'id':_0x434543[_0xa046('0x2c')]['id']}})[_0xa046('0x17')](function(_0x20be1b){return db[_0xa046('0x5a')][_0xa046('0x5b')](function(_0x4b5115){return _0x20be1b[_0xa046('0x55')](_0x3674b9,{'transaction':_0x4b5115})[_0xa046('0x17')](function(){return BPromise['each'](_0x2f60a5,function(_0x1b2f66){return db[_0xa046('0x41')]['findOrCreate']({'where':{'UserId':_0x1b2f66['id'],'ChatQueueId':_0x434543['params']['id']},'transaction':_0x4b5115});});})[_0xa046('0x17')](function(){_0x2f60a5['forEach'](function(_0x58642f){socket['emit'](_0xa046('0x5c'),{'UserId':_0x58642f['id'],'ChatQueueId':_0x20be1b['id']});});});});});}})[_0xa046('0x17')](respondWithStatusCode(_0x157b91,null))[_0xa046('0x2a')](handleError(_0x157b91,null));};exports[_0xa046('0x5d')]=function(_0x1d68c9,_0x42deaa){return db['Team'][_0xa046('0x5e')]({'where':{'id':_0x1d68c9['query'][_0xa046('0x5f')]},'attributes':['id'],'include':[{'model':db[_0xa046('0x49')],'as':_0xa046('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x42deaa,null))[_0xa046('0x17')](function(_0x34ad9f){var _0x3c0b9b=_[_0xa046('0x48')](_0x34ad9f,'id');var _0x29276a=[];var _0x14a733=[];var _0x529e67=squel[_0xa046('0x60')]();_0x529e67[_0xa046('0x61')]('tq.TeamId')[_0xa046('0x62')](_0xa046('0x63'),'tq')['join']('user_has_teams','ut',_0xa046('0x64'))[_0xa046('0x26')]('ChatQueueId\x20=\x20?',_0x1d68c9['params']['id']);for(var _0xd3fd5f=0x0;_0xd3fd5f<_0x34ad9f['length'];_0xd3fd5f+=0x1){let _0x316ef8=_0x34ad9f[_0xd3fd5f];for(var _0x1d5534=0x0;_0x1d5534<_0x316ef8['Agents'][_0xa046('0x32')];_0x1d5534+=0x1){let _0x23d373=_0x316ef8['Agents'][_0x1d5534];var _0x2016b9=_0x529e67[_0xa046('0x65')]();_0x2016b9[_0xa046('0x26')](_0xa046('0x66'),_0x23d373['id']);_0x14a733[_0xa046('0x67')](db[_0xa046('0x5a')]['query'](_0x2016b9['toString'](),{'type':db[_0xa046('0x5a')][_0xa046('0x68')][_0xa046('0x69')]})[_0xa046('0x17')](function(_0x1f1ea9){if(_0x1f1ea9['length']===0x1){return _0x23d373['id'];}else{var _0x422561=_[_0xa046('0x6a')](_['map'](_0x1f1ea9,_0xa046('0x6b')),function(_0x83af2d){return _[_0xa046('0x6c')](_0x3c0b9b,_0x83af2d);});if(_0x422561){return _0x23d373['id'];}}}));}}return BPromise[_0xa046('0x6d')](_0x14a733)['then'](function(_0x148f88){_0x29276a=_(_0x29276a)['union'](_0x148f88)[_0xa046('0x6e')]()[_0xa046('0x6f')]();return db[_0xa046('0x20')][_0xa046('0x36')]({'where':{'id':_0x1d68c9[_0xa046('0x2c')]['id']}})[_0xa046('0x17')](function(_0x307843){return db[_0xa046('0x5a')][_0xa046('0x5b')](function(_0x5d113a){return _0x307843[_0xa046('0x5d')](_0x1d68c9[_0xa046('0x28')]['ids'],{'transaction':_0x5d113a})[_0xa046('0x17')](function(){if(!_[_0xa046('0x70')](_0x29276a)){return _0x307843['removeAgents'](_0x29276a,{'transaction':_0x5d113a});}})[_0xa046('0x17')](function(){_0x29276a[_0xa046('0x71')](function(_0x158d78){socket[_0xa046('0x72')](_0xa046('0x73'),{'UserId':_0x158d78,'ChatQueueId':_0x307843['id']});});});});});});})[_0xa046('0x17')](respondWithStatusCode(_0x42deaa,null))[_0xa046('0x2a')](handleError(_0x42deaa,null));};exports[_0xa046('0x74')]=function(_0x2e9422,_0x4908e0){return db[_0xa046('0x20')]['find']({'where':{'id':_0x2e9422['params']['id']}})[_0xa046('0x17')](handleEntityNotFound(_0x4908e0,null))[_0xa046('0x17')](function(_0x5f451d){if(_0x5f451d){return _0x5f451d['addAgents'](_0x2e9422[_0xa046('0x3e')][_0xa046('0x5f')],_['omit'](_0x2e9422[_0xa046('0x3e')],['ids','id'])||{})[_0xa046('0x75')](function(_0x3d77fa){for(var _0x237931=0x0;_0x237931<_0x2e9422[_0xa046('0x3e')][_0xa046('0x5f')][_0xa046('0x32')];_0x237931+=0x1){socket[_0xa046('0x72')](_0xa046('0x5c'),{'UserId':Number(_0x2e9422['body'][_0xa046('0x5f')][_0x237931]),'ChatQueueId':Number(_0x2e9422['params']['id'])});}return _0x3d77fa;});}})[_0xa046('0x17')](respondWithResult(_0x4908e0,null))[_0xa046('0x2a')](handleError(_0x4908e0,null));};exports[_0xa046('0x76')]=function(_0x8168aa,_0x3f8fdb){return db['ChatQueue'][_0xa046('0x36')]({'where':{'id':_0x8168aa[_0xa046('0x2c')]['id']}})[_0xa046('0x17')](handleEntityNotFound(_0x3f8fdb,null))[_0xa046('0x17')](function(_0x4f6677){if(_0x4f6677){return _0x4f6677['removeAgents'](_0x8168aa['query'][_0xa046('0x5f')])[_0xa046('0x17')](function(){if(_['isArray'](_0x8168aa[_0xa046('0x28')][_0xa046('0x5f')])){for(var _0x1c33bc=0x0;_0x1c33bc<_0x8168aa['query'][_0xa046('0x5f')][_0xa046('0x32')];_0x1c33bc+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x8168aa[_0xa046('0x28')][_0xa046('0x5f')][_0x1c33bc]),'ChatQueueId':Number(_0x8168aa[_0xa046('0x2c')]['id'])});}}else{socket[_0xa046('0x72')]('userChatQueue:remove',{'UserId':Number(_0x8168aa[_0xa046('0x28')][_0xa046('0x5f')]),'ChatQueueId':Number(_0x8168aa['params']['id'])});}});}})[_0xa046('0x17')](respondWithStatusCode(_0x3f8fdb,null))[_0xa046('0x2a')](handleError(_0x3f8fdb,null));};exports[_0xa046('0x77')]=function(_0x7e127f,_0x245686){var _0x518f0e={};var _0x4121ac={};var _0x29dc02;var _0x45f25d;return db[_0xa046('0x20')][_0xa046('0x52')]({'where':{'id':_0x7e127f[_0xa046('0x2c')]['id']}})[_0xa046('0x17')](handleEntityNotFound(_0x245686,null))[_0xa046('0x17')](function(_0x3cb517){if(_0x3cb517){_0x29dc02=_0x3cb517;_0x4121ac[_0xa046('0x2d')]=_[_0xa046('0x2e')](db[_0xa046('0x49')][_0xa046('0x21')]);_0x4121ac[_0xa046('0x28')]=_[_0xa046('0x2e')](_0x7e127f[_0xa046('0x28')]);_0x4121ac[_0xa046('0x2f')]=_[_0xa046('0x30')](_0x4121ac[_0xa046('0x2d')],_0x4121ac[_0xa046('0x28')]);_0x518f0e[_0xa046('0x31')]=_[_0xa046('0x30')](_0x4121ac['model'],qs[_0xa046('0x42')](_0x7e127f[_0xa046('0x28')][_0xa046('0x42')]));_0x518f0e['attributes']=_0x518f0e[_0xa046('0x31')][_0xa046('0x32')]?_0x518f0e[_0xa046('0x31')]:_0x4121ac[_0xa046('0x2d')];_0x518f0e[_0xa046('0x44')]=qs[_0xa046('0x45')](_0x7e127f[_0xa046('0x28')][_0xa046('0x45')]);_0x518f0e[_0xa046('0x26')]=qs['filters'](_['pick'](_0x7e127f['query'],_0x4121ac[_0xa046('0x2f')]));if(_0x7e127f[_0xa046('0x28')]['filter']){_0x518f0e['where']=_['merge'](_0x518f0e['where'],{'$or':_['map'](_0x518f0e['attributes'],function(_0xbd8525){var _0x2e694d={};_0x2e694d[_0xbd8525]={'$like':'%'+_0x7e127f[_0xa046('0x28')][_0xa046('0x47')]+'%'};return _0x2e694d;})});}_0x518f0e=_['merge']({},_0x518f0e,_0x7e127f[_0xa046('0x35')]);return _0x29dc02[_0xa046('0x77')](_0x518f0e);}})[_0xa046('0x17')](function(_0x12904b){if(_0x12904b){_0x45f25d=_0x12904b[_0xa046('0x32')];if(!_0x7e127f[_0xa046('0x28')][_0xa046('0x43')]('nolimit')){_0x518f0e[_0xa046('0xf')]=qs[_0xa046('0xf')](_0x7e127f['query']['limit']);_0x518f0e['offset']=qs[_0xa046('0x12')](_0x7e127f[_0xa046('0x28')][_0xa046('0x12')]);}return _0x29dc02['getAgents'](_0x518f0e);}})[_0xa046('0x17')](function(_0x52bca1){if(_0x52bca1){return _0x52bca1?{'count':_0x45f25d,'rows':_0x52bca1}:null;}})[_0xa046('0x17')](respondWithResult(_0x245686,null))[_0xa046('0x2a')](handleError(_0x245686,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index b2c6bec..2d2f05f 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb776=['exports','events','../../mysqldb','ChatQueue','save','update','remove','emit','hook'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0xb776,0x1cc));var _0x6b77=function(_0x59ab10,_0x538141){_0x59ab10=_0x59ab10-0x0;var _0x383f73=_0xb776[_0x59ab10];return _0x383f73;};'use strict';var EventEmitter=require(_0x6b77('0x0'));var ChatQueue=require(_0x6b77('0x1'))['db'][_0x6b77('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b77('0x3'),'afterUpdate':_0x6b77('0x4'),'afterDestroy':_0x6b77('0x5')};function emitEvent(_0x35789c){return function(_0x3663c7,_0xb8ebde,_0x383a47){ChatQueueEvents[_0x6b77('0x6')](_0x35789c+':'+_0x3663c7['id'],_0x3663c7);ChatQueueEvents[_0x6b77('0x6')](_0x35789c,_0x3663c7);_0x383a47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x6b77('0x7')](e,emitEvent(event));}}module[_0x6b77('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xfa54=['ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa54,0x98));var _0x4fa5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xfa54[_0x2be8c2];return _0x97f531;};'use strict';var EventEmitter=require(_0x4fa5('0x0'));var ChatQueue=require(_0x4fa5('0x1'))['db'][_0x4fa5('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4fa5('0x3')](0x0);var events={'afterCreate':_0x4fa5('0x4'),'afterUpdate':_0x4fa5('0x5'),'afterDestroy':_0x4fa5('0x6')};function emitEvent(_0x384cfd){return function(_0x28eafe,_0x279534,_0x380e9f){ChatQueueEvents[_0x4fa5('0x7')](_0x384cfd+':'+_0x28eafe['id'],_0x28eafe);ChatQueueEvents[_0x4fa5('0x7')](_0x384cfd,_0x28eafe);_0x380e9f(null);};}for(var e in events){if(events[_0x4fa5('0x8')](e)){var event=events[e];ChatQueue[_0x4fa5('0x9')](e,emitEvent(event));}}module[_0x4fa5('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 9bd8aa5..a9c0be8 100644 --- a/server/api/chatQueue/chatQueue.model.js +++ b/server/api/chatQueue/chatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d2c=['../../config/logger','api','moment','bluebird','request-promise','path','./chatQueue.attributes','exports','lodash','util'];(function(_0x452558,_0x565159){var _0x3027f7=function(_0x198dc7){while(--_0x198dc7){_0x452558['push'](_0x452558['shift']());}};_0x3027f7(++_0x565159);}(_0x7d2c,0x184));var _0xc7d2=function(_0x3c42f0,_0x421a98){_0x3c42f0=_0x3c42f0-0x0;var _0x2e39da=_0x7d2c[_0x3c42f0];return _0x2e39da;};'use strict';var _=require(_0xc7d2('0x0'));var util=require(_0xc7d2('0x1'));var logger=require(_0xc7d2('0x2'))(_0xc7d2('0x3'));var moment=require(_0xc7d2('0x4'));var BPromise=require(_0xc7d2('0x5'));var rp=require(_0xc7d2('0x6'));var fs=require('fs');var path=require(_0xc7d2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc7d2('0x8'));module[_0xc7d2('0x9')]=function(_0x188d37,_0x49c3bc){return _0x188d37['define']('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e0e=['bluebird','request-promise','path','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','moment'];(function(_0xa22e9f,_0x5cd275){var _0x1d9a64=function(_0x1be759){while(--_0x1be759){_0xa22e9f['push'](_0xa22e9f['shift']());}};_0x1d9a64(++_0x5cd275);}(_0x8e0e,0x17e));var _0xe8e0=function(_0x30c8c7,_0x455188){_0x30c8c7=_0x30c8c7-0x0;var _0x55f32d=_0x8e0e[_0x30c8c7];return _0x55f32d;};'use strict';var _=require('lodash');var util=require(_0xe8e0('0x0'));var logger=require(_0xe8e0('0x1'))('api');var moment=require(_0xe8e0('0x2'));var BPromise=require(_0xe8e0('0x3'));var rp=require(_0xe8e0('0x4'));var fs=require('fs');var path=require(_0xe8e0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe8e0('0x6'));module[_0xe8e0('0x7')]=function(_0x2b4d7e,_0x520017){return _0x2b4d7e[_0xe8e0('0x8')](_0xe8e0('0x9'),attributes,{'tableName':_0xe8e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 7428814..785adcd 100644 --- a/server/api/chatQueue/chatQueue.rpc.js +++ b/server/api/chatQueue/chatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x236c=['error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','info','debug','find','ShowChatQueue','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./chatQueue.socket','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1aaa19,_0x3e7c58){var _0x1dd09e=function(_0x60a6fe){while(--_0x60a6fe){_0x1aaa19['push'](_0x1aaa19['shift']());}};_0x1dd09e(++_0x3e7c58);}(_0x236c,0x155));var _0xc236=function(_0x1fc619,_0x29ad91){_0x1fc619=_0x1fc619-0x0;var _0x3a5129=_0x236c[_0x1fc619];return _0x3a5129;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});config['redis']=_[_0xc236('0xc')](config[_0xc236('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc236('0xe'))['register'](socket);function respondWithRpcPromise(_0x30a28d,_0x381ed1,_0x18f33b){return new BPromise(function(_0x2f8b72,_0xaf651b){return client['request'](_0x30a28d,_0x18f33b)[_0xc236('0xf')](function(_0x3311f7){logger['info'](_0xc236('0x10'),_0x381ed1,_0xc236('0x11'));logger['debug'](_0xc236('0x12'),_0x381ed1,'request\x20sent',JSON['stringify'](_0x3311f7));if(_0x3311f7[_0xc236('0x13')]){if(_0x3311f7[_0xc236('0x13')][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('ChatQueue,\x20%s,\x20%s',_0x381ed1,_0x3311f7[_0xc236('0x13')]['message']);return _0xaf651b(_0x3311f7['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0x10'),_0x381ed1,_0x3311f7[_0xc236('0x13')][_0xc236('0x15')]);return _0x2f8b72(_0x3311f7['error']['message']);}else{logger['info'](_0xc236('0x10'),_0x381ed1,_0xc236('0x11'));_0x2f8b72(_0x3311f7[_0xc236('0x16')]['message']);}})[_0xc236('0x17')](function(_0x506974){logger['error'](_0xc236('0x10'),_0x381ed1,_0x506974);_0xaf651b(_0x506974);});});}exports[_0xc236('0x18')]=function(_0x3a6183){var _0x46bc69=this;return new Promise(function(_0x2b6d3f,_0x27c6ab){return db[_0xc236('0x19')][_0xc236('0x1a')]({'raw':_0x3a6183[_0xc236('0x1b')]?_0x3a6183[_0xc236('0x1b')][_0xc236('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a6183['options']?_0x3a6183[_0xc236('0x1b')][_0xc236('0x1d')]||null:null,'attributes':_0x3a6183[_0xc236('0x1b')]?_0x3a6183[_0xc236('0x1b')][_0xc236('0x1e')]||null:null,'limit':_0x3a6183[_0xc236('0x1b')]?_0x3a6183[_0xc236('0x1b')][_0xc236('0x1f')]||null:null,'include':_0x3a6183[_0xc236('0x1b')]?_0x3a6183[_0xc236('0x1b')][_0xc236('0x20')]?_['map'](_0x3a6183[_0xc236('0x1b')][_0xc236('0x20')],function(_0x356042){return{'model':db[_0x356042[_0xc236('0x21')]],'as':_0x356042['as'],'attributes':_0x356042['attributes'],'include':_0x356042[_0xc236('0x20')]?_['map'](_0x356042['include'],function(_0x15ead8){return{'model':db[_0x15ead8['model']],'as':_0x15ead8['as'],'attributes':_0x15ead8[_0xc236('0x1e')],'include':_0x15ead8['include']?_[_0xc236('0x22')](_0x15ead8['include'],function(_0x423842){return{'model':db[_0x423842[_0xc236('0x21')]],'as':_0x423842['as'],'attributes':_0x423842['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x265c8d){logger[_0xc236('0x23')](_0xc236('0x18'),_0x3a6183);logger[_0xc236('0x24')]('GetChatQueue',_0x3a6183,JSON['stringify'](_0x265c8d));_0x2b6d3f(_0x265c8d);})[_0xc236('0x17')](function(_0x53b767){logger[_0xc236('0x13')]('GetChatQueue',_0x53b767[_0xc236('0x15')],_0x3a6183);_0x27c6ab(_0x46bc69[_0xc236('0x13')](0x1f4,_0x53b767['message']));});});};exports['ShowChatQueue']=function(_0x2537f9){var _0x3053a3=this;return new Promise(function(_0xbda858,_0x2f64bd){return db[_0xc236('0x19')][_0xc236('0x25')]({'raw':_0x2537f9[_0xc236('0x1b')]?_0x2537f9[_0xc236('0x1b')][_0xc236('0x1c')]===undefined?!![]:![]:!![],'where':_0x2537f9['options']?_0x2537f9['options']['where']||null:null,'attributes':_0x2537f9[_0xc236('0x1b')]?_0x2537f9[_0xc236('0x1b')][_0xc236('0x1e')]||null:null,'include':_0x2537f9[_0xc236('0x1b')]?_0x2537f9[_0xc236('0x1b')][_0xc236('0x20')]?_[_0xc236('0x22')](_0x2537f9['options'][_0xc236('0x20')],function(_0x3f9b1d){return{'model':db[_0x3f9b1d[_0xc236('0x21')]],'as':_0x3f9b1d['as'],'attributes':_0x3f9b1d['attributes'],'include':_0x3f9b1d[_0xc236('0x20')]?_[_0xc236('0x22')](_0x3f9b1d[_0xc236('0x20')],function(_0x281137){return{'model':db[_0x281137['model']],'as':_0x281137['as'],'attributes':_0x281137[_0xc236('0x1e')],'include':_0x281137[_0xc236('0x20')]?_[_0xc236('0x22')](_0x281137[_0xc236('0x20')],function(_0x3f3785){return{'model':db[_0x3f3785[_0xc236('0x21')]],'as':_0x3f3785['as'],'attributes':_0x3f3785[_0xc236('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc236('0xf')](function(_0x131212){logger[_0xc236('0x23')](_0xc236('0x26'),_0x2537f9);logger[_0xc236('0x24')](_0xc236('0x26'),_0x2537f9,JSON[_0xc236('0x27')](_0x131212));_0xbda858(_0x131212);})[_0xc236('0x17')](function(_0x3973be){logger[_0xc236('0x13')]('ShowChatQueue',_0x3973be['message'],_0x2537f9);_0x2f64bd(_0x3053a3['error'](0x1f4,_0x3973be['message']));});});}; \ No newline at end of file +var _0x74fd=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then'];(function(_0x52c6bf,_0x29c95b){var _0x37fea0=function(_0xb23096){while(--_0xb23096){_0x52c6bf['push'](_0x52c6bf['shift']());}};_0x37fea0(++_0x29c95b);}(_0x74fd,0x8f));var _0xd74f=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x74fd[_0x31a576];return _0x30b1d3;};'use strict';var _=require(_0xd74f('0x0'));var util=require('util');var moment=require(_0xd74f('0x1'));var BPromise=require(_0xd74f('0x2'));var rs=require(_0xd74f('0x3'));var fs=require('fs');var Redis=require(_0xd74f('0x4'));var db=require(_0xd74f('0x5'))['db'];var utils=require(_0xd74f('0x6'));var logger=require(_0xd74f('0x7'))(_0xd74f('0x8'));var config=require(_0xd74f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd74f('0xa')]({'port':0x232a});config[_0xd74f('0xb')]=_['defaults'](config[_0xd74f('0xb')],{'host':_0xd74f('0xc'),'port':0x18eb});var socket=require(_0xd74f('0xd'))(new Redis(config[_0xd74f('0xb')]));require(_0xd74f('0xe'))['register'](socket);function respondWithRpcPromise(_0x50f801,_0x33150f,_0x58836e){return new BPromise(function(_0x50790b,_0x39552d){return client[_0xd74f('0xf')](_0x50f801,_0x58836e)[_0xd74f('0x10')](function(_0x176773){logger[_0xd74f('0x11')](_0xd74f('0x12'),_0x33150f,_0xd74f('0x13'));logger[_0xd74f('0x14')](_0xd74f('0x15'),_0x33150f,'request\x20sent',JSON[_0xd74f('0x16')](_0x176773));if(_0x176773[_0xd74f('0x17')]){if(_0x176773[_0xd74f('0x17')][_0xd74f('0x18')]===0x1f4){logger[_0xd74f('0x17')]('ChatQueue,\x20%s,\x20%s',_0x33150f,_0x176773[_0xd74f('0x17')][_0xd74f('0x19')]);return _0x39552d(_0x176773[_0xd74f('0x17')]['message']);}logger[_0xd74f('0x17')](_0xd74f('0x12'),_0x33150f,_0x176773['error'][_0xd74f('0x19')]);return _0x50790b(_0x176773[_0xd74f('0x17')][_0xd74f('0x19')]);}else{logger[_0xd74f('0x11')](_0xd74f('0x12'),_0x33150f,_0xd74f('0x13'));_0x50790b(_0x176773[_0xd74f('0x1a')]['message']);}})[_0xd74f('0x1b')](function(_0x43ede4){logger['error'](_0xd74f('0x12'),_0x33150f,_0x43ede4);_0x39552d(_0x43ede4);});});}exports[_0xd74f('0x1c')]=function(_0x36377a){var _0x5b2746=this;return new Promise(function(_0x554b8f,_0x586a75){return db[_0xd74f('0x1d')]['findAll']({'raw':_0x36377a['options']?_0x36377a[_0xd74f('0x1e')][_0xd74f('0x1f')]===undefined?!![]:![]:!![],'where':_0x36377a['options']?_0x36377a[_0xd74f('0x1e')][_0xd74f('0x20')]||null:null,'attributes':_0x36377a['options']?_0x36377a['options'][_0xd74f('0x21')]||null:null,'limit':_0x36377a[_0xd74f('0x1e')]?_0x36377a[_0xd74f('0x1e')][_0xd74f('0x22')]||null:null,'include':_0x36377a[_0xd74f('0x1e')]?_0x36377a[_0xd74f('0x1e')][_0xd74f('0x23')]?_[_0xd74f('0x24')](_0x36377a[_0xd74f('0x1e')][_0xd74f('0x23')],function(_0x1abb89){return{'model':db[_0x1abb89[_0xd74f('0x25')]],'as':_0x1abb89['as'],'attributes':_0x1abb89[_0xd74f('0x21')],'include':_0x1abb89[_0xd74f('0x23')]?_[_0xd74f('0x24')](_0x1abb89['include'],function(_0x4ea720){return{'model':db[_0x4ea720['model']],'as':_0x4ea720['as'],'attributes':_0x4ea720[_0xd74f('0x21')],'include':_0x4ea720[_0xd74f('0x23')]?_[_0xd74f('0x24')](_0x4ea720[_0xd74f('0x23')],function(_0x175c36){return{'model':db[_0x175c36[_0xd74f('0x25')]],'as':_0x175c36['as'],'attributes':_0x175c36[_0xd74f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd74f('0x10')](function(_0x33d02e){logger[_0xd74f('0x11')](_0xd74f('0x1c'),_0x36377a);logger['debug'](_0xd74f('0x1c'),_0x36377a,JSON[_0xd74f('0x16')](_0x33d02e));_0x554b8f(_0x33d02e);})[_0xd74f('0x1b')](function(_0x29af0c){logger[_0xd74f('0x17')]('GetChatQueue',_0x29af0c[_0xd74f('0x19')],_0x36377a);_0x586a75(_0x5b2746[_0xd74f('0x17')](0x1f4,_0x29af0c[_0xd74f('0x19')]));});});};exports[_0xd74f('0x26')]=function(_0x306c1f){var _0x34b074=this;return new Promise(function(_0x16ef8c,_0x572535){return db[_0xd74f('0x1d')][_0xd74f('0x27')]({'raw':_0x306c1f[_0xd74f('0x1e')]?_0x306c1f[_0xd74f('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x306c1f['options']?_0x306c1f[_0xd74f('0x1e')][_0xd74f('0x20')]||null:null,'attributes':_0x306c1f[_0xd74f('0x1e')]?_0x306c1f[_0xd74f('0x1e')][_0xd74f('0x21')]||null:null,'include':_0x306c1f['options']?_0x306c1f[_0xd74f('0x1e')]['include']?_[_0xd74f('0x24')](_0x306c1f['options']['include'],function(_0x2f8a33){return{'model':db[_0x2f8a33[_0xd74f('0x25')]],'as':_0x2f8a33['as'],'attributes':_0x2f8a33[_0xd74f('0x21')],'include':_0x2f8a33['include']?_[_0xd74f('0x24')](_0x2f8a33[_0xd74f('0x23')],function(_0x126ac9){return{'model':db[_0x126ac9[_0xd74f('0x25')]],'as':_0x126ac9['as'],'attributes':_0x126ac9[_0xd74f('0x21')],'include':_0x126ac9[_0xd74f('0x23')]?_[_0xd74f('0x24')](_0x126ac9[_0xd74f('0x23')],function(_0x23fa3f){return{'model':db[_0x23fa3f[_0xd74f('0x25')]],'as':_0x23fa3f['as'],'attributes':_0x23fa3f[_0xd74f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd74f('0x10')](function(_0x218fe5){logger[_0xd74f('0x11')](_0xd74f('0x26'),_0x306c1f);logger[_0xd74f('0x14')]('ShowChatQueue',_0x306c1f,JSON[_0xd74f('0x16')](_0x218fe5));_0x16ef8c(_0x218fe5);})[_0xd74f('0x1b')](function(_0x25a801){logger[_0xd74f('0x17')](_0xd74f('0x26'),_0x25a801[_0xd74f('0x19')],_0x306c1f);_0x572535(_0x34b074[_0xd74f('0x17')](0x1f4,_0x25a801[_0xd74f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f9f2cc5..c91fa93 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7c8=['chatQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0x2a9831,_0x599826){var _0x4df16c=function(_0x27bea6){while(--_0x27bea6){_0x2a9831['push'](_0x2a9831['shift']());}};_0x4df16c(++_0x599826);}(_0xb7c8,0x119));var _0x8b7c=function(_0x5bd86b,_0x504b7b){_0x5bd86b=_0x5bd86b-0x0;var _0x74090a=_0xb7c8[_0x5bd86b];return _0x74090a;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8b7c('0x0'),_0x8b7c('0x1'),_0x8b7c('0x2')];function createListener(_0x3a84fc,_0x1dceff){return function(_0x31ad24){_0x1dceff[_0x8b7c('0x3')](_0x3a84fc,_0x31ad24);};}function removeListener(_0x50113e,_0x38672b){return function(){ChatQueueEvents[_0x8b7c('0x4')](_0x50113e,_0x38672b);};}exports[_0x8b7c('0x5')]=function(_0x440900){for(var _0x107428=0x0,_0x12665c=events[_0x8b7c('0x6')];_0x107428<_0x12665c;_0x107428++){var _0x3c8fd6=events[_0x107428];var _0x6afb55=createListener(_0x8b7c('0x7')+_0x3c8fd6,_0x440900);ChatQueueEvents['on'](_0x3c8fd6,_0x6afb55);}}; \ No newline at end of file +var _0x84ab=['update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save','remove'];(function(_0x5728ba,_0x4259e2){var _0x529a3a=function(_0x36a810){while(--_0x36a810){_0x5728ba['push'](_0x5728ba['shift']());}};_0x529a3a(++_0x4259e2);}(_0x84ab,0x12f));var _0xb84a=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x84ab[_0x2eb5bc];return _0x51c7b1;};'use strict';var ChatQueueEvents=require(_0xb84a('0x0'));var events=[_0xb84a('0x1'),_0xb84a('0x2'),_0xb84a('0x3')];function createListener(_0x473c3,_0x512f13){return function(_0xc83587){_0x512f13[_0xb84a('0x4')](_0x473c3,_0xc83587);};}function removeListener(_0x47b8e3,_0x9d3a00){return function(){ChatQueueEvents[_0xb84a('0x5')](_0x47b8e3,_0x9d3a00);};}exports[_0xb84a('0x6')]=function(_0x5b9def){for(var _0x521a64=0x0,_0x4dc496=events[_0xb84a('0x7')];_0x521a64<_0x4dc496;_0x521a64++){var _0x4fac4d=events[_0x521a64];var _0x3e9086=createListener(_0xb84a('0x8')+_0x4fac4d,_0x5b9def);ChatQueueEvents['on'](_0x4fac4d,_0x3e9086);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index b89264f..3681bd4 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x5dd5d9,_0x1e4895){var _0xbbeaa7=function(_0x24f203){while(--_0x24f203){_0x5dd5d9['push'](_0x5dd5d9['shift']());}};_0xbbeaa7(++_0x1e4895);}(_0xe14b,0x93));var _0xbe14=function(_0x49d259,_0x297ed6){_0x49d259=_0x49d259-0x0;var _0x11c87e=_0xe14b[_0x49d259];return _0x11c87e;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x384b0a,_0x4aff7c){var _0x10a10b=function(_0x4ef092){while(--_0x4ef092){_0x384b0a['push'](_0x384b0a['shift']());}};_0x10a10b(++_0x4aff7c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index d05947b..e4bb90e 100644 --- a/server/api/chatQueueReport/chatQueueReport.attributes.js +++ b/server/api/chatQueueReport/chatQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ac3=['STRING','DATE','moment','sequelize','exports'];(function(_0x6cfb8a,_0x53be6f){var _0x29ba1d=function(_0x104303){while(--_0x104303){_0x6cfb8a['push'](_0x6cfb8a['shift']());}};_0x29ba1d(++_0x53be6f);}(_0x1ac3,0x129));var _0x31ac=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x1ac3[_0x5bd426];return _0x23a7eb;};'use strict';var moment=require(_0x31ac('0x0'));var Sequelize=require(_0x31ac('0x1'));module[_0x31ac('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x31ac('0x3')]},'joinAt':{'type':Sequelize[_0x31ac('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x31ac('0x4')]},'reason':{'type':Sequelize[_0x31ac('0x3')]}}; \ No newline at end of file +var _0x3691=['moment','sequelize','STRING','DATE'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x3691,0xac));var _0x1369=function(_0x1789e7,_0x4b22c1){_0x1789e7=_0x1789e7-0x0;var _0x4daf76=_0x3691[_0x1789e7];return _0x4daf76;};'use strict';var moment=require(_0x1369('0x0'));var Sequelize=require(_0x1369('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1369('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1369('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1369('0x3')]},'acceptAt':{'type':Sequelize[_0x1369('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1369('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 6fe45e3..de56218 100644 --- a/server/api/chatQueueReport/chatQueueReport.controller.js +++ b/server/api/chatQueueReport/chatQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf562=['map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','ChatQueueReport','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','fieldName','type','key','model'];(function(_0x2ffd34,_0xc660c9){var _0x9d8e89=function(_0x5609fd){while(--_0x5609fd){_0x2ffd34['push'](_0x2ffd34['shift']());}};_0x9d8e89(++_0xc660c9);}(_0xf562,0x100));var _0x2f56=function(_0x3ba963,_0x26436b){_0x3ba963=_0x3ba963-0x0;var _0x5d0bc4=_0xf562[_0x3ba963];return _0x5d0bc4;};'use strict';var emlformat=require(_0x2f56('0x0'));var rimraf=require(_0x2f56('0x1'));var zipdir=require(_0x2f56('0x2'));var jsonpatch=require(_0x2f56('0x3'));var rp=require(_0x2f56('0x4'));var moment=require(_0x2f56('0x5'));var BPromise=require(_0x2f56('0x6'));var Mustache=require(_0x2f56('0x7'));var util=require(_0x2f56('0x8'));var path=require('path');var sox=require(_0x2f56('0x9'));var csv=require('to-csv');var ejs=require(_0x2f56('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f56('0xb'));var squel=require(_0x2f56('0xc'));var crypto=require(_0x2f56('0xd'));var jsforce=require(_0x2f56('0xe'));var deskjs=require(_0x2f56('0xf'));var toCsv=require(_0x2f56('0x10'));var querystring=require(_0x2f56('0x11'));var Papa=require(_0x2f56('0x12'));var Redis=require(_0x2f56('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2f56('0x14'));var as=require(_0x2f56('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f56('0x16'))(_0x2f56('0x17'));var utils=require('../../config/utils');var config=require(_0x2f56('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f56('0x19'))['db'];function respondWithStatusCode(_0x519c81,_0xa190b0){_0xa190b0=_0xa190b0||0xcc;return function(_0x3bec3f){if(_0x3bec3f){return _0x519c81[_0x2f56('0x1a')](_0xa190b0);}return _0x519c81[_0x2f56('0x1b')](_0xa190b0)[_0x2f56('0x1c')]();};}function respondWithResult(_0x69fc74,_0x37e55f){_0x37e55f=_0x37e55f||0xc8;return function(_0x3d9cb3){if(_0x3d9cb3){return _0x69fc74['status'](_0x37e55f)[_0x2f56('0x1d')](_0x3d9cb3);}};}function respondWithFilteredResult(_0x42a056,_0x11dd1e){return function(_0x1d2463){if(_0x1d2463){var _0x341045=typeof _0x11dd1e['offset']===_0x2f56('0x1e')&&typeof _0x11dd1e[_0x2f56('0x1f')]===_0x2f56('0x1e');var _0x3e3165=_0x1d2463[_0x2f56('0x20')];var _0x59db1d=_0x341045?0x0:_0x11dd1e[_0x2f56('0x21')];var _0x33b43f=_0x341045?_0x1d2463[_0x2f56('0x20')]:_0x11dd1e[_0x2f56('0x21')]+_0x11dd1e[_0x2f56('0x1f')];var _0x562cea;if(_0x33b43f>=_0x3e3165){_0x33b43f=_0x3e3165;_0x562cea=0xc8;}else{_0x562cea=0xce;}_0x42a056[_0x2f56('0x1b')](_0x562cea);return _0x42a056[_0x2f56('0x22')](_0x2f56('0x23'),_0x59db1d+'-'+_0x33b43f+'/'+_0x3e3165)[_0x2f56('0x1d')](_0x1d2463);}return null;};}function patchUpdates(_0x33dc10){return function(_0x27613f){try{jsonpatch[_0x2f56('0x24')](_0x27613f,_0x33dc10,!![]);}catch(_0x349d55){return BPromise['reject'](_0x349d55);}return _0x27613f[_0x2f56('0x25')]();};}function saveUpdates(_0x497d3f,_0x5bac85){return function(_0x297827){if(_0x297827){return _0x297827[_0x2f56('0x26')](_0x497d3f)[_0x2f56('0x27')](function(_0x4ee4c9){return _0x4ee4c9;});}return null;};}function removeEntity(_0x21f4b0,_0x433f0b){return function(_0x2db586){if(_0x2db586){return _0x2db586['destroy']()['then'](function(){_0x21f4b0[_0x2f56('0x1b')](0xcc)[_0x2f56('0x1c')]();});}};}function handleEntityNotFound(_0x38b366,_0x3e047b){return function(_0x4406ff){if(!_0x4406ff){_0x38b366['sendStatus'](0x194);}return _0x4406ff;};}function handleError(_0x2641d9,_0xaec9e8){_0xaec9e8=_0xaec9e8||0x1f4;return function(_0x861e9c){logger[_0x2f56('0x28')](_0x861e9c[_0x2f56('0x29')]);if(_0x861e9c[_0x2f56('0x2a')]){delete _0x861e9c[_0x2f56('0x2a')];}_0x2641d9[_0x2f56('0x1b')](_0xaec9e8)[_0x2f56('0x2b')](_0x861e9c);};}exports['index']=function(_0x44ff58,_0x49b89c){var _0x4e6dbc={},_0x284252={},_0x60a325={'count':0x0,'rows':[]};var _0x288019=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0x61a170){return{'name':_0x61a170[_0x2f56('0x2c')],'type':_0x61a170[_0x2f56('0x2d')][_0x2f56('0x2e')]};});_0x284252[_0x2f56('0x2f')]=_[_0x2f56('0x30')](_0x288019,_0x2f56('0x2a'));_0x284252['query']=_[_0x2f56('0x31')](_0x44ff58[_0x2f56('0x32')]);_0x284252[_0x2f56('0x33')]=_['intersection'](_0x284252[_0x2f56('0x2f')],_0x284252[_0x2f56('0x32')]);_0x4e6dbc[_0x2f56('0x34')]=_[_0x2f56('0x35')](_0x284252[_0x2f56('0x2f')],qs[_0x2f56('0x36')](_0x44ff58[_0x2f56('0x32')]['fields']));_0x4e6dbc[_0x2f56('0x34')]=_0x4e6dbc[_0x2f56('0x34')]['length']?_0x4e6dbc[_0x2f56('0x34')]:_0x284252[_0x2f56('0x2f')];if(!_0x44ff58['query'][_0x2f56('0x37')]('nolimit')){_0x4e6dbc['limit']=qs[_0x2f56('0x1f')](_0x44ff58[_0x2f56('0x32')][_0x2f56('0x1f')]);_0x4e6dbc['offset']=qs[_0x2f56('0x21')](_0x44ff58['query'][_0x2f56('0x21')]);}_0x4e6dbc['order']=qs[_0x2f56('0x38')](_0x44ff58[_0x2f56('0x32')][_0x2f56('0x38')]);_0x4e6dbc['where']=qs[_0x2f56('0x33')](_[_0x2f56('0x39')](_0x44ff58[_0x2f56('0x32')],_0x284252[_0x2f56('0x33')]),_0x288019);if(_0x44ff58[_0x2f56('0x32')][_0x2f56('0x3a')]){_0x4e6dbc['where']=_[_0x2f56('0x3b')](_0x4e6dbc[_0x2f56('0x3c')],{'$or':_[_0x2f56('0x30')](_0x288019,function(_0x27c4ce){if(_0x27c4ce[_0x2f56('0x2d')]!==_0x2f56('0x3d')){var _0x141c09={};_0x141c09[_0x27c4ce[_0x2f56('0x2a')]]={'$like':'%'+_0x44ff58[_0x2f56('0x32')]['filter']+'%'};return _0x141c09;}})});}_0x4e6dbc=_[_0x2f56('0x3b')]({},_0x4e6dbc,_0x44ff58['options']);var _0x12032c={'where':_0x4e6dbc[_0x2f56('0x3c')]};return db[_0x2f56('0x3e')][_0x2f56('0x20')](_0x12032c)[_0x2f56('0x27')](function(_0x197bcc){_0x60a325[_0x2f56('0x20')]=_0x197bcc;if(_0x44ff58['query']['includeAll']){_0x4e6dbc[_0x2f56('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x2f56('0x40')](_0x4e6dbc);})[_0x2f56('0x27')](function(_0x1d3efa){_0x60a325[_0x2f56('0x41')]=_0x1d3efa;return _0x60a325;})[_0x2f56('0x27')](respondWithFilteredResult(_0x49b89c,_0x4e6dbc))[_0x2f56('0x42')](handleError(_0x49b89c,null));};exports[_0x2f56('0x43')]=function(_0x18464b,_0x1de6a7){var _0x5cf160={'raw':!![],'where':{'id':_0x18464b[_0x2f56('0x44')]['id']}},_0x5779a6={};_0x5779a6['model']=_[_0x2f56('0x31')](db[_0x2f56('0x3e')][_0x2f56('0x45')]);_0x5779a6[_0x2f56('0x32')]=_[_0x2f56('0x31')](_0x18464b[_0x2f56('0x32')]);_0x5779a6['filters']=_['intersection'](_0x5779a6['model'],_0x5779a6[_0x2f56('0x32')]);_0x5cf160['attributes']=_[_0x2f56('0x35')](_0x5779a6[_0x2f56('0x2f')],qs['fields'](_0x18464b[_0x2f56('0x32')]['fields']));_0x5cf160[_0x2f56('0x34')]=_0x5cf160['attributes'][_0x2f56('0x46')]?_0x5cf160[_0x2f56('0x34')]:_0x5779a6[_0x2f56('0x2f')];if(_0x18464b[_0x2f56('0x32')]['includeAll']){_0x5cf160[_0x2f56('0x3f')]=[{'all':!![]}];}_0x5cf160=_[_0x2f56('0x3b')]({},_0x5cf160,_0x18464b[_0x2f56('0x47')]);return db[_0x2f56('0x3e')][_0x2f56('0x48')](_0x5cf160)['then'](handleEntityNotFound(_0x1de6a7,null))[_0x2f56('0x27')](respondWithResult(_0x1de6a7,null))[_0x2f56('0x42')](handleError(_0x1de6a7,null));};exports[_0x2f56('0x49')]=function(_0x519790,_0x3218eb){return db['ChatQueueReport'][_0x2f56('0x49')](_0x519790[_0x2f56('0x4a')],{})['then'](respondWithResult(_0x3218eb,0xc9))['catch'](handleError(_0x3218eb,null));};exports[_0x2f56('0x26')]=function(_0x338324,_0x215215){if(_0x338324[_0x2f56('0x4a')]['id']){delete _0x338324[_0x2f56('0x4a')]['id'];}return db['ChatQueueReport'][_0x2f56('0x48')]({'where':{'id':_0x338324[_0x2f56('0x44')]['id']}})[_0x2f56('0x27')](handleEntityNotFound(_0x215215,null))['then'](saveUpdates(_0x338324[_0x2f56('0x4a')],null))[_0x2f56('0x27')](respondWithResult(_0x215215,null))[_0x2f56('0x42')](handleError(_0x215215,null));};exports[_0x2f56('0x4b')]=function(_0x4ad9bf,_0x2e0311){return db[_0x2f56('0x3e')][_0x2f56('0x48')]({'where':{'id':_0x4ad9bf[_0x2f56('0x44')]['id']}})[_0x2f56('0x27')](handleEntityNotFound(_0x2e0311,null))[_0x2f56('0x27')](removeEntity(_0x2e0311,null))[_0x2f56('0x42')](handleError(_0x2e0311,null));};exports['describe']=function(_0x3a4cf4,_0x213d99){return db['ChatQueueReport']['describe']()[_0x2f56('0x27')](respondWithResult(_0x213d99,null))[_0x2f56('0x42')](handleError(_0x213d99,null));}; \ No newline at end of file +var _0xb1ad=['rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','ChatQueueReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','pick','filters','filter','where','merge','options','then','includeAll','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb1ad,0x184));var _0xdb1a=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xb1ad[_0x24259d];return _0x5a701;};'use strict';var emlformat=require(_0xdb1a('0x0'));var rimraf=require(_0xdb1a('0x1'));var zipdir=require(_0xdb1a('0x2'));var jsonpatch=require(_0xdb1a('0x3'));var rp=require(_0xdb1a('0x4'));var moment=require(_0xdb1a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdb1a('0x6'));var util=require(_0xdb1a('0x7'));var path=require(_0xdb1a('0x8'));var sox=require(_0xdb1a('0x9'));var csv=require(_0xdb1a('0xa'));var ejs=require(_0xdb1a('0xb'));var fs=require('fs');var fs_extra=require(_0xdb1a('0xc'));var _=require(_0xdb1a('0xd'));var squel=require(_0xdb1a('0xe'));var crypto=require(_0xdb1a('0xf'));var jsforce=require(_0xdb1a('0x10'));var deskjs=require(_0xdb1a('0x11'));var toCsv=require(_0xdb1a('0xa'));var querystring=require(_0xdb1a('0x12'));var Papa=require(_0xdb1a('0x13'));var Redis=require('ioredis');var authService=require(_0xdb1a('0x14'));var qs=require(_0xdb1a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb1a('0x16'));var utils=require(_0xdb1a('0x17'));var config=require(_0xdb1a('0x18'));var licenseUtil=require(_0xdb1a('0x19'));var db=require(_0xdb1a('0x1a'))['db'];function respondWithStatusCode(_0x31ccd3,_0x3ca28b){_0x3ca28b=_0x3ca28b||0xcc;return function(_0x1c40c8){if(_0x1c40c8){return _0x31ccd3[_0xdb1a('0x1b')](_0x3ca28b);}return _0x31ccd3[_0xdb1a('0x1c')](_0x3ca28b)[_0xdb1a('0x1d')]();};}function respondWithResult(_0x1d69dd,_0x857c00){_0x857c00=_0x857c00||0xc8;return function(_0x5aa761){if(_0x5aa761){return _0x1d69dd[_0xdb1a('0x1c')](_0x857c00)[_0xdb1a('0x1e')](_0x5aa761);}};}function respondWithFilteredResult(_0x112be1,_0x4bdec7){return function(_0x28dfe9){if(_0x28dfe9){var _0x504d92=typeof _0x4bdec7[_0xdb1a('0x1f')]===_0xdb1a('0x20')&&typeof _0x4bdec7[_0xdb1a('0x21')]==='undefined';var _0x9ffb77=_0x28dfe9[_0xdb1a('0x22')];var _0x268ce8=_0x504d92?0x0:_0x4bdec7['offset'];var _0xe3780b=_0x504d92?_0x28dfe9[_0xdb1a('0x22')]:_0x4bdec7[_0xdb1a('0x1f')]+_0x4bdec7[_0xdb1a('0x21')];var _0x37e10c;if(_0xe3780b>=_0x9ffb77){_0xe3780b=_0x9ffb77;_0x37e10c=0xc8;}else{_0x37e10c=0xce;}_0x112be1[_0xdb1a('0x1c')](_0x37e10c);return _0x112be1['set'](_0xdb1a('0x23'),_0x268ce8+'-'+_0xe3780b+'/'+_0x9ffb77)[_0xdb1a('0x1e')](_0x28dfe9);}return null;};}function patchUpdates(_0x386e32){return function(_0x37b776){try{jsonpatch[_0xdb1a('0x24')](_0x37b776,_0x386e32,!![]);}catch(_0x400397){return BPromise[_0xdb1a('0x25')](_0x400397);}return _0x37b776[_0xdb1a('0x26')]();};}function saveUpdates(_0x3a9b3a,_0xc92d26){return function(_0x4d1d09){if(_0x4d1d09){return _0x4d1d09[_0xdb1a('0x27')](_0x3a9b3a)['then'](function(_0x28ccfe){return _0x28ccfe;});}return null;};}function removeEntity(_0x2cc1aa,_0x3d07fc){return function(_0x5d3d24){if(_0x5d3d24){return _0x5d3d24[_0xdb1a('0x28')]()['then'](function(){_0x2cc1aa[_0xdb1a('0x1c')](0xcc)[_0xdb1a('0x1d')]();});}};}function handleEntityNotFound(_0x22c95e,_0x157c6a){return function(_0xaa6f2e){if(!_0xaa6f2e){_0x22c95e[_0xdb1a('0x1b')](0x194);}return _0xaa6f2e;};}function handleError(_0x22c260,_0x2e814e){_0x2e814e=_0x2e814e||0x1f4;return function(_0x5c963b){logger['error'](_0x5c963b[_0xdb1a('0x29')]);if(_0x5c963b[_0xdb1a('0x2a')]){delete _0x5c963b[_0xdb1a('0x2a')];}_0x22c260[_0xdb1a('0x1c')](_0x2e814e)[_0xdb1a('0x2b')](_0x5c963b);};}exports[_0xdb1a('0x2c')]=function(_0x5d1514,_0x3ec2f6){var _0x51f0ff={},_0x5a67c4={},_0xbfa09f={'count':0x0,'rows':[]};var _0x51a26d=_['map'](db[_0xdb1a('0x2d')][_0xdb1a('0x2e')],function(_0x46d019){return{'name':_0x46d019['fieldName'],'type':_0x46d019[_0xdb1a('0x2f')][_0xdb1a('0x30')]};});_0x5a67c4[_0xdb1a('0x31')]=_[_0xdb1a('0x32')](_0x51a26d,'name');_0x5a67c4[_0xdb1a('0x33')]=_[_0xdb1a('0x34')](_0x5d1514[_0xdb1a('0x33')]);_0x5a67c4['filters']=_[_0xdb1a('0x35')](_0x5a67c4[_0xdb1a('0x31')],_0x5a67c4[_0xdb1a('0x33')]);_0x51f0ff[_0xdb1a('0x36')]=_['intersection'](_0x5a67c4['model'],qs['fields'](_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x37')]));_0x51f0ff['attributes']=_0x51f0ff[_0xdb1a('0x36')][_0xdb1a('0x38')]?_0x51f0ff[_0xdb1a('0x36')]:_0x5a67c4[_0xdb1a('0x31')];if(!_0x5d1514[_0xdb1a('0x33')]['hasOwnProperty']('nolimit')){_0x51f0ff['limit']=qs[_0xdb1a('0x21')](_0x5d1514['query']['limit']);_0x51f0ff[_0xdb1a('0x1f')]=qs[_0xdb1a('0x1f')](_0x5d1514['query'][_0xdb1a('0x1f')]);}_0x51f0ff[_0xdb1a('0x39')]=qs[_0xdb1a('0x3a')](_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x3a')]);_0x51f0ff['where']=qs['filters'](_[_0xdb1a('0x3b')](_0x5d1514[_0xdb1a('0x33')],_0x5a67c4[_0xdb1a('0x3c')]),_0x51a26d);if(_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x3d')]){_0x51f0ff[_0xdb1a('0x3e')]=_[_0xdb1a('0x3f')](_0x51f0ff['where'],{'$or':_[_0xdb1a('0x32')](_0x51a26d,function(_0x5ba671){if(_0x5ba671['type']!=='VIRTUAL'){var _0x4a4366={};_0x4a4366[_0x5ba671[_0xdb1a('0x2a')]]={'$like':'%'+_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x3d')]+'%'};return _0x4a4366;}})});}_0x51f0ff=_[_0xdb1a('0x3f')]({},_0x51f0ff,_0x5d1514[_0xdb1a('0x40')]);var _0x5f535d={'where':_0x51f0ff[_0xdb1a('0x3e')]};return db[_0xdb1a('0x2d')][_0xdb1a('0x22')](_0x5f535d)[_0xdb1a('0x41')](function(_0xcffe52){_0xbfa09f[_0xdb1a('0x22')]=_0xcffe52;if(_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x42')]){_0x51f0ff[_0xdb1a('0x43')]=[{'all':!![]}];}return db[_0xdb1a('0x2d')]['findAll'](_0x51f0ff);})['then'](function(_0x43e27a){_0xbfa09f[_0xdb1a('0x44')]=_0x43e27a;return _0xbfa09f;})[_0xdb1a('0x41')](respondWithFilteredResult(_0x3ec2f6,_0x51f0ff))[_0xdb1a('0x45')](handleError(_0x3ec2f6,null));};exports[_0xdb1a('0x46')]=function(_0x4572d,_0x149fd6){var _0xad79f2={'raw':!![],'where':{'id':_0x4572d[_0xdb1a('0x47')]['id']}},_0xcb156c={};_0xcb156c[_0xdb1a('0x31')]=_[_0xdb1a('0x34')](db[_0xdb1a('0x2d')]['rawAttributes']);_0xcb156c[_0xdb1a('0x33')]=_[_0xdb1a('0x34')](_0x4572d[_0xdb1a('0x33')]);_0xcb156c[_0xdb1a('0x3c')]=_[_0xdb1a('0x35')](_0xcb156c[_0xdb1a('0x31')],_0xcb156c[_0xdb1a('0x33')]);_0xad79f2['attributes']=_['intersection'](_0xcb156c['model'],qs[_0xdb1a('0x37')](_0x4572d[_0xdb1a('0x33')]['fields']));_0xad79f2[_0xdb1a('0x36')]=_0xad79f2[_0xdb1a('0x36')]['length']?_0xad79f2['attributes']:_0xcb156c[_0xdb1a('0x31')];if(_0x4572d[_0xdb1a('0x33')]['includeAll']){_0xad79f2[_0xdb1a('0x43')]=[{'all':!![]}];}_0xad79f2=_[_0xdb1a('0x3f')]({},_0xad79f2,_0x4572d[_0xdb1a('0x40')]);return db['ChatQueueReport'][_0xdb1a('0x48')](_0xad79f2)[_0xdb1a('0x41')](handleEntityNotFound(_0x149fd6,null))[_0xdb1a('0x41')](respondWithResult(_0x149fd6,null))[_0xdb1a('0x45')](handleError(_0x149fd6,null));};exports['create']=function(_0x37aa5e,_0x452aa8){return db[_0xdb1a('0x2d')][_0xdb1a('0x49')](_0x37aa5e['body'],{})[_0xdb1a('0x41')](respondWithResult(_0x452aa8,0xc9))[_0xdb1a('0x45')](handleError(_0x452aa8,null));};exports[_0xdb1a('0x27')]=function(_0x367b1f,_0x40b193){if(_0x367b1f[_0xdb1a('0x4a')]['id']){delete _0x367b1f[_0xdb1a('0x4a')]['id'];}return db[_0xdb1a('0x2d')][_0xdb1a('0x48')]({'where':{'id':_0x367b1f[_0xdb1a('0x47')]['id']}})['then'](handleEntityNotFound(_0x40b193,null))['then'](saveUpdates(_0x367b1f['body'],null))[_0xdb1a('0x41')](respondWithResult(_0x40b193,null))[_0xdb1a('0x45')](handleError(_0x40b193,null));};exports[_0xdb1a('0x28')]=function(_0x3b018c,_0x32faa7){return db[_0xdb1a('0x2d')][_0xdb1a('0x48')]({'where':{'id':_0x3b018c['params']['id']}})['then'](handleEntityNotFound(_0x32faa7,null))['then'](removeEntity(_0x32faa7,null))['catch'](handleError(_0x32faa7,null));};exports[_0xdb1a('0x4b')]=function(_0x1f6115,_0x5663f1){return db['ChatQueueReport']['describe']()[_0xdb1a('0x41')](respondWithResult(_0x5663f1,null))[_0xdb1a('0x45')](handleError(_0x5663f1,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 3c140fa..0165b75 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x2f3623,_0x34a5ed){var _0x51e1b3=function(_0x6d6200){while(--_0x6d6200){_0x2f3623['push'](_0x2f3623['shift']());}};_0x51e1b3(++_0x34a5ed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0xcb91[_0x53bcc3];return _0x47c959;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x2dbcef,_0x1cfecb){var _0x5a90ea=function(_0x189054){while(--_0x189054){_0x2dbcef['push'](_0x2dbcef['shift']());}};_0x5a90ea(++_0x1cfecb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 12d2e34..6d6f7eb 100644 --- a/server/api/chatQueueReport/chatQueueReport.rpc.js +++ b/server/api/chatQueueReport/chatQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8f0=['CreateChatQueueReport','options','raw','stringify','UpdateChatQueueReport','body','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','catch'];(function(_0xb51261,_0x51a20c){var _0x217382=function(_0x5e0c81){while(--_0x5e0c81){_0xb51261['push'](_0xb51261['shift']());}};_0x217382(++_0x51a20c);}(_0xa8f0,0x173));var _0x0a8f=function(_0x4d093a,_0x15d59c){_0x4d093a=_0x4d093a-0x0;var _0x5d7227=_0xa8f0[_0x4d093a];return _0x5d7227;};'use strict';var _=require('lodash');var util=require(_0x0a8f('0x0'));var moment=require(_0x0a8f('0x1'));var BPromise=require(_0x0a8f('0x2'));var rs=require(_0x0a8f('0x3'));var fs=require('fs');var Redis=require(_0x0a8f('0x4'));var db=require(_0x0a8f('0x5'))['db'];var utils=require(_0x0a8f('0x6'));var logger=require(_0x0a8f('0x7'))('rpc');var config=require(_0x0a8f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a8f('0x9')][_0x0a8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xca44d2,_0x65bd19,_0x54f2d6){return new BPromise(function(_0x430f12,_0x228e64){return client['request'](_0xca44d2,_0x54f2d6)[_0x0a8f('0xb')](function(_0x128683){logger[_0x0a8f('0xc')](_0x0a8f('0xd'),_0x65bd19,_0x0a8f('0xe'));logger[_0x0a8f('0xf')](_0x0a8f('0x10'),_0x65bd19,_0x0a8f('0xe'),JSON['stringify'](_0x128683));if(_0x128683['error']){if(_0x128683['error'][_0x0a8f('0x11')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x65bd19,_0x128683[_0x0a8f('0x12')][_0x0a8f('0x13')]);return _0x228e64(_0x128683[_0x0a8f('0x12')][_0x0a8f('0x13')]);}logger[_0x0a8f('0x12')](_0x0a8f('0xd'),_0x65bd19,_0x128683[_0x0a8f('0x12')]['message']);return _0x430f12(_0x128683[_0x0a8f('0x12')][_0x0a8f('0x13')]);}else{logger[_0x0a8f('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x65bd19,'request\x20sent');_0x430f12(_0x128683['result'][_0x0a8f('0x13')]);}})[_0x0a8f('0x14')](function(_0x251e6e){logger[_0x0a8f('0x12')](_0x0a8f('0xd'),_0x65bd19,_0x251e6e);_0x228e64(_0x251e6e);});});}exports[_0x0a8f('0x15')]=function(_0x56ec8e){var _0x40c859=this;return new Promise(function(_0x2c2e2d,_0x58d493){return db['ChatQueueReport']['create'](_0x56ec8e['body'],{'raw':_0x56ec8e[_0x0a8f('0x16')]?_0x56ec8e[_0x0a8f('0x16')][_0x0a8f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3bc61c){logger[_0x0a8f('0xc')](_0x0a8f('0x15'),_0x56ec8e);logger[_0x0a8f('0xf')](_0x0a8f('0x15'),_0x56ec8e,JSON[_0x0a8f('0x18')](_0x3bc61c));_0x2c2e2d(_0x3bc61c);})['catch'](function(_0x743a91){logger[_0x0a8f('0x12')]('CreateChatQueueReport',_0x743a91['message'],_0x56ec8e);_0x58d493(_0x40c859['error'](0x1f4,_0x743a91[_0x0a8f('0x13')]));});});};exports[_0x0a8f('0x19')]=function(_0x43c9c3){var _0x41ccf2=this;return new Promise(function(_0x263a2c,_0xbbd479){return db['ChatQueueReport']['update'](_0x43c9c3[_0x0a8f('0x1a')],{'raw':_0x43c9c3[_0x0a8f('0x16')]?_0x43c9c3[_0x0a8f('0x16')][_0x0a8f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c9c3[_0x0a8f('0x16')]?_0x43c9c3['options'][_0x0a8f('0x1b')]||null:null,'attributes':_0x43c9c3[_0x0a8f('0x16')]?_0x43c9c3[_0x0a8f('0x16')]['attributes']||null:null,'limit':_0x43c9c3[_0x0a8f('0x16')]?_0x43c9c3[_0x0a8f('0x16')]['limit']||null:null})[_0x0a8f('0xb')](function(_0x78e1b5){logger[_0x0a8f('0xc')](_0x0a8f('0x19'),_0x43c9c3);logger['debug']('UpdateChatQueueReport',_0x43c9c3,JSON[_0x0a8f('0x18')](_0x78e1b5));_0x263a2c(_0x78e1b5);})['catch'](function(_0x48e8d1){logger[_0x0a8f('0x12')]('UpdateChatQueueReport',_0x48e8d1[_0x0a8f('0x13')],_0x43c9c3);_0xbbd479(_0x41ccf2['error'](0x1f4,_0x48e8d1['message']));});});}; \ No newline at end of file +var _0x895d=['ChatQueueReport','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','attributes','limit','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x4cf87e,_0x31894e){var _0x42e41e=function(_0x515278){while(--_0x515278){_0x4cf87e['push'](_0x4cf87e['shift']());}};_0x42e41e(++_0x31894e);}(_0x895d,0x181));var _0xd895=function(_0x1b8241,_0x3a359e){_0x1b8241=_0x1b8241-0x0;var _0x22ac33=_0x895d[_0x1b8241];return _0x22ac33;};'use strict';var _=require(_0xd895('0x0'));var util=require(_0xd895('0x1'));var moment=require(_0xd895('0x2'));var BPromise=require('bluebird');var rs=require(_0xd895('0x3'));var fs=require('fs');var Redis=require(_0xd895('0x4'));var db=require(_0xd895('0x5'))['db'];var utils=require(_0xd895('0x6'));var logger=require(_0xd895('0x7'))(_0xd895('0x8'));var config=require('../../config/environment');var jayson=require(_0xd895('0x9'));var client=jayson[_0xd895('0xa')][_0xd895('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6a3e2c,_0x13bffa,_0x9048bb){return new BPromise(function(_0x2199b2,_0x31769f){return client[_0xd895('0xc')](_0x6a3e2c,_0x9048bb)[_0xd895('0xd')](function(_0x557bfb){logger[_0xd895('0xe')](_0xd895('0xf'),_0x13bffa,_0xd895('0x10'));logger[_0xd895('0x11')](_0xd895('0x12'),_0x13bffa,_0xd895('0x10'),JSON['stringify'](_0x557bfb));if(_0x557bfb[_0xd895('0x13')]){if(_0x557bfb['error']['code']===0x1f4){logger[_0xd895('0x13')](_0xd895('0xf'),_0x13bffa,_0x557bfb[_0xd895('0x13')][_0xd895('0x14')]);return _0x31769f(_0x557bfb[_0xd895('0x13')][_0xd895('0x14')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x13bffa,_0x557bfb[_0xd895('0x13')]['message']);return _0x2199b2(_0x557bfb['error'][_0xd895('0x14')]);}else{logger[_0xd895('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x13bffa,_0xd895('0x10'));_0x2199b2(_0x557bfb[_0xd895('0x15')]['message']);}})[_0xd895('0x16')](function(_0x4d7147){logger[_0xd895('0x13')](_0xd895('0xf'),_0x13bffa,_0x4d7147);_0x31769f(_0x4d7147);});});}exports['CreateChatQueueReport']=function(_0x26258f){var _0x12a3e2=this;return new Promise(function(_0x1c07bb,_0x44462b){return db[_0xd895('0x17')][_0xd895('0x18')](_0x26258f[_0xd895('0x19')],{'raw':_0x26258f[_0xd895('0x1a')]?_0x26258f[_0xd895('0x1a')][_0xd895('0x1b')]===undefined?!![]:![]:!![]})[_0xd895('0xd')](function(_0xfe7c0){logger[_0xd895('0xe')]('CreateChatQueueReport',_0x26258f);logger[_0xd895('0x11')](_0xd895('0x1c'),_0x26258f,JSON['stringify'](_0xfe7c0));_0x1c07bb(_0xfe7c0);})[_0xd895('0x16')](function(_0x2078ff){logger[_0xd895('0x13')]('CreateChatQueueReport',_0x2078ff[_0xd895('0x14')],_0x26258f);_0x44462b(_0x12a3e2[_0xd895('0x13')](0x1f4,_0x2078ff[_0xd895('0x14')]));});});};exports[_0xd895('0x1d')]=function(_0x13eddb){var _0x3f7d17=this;return new Promise(function(_0x36b4ef,_0x29f01a){return db['ChatQueueReport'][_0xd895('0x1e')](_0x13eddb['body'],{'raw':_0x13eddb[_0xd895('0x1a')]?_0x13eddb[_0xd895('0x1a')][_0xd895('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13eddb[_0xd895('0x1a')]?_0x13eddb[_0xd895('0x1a')]['where']||null:null,'attributes':_0x13eddb[_0xd895('0x1a')]?_0x13eddb[_0xd895('0x1a')][_0xd895('0x1f')]||null:null,'limit':_0x13eddb['options']?_0x13eddb[_0xd895('0x1a')][_0xd895('0x20')]||null:null})[_0xd895('0xd')](function(_0x1286d7){logger[_0xd895('0xe')](_0xd895('0x1d'),_0x13eddb);logger['debug'](_0xd895('0x1d'),_0x13eddb,JSON[_0xd895('0x21')](_0x1286d7));_0x36b4ef(_0x1286d7);})[_0xd895('0x16')](function(_0x1b96bf){logger['error'](_0xd895('0x1d'),_0x1b96bf[_0xd895('0x14')],_0x13eddb);_0x29f01a(_0x3f7d17[_0xd895('0x13')](0x1f4,_0x1b96bf['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c0c836e..1aecc18 100644 --- a/server/api/chatQueueReport/index.js +++ b/server/api/chatQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5dd3=['/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','index'];(function(_0x2dcb28,_0x26b688){var _0x314ba5=function(_0x2cf325){while(--_0x2cf325){_0x2dcb28['push'](_0x2dcb28['shift']());}};_0x314ba5(++_0x26b688);}(_0x5dd3,0x1af));var _0x35dd=function(_0x3526a5,_0x56825d){_0x3526a5=_0x3526a5-0x0;var _0x44f869=_0x5dd3[_0x3526a5];return _0x44f869;};'use strict';var multer=require('multer');var util=require(_0x35dd('0x0'));var path=require(_0x35dd('0x1'));var timeout=require(_0x35dd('0x2'));var express=require('express');var router=express[_0x35dd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x35dd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x35dd('0x5'));var controller=require(_0x35dd('0x6'));router[_0x35dd('0x7')]('/',auth['isAuthenticated'](),controller[_0x35dd('0x8')]);router[_0x35dd('0x7')](_0x35dd('0x9'),auth[_0x35dd('0xa')](),controller[_0x35dd('0xb')]);router[_0x35dd('0x7')](_0x35dd('0xc'),auth[_0x35dd('0xa')](),controller['show']);router[_0x35dd('0xd')]('/',auth[_0x35dd('0xa')](),controller[_0x35dd('0xe')]);router[_0x35dd('0xf')](_0x35dd('0xc'),auth['isAuthenticated'](),controller[_0x35dd('0x10')]);router[_0x35dd('0x11')](_0x35dd('0xc'),auth[_0x35dd('0xa')](),controller[_0x35dd('0x12')]);module[_0x35dd('0x13')]=router; \ No newline at end of file +var _0x889f=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x889f,0x10a));var _0xf889=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x889f[_0x1780f8];return _0x33a410;};'use strict';var multer=require(_0xf889('0x0'));var util=require('util');var path=require(_0xf889('0x1'));var timeout=require(_0xf889('0x2'));var express=require('express');var router=express[_0xf889('0x3')]();var fs_extra=require(_0xf889('0x4'));var auth=require(_0xf889('0x5'));var interaction=require(_0xf889('0x6'));var config=require('../../config/environment');var controller=require(_0xf889('0x7'));router[_0xf889('0x8')]('/',auth[_0xf889('0x9')](),controller[_0xf889('0xa')]);router['get'](_0xf889('0xb'),auth['isAuthenticated'](),controller[_0xf889('0xc')]);router[_0xf889('0x8')](_0xf889('0xd'),auth[_0xf889('0x9')](),controller['show']);router[_0xf889('0xe')]('/',auth[_0xf889('0x9')](),controller[_0xf889('0xf')]);router[_0xf889('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf889('0x11')]);router[_0xf889('0x12')](_0xf889('0xd'),auth[_0xf889('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0f15a12..34fbdc7 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x230a9b,_0x3bbee7){var _0x28dfd1=function(_0x18f00a){while(--_0x18f00a){_0x230a9b['push'](_0x230a9b['shift']());}};_0x28dfd1(++_0x3bbee7);}(_0x4b84,0x1cc));var _0x44b8=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x4b84[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x45dd0e,_0x28e603){var _0x50e5ca=function(_0x46a412){while(--_0x46a412){_0x45dd0e['push'](_0x45dd0e['shift']());}};_0x50e5ca(++_0x28e603);}(_0x008c,0x188));var _0xc008=function(_0x31cdf3,_0x4f2183){_0x31cdf3=_0x31cdf3-0x0;var _0x5623f8=_0x008c[_0x31cdf3];return _0x5623f8;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 664b2e1..ea81b95 100644 --- a/server/api/chatTransferReport/chatTransferReport.controller.js +++ b/server/api/chatTransferReport/chatTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ea2=['undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','name','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','findAll','catch','show','params','include','merge','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2199db,_0x64fe69){var _0x1823bc=function(_0x4f849b){while(--_0x4f849b){_0x2199db['push'](_0x2199db['shift']());}};_0x1823bc(++_0x64fe69);}(_0x2ea2,0x73));var _0x22ea=function(_0x23ca4a,_0x491470){_0x23ca4a=_0x23ca4a-0x0;var _0x392a33=_0x2ea2[_0x23ca4a];return _0x392a33;};'use strict';var emlformat=require(_0x22ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x22ea('0x1'));var jsonpatch=require(_0x22ea('0x2'));var rp=require(_0x22ea('0x3'));var moment=require(_0x22ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x22ea('0x5'));var util=require('util');var path=require('path');var sox=require(_0x22ea('0x6'));var csv=require(_0x22ea('0x7'));var ejs=require(_0x22ea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22ea('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x22ea('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x22ea('0x7'));var querystring=require('querystring');var Papa=require(_0x22ea('0xb'));var Redis=require(_0x22ea('0xc'));var authService=require(_0x22ea('0xd'));var qs=require(_0x22ea('0xe'));var as=require(_0x22ea('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22ea('0x10'))(_0x22ea('0x11'));var utils=require(_0x22ea('0x12'));var config=require(_0x22ea('0x13'));var licenseUtil=require(_0x22ea('0x14'));var db=require(_0x22ea('0x15'))['db'];function respondWithStatusCode(_0x1f6f1c,_0x18b0c0){_0x18b0c0=_0x18b0c0||0xcc;return function(_0x444d9f){if(_0x444d9f){return _0x1f6f1c[_0x22ea('0x16')](_0x18b0c0);}return _0x1f6f1c[_0x22ea('0x17')](_0x18b0c0)[_0x22ea('0x18')]();};}function respondWithResult(_0x4b203e,_0x2a245b){_0x2a245b=_0x2a245b||0xc8;return function(_0x3d8982){if(_0x3d8982){return _0x4b203e['status'](_0x2a245b)[_0x22ea('0x19')](_0x3d8982);}};}function respondWithFilteredResult(_0x36d354,_0x307593){return function(_0x2263f7){if(_0x2263f7){var _0xbed39a=typeof _0x307593[_0x22ea('0x1a')]===_0x22ea('0x1b')&&typeof _0x307593[_0x22ea('0x1c')]===_0x22ea('0x1b');var _0x45a6e2=_0x2263f7[_0x22ea('0x1d')];var _0x56b35f=_0xbed39a?0x0:_0x307593[_0x22ea('0x1a')];var _0x152b86=_0xbed39a?_0x2263f7[_0x22ea('0x1d')]:_0x307593['offset']+_0x307593[_0x22ea('0x1c')];var _0x57b0ad;if(_0x152b86>=_0x45a6e2){_0x152b86=_0x45a6e2;_0x57b0ad=0xc8;}else{_0x57b0ad=0xce;}_0x36d354[_0x22ea('0x17')](_0x57b0ad);return _0x36d354['set'](_0x22ea('0x1e'),_0x56b35f+'-'+_0x152b86+'/'+_0x45a6e2)['json'](_0x2263f7);}return null;};}function patchUpdates(_0x4786b4){return function(_0x27cea7){try{jsonpatch[_0x22ea('0x1f')](_0x27cea7,_0x4786b4,!![]);}catch(_0x1b0377){return BPromise[_0x22ea('0x20')](_0x1b0377);}return _0x27cea7[_0x22ea('0x21')]();};}function saveUpdates(_0x4e5e80,_0x12bdf2){return function(_0x486870){if(_0x486870){return _0x486870[_0x22ea('0x22')](_0x4e5e80)['then'](function(_0x4b03eb){return _0x4b03eb;});}return null;};}function removeEntity(_0x4d3f4b,_0x1aa13c){return function(_0x5f0dce){if(_0x5f0dce){return _0x5f0dce[_0x22ea('0x23')]()[_0x22ea('0x24')](function(){_0x4d3f4b[_0x22ea('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x217474,_0x12e51e){return function(_0x758b73){if(!_0x758b73){_0x217474[_0x22ea('0x16')](0x194);}return _0x758b73;};}function handleError(_0x124f7a,_0x255801){_0x255801=_0x255801||0x1f4;return function(_0x4f4d82){logger[_0x22ea('0x25')](_0x4f4d82['stack']);if(_0x4f4d82[_0x22ea('0x26')]){delete _0x4f4d82['name'];}_0x124f7a[_0x22ea('0x17')](_0x255801)['send'](_0x4f4d82);};}exports['index']=function(_0xf3aa34,_0x27ca1b){var _0x1af2b1={},_0x2cb7ce={},_0x31f537={'count':0x0,'rows':[]};var _0x2dfc60=_[_0x22ea('0x27')](db[_0x22ea('0x28')][_0x22ea('0x29')],function(_0x213d9a){return{'name':_0x213d9a[_0x22ea('0x2a')],'type':_0x213d9a[_0x22ea('0x2b')][_0x22ea('0x2c')]};});_0x2cb7ce[_0x22ea('0x2d')]=_[_0x22ea('0x27')](_0x2dfc60,'name');_0x2cb7ce['query']=_[_0x22ea('0x2e')](_0xf3aa34[_0x22ea('0x2f')]);_0x2cb7ce['filters']=_[_0x22ea('0x30')](_0x2cb7ce[_0x22ea('0x2d')],_0x2cb7ce[_0x22ea('0x2f')]);_0x1af2b1['attributes']=_[_0x22ea('0x30')](_0x2cb7ce[_0x22ea('0x2d')],qs['fields'](_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x31')]));_0x1af2b1[_0x22ea('0x32')]=_0x1af2b1['attributes'][_0x22ea('0x33')]?_0x1af2b1['attributes']:_0x2cb7ce['model'];if(!_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x34')]('nolimit')){_0x1af2b1['limit']=qs['limit'](_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x1c')]);_0x1af2b1[_0x22ea('0x1a')]=qs[_0x22ea('0x1a')](_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x1a')]);}_0x1af2b1['order']=qs['sort'](_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x35')]);_0x1af2b1[_0x22ea('0x36')]=qs[_0x22ea('0x37')](_[_0x22ea('0x38')](_0xf3aa34[_0x22ea('0x2f')],_0x2cb7ce[_0x22ea('0x37')]),_0x2dfc60);if(_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x39')]){_0x1af2b1[_0x22ea('0x36')]=_['merge'](_0x1af2b1[_0x22ea('0x36')],{'$or':_[_0x22ea('0x27')](_0x2dfc60,function(_0x5d2a8e){if(_0x5d2a8e['type']!==_0x22ea('0x3a')){var _0x2018fe={};_0x2018fe[_0x5d2a8e[_0x22ea('0x26')]]={'$like':'%'+_0xf3aa34['query']['filter']+'%'};return _0x2018fe;}})});}_0x1af2b1=_['merge']({},_0x1af2b1,_0xf3aa34[_0x22ea('0x3b')]);var _0x1e74ff={'where':_0x1af2b1[_0x22ea('0x36')]};return db[_0x22ea('0x28')]['count'](_0x1e74ff)[_0x22ea('0x24')](function(_0x24a82c){_0x31f537[_0x22ea('0x1d')]=_0x24a82c;if(_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x3c')]){_0x1af2b1['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x22ea('0x3d')](_0x1af2b1);})[_0x22ea('0x24')](function(_0x3d98cf){_0x31f537['rows']=_0x3d98cf;return _0x31f537;})[_0x22ea('0x24')](respondWithFilteredResult(_0x27ca1b,_0x1af2b1))[_0x22ea('0x3e')](handleError(_0x27ca1b,null));};exports[_0x22ea('0x3f')]=function(_0x350ed9,_0x49d5ab){var _0x28be64={'raw':!![],'where':{'id':_0x350ed9[_0x22ea('0x40')]['id']}},_0x582862={};_0x582862[_0x22ea('0x2d')]=_[_0x22ea('0x2e')](db[_0x22ea('0x28')][_0x22ea('0x29')]);_0x582862[_0x22ea('0x2f')]=_[_0x22ea('0x2e')](_0x350ed9[_0x22ea('0x2f')]);_0x582862[_0x22ea('0x37')]=_['intersection'](_0x582862[_0x22ea('0x2d')],_0x582862['query']);_0x28be64['attributes']=_[_0x22ea('0x30')](_0x582862[_0x22ea('0x2d')],qs['fields'](_0x350ed9['query'][_0x22ea('0x31')]));_0x28be64['attributes']=_0x28be64[_0x22ea('0x32')][_0x22ea('0x33')]?_0x28be64['attributes']:_0x582862[_0x22ea('0x2d')];if(_0x350ed9[_0x22ea('0x2f')]['includeAll']){_0x28be64[_0x22ea('0x41')]=[{'all':!![]}];}_0x28be64=_[_0x22ea('0x42')]({},_0x28be64,_0x350ed9[_0x22ea('0x3b')]);return db['ChatTransferReport'][_0x22ea('0x43')](_0x28be64)[_0x22ea('0x24')](handleEntityNotFound(_0x49d5ab,null))[_0x22ea('0x24')](respondWithResult(_0x49d5ab,null))['catch'](handleError(_0x49d5ab,null));};exports[_0x22ea('0x44')]=function(_0x7f625e,_0x3d3944){return db[_0x22ea('0x28')]['create'](_0x7f625e['body'],{})[_0x22ea('0x24')](respondWithResult(_0x3d3944,0xc9))['catch'](handleError(_0x3d3944,null));};exports[_0x22ea('0x22')]=function(_0x1c108b,_0x2cad54){if(_0x1c108b[_0x22ea('0x45')]['id']){delete _0x1c108b[_0x22ea('0x45')]['id'];}return db[_0x22ea('0x28')][_0x22ea('0x43')]({'where':{'id':_0x1c108b[_0x22ea('0x40')]['id']}})[_0x22ea('0x24')](handleEntityNotFound(_0x2cad54,null))[_0x22ea('0x24')](saveUpdates(_0x1c108b['body'],null))[_0x22ea('0x24')](respondWithResult(_0x2cad54,null))[_0x22ea('0x3e')](handleError(_0x2cad54,null));};exports[_0x22ea('0x23')]=function(_0x64993b,_0xa1eeca){return db[_0x22ea('0x28')][_0x22ea('0x43')]({'where':{'id':_0x64993b[_0x22ea('0x40')]['id']}})[_0x22ea('0x24')](handleEntityNotFound(_0xa1eeca,null))[_0x22ea('0x24')](removeEntity(_0xa1eeca,null))[_0x22ea('0x3e')](handleError(_0xa1eeca,null));};exports[_0x22ea('0x46')]=function(_0x15c8da,_0x381e31){return db[_0x22ea('0x28')]['describe']()[_0x22ea('0x24')](respondWithResult(_0x381e31,null))[_0x22ea('0x3e')](handleError(_0x381e31,null));}; \ No newline at end of file +var _0x378c=['ChatTransferReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map'];(function(_0x478612,_0x2d5b1f){var _0x878115=function(_0x1b6f8a){while(--_0x1b6f8a){_0x478612['push'](_0x478612['shift']());}};_0x878115(++_0x2d5b1f);}(_0x378c,0x1c1));var _0xc378=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x378c[_0x24f31b];return _0x488401;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc378('0x0'));var rp=require(_0xc378('0x1'));var moment=require('moment');var BPromise=require(_0xc378('0x2'));var Mustache=require(_0xc378('0x3'));var util=require('util');var path=require(_0xc378('0x4'));var sox=require(_0xc378('0x5'));var csv=require(_0xc378('0x6'));var ejs=require(_0xc378('0x7'));var fs=require('fs');var fs_extra=require(_0xc378('0x8'));var _=require('lodash');var squel=require(_0xc378('0x9'));var crypto=require(_0xc378('0xa'));var jsforce=require(_0xc378('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc378('0x6'));var querystring=require(_0xc378('0xc'));var Papa=require('papaparse');var Redis=require(_0xc378('0xd'));var authService=require(_0xc378('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc378('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc378('0x10'))(_0xc378('0x11'));var utils=require('../../config/utils');var config=require(_0xc378('0x12'));var licenseUtil=require(_0xc378('0x13'));var db=require(_0xc378('0x14'))['db'];function respondWithStatusCode(_0x2053ce,_0x96861b){_0x96861b=_0x96861b||0xcc;return function(_0x3a51f8){if(_0x3a51f8){return _0x2053ce[_0xc378('0x15')](_0x96861b);}return _0x2053ce[_0xc378('0x16')](_0x96861b)[_0xc378('0x17')]();};}function respondWithResult(_0x4575f0,_0x2ec00d){_0x2ec00d=_0x2ec00d||0xc8;return function(_0x4cd841){if(_0x4cd841){return _0x4575f0[_0xc378('0x16')](_0x2ec00d)[_0xc378('0x18')](_0x4cd841);}};}function respondWithFilteredResult(_0x37e2bd,_0x35c1a6){return function(_0x463384){if(_0x463384){var _0x120f64=typeof _0x35c1a6[_0xc378('0x19')]===_0xc378('0x1a')&&typeof _0x35c1a6[_0xc378('0x1b')]===_0xc378('0x1a');var _0x21a6c6=_0x463384[_0xc378('0x1c')];var _0x18f6ed=_0x120f64?0x0:_0x35c1a6['offset'];var _0xa2ee27=_0x120f64?_0x463384[_0xc378('0x1c')]:_0x35c1a6['offset']+_0x35c1a6[_0xc378('0x1b')];var _0x4f1c8b;if(_0xa2ee27>=_0x21a6c6){_0xa2ee27=_0x21a6c6;_0x4f1c8b=0xc8;}else{_0x4f1c8b=0xce;}_0x37e2bd[_0xc378('0x16')](_0x4f1c8b);return _0x37e2bd[_0xc378('0x1d')](_0xc378('0x1e'),_0x18f6ed+'-'+_0xa2ee27+'/'+_0x21a6c6)['json'](_0x463384);}return null;};}function patchUpdates(_0x44a2c6){return function(_0x48d624){try{jsonpatch[_0xc378('0x1f')](_0x48d624,_0x44a2c6,!![]);}catch(_0x14a6ae){return BPromise['reject'](_0x14a6ae);}return _0x48d624['save']();};}function saveUpdates(_0x1a78e2,_0x23236c){return function(_0x4d3a05){if(_0x4d3a05){return _0x4d3a05[_0xc378('0x20')](_0x1a78e2)[_0xc378('0x21')](function(_0x54c32c){return _0x54c32c;});}return null;};}function removeEntity(_0x45092a,_0x264b99){return function(_0x355c59){if(_0x355c59){return _0x355c59[_0xc378('0x22')]()[_0xc378('0x21')](function(){_0x45092a['status'](0xcc)[_0xc378('0x17')]();});}};}function handleEntityNotFound(_0x3944cf,_0x4bf6de){return function(_0x4095f4){if(!_0x4095f4){_0x3944cf[_0xc378('0x15')](0x194);}return _0x4095f4;};}function handleError(_0x322688,_0x44130d){_0x44130d=_0x44130d||0x1f4;return function(_0x2b18e3){logger[_0xc378('0x23')](_0x2b18e3[_0xc378('0x24')]);if(_0x2b18e3['name']){delete _0x2b18e3[_0xc378('0x25')];}_0x322688['status'](_0x44130d)[_0xc378('0x26')](_0x2b18e3);};}exports[_0xc378('0x27')]=function(_0x49b9d4,_0x1a01e4){var _0xf3ecdf={},_0x3455b4={},_0x2be6ea={'count':0x0,'rows':[]};var _0x1b9a5=_[_0xc378('0x28')](db[_0xc378('0x29')][_0xc378('0x2a')],function(_0x1bd4c6){return{'name':_0x1bd4c6['fieldName'],'type':_0x1bd4c6[_0xc378('0x2b')][_0xc378('0x2c')]};});_0x3455b4[_0xc378('0x2d')]=_['map'](_0x1b9a5,'name');_0x3455b4[_0xc378('0x2e')]=_['keys'](_0x49b9d4[_0xc378('0x2e')]);_0x3455b4[_0xc378('0x2f')]=_[_0xc378('0x30')](_0x3455b4['model'],_0x3455b4[_0xc378('0x2e')]);_0xf3ecdf['attributes']=_['intersection'](_0x3455b4[_0xc378('0x2d')],qs['fields'](_0x49b9d4['query'][_0xc378('0x31')]));_0xf3ecdf[_0xc378('0x32')]=_0xf3ecdf[_0xc378('0x32')]['length']?_0xf3ecdf[_0xc378('0x32')]:_0x3455b4[_0xc378('0x2d')];if(!_0x49b9d4['query']['hasOwnProperty'](_0xc378('0x33'))){_0xf3ecdf[_0xc378('0x1b')]=qs[_0xc378('0x1b')](_0x49b9d4['query'][_0xc378('0x1b')]);_0xf3ecdf[_0xc378('0x19')]=qs[_0xc378('0x19')](_0x49b9d4['query'][_0xc378('0x19')]);}_0xf3ecdf['order']=qs['sort'](_0x49b9d4['query'][_0xc378('0x34')]);_0xf3ecdf['where']=qs[_0xc378('0x2f')](_[_0xc378('0x35')](_0x49b9d4[_0xc378('0x2e')],_0x3455b4['filters']),_0x1b9a5);if(_0x49b9d4[_0xc378('0x2e')][_0xc378('0x36')]){_0xf3ecdf[_0xc378('0x37')]=_[_0xc378('0x38')](_0xf3ecdf[_0xc378('0x37')],{'$or':_[_0xc378('0x28')](_0x1b9a5,function(_0x43dc6){if(_0x43dc6[_0xc378('0x2b')]!=='VIRTUAL'){var _0x15987f={};_0x15987f[_0x43dc6[_0xc378('0x25')]]={'$like':'%'+_0x49b9d4[_0xc378('0x2e')]['filter']+'%'};return _0x15987f;}})});}_0xf3ecdf=_[_0xc378('0x38')]({},_0xf3ecdf,_0x49b9d4[_0xc378('0x39')]);var _0x1027d2={'where':_0xf3ecdf[_0xc378('0x37')]};return db[_0xc378('0x29')]['count'](_0x1027d2)[_0xc378('0x21')](function(_0x16b1aa){_0x2be6ea[_0xc378('0x1c')]=_0x16b1aa;if(_0x49b9d4[_0xc378('0x2e')][_0xc378('0x3a')]){_0xf3ecdf[_0xc378('0x3b')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xc378('0x3c')](_0xf3ecdf);})[_0xc378('0x21')](function(_0x21e6f8){_0x2be6ea[_0xc378('0x3d')]=_0x21e6f8;return _0x2be6ea;})[_0xc378('0x21')](respondWithFilteredResult(_0x1a01e4,_0xf3ecdf))[_0xc378('0x3e')](handleError(_0x1a01e4,null));};exports[_0xc378('0x3f')]=function(_0x1956a0,_0x2849b7){var _0x50acd6={'raw':!![],'where':{'id':_0x1956a0[_0xc378('0x40')]['id']}},_0x47436c={};_0x47436c['model']=_['keys'](db[_0xc378('0x29')][_0xc378('0x2a')]);_0x47436c[_0xc378('0x2e')]=_[_0xc378('0x41')](_0x1956a0['query']);_0x47436c[_0xc378('0x2f')]=_['intersection'](_0x47436c[_0xc378('0x2d')],_0x47436c['query']);_0x50acd6[_0xc378('0x32')]=_[_0xc378('0x30')](_0x47436c[_0xc378('0x2d')],qs[_0xc378('0x31')](_0x1956a0[_0xc378('0x2e')][_0xc378('0x31')]));_0x50acd6['attributes']=_0x50acd6[_0xc378('0x32')]['length']?_0x50acd6[_0xc378('0x32')]:_0x47436c[_0xc378('0x2d')];if(_0x1956a0[_0xc378('0x2e')][_0xc378('0x3a')]){_0x50acd6[_0xc378('0x3b')]=[{'all':!![]}];}_0x50acd6=_['merge']({},_0x50acd6,_0x1956a0[_0xc378('0x39')]);return db[_0xc378('0x29')][_0xc378('0x42')](_0x50acd6)[_0xc378('0x21')](handleEntityNotFound(_0x2849b7,null))[_0xc378('0x21')](respondWithResult(_0x2849b7,null))['catch'](handleError(_0x2849b7,null));};exports[_0xc378('0x43')]=function(_0x3f1020,_0x5d8a2e){return db['ChatTransferReport'][_0xc378('0x43')](_0x3f1020[_0xc378('0x44')],{})[_0xc378('0x21')](respondWithResult(_0x5d8a2e,0xc9))['catch'](handleError(_0x5d8a2e,null));};exports['update']=function(_0x49aea3,_0x58f45f){if(_0x49aea3[_0xc378('0x44')]['id']){delete _0x49aea3[_0xc378('0x44')]['id'];}return db['ChatTransferReport'][_0xc378('0x42')]({'where':{'id':_0x49aea3[_0xc378('0x40')]['id']}})['then'](handleEntityNotFound(_0x58f45f,null))[_0xc378('0x21')](saveUpdates(_0x49aea3[_0xc378('0x44')],null))[_0xc378('0x21')](respondWithResult(_0x58f45f,null))[_0xc378('0x3e')](handleError(_0x58f45f,null));};exports[_0xc378('0x22')]=function(_0x46a7d9,_0x5b4ae9){return db[_0xc378('0x29')]['find']({'where':{'id':_0x46a7d9[_0xc378('0x40')]['id']}})['then'](handleEntityNotFound(_0x5b4ae9,null))['then'](removeEntity(_0x5b4ae9,null))[_0xc378('0x3e')](handleError(_0x5b4ae9,null));};exports[_0xc378('0x45')]=function(_0x546682,_0x577fd8){return db['ChatTransferReport'][_0xc378('0x45')]()[_0xc378('0x21')](respondWithResult(_0x577fd8,null))['catch'](handleError(_0x577fd8,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ae9b666..ea09b73 100644 --- a/server/api/chatTransferReport/chatTransferReport.model.js +++ b/server/api/chatTransferReport/chatTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9160=['rimraf','../../config/environment','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x41c19c,_0x43f4ef){var _0x14e900=function(_0xff3679){while(--_0xff3679){_0x41c19c['push'](_0x41c19c['shift']());}};_0x14e900(++_0x43f4ef);}(_0x9160,0x1c2));var _0x0916=function(_0x5df47d,_0x56b70d){_0x5df47d=_0x5df47d-0x0;var _0x503d79=_0x9160[_0x5df47d];return _0x503d79;};'use strict';var _=require(_0x0916('0x0'));var util=require(_0x0916('0x1'));var logger=require(_0x0916('0x2'))(_0x0916('0x3'));var moment=require(_0x0916('0x4'));var BPromise=require('bluebird');var rp=require(_0x0916('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0916('0x6'));var config=require(_0x0916('0x7'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x3214ae,_0x5dacc){return _0x3214ae[_0x0916('0x8')](_0x0916('0x9'),attributes,{'tableName':_0x0916('0xa'),'paranoid':![],'indexes':[{'name':_0x0916('0xb'),'fields':[_0x0916('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x132f=['exports','ChatTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x71dc07,_0x20d016){var _0x3eaf59=function(_0x44971a){while(--_0x44971a){_0x71dc07['push'](_0x71dc07['shift']());}};_0x3eaf59(++_0x20d016);}(_0x132f,0x9f));var _0xf132=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0x132f[_0x2feb53];return _0x5700ee;};'use strict';var _=require(_0xf132('0x0'));var util=require(_0xf132('0x1'));var logger=require(_0xf132('0x2'))('api');var moment=require(_0xf132('0x3'));var BPromise=require(_0xf132('0x4'));var rp=require(_0xf132('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf132('0x6'));var config=require(_0xf132('0x7'));var attributes=require(_0xf132('0x8'));module[_0xf132('0x9')]=function(_0x4409e6,_0x276b08){return _0x4409e6['define'](_0xf132('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf132('0xb'),'fields':[_0xf132('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9e33598..d15c84e 100644 --- a/server/api/chatTransferReport/chatTransferReport.rpc.js +++ b/server/api/chatTransferReport/chatTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9487=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x9487,0x6c));var _0x7948=function(_0x21f7ee,_0x5c38f0){_0x21f7ee=_0x21f7ee-0x0;var _0x12079a=_0x9487[_0x21f7ee];return _0x12079a;};'use strict';var _=require(_0x7948('0x0'));var util=require('util');var moment=require(_0x7948('0x1'));var BPromise=require(_0x7948('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7948('0x3'))['db'];var utils=require(_0x7948('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7948('0x5'));var client=jayson[_0x7948('0x6')][_0x7948('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c7366,_0x5b399d,_0x1e2368){return new BPromise(function(_0x5ad6f1,_0x2f1e1d){return client[_0x7948('0x8')](_0x4c7366,_0x1e2368)[_0x7948('0x9')](function(_0x9ae07a){logger['info'](_0x7948('0xa'),_0x5b399d,_0x7948('0xb'));logger[_0x7948('0xc')](_0x7948('0xd'),_0x5b399d,_0x7948('0xb'),JSON[_0x7948('0xe')](_0x9ae07a));if(_0x9ae07a[_0x7948('0xf')]){if(_0x9ae07a[_0x7948('0xf')][_0x7948('0x10')]===0x1f4){logger[_0x7948('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x5b399d,_0x9ae07a[_0x7948('0xf')][_0x7948('0x11')]);return _0x2f1e1d(_0x9ae07a[_0x7948('0xf')][_0x7948('0x11')]);}logger[_0x7948('0xf')](_0x7948('0xa'),_0x5b399d,_0x9ae07a[_0x7948('0xf')][_0x7948('0x11')]);return _0x5ad6f1(_0x9ae07a[_0x7948('0xf')][_0x7948('0x11')]);}else{logger[_0x7948('0x12')](_0x7948('0xa'),_0x5b399d,_0x7948('0xb'));_0x5ad6f1(_0x9ae07a['result']['message']);}})[_0x7948('0x13')](function(_0x277395){logger[_0x7948('0xf')](_0x7948('0xa'),_0x5b399d,_0x277395);_0x2f1e1d(_0x277395);});});} \ No newline at end of file +var _0x57a2=['http','request','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x57a2,0x197));var _0x257a=function(_0x1a41a9,_0x5023b3){_0x1a41a9=_0x1a41a9-0x0;var _0xad981f=_0x57a2[_0x1a41a9];return _0xad981f;};'use strict';var _=require(_0x257a('0x0'));var util=require(_0x257a('0x1'));var moment=require('moment');var BPromise=require(_0x257a('0x2'));var rs=require(_0x257a('0x3'));var fs=require('fs');var Redis=require(_0x257a('0x4'));var db=require(_0x257a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x257a('0x6'))(_0x257a('0x7'));var config=require(_0x257a('0x8'));var jayson=require(_0x257a('0x9'));var client=jayson[_0x257a('0xa')][_0x257a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369c43,_0x37b823,_0x2db3a5){return new BPromise(function(_0x1421b2,_0x4a86db){return client[_0x257a('0xc')](_0x369c43,_0x2db3a5)['then'](function(_0x17bc86){logger[_0x257a('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x37b823,_0x257a('0xe'));logger[_0x257a('0xf')](_0x257a('0x10'),_0x37b823,'request\x20sent',JSON['stringify'](_0x17bc86));if(_0x17bc86[_0x257a('0x11')]){if(_0x17bc86[_0x257a('0x11')]['code']===0x1f4){logger[_0x257a('0x11')](_0x257a('0x12'),_0x37b823,_0x17bc86[_0x257a('0x11')][_0x257a('0x13')]);return _0x4a86db(_0x17bc86['error'][_0x257a('0x13')]);}logger[_0x257a('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x37b823,_0x17bc86['error'][_0x257a('0x13')]);return _0x1421b2(_0x17bc86[_0x257a('0x11')][_0x257a('0x13')]);}else{logger[_0x257a('0xd')](_0x257a('0x12'),_0x37b823,_0x257a('0xe'));_0x1421b2(_0x17bc86[_0x257a('0x14')][_0x257a('0x13')]);}})[_0x257a('0x15')](function(_0x272354){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x37b823,_0x272354);_0x4a86db(_0x272354);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 4a50d47..cfe25c5 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f1f=['index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x41fad2,_0xe2dc0e){var _0x67dac0=function(_0x3271a2){while(--_0x3271a2){_0x41fad2['push'](_0x41fad2['shift']());}};_0x67dac0(++_0xe2dc0e);}(_0x0f1f,0x69));var _0xf0f1=function(_0x464507,_0x28b145){_0x464507=_0x464507-0x0;var _0x3f6072=_0x0f1f[_0x464507];return _0x3f6072;};'use strict';var multer=require('multer');var util=require(_0xf0f1('0x0'));var path=require(_0xf0f1('0x1'));var timeout=require(_0xf0f1('0x2'));var express=require('express');var router=express[_0xf0f1('0x3')]();var fs_extra=require(_0xf0f1('0x4'));var auth=require(_0xf0f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf0f1('0x6'));var controller=require('./chatTransferReport.controller');router[_0xf0f1('0x7')]('/',auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x9')]);router[_0xf0f1('0x7')]('/describe',auth[_0xf0f1('0x8')](),controller['describe']);router[_0xf0f1('0x7')](_0xf0f1('0xa'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0xb')]);router[_0xf0f1('0xc')]('/',auth['isAuthenticated'](),controller[_0xf0f1('0xd')]);router[_0xf0f1('0xe')](_0xf0f1('0xa'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0xf')]);router[_0xf0f1('0x10')](_0xf0f1('0xa'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x11')]);module[_0xf0f1('0x12')]=router; \ No newline at end of file +var _0xb989=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','create','delete','/:id','multer','util','path','connect-timeout','express'];(function(_0x3078f2,_0x2a9c32){var _0x797e2=function(_0x23012b){while(--_0x23012b){_0x3078f2['push'](_0x3078f2['shift']());}};_0x797e2(++_0x2a9c32);}(_0xb989,0x11b));var _0x9b98=function(_0x868b7c,_0xfa438b){_0x868b7c=_0x868b7c-0x0;var _0x21683c=_0xb989[_0x868b7c];return _0x21683c;};'use strict';var multer=require(_0x9b98('0x0'));var util=require(_0x9b98('0x1'));var path=require(_0x9b98('0x2'));var timeout=require(_0x9b98('0x3'));var express=require(_0x9b98('0x4'));var router=express[_0x9b98('0x5')]();var fs_extra=require(_0x9b98('0x6'));var auth=require(_0x9b98('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9b98('0x8'));var controller=require(_0x9b98('0x9'));router[_0x9b98('0xa')]('/',auth['isAuthenticated'](),controller[_0x9b98('0xb')]);router['get'](_0x9b98('0xc'),auth[_0x9b98('0xd')](),controller[_0x9b98('0xe')]);router['get']('/:id',auth[_0x9b98('0xd')](),controller['show']);router['post']('/',auth[_0x9b98('0xd')](),controller[_0x9b98('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9b98('0x10')](_0x9b98('0x11'),auth[_0x9b98('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 6d61783..2164854 100644 --- a/server/api/chatWebsite/chatWebsite.attributes.js +++ b/server/api/chatWebsite/chatWebsite.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0aa5=['Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','onlineForm','getDataValue','setDataValue','textarea','Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0x2971e6,_0x4a962e){var _0x5e6392=function(_0x16e6cf){while(--_0x16e6cf){_0x2971e6['push'](_0x2971e6['shift']());}};_0x5e6392(++_0x4a962e);}(_0x0aa5,0x11b));var _0x50aa=function(_0x54ac7c,_0x219d13){_0x54ac7c=_0x54ac7c-0x0;var _0xa4b01c=_0x0aa5[_0x54ac7c];return _0xa4b01c;};'use strict';var Sequelize=require(_0x50aa('0x0'));var rs=require(_0x50aa('0x1'));module['exports']={'name':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![],'unique':_0x50aa('0x3')},'description':{'type':Sequelize[_0x50aa('0x2')]},'mapKey':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x4')},'mapKeyOffline':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x4')},'key':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x5')},'customerAlias':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![],'defaultValue':_0x50aa('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x50aa('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![],'defaultValue':_0x50aa('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![],'defaultValue':_0x50aa('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x50aa('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x50aa('0xa'),_0x50aa('0xb')),'defaultValue':_0x50aa('0xa')},'header_online':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xc')},'start_chat_button':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xd')},'offline_chat_button':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xe')},'header_offline':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xf')},'download_transcript':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x50aa('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x50aa('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x12')},'placeholderMessage':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x13')},'closingMessage':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x14')},'closingMessageButton':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xe')},'skipMessageButton':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x15')},'conditionAgreement':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0x50aa('0x17'),_0x50aa('0x18')),'defaultValue':_0x50aa('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x50aa('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x50aa('0x10')],'defaultValue':function(){return JSON[_0x50aa('0x19')]({'items':[{'type':_0x50aa('0x1a'),'variable':null,'config':{'placeholder':_0x50aa('0x1b'),'type':'text','required':!![]},'props':{'title':_0x50aa('0x1b'),'helpText':''}},{'type':_0x50aa('0x1a'),'props':{'title':_0x50aa('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x50aa('0x4'),'type':_0x50aa('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x50aa('0x1c'))?JSON['parse'](this[_0x50aa('0x1d')]('onlineForm')):{};},'set':function(_0x4ab514){return this[_0x50aa('0x1e')](_0x50aa('0x1c'),JSON[_0x50aa('0x19')](_0x4ab514));}},'offlineForm':{'type':Sequelize[_0x50aa('0x10')],'defaultValue':function(){return JSON[_0x50aa('0x19')]({'items':[{'type':_0x50aa('0x1a'),'props':{'title':_0x50aa('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x50aa('0x4'),'type':'email'},'variable':null},{'type':_0x50aa('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x50aa('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x50aa('0x1d')](_0x50aa('0x21'))?JSON['parse'](this[_0x50aa('0x1d')]('offlineForm')):{};},'set':function(_0x29f9ec){return this[_0x50aa('0x1e')](_0x50aa('0x21'),JSON[_0x50aa('0x19')](_0x29f9ec));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x50aa('0x22')]();}},'autoclose':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x50aa('0x2')]},'forwardOffline':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x50aa('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x26')},'skipUnmanaged':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x15')},'sendUnmanaged':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x50aa('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x50aa('0x2')]},'notificationTemplate':{'type':Sequelize[_0x50aa('0x10')],'defaultValue':function(){return _0x50aa('0x27');}},'notificationSound':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x50aa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x50aa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x50aa('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x50aa('0x29')},'messagesAlignment':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x2a')},'defaultTitle':{'type':Sequelize[_0x50aa('0x2')]},'customerAvatar':{'type':Sequelize[_0x50aa('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![],'defaultValue':_0x50aa('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x50aa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x50aa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x50aa('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x50aa('0x8')],'comment':_0x50aa('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4ccaab){if(!_0x4ccaab)this[_0x50aa('0x1e')](_0x50aa('0x2d'),null);this['setDataValue']('mandatoryDisposition',_0x4ccaab);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x50aa('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':function(){return _0x50aa('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0x50aa('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x50aa('0x10')]}}; \ No newline at end of file +var _0x42b4=['TEXT','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','INTEGER','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us'];(function(_0x3e138d,_0x2ca788){var _0x434945=function(_0x340d21){while(--_0x340d21){_0x3e138d['push'](_0x3e138d['shift']());}};_0x434945(++_0x2ca788);}(_0x42b4,0xf1));var _0x442b=function(_0x3c7335,_0x86f232){_0x3c7335=_0x3c7335-0x0;var _0x4c15a7=_0x42b4[_0x3c7335];return _0x4c15a7;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x442b('0x0')]={'name':{'type':Sequelize[_0x442b('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x442b('0x1')],'allowNull':![],'unique':_0x442b('0x2')},'description':{'type':Sequelize[_0x442b('0x1')]},'mapKey':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x3')},'mapKeyOffline':{'type':Sequelize[_0x442b('0x1')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x4')},'customerAlias':{'type':Sequelize[_0x442b('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x442b('0x1')],'allowNull':![],'defaultValue':_0x442b('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x442b('0x1')],'allowNull':![],'defaultValue':_0x442b('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x442b('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x442b('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x442b('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x442b('0x8'),_0x442b('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0xa')},'start_chat_button':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0xb')},'offline_chat_button':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0xc')},'header_offline':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0xd')},'download_transcript':{'type':Sequelize[_0x442b('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x442b('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x442b('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x442b('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x442b('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x10')},'placeholderMessage':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x11')},'closingMessage':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x12')},'closingMessageButton':{'type':Sequelize[_0x442b('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x14')},'ratingType':{'type':Sequelize[_0x442b('0x15')](_0x442b('0x16'),_0x442b('0x17')),'defaultValue':_0x442b('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x442b('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x442b('0x18'),'variable':null,'config':{'placeholder':_0x442b('0x19'),'type':_0x442b('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x442b('0x18'),'props':{'title':_0x442b('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x442b('0x3'),'type':_0x442b('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x442b('0x1b')](_0x442b('0x1c'))?JSON[_0x442b('0x1d')](this['getDataValue']('onlineForm')):{};},'set':function(_0x14f0c7){return this[_0x442b('0x1e')](_0x442b('0x1c'),JSON[_0x442b('0x1f')](_0x14f0c7));}},'offlineForm':{'type':Sequelize[_0x442b('0xe')],'defaultValue':function(){return JSON[_0x442b('0x1f')]({'items':[{'type':'input','props':{'title':_0x442b('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x442b('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0x442b('0x20')},'props':{'title':_0x442b('0x20'),'helpText':_0x442b('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x442b('0x1b')](_0x442b('0x22'))?JSON[_0x442b('0x1d')](this[_0x442b('0x1b')](_0x442b('0x22'))):{};},'set':function(_0x4eed8e){return this[_0x442b('0x1e')]('offlineForm',JSON[_0x442b('0x1f')](_0x4eed8e));}},'token':{'type':Sequelize[_0x442b('0x1')],'defaultValue':function(){return rs[_0x442b('0x23')]();}},'autoclose':{'type':Sequelize[_0x442b('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x442b('0x1')]},'forwardOffline':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x442b('0x1')]},'waitingTitle':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x442b('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x442b('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x442b('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x26')},'skipUnmanaged':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x13')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x442b('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x442b('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x442b('0x1')]},'notificationTemplate':{'type':Sequelize[_0x442b('0xe')],'defaultValue':function(){return _0x442b('0x27');}},'notificationSound':{'type':Sequelize[_0x442b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x442b('0x29')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x442b('0x29')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x2a')},'verticalAlignment':{'type':Sequelize[_0x442b('0x29')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x442b('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x2b')},'defaultTitle':{'type':Sequelize[_0x442b('0x1')]},'customerAvatar':{'type':Sequelize[_0x442b('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x442b('0x29')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x442b('0x1')],'allowNull':![],'defaultValue':_0x442b('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x442b('0x29')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x442b('0x29')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x442b('0x1')],'defaultValue':_0x442b('0x2d')},'systemAvatar':{'type':Sequelize[_0x442b('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x442b('0x29')],'comment':_0x442b('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![],'comment':_0x442b('0x2f'),'set':function(_0x551dc1){if(!_0x551dc1)this['setDataValue'](_0x442b('0x30'),null);this[_0x442b('0x1e')]('mandatoryDisposition',_0x551dc1);}},'vidaooEscalation':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x442b('0x1')]},'vidaooTopic':{'type':Sequelize[_0x442b('0x1')],'allowNull':![],'defaultValue':_0x442b('0x31')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x442b('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x442b('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x442b('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x442b('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index cb33853..bf612a9 100644 --- a/server/api/chatWebsite/chatWebsite.controller.js +++ b/server/api/chatWebsite/chatWebsite.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1224=['getDispositions','findOne','Disposition','nolimit','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','getLicense','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','getSystemAvatar','server/files/images/avatars/system_avatar.png','existsSync','notify','chat','from','mapKey','isEmpty','Body\x20is\x20mandatory','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmContact','DESC','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','timezone','ifTime','List','account','list','orderBy','priority','asc','Contacts','contact','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','interaction','messageId','created','autoclose','push','applications','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','Sequelize','difference','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','addInteraction','omit','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','getProactiveActions','../../config/license/util','virtual','custom','License','increment','server/files/chat/iframe.ejs','utf8','origin','remote','headers','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','READ_COMMITTED','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','offlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','querystring','html-to-text','ioredis','../../components/parsers/qs','api','../../config/environment','APIBadRequestError','APINotFoundError','../../errors/api','APIOutOfIntervalError','handleError','APIConflictError','redis','defaults','socket.io-emitter','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','offset','limit','count','set','Content-Range','json','destroy','get','ChatWebsites','sendStatus','stack','name','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','device','vendor','model','type','index','Pause','mandatoryDispositionPause','ChatWebsite','fieldName','key','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','body','ChatWebsiteId'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1224,0xc6));var _0x4122=function(_0x4f02a5,_0x154972){_0x4f02a5=_0x4f02a5-0x0;var _0x23ca4f=_0x1224[_0x4f02a5];return _0x23ca4f;};'use strict';var Mustache=require(_0x4122('0x0'));var util=require(_0x4122('0x1'));var path=require(_0x4122('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0x4122('0x3'));var htmlToText=require(_0x4122('0x4'));var Redis=require(_0x4122('0x5'));var jayson=require('jayson/promise');var url=require('url');var qs=require(_0x4122('0x6'));var logger=require('../../config/logger')(_0x4122('0x7'));var config=require(_0x4122('0x8'));var APIBadRequestError=require('../../errors/api')[_0x4122('0x9')];var APINotFoundError=require('../../errors/api')[_0x4122('0xa')];var APIOutOfIntervalError=require(_0x4122('0xb'))[_0x4122('0xc')];var APIHandleError=require(_0x4122('0xb'))[_0x4122('0xd')];var APIConflictError=require(_0x4122('0xb'))[_0x4122('0xe')];var db=require('../../mysqldb')['db'];config[_0x4122('0xf')]=_[_0x4122('0x10')](config[_0x4122('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x4122('0x11'))(new Redis(config[_0x4122('0xf')]));require('./chatWebsite.socket')[_0x4122('0x12')](socket);var client=jayson[_0x4122('0x13')][_0x4122('0x14')]({'port':0x232c});var client9002=jayson[_0x4122('0x13')]['http']({'port':0x232a});var client9003=jayson[_0x4122('0x13')][_0x4122('0x14')]({'port':0x232b});var client9001=jayson['client'][_0x4122('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x384641,_0x254e35,_0x5d17a6,_0x3b55d9){return new Promise(function(_0x412a1e,_0x457d11){var _0x587c3c=_0x3b55d9||client;return _0x587c3c['request'](_0x384641,_0x5d17a6)[_0x4122('0x15')](function(_0x4c7236){logger[_0x4122('0x16')](_0x4122('0x17'),_0x254e35,_0x4122('0x18'));logger[_0x4122('0x19')](_0x4122('0x1a'),_0x254e35,_0x4122('0x18'),JSON[_0x4122('0x1b')](_0x4c7236));if(_0x4c7236[_0x4122('0x1c')]){if(_0x4c7236[_0x4122('0x1c')][_0x4122('0x1d')]===0x1f4){logger[_0x4122('0x1c')](_0x4122('0x17'),_0x254e35,_0x4c7236[_0x4122('0x1c')][_0x4122('0x1e')]);return _0x457d11(_0x4c7236[_0x4122('0x1c')][_0x4122('0x1e')]);}logger['error'](_0x4122('0x17'),_0x254e35,_0x4c7236[_0x4122('0x1c')][_0x4122('0x1e')]);return _0x412a1e(_0x4c7236['error'][_0x4122('0x1e')]);}else{logger[_0x4122('0x16')](_0x4122('0x17'),_0x254e35,_0x4122('0x18'));_0x412a1e(_0x4c7236[_0x4122('0x1f')][_0x4122('0x1e')]);}})[_0x4122('0x20')](function(_0x2da1d1){logger[_0x4122('0x1c')](_0x4122('0x17'),_0x254e35,_0x2da1d1);_0x457d11(_0x2da1d1);});});}function respondWithStatusCode(_0x52f531,_0x34f5ea){_0x34f5ea=_0x34f5ea||0xcc;return function(_0x5446ce){if(_0x5446ce){return _0x52f531['sendStatus'](_0x34f5ea);}return _0x52f531['status'](_0x34f5ea)[_0x4122('0x21')]();};}function respondWithResult(_0x4e8c7d,_0x2e32f7){_0x2e32f7=_0x2e32f7||0xc8;return function(_0x1c5b14){if(_0x1c5b14){return _0x4e8c7d[_0x4122('0x22')](_0x2e32f7)['json'](_0x1c5b14);}};}function respondWithFilteredResult(_0xbb939f,_0x3691ed){return function(_0x1a11c){if(_0x1a11c){var _0xbf64db=typeof _0x3691ed[_0x4122('0x23')]==='undefined'&&typeof _0x3691ed[_0x4122('0x24')]==='undefined';var _0x518aaa=_0x1a11c[_0x4122('0x25')];var _0x3cbe98=_0xbf64db?0x0:_0x3691ed['offset'];var _0x156fe6=_0xbf64db?_0x1a11c['count']:_0x3691ed[_0x4122('0x23')]+_0x3691ed['limit'];var _0x148a7d;if(_0x156fe6>=_0x518aaa){_0x156fe6=_0x518aaa;_0x148a7d=0xc8;}else{_0x148a7d=0xce;}_0xbb939f[_0x4122('0x22')](_0x148a7d);return _0xbb939f[_0x4122('0x26')](_0x4122('0x27'),_0x3cbe98+'-'+_0x156fe6+'/'+_0x518aaa)[_0x4122('0x28')](_0x1a11c);}return null;};}function saveUpdates(_0x168af5){return function(_0x2881a4){if(_0x2881a4){return _0x2881a4['update'](_0x168af5)[_0x4122('0x15')](function(_0x2e7fce){return _0x2e7fce;});}return null;};}function removeEntity(_0xa8ce1e){return function(_0x58df9c){if(_0x58df9c){return _0x58df9c[_0x4122('0x29')]()[_0x4122('0x15')](function(){var _0x29c0d6=_0x58df9c[_0x4122('0x2a')]({'plain':!![]});var _0x57f13f=_0x4122('0x2b');return db['UserProfileResource'][_0x4122('0x29')]({'where':{'type':_0x57f13f,'resourceId':_0x29c0d6['id']}})['then'](function(){return _0x58df9c;});})[_0x4122('0x15')](function(){_0xa8ce1e[_0x4122('0x22')](0xcc)[_0x4122('0x21')]();});}};}function handleEntityNotFound(_0xa373c6){return function(_0x10379b){if(!_0x10379b){_0xa373c6[_0x4122('0x2c')](0x194);}return _0x10379b;};}function handleError(_0x21257d,_0x1dc688){_0x1dc688=_0x1dc688||0x1f4;return function(_0x594e9c){logger['error'](_0x594e9c[_0x4122('0x2d')]);if(_0x594e9c[_0x4122('0x2e')]){delete _0x594e9c['name'];}_0x21257d['status'](_0x1dc688)['send'](_0x594e9c);};}function createInteractionObject(_0x55707a,_0x2fd4ff,_0x16bd08,_0x219424){var _0x4e9fc5=require(_0x4122('0x2f'));var _0x1cfb27=new _0x4e9fc5();var _0x54030b=_0x1cfb27[_0x4122('0x30')](_0x16bd08[_0x4122('0x31')])[_0x4122('0x32')]();var _0x31168d=_0x2fd4ff[_0x4122('0x33')];if(_0x16bd08['cf-connecting-ip']){_0x31168d=_0x16bd08[_0x4122('0x34')];}else if(_0x16bd08[_0x4122('0x35')]){_0x31168d=_[_0x4122('0x36')](_0x16bd08['x-forwarded-for'][_0x4122('0x37')](','));}return{'ContactId':_0x219424['id'],'ChatWebsiteId':_0x55707a,'from':(_0x219424[_0x4122('0x38')]||'')+'\x20'+(_0x219424[_0x4122('0x39')]||''),'customerIp':_0x31168d,'customerPort':_0x16bd08[_0x4122('0x3a')]?_0x16bd08[_0x4122('0x3a')]:null,'referer':_0x2fd4ff[_0x4122('0x3b')],'browserName':_0x54030b[_0x4122('0x3c')][_0x4122('0x2e')]&&_0x54030b[_0x4122('0x3c')][_0x4122('0x3d')]?util[_0x4122('0x3e')]('%s\x20%s',_0x54030b[_0x4122('0x3c')][_0x4122('0x2e')],_0x54030b[_0x4122('0x3c')]['version']):'unknown','browserVersion':_0x54030b[_0x4122('0x3c')][_0x4122('0x3d')]||_0x4122('0x3f'),'osName':util['format']('%s\x20%s',_0x54030b['os'][_0x4122('0x2e')],_0x54030b['os'][_0x4122('0x3d')]),'osVersion':_0x54030b['os']['version'],'deviceModel':_0x54030b[_0x4122('0x40')]['model']&&_0x54030b['device'][_0x4122('0x41')]?util[_0x4122('0x3e')]('%s\x20%s\x20%s',_0x54030b[_0x4122('0x40')][_0x4122('0x42')],_0x54030b[_0x4122('0x40')][_0x4122('0x41')],_0x54030b[_0x4122('0x40')][_0x4122('0x43')]):null,'deviceVendor':_0x54030b[_0x4122('0x40')]['vendor'],'deviceType':_0x54030b[_0x4122('0x40')][_0x4122('0x43')],'formData':JSON[_0x4122('0x1b')](_0x2fd4ff)};}exports[_0x4122('0x44')]=function(_0x12e99f,_0x2d6ccd){var _0x4bb6ca={'include':[{'model':db[_0x4122('0x45')],'as':_0x4122('0x46')}]},_0x47334e={},_0x19539e={'count':0x0,'rows':[]};var _0x2d86bf=_['map'](db[_0x4122('0x47')]['rawAttributes'],function(_0x242993){return{'name':_0x242993[_0x4122('0x48')],'type':_0x242993['type'][_0x4122('0x49')]};});_0x47334e['model']=_[_0x4122('0x4a')](_0x2d86bf,_0x4122('0x2e'));_0x47334e[_0x4122('0x4b')]=_[_0x4122('0x4c')](_0x12e99f[_0x4122('0x4b')]);_0x47334e[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0x47334e[_0x4122('0x42')],_0x47334e[_0x4122('0x4b')]);_0x4bb6ca[_0x4122('0x4f')]=_['intersection'](_0x47334e[_0x4122('0x42')],qs[_0x4122('0x50')](_0x12e99f['query']['fields']));_0x4bb6ca[_0x4122('0x4f')]=_0x4bb6ca[_0x4122('0x4f')][_0x4122('0x51')]?_0x4bb6ca[_0x4122('0x4f')]:_0x47334e['model'];if(!_0x12e99f[_0x4122('0x4b')][_0x4122('0x52')]('nolimit')){_0x4bb6ca[_0x4122('0x24')]=qs[_0x4122('0x24')](_0x12e99f[_0x4122('0x4b')]['limit']);_0x4bb6ca[_0x4122('0x23')]=qs[_0x4122('0x23')](_0x12e99f['query'][_0x4122('0x23')]);}_0x4bb6ca[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x12e99f[_0x4122('0x4b')][_0x4122('0x54')]);_0x4bb6ca['where']=qs[_0x4122('0x4d')](_[_0x4122('0x55')](_0x12e99f[_0x4122('0x4b')],_0x47334e[_0x4122('0x4d')]),_0x2d86bf);if(_0x12e99f[_0x4122('0x4b')][_0x4122('0x56')]){_0x4bb6ca[_0x4122('0x57')]=_[_0x4122('0x58')](_0x4bb6ca[_0x4122('0x57')],{'$or':_[_0x4122('0x4a')](_0x2d86bf,function(_0x436f7c){if(_0x436f7c[_0x4122('0x43')]!==_0x4122('0x59')){var _0x54d733={};_0x54d733[_0x436f7c['name']]={'$like':'%'+_0x12e99f['query'][_0x4122('0x56')]+'%'};return _0x54d733;}})});}_0x4bb6ca=_[_0x4122('0x58')]({},_0x4bb6ca,_0x12e99f[_0x4122('0x5a')]);var _0x372d5a={'where':_0x4bb6ca[_0x4122('0x57')]};return db['ChatWebsite'][_0x4122('0x25')](_0x372d5a)['then'](function(_0x12be15){_0x19539e[_0x4122('0x25')]=_0x12be15;if(_0x12e99f['query']['includeAll']){_0x4bb6ca[_0x4122('0x5b')]=[{'all':!![]}];}return db['ChatWebsite'][_0x4122('0x5c')](_0x4bb6ca);})[_0x4122('0x15')](function(_0x4b7491){_0x19539e['rows']=_0x4b7491;return _0x19539e;})['then'](respondWithFilteredResult(_0x2d6ccd,_0x4bb6ca))[_0x4122('0x20')](handleError(_0x2d6ccd,null));};exports[_0x4122('0x5d')]=function(_0x4625aa,_0x3e256){var _0x51633a={'raw':![],'where':{'id':_0x4625aa[_0x4122('0x5e')]['id']},'include':[{'model':db[_0x4122('0x45')],'as':_0x4122('0x46')}]},_0x5cdbc9={};_0x5cdbc9[_0x4122('0x42')]=_['keys'](db[_0x4122('0x47')][_0x4122('0x5f')]);_0x5cdbc9[_0x4122('0x4b')]=_[_0x4122('0x4c')](_0x4625aa[_0x4122('0x4b')]);_0x5cdbc9['filters']=_[_0x4122('0x4e')](_0x5cdbc9[_0x4122('0x42')],_0x5cdbc9['query']);_0x51633a['attributes']=_[_0x4122('0x4e')](_0x5cdbc9[_0x4122('0x42')],qs[_0x4122('0x50')](_0x4625aa[_0x4122('0x4b')]['fields']));_0x51633a[_0x4122('0x4f')]=_0x51633a[_0x4122('0x4f')][_0x4122('0x51')]?_0x51633a[_0x4122('0x4f')]:_0x5cdbc9[_0x4122('0x42')];if(_0x4625aa[_0x4122('0x4b')]['includeAll']){_0x51633a[_0x4122('0x5b')]=[{'all':!![]}];}_0x51633a=_[_0x4122('0x58')]({},_0x51633a,_0x4625aa[_0x4122('0x5a')]);return db['ChatWebsite']['find'](_0x51633a)[_0x4122('0x15')](handleEntityNotFound(_0x3e256,null))['then'](respondWithResult(_0x3e256,null))[_0x4122('0x20')](handleError(_0x3e256,null));};exports[_0x4122('0x60')]=function(_0xed30b6,_0x4f8ee1){return db[_0x4122('0x47')][_0x4122('0x60')](_0xed30b6['body'],{})[_0x4122('0x15')](function(_0x3157fa){var _0x58566c=_0xed30b6['user']['get']({'plain':!![]});if(!_0x58566c)throw new Error(_0x4122('0x61'));if(_0x58566c[_0x4122('0x62')]===_0x4122('0x63')){var _0x44fcee=_0x3157fa['get']({'plain':!![]});var _0xf41526=_0x4122('0x2b');return db[_0x4122('0x64')][_0x4122('0x65')]({'where':{'name':_0xf41526,'userProfileId':_0x58566c[_0x4122('0x66')]},'raw':!![]})['then'](function(_0x2fa300){if(_0x2fa300&&_0x2fa300[_0x4122('0x67')]===0x0){return db[_0x4122('0x68')][_0x4122('0x60')]({'name':_0x44fcee[_0x4122('0x2e')],'resourceId':_0x44fcee['id'],'type':_0x2fa300['name'],'sectionId':_0x2fa300['id']},{})[_0x4122('0x15')](function(){return _0x3157fa;});}else{return _0x3157fa;}})[_0x4122('0x20')](function(_0x4e4364){logger[_0x4122('0x1c')](_0x4122('0x69'),_0x4e4364);throw _0x4e4364;});}return _0x3157fa;})[_0x4122('0x15')](respondWithResult(_0x4f8ee1,0xc9))[_0x4122('0x20')](handleError(_0x4f8ee1,null));};exports[_0x4122('0x6a')]=function(_0x3ae015,_0x49d273){if(_0x3ae015['body']['id']){delete _0x3ae015['body']['id'];}return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x3ae015[_0x4122('0x5e')]['id']},'include':[{'model':db[_0x4122('0x45')],'as':_0x4122('0x46')}]})[_0x4122('0x15')](handleEntityNotFound(_0x49d273,null))[_0x4122('0x15')](saveUpdates(_0x3ae015['body'],null))[_0x4122('0x15')](respondWithResult(_0x49d273,null))['catch'](handleError(_0x49d273,null));};exports[_0x4122('0x29')]=function(_0x3376ca,_0x2cc75a){return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x3376ca[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x2cc75a,null))['then'](removeEntity(_0x2cc75a,null))['catch'](handleError(_0x2cc75a,null));};exports[_0x4122('0x6b')]=function(_0x5bbfaf,_0x5cc276){return db[_0x4122('0x47')][_0x4122('0x6b')]()['then'](respondWithResult(_0x5cc276,null))['catch'](handleError(_0x5cc276,null));};exports[_0x4122('0x6c')]=function(_0x300254,_0x44b90c){if(_0x300254[_0x4122('0x6d')]['id']){delete _0x300254[_0x4122('0x6d')]['id'];}return db['ChatWebsite'][_0x4122('0x65')]({'where':{'id':_0x300254[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x44b90c,null))[_0x4122('0x15')](function(_0x1c051d){if(_0x1c051d){_0x300254[_0x4122('0x6d')][_0x4122('0x6e')]=_0x1c051d['id'];return db['Disposition'][_0x4122('0x60')](_0x300254['body']);}})[_0x4122('0x15')](respondWithResult(_0x44b90c,null))[_0x4122('0x20')](handleError(_0x44b90c,null));};exports[_0x4122('0x6f')]=function(_0x3270d9,_0x3747e8){var _0x376ddf={'raw':![],'where':{}};var _0x122a84={};var _0x57409e={'count':0x0,'rows':[]};return db[_0x4122('0x47')][_0x4122('0x70')]({'where':{'id':_0x3270d9[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x3747e8,null))[_0x4122('0x15')](function(_0x452094){if(_0x452094){_0x122a84[_0x4122('0x42')]=_['keys'](db[_0x4122('0x71')][_0x4122('0x5f')]);_0x122a84[_0x4122('0x4b')]=_['keys'](_0x3270d9[_0x4122('0x4b')]);_0x122a84[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0x122a84[_0x4122('0x42')],_0x122a84[_0x4122('0x4b')]);_0x376ddf[_0x4122('0x4f')]=_[_0x4122('0x4e')](_0x122a84[_0x4122('0x42')],qs[_0x4122('0x50')](_0x3270d9['query']['fields']));_0x376ddf['attributes']=_0x376ddf[_0x4122('0x4f')]['length']?_0x376ddf[_0x4122('0x4f')]:_0x122a84[_0x4122('0x42')];if(!_0x3270d9[_0x4122('0x4b')]['hasOwnProperty'](_0x4122('0x72'))){_0x376ddf[_0x4122('0x24')]=qs[_0x4122('0x24')](_0x3270d9['query'][_0x4122('0x24')]);_0x376ddf[_0x4122('0x23')]=qs['offset'](_0x3270d9[_0x4122('0x4b')]['offset']);}_0x376ddf['order']=qs['sort'](_0x3270d9[_0x4122('0x4b')]['sort']);_0x376ddf[_0x4122('0x57')]=qs[_0x4122('0x4d')](_[_0x4122('0x55')](_0x3270d9[_0x4122('0x4b')],_0x122a84[_0x4122('0x4d')]));_0x376ddf[_0x4122('0x57')]['ChatWebsiteId']=_0x452094['id'];if(_0x3270d9[_0x4122('0x4b')][_0x4122('0x56')]){_0x376ddf['where']=_['merge'](_0x376ddf['where'],{'$or':_[_0x4122('0x4a')](_0x376ddf['attributes'],function(_0x909ac0){var _0x5de7fa={};_0x5de7fa[_0x909ac0]={'$like':'%'+_0x3270d9[_0x4122('0x4b')][_0x4122('0x56')]+'%'};return _0x5de7fa;})});}_0x376ddf=_[_0x4122('0x58')]({},_0x376ddf,_0x3270d9[_0x4122('0x5a')]);return db[_0x4122('0x71')]['count']({'where':_0x376ddf[_0x4122('0x57')]})[_0x4122('0x15')](function(_0x3357a8){_0x57409e[_0x4122('0x25')]=_0x3357a8;if(_0x3270d9[_0x4122('0x4b')][_0x4122('0x73')]){_0x376ddf[_0x4122('0x5b')]=[{'all':!![]}];}return db[_0x4122('0x71')][_0x4122('0x5c')](_0x376ddf);})[_0x4122('0x15')](function(_0x15dede){_0x57409e['rows']=_0x15dede;return _0x57409e;});}})['then'](respondWithFilteredResult(_0x3747e8,_0x376ddf))['catch'](handleError(_0x3747e8,null));};exports[_0x4122('0x74')]=function(_0x2d3a6a,_0x5f5c67){return db['ChatWebsite'][_0x4122('0x65')]({'where':{'id':_0x2d3a6a[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x5f5c67,null))['then'](function(_0x1e186e){if(_0x1e186e){return _0x1e186e[_0x4122('0x74')](_0x2d3a6a[_0x4122('0x4b')][_0x4122('0x75')]);}})[_0x4122('0x15')](respondWithStatusCode(_0x5f5c67,null))[_0x4122('0x20')](handleError(_0x5f5c67,null));};exports[_0x4122('0x76')]=function(_0x2e497a,_0x4308e8){if(_0x2e497a[_0x4122('0x6d')]['id']){delete _0x2e497a['body']['id'];}return db['ChatWebsite'][_0x4122('0x65')]({'where':{'id':_0x2e497a[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4308e8,null))['then'](function(_0x29a62a){if(_0x29a62a){_0x2e497a[_0x4122('0x6d')][_0x4122('0x6e')]=_0x29a62a['id'];return db[_0x4122('0x77')][_0x4122('0x60')](_0x2e497a[_0x4122('0x6d')]);}})['then'](respondWithResult(_0x4308e8,null))['catch'](handleError(_0x4308e8,null));};exports[_0x4122('0x78')]=function(_0x2c6b16,_0x284fda){var _0x1d29b4={'raw':![],'where':{}};var _0xaa0c38={};var _0x2324c6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4122('0x70')]({'where':{'id':_0x2c6b16[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x284fda,null))[_0x4122('0x15')](function(_0x157c6a){if(_0x157c6a){_0xaa0c38[_0x4122('0x42')]=_[_0x4122('0x4c')](db[_0x4122('0x77')][_0x4122('0x5f')]);_0xaa0c38['query']=_[_0x4122('0x4c')](_0x2c6b16[_0x4122('0x4b')]);_0xaa0c38[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0xaa0c38['model'],_0xaa0c38[_0x4122('0x4b')]);_0x1d29b4[_0x4122('0x4f')]=_[_0x4122('0x4e')](_0xaa0c38['model'],qs['fields'](_0x2c6b16[_0x4122('0x4b')]['fields']));_0x1d29b4[_0x4122('0x4f')]=_0x1d29b4[_0x4122('0x4f')][_0x4122('0x51')]?_0x1d29b4[_0x4122('0x4f')]:_0xaa0c38[_0x4122('0x42')];if(!_0x2c6b16['query'][_0x4122('0x52')](_0x4122('0x72'))){_0x1d29b4[_0x4122('0x24')]=qs[_0x4122('0x24')](_0x2c6b16[_0x4122('0x4b')][_0x4122('0x24')]);_0x1d29b4[_0x4122('0x23')]=qs[_0x4122('0x23')](_0x2c6b16[_0x4122('0x4b')][_0x4122('0x23')]);}_0x1d29b4[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x2c6b16[_0x4122('0x4b')][_0x4122('0x54')]);_0x1d29b4[_0x4122('0x57')]=qs['filters'](_[_0x4122('0x55')](_0x2c6b16['query'],_0xaa0c38[_0x4122('0x4d')]));_0x1d29b4[_0x4122('0x57')][_0x4122('0x6e')]=_0x157c6a['id'];if(_0x2c6b16['query'][_0x4122('0x56')]){_0x1d29b4['where']=_[_0x4122('0x58')](_0x1d29b4[_0x4122('0x57')],{'$or':_['map'](_0x1d29b4['attributes'],function(_0x5ba438){var _0x205457={};_0x205457[_0x5ba438]={'$like':'%'+_0x2c6b16[_0x4122('0x4b')]['filter']+'%'};return _0x205457;})});}_0x1d29b4=_[_0x4122('0x58')]({},_0x1d29b4,_0x2c6b16[_0x4122('0x5a')]);return db[_0x4122('0x77')][_0x4122('0x25')]({'where':_0x1d29b4[_0x4122('0x57')]})[_0x4122('0x15')](function(_0x49d235){_0x2324c6[_0x4122('0x25')]=_0x49d235;if(_0x2c6b16[_0x4122('0x4b')][_0x4122('0x73')]){_0x1d29b4[_0x4122('0x5b')]=[{'all':!![]}];}return db[_0x4122('0x77')][_0x4122('0x5c')](_0x1d29b4);})[_0x4122('0x15')](function(_0x2b841f){_0x2324c6[_0x4122('0x79')]=_0x2b841f;return _0x2324c6;});}})['then'](respondWithFilteredResult(_0x284fda,_0x1d29b4))[_0x4122('0x20')](handleError(_0x284fda,null));};exports['removeAnswers']=function(_0x4eb3da,_0x4d91a6){return db['ChatWebsite'][_0x4122('0x65')]({'where':{'id':_0x4eb3da[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x4d91a6,null))[_0x4122('0x15')](function(_0x51fb2d){if(_0x51fb2d){return _0x51fb2d['removeAnswers'](_0x4eb3da['query'][_0x4122('0x75')]);}})[_0x4122('0x15')](respondWithStatusCode(_0x4d91a6,null))[_0x4122('0x20')](handleError(_0x4d91a6,null));};exports[_0x4122('0x7a')]=function(_0x102854,_0x5e3c0f){_0x102854[_0x4122('0x6d')][_0x4122('0x7b')]=_0x102854[_0x4122('0x7c')][_0x4122('0x7d')];return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x102854[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x5e3c0f,null))['then'](saveUpdates(_0x102854[_0x4122('0x6d')],null))[_0x4122('0x15')](respondWithResult(_0x5e3c0f,null))[_0x4122('0x20')](handleError(_0x5e3c0f,null));};exports[_0x4122('0x7e')]=function(_0x24b499,_0x2060eb){_0x24b499[_0x4122('0x6d')][_0x4122('0x7f')]=_0x24b499['file'][_0x4122('0x7d')];return db[_0x4122('0x47')]['find']({'where':{'id':_0x24b499['params']['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x2060eb,null))[_0x4122('0x15')](saveUpdates(_0x24b499[_0x4122('0x6d')],null))[_0x4122('0x15')](respondWithResult(_0x2060eb,null))[_0x4122('0x20')](handleError(_0x2060eb,null));};exports[_0x4122('0x80')]=function(_0x1489f7,_0x152426){_0x1489f7[_0x4122('0x6d')][_0x4122('0x81')]=_0x1489f7['file'][_0x4122('0x7d')];return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x1489f7[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x152426,null))['then'](saveUpdates(_0x1489f7[_0x4122('0x6d')],null))[_0x4122('0x15')](respondWithResult(_0x152426,null))[_0x4122('0x20')](handleError(_0x152426,null));};exports[_0x4122('0x82')]=function(_0x1fc2e6,_0x29e7a2){_0x1fc2e6[_0x4122('0x6d')][_0x4122('0x83')]=_0x1fc2e6['file'][_0x4122('0x7d')];return db[_0x4122('0x47')]['find']({'where':{'id':_0x1fc2e6[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x29e7a2,null))[_0x4122('0x15')](saveUpdates(_0x1fc2e6[_0x4122('0x6d')],null))[_0x4122('0x15')](respondWithResult(_0x29e7a2,null))[_0x4122('0x20')](handleError(_0x29e7a2,null));};exports[_0x4122('0x84')]=function(_0x5b3b35,_0x5e812e){var _0x338382=path[_0x4122('0x85')](config[_0x4122('0x86')],'server/files/images/logos/default_logo.svg');var _0x4eb5c1={'where':{'id':_0x5b3b35[_0x4122('0x5e')]['id']},'attributes':['id',_0x4122('0x7b')],'raw':!![]};var _0x1005a8=![];return require('../../config/license/util')[_0x4122('0x87')]()['then'](function(_0x790b9c){if(_0x790b9c){_0x1005a8=_0x790b9c['custom'];}})[_0x4122('0x15')](function(){return db[_0x4122('0x47')]['find'](_0x4eb5c1);})[_0x4122('0x15')](handleEntityNotFound(_0x5e812e,null))[_0x4122('0x15')](function(_0xea2df4){if(_0xea2df4){if(!_['isNil'](_0xea2df4['sitepic'])){if(fs['existsSync'](path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x88'),_0xea2df4[_0x4122('0x7b')]))&&_0x1005a8){_0x338382=path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x88'),_0xea2df4[_0x4122('0x7b')]);}}return _0x5e812e[_0x4122('0x89')](_0x338382);}})[_0x4122('0x20')](handleError(_0x5e812e,null));};exports[_0x4122('0x8a')]=function(_0xbffd65,_0x39ed0a){var _0xabc7a=path['join'](config[_0x4122('0x86')],'server/files/images/avatars/default_avatar.png');var _0x294f6c={'where':{'id':_0xbffd65[_0x4122('0x5e')]['id']},'attributes':['id',_0x4122('0x7f')],'raw':!![]};return db[_0x4122('0x47')][_0x4122('0x65')](_0x294f6c)[_0x4122('0x15')](handleEntityNotFound(_0x39ed0a,null))[_0x4122('0x15')](function(_0x4b8af0){if(_0x4b8af0){if(!_['isNil'](_0x4b8af0['agentAvatar'])){if(fs['existsSync'](path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x8b'),_0x4b8af0['agentAvatar']))){_0xabc7a=path['join'](config[_0x4122('0x86')],_0x4122('0x8b'),_0x4b8af0[_0x4122('0x7f')]);}}return _0x39ed0a[_0x4122('0x89')](_0xabc7a);}})[_0x4122('0x20')](handleError(_0x39ed0a,null));};exports[_0x4122('0x8c')]=function(_0x3ddf4c,_0x2c3f0d){var _0x105186=path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x8d'));var _0x38eff7={'where':{'id':_0x3ddf4c[_0x4122('0x5e')]['id']},'attributes':['id',_0x4122('0x81'),_0x4122('0x8e')],'raw':!![]};return db['ChatWebsite'][_0x4122('0x65')](_0x38eff7)['then'](handleEntityNotFound(_0x2c3f0d,null))[_0x4122('0x15')](function(_0x26033d){if(_0x26033d){if(!_[_0x4122('0x8f')](_0x26033d[_0x4122('0x81')])){if(fs['existsSync'](path[_0x4122('0x85')](config[_0x4122('0x86')],'server/files/images/avatars/',_0x26033d[_0x4122('0x81')]))&&_0x26033d[_0x4122('0x8e')]){_0x105186=path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x8b'),_0x26033d[_0x4122('0x81')]);}}return _0x2c3f0d[_0x4122('0x89')](_0x105186);}})[_0x4122('0x20')](handleError(_0x2c3f0d,null));};exports[_0x4122('0x90')]=function(_0x539163,_0x5c78c0){var _0xdb77eb=path['join'](config['root'],_0x4122('0x91'));var _0x1cc890={'where':{'id':_0x539163[_0x4122('0x5e')]['id']},'attributes':['id',_0x4122('0x83')],'raw':!![]};return db[_0x4122('0x47')][_0x4122('0x65')](_0x1cc890)[_0x4122('0x15')](handleEntityNotFound(_0x5c78c0,null))[_0x4122('0x15')](function(_0x10e93d){if(_0x10e93d){if(!_['isNil'](_0x10e93d[_0x4122('0x83')])){if(fs[_0x4122('0x92')](path['join'](config[_0x4122('0x86')],_0x4122('0x8b'),_0x10e93d[_0x4122('0x83')]))){_0xdb77eb=path['join'](config[_0x4122('0x86')],_0x4122('0x8b'),_0x10e93d['systemAvatar']);}}return _0x5c78c0['download'](_0xdb77eb);}})[_0x4122('0x20')](handleError(_0x5c78c0,null));};exports[_0x4122('0x93')]=function(_0xb9b23b,_0x3a5d97){var _0x1f2b80={'body':_0xb9b23b[_0x4122('0x6d')],'channel':_0x4122('0x94')};var _0x3d905f=[];var _0x1609fd=[];var _0x1c81f4={};var _0x1cdd7a=![];if(_0xb9b23b['body']['id']){delete _0xb9b23b[_0x4122('0x6d')]['id'];}if(_[_0x4122('0x8f')](_0xb9b23b[_0x4122('0x6d')][_0x4122('0x95')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x4122('0x8f')](_0xb9b23b[_0x4122('0x6d')][_0x4122('0x96')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x4122('0x97')](_0xb9b23b[_0x4122('0x6d')]['body'])){throw new APIBadRequestError(_0x4122('0x98'));}return db['CmContact'][_0x4122('0x6b')]()[_0x4122('0x15')](function(_0x171926){if(!_0x171926){throw new Error(_0x4122('0x99'));}_0x3d905f=Object[_0x4122('0x4c')](_0x171926)[_0x4122('0x56')](function(_0x4ae150){return![_0x4122('0x9a'),'updatedAt']['includes'](_0x4ae150);});_0x1609fd=Object[_0x4122('0x4c')](_0x171926)['filter'](function(_0x3aac12){return!['createdAt',_0x4122('0x9b'),_0x4122('0x9c'),_0x4122('0x9d')][_0x4122('0x9e')](_0x3aac12);});if(!_['includes'](_0x1609fd,_0xb9b23b[_0x4122('0x6d')][_0x4122('0x96')])){throw new APIBadRequestError(_0x4122('0x9f')+_0x1609fd[_0x4122('0x85')](',\x20'));}_0x1c81f4[_0xb9b23b['body']['mapKey']]=_0xb9b23b[_0x4122('0x6d')][_0x4122('0x95')];})[_0x4122('0x15')](function(){return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0xb9b23b['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4122('0xa0')],'as':'Contacts','where':_0x1c81f4,'limit':0x1,'order':[[_0x4122('0x9b'),_0x4122('0xa1')]]}]},{'model':db[_0x4122('0xa2')],'as':_0x4122('0xa3')},{'model':db[_0x4122('0xa4')],'as':_0x4122('0xa4'),'include':[{'model':db[_0x4122('0xa4')],'as':_0x4122('0xa5'),'attributes':['id',_0x4122('0xa6')],'raw':!![]}]}]});})[_0x4122('0x15')](function(_0xac7866){if(!_0xac7866){throw new APINotFoundError(util[_0x4122('0x3e')](_0x4122('0xa7'),_0xb9b23b[_0x4122('0x5e')]['id']));}var _0x530878=_0xac7866[_0x4122('0xa4')];if(_0x530878){var _0x3a9445=_0xac7866[_0x4122('0xa8')]||undefined;return _0x530878[_0x4122('0xa9')](_0x3a9445)['then'](function(_0x355157){if(!_0x355157){throw new APIOutOfIntervalError();}return _0xac7866;});}else{return _0xac7866;}})[_0x4122('0x15')](function(_0x67d048){if(!_0x67d048[_0x4122('0xaa')]){return;}_0x1f2b80[_0x4122('0xab')]=_0x67d048;_0x1f2b80[_0x4122('0xac')]=_0x67d048['List'];_0x1f2b80['applications']=_[_0x4122('0xad')](_0x67d048[_0x4122('0xa3')],[_0x4122('0xae')],[_0x4122('0xaf')]);if(_0x1f2b80[_0x4122('0xab')]['Applications']){delete _0x1f2b80['account'][_0x4122('0xa3')];}if(_0x1f2b80[_0x4122('0xab')][_0x4122('0xaa')]&&_0x1f2b80[_0x4122('0xab')][_0x4122('0xaa')][_0x4122('0xb0')]['length']){return _0x1f2b80[_0x4122('0xab')][_0x4122('0xaa')][_0x4122('0xb0')][0x0];}var _0x4ebef5=_[_0x4122('0x10')](_0xb9b23b[_0x4122('0x6d')],{'firstName':_0xb9b23b[_0x4122('0x6d')][_0x4122('0x95')],'ListId':_0x67d048[_0x4122('0x9d')]});_0x4ebef5[_0xb9b23b['body'][_0x4122('0x96')]]=_0xb9b23b[_0x4122('0x6d')][_0x4122('0x95')];return db[_0x4122('0xa0')]['create'](_0x4ebef5,{'fields':_0x3d905f,'raw':!![]});})['then'](function(_0x4d8630){_0x1f2b80[_0x4122('0xb1')]=_0x4d8630;var _0x5a7f9a=createInteractionObject(_0xb9b23b[_0x4122('0x5e')]['id'],_0xb9b23b['body'],_0xb9b23b['headers'],_0x4d8630);var _0x164c12={'ChatWebsiteId':_0xb9b23b[_0x4122('0x5e')]['id']};if(_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb2')]){_0x164c12[_0x4122('0xb2')]=_0xb9b23b[_0x4122('0x6d')]['threadId'];_0x164c12[_0x4122('0xb3')]=![];return db['ChatInteraction']['find']({'where':_0x164c12})['then'](function(_0x2e77f4){var _0xb215b8=_0xb9b23b[_0x4122('0x6d')][_0x4122('0x33')]&&_0xb9b23b[_0x4122('0x6d')]['referer'];if(_0x2e77f4){_0x1cdd7a=!![];return _0x2e77f4;}else if(!_0xb215b8&&_0x2e77f4&&_0x2e77f4[_0x4122('0xb3')]){throw new APIConflictError(_0x4122('0xb4'));}_0x5a7f9a[_0x4122('0xb2')]=_0xb9b23b[_0x4122('0x6d')]['threadId'];_0x5a7f9a[_0x4122('0xb5')]=_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb5')];return db[_0x4122('0xb6')][_0x4122('0x60')](_0x5a7f9a);});}_0x164c12['ContactId']=_0x4d8630['id'];if(_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb7')]&&_0xb9b23b['body'][_0x4122('0xb7')]['id']){_0x164c12['id']=_0xb9b23b['body'][_0x4122('0xb7')]['id'];return db[_0x4122('0xb6')]['find']({'where':_0x164c12})[_0x4122('0x15')](function(_0x5aec89){var _0xddf209=_0xb9b23b[_0x4122('0x6d')][_0x4122('0x33')]&&_0xb9b23b[_0x4122('0x6d')][_0x4122('0x3b')];if(!_0xddf209&&_0x5aec89&&_0x5aec89[_0x4122('0xb3')]){throw new APIConflictError(_0x4122('0xb4'));}else if(_0x5aec89){_0x1cdd7a=!![];return _0x5aec89;}else{return db[_0x4122('0xb6')][_0x4122('0x60')](_0x5a7f9a);}});}return db[_0x4122('0xb6')][_0x4122('0x60')](_0x5a7f9a);})[_0x4122('0x15')](function(_0x14b404){if(!_0x1cdd7a){return _0x14b404;}var _0x28a0fb={'from':(_0x1f2b80['contact'][_0x4122('0x38')]||'')+'\x20'+(_0x1f2b80[_0x4122('0xb1')][_0x4122('0x39')]||'')};if(_0xb9b23b['body'][_0x4122('0xb2')]&&_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb8')]&&_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb2')]!=_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb8')]){_0x28a0fb[_0x4122('0xb2')]=_0xb9b23b[_0x4122('0x6d')]['messageId'];}return _0x14b404['update'](_0x28a0fb);})[_0x4122('0x15')](function(_0x1e88b5){_0x1f2b80[_0x4122('0xb7')]=_0x1e88b5[_0x4122('0x2a')]({'plain':!![]});_0x1f2b80[_0x4122('0xb7')][_0x4122('0xb9')]=!_0x1cdd7a;if(_0x1f2b80[_0x4122('0xb7')][_0x4122('0xb9')]){if(_0x1f2b80[_0x4122('0xab')][_0x4122('0xba')]){_0x1f2b80['applications'][_0x4122('0xbb')]({'id':0x0,'priority':_0x1f2b80[_0x4122('0xbc')]['length']+0x1,'app':_0x4122('0xbd'),'appdata':_0x4122('0xbe'),'interval':_0x4122('0xbf')});}}return db[_0x4122('0xc0')][_0x4122('0x60')]({'body':_0xb9b23b['body'][_0x4122('0x6d')],'ChatWebsiteId':_0xb9b23b[_0x4122('0x5e')]['id'],'ChatInteractionId':_0x1e88b5['id'],'direction':'in','ContactId':_0x1f2b80[_0x4122('0xb1')]['id'],'AttachmentId':_0xb9b23b[_0x4122('0x6d')][_0x4122('0xc1')]});})['then'](function(_0x230f2b){_0x1f2b80['message']=_0x230f2b;if(!_0x1f2b80[_0x4122('0xb7')][_0x4122('0xc2')]){return;}return db[_0x4122('0xc3')][_0x4122('0x65')]({'attributes':['id',_0x4122('0x2e')],'where':{'id':_0x1f2b80[_0x4122('0xb7')][_0x4122('0xc2')]}});})[_0x4122('0x15')](function(_0x1f9496){if(_0x1f9496){_0x1f2b80[_0x4122('0xbc')][_0x4122('0xc4')]({'id':0x0,'priority':0x0,'app':_0x4122('0xc5'),'appdata':_0x1f9496[_0x4122('0x2e')]+','+(_0x1f2b80['account'][_0x4122('0xc6')]||0xa),'interval':_0x4122('0xbf')});_0x1f2b80[_0x4122('0xc7')]=!![];}if(!_0x1f2b80[_0x4122('0xb7')][_0x4122('0xc8')]){return;}return db[_0x4122('0xc9')][_0x4122('0x65')]({'attributes':['id',_0x4122('0x2e')],'where':{'id':_0x1f2b80[_0x4122('0xb7')]['queueId']}});})['then'](function(_0x517373){if(_0x517373){_0x1f2b80[_0x4122('0xbc')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4122('0xca'),'appdata':_0x517373['name']+','+(_0x1f2b80[_0x4122('0xab')][_0x4122('0xcb')]||0x12c),'interval':_0x4122('0xbf')});}return respondWithRpcPromise(_0x4122('0xcc'),_0x4122('0xcd'),_0x1f2b80);})['then'](function(_0x287dcc){respondWithRpcPromise(_0x4122('0xce'),_0x4122('0xce'),{'event':_0x4122('0x93'),'message':_0x287dcc},client9002);return _0x287dcc;})[_0x4122('0x15')](respondWithResult(_0x3a5d97,null))['catch'](APIHandleError(_0x3a5d97));};exports[_0x4122('0xcf')]=function(_0x49570d,_0x4bbde1){var _0x4f5f47,_0x4caa8c,_0x4a12a6;var _0x34bfa1=[];var _0x8d2161={};var _0x5911c6=_0x49570d[_0x4122('0xd0')]||[];var _0x203510=[];var _0x4cafd4;return db['CmContact'][_0x4122('0x6b')]()[_0x4122('0x15')](function(_0x3fb236){if(!_0x3fb236){throw new db[(_0x4122('0xd1'))]['ValidationError']('no\x20available\x20attributes');}_0x34bfa1=_[_0x4122('0xd2')](_['keys'](_0x3fb236),[_0x4122('0x9a'),_0x4122('0x9b'),'CompanyId',_0x4122('0x9d')]);if(_0x49570d[_0x4122('0x6d')]['id']){delete _0x49570d['body']['id'];}if(_['isNil'](_0x49570d[_0x4122('0x6d')][_0x4122('0x95')])){throw _0x4bbde1[_0x4122('0x22')](0x1f4)['send'](new db[(_0x4122('0xd1'))][(_0x4122('0xd3'))](_0x4122('0xd4')));}if(_[_0x4122('0x8f')](_0x49570d['body'][_0x4122('0x6d')])||_0x49570d[_0x4122('0x6d')][_0x4122('0x6d')]===''){throw _0x4bbde1[_0x4122('0x22')](0x1f4)['send'](new db[(_0x4122('0xd1'))][(_0x4122('0xd3'))](_0x4122('0xd5')));}if(_[_0x4122('0x8f')](_0x49570d[_0x4122('0x6d')][_0x4122('0xd6')])){throw _0x4bbde1[_0x4122('0x22')](0x1f4)[_0x4122('0xd7')](new db[(_0x4122('0xd1'))][(_0x4122('0xd3'))](_0x4122('0xd8')+_0x34bfa1));}if(!_[_0x4122('0x9e')](_0x34bfa1,_0x49570d[_0x4122('0x6d')][_0x4122('0xd6')])){throw _0x4bbde1[_0x4122('0x22')](0x1f4)[_0x4122('0xd7')](new db[(_0x4122('0xd1'))][(_0x4122('0xd3'))](_0x4122('0xd9')+_0x34bfa1));}_0x8d2161[_0x49570d[_0x4122('0x6d')][_0x4122('0xd6')]]=_0x49570d[_0x4122('0x6d')][_0x4122('0x95')];})['then'](function(){return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x49570d['params']['id']},'include':[{'model':db[_0x4122('0xda')],'as':'List'},{'model':db[_0x4122('0xdb')],'as':'MailAccount'}]});})[_0x4122('0x15')](handleEntityNotFound(_0x4bbde1,null))[_0x4122('0x15')](function(_0x521816){if(_0x521816&&_0x521816[_0x4122('0xaa')]){_0x4caa8c=_0x521816;var _0x35e9a3=_[_0x4122('0x10')](_0x49570d[_0x4122('0x6d')],{'firstName':_0x49570d['body'][_0x4122('0x95')],'phone':_0x49570d[_0x4122('0x6d')]['from'],'ListId':_0x521816[_0x4122('0x9d')]});_0x35e9a3[_0x49570d[_0x4122('0x6d')][_0x4122('0xd6')]]=_0x49570d[_0x4122('0x6d')][_0x4122('0x95')];return db[_0x4122('0xa0')][_0x4122('0xdc')]({'where':_0x8d2161,'defaults':_0x35e9a3});}})[_0x4122('0xdd')](function(_0x1a98a1){if(_0x1a98a1){_0x4a12a6=_0x1a98a1;var _0x15ac3f=fs[_0x4122('0xde')](path['join'](config['root'],_0x4122('0xdf')),'utf8');var _0x51d120=ejs[_0x4122('0xe0')](_0x15ac3f,{'body':_[_0x4122('0xe1')](_0x49570d[_0x4122('0x6d')][_0x4122('0x6d')]),'bodyTitle':_0x4caa8c[_0x4122('0xe2')]});return db[_0x4122('0xe3')][_0x4122('0x60')]({'body':_0x51d120,'plainBody':htmlToText[_0x4122('0xe4')](_0x51d120),'ContactId':_0x1a98a1['id'],'ChatWebsiteId':_0x4caa8c['id']});}})[_0x4122('0x15')](function(_0x6ddac0){_0x4cafd4=_0x6ddac0;if(_0x5911c6[_0x4122('0x51')]){var _0x1747ac=_0x5911c6[_0x4122('0x4a')](function(_0x144fa0){return{'name':_0x144fa0[_0x4122('0xe5')],'basename':_0x144fa0[_0x4122('0x7d')],'type':_0x144fa0[_0x4122('0xe6')],'ChatOfflineMessageId':_0x6ddac0['id']};});_0x203510=_0x1747ac[_0x4122('0x4a')](_0xfbe78d=>{var _0x4390da={'filename':_0xfbe78d[_0x4122('0x2e')],'path':path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0xe7'),_0x4122('0xd0'),_0x4122('0xe8'),_0x4122('0xe9'),_0xfbe78d[_0x4122('0xea')])};return _0x4390da;});if(!_0x4caa8c['openNewInteraction']){return db[_0x4122('0xeb')][_0x4122('0xec')](function(_0x59108b){return db[_0x4122('0xed')][_0x4122('0xee')](_0x1747ac,{'transaction':_0x59108b});});}}})[_0x4122('0x15')](function(){if(_0x4cafd4){_0x4f5f47=_0x4cafd4;return db[_0x4122('0xdb')][_0x4122('0x70')]({'where':{'service':!![]},'include':[{'model':db[_0x4122('0xef')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4122('0xf0')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x4122('0x15')](function(_0x496112){if(_0x496112&&_0x496112[_0x4122('0xf1')]&&_0x4caa8c[_0x4122('0xf2')]&&_0x4caa8c['forwardOfflineAddress']){var _0x5b617c=_0x496112[_0x4122('0xf3')]();return respondWithRpcPromise(_0x4122('0xf4'),_0x4122('0xf5'),{'account':_0x5b617c,'message':{'from':util['format'](_0x4122('0xf6'),_0x496112[_0x4122('0x2e')],_0x496112[_0x4122('0xf7')]||_0x496112[_0x4122('0xf1')][_0x4122('0x63')]),'to':_0x4caa8c[_0x4122('0xf8')],'subject':_0x4caa8c[_0x4122('0xf9')],'html':_0x4f5f47[_0x4122('0x6d')],'attachments':_0x203510}},client9003)['then'](function(){return _0x4f5f47;})[_0x4122('0x20')](function(_0x952fe1){logger[_0x4122('0x1c')](_0x952fe1);});}})[_0x4122('0x15')](function(){if(_0x4caa8c&&_0x4caa8c[_0x4122('0xfa')]&&_0x4caa8c[_0x4122('0xfb')]){var _0x1037b0=[];if(_0x5911c6['length']){_0x1037b0=_0x5911c6[_0x4122('0x4a')](function(_0x43c964){return{'name':_0x43c964['originalname'],'basename':_0x43c964[_0x4122('0x7d')],'type':_0x43c964[_0x4122('0xe6')],'ChatOfflineMessageId':_0x4cafd4['id']};});}var _0x32b5ae;if(!_[_0x4122('0x8f')](_0x4caa8c[_0x4122('0xfc')])){var _0x4f0c78=_[_0x4122('0x4a')](_0x49570d['body'],function(_0x873052){return _0x873052;});var _0x4a2338=_[_0x4122('0xfd')](_0x4f0c78)[0x0];var _0x3638b8=_[_0x4122('0xfe')](_0x4a2338,function(_0x5315c8){return _0x5315c8;});_0x32b5ae=_0x3638b8[0x1][_0x4caa8c[_0x4122('0xfc')]];}var _0x287946={'from':_0x4a12a6['email'],'firstName':_0x4a12a6[_0x4122('0x38')],'lastName':_0x4a12a6[_0x4122('0x39')],'mapKey':_0x4122('0xf7'),'message':{'from':_0x4a12a6[_0x4122('0xf7')],'to':_0x4caa8c[_0x4122('0xdb')][_0x4122('0xf7')],'cc':'','subject':_[_0x4122('0x8f')](_0x32b5ae)?_0x4caa8c[_0x4122('0xf9')]:_0x32b5ae,'messageId':'','sentAt':new Date(),'attach':_0x1037b0['length'],'attachments':_0x1037b0,'originChannel':_0x4122('0xff'),'ChatWebsiteId':_0x4caa8c['id'],'ChatOfflineMessageId':_0x4f5f47['id'],'originTo':_0x4caa8c[_0x4122('0xdb')][_0x4122('0xf7')]},'body':_0x4f5f47[_0x4122('0x6d')]};var _0x3d2f91={'account':{'id':_0x4caa8c[_0x4122('0xfb')]},'body':_0x287946,'log':_0x4122('0x100')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x3d2f91,client9001)[_0x4122('0x15')](function(){return _0x4f5f47;})['catch'](function(_0x468460){logger['error'](_0x468460);});}return;})[_0x4122('0x15')](function(){if(_0x4f5f47){return _0x4f5f47;}})[_0x4122('0x15')](respondWithResult(_0x4bbde1,null))[_0x4122('0x20')](function(){for(var _0xc9a468 of _0x5911c6){var _0x4b94f4=path[_0x4122('0x85')](config['root'],_0x4122('0xe7'),_0x4122('0xd0'),_0x4122('0xe8'),'offline-chat',_0xc9a468[_0x4122('0x7d')]);fs_extra['remove'](_0x4b94f4)[_0x4122('0x20')](function(_0x16e1fd){logger[_0x4122('0x1c')]('Could\x20not\x20remove\x20attachment\x20file',_0x4b94f4,_0x16e1fd);});}});};exports[_0x4122('0x101')]=function(_0x370266,_0x589870){return db[_0x4122('0xb6')][_0x4122('0x65')]({'where':{'id':_0x370266['params']['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x589870,null))['then'](function(_0x5d5155){if(_0x5d5155){return _0x5d5155['addInteraction'](_0x370266[_0x4122('0x6d')][_0x4122('0x75')],_[_0x4122('0x102')](_0x370266[_0x4122('0x6d')],[_0x4122('0x75'),'id'])||{});}})[_0x4122('0x15')](respondWithResult(_0x589870,null))['catch'](handleError(_0x589870,null));};exports[_0x4122('0x103')]=function(_0x55ce4a,_0x39d1bc){var _0x224a86={'raw':![],'where':{}};var _0x409bad={};var _0x1bde17={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x55ce4a[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x39d1bc,null))['then'](function(_0x3c4d9a){if(_0x3c4d9a){_0x409bad[_0x4122('0x42')]=_[_0x4122('0x4c')](db['ChatInteraction'][_0x4122('0x5f')]);_0x409bad[_0x4122('0x4b')]=_['keys'](_0x55ce4a['query']);_0x409bad['filters']=_[_0x4122('0x4e')](_0x409bad[_0x4122('0x42')],_0x409bad[_0x4122('0x4b')]);_0x224a86[_0x4122('0x4f')]=_[_0x4122('0x4e')](_0x409bad[_0x4122('0x42')],qs[_0x4122('0x50')](_0x55ce4a['query'][_0x4122('0x50')]));_0x224a86[_0x4122('0x4f')]=_0x224a86[_0x4122('0x4f')][_0x4122('0x51')]?_0x224a86[_0x4122('0x4f')]:_0x409bad[_0x4122('0x42')];if(!_0x55ce4a[_0x4122('0x4b')]['hasOwnProperty']('nolimit')){_0x224a86['limit']=qs['limit'](_0x55ce4a[_0x4122('0x4b')][_0x4122('0x24')]);_0x224a86[_0x4122('0x23')]=qs[_0x4122('0x23')](_0x55ce4a[_0x4122('0x4b')][_0x4122('0x23')]);}_0x224a86['order']=qs['sort'](_0x55ce4a['query'][_0x4122('0x54')]);_0x224a86[_0x4122('0x57')]=qs[_0x4122('0x4d')](_[_0x4122('0x55')](_0x55ce4a['query'],_0x409bad['filters']));_0x224a86['where'][_0x4122('0x6e')]=_0x3c4d9a['id'];if(_0x55ce4a['query']['filter']){_0x224a86['where']=_[_0x4122('0x58')](_0x224a86[_0x4122('0x57')],{'$or':_['map'](_0x224a86[_0x4122('0x4f')],function(_0x989f7){var _0x2e9c92={};_0x2e9c92[_0x989f7]={'$like':'%'+_0x55ce4a[_0x4122('0x4b')][_0x4122('0x56')]+'%'};return _0x2e9c92;})});}_0x224a86=_[_0x4122('0x58')]({},_0x224a86,_0x55ce4a[_0x4122('0x5a')]);return db[_0x4122('0xb6')][_0x4122('0x25')]({'where':_0x224a86[_0x4122('0x57')]})['then'](function(_0x24102e){_0x1bde17['count']=_0x24102e;if(_0x55ce4a[_0x4122('0x4b')][_0x4122('0x73')]){_0x224a86['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x4122('0xc3')],'as':_0x4122('0x104'),'attributes':['name',_0x4122('0x105'),_0x4122('0x106')],'required':![]},{'model':db[_0x4122('0x107')],'as':_0x4122('0x108'),'attributes':['id','name',_0x4122('0x109')],'where':_0x55ce4a['query'][_0x4122('0x10a')]?{'id':_0x55ce4a[_0x4122('0x4b')]['tag']}:undefined,'required':_0x55ce4a[_0x4122('0x4b')][_0x4122('0x10a')]?!![]:![]}];}return db[_0x4122('0xb6')]['findAll'](_0x224a86);})['then'](function(_0x297958){_0x1bde17['rows']=_0x297958;return _0x1bde17;});}})[_0x4122('0x15')](respondWithFilteredResult(_0x39d1bc,_0x224a86))['catch'](handleError(_0x39d1bc,null));};exports['getSnippet']=function(_0x15031a,_0x1579ad){var _0x430c5f=0x0;var _0xa3b6bb=0x0;var _0x4f108f=![];var _0x423f9c;var _0x1505f1;return db['ChatWebsite']['find']({'where':{'id':_0x15031a['params']['id']},'include':[{'model':db[_0x4122('0xa4')],'as':_0x4122('0xa4'),'include':[{'model':db[_0x4122('0xa4')],'as':'Intervals','attributes':['id',_0x4122('0xa6')]}]}]})[_0x4122('0x15')](handleEntityNotFound(_0x1579ad,null))[_0x4122('0x15')](function(_0x19837f){if(_0x19837f){_0x423f9c=_0x19837f;return _0x19837f[_0x4122('0x10b')]({'raw':!![]});}})[_0x4122('0x15')](function(_0x30eb51){if(_0x423f9c){if(_0x30eb51){_0x1505f1=_0x30eb51;}}return require(_0x4122('0x10c'))[_0x4122('0x87')]();})['then'](function(_0x3b0aee){if(_0x3b0aee){_0xa3b6bb=_0x3b0aee[_0x4122('0x10d')];_0x4f108f=_0x3b0aee[_0x4122('0x10e')];}})[_0x4122('0x15')](function(){return db[_0x4122('0xb6')][_0x4122('0x25')]({'where':{'closed':![]}});})[_0x4122('0x15')](function(_0x1dbb7a){_0x430c5f=_0x1dbb7a;if(_0xa3b6bb&&_0x1dbb7a>_0xa3b6bb){return db[_0x4122('0x10f')][_0x4122('0x70')]({'where':{'id':0x1}})[_0x4122('0x15')](function(_0x408182){if(_0x408182){_0x408182[_0x4122('0x110')]('chatLicenseExceeded');}});}})['then'](function(){var _0x9d9d73=_0x423f9c[_0x4122('0xa4')];var _0x3fe22e=_0x423f9c[_0x4122('0xa8')]||undefined;return _0x9d9d73?_0x9d9d73[_0x4122('0xa9')](_0x3fe22e):!![];})[_0x4122('0x15')](function(_0xb39b79){var _0x10fbbb=fs[_0x4122('0xde')](path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x111')),_0x4122('0x112'));var _0x3da13c=new url['URL'](_0x423f9c['address'])[_0x4122('0x113')];var _0x315a59='3.8.1';var _0x31a4cc=![];var _0x2fe24f={'chatVersion':_0x315a59,'chatWebsiteAddressOrigin':_0x3da13c,'remote':_0x423f9c[_0x4122('0x114')],'query':querystring['stringify'](_[_0x4122('0x58')](_0x423f9c[_0x4122('0x2a')]({'plain':!![]}),{'customerIp':_0x15031a['headers'][_0x4122('0x35')]||_0x15031a[_0x4122('0x115')]['x-real-ip']||_0x15031a[_0x4122('0x116')][_0x4122('0x117')]||_0x15031a['ip'],'referer':_0x15031a['headers'][_0x4122('0x3b')],'openedInteractions':_0x430c5f,'maxInteractions':_0xa3b6bb,'virtual':_0x4f108f['virtual'],'online':_0xb39b79,'custom':_0x4f108f}))['replace'](/'/g,'\x5c\x27')};_0x1579ad[_0x4122('0xd7')](ejs[_0x4122('0xe0')](Mustache[_0x4122('0xe0')](_0x10fbbb,_0x2fe24f),{'proactiveActions':_0x1505f1,'alignment':_0x423f9c[_0x4122('0x118')],'verticalAlignment':_0x423f9c[_0x4122('0x119')],'div_color':_0x423f9c[_0x4122('0x109')],'labelText':_0x423f9c[_0x4122('0x11a')],'text_color':_0x423f9c[_0x4122('0x11b')],'text_button_color':_0x423f9c[_0x4122('0x11c')],'button_color':_0x423f9c['color_button'],'background_color':_0x423f9c[_0x4122('0x11d')],'hideWhenOffline':_0x423f9c[_0x4122('0x11e')],'intervalId':_0x423f9c[_0x4122('0x11f')],'isDevelopment':_0x31a4cc,'chatVersion':_0x315a59}));})['catch'](handleError(_0x1579ad,null));};exports[_0x4122('0x120')]=function(_0x18e1c6,_0x540a1d){var _0x1f2086=_0x18e1c6[_0x4122('0x5e')]['id'];var _0x2af064=_0x18e1c6[_0x4122('0x6d')];var _0x202c62=0xc8;var _0x57d164=null;return db[_0x4122('0xeb')][_0x4122('0xec')]({'isolationLevel':db[_0x4122('0xeb')][_0x4122('0x121')]['ISOLATION_LEVELS'][_0x4122('0x122')]},function(_0x4d6344){return db[_0x4122('0x47')][_0x4122('0x70')]({'where':{'id':_0x1f2086},'transaction':_0x4d6344})[_0x4122('0x15')](function(_0x1c99e4){if(_0x1c99e4){return db[_0x4122('0xa2')][_0x4122('0x29')]({'where':{'ChatWebsiteId':_0x1f2086},'transaction':_0x4d6344})['then'](function(){var _0x4fe8b8=_[_0x4122('0x4a')](_0x2af064,function(_0x34760f){_0x34760f[_0x4122('0x6e')]=_0x1f2086;return _0x34760f;});return db[_0x4122('0xa2')]['bulkCreate'](_0x4fe8b8,{'transaction':_0x4d6344});});}else{_0x202c62=0x194;_0x57d164=[];}});})[_0x4122('0x15')](function(){if(_0x202c62!==0x194){return db[_0x4122('0xa2')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1f2086},'order':'priority'})[_0x4122('0x15')](function(_0xd6ba5c){_0x57d164=_0xd6ba5c;});}})[_0x4122('0x20')](function(_0x41d402){_0x202c62=0x1f4;logger['error'](_0x41d402['stack']);if(_0x41d402['name']){delete _0x41d402['name'];}_0x57d164=_0x41d402;})[_0x4122('0x123')](function(){if(_0x57d164===null){_0x540a1d[_0x4122('0x2c')](_0x202c62);}else{if(_0x202c62===0x1f4){_0x540a1d['status'](_0x202c62)['send'](_0x57d164);}else{_0x540a1d[_0x4122('0x22')](_0x202c62)['json'](_0x57d164);}}});};exports[_0x4122('0x124')]=function(_0x5481d7,_0x2badbc){var _0x508af0={};var _0x8c8072={};var _0x534ed3;var _0x405fff;return db['ChatWebsite']['findOne']({'where':{'id':_0x5481d7[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x2badbc,null))[_0x4122('0x15')](function(_0x7a24e3){if(_0x7a24e3){_0x534ed3=_0x7a24e3;_0x8c8072[_0x4122('0x42')]=_[_0x4122('0x4c')](db[_0x4122('0xa2')]['rawAttributes']);_0x8c8072[_0x4122('0x4b')]=_[_0x4122('0x4c')](_0x5481d7['query']);_0x8c8072[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0x8c8072['model'],_0x8c8072[_0x4122('0x4b')]);_0x508af0[_0x4122('0x4f')]=_[_0x4122('0x4e')](_0x8c8072['model'],qs[_0x4122('0x50')](_0x5481d7['query'][_0x4122('0x50')]));_0x508af0[_0x4122('0x4f')]=_0x508af0['attributes'][_0x4122('0x51')]?_0x508af0[_0x4122('0x4f')]:_0x8c8072[_0x4122('0x42')];_0x508af0[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x5481d7['query'][_0x4122('0x54')]);_0x508af0['where']=qs['filters'](_['pick'](_0x5481d7[_0x4122('0x4b')],_0x8c8072['filters']));if(_0x5481d7[_0x4122('0x4b')]['filter']){_0x508af0[_0x4122('0x57')]=_[_0x4122('0x58')](_0x508af0[_0x4122('0x57')],{'$or':_[_0x4122('0x4a')](_0x508af0[_0x4122('0x4f')],function(_0x2bfd89){var _0x26f7b1={};_0x26f7b1[_0x2bfd89]={'$like':'%'+_0x5481d7['query'][_0x4122('0x56')]+'%'};return _0x26f7b1;})});}_0x508af0=_['merge']({},_0x508af0,_0x5481d7['options']);return _0x534ed3[_0x4122('0x124')](_0x508af0);}})[_0x4122('0x15')](function(_0x4d428c){if(_0x4d428c){_0x405fff=_0x4d428c[_0x4122('0x51')];if(!_0x5481d7[_0x4122('0x4b')][_0x4122('0x52')](_0x4122('0x72'))){_0x508af0[_0x4122('0x24')]=qs['limit'](_0x5481d7[_0x4122('0x4b')][_0x4122('0x24')]);_0x508af0[_0x4122('0x23')]=qs['offset'](_0x5481d7[_0x4122('0x4b')][_0x4122('0x23')]);}return _0x534ed3[_0x4122('0x124')](_0x508af0);}})['then'](function(_0x2684bd){if(_0x2684bd){return _0x2684bd?{'count':_0x405fff,'rows':_0x2684bd}:null;}})[_0x4122('0x15')](respondWithResult(_0x2badbc,null))['catch'](handleError(_0x2badbc,null));};exports['addProactiveActions']=function(_0x1a03c2,_0x260b3b){return db[_0x4122('0x125')][_0x4122('0x65')]({'where':{'id':_0x1a03c2[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x260b3b,null))[_0x4122('0x15')](function(_0x2d2f31){if(_0x2d2f31){return _0x2d2f31[_0x4122('0x126')](_0x1a03c2['body'][_0x4122('0x75')],_['omit'](_0x1a03c2[_0x4122('0x6d')],[_0x4122('0x75'),'id'])||{});}})[_0x4122('0x15')](respondWithResult(_0x260b3b,null))[_0x4122('0x20')](handleError(_0x260b3b,null));};exports[_0x4122('0x10b')]=function(_0x3c1256,_0x1b8840){var _0x52adcc={};var _0x49875f={};var _0x59cf79;var _0x15826a;return db[_0x4122('0x47')][_0x4122('0x70')]({'where':{'id':_0x3c1256[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x1b8840,null))['then'](function(_0x1df890){if(_0x1df890){_0x59cf79=_0x1df890;_0x49875f[_0x4122('0x42')]=_['keys'](db[_0x4122('0x127')][_0x4122('0x5f')]);_0x49875f[_0x4122('0x4b')]=_[_0x4122('0x4c')](_0x3c1256[_0x4122('0x4b')]);_0x49875f[_0x4122('0x4d')]=_['intersection'](_0x49875f[_0x4122('0x42')],_0x49875f[_0x4122('0x4b')]);_0x52adcc[_0x4122('0x4f')]=_[_0x4122('0x4e')](_0x49875f[_0x4122('0x42')],qs['fields'](_0x3c1256[_0x4122('0x4b')][_0x4122('0x50')]));_0x52adcc['attributes']=_0x52adcc[_0x4122('0x4f')][_0x4122('0x51')]?_0x52adcc['attributes']:_0x49875f[_0x4122('0x42')];_0x52adcc[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x3c1256['query'][_0x4122('0x54')]);_0x52adcc[_0x4122('0x57')]=qs[_0x4122('0x4d')](_['pick'](_0x3c1256[_0x4122('0x4b')],_0x49875f[_0x4122('0x4d')]));if(_0x3c1256[_0x4122('0x4b')][_0x4122('0x56')]){_0x52adcc['where']=_[_0x4122('0x58')](_0x52adcc[_0x4122('0x57')],{'$or':_['map'](_0x52adcc[_0x4122('0x4f')],function(_0x564a9b){var _0x2c2522={};_0x2c2522[_0x564a9b]={'$like':'%'+_0x3c1256[_0x4122('0x4b')][_0x4122('0x56')]+'%'};return _0x2c2522;})});}_0x52adcc=_[_0x4122('0x58')]({},_0x52adcc,_0x3c1256[_0x4122('0x5a')]);return _0x59cf79[_0x4122('0x10b')](_0x52adcc);}})[_0x4122('0x15')](function(_0x26fed7){if(_0x26fed7){_0x15826a=_0x26fed7['length'];if(!_0x3c1256[_0x4122('0x4b')][_0x4122('0x52')](_0x4122('0x72'))){_0x52adcc[_0x4122('0x24')]=qs[_0x4122('0x24')](_0x3c1256[_0x4122('0x4b')][_0x4122('0x24')]);_0x52adcc[_0x4122('0x23')]=qs['offset'](_0x3c1256[_0x4122('0x4b')][_0x4122('0x23')]);}return _0x59cf79[_0x4122('0x10b')](_0x52adcc);}})[_0x4122('0x15')](function(_0x1a9d51){if(_0x1a9d51){return _0x1a9d51?{'count':_0x15826a,'rows':_0x1a9d51}:null;}})[_0x4122('0x15')](respondWithResult(_0x1b8840,null))[_0x4122('0x20')](handleError(_0x1b8840,null));};exports[_0x4122('0x128')]=function(_0xbd985d,_0x311464){var _0x1d4714=_0xbd985d['query']['online']==='false'?_0x4122('0x129'):'onlineForm';return db['ChatWebsite'][_0x4122('0x65')]({'attributes':['id',_0x1d4714],'where':{'id':_0xbd985d[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x311464,null))[_0x4122('0x15')](function(_0x1f01a3){if(_0x1f01a3){var _0x4ecbf5=_0x1f01a3[_0x1d4714];var _0x19f6c2=_0x4ecbf5&&_0x4ecbf5[_0x4122('0x12a')]?_0x4ecbf5['items']:[];_0x311464[_0x4122('0xd7')]({'fromKey':_[_0x4122('0x8f')](_0x4ecbf5['fromKey'])?undefined:_0x4ecbf5[_0x4122('0x12b')],'count':_0x19f6c2[_0x4122('0x51')],'rows':_0x19f6c2});}})[_0x4122('0x20')](handleError(_0x311464,null));};exports[_0x4122('0x12c')]=function(_0x19214c,_0x46f8a2){var _0x3fc21c={'raw':![],'where':{}};var _0x4f2c96={};var _0x32b626={'count':0x0,'rows':[]};return db[_0x4122('0x47')][_0x4122('0x70')]({'where':{'id':_0x19214c[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x46f8a2,null))['then'](function(_0x4c6cca){if(_0x4c6cca){_0x4f2c96[_0x4122('0x42')]=_[_0x4122('0x4c')](db[_0x4122('0xe3')][_0x4122('0x5f')]);_0x4f2c96[_0x4122('0x4b')]=_[_0x4122('0x4c')](_0x19214c[_0x4122('0x4b')]);_0x4f2c96[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0x4f2c96[_0x4122('0x42')],_0x4f2c96['query']);_0x3fc21c['attributes']=_[_0x4122('0x4e')](_0x4f2c96[_0x4122('0x42')],qs[_0x4122('0x50')](_0x19214c['query']['fields']));_0x3fc21c[_0x4122('0x4f')]=_0x3fc21c[_0x4122('0x4f')][_0x4122('0x51')]?_0x3fc21c[_0x4122('0x4f')]:_0x4f2c96['model'];if(!_0x19214c[_0x4122('0x4b')][_0x4122('0x52')](_0x4122('0x72'))){_0x3fc21c[_0x4122('0x24')]=qs[_0x4122('0x24')](_0x19214c[_0x4122('0x4b')]['limit']);_0x3fc21c['offset']=qs[_0x4122('0x23')](_0x19214c[_0x4122('0x4b')][_0x4122('0x23')]);}_0x3fc21c[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x19214c[_0x4122('0x4b')][_0x4122('0x54')]);_0x3fc21c['where']=qs[_0x4122('0x4d')](_[_0x4122('0x55')](_0x19214c[_0x4122('0x4b')],_0x4f2c96['filters']));_0x3fc21c[_0x4122('0x57')][_0x4122('0x6e')]=_0x4c6cca['id'];if(_0x19214c[_0x4122('0x4b')]['filter']){_0x3fc21c[_0x4122('0x57')]=_[_0x4122('0x58')](_0x3fc21c[_0x4122('0x57')],{'$or':_[_0x4122('0x4a')](_0x3fc21c[_0x4122('0x4f')],function(_0x27441d){var _0x2d8d35={};_0x2d8d35[_0x27441d]={'$like':'%'+_0x19214c[_0x4122('0x4b')]['filter']+'%'};return _0x2d8d35;})});}_0x3fc21c=_[_0x4122('0x58')]({},_0x3fc21c,_0x19214c[_0x4122('0x5a')]);return db['ChatOfflineMessage'][_0x4122('0x25')]({'where':_0x3fc21c[_0x4122('0x57')]})[_0x4122('0x15')](function(_0xd7fdde){_0x32b626[_0x4122('0x25')]=_0xd7fdde;if(_0x19214c[_0x4122('0x4b')]['includeAll']){_0x3fc21c[_0x4122('0x5b')]=[{'all':!![]}];}else{_0x3fc21c[_0x4122('0x5b')]=[{'model':db[_0x4122('0xa0')],'as':_0x4122('0x12d'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0x4122('0xe3')]['findAll'](_0x3fc21c);})[_0x4122('0x15')](function(_0x1c23e8){_0x32b626[_0x4122('0x79')]=_0x1c23e8;return _0x32b626;});}})[_0x4122('0x15')](respondWithFilteredResult(_0x46f8a2,_0x3fc21c))[_0x4122('0x20')](handleError(_0x46f8a2,null));};exports[_0x4122('0x12e')]=function(_0x281bd1,_0x5e55e2){return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x281bd1[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x5e55e2,null))[_0x4122('0x15')](function(_0xa2300c){if(_0xa2300c){return _0xa2300c[_0x4122('0x12e')](_0x281bd1['body'][_0x4122('0x75')],_[_0x4122('0x102')](_0x281bd1[_0x4122('0x6d')],['ids','id'])||{})[_0x4122('0xdd')](function(_0x49b039){for(var _0x107443=0x0;_0x107443<_0x281bd1['body'][_0x4122('0x75')][_0x4122('0x51')];_0x107443+=0x1){socket[_0x4122('0x12f')](_0x4122('0x130'),{'UserId':Number(_0x281bd1[_0x4122('0x6d')]['ids'][_0x107443]),'ChatWebsiteId':Number(_0x281bd1[_0x4122('0x5e')]['id'])});}return _0x49b039;});}})[_0x4122('0x15')](respondWithResult(_0x5e55e2,null))[_0x4122('0x20')](handleError(_0x5e55e2,null));};exports[_0x4122('0x131')]=function(_0x4485b4,_0x219331){return db['ChatWebsite']['find']({'where':{'id':_0x4485b4[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x219331,null))[_0x4122('0x15')](function(_0x437970){if(_0x437970){return _0x437970[_0x4122('0x131')](_0x4485b4[_0x4122('0x4b')][_0x4122('0x75')])[_0x4122('0x15')](function(){if(_[_0x4122('0x132')](_0x4485b4[_0x4122('0x4b')][_0x4122('0x75')])){for(var _0x326c20=0x0;_0x326c20<_0x4485b4[_0x4122('0x4b')][_0x4122('0x75')]['length'];_0x326c20+=0x1){socket[_0x4122('0x12f')](_0x4122('0x133'),{'UserId':Number(_0x4485b4[_0x4122('0x4b')][_0x4122('0x75')][_0x326c20]),'ChatWebsiteId':Number(_0x4485b4[_0x4122('0x5e')]['id'])});}}else{socket['emit'](_0x4122('0x133'),{'UserId':Number(_0x4485b4[_0x4122('0x4b')][_0x4122('0x75')]),'ChatWebsiteId':Number(_0x4485b4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x219331,null))[_0x4122('0x20')](handleError(_0x219331,null));};exports[_0x4122('0x134')]=function(_0x13fad9,_0x1d666e){var _0x58fe14={};var _0x1eed2e={};var _0x29b38e;var _0x33225f;return db[_0x4122('0x47')][_0x4122('0x70')]({'where':{'id':_0x13fad9[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1d666e,null))[_0x4122('0x15')](function(_0x3c3bc6){if(_0x3c3bc6){_0x29b38e=_0x3c3bc6;_0x1eed2e[_0x4122('0x42')]=_[_0x4122('0x4c')](db[_0x4122('0xc3')][_0x4122('0x5f')]);_0x1eed2e[_0x4122('0x4b')]=_['keys'](_0x13fad9[_0x4122('0x4b')]);_0x1eed2e[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0x1eed2e[_0x4122('0x42')],_0x1eed2e[_0x4122('0x4b')]);_0x58fe14[_0x4122('0x4f')]=_['intersection'](_0x1eed2e[_0x4122('0x42')],qs[_0x4122('0x50')](_0x13fad9[_0x4122('0x4b')][_0x4122('0x50')]));_0x58fe14[_0x4122('0x4f')]=_0x58fe14[_0x4122('0x4f')][_0x4122('0x51')]?_0x58fe14['attributes']:_0x1eed2e[_0x4122('0x42')];_0x58fe14[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x13fad9['query'][_0x4122('0x54')]);_0x58fe14['where']=qs[_0x4122('0x4d')](_[_0x4122('0x55')](_0x13fad9[_0x4122('0x4b')],_0x1eed2e[_0x4122('0x4d')]));if(_0x13fad9[_0x4122('0x4b')][_0x4122('0x56')]){_0x58fe14[_0x4122('0x57')]=_['merge'](_0x58fe14[_0x4122('0x57')],{'$or':_[_0x4122('0x4a')](_0x58fe14['attributes'],function(_0x1688eb){var _0x2d6c25={};_0x2d6c25[_0x1688eb]={'$like':'%'+_0x13fad9[_0x4122('0x4b')][_0x4122('0x56')]+'%'};return _0x2d6c25;})});}_0x58fe14=_[_0x4122('0x58')]({},_0x58fe14,_0x13fad9['options']);return _0x29b38e[_0x4122('0x134')](_0x58fe14);}})[_0x4122('0x15')](function(_0x2f8e72){if(_0x2f8e72){_0x33225f=_0x2f8e72[_0x4122('0x51')];if(!_0x13fad9[_0x4122('0x4b')][_0x4122('0x52')](_0x4122('0x72'))){_0x58fe14['limit']=qs[_0x4122('0x24')](_0x13fad9[_0x4122('0x4b')][_0x4122('0x24')]);_0x58fe14[_0x4122('0x23')]=qs[_0x4122('0x23')](_0x13fad9[_0x4122('0x4b')][_0x4122('0x23')]);}return _0x29b38e[_0x4122('0x134')](_0x58fe14);}})['then'](function(_0x30e0b0){if(_0x30e0b0){return _0x30e0b0?{'count':_0x33225f,'rows':_0x30e0b0}:null;}})[_0x4122('0x15')](respondWithResult(_0x1d666e,null))['catch'](handleError(_0x1d666e,null));}; \ No newline at end of file +var _0xe010=['bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','SendMail','sendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','MailAccountId','subjectOffline','toPairsIn','email','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','internal','Tags','color','tag','getSnippet','virtual','License','chatLicenseExceeded','ifTime','server/files/chat/iframe.ejs','URL','address','origin','3.8.1','remote','x-real-ip','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','transaction','sequelize','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','onlineForm','items','fromKey','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','url','../../config/logger','api','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','update','then','destroy','ChatWebsites','stack','name','send','user-agent-parser','setUA','getResult','customerIp','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','unknown','format','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','show','params','Pause','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','includes','List','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','timezone','list','priority','asc','account','contact','headers','threadId','ChatInteraction','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','applications','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','files','Sequelize','no\x20available\x20attributes','difference','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','Attachment'];(function(_0x4e4984,_0x10d93e){var _0x1a807e=function(_0x4381cc){while(--_0x4381cc){_0x4e4984['push'](_0x4e4984['shift']());}};_0x1a807e(++_0x10d93e);}(_0xe010,0x17e));var _0x0e01=function(_0x3bd928,_0x441fec){_0x3bd928=_0x3bd928-0x0;var _0x4cc090=_0xe010[_0x3bd928];return _0x4cc090;};'use strict';var Mustache=require(_0x0e01('0x0'));var util=require('util');var path=require(_0x0e01('0x1'));var ejs=require(_0x0e01('0x2'));var fs=require('fs');var fs_extra=require(_0x0e01('0x3'));var _=require(_0x0e01('0x4'));var querystring=require(_0x0e01('0x5'));var htmlToText=require(_0x0e01('0x6'));var Redis=require(_0x0e01('0x7'));var jayson=require(_0x0e01('0x8'));var url=require(_0x0e01('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0x0e01('0xa'))(_0x0e01('0xb'));var config=require('../../config/environment');var APIBadRequestError=require(_0x0e01('0xc'))[_0x0e01('0xd')];var APINotFoundError=require('../../errors/api')[_0x0e01('0xe')];var APIOutOfIntervalError=require(_0x0e01('0xc'))[_0x0e01('0xf')];var APIHandleError=require('../../errors/api')[_0x0e01('0x10')];var APIConflictError=require(_0x0e01('0xc'))['APIConflictError'];var db=require(_0x0e01('0x11'))['db'];config[_0x0e01('0x12')]=_['defaults'](config['redis'],{'host':_0x0e01('0x13'),'port':0x18eb});var socket=require(_0x0e01('0x14'))(new Redis(config[_0x0e01('0x12')]));require(_0x0e01('0x15'))[_0x0e01('0x16')](socket);var client=jayson[_0x0e01('0x17')][_0x0e01('0x18')]({'port':0x232c});var client9002=jayson[_0x0e01('0x17')][_0x0e01('0x18')]({'port':0x232a});var client9003=jayson[_0x0e01('0x17')][_0x0e01('0x18')]({'port':0x232b});var client9001=jayson[_0x0e01('0x17')][_0x0e01('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x230fbe,_0x147262,_0x440452,_0x286870){return new Promise(function(_0x51d333,_0xc9b6ad){var _0x553df6=_0x286870||client;return _0x553df6[_0x0e01('0x19')](_0x230fbe,_0x440452)['then'](function(_0x50fa55){logger[_0x0e01('0x1a')](_0x0e01('0x1b'),_0x147262,'request\x20sent');logger[_0x0e01('0x1c')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x147262,'request\x20sent',JSON[_0x0e01('0x1d')](_0x50fa55));if(_0x50fa55[_0x0e01('0x1e')]){if(_0x50fa55[_0x0e01('0x1e')]['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x147262,_0x50fa55[_0x0e01('0x1e')]['message']);return _0xc9b6ad(_0x50fa55['error'][_0x0e01('0x1f')]);}logger[_0x0e01('0x1e')](_0x0e01('0x1b'),_0x147262,_0x50fa55[_0x0e01('0x1e')]['message']);return _0x51d333(_0x50fa55[_0x0e01('0x1e')][_0x0e01('0x1f')]);}else{logger[_0x0e01('0x1a')](_0x0e01('0x1b'),_0x147262,_0x0e01('0x20'));_0x51d333(_0x50fa55[_0x0e01('0x21')][_0x0e01('0x1f')]);}})[_0x0e01('0x22')](function(_0x3e7d79){logger[_0x0e01('0x1e')](_0x0e01('0x1b'),_0x147262,_0x3e7d79);_0xc9b6ad(_0x3e7d79);});});}function respondWithStatusCode(_0x36e44e,_0x202dae){_0x202dae=_0x202dae||0xcc;return function(_0x17520a){if(_0x17520a){return _0x36e44e[_0x0e01('0x23')](_0x202dae);}return _0x36e44e['status'](_0x202dae)[_0x0e01('0x24')]();};}function respondWithResult(_0x10a318,_0x34a9b1){_0x34a9b1=_0x34a9b1||0xc8;return function(_0x58edb4){if(_0x58edb4){return _0x10a318['status'](_0x34a9b1)[_0x0e01('0x25')](_0x58edb4);}};}function respondWithFilteredResult(_0x850d92,_0x3f9a2a){return function(_0x4c2c83){if(_0x4c2c83){var _0x58ba68=typeof _0x3f9a2a['offset']===_0x0e01('0x26')&&typeof _0x3f9a2a[_0x0e01('0x27')]===_0x0e01('0x26');var _0xae2ef1=_0x4c2c83[_0x0e01('0x28')];var _0x42a7c7=_0x58ba68?0x0:_0x3f9a2a['offset'];var _0x4c8779=_0x58ba68?_0x4c2c83[_0x0e01('0x28')]:_0x3f9a2a[_0x0e01('0x29')]+_0x3f9a2a['limit'];var _0x312991;if(_0x4c8779>=_0xae2ef1){_0x4c8779=_0xae2ef1;_0x312991=0xc8;}else{_0x312991=0xce;}_0x850d92[_0x0e01('0x2a')](_0x312991);return _0x850d92[_0x0e01('0x2b')](_0x0e01('0x2c'),_0x42a7c7+'-'+_0x4c8779+'/'+_0xae2ef1)[_0x0e01('0x25')](_0x4c2c83);}return null;};}function saveUpdates(_0x12e501){return function(_0x14e144){if(_0x14e144){return _0x14e144[_0x0e01('0x2d')](_0x12e501)[_0x0e01('0x2e')](function(_0x4bb437){return _0x4bb437;});}return null;};}function removeEntity(_0x4e5378){return function(_0x19e563){if(_0x19e563){return _0x19e563[_0x0e01('0x2f')]()['then'](function(){var _0x38b4b3=_0x19e563['get']({'plain':!![]});var _0x5ab4ae=_0x0e01('0x30');return db['UserProfileResource'][_0x0e01('0x2f')]({'where':{'type':_0x5ab4ae,'resourceId':_0x38b4b3['id']}})[_0x0e01('0x2e')](function(){return _0x19e563;});})['then'](function(){_0x4e5378['status'](0xcc)[_0x0e01('0x24')]();});}};}function handleEntityNotFound(_0x57999e){return function(_0x40187c){if(!_0x40187c){_0x57999e[_0x0e01('0x23')](0x194);}return _0x40187c;};}function handleError(_0x9940d6,_0x50fc43){_0x50fc43=_0x50fc43||0x1f4;return function(_0x373f3a){logger[_0x0e01('0x1e')](_0x373f3a[_0x0e01('0x31')]);if(_0x373f3a[_0x0e01('0x32')]){delete _0x373f3a[_0x0e01('0x32')];}_0x9940d6['status'](_0x50fc43)[_0x0e01('0x33')](_0x373f3a);};}function createInteractionObject(_0x51a8a6,_0x57e59e,_0x345e0a,_0x4dbe21){var _0x486d7c=require(_0x0e01('0x34'));var _0x3b8ffc=new _0x486d7c();var _0x26cced=_0x3b8ffc[_0x0e01('0x35')](_0x345e0a['user-agent'])[_0x0e01('0x36')]();var _0x318ccf=_0x57e59e[_0x0e01('0x37')];if(_0x345e0a['cf-connecting-ip']){_0x318ccf=_0x345e0a['cf-connecting-ip'];}else if(_0x345e0a[_0x0e01('0x38')]){_0x318ccf=_['first'](_0x345e0a[_0x0e01('0x38')][_0x0e01('0x39')](','));}return{'ContactId':_0x4dbe21['id'],'ChatWebsiteId':_0x51a8a6,'from':(_0x4dbe21[_0x0e01('0x3a')]||'')+'\x20'+(_0x4dbe21[_0x0e01('0x3b')]||''),'customerIp':_0x318ccf,'customerPort':_0x345e0a[_0x0e01('0x3c')]?_0x345e0a['x-real-port']:null,'referer':_0x57e59e[_0x0e01('0x3d')],'browserName':_0x26cced[_0x0e01('0x3e')][_0x0e01('0x32')]&&_0x26cced[_0x0e01('0x3e')]['version']?util['format']('%s\x20%s',_0x26cced[_0x0e01('0x3e')][_0x0e01('0x32')],_0x26cced['browser'][_0x0e01('0x3f')]):_0x0e01('0x40'),'browserVersion':_0x26cced[_0x0e01('0x3e')][_0x0e01('0x3f')]||_0x0e01('0x40'),'osName':util[_0x0e01('0x41')](_0x0e01('0x42'),_0x26cced['os'][_0x0e01('0x32')],_0x26cced['os'][_0x0e01('0x3f')]),'osVersion':_0x26cced['os'][_0x0e01('0x3f')],'deviceModel':_0x26cced[_0x0e01('0x43')][_0x0e01('0x44')]&&_0x26cced[_0x0e01('0x43')][_0x0e01('0x45')]?util[_0x0e01('0x41')](_0x0e01('0x46'),_0x26cced[_0x0e01('0x43')][_0x0e01('0x44')],_0x26cced['device']['vendor'],_0x26cced[_0x0e01('0x43')]['type']):null,'deviceVendor':_0x26cced[_0x0e01('0x43')][_0x0e01('0x45')],'deviceType':_0x26cced['device']['type'],'formData':JSON[_0x0e01('0x1d')](_0x57e59e)};}exports[_0x0e01('0x47')]=function(_0x21691b,_0xe85206){var _0x3ab9c2={'include':[{'model':db['Pause'],'as':_0x0e01('0x48')}]},_0x2d47ee={},_0x4c81b3={'count':0x0,'rows':[]};var _0x3626ea=_[_0x0e01('0x49')](db[_0x0e01('0x4a')][_0x0e01('0x4b')],function(_0x479f5b){return{'name':_0x479f5b[_0x0e01('0x4c')],'type':_0x479f5b[_0x0e01('0x4d')][_0x0e01('0x4e')]};});_0x2d47ee[_0x0e01('0x44')]=_[_0x0e01('0x49')](_0x3626ea,_0x0e01('0x32'));_0x2d47ee[_0x0e01('0x4f')]=_[_0x0e01('0x50')](_0x21691b['query']);_0x2d47ee[_0x0e01('0x51')]=_[_0x0e01('0x52')](_0x2d47ee[_0x0e01('0x44')],_0x2d47ee[_0x0e01('0x4f')]);_0x3ab9c2[_0x0e01('0x53')]=_[_0x0e01('0x52')](_0x2d47ee['model'],qs[_0x0e01('0x54')](_0x21691b['query'][_0x0e01('0x54')]));_0x3ab9c2[_0x0e01('0x53')]=_0x3ab9c2['attributes'][_0x0e01('0x55')]?_0x3ab9c2[_0x0e01('0x53')]:_0x2d47ee['model'];if(!_0x21691b[_0x0e01('0x4f')][_0x0e01('0x56')](_0x0e01('0x57'))){_0x3ab9c2['limit']=qs[_0x0e01('0x27')](_0x21691b[_0x0e01('0x4f')][_0x0e01('0x27')]);_0x3ab9c2[_0x0e01('0x29')]=qs[_0x0e01('0x29')](_0x21691b[_0x0e01('0x4f')][_0x0e01('0x29')]);}_0x3ab9c2[_0x0e01('0x58')]=qs[_0x0e01('0x59')](_0x21691b[_0x0e01('0x4f')][_0x0e01('0x59')]);_0x3ab9c2[_0x0e01('0x5a')]=qs['filters'](_[_0x0e01('0x5b')](_0x21691b[_0x0e01('0x4f')],_0x2d47ee['filters']),_0x3626ea);if(_0x21691b['query']['filter']){_0x3ab9c2[_0x0e01('0x5a')]=_[_0x0e01('0x5c')](_0x3ab9c2[_0x0e01('0x5a')],{'$or':_[_0x0e01('0x49')](_0x3626ea,function(_0x5bf1ec){if(_0x5bf1ec['type']!==_0x0e01('0x5d')){var _0x2cb385={};_0x2cb385[_0x5bf1ec[_0x0e01('0x32')]]={'$like':'%'+_0x21691b[_0x0e01('0x4f')][_0x0e01('0x5e')]+'%'};return _0x2cb385;}})});}_0x3ab9c2=_[_0x0e01('0x5c')]({},_0x3ab9c2,_0x21691b['options']);var _0x273927={'where':_0x3ab9c2[_0x0e01('0x5a')]};return db[_0x0e01('0x4a')]['count'](_0x273927)[_0x0e01('0x2e')](function(_0x559377){_0x4c81b3[_0x0e01('0x28')]=_0x559377;if(_0x21691b['query'][_0x0e01('0x5f')]){_0x3ab9c2['include']=[{'all':!![]}];}return db[_0x0e01('0x4a')][_0x0e01('0x60')](_0x3ab9c2);})[_0x0e01('0x2e')](function(_0x36ef94){_0x4c81b3[_0x0e01('0x61')]=_0x36ef94;return _0x4c81b3;})['then'](respondWithFilteredResult(_0xe85206,_0x3ab9c2))['catch'](handleError(_0xe85206,null));};exports[_0x0e01('0x62')]=function(_0x5338b1,_0x94d3d1){var _0x4672ec={'raw':![],'where':{'id':_0x5338b1[_0x0e01('0x63')]['id']},'include':[{'model':db[_0x0e01('0x64')],'as':_0x0e01('0x48')}]},_0x19bda3={};_0x19bda3['model']=_[_0x0e01('0x50')](db['ChatWebsite'][_0x0e01('0x4b')]);_0x19bda3[_0x0e01('0x4f')]=_[_0x0e01('0x50')](_0x5338b1[_0x0e01('0x4f')]);_0x19bda3[_0x0e01('0x51')]=_['intersection'](_0x19bda3[_0x0e01('0x44')],_0x19bda3[_0x0e01('0x4f')]);_0x4672ec[_0x0e01('0x53')]=_['intersection'](_0x19bda3[_0x0e01('0x44')],qs[_0x0e01('0x54')](_0x5338b1[_0x0e01('0x4f')][_0x0e01('0x54')]));_0x4672ec[_0x0e01('0x53')]=_0x4672ec[_0x0e01('0x53')][_0x0e01('0x55')]?_0x4672ec[_0x0e01('0x53')]:_0x19bda3[_0x0e01('0x44')];if(_0x5338b1[_0x0e01('0x4f')][_0x0e01('0x5f')]){_0x4672ec[_0x0e01('0x65')]=[{'all':!![]}];}_0x4672ec=_['merge']({},_0x4672ec,_0x5338b1[_0x0e01('0x66')]);return db[_0x0e01('0x4a')][_0x0e01('0x67')](_0x4672ec)[_0x0e01('0x2e')](handleEntityNotFound(_0x94d3d1,null))[_0x0e01('0x2e')](respondWithResult(_0x94d3d1,null))[_0x0e01('0x22')](handleError(_0x94d3d1,null));};exports[_0x0e01('0x68')]=function(_0x56e062,_0x58c63c){return db[_0x0e01('0x4a')][_0x0e01('0x68')](_0x56e062[_0x0e01('0x69')],{})['then'](function(_0x3fe595){var _0x4a7f15=_0x56e062[_0x0e01('0x6a')][_0x0e01('0x6b')]({'plain':!![]});if(!_0x4a7f15)throw new Error(_0x0e01('0x6c'));if(_0x4a7f15[_0x0e01('0x6d')]===_0x0e01('0x6a')){var _0x2d7419=_0x3fe595[_0x0e01('0x6b')]({'plain':!![]});var _0x1201ab=_0x0e01('0x30');return db[_0x0e01('0x6e')][_0x0e01('0x67')]({'where':{'name':_0x1201ab,'userProfileId':_0x4a7f15[_0x0e01('0x6f')]},'raw':!![]})[_0x0e01('0x2e')](function(_0x5df421){if(_0x5df421&&_0x5df421[_0x0e01('0x70')]===0x0){return db['UserProfileResource'][_0x0e01('0x68')]({'name':_0x2d7419['name'],'resourceId':_0x2d7419['id'],'type':_0x5df421[_0x0e01('0x32')],'sectionId':_0x5df421['id']},{})['then'](function(){return _0x3fe595;});}else{return _0x3fe595;}})[_0x0e01('0x22')](function(_0x34ac10){logger[_0x0e01('0x1e')](_0x0e01('0x71'),_0x34ac10);throw _0x34ac10;});}return _0x3fe595;})[_0x0e01('0x2e')](respondWithResult(_0x58c63c,0xc9))['catch'](handleError(_0x58c63c,null));};exports[_0x0e01('0x2d')]=function(_0x25c567,_0xe5f731){if(_0x25c567[_0x0e01('0x69')]['id']){delete _0x25c567[_0x0e01('0x69')]['id'];}return db[_0x0e01('0x4a')][_0x0e01('0x67')]({'where':{'id':_0x25c567[_0x0e01('0x63')]['id']},'include':[{'model':db[_0x0e01('0x64')],'as':_0x0e01('0x48')}]})['then'](handleEntityNotFound(_0xe5f731,null))['then'](saveUpdates(_0x25c567['body'],null))[_0x0e01('0x2e')](respondWithResult(_0xe5f731,null))['catch'](handleError(_0xe5f731,null));};exports['destroy']=function(_0x438b41,_0x5cbd2f){return db['ChatWebsite'][_0x0e01('0x67')]({'where':{'id':_0x438b41['params']['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x5cbd2f,null))['then'](removeEntity(_0x5cbd2f,null))[_0x0e01('0x22')](handleError(_0x5cbd2f,null));};exports[_0x0e01('0x72')]=function(_0x385b6e,_0x1e6d14){return db[_0x0e01('0x4a')][_0x0e01('0x72')]()[_0x0e01('0x2e')](respondWithResult(_0x1e6d14,null))['catch'](handleError(_0x1e6d14,null));};exports[_0x0e01('0x73')]=function(_0x231a85,_0x1cae16){if(_0x231a85[_0x0e01('0x69')]['id']){delete _0x231a85[_0x0e01('0x69')]['id'];}return db[_0x0e01('0x4a')][_0x0e01('0x67')]({'where':{'id':_0x231a85[_0x0e01('0x63')]['id']}})['then'](handleEntityNotFound(_0x1cae16,null))['then'](function(_0x46b488){if(_0x46b488){_0x231a85['body'][_0x0e01('0x74')]=_0x46b488['id'];return db[_0x0e01('0x75')][_0x0e01('0x68')](_0x231a85['body']);}})['then'](respondWithResult(_0x1cae16,null))[_0x0e01('0x22')](handleError(_0x1cae16,null));};exports[_0x0e01('0x76')]=function(_0xf0ebe7,_0x292237){var _0x1d5c5c={'raw':![],'where':{}};var _0x533d8e={};var _0x59d331={'count':0x0,'rows':[]};return db[_0x0e01('0x4a')][_0x0e01('0x77')]({'where':{'id':_0xf0ebe7[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x292237,null))['then'](function(_0x5b28c3){if(_0x5b28c3){_0x533d8e[_0x0e01('0x44')]=_['keys'](db['Disposition'][_0x0e01('0x4b')]);_0x533d8e[_0x0e01('0x4f')]=_[_0x0e01('0x50')](_0xf0ebe7[_0x0e01('0x4f')]);_0x533d8e[_0x0e01('0x51')]=_[_0x0e01('0x52')](_0x533d8e[_0x0e01('0x44')],_0x533d8e[_0x0e01('0x4f')]);_0x1d5c5c['attributes']=_[_0x0e01('0x52')](_0x533d8e[_0x0e01('0x44')],qs[_0x0e01('0x54')](_0xf0ebe7[_0x0e01('0x4f')][_0x0e01('0x54')]));_0x1d5c5c[_0x0e01('0x53')]=_0x1d5c5c[_0x0e01('0x53')][_0x0e01('0x55')]?_0x1d5c5c[_0x0e01('0x53')]:_0x533d8e[_0x0e01('0x44')];if(!_0xf0ebe7[_0x0e01('0x4f')][_0x0e01('0x56')]('nolimit')){_0x1d5c5c[_0x0e01('0x27')]=qs[_0x0e01('0x27')](_0xf0ebe7['query'][_0x0e01('0x27')]);_0x1d5c5c[_0x0e01('0x29')]=qs['offset'](_0xf0ebe7[_0x0e01('0x4f')][_0x0e01('0x29')]);}_0x1d5c5c[_0x0e01('0x58')]=qs['sort'](_0xf0ebe7[_0x0e01('0x4f')][_0x0e01('0x59')]);_0x1d5c5c[_0x0e01('0x5a')]=qs[_0x0e01('0x51')](_['pick'](_0xf0ebe7['query'],_0x533d8e[_0x0e01('0x51')]));_0x1d5c5c['where']['ChatWebsiteId']=_0x5b28c3['id'];if(_0xf0ebe7[_0x0e01('0x4f')]['filter']){_0x1d5c5c[_0x0e01('0x5a')]=_[_0x0e01('0x5c')](_0x1d5c5c[_0x0e01('0x5a')],{'$or':_['map'](_0x1d5c5c['attributes'],function(_0x2718a0){var _0xb587d9={};_0xb587d9[_0x2718a0]={'$like':'%'+_0xf0ebe7[_0x0e01('0x4f')]['filter']+'%'};return _0xb587d9;})});}_0x1d5c5c=_[_0x0e01('0x5c')]({},_0x1d5c5c,_0xf0ebe7['options']);return db['Disposition'][_0x0e01('0x28')]({'where':_0x1d5c5c[_0x0e01('0x5a')]})[_0x0e01('0x2e')](function(_0x3e3fda){_0x59d331[_0x0e01('0x28')]=_0x3e3fda;if(_0xf0ebe7['query'][_0x0e01('0x5f')]){_0x1d5c5c[_0x0e01('0x65')]=[{'all':!![]}];}return db[_0x0e01('0x75')][_0x0e01('0x60')](_0x1d5c5c);})[_0x0e01('0x2e')](function(_0x533e0a){_0x59d331[_0x0e01('0x61')]=_0x533e0a;return _0x59d331;});}})[_0x0e01('0x2e')](respondWithFilteredResult(_0x292237,_0x1d5c5c))[_0x0e01('0x22')](handleError(_0x292237,null));};exports[_0x0e01('0x78')]=function(_0x3f2709,_0x5dfd31){return db['ChatWebsite'][_0x0e01('0x67')]({'where':{'id':_0x3f2709[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x5dfd31,null))[_0x0e01('0x2e')](function(_0x22797a){if(_0x22797a){return _0x22797a[_0x0e01('0x78')](_0x3f2709['query']['ids']);}})['then'](respondWithStatusCode(_0x5dfd31,null))[_0x0e01('0x22')](handleError(_0x5dfd31,null));};exports[_0x0e01('0x79')]=function(_0x4a3008,_0x3a3755){if(_0x4a3008[_0x0e01('0x69')]['id']){delete _0x4a3008[_0x0e01('0x69')]['id'];}return db[_0x0e01('0x4a')][_0x0e01('0x67')]({'where':{'id':_0x4a3008[_0x0e01('0x63')]['id']}})['then'](handleEntityNotFound(_0x3a3755,null))[_0x0e01('0x2e')](function(_0x283f9a){if(_0x283f9a){_0x4a3008[_0x0e01('0x69')]['ChatWebsiteId']=_0x283f9a['id'];return db[_0x0e01('0x7a')][_0x0e01('0x68')](_0x4a3008[_0x0e01('0x69')]);}})[_0x0e01('0x2e')](respondWithResult(_0x3a3755,null))['catch'](handleError(_0x3a3755,null));};exports[_0x0e01('0x7b')]=function(_0x500e51,_0x5b52cc){var _0x3e3ee9={'raw':![],'where':{}};var _0x2ef18f={};var _0x57df16={'count':0x0,'rows':[]};return db[_0x0e01('0x4a')][_0x0e01('0x77')]({'where':{'id':_0x500e51[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x5b52cc,null))['then'](function(_0x23bddc){if(_0x23bddc){_0x2ef18f['model']=_[_0x0e01('0x50')](db['CannedAnswer'][_0x0e01('0x4b')]);_0x2ef18f['query']=_['keys'](_0x500e51[_0x0e01('0x4f')]);_0x2ef18f[_0x0e01('0x51')]=_['intersection'](_0x2ef18f[_0x0e01('0x44')],_0x2ef18f[_0x0e01('0x4f')]);_0x3e3ee9[_0x0e01('0x53')]=_['intersection'](_0x2ef18f[_0x0e01('0x44')],qs['fields'](_0x500e51[_0x0e01('0x4f')][_0x0e01('0x54')]));_0x3e3ee9[_0x0e01('0x53')]=_0x3e3ee9[_0x0e01('0x53')][_0x0e01('0x55')]?_0x3e3ee9[_0x0e01('0x53')]:_0x2ef18f[_0x0e01('0x44')];if(!_0x500e51[_0x0e01('0x4f')][_0x0e01('0x56')](_0x0e01('0x57'))){_0x3e3ee9[_0x0e01('0x27')]=qs[_0x0e01('0x27')](_0x500e51[_0x0e01('0x4f')][_0x0e01('0x27')]);_0x3e3ee9[_0x0e01('0x29')]=qs[_0x0e01('0x29')](_0x500e51['query'][_0x0e01('0x29')]);}_0x3e3ee9[_0x0e01('0x58')]=qs[_0x0e01('0x59')](_0x500e51[_0x0e01('0x4f')][_0x0e01('0x59')]);_0x3e3ee9[_0x0e01('0x5a')]=qs[_0x0e01('0x51')](_['pick'](_0x500e51[_0x0e01('0x4f')],_0x2ef18f['filters']));_0x3e3ee9[_0x0e01('0x5a')][_0x0e01('0x74')]=_0x23bddc['id'];if(_0x500e51[_0x0e01('0x4f')]['filter']){_0x3e3ee9['where']=_[_0x0e01('0x5c')](_0x3e3ee9[_0x0e01('0x5a')],{'$or':_[_0x0e01('0x49')](_0x3e3ee9[_0x0e01('0x53')],function(_0x33c11a){var _0x35a5c2={};_0x35a5c2[_0x33c11a]={'$like':'%'+_0x500e51[_0x0e01('0x4f')]['filter']+'%'};return _0x35a5c2;})});}_0x3e3ee9=_[_0x0e01('0x5c')]({},_0x3e3ee9,_0x500e51[_0x0e01('0x66')]);return db[_0x0e01('0x7a')][_0x0e01('0x28')]({'where':_0x3e3ee9[_0x0e01('0x5a')]})['then'](function(_0x595206){_0x57df16['count']=_0x595206;if(_0x500e51[_0x0e01('0x4f')][_0x0e01('0x5f')]){_0x3e3ee9[_0x0e01('0x65')]=[{'all':!![]}];}return db[_0x0e01('0x7a')][_0x0e01('0x60')](_0x3e3ee9);})[_0x0e01('0x2e')](function(_0x371d71){_0x57df16[_0x0e01('0x61')]=_0x371d71;return _0x57df16;});}})[_0x0e01('0x2e')](respondWithFilteredResult(_0x5b52cc,_0x3e3ee9))[_0x0e01('0x22')](handleError(_0x5b52cc,null));};exports['removeAnswers']=function(_0x4d2626,_0x355f0c){return db[_0x0e01('0x4a')]['find']({'where':{'id':_0x4d2626[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x355f0c,null))['then'](function(_0x5da911){if(_0x5da911){return _0x5da911[_0x0e01('0x7c')](_0x4d2626[_0x0e01('0x4f')][_0x0e01('0x7d')]);}})[_0x0e01('0x2e')](respondWithStatusCode(_0x355f0c,null))[_0x0e01('0x22')](handleError(_0x355f0c,null));};exports[_0x0e01('0x7e')]=function(_0x5ab31c,_0x22c43e){_0x5ab31c['body'][_0x0e01('0x7f')]=_0x5ab31c[_0x0e01('0x80')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x5ab31c[_0x0e01('0x63')]['id']}})['then'](handleEntityNotFound(_0x22c43e,null))['then'](saveUpdates(_0x5ab31c[_0x0e01('0x69')],null))['then'](respondWithResult(_0x22c43e,null))[_0x0e01('0x22')](handleError(_0x22c43e,null));};exports[_0x0e01('0x81')]=function(_0x4702a0,_0x1db996){_0x4702a0['body'][_0x0e01('0x82')]=_0x4702a0[_0x0e01('0x80')][_0x0e01('0x83')];return db['ChatWebsite'][_0x0e01('0x67')]({'where':{'id':_0x4702a0[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x1db996,null))[_0x0e01('0x2e')](saveUpdates(_0x4702a0[_0x0e01('0x69')],null))[_0x0e01('0x2e')](respondWithResult(_0x1db996,null))[_0x0e01('0x22')](handleError(_0x1db996,null));};exports[_0x0e01('0x84')]=function(_0x159329,_0x3a1493){_0x159329[_0x0e01('0x69')][_0x0e01('0x85')]=_0x159329[_0x0e01('0x80')][_0x0e01('0x83')];return db[_0x0e01('0x4a')][_0x0e01('0x67')]({'where':{'id':_0x159329['params']['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x3a1493,null))[_0x0e01('0x2e')](saveUpdates(_0x159329[_0x0e01('0x69')],null))[_0x0e01('0x2e')](respondWithResult(_0x3a1493,null))[_0x0e01('0x22')](handleError(_0x3a1493,null));};exports[_0x0e01('0x86')]=function(_0x30911d,_0x1d64bf){_0x30911d[_0x0e01('0x69')][_0x0e01('0x87')]=_0x30911d['file'][_0x0e01('0x83')];return db[_0x0e01('0x4a')][_0x0e01('0x67')]({'where':{'id':_0x30911d[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x1d64bf,null))['then'](saveUpdates(_0x30911d['body'],null))[_0x0e01('0x2e')](respondWithResult(_0x1d64bf,null))[_0x0e01('0x22')](handleError(_0x1d64bf,null));};exports[_0x0e01('0x88')]=function(_0x2872fa,_0x511769){var _0x1513b9=path['join'](config[_0x0e01('0x89')],_0x0e01('0x8a'));var _0x300a22={'where':{'id':_0x2872fa[_0x0e01('0x63')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x300717=![];return require(_0x0e01('0x8b'))[_0x0e01('0x8c')]()[_0x0e01('0x2e')](function(_0x231da0){if(_0x231da0){_0x300717=_0x231da0[_0x0e01('0x8d')];}})['then'](function(){return db[_0x0e01('0x4a')]['find'](_0x300a22);})[_0x0e01('0x2e')](handleEntityNotFound(_0x511769,null))[_0x0e01('0x2e')](function(_0x11ec22){if(_0x11ec22){if(!_[_0x0e01('0x8e')](_0x11ec22['sitepic'])){if(fs[_0x0e01('0x8f')](path[_0x0e01('0x90')](config['root'],_0x0e01('0x91'),_0x11ec22[_0x0e01('0x7f')]))&&_0x300717){_0x1513b9=path[_0x0e01('0x90')](config[_0x0e01('0x89')],_0x0e01('0x91'),_0x11ec22[_0x0e01('0x7f')]);}}return _0x511769[_0x0e01('0x92')](_0x1513b9);}})[_0x0e01('0x22')](handleError(_0x511769,null));};exports[_0x0e01('0x93')]=function(_0x517c53,_0x3b5fef){var _0x4ca1bd=path[_0x0e01('0x90')](config[_0x0e01('0x89')],_0x0e01('0x94'));var _0x59c53d={'where':{'id':_0x517c53[_0x0e01('0x63')]['id']},'attributes':['id',_0x0e01('0x82')],'raw':!![]};return db[_0x0e01('0x4a')][_0x0e01('0x67')](_0x59c53d)[_0x0e01('0x2e')](handleEntityNotFound(_0x3b5fef,null))[_0x0e01('0x2e')](function(_0x15b433){if(_0x15b433){if(!_[_0x0e01('0x8e')](_0x15b433[_0x0e01('0x82')])){if(fs[_0x0e01('0x8f')](path[_0x0e01('0x90')](config[_0x0e01('0x89')],_0x0e01('0x95'),_0x15b433[_0x0e01('0x82')]))){_0x4ca1bd=path[_0x0e01('0x90')](config[_0x0e01('0x89')],_0x0e01('0x95'),_0x15b433['agentAvatar']);}}return _0x3b5fef[_0x0e01('0x92')](_0x4ca1bd);}})[_0x0e01('0x22')](handleError(_0x3b5fef,null));};exports[_0x0e01('0x96')]=function(_0x388c90,_0x53ac47){var _0x4b55ea=path['join'](config[_0x0e01('0x89')],_0x0e01('0x97'));var _0x532cef={'where':{'id':_0x388c90[_0x0e01('0x63')]['id']},'attributes':['id',_0x0e01('0x85'),_0x0e01('0x98')],'raw':!![]};return db['ChatWebsite'][_0x0e01('0x67')](_0x532cef)[_0x0e01('0x2e')](handleEntityNotFound(_0x53ac47,null))[_0x0e01('0x2e')](function(_0x63d11){if(_0x63d11){if(!_[_0x0e01('0x8e')](_0x63d11['customerAvatar'])){if(fs[_0x0e01('0x8f')](path[_0x0e01('0x90')](config[_0x0e01('0x89')],_0x0e01('0x95'),_0x63d11[_0x0e01('0x85')]))&&_0x63d11[_0x0e01('0x98')]){_0x4b55ea=path[_0x0e01('0x90')](config[_0x0e01('0x89')],'server/files/images/avatars/',_0x63d11['customerAvatar']);}}return _0x53ac47[_0x0e01('0x92')](_0x4b55ea);}})[_0x0e01('0x22')](handleError(_0x53ac47,null));};exports['getSystemAvatar']=function(_0xce57ae,_0x3e728c){var _0x8c0725=path['join'](config[_0x0e01('0x89')],_0x0e01('0x99'));var _0x5befc7={'where':{'id':_0xce57ae['params']['id']},'attributes':['id',_0x0e01('0x87')],'raw':!![]};return db['ChatWebsite']['find'](_0x5befc7)['then'](handleEntityNotFound(_0x3e728c,null))[_0x0e01('0x2e')](function(_0xf5c0db){if(_0xf5c0db){if(!_['isNil'](_0xf5c0db['systemAvatar'])){if(fs[_0x0e01('0x8f')](path[_0x0e01('0x90')](config['root'],'server/files/images/avatars/',_0xf5c0db[_0x0e01('0x87')]))){_0x8c0725=path[_0x0e01('0x90')](config[_0x0e01('0x89')],'server/files/images/avatars/',_0xf5c0db['systemAvatar']);}}return _0x3e728c[_0x0e01('0x92')](_0x8c0725);}})[_0x0e01('0x22')](handleError(_0x3e728c,null));};exports[_0x0e01('0x9a')]=function(_0x1542ec,_0x2f1f68){var _0x1c8b75={'body':_0x1542ec[_0x0e01('0x69')],'channel':'chat'};var _0x2f159c=[];var _0x2b78a8=[];var _0x3a0e58={};var _0x3bce1c=![];if(_0x1542ec[_0x0e01('0x69')]['id']){delete _0x1542ec[_0x0e01('0x69')]['id'];}if(_[_0x0e01('0x8e')](_0x1542ec['body'][_0x0e01('0x9b')])){throw new APIBadRequestError(_0x0e01('0x9c'));}if(_['isNil'](_0x1542ec[_0x0e01('0x69')][_0x0e01('0x9d')])){throw new APIBadRequestError(_0x0e01('0x9e'));}if(_[_0x0e01('0x9f')](_0x1542ec['body'][_0x0e01('0x69')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}return db[_0x0e01('0xa0')][_0x0e01('0x72')]()['then'](function(_0x537f8e){if(!_0x537f8e){throw new Error(_0x0e01('0xa1'));}_0x2f159c=Object[_0x0e01('0x50')](_0x537f8e)[_0x0e01('0x5e')](function(_0x157755){return![_0x0e01('0xa2'),'updatedAt']['includes'](_0x157755);});_0x2b78a8=Object['keys'](_0x537f8e)[_0x0e01('0x5e')](function(_0x540747){return![_0x0e01('0xa2'),_0x0e01('0xa3'),_0x0e01('0xa4'),_0x0e01('0xa5')][_0x0e01('0xa6')](_0x540747);});if(!_[_0x0e01('0xa6')](_0x2b78a8,_0x1542ec[_0x0e01('0x69')][_0x0e01('0x9d')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x2b78a8[_0x0e01('0x90')](',\x20'));}_0x3a0e58[_0x1542ec[_0x0e01('0x69')][_0x0e01('0x9d')]]=_0x1542ec['body'][_0x0e01('0x9b')];})[_0x0e01('0x2e')](function(){return db['ChatWebsite'][_0x0e01('0x67')]({'where':{'id':_0x1542ec[_0x0e01('0x63')]['id']},'include':[{'model':db['CmList'],'as':_0x0e01('0xa7'),'include':[{'model':db[_0x0e01('0xa0')],'as':_0x0e01('0xa8'),'where':_0x3a0e58,'limit':0x1,'order':[['updatedAt',_0x0e01('0xa9')]]}]},{'model':db[_0x0e01('0xaa')],'as':_0x0e01('0xab')},{'model':db[_0x0e01('0xac')],'as':_0x0e01('0xac'),'include':[{'model':db['Interval'],'as':_0x0e01('0xad'),'attributes':['id',_0x0e01('0xae')],'raw':!![]}]}]});})['then'](function(_0x1a39b2){if(!_0x1a39b2){throw new APINotFoundError(util[_0x0e01('0x41')](_0x0e01('0xaf'),_0x1542ec[_0x0e01('0x63')]['id']));}var _0x36b271=_0x1a39b2[_0x0e01('0xac')];if(_0x36b271){var _0x3835ed=_0x1a39b2[_0x0e01('0xb0')]||undefined;return _0x36b271['ifTime'](_0x3835ed)['then'](function(_0x49de0c){if(!_0x49de0c){throw new APIOutOfIntervalError();}return _0x1a39b2;});}else{return _0x1a39b2;}})[_0x0e01('0x2e')](function(_0x4474ac){if(!_0x4474ac[_0x0e01('0xa7')]){return;}_0x1c8b75['account']=_0x4474ac;_0x1c8b75[_0x0e01('0xb1')]=_0x4474ac[_0x0e01('0xa7')];_0x1c8b75['applications']=_['orderBy'](_0x4474ac[_0x0e01('0xab')],[_0x0e01('0xb2')],[_0x0e01('0xb3')]);if(_0x1c8b75['account'][_0x0e01('0xab')]){delete _0x1c8b75['account'][_0x0e01('0xab')];}if(_0x1c8b75[_0x0e01('0xb4')][_0x0e01('0xa7')]&&_0x1c8b75[_0x0e01('0xb4')][_0x0e01('0xa7')][_0x0e01('0xa8')][_0x0e01('0x55')]){return _0x1c8b75[_0x0e01('0xb4')]['List']['Contacts'][0x0];}var _0x4dfcd7=_['defaults'](_0x1542ec[_0x0e01('0x69')],{'firstName':_0x1542ec['body']['from'],'ListId':_0x4474ac[_0x0e01('0xa5')]});_0x4dfcd7[_0x1542ec['body'][_0x0e01('0x9d')]]=_0x1542ec[_0x0e01('0x69')]['from'];return db[_0x0e01('0xa0')][_0x0e01('0x68')](_0x4dfcd7,{'fields':_0x2f159c,'raw':!![]});})[_0x0e01('0x2e')](function(_0x61da63){_0x1c8b75[_0x0e01('0xb5')]=_0x61da63;var _0x42f238=createInteractionObject(_0x1542ec[_0x0e01('0x63')]['id'],_0x1542ec['body'],_0x1542ec[_0x0e01('0xb6')],_0x61da63);var _0x4d8410={'ChatWebsiteId':_0x1542ec[_0x0e01('0x63')]['id']};if(_0x1542ec[_0x0e01('0x69')][_0x0e01('0xb7')]){_0x4d8410[_0x0e01('0xb7')]=_0x1542ec[_0x0e01('0x69')]['threadId'];_0x4d8410['closed']=![];return db[_0x0e01('0xb8')][_0x0e01('0x67')]({'where':_0x4d8410})[_0x0e01('0x2e')](function(_0x531d43){var _0x4c6c10=_0x1542ec[_0x0e01('0x69')][_0x0e01('0x37')]&&_0x1542ec[_0x0e01('0x69')][_0x0e01('0x3d')];if(_0x531d43){_0x3bce1c=!![];return _0x531d43;}else if(!_0x4c6c10&&_0x531d43&&_0x531d43[_0x0e01('0xb9')]){throw new APIConflictError(_0x0e01('0xba'));}_0x42f238['threadId']=_0x1542ec['body']['threadId'];_0x42f238['externalUrl']=_0x1542ec[_0x0e01('0x69')][_0x0e01('0xbb')];return db[_0x0e01('0xb8')][_0x0e01('0x68')](_0x42f238);});}_0x4d8410[_0x0e01('0xbc')]=_0x61da63['id'];if(_0x1542ec['body'][_0x0e01('0xbd')]&&_0x1542ec[_0x0e01('0x69')][_0x0e01('0xbd')]['id']){_0x4d8410['id']=_0x1542ec[_0x0e01('0x69')][_0x0e01('0xbd')]['id'];return db[_0x0e01('0xb8')][_0x0e01('0x67')]({'where':_0x4d8410})[_0x0e01('0x2e')](function(_0x3e17c4){var _0x370c88=_0x1542ec[_0x0e01('0x69')][_0x0e01('0x37')]&&_0x1542ec[_0x0e01('0x69')][_0x0e01('0x3d')];if(!_0x370c88&&_0x3e17c4&&_0x3e17c4['closed']){throw new APIConflictError(_0x0e01('0xba'));}else if(_0x3e17c4){_0x3bce1c=!![];return _0x3e17c4;}else{return db[_0x0e01('0xb8')]['create'](_0x42f238);}});}return db['ChatInteraction'][_0x0e01('0x68')](_0x42f238);})[_0x0e01('0x2e')](function(_0x39a775){if(!_0x3bce1c){return _0x39a775;}var _0x303df3={'from':(_0x1c8b75[_0x0e01('0xb5')][_0x0e01('0x3a')]||'')+'\x20'+(_0x1c8b75[_0x0e01('0xb5')][_0x0e01('0x3b')]||'')};if(_0x1542ec[_0x0e01('0x69')]['threadId']&&_0x1542ec[_0x0e01('0x69')][_0x0e01('0xbe')]&&_0x1542ec[_0x0e01('0x69')]['threadId']!=_0x1542ec[_0x0e01('0x69')][_0x0e01('0xbe')]){_0x303df3['threadId']=_0x1542ec[_0x0e01('0x69')]['messageId'];}return _0x39a775[_0x0e01('0x2d')](_0x303df3);})[_0x0e01('0x2e')](function(_0x5867ce){_0x1c8b75[_0x0e01('0xbd')]=_0x5867ce[_0x0e01('0x6b')]({'plain':!![]});_0x1c8b75[_0x0e01('0xbd')][_0x0e01('0xbf')]=!_0x3bce1c;if(_0x1c8b75[_0x0e01('0xbd')][_0x0e01('0xbf')]){if(_0x1c8b75[_0x0e01('0xb4')][_0x0e01('0xc0')]){_0x1c8b75[_0x0e01('0xc1')][_0x0e01('0xc2')]({'id':0x0,'priority':_0x1c8b75[_0x0e01('0xc1')][_0x0e01('0x55')]+0x1,'app':_0x0e01('0xc3'),'appdata':_0x0e01('0xc4'),'interval':_0x0e01('0xc5')});}}return db[_0x0e01('0xc6')][_0x0e01('0x68')]({'body':_0x1542ec[_0x0e01('0x69')][_0x0e01('0x69')],'ChatWebsiteId':_0x1542ec[_0x0e01('0x63')]['id'],'ChatInteractionId':_0x5867ce['id'],'direction':'in','ContactId':_0x1c8b75['contact']['id'],'AttachmentId':_0x1542ec[_0x0e01('0x69')][_0x0e01('0xc7')]});})[_0x0e01('0x2e')](function(_0x515ef0){_0x1c8b75['message']=_0x515ef0;if(!_0x1c8b75[_0x0e01('0xbd')][_0x0e01('0xc8')]){return;}return db[_0x0e01('0xc9')][_0x0e01('0x67')]({'attributes':['id',_0x0e01('0x32')],'where':{'id':_0x1c8b75[_0x0e01('0xbd')][_0x0e01('0xc8')]}});})[_0x0e01('0x2e')](function(_0x29a864){if(_0x29a864){_0x1c8b75[_0x0e01('0xc1')][_0x0e01('0xca')]({'id':0x0,'priority':0x0,'app':_0x0e01('0xcb'),'appdata':_0x29a864[_0x0e01('0x32')]+','+(_0x1c8b75[_0x0e01('0xb4')][_0x0e01('0xcc')]||0xa),'interval':_0x0e01('0xc5')});_0x1c8b75[_0x0e01('0xcd')]=!![];}if(!_0x1c8b75[_0x0e01('0xbd')][_0x0e01('0xce')]){return;}return db['ChatQueue'][_0x0e01('0x67')]({'attributes':['id','name'],'where':{'id':_0x1c8b75[_0x0e01('0xbd')][_0x0e01('0xce')]}});})[_0x0e01('0x2e')](function(_0x4d047c){if(_0x4d047c){_0x1c8b75[_0x0e01('0xc1')]['unshift']({'id':0x0,'priority':0x1,'app':_0x0e01('0xcf'),'appdata':_0x4d047c[_0x0e01('0x32')]+','+(_0x1c8b75[_0x0e01('0xb4')][_0x0e01('0xd0')]||0x12c),'interval':_0x0e01('0xc5')});}return respondWithRpcPromise(_0x0e01('0xd1'),_0x0e01('0xd2'),_0x1c8b75);})[_0x0e01('0x2e')](function(_0x3cb79e){respondWithRpcPromise(_0x0e01('0xd3'),_0x0e01('0xd3'),{'event':_0x0e01('0x9a'),'message':_0x3cb79e},client9002);return _0x3cb79e;})[_0x0e01('0x2e')](respondWithResult(_0x2f1f68,null))[_0x0e01('0x22')](APIHandleError(_0x2f1f68));};exports['offline']=function(_0x2259e8,_0x3b38fe){var _0x5c38df,_0x28a346,_0x3ab3c8;var _0x342822=[];var _0x120039={};var _0x424eb2=_0x2259e8[_0x0e01('0xd4')]||[];var _0xb35ed=[];var _0x3a1aee;return db[_0x0e01('0xa0')]['describe']()['then'](function(_0x47318e){if(!_0x47318e){throw new db[(_0x0e01('0xd5'))]['ValidationError'](_0x0e01('0xd6'));}_0x342822=_[_0x0e01('0xd7')](_[_0x0e01('0x50')](_0x47318e),[_0x0e01('0xa2'),_0x0e01('0xa3'),_0x0e01('0xa4'),_0x0e01('0xa5')]);if(_0x2259e8['body']['id']){delete _0x2259e8['body']['id'];}if(_[_0x0e01('0x8e')](_0x2259e8['body'][_0x0e01('0x9b')])){throw _0x3b38fe[_0x0e01('0x2a')](0x1f4)[_0x0e01('0x33')](new db[(_0x0e01('0xd5'))][(_0x0e01('0xd8'))](_0x0e01('0xd9')));}if(_[_0x0e01('0x8e')](_0x2259e8[_0x0e01('0x69')]['body'])||_0x2259e8[_0x0e01('0x69')][_0x0e01('0x69')]===''){throw _0x3b38fe[_0x0e01('0x2a')](0x1f4)[_0x0e01('0x33')](new db['Sequelize'][(_0x0e01('0xd8'))](_0x0e01('0xda')));}if(_[_0x0e01('0x8e')](_0x2259e8[_0x0e01('0x69')][_0x0e01('0xdb')])){throw _0x3b38fe[_0x0e01('0x2a')](0x1f4)['send'](new db['Sequelize'][(_0x0e01('0xd8'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x342822));}if(!_[_0x0e01('0xa6')](_0x342822,_0x2259e8['body'][_0x0e01('0xdb')])){throw _0x3b38fe[_0x0e01('0x2a')](0x1f4)[_0x0e01('0x33')](new db[(_0x0e01('0xd5'))][(_0x0e01('0xd8'))](_0x0e01('0xdc')+_0x342822));}_0x120039[_0x2259e8[_0x0e01('0x69')][_0x0e01('0xdb')]]=_0x2259e8[_0x0e01('0x69')]['from'];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2259e8['params']['id']},'include':[{'model':db[_0x0e01('0xdd')],'as':_0x0e01('0xa7')},{'model':db[_0x0e01('0xde')],'as':_0x0e01('0xde')}]});})[_0x0e01('0x2e')](handleEntityNotFound(_0x3b38fe,null))[_0x0e01('0x2e')](function(_0x51ad27){if(_0x51ad27&&_0x51ad27[_0x0e01('0xa7')]){_0x28a346=_0x51ad27;var _0xbfcd02=_['defaults'](_0x2259e8[_0x0e01('0x69')],{'firstName':_0x2259e8[_0x0e01('0x69')][_0x0e01('0x9b')],'phone':_0x2259e8[_0x0e01('0x69')][_0x0e01('0x9b')],'ListId':_0x51ad27[_0x0e01('0xa5')]});_0xbfcd02[_0x2259e8[_0x0e01('0x69')]['mapKeyOffline']]=_0x2259e8['body'][_0x0e01('0x9b')];return db[_0x0e01('0xa0')][_0x0e01('0xdf')]({'where':_0x120039,'defaults':_0xbfcd02});}})[_0x0e01('0xe0')](function(_0x8f9f19){if(_0x8f9f19){_0x3ab3c8=_0x8f9f19;var _0x4e0de3=fs[_0x0e01('0xe1')](path[_0x0e01('0x90')](config['root'],_0x0e01('0xe2')),_0x0e01('0xe3'));var _0x553a1a=ejs['render'](_0x4e0de3,{'body':_[_0x0e01('0xe4')](_0x2259e8[_0x0e01('0x69')]['body']),'bodyTitle':_0x28a346[_0x0e01('0xe5')]});return db['ChatOfflineMessage'][_0x0e01('0x68')]({'body':_0x553a1a,'plainBody':htmlToText[_0x0e01('0xe6')](_0x553a1a),'ContactId':_0x8f9f19['id'],'ChatWebsiteId':_0x28a346['id']});}})[_0x0e01('0x2e')](function(_0x3b5914){_0x3a1aee=_0x3b5914;if(_0x424eb2[_0x0e01('0x55')]){var _0x12c56f=_0x424eb2['map'](function(_0x1d64c4){return{'name':_0x1d64c4[_0x0e01('0xe7')],'basename':_0x1d64c4[_0x0e01('0x83')],'type':_0x1d64c4[_0x0e01('0xe8')],'ChatOfflineMessageId':_0x3b5914['id']};});_0xb35ed=_0x12c56f[_0x0e01('0x49')](_0x2c3656=>{var _0x255aee={'filename':_0x2c3656['name'],'path':path[_0x0e01('0x90')](config[_0x0e01('0x89')],_0x0e01('0xe9'),'files',_0x0e01('0xea'),_0x0e01('0xeb'),_0x2c3656['basename'])};return _0x255aee;});if(!_0x28a346[_0x0e01('0xec')]){return db['sequelize']['transaction'](function(_0x40f0b5){return db[_0x0e01('0xed')][_0x0e01('0xee')](_0x12c56f,{'transaction':_0x40f0b5});});}}})[_0x0e01('0x2e')](function(){if(_0x3a1aee){_0x5c38df=_0x3a1aee;return db['MailAccount'][_0x0e01('0x77')]({'where':{'service':!![]},'include':[{'model':db[_0x0e01('0xef')],'as':_0x0e01('0xf0'),'raw':!![],'include':[{'model':db[_0x0e01('0xf1')],'as':_0x0e01('0xf1'),'raw':!![]}]}]});}})[_0x0e01('0x2e')](function(_0x29bac2){if(_0x29bac2&&_0x29bac2[_0x0e01('0xf0')]&&_0x28a346[_0x0e01('0xf2')]&&_0x28a346['forwardOfflineAddress']){var _0x194cf7=_0x29bac2['getSmtpOptions']();return respondWithRpcPromise(_0x0e01('0xf3'),_0x0e01('0xf4'),{'account':_0x194cf7,'message':{'from':util[_0x0e01('0x41')](_0x0e01('0xf5'),_0x29bac2[_0x0e01('0x32')],_0x29bac2['email']||_0x29bac2['Smtp'][_0x0e01('0x6a')]),'to':_0x28a346[_0x0e01('0xf6')],'subject':_0x28a346['offlineMessageSubject'],'html':_0x5c38df['body'],'attachments':_0xb35ed}},client9003)[_0x0e01('0x2e')](function(){return _0x5c38df;})[_0x0e01('0x22')](function(_0x720b50){logger[_0x0e01('0x1e')](_0x720b50);});}})[_0x0e01('0x2e')](function(){if(_0x28a346&&_0x28a346['openNewInteraction']&&_0x28a346[_0x0e01('0xf7')]){var _0x49a007=[];if(_0x424eb2[_0x0e01('0x55')]){_0x49a007=_0x424eb2[_0x0e01('0x49')](function(_0x17e0bc){return{'name':_0x17e0bc[_0x0e01('0xe7')],'basename':_0x17e0bc[_0x0e01('0x83')],'type':_0x17e0bc[_0x0e01('0xe8')],'ChatOfflineMessageId':_0x3a1aee['id']};});}var _0x50fd4a;if(!_['isNil'](_0x28a346[_0x0e01('0xf8')])){var _0x426ebc=_[_0x0e01('0x49')](_0x2259e8[_0x0e01('0x69')],function(_0x3f70ef){return _0x3f70ef;});var _0x4453c6=_[_0x0e01('0xf9')](_0x426ebc)[0x0];var _0x50a327=_['mapValues'](_0x4453c6,function(_0x546d41){return _0x546d41;});_0x50fd4a=_0x50a327[0x1][_0x28a346['subjectOffline']];}var _0x3ffb9e={'from':_0x3ab3c8[_0x0e01('0xfa')],'firstName':_0x3ab3c8['firstName'],'lastName':_0x3ab3c8[_0x0e01('0x3b')],'mapKey':'email','message':{'from':_0x3ab3c8[_0x0e01('0xfa')],'to':_0x28a346[_0x0e01('0xde')][_0x0e01('0xfa')],'cc':'','subject':_[_0x0e01('0x8e')](_0x50fd4a)?_0x28a346['offlineMessageSubject']:_0x50fd4a,'messageId':'','sentAt':new Date(),'attach':_0x49a007[_0x0e01('0x55')],'attachments':_0x49a007,'originChannel':_0x0e01('0xfb'),'ChatWebsiteId':_0x28a346['id'],'ChatOfflineMessageId':_0x5c38df['id'],'originTo':_0x28a346[_0x0e01('0xde')][_0x0e01('0xfa')]},'body':_0x5c38df[_0x0e01('0x69')]};var _0x10aeb9={'account':{'id':_0x28a346['MailAccountId']},'body':_0x3ffb9e,'log':_0x0e01('0xfc')};return respondWithRpcPromise(_0x0e01('0xfc'),_0x0e01('0xfd'),_0x10aeb9,client9001)[_0x0e01('0x2e')](function(){return _0x5c38df;})['catch'](function(_0x4ab220){logger['error'](_0x4ab220);});}return;})[_0x0e01('0x2e')](function(){if(_0x5c38df){return _0x5c38df;}})['then'](respondWithResult(_0x3b38fe,null))[_0x0e01('0x22')](function(){for(var _0x209f0f of _0x424eb2){var _0xd5a53a=path[_0x0e01('0x90')](config[_0x0e01('0x89')],_0x0e01('0xe9'),_0x0e01('0xd4'),_0x0e01('0xea'),'offline-chat',_0x209f0f[_0x0e01('0x83')]);fs_extra['remove'](_0xd5a53a)['catch'](function(_0x5dbbb3){logger[_0x0e01('0x1e')](_0x0e01('0xfe'),_0xd5a53a,_0x5dbbb3);});}});};exports[_0x0e01('0xff')]=function(_0x4f854d,_0x1e5447){return db['ChatInteraction'][_0x0e01('0x67')]({'where':{'id':_0x4f854d[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x1e5447,null))['then'](function(_0x4a21bf){if(_0x4a21bf){return _0x4a21bf['addInteraction'](_0x4f854d[_0x0e01('0x69')][_0x0e01('0x7d')],_[_0x0e01('0x100')](_0x4f854d[_0x0e01('0x69')],['ids','id'])||{});}})[_0x0e01('0x2e')](respondWithResult(_0x1e5447,null))['catch'](handleError(_0x1e5447,null));};exports[_0x0e01('0x101')]=function(_0x21dbaf,_0xcd491f){var _0x10c383={'raw':![],'where':{}};var _0x2f915f={};var _0x228458={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0e01('0x77')]({'where':{'id':_0x21dbaf[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0xcd491f,null))[_0x0e01('0x2e')](function(_0x4c7e4c){if(_0x4c7e4c){_0x2f915f[_0x0e01('0x44')]=_['keys'](db['ChatInteraction'][_0x0e01('0x4b')]);_0x2f915f[_0x0e01('0x4f')]=_['keys'](_0x21dbaf['query']);_0x2f915f['filters']=_[_0x0e01('0x52')](_0x2f915f[_0x0e01('0x44')],_0x2f915f[_0x0e01('0x4f')]);_0x10c383['attributes']=_['intersection'](_0x2f915f[_0x0e01('0x44')],qs[_0x0e01('0x54')](_0x21dbaf[_0x0e01('0x4f')][_0x0e01('0x54')]));_0x10c383[_0x0e01('0x53')]=_0x10c383[_0x0e01('0x53')]['length']?_0x10c383['attributes']:_0x2f915f['model'];if(!_0x21dbaf[_0x0e01('0x4f')]['hasOwnProperty'](_0x0e01('0x57'))){_0x10c383[_0x0e01('0x27')]=qs[_0x0e01('0x27')](_0x21dbaf[_0x0e01('0x4f')]['limit']);_0x10c383['offset']=qs[_0x0e01('0x29')](_0x21dbaf['query'][_0x0e01('0x29')]);}_0x10c383[_0x0e01('0x58')]=qs['sort'](_0x21dbaf[_0x0e01('0x4f')][_0x0e01('0x59')]);_0x10c383['where']=qs['filters'](_['pick'](_0x21dbaf[_0x0e01('0x4f')],_0x2f915f[_0x0e01('0x51')]));_0x10c383[_0x0e01('0x5a')][_0x0e01('0x74')]=_0x4c7e4c['id'];if(_0x21dbaf[_0x0e01('0x4f')][_0x0e01('0x5e')]){_0x10c383[_0x0e01('0x5a')]=_['merge'](_0x10c383[_0x0e01('0x5a')],{'$or':_[_0x0e01('0x49')](_0x10c383[_0x0e01('0x53')],function(_0x1544f4){var _0x5cc5ae={};_0x5cc5ae[_0x1544f4]={'$like':'%'+_0x21dbaf[_0x0e01('0x4f')][_0x0e01('0x5e')]+'%'};return _0x5cc5ae;})});}_0x10c383=_[_0x0e01('0x5c')]({},_0x10c383,_0x21dbaf['options']);return db['ChatInteraction'][_0x0e01('0x28')]({'where':_0x10c383[_0x0e01('0x5a')]})[_0x0e01('0x2e')](function(_0x363774){_0x228458[_0x0e01('0x28')]=_0x363774;if(_0x21dbaf['query']['includeAll']){_0x10c383[_0x0e01('0x65')]=[{'model':db[_0x0e01('0xa0')],'as':_0x0e01('0x102'),'required':![]},{'model':db[_0x0e01('0xc9')],'as':'Owner','attributes':[_0x0e01('0x32'),_0x0e01('0x103'),_0x0e01('0x104')],'required':![]},{'model':db['Tag'],'as':_0x0e01('0x105'),'attributes':['id','name',_0x0e01('0x106')],'where':_0x21dbaf[_0x0e01('0x4f')][_0x0e01('0x107')]?{'id':_0x21dbaf[_0x0e01('0x4f')][_0x0e01('0x107')]}:undefined,'required':_0x21dbaf[_0x0e01('0x4f')][_0x0e01('0x107')]?!![]:![]}];}return db['ChatInteraction'][_0x0e01('0x60')](_0x10c383);})[_0x0e01('0x2e')](function(_0xec1b8f){_0x228458[_0x0e01('0x61')]=_0xec1b8f;return _0x228458;});}})['then'](respondWithFilteredResult(_0xcd491f,_0x10c383))[_0x0e01('0x22')](handleError(_0xcd491f,null));};exports[_0x0e01('0x108')]=function(_0x4a0a61,_0x5689a6){var _0x1acee1=0x0;var _0x27debb=0x0;var _0x21259c=![];var _0x51a7b7;var _0x43422e;return db[_0x0e01('0x4a')]['find']({'where':{'id':_0x4a0a61['params']['id']},'include':[{'model':db[_0x0e01('0xac')],'as':_0x0e01('0xac'),'include':[{'model':db[_0x0e01('0xac')],'as':'Intervals','attributes':['id',_0x0e01('0xae')]}]}]})[_0x0e01('0x2e')](handleEntityNotFound(_0x5689a6,null))['then'](function(_0xd94483){if(_0xd94483){_0x51a7b7=_0xd94483;return _0xd94483['getProactiveActions']({'raw':!![]});}})[_0x0e01('0x2e')](function(_0x25abbb){if(_0x51a7b7){if(_0x25abbb){_0x43422e=_0x25abbb;}}return require(_0x0e01('0x8b'))[_0x0e01('0x8c')]();})[_0x0e01('0x2e')](function(_0x584da2){if(_0x584da2){_0x27debb=_0x584da2[_0x0e01('0x109')];_0x21259c=_0x584da2[_0x0e01('0x8d')];}})[_0x0e01('0x2e')](function(){return db[_0x0e01('0xb8')][_0x0e01('0x28')]({'where':{'closed':![]}});})[_0x0e01('0x2e')](function(_0x3176c8){_0x1acee1=_0x3176c8;if(_0x27debb&&_0x3176c8>_0x27debb){return db[_0x0e01('0x10a')]['findOne']({'where':{'id':0x1}})['then'](function(_0xef932d){if(_0xef932d){_0xef932d['increment'](_0x0e01('0x10b'));}});}})['then'](function(){var _0x461f87=_0x51a7b7[_0x0e01('0xac')];var _0x3ceac1=_0x51a7b7['timezone']||undefined;return _0x461f87?_0x461f87[_0x0e01('0x10c')](_0x3ceac1):!![];})['then'](function(_0x318d7b){var _0x1891d4=fs[_0x0e01('0xe1')](path['join'](config['root'],_0x0e01('0x10d')),'utf8');var _0x224454=new url[(_0x0e01('0x10e'))](_0x51a7b7[_0x0e01('0x10f')])[_0x0e01('0x110')];var _0x5eacb3=_0x0e01('0x111');var _0x4a2055=![];var _0xbf9c1a={'chatVersion':_0x5eacb3,'chatWebsiteAddressOrigin':_0x224454,'remote':_0x51a7b7[_0x0e01('0x112')],'query':querystring[_0x0e01('0x1d')](_[_0x0e01('0x5c')](_0x51a7b7['get']({'plain':!![]}),{'customerIp':_0x4a0a61[_0x0e01('0xb6')][_0x0e01('0x38')]||_0x4a0a61[_0x0e01('0xb6')][_0x0e01('0x113')]||_0x4a0a61['connection']['remoteAddress']||_0x4a0a61['ip'],'referer':_0x4a0a61[_0x0e01('0xb6')][_0x0e01('0x3d')],'openedInteractions':_0x1acee1,'maxInteractions':_0x27debb,'virtual':_0x21259c[_0x0e01('0x109')],'online':_0x318d7b,'custom':_0x21259c}))[_0x0e01('0x114')](/'/g,'\x5c\x27')};_0x5689a6[_0x0e01('0x33')](ejs[_0x0e01('0x115')](Mustache[_0x0e01('0x115')](_0x1891d4,_0xbf9c1a),{'proactiveActions':_0x43422e,'alignment':_0x51a7b7[_0x0e01('0x116')],'verticalAlignment':_0x51a7b7[_0x0e01('0x117')],'div_color':_0x51a7b7[_0x0e01('0x106')],'labelText':_0x51a7b7[_0x0e01('0x118')],'text_color':_0x51a7b7[_0x0e01('0x119')],'text_button_color':_0x51a7b7[_0x0e01('0x11a')],'button_color':_0x51a7b7[_0x0e01('0x11b')],'background_color':_0x51a7b7[_0x0e01('0x11c')],'hideWhenOffline':_0x51a7b7[_0x0e01('0x11d')],'intervalId':_0x51a7b7[_0x0e01('0x11e')],'isDevelopment':_0x4a2055,'chatVersion':_0x5eacb3}));})[_0x0e01('0x22')](handleError(_0x5689a6,null));};exports[_0x0e01('0x11f')]=function(_0xd56f79,_0x184a97){var _0x10d262=_0xd56f79['params']['id'];var _0x33b152=_0xd56f79[_0x0e01('0x69')];var _0x4be811=0xc8;var _0x40308f=null;return db['sequelize'][_0x0e01('0x120')]({'isolationLevel':db[_0x0e01('0x121')]['Transaction']['ISOLATION_LEVELS'][_0x0e01('0x122')]},function(_0x5e9f3f){return db[_0x0e01('0x4a')][_0x0e01('0x77')]({'where':{'id':_0x10d262},'transaction':_0x5e9f3f})['then'](function(_0x55a74e){if(_0x55a74e){return db[_0x0e01('0xaa')][_0x0e01('0x2f')]({'where':{'ChatWebsiteId':_0x10d262},'transaction':_0x5e9f3f})['then'](function(){var _0x5d1d60=_[_0x0e01('0x49')](_0x33b152,function(_0x563d3b){_0x563d3b[_0x0e01('0x74')]=_0x10d262;return _0x563d3b;});return db['ChatApplication'][_0x0e01('0xee')](_0x5d1d60,{'transaction':_0x5e9f3f});});}else{_0x4be811=0x194;_0x40308f=[];}});})[_0x0e01('0x2e')](function(){if(_0x4be811!==0x194){return db[_0x0e01('0xaa')][_0x0e01('0x123')]({'where':{'ChatWebsiteId':_0x10d262},'order':_0x0e01('0xb2')})[_0x0e01('0x2e')](function(_0x207219){_0x40308f=_0x207219;});}})[_0x0e01('0x22')](function(_0xd4e859){_0x4be811=0x1f4;logger[_0x0e01('0x1e')](_0xd4e859[_0x0e01('0x31')]);if(_0xd4e859[_0x0e01('0x32')]){delete _0xd4e859['name'];}_0x40308f=_0xd4e859;})[_0x0e01('0x124')](function(){if(_0x40308f===null){_0x184a97[_0x0e01('0x23')](_0x4be811);}else{if(_0x4be811===0x1f4){_0x184a97[_0x0e01('0x2a')](_0x4be811)['send'](_0x40308f);}else{_0x184a97[_0x0e01('0x2a')](_0x4be811)[_0x0e01('0x25')](_0x40308f);}}});};exports[_0x0e01('0x125')]=function(_0x2f7a1b,_0xc00ff3){var _0x12ea8d={};var _0x3de799={};var _0x9e4d48;var _0x2add87;return db[_0x0e01('0x4a')][_0x0e01('0x77')]({'where':{'id':_0x2f7a1b[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0xc00ff3,null))[_0x0e01('0x2e')](function(_0x5807c3){if(_0x5807c3){_0x9e4d48=_0x5807c3;_0x3de799[_0x0e01('0x44')]=_[_0x0e01('0x50')](db[_0x0e01('0xaa')][_0x0e01('0x4b')]);_0x3de799['query']=_[_0x0e01('0x50')](_0x2f7a1b[_0x0e01('0x4f')]);_0x3de799[_0x0e01('0x51')]=_[_0x0e01('0x52')](_0x3de799[_0x0e01('0x44')],_0x3de799[_0x0e01('0x4f')]);_0x12ea8d[_0x0e01('0x53')]=_[_0x0e01('0x52')](_0x3de799[_0x0e01('0x44')],qs[_0x0e01('0x54')](_0x2f7a1b[_0x0e01('0x4f')][_0x0e01('0x54')]));_0x12ea8d['attributes']=_0x12ea8d[_0x0e01('0x53')][_0x0e01('0x55')]?_0x12ea8d[_0x0e01('0x53')]:_0x3de799[_0x0e01('0x44')];_0x12ea8d[_0x0e01('0x58')]=qs['sort'](_0x2f7a1b[_0x0e01('0x4f')][_0x0e01('0x59')]);_0x12ea8d[_0x0e01('0x5a')]=qs[_0x0e01('0x51')](_[_0x0e01('0x5b')](_0x2f7a1b[_0x0e01('0x4f')],_0x3de799[_0x0e01('0x51')]));if(_0x2f7a1b[_0x0e01('0x4f')][_0x0e01('0x5e')]){_0x12ea8d[_0x0e01('0x5a')]=_[_0x0e01('0x5c')](_0x12ea8d['where'],{'$or':_['map'](_0x12ea8d[_0x0e01('0x53')],function(_0x484684){var _0x3428d2={};_0x3428d2[_0x484684]={'$like':'%'+_0x2f7a1b[_0x0e01('0x4f')][_0x0e01('0x5e')]+'%'};return _0x3428d2;})});}_0x12ea8d=_[_0x0e01('0x5c')]({},_0x12ea8d,_0x2f7a1b[_0x0e01('0x66')]);return _0x9e4d48['getApplications'](_0x12ea8d);}})[_0x0e01('0x2e')](function(_0x1d83ed){if(_0x1d83ed){_0x2add87=_0x1d83ed[_0x0e01('0x55')];if(!_0x2f7a1b[_0x0e01('0x4f')][_0x0e01('0x56')](_0x0e01('0x57'))){_0x12ea8d['limit']=qs['limit'](_0x2f7a1b['query'][_0x0e01('0x27')]);_0x12ea8d[_0x0e01('0x29')]=qs[_0x0e01('0x29')](_0x2f7a1b[_0x0e01('0x4f')][_0x0e01('0x29')]);}return _0x9e4d48['getApplications'](_0x12ea8d);}})[_0x0e01('0x2e')](function(_0x5f46e4){if(_0x5f46e4){return _0x5f46e4?{'count':_0x2add87,'rows':_0x5f46e4}:null;}})['then'](respondWithResult(_0xc00ff3,null))[_0x0e01('0x22')](handleError(_0xc00ff3,null));};exports[_0x0e01('0x126')]=function(_0x9fc065,_0x190231){return db[_0x0e01('0x127')]['find']({'where':{'id':_0x9fc065[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x190231,null))[_0x0e01('0x2e')](function(_0x1db44d){if(_0x1db44d){return _0x1db44d[_0x0e01('0x126')](_0x9fc065[_0x0e01('0x69')][_0x0e01('0x7d')],_[_0x0e01('0x100')](_0x9fc065[_0x0e01('0x69')],[_0x0e01('0x7d'),'id'])||{});}})[_0x0e01('0x2e')](respondWithResult(_0x190231,null))[_0x0e01('0x22')](handleError(_0x190231,null));};exports[_0x0e01('0x128')]=function(_0x59458b,_0x77166a){var _0x28d08c={};var _0x2bb16b={};var _0x5d9818;var _0x2b676e;return db[_0x0e01('0x4a')][_0x0e01('0x77')]({'where':{'id':_0x59458b[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x77166a,null))[_0x0e01('0x2e')](function(_0xe37e4b){if(_0xe37e4b){_0x5d9818=_0xe37e4b;_0x2bb16b['model']=_[_0x0e01('0x50')](db['ChatProactiveAction'][_0x0e01('0x4b')]);_0x2bb16b['query']=_[_0x0e01('0x50')](_0x59458b[_0x0e01('0x4f')]);_0x2bb16b[_0x0e01('0x51')]=_[_0x0e01('0x52')](_0x2bb16b['model'],_0x2bb16b[_0x0e01('0x4f')]);_0x28d08c[_0x0e01('0x53')]=_[_0x0e01('0x52')](_0x2bb16b[_0x0e01('0x44')],qs[_0x0e01('0x54')](_0x59458b[_0x0e01('0x4f')][_0x0e01('0x54')]));_0x28d08c[_0x0e01('0x53')]=_0x28d08c[_0x0e01('0x53')]['length']?_0x28d08c['attributes']:_0x2bb16b[_0x0e01('0x44')];_0x28d08c[_0x0e01('0x58')]=qs[_0x0e01('0x59')](_0x59458b[_0x0e01('0x4f')][_0x0e01('0x59')]);_0x28d08c['where']=qs[_0x0e01('0x51')](_[_0x0e01('0x5b')](_0x59458b[_0x0e01('0x4f')],_0x2bb16b[_0x0e01('0x51')]));if(_0x59458b['query'][_0x0e01('0x5e')]){_0x28d08c[_0x0e01('0x5a')]=_[_0x0e01('0x5c')](_0x28d08c['where'],{'$or':_[_0x0e01('0x49')](_0x28d08c[_0x0e01('0x53')],function(_0x36278b){var _0x136b8f={};_0x136b8f[_0x36278b]={'$like':'%'+_0x59458b[_0x0e01('0x4f')][_0x0e01('0x5e')]+'%'};return _0x136b8f;})});}_0x28d08c=_[_0x0e01('0x5c')]({},_0x28d08c,_0x59458b[_0x0e01('0x66')]);return _0x5d9818[_0x0e01('0x128')](_0x28d08c);}})[_0x0e01('0x2e')](function(_0x5f20da){if(_0x5f20da){_0x2b676e=_0x5f20da['length'];if(!_0x59458b[_0x0e01('0x4f')][_0x0e01('0x56')](_0x0e01('0x57'))){_0x28d08c['limit']=qs[_0x0e01('0x27')](_0x59458b[_0x0e01('0x4f')][_0x0e01('0x27')]);_0x28d08c[_0x0e01('0x29')]=qs[_0x0e01('0x29')](_0x59458b[_0x0e01('0x4f')][_0x0e01('0x29')]);}return _0x5d9818['getProactiveActions'](_0x28d08c);}})[_0x0e01('0x2e')](function(_0x4fde59){if(_0x4fde59){return _0x4fde59?{'count':_0x2b676e,'rows':_0x4fde59}:null;}})[_0x0e01('0x2e')](respondWithResult(_0x77166a,null))[_0x0e01('0x22')](handleError(_0x77166a,null));};exports[_0x0e01('0x129')]=function(_0x3e21e4,_0x147498){var _0x15794b=_0x3e21e4[_0x0e01('0x4f')]['online']==='false'?'offlineForm':_0x0e01('0x12a');return db[_0x0e01('0x4a')][_0x0e01('0x67')]({'attributes':['id',_0x15794b],'where':{'id':_0x3e21e4[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x147498,null))[_0x0e01('0x2e')](function(_0x39eeb2){if(_0x39eeb2){var _0x10e0e4=_0x39eeb2[_0x15794b];var _0x26dfc0=_0x10e0e4&&_0x10e0e4[_0x0e01('0x12b')]?_0x10e0e4[_0x0e01('0x12b')]:[];_0x147498[_0x0e01('0x33')]({'fromKey':_['isNil'](_0x10e0e4['fromKey'])?undefined:_0x10e0e4[_0x0e01('0x12c')],'count':_0x26dfc0[_0x0e01('0x55')],'rows':_0x26dfc0});}})[_0x0e01('0x22')](handleError(_0x147498,null));};exports['getOfflineMessages']=function(_0x1df46f,_0x2188a6){var _0x426ba7={'raw':![],'where':{}};var _0x55c83a={};var _0xec52de={'count':0x0,'rows':[]};return db[_0x0e01('0x4a')]['findOne']({'where':{'id':_0x1df46f[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x2188a6,null))[_0x0e01('0x2e')](function(_0x1b1ab3){if(_0x1b1ab3){_0x55c83a[_0x0e01('0x44')]=_[_0x0e01('0x50')](db[_0x0e01('0x12d')][_0x0e01('0x4b')]);_0x55c83a['query']=_['keys'](_0x1df46f['query']);_0x55c83a['filters']=_[_0x0e01('0x52')](_0x55c83a['model'],_0x55c83a['query']);_0x426ba7[_0x0e01('0x53')]=_[_0x0e01('0x52')](_0x55c83a[_0x0e01('0x44')],qs[_0x0e01('0x54')](_0x1df46f[_0x0e01('0x4f')][_0x0e01('0x54')]));_0x426ba7[_0x0e01('0x53')]=_0x426ba7[_0x0e01('0x53')][_0x0e01('0x55')]?_0x426ba7[_0x0e01('0x53')]:_0x55c83a[_0x0e01('0x44')];if(!_0x1df46f[_0x0e01('0x4f')][_0x0e01('0x56')](_0x0e01('0x57'))){_0x426ba7[_0x0e01('0x27')]=qs['limit'](_0x1df46f[_0x0e01('0x4f')]['limit']);_0x426ba7['offset']=qs[_0x0e01('0x29')](_0x1df46f[_0x0e01('0x4f')]['offset']);}_0x426ba7[_0x0e01('0x58')]=qs[_0x0e01('0x59')](_0x1df46f[_0x0e01('0x4f')]['sort']);_0x426ba7[_0x0e01('0x5a')]=qs['filters'](_['pick'](_0x1df46f[_0x0e01('0x4f')],_0x55c83a['filters']));_0x426ba7[_0x0e01('0x5a')][_0x0e01('0x74')]=_0x1b1ab3['id'];if(_0x1df46f['query']['filter']){_0x426ba7['where']=_[_0x0e01('0x5c')](_0x426ba7[_0x0e01('0x5a')],{'$or':_[_0x0e01('0x49')](_0x426ba7[_0x0e01('0x53')],function(_0x48d45e){var _0x2eddbd={};_0x2eddbd[_0x48d45e]={'$like':'%'+_0x1df46f[_0x0e01('0x4f')][_0x0e01('0x5e')]+'%'};return _0x2eddbd;})});}_0x426ba7=_[_0x0e01('0x5c')]({},_0x426ba7,_0x1df46f[_0x0e01('0x66')]);return db[_0x0e01('0x12d')][_0x0e01('0x28')]({'where':_0x426ba7[_0x0e01('0x5a')]})[_0x0e01('0x2e')](function(_0x1dd2c5){_0xec52de[_0x0e01('0x28')]=_0x1dd2c5;if(_0x1df46f[_0x0e01('0x4f')][_0x0e01('0x5f')]){_0x426ba7['include']=[{'all':!![]}];}else{_0x426ba7[_0x0e01('0x65')]=[{'model':db[_0x0e01('0xa0')],'as':_0x0e01('0x102'),'required':![]},{'model':db[_0x0e01('0xed')],'as':_0x0e01('0x12e'),'required':![]}];}return db[_0x0e01('0x12d')]['findAll'](_0x426ba7);})[_0x0e01('0x2e')](function(_0x47111b){_0xec52de[_0x0e01('0x61')]=_0x47111b;return _0xec52de;});}})[_0x0e01('0x2e')](respondWithFilteredResult(_0x2188a6,_0x426ba7))[_0x0e01('0x22')](handleError(_0x2188a6,null));};exports['addAgents']=function(_0x293a01,_0xcc5410){return db[_0x0e01('0x4a')]['find']({'where':{'id':_0x293a01[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0xcc5410,null))[_0x0e01('0x2e')](function(_0x490f21){if(_0x490f21){return _0x490f21[_0x0e01('0x12f')](_0x293a01[_0x0e01('0x69')][_0x0e01('0x7d')],_[_0x0e01('0x100')](_0x293a01[_0x0e01('0x69')],[_0x0e01('0x7d'),'id'])||{})[_0x0e01('0xe0')](function(_0x5341e5){for(var _0x509188=0x0;_0x509188<_0x293a01[_0x0e01('0x69')][_0x0e01('0x7d')][_0x0e01('0x55')];_0x509188+=0x1){socket[_0x0e01('0x130')](_0x0e01('0x131'),{'UserId':Number(_0x293a01[_0x0e01('0x69')][_0x0e01('0x7d')][_0x509188]),'ChatWebsiteId':Number(_0x293a01[_0x0e01('0x63')]['id'])});}return _0x5341e5;});}})['then'](respondWithResult(_0xcc5410,null))[_0x0e01('0x22')](handleError(_0xcc5410,null));};exports[_0x0e01('0x132')]=function(_0x3369fb,_0x45b77b){return db[_0x0e01('0x4a')][_0x0e01('0x67')]({'where':{'id':_0x3369fb[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x45b77b,null))['then'](function(_0x38e681){if(_0x38e681){return _0x38e681[_0x0e01('0x132')](_0x3369fb[_0x0e01('0x4f')][_0x0e01('0x7d')])[_0x0e01('0x2e')](function(){if(_[_0x0e01('0x133')](_0x3369fb[_0x0e01('0x4f')][_0x0e01('0x7d')])){for(var _0x440029=0x0;_0x440029<_0x3369fb['query']['ids']['length'];_0x440029+=0x1){socket[_0x0e01('0x130')](_0x0e01('0x134'),{'UserId':Number(_0x3369fb[_0x0e01('0x4f')][_0x0e01('0x7d')][_0x440029]),'ChatWebsiteId':Number(_0x3369fb['params']['id'])});}}else{socket[_0x0e01('0x130')]('userChatWebsite:remove',{'UserId':Number(_0x3369fb[_0x0e01('0x4f')][_0x0e01('0x7d')]),'ChatWebsiteId':Number(_0x3369fb[_0x0e01('0x63')]['id'])});}});}})[_0x0e01('0x2e')](respondWithStatusCode(_0x45b77b,null))[_0x0e01('0x22')](handleError(_0x45b77b,null));};exports[_0x0e01('0x135')]=function(_0x3648c1,_0x3e4a50){var _0x3cddfe={};var _0x507085={};var _0x5736d3;var _0x1f7818;return db[_0x0e01('0x4a')][_0x0e01('0x77')]({'where':{'id':_0x3648c1[_0x0e01('0x63')]['id']}})[_0x0e01('0x2e')](handleEntityNotFound(_0x3e4a50,null))['then'](function(_0x782c6a){if(_0x782c6a){_0x5736d3=_0x782c6a;_0x507085[_0x0e01('0x44')]=_['keys'](db[_0x0e01('0xc9')][_0x0e01('0x4b')]);_0x507085[_0x0e01('0x4f')]=_[_0x0e01('0x50')](_0x3648c1[_0x0e01('0x4f')]);_0x507085[_0x0e01('0x51')]=_[_0x0e01('0x52')](_0x507085[_0x0e01('0x44')],_0x507085[_0x0e01('0x4f')]);_0x3cddfe[_0x0e01('0x53')]=_['intersection'](_0x507085['model'],qs['fields'](_0x3648c1['query'][_0x0e01('0x54')]));_0x3cddfe[_0x0e01('0x53')]=_0x3cddfe[_0x0e01('0x53')][_0x0e01('0x55')]?_0x3cddfe[_0x0e01('0x53')]:_0x507085[_0x0e01('0x44')];_0x3cddfe[_0x0e01('0x58')]=qs[_0x0e01('0x59')](_0x3648c1[_0x0e01('0x4f')][_0x0e01('0x59')]);_0x3cddfe[_0x0e01('0x5a')]=qs[_0x0e01('0x51')](_[_0x0e01('0x5b')](_0x3648c1[_0x0e01('0x4f')],_0x507085[_0x0e01('0x51')]));if(_0x3648c1[_0x0e01('0x4f')][_0x0e01('0x5e')]){_0x3cddfe[_0x0e01('0x5a')]=_[_0x0e01('0x5c')](_0x3cddfe[_0x0e01('0x5a')],{'$or':_['map'](_0x3cddfe['attributes'],function(_0x513f9b){var _0x5c7ca2={};_0x5c7ca2[_0x513f9b]={'$like':'%'+_0x3648c1[_0x0e01('0x4f')]['filter']+'%'};return _0x5c7ca2;})});}_0x3cddfe=_[_0x0e01('0x5c')]({},_0x3cddfe,_0x3648c1['options']);return _0x5736d3[_0x0e01('0x135')](_0x3cddfe);}})[_0x0e01('0x2e')](function(_0x2b8f70){if(_0x2b8f70){_0x1f7818=_0x2b8f70['length'];if(!_0x3648c1[_0x0e01('0x4f')][_0x0e01('0x56')](_0x0e01('0x57'))){_0x3cddfe[_0x0e01('0x27')]=qs['limit'](_0x3648c1['query'][_0x0e01('0x27')]);_0x3cddfe[_0x0e01('0x29')]=qs[_0x0e01('0x29')](_0x3648c1[_0x0e01('0x4f')]['offset']);}return _0x5736d3[_0x0e01('0x135')](_0x3cddfe);}})[_0x0e01('0x2e')](function(_0x5abf73){if(_0x5abf73){return _0x5abf73?{'count':_0x1f7818,'rows':_0x5abf73}:null;}})[_0x0e01('0x2e')](respondWithResult(_0x3e4a50,null))['catch'](handleError(_0x3e4a50,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 5404aa0..68c9b26 100644 --- a/server/api/chatWebsite/chatWebsite.events.js +++ b/server/api/chatWebsite/chatWebsite.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c96=['exports','events','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c96,0x1c1));var _0x66c9=function(_0x5ab2e6,_0x150c3a){_0x5ab2e6=_0x5ab2e6-0x0;var _0x329b44=_0x6c96[_0x5ab2e6];return _0x329b44;};'use strict';var EventEmitter=require(_0x66c9('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x66c9('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x66c9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x66c9('0x3'),'afterDestroy':_0x66c9('0x4')};function emitEvent(_0x3c2e67){return function(_0x37e814,_0x35b830,_0x15aaa6){ChatWebsiteEvents[_0x66c9('0x5')](_0x3c2e67+':'+_0x37e814['id'],_0x37e814);ChatWebsiteEvents['emit'](_0x3c2e67,_0x37e814);_0x15aaa6(null);};}for(var e in events){if(events[_0x66c9('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x66c9('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xbed7=['ChatWebsite','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xc50658,_0x49657a){var _0x5cb377=function(_0x4e941c){while(--_0x4e941c){_0xc50658['push'](_0xc50658['shift']());}};_0x5cb377(++_0x49657a);}(_0xbed7,0x14b));var _0x7bed=function(_0x4c5b06,_0x5657d4){_0x4c5b06=_0x4c5b06-0x0;var _0x2d17c8=_0xbed7[_0x4c5b06];return _0x2d17c8;};'use strict';var EventEmitter=require(_0x7bed('0x0'));var ChatWebsite=require(_0x7bed('0x1'))['db'][_0x7bed('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7bed('0x3')](0x0);var events={'afterCreate':_0x7bed('0x4'),'afterUpdate':'update','afterDestroy':_0x7bed('0x5')};function emitEvent(_0x208dc6){return function(_0x1da710,_0x18c2c7,_0x2e683a){ChatWebsiteEvents[_0x7bed('0x6')](_0x208dc6+':'+_0x1da710['id'],_0x1da710);ChatWebsiteEvents[_0x7bed('0x6')](_0x208dc6,_0x1da710);_0x2e683a(null);};}for(var e in events){if(events[_0x7bed('0x7')](e)){var event=events[e];ChatWebsite[_0x7bed('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d83f80b..321ee5c 100644 --- a/server/api/chatWebsite/chatWebsite.model.js +++ b/server/api/chatWebsite/chatWebsite.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf668=['util','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf668,0x1b7));var _0x8f66=function(_0x4f73f5,_0x13bb5e){_0x4f73f5=_0x4f73f5-0x0;var _0x5f3974=_0xf668[_0x4f73f5];return _0x5f3974;};'use strict';var _=require(_0x8f66('0x0'));var util=require(_0x8f66('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8f66('0x2'));var rp=require(_0x8f66('0x3'));var fs=require('fs');var path=require(_0x8f66('0x4'));var rimraf=require('rimraf');var config=require(_0x8f66('0x5'));var attributes=require(_0x8f66('0x6'));module[_0x8f66('0x7')]=function(_0x5053cf,_0x332073){return _0x5053cf[_0x8f66('0x8')](_0x8f66('0x9'),attributes,{'tableName':_0x8f66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbbd=['rimraf','define','ChatWebsite','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbbbd,0x9c));var _0xdbbb=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xbbbd[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xdbbb('0x0'));var util=require('util');var logger=require(_0xdbbb('0x1'))(_0xdbbb('0x2'));var moment=require(_0xdbbb('0x3'));var BPromise=require(_0xdbbb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbbb('0x5'));var rimraf=require(_0xdbbb('0x6'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x55e8f4,_0x562e8b){return _0x55e8f4[_0xdbbb('0x7')](_0xdbbb('0x8'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 2980b7b..d0f85ed 100644 --- a/server/api/chatWebsite/chatWebsite.rpc.js +++ b/server/api/chatWebsite/chatWebsite.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24c6=['then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatWebsite.socket','register','request'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x24c6,0xa6));var _0x624c=function(_0x159259,_0x5d97a8){_0x159259=_0x159259-0x0;var _0x5e01cd=_0x24c6[_0x159259];return _0x5e01cd;};'use strict';var _=require(_0x624c('0x0'));var util=require(_0x624c('0x1'));var moment=require(_0x624c('0x2'));var BPromise=require(_0x624c('0x3'));var rs=require(_0x624c('0x4'));var fs=require('fs');var Redis=require(_0x624c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x624c('0x6'))(_0x624c('0x7'));var config=require(_0x624c('0x8'));var jayson=require(_0x624c('0x9'));var client=jayson[_0x624c('0xa')][_0x624c('0xb')]({'port':0x232a});config[_0x624c('0xc')]=_['defaults'](config[_0x624c('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x624c('0xc')]));require(_0x624c('0xd'))[_0x624c('0xe')](socket);function respondWithRpcPromise(_0x28b2c2,_0x4b7206,_0x14e6bb){return new BPromise(function(_0x34f426,_0x31b5bc){return client[_0x624c('0xf')](_0x28b2c2,_0x14e6bb)[_0x624c('0x10')](function(_0x150022){logger[_0x624c('0x11')](_0x624c('0x12'),_0x4b7206,'request\x20sent');logger[_0x624c('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4b7206,_0x624c('0x14'),JSON[_0x624c('0x15')](_0x150022));if(_0x150022[_0x624c('0x16')]){if(_0x150022[_0x624c('0x16')][_0x624c('0x17')]===0x1f4){logger['error'](_0x624c('0x12'),_0x4b7206,_0x150022['error'][_0x624c('0x18')]);return _0x31b5bc(_0x150022[_0x624c('0x16')][_0x624c('0x18')]);}logger[_0x624c('0x16')](_0x624c('0x12'),_0x4b7206,_0x150022[_0x624c('0x16')]['message']);return _0x34f426(_0x150022[_0x624c('0x16')][_0x624c('0x18')]);}else{logger[_0x624c('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x4b7206,_0x624c('0x14'));_0x34f426(_0x150022['result'][_0x624c('0x18')]);}})[_0x624c('0x19')](function(_0x545018){logger['error'](_0x624c('0x12'),_0x4b7206,_0x545018);_0x31b5bc(_0x545018);});});} \ No newline at end of file +var _0xd8e9=['message','request\x20sent','result','catch','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','redis','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0xd8e9,0x77));var _0x9d8e=function(_0x57a88d,_0x888f7){_0x57a88d=_0x57a88d-0x0;var _0x2883ce=_0xd8e9[_0x57a88d];return _0x2883ce;};'use strict';var _=require(_0x9d8e('0x0'));var util=require(_0x9d8e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d8e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9d8e('0x3'))(_0x9d8e('0x4'));var config=require(_0x9d8e('0x5'));var jayson=require(_0x9d8e('0x6'));var client=jayson['client'][_0x9d8e('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x9d8e('0x8'),'port':0x18eb});var socket=require(_0x9d8e('0x9'))(new Redis(config[_0x9d8e('0xa')]));require('./chatWebsite.socket')[_0x9d8e('0xb')](socket);function respondWithRpcPromise(_0x545c97,_0xa8f46b,_0x22e045){return new BPromise(function(_0x1f619b,_0x42dc4f){return client[_0x9d8e('0xc')](_0x545c97,_0x22e045)[_0x9d8e('0xd')](function(_0x2c9fb5){logger[_0x9d8e('0xe')](_0x9d8e('0xf'),_0xa8f46b,'request\x20sent');logger[_0x9d8e('0x10')](_0x9d8e('0x11'),_0xa8f46b,'request\x20sent',JSON['stringify'](_0x2c9fb5));if(_0x2c9fb5[_0x9d8e('0x12')]){if(_0x2c9fb5[_0x9d8e('0x12')]['code']===0x1f4){logger['error'](_0x9d8e('0xf'),_0xa8f46b,_0x2c9fb5[_0x9d8e('0x12')][_0x9d8e('0x13')]);return _0x42dc4f(_0x2c9fb5['error'][_0x9d8e('0x13')]);}logger[_0x9d8e('0x12')]('ChatWebsite,\x20%s,\x20%s',_0xa8f46b,_0x2c9fb5[_0x9d8e('0x12')][_0x9d8e('0x13')]);return _0x1f619b(_0x2c9fb5['error'][_0x9d8e('0x13')]);}else{logger['info'](_0x9d8e('0xf'),_0xa8f46b,_0x9d8e('0x14'));_0x1f619b(_0x2c9fb5[_0x9d8e('0x15')][_0x9d8e('0x13')]);}})[_0x9d8e('0x16')](function(_0x13f6db){logger[_0x9d8e('0x12')]('ChatWebsite,\x20%s,\x20%s',_0xa8f46b,_0x13f6db);_0x42dc4f(_0x13f6db);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 3f6d405..f501230 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ff2=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x17ead7,_0x2e8a8a){var _0x44990d=function(_0x52214e){while(--_0x52214e){_0x17ead7['push'](_0x17ead7['shift']());}};_0x44990d(++_0x2e8a8a);}(_0x0ff2,0x137));var _0x20ff=function(_0x27d30a,_0x52eb35){_0x27d30a=_0x27d30a-0x0;var _0x3ee370=_0x0ff2[_0x27d30a];return _0x3ee370;};'use strict';var ChatWebsiteEvents=require(_0x20ff('0x0'));var events=['save',_0x20ff('0x1'),_0x20ff('0x2')];function createListener(_0x36df08,_0x5be3b3){return function(_0x33d52b){_0x5be3b3[_0x20ff('0x3')](_0x36df08,_0x33d52b);};}function removeListener(_0x2321ea,_0x1a0a17){return function(){ChatWebsiteEvents[_0x20ff('0x4')](_0x2321ea,_0x1a0a17);};}exports[_0x20ff('0x5')]=function(_0x450e3e){for(var _0x12346c=0x0,_0x17adaa=events[_0x20ff('0x6')];_0x12346c<_0x17adaa;_0x12346c++){var _0xb1fc09=events[_0x12346c];var _0x42edb6=createListener(_0x20ff('0x7')+_0xb1fc09,_0x450e3e);ChatWebsiteEvents['on'](_0xb1fc09,_0x42edb6);}}; \ No newline at end of file +var _0x03a2=['length','chatWebsite:','./chatWebsite.events','save','remove','update','removeListener','register'];(function(_0x107dd5,_0x30d9ad){var _0x2e1593=function(_0xf6ed27){while(--_0xf6ed27){_0x107dd5['push'](_0x107dd5['shift']());}};_0x2e1593(++_0x30d9ad);}(_0x03a2,0x162));var _0x203a=function(_0x20171f,_0x3d4540){_0x20171f=_0x20171f-0x0;var _0x203015=_0x03a2[_0x20171f];return _0x203015;};'use strict';var ChatWebsiteEvents=require(_0x203a('0x0'));var events=[_0x203a('0x1'),_0x203a('0x2'),_0x203a('0x3')];function createListener(_0x56e59a,_0x20f55b){return function(_0xcac4b4){_0x20f55b['emit'](_0x56e59a,_0xcac4b4);};}function removeListener(_0x26d420,_0x228144){return function(){ChatWebsiteEvents[_0x203a('0x4')](_0x26d420,_0x228144);};}exports[_0x203a('0x5')]=function(_0x31b769){for(var _0x131a09=0x0,_0x5c1748=events[_0x203a('0x6')];_0x131a09<_0x5c1748;_0x131a09++){var _0x3799cd=events[_0x131a09];var _0x174b2f=createListener(_0x203a('0x7')+_0x3799cd,_0x31b769);ChatWebsiteEvents['on'](_0x3799cd,_0x174b2f);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 9820ddc..c7ed104 100644 --- a/server/api/chatWebsite/index.js +++ b/server/api/chatWebsite/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab0f=['update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','create','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','/:id/logo','single','server/files/images/avatars/','originalname','file','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','replace','extname','/:id/offline','any','offline','addApplications','/:id/users','addAgents'];(function(_0x4ec945,_0xe9fb7f){var _0x4eb0be=function(_0x4738a9){while(--_0x4738a9){_0x4ec945['push'](_0x4ec945['shift']());}};_0x4eb0be(++_0xe9fb7f);}(_0xab0f,0x118));var _0xfab0=function(_0x3e7346,_0x4f4f45){_0x3e7346=_0x3e7346-0x0;var _0x16bec5=_0xab0f[_0x3e7346];return _0x16bec5;};'use strict';var multer=require(_0xfab0('0x0'));var util=require(_0xfab0('0x1'));var path=require('path');var timeout=require(_0xfab0('0x2'));var express=require('express');var router=express[_0xfab0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfab0('0x4'));var config=require('../../config/environment');var controller=require(_0xfab0('0x5'));router[_0xfab0('0x6')]('/',auth[_0xfab0('0x7')](),controller[_0xfab0('0x8')]);router[_0xfab0('0x6')](_0xfab0('0x9'),auth['isAuthenticated'](),controller[_0xfab0('0xa')]);router[_0xfab0('0x6')](_0xfab0('0xb'),auth[_0xfab0('0x7')](),controller['show']);router[_0xfab0('0x6')]('/:id/dispositions',auth[_0xfab0('0x7')](),controller[_0xfab0('0xc')]);router[_0xfab0('0x6')](_0xfab0('0xd'),auth[_0xfab0('0x7')](),controller[_0xfab0('0xe')]);router['get']('/:id/logo',controller[_0xfab0('0xf')]);router[_0xfab0('0x6')](_0xfab0('0x10'),controller[_0xfab0('0x11')]);router[_0xfab0('0x6')]('/:id/customer_avatar',controller[_0xfab0('0x12')]);router['get'](_0xfab0('0x13'),controller[_0xfab0('0x14')]);router[_0xfab0('0x6')](_0xfab0('0x15'),auth[_0xfab0('0x7')](),controller[_0xfab0('0x16')]);router['get'](_0xfab0('0x17'),controller['getSnippet']);router[_0xfab0('0x6')](_0xfab0('0x18'),auth['isAuthenticated'](),controller[_0xfab0('0x19')]);router['get'](_0xfab0('0x1a'),auth['isAuthenticated'](),controller[_0xfab0('0x1b')]);router[_0xfab0('0x6')](_0xfab0('0x1c'),controller['getFields']);router['get']('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xfab0('0x1d')]);router['get']('/:id/users',auth[_0xfab0('0x7')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xfab0('0x1e')]);router[_0xfab0('0x1f')]('/:id/dispositions',auth[_0xfab0('0x7')](),controller['addDisposition']);router[_0xfab0('0x1f')]('/:id/canned_answers',auth[_0xfab0('0x7')](),controller[_0xfab0('0x20')]);var upload=multer({'storage':multer[_0xfab0('0x21')]({'destination':function(_0xe85233,_0x49dae8,_0x21b330){_0x21b330(null,path[_0xfab0('0x22')](config[_0xfab0('0x23')],_0xfab0('0x24')));},'filename':function(_0x2744cc,_0x55988d,_0x32d3dc){_0x32d3dc(null,util[_0xfab0('0x25')](_0xfab0('0x26'),Date[_0xfab0('0x27')](),_0x55988d['originalname']));}})});router[_0xfab0('0x1f')](_0xfab0('0x28'),upload[_0xfab0('0x29')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xfab0('0x21')]({'destination':function(_0x15ad99,_0x39b226,_0x377387){_0x377387(null,path[_0xfab0('0x22')](config[_0xfab0('0x23')],_0xfab0('0x2a')));},'filename':function(_0x154005,_0x6fea44,_0x473ef7){_0x473ef7(null,util[_0xfab0('0x25')](_0xfab0('0x26'),Date[_0xfab0('0x27')](),_0x6fea44[_0xfab0('0x2b')]));}})});router[_0xfab0('0x1f')](_0xfab0('0x10'),upload[_0xfab0('0x29')](_0xfab0('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0xfab0('0x21')]({'destination':function(_0x397efb,_0x166ce2,_0x49e025){_0x49e025(null,path['join'](config[_0xfab0('0x23')],_0xfab0('0x2a')));},'filename':function(_0x4cad54,_0x5260d4,_0x148863){_0x148863(null,util[_0xfab0('0x25')](_0xfab0('0x26'),Date[_0xfab0('0x27')](),_0x5260d4[_0xfab0('0x2b')]));}})});router['post'](_0xfab0('0x2d'),upload[_0xfab0('0x29')](_0xfab0('0x2c')),controller[_0xfab0('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x361d80,_0x4c76ed,_0x31c351){_0x31c351(null,path[_0xfab0('0x22')](config['root'],_0xfab0('0x2a')));},'filename':function(_0x1a4688,_0x2dc0db,_0x525eba){_0x525eba(null,util[_0xfab0('0x25')](_0xfab0('0x26'),Date[_0xfab0('0x27')](),_0x2dc0db[_0xfab0('0x2b')]));}})});router[_0xfab0('0x1f')](_0xfab0('0x13'),upload[_0xfab0('0x29')](_0xfab0('0x2c')),controller[_0xfab0('0x2f')]);router[_0xfab0('0x1f')](_0xfab0('0x30'),controller[_0xfab0('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0xfab0('0x21')]({'destination':function(_0x57f7f1,_0x258e12,_0xd5c598){const _0x7a0359=path[_0xfab0('0x22')](config['root'],_0xfab0('0x32'),_0xfab0('0x33'),'offline-chat');fs_extra['ensureDir'](_0x7a0359,function(){_0xd5c598(null,_0x7a0359);});},'filename':function(_0x41501f,_0x203262,_0x1b0cbd){const _0xe7084a=_0x203262[_0xfab0('0x2b')][_0xfab0('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x52e06a=path[_0xfab0('0x35')](_0xe7084a);const _0x14b508=Date[_0xfab0('0x27')]()+'-'+_0xe7084a[_0xfab0('0x34')](_0x52e06a,'')+_0x52e06a;_0x1b0cbd(null,_0x14b508);}})});router[_0xfab0('0x1f')](_0xfab0('0x36'),offlineUploadMulter[_0xfab0('0x37')](),controller[_0xfab0('0x38')]);router[_0xfab0('0x1f')](_0xfab0('0x15'),auth[_0xfab0('0x7')](),controller['addInteraction']);router[_0xfab0('0x1f')](_0xfab0('0x18'),auth['isAuthenticated'](),controller[_0xfab0('0x39')]);router[_0xfab0('0x1f')](_0xfab0('0x1a'),auth[_0xfab0('0x7')](),controller['addProactiveActions']);router[_0xfab0('0x1f')](_0xfab0('0x3a'),auth['isAuthenticated'](),controller[_0xfab0('0x3b')]);router['put'](_0xfab0('0xb'),auth[_0xfab0('0x7')](),controller[_0xfab0('0x3c')]);router[_0xfab0('0x3d')](_0xfab0('0xb'),auth[_0xfab0('0x7')](),controller[_0xfab0('0x3e')]);router['delete'](_0xfab0('0x3f'),auth[_0xfab0('0x7')](),controller[_0xfab0('0x40')]);router[_0xfab0('0x3d')](_0xfab0('0xd'),auth[_0xfab0('0x7')](),controller[_0xfab0('0x41')]);router[_0xfab0('0x3d')](_0xfab0('0x3a'),auth['isAuthenticated'](),controller[_0xfab0('0x42')]);module[_0xfab0('0x43')]=router; \ No newline at end of file +var _0xdceb=['delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','format','%s-%s','now','originalname','single','file','addLogo','join','root','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','notify','attachments','offline-chat','ensureDir','replace','/:id/offline','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','update'];(function(_0x18f5f3,_0x4c952c){var _0x332ef1=function(_0x3c7e0b){while(--_0x3c7e0b){_0x18f5f3['push'](_0x18f5f3['shift']());}};_0x332ef1(++_0x4c952c);}(_0xdceb,0x15c));var _0xbdce=function(_0x278562,_0x2f9204){_0x278562=_0x278562-0x0;var _0x480af8=_0xdceb[_0x278562];return _0x480af8;};'use strict';var multer=require(_0xbdce('0x0'));var util=require(_0xbdce('0x1'));var path=require(_0xbdce('0x2'));var timeout=require(_0xbdce('0x3'));var express=require(_0xbdce('0x4'));var router=express[_0xbdce('0x5')]();var fs_extra=require(_0xbdce('0x6'));var auth=require(_0xbdce('0x7'));var interaction=require(_0xbdce('0x8'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0xbdce('0x9')]('/',auth[_0xbdce('0xa')](),controller[_0xbdce('0xb')]);router['get'](_0xbdce('0xc'),auth[_0xbdce('0xa')](),controller['describe']);router[_0xbdce('0x9')](_0xbdce('0xd'),auth[_0xbdce('0xa')](),controller[_0xbdce('0xe')]);router[_0xbdce('0x9')](_0xbdce('0xf'),auth[_0xbdce('0xa')](),controller[_0xbdce('0x10')]);router[_0xbdce('0x9')](_0xbdce('0x11'),auth[_0xbdce('0xa')](),controller['getAnswers']);router['get'](_0xbdce('0x12'),controller[_0xbdce('0x13')]);router[_0xbdce('0x9')](_0xbdce('0x14'),controller[_0xbdce('0x15')]);router['get'](_0xbdce('0x16'),controller[_0xbdce('0x17')]);router[_0xbdce('0x9')](_0xbdce('0x18'),controller[_0xbdce('0x19')]);router[_0xbdce('0x9')]('/:id/interactions',auth[_0xbdce('0xa')](),controller['getInteractions']);router[_0xbdce('0x9')](_0xbdce('0x1a'),controller[_0xbdce('0x1b')]);router[_0xbdce('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0xbdce('0x1c')]);router['get'](_0xbdce('0x1d'),auth['isAuthenticated'](),controller[_0xbdce('0x1e')]);router['get'](_0xbdce('0x1f'),controller[_0xbdce('0x20')]);router[_0xbdce('0x9')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xbdce('0x21')]);router[_0xbdce('0x9')](_0xbdce('0x22'),auth[_0xbdce('0xa')](),controller[_0xbdce('0x23')]);router[_0xbdce('0x24')]('/',auth[_0xbdce('0xa')](),controller[_0xbdce('0x25')]);router['post'](_0xbdce('0xf'),auth['isAuthenticated'](),controller[_0xbdce('0x26')]);router[_0xbdce('0x24')](_0xbdce('0x11'),auth[_0xbdce('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xbdce('0x27')]({'destination':function(_0x11533d,_0x1dbb1c,_0x3dac33){_0x3dac33(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x35870e,_0x4e8d55,_0x3628fa){_0x3628fa(null,util[_0xbdce('0x28')](_0xbdce('0x29'),Date[_0xbdce('0x2a')](),_0x4e8d55[_0xbdce('0x2b')]));}})});router[_0xbdce('0x24')](_0xbdce('0x12'),upload[_0xbdce('0x2c')](_0xbdce('0x2d')),controller[_0xbdce('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x587a95,_0x2a47d6,_0x3d1233){_0x3d1233(null,path[_0xbdce('0x2f')](config[_0xbdce('0x30')],'server/files/images/avatars/'));},'filename':function(_0x28d630,_0x14dd46,_0x5d16d6){_0x5d16d6(null,util[_0xbdce('0x28')](_0xbdce('0x29'),Date[_0xbdce('0x2a')](),_0x14dd46[_0xbdce('0x2b')]));}})});router[_0xbdce('0x24')](_0xbdce('0x14'),upload[_0xbdce('0x2c')](_0xbdce('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0xbdce('0x27')]({'destination':function(_0x277d58,_0x364860,_0x451149){_0x451149(null,path[_0xbdce('0x2f')](config[_0xbdce('0x30')],_0xbdce('0x31')));},'filename':function(_0x2b2781,_0x5977e4,_0xaf3259){_0xaf3259(null,util[_0xbdce('0x28')]('%s-%s',Date[_0xbdce('0x2a')](),_0x5977e4[_0xbdce('0x2b')]));}})});router[_0xbdce('0x24')](_0xbdce('0x16'),upload['single'](_0xbdce('0x2d')),controller[_0xbdce('0x32')]);var upload=multer({'storage':multer[_0xbdce('0x27')]({'destination':function(_0x5445d8,_0x48fcfd,_0x356f20){_0x356f20(null,path[_0xbdce('0x2f')](config[_0xbdce('0x30')],_0xbdce('0x31')));},'filename':function(_0x571375,_0xf159d4,_0x53bbb0){_0x53bbb0(null,util[_0xbdce('0x28')]('%s-%s',Date['now'](),_0xf159d4[_0xbdce('0x2b')]));}})});router[_0xbdce('0x24')]('/:id/system_avatar',upload[_0xbdce('0x2c')](_0xbdce('0x2d')),controller[_0xbdce('0x33')]);router[_0xbdce('0x24')]('/:id/notify',controller[_0xbdce('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0xbdce('0x27')]({'destination':function(_0x574f90,_0x10bd7d,_0x40acd5){const _0x8d7fcd=path['join'](config[_0xbdce('0x30')],'server/files',_0xbdce('0x35'),_0xbdce('0x36'));fs_extra[_0xbdce('0x37')](_0x8d7fcd,function(){_0x40acd5(null,_0x8d7fcd);});},'filename':function(_0x22063b,_0x4e4cf6,_0x67ba78){const _0x5ad81f=_0x4e4cf6[_0xbdce('0x2b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x10b8bc=path['extname'](_0x5ad81f);const _0x55c99a=Date[_0xbdce('0x2a')]()+'-'+_0x5ad81f[_0xbdce('0x38')](_0x10b8bc,'')+_0x10b8bc;_0x67ba78(null,_0x55c99a);}})});router[_0xbdce('0x24')](_0xbdce('0x39'),offlineUploadMulter['any'](),controller[_0xbdce('0x3a')]);router[_0xbdce('0x24')](_0xbdce('0x3b'),auth[_0xbdce('0xa')](),controller[_0xbdce('0x3c')]);router[_0xbdce('0x24')]('/:id/applications',auth[_0xbdce('0xa')](),controller[_0xbdce('0x3d')]);router[_0xbdce('0x24')](_0xbdce('0x1d'),auth[_0xbdce('0xa')](),controller[_0xbdce('0x3e')]);router[_0xbdce('0x24')](_0xbdce('0x22'),auth[_0xbdce('0xa')](),controller[_0xbdce('0x3f')]);router[_0xbdce('0x40')](_0xbdce('0xd'),auth['isAuthenticated'](),controller[_0xbdce('0x41')]);router[_0xbdce('0x42')](_0xbdce('0xd'),auth[_0xbdce('0xa')](),controller['destroy']);router[_0xbdce('0x42')](_0xbdce('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xbdce('0x42')](_0xbdce('0x11'),auth[_0xbdce('0xa')](),controller['removeAnswers']);router[_0xbdce('0x42')]('/:id/users',auth['isAuthenticated'](),controller[_0xbdce('0x43')]);module[_0xbdce('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index f003a18..373052d 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf550=['expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x14767e,_0x33a047){var _0x2abce9=function(_0x5527b4){while(--_0x5527b4){_0x14767e['push'](_0x14767e['shift']());}};_0x2abce9(++_0x33a047);}(_0xf550,0x1d9));var _0x0f55=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0xf550[_0x53f402];return _0x45a76d;};var beaverLogger=require(_0x0f55('0x0'));var express=require(_0x0f55('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x0f55('0x2')]();var isProduction=config[_0x0f55('0x3')]===_0x0f55('0x4')||![];function clientSideLogs(_0x5e59ac,_0x44e3bc,_0x24f0ac){var _0x3c3e52=_0x5e59ac[_0x0f55('0x5')]['get'](_0x0f55('0x6'));if(!_0x3c3e52){throw new Error(_0x0f55('0x7'));}return beaverLogger[_0x0f55('0x8')]({'uri':_0x0f55('0x9'),'logger':_0x3c3e52,'enableCors':!isProduction})(_0x5e59ac,_0x44e3bc,_0x24f0ac);}router[_0x0f55('0xa')](auth[_0x0f55('0xb')](),clientSideLogs);module[_0x0f55('0xc')]=router; \ No newline at end of file +var _0x7786=['exports','beaver-logger/server','../components/auth/service','Router','env','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated'];(function(_0x50ff3a,_0x69be64){var _0x23fa9f=function(_0x1e88f1){while(--_0x1e88f1){_0x50ff3a['push'](_0x50ff3a['shift']());}};_0x23fa9f(++_0x69be64);}(_0x7786,0x156));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};var beaverLogger=require(_0x6778('0x0'));var express=require('express');var auth=require(_0x6778('0x1'));var config=require('../config/environment');var router=express[_0x6778('0x2')]();var isProduction=config[_0x6778('0x3')]==='production'||![];function clientSideLogs(_0x327667,_0xbc3888,_0x4197b2){var _0x19828b=_0x327667['app'][_0x6778('0x4')](_0x6778('0x5'));if(!_0x19828b){throw new Error(_0x6778('0x6'));}return beaverLogger[_0x6778('0x7')]({'uri':'/client-logs','logger':_0x19828b,'enableCors':!isProduction})(_0x327667,_0xbc3888,_0x4197b2);}router[_0x6778('0x8')](auth[_0x6778('0x9')](),clientSideLogs);module[_0x6778('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e1288ca..f005525 100644 --- a/server/api/cloudProvider/cloudProvider.attributes.js +++ b/server/api/cloudProvider/cloudProvider.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa04=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','STRING'];(function(_0x571fdd,_0x2bc60a){var _0x4f92e7=function(_0x1b7f3b){while(--_0x1b7f3b){_0x571fdd['push'](_0x571fdd['shift']());}};_0x4f92e7(++_0x2bc60a);}(_0xaa04,0x118));var _0x4aa0=function(_0x476dd4,_0x1a59cb){_0x476dd4=_0x476dd4-0x0;var _0x801ef2=_0xaa04[_0x476dd4];return _0x801ef2;};'use strict';var Sequelize=require('sequelize');module[_0x4aa0('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4aa0('0x1')](_0x4aa0('0x2'),_0x4aa0('0x3'),_0x4aa0('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4aa0('0x1')]('Outlook365',_0x4aa0('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0x4aa0('0x6')},'data2':{'type':Sequelize[_0x4aa0('0x7')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0x4aa0('0x8')},'data4':{'type':Sequelize[_0x4aa0('0x7')],'comment':_0x4aa0('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x4aa0('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x4aa0('0xa')],'comment':_0x4aa0('0xb')}}; \ No newline at end of file +var _0xca21=['STRING','ENUM','Google','MicrosoftAzure','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports'];(function(_0x459335,_0x2e95dd){var _0x50f00b=function(_0x5ccdaf){while(--_0x5ccdaf){_0x459335['push'](_0x459335['shift']());}};_0x50f00b(++_0x2e95dd);}(_0xca21,0x110));var _0x1ca2=function(_0x319b4d,_0xb0fd0c){_0x319b4d=_0x319b4d-0x0;var _0x1168dd=_0xca21[_0x319b4d];return _0x1168dd;};'use strict';var Sequelize=require('sequelize');module[_0x1ca2('0x0')]={'name':{'type':Sequelize[_0x1ca2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1ca2('0x2')]('AmazonAWS',_0x1ca2('0x3'),_0x1ca2('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0x1ca2('0x1')],'comment':_0x1ca2('0x5')},'data2':{'type':Sequelize[_0x1ca2('0x1')],'comment':_0x1ca2('0x6')},'data3':{'type':Sequelize[_0x1ca2('0x1')],'comment':_0x1ca2('0x7')},'data4':{'type':Sequelize[_0x1ca2('0x1')],'comment':_0x1ca2('0x8')},'data5':{'type':Sequelize[_0x1ca2('0x9')],'comment':_0x1ca2('0xa')},'data6':{'type':Sequelize[_0x1ca2('0x9')],'comment':_0x1ca2('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0x1ca2('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c3323da..209c880 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d27=['Name\x20parameter\x20not\x20specified','service','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','from','base64','toString','ascii','parse','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','data5','access_token','data6','startRefreshInterval','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','options','CloudProvider','includeAll','include','rows','MicrosoftAzure','decryptString','data3','catch','length','find','create','body'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0x0d27,0x189));var _0x70d2=function(_0x135b97,_0x44bee8){_0x135b97=_0x135b97-0x0;var _0x8f5004=_0x0d27[_0x135b97];return _0x8f5004;};'use strict';var _=require(_0x70d2('0x0'));var Redis=require(_0x70d2('0x1'));var qs=require(_0x70d2('0x2'));var encryptor=require(_0x70d2('0x3'));var config=require('../../config/environment');var logger=require(_0x70d2('0x4'))(_0x70d2('0x5'));var db=require(_0x70d2('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x70d2('0x7')]=_[_0x70d2('0x8')](config['redis'],{'host':_0x70d2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70d2('0x7')]));var redis=new Redis(config[_0x70d2('0x7')]);function respondWithStatusCode(_0x43eac9,_0x1febcd){_0x1febcd=_0x1febcd||0xcc;return function(_0x37b481){if(_0x37b481){return _0x43eac9[_0x70d2('0xa')](_0x1febcd);}return _0x43eac9[_0x70d2('0xb')](_0x1febcd)[_0x70d2('0xc')]();};}function respondWithResult(_0x1c6d8d,_0x54e4f1){_0x54e4f1=_0x54e4f1||0xc8;return function(_0x42940f){if(_0x42940f){return _0x1c6d8d[_0x70d2('0xb')](_0x54e4f1)[_0x70d2('0xd')](_0x42940f);}};}function respondWithFilteredResult(_0x391a72,_0x31ad9a){return function(_0x459884){if(_0x459884){var _0x26f496=typeof _0x31ad9a[_0x70d2('0xe')]==='undefined'&&typeof _0x31ad9a['limit']===_0x70d2('0xf');var _0x4a63d3=_0x459884[_0x70d2('0x10')];var _0x2827a2=_0x26f496?0x0:_0x31ad9a['offset'];var _0x1cd305=_0x26f496?_0x459884['count']:_0x31ad9a[_0x70d2('0xe')]+_0x31ad9a[_0x70d2('0x11')];var _0x49dd5e;if(_0x1cd305>=_0x4a63d3){_0x1cd305=_0x4a63d3;_0x49dd5e=0xc8;}else{_0x49dd5e=0xce;}_0x391a72[_0x70d2('0xb')](_0x49dd5e);return _0x391a72[_0x70d2('0x12')](_0x70d2('0x13'),_0x2827a2+'-'+_0x1cd305+'/'+_0x4a63d3)[_0x70d2('0xd')](_0x459884);}return null;};}function saveUpdates(_0x385d46){return function(_0x3501f2){if(_0x3501f2){return _0x3501f2[_0x70d2('0x14')](_0x385d46)['then'](function(_0x12315d){return _0x12315d;});}return null;};}function removeEntity(_0x528e3d){return function(_0x2ee6a9){if(_0x2ee6a9){return _0x2ee6a9[_0x70d2('0x15')]()[_0x70d2('0x16')](function(){_0x528e3d[_0x70d2('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b71c6){return function(_0x3afe50){if(!_0x3afe50){_0x2b71c6['sendStatus'](0x194);}return _0x3afe50;};}function handleError(_0x2fde8c,_0x26a5f3){_0x26a5f3=_0x26a5f3||0x1f4;return function(_0x4bf77d){logger[_0x70d2('0x17')](_0x4bf77d[_0x70d2('0x18')]);if(_0x4bf77d[_0x70d2('0x19')]){delete _0x4bf77d[_0x70d2('0x19')];}_0x2fde8c[_0x70d2('0xb')](_0x26a5f3)[_0x70d2('0x1a')](_0x4bf77d);};}function maskClientSecret(_0x590e14){return _['padEnd'](_0x590e14['slice'](0x0,0x3),0x14,'*');}exports[_0x70d2('0x1b')]=function(_0x373bc9,_0x49f1bd){var _0x191c1d={},_0x34d472={},_0x11626f={'count':0x0,'rows':[]};var _0x57555a=_[_0x70d2('0x1c')](db['CloudProvider'][_0x70d2('0x1d')],function(_0x32d670){return{'name':_0x32d670['fieldName'],'type':_0x32d670[_0x70d2('0x1e')]['key']};});_0x34d472[_0x70d2('0x1f')]=_[_0x70d2('0x1c')](_0x57555a,_0x70d2('0x19'));_0x34d472[_0x70d2('0x20')]=_[_0x70d2('0x21')](_0x373bc9['query']);_0x34d472[_0x70d2('0x22')]=_[_0x70d2('0x23')](_0x34d472[_0x70d2('0x1f')],_0x34d472[_0x70d2('0x20')]);_0x191c1d[_0x70d2('0x24')]=_[_0x70d2('0x23')](_0x34d472[_0x70d2('0x1f')],qs[_0x70d2('0x25')](_0x373bc9[_0x70d2('0x20')][_0x70d2('0x25')]));_0x191c1d[_0x70d2('0x24')]=_0x191c1d[_0x70d2('0x24')]['length']?_0x191c1d[_0x70d2('0x24')]:_0x34d472['model'];if(!_0x373bc9[_0x70d2('0x20')][_0x70d2('0x26')]('nolimit')){_0x191c1d[_0x70d2('0x11')]=qs[_0x70d2('0x11')](_0x373bc9['query'][_0x70d2('0x11')]);_0x191c1d['offset']=qs[_0x70d2('0xe')](_0x373bc9['query'][_0x70d2('0xe')]);}_0x191c1d['order']=qs[_0x70d2('0x27')](_0x373bc9[_0x70d2('0x20')][_0x70d2('0x27')]);_0x191c1d[_0x70d2('0x28')]=qs[_0x70d2('0x22')](_[_0x70d2('0x29')](_0x373bc9[_0x70d2('0x20')],_0x34d472[_0x70d2('0x22')]),_0x57555a);if(_0x373bc9[_0x70d2('0x20')]['filter']){_0x191c1d[_0x70d2('0x28')]=_['merge'](_0x191c1d[_0x70d2('0x28')],{'$or':_[_0x70d2('0x1c')](_0x57555a,function(_0x25d6ac){if(_0x25d6ac[_0x70d2('0x1e')]!=='VIRTUAL'){var _0x55c11e={};_0x55c11e[_0x25d6ac[_0x70d2('0x19')]]={'$like':'%'+_0x373bc9[_0x70d2('0x20')][_0x70d2('0x2a')]+'%'};return _0x55c11e;}})});}_0x191c1d=_[_0x70d2('0x2b')]({},_0x191c1d,_0x373bc9[_0x70d2('0x2c')]);var _0x1289e5={'where':_0x191c1d[_0x70d2('0x28')]};return db[_0x70d2('0x2d')][_0x70d2('0x10')](_0x1289e5)[_0x70d2('0x16')](function(_0xef81f4){_0x11626f[_0x70d2('0x10')]=_0xef81f4;if(_0x373bc9[_0x70d2('0x20')][_0x70d2('0x2e')]){_0x191c1d[_0x70d2('0x2f')]=[{'all':!![]}];}return db[_0x70d2('0x2d')]['findAll'](_0x191c1d);})['then'](function(_0x4f2c07){_0x11626f[_0x70d2('0x30')]=_[_0x70d2('0x1c')](_0x4f2c07,function(_0x516fc4){if(_0x516fc4['service']===_0x70d2('0x31')){var _0x494a15=encryptor[_0x70d2('0x32')](_0x516fc4['data3']);_0x516fc4[_0x70d2('0x33')]=maskClientSecret(_0x494a15);}return _0x516fc4;});return _0x11626f;})[_0x70d2('0x16')](respondWithFilteredResult(_0x49f1bd,_0x191c1d))[_0x70d2('0x34')](handleError(_0x49f1bd,null));};exports['show']=function(_0x478ac3,_0x41963d){var _0x288b6c={'raw':!![],'where':{'id':_0x478ac3['params']['id']}},_0x3d4aad={};_0x3d4aad[_0x70d2('0x1f')]=_['keys'](db['CloudProvider']['rawAttributes']);_0x3d4aad[_0x70d2('0x20')]=_['keys'](_0x478ac3[_0x70d2('0x20')]);_0x3d4aad[_0x70d2('0x22')]=_[_0x70d2('0x23')](_0x3d4aad[_0x70d2('0x1f')],_0x3d4aad['query']);_0x288b6c[_0x70d2('0x24')]=_['intersection'](_0x3d4aad[_0x70d2('0x1f')],qs[_0x70d2('0x25')](_0x478ac3[_0x70d2('0x20')][_0x70d2('0x25')]));_0x288b6c['attributes']=_0x288b6c[_0x70d2('0x24')][_0x70d2('0x35')]?_0x288b6c[_0x70d2('0x24')]:_0x3d4aad[_0x70d2('0x1f')];if(_0x478ac3[_0x70d2('0x20')][_0x70d2('0x2e')]){_0x288b6c[_0x70d2('0x2f')]=[{'all':!![]}];}_0x288b6c=_[_0x70d2('0x2b')]({},_0x288b6c,_0x478ac3['options']);return db['CloudProvider'][_0x70d2('0x36')](_0x288b6c)['then'](handleEntityNotFound(_0x41963d,null))[_0x70d2('0x16')](function(_0x300d0d){if(_0x300d0d['service']===_0x70d2('0x31')){var _0x2e1819=encryptor[_0x70d2('0x32')](_0x300d0d['data3']);_0x300d0d[_0x70d2('0x33')]=maskClientSecret(_0x2e1819);}return _0x300d0d;})['then'](respondWithResult(_0x41963d,null))[_0x70d2('0x34')](handleError(_0x41963d,null));};exports[_0x70d2('0x37')]=function(_0x5292db,_0x1c1932){if(!_0x5292db[_0x70d2('0x38')][_0x70d2('0x19')])throw new Error(_0x70d2('0x39'));if(!_0x5292db['body'][_0x70d2('0x3a')])throw new Error(_0x70d2('0x3b'));var _0x825ed2=db[_0x70d2('0x2d')][_0x70d2('0x1d')][_0x70d2('0x3a')][_0x70d2('0x3c')];if(!_0x825ed2[_0x70d2('0x3d')](_0x5292db['body'][_0x70d2('0x3a')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x825ed2[_0x70d2('0x3e')](',\x20'));if(_0x5292db['body']['service']===_0x70d2('0x31')&&_0x5292db['body'][_0x70d2('0x33')]){_0x5292db[_0x70d2('0x38')][_0x70d2('0x33')]=encryptor[_0x70d2('0x3f')](_0x5292db[_0x70d2('0x38')][_0x70d2('0x33')]);}return db[_0x70d2('0x2d')]['create'](_0x5292db[_0x70d2('0x38')],{})[_0x70d2('0x16')](respondWithResult(_0x1c1932,0xc9))[_0x70d2('0x34')](handleError(_0x1c1932,null));};exports[_0x70d2('0x14')]=function(_0x5bfc5d,_0x4577db){if(_0x5bfc5d[_0x70d2('0x38')]['id']){delete _0x5bfc5d[_0x70d2('0x38')]['id'];}return db[_0x70d2('0x2d')][_0x70d2('0x36')]({'where':{'id':_0x5bfc5d['params']['id']}})[_0x70d2('0x16')](handleEntityNotFound(_0x4577db,null))['then'](function(_0x5bcd2b){if(_0x5bcd2b['service']==='MicrosoftAzure'&&_0x5bfc5d[_0x70d2('0x38')][_0x70d2('0x33')]){_0x5bfc5d[_0x70d2('0x38')][_0x70d2('0x33')]=encryptor[_0x70d2('0x3f')](_0x5bfc5d['body'][_0x70d2('0x33')]);}return _0x5bcd2b;})[_0x70d2('0x16')](saveUpdates(_0x5bfc5d[_0x70d2('0x38')],null))[_0x70d2('0x16')](respondWithResult(_0x4577db,null))['catch'](handleError(_0x4577db,null));};exports['destroy']=function(_0x2893dc,_0x48ce66){return db[_0x70d2('0x2d')][_0x70d2('0x36')]({'where':{'id':_0x2893dc[_0x70d2('0x40')]['id']}})[_0x70d2('0x16')](handleEntityNotFound(_0x48ce66,null))[_0x70d2('0x16')](removeEntity(_0x48ce66,null))[_0x70d2('0x34')](handleError(_0x48ce66,null));};exports[_0x70d2('0x41')]=function(_0x32c95d,_0x489f9e){return db[_0x70d2('0x2d')][_0x70d2('0x42')]({'where':{'id':_0x32c95d[_0x70d2('0x40')]['id']},'raw':!![]})[_0x70d2('0x16')](function(_0x52fbd7){if(!_0x52fbd7)return _0x489f9e[_0x70d2('0xa')](0x194);return{'url':oauth[_0x70d2('0x43')](_0x52fbd7,_0x32c95d[_0x70d2('0x44')]['id'])};})[_0x70d2('0x16')](respondWithResult(_0x489f9e,null))[_0x70d2('0x34')](handleError(_0x489f9e,null));};exports[_0x70d2('0x45')]=function(_0x2028cf,_0x394199){var _0x43092c=_0x2028cf[_0x70d2('0x38')];var _0x5a330a;var _0x6e4d31;if(_0x43092c['error'])throw _0x43092c;redis['get'](_0x43092c[_0x70d2('0x46')])['then'](function(_0x2e8e6e){if(!_0x2e8e6e)throw new Error('Invalid\x20state\x20parameter');_0x5a330a=JSON['parse'](_0x2e8e6e);var _0x1bf41e=Buffer[_0x70d2('0x47')](_0x43092c[_0x70d2('0x46')],_0x70d2('0x48'))[_0x70d2('0x49')](_0x70d2('0x4a'));_0x6e4d31=JSON[_0x70d2('0x4b')](_0x1bf41e);if(!oauth['isValidIdToken'](_0x43092c[_0x70d2('0x4c')],_0x5a330a[_0x70d2('0x4d')]))throw new Error(_0x70d2('0x4e'));redis['del'](_0x43092c['state']);return oauth[_0x70d2('0x4f')](_0x43092c['code'],_0x5a330a);})[_0x70d2('0x16')](function(_0x1007a3){_0x5a330a[_0x70d2('0x50')]=_0x1007a3[_0x70d2('0x51')];_0x5a330a[_0x70d2('0x52')]=_0x1007a3['refresh_token'];return db['CloudProvider']['update']({'data5':_0x5a330a[_0x70d2('0x50')],'data6':_0x5a330a[_0x70d2('0x52')]},{'where':{'id':_0x5a330a['id']}});})[_0x70d2('0x16')](function(){oauth[_0x70d2('0x53')](_0x5a330a);socket['emit'](_0x70d2('0x54'),{'id':_0x6e4d31['id']});return;})[_0x70d2('0x16')](respondWithStatusCode(_0x394199,null))['catch'](function(_0x2d838a){if(_0x6e4d31){socket['emit'](_0x70d2('0x55'),{'id':_0x6e4d31['id']});}if(!_0x5a330a){logger[_0x70d2('0x17')](_0x70d2('0x56'),_0x2d838a);return _0x394199[_0x70d2('0xb')](0x1f4)['send'](_0x2d838a[_0x70d2('0x57')]);}logger[_0x70d2('0x17')](_0x70d2('0x58'),_0x5a330a['id'],JSON[_0x70d2('0x59')](_0x2d838a));});}; \ No newline at end of file +var _0x8a7e=['includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','data6','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','send','padEnd','slice','index','CloudProvider','fieldName','type','key','model','map','name','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','service','MicrosoftAzure','data3','show','params','rawAttributes','find','decryptString','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values'];(function(_0x10fce2,_0x590d31){var _0xb1a34a=function(_0x51d0cd){while(--_0x51d0cd){_0x10fce2['push'](_0x10fce2['shift']());}};_0xb1a34a(++_0x590d31);}(_0x8a7e,0xe4));var _0xe8a7=function(_0x15732d,_0x16ea2e){_0x15732d=_0x15732d-0x0;var _0x510ad8=_0x8a7e[_0x15732d];return _0x510ad8;};'use strict';var _=require(_0xe8a7('0x0'));var Redis=require('ioredis');var qs=require(_0xe8a7('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0xe8a7('0x2'));var logger=require(_0xe8a7('0x3'))(_0xe8a7('0x4'));var db=require(_0xe8a7('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_['defaults'](config[_0xe8a7('0x6')],{'host':_0xe8a7('0x7'),'port':0x18eb});var socket=require(_0xe8a7('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0xe8a7('0x6')]);function respondWithStatusCode(_0x1a7b6b,_0x2a17ed){_0x2a17ed=_0x2a17ed||0xcc;return function(_0x4e46ec){if(_0x4e46ec){return _0x1a7b6b[_0xe8a7('0x9')](_0x2a17ed);}return _0x1a7b6b[_0xe8a7('0xa')](_0x2a17ed)[_0xe8a7('0xb')]();};}function respondWithResult(_0x138f2e,_0x759f8d){_0x759f8d=_0x759f8d||0xc8;return function(_0x516ef8){if(_0x516ef8){return _0x138f2e[_0xe8a7('0xa')](_0x759f8d)['json'](_0x516ef8);}};}function respondWithFilteredResult(_0x46cf21,_0x19f448){return function(_0x1f69ee){if(_0x1f69ee){var _0xa98fb=typeof _0x19f448[_0xe8a7('0xc')]===_0xe8a7('0xd')&&typeof _0x19f448[_0xe8a7('0xe')]==='undefined';var _0xabfd43=_0x1f69ee[_0xe8a7('0xf')];var _0x18cd0a=_0xa98fb?0x0:_0x19f448[_0xe8a7('0xc')];var _0x197677=_0xa98fb?_0x1f69ee[_0xe8a7('0xf')]:_0x19f448[_0xe8a7('0xc')]+_0x19f448[_0xe8a7('0xe')];var _0xaf1bc7;if(_0x197677>=_0xabfd43){_0x197677=_0xabfd43;_0xaf1bc7=0xc8;}else{_0xaf1bc7=0xce;}_0x46cf21['status'](_0xaf1bc7);return _0x46cf21[_0xe8a7('0x10')](_0xe8a7('0x11'),_0x18cd0a+'-'+_0x197677+'/'+_0xabfd43)[_0xe8a7('0x12')](_0x1f69ee);}return null;};}function saveUpdates(_0x482bc4){return function(_0x52baec){if(_0x52baec){return _0x52baec[_0xe8a7('0x13')](_0x482bc4)[_0xe8a7('0x14')](function(_0x2e9844){return _0x2e9844;});}return null;};}function removeEntity(_0x35ac49){return function(_0x461db6){if(_0x461db6){return _0x461db6[_0xe8a7('0x15')]()[_0xe8a7('0x14')](function(){_0x35ac49['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d27db){return function(_0x2e5e3e){if(!_0x2e5e3e){_0x3d27db[_0xe8a7('0x9')](0x194);}return _0x2e5e3e;};}function handleError(_0x1810b1,_0x3c6a97){_0x3c6a97=_0x3c6a97||0x1f4;return function(_0x3f180c){logger[_0xe8a7('0x16')](_0x3f180c[_0xe8a7('0x17')]);if(_0x3f180c['name']){delete _0x3f180c['name'];}_0x1810b1[_0xe8a7('0xa')](_0x3c6a97)[_0xe8a7('0x18')](_0x3f180c);};}function maskClientSecret(_0x32bf1a){return _[_0xe8a7('0x19')](_0x32bf1a[_0xe8a7('0x1a')](0x0,0x3),0x14,'*');}exports[_0xe8a7('0x1b')]=function(_0x486315,_0x23ab0a){var _0x2b5fe1={},_0x471434={},_0x7adc89={'count':0x0,'rows':[]};var _0x2f1d32=_['map'](db[_0xe8a7('0x1c')]['rawAttributes'],function(_0x294e41){return{'name':_0x294e41[_0xe8a7('0x1d')],'type':_0x294e41[_0xe8a7('0x1e')][_0xe8a7('0x1f')]};});_0x471434[_0xe8a7('0x20')]=_[_0xe8a7('0x21')](_0x2f1d32,_0xe8a7('0x22'));_0x471434[_0xe8a7('0x23')]=_[_0xe8a7('0x24')](_0x486315['query']);_0x471434['filters']=_[_0xe8a7('0x25')](_0x471434['model'],_0x471434[_0xe8a7('0x23')]);_0x2b5fe1[_0xe8a7('0x26')]=_[_0xe8a7('0x25')](_0x471434[_0xe8a7('0x20')],qs[_0xe8a7('0x27')](_0x486315[_0xe8a7('0x23')][_0xe8a7('0x27')]));_0x2b5fe1[_0xe8a7('0x26')]=_0x2b5fe1[_0xe8a7('0x26')][_0xe8a7('0x28')]?_0x2b5fe1[_0xe8a7('0x26')]:_0x471434[_0xe8a7('0x20')];if(!_0x486315['query']['hasOwnProperty']('nolimit')){_0x2b5fe1[_0xe8a7('0xe')]=qs[_0xe8a7('0xe')](_0x486315['query'][_0xe8a7('0xe')]);_0x2b5fe1[_0xe8a7('0xc')]=qs[_0xe8a7('0xc')](_0x486315[_0xe8a7('0x23')][_0xe8a7('0xc')]);}_0x2b5fe1['order']=qs[_0xe8a7('0x29')](_0x486315['query']['sort']);_0x2b5fe1[_0xe8a7('0x2a')]=qs[_0xe8a7('0x2b')](_[_0xe8a7('0x2c')](_0x486315['query'],_0x471434['filters']),_0x2f1d32);if(_0x486315[_0xe8a7('0x23')][_0xe8a7('0x2d')]){_0x2b5fe1[_0xe8a7('0x2a')]=_[_0xe8a7('0x2e')](_0x2b5fe1['where'],{'$or':_[_0xe8a7('0x21')](_0x2f1d32,function(_0x4b72c9){if(_0x4b72c9[_0xe8a7('0x1e')]!==_0xe8a7('0x2f')){var _0x455457={};_0x455457[_0x4b72c9[_0xe8a7('0x22')]]={'$like':'%'+_0x486315['query'][_0xe8a7('0x2d')]+'%'};return _0x455457;}})});}_0x2b5fe1=_[_0xe8a7('0x2e')]({},_0x2b5fe1,_0x486315[_0xe8a7('0x30')]);var _0x84dd05={'where':_0x2b5fe1['where']};return db[_0xe8a7('0x1c')][_0xe8a7('0xf')](_0x84dd05)[_0xe8a7('0x14')](function(_0x3efc82){_0x7adc89['count']=_0x3efc82;if(_0x486315['query'][_0xe8a7('0x31')]){_0x2b5fe1[_0xe8a7('0x32')]=[{'all':!![]}];}return db[_0xe8a7('0x1c')][_0xe8a7('0x33')](_0x2b5fe1);})['then'](function(_0x515e21){_0x7adc89['rows']=_[_0xe8a7('0x21')](_0x515e21,function(_0x495fed){if(_0x495fed[_0xe8a7('0x34')]===_0xe8a7('0x35')){var _0x3a3e42=encryptor['decryptString'](_0x495fed[_0xe8a7('0x36')]);_0x495fed[_0xe8a7('0x36')]=maskClientSecret(_0x3a3e42);}return _0x495fed;});return _0x7adc89;})[_0xe8a7('0x14')](respondWithFilteredResult(_0x23ab0a,_0x2b5fe1))['catch'](handleError(_0x23ab0a,null));};exports[_0xe8a7('0x37')]=function(_0x5e9ddb,_0xf3ff04){var _0xd9d34e={'raw':!![],'where':{'id':_0x5e9ddb[_0xe8a7('0x38')]['id']}},_0x114cc0={};_0x114cc0[_0xe8a7('0x20')]=_['keys'](db[_0xe8a7('0x1c')][_0xe8a7('0x39')]);_0x114cc0[_0xe8a7('0x23')]=_[_0xe8a7('0x24')](_0x5e9ddb[_0xe8a7('0x23')]);_0x114cc0[_0xe8a7('0x2b')]=_[_0xe8a7('0x25')](_0x114cc0['model'],_0x114cc0[_0xe8a7('0x23')]);_0xd9d34e[_0xe8a7('0x26')]=_[_0xe8a7('0x25')](_0x114cc0[_0xe8a7('0x20')],qs[_0xe8a7('0x27')](_0x5e9ddb[_0xe8a7('0x23')]['fields']));_0xd9d34e[_0xe8a7('0x26')]=_0xd9d34e[_0xe8a7('0x26')][_0xe8a7('0x28')]?_0xd9d34e[_0xe8a7('0x26')]:_0x114cc0[_0xe8a7('0x20')];if(_0x5e9ddb['query'][_0xe8a7('0x31')]){_0xd9d34e[_0xe8a7('0x32')]=[{'all':!![]}];}_0xd9d34e=_['merge']({},_0xd9d34e,_0x5e9ddb[_0xe8a7('0x30')]);return db[_0xe8a7('0x1c')][_0xe8a7('0x3a')](_0xd9d34e)['then'](handleEntityNotFound(_0xf3ff04,null))['then'](function(_0x6ca37){if(_0x6ca37[_0xe8a7('0x34')]===_0xe8a7('0x35')){var _0x3e83ef=encryptor[_0xe8a7('0x3b')](_0x6ca37[_0xe8a7('0x36')]);_0x6ca37[_0xe8a7('0x36')]=maskClientSecret(_0x3e83ef);}return _0x6ca37;})[_0xe8a7('0x14')](respondWithResult(_0xf3ff04,null))[_0xe8a7('0x3c')](handleError(_0xf3ff04,null));};exports[_0xe8a7('0x3d')]=function(_0x27846d,_0x22712c){if(!_0x27846d[_0xe8a7('0x3e')]['name'])throw new Error(_0xe8a7('0x3f'));if(!_0x27846d[_0xe8a7('0x3e')][_0xe8a7('0x34')])throw new Error(_0xe8a7('0x40'));var _0x499a39=db[_0xe8a7('0x1c')][_0xe8a7('0x39')][_0xe8a7('0x34')][_0xe8a7('0x41')];if(!_0x499a39[_0xe8a7('0x42')](_0x27846d['body']['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x499a39[_0xe8a7('0x43')](',\x20'));if(_0x27846d['body'][_0xe8a7('0x34')]===_0xe8a7('0x35')&&_0x27846d[_0xe8a7('0x3e')][_0xe8a7('0x36')]){_0x27846d[_0xe8a7('0x3e')]['data3']=encryptor[_0xe8a7('0x44')](_0x27846d['body']['data3']);}return db[_0xe8a7('0x1c')][_0xe8a7('0x3d')](_0x27846d['body'],{})[_0xe8a7('0x14')](respondWithResult(_0x22712c,0xc9))['catch'](handleError(_0x22712c,null));};exports[_0xe8a7('0x13')]=function(_0x198d83,_0x44ba59){if(_0x198d83[_0xe8a7('0x3e')]['id']){delete _0x198d83[_0xe8a7('0x3e')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x198d83[_0xe8a7('0x38')]['id']}})[_0xe8a7('0x14')](handleEntityNotFound(_0x44ba59,null))['then'](function(_0x3c4ec1){if(_0x3c4ec1[_0xe8a7('0x34')]==='MicrosoftAzure'&&_0x198d83[_0xe8a7('0x3e')]['data3']){_0x198d83['body'][_0xe8a7('0x36')]=encryptor[_0xe8a7('0x44')](_0x198d83[_0xe8a7('0x3e')][_0xe8a7('0x36')]);}return _0x3c4ec1;})[_0xe8a7('0x14')](saveUpdates(_0x198d83[_0xe8a7('0x3e')],null))[_0xe8a7('0x14')](respondWithResult(_0x44ba59,null))[_0xe8a7('0x3c')](handleError(_0x44ba59,null));};exports['destroy']=function(_0x57b57f,_0x559439){return db['CloudProvider'][_0xe8a7('0x3a')]({'where':{'id':_0x57b57f[_0xe8a7('0x38')]['id']}})[_0xe8a7('0x14')](handleEntityNotFound(_0x559439,null))[_0xe8a7('0x14')](removeEntity(_0x559439,null))[_0xe8a7('0x3c')](handleError(_0x559439,null));};exports[_0xe8a7('0x45')]=function(_0xc5953a,_0x3d9e1f){return db['CloudProvider'][_0xe8a7('0x46')]({'where':{'id':_0xc5953a[_0xe8a7('0x38')]['id']},'raw':!![]})[_0xe8a7('0x14')](function(_0x3dad17){if(!_0x3dad17)return _0x3d9e1f[_0xe8a7('0x9')](0x194);return{'url':oauth[_0xe8a7('0x47')](_0x3dad17,_0xc5953a[_0xe8a7('0x48')]['id'])};})['then'](respondWithResult(_0x3d9e1f,null))[_0xe8a7('0x3c')](handleError(_0x3d9e1f,null));};exports[_0xe8a7('0x49')]=function(_0x2f229d,_0x502551){var _0x1b149f=_0x2f229d[_0xe8a7('0x3e')];var _0x356e9c;var _0x24ca61;if(_0x1b149f[_0xe8a7('0x16')])throw _0x1b149f;redis[_0xe8a7('0x4a')](_0x1b149f[_0xe8a7('0x4b')])[_0xe8a7('0x14')](function(_0x11b8c1){if(!_0x11b8c1)throw new Error(_0xe8a7('0x4c'));_0x356e9c=JSON[_0xe8a7('0x4d')](_0x11b8c1);var _0x16f679=Buffer[_0xe8a7('0x4e')](_0x1b149f[_0xe8a7('0x4b')],_0xe8a7('0x4f'))[_0xe8a7('0x50')](_0xe8a7('0x51'));_0x24ca61=JSON[_0xe8a7('0x4d')](_0x16f679);if(!oauth[_0xe8a7('0x52')](_0x1b149f[_0xe8a7('0x53')],_0x356e9c[_0xe8a7('0x54')]))throw new Error(_0xe8a7('0x55'));redis['del'](_0x1b149f['state']);return oauth[_0xe8a7('0x56')](_0x1b149f[_0xe8a7('0x57')],_0x356e9c);})['then'](function(_0x194367){_0x356e9c[_0xe8a7('0x58')]=_0x194367[_0xe8a7('0x59')];_0x356e9c['data6']=_0x194367[_0xe8a7('0x5a')];return db[_0xe8a7('0x1c')]['update']({'data5':_0x356e9c[_0xe8a7('0x58')],'data6':_0x356e9c[_0xe8a7('0x5b')]},{'where':{'id':_0x356e9c['id']}});})[_0xe8a7('0x14')](function(){oauth['startRefreshInterval'](_0x356e9c);socket[_0xe8a7('0x5c')](_0xe8a7('0x5d'),{'id':_0x24ca61['id']});return;})[_0xe8a7('0x14')](respondWithStatusCode(_0x502551,null))['catch'](function(_0x58f87d){if(_0x24ca61){socket[_0xe8a7('0x5c')]('microsoftAuthorization:error',{'id':_0x24ca61['id']});}if(!_0x356e9c){logger['error'](_0xe8a7('0x5e'),_0x58f87d);return _0x502551[_0xe8a7('0xa')](0x1f4)[_0xe8a7('0x18')](_0x58f87d[_0xe8a7('0x5f')]);}logger[_0xe8a7('0x16')](_0xe8a7('0x60'),_0x356e9c['id'],JSON[_0xe8a7('0x61')](_0x58f87d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 45bb5d4..e188ca5 100644 --- a/server/api/cloudProvider/cloudProvider.model.js +++ b/server/api/cloudProvider/cloudProvider.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe8e=['./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4cdd96,_0x373b18){var _0x48fe61=function(_0x24dd3e){while(--_0x24dd3e){_0x4cdd96['push'](_0x4cdd96['shift']());}};_0x48fe61(++_0x373b18);}(_0xfe8e,0x148));var _0xefe8=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xfe8e[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0xefe8('0x0'));var util=require(_0xefe8('0x1'));var logger=require(_0xefe8('0x2'))(_0xefe8('0x3'));var moment=require(_0xefe8('0x4'));var BPromise=require('bluebird');var rp=require(_0xefe8('0x5'));var fs=require('fs');var path=require(_0xefe8('0x6'));var rimraf=require(_0xefe8('0x7'));var config=require('../../config/environment');var attributes=require(_0xefe8('0x8'));module[_0xefe8('0x9')]=function(_0x2854b9,_0x3d7630){return _0x2854b9[_0xefe8('0xa')](_0xefe8('0xb'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe0f=['request-promise','path','rimraf','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird'];(function(_0x4a058f,_0x2a556e){var _0x20a69e=function(_0x43fd6d){while(--_0x43fd6d){_0x4a058f['push'](_0x4a058f['shift']());}};_0x20a69e(++_0x2a556e);}(_0xfe0f,0x73));var _0xffe0=function(_0x393572,_0x29dfad){_0x393572=_0x393572-0x0;var _0x147e07=_0xfe0f[_0x393572];return _0x147e07;};'use strict';var _=require(_0xffe0('0x0'));var util=require(_0xffe0('0x1'));var logger=require(_0xffe0('0x2'))(_0xffe0('0x3'));var moment=require('moment');var BPromise=require(_0xffe0('0x4'));var rp=require(_0xffe0('0x5'));var fs=require('fs');var path=require(_0xffe0('0x6'));var rimraf=require(_0xffe0('0x7'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0xffe0('0x8')]=function(_0x4d5c1d,_0x34dda2){return _0x4d5c1d[_0xffe0('0x9')](_0xffe0('0xa'),attributes,{'tableName':_0xffe0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 1c66106..3b73183 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf24=['refresh_token','data6','decryptString','{TENANT_ID}','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','data7','join','Outlook365','replace','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','data4','response_mode','scope','state','prompt','key','oauth2/','set','decode','payload','iss','issuer','aud','nonce','unix','data3','CloudProvider','findOne','then'];(function(_0x40a206,_0x46f2c2){var _0x52dabc=function(_0x5c354b){while(--_0x5c354b){_0x40a206['push'](_0x40a206['shift']());}};_0x52dabc(++_0x46f2c2);}(_0xaf24,0x18d));var _0x4af2=function(_0x55b728,_0xe943c2){_0x55b728=_0x55b728-0x0;var _0x54773f=_0xaf24[_0x55b728];return _0x54773f;};'use strict';var _=require(_0x4af2('0x0'));var crypto=require(_0x4af2('0x1'));var jwt=require(_0x4af2('0x2'));var moment=require(_0x4af2('0x3'));var Redis=require('ioredis');var rp=require(_0x4af2('0x4'));var util=require(_0x4af2('0x5'));var encryptor=require(_0x4af2('0x6'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x4af2('0x7'));var schedule=require(_0x4af2('0x8'));var db=require(_0x4af2('0x9'))['db'];config[_0x4af2('0xa')]=_[_0x4af2('0xb')](config[_0x4af2('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x4af2('0xa')]);var MICROSOFT_AUTH_URL=_0x4af2('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x4af2('0xd'),_0x4af2('0xe'),'email',_0x4af2('0xf'),_0x4af2('0x10'),_0x4af2('0x11'),_0x4af2('0x12')],'Dynamics365':[_0x4af2('0xd'),_0x4af2('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x4af2('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x82b3b2){var _0x5ec76b=_[_0x4af2('0x14')](AZURE_AUTH_SCOPES[_0x82b3b2[_0x4af2('0x15')]]);if(_0x82b3b2[_0x4af2('0x15')]===_0x4af2('0x16'))_0x5ec76b[_0x4af2('0x17')](_0x82b3b2[_0x4af2('0x18')]+'/.default');return _0x5ec76b[_0x4af2('0x19')]('\x20');}function getAccessTokenScope(_0x41b8b7){if(_0x41b8b7[_0x4af2('0x15')]===_0x4af2('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x41b8b7[_0x4af2('0x15')]===_0x4af2('0x16'))return _0x41b8b7['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x533031,_0x464129){var _0x676bfa=MICROSOFT_AUTH_URL[_0x4af2('0x1b')]('{TENANT_ID}',_0x533031[_0x4af2('0x1c')]);var _0x345d40=[_0x4af2('0x1d'),_0x4af2('0x1e')];var _0x17c20c=Buffer[_0x4af2('0x1f')](JSON[_0x4af2('0x20')]({'id':_0x464129}))[_0x4af2('0x21')](_0x4af2('0x22'));var _0x2f07d2=crypto[_0x4af2('0x23')](0x10)[_0x4af2('0x21')](_0x4af2('0x24'));var _0x2e54cc=getAuthorizationScopes(_0x533031);var _0x431b98=[{'key':_0x4af2('0x25'),'value':_0x533031[_0x4af2('0x26')]},{'key':_0x4af2('0x27'),'value':encodeURIComponent(_0x345d40['join']('\x20'))},{'key':'redirect_uri','value':_0x533031[_0x4af2('0x28')]},{'key':_0x4af2('0x29'),'value':'form_post'},{'key':_0x4af2('0x2a'),'value':encodeURIComponent(_0x2e54cc)},{'key':_0x4af2('0x2b'),'value':_0x17c20c},{'key':'nonce','value':_0x2f07d2},{'key':_0x4af2('0x2c'),'value':'login'}];var _0xf810a=_0x676bfa+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x4af2('0x14')](_0x431b98,function(_0x3b896e){return _0x3b896e[_0x4af2('0x2d')]+'='+_0x3b896e['value'];})[_0x4af2('0x19')]('&');_0x533031['oauth2Claims']={'issuer':_0x676bfa[_0x4af2('0x1b')](_0x4af2('0x2e'),''),'audience':_0x533031[_0x4af2('0x26')],'state':_0x17c20c,'nonce':_0x2f07d2};redis[_0x4af2('0x2f')](_0x17c20c,JSON[_0x4af2('0x20')](_0x533031));return _0xf810a;}function isValidIdToken(_0x9f4dfe,_0x49f395){try{var _0x356bcb=jwt[_0x4af2('0x30')](_0x9f4dfe,{'complete':!![]});var _0x50ea97=_0x356bcb[_0x4af2('0x31')];if(_0x50ea97[_0x4af2('0x32')]!==_0x49f395[_0x4af2('0x33')])return![];if(_0x50ea97[_0x4af2('0x34')]!==_0x49f395['audience'])return![];if(_0x50ea97[_0x4af2('0x35')]!==_0x49f395[_0x4af2('0x35')])return![];if(moment()['isAfter'](moment[_0x4af2('0x36')](_0x50ea97['exp'])))return![];return!![];}catch(_0x5ee3e9){throw _0x5ee3e9;}}function refreshOauth2MicrosoftAccessToken(_0x100129){return Promise['resolve']()['then'](function(){if(_0x100129[_0x4af2('0x37')])return _0x100129;return db[_0x4af2('0x38')][_0x4af2('0x39')]({'where':{'id':_0x100129['id']},'raw':!![]});})[_0x4af2('0x3a')](function(_0x8c9fc0){var _0x59fa10={'grant_type':_0x4af2('0x3b'),'refresh_token':_0x8c9fc0[_0x4af2('0x3c')],'scope':getAccessTokenScope(_0x8c9fc0),'redirect_uri':_0x8c9fc0['data4'],'client_id':_0x8c9fc0[_0x4af2('0x26')],'client_secret':encryptor[_0x4af2('0x3d')](_0x8c9fc0[_0x4af2('0x37')])};var _0x443e6b={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x4af2('0x1b')](_0x4af2('0x3e'),_0x8c9fc0[_0x4af2('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x59fa10,'json':!![]};return rp(_0x443e6b);})[_0x4af2('0x3a')](function(_0x4ff0d1){_0x100129[_0x4af2('0x3f')]=_0x4ff0d1[_0x4af2('0x40')];_0x100129[_0x4af2('0x3c')]=_0x4ff0d1[_0x4af2('0x3b')];return db[_0x4af2('0x38')][_0x4af2('0x41')]({'data5':_0x100129[_0x4af2('0x3f')],'data6':_0x100129[_0x4af2('0x3c')]},{'where':{'id':_0x100129['id']}});})[_0x4af2('0x3a')](function(){return _0x100129;})[_0x4af2('0x42')](function(_0x139d20){logger[_0x4af2('0x43')](_0x4af2('0x44'),_0x100129['id'],_0x139d20);});}function getOauth2MicrosoftAccessToken(_0x461c7a,_0x21501b){var _0xf711c5={'grant_type':_0x4af2('0x45'),'code':_0x461c7a,'scope':getAccessTokenScope(_0x21501b),'redirect_uri':_0x21501b[_0x4af2('0x28')],'client_id':_0x21501b[_0x4af2('0x26')],'client_secret':encryptor['decryptString'](_0x21501b[_0x4af2('0x37')])};var _0x1069ee={'method':_0x4af2('0x46'),'uri':MICROSOFT_AUTH_URL[_0x4af2('0x1b')]('{TENANT_ID}',_0x21501b[_0x4af2('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xf711c5,'json':!![]};return rp(_0x1069ee);}function startRefreshInterval(_0x1fabad){var _0x41d9fd=schedule[_0x4af2('0x47')];if(_0x41d9fd[_0x1fabad['id']])clearInterval(_0x41d9fd[_0x1fabad['id']]);_0x41d9fd[_0x1fabad['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x4af2('0x48')](this,{'id':_0x1fabad['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x41d9fd;}function startAllRefreshIntervals(){return db[_0x4af2('0x38')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x4af2('0x3a')](function(_0x11095e){var _0x32ac8d=_0x11095e[_0x4af2('0x14')](function(_0x10974b){return refreshOauth2MicrosoftAccessToken(_0x10974b)[_0x4af2('0x3a')](function(_0x4f156b){startRefreshInterval(_0x4f156b);});});return Promise[_0x4af2('0x49')](_0x32ac8d);})[_0x4af2('0x42')](function(_0x17c225){var _0x5c9c4e=_0x17c225?util[_0x4af2('0x4a')](_0x17c225,{'showHidden':![],'depth':null}):'';logger[_0x4af2('0x43')](_0x4af2('0x4b'),_0x5c9c4e);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xa8ec=['map','type','Dynamics365','push','/.default','join','replace','data2','id_token','from','stringify','toString','randomBytes','hex','client_id','data1','response_type','data4','scope','state','nonce','prompt','key','set','iss','aud','audience','isAfter','unix','exp','resolve','findOne','then','data3','POST','{TENANT_ID}','data5','access_token','data6','refresh_token','CloudProvider','update','catch','authorization_code','decryptString','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token'];(function(_0x26fa43,_0x30a86c){var _0x81ca8d=function(_0x65bfd2){while(--_0x65bfd2){_0x26fa43['push'](_0x26fa43['shift']());}};_0x81ca8d(++_0x30a86c);}(_0xa8ec,0xc7));var _0xca8e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xa8ec[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xca8e('0x0'));var crypto=require(_0xca8e('0x1'));var jwt=require(_0xca8e('0x2'));var moment=require(_0xca8e('0x3'));var Redis=require(_0xca8e('0x4'));var rp=require(_0xca8e('0x5'));var util=require('util');var encryptor=require(_0xca8e('0x6'));var config=require('../../config/environment');var logger=require('../../config/logger')('api');var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0xca8e('0x7')]=_[_0xca8e('0x8')](config[_0xca8e('0x7')],{'host':_0xca8e('0x9'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xca8e('0xa');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xca8e('0xb'),_0xca8e('0xc'),_0xca8e('0xd'),_0xca8e('0xe'),_0xca8e('0xf'),_0xca8e('0x10')],'Dynamics365':[_0xca8e('0x11'),_0xca8e('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0xca8e('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xca8e('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1c27a7){var _0x3ad394=_[_0xca8e('0x14')](AZURE_AUTH_SCOPES[_0x1c27a7[_0xca8e('0x15')]]);if(_0x1c27a7[_0xca8e('0x15')]===_0xca8e('0x16'))_0x3ad394[_0xca8e('0x17')](_0x1c27a7['data7']+_0xca8e('0x18'));return _0x3ad394[_0xca8e('0x19')]('\x20');}function getAccessTokenScope(_0x47184b){if(_0x47184b[_0xca8e('0x15')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x47184b[_0xca8e('0x15')]===_0xca8e('0x16'))return _0x47184b['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x52068a,_0x3cebef){var _0x5adcce=MICROSOFT_AUTH_URL[_0xca8e('0x1a')]('{TENANT_ID}',_0x52068a[_0xca8e('0x1b')]);var _0x52a1d7=['code',_0xca8e('0x1c')];var _0x39f073=Buffer[_0xca8e('0x1d')](JSON[_0xca8e('0x1e')]({'id':_0x3cebef}))[_0xca8e('0x1f')]('base64');var _0x546ca1=crypto[_0xca8e('0x20')](0x10)['toString'](_0xca8e('0x21'));var _0xbba71b=getAuthorizationScopes(_0x52068a);var _0x48c817=[{'key':_0xca8e('0x22'),'value':_0x52068a[_0xca8e('0x23')]},{'key':_0xca8e('0x24'),'value':encodeURIComponent(_0x52a1d7[_0xca8e('0x19')]('\x20'))},{'key':'redirect_uri','value':_0x52068a[_0xca8e('0x25')]},{'key':'response_mode','value':'form_post'},{'key':_0xca8e('0x26'),'value':encodeURIComponent(_0xbba71b)},{'key':_0xca8e('0x27'),'value':_0x39f073},{'key':_0xca8e('0x28'),'value':_0x546ca1},{'key':_0xca8e('0x29'),'value':'login'}];var _0x597bf8=_0x5adcce+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xca8e('0x14')](_0x48c817,function(_0x53fa94){return _0x53fa94[_0xca8e('0x2a')]+'='+_0x53fa94['value'];})[_0xca8e('0x19')]('&');_0x52068a['oauth2Claims']={'issuer':_0x5adcce[_0xca8e('0x1a')]('oauth2/',''),'audience':_0x52068a[_0xca8e('0x23')],'state':_0x39f073,'nonce':_0x546ca1};redis[_0xca8e('0x2b')](_0x39f073,JSON['stringify'](_0x52068a));return _0x597bf8;}function isValidIdToken(_0x274752,_0x2d3ad9){try{var _0x978b1=jwt['decode'](_0x274752,{'complete':!![]});var _0x2df582=_0x978b1['payload'];if(_0x2df582[_0xca8e('0x2c')]!==_0x2d3ad9['issuer'])return![];if(_0x2df582[_0xca8e('0x2d')]!==_0x2d3ad9[_0xca8e('0x2e')])return![];if(_0x2df582[_0xca8e('0x28')]!==_0x2d3ad9[_0xca8e('0x28')])return![];if(moment()[_0xca8e('0x2f')](moment[_0xca8e('0x30')](_0x2df582[_0xca8e('0x31')])))return![];return!![];}catch(_0x49c103){throw _0x49c103;}}function refreshOauth2MicrosoftAccessToken(_0x2344ce){return Promise[_0xca8e('0x32')]()['then'](function(){if(_0x2344ce['data3'])return _0x2344ce;return db['CloudProvider'][_0xca8e('0x33')]({'where':{'id':_0x2344ce['id']},'raw':!![]});})[_0xca8e('0x34')](function(_0x183cba){var _0x227538={'grant_type':'refresh_token','refresh_token':_0x183cba['data6'],'scope':getAccessTokenScope(_0x183cba),'redirect_uri':_0x183cba[_0xca8e('0x25')],'client_id':_0x183cba[_0xca8e('0x23')],'client_secret':encryptor['decryptString'](_0x183cba[_0xca8e('0x35')])};var _0x4d8c1b={'method':_0xca8e('0x36'),'uri':MICROSOFT_AUTH_URL[_0xca8e('0x1a')](_0xca8e('0x37'),_0x183cba[_0xca8e('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x227538,'json':!![]};return rp(_0x4d8c1b);})[_0xca8e('0x34')](function(_0x5b883d){_0x2344ce[_0xca8e('0x38')]=_0x5b883d[_0xca8e('0x39')];_0x2344ce[_0xca8e('0x3a')]=_0x5b883d[_0xca8e('0x3b')];return db[_0xca8e('0x3c')][_0xca8e('0x3d')]({'data5':_0x2344ce[_0xca8e('0x38')],'data6':_0x2344ce[_0xca8e('0x3a')]},{'where':{'id':_0x2344ce['id']}});})[_0xca8e('0x34')](function(){return _0x2344ce;})[_0xca8e('0x3e')](function(_0x553468){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x2344ce['id'],_0x553468);});}function getOauth2MicrosoftAccessToken(_0x1c69ed,_0x36a22f){var _0x3851ad={'grant_type':_0xca8e('0x3f'),'code':_0x1c69ed,'scope':getAccessTokenScope(_0x36a22f),'redirect_uri':_0x36a22f[_0xca8e('0x25')],'client_id':_0x36a22f[_0xca8e('0x23')],'client_secret':encryptor[_0xca8e('0x40')](_0x36a22f[_0xca8e('0x35')])};var _0x4515e9={'method':'POST','uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x36a22f[_0xca8e('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3851ad,'json':!![]};return rp(_0x4515e9);}function startRefreshInterval(_0x171560){var _0x253044=schedule[_0xca8e('0x41')];if(_0x253044[_0x171560['id']])clearInterval(_0x253044[_0x171560['id']]);_0x253044[_0x171560['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xca8e('0x42')](this,{'id':_0x171560['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xca8e('0x41')]=_0x253044;}function startAllRefreshIntervals(){return db[_0xca8e('0x3c')][_0xca8e('0x43')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xca8e('0x34')](function(_0x2f07c0){var _0x3a0928=_0x2f07c0[_0xca8e('0x14')](function(_0x1d835a){return refreshOauth2MicrosoftAccessToken(_0x1d835a)[_0xca8e('0x34')](function(_0x8d49d0){startRefreshInterval(_0x8d49d0);});});return Promise[_0xca8e('0x44')](_0x3a0928);})['catch'](function(_0x8a77df){var _0x1f24d7=_0x8a77df?util[_0xca8e('0x45')](_0x8a77df,{'showHidden':![],'depth':null}):'';logger[_0xca8e('0x46')](_0xca8e('0x47'),_0x1f24d7);});}module[_0xca8e('0x48')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 1aee72e..687322e 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c91=['client','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0x3c91,0x1af));var _0x13c9=function(_0x4c45d4,_0x388987){_0x4c45d4=_0x4c45d4-0x0;var _0x1ee8be=_0x3c91[_0x4c45d4];return _0x1ee8be;};'use strict';var _=require(_0x13c9('0x0'));var util=require(_0x13c9('0x1'));var moment=require(_0x13c9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13c9('0x3'));var db=require(_0x13c9('0x4'))['db'];var utils=require(_0x13c9('0x5'));var logger=require('../../config/logger')(_0x13c9('0x6'));var config=require(_0x13c9('0x7'));var jayson=require(_0x13c9('0x8'));var client=jayson[_0x13c9('0x9')][_0x13c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4332,_0x58b610,_0x44243f){return new BPromise(function(_0x196c2a,_0x5fd23){return client[_0x13c9('0xb')](_0x4c4332,_0x44243f)[_0x13c9('0xc')](function(_0x5370dd){logger['info'](_0x13c9('0xd'),_0x58b610,_0x13c9('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x58b610,_0x13c9('0xe'),JSON[_0x13c9('0xf')](_0x5370dd));if(_0x5370dd[_0x13c9('0x10')]){if(_0x5370dd[_0x13c9('0x10')][_0x13c9('0x11')]===0x1f4){logger[_0x13c9('0x10')](_0x13c9('0xd'),_0x58b610,_0x5370dd['error'][_0x13c9('0x12')]);return _0x5fd23(_0x5370dd['error']['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x58b610,_0x5370dd['error'][_0x13c9('0x12')]);return _0x196c2a(_0x5370dd[_0x13c9('0x10')]['message']);}else{logger[_0x13c9('0x13')](_0x13c9('0xd'),_0x58b610,_0x13c9('0xe'));_0x196c2a(_0x5370dd[_0x13c9('0x14')][_0x13c9('0x12')]);}})[_0x13c9('0x15')](function(_0x238952){logger['error']('CloudProvider,\x20%s,\x20%s',_0x58b610,_0x238952);_0x5fd23(_0x238952);});});} \ No newline at end of file +var _0xcac3=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4c525c,_0x4668a1){var _0x14a634=function(_0x467b4b){while(--_0x467b4b){_0x4c525c['push'](_0x4c525c['shift']());}};_0x14a634(++_0x4668a1);}(_0xcac3,0x193));var _0x3cac=function(_0x12156e,_0x550b21){_0x12156e=_0x12156e-0x0;var _0x55ada7=_0xcac3[_0x12156e];return _0x55ada7;};'use strict';var _=require('lodash');var util=require(_0x3cac('0x0'));var moment=require(_0x3cac('0x1'));var BPromise=require(_0x3cac('0x2'));var rs=require(_0x3cac('0x3'));var fs=require('fs');var Redis=require(_0x3cac('0x4'));var db=require(_0x3cac('0x5'))['db'];var utils=require(_0x3cac('0x6'));var logger=require(_0x3cac('0x7'))(_0x3cac('0x8'));var config=require(_0x3cac('0x9'));var jayson=require(_0x3cac('0xa'));var client=jayson[_0x3cac('0xb')][_0x3cac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e2560,_0x14562c,_0x21365c){return new BPromise(function(_0x13c1b9,_0x55670d){return client[_0x3cac('0xd')](_0x1e2560,_0x21365c)[_0x3cac('0xe')](function(_0x3bcbed){logger[_0x3cac('0xf')](_0x3cac('0x10'),_0x14562c,'request\x20sent');logger[_0x3cac('0x11')](_0x3cac('0x12'),_0x14562c,_0x3cac('0x13'),JSON[_0x3cac('0x14')](_0x3bcbed));if(_0x3bcbed[_0x3cac('0x15')]){if(_0x3bcbed['error']['code']===0x1f4){logger[_0x3cac('0x15')](_0x3cac('0x10'),_0x14562c,_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);return _0x55670d(_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);}logger[_0x3cac('0x15')]('CloudProvider,\x20%s,\x20%s',_0x14562c,_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);return _0x13c1b9(_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);}else{logger[_0x3cac('0xf')](_0x3cac('0x10'),_0x14562c,_0x3cac('0x13'));_0x13c1b9(_0x3bcbed[_0x3cac('0x17')][_0x3cac('0x16')]);}})[_0x3cac('0x18')](function(_0x4173ca){logger[_0x3cac('0x15')](_0x3cac('0x10'),_0x14562c,_0x4173ca);_0x55670d(_0x4173ca);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5b05a45..78e452f 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x11fc7b,_0x1434e6){var _0x4080e6=function(_0x54ccb0){while(--_0x54ccb0){_0x11fc7b['push'](_0x11fc7b['shift']());}};_0x4080e6(++_0x1434e6);}(_0xdb28,0x106));var _0x8db2=function(_0x4b1edb,_0x39f6d6){_0x4b1edb=_0x4b1edb-0x0;var _0x1c7bb9=_0xdb28[_0x4b1edb];return _0x1c7bb9;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x7a54,0x106));var _0x47a5=function(_0x85abec,_0x4c1b3b){_0x85abec=_0x85abec-0x0;var _0x17cdf9=_0x7a54[_0x85abec];return _0x17cdf9;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index b965a78..f74bda9 100644 --- a/server/api/cmCompany/cmCompany.attributes.js +++ b/server/api/cmCompany/cmCompany.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6b4=['sequelize','exports','STRING'];(function(_0xd8fc2d,_0x1c3f81){var _0x281c9e=function(_0x4df715){while(--_0x4df715){_0xd8fc2d['push'](_0xd8fc2d['shift']());}};_0x281c9e(++_0x1c3f81);}(_0xd6b4,0xb4));var _0x4d6b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd6b4[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4d6b('0x0'));module[_0x4d6b('0x1')]={'name':{'type':Sequelize[_0x4d6b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4d6b('0x2')]},'companyId':{'type':Sequelize[_0x4d6b('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4d6b('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d6b('0x2')]},'street':{'type':Sequelize[_0x4d6b('0x2')]},'postalCode':{'type':Sequelize[_0x4d6b('0x2')]},'city':{'type':Sequelize[_0x4d6b('0x2')]},'country':{'type':Sequelize[_0x4d6b('0x2')]},'email':{'type':Sequelize[_0x4d6b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4d6b('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x4d6b('0x2')]},'sCountry':{'type':Sequelize[_0x4d6b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8225=['sequelize','exports','STRING'];(function(_0x595852,_0x27d446){var _0x245346=function(_0xce6edd){while(--_0xce6edd){_0x595852['push'](_0x595852['shift']());}};_0x245346(++_0x27d446);}(_0x8225,0x87));var _0x5822=function(_0x19f8b6,_0x2b4e8c){_0x19f8b6=_0x19f8b6-0x0;var _0x213ebc=_0x8225[_0x19f8b6];return _0x213ebc;};'use strict';var Sequelize=require(_0x5822('0x0'));module[_0x5822('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x5822('0x2')]},'website':{'type':Sequelize[_0x5822('0x2')]},'phone':{'type':Sequelize[_0x5822('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5822('0x2')]},'street':{'type':Sequelize[_0x5822('0x2')]},'postalCode':{'type':Sequelize[_0x5822('0x2')]},'city':{'type':Sequelize[_0x5822('0x2')]},'country':{'type':Sequelize[_0x5822('0x2')]},'email':{'type':Sequelize[_0x5822('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5822('0x2')]},'sStreet':{'type':Sequelize[_0x5822('0x2')]},'sPostalCode':{'type':Sequelize[_0x5822('0x2')]},'sCity':{'type':Sequelize[_0x5822('0x2')]},'sCountry':{'type':Sequelize[_0x5822('0x2')]},'description':{'type':Sequelize[_0x5822('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b959d78..d3ff73c 100644 --- a/server/api/cmCompany/cmCompany.controller.js +++ b/server/api/cmCompany/cmCompany.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99ee=['role','userProfileId','autoAssociation','UserProfileResource','params','addContacts','CmContact','ids','getContacts','findOne','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','destroy','get','Companies','then','error','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x522a0c,_0x32ba4e){var _0x194106=function(_0x5691ac){while(--_0x5691ac){_0x522a0c['push'](_0x522a0c['shift']());}};_0x194106(++_0x32ba4e);}(_0x99ee,0x157));var _0xe99e=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x99ee[_0xaa6a4];return _0xdc31a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe99e('0x0'));var zipdir=require(_0xe99e('0x1'));var jsonpatch=require(_0xe99e('0x2'));var rp=require(_0xe99e('0x3'));var moment=require('moment');var BPromise=require(_0xe99e('0x4'));var Mustache=require('mustache');var util=require(_0xe99e('0x5'));var path=require('path');var sox=require(_0xe99e('0x6'));var csv=require(_0xe99e('0x7'));var ejs=require(_0xe99e('0x8'));var fs=require('fs');var fs_extra=require(_0xe99e('0x9'));var _=require(_0xe99e('0xa'));var squel=require('squel');var crypto=require(_0xe99e('0xb'));var jsforce=require(_0xe99e('0xc'));var deskjs=require(_0xe99e('0xd'));var toCsv=require(_0xe99e('0x7'));var querystring=require('querystring');var Papa=require(_0xe99e('0xe'));var Redis=require(_0xe99e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe99e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe99e('0x11'))(_0xe99e('0x12'));var utils=require(_0xe99e('0x13'));var config=require(_0xe99e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe99e('0x15'))['db'];function respondWithStatusCode(_0x2aa1d9,_0x33ea2a){_0x33ea2a=_0x33ea2a||0xcc;return function(_0x27a3d4){if(_0x27a3d4){return _0x2aa1d9[_0xe99e('0x16')](_0x33ea2a);}return _0x2aa1d9[_0xe99e('0x17')](_0x33ea2a)[_0xe99e('0x18')]();};}function respondWithResult(_0x2c8f53,_0x53da2e){_0x53da2e=_0x53da2e||0xc8;return function(_0x2c3299){if(_0x2c3299){return _0x2c8f53['status'](_0x53da2e)['json'](_0x2c3299);}};}function respondWithFilteredResult(_0x1fb223,_0x17e057){return function(_0x528a05){if(_0x528a05){var _0x4b0ad6=typeof _0x17e057[_0xe99e('0x19')]===_0xe99e('0x1a')&&typeof _0x17e057[_0xe99e('0x1b')]===_0xe99e('0x1a');var _0x3156d3=_0x528a05['count'];var _0x54688f=_0x4b0ad6?0x0:_0x17e057[_0xe99e('0x19')];var _0x5e252c=_0x4b0ad6?_0x528a05[_0xe99e('0x1c')]:_0x17e057[_0xe99e('0x19')]+_0x17e057['limit'];var _0x540733;if(_0x5e252c>=_0x3156d3){_0x5e252c=_0x3156d3;_0x540733=0xc8;}else{_0x540733=0xce;}_0x1fb223['status'](_0x540733);return _0x1fb223['set'](_0xe99e('0x1d'),_0x54688f+'-'+_0x5e252c+'/'+_0x3156d3)['json'](_0x528a05);}return null;};}function patchUpdates(_0x29d840){return function(_0x33785f){try{jsonpatch['apply'](_0x33785f,_0x29d840,!![]);}catch(_0x28cff8){return BPromise[_0xe99e('0x1e')](_0x28cff8);}return _0x33785f[_0xe99e('0x1f')]();};}function saveUpdates(_0x10a9ec,_0x5cfd97){return function(_0xf32ac){if(_0xf32ac){return _0xf32ac['update'](_0x10a9ec)['then'](function(_0x271f28){return _0x271f28;});}return null;};}function removeEntity(_0xabe043,_0x432ce1){return function(_0x43360b){if(_0x43360b){return _0x43360b[_0xe99e('0x20')]()['then'](function(){var _0x442365=_0x43360b[_0xe99e('0x21')]({'plain':!![]});var _0x3b3a9a=_0xe99e('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b3a9a,'resourceId':_0x442365['id']}})[_0xe99e('0x23')](function(){return _0x43360b;});})[_0xe99e('0x23')](function(){_0xabe043['status'](0xcc)[_0xe99e('0x18')]();});}};}function handleEntityNotFound(_0x209ea7,_0x54a5ba){return function(_0x12bf5c){if(!_0x12bf5c){_0x209ea7[_0xe99e('0x16')](0x194);}return _0x12bf5c;};}function handleError(_0x21711b,_0x79edd9){_0x79edd9=_0x79edd9||0x1f4;return function(_0x139ab3){logger[_0xe99e('0x24')](_0x139ab3[_0xe99e('0x25')]);if(_0x139ab3[_0xe99e('0x26')]){delete _0x139ab3['name'];}_0x21711b[_0xe99e('0x17')](_0x79edd9)[_0xe99e('0x27')](_0x139ab3);};}exports[_0xe99e('0x28')]=function(_0x566e39,_0x38082e){var _0x9da73d={},_0x2c8c62={},_0x37a374={'count':0x0,'rows':[]};return db[_0xe99e('0x29')][_0xe99e('0x2a')]()[_0xe99e('0x23')](function(_0x2e0c54){_0x2c8c62[_0xe99e('0x2b')]=_['keys'](_0x2e0c54);_0x2c8c62[_0xe99e('0x2c')]=_[_0xe99e('0x2d')](_0x566e39[_0xe99e('0x2c')]);_0x2c8c62[_0xe99e('0x2e')]=_[_0xe99e('0x2f')](_0x2c8c62[_0xe99e('0x2b')],_0x2c8c62[_0xe99e('0x2c')]);_0x9da73d['attributes']=_[_0xe99e('0x2f')](_0x2c8c62[_0xe99e('0x2b')],qs[_0xe99e('0x30')](_0x566e39['query'][_0xe99e('0x30')]));_0x9da73d[_0xe99e('0x31')]=_0x9da73d['attributes'][_0xe99e('0x32')]?_0x9da73d[_0xe99e('0x31')]:_0x2c8c62[_0xe99e('0x2b')];if(!_0x566e39[_0xe99e('0x2c')][_0xe99e('0x33')]('nolimit')){_0x9da73d[_0xe99e('0x1b')]=qs[_0xe99e('0x1b')](_0x566e39['query'][_0xe99e('0x1b')]);_0x9da73d[_0xe99e('0x19')]=qs[_0xe99e('0x19')](_0x566e39[_0xe99e('0x2c')][_0xe99e('0x19')]);}_0x9da73d[_0xe99e('0x34')]=qs[_0xe99e('0x35')](_0x566e39['query'][_0xe99e('0x35')]);_0x9da73d[_0xe99e('0x36')]=qs[_0xe99e('0x2e')](_[_0xe99e('0x37')](_0x566e39['query'],_0x2c8c62[_0xe99e('0x2e')]),_0x2e0c54);if(_0x566e39[_0xe99e('0x2c')][_0xe99e('0x38')]){_0x9da73d[_0xe99e('0x36')]=_[_0xe99e('0x39')](_0x9da73d[_0xe99e('0x36')],{'$or':_[_0xe99e('0x3a')](_0x9da73d[_0xe99e('0x31')],function(_0x21fa60){var _0x49c70a={};_0x49c70a[_0x21fa60]={'$like':'%'+_0x566e39['query']['filter']+'%'};return _0x49c70a;})});}_0x9da73d=_['merge']({},_0x9da73d,_0x566e39[_0xe99e('0x3b')]);var _0x411e5a={'where':_0x9da73d['where']};return db[_0xe99e('0x29')][_0xe99e('0x1c')](_0x411e5a)[_0xe99e('0x23')](function(_0x4b788b){_0x37a374['count']=_0x4b788b;if(_0x566e39[_0xe99e('0x2c')][_0xe99e('0x3c')]){_0x9da73d[_0xe99e('0x3d')]=[{'all':!![]}];}return db[_0xe99e('0x29')][_0xe99e('0x3e')](_0x9da73d);})[_0xe99e('0x23')](function(_0x1f5af4){_0x37a374[_0xe99e('0x3f')]=_0x1f5af4;return _0x37a374;})[_0xe99e('0x23')](respondWithFilteredResult(_0x38082e,_0x9da73d))[_0xe99e('0x40')](handleError(_0x38082e,null));})['catch'](handleError(_0x38082e,null));};exports[_0xe99e('0x41')]=function(_0xdc4438,_0x4408fe){var _0x3cced4={'raw':![],'where':{'id':_0xdc4438['params']['id']}},_0x5c124d={};_0x5c124d[_0xe99e('0x2b')]=_[_0xe99e('0x2d')](db['CmCompany'][_0xe99e('0x42')]);_0x5c124d[_0xe99e('0x2c')]=_[_0xe99e('0x2d')](_0xdc4438['query']);_0x5c124d['filters']=_[_0xe99e('0x2f')](_0x5c124d[_0xe99e('0x2b')],_0x5c124d[_0xe99e('0x2c')]);_0x3cced4['attributes']=_[_0xe99e('0x2f')](_0x5c124d[_0xe99e('0x2b')],qs[_0xe99e('0x30')](_0xdc4438[_0xe99e('0x2c')][_0xe99e('0x30')]));_0x3cced4[_0xe99e('0x31')]=_0x3cced4[_0xe99e('0x31')]['length']?_0x3cced4[_0xe99e('0x31')]:_0x5c124d[_0xe99e('0x2b')];if(_0xdc4438[_0xe99e('0x2c')]['includeAll']){_0x3cced4[_0xe99e('0x3d')]=[{'all':!![]}];}_0x3cced4=_[_0xe99e('0x39')]({},_0x3cced4,_0xdc4438[_0xe99e('0x3b')]);return db[_0xe99e('0x29')][_0xe99e('0x43')](_0x3cced4)['then'](handleEntityNotFound(_0x4408fe,null))[_0xe99e('0x23')](respondWithResult(_0x4408fe,null))['catch'](handleError(_0x4408fe,null));};exports[_0xe99e('0x44')]=function(_0x52a010,_0x55ffc8){return db[_0xe99e('0x29')]['create'](_0x52a010[_0xe99e('0x45')],{})[_0xe99e('0x23')](function(_0x12554f){var _0xd558c4=_0x52a010[_0xe99e('0x46')][_0xe99e('0x21')]({'plain':!![]});if(!_0xd558c4)throw new Error(_0xe99e('0x47'));if(_0xd558c4[_0xe99e('0x48')]==='user'){var _0x71aa43=_0x12554f['get']({'plain':!![]});var _0x35f231=_0xe99e('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x35f231,'userProfileId':_0xd558c4[_0xe99e('0x49')]},'raw':!![]})[_0xe99e('0x23')](function(_0x9058d9){if(_0x9058d9&&_0x9058d9[_0xe99e('0x4a')]===0x0){return db[_0xe99e('0x4b')][_0xe99e('0x44')]({'name':_0x71aa43[_0xe99e('0x26')],'resourceId':_0x71aa43['id'],'type':_0x9058d9[_0xe99e('0x26')],'sectionId':_0x9058d9['id']},{})[_0xe99e('0x23')](function(){return _0x12554f;});}else{return _0x12554f;}})[_0xe99e('0x40')](function(_0x342fc0){logger[_0xe99e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x342fc0);throw _0x342fc0;});}return _0x12554f;})[_0xe99e('0x23')](respondWithResult(_0x55ffc8,0xc9))[_0xe99e('0x40')](handleError(_0x55ffc8,null));};exports['update']=function(_0x5928f3,_0x121492){if(_0x5928f3[_0xe99e('0x45')]['id']){delete _0x5928f3[_0xe99e('0x45')]['id'];}return db[_0xe99e('0x29')][_0xe99e('0x43')]({'where':{'id':_0x5928f3['params']['id']}})[_0xe99e('0x23')](handleEntityNotFound(_0x121492,null))[_0xe99e('0x23')](saveUpdates(_0x5928f3[_0xe99e('0x45')],null))[_0xe99e('0x23')](respondWithResult(_0x121492,null))['catch'](handleError(_0x121492,null));};exports[_0xe99e('0x20')]=function(_0xffa9e6,_0x36ad97){return db[_0xe99e('0x29')]['find']({'where':{'id':_0xffa9e6[_0xe99e('0x4c')]['id']}})[_0xe99e('0x23')](handleEntityNotFound(_0x36ad97,null))[_0xe99e('0x23')](removeEntity(_0x36ad97,null))['catch'](handleError(_0x36ad97,null));};exports['describe']=function(_0xd77be9,_0x230f02){return db[_0xe99e('0x29')]['describe']()[_0xe99e('0x23')](respondWithResult(_0x230f02,null))[_0xe99e('0x40')](handleError(_0x230f02,null));};exports[_0xe99e('0x4d')]=function(_0x27593e,_0x37cc70,_0x488457){return db[_0xe99e('0x4e')][_0xe99e('0x43')]({'where':{'id':_0x27593e[_0xe99e('0x4c')]['id']}})[_0xe99e('0x23')](handleEntityNotFound(_0x37cc70,null))[_0xe99e('0x23')](function(_0x155656){if(_0x155656){return _0x155656[_0xe99e('0x4d')](_0x27593e[_0xe99e('0x45')]['ids'],_['omit'](_0x27593e[_0xe99e('0x45')],[_0xe99e('0x4f'),'id'])||{});}})[_0xe99e('0x23')](respondWithResult(_0x37cc70,null))[_0xe99e('0x40')](handleError(_0x37cc70,null));};exports[_0xe99e('0x50')]=function(_0x199566,_0x28c495,_0x34b871){var _0x24ee36={};var _0x440343={};var _0x430678;var _0x23bc14;return db[_0xe99e('0x29')][_0xe99e('0x51')]({'where':{'id':_0x199566[_0xe99e('0x4c')]['id']}})[_0xe99e('0x23')](handleEntityNotFound(_0x28c495,null))[_0xe99e('0x23')](function(_0x32a3e7){if(_0x32a3e7){_0x430678=_0x32a3e7;_0x440343[_0xe99e('0x2b')]=_['keys'](db[_0xe99e('0x4e')][_0xe99e('0x42')]);_0x440343[_0xe99e('0x2c')]=_[_0xe99e('0x2d')](_0x199566[_0xe99e('0x2c')]);_0x440343[_0xe99e('0x2e')]=_[_0xe99e('0x2f')](_0x440343[_0xe99e('0x2b')],_0x440343[_0xe99e('0x2c')]);_0x24ee36[_0xe99e('0x31')]=_[_0xe99e('0x2f')](_0x440343[_0xe99e('0x2b')],qs[_0xe99e('0x30')](_0x199566[_0xe99e('0x2c')][_0xe99e('0x30')]));_0x24ee36['attributes']=_0x24ee36['attributes']['length']?_0x24ee36[_0xe99e('0x31')]:_0x440343['model'];_0x24ee36[_0xe99e('0x34')]=qs['sort'](_0x199566[_0xe99e('0x2c')][_0xe99e('0x35')]);_0x24ee36[_0xe99e('0x36')]=qs[_0xe99e('0x2e')](_['pick'](_0x199566['query'],_0x440343['filters']));if(_0x199566['query']['filter']){_0x24ee36[_0xe99e('0x36')]=_[_0xe99e('0x39')](_0x24ee36[_0xe99e('0x36')],{'$or':_['map'](_0x24ee36[_0xe99e('0x31')],function(_0x378753){var _0x42c9d1={};_0x42c9d1[_0x378753]={'$like':'%'+_0x199566[_0xe99e('0x2c')][_0xe99e('0x38')]+'%'};return _0x42c9d1;})});}_0x24ee36=_['merge']({},_0x24ee36,_0x199566[_0xe99e('0x3b')]);return _0x430678['getContacts'](_0x24ee36);}})[_0xe99e('0x23')](function(_0x5a7ea5){if(_0x5a7ea5){_0x23bc14=_0x5a7ea5[_0xe99e('0x32')];if(!_0x199566[_0xe99e('0x2c')][_0xe99e('0x33')](_0xe99e('0x52'))){_0x24ee36[_0xe99e('0x1b')]=qs['limit'](_0x199566[_0xe99e('0x2c')][_0xe99e('0x1b')]);_0x24ee36[_0xe99e('0x19')]=qs[_0xe99e('0x19')](_0x199566[_0xe99e('0x2c')][_0xe99e('0x19')]);}return _0x430678[_0xe99e('0x50')](_0x24ee36);}})[_0xe99e('0x23')](function(_0x308d20){if(_0x308d20){return _0x308d20?{'count':_0x23bc14,'rows':_0x308d20}:null;}})[_0xe99e('0x23')](respondWithResult(_0x28c495,null))[_0xe99e('0x40')](handleError(_0x28c495,null));}; \ No newline at end of file +var _0x167b=['apply','save','update','then','destroy','get','UserProfileResource','name','send','index','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','getContacts','findOne','rawAttributes','order','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x5c110c,_0x58d08b){var _0x485822=function(_0xb98557){while(--_0xb98557){_0x5c110c['push'](_0x5c110c['shift']());}};_0x485822(++_0x58d08b);}(_0x167b,0x196));var _0xb167=function(_0x597f41,_0x1922f6){_0x597f41=_0x597f41-0x0;var _0x3cdbc1=_0x167b[_0x597f41];return _0x3cdbc1;};'use strict';var emlformat=require(_0xb167('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb167('0x1'));var rp=require(_0xb167('0x2'));var moment=require(_0xb167('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb167('0x4'));var util=require(_0xb167('0x5'));var path=require(_0xb167('0x6'));var sox=require(_0xb167('0x7'));var csv=require(_0xb167('0x8'));var ejs=require(_0xb167('0x9'));var fs=require('fs');var fs_extra=require(_0xb167('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb167('0xb'));var jsforce=require(_0xb167('0xc'));var deskjs=require(_0xb167('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb167('0xe'));var Papa=require(_0xb167('0xf'));var Redis=require(_0xb167('0x10'));var authService=require(_0xb167('0x11'));var qs=require(_0xb167('0x12'));var as=require(_0xb167('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb167('0x14'))(_0xb167('0x15'));var utils=require('../../config/utils');var config=require(_0xb167('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb167('0x17'))['db'];function respondWithStatusCode(_0x1ab865,_0x4c904c){_0x4c904c=_0x4c904c||0xcc;return function(_0x2ea3c2){if(_0x2ea3c2){return _0x1ab865[_0xb167('0x18')](_0x4c904c);}return _0x1ab865[_0xb167('0x19')](_0x4c904c)[_0xb167('0x1a')]();};}function respondWithResult(_0x4a4284,_0x402263){_0x402263=_0x402263||0xc8;return function(_0x35246d){if(_0x35246d){return _0x4a4284['status'](_0x402263)[_0xb167('0x1b')](_0x35246d);}};}function respondWithFilteredResult(_0x51c7ae,_0x229f3d){return function(_0x156854){if(_0x156854){var _0x566b00=typeof _0x229f3d['offset']===_0xb167('0x1c')&&typeof _0x229f3d[_0xb167('0x1d')]===_0xb167('0x1c');var _0x1f10fa=_0x156854[_0xb167('0x1e')];var _0x151146=_0x566b00?0x0:_0x229f3d[_0xb167('0x1f')];var _0x550c90=_0x566b00?_0x156854[_0xb167('0x1e')]:_0x229f3d[_0xb167('0x1f')]+_0x229f3d['limit'];var _0x9ab4e1;if(_0x550c90>=_0x1f10fa){_0x550c90=_0x1f10fa;_0x9ab4e1=0xc8;}else{_0x9ab4e1=0xce;}_0x51c7ae[_0xb167('0x19')](_0x9ab4e1);return _0x51c7ae[_0xb167('0x20')](_0xb167('0x21'),_0x151146+'-'+_0x550c90+'/'+_0x1f10fa)[_0xb167('0x1b')](_0x156854);}return null;};}function patchUpdates(_0x3bff61){return function(_0x24d65a){try{jsonpatch[_0xb167('0x22')](_0x24d65a,_0x3bff61,!![]);}catch(_0x197972){return BPromise['reject'](_0x197972);}return _0x24d65a[_0xb167('0x23')]();};}function saveUpdates(_0x4489a4,_0x4d2cf2){return function(_0x528cae){if(_0x528cae){return _0x528cae[_0xb167('0x24')](_0x4489a4)[_0xb167('0x25')](function(_0x59d1a6){return _0x59d1a6;});}return null;};}function removeEntity(_0x595a75,_0x57f310){return function(_0x14c3f2){if(_0x14c3f2){return _0x14c3f2[_0xb167('0x26')]()[_0xb167('0x25')](function(){var _0x3d3777=_0x14c3f2[_0xb167('0x27')]({'plain':!![]});var _0x1cabaa='Companies';return db[_0xb167('0x28')][_0xb167('0x26')]({'where':{'type':_0x1cabaa,'resourceId':_0x3d3777['id']}})['then'](function(){return _0x14c3f2;});})[_0xb167('0x25')](function(){_0x595a75[_0xb167('0x19')](0xcc)[_0xb167('0x1a')]();});}};}function handleEntityNotFound(_0x529733,_0xb19774){return function(_0x241b82){if(!_0x241b82){_0x529733[_0xb167('0x18')](0x194);}return _0x241b82;};}function handleError(_0x3a977a,_0x504c06){_0x504c06=_0x504c06||0x1f4;return function(_0x52b590){logger['error'](_0x52b590['stack']);if(_0x52b590[_0xb167('0x29')]){delete _0x52b590[_0xb167('0x29')];}_0x3a977a['status'](_0x504c06)[_0xb167('0x2a')](_0x52b590);};}exports[_0xb167('0x2b')]=function(_0x2b6889,_0x79f71e){var _0x5e44b3={},_0xfa25d1={},_0x491dd4={'count':0x0,'rows':[]};return db['CmCompany'][_0xb167('0x2c')]()[_0xb167('0x25')](function(_0x44c384){_0xfa25d1[_0xb167('0x2d')]=_[_0xb167('0x2e')](_0x44c384);_0xfa25d1[_0xb167('0x2f')]=_[_0xb167('0x2e')](_0x2b6889[_0xb167('0x2f')]);_0xfa25d1[_0xb167('0x30')]=_[_0xb167('0x31')](_0xfa25d1[_0xb167('0x2d')],_0xfa25d1[_0xb167('0x2f')]);_0x5e44b3['attributes']=_[_0xb167('0x31')](_0xfa25d1[_0xb167('0x2d')],qs[_0xb167('0x32')](_0x2b6889['query'][_0xb167('0x32')]));_0x5e44b3[_0xb167('0x33')]=_0x5e44b3[_0xb167('0x33')][_0xb167('0x34')]?_0x5e44b3[_0xb167('0x33')]:_0xfa25d1[_0xb167('0x2d')];if(!_0x2b6889['query'][_0xb167('0x35')](_0xb167('0x36'))){_0x5e44b3[_0xb167('0x1d')]=qs[_0xb167('0x1d')](_0x2b6889[_0xb167('0x2f')]['limit']);_0x5e44b3[_0xb167('0x1f')]=qs[_0xb167('0x1f')](_0x2b6889[_0xb167('0x2f')][_0xb167('0x1f')]);}_0x5e44b3['order']=qs[_0xb167('0x37')](_0x2b6889['query'][_0xb167('0x37')]);_0x5e44b3[_0xb167('0x38')]=qs['filters'](_[_0xb167('0x39')](_0x2b6889[_0xb167('0x2f')],_0xfa25d1[_0xb167('0x30')]),_0x44c384);if(_0x2b6889['query'][_0xb167('0x3a')]){_0x5e44b3[_0xb167('0x38')]=_[_0xb167('0x3b')](_0x5e44b3[_0xb167('0x38')],{'$or':_[_0xb167('0x3c')](_0x5e44b3[_0xb167('0x33')],function(_0x1e7091){var _0x134ef0={};_0x134ef0[_0x1e7091]={'$like':'%'+_0x2b6889['query'][_0xb167('0x3a')]+'%'};return _0x134ef0;})});}_0x5e44b3=_[_0xb167('0x3b')]({},_0x5e44b3,_0x2b6889[_0xb167('0x3d')]);var _0xbdc696={'where':_0x5e44b3[_0xb167('0x38')]};return db[_0xb167('0x3e')][_0xb167('0x1e')](_0xbdc696)['then'](function(_0x578d9d){_0x491dd4[_0xb167('0x1e')]=_0x578d9d;if(_0x2b6889[_0xb167('0x2f')][_0xb167('0x3f')]){_0x5e44b3[_0xb167('0x40')]=[{'all':!![]}];}return db[_0xb167('0x3e')][_0xb167('0x41')](_0x5e44b3);})['then'](function(_0x50d266){_0x491dd4[_0xb167('0x42')]=_0x50d266;return _0x491dd4;})[_0xb167('0x25')](respondWithFilteredResult(_0x79f71e,_0x5e44b3))[_0xb167('0x43')](handleError(_0x79f71e,null));})['catch'](handleError(_0x79f71e,null));};exports[_0xb167('0x44')]=function(_0x303356,_0xd5bc5d){var _0x6090f={'raw':![],'where':{'id':_0x303356[_0xb167('0x45')]['id']}},_0x593c04={};_0x593c04['model']=_[_0xb167('0x2e')](db[_0xb167('0x3e')]['rawAttributes']);_0x593c04[_0xb167('0x2f')]=_[_0xb167('0x2e')](_0x303356[_0xb167('0x2f')]);_0x593c04[_0xb167('0x30')]=_[_0xb167('0x31')](_0x593c04[_0xb167('0x2d')],_0x593c04[_0xb167('0x2f')]);_0x6090f[_0xb167('0x33')]=_[_0xb167('0x31')](_0x593c04[_0xb167('0x2d')],qs[_0xb167('0x32')](_0x303356['query']['fields']));_0x6090f[_0xb167('0x33')]=_0x6090f[_0xb167('0x33')][_0xb167('0x34')]?_0x6090f[_0xb167('0x33')]:_0x593c04[_0xb167('0x2d')];if(_0x303356[_0xb167('0x2f')][_0xb167('0x3f')]){_0x6090f[_0xb167('0x40')]=[{'all':!![]}];}_0x6090f=_[_0xb167('0x3b')]({},_0x6090f,_0x303356['options']);return db[_0xb167('0x3e')]['find'](_0x6090f)[_0xb167('0x25')](handleEntityNotFound(_0xd5bc5d,null))[_0xb167('0x25')](respondWithResult(_0xd5bc5d,null))[_0xb167('0x43')](handleError(_0xd5bc5d,null));};exports[_0xb167('0x46')]=function(_0x44140b,_0x5bb196){return db[_0xb167('0x3e')]['create'](_0x44140b[_0xb167('0x47')],{})['then'](function(_0x410987){var _0x2ec6e9=_0x44140b[_0xb167('0x48')][_0xb167('0x27')]({'plain':!![]});if(!_0x2ec6e9)throw new Error(_0xb167('0x49'));if(_0x2ec6e9[_0xb167('0x4a')]===_0xb167('0x48')){var _0x23f17c=_0x410987[_0xb167('0x27')]({'plain':!![]});var _0x111ca8=_0xb167('0x4b');return db[_0xb167('0x4c')][_0xb167('0x4d')]({'where':{'name':_0x111ca8,'userProfileId':_0x2ec6e9[_0xb167('0x4e')]},'raw':!![]})['then'](function(_0x410db1){if(_0x410db1&&_0x410db1['autoAssociation']===0x0){return db['UserProfileResource'][_0xb167('0x46')]({'name':_0x23f17c['name'],'resourceId':_0x23f17c['id'],'type':_0x410db1[_0xb167('0x29')],'sectionId':_0x410db1['id']},{})[_0xb167('0x25')](function(){return _0x410987;});}else{return _0x410987;}})[_0xb167('0x43')](function(_0x369e49){logger[_0xb167('0x4f')](_0xb167('0x50'),_0x369e49);throw _0x369e49;});}return _0x410987;})['then'](respondWithResult(_0x5bb196,0xc9))['catch'](handleError(_0x5bb196,null));};exports[_0xb167('0x24')]=function(_0x12fa18,_0x44ba2f){if(_0x12fa18[_0xb167('0x47')]['id']){delete _0x12fa18[_0xb167('0x47')]['id'];}return db[_0xb167('0x3e')][_0xb167('0x4d')]({'where':{'id':_0x12fa18['params']['id']}})[_0xb167('0x25')](handleEntityNotFound(_0x44ba2f,null))[_0xb167('0x25')](saveUpdates(_0x12fa18[_0xb167('0x47')],null))['then'](respondWithResult(_0x44ba2f,null))[_0xb167('0x43')](handleError(_0x44ba2f,null));};exports[_0xb167('0x26')]=function(_0x4f6faa,_0x4873fa){return db[_0xb167('0x3e')][_0xb167('0x4d')]({'where':{'id':_0x4f6faa['params']['id']}})[_0xb167('0x25')](handleEntityNotFound(_0x4873fa,null))[_0xb167('0x25')](removeEntity(_0x4873fa,null))[_0xb167('0x43')](handleError(_0x4873fa,null));};exports['describe']=function(_0x5f4579,_0x345dc9){return db['CmCompany']['describe']()[_0xb167('0x25')](respondWithResult(_0x345dc9,null))['catch'](handleError(_0x345dc9,null));};exports['addContacts']=function(_0x417bc2,_0x2af850,_0x181a04){return db[_0xb167('0x51')]['find']({'where':{'id':_0x417bc2[_0xb167('0x45')]['id']}})[_0xb167('0x25')](handleEntityNotFound(_0x2af850,null))[_0xb167('0x25')](function(_0x2a9e52){if(_0x2a9e52){return _0x2a9e52[_0xb167('0x52')](_0x417bc2[_0xb167('0x47')][_0xb167('0x53')],_['omit'](_0x417bc2[_0xb167('0x47')],[_0xb167('0x53'),'id'])||{});}})[_0xb167('0x25')](respondWithResult(_0x2af850,null))[_0xb167('0x43')](handleError(_0x2af850,null));};exports[_0xb167('0x54')]=function(_0x5b936f,_0x1106b3,_0x2d65c9){var _0x21cd99={};var _0x4ec1d5={};var _0x215b4e;var _0x573184;return db[_0xb167('0x3e')][_0xb167('0x55')]({'where':{'id':_0x5b936f[_0xb167('0x45')]['id']}})['then'](handleEntityNotFound(_0x1106b3,null))[_0xb167('0x25')](function(_0x1c6c27){if(_0x1c6c27){_0x215b4e=_0x1c6c27;_0x4ec1d5[_0xb167('0x2d')]=_[_0xb167('0x2e')](db[_0xb167('0x51')][_0xb167('0x56')]);_0x4ec1d5[_0xb167('0x2f')]=_['keys'](_0x5b936f[_0xb167('0x2f')]);_0x4ec1d5['filters']=_['intersection'](_0x4ec1d5['model'],_0x4ec1d5[_0xb167('0x2f')]);_0x21cd99[_0xb167('0x33')]=_[_0xb167('0x31')](_0x4ec1d5['model'],qs[_0xb167('0x32')](_0x5b936f[_0xb167('0x2f')][_0xb167('0x32')]));_0x21cd99[_0xb167('0x33')]=_0x21cd99['attributes'][_0xb167('0x34')]?_0x21cd99['attributes']:_0x4ec1d5['model'];_0x21cd99[_0xb167('0x57')]=qs[_0xb167('0x37')](_0x5b936f[_0xb167('0x2f')][_0xb167('0x37')]);_0x21cd99[_0xb167('0x38')]=qs[_0xb167('0x30')](_['pick'](_0x5b936f[_0xb167('0x2f')],_0x4ec1d5[_0xb167('0x30')]));if(_0x5b936f[_0xb167('0x2f')]['filter']){_0x21cd99[_0xb167('0x38')]=_[_0xb167('0x3b')](_0x21cd99['where'],{'$or':_['map'](_0x21cd99['attributes'],function(_0x4a5569){var _0x12325f={};_0x12325f[_0x4a5569]={'$like':'%'+_0x5b936f[_0xb167('0x2f')][_0xb167('0x3a')]+'%'};return _0x12325f;})});}_0x21cd99=_[_0xb167('0x3b')]({},_0x21cd99,_0x5b936f[_0xb167('0x3d')]);return _0x215b4e[_0xb167('0x54')](_0x21cd99);}})[_0xb167('0x25')](function(_0x430f57){if(_0x430f57){_0x573184=_0x430f57[_0xb167('0x34')];if(!_0x5b936f[_0xb167('0x2f')][_0xb167('0x35')](_0xb167('0x36'))){_0x21cd99[_0xb167('0x1d')]=qs[_0xb167('0x1d')](_0x5b936f[_0xb167('0x2f')][_0xb167('0x1d')]);_0x21cd99[_0xb167('0x1f')]=qs['offset'](_0x5b936f[_0xb167('0x2f')][_0xb167('0x1f')]);}return _0x215b4e[_0xb167('0x54')](_0x21cd99);}})[_0xb167('0x25')](function(_0x34008a){if(_0x34008a){return _0x34008a?{'count':_0x573184,'rows':_0x34008a}:null;}})['then'](respondWithResult(_0x1106b3,null))[_0xb167('0x43')](handleError(_0x1106b3,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 753c040..226ddf5 100644 --- a/server/api/cmCompany/cmCompany.model.js +++ b/server/api/cmCompany/cmCompany.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49e9=['util','../../config/logger','request-promise','path','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash'];(function(_0x482ea4,_0x38e290){var _0x3e7cef=function(_0x41a909){while(--_0x41a909){_0x482ea4['push'](_0x482ea4['shift']());}};_0x3e7cef(++_0x38e290);}(_0x49e9,0x117));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var logger=require(_0x949e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x949e('0x3'));var fs=require('fs');var path=require(_0x949e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x949e('0x5'));module[_0x949e('0x6')]=function(_0x3e97da,_0x1958a2){return _0x3e97da[_0x949e('0x7')](_0x949e('0x8'),attributes,{'tableName':_0x949e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x766c=['cm_companies','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x766c,0xfd));var _0xc766=function(_0x363b9c,_0x175500){_0x363b9c=_0x363b9c-0x0;var _0x2a8edd=_0x766c[_0x363b9c];return _0x2a8edd;};'use strict';var _=require(_0xc766('0x0'));var util=require(_0xc766('0x1'));var logger=require('../../config/logger')(_0xc766('0x2'));var moment=require('moment');var BPromise=require(_0xc766('0x3'));var rp=require(_0xc766('0x4'));var fs=require('fs');var path=require(_0xc766('0x5'));var rimraf=require(_0xc766('0x6'));var config=require(_0xc766('0x7'));var attributes=require(_0xc766('0x8'));module[_0xc766('0x9')]=function(_0x5aea45,_0x5f23a0){return _0x5aea45['define'](_0xc766('0xa'),attributes,{'tableName':_0xc766('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 57f0240..c5a12e8 100644 --- a/server/api/cmCompany/cmCompany.rpc.js +++ b/server/api/cmCompany/cmCompany.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b4b=['http','then','info','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x49e5bc,_0x22576f){var _0x27c672=function(_0x185798){while(--_0x185798){_0x49e5bc['push'](_0x49e5bc['shift']());}};_0x27c672(++_0x22576f);}(_0x7b4b,0x1ad));var _0xb7b4=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x7b4b[_0x557fd2];return _0x1b54a2;};'use strict';var _=require(_0xb7b4('0x0'));var util=require(_0xb7b4('0x1'));var moment=require(_0xb7b4('0x2'));var BPromise=require(_0xb7b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7b4('0x4'))['db'];var utils=require(_0xb7b4('0x5'));var logger=require(_0xb7b4('0x6'))(_0xb7b4('0x7'));var config=require(_0xb7b4('0x8'));var jayson=require(_0xb7b4('0x9'));var client=jayson[_0xb7b4('0xa')][_0xb7b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x203f2f,_0x5a4ee5,_0x69de6f){return new BPromise(function(_0x864ce9,_0x448747){return client['request'](_0x203f2f,_0x69de6f)[_0xb7b4('0xc')](function(_0x670b20){logger[_0xb7b4('0xd')]('CmCompany,\x20%s,\x20%s',_0x5a4ee5,'request\x20sent');logger['debug'](_0xb7b4('0xe'),_0x5a4ee5,_0xb7b4('0xf'),JSON['stringify'](_0x670b20));if(_0x670b20[_0xb7b4('0x10')]){if(_0x670b20[_0xb7b4('0x10')][_0xb7b4('0x11')]===0x1f4){logger[_0xb7b4('0x10')](_0xb7b4('0x12'),_0x5a4ee5,_0x670b20[_0xb7b4('0x10')][_0xb7b4('0x13')]);return _0x448747(_0x670b20[_0xb7b4('0x10')][_0xb7b4('0x13')]);}logger[_0xb7b4('0x10')](_0xb7b4('0x12'),_0x5a4ee5,_0x670b20[_0xb7b4('0x10')][_0xb7b4('0x13')]);return _0x864ce9(_0x670b20[_0xb7b4('0x10')][_0xb7b4('0x13')]);}else{logger['info'](_0xb7b4('0x12'),_0x5a4ee5,_0xb7b4('0xf'));_0x864ce9(_0x670b20[_0xb7b4('0x14')][_0xb7b4('0x13')]);}})[_0xb7b4('0x15')](function(_0x2d70a5){logger[_0xb7b4('0x10')](_0xb7b4('0x12'),_0x5a4ee5,_0x2d70a5);_0x448747(_0x2d70a5);});});} \ No newline at end of file +var _0x525d=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x525d,0x1c3));var _0xd525=function(_0x28ea42,_0x19a083){_0x28ea42=_0x28ea42-0x0;var _0x17318d=_0x525d[_0x28ea42];return _0x17318d;};'use strict';var _=require(_0xd525('0x0'));var util=require('util');var moment=require(_0xd525('0x1'));var BPromise=require('bluebird');var rs=require(_0xd525('0x2'));var fs=require('fs');var Redis=require(_0xd525('0x3'));var db=require(_0xd525('0x4'))['db'];var utils=require(_0xd525('0x5'));var logger=require(_0xd525('0x6'))(_0xd525('0x7'));var config=require(_0xd525('0x8'));var jayson=require(_0xd525('0x9'));var client=jayson[_0xd525('0xa')][_0xd525('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x284b3f,_0x4297c2,_0x4c94b0){return new BPromise(function(_0x4dc26b,_0x4277c9){return client[_0xd525('0xc')](_0x284b3f,_0x4c94b0)[_0xd525('0xd')](function(_0x48962f){logger[_0xd525('0xe')](_0xd525('0xf'),_0x4297c2,_0xd525('0x10'));logger[_0xd525('0x11')](_0xd525('0x12'),_0x4297c2,_0xd525('0x10'),JSON[_0xd525('0x13')](_0x48962f));if(_0x48962f[_0xd525('0x14')]){if(_0x48962f[_0xd525('0x14')][_0xd525('0x15')]===0x1f4){logger[_0xd525('0x14')](_0xd525('0xf'),_0x4297c2,_0x48962f['error'][_0xd525('0x16')]);return _0x4277c9(_0x48962f[_0xd525('0x14')][_0xd525('0x16')]);}logger[_0xd525('0x14')](_0xd525('0xf'),_0x4297c2,_0x48962f['error'][_0xd525('0x16')]);return _0x4dc26b(_0x48962f[_0xd525('0x14')][_0xd525('0x16')]);}else{logger['info'](_0xd525('0xf'),_0x4297c2,'request\x20sent');_0x4dc26b(_0x48962f[_0xd525('0x17')][_0xd525('0x16')]);}})[_0xd525('0x18')](function(_0x1dc629){logger[_0xd525('0x14')](_0xd525('0xf'),_0x4297c2,_0x1dc629);_0x4277c9(_0x1dc629);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 1b6b960..e01ac7c 100644 --- a/server/api/cmCompany/index.js +++ b/server/api/cmCompany/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cf6=['create','addContacts','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','/:id/contacts','getContacts','post'];(function(_0xe9c732,_0x125b29){var _0x2e6559=function(_0x1463d5){while(--_0x1463d5){_0xe9c732['push'](_0xe9c732['shift']());}};_0x2e6559(++_0x125b29);}(_0x7cf6,0x125));var _0x67cf=function(_0x2a5297,_0x577f67){_0x2a5297=_0x2a5297-0x0;var _0x261070=_0x7cf6[_0x2a5297];return _0x261070;};'use strict';var multer=require(_0x67cf('0x0'));var util=require('util');var path=require(_0x67cf('0x1'));var timeout=require(_0x67cf('0x2'));var express=require(_0x67cf('0x3'));var router=express['Router']();var fs_extra=require(_0x67cf('0x4'));var auth=require(_0x67cf('0x5'));var interaction=require(_0x67cf('0x6'));var config=require(_0x67cf('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x67cf('0x8')]);router[_0x67cf('0x9')]('/describe',auth[_0x67cf('0xa')](),controller[_0x67cf('0xb')]);router[_0x67cf('0x9')]('/:id',auth[_0x67cf('0xa')](),controller['show']);router[_0x67cf('0x9')](_0x67cf('0xc'),auth[_0x67cf('0xa')](),controller[_0x67cf('0xd')]);router[_0x67cf('0xe')]('/',auth[_0x67cf('0xa')](),controller[_0x67cf('0xf')]);router[_0x67cf('0xe')](_0x67cf('0xc'),auth[_0x67cf('0xa')](),controller[_0x67cf('0x10')]);router['put'](_0x67cf('0x11'),auth[_0x67cf('0xa')](),controller[_0x67cf('0x12')]);router[_0x67cf('0x13')](_0x67cf('0x11'),auth[_0x67cf('0xa')](),controller[_0x67cf('0x14')]);module[_0x67cf('0x15')]=router; \ No newline at end of file +var _0x0e4f=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','delete'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x0e4f,0xca));var _0xf0e4=function(_0x5f0cd9,_0x2a7359){_0x5f0cd9=_0x5f0cd9-0x0;var _0x4f9c59=_0x0e4f[_0x5f0cd9];return _0x4f9c59;};'use strict';var multer=require(_0xf0e4('0x0'));var util=require('util');var path=require(_0xf0e4('0x1'));var timeout=require(_0xf0e4('0x2'));var express=require('express');var router=express[_0xf0e4('0x3')]();var fs_extra=require(_0xf0e4('0x4'));var auth=require(_0xf0e4('0x5'));var interaction=require(_0xf0e4('0x6'));var config=require(_0xf0e4('0x7'));var controller=require(_0xf0e4('0x8'));router[_0xf0e4('0x9')]('/',auth[_0xf0e4('0xa')](),controller[_0xf0e4('0xb')]);router[_0xf0e4('0x9')](_0xf0e4('0xc'),auth[_0xf0e4('0xa')](),controller[_0xf0e4('0xd')]);router[_0xf0e4('0x9')](_0xf0e4('0xe'),auth[_0xf0e4('0xa')](),controller[_0xf0e4('0xf')]);router[_0xf0e4('0x9')](_0xf0e4('0x10'),auth['isAuthenticated'](),controller[_0xf0e4('0x11')]);router[_0xf0e4('0x12')]('/',auth[_0xf0e4('0xa')](),controller['create']);router[_0xf0e4('0x12')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xf0e4('0x13')]);router[_0xf0e4('0x14')](_0xf0e4('0xe'),auth[_0xf0e4('0xa')](),controller[_0xf0e4('0x15')]);router[_0xf0e4('0x16')](_0xf0e4('0xe'),auth[_0xf0e4('0xa')](),controller[_0xf0e4('0x17')]);module[_0xf0e4('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 632fd09..75e702f 100644 --- a/server/api/cmContact/cmContact.attributes.js +++ b/server/api/cmContact/cmContact.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4d1=['UNSIGNED','DATE','NOW','STRING','TEXT','INTEGER'];(function(_0x468e6c,_0x5e150b){var _0x54c64b=function(_0x44559f){while(--_0x44559f){_0x468e6c['push'](_0x468e6c['shift']());}};_0x54c64b(++_0x5e150b);}(_0xa4d1,0x17d));var _0x1a4d=function(_0x26764f,_0x43f4e7){_0x26764f=_0x26764f-0x0;var _0x53c715=_0xa4d1[_0x26764f];return _0x53c715;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0x1a4d('0x0')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1a4d('0x0')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1a4d('0x0')]},'city':{'type':Sequelize[_0x1a4d('0x0')]},'country':{'type':Sequelize[_0x1a4d('0x0')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a4d('0x1')]},'phone':{'type':Sequelize[_0x1a4d('0x0')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1a4d('0x0')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x1a4d('0x0')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x1a4d('0x0')]},'viber':{'type':Sequelize[_0x1a4d('0x0')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x1a4d('0x0')]},'telegram':{'type':Sequelize[_0x1a4d('0x0')]},'UserId':{'type':Sequelize[_0x1a4d('0x2')]},'AdditionalPhones':{'type':Sequelize[_0x1a4d('0x0')]},'priority':{'type':Sequelize[_0x1a4d('0x2')](0x2)[_0x1a4d('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1a4d('0x4')],'defaultValue':Sequelize[_0x1a4d('0x5')]},'dialTimezone':{'type':Sequelize[_0x1a4d('0x0')]},'utcOffset':{'type':Sequelize[_0x1a4d('0x2')]}}; \ No newline at end of file +var _0x241b=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports'];(function(_0x5b7b6a,_0x4928a0){var _0x40aa78=function(_0x142851){while(--_0x142851){_0x5b7b6a['push'](_0x5b7b6a['shift']());}};_0x40aa78(++_0x4928a0);}(_0x241b,0x165));var _0xb241=function(_0x2c6665,_0x506b4b){_0x2c6665=_0x2c6665-0x0;var _0x3cf7a4=_0x241b[_0x2c6665];return _0x3cf7a4;};'use strict';var _=require(_0xb241('0x0'));var Sequelize=require(_0xb241('0x1'));module[_0xb241('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xb241('0x3')]},'street':{'type':Sequelize[_0xb241('0x3')]},'postalCode':{'type':Sequelize[_0xb241('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xb241('0x3')]},'dateOfBirth':{'type':Sequelize[_0xb241('0x3')]},'description':{'type':Sequelize[_0xb241('0x4')]},'phone':{'type':Sequelize[_0xb241('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xb241('0x3')]},'email':{'type':Sequelize[_0xb241('0x3')]},'url':{'type':Sequelize[_0xb241('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xb241('0x3')]},'skype':{'type':Sequelize[_0xb241('0x3')]},'teams':{'type':Sequelize[_0xb241('0x3')]},'viber':{'type':Sequelize[_0xb241('0x3')]},'line':{'type':Sequelize[_0xb241('0x3')]},'wechat':{'type':Sequelize[_0xb241('0x3')]},'telegram':{'type':Sequelize[_0xb241('0x3')]},'UserId':{'type':Sequelize[_0xb241('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb241('0x5')](0x2)[_0xb241('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb241('0x7')],'defaultValue':Sequelize[_0xb241('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xb241('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 9ef9a4d..f25a82c 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x544f=['custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','tags','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','create','join','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','$or','push','where','ListId','findOrCreate','contact','all','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','setFields','id\x20=\x20?','toParam','sequelize','text','phone','getTags','findOne','model','rawAttributes','attributes','intersection','fields','order','sort','filters','pick','filter','options','setTags','ids','CmContactHasItem','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','child_process','fork','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','meta','import','User','agent','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','firstName','socket_timestamp','../../components/import/cm/csvUpdates','message','getJourney','mail','chat','sms','openchannel','fax','voice','-createdAt','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','Interaction','flatten','reverse','value','moment','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','index','describe','getOptions','findAll','query','CmContact','find','params','catch','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x544f,0x1cd));var _0xf544=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x544f[_0x46698a];return _0x356db0;};'use strict';var moment=require(_0xf544('0x0'));var BPromise=require('bluebird');var util=require(_0xf544('0x1'));var path=require(_0xf544('0x2'));var fs=require('fs');var _=require(_0xf544('0x3'));var squel=require(_0xf544('0x4'));var Papa=require(_0xf544('0x5'));var Redis=require(_0xf544('0x6'));var contacts=require(_0xf544('0x7'));var qs=require(_0xf544('0x8'));var logger=require(_0xf544('0x9'))(_0xf544('0xa'));var config=require(_0xf544('0xb'));var shared=require(_0xf544('0xc'));var db=require('../../mysqldb')['db'];config[_0xf544('0xd')]=_[_0xf544('0xe')](config[_0xf544('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf544('0xf'))(new Redis(config[_0xf544('0xd')]));require('./cmContact.socket')[_0xf544('0x10')](socket);function respondWithResult(_0x3c2f00,_0x38df05){_0x38df05=_0x38df05||0xc8;return function(_0x11cbf7){if(_0x11cbf7){return _0x3c2f00[_0xf544('0x11')](_0x38df05)[_0xf544('0x12')](_0x11cbf7);}};}function respondWithFilteredResult(_0x265a80,_0xb96a0f){return function(_0x138ad6){if(_0x138ad6){var _0x241ca8=typeof _0xb96a0f['offset']===_0xf544('0x13')&&typeof _0xb96a0f[_0xf544('0x14')]==='undefined';var _0x4fb7cd=_0x138ad6[_0xf544('0x15')];var _0x3c7e94=_0x241ca8?0x0:_0xb96a0f[_0xf544('0x16')];var _0x55b37a=_0x241ca8?_0x138ad6[_0xf544('0x15')]:_0xb96a0f[_0xf544('0x16')]+_0xb96a0f[_0xf544('0x14')];var _0x4266c7;if(_0x55b37a>=_0x4fb7cd){_0x55b37a=_0x4fb7cd;_0x4266c7=0xc8;}else{_0x4266c7=0xce;}_0x265a80[_0xf544('0x11')](_0x4266c7);return _0x265a80[_0xf544('0x17')](_0xf544('0x18'),_0x3c7e94+'-'+_0x55b37a+'/'+_0x4fb7cd)[_0xf544('0x12')](_0x138ad6);}return null;};}function saveUpdates(_0x43a93a){return function(_0x2c6ac6){if(_0x2c6ac6){return _0x2c6ac6[_0xf544('0x19')](_0x43a93a)[_0xf544('0x1a')](function(_0x48d441){return _0x48d441;});}return null;};}function removeEntity(_0x350243){return function(_0x5c909f){if(_0x5c909f){return _0x5c909f[_0xf544('0x1b')]()[_0xf544('0x1a')](function(){_0x350243['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8914){return function(_0xeda7b2){if(!_0xeda7b2){_0x3a8914[_0xf544('0x1c')](0x194);}return _0xeda7b2;};}function handleError(_0x235325,_0xf5e5a1){_0xf5e5a1=_0xf5e5a1||0x1f4;return function(_0x9a908){logger[_0xf544('0x1d')](_0x9a908[_0xf544('0x1e')]);if(_0x9a908[_0xf544('0x1f')]){delete _0x9a908[_0xf544('0x1f')];}_0x235325[_0xf544('0x11')](_0xf5e5a1)['send'](_0x9a908);};}exports[_0xf544('0x20')]=function(_0x3598cf,_0x453a9d){var _0x2278b4={};return contacts[_0xf544('0x21')]()['then'](function(_0x20afcd){_0x2278b4=qs[_0xf544('0x22')](_0x20afcd,_0x3598cf);return contacts[_0xf544('0x23')](_0x3598cf[_0xf544('0x24')],_0x3598cf['user'],_0x2278b4,_0x20afcd);})[_0xf544('0x1a')](respondWithFilteredResult(_0x453a9d,_0x2278b4))['catch'](handleError(_0x453a9d,null));};exports['destroy']=function(_0x2c4e96,_0x5d5e2c){return db[_0xf544('0x25')][_0xf544('0x26')]({'where':{'id':_0x2c4e96[_0xf544('0x27')]['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0x5d5e2c,null))['then'](removeEntity(_0x5d5e2c,null))[_0xf544('0x28')](handleError(_0x5d5e2c,null));};exports[_0xf544('0x21')]=function(_0x3e748c,_0x42bdc4){return db[_0xf544('0x25')][_0xf544('0x21')]()[_0xf544('0x1a')](function(_0x5b81a4){delete _0x5b81a4['tags'];for(var _0x3c0599=0x0;_0x3c05990x0){return new Promise(function(_0x369eed){var _0x6ea18c=[];for(var _0x4a98f4=0x0;_0x4a98f4<_0x42a4a6[_0xf544('0x2a')];_0x4a98f4++){_0x6ea18c[_0xf544('0x60')](insertAdditionalPhones(_0x42a4a6[_0x4a98f4][_0xf544('0x64')],_0x42a4a6[_0x4a98f4][_0xf544('0x5c')]));}Promise[_0xf544('0x65')](_0x6ea18c)[_0xf544('0x1a')](function(){_0x369eed(0x1);});})[_0xf544('0x1a')](function(){return{'success':_0x171ed3,'failure':_0x2223e2,'duplicates':_0xea5743};});}else{return{'success':_0x171ed3,'failure':_0x2223e2,'duplicates':_0xea5743};}}})[_0xf544('0x1a')](respondWithResult(_0x18457b,0xc9))['catch'](handleError(_0x18457b,null));};exports['show']=function(_0x4f4fd8,_0x4aae20){var _0x42719b;return db['CmContact'][_0xf544('0x21')]()[_0xf544('0x1a')](function(_0x4a4895){return db[_0xf544('0x25')][_0xf544('0x26')]({'where':{'id':_0x4f4fd8[_0xf544('0x27')]['id']},'include':[{'model':db[_0xf544('0x66')],'as':_0xf544('0x67'),'attributes':['id',_0xf544('0x1f'),_0xf544('0x68')],'required':_0x4f4fd8[_0xf544('0x24')][_0xf544('0x69')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xf544('0x6a'),'where':{'CmContactId':_0x4f4fd8[_0xf544('0x27')]['id']},'required':![],'include':[{'model':db[_0xf544('0x6b')],'as':_0xf544('0x6c')}]}],'order':[db['sequelize'][_0xf544('0x6d')](_0xf544('0x6e'))],'attributes':_['keys'](_0x4a4895)});})[_0xf544('0x1a')](function(_0x5a9357){if(!_[_0xf544('0x59')](_0x5a9357)){_0x42719b=_0x5a9357[_0xf544('0x3a')]({'plain':!![]});var _0xc15fe5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5a9357&&_0x5a9357['ListId']){if(_0x5a9357[_0xf544('0x62')]){_0xc15fe5['where'][_0xf544('0x6f')][_0xf544('0x60')]({'ListId':{'$ne':_0x5a9357[_0xf544('0x62')]}});}}return db[_0xf544('0x30')][_0xf544('0x23')](_0xc15fe5);}})['then'](function(_0x5bab53){if(!_[_0xf544('0x59')](_0x5bab53)){return _[_0xf544('0x70')](_0x42719b,_[_0xf544('0x71')](_0x5bab53,function(_0x26830f){return util[_0xf544('0x72')](_0xf544('0x73'),_0x26830f['id']);}));}})[_0xf544('0x1a')](handleEntityNotFound(_0x4aae20,null))['then'](respondWithResult(_0x4aae20,null))['catch'](handleError(_0x4aae20,null));};exports[_0xf544('0x19')]=function(_0x4b63c1,_0x3cc301){var _0x179a26;if(_0x4b63c1[_0xf544('0x38')]['id']){delete _0x4b63c1[_0xf544('0x38')]['id'];}if(!_[_0xf544('0x59')](_0x4b63c1[_0xf544('0x38')][_0xf544('0x58')])){var _0x58a6a4=_0x4b63c1['body'][_0xf544('0x58')];if(!_[_0xf544('0x59')](shared[_0xf544('0x5a')][_0x58a6a4]))_0x4b63c1['body'][_0xf544('0x5b')]=shared[_0xf544('0x5a')][_0x58a6a4][_0xf544('0x5b')];}return db[_0xf544('0x25')][_0xf544('0x26')]({'where':{'id':_0x4b63c1['params']['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0x3cc301,null))[_0xf544('0x1a')](saveUpdates(_0x4b63c1[_0xf544('0x38')],null))['then'](function(_0x45863d){_0x179a26=_0x45863d;var _0x55ec7c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x45863d&&_0x45863d[_0xf544('0x62')]){if(_0x45863d[_0xf544('0x62')]){_0x55ec7c[_0xf544('0x61')][_0xf544('0x6f')]['push']({'ListId':{'$ne':_0x45863d[_0xf544('0x62')]}});}}return db['CmCustomField'][_0xf544('0x23')](_0x55ec7c);})[_0xf544('0x1a')](function(_0x5348dd){if(_0x5348dd){return _[_0xf544('0x70')](_[_0xf544('0x74')](_0x4b63c1[_0xf544('0x38')],function(_0x542233,_0x4a8fb0){return _[_0xf544('0x2b')](_0x4a8fb0,_0xf544('0x2c'));}),_[_0xf544('0x71')](_0x5348dd,function(_0x2ca0ba){return util[_0xf544('0x72')]('cf_%d',_0x2ca0ba['id']);}));}})[_0xf544('0x1a')](function(_0x3a0f87){if(_0x3a0f87&&!_['isEmpty'](_0x3a0f87)){var _0x13662f=squel['update']()['table']('cm_contacts')[_0xf544('0x75')](_0x3a0f87)[_0xf544('0x61')](_0xf544('0x76'),_0x4b63c1[_0xf544('0x27')]['id'])[_0xf544('0x77')]();return db[_0xf544('0x78')]['query'](_0x13662f[_0xf544('0x79')],{'replacements':_0x13662f[_0xf544('0x33')]});}})[_0xf544('0x1a')](function(){if(_0x4b63c1[_0xf544('0x38')][_0xf544('0x7a')]&&_0x179a26){return db[_0xf544('0x40')][_0xf544('0x19')]({'phone':_0x4b63c1[_0xf544('0x38')][_0xf544('0x7a')],'OrderBy':0x0},{'where':{'ContactId':_0x179a26['id']}});}})[_0xf544('0x1a')](function(){return _0x179a26;})['then'](respondWithResult(_0x3cc301,null))[_0xf544('0x28')](handleError(_0x3cc301,null));};exports[_0xf544('0x7b')]=function(_0x5338bb,_0xa23214){var _0x1a5ef3={};var _0x45718f={};var _0x1dc3d3;var _0x59aafa;return db['CmContact'][_0xf544('0x7c')]({'where':{'id':_0x5338bb[_0xf544('0x27')]['id']}})['then'](handleEntityNotFound(_0xa23214,null))['then'](function(_0x50ee24){if(_0x50ee24){_0x1dc3d3=_0x50ee24;_0x45718f[_0xf544('0x7d')]=_[_0xf544('0x29')](db[_0xf544('0x66')][_0xf544('0x7e')]);_0x45718f[_0xf544('0x24')]=_[_0xf544('0x29')](_0x5338bb[_0xf544('0x24')]);_0x45718f['filters']=_['intersection'](_0x45718f['model'],_0x45718f[_0xf544('0x24')]);_0x1a5ef3[_0xf544('0x7f')]=_[_0xf544('0x80')](_0x45718f[_0xf544('0x7d')],qs[_0xf544('0x81')](_0x5338bb[_0xf544('0x24')]['fields']));_0x1a5ef3[_0xf544('0x7f')]=_0x1a5ef3[_0xf544('0x7f')][_0xf544('0x2a')]?_0x1a5ef3[_0xf544('0x7f')]:_0x45718f[_0xf544('0x7d')];_0x1a5ef3[_0xf544('0x82')]=qs[_0xf544('0x83')](_0x5338bb[_0xf544('0x24')][_0xf544('0x83')]);_0x1a5ef3[_0xf544('0x61')]=qs[_0xf544('0x84')](_[_0xf544('0x85')](_0x5338bb[_0xf544('0x24')],_0x45718f[_0xf544('0x84')]));if(_0x5338bb['query'][_0xf544('0x86')]){_0x1a5ef3[_0xf544('0x61')]=_[_0xf544('0x37')](_0x1a5ef3[_0xf544('0x61')],{'$or':_[_0xf544('0x71')](_0x1a5ef3[_0xf544('0x7f')],function(_0x2542df){var _0x2b71e7={};_0x2b71e7[_0x2542df]={'$like':'%'+_0x5338bb['query']['filter']+'%'};return _0x2b71e7;})});}_0x1a5ef3=_[_0xf544('0x37')]({},_0x1a5ef3,_0x5338bb[_0xf544('0x87')]);return _0x1dc3d3[_0xf544('0x7b')](_0x1a5ef3);}})['then'](function(_0x2a6c4d){if(_0x2a6c4d){_0x59aafa=_0x2a6c4d[_0xf544('0x2a')];if(!_0x5338bb[_0xf544('0x24')]['hasOwnProperty']('nolimit')){_0x1a5ef3[_0xf544('0x14')]=qs[_0xf544('0x14')](_0x5338bb[_0xf544('0x24')][_0xf544('0x14')]);_0x1a5ef3[_0xf544('0x16')]=qs[_0xf544('0x16')](_0x5338bb[_0xf544('0x24')][_0xf544('0x16')]);}return _0x1dc3d3[_0xf544('0x7b')](_0x1a5ef3);}})['then'](function(_0x58bb18){if(_0x58bb18){return _0x58bb18?{'count':_0x59aafa,'rows':_0x58bb18}:null;}})[_0xf544('0x1a')](respondWithResult(_0xa23214,null))[_0xf544('0x28')](handleError(_0xa23214,null));};exports[_0xf544('0x88')]=function(_0x5f3c33,_0x3bb5f2){if(_0x5f3c33[_0xf544('0x38')]['id']){delete _0x5f3c33[_0xf544('0x38')]['id'];}return db[_0xf544('0x25')][_0xf544('0x7c')]({'where':{'id':_0x5f3c33[_0xf544('0x27')]['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0x3bb5f2,null))[_0xf544('0x1a')](function(_0x35c7c7){if(_0x35c7c7){return _0x35c7c7[_0xf544('0x88')](_0x5f3c33[_0xf544('0x38')][_0xf544('0x89')]||[]);}return null;})['then'](respondWithResult(_0x3bb5f2,null))['catch'](handleError(_0x3bb5f2,null));};exports['setAdditionalPhones']=function(_0x2c0a9e,_0x36417c){var _0x230d9c=[];_0x230d9c['push'](addAdditionalPhones(_0x2c0a9e['body']));Promise['all'](_0x230d9c)[_0xf544('0x1a')](function(){_0x230d9c=[];_0x230d9c[_0xf544('0x60')](deleteCmHopperPhones(_0x2c0a9e[_0xf544('0x38')]['id']));_0x230d9c[_0xf544('0x60')](addCmHopperPhones(_0x2c0a9e[_0xf544('0x38')]['id']));Promise[_0xf544('0x65')](_0x230d9c)['then'](function(){return[0x1];})[_0xf544('0x1a')](respondWithResult(_0x36417c,null));});};function addAdditionalPhones(_0x5be731){var _0x5457e0;return new Promise(function(_0x3184f3){return db[_0xf544('0x8a')][_0xf544('0x1b')]({'where':{'CmContactId':_0x5be731['id']}})[_0xf544('0x1a')](function(){db[_0xf544('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0xf544('0x8b')]})[_0xf544('0x1a')](function(_0x45ef48){var _0x1ea216=[];for(var _0x4ae69c=0x0;_0x4ae69c<_0x5be731[_0xf544('0x8c')][_0xf544('0x2a')];_0x4ae69c++){var _0x4a466b=_0x5be731[_0xf544('0x8d')]?_[_0xf544('0x59')](_0x5be731[_0xf544('0x8d')][_0x4ae69c])?'':_0x5be731[_0xf544('0x8d')][_0x4ae69c]:_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x8e')]?_0x5be731[_0xf544('0x8c')][_0x4ae69c]['ItemTypeId']:'';var _0x30c1b7=_['isNil'](_0x5be731[_0xf544('0x8c')][_0x4ae69c]['description'])?'':_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x8f')];var _0x1382e5=_0x4a466b+':'+_0x5be731[_0xf544('0x8c')][_0x4ae69c]['phone']+'§'+_0x30c1b7;if(_[_0xf544('0x59')](_0x5457e0))_0x5457e0=_0x1382e5;else _0x5457e0+=';'+_0x1382e5;var _0x2ee894=null;var _0x52f96d=null;if(_0x5be731[_0xf544('0x8d')]){if(!_[_0xf544('0x59')](_0x5be731[_0xf544('0x8d')][_0x4ae69c])){_0x52f96d=_[_0xf544('0x26')](_0x45ef48,function(_0x4ff713){return _0x4ff713['id']===_0x5be731[_0xf544('0x8d')][_0x4ae69c];});if(!_[_0xf544('0x59')](_0x52f96d)){_0x2ee894=_0x52f96d[_0xf544('0x8b')];}}}else{if(!_[_0xf544('0x59')](_0x5be731['items'][_0x4ae69c])){_0x52f96d=_['find'](_0x45ef48,function(_0xbab3bb){return _0xbab3bb['id']===_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x8e')];});if(!_[_0xf544('0x59')](_0x52f96d)){_0x2ee894=_0x4ae69c;}}}if(_['isNil'](_0x2ee894)){_0x2ee894=0x64;}_0x1ea216[_0xf544('0x60')](addAdditionalPhone(_0x5be731['id'],_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x7a')],_0x5be731[_0xf544('0x8d')]?_['isNil'](_0x5be731[_0xf544('0x8d')][_0x4ae69c])?null:_0x5be731[_0xf544('0x8d')][_0x4ae69c]:_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x8e')]?_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x8e')]:null,_0x2ee894,_0x30c1b7));}Promise[_0xf544('0x65')](_0x1ea216)[_0xf544('0x1a')](function(){db['CmContact'][_0xf544('0x19')]({'AdditionalPhones':_0x5457e0},{'where':{'id':_0x5be731['id']}})['then'](function(){_0x3184f3(0x1);});});});});});}function addAdditionalPhone(_0x23369e,_0xaa6413,_0x5366c1,_0x234866,_0x499577){return db[_0xf544('0x8a')][_0xf544('0x26')]({'where':{'CmContactId':_0x23369e,'item':_0xaa6413}})[_0xf544('0x1a')](function(_0x2fe537){if(_0x2fe537)logger['info'](_0xf544('0x90'),_0x2fe537);else{db[_0xf544('0x8a')][_0xf544('0x56')]({'CmContactId':_0x23369e,'item':_0xaa6413,'ItemTypeId':_0x5366c1,'OrderBy':_0x234866,'ItemClass':'PHONE','description':_0x499577});}});}function deleteCmHopperPhones(_0x209688){return new Promise(function(_0x33a9c5){return db[_0xf544('0x40')][_0xf544('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x209688}})[_0xf544('0x1a')](function(_0x597783){db[_0xf544('0x91')][_0xf544('0x1b')]({'where':{'CmHopperId':{'$in':_[_0xf544('0x71')](_0x597783,'id')}}});})[_0xf544('0x1a')](function(){_0x33a9c5(0x1);});});}function addCmHopperPhones(_0x4970fc){return new Promise(function(_0x264cb3){return db[_0xf544('0x40')][_0xf544('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4970fc}})[_0xf544('0x1a')](function(_0x55180c){var _0x3244b0=[];_[_0xf544('0x71')](_0x55180c,function(_0x59dcea){_0x3244b0[_0xf544('0x60')](createCmHopperPhone(_0x4970fc,_0x59dcea['id']));});Promise['all'](_0x3244b0)['then'](function(){_0x264cb3(0x1);});});});}function createCmHopperPhone(_0x12a2c3,_0x53e0ab){return new Promise(function(_0x227028){db[_0xf544('0x8a')][_0xf544('0x23')]({'raw':!![],'attributes':[_0xf544('0x92'),_0xf544('0x8b')],'where':{'CmContactId':_0x12a2c3,'ItemClass':_0xf544('0x93')},'include':[{'model':db[_0xf544('0x6b')],'attributes':[_0xf544('0x8b')],'as':'ItemType'}],'order':[_0xf544('0x8b'),db[_0xf544('0x78')][_0xf544('0x6d')]('`ItemType`.OrderBy')]})['then'](function(_0x39f54b){var _0xcfa1a5=0x1;var _0x57697d=_[_0xf544('0x71')](_0x39f54b,function(_0x1faf9b){_0x1faf9b[_0xf544('0x94')]=_0x53e0ab;_0x1faf9b[_0xf544('0x7a')]=_0x1faf9b[_0xf544('0x92')];_0x1faf9b[_0xf544('0x8b')]=_0xcfa1a5;delete _0x1faf9b[_0xf544('0x95')];_0xcfa1a5=_0xcfa1a5+0x1;return _0x1faf9b;});return db[_0xf544('0x91')][_0xf544('0x5d')](_0x57697d,{});})['then'](function(){_0x227028(0x1);});});}function insertAdditionalPhones(_0x5b30ed,_0x4ff8f8){return new Promise(function(_0x3911d7){var _0x327721=[];for(var _0x39f66a=0x0;_0x39f66a<_0x4ff8f8['length'];_0x39f66a++){var _0x303ac9=_0x4ff8f8[_0x39f66a];_0x327721[_0xf544('0x60')](parseContactItemType(_0x303ac9));}Promise[_0xf544('0x65')](_0x327721)['then'](function(){var _0x48f17d={'id':_0x5b30ed['id'],'items':_0x4ff8f8};return addAdditionalPhones(_0x48f17d)[_0xf544('0x1a')](function(){return addCmHopperPhones(_0x5b30ed['id']);});})[_0xf544('0x1a')](function(){_0x3911d7(_0x5b30ed);});});}function parseContactItemType(_0x58ea43){return new Promise(function(_0x175ed4){if(_0x58ea43[_0xf544('0x36')](_0xf544('0x8e'))){_0x175ed4(_0x58ea43);}else{return db['ContactItemType'][_0xf544('0x26')]({'where':{'name':_0x58ea43[_0xf544('0x6c')]}})[_0xf544('0x1a')](function(_0x796721){if(_[_0xf544('0x59')](_0x796721))_0x58ea43[_0xf544('0x8e')]=null;else _0x58ea43[_0xf544('0x8e')]=_0x796721['id'];_0x175ed4(_0x58ea43);});}});}exports[_0xf544('0x96')]=function(_0x3a6cd2,_0x5cbde9){return db[_0xf544('0x8a')][_0xf544('0x23')]({'raw':!![],'where':{'CmContactId':_0x3a6cd2[_0xf544('0x27')]['id'],'ItemClass':_0xf544('0x93')},'include':[{'model':db[_0xf544('0x6b')],'as':_0xf544('0x6c')}],'order':[[_0xf544('0x8b')],[db[_0xf544('0x78')][_0xf544('0x6d')]('`ItemType`.OrderBy')]]})['then'](function(_0x15984d){return _0x15984d;})[_0xf544('0x1a')](respondWithResult(_0x5cbde9,null))[_0xf544('0x28')](handleError(_0x5cbde9,null));};exports[_0xf544('0x97')]=function(_0x3da223,_0x37a6e3){return db[_0xf544('0x8a')][_0xf544('0x23')]({'raw':!![],'where':{'CmContactId':_0x3da223['body'][_0xf544('0x98')]}})[_0xf544('0x1a')](function(_0x1e3b20){var _0x1ad0ce=_[_0xf544('0x71')](_0x1e3b20,function(_0x2b5bae){_0x2b5bae['CmContactId']=_0x3da223[_0xf544('0x38')][_0xf544('0x99')];return _0x2b5bae;});return db['CmContactHasItem']['bulkCreate'](_0x1ad0ce,{});})[_0xf544('0x1a')](function(){return addCmHopperPhones(_0x3da223[_0xf544('0x38')][_0xf544('0x99')]);})[_0xf544('0x1a')](function(){return['ok'];})[_0xf544('0x1a')](respondWithResult(_0x37a6e3,null))[_0xf544('0x28')](handleError(_0x37a6e3,null));};exports[_0xf544('0x9a')]=function(_0x153399,_0x25fe64){var _0x8b28fb=[];_0x8b28fb[_0xf544('0x60')](createCmHopperPhone(_0x153399['body']['id'],_0x153399[_0xf544('0x38')][_0xf544('0x9b')]));Promise[_0xf544('0x65')](_0x8b28fb)[_0xf544('0x1a')](function(){return[0x1];})['then'](respondWithResult(_0x25fe64,null));};exports[_0xf544('0x9c')]=function(_0x33c96d,_0xaf437e){var _0x51afbb={'raw':![],'where':{}};var _0x505471={};var _0x27c99b={'count':0x0,'rows':[]};return db[_0xf544('0x25')][_0xf544('0x7c')]({'where':{'id':_0x33c96d[_0xf544('0x27')]['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0xaf437e,null))[_0xf544('0x1a')](function(_0x5da7ea){if(_0x5da7ea){_0x505471[_0xf544('0x7d')]=_[_0xf544('0x29')](db[_0xf544('0x40')][_0xf544('0x7e')]);_0x505471[_0xf544('0x24')]=_['keys'](_0x33c96d['query']);_0x505471[_0xf544('0x84')]=_[_0xf544('0x80')](_0x505471['model'],_0x505471['query']);_0x51afbb[_0xf544('0x7f')]=_[_0xf544('0x80')](_0x505471[_0xf544('0x7d')],qs[_0xf544('0x81')](_0x33c96d[_0xf544('0x24')]['fields']));_0x51afbb['attributes']=_0x51afbb['attributes'][_0xf544('0x2a')]?_0x51afbb[_0xf544('0x7f')]:_0x505471[_0xf544('0x7d')];if(!_0x33c96d[_0xf544('0x24')][_0xf544('0x36')](_0xf544('0x9d'))){_0x51afbb['limit']=qs[_0xf544('0x14')](_0x33c96d[_0xf544('0x24')]['limit']);_0x51afbb[_0xf544('0x16')]=qs[_0xf544('0x16')](_0x33c96d['query'][_0xf544('0x16')]);}_0x51afbb[_0xf544('0x82')]=qs['sort'](_0x33c96d['query'][_0xf544('0x83')]);_0x51afbb[_0xf544('0x61')]=qs[_0xf544('0x84')](_['pick'](_0x33c96d[_0xf544('0x24')],_0x505471[_0xf544('0x84')]));_0x51afbb[_0xf544('0x61')][_0xf544('0x9e')]=_0x5da7ea['id'];if(_0x33c96d[_0xf544('0x24')][_0xf544('0x86')]){_0x51afbb[_0xf544('0x61')]=_[_0xf544('0x37')](_0x51afbb[_0xf544('0x61')],{'$or':_[_0xf544('0x71')](_0x51afbb[_0xf544('0x7f')],function(_0xb481d3){var _0x25ac19={};_0x25ac19[_0xb481d3]={'$like':'%'+_0x33c96d[_0xf544('0x24')][_0xf544('0x86')]+'%'};return _0x25ac19;})});}_0x51afbb=_[_0xf544('0x37')]({},_0x51afbb,_0x33c96d[_0xf544('0x87')]);return db[_0xf544('0x40')][_0xf544('0x15')]({'where':_0x51afbb['where']})[_0xf544('0x1a')](function(_0x52f8f6){_0x27c99b['count']=_0x52f8f6;if(_0x33c96d['query'][_0xf544('0x9f')]){_0x51afbb[_0xf544('0xa0')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x51afbb);})[_0xf544('0x1a')](function(_0x318682){_0x27c99b[_0xf544('0xa1')]=_0x318682;return _0x27c99b;});}})['then'](respondWithFilteredResult(_0xaf437e,_0x51afbb))[_0xf544('0x28')](handleError(_0xaf437e,null));};exports[_0xf544('0xa2')]=function(_0xc14583,_0x3811e2){var _0x478b57={'raw':!![],'where':{}};var _0x4d64d8={};var _0x432769={'count':0x0,'rows':[]};return db[_0xf544('0x25')][_0xf544('0x7c')]({'where':{'id':_0xc14583['params']['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0x3811e2,null))[_0xf544('0x1a')](function(_0x3e6f09){if(_0x3e6f09){_0x4d64d8[_0xf544('0x7d')]=_[_0xf544('0x29')](db[_0xf544('0x4e')][_0xf544('0x7e')]);_0x4d64d8[_0xf544('0x24')]=_[_0xf544('0x29')](_0xc14583[_0xf544('0x24')]);_0x4d64d8[_0xf544('0x84')]=_[_0xf544('0x80')](_0x4d64d8[_0xf544('0x7d')],_0x4d64d8[_0xf544('0x24')]);_0x478b57['attributes']=_[_0xf544('0x80')](_0x4d64d8[_0xf544('0x7d')],qs['fields'](_0xc14583['query'][_0xf544('0x81')]));_0x478b57[_0xf544('0x7f')]=_0x478b57[_0xf544('0x7f')][_0xf544('0x2a')]?_0x478b57[_0xf544('0x7f')]:_0x4d64d8[_0xf544('0x7d')];if(!_0xc14583[_0xf544('0x24')][_0xf544('0x36')](_0xf544('0x9d'))){_0x478b57[_0xf544('0x14')]=qs[_0xf544('0x14')](_0xc14583[_0xf544('0x24')][_0xf544('0x14')]);_0x478b57[_0xf544('0x16')]=qs['offset'](_0xc14583[_0xf544('0x24')][_0xf544('0x16')]);}_0x478b57[_0xf544('0x82')]=qs[_0xf544('0x83')](_0xc14583[_0xf544('0x24')][_0xf544('0x83')]);_0x478b57['where']=qs[_0xf544('0x84')](_[_0xf544('0x85')](_0xc14583['query'],_0x4d64d8[_0xf544('0x84')]));_0x478b57[_0xf544('0x61')][_0xf544('0x9e')]=_0x3e6f09['id'];if(_0xc14583[_0xf544('0x24')]['filter']){_0x478b57[_0xf544('0x61')]=_[_0xf544('0x37')](_0x478b57['where'],{'$or':_[_0xf544('0x71')](_0x478b57['attributes'],function(_0x3ec87e){var _0x2972f2={};_0x2972f2[_0x3ec87e]={'$like':'%'+_0xc14583['query'][_0xf544('0x86')]+'%'};return _0x2972f2;})});}_0x478b57=_['merge']({},_0x478b57,_0xc14583[_0xf544('0x87')]);return db['CmHopperHistory'][_0xf544('0x15')]({'where':_0x478b57[_0xf544('0x61')]})[_0xf544('0x1a')](function(_0x4fbf1a){_0x432769['count']=_0x4fbf1a;if(_0xc14583[_0xf544('0x24')][_0xf544('0x9f')]){_0x478b57['include']=[{'all':!![]}];}return db[_0xf544('0x4e')][_0xf544('0x23')](_0x478b57);})[_0xf544('0x1a')](function(_0xc59676){_0x432769[_0xf544('0xa1')]=_0xc59676;return _0x432769;});}})[_0xf544('0x1a')](respondWithFilteredResult(_0x3811e2,_0x478b57))[_0xf544('0x28')](handleError(_0x3811e2,null));};exports[_0xf544('0xa3')]=function(_0x51112f,_0x52e3fe){var _0x41a7ab={'raw':!![],'where':{}};var _0x27bbb1={};var _0x5ec8b8={'count':0x0,'rows':[]};return db['CmContact'][_0xf544('0x7c')]({'where':{'id':_0x51112f[_0xf544('0x27')]['id']}})['then'](handleEntityNotFound(_0x52e3fe,null))[_0xf544('0x1a')](function(_0xe7e4e9){if(_0xe7e4e9){_0x27bbb1[_0xf544('0x7d')]=_['keys'](db[_0xf544('0x4d')][_0xf544('0x7e')]);_0x27bbb1['query']=_[_0xf544('0x29')](_0x51112f[_0xf544('0x24')]);_0x27bbb1[_0xf544('0x84')]=_['intersection'](_0x27bbb1[_0xf544('0x7d')],_0x27bbb1[_0xf544('0x24')]);_0x41a7ab[_0xf544('0x7f')]=_['intersection'](_0x27bbb1[_0xf544('0x7d')],qs[_0xf544('0x81')](_0x51112f['query']['fields']));_0x41a7ab['attributes']=_0x41a7ab['attributes'][_0xf544('0x2a')]?_0x41a7ab[_0xf544('0x7f')]:_0x27bbb1[_0xf544('0x7d')];if(!_0x51112f[_0xf544('0x24')][_0xf544('0x36')]('nolimit')){_0x41a7ab[_0xf544('0x14')]=qs[_0xf544('0x14')](_0x51112f['query'][_0xf544('0x14')]);_0x41a7ab[_0xf544('0x16')]=qs['offset'](_0x51112f['query'][_0xf544('0x16')]);}_0x41a7ab[_0xf544('0x82')]=qs['sort'](_0x51112f['query'][_0xf544('0x83')]);_0x41a7ab[_0xf544('0x61')]=qs[_0xf544('0x84')](_[_0xf544('0x85')](_0x51112f['query'],_0x27bbb1[_0xf544('0x84')]));_0x41a7ab[_0xf544('0x61')][_0xf544('0x9e')]=_0xe7e4e9['id'];if(_0x51112f[_0xf544('0x24')]['filter']){_0x41a7ab[_0xf544('0x61')]=_[_0xf544('0x37')](_0x41a7ab[_0xf544('0x61')],{'$or':_[_0xf544('0x71')](_0x41a7ab[_0xf544('0x7f')],function(_0x1a4826){var _0x2d5ac8={};_0x2d5ac8[_0x1a4826]={'$like':'%'+_0x51112f[_0xf544('0x24')][_0xf544('0x86')]+'%'};return _0x2d5ac8;})});}_0x41a7ab=_[_0xf544('0x37')]({},_0x41a7ab,_0x51112f[_0xf544('0x87')]);return db[_0xf544('0x4d')][_0xf544('0x15')]({'where':_0x41a7ab[_0xf544('0x61')]})[_0xf544('0x1a')](function(_0x4eef30){_0x5ec8b8[_0xf544('0x15')]=_0x4eef30;if(_0x51112f['query'][_0xf544('0x9f')]){_0x41a7ab[_0xf544('0xa0')]=[{'all':!![]}];}return db[_0xf544('0x4d')]['findAll'](_0x41a7ab);})[_0xf544('0x1a')](function(_0x6376c5){_0x5ec8b8[_0xf544('0xa1')]=_0x6376c5;return _0x5ec8b8;});}})['then'](respondWithFilteredResult(_0x52e3fe,_0x41a7ab))[_0xf544('0x28')](handleError(_0x52e3fe,null));};exports[_0xf544('0xa4')]=function(_0x98b7db,_0x35376b){var _0x5a2d15={'raw':!![],'where':{}};var _0x4ef714={};var _0x4bff5c={'count':0x0,'rows':[]};return db[_0xf544('0x25')][_0xf544('0x7c')]({'where':{'id':_0x98b7db[_0xf544('0x27')]['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0x35376b,null))[_0xf544('0x1a')](function(_0x3301e8){if(_0x3301e8){_0x4ef714[_0xf544('0x7d')]=_['keys'](db['JscriptySessionReport'][_0xf544('0x7e')]);_0x4ef714[_0xf544('0x24')]=_[_0xf544('0x29')](_0x98b7db[_0xf544('0x24')]);_0x4ef714['filters']=_['intersection'](_0x4ef714[_0xf544('0x7d')],_0x4ef714[_0xf544('0x24')]);_0x5a2d15[_0xf544('0x7f')]=_[_0xf544('0x80')](_0x4ef714[_0xf544('0x7d')],qs[_0xf544('0x81')](_0x98b7db[_0xf544('0x24')][_0xf544('0x81')]));_0x5a2d15['attributes']=_0x5a2d15[_0xf544('0x7f')][_0xf544('0x2a')]?_0x5a2d15[_0xf544('0x7f')]:_0x4ef714['model'];if(!_0x98b7db['query'][_0xf544('0x36')](_0xf544('0x9d'))){_0x5a2d15[_0xf544('0x14')]=qs['limit'](_0x98b7db[_0xf544('0x24')][_0xf544('0x14')]);_0x5a2d15[_0xf544('0x16')]=qs[_0xf544('0x16')](_0x98b7db[_0xf544('0x24')][_0xf544('0x16')]);}_0x5a2d15[_0xf544('0x82')]=qs[_0xf544('0x83')](_0x98b7db[_0xf544('0x24')]['sort']);_0x5a2d15['where']=qs[_0xf544('0x84')](_[_0xf544('0x85')](_0x98b7db[_0xf544('0x24')],_0x4ef714['filters']));_0x5a2d15['where'][_0xf544('0x9e')]=_0x3301e8['id'];if(_0x98b7db[_0xf544('0x24')]['filter']){_0x5a2d15['where']=_['merge'](_0x5a2d15[_0xf544('0x61')],{'$or':_[_0xf544('0x71')](_0x5a2d15[_0xf544('0x7f')],function(_0x372cd0){var _0x861ba0={};_0x861ba0[_0x372cd0]={'$like':'%'+_0x98b7db[_0xf544('0x24')][_0xf544('0x86')]+'%'};return _0x861ba0;})});}_0x5a2d15=_[_0xf544('0x37')]({},_0x5a2d15,_0x98b7db[_0xf544('0x87')]);return db[_0xf544('0x54')][_0xf544('0x15')]({'where':_0x5a2d15[_0xf544('0x61')]})[_0xf544('0x1a')](function(_0x1718ed){_0x4bff5c['count']=_0x1718ed;if(_0x98b7db[_0xf544('0x24')][_0xf544('0x9f')]){_0x5a2d15[_0xf544('0xa0')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x5a2d15);})[_0xf544('0x1a')](function(_0x3900f8){_0x4bff5c[_0xf544('0xa1')]=_0x3900f8;return _0x4bff5c;});}})[_0xf544('0x1a')](respondWithFilteredResult(_0x35376b,_0x5a2d15))[_0xf544('0x28')](handleError(_0x35376b,null));};exports['uploadCsv']=function(_0x3dd560,_0x2c2586){try{if(!_0x3dd560[_0xf544('0x38')][_0xf544('0x62')]){throw new Error(_0xf544('0xa5'));}if(!_0x3dd560[_0xf544('0x38')][_0xf544('0xa6')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x3dd560[_0xf544('0x38')][_0xf544('0xa7')]){throw new Error(_0xf544('0xa8'));}if(!_0x3dd560['body']['socket_timestamp']){throw new Error(_0xf544('0xa9'));}var _0x3197ac=_0x3dd560[_0xf544('0x38')][_0xf544('0xa6')][_0xf544('0xaa')](',');var _0x312703=_0x3dd560[_0xf544('0x38')][_0xf544('0xa7')]['split'](',');if(!_0x3197ac['length']||!_0x312703[_0xf544('0x2a')]||_0x3197ac[_0xf544('0x2a')]!==_0x312703['length']){throw new Error(_0xf544('0xab'));}_0x3dd560[_0xf544('0x38')][_0xf544('0x81')]=_[_0xf544('0xac')](_0x3197ac,_0x312703);if(!_0x3dd560[_0xf544('0x38')][_0xf544('0x81')][_0xf544('0x7a')]){throw new Error(_0xf544('0xad'));}if(!_0x3dd560[_0xf544('0x38')][_0xf544('0x81')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x3d7918=path[_0xf544('0x57')](config[_0xf544('0xae')],_0xf544('0xaf'),_0x3dd560[_0xf544('0xb0')]['filename']);fs[_0xf544('0xb1')](_0x3d7918,parseInt(_0xf544('0xb2'),0x8));var _0x3c83de=require(_0xf544('0xb3'))[_0xf544('0xb4')](path[_0xf544('0x57')](__dirname,'../../components/import/cm/csv'),[_0x3d7918,_0x3dd560[_0xf544('0x38')][_0xf544('0xa6')],_0x3dd560[_0xf544('0x38')][_0xf544('0xa7')],_0x3dd560['body'][_0xf544('0x62')],_0x3dd560['body']['CompanyId'],_0x3dd560[_0xf544('0x38')][_0xf544('0x5e')],_0x3dd560[_0xf544('0x38')]['socket_timestamp']]);return _0x2c2586['status'](0xc8)[_0xf544('0x12')]({'message':_0xf544('0xb5'),'pid':_0x3c83de[_0xf544('0xb6')]});}catch(_0x24a0b2){return _0x2c2586[_0xf544('0x11')](0x1f4)[_0xf544('0xb7')](_0x24a0b2);}};exports[_0xf544('0xb8')]=function(_0x24d1f9,_0x3e6b08){var _0x155102=fs[_0xf544('0xb9')](_0x24d1f9['file'][_0xf544('0x2')]);Papa[_0xf544('0xba')](_0x155102,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x708b31){return _0x3e6b08[_0xf544('0x11')](0xc8)[_0xf544('0x12')]({'file':_0x24d1f9[_0xf544('0xb0')],'fields':_0x708b31[_0xf544('0xbb')][_0xf544('0x81')]});}});};exports[_0xf544('0xbc')]=function(_0x18c527,_0x48bb12){return db[_0xf544('0xbd')][_0xf544('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0xf544('0xbe')}})[_0xf544('0x1a')](function(_0x1fa9e5){var _0x10df7f=![];if(!_0x18c527['body']['ListId']){throw new Error(_0xf544('0xa5'));}if(!_0x18c527[_0xf544('0x38')][_0xf544('0xbf')][_0xf544('0x7a')]){throw new Error(_0xf544('0xad'));}if(!_0x18c527[_0xf544('0x38')]['binding']['firstName']){throw new Error(_0xf544('0xc0'));}if(!_0x18c527['body']['socket_timestamp']){throw new Error(_0xf544('0xa9'));}var _0x50993e=require(_0xf544('0xb3'))[_0xf544('0xb4')](path[_0xf544('0x57')](__dirname,_0xf544('0xc1')),[_0x18c527['params']['id'],JSON['stringify'](_0x18c527[_0xf544('0x38')]),JSON[_0xf544('0xc2')](_0x1fa9e5)]);_0x50993e['on']('message',function(){_0x10df7f=!![];return _0x48bb12[_0xf544('0x11')](0xc8)['json']({'message':_0xf544('0xc3'),'pid':_0x50993e['pid']});});_0x50993e['on'](_0xf544('0xc4'),function(_0x16432e){if(_0x16432e&&!_0x10df7f){return _0x48bb12[_0xf544('0x11')](0x1f4)['json']({'message':_0xf544('0xc5'),'pid':_0x50993e['pid']});}});})[_0xf544('0x28')](handleError(_0x48bb12,null));};exports[_0xf544('0xc6')]=function(_0x141aa3,_0xc63f22){return db['User'][_0xf544('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xf544('0x1a')](function(_0xf82ec5){var _0x2bf7e6=![];if(!_0x141aa3[_0xf544('0x38')]['ListId']){throw new Error(_0xf544('0xa5'));}if(!_0x141aa3[_0xf544('0x38')]['binding'][_0xf544('0x7a')]){throw new Error(_0xf544('0xad'));}if(!_0x141aa3[_0xf544('0x38')][_0xf544('0xbf')][_0xf544('0xc7')]){throw new Error(_0xf544('0xc0'));}if(!_0x141aa3['body'][_0xf544('0xc8')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3bc341=require(_0xf544('0xb3'))[_0xf544('0xb4')](path[_0xf544('0x57')](__dirname,_0xf544('0xc9')),[_0x141aa3[_0xf544('0x27')]['id'],JSON[_0xf544('0xc2')](_0x141aa3[_0xf544('0x38')]),JSON['stringify'](_0xf82ec5)]);_0x3bc341['on'](_0xf544('0xca'),function(){_0x2bf7e6=!![];return _0xc63f22['status'](0xc8)[_0xf544('0x12')]({'message':_0xf544('0xc3'),'pid':_0x3bc341['pid']});});_0x3bc341['on'](_0xf544('0xc4'),function(_0x4481ed){if(_0x4481ed&&!_0x2bf7e6){return _0xc63f22['status'](0x1f4)[_0xf544('0x12')]({'message':_0xf544('0xc5'),'pid':_0x3bc341[_0xf544('0xb6')]});}});})[_0xf544('0x28')](handleError(_0xc63f22,null));};exports[_0xf544('0xcb')]=function(_0x395e32,_0x16f5ca){var _0x425ae9=[_0xf544('0xcc'),_0xf544('0xcd'),_0xf544('0xce'),_0xf544('0xcf'),_0xf544('0xd0'),'whatsapp',_0xf544('0xd1')];var _0x178aa7={'offset':0x0,'order':qs[_0xf544('0x83')](_0xf544('0xd2'))},_0x3a87ce={'count':0x0,'rows':[]};Promise[_0xf544('0xd3')]()[_0xf544('0x1a')](function(){if(_0x395e32['query'][_0xf544('0xd4')]){if(!_[_0xf544('0xd5')](_0x425ae9,_0x395e32[_0xf544('0x24')][_0xf544('0xd4')][_0xf544('0xd6')]())){throw new Error('Invalid\x20channel');}_0x425ae9=[_0x395e32[_0xf544('0x24')][_0xf544('0xd4')]['toLowerCase']()];}if(_0x395e32[_0xf544('0x24')][_0xf544('0xd7')]){try{var _0xe0402c=JSON['parse'](_0x395e32[_0xf544('0x24')][_0xf544('0xd7')]);if(!moment(_0xe0402c[_0xf544('0x39')])[_0xf544('0xd8')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0xe0402c['to'])[_0xf544('0xd8')]()){throw new Error(_0xf544('0xd9'));}}catch(_0x5bb631){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x395e32[_0xf544('0x24')][_0xf544('0x36')](_0xf544('0x9d'))){_0x178aa7[_0xf544('0x14')]=qs[_0xf544('0x14')](_0x395e32[_0xf544('0x24')][_0xf544('0x14')]||0xa);_0x178aa7[_0xf544('0x16')]=qs[_0xf544('0x16')](_0x395e32[_0xf544('0x24')]['offset']);}var _0x4c1155=_0x425ae9['map'](function(_0x49f785){if(_0x49f785===_0xf544('0xd1')){var _0x59141d={'attributes':['id',_0xf544('0xda'),_0xf544('0x32'),_0xf544('0xdb'),_0xf544('0xdc'),'callerid',_0xf544('0xdd'),_0xf544('0xde'),_0xf544('0xdf'),_0xf544('0xe0'),_0xf544('0xe1'),_0xf544('0xe2'),'userSecondDisposition','userThirdDisposition','UserId'],'where':{'ContactId':_0x395e32['params']['id']},'include':[{'model':db[_0xf544('0xbd')],'as':'User','attributes':['id',_0xf544('0x1f'),_0xf544('0xe3'),_0xf544('0xe4')]}],'order':[[_0xf544('0xe1'),_0xf544('0xe5')]]};if(_0x395e32[_0xf544('0x24')][_0xf544('0xd7')]){_0x59141d[_0xf544('0x61')]['createdAt']={'$gte':_0xe0402c[_0xf544('0x39')],'$lte':_0xe0402c['to']};}return db['VoiceCallReport'][_0xf544('0xe6')](_0x59141d)[_0xf544('0x1a')](function(_0x21c3cd){_0x3a87ce['count']+=_0x21c3cd[_0xf544('0x15')];return _[_0xf544('0x71')](_0x21c3cd[_0xf544('0xa1')],function(_0x5013a0){var _0x19eb82=_0x5013a0[_0xf544('0x3a')]({'plain':!![]});_0x19eb82['channel']=_0x49f785;if(_0x19eb82[_0xf544('0xbd')]){_0x19eb82['User']={'id':_0x19eb82[_0xf544('0xbd')]['id'],'name':_0x19eb82['User'][_0xf544('0x1f')],'fullname':_0x19eb82[_0xf544('0xbd')][_0xf544('0xe3')],'alias':_0x19eb82[_0xf544('0xbd')][_0xf544('0xe4')]};}return _0x19eb82;});});}else{var _0x330df9=_[_0xf544('0xe7')](_0x49f785)+(_0x49f785===_0xf544('0xcd')?_0xf544('0xe8'):_0xf544('0xe9'));var _0x3085b3={'attributes':['id',_0xf544('0xea'),_0xf544('0xeb'),'createdAt',_0xf544('0xe0'),_0xf544('0xec'),'secondDisposition',_0xf544('0xed'),'UserId',_0x330df9+'Id'],'where':{'ContactId':_0x395e32[_0xf544('0x27')]['id']},'include':[{'model':db[_0x330df9],'as':_0xf544('0xe9'),'attributes':['id','name',_0xf544('0xee')]},{'model':db[_0xf544('0xbd')],'as':_0xf544('0xef'),'attributes':['id',_0xf544('0x1f'),_0xf544('0xe3')]},{'model':db[_0xf544('0x66')],'as':_0xf544('0x67'),'attributes':['id','name',_0xf544('0x68')],'through':{'attributes':[]}}],'order':[[_0xf544('0xe1'),_0xf544('0xe5')]]};if(_0x395e32['query'][_0xf544('0xd7')]){_0x3085b3[_0xf544('0x61')][_0xf544('0xe1')]={'$gte':_0xe0402c['from'],'$lte':_0xe0402c['to']};}switch(_0x49f785){case _0xf544('0xcd'):_0x3085b3[_0xf544('0x7f')][_0xf544('0x60')](_0xf544('0xf0'),_0xf544('0xf1'),_0xf544('0xf2'),_0xf544('0xf3'),_0xf544('0xf4'),_0xf544('0xf5'),'ratingType',_0xf544('0xf6'),_0xf544('0xf7'));break;case _0xf544('0xcc'):_0x3085b3['attributes']['push'](_0xf544('0xf8'),_0xf544('0xf9'));break;case'openchannel':_0x3085b3[_0xf544('0x7f')][_0xf544('0x60')](_0xf544('0xfa'),'threadId');break;}return db[_[_0xf544('0xe7')](_0x49f785)+_0xf544('0xfb')]['findAndCountAll'](_0x3085b3)[_0xf544('0x1a')](function(_0x19f619){_0x3a87ce[_0xf544('0x15')]+=_0x19f619[_0xf544('0x15')];return _['map'](_0x19f619[_0xf544('0xa1')],function(_0x5d8498){var _0x2183c1=_0x5d8498[_0xf544('0x3a')]({'plain':!![]});_0x2183c1[_0xf544('0xd4')]=_0x49f785;if(_0x2183c1['Owner']){_0x2183c1[_0xf544('0xef')]={'id':_0x2183c1['Owner']['id'],'name':_0x2183c1[_0xf544('0xef')][_0xf544('0x1f')],'fullname':_0x2183c1['Owner']['fullname']};}return _0x2183c1;});});}});return Promise[_0xf544('0x65')](_0x4c1155);})[_0xf544('0x1a')](function(_0x518636){return _(_0x518636)[_0xf544('0xfc')]()['sortBy']('createdAt')[_0xf544('0xfd')]()[_0xf544('0xfe')]();})['then'](function(_0x4224a4){_0x3a87ce[_0xf544('0xa1')]=_0x178aa7['limit']?_0x4224a4['slice'](_0x178aa7['offset'],_0x178aa7[_0xf544('0x16')]+_0x178aa7[_0xf544('0x14')]):_0x4224a4;return _0x3a87ce;})[_0xf544('0x1a')](respondWithFilteredResult(_0x16f5ca,_0x178aa7))[_0xf544('0x28')](handleError(_0x16f5ca,null));}; \ No newline at end of file +var _0x2e0b=['MailMessage','SmsInteraction','SmsMessage','FaxInteraction','CmContactHasItem','CmHopperFinal','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappQueueReport','create','isNil','dialTimezone','timezones','utcOffset','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','hasOwnProperty','additionalPhones','contact','all','show','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','Phones.OrderBy','omit','map','cf_%d','$and','pickBy','format','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','values','phone','getTags','findOne','filters','intersection','attributes','fields','model','order','sort','pick','filter','options','nolimit','limit','setTags','ids','setAdditionalPhones','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','ContactId','include','rows','getHopperHistories','CmHopperHistory','includeAll','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','join','root','server/files/tmp','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','createReadStream','parse','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','getJourney','mail','chat','sms','openchannel','fax','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','findAndCountAll','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','DESC','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','subject','substatus','externalUrl','Interaction','Owner','flatten','sortBy','reverse','value','slice','bluebird','util','path','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','undefined','offset','count','set','json','update','then','destroy','error','stack','name','send','describe','getOptions','query','user','catch','CmContact','find','params','tags','keys','cf_','columnName','displayName','CmCustomField','findAll','length','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','mergeWith','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatOfflineMessage','MailInteraction'];(function(_0x4828f3,_0x5774b6){var _0x8a2a6=function(_0x5d82dd){while(--_0x5d82dd){_0x4828f3['push'](_0x4828f3['shift']());}};_0x8a2a6(++_0x5774b6);}(_0x2e0b,0xc8));var _0xb2e0=function(_0x243cca,_0x514c2d){_0x243cca=_0x243cca-0x0;var _0xf94771=_0x2e0b[_0x243cca];return _0xf94771;};'use strict';var moment=require('moment');var BPromise=require(_0xb2e0('0x0'));var util=require(_0xb2e0('0x1'));var path=require(_0xb2e0('0x2'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xb2e0('0x3'));var contacts=require(_0xb2e0('0x4'));var qs=require(_0xb2e0('0x5'));var logger=require(_0xb2e0('0x6'))(_0xb2e0('0x7'));var config=require(_0xb2e0('0x8'));var shared=require(_0xb2e0('0x9'));var db=require(_0xb2e0('0xa'))['db'];config['redis']=_[_0xb2e0('0xb')](config[_0xb2e0('0xc')],{'host':_0xb2e0('0xd'),'port':0x18eb});var socket=require(_0xb2e0('0xe'))(new Redis(config[_0xb2e0('0xc')]));require(_0xb2e0('0xf'))[_0xb2e0('0x10')](socket);function respondWithResult(_0x403c3b,_0x38431e){_0x38431e=_0x38431e||0xc8;return function(_0x48d827){if(_0x48d827){return _0x403c3b[_0xb2e0('0x11')](_0x38431e)['json'](_0x48d827);}};}function respondWithFilteredResult(_0x1dd361,_0x4d193b){return function(_0x15dc3f){if(_0x15dc3f){var _0x443a6c=typeof _0x4d193b['offset']==='undefined'&&typeof _0x4d193b['limit']===_0xb2e0('0x12');var _0x501f5e=_0x15dc3f['count'];var _0x25a0a4=_0x443a6c?0x0:_0x4d193b[_0xb2e0('0x13')];var _0x4073a0=_0x443a6c?_0x15dc3f[_0xb2e0('0x14')]:_0x4d193b[_0xb2e0('0x13')]+_0x4d193b['limit'];var _0x3b35f0;if(_0x4073a0>=_0x501f5e){_0x4073a0=_0x501f5e;_0x3b35f0=0xc8;}else{_0x3b35f0=0xce;}_0x1dd361[_0xb2e0('0x11')](_0x3b35f0);return _0x1dd361[_0xb2e0('0x15')]('Content-Range',_0x25a0a4+'-'+_0x4073a0+'/'+_0x501f5e)[_0xb2e0('0x16')](_0x15dc3f);}return null;};}function saveUpdates(_0x3c2e3f){return function(_0x3cbeea){if(_0x3cbeea){return _0x3cbeea[_0xb2e0('0x17')](_0x3c2e3f)[_0xb2e0('0x18')](function(_0x1c6228){return _0x1c6228;});}return null;};}function removeEntity(_0x491c3d){return function(_0xaa3c25){if(_0xaa3c25){return _0xaa3c25[_0xb2e0('0x19')]()[_0xb2e0('0x18')](function(){_0x491c3d[_0xb2e0('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdbe8e7){return function(_0x530991){if(!_0x530991){_0xdbe8e7['sendStatus'](0x194);}return _0x530991;};}function handleError(_0x3caf19,_0x3eb989){_0x3eb989=_0x3eb989||0x1f4;return function(_0x2f4bee){logger[_0xb2e0('0x1a')](_0x2f4bee[_0xb2e0('0x1b')]);if(_0x2f4bee[_0xb2e0('0x1c')]){delete _0x2f4bee['name'];}_0x3caf19[_0xb2e0('0x11')](_0x3eb989)[_0xb2e0('0x1d')](_0x2f4bee);};}exports['index']=function(_0x407aae,_0x1fadce){var _0xd15daf={};return contacts[_0xb2e0('0x1e')]()[_0xb2e0('0x18')](function(_0xb931bd){_0xd15daf=qs[_0xb2e0('0x1f')](_0xb931bd,_0x407aae);return contacts['findAll'](_0x407aae[_0xb2e0('0x20')],_0x407aae[_0xb2e0('0x21')],_0xd15daf,_0xb931bd);})[_0xb2e0('0x18')](respondWithFilteredResult(_0x1fadce,_0xd15daf))[_0xb2e0('0x22')](handleError(_0x1fadce,null));};exports[_0xb2e0('0x19')]=function(_0x54a678,_0x58e7e5){return db[_0xb2e0('0x23')][_0xb2e0('0x24')]({'where':{'id':_0x54a678[_0xb2e0('0x25')]['id']}})['then'](handleEntityNotFound(_0x58e7e5,null))[_0xb2e0('0x18')](removeEntity(_0x58e7e5,null))[_0xb2e0('0x22')](handleError(_0x58e7e5,null));};exports[_0xb2e0('0x1e')]=function(_0xa1e3a8,_0x42890e){return db[_0xb2e0('0x23')][_0xb2e0('0x1e')]()[_0xb2e0('0x18')](function(_0x407e15){delete _0x407e15[_0xb2e0('0x26')];for(var _0x3e8e85=0x0;_0x3e8e850x0){return new Promise(function(_0x323ace){var _0x3a2feb=[];for(var _0xb0e7c8=0x0;_0xb0e7c8<_0x56bd11[_0xb2e0('0x2d')];_0xb0e7c8++){_0x3a2feb[_0xb2e0('0x58')](insertAdditionalPhones(_0x56bd11[_0xb0e7c8][_0xb2e0('0x5e')],_0x56bd11[_0xb0e7c8][_0xb2e0('0x5d')]));}Promise[_0xb2e0('0x5f')](_0x3a2feb)[_0xb2e0('0x18')](function(){_0x323ace(0x1);});})[_0xb2e0('0x18')](function(){return{'success':_0x2b6092,'failure':_0x1d5b7e,'duplicates':_0x201775};});}else{return{'success':_0x2b6092,'failure':_0x1d5b7e,'duplicates':_0x201775};}}})[_0xb2e0('0x18')](respondWithResult(_0x56d6c0,0xc9))[_0xb2e0('0x22')](handleError(_0x56d6c0,null));};exports[_0xb2e0('0x60')]=function(_0x493258,_0x4fb72f){var _0x283854;return db[_0xb2e0('0x23')][_0xb2e0('0x1e')]()['then'](function(_0x33b9af){return db[_0xb2e0('0x23')][_0xb2e0('0x24')]({'where':{'id':_0x493258[_0xb2e0('0x25')]['id']},'include':[{'model':db[_0xb2e0('0x61')],'as':_0xb2e0('0x62'),'attributes':['id','name',_0xb2e0('0x63')],'required':_0x493258[_0xb2e0('0x20')][_0xb2e0('0x64')]?!![]:![]},{'model':db[_0xb2e0('0x44')],'as':_0xb2e0('0x65'),'where':{'CmContactId':_0x493258[_0xb2e0('0x25')]['id']},'required':![],'include':[{'model':db[_0xb2e0('0x66')],'as':_0xb2e0('0x67')}]}],'order':[db[_0xb2e0('0x68')]['literal'](_0xb2e0('0x69'))],'attributes':_[_0xb2e0('0x27')](_0x33b9af)});})[_0xb2e0('0x18')](function(_0x3c0688){if(!_['isNil'](_0x3c0688)){_0x283854=_0x3c0688[_0xb2e0('0x36')]({'plain':!![]});var _0x298cc9={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3c0688&&_0x3c0688[_0xb2e0('0x59')]){if(_0x3c0688['ListId']){_0x298cc9[_0xb2e0('0x56')]['$and'][_0xb2e0('0x58')]({'ListId':{'$ne':_0x3c0688['ListId']}});}}return db['CmCustomField'][_0xb2e0('0x2c')](_0x298cc9);}})['then'](function(_0x206371){if(!_[_0xb2e0('0x4f')](_0x206371)){return _[_0xb2e0('0x6a')](_0x283854,_[_0xb2e0('0x6b')](_0x206371,function(_0x44ec32){return util['format'](_0xb2e0('0x6c'),_0x44ec32['id']);}));}})[_0xb2e0('0x18')](handleEntityNotFound(_0x4fb72f,null))[_0xb2e0('0x18')](respondWithResult(_0x4fb72f,null))[_0xb2e0('0x22')](handleError(_0x4fb72f,null));};exports[_0xb2e0('0x17')]=function(_0x553946,_0x5cc164){var _0x5ca3d0;if(_0x553946[_0xb2e0('0x34')]['id']){delete _0x553946[_0xb2e0('0x34')]['id'];}if(!_[_0xb2e0('0x4f')](_0x553946['body'][_0xb2e0('0x50')])){var _0x4e6e8f=_0x553946[_0xb2e0('0x34')]['dialTimezone'];if(!_[_0xb2e0('0x4f')](shared[_0xb2e0('0x51')][_0x4e6e8f]))_0x553946[_0xb2e0('0x34')][_0xb2e0('0x52')]=shared[_0xb2e0('0x51')][_0x4e6e8f]['utcOffset'];}return db['CmContact'][_0xb2e0('0x24')]({'where':{'id':_0x553946[_0xb2e0('0x25')]['id']}})[_0xb2e0('0x18')](handleEntityNotFound(_0x5cc164,null))[_0xb2e0('0x18')](saveUpdates(_0x553946[_0xb2e0('0x34')],null))['then'](function(_0x15f028){_0x5ca3d0=_0x15f028;var _0x70f369={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x15f028&&_0x15f028[_0xb2e0('0x59')]){if(_0x15f028[_0xb2e0('0x59')]){_0x70f369[_0xb2e0('0x56')][_0xb2e0('0x6d')][_0xb2e0('0x58')]({'ListId':{'$ne':_0x15f028[_0xb2e0('0x59')]}});}}return db['CmCustomField']['findAll'](_0x70f369);})[_0xb2e0('0x18')](function(_0x22747f){if(_0x22747f){return _[_0xb2e0('0x6a')](_[_0xb2e0('0x6e')](_0x553946['body'],function(_0x470ab6,_0x7e7064){return _['startsWith'](_0x7e7064,'cf_');}),_['map'](_0x22747f,function(_0xe63336){return util[_0xb2e0('0x6f')](_0xb2e0('0x6c'),_0xe63336['id']);}));}})['then'](function(_0x2ed2f7){if(_0x2ed2f7&&!_[_0xb2e0('0x70')](_0x2ed2f7)){var _0x220e2f=squel[_0xb2e0('0x17')]()[_0xb2e0('0x71')](_0xb2e0('0x72'))[_0xb2e0('0x73')](_0x2ed2f7)['where'](_0xb2e0('0x74'),_0x553946[_0xb2e0('0x25')]['id'])[_0xb2e0('0x75')]();return db[_0xb2e0('0x68')]['query'](_0x220e2f[_0xb2e0('0x76')],{'replacements':_0x220e2f[_0xb2e0('0x77')]});}})[_0xb2e0('0x18')](function(){if(_0x553946[_0xb2e0('0x34')][_0xb2e0('0x78')]&&_0x5ca3d0){return db[_0xb2e0('0x3a')]['update']({'phone':_0x553946[_0xb2e0('0x34')][_0xb2e0('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x5ca3d0['id']}});}})[_0xb2e0('0x18')](function(){return _0x5ca3d0;})[_0xb2e0('0x18')](respondWithResult(_0x5cc164,null))['catch'](handleError(_0x5cc164,null));};exports[_0xb2e0('0x79')]=function(_0x47361c,_0x1a99f5){var _0x3bf51c={};var _0x12bdc9={};var _0x3f45f8;var _0x4c22d5;return db[_0xb2e0('0x23')][_0xb2e0('0x7a')]({'where':{'id':_0x47361c[_0xb2e0('0x25')]['id']}})[_0xb2e0('0x18')](handleEntityNotFound(_0x1a99f5,null))[_0xb2e0('0x18')](function(_0x4a662a){if(_0x4a662a){_0x3f45f8=_0x4a662a;_0x12bdc9['model']=_['keys'](db[_0xb2e0('0x61')]['rawAttributes']);_0x12bdc9[_0xb2e0('0x20')]=_['keys'](_0x47361c[_0xb2e0('0x20')]);_0x12bdc9[_0xb2e0('0x7b')]=_[_0xb2e0('0x7c')](_0x12bdc9['model'],_0x12bdc9[_0xb2e0('0x20')]);_0x3bf51c[_0xb2e0('0x7d')]=_['intersection'](_0x12bdc9['model'],qs[_0xb2e0('0x7e')](_0x47361c['query'][_0xb2e0('0x7e')]));_0x3bf51c[_0xb2e0('0x7d')]=_0x3bf51c[_0xb2e0('0x7d')]['length']?_0x3bf51c[_0xb2e0('0x7d')]:_0x12bdc9[_0xb2e0('0x7f')];_0x3bf51c[_0xb2e0('0x80')]=qs[_0xb2e0('0x81')](_0x47361c[_0xb2e0('0x20')][_0xb2e0('0x81')]);_0x3bf51c[_0xb2e0('0x56')]=qs[_0xb2e0('0x7b')](_[_0xb2e0('0x82')](_0x47361c[_0xb2e0('0x20')],_0x12bdc9[_0xb2e0('0x7b')]));if(_0x47361c[_0xb2e0('0x20')][_0xb2e0('0x83')]){_0x3bf51c['where']=_[_0xb2e0('0x33')](_0x3bf51c[_0xb2e0('0x56')],{'$or':_[_0xb2e0('0x6b')](_0x3bf51c[_0xb2e0('0x7d')],function(_0x6fe8a2){var _0x1b4bbf={};_0x1b4bbf[_0x6fe8a2]={'$like':'%'+_0x47361c['query'][_0xb2e0('0x83')]+'%'};return _0x1b4bbf;})});}_0x3bf51c=_[_0xb2e0('0x33')]({},_0x3bf51c,_0x47361c[_0xb2e0('0x84')]);return _0x3f45f8['getTags'](_0x3bf51c);}})[_0xb2e0('0x18')](function(_0x4a561c){if(_0x4a561c){_0x4c22d5=_0x4a561c[_0xb2e0('0x2d')];if(!_0x47361c[_0xb2e0('0x20')][_0xb2e0('0x5c')](_0xb2e0('0x85'))){_0x3bf51c[_0xb2e0('0x86')]=qs['limit'](_0x47361c[_0xb2e0('0x20')][_0xb2e0('0x86')]);_0x3bf51c[_0xb2e0('0x13')]=qs[_0xb2e0('0x13')](_0x47361c['query'][_0xb2e0('0x13')]);}return _0x3f45f8[_0xb2e0('0x79')](_0x3bf51c);}})[_0xb2e0('0x18')](function(_0x57e928){if(_0x57e928){return _0x57e928?{'count':_0x4c22d5,'rows':_0x57e928}:null;}})['then'](respondWithResult(_0x1a99f5,null))[_0xb2e0('0x22')](handleError(_0x1a99f5,null));};exports[_0xb2e0('0x87')]=function(_0x51f62d,_0x282a96){if(_0x51f62d[_0xb2e0('0x34')]['id']){delete _0x51f62d['body']['id'];}return db['CmContact'][_0xb2e0('0x7a')]({'where':{'id':_0x51f62d[_0xb2e0('0x25')]['id']}})['then'](handleEntityNotFound(_0x282a96,null))[_0xb2e0('0x18')](function(_0x78ac77){if(_0x78ac77){return _0x78ac77[_0xb2e0('0x87')](_0x51f62d[_0xb2e0('0x34')][_0xb2e0('0x88')]||[]);}return null;})[_0xb2e0('0x18')](respondWithResult(_0x282a96,null))[_0xb2e0('0x22')](handleError(_0x282a96,null));};exports[_0xb2e0('0x89')]=function(_0x26be4c,_0xe577e4){var _0x2b82b2=[];_0x2b82b2['push'](addAdditionalPhones(_0x26be4c[_0xb2e0('0x34')]));Promise[_0xb2e0('0x5f')](_0x2b82b2)[_0xb2e0('0x18')](function(){_0x2b82b2=[];_0x2b82b2[_0xb2e0('0x58')](deleteCmHopperPhones(_0x26be4c[_0xb2e0('0x34')]['id']));_0x2b82b2[_0xb2e0('0x58')](addCmHopperPhones(_0x26be4c[_0xb2e0('0x34')]['id']));Promise[_0xb2e0('0x5f')](_0x2b82b2)[_0xb2e0('0x18')](function(){return[0x1];})[_0xb2e0('0x18')](respondWithResult(_0xe577e4,null));});};function addAdditionalPhones(_0x2c9521){var _0x4ed9a3;return new Promise(function(_0x3ddef8){return db[_0xb2e0('0x44')]['destroy']({'where':{'CmContactId':_0x2c9521['id']}})['then'](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0xb2e0('0x8a')]})['then'](function(_0x1d03eb){var _0x2917c3=[];for(var _0x1493b6=0x0;_0x1493b6<_0x2c9521['items'][_0xb2e0('0x2d')];_0x1493b6++){var _0x51a29e=_0x2c9521['item_types']?_[_0xb2e0('0x4f')](_0x2c9521['item_types'][_0x1493b6])?'':_0x2c9521[_0xb2e0('0x8b')][_0x1493b6]:_0x2c9521[_0xb2e0('0x8c')][_0x1493b6][_0xb2e0('0x8d')]?_0x2c9521[_0xb2e0('0x8c')][_0x1493b6]['ItemTypeId']:'';var _0x5d64d2=_[_0xb2e0('0x4f')](_0x2c9521[_0xb2e0('0x8c')][_0x1493b6][_0xb2e0('0x8e')])?'':_0x2c9521[_0xb2e0('0x8c')][_0x1493b6][_0xb2e0('0x8e')];var _0x498931=_0x51a29e+':'+_0x2c9521['items'][_0x1493b6][_0xb2e0('0x78')]+'§'+_0x5d64d2;if(_[_0xb2e0('0x4f')](_0x4ed9a3))_0x4ed9a3=_0x498931;else _0x4ed9a3+=';'+_0x498931;var _0xe3b543=null;var _0x5d0fc2=null;if(_0x2c9521['item_types']){if(!_[_0xb2e0('0x4f')](_0x2c9521[_0xb2e0('0x8b')][_0x1493b6])){_0x5d0fc2=_[_0xb2e0('0x24')](_0x1d03eb,function(_0x3b9bd7){return _0x3b9bd7['id']===_0x2c9521[_0xb2e0('0x8b')][_0x1493b6];});if(!_[_0xb2e0('0x4f')](_0x5d0fc2)){_0xe3b543=_0x5d0fc2['OrderBy'];}}}else{if(!_[_0xb2e0('0x4f')](_0x2c9521[_0xb2e0('0x8c')][_0x1493b6])){_0x5d0fc2=_['find'](_0x1d03eb,function(_0x328032){return _0x328032['id']===_0x2c9521[_0xb2e0('0x8c')][_0x1493b6][_0xb2e0('0x8d')];});if(!_[_0xb2e0('0x4f')](_0x5d0fc2)){_0xe3b543=_0x1493b6;}}}if(_[_0xb2e0('0x4f')](_0xe3b543)){_0xe3b543=0x64;}_0x2917c3[_0xb2e0('0x58')](addAdditionalPhone(_0x2c9521['id'],_0x2c9521[_0xb2e0('0x8c')][_0x1493b6][_0xb2e0('0x78')],_0x2c9521[_0xb2e0('0x8b')]?_['isNil'](_0x2c9521['item_types'][_0x1493b6])?null:_0x2c9521[_0xb2e0('0x8b')][_0x1493b6]:_0x2c9521[_0xb2e0('0x8c')][_0x1493b6]['ItemTypeId']?_0x2c9521[_0xb2e0('0x8c')][_0x1493b6][_0xb2e0('0x8d')]:null,_0xe3b543,_0x5d64d2));}Promise[_0xb2e0('0x5f')](_0x2917c3)['then'](function(){db[_0xb2e0('0x23')]['update']({'AdditionalPhones':_0x4ed9a3},{'where':{'id':_0x2c9521['id']}})[_0xb2e0('0x18')](function(){_0x3ddef8(0x1);});});});});});}function addAdditionalPhone(_0x5daa9c,_0x17683a,_0x23b447,_0x3d698e,_0x34d7e0){return db[_0xb2e0('0x44')]['find']({'where':{'CmContactId':_0x5daa9c,'item':_0x17683a}})[_0xb2e0('0x18')](function(_0x2fd95f){if(_0x2fd95f)logger[_0xb2e0('0x30')](_0xb2e0('0x8f'),_0x2fd95f);else{db[_0xb2e0('0x44')][_0xb2e0('0x4e')]({'CmContactId':_0x5daa9c,'item':_0x17683a,'ItemTypeId':_0x23b447,'OrderBy':_0x3d698e,'ItemClass':_0xb2e0('0x90'),'description':_0x34d7e0});}});}function deleteCmHopperPhones(_0x2558eb){return new Promise(function(_0x5a9e31){return db[_0xb2e0('0x3a')][_0xb2e0('0x2c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2558eb}})['then'](function(_0x1fc90f){db[_0xb2e0('0x91')][_0xb2e0('0x19')]({'where':{'CmHopperId':{'$in':_[_0xb2e0('0x6b')](_0x1fc90f,'id')}}});})['then'](function(){_0x5a9e31(0x1);});});}function addCmHopperPhones(_0xd51bf5){return new Promise(function(_0x3b2213){return db[_0xb2e0('0x3a')][_0xb2e0('0x2c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xd51bf5}})[_0xb2e0('0x18')](function(_0x26a9ed){var _0x580083=[];_[_0xb2e0('0x6b')](_0x26a9ed,function(_0x2ec758){_0x580083[_0xb2e0('0x58')](createCmHopperPhone(_0xd51bf5,_0x2ec758['id']));});Promise['all'](_0x580083)[_0xb2e0('0x18')](function(){_0x3b2213(0x1);});});});}function createCmHopperPhone(_0x50ca0d,_0x119f92){return new Promise(function(_0x160975){db[_0xb2e0('0x44')][_0xb2e0('0x2c')]({'raw':!![],'attributes':[_0xb2e0('0x92'),'OrderBy'],'where':{'CmContactId':_0x50ca0d,'ItemClass':_0xb2e0('0x90')},'include':[{'model':db[_0xb2e0('0x66')],'attributes':['OrderBy'],'as':_0xb2e0('0x67')}],'order':[_0xb2e0('0x8a'),db[_0xb2e0('0x68')][_0xb2e0('0x93')](_0xb2e0('0x94'))]})[_0xb2e0('0x18')](function(_0x59a0cd){var _0x5db98c=0x1;var _0x5221a0=_[_0xb2e0('0x6b')](_0x59a0cd,function(_0x20094a){_0x20094a[_0xb2e0('0x95')]=_0x119f92;_0x20094a['phone']=_0x20094a[_0xb2e0('0x92')];_0x20094a[_0xb2e0('0x8a')]=_0x5db98c;delete _0x20094a[_0xb2e0('0x96')];_0x5db98c=_0x5db98c+0x1;return _0x20094a;});return db[_0xb2e0('0x91')][_0xb2e0('0x53')](_0x5221a0,{});})[_0xb2e0('0x18')](function(){_0x160975(0x1);});});}function insertAdditionalPhones(_0x4e8cf9,_0x121c2c){return new Promise(function(_0x2395e5){var _0x42f073=[];for(var _0x739298=0x0;_0x739298<_0x121c2c[_0xb2e0('0x2d')];_0x739298++){var _0xcc2e0c=_0x121c2c[_0x739298];_0x42f073[_0xb2e0('0x58')](parseContactItemType(_0xcc2e0c));}Promise[_0xb2e0('0x5f')](_0x42f073)[_0xb2e0('0x18')](function(){var _0x28c4d8={'id':_0x4e8cf9['id'],'items':_0x121c2c};return addAdditionalPhones(_0x28c4d8)[_0xb2e0('0x18')](function(){return addCmHopperPhones(_0x4e8cf9['id']);});})['then'](function(){_0x2395e5(_0x4e8cf9);});});}function parseContactItemType(_0x2f1227){return new Promise(function(_0x427a24){if(_0x2f1227[_0xb2e0('0x5c')]('ItemTypeId')){_0x427a24(_0x2f1227);}else{return db[_0xb2e0('0x66')][_0xb2e0('0x24')]({'where':{'name':_0x2f1227[_0xb2e0('0x67')]}})[_0xb2e0('0x18')](function(_0x3ecb53){if(_[_0xb2e0('0x4f')](_0x3ecb53))_0x2f1227['ItemTypeId']=null;else _0x2f1227[_0xb2e0('0x8d')]=_0x3ecb53['id'];_0x427a24(_0x2f1227);});}});}exports[_0xb2e0('0x97')]=function(_0x2d50c4,_0x4c48fe){return db[_0xb2e0('0x44')][_0xb2e0('0x2c')]({'raw':!![],'where':{'CmContactId':_0x2d50c4[_0xb2e0('0x25')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xb2e0('0x66')],'as':'ItemType'}],'order':[[_0xb2e0('0x8a')],[db['sequelize']['literal'](_0xb2e0('0x94'))]]})[_0xb2e0('0x18')](function(_0x1ab45b){return _0x1ab45b;})[_0xb2e0('0x18')](respondWithResult(_0x4c48fe,null))[_0xb2e0('0x22')](handleError(_0x4c48fe,null));};exports[_0xb2e0('0x98')]=function(_0x2550f6,_0x2ef3f5){return db[_0xb2e0('0x44')][_0xb2e0('0x2c')]({'raw':!![],'where':{'CmContactId':_0x2550f6[_0xb2e0('0x34')][_0xb2e0('0x99')]}})[_0xb2e0('0x18')](function(_0x5f396a){var _0x4a6426=_[_0xb2e0('0x6b')](_0x5f396a,function(_0x592ce0){_0x592ce0['CmContactId']=_0x2550f6[_0xb2e0('0x34')][_0xb2e0('0x9a')];return _0x592ce0;});return db[_0xb2e0('0x44')][_0xb2e0('0x53')](_0x4a6426,{});})['then'](function(){return addCmHopperPhones(_0x2550f6[_0xb2e0('0x34')][_0xb2e0('0x9a')]);})[_0xb2e0('0x18')](function(){return['ok'];})[_0xb2e0('0x18')](respondWithResult(_0x2ef3f5,null))['catch'](handleError(_0x2ef3f5,null));};exports[_0xb2e0('0x9b')]=function(_0x586adf,_0x4d3301){var _0x57757f=[];_0x57757f[_0xb2e0('0x58')](createCmHopperPhone(_0x586adf[_0xb2e0('0x34')]['id'],_0x586adf[_0xb2e0('0x34')][_0xb2e0('0x9c')]));Promise['all'](_0x57757f)[_0xb2e0('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x4d3301,null));};exports[_0xb2e0('0x9d')]=function(_0xd275dd,_0x4ac9d7){var _0x256bb3={'raw':![],'where':{}};var _0x8c8fd4={};var _0x47bf0e={'count':0x0,'rows':[]};return db[_0xb2e0('0x23')][_0xb2e0('0x7a')]({'where':{'id':_0xd275dd['params']['id']}})[_0xb2e0('0x18')](handleEntityNotFound(_0x4ac9d7,null))['then'](function(_0x4e65c8){if(_0x4e65c8){_0x8c8fd4['model']=_[_0xb2e0('0x27')](db[_0xb2e0('0x3a')][_0xb2e0('0x9e')]);_0x8c8fd4[_0xb2e0('0x20')]=_[_0xb2e0('0x27')](_0xd275dd['query']);_0x8c8fd4['filters']=_['intersection'](_0x8c8fd4[_0xb2e0('0x7f')],_0x8c8fd4['query']);_0x256bb3[_0xb2e0('0x7d')]=_[_0xb2e0('0x7c')](_0x8c8fd4[_0xb2e0('0x7f')],qs[_0xb2e0('0x7e')](_0xd275dd[_0xb2e0('0x20')][_0xb2e0('0x7e')]));_0x256bb3[_0xb2e0('0x7d')]=_0x256bb3['attributes'][_0xb2e0('0x2d')]?_0x256bb3['attributes']:_0x8c8fd4[_0xb2e0('0x7f')];if(!_0xd275dd[_0xb2e0('0x20')][_0xb2e0('0x5c')](_0xb2e0('0x85'))){_0x256bb3[_0xb2e0('0x86')]=qs[_0xb2e0('0x86')](_0xd275dd[_0xb2e0('0x20')][_0xb2e0('0x86')]);_0x256bb3[_0xb2e0('0x13')]=qs[_0xb2e0('0x13')](_0xd275dd[_0xb2e0('0x20')]['offset']);}_0x256bb3['order']=qs[_0xb2e0('0x81')](_0xd275dd[_0xb2e0('0x20')][_0xb2e0('0x81')]);_0x256bb3[_0xb2e0('0x56')]=qs['filters'](_[_0xb2e0('0x82')](_0xd275dd[_0xb2e0('0x20')],_0x8c8fd4[_0xb2e0('0x7b')]));_0x256bb3[_0xb2e0('0x56')][_0xb2e0('0x9f')]=_0x4e65c8['id'];if(_0xd275dd[_0xb2e0('0x20')][_0xb2e0('0x83')]){_0x256bb3['where']=_[_0xb2e0('0x33')](_0x256bb3[_0xb2e0('0x56')],{'$or':_[_0xb2e0('0x6b')](_0x256bb3[_0xb2e0('0x7d')],function(_0x4205cf){var _0x5d5eb4={};_0x5d5eb4[_0x4205cf]={'$like':'%'+_0xd275dd[_0xb2e0('0x20')][_0xb2e0('0x83')]+'%'};return _0x5d5eb4;})});}_0x256bb3=_['merge']({},_0x256bb3,_0xd275dd['options']);return db[_0xb2e0('0x3a')][_0xb2e0('0x14')]({'where':_0x256bb3[_0xb2e0('0x56')]})['then'](function(_0x29c087){_0x47bf0e['count']=_0x29c087;if(_0xd275dd[_0xb2e0('0x20')]['includeAll']){_0x256bb3[_0xb2e0('0xa0')]=[{'all':!![]}];}return db['CmHopper'][_0xb2e0('0x2c')](_0x256bb3);})['then'](function(_0x71b21e){_0x47bf0e[_0xb2e0('0xa1')]=_0x71b21e;return _0x47bf0e;});}})[_0xb2e0('0x18')](respondWithFilteredResult(_0x4ac9d7,_0x256bb3))[_0xb2e0('0x22')](handleError(_0x4ac9d7,null));};exports[_0xb2e0('0xa2')]=function(_0x26abc3,_0x532a01){var _0x388b0a={'raw':!![],'where':{}};var _0x254abd={};var _0x4bfc6d={'count':0x0,'rows':[]};return db[_0xb2e0('0x23')][_0xb2e0('0x7a')]({'where':{'id':_0x26abc3[_0xb2e0('0x25')]['id']}})['then'](handleEntityNotFound(_0x532a01,null))['then'](function(_0x2d1ca0){if(_0x2d1ca0){_0x254abd[_0xb2e0('0x7f')]=_['keys'](db['CmHopperHistory'][_0xb2e0('0x9e')]);_0x254abd[_0xb2e0('0x20')]=_['keys'](_0x26abc3['query']);_0x254abd[_0xb2e0('0x7b')]=_[_0xb2e0('0x7c')](_0x254abd[_0xb2e0('0x7f')],_0x254abd['query']);_0x388b0a[_0xb2e0('0x7d')]=_[_0xb2e0('0x7c')](_0x254abd[_0xb2e0('0x7f')],qs['fields'](_0x26abc3[_0xb2e0('0x20')][_0xb2e0('0x7e')]));_0x388b0a[_0xb2e0('0x7d')]=_0x388b0a['attributes'][_0xb2e0('0x2d')]?_0x388b0a['attributes']:_0x254abd[_0xb2e0('0x7f')];if(!_0x26abc3[_0xb2e0('0x20')]['hasOwnProperty']('nolimit')){_0x388b0a['limit']=qs[_0xb2e0('0x86')](_0x26abc3[_0xb2e0('0x20')][_0xb2e0('0x86')]);_0x388b0a[_0xb2e0('0x13')]=qs[_0xb2e0('0x13')](_0x26abc3[_0xb2e0('0x20')][_0xb2e0('0x13')]);}_0x388b0a[_0xb2e0('0x80')]=qs[_0xb2e0('0x81')](_0x26abc3[_0xb2e0('0x20')][_0xb2e0('0x81')]);_0x388b0a[_0xb2e0('0x56')]=qs[_0xb2e0('0x7b')](_[_0xb2e0('0x82')](_0x26abc3['query'],_0x254abd[_0xb2e0('0x7b')]));_0x388b0a[_0xb2e0('0x56')][_0xb2e0('0x9f')]=_0x2d1ca0['id'];if(_0x26abc3[_0xb2e0('0x20')][_0xb2e0('0x83')]){_0x388b0a[_0xb2e0('0x56')]=_[_0xb2e0('0x33')](_0x388b0a[_0xb2e0('0x56')],{'$or':_[_0xb2e0('0x6b')](_0x388b0a['attributes'],function(_0x742cd7){var _0x329c0b={};_0x329c0b[_0x742cd7]={'$like':'%'+_0x26abc3[_0xb2e0('0x20')][_0xb2e0('0x83')]+'%'};return _0x329c0b;})});}_0x388b0a=_[_0xb2e0('0x33')]({},_0x388b0a,_0x26abc3[_0xb2e0('0x84')]);return db[_0xb2e0('0xa3')][_0xb2e0('0x14')]({'where':_0x388b0a[_0xb2e0('0x56')]})[_0xb2e0('0x18')](function(_0x10d88f){_0x4bfc6d['count']=_0x10d88f;if(_0x26abc3['query'][_0xb2e0('0xa4')]){_0x388b0a[_0xb2e0('0xa0')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xb2e0('0x2c')](_0x388b0a);})[_0xb2e0('0x18')](function(_0x26775f){_0x4bfc6d[_0xb2e0('0xa1')]=_0x26775f;return _0x4bfc6d;});}})[_0xb2e0('0x18')](respondWithFilteredResult(_0x532a01,_0x388b0a))[_0xb2e0('0x22')](handleError(_0x532a01,null));};exports[_0xb2e0('0xa5')]=function(_0x785be2,_0x174d54){var _0x34f14e={'raw':!![],'where':{}};var _0x429855={};var _0x426e12={'count':0x0,'rows':[]};return db[_0xb2e0('0x23')][_0xb2e0('0x7a')]({'where':{'id':_0x785be2[_0xb2e0('0x25')]['id']}})[_0xb2e0('0x18')](handleEntityNotFound(_0x174d54,null))[_0xb2e0('0x18')](function(_0xf5bac7){if(_0xf5bac7){_0x429855[_0xb2e0('0x7f')]=_[_0xb2e0('0x27')](db[_0xb2e0('0x45')]['rawAttributes']);_0x429855[_0xb2e0('0x20')]=_['keys'](_0x785be2[_0xb2e0('0x20')]);_0x429855[_0xb2e0('0x7b')]=_[_0xb2e0('0x7c')](_0x429855[_0xb2e0('0x7f')],_0x429855[_0xb2e0('0x20')]);_0x34f14e[_0xb2e0('0x7d')]=_[_0xb2e0('0x7c')](_0x429855[_0xb2e0('0x7f')],qs[_0xb2e0('0x7e')](_0x785be2[_0xb2e0('0x20')][_0xb2e0('0x7e')]));_0x34f14e[_0xb2e0('0x7d')]=_0x34f14e[_0xb2e0('0x7d')]['length']?_0x34f14e['attributes']:_0x429855['model'];if(!_0x785be2['query'][_0xb2e0('0x5c')](_0xb2e0('0x85'))){_0x34f14e[_0xb2e0('0x86')]=qs[_0xb2e0('0x86')](_0x785be2['query']['limit']);_0x34f14e[_0xb2e0('0x13')]=qs[_0xb2e0('0x13')](_0x785be2[_0xb2e0('0x20')][_0xb2e0('0x13')]);}_0x34f14e[_0xb2e0('0x80')]=qs['sort'](_0x785be2[_0xb2e0('0x20')][_0xb2e0('0x81')]);_0x34f14e[_0xb2e0('0x56')]=qs['filters'](_['pick'](_0x785be2[_0xb2e0('0x20')],_0x429855['filters']));_0x34f14e['where'][_0xb2e0('0x9f')]=_0xf5bac7['id'];if(_0x785be2[_0xb2e0('0x20')][_0xb2e0('0x83')]){_0x34f14e[_0xb2e0('0x56')]=_['merge'](_0x34f14e[_0xb2e0('0x56')],{'$or':_[_0xb2e0('0x6b')](_0x34f14e[_0xb2e0('0x7d')],function(_0x33ec5c){var _0x26de0b={};_0x26de0b[_0x33ec5c]={'$like':'%'+_0x785be2[_0xb2e0('0x20')]['filter']+'%'};return _0x26de0b;})});}_0x34f14e=_['merge']({},_0x34f14e,_0x785be2[_0xb2e0('0x84')]);return db['CmHopperFinal'][_0xb2e0('0x14')]({'where':_0x34f14e[_0xb2e0('0x56')]})[_0xb2e0('0x18')](function(_0x1dc8e3){_0x426e12[_0xb2e0('0x14')]=_0x1dc8e3;if(_0x785be2[_0xb2e0('0x20')][_0xb2e0('0xa4')]){_0x34f14e[_0xb2e0('0xa0')]=[{'all':!![]}];}return db[_0xb2e0('0x45')][_0xb2e0('0x2c')](_0x34f14e);})['then'](function(_0x268a50){_0x426e12['rows']=_0x268a50;return _0x426e12;});}})[_0xb2e0('0x18')](respondWithFilteredResult(_0x174d54,_0x34f14e))[_0xb2e0('0x22')](handleError(_0x174d54,null));};exports['getJscriptySessions']=function(_0x3b7d42,_0x3234e6){var _0x286f1e={'raw':!![],'where':{}};var _0x5a0271={};var _0x504959={'count':0x0,'rows':[]};return db[_0xb2e0('0x23')][_0xb2e0('0x7a')]({'where':{'id':_0x3b7d42['params']['id']}})[_0xb2e0('0x18')](handleEntityNotFound(_0x3234e6,null))[_0xb2e0('0x18')](function(_0x5c749d){if(_0x5c749d){_0x5a0271['model']=_[_0xb2e0('0x27')](db[_0xb2e0('0x4c')]['rawAttributes']);_0x5a0271['query']=_[_0xb2e0('0x27')](_0x3b7d42['query']);_0x5a0271[_0xb2e0('0x7b')]=_['intersection'](_0x5a0271[_0xb2e0('0x7f')],_0x5a0271[_0xb2e0('0x20')]);_0x286f1e['attributes']=_[_0xb2e0('0x7c')](_0x5a0271[_0xb2e0('0x7f')],qs['fields'](_0x3b7d42[_0xb2e0('0x20')][_0xb2e0('0x7e')]));_0x286f1e[_0xb2e0('0x7d')]=_0x286f1e[_0xb2e0('0x7d')][_0xb2e0('0x2d')]?_0x286f1e[_0xb2e0('0x7d')]:_0x5a0271[_0xb2e0('0x7f')];if(!_0x3b7d42[_0xb2e0('0x20')][_0xb2e0('0x5c')]('nolimit')){_0x286f1e[_0xb2e0('0x86')]=qs['limit'](_0x3b7d42[_0xb2e0('0x20')]['limit']);_0x286f1e[_0xb2e0('0x13')]=qs[_0xb2e0('0x13')](_0x3b7d42[_0xb2e0('0x20')]['offset']);}_0x286f1e[_0xb2e0('0x80')]=qs[_0xb2e0('0x81')](_0x3b7d42['query'][_0xb2e0('0x81')]);_0x286f1e['where']=qs[_0xb2e0('0x7b')](_['pick'](_0x3b7d42[_0xb2e0('0x20')],_0x5a0271[_0xb2e0('0x7b')]));_0x286f1e[_0xb2e0('0x56')][_0xb2e0('0x9f')]=_0x5c749d['id'];if(_0x3b7d42[_0xb2e0('0x20')][_0xb2e0('0x83')]){_0x286f1e[_0xb2e0('0x56')]=_[_0xb2e0('0x33')](_0x286f1e[_0xb2e0('0x56')],{'$or':_[_0xb2e0('0x6b')](_0x286f1e[_0xb2e0('0x7d')],function(_0x2d7d06){var _0x466f8a={};_0x466f8a[_0x2d7d06]={'$like':'%'+_0x3b7d42[_0xb2e0('0x20')][_0xb2e0('0x83')]+'%'};return _0x466f8a;})});}_0x286f1e=_['merge']({},_0x286f1e,_0x3b7d42[_0xb2e0('0x84')]);return db['JscriptySessionReport'][_0xb2e0('0x14')]({'where':_0x286f1e['where']})['then'](function(_0x49ee8b){_0x504959[_0xb2e0('0x14')]=_0x49ee8b;if(_0x3b7d42[_0xb2e0('0x20')][_0xb2e0('0xa4')]){_0x286f1e['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xb2e0('0x2c')](_0x286f1e);})[_0xb2e0('0x18')](function(_0xa2e6f4){_0x504959[_0xb2e0('0xa1')]=_0xa2e6f4;return _0x504959;});}})[_0xb2e0('0x18')](respondWithFilteredResult(_0x3234e6,_0x286f1e))[_0xb2e0('0x22')](handleError(_0x3234e6,null));};exports[_0xb2e0('0xa6')]=function(_0x3ae10d,_0x2656ac){try{if(!_0x3ae10d[_0xb2e0('0x34')][_0xb2e0('0x59')]){throw new Error(_0xb2e0('0xa7'));}if(!_0x3ae10d[_0xb2e0('0x34')][_0xb2e0('0xa8')]){throw new Error(_0xb2e0('0xa9'));}if(!_0x3ae10d[_0xb2e0('0x34')]['binding_values']){throw new Error(_0xb2e0('0xaa'));}if(!_0x3ae10d[_0xb2e0('0x34')][_0xb2e0('0xab')]){throw new Error(_0xb2e0('0xac'));}var _0x48c238=_0x3ae10d[_0xb2e0('0x34')]['binding_keys'][_0xb2e0('0xad')](',');var _0x1d0075=_0x3ae10d[_0xb2e0('0x34')][_0xb2e0('0xae')][_0xb2e0('0xad')](',');if(!_0x48c238['length']||!_0x1d0075[_0xb2e0('0x2d')]||_0x48c238[_0xb2e0('0x2d')]!==_0x1d0075[_0xb2e0('0x2d')]){throw new Error(_0xb2e0('0xaf'));}_0x3ae10d[_0xb2e0('0x34')][_0xb2e0('0x7e')]=_['zipObject'](_0x48c238,_0x1d0075);if(!_0x3ae10d['body']['fields'][_0xb2e0('0x78')]){throw new Error(_0xb2e0('0xb0'));}if(!_0x3ae10d['body']['fields'][_0xb2e0('0xb1')]){throw new Error(_0xb2e0('0xb2'));}var _0x57ccfe=path[_0xb2e0('0xb3')](config[_0xb2e0('0xb4')],_0xb2e0('0xb5'),_0x3ae10d['file'][_0xb2e0('0xb6')]);fs[_0xb2e0('0xb7')](_0x57ccfe,parseInt('0777',0x8));var _0xd1a1d6=require(_0xb2e0('0xb8'))[_0xb2e0('0xb9')](path[_0xb2e0('0xb3')](__dirname,_0xb2e0('0xba')),[_0x57ccfe,_0x3ae10d[_0xb2e0('0x34')]['binding_keys'],_0x3ae10d['body'][_0xb2e0('0xae')],_0x3ae10d[_0xb2e0('0x34')]['ListId'],_0x3ae10d[_0xb2e0('0x34')][_0xb2e0('0xbb')],_0x3ae10d[_0xb2e0('0x34')]['duplicates'],_0x3ae10d[_0xb2e0('0x34')][_0xb2e0('0xab')]]);return _0x2656ac[_0xb2e0('0x11')](0xc8)[_0xb2e0('0x16')]({'message':_0xb2e0('0xbc'),'pid':_0xd1a1d6['pid']});}catch(_0x55e260){return _0x2656ac[_0xb2e0('0x11')](0x1f4)[_0xb2e0('0x1d')](_0x55e260);}};exports['upload']=function(_0x31d3d7,_0x8ecd5f){var _0xaabfb2=fs[_0xb2e0('0xbd')](_0x31d3d7['file'][_0xb2e0('0x2')]);Papa[_0xb2e0('0xbe')](_0xaabfb2,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x171523){return _0x8ecd5f[_0xb2e0('0x11')](0xc8)[_0xb2e0('0x16')]({'file':_0x31d3d7['file'],'fields':_0x171523[_0xb2e0('0xbf')]['fields']});}});};exports[_0xb2e0('0xc0')]=function(_0x165a2b,_0x1e52f0){return db[_0xb2e0('0xc1')][_0xb2e0('0x2c')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb2e0('0xc2')}})['then'](function(_0x57cd65){var _0x1d344c=![];if(!_0x165a2b['body'][_0xb2e0('0x59')]){throw new Error(_0xb2e0('0xa7'));}if(!_0x165a2b[_0xb2e0('0x34')][_0xb2e0('0xc3')][_0xb2e0('0x78')]){throw new Error(_0xb2e0('0xb0'));}if(!_0x165a2b['body']['binding'][_0xb2e0('0xb1')]){throw new Error(_0xb2e0('0xb2'));}if(!_0x165a2b['body'][_0xb2e0('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2b5dad=require(_0xb2e0('0xb8'))[_0xb2e0('0xb9')](path['join'](__dirname,_0xb2e0('0xc4')),[_0x165a2b[_0xb2e0('0x25')]['id'],JSON[_0xb2e0('0xc5')](_0x165a2b['body']),JSON['stringify'](_0x57cd65)]);_0x2b5dad['on'](_0xb2e0('0xc6'),function(){_0x1d344c=!![];return _0x1e52f0[_0xb2e0('0x11')](0xc8)[_0xb2e0('0x16')]({'message':_0xb2e0('0xc7'),'pid':_0x2b5dad[_0xb2e0('0xc8')]});});_0x2b5dad['on'](_0xb2e0('0xc9'),function(_0x5e6403){if(_0x5e6403&&!_0x1d344c){return _0x1e52f0[_0xb2e0('0x11')](0x1f4)['json']({'message':_0xb2e0('0xca'),'pid':_0x2b5dad['pid']});}});})[_0xb2e0('0x22')](handleError(_0x1e52f0,null));};exports[_0xb2e0('0xcb')]=function(_0x32398d,_0x54052f){return db[_0xb2e0('0xc1')][_0xb2e0('0x2c')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb2e0('0xc2')}})[_0xb2e0('0x18')](function(_0xcdc326){var _0x5d03b2=![];if(!_0x32398d['body'][_0xb2e0('0x59')]){throw new Error('No\x20ListId\x20specified');}if(!_0x32398d[_0xb2e0('0x34')]['binding'][_0xb2e0('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x32398d[_0xb2e0('0x34')][_0xb2e0('0xc3')]['firstName']){throw new Error(_0xb2e0('0xb2'));}if(!_0x32398d[_0xb2e0('0x34')][_0xb2e0('0xab')]){throw new Error(_0xb2e0('0xac'));}var _0x4ab722=require(_0xb2e0('0xb8'))['fork'](path[_0xb2e0('0xb3')](__dirname,'../../components/import/cm/csvUpdates'),[_0x32398d['params']['id'],JSON[_0xb2e0('0xc5')](_0x32398d[_0xb2e0('0x34')]),JSON[_0xb2e0('0xc5')](_0xcdc326)]);_0x4ab722['on'](_0xb2e0('0xc6'),function(){_0x5d03b2=!![];return _0x54052f[_0xb2e0('0x11')](0xc8)[_0xb2e0('0x16')]({'message':_0xb2e0('0xc7'),'pid':_0x4ab722['pid']});});_0x4ab722['on'](_0xb2e0('0xc9'),function(_0x5bb97a){if(_0x5bb97a&&!_0x5d03b2){return _0x54052f[_0xb2e0('0x11')](0x1f4)[_0xb2e0('0x16')]({'message':_0xb2e0('0xca'),'pid':_0x4ab722[_0xb2e0('0xc8')]});}});})['catch'](handleError(_0x54052f,null));};exports[_0xb2e0('0xcc')]=function(_0xca365a,_0x62a073){var _0x1adbc9=[_0xb2e0('0xcd'),_0xb2e0('0xce'),_0xb2e0('0xcf'),_0xb2e0('0xd0'),_0xb2e0('0xd1'),'whatsapp',_0xb2e0('0xd2')];var _0x3392e5={'offset':0x0,'order':qs[_0xb2e0('0x81')](_0xb2e0('0xd3'))},_0x191ee3={'count':0x0,'rows':[]};Promise[_0xb2e0('0xd4')]()[_0xb2e0('0x18')](function(){if(_0xca365a[_0xb2e0('0x20')][_0xb2e0('0xd5')]){if(!_[_0xb2e0('0xd6')](_0x1adbc9,_0xca365a[_0xb2e0('0x20')][_0xb2e0('0xd5')][_0xb2e0('0xd7')]())){throw new Error(_0xb2e0('0xd8'));}_0x1adbc9=[_0xca365a[_0xb2e0('0x20')][_0xb2e0('0xd5')][_0xb2e0('0xd7')]()];}if(_0xca365a[_0xb2e0('0x20')][_0xb2e0('0xd9')]){try{var _0x5696c1=JSON['parse'](_0xca365a[_0xb2e0('0x20')][_0xb2e0('0xd9')]);if(!moment(_0x5696c1[_0xb2e0('0x35')])[_0xb2e0('0xda')]()){throw new Error(_0xb2e0('0xdb'));}if(!moment(_0x5696c1['to'])[_0xb2e0('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0xb3af0b){throw new Error(_0xb2e0('0xdc'));}}if(!_0xca365a[_0xb2e0('0x20')]['hasOwnProperty'](_0xb2e0('0x85'))){_0x3392e5['limit']=qs[_0xb2e0('0x86')](_0xca365a[_0xb2e0('0x20')]['limit']||0xa);_0x3392e5['offset']=qs[_0xb2e0('0x13')](_0xca365a[_0xb2e0('0x20')][_0xb2e0('0x13')]);}var _0x5aaba0=_0x1adbc9[_0xb2e0('0x6b')](function(_0x59c452){if(_0x59c452===_0xb2e0('0xd2')){var _0x5941f3={'attributes':['id',_0xb2e0('0xdd'),_0xb2e0('0x2f'),_0xb2e0('0xde'),_0xb2e0('0xdf'),_0xb2e0('0xe0'),_0xb2e0('0xe1'),_0xb2e0('0xe2'),_0xb2e0('0xe3'),_0xb2e0('0xe4'),_0xb2e0('0xe5'),_0xb2e0('0xe6'),_0xb2e0('0xe7'),_0xb2e0('0xe8'),_0xb2e0('0xe9')],'where':{'ContactId':_0xca365a[_0xb2e0('0x25')]['id']},'include':[{'model':db[_0xb2e0('0xc1')],'as':_0xb2e0('0xc1'),'attributes':['id',_0xb2e0('0x1c'),_0xb2e0('0xea'),_0xb2e0('0xeb')]}],'order':[[_0xb2e0('0xe5'),'DESC']]};if(_0xca365a['query'][_0xb2e0('0xd9')]){_0x5941f3[_0xb2e0('0x56')][_0xb2e0('0xe5')]={'$gte':_0x5696c1[_0xb2e0('0x35')],'$lte':_0x5696c1['to']};}return db[_0xb2e0('0x46')][_0xb2e0('0xec')](_0x5941f3)['then'](function(_0x1ecef5){_0x191ee3['count']+=_0x1ecef5[_0xb2e0('0x14')];return _[_0xb2e0('0x6b')](_0x1ecef5[_0xb2e0('0xa1')],function(_0x4e32c7){var _0x1baf31=_0x4e32c7[_0xb2e0('0x36')]({'plain':!![]});_0x1baf31[_0xb2e0('0xd5')]=_0x59c452;if(_0x1baf31[_0xb2e0('0xc1')]){_0x1baf31[_0xb2e0('0xc1')]={'id':_0x1baf31[_0xb2e0('0xc1')]['id'],'name':_0x1baf31[_0xb2e0('0xc1')][_0xb2e0('0x1c')],'fullname':_0x1baf31['User'][_0xb2e0('0xea')],'alias':_0x1baf31['User'][_0xb2e0('0xeb')]};}return _0x1baf31;});});}else{var _0x556521=_[_0xb2e0('0xed')](_0x59c452)+(_0x59c452===_0xb2e0('0xce')?_0xb2e0('0xee'):'Account');var _0x56f277={'attributes':['id',_0xb2e0('0xef'),_0xb2e0('0xf0'),_0xb2e0('0xe5'),_0xb2e0('0xe4'),_0xb2e0('0xf1'),_0xb2e0('0xf2'),_0xb2e0('0xf3'),_0xb2e0('0xe9'),_0x556521+'Id'],'where':{'ContactId':_0xca365a[_0xb2e0('0x25')]['id']},'include':[{'model':db[_0x556521],'as':_0xb2e0('0xf4'),'attributes':['id',_0xb2e0('0x1c'),_0xb2e0('0xf5')]},{'model':db[_0xb2e0('0xc1')],'as':'Owner','attributes':['id',_0xb2e0('0x1c'),_0xb2e0('0xea')]},{'model':db[_0xb2e0('0x61')],'as':_0xb2e0('0x62'),'attributes':['id',_0xb2e0('0x1c'),_0xb2e0('0x63')],'through':{'attributes':[]}}],'order':[[_0xb2e0('0xe5'),_0xb2e0('0xf6')]]};if(_0xca365a[_0xb2e0('0x20')]['range']){_0x56f277[_0xb2e0('0x56')]['createdAt']={'$gte':_0x5696c1[_0xb2e0('0x35')],'$lte':_0x5696c1['to']};}switch(_0x59c452){case'chat':_0x56f277[_0xb2e0('0x7d')]['push'](_0xb2e0('0xf7'),_0xb2e0('0xf8'),_0xb2e0('0xf9'),'deviceModel',_0xb2e0('0xfa'),_0xb2e0('0xfb'),_0xb2e0('0xfc'),_0xb2e0('0xfd'),'referer');break;case _0xb2e0('0xcd'):_0x56f277[_0xb2e0('0x7d')]['push'](_0xb2e0('0xfe'),_0xb2e0('0xff'));break;case _0xb2e0('0xd0'):_0x56f277[_0xb2e0('0x7d')]['push'](_0xb2e0('0x100'),'threadId');break;}return db[_[_0xb2e0('0xed')](_0x59c452)+_0xb2e0('0x101')][_0xb2e0('0xec')](_0x56f277)[_0xb2e0('0x18')](function(_0x32ee4e){_0x191ee3[_0xb2e0('0x14')]+=_0x32ee4e[_0xb2e0('0x14')];return _['map'](_0x32ee4e['rows'],function(_0x258e7f){var _0x2bc281=_0x258e7f[_0xb2e0('0x36')]({'plain':!![]});_0x2bc281[_0xb2e0('0xd5')]=_0x59c452;if(_0x2bc281[_0xb2e0('0x102')]){_0x2bc281[_0xb2e0('0x102')]={'id':_0x2bc281[_0xb2e0('0x102')]['id'],'name':_0x2bc281[_0xb2e0('0x102')]['name'],'fullname':_0x2bc281[_0xb2e0('0x102')]['fullname']};}return _0x2bc281;});});}});return Promise[_0xb2e0('0x5f')](_0x5aaba0);})[_0xb2e0('0x18')](function(_0x24caea){return _(_0x24caea)[_0xb2e0('0x103')]()[_0xb2e0('0x104')](_0xb2e0('0xe5'))[_0xb2e0('0x105')]()[_0xb2e0('0x106')]();})[_0xb2e0('0x18')](function(_0x1baddf){_0x191ee3[_0xb2e0('0xa1')]=_0x3392e5[_0xb2e0('0x86')]?_0x1baddf[_0xb2e0('0x107')](_0x3392e5['offset'],_0x3392e5['offset']+_0x3392e5['limit']):_0x1baddf;return _0x191ee3;})['then'](respondWithFilteredResult(_0x62a073,_0x3392e5))[_0xb2e0('0x22')](handleError(_0x62a073,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index b97ef4d..95c1d7c 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef6a=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x1f7f6e,_0x103a61){var _0x2747df=function(_0x35a06e){while(--_0x35a06e){_0x1f7f6e['push'](_0x1f7f6e['shift']());}};_0x2747df(++_0x103a61);}(_0xef6a,0x119));var _0xaef6=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xef6a[_0x4792c8];return _0x35edb1;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xaef6('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xaef6('0x1')](0x0);var events={'afterCreate':_0xaef6('0x2'),'afterUpdate':_0xaef6('0x3'),'afterDestroy':_0xaef6('0x4')};function emitEvent(_0x364601){return function(_0x2c8221,_0x1cb82c,_0x20f444){CmContactEvents[_0xaef6('0x5')](_0x364601+':'+_0x2c8221['id'],_0x2c8221);CmContactEvents[_0xaef6('0x5')](_0x364601,_0x2c8221);_0x20f444(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xaef6('0x6')](e,emitEvent(event));}}module[_0xaef6('0x7')]=CmContactEvents; \ No newline at end of file +var _0x7c41=['emit','hasOwnProperty','hook','exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove'];(function(_0x14ad7c,_0x42aa77){var _0x3928cc=function(_0x1e6f70){while(--_0x1e6f70){_0x14ad7c['push'](_0x14ad7c['shift']());}};_0x3928cc(++_0x42aa77);}(_0x7c41,0x180));var _0x17c4=function(_0x1f57a8,_0xf93936){_0x1f57a8=_0x1f57a8-0x0;var _0x4353ed=_0x7c41[_0x1f57a8];return _0x4353ed;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x17c4('0x0'))['db'][_0x17c4('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x17c4('0x2')](0x0);var events={'afterCreate':_0x17c4('0x3'),'afterUpdate':_0x17c4('0x4'),'afterDestroy':_0x17c4('0x5')};function emitEvent(_0x20e1ef){return function(_0x218509,_0x3f9ccd,_0x5dcc8a){CmContactEvents[_0x17c4('0x6')](_0x20e1ef+':'+_0x218509['id'],_0x218509);CmContactEvents[_0x17c4('0x6')](_0x20e1ef,_0x218509);_0x5dcc8a(null);};}for(var e in events){if(events[_0x17c4('0x7')](e)){var event=events[e];CmContact[_0x17c4('0x8')](e,emitEvent(event));}}module[_0x17c4('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 0fde338..cb39e36 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3973=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','CmHopperBlack','BlackLists','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','destroy','ContactId','push','all','inspect','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','firstName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','add','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal'];(function(_0x1d5fb9,_0x43aa73){var _0xd72009=function(_0x44052e){while(--_0x44052e){_0x1d5fb9['push'](_0x1d5fb9['shift']());}};_0xd72009(++_0x43aa73);}(_0x3973,0xdd));var _0x3397=function(_0x54e18b,_0x9e4e7a){_0x54e18b=_0x54e18b-0x0;var _0x199dbd=_0x3973[_0x54e18b];return _0x199dbd;};'use strict';var _=require('lodash');var util=require(_0x3397('0x0'));var logger=require(_0x3397('0x1'))(_0x3397('0x2'));var moment=require(_0x3397('0x3'));var BPromise=require('bluebird');var rp=require(_0x3397('0x4'));var fs=require('fs');var path=require(_0x3397('0x5'));var rimraf=require(_0x3397('0x6'));var config=require(_0x3397('0x7'));var shared=require(_0x3397('0x8'));var attributes=require(_0x3397('0x9'));module[_0x3397('0xa')]=function(_0x24ea45,_0x3ffb6e){return _0x24ea45['define'](_0x3397('0xb'),attributes,{'tableName':_0x3397('0xc'),'paranoid':!![],'indexes':[{'name':_0x3397('0xd'),'fields':[_0x3397('0xd')]},{'name':'fti_cm_contacts','fields':[_0x3397('0xe'),'lastName',_0x3397('0xd'),_0x3397('0xf'),'fax',_0x3397('0x10')],'type':_0x3397('0x11')}],'timestamps':!![],'charset':_0x3397('0x12'),'collate':_0x3397('0x13'),'hooks':{'afterCreate':function(_0xbee250,_0x257f67,_0x24b3c8){var _0x47ed4b=_0x24ea45[_0x3397('0x14')];var _0x44fa91=_0xbee250[_0x3397('0x15')]({'plain':!![]});function _0x403782(){return function(_0x19260b){logger[_0x3397('0x16')]('cmContact',_0x3397('0x17'),util['inspect'](_0x19260b,{'showHidden':![],'depth':null}));};}function _0x4d1bd2(_0x24906a,_0xb15a86){var _0xae0e14=_0xb15a86[_0x3397('0x18')]?_0xb15a86[_0x3397('0x18')]:moment()[_0x3397('0x19')](_0x3397('0x1a'));return new BPromise(function(_0x20d761,_0x1e4ccf){if(_[_0x3397('0x1b')](_0xb15a86[_0x3397('0x1c')])){_0x20d761({'ret':_0xae0e14});}else{_0x47ed4b[_0x3397('0x1d')][_0x3397('0x1e')]({'where':{'id':_0x24906a['id']}})['then'](function(_0xc1d6cc){if(!_['isNil'](_0xc1d6cc)){var _0x4dd4fb=_0xc1d6cc['dialTimezone'];if(!_[_0x3397('0x1b')](_0x4dd4fb)){var _0x4833d2=shared[_0x3397('0x1f')];var _0x48bcff=_0x4833d2[_0x4dd4fb];var _0x2eb4b9=_0x4833d2[_0xb15a86[_0x3397('0x1c')]];if(!_['isNil'](_0x48bcff)&&!_[_0x3397('0x1b')](_0x2eb4b9)){var _0x582f69=_0x48bcff[_0x3397('0x20')]-_0x2eb4b9[_0x3397('0x20')];_0xae0e14=_0xb15a86[_0x3397('0x18')]?_0xb15a86[_0x3397('0x18')]:moment();var _0x1b1eab=moment(_0xae0e14)[_0x3397('0x21')](_0x582f69,'minutes');_0x20d761({'ret':_0x1b1eab['format'](_0x3397('0x1a'))});}else _0x20d761({'ret':_0xae0e14});}else _0x20d761({'ret':_0xae0e14});}else{_0x20d761({'ret':_0xae0e14});}});}});return 0xa;}var _0x53d4f2=function(_0x5778d5){return new BPromise(function(_0x3c8fa,_0x3cc7fc){_0x4d1bd2(_0x5778d5,_0x44fa91)[_0x3397('0x22')](function(_0x50ff99){_0x44fa91['scheduledat']=_0x50ff99[_0x3397('0x23')];_0x47ed4b[_0x3397('0x24')][_0x3397('0x1e')]({'where':{'phone':_0x44fa91[_0x3397('0xd')],'VoiceQueueId':_0x5778d5['id']}})[_0x3397('0x22')](function(_0x1e086a){if(!_[_0x3397('0x1b')](_0x1e086a)){throw new Error(_0x3397('0x25')+_0x44fa91[_0x3397('0xd')]+_0x3397('0x26')+_0x5778d5['id']);}return _0x47ed4b[_0x3397('0x24')][_0x3397('0x27')]({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'priority':_0x44fa91[_0x3397('0x29')]?_0x44fa91['priority']:0x2,'scheduledat':_0x44fa91['scheduledat']?_0x44fa91[_0x3397('0x18')]:moment()[_0x3397('0x19')](_0x3397('0x1a')),'callback':_0x44fa91[_0x3397('0x2a')]?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91[_0x3397('0x2a')]?moment()[_0x3397('0x19')](_0x3397('0x1a')):undefined,'VoiceQueueId':_0x5778d5['id']});})[_0x3397('0x2b')](function(_0x575357){_0x3cc7fc(_0x575357);});});});};var _0x258b62=function(_0xb6662c){return new BPromise(function(_0x3c2faf,_0x1d56ef){_0x4d1bd2(_0xb6662c,_0x44fa91)[_0x3397('0x22')](function(_0x28dc28){_0x44fa91[_0x3397('0x18')]=_0x28dc28[_0x3397('0x23')];_0x47ed4b[_0x3397('0x24')][_0x3397('0x1e')]({'where':{'phone':_0x44fa91[_0x3397('0xd')],'VoiceQueueId':_0xb6662c['id']}})[_0x3397('0x22')](function(_0x48dea4){if(!_[_0x3397('0x1b')](_0x48dea4)){throw new Error(_0x3397('0x25')+_0x44fa91[_0x3397('0xd')]+_0x3397('0x2c')+_0xb6662c['id']);}return _0x47ed4b['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x44fa91[_0x3397('0xd')],'VoiceQueueId':_0xb6662c['id']}});})['then'](function(_0x53c541){if(!_[_0x3397('0x1b')](_0x53c541)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x44fa91[_0x3397('0xd')]+_0x3397('0x2d')+_0xb6662c['id']);}return _0x47ed4b['CmHopper']['create']({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'priority':_0x44fa91['priority']?_0x44fa91[_0x3397('0x29')]:0x2,'scheduledat':_0x44fa91[_0x3397('0x18')]?_0x44fa91['scheduledat']:moment()[_0x3397('0x19')](_0x3397('0x1a')),'callback':_0x44fa91[_0x3397('0x2a')]?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91['callbackUniqueid']?moment()[_0x3397('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xb6662c['id']});})[_0x3397('0x2b')](function(_0x319ac2){_0x1d56ef(_0x319ac2);});});});};function _0x54246b(){return function(_0x24b59e){logger[_0x3397('0x16')]('cmContact',_0x3397('0x17'),util['inspect'](_0x24b59e,{'showHidden':![],'depth':null}));};}function _0x74c431(_0x154063,_0x2fccd1){var _0x583979=_0x2fccd1[_0x3397('0x18')]?_0x2fccd1[_0x3397('0x18')]:moment()[_0x3397('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0xe95129,_0x3d9927){if(_[_0x3397('0x1b')](_0x2fccd1[_0x3397('0x1c')])){_0xe95129({'ret':_0x583979});}else{_0x47ed4b[_0x3397('0x2e')]['findOne']({'where':{'id':_0x154063['id']}})[_0x3397('0x22')](function(_0x3ebd7f){if(!_[_0x3397('0x1b')](_0x3ebd7f)){var _0x1eb4ea=_0x3ebd7f[_0x3397('0x1c')];if(!_[_0x3397('0x1b')](_0x1eb4ea)){var _0x1cbb5d=shared[_0x3397('0x1f')];var _0x3a850a=_0x1cbb5d[_0x1eb4ea];var _0xa53f4c=_0x1cbb5d[_0x2fccd1[_0x3397('0x1c')]];if(!_[_0x3397('0x1b')](_0x3a850a)&&!_[_0x3397('0x1b')](_0xa53f4c)){var _0x4c5ffb=_0x3a850a[_0x3397('0x20')]-_0xa53f4c[_0x3397('0x20')];_0x583979=_0x2fccd1['scheduledat']?_0x2fccd1[_0x3397('0x18')]:moment();var _0x591a93=moment(_0x583979)['add'](_0x4c5ffb,_0x3397('0x2f'));_0xe95129({'ret':_0x591a93[_0x3397('0x19')](_0x3397('0x1a'))});}else _0xe95129({'ret':_0x583979});}else _0xe95129({'ret':_0x583979});}else{_0xe95129({'ret':_0x583979});}});}});return 0xa;}var _0x1e3230=function(_0x7808f9){return new BPromise(function(_0x3b60b3,_0x4085d5){_0x74c431(_0x7808f9,_0x44fa91)[_0x3397('0x22')](function(_0x25a865){_0x44fa91[_0x3397('0x18')]=_0x25a865[_0x3397('0x23')];_0x47ed4b[_0x3397('0x24')][_0x3397('0x1e')]({'where':{'phone':_0x44fa91[_0x3397('0xd')],'CampaignId':_0x7808f9['id']}})[_0x3397('0x22')](function(_0x2504a9){if(!_[_0x3397('0x1b')](_0x2504a9)){throw new Error(_0x3397('0x25')+_0x44fa91['phone']+_0x3397('0x30')+_0x7808f9['id']);}return _0x47ed4b[_0x3397('0x24')]['create']({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91['ListId'],'priority':_0x44fa91['priority']?_0x44fa91[_0x3397('0x29')]:0x2,'scheduledat':_0x44fa91['scheduledat']?_0x44fa91[_0x3397('0x18')]:moment()[_0x3397('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x44fa91[_0x3397('0x2a')]?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91['callbackUniqueid']?moment()[_0x3397('0x19')](_0x3397('0x1a')):undefined,'CampaignId':_0x7808f9['id']});})['catch'](function(_0x28bf59){_0x4085d5(_0x28bf59);});});});};var _0x33e946=function(_0x5b8fea){return new BPromise(function(_0x883c50,_0x2beb02){_0x74c431(_0x5b8fea,_0x44fa91)[_0x3397('0x22')](function(_0x660655){_0x44fa91[_0x3397('0x18')]=_0x660655[_0x3397('0x23')];_0x47ed4b['CmHopper']['findOne']({'where':{'phone':_0x44fa91[_0x3397('0xd')],'CampaignId':_0x5b8fea['id']}})[_0x3397('0x22')](function(_0x2eb10f){if(!_[_0x3397('0x1b')](_0x2eb10f)){throw new Error(_0x3397('0x25')+_0x44fa91['phone']+_0x3397('0x31')+_0x5b8fea['id']);}return _0x47ed4b[_0x3397('0x32')]['findOne']({'where':{'calleridnum':_0x44fa91['phone'],'CampaignId':_0x5b8fea['id']}});})['then'](function(_0x556a95){if(!_[_0x3397('0x1b')](_0x556a95)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x44fa91[_0x3397('0xd')]+_0x3397('0x33')+_0x5b8fea['id']);}return _0x47ed4b[_0x3397('0x24')]['create']({'phone':_0x44fa91['phone'],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91['ListId'],'priority':_0x44fa91[_0x3397('0x29')]?_0x44fa91[_0x3397('0x29')]:0x2,'scheduledat':_0x44fa91['scheduledat']?_0x44fa91[_0x3397('0x18')]:moment()[_0x3397('0x19')](_0x3397('0x1a')),'callback':_0x44fa91[_0x3397('0x2a')]?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91[_0x3397('0x2a')]?moment()[_0x3397('0x19')](_0x3397('0x1a')):undefined,'CampaignId':_0x5b8fea['id']});})[_0x3397('0x2b')](function(_0x1cbbce){_0x2beb02(_0x1cbbce);});});});};if(_0x44fa91['ListId']){_0x47ed4b[_0x3397('0x1d')][_0x3397('0x34')]({'where':{'type':_0x3397('0x35')},'attributes':['id','dialCheckDuplicateType',_0x3397('0x1c')],'include':[{'model':_0x47ed4b[_0x3397('0x36')],'as':_0x3397('0x37'),'where':{'id':_0x44fa91['ListId']}}]})['then'](function(_0x42e065){if(_0x42e065){var _0x2999b3=[];for(var _0x32736d=0x0,_0x2dd4a7;_0x32736d<_0x42e065[_0x3397('0x38')];_0x32736d+=0x1){_0x2dd4a7=_0x42e065[_0x32736d][_0x3397('0x15')]({'plain':!![]});switch(_0x2dd4a7[_0x3397('0x39')]){case'always':_0x258b62(_0x2dd4a7)[_0x3397('0x2b')](_0x403782());break;case'onlyIfOpen':_0x53d4f2(_0x2dd4a7)['catch'](_0x403782());break;default:_0x74c431(_0x2dd4a7,_0x44fa91)[_0x3397('0x22')](function(_0x3191b9){_0x44fa91[_0x3397('0x18')]=_0x3191b9[_0x3397('0x23')];_0x47ed4b[_0x3397('0x24')]['create']({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'scheduledat':_0x44fa91[_0x3397('0x18')]?_0x44fa91['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x44fa91['priority']?_0x44fa91[_0x3397('0x29')]:0x2,'callback':_0x44fa91[_0x3397('0x2a')]?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91[_0x3397('0x2a')]?moment()[_0x3397('0x19')](_0x3397('0x1a')):undefined,'VoiceQueueId':_0x2dd4a7['id']})[_0x3397('0x2b')](_0x403782());});}}}})[_0x3397('0x22')](function(){return _0x47ed4b[_0x3397('0x1d')]['findAll']({'where':{'type':_0x3397('0x35')},'attributes':['id'],'include':[{'model':_0x47ed4b['CmList'],'as':'BlackLists','where':{'id':_0x44fa91['ListId']}}]})['then'](function(_0x36accb){if(_0x36accb){var _0x26050b=[];for(var _0x4c92f9=0x0,_0x467db3;_0x4c92f9<_0x36accb['length'];_0x4c92f9+=0x1){_0x467db3=_0x36accb[_0x4c92f9][_0x3397('0x15')]({'plain':!![]});_0x47ed4b[_0x3397('0x3a')]['create']({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'VoiceQueueId':_0x467db3['id']})['catch'](function(_0x32aa05){logger[_0x3397('0x16')]('cmContact,\x20%s,\x20%s',_0x3397('0x17'),_0x32aa05['message']);});}}});})['then'](function(){return _0x47ed4b[_0x3397('0x2e')]['findAll']({'attributes':['id',_0x3397('0x39'),_0x3397('0x1c')],'include':[{'model':_0x47ed4b[_0x3397('0x36')],'as':_0x3397('0x37'),'where':{'id':_0x44fa91[_0x3397('0x28')]}}]})[_0x3397('0x22')](function(_0x54e815){if(_0x54e815){var _0x2bcc71=[];for(var _0x24e7d6=0x0,_0x248830;_0x24e7d6<_0x54e815['length'];_0x24e7d6+=0x1){_0x248830=_0x54e815[_0x24e7d6][_0x3397('0x15')]({'plain':!![]});switch(_0x248830[_0x3397('0x39')]){case'always':_0x33e946(_0x248830)[_0x3397('0x2b')](_0x54246b());break;case'onlyIfOpen':_0x1e3230(_0x248830)[_0x3397('0x2b')](_0x54246b());break;default:_0x47ed4b[_0x3397('0x24')][_0x3397('0x27')]({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'scheduledat':_0x44fa91[_0x3397('0x18')]?_0x44fa91[_0x3397('0x18')]:moment()[_0x3397('0x19')](_0x3397('0x1a')),'priority':_0x44fa91[_0x3397('0x29')]?_0x44fa91[_0x3397('0x29')]:0x2,'callback':_0x44fa91['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91[_0x3397('0x2a')]?moment()['format'](_0x3397('0x1a')):undefined,'CampaignId':_0x248830['id']})[_0x3397('0x2b')](_0x54246b());}}}});})[_0x3397('0x22')](function(){return _0x47ed4b[_0x3397('0x2e')][_0x3397('0x34')]({'attributes':['id'],'include':[{'model':_0x47ed4b[_0x3397('0x36')],'as':_0x3397('0x3b'),'where':{'id':_0x44fa91['ListId']}}]})['then'](function(_0x4fa213){if(_0x4fa213){var _0x386db9=[];for(var _0x5a3a6f=0x0,_0x4f8aec;_0x5a3a6f<_0x4fa213[_0x3397('0x38')];_0x5a3a6f+=0x1){_0x4f8aec=_0x4fa213[_0x5a3a6f][_0x3397('0x15')]({'plain':!![]});_0x47ed4b['CmHopperBlack'][_0x3397('0x27')]({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'CampaignId':_0x4f8aec['id']})['catch'](function(_0x17c784){logger['error'](_0x3397('0x3c'),_0x3397('0x17'),_0x17c784[_0x3397('0x3d')]);});}}});})['then'](function(){_0x24b3c8();})[_0x3397('0x2b')](function(_0x4e187b){logger[_0x3397('0x16')](_0x3397('0x3c'),_0x3397('0x17'),_0x4e187b[_0x3397('0x3d')]);_0x24b3c8(_0x4e187b);});}else{_0x24b3c8(new Error(_0x3397('0x3e')));}},'afterDestroy':function(_0xe751b7,_0x3140f2,_0x361863){var _0x274557=_0x24ea45[_0x3397('0x14')];var _0x23e60a=_0xe751b7['get']({'plain':!![]});return _0x274557['CmHopper'][_0x3397('0x34')]({'raw':!![],'where':{'ListId':_0x23e60a[_0x3397('0x28')],'ContactId':_0x23e60a['id']}})[_0x3397('0x22')](function(_0x2223ac){if(!_['isEmpty'](_0x2223ac)){var _0xc044c=[];for(var _0x5cc342=0x0;_0x5cc342<_0x2223ac[_0x3397('0x38')];_0x5cc342+=0x1){var _0x17492c=_0x274557['CmHopper'][_0x3397('0x3f')]({'where':{'ListId':_0x2223ac[_0x5cc342]['ListId'],'ContactId':_0x2223ac[_0x5cc342][_0x3397('0x40')],'VoiceQueueId':_0x2223ac[_0x5cc342]['VoiceQueueId'],'CampaignId':_0x2223ac[_0x5cc342]['CampaignId']}});_0xc044c[_0x3397('0x41')](_0x17492c);}return BPromise[_0x3397('0x42')](_0xc044c);}})[_0x3397('0x22')](function(_0x47a32c){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x3397('0x43')](_0x47a32c,{'showHidden':![],'depth':null}));_0x361863();})[_0x3397('0x2b')](function(_0x45841d){logger[_0x3397('0x16')]('[CmContact][afterDestroy][Error]',util[_0x3397('0x43')](_0x45841d,{'showHidden':![],'depth':null}));_0x361863(_0x45841d);});}}});}; \ No newline at end of file +var _0xa3a6=['[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','error','cmContact','afterCreate','scheduledat','format','isNil','dialTimezone','findOne','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','inspect','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','length','always','onlyIfOpen','CmList','BlackLists','get','CmHopperBlack','message','Lists','Campaign','cmContact,\x20%s,\x20%s','List\x20not\x20found','models','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3a6,0xf2));var _0x6a3a=function(_0x1abe22,_0x417502){_0x1abe22=_0x1abe22-0x0;var _0x568db1=_0xa3a6[_0x1abe22];return _0x568db1;};'use strict';var _=require(_0x6a3a('0x0'));var util=require(_0x6a3a('0x1'));var logger=require(_0x6a3a('0x2'))('api');var moment=require(_0x6a3a('0x3'));var BPromise=require(_0x6a3a('0x4'));var rp=require(_0x6a3a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a3a('0x6'));var config=require(_0x6a3a('0x7'));var shared=require(_0x6a3a('0x8'));var attributes=require(_0x6a3a('0x9'));module[_0x6a3a('0xa')]=function(_0x26c7c6,_0x56e446){return _0x26c7c6[_0x6a3a('0xb')](_0x6a3a('0xc'),attributes,{'tableName':_0x6a3a('0xd'),'paranoid':!![],'indexes':[{'name':_0x6a3a('0xe'),'fields':['phone']},{'name':'fti_cm_contacts','fields':[_0x6a3a('0xf'),_0x6a3a('0x10'),_0x6a3a('0xe'),_0x6a3a('0x11'),_0x6a3a('0x12'),_0x6a3a('0x13')],'type':_0x6a3a('0x14')}],'timestamps':!![],'charset':_0x6a3a('0x15'),'collate':_0x6a3a('0x16'),'hooks':{'afterCreate':function(_0x1e28e7,_0x5a49b4,_0x109aa7){var _0x2547d0=_0x26c7c6['models'];var _0x339603=_0x1e28e7['get']({'plain':!![]});function _0x1d3ea5(){return function(_0x274f58){logger[_0x6a3a('0x17')](_0x6a3a('0x18'),_0x6a3a('0x19'),util['inspect'](_0x274f58,{'showHidden':![],'depth':null}));};}function _0x4a7df4(_0x48b5ab,_0x2d1317){var _0x6a09a1=_0x2d1317[_0x6a3a('0x1a')]?_0x2d1317[_0x6a3a('0x1a')]:moment()[_0x6a3a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x534dad,_0x1a354a){if(_[_0x6a3a('0x1c')](_0x2d1317[_0x6a3a('0x1d')])){_0x534dad({'ret':_0x6a09a1});}else{_0x2547d0['VoiceQueue'][_0x6a3a('0x1e')]({'where':{'id':_0x48b5ab['id']}})[_0x6a3a('0x1f')](function(_0x5ac412){if(!_[_0x6a3a('0x1c')](_0x5ac412)){var _0x3f7597=_0x5ac412['dialTimezone'];if(!_[_0x6a3a('0x1c')](_0x3f7597)){var _0x3707dc=shared[_0x6a3a('0x20')];var _0x302b45=_0x3707dc[_0x3f7597];var _0x48722b=_0x3707dc[_0x2d1317[_0x6a3a('0x1d')]];if(!_[_0x6a3a('0x1c')](_0x302b45)&&!_[_0x6a3a('0x1c')](_0x48722b)){var _0x362614=_0x302b45[_0x6a3a('0x21')]-_0x48722b[_0x6a3a('0x21')];_0x6a09a1=_0x2d1317[_0x6a3a('0x1a')]?_0x2d1317[_0x6a3a('0x1a')]:moment();var _0x8133c6=moment(_0x6a09a1)[_0x6a3a('0x22')](_0x362614,_0x6a3a('0x23'));_0x534dad({'ret':_0x8133c6[_0x6a3a('0x1b')](_0x6a3a('0x24'))});}else _0x534dad({'ret':_0x6a09a1});}else _0x534dad({'ret':_0x6a09a1});}else{_0x534dad({'ret':_0x6a09a1});}});}});return 0xa;}var _0x9b3673=function(_0x1d354e){return new BPromise(function(_0x44c3dc,_0x31028e){_0x4a7df4(_0x1d354e,_0x339603)[_0x6a3a('0x1f')](function(_0xd9cef9){_0x339603[_0x6a3a('0x1a')]=_0xd9cef9[_0x6a3a('0x25')];_0x2547d0[_0x6a3a('0x26')][_0x6a3a('0x1e')]({'where':{'phone':_0x339603[_0x6a3a('0xe')],'VoiceQueueId':_0x1d354e['id']}})[_0x6a3a('0x1f')](function(_0x55d004){if(!_['isNil'](_0x55d004)){throw new Error(_0x6a3a('0x27')+_0x339603[_0x6a3a('0xe')]+_0x6a3a('0x28')+_0x1d354e['id']);}return _0x2547d0['CmHopper'][_0x6a3a('0x29')]({'phone':_0x339603[_0x6a3a('0xe')],'ContactId':_0x339603['id'],'ListId':_0x339603[_0x6a3a('0x2a')],'priority':_0x339603[_0x6a3a('0x2b')]?_0x339603['priority']:0x2,'scheduledat':_0x339603[_0x6a3a('0x1a')]?_0x339603[_0x6a3a('0x1a')]:moment()[_0x6a3a('0x1b')](_0x6a3a('0x24')),'callback':_0x339603[_0x6a3a('0x2c')]?!![]:![],'callbackuniqueid':_0x339603[_0x6a3a('0x2c')]?_0x339603['callbackUniqueid']:undefined,'callbackat':_0x339603[_0x6a3a('0x2c')]?moment()[_0x6a3a('0x1b')](_0x6a3a('0x24')):undefined,'VoiceQueueId':_0x1d354e['id']});})[_0x6a3a('0x2d')](function(_0x39395f){_0x31028e(_0x39395f);});});});};var _0x5db065=function(_0x3923a4){return new BPromise(function(_0x19c850,_0x60dcc6){_0x4a7df4(_0x3923a4,_0x339603)['then'](function(_0x1f3893){_0x339603[_0x6a3a('0x1a')]=_0x1f3893[_0x6a3a('0x25')];_0x2547d0['CmHopper'][_0x6a3a('0x1e')]({'where':{'phone':_0x339603[_0x6a3a('0xe')],'VoiceQueueId':_0x3923a4['id']}})[_0x6a3a('0x1f')](function(_0x1a144b){if(!_[_0x6a3a('0x1c')](_0x1a144b)){throw new Error(_0x6a3a('0x27')+_0x339603[_0x6a3a('0xe')]+_0x6a3a('0x2e')+_0x3923a4['id']);}return _0x2547d0[_0x6a3a('0x2f')][_0x6a3a('0x1e')]({'where':{'calleridnum':_0x339603[_0x6a3a('0xe')],'VoiceQueueId':_0x3923a4['id']}});})['then'](function(_0x203c65){if(!_[_0x6a3a('0x1c')](_0x203c65)){throw new Error(_0x6a3a('0x30')+_0x339603[_0x6a3a('0xe')]+_0x6a3a('0x31')+_0x3923a4['id']);}return _0x2547d0[_0x6a3a('0x26')]['create']({'phone':_0x339603[_0x6a3a('0xe')],'ContactId':_0x339603['id'],'ListId':_0x339603[_0x6a3a('0x2a')],'priority':_0x339603[_0x6a3a('0x2b')]?_0x339603[_0x6a3a('0x2b')]:0x2,'scheduledat':_0x339603['scheduledat']?_0x339603[_0x6a3a('0x1a')]:moment()[_0x6a3a('0x1b')](_0x6a3a('0x24')),'callback':_0x339603[_0x6a3a('0x2c')]?!![]:![],'callbackuniqueid':_0x339603[_0x6a3a('0x2c')]?_0x339603['callbackUniqueid']:undefined,'callbackat':_0x339603['callbackUniqueid']?moment()[_0x6a3a('0x1b')](_0x6a3a('0x24')):undefined,'VoiceQueueId':_0x3923a4['id']});})['catch'](function(_0x2d5e42){_0x60dcc6(_0x2d5e42);});});});};function _0x48ed39(){return function(_0x45c41d){logger[_0x6a3a('0x17')]('cmContact','afterCreate',util[_0x6a3a('0x32')](_0x45c41d,{'showHidden':![],'depth':null}));};}function _0x17b614(_0x343639,_0x35b6d9){var _0x2bca09=_0x35b6d9[_0x6a3a('0x1a')]?_0x35b6d9['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x482387,_0x2bb0ff){if(_[_0x6a3a('0x1c')](_0x35b6d9['dialTimezone'])){_0x482387({'ret':_0x2bca09});}else{_0x2547d0['Campaign'][_0x6a3a('0x1e')]({'where':{'id':_0x343639['id']}})[_0x6a3a('0x1f')](function(_0x5a8a36){if(!_[_0x6a3a('0x1c')](_0x5a8a36)){var _0xc3ad00=_0x5a8a36[_0x6a3a('0x1d')];if(!_['isNil'](_0xc3ad00)){var _0x297adb=shared[_0x6a3a('0x20')];var _0xf8d632=_0x297adb[_0xc3ad00];var _0x42729f=_0x297adb[_0x35b6d9['dialTimezone']];if(!_['isNil'](_0xf8d632)&&!_[_0x6a3a('0x1c')](_0x42729f)){var _0x797676=_0xf8d632[_0x6a3a('0x21')]-_0x42729f[_0x6a3a('0x21')];_0x2bca09=_0x35b6d9['scheduledat']?_0x35b6d9[_0x6a3a('0x1a')]:moment();var _0x54799d=moment(_0x2bca09)['add'](_0x797676,_0x6a3a('0x23'));_0x482387({'ret':_0x54799d[_0x6a3a('0x1b')](_0x6a3a('0x24'))});}else _0x482387({'ret':_0x2bca09});}else _0x482387({'ret':_0x2bca09});}else{_0x482387({'ret':_0x2bca09});}});}});return 0xa;}var _0x4de8d1=function(_0x210bb2){return new BPromise(function(_0x115cc2,_0x5ecdf2){_0x17b614(_0x210bb2,_0x339603)[_0x6a3a('0x1f')](function(_0x266d57){_0x339603[_0x6a3a('0x1a')]=_0x266d57[_0x6a3a('0x25')];_0x2547d0[_0x6a3a('0x26')]['findOne']({'where':{'phone':_0x339603[_0x6a3a('0xe')],'CampaignId':_0x210bb2['id']}})[_0x6a3a('0x1f')](function(_0x1d5cb6){if(!_[_0x6a3a('0x1c')](_0x1d5cb6)){throw new Error(_0x6a3a('0x27')+_0x339603[_0x6a3a('0xe')]+_0x6a3a('0x33')+_0x210bb2['id']);}return _0x2547d0[_0x6a3a('0x26')][_0x6a3a('0x29')]({'phone':_0x339603[_0x6a3a('0xe')],'ContactId':_0x339603['id'],'ListId':_0x339603[_0x6a3a('0x2a')],'priority':_0x339603['priority']?_0x339603[_0x6a3a('0x2b')]:0x2,'scheduledat':_0x339603[_0x6a3a('0x1a')]?_0x339603[_0x6a3a('0x1a')]:moment()[_0x6a3a('0x1b')](_0x6a3a('0x24')),'callback':_0x339603[_0x6a3a('0x2c')]?!![]:![],'callbackuniqueid':_0x339603[_0x6a3a('0x2c')]?_0x339603[_0x6a3a('0x2c')]:undefined,'callbackat':_0x339603['callbackUniqueid']?moment()[_0x6a3a('0x1b')](_0x6a3a('0x24')):undefined,'CampaignId':_0x210bb2['id']});})[_0x6a3a('0x2d')](function(_0x2b200d){_0x5ecdf2(_0x2b200d);});});});};var _0x4e337d=function(_0x5b520e){return new BPromise(function(_0x4ca518,_0x70d000){_0x17b614(_0x5b520e,_0x339603)['then'](function(_0x455214){_0x339603['scheduledat']=_0x455214[_0x6a3a('0x25')];_0x2547d0[_0x6a3a('0x26')][_0x6a3a('0x1e')]({'where':{'phone':_0x339603[_0x6a3a('0xe')],'CampaignId':_0x5b520e['id']}})[_0x6a3a('0x1f')](function(_0x39be50){if(!_['isNil'](_0x39be50)){throw new Error(_0x6a3a('0x27')+_0x339603[_0x6a3a('0xe')]+_0x6a3a('0x34')+_0x5b520e['id']);}return _0x2547d0['CmHopperFinal'][_0x6a3a('0x1e')]({'where':{'calleridnum':_0x339603[_0x6a3a('0xe')],'CampaignId':_0x5b520e['id']}});})[_0x6a3a('0x1f')](function(_0x142659){if(!_[_0x6a3a('0x1c')](_0x142659)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x339603[_0x6a3a('0xe')]+_0x6a3a('0x35')+_0x5b520e['id']);}return _0x2547d0[_0x6a3a('0x26')][_0x6a3a('0x29')]({'phone':_0x339603['phone'],'ContactId':_0x339603['id'],'ListId':_0x339603[_0x6a3a('0x2a')],'priority':_0x339603[_0x6a3a('0x2b')]?_0x339603[_0x6a3a('0x2b')]:0x2,'scheduledat':_0x339603['scheduledat']?_0x339603[_0x6a3a('0x1a')]:moment()[_0x6a3a('0x1b')](_0x6a3a('0x24')),'callback':_0x339603['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x339603['callbackUniqueid']?_0x339603[_0x6a3a('0x2c')]:undefined,'callbackat':_0x339603[_0x6a3a('0x2c')]?moment()[_0x6a3a('0x1b')](_0x6a3a('0x24')):undefined,'CampaignId':_0x5b520e['id']});})[_0x6a3a('0x2d')](function(_0xc9729a){_0x70d000(_0xc9729a);});});});};if(_0x339603['ListId']){_0x2547d0[_0x6a3a('0x36')][_0x6a3a('0x37')]({'where':{'type':_0x6a3a('0x38')},'attributes':['id',_0x6a3a('0x39'),'dialTimezone'],'include':[{'model':_0x2547d0['CmList'],'as':'Lists','where':{'id':_0x339603['ListId']}}]})[_0x6a3a('0x1f')](function(_0x1ae648){if(_0x1ae648){var _0x32efda=[];for(var _0x4a79b4=0x0,_0x19a4d3;_0x4a79b4<_0x1ae648[_0x6a3a('0x3a')];_0x4a79b4+=0x1){_0x19a4d3=_0x1ae648[_0x4a79b4]['get']({'plain':!![]});switch(_0x19a4d3[_0x6a3a('0x39')]){case _0x6a3a('0x3b'):_0x5db065(_0x19a4d3)[_0x6a3a('0x2d')](_0x1d3ea5());break;case _0x6a3a('0x3c'):_0x9b3673(_0x19a4d3)['catch'](_0x1d3ea5());break;default:_0x17b614(_0x19a4d3,_0x339603)[_0x6a3a('0x1f')](function(_0x5b8caa){_0x339603[_0x6a3a('0x1a')]=_0x5b8caa[_0x6a3a('0x25')];_0x2547d0[_0x6a3a('0x26')][_0x6a3a('0x29')]({'phone':_0x339603[_0x6a3a('0xe')],'ContactId':_0x339603['id'],'ListId':_0x339603[_0x6a3a('0x2a')],'scheduledat':_0x339603['scheduledat']?_0x339603[_0x6a3a('0x1a')]:moment()[_0x6a3a('0x1b')](_0x6a3a('0x24')),'priority':_0x339603['priority']?_0x339603[_0x6a3a('0x2b')]:0x2,'callback':_0x339603[_0x6a3a('0x2c')]?!![]:![],'callbackuniqueid':_0x339603[_0x6a3a('0x2c')]?_0x339603[_0x6a3a('0x2c')]:undefined,'callbackat':_0x339603['callbackUniqueid']?moment()[_0x6a3a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x19a4d3['id']})[_0x6a3a('0x2d')](_0x1d3ea5());});}}}})['then'](function(){return _0x2547d0[_0x6a3a('0x36')][_0x6a3a('0x37')]({'where':{'type':_0x6a3a('0x38')},'attributes':['id'],'include':[{'model':_0x2547d0[_0x6a3a('0x3d')],'as':_0x6a3a('0x3e'),'where':{'id':_0x339603[_0x6a3a('0x2a')]}}]})[_0x6a3a('0x1f')](function(_0x538363){if(_0x538363){var _0x55867d=[];for(var _0x45aa8a=0x0,_0x295cf6;_0x45aa8a<_0x538363[_0x6a3a('0x3a')];_0x45aa8a+=0x1){_0x295cf6=_0x538363[_0x45aa8a][_0x6a3a('0x3f')]({'plain':!![]});_0x2547d0[_0x6a3a('0x40')][_0x6a3a('0x29')]({'phone':_0x339603[_0x6a3a('0xe')],'ContactId':_0x339603['id'],'ListId':_0x339603[_0x6a3a('0x2a')],'VoiceQueueId':_0x295cf6['id']})[_0x6a3a('0x2d')](function(_0x1d613f){logger['error']('cmContact,\x20%s,\x20%s',_0x6a3a('0x19'),_0x1d613f[_0x6a3a('0x41')]);});}}});})['then'](function(){return _0x2547d0['Campaign'][_0x6a3a('0x37')]({'attributes':['id',_0x6a3a('0x39'),_0x6a3a('0x1d')],'include':[{'model':_0x2547d0[_0x6a3a('0x3d')],'as':_0x6a3a('0x42'),'where':{'id':_0x339603[_0x6a3a('0x2a')]}}]})[_0x6a3a('0x1f')](function(_0x1649d2){if(_0x1649d2){var _0x2bbcbe=[];for(var _0x3171ee=0x0,_0x78f19c;_0x3171ee<_0x1649d2[_0x6a3a('0x3a')];_0x3171ee+=0x1){_0x78f19c=_0x1649d2[_0x3171ee][_0x6a3a('0x3f')]({'plain':!![]});switch(_0x78f19c[_0x6a3a('0x39')]){case _0x6a3a('0x3b'):_0x4e337d(_0x78f19c)[_0x6a3a('0x2d')](_0x48ed39());break;case _0x6a3a('0x3c'):_0x4de8d1(_0x78f19c)[_0x6a3a('0x2d')](_0x48ed39());break;default:_0x2547d0[_0x6a3a('0x26')][_0x6a3a('0x29')]({'phone':_0x339603[_0x6a3a('0xe')],'ContactId':_0x339603['id'],'ListId':_0x339603['ListId'],'scheduledat':_0x339603[_0x6a3a('0x1a')]?_0x339603[_0x6a3a('0x1a')]:moment()[_0x6a3a('0x1b')](_0x6a3a('0x24')),'priority':_0x339603[_0x6a3a('0x2b')]?_0x339603[_0x6a3a('0x2b')]:0x2,'callback':_0x339603[_0x6a3a('0x2c')]?!![]:![],'callbackuniqueid':_0x339603['callbackUniqueid']?_0x339603[_0x6a3a('0x2c')]:undefined,'callbackat':_0x339603[_0x6a3a('0x2c')]?moment()['format'](_0x6a3a('0x24')):undefined,'CampaignId':_0x78f19c['id']})[_0x6a3a('0x2d')](_0x48ed39());}}}});})[_0x6a3a('0x1f')](function(){return _0x2547d0[_0x6a3a('0x43')][_0x6a3a('0x37')]({'attributes':['id'],'include':[{'model':_0x2547d0[_0x6a3a('0x3d')],'as':_0x6a3a('0x3e'),'where':{'id':_0x339603[_0x6a3a('0x2a')]}}]})[_0x6a3a('0x1f')](function(_0x14437d){if(_0x14437d){var _0x2e1e52=[];for(var _0x4234c4=0x0,_0x3e6c9d;_0x4234c4<_0x14437d['length'];_0x4234c4+=0x1){_0x3e6c9d=_0x14437d[_0x4234c4][_0x6a3a('0x3f')]({'plain':!![]});_0x2547d0[_0x6a3a('0x40')][_0x6a3a('0x29')]({'phone':_0x339603[_0x6a3a('0xe')],'ContactId':_0x339603['id'],'ListId':_0x339603[_0x6a3a('0x2a')],'CampaignId':_0x3e6c9d['id']})[_0x6a3a('0x2d')](function(_0x3c81e7){logger[_0x6a3a('0x17')](_0x6a3a('0x44'),_0x6a3a('0x19'),_0x3c81e7['message']);});}}});})[_0x6a3a('0x1f')](function(){_0x109aa7();})[_0x6a3a('0x2d')](function(_0xbd06a1){logger[_0x6a3a('0x17')](_0x6a3a('0x44'),_0x6a3a('0x19'),_0xbd06a1['message']);_0x109aa7(_0xbd06a1);});}else{_0x109aa7(new Error(_0x6a3a('0x45')));}},'afterDestroy':function(_0x3a1f4a,_0x5d3500,_0x3b1bd2){var _0x9cc17e=_0x26c7c6[_0x6a3a('0x46')];var _0x21594d=_0x3a1f4a[_0x6a3a('0x3f')]({'plain':!![]});return _0x9cc17e[_0x6a3a('0x26')][_0x6a3a('0x37')]({'raw':!![],'where':{'ListId':_0x21594d[_0x6a3a('0x2a')],'ContactId':_0x21594d['id']}})[_0x6a3a('0x1f')](function(_0x51a4ed){if(!_['isEmpty'](_0x51a4ed)){var _0x1cad73=[];for(var _0x1c3a61=0x0;_0x1c3a61<_0x51a4ed[_0x6a3a('0x3a')];_0x1c3a61+=0x1){var _0x45bb81=_0x9cc17e[_0x6a3a('0x26')][_0x6a3a('0x47')]({'where':{'ListId':_0x51a4ed[_0x1c3a61][_0x6a3a('0x2a')],'ContactId':_0x51a4ed[_0x1c3a61][_0x6a3a('0x48')],'VoiceQueueId':_0x51a4ed[_0x1c3a61][_0x6a3a('0x49')],'CampaignId':_0x51a4ed[_0x1c3a61][_0x6a3a('0x4a')]}});_0x1cad73[_0x6a3a('0x4b')](_0x45bb81);}return BPromise[_0x6a3a('0x4c')](_0x1cad73);}})[_0x6a3a('0x1f')](function(_0x19ed2b){logger[_0x6a3a('0x4d')](_0x6a3a('0x4e'),util[_0x6a3a('0x32')](_0x19ed2b,{'showHidden':![],'depth':null}));_0x3b1bd2();})[_0x6a3a('0x2d')](function(_0x1eb0ac){logger['error'](_0x6a3a('0x4f'),util[_0x6a3a('0x32')](_0x1eb0ac,{'showHidden':![],'depth':null}));_0x3b1bd2(_0x1eb0ac);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index c7522e9..700df60 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x389e6c,_0x2370c5){var _0x1169a4=function(_0x33c168){while(--_0x33c168){_0x389e6c['push'](_0x389e6c['shift']());}};_0x1169a4(++_0x2370c5);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x2216de,_0x220d22){var _0x8df3f1=function(_0x104c99){while(--_0x104c99){_0x2216de['push'](_0x2216de['shift']());}};_0x8df3f1(++_0x220d22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index c84a108..9e8556c 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb18e=['PHONE','INTEGER'];(function(_0xa196f5,_0x1cbaa9){var _0x1db077=function(_0x4b9c43){while(--_0x4b9c43){_0xa196f5['push'](_0xa196f5['shift']());}};_0x1db077(++_0x1cbaa9);}(_0xb18e,0x181));var _0xeb18=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0xb18e[_0x446208];return _0xe49563;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0xeb18('0x0')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xeb18('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xeb18('0x1')},'OrderBy':{'type':Sequelize[_0xeb18('0x0')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x8f7d=['PHONE','sequelize','exports','STRING'];(function(_0x49c317,_0x2d866d){var _0x1cb158=function(_0x28fbb4){while(--_0x28fbb4){_0x49c317['push'](_0x49c317['shift']());}};_0x1cb158(++_0x2d866d);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x8282fe,_0x27cc62){_0x8282fe=_0x8282fe-0x0;var _0x48ab18=_0x8f7d[_0x8282fe];return _0x48ab18;};'use strict';var Sequelize=require(_0xd8f7('0x0'));module[_0xd8f7('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xd8f7('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xd8f7('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xd8f7('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 6c906c4..d12efb3 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeaf=['rawAttributes','fieldName','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index','CmContactHasItem'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0xdeaf,0x110));var _0xfdea=function(_0x5158c3,_0x38e2a4){_0x5158c3=_0x5158c3-0x0;var _0x56cb6e=_0xdeaf[_0x5158c3];return _0x56cb6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdea('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdea('0x1'));var rp=require(_0xfdea('0x2'));var moment=require(_0xfdea('0x3'));var BPromise=require(_0xfdea('0x4'));var Mustache=require(_0xfdea('0x5'));var util=require(_0xfdea('0x6'));var path=require(_0xfdea('0x7'));var sox=require(_0xfdea('0x8'));var csv=require('to-csv');var ejs=require(_0xfdea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfdea('0xa'));var crypto=require(_0xfdea('0xb'));var jsforce=require(_0xfdea('0xc'));var deskjs=require(_0xfdea('0xd'));var toCsv=require(_0xfdea('0xe'));var querystring=require('querystring');var Papa=require(_0xfdea('0xf'));var Redis=require('ioredis');var authService=require(_0xfdea('0x10'));var qs=require(_0xfdea('0x11'));var as=require(_0xfdea('0x12'));var hardwareService=require(_0xfdea('0x13'));var logger=require(_0xfdea('0x14'))(_0xfdea('0x15'));var utils=require(_0xfdea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfdea('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x231822,_0x1c262d){_0x1c262d=_0x1c262d||0xcc;return function(_0x4cd391){if(_0x4cd391){return _0x231822['sendStatus'](_0x1c262d);}return _0x231822[_0xfdea('0x18')](_0x1c262d)[_0xfdea('0x19')]();};}function respondWithResult(_0xb5630a,_0xe8c244){_0xe8c244=_0xe8c244||0xc8;return function(_0x3d6cef){if(_0x3d6cef){return _0xb5630a[_0xfdea('0x18')](_0xe8c244)['json'](_0x3d6cef);}};}function respondWithFilteredResult(_0x2fd469,_0x352563){return function(_0x13513e){if(_0x13513e){var _0xe11d30=typeof _0x352563[_0xfdea('0x1a')]===_0xfdea('0x1b')&&typeof _0x352563[_0xfdea('0x1c')]==='undefined';var _0x19d364=_0x13513e['count'];var _0xe2ac47=_0xe11d30?0x0:_0x352563[_0xfdea('0x1a')];var _0x265863=_0xe11d30?_0x13513e[_0xfdea('0x1d')]:_0x352563[_0xfdea('0x1a')]+_0x352563[_0xfdea('0x1c')];var _0x3bfcd6;if(_0x265863>=_0x19d364){_0x265863=_0x19d364;_0x3bfcd6=0xc8;}else{_0x3bfcd6=0xce;}_0x2fd469[_0xfdea('0x18')](_0x3bfcd6);return _0x2fd469[_0xfdea('0x1e')](_0xfdea('0x1f'),_0xe2ac47+'-'+_0x265863+'/'+_0x19d364)[_0xfdea('0x20')](_0x13513e);}return null;};}function patchUpdates(_0x3244e1){return function(_0x212caa){try{jsonpatch[_0xfdea('0x21')](_0x212caa,_0x3244e1,!![]);}catch(_0x59a22b){return BPromise[_0xfdea('0x22')](_0x59a22b);}return _0x212caa['save']();};}function saveUpdates(_0x1861fd,_0x1593ab){return function(_0x693e1b){if(_0x693e1b){return _0x693e1b[_0xfdea('0x23')](_0x1861fd)[_0xfdea('0x24')](function(_0x394c59){return _0x394c59;});}return null;};}function removeEntity(_0x3cb3c6,_0x201532){return function(_0x64547f){if(_0x64547f){return _0x64547f[_0xfdea('0x25')]()['then'](function(){var _0x17e26a=_0x64547f[_0xfdea('0x26')]({'plain':!![]});var _0x5e98d6=_0xfdea('0x27');return db[_0xfdea('0x28')][_0xfdea('0x25')]({'where':{'type':_0x5e98d6,'resourceId':_0x17e26a['id']}})[_0xfdea('0x24')](function(){return _0x64547f;});})[_0xfdea('0x24')](function(){_0x3cb3c6['status'](0xcc)[_0xfdea('0x19')]();});}};}function handleEntityNotFound(_0x585324,_0x54bfcd){return function(_0x2c1174){if(!_0x2c1174){_0x585324[_0xfdea('0x29')](0x194);}return _0x2c1174;};}function handleError(_0xcb3241,_0x2a3d82){_0x2a3d82=_0x2a3d82||0x1f4;return function(_0x39343f){logger[_0xfdea('0x2a')](_0x39343f[_0xfdea('0x2b')]);if(_0x39343f['name']){delete _0x39343f[_0xfdea('0x2c')];}_0xcb3241[_0xfdea('0x18')](_0x2a3d82)[_0xfdea('0x2d')](_0x39343f);};}exports[_0xfdea('0x2e')]=function(_0x3a4678,_0x5cd1cb){var _0x4ca38f={},_0x4823e2={},_0x27f5e1={'count':0x0,'rows':[]};var _0x2c77c8=_['map'](db[_0xfdea('0x2f')][_0xfdea('0x30')],function(_0x3a07fc){return{'name':_0x3a07fc[_0xfdea('0x31')],'type':_0x3a07fc['type']['key']};});_0x4823e2['model']=_['map'](_0x2c77c8,_0xfdea('0x2c'));_0x4823e2[_0xfdea('0x32')]=_[_0xfdea('0x33')](_0x3a4678[_0xfdea('0x32')]);_0x4823e2[_0xfdea('0x34')]=_[_0xfdea('0x35')](_0x4823e2['model'],_0x4823e2[_0xfdea('0x32')]);_0x4ca38f[_0xfdea('0x36')]=_[_0xfdea('0x35')](_0x4823e2['model'],qs[_0xfdea('0x37')](_0x3a4678['query']['fields']));_0x4ca38f[_0xfdea('0x36')]=_0x4ca38f[_0xfdea('0x36')][_0xfdea('0x38')]?_0x4ca38f[_0xfdea('0x36')]:_0x4823e2[_0xfdea('0x39')];if(!_0x3a4678[_0xfdea('0x32')][_0xfdea('0x3a')](_0xfdea('0x3b'))){_0x4ca38f[_0xfdea('0x1c')]=qs[_0xfdea('0x1c')](_0x3a4678[_0xfdea('0x32')][_0xfdea('0x1c')]);_0x4ca38f[_0xfdea('0x1a')]=qs[_0xfdea('0x1a')](_0x3a4678[_0xfdea('0x32')][_0xfdea('0x1a')]);}_0x4ca38f['order']=qs[_0xfdea('0x3c')](_0x3a4678[_0xfdea('0x32')][_0xfdea('0x3c')]);_0x4ca38f['where']=qs[_0xfdea('0x34')](_[_0xfdea('0x3d')](_0x3a4678[_0xfdea('0x32')],_0x4823e2[_0xfdea('0x34')]),_0x2c77c8);if(_0x3a4678[_0xfdea('0x32')][_0xfdea('0x3e')]){_0x4ca38f[_0xfdea('0x3f')]=_['merge'](_0x4ca38f[_0xfdea('0x3f')],{'$or':_['map'](_0x2c77c8,function(_0x3d7dd9){if(_0x3d7dd9['type']!=='VIRTUAL'){var _0x45ba0d={};_0x45ba0d[_0x3d7dd9[_0xfdea('0x2c')]]={'$like':'%'+_0x3a4678[_0xfdea('0x32')][_0xfdea('0x3e')]+'%'};return _0x45ba0d;}})});}_0x4ca38f=_[_0xfdea('0x40')]({},_0x4ca38f,_0x3a4678[_0xfdea('0x41')]);var _0x1d4f8f={'where':_0x4ca38f[_0xfdea('0x3f')]};return db[_0xfdea('0x2f')]['count'](_0x1d4f8f)['then'](function(_0x5843b4){_0x27f5e1[_0xfdea('0x1d')]=_0x5843b4;if(_0x3a4678[_0xfdea('0x32')][_0xfdea('0x42')]){_0x4ca38f[_0xfdea('0x43')]=[{'all':!![]}];}return db[_0xfdea('0x2f')][_0xfdea('0x44')](_0x4ca38f);})['then'](function(_0x4460d8){_0x27f5e1[_0xfdea('0x45')]=_0x4460d8;return _0x27f5e1;})[_0xfdea('0x24')](respondWithFilteredResult(_0x5cd1cb,_0x4ca38f))['catch'](handleError(_0x5cd1cb,null));};exports[_0xfdea('0x46')]=function(_0x3b047e,_0x322e8d){var _0x1601cd={'raw':!![],'where':{'id':_0x3b047e['params']['id']}},_0x3074f0={};_0x3074f0[_0xfdea('0x39')]=_['keys'](db[_0xfdea('0x2f')]['rawAttributes']);_0x3074f0[_0xfdea('0x32')]=_[_0xfdea('0x33')](_0x3b047e[_0xfdea('0x32')]);_0x3074f0[_0xfdea('0x34')]=_[_0xfdea('0x35')](_0x3074f0[_0xfdea('0x39')],_0x3074f0[_0xfdea('0x32')]);_0x1601cd[_0xfdea('0x36')]=_[_0xfdea('0x35')](_0x3074f0['model'],qs[_0xfdea('0x37')](_0x3b047e['query']['fields']));_0x1601cd[_0xfdea('0x36')]=_0x1601cd['attributes'][_0xfdea('0x38')]?_0x1601cd[_0xfdea('0x36')]:_0x3074f0[_0xfdea('0x39')];if(_0x3b047e[_0xfdea('0x32')]['includeAll']){_0x1601cd[_0xfdea('0x43')]=[{'all':!![]}];}_0x1601cd=_[_0xfdea('0x40')]({},_0x1601cd,_0x3b047e[_0xfdea('0x41')]);return db[_0xfdea('0x2f')][_0xfdea('0x47')](_0x1601cd)[_0xfdea('0x24')](handleEntityNotFound(_0x322e8d,null))[_0xfdea('0x24')](respondWithResult(_0x322e8d,null))[_0xfdea('0x48')](handleError(_0x322e8d,null));};exports[_0xfdea('0x49')]=function(_0x475a4c,_0x5c4e38){return db['CmContactHasItem'][_0xfdea('0x49')](_0x475a4c['body'],{})['then'](function(_0x4c162b){var _0x15c9ad=_0x475a4c[_0xfdea('0x4a')][_0xfdea('0x26')]({'plain':!![]});if(!_0x15c9ad)throw new Error(_0xfdea('0x4b'));if(_0x15c9ad['role']===_0xfdea('0x4a')){var _0x1816c6=_0x4c162b['get']({'plain':!![]});var _0x12f99d=_0xfdea('0x27');return db[_0xfdea('0x4c')][_0xfdea('0x47')]({'where':{'name':_0x12f99d,'userProfileId':_0x15c9ad[_0xfdea('0x4d')]},'raw':!![]})['then'](function(_0x1f7734){if(_0x1f7734&&_0x1f7734['autoAssociation']===0x0){return db[_0xfdea('0x28')][_0xfdea('0x49')]({'name':_0x1816c6['name'],'resourceId':_0x1816c6['id'],'type':_0x1f7734[_0xfdea('0x2c')],'sectionId':_0x1f7734['id']},{})[_0xfdea('0x24')](function(){return _0x4c162b;});}else{return _0x4c162b;}})[_0xfdea('0x48')](function(_0x17a817){logger[_0xfdea('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17a817);throw _0x17a817;});}return _0x4c162b;})[_0xfdea('0x24')](respondWithResult(_0x5c4e38,0xc9))[_0xfdea('0x48')](handleError(_0x5c4e38,null));};exports[_0xfdea('0x23')]=function(_0xb16840,_0x75ed04){if(_0xb16840['body']['id']){delete _0xb16840[_0xfdea('0x4e')]['id'];}return db['CmContactHasItem'][_0xfdea('0x47')]({'where':{'id':_0xb16840[_0xfdea('0x4f')]['id']}})[_0xfdea('0x24')](handleEntityNotFound(_0x75ed04,null))['then'](saveUpdates(_0xb16840[_0xfdea('0x4e')],null))[_0xfdea('0x24')](respondWithResult(_0x75ed04,null))[_0xfdea('0x48')](handleError(_0x75ed04,null));};exports[_0xfdea('0x25')]=function(_0x491b02,_0xf4bc6){return db[_0xfdea('0x2f')]['find']({'where':{'id':_0x491b02[_0xfdea('0x4f')]['id']}})[_0xfdea('0x24')](handleEntityNotFound(_0xf4bc6,null))[_0xfdea('0x24')](removeEntity(_0xf4bc6,null))[_0xfdea('0x48')](handleError(_0xf4bc6,null));}; \ No newline at end of file +var _0x69d0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','map','CmContactHasItem','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x395776,_0x44fc08){var _0x5ba3db=function(_0x1f73da){while(--_0x1f73da){_0x395776['push'](_0x395776['shift']());}};_0x5ba3db(++_0x44fc08);}(_0x69d0,0x127));var _0x069d=function(_0x14459e,_0x6ade13){_0x14459e=_0x14459e-0x0;var _0xbdf0da=_0x69d0[_0x14459e];return _0xbdf0da;};'use strict';var emlformat=require(_0x069d('0x0'));var rimraf=require(_0x069d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x069d('0x2'));var rp=require(_0x069d('0x3'));var moment=require('moment');var BPromise=require(_0x069d('0x4'));var Mustache=require(_0x069d('0x5'));var util=require('util');var path=require(_0x069d('0x6'));var sox=require(_0x069d('0x7'));var csv=require(_0x069d('0x8'));var ejs=require(_0x069d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x069d('0xa'));var squel=require(_0x069d('0xb'));var crypto=require(_0x069d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x069d('0xd'));var toCsv=require(_0x069d('0x8'));var querystring=require(_0x069d('0xe'));var Papa=require(_0x069d('0xf'));var Redis=require(_0x069d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x069d('0x11'));var hardwareService=require(_0x069d('0x12'));var logger=require(_0x069d('0x13'))(_0x069d('0x14'));var utils=require(_0x069d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x069d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x117c52,_0x591bc3){_0x591bc3=_0x591bc3||0xcc;return function(_0x3b98c6){if(_0x3b98c6){return _0x117c52['sendStatus'](_0x591bc3);}return _0x117c52[_0x069d('0x17')](_0x591bc3)[_0x069d('0x18')]();};}function respondWithResult(_0x4e0caf,_0x24b1f7){_0x24b1f7=_0x24b1f7||0xc8;return function(_0xa8a81c){if(_0xa8a81c){return _0x4e0caf[_0x069d('0x17')](_0x24b1f7)[_0x069d('0x19')](_0xa8a81c);}};}function respondWithFilteredResult(_0x195902,_0x50a0ca){return function(_0x10ffc1){if(_0x10ffc1){var _0x4c30cb=typeof _0x50a0ca[_0x069d('0x1a')]==='undefined'&&typeof _0x50a0ca[_0x069d('0x1b')]==='undefined';var _0x544d6f=_0x10ffc1[_0x069d('0x1c')];var _0x3ee43b=_0x4c30cb?0x0:_0x50a0ca[_0x069d('0x1a')];var _0x571dcd=_0x4c30cb?_0x10ffc1[_0x069d('0x1c')]:_0x50a0ca[_0x069d('0x1a')]+_0x50a0ca['limit'];var _0x9398f2;if(_0x571dcd>=_0x544d6f){_0x571dcd=_0x544d6f;_0x9398f2=0xc8;}else{_0x9398f2=0xce;}_0x195902['status'](_0x9398f2);return _0x195902[_0x069d('0x1d')](_0x069d('0x1e'),_0x3ee43b+'-'+_0x571dcd+'/'+_0x544d6f)[_0x069d('0x19')](_0x10ffc1);}return null;};}function patchUpdates(_0x2c04b1){return function(_0x346eac){try{jsonpatch[_0x069d('0x1f')](_0x346eac,_0x2c04b1,!![]);}catch(_0x5aca17){return BPromise[_0x069d('0x20')](_0x5aca17);}return _0x346eac[_0x069d('0x21')]();};}function saveUpdates(_0x5472a6,_0x54d4ce){return function(_0x5baa55){if(_0x5baa55){return _0x5baa55['update'](_0x5472a6)[_0x069d('0x22')](function(_0x155cea){return _0x155cea;});}return null;};}function removeEntity(_0x5924ba,_0x3594c8){return function(_0x4f9bb7){if(_0x4f9bb7){return _0x4f9bb7[_0x069d('0x23')]()['then'](function(){var _0x3fb0dc=_0x4f9bb7[_0x069d('0x24')]({'plain':!![]});var _0x9dde13=_0x069d('0x25');return db[_0x069d('0x26')][_0x069d('0x23')]({'where':{'type':_0x9dde13,'resourceId':_0x3fb0dc['id']}})[_0x069d('0x22')](function(){return _0x4f9bb7;});})['then'](function(){_0x5924ba[_0x069d('0x17')](0xcc)[_0x069d('0x18')]();});}};}function handleEntityNotFound(_0x48958f,_0x52bc99){return function(_0x154f7e){if(!_0x154f7e){_0x48958f['sendStatus'](0x194);}return _0x154f7e;};}function handleError(_0x445e21,_0x179f7e){_0x179f7e=_0x179f7e||0x1f4;return function(_0x2b8026){logger[_0x069d('0x27')](_0x2b8026[_0x069d('0x28')]);if(_0x2b8026[_0x069d('0x29')]){delete _0x2b8026[_0x069d('0x29')];}_0x445e21[_0x069d('0x17')](_0x179f7e)['send'](_0x2b8026);};}exports['index']=function(_0x2f7f13,_0x48cd19){var _0x266af1={},_0xc36ec4={},_0x13809c={'count':0x0,'rows':[]};var _0x25cce6=_[_0x069d('0x2a')](db[_0x069d('0x2b')][_0x069d('0x2c')],function(_0x44e41c){return{'name':_0x44e41c['fieldName'],'type':_0x44e41c['type'][_0x069d('0x2d')]};});_0xc36ec4[_0x069d('0x2e')]=_[_0x069d('0x2a')](_0x25cce6,_0x069d('0x29'));_0xc36ec4[_0x069d('0x2f')]=_[_0x069d('0x30')](_0x2f7f13[_0x069d('0x2f')]);_0xc36ec4[_0x069d('0x31')]=_[_0x069d('0x32')](_0xc36ec4[_0x069d('0x2e')],_0xc36ec4[_0x069d('0x2f')]);_0x266af1[_0x069d('0x33')]=_['intersection'](_0xc36ec4[_0x069d('0x2e')],qs[_0x069d('0x34')](_0x2f7f13[_0x069d('0x2f')][_0x069d('0x34')]));_0x266af1['attributes']=_0x266af1[_0x069d('0x33')][_0x069d('0x35')]?_0x266af1['attributes']:_0xc36ec4['model'];if(!_0x2f7f13[_0x069d('0x2f')][_0x069d('0x36')]('nolimit')){_0x266af1[_0x069d('0x1b')]=qs['limit'](_0x2f7f13['query'][_0x069d('0x1b')]);_0x266af1[_0x069d('0x1a')]=qs[_0x069d('0x1a')](_0x2f7f13[_0x069d('0x2f')]['offset']);}_0x266af1[_0x069d('0x37')]=qs[_0x069d('0x38')](_0x2f7f13['query'][_0x069d('0x38')]);_0x266af1[_0x069d('0x39')]=qs['filters'](_['pick'](_0x2f7f13['query'],_0xc36ec4[_0x069d('0x31')]),_0x25cce6);if(_0x2f7f13[_0x069d('0x2f')][_0x069d('0x3a')]){_0x266af1[_0x069d('0x39')]=_[_0x069d('0x3b')](_0x266af1['where'],{'$or':_[_0x069d('0x2a')](_0x25cce6,function(_0x2f8c08){if(_0x2f8c08[_0x069d('0x3c')]!==_0x069d('0x3d')){var _0x16fb90={};_0x16fb90[_0x2f8c08['name']]={'$like':'%'+_0x2f7f13[_0x069d('0x2f')][_0x069d('0x3a')]+'%'};return _0x16fb90;}})});}_0x266af1=_[_0x069d('0x3b')]({},_0x266af1,_0x2f7f13[_0x069d('0x3e')]);var _0x58392d={'where':_0x266af1[_0x069d('0x39')]};return db[_0x069d('0x2b')][_0x069d('0x1c')](_0x58392d)['then'](function(_0x538ac2){_0x13809c['count']=_0x538ac2;if(_0x2f7f13[_0x069d('0x2f')]['includeAll']){_0x266af1[_0x069d('0x3f')]=[{'all':!![]}];}return db[_0x069d('0x2b')][_0x069d('0x40')](_0x266af1);})['then'](function(_0x3a292d){_0x13809c[_0x069d('0x41')]=_0x3a292d;return _0x13809c;})['then'](respondWithFilteredResult(_0x48cd19,_0x266af1))['catch'](handleError(_0x48cd19,null));};exports[_0x069d('0x42')]=function(_0x4e9b68,_0x588b21){var _0x45fc3f={'raw':!![],'where':{'id':_0x4e9b68[_0x069d('0x43')]['id']}},_0x58d10d={};_0x58d10d[_0x069d('0x2e')]=_['keys'](db[_0x069d('0x2b')][_0x069d('0x2c')]);_0x58d10d[_0x069d('0x2f')]=_[_0x069d('0x30')](_0x4e9b68[_0x069d('0x2f')]);_0x58d10d['filters']=_['intersection'](_0x58d10d[_0x069d('0x2e')],_0x58d10d[_0x069d('0x2f')]);_0x45fc3f['attributes']=_['intersection'](_0x58d10d[_0x069d('0x2e')],qs['fields'](_0x4e9b68[_0x069d('0x2f')][_0x069d('0x34')]));_0x45fc3f[_0x069d('0x33')]=_0x45fc3f[_0x069d('0x33')][_0x069d('0x35')]?_0x45fc3f[_0x069d('0x33')]:_0x58d10d[_0x069d('0x2e')];if(_0x4e9b68[_0x069d('0x2f')]['includeAll']){_0x45fc3f[_0x069d('0x3f')]=[{'all':!![]}];}_0x45fc3f=_[_0x069d('0x3b')]({},_0x45fc3f,_0x4e9b68[_0x069d('0x3e')]);return db['CmContactHasItem'][_0x069d('0x44')](_0x45fc3f)['then'](handleEntityNotFound(_0x588b21,null))[_0x069d('0x22')](respondWithResult(_0x588b21,null))[_0x069d('0x45')](handleError(_0x588b21,null));};exports[_0x069d('0x46')]=function(_0x4eff8d,_0x47bd92){return db[_0x069d('0x2b')]['create'](_0x4eff8d[_0x069d('0x47')],{})[_0x069d('0x22')](function(_0x47536f){var _0x411cf9=_0x4eff8d[_0x069d('0x48')][_0x069d('0x24')]({'plain':!![]});if(!_0x411cf9)throw new Error(_0x069d('0x49'));if(_0x411cf9[_0x069d('0x4a')]===_0x069d('0x48')){var _0x5a76a0=_0x47536f[_0x069d('0x24')]({'plain':!![]});var _0x1a654c=_0x069d('0x25');return db[_0x069d('0x4b')][_0x069d('0x44')]({'where':{'name':_0x1a654c,'userProfileId':_0x411cf9[_0x069d('0x4c')]},'raw':!![]})[_0x069d('0x22')](function(_0x1f71ea){if(_0x1f71ea&&_0x1f71ea['autoAssociation']===0x0){return db['UserProfileResource'][_0x069d('0x46')]({'name':_0x5a76a0[_0x069d('0x29')],'resourceId':_0x5a76a0['id'],'type':_0x1f71ea[_0x069d('0x29')],'sectionId':_0x1f71ea['id']},{})[_0x069d('0x22')](function(){return _0x47536f;});}else{return _0x47536f;}})[_0x069d('0x45')](function(_0x24bdfd){logger[_0x069d('0x27')](_0x069d('0x4d'),_0x24bdfd);throw _0x24bdfd;});}return _0x47536f;})['then'](respondWithResult(_0x47bd92,0xc9))[_0x069d('0x45')](handleError(_0x47bd92,null));};exports['update']=function(_0x56ed47,_0x1f4e5c){if(_0x56ed47[_0x069d('0x47')]['id']){delete _0x56ed47[_0x069d('0x47')]['id'];}return db[_0x069d('0x2b')][_0x069d('0x44')]({'where':{'id':_0x56ed47['params']['id']}})[_0x069d('0x22')](handleEntityNotFound(_0x1f4e5c,null))[_0x069d('0x22')](saveUpdates(_0x56ed47['body'],null))['then'](respondWithResult(_0x1f4e5c,null))[_0x069d('0x45')](handleError(_0x1f4e5c,null));};exports['destroy']=function(_0x27ca1d,_0x2b07ca){return db[_0x069d('0x2b')][_0x069d('0x44')]({'where':{'id':_0x27ca1d['params']['id']}})[_0x069d('0x22')](handleEntityNotFound(_0x2b07ca,null))[_0x069d('0x22')](removeEntity(_0x2b07ca,null))[_0x069d('0x45')](handleError(_0x2b07ca,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 31ed3b3..3dc0ba1 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecb1=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x714070,_0x434d9e){var _0x554083=function(_0x39ac52){while(--_0x39ac52){_0x714070['push'](_0x714070['shift']());}};_0x554083(++_0x434d9e);}(_0xecb1,0xc4));var _0x1ecb=function(_0x40f119,_0x2bac8c){_0x40f119=_0x40f119-0x0;var _0x39ad9e=_0xecb1[_0x40f119];return _0x39ad9e;};'use strict';var _=require(_0x1ecb('0x0'));var util=require(_0x1ecb('0x1'));var logger=require(_0x1ecb('0x2'))('api');var moment=require(_0x1ecb('0x3'));var BPromise=require(_0x1ecb('0x4'));var rp=require(_0x1ecb('0x5'));var fs=require('fs');var path=require(_0x1ecb('0x6'));var rimraf=require(_0x1ecb('0x7'));var config=require(_0x1ecb('0x8'));var attributes=require(_0x1ecb('0x9'));module[_0x1ecb('0xa')]=function(_0x22f198,_0xa607e2){return _0x22f198[_0x1ecb('0xb')](_0x1ecb('0xc'),attributes,{'tableName':_0x1ecb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4050=['cm_contact_has_items','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem'];(function(_0x521328,_0x208c88){var _0x45f832=function(_0x2d8ecb){while(--_0x2d8ecb){_0x521328['push'](_0x521328['shift']());}};_0x45f832(++_0x208c88);}(_0x4050,0x160));var _0x0405=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x4050[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x0405('0x0'));var util=require(_0x0405('0x1'));var logger=require(_0x0405('0x2'))(_0x0405('0x3'));var moment=require(_0x0405('0x4'));var BPromise=require('bluebird');var rp=require(_0x0405('0x5'));var fs=require('fs');var path=require(_0x0405('0x6'));var rimraf=require(_0x0405('0x7'));var config=require(_0x0405('0x8'));var attributes=require(_0x0405('0x9'));module[_0x0405('0xa')]=function(_0x54ea31,_0x576ff0){return _0x54ea31['define'](_0x0405('0xb'),attributes,{'tableName':_0x0405('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 4ac11ba..4cfc8e5 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e26=['lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch'];(function(_0x338bc2,_0x1be2e3){var _0x336630=function(_0x27ff61){while(--_0x27ff61){_0x338bc2['push'](_0x338bc2['shift']());}};_0x336630(++_0x1be2e3);}(_0x1e26,0xe7));var _0x61e2=function(_0x280ee0,_0x5e737f){_0x280ee0=_0x280ee0-0x0;var _0x3ad799=_0x1e26[_0x280ee0];return _0x3ad799;};'use strict';var _=require(_0x61e2('0x0'));var util=require(_0x61e2('0x1'));var moment=require(_0x61e2('0x2'));var BPromise=require(_0x61e2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x61e2('0x5'))(_0x61e2('0x6'));var config=require('../../config/environment');var jayson=require(_0x61e2('0x7'));var client=jayson[_0x61e2('0x8')][_0x61e2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20159e,_0x109822,_0x2cf699){return new BPromise(function(_0x5161d3,_0x3d423a){return client[_0x61e2('0xa')](_0x20159e,_0x2cf699)[_0x61e2('0xb')](function(_0x408646){logger[_0x61e2('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x109822,_0x61e2('0xd'));logger[_0x61e2('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x109822,'request\x20sent',JSON[_0x61e2('0xf')](_0x408646));if(_0x408646['error']){if(_0x408646[_0x61e2('0x10')][_0x61e2('0x11')]===0x1f4){logger[_0x61e2('0x10')](_0x61e2('0x12'),_0x109822,_0x408646['error'][_0x61e2('0x13')]);return _0x3d423a(_0x408646[_0x61e2('0x10')][_0x61e2('0x13')]);}logger[_0x61e2('0x10')](_0x61e2('0x12'),_0x109822,_0x408646['error'][_0x61e2('0x13')]);return _0x5161d3(_0x408646['error'][_0x61e2('0x13')]);}else{logger[_0x61e2('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x109822,'request\x20sent');_0x5161d3(_0x408646['result']['message']);}})[_0x61e2('0x14')](function(_0x16ab6e){logger['error'](_0x61e2('0x12'),_0x109822,_0x16ab6e);_0x3d423a(_0x16ab6e);});});} \ No newline at end of file +var _0xe1b9=['then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x18bb67,_0x5eff3d){var _0x149f9a=function(_0x1b890c){while(--_0x1b890c){_0x18bb67['push'](_0x18bb67['shift']());}};_0x149f9a(++_0x5eff3d);}(_0xe1b9,0xdc));var _0x9e1b=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe1b9[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x9e1b('0x0'));var util=require(_0x9e1b('0x1'));var moment=require(_0x9e1b('0x2'));var BPromise=require(_0x9e1b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e1b('0x4'));var db=require(_0x9e1b('0x5'))['db'];var utils=require(_0x9e1b('0x6'));var logger=require(_0x9e1b('0x7'))('rpc');var config=require(_0x9e1b('0x8'));var jayson=require(_0x9e1b('0x9'));var client=jayson['client'][_0x9e1b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xde0f71,_0x3e15ff,_0x5ac60f){return new BPromise(function(_0x53715e,_0x526699){return client['request'](_0xde0f71,_0x5ac60f)[_0x9e1b('0xb')](function(_0x38e7db){logger[_0x9e1b('0xc')](_0x9e1b('0xd'),_0x3e15ff,_0x9e1b('0xe'));logger[_0x9e1b('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x3e15ff,_0x9e1b('0xe'),JSON[_0x9e1b('0x10')](_0x38e7db));if(_0x38e7db[_0x9e1b('0x11')]){if(_0x38e7db[_0x9e1b('0x11')][_0x9e1b('0x12')]===0x1f4){logger[_0x9e1b('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x3e15ff,_0x38e7db[_0x9e1b('0x11')]['message']);return _0x526699(_0x38e7db[_0x9e1b('0x11')][_0x9e1b('0x13')]);}logger['error'](_0x9e1b('0xd'),_0x3e15ff,_0x38e7db[_0x9e1b('0x11')]['message']);return _0x53715e(_0x38e7db[_0x9e1b('0x11')]['message']);}else{logger[_0x9e1b('0xc')](_0x9e1b('0xd'),_0x3e15ff,_0x9e1b('0xe'));_0x53715e(_0x38e7db[_0x9e1b('0x14')][_0x9e1b('0x13')]);}})['catch'](function(_0x114b84){logger['error'](_0x9e1b('0xd'),_0x3e15ff,_0x114b84);_0x526699(_0x114b84);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index fc4f643..5d6f128 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd95d=['destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index','isAuthenticated','post','create','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd95d,0xf2));var _0xdd95=function(_0x57cf2e,_0x1fc8ca){_0x57cf2e=_0x57cf2e-0x0;var _0x4d1e0e=_0xd95d[_0x57cf2e];return _0x4d1e0e;};'use strict';var multer=require(_0xdd95('0x0'));var util=require(_0xdd95('0x1'));var path=require(_0xdd95('0x2'));var timeout=require(_0xdd95('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdd95('0x4'));var config=require(_0xdd95('0x5'));var controller=require(_0xdd95('0x6'));router[_0xdd95('0x7')]('/',auth['isAuthenticated'](),controller[_0xdd95('0x8')]);router['get']('/:id',auth[_0xdd95('0x9')](),controller['show']);router[_0xdd95('0xa')]('/',auth[_0xdd95('0x9')](),controller[_0xdd95('0xb')]);router['put']('/:id',auth[_0xdd95('0x9')](),controller[_0xdd95('0xc')]);router['delete']('/:id',auth[_0xdd95('0x9')](),controller[_0xdd95('0xd')]);module[_0xdd95('0xe')]=router; \ No newline at end of file +var _0xbc11=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xbc11,0x185));var _0x1bc1=function(_0xaddc52,_0x102147){_0xaddc52=_0xaddc52-0x0;var _0x17aea9=_0xbc11[_0xaddc52];return _0x17aea9;};'use strict';var multer=require(_0x1bc1('0x0'));var util=require(_0x1bc1('0x1'));var path=require(_0x1bc1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1bc1('0x3')]();var fs_extra=require(_0x1bc1('0x4'));var auth=require(_0x1bc1('0x5'));var interaction=require(_0x1bc1('0x6'));var config=require('../../config/environment');var controller=require(_0x1bc1('0x7'));router[_0x1bc1('0x8')]('/',auth[_0x1bc1('0x9')](),controller[_0x1bc1('0xa')]);router[_0x1bc1('0x8')](_0x1bc1('0xb'),auth[_0x1bc1('0x9')](),controller[_0x1bc1('0xc')]);router[_0x1bc1('0xd')]('/',auth['isAuthenticated'](),controller[_0x1bc1('0xe')]);router[_0x1bc1('0xf')](_0x1bc1('0xb'),auth[_0x1bc1('0x9')](),controller[_0x1bc1('0x10')]);router[_0x1bc1('0x11')](_0x1bc1('0xb'),auth[_0x1bc1('0x9')](),controller[_0x1bc1('0x12')]);module[_0x1bc1('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index bff45cd..20291fa 100644 --- a/server/api/cmCustomField/cmCustomField.attributes.js +++ b/server/api/cmCustomField/cmCustomField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f33=['TEXT','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f33,0x171));var _0x37f3=function(_0x40d2a5,_0x5b2281){_0x40d2a5=_0x40d2a5-0x0;var _0x4f1be1=_0x7f33[_0x40d2a5];return _0x4f1be1;};'use strict';var Sequelize=require(_0x37f3('0x0'));var _=require(_0x37f3('0x1'));module[_0x37f3('0x2')]={'name':{'type':Sequelize[_0x37f3('0x3')],'get':function(_0x4773b9){return this[_0x37f3('0x4')](_0x37f3('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x35cd99){this[_0x37f3('0x6')]('alias',_0x35cd99?_0x35cd99:this[_0x37f3('0x4')](_0x37f3('0x7')));}},'type':{'type':Sequelize[_0x37f3('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x37f3('0x9')]('long'),'get':function(){if(this[_0x37f3('0x4')]('type')===_0x37f3('0xa')){return JSON[_0x37f3('0xb')](this[_0x37f3('0x4')](_0x37f3('0xc')));}else{return this['getDataValue'](_0x37f3('0xc'));}},'set':function(_0x513e99){if(Array[_0x37f3('0xd')](_0x513e99)){this[_0x37f3('0x6')](_0x37f3('0xc'),JSON[_0x37f3('0xe')](_0x513e99));}else{this['setDataValue'](_0x37f3('0xc'),_0x513e99);}}},'required':{'type':Sequelize[_0x37f3('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x37f3('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x37f3('0x10')](_0x37f3('0x11'))}}; \ No newline at end of file +var _0xd363=['exports','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize'];(function(_0x2a6572,_0x15f9b4){var _0x12ceae=function(_0x13d510){while(--_0x13d510){_0x2a6572['push'](_0x2a6572['shift']());}};_0x12ceae(++_0x15f9b4);}(_0xd363,0x6b));var _0x3d36=function(_0x237bf7,_0xb851fc){_0x237bf7=_0x237bf7-0x0;var _0x5928ba=_0xd363[_0x237bf7];return _0x5928ba;};'use strict';var Sequelize=require(_0x3d36('0x0'));var _=require('lodash');module[_0x3d36('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3849e9){return this[_0x3d36('0x2')](_0x3d36('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1bebb3){this[_0x3d36('0x4')](_0x3d36('0x3'),_0x1bebb3?_0x1bebb3:this['getDataValue'](_0x3d36('0x5')));}},'type':{'type':Sequelize[_0x3d36('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x3d36('0x7')](_0x3d36('0x8')),'get':function(){if(this[_0x3d36('0x2')](_0x3d36('0x9'))===_0x3d36('0xa')){return JSON[_0x3d36('0xb')](this[_0x3d36('0x2')]('values'));}else{return this[_0x3d36('0x2')](_0x3d36('0xc'));}},'set':function(_0x23fefc){if(Array[_0x3d36('0xd')](_0x23fefc)){this[_0x3d36('0x4')](_0x3d36('0xc'),JSON[_0x3d36('0xe')](_0x23fefc));}else{this[_0x3d36('0x4')]('values',_0x23fefc);}}},'required':{'type':Sequelize[_0x3d36('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3d36('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3d36('0x10')](_0x3d36('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4c3599e..2fca5e6 100644 --- a/server/api/cmCustomField/cmCustomField.controller.js +++ b/server/api/cmCustomField/cmCustomField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x206b=['bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','CmCustomField','rawAttributes','type','model','differenceBy','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','count','include','rows','show','params','includeAll','find','catch','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x32cd29,_0x29f6bb){var _0x2f7e6e=function(_0x20a924){while(--_0x20a924){_0x32cd29['push'](_0x32cd29['shift']());}};_0x2f7e6e(++_0x29f6bb);}(_0x206b,0xf6));var _0xb206=function(_0x1b79f5,_0x1cf93a){_0x1b79f5=_0x1b79f5-0x0;var _0x26a6f1=_0x206b[_0x1b79f5];return _0x26a6f1;};'use strict';var emlformat=require(_0xb206('0x0'));var rimraf=require(_0xb206('0x1'));var zipdir=require(_0xb206('0x2'));var jsonpatch=require(_0xb206('0x3'));var rp=require(_0xb206('0x4'));var moment=require(_0xb206('0x5'));var BPromise=require(_0xb206('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb206('0x7'));var sox=require(_0xb206('0x8'));var csv=require(_0xb206('0x9'));var ejs=require(_0xb206('0xa'));var fs=require('fs');var fs_extra=require(_0xb206('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb206('0xc'));var jsforce=require(_0xb206('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb206('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb206('0xe'));var authService=require(_0xb206('0xf'));var qs=require(_0xb206('0x10'));var as=require(_0xb206('0x11'));var hardwareService=require(_0xb206('0x12'));var logger=require(_0xb206('0x13'))('api');var utils=require(_0xb206('0x14'));var config=require(_0xb206('0x15'));var licenseUtil=require(_0xb206('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x331664,_0x435972){_0x435972=_0x435972||0xcc;return function(_0x117933){if(_0x117933){return _0x331664[_0xb206('0x17')](_0x435972);}return _0x331664[_0xb206('0x18')](_0x435972)[_0xb206('0x19')]();};}function respondWithResult(_0x40507a,_0xa4a590){_0xa4a590=_0xa4a590||0xc8;return function(_0x3c4fe1){if(_0x3c4fe1){return _0x40507a['status'](_0xa4a590)[_0xb206('0x1a')](_0x3c4fe1);}};}function respondWithFilteredResult(_0x12da30,_0x10a5ea){return function(_0x44697c){if(_0x44697c){var _0x16da21=typeof _0x10a5ea[_0xb206('0x1b')]===_0xb206('0x1c')&&typeof _0x10a5ea[_0xb206('0x1d')]===_0xb206('0x1c');var _0x3c9e02=_0x44697c['count'];var _0x11c3de=_0x16da21?0x0:_0x10a5ea[_0xb206('0x1b')];var _0x256c0c=_0x16da21?_0x44697c['count']:_0x10a5ea[_0xb206('0x1b')]+_0x10a5ea['limit'];var _0x30009d;if(_0x256c0c>=_0x3c9e02){_0x256c0c=_0x3c9e02;_0x30009d=0xc8;}else{_0x30009d=0xce;}_0x12da30['status'](_0x30009d);return _0x12da30[_0xb206('0x1e')](_0xb206('0x1f'),_0x11c3de+'-'+_0x256c0c+'/'+_0x3c9e02)[_0xb206('0x1a')](_0x44697c);}return null;};}function patchUpdates(_0xc632f1){return function(_0x4b7324){try{jsonpatch[_0xb206('0x20')](_0x4b7324,_0xc632f1,!![]);}catch(_0x112c92){return BPromise[_0xb206('0x21')](_0x112c92);}return _0x4b7324[_0xb206('0x22')]();};}function saveUpdates(_0x407ff6,_0x163c2a){return function(_0xb5c735){if(_0xb5c735){return _0xb5c735[_0xb206('0x23')](_0x407ff6)['then'](function(_0x156603){return _0x156603;});}return null;};}function removeEntity(_0x1a22cc,_0x5a9fb3){return function(_0x186610){if(_0x186610){return _0x186610[_0xb206('0x24')]()[_0xb206('0x25')](function(){_0x1a22cc[_0xb206('0x18')](0xcc)[_0xb206('0x19')]();});}};}function handleEntityNotFound(_0x420c3c,_0x2443f8){return function(_0x46b8db){if(!_0x46b8db){_0x420c3c[_0xb206('0x17')](0x194);}return _0x46b8db;};}function handleError(_0x2dbd09,_0x2b699e){_0x2b699e=_0x2b699e||0x1f4;return function(_0x463fc2){logger['error'](_0x463fc2['stack']);if(_0x463fc2[_0xb206('0x26')]){delete _0x463fc2[_0xb206('0x26')];}_0x2dbd09[_0xb206('0x18')](_0x2b699e)[_0xb206('0x27')](_0x463fc2);};}exports[_0xb206('0x28')]=function(_0x576359,_0x52f3fe){var _0x4e40b1={},_0x4d336e={},_0x2cd902={'count':0x0,'rows':[]};var _0x2326ba=_[_0xb206('0x29')](db[_0xb206('0x2a')][_0xb206('0x2b')],function(_0x257e27){return{'name':_0x257e27['fieldName'],'type':_0x257e27[_0xb206('0x2c')]['key']};});_0x4d336e[_0xb206('0x2d')]=_[_0xb206('0x2e')](_[_0xb206('0x29')](_0x2326ba,_0xb206('0x26')),['name']);_0x4d336e[_0xb206('0x2f')]=_[_0xb206('0x30')](_0x576359[_0xb206('0x2f')]);_0x4d336e['filters']=_['intersection'](_0x4d336e[_0xb206('0x2d')],_0x4d336e[_0xb206('0x2f')]);_0x4e40b1[_0xb206('0x31')]=_[_0xb206('0x32')](_0x4d336e[_0xb206('0x2d')],qs[_0xb206('0x33')](_0x576359['query']['fields']));_0x4e40b1['attributes']=_0x4e40b1[_0xb206('0x31')][_0xb206('0x34')]?_0x4e40b1['attributes']:_0x4d336e[_0xb206('0x2d')];if(!_0x576359[_0xb206('0x2f')]['hasOwnProperty'](_0xb206('0x35'))){_0x4e40b1[_0xb206('0x1d')]=qs[_0xb206('0x1d')](_0x576359[_0xb206('0x2f')][_0xb206('0x1d')]);_0x4e40b1['offset']=qs[_0xb206('0x1b')](_0x576359[_0xb206('0x2f')][_0xb206('0x1b')]);}_0x4e40b1[_0xb206('0x36')]=qs[_0xb206('0x37')](_0x576359[_0xb206('0x2f')]['sort']);_0x4e40b1[_0xb206('0x38')]=qs[_0xb206('0x39')](_[_0xb206('0x3a')](_0x576359[_0xb206('0x2f')],_0x4d336e[_0xb206('0x39')]),_0x2326ba);if(_0x576359['query'][_0xb206('0x3b')]){_0x4e40b1['where']=_['merge'](_0x4e40b1[_0xb206('0x38')],{'$or':_[_0xb206('0x29')](_0x2326ba,function(_0x529349){if(_0x529349[_0xb206('0x2c')]!=='VIRTUAL'){var _0x141320={};_0x141320[_0x529349['name']]={'$like':'%'+_0x576359[_0xb206('0x2f')]['filter']+'%'};return _0x141320;}})});}_0x4e40b1=_[_0xb206('0x3c')]({},_0x4e40b1,_0x576359[_0xb206('0x3d')]);var _0x1cec5e={'where':_0x4e40b1[_0xb206('0x38')]};return db[_0xb206('0x2a')][_0xb206('0x3e')](_0x1cec5e)[_0xb206('0x25')](function(_0x46765a){_0x2cd902['count']=_0x46765a;if(_0x576359[_0xb206('0x2f')]['includeAll']){_0x4e40b1[_0xb206('0x3f')]=[{'all':!![]}];}return db[_0xb206('0x2a')]['findAll'](_0x4e40b1);})['then'](function(_0x569eb4){_0x2cd902[_0xb206('0x40')]=_0x569eb4;return _0x2cd902;})['then'](respondWithFilteredResult(_0x52f3fe,_0x4e40b1))['catch'](handleError(_0x52f3fe,null));};exports[_0xb206('0x41')]=function(_0x29329d,_0x3b80bb){var _0x3ec2f0={'raw':!![],'where':{'id':_0x29329d[_0xb206('0x42')]['id']}},_0x35c336={};_0x35c336[_0xb206('0x2d')]=_[_0xb206('0x30')](db[_0xb206('0x2a')]['rawAttributes']);_0x35c336[_0xb206('0x2f')]=_[_0xb206('0x30')](_0x29329d[_0xb206('0x2f')]);_0x35c336['filters']=_[_0xb206('0x32')](_0x35c336[_0xb206('0x2d')],_0x35c336[_0xb206('0x2f')]);_0x3ec2f0[_0xb206('0x31')]=_[_0xb206('0x32')](_0x35c336[_0xb206('0x2d')],qs[_0xb206('0x33')](_0x29329d[_0xb206('0x2f')][_0xb206('0x33')]));_0x3ec2f0[_0xb206('0x31')]=_0x3ec2f0[_0xb206('0x31')][_0xb206('0x34')]?_0x3ec2f0[_0xb206('0x31')]:_0x35c336[_0xb206('0x2d')];if(_0x29329d[_0xb206('0x2f')][_0xb206('0x43')]){_0x3ec2f0['include']=[{'all':!![]}];}_0x3ec2f0=_[_0xb206('0x3c')]({},_0x3ec2f0,_0x29329d['options']);return db['CmCustomField'][_0xb206('0x44')](_0x3ec2f0)[_0xb206('0x25')](handleEntityNotFound(_0x3b80bb,null))['then'](respondWithResult(_0x3b80bb,null))[_0xb206('0x45')](handleError(_0x3b80bb,null));};exports['update']=function(_0x5109a4,_0x20e1dd){if(_0x5109a4[_0xb206('0x46')]['id']){delete _0x5109a4['body']['id'];}return db[_0xb206('0x2a')][_0xb206('0x44')]({'where':{'id':_0x5109a4[_0xb206('0x42')]['id']}})[_0xb206('0x25')](handleEntityNotFound(_0x20e1dd,null))[_0xb206('0x25')](saveUpdates(_0x5109a4[_0xb206('0x46')],null))['then'](respondWithResult(_0x20e1dd,null))[_0xb206('0x45')](handleError(_0x20e1dd,null));};exports[_0xb206('0x24')]=function(_0x461e6b,_0x27fbd9){return db[_0xb206('0x2a')][_0xb206('0x44')]({'where':{'id':_0x461e6b[_0xb206('0x42')]['id']}})[_0xb206('0x25')](handleEntityNotFound(_0x27fbd9,null))[_0xb206('0x25')](removeEntity(_0x27fbd9,null))[_0xb206('0x45')](handleError(_0x27fbd9,null));};exports[_0xb206('0x47')]=function(_0x443c1b,_0x5b7fea){var _0x5aa9be;return db[_0xb206('0x48')][_0xb206('0x49')](function(_0x4232bb){return db[_0xb206('0x2a')][_0xb206('0x47')](_0x443c1b['body'],{'transaction':_0x4232bb})['then'](function(_0x341a72){_0x5aa9be=_0x341a72;var _0x299443={'type':db[_0xb206('0x4a')][_0xb206('0x4b')],'transaction':_0x4232bb};switch(_0x443c1b[_0xb206('0x46')][_0xb206('0x2c')]){case'text':_0x299443[_0xb206('0x2c')]=db[_0xb206('0x4a')]['TEXT'];break;case _0xb206('0x4c'):_0x299443[_0xb206('0x2c')]=db[_0xb206('0x4a')][_0xb206('0x4d')];break;case _0xb206('0x4e'):_0x299443['type']=db['Sequelize'][_0xb206('0x4f')];_0x299443[_0xb206('0x50')]=![];break;default:}return db[_0xb206('0x48')][_0xb206('0x51')]['addColumn'](_0xb206('0x52'),util[_0xb206('0x53')]('cf_%d',_0x5aa9be['id']),_0x299443);})[_0xb206('0x25')](function(){return _0x5aa9be;});})[_0xb206('0x25')](respondWithResult(_0x5b7fea,0xc9))[_0xb206('0x45')](handleError(_0x5b7fea,null));}; \ No newline at end of file +var _0xd3e1=['query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','rows','catch','params','options','find','body','sequelize','create','TEXT','text','number','INTEGER','switch','Sequelize','BOOLEAN','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','destroy','then','error','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','keys'];(function(_0x49d683,_0x4699ac){var _0x161524=function(_0x3ad382){while(--_0x3ad382){_0x49d683['push'](_0x49d683['shift']());}};_0x161524(++_0x4699ac);}(_0xd3e1,0x7a));var _0x1d3e=function(_0x59dbf2,_0x267a4b){_0x59dbf2=_0x59dbf2-0x0;var _0xb353da=_0xd3e1[_0x59dbf2];return _0xb353da;};'use strict';var emlformat=require(_0x1d3e('0x0'));var rimraf=require(_0x1d3e('0x1'));var zipdir=require(_0x1d3e('0x2'));var jsonpatch=require(_0x1d3e('0x3'));var rp=require(_0x1d3e('0x4'));var moment=require(_0x1d3e('0x5'));var BPromise=require(_0x1d3e('0x6'));var Mustache=require(_0x1d3e('0x7'));var util=require(_0x1d3e('0x8'));var path=require(_0x1d3e('0x9'));var sox=require(_0x1d3e('0xa'));var csv=require(_0x1d3e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d3e('0xc'));var _=require(_0x1d3e('0xd'));var squel=require(_0x1d3e('0xe'));var crypto=require(_0x1d3e('0xf'));var jsforce=require(_0x1d3e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1d3e('0xb'));var querystring=require('querystring');var Papa=require(_0x1d3e('0x11'));var Redis=require(_0x1d3e('0x12'));var authService=require(_0x1d3e('0x13'));var qs=require(_0x1d3e('0x14'));var as=require(_0x1d3e('0x15'));var hardwareService=require(_0x1d3e('0x16'));var logger=require('../../config/logger')(_0x1d3e('0x17'));var utils=require(_0x1d3e('0x18'));var config=require(_0x1d3e('0x19'));var licenseUtil=require(_0x1d3e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8b3a9b,_0x2015ab){_0x2015ab=_0x2015ab||0xcc;return function(_0x44557d){if(_0x44557d){return _0x8b3a9b[_0x1d3e('0x1b')](_0x2015ab);}return _0x8b3a9b[_0x1d3e('0x1c')](_0x2015ab)[_0x1d3e('0x1d')]();};}function respondWithResult(_0x19587f,_0x36d48f){_0x36d48f=_0x36d48f||0xc8;return function(_0x531f62){if(_0x531f62){return _0x19587f[_0x1d3e('0x1c')](_0x36d48f)['json'](_0x531f62);}};}function respondWithFilteredResult(_0x18920d,_0x36d6fe){return function(_0x13ac49){if(_0x13ac49){var _0x3fdafe=typeof _0x36d6fe[_0x1d3e('0x1e')]===_0x1d3e('0x1f')&&typeof _0x36d6fe[_0x1d3e('0x20')]===_0x1d3e('0x1f');var _0x5ede62=_0x13ac49[_0x1d3e('0x21')];var _0x5ba2cc=_0x3fdafe?0x0:_0x36d6fe[_0x1d3e('0x1e')];var _0x15752c=_0x3fdafe?_0x13ac49[_0x1d3e('0x21')]:_0x36d6fe['offset']+_0x36d6fe['limit'];var _0x5f0c83;if(_0x15752c>=_0x5ede62){_0x15752c=_0x5ede62;_0x5f0c83=0xc8;}else{_0x5f0c83=0xce;}_0x18920d['status'](_0x5f0c83);return _0x18920d[_0x1d3e('0x22')]('Content-Range',_0x5ba2cc+'-'+_0x15752c+'/'+_0x5ede62)[_0x1d3e('0x23')](_0x13ac49);}return null;};}function patchUpdates(_0x32e063){return function(_0x11494a){try{jsonpatch[_0x1d3e('0x24')](_0x11494a,_0x32e063,!![]);}catch(_0x3fbb04){return BPromise['reject'](_0x3fbb04);}return _0x11494a[_0x1d3e('0x25')]();};}function saveUpdates(_0x456ade,_0x30224b){return function(_0x60e0e3){if(_0x60e0e3){return _0x60e0e3[_0x1d3e('0x26')](_0x456ade)['then'](function(_0x45ed24){return _0x45ed24;});}return null;};}function removeEntity(_0x106062,_0x44b3f9){return function(_0x105ba9){if(_0x105ba9){return _0x105ba9[_0x1d3e('0x27')]()[_0x1d3e('0x28')](function(){_0x106062['status'](0xcc)[_0x1d3e('0x1d')]();});}};}function handleEntityNotFound(_0x4d73e3,_0x3e1753){return function(_0x4e5e63){if(!_0x4e5e63){_0x4d73e3['sendStatus'](0x194);}return _0x4e5e63;};}function handleError(_0x4ca3dc,_0xac0b31){_0xac0b31=_0xac0b31||0x1f4;return function(_0x3f5f5e){logger[_0x1d3e('0x29')](_0x3f5f5e['stack']);if(_0x3f5f5e[_0x1d3e('0x2a')]){delete _0x3f5f5e[_0x1d3e('0x2a')];}_0x4ca3dc[_0x1d3e('0x1c')](_0xac0b31)[_0x1d3e('0x2b')](_0x3f5f5e);};}exports['index']=function(_0x4637ff,_0x291ed5){var _0x5a83ff={},_0x592c55={},_0x3261b0={'count':0x0,'rows':[]};var _0x4d0cfc=_[_0x1d3e('0x2c')](db[_0x1d3e('0x2d')][_0x1d3e('0x2e')],function(_0xca33c){return{'name':_0xca33c[_0x1d3e('0x2f')],'type':_0xca33c[_0x1d3e('0x30')][_0x1d3e('0x31')]};});_0x592c55[_0x1d3e('0x32')]=_['differenceBy'](_[_0x1d3e('0x2c')](_0x4d0cfc,_0x1d3e('0x2a')),[_0x1d3e('0x2a')]);_0x592c55['query']=_[_0x1d3e('0x33')](_0x4637ff[_0x1d3e('0x34')]);_0x592c55[_0x1d3e('0x35')]=_['intersection'](_0x592c55[_0x1d3e('0x32')],_0x592c55['query']);_0x5a83ff[_0x1d3e('0x36')]=_[_0x1d3e('0x37')](_0x592c55[_0x1d3e('0x32')],qs[_0x1d3e('0x38')](_0x4637ff[_0x1d3e('0x34')][_0x1d3e('0x38')]));_0x5a83ff[_0x1d3e('0x36')]=_0x5a83ff[_0x1d3e('0x36')][_0x1d3e('0x39')]?_0x5a83ff['attributes']:_0x592c55[_0x1d3e('0x32')];if(!_0x4637ff[_0x1d3e('0x34')][_0x1d3e('0x3a')](_0x1d3e('0x3b'))){_0x5a83ff[_0x1d3e('0x20')]=qs['limit'](_0x4637ff['query'][_0x1d3e('0x20')]);_0x5a83ff[_0x1d3e('0x1e')]=qs[_0x1d3e('0x1e')](_0x4637ff[_0x1d3e('0x34')][_0x1d3e('0x1e')]);}_0x5a83ff[_0x1d3e('0x3c')]=qs[_0x1d3e('0x3d')](_0x4637ff[_0x1d3e('0x34')][_0x1d3e('0x3d')]);_0x5a83ff[_0x1d3e('0x3e')]=qs['filters'](_[_0x1d3e('0x3f')](_0x4637ff['query'],_0x592c55['filters']),_0x4d0cfc);if(_0x4637ff[_0x1d3e('0x34')]['filter']){_0x5a83ff[_0x1d3e('0x3e')]=_[_0x1d3e('0x40')](_0x5a83ff[_0x1d3e('0x3e')],{'$or':_['map'](_0x4d0cfc,function(_0x2b53bf){if(_0x2b53bf['type']!=='VIRTUAL'){var _0x42baee={};_0x42baee[_0x2b53bf['name']]={'$like':'%'+_0x4637ff[_0x1d3e('0x34')][_0x1d3e('0x41')]+'%'};return _0x42baee;}})});}_0x5a83ff=_[_0x1d3e('0x40')]({},_0x5a83ff,_0x4637ff['options']);var _0x5a7b88={'where':_0x5a83ff[_0x1d3e('0x3e')]};return db[_0x1d3e('0x2d')][_0x1d3e('0x21')](_0x5a7b88)[_0x1d3e('0x28')](function(_0x10a1c9){_0x3261b0[_0x1d3e('0x21')]=_0x10a1c9;if(_0x4637ff[_0x1d3e('0x34')][_0x1d3e('0x42')]){_0x5a83ff[_0x1d3e('0x43')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x5a83ff);})[_0x1d3e('0x28')](function(_0x4bf5b3){_0x3261b0[_0x1d3e('0x44')]=_0x4bf5b3;return _0x3261b0;})[_0x1d3e('0x28')](respondWithFilteredResult(_0x291ed5,_0x5a83ff))[_0x1d3e('0x45')](handleError(_0x291ed5,null));};exports['show']=function(_0x1e9362,_0x40d128){var _0x5e0107={'raw':!![],'where':{'id':_0x1e9362[_0x1d3e('0x46')]['id']}},_0x3f2a8a={};_0x3f2a8a[_0x1d3e('0x32')]=_[_0x1d3e('0x33')](db[_0x1d3e('0x2d')][_0x1d3e('0x2e')]);_0x3f2a8a[_0x1d3e('0x34')]=_['keys'](_0x1e9362[_0x1d3e('0x34')]);_0x3f2a8a[_0x1d3e('0x35')]=_[_0x1d3e('0x37')](_0x3f2a8a[_0x1d3e('0x32')],_0x3f2a8a[_0x1d3e('0x34')]);_0x5e0107[_0x1d3e('0x36')]=_[_0x1d3e('0x37')](_0x3f2a8a['model'],qs[_0x1d3e('0x38')](_0x1e9362[_0x1d3e('0x34')][_0x1d3e('0x38')]));_0x5e0107['attributes']=_0x5e0107[_0x1d3e('0x36')][_0x1d3e('0x39')]?_0x5e0107['attributes']:_0x3f2a8a['model'];if(_0x1e9362[_0x1d3e('0x34')][_0x1d3e('0x42')]){_0x5e0107[_0x1d3e('0x43')]=[{'all':!![]}];}_0x5e0107=_[_0x1d3e('0x40')]({},_0x5e0107,_0x1e9362[_0x1d3e('0x47')]);return db['CmCustomField'][_0x1d3e('0x48')](_0x5e0107)[_0x1d3e('0x28')](handleEntityNotFound(_0x40d128,null))[_0x1d3e('0x28')](respondWithResult(_0x40d128,null))['catch'](handleError(_0x40d128,null));};exports[_0x1d3e('0x26')]=function(_0x45bea9,_0x9c3f50){if(_0x45bea9['body']['id']){delete _0x45bea9[_0x1d3e('0x49')]['id'];}return db[_0x1d3e('0x2d')][_0x1d3e('0x48')]({'where':{'id':_0x45bea9['params']['id']}})[_0x1d3e('0x28')](handleEntityNotFound(_0x9c3f50,null))[_0x1d3e('0x28')](saveUpdates(_0x45bea9[_0x1d3e('0x49')],null))['then'](respondWithResult(_0x9c3f50,null))[_0x1d3e('0x45')](handleError(_0x9c3f50,null));};exports[_0x1d3e('0x27')]=function(_0x3669ef,_0x4d0c2d){return db[_0x1d3e('0x2d')][_0x1d3e('0x48')]({'where':{'id':_0x3669ef['params']['id']}})[_0x1d3e('0x28')](handleEntityNotFound(_0x4d0c2d,null))[_0x1d3e('0x28')](removeEntity(_0x4d0c2d,null))[_0x1d3e('0x45')](handleError(_0x4d0c2d,null));};exports['create']=function(_0x594b9a,_0x20ad26){var _0xf2593c;return db[_0x1d3e('0x4a')]['transaction'](function(_0x3ecee9){return db[_0x1d3e('0x2d')][_0x1d3e('0x4b')](_0x594b9a[_0x1d3e('0x49')],{'transaction':_0x3ecee9})[_0x1d3e('0x28')](function(_0x99f1e3){_0xf2593c=_0x99f1e3;var _0x1dac13={'type':db['Sequelize'][_0x1d3e('0x4c')],'transaction':_0x3ecee9};switch(_0x594b9a[_0x1d3e('0x49')]['type']){case _0x1d3e('0x4d'):_0x1dac13['type']=db['Sequelize'][_0x1d3e('0x4c')];break;case _0x1d3e('0x4e'):_0x1dac13[_0x1d3e('0x30')]=db['Sequelize'][_0x1d3e('0x4f')];break;case _0x1d3e('0x50'):_0x1dac13['type']=db[_0x1d3e('0x51')][_0x1d3e('0x52')];_0x1dac13['defaultValue']=![];break;default:}return db['sequelize'][_0x1d3e('0x53')][_0x1d3e('0x54')](_0x1d3e('0x55'),util[_0x1d3e('0x56')]('cf_%d',_0xf2593c['id']),_0x1dac13);})[_0x1d3e('0x28')](function(){return _0xf2593c;});})[_0x1d3e('0x28')](respondWithResult(_0x20ad26,0xc9))[_0x1d3e('0x45')](handleError(_0x20ad26,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 683f984..ffcc881 100644 --- a/server/api/cmCustomField/cmCustomField.model.js +++ b/server/api/cmCustomField/cmCustomField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50b6=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','moment','request-promise','path'];(function(_0x558db1,_0x297625){var _0x3c480d=function(_0x590bab){while(--_0x590bab){_0x558db1['push'](_0x558db1['shift']());}};_0x3c480d(++_0x297625);}(_0x50b6,0xaf));var _0x650b=function(_0x55e12e,_0x5a9ee2){_0x55e12e=_0x55e12e-0x0;var _0x3caa06=_0x50b6[_0x55e12e];return _0x3caa06;};'use strict';var _=require('lodash');var util=require(_0x650b('0x0'));var logger=require(_0x650b('0x1'))('api');var moment=require(_0x650b('0x2'));var BPromise=require('bluebird');var rp=require(_0x650b('0x3'));var fs=require('fs');var path=require(_0x650b('0x4'));var rimraf=require(_0x650b('0x5'));var config=require(_0x650b('0x6'));var attributes=require(_0x650b('0x7'));module[_0x650b('0x8')]=function(_0x3f5018,_0x2fa8c4){return _0x3f5018[_0x650b('0x9')](_0x650b('0xa'),attributes,{'tableName':_0x650b('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66ec=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api'];(function(_0x1c169a,_0x37a2fa){var _0x4be19d=function(_0x1e8d6d){while(--_0x1e8d6d){_0x1c169a['push'](_0x1c169a['shift']());}};_0x4be19d(++_0x37a2fa);}(_0x66ec,0x17d));var _0xc66e=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x66ec[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0xc66e('0x0'));var logger=require(_0xc66e('0x1'))(_0xc66e('0x2'));var moment=require('moment');var BPromise=require(_0xc66e('0x3'));var rp=require(_0xc66e('0x4'));var fs=require('fs');var path=require(_0xc66e('0x5'));var rimraf=require(_0xc66e('0x6'));var config=require(_0xc66e('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xc66e('0x8')]=function(_0x38306a,_0x369063){return _0x38306a[_0xc66e('0x9')](_0xc66e('0xa'),attributes,{'tableName':_0xc66e('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 55b26a7..c8d4496 100644 --- a/server/api/cmCustomField/cmCustomField.rpc.js +++ b/server/api/cmCustomField/cmCustomField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd3d=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x50694c,_0x7a7fa9){var _0x535b99=function(_0x3b3063){while(--_0x3b3063){_0x50694c['push'](_0x50694c['shift']());}};_0x535b99(++_0x7a7fa9);}(_0xbd3d,0x165));var _0xdbd3=function(_0x5d1172,_0x2e0796){_0x5d1172=_0x5d1172-0x0;var _0x5aaa6d=_0xbd3d[_0x5d1172];return _0x5aaa6d;};'use strict';var _=require(_0xdbd3('0x0'));var util=require('util');var moment=require(_0xdbd3('0x1'));var BPromise=require(_0xdbd3('0x2'));var rs=require(_0xdbd3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdbd3('0x4'));var logger=require(_0xdbd3('0x5'))(_0xdbd3('0x6'));var config=require(_0xdbd3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdbd3('0x8')][_0xdbd3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1786b2,_0x38be20,_0x14e5fb){return new BPromise(function(_0x575fa7,_0x143b52){return client['request'](_0x1786b2,_0x14e5fb)[_0xdbd3('0xa')](function(_0x1290b3){logger['info'](_0xdbd3('0xb'),_0x38be20,_0xdbd3('0xc'));logger[_0xdbd3('0xd')](_0xdbd3('0xe'),_0x38be20,_0xdbd3('0xc'),JSON['stringify'](_0x1290b3));if(_0x1290b3[_0xdbd3('0xf')]){if(_0x1290b3[_0xdbd3('0xf')][_0xdbd3('0x10')]===0x1f4){logger[_0xdbd3('0xf')]('CmCustomField,\x20%s,\x20%s',_0x38be20,_0x1290b3['error']['message']);return _0x143b52(_0x1290b3[_0xdbd3('0xf')]['message']);}logger[_0xdbd3('0xf')](_0xdbd3('0xb'),_0x38be20,_0x1290b3[_0xdbd3('0xf')][_0xdbd3('0x11')]);return _0x575fa7(_0x1290b3['error'][_0xdbd3('0x11')]);}else{logger['info'](_0xdbd3('0xb'),_0x38be20,_0xdbd3('0xc'));_0x575fa7(_0x1290b3[_0xdbd3('0x12')][_0xdbd3('0x11')]);}})[_0xdbd3('0x13')](function(_0x184307){logger[_0xdbd3('0xf')](_0xdbd3('0xb'),_0x38be20,_0x184307);_0x143b52(_0x184307);});});} \ No newline at end of file +var _0x71d8=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x41068c,_0x54fac1){var _0x4ef366=function(_0x4496fc){while(--_0x4496fc){_0x41068c['push'](_0x41068c['shift']());}};_0x4ef366(++_0x54fac1);}(_0x71d8,0xb0));var _0x871d=function(_0x1bd75c,_0x1e96d9){_0x1bd75c=_0x1bd75c-0x0;var _0x584207=_0x71d8[_0x1bd75c];return _0x584207;};'use strict';var _=require(_0x871d('0x0'));var util=require(_0x871d('0x1'));var moment=require(_0x871d('0x2'));var BPromise=require(_0x871d('0x3'));var rs=require(_0x871d('0x4'));var fs=require('fs');var Redis=require(_0x871d('0x5'));var db=require(_0x871d('0x6'))['db'];var utils=require(_0x871d('0x7'));var logger=require(_0x871d('0x8'))(_0x871d('0x9'));var config=require(_0x871d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x871d('0xb')][_0x871d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2519d6,_0x394493,_0x1df5c3){return new BPromise(function(_0x4a2736,_0x1ef665){return client[_0x871d('0xd')](_0x2519d6,_0x1df5c3)[_0x871d('0xe')](function(_0x281fb0){logger[_0x871d('0xf')](_0x871d('0x10'),_0x394493,'request\x20sent');logger[_0x871d('0x11')](_0x871d('0x12'),_0x394493,_0x871d('0x13'),JSON[_0x871d('0x14')](_0x281fb0));if(_0x281fb0[_0x871d('0x15')]){if(_0x281fb0[_0x871d('0x15')][_0x871d('0x16')]===0x1f4){logger[_0x871d('0x15')](_0x871d('0x10'),_0x394493,_0x281fb0[_0x871d('0x15')]['message']);return _0x1ef665(_0x281fb0[_0x871d('0x15')][_0x871d('0x17')]);}logger['error'](_0x871d('0x10'),_0x394493,_0x281fb0[_0x871d('0x15')][_0x871d('0x17')]);return _0x4a2736(_0x281fb0['error'][_0x871d('0x17')]);}else{logger[_0x871d('0xf')](_0x871d('0x10'),_0x394493,_0x871d('0x13'));_0x4a2736(_0x281fb0[_0x871d('0x18')][_0x871d('0x17')]);}})['catch'](function(_0x733525){logger['error'](_0x871d('0x10'),_0x394493,_0x733525);_0x1ef665(_0x733525);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 8e5cefd..5d20a4c 100644 --- a/server/api/cmCustomField/index.js +++ b/server/api/cmCustomField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9ef=['put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd9ef,0x95));var _0xfd9e=function(_0xa4fcb6,_0x2fa837){_0xa4fcb6=_0xa4fcb6-0x0;var _0x51cde7=_0xd9ef[_0xa4fcb6];return _0x51cde7;};'use strict';var multer=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var path=require('path');var timeout=require(_0xfd9e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfd9e('0x3'));var interaction=require(_0xfd9e('0x4'));var config=require(_0xfd9e('0x5'));var controller=require(_0xfd9e('0x6'));router[_0xfd9e('0x7')]('/',auth[_0xfd9e('0x8')](),controller[_0xfd9e('0x9')]);router[_0xfd9e('0x7')](_0xfd9e('0xa'),auth[_0xfd9e('0x8')](),controller[_0xfd9e('0xb')]);router[_0xfd9e('0xc')]('/',auth[_0xfd9e('0x8')](),controller['create']);router[_0xfd9e('0xd')](_0xfd9e('0xa'),auth['isAuthenticated'](),controller[_0xfd9e('0xe')]);router[_0xfd9e('0xf')](_0xfd9e('0xa'),auth['isAuthenticated'](),controller[_0xfd9e('0x10')]);module[_0xfd9e('0x11')]=router; \ No newline at end of file +var _0xa267=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','update'];(function(_0x456442,_0x4e5522){var _0x55dfb8=function(_0x512e80){while(--_0x512e80){_0x456442['push'](_0x456442['shift']());}};_0x55dfb8(++_0x4e5522);}(_0xa267,0xcb));var _0x7a26=function(_0x537e48,_0x200301){_0x537e48=_0x537e48-0x0;var _0x14bc5e=_0xa267[_0x537e48];return _0x14bc5e;};'use strict';var multer=require(_0x7a26('0x0'));var util=require(_0x7a26('0x1'));var path=require(_0x7a26('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a26('0x3'));var router=express[_0x7a26('0x4')]();var fs_extra=require(_0x7a26('0x5'));var auth=require(_0x7a26('0x6'));var interaction=require(_0x7a26('0x7'));var config=require(_0x7a26('0x8'));var controller=require(_0x7a26('0x9'));router[_0x7a26('0xa')]('/',auth['isAuthenticated'](),controller[_0x7a26('0xb')]);router[_0x7a26('0xa')](_0x7a26('0xc'),auth['isAuthenticated'](),controller[_0x7a26('0xd')]);router[_0x7a26('0xe')]('/',auth[_0x7a26('0xf')](),controller['create']);router['put'](_0x7a26('0xc'),auth[_0x7a26('0xf')](),controller[_0x7a26('0x10')]);router[_0x7a26('0x11')](_0x7a26('0xc'),auth[_0x7a26('0xf')](),controller[_0x7a26('0x12')]);module[_0x7a26('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 74d1ea1..5ea6136 100644 --- a/server/api/cmHopper/cmHopper.attributes.js +++ b/server/api/cmHopper/cmHopper.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a34=['UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x3653c7,_0xadb356){var _0x58a021=function(_0x20b237){while(--_0x20b237){_0x3653c7['push'](_0x3653c7['shift']());}};_0x58a021(++_0xadb356);}(_0x0a34,0x106));var _0x40a3=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x0a34[_0x5f1391];return _0x50ebe3;};'use strict';var moment=require(_0x40a3('0x0'));var Sequelize=require(_0x40a3('0x1'));module[_0x40a3('0x2')]={'phone':{'type':Sequelize[_0x40a3('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x40a3('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x40a3('0x5')],'defaultValue':moment()['format'](_0x40a3('0x6'))},'countbusyretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x40a3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x40a3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x40a3('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x40a3('0x7')],'unique':_0x40a3('0x9')},'ListId':{'type':Sequelize[_0x40a3('0x7')],'unique':_0x40a3('0x9')},'UserId':{'type':Sequelize[_0x40a3('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x40a3('0x7')],'unique':_0x40a3('0x9')},'CampaignId':{'type':Sequelize[_0x40a3('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x40a3('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x40a3('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9276=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','BOOLEAN','contactListQueue','sequelize','STRING','DATE'];(function(_0x4d0d85,_0x3250d3){var _0x290a74=function(_0x4762db){while(--_0x4762db){_0x4d0d85['push'](_0x4d0d85['shift']());}};_0x290a74(++_0x3250d3);}(_0x9276,0x7d));var _0x6927=function(_0x5d4ed9,_0x321ad9){_0x5d4ed9=_0x5d4ed9-0x0;var _0x46184a=_0x9276[_0x5d4ed9];return _0x46184a;};'use strict';var moment=require('moment');var Sequelize=require(_0x6927('0x0'));module['exports']={'phone':{'type':Sequelize[_0x6927('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6927('0x2')],'defaultValue':moment()['format'](_0x6927('0x3'))},'countbusyretry':{'type':Sequelize[_0x6927('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6927('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6927('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6927('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6927('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x6927('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6927('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6927('0x4')],'unique':_0x6927('0x7')},'ListId':{'type':Sequelize[_0x6927('0x4')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x6927('0x4')],'unique':_0x6927('0x7')},'CampaignId':{'type':Sequelize[_0x6927('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6927('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6927('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6927('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6927('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6927('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6927('0x2')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index c43ee6d..ff38d51 100644 --- a/server/api/cmHopper/cmHopper.controller.js +++ b/server/api/cmHopper/cmHopper.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Contact','List','Queue','preview','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','getTimezones','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','fieldName','key','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','attributes','model','length','order','sort','pick','filter','where','merge','options','includeAll','include','CmHopper','findAll','catch','show','params','rawAttributes','fields','find','create','body','describe','destroy','VoiceQueueId','Campaign','CampaignId','dataValues','createdAt','updatedAt','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','calleridname','firstName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','hopperIds','priority','scheduledAt','DESC','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','CmCompany','Company','CmList','VoiceQueue','dialActive'];(function(_0x404f13,_0x4fa35f){var _0x1f9dbb=function(_0x492b33){while(--_0x492b33){_0x404f13['push'](_0x404f13['shift']());}};_0x1f9dbb(++_0x4fa35f);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var moment=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var qs=require(_0x7995('0x2'));var logger=require(_0x7995('0x3'))('api');var shared=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];function respondWithResult(_0x1902b4,_0x462a03){_0x462a03=_0x462a03||0xc8;return function(_0x576d89){if(_0x576d89){return _0x1902b4[_0x7995('0x6')](_0x462a03)[_0x7995('0x7')](_0x576d89);}};}function respondWithFilteredResult(_0x137b6b,_0x219534){return function(_0xbda126){if(_0xbda126){var _0x326741=typeof _0x219534['offset']===_0x7995('0x8')&&typeof _0x219534[_0x7995('0x9')]==='undefined';var _0xa2e5f0=_0xbda126[_0x7995('0xa')];var _0x18c8a3=_0x326741?0x0:_0x219534[_0x7995('0xb')];var _0x3c1d19=_0x326741?_0xbda126[_0x7995('0xa')]:_0x219534[_0x7995('0xb')]+_0x219534['limit'];var _0x245143;if(_0x3c1d19>=_0xa2e5f0){_0x3c1d19=_0xa2e5f0;_0x245143=0xc8;}else{_0x245143=0xce;}_0x137b6b[_0x7995('0x6')](_0x245143);return _0x137b6b['set'](_0x7995('0xc'),_0x18c8a3+'-'+_0x3c1d19+'/'+_0xa2e5f0)[_0x7995('0x7')](_0xbda126);}return null;};}function saveUpdates(_0x19a27e,_0x385f00){return function(_0x281576){if(_0x281576){return _0x281576[_0x7995('0xd')](_0x19a27e)[_0x7995('0xe')](function(_0x4cc004){return _0x4cc004;});}return null;};}function handleEntityNotFound(_0x58f5ad,_0x2b4e94){return function(_0x2233dd){if(!_0x2233dd){_0x58f5ad[_0x7995('0xf')](0x194);}return _0x2233dd;};}function handleError(_0x321ae8,_0x3f1d3e){_0x3f1d3e=_0x3f1d3e||0x1f4;return function(_0x1a5310){logger[_0x7995('0x10')](_0x1a5310[_0x7995('0x11')]);if(_0x1a5310['name']){delete _0x1a5310[_0x7995('0x12')];}_0x321ae8['status'](_0x3f1d3e)[_0x7995('0x13')](_0x1a5310);};}exports[_0x7995('0x14')]=function(_0x43d4b8,_0x291317){var _0x1e1415={},_0x37a7d4={},_0x4faa60={'count':0x0,'rows':[]};var _0x54c9ae=_[_0x7995('0x15')](db['CmHopper']['rawAttributes'],function(_0x3ec178){return{'name':_0x3ec178[_0x7995('0x16')],'type':_0x3ec178['type'][_0x7995('0x17')]};});_0x37a7d4['model']=_['map'](_0x54c9ae,_0x7995('0x12'));_0x37a7d4[_0x7995('0x18')]=_[_0x7995('0x19')](_0x43d4b8[_0x7995('0x18')]);_0x37a7d4[_0x7995('0x1a')]=_[_0x7995('0x1b')](_0x37a7d4['model'],_0x37a7d4[_0x7995('0x18')]);_0x37a7d4[_0x7995('0x1a')]=_[_0x7995('0x1c')](_0x37a7d4[_0x7995('0x1a')],[_0x7995('0x1d'),_0x7995('0x1e'),_0x7995('0x1f'),_0x7995('0x20'),'$lt',_0x7995('0x21'),_0x7995('0x22'),_0x7995('0x23'),_0x7995('0x24'),_0x7995('0x25'),_0x7995('0x26'),'$in',_0x7995('0x27'),'$like',_0x7995('0x28'),_0x7995('0x29'),_0x7995('0x2a'),_0x7995('0x2b'),_0x7995('0x2c'),'$contains',_0x7995('0x2d'),'$any']);_0x1e1415[_0x7995('0x2e')]=_[_0x7995('0x1b')](_0x37a7d4[_0x7995('0x2f')],qs['fields'](_0x43d4b8['query']['fields']));_0x1e1415[_0x7995('0x2e')]=_0x1e1415[_0x7995('0x2e')][_0x7995('0x30')]?_0x1e1415[_0x7995('0x2e')]:_0x37a7d4[_0x7995('0x2f')];if(!_0x43d4b8[_0x7995('0x18')]['hasOwnProperty']('nolimit')){_0x1e1415[_0x7995('0x9')]=qs['limit'](_0x43d4b8[_0x7995('0x18')][_0x7995('0x9')]);_0x1e1415[_0x7995('0xb')]=qs[_0x7995('0xb')](_0x43d4b8[_0x7995('0x18')]['offset']);}_0x1e1415[_0x7995('0x31')]=qs[_0x7995('0x32')](_0x43d4b8['query']['sort']);_0x1e1415['where']=qs[_0x7995('0x1a')](_[_0x7995('0x33')](_0x43d4b8['query'],_0x37a7d4[_0x7995('0x1a')]),_0x54c9ae);if(_0x43d4b8['query'][_0x7995('0x34')]){_0x1e1415[_0x7995('0x35')]=_[_0x7995('0x36')](_0x1e1415['where'],{'$or':_['map'](_0x54c9ae,function(_0x36d057){if(_0x36d057['type']!=='VIRTUAL'){var _0x3e99cd={};_0x3e99cd[_0x36d057[_0x7995('0x12')]]={'$like':'%'+_0x43d4b8['query'][_0x7995('0x34')]+'%'};return _0x3e99cd;}})});}_0x1e1415=_[_0x7995('0x36')]({},_0x1e1415,_0x43d4b8[_0x7995('0x37')]);var _0x18667c={'where':_0x1e1415[_0x7995('0x35')]};return db['CmHopper'][_0x7995('0xa')](_0x18667c)[_0x7995('0xe')](function(_0xf612e6){_0x4faa60[_0x7995('0xa')]=_0xf612e6;if(_0x43d4b8['query'][_0x7995('0x38')]){_0x1e1415[_0x7995('0x39')]=[{'all':!![]}];}return db[_0x7995('0x3a')][_0x7995('0x3b')](_0x1e1415);})[_0x7995('0xe')](function(_0x1035dc){_0x4faa60['rows']=_0x1035dc;return _0x4faa60;})[_0x7995('0xe')](respondWithFilteredResult(_0x291317,_0x1e1415))[_0x7995('0x3c')](handleError(_0x291317,null));};exports[_0x7995('0x3d')]=function(_0x2ea47f,_0x2e04cd){var _0x298fc2={'raw':!![],'where':{'id':_0x2ea47f[_0x7995('0x3e')]['id']}},_0x14d638={};_0x14d638[_0x7995('0x2f')]=_[_0x7995('0x19')](db[_0x7995('0x3a')][_0x7995('0x3f')]);_0x14d638[_0x7995('0x18')]=_['keys'](_0x2ea47f['query']);_0x14d638[_0x7995('0x1a')]=_[_0x7995('0x1b')](_0x14d638['model'],_0x14d638['query']);_0x298fc2[_0x7995('0x2e')]=_['intersection'](_0x14d638['model'],qs[_0x7995('0x40')](_0x2ea47f[_0x7995('0x18')][_0x7995('0x40')]));_0x298fc2['attributes']=_0x298fc2[_0x7995('0x2e')]['length']?_0x298fc2[_0x7995('0x2e')]:_0x14d638['model'];if(_0x2ea47f['query'][_0x7995('0x38')]){_0x298fc2[_0x7995('0x39')]=[{'all':!![]}];}_0x298fc2=_[_0x7995('0x36')]({},_0x298fc2,_0x2ea47f[_0x7995('0x37')]);return db['CmHopper'][_0x7995('0x41')](_0x298fc2)[_0x7995('0xe')](handleEntityNotFound(_0x2e04cd,null))[_0x7995('0xe')](respondWithResult(_0x2e04cd,null))[_0x7995('0x3c')](handleError(_0x2e04cd,null));};exports['create']=function(_0x5f28e7,_0x1c37c6){return db['CmHopper'][_0x7995('0x42')](_0x5f28e7['body'],{})[_0x7995('0xe')](respondWithResult(_0x1c37c6,0xc9))['catch'](handleError(_0x1c37c6,null));};exports[_0x7995('0xd')]=function(_0x1b0373,_0x4d9245){if(_0x1b0373[_0x7995('0x43')]['id']){delete _0x1b0373[_0x7995('0x43')]['id'];}return db[_0x7995('0x3a')][_0x7995('0x41')]({'where':{'id':_0x1b0373['params']['id']}})[_0x7995('0xe')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0xe')](saveUpdates(_0x1b0373[_0x7995('0x43')],null))['then'](respondWithResult(_0x4d9245,null))[_0x7995('0x3c')](handleError(_0x4d9245,null));};exports[_0x7995('0x44')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x3a')]['describe']()[_0x7995('0xe')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x3c')](handleError(_0x3d8ae3,null));};exports['destroy']=function(_0x3d1dbb,_0x5843ba){var _0x1d87f9;var _0x187735=_0x3d1dbb[_0x7995('0x3e')]['id'];return db[_0x7995('0x3a')][_0x7995('0x41')]({'where':{'id':_0x3d1dbb[_0x7995('0x3e')]['id']}})[_0x7995('0xe')](handleEntityNotFound(_0x5843ba,null))['then'](function(_0x427dcf){if(_0x427dcf){return _0x427dcf[_0x7995('0x45')]()[_0x7995('0xe')](function(_0x4ffc8a){return _0x4ffc8a;});}})[_0x7995('0xe')](function(_0x1fe77e){_0x1d87f9=_0x1fe77e;if(_0x1fe77e){if(_0x1fe77e[_0x7995('0x46')]||_0x1fe77e['CampaignId']){return db[_0x1fe77e['VoiceQueueId']?'VoiceQueue':_0x7995('0x47')][_0x7995('0x41')]({'where':{'id':_0x1fe77e['VoiceQueueId']?_0x1fe77e[_0x7995('0x46')]:_0x1fe77e[_0x7995('0x48')]},'attributes':['id',_0x7995('0x12')],'raw':!![]});}}})[_0x7995('0xe')](function(_0xc04004){var _0x528c8e={};if(_0xc04004){_[_0x7995('0x36')](_0x528c8e,_['omit'](_0x1d87f9[_0x7995('0x49')],[_0x7995('0x4a'),_0x7995('0x4b'),'id']));_0x528c8e['state']=0x15;_0x528c8e['statedesc']='deleted';_0x528c8e['campaign']=_0xc04004[_0x7995('0x12')];_0x528c8e[_0x7995('0x4c')]=_0x3d1dbb[_0x7995('0x4d')][_0x7995('0x12')];_0x528c8e[_0x7995('0x4e')]=_0x3d1dbb[_0x7995('0x4d')]['id'];_0x528c8e[_0x7995('0x4f')]=!![];_0x528c8e[_0x7995('0x50')]=moment()[_0x7995('0x51')](_0x7995('0x52'));_0x528c8e[_0x7995('0x53')]=_0x1d87f9[_0x7995('0x54')];_0x528c8e[_0x7995('0x55')]=_0x1d87f9[_0x7995('0x46')]?_0x7995('0x56'):_0x7995('0x57');return db[_0x7995('0x58')][_0x7995('0x41')]({'where':{'id':_0x528c8e[_0x7995('0x59')]},'attributes':['firstName',_0x7995('0x5a')]})[_0x7995('0xe')](function(_0x3b8a54){if(!_[_0x7995('0x5b')](_0x5843ba)&&!_['isNil'](_0x3b8a54['firstName'])){_0x528c8e[_0x7995('0x5c')]=_0x3b8a54[_0x7995('0x5d')];if(!_[_0x7995('0x5b')](_0x3b8a54[_0x7995('0x5a')])){_0x528c8e['calleridname']+='\x20'+_0x3b8a54[_0x7995('0x5a')];}}})[_0x7995('0x5e')](function(){return db[_0x7995('0x5f')][_0x7995('0x42')](_0x528c8e);});}})['then'](function(_0x5e2d97){return db[_0x7995('0x60')][_0x7995('0x45')]({'where':{'CmHopperId':_0x187735}});})[_0x7995('0xe')](function(){return _0x5843ba[_0x7995('0x6')](0xcc)[_0x7995('0x61')]();})[_0x7995('0x3c')](handleError(_0x5843ba,null));};exports[_0x7995('0x62')]=function(_0x1e2206,_0x984c23){var _0x50caf5=[];return db[_0x7995('0x58')][_0x7995('0x44')]()[_0x7995('0xe')](function(_0x1ecfdb){_0x50caf5=_['keys'](_0x1ecfdb);return _0x1e2206['user'][_0x7995('0x63')]({'where':{'type':_0x7995('0x64'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x7995('0x65'),_0x7995('0x66')],'raw':!![]});})[_0x7995('0xe')](function(_0x57727e){if(_0x57727e&&_0x57727e[_0x7995('0x30')]){return db['sequelize'][_0x7995('0x67')](function(_0x564fca){var _0x3e0a46={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7995('0x51')](_0x7995('0x52'))},'VoiceQueueId':{'$in':_[_0x7995('0x15')](_0x57727e,'id')},'$or':[{'UserId':null},{'UserId':_0x1e2206[_0x7995('0x4d')]['id']}]};var _0xeb8920={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x57727e)[_0x7995('0x34')]([_0x7995('0x66'),0x0])[_0x7995('0x15')]('id')[_0x7995('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x1e2206[_0x7995('0x4d')]['id']}]};var _0x234d8d={'$or':[_0x3e0a46,_0xeb8920]};var _0x56eb85=[];if(_0x1e2206[_0x7995('0x43')][_0x7995('0x69')]&&_0x1e2206[_0x7995('0x43')][_0x7995('0x69')]===_0x7995('0x6a')){if(!_['isEmpty'](_0x1e2206['body'][_0x7995('0x6b')])){_0x234d8d['id']={'$in':_0x1e2206[_0x7995('0x43')][_0x7995('0x6b')]};}_0x56eb85=[[_0x7995('0x6c'),'ASC'],[_0x7995('0x6d'),_0x57727e[0x0]['dialOrderByScheduledAt']==='ASC'?_0x7995('0x6e'):_0x7995('0x6f')],db[_0x7995('0x70')][_0x7995('0x71')](_0x7995('0x72')),['id',_0x7995('0x6e')]];}else{if(!_[_0x7995('0x73')](_0x1e2206[_0x7995('0x43')][_0x7995('0x6b')])){_0x234d8d['id']={'$notIn':_0x1e2206[_0x7995('0x43')]['hopperIds']};}_0x56eb85=[[_0x7995('0x6c'),_0x7995('0x6e')],[_0x7995('0x6d'),_0x57727e[0x0]['dialOrderByScheduledAt']],db[_0x7995('0x70')][_0x7995('0x71')](_0x7995('0x74')),['id',_0x7995('0x6f')]];}return db[_0x7995('0x3a')][_0x7995('0x75')]({'attributes':['id',_0x7995('0x76'),_0x7995('0x54'),_0x7995('0x77')],'where':_0x234d8d,'order':_0x56eb85,'transaction':_0x564fca,'lock':_0x564fca[_0x7995('0x78')][_0x7995('0x79')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x50caf5,'include':[{'model':db[_0x7995('0x7a')],'as':_0x7995('0x7b'),'attributes':['id',_0x7995('0x12')]}]},{'model':db[_0x7995('0x7c')],'as':'List','attributes':['id',_0x7995('0x12')]},{'model':db[_0x7995('0x7d')],'as':'Queue','attributes':['id','name',_0x7995('0x7e')]}]})[_0x7995('0xe')](function(_0x555277){if(_0x555277){return _0x555277[_0x7995('0xd')]({'UserId':_0x1e2206['user']['id']},{'transaction':_0x564fca});}});});}})[_0x7995('0xe')](handleEntityNotFound(_0x984c23,null))[_0x7995('0xe')](respondWithResult(_0x984c23,null))['catch'](handleError(_0x984c23,null));};exports['getPreviewRecall']=function(_0x1f01c0,_0x50c1a4,_0x31b9e6){var _0xa41fff=[];var _0x3dd197=_0x1f01c0[_0x7995('0x3e')]['id'];var _0x1a1873=_0x1f01c0[_0x7995('0x4d')]['id'];return db[_0x7995('0x58')][_0x7995('0x44')]()[_0x7995('0xe')](function(_0x117317){_0xa41fff=_[_0x7995('0x19')](_0x117317);return db[_0x7995('0x70')][_0x7995('0x67')](function(_0x1ff436){const _0x36e3a7={'id':_0x3dd197};return db[_0x7995('0x3a')][_0x7995('0x75')]({'attributes':['id',_0x7995('0x76'),_0x7995('0x77')],'where':_0x36e3a7,'transaction':_0x1ff436,'lock':_0x1ff436[_0x7995('0x78')][_0x7995('0x79')],'include':[{'model':db[_0x7995('0x58')],'as':_0x7995('0x7f'),'attributes':_0xa41fff,'include':[{'model':db[_0x7995('0x7a')],'as':_0x7995('0x7b'),'attributes':['id',_0x7995('0x12')]}]},{'model':db[_0x7995('0x7c')],'as':_0x7995('0x80'),'attributes':['id','name']},{'model':db[_0x7995('0x7d')],'as':_0x7995('0x81'),'attributes':['id','name','dialActive']}]})[_0x7995('0xe')](function(_0x3fe8fc){if(_0x3fe8fc){return _0x3fe8fc[_0x7995('0xd')]({'UserId':_0x1a1873},{'transaction':_0x1ff436});}});});})[_0x7995('0xe')](handleEntityNotFound(_0x50c1a4,null))[_0x7995('0xe')](respondWithResult(_0x50c1a4,null))[_0x7995('0x3c')](handleError(_0x50c1a4,null));};exports['getOpenContacts']=function(_0x2f8a2d,_0xb68962){return _0x2f8a2d[_0x7995('0x4d')][_0x7995('0x63')]({'where':{'type':_0x7995('0x64'),'dialActive':!![],'dialMethod':_0x7995('0x82')},'attributes':['id'],'raw':!![]})[_0x7995('0xe')](function(_0xc93dcb){if(_0xc93dcb&&_0xc93dcb['length']){return db[_0x7995('0x3a')][_0x7995('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x7995('0x15')](_0xc93dcb,'id')},'$or':[{'UserId':null},{'UserId':_0x2f8a2d[_0x7995('0x4d')]['id']}]}});}return 0x0;})[_0x7995('0xe')](function(_0x3db7a9){if(!_[_0x7995('0x5b')](_0x3db7a9)&&_['isNumber'](_0x3db7a9)){return _0xb68962[_0x7995('0x6')](0xc8)[_0x7995('0x7')]({'contacts':_0x3db7a9});}else{logger['error'](_0x7995('0x83'),_0x7995('0x84'),0x194,'entity\x20not\x20found');_0xb68962[_0x7995('0xf')](0x194);}})['catch'](handleError(_0xb68962,null));};exports[_0x7995('0x85')]=function(_0x2322bf,_0x3ab421){var _0x428a1b=shared[_0x7995('0x86')];var _0x5d16da=[];_[_0x7995('0x15')](_0x428a1b,function(_0x345080){_0x5d16da[_0x7995('0x87')]({'id':_0x345080['name'],'name':_0x345080[_0x7995('0x12')],'utcOffset':_0x345080[_0x7995('0x88')]});});return _0x3ab421[_0x7995('0x6')](0xc8)[_0x7995('0x7')]({'tz':_0x5d16da});};exports['getTimezone']=function(_0x3356fd,_0xf59a39){var _0x3a5f5e=shared['timezones'];var _0x5358d4={};if(!_[_0x7995('0x5b')](_0x3a5f5e[_0x3356fd[_0x7995('0x43')]['id']]))_0x5358d4=_0x3a5f5e[_0x3356fd['body']['id']];return _0xf59a39['status'](0xc8)[_0x7995('0x7')](_0x5358d4);}; \ No newline at end of file +var _0x7bae=['format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','findOne','scheduledat','recallme','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getPreviewRecall','LOCK','UPDATE','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','../../components/parsers/qs','../../config/logger','../../config/environment','status','json','offset','undefined','limit','count','set','update','then','sendStatus','error','index','map','CmHopper','fieldName','type','key','name','keys','query','filters','intersection','model','concat','$and','$lte','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','omit','dataValues','updatedAt','state','statedesc','campaign','user','deletedat'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bae[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require(_0xe7ba('0x0'));var logger=require(_0xe7ba('0x1'))('api');var shared=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x120efa,_0x10908b){_0x10908b=_0x10908b||0xc8;return function(_0x166acb){if(_0x166acb){return _0x120efa[_0xe7ba('0x3')](_0x10908b)[_0xe7ba('0x4')](_0x166acb);}};}function respondWithFilteredResult(_0xfd3a22,_0x2d31df){return function(_0x3c5e59){if(_0x3c5e59){var _0x10b307=typeof _0x2d31df[_0xe7ba('0x5')]===_0xe7ba('0x6')&&typeof _0x2d31df[_0xe7ba('0x7')]===_0xe7ba('0x6');var _0x1b2693=_0x3c5e59['count'];var _0x3df8bf=_0x10b307?0x0:_0x2d31df[_0xe7ba('0x5')];var _0x375ebb=_0x10b307?_0x3c5e59[_0xe7ba('0x8')]:_0x2d31df[_0xe7ba('0x5')]+_0x2d31df[_0xe7ba('0x7')];var _0x99a86f;if(_0x375ebb>=_0x1b2693){_0x375ebb=_0x1b2693;_0x99a86f=0xc8;}else{_0x99a86f=0xce;}_0xfd3a22[_0xe7ba('0x3')](_0x99a86f);return _0xfd3a22[_0xe7ba('0x9')]('Content-Range',_0x3df8bf+'-'+_0x375ebb+'/'+_0x1b2693)[_0xe7ba('0x4')](_0x3c5e59);}return null;};}function saveUpdates(_0x588c8b,_0x602b1){return function(_0x45229c){if(_0x45229c){return _0x45229c[_0xe7ba('0xa')](_0x588c8b)[_0xe7ba('0xb')](function(_0x15d018){return _0x15d018;});}return null;};}function handleEntityNotFound(_0x41369f,_0x561dbb){return function(_0x561c48){if(!_0x561c48){_0x41369f[_0xe7ba('0xc')](0x194);}return _0x561c48;};}function handleError(_0x7ba72a,_0x359f6f){_0x359f6f=_0x359f6f||0x1f4;return function(_0x5d1d03){logger[_0xe7ba('0xd')](_0x5d1d03['stack']);if(_0x5d1d03['name']){delete _0x5d1d03['name'];}_0x7ba72a[_0xe7ba('0x3')](_0x359f6f)['send'](_0x5d1d03);};}exports[_0xe7ba('0xe')]=function(_0x4888d9,_0x4e3021){var _0x5a82b5={},_0x3f326a={},_0x30086c={'count':0x0,'rows':[]};var _0x39ca38=_[_0xe7ba('0xf')](db[_0xe7ba('0x10')]['rawAttributes'],function(_0x149c62){return{'name':_0x149c62[_0xe7ba('0x11')],'type':_0x149c62[_0xe7ba('0x12')][_0xe7ba('0x13')]};});_0x3f326a['model']=_[_0xe7ba('0xf')](_0x39ca38,_0xe7ba('0x14'));_0x3f326a['query']=_[_0xe7ba('0x15')](_0x4888d9[_0xe7ba('0x16')]);_0x3f326a[_0xe7ba('0x17')]=_[_0xe7ba('0x18')](_0x3f326a[_0xe7ba('0x19')],_0x3f326a[_0xe7ba('0x16')]);_0x3f326a[_0xe7ba('0x17')]=_[_0xe7ba('0x1a')](_0x3f326a[_0xe7ba('0x17')],[_0xe7ba('0x1b'),'$or','$gt','$gte','$lt',_0xe7ba('0x1c'),'$ne','$eq','$not',_0xe7ba('0x1d'),_0xe7ba('0x1e'),_0xe7ba('0x1f'),_0xe7ba('0x20'),_0xe7ba('0x21'),_0xe7ba('0x22'),_0xe7ba('0x23'),_0xe7ba('0x24'),'$like',_0xe7ba('0x25'),'$contains',_0xe7ba('0x26'),_0xe7ba('0x27')]);_0x5a82b5[_0xe7ba('0x28')]=_['intersection'](_0x3f326a['model'],qs[_0xe7ba('0x29')](_0x4888d9[_0xe7ba('0x16')][_0xe7ba('0x29')]));_0x5a82b5[_0xe7ba('0x28')]=_0x5a82b5[_0xe7ba('0x28')]['length']?_0x5a82b5[_0xe7ba('0x28')]:_0x3f326a[_0xe7ba('0x19')];if(!_0x4888d9['query'][_0xe7ba('0x2a')]('nolimit')){_0x5a82b5['limit']=qs[_0xe7ba('0x7')](_0x4888d9[_0xe7ba('0x16')][_0xe7ba('0x7')]);_0x5a82b5['offset']=qs[_0xe7ba('0x5')](_0x4888d9['query'][_0xe7ba('0x5')]);}_0x5a82b5[_0xe7ba('0x2b')]=qs[_0xe7ba('0x2c')](_0x4888d9[_0xe7ba('0x16')][_0xe7ba('0x2c')]);_0x5a82b5['where']=qs[_0xe7ba('0x17')](_[_0xe7ba('0x2d')](_0x4888d9['query'],_0x3f326a[_0xe7ba('0x17')]),_0x39ca38);if(_0x4888d9[_0xe7ba('0x16')][_0xe7ba('0x2e')]){_0x5a82b5['where']=_[_0xe7ba('0x2f')](_0x5a82b5[_0xe7ba('0x30')],{'$or':_['map'](_0x39ca38,function(_0x3e850e){if(_0x3e850e[_0xe7ba('0x12')]!==_0xe7ba('0x31')){var _0x4c1325={};_0x4c1325[_0x3e850e[_0xe7ba('0x14')]]={'$like':'%'+_0x4888d9[_0xe7ba('0x16')]['filter']+'%'};return _0x4c1325;}})});}_0x5a82b5=_[_0xe7ba('0x2f')]({},_0x5a82b5,_0x4888d9[_0xe7ba('0x32')]);var _0x8a5776={'where':_0x5a82b5['where']};return db['CmHopper'][_0xe7ba('0x8')](_0x8a5776)[_0xe7ba('0xb')](function(_0x58d2a){_0x30086c[_0xe7ba('0x8')]=_0x58d2a;if(_0x4888d9[_0xe7ba('0x16')]['includeAll']){_0x5a82b5[_0xe7ba('0x33')]=[{'all':!![]}];}return db[_0xe7ba('0x10')][_0xe7ba('0x34')](_0x5a82b5);})[_0xe7ba('0xb')](function(_0x5e9619){_0x30086c[_0xe7ba('0x35')]=_0x5e9619;return _0x30086c;})[_0xe7ba('0xb')](respondWithFilteredResult(_0x4e3021,_0x5a82b5))[_0xe7ba('0x36')](handleError(_0x4e3021,null));};exports[_0xe7ba('0x37')]=function(_0x35a5f3,_0x3793c6){var _0x124cc4={'raw':!![],'where':{'id':_0x35a5f3[_0xe7ba('0x38')]['id']}},_0x4e22f3={};_0x4e22f3[_0xe7ba('0x19')]=_[_0xe7ba('0x15')](db[_0xe7ba('0x10')][_0xe7ba('0x39')]);_0x4e22f3[_0xe7ba('0x16')]=_[_0xe7ba('0x15')](_0x35a5f3[_0xe7ba('0x16')]);_0x4e22f3[_0xe7ba('0x17')]=_['intersection'](_0x4e22f3[_0xe7ba('0x19')],_0x4e22f3[_0xe7ba('0x16')]);_0x124cc4['attributes']=_['intersection'](_0x4e22f3[_0xe7ba('0x19')],qs[_0xe7ba('0x29')](_0x35a5f3[_0xe7ba('0x16')]['fields']));_0x124cc4[_0xe7ba('0x28')]=_0x124cc4[_0xe7ba('0x28')][_0xe7ba('0x3a')]?_0x124cc4[_0xe7ba('0x28')]:_0x4e22f3[_0xe7ba('0x19')];if(_0x35a5f3['query'][_0xe7ba('0x3b')]){_0x124cc4['include']=[{'all':!![]}];}_0x124cc4=_[_0xe7ba('0x2f')]({},_0x124cc4,_0x35a5f3[_0xe7ba('0x32')]);return db[_0xe7ba('0x10')][_0xe7ba('0x3c')](_0x124cc4)[_0xe7ba('0xb')](handleEntityNotFound(_0x3793c6,null))[_0xe7ba('0xb')](respondWithResult(_0x3793c6,null))[_0xe7ba('0x36')](handleError(_0x3793c6,null));};exports[_0xe7ba('0x3d')]=function(_0x51e6f1,_0x42f4c3){return db[_0xe7ba('0x10')][_0xe7ba('0x3d')](_0x51e6f1[_0xe7ba('0x3e')],{})[_0xe7ba('0xb')](respondWithResult(_0x42f4c3,0xc9))[_0xe7ba('0x36')](handleError(_0x42f4c3,null));};exports[_0xe7ba('0xa')]=function(_0x2c54ac,_0x45f49a){if(_0x2c54ac[_0xe7ba('0x3e')]['id']){delete _0x2c54ac['body']['id'];}return db[_0xe7ba('0x10')]['find']({'where':{'id':_0x2c54ac[_0xe7ba('0x38')]['id']}})[_0xe7ba('0xb')](handleEntityNotFound(_0x45f49a,null))[_0xe7ba('0xb')](saveUpdates(_0x2c54ac[_0xe7ba('0x3e')],null))[_0xe7ba('0xb')](respondWithResult(_0x45f49a,null))[_0xe7ba('0x36')](handleError(_0x45f49a,null));};exports['describe']=function(_0x271592,_0x1cc668){return db[_0xe7ba('0x10')][_0xe7ba('0x3f')]()[_0xe7ba('0xb')](respondWithResult(_0x1cc668,null))[_0xe7ba('0x36')](handleError(_0x1cc668,null));};exports[_0xe7ba('0x40')]=function(_0x266ace,_0x272cb9){var _0x1189bd;var _0xbe2a32=_0x266ace['params']['id'];return db[_0xe7ba('0x10')][_0xe7ba('0x3c')]({'where':{'id':_0x266ace[_0xe7ba('0x38')]['id']}})[_0xe7ba('0xb')](handleEntityNotFound(_0x272cb9,null))[_0xe7ba('0xb')](function(_0x1fd246){if(_0x1fd246){return _0x1fd246['destroy']()[_0xe7ba('0xb')](function(_0x3ee828){return _0x3ee828;});}})['then'](function(_0x330ebd){_0x1189bd=_0x330ebd;if(_0x330ebd){if(_0x330ebd[_0xe7ba('0x41')]||_0x330ebd[_0xe7ba('0x42')]){return db[_0x330ebd[_0xe7ba('0x41')]?'VoiceQueue':'Campaign'][_0xe7ba('0x3c')]({'where':{'id':_0x330ebd[_0xe7ba('0x41')]?_0x330ebd[_0xe7ba('0x41')]:_0x330ebd['CampaignId']},'attributes':['id',_0xe7ba('0x14')],'raw':!![]});}}})[_0xe7ba('0xb')](function(_0x377877){var _0x45bcbd={};if(_0x377877){_[_0xe7ba('0x2f')](_0x45bcbd,_[_0xe7ba('0x43')](_0x1189bd[_0xe7ba('0x44')],['createdAt',_0xe7ba('0x45'),'id']));_0x45bcbd[_0xe7ba('0x46')]=0x15;_0x45bcbd[_0xe7ba('0x47')]='deleted';_0x45bcbd[_0xe7ba('0x48')]=_0x377877[_0xe7ba('0x14')];_0x45bcbd['membername']=_0x266ace[_0xe7ba('0x49')][_0xe7ba('0x14')];_0x45bcbd['UserId']=_0x266ace[_0xe7ba('0x49')]['id'];_0x45bcbd['deleted']=!![];_0x45bcbd[_0xe7ba('0x4a')]=moment()[_0xe7ba('0x4b')](_0xe7ba('0x4c'));_0x45bcbd['calleridnum']=_0x1189bd[_0xe7ba('0x4d')];_0x45bcbd[_0xe7ba('0x4e')]=_0x1189bd[_0xe7ba('0x41')]?_0xe7ba('0x4f'):_0xe7ba('0x50');return db['CmContact'][_0xe7ba('0x3c')]({'where':{'id':_0x45bcbd[_0xe7ba('0x51')]},'attributes':[_0xe7ba('0x52'),_0xe7ba('0x53')]})[_0xe7ba('0xb')](function(_0x50aecc){if(!_[_0xe7ba('0x54')](_0x272cb9)&&!_[_0xe7ba('0x54')](_0x50aecc[_0xe7ba('0x52')])){_0x45bcbd[_0xe7ba('0x55')]=_0x50aecc['firstName'];if(!_[_0xe7ba('0x54')](_0x50aecc[_0xe7ba('0x53')])){_0x45bcbd[_0xe7ba('0x55')]+='\x20'+_0x50aecc[_0xe7ba('0x53')];}}})[_0xe7ba('0x56')](function(){return db[_0xe7ba('0x57')]['create'](_0x45bcbd);});}})[_0xe7ba('0xb')](function(_0x103762){return db[_0xe7ba('0x58')]['destroy']({'where':{'CmHopperId':_0xbe2a32}});})[_0xe7ba('0xb')](function(){return _0x272cb9[_0xe7ba('0x3')](0xcc)[_0xe7ba('0x59')]();})[_0xe7ba('0x36')](handleError(_0x272cb9,null));};exports[_0xe7ba('0x5a')]=function(_0x162d7f,_0x3a7bfb){var _0x3351d5=[];return db[_0xe7ba('0x5b')][_0xe7ba('0x3f')]()[_0xe7ba('0xb')](function(_0x27422d){_0x3351d5=_['keys'](_0x27422d);return _0x162d7f[_0xe7ba('0x49')][_0xe7ba('0x5c')]({'where':{'type':_0xe7ba('0x5d'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xe7ba('0x5e'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xe7ba('0xb')](function(_0x194dff){if(_0x194dff&&_0x194dff[_0xe7ba('0x3a')]){return db['sequelize']['transaction'](function(_0x46d06e){var _0x2812af={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe7ba('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe7ba('0xf')](_0x194dff,'id')},'$or':[{'UserId':null},{'UserId':_0x162d7f[_0xe7ba('0x49')]['id']}]};var _0x3fe82a={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x194dff)[_0xe7ba('0x2e')]([_0xe7ba('0x5f'),0x0])['map']('id')[_0xe7ba('0x60')]()},'$or':[{'UserId':null},{'UserId':_0x162d7f[_0xe7ba('0x49')]['id']}]};var _0x70ce9c={'$or':[_0x2812af,_0x3fe82a]};var _0x50cc8b=[];if(_0x162d7f[_0xe7ba('0x3e')][_0xe7ba('0x61')]&&_0x162d7f[_0xe7ba('0x3e')][_0xe7ba('0x61')]===_0xe7ba('0x62')){if(!_[_0xe7ba('0x63')](_0x162d7f[_0xe7ba('0x3e')][_0xe7ba('0x64')])){_0x70ce9c['id']={'$in':_0x162d7f[_0xe7ba('0x3e')][_0xe7ba('0x64')]};}_0x50cc8b=[['priority',_0xe7ba('0x65')],[_0xe7ba('0x66'),_0x194dff[0x0][_0xe7ba('0x5e')]===_0xe7ba('0x65')?'DESC':'ASC'],db[_0xe7ba('0x67')][_0xe7ba('0x68')](_0xe7ba('0x69')),['id','DESC']];}else{if(!_['isEmpty'](_0x162d7f['body'][_0xe7ba('0x64')])){_0x70ce9c['id']={'$notIn':_0x162d7f[_0xe7ba('0x3e')]['hopperIds']};}_0x50cc8b=[[_0xe7ba('0x6a'),'DESC'],[_0xe7ba('0x66'),_0x194dff[0x0]['dialOrderByScheduledAt']],db[_0xe7ba('0x67')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xe7ba('0x65')]];}return db[_0xe7ba('0x10')][_0xe7ba('0x6b')]({'attributes':['id',_0xe7ba('0x6c'),_0xe7ba('0x4d'),_0xe7ba('0x6d')],'where':_0x70ce9c,'order':_0x50cc8b,'transaction':_0x46d06e,'lock':_0x46d06e['LOCK']['UPDATE'],'include':[{'model':db[_0xe7ba('0x5b')],'as':_0xe7ba('0x6e'),'attributes':_0x3351d5,'include':[{'model':db[_0xe7ba('0x6f')],'as':_0xe7ba('0x70'),'attributes':['id',_0xe7ba('0x14')]}]},{'model':db[_0xe7ba('0x71')],'as':_0xe7ba('0x72'),'attributes':['id',_0xe7ba('0x14')]},{'model':db[_0xe7ba('0x73')],'as':_0xe7ba('0x74'),'attributes':['id',_0xe7ba('0x14'),_0xe7ba('0x75')]}]})[_0xe7ba('0xb')](function(_0x2e31df){if(_0x2e31df){return _0x2e31df[_0xe7ba('0xa')]({'UserId':_0x162d7f['user']['id']},{'transaction':_0x46d06e});}});});}})[_0xe7ba('0xb')](handleEntityNotFound(_0x3a7bfb,null))[_0xe7ba('0xb')](respondWithResult(_0x3a7bfb,null))[_0xe7ba('0x36')](handleError(_0x3a7bfb,null));};exports[_0xe7ba('0x76')]=function(_0x1f149c,_0x3ff0e6,_0x2471c8){var _0x11ca03=[];var _0x2044db=_0x1f149c[_0xe7ba('0x38')]['id'];var _0x418831=_0x1f149c[_0xe7ba('0x49')]['id'];return db['CmContact'][_0xe7ba('0x3f')]()['then'](function(_0x27a939){_0x11ca03=_[_0xe7ba('0x15')](_0x27a939);return db[_0xe7ba('0x67')]['transaction'](function(_0x156b66){const _0x40eb35={'id':_0x2044db};return db[_0xe7ba('0x10')][_0xe7ba('0x6b')]({'attributes':['id','scheduledat',_0xe7ba('0x6d')],'where':_0x40eb35,'transaction':_0x156b66,'lock':_0x156b66[_0xe7ba('0x77')][_0xe7ba('0x78')],'include':[{'model':db[_0xe7ba('0x5b')],'as':'Contact','attributes':_0x11ca03,'include':[{'model':db[_0xe7ba('0x6f')],'as':_0xe7ba('0x70'),'attributes':['id',_0xe7ba('0x14')]}]},{'model':db[_0xe7ba('0x71')],'as':_0xe7ba('0x72'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xe7ba('0x14'),_0xe7ba('0x75')]}]})[_0xe7ba('0xb')](function(_0x27e7a5){if(_0x27e7a5){return _0x27e7a5[_0xe7ba('0xa')]({'UserId':_0x418831},{'transaction':_0x156b66});}});});})[_0xe7ba('0xb')](handleEntityNotFound(_0x3ff0e6,null))['then'](respondWithResult(_0x3ff0e6,null))[_0xe7ba('0x36')](handleError(_0x3ff0e6,null));};exports['getOpenContacts']=function(_0x439c96,_0x2e3e28){return _0x439c96[_0xe7ba('0x49')][_0xe7ba('0x5c')]({'where':{'type':_0xe7ba('0x5d'),'dialActive':!![],'dialMethod':_0xe7ba('0x79')},'attributes':['id'],'raw':!![]})['then'](function(_0x44563b){if(_0x44563b&&_0x44563b[_0xe7ba('0x3a')]){return db[_0xe7ba('0x10')][_0xe7ba('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe7ba('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe7ba('0xf')](_0x44563b,'id')},'$or':[{'UserId':null},{'UserId':_0x439c96['user']['id']}]}});}return 0x0;})[_0xe7ba('0xb')](function(_0x157686){if(!_[_0xe7ba('0x54')](_0x157686)&&_[_0xe7ba('0x7a')](_0x157686)){return _0x2e3e28[_0xe7ba('0x3')](0xc8)[_0xe7ba('0x4')]({'contacts':_0x157686});}else{logger[_0xe7ba('0xd')](_0xe7ba('0x7b'),_0xe7ba('0x7c'),0x194,_0xe7ba('0x7d'));_0x2e3e28[_0xe7ba('0xc')](0x194);}})[_0xe7ba('0x36')](handleError(_0x2e3e28,null));};exports[_0xe7ba('0x7e')]=function(_0x167996,_0x3129e5){var _0x27eb0e=shared[_0xe7ba('0x7f')];var _0x158615=[];_[_0xe7ba('0xf')](_0x27eb0e,function(_0x1b39b7){_0x158615[_0xe7ba('0x80')]({'id':_0x1b39b7[_0xe7ba('0x14')],'name':_0x1b39b7[_0xe7ba('0x14')],'utcOffset':_0x1b39b7[_0xe7ba('0x81')]});});return _0x3129e5[_0xe7ba('0x3')](0xc8)['json']({'tz':_0x158615});};exports['getTimezone']=function(_0x5889b9,_0xaccf6e){var _0x2ecfac=shared['timezones'];var _0x5ad36f={};if(!_[_0xe7ba('0x54')](_0x2ecfac[_0x5889b9[_0xe7ba('0x3e')]['id']]))_0x5ad36f=_0x2ecfac[_0x5889b9['body']['id']];return _0xaccf6e[_0xe7ba('0x3')](0xc8)['json'](_0x5ad36f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 977ed9e..9dce861 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmHopper.attributes','exports'];(function(_0x10445d,_0x416fc6){var _0x178880=function(_0x36b757){while(--_0x36b757){_0x10445d['push'](_0x10445d['shift']());}};_0x178880(++_0x416fc6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xac4a('0xc'),'fields':[_0xac4a('0xc')]},{'name':_0xac4a('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['util','../../config/logger','api','path','rimraf','./cmHopper.attributes','exports','CmHopper','scheduledat','priority','lodash'];(function(_0x30fa5d,_0x517548){var _0x416307=function(_0x23a932){while(--_0x23a932){_0x30fa5d['push'](_0x30fa5d['shift']());}};_0x416307(++_0x517548);}(_0xd8fb,0x99));var _0xbd8f=function(_0x530586,_0x819012){_0x530586=_0x530586-0x0;var _0x53df94=_0xd8fb[_0x530586];return _0x53df94;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]},{'name':'phone','fields':['phone']},{'name':_0xbd8f('0xa'),'fields':[_0xbd8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index f0ce9f5..00cfbf0 100644 --- a/server/api/cmHopper/cmHopper.rpc.js +++ b/server/api/cmHopper/cmHopper.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1633=['push','includes','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','describe','UPDATE','all','Contact','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','Agent','name','List','CmHopperHandlePreviewRecallNotifications','lodash','util','bluebird','../../mysqldb','rpc','CmHopper','options','raw','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','GetCmHopper','message','where','ShowCmHopper','CreateCmHopper','create','update','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','transaction','findAll','order','LOCK','keys','voicePause','UserId'];(function(_0xedba63,_0x319cd4){var _0x84c5ce=function(_0x65607b){while(--_0x65607b){_0xedba63['push'](_0xedba63['shift']());}};_0x84c5ce(++_0x319cd4);}(_0x1633,0x154));var _0x3163=function(_0x46c3d7,_0x45bf58){_0x46c3d7=_0x46c3d7-0x0;var _0x121592=_0x1633[_0x46c3d7];return _0x121592;};'use strict';var _=require(_0x3163('0x0'));var util=require(_0x3163('0x1'));var moment=require('moment');var BPromise=require(_0x3163('0x2'));var db=require(_0x3163('0x3'))['db'];var logger=require('../../config/logger')(_0x3163('0x4'));exports['GetCmHopper']=function(_0x1dbe79){var _0xfaebaa=this;return new Promise(function(_0x12cbfa,_0x47cece){return db[_0x3163('0x5')]['findAll']({'raw':_0x1dbe79[_0x3163('0x6')]?_0x1dbe79['options'][_0x3163('0x7')]===undefined?!![]:![]:!![],'where':_0x1dbe79['options']?_0x1dbe79[_0x3163('0x6')]['where']||null:null,'attributes':_0x1dbe79[_0x3163('0x6')]?_0x1dbe79[_0x3163('0x6')][_0x3163('0x8')]||null:null,'limit':_0x1dbe79['options']?_0x1dbe79['options'][_0x3163('0x9')]||null:null,'include':_0x1dbe79[_0x3163('0x6')]?_0x1dbe79[_0x3163('0x6')][_0x3163('0xa')]?_['map'](_0x1dbe79[_0x3163('0x6')][_0x3163('0xa')],function(_0x5b1b79){return{'model':db[_0x5b1b79[_0x3163('0xb')]],'as':_0x5b1b79['as'],'attributes':_0x5b1b79['attributes'],'include':_0x5b1b79[_0x3163('0xa')]?_[_0x3163('0xc')](_0x5b1b79[_0x3163('0xa')],function(_0x461ca4){return{'model':db[_0x461ca4[_0x3163('0xb')]],'as':_0x461ca4['as'],'attributes':_0x461ca4['attributes'],'include':_0x461ca4[_0x3163('0xa')]?_[_0x3163('0xc')](_0x461ca4[_0x3163('0xa')],function(_0x506113){return{'model':db[_0x506113['model']],'as':_0x506113['as'],'attributes':_0x506113['attributes']};}):[]};}):[]};}):[]:[]})[_0x3163('0xd')](function(_0x1798aa){logger[_0x3163('0xe')]('GetCmHopper',_0x1dbe79);logger[_0x3163('0xf')]('GetCmHopper',_0x1dbe79,JSON[_0x3163('0x10')](_0x1798aa));_0x12cbfa(_0x1798aa);})[_0x3163('0x11')](function(_0x4cfc0c){logger[_0x3163('0x12')](_0x3163('0x13'),_0x4cfc0c[_0x3163('0x14')],_0x1dbe79);_0x47cece(_0xfaebaa[_0x3163('0x12')](0x1f4,_0x4cfc0c[_0x3163('0x14')]));});});};exports['ShowCmHopper']=function(_0x365ee5){var _0x5adcf6=this;return new Promise(function(_0x29e6bd,_0x5b3f73){return db[_0x3163('0x5')]['find']({'raw':_0x365ee5[_0x3163('0x6')]?_0x365ee5[_0x3163('0x6')][_0x3163('0x7')]===undefined?!![]:![]:!![],'where':_0x365ee5[_0x3163('0x6')]?_0x365ee5[_0x3163('0x6')][_0x3163('0x15')]||null:null,'attributes':_0x365ee5[_0x3163('0x6')]?_0x365ee5[_0x3163('0x6')][_0x3163('0x8')]||null:null,'include':_0x365ee5[_0x3163('0x6')]?_0x365ee5[_0x3163('0x6')][_0x3163('0xa')]?_[_0x3163('0xc')](_0x365ee5[_0x3163('0x6')]['include'],function(_0x1c0c80){return{'model':db[_0x1c0c80[_0x3163('0xb')]],'as':_0x1c0c80['as'],'attributes':_0x1c0c80['attributes'],'include':_0x1c0c80[_0x3163('0xa')]?_[_0x3163('0xc')](_0x1c0c80[_0x3163('0xa')],function(_0x56cd71){return{'model':db[_0x56cd71[_0x3163('0xb')]],'as':_0x56cd71['as'],'attributes':_0x56cd71[_0x3163('0x8')],'include':_0x56cd71[_0x3163('0xa')]?_[_0x3163('0xc')](_0x56cd71[_0x3163('0xa')],function(_0x226cff){return{'model':db[_0x226cff[_0x3163('0xb')]],'as':_0x226cff['as'],'attributes':_0x226cff[_0x3163('0x8')]};}):[]};}):[]};}):[]:[]})[_0x3163('0xd')](function(_0x356ac8){logger[_0x3163('0xe')]('ShowCmHopper',_0x365ee5);logger[_0x3163('0xf')](_0x3163('0x16'),_0x365ee5,JSON[_0x3163('0x10')](_0x356ac8));_0x29e6bd(_0x356ac8);})[_0x3163('0x11')](function(_0x553ef2){logger[_0x3163('0x12')](_0x3163('0x16'),_0x553ef2[_0x3163('0x14')],_0x365ee5);_0x5b3f73(_0x5adcf6[_0x3163('0x12')](0x1f4,_0x553ef2['message']));});});};exports[_0x3163('0x17')]=function(_0x1b2a96){var _0x529576=this;return new Promise(function(_0x5864b4,_0x126996){return db[_0x3163('0x5')][_0x3163('0x18')](_0x1b2a96['body'],{'raw':_0x1b2a96[_0x3163('0x6')]?_0x1b2a96[_0x3163('0x6')][_0x3163('0x7')]===undefined?!![]:![]:!![]})[_0x3163('0xd')](function(_0x3e9c5b){logger[_0x3163('0xe')](_0x3163('0x17'),_0x1b2a96);logger[_0x3163('0xf')](_0x3163('0x17'),_0x1b2a96,JSON[_0x3163('0x10')](_0x3e9c5b));_0x5864b4(_0x3e9c5b);})[_0x3163('0x11')](function(_0x31c620){logger[_0x3163('0x12')](_0x3163('0x17'),_0x31c620[_0x3163('0x14')],_0x1b2a96);_0x126996(_0x529576['error'](0x1f4,_0x31c620[_0x3163('0x14')]));});});};exports['UpdateCmHopper']=function(_0x24eb1d){var _0x42f5b9=this;return new Promise(function(_0x2bb946,_0x51af4e){return db[_0x3163('0x5')][_0x3163('0x19')](_0x24eb1d[_0x3163('0x1a')],{'raw':_0x24eb1d[_0x3163('0x6')]?_0x24eb1d[_0x3163('0x6')][_0x3163('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24eb1d['options']?_0x24eb1d[_0x3163('0x6')][_0x3163('0x15')]||null:null,'attributes':_0x24eb1d['options']?_0x24eb1d['options'][_0x3163('0x8')]||null:null,'limit':_0x24eb1d[_0x3163('0x6')]?_0x24eb1d[_0x3163('0x6')][_0x3163('0x9')]||null:null})[_0x3163('0xd')](function(_0x2cacd8){logger['info'](_0x3163('0x1b'),_0x24eb1d);logger['info'](_0x3163('0x1c'),JSON[_0x3163('0x10')](_0x24eb1d[_0x3163('0x6')][_0x3163('0x15')]),_0x24eb1d[_0x3163('0x1a')][_0x3163('0x1d')]);logger['debug']('UpdateCmHopper',_0x24eb1d,JSON[_0x3163('0x10')](_0x2cacd8));_0x2bb946(_0x2cacd8);})['catch'](function(_0x271b97){logger[_0x3163('0x12')]('UpdateCmHopper',_0x271b97[_0x3163('0x14')],_0x24eb1d);_0x51af4e(_0x42f5b9[_0x3163('0x12')](0x1f4,_0x271b97['message']));});});};exports[_0x3163('0x1e')]=function(_0x32684e){var _0x4846db=this;return new Promise(function(_0x31d2d6,_0x31ad8d){return db['CmHopper']['destroy']({'where':_0x32684e['options']?_0x32684e[_0x3163('0x6')]['where']||null:null})[_0x3163('0xd')](function(_0x1d2e6f){logger[_0x3163('0xe')](_0x3163('0x1e'),_0x32684e);logger[_0x3163('0xf')]('DestroyCmHopper',_0x32684e,JSON[_0x3163('0x10')](_0x1d2e6f));_0x31d2d6(_0x1d2e6f);})[_0x3163('0x11')](function(_0x5e232c){logger[_0x3163('0x12')](_0x3163('0x1e'),_0x5e232c[_0x3163('0x14')],_0x32684e);_0x31ad8d(_0x4846db[_0x3163('0x12')](0x1f4,_0x5e232c['message']));});});};exports[_0x3163('0x1f')]=function(_0x5ecfa6){var _0x554a09=this;return new Promise(function(_0xb6407d,_0x11bd1e){return db[_0x3163('0x20')]['describe']()[_0x3163('0xd')](function(_0xad9bbc){return db['sequelize'][_0x3163('0x21')](function(_0x15d6ac){return db[_0x3163('0x5')][_0x3163('0x22')]({'where':_0x5ecfa6['options']?_0x5ecfa6[_0x3163('0x6')][_0x3163('0x15')]||null:null,'attributes':_0x5ecfa6['options']?_0x5ecfa6[_0x3163('0x6')][_0x3163('0x8')]||null:null,'limit':_0x5ecfa6[_0x3163('0x6')]?_0x5ecfa6[_0x3163('0x6')][_0x3163('0x9')]||null:null,'order':_0x5ecfa6[_0x3163('0x6')]?_0x5ecfa6[_0x3163('0x6')][_0x3163('0x23')]||null:null,'transaction':_0x15d6ac,'lock':_0x15d6ac[_0x3163('0x24')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x3163('0x25')](_0xad9bbc)},{'model':db['User'],'as':'Agent','attributes':['id','name',_0x3163('0x26')]}]})['then'](function(_0x3d739d){var _0x143dbc=[];var _0x51de46=[];for(var _0x371c39=0x0;_0x371c39<_0x3d739d['length'];_0x371c39+=0x1){var _0x1f1cb0=_0x3d739d[_0x371c39][_0x3163('0x27')];if(_0x1f1cb0===null){_0x143dbc[_0x3163('0x28')](_0x3d739d[_0x371c39][_0x3163('0x19')](_0x5ecfa6[_0x3163('0x1a')],{'transaction':_0x15d6ac}));}else if(!_0x51de46[_0x3163('0x29')](_0x1f1cb0)){_0x51de46[_0x3163('0x28')](_0x1f1cb0);_0x143dbc[_0x3163('0x28')](_0x3d739d[_0x371c39][_0x3163('0x19')](_0x5ecfa6[_0x3163('0x1a')],{'transaction':_0x15d6ac}));}}return BPromise['all'](_0x143dbc);});})['then'](function(_0x5f1c29){logger[_0x3163('0xe')](_0x3163('0x1f'),_0x5ecfa6);if(_0x5f1c29[_0x3163('0x2a')]>0x0){logger[_0x3163('0xe')](_0x3163('0x2b'),_0x5f1c29[0x0][_0x3163('0x2c')]['id'],_0x5f1c29[0x0]['dataValues']['ContactId'],_0x5f1c29[0x0][_0x3163('0x2c')][_0x3163('0x1d')]);}logger[_0x3163('0xf')](_0x3163('0x1f'),_0x5ecfa6,JSON['stringify'](_0x5f1c29));_0xb6407d(_0x5f1c29);})[_0x3163('0x11')](function(_0x3fa915){logger[_0x3163('0x12')](_0x3163('0x1f'),_0x3fa915[_0x3163('0x14')],_0x5ecfa6);_0x11bd1e(_0x554a09[_0x3163('0x12')](0x1f4,_0x3fa915['message']));});});});};exports[_0x3163('0x2d')]=function(_0x369568){var _0x2b253e=this;return new Promise(function(_0x3a2885,_0x2a5197){return db['sequelize'][_0x3163('0x21')](function(_0x11997d){return db['CmHopperFinal'][_0x3163('0x18')](_0x369568[_0x3163('0x1a')],{'raw':_0x369568[_0x3163('0x6')]?_0x369568['options'][_0x3163('0x7')]===undefined?!![]:![]:!![],'transaction':_0x11997d})[_0x3163('0xd')](function(){logger['info'](_0x3163('0x2e'),JSON['stringify'](_0x369568['options'][_0x3163('0x15')]),_0x369568['options'][_0x3163('0x15')][_0x3163('0x1d')]);return db[_0x3163('0x5')]['destroy']({'where':_0x369568[_0x3163('0x6')]?_0x369568[_0x3163('0x6')]['where']||null:null,'transaction':_0x11997d});});})[_0x3163('0xd')](function(_0x5463fe){logger[_0x3163('0xe')]('MoveContactManagedDialer',_0x369568);logger['debug'](_0x3163('0x2d'),_0x369568,JSON[_0x3163('0x10')](_0x5463fe));_0x3a2885(_0x5463fe);})[_0x3163('0x11')](function(_0x5bd045){logger['error'](_0x3163('0x2d'),_0x5bd045[_0x3163('0x14')],_0x369568);_0x2a5197(_0x2b253e['error'](0x1f4,_0x5bd045['message']));});});};exports['CountReScheduled']=function(_0x36bb38){var _0x5cdda2=this;return new Promise(function(_0x4abf95,_0x24a579){return db['CmHopper'][_0x3163('0x22')]({'raw':_0x36bb38[_0x3163('0x6')]?_0x36bb38[_0x3163('0x6')][_0x3163('0x7')]===undefined?!![]:![]:!![],'where':_0x36bb38[_0x3163('0x6')]?_0x36bb38[_0x3163('0x6')][_0x3163('0x15')]||null:null,'attributes':[[db[_0x3163('0x2f')]['fn'](_0x3163('0x30'),db['sequelize']['fn']('IF',db[_0x3163('0x2f')][_0x3163('0x31')](_0x3163('0x32')+util[_0x3163('0x33')](_0x3163('0x34'),moment()[_0x3163('0x33')](_0x3163('0x35')))+'\x20,\x201,\x20null'))),_0x3163('0x36')]]})[_0x3163('0xd')](function(_0x4cddb3){logger[_0x3163('0xe')]('CountReScheduled',_0x36bb38);logger[_0x3163('0xf')](_0x3163('0x37'),_0x36bb38,JSON[_0x3163('0x10')](_0x4cddb3));_0x4abf95(_0x4cddb3);})['catch'](function(_0x4f83bb){logger[_0x3163('0x12')]('CountReScheduled',_0x4f83bb[_0x3163('0x14')],_0x36bb38);_0x24a579(_0x5cdda2[_0x3163('0x12')](0x1f4,_0x4f83bb[_0x3163('0x14')]));});});};exports[_0x3163('0x38')]=function(_0xc51cff){var _0x468039=this;return new Promise(function(_0x4051a4,_0x1497b0){return db['CmContact'][_0x3163('0x39')]()['then'](function(){return db['sequelize'][_0x3163('0x21')](function(_0x49da03){return db[_0x3163('0x5')][_0x3163('0x22')]({'where':_0xc51cff[_0x3163('0x6')]?_0xc51cff['options']['where']||null:null,'attributes':_0xc51cff['options']?_0xc51cff['options']['attributes']||null:null,'limit':0x1,'order':_0xc51cff[_0x3163('0x6')]?_0xc51cff['options'][_0x3163('0x23')]||null:null,'group':db[_0x3163('0x5')][_0x3163('0x27')],'transaction':_0x49da03,'lock':_0x49da03['LOCK'][_0x3163('0x3a')],'include':_0xc51cff[_0x3163('0x6')]?_0xc51cff[_0x3163('0x6')]['include']?_['map'](_0xc51cff['options'][_0x3163('0xa')],function(_0x6c2402){return{'model':db[_0x6c2402[_0x3163('0xb')]],'as':_0x6c2402['as'],'attributes':_0x6c2402[_0x3163('0x8')],'include':_0x6c2402[_0x3163('0xa')]?_['map'](_0x6c2402[_0x3163('0xa')],function(_0x48dab0){return{'model':db[_0x48dab0[_0x3163('0xb')]],'as':_0x48dab0['as'],'attributes':_0x48dab0['attributes'],'include':_0x48dab0[_0x3163('0xa')]?_[_0x3163('0xc')](_0x48dab0[_0x3163('0xa')],function(_0x1483d9){return{'model':db[_0x1483d9[_0x3163('0xb')]],'as':_0x1483d9['as'],'attributes':_0x1483d9[_0x3163('0x8')]};}):[]};}):[]};}):[]:[]})[_0x3163('0xd')](function(_0x559981){var _0x480f35=[];for(var _0x1ab91c=0x0;_0x1ab91c<_0x559981[_0x3163('0x2a')];_0x1ab91c+=0x1){_0x480f35['push'](_0x559981[_0x1ab91c][_0x3163('0x19')](_0xc51cff[_0x3163('0x1a')],{'transaction':_0x49da03}));}return BPromise[_0x3163('0x3b')](_0x480f35);});})[_0x3163('0xd')](function(_0x1fc134){logger[_0x3163('0xe')](_0x3163('0x38'),_0xc51cff);logger[_0x3163('0xf')](_0x3163('0x38'),_0xc51cff,JSON[_0x3163('0x10')](_0x1fc134));_0x4051a4(_0x1fc134);})[_0x3163('0x11')](function(_0x521fa3){logger[_0x3163('0x12')](_0x3163('0x38'),_0x521fa3['message'],_0xc51cff);_0x1497b0(_0x468039[_0x3163('0x12')](0x1f4,_0x521fa3['message']));});});});};exports['GetCmHopperPreview']=function(_0x44f6af){var _0x13fa73=this;return new Promise(function(_0x440f08,_0x4b3e54){db['CmContact'][_0x3163('0x39')]()[_0x3163('0xd')](function(_0x522443){return db[_0x3163('0x5')][_0x3163('0x22')]({'raw':_0x44f6af['options']?_0x44f6af['options'][_0x3163('0x7')]===undefined?!![]:![]:!![],'where':_0x44f6af[_0x3163('0x6')]?_0x44f6af[_0x3163('0x6')][_0x3163('0x15')]||null:null,'attributes':_0x44f6af[_0x3163('0x6')]?_0x44f6af['options'][_0x3163('0x8')]||null:null,'limit':_0x44f6af['options']?_0x44f6af[_0x3163('0x6')]['limit']||null:null,'include':_0x44f6af['options']?_0x44f6af[_0x3163('0x6')][_0x3163('0xa')]?_[_0x3163('0xc')](_0x44f6af[_0x3163('0x6')]['include'],function(_0x2b6a49){return{'model':db[_0x2b6a49[_0x3163('0xb')]],'as':_0x2b6a49['as'],'attributes':_0x2b6a49['as']===_0x3163('0x3c')?_[_0x3163('0x25')](_0x522443):_0x2b6a49[_0x3163('0x8')],'include':_0x2b6a49[_0x3163('0xa')]?_['map'](_0x2b6a49[_0x3163('0xa')],function(_0x1ca362){return{'model':db[_0x1ca362[_0x3163('0xb')]],'as':_0x1ca362['as'],'attributes':_0x1ca362[_0x3163('0x8')],'include':_0x1ca362[_0x3163('0xa')]?_[_0x3163('0xc')](_0x1ca362['include'],function(_0x1982e9){return{'model':db[_0x1982e9[_0x3163('0xb')]],'as':_0x1982e9['as'],'attributes':_0x1982e9[_0x3163('0x8')]};}):[]};}):[]};}):[]:[]})[_0x3163('0xd')](function(_0x5b7b85){logger[_0x3163('0xe')](_0x3163('0x13'),_0x44f6af);logger['debug']('GetCmHopper',_0x44f6af,JSON[_0x3163('0x10')](_0x5b7b85));_0x440f08(_0x5b7b85);})[_0x3163('0x11')](function(_0x38ca76){logger['error'](_0x3163('0x13'),_0x38ca76[_0x3163('0x14')],_0x44f6af);_0x4b3e54(_0x13fa73['error'](0x1f4,_0x38ca76[_0x3163('0x14')]));});});});};exports[_0x3163('0x3d')]=function(_0x346da5){var _0x221c28=this;return new Promise(function(_0x424411,_0x4ceac6){return db[_0x3163('0x20')][_0x3163('0x3e')]({'raw':!![],'where':{'phone':_0x346da5['options']['where'][_0x3163('0x3f')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x3163('0xd')](function(_0x782faa){logger[_0x3163('0xe')](_0x3163('0x40'),_0x346da5);logger[_0x3163('0xf')](_0x3163('0x40'),_0x346da5,JSON['stringify'](_0x782faa));_0x424411(_0x782faa);})['catch'](function(_0x359b4d){logger[_0x3163('0x12')](_0x3163('0x40'),_0x359b4d[_0x3163('0x14')],_0x346da5);_0x4ceac6(_0x221c28['error'](0x1f4,_0x359b4d[_0x3163('0x14')]));});});};exports['ResetActiveCalls']=function(_0x3cc6b7){var _0x41a8cb=this;return new Promise(function(_0x595164,_0x1e7934){return db[_0x3163('0x2f')][_0x3163('0x21')](function(_0x177129){var _0x40432a=_0x3cc6b7['options']&&_0x3cc6b7[_0x3163('0x6')][_0x3163('0x15')]?_0x3cc6b7[_0x3163('0x6')][_0x3163('0x15')]:{};return db[_0x3163('0x5')][_0x3163('0x19')](_0x3cc6b7[_0x3163('0x1a')],{'where':_0x40432a,'transaction':_0x177129})[_0x3163('0xd')](function(_0x338392){logger[_0x3163('0xe')](_0x3163('0x41'),_0x3cc6b7);logger[_0x3163('0xf')](_0x3163('0x41'),_0x3cc6b7,JSON[_0x3163('0x10')](_0x338392));_0x595164(_0x338392);})[_0x3163('0x11')](function(_0xbdaba3){logger[_0x3163('0x12')](_0x3163('0x41'),_0xbdaba3['message'],_0x3cc6b7);_0x1e7934(_0x41a8cb[_0x3163('0x12')](0x1f4,_0xbdaba3['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x2102a5){var _0x206014=this;var _0xd85a64=_0x2102a5[_0x3163('0x1a')][_0x3163('0x15')]['voiceQueueIds'];var _0x240958=_0x2102a5[_0x3163('0x1a')][_0x3163('0x15')][_0x3163('0x42')];var _0x11011e=_0x2102a5[_0x3163('0x1a')][_0x3163('0x15')][_0x3163('0x43')];return new Promise(function(_0x570b51,_0xd037d8){return db[_0x3163('0x5')][_0x3163('0x22')]({'where':{'voiceQueueId':{'$in':_0xd85a64},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3163('0x2f')]['literal'](_0x3163('0x44')+_0x240958+_0x3163('0x45')),'$gt':db[_0x3163('0x2f')][_0x3163('0x31')](_0x3163('0x46'))}},'UserId':{'$in':_0x11011e}},'include':[{'model':db[_0x3163('0x20')],'as':_0x3163('0x3c')},{'model':db[_0x3163('0x47')],'as':_0x3163('0x48'),'attributes':['id',_0x3163('0x49'),_0x3163('0x26')]},{'model':db['CmList'],'as':_0x3163('0x4a')}]})[_0x3163('0xd')](function(_0x5d7d92){if(_0x5d7d92['length']>0x0){return db[_0x3163('0x2f')][_0x3163('0x21')](function(_0x1c5dab){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0x3163('0x2f')][_0x3163('0x31')](_0x3163('0x46'))},{'where':{'id':{'$in':_[_0x3163('0xc')](_0x5d7d92,'id')}},'transaction':_0x1c5dab})[_0x3163('0xd')](function(){_0x570b51(_0x5d7d92);})['catch'](function(_0x5887e1){logger[_0x3163('0x12')](_0x3163('0x4b'),_0x5887e1[_0x3163('0x14')],_0x2102a5);_0xd037d8(_0x206014[_0x3163('0x12')](0x1f4,_0x5887e1[_0x3163('0x14')]));});})[_0x3163('0x11')](function(_0x489bae){logger[_0x3163('0x12')](_0x3163('0x4b'),_0x489bae['message'],_0x2102a5);_0xd037d8(_0x206014[_0x3163('0x12')](0x1f4,_0x489bae['message']));});}else{_0x570b51(_0x5d7d92);}});});}; \ No newline at end of file +var _0x596e=['where','limit','include','map','model','attributes','info','GetCmHopper','debug','stringify','error','message','ShowCmHopper','then','catch','CreateCmHopper','create','UpdateCmHopper','update','body','DestroyCmHopper','CmContact','describe','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','includes','push','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','transaction','LOCK','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','CmHopperHandlePreviewRecallNotifications','util','bluebird','rpc','CmHopper','findAll','options','raw'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x596e,0xe3));var _0xe596=function(_0x29101b,_0x346451){_0x29101b=_0x29101b-0x0;var _0x519a3d=_0x596e[_0x29101b];return _0x519a3d;};'use strict';var _=require('lodash');var util=require(_0xe596('0x0'));var moment=require('moment');var BPromise=require(_0xe596('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xe596('0x2'));exports['GetCmHopper']=function(_0x5da0d0){var _0x3c59ff=this;return new Promise(function(_0x143b77,_0x4d4de8){return db[_0xe596('0x3')][_0xe596('0x4')]({'raw':_0x5da0d0[_0xe596('0x5')]?_0x5da0d0['options'][_0xe596('0x6')]===undefined?!![]:![]:!![],'where':_0x5da0d0[_0xe596('0x5')]?_0x5da0d0['options'][_0xe596('0x7')]||null:null,'attributes':_0x5da0d0['options']?_0x5da0d0[_0xe596('0x5')]['attributes']||null:null,'limit':_0x5da0d0[_0xe596('0x5')]?_0x5da0d0[_0xe596('0x5')][_0xe596('0x8')]||null:null,'include':_0x5da0d0[_0xe596('0x5')]?_0x5da0d0[_0xe596('0x5')][_0xe596('0x9')]?_[_0xe596('0xa')](_0x5da0d0[_0xe596('0x5')][_0xe596('0x9')],function(_0x312021){return{'model':db[_0x312021[_0xe596('0xb')]],'as':_0x312021['as'],'attributes':_0x312021[_0xe596('0xc')],'include':_0x312021[_0xe596('0x9')]?_['map'](_0x312021[_0xe596('0x9')],function(_0x3f51c5){return{'model':db[_0x3f51c5[_0xe596('0xb')]],'as':_0x3f51c5['as'],'attributes':_0x3f51c5['attributes'],'include':_0x3f51c5[_0xe596('0x9')]?_[_0xe596('0xa')](_0x3f51c5[_0xe596('0x9')],function(_0x53cd01){return{'model':db[_0x53cd01[_0xe596('0xb')]],'as':_0x53cd01['as'],'attributes':_0x53cd01[_0xe596('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ec166){logger[_0xe596('0xd')](_0xe596('0xe'),_0x5da0d0);logger[_0xe596('0xf')](_0xe596('0xe'),_0x5da0d0,JSON[_0xe596('0x10')](_0x2ec166));_0x143b77(_0x2ec166);})['catch'](function(_0x332122){logger[_0xe596('0x11')](_0xe596('0xe'),_0x332122[_0xe596('0x12')],_0x5da0d0);_0x4d4de8(_0x3c59ff[_0xe596('0x11')](0x1f4,_0x332122['message']));});});};exports[_0xe596('0x13')]=function(_0x373c){var _0x5a48d7=this;return new Promise(function(_0x2a807b,_0x2eea22){return db['CmHopper']['find']({'raw':_0x373c[_0xe596('0x5')]?_0x373c[_0xe596('0x5')][_0xe596('0x6')]===undefined?!![]:![]:!![],'where':_0x373c[_0xe596('0x5')]?_0x373c[_0xe596('0x5')][_0xe596('0x7')]||null:null,'attributes':_0x373c[_0xe596('0x5')]?_0x373c[_0xe596('0x5')]['attributes']||null:null,'include':_0x373c['options']?_0x373c[_0xe596('0x5')][_0xe596('0x9')]?_[_0xe596('0xa')](_0x373c[_0xe596('0x5')][_0xe596('0x9')],function(_0x33c79e){return{'model':db[_0x33c79e[_0xe596('0xb')]],'as':_0x33c79e['as'],'attributes':_0x33c79e[_0xe596('0xc')],'include':_0x33c79e['include']?_[_0xe596('0xa')](_0x33c79e[_0xe596('0x9')],function(_0x4f227d){return{'model':db[_0x4f227d[_0xe596('0xb')]],'as':_0x4f227d['as'],'attributes':_0x4f227d[_0xe596('0xc')],'include':_0x4f227d[_0xe596('0x9')]?_[_0xe596('0xa')](_0x4f227d['include'],function(_0x38b12f){return{'model':db[_0x38b12f[_0xe596('0xb')]],'as':_0x38b12f['as'],'attributes':_0x38b12f[_0xe596('0xc')]};}):[]};}):[]};}):[]:[]})[_0xe596('0x14')](function(_0x7beb42){logger['info'](_0xe596('0x13'),_0x373c);logger[_0xe596('0xf')](_0xe596('0x13'),_0x373c,JSON[_0xe596('0x10')](_0x7beb42));_0x2a807b(_0x7beb42);})[_0xe596('0x15')](function(_0x28d876){logger['error']('ShowCmHopper',_0x28d876[_0xe596('0x12')],_0x373c);_0x2eea22(_0x5a48d7['error'](0x1f4,_0x28d876[_0xe596('0x12')]));});});};exports[_0xe596('0x16')]=function(_0x5d32e9){var _0x1bdea4=this;return new Promise(function(_0x26733c,_0x407d97){return db['CmHopper'][_0xe596('0x17')](_0x5d32e9['body'],{'raw':_0x5d32e9[_0xe596('0x5')]?_0x5d32e9[_0xe596('0x5')]['raw']===undefined?!![]:![]:!![]})[_0xe596('0x14')](function(_0x5df704){logger[_0xe596('0xd')](_0xe596('0x16'),_0x5d32e9);logger['debug'](_0xe596('0x16'),_0x5d32e9,JSON[_0xe596('0x10')](_0x5df704));_0x26733c(_0x5df704);})['catch'](function(_0x53082e){logger[_0xe596('0x11')](_0xe596('0x16'),_0x53082e[_0xe596('0x12')],_0x5d32e9);_0x407d97(_0x1bdea4[_0xe596('0x11')](0x1f4,_0x53082e['message']));});});};exports[_0xe596('0x18')]=function(_0x5724a5){var _0x28aed3=this;return new Promise(function(_0x19ec60,_0x546422){return db['CmHopper'][_0xe596('0x19')](_0x5724a5[_0xe596('0x1a')],{'raw':_0x5724a5['options']?_0x5724a5['options'][_0xe596('0x6')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5724a5[_0xe596('0x5')]?_0x5724a5[_0xe596('0x5')][_0xe596('0x7')]||null:null,'attributes':_0x5724a5[_0xe596('0x5')]?_0x5724a5['options'][_0xe596('0xc')]||null:null,'limit':_0x5724a5[_0xe596('0x5')]?_0x5724a5[_0xe596('0x5')][_0xe596('0x8')]||null:null})[_0xe596('0x14')](function(_0x154a4d){logger[_0xe596('0xd')](_0xe596('0x18'),_0x5724a5);logger[_0xe596('0xd')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xe596('0x10')](_0x5724a5['options'][_0xe596('0x7')]),_0x5724a5['body']['active']);logger[_0xe596('0xf')]('UpdateCmHopper',_0x5724a5,JSON[_0xe596('0x10')](_0x154a4d));_0x19ec60(_0x154a4d);})['catch'](function(_0x2f6b50){logger[_0xe596('0x11')]('UpdateCmHopper',_0x2f6b50[_0xe596('0x12')],_0x5724a5);_0x546422(_0x28aed3['error'](0x1f4,_0x2f6b50[_0xe596('0x12')]));});});};exports[_0xe596('0x1b')]=function(_0x332d3a){var _0x176076=this;return new Promise(function(_0xe0468,_0x22a405){return db[_0xe596('0x3')]['destroy']({'where':_0x332d3a[_0xe596('0x5')]?_0x332d3a['options'][_0xe596('0x7')]||null:null})[_0xe596('0x14')](function(_0x21783e){logger[_0xe596('0xd')](_0xe596('0x1b'),_0x332d3a);logger[_0xe596('0xf')]('DestroyCmHopper',_0x332d3a,JSON[_0xe596('0x10')](_0x21783e));_0xe0468(_0x21783e);})[_0xe596('0x15')](function(_0x792704){logger['error']('DestroyCmHopper',_0x792704['message'],_0x332d3a);_0x22a405(_0x176076[_0xe596('0x11')](0x1f4,_0x792704[_0xe596('0x12')]));});});};exports['GetContactDialer']=function(_0x86941){var _0x4a13c0=this;return new Promise(function(_0x466f23,_0x1b5db3){return db[_0xe596('0x1c')][_0xe596('0x1d')]()[_0xe596('0x14')](function(_0x1202d1){return db['sequelize']['transaction'](function(_0x2eab01){return db[_0xe596('0x3')][_0xe596('0x4')]({'where':_0x86941[_0xe596('0x5')]?_0x86941[_0xe596('0x5')]['where']||null:null,'attributes':_0x86941[_0xe596('0x5')]?_0x86941['options'][_0xe596('0xc')]||null:null,'limit':_0x86941[_0xe596('0x5')]?_0x86941[_0xe596('0x5')][_0xe596('0x8')]||null:null,'order':_0x86941[_0xe596('0x5')]?_0x86941[_0xe596('0x5')]['order']||null:null,'transaction':_0x2eab01,'lock':_0x2eab01['LOCK'][_0xe596('0x1e')],'include':[{'model':db[_0xe596('0x1c')],'as':_0xe596('0x1f'),'attributes':_[_0xe596('0x20')](_0x1202d1)},{'model':db[_0xe596('0x21')],'as':_0xe596('0x22'),'attributes':['id',_0xe596('0x23'),_0xe596('0x24')]}]})['then'](function(_0x29cff3){var _0x273c04=[];var _0x495dd0=[];for(var _0x54336b=0x0;_0x54336b<_0x29cff3[_0xe596('0x25')];_0x54336b+=0x1){var _0x53de6b=_0x29cff3[_0x54336b][_0xe596('0x26')];if(_0x53de6b===null){_0x273c04['push'](_0x29cff3[_0x54336b]['update'](_0x86941[_0xe596('0x1a')],{'transaction':_0x2eab01}));}else if(!_0x495dd0[_0xe596('0x27')](_0x53de6b)){_0x495dd0[_0xe596('0x28')](_0x53de6b);_0x273c04[_0xe596('0x28')](_0x29cff3[_0x54336b][_0xe596('0x19')](_0x86941[_0xe596('0x1a')],{'transaction':_0x2eab01}));}}return BPromise[_0xe596('0x29')](_0x273c04);});})[_0xe596('0x14')](function(_0x160cb0){logger[_0xe596('0xd')](_0xe596('0x2a'),_0x86941);if(_0x160cb0[_0xe596('0x25')]>0x0){logger[_0xe596('0xd')](_0xe596('0x2b'),_0x160cb0[0x0]['dataValues']['id'],_0x160cb0[0x0][_0xe596('0x2c')]['ContactId'],_0x160cb0[0x0][_0xe596('0x2c')][_0xe596('0x2d')]);}logger[_0xe596('0xf')](_0xe596('0x2a'),_0x86941,JSON['stringify'](_0x160cb0));_0x466f23(_0x160cb0);})[_0xe596('0x15')](function(_0x291a1c){logger[_0xe596('0x11')](_0xe596('0x2a'),_0x291a1c['message'],_0x86941);_0x1b5db3(_0x4a13c0[_0xe596('0x11')](0x1f4,_0x291a1c[_0xe596('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x415b1f){var _0x194731=this;return new Promise(function(_0x64aa80,_0x202709){return db[_0xe596('0x2e')]['transaction'](function(_0x38ae94){return db[_0xe596('0x2f')][_0xe596('0x17')](_0x415b1f[_0xe596('0x1a')],{'raw':_0x415b1f[_0xe596('0x5')]?_0x415b1f[_0xe596('0x5')][_0xe596('0x6')]===undefined?!![]:![]:!![],'transaction':_0x38ae94})[_0xe596('0x14')](function(){logger['info'](_0xe596('0x30'),JSON[_0xe596('0x10')](_0x415b1f[_0xe596('0x5')][_0xe596('0x7')]),_0x415b1f[_0xe596('0x5')]['where'][_0xe596('0x2d')]);return db[_0xe596('0x3')][_0xe596('0x31')]({'where':_0x415b1f['options']?_0x415b1f[_0xe596('0x5')][_0xe596('0x7')]||null:null,'transaction':_0x38ae94});});})['then'](function(_0x3b762e){logger[_0xe596('0xd')](_0xe596('0x32'),_0x415b1f);logger[_0xe596('0xf')](_0xe596('0x32'),_0x415b1f,JSON[_0xe596('0x10')](_0x3b762e));_0x64aa80(_0x3b762e);})[_0xe596('0x15')](function(_0x20452a){logger[_0xe596('0x11')](_0xe596('0x32'),_0x20452a[_0xe596('0x12')],_0x415b1f);_0x202709(_0x194731['error'](0x1f4,_0x20452a['message']));});});};exports[_0xe596('0x33')]=function(_0x517ded){var _0x5a8eb3=this;return new Promise(function(_0x37be7d,_0x33f1c2){return db['CmHopper'][_0xe596('0x4')]({'raw':_0x517ded[_0xe596('0x5')]?_0x517ded['options'][_0xe596('0x6')]===undefined?!![]:![]:!![],'where':_0x517ded[_0xe596('0x5')]?_0x517ded[_0xe596('0x5')][_0xe596('0x7')]||null:null,'attributes':[[db[_0xe596('0x2e')]['fn'](_0xe596('0x34'),db[_0xe596('0x2e')]['fn']('IF',db[_0xe596('0x2e')]['literal'](_0xe596('0x35')+util[_0xe596('0x36')](_0xe596('0x37'),moment()['format'](_0xe596('0x38')))+_0xe596('0x39')))),_0xe596('0x3a')]]})[_0xe596('0x14')](function(_0x17131b){logger['info'](_0xe596('0x33'),_0x517ded);logger[_0xe596('0xf')](_0xe596('0x33'),_0x517ded,JSON[_0xe596('0x10')](_0x17131b));_0x37be7d(_0x17131b);})[_0xe596('0x15')](function(_0x42dd07){logger[_0xe596('0x11')](_0xe596('0x33'),_0x42dd07['message'],_0x517ded);_0x33f1c2(_0x5a8eb3[_0xe596('0x11')](0x1f4,_0x42dd07[_0xe596('0x12')]));});});};exports[_0xe596('0x3b')]=function(_0x2659ad){var _0x178a13=this;return new Promise(function(_0x58f0fe,_0x371a0e){return db[_0xe596('0x1c')][_0xe596('0x1d')]()[_0xe596('0x14')](function(){return db[_0xe596('0x2e')][_0xe596('0x3c')](function(_0x5d430d){return db[_0xe596('0x3')][_0xe596('0x4')]({'where':_0x2659ad[_0xe596('0x5')]?_0x2659ad['options'][_0xe596('0x7')]||null:null,'attributes':_0x2659ad[_0xe596('0x5')]?_0x2659ad[_0xe596('0x5')]['attributes']||null:null,'limit':0x1,'order':_0x2659ad[_0xe596('0x5')]?_0x2659ad[_0xe596('0x5')]['order']||null:null,'group':db[_0xe596('0x3')]['UserId'],'transaction':_0x5d430d,'lock':_0x5d430d[_0xe596('0x3d')][_0xe596('0x1e')],'include':_0x2659ad[_0xe596('0x5')]?_0x2659ad[_0xe596('0x5')][_0xe596('0x9')]?_['map'](_0x2659ad[_0xe596('0x5')][_0xe596('0x9')],function(_0x4c9c8e){return{'model':db[_0x4c9c8e[_0xe596('0xb')]],'as':_0x4c9c8e['as'],'attributes':_0x4c9c8e[_0xe596('0xc')],'include':_0x4c9c8e[_0xe596('0x9')]?_[_0xe596('0xa')](_0x4c9c8e['include'],function(_0x20382a){return{'model':db[_0x20382a[_0xe596('0xb')]],'as':_0x20382a['as'],'attributes':_0x20382a[_0xe596('0xc')],'include':_0x20382a[_0xe596('0x9')]?_[_0xe596('0xa')](_0x20382a[_0xe596('0x9')],function(_0x1ed299){return{'model':db[_0x1ed299[_0xe596('0xb')]],'as':_0x1ed299['as'],'attributes':_0x1ed299[_0xe596('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b7d0c){var _0x4e4c14=[];for(var _0xc2e809=0x0;_0xc2e809<_0x1b7d0c[_0xe596('0x25')];_0xc2e809+=0x1){_0x4e4c14['push'](_0x1b7d0c[_0xc2e809][_0xe596('0x19')](_0x2659ad[_0xe596('0x1a')],{'transaction':_0x5d430d}));}return BPromise['all'](_0x4e4c14);});})[_0xe596('0x14')](function(_0x431e75){logger[_0xe596('0xd')]('GetContactRecallMe',_0x2659ad);logger[_0xe596('0xf')](_0xe596('0x3b'),_0x2659ad,JSON[_0xe596('0x10')](_0x431e75));_0x58f0fe(_0x431e75);})[_0xe596('0x15')](function(_0xe3490f){logger[_0xe596('0x11')](_0xe596('0x3b'),_0xe3490f['message'],_0x2659ad);_0x371a0e(_0x178a13[_0xe596('0x11')](0x1f4,_0xe3490f[_0xe596('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x50c1b6){var _0x45b27f=this;return new Promise(function(_0x203b17,_0x52a795){db[_0xe596('0x1c')]['describe']()[_0xe596('0x14')](function(_0x3f14ca){return db[_0xe596('0x3')][_0xe596('0x4')]({'raw':_0x50c1b6[_0xe596('0x5')]?_0x50c1b6['options'][_0xe596('0x6')]===undefined?!![]:![]:!![],'where':_0x50c1b6[_0xe596('0x5')]?_0x50c1b6['options']['where']||null:null,'attributes':_0x50c1b6[_0xe596('0x5')]?_0x50c1b6[_0xe596('0x5')][_0xe596('0xc')]||null:null,'limit':_0x50c1b6[_0xe596('0x5')]?_0x50c1b6[_0xe596('0x5')][_0xe596('0x8')]||null:null,'include':_0x50c1b6[_0xe596('0x5')]?_0x50c1b6[_0xe596('0x5')][_0xe596('0x9')]?_['map'](_0x50c1b6[_0xe596('0x5')]['include'],function(_0x559a1a){return{'model':db[_0x559a1a['model']],'as':_0x559a1a['as'],'attributes':_0x559a1a['as']===_0xe596('0x1f')?_[_0xe596('0x20')](_0x3f14ca):_0x559a1a[_0xe596('0xc')],'include':_0x559a1a[_0xe596('0x9')]?_[_0xe596('0xa')](_0x559a1a[_0xe596('0x9')],function(_0x3a5911){return{'model':db[_0x3a5911[_0xe596('0xb')]],'as':_0x3a5911['as'],'attributes':_0x3a5911[_0xe596('0xc')],'include':_0x3a5911[_0xe596('0x9')]?_['map'](_0x3a5911[_0xe596('0x9')],function(_0x52b940){return{'model':db[_0x52b940[_0xe596('0xb')]],'as':_0x52b940['as'],'attributes':_0x52b940[_0xe596('0xc')]};}):[]};}):[]};}):[]:[]})[_0xe596('0x14')](function(_0x1efb12){logger[_0xe596('0xd')](_0xe596('0xe'),_0x50c1b6);logger[_0xe596('0xf')]('GetCmHopper',_0x50c1b6,JSON[_0xe596('0x10')](_0x1efb12));_0x203b17(_0x1efb12);})[_0xe596('0x15')](function(_0x4a140c){logger[_0xe596('0x11')](_0xe596('0xe'),_0x4a140c[_0xe596('0x12')],_0x50c1b6);_0x52a795(_0x45b27f[_0xe596('0x11')](0x1f4,_0x4a140c[_0xe596('0x12')]));});});});};exports[_0xe596('0x3e')]=function(_0x3f06a8){var _0x235562=this;return new Promise(function(_0x3f05d9,_0x43567c){return db[_0xe596('0x1c')][_0xe596('0x3f')]({'raw':!![],'where':{'phone':_0x3f06a8[_0xe596('0x5')][_0xe596('0x7')][_0xe596('0x40')]},'attributes':['id',_0xe596('0x41')],'order':[['id',_0xe596('0x42')]]})[_0xe596('0x14')](function(_0x2c49b9){logger[_0xe596('0xd')](_0xe596('0x43'),_0x3f06a8);logger['debug']('getContactByPhone',_0x3f06a8,JSON[_0xe596('0x10')](_0x2c49b9));_0x3f05d9(_0x2c49b9);})[_0xe596('0x15')](function(_0x795f32){logger[_0xe596('0x11')](_0xe596('0x43'),_0x795f32[_0xe596('0x12')],_0x3f06a8);_0x43567c(_0x235562[_0xe596('0x11')](0x1f4,_0x795f32['message']));});});};exports[_0xe596('0x44')]=function(_0x424553){var _0x5ba688=this;return new Promise(function(_0x463650,_0x47e6a6){return db[_0xe596('0x2e')][_0xe596('0x3c')](function(_0x130c04){var _0x5bf945=_0x424553[_0xe596('0x5')]&&_0x424553[_0xe596('0x5')][_0xe596('0x7')]?_0x424553[_0xe596('0x5')]['where']:{};return db[_0xe596('0x3')][_0xe596('0x19')](_0x424553[_0xe596('0x1a')],{'where':_0x5bf945,'transaction':_0x130c04})[_0xe596('0x14')](function(_0x2aea3f){logger[_0xe596('0xd')](_0xe596('0x44'),_0x424553);logger[_0xe596('0xf')](_0xe596('0x44'),_0x424553,JSON[_0xe596('0x10')](_0x2aea3f));_0x463650(_0x2aea3f);})[_0xe596('0x15')](function(_0x2d0f8d){logger[_0xe596('0x11')](_0xe596('0x44'),_0x2d0f8d[_0xe596('0x12')],_0x424553);_0x47e6a6(_0x5ba688[_0xe596('0x11')](0x1f4,_0x2d0f8d[_0xe596('0x12')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x349ee6){var _0x23f2db=this;var _0x433ba3=_0x349ee6[_0xe596('0x1a')]['where'][_0xe596('0x45')];var _0x560457=_0x349ee6[_0xe596('0x1a')][_0xe596('0x7')][_0xe596('0x46')];var _0x2f016b=_0x349ee6[_0xe596('0x1a')]['where'][_0xe596('0x47')];return new Promise(function(_0x210cd2,_0xe19a65){return db[_0xe596('0x3')][_0xe596('0x4')]({'where':{'voiceQueueId':{'$in':_0x433ba3},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe596('0x2e')][_0xe596('0x48')](_0xe596('0x49')+_0x560457+_0xe596('0x4a')),'$gt':db[_0xe596('0x2e')][_0xe596('0x48')](_0xe596('0x4b'))}},'UserId':{'$in':_0x2f016b}},'include':[{'model':db[_0xe596('0x1c')],'as':_0xe596('0x1f')},{'model':db[_0xe596('0x21')],'as':'Agent','attributes':['id','name','voicePause']},{'model':db[_0xe596('0x4c')],'as':'List'}]})['then'](function(_0x21e65d){if(_0x21e65d[_0xe596('0x25')]>0x0){return db[_0xe596('0x2e')][_0xe596('0x3c')](function(_0x2e291c){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0xe596('0x2e')][_0xe596('0x48')](_0xe596('0x4b'))},{'where':{'id':{'$in':_[_0xe596('0xa')](_0x21e65d,'id')}},'transaction':_0x2e291c})[_0xe596('0x14')](function(){_0x210cd2(_0x21e65d);})[_0xe596('0x15')](function(_0x3c01ee){logger[_0xe596('0x11')](_0xe596('0x4d'),_0x3c01ee['message'],_0x349ee6);_0xe19a65(_0x23f2db[_0xe596('0x11')](0x1f4,_0x3c01ee['message']));});})[_0xe596('0x15')](function(_0x19fc68){logger[_0xe596('0x11')](_0xe596('0x4d'),_0x19fc68[_0xe596('0x12')],_0x349ee6);_0xe19a65(_0x23f2db[_0xe596('0x11')](0x1f4,_0x19fc68['message']));});}else{_0x210cd2(_0x21e65d);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9e4db98..921725e 100644 --- a/server/api/cmHopper/index.js +++ b/server/api/cmHopper/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5efc=['index','get','/describe','describe','/opencontacts','getOpenContacts','getTimezones','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','/:id','update','delete','destroy','express','../../components/auth/service','./cmHopper.controller','isAuthenticated'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5efc,0x1f4));var _0xc5ef=function(_0x335fe8,_0x45e3c0){_0x335fe8=_0x335fe8-0x0;var _0x43c2b6=_0x5efc[_0x335fe8];return _0x43c2b6;};'use strict';var express=require(_0xc5ef('0x0'));var router=express['Router']();var auth=require(_0xc5ef('0x1'));var controller=require(_0xc5ef('0x2'));router['get']('/',auth[_0xc5ef('0x3')](),controller[_0xc5ef('0x4')]);router[_0xc5ef('0x5')](_0xc5ef('0x6'),auth['isAuthenticated'](),controller[_0xc5ef('0x7')]);router['get'](_0xc5ef('0x8'),auth[_0xc5ef('0x3')](),controller[_0xc5ef('0x9')]);router[_0xc5ef('0x5')]('/timezones',auth[_0xc5ef('0x3')](),controller[_0xc5ef('0xa')]);router[_0xc5ef('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xc5ef('0xb')]);router[_0xc5ef('0x5')](_0xc5ef('0xc'),auth[_0xc5ef('0x3')](),controller[_0xc5ef('0xd')]);router['post']('/',auth[_0xc5ef('0x3')](),controller['create']);router[_0xc5ef('0xe')](_0xc5ef('0xf'),auth[_0xc5ef('0x3')](),controller[_0xc5ef('0x10')]);router[_0xc5ef('0xe')](_0xc5ef('0x11'),auth['isAuthenticated'](),controller[_0xc5ef('0x12')]);router[_0xc5ef('0x13')](_0xc5ef('0x14'),auth[_0xc5ef('0x3')](),controller[_0xc5ef('0x15')]);router[_0xc5ef('0x16')](_0xc5ef('0x14'),auth[_0xc5ef('0x3')](),controller[_0xc5ef('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0edf=['getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','/timezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','/timezone'];(function(_0x54ce59,_0x9ed087){var _0x3e2cbc=function(_0x5e3fcf){while(--_0x5e3fcf){_0x54ce59['push'](_0x54ce59['shift']());}};_0x3e2cbc(++_0x9ed087);}(_0x0edf,0x1e6));var _0xf0ed=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x0edf[_0x15bc81];return _0x59440e;};'use strict';var express=require(_0xf0ed('0x0'));var router=express[_0xf0ed('0x1')]();var auth=require(_0xf0ed('0x2'));var controller=require(_0xf0ed('0x3'));router[_0xf0ed('0x4')]('/',auth[_0xf0ed('0x5')](),controller[_0xf0ed('0x6')]);router[_0xf0ed('0x4')](_0xf0ed('0x7'),auth['isAuthenticated'](),controller[_0xf0ed('0x8')]);router[_0xf0ed('0x4')](_0xf0ed('0x9'),auth[_0xf0ed('0x5')](),controller['getOpenContacts']);router[_0xf0ed('0x4')](_0xf0ed('0xa'),auth['isAuthenticated'](),controller['getTimezones']);router['get'](_0xf0ed('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf0ed('0x4')](_0xf0ed('0xc'),auth[_0xf0ed('0x5')](),controller[_0xf0ed('0xd')]);router[_0xf0ed('0xe')]('/',auth[_0xf0ed('0x5')](),controller[_0xf0ed('0xf')]);router['post'](_0xf0ed('0x10'),auth[_0xf0ed('0x5')](),controller['getPreview']);router[_0xf0ed('0xe')](_0xf0ed('0x11'),auth[_0xf0ed('0x5')](),controller[_0xf0ed('0x12')]);router[_0xf0ed('0x13')](_0xf0ed('0xb'),auth[_0xf0ed('0x5')](),controller[_0xf0ed('0x14')]);router[_0xf0ed('0x15')](_0xf0ed('0xb'),auth[_0xf0ed('0x5')](),controller[_0xf0ed('0x16')]);module[_0xf0ed('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 32c36a8..c4a5fba 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x692d=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','STRING','INTEGER','format'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0x692d,0x97));var _0xd692=function(_0xcd0ee7,_0x445a21){_0xcd0ee7=_0xcd0ee7-0x0;var _0x1e0644=_0x692d[_0xcd0ee7];return _0x1e0644;};'use strict';var moment=require(_0xd692('0x0'));var Sequelize=require(_0xd692('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xd692('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd692('0x4')](_0xd692('0x5'))},'countbusyretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xba7f=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','STRING','DATE','format'];(function(_0x1ee5ef,_0x38d42b){var _0x448ab8=function(_0x508932){while(--_0x508932){_0x1ee5ef['push'](_0x1ee5ef['shift']());}};_0x448ab8(++_0x38d42b);}(_0xba7f,0xf6));var _0xfba7=function(_0x1c1fa8,_0x4e7944){_0x1c1fa8=_0x1c1fa8-0x0;var _0x50564a=_0xba7f[_0x1c1fa8];return _0x50564a;};'use strict';var moment=require(_0xfba7('0x0'));var Sequelize=require(_0xfba7('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xfba7('0x2')]},'phone':{'type':Sequelize[_0xfba7('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xfba7('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xfba7('0x4')],'defaultValue':moment()[_0xfba7('0x5')](_0xfba7('0x6'))},'countbusyretry':{'type':Sequelize[_0xfba7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfba7('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xfba7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfba7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfba7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfba7('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 7aa1d69..ee81f5a 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xace9=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','get','CmHopperAdditionalPhones','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','params','options','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x2d99d4,_0x32db5a){var _0x137524=function(_0x10ed33){while(--_0x10ed33){_0x2d99d4['push'](_0x2d99d4['shift']());}};_0x137524(++_0x32db5a);}(_0xace9,0x142));var _0x9ace=function(_0x4cd362,_0x58295e){_0x4cd362=_0x4cd362-0x0;var _0x24d8ea=_0xace9[_0x4cd362];return _0x24d8ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ace('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ace('0x1'));var rp=require(_0x9ace('0x2'));var moment=require(_0x9ace('0x3'));var BPromise=require(_0x9ace('0x4'));var Mustache=require('mustache');var util=require(_0x9ace('0x5'));var path=require(_0x9ace('0x6'));var sox=require(_0x9ace('0x7'));var csv=require(_0x9ace('0x8'));var ejs=require(_0x9ace('0x9'));var fs=require('fs');var fs_extra=require(_0x9ace('0xa'));var _=require(_0x9ace('0xb'));var squel=require(_0x9ace('0xc'));var crypto=require(_0x9ace('0xd'));var jsforce=require(_0x9ace('0xe'));var deskjs=require(_0x9ace('0xf'));var toCsv=require(_0x9ace('0x8'));var querystring=require(_0x9ace('0x10'));var Papa=require('papaparse');var Redis=require(_0x9ace('0x11'));var authService=require(_0x9ace('0x12'));var qs=require(_0x9ace('0x13'));var as=require(_0x9ace('0x14'));var hardwareService=require(_0x9ace('0x15'));var logger=require(_0x9ace('0x16'))('api');var utils=require(_0x9ace('0x17'));var config=require(_0x9ace('0x18'));var licenseUtil=require(_0x9ace('0x19'));var db=require(_0x9ace('0x1a'))['db'];function respondWithStatusCode(_0x5df801,_0x44e6d2){_0x44e6d2=_0x44e6d2||0xcc;return function(_0x17d1da){if(_0x17d1da){return _0x5df801[_0x9ace('0x1b')](_0x44e6d2);}return _0x5df801[_0x9ace('0x1c')](_0x44e6d2)['end']();};}function respondWithResult(_0x39126e,_0x5b81eb){_0x5b81eb=_0x5b81eb||0xc8;return function(_0x4c6f47){if(_0x4c6f47){return _0x39126e[_0x9ace('0x1c')](_0x5b81eb)[_0x9ace('0x1d')](_0x4c6f47);}};}function respondWithFilteredResult(_0x3198bc,_0x1fe872){return function(_0x400222){if(_0x400222){var _0x1cb202=typeof _0x1fe872['offset']===_0x9ace('0x1e')&&typeof _0x1fe872[_0x9ace('0x1f')]===_0x9ace('0x1e');var _0x481ed4=_0x400222[_0x9ace('0x20')];var _0x52ad50=_0x1cb202?0x0:_0x1fe872[_0x9ace('0x21')];var _0x33a405=_0x1cb202?_0x400222[_0x9ace('0x20')]:_0x1fe872[_0x9ace('0x21')]+_0x1fe872[_0x9ace('0x1f')];var _0x2f74bd;if(_0x33a405>=_0x481ed4){_0x33a405=_0x481ed4;_0x2f74bd=0xc8;}else{_0x2f74bd=0xce;}_0x3198bc[_0x9ace('0x1c')](_0x2f74bd);return _0x3198bc['set'](_0x9ace('0x22'),_0x52ad50+'-'+_0x33a405+'/'+_0x481ed4)[_0x9ace('0x1d')](_0x400222);}return null;};}function patchUpdates(_0x14e481){return function(_0xec4f69){try{jsonpatch[_0x9ace('0x23')](_0xec4f69,_0x14e481,!![]);}catch(_0x5b1fcf){return BPromise['reject'](_0x5b1fcf);}return _0xec4f69[_0x9ace('0x24')]();};}function saveUpdates(_0x40042e,_0x53210f){return function(_0x1b74a9){if(_0x1b74a9){return _0x1b74a9['update'](_0x40042e)[_0x9ace('0x25')](function(_0x2520e7){return _0x2520e7;});}return null;};}function removeEntity(_0x175c6a,_0x5795fc){return function(_0x2a8411){if(_0x2a8411){return _0x2a8411[_0x9ace('0x26')]()[_0x9ace('0x25')](function(){var _0x2263ed=_0x2a8411[_0x9ace('0x27')]({'plain':!![]});var _0x50e077=_0x9ace('0x28');return db['UserProfileResource'][_0x9ace('0x26')]({'where':{'type':_0x50e077,'resourceId':_0x2263ed['id']}})[_0x9ace('0x25')](function(){return _0x2a8411;});})[_0x9ace('0x25')](function(){_0x175c6a[_0x9ace('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ebca,_0x3c8502){return function(_0x2324c1){if(!_0x2324c1){_0x18ebca['sendStatus'](0x194);}return _0x2324c1;};}function handleError(_0x2003a3,_0x1a0498){_0x1a0498=_0x1a0498||0x1f4;return function(_0x2d6dbe){logger['error'](_0x2d6dbe[_0x9ace('0x29')]);if(_0x2d6dbe[_0x9ace('0x2a')]){delete _0x2d6dbe[_0x9ace('0x2a')];}_0x2003a3[_0x9ace('0x1c')](_0x1a0498)[_0x9ace('0x2b')](_0x2d6dbe);};}exports[_0x9ace('0x2c')]=function(_0x37b9ef,_0x5f1286){var _0x1a03eb={},_0x668839={},_0x41a6c5={'count':0x0,'rows':[]};var _0xa876ae=_[_0x9ace('0x2d')](db[_0x9ace('0x2e')][_0x9ace('0x2f')],function(_0x3f8f75){return{'name':_0x3f8f75['fieldName'],'type':_0x3f8f75[_0x9ace('0x30')][_0x9ace('0x31')]};});_0x668839[_0x9ace('0x32')]=_[_0x9ace('0x2d')](_0xa876ae,'name');_0x668839['query']=_[_0x9ace('0x33')](_0x37b9ef[_0x9ace('0x34')]);_0x668839[_0x9ace('0x35')]=_[_0x9ace('0x36')](_0x668839['model'],_0x668839[_0x9ace('0x34')]);_0x1a03eb[_0x9ace('0x37')]=_[_0x9ace('0x36')](_0x668839[_0x9ace('0x32')],qs[_0x9ace('0x38')](_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x38')]));_0x1a03eb[_0x9ace('0x37')]=_0x1a03eb['attributes'][_0x9ace('0x39')]?_0x1a03eb[_0x9ace('0x37')]:_0x668839[_0x9ace('0x32')];if(!_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x3a')]('nolimit')){_0x1a03eb[_0x9ace('0x1f')]=qs[_0x9ace('0x1f')](_0x37b9ef['query'][_0x9ace('0x1f')]);_0x1a03eb[_0x9ace('0x21')]=qs['offset'](_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x21')]);}_0x1a03eb[_0x9ace('0x3b')]=qs[_0x9ace('0x3c')](_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x3c')]);_0x1a03eb['where']=qs[_0x9ace('0x35')](_[_0x9ace('0x3d')](_0x37b9ef[_0x9ace('0x34')],_0x668839[_0x9ace('0x35')]),_0xa876ae);if(_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x3e')]){_0x1a03eb[_0x9ace('0x3f')]=_['merge'](_0x1a03eb[_0x9ace('0x3f')],{'$or':_[_0x9ace('0x2d')](_0xa876ae,function(_0x2d5a2e){if(_0x2d5a2e['type']!==_0x9ace('0x40')){var _0x31c15a={};_0x31c15a[_0x2d5a2e[_0x9ace('0x2a')]]={'$like':'%'+_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x3e')]+'%'};return _0x31c15a;}})});}_0x1a03eb=_[_0x9ace('0x41')]({},_0x1a03eb,_0x37b9ef['options']);var _0x382dac={'where':_0x1a03eb[_0x9ace('0x3f')]};return db[_0x9ace('0x2e')][_0x9ace('0x20')](_0x382dac)[_0x9ace('0x25')](function(_0x33d207){_0x41a6c5[_0x9ace('0x20')]=_0x33d207;if(_0x37b9ef[_0x9ace('0x34')]['includeAll']){_0x1a03eb[_0x9ace('0x42')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x9ace('0x43')](_0x1a03eb);})[_0x9ace('0x25')](function(_0x248734){_0x41a6c5[_0x9ace('0x44')]=_0x248734;return _0x41a6c5;})[_0x9ace('0x25')](respondWithFilteredResult(_0x5f1286,_0x1a03eb))[_0x9ace('0x45')](handleError(_0x5f1286,null));};exports['show']=function(_0x59f09e,_0x5d9380){var _0x3a0112={'raw':!![],'where':{'id':_0x59f09e[_0x9ace('0x46')]['id']}},_0x4c9e88={};_0x4c9e88[_0x9ace('0x32')]=_[_0x9ace('0x33')](db[_0x9ace('0x2e')][_0x9ace('0x2f')]);_0x4c9e88['query']=_['keys'](_0x59f09e[_0x9ace('0x34')]);_0x4c9e88[_0x9ace('0x35')]=_['intersection'](_0x4c9e88[_0x9ace('0x32')],_0x4c9e88['query']);_0x3a0112[_0x9ace('0x37')]=_[_0x9ace('0x36')](_0x4c9e88[_0x9ace('0x32')],qs['fields'](_0x59f09e['query'][_0x9ace('0x38')]));_0x3a0112[_0x9ace('0x37')]=_0x3a0112['attributes'][_0x9ace('0x39')]?_0x3a0112[_0x9ace('0x37')]:_0x4c9e88[_0x9ace('0x32')];if(_0x59f09e['query']['includeAll']){_0x3a0112['include']=[{'all':!![]}];}_0x3a0112=_['merge']({},_0x3a0112,_0x59f09e[_0x9ace('0x47')]);return db[_0x9ace('0x2e')][_0x9ace('0x48')](_0x3a0112)[_0x9ace('0x25')](handleEntityNotFound(_0x5d9380,null))['then'](respondWithResult(_0x5d9380,null))[_0x9ace('0x45')](handleError(_0x5d9380,null));};exports[_0x9ace('0x49')]=function(_0x4b0d7c,_0x409e32){return db[_0x9ace('0x2e')][_0x9ace('0x49')](_0x4b0d7c[_0x9ace('0x4a')],{})[_0x9ace('0x25')](function(_0x3f8186){var _0x33622a=_0x4b0d7c[_0x9ace('0x4b')][_0x9ace('0x27')]({'plain':!![]});if(!_0x33622a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33622a[_0x9ace('0x4c')]===_0x9ace('0x4b')){var _0x31cb3e=_0x3f8186[_0x9ace('0x27')]({'plain':!![]});var _0x14fc7d=_0x9ace('0x28');return db['UserProfileSection'][_0x9ace('0x48')]({'where':{'name':_0x14fc7d,'userProfileId':_0x33622a[_0x9ace('0x4d')]},'raw':!![]})[_0x9ace('0x25')](function(_0x471852){if(_0x471852&&_0x471852[_0x9ace('0x4e')]===0x0){return db[_0x9ace('0x4f')][_0x9ace('0x49')]({'name':_0x31cb3e['name'],'resourceId':_0x31cb3e['id'],'type':_0x471852[_0x9ace('0x2a')],'sectionId':_0x471852['id']},{})[_0x9ace('0x25')](function(){return _0x3f8186;});}else{return _0x3f8186;}})[_0x9ace('0x45')](function(_0x3e5a12){logger['error'](_0x9ace('0x50'),_0x3e5a12);throw _0x3e5a12;});}return _0x3f8186;})[_0x9ace('0x25')](respondWithResult(_0x409e32,0xc9))['catch'](handleError(_0x409e32,null));};exports[_0x9ace('0x51')]=function(_0x5a23da,_0x455f4c){if(_0x5a23da[_0x9ace('0x4a')]['id']){delete _0x5a23da[_0x9ace('0x4a')]['id'];}return db[_0x9ace('0x2e')][_0x9ace('0x48')]({'where':{'id':_0x5a23da[_0x9ace('0x46')]['id']}})['then'](handleEntityNotFound(_0x455f4c,null))[_0x9ace('0x25')](saveUpdates(_0x5a23da['body'],null))[_0x9ace('0x25')](respondWithResult(_0x455f4c,null))['catch'](handleError(_0x455f4c,null));};exports['destroy']=function(_0x3de9f8,_0x2e47ff){return db[_0x9ace('0x2e')][_0x9ace('0x48')]({'where':{'id':_0x3de9f8[_0x9ace('0x46')]['id']}})[_0x9ace('0x25')](handleEntityNotFound(_0x2e47ff,null))[_0x9ace('0x25')](removeEntity(_0x2e47ff,null))[_0x9ace('0x45')](handleError(_0x2e47ff,null));}; \ No newline at end of file +var _0x8db6=['path','sox','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','includeAll','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x39b813,_0x4d3ff2){var _0x1a7b8a=function(_0x451345){while(--_0x451345){_0x39b813['push'](_0x39b813['shift']());}};_0x1a7b8a(++_0x4d3ff2);}(_0x8db6,0xeb));var _0x68db=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x8db6[_0x22f8ab];return _0x2a70e5;};'use strict';var emlformat=require(_0x68db('0x0'));var rimraf=require(_0x68db('0x1'));var zipdir=require(_0x68db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68db('0x3'));var moment=require(_0x68db('0x4'));var BPromise=require(_0x68db('0x5'));var Mustache=require(_0x68db('0x6'));var util=require(_0x68db('0x7'));var path=require(_0x68db('0x8'));var sox=require(_0x68db('0x9'));var csv=require('to-csv');var ejs=require(_0x68db('0xa'));var fs=require('fs');var fs_extra=require(_0x68db('0xb'));var _=require('lodash');var squel=require(_0x68db('0xc'));var crypto=require(_0x68db('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x68db('0xe'));var Papa=require(_0x68db('0xf'));var Redis=require(_0x68db('0x10'));var authService=require(_0x68db('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x68db('0x12'));var hardwareService=require(_0x68db('0x13'));var logger=require(_0x68db('0x14'))(_0x68db('0x15'));var utils=require(_0x68db('0x16'));var config=require(_0x68db('0x17'));var licenseUtil=require(_0x68db('0x18'));var db=require(_0x68db('0x19'))['db'];function respondWithStatusCode(_0x81bab8,_0x43e2a5){_0x43e2a5=_0x43e2a5||0xcc;return function(_0x418120){if(_0x418120){return _0x81bab8[_0x68db('0x1a')](_0x43e2a5);}return _0x81bab8['status'](_0x43e2a5)[_0x68db('0x1b')]();};}function respondWithResult(_0x56ba0e,_0x31b5e2){_0x31b5e2=_0x31b5e2||0xc8;return function(_0xc4c051){if(_0xc4c051){return _0x56ba0e['status'](_0x31b5e2)[_0x68db('0x1c')](_0xc4c051);}};}function respondWithFilteredResult(_0x2f5f03,_0x4540d7){return function(_0x2aad9d){if(_0x2aad9d){var _0x2720fc=typeof _0x4540d7[_0x68db('0x1d')]===_0x68db('0x1e')&&typeof _0x4540d7[_0x68db('0x1f')]==='undefined';var _0x173f3b=_0x2aad9d[_0x68db('0x20')];var _0x510634=_0x2720fc?0x0:_0x4540d7[_0x68db('0x1d')];var _0x51f201=_0x2720fc?_0x2aad9d[_0x68db('0x20')]:_0x4540d7['offset']+_0x4540d7[_0x68db('0x1f')];var _0x363261;if(_0x51f201>=_0x173f3b){_0x51f201=_0x173f3b;_0x363261=0xc8;}else{_0x363261=0xce;}_0x2f5f03[_0x68db('0x21')](_0x363261);return _0x2f5f03['set'](_0x68db('0x22'),_0x510634+'-'+_0x51f201+'/'+_0x173f3b)['json'](_0x2aad9d);}return null;};}function patchUpdates(_0x56a719){return function(_0x47c4e3){try{jsonpatch[_0x68db('0x23')](_0x47c4e3,_0x56a719,!![]);}catch(_0x463c1f){return BPromise[_0x68db('0x24')](_0x463c1f);}return _0x47c4e3['save']();};}function saveUpdates(_0x39b72d,_0x38f5a9){return function(_0xbbd238){if(_0xbbd238){return _0xbbd238[_0x68db('0x25')](_0x39b72d)[_0x68db('0x26')](function(_0x415056){return _0x415056;});}return null;};}function removeEntity(_0xc27d4c,_0x32ad0b){return function(_0x121b07){if(_0x121b07){return _0x121b07[_0x68db('0x27')]()[_0x68db('0x26')](function(){var _0x54b45b=_0x121b07[_0x68db('0x28')]({'plain':!![]});var _0x103087=_0x68db('0x29');return db[_0x68db('0x2a')][_0x68db('0x27')]({'where':{'type':_0x103087,'resourceId':_0x54b45b['id']}})['then'](function(){return _0x121b07;});})[_0x68db('0x26')](function(){_0xc27d4c[_0x68db('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xad0d1b,_0x4f2b16){return function(_0x4426c9){if(!_0x4426c9){_0xad0d1b[_0x68db('0x1a')](0x194);}return _0x4426c9;};}function handleError(_0xab00e9,_0x40754c){_0x40754c=_0x40754c||0x1f4;return function(_0x2c87ef){logger[_0x68db('0x2b')](_0x2c87ef[_0x68db('0x2c')]);if(_0x2c87ef[_0x68db('0x2d')]){delete _0x2c87ef[_0x68db('0x2d')];}_0xab00e9[_0x68db('0x21')](_0x40754c)[_0x68db('0x2e')](_0x2c87ef);};}exports['index']=function(_0x5163a6,_0x28c482){var _0x53041e={},_0x6a6b7e={},_0x1d654b={'count':0x0,'rows':[]};var _0x1c50f7=_[_0x68db('0x2f')](db[_0x68db('0x30')][_0x68db('0x31')],function(_0x16f43f){return{'name':_0x16f43f['fieldName'],'type':_0x16f43f[_0x68db('0x32')]['key']};});_0x6a6b7e[_0x68db('0x33')]=_[_0x68db('0x2f')](_0x1c50f7,'name');_0x6a6b7e[_0x68db('0x34')]=_[_0x68db('0x35')](_0x5163a6[_0x68db('0x34')]);_0x6a6b7e[_0x68db('0x36')]=_[_0x68db('0x37')](_0x6a6b7e[_0x68db('0x33')],_0x6a6b7e[_0x68db('0x34')]);_0x53041e[_0x68db('0x38')]=_[_0x68db('0x37')](_0x6a6b7e[_0x68db('0x33')],qs[_0x68db('0x39')](_0x5163a6[_0x68db('0x34')]['fields']));_0x53041e[_0x68db('0x38')]=_0x53041e['attributes']['length']?_0x53041e[_0x68db('0x38')]:_0x6a6b7e['model'];if(!_0x5163a6[_0x68db('0x34')][_0x68db('0x3a')](_0x68db('0x3b'))){_0x53041e[_0x68db('0x1f')]=qs[_0x68db('0x1f')](_0x5163a6[_0x68db('0x34')][_0x68db('0x1f')]);_0x53041e[_0x68db('0x1d')]=qs[_0x68db('0x1d')](_0x5163a6[_0x68db('0x34')][_0x68db('0x1d')]);}_0x53041e['order']=qs[_0x68db('0x3c')](_0x5163a6[_0x68db('0x34')][_0x68db('0x3c')]);_0x53041e[_0x68db('0x3d')]=qs[_0x68db('0x36')](_[_0x68db('0x3e')](_0x5163a6[_0x68db('0x34')],_0x6a6b7e[_0x68db('0x36')]),_0x1c50f7);if(_0x5163a6[_0x68db('0x34')][_0x68db('0x3f')]){_0x53041e[_0x68db('0x3d')]=_[_0x68db('0x40')](_0x53041e[_0x68db('0x3d')],{'$or':_['map'](_0x1c50f7,function(_0x57005e){if(_0x57005e[_0x68db('0x32')]!==_0x68db('0x41')){var _0x5ed191={};_0x5ed191[_0x57005e[_0x68db('0x2d')]]={'$like':'%'+_0x5163a6[_0x68db('0x34')][_0x68db('0x3f')]+'%'};return _0x5ed191;}})});}_0x53041e=_[_0x68db('0x40')]({},_0x53041e,_0x5163a6['options']);var _0x1181f7={'where':_0x53041e['where']};return db[_0x68db('0x30')][_0x68db('0x20')](_0x1181f7)['then'](function(_0x444be6){_0x1d654b[_0x68db('0x20')]=_0x444be6;if(_0x5163a6[_0x68db('0x34')]['includeAll']){_0x53041e[_0x68db('0x42')]=[{'all':!![]}];}return db[_0x68db('0x30')][_0x68db('0x43')](_0x53041e);})['then'](function(_0x2dd10f){_0x1d654b[_0x68db('0x44')]=_0x2dd10f;return _0x1d654b;})[_0x68db('0x26')](respondWithFilteredResult(_0x28c482,_0x53041e))[_0x68db('0x45')](handleError(_0x28c482,null));};exports[_0x68db('0x46')]=function(_0x388fea,_0x481dab){var _0x55f771={'raw':!![],'where':{'id':_0x388fea[_0x68db('0x47')]['id']}},_0x196f48={};_0x196f48[_0x68db('0x33')]=_[_0x68db('0x35')](db['CmHopperAdditionalPhone'][_0x68db('0x31')]);_0x196f48[_0x68db('0x34')]=_['keys'](_0x388fea[_0x68db('0x34')]);_0x196f48['filters']=_[_0x68db('0x37')](_0x196f48[_0x68db('0x33')],_0x196f48[_0x68db('0x34')]);_0x55f771[_0x68db('0x38')]=_['intersection'](_0x196f48[_0x68db('0x33')],qs[_0x68db('0x39')](_0x388fea['query'][_0x68db('0x39')]));_0x55f771[_0x68db('0x38')]=_0x55f771[_0x68db('0x38')][_0x68db('0x48')]?_0x55f771[_0x68db('0x38')]:_0x196f48[_0x68db('0x33')];if(_0x388fea['query'][_0x68db('0x49')]){_0x55f771['include']=[{'all':!![]}];}_0x55f771=_[_0x68db('0x40')]({},_0x55f771,_0x388fea['options']);return db[_0x68db('0x30')]['find'](_0x55f771)['then'](handleEntityNotFound(_0x481dab,null))[_0x68db('0x26')](respondWithResult(_0x481dab,null))[_0x68db('0x45')](handleError(_0x481dab,null));};exports['create']=function(_0x55153f,_0x2fdc66){return db[_0x68db('0x30')]['create'](_0x55153f[_0x68db('0x4a')],{})[_0x68db('0x26')](function(_0x118a8c){var _0x59cebe=_0x55153f[_0x68db('0x4b')][_0x68db('0x28')]({'plain':!![]});if(!_0x59cebe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59cebe[_0x68db('0x4c')]===_0x68db('0x4b')){var _0x406aac=_0x118a8c[_0x68db('0x28')]({'plain':!![]});var _0x2176a3=_0x68db('0x29');return db['UserProfileSection'][_0x68db('0x4d')]({'where':{'name':_0x2176a3,'userProfileId':_0x59cebe[_0x68db('0x4e')]},'raw':!![]})['then'](function(_0x43526f){if(_0x43526f&&_0x43526f[_0x68db('0x4f')]===0x0){return db[_0x68db('0x2a')]['create']({'name':_0x406aac['name'],'resourceId':_0x406aac['id'],'type':_0x43526f[_0x68db('0x2d')],'sectionId':_0x43526f['id']},{})[_0x68db('0x26')](function(){return _0x118a8c;});}else{return _0x118a8c;}})[_0x68db('0x45')](function(_0x2546d2){logger['error'](_0x68db('0x50'),_0x2546d2);throw _0x2546d2;});}return _0x118a8c;})[_0x68db('0x26')](respondWithResult(_0x2fdc66,0xc9))[_0x68db('0x45')](handleError(_0x2fdc66,null));};exports['update']=function(_0x47820a,_0x241d0a){if(_0x47820a['body']['id']){delete _0x47820a[_0x68db('0x4a')]['id'];}return db[_0x68db('0x30')]['find']({'where':{'id':_0x47820a[_0x68db('0x47')]['id']}})[_0x68db('0x26')](handleEntityNotFound(_0x241d0a,null))['then'](saveUpdates(_0x47820a[_0x68db('0x4a')],null))[_0x68db('0x26')](respondWithResult(_0x241d0a,null))['catch'](handleError(_0x241d0a,null));};exports[_0x68db('0x27')]=function(_0x42ebc7,_0x48d146){return db[_0x68db('0x30')][_0x68db('0x4d')]({'where':{'id':_0x42ebc7['params']['id']}})[_0x68db('0x26')](handleEntityNotFound(_0x48d146,null))['then'](removeEntity(_0x48d146,null))['catch'](handleError(_0x48d146,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 4105647..2eeefd8 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30ef=['moment','request-promise','path','rimraf','exports','define','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0xd685e,_0x360045){var _0x5ef5e0=function(_0x37f4b3){while(--_0x37f4b3){_0xd685e['push'](_0xd685e['shift']());}};_0x5ef5e0(++_0x360045);}(_0x30ef,0x129));var _0xf30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf30e('0x0'));var util=require(_0xf30e('0x1'));var logger=require(_0xf30e('0x2'))('api');var moment=require(_0xf30e('0x3'));var BPromise=require('bluebird');var rp=require(_0xf30e('0x4'));var fs=require('fs');var path=require(_0xf30e('0x5'));var rimraf=require(_0xf30e('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xf30e('0x7')]=function(_0x4419fd,_0x2e97c3){return _0x4419fd[_0xf30e('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xf30e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1ae=['exports','define','cm_hopper_additional_phones','lodash','api','moment','bluebird','rimraf','./cmHopperAdditionalPhone.attributes'];(function(_0x573ae1,_0x11b4cc){var _0x48b9f9=function(_0x13f570){while(--_0x13f570){_0x573ae1['push'](_0x573ae1['shift']());}};_0x48b9f9(++_0x11b4cc);}(_0xb1ae,0x1bc));var _0xeb1a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ae[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeb1a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeb1a('0x1'));var moment=require(_0xeb1a('0x2'));var BPromise=require(_0xeb1a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeb1a('0x4'));var config=require('../../config/environment');var attributes=require(_0xeb1a('0x5'));module[_0xeb1a('0x6')]=function(_0x44e30f,_0x3b1206){return _0x44e30f[_0xeb1a('0x7')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xeb1a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 676dc31..368bedb 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cee=['createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','then','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','findOne','OrderBy','ASC','catch','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone'];(function(_0x5ce7e2,_0x8dd5de){var _0x5224d1=function(_0x3b04f1){while(--_0x3b04f1){_0x5ce7e2['push'](_0x5ce7e2['shift']());}};_0x5224d1(++_0x8dd5de);}(_0x4cee,0x75));var _0xe4ce=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x4cee[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require(_0xe4ce('0x0'));var moment=require('moment');var BPromise=require(_0xe4ce('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4ce('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4ce('0x3'));var logger=require(_0xe4ce('0x4'))(_0xe4ce('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe4ce('0x6')][_0xe4ce('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48d5aa,_0x5b18dd,_0x5a912a){return new BPromise(function(_0x1c7cb4,_0xa947a3){return client[_0xe4ce('0x8')](_0x48d5aa,_0x5a912a)['then'](function(_0x4e854d){logger[_0xe4ce('0x9')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5b18dd,_0xe4ce('0xa'));logger[_0xe4ce('0xb')](_0xe4ce('0xc'),_0x5b18dd,'request\x20sent',JSON['stringify'](_0x4e854d));if(_0x4e854d[_0xe4ce('0xd')]){if(_0x4e854d[_0xe4ce('0xd')][_0xe4ce('0xe')]===0x1f4){logger[_0xe4ce('0xd')](_0xe4ce('0xf'),_0x5b18dd,_0x4e854d[_0xe4ce('0xd')][_0xe4ce('0x10')]);return _0xa947a3(_0x4e854d[_0xe4ce('0xd')][_0xe4ce('0x10')]);}logger[_0xe4ce('0xd')](_0xe4ce('0xf'),_0x5b18dd,_0x4e854d[_0xe4ce('0xd')]['message']);return _0x1c7cb4(_0x4e854d['error']['message']);}else{logger[_0xe4ce('0x9')](_0xe4ce('0xf'),_0x5b18dd,_0xe4ce('0xa'));_0x1c7cb4(_0x4e854d[_0xe4ce('0x11')][_0xe4ce('0x10')]);}})['catch'](function(_0x5f1462){logger[_0xe4ce('0xd')](_0xe4ce('0xf'),_0x5b18dd,_0x5f1462);_0xa947a3(_0x5f1462);});});}exports[_0xe4ce('0x12')]=function(_0x4aaf75){var _0x344fef=this;return new Promise(function(_0x536504,_0x2ba6df){return db[_0xe4ce('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x4aaf75[_0xe4ce('0x14')][_0xe4ce('0x15')],'ListId':_0x4aaf75['body'][_0xe4ce('0x16')],'VoiceQueueId':_0x4aaf75[_0xe4ce('0x14')][_0xe4ce('0x17')]===undefined?null:_0x4aaf75[_0xe4ce('0x14')][_0xe4ce('0x17')],'CampaignId':_0x4aaf75[_0xe4ce('0x14')][_0xe4ce('0x18')]===undefined?null:_0x4aaf75[_0xe4ce('0x14')][_0xe4ce('0x18')]}})['then'](function(_0xaccfba){if(_0xaccfba!=null){return db[_0xe4ce('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xaccfba['id'],'OrderBy':{'$gt':_0xaccfba['OrderBy']}},'order':[['OrderBy','ASC']]})[_0xe4ce('0x1a')](function(_0x23d39e){var _0x294fe6=0x0;if(_0x23d39e){if(_0x23d39e[_0xe4ce('0x1b')]+_0x23d39e[_0xe4ce('0x1c')]+_0x23d39e[_0xe4ce('0x1d')]+_0x23d39e[_0xe4ce('0x1e')]+_0x23d39e[_0xe4ce('0x1f')]+_0x23d39e[_0xe4ce('0x20')]+_0x23d39e[_0xe4ce('0x21')]+_0x23d39e[_0xe4ce('0x22')]<_0x4aaf75['entity'][_0xe4ce('0x23')])_0x294fe6=0x1;_0x536504({'additional':_0x294fe6});}else{return db['CmHopperAdditionalPhone'][_0xe4ce('0x24')]({'raw':!![],'where':{'CmHopperId':_0xaccfba['id']},'order':[[_0xe4ce('0x25'),_0xe4ce('0x26')]]})[_0xe4ce('0x1a')](function(_0x27b915){var _0x50328d=0x0;if(_0x27b915){if(_0x27b915[_0xe4ce('0x1b')]+_0x27b915[_0xe4ce('0x1c')]+_0x27b915['countnoanswerretry']+_0x27b915[_0xe4ce('0x1e')]+_0x27b915['countdropretry']+_0x27b915[_0xe4ce('0x20')]+_0x27b915['countmachineretry']+_0x27b915[_0xe4ce('0x22')]<_0x4aaf75['entity'][_0xe4ce('0x23')])_0x50328d=0x1;_0x536504({'additional':_0x50328d});}else{_0x536504({'additional':0x0});}})[_0xe4ce('0x27')](function(_0x4f3926){logger['error'](_0xe4ce('0x12'),_0x4f3926[_0xe4ce('0x10')]);_0x2ba6df(_0x344fef[_0xe4ce('0xd')](0x1f4,_0x4f3926[_0xe4ce('0x10')]));});}})['catch'](function(_0x545228){logger['error']('VerifyAdditionalPhones',_0x545228[_0xe4ce('0x10')]);_0x2ba6df(_0x344fef[_0xe4ce('0xd')](0x1f4,_0x545228[_0xe4ce('0x10')]));});}else _0x536504({'additional':0x0});});});};exports[_0xe4ce('0x28')]=function(_0x50d1a9){var _0x2883ff=this;return new Promise(function(_0x2c0a64,_0x12e64b){return db[_0xe4ce('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x50d1a9[_0xe4ce('0x14')][_0xe4ce('0x15')],'ListId':_0x50d1a9['body'][_0xe4ce('0x16')],'VoiceQueueId':_0x50d1a9[_0xe4ce('0x14')][_0xe4ce('0x17')]===undefined?null:_0x50d1a9['body'][_0xe4ce('0x17')],'CampaignId':_0x50d1a9[_0xe4ce('0x14')][_0xe4ce('0x18')]===undefined?null:_0x50d1a9['body']['CampaignId']}})[_0xe4ce('0x1a')](function(_0xd1d499){if(_0xd1d499!=null){return db[_0xe4ce('0x19')][_0xe4ce('0x24')]({'raw':!![],'where':{'CmHopperId':_0xd1d499['id'],'OrderBy':{'$gte':_0xd1d499[_0xe4ce('0x25')]}},'order':[[_0xe4ce('0x25'),_0xe4ce('0x26')]]})['then'](function(_0x101c23){if(_0x101c23)return activateAdditionalPhone(_0xd1d499,_0x50d1a9[_0xe4ce('0x14')],_0x101c23,_0x50d1a9['duration'],_0x50d1a9['waitTime'])[_0xe4ce('0x1a')](function(_0x577b97){_0x2c0a64(_0x577b97);});else{return db[_0xe4ce('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xd1d499['id']},'order':[['OrderBy',_0xe4ce('0x26')]]})[_0xe4ce('0x1a')](function(_0x4b72c3){if(_0x4b72c3)return activateAdditionalPhone(_0xd1d499,_0x50d1a9[_0xe4ce('0x14')],_0x4b72c3,_0x50d1a9[_0xe4ce('0x29')],_0x50d1a9[_0xe4ce('0x2a')])[_0xe4ce('0x1a')](function(_0x448677){_0x2c0a64(_0x448677);});else{_0x2c0a64({'id':_0xd1d499['id'],'phone':''});}})[_0xe4ce('0x27')](function(_0x5e88d4){logger[_0xe4ce('0xd')](_0xe4ce('0x12'),_0x5e88d4[_0xe4ce('0x10')]);_0x12e64b(_0x2883ff['error'](0x1f4,_0x5e88d4[_0xe4ce('0x10')]));});}})[_0xe4ce('0x27')](function(_0x1cbb12){logger[_0xe4ce('0xd')]('VerifyAdditionalPhones',_0x1cbb12[_0xe4ce('0x10')]);_0x12e64b(_0x2883ff[_0xe4ce('0xd')](0x1f4,_0x1cbb12[_0xe4ce('0x10')]));});}else _0x2c0a64(0x1);});});};function activateAdditionalPhone(_0x4d7751,_0x34d955,_0x5eafe0,_0x5e209b,_0x552afd){return new Promise(function(_0x3378be,_0x2315cc){var _0x52eb69;if(_[_0xe4ce('0x2b')](_0x5eafe0[_0xe4ce('0x2c')])){_0x5eafe0[_0xe4ce('0x2c')]=moment();}if(moment()>moment(_0x5eafe0[_0xe4ce('0x2c')])){_0x52eb69=moment()[_0xe4ce('0x2d')](_0x552afd||0x3,_0xe4ce('0x2e'));}else{if(_0x5eafe0[_0xe4ce('0x25')]==0x0){_0x52eb69=moment(_0x5eafe0[_0xe4ce('0x2c')]);}else{_0x52eb69=moment()['add'](_0x552afd||0x3,_0xe4ce('0x2e'));}}if(_[_0xe4ce('0x2b')](_0x52eb69)){_0x52eb69=moment()[_0xe4ce('0x2d')](_0x552afd||0x3,_0xe4ce('0x2e'));}var _0x47af5b={'phone':_0x4d7751[_0xe4ce('0x2f')],'active':0x0,'OrderBy':_[_0xe4ce('0x2b')](_0x4d7751[_0xe4ce('0x25')])?0x0:_0x4d7751[_0xe4ce('0x25')],'scheduledat':moment()['add'](_0x5e209b||0x1,'minutes'),'countbusyretry':_0x34d955[_0xe4ce('0x1b')],'countcongestionretry':_0x34d955[_0xe4ce('0x1c')],'countnoanswerretry':_0x34d955[_0xe4ce('0x1d')],'countnosuchnumberretry':_0x34d955[_0xe4ce('0x1e')],'countdropretry':_0x34d955['countdropretry'],'countabandonedretry':_0x34d955[_0xe4ce('0x20')],'countmachineretry':_0x34d955['countmachineretry'],'countagentrejectretry':_0x34d955[_0xe4ce('0x22')],'createdAt':_0x34d955[_0xe4ce('0x30')],'updatedAt':_0x34d955[_0xe4ce('0x31')]};var _0x14210d={'CmHopperId':_0x4d7751['id'],'phone':_0x5eafe0[_0xe4ce('0x2f')],'active':0x0,'OrderBy':_[_0xe4ce('0x2b')](_0x5eafe0[_0xe4ce('0x25')])?0x0:_0x5eafe0[_0xe4ce('0x25')],'scheduledat':_0x52eb69,'countbusyretry':_0x5eafe0[_0xe4ce('0x1b')],'countcongestionretry':_0x5eafe0[_0xe4ce('0x1c')],'countnoanswerretry':_0x5eafe0['countnoanswerretry'],'countnosuchnumberretry':_0x5eafe0[_0xe4ce('0x1e')],'countdropretry':_0x5eafe0['countdropretry'],'countabandonedretry':_0x5eafe0[_0xe4ce('0x20')],'countmachineretry':_0x5eafe0[_0xe4ce('0x21')],'countagentrejectretry':_0x5eafe0[_0xe4ce('0x22')],'createdAt':_0x5eafe0[_0xe4ce('0x30')],'updatedAt':_0x5eafe0['updatedAt']};return db[_0xe4ce('0x32')]['transaction'](function(_0x7ea64d){return db[_0xe4ce('0x19')]['update'](_0x47af5b,{'where':{'id':_0x5eafe0['id']}},{'transaction':_0x7ea64d})[_0xe4ce('0x1a')](function(){return db['CmHopper'][_0xe4ce('0x33')](_0x14210d,{'where':{'id':_0x4d7751['id']}},{'transaction':_0x7ea64d});});})[_0xe4ce('0x1a')](function(_0x19921e){_0x3378be({'id':_0x4d7751['id'],'phone':_0x5eafe0['phone']});})[_0xe4ce('0x27')](function(_0x1d99f8){logger[_0xe4ce('0xd')](_0xe4ce('0x34'),_0x1d99f8[_0xe4ce('0x10')]);_0x2315cc({'error':_0x1d99f8[_0xe4ce('0x10')]});});});}exports[_0xe4ce('0x35')]=function(_0x5c0662){var _0x296c39=this;return new Promise(function(_0xa7c3b7,_0x1cb067){return db[_0xe4ce('0x13')]['update'](_0x5c0662[_0xe4ce('0x14')][_0xe4ce('0x36')],{'where':{'id':_0x5c0662[_0xe4ce('0x14')]['id']}})[_0xe4ce('0x1a')](function(_0x116cda){_0xa7c3b7(_0x116cda);})['catch'](function(_0x13f7d3){logger['error'](_0xe4ce('0x35'),_0x13f7d3[_0xe4ce('0x10')]);_0x1cb067(_0x296c39['error'](0x1f4,_0x13f7d3[_0xe4ce('0x10')]));});});}; \ No newline at end of file +var _0x1042=['updatedAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','VerifyAdditionalPhones','CmHopper','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','countbusyretry','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countnosuchnumberretry','countabandonedretry','catch','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','countnoanswerretry','createdAt'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x1042,0x1de));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2104('0x0'));var util=require(_0x2104('0x1'));var moment=require(_0x2104('0x2'));var BPromise=require(_0x2104('0x3'));var rs=require(_0x2104('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2104('0x5'));var logger=require(_0x2104('0x6'))(_0x2104('0x7'));var config=require(_0x2104('0x8'));var jayson=require(_0x2104('0x9'));var client=jayson[_0x2104('0xa')][_0x2104('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18b491,_0x543b64,_0x397603){return new BPromise(function(_0x1f6927,_0x5897da){return client[_0x2104('0xc')](_0x18b491,_0x397603)[_0x2104('0xd')](function(_0x16f93f){logger[_0x2104('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x543b64,_0x2104('0xf'));logger[_0x2104('0x10')](_0x2104('0x11'),_0x543b64,_0x2104('0xf'),JSON[_0x2104('0x12')](_0x16f93f));if(_0x16f93f['error']){if(_0x16f93f[_0x2104('0x13')][_0x2104('0x14')]===0x1f4){logger[_0x2104('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x543b64,_0x16f93f[_0x2104('0x13')]['message']);return _0x5897da(_0x16f93f[_0x2104('0x13')]['message']);}logger[_0x2104('0x13')](_0x2104('0x15'),_0x543b64,_0x16f93f[_0x2104('0x13')]['message']);return _0x1f6927(_0x16f93f[_0x2104('0x13')][_0x2104('0x16')]);}else{logger[_0x2104('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x543b64,_0x2104('0xf'));_0x1f6927(_0x16f93f[_0x2104('0x17')][_0x2104('0x16')]);}})['catch'](function(_0x3fea9b){logger[_0x2104('0x13')](_0x2104('0x15'),_0x543b64,_0x3fea9b);_0x5897da(_0x3fea9b);});});}exports[_0x2104('0x18')]=function(_0x39258d){var _0x4b5319=this;return new Promise(function(_0x10e9c7,_0x43130c){return db[_0x2104('0x19')]['findOne']({'raw':!![],'where':{'ContactId':_0x39258d[_0x2104('0x1a')]['ContactId'],'ListId':_0x39258d[_0x2104('0x1a')]['ListId'],'VoiceQueueId':_0x39258d[_0x2104('0x1a')][_0x2104('0x1b')]===undefined?null:_0x39258d[_0x2104('0x1a')]['VoiceQueueId'],'CampaignId':_0x39258d[_0x2104('0x1a')][_0x2104('0x1c')]===undefined?null:_0x39258d['body'][_0x2104('0x1c')]}})[_0x2104('0xd')](function(_0x571e0e){if(_0x571e0e!=null){return db[_0x2104('0x1d')][_0x2104('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x571e0e['id'],'OrderBy':{'$gt':_0x571e0e[_0x2104('0x1f')]}},'order':[[_0x2104('0x1f'),'ASC']]})[_0x2104('0xd')](function(_0x10045b){var _0x189773=0x0;if(_0x10045b){if(_0x10045b[_0x2104('0x20')]+_0x10045b[_0x2104('0x21')]+_0x10045b['countnoanswerretry']+_0x10045b['countnosuchnumberretry']+_0x10045b[_0x2104('0x22')]+_0x10045b['countabandonedretry']+_0x10045b[_0x2104('0x23')]+_0x10045b[_0x2104('0x24')]<_0x39258d[_0x2104('0x25')][_0x2104('0x26')])_0x189773=0x1;_0x10e9c7({'additional':_0x189773});}else{return db[_0x2104('0x1d')][_0x2104('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x571e0e['id']},'order':[[_0x2104('0x1f'),_0x2104('0x27')]]})[_0x2104('0xd')](function(_0x6a1897){var _0x525723=0x0;if(_0x6a1897){if(_0x6a1897[_0x2104('0x20')]+_0x6a1897[_0x2104('0x21')]+_0x6a1897['countnoanswerretry']+_0x6a1897[_0x2104('0x28')]+_0x6a1897[_0x2104('0x22')]+_0x6a1897[_0x2104('0x29')]+_0x6a1897['countmachineretry']+_0x6a1897[_0x2104('0x24')]<_0x39258d[_0x2104('0x25')]['dialGlobalMaxRetry'])_0x525723=0x1;_0x10e9c7({'additional':_0x525723});}else{_0x10e9c7({'additional':0x0});}})[_0x2104('0x2a')](function(_0xa4018e){logger['error'](_0x2104('0x18'),_0xa4018e['message']);_0x43130c(_0x4b5319[_0x2104('0x13')](0x1f4,_0xa4018e[_0x2104('0x16')]));});}})[_0x2104('0x2a')](function(_0x2b23af){logger[_0x2104('0x13')]('VerifyAdditionalPhones',_0x2b23af[_0x2104('0x16')]);_0x43130c(_0x4b5319['error'](0x1f4,_0x2b23af[_0x2104('0x16')]));});}else _0x10e9c7({'additional':0x0});});});};exports[_0x2104('0x2b')]=function(_0x824d80){var _0x35335e=this;return new Promise(function(_0x128804,_0xd7f39a){return db[_0x2104('0x19')][_0x2104('0x1e')]({'raw':!![],'where':{'ContactId':_0x824d80[_0x2104('0x1a')]['ContactId'],'ListId':_0x824d80[_0x2104('0x1a')]['ListId'],'VoiceQueueId':_0x824d80[_0x2104('0x1a')][_0x2104('0x1b')]===undefined?null:_0x824d80[_0x2104('0x1a')]['VoiceQueueId'],'CampaignId':_0x824d80[_0x2104('0x1a')]['CampaignId']===undefined?null:_0x824d80['body'][_0x2104('0x1c')]}})['then'](function(_0x433371){if(_0x433371!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x433371['id'],'OrderBy':{'$gte':_0x433371[_0x2104('0x1f')]}},'order':[['OrderBy',_0x2104('0x27')]]})[_0x2104('0xd')](function(_0x475e59){if(_0x475e59)return activateAdditionalPhone(_0x433371,_0x824d80[_0x2104('0x1a')],_0x475e59,_0x824d80['duration'],_0x824d80['waitTime'])[_0x2104('0xd')](function(_0x12b419){_0x128804(_0x12b419);});else{return db['CmHopperAdditionalPhone'][_0x2104('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x433371['id']},'order':[['OrderBy',_0x2104('0x27')]]})[_0x2104('0xd')](function(_0x40ab90){if(_0x40ab90)return activateAdditionalPhone(_0x433371,_0x824d80[_0x2104('0x1a')],_0x40ab90,_0x824d80[_0x2104('0x2c')],_0x824d80[_0x2104('0x2d')])[_0x2104('0xd')](function(_0x38bb51){_0x128804(_0x38bb51);});else{_0x128804({'id':_0x433371['id'],'phone':''});}})[_0x2104('0x2a')](function(_0x28a4d8){logger[_0x2104('0x13')](_0x2104('0x18'),_0x28a4d8['message']);_0xd7f39a(_0x35335e[_0x2104('0x13')](0x1f4,_0x28a4d8['message']));});}})[_0x2104('0x2a')](function(_0x32e3ac){logger[_0x2104('0x13')](_0x2104('0x18'),_0x32e3ac[_0x2104('0x16')]);_0xd7f39a(_0x35335e[_0x2104('0x13')](0x1f4,_0x32e3ac[_0x2104('0x16')]));});}else _0x128804(0x1);});});};function activateAdditionalPhone(_0x28ffe7,_0x5cbe64,_0x32798e,_0x35b919,_0x4c412b){return new Promise(function(_0x3cbfa8,_0x15615e){var _0x89327e;if(_[_0x2104('0x2e')](_0x32798e['scheduledat'])){_0x32798e[_0x2104('0x2f')]=moment();}if(moment()>moment(_0x32798e[_0x2104('0x2f')])){_0x89327e=moment()[_0x2104('0x30')](_0x4c412b||0x3,_0x2104('0x31'));}else{if(_0x32798e[_0x2104('0x1f')]==0x0){_0x89327e=moment(_0x32798e['scheduledat']);}else{_0x89327e=moment()[_0x2104('0x30')](_0x4c412b||0x3,_0x2104('0x31'));}}if(_[_0x2104('0x2e')](_0x89327e)){_0x89327e=moment()[_0x2104('0x30')](_0x4c412b||0x3,_0x2104('0x31'));}var _0x5ab0c9={'phone':_0x28ffe7[_0x2104('0x32')],'active':0x0,'OrderBy':_[_0x2104('0x2e')](_0x28ffe7[_0x2104('0x1f')])?0x0:_0x28ffe7[_0x2104('0x1f')],'scheduledat':moment()['add'](_0x35b919||0x1,'minutes'),'countbusyretry':_0x5cbe64[_0x2104('0x20')],'countcongestionretry':_0x5cbe64[_0x2104('0x21')],'countnoanswerretry':_0x5cbe64[_0x2104('0x33')],'countnosuchnumberretry':_0x5cbe64[_0x2104('0x28')],'countdropretry':_0x5cbe64[_0x2104('0x22')],'countabandonedretry':_0x5cbe64['countabandonedretry'],'countmachineretry':_0x5cbe64[_0x2104('0x23')],'countagentrejectretry':_0x5cbe64['countagentrejectretry'],'createdAt':_0x5cbe64[_0x2104('0x34')],'updatedAt':_0x5cbe64[_0x2104('0x35')]};var _0x2ce3f8={'CmHopperId':_0x28ffe7['id'],'phone':_0x32798e['phone'],'active':0x0,'OrderBy':_['isNil'](_0x32798e[_0x2104('0x1f')])?0x0:_0x32798e[_0x2104('0x1f')],'scheduledat':_0x89327e,'countbusyretry':_0x32798e[_0x2104('0x20')],'countcongestionretry':_0x32798e['countcongestionretry'],'countnoanswerretry':_0x32798e['countnoanswerretry'],'countnosuchnumberretry':_0x32798e['countnosuchnumberretry'],'countdropretry':_0x32798e['countdropretry'],'countabandonedretry':_0x32798e[_0x2104('0x29')],'countmachineretry':_0x32798e[_0x2104('0x23')],'countagentrejectretry':_0x32798e[_0x2104('0x24')],'createdAt':_0x32798e['createdAt'],'updatedAt':_0x32798e[_0x2104('0x35')]};return db['sequelize'][_0x2104('0x36')](function(_0x5db048){return db['CmHopperAdditionalPhone'][_0x2104('0x37')](_0x5ab0c9,{'where':{'id':_0x32798e['id']}},{'transaction':_0x5db048})['then'](function(){return db[_0x2104('0x19')][_0x2104('0x37')](_0x2ce3f8,{'where':{'id':_0x28ffe7['id']}},{'transaction':_0x5db048});});})[_0x2104('0xd')](function(_0x393c63){_0x3cbfa8({'id':_0x28ffe7['id'],'phone':_0x32798e['phone']});})[_0x2104('0x2a')](function(_0x2d51a2){logger[_0x2104('0x13')](_0x2104('0x38'),_0x2d51a2['message']);_0x15615e({'error':_0x2d51a2[_0x2104('0x16')]});});});}exports[_0x2104('0x39')]=function(_0x4fc5d8){var _0x1caf57=this;return new Promise(function(_0x5cc000,_0x3e159f){return db[_0x2104('0x19')][_0x2104('0x37')](_0x4fc5d8['body'][_0x2104('0x3a')],{'where':{'id':_0x4fc5d8[_0x2104('0x1a')]['id']}})['then'](function(_0x160926){_0x5cc000(_0x160926);})[_0x2104('0x2a')](function(_0x57992b){logger[_0x2104('0x13')](_0x2104('0x39'),_0x57992b['message']);_0x3e159f(_0x1caf57[_0x2104('0x13')](0x1f4,_0x57992b[_0x2104('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index bbb2eaa..0db0fc2 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d36=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','index','/:id','isAuthenticated','show','create','put','multer','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5d36,0x11a));var _0x65d3=function(_0x17e315,_0x361db6){_0x17e315=_0x17e315-0x0;var _0x3e7afb=_0x5d36[_0x17e315];return _0x3e7afb;};'use strict';var multer=require(_0x65d3('0x0'));var util=require(_0x65d3('0x1'));var path=require(_0x65d3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x65d3('0x3')]();var fs_extra=require(_0x65d3('0x4'));var auth=require(_0x65d3('0x5'));var interaction=require(_0x65d3('0x6'));var config=require(_0x65d3('0x7'));var controller=require(_0x65d3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x65d3('0x9')]);router['get'](_0x65d3('0xa'),auth[_0x65d3('0xb')](),controller[_0x65d3('0xc')]);router['post']('/',auth[_0x65d3('0xb')](),controller[_0x65d3('0xd')]);router[_0x65d3('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x65d3('0xa'),auth[_0x65d3('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf116=['index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated'];(function(_0x5a818d,_0x2e6f5f){var _0x494b9a=function(_0x228131){while(--_0x228131){_0x5a818d['push'](_0x5a818d['shift']());}};_0x494b9a(++_0x2e6f5f);}(_0xf116,0x16f));var _0x6f11=function(_0x3feab5,_0x1849cb){_0x3feab5=_0x3feab5-0x0;var _0x4fb9e9=_0xf116[_0x3feab5];return _0x4fb9e9;};'use strict';var multer=require('multer');var util=require(_0x6f11('0x0'));var path=require(_0x6f11('0x1'));var timeout=require(_0x6f11('0x2'));var express=require(_0x6f11('0x3'));var router=express[_0x6f11('0x4')]();var fs_extra=require(_0x6f11('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6f11('0x6'));var config=require(_0x6f11('0x7'));var controller=require(_0x6f11('0x8'));router[_0x6f11('0x9')]('/',auth[_0x6f11('0xa')](),controller[_0x6f11('0xb')]);router[_0x6f11('0x9')](_0x6f11('0xc'),auth[_0x6f11('0xa')](),controller[_0x6f11('0xd')]);router[_0x6f11('0xe')]('/',auth[_0x6f11('0xa')](),controller[_0x6f11('0xf')]);router[_0x6f11('0x10')](_0x6f11('0xc'),auth[_0x6f11('0xa')](),controller[_0x6f11('0x11')]);router[_0x6f11('0x12')](_0x6f11('0xc'),auth['isAuthenticated'](),controller[_0x6f11('0x13')]);module[_0x6f11('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 656c082..4d78adb 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.attributes.js +++ b/server/api/cmHopperBlack/cmHopperBlack.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x119a=['moment','sequelize','exports','INTEGER','contactListQueue'];(function(_0x395928,_0x51afb0){var _0x4efda4=function(_0x3a422e){while(--_0x3a422e){_0x395928['push'](_0x395928['shift']());}};_0x4efda4(++_0x51afb0);}(_0x119a,0x69));var _0xa119=function(_0x6a2596,_0x28a155){_0x6a2596=_0x6a2596-0x0;var _0x51c246=_0x119a[_0x6a2596];return _0x51c246;};'use strict';var moment=require(_0xa119('0x0'));var Sequelize=require(_0xa119('0x1'));module[_0xa119('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa119('0x3')],'unique':_0xa119('0x4')},'ListId':{'type':Sequelize[_0xa119('0x3')],'unique':_0xa119('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa119('0x4')}}; \ No newline at end of file +var _0x8e20=['contactListQueue','moment','sequelize','exports','INTEGER'];(function(_0x24c291,_0x5b00b1){var _0xa1e54a=function(_0x2961a5){while(--_0x2961a5){_0x24c291['push'](_0x24c291['shift']());}};_0xa1e54a(++_0x5b00b1);}(_0x8e20,0x1af));var _0x08e2=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0x8e20[_0x4d6ac0];return _0x5296c4;};'use strict';var moment=require(_0x08e2('0x0'));var Sequelize=require(_0x08e2('0x1'));module[_0x08e2('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x08e2('0x3')],'unique':_0x08e2('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x08e2('0x4')},'VoiceQueueId':{'type':Sequelize[_0x08e2('0x3')],'unique':_0x08e2('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index fddf841..eccc802 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe596=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','reject','save','then','destroy','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','options','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xe596,0x1b1));var _0x6e59=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe596[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x6e59('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e59('0x1'));var jsonpatch=require(_0x6e59('0x2'));var rp=require(_0x6e59('0x3'));var moment=require(_0x6e59('0x4'));var BPromise=require(_0x6e59('0x5'));var Mustache=require(_0x6e59('0x6'));var util=require(_0x6e59('0x7'));var path=require(_0x6e59('0x8'));var sox=require(_0x6e59('0x9'));var csv=require('to-csv');var ejs=require(_0x6e59('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e59('0xb'));var squel=require(_0x6e59('0xc'));var crypto=require('crypto');var jsforce=require(_0x6e59('0xd'));var deskjs=require(_0x6e59('0xe'));var toCsv=require(_0x6e59('0xf'));var querystring=require(_0x6e59('0x10'));var Papa=require(_0x6e59('0x11'));var Redis=require(_0x6e59('0x12'));var authService=require(_0x6e59('0x13'));var qs=require(_0x6e59('0x14'));var as=require(_0x6e59('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e59('0x16'))(_0x6e59('0x17'));var utils=require(_0x6e59('0x18'));var config=require(_0x6e59('0x19'));var licenseUtil=require(_0x6e59('0x1a'));var db=require(_0x6e59('0x1b'))['db'];function respondWithStatusCode(_0x107e33,_0x35b242){_0x35b242=_0x35b242||0xcc;return function(_0x447be8){if(_0x447be8){return _0x107e33[_0x6e59('0x1c')](_0x35b242);}return _0x107e33[_0x6e59('0x1d')](_0x35b242)[_0x6e59('0x1e')]();};}function respondWithResult(_0xad44a5,_0x1854d){_0x1854d=_0x1854d||0xc8;return function(_0x1aab95){if(_0x1aab95){return _0xad44a5[_0x6e59('0x1d')](_0x1854d)[_0x6e59('0x1f')](_0x1aab95);}};}function respondWithFilteredResult(_0x136b10,_0x38493e){return function(_0x28980b){if(_0x28980b){var _0x4d9538=typeof _0x38493e['offset']===_0x6e59('0x20')&&typeof _0x38493e['limit']==='undefined';var _0x25348d=_0x28980b[_0x6e59('0x21')];var _0x2f5302=_0x4d9538?0x0:_0x38493e[_0x6e59('0x22')];var _0x5a7fcb=_0x4d9538?_0x28980b[_0x6e59('0x21')]:_0x38493e['offset']+_0x38493e['limit'];var _0x34f084;if(_0x5a7fcb>=_0x25348d){_0x5a7fcb=_0x25348d;_0x34f084=0xc8;}else{_0x34f084=0xce;}_0x136b10[_0x6e59('0x1d')](_0x34f084);return _0x136b10[_0x6e59('0x23')]('Content-Range',_0x2f5302+'-'+_0x5a7fcb+'/'+_0x25348d)[_0x6e59('0x1f')](_0x28980b);}return null;};}function patchUpdates(_0x5cb05b){return function(_0x3b05fb){try{jsonpatch['apply'](_0x3b05fb,_0x5cb05b,!![]);}catch(_0x3ab5c4){return BPromise[_0x6e59('0x24')](_0x3ab5c4);}return _0x3b05fb[_0x6e59('0x25')]();};}function saveUpdates(_0x3ce7a2,_0x11bcd0){return function(_0x4eb36b){if(_0x4eb36b){return _0x4eb36b['update'](_0x3ce7a2)[_0x6e59('0x26')](function(_0x548cc8){return _0x548cc8;});}return null;};}function removeEntity(_0x2fb587,_0x173a83){return function(_0x39efbe){if(_0x39efbe){return _0x39efbe[_0x6e59('0x27')]()[_0x6e59('0x26')](function(){_0x2fb587[_0x6e59('0x1d')](0xcc)[_0x6e59('0x1e')]();});}};}function handleEntityNotFound(_0xa9383f,_0x4602b1){return function(_0x56fa5d){if(!_0x56fa5d){_0xa9383f[_0x6e59('0x1c')](0x194);}return _0x56fa5d;};}function handleError(_0x1f3e6c,_0x4204b2){_0x4204b2=_0x4204b2||0x1f4;return function(_0x428a51){logger[_0x6e59('0x28')](_0x428a51[_0x6e59('0x29')]);if(_0x428a51[_0x6e59('0x2a')]){delete _0x428a51['name'];}_0x1f3e6c['status'](_0x4204b2)[_0x6e59('0x2b')](_0x428a51);};}exports[_0x6e59('0x2c')]=function(_0x1feb0f,_0x4ce586){var _0x2bd515={},_0x566adb={},_0x233de9={'count':0x0,'rows':[]};var _0xcab3db=_['map'](db[_0x6e59('0x2d')][_0x6e59('0x2e')],function(_0x109531){return{'name':_0x109531[_0x6e59('0x2f')],'type':_0x109531[_0x6e59('0x30')][_0x6e59('0x31')]};});_0x566adb[_0x6e59('0x32')]=_[_0x6e59('0x33')](_0xcab3db,_0x6e59('0x2a'));_0x566adb[_0x6e59('0x34')]=_[_0x6e59('0x35')](_0x1feb0f[_0x6e59('0x34')]);_0x566adb[_0x6e59('0x36')]=_[_0x6e59('0x37')](_0x566adb[_0x6e59('0x32')],_0x566adb[_0x6e59('0x34')]);_0x2bd515[_0x6e59('0x38')]=_[_0x6e59('0x37')](_0x566adb[_0x6e59('0x32')],qs['fields'](_0x1feb0f[_0x6e59('0x34')][_0x6e59('0x39')]));_0x2bd515[_0x6e59('0x38')]=_0x2bd515[_0x6e59('0x38')][_0x6e59('0x3a')]?_0x2bd515[_0x6e59('0x38')]:_0x566adb[_0x6e59('0x32')];if(!_0x1feb0f[_0x6e59('0x34')]['hasOwnProperty']('nolimit')){_0x2bd515[_0x6e59('0x3b')]=qs[_0x6e59('0x3b')](_0x1feb0f[_0x6e59('0x34')][_0x6e59('0x3b')]);_0x2bd515[_0x6e59('0x22')]=qs['offset'](_0x1feb0f[_0x6e59('0x34')]['offset']);}_0x2bd515[_0x6e59('0x3c')]=qs[_0x6e59('0x3d')](_0x1feb0f[_0x6e59('0x34')]['sort']);_0x2bd515[_0x6e59('0x3e')]=qs['filters'](_['pick'](_0x1feb0f[_0x6e59('0x34')],_0x566adb['filters']),_0xcab3db);if(_0x1feb0f['query'][_0x6e59('0x3f')]){_0x2bd515[_0x6e59('0x3e')]=_[_0x6e59('0x40')](_0x2bd515['where'],{'$or':_[_0x6e59('0x33')](_0xcab3db,function(_0x24ff03){if(_0x24ff03[_0x6e59('0x30')]!=='VIRTUAL'){var _0x1b3728={};_0x1b3728[_0x24ff03['name']]={'$like':'%'+_0x1feb0f['query'][_0x6e59('0x3f')]+'%'};return _0x1b3728;}})});}_0x2bd515=_['merge']({},_0x2bd515,_0x1feb0f['options']);var _0xbce8={'where':_0x2bd515[_0x6e59('0x3e')]};return db[_0x6e59('0x2d')]['count'](_0xbce8)['then'](function(_0x1fe0c5){_0x233de9[_0x6e59('0x21')]=_0x1fe0c5;if(_0x1feb0f['query'][_0x6e59('0x41')]){_0x2bd515['include']=[{'all':!![]}];}return db[_0x6e59('0x2d')][_0x6e59('0x42')](_0x2bd515);})['then'](function(_0x3f7238){_0x233de9[_0x6e59('0x43')]=_0x3f7238;return _0x233de9;})[_0x6e59('0x26')](respondWithFilteredResult(_0x4ce586,_0x2bd515))[_0x6e59('0x44')](handleError(_0x4ce586,null));};exports[_0x6e59('0x45')]=function(_0x9599fd,_0x5dca60){var _0x2ec8d4={'raw':!![],'where':{'id':_0x9599fd['params']['id']}},_0xfb3ff9={};_0xfb3ff9['model']=_[_0x6e59('0x35')](db[_0x6e59('0x2d')][_0x6e59('0x2e')]);_0xfb3ff9['query']=_[_0x6e59('0x35')](_0x9599fd[_0x6e59('0x34')]);_0xfb3ff9[_0x6e59('0x36')]=_[_0x6e59('0x37')](_0xfb3ff9[_0x6e59('0x32')],_0xfb3ff9['query']);_0x2ec8d4[_0x6e59('0x38')]=_[_0x6e59('0x37')](_0xfb3ff9[_0x6e59('0x32')],qs['fields'](_0x9599fd[_0x6e59('0x34')][_0x6e59('0x39')]));_0x2ec8d4[_0x6e59('0x38')]=_0x2ec8d4[_0x6e59('0x38')][_0x6e59('0x3a')]?_0x2ec8d4['attributes']:_0xfb3ff9['model'];if(_0x9599fd[_0x6e59('0x34')][_0x6e59('0x41')]){_0x2ec8d4['include']=[{'all':!![]}];}_0x2ec8d4=_[_0x6e59('0x40')]({},_0x2ec8d4,_0x9599fd[_0x6e59('0x46')]);return db[_0x6e59('0x2d')][_0x6e59('0x47')](_0x2ec8d4)[_0x6e59('0x26')](handleEntityNotFound(_0x5dca60,null))[_0x6e59('0x26')](respondWithResult(_0x5dca60,null))[_0x6e59('0x44')](handleError(_0x5dca60,null));};exports['update']=function(_0x1ed749,_0x325160){if(_0x1ed749[_0x6e59('0x48')]['id']){delete _0x1ed749['body']['id'];}return db[_0x6e59('0x2d')][_0x6e59('0x47')]({'where':{'id':_0x1ed749[_0x6e59('0x49')]['id']}})['then'](handleEntityNotFound(_0x325160,null))[_0x6e59('0x26')](saveUpdates(_0x1ed749[_0x6e59('0x48')],null))[_0x6e59('0x26')](respondWithResult(_0x325160,null))[_0x6e59('0x44')](handleError(_0x325160,null));};exports[_0x6e59('0x27')]=function(_0x1afc64,_0x4a1cab){return db['CmHopperBlack'][_0x6e59('0x47')]({'where':{'id':_0x1afc64[_0x6e59('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a1cab,null))[_0x6e59('0x26')](removeEntity(_0x4a1cab,null))[_0x6e59('0x44')](handleError(_0x4a1cab,null));};exports[_0x6e59('0x4a')]=function(_0x3876d6,_0x2c9522){return db[_0x6e59('0x2d')][_0x6e59('0x4a')]()[_0x6e59('0x26')](respondWithResult(_0x2c9522,null))['catch'](handleError(_0x2c9522,null));}; \ No newline at end of file +var _0x12fc=['fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','length','find','params','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','then','sendStatus','error','stack','name','send','index','map','CmHopperBlack'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x12fc,0xb6));var _0xc12f=function(_0x1d61a5,_0x46cca2){_0x1d61a5=_0x1d61a5-0x0;var _0x59a87b=_0x12fc[_0x1d61a5];return _0x59a87b;};'use strict';var emlformat=require(_0xc12f('0x0'));var rimraf=require(_0xc12f('0x1'));var zipdir=require(_0xc12f('0x2'));var jsonpatch=require(_0xc12f('0x3'));var rp=require(_0xc12f('0x4'));var moment=require(_0xc12f('0x5'));var BPromise=require(_0xc12f('0x6'));var Mustache=require(_0xc12f('0x7'));var util=require(_0xc12f('0x8'));var path=require(_0xc12f('0x9'));var sox=require('sox');var csv=require(_0xc12f('0xa'));var ejs=require(_0xc12f('0xb'));var fs=require('fs');var fs_extra=require(_0xc12f('0xc'));var _=require(_0xc12f('0xd'));var squel=require(_0xc12f('0xe'));var crypto=require(_0xc12f('0xf'));var jsforce=require(_0xc12f('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc12f('0x11'));var Papa=require(_0xc12f('0x12'));var Redis=require('ioredis');var authService=require(_0xc12f('0x13'));var qs=require(_0xc12f('0x14'));var as=require(_0xc12f('0x15'));var hardwareService=require(_0xc12f('0x16'));var logger=require(_0xc12f('0x17'))(_0xc12f('0x18'));var utils=require(_0xc12f('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x568e44,_0x330405){_0x330405=_0x330405||0xcc;return function(_0x5a81e6){if(_0x5a81e6){return _0x568e44['sendStatus'](_0x330405);}return _0x568e44[_0xc12f('0x1a')](_0x330405)[_0xc12f('0x1b')]();};}function respondWithResult(_0x4a1a2f,_0x998276){_0x998276=_0x998276||0xc8;return function(_0xe54355){if(_0xe54355){return _0x4a1a2f[_0xc12f('0x1a')](_0x998276)[_0xc12f('0x1c')](_0xe54355);}};}function respondWithFilteredResult(_0x443472,_0x3f20a1){return function(_0xd363f7){if(_0xd363f7){var _0x3c8dda=typeof _0x3f20a1[_0xc12f('0x1d')]===_0xc12f('0x1e')&&typeof _0x3f20a1[_0xc12f('0x1f')]===_0xc12f('0x1e');var _0x27938f=_0xd363f7[_0xc12f('0x20')];var _0x59e102=_0x3c8dda?0x0:_0x3f20a1['offset'];var _0x4cc6ee=_0x3c8dda?_0xd363f7[_0xc12f('0x20')]:_0x3f20a1[_0xc12f('0x1d')]+_0x3f20a1[_0xc12f('0x1f')];var _0x2b98db;if(_0x4cc6ee>=_0x27938f){_0x4cc6ee=_0x27938f;_0x2b98db=0xc8;}else{_0x2b98db=0xce;}_0x443472[_0xc12f('0x1a')](_0x2b98db);return _0x443472['set'](_0xc12f('0x21'),_0x59e102+'-'+_0x4cc6ee+'/'+_0x27938f)[_0xc12f('0x1c')](_0xd363f7);}return null;};}function patchUpdates(_0xa29ce6){return function(_0x17e073){try{jsonpatch[_0xc12f('0x22')](_0x17e073,_0xa29ce6,!![]);}catch(_0x201033){return BPromise['reject'](_0x201033);}return _0x17e073[_0xc12f('0x23')]();};}function saveUpdates(_0x106033,_0x4e75ef){return function(_0xe6e170){if(_0xe6e170){return _0xe6e170['update'](_0x106033)['then'](function(_0x31689a){return _0x31689a;});}return null;};}function removeEntity(_0x105ae7,_0x57fe79){return function(_0x1316e9){if(_0x1316e9){return _0x1316e9[_0xc12f('0x24')]()[_0xc12f('0x25')](function(){_0x105ae7['status'](0xcc)[_0xc12f('0x1b')]();});}};}function handleEntityNotFound(_0x132736,_0x43b0da){return function(_0xd8c245){if(!_0xd8c245){_0x132736[_0xc12f('0x26')](0x194);}return _0xd8c245;};}function handleError(_0x1a08fe,_0xb04c67){_0xb04c67=_0xb04c67||0x1f4;return function(_0x210dae){logger[_0xc12f('0x27')](_0x210dae[_0xc12f('0x28')]);if(_0x210dae[_0xc12f('0x29')]){delete _0x210dae['name'];}_0x1a08fe[_0xc12f('0x1a')](_0xb04c67)[_0xc12f('0x2a')](_0x210dae);};}exports[_0xc12f('0x2b')]=function(_0x57076b,_0x48d0b7){var _0x57c5d1={},_0x46721e={},_0x153927={'count':0x0,'rows':[]};var _0x19a2e2=_[_0xc12f('0x2c')](db[_0xc12f('0x2d')]['rawAttributes'],function(_0x18a622){return{'name':_0x18a622[_0xc12f('0x2e')],'type':_0x18a622['type'][_0xc12f('0x2f')]};});_0x46721e[_0xc12f('0x30')]=_[_0xc12f('0x2c')](_0x19a2e2,_0xc12f('0x29'));_0x46721e['query']=_[_0xc12f('0x31')](_0x57076b[_0xc12f('0x32')]);_0x46721e['filters']=_[_0xc12f('0x33')](_0x46721e[_0xc12f('0x30')],_0x46721e[_0xc12f('0x32')]);_0x57c5d1[_0xc12f('0x34')]=_[_0xc12f('0x33')](_0x46721e[_0xc12f('0x30')],qs[_0xc12f('0x35')](_0x57076b[_0xc12f('0x32')]['fields']));_0x57c5d1[_0xc12f('0x34')]=_0x57c5d1[_0xc12f('0x34')]['length']?_0x57c5d1[_0xc12f('0x34')]:_0x46721e[_0xc12f('0x30')];if(!_0x57076b[_0xc12f('0x32')][_0xc12f('0x36')](_0xc12f('0x37'))){_0x57c5d1[_0xc12f('0x1f')]=qs[_0xc12f('0x1f')](_0x57076b[_0xc12f('0x32')]['limit']);_0x57c5d1[_0xc12f('0x1d')]=qs[_0xc12f('0x1d')](_0x57076b[_0xc12f('0x32')]['offset']);}_0x57c5d1[_0xc12f('0x38')]=qs[_0xc12f('0x39')](_0x57076b[_0xc12f('0x32')]['sort']);_0x57c5d1[_0xc12f('0x3a')]=qs[_0xc12f('0x3b')](_['pick'](_0x57076b['query'],_0x46721e[_0xc12f('0x3b')]),_0x19a2e2);if(_0x57076b[_0xc12f('0x32')][_0xc12f('0x3c')]){_0x57c5d1['where']=_['merge'](_0x57c5d1[_0xc12f('0x3a')],{'$or':_[_0xc12f('0x2c')](_0x19a2e2,function(_0x5d21d6){if(_0x5d21d6[_0xc12f('0x3d')]!==_0xc12f('0x3e')){var _0x191f9f={};_0x191f9f[_0x5d21d6[_0xc12f('0x29')]]={'$like':'%'+_0x57076b['query'][_0xc12f('0x3c')]+'%'};return _0x191f9f;}})});}_0x57c5d1=_[_0xc12f('0x3f')]({},_0x57c5d1,_0x57076b[_0xc12f('0x40')]);var _0x2533b8={'where':_0x57c5d1[_0xc12f('0x3a')]};return db[_0xc12f('0x2d')][_0xc12f('0x20')](_0x2533b8)['then'](function(_0x827aed){_0x153927[_0xc12f('0x20')]=_0x827aed;if(_0x57076b[_0xc12f('0x32')][_0xc12f('0x41')]){_0x57c5d1[_0xc12f('0x42')]=[{'all':!![]}];}return db[_0xc12f('0x2d')][_0xc12f('0x43')](_0x57c5d1);})[_0xc12f('0x25')](function(_0x159182){_0x153927['rows']=_0x159182;return _0x153927;})[_0xc12f('0x25')](respondWithFilteredResult(_0x48d0b7,_0x57c5d1))[_0xc12f('0x44')](handleError(_0x48d0b7,null));};exports[_0xc12f('0x45')]=function(_0x4624a7,_0x11f9dc){var _0x22e26b={'raw':!![],'where':{'id':_0x4624a7['params']['id']}},_0xb788e7={};_0xb788e7[_0xc12f('0x30')]=_[_0xc12f('0x31')](db[_0xc12f('0x2d')][_0xc12f('0x46')]);_0xb788e7[_0xc12f('0x32')]=_['keys'](_0x4624a7['query']);_0xb788e7[_0xc12f('0x3b')]=_['intersection'](_0xb788e7[_0xc12f('0x30')],_0xb788e7[_0xc12f('0x32')]);_0x22e26b[_0xc12f('0x34')]=_['intersection'](_0xb788e7['model'],qs['fields'](_0x4624a7[_0xc12f('0x32')][_0xc12f('0x35')]));_0x22e26b[_0xc12f('0x34')]=_0x22e26b[_0xc12f('0x34')][_0xc12f('0x47')]?_0x22e26b[_0xc12f('0x34')]:_0xb788e7[_0xc12f('0x30')];if(_0x4624a7[_0xc12f('0x32')][_0xc12f('0x41')]){_0x22e26b[_0xc12f('0x42')]=[{'all':!![]}];}_0x22e26b=_[_0xc12f('0x3f')]({},_0x22e26b,_0x4624a7[_0xc12f('0x40')]);return db[_0xc12f('0x2d')][_0xc12f('0x48')](_0x22e26b)[_0xc12f('0x25')](handleEntityNotFound(_0x11f9dc,null))[_0xc12f('0x25')](respondWithResult(_0x11f9dc,null))['catch'](handleError(_0x11f9dc,null));};exports['update']=function(_0x4e9f7d,_0x4af176){if(_0x4e9f7d['body']['id']){delete _0x4e9f7d['body']['id'];}return db[_0xc12f('0x2d')]['find']({'where':{'id':_0x4e9f7d[_0xc12f('0x49')]['id']}})['then'](handleEntityNotFound(_0x4af176,null))[_0xc12f('0x25')](saveUpdates(_0x4e9f7d[_0xc12f('0x4a')],null))[_0xc12f('0x25')](respondWithResult(_0x4af176,null))[_0xc12f('0x44')](handleError(_0x4af176,null));};exports[_0xc12f('0x24')]=function(_0x44ea2d,_0x466fa5){return db['CmHopperBlack'][_0xc12f('0x48')]({'where':{'id':_0x44ea2d[_0xc12f('0x49')]['id']}})['then'](handleEntityNotFound(_0x466fa5,null))[_0xc12f('0x25')](removeEntity(_0x466fa5,null))[_0xc12f('0x44')](handleError(_0x466fa5,null));};exports[_0xc12f('0x4b')]=function(_0x162f92,_0x437656){return db[_0xc12f('0x2d')][_0xc12f('0x4b')]()[_0xc12f('0x25')](respondWithResult(_0x437656,null))[_0xc12f('0x44')](handleError(_0x437656,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 29c987f..2bb1087 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.model.js +++ b/server/api/cmHopperBlack/cmHopperBlack.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b3d=['CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x441874,_0x292fdb){var _0x357378=function(_0x3df16a){while(--_0x3df16a){_0x441874['push'](_0x441874['shift']());}};_0x357378(++_0x292fdb);}(_0x3b3d,0x1ee));var _0xd3b3=function(_0x45b55e,_0x3213a0){_0x45b55e=_0x45b55e-0x0;var _0x437be0=_0x3b3d[_0x45b55e];return _0x437be0;};'use strict';var _=require(_0xd3b3('0x0'));var util=require('util');var logger=require(_0xd3b3('0x1'))(_0xd3b3('0x2'));var moment=require('moment');var BPromise=require(_0xd3b3('0x3'));var rp=require(_0xd3b3('0x4'));var fs=require('fs');var path=require(_0xd3b3('0x5'));var rimraf=require(_0xd3b3('0x6'));var config=require(_0xd3b3('0x7'));var attributes=require(_0xd3b3('0x8'));module[_0xd3b3('0x9')]=function(_0x176215,_0xe8efde){return _0x176215['define'](_0xd3b3('0xa'),attributes,{'tableName':_0xd3b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6004=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x395559,_0x2777d0){var _0x31f5e2=function(_0x21f31a){while(--_0x21f31a){_0x395559['push'](_0x395559['shift']());}};_0x31f5e2(++_0x2777d0);}(_0x6004,0x131));var _0x4600=function(_0x15e1b9,_0x1d32e6){_0x15e1b9=_0x15e1b9-0x0;var _0x418317=_0x6004[_0x15e1b9];return _0x418317;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4600('0x0'))('api');var moment=require(_0x4600('0x1'));var BPromise=require(_0x4600('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4600('0x3'));var config=require(_0x4600('0x4'));var attributes=require(_0x4600('0x5'));module[_0x4600('0x6')]=function(_0x2358f8,_0x432f1a){return _0x2358f8[_0x4600('0x7')](_0x4600('0x8'),attributes,{'tableName':_0x4600('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 93cd345..4b8a9e5 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.rpc.js +++ b/server/api/cmHopperBlack/cmHopperBlack.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78af=['catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','map','model','include','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x78af,0x1e4));var _0xf78a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x78af[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xf78a('0x0'));var util=require('util');var moment=require(_0xf78a('0x1'));var BPromise=require(_0xf78a('0x2'));var rs=require(_0xf78a('0x3'));var fs=require('fs');var Redis=require(_0xf78a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf78a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf78a('0x6'));var jayson=require(_0xf78a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26b6c3,_0x573cbd,_0x58a26e){return new BPromise(function(_0x278635,_0x14022d){return client[_0xf78a('0x8')](_0x26b6c3,_0x58a26e)[_0xf78a('0x9')](function(_0x23beec){logger['info'](_0xf78a('0xa'),_0x573cbd,_0xf78a('0xb'));logger[_0xf78a('0xc')](_0xf78a('0xd'),_0x573cbd,_0xf78a('0xb'),JSON[_0xf78a('0xe')](_0x23beec));if(_0x23beec[_0xf78a('0xf')]){if(_0x23beec[_0xf78a('0xf')][_0xf78a('0x10')]===0x1f4){logger[_0xf78a('0xf')](_0xf78a('0xa'),_0x573cbd,_0x23beec[_0xf78a('0xf')][_0xf78a('0x11')]);return _0x14022d(_0x23beec[_0xf78a('0xf')][_0xf78a('0x11')]);}logger[_0xf78a('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x573cbd,_0x23beec[_0xf78a('0xf')][_0xf78a('0x11')]);return _0x278635(_0x23beec[_0xf78a('0xf')][_0xf78a('0x11')]);}else{logger[_0xf78a('0x12')](_0xf78a('0xa'),_0x573cbd,_0xf78a('0xb'));_0x278635(_0x23beec[_0xf78a('0x13')][_0xf78a('0x11')]);}})[_0xf78a('0x14')](function(_0x4fc5ef){logger[_0xf78a('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x573cbd,_0x4fc5ef);_0x14022d(_0x4fc5ef);});});}exports[_0xf78a('0x15')]=function(_0x252c6c){var _0x54fec0=this;return new Promise(function(_0x89634c,_0x591734){return db[_0xf78a('0x16')][_0xf78a('0x17')]({'raw':_0x252c6c[_0xf78a('0x18')]?_0x252c6c['options'][_0xf78a('0x19')]===undefined?!![]:![]:!![],'where':_0x252c6c[_0xf78a('0x18')]?_0x252c6c[_0xf78a('0x18')][_0xf78a('0x1a')]||null:null,'attributes':_0x252c6c[_0xf78a('0x18')]?_0x252c6c[_0xf78a('0x18')][_0xf78a('0x1b')]||null:null,'limit':_0x252c6c[_0xf78a('0x18')]?_0x252c6c[_0xf78a('0x18')][_0xf78a('0x1c')]||null:null,'include':_0x252c6c[_0xf78a('0x18')]?_0x252c6c[_0xf78a('0x18')]['include']?_[_0xf78a('0x1d')](_0x252c6c[_0xf78a('0x18')]['include'],function(_0x1283f7){return{'model':db[_0x1283f7[_0xf78a('0x1e')]],'as':_0x1283f7['as'],'attributes':_0x1283f7[_0xf78a('0x1b')],'include':_0x1283f7[_0xf78a('0x1f')]?_[_0xf78a('0x1d')](_0x1283f7['include'],function(_0x45d2b9){return{'model':db[_0x45d2b9[_0xf78a('0x1e')]],'as':_0x45d2b9['as'],'attributes':_0x45d2b9[_0xf78a('0x1b')],'include':_0x45d2b9['include']?_[_0xf78a('0x1d')](_0x45d2b9[_0xf78a('0x1f')],function(_0x19d576){return{'model':db[_0x19d576[_0xf78a('0x1e')]],'as':_0x19d576['as'],'attributes':_0x19d576[_0xf78a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf78a('0x9')](function(_0x4a4573){logger['info']('GetCmHopperBlack',_0x252c6c);logger[_0xf78a('0xc')](_0xf78a('0x15'),_0x252c6c,JSON[_0xf78a('0xe')](_0x4a4573));_0x89634c(_0x4a4573);})['catch'](function(_0x2935ca){logger[_0xf78a('0xf')](_0xf78a('0x15'),_0x2935ca['message'],_0x252c6c);_0x591734(_0x54fec0[_0xf78a('0xf')](0x1f4,_0x2935ca[_0xf78a('0x11')]));});});};exports[_0xf78a('0x20')]=function(_0x13ddde){var _0x2dee6b=this;return new Promise(function(_0x1752d8,_0xee6f28){return db['CmHopperBlack'][_0xf78a('0x21')](_0x13ddde[_0xf78a('0x22')],{'raw':_0x13ddde['options']?_0x13ddde['options'][_0xf78a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13ddde[_0xf78a('0x18')]?_0x13ddde['options']['where']||null:null,'attributes':_0x13ddde['options']?_0x13ddde['options'][_0xf78a('0x1b')]||null:null,'limit':_0x13ddde['options']?_0x13ddde['options'][_0xf78a('0x1c')]||null:null})[_0xf78a('0x9')](function(_0x51b345){logger['info'](_0xf78a('0x20'),_0x13ddde);logger[_0xf78a('0xc')](_0xf78a('0x20'),_0x13ddde,JSON[_0xf78a('0xe')](_0x51b345));_0x1752d8(_0x51b345);})[_0xf78a('0x14')](function(_0x190ed5){logger[_0xf78a('0xf')](_0xf78a('0x20'),_0x190ed5[_0xf78a('0x11')],_0x13ddde);_0xee6f28(_0x2dee6b[_0xf78a('0xf')](0x1f4,_0x190ed5[_0xf78a('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x5a2f79){var _0x23ba71=this;return new Promise(function(_0x595bff,_0x1d1cb6){return db[_0xf78a('0x16')]['destroy']({'where':_0x5a2f79[_0xf78a('0x18')]?_0x5a2f79[_0xf78a('0x18')][_0xf78a('0x1a')]||null:null})['then'](function(_0x18ab18){logger[_0xf78a('0x12')](_0xf78a('0x23'),_0x5a2f79);logger[_0xf78a('0xc')]('DestroyCmHopperBlack',_0x5a2f79,JSON['stringify'](_0x18ab18));_0x595bff(_0x18ab18);})[_0xf78a('0x14')](function(_0x5651a6){logger[_0xf78a('0xf')](_0xf78a('0x23'),_0x5651a6[_0xf78a('0x11')],_0x5a2f79);_0x1d1cb6(_0x23ba71[_0xf78a('0xf')](0x1f4,_0x5651a6[_0xf78a('0x11')]));});});}; \ No newline at end of file +var _0x6d14=['../../mysqldb','jayson/promise','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','CmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring'];(function(_0x3e0129,_0x43fe29){var _0x59bc3a=function(_0x3fe20f){while(--_0x3fe20f){_0x3e0129['push'](_0x3e0129['shift']());}};_0x59bc3a(++_0x43fe29);}(_0x6d14,0xd3));var _0x46d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x46d1('0x0'));var util=require(_0x46d1('0x1'));var moment=require(_0x46d1('0x2'));var BPromise=require(_0x46d1('0x3'));var rs=require(_0x46d1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46d1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x46d1('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb44f8,_0x212a2c,_0x53acc5){return new BPromise(function(_0x49df3f,_0x10c518){return client[_0x46d1('0x7')](_0xb44f8,_0x53acc5)[_0x46d1('0x8')](function(_0xe9f50){logger[_0x46d1('0x9')](_0x46d1('0xa'),_0x212a2c,_0x46d1('0xb'));logger[_0x46d1('0xc')](_0x46d1('0xd'),_0x212a2c,_0x46d1('0xb'),JSON[_0x46d1('0xe')](_0xe9f50));if(_0xe9f50[_0x46d1('0xf')]){if(_0xe9f50[_0x46d1('0xf')][_0x46d1('0x10')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x212a2c,_0xe9f50[_0x46d1('0xf')][_0x46d1('0x11')]);return _0x10c518(_0xe9f50[_0x46d1('0xf')][_0x46d1('0x11')]);}logger[_0x46d1('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x212a2c,_0xe9f50[_0x46d1('0xf')][_0x46d1('0x11')]);return _0x49df3f(_0xe9f50[_0x46d1('0xf')][_0x46d1('0x11')]);}else{logger[_0x46d1('0x9')](_0x46d1('0xa'),_0x212a2c,_0x46d1('0xb'));_0x49df3f(_0xe9f50[_0x46d1('0x12')]['message']);}})[_0x46d1('0x13')](function(_0xb0db96){logger[_0x46d1('0xf')](_0x46d1('0xa'),_0x212a2c,_0xb0db96);_0x10c518(_0xb0db96);});});}exports[_0x46d1('0x14')]=function(_0x6412de){var _0x1e333f=this;return new Promise(function(_0x1a8da9,_0x222406){return db['CmHopperBlack'][_0x46d1('0x15')]({'raw':_0x6412de[_0x46d1('0x16')]?_0x6412de[_0x46d1('0x16')][_0x46d1('0x17')]===undefined?!![]:![]:!![],'where':_0x6412de['options']?_0x6412de[_0x46d1('0x16')][_0x46d1('0x18')]||null:null,'attributes':_0x6412de['options']?_0x6412de[_0x46d1('0x16')][_0x46d1('0x19')]||null:null,'limit':_0x6412de[_0x46d1('0x16')]?_0x6412de['options'][_0x46d1('0x1a')]||null:null,'include':_0x6412de[_0x46d1('0x16')]?_0x6412de[_0x46d1('0x16')][_0x46d1('0x1b')]?_[_0x46d1('0x1c')](_0x6412de[_0x46d1('0x16')][_0x46d1('0x1b')],function(_0x22a5d1){return{'model':db[_0x22a5d1[_0x46d1('0x1d')]],'as':_0x22a5d1['as'],'attributes':_0x22a5d1[_0x46d1('0x19')],'include':_0x22a5d1[_0x46d1('0x1b')]?_[_0x46d1('0x1c')](_0x22a5d1['include'],function(_0x9935c5){return{'model':db[_0x9935c5[_0x46d1('0x1d')]],'as':_0x9935c5['as'],'attributes':_0x9935c5[_0x46d1('0x19')],'include':_0x9935c5[_0x46d1('0x1b')]?_[_0x46d1('0x1c')](_0x9935c5[_0x46d1('0x1b')],function(_0x4675da){return{'model':db[_0x4675da[_0x46d1('0x1d')]],'as':_0x4675da['as'],'attributes':_0x4675da[_0x46d1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c5c33){logger[_0x46d1('0x9')](_0x46d1('0x14'),_0x6412de);logger[_0x46d1('0xc')](_0x46d1('0x14'),_0x6412de,JSON['stringify'](_0x2c5c33));_0x1a8da9(_0x2c5c33);})[_0x46d1('0x13')](function(_0x5ce077){logger['error'](_0x46d1('0x14'),_0x5ce077['message'],_0x6412de);_0x222406(_0x1e333f[_0x46d1('0xf')](0x1f4,_0x5ce077[_0x46d1('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x38e87b){var _0x5e1d44=this;return new Promise(function(_0xdfcbad,_0x1f2ee5){return db[_0x46d1('0x1e')][_0x46d1('0x1f')](_0x38e87b[_0x46d1('0x20')],{'raw':_0x38e87b[_0x46d1('0x16')]?_0x38e87b[_0x46d1('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38e87b[_0x46d1('0x16')]?_0x38e87b[_0x46d1('0x16')]['where']||null:null,'attributes':_0x38e87b[_0x46d1('0x16')]?_0x38e87b['options'][_0x46d1('0x19')]||null:null,'limit':_0x38e87b['options']?_0x38e87b['options'][_0x46d1('0x1a')]||null:null})['then'](function(_0x18718a){logger['info']('UpdateCmHopperBlack',_0x38e87b);logger[_0x46d1('0xc')]('UpdateCmHopperBlack',_0x38e87b,JSON[_0x46d1('0xe')](_0x18718a));_0xdfcbad(_0x18718a);})[_0x46d1('0x13')](function(_0x1f3e1e){logger[_0x46d1('0xf')](_0x46d1('0x21'),_0x1f3e1e[_0x46d1('0x11')],_0x38e87b);_0x1f2ee5(_0x5e1d44[_0x46d1('0xf')](0x1f4,_0x1f3e1e[_0x46d1('0x11')]));});});};exports[_0x46d1('0x22')]=function(_0x43004c){var _0x3f71ce=this;return new Promise(function(_0x2b81ee,_0x540823){return db['CmHopperBlack'][_0x46d1('0x23')]({'where':_0x43004c[_0x46d1('0x16')]?_0x43004c[_0x46d1('0x16')][_0x46d1('0x18')]||null:null})[_0x46d1('0x8')](function(_0xd6e873){logger[_0x46d1('0x9')](_0x46d1('0x22'),_0x43004c);logger['debug'](_0x46d1('0x22'),_0x43004c,JSON['stringify'](_0xd6e873));_0x2b81ee(_0xd6e873);})[_0x46d1('0x13')](function(_0x470683){logger[_0x46d1('0xf')](_0x46d1('0x22'),_0x470683[_0x46d1('0x11')],_0x43004c);_0x540823(_0x3f71ce[_0x46d1('0xf')](0x1f4,_0x470683[_0x46d1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a5e9ad6..7a66e3e 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d04=['show','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id'];(function(_0x92c03c,_0x413eca){var _0x5bd89d=function(_0x15ff21){while(--_0x15ff21){_0x92c03c['push'](_0x92c03c['shift']());}};_0x5bd89d(++_0x413eca);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['put']('/:id',auth[_0x43d0('0xb')](),controller['update']);router['delete'](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xf')]);module[_0x43d0('0x10')]=router; \ No newline at end of file +var _0x2542=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete'];(function(_0x38d2b1,_0x2778b3){var _0x38a5d0=function(_0x330cc1){while(--_0x330cc1){_0x38d2b1['push'](_0x38d2b1['shift']());}};_0x38a5d0(++_0x2778b3);}(_0x2542,0x169));var _0x2254=function(_0x1d1739,_0x3a10b7){_0x1d1739=_0x1d1739-0x0;var _0x38ad95=_0x2542[_0x1d1739];return _0x38ad95;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')](_0x2254('0xe'),auth['isAuthenticated'](),controller[_0x2254('0x11')]);router[_0x2254('0x12')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2e8b4a9..876912d 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.attributes.js +++ b/server/api/cmHopperFinal/cmHopperFinal.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa016=['setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','endtime'];(function(_0x61115c,_0x221d6f){var _0x465b64=function(_0x2bdb07){while(--_0x2bdb07){_0x61115c['push'](_0x61115c['shift']());}};_0x465b64(++_0x221d6f);}(_0xa016,0x72));var _0x6a01=function(_0x4fd37b,_0x4a6ee6){_0x4fd37b=_0x4fd37b-0x0;var _0x1b4ea1=_0xa016[_0x4fd37b];return _0x1b4ea1;};'use strict';var Sequelize=require(_0x6a01('0x0'));var moment=require(_0x6a01('0x1'));module[_0x6a01('0x2')]={'state':{'type':Sequelize[_0x6a01('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x6a01('0x4')]},'scheduledat':{'type':Sequelize[_0x6a01('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x6a01('0x4')]},'calleridnum':{'type':Sequelize[_0x6a01('0x4')]},'calleridname':{'type':Sequelize[_0x6a01('0x4')]},'starttime':{'type':Sequelize[_0x6a01('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6a01('0x5')]},'droptime':{'type':Sequelize[_0x6a01('0x5')]},'endtime':{'type':Sequelize[_0x6a01('0x5')]},'ringtime':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6a01('0x4')]},'campaign':{'type':Sequelize[_0x6a01('0x4')]},'campaigntype':{'type':Sequelize[_0x6a01('0x4')]},'membername':{'type':Sequelize[_0x6a01('0x4')]},'reason':{'type':Sequelize[_0x6a01('0x4')]},'disposition':{'type':Sequelize[_0x6a01('0x4')]},'secondDisposition':{'type':Sequelize[_0x6a01('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x6a01('0x5')],'set':function(_0x506f4b){var _0x2d1579=this['getDataValue'](_0x6a01('0x6'));if(_0x2d1579&&_0x506f4b){this[_0x6a01('0x7')](_0x6a01('0x8'),moment(_0x506f4b)[_0x6a01('0x9')](moment(_0x2d1579),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x6a01('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6a01('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6a01('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6a01('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6a01('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6a01('0x5')]},'deleted':{'type':Sequelize[_0x6a01('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6a01('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6a01('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf733=['getDataValue','endtime','followuptime','diff','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE'];(function(_0x2b88c5,_0x494b55){var _0x1e9b91=function(_0x4df4a0){while(--_0x4df4a0){_0x2b88c5['push'](_0x2b88c5['shift']());}};_0x1e9b91(++_0x494b55);}(_0xf733,0xaf));var _0x3f73=function(_0x413426,_0x4f7814){_0x413426=_0x413426-0x0;var _0x5576e2=_0xf733[_0x413426];return _0x5576e2;};'use strict';var Sequelize=require(_0x3f73('0x0'));var moment=require(_0x3f73('0x1'));module['exports']={'state':{'type':Sequelize[_0x3f73('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3f73('0x3')]},'scheduledat':{'type':Sequelize[_0x3f73('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3f73('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3f73('0x3')]},'originatecalleridname':{'type':Sequelize[_0x3f73('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3f73('0x3')]},'starttime':{'type':Sequelize[_0x3f73('0x4')]},'responsetime':{'type':Sequelize[_0x3f73('0x4')]},'answertime':{'type':Sequelize[_0x3f73('0x4')]},'droptime':{'type':Sequelize[_0x3f73('0x4')]},'endtime':{'type':Sequelize[_0x3f73('0x4')]},'ringtime':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3f73('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3f73('0x3')]},'membername':{'type':Sequelize[_0x3f73('0x3')]},'reason':{'type':Sequelize[_0x3f73('0x3')]},'disposition':{'type':Sequelize[_0x3f73('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x3f73('0x4')],'set':function(_0x2cdef3){var _0xd4c149=this[_0x3f73('0x5')](_0x3f73('0x6'));if(_0xd4c149&&_0x2cdef3){this['setDataValue'](_0x3f73('0x7'),moment(_0x2cdef3)[_0x3f73('0x8')](moment(_0xd4c149),'seconds'));}}},'amd':{'type':Sequelize[_0x3f73('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3f73('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3f73('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3f73('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x3f73('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x3f73('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3f73('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3f73('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index fc2216a..013cb92 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9536=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','CmHopperFinal','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ListId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ListId)','CampaignId\x20=\x20?','cm_hopper_final','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0xe4528a,_0x12c141){var _0x35c55c=function(_0x4d63cc){while(--_0x4d63cc){_0xe4528a['push'](_0xe4528a['shift']());}};_0x35c55c(++_0x12c141);}(_0x9536,0x179));var _0x6953=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0x9536[_0x5235dd];return _0x13059d;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':!![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['describe']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['describe']()[_0x6953('0x3c')](respondWithResult(_0x1d5979,null))[_0x6953('0x41')](handleError(_0x1d5979,null));};exports['update']=function(_0x525145,_0xbf5b61){if(_0x525145[_0x6953('0x48')][_0x6953('0x49')]){delete _0x525145[_0x6953('0x48')][_0x6953('0x49')];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'uniqueid':_0x525145[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xbf5b61,null))[_0x6953('0x3c')](saveUpdates(_0x525145[_0x6953('0x48')],null))['then'](respondWithResult(_0xbf5b61,null))['catch'](handleError(_0xbf5b61,null));};exports[_0x6953('0x4a')]=function(_0x38e3e8,_0x68ab5d,_0x7bcd92){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x38e3e8[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db['sequelize']['fn']('COUNT',db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db['sequelize']['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db['sequelize']['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x57')))),'reCallContacts'],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x58')))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x68ab5d,null))['then'](respondWithResult(_0x68ab5d,null))[_0x6953('0x41')](handleError(_0x68ab5d,null));};exports[_0x6953('0x5a')]=function(_0x35ac0e,_0x57ffab,_0x479ab4){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'CampaignId':_0x35ac0e[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5b')))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5c')))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5d')))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x57')))),_0x6953('0x5e')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x57ffab,null))['then'](respondWithResult(_0x57ffab,null))[_0x6953('0x41')](handleError(_0x57ffab,null));};exports[_0x6953('0x5f')]=function(_0x41d74d,_0x5063ac,_0x4cb8a4){return db[_0x6953('0x60')][_0x6953('0x47')]({'where':{'id':_0x41d74d[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x5063ac,null))[_0x6953('0x3c')](function(_0x43a39f){var _0x3cf1c0;if(_0x43a39f){_0x3cf1c0=squel[_0x6953('0x61')]()[_0x6953('0x62')]('cm_hopper')[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),_0x6953('0x66'),'ListId',_0x6953('0x67'),_0x6953('0x68'),_0x6953('0x69')],squel['select']()[_0x6953('0x6a')](_0x6953('0x6b'),_0x6953('0x64'))[_0x6953('0x6a')]('NOW()',_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field']('ANY_VALUE(ListId)',_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x68'))[_0x6953('0x6a')]('NOW()',_0x6953('0x69'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id']['toString']())['where'](_0x6953('0x71'),_0x41d74d[_0x6953('0x48')][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x64'))[_0x6953('0x6f')](_0x6953('0x76'))[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id'][_0x6953('0x73')]()))['where'](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x77'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))['group'](_0x6953('0x66')))[_0x6953('0x73')]();return db[_0x6953('0x4b')][_0x6953('0x2e')](_0x3cf1c0);}return[];})[_0x6953('0x3c')](respondWithResult(_0x5063ac,null))[_0x6953('0x41')](handleError(_0x5063ac,null));};exports[_0x6953('0x79')]=function(_0xa26241,_0xefb593,_0x216b92){return db[_0x6953('0x7a')]['find']({'where':{'id':_0xa26241[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xefb593,null))[_0x6953('0x3c')](function(_0x396a9f){var _0x92c0bc;if(_0x396a9f){_0x92c0bc=squel[_0x6953('0x61')]()[_0x6953('0x62')](_0x6953('0x76'))[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),'ContactId',_0x6953('0x6d'),_0x6953('0x7b'),_0x6953('0x68'),'updatedAt'],squel[_0x6953('0x7c')]()['field']('ANY_VALUE(calleridnum)',_0x6953('0x64'))[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field'](_0x6953('0x7d'),_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(CampaignId)',_0x6953('0x7b'))[_0x6953('0x6a')]('NOW()',_0x6953('0x68'))['field']('NOW()',_0x6953('0x69'))['from']('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id']['toString']())[_0x6953('0x39')](_0x6953('0x71'),_0xa26241['body'][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x64'))['from'](_0x6953('0x76'))[_0x6953('0x39')]('CampaignId\x20=\x20?',_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]()))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x77'))['from'](_0x6953('0x7f'))[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))[_0x6953('0x80')](_0x6953('0x66')))['toString']();return db[_0x6953('0x4b')]['query'](_0x92c0bc);}return[];})[_0x6953('0x3c')](respondWithResult(_0xefb593,null))['catch'](handleError(_0xefb593,null));};exports[_0x6953('0x81')]=function(_0x7215ed,_0x3cb96a,_0x46bcec){return db[_0x6953('0x82')]['findOne']({'where':{'VoiceQueueId':_0x7215ed[_0x6953('0x48')]['VoiceQueueId'],'CampaignId':_0x7215ed[_0x6953('0x48')][_0x6953('0x7b')],'ContactId':_0x7215ed[_0x6953('0x48')][_0x6953('0x66')]}})['then'](handleEntityNotFound(_0x3cb96a,null))[_0x6953('0x3c')](function(_0x50f019){if(_0x50f019){return _0x50f019;}return null;})[_0x6953('0x3c')](respondWithResult(_0x3cb96a,null))[_0x6953('0x41')](handleError(_0x3cb96a,null));}; \ No newline at end of file +var _0x33af=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1a0ad9,_0x47dc23){var _0x457565=function(_0x1fd327){while(--_0x1fd327){_0x1a0ad9['push'](_0x1a0ad9['shift']());}};_0x457565(++_0x47dc23);}(_0x33af,0xec));var _0xf33a=function(_0x4cefc3,_0x23f291){_0x4cefc3=_0x4cefc3-0x0;var _0x1cc779=_0x33af[_0x4cefc3];return _0x1cc779;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['CmHopperFinal'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':!![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')]()[_0xf33a('0x26')](respondWithResult(_0x1a98f9,null))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x4107b1,_0x190a2b){if(_0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')]){delete _0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')];}return db[_0xf33a('0x2d')][_0xf33a('0x4a')]({'where':{'uniqueid':_0x4107b1[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x190a2b,null))[_0xf33a('0x26')](saveUpdates(_0x4107b1[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x190a2b,null))[_0xf33a('0x42')](handleError(_0x190a2b,null));};exports[_0xf33a('0x4b')]=function(_0x3bab07,_0x1f7d8c,_0x57815c){return db['CmHopperFinal'][_0xf33a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x3bab07[_0xf33a('0x44')]['id']},'attributes':[[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x4e')))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xf33a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),'dropContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x56')))),_0xf33a('0x57')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),'answeringMachine']]})[_0xf33a('0x26')](handleEntityNotFound(_0x1f7d8c,null))[_0xf33a('0x26')](respondWithResult(_0x1f7d8c,null))[_0xf33a('0x42')](handleError(_0x1f7d8c,null));};exports[_0xf33a('0x59')]=function(_0x2f1fef,_0x129229,_0x473484){return db[_0xf33a('0x2d')][_0xf33a('0x40')]({'raw':![],'where':{'CampaignId':_0x2f1fef[_0xf33a('0x44')]['id']},'attributes':[[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x51')))),_0xf33a('0x5a')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5b')))),'congestionContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),_0xf33a('0x5c')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5d')))),_0xf33a('0x5e')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x56')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),_0xf33a('0x5f')]]})[_0xf33a('0x26')](handleEntityNotFound(_0x129229,null))[_0xf33a('0x26')](respondWithResult(_0x129229,null))[_0xf33a('0x42')](handleError(_0x129229,null));};exports[_0xf33a('0x60')]=function(_0x3bebca,_0x40bb02,_0x10a271){return db['VoiceQueue'][_0xf33a('0x4a')]({'where':{'id':_0x3bebca['params']['id']}})['then'](handleEntityNotFound(_0x40bb02,null))[_0xf33a('0x26')](function(_0x25cc49){var _0x132764;if(_0x25cc49){_0x132764=squel['insert']()['into'](_0xf33a('0x61'))['fromQuery']([_0xf33a('0x62'),_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x66'),'createdAt','updatedAt'],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))['field'](_0xf33a('0x6a'),_0xf33a('0x63'))['field'](_0xf33a('0x6b'),_0xf33a('0x64'))[_0xf33a('0x68')]('ANY_VALUE(ListId)',_0xf33a('0x65'))[_0xf33a('0x68')](_0xf33a('0x6c'),_0xf33a('0x66'))['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))[_0xf33a('0x68')]('NOW()',_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x73'),_0x3bebca[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x75'))[_0xf33a('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x62'))[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))[_0xf33a('0x79')](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x132764);}return[];})[_0xf33a('0x26')](respondWithResult(_0x40bb02,null))['catch'](handleError(_0x40bb02,null));};exports[_0xf33a('0x7a')]=function(_0x1dfb59,_0x9c0b99,_0x17b2fa){return db['Campaign']['find']({'where':{'id':_0x1dfb59[_0xf33a('0x44')]['id']}})['then'](handleEntityNotFound(_0x9c0b99,null))[_0xf33a('0x26')](function(_0x1595b7){var _0x3d8dbe;if(_0x1595b7){_0x3d8dbe=squel[_0xf33a('0x7b')]()['into']('cm_hopper')[_0xf33a('0x7c')](['phone',_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x7d'),_0xf33a('0x6d'),_0xf33a('0x6e')],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))[_0xf33a('0x68')](_0xf33a('0x6a'),_0xf33a('0x63'))[_0xf33a('0x68')](_0xf33a('0x6b'),_0xf33a('0x64'))['field'](_0xf33a('0x7e'),'ListId')[_0xf33a('0x68')]('ANY_VALUE(CampaignId)','CampaignId')['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))['field'](_0xf33a('0x6a'),_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59['params']['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')]('state\x20=\x20?',_0x1dfb59[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())['where'](_0xf33a('0x75'))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')]('phone')[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59[_0xf33a('0x44')]['id']['toString']()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))['where']('CampaignId\x20=\x20?',_0x1dfb59[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))['group'](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x3d8dbe);}return[];})[_0xf33a('0x26')](respondWithResult(_0x9c0b99,null))[_0xf33a('0x42')](handleError(_0x9c0b99,null));};exports[_0xf33a('0x80')]=function(_0x4abd84,_0x1205d1,_0x1d83a0){return db[_0xf33a('0x81')][_0xf33a('0x82')]({'where':{'VoiceQueueId':_0x4abd84['body'][_0xf33a('0x66')],'CampaignId':_0x4abd84['body'][_0xf33a('0x7d')],'ContactId':_0x4abd84[_0xf33a('0x48')][_0xf33a('0x64')]}})[_0xf33a('0x26')](handleEntityNotFound(_0x1205d1,null))[_0xf33a('0x26')](function(_0x49c40a){if(_0x49c40a){return _0x49c40a;}return null;})[_0xf33a('0x26')](respondWithResult(_0x1205d1,null))[_0xf33a('0x42')](handleError(_0x1205d1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 8766302..7ecfb69 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.model.js +++ b/server/api/cmHopperFinal/cmHopperFinal.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa898=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api'];(function(_0x133289,_0x1cfb37){var _0x408b6f=function(_0x44d826){while(--_0x44d826){_0x133289['push'](_0x133289['shift']());}};_0x408b6f(++_0x1cfb37);}(_0xa898,0x10b));var _0x8a89=function(_0x9f64c0,_0x436b3b){_0x9f64c0=_0x9f64c0-0x0;var _0x230a21=_0xa898[_0x9f64c0];return _0x230a21;};'use strict';var _=require('lodash');var util=require(_0x8a89('0x0'));var logger=require(_0x8a89('0x1'))(_0x8a89('0x2'));var moment=require(_0x8a89('0x3'));var BPromise=require(_0x8a89('0x4'));var rp=require(_0x8a89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a89('0x6'));var config=require(_0x8a89('0x7'));var attributes=require(_0x8a89('0x8'));module[_0x8a89('0x9')]=function(_0x4aad08,_0x5b2878){return _0x4aad08[_0x8a89('0xa')](_0x8a89('0xb'),attributes,{'tableName':_0x8a89('0xc'),'paranoid':![],'indexes':[{'name':_0x8a89('0xd'),'fields':[_0x8a89('0xd')]},{'name':'uniqueid','fields':[_0x8a89('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf5f=['define','CmHopperFinal','cm_hopper_final','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x1aa816,_0x149b14){var _0x4b696a=function(_0x3864ac){while(--_0x3864ac){_0x1aa816['push'](_0x1aa816['shift']());}};_0x4b696a(++_0x149b14);}(_0xcf5f,0xad));var _0xfcf5=function(_0x21087c,_0x48d89f){_0x21087c=_0x21087c-0x0;var _0x3cadfe=_0xcf5f[_0x21087c];return _0x3cadfe;};'use strict';var _=require(_0xfcf5('0x0'));var util=require(_0xfcf5('0x1'));var logger=require(_0xfcf5('0x2'))(_0xfcf5('0x3'));var moment=require('moment');var BPromise=require(_0xfcf5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcf5('0x5'));var rimraf=require(_0xfcf5('0x6'));var config=require(_0xfcf5('0x7'));var attributes=require(_0xfcf5('0x8'));module['exports']=function(_0x42b028,_0x36f535){return _0x42b028[_0xfcf5('0x9')](_0xfcf5('0xa'),attributes,{'tableName':_0xfcf5('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0xfcf5('0xc'),'fields':[_0xfcf5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 7e59eb3..5bb6043 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x48ca51,_0x57f990){var _0x7bb6f5=function(_0x4d9fd9){while(--_0x4d9fd9){_0x48ca51['push'](_0x48ca51['shift']());}};_0x7bb6f5(++_0x57f990);}(_0x7a54,0x106));var _0x47a5=function(_0x3f3ec4,_0x21870e){_0x3f3ec4=_0x3f3ec4-0x0;var _0x29c3ab=_0x7a54[_0x3f3ec4];return _0x29c3ab;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3c9051,_0x144cfc){var _0x1181d6=function(_0x53369b){while(--_0x53369b){_0x3c9051['push'](_0x3c9051['shift']());}};_0x1181d6(++_0x144cfc);}(_0x7a54,0x106));var _0x47a5=function(_0x21af63,_0x16119a){_0x21af63=_0x21af63-0x0;var _0x4054b2=_0x7a54[_0x21af63];return _0x4054b2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index eed7780..2c552a6 100644 --- a/server/api/cmHopperFinal/index.js +++ b/server/api/cmHopperFinal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10b2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','connect-timeout','express'];(function(_0x518c6d,_0x48985e){var _0x2ff6c8=function(_0x52d59f){while(--_0x52d59f){_0x518c6d['push'](_0x518c6d['shift']());}};_0x2ff6c8(++_0x48985e);}(_0x10b2,0x1be));var _0x210b=function(_0xf9901b,_0x4a3270){_0xf9901b=_0xf9901b-0x0;var _0x37b08d=_0x10b2[_0xf9901b];return _0x37b08d;};'use strict';var multer=require(_0x210b('0x0'));var util=require(_0x210b('0x1'));var path=require('path');var timeout=require(_0x210b('0x2'));var express=require(_0x210b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x210b('0x4'));var interaction=require(_0x210b('0x5'));var config=require(_0x210b('0x6'));var controller=require(_0x210b('0x7'));router[_0x210b('0x8')]('/',auth[_0x210b('0x9')](),controller['index']);router[_0x210b('0x8')]('/describe',auth[_0x210b('0x9')](),controller['describe']);router[_0x210b('0x8')](_0x210b('0xa'),auth[_0x210b('0x9')](),controller[_0x210b('0xb')]);router[_0x210b('0x8')](_0x210b('0xc'),auth[_0x210b('0x9')](),controller[_0x210b('0xd')]);router[_0x210b('0x8')](_0x210b('0xe'),auth[_0x210b('0x9')](),controller[_0x210b('0xf')]);router['post'](_0x210b('0x10'),auth['isAuthenticated'](),controller[_0x210b('0x11')]);router[_0x210b('0x12')](_0x210b('0x13'),auth[_0x210b('0x9')](),controller[_0x210b('0x14')]);router['post'](_0x210b('0x15'),auth[_0x210b('0x9')](),controller[_0x210b('0x16')]);router[_0x210b('0x17')]('/:id',auth[_0x210b('0x9')](),controller['update']);module[_0x210b('0x18')]=router; \ No newline at end of file +var _0xef4d=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2e4eef,_0x1cb476){var _0x2a8428=function(_0x56ade6){while(--_0x56ade6){_0x2e4eef['push'](_0x2e4eef['shift']());}};_0x2a8428(++_0x1cb476);}(_0xef4d,0xaf));var _0xdef4=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xef4d[_0x580576];return _0x3f55a0;};'use strict';var multer=require(_0xdef4('0x0'));var util=require(_0xdef4('0x1'));var path=require('path');var timeout=require(_0xdef4('0x2'));var express=require(_0xdef4('0x3'));var router=express[_0xdef4('0x4')]();var fs_extra=require(_0xdef4('0x5'));var auth=require(_0xdef4('0x6'));var interaction=require(_0xdef4('0x7'));var config=require(_0xdef4('0x8'));var controller=require(_0xdef4('0x9'));router[_0xdef4('0xa')]('/',auth[_0xdef4('0xb')](),controller[_0xdef4('0xc')]);router[_0xdef4('0xa')](_0xdef4('0xd'),auth[_0xdef4('0xb')](),controller[_0xdef4('0xe')]);router['get'](_0xdef4('0xf'),auth[_0xdef4('0xb')](),controller[_0xdef4('0x10')]);router['get'](_0xdef4('0x11'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xdef4('0xa')]('/campaign/countAttributes/:id',auth[_0xdef4('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xdef4('0x12')](_0xdef4('0x13'),auth[_0xdef4('0xb')](),controller[_0xdef4('0x14')]);router[_0xdef4('0x12')](_0xdef4('0x15'),auth[_0xdef4('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xdef4('0x12')](_0xdef4('0x16'),auth['isAuthenticated'](),controller[_0xdef4('0x17')]);router[_0xdef4('0x18')](_0xdef4('0xf'),auth['isAuthenticated'](),controller['update']);module[_0xdef4('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index cfdac3a..a7a5398 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.attributes.js +++ b/server/api/cmHopperHistory/cmHopperHistory.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc88f=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc88f,0x19b));var _0xfc88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc88f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfc88('0x0'));module[_0xfc88('0x1')]={'state':{'type':Sequelize[_0xfc88('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xfc88('0x3')]},'scheduledat':{'type':Sequelize[_0xfc88('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xfc88('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfc88('0x3')]},'calleridname':{'type':Sequelize[_0xfc88('0x3')]},'starttime':{'type':Sequelize[_0xfc88('0x4')]},'responsetime':{'type':Sequelize[_0xfc88('0x4')]},'answertime':{'type':Sequelize[_0xfc88('0x4')]},'droptime':{'type':Sequelize[_0xfc88('0x4')]},'endtime':{'type':Sequelize[_0xfc88('0x4')]},'ringtime':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfc88('0x3')]},'campaign':{'type':Sequelize[_0xfc88('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfc88('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xfc88('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xfc88('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfc88('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfc88('0x4')]},'recallme':{'type':Sequelize[_0xfc88('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfc88('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfc88('0x3')]}}; \ No newline at end of file +var _0x2499=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x457e7b,_0x2ef525){var _0x14b5b5=function(_0x33e64d){while(--_0x33e64d){_0x457e7b['push'](_0x457e7b['shift']());}};_0x14b5b5(++_0x2ef525);}(_0x2499,0x7d));var _0x9249=function(_0x5a7f62,_0x49b582){_0x5a7f62=_0x5a7f62-0x0;var _0x1b1b01=_0x2499[_0x5a7f62];return _0x1b1b01;};'use strict';var Sequelize=require(_0x9249('0x0'));module[_0x9249('0x1')]={'state':{'type':Sequelize[_0x9249('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9249('0x3')]},'scheduledat':{'type':Sequelize[_0x9249('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9249('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9249('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9249('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x9249('0x3')]},'originatecalleridname':{'type':Sequelize[_0x9249('0x3')]},'calleridnum':{'type':Sequelize[_0x9249('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9249('0x4')]},'responsetime':{'type':Sequelize[_0x9249('0x4')]},'answertime':{'type':Sequelize[_0x9249('0x4')]},'droptime':{'type':Sequelize[_0x9249('0x4')]},'endtime':{'type':Sequelize[_0x9249('0x4')]},'ringtime':{'type':Sequelize[_0x9249('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9249('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9249('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9249('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9249('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x9249('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9249('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9249('0x4')]},'recallme':{'type':Sequelize[_0x9249('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x9249('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x9249('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9249('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9249('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9249('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a49a7a8..87590f9 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.controller.js +++ b/server/api/cmHopperHistory/cmHopperHistory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e44=['name','send','index','map','CmHopperHistory','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','update','uniqueid','eml-format','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','reject','save','then','destroy','error','stack'];(function(_0x4597f0,_0x526214){var _0x1c78d2=function(_0x38840c){while(--_0x38840c){_0x4597f0['push'](_0x4597f0['shift']());}};_0x1c78d2(++_0x526214);}(_0x5e44,0x147));var _0x45e4=function(_0x9165a,_0x490cac){_0x9165a=_0x9165a-0x0;var _0x582d88=_0x5e44[_0x9165a];return _0x582d88;};'use strict';var emlformat=require(_0x45e4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x45e4('0x1'));var moment=require('moment');var BPromise=require(_0x45e4('0x2'));var Mustache=require(_0x45e4('0x3'));var util=require(_0x45e4('0x4'));var path=require('path');var sox=require(_0x45e4('0x5'));var csv=require('to-csv');var ejs=require(_0x45e4('0x6'));var fs=require('fs');var fs_extra=require(_0x45e4('0x7'));var _=require(_0x45e4('0x8'));var squel=require('squel');var crypto=require(_0x45e4('0x9'));var jsforce=require(_0x45e4('0xa'));var deskjs=require(_0x45e4('0xb'));var toCsv=require(_0x45e4('0xc'));var querystring=require(_0x45e4('0xd'));var Papa=require('papaparse');var Redis=require(_0x45e4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x45e4('0xf'));var hardwareService=require(_0x45e4('0x10'));var logger=require(_0x45e4('0x11'))(_0x45e4('0x12'));var utils=require(_0x45e4('0x13'));var config=require(_0x45e4('0x14'));var licenseUtil=require(_0x45e4('0x15'));var db=require(_0x45e4('0x16'))['db'];function respondWithStatusCode(_0x587362,_0x4b04c4){_0x4b04c4=_0x4b04c4||0xcc;return function(_0x5628f7){if(_0x5628f7){return _0x587362[_0x45e4('0x17')](_0x4b04c4);}return _0x587362[_0x45e4('0x18')](_0x4b04c4)[_0x45e4('0x19')]();};}function respondWithResult(_0x85bbce,_0x448411){_0x448411=_0x448411||0xc8;return function(_0x3e28ef){if(_0x3e28ef){return _0x85bbce[_0x45e4('0x18')](_0x448411)[_0x45e4('0x1a')](_0x3e28ef);}};}function respondWithFilteredResult(_0xcf4c3f,_0xee499f){return function(_0x46a9ab){if(_0x46a9ab){var _0x363772=typeof _0xee499f['offset']===_0x45e4('0x1b')&&typeof _0xee499f['limit']===_0x45e4('0x1b');var _0x21ce7b=_0x46a9ab['count'];var _0x22baf9=_0x363772?0x0:_0xee499f[_0x45e4('0x1c')];var _0x3048ac=_0x363772?_0x46a9ab[_0x45e4('0x1d')]:_0xee499f[_0x45e4('0x1c')]+_0xee499f[_0x45e4('0x1e')];var _0x168ddc;if(_0x3048ac>=_0x21ce7b){_0x3048ac=_0x21ce7b;_0x168ddc=0xc8;}else{_0x168ddc=0xce;}_0xcf4c3f['status'](_0x168ddc);return _0xcf4c3f[_0x45e4('0x1f')]('Content-Range',_0x22baf9+'-'+_0x3048ac+'/'+_0x21ce7b)['json'](_0x46a9ab);}return null;};}function patchUpdates(_0xed034a){return function(_0x1bc33d){try{jsonpatch['apply'](_0x1bc33d,_0xed034a,!![]);}catch(_0x20e765){return BPromise[_0x45e4('0x20')](_0x20e765);}return _0x1bc33d[_0x45e4('0x21')]();};}function saveUpdates(_0x4b9ccc,_0x16d995){return function(_0x5d58b7){if(_0x5d58b7){return _0x5d58b7['update'](_0x4b9ccc)[_0x45e4('0x22')](function(_0x2a186b){return _0x2a186b;});}return null;};}function removeEntity(_0x1cd90f,_0x9c7e8c){return function(_0x29f856){if(_0x29f856){return _0x29f856[_0x45e4('0x23')]()[_0x45e4('0x22')](function(){_0x1cd90f['status'](0xcc)[_0x45e4('0x19')]();});}};}function handleEntityNotFound(_0x2519ce,_0x6c78e1){return function(_0x20bb3a){if(!_0x20bb3a){_0x2519ce[_0x45e4('0x17')](0x194);}return _0x20bb3a;};}function handleError(_0x56467e,_0x499cd4){_0x499cd4=_0x499cd4||0x1f4;return function(_0x35d47c){logger[_0x45e4('0x24')](_0x35d47c[_0x45e4('0x25')]);if(_0x35d47c[_0x45e4('0x26')]){delete _0x35d47c['name'];}_0x56467e[_0x45e4('0x18')](_0x499cd4)[_0x45e4('0x27')](_0x35d47c);};}exports[_0x45e4('0x28')]=function(_0x559730,_0x5aa2a7){var _0x3777b6={},_0x45de86={},_0x10f613={'count':0x0,'rows':[]};var _0x5239e6=_[_0x45e4('0x29')](db[_0x45e4('0x2a')]['rawAttributes'],function(_0x4424df){return{'name':_0x4424df['fieldName'],'type':_0x4424df[_0x45e4('0x2b')]['key']};});_0x45de86[_0x45e4('0x2c')]=_[_0x45e4('0x29')](_0x5239e6,_0x45e4('0x26'));_0x45de86[_0x45e4('0x2d')]=_['keys'](_0x559730['query']);_0x45de86[_0x45e4('0x2e')]=_[_0x45e4('0x2f')](_0x45de86[_0x45e4('0x2c')],_0x45de86[_0x45e4('0x2d')]);_0x3777b6[_0x45e4('0x30')]=_['intersection'](_0x45de86['model'],qs[_0x45e4('0x31')](_0x559730['query']['fields']));_0x3777b6[_0x45e4('0x30')]=_0x3777b6['attributes'][_0x45e4('0x32')]?_0x3777b6['attributes']:_0x45de86['model'];if(!_0x559730[_0x45e4('0x2d')][_0x45e4('0x33')]('nolimit')){_0x3777b6[_0x45e4('0x1e')]=qs[_0x45e4('0x1e')](_0x559730['query'][_0x45e4('0x1e')]);_0x3777b6[_0x45e4('0x1c')]=qs[_0x45e4('0x1c')](_0x559730[_0x45e4('0x2d')]['offset']);}_0x3777b6[_0x45e4('0x34')]=qs[_0x45e4('0x35')](_0x559730[_0x45e4('0x2d')][_0x45e4('0x35')]);_0x3777b6[_0x45e4('0x36')]=qs[_0x45e4('0x2e')](_['pick'](_0x559730['query'],_0x45de86[_0x45e4('0x2e')]),_0x5239e6);if(_0x559730['query'][_0x45e4('0x37')]){_0x3777b6['where']=_[_0x45e4('0x38')](_0x3777b6[_0x45e4('0x36')],{'$or':_[_0x45e4('0x29')](_0x5239e6,function(_0xb4a3fb){if(_0xb4a3fb['type']!==_0x45e4('0x39')){var _0x9db649={};_0x9db649[_0xb4a3fb['name']]={'$like':'%'+_0x559730['query']['filter']+'%'};return _0x9db649;}})});}_0x3777b6=_[_0x45e4('0x38')]({},_0x3777b6,_0x559730[_0x45e4('0x3a')]);var _0x5047fb={'where':_0x3777b6['where']};return db[_0x45e4('0x2a')][_0x45e4('0x1d')](_0x5047fb)[_0x45e4('0x22')](function(_0xc2252a){_0x10f613['count']=_0xc2252a;if(_0x559730[_0x45e4('0x2d')]['includeAll']){_0x3777b6[_0x45e4('0x3b')]=[{'all':!![]}];}return db[_0x45e4('0x2a')][_0x45e4('0x3c')](_0x3777b6);})[_0x45e4('0x22')](function(_0x390b07){_0x10f613['rows']=_0x390b07;return _0x10f613;})['then'](respondWithFilteredResult(_0x5aa2a7,_0x3777b6))[_0x45e4('0x3d')](handleError(_0x5aa2a7,null));};exports[_0x45e4('0x3e')]=function(_0x215622,_0x25c932){var _0xdb9f89={'raw':!![],'where':{'id':_0x215622[_0x45e4('0x3f')]['id']}},_0x4a520d={};_0x4a520d['model']=_[_0x45e4('0x40')](db[_0x45e4('0x2a')][_0x45e4('0x41')]);_0x4a520d[_0x45e4('0x2d')]=_[_0x45e4('0x40')](_0x215622[_0x45e4('0x2d')]);_0x4a520d[_0x45e4('0x2e')]=_[_0x45e4('0x2f')](_0x4a520d[_0x45e4('0x2c')],_0x4a520d[_0x45e4('0x2d')]);_0xdb9f89['attributes']=_['intersection'](_0x4a520d[_0x45e4('0x2c')],qs['fields'](_0x215622[_0x45e4('0x2d')]['fields']));_0xdb9f89[_0x45e4('0x30')]=_0xdb9f89[_0x45e4('0x30')][_0x45e4('0x32')]?_0xdb9f89['attributes']:_0x4a520d[_0x45e4('0x2c')];if(_0x215622['query'][_0x45e4('0x42')]){_0xdb9f89[_0x45e4('0x3b')]=[{'all':!![]}];}_0xdb9f89=_[_0x45e4('0x38')]({},_0xdb9f89,_0x215622['options']);return db['CmHopperHistory'][_0x45e4('0x43')](_0xdb9f89)[_0x45e4('0x22')](handleEntityNotFound(_0x25c932,null))['then'](respondWithResult(_0x25c932,null))[_0x45e4('0x3d')](handleError(_0x25c932,null));};exports[_0x45e4('0x44')]=function(_0x2a946b,_0x53f904){return db[_0x45e4('0x2a')][_0x45e4('0x44')](_0x2a946b[_0x45e4('0x45')],{})['then'](respondWithResult(_0x53f904,0xc9))['catch'](handleError(_0x53f904,null));};exports[_0x45e4('0x46')]=function(_0x4e15ac,_0x13acb7){return db[_0x45e4('0x2a')][_0x45e4('0x46')]()['then'](respondWithResult(_0x13acb7,null))['catch'](handleError(_0x13acb7,null));};exports[_0x45e4('0x47')]=function(_0x474204,_0x323619){if(_0x474204['body'][_0x45e4('0x48')]){delete _0x474204[_0x45e4('0x45')]['uniqueid'];}return db['CmHopperHistory'][_0x45e4('0x43')]({'where':{'uniqueid':_0x474204[_0x45e4('0x3f')]['id']}})[_0x45e4('0x22')](handleEntityNotFound(_0x323619,null))[_0x45e4('0x22')](saveUpdates(_0x474204[_0x45e4('0x45')],null))[_0x45e4('0x22')](respondWithResult(_0x323619,null))[_0x45e4('0x3d')](handleError(_0x323619,null));}; \ No newline at end of file +var _0x5d9d=['moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','CmHopperHistory','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','catch','params','include','find','create','body','describe','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x192ac5,_0x308bad){var _0x2073f8=function(_0x3f0fc3){while(--_0x3f0fc3){_0x192ac5['push'](_0x192ac5['shift']());}};_0x2073f8(++_0x308bad);}(_0x5d9d,0x19a));var _0xd5d9=function(_0x2ce437,_0x30f034){_0x2ce437=_0x2ce437-0x0;var _0x5bfb88=_0x5d9d[_0x2ce437];return _0x5bfb88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd5d9('0x0'));var zipdir=require(_0xd5d9('0x1'));var jsonpatch=require(_0xd5d9('0x2'));var rp=require(_0xd5d9('0x3'));var moment=require(_0xd5d9('0x4'));var BPromise=require(_0xd5d9('0x5'));var Mustache=require(_0xd5d9('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd5d9('0x7'));var csv=require(_0xd5d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd5d9('0x9'));var _=require(_0xd5d9('0xa'));var squel=require(_0xd5d9('0xb'));var crypto=require(_0xd5d9('0xc'));var jsforce=require(_0xd5d9('0xd'));var deskjs=require(_0xd5d9('0xe'));var toCsv=require(_0xd5d9('0x8'));var querystring=require(_0xd5d9('0xf'));var Papa=require('papaparse');var Redis=require(_0xd5d9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd5d9('0x11'));var hardwareService=require(_0xd5d9('0x12'));var logger=require('../../config/logger')(_0xd5d9('0x13'));var utils=require('../../config/utils');var config=require(_0xd5d9('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x471e14,_0x3fc55e){_0x3fc55e=_0x3fc55e||0xcc;return function(_0x4338b9){if(_0x4338b9){return _0x471e14[_0xd5d9('0x15')](_0x3fc55e);}return _0x471e14[_0xd5d9('0x16')](_0x3fc55e)[_0xd5d9('0x17')]();};}function respondWithResult(_0x5e8531,_0x4e27e5){_0x4e27e5=_0x4e27e5||0xc8;return function(_0x10504a){if(_0x10504a){return _0x5e8531[_0xd5d9('0x16')](_0x4e27e5)[_0xd5d9('0x18')](_0x10504a);}};}function respondWithFilteredResult(_0x38a3fc,_0x113a0e){return function(_0x17d1a5){if(_0x17d1a5){var _0x27bf05=typeof _0x113a0e[_0xd5d9('0x19')]===_0xd5d9('0x1a')&&typeof _0x113a0e[_0xd5d9('0x1b')]==='undefined';var _0x4e026e=_0x17d1a5[_0xd5d9('0x1c')];var _0xa1f81=_0x27bf05?0x0:_0x113a0e[_0xd5d9('0x19')];var _0x9ffa18=_0x27bf05?_0x17d1a5[_0xd5d9('0x1c')]:_0x113a0e['offset']+_0x113a0e['limit'];var _0x175c77;if(_0x9ffa18>=_0x4e026e){_0x9ffa18=_0x4e026e;_0x175c77=0xc8;}else{_0x175c77=0xce;}_0x38a3fc['status'](_0x175c77);return _0x38a3fc[_0xd5d9('0x1d')](_0xd5d9('0x1e'),_0xa1f81+'-'+_0x9ffa18+'/'+_0x4e026e)['json'](_0x17d1a5);}return null;};}function patchUpdates(_0x19336e){return function(_0x19d1aa){try{jsonpatch[_0xd5d9('0x1f')](_0x19d1aa,_0x19336e,!![]);}catch(_0x35253b){return BPromise[_0xd5d9('0x20')](_0x35253b);}return _0x19d1aa['save']();};}function saveUpdates(_0x433f8f,_0x2aee1d){return function(_0x492ba2){if(_0x492ba2){return _0x492ba2[_0xd5d9('0x21')](_0x433f8f)[_0xd5d9('0x22')](function(_0x341d6b){return _0x341d6b;});}return null;};}function removeEntity(_0x40141b,_0x40a373){return function(_0x5cf7e5){if(_0x5cf7e5){return _0x5cf7e5[_0xd5d9('0x23')]()[_0xd5d9('0x22')](function(){_0x40141b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x150b28,_0x515e6d){return function(_0xb42115){if(!_0xb42115){_0x150b28['sendStatus'](0x194);}return _0xb42115;};}function handleError(_0x33e788,_0x443c18){_0x443c18=_0x443c18||0x1f4;return function(_0x57dab6){logger[_0xd5d9('0x24')](_0x57dab6[_0xd5d9('0x25')]);if(_0x57dab6[_0xd5d9('0x26')]){delete _0x57dab6[_0xd5d9('0x26')];}_0x33e788[_0xd5d9('0x16')](_0x443c18)[_0xd5d9('0x27')](_0x57dab6);};}exports['index']=function(_0x2cabb3,_0x2e5942){var _0x2534e4={},_0x4baba4={},_0x39147f={'count':0x0,'rows':[]};var _0x213f35=_[_0xd5d9('0x28')](db[_0xd5d9('0x29')][_0xd5d9('0x2a')],function(_0x516083){return{'name':_0x516083['fieldName'],'type':_0x516083[_0xd5d9('0x2b')][_0xd5d9('0x2c')]};});_0x4baba4['model']=_[_0xd5d9('0x28')](_0x213f35,_0xd5d9('0x26'));_0x4baba4[_0xd5d9('0x2d')]=_[_0xd5d9('0x2e')](_0x2cabb3[_0xd5d9('0x2d')]);_0x4baba4[_0xd5d9('0x2f')]=_['intersection'](_0x4baba4[_0xd5d9('0x30')],_0x4baba4[_0xd5d9('0x2d')]);_0x2534e4['attributes']=_[_0xd5d9('0x31')](_0x4baba4[_0xd5d9('0x30')],qs[_0xd5d9('0x32')](_0x2cabb3['query']['fields']));_0x2534e4['attributes']=_0x2534e4[_0xd5d9('0x33')][_0xd5d9('0x34')]?_0x2534e4['attributes']:_0x4baba4[_0xd5d9('0x30')];if(!_0x2cabb3[_0xd5d9('0x2d')][_0xd5d9('0x35')](_0xd5d9('0x36'))){_0x2534e4[_0xd5d9('0x1b')]=qs[_0xd5d9('0x1b')](_0x2cabb3[_0xd5d9('0x2d')][_0xd5d9('0x1b')]);_0x2534e4[_0xd5d9('0x19')]=qs['offset'](_0x2cabb3['query'][_0xd5d9('0x19')]);}_0x2534e4['order']=qs[_0xd5d9('0x37')](_0x2cabb3['query'][_0xd5d9('0x37')]);_0x2534e4[_0xd5d9('0x38')]=qs[_0xd5d9('0x2f')](_[_0xd5d9('0x39')](_0x2cabb3[_0xd5d9('0x2d')],_0x4baba4[_0xd5d9('0x2f')]),_0x213f35);if(_0x2cabb3[_0xd5d9('0x2d')]['filter']){_0x2534e4[_0xd5d9('0x38')]=_[_0xd5d9('0x3a')](_0x2534e4[_0xd5d9('0x38')],{'$or':_[_0xd5d9('0x28')](_0x213f35,function(_0x2a4a83){if(_0x2a4a83['type']!==_0xd5d9('0x3b')){var _0x3b51bd={};_0x3b51bd[_0x2a4a83[_0xd5d9('0x26')]]={'$like':'%'+_0x2cabb3[_0xd5d9('0x2d')]['filter']+'%'};return _0x3b51bd;}})});}_0x2534e4=_[_0xd5d9('0x3a')]({},_0x2534e4,_0x2cabb3[_0xd5d9('0x3c')]);var _0xb3f8e4={'where':_0x2534e4[_0xd5d9('0x38')]};return db[_0xd5d9('0x29')][_0xd5d9('0x1c')](_0xb3f8e4)[_0xd5d9('0x22')](function(_0x289480){_0x39147f[_0xd5d9('0x1c')]=_0x289480;if(_0x2cabb3[_0xd5d9('0x2d')]['includeAll']){_0x2534e4['include']=[{'all':!![]}];}return db[_0xd5d9('0x29')]['findAll'](_0x2534e4);})['then'](function(_0x8f6481){_0x39147f['rows']=_0x8f6481;return _0x39147f;})[_0xd5d9('0x22')](respondWithFilteredResult(_0x2e5942,_0x2534e4))[_0xd5d9('0x3d')](handleError(_0x2e5942,null));};exports['show']=function(_0x380fcd,_0x3da72d){var _0x2b3b1f={'raw':!![],'where':{'id':_0x380fcd[_0xd5d9('0x3e')]['id']}},_0x18244e={};_0x18244e[_0xd5d9('0x30')]=_[_0xd5d9('0x2e')](db['CmHopperHistory'][_0xd5d9('0x2a')]);_0x18244e['query']=_[_0xd5d9('0x2e')](_0x380fcd['query']);_0x18244e[_0xd5d9('0x2f')]=_['intersection'](_0x18244e[_0xd5d9('0x30')],_0x18244e[_0xd5d9('0x2d')]);_0x2b3b1f['attributes']=_[_0xd5d9('0x31')](_0x18244e['model'],qs[_0xd5d9('0x32')](_0x380fcd['query'][_0xd5d9('0x32')]));_0x2b3b1f['attributes']=_0x2b3b1f[_0xd5d9('0x33')][_0xd5d9('0x34')]?_0x2b3b1f['attributes']:_0x18244e[_0xd5d9('0x30')];if(_0x380fcd[_0xd5d9('0x2d')]['includeAll']){_0x2b3b1f[_0xd5d9('0x3f')]=[{'all':!![]}];}_0x2b3b1f=_[_0xd5d9('0x3a')]({},_0x2b3b1f,_0x380fcd[_0xd5d9('0x3c')]);return db['CmHopperHistory'][_0xd5d9('0x40')](_0x2b3b1f)[_0xd5d9('0x22')](handleEntityNotFound(_0x3da72d,null))[_0xd5d9('0x22')](respondWithResult(_0x3da72d,null))[_0xd5d9('0x3d')](handleError(_0x3da72d,null));};exports[_0xd5d9('0x41')]=function(_0x2cd863,_0x40cd0b){return db[_0xd5d9('0x29')][_0xd5d9('0x41')](_0x2cd863[_0xd5d9('0x42')],{})[_0xd5d9('0x22')](respondWithResult(_0x40cd0b,0xc9))[_0xd5d9('0x3d')](handleError(_0x40cd0b,null));};exports[_0xd5d9('0x43')]=function(_0x490b50,_0x923b11){return db[_0xd5d9('0x29')]['describe']()[_0xd5d9('0x22')](respondWithResult(_0x923b11,null))[_0xd5d9('0x3d')](handleError(_0x923b11,null));};exports[_0xd5d9('0x21')]=function(_0x146624,_0x392fae){if(_0x146624[_0xd5d9('0x42')][_0xd5d9('0x44')]){delete _0x146624['body'][_0xd5d9('0x44')];}return db[_0xd5d9('0x29')][_0xd5d9('0x40')]({'where':{'uniqueid':_0x146624['params']['id']}})[_0xd5d9('0x22')](handleEntityNotFound(_0x392fae,null))['then'](saveUpdates(_0x146624[_0xd5d9('0x42')],null))[_0xd5d9('0x22')](respondWithResult(_0x392fae,null))['catch'](handleError(_0x392fae,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0bb31a9..b1c8140 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.model.js +++ b/server/api/cmHopperHistory/cmHopperHistory.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8a0=['api','bluebird','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger'];(function(_0x239d1f,_0x367a95){var _0x27e245=function(_0x1dca12){while(--_0x1dca12){_0x239d1f['push'](_0x239d1f['shift']());}};_0x27e245(++_0x367a95);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0xf44b76,_0x10b04c){_0xf44b76=_0xf44b76-0x0;var _0x24d1a4=_0xb8a0[_0xf44b76];return _0x24d1a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b8a('0x0'))(_0x0b8a('0x1'));var moment=require('moment');var BPromise=require(_0x0b8a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b8a('0x3'));module[_0x0b8a('0x4')]=function(_0x381b17,_0x165710){return _0x381b17[_0x0b8a('0x5')](_0x0b8a('0x6'),attributes,{'tableName':_0x0b8a('0x7'),'paranoid':![],'indexes':[{'name':_0x0b8a('0x8'),'fields':[_0x0b8a('0x8')]},{'name':_0x0b8a('0x9'),'fields':[_0x0b8a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3419=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x4e4c5a,_0x34f306){var _0x193b18=function(_0x13256c){while(--_0x13256c){_0x4e4c5a['push'](_0x4e4c5a['shift']());}};_0x193b18(++_0x34f306);}(_0x3419,0xb3));var _0x9341=function(_0x14b4b2,_0x42aed0){_0x14b4b2=_0x14b4b2-0x0;var _0x2710fd=_0x3419[_0x14b4b2];return _0x2710fd;};'use strict';var _=require(_0x9341('0x0'));var util=require(_0x9341('0x1'));var logger=require(_0x9341('0x2'))(_0x9341('0x3'));var moment=require(_0x9341('0x4'));var BPromise=require('bluebird');var rp=require(_0x9341('0x5'));var fs=require('fs');var path=require(_0x9341('0x6'));var rimraf=require(_0x9341('0x7'));var config=require(_0x9341('0x8'));var attributes=require(_0x9341('0x9'));module['exports']=function(_0xa36232,_0x204ee){return _0xa36232['define'](_0x9341('0xa'),attributes,{'tableName':_0x9341('0xb'),'paranoid':![],'indexes':[{'name':_0x9341('0xc'),'fields':[_0x9341('0xc')]},{'name':_0x9341('0xd'),'fields':[_0x9341('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 6e235b2..d3356e9 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.rpc.js +++ b/server/api/cmHopperHistory/cmHopperHistory.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2083=['info','result','CreateCmHopperHistory','CmHopperHistory','body','options','raw','catch','findAll','where','COUNT','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','stringify','GetVoiceQueueHopperHistory','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundReCallsDay','campaign','name','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2083,0x137));var _0x3208=function(_0x5660cf,_0x56b76f){_0x5660cf=_0x5660cf-0x0;var _0x4053d6=_0x2083[_0x5660cf];return _0x4053d6;};'use strict';var _=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var moment=require('moment');var BPromise=require(_0x3208('0x2'));var rs=require(_0x3208('0x3'));var fs=require('fs');var Redis=require(_0x3208('0x4'));var db=require(_0x3208('0x5'))['db'];var utils=require(_0x3208('0x6'));var logger=require(_0x3208('0x7'))(_0x3208('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3208('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d837d,_0x3d4b9d,_0x17972f){return new BPromise(function(_0x564ff6,_0x165e5e){return client[_0x3208('0xa')](_0x3d837d,_0x17972f)[_0x3208('0xb')](function(_0x4c45f4){logger['info'](_0x3208('0xc'),_0x3d4b9d,_0x3208('0xd'));logger[_0x3208('0xe')](_0x3208('0xf'),_0x3d4b9d,'request\x20sent',JSON['stringify'](_0x4c45f4));if(_0x4c45f4[_0x3208('0x10')]){if(_0x4c45f4[_0x3208('0x10')][_0x3208('0x11')]===0x1f4){logger[_0x3208('0x10')](_0x3208('0xc'),_0x3d4b9d,_0x4c45f4[_0x3208('0x10')][_0x3208('0x12')]);return _0x165e5e(_0x4c45f4[_0x3208('0x10')][_0x3208('0x12')]);}logger[_0x3208('0x10')](_0x3208('0xc'),_0x3d4b9d,_0x4c45f4[_0x3208('0x10')][_0x3208('0x12')]);return _0x564ff6(_0x4c45f4[_0x3208('0x10')]['message']);}else{logger[_0x3208('0x13')](_0x3208('0xc'),_0x3d4b9d,_0x3208('0xd'));_0x564ff6(_0x4c45f4[_0x3208('0x14')][_0x3208('0x12')]);}})['catch'](function(_0x244d19){logger[_0x3208('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x3d4b9d,_0x244d19);_0x165e5e(_0x244d19);});});}exports[_0x3208('0x15')]=function(_0x3590c5){var _0x3b45bf=this;return new Promise(function(_0x28e291,_0x26a826){return db[_0x3208('0x16')]['create'](_0x3590c5[_0x3208('0x17')],{'raw':_0x3590c5[_0x3208('0x18')]?_0x3590c5[_0x3208('0x18')][_0x3208('0x19')]===undefined?!![]:![]:!![]})[_0x3208('0xb')](function(_0x46b227){logger[_0x3208('0x13')]('CreateCmHopperHistory',_0x3590c5);logger[_0x3208('0xe')](_0x3208('0x15'),_0x3590c5,JSON['stringify'](_0x46b227));_0x28e291(_0x46b227);})[_0x3208('0x1a')](function(_0x361d1c){logger[_0x3208('0x10')](_0x3208('0x15'),_0x361d1c[_0x3208('0x12')],_0x3590c5);_0x26a826(_0x3b45bf[_0x3208('0x10')](0x1f4,_0x361d1c[_0x3208('0x12')]));});});};exports['AvgHandleTime']=function(_0x54aa98){var _0xd9ad58=this;return new Promise(function(_0x2f2dc3,_0x1c4f3f){return db[_0x3208('0x16')][_0x3208('0x1b')]({'raw':_0x54aa98[_0x3208('0x18')]?_0x54aa98['options'][_0x3208('0x19')]===undefined?!![]:![]:!![],'where':_0x54aa98[_0x3208('0x18')]?_0x54aa98[_0x3208('0x18')][_0x3208('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')][_0x3208('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x21')))),_0x3208('0x22')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x23')))),_0x3208('0x24')],[db['sequelize']['fn']('COUNT',db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3208('0x25')],[db[_0x3208('0x1e')]['fn']('AVG',db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x26')))),_0x3208('0x27')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x28'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x29')))),_0x3208('0x2a')]]})[_0x3208('0xb')](function(_0x47f46c){logger[_0x3208('0x13')](_0x3208('0x2b'),_0x54aa98);logger['debug'](_0x3208('0x2b'),_0x54aa98,JSON[_0x3208('0x2c')](_0x47f46c));_0x2f2dc3(_0x47f46c);})[_0x3208('0x1a')](function(_0x39ff47){logger['error']('AvgHandleTime',_0x39ff47[_0x3208('0x12')],_0x54aa98);_0x1c4f3f(_0xd9ad58['error'](0x1f4,_0x39ff47[_0x3208('0x12')]));});});};exports[_0x3208('0x2d')]=function(_0x35df97){var _0x2618c0=this;return new Promise(function(_0x419b59,_0x1588f4){return db[_0x3208('0x16')][_0x3208('0x1b')]({'raw':_0x35df97[_0x3208('0x18')]?_0x35df97['options'][_0x3208('0x19')]===undefined?!![]:![]:!![],'where':_0x35df97['options']?_0x35df97[_0x3208('0x18')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x3208('0x1e')]['fn']('COUNT',db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')]('`state`\x20=\x200,\x201,\x20null'))),_0x3208('0x2e')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x3208('0x20')](_0x3208('0x2f')))),'outboundNoAnswerCallsDay'],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db['sequelize'][_0x3208('0x20')](_0x3208('0x21')))),_0x3208('0x30')],[db[_0x3208('0x1e')]['fn']('COUNT',db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')]['literal'](_0x3208('0x31')))),_0x3208('0x32')],[db[_0x3208('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x33')))),_0x3208('0x34')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3208('0x35')],[db['sequelize']['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3208('0x36')],[db['sequelize']['fn'](_0x3208('0x1d'),db['sequelize']['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0x3208('0x37')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')]['literal'](_0x3208('0x38')))),_0x3208('0x39')],[db['sequelize']['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x3a')))),'outboundRejectCallsDay'],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db['sequelize']['fn']('IF',db[_0x3208('0x1e')]['literal'](_0x3208('0x3b')))),_0x3208('0x3c')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db['sequelize'][_0x3208('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x3208('0x3d')]],'group':[_0x3208('0x3e')]})['then'](function(_0x3b1b30){logger[_0x3208('0x13')](_0x3208('0x2d'),_0x35df97);logger[_0x3208('0xe')](_0x3208('0x2d'),_0x35df97,JSON[_0x3208('0x2c')](_0x3b1b30));_0x419b59(_0x3b1b30);})[_0x3208('0x1a')](function(_0x4ee3db){logger[_0x3208('0x10')]('GetVoiceQueueHopperHistory',_0x4ee3db[_0x3208('0x12')],_0x35df97);_0x1588f4(_0x2618c0[_0x3208('0x10')](0x1f4,_0x4ee3db[_0x3208('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x17b7d3){var _0x4aeca7=this;return new Promise(function(_0xa5daf1,_0x299f28){return db['CmHopperHistory']['findAll']({'raw':_0x17b7d3[_0x3208('0x18')]?_0x17b7d3['options'][_0x3208('0x19')]===undefined?!![]:![]:!![],'where':_0x17b7d3[_0x3208('0x18')]?_0x17b7d3['options'][_0x3208('0x1c')]||null:null,'attributes':[[_0x3208('0x3e'),_0x3208('0x3f')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db['sequelize'][_0x3208('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x3208('0x40')]],'group':[_0x3208('0x3e')]})[_0x3208('0xb')](function(_0x41ea31){logger['info'](_0x3208('0x41'),_0x17b7d3);logger['debug'](_0x3208('0x41'),_0x17b7d3,JSON[_0x3208('0x2c')](_0x41ea31));_0xa5daf1(_0x41ea31);})['catch'](function(_0x5714c1){logger['error'](_0x3208('0x41'),_0x5714c1[_0x3208('0x12')],_0x17b7d3);_0x299f28(_0x4aeca7[_0x3208('0x10')](0x1f4,_0x5714c1['message']));});});}; \ No newline at end of file +var _0xad13=['http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateCmHopperHistory','create','body','options','raw','AvgHandleTime','CmHopperHistory','findAll','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundReCallsDay','GetVoiceQueueHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x93f929,_0x5945b9){var _0x278195=function(_0x5a66f1){while(--_0x5a66f1){_0x93f929['push'](_0x93f929['shift']());}};_0x278195(++_0x5945b9);}(_0xad13,0x79));var _0x3ad1=function(_0x7f8db1,_0x491af7){_0x7f8db1=_0x7f8db1-0x0;var _0x4a8b20=_0xad13[_0x7f8db1];return _0x4a8b20;};'use strict';var _=require(_0x3ad1('0x0'));var util=require('util');var moment=require(_0x3ad1('0x1'));var BPromise=require(_0x3ad1('0x2'));var rs=require(_0x3ad1('0x3'));var fs=require('fs');var Redis=require(_0x3ad1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ad1('0x5'));var logger=require(_0x3ad1('0x6'))(_0x3ad1('0x7'));var config=require(_0x3ad1('0x8'));var jayson=require(_0x3ad1('0x9'));var client=jayson[_0x3ad1('0xa')][_0x3ad1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23ed63,_0x44fd50,_0x313ad9){return new BPromise(function(_0x4d27b0,_0x2429f4){return client[_0x3ad1('0xc')](_0x23ed63,_0x313ad9)[_0x3ad1('0xd')](function(_0x4e93df){logger[_0x3ad1('0xe')](_0x3ad1('0xf'),_0x44fd50,'request\x20sent');logger[_0x3ad1('0x10')](_0x3ad1('0x11'),_0x44fd50,_0x3ad1('0x12'),JSON[_0x3ad1('0x13')](_0x4e93df));if(_0x4e93df[_0x3ad1('0x14')]){if(_0x4e93df[_0x3ad1('0x14')]['code']===0x1f4){logger['error'](_0x3ad1('0xf'),_0x44fd50,_0x4e93df[_0x3ad1('0x14')][_0x3ad1('0x15')]);return _0x2429f4(_0x4e93df[_0x3ad1('0x14')]['message']);}logger[_0x3ad1('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x44fd50,_0x4e93df[_0x3ad1('0x14')][_0x3ad1('0x15')]);return _0x4d27b0(_0x4e93df[_0x3ad1('0x14')][_0x3ad1('0x15')]);}else{logger[_0x3ad1('0xe')](_0x3ad1('0xf'),_0x44fd50,_0x3ad1('0x12'));_0x4d27b0(_0x4e93df[_0x3ad1('0x16')][_0x3ad1('0x15')]);}})[_0x3ad1('0x17')](function(_0x1d924e){logger[_0x3ad1('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x44fd50,_0x1d924e);_0x2429f4(_0x1d924e);});});}exports[_0x3ad1('0x18')]=function(_0x30e53f){var _0x79b791=this;return new Promise(function(_0xd43203,_0x11e3ed){return db['CmHopperHistory'][_0x3ad1('0x19')](_0x30e53f[_0x3ad1('0x1a')],{'raw':_0x30e53f['options']?_0x30e53f[_0x3ad1('0x1b')][_0x3ad1('0x1c')]===undefined?!![]:![]:!![]})[_0x3ad1('0xd')](function(_0x46649d){logger[_0x3ad1('0xe')](_0x3ad1('0x18'),_0x30e53f);logger['debug'](_0x3ad1('0x18'),_0x30e53f,JSON['stringify'](_0x46649d));_0xd43203(_0x46649d);})[_0x3ad1('0x17')](function(_0x5f1031){logger[_0x3ad1('0x14')](_0x3ad1('0x18'),_0x5f1031[_0x3ad1('0x15')],_0x30e53f);_0x11e3ed(_0x79b791[_0x3ad1('0x14')](0x1f4,_0x5f1031[_0x3ad1('0x15')]));});});};exports[_0x3ad1('0x1d')]=function(_0x2fd5e6){var _0x591c61=this;return new Promise(function(_0x5e36fe,_0x466d91){return db[_0x3ad1('0x1e')][_0x3ad1('0x1f')]({'raw':_0x2fd5e6[_0x3ad1('0x1b')]?_0x2fd5e6[_0x3ad1('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2fd5e6['options']?_0x2fd5e6[_0x3ad1('0x1b')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')][_0x3ad1('0x22')]('id')),_0x3ad1('0x23')],[db['sequelize']['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')]['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')](_0x3ad1('0x25')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x3ad1('0x20'),db['sequelize']['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')](_0x3ad1('0x26')))),_0x3ad1('0x27')],[db[_0x3ad1('0x21')]['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')]['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3ad1('0x28')],[db['sequelize']['fn'](_0x3ad1('0x29'),db[_0x3ad1('0x21')]['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')](_0x3ad1('0x2a')))),_0x3ad1('0x2b')],[db[_0x3ad1('0x21')]['fn']('AVG',db[_0x3ad1('0x21')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3ad1('0x2c')]]})[_0x3ad1('0xd')](function(_0xa4ccc3){logger[_0x3ad1('0xe')](_0x3ad1('0x1d'),_0x2fd5e6);logger[_0x3ad1('0x10')]('AvgHandleTime',_0x2fd5e6,JSON['stringify'](_0xa4ccc3));_0x5e36fe(_0xa4ccc3);})[_0x3ad1('0x17')](function(_0x21f21){logger[_0x3ad1('0x14')](_0x3ad1('0x1d'),_0x21f21[_0x3ad1('0x15')],_0x2fd5e6);_0x466d91(_0x591c61['error'](0x1f4,_0x21f21['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x5d9365){var _0x528168=this;return new Promise(function(_0x5e878d,_0x5c2acd){return db[_0x3ad1('0x1e')][_0x3ad1('0x1f')]({'raw':_0x5d9365['options']?_0x5d9365[_0x3ad1('0x1b')][_0x3ad1('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d9365['options']?_0x5d9365[_0x3ad1('0x1b')]['where']||null:null,'attributes':[[_0x3ad1('0x2d'),_0x3ad1('0x2e')],[db[_0x3ad1('0x21')]['fn'](_0x3ad1('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x3ad1('0x24')](_0x3ad1('0x2f')))),_0x3ad1('0x30')],[db[_0x3ad1('0x21')]['fn']('COUNT',db[_0x3ad1('0x21')]['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')](_0x3ad1('0x31')))),'outboundNoAnswerCallsDay'],[db[_0x3ad1('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3ad1('0x21')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x3ad1('0x21')]['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')]['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0x3ad1('0x21')]['fn'](_0x3ad1('0x20'),db['sequelize']['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')]('`state`\x20=\x208,\x201,\x20null'))),_0x3ad1('0x32')],[db[_0x3ad1('0x21')]['fn']('COUNT',db[_0x3ad1('0x21')]['fn']('IF',db['sequelize'][_0x3ad1('0x24')](_0x3ad1('0x33')))),_0x3ad1('0x34')],[db[_0x3ad1('0x21')]['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')]['fn']('IF',db[_0x3ad1('0x21')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3ad1('0x35')],[db[_0x3ad1('0x21')]['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')]['fn']('IF',db['sequelize']['literal'](_0x3ad1('0x36')))),'outboundUnknownCallsDay'],[db[_0x3ad1('0x21')]['fn']('COUNT',db[_0x3ad1('0x21')]['fn']('IF',db['sequelize'][_0x3ad1('0x24')](_0x3ad1('0x37')))),_0x3ad1('0x38')],[db['sequelize']['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')]['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),_0x3ad1('0x39')],[db[_0x3ad1('0x21')]['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')]['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')]['fn']('IF',db['sequelize']['literal'](_0x3ad1('0x3a')))),_0x3ad1('0x3b')],[db[_0x3ad1('0x21')]['fn'](_0x3ad1('0x20'),db['sequelize']['fn']('IF',db[_0x3ad1('0x21')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x3ad1('0x21')]['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')]['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x3ad1('0x3c')]],'group':[_0x3ad1('0x2d')]})[_0x3ad1('0xd')](function(_0x4081d4){logger[_0x3ad1('0xe')]('GetVoiceQueueHopperHistory',_0x5d9365);logger[_0x3ad1('0x10')](_0x3ad1('0x3d'),_0x5d9365,JSON[_0x3ad1('0x13')](_0x4081d4));_0x5e878d(_0x4081d4);})[_0x3ad1('0x17')](function(_0x350d40){logger[_0x3ad1('0x14')](_0x3ad1('0x3d'),_0x350d40[_0x3ad1('0x15')],_0x5d9365);_0x5c2acd(_0x528168[_0x3ad1('0x14')](0x1f4,_0x350d40[_0x3ad1('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x58ccef){var _0x42a2ac=this;return new Promise(function(_0x4e0fe8,_0x34d9c2){return db[_0x3ad1('0x1e')][_0x3ad1('0x1f')]({'raw':_0x58ccef['options']?_0x58ccef[_0x3ad1('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x58ccef[_0x3ad1('0x1b')]?_0x58ccef['options'][_0x3ad1('0x3e')]||null:null,'attributes':[[_0x3ad1('0x2d'),'name'],[db[_0x3ad1('0x21')]['fn'](_0x3ad1('0x20'),db[_0x3ad1('0x21')][_0x3ad1('0x22')]('id')),_0x3ad1('0x3f')],[db['sequelize']['fn'](_0x3ad1('0x20'),db['sequelize']['fn']('IF',db[_0x3ad1('0x21')][_0x3ad1('0x24')](_0x3ad1('0x25')))),_0x3ad1('0x40')]],'group':[_0x3ad1('0x2d')]})[_0x3ad1('0xd')](function(_0x924273){logger[_0x3ad1('0xe')]('GetCampaignHopperHistory',_0x58ccef);logger[_0x3ad1('0x10')](_0x3ad1('0x41'),_0x58ccef,JSON[_0x3ad1('0x13')](_0x924273));_0x4e0fe8(_0x924273);})[_0x3ad1('0x17')](function(_0x1d1403){logger[_0x3ad1('0x14')]('GetCampaignHopperHistory',_0x1d1403[_0x3ad1('0x15')],_0x58ccef);_0x34d9c2(_0x42a2ac[_0x3ad1('0x14')](0x1f4,_0x1d1403[_0x3ad1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 7f83fb0..b86fdcf 100644 --- a/server/api/cmHopperHistory/index.js +++ b/server/api/cmHopperHistory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb651=['post','create','put','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x13fc36,_0x4cdc35){var _0x5937d5=function(_0x17da60){while(--_0x17da60){_0x13fc36['push'](_0x13fc36['shift']());}};_0x5937d5(++_0x4cdc35);}(_0xb651,0x8c));var _0x1b65=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xb651[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x1b65('0x0'));var util=require('util');var path=require(_0x1b65('0x1'));var timeout=require(_0x1b65('0x2'));var express=require(_0x1b65('0x3'));var router=express['Router']();var fs_extra=require(_0x1b65('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1b65('0x5'));var config=require(_0x1b65('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x1b65('0x7')]('/',auth[_0x1b65('0x8')](),controller[_0x1b65('0x9')]);router[_0x1b65('0x7')]('/describe',auth[_0x1b65('0x8')](),controller[_0x1b65('0xa')]);router['get'](_0x1b65('0xb'),auth[_0x1b65('0x8')](),controller[_0x1b65('0xc')]);router[_0x1b65('0xd')]('/',auth['isAuthenticated'](),controller[_0x1b65('0xe')]);router[_0x1b65('0xf')](_0x1b65('0xb'),auth['isAuthenticated'](),controller['update']);module[_0x1b65('0x10')]=router; \ No newline at end of file +var _0x42db=['isAuthenticated','describe','/:id','post','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe'];(function(_0x475675,_0x5839f6){var _0x92d2a0=function(_0x2ac8d1){while(--_0x2ac8d1){_0x475675['push'](_0x475675['shift']());}};_0x92d2a0(++_0x5839f6);}(_0x42db,0x79));var _0xb42d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x42db[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb42d('0x0'));var util=require(_0xb42d('0x1'));var path=require(_0xb42d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb42d('0x3'));var router=express[_0xb42d('0x4')]();var fs_extra=require(_0xb42d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb42d('0x6'));var config=require(_0xb42d('0x7'));var controller=require(_0xb42d('0x8'));router[_0xb42d('0x9')]('/',auth['isAuthenticated'](),controller[_0xb42d('0xa')]);router[_0xb42d('0x9')](_0xb42d('0xb'),auth[_0xb42d('0xc')](),controller[_0xb42d('0xd')]);router[_0xb42d('0x9')](_0xb42d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xb42d('0xf')]('/',auth[_0xb42d('0xc')](),controller['create']);router[_0xb42d('0x10')](_0xb42d('0xe'),auth[_0xb42d('0xc')](),controller[_0xb42d('0x11')]);module[_0xb42d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c934f21..8f6594f 100644 --- a/server/api/cmList/cmList.attributes.js +++ b/server/api/cmList/cmList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50b9=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50b9,0x171));var _0x950b=function(_0x3a8ce2,_0x552ad5){_0x3a8ce2=_0x3a8ce2-0x0;var _0x2e5a45=_0x50b9[_0x3a8ce2];return _0x2e5a45;};'use strict';var Sequelize=require(_0x950b('0x0'));module['exports']={'name':{'type':Sequelize[_0x950b('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x950b('0x1')]},'dialPrefix':{'type':Sequelize[_0x950b('0x1')]}}; \ No newline at end of file +var _0x7722=['STRING','name','sequelize','exports'];(function(_0x3bd749,_0xa93c27){var _0x3ec8f7=function(_0x326c){while(--_0x326c){_0x3bd749['push'](_0x3bd749['shift']());}};_0x3ec8f7(++_0xa93c27);}(_0x7722,0x14e));var _0x2772=function(_0x39362f,_0x54694c){_0x39362f=_0x39362f-0x0;var _0x3e3753=_0x7722[_0x39362f];return _0x3e3753;};'use strict';var Sequelize=require(_0x2772('0x0'));module[_0x2772('0x1')]={'name':{'type':Sequelize[_0x2772('0x2')],'unique':_0x2772('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2772('0x2')]},'dialPrefix':{'type':Sequelize[_0x2772('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e5d2bf4..258c307 100644 --- a/server/api/cmList/cmList.controller.js +++ b/server/api/cmList/cmList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc18f=['../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','destroy','error','stack','name','index','CmList','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','intersection','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','create','findOne','hasOwnProperty','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','success','push','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','OrderBy','alias','select','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','from','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','writeFileSync','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','transaction','addCustomFields','TEXT','text','type','number','Sequelize','INTEGER','switch','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','info','sequelize','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x7f37b,_0x2753a9){var _0x537068=function(_0x273ce6){while(--_0x273ce6){_0x7f37b['push'](_0x7f37b['shift']());}};_0x537068(++_0x2753a9);}(_0xc18f,0x1dc));var _0xfc18=function(_0x1eaa6a,_0x52d5e7){_0x1eaa6a=_0x1eaa6a-0x0;var _0x5b6238=_0xc18f[_0x1eaa6a];return _0x5b6238;};'use strict';var emlformat=require(_0xfc18('0x0'));var rimraf=require(_0xfc18('0x1'));var zipdir=require(_0xfc18('0x2'));var jsonpatch=require(_0xfc18('0x3'));var rp=require(_0xfc18('0x4'));var moment=require(_0xfc18('0x5'));var BPromise=require(_0xfc18('0x6'));var Mustache=require(_0xfc18('0x7'));var util=require('util');var path=require(_0xfc18('0x8'));var sox=require('sox');var csv=require(_0xfc18('0x9'));var ejs=require(_0xfc18('0xa'));var fs=require('fs');var fs_extra=require(_0xfc18('0xb'));var _=require(_0xfc18('0xc'));var squel=require(_0xfc18('0xd'));var crypto=require(_0xfc18('0xe'));var jsforce=require(_0xfc18('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfc18('0x9'));var querystring=require(_0xfc18('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc18('0x11'));var hardwareService=require(_0xfc18('0x12'));var logger=require(_0xfc18('0x13'))(_0xfc18('0x14'));var utils=require(_0xfc18('0x15'));var config=require(_0xfc18('0x16'));var licenseUtil=require(_0xfc18('0x17'));var db=require(_0xfc18('0x18'))['db'];var csv_results;config[_0xfc18('0x19')]=_['defaults'](config[_0xfc18('0x19')],{'host':_0xfc18('0x1a'),'port':0x18eb});var socket=require(_0xfc18('0x1b'))(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x3c3299,_0x5ea0ec){_0x5ea0ec=_0x5ea0ec||0xcc;return function(_0x534418){if(_0x534418){return _0x3c3299[_0xfc18('0x1c')](_0x5ea0ec);}return _0x3c3299[_0xfc18('0x1d')](_0x5ea0ec)[_0xfc18('0x1e')]();};}function respondWithResult(_0x1f6936,_0x3fc06d){_0x3fc06d=_0x3fc06d||0xc8;return function(_0x46bbc6){if(_0x46bbc6){return _0x1f6936[_0xfc18('0x1d')](_0x3fc06d)[_0xfc18('0x1f')](_0x46bbc6);}};}function respondWithFilteredResult(_0x81b76b,_0x27ec61){return function(_0x3d0bdd){if(_0x3d0bdd){var _0x156499=typeof _0x27ec61[_0xfc18('0x20')]===_0xfc18('0x21')&&typeof _0x27ec61[_0xfc18('0x22')]==='undefined';var _0x36847b=_0x3d0bdd[_0xfc18('0x23')];var _0x4c068f=_0x156499?0x0:_0x27ec61[_0xfc18('0x20')];var _0x5ba027=_0x156499?_0x3d0bdd[_0xfc18('0x23')]:_0x27ec61[_0xfc18('0x20')]+_0x27ec61[_0xfc18('0x22')];var _0xdaac64;if(_0x5ba027>=_0x36847b){_0x5ba027=_0x36847b;_0xdaac64=0xc8;}else{_0xdaac64=0xce;}_0x81b76b[_0xfc18('0x1d')](_0xdaac64);return _0x81b76b[_0xfc18('0x24')](_0xfc18('0x25'),_0x4c068f+'-'+_0x5ba027+'/'+_0x36847b)[_0xfc18('0x1f')](_0x3d0bdd);}return null;};}function patchUpdates(_0x537beb){return function(_0x330b98){try{jsonpatch['apply'](_0x330b98,_0x537beb,!![]);}catch(_0x3cb01f){return BPromise['reject'](_0x3cb01f);}return _0x330b98[_0xfc18('0x26')]();};}function saveUpdates(_0x477c9f,_0x1b7586){return function(_0x31a433){if(_0x31a433){return _0x31a433[_0xfc18('0x27')](_0x477c9f)[_0xfc18('0x28')](function(_0x2fcc49){return _0x2fcc49;});}return null;};}function removeEntity(_0x2f3b4d,_0x10d6e5){return function(_0x2133f4){if(_0x2133f4){return _0x2133f4['destroy']()[_0xfc18('0x28')](function(){var _0xd425aa=_0x2133f4[_0xfc18('0x29')]({'plain':!![]});var _0x53ef20='Lists';return db['UserProfileResource'][_0xfc18('0x2a')]({'where':{'type':_0x53ef20,'resourceId':_0xd425aa['id']}})[_0xfc18('0x28')](function(){return _0x2133f4;});})['then'](function(){_0x2f3b4d[_0xfc18('0x1d')](0xcc)[_0xfc18('0x1e')]();});}};}function handleEntityNotFound(_0x3cccff,_0x4dc7fe){return function(_0x5228a3){if(!_0x5228a3){_0x3cccff['sendStatus'](0x194);}return _0x5228a3;};}function handleError(_0x34f28d,_0xc60304){_0xc60304=_0xc60304||0x1f4;return function(_0x49040d){logger[_0xfc18('0x2b')](_0x49040d[_0xfc18('0x2c')]);if(_0x49040d['name']){delete _0x49040d[_0xfc18('0x2d')];}_0x34f28d['status'](_0xc60304)['send'](_0x49040d);};}exports[_0xfc18('0x2e')]=function(_0x3f04f1,_0x3de684){var _0x22efc8={},_0x2579a0={},_0x9a4351={'count':0x0,'rows':[]};var _0x56acea=_['map'](db[_0xfc18('0x2f')][_0xfc18('0x30')],function(_0x55e08f){return{'name':_0x55e08f[_0xfc18('0x31')],'type':_0x55e08f['type'][_0xfc18('0x32')]};});_0x2579a0[_0xfc18('0x33')]=_[_0xfc18('0x34')](_0x56acea,_0xfc18('0x2d'));_0x2579a0[_0xfc18('0x35')]=_[_0xfc18('0x36')](_0x3f04f1['query']);_0x2579a0[_0xfc18('0x37')]=_['intersection'](_0x2579a0[_0xfc18('0x33')],_0x2579a0[_0xfc18('0x35')]);_0x22efc8[_0xfc18('0x38')]=_['intersection'](_0x2579a0[_0xfc18('0x33')],qs[_0xfc18('0x39')](_0x3f04f1[_0xfc18('0x35')][_0xfc18('0x39')]));_0x22efc8['attributes']=_0x22efc8['attributes'][_0xfc18('0x3a')]?_0x22efc8[_0xfc18('0x38')]:_0x2579a0[_0xfc18('0x33')];if(!_0x3f04f1[_0xfc18('0x35')]['hasOwnProperty'](_0xfc18('0x3b'))){_0x22efc8[_0xfc18('0x22')]=qs[_0xfc18('0x22')](_0x3f04f1[_0xfc18('0x35')]['limit']);_0x22efc8[_0xfc18('0x20')]=qs[_0xfc18('0x20')](_0x3f04f1['query'][_0xfc18('0x20')]);}_0x22efc8[_0xfc18('0x3c')]=qs[_0xfc18('0x3d')](_0x3f04f1[_0xfc18('0x35')][_0xfc18('0x3d')]);_0x22efc8['where']=qs[_0xfc18('0x37')](_['pick'](_0x3f04f1[_0xfc18('0x35')],_0x2579a0[_0xfc18('0x37')]),_0x56acea);if(_0x3f04f1[_0xfc18('0x35')][_0xfc18('0x3e')]){_0x22efc8[_0xfc18('0x3f')]=_[_0xfc18('0x40')](_0x22efc8[_0xfc18('0x3f')],{'$or':_['map'](_0x56acea,function(_0x3f71f7){if(_0x3f71f7['type']!==_0xfc18('0x41')){var _0x12fd54={};_0x12fd54[_0x3f71f7[_0xfc18('0x2d')]]={'$like':'%'+_0x3f04f1[_0xfc18('0x35')][_0xfc18('0x3e')]+'%'};return _0x12fd54;}})});}_0x22efc8=_[_0xfc18('0x40')]({},_0x22efc8,_0x3f04f1[_0xfc18('0x42')]);var _0x22f391={'where':_0x22efc8[_0xfc18('0x3f')]};return db['CmList'][_0xfc18('0x23')](_0x22f391)[_0xfc18('0x28')](function(_0x325402){_0x9a4351[_0xfc18('0x23')]=_0x325402;if(_0x3f04f1['query'][_0xfc18('0x43')]){_0x22efc8[_0xfc18('0x44')]=[{'all':!![]}];}return db[_0xfc18('0x2f')][_0xfc18('0x45')](_0x22efc8);})['then'](function(_0x273d51){_0x9a4351[_0xfc18('0x46')]=_0x273d51;return _0x9a4351;})[_0xfc18('0x28')](respondWithFilteredResult(_0x3de684,_0x22efc8))[_0xfc18('0x47')](handleError(_0x3de684,null));};exports['show']=function(_0x110e33,_0x1f0141){var _0x316829={'raw':![],'where':{'id':_0x110e33['params']['id']}},_0x518168={};_0x518168[_0xfc18('0x33')]=_[_0xfc18('0x36')](db[_0xfc18('0x2f')][_0xfc18('0x30')]);_0x518168['query']=_[_0xfc18('0x36')](_0x110e33[_0xfc18('0x35')]);_0x518168[_0xfc18('0x37')]=_['intersection'](_0x518168[_0xfc18('0x33')],_0x518168[_0xfc18('0x35')]);_0x316829[_0xfc18('0x38')]=_[_0xfc18('0x48')](_0x518168[_0xfc18('0x33')],qs[_0xfc18('0x39')](_0x110e33[_0xfc18('0x35')][_0xfc18('0x39')]));_0x316829[_0xfc18('0x38')]=_0x316829[_0xfc18('0x38')][_0xfc18('0x3a')]?_0x316829['attributes']:_0x518168[_0xfc18('0x33')];if(_0x110e33['query']['includeAll']){_0x316829['include']=[{'all':!![]}];}_0x316829=_[_0xfc18('0x40')]({},_0x316829,_0x110e33[_0xfc18('0x42')]);return db[_0xfc18('0x2f')]['find'](_0x316829)[_0xfc18('0x28')](handleEntityNotFound(_0x1f0141,null))[_0xfc18('0x28')](respondWithResult(_0x1f0141,null))[_0xfc18('0x47')](handleError(_0x1f0141,null));};exports['create']=function(_0xea2331,_0x4d9d95){return db[_0xfc18('0x2f')]['create'](_0xea2331[_0xfc18('0x49')],{})[_0xfc18('0x28')](function(_0x17ad91){var _0x5c6c23=_0xea2331[_0xfc18('0x4a')][_0xfc18('0x29')]({'plain':!![]});if(!_0x5c6c23)throw new Error(_0xfc18('0x4b'));if(_0x5c6c23[_0xfc18('0x4c')]===_0xfc18('0x4a')){var _0x30bb01=_0x17ad91[_0xfc18('0x29')]({'plain':!![]});var _0x25b529=_0xfc18('0x4d');return db[_0xfc18('0x4e')][_0xfc18('0x4f')]({'where':{'name':_0x25b529,'userProfileId':_0x5c6c23[_0xfc18('0x50')]},'raw':!![]})[_0xfc18('0x28')](function(_0x30a99d){if(_0x30a99d&&_0x30a99d[_0xfc18('0x51')]===0x0){return db[_0xfc18('0x52')]['create']({'name':_0x30bb01[_0xfc18('0x2d')],'resourceId':_0x30bb01['id'],'type':_0x30a99d[_0xfc18('0x2d')],'sectionId':_0x30a99d['id']},{})[_0xfc18('0x28')](function(){return _0x17ad91;});}else{return _0x17ad91;}})[_0xfc18('0x47')](function(_0x225c9c){logger[_0xfc18('0x2b')](_0xfc18('0x53'),_0x225c9c);throw _0x225c9c;});}return _0x17ad91;})[_0xfc18('0x28')](respondWithResult(_0x4d9d95,0xc9))['catch'](handleError(_0x4d9d95,null));};exports[_0xfc18('0x27')]=function(_0x1509ec,_0x52bbfb){if(_0x1509ec[_0xfc18('0x49')]['id']){delete _0x1509ec[_0xfc18('0x49')]['id'];}return db[_0xfc18('0x2f')][_0xfc18('0x4f')]({'where':{'id':_0x1509ec[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x52bbfb,null))[_0xfc18('0x28')](saveUpdates(_0x1509ec['body'],null))[_0xfc18('0x28')](respondWithResult(_0x52bbfb,null))['catch'](handleError(_0x52bbfb,null));};exports[_0xfc18('0x2a')]=function(_0x476477,_0x16c953){return db[_0xfc18('0x2f')][_0xfc18('0x4f')]({'where':{'id':_0x476477[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x16c953,null))['then'](removeEntity(_0x16c953,null))[_0xfc18('0x47')](handleError(_0x16c953,null));};exports['describe']=function(_0x2e039c,_0x291b03){return db[_0xfc18('0x2f')][_0xfc18('0x55')]()[_0xfc18('0x28')](respondWithResult(_0x291b03,null))[_0xfc18('0x47')](handleError(_0x291b03,null));};exports[_0xfc18('0x56')]=function(_0x459ab4,_0x107394,_0x40821d){if(_0x459ab4[_0xfc18('0x49')]['id']){delete _0x459ab4['body']['id'];}return db[_0xfc18('0x2f')]['find']({'where':{'id':_0x459ab4[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x107394,null))[_0xfc18('0x28')](function(_0x28ed7f){if(_0x28ed7f){_0x459ab4[_0xfc18('0x49')][_0xfc18('0x57')]=_0x28ed7f['id'];return db[_0xfc18('0x58')][_0xfc18('0x59')](_0x459ab4['body']);}})['then'](respondWithResult(_0x107394,null))[_0xfc18('0x47')](handleError(_0x107394,null));};exports['getDispositions']=function(_0x5ce4d9,_0x1dabcd,_0x2c9dd0){var _0x4df3bc={'raw':![],'where':{}};var _0x597f65={};var _0x543d66={'count':0x0,'rows':[]};return db[_0xfc18('0x2f')][_0xfc18('0x5a')]({'where':{'id':_0x5ce4d9[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x1dabcd,null))['then'](function(_0x18ca35){if(_0x18ca35){_0x597f65[_0xfc18('0x33')]=_[_0xfc18('0x36')](db['Disposition'][_0xfc18('0x30')]);_0x597f65['query']=_[_0xfc18('0x36')](_0x5ce4d9['query']);_0x597f65['filters']=_[_0xfc18('0x48')](_0x597f65[_0xfc18('0x33')],_0x597f65[_0xfc18('0x35')]);_0x4df3bc[_0xfc18('0x38')]=_[_0xfc18('0x48')](_0x597f65[_0xfc18('0x33')],qs[_0xfc18('0x39')](_0x5ce4d9['query'][_0xfc18('0x39')]));_0x4df3bc[_0xfc18('0x38')]=_0x4df3bc[_0xfc18('0x38')]['length']?_0x4df3bc[_0xfc18('0x38')]:_0x597f65[_0xfc18('0x33')];if(!_0x5ce4d9[_0xfc18('0x35')][_0xfc18('0x5b')]('nolimit')){_0x4df3bc[_0xfc18('0x22')]=qs['limit'](_0x5ce4d9[_0xfc18('0x35')][_0xfc18('0x22')]);_0x4df3bc[_0xfc18('0x20')]=qs[_0xfc18('0x20')](_0x5ce4d9[_0xfc18('0x35')]['offset']);}_0x4df3bc[_0xfc18('0x3c')]=qs[_0xfc18('0x3d')](_0x5ce4d9['query'][_0xfc18('0x3d')]);_0x4df3bc[_0xfc18('0x3f')]=qs[_0xfc18('0x37')](_[_0xfc18('0x5c')](_0x5ce4d9['query'],_0x597f65[_0xfc18('0x37')]));_0x4df3bc['where'][_0xfc18('0x57')]=_0x18ca35['id'];if(_0x5ce4d9[_0xfc18('0x35')][_0xfc18('0x3e')]){_0x4df3bc[_0xfc18('0x3f')]=_[_0xfc18('0x40')](_0x4df3bc['where'],{'$or':_[_0xfc18('0x34')](_0x4df3bc[_0xfc18('0x38')],function(_0x5b62aa){var _0x53e83c={};_0x53e83c[_0x5b62aa]={'$like':'%'+_0x5ce4d9['query'][_0xfc18('0x3e')]+'%'};return _0x53e83c;})});}_0x4df3bc=_[_0xfc18('0x40')]({},_0x4df3bc,_0x5ce4d9[_0xfc18('0x42')]);return db[_0xfc18('0x58')][_0xfc18('0x23')]({'where':_0x4df3bc[_0xfc18('0x3f')]})[_0xfc18('0x28')](function(_0x21fa8a){_0x543d66[_0xfc18('0x23')]=_0x21fa8a;if(_0x5ce4d9['query'][_0xfc18('0x43')]){_0x4df3bc[_0xfc18('0x44')]=[{'all':!![]}];}return db[_0xfc18('0x58')][_0xfc18('0x45')](_0x4df3bc);})[_0xfc18('0x28')](function(_0xef9705){_0x543d66[_0xfc18('0x46')]=_0xef9705;return _0x543d66;});}})['then'](respondWithFilteredResult(_0x1dabcd,_0x4df3bc))[_0xfc18('0x47')](handleError(_0x1dabcd,null));};exports[_0xfc18('0x5d')]=function(_0x3ad7aa,_0x1ccabe,_0x1a78bc){return db[_0xfc18('0x2f')][_0xfc18('0x4f')]({'where':{'id':_0x3ad7aa[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x1ccabe,null))[_0xfc18('0x28')](function(_0x5e153a){if(_0x5e153a){return _0x5e153a[_0xfc18('0x5d')](_0x3ad7aa[_0xfc18('0x35')][_0xfc18('0x5e')]);}})[_0xfc18('0x28')](respondWithStatusCode(_0x1ccabe,null))[_0xfc18('0x47')](handleError(_0x1ccabe,null));};exports[_0xfc18('0x5f')]=function(_0x5f2324,_0x5b642f,_0x2e9c2b){return db[_0xfc18('0x2f')][_0xfc18('0x4f')]({'where':{'id':_0x5f2324[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x5b642f,null))['then'](function(_0x42c10f){if(_0x42c10f){var _0x4911eb=[];var _0x2205fb={'success':[],'errors':[]};return db[_0xfc18('0x60')][_0xfc18('0x55')]()[_0xfc18('0x28')](function(_0x34a289){if(_0x5f2324[_0xfc18('0x49')][_0xfc18('0x61')]&&_[_0xfc18('0x62')](_0x5f2324['body']['tags'])){if(_0x5f2324['body'][_0xfc18('0x61')][_0xfc18('0x3a')]){_0x5f2324[_0xfc18('0x49')]['tags']=_0x5f2324[_0xfc18('0x49')][_0xfc18('0x61')]['join'](';')+';';}else{_0x5f2324['body'][_0xfc18('0x61')]=null;}}else{_0x5f2324[_0xfc18('0x49')][_0xfc18('0x61')]=null;}if(_0x5f2324[_0xfc18('0x49')]&&_[_0xfc18('0x62')](_0x5f2324['body'])){for(var _0x59e991=0x0;_0x59e991<_0x5f2324[_0xfc18('0x49')]['length'];_0x59e991+=0x1){_0x5f2324['body'][_0x59e991][_0xfc18('0x57')]=_0x5f2324['params']['id'];_0x4911eb['push'](_0x5f2324['body'][_0x59e991]);}return BPromise[_0xfc18('0x63')](_0x4911eb,function(_0x4b7a29){return db[_0xfc18('0x60')]['create'](_['omit'](_0x4b7a29,[_0xfc18('0x5e'),'id'])||{},{'fields':_[_0xfc18('0x36')](_0x34a289),'raw':!![]})['then'](function(_0x542a4f){_0x2205fb[_0xfc18('0x64')][_0xfc18('0x65')](_0x542a4f[_0xfc18('0x66')]);})['catch'](function(_0x2de1c0){_0x2205fb[_0xfc18('0x67')]['push']({'data':_0x4b7a29,'error':_0x2de1c0['message']});});})[_0xfc18('0x28')](function(_0x24141b){return _0x2205fb;})[_0xfc18('0x47')](function(_0x4f32d4){return _0x4f32d4;});}else{_0x5b642f[_0xfc18('0x1d')](0x190)[_0xfc18('0x1f')]({'message':_0xfc18('0x68')});}});}})[_0xfc18('0x28')](respondWithResult(_0x5b642f,null))[_0xfc18('0x47')](handleError(_0x5b642f,null));};exports[_0xfc18('0x69')]=function(_0x36b324,_0x3abefe,_0x59f7fb){var _0x1b865b;return db['CmList'][_0xfc18('0x4f')]({'where':{'id':_0x36b324[_0xfc18('0x54')]['id']},'include':[{'model':db[_0xfc18('0x6a')],'as':'CustomFields'}]})[_0xfc18('0x28')](handleEntityNotFound(_0x3abefe,null))[_0xfc18('0x28')](function(_0x476ed8){if(_0x476ed8){_0x1b865b=_0x476ed8;return db[_0xfc18('0x60')][_0xfc18('0x30')];}})['then'](function(_0x249fb1){if(_0x249fb1){var _0x699aba={};var _0x3a9469={};_0x3a9469[_0xfc18('0x33')]=_[_0xfc18('0x6b')](_[_0xfc18('0x36')](_0x249fb1),_[_0xfc18('0x34')](_0x1b865b[_0xfc18('0x6c')],function(_0x245aa4){return util[_0xfc18('0x6d')](_0xfc18('0x6e'),_0x245aa4['id']);}));_0x3a9469[_0xfc18('0x35')]=_[_0xfc18('0x36')](_0x36b324[_0xfc18('0x35')]);_0x3a9469['filters']=_[_0xfc18('0x48')](_0x3a9469[_0xfc18('0x33')],_0x3a9469[_0xfc18('0x35')]);_0x699aba[_0xfc18('0x38')]=_[_0xfc18('0x48')](_0x3a9469[_0xfc18('0x33')],qs['fields'](_0x36b324[_0xfc18('0x35')][_0xfc18('0x39')]));_0x699aba[_0xfc18('0x38')]=_0x699aba[_0xfc18('0x38')][_0xfc18('0x3a')]?_0x699aba['attributes']:_0x3a9469['model'];if(!_0x36b324[_0xfc18('0x35')][_0xfc18('0x5b')](_0xfc18('0x3b'))){_0x699aba[_0xfc18('0x22')]=qs[_0xfc18('0x22')](_0x36b324[_0xfc18('0x35')][_0xfc18('0x22')]);_0x699aba[_0xfc18('0x20')]=qs['offset'](_0x36b324['query'][_0xfc18('0x20')]);}_0x699aba[_0xfc18('0x3c')]=qs['sort'](_0x36b324[_0xfc18('0x35')][_0xfc18('0x3d')]);_0x699aba['where']=qs[_0xfc18('0x37')](_[_0xfc18('0x5c')](_0x36b324[_0xfc18('0x35')],_0x3a9469[_0xfc18('0x37')]));_0x699aba[_0xfc18('0x6f')]=!![];if(_0x36b324[_0xfc18('0x35')][_0xfc18('0x3e')]){_0x699aba['where']=_[_0xfc18('0x40')](_0x699aba[_0xfc18('0x3f')],{'$or':_['map'](_0x699aba[_0xfc18('0x38')],function(_0x974802){var _0x5be4aa={};_0x5be4aa[_0x974802]={'$like':'%'+_0x36b324[_0xfc18('0x35')][_0xfc18('0x3e')]+'%'};return _0x5be4aa;})});}_0x699aba=_[_0xfc18('0x40')]({},_0x699aba,_0x36b324[_0xfc18('0x42')]);return _0x1b865b[_0xfc18('0x69')](_0x699aba);}})[_0xfc18('0x28')](respondWithResult(_0x3abefe,null))[_0xfc18('0x47')](handleError(_0x3abefe,null));};exports[_0xfc18('0x70')]=function(_0x9f4b4f,_0x34d063,_0x4315b7){var _0x30251b;var _0x4e6d7f;var _0x402b91;var _0x5998bb=_0x9f4b4f[_0xfc18('0x54')]['id'];csv_results=[];return db['ContactItemType'][_0xfc18('0x45')]({'attributes':['id',_0xfc18('0x2d')],'raw':!![],'order':[_0xfc18('0x71')]})['then'](function(_0xfb112f){_0x30251b=_0xfb112f;var _0x1be2f0=_['keys'](db[_0xfc18('0x60')]['rawAttributes']);return db[_0xfc18('0x6a')][_0xfc18('0x45')]({'raw':!![],'attributes':['id',_0xfc18('0x72')]})[_0xfc18('0x28')](function(_0x123af8){_0x4e6d7f=_0x123af8;var _0x5c1b8f=squel[_0xfc18('0x73')]()[_0xfc18('0x39')](_0x1be2f0)['from'](_0xfc18('0x74'),'c')[_0xfc18('0x3f')]('c.ListId\x20=\x20?',_0x5998bb)[_0xfc18('0x3f')](_0xfc18('0x75'))[_0xfc18('0x76')]();for(var _0x373589=0x0;_0x373589<_0x4e6d7f[_0xfc18('0x3a')];_0x373589++){_0x5c1b8f[_0xfc18('0x77')](_0xfc18('0x78')+_0x4e6d7f[_0x373589]['id'],_0xfc18('0x79')+_0x4e6d7f[_0x373589][_0xfc18('0x72')]);}for(var _0x373589=0x0;_0x373589<_0x30251b['length'];_0x373589++){_0x5c1b8f[_0xfc18('0x77')](squel[_0xfc18('0x73')]()['field'](_0xfc18('0x7a'))['from'](_0xfc18('0x7b'))[_0xfc18('0x3f')](_0xfc18('0x7c'),_0x30251b[_0x373589]['id'])[_0xfc18('0x3f')]('CmContactId\x20=\x20c.id'),_0xfc18('0x7d')+_0x30251b[_0x373589][_0xfc18('0x2d')]);_0x5c1b8f[_0xfc18('0x77')](squel[_0xfc18('0x73')]()['field'](_0xfc18('0x7e'))[_0xfc18('0x7f')](_0xfc18('0x7b'))['where']('ItemTypeId\x20=\x20?',_0x30251b[_0x373589]['id'])[_0xfc18('0x3f')](_0xfc18('0x80')),_0xfc18('0x81')+_0x30251b[_0x373589][_0xfc18('0x2d')]);}var _0x33a256=[];_0x33a256[_0xfc18('0x65')](_0x5c1b8f[_0xfc18('0x82')]());BPromise['each'](_0x33a256,handleQuery)[_0xfc18('0x28')](function(_0x487cc8){handleQuery(_0x5c1b8f[_0xfc18('0x82')]());var _0x3d5875=csv_results[0x0];if(!_['isEmpty'](_0x3d5875)){var _0x2e0ec7=toCsv(_0x3d5875);var _0x68a079=Date[_0xfc18('0x83')]();fs[_0xfc18('0x84')](util[_0xfc18('0x6d')]('/tmp/list_%d_%s.csv',_0x5998bb,_0x68a079),_0x2e0ec7);_0x34d063['setHeader'](_0xfc18('0x85'),_0xfc18('0x86')+util[_0xfc18('0x6d')]('list_%d_%s.csv',_0x5998bb,_0x68a079));_0x34d063[_0xfc18('0x87')](_0xfc18('0x88'),_0xfc18('0x89'));return _0x34d063[_0xfc18('0x8a')](util[_0xfc18('0x6d')](_0xfc18('0x8b'),_0x5998bb,_0x68a079));}else{return _0x34d063['sendStatus'](0xcc);}});});});};exports[_0xfc18('0x8c')]=function(_0x99d5ae,_0x11ad7d,_0x2ee259){var _0x4466dc;delete _0x99d5ae[_0xfc18('0x49')]['id'];return db['CmList'][_0xfc18('0x5a')]({'where':{'id':_0x99d5ae['params']['id']}})['then'](handleEntityNotFound(_0x11ad7d,null))[_0xfc18('0x28')](function(_0x514dc4){if(_0x514dc4){return db['sequelize'][_0xfc18('0x8d')](function(_0x5ec42b){return db['CmCustomField'][_0xfc18('0x59')](_0x99d5ae['body'],{'transaction':_0x5ec42b})[_0xfc18('0x28')](function(_0x432f18){_0x4466dc=_0x432f18;return _0x514dc4[_0xfc18('0x8e')](_0x432f18,{'transaction':_0x5ec42b});})[_0xfc18('0x28')](function(){var _0x4e8dfb={'type':db['Sequelize'][_0xfc18('0x8f')],'transaction':_0x5ec42b};switch(_0x99d5ae[_0xfc18('0x49')]['type']){case _0xfc18('0x90'):_0x4e8dfb[_0xfc18('0x91')]=db['Sequelize'][_0xfc18('0x8f')];break;case _0xfc18('0x92'):_0x4e8dfb[_0xfc18('0x91')]=db[_0xfc18('0x93')][_0xfc18('0x94')];break;case _0xfc18('0x95'):_0x4e8dfb[_0xfc18('0x91')]=db[_0xfc18('0x93')]['BOOLEAN'];_0x4e8dfb['defaultValue']=![];break;default:}return db['sequelize'][_0xfc18('0x96')][_0xfc18('0x97')](_0xfc18('0x74'),util['format'](_0xfc18('0x98'),_0x4466dc['id']),_0x4e8dfb);})[_0xfc18('0x28')](function(){return _0x4466dc;});});}})['then'](respondWithResult(_0x11ad7d,null))['catch'](handleError(_0x11ad7d,null));};exports[_0xfc18('0x99')]=function(_0x2ab46e,_0xd95f9f,_0x3f3e1c){var _0x159e20={};var _0x503e95={};var _0x31f764;var _0x4c2636;return db['CmList'][_0xfc18('0x5a')]({'where':{'id':_0x2ab46e['params']['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0xd95f9f,null))[_0xfc18('0x28')](function(_0xc0175f){if(_0xc0175f){_0x31f764=_0xc0175f;_0x503e95[_0xfc18('0x33')]=_[_0xfc18('0x36')](db['CmCustomField'][_0xfc18('0x30')]);_0x503e95['query']=_[_0xfc18('0x36')](_0x2ab46e[_0xfc18('0x35')]);_0x503e95[_0xfc18('0x37')]=_[_0xfc18('0x48')](_0x503e95[_0xfc18('0x33')],_0x503e95[_0xfc18('0x35')]);_0x159e20[_0xfc18('0x38')]=_[_0xfc18('0x48')](_0x503e95[_0xfc18('0x33')],qs[_0xfc18('0x39')](_0x2ab46e[_0xfc18('0x35')][_0xfc18('0x39')]));_0x159e20[_0xfc18('0x38')]=_0x159e20[_0xfc18('0x38')]['length']?_0x159e20[_0xfc18('0x38')]:_0x503e95[_0xfc18('0x33')];_0x159e20[_0xfc18('0x3c')]=qs[_0xfc18('0x3d')](_0x2ab46e['query'][_0xfc18('0x3d')]);_0x159e20[_0xfc18('0x3f')]=qs[_0xfc18('0x37')](_[_0xfc18('0x5c')](_0x2ab46e['query'],_0x503e95[_0xfc18('0x37')]));_0x159e20['where']=_[_0xfc18('0x40')](_0x159e20[_0xfc18('0x3f')],{'$or':[{'ListId':_0xc0175f['id']},{'ListId':null}]});if(_0x2ab46e[_0xfc18('0x35')][_0xfc18('0x3e')]){_0x159e20[_0xfc18('0x3f')]=_[_0xfc18('0x40')](_0x159e20[_0xfc18('0x3f')],{'$or':_['map'](_0x159e20[_0xfc18('0x38')],function(_0x517a6e){var _0x3b7b14={};_0x3b7b14[_0x517a6e]={'$like':'%'+_0x2ab46e[_0xfc18('0x35')][_0xfc18('0x3e')]+'%'};return _0x3b7b14;})});}_0x159e20=_[_0xfc18('0x40')]({},_0x159e20,_0x2ab46e[_0xfc18('0x42')]);return db[_0xfc18('0x6a')][_0xfc18('0x9a')](_0x159e20);}})['then'](respondWithResult(_0xd95f9f,null))[_0xfc18('0x47')](handleError(_0xd95f9f,null));};exports[_0xfc18('0x9b')]=function(_0x1babaa,_0x35c247){return db[_0xfc18('0x6a')][_0xfc18('0x9a')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x35c247,null))[_0xfc18('0x28')](function(_0xdb0f36){return _0xdb0f36;})[_0xfc18('0x28')](respondWithResult(_0x35c247,null))[_0xfc18('0x47')](handleError(_0x35c247,null));};exports[_0xfc18('0x9c')]=function(_0x4fadd8,_0x500b01,_0x432d0d){return db['CmList']['find']({'where':{'id':_0x4fadd8[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x500b01,null))[_0xfc18('0x28')](function(_0x542f38){if(_0x542f38){return _0x542f38[_0xfc18('0x9c')](_0x4fadd8[_0xfc18('0x49')]['ids'],_[_0xfc18('0x9d')](_0x4fadd8[_0xfc18('0x49')],[_0xfc18('0x5e'),'id'])||{})[_0xfc18('0x9e')](function(_0x5f13e4){for(var _0x47b0de=0x0;_0x47b0de<_0x4fadd8[_0xfc18('0x49')][_0xfc18('0x5e')][_0xfc18('0x3a')];_0x47b0de+=0x1){socket[_0xfc18('0x9f')]('userCmList:save',{'UserId':Number(_0x4fadd8[_0xfc18('0x49')]['ids'][_0x47b0de]),'CmListId':Number(_0x4fadd8['params']['id'])});}return _0x5f13e4;});}})['then'](respondWithResult(_0x500b01,null))[_0xfc18('0x47')](handleError(_0x500b01,null));};exports[_0xfc18('0xa0')]=function(_0x2caf72,_0x39285e,_0x1ad324){return db[_0xfc18('0x2f')][_0xfc18('0x4f')]({'where':{'id':_0x2caf72[_0xfc18('0x54')]['id']}})['then'](handleEntityNotFound(_0x39285e,null))[_0xfc18('0x28')](function(_0x524fd2){if(_0x524fd2){return _0x524fd2['removeAgents'](_0x2caf72[_0xfc18('0x35')][_0xfc18('0x5e')])[_0xfc18('0x28')](function(){if(_[_0xfc18('0x62')](_0x2caf72[_0xfc18('0x35')][_0xfc18('0x5e')])){for(var _0x435d7f=0x0;_0x435d7f<_0x2caf72[_0xfc18('0x35')][_0xfc18('0x5e')][_0xfc18('0x3a')];_0x435d7f+=0x1){socket['emit'](_0xfc18('0xa1'),{'UserId':Number(_0x2caf72[_0xfc18('0x35')][_0xfc18('0x5e')][_0x435d7f]),'CmListId':Number(_0x2caf72[_0xfc18('0x54')]['id'])});}}else{socket[_0xfc18('0x9f')](_0xfc18('0xa1'),{'UserId':Number(_0x2caf72[_0xfc18('0x35')][_0xfc18('0x5e')]),'CmListId':Number(_0x2caf72[_0xfc18('0x54')]['id'])});}});}})[_0xfc18('0x28')](respondWithStatusCode(_0x39285e,null))['catch'](handleError(_0x39285e,null));};exports[_0xfc18('0xa2')]=function(_0x53ff2b,_0x80bde6,_0x24900f){var _0x5f517f={};var _0x113c86={};var _0x59a115;var _0x5a1c40;return db[_0xfc18('0x2f')][_0xfc18('0x5a')]({'where':{'id':_0x53ff2b[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x80bde6,null))[_0xfc18('0x28')](function(_0x1cfb53){if(_0x1cfb53){_0x59a115=_0x1cfb53;_0x113c86[_0xfc18('0x33')]=_[_0xfc18('0x36')](db['User'][_0xfc18('0x30')]);_0x113c86[_0xfc18('0x35')]=_['keys'](_0x53ff2b['query']);_0x113c86['filters']=_[_0xfc18('0x48')](_0x113c86[_0xfc18('0x33')],_0x113c86['query']);_0x5f517f[_0xfc18('0x38')]=_[_0xfc18('0x48')](_0x113c86['model'],qs[_0xfc18('0x39')](_0x53ff2b[_0xfc18('0x35')][_0xfc18('0x39')]));_0x5f517f[_0xfc18('0x38')]=_0x5f517f[_0xfc18('0x38')]['length']?_0x5f517f['attributes']:_0x113c86['model'];_0x5f517f['order']=qs[_0xfc18('0x3d')](_0x53ff2b['query'][_0xfc18('0x3d')]);_0x5f517f['where']=qs[_0xfc18('0x37')](_['pick'](_0x53ff2b[_0xfc18('0x35')],_0x113c86[_0xfc18('0x37')]));if(_0x53ff2b[_0xfc18('0x35')][_0xfc18('0x3e')]){_0x5f517f[_0xfc18('0x3f')]=_[_0xfc18('0x40')](_0x5f517f['where'],{'$or':_[_0xfc18('0x34')](_0x5f517f['attributes'],function(_0x583b43){var _0x1d7cd6={};_0x1d7cd6[_0x583b43]={'$like':'%'+_0x53ff2b['query'][_0xfc18('0x3e')]+'%'};return _0x1d7cd6;})});}_0x5f517f=_[_0xfc18('0x40')]({},_0x5f517f,_0x53ff2b[_0xfc18('0x42')]);return _0x59a115[_0xfc18('0xa2')](_0x5f517f);}})['then'](function(_0xf4b549){if(_0xf4b549){_0x5a1c40=_0xf4b549['length'];if(!_0x53ff2b[_0xfc18('0x35')][_0xfc18('0x5b')](_0xfc18('0x3b'))){_0x5f517f[_0xfc18('0x22')]=qs[_0xfc18('0x22')](_0x53ff2b[_0xfc18('0x35')]['limit']);_0x5f517f[_0xfc18('0x20')]=qs['offset'](_0x53ff2b['query'][_0xfc18('0x20')]);}return _0x59a115['getAgents'](_0x5f517f);}})[_0xfc18('0x28')](function(_0x1fe319){if(_0x1fe319){return _0x1fe319?{'count':_0x5a1c40,'rows':_0x1fe319}:null;}})[_0xfc18('0x28')](respondWithResult(_0x80bde6,null))[_0xfc18('0x47')](handleError(_0x80bde6,null));};function handleQuery(_0x4ee3cc){logger[_0xfc18('0xa3')](_0x4ee3cc);return db[_0xfc18('0xa4')][_0xfc18('0x35')](_0x4ee3cc)[_0xfc18('0x9e')](function(_0x32df0a){csv_results[_0xfc18('0x65')](_0x32df0a);})['catch'](function(_0x1afabf){logger[_0xfc18('0x2b')](_0x1afabf[_0xfc18('0xa5')]);});} \ No newline at end of file +var _0xfe15=['request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Lists','UserProfileResource','destroy','sendStatus','error','stack','name','send','map','CmList','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','describe','addDisposition','ListId','Disposition','getDispositions','findOne','rawAttributes','order','findAll','removeDispositions','ids','CmContact','tags','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','download','addCustomField','sequelize','transaction','TEXT','text','number','Sequelize','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','zip-dir','fast-json-patch'];(function(_0x545016,_0x5c5822){var _0x3a64f6=function(_0x3da565){while(--_0x3da565){_0x545016['push'](_0x545016['shift']());}};_0x3a64f6(++_0x5c5822);}(_0xfe15,0x144));var _0x5fe1=function(_0x595c62,_0x2e649a){_0x595c62=_0x595c62-0x0;var _0x5767a1=_0xfe15[_0x595c62];return _0x5767a1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5fe1('0x0'));var jsonpatch=require(_0x5fe1('0x1'));var rp=require(_0x5fe1('0x2'));var moment=require(_0x5fe1('0x3'));var BPromise=require(_0x5fe1('0x4'));var Mustache=require(_0x5fe1('0x5'));var util=require(_0x5fe1('0x6'));var path=require(_0x5fe1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5fe1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fe1('0x9'));var squel=require('squel');var crypto=require(_0x5fe1('0xa'));var jsforce=require(_0x5fe1('0xb'));var deskjs=require(_0x5fe1('0xc'));var toCsv=require(_0x5fe1('0xd'));var querystring=require('querystring');var Papa=require(_0x5fe1('0xe'));var Redis=require(_0x5fe1('0xf'));var authService=require(_0x5fe1('0x10'));var qs=require(_0x5fe1('0x11'));var as=require(_0x5fe1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fe1('0x13'))(_0x5fe1('0x14'));var utils=require(_0x5fe1('0x15'));var config=require(_0x5fe1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5fe1('0x17'))['db'];var csv_results;config[_0x5fe1('0x18')]=_[_0x5fe1('0x19')](config[_0x5fe1('0x18')],{'host':_0x5fe1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5fe1('0x18')]));require(_0x5fe1('0x1b'))[_0x5fe1('0x1c')](socket);function respondWithStatusCode(_0x5072ff,_0x1a186d){_0x1a186d=_0x1a186d||0xcc;return function(_0x415259){if(_0x415259){return _0x5072ff['sendStatus'](_0x1a186d);}return _0x5072ff[_0x5fe1('0x1d')](_0x1a186d)[_0x5fe1('0x1e')]();};}function respondWithResult(_0x307cc1,_0x27e5e8){_0x27e5e8=_0x27e5e8||0xc8;return function(_0x1ddee5){if(_0x1ddee5){return _0x307cc1[_0x5fe1('0x1d')](_0x27e5e8)[_0x5fe1('0x1f')](_0x1ddee5);}};}function respondWithFilteredResult(_0x2b303a,_0x2f9b59){return function(_0x465231){if(_0x465231){var _0x33f28b=typeof _0x2f9b59[_0x5fe1('0x20')]===_0x5fe1('0x21')&&typeof _0x2f9b59[_0x5fe1('0x22')]===_0x5fe1('0x21');var _0x34f97c=_0x465231[_0x5fe1('0x23')];var _0x3b54ad=_0x33f28b?0x0:_0x2f9b59[_0x5fe1('0x20')];var _0x19702f=_0x33f28b?_0x465231[_0x5fe1('0x23')]:_0x2f9b59['offset']+_0x2f9b59['limit'];var _0x5b0c27;if(_0x19702f>=_0x34f97c){_0x19702f=_0x34f97c;_0x5b0c27=0xc8;}else{_0x5b0c27=0xce;}_0x2b303a['status'](_0x5b0c27);return _0x2b303a[_0x5fe1('0x24')](_0x5fe1('0x25'),_0x3b54ad+'-'+_0x19702f+'/'+_0x34f97c)[_0x5fe1('0x1f')](_0x465231);}return null;};}function patchUpdates(_0xab22ba){return function(_0x3c790f){try{jsonpatch[_0x5fe1('0x26')](_0x3c790f,_0xab22ba,!![]);}catch(_0x3678e7){return BPromise[_0x5fe1('0x27')](_0x3678e7);}return _0x3c790f['save']();};}function saveUpdates(_0x2ea730,_0x557173){return function(_0x1d62d8){if(_0x1d62d8){return _0x1d62d8[_0x5fe1('0x28')](_0x2ea730)[_0x5fe1('0x29')](function(_0x17dadd){return _0x17dadd;});}return null;};}function removeEntity(_0x49485b,_0x248b89){return function(_0x14b079){if(_0x14b079){return _0x14b079['destroy']()[_0x5fe1('0x29')](function(){var _0x330204=_0x14b079[_0x5fe1('0x2a')]({'plain':!![]});var _0x351004=_0x5fe1('0x2b');return db[_0x5fe1('0x2c')][_0x5fe1('0x2d')]({'where':{'type':_0x351004,'resourceId':_0x330204['id']}})[_0x5fe1('0x29')](function(){return _0x14b079;});})[_0x5fe1('0x29')](function(){_0x49485b['status'](0xcc)[_0x5fe1('0x1e')]();});}};}function handleEntityNotFound(_0x4c74a7,_0x3543c2){return function(_0x3944cd){if(!_0x3944cd){_0x4c74a7[_0x5fe1('0x2e')](0x194);}return _0x3944cd;};}function handleError(_0x1284ec,_0x347799){_0x347799=_0x347799||0x1f4;return function(_0x27e475){logger[_0x5fe1('0x2f')](_0x27e475[_0x5fe1('0x30')]);if(_0x27e475[_0x5fe1('0x31')]){delete _0x27e475[_0x5fe1('0x31')];}_0x1284ec[_0x5fe1('0x1d')](_0x347799)[_0x5fe1('0x32')](_0x27e475);};}exports['index']=function(_0x269ea1,_0x561900){var _0x44a597={},_0x27714a={},_0x42088d={'count':0x0,'rows':[]};var _0x93d2cf=_[_0x5fe1('0x33')](db[_0x5fe1('0x34')]['rawAttributes'],function(_0x5e040d){return{'name':_0x5e040d[_0x5fe1('0x35')],'type':_0x5e040d['type'][_0x5fe1('0x36')]};});_0x27714a[_0x5fe1('0x37')]=_[_0x5fe1('0x33')](_0x93d2cf,_0x5fe1('0x31'));_0x27714a[_0x5fe1('0x38')]=_[_0x5fe1('0x39')](_0x269ea1['query']);_0x27714a['filters']=_['intersection'](_0x27714a[_0x5fe1('0x37')],_0x27714a[_0x5fe1('0x38')]);_0x44a597['attributes']=_[_0x5fe1('0x3a')](_0x27714a['model'],qs[_0x5fe1('0x3b')](_0x269ea1[_0x5fe1('0x38')]['fields']));_0x44a597[_0x5fe1('0x3c')]=_0x44a597[_0x5fe1('0x3c')][_0x5fe1('0x3d')]?_0x44a597[_0x5fe1('0x3c')]:_0x27714a[_0x5fe1('0x37')];if(!_0x269ea1[_0x5fe1('0x38')][_0x5fe1('0x3e')](_0x5fe1('0x3f'))){_0x44a597[_0x5fe1('0x22')]=qs[_0x5fe1('0x22')](_0x269ea1[_0x5fe1('0x38')][_0x5fe1('0x22')]);_0x44a597[_0x5fe1('0x20')]=qs['offset'](_0x269ea1['query']['offset']);}_0x44a597['order']=qs['sort'](_0x269ea1[_0x5fe1('0x38')][_0x5fe1('0x40')]);_0x44a597[_0x5fe1('0x41')]=qs[_0x5fe1('0x42')](_[_0x5fe1('0x43')](_0x269ea1[_0x5fe1('0x38')],_0x27714a[_0x5fe1('0x42')]),_0x93d2cf);if(_0x269ea1['query'][_0x5fe1('0x44')]){_0x44a597[_0x5fe1('0x41')]=_[_0x5fe1('0x45')](_0x44a597[_0x5fe1('0x41')],{'$or':_['map'](_0x93d2cf,function(_0x5c29bf){if(_0x5c29bf[_0x5fe1('0x46')]!==_0x5fe1('0x47')){var _0x57b2af={};_0x57b2af[_0x5c29bf[_0x5fe1('0x31')]]={'$like':'%'+_0x269ea1[_0x5fe1('0x38')][_0x5fe1('0x44')]+'%'};return _0x57b2af;}})});}_0x44a597=_[_0x5fe1('0x45')]({},_0x44a597,_0x269ea1[_0x5fe1('0x48')]);var _0x203867={'where':_0x44a597[_0x5fe1('0x41')]};return db[_0x5fe1('0x34')][_0x5fe1('0x23')](_0x203867)[_0x5fe1('0x29')](function(_0x4debe2){_0x42088d[_0x5fe1('0x23')]=_0x4debe2;if(_0x269ea1[_0x5fe1('0x38')]['includeAll']){_0x44a597[_0x5fe1('0x49')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x44a597);})[_0x5fe1('0x29')](function(_0xddb7d9){_0x42088d[_0x5fe1('0x4a')]=_0xddb7d9;return _0x42088d;})[_0x5fe1('0x29')](respondWithFilteredResult(_0x561900,_0x44a597))['catch'](handleError(_0x561900,null));};exports[_0x5fe1('0x4b')]=function(_0x4bac91,_0x1ec75c){var _0x22afba={'raw':![],'where':{'id':_0x4bac91[_0x5fe1('0x4c')]['id']}},_0x3eca62={};_0x3eca62[_0x5fe1('0x37')]=_['keys'](db[_0x5fe1('0x34')]['rawAttributes']);_0x3eca62[_0x5fe1('0x38')]=_['keys'](_0x4bac91[_0x5fe1('0x38')]);_0x3eca62[_0x5fe1('0x42')]=_[_0x5fe1('0x3a')](_0x3eca62[_0x5fe1('0x37')],_0x3eca62['query']);_0x22afba['attributes']=_['intersection'](_0x3eca62['model'],qs['fields'](_0x4bac91[_0x5fe1('0x38')][_0x5fe1('0x3b')]));_0x22afba['attributes']=_0x22afba[_0x5fe1('0x3c')][_0x5fe1('0x3d')]?_0x22afba[_0x5fe1('0x3c')]:_0x3eca62[_0x5fe1('0x37')];if(_0x4bac91['query']['includeAll']){_0x22afba['include']=[{'all':!![]}];}_0x22afba=_['merge']({},_0x22afba,_0x4bac91[_0x5fe1('0x48')]);return db['CmList'][_0x5fe1('0x4d')](_0x22afba)[_0x5fe1('0x29')](handleEntityNotFound(_0x1ec75c,null))[_0x5fe1('0x29')](respondWithResult(_0x1ec75c,null))['catch'](handleError(_0x1ec75c,null));};exports[_0x5fe1('0x4e')]=function(_0x5b6373,_0x3d964e){return db['CmList']['create'](_0x5b6373[_0x5fe1('0x4f')],{})[_0x5fe1('0x29')](function(_0x48d820){var _0x26307b=_0x5b6373[_0x5fe1('0x50')]['get']({'plain':!![]});if(!_0x26307b)throw new Error(_0x5fe1('0x51'));if(_0x26307b[_0x5fe1('0x52')]==='user'){var _0x28e631=_0x48d820[_0x5fe1('0x2a')]({'plain':!![]});var _0x4a3c99=_0x5fe1('0x2b');return db[_0x5fe1('0x53')][_0x5fe1('0x4d')]({'where':{'name':_0x4a3c99,'userProfileId':_0x26307b['userProfileId']},'raw':!![]})[_0x5fe1('0x29')](function(_0x3cc464){if(_0x3cc464&&_0x3cc464[_0x5fe1('0x54')]===0x0){return db[_0x5fe1('0x2c')]['create']({'name':_0x28e631[_0x5fe1('0x31')],'resourceId':_0x28e631['id'],'type':_0x3cc464['name'],'sectionId':_0x3cc464['id']},{})[_0x5fe1('0x29')](function(){return _0x48d820;});}else{return _0x48d820;}})['catch'](function(_0x2f6308){logger[_0x5fe1('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f6308);throw _0x2f6308;});}return _0x48d820;})['then'](respondWithResult(_0x3d964e,0xc9))['catch'](handleError(_0x3d964e,null));};exports[_0x5fe1('0x28')]=function(_0x447390,_0x37fc17){if(_0x447390[_0x5fe1('0x4f')]['id']){delete _0x447390['body']['id'];}return db[_0x5fe1('0x34')]['find']({'where':{'id':_0x447390[_0x5fe1('0x4c')]['id']}})[_0x5fe1('0x29')](handleEntityNotFound(_0x37fc17,null))[_0x5fe1('0x29')](saveUpdates(_0x447390[_0x5fe1('0x4f')],null))[_0x5fe1('0x29')](respondWithResult(_0x37fc17,null))[_0x5fe1('0x55')](handleError(_0x37fc17,null));};exports[_0x5fe1('0x2d')]=function(_0x394235,_0x2d1e1a){return db['CmList'][_0x5fe1('0x4d')]({'where':{'id':_0x394235['params']['id']}})[_0x5fe1('0x29')](handleEntityNotFound(_0x2d1e1a,null))[_0x5fe1('0x29')](removeEntity(_0x2d1e1a,null))[_0x5fe1('0x55')](handleError(_0x2d1e1a,null));};exports[_0x5fe1('0x56')]=function(_0x210ae2,_0x5b73f9){return db[_0x5fe1('0x34')]['describe']()[_0x5fe1('0x29')](respondWithResult(_0x5b73f9,null))[_0x5fe1('0x55')](handleError(_0x5b73f9,null));};exports[_0x5fe1('0x57')]=function(_0x4bb76d,_0x3ad23c,_0x583fec){if(_0x4bb76d[_0x5fe1('0x4f')]['id']){delete _0x4bb76d[_0x5fe1('0x4f')]['id'];}return db[_0x5fe1('0x34')][_0x5fe1('0x4d')]({'where':{'id':_0x4bb76d[_0x5fe1('0x4c')]['id']}})[_0x5fe1('0x29')](handleEntityNotFound(_0x3ad23c,null))['then'](function(_0x42c63f){if(_0x42c63f){_0x4bb76d[_0x5fe1('0x4f')][_0x5fe1('0x58')]=_0x42c63f['id'];return db[_0x5fe1('0x59')][_0x5fe1('0x4e')](_0x4bb76d[_0x5fe1('0x4f')]);}})[_0x5fe1('0x29')](respondWithResult(_0x3ad23c,null))[_0x5fe1('0x55')](handleError(_0x3ad23c,null));};exports[_0x5fe1('0x5a')]=function(_0x33f7d7,_0x2cf25f,_0x1c75a2){var _0x551222={'raw':![],'where':{}};var _0x3d3853={};var _0x3ba7e4={'count':0x0,'rows':[]};return db[_0x5fe1('0x34')][_0x5fe1('0x5b')]({'where':{'id':_0x33f7d7[_0x5fe1('0x4c')]['id']}})[_0x5fe1('0x29')](handleEntityNotFound(_0x2cf25f,null))[_0x5fe1('0x29')](function(_0x345606){if(_0x345606){_0x3d3853[_0x5fe1('0x37')]=_[_0x5fe1('0x39')](db[_0x5fe1('0x59')][_0x5fe1('0x5c')]);_0x3d3853[_0x5fe1('0x38')]=_['keys'](_0x33f7d7[_0x5fe1('0x38')]);_0x3d3853[_0x5fe1('0x42')]=_['intersection'](_0x3d3853['model'],_0x3d3853['query']);_0x551222[_0x5fe1('0x3c')]=_['intersection'](_0x3d3853[_0x5fe1('0x37')],qs[_0x5fe1('0x3b')](_0x33f7d7['query']['fields']));_0x551222[_0x5fe1('0x3c')]=_0x551222[_0x5fe1('0x3c')][_0x5fe1('0x3d')]?_0x551222['attributes']:_0x3d3853[_0x5fe1('0x37')];if(!_0x33f7d7[_0x5fe1('0x38')][_0x5fe1('0x3e')](_0x5fe1('0x3f'))){_0x551222[_0x5fe1('0x22')]=qs[_0x5fe1('0x22')](_0x33f7d7[_0x5fe1('0x38')][_0x5fe1('0x22')]);_0x551222[_0x5fe1('0x20')]=qs[_0x5fe1('0x20')](_0x33f7d7[_0x5fe1('0x38')][_0x5fe1('0x20')]);}_0x551222[_0x5fe1('0x5d')]=qs[_0x5fe1('0x40')](_0x33f7d7[_0x5fe1('0x38')][_0x5fe1('0x40')]);_0x551222[_0x5fe1('0x41')]=qs[_0x5fe1('0x42')](_[_0x5fe1('0x43')](_0x33f7d7['query'],_0x3d3853['filters']));_0x551222[_0x5fe1('0x41')][_0x5fe1('0x58')]=_0x345606['id'];if(_0x33f7d7[_0x5fe1('0x38')][_0x5fe1('0x44')]){_0x551222['where']=_[_0x5fe1('0x45')](_0x551222['where'],{'$or':_[_0x5fe1('0x33')](_0x551222[_0x5fe1('0x3c')],function(_0x181309){var _0x108dc1={};_0x108dc1[_0x181309]={'$like':'%'+_0x33f7d7['query'][_0x5fe1('0x44')]+'%'};return _0x108dc1;})});}_0x551222=_['merge']({},_0x551222,_0x33f7d7[_0x5fe1('0x48')]);return db['Disposition']['count']({'where':_0x551222['where']})[_0x5fe1('0x29')](function(_0x5ee522){_0x3ba7e4['count']=_0x5ee522;if(_0x33f7d7[_0x5fe1('0x38')]['includeAll']){_0x551222[_0x5fe1('0x49')]=[{'all':!![]}];}return db[_0x5fe1('0x59')][_0x5fe1('0x5e')](_0x551222);})['then'](function(_0x2c8e25){_0x3ba7e4[_0x5fe1('0x4a')]=_0x2c8e25;return _0x3ba7e4;});}})[_0x5fe1('0x29')](respondWithFilteredResult(_0x2cf25f,_0x551222))[_0x5fe1('0x55')](handleError(_0x2cf25f,null));};exports[_0x5fe1('0x5f')]=function(_0x25283f,_0x14233,_0x2f5c08){return db[_0x5fe1('0x34')][_0x5fe1('0x4d')]({'where':{'id':_0x25283f['params']['id']}})[_0x5fe1('0x29')](handleEntityNotFound(_0x14233,null))['then'](function(_0x53ec5f){if(_0x53ec5f){return _0x53ec5f['removeDispositions'](_0x25283f[_0x5fe1('0x38')][_0x5fe1('0x60')]);}})[_0x5fe1('0x29')](respondWithStatusCode(_0x14233,null))[_0x5fe1('0x55')](handleError(_0x14233,null));};exports['addContacts']=function(_0x41590f,_0xd4f22a,_0x2356fb){return db['CmList'][_0x5fe1('0x4d')]({'where':{'id':_0x41590f['params']['id']}})['then'](handleEntityNotFound(_0xd4f22a,null))[_0x5fe1('0x29')](function(_0x53ede5){if(_0x53ede5){var _0x3a389c=[];var _0x44e2ed={'success':[],'errors':[]};return db[_0x5fe1('0x61')][_0x5fe1('0x56')]()[_0x5fe1('0x29')](function(_0x3eec91){if(_0x41590f[_0x5fe1('0x4f')][_0x5fe1('0x62')]&&_[_0x5fe1('0x63')](_0x41590f[_0x5fe1('0x4f')][_0x5fe1('0x62')])){if(_0x41590f['body'][_0x5fe1('0x62')][_0x5fe1('0x3d')]){_0x41590f[_0x5fe1('0x4f')][_0x5fe1('0x62')]=_0x41590f[_0x5fe1('0x4f')][_0x5fe1('0x62')]['join'](';')+';';}else{_0x41590f[_0x5fe1('0x4f')][_0x5fe1('0x62')]=null;}}else{_0x41590f[_0x5fe1('0x4f')][_0x5fe1('0x62')]=null;}if(_0x41590f[_0x5fe1('0x4f')]&&_[_0x5fe1('0x63')](_0x41590f[_0x5fe1('0x4f')])){for(var _0x4e9080=0x0;_0x4e9080<_0x41590f[_0x5fe1('0x4f')]['length'];_0x4e9080+=0x1){_0x41590f[_0x5fe1('0x4f')][_0x4e9080]['ListId']=_0x41590f[_0x5fe1('0x4c')]['id'];_0x3a389c[_0x5fe1('0x64')](_0x41590f[_0x5fe1('0x4f')][_0x4e9080]);}return BPromise[_0x5fe1('0x65')](_0x3a389c,function(_0x54bd69){return db[_0x5fe1('0x61')]['create'](_[_0x5fe1('0x66')](_0x54bd69,['ids','id'])||{},{'fields':_['keys'](_0x3eec91),'raw':!![]})['then'](function(_0x185623){_0x44e2ed[_0x5fe1('0x67')][_0x5fe1('0x64')](_0x185623[_0x5fe1('0x68')]);})[_0x5fe1('0x55')](function(_0x3f6c1a){_0x44e2ed[_0x5fe1('0x69')][_0x5fe1('0x64')]({'data':_0x54bd69,'error':_0x3f6c1a[_0x5fe1('0x6a')]});});})['then'](function(_0x3e9b99){return _0x44e2ed;})[_0x5fe1('0x55')](function(_0x40a409){return _0x40a409;});}else{_0xd4f22a['status'](0x190)['json']({'message':_0x5fe1('0x6b')});}});}})[_0x5fe1('0x29')](respondWithResult(_0xd4f22a,null))[_0x5fe1('0x55')](handleError(_0xd4f22a,null));};exports[_0x5fe1('0x6c')]=function(_0x48544e,_0x272602,_0x5882f3){var _0x51fa44;return db[_0x5fe1('0x34')][_0x5fe1('0x4d')]({'where':{'id':_0x48544e[_0x5fe1('0x4c')]['id']},'include':[{'model':db[_0x5fe1('0x6d')],'as':_0x5fe1('0x6e')}]})['then'](handleEntityNotFound(_0x272602,null))[_0x5fe1('0x29')](function(_0xd7ba8c){if(_0xd7ba8c){_0x51fa44=_0xd7ba8c;return db[_0x5fe1('0x61')][_0x5fe1('0x5c')];}})[_0x5fe1('0x29')](function(_0x2eabc3){if(_0x2eabc3){var _0x3a44a8={};var _0x354f01={};_0x354f01['model']=_['concat'](_[_0x5fe1('0x39')](_0x2eabc3),_[_0x5fe1('0x33')](_0x51fa44[_0x5fe1('0x6e')],function(_0x395afe){return util[_0x5fe1('0x6f')](_0x5fe1('0x70'),_0x395afe['id']);}));_0x354f01['query']=_[_0x5fe1('0x39')](_0x48544e['query']);_0x354f01[_0x5fe1('0x42')]=_[_0x5fe1('0x3a')](_0x354f01[_0x5fe1('0x37')],_0x354f01[_0x5fe1('0x38')]);_0x3a44a8[_0x5fe1('0x3c')]=_[_0x5fe1('0x3a')](_0x354f01[_0x5fe1('0x37')],qs[_0x5fe1('0x3b')](_0x48544e[_0x5fe1('0x38')]['fields']));_0x3a44a8[_0x5fe1('0x3c')]=_0x3a44a8[_0x5fe1('0x3c')][_0x5fe1('0x3d')]?_0x3a44a8[_0x5fe1('0x3c')]:_0x354f01['model'];if(!_0x48544e['query']['hasOwnProperty'](_0x5fe1('0x3f'))){_0x3a44a8[_0x5fe1('0x22')]=qs[_0x5fe1('0x22')](_0x48544e[_0x5fe1('0x38')][_0x5fe1('0x22')]);_0x3a44a8[_0x5fe1('0x20')]=qs['offset'](_0x48544e[_0x5fe1('0x38')]['offset']);}_0x3a44a8['order']=qs[_0x5fe1('0x40')](_0x48544e[_0x5fe1('0x38')][_0x5fe1('0x40')]);_0x3a44a8[_0x5fe1('0x41')]=qs[_0x5fe1('0x42')](_[_0x5fe1('0x43')](_0x48544e[_0x5fe1('0x38')],_0x354f01['filters']));_0x3a44a8[_0x5fe1('0x71')]=!![];if(_0x48544e[_0x5fe1('0x38')]['filter']){_0x3a44a8['where']=_[_0x5fe1('0x45')](_0x3a44a8[_0x5fe1('0x41')],{'$or':_[_0x5fe1('0x33')](_0x3a44a8[_0x5fe1('0x3c')],function(_0xbaae98){var _0x4c0dd5={};_0x4c0dd5[_0xbaae98]={'$like':'%'+_0x48544e[_0x5fe1('0x38')][_0x5fe1('0x44')]+'%'};return _0x4c0dd5;})});}_0x3a44a8=_[_0x5fe1('0x45')]({},_0x3a44a8,_0x48544e['options']);return _0x51fa44['getContacts'](_0x3a44a8);}})[_0x5fe1('0x29')](respondWithResult(_0x272602,null))[_0x5fe1('0x55')](handleError(_0x272602,null));};exports[_0x5fe1('0x72')]=function(_0x3e8da7,_0x250e89,_0x2bd4e3){var _0x36e1bc;var _0x50d69e;var _0x34573d;var _0x162315=_0x3e8da7[_0x5fe1('0x4c')]['id'];csv_results=[];return db[_0x5fe1('0x73')][_0x5fe1('0x5e')]({'attributes':['id',_0x5fe1('0x31')],'raw':!![],'order':[_0x5fe1('0x74')]})['then'](function(_0x3f38d4){_0x36e1bc=_0x3f38d4;var _0x417c97=_[_0x5fe1('0x39')](db[_0x5fe1('0x61')]['rawAttributes']);return db[_0x5fe1('0x6d')][_0x5fe1('0x5e')]({'raw':!![],'attributes':['id','alias']})[_0x5fe1('0x29')](function(_0x37391e){_0x50d69e=_0x37391e;var _0x362d6b=squel[_0x5fe1('0x75')]()[_0x5fe1('0x3b')](_0x417c97)[_0x5fe1('0x76')](_0x5fe1('0x77'),'c')[_0x5fe1('0x41')]('c.ListId\x20=\x20?',_0x162315)['where'](_0x5fe1('0x78'))[_0x5fe1('0x79')]();for(var _0x3a5ac7=0x0;_0x3a5ac7<_0x50d69e['length'];_0x3a5ac7++){_0x362d6b[_0x5fe1('0x7a')](_0x5fe1('0x7b')+_0x50d69e[_0x3a5ac7]['id'],_0x5fe1('0x7c')+_0x50d69e[_0x3a5ac7]['alias']);}for(var _0x3a5ac7=0x0;_0x3a5ac7<_0x36e1bc['length'];_0x3a5ac7++){_0x362d6b[_0x5fe1('0x7a')](squel[_0x5fe1('0x75')]()[_0x5fe1('0x7a')](_0x5fe1('0x7d'))[_0x5fe1('0x76')](_0x5fe1('0x7e'))[_0x5fe1('0x41')](_0x5fe1('0x7f'),_0x36e1bc[_0x3a5ac7]['id'])[_0x5fe1('0x41')]('CmContactId\x20=\x20c.id'),_0x5fe1('0x80')+_0x36e1bc[_0x3a5ac7][_0x5fe1('0x31')]);_0x362d6b[_0x5fe1('0x7a')](squel['select']()[_0x5fe1('0x7a')](_0x5fe1('0x81'))['from'](_0x5fe1('0x7e'))['where'](_0x5fe1('0x7f'),_0x36e1bc[_0x3a5ac7]['id'])[_0x5fe1('0x41')]('CmContactId\x20=\x20c.id'),_0x5fe1('0x82')+_0x36e1bc[_0x3a5ac7][_0x5fe1('0x31')]);}var _0x4abc66=[];_0x4abc66[_0x5fe1('0x64')](_0x362d6b['toString']());BPromise[_0x5fe1('0x65')](_0x4abc66,handleQuery)[_0x5fe1('0x29')](function(_0x4a8569){handleQuery(_0x362d6b[_0x5fe1('0x83')]());var _0x59184c=csv_results[0x0];if(!_[_0x5fe1('0x84')](_0x59184c)){var _0xe3512=toCsv(_0x59184c);var _0x560042=Date[_0x5fe1('0x85')]();fs[_0x5fe1('0x86')](util[_0x5fe1('0x6f')](_0x5fe1('0x87'),_0x162315,_0x560042),_0xe3512);_0x250e89['setHeader'](_0x5fe1('0x88'),_0x5fe1('0x89')+util[_0x5fe1('0x6f')](_0x5fe1('0x8a'),_0x162315,_0x560042));_0x250e89[_0x5fe1('0x8b')]('Content-type','text/csv');return _0x250e89[_0x5fe1('0x8c')](util[_0x5fe1('0x6f')](_0x5fe1('0x87'),_0x162315,_0x560042));}else{return _0x250e89['sendStatus'](0xcc);}});});});};exports[_0x5fe1('0x8d')]=function(_0x5036e1,_0x27da7b,_0xbf5de9){var _0x419d3d;delete _0x5036e1['body']['id'];return db[_0x5fe1('0x34')][_0x5fe1('0x5b')]({'where':{'id':_0x5036e1[_0x5fe1('0x4c')]['id']}})[_0x5fe1('0x29')](handleEntityNotFound(_0x27da7b,null))[_0x5fe1('0x29')](function(_0x1be2c0){if(_0x1be2c0){return db[_0x5fe1('0x8e')][_0x5fe1('0x8f')](function(_0x3022f1){return db[_0x5fe1('0x6d')]['create'](_0x5036e1['body'],{'transaction':_0x3022f1})[_0x5fe1('0x29')](function(_0x2e6069){_0x419d3d=_0x2e6069;return _0x1be2c0['addCustomFields'](_0x2e6069,{'transaction':_0x3022f1});})['then'](function(){var _0x31ba6a={'type':db['Sequelize'][_0x5fe1('0x90')],'transaction':_0x3022f1};switch(_0x5036e1['body'][_0x5fe1('0x46')]){case _0x5fe1('0x91'):_0x31ba6a['type']=db['Sequelize'][_0x5fe1('0x90')];break;case _0x5fe1('0x92'):_0x31ba6a['type']=db[_0x5fe1('0x93')]['INTEGER'];break;case _0x5fe1('0x94'):_0x31ba6a[_0x5fe1('0x46')]=db[_0x5fe1('0x93')][_0x5fe1('0x95')];_0x31ba6a[_0x5fe1('0x96')]=![];break;default:}return db[_0x5fe1('0x8e')][_0x5fe1('0x97')][_0x5fe1('0x98')](_0x5fe1('0x77'),util[_0x5fe1('0x6f')]('cf_%s',_0x419d3d['id']),_0x31ba6a);})[_0x5fe1('0x29')](function(){return _0x419d3d;});});}})[_0x5fe1('0x29')](respondWithResult(_0x27da7b,null))[_0x5fe1('0x55')](handleError(_0x27da7b,null));};exports['getCustomFields']=function(_0x530ade,_0x13e969,_0x48a25d){var _0x1b6b56={};var _0x3f85c0={};var _0x14be26;var _0x452f1;return db[_0x5fe1('0x34')][_0x5fe1('0x5b')]({'where':{'id':_0x530ade[_0x5fe1('0x4c')]['id']}})[_0x5fe1('0x29')](handleEntityNotFound(_0x13e969,null))[_0x5fe1('0x29')](function(_0x271f39){if(_0x271f39){_0x14be26=_0x271f39;_0x3f85c0['model']=_[_0x5fe1('0x39')](db[_0x5fe1('0x6d')]['rawAttributes']);_0x3f85c0['query']=_['keys'](_0x530ade['query']);_0x3f85c0['filters']=_['intersection'](_0x3f85c0[_0x5fe1('0x37')],_0x3f85c0[_0x5fe1('0x38')]);_0x1b6b56[_0x5fe1('0x3c')]=_[_0x5fe1('0x3a')](_0x3f85c0['model'],qs[_0x5fe1('0x3b')](_0x530ade[_0x5fe1('0x38')][_0x5fe1('0x3b')]));_0x1b6b56[_0x5fe1('0x3c')]=_0x1b6b56['attributes'][_0x5fe1('0x3d')]?_0x1b6b56[_0x5fe1('0x3c')]:_0x3f85c0[_0x5fe1('0x37')];_0x1b6b56['order']=qs['sort'](_0x530ade[_0x5fe1('0x38')][_0x5fe1('0x40')]);_0x1b6b56[_0x5fe1('0x41')]=qs[_0x5fe1('0x42')](_[_0x5fe1('0x43')](_0x530ade['query'],_0x3f85c0[_0x5fe1('0x42')]));_0x1b6b56['where']=_[_0x5fe1('0x45')](_0x1b6b56[_0x5fe1('0x41')],{'$or':[{'ListId':_0x271f39['id']},{'ListId':null}]});if(_0x530ade[_0x5fe1('0x38')][_0x5fe1('0x44')]){_0x1b6b56[_0x5fe1('0x41')]=_[_0x5fe1('0x45')](_0x1b6b56[_0x5fe1('0x41')],{'$or':_[_0x5fe1('0x33')](_0x1b6b56[_0x5fe1('0x3c')],function(_0x285254){var _0x47b2cf={};_0x47b2cf[_0x285254]={'$like':'%'+_0x530ade[_0x5fe1('0x38')][_0x5fe1('0x44')]+'%'};return _0x47b2cf;})});}_0x1b6b56=_['merge']({},_0x1b6b56,_0x530ade[_0x5fe1('0x48')]);return db['CmCustomField']['findAndCountAll'](_0x1b6b56);}})[_0x5fe1('0x29')](respondWithResult(_0x13e969,null))['catch'](handleError(_0x13e969,null));};exports[_0x5fe1('0x99')]=function(_0x50b73a,_0x4058d7){return db[_0x5fe1('0x6d')]['findAndCountAll']({'where':{'ListId':null}})[_0x5fe1('0x29')](handleEntityNotFound(_0x4058d7,null))[_0x5fe1('0x29')](function(_0x3923b9){return _0x3923b9;})[_0x5fe1('0x29')](respondWithResult(_0x4058d7,null))[_0x5fe1('0x55')](handleError(_0x4058d7,null));};exports[_0x5fe1('0x9a')]=function(_0x31fade,_0x4aabde,_0xedb953){return db[_0x5fe1('0x34')][_0x5fe1('0x4d')]({'where':{'id':_0x31fade[_0x5fe1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4aabde,null))[_0x5fe1('0x29')](function(_0x4ebebd){if(_0x4ebebd){return _0x4ebebd[_0x5fe1('0x9a')](_0x31fade[_0x5fe1('0x4f')]['ids'],_[_0x5fe1('0x66')](_0x31fade[_0x5fe1('0x4f')],[_0x5fe1('0x60'),'id'])||{})[_0x5fe1('0x9b')](function(_0x4919d3){for(var _0x1d16b0=0x0;_0x1d16b0<_0x31fade['body'][_0x5fe1('0x60')]['length'];_0x1d16b0+=0x1){socket[_0x5fe1('0x9c')](_0x5fe1('0x9d'),{'UserId':Number(_0x31fade[_0x5fe1('0x4f')][_0x5fe1('0x60')][_0x1d16b0]),'CmListId':Number(_0x31fade['params']['id'])});}return _0x4919d3;});}})[_0x5fe1('0x29')](respondWithResult(_0x4aabde,null))[_0x5fe1('0x55')](handleError(_0x4aabde,null));};exports[_0x5fe1('0x9e')]=function(_0x498fd9,_0x1e0e35,_0x1b5b4c){return db[_0x5fe1('0x34')][_0x5fe1('0x4d')]({'where':{'id':_0x498fd9[_0x5fe1('0x4c')]['id']}})[_0x5fe1('0x29')](handleEntityNotFound(_0x1e0e35,null))['then'](function(_0x2694b7){if(_0x2694b7){return _0x2694b7[_0x5fe1('0x9e')](_0x498fd9[_0x5fe1('0x38')][_0x5fe1('0x60')])['then'](function(){if(_[_0x5fe1('0x63')](_0x498fd9[_0x5fe1('0x38')]['ids'])){for(var _0x4c7160=0x0;_0x4c7160<_0x498fd9['query']['ids'][_0x5fe1('0x3d')];_0x4c7160+=0x1){socket[_0x5fe1('0x9c')](_0x5fe1('0x9f'),{'UserId':Number(_0x498fd9['query'][_0x5fe1('0x60')][_0x4c7160]),'CmListId':Number(_0x498fd9[_0x5fe1('0x4c')]['id'])});}}else{socket[_0x5fe1('0x9c')]('userCmList:remove',{'UserId':Number(_0x498fd9[_0x5fe1('0x38')][_0x5fe1('0x60')]),'CmListId':Number(_0x498fd9[_0x5fe1('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1e0e35,null))[_0x5fe1('0x55')](handleError(_0x1e0e35,null));};exports[_0x5fe1('0xa0')]=function(_0x1b8277,_0x30f43f,_0x4071a8){var _0x4e8876={};var _0x2bd2d2={};var _0x115f4c;var _0x17a93d;return db[_0x5fe1('0x34')][_0x5fe1('0x5b')]({'where':{'id':_0x1b8277[_0x5fe1('0x4c')]['id']}})[_0x5fe1('0x29')](handleEntityNotFound(_0x30f43f,null))['then'](function(_0x5dfad3){if(_0x5dfad3){_0x115f4c=_0x5dfad3;_0x2bd2d2[_0x5fe1('0x37')]=_[_0x5fe1('0x39')](db[_0x5fe1('0xa1')][_0x5fe1('0x5c')]);_0x2bd2d2[_0x5fe1('0x38')]=_[_0x5fe1('0x39')](_0x1b8277[_0x5fe1('0x38')]);_0x2bd2d2['filters']=_[_0x5fe1('0x3a')](_0x2bd2d2['model'],_0x2bd2d2[_0x5fe1('0x38')]);_0x4e8876[_0x5fe1('0x3c')]=_[_0x5fe1('0x3a')](_0x2bd2d2[_0x5fe1('0x37')],qs[_0x5fe1('0x3b')](_0x1b8277[_0x5fe1('0x38')][_0x5fe1('0x3b')]));_0x4e8876['attributes']=_0x4e8876[_0x5fe1('0x3c')][_0x5fe1('0x3d')]?_0x4e8876[_0x5fe1('0x3c')]:_0x2bd2d2[_0x5fe1('0x37')];_0x4e8876[_0x5fe1('0x5d')]=qs['sort'](_0x1b8277['query'][_0x5fe1('0x40')]);_0x4e8876['where']=qs[_0x5fe1('0x42')](_['pick'](_0x1b8277['query'],_0x2bd2d2[_0x5fe1('0x42')]));if(_0x1b8277[_0x5fe1('0x38')][_0x5fe1('0x44')]){_0x4e8876[_0x5fe1('0x41')]=_[_0x5fe1('0x45')](_0x4e8876[_0x5fe1('0x41')],{'$or':_[_0x5fe1('0x33')](_0x4e8876[_0x5fe1('0x3c')],function(_0x34a071){var _0x32e19c={};_0x32e19c[_0x34a071]={'$like':'%'+_0x1b8277[_0x5fe1('0x38')][_0x5fe1('0x44')]+'%'};return _0x32e19c;})});}_0x4e8876=_[_0x5fe1('0x45')]({},_0x4e8876,_0x1b8277[_0x5fe1('0x48')]);return _0x115f4c[_0x5fe1('0xa0')](_0x4e8876);}})[_0x5fe1('0x29')](function(_0x58ea66){if(_0x58ea66){_0x17a93d=_0x58ea66[_0x5fe1('0x3d')];if(!_0x1b8277[_0x5fe1('0x38')][_0x5fe1('0x3e')](_0x5fe1('0x3f'))){_0x4e8876[_0x5fe1('0x22')]=qs[_0x5fe1('0x22')](_0x1b8277[_0x5fe1('0x38')]['limit']);_0x4e8876[_0x5fe1('0x20')]=qs[_0x5fe1('0x20')](_0x1b8277[_0x5fe1('0x38')]['offset']);}return _0x115f4c['getAgents'](_0x4e8876);}})[_0x5fe1('0x29')](function(_0xe712e9){if(_0xe712e9){return _0xe712e9?{'count':_0x17a93d,'rows':_0xe712e9}:null;}})[_0x5fe1('0x29')](respondWithResult(_0x30f43f,null))[_0x5fe1('0x55')](handleError(_0x30f43f,null));};function handleQuery(_0x27b8c0){logger[_0x5fe1('0xa2')](_0x27b8c0);return db[_0x5fe1('0x8e')]['query'](_0x27b8c0)['spread'](function(_0x262121){csv_results[_0x5fe1('0x64')](_0x262121);})['catch'](function(_0x381013){logger[_0x5fe1('0x2f')](_0x381013[_0x5fe1('0x6a')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d548d25..7afc172 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x5fc3[_0x5f09c5];return _0x426ad9;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x115598,_0x4622f8){var _0x128dcb=function(_0x329313){while(--_0x329313){_0x115598['push'](_0x115598['shift']());}};_0x128dcb(++_0x4622f8);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 051d405..0a570a6 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd28=['rimraf','./cmList.attributes','exports','define','util','../../config/logger','moment','request-promise','path'];(function(_0x13484b,_0x442853){var _0x1535e7=function(_0x41bec5){while(--_0x41bec5){_0x13484b['push'](_0x13484b['shift']());}};_0x1535e7(++_0x442853);}(_0xfd28,0x148));var _0x8fd2=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0xfd28[_0x104e21];return _0x605b37;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));module[_0x8fd2('0x7')]=function(_0x2ee87e,_0x36178a){return _0x2ee87e[_0x8fd2('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x878f=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x878f,0x173));var _0xf878=function(_0x1b2247,_0x4fce46){_0x1b2247=_0x1b2247-0x0;var _0x99c746=_0x878f[_0x1b2247];return _0x99c746;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 3e919fa..209f404 100644 --- a/server/api/cmList/cmList.rpc.js +++ b/server/api/cmList/cmList.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdaa1=['socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdaa1,0x94));var _0x1daa=function(_0x1dde10,_0x221c4f){_0x1dde10=_0x1dde10-0x0;var _0x5edc65=_0xdaa1[_0x1dde10];return _0x5edc65;};'use strict';var _=require(_0x1daa('0x0'));var util=require(_0x1daa('0x1'));var moment=require(_0x1daa('0x2'));var BPromise=require(_0x1daa('0x3'));var rs=require(_0x1daa('0x4'));var fs=require('fs');var Redis=require(_0x1daa('0x5'));var db=require(_0x1daa('0x6'))['db'];var utils=require(_0x1daa('0x7'));var logger=require(_0x1daa('0x8'))(_0x1daa('0x9'));var config=require('../../config/environment');var jayson=require(_0x1daa('0xa'));var client=jayson['client'][_0x1daa('0xb')]({'port':0x232a});config[_0x1daa('0xc')]=_[_0x1daa('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1daa('0xe'))(new Redis(config[_0x1daa('0xc')]));require(_0x1daa('0xf'))[_0x1daa('0x10')](socket);function respondWithRpcPromise(_0x57618f,_0x277516,_0x554c02){return new BPromise(function(_0x45ebd3,_0x2653df){return client[_0x1daa('0x11')](_0x57618f,_0x554c02)[_0x1daa('0x12')](function(_0xee1770){logger[_0x1daa('0x13')](_0x1daa('0x14'),_0x277516,_0x1daa('0x15'));logger[_0x1daa('0x16')](_0x1daa('0x17'),_0x277516,_0x1daa('0x15'),JSON['stringify'](_0xee1770));if(_0xee1770[_0x1daa('0x18')]){if(_0xee1770['error']['code']===0x1f4){logger[_0x1daa('0x18')](_0x1daa('0x14'),_0x277516,_0xee1770[_0x1daa('0x18')]['message']);return _0x2653df(_0xee1770['error']['message']);}logger['error'](_0x1daa('0x14'),_0x277516,_0xee1770[_0x1daa('0x18')][_0x1daa('0x19')]);return _0x45ebd3(_0xee1770[_0x1daa('0x18')][_0x1daa('0x19')]);}else{logger[_0x1daa('0x13')](_0x1daa('0x14'),_0x277516,_0x1daa('0x15'));_0x45ebd3(_0xee1770[_0x1daa('0x1a')][_0x1daa('0x19')]);}})['catch'](function(_0x788e57){logger[_0x1daa('0x18')](_0x1daa('0x14'),_0x277516,_0x788e57);_0x2653df(_0x788e57);});});} \ No newline at end of file +var _0xcc8f=['redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http'];(function(_0x35e0da,_0x1c6e27){var _0x51a4fa=function(_0x54bf74){while(--_0x54bf74){_0x35e0da['push'](_0x35e0da['shift']());}};_0x51a4fa(++_0x1c6e27);}(_0xcc8f,0xbd));var _0xfcc8=function(_0x50b852,_0x868720){_0x50b852=_0x50b852-0x0;var _0x4eb264=_0xcc8f[_0x50b852];return _0x4eb264;};'use strict';var _=require(_0xfcc8('0x0'));var util=require(_0xfcc8('0x1'));var moment=require(_0xfcc8('0x2'));var BPromise=require(_0xfcc8('0x3'));var rs=require(_0xfcc8('0x4'));var fs=require('fs');var Redis=require(_0xfcc8('0x5'));var db=require(_0xfcc8('0x6'))['db'];var utils=require(_0xfcc8('0x7'));var logger=require(_0xfcc8('0x8'))(_0xfcc8('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xfcc8('0xa')]({'port':0x232a});config[_0xfcc8('0xb')]=_[_0xfcc8('0xc')](config[_0xfcc8('0xb')],{'host':_0xfcc8('0xd'),'port':0x18eb});var socket=require(_0xfcc8('0xe'))(new Redis(config[_0xfcc8('0xb')]));require(_0xfcc8('0xf'))[_0xfcc8('0x10')](socket);function respondWithRpcPromise(_0x31b664,_0x4a1114,_0x1a16a5){return new BPromise(function(_0x2840c7,_0x3a95a9){return client[_0xfcc8('0x11')](_0x31b664,_0x1a16a5)['then'](function(_0x4d6473){logger[_0xfcc8('0x12')](_0xfcc8('0x13'),_0x4a1114,_0xfcc8('0x14'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x4a1114,_0xfcc8('0x14'),JSON['stringify'](_0x4d6473));if(_0x4d6473[_0xfcc8('0x15')]){if(_0x4d6473[_0xfcc8('0x15')][_0xfcc8('0x16')]===0x1f4){logger[_0xfcc8('0x15')](_0xfcc8('0x13'),_0x4a1114,_0x4d6473[_0xfcc8('0x15')][_0xfcc8('0x17')]);return _0x3a95a9(_0x4d6473[_0xfcc8('0x15')][_0xfcc8('0x17')]);}logger[_0xfcc8('0x15')](_0xfcc8('0x13'),_0x4a1114,_0x4d6473['error']['message']);return _0x2840c7(_0x4d6473[_0xfcc8('0x15')][_0xfcc8('0x17')]);}else{logger[_0xfcc8('0x12')](_0xfcc8('0x13'),_0x4a1114,_0xfcc8('0x14'));_0x2840c7(_0x4d6473['result'][_0xfcc8('0x17')]);}})[_0xfcc8('0x18')](function(_0xf12eb6){logger[_0xfcc8('0x15')](_0xfcc8('0x13'),_0x4a1114,_0xf12eb6);_0x3a95a9(_0xf12eb6);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d2235bb..cb658a8 100644 --- a/server/api/cmList/cmList.socket.js +++ b/server/api/cmList/cmList.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dc7=['./cmList.events','save','emit','length','cmList:'];(function(_0x5c4b04,_0x3b364a){var _0x2718e5=function(_0x1e421b){while(--_0x1e421b){_0x5c4b04['push'](_0x5c4b04['shift']());}};_0x2718e5(++_0x3b364a);}(_0x2dc7,0xe1));var _0x72dc=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x2dc7[_0x1e05c1];return _0x15f1ca;};'use strict';var CmListEvents=require(_0x72dc('0x0'));var events=[_0x72dc('0x1'),'remove','update'];function createListener(_0x58be93,_0x30d46e){return function(_0x540f55){_0x30d46e[_0x72dc('0x2')](_0x58be93,_0x540f55);};}function removeListener(_0x244d3d,_0x51c46f){return function(){CmListEvents['removeListener'](_0x244d3d,_0x51c46f);};}exports['register']=function(_0x49a61f){for(var _0x2978ab=0x0,_0x565c3e=events[_0x72dc('0x3')];_0x2978ab<_0x565c3e;_0x2978ab++){var _0x2f964a=events[_0x2978ab];var _0x26df17=createListener(_0x72dc('0x4')+_0x2f964a,_0x49a61f);CmListEvents['on'](_0x2f964a,_0x26df17);}}; \ No newline at end of file +var _0x7a4f=['update','emit','register','length','cmList:','save','remove'];(function(_0x55becf,_0x1ed2c7){var _0x29f547=function(_0x206a0a){while(--_0x206a0a){_0x55becf['push'](_0x55becf['shift']());}};_0x29f547(++_0x1ed2c7);}(_0x7a4f,0x1d3));var _0xf7a4=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0x7a4f[_0x1e5cc3];return _0x15c596;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xf7a4('0x0'),_0xf7a4('0x1'),_0xf7a4('0x2')];function createListener(_0x29ed50,_0x141974){return function(_0x3357e6){_0x141974[_0xf7a4('0x3')](_0x29ed50,_0x3357e6);};}function removeListener(_0x2dc8ef,_0x446613){return function(){CmListEvents['removeListener'](_0x2dc8ef,_0x446613);};}exports[_0xf7a4('0x4')]=function(_0x34b03b){for(var _0x1844be=0x0,_0x468767=events[_0xf7a4('0x5')];_0x1844be<_0x468767;_0x1844be++){var _0x41002d=events[_0x1844be];var _0x5da8cf=createListener(_0xf7a4('0x6')+_0x41002d,_0x34b03b);CmListEvents['on'](_0x41002d,_0x5da8cf);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index fa341a5..1a63c16 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64f6=['../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','/:id','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','post','/:id/dispositions','addCustomField','addAgents','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x592e40,_0x2ed011){var _0x5d4288=function(_0x366e87){while(--_0x366e87){_0x592e40['push'](_0x592e40['shift']());}};_0x5d4288(++_0x2ed011);}(_0x64f6,0xb3));var _0x664f=function(_0x54496d,_0x5b8572){_0x54496d=_0x54496d-0x0;var _0x40e626=_0x64f6[_0x54496d];return _0x40e626;};'use strict';var multer=require(_0x664f('0x0'));var util=require(_0x664f('0x1'));var path=require(_0x664f('0x2'));var timeout=require(_0x664f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x664f('0x4'));var auth=require(_0x664f('0x5'));var interaction=require(_0x664f('0x6'));var config=require(_0x664f('0x7'));var controller=require(_0x664f('0x8'));router[_0x664f('0x9')]('/',auth[_0x664f('0xa')](),controller[_0x664f('0xb')]);router[_0x664f('0x9')](_0x664f('0xc'),auth[_0x664f('0xa')](),controller['describe']);router[_0x664f('0x9')](_0x664f('0xd'),auth[_0x664f('0xa')](),controller[_0x664f('0xe')]);router[_0x664f('0x9')](_0x664f('0xf'),auth[_0x664f('0xa')](),controller['show']);router[_0x664f('0x9')]('/:id/dispositions',auth[_0x664f('0xa')](),controller[_0x664f('0x10')]);router[_0x664f('0x9')](_0x664f('0x11'),auth[_0x664f('0xa')](),controller['getContacts']);router[_0x664f('0x9')](_0x664f('0x12'),auth[_0x664f('0xa')](),controller[_0x664f('0x13')]);router[_0x664f('0x9')](_0x664f('0x14'),auth[_0x664f('0xa')](),controller['getCustomFields']);router[_0x664f('0x9')](_0x664f('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0x664f('0x16')]('/',auth[_0x664f('0xa')](),controller['create']);router[_0x664f('0x16')](_0x664f('0x17'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x664f('0x16')](_0x664f('0x11'),auth[_0x664f('0xa')](),controller['addContacts']);router['post']('/:id/fields',auth[_0x664f('0xa')](),controller[_0x664f('0x18')]);router[_0x664f('0x16')]('/:id/users',auth[_0x664f('0xa')](),controller[_0x664f('0x19')]);router['put'](_0x664f('0xf'),auth[_0x664f('0xa')](),controller['update']);router[_0x664f('0x1a')]('/:id',auth[_0x664f('0xa')](),controller[_0x664f('0x1b')]);router['delete'](_0x664f('0x17'),auth[_0x664f('0xa')](),controller[_0x664f('0x1c')]);router['delete']('/:id/users',auth[_0x664f('0xa')](),controller[_0x664f('0x1d')]);module[_0x664f('0x1e')]=router; \ No newline at end of file +var _0x1c32=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getAgents','post','addContacts','addCustomField','/:id/users','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','express','Router','fs-extra'];(function(_0x5a7fca,_0x2b8450){var _0x4db9ff=function(_0x36fe79){while(--_0x36fe79){_0x5a7fca['push'](_0x5a7fca['shift']());}};_0x4db9ff(++_0x2b8450);}(_0x1c32,0xb8));var _0x21c3=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0x1c32[_0x5de1bc];return _0x19f4b8;};'use strict';var multer=require(_0x21c3('0x0'));var util=require(_0x21c3('0x1'));var path=require(_0x21c3('0x2'));var timeout=require('connect-timeout');var express=require(_0x21c3('0x3'));var router=express[_0x21c3('0x4')]();var fs_extra=require(_0x21c3('0x5'));var auth=require(_0x21c3('0x6'));var interaction=require(_0x21c3('0x7'));var config=require(_0x21c3('0x8'));var controller=require(_0x21c3('0x9'));router[_0x21c3('0xa')]('/',auth[_0x21c3('0xb')](),controller[_0x21c3('0xc')]);router[_0x21c3('0xa')](_0x21c3('0xd'),auth[_0x21c3('0xb')](),controller[_0x21c3('0xe')]);router[_0x21c3('0xa')](_0x21c3('0xf'),auth['isAuthenticated'](),controller[_0x21c3('0x10')]);router[_0x21c3('0xa')]('/:id',auth[_0x21c3('0xb')](),controller[_0x21c3('0x11')]);router['get'](_0x21c3('0x12'),auth[_0x21c3('0xb')](),controller[_0x21c3('0x13')]);router[_0x21c3('0xa')](_0x21c3('0x14'),auth[_0x21c3('0xb')](),controller[_0x21c3('0x15')]);router['get'](_0x21c3('0x16'),auth[_0x21c3('0xb')](),controller[_0x21c3('0x17')]);router['get'](_0x21c3('0x18'),auth[_0x21c3('0xb')](),controller['getCustomFields']);router[_0x21c3('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x21c3('0x19')]);router[_0x21c3('0x1a')]('/',auth[_0x21c3('0xb')](),controller['create']);router[_0x21c3('0x1a')](_0x21c3('0x12'),auth[_0x21c3('0xb')](),controller['addDisposition']);router[_0x21c3('0x1a')](_0x21c3('0x14'),auth[_0x21c3('0xb')](),controller[_0x21c3('0x1b')]);router[_0x21c3('0x1a')](_0x21c3('0x18'),auth[_0x21c3('0xb')](),controller[_0x21c3('0x1c')]);router[_0x21c3('0x1a')](_0x21c3('0x1d'),auth[_0x21c3('0xb')](),controller[_0x21c3('0x1e')]);router[_0x21c3('0x1f')](_0x21c3('0x20'),auth[_0x21c3('0xb')](),controller[_0x21c3('0x21')]);router[_0x21c3('0x22')](_0x21c3('0x20'),auth[_0x21c3('0xb')](),controller[_0x21c3('0x23')]);router[_0x21c3('0x22')](_0x21c3('0x12'),auth[_0x21c3('0xb')](),controller[_0x21c3('0x24')]);router[_0x21c3('0x22')]('/:id/users',auth[_0x21c3('0xb')](),controller[_0x21c3('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a736464..0ed3e0f 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bbb=['getDataValue','field','STRING','VIRTUAL'];(function(_0x3c49fb,_0xfbc6ac){var _0x536319=function(_0x488308){while(--_0x488308){_0x3c49fb['push'](_0x3c49fb['shift']());}};_0x536319(++_0xfbc6ac);}(_0x0bbb,0x107));var _0xb0bb=function(_0x401554,_0x34b410){_0x401554=_0x401554-0x0;var _0x5b70e9=_0x0bbb[_0x401554];return _0x5b70e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb0bb('0x0')],'get':function(_0x3c7570){return this[_0xb0bb('0x1')](_0xb0bb('0x2'));}},'field':{'type':Sequelize[_0xb0bb('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4d46=['getDataValue','STRING','sequelize','VIRTUAL'];(function(_0x389213,_0x14a50d){var _0x4ad6ca=function(_0x45203b){while(--_0x45203b){_0x389213['push'](_0x389213['shift']());}};_0x4ad6ca(++_0x14a50d);}(_0x4d46,0x1e2));var _0x64d4=function(_0x4eda88,_0x3cf42f){_0x4eda88=_0x4eda88-0x0;var _0xa891d3=_0x4d46[_0x4eda88];return _0xa891d3;};'use strict';var Sequelize=require(_0x64d4('0x0'));module['exports']={'name':{'type':Sequelize[_0x64d4('0x1')],'get':function(_0x794327){return this[_0x64d4('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x64d4('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 8d0930b..4726efb 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x439c02,_0x382c35){var _0x5681fc=function(_0x1dffe8){while(--_0x1dffe8){_0x439c02['push'](_0x439c02['shift']());}};_0x5681fc(++_0x382c35);}(_0x7a54,0x106));var _0x47a5=function(_0x34a149,_0xf986b5){_0x34a149=_0x34a149-0x0;var _0x50e7ad=_0x7a54[_0x34a149];return _0x50e7ad;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x568313,_0x120b36){var _0x157057=function(_0x4b9a6d){while(--_0x4b9a6d){_0x568313['push'](_0x568313['shift']());}};_0x157057(++_0x120b36);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 9bb1105..4d6a4b8 100644 --- a/server/api/condition/condition.model.js +++ b/server/api/condition/condition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72fe=['util','../../config/logger','bluebird','request-promise','path','./condition.attributes','exports','define','Condition','tools_conditions'];(function(_0xf482c1,_0x32cbca){var _0x184548=function(_0x2f8086){while(--_0x2f8086){_0xf482c1['push'](_0xf482c1['shift']());}};_0x184548(++_0x32cbca);}(_0x72fe,0x1f4));var _0xe72f=function(_0x4f77a6,_0x24efcc){_0x4f77a6=_0x4f77a6-0x0;var _0x41e973=_0x72fe[_0x4f77a6];return _0x41e973;};'use strict';var _=require('lodash');var util=require(_0xe72f('0x0'));var logger=require(_0xe72f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe72f('0x2'));var rp=require(_0xe72f('0x3'));var fs=require('fs');var path=require(_0xe72f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe72f('0x5'));module[_0xe72f('0x6')]=function(_0x3fbb33,_0x3dc17c){return _0x3fbb33[_0xe72f('0x7')](_0xe72f('0x8'),attributes,{'tableName':_0xe72f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56d8=['tools_conditions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','Condition'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x56d8,0x91));var _0x856d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x56d8[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x856d('0x0'));var util=require(_0x856d('0x1'));var logger=require(_0x856d('0x2'))(_0x856d('0x3'));var moment=require(_0x856d('0x4'));var BPromise=require('bluebird');var rp=require(_0x856d('0x5'));var fs=require('fs');var path=require(_0x856d('0x6'));var rimraf=require(_0x856d('0x7'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0x856d('0x8')]=function(_0x54e541,_0x28c157){return _0x54e541[_0x856d('0x9')](_0x856d('0xa'),attributes,{'tableName':_0x856d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 4bf4cdb..1e27570 100644 --- a/server/api/condition/condition.rpc.js +++ b/server/api/condition/condition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb130=['info','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5489bb,_0x5098b9){var _0x2311f7=function(_0x5e2f70){while(--_0x5e2f70){_0x5489bb['push'](_0x5489bb['shift']());}};_0x2311f7(++_0x5098b9);}(_0xb130,0x6b));var _0x0b13=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0xb130[_0x10dbf6];return _0x452147;};'use strict';var _=require(_0x0b13('0x0'));var util=require(_0x0b13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b13('0x2'));var fs=require('fs');var Redis=require(_0x0b13('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b13('0x4'));var logger=require(_0x0b13('0x5'))(_0x0b13('0x6'));var config=require(_0x0b13('0x7'));var jayson=require(_0x0b13('0x8'));var client=jayson[_0x0b13('0x9')][_0x0b13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41977b,_0x299b64,_0x42c607){return new BPromise(function(_0x52c72e,_0x33234d){return client[_0x0b13('0xb')](_0x41977b,_0x42c607)['then'](function(_0x33c458){logger['info'](_0x0b13('0xc'),_0x299b64,_0x0b13('0xd'));logger[_0x0b13('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x299b64,'request\x20sent',JSON[_0x0b13('0xf')](_0x33c458));if(_0x33c458[_0x0b13('0x10')]){if(_0x33c458[_0x0b13('0x10')][_0x0b13('0x11')]===0x1f4){logger[_0x0b13('0x10')]('Condition,\x20%s,\x20%s',_0x299b64,_0x33c458[_0x0b13('0x10')]['message']);return _0x33234d(_0x33c458[_0x0b13('0x10')][_0x0b13('0x12')]);}logger[_0x0b13('0x10')](_0x0b13('0xc'),_0x299b64,_0x33c458[_0x0b13('0x10')][_0x0b13('0x12')]);return _0x52c72e(_0x33c458[_0x0b13('0x10')][_0x0b13('0x12')]);}else{logger[_0x0b13('0x13')](_0x0b13('0xc'),_0x299b64,_0x0b13('0xd'));_0x52c72e(_0x33c458[_0x0b13('0x14')][_0x0b13('0x12')]);}})['catch'](function(_0x516f58){logger[_0x0b13('0x10')]('Condition,\x20%s,\x20%s',_0x299b64,_0x516f58);_0x33234d(_0x516f58);});});} \ No newline at end of file +var _0xc1fe=['request','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x4b6887,_0x96c4b7){var _0x2bf120=function(_0x9c70c){while(--_0x9c70c){_0x4b6887['push'](_0x4b6887['shift']());}};_0x2bf120(++_0x96c4b7);}(_0xc1fe,0x108));var _0xec1f=function(_0x4a0b5f,_0x48f76a){_0x4a0b5f=_0x4a0b5f-0x0;var _0x70d9d6=_0xc1fe[_0x4a0b5f];return _0x70d9d6;};'use strict';var _=require(_0xec1f('0x0'));var util=require(_0xec1f('0x1'));var moment=require(_0xec1f('0x2'));var BPromise=require(_0xec1f('0x3'));var rs=require(_0xec1f('0x4'));var fs=require('fs');var Redis=require(_0xec1f('0x5'));var db=require(_0xec1f('0x6'))['db'];var utils=require(_0xec1f('0x7'));var logger=require(_0xec1f('0x8'))('rpc');var config=require(_0xec1f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xec1f('0xa')][_0xec1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b5fd3,_0xeedf34,_0x239573){return new BPromise(function(_0xcb9a3e,_0x4cf9e6){return client[_0xec1f('0xc')](_0x3b5fd3,_0x239573)['then'](function(_0x527859){logger['info'](_0xec1f('0xd'),_0xeedf34,'request\x20sent');logger[_0xec1f('0xe')](_0xec1f('0xf'),_0xeedf34,'request\x20sent',JSON[_0xec1f('0x10')](_0x527859));if(_0x527859[_0xec1f('0x11')]){if(_0x527859[_0xec1f('0x11')][_0xec1f('0x12')]===0x1f4){logger[_0xec1f('0x11')](_0xec1f('0xd'),_0xeedf34,_0x527859[_0xec1f('0x11')]['message']);return _0x4cf9e6(_0x527859[_0xec1f('0x11')][_0xec1f('0x13')]);}logger[_0xec1f('0x11')]('Condition,\x20%s,\x20%s',_0xeedf34,_0x527859[_0xec1f('0x11')][_0xec1f('0x13')]);return _0xcb9a3e(_0x527859['error'][_0xec1f('0x13')]);}else{logger[_0xec1f('0x14')](_0xec1f('0xd'),_0xeedf34,_0xec1f('0x15'));_0xcb9a3e(_0x527859[_0xec1f('0x16')]['message']);}})['catch'](function(_0x5721fb){logger[_0xec1f('0x11')](_0xec1f('0xd'),_0xeedf34,_0x5721fb);_0x4cf9e6(_0x5721fb);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 06d8b8a..b90b26e 100644 --- a/server/api/condition/index.js +++ b/server/api/condition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeead=['update','delete','/:id','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put','isAuthenticated'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xeead,0x11c));var _0xdeea=function(_0x1056de,_0x1c4a59){_0x1056de=_0x1056de-0x0;var _0x58b2a2=_0xeead[_0x1056de];return _0x58b2a2;};'use strict';var multer=require(_0xdeea('0x0'));var util=require(_0xdeea('0x1'));var path=require('path');var timeout=require(_0xdeea('0x2'));var express=require(_0xdeea('0x3'));var router=express[_0xdeea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdeea('0x5'));var interaction=require(_0xdeea('0x6'));var config=require('../../config/environment');var controller=require(_0xdeea('0x7'));router[_0xdeea('0x8')]('/:id',auth[_0xdeea('0x9')](),controller[_0xdeea('0xa')]);router[_0xdeea('0xb')](_0xdeea('0xc'),auth[_0xdeea('0x9')](),controller['destroy']);module[_0xdeea('0xd')]=router; \ No newline at end of file +var _0x8b70=['isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./condition.controller','/:id','update','delete'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x8b70,0x1c2));var _0x08b7=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x8b70[_0x3f2fea];return _0x69a4d5;};'use strict';var multer=require(_0x08b7('0x0'));var util=require(_0x08b7('0x1'));var path=require(_0x08b7('0x2'));var timeout=require(_0x08b7('0x3'));var express=require(_0x08b7('0x4'));var router=express[_0x08b7('0x5')]();var fs_extra=require(_0x08b7('0x6'));var auth=require(_0x08b7('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x08b7('0x8'));router['put'](_0x08b7('0x9'),auth['isAuthenticated'](),controller[_0x08b7('0xa')]);router[_0x08b7('0xb')](_0x08b7('0x9'),auth[_0x08b7('0xc')](),controller['destroy']);module[_0x08b7('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index ede92ef..709b7f9 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42c6=['INTEGER'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x42c6,0x15e));var _0x642c=function(_0x1a1ec0,_0x11d446){_0x1a1ec0=_0x1a1ec0-0x0;var _0x106724=_0x42c6[_0x1a1ec0];return _0x106724;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x642c('0x0')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x7e57=['exports','STRING','INTEGER'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x7e57,0xdb));var _0x77e5=function(_0x407147,_0x2b5b58){_0x407147=_0x407147-0x0;var _0x5e3a42=_0x7e57[_0x407147];return _0x5e3a42;};'use strict';var Sequelize=require('sequelize');module[_0x77e5('0x0')]={'name':{'type':Sequelize[_0x77e5('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x77e5('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x77e5('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 764ff8d..58c8ecb 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7334=['save','update','then','destroy','get','ContactItemTypes','UserProfileResource','name','send','index','map','ContactItemType','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7334,0x184));var _0x4733=function(_0x51924e,_0x285e0f){_0x51924e=_0x51924e-0x0;var _0x3a1b9a=_0x7334[_0x51924e];return _0x3a1b9a;};'use strict';var emlformat=require(_0x4733('0x0'));var rimraf=require(_0x4733('0x1'));var zipdir=require(_0x4733('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4733('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4733('0x4'));var util=require(_0x4733('0x5'));var path=require(_0x4733('0x6'));var sox=require(_0x4733('0x7'));var csv=require(_0x4733('0x8'));var ejs=require(_0x4733('0x9'));var fs=require('fs');var fs_extra=require(_0x4733('0xa'));var _=require(_0x4733('0xb'));var squel=require(_0x4733('0xc'));var crypto=require(_0x4733('0xd'));var jsforce=require(_0x4733('0xe'));var deskjs=require(_0x4733('0xf'));var toCsv=require(_0x4733('0x8'));var querystring=require(_0x4733('0x10'));var Papa=require(_0x4733('0x11'));var Redis=require(_0x4733('0x12'));var authService=require(_0x4733('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4733('0x14'));var hardwareService=require(_0x4733('0x15'));var logger=require('../../config/logger')(_0x4733('0x16'));var utils=require('../../config/utils');var config=require(_0x4733('0x17'));var licenseUtil=require(_0x4733('0x18'));var db=require(_0x4733('0x19'))['db'];function respondWithStatusCode(_0x461f74,_0x100ecd){_0x100ecd=_0x100ecd||0xcc;return function(_0x1c146c){if(_0x1c146c){return _0x461f74[_0x4733('0x1a')](_0x100ecd);}return _0x461f74['status'](_0x100ecd)[_0x4733('0x1b')]();};}function respondWithResult(_0x543caf,_0x4327f3){_0x4327f3=_0x4327f3||0xc8;return function(_0x1a22e4){if(_0x1a22e4){return _0x543caf[_0x4733('0x1c')](_0x4327f3)[_0x4733('0x1d')](_0x1a22e4);}};}function respondWithFilteredResult(_0x3813df,_0x167016){return function(_0x12f111){if(_0x12f111){var _0x9fff=typeof _0x167016[_0x4733('0x1e')]==='undefined'&&typeof _0x167016[_0x4733('0x1f')]===_0x4733('0x20');var _0x47b129=_0x12f111[_0x4733('0x21')];var _0x1d2fb6=_0x9fff?0x0:_0x167016[_0x4733('0x1e')];var _0x384e0c=_0x9fff?_0x12f111['count']:_0x167016['offset']+_0x167016[_0x4733('0x1f')];var _0x3b730a;if(_0x384e0c>=_0x47b129){_0x384e0c=_0x47b129;_0x3b730a=0xc8;}else{_0x3b730a=0xce;}_0x3813df['status'](_0x3b730a);return _0x3813df[_0x4733('0x22')](_0x4733('0x23'),_0x1d2fb6+'-'+_0x384e0c+'/'+_0x47b129)[_0x4733('0x1d')](_0x12f111);}return null;};}function patchUpdates(_0x7a4e0){return function(_0x493cd3){try{jsonpatch[_0x4733('0x24')](_0x493cd3,_0x7a4e0,!![]);}catch(_0xb45e1){return BPromise['reject'](_0xb45e1);}return _0x493cd3[_0x4733('0x25')]();};}function saveUpdates(_0x18da47,_0x478e34){return function(_0x15a291){if(_0x15a291){return _0x15a291[_0x4733('0x26')](_0x18da47)[_0x4733('0x27')](function(_0x1a0643){return _0x1a0643;});}return null;};}function removeEntity(_0x3a2542,_0x24db74){return function(_0x180049){if(_0x180049){return _0x180049[_0x4733('0x28')]()['then'](function(){var _0x3e6976=_0x180049[_0x4733('0x29')]({'plain':!![]});var _0x7884e5=_0x4733('0x2a');return db[_0x4733('0x2b')][_0x4733('0x28')]({'where':{'type':_0x7884e5,'resourceId':_0x3e6976['id']}})[_0x4733('0x27')](function(){return _0x180049;});})[_0x4733('0x27')](function(){_0x3a2542[_0x4733('0x1c')](0xcc)[_0x4733('0x1b')]();});}};}function handleEntityNotFound(_0x521855,_0x3aeb57){return function(_0x4c91bc){if(!_0x4c91bc){_0x521855['sendStatus'](0x194);}return _0x4c91bc;};}function handleError(_0x24e975,_0x49c516){_0x49c516=_0x49c516||0x1f4;return function(_0xcde4f4){logger['error'](_0xcde4f4['stack']);if(_0xcde4f4['name']){delete _0xcde4f4[_0x4733('0x2c')];}_0x24e975[_0x4733('0x1c')](_0x49c516)[_0x4733('0x2d')](_0xcde4f4);};}exports[_0x4733('0x2e')]=function(_0x4fee4a,_0x538a7c){var _0x50f67e={},_0x2b2757={},_0x56872b={'count':0x0,'rows':[]};var _0x5a4814=_[_0x4733('0x2f')](db[_0x4733('0x30')][_0x4733('0x31')],function(_0x59172a){return{'name':_0x59172a['fieldName'],'type':_0x59172a[_0x4733('0x32')][_0x4733('0x33')]};});_0x2b2757[_0x4733('0x34')]=_[_0x4733('0x2f')](_0x5a4814,_0x4733('0x2c'));_0x2b2757['query']=_[_0x4733('0x35')](_0x4fee4a[_0x4733('0x36')]);_0x2b2757[_0x4733('0x37')]=_[_0x4733('0x38')](_0x2b2757[_0x4733('0x34')],_0x2b2757['query']);_0x50f67e['attributes']=_[_0x4733('0x38')](_0x2b2757[_0x4733('0x34')],qs[_0x4733('0x39')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x39')]));_0x50f67e['attributes']=_0x50f67e[_0x4733('0x3a')][_0x4733('0x3b')]?_0x50f67e[_0x4733('0x3a')]:_0x2b2757['model'];if(!_0x4fee4a[_0x4733('0x36')][_0x4733('0x3c')](_0x4733('0x3d'))){_0x50f67e[_0x4733('0x1f')]=qs[_0x4733('0x1f')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x1f')]);_0x50f67e[_0x4733('0x1e')]=qs['offset'](_0x4fee4a[_0x4733('0x36')]['offset']);}_0x50f67e[_0x4733('0x3e')]=qs[_0x4733('0x3f')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x3f')]);_0x50f67e[_0x4733('0x40')]=qs[_0x4733('0x37')](_[_0x4733('0x41')](_0x4fee4a[_0x4733('0x36')],_0x2b2757['filters']),_0x5a4814);if(_0x4fee4a[_0x4733('0x36')][_0x4733('0x42')]){_0x50f67e['where']=_[_0x4733('0x43')](_0x50f67e[_0x4733('0x40')],{'$or':_['map'](_0x5a4814,function(_0x34aefe){if(_0x34aefe['type']!==_0x4733('0x44')){var _0x4c3073={};_0x4c3073[_0x34aefe[_0x4733('0x2c')]]={'$like':'%'+_0x4fee4a[_0x4733('0x36')]['filter']+'%'};return _0x4c3073;}})});}_0x50f67e=_['merge']({},_0x50f67e,_0x4fee4a[_0x4733('0x45')]);var _0x1d7112={'where':_0x50f67e['where']};return db[_0x4733('0x30')][_0x4733('0x21')](_0x1d7112)[_0x4733('0x27')](function(_0x28ed14){_0x56872b[_0x4733('0x21')]=_0x28ed14;if(_0x4fee4a[_0x4733('0x36')][_0x4733('0x46')]){_0x50f67e[_0x4733('0x47')]=[{'all':!![]}];}return db[_0x4733('0x30')][_0x4733('0x48')](_0x50f67e);})[_0x4733('0x27')](function(_0x1d32df){_0x56872b[_0x4733('0x49')]=_0x1d32df;return _0x56872b;})[_0x4733('0x27')](respondWithFilteredResult(_0x538a7c,_0x50f67e))[_0x4733('0x4a')](handleError(_0x538a7c,null));};exports[_0x4733('0x4b')]=function(_0x297bb1,_0x397088){var _0x50b9cb={'raw':!![],'where':{'id':_0x297bb1[_0x4733('0x4c')]['id']}},_0x1a0c5c={};_0x1a0c5c[_0x4733('0x34')]=_[_0x4733('0x35')](db[_0x4733('0x30')][_0x4733('0x31')]);_0x1a0c5c[_0x4733('0x36')]=_[_0x4733('0x35')](_0x297bb1[_0x4733('0x36')]);_0x1a0c5c[_0x4733('0x37')]=_[_0x4733('0x38')](_0x1a0c5c[_0x4733('0x34')],_0x1a0c5c[_0x4733('0x36')]);_0x50b9cb[_0x4733('0x3a')]=_['intersection'](_0x1a0c5c['model'],qs[_0x4733('0x39')](_0x297bb1[_0x4733('0x36')][_0x4733('0x39')]));_0x50b9cb[_0x4733('0x3a')]=_0x50b9cb[_0x4733('0x3a')][_0x4733('0x3b')]?_0x50b9cb[_0x4733('0x3a')]:_0x1a0c5c[_0x4733('0x34')];if(_0x297bb1[_0x4733('0x36')][_0x4733('0x46')]){_0x50b9cb['include']=[{'all':!![]}];}_0x50b9cb=_['merge']({},_0x50b9cb,_0x297bb1['options']);return db['ContactItemType'][_0x4733('0x4d')](_0x50b9cb)[_0x4733('0x27')](handleEntityNotFound(_0x397088,null))[_0x4733('0x27')](respondWithResult(_0x397088,null))[_0x4733('0x4a')](handleError(_0x397088,null));};exports[_0x4733('0x4e')]=function(_0x45b9cf,_0x1c6abf){return db[_0x4733('0x30')][_0x4733('0x4e')](_0x45b9cf[_0x4733('0x4f')],{})['then'](function(_0x53d70b){var _0x29c93d=_0x45b9cf['user'][_0x4733('0x29')]({'plain':!![]});if(!_0x29c93d)throw new Error(_0x4733('0x50'));if(_0x29c93d[_0x4733('0x51')]==='user'){var _0x3f2a78=_0x53d70b[_0x4733('0x29')]({'plain':!![]});var _0x31ae69=_0x4733('0x2a');return db[_0x4733('0x52')][_0x4733('0x4d')]({'where':{'name':_0x31ae69,'userProfileId':_0x29c93d[_0x4733('0x53')]},'raw':!![]})[_0x4733('0x27')](function(_0x28d428){if(_0x28d428&&_0x28d428['autoAssociation']===0x0){return db[_0x4733('0x2b')][_0x4733('0x4e')]({'name':_0x3f2a78[_0x4733('0x2c')],'resourceId':_0x3f2a78['id'],'type':_0x28d428['name'],'sectionId':_0x28d428['id']},{})[_0x4733('0x27')](function(){return _0x53d70b;});}else{return _0x53d70b;}})[_0x4733('0x4a')](function(_0xafb3f8){logger[_0x4733('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xafb3f8);throw _0xafb3f8;});}return _0x53d70b;})[_0x4733('0x27')](respondWithResult(_0x1c6abf,0xc9))['catch'](handleError(_0x1c6abf,null));};exports[_0x4733('0x26')]=function(_0x3b8165,_0x42405e){if(_0x3b8165[_0x4733('0x4f')]['id']){delete _0x3b8165[_0x4733('0x4f')]['id'];}return db['ContactItemType'][_0x4733('0x4d')]({'where':{'id':_0x3b8165[_0x4733('0x4c')]['id']}})['then'](handleEntityNotFound(_0x42405e,null))['then'](saveUpdates(_0x3b8165[_0x4733('0x4f')],null))[_0x4733('0x27')](respondWithResult(_0x42405e,null))[_0x4733('0x4a')](handleError(_0x42405e,null));};exports[_0x4733('0x28')]=function(_0x422010,_0x972fde){return db[_0x4733('0x30')][_0x4733('0x4d')]({'where':{'id':_0x422010['params']['id']}})['then'](handleEntityNotFound(_0x972fde,null))[_0x4733('0x27')](db['CmContactHasItem'][_0x4733('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x422010[_0x4733('0x4c')]['id']}}))[_0x4733('0x27')](removeEntity(_0x972fde,null))['catch'](handleError(_0x972fde,null));}; \ No newline at end of file +var _0x1775=['status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','ContactItemTypes','UserProfileResource','name','send','index','ContactItemType','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','params','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];function respondWithStatusCode(_0xc613b9,_0x3c4ced){_0x3c4ced=_0x3c4ced||0xcc;return function(_0x111e99){if(_0x111e99){return _0xc613b9[_0x5177('0x1c')](_0x3c4ced);}return _0xc613b9[_0x5177('0x1d')](_0x3c4ced)[_0x5177('0x1e')]();};}function respondWithResult(_0x3e6224,_0x1eb9dd){_0x1eb9dd=_0x1eb9dd||0xc8;return function(_0x41bef4){if(_0x41bef4){return _0x3e6224[_0x5177('0x1d')](_0x1eb9dd)[_0x5177('0x1f')](_0x41bef4);}};}function respondWithFilteredResult(_0x31aff8,_0x1b32e6){return function(_0x175ca6){if(_0x175ca6){var _0x2ab5e5=typeof _0x1b32e6[_0x5177('0x20')]===_0x5177('0x21')&&typeof _0x1b32e6['limit']===_0x5177('0x21');var _0x41e687=_0x175ca6[_0x5177('0x22')];var _0x1b4102=_0x2ab5e5?0x0:_0x1b32e6['offset'];var _0x3e6944=_0x2ab5e5?_0x175ca6[_0x5177('0x22')]:_0x1b32e6[_0x5177('0x20')]+_0x1b32e6['limit'];var _0x86f5f8;if(_0x3e6944>=_0x41e687){_0x3e6944=_0x41e687;_0x86f5f8=0xc8;}else{_0x86f5f8=0xce;}_0x31aff8['status'](_0x86f5f8);return _0x31aff8[_0x5177('0x23')](_0x5177('0x24'),_0x1b4102+'-'+_0x3e6944+'/'+_0x41e687)[_0x5177('0x1f')](_0x175ca6);}return null;};}function patchUpdates(_0x27b732){return function(_0x451e5c){try{jsonpatch[_0x5177('0x25')](_0x451e5c,_0x27b732,!![]);}catch(_0x174c4f){return BPromise[_0x5177('0x26')](_0x174c4f);}return _0x451e5c[_0x5177('0x27')]();};}function saveUpdates(_0x2a95cc,_0x23dad2){return function(_0x3b0c37){if(_0x3b0c37){return _0x3b0c37['update'](_0x2a95cc)[_0x5177('0x28')](function(_0x556f96){return _0x556f96;});}return null;};}function removeEntity(_0x30b60f,_0x2c68d8){return function(_0x3b39b5){if(_0x3b39b5){return _0x3b39b5[_0x5177('0x29')]()['then'](function(){var _0x2503ef=_0x3b39b5['get']({'plain':!![]});var _0x564139=_0x5177('0x2a');return db[_0x5177('0x2b')]['destroy']({'where':{'type':_0x564139,'resourceId':_0x2503ef['id']}})[_0x5177('0x28')](function(){return _0x3b39b5;});})['then'](function(){_0x30b60f[_0x5177('0x1d')](0xcc)[_0x5177('0x1e')]();});}};}function handleEntityNotFound(_0x58846c,_0x3e021a){return function(_0x2554ec){if(!_0x2554ec){_0x58846c[_0x5177('0x1c')](0x194);}return _0x2554ec;};}function handleError(_0x7f86e,_0xe98ff1){_0xe98ff1=_0xe98ff1||0x1f4;return function(_0x1cef5d){logger['error'](_0x1cef5d['stack']);if(_0x1cef5d[_0x5177('0x2c')]){delete _0x1cef5d[_0x5177('0x2c')];}_0x7f86e[_0x5177('0x1d')](_0xe98ff1)[_0x5177('0x2d')](_0x1cef5d);};}exports[_0x5177('0x2e')]=function(_0x8134f9,_0x31eb9f){var _0x72dced={},_0x49f6f1={},_0x42e1db={'count':0x0,'rows':[]};var _0x2233a2=_['map'](db[_0x5177('0x2f')]['rawAttributes'],function(_0x172b36){return{'name':_0x172b36[_0x5177('0x30')],'type':_0x172b36[_0x5177('0x31')]['key']};});_0x49f6f1['model']=_[_0x5177('0x32')](_0x2233a2,_0x5177('0x2c'));_0x49f6f1[_0x5177('0x33')]=_[_0x5177('0x34')](_0x8134f9[_0x5177('0x33')]);_0x49f6f1[_0x5177('0x35')]=_[_0x5177('0x36')](_0x49f6f1[_0x5177('0x37')],_0x49f6f1['query']);_0x72dced[_0x5177('0x38')]=_[_0x5177('0x36')](_0x49f6f1['model'],qs[_0x5177('0x39')](_0x8134f9[_0x5177('0x33')][_0x5177('0x39')]));_0x72dced[_0x5177('0x38')]=_0x72dced[_0x5177('0x38')][_0x5177('0x3a')]?_0x72dced['attributes']:_0x49f6f1[_0x5177('0x37')];if(!_0x8134f9[_0x5177('0x33')][_0x5177('0x3b')](_0x5177('0x3c'))){_0x72dced[_0x5177('0x3d')]=qs[_0x5177('0x3d')](_0x8134f9[_0x5177('0x33')]['limit']);_0x72dced[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x8134f9['query']['offset']);}_0x72dced[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x8134f9[_0x5177('0x33')][_0x5177('0x3f')]);_0x72dced[_0x5177('0x40')]=qs[_0x5177('0x35')](_[_0x5177('0x41')](_0x8134f9[_0x5177('0x33')],_0x49f6f1[_0x5177('0x35')]),_0x2233a2);if(_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]){_0x72dced[_0x5177('0x40')]=_[_0x5177('0x43')](_0x72dced['where'],{'$or':_[_0x5177('0x32')](_0x2233a2,function(_0x2a4db1){if(_0x2a4db1['type']!==_0x5177('0x44')){var _0x56f297={};_0x56f297[_0x2a4db1[_0x5177('0x2c')]]={'$like':'%'+_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]+'%'};return _0x56f297;}})});}_0x72dced=_['merge']({},_0x72dced,_0x8134f9['options']);var _0x210510={'where':_0x72dced[_0x5177('0x40')]};return db[_0x5177('0x2f')][_0x5177('0x22')](_0x210510)[_0x5177('0x28')](function(_0x3e710d){_0x42e1db[_0x5177('0x22')]=_0x3e710d;if(_0x8134f9[_0x5177('0x33')]['includeAll']){_0x72dced[_0x5177('0x45')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x72dced);})[_0x5177('0x28')](function(_0x17dc98){_0x42e1db['rows']=_0x17dc98;return _0x42e1db;})[_0x5177('0x28')](respondWithFilteredResult(_0x31eb9f,_0x72dced))['catch'](handleError(_0x31eb9f,null));};exports['show']=function(_0x46c833,_0x1769cd){var _0x262c71={'raw':!![],'where':{'id':_0x46c833[_0x5177('0x46')]['id']}},_0x3776b8={};_0x3776b8[_0x5177('0x37')]=_[_0x5177('0x34')](db['ContactItemType']['rawAttributes']);_0x3776b8[_0x5177('0x33')]=_['keys'](_0x46c833[_0x5177('0x33')]);_0x3776b8[_0x5177('0x35')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],_0x3776b8['query']);_0x262c71[_0x5177('0x38')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],qs[_0x5177('0x39')](_0x46c833[_0x5177('0x33')][_0x5177('0x39')]));_0x262c71[_0x5177('0x38')]=_0x262c71[_0x5177('0x38')][_0x5177('0x3a')]?_0x262c71[_0x5177('0x38')]:_0x3776b8[_0x5177('0x37')];if(_0x46c833['query'][_0x5177('0x47')]){_0x262c71['include']=[{'all':!![]}];}_0x262c71=_['merge']({},_0x262c71,_0x46c833['options']);return db[_0x5177('0x2f')][_0x5177('0x48')](_0x262c71)['then'](handleEntityNotFound(_0x1769cd,null))[_0x5177('0x28')](respondWithResult(_0x1769cd,null))[_0x5177('0x49')](handleError(_0x1769cd,null));};exports[_0x5177('0x4a')]=function(_0x4891fe,_0x1d4ae4){return db['ContactItemType']['create'](_0x4891fe['body'],{})[_0x5177('0x28')](function(_0x37d5dd){var _0x1300d7=_0x4891fe['user']['get']({'plain':!![]});if(!_0x1300d7)throw new Error(_0x5177('0x4b'));if(_0x1300d7['role']===_0x5177('0x4c')){var _0x9dd7a2=_0x37d5dd[_0x5177('0x4d')]({'plain':!![]});var _0x31a6e1=_0x5177('0x2a');return db[_0x5177('0x4e')][_0x5177('0x48')]({'where':{'name':_0x31a6e1,'userProfileId':_0x1300d7[_0x5177('0x4f')]},'raw':!![]})[_0x5177('0x28')](function(_0x217aca){if(_0x217aca&&_0x217aca[_0x5177('0x50')]===0x0){return db[_0x5177('0x2b')][_0x5177('0x4a')]({'name':_0x9dd7a2['name'],'resourceId':_0x9dd7a2['id'],'type':_0x217aca['name'],'sectionId':_0x217aca['id']},{})[_0x5177('0x28')](function(){return _0x37d5dd;});}else{return _0x37d5dd;}})['catch'](function(_0x649c6f){logger['error'](_0x5177('0x51'),_0x649c6f);throw _0x649c6f;});}return _0x37d5dd;})[_0x5177('0x28')](respondWithResult(_0x1d4ae4,0xc9))[_0x5177('0x49')](handleError(_0x1d4ae4,null));};exports['update']=function(_0x5be224,_0x19884e){if(_0x5be224[_0x5177('0x52')]['id']){delete _0x5be224[_0x5177('0x52')]['id'];}return db[_0x5177('0x2f')]['find']({'where':{'id':_0x5be224['params']['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x19884e,null))[_0x5177('0x28')](saveUpdates(_0x5be224[_0x5177('0x52')],null))[_0x5177('0x28')](respondWithResult(_0x19884e,null))['catch'](handleError(_0x19884e,null));};exports[_0x5177('0x29')]=function(_0x143aff,_0x3a18ad){return db['ContactItemType'][_0x5177('0x48')]({'where':{'id':_0x143aff[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x3a18ad,null))['then'](db[_0x5177('0x53')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x143aff[_0x5177('0x46')]['id']}}))[_0x5177('0x28')](removeEntity(_0x3a18ad,null))[_0x5177('0x49')](handleError(_0x3a18ad,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 2bfa001..d7de1a0 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc46a=['define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports'];(function(_0x405dd6,_0x59b084){var _0x4692d3=function(_0xe9573c){while(--_0xe9573c){_0x405dd6['push'](_0x405dd6['shift']());}};_0x4692d3(++_0x59b084);}(_0xc46a,0x189));var _0xac46=function(_0x2f06b3,_0x12feb6){_0x2f06b3=_0x2f06b3-0x0;var _0x270d4d=_0xc46a[_0x2f06b3];return _0x270d4d;};'use strict';var _=require(_0xac46('0x0'));var util=require(_0xac46('0x1'));var logger=require(_0xac46('0x2'))(_0xac46('0x3'));var moment=require(_0xac46('0x4'));var BPromise=require(_0xac46('0x5'));var rp=require(_0xac46('0x6'));var fs=require('fs');var path=require(_0xac46('0x7'));var rimraf=require(_0xac46('0x8'));var config=require(_0xac46('0x9'));var attributes=require(_0xac46('0xa'));module[_0xac46('0xb')]=function(_0x4f6b9d,_0x17d005){return _0x4f6b9d[_0xac46('0xc')](_0xac46('0xd'),attributes,{'tableName':_0xac46('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4706=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','tools_contact_item_types','lodash','util'];(function(_0x114df3,_0x2b8934){var _0x53262f=function(_0x30d6df){while(--_0x30d6df){_0x114df3['push'](_0x114df3['shift']());}};_0x53262f(++_0x2b8934);}(_0x4706,0x17e));var _0x6470=function(_0x3aea74,_0x5f1e71){_0x3aea74=_0x3aea74-0x0;var _0x2f72e5=_0x4706[_0x3aea74];return _0x2f72e5;};'use strict';var _=require(_0x6470('0x0'));var util=require(_0x6470('0x1'));var logger=require(_0x6470('0x2'))(_0x6470('0x3'));var moment=require(_0x6470('0x4'));var BPromise=require(_0x6470('0x5'));var rp=require(_0x6470('0x6'));var fs=require('fs');var path=require(_0x6470('0x7'));var rimraf=require(_0x6470('0x8'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module[_0x6470('0x9')]=function(_0x168921,_0x1caaf6){return _0x168921[_0x6470('0xa')]('ContactItemType',attributes,{'tableName':_0x6470('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 31d0eca..bdad804 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b34=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x22f8a2,_0x3042a8){var _0x3324ba=function(_0x3171ac){while(--_0x3171ac){_0x22f8a2['push'](_0x22f8a2['shift']());}};_0x3324ba(++_0x3042a8);}(_0x9b34,0x9d));var _0x49b3=function(_0x408c05,_0x12d88a){_0x408c05=_0x408c05-0x0;var _0x515e74=_0x9b34[_0x408c05];return _0x515e74;};'use strict';var _=require(_0x49b3('0x0'));var util=require(_0x49b3('0x1'));var moment=require(_0x49b3('0x2'));var BPromise=require(_0x49b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49b3('0x4'));var db=require(_0x49b3('0x5'))['db'];var utils=require(_0x49b3('0x6'));var logger=require(_0x49b3('0x7'))('rpc');var config=require(_0x49b3('0x8'));var jayson=require(_0x49b3('0x9'));var client=jayson[_0x49b3('0xa')][_0x49b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x182d49,_0x36c6cb,_0x11105b){return new BPromise(function(_0x486437,_0x36a4d2){return client[_0x49b3('0xc')](_0x182d49,_0x11105b)['then'](function(_0x548c97){logger['info'](_0x49b3('0xd'),_0x36c6cb,_0x49b3('0xe'));logger[_0x49b3('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x36c6cb,_0x49b3('0xe'),JSON['stringify'](_0x548c97));if(_0x548c97['error']){if(_0x548c97[_0x49b3('0x10')][_0x49b3('0x11')]===0x1f4){logger[_0x49b3('0x10')]('ContactItemType,\x20%s,\x20%s',_0x36c6cb,_0x548c97[_0x49b3('0x10')]['message']);return _0x36a4d2(_0x548c97[_0x49b3('0x10')][_0x49b3('0x12')]);}logger[_0x49b3('0x10')](_0x49b3('0xd'),_0x36c6cb,_0x548c97[_0x49b3('0x10')][_0x49b3('0x12')]);return _0x486437(_0x548c97[_0x49b3('0x10')][_0x49b3('0x12')]);}else{logger[_0x49b3('0x13')](_0x49b3('0xd'),_0x36c6cb,_0x49b3('0xe'));_0x486437(_0x548c97[_0x49b3('0x14')][_0x49b3('0x12')]);}})[_0x49b3('0x15')](function(_0x4cdb2b){logger[_0x49b3('0x10')](_0x49b3('0xd'),_0x36c6cb,_0x4cdb2b);_0x36a4d2(_0x4cdb2b);});});} \ No newline at end of file +var _0x32ee=['error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32ee,0x10e));var _0xe32e=function(_0x2535c9,_0x15db59){_0x2535c9=_0x2535c9-0x0;var _0x506ac3=_0x32ee[_0x2535c9];return _0x506ac3;};'use strict';var _=require('lodash');var util=require(_0xe32e('0x0'));var moment=require(_0xe32e('0x1'));var BPromise=require('bluebird');var rs=require(_0xe32e('0x2'));var fs=require('fs');var Redis=require(_0xe32e('0x3'));var db=require(_0xe32e('0x4'))['db'];var utils=require(_0xe32e('0x5'));var logger=require(_0xe32e('0x6'))(_0xe32e('0x7'));var config=require(_0xe32e('0x8'));var jayson=require(_0xe32e('0x9'));var client=jayson[_0xe32e('0xa')][_0xe32e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dc66d,_0x29110a,_0x5d610d){return new BPromise(function(_0x5a63b0,_0x29bddf){return client[_0xe32e('0xc')](_0x5dc66d,_0x5d610d)[_0xe32e('0xd')](function(_0xa3f052){logger['info'](_0xe32e('0xe'),_0x29110a,'request\x20sent');logger['debug'](_0xe32e('0xf'),_0x29110a,_0xe32e('0x10'),JSON[_0xe32e('0x11')](_0xa3f052));if(_0xa3f052[_0xe32e('0x12')]){if(_0xa3f052['error'][_0xe32e('0x13')]===0x1f4){logger[_0xe32e('0x12')](_0xe32e('0xe'),_0x29110a,_0xa3f052[_0xe32e('0x12')]['message']);return _0x29bddf(_0xa3f052[_0xe32e('0x12')]['message']);}logger[_0xe32e('0x12')]('ContactItemType,\x20%s,\x20%s',_0x29110a,_0xa3f052[_0xe32e('0x12')][_0xe32e('0x14')]);return _0x5a63b0(_0xa3f052['error'][_0xe32e('0x14')]);}else{logger[_0xe32e('0x15')](_0xe32e('0xe'),_0x29110a,_0xe32e('0x10'));_0x5a63b0(_0xa3f052[_0xe32e('0x16')][_0xe32e('0x14')]);}})[_0xe32e('0x17')](function(_0x18f0c2){logger['error'](_0xe32e('0xe'),_0x29110a,_0x18f0c2);_0x29bddf(_0x18f0c2);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 7f2f2f6..3da7490 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c11=['../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x5c11,0xa4));var _0x15c1=function(_0x289e48,_0x2fe387){_0x289e48=_0x289e48-0x0;var _0x56d497=_0x5c11[_0x289e48];return _0x56d497;};'use strict';var multer=require(_0x15c1('0x0'));var util=require(_0x15c1('0x1'));var path=require(_0x15c1('0x2'));var timeout=require(_0x15c1('0x3'));var express=require('express');var router=express[_0x15c1('0x4')]();var fs_extra=require(_0x15c1('0x5'));var auth=require(_0x15c1('0x6'));var interaction=require(_0x15c1('0x7'));var config=require(_0x15c1('0x8'));var controller=require(_0x15c1('0x9'));router[_0x15c1('0xa')]('/',auth['isAuthenticated'](),controller[_0x15c1('0xb')]);router[_0x15c1('0xa')](_0x15c1('0xc'),auth[_0x15c1('0xd')](),controller[_0x15c1('0xe')]);router[_0x15c1('0xf')]('/',auth[_0x15c1('0xd')](),controller['create']);router['put'](_0x15c1('0xc'),auth[_0x15c1('0xd')](),controller[_0x15c1('0x10')]);router[_0x15c1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x15c1('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb790=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2f6b14,_0x59ea50){var _0x2bb6ef=function(_0x3b6d12){while(--_0x3b6d12){_0x2f6b14['push'](_0x2f6b14['shift']());}};_0x2bb6ef(++_0x59ea50);}(_0xb790,0x1b9));var _0x0b79=function(_0xf34895,_0x21fb70){_0xf34895=_0xf34895-0x0;var _0x143f44=_0xb790[_0xf34895];return _0x143f44;};'use strict';var multer=require(_0x0b79('0x0'));var util=require(_0x0b79('0x1'));var path=require(_0x0b79('0x2'));var timeout=require(_0x0b79('0x3'));var express=require(_0x0b79('0x4'));var router=express['Router']();var fs_extra=require(_0x0b79('0x5'));var auth=require(_0x0b79('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0b79('0x7'));router[_0x0b79('0x8')]('/',auth[_0x0b79('0x9')](),controller[_0x0b79('0xa')]);router['get'](_0x0b79('0xb'),auth[_0x0b79('0x9')](),controller[_0x0b79('0xc')]);router[_0x0b79('0xd')]('/',auth[_0x0b79('0x9')](),controller[_0x0b79('0xe')]);router['put'](_0x0b79('0xb'),auth[_0x0b79('0x9')](),controller[_0x0b79('0xf')]);router[_0x0b79('0x10')]('/:id',auth[_0x0b79('0x9')](),controller[_0x0b79('0x11')]);module[_0x0b79('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d81cd37..d978fa9 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x424339,_0x3486c2){var _0x3f93e4=function(_0x400a5f){while(--_0x400a5f){_0x424339['push'](_0x424339['shift']());}};_0x3f93e4(++_0x3486c2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xe4ba23,_0x366307){var _0x23dc13=function(_0x2a60d5){while(--_0x2a60d5){_0xe4ba23['push'](_0xe4ba23['shift']());}};_0x23dc13(++_0x366307);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d95d81f..d47ce3b 100644 --- a/server/api/dashboard/dashboard.controller.js +++ b/server/api/dashboard/dashboard.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x927e=['web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','CustomDashboards','UserProfileResource','stack','name','send','index','map','Dashboard','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','role','user','userProfileId','create','length','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3'];(function(_0x463d53,_0x59b94d){var _0x528135=function(_0x4d2d70){while(--_0x4d2d70){_0x463d53['push'](_0x463d53['shift']());}};_0x528135(++_0x59b94d);}(_0x927e,0x8e));var _0xe927=function(_0x5557aa,_0x554f79){_0x5557aa=_0x5557aa-0x0;var _0x4148d6=_0x927e[_0x5557aa];return _0x4148d6;};'use strict';var emlformat=require(_0xe927('0x0'));var rimraf=require(_0xe927('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe927('0x2'));var moment=require('moment');var BPromise=require(_0xe927('0x3'));var Mustache=require(_0xe927('0x4'));var util=require('util');var path=require(_0xe927('0x5'));var sox=require(_0xe927('0x6'));var csv=require(_0xe927('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe927('0x8'));var _=require(_0xe927('0x9'));var squel=require(_0xe927('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe927('0xb'));var toCsv=require(_0xe927('0x7'));var querystring=require(_0xe927('0xc'));var Papa=require(_0xe927('0xd'));var Redis=require(_0xe927('0xe'));var authService=require(_0xe927('0xf'));var qs=require(_0xe927('0x10'));var as=require(_0xe927('0x11'));var hardwareService=require(_0xe927('0x12'));var logger=require(_0xe927('0x13'))('api');var utils=require(_0xe927('0x14'));var config=require(_0xe927('0x15'));var licenseUtil=require(_0xe927('0x16'));var db=require(_0xe927('0x17'))['db'];config[_0xe927('0x18')]=_[_0xe927('0x19')](config[_0xe927('0x18')],{'host':_0xe927('0x1a'),'port':0x18eb});var socket=require(_0xe927('0x1b'))(new Redis(config[_0xe927('0x18')]));require('./dashboard.socket')[_0xe927('0x1c')](socket);function respondWithStatusCode(_0xbb816b,_0x4a1bfa){_0x4a1bfa=_0x4a1bfa||0xcc;return function(_0x54090b){if(_0x54090b){return _0xbb816b[_0xe927('0x1d')](_0x4a1bfa);}return _0xbb816b['status'](_0x4a1bfa)[_0xe927('0x1e')]();};}function respondWithResult(_0x124fa5,_0x4d421c){_0x4d421c=_0x4d421c||0xc8;return function(_0x1fb9ab){if(_0x1fb9ab){return _0x124fa5[_0xe927('0x1f')](_0x4d421c)['json'](_0x1fb9ab);}};}function respondWithFilteredResult(_0x34a5c9,_0x43d2af){return function(_0x484e7e){if(_0x484e7e){var _0x5687d9=typeof _0x43d2af[_0xe927('0x20')]===_0xe927('0x21')&&typeof _0x43d2af['limit']===_0xe927('0x21');var _0xad304b=_0x484e7e[_0xe927('0x22')];var _0x21826f=_0x5687d9?0x0:_0x43d2af['offset'];var _0x103776=_0x5687d9?_0x484e7e[_0xe927('0x22')]:_0x43d2af[_0xe927('0x20')]+_0x43d2af[_0xe927('0x23')];var _0x10a657;if(_0x103776>=_0xad304b){_0x103776=_0xad304b;_0x10a657=0xc8;}else{_0x10a657=0xce;}_0x34a5c9[_0xe927('0x1f')](_0x10a657);return _0x34a5c9[_0xe927('0x24')](_0xe927('0x25'),_0x21826f+'-'+_0x103776+'/'+_0xad304b)[_0xe927('0x26')](_0x484e7e);}return null;};}function patchUpdates(_0x2981a9){return function(_0x48b251){try{jsonpatch[_0xe927('0x27')](_0x48b251,_0x2981a9,!![]);}catch(_0x7b5fa2){return BPromise[_0xe927('0x28')](_0x7b5fa2);}return _0x48b251['save']();};}function saveUpdates(_0x37e237,_0x39f1d2){return function(_0x52df6f){if(_0x52df6f){return _0x52df6f[_0xe927('0x29')](_0x37e237)['then'](function(_0x5d31c4){return _0x5d31c4;});}return null;};}function removeEntity(_0x32445c,_0x5ef58e){return function(_0x5ef048){if(_0x5ef048){return _0x5ef048[_0xe927('0x2a')]()[_0xe927('0x2b')](function(){var _0x8e8a78=_0x5ef048[_0xe927('0x2c')]({'plain':!![]});var _0x5bda63=_0xe927('0x2d');return db[_0xe927('0x2e')][_0xe927('0x2a')]({'where':{'type':_0x5bda63,'resourceId':_0x8e8a78['id']}})[_0xe927('0x2b')](function(){return _0x5ef048;});})[_0xe927('0x2b')](function(){_0x32445c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x246606,_0x4e53d8){return function(_0xd294d){if(!_0xd294d){_0x246606[_0xe927('0x1d')](0x194);}return _0xd294d;};}function handleError(_0x9d190d,_0x48ef4c){_0x48ef4c=_0x48ef4c||0x1f4;return function(_0x412d00){logger['error'](_0x412d00[_0xe927('0x2f')]);if(_0x412d00[_0xe927('0x30')]){delete _0x412d00[_0xe927('0x30')];}_0x9d190d[_0xe927('0x1f')](_0x48ef4c)[_0xe927('0x31')](_0x412d00);};}exports[_0xe927('0x32')]=function(_0x1cb9c7,_0x56a743){var _0x57b4bb={},_0x5ea0c7={},_0x410642={'count':0x0,'rows':[]};var _0x373a92=_[_0xe927('0x33')](db[_0xe927('0x34')]['rawAttributes'],function(_0x2cf5e2){return{'name':_0x2cf5e2['fieldName'],'type':_0x2cf5e2[_0xe927('0x35')][_0xe927('0x36')]};});_0x5ea0c7[_0xe927('0x37')]=_[_0xe927('0x33')](_0x373a92,_0xe927('0x30'));_0x5ea0c7['query']=_[_0xe927('0x38')](_0x1cb9c7[_0xe927('0x39')]);_0x5ea0c7['filters']=_[_0xe927('0x3a')](_0x5ea0c7[_0xe927('0x37')],_0x5ea0c7[_0xe927('0x39')]);_0x57b4bb['attributes']=_[_0xe927('0x3a')](_0x5ea0c7[_0xe927('0x37')],qs['fields'](_0x1cb9c7[_0xe927('0x39')][_0xe927('0x3b')]));_0x57b4bb[_0xe927('0x3c')]=_0x57b4bb[_0xe927('0x3c')]['length']?_0x57b4bb[_0xe927('0x3c')]:_0x5ea0c7[_0xe927('0x37')];if(!_0x1cb9c7[_0xe927('0x39')][_0xe927('0x3d')](_0xe927('0x3e'))){_0x57b4bb['limit']=qs[_0xe927('0x23')](_0x1cb9c7['query'][_0xe927('0x23')]);_0x57b4bb['offset']=qs['offset'](_0x1cb9c7['query'][_0xe927('0x20')]);}_0x57b4bb[_0xe927('0x3f')]=qs[_0xe927('0x40')](_0x1cb9c7[_0xe927('0x39')][_0xe927('0x40')]);_0x57b4bb[_0xe927('0x41')]=qs[_0xe927('0x42')](_[_0xe927('0x43')](_0x1cb9c7[_0xe927('0x39')],_0x5ea0c7[_0xe927('0x42')]),_0x373a92);if(_0x1cb9c7['query'][_0xe927('0x44')]){_0x57b4bb['where']=_[_0xe927('0x45')](_0x57b4bb[_0xe927('0x41')],{'$or':_[_0xe927('0x33')](_0x373a92,function(_0x3b1599){if(_0x3b1599['type']!==_0xe927('0x46')){var _0x283816={};_0x283816[_0x3b1599[_0xe927('0x30')]]={'$like':'%'+_0x1cb9c7[_0xe927('0x39')][_0xe927('0x44')]+'%'};return _0x283816;}})});}_0x57b4bb=_[_0xe927('0x45')]({},_0x57b4bb,_0x1cb9c7[_0xe927('0x47')]);var _0x28e216={'where':_0x57b4bb[_0xe927('0x41')]};return db[_0xe927('0x34')][_0xe927('0x22')](_0x28e216)[_0xe927('0x2b')](function(_0x1e9566){_0x410642[_0xe927('0x22')]=_0x1e9566;if(_0x1cb9c7[_0xe927('0x39')][_0xe927('0x48')]){_0x57b4bb[_0xe927('0x49')]=[{'all':!![]}];}return db[_0xe927('0x34')][_0xe927('0x4a')](_0x57b4bb);})[_0xe927('0x2b')](function(_0x45e6ea){_0x410642[_0xe927('0x4b')]=_0x45e6ea;return _0x410642;})[_0xe927('0x2b')](respondWithFilteredResult(_0x56a743,_0x57b4bb))[_0xe927('0x4c')](handleError(_0x56a743,null));};exports[_0xe927('0x4d')]=function(_0x113661,_0x2760c4){var _0x4d92a2={'raw':![],'where':{'id':_0x113661[_0xe927('0x4e')]['id']}},_0x477fea={};_0x477fea['model']=_[_0xe927('0x38')](db[_0xe927('0x34')][_0xe927('0x4f')]);_0x477fea[_0xe927('0x39')]=_[_0xe927('0x38')](_0x113661[_0xe927('0x39')]);_0x477fea[_0xe927('0x42')]=_[_0xe927('0x3a')](_0x477fea[_0xe927('0x37')],_0x477fea[_0xe927('0x39')]);_0x4d92a2[_0xe927('0x3c')]=_[_0xe927('0x3a')](_0x477fea[_0xe927('0x37')],qs[_0xe927('0x3b')](_0x113661[_0xe927('0x39')][_0xe927('0x3b')]));_0x4d92a2[_0xe927('0x3c')]=_0x4d92a2[_0xe927('0x3c')]['length']?_0x4d92a2[_0xe927('0x3c')]:_0x477fea['model'];if(_0x113661[_0xe927('0x39')]['includeAll']){_0x4d92a2[_0xe927('0x49')]=[{'all':!![]}];}_0x4d92a2=_[_0xe927('0x45')]({},_0x4d92a2,_0x113661[_0xe927('0x47')]);return db[_0xe927('0x34')][_0xe927('0x50')](_0x4d92a2)['then'](handleEntityNotFound(_0x2760c4,null))[_0xe927('0x2b')](respondWithResult(_0x2760c4,null))[_0xe927('0x4c')](handleError(_0x2760c4,null));};exports['create']=function(_0x95b1de,_0x3b9438){return db['Dashboard']['create'](_0x95b1de[_0xe927('0x51')],{})[_0xe927('0x2b')](function(_0x46837e){var _0xca8807=_0x95b1de['user'][_0xe927('0x2c')]({'plain':!![]});if(!_0xca8807)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xca8807[_0xe927('0x52')]===_0xe927('0x53')){var _0xcbe613=_0x46837e[_0xe927('0x2c')]({'plain':!![]});var _0x29b975=_0xe927('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x29b975,'userProfileId':_0xca8807[_0xe927('0x54')]},'raw':!![]})[_0xe927('0x2b')](function(_0x224b03){if(_0x224b03&&_0x224b03['autoAssociation']===0x0){return db[_0xe927('0x2e')][_0xe927('0x55')]({'name':_0xcbe613[_0xe927('0x30')],'resourceId':_0xcbe613['id'],'type':_0x224b03[_0xe927('0x30')],'sectionId':_0x224b03['id']},{})[_0xe927('0x2b')](function(){return _0x46837e;});}else{return _0x46837e;}})[_0xe927('0x4c')](function(_0x2d9dba){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d9dba);throw _0x2d9dba;});}return _0x46837e;})[_0xe927('0x2b')](respondWithResult(_0x3b9438,0xc9))[_0xe927('0x4c')](handleError(_0x3b9438,null));};exports['clone']=function(_0x3b0727,_0x5d489c){var _0x536ed8={'where':{'id':_0x3b0727[_0xe927('0x4e')]['id']}},_0x4f486a={};_0x4f486a[_0xe927('0x37')]=_[_0xe927('0x38')](db['Dashboard']['rawAttributes']);_0x536ed8[_0xe927('0x3c')]=_[_0xe927('0x3a')](_0x4f486a[_0xe927('0x37')],qs[_0xe927('0x3b')](_0x3b0727[_0xe927('0x39')][_0xe927('0x3b')]));_0x536ed8[_0xe927('0x3c')]=_0x536ed8[_0xe927('0x3c')][_0xe927('0x56')]?_0x536ed8[_0xe927('0x3c')]:_0x4f486a['model'];if(_0x3b0727['query']['includeAll']){_0x536ed8['include']=[{'all':!![]}];}_0x536ed8=_[_0xe927('0x45')]({},_0x536ed8,_0x3b0727[_0xe927('0x47')]);return db[_0xe927('0x34')][_0xe927('0x50')](_0x536ed8)['then'](handleEntityNotFound(_0x5d489c,null))[_0xe927('0x2b')](function(_0x501fb2){if(_0x501fb2){var _0x5310e7=_0x501fb2['get']({'plain':!![]});_0x5310e7=qs[_0xe927('0x57')](_0x5310e7,['id',_0xe927('0x58'),_0xe927('0x59')]);_0x3b0727[_0xe927('0x51')]=_[_0xe927('0x57')](_0x3b0727[_0xe927('0x51')],['id',_0xe927('0x58'),_0xe927('0x59')]);return db['Dashboard'][_0xe927('0x55')](_[_0xe927('0x45')](_0x5310e7,_0x3b0727[_0xe927('0x51')]),{'include':_0x3b0727[_0xe927('0x39')][_0xe927('0x48')]?[{'all':!![]}]:undefined})[_0xe927('0x2b')](function(_0x1b7197){var _0x519570=_0x3b0727[_0xe927('0x53')]['get']({'plain':!![]});if(!_0x519570)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x519570[_0xe927('0x52')]===_0xe927('0x53')){var _0x24d4e7=_0x1b7197[_0xe927('0x2c')]({'plain':!![]});var _0x1eb8ba=_0xe927('0x2d');return db[_0xe927('0x5a')]['find']({'where':{'name':_0x1eb8ba,'userProfileId':_0x519570[_0xe927('0x54')]},'raw':!![]})[_0xe927('0x2b')](function(_0x38c400){if(_0x38c400&&_0x38c400[_0xe927('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x24d4e7[_0xe927('0x30')],'resourceId':_0x24d4e7['id'],'type':_0x38c400[_0xe927('0x30')],'sectionId':_0x38c400['id']},{})[_0xe927('0x2b')](function(){return _0x1b7197;});}else{return _0x1b7197;}})[_0xe927('0x4c')](function(_0xb45096){logger[_0xe927('0x5c')](_0xe927('0x5d'),_0xb45096);throw _0xb45096;});}return _0x1b7197;});}})['then'](respondWithResult(_0x5d489c,0xc9))['catch'](handleError(_0x5d489c,null));};exports[_0xe927('0x29')]=function(_0x41afb9,_0x30d61f){if(_0x41afb9[_0xe927('0x51')]['id']){delete _0x41afb9[_0xe927('0x51')]['id'];}return db[_0xe927('0x34')][_0xe927('0x50')]({'where':{'id':_0x41afb9[_0xe927('0x4e')]['id']}})[_0xe927('0x2b')](handleEntityNotFound(_0x30d61f,null))['then'](saveUpdates(_0x41afb9['body'],null))[_0xe927('0x2b')](respondWithResult(_0x30d61f,null))[_0xe927('0x4c')](handleError(_0x30d61f,null));};exports['destroy']=function(_0x396286,_0x401b0c){return db[_0xe927('0x34')][_0xe927('0x50')]({'where':{'id':_0x396286[_0xe927('0x4e')]['id']}})[_0xe927('0x2b')](handleEntityNotFound(_0x401b0c,null))[_0xe927('0x2b')](removeEntity(_0x401b0c,null))['catch'](handleError(_0x401b0c,null));};function widgetAttributes(_0x2bf7ee){try{switch(_0x2bf7ee[_0xe927('0x35')]){case'iframe':return[{'name':_0xe927('0x5e'),'value':_0x2bf7ee['attrUrl']||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee['attrs'][0x0][_0xe927('0x60')]:undefined)||_0xe927('0x61')}];case _0xe927('0x62'):return[{'name':_0xe927('0x63'),'value':_0x2bf7ee[_0xe927('0x63')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee['attrs'][0x0][_0xe927('0x60')]:undefined)||''}];case _0xe927('0x64'):return[{'name':'attrHourFormat','value':_0x2bf7ee[_0xe927('0x65')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee[_0xe927('0x5f')][0x0][_0xe927('0x60')]:undefined)||_0xe927('0x66')},{'name':_0xe927('0x67'),'value':_0x2bf7ee[_0xe927('0x67')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x1]?_0x2bf7ee[_0xe927('0x5f')][0x1][_0xe927('0x60')]:undefined)||_0xe927('0x68')},{'name':_0xe927('0x69'),'value':_0x2bf7ee[_0xe927('0x69')]||(_0x2bf7ee['attrs']&&_0x2bf7ee[_0xe927('0x5f')][0x2]?_0x2bf7ee[_0xe927('0x5f')][0x2][_0xe927('0x60')]:undefined)||0xc}];case _0xe927('0x6a'):return[{'name':_0xe927('0x6b'),'value':_0x2bf7ee[_0xe927('0x6b')]||(_0x2bf7ee['attrs']&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee[_0xe927('0x5f')][0x0][_0xe927('0x60')]:undefined)||_0xe927('0x6c')},{'name':_0xe927('0x6d'),'value':_0x2bf7ee[_0xe927('0x6d')]||(_0x2bf7ee['attrs']&&_0x2bf7ee[_0xe927('0x5f')][0x1]?_0x2bf7ee[_0xe927('0x5f')][0x1][_0xe927('0x60')]:undefined)||[]},{'name':_0xe927('0x69'),'value':_0x2bf7ee[_0xe927('0x69')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x2]?_0x2bf7ee[_0xe927('0x5f')][0x2][_0xe927('0x60')]:undefined)||0x14},{'name':_0xe927('0x6e'),'value':_0x2bf7ee[_0xe927('0x6e')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee['attrs'][0x3]?_0x2bf7ee[_0xe927('0x5f')][0x3][_0xe927('0x60')]:undefined)||_0xe927('0x6f')},{'name':_0xe927('0x70'),'value':_0x2bf7ee[_0xe927('0x70')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee['attrs'][0x4]?_0x2bf7ee['attrs'][0x4][_0xe927('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2bf7ee[_0xe927('0x71')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee['attrs'][0x5]?_0x2bf7ee[_0xe927('0x5f')][0x5][_0xe927('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2bf7ee[_0xe927('0x72')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x6]?_0x2bf7ee['attrs'][0x6][_0xe927('0x60')]:undefined)||''},{'name':_0xe927('0x73'),'value':_0x2bf7ee['attrOpenchannelAccounts']||(_0x2bf7ee['attrs']&&_0x2bf7ee[_0xe927('0x5f')][0x7]?_0x2bf7ee[_0xe927('0x5f')][0x7]['value']:undefined)||''},{'name':_0xe927('0x74'),'value':_0x2bf7ee[_0xe927('0x74')]||(_0x2bf7ee['attrs']&&_0x2bf7ee['attrs'][0x8]?_0x2bf7ee[_0xe927('0x5f')][0x8][_0xe927('0x60')]:undefined)||''},{'name':_0xe927('0x75'),'value':_0x2bf7ee[_0xe927('0x75')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x9]?_0x2bf7ee[_0xe927('0x5f')][0x9]['value']:undefined)||''}];case _0xe927('0x76'):case _0xe927('0x77'):return[{'name':'attrSerie1','value':_0x2bf7ee['attrSerie1']||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee[_0xe927('0x5f')][0x0]['value']:undefined)||_0xe927('0x6c')},{'name':_0xe927('0x78'),'value':_0x2bf7ee[_0xe927('0x78')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x1]?_0x2bf7ee[_0xe927('0x5f')][0x1][_0xe927('0x60')]:undefined)||null},{'name':'attrSerie3','value':_0x2bf7ee[_0xe927('0x79')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x2]?_0x2bf7ee['attrs'][0x2][_0xe927('0x60')]:undefined)||null},{'name':_0xe927('0x6d'),'value':_0x2bf7ee[_0xe927('0x6d')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee['attrs'][0x3]?_0x2bf7ee['attrs'][0x3][_0xe927('0x60')]:undefined)||[]},{'name':'attrChannel','value':_0x2bf7ee[_0xe927('0x6e')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x4]?_0x2bf7ee[_0xe927('0x5f')][0x4]['value']:undefined)||_0xe927('0x6f')},{'name':_0xe927('0x70'),'value':_0x2bf7ee[_0xe927('0x70')]||(_0x2bf7ee['attrs']&&_0x2bf7ee[_0xe927('0x5f')][0x5]?_0x2bf7ee[_0xe927('0x5f')][0x5][_0xe927('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2bf7ee[_0xe927('0x71')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x6]?_0x2bf7ee[_0xe927('0x5f')][0x6][_0xe927('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2bf7ee['attrSmsAccounts']||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x7]?_0x2bf7ee['attrs'][0x7][_0xe927('0x60')]:undefined)||''},{'name':_0xe927('0x73'),'value':_0x2bf7ee[_0xe927('0x73')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x8]?_0x2bf7ee['attrs'][0x8][_0xe927('0x60')]:undefined)||''},{'name':_0xe927('0x74'),'value':_0x2bf7ee['attrWhatsappAccounts']||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee['attrs'][0x9]?_0x2bf7ee['attrs'][0x9][_0xe927('0x60')]:undefined)||''},{'name':_0xe927('0x75'),'value':_0x2bf7ee[_0xe927('0x75')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0xa]?_0x2bf7ee[_0xe927('0x5f')][0xa][_0xe927('0x60')]:undefined)||''}];case _0xe927('0x7a'):return[{'name':'attrReport','type':_0x2bf7ee[_0xe927('0x7b')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee['attrs'][0x0][_0xe927('0x35')]:undefined)||null,'value':_0x2bf7ee[_0xe927('0x7c')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee['attrs'][0x0][_0xe927('0x60')]:undefined)||null},{'name':_0xe927('0x7d'),'value':_0x2bf7ee['attrRefresh']||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x1]?_0x2bf7ee[_0xe927('0x5f')][0x1][_0xe927('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x284bcf){logger['error'](_0xe927('0x7e'),JSON[_0xe927('0x7f')](_0x284bcf));return[];}}exports['addItem']=function(_0x5d6979,_0x5a69df,_0x2b95f2){if(_0x5d6979[_0xe927('0x51')]['id']){delete _0x5d6979['body']['id'];}return db['Dashboard'][_0xe927('0x50')]({'where':{'id':_0x5d6979[_0xe927('0x4e')]['id']}})[_0xe927('0x2b')](handleEntityNotFound(_0x5a69df,null))[_0xe927('0x2b')](function(_0x35fb5a){if(_0x35fb5a){_0x5d6979[_0xe927('0x51')][_0xe927('0x80')]=_0x35fb5a['id'];_0x5d6979[_0xe927('0x51')]['attrs']=widgetAttributes(_0x5d6979[_0xe927('0x51')]);return db[_0xe927('0x81')][_0xe927('0x55')](_0x5d6979[_0xe927('0x51')]);}})[_0xe927('0x2b')](respondWithResult(_0x5a69df,null))['catch'](handleError(_0x5a69df,null));};exports[_0xe927('0x82')]=function(_0x6fe879,_0x512705,_0x51bb8e){var _0x144517={};var _0x4ec3bb={};var _0x2e157a;var _0x584cfd;return db[_0xe927('0x34')][_0xe927('0x83')]({'where':{'id':_0x6fe879[_0xe927('0x4e')]['id']}})[_0xe927('0x2b')](handleEntityNotFound(_0x512705,null))['then'](function(_0x9b969a){if(_0x9b969a){_0x2e157a=_0x9b969a;_0x4ec3bb[_0xe927('0x37')]=_['keys'](db[_0xe927('0x81')][_0xe927('0x4f')]);_0x4ec3bb[_0xe927('0x39')]=_[_0xe927('0x38')](_0x6fe879[_0xe927('0x39')]);_0x4ec3bb['filters']=_['intersection'](_0x4ec3bb['model'],_0x4ec3bb[_0xe927('0x39')]);_0x144517['attributes']=_[_0xe927('0x3a')](_0x4ec3bb[_0xe927('0x37')],qs['fields'](_0x6fe879['query'][_0xe927('0x3b')]));_0x144517[_0xe927('0x3c')]=_0x144517[_0xe927('0x3c')][_0xe927('0x56')]?_0x144517[_0xe927('0x3c')]:_0x4ec3bb[_0xe927('0x37')];_0x144517[_0xe927('0x3f')]=qs[_0xe927('0x40')](_0x6fe879[_0xe927('0x39')][_0xe927('0x40')]);_0x144517[_0xe927('0x41')]=qs[_0xe927('0x42')](_[_0xe927('0x43')](_0x6fe879[_0xe927('0x39')],_0x4ec3bb[_0xe927('0x42')]));if(_0x6fe879[_0xe927('0x39')][_0xe927('0x44')]){_0x144517[_0xe927('0x41')]=_[_0xe927('0x45')](_0x144517[_0xe927('0x41')],{'$or':_[_0xe927('0x33')](_0x144517[_0xe927('0x3c')],function(_0x540a7b){var _0x27fa89={};_0x27fa89[_0x540a7b]={'$like':'%'+_0x6fe879[_0xe927('0x39')][_0xe927('0x44')]+'%'};return _0x27fa89;})});}_0x144517=_[_0xe927('0x45')]({},_0x144517,_0x6fe879[_0xe927('0x47')]);return _0x2e157a[_0xe927('0x82')](_0x144517);}})['then'](function(_0x2b1411){if(_0x2b1411){_0x584cfd=_0x2b1411[_0xe927('0x56')];if(!_0x6fe879[_0xe927('0x39')][_0xe927('0x3d')](_0xe927('0x3e'))){_0x144517[_0xe927('0x23')]=qs[_0xe927('0x23')](_0x6fe879[_0xe927('0x39')][_0xe927('0x23')]);_0x144517[_0xe927('0x20')]=qs['offset'](_0x6fe879[_0xe927('0x39')][_0xe927('0x20')]);}return _0x2e157a[_0xe927('0x82')](_0x144517);}})['then'](function(_0x2e0231){if(_0x2e0231){return _0x2e0231?{'count':_0x584cfd,'rows':_0x2e0231}:null;}})[_0xe927('0x2b')](respondWithResult(_0x512705,null))[_0xe927('0x4c')](handleError(_0x512705,null));}; \ No newline at end of file +var _0x4c0e=['filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','update','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','order','eml-format','fast-json-patch','moment','bluebird','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','CustomDashboards','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x4c0e,0x13d));var _0xe4c0=function(_0x323419,_0x2a6172){_0x323419=_0x323419-0x0;var _0x4c0be7=_0x4c0e[_0x323419];return _0x4c0be7;};'use strict';var emlformat=require(_0xe4c0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe4c0('0x1'));var rp=require('request-promise');var moment=require(_0xe4c0('0x2'));var BPromise=require(_0xe4c0('0x3'));var Mustache=require('mustache');var util=require(_0xe4c0('0x4'));var path=require(_0xe4c0('0x5'));var sox=require('sox');var csv=require(_0xe4c0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe4c0('0x7'));var jsforce=require(_0xe4c0('0x8'));var deskjs=require(_0xe4c0('0x9'));var toCsv=require(_0xe4c0('0x6'));var querystring=require(_0xe4c0('0xa'));var Papa=require(_0xe4c0('0xb'));var Redis=require(_0xe4c0('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe4c0('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4c0('0xe'));var logger=require(_0xe4c0('0xf'))('api');var utils=require(_0xe4c0('0x10'));var config=require(_0xe4c0('0x11'));var licenseUtil=require(_0xe4c0('0x12'));var db=require(_0xe4c0('0x13'))['db'];config[_0xe4c0('0x14')]=_[_0xe4c0('0x15')](config['redis'],{'host':_0xe4c0('0x16'),'port':0x18eb});var socket=require(_0xe4c0('0x17'))(new Redis(config['redis']));require(_0xe4c0('0x18'))[_0xe4c0('0x19')](socket);function respondWithStatusCode(_0x43469a,_0x1aac2a){_0x1aac2a=_0x1aac2a||0xcc;return function(_0x18922a){if(_0x18922a){return _0x43469a[_0xe4c0('0x1a')](_0x1aac2a);}return _0x43469a[_0xe4c0('0x1b')](_0x1aac2a)[_0xe4c0('0x1c')]();};}function respondWithResult(_0x517709,_0x58a04a){_0x58a04a=_0x58a04a||0xc8;return function(_0xd47f09){if(_0xd47f09){return _0x517709['status'](_0x58a04a)['json'](_0xd47f09);}};}function respondWithFilteredResult(_0x302dd9,_0x3eca33){return function(_0x487cc7){if(_0x487cc7){var _0x51795b=typeof _0x3eca33[_0xe4c0('0x1d')]===_0xe4c0('0x1e')&&typeof _0x3eca33[_0xe4c0('0x1f')]===_0xe4c0('0x1e');var _0x5bfae3=_0x487cc7[_0xe4c0('0x20')];var _0x38b4b9=_0x51795b?0x0:_0x3eca33['offset'];var _0x472076=_0x51795b?_0x487cc7[_0xe4c0('0x20')]:_0x3eca33[_0xe4c0('0x1d')]+_0x3eca33[_0xe4c0('0x1f')];var _0x302a60;if(_0x472076>=_0x5bfae3){_0x472076=_0x5bfae3;_0x302a60=0xc8;}else{_0x302a60=0xce;}_0x302dd9[_0xe4c0('0x1b')](_0x302a60);return _0x302dd9[_0xe4c0('0x21')](_0xe4c0('0x22'),_0x38b4b9+'-'+_0x472076+'/'+_0x5bfae3)[_0xe4c0('0x23')](_0x487cc7);}return null;};}function patchUpdates(_0x2f5ee8){return function(_0x3afc03){try{jsonpatch[_0xe4c0('0x24')](_0x3afc03,_0x2f5ee8,!![]);}catch(_0x3fb96e){return BPromise['reject'](_0x3fb96e);}return _0x3afc03[_0xe4c0('0x25')]();};}function saveUpdates(_0x219bc5,_0x1e58bb){return function(_0x16e444){if(_0x16e444){return _0x16e444['update'](_0x219bc5)[_0xe4c0('0x26')](function(_0x17ffa2){return _0x17ffa2;});}return null;};}function removeEntity(_0x18b2e3,_0x102cef){return function(_0x5d4c90){if(_0x5d4c90){return _0x5d4c90[_0xe4c0('0x27')]()[_0xe4c0('0x26')](function(){var _0xbaf0c4=_0x5d4c90['get']({'plain':!![]});var _0x526977=_0xe4c0('0x28');return db['UserProfileResource'][_0xe4c0('0x27')]({'where':{'type':_0x526977,'resourceId':_0xbaf0c4['id']}})[_0xe4c0('0x26')](function(){return _0x5d4c90;});})[_0xe4c0('0x26')](function(){_0x18b2e3['status'](0xcc)[_0xe4c0('0x1c')]();});}};}function handleEntityNotFound(_0x120492,_0x132b24){return function(_0x4dbc8e){if(!_0x4dbc8e){_0x120492[_0xe4c0('0x1a')](0x194);}return _0x4dbc8e;};}function handleError(_0x1ffcc9,_0x131cb5){_0x131cb5=_0x131cb5||0x1f4;return function(_0xc8555e){logger[_0xe4c0('0x29')](_0xc8555e[_0xe4c0('0x2a')]);if(_0xc8555e[_0xe4c0('0x2b')]){delete _0xc8555e[_0xe4c0('0x2b')];}_0x1ffcc9[_0xe4c0('0x1b')](_0x131cb5)[_0xe4c0('0x2c')](_0xc8555e);};}exports[_0xe4c0('0x2d')]=function(_0x4fd624,_0x1a47a4){var _0x57aad3={},_0x5f48cd={},_0x52eb1a={'count':0x0,'rows':[]};var _0x21fcfd=_[_0xe4c0('0x2e')](db[_0xe4c0('0x2f')][_0xe4c0('0x30')],function(_0x8f146){return{'name':_0x8f146[_0xe4c0('0x31')],'type':_0x8f146[_0xe4c0('0x32')][_0xe4c0('0x33')]};});_0x5f48cd[_0xe4c0('0x34')]=_[_0xe4c0('0x2e')](_0x21fcfd,'name');_0x5f48cd[_0xe4c0('0x35')]=_[_0xe4c0('0x36')](_0x4fd624[_0xe4c0('0x35')]);_0x5f48cd[_0xe4c0('0x37')]=_['intersection'](_0x5f48cd[_0xe4c0('0x34')],_0x5f48cd[_0xe4c0('0x35')]);_0x57aad3[_0xe4c0('0x38')]=_[_0xe4c0('0x39')](_0x5f48cd[_0xe4c0('0x34')],qs[_0xe4c0('0x3a')](_0x4fd624['query'][_0xe4c0('0x3a')]));_0x57aad3[_0xe4c0('0x38')]=_0x57aad3[_0xe4c0('0x38')][_0xe4c0('0x3b')]?_0x57aad3[_0xe4c0('0x38')]:_0x5f48cd['model'];if(!_0x4fd624[_0xe4c0('0x35')][_0xe4c0('0x3c')](_0xe4c0('0x3d'))){_0x57aad3['limit']=qs[_0xe4c0('0x1f')](_0x4fd624[_0xe4c0('0x35')][_0xe4c0('0x1f')]);_0x57aad3[_0xe4c0('0x1d')]=qs[_0xe4c0('0x1d')](_0x4fd624[_0xe4c0('0x35')]['offset']);}_0x57aad3['order']=qs[_0xe4c0('0x3e')](_0x4fd624['query'][_0xe4c0('0x3e')]);_0x57aad3['where']=qs[_0xe4c0('0x37')](_[_0xe4c0('0x3f')](_0x4fd624[_0xe4c0('0x35')],_0x5f48cd[_0xe4c0('0x37')]),_0x21fcfd);if(_0x4fd624[_0xe4c0('0x35')][_0xe4c0('0x40')]){_0x57aad3[_0xe4c0('0x41')]=_['merge'](_0x57aad3['where'],{'$or':_[_0xe4c0('0x2e')](_0x21fcfd,function(_0x1d195b){if(_0x1d195b[_0xe4c0('0x32')]!=='VIRTUAL'){var _0x309ae0={};_0x309ae0[_0x1d195b['name']]={'$like':'%'+_0x4fd624[_0xe4c0('0x35')]['filter']+'%'};return _0x309ae0;}})});}_0x57aad3=_[_0xe4c0('0x42')]({},_0x57aad3,_0x4fd624[_0xe4c0('0x43')]);var _0x36d012={'where':_0x57aad3[_0xe4c0('0x41')]};return db[_0xe4c0('0x2f')][_0xe4c0('0x20')](_0x36d012)[_0xe4c0('0x26')](function(_0x3d431d){_0x52eb1a[_0xe4c0('0x20')]=_0x3d431d;if(_0x4fd624[_0xe4c0('0x35')][_0xe4c0('0x44')]){_0x57aad3[_0xe4c0('0x45')]=[{'all':!![]}];}return db[_0xe4c0('0x2f')][_0xe4c0('0x46')](_0x57aad3);})[_0xe4c0('0x26')](function(_0x4ab6e6){_0x52eb1a[_0xe4c0('0x47')]=_0x4ab6e6;return _0x52eb1a;})[_0xe4c0('0x26')](respondWithFilteredResult(_0x1a47a4,_0x57aad3))[_0xe4c0('0x48')](handleError(_0x1a47a4,null));};exports[_0xe4c0('0x49')]=function(_0x3b92a1,_0x42dfee){var _0x1171a0={'raw':![],'where':{'id':_0x3b92a1[_0xe4c0('0x4a')]['id']}},_0x20a02c={};_0x20a02c['model']=_[_0xe4c0('0x36')](db[_0xe4c0('0x2f')][_0xe4c0('0x30')]);_0x20a02c[_0xe4c0('0x35')]=_[_0xe4c0('0x36')](_0x3b92a1[_0xe4c0('0x35')]);_0x20a02c[_0xe4c0('0x37')]=_['intersection'](_0x20a02c[_0xe4c0('0x34')],_0x20a02c[_0xe4c0('0x35')]);_0x1171a0['attributes']=_[_0xe4c0('0x39')](_0x20a02c['model'],qs[_0xe4c0('0x3a')](_0x3b92a1[_0xe4c0('0x35')][_0xe4c0('0x3a')]));_0x1171a0['attributes']=_0x1171a0[_0xe4c0('0x38')][_0xe4c0('0x3b')]?_0x1171a0[_0xe4c0('0x38')]:_0x20a02c[_0xe4c0('0x34')];if(_0x3b92a1[_0xe4c0('0x35')][_0xe4c0('0x44')]){_0x1171a0['include']=[{'all':!![]}];}_0x1171a0=_[_0xe4c0('0x42')]({},_0x1171a0,_0x3b92a1[_0xe4c0('0x43')]);return db[_0xe4c0('0x2f')][_0xe4c0('0x4b')](_0x1171a0)[_0xe4c0('0x26')](handleEntityNotFound(_0x42dfee,null))[_0xe4c0('0x26')](respondWithResult(_0x42dfee,null))[_0xe4c0('0x48')](handleError(_0x42dfee,null));};exports[_0xe4c0('0x4c')]=function(_0x2c42ec,_0x1e65fe){return db['Dashboard'][_0xe4c0('0x4c')](_0x2c42ec[_0xe4c0('0x4d')],{})[_0xe4c0('0x26')](function(_0x3717b0){var _0x55d705=_0x2c42ec['user'][_0xe4c0('0x4e')]({'plain':!![]});if(!_0x55d705)throw new Error(_0xe4c0('0x4f'));if(_0x55d705[_0xe4c0('0x50')]===_0xe4c0('0x51')){var _0x210e3c=_0x3717b0[_0xe4c0('0x4e')]({'plain':!![]});var _0x5c6966='CustomDashboards';return db[_0xe4c0('0x52')]['find']({'where':{'name':_0x5c6966,'userProfileId':_0x55d705[_0xe4c0('0x53')]},'raw':!![]})[_0xe4c0('0x26')](function(_0x32e82c){if(_0x32e82c&&_0x32e82c[_0xe4c0('0x54')]===0x0){return db[_0xe4c0('0x55')][_0xe4c0('0x4c')]({'name':_0x210e3c[_0xe4c0('0x2b')],'resourceId':_0x210e3c['id'],'type':_0x32e82c[_0xe4c0('0x2b')],'sectionId':_0x32e82c['id']},{})[_0xe4c0('0x26')](function(){return _0x3717b0;});}else{return _0x3717b0;}})[_0xe4c0('0x48')](function(_0x3d674b){logger[_0xe4c0('0x29')](_0xe4c0('0x56'),_0x3d674b);throw _0x3d674b;});}return _0x3717b0;})[_0xe4c0('0x26')](respondWithResult(_0x1e65fe,0xc9))[_0xe4c0('0x48')](handleError(_0x1e65fe,null));};exports[_0xe4c0('0x57')]=function(_0x33da39,_0x11251b){var _0x50ec1b={'where':{'id':_0x33da39[_0xe4c0('0x4a')]['id']}},_0x26dea6={};_0x26dea6['model']=_[_0xe4c0('0x36')](db[_0xe4c0('0x2f')][_0xe4c0('0x30')]);_0x50ec1b[_0xe4c0('0x38')]=_[_0xe4c0('0x39')](_0x26dea6[_0xe4c0('0x34')],qs[_0xe4c0('0x3a')](_0x33da39[_0xe4c0('0x35')][_0xe4c0('0x3a')]));_0x50ec1b[_0xe4c0('0x38')]=_0x50ec1b['attributes'][_0xe4c0('0x3b')]?_0x50ec1b[_0xe4c0('0x38')]:_0x26dea6['model'];if(_0x33da39['query'][_0xe4c0('0x44')]){_0x50ec1b['include']=[{'all':!![]}];}_0x50ec1b=_[_0xe4c0('0x42')]({},_0x50ec1b,_0x33da39['options']);return db['Dashboard'][_0xe4c0('0x4b')](_0x50ec1b)[_0xe4c0('0x26')](handleEntityNotFound(_0x11251b,null))[_0xe4c0('0x26')](function(_0x55f097){if(_0x55f097){var _0x4369a2=_0x55f097[_0xe4c0('0x4e')]({'plain':!![]});_0x4369a2=qs['omit'](_0x4369a2,['id',_0xe4c0('0x58'),'updatedAt']);_0x33da39['body']=_['omit'](_0x33da39['body'],['id',_0xe4c0('0x58'),_0xe4c0('0x59')]);return db[_0xe4c0('0x2f')][_0xe4c0('0x4c')](_[_0xe4c0('0x42')](_0x4369a2,_0x33da39[_0xe4c0('0x4d')]),{'include':_0x33da39[_0xe4c0('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0xe4c0('0x26')](function(_0x13b301){var _0x4b5c5e=_0x33da39[_0xe4c0('0x51')][_0xe4c0('0x4e')]({'plain':!![]});if(!_0x4b5c5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b5c5e[_0xe4c0('0x50')]===_0xe4c0('0x51')){var _0x10309c=_0x13b301[_0xe4c0('0x4e')]({'plain':!![]});var _0x16e9bf=_0xe4c0('0x28');return db['UserProfileSection'][_0xe4c0('0x4b')]({'where':{'name':_0x16e9bf,'userProfileId':_0x4b5c5e[_0xe4c0('0x53')]},'raw':!![]})['then'](function(_0x69e3f6){if(_0x69e3f6&&_0x69e3f6[_0xe4c0('0x54')]===0x0){return db['UserProfileResource'][_0xe4c0('0x4c')]({'name':_0x10309c['name'],'resourceId':_0x10309c['id'],'type':_0x69e3f6[_0xe4c0('0x2b')],'sectionId':_0x69e3f6['id']},{})['then'](function(){return _0x13b301;});}else{return _0x13b301;}})['catch'](function(_0x4b633a){logger[_0xe4c0('0x29')](_0xe4c0('0x56'),_0x4b633a);throw _0x4b633a;});}return _0x13b301;});}})['then'](respondWithResult(_0x11251b,0xc9))[_0xe4c0('0x48')](handleError(_0x11251b,null));};exports[_0xe4c0('0x5a')]=function(_0x2d7600,_0x2a62e7){if(_0x2d7600['body']['id']){delete _0x2d7600[_0xe4c0('0x4d')]['id'];}return db[_0xe4c0('0x2f')][_0xe4c0('0x4b')]({'where':{'id':_0x2d7600[_0xe4c0('0x4a')]['id']}})[_0xe4c0('0x26')](handleEntityNotFound(_0x2a62e7,null))['then'](saveUpdates(_0x2d7600['body'],null))[_0xe4c0('0x26')](respondWithResult(_0x2a62e7,null))[_0xe4c0('0x48')](handleError(_0x2a62e7,null));};exports['destroy']=function(_0x5da268,_0x282940){return db[_0xe4c0('0x2f')][_0xe4c0('0x4b')]({'where':{'id':_0x5da268[_0xe4c0('0x4a')]['id']}})[_0xe4c0('0x26')](handleEntityNotFound(_0x282940,null))['then'](removeEntity(_0x282940,null))[_0xe4c0('0x48')](handleError(_0x282940,null));};function widgetAttributes(_0x10c87a){try{switch(_0x10c87a[_0xe4c0('0x32')]){case'iframe':return[{'name':'attrUrl','value':_0x10c87a[_0xe4c0('0x5b')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x0]?_0x10c87a[_0xe4c0('0x5c')][0x0][_0xe4c0('0x5d')]:undefined)||_0xe4c0('0x5e')}];case _0xe4c0('0x5f'):return[{'name':'attrPath','value':_0x10c87a[_0xe4c0('0x60')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x0]?_0x10c87a[_0xe4c0('0x5c')][0x0][_0xe4c0('0x5d')]:undefined)||''}];case _0xe4c0('0x61'):return[{'name':_0xe4c0('0x62'),'value':_0x10c87a[_0xe4c0('0x62')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x0]?_0x10c87a[_0xe4c0('0x5c')][0x0][_0xe4c0('0x5d')]:undefined)||_0xe4c0('0x63')},{'name':'attrTimezone','value':_0x10c87a[_0xe4c0('0x64')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x1]?_0x10c87a[_0xe4c0('0x5c')][0x1][_0xe4c0('0x5d')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x10c87a[_0xe4c0('0x65')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x2]?_0x10c87a[_0xe4c0('0x5c')][0x2][_0xe4c0('0x5d')]:undefined)||0xc}];case'counter':return[{'name':_0xe4c0('0x66'),'value':_0x10c87a[_0xe4c0('0x66')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x0]?_0x10c87a[_0xe4c0('0x5c')][0x0][_0xe4c0('0x5d')]:undefined)||_0xe4c0('0x67')},{'name':_0xe4c0('0x68'),'value':_0x10c87a['attrVoiceQueues']||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a['attrs'][0x1]?_0x10c87a[_0xe4c0('0x5c')][0x1][_0xe4c0('0x5d')]:undefined)||[]},{'name':_0xe4c0('0x65'),'value':_0x10c87a['attrFontSize']||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x2]?_0x10c87a['attrs'][0x2][_0xe4c0('0x5d')]:undefined)||0x14},{'name':'attrChannel','value':_0x10c87a[_0xe4c0('0x69')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x3]?_0x10c87a[_0xe4c0('0x5c')][0x3][_0xe4c0('0x5d')]:undefined)||_0xe4c0('0x6a')},{'name':_0xe4c0('0x6b'),'value':_0x10c87a[_0xe4c0('0x6b')]||(_0x10c87a['attrs']&&_0x10c87a[_0xe4c0('0x5c')][0x4]?_0x10c87a[_0xe4c0('0x5c')][0x4][_0xe4c0('0x5d')]:undefined)||''},{'name':_0xe4c0('0x6c'),'value':_0x10c87a[_0xe4c0('0x6c')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a['attrs'][0x5]?_0x10c87a[_0xe4c0('0x5c')][0x5]['value']:undefined)||''},{'name':_0xe4c0('0x6d'),'value':_0x10c87a[_0xe4c0('0x6d')]||(_0x10c87a['attrs']&&_0x10c87a[_0xe4c0('0x5c')][0x6]?_0x10c87a['attrs'][0x6][_0xe4c0('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x10c87a[_0xe4c0('0x6e')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x7]?_0x10c87a[_0xe4c0('0x5c')][0x7][_0xe4c0('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x10c87a[_0xe4c0('0x6f')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x8]?_0x10c87a[_0xe4c0('0x5c')][0x8]['value']:undefined)||''},{'name':_0xe4c0('0x70'),'value':_0x10c87a[_0xe4c0('0x70')]||(_0x10c87a['attrs']&&_0x10c87a[_0xe4c0('0x5c')][0x9]?_0x10c87a['attrs'][0x9][_0xe4c0('0x5d')]:undefined)||''}];case'multibar-chart':case _0xe4c0('0x71'):return[{'name':'attrSerie1','value':_0x10c87a[_0xe4c0('0x72')]||(_0x10c87a['attrs']&&_0x10c87a[_0xe4c0('0x5c')][0x0]?_0x10c87a['attrs'][0x0][_0xe4c0('0x5d')]:undefined)||_0xe4c0('0x67')},{'name':_0xe4c0('0x73'),'value':_0x10c87a['attrSerie2']||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x1]?_0x10c87a[_0xe4c0('0x5c')][0x1][_0xe4c0('0x5d')]:undefined)||null},{'name':_0xe4c0('0x74'),'value':_0x10c87a[_0xe4c0('0x74')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x2]?_0x10c87a[_0xe4c0('0x5c')][0x2]['value']:undefined)||null},{'name':_0xe4c0('0x68'),'value':_0x10c87a[_0xe4c0('0x68')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a['attrs'][0x3]?_0x10c87a[_0xe4c0('0x5c')][0x3][_0xe4c0('0x5d')]:undefined)||[]},{'name':_0xe4c0('0x69'),'value':_0x10c87a[_0xe4c0('0x69')]||(_0x10c87a['attrs']&&_0x10c87a[_0xe4c0('0x5c')][0x4]?_0x10c87a['attrs'][0x4]['value']:undefined)||_0xe4c0('0x6a')},{'name':_0xe4c0('0x6b'),'value':_0x10c87a[_0xe4c0('0x6b')]||(_0x10c87a['attrs']&&_0x10c87a[_0xe4c0('0x5c')][0x5]?_0x10c87a['attrs'][0x5][_0xe4c0('0x5d')]:undefined)||''},{'name':_0xe4c0('0x6c'),'value':_0x10c87a[_0xe4c0('0x6c')]||(_0x10c87a['attrs']&&_0x10c87a['attrs'][0x6]?_0x10c87a[_0xe4c0('0x5c')][0x6][_0xe4c0('0x5d')]:undefined)||''},{'name':_0xe4c0('0x6d'),'value':_0x10c87a[_0xe4c0('0x6d')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a['attrs'][0x7]?_0x10c87a[_0xe4c0('0x5c')][0x7][_0xe4c0('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x10c87a[_0xe4c0('0x6e')]||(_0x10c87a['attrs']&&_0x10c87a[_0xe4c0('0x5c')][0x8]?_0x10c87a[_0xe4c0('0x5c')][0x8][_0xe4c0('0x5d')]:undefined)||''},{'name':_0xe4c0('0x6f'),'value':_0x10c87a['attrWhatsappAccounts']||(_0x10c87a['attrs']&&_0x10c87a['attrs'][0x9]?_0x10c87a[_0xe4c0('0x5c')][0x9]['value']:undefined)||''},{'name':_0xe4c0('0x70'),'value':_0x10c87a[_0xe4c0('0x70')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0xa]?_0x10c87a[_0xe4c0('0x5c')][0xa][_0xe4c0('0x5d')]:undefined)||''}];case _0xe4c0('0x75'):return[{'name':_0xe4c0('0x76'),'type':_0x10c87a[_0xe4c0('0x77')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a['attrs'][0x0]?_0x10c87a[_0xe4c0('0x5c')][0x0][_0xe4c0('0x32')]:undefined)||null,'value':_0x10c87a[_0xe4c0('0x76')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x0]?_0x10c87a[_0xe4c0('0x5c')][0x0][_0xe4c0('0x5d')]:undefined)||null},{'name':_0xe4c0('0x78'),'value':_0x10c87a[_0xe4c0('0x78')]||(_0x10c87a[_0xe4c0('0x5c')]&&_0x10c87a[_0xe4c0('0x5c')][0x1]?_0x10c87a[_0xe4c0('0x5c')][0x1][_0xe4c0('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x22effc){logger['error'](_0xe4c0('0x79'),JSON[_0xe4c0('0x7a')](_0x22effc));return[];}}exports[_0xe4c0('0x7b')]=function(_0x142d8f,_0x40236d,_0x28c99d){if(_0x142d8f['body']['id']){delete _0x142d8f[_0xe4c0('0x4d')]['id'];}return db[_0xe4c0('0x2f')][_0xe4c0('0x4b')]({'where':{'id':_0x142d8f['params']['id']}})[_0xe4c0('0x26')](handleEntityNotFound(_0x40236d,null))[_0xe4c0('0x26')](function(_0xc0b61){if(_0xc0b61){_0x142d8f['body']['DashboardId']=_0xc0b61['id'];_0x142d8f[_0xe4c0('0x4d')][_0xe4c0('0x5c')]=widgetAttributes(_0x142d8f[_0xe4c0('0x4d')]);return db[_0xe4c0('0x7c')]['create'](_0x142d8f[_0xe4c0('0x4d')]);}})[_0xe4c0('0x26')](respondWithResult(_0x40236d,null))[_0xe4c0('0x48')](handleError(_0x40236d,null));};exports[_0xe4c0('0x7d')]=function(_0x3212cb,_0x113d39,_0x53971e){var _0x5e9dda={};var _0x193219={};var _0x154bbe;var _0x779020;return db[_0xe4c0('0x2f')]['findOne']({'where':{'id':_0x3212cb[_0xe4c0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x113d39,null))[_0xe4c0('0x26')](function(_0x31cccf){if(_0x31cccf){_0x154bbe=_0x31cccf;_0x193219[_0xe4c0('0x34')]=_[_0xe4c0('0x36')](db['DashboardItem'][_0xe4c0('0x30')]);_0x193219[_0xe4c0('0x35')]=_[_0xe4c0('0x36')](_0x3212cb['query']);_0x193219[_0xe4c0('0x37')]=_[_0xe4c0('0x39')](_0x193219['model'],_0x193219[_0xe4c0('0x35')]);_0x5e9dda['attributes']=_[_0xe4c0('0x39')](_0x193219['model'],qs['fields'](_0x3212cb[_0xe4c0('0x35')][_0xe4c0('0x3a')]));_0x5e9dda['attributes']=_0x5e9dda[_0xe4c0('0x38')][_0xe4c0('0x3b')]?_0x5e9dda[_0xe4c0('0x38')]:_0x193219['model'];_0x5e9dda[_0xe4c0('0x7e')]=qs['sort'](_0x3212cb[_0xe4c0('0x35')]['sort']);_0x5e9dda[_0xe4c0('0x41')]=qs['filters'](_['pick'](_0x3212cb[_0xe4c0('0x35')],_0x193219[_0xe4c0('0x37')]));if(_0x3212cb[_0xe4c0('0x35')][_0xe4c0('0x40')]){_0x5e9dda[_0xe4c0('0x41')]=_[_0xe4c0('0x42')](_0x5e9dda['where'],{'$or':_[_0xe4c0('0x2e')](_0x5e9dda[_0xe4c0('0x38')],function(_0x193a2e){var _0x4abf8f={};_0x4abf8f[_0x193a2e]={'$like':'%'+_0x3212cb[_0xe4c0('0x35')][_0xe4c0('0x40')]+'%'};return _0x4abf8f;})});}_0x5e9dda=_['merge']({},_0x5e9dda,_0x3212cb[_0xe4c0('0x43')]);return _0x154bbe[_0xe4c0('0x7d')](_0x5e9dda);}})['then'](function(_0x11917e){if(_0x11917e){_0x779020=_0x11917e[_0xe4c0('0x3b')];if(!_0x3212cb[_0xe4c0('0x35')][_0xe4c0('0x3c')](_0xe4c0('0x3d'))){_0x5e9dda[_0xe4c0('0x1f')]=qs['limit'](_0x3212cb[_0xe4c0('0x35')]['limit']);_0x5e9dda[_0xe4c0('0x1d')]=qs[_0xe4c0('0x1d')](_0x3212cb[_0xe4c0('0x35')][_0xe4c0('0x1d')]);}return _0x154bbe[_0xe4c0('0x7d')](_0x5e9dda);}})[_0xe4c0('0x26')](function(_0x828f87){if(_0x828f87){return _0x828f87?{'count':_0x779020,'rows':_0x828f87}:null;}})['then'](respondWithResult(_0x113d39,null))[_0xe4c0('0x48')](handleError(_0x113d39,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 4fbc661..b46338b 100644 --- a/server/api/dashboard/dashboard.events.js +++ b/server/api/dashboard/dashboard.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb933=['remove','emit','../../mysqldb','Dashboard','save','update'];(function(_0x2db7c0,_0xe25817){var _0x28b197=function(_0x58306f){while(--_0x58306f){_0x2db7c0['push'](_0x2db7c0['shift']());}};_0x28b197(++_0xe25817);}(_0xb933,0x110));var _0x3b93=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xb933[_0x99868f];return _0x27a71b;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x3b93('0x0'))['db'][_0x3b93('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b93('0x2'),'afterUpdate':_0x3b93('0x3'),'afterDestroy':_0x3b93('0x4')};function emitEvent(_0x168653){return function(_0x4f274e,_0x2ed053,_0x3f9e38){DashboardEvents[_0x3b93('0x5')](_0x168653+':'+_0x4f274e['id'],_0x4f274e);DashboardEvents[_0x3b93('0x5')](_0x168653,_0x4f274e);_0x3f9e38(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xc774=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard'];(function(_0x35f4ac,_0x468f03){var _0x5b8bbd=function(_0x37469f){while(--_0x37469f){_0x35f4ac['push'](_0x35f4ac['shift']());}};_0x5b8bbd(++_0x468f03);}(_0xc774,0x129));var _0x4c77=function(_0x275ae5,_0xcfedc3){_0x275ae5=_0x275ae5-0x0;var _0x2c221d=_0xc774[_0x275ae5];return _0x2c221d;};'use strict';var EventEmitter=require(_0x4c77('0x0'));var Dashboard=require(_0x4c77('0x1'))['db'][_0x4c77('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4c77('0x3')](0x0);var events={'afterCreate':_0x4c77('0x4'),'afterUpdate':_0x4c77('0x5'),'afterDestroy':_0x4c77('0x6')};function emitEvent(_0x52c02d){return function(_0x2887fd,_0xb14d2d,_0x3c9238){DashboardEvents[_0x4c77('0x7')](_0x52c02d+':'+_0x2887fd['id'],_0x2887fd);DashboardEvents[_0x4c77('0x7')](_0x52c02d,_0x2887fd);_0x3c9238(null);};}for(var e in events){if(events[_0x4c77('0x8')](e)){var event=events[e];Dashboard[_0x4c77('0x9')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index e28ef77..eb71793 100644 --- a/server/api/dashboard/dashboard.model.js +++ b/server/api/dashboard/dashboard.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5ab=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xf5ab,0x16c));var _0xbf5a=function(_0x461538,_0x593096){_0x461538=_0x461538-0x0;var _0x570061=_0xf5ab[_0x461538];return _0x570061;};'use strict';var _=require(_0xbf5a('0x0'));var util=require(_0xbf5a('0x1'));var logger=require(_0xbf5a('0x2'))(_0xbf5a('0x3'));var moment=require(_0xbf5a('0x4'));var BPromise=require(_0xbf5a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf5a('0x6'));var rimraf=require(_0xbf5a('0x7'));var config=require(_0xbf5a('0x8'));var attributes=require(_0xbf5a('0x9'));module['exports']=function(_0x45334f,_0x152549){return _0x45334f[_0xbf5a('0xa')](_0xbf5a('0xb'),attributes,{'tableName':_0xbf5a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c18=['Dashboard','dashboards','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','define'];(function(_0x58cc62,_0x550387){var _0x2cb63b=function(_0x1e4bfe){while(--_0x1e4bfe){_0x58cc62['push'](_0x58cc62['shift']());}};_0x2cb63b(++_0x550387);}(_0x6c18,0x1a6));var _0x86c1=function(_0x40ca7a,_0x3d0a97){_0x40ca7a=_0x40ca7a-0x0;var _0x2d30b3=_0x6c18[_0x40ca7a];return _0x2d30b3;};'use strict';var _=require('lodash');var util=require(_0x86c1('0x0'));var logger=require(_0x86c1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x86c1('0x2'));var rp=require(_0x86c1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86c1('0x4'));var config=require(_0x86c1('0x5'));var attributes=require(_0x86c1('0x6'));module['exports']=function(_0x3bd87c,_0x412c8d){return _0x3bd87c[_0x86c1('0x7')](_0x86c1('0x8'),attributes,{'tableName':_0x86c1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index c0ebcf9..7bd3c9c 100644 --- a/server/api/dashboard/dashboard.rpc.js +++ b/server/api/dashboard/dashboard.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1db=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','Dashboard,\x20%s,\x20%s'];(function(_0x24579a,_0x59612d){var _0x59dff7=function(_0x47c50f){while(--_0x47c50f){_0x24579a['push'](_0x24579a['shift']());}};_0x59dff7(++_0x59612d);}(_0xa1db,0xb0));var _0xba1d=function(_0x1f4b18,_0x4e777c){_0x1f4b18=_0x1f4b18-0x0;var _0xde3957=_0xa1db[_0x1f4b18];return _0xde3957;};'use strict';var _=require(_0xba1d('0x0'));var util=require(_0xba1d('0x1'));var moment=require(_0xba1d('0x2'));var BPromise=require(_0xba1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba1d('0x4'))['db'];var utils=require(_0xba1d('0x5'));var logger=require('../../config/logger')(_0xba1d('0x6'));var config=require(_0xba1d('0x7'));var jayson=require(_0xba1d('0x8'));var client=jayson[_0xba1d('0x9')][_0xba1d('0xa')]({'port':0x232a});config[_0xba1d('0xb')]=_[_0xba1d('0xc')](config[_0xba1d('0xb')],{'host':_0xba1d('0xd'),'port':0x18eb});var socket=require(_0xba1d('0xe'))(new Redis(config[_0xba1d('0xb')]));require(_0xba1d('0xf'))[_0xba1d('0x10')](socket);function respondWithRpcPromise(_0x4e9713,_0x13e642,_0x39bcb4){return new BPromise(function(_0x3548c9,_0x280d91){return client[_0xba1d('0x11')](_0x4e9713,_0x39bcb4)[_0xba1d('0x12')](function(_0x34ac7d){logger[_0xba1d('0x13')]('Dashboard,\x20%s,\x20%s',_0x13e642,_0xba1d('0x14'));logger[_0xba1d('0x15')](_0xba1d('0x16'),_0x13e642,_0xba1d('0x14'),JSON[_0xba1d('0x17')](_0x34ac7d));if(_0x34ac7d['error']){if(_0x34ac7d['error'][_0xba1d('0x18')]===0x1f4){logger[_0xba1d('0x19')](_0xba1d('0x1a'),_0x13e642,_0x34ac7d[_0xba1d('0x19')][_0xba1d('0x1b')]);return _0x280d91(_0x34ac7d[_0xba1d('0x19')]['message']);}logger['error'](_0xba1d('0x1a'),_0x13e642,_0x34ac7d[_0xba1d('0x19')][_0xba1d('0x1b')]);return _0x3548c9(_0x34ac7d['error'][_0xba1d('0x1b')]);}else{logger[_0xba1d('0x13')](_0xba1d('0x1a'),_0x13e642,_0xba1d('0x14'));_0x3548c9(_0x34ac7d[_0xba1d('0x1c')][_0xba1d('0x1b')]);}})['catch'](function(_0x3110c2){logger[_0xba1d('0x19')](_0xba1d('0x1a'),_0x13e642,_0x3110c2);_0x280d91(_0x3110c2);});});} \ No newline at end of file +var _0x39cc=['../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x1365ae,_0x25be8e){var _0x525a9e=function(_0x4110a7){while(--_0x4110a7){_0x1365ae['push'](_0x1365ae['shift']());}};_0x525a9e(++_0x25be8e);}(_0x39cc,0x190));var _0xc39c=function(_0x14afb2,_0x223bc4){_0x14afb2=_0x14afb2-0x0;var _0x39ab93=_0x39cc[_0x14afb2];return _0x39ab93;};'use strict';var _=require(_0xc39c('0x0'));var util=require(_0xc39c('0x1'));var moment=require('moment');var BPromise=require(_0xc39c('0x2'));var rs=require(_0xc39c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc39c('0x4'))['db'];var utils=require(_0xc39c('0x5'));var logger=require(_0xc39c('0x6'))(_0xc39c('0x7'));var config=require(_0xc39c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc39c('0x9')]['http']({'port':0x232a});config['redis']=_[_0xc39c('0xa')](config[_0xc39c('0xb')],{'host':_0xc39c('0xc'),'port':0x18eb});var socket=require(_0xc39c('0xd'))(new Redis(config['redis']));require(_0xc39c('0xe'))[_0xc39c('0xf')](socket);function respondWithRpcPromise(_0x53ee3b,_0xf89b7a,_0x2b9fe2){return new BPromise(function(_0x4e8e70,_0x21f6bf){return client['request'](_0x53ee3b,_0x2b9fe2)[_0xc39c('0x10')](function(_0x293b78){logger[_0xc39c('0x11')](_0xc39c('0x12'),_0xf89b7a,_0xc39c('0x13'));logger[_0xc39c('0x14')](_0xc39c('0x15'),_0xf89b7a,_0xc39c('0x13'),JSON[_0xc39c('0x16')](_0x293b78));if(_0x293b78[_0xc39c('0x17')]){if(_0x293b78[_0xc39c('0x17')]['code']===0x1f4){logger[_0xc39c('0x17')](_0xc39c('0x12'),_0xf89b7a,_0x293b78[_0xc39c('0x17')][_0xc39c('0x18')]);return _0x21f6bf(_0x293b78['error'][_0xc39c('0x18')]);}logger[_0xc39c('0x17')](_0xc39c('0x12'),_0xf89b7a,_0x293b78['error'][_0xc39c('0x18')]);return _0x4e8e70(_0x293b78['error']['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0xf89b7a,_0xc39c('0x13'));_0x4e8e70(_0x293b78[_0xc39c('0x19')][_0xc39c('0x18')]);}})[_0xc39c('0x1a')](function(_0x9fcdda){logger['error'](_0xc39c('0x12'),_0xf89b7a,_0x9fcdda);_0x21f6bf(_0x9fcdda);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 0ce8db1..fd0b8ea 100644 --- a/server/api/dashboard/dashboard.socket.js +++ b/server/api/dashboard/dashboard.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8769=['removeListener','register','dashboard:','save','remove','update','emit'];(function(_0x553c03,_0x3fc9ce){var _0x5d244c=function(_0x1243e5){while(--_0x1243e5){_0x553c03['push'](_0x553c03['shift']());}};_0x5d244c(++_0x3fc9ce);}(_0x8769,0x9d));var _0x9876=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x8769[_0x19b3f9];return _0x18c3f6;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x9876('0x0'),_0x9876('0x1'),_0x9876('0x2')];function createListener(_0x164fe5,_0x3de8f5){return function(_0x1ac9fa){_0x3de8f5[_0x9876('0x3')](_0x164fe5,_0x1ac9fa);};}function removeListener(_0x17c8ae,_0x78ada0){return function(){DashboardEvents[_0x9876('0x4')](_0x17c8ae,_0x78ada0);};}exports[_0x9876('0x5')]=function(_0x6e46ab){for(var _0xb5fdc5=0x0,_0x568ad2=events['length'];_0xb5fdc5<_0x568ad2;_0xb5fdc5++){var _0x3a38b7=events[_0xb5fdc5];var _0x3bb999=createListener(_0x9876('0x6')+_0x3a38b7,_0x6e46ab);DashboardEvents['on'](_0x3a38b7,_0x3bb999);}}; \ No newline at end of file +var _0xf7f2=['register','length','dashboard:','./dashboard.events','save','update','emit','removeListener'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xf7f2,0xf3));var _0x2f7f=function(_0x7a6897,_0x66fa7c){_0x7a6897=_0x7a6897-0x0;var _0x1d49c1=_0xf7f2[_0x7a6897];return _0x1d49c1;};'use strict';var DashboardEvents=require(_0x2f7f('0x0'));var events=[_0x2f7f('0x1'),'remove',_0x2f7f('0x2')];function createListener(_0x87ea34,_0x3cc557){return function(_0x249c0c){_0x3cc557[_0x2f7f('0x3')](_0x87ea34,_0x249c0c);};}function removeListener(_0x1850fa,_0x96ef2b){return function(){DashboardEvents[_0x2f7f('0x4')](_0x1850fa,_0x96ef2b);};}exports[_0x2f7f('0x5')]=function(_0x420f80){for(var _0x268ea5=0x0,_0x288c85=events[_0x2f7f('0x6')];_0x268ea5<_0x288c85;_0x268ea5++){var _0x31c8c6=events[_0x268ea5];var _0xb2487b=createListener(_0x2f7f('0x7')+_0x31c8c6,_0x420f80);DashboardEvents['on'](_0x31c8c6,_0xb2487b);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d2a1654..ead1370 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9751=['clone','/:id/items','put','update','delete','destroy','exports','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','/:id','show','get','getItems','post','create','/:id/clone'];(function(_0x4c19cc,_0x24e1c4){var _0x2d9319=function(_0x3e6ec8){while(--_0x3e6ec8){_0x4c19cc['push'](_0x4c19cc['shift']());}};_0x2d9319(++_0x24e1c4);}(_0x9751,0x1d5));var _0x1975=function(_0x4c7892,_0x1c2cb0){_0x4c7892=_0x4c7892-0x0;var _0x2a79c8=_0x9751[_0x4c7892];return _0x2a79c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1975('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1975('0x1')]();var fs_extra=require(_0x1975('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1975('0x3'));var config=require(_0x1975('0x4'));var controller=require(_0x1975('0x5'));router['get']('/',auth[_0x1975('0x6')](),controller[_0x1975('0x7')]);router['get'](_0x1975('0x8'),auth[_0x1975('0x6')](),controller[_0x1975('0x9')]);router[_0x1975('0xa')]('/:id/items',auth[_0x1975('0x6')](),controller[_0x1975('0xb')]);router[_0x1975('0xc')]('/',auth[_0x1975('0x6')](),controller[_0x1975('0xd')]);router[_0x1975('0xc')](_0x1975('0xe'),auth[_0x1975('0x6')](),controller[_0x1975('0xf')]);router[_0x1975('0xc')](_0x1975('0x10'),auth['isAuthenticated'](),controller['addItem']);router[_0x1975('0x11')](_0x1975('0x8'),auth[_0x1975('0x6')](),controller[_0x1975('0x12')]);router[_0x1975('0x13')]('/:id',auth[_0x1975('0x6')](),controller[_0x1975('0x14')]);module[_0x1975('0x15')]=router; \ No newline at end of file +var _0xb714=['post','/:id/clone','clone','addItem','update','delete','destroy','exports','util','express','fs-extra','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','create'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xb714,0x120));var _0x4b71=function(_0x121f35,_0x5900cd){_0x121f35=_0x121f35-0x0;var _0x365177=_0xb714[_0x121f35];return _0x365177;};'use strict';var multer=require('multer');var util=require(_0x4b71('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4b71('0x1'));var router=express['Router']();var fs_extra=require(_0x4b71('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b71('0x3'));var controller=require(_0x4b71('0x4'));router[_0x4b71('0x5')]('/',auth[_0x4b71('0x6')](),controller[_0x4b71('0x7')]);router[_0x4b71('0x5')](_0x4b71('0x8'),auth[_0x4b71('0x6')](),controller[_0x4b71('0x9')]);router['get'](_0x4b71('0xa'),auth['isAuthenticated'](),controller['getItems']);router['post']('/',auth[_0x4b71('0x6')](),controller[_0x4b71('0xb')]);router[_0x4b71('0xc')](_0x4b71('0xd'),auth[_0x4b71('0x6')](),controller[_0x4b71('0xe')]);router[_0x4b71('0xc')](_0x4b71('0xa'),auth[_0x4b71('0x6')](),controller[_0x4b71('0xf')]);router['put'](_0x4b71('0x8'),auth[_0x4b71('0x6')](),controller[_0x4b71('0x10')]);router[_0x4b71('0x11')](_0x4b71('0x8'),auth[_0x4b71('0x6')](),controller[_0x4b71('0x12')]);module[_0x4b71('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 0783c17..4a927cb 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba34=['attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','parse','getDataValue'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xba34,0x119));var _0x4ba3=function(_0x6024ae,_0x5c5c6d){_0x6024ae=_0x6024ae-0x0;var _0x565f0f=_0xba34[_0x6024ae];return _0x565f0f;};'use strict';var Sequelize=require(_0x4ba3('0x0'));var squel=require(_0x4ba3('0x1'));var _=require(_0x4ba3('0x2'));module[_0x4ba3('0x3')]={'title':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x4ba3('0x5')](this[_0x4ba3('0x6')](_0x4ba3('0x7')));}catch(_0x1011ec){return[];}},'set':function(_0x3590a1){try{this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON['stringify'](_0x3590a1));}catch(_0x6254fb){this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON[_0x4ba3('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4ba3('0xa')]},'col':{'type':Sequelize[_0x4ba3('0xa')]},'background':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':_0x4ba3('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4ba3('0x4')]},'titleFontSize':{'type':Sequelize[_0x4ba3('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xd117=['long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd117,0x182));var _0x7d11=function(_0x14bf63,_0xdbd373){_0x14bf63=_0x14bf63-0x0;var _0x410d22=_0xd117[_0x14bf63];return _0x410d22;};'use strict';var Sequelize=require(_0x7d11('0x0'));var squel=require(_0x7d11('0x1'));var _=require(_0x7d11('0x2'));module[_0x7d11('0x3')]={'title':{'type':Sequelize[_0x7d11('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x7d11('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7d11('0x5')](_0x7d11('0x6')),'get':function(){try{return JSON[_0x7d11('0x7')](this[_0x7d11('0x8')](_0x7d11('0x9')));}catch(_0x2689c6){return[];}},'set':function(_0x27d7e8){try{this[_0x7d11('0xa')](_0x7d11('0x9'),JSON[_0x7d11('0xb')](_0x27d7e8));}catch(_0x47b5e6){this[_0x7d11('0xa')](_0x7d11('0x9'),JSON[_0x7d11('0xb')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7d11('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7d11('0xc')]},'col':{'type':Sequelize[_0x7d11('0xc')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7d11('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7d11('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 9f90b21..10249da 100644 --- a/server/api/dashboardItem/dashboardItem.controller.js +++ b/server/api/dashboardItem/dashboardItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2eb2=['0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','status','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','length','includeAll','include','merge','options','DashboardItem','destroy','find','type','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','value'];(function(_0x1159cc,_0x567178){var _0x210403=function(_0x27c347){while(--_0x27c347){_0x1159cc['push'](_0x1159cc['shift']());}};_0x210403(++_0x567178);}(_0x2eb2,0x19f));var _0x22eb=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2eb2[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x22eb('0x16')]=_[_0x22eb('0x17')](config[_0x22eb('0x16')],{'host':_0x22eb('0x18'),'port':0x18eb});var socket=require(_0x22eb('0x19'))(new Redis(config['redis']));require(_0x22eb('0x1a'))['register'](socket);function respondWithStatusCode(_0x1f5089,_0x55ede8){_0x55ede8=_0x55ede8||0xcc;return function(_0x40c8cb){if(_0x40c8cb){return _0x1f5089[_0x22eb('0x1b')](_0x55ede8);}return _0x1f5089['status'](_0x55ede8)['end']();};}function respondWithResult(_0x4bc29a,_0x2ed8a7){_0x2ed8a7=_0x2ed8a7||0xc8;return function(_0x5245fe){if(_0x5245fe){return _0x4bc29a['status'](_0x2ed8a7)[_0x22eb('0x1c')](_0x5245fe);}};}function respondWithFilteredResult(_0x4d9a71,_0x4d9b09){return function(_0xb7a73a){if(_0xb7a73a){var _0x2a55e4=typeof _0x4d9b09[_0x22eb('0x1d')]===_0x22eb('0x1e')&&typeof _0x4d9b09[_0x22eb('0x1f')]==='undefined';var _0x4182a8=_0xb7a73a[_0x22eb('0x20')];var _0x10d182=_0x2a55e4?0x0:_0x4d9b09[_0x22eb('0x1d')];var _0x36be50=_0x2a55e4?_0xb7a73a['count']:_0x4d9b09[_0x22eb('0x1d')]+_0x4d9b09[_0x22eb('0x1f')];var _0x2fc36e;if(_0x36be50>=_0x4182a8){_0x36be50=_0x4182a8;_0x2fc36e=0xc8;}else{_0x2fc36e=0xce;}_0x4d9a71['status'](_0x2fc36e);return _0x4d9a71['set'](_0x22eb('0x21'),_0x10d182+'-'+_0x36be50+'/'+_0x4182a8)[_0x22eb('0x1c')](_0xb7a73a);}return null;};}function patchUpdates(_0x434ecb){return function(_0x44639a){try{jsonpatch[_0x22eb('0x22')](_0x44639a,_0x434ecb,!![]);}catch(_0x3e8c1c){return BPromise[_0x22eb('0x23')](_0x3e8c1c);}return _0x44639a['save']();};}function saveUpdates(_0x2e8f7c,_0x11edbd){return function(_0x3ffa9e){if(_0x3ffa9e){return _0x3ffa9e[_0x22eb('0x24')](_0x2e8f7c)[_0x22eb('0x25')](function(_0x4da252){return _0x4da252;});}return null;};}function removeEntity(_0x12c133,_0x6f8ff3){return function(_0x2f3b39){if(_0x2f3b39){return _0x2f3b39['destroy']()[_0x22eb('0x25')](function(){_0x12c133[_0x22eb('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a4b6,_0x222ef3){return function(_0x1e3015){if(!_0x1e3015){_0x32a4b6[_0x22eb('0x1b')](0x194);}return _0x1e3015;};}function handleError(_0x2da5c6,_0x4f4f56){_0x4f4f56=_0x4f4f56||0x1f4;return function(_0x49dd59){logger[_0x22eb('0x27')](_0x49dd59[_0x22eb('0x28')]);if(_0x49dd59[_0x22eb('0x29')]){delete _0x49dd59[_0x22eb('0x29')];}_0x2da5c6[_0x22eb('0x26')](_0x4f4f56)[_0x22eb('0x2a')](_0x49dd59);};}exports[_0x22eb('0x2b')]=function(_0x13814f,_0x382784){var _0x39cec1={'raw':![],'where':{'id':_0x13814f[_0x22eb('0x2c')]['id']}},_0x24e9dc={};_0x24e9dc['model']=_[_0x22eb('0x2d')](db['DashboardItem'][_0x22eb('0x2e')]);_0x24e9dc[_0x22eb('0x2f')]=_[_0x22eb('0x2d')](_0x13814f[_0x22eb('0x2f')]);_0x24e9dc[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x24e9dc[_0x22eb('0x32')],_0x24e9dc[_0x22eb('0x2f')]);_0x39cec1[_0x22eb('0x33')]=_[_0x22eb('0x31')](_0x24e9dc['model'],qs['fields'](_0x13814f[_0x22eb('0x2f')]['fields']));_0x39cec1['attributes']=_0x39cec1[_0x22eb('0x33')][_0x22eb('0x34')]?_0x39cec1[_0x22eb('0x33')]:_0x24e9dc[_0x22eb('0x32')];if(_0x13814f[_0x22eb('0x2f')][_0x22eb('0x35')]){_0x39cec1[_0x22eb('0x36')]=[{'all':!![]}];}_0x39cec1=_[_0x22eb('0x37')]({},_0x39cec1,_0x13814f[_0x22eb('0x38')]);return db[_0x22eb('0x39')]['find'](_0x39cec1)[_0x22eb('0x25')](handleEntityNotFound(_0x382784,null))['then'](respondWithResult(_0x382784,null))['catch'](handleError(_0x382784,null));};exports[_0x22eb('0x3a')]=function(_0x2b5cb5,_0x48e47e){return db[_0x22eb('0x39')][_0x22eb('0x3b')]({'where':{'id':_0x2b5cb5[_0x22eb('0x2c')]['id']}})[_0x22eb('0x25')](handleEntityNotFound(_0x48e47e,null))[_0x22eb('0x25')](removeEntity(_0x48e47e,null))['catch'](handleError(_0x48e47e,null));};function widgetAttributes(_0x25f140){try{switch(_0x25f140[_0x22eb('0x3c')]){case'iframe':return[{'name':_0x22eb('0x3d'),'value':_0x25f140[_0x22eb('0x3d')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||'https://'}];case _0x22eb('0x3f'):return[{'name':_0x22eb('0x40'),'value':_0x25f140['attrPath']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||''}];case _0x22eb('0x41'):return[{'name':_0x22eb('0x42'),'value':_0x25f140[_0x22eb('0x42')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||_0x22eb('0x43')},{'name':_0x22eb('0x44'),'value':_0x25f140['attrTimezone']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x1]?_0x25f140[_0x22eb('0x3e')][0x1][_0x22eb('0x45')]:undefined)||_0x22eb('0x46')},{'name':_0x22eb('0x47'),'value':_0x25f140[_0x22eb('0x47')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x2]?_0x25f140[_0x22eb('0x3e')][0x2][_0x22eb('0x45')]:undefined)||0xc}];case _0x22eb('0x48'):return[{'name':_0x22eb('0x49'),'value':_0x25f140[_0x22eb('0x49')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0][_0x22eb('0x45')]:undefined)||'total'},{'name':_0x22eb('0x4a'),'value':_0x25f140[_0x22eb('0x4a')]||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x1]?_0x25f140[_0x22eb('0x3e')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x25f140['attrFontSize']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x2]?_0x25f140['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x22eb('0x4b'),'value':_0x25f140[_0x22eb('0x4b')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x3]?_0x25f140[_0x22eb('0x3e')][0x3][_0x22eb('0x45')]:undefined)||_0x22eb('0x4c')},{'name':_0x22eb('0x4d'),'value':_0x25f140['attrEmailAccounts']||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x4]?_0x25f140['attrs'][0x4][_0x22eb('0x45')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x25f140[_0x22eb('0x4e')]||(_0x25f140['attrs']&&_0x25f140['attrs'][0x5]?_0x25f140['attrs'][0x5]['value']:undefined)||''},{'name':_0x22eb('0x4f'),'value':_0x25f140['attrSmsAccounts']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x6]?_0x25f140['attrs'][0x6][_0x22eb('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x25f140[_0x22eb('0x50')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x7]?_0x25f140[_0x22eb('0x3e')][0x7][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x51'),'value':_0x25f140[_0x22eb('0x51')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x8]?_0x25f140['attrs'][0x8][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x52'),'value':_0x25f140['attrChatWebsites']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x9]?_0x25f140[_0x22eb('0x3e')][0x9][_0x22eb('0x45')]:undefined)||''}];case'multibar-chart':case _0x22eb('0x53'):return[{'name':_0x22eb('0x54'),'value':_0x25f140[_0x22eb('0x54')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||_0x22eb('0x55')},{'name':'attrSerie2','value':_0x25f140[_0x22eb('0x56')]||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x1]?_0x25f140[_0x22eb('0x3e')][0x1][_0x22eb('0x45')]:undefined)||null},{'name':_0x22eb('0x57'),'value':_0x25f140[_0x22eb('0x57')]||(_0x25f140['attrs']&&_0x25f140['attrs'][0x2]?_0x25f140[_0x22eb('0x3e')][0x2][_0x22eb('0x45')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x25f140[_0x22eb('0x4a')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x3]?_0x25f140[_0x22eb('0x3e')][0x3][_0x22eb('0x45')]:undefined)||[]},{'name':_0x22eb('0x4b'),'value':_0x25f140[_0x22eb('0x4b')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x4]?_0x25f140[_0x22eb('0x3e')][0x4][_0x22eb('0x45')]:undefined)||'voice'},{'name':_0x22eb('0x4d'),'value':_0x25f140[_0x22eb('0x4d')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x5]?_0x25f140[_0x22eb('0x3e')][0x5][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x4e'),'value':_0x25f140[_0x22eb('0x4e')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x6]?_0x25f140[_0x22eb('0x3e')][0x6][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x4f'),'value':_0x25f140[_0x22eb('0x4f')]||(_0x25f140['attrs']&&_0x25f140['attrs'][0x7]?_0x25f140[_0x22eb('0x3e')][0x7][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x50'),'value':_0x25f140[_0x22eb('0x50')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140['attrs'][0x8]?_0x25f140[_0x22eb('0x3e')][0x8][_0x22eb('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x25f140['attrWhatsappAccounts']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x9]?_0x25f140[_0x22eb('0x3e')][0x9][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x52'),'value':_0x25f140[_0x22eb('0x52')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0xa]?_0x25f140[_0x22eb('0x3e')][0xa][_0x22eb('0x45')]:undefined)||''}];case _0x22eb('0x58'):return[{'name':_0x22eb('0x59'),'type':_0x25f140[_0x22eb('0x5a')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140['attrs'][0x0]?_0x25f140[_0x22eb('0x3e')][0x0][_0x22eb('0x3c')]:undefined)||null,'value':_0x25f140[_0x22eb('0x59')]||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140['attrs'][0x0][_0x22eb('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x25f140[_0x22eb('0x5b')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140['attrs'][0x1]?_0x25f140[_0x22eb('0x3e')][0x1][_0x22eb('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x538bc0){logger['error'](_0x22eb('0x5c'),JSON[_0x22eb('0x5d')](_0x538bc0));return[];}}exports[_0x22eb('0x5e')]=function(_0x344064,_0x3468ca){if(_0x344064[_0x22eb('0x5f')]){_0x344064['body'][_0x22eb('0x3e')]=widgetAttributes(_0x344064['body']);}return db['DashboardItem'][_0x22eb('0x5e')](_0x344064[_0x22eb('0x5f')],{})[_0x22eb('0x25')](respondWithResult(_0x3468ca,0xc9))[_0x22eb('0x60')](handleError(_0x3468ca,null));};exports[_0x22eb('0x24')]=function(_0x797700,_0x400dbe){if(_0x797700[_0x22eb('0x5f')]['id']){delete _0x797700['body']['id'];}_0x797700['body'][_0x22eb('0x3e')]=widgetAttributes(_0x797700[_0x22eb('0x5f')]);return db['DashboardItem'][_0x22eb('0x3b')]({'where':{'id':_0x797700[_0x22eb('0x2c')]['id']}})[_0x22eb('0x25')](handleEntityNotFound(_0x400dbe,null))[_0x22eb('0x25')](saveUpdates(_0x797700[_0x22eb('0x5f')],null))[_0x22eb('0x25')](respondWithResult(_0x400dbe,null))['catch'](handleError(_0x400dbe,null));}; \ No newline at end of file +var _0xfdb3=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','catch','find','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','stringify','create','body','update','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment'];(function(_0x55ff21,_0x566b6f){var _0x41d9fb=function(_0x1fec46){while(--_0x1fec46){_0x55ff21['push'](_0x55ff21['shift']());}};_0x41d9fb(++_0x566b6f);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x455fff,_0x325219){_0x455fff=_0x455fff-0x0;var _0x44bdfc=_0xfdb3[_0x455fff];return _0x44bdfc;};'use strict';var emlformat=require(_0x3fdb('0x0'));var rimraf=require(_0x3fdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fdb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3fdb('0x3'));var Mustache=require('mustache');var util=require(_0x3fdb('0x4'));var path=require(_0x3fdb('0x5'));var sox=require(_0x3fdb('0x6'));var csv=require(_0x3fdb('0x7'));var ejs=require(_0x3fdb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fdb('0x9'));var squel=require(_0x3fdb('0xa'));var crypto=require(_0x3fdb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3fdb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3fdb('0xd'));var Papa=require(_0x3fdb('0xe'));var Redis=require(_0x3fdb('0xf'));var authService=require(_0x3fdb('0x10'));var qs=require(_0x3fdb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3fdb('0x12'));var config=require(_0x3fdb('0x13'));var licenseUtil=require(_0x3fdb('0x14'));var db=require(_0x3fdb('0x15'))['db'];config[_0x3fdb('0x16')]=_[_0x3fdb('0x17')](config[_0x3fdb('0x16')],{'host':_0x3fdb('0x18'),'port':0x18eb});var socket=require(_0x3fdb('0x19'))(new Redis(config[_0x3fdb('0x16')]));require('./dashboardItem.socket')[_0x3fdb('0x1a')](socket);function respondWithStatusCode(_0x1a5dd8,_0x4cbc07){_0x4cbc07=_0x4cbc07||0xcc;return function(_0x46c906){if(_0x46c906){return _0x1a5dd8[_0x3fdb('0x1b')](_0x4cbc07);}return _0x1a5dd8[_0x3fdb('0x1c')](_0x4cbc07)[_0x3fdb('0x1d')]();};}function respondWithResult(_0x5a9b95,_0x5f2d00){_0x5f2d00=_0x5f2d00||0xc8;return function(_0x52132a){if(_0x52132a){return _0x5a9b95[_0x3fdb('0x1c')](_0x5f2d00)[_0x3fdb('0x1e')](_0x52132a);}};}function respondWithFilteredResult(_0x11d57d,_0xf52e41){return function(_0x212ab6){if(_0x212ab6){var _0x57676f=typeof _0xf52e41[_0x3fdb('0x1f')]===_0x3fdb('0x20')&&typeof _0xf52e41[_0x3fdb('0x21')]===_0x3fdb('0x20');var _0x370f84=_0x212ab6['count'];var _0x319a6c=_0x57676f?0x0:_0xf52e41[_0x3fdb('0x1f')];var _0x44c8b2=_0x57676f?_0x212ab6[_0x3fdb('0x22')]:_0xf52e41[_0x3fdb('0x1f')]+_0xf52e41['limit'];var _0x76431d;if(_0x44c8b2>=_0x370f84){_0x44c8b2=_0x370f84;_0x76431d=0xc8;}else{_0x76431d=0xce;}_0x11d57d['status'](_0x76431d);return _0x11d57d[_0x3fdb('0x23')]('Content-Range',_0x319a6c+'-'+_0x44c8b2+'/'+_0x370f84)['json'](_0x212ab6);}return null;};}function patchUpdates(_0x48b674){return function(_0x5d6e2f){try{jsonpatch[_0x3fdb('0x24')](_0x5d6e2f,_0x48b674,!![]);}catch(_0x264913){return BPromise[_0x3fdb('0x25')](_0x264913);}return _0x5d6e2f[_0x3fdb('0x26')]();};}function saveUpdates(_0x111cb8,_0x3fb779){return function(_0x5d7665){if(_0x5d7665){return _0x5d7665['update'](_0x111cb8)[_0x3fdb('0x27')](function(_0xc0410d){return _0xc0410d;});}return null;};}function removeEntity(_0x5c30b5,_0xaf7f8f){return function(_0x594173){if(_0x594173){return _0x594173['destroy']()[_0x3fdb('0x27')](function(){_0x5c30b5[_0x3fdb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a634a,_0x4d9c14){return function(_0x166ff2){if(!_0x166ff2){_0x2a634a[_0x3fdb('0x1b')](0x194);}return _0x166ff2;};}function handleError(_0x11db11,_0x477f79){_0x477f79=_0x477f79||0x1f4;return function(_0x3d6fbe){logger[_0x3fdb('0x28')](_0x3d6fbe[_0x3fdb('0x29')]);if(_0x3d6fbe[_0x3fdb('0x2a')]){delete _0x3d6fbe['name'];}_0x11db11['status'](_0x477f79)[_0x3fdb('0x2b')](_0x3d6fbe);};}exports[_0x3fdb('0x2c')]=function(_0x874f01,_0x45da89){var _0x457a79={'raw':![],'where':{'id':_0x874f01[_0x3fdb('0x2d')]['id']}},_0xa87d82={};_0xa87d82[_0x3fdb('0x2e')]=_['keys'](db[_0x3fdb('0x2f')][_0x3fdb('0x30')]);_0xa87d82[_0x3fdb('0x31')]=_[_0x3fdb('0x32')](_0x874f01[_0x3fdb('0x31')]);_0xa87d82[_0x3fdb('0x33')]=_[_0x3fdb('0x34')](_0xa87d82[_0x3fdb('0x2e')],_0xa87d82[_0x3fdb('0x31')]);_0x457a79[_0x3fdb('0x35')]=_[_0x3fdb('0x34')](_0xa87d82[_0x3fdb('0x2e')],qs[_0x3fdb('0x36')](_0x874f01['query']['fields']));_0x457a79[_0x3fdb('0x35')]=_0x457a79[_0x3fdb('0x35')][_0x3fdb('0x37')]?_0x457a79[_0x3fdb('0x35')]:_0xa87d82[_0x3fdb('0x2e')];if(_0x874f01[_0x3fdb('0x31')][_0x3fdb('0x38')]){_0x457a79[_0x3fdb('0x39')]=[{'all':!![]}];}_0x457a79=_[_0x3fdb('0x3a')]({},_0x457a79,_0x874f01['options']);return db[_0x3fdb('0x2f')]['find'](_0x457a79)[_0x3fdb('0x27')](handleEntityNotFound(_0x45da89,null))[_0x3fdb('0x27')](respondWithResult(_0x45da89,null))[_0x3fdb('0x3b')](handleError(_0x45da89,null));};exports['destroy']=function(_0x29cdfa,_0x324037){return db['DashboardItem'][_0x3fdb('0x3c')]({'where':{'id':_0x29cdfa[_0x3fdb('0x2d')]['id']}})[_0x3fdb('0x27')](handleEntityNotFound(_0x324037,null))[_0x3fdb('0x27')](removeEntity(_0x324037,null))['catch'](handleError(_0x324037,null));};function widgetAttributes(_0x18431a){try{switch(_0x18431a[_0x3fdb('0x3d')]){case'iframe':return[{'name':_0x3fdb('0x3e'),'value':_0x18431a[_0x3fdb('0x3e')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x0]?_0x18431a[_0x3fdb('0x3f')][0x0][_0x3fdb('0x40')]:undefined)||'https://'}];case _0x3fdb('0x41'):return[{'name':'attrPath','value':_0x18431a[_0x3fdb('0x42')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x0]?_0x18431a['attrs'][0x0][_0x3fdb('0x40')]:undefined)||''}];case _0x3fdb('0x43'):return[{'name':_0x3fdb('0x44'),'value':_0x18431a[_0x3fdb('0x44')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x0]?_0x18431a[_0x3fdb('0x3f')][0x0]['value']:undefined)||_0x3fdb('0x45')},{'name':_0x3fdb('0x46'),'value':_0x18431a['attrTimezone']||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x1]?_0x18431a[_0x3fdb('0x3f')][0x1][_0x3fdb('0x40')]:undefined)||'0.00'},{'name':_0x3fdb('0x47'),'value':_0x18431a[_0x3fdb('0x47')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x2]?_0x18431a['attrs'][0x2][_0x3fdb('0x40')]:undefined)||0xc}];case _0x3fdb('0x48'):return[{'name':_0x3fdb('0x49'),'value':_0x18431a[_0x3fdb('0x49')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x0]?_0x18431a[_0x3fdb('0x3f')][0x0][_0x3fdb('0x40')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x18431a[_0x3fdb('0x4a')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x1]?_0x18431a[_0x3fdb('0x3f')][0x1][_0x3fdb('0x40')]:undefined)||[]},{'name':_0x3fdb('0x47'),'value':_0x18431a[_0x3fdb('0x47')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x2]?_0x18431a[_0x3fdb('0x3f')][0x2][_0x3fdb('0x40')]:undefined)||0x14},{'name':_0x3fdb('0x4b'),'value':_0x18431a['attrChannel']||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x3]?_0x18431a['attrs'][0x3][_0x3fdb('0x40')]:undefined)||_0x3fdb('0x4c')},{'name':'attrEmailAccounts','value':_0x18431a[_0x3fdb('0x4d')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x4]?_0x18431a['attrs'][0x4][_0x3fdb('0x40')]:undefined)||''},{'name':_0x3fdb('0x4e'),'value':_0x18431a['attrFaxAccounts']||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x5]?_0x18431a[_0x3fdb('0x3f')][0x5][_0x3fdb('0x40')]:undefined)||''},{'name':_0x3fdb('0x4f'),'value':_0x18431a[_0x3fdb('0x4f')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x6]?_0x18431a[_0x3fdb('0x3f')][0x6]['value']:undefined)||''},{'name':_0x3fdb('0x50'),'value':_0x18431a[_0x3fdb('0x50')]||(_0x18431a['attrs']&&_0x18431a['attrs'][0x7]?_0x18431a['attrs'][0x7][_0x3fdb('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x18431a['attrWhatsappAccounts']||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a['attrs'][0x8]?_0x18431a[_0x3fdb('0x3f')][0x8][_0x3fdb('0x40')]:undefined)||''},{'name':'attrChatWebsites','value':_0x18431a[_0x3fdb('0x51')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x9]?_0x18431a['attrs'][0x9][_0x3fdb('0x40')]:undefined)||''}];case'multibar-chart':case _0x3fdb('0x52'):return[{'name':_0x3fdb('0x53'),'value':_0x18431a[_0x3fdb('0x53')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a['attrs'][0x0]?_0x18431a['attrs'][0x0]['value']:undefined)||_0x3fdb('0x54')},{'name':_0x3fdb('0x55'),'value':_0x18431a[_0x3fdb('0x55')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a['attrs'][0x1]?_0x18431a[_0x3fdb('0x3f')][0x1][_0x3fdb('0x40')]:undefined)||null},{'name':_0x3fdb('0x56'),'value':_0x18431a['attrSerie3']||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x2]?_0x18431a[_0x3fdb('0x3f')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x18431a[_0x3fdb('0x4a')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x3]?_0x18431a['attrs'][0x3][_0x3fdb('0x40')]:undefined)||[]},{'name':_0x3fdb('0x4b'),'value':_0x18431a[_0x3fdb('0x4b')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x4]?_0x18431a[_0x3fdb('0x3f')][0x4][_0x3fdb('0x40')]:undefined)||_0x3fdb('0x4c')},{'name':_0x3fdb('0x4d'),'value':_0x18431a[_0x3fdb('0x4d')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x5]?_0x18431a['attrs'][0x5]['value']:undefined)||''},{'name':_0x3fdb('0x4e'),'value':_0x18431a[_0x3fdb('0x4e')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x6]?_0x18431a[_0x3fdb('0x3f')][0x6][_0x3fdb('0x40')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x18431a[_0x3fdb('0x4f')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a['attrs'][0x7]?_0x18431a[_0x3fdb('0x3f')][0x7][_0x3fdb('0x40')]:undefined)||''},{'name':_0x3fdb('0x50'),'value':_0x18431a[_0x3fdb('0x50')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x8]?_0x18431a[_0x3fdb('0x3f')][0x8][_0x3fdb('0x40')]:undefined)||''},{'name':_0x3fdb('0x57'),'value':_0x18431a['attrWhatsappAccounts']||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x9]?_0x18431a[_0x3fdb('0x3f')][0x9][_0x3fdb('0x40')]:undefined)||''},{'name':_0x3fdb('0x51'),'value':_0x18431a[_0x3fdb('0x51')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a['attrs'][0xa]?_0x18431a[_0x3fdb('0x3f')][0xa]['value']:undefined)||''}];case _0x3fdb('0x58'):return[{'name':_0x3fdb('0x59'),'type':_0x18431a[_0x3fdb('0x5a')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x0]?_0x18431a['attrs'][0x0][_0x3fdb('0x3d')]:undefined)||null,'value':_0x18431a[_0x3fdb('0x59')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x0]?_0x18431a[_0x3fdb('0x3f')][0x0][_0x3fdb('0x40')]:undefined)||null},{'name':_0x3fdb('0x5b'),'value':_0x18431a[_0x3fdb('0x5b')]||(_0x18431a[_0x3fdb('0x3f')]&&_0x18431a[_0x3fdb('0x3f')][0x1]?_0x18431a[_0x3fdb('0x3f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5519a8){logger[_0x3fdb('0x28')]('widgetAttributes:\x20%s',JSON[_0x3fdb('0x5c')](_0x5519a8));return[];}}exports[_0x3fdb('0x5d')]=function(_0x42cbe5,_0x5b5993){if(_0x42cbe5['body']){_0x42cbe5[_0x3fdb('0x5e')][_0x3fdb('0x3f')]=widgetAttributes(_0x42cbe5[_0x3fdb('0x5e')]);}return db[_0x3fdb('0x2f')][_0x3fdb('0x5d')](_0x42cbe5['body'],{})[_0x3fdb('0x27')](respondWithResult(_0x5b5993,0xc9))[_0x3fdb('0x3b')](handleError(_0x5b5993,null));};exports[_0x3fdb('0x5f')]=function(_0x1366d4,_0x5110af){if(_0x1366d4[_0x3fdb('0x5e')]['id']){delete _0x1366d4['body']['id'];}_0x1366d4[_0x3fdb('0x5e')][_0x3fdb('0x3f')]=widgetAttributes(_0x1366d4[_0x3fdb('0x5e')]);return db[_0x3fdb('0x2f')][_0x3fdb('0x3c')]({'where':{'id':_0x1366d4['params']['id']}})[_0x3fdb('0x27')](handleEntityNotFound(_0x5110af,null))[_0x3fdb('0x27')](saveUpdates(_0x1366d4[_0x3fdb('0x5e')],null))[_0x3fdb('0x27')](respondWithResult(_0x5110af,null))['catch'](handleError(_0x5110af,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index ce14a5b..dde3978 100644 --- a/server/api/dashboardItem/dashboardItem.events.js +++ b/server/api/dashboardItem/dashboardItem.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52f3=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0xb53f83,_0x39d004){var _0x52cf5=function(_0x1f3fb6){while(--_0x1f3fb6){_0xb53f83['push'](_0xb53f83['shift']());}};_0x52cf5(++_0x39d004);}(_0x52f3,0xba));var _0x352f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x52f3[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x352f('0x0'))['db'][_0x352f('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x352f('0x2')](0x0);var events={'afterCreate':_0x352f('0x3'),'afterUpdate':_0x352f('0x4'),'afterDestroy':_0x352f('0x5')};function emitEvent(_0xc89823){return function(_0x117888,_0x46444e,_0x364034){DashboardItemEvents['emit'](_0xc89823+':'+_0x117888['id'],_0x117888);DashboardItemEvents[_0x352f('0x6')](_0xc89823,_0x117888);_0x364034(null);};}for(var e in events){if(events[_0x352f('0x7')](e)){var event=events[e];DashboardItem[_0x352f('0x8')](e,emitEvent(event));}}module[_0x352f('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x2b09=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2b09,0x1bb));var _0x92b0=function(_0x347110,_0x13aa0f){_0x347110=_0x347110-0x0;var _0x37dfb4=_0x2b09[_0x347110];return _0x37dfb4;};'use strict';var EventEmitter=require(_0x92b0('0x0'));var DashboardItem=require(_0x92b0('0x1'))['db'][_0x92b0('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x92b0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x92b0('0x4'),'afterDestroy':_0x92b0('0x5')};function emitEvent(_0xc72165){return function(_0x1e5868,_0x1d77d8,_0xff180c){DashboardItemEvents['emit'](_0xc72165+':'+_0x1e5868['id'],_0x1e5868);DashboardItemEvents[_0x92b0('0x6')](_0xc72165,_0x1e5868);_0xff180c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x92b0('0x7')](e,emitEvent(event));}}module[_0x92b0('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 19f2fda..5745103 100644 --- a/server/api/dashboardItem/dashboardItem.model.js +++ b/server/api/dashboardItem/dashboardItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c48=['DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0x3c48,0x152));var _0x83c4=function(_0x1e76a8,_0x49cccc){_0x1e76a8=_0x1e76a8-0x0;var _0x56c79a=_0x3c48[_0x1e76a8];return _0x56c79a;};'use strict';var _=require(_0x83c4('0x0'));var util=require(_0x83c4('0x1'));var logger=require(_0x83c4('0x2'))(_0x83c4('0x3'));var moment=require(_0x83c4('0x4'));var BPromise=require(_0x83c4('0x5'));var rp=require(_0x83c4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x83c4('0x7'));var attributes=require(_0x83c4('0x8'));module[_0x83c4('0x9')]=function(_0xff4c6c,_0x19805e){return _0xff4c6c['define'](_0x83c4('0xa'),attributes,{'tableName':_0x83c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60f2=['DashboardItem','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define'];(function(_0x5171ff,_0x5e9e47){var _0x2287ce=function(_0x1e5fca){while(--_0x1e5fca){_0x5171ff['push'](_0x5171ff['shift']());}};_0x2287ce(++_0x5e9e47);}(_0x60f2,0x1bd));var _0x260f=function(_0x2c87c7,_0x3c5fce){_0x2c87c7=_0x2c87c7-0x0;var _0x487963=_0x60f2[_0x2c87c7];return _0x487963;};'use strict';var _=require(_0x260f('0x0'));var util=require(_0x260f('0x1'));var logger=require(_0x260f('0x2'))('api');var moment=require(_0x260f('0x3'));var BPromise=require(_0x260f('0x4'));var rp=require(_0x260f('0x5'));var fs=require('fs');var path=require(_0x260f('0x6'));var rimraf=require(_0x260f('0x7'));var config=require('../../config/environment');var attributes=require(_0x260f('0x8'));module[_0x260f('0x9')]=function(_0x45adcb,_0x17a1cc){return _0x45adcb[_0x260f('0xa')](_0x260f('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 632b4b7..f71abf7 100644 --- a/server/api/dashboardItem/dashboardItem.rpc.js +++ b/server/api/dashboardItem/dashboardItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35aa=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x1cebd3,_0x18e5f7){var _0x4a51eb=function(_0x56fee9){while(--_0x56fee9){_0x1cebd3['push'](_0x1cebd3['shift']());}};_0x4a51eb(++_0x18e5f7);}(_0x35aa,0xf5));var _0xa35a=function(_0x2d7e09,_0x16be83){_0x2d7e09=_0x2d7e09-0x0;var _0x1ba707=_0x35aa[_0x2d7e09];return _0x1ba707;};'use strict';var _=require(_0xa35a('0x0'));var util=require(_0xa35a('0x1'));var moment=require(_0xa35a('0x2'));var BPromise=require(_0xa35a('0x3'));var rs=require(_0xa35a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa35a('0x5'))['db'];var utils=require(_0xa35a('0x6'));var logger=require(_0xa35a('0x7'))(_0xa35a('0x8'));var config=require(_0xa35a('0x9'));var jayson=require(_0xa35a('0xa'));var client=jayson[_0xa35a('0xb')][_0xa35a('0xc')]({'port':0x232a});config[_0xa35a('0xd')]=_['defaults'](config[_0xa35a('0xd')],{'host':_0xa35a('0xe'),'port':0x18eb});var socket=require(_0xa35a('0xf'))(new Redis(config[_0xa35a('0xd')]));require(_0xa35a('0x10'))[_0xa35a('0x11')](socket);function respondWithRpcPromise(_0x39de9c,_0x32e3c3,_0x31e204){return new BPromise(function(_0x2254bd,_0x37f7b6){return client[_0xa35a('0x12')](_0x39de9c,_0x31e204)[_0xa35a('0x13')](function(_0x47ca5b){logger[_0xa35a('0x14')]('DashboardItem,\x20%s,\x20%s',_0x32e3c3,_0xa35a('0x15'));logger[_0xa35a('0x16')](_0xa35a('0x17'),_0x32e3c3,_0xa35a('0x15'),JSON[_0xa35a('0x18')](_0x47ca5b));if(_0x47ca5b[_0xa35a('0x19')]){if(_0x47ca5b[_0xa35a('0x19')][_0xa35a('0x1a')]===0x1f4){logger['error'](_0xa35a('0x1b'),_0x32e3c3,_0x47ca5b['error'][_0xa35a('0x1c')]);return _0x37f7b6(_0x47ca5b[_0xa35a('0x19')]['message']);}logger[_0xa35a('0x19')](_0xa35a('0x1b'),_0x32e3c3,_0x47ca5b[_0xa35a('0x19')]['message']);return _0x2254bd(_0x47ca5b[_0xa35a('0x19')][_0xa35a('0x1c')]);}else{logger[_0xa35a('0x14')]('DashboardItem,\x20%s,\x20%s',_0x32e3c3,'request\x20sent');_0x2254bd(_0x47ca5b[_0xa35a('0x1d')][_0xa35a('0x1c')]);}})[_0xa35a('0x1e')](function(_0x5b136b){logger[_0xa35a('0x19')](_0xa35a('0x1b'),_0x32e3c3,_0x5b136b);_0x37f7b6(_0x5b136b);});});} \ No newline at end of file +var _0x9785=['debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9785,0x1e7));var _0x5978=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x9785[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x5978('0x0'));var util=require(_0x5978('0x1'));var moment=require(_0x5978('0x2'));var BPromise=require(_0x5978('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5978('0x4'));var db=require(_0x5978('0x5'))['db'];var utils=require(_0x5978('0x6'));var logger=require(_0x5978('0x7'))(_0x5978('0x8'));var config=require(_0x5978('0x9'));var jayson=require(_0x5978('0xa'));var client=jayson[_0x5978('0xb')][_0x5978('0xc')]({'port':0x232a});config[_0x5978('0xd')]=_[_0x5978('0xe')](config[_0x5978('0xd')],{'host':_0x5978('0xf'),'port':0x18eb});var socket=require(_0x5978('0x10'))(new Redis(config[_0x5978('0xd')]));require(_0x5978('0x11'))[_0x5978('0x12')](socket);function respondWithRpcPromise(_0x306fbc,_0x40a9f4,_0x1dbdf5){return new BPromise(function(_0x5441c6,_0x56bd17){return client[_0x5978('0x13')](_0x306fbc,_0x1dbdf5)[_0x5978('0x14')](function(_0x523de8){logger['info'](_0x5978('0x15'),_0x40a9f4,_0x5978('0x16'));logger[_0x5978('0x17')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x40a9f4,'request\x20sent',JSON['stringify'](_0x523de8));if(_0x523de8[_0x5978('0x18')]){if(_0x523de8[_0x5978('0x18')][_0x5978('0x19')]===0x1f4){logger['error'](_0x5978('0x15'),_0x40a9f4,_0x523de8[_0x5978('0x18')][_0x5978('0x1a')]);return _0x56bd17(_0x523de8[_0x5978('0x18')][_0x5978('0x1a')]);}logger['error'](_0x5978('0x15'),_0x40a9f4,_0x523de8[_0x5978('0x18')][_0x5978('0x1a')]);return _0x5441c6(_0x523de8['error'][_0x5978('0x1a')]);}else{logger[_0x5978('0x1b')]('DashboardItem,\x20%s,\x20%s',_0x40a9f4,_0x5978('0x16'));_0x5441c6(_0x523de8[_0x5978('0x1c')]['message']);}})[_0x5978('0x1d')](function(_0x458664){logger[_0x5978('0x18')](_0x5978('0x15'),_0x40a9f4,_0x458664);_0x56bd17(_0x458664);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 464bbe3..2a01e4d 100644 --- a/server/api/dashboardItem/dashboardItem.socket.js +++ b/server/api/dashboardItem/dashboardItem.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee31=['register','length','dashboardItem:','./dashboardItem.events','save','removeListener'];(function(_0x4946f9,_0x4694e3){var _0x7d8ec1=function(_0x550b4e){while(--_0x550b4e){_0x4946f9['push'](_0x4946f9['shift']());}};_0x7d8ec1(++_0x4694e3);}(_0xee31,0x189));var _0x1ee3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xee31[_0x57b54c];return _0x59cc19;};'use strict';var DashboardItemEvents=require(_0x1ee3('0x0'));var events=[_0x1ee3('0x1'),'remove','update'];function createListener(_0x573c09,_0x440563){return function(_0x351b62){_0x440563['emit'](_0x573c09,_0x351b62);};}function removeListener(_0x507a6a,_0x33c1ae){return function(){DashboardItemEvents[_0x1ee3('0x2')](_0x507a6a,_0x33c1ae);};}exports[_0x1ee3('0x3')]=function(_0x43ddb0){for(var _0x52f12a=0x0,_0x160eba=events[_0x1ee3('0x4')];_0x52f12a<_0x160eba;_0x52f12a++){var _0x1945ad=events[_0x52f12a];var _0x3ca334=createListener(_0x1ee3('0x5')+_0x1945ad,_0x43ddb0);DashboardItemEvents['on'](_0x1945ad,_0x3ca334);}}; \ No newline at end of file +var _0x7926=['./dashboardItem.events','save','remove','update','emit','register','length'];(function(_0xcab78a,_0x4dcb3b){var _0x18c1ca=function(_0x508b90){while(--_0x508b90){_0xcab78a['push'](_0xcab78a['shift']());}};_0x18c1ca(++_0x4dcb3b);}(_0x7926,0x134));var _0x6792=function(_0x52441d,_0x23ad5a){_0x52441d=_0x52441d-0x0;var _0x13a0a4=_0x7926[_0x52441d];return _0x13a0a4;};'use strict';var DashboardItemEvents=require(_0x6792('0x0'));var events=[_0x6792('0x1'),_0x6792('0x2'),_0x6792('0x3')];function createListener(_0x1afdad,_0x43f7d1){return function(_0x28ce7f){_0x43f7d1[_0x6792('0x4')](_0x1afdad,_0x28ce7f);};}function removeListener(_0x59197f,_0x4501a7){return function(){DashboardItemEvents['removeListener'](_0x59197f,_0x4501a7);};}exports[_0x6792('0x5')]=function(_0x24aa99){for(var _0x21d755=0x0,_0x45c445=events[_0x6792('0x6')];_0x21d755<_0x45c445;_0x21d755++){var _0x32277c=events[_0x21d755];var _0x3a23d8=createListener('dashboardItem:'+_0x32277c,_0x24aa99);DashboardItemEvents['on'](_0x32277c,_0x3a23d8);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 7ac91e8..af9a839 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e6f=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x141a3b,_0x45b0a3){var _0x2585be=function(_0x335c75){while(--_0x335c75){_0x141a3b['push'](_0x141a3b['shift']());}};_0x2585be(++_0x45b0a3);}(_0x8e6f,0x100));var _0xf8e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e6f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf8e6('0x0'));var util=require('util');var path=require(_0xf8e6('0x1'));var timeout=require('connect-timeout');var express=require(_0xf8e6('0x2'));var router=express['Router']();var fs_extra=require(_0xf8e6('0x3'));var auth=require(_0xf8e6('0x4'));var interaction=require(_0xf8e6('0x5'));var config=require(_0xf8e6('0x6'));var controller=require(_0xf8e6('0x7'));router[_0xf8e6('0x8')](_0xf8e6('0x9'),auth[_0xf8e6('0xa')](),controller[_0xf8e6('0xb')]);router[_0xf8e6('0xc')]('/',auth[_0xf8e6('0xa')](),controller[_0xf8e6('0xd')]);router[_0xf8e6('0xe')](_0xf8e6('0x9'),auth[_0xf8e6('0xa')](),controller[_0xf8e6('0xf')]);router[_0xf8e6('0x10')](_0xf8e6('0x9'),auth['isAuthenticated'](),controller[_0xf8e6('0x11')]);module[_0xf8e6('0x12')]=router; \ No newline at end of file +var _0x0aff=['create','put','isAuthenticated','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','./dashboardItem.controller','/:id','show'];(function(_0x399ecd,_0x1068c3){var _0x4e5421=function(_0x8aadff){while(--_0x8aadff){_0x399ecd['push'](_0x399ecd['shift']());}};_0x4e5421(++_0x1068c3);}(_0x0aff,0xab));var _0xf0af=function(_0x25a45a,_0x156e4b){_0x25a45a=_0x25a45a-0x0;var _0x237f87=_0x0aff[_0x25a45a];return _0x237f87;};'use strict';var multer=require(_0xf0af('0x0'));var util=require('util');var path=require(_0xf0af('0x1'));var timeout=require(_0xf0af('0x2'));var express=require(_0xf0af('0x3'));var router=express[_0xf0af('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf0af('0x5'));var config=require('../../config/environment');var controller=require(_0xf0af('0x6'));router['get'](_0xf0af('0x7'),auth['isAuthenticated'](),controller[_0xf0af('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf0af('0x9')]);router[_0xf0af('0xa')](_0xf0af('0x7'),auth[_0xf0af('0xb')](),controller[_0xf0af('0xc')]);router[_0xf0af('0xd')](_0xf0af('0x7'),auth[_0xf0af('0xb')](),controller[_0xf0af('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 0b39e9e..bac28a8 100644 --- a/server/api/disposition/disposition.attributes.js +++ b/server/api/disposition/disposition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe34d=['first','second','third','sequelize','exports','STRING','ENUM'];(function(_0x3d83fb,_0x33908e){var _0x4891a5=function(_0x4cbbc6){while(--_0x4cbbc6){_0x3d83fb['push'](_0x3d83fb['shift']());}};_0x4891a5(++_0x33908e);}(_0xe34d,0x65));var _0xde34=function(_0xe0c178,_0xe313ee){_0xe0c178=_0xe0c178-0x0;var _0x4839a1=_0xe34d[_0xe0c178];return _0x4839a1;};'use strict';var Sequelize=require(_0xde34('0x0'));module[_0xde34('0x1')]={'name':{'type':Sequelize[_0xde34('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xde34('0x3')](_0xde34('0x4'),_0xde34('0x5'),_0xde34('0x6')),'allowNull':![],'defaultValue':_0xde34('0x4')},'description':{'type':Sequelize[_0xde34('0x2')]}}; \ No newline at end of file +var _0xc0d0=['sequelize','STRING','ENUM','first','second','third'];(function(_0x2a11e0,_0x318b4b){var _0xed89fe=function(_0x45148e){while(--_0x45148e){_0x2a11e0['push'](_0x2a11e0['shift']());}};_0xed89fe(++_0x318b4b);}(_0xc0d0,0x17a));var _0x0c0d=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0xc0d0[_0x5f4cd7];return _0x47c93f;};'use strict';var Sequelize=require(_0x0c0d('0x0'));module['exports']={'name':{'type':Sequelize[_0x0c0d('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x0c0d('0x2')](_0x0c0d('0x3'),_0x0c0d('0x4'),_0x0c0d('0x5')),'allowNull':![],'defaultValue':_0x0c0d('0x3')},'description':{'type':Sequelize[_0x0c0d('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index fe87d6a..b7a0c4d 100644 --- a/server/api/disposition/disposition.controller.js +++ b/server/api/disposition/disposition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecb2=['sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','Dispositions','UserProfileResource','destroy','end','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','get','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','fast-json-patch','bluebird','mustache','util','path'];(function(_0x840016,_0x3325c6){var _0x34ba16=function(_0x3d12a0){while(--_0x3d12a0){_0x840016['push'](_0x840016['shift']());}};_0x34ba16(++_0x3325c6);}(_0xecb2,0xf6));var _0x2ecb=function(_0x4ae710,_0x16c191){_0x4ae710=_0x4ae710-0x0;var _0xa2758e=_0xecb2[_0x4ae710];return _0xa2758e;};'use strict';var emlformat=require(_0x2ecb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2ecb('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ecb('0x2'));var Mustache=require(_0x2ecb('0x3'));var util=require(_0x2ecb('0x4'));var path=require(_0x2ecb('0x5'));var sox=require(_0x2ecb('0x6'));var csv=require(_0x2ecb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ecb('0x8'));var crypto=require(_0x2ecb('0x9'));var jsforce=require(_0x2ecb('0xa'));var deskjs=require(_0x2ecb('0xb'));var toCsv=require(_0x2ecb('0x7'));var querystring=require('querystring');var Papa=require(_0x2ecb('0xc'));var Redis=require(_0x2ecb('0xd'));var authService=require(_0x2ecb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2ecb('0xf'));var hardwareService=require(_0x2ecb('0x10'));var logger=require(_0x2ecb('0x11'))(_0x2ecb('0x12'));var utils=require(_0x2ecb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2ecb('0x14'));var db=require(_0x2ecb('0x15'))['db'];function respondWithStatusCode(_0x3d74b3,_0x29cb3d){_0x29cb3d=_0x29cb3d||0xcc;return function(_0x59568c){if(_0x59568c){return _0x3d74b3[_0x2ecb('0x16')](_0x29cb3d);}return _0x3d74b3[_0x2ecb('0x17')](_0x29cb3d)['end']();};}function respondWithResult(_0x10bc58,_0x234741){_0x234741=_0x234741||0xc8;return function(_0x48505e){if(_0x48505e){return _0x10bc58[_0x2ecb('0x17')](_0x234741)[_0x2ecb('0x18')](_0x48505e);}};}function respondWithFilteredResult(_0x121f29,_0x3fda3b){return function(_0xe429aa){if(_0xe429aa){var _0x37ea40=typeof _0x3fda3b[_0x2ecb('0x19')]===_0x2ecb('0x1a')&&typeof _0x3fda3b[_0x2ecb('0x1b')]==='undefined';var _0x1c3e62=_0xe429aa[_0x2ecb('0x1c')];var _0x5a1d41=_0x37ea40?0x0:_0x3fda3b[_0x2ecb('0x19')];var _0x4c17cf=_0x37ea40?_0xe429aa[_0x2ecb('0x1c')]:_0x3fda3b[_0x2ecb('0x19')]+_0x3fda3b[_0x2ecb('0x1b')];var _0x3101fa;if(_0x4c17cf>=_0x1c3e62){_0x4c17cf=_0x1c3e62;_0x3101fa=0xc8;}else{_0x3101fa=0xce;}_0x121f29[_0x2ecb('0x17')](_0x3101fa);return _0x121f29[_0x2ecb('0x1d')](_0x2ecb('0x1e'),_0x5a1d41+'-'+_0x4c17cf+'/'+_0x1c3e62)['json'](_0xe429aa);}return null;};}function patchUpdates(_0x8ff004){return function(_0x3aaaae){try{jsonpatch[_0x2ecb('0x1f')](_0x3aaaae,_0x8ff004,!![]);}catch(_0x4c8330){return BPromise[_0x2ecb('0x20')](_0x4c8330);}return _0x3aaaae[_0x2ecb('0x21')]();};}function saveUpdates(_0x4e3d3c,_0x5b9d50){return function(_0x2db610){if(_0x2db610){return _0x2db610['update'](_0x4e3d3c)[_0x2ecb('0x22')](function(_0x2a1834){return _0x2a1834;});}return null;};}function removeEntity(_0xba8379,_0x296ae0){return function(_0x1ff315){if(_0x1ff315){return _0x1ff315['destroy']()['then'](function(){var _0x2e38ee=_0x1ff315['get']({'plain':!![]});var _0x3fa13f=_0x2ecb('0x23');return db[_0x2ecb('0x24')][_0x2ecb('0x25')]({'where':{'type':_0x3fa13f,'resourceId':_0x2e38ee['id']}})[_0x2ecb('0x22')](function(){return _0x1ff315;});})[_0x2ecb('0x22')](function(){_0xba8379[_0x2ecb('0x17')](0xcc)[_0x2ecb('0x26')]();});}};}function handleEntityNotFound(_0x28ee7a,_0x1e2df4){return function(_0x32e88a){if(!_0x32e88a){_0x28ee7a[_0x2ecb('0x16')](0x194);}return _0x32e88a;};}function handleError(_0x45c0ac,_0x211e0f){_0x211e0f=_0x211e0f||0x1f4;return function(_0x75c8cb){logger[_0x2ecb('0x27')](_0x75c8cb[_0x2ecb('0x28')]);if(_0x75c8cb[_0x2ecb('0x29')]){delete _0x75c8cb[_0x2ecb('0x29')];}_0x45c0ac[_0x2ecb('0x17')](_0x211e0f)[_0x2ecb('0x2a')](_0x75c8cb);};}exports[_0x2ecb('0x2b')]=function(_0x4cfa56,_0x52f9f4){var _0x354734={},_0x3c97d1={},_0x8fad28={'count':0x0,'rows':[]};var _0x323328=_['map'](db[_0x2ecb('0x2c')][_0x2ecb('0x2d')],function(_0x3142b0){return{'name':_0x3142b0[_0x2ecb('0x2e')],'type':_0x3142b0[_0x2ecb('0x2f')][_0x2ecb('0x30')]};});_0x3c97d1['model']=_[_0x2ecb('0x31')](_0x323328,'name');_0x3c97d1[_0x2ecb('0x32')]=_[_0x2ecb('0x33')](_0x4cfa56[_0x2ecb('0x32')]);_0x3c97d1[_0x2ecb('0x34')]=_[_0x2ecb('0x35')](_0x3c97d1[_0x2ecb('0x36')],_0x3c97d1[_0x2ecb('0x32')]);_0x354734[_0x2ecb('0x37')]=_[_0x2ecb('0x35')](_0x3c97d1['model'],qs[_0x2ecb('0x38')](_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x38')]));_0x354734['attributes']=_0x354734[_0x2ecb('0x37')][_0x2ecb('0x39')]?_0x354734[_0x2ecb('0x37')]:_0x3c97d1['model'];if(!_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x3a')](_0x2ecb('0x3b'))){_0x354734[_0x2ecb('0x1b')]=qs[_0x2ecb('0x1b')](_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x1b')]);_0x354734[_0x2ecb('0x19')]=qs[_0x2ecb('0x19')](_0x4cfa56[_0x2ecb('0x32')]['offset']);}_0x354734[_0x2ecb('0x3c')]=qs['sort'](_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x3d')]);_0x354734[_0x2ecb('0x3e')]=qs[_0x2ecb('0x34')](_[_0x2ecb('0x3f')](_0x4cfa56[_0x2ecb('0x32')],_0x3c97d1['filters']),_0x323328);if(_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x40')]){_0x354734[_0x2ecb('0x3e')]=_[_0x2ecb('0x41')](_0x354734[_0x2ecb('0x3e')],{'$or':_[_0x2ecb('0x31')](_0x323328,function(_0x36f308){if(_0x36f308[_0x2ecb('0x2f')]!==_0x2ecb('0x42')){var _0x443bfe={};_0x443bfe[_0x36f308[_0x2ecb('0x29')]]={'$like':'%'+_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x40')]+'%'};return _0x443bfe;}})});}_0x354734=_['merge']({},_0x354734,_0x4cfa56[_0x2ecb('0x43')]);var _0x5944a0={'where':_0x354734['where']};return db[_0x2ecb('0x2c')][_0x2ecb('0x1c')](_0x5944a0)[_0x2ecb('0x22')](function(_0x818b70){_0x8fad28['count']=_0x818b70;if(_0x4cfa56['query']['includeAll']){_0x354734[_0x2ecb('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x2ecb('0x45')](_0x354734);})[_0x2ecb('0x22')](function(_0x312b35){_0x8fad28[_0x2ecb('0x46')]=_0x312b35;return _0x8fad28;})[_0x2ecb('0x22')](respondWithFilteredResult(_0x52f9f4,_0x354734))[_0x2ecb('0x47')](handleError(_0x52f9f4,null));};exports[_0x2ecb('0x48')]=function(_0xfcdbbb,_0x35001f){var _0x227c25={'raw':!![],'where':{'id':_0xfcdbbb[_0x2ecb('0x49')]['id']}},_0xaa3890={};_0xaa3890['model']=_[_0x2ecb('0x33')](db[_0x2ecb('0x2c')]['rawAttributes']);_0xaa3890[_0x2ecb('0x32')]=_[_0x2ecb('0x33')](_0xfcdbbb[_0x2ecb('0x32')]);_0xaa3890['filters']=_['intersection'](_0xaa3890[_0x2ecb('0x36')],_0xaa3890[_0x2ecb('0x32')]);_0x227c25[_0x2ecb('0x37')]=_[_0x2ecb('0x35')](_0xaa3890['model'],qs[_0x2ecb('0x38')](_0xfcdbbb[_0x2ecb('0x32')][_0x2ecb('0x38')]));_0x227c25[_0x2ecb('0x37')]=_0x227c25[_0x2ecb('0x37')]['length']?_0x227c25[_0x2ecb('0x37')]:_0xaa3890[_0x2ecb('0x36')];if(_0xfcdbbb[_0x2ecb('0x32')][_0x2ecb('0x4a')]){_0x227c25['include']=[{'all':!![]}];}_0x227c25=_[_0x2ecb('0x41')]({},_0x227c25,_0xfcdbbb['options']);return db[_0x2ecb('0x2c')][_0x2ecb('0x4b')](_0x227c25)[_0x2ecb('0x22')](handleEntityNotFound(_0x35001f,null))['then'](respondWithResult(_0x35001f,null))[_0x2ecb('0x47')](handleError(_0x35001f,null));};exports[_0x2ecb('0x4c')]=function(_0x5f5350,_0x3afd6d){return db[_0x2ecb('0x2c')]['create'](_0x5f5350['body'],{})[_0x2ecb('0x22')](function(_0x177ce2){var _0x3f5dd3=_0x5f5350['user'][_0x2ecb('0x4d')]({'plain':!![]});if(!_0x3f5dd3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f5dd3['role']===_0x2ecb('0x4e')){var _0x273286=_0x177ce2[_0x2ecb('0x4d')]({'plain':!![]});var _0x4d9f59=_0x2ecb('0x23');return db['UserProfileSection'][_0x2ecb('0x4b')]({'where':{'name':_0x4d9f59,'userProfileId':_0x3f5dd3[_0x2ecb('0x4f')]},'raw':!![]})[_0x2ecb('0x22')](function(_0x1f8a45){if(_0x1f8a45&&_0x1f8a45[_0x2ecb('0x50')]===0x0){return db['UserProfileResource'][_0x2ecb('0x4c')]({'name':_0x273286['name'],'resourceId':_0x273286['id'],'type':_0x1f8a45['name'],'sectionId':_0x1f8a45['id']},{})[_0x2ecb('0x22')](function(){return _0x177ce2;});}else{return _0x177ce2;}})[_0x2ecb('0x47')](function(_0x32af90){logger[_0x2ecb('0x27')](_0x2ecb('0x51'),_0x32af90);throw _0x32af90;});}return _0x177ce2;})[_0x2ecb('0x22')](respondWithResult(_0x3afd6d,0xc9))[_0x2ecb('0x47')](handleError(_0x3afd6d,null));};exports[_0x2ecb('0x52')]=function(_0x2d4c33,_0x68917f){if(_0x2d4c33[_0x2ecb('0x53')]['id']){delete _0x2d4c33[_0x2ecb('0x53')]['id'];}return db['Disposition'][_0x2ecb('0x4b')]({'where':{'id':_0x2d4c33[_0x2ecb('0x49')]['id']}})[_0x2ecb('0x22')](handleEntityNotFound(_0x68917f,null))[_0x2ecb('0x22')](saveUpdates(_0x2d4c33['body'],null))[_0x2ecb('0x22')](respondWithResult(_0x68917f,null))[_0x2ecb('0x47')](handleError(_0x68917f,null));};exports[_0x2ecb('0x25')]=function(_0x5f4586,_0x4b18b1){return db['Disposition'][_0x2ecb('0x4b')]({'where':{'id':_0x5f4586[_0x2ecb('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b18b1,null))[_0x2ecb('0x22')](removeEntity(_0x4b18b1,null))[_0x2ecb('0x47')](handleError(_0x4b18b1,null));}; \ No newline at end of file +var _0x673f=['nolimit','sort','where','filters','pick','filter','options','include','rows','catch','show','params','intersection','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','Dispositions','then','error','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','query','keys','attributes','fields','hasOwnProperty'];(function(_0x2d86ca,_0x3e0323){var _0xae8b2a=function(_0xc28dba){while(--_0xc28dba){_0x2d86ca['push'](_0x2d86ca['shift']());}};_0xae8b2a(++_0x3e0323);}(_0x673f,0x1b8));var _0xf673=function(_0x2d6119,_0x125fce){_0x2d6119=_0x2d6119-0x0;var _0x1325cd=_0x673f[_0x2d6119];return _0x1325cd;};'use strict';var emlformat=require(_0xf673('0x0'));var rimraf=require(_0xf673('0x1'));var zipdir=require(_0xf673('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf673('0x3'));var moment=require('moment');var BPromise=require(_0xf673('0x4'));var Mustache=require('mustache');var util=require(_0xf673('0x5'));var path=require(_0xf673('0x6'));var sox=require(_0xf673('0x7'));var csv=require(_0xf673('0x8'));var ejs=require(_0xf673('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf673('0xa'));var jsforce=require(_0xf673('0xb'));var deskjs=require(_0xf673('0xc'));var toCsv=require(_0xf673('0x8'));var querystring=require(_0xf673('0xd'));var Papa=require(_0xf673('0xe'));var Redis=require(_0xf673('0xf'));var authService=require(_0xf673('0x10'));var qs=require(_0xf673('0x11'));var as=require(_0xf673('0x12'));var hardwareService=require(_0xf673('0x13'));var logger=require('../../config/logger')(_0xf673('0x14'));var utils=require(_0xf673('0x15'));var config=require(_0xf673('0x16'));var licenseUtil=require(_0xf673('0x17'));var db=require(_0xf673('0x18'))['db'];function respondWithStatusCode(_0x3f442f,_0x31d68f){_0x31d68f=_0x31d68f||0xcc;return function(_0xc3eb50){if(_0xc3eb50){return _0x3f442f[_0xf673('0x19')](_0x31d68f);}return _0x3f442f[_0xf673('0x1a')](_0x31d68f)[_0xf673('0x1b')]();};}function respondWithResult(_0x25c0f,_0x2104ce){_0x2104ce=_0x2104ce||0xc8;return function(_0xe4f075){if(_0xe4f075){return _0x25c0f[_0xf673('0x1a')](_0x2104ce)[_0xf673('0x1c')](_0xe4f075);}};}function respondWithFilteredResult(_0x2761c0,_0x2fc20e){return function(_0x35ef69){if(_0x35ef69){var _0x21eda3=typeof _0x2fc20e[_0xf673('0x1d')]===_0xf673('0x1e')&&typeof _0x2fc20e[_0xf673('0x1f')]===_0xf673('0x1e');var _0x1fc4b6=_0x35ef69[_0xf673('0x20')];var _0x53cc6c=_0x21eda3?0x0:_0x2fc20e['offset'];var _0x4d19ed=_0x21eda3?_0x35ef69[_0xf673('0x20')]:_0x2fc20e[_0xf673('0x1d')]+_0x2fc20e[_0xf673('0x1f')];var _0x2c3199;if(_0x4d19ed>=_0x1fc4b6){_0x4d19ed=_0x1fc4b6;_0x2c3199=0xc8;}else{_0x2c3199=0xce;}_0x2761c0[_0xf673('0x1a')](_0x2c3199);return _0x2761c0[_0xf673('0x21')](_0xf673('0x22'),_0x53cc6c+'-'+_0x4d19ed+'/'+_0x1fc4b6)['json'](_0x35ef69);}return null;};}function patchUpdates(_0x2fb992){return function(_0x37126b){try{jsonpatch[_0xf673('0x23')](_0x37126b,_0x2fb992,!![]);}catch(_0x21f377){return BPromise[_0xf673('0x24')](_0x21f377);}return _0x37126b[_0xf673('0x25')]();};}function saveUpdates(_0x4f1de7,_0x3fe0ea){return function(_0x35a41c){if(_0x35a41c){return _0x35a41c['update'](_0x4f1de7)['then'](function(_0x16bb19){return _0x16bb19;});}return null;};}function removeEntity(_0x5d8966,_0x139ed6){return function(_0x167444){if(_0x167444){return _0x167444[_0xf673('0x26')]()['then'](function(){var _0x551a02=_0x167444[_0xf673('0x27')]({'plain':!![]});var _0x30bbbc=_0xf673('0x28');return db['UserProfileResource'][_0xf673('0x26')]({'where':{'type':_0x30bbbc,'resourceId':_0x551a02['id']}})[_0xf673('0x29')](function(){return _0x167444;});})[_0xf673('0x29')](function(){_0x5d8966[_0xf673('0x1a')](0xcc)[_0xf673('0x1b')]();});}};}function handleEntityNotFound(_0x286384,_0x223577){return function(_0x2c6757){if(!_0x2c6757){_0x286384['sendStatus'](0x194);}return _0x2c6757;};}function handleError(_0x125db7,_0x5909d1){_0x5909d1=_0x5909d1||0x1f4;return function(_0x42f9d3){logger[_0xf673('0x2a')](_0x42f9d3[_0xf673('0x2b')]);if(_0x42f9d3[_0xf673('0x2c')]){delete _0x42f9d3['name'];}_0x125db7['status'](_0x5909d1)[_0xf673('0x2d')](_0x42f9d3);};}exports[_0xf673('0x2e')]=function(_0x11673c,_0x5c2cc7){var _0x23ac3b={},_0x159b55={},_0x1abdfb={'count':0x0,'rows':[]};var _0x29ff43=_[_0xf673('0x2f')](db[_0xf673('0x30')][_0xf673('0x31')],function(_0x21425b){return{'name':_0x21425b['fieldName'],'type':_0x21425b[_0xf673('0x32')][_0xf673('0x33')]};});_0x159b55[_0xf673('0x34')]=_[_0xf673('0x2f')](_0x29ff43,_0xf673('0x2c'));_0x159b55[_0xf673('0x35')]=_[_0xf673('0x36')](_0x11673c['query']);_0x159b55['filters']=_['intersection'](_0x159b55[_0xf673('0x34')],_0x159b55[_0xf673('0x35')]);_0x23ac3b[_0xf673('0x37')]=_['intersection'](_0x159b55[_0xf673('0x34')],qs['fields'](_0x11673c['query'][_0xf673('0x38')]));_0x23ac3b[_0xf673('0x37')]=_0x23ac3b[_0xf673('0x37')]['length']?_0x23ac3b['attributes']:_0x159b55[_0xf673('0x34')];if(!_0x11673c[_0xf673('0x35')][_0xf673('0x39')](_0xf673('0x3a'))){_0x23ac3b['limit']=qs[_0xf673('0x1f')](_0x11673c['query'][_0xf673('0x1f')]);_0x23ac3b[_0xf673('0x1d')]=qs[_0xf673('0x1d')](_0x11673c[_0xf673('0x35')][_0xf673('0x1d')]);}_0x23ac3b['order']=qs[_0xf673('0x3b')](_0x11673c[_0xf673('0x35')][_0xf673('0x3b')]);_0x23ac3b[_0xf673('0x3c')]=qs[_0xf673('0x3d')](_[_0xf673('0x3e')](_0x11673c['query'],_0x159b55[_0xf673('0x3d')]),_0x29ff43);if(_0x11673c[_0xf673('0x35')][_0xf673('0x3f')]){_0x23ac3b['where']=_['merge'](_0x23ac3b[_0xf673('0x3c')],{'$or':_[_0xf673('0x2f')](_0x29ff43,function(_0x976f53){if(_0x976f53[_0xf673('0x32')]!=='VIRTUAL'){var _0x18c9ba={};_0x18c9ba[_0x976f53['name']]={'$like':'%'+_0x11673c[_0xf673('0x35')][_0xf673('0x3f')]+'%'};return _0x18c9ba;}})});}_0x23ac3b=_['merge']({},_0x23ac3b,_0x11673c[_0xf673('0x40')]);var _0x6b3d82={'where':_0x23ac3b[_0xf673('0x3c')]};return db['Disposition'][_0xf673('0x20')](_0x6b3d82)['then'](function(_0x496300){_0x1abdfb[_0xf673('0x20')]=_0x496300;if(_0x11673c[_0xf673('0x35')]['includeAll']){_0x23ac3b[_0xf673('0x41')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x23ac3b);})[_0xf673('0x29')](function(_0x125b89){_0x1abdfb[_0xf673('0x42')]=_0x125b89;return _0x1abdfb;})['then'](respondWithFilteredResult(_0x5c2cc7,_0x23ac3b))[_0xf673('0x43')](handleError(_0x5c2cc7,null));};exports[_0xf673('0x44')]=function(_0x7580dd,_0xf721b3){var _0x1df809={'raw':!![],'where':{'id':_0x7580dd[_0xf673('0x45')]['id']}},_0x5cf846={};_0x5cf846[_0xf673('0x34')]=_['keys'](db[_0xf673('0x30')]['rawAttributes']);_0x5cf846['query']=_[_0xf673('0x36')](_0x7580dd[_0xf673('0x35')]);_0x5cf846[_0xf673('0x3d')]=_[_0xf673('0x46')](_0x5cf846[_0xf673('0x34')],_0x5cf846[_0xf673('0x35')]);_0x1df809[_0xf673('0x37')]=_['intersection'](_0x5cf846[_0xf673('0x34')],qs['fields'](_0x7580dd[_0xf673('0x35')][_0xf673('0x38')]));_0x1df809[_0xf673('0x37')]=_0x1df809['attributes'][_0xf673('0x47')]?_0x1df809[_0xf673('0x37')]:_0x5cf846[_0xf673('0x34')];if(_0x7580dd[_0xf673('0x35')][_0xf673('0x48')]){_0x1df809[_0xf673('0x41')]=[{'all':!![]}];}_0x1df809=_[_0xf673('0x49')]({},_0x1df809,_0x7580dd[_0xf673('0x40')]);return db[_0xf673('0x30')][_0xf673('0x4a')](_0x1df809)[_0xf673('0x29')](handleEntityNotFound(_0xf721b3,null))[_0xf673('0x29')](respondWithResult(_0xf721b3,null))[_0xf673('0x43')](handleError(_0xf721b3,null));};exports[_0xf673('0x4b')]=function(_0x51910a,_0x316ba2){return db['Disposition'][_0xf673('0x4b')](_0x51910a[_0xf673('0x4c')],{})[_0xf673('0x29')](function(_0x2ec9b8){var _0x4745bb=_0x51910a[_0xf673('0x4d')][_0xf673('0x27')]({'plain':!![]});if(!_0x4745bb)throw new Error(_0xf673('0x4e'));if(_0x4745bb['role']===_0xf673('0x4d')){var _0x4c9150=_0x2ec9b8[_0xf673('0x27')]({'plain':!![]});var _0x4648b6=_0xf673('0x28');return db['UserProfileSection'][_0xf673('0x4a')]({'where':{'name':_0x4648b6,'userProfileId':_0x4745bb[_0xf673('0x4f')]},'raw':!![]})[_0xf673('0x29')](function(_0x56d14c){if(_0x56d14c&&_0x56d14c[_0xf673('0x50')]===0x0){return db[_0xf673('0x51')][_0xf673('0x4b')]({'name':_0x4c9150[_0xf673('0x2c')],'resourceId':_0x4c9150['id'],'type':_0x56d14c[_0xf673('0x2c')],'sectionId':_0x56d14c['id']},{})[_0xf673('0x29')](function(){return _0x2ec9b8;});}else{return _0x2ec9b8;}})[_0xf673('0x43')](function(_0x24c9fe){logger[_0xf673('0x2a')](_0xf673('0x52'),_0x24c9fe);throw _0x24c9fe;});}return _0x2ec9b8;})[_0xf673('0x29')](respondWithResult(_0x316ba2,0xc9))['catch'](handleError(_0x316ba2,null));};exports['update']=function(_0x5c13c3,_0xee3703){if(_0x5c13c3[_0xf673('0x4c')]['id']){delete _0x5c13c3[_0xf673('0x4c')]['id'];}return db[_0xf673('0x30')][_0xf673('0x4a')]({'where':{'id':_0x5c13c3[_0xf673('0x45')]['id']}})['then'](handleEntityNotFound(_0xee3703,null))[_0xf673('0x29')](saveUpdates(_0x5c13c3[_0xf673('0x4c')],null))[_0xf673('0x29')](respondWithResult(_0xee3703,null))[_0xf673('0x43')](handleError(_0xee3703,null));};exports[_0xf673('0x26')]=function(_0x334e5b,_0x17cd51){return db[_0xf673('0x30')][_0xf673('0x4a')]({'where':{'id':_0x334e5b[_0xf673('0x45')]['id']}})[_0xf673('0x29')](handleEntityNotFound(_0x17cd51,null))[_0xf673('0x29')](removeEntity(_0x17cd51,null))[_0xf673('0x43')](handleError(_0x17cd51,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a17be6c..52d852c 100644 --- a/server/api/disposition/disposition.model.js +++ b/server/api/disposition/disposition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14d=['../../config/environment','exports','define','Disposition','tools_dispositions','ListId','name','ChatWebsiteId','name_mail','SmsAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x2ed296,_0x9be267){var _0x188f8b=function(_0x5c355f){while(--_0x5c355f){_0x2ed296['push'](_0x2ed296['shift']());}};_0x188f8b(++_0x9be267);}(_0xe14d,0xf5));var _0xde14=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xe14d[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require(_0xde14('0x4'));var BPromise=require('bluebird');var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require('./disposition.attributes');module[_0xde14('0x8')]=function(_0x12035e,_0x12d2ec){return _0x12035e[_0xde14('0x9')](_0xde14('0xa'),attributes,{'tableName':_0xde14('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0xde14('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0xde14('0xd'),_0xde14('0xe')]},{'unique':!![],'name':_0xde14('0xf'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0xde14('0xd'),_0xde14('0x10')]},{'unique':!![],'name':'name_fax','fields':['name',_0xde14('0x11')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xde14('0x12')]},{'unique':!![],'name':_0xde14('0x13'),'fields':['name',_0xde14('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2aad=['moment','bluebird','request-promise','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','WhatsappAccountId','../../config/logger'];(function(_0x19da68,_0x5e9f6f){var _0x44da35=function(_0x4d61f6){while(--_0x4d61f6){_0x19da68['push'](_0x19da68['shift']());}};_0x44da35(++_0x5e9f6f);}(_0x2aad,0x1e2));var _0xd2aa=function(_0x1567a6,_0x1d84c2){_0x1567a6=_0x1567a6-0x0;var _0x7527c8=_0x2aad[_0x1567a6];return _0x7527c8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd2aa('0x0'))('api');var moment=require(_0xd2aa('0x1'));var BPromise=require(_0xd2aa('0x2'));var rp=require(_0xd2aa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd2aa('0x4'));var attributes=require(_0xd2aa('0x5'));module[_0xd2aa('0x6')]=function(_0x5b3362,_0x271434){return _0x5b3362[_0xd2aa('0x7')](_0xd2aa('0x8'),attributes,{'tableName':_0xd2aa('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xd2aa('0xa'),'fields':[_0xd2aa('0xb'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xd2aa('0xb'),_0xd2aa('0xc')]},{'unique':!![],'name':_0xd2aa('0xd'),'fields':[_0xd2aa('0xb'),_0xd2aa('0xe')]},{'unique':!![],'name':_0xd2aa('0xf'),'fields':[_0xd2aa('0xb'),_0xd2aa('0x10')]},{'unique':!![],'name':_0xd2aa('0x11'),'fields':[_0xd2aa('0xb'),_0xd2aa('0x12')]},{'unique':!![],'name':_0xd2aa('0x13'),'fields':[_0xd2aa('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xd2aa('0xb'),_0xd2aa('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a96a3a7..6529a57 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5bbfed,_0x401853){var _0x584a1b=function(_0x4eec35){while(--_0x4eec35){_0x5bbfed['push'](_0x5bbfed['shift']());}};_0x584a1b(++_0x401853);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x126417,_0x344291){var _0x3ea35c=function(_0x1a8b12){while(--_0x1a8b12){_0x126417['push'](_0x126417['shift']());}};_0x3ea35c(++_0x344291);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 57c2211..4713fe2 100644 --- a/server/api/disposition/index.js +++ b/server/api/disposition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d7c=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0x5d7c,0xae));var _0xc5d7=function(_0x3cd774,_0x1c01b1){_0x3cd774=_0x3cd774-0x0;var _0x1f4922=_0x5d7c[_0x3cd774];return _0x1f4922;};'use strict';var multer=require(_0xc5d7('0x0'));var util=require(_0xc5d7('0x1'));var path=require(_0xc5d7('0x2'));var timeout=require(_0xc5d7('0x3'));var express=require('express');var router=express[_0xc5d7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc5d7('0x5'));var config=require(_0xc5d7('0x6'));var controller=require(_0xc5d7('0x7'));router[_0xc5d7('0x8')]('/',auth[_0xc5d7('0x9')](),controller[_0xc5d7('0xa')]);router['get'](_0xc5d7('0xb'),auth[_0xc5d7('0x9')](),controller[_0xc5d7('0xc')]);router[_0xc5d7('0xd')]('/',auth[_0xc5d7('0x9')](),controller[_0xc5d7('0xe')]);router[_0xc5d7('0xf')](_0xc5d7('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc5d7('0x10')]('/:id',auth[_0xc5d7('0x9')](),controller['destroy']);module[_0xc5d7('0x11')]=router; \ No newline at end of file +var _0x99d5=['index','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated'];(function(_0x2ea952,_0xb91b9e){var _0x2a5456=function(_0x188f41){while(--_0x188f41){_0x2ea952['push'](_0x2ea952['shift']());}};_0x2a5456(++_0xb91b9e);}(_0x99d5,0x77));var _0x599d=function(_0x2313ef,_0x55f489){_0x2313ef=_0x2313ef-0x0;var _0x4f4159=_0x99d5[_0x2313ef];return _0x4f4159;};'use strict';var multer=require(_0x599d('0x0'));var util=require(_0x599d('0x1'));var path=require(_0x599d('0x2'));var timeout=require(_0x599d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x599d('0x4'));var interaction=require(_0x599d('0x5'));var config=require('../../config/environment');var controller=require(_0x599d('0x6'));router[_0x599d('0x7')]('/',auth[_0x599d('0x8')](),controller[_0x599d('0x9')]);router['get'](_0x599d('0xa'),auth[_0x599d('0x8')](),controller[_0x599d('0xb')]);router[_0x599d('0xc')]('/',auth[_0x599d('0x8')](),controller['create']);router[_0x599d('0xd')](_0x599d('0xa'),auth[_0x599d('0x8')](),controller[_0x599d('0xe')]);router[_0x599d('0xf')](_0x599d('0xa'),auth[_0x599d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 02a5576..1008e07 100644 --- a/server/api/faxAccount/faxAccount.attributes.js +++ b/server/api/faxAccount/faxAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0a1=['4800','7200','9600','12000','14400','2400','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0xd81e3,_0x1d78bb){var _0x59d814=function(_0xec725d){while(--_0xec725d){_0xd81e3['push'](_0xd81e3['shift']());}};_0x59d814(++_0x1d78bb);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x275cf9,_0x307465){_0x275cf9=_0x275cf9-0x0;var _0x2dd275=_0xa0a1[_0x275cf9];return _0x2dd275;};'use strict';var Sequelize=require(_0x1a0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a0a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1a0a('0x1')]},'ecm':{'type':Sequelize[_0x1a0a('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x1a0a('0x1')],'defaultValue':_0x1a0a('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x1a0a('0x4')},'minrate':{'type':Sequelize[_0x1a0a('0x2')]('2400',_0x1a0a('0x5'),_0x1a0a('0x6'),_0x1a0a('0x7'),_0x1a0a('0x8'),_0x1a0a('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x1a0a('0x2')](_0x1a0a('0xa'),_0x1a0a('0x5'),'7200','9600','12000',_0x1a0a('0x9')),'defaultValue':_0x1a0a('0x9')},'modem':{'type':Sequelize[_0x1a0a('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1a0a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1a0a('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1a0a('0x2')](_0x1a0a('0xc'),_0x1a0a('0xd'),_0x1a0a('0xe'),_0x1a0a('0xf')),'defaultValue':_0x1a0a('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1a0a('0x10')],'defaultValue':function(){return _0x1a0a('0x11');}},'notificationSound':{'type':Sequelize[_0x1a0a('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a0a('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a0a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1a0a('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a0a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a0a('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1a0a('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1a0a('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x54bfbe){if(!_0x54bfbe)this[_0x1a0a('0x13')](_0x1a0a('0x14'),null);this[_0x1a0a('0x13')](_0x1a0a('0x15'),_0x54bfbe);}}}; \ No newline at end of file +var _0xc949=['mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xc949,0x181));var _0x9c94=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xc949[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x9c94('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c94('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c94('0x1')]},'ecm':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':_0x9c94('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x9c94('0x5')},'minrate':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0x6'),_0x9c94('0x7'),'7200',_0x9c94('0x8'),_0x9c94('0x9'),_0x9c94('0xa')),'defaultValue':_0x9c94('0x7')},'maxrate':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0x6'),_0x9c94('0x7'),_0x9c94('0xb'),_0x9c94('0x8'),_0x9c94('0x9'),'14400'),'defaultValue':_0x9c94('0xa')},'modem':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':_0x9c94('0xc')},'gateway':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9c94('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0xe'),_0x9c94('0xf'),_0x9c94('0x10'),_0x9c94('0x11')),'defaultValue':_0x9c94('0xe')},'key':{'type':Sequelize[_0x9c94('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9c94('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9c94('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c94('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9c94('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c94('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9c94('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9c94('0x13')],'defaultValue':![],'comment':_0x9c94('0x14'),'set':function(_0x4d9266){if(!_0x4d9266)this[_0x9c94('0x15')](_0x9c94('0x16'),null);this[_0x9c94('0x15')](_0x9c94('0x17'),_0x4d9266);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 1c6b6bf..c0cc26c 100644 --- a/server/api/faxAccount/faxAccount.controller.js +++ b/server/api/faxAccount/faxAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa459=['limit','count','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','addInteraction','FaxInteraction','CmContact','User','Owner','internal','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','maxrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','omit','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined'];(function(_0xd685e,_0x360045){var _0x5ef5e0=function(_0x37f4b3){while(--_0x37f4b3){_0xd685e['push'](_0xd685e['shift']());}};_0x5ef5e0(++_0x360045);}(_0xa459,0x95));var _0x9a45=function(_0x25a71f,_0x4814c8){_0x25a71f=_0x25a71f-0x0;var _0x5ddc15=_0xa459[_0x25a71f];return _0x5ddc15;};'use strict';var emlformat=require(_0x9a45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a45('0x1'));var jsonpatch=require(_0x9a45('0x2'));var rp=require(_0x9a45('0x3'));var moment=require('moment');var BPromise=require(_0x9a45('0x4'));var Mustache=require(_0x9a45('0x5'));var util=require('util');var path=require(_0x9a45('0x6'));var sox=require(_0x9a45('0x7'));var csv=require(_0x9a45('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a45('0x9'));var _=require(_0x9a45('0xa'));var squel=require(_0x9a45('0xb'));var crypto=require(_0x9a45('0xc'));var jsforce=require(_0x9a45('0xd'));var deskjs=require(_0x9a45('0xe'));var toCsv=require(_0x9a45('0x8'));var querystring=require(_0x9a45('0xf'));var Papa=require(_0x9a45('0x10'));var Redis=require(_0x9a45('0x11'));var authService=require(_0x9a45('0x12'));var qs=require(_0x9a45('0x13'));var as=require(_0x9a45('0x14'));var hardwareService=require(_0x9a45('0x15'));var logger=require(_0x9a45('0x16'))(_0x9a45('0x17'));var utils=require(_0x9a45('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9a45('0x19'));var db=require(_0x9a45('0x1a'))['db'];config[_0x9a45('0x1b')]=_[_0x9a45('0x1c')](config[_0x9a45('0x1b')],{'host':_0x9a45('0x1d'),'port':0x18eb});var socket=require(_0x9a45('0x1e'))(new Redis(config[_0x9a45('0x1b')]));require('./faxAccount.socket')[_0x9a45('0x1f')](socket);var jayson=require(_0x9a45('0x20'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x9a45('0x21')][_0x9a45('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3c1641,_0x5ef119,_0x475de7,_0xcf6070){return new BPromise(function(_0x445261,_0x58074d){var _0x429045=_0xcf6070||client;return _0x429045['request'](_0x3c1641,_0x475de7)[_0x9a45('0x23')](function(_0xc135fd){logger[_0x9a45('0x24')](_0x9a45('0x25'),_0x5ef119,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5ef119,_0x9a45('0x26'),JSON[_0x9a45('0x27')](_0xc135fd));if(_0xc135fd[_0x9a45('0x28')]){if(_0xc135fd[_0x9a45('0x28')][_0x9a45('0x29')]===0x1f4){logger[_0x9a45('0x28')]('FaxAccount,\x20%s,\x20%s',_0x5ef119,_0xc135fd[_0x9a45('0x28')][_0x9a45('0x2a')]);return _0x58074d(_0xc135fd[_0x9a45('0x28')][_0x9a45('0x2a')]);}logger['error'](_0x9a45('0x25'),_0x5ef119,_0xc135fd[_0x9a45('0x28')]['message']);return _0x445261(_0xc135fd[_0x9a45('0x28')][_0x9a45('0x2a')]);}else{logger[_0x9a45('0x24')]('FaxAccount,\x20%s,\x20%s',_0x5ef119,'request\x20sent');_0x445261(_0xc135fd[_0x9a45('0x2b')][_0x9a45('0x2a')]);}})['catch'](function(_0x108f97){logger[_0x9a45('0x28')](_0x9a45('0x25'),_0x5ef119,_0x108f97);_0x58074d(_0x108f97);});});}function respondWithStatusCode(_0x14093d,_0x42772e){_0x42772e=_0x42772e||0xcc;return function(_0xe643a0){if(_0xe643a0){return _0x14093d[_0x9a45('0x2c')](_0x42772e);}return _0x14093d[_0x9a45('0x2d')](_0x42772e)[_0x9a45('0x2e')]();};}function respondWithResult(_0x538a51,_0x33ecf4){_0x33ecf4=_0x33ecf4||0xc8;return function(_0x3a0825){if(_0x3a0825){return _0x538a51[_0x9a45('0x2d')](_0x33ecf4)[_0x9a45('0x2f')](_0x3a0825);}};}function respondWithFilteredResult(_0x57f965,_0x20894b){return function(_0x1e9c4b){if(_0x1e9c4b){var _0x3fd3b9=typeof _0x20894b[_0x9a45('0x30')]===_0x9a45('0x31')&&typeof _0x20894b[_0x9a45('0x32')]==='undefined';var _0x3e3114=_0x1e9c4b['count'];var _0x52c8cb=_0x3fd3b9?0x0:_0x20894b[_0x9a45('0x30')];var _0x1b503a=_0x3fd3b9?_0x1e9c4b[_0x9a45('0x33')]:_0x20894b[_0x9a45('0x30')]+_0x20894b[_0x9a45('0x32')];var _0x508191;if(_0x1b503a>=_0x3e3114){_0x1b503a=_0x3e3114;_0x508191=0xc8;}else{_0x508191=0xce;}_0x57f965[_0x9a45('0x2d')](_0x508191);return _0x57f965['set'](_0x9a45('0x34'),_0x52c8cb+'-'+_0x1b503a+'/'+_0x3e3114)['json'](_0x1e9c4b);}return null;};}function patchUpdates(_0x280b23){return function(_0x57aec9){try{jsonpatch[_0x9a45('0x35')](_0x57aec9,_0x280b23,!![]);}catch(_0x2fe2a2){return BPromise[_0x9a45('0x36')](_0x2fe2a2);}return _0x57aec9[_0x9a45('0x37')]();};}function saveUpdates(_0x4459dd,_0x28cf06){return function(_0x33995d){if(_0x33995d){return _0x33995d[_0x9a45('0x38')](_0x4459dd)[_0x9a45('0x23')](function(_0x2c5675){return _0x2c5675;});}return null;};}function removeEntity(_0x35600c,_0x336a09){return function(_0x42a4c2){if(_0x42a4c2){return _0x42a4c2[_0x9a45('0x39')]()[_0x9a45('0x23')](function(){var _0x40973c=_0x42a4c2[_0x9a45('0x3a')]({'plain':!![]});var _0x22002a=_0x9a45('0x3b');return db[_0x9a45('0x3c')][_0x9a45('0x39')]({'where':{'type':_0x22002a,'resourceId':_0x40973c['id']}})[_0x9a45('0x23')](function(){return _0x42a4c2;});})[_0x9a45('0x23')](function(){_0x35600c[_0x9a45('0x2d')](0xcc)[_0x9a45('0x2e')]();});}};}function handleEntityNotFound(_0x3d3499,_0x3b1eb5){return function(_0x45f113){if(!_0x45f113){_0x3d3499[_0x9a45('0x2c')](0x194);}return _0x45f113;};}function handleError(_0x11e1c4,_0x91812c){_0x91812c=_0x91812c||0x1f4;return function(_0x231d11){logger['error'](_0x231d11[_0x9a45('0x3d')]);if(_0x231d11[_0x9a45('0x3e')]){delete _0x231d11[_0x9a45('0x3e')];}_0x11e1c4[_0x9a45('0x2d')](_0x91812c)[_0x9a45('0x3f')](_0x231d11);};}exports[_0x9a45('0x40')]=function(_0x41a15b,_0x2c0c86){var _0x18df90={'include':[{'model':db[_0x9a45('0x41')],'as':_0x9a45('0x42')}]},_0x513f93={},_0x2e08d7={'count':0x0,'rows':[]};var _0x13a77b=_[_0x9a45('0x43')](db[_0x9a45('0x44')]['rawAttributes'],function(_0x245da0){return{'name':_0x245da0['fieldName'],'type':_0x245da0[_0x9a45('0x45')]['key']};});_0x513f93[_0x9a45('0x46')]=_[_0x9a45('0x43')](_0x13a77b,_0x9a45('0x3e'));_0x513f93[_0x9a45('0x47')]=_[_0x9a45('0x48')](_0x41a15b['query']);_0x513f93[_0x9a45('0x49')]=_[_0x9a45('0x4a')](_0x513f93[_0x9a45('0x46')],_0x513f93['query']);_0x18df90[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x513f93['model'],qs[_0x9a45('0x4c')](_0x41a15b[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x18df90[_0x9a45('0x4b')]=_0x18df90[_0x9a45('0x4b')]['length']?_0x18df90[_0x9a45('0x4b')]:_0x513f93[_0x9a45('0x46')];if(!_0x41a15b[_0x9a45('0x47')][_0x9a45('0x4d')](_0x9a45('0x4e'))){_0x18df90[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x41a15b[_0x9a45('0x47')]['limit']);_0x18df90[_0x9a45('0x30')]=qs[_0x9a45('0x30')](_0x41a15b['query'][_0x9a45('0x30')]);}_0x18df90[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x41a15b[_0x9a45('0x47')]['sort']);_0x18df90[_0x9a45('0x51')]=qs[_0x9a45('0x49')](_[_0x9a45('0x52')](_0x41a15b[_0x9a45('0x47')],_0x513f93[_0x9a45('0x49')]),_0x13a77b);if(_0x41a15b[_0x9a45('0x47')]['filter']){_0x18df90[_0x9a45('0x51')]=_[_0x9a45('0x53')](_0x18df90[_0x9a45('0x51')],{'$or':_[_0x9a45('0x43')](_0x13a77b,function(_0x15bedc){if(_0x15bedc['type']!==_0x9a45('0x54')){var _0x5b6939={};_0x5b6939[_0x15bedc[_0x9a45('0x3e')]]={'$like':'%'+_0x41a15b['query']['filter']+'%'};return _0x5b6939;}})});}_0x18df90=_[_0x9a45('0x53')]({},_0x18df90,_0x41a15b[_0x9a45('0x55')]);var _0x21b5de={'where':_0x18df90[_0x9a45('0x51')]};return db[_0x9a45('0x44')][_0x9a45('0x33')](_0x21b5de)[_0x9a45('0x23')](function(_0x28bc1a){_0x2e08d7[_0x9a45('0x33')]=_0x28bc1a;if(_0x41a15b[_0x9a45('0x47')][_0x9a45('0x56')]){_0x18df90[_0x9a45('0x57')]=[{'all':!![]}];}return db[_0x9a45('0x44')][_0x9a45('0x58')](_0x18df90);})[_0x9a45('0x23')](function(_0x2e85a7){_0x2e08d7['rows']=_0x2e85a7;return _0x2e08d7;})[_0x9a45('0x23')](respondWithFilteredResult(_0x2c0c86,_0x18df90))[_0x9a45('0x59')](handleError(_0x2c0c86,null));};exports[_0x9a45('0x5a')]=function(_0x141159,_0x6e2ee7){var _0x128194={'raw':![],'where':{'id':_0x141159[_0x9a45('0x5b')]['id']},'include':[{'model':db[_0x9a45('0x41')],'as':_0x9a45('0x42')}]},_0x1fc4f7={};_0x1fc4f7[_0x9a45('0x46')]=_[_0x9a45('0x48')](db[_0x9a45('0x44')][_0x9a45('0x5c')]);_0x1fc4f7[_0x9a45('0x47')]=_[_0x9a45('0x48')](_0x141159[_0x9a45('0x47')]);_0x1fc4f7[_0x9a45('0x49')]=_['intersection'](_0x1fc4f7[_0x9a45('0x46')],_0x1fc4f7[_0x9a45('0x47')]);_0x128194[_0x9a45('0x4b')]=_['intersection'](_0x1fc4f7[_0x9a45('0x46')],qs[_0x9a45('0x4c')](_0x141159['query'][_0x9a45('0x4c')]));_0x128194['attributes']=_0x128194['attributes'][_0x9a45('0x5d')]?_0x128194[_0x9a45('0x4b')]:_0x1fc4f7['model'];if(_0x141159['query'][_0x9a45('0x56')]){_0x128194[_0x9a45('0x57')]=[{'all':!![]}];}_0x128194=_[_0x9a45('0x53')]({},_0x128194,_0x141159['options']);return db[_0x9a45('0x44')]['find'](_0x128194)[_0x9a45('0x23')](handleEntityNotFound(_0x6e2ee7,null))[_0x9a45('0x23')](respondWithResult(_0x6e2ee7,null))[_0x9a45('0x59')](handleError(_0x6e2ee7,null));};exports['create']=function(_0x4ce984,_0x48617c){return db[_0x9a45('0x44')]['create'](_0x4ce984[_0x9a45('0x5e')],{})[_0x9a45('0x23')](function(_0x5b29cd){var _0x151a00=_0x4ce984[_0x9a45('0x5f')][_0x9a45('0x3a')]({'plain':!![]});if(!_0x151a00)throw new Error(_0x9a45('0x60'));if(_0x151a00['role']===_0x9a45('0x5f')){var _0x24a689=_0x5b29cd[_0x9a45('0x3a')]({'plain':!![]});var _0x1fc0b0=_0x9a45('0x3b');return db[_0x9a45('0x61')][_0x9a45('0x62')]({'where':{'name':_0x1fc0b0,'userProfileId':_0x151a00['userProfileId']},'raw':!![]})[_0x9a45('0x23')](function(_0x41a467){if(_0x41a467&&_0x41a467[_0x9a45('0x63')]===0x0){return db[_0x9a45('0x3c')][_0x9a45('0x64')]({'name':_0x24a689['name'],'resourceId':_0x24a689['id'],'type':_0x41a467[_0x9a45('0x3e')],'sectionId':_0x41a467['id']},{})[_0x9a45('0x23')](function(){return _0x5b29cd;});}else{return _0x5b29cd;}})['catch'](function(_0x4dbf54){logger['error'](_0x9a45('0x65'),_0x4dbf54);throw _0x4dbf54;});}return _0x5b29cd;})['then'](respondWithResult(_0x48617c,0xc9))[_0x9a45('0x59')](handleError(_0x48617c,null));};exports[_0x9a45('0x38')]=function(_0x1bd8a0,_0x39c683){if(_0x1bd8a0[_0x9a45('0x5e')]['id']){delete _0x1bd8a0[_0x9a45('0x5e')]['id'];}return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x1bd8a0['params']['id']},'include':[{'model':db[_0x9a45('0x41')],'as':_0x9a45('0x42')}]})['then'](handleEntityNotFound(_0x39c683,null))[_0x9a45('0x23')](saveUpdates(_0x1bd8a0[_0x9a45('0x5e')],null))[_0x9a45('0x23')](respondWithResult(_0x39c683,null))['catch'](handleError(_0x39c683,null));};exports[_0x9a45('0x39')]=function(_0x3ab2f9,_0x35a1ab){return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x3ab2f9[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x35a1ab,null))[_0x9a45('0x23')](removeEntity(_0x35a1ab,null))['catch'](handleError(_0x35a1ab,null));};exports[_0x9a45('0x66')]=function(_0x2a2fad,_0x25c130){return db[_0x9a45('0x44')][_0x9a45('0x66')]()[_0x9a45('0x23')](respondWithResult(_0x25c130,null))['catch'](handleError(_0x25c130,null));};exports[_0x9a45('0x67')]=function(_0x3502da,_0x583c99,_0x1dba7b){if(_0x3502da[_0x9a45('0x5e')]['id']){delete _0x3502da[_0x9a45('0x5e')]['id'];}return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x3502da[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x583c99,null))[_0x9a45('0x23')](function(_0x4cb20c){if(_0x4cb20c){_0x3502da['body'][_0x9a45('0x68')]=_0x4cb20c['id'];return db[_0x9a45('0x69')][_0x9a45('0x64')](_0x3502da[_0x9a45('0x5e')]);}})[_0x9a45('0x23')](respondWithResult(_0x583c99,null))[_0x9a45('0x59')](handleError(_0x583c99,null));};exports['getDispositions']=function(_0x311f05,_0x2d02c8,_0xef089d){var _0x46f76f={'raw':![],'where':{}};var _0x2d2e65={};var _0x3dd8f8={'count':0x0,'rows':[]};return db[_0x9a45('0x44')]['findOne']({'where':{'id':_0x311f05[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x2d02c8,null))[_0x9a45('0x23')](function(_0xd24dcb){if(_0xd24dcb){_0x2d2e65[_0x9a45('0x46')]=_[_0x9a45('0x48')](db['Disposition']['rawAttributes']);_0x2d2e65[_0x9a45('0x47')]=_['keys'](_0x311f05[_0x9a45('0x47')]);_0x2d2e65['filters']=_[_0x9a45('0x4a')](_0x2d2e65[_0x9a45('0x46')],_0x2d2e65[_0x9a45('0x47')]);_0x46f76f['attributes']=_[_0x9a45('0x4a')](_0x2d2e65[_0x9a45('0x46')],qs[_0x9a45('0x4c')](_0x311f05[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x46f76f[_0x9a45('0x4b')]=_0x46f76f[_0x9a45('0x4b')][_0x9a45('0x5d')]?_0x46f76f[_0x9a45('0x4b')]:_0x2d2e65[_0x9a45('0x46')];if(!_0x311f05[_0x9a45('0x47')][_0x9a45('0x4d')](_0x9a45('0x4e'))){_0x46f76f[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x311f05[_0x9a45('0x47')][_0x9a45('0x32')]);_0x46f76f['offset']=qs[_0x9a45('0x30')](_0x311f05[_0x9a45('0x47')][_0x9a45('0x30')]);}_0x46f76f[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x311f05[_0x9a45('0x47')]['sort']);_0x46f76f['where']=qs[_0x9a45('0x49')](_['pick'](_0x311f05[_0x9a45('0x47')],_0x2d2e65[_0x9a45('0x49')]));_0x46f76f[_0x9a45('0x51')][_0x9a45('0x68')]=_0xd24dcb['id'];if(_0x311f05[_0x9a45('0x47')]['filter']){_0x46f76f['where']=_[_0x9a45('0x53')](_0x46f76f[_0x9a45('0x51')],{'$or':_[_0x9a45('0x43')](_0x46f76f[_0x9a45('0x4b')],function(_0x31fa17){var _0x5149bd={};_0x5149bd[_0x31fa17]={'$like':'%'+_0x311f05[_0x9a45('0x47')][_0x9a45('0x6a')]+'%'};return _0x5149bd;})});}_0x46f76f=_[_0x9a45('0x53')]({},_0x46f76f,_0x311f05[_0x9a45('0x55')]);return db[_0x9a45('0x69')][_0x9a45('0x33')]({'where':_0x46f76f[_0x9a45('0x51')]})[_0x9a45('0x23')](function(_0x2f0fcf){_0x3dd8f8['count']=_0x2f0fcf;if(_0x311f05[_0x9a45('0x47')][_0x9a45('0x56')]){_0x46f76f[_0x9a45('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x9a45('0x58')](_0x46f76f);})[_0x9a45('0x23')](function(_0x4ee44a){_0x3dd8f8[_0x9a45('0x6b')]=_0x4ee44a;return _0x3dd8f8;});}})[_0x9a45('0x23')](respondWithFilteredResult(_0x2d02c8,_0x46f76f))['catch'](handleError(_0x2d02c8,null));};exports['removeDispositions']=function(_0x28c5d9,_0x5ac278,_0x248deb){return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x28c5d9['params']['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x5ac278,null))[_0x9a45('0x23')](function(_0x1c7a4a){if(_0x1c7a4a){return _0x1c7a4a[_0x9a45('0x6c')](_0x28c5d9['query'][_0x9a45('0x6d')]);}})[_0x9a45('0x23')](respondWithStatusCode(_0x5ac278,null))[_0x9a45('0x59')](handleError(_0x5ac278,null));};exports[_0x9a45('0x6e')]=function(_0x2b3116,_0x311ec6,_0xc84f80){if(_0x2b3116[_0x9a45('0x5e')]['id']){delete _0x2b3116[_0x9a45('0x5e')]['id'];}return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x2b3116[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x311ec6,null))['then'](function(_0x15eca1){if(_0x15eca1){_0x2b3116[_0x9a45('0x5e')][_0x9a45('0x68')]=_0x15eca1['id'];return db[_0x9a45('0x6f')][_0x9a45('0x64')](_0x2b3116[_0x9a45('0x5e')]);}})[_0x9a45('0x23')](respondWithResult(_0x311ec6,null))[_0x9a45('0x59')](handleError(_0x311ec6,null));};exports[_0x9a45('0x70')]=function(_0x36c6e6,_0x20ba85,_0xb4ed08){var _0x16dda1={'raw':![],'where':{}};var _0x4448b2={};var _0x2301b9={'count':0x0,'rows':[]};return db[_0x9a45('0x44')][_0x9a45('0x71')]({'where':{'id':_0x36c6e6[_0x9a45('0x5b')]['id']}})['then'](handleEntityNotFound(_0x20ba85,null))[_0x9a45('0x23')](function(_0x2150e5){if(_0x2150e5){_0x4448b2[_0x9a45('0x46')]=_[_0x9a45('0x48')](db[_0x9a45('0x6f')][_0x9a45('0x5c')]);_0x4448b2[_0x9a45('0x47')]=_[_0x9a45('0x48')](_0x36c6e6[_0x9a45('0x47')]);_0x4448b2[_0x9a45('0x49')]=_[_0x9a45('0x4a')](_0x4448b2[_0x9a45('0x46')],_0x4448b2[_0x9a45('0x47')]);_0x16dda1[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x4448b2[_0x9a45('0x46')],qs[_0x9a45('0x4c')](_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x16dda1[_0x9a45('0x4b')]=_0x16dda1['attributes']['length']?_0x16dda1[_0x9a45('0x4b')]:_0x4448b2[_0x9a45('0x46')];if(!_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x4d')](_0x9a45('0x4e'))){_0x16dda1[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x32')]);_0x16dda1[_0x9a45('0x30')]=qs['offset'](_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x30')]);}_0x16dda1[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x50')]);_0x16dda1[_0x9a45('0x51')]=qs[_0x9a45('0x49')](_[_0x9a45('0x52')](_0x36c6e6['query'],_0x4448b2['filters']));_0x16dda1['where'][_0x9a45('0x68')]=_0x2150e5['id'];if(_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x6a')]){_0x16dda1['where']=_['merge'](_0x16dda1[_0x9a45('0x51')],{'$or':_[_0x9a45('0x43')](_0x16dda1[_0x9a45('0x4b')],function(_0x39238b){var _0x5f3c95={};_0x5f3c95[_0x39238b]={'$like':'%'+_0x36c6e6[_0x9a45('0x47')]['filter']+'%'};return _0x5f3c95;})});}_0x16dda1=_['merge']({},_0x16dda1,_0x36c6e6['options']);return db[_0x9a45('0x6f')]['count']({'where':_0x16dda1[_0x9a45('0x51')]})['then'](function(_0x39bce7){_0x2301b9[_0x9a45('0x33')]=_0x39bce7;if(_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x56')]){_0x16dda1[_0x9a45('0x57')]=[{'all':!![]}];}return db[_0x9a45('0x6f')][_0x9a45('0x58')](_0x16dda1);})[_0x9a45('0x23')](function(_0x34462d){_0x2301b9['rows']=_0x34462d;return _0x2301b9;});}})[_0x9a45('0x23')](respondWithFilteredResult(_0x20ba85,_0x16dda1))[_0x9a45('0x59')](handleError(_0x20ba85,null));};exports['removeAnswers']=function(_0x1f785d,_0xf057b0,_0x2a4aee){return db[_0x9a45('0x44')]['find']({'where':{'id':_0x1f785d[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0xf057b0,null))[_0x9a45('0x23')](function(_0x20f41b){if(_0x20f41b){return _0x20f41b['removeAnswers'](_0x1f785d['query'][_0x9a45('0x6d')]);}})['then'](respondWithStatusCode(_0xf057b0,null))[_0x9a45('0x59')](handleError(_0xf057b0,null));};exports[_0x9a45('0x72')]=function(_0x488aef,_0xb4899c,_0x4c5d4f){return db[_0x9a45('0x73')][_0x9a45('0x62')]({'where':{'id':_0x488aef[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0xb4899c,null))[_0x9a45('0x23')](function(_0x6607f8){if(_0x6607f8){return _0x6607f8[_0x9a45('0x72')](_0x488aef[_0x9a45('0x5e')]['ids'],_['omit'](_0x488aef['body'],[_0x9a45('0x6d'),'id'])||{});}})[_0x9a45('0x23')](respondWithResult(_0xb4899c,null))[_0x9a45('0x59')](handleError(_0xb4899c,null));};exports['getInteractions']=function(_0x2b9594,_0x17ea55,_0x243c67){var _0x342e0a={'raw':![],'where':{}};var _0x2a9eff={};var _0x47e0ed={'count':0x0,'rows':[]};return db[_0x9a45('0x44')][_0x9a45('0x71')]({'where':{'id':_0x2b9594[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x17ea55,null))[_0x9a45('0x23')](function(_0x1883b2){if(_0x1883b2){_0x2a9eff['model']=_[_0x9a45('0x48')](db['FaxInteraction'][_0x9a45('0x5c')]);_0x2a9eff['query']=_['keys'](_0x2b9594[_0x9a45('0x47')]);_0x2a9eff['filters']=_[_0x9a45('0x4a')](_0x2a9eff[_0x9a45('0x46')],_0x2a9eff[_0x9a45('0x47')]);_0x342e0a[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x2a9eff[_0x9a45('0x46')],qs['fields'](_0x2b9594[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x342e0a['attributes']=_0x342e0a['attributes']['length']?_0x342e0a[_0x9a45('0x4b')]:_0x2a9eff[_0x9a45('0x46')];if(!_0x2b9594[_0x9a45('0x47')][_0x9a45('0x4d')]('nolimit')){_0x342e0a[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x2b9594[_0x9a45('0x47')]['limit']);_0x342e0a[_0x9a45('0x30')]=qs[_0x9a45('0x30')](_0x2b9594[_0x9a45('0x47')][_0x9a45('0x30')]);}_0x342e0a[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x2b9594[_0x9a45('0x47')]['sort']);_0x342e0a['where']=qs['filters'](_[_0x9a45('0x52')](_0x2b9594[_0x9a45('0x47')],_0x2a9eff[_0x9a45('0x49')]));_0x342e0a['where'][_0x9a45('0x68')]=_0x1883b2['id'];if(_0x2b9594[_0x9a45('0x47')][_0x9a45('0x6a')]){_0x342e0a['where']=_[_0x9a45('0x53')](_0x342e0a[_0x9a45('0x51')],{'$or':_[_0x9a45('0x43')](_0x342e0a[_0x9a45('0x4b')],function(_0x32c184){var _0x48e2f4={};_0x48e2f4[_0x32c184]={'$like':'%'+_0x2b9594[_0x9a45('0x47')][_0x9a45('0x6a')]+'%'};return _0x48e2f4;})});}_0x342e0a=_[_0x9a45('0x53')]({},_0x342e0a,_0x2b9594['options']);return db['FaxInteraction'][_0x9a45('0x33')]({'where':_0x342e0a[_0x9a45('0x51')]})['then'](function(_0x19ba65){_0x47e0ed[_0x9a45('0x33')]=_0x19ba65;if(_0x2b9594['query'][_0x9a45('0x56')]){_0x342e0a[_0x9a45('0x57')]=[{'model':db[_0x9a45('0x74')],'as':'Contact','required':![]},{'model':db[_0x9a45('0x75')],'as':_0x9a45('0x76'),'attributes':[_0x9a45('0x3e'),'fullname',_0x9a45('0x77')],'required':![]},{'model':db['Tag'],'as':_0x9a45('0x78'),'attributes':['id',_0x9a45('0x3e'),_0x9a45('0x79')],'where':_0x2b9594[_0x9a45('0x47')][_0x9a45('0x7a')]?{'id':_0x2b9594['query']['tag']}:undefined,'required':_0x2b9594[_0x9a45('0x47')][_0x9a45('0x7a')]?!![]:![]}];}return db[_0x9a45('0x73')][_0x9a45('0x58')](_0x342e0a);})[_0x9a45('0x23')](function(_0x22724b){_0x47e0ed[_0x9a45('0x6b')]=_0x22724b;return _0x47e0ed;});}})[_0x9a45('0x23')](respondWithFilteredResult(_0x17ea55,_0x342e0a))[_0x9a45('0x59')](handleError(_0x17ea55,null));};exports[_0x9a45('0x7b')]=function(_0x43cb27,_0x314282){var _0xe106f3=_0x43cb27[_0x9a45('0x5b')]['id'];var _0x286199=_0x43cb27[_0x9a45('0x5e')];var _0x2527ec=0xc8;var _0x2b49e9=null;return db[_0x9a45('0x7c')]['transaction']({'isolationLevel':db[_0x9a45('0x7c')][_0x9a45('0x7d')][_0x9a45('0x7e')][_0x9a45('0x7f')]},function(_0x2f083c){return db[_0x9a45('0x44')]['findOne']({'where':{'id':_0xe106f3},'transaction':_0x2f083c})[_0x9a45('0x23')](function(_0x4626bb){if(_0x4626bb){return db['FaxApplication'][_0x9a45('0x39')]({'where':{'FaxAccountId':_0xe106f3},'transaction':_0x2f083c})[_0x9a45('0x23')](function(){var _0x5878dd=_[_0x9a45('0x43')](_0x286199,function(_0x5111af){_0x5111af[_0x9a45('0x68')]=_0xe106f3;return _0x5111af;});return db[_0x9a45('0x80')][_0x9a45('0x81')](_0x5878dd,{'transaction':_0x2f083c});});}else{_0x2527ec=0x194;_0x2b49e9=[];}});})[_0x9a45('0x23')](function(){if(_0x2527ec!==0x194){return db['FaxApplication'][_0x9a45('0x82')]({'where':{'FaxAccountId':_0xe106f3},'order':_0x9a45('0x83')})[_0x9a45('0x23')](function(_0x2a5c11){_0x2b49e9=_0x2a5c11;});}})['catch'](function(_0x669d30){_0x2527ec=0x1f4;logger[_0x9a45('0x28')](_0x669d30['stack']);if(_0x669d30[_0x9a45('0x3e')]){delete _0x669d30['name'];}_0x2b49e9=_0x669d30;})[_0x9a45('0x84')](function(){if(_0x2b49e9===null){_0x314282[_0x9a45('0x2c')](_0x2527ec);}else{if(_0x2527ec===0x1f4){_0x314282[_0x9a45('0x2d')](_0x2527ec)[_0x9a45('0x3f')](_0x2b49e9);}else{_0x314282[_0x9a45('0x2d')](_0x2527ec)[_0x9a45('0x2f')](_0x2b49e9);}}});};exports['getApplications']=function(_0xd38736,_0x245c0a,_0x5adb2e){var _0x38aaa8={};var _0x38695f={};var _0x3255cc;var _0x192e58;return db[_0x9a45('0x44')][_0x9a45('0x71')]({'where':{'id':_0xd38736[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x245c0a,null))['then'](function(_0x392759){if(_0x392759){_0x3255cc=_0x392759;_0x38695f[_0x9a45('0x46')]=_[_0x9a45('0x48')](db[_0x9a45('0x80')]['rawAttributes']);_0x38695f['query']=_['keys'](_0xd38736['query']);_0x38695f[_0x9a45('0x49')]=_[_0x9a45('0x4a')](_0x38695f['model'],_0x38695f[_0x9a45('0x47')]);_0x38aaa8[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x38695f[_0x9a45('0x46')],qs[_0x9a45('0x4c')](_0xd38736[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x38aaa8[_0x9a45('0x4b')]=_0x38aaa8[_0x9a45('0x4b')][_0x9a45('0x5d')]?_0x38aaa8[_0x9a45('0x4b')]:_0x38695f[_0x9a45('0x46')];_0x38aaa8[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0xd38736[_0x9a45('0x47')][_0x9a45('0x50')]);_0x38aaa8[_0x9a45('0x51')]=qs[_0x9a45('0x49')](_[_0x9a45('0x52')](_0xd38736[_0x9a45('0x47')],_0x38695f[_0x9a45('0x49')]));if(_0xd38736[_0x9a45('0x47')][_0x9a45('0x6a')]){_0x38aaa8['where']=_[_0x9a45('0x53')](_0x38aaa8[_0x9a45('0x51')],{'$or':_['map'](_0x38aaa8[_0x9a45('0x4b')],function(_0x458322){var _0x3f7f65={};_0x3f7f65[_0x458322]={'$like':'%'+_0xd38736['query'][_0x9a45('0x6a')]+'%'};return _0x3f7f65;})});}_0x38aaa8=_[_0x9a45('0x53')]({},_0x38aaa8,_0xd38736[_0x9a45('0x55')]);return _0x3255cc['getApplications'](_0x38aaa8);}})[_0x9a45('0x23')](function(_0x471893){if(_0x471893){_0x192e58=_0x471893[_0x9a45('0x5d')];if(!_0xd38736[_0x9a45('0x47')][_0x9a45('0x4d')]('nolimit')){_0x38aaa8[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0xd38736['query']['limit']);_0x38aaa8['offset']=qs[_0x9a45('0x30')](_0xd38736[_0x9a45('0x47')][_0x9a45('0x30')]);}return _0x3255cc[_0x9a45('0x85')](_0x38aaa8);}})[_0x9a45('0x23')](function(_0x5d54e0){if(_0x5d54e0){return _0x5d54e0?{'count':_0x192e58,'rows':_0x5d54e0}:null;}})[_0x9a45('0x23')](respondWithResult(_0x245c0a,null))['catch'](handleError(_0x245c0a,null));};function Extension(_0xc99a5d,_0x517778,_0x3032d8,_0x4c5782){this[_0x9a45('0x86')]=_0x9a45('0x87');this[_0x9a45('0x88')]=_0xc99a5d[_0x9a45('0x89')];this[_0x9a45('0x8a')]=_0x4c5782;this[_0x9a45('0x45')]=_0x9a45('0x8b');this[_0x9a45('0x8c')]=_0x9a45('0x8d');this[_0x9a45('0x68')]=_0xc99a5d['id'];this[_0x9a45('0x83')]=_0x517778;this[_0x9a45('0x8e')]=_0x3032d8;}function createExtensionsReciveFax(_0x2c71bd){var _0x284741=0x1;var _0x3370f5=[];_0x3370f5[_0x9a45('0x8f')](new Extension(_0x2c71bd,_0x284741,'',_0x9a45('0x90')));_0x284741+=0x1;_0x3370f5[_0x9a45('0x8f')](new Extension(_0x2c71bd,_0x284741,_0x9a45('0x91'),_0x9a45('0x92')));_0x284741+=0x1;for(var _0x442b2e in _0x2c71bd){if(_0x2c71bd[_0x9a45('0x4d')](_0x442b2e)&&(_0x442b2e===_0x9a45('0x93')||_0x442b2e===_0x9a45('0x89')||_0x442b2e==='gateway'||_0x442b2e===_0x9a45('0x94')||_0x442b2e==='headerinfo'||_0x442b2e===_0x9a45('0x95')||_0x442b2e==='minrate'||_0x442b2e==='modem'||_0x442b2e===_0x9a45('0x96'))){_0x3370f5[_0x9a45('0x8f')](new Extension(_0x2c71bd,_0x284741,_0x9a45('0x97')+_0x442b2e+')='+_0x2c71bd[_0x442b2e],_0x9a45('0x92')));_0x284741+=0x1;}}_0x3370f5[_0x9a45('0x8f')](new Extension(_0x2c71bd,_0x284741,'6',_0x9a45('0x98')));_0x284741+=0x1;_0x3370f5[_0x9a45('0x8f')](new Extension(_0x2c71bd,_0x284741,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0x9a45('0x99')));_0x284741=0x0;return _0x3370f5;}exports[_0x9a45('0x9a')]=function(_0x514b2f,_0x5c4b4a,_0x3acecc){var _0x14a37b;return db[_0x9a45('0x7c')][_0x9a45('0x9b')](function(_0x5f0042){return db[_0x9a45('0x44')][_0x9a45('0x64')](_0x514b2f[_0x9a45('0x5e')],{'transaction':_0x5f0042})[_0x9a45('0x23')](function(_0x15b5f7){_0x14a37b=_0x15b5f7[_0x9a45('0x3a')]({'plain':!![]});return db[_0x9a45('0x9c')][_0x9a45('0x81')](createExtensionsReciveFax(_0x14a37b),{'transaction':_0x5f0042});});})[_0x9a45('0x23')](function(){return _0x14a37b;})[_0x9a45('0x23')](respondWithResult(_0x5c4b4a,null))[_0x9a45('0x59')](handleError(_0x5c4b4a,null));};exports[_0x9a45('0x9d')]=function(_0x9a013e,_0x581be0,_0x4d6282){var _0x5cfd96;return db['sequelize']['transaction'](function(_0x1fd0d6){return db[_0x9a45('0x44')][_0x9a45('0x38')](_0x9a013e['body'],{'where':{'id':_0x9a013e['body']['id']},'transaction':_0x1fd0d6})[_0x9a45('0x23')](function(_0x423c93){return db[_0x9a45('0x9c')][_0x9a45('0x39')]({'where':{'FaxAccountId':_0x9a013e[_0x9a45('0x5e')]['id']},'transaction':_0x1fd0d6})['then'](function(_0x35c6bc){return db[_0x9a45('0x9c')][_0x9a45('0x81')](createExtensionsReciveFax(_[_0x9a45('0x9e')](_0x9a013e[_0x9a45('0x5e')],[_0x9a45('0x9f'),_0x9a45('0xa0'),_0x9a45('0xa1'),_0x9a45('0xa2'),_0x9a45('0xa3'),_0x9a45('0xa4')])),{'transaction':_0x1fd0d6});});});})[_0x9a45('0x23')](function(){return db[_0x9a45('0x44')][_0x9a45('0xa5')](_0x9a013e[_0x9a45('0x5e')]['id']);})[_0x9a45('0x23')](respondWithResult(_0x581be0,null))['catch'](handleError(_0x581be0,null));};exports[_0x9a45('0xa6')]=function(_0x3f31c1,_0x41a54d,_0x16802b){var _0x3f70d5={'raw':!![],'where':{}};var _0x20491c={};var _0x3819aa={'count':0x0,'rows':[]};return db[_0x9a45('0x44')][_0x9a45('0x71')]({'where':{'id':_0x3f31c1[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x41a54d,null))[_0x9a45('0x23')](function(_0x2713da){if(_0x2713da){_0x20491c[_0x9a45('0x46')]=_['keys'](db[_0x9a45('0xa7')][_0x9a45('0x5c')]);_0x20491c[_0x9a45('0x47')]=_[_0x9a45('0x48')](_0x3f31c1[_0x9a45('0x47')]);_0x20491c[_0x9a45('0x49')]=_[_0x9a45('0x4a')](_0x20491c[_0x9a45('0x46')],_0x20491c[_0x9a45('0x47')]);_0x3f70d5[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x20491c[_0x9a45('0x46')],qs['fields'](_0x3f31c1[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x3f70d5[_0x9a45('0x4b')]=_0x3f70d5[_0x9a45('0x4b')][_0x9a45('0x5d')]?_0x3f70d5[_0x9a45('0x4b')]:_0x20491c['model'];if(!_0x3f31c1[_0x9a45('0x47')][_0x9a45('0x4d')](_0x9a45('0x4e'))){_0x3f70d5[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x3f31c1[_0x9a45('0x47')][_0x9a45('0x32')]);_0x3f70d5[_0x9a45('0x30')]=qs[_0x9a45('0x30')](_0x3f31c1[_0x9a45('0x47')][_0x9a45('0x30')]);}_0x3f70d5[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x3f31c1[_0x9a45('0x47')][_0x9a45('0x50')]);_0x3f70d5['where']=qs['filters'](_['pick'](_0x3f31c1[_0x9a45('0x47')],_0x20491c[_0x9a45('0x49')]));_0x3f70d5['where'][_0x9a45('0x68')]=_0x2713da['id'];if(_0x3f31c1[_0x9a45('0x47')]['filter']){_0x3f70d5[_0x9a45('0x51')]=_[_0x9a45('0x53')](_0x3f70d5['where'],{'$or':_[_0x9a45('0x43')](_0x3f70d5[_0x9a45('0x4b')],function(_0x58ae15){var _0x35b7dd={};_0x35b7dd[_0x58ae15]={'$like':'%'+_0x3f31c1['query']['filter']+'%'};return _0x35b7dd;})});}if(_0x3f31c1[_0x9a45('0x47')][_0x9a45('0xa8')]){var _0x27ecdc=_0x3f31c1[_0x9a45('0x47')]['$gte'][_0x9a45('0xa9')](',');var _0x1586cb={};_0x1586cb[_0x27ecdc[0x0]]={'$gte':moment(_0x27ecdc[0x1])[_0x9a45('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3f70d5[_0x9a45('0x51')]=_['merge'](_0x3f70d5[_0x9a45('0x51')],_0x1586cb);}_0x3f70d5=_[_0x9a45('0x53')]({},_0x3f70d5,_0x3f31c1[_0x9a45('0x55')]);return db[_0x9a45('0xa7')][_0x9a45('0x33')]({'where':_0x3f70d5['where']})['then'](function(_0x1722a1){_0x3819aa[_0x9a45('0x33')]=_0x1722a1;if(_0x3f31c1[_0x9a45('0x47')]['includeAll']){_0x3f70d5[_0x9a45('0x57')]=[{'all':!![]}];}return db[_0x9a45('0xa7')][_0x9a45('0x58')](_0x3f70d5);})['then'](function(_0x5f2a29){_0x3819aa[_0x9a45('0x6b')]=_0x5f2a29;return _0x3819aa;});}})[_0x9a45('0x23')](respondWithFilteredResult(_0x41a54d,_0x3f70d5))[_0x9a45('0x59')](handleError(_0x41a54d,null));};exports[_0x9a45('0x3f')]=function(_0x344941,_0x108115,_0x1d4dfb){var _0x56fd21,_0x1bfc62={},_0x3742e3;if(_0x344941[_0x9a45('0x5e')]['to']){_0x3742e3=_0x344941[_0x9a45('0x5e')]['to'][0x0];}return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x344941['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9a45('0x74')],'as':_0x9a45('0xab'),'where':{'fax':_0x3742e3},'limit':0x1,'order':[[_0x9a45('0xa2'),_0x9a45('0xac')]]}]}]})[_0x9a45('0x23')](handleEntityNotFound(_0x108115,null))[_0x9a45('0x23')](function(_0x3ad724){_0x56fd21=_0x3ad724;if(_0x344941['body'][_0x9a45('0xad')]&&_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][_0x9a45('0x5d')]){for(var _0x169b16=0x0;_0x169b16<_0x344941[_0x9a45('0x5e')]['attachments']['length'];_0x169b16+=0x1){_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][_0x169b16]={'filename':_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][_0x169b16][_0x9a45('0x3e')],'id':_0x344941[_0x9a45('0x5e')]['attachments'][_0x169b16]['id'],'path':path['join'](config[_0x9a45('0xae')],_0x9a45('0xaf'),_0x344941[_0x9a45('0x5e')]['attachments'][_0x169b16]['basename'])};}}return respondWithRpcPromise(_0x9a45('0xb0'),_0x9a45('0xb0'),{'FaxAccountId':_[_0x9a45('0xb1')](_0x344941[_0x9a45('0x5b')]['id'])?undefined:_0x344941['params']['id'],'path':_['isNil'](_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][0x0][_0x9a45('0x6')])?undefined:_0x344941[_0x9a45('0x5e')]['attachments'][0x0][_0x9a45('0x6')],'fax':_[_0x9a45('0xb1')](_0x344941[_0x9a45('0x5e')]['to'][0x0])?undefined:_0x344941[_0x9a45('0x5e')]['to'][0x0]},client9002);})['then'](function(){if(_0x56fd21){if(_[_0x9a45('0xb1')](_0x344941[_0x9a45('0x5e')][_0x9a45('0xb2')])){_0x344941[_0x9a45('0x5e')][_0x9a45('0xb2')]=util[_0x9a45('0xaa')](_0x9a45('0xb3'),_0x56fd21[_0x9a45('0x3e')],_0x56fd21[_0x9a45('0xb4')]);}if(_0x56fd21[_0x9a45('0xb5')]){if(_0x56fd21[_0x9a45('0xb5')][_0x9a45('0xab')][_0x9a45('0x5d')]){return _0x56fd21['List'][_0x9a45('0xab')][0x0];}else{return db[_0x9a45('0x74')][_0x9a45('0x64')](_[_0x9a45('0x1c')](_0x344941[_0x9a45('0x5e')],{'firstName':_0x344941[_0x9a45('0x5e')]['to'][0x0],'phone':_0x344941[_0x9a45('0x5e')]['to'][0x0],'fax':_0x344941['body']['to'][0x0],'ListId':_0x56fd21[_0x9a45('0xa4')]}));}}else{throw new Error(_0x9a45('0xb6'));}}else{throw new Error(_0x9a45('0xb7'));}})[_0x9a45('0x23')](function(_0x2eef85){if(_0x2eef85){return db['FaxInteraction'][_0x9a45('0x62')]({'where':{'ContactId':_0x2eef85['id'],'closed':![],'FaxAccountId':_0x56fd21['id']}})[_0x9a45('0x23')](function(_0x15139e){if(_0x15139e){return[_0x15139e,![]];}return db['FaxInteraction'][_0x9a45('0x64')]({'UserId':_0x344941[_0x9a45('0x5f')]['id'],'ContactId':_0x2eef85['id'],'FaxAccountId':_0x56fd21['id'],'fax':_0x344941[_0x9a45('0x5e')]['to'][0x0],'firstMsgDirection':_0x9a45('0xb8'),'Messages':[_[_0x9a45('0x53')](_0x344941['body'],{'read':![],'body':_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][0x0][_0x9a45('0xb9')],'FaxAccountId':_0x56fd21['id'],'UserId':_0x344941[_0x9a45('0x5f')]['id'],'ContactId':_0x2eef85['id'],'AttachmentId':_0x344941['body'][_0x9a45('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x9a45('0xba')}]})[_0x9a45('0x23')](function(_0x355e2a){return[_0x355e2a,!![]];});});}else{throw new Error(_0x9a45('0xbb'));}})['spread'](function(_0xf8c2,_0x4a719f){if(_0x4a719f){return _0xf8c2;}return db[_0x9a45('0xa7')][_0x9a45('0x64')]({'direction':'out','read':![],'body':_0x344941[_0x9a45('0x5e')]['attachments'][0x0][_0x9a45('0xb9')],'FaxAccountId':_0x56fd21['id'],'FaxInteractionId':_0xf8c2['id'],'UserId':_0x344941[_0x9a45('0x5f')]['id'],'ContactId':_0xf8c2[_0x9a45('0xbc')],'AttachmentId':_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][0x0]['id']})[_0x9a45('0x23')](function(_0x58e8d1){_0xf8c2[_0x9a45('0xbd')][_0x9a45('0xba')]=[];_0xf8c2[_0x9a45('0xbd')]['Messages'][_0x9a45('0x8f')](_0x58e8d1[_0x9a45('0xbd')]);return _0xf8c2;});})['then'](function(_0x248104){respondWithRpcPromise(_0x9a45('0xbe'),'SendFax',{'FaxAccountId':_[_0x9a45('0xb1')](_0x344941[_0x9a45('0x5b')]['id'])?undefined:_0x344941['params']['id'],'path':_[_0x9a45('0xb1')](_0x344941[_0x9a45('0x5e')]['attachments'][0x0]['path'])?undefined:_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][0x0]['path'],'fax':_['isNil'](_0x344941[_0x9a45('0x5e')]['to'][0x0])?undefined:_0x344941[_0x9a45('0x5e')]['to'][0x0],'AttachmentId':_0x344941['body']['attachments'][0x0]['id']},client9002)['then'](function(_0x39419b){logger['info']('SendFaxRpc,\x20%s',_0x39419b);})[_0x9a45('0x59')](function(_0x4a155e){logger[_0x9a45('0x24')]('SendFaxRpc,\x20%s',_0x4a155e);});return _0x248104;})['then'](respondWithResult(_0x108115,null))[_0x9a45('0x59')](handleError(_0x108115,null));};exports[_0x9a45('0xbf')]=function(_0x20634a,_0x431a57,_0x585c14){return db['FaxAccount'][_0x9a45('0x62')]({'where':{'id':_0x20634a[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x431a57,null))[_0x9a45('0x23')](function(_0x42f71c){if(_0x42f71c){return _0x42f71c['addAgents'](_0x20634a[_0x9a45('0x5e')][_0x9a45('0x6d')],_[_0x9a45('0x9e')](_0x20634a[_0x9a45('0x5e')],[_0x9a45('0x6d'),'id'])||{})[_0x9a45('0xc0')](function(_0x1fb51b){for(var _0x5c83e6=0x0;_0x5c83e6<_0x20634a[_0x9a45('0x5e')][_0x9a45('0x6d')]['length'];_0x5c83e6+=0x1){socket[_0x9a45('0xc1')](_0x9a45('0xc2'),{'UserId':Number(_0x20634a[_0x9a45('0x5e')][_0x9a45('0x6d')][_0x5c83e6]),'FaxAccountId':Number(_0x20634a[_0x9a45('0x5b')]['id'])});}return _0x1fb51b;});}})['then'](respondWithResult(_0x431a57,null))[_0x9a45('0x59')](handleError(_0x431a57,null));};exports['removeAgents']=function(_0x44166b,_0x1781e7,_0x4fc4d5){return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x44166b[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x1781e7,null))[_0x9a45('0x23')](function(_0xe88084){if(_0xe88084){return _0xe88084[_0x9a45('0xc3')](_0x44166b[_0x9a45('0x47')]['ids'])[_0x9a45('0x23')](function(){if(_[_0x9a45('0xc4')](_0x44166b[_0x9a45('0x47')][_0x9a45('0x6d')])){for(var _0x1ebb34=0x0;_0x1ebb34<_0x44166b[_0x9a45('0x47')][_0x9a45('0x6d')][_0x9a45('0x5d')];_0x1ebb34+=0x1){socket[_0x9a45('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x44166b[_0x9a45('0x47')]['ids'][_0x1ebb34]),'FaxAccountId':Number(_0x44166b['params']['id'])});}}else{socket[_0x9a45('0xc1')](_0x9a45('0xc5'),{'UserId':Number(_0x44166b['query'][_0x9a45('0x6d')]),'FaxAccountId':Number(_0x44166b[_0x9a45('0x5b')]['id'])});}});}})[_0x9a45('0x23')](respondWithStatusCode(_0x1781e7,null))[_0x9a45('0x59')](handleError(_0x1781e7,null));};exports[_0x9a45('0xc6')]=function(_0x2defe0,_0x574c8b,_0x484657){var _0x72eaa8={};var _0x48341e={};var _0x3398b9;var _0x4171a6;return db[_0x9a45('0x44')]['findOne']({'where':{'id':_0x2defe0['params']['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x574c8b,null))[_0x9a45('0x23')](function(_0x5c6c41){if(_0x5c6c41){_0x3398b9=_0x5c6c41;_0x48341e[_0x9a45('0x46')]=_[_0x9a45('0x48')](db[_0x9a45('0x75')][_0x9a45('0x5c')]);_0x48341e[_0x9a45('0x47')]=_[_0x9a45('0x48')](_0x2defe0[_0x9a45('0x47')]);_0x48341e[_0x9a45('0x49')]=_[_0x9a45('0x4a')](_0x48341e[_0x9a45('0x46')],_0x48341e[_0x9a45('0x47')]);_0x72eaa8[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x48341e[_0x9a45('0x46')],qs[_0x9a45('0x4c')](_0x2defe0[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x72eaa8[_0x9a45('0x4b')]=_0x72eaa8[_0x9a45('0x4b')][_0x9a45('0x5d')]?_0x72eaa8['attributes']:_0x48341e[_0x9a45('0x46')];_0x72eaa8[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x2defe0[_0x9a45('0x47')]['sort']);_0x72eaa8['where']=qs[_0x9a45('0x49')](_[_0x9a45('0x52')](_0x2defe0['query'],_0x48341e['filters']));if(_0x2defe0[_0x9a45('0x47')][_0x9a45('0x6a')]){_0x72eaa8[_0x9a45('0x51')]=_[_0x9a45('0x53')](_0x72eaa8[_0x9a45('0x51')],{'$or':_['map'](_0x72eaa8[_0x9a45('0x4b')],function(_0x804970){var _0x20c15b={};_0x20c15b[_0x804970]={'$like':'%'+_0x2defe0['query']['filter']+'%'};return _0x20c15b;})});}_0x72eaa8=_[_0x9a45('0x53')]({},_0x72eaa8,_0x2defe0[_0x9a45('0x55')]);return _0x3398b9[_0x9a45('0xc6')](_0x72eaa8);}})[_0x9a45('0x23')](function(_0x4e4cee){if(_0x4e4cee){_0x4171a6=_0x4e4cee[_0x9a45('0x5d')];if(!_0x2defe0[_0x9a45('0x47')][_0x9a45('0x4d')]('nolimit')){_0x72eaa8[_0x9a45('0x32')]=qs['limit'](_0x2defe0[_0x9a45('0x47')]['limit']);_0x72eaa8[_0x9a45('0x30')]=qs['offset'](_0x2defe0[_0x9a45('0x47')]['offset']);}return _0x3398b9[_0x9a45('0xc6')](_0x72eaa8);}})['then'](function(_0x2684fd){if(_0x2684fd){return _0x2684fd?{'count':_0x4171a6,'rows':_0x2684fd}:null;}})['then'](respondWithResult(_0x574c8b,null))[_0x9a45('0x59')](handleError(_0x574c8b,null));}; \ No newline at end of file +var _0xb267=['CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','FaxApplication','bulkCreate','findAndCountAll','send','getApplications','context','exten','localstationid','system','Fax\x20Extension','priority','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','key','createdAt','TrunkId','ListId','findById','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','List','Contacts','List\x20not\x20found','filename','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxAccount.socket','register','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','FaxAccounts','UserProfileResource','stack','name','index','Pause','map','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','rows','show','params','mandatoryDispositionPause','include','FaxAccount','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','FaxAccountId','options','findAll','removeDispositions','ids','addAnswer'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xb267,0x1ed));var _0x7b26=function(_0x88cc82,_0x5a38cf){_0x88cc82=_0x88cc82-0x0;var _0xba7a1=_0xb267[_0x88cc82];return _0xba7a1;};'use strict';var emlformat=require(_0x7b26('0x0'));var rimraf=require(_0x7b26('0x1'));var zipdir=require(_0x7b26('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b26('0x3'));var moment=require(_0x7b26('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7b26('0x5'));var path=require(_0x7b26('0x6'));var sox=require(_0x7b26('0x7'));var csv=require('to-csv');var ejs=require(_0x7b26('0x8'));var fs=require('fs');var fs_extra=require(_0x7b26('0x9'));var _=require(_0x7b26('0xa'));var squel=require(_0x7b26('0xb'));var crypto=require(_0x7b26('0xc'));var jsforce=require(_0x7b26('0xd'));var deskjs=require(_0x7b26('0xe'));var toCsv=require(_0x7b26('0xf'));var querystring=require(_0x7b26('0x10'));var Papa=require(_0x7b26('0x11'));var Redis=require(_0x7b26('0x12'));var authService=require(_0x7b26('0x13'));var qs=require(_0x7b26('0x14'));var as=require(_0x7b26('0x15'));var hardwareService=require(_0x7b26('0x16'));var logger=require(_0x7b26('0x17'))(_0x7b26('0x18'));var utils=require(_0x7b26('0x19'));var config=require(_0x7b26('0x1a'));var licenseUtil=require(_0x7b26('0x1b'));var db=require('../../mysqldb')['db'];config[_0x7b26('0x1c')]=_[_0x7b26('0x1d')](config[_0x7b26('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b26('0x1e'))(new Redis(config[_0x7b26('0x1c')]));require(_0x7b26('0x1f'))[_0x7b26('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7b26('0x21')][_0x7b26('0x22')]({'port':0x232c});var client9002=jayson[_0x7b26('0x21')][_0x7b26('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x45054b,_0x42c49b,_0x639625,_0x14edc1){return new BPromise(function(_0x31e4a6,_0x375890){var _0x103482=_0x14edc1||client;return _0x103482[_0x7b26('0x23')](_0x45054b,_0x639625)['then'](function(_0x5b8fe9){logger[_0x7b26('0x24')](_0x7b26('0x25'),_0x42c49b,_0x7b26('0x26'));logger['debug'](_0x7b26('0x27'),_0x42c49b,_0x7b26('0x26'),JSON[_0x7b26('0x28')](_0x5b8fe9));if(_0x5b8fe9[_0x7b26('0x29')]){if(_0x5b8fe9[_0x7b26('0x29')]['code']===0x1f4){logger[_0x7b26('0x29')](_0x7b26('0x25'),_0x42c49b,_0x5b8fe9['error']['message']);return _0x375890(_0x5b8fe9[_0x7b26('0x29')][_0x7b26('0x2a')]);}logger[_0x7b26('0x29')](_0x7b26('0x25'),_0x42c49b,_0x5b8fe9[_0x7b26('0x29')][_0x7b26('0x2a')]);return _0x31e4a6(_0x5b8fe9[_0x7b26('0x29')][_0x7b26('0x2a')]);}else{logger[_0x7b26('0x24')]('FaxAccount,\x20%s,\x20%s',_0x42c49b,_0x7b26('0x26'));_0x31e4a6(_0x5b8fe9[_0x7b26('0x2b')][_0x7b26('0x2a')]);}})[_0x7b26('0x2c')](function(_0xa673ed){logger[_0x7b26('0x29')](_0x7b26('0x25'),_0x42c49b,_0xa673ed);_0x375890(_0xa673ed);});});}function respondWithStatusCode(_0x11dc5e,_0x42b697){_0x42b697=_0x42b697||0xcc;return function(_0x2024a6){if(_0x2024a6){return _0x11dc5e[_0x7b26('0x2d')](_0x42b697);}return _0x11dc5e[_0x7b26('0x2e')](_0x42b697)[_0x7b26('0x2f')]();};}function respondWithResult(_0x1a71e7,_0x2610ef){_0x2610ef=_0x2610ef||0xc8;return function(_0x2aee1b){if(_0x2aee1b){return _0x1a71e7['status'](_0x2610ef)[_0x7b26('0x30')](_0x2aee1b);}};}function respondWithFilteredResult(_0x26ef46,_0x2afcd3){return function(_0x29cd57){if(_0x29cd57){var _0x1c783f=typeof _0x2afcd3['offset']===_0x7b26('0x31')&&typeof _0x2afcd3[_0x7b26('0x32')]===_0x7b26('0x31');var _0x4e2053=_0x29cd57[_0x7b26('0x33')];var _0xcd12bc=_0x1c783f?0x0:_0x2afcd3[_0x7b26('0x34')];var _0x5ed3f4=_0x1c783f?_0x29cd57[_0x7b26('0x33')]:_0x2afcd3[_0x7b26('0x34')]+_0x2afcd3[_0x7b26('0x32')];var _0x9f333b;if(_0x5ed3f4>=_0x4e2053){_0x5ed3f4=_0x4e2053;_0x9f333b=0xc8;}else{_0x9f333b=0xce;}_0x26ef46[_0x7b26('0x2e')](_0x9f333b);return _0x26ef46[_0x7b26('0x35')](_0x7b26('0x36'),_0xcd12bc+'-'+_0x5ed3f4+'/'+_0x4e2053)[_0x7b26('0x30')](_0x29cd57);}return null;};}function patchUpdates(_0x5f16e5){return function(_0xbfc98d){try{jsonpatch[_0x7b26('0x37')](_0xbfc98d,_0x5f16e5,!![]);}catch(_0x7f284c){return BPromise[_0x7b26('0x38')](_0x7f284c);}return _0xbfc98d['save']();};}function saveUpdates(_0x539c2f,_0x19d125){return function(_0x442940){if(_0x442940){return _0x442940[_0x7b26('0x39')](_0x539c2f)['then'](function(_0x3ec609){return _0x3ec609;});}return null;};}function removeEntity(_0x4eb4c4,_0xbfee75){return function(_0x138e4d){if(_0x138e4d){return _0x138e4d[_0x7b26('0x3a')]()[_0x7b26('0x3b')](function(){var _0x13a14f=_0x138e4d['get']({'plain':!![]});var _0x465d52=_0x7b26('0x3c');return db[_0x7b26('0x3d')]['destroy']({'where':{'type':_0x465d52,'resourceId':_0x13a14f['id']}})['then'](function(){return _0x138e4d;});})[_0x7b26('0x3b')](function(){_0x4eb4c4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa8b887,_0x441fd7){return function(_0x19c2c7){if(!_0x19c2c7){_0xa8b887[_0x7b26('0x2d')](0x194);}return _0x19c2c7;};}function handleError(_0x2c83fc,_0x137ab8){_0x137ab8=_0x137ab8||0x1f4;return function(_0x414fef){logger[_0x7b26('0x29')](_0x414fef[_0x7b26('0x3e')]);if(_0x414fef[_0x7b26('0x3f')]){delete _0x414fef[_0x7b26('0x3f')];}_0x2c83fc[_0x7b26('0x2e')](_0x137ab8)['send'](_0x414fef);};}exports[_0x7b26('0x40')]=function(_0x2a666f,_0x65169){var _0x32619e={'include':[{'model':db[_0x7b26('0x41')],'as':'mandatoryDispositionPause'}]},_0x1b0a5b={},_0x4bbb03={'count':0x0,'rows':[]};var _0x5e1091=_[_0x7b26('0x42')](db['FaxAccount'][_0x7b26('0x43')],function(_0x491d35){return{'name':_0x491d35[_0x7b26('0x44')],'type':_0x491d35[_0x7b26('0x45')]['key']};});_0x1b0a5b['model']=_[_0x7b26('0x42')](_0x5e1091,'name');_0x1b0a5b['query']=_[_0x7b26('0x46')](_0x2a666f[_0x7b26('0x47')]);_0x1b0a5b[_0x7b26('0x48')]=_[_0x7b26('0x49')](_0x1b0a5b['model'],_0x1b0a5b[_0x7b26('0x47')]);_0x32619e[_0x7b26('0x4a')]=_[_0x7b26('0x49')](_0x1b0a5b[_0x7b26('0x4b')],qs[_0x7b26('0x4c')](_0x2a666f[_0x7b26('0x47')][_0x7b26('0x4c')]));_0x32619e['attributes']=_0x32619e['attributes'][_0x7b26('0x4d')]?_0x32619e['attributes']:_0x1b0a5b['model'];if(!_0x2a666f['query'][_0x7b26('0x4e')](_0x7b26('0x4f'))){_0x32619e[_0x7b26('0x32')]=qs[_0x7b26('0x32')](_0x2a666f[_0x7b26('0x47')]['limit']);_0x32619e['offset']=qs[_0x7b26('0x34')](_0x2a666f[_0x7b26('0x47')][_0x7b26('0x34')]);}_0x32619e[_0x7b26('0x50')]=qs[_0x7b26('0x51')](_0x2a666f[_0x7b26('0x47')][_0x7b26('0x51')]);_0x32619e[_0x7b26('0x52')]=qs['filters'](_[_0x7b26('0x53')](_0x2a666f['query'],_0x1b0a5b[_0x7b26('0x48')]),_0x5e1091);if(_0x2a666f[_0x7b26('0x47')][_0x7b26('0x54')]){_0x32619e[_0x7b26('0x52')]=_[_0x7b26('0x55')](_0x32619e[_0x7b26('0x52')],{'$or':_[_0x7b26('0x42')](_0x5e1091,function(_0x50e34b){if(_0x50e34b['type']!=='VIRTUAL'){var _0x4b4b99={};_0x4b4b99[_0x50e34b[_0x7b26('0x3f')]]={'$like':'%'+_0x2a666f['query'][_0x7b26('0x54')]+'%'};return _0x4b4b99;}})});}_0x32619e=_['merge']({},_0x32619e,_0x2a666f['options']);var _0x2ec0ce={'where':_0x32619e['where']};return db['FaxAccount'][_0x7b26('0x33')](_0x2ec0ce)[_0x7b26('0x3b')](function(_0xdbab05){_0x4bbb03[_0x7b26('0x33')]=_0xdbab05;if(_0x2a666f[_0x7b26('0x47')][_0x7b26('0x56')]){_0x32619e['include']=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x32619e);})['then'](function(_0x5829a2){_0x4bbb03[_0x7b26('0x57')]=_0x5829a2;return _0x4bbb03;})[_0x7b26('0x3b')](respondWithFilteredResult(_0x65169,_0x32619e))['catch'](handleError(_0x65169,null));};exports[_0x7b26('0x58')]=function(_0x102ff6,_0xeff2ea){var _0x573b12={'raw':![],'where':{'id':_0x102ff6[_0x7b26('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x7b26('0x5a')}]},_0xd410d={};_0xd410d[_0x7b26('0x4b')]=_[_0x7b26('0x46')](db['FaxAccount']['rawAttributes']);_0xd410d[_0x7b26('0x47')]=_[_0x7b26('0x46')](_0x102ff6[_0x7b26('0x47')]);_0xd410d[_0x7b26('0x48')]=_[_0x7b26('0x49')](_0xd410d[_0x7b26('0x4b')],_0xd410d[_0x7b26('0x47')]);_0x573b12['attributes']=_[_0x7b26('0x49')](_0xd410d['model'],qs[_0x7b26('0x4c')](_0x102ff6[_0x7b26('0x47')][_0x7b26('0x4c')]));_0x573b12[_0x7b26('0x4a')]=_0x573b12[_0x7b26('0x4a')]['length']?_0x573b12[_0x7b26('0x4a')]:_0xd410d[_0x7b26('0x4b')];if(_0x102ff6[_0x7b26('0x47')][_0x7b26('0x56')]){_0x573b12[_0x7b26('0x5b')]=[{'all':!![]}];}_0x573b12=_[_0x7b26('0x55')]({},_0x573b12,_0x102ff6['options']);return db[_0x7b26('0x5c')][_0x7b26('0x5d')](_0x573b12)[_0x7b26('0x3b')](handleEntityNotFound(_0xeff2ea,null))[_0x7b26('0x3b')](respondWithResult(_0xeff2ea,null))[_0x7b26('0x2c')](handleError(_0xeff2ea,null));};exports[_0x7b26('0x5e')]=function(_0x246c4c,_0x139600){return db[_0x7b26('0x5c')][_0x7b26('0x5e')](_0x246c4c[_0x7b26('0x5f')],{})['then'](function(_0x1866fa){var _0x5f351e=_0x246c4c[_0x7b26('0x60')][_0x7b26('0x61')]({'plain':!![]});if(!_0x5f351e)throw new Error(_0x7b26('0x62'));if(_0x5f351e[_0x7b26('0x63')]===_0x7b26('0x60')){var _0x25ef2e=_0x1866fa[_0x7b26('0x61')]({'plain':!![]});var _0x4f6041=_0x7b26('0x3c');return db[_0x7b26('0x64')][_0x7b26('0x5d')]({'where':{'name':_0x4f6041,'userProfileId':_0x5f351e[_0x7b26('0x65')]},'raw':!![]})[_0x7b26('0x3b')](function(_0x41f22a){if(_0x41f22a&&_0x41f22a['autoAssociation']===0x0){return db[_0x7b26('0x3d')]['create']({'name':_0x25ef2e[_0x7b26('0x3f')],'resourceId':_0x25ef2e['id'],'type':_0x41f22a[_0x7b26('0x3f')],'sectionId':_0x41f22a['id']},{})[_0x7b26('0x3b')](function(){return _0x1866fa;});}else{return _0x1866fa;}})[_0x7b26('0x2c')](function(_0x1c73c8){logger[_0x7b26('0x29')](_0x7b26('0x66'),_0x1c73c8);throw _0x1c73c8;});}return _0x1866fa;})[_0x7b26('0x3b')](respondWithResult(_0x139600,0xc9))['catch'](handleError(_0x139600,null));};exports['update']=function(_0x5f58ad,_0x12efce){if(_0x5f58ad[_0x7b26('0x5f')]['id']){delete _0x5f58ad[_0x7b26('0x5f')]['id'];}return db[_0x7b26('0x5c')][_0x7b26('0x5d')]({'where':{'id':_0x5f58ad[_0x7b26('0x59')]['id']},'include':[{'model':db[_0x7b26('0x41')],'as':_0x7b26('0x5a')}]})[_0x7b26('0x3b')](handleEntityNotFound(_0x12efce,null))[_0x7b26('0x3b')](saveUpdates(_0x5f58ad[_0x7b26('0x5f')],null))[_0x7b26('0x3b')](respondWithResult(_0x12efce,null))[_0x7b26('0x2c')](handleError(_0x12efce,null));};exports['destroy']=function(_0x5bc191,_0x34d159){return db[_0x7b26('0x5c')][_0x7b26('0x5d')]({'where':{'id':_0x5bc191[_0x7b26('0x59')]['id']}})[_0x7b26('0x3b')](handleEntityNotFound(_0x34d159,null))[_0x7b26('0x3b')](removeEntity(_0x34d159,null))['catch'](handleError(_0x34d159,null));};exports[_0x7b26('0x67')]=function(_0x131734,_0x2f0089){return db[_0x7b26('0x5c')][_0x7b26('0x67')]()[_0x7b26('0x3b')](respondWithResult(_0x2f0089,null))[_0x7b26('0x2c')](handleError(_0x2f0089,null));};exports[_0x7b26('0x68')]=function(_0x5b0515,_0x153fe3,_0x5ad331){if(_0x5b0515[_0x7b26('0x5f')]['id']){delete _0x5b0515[_0x7b26('0x5f')]['id'];}return db[_0x7b26('0x5c')][_0x7b26('0x5d')]({'where':{'id':_0x5b0515[_0x7b26('0x59')]['id']}})['then'](handleEntityNotFound(_0x153fe3,null))[_0x7b26('0x3b')](function(_0x5de9c5){if(_0x5de9c5){_0x5b0515[_0x7b26('0x5f')]['FaxAccountId']=_0x5de9c5['id'];return db[_0x7b26('0x69')][_0x7b26('0x5e')](_0x5b0515['body']);}})[_0x7b26('0x3b')](respondWithResult(_0x153fe3,null))[_0x7b26('0x2c')](handleError(_0x153fe3,null));};exports[_0x7b26('0x6a')]=function(_0x4bedad,_0x386b2c,_0x43f120){var _0x5a56c2={'raw':![],'where':{}};var _0x26bdff={};var _0x383ac2={'count':0x0,'rows':[]};return db[_0x7b26('0x5c')]['findOne']({'where':{'id':_0x4bedad['params']['id']}})[_0x7b26('0x3b')](handleEntityNotFound(_0x386b2c,null))[_0x7b26('0x3b')](function(_0xdf5561){if(_0xdf5561){_0x26bdff['model']=_[_0x7b26('0x46')](db[_0x7b26('0x69')][_0x7b26('0x43')]);_0x26bdff[_0x7b26('0x47')]=_[_0x7b26('0x46')](_0x4bedad[_0x7b26('0x47')]);_0x26bdff[_0x7b26('0x48')]=_[_0x7b26('0x49')](_0x26bdff['model'],_0x26bdff['query']);_0x5a56c2['attributes']=_[_0x7b26('0x49')](_0x26bdff['model'],qs[_0x7b26('0x4c')](_0x4bedad[_0x7b26('0x47')][_0x7b26('0x4c')]));_0x5a56c2[_0x7b26('0x4a')]=_0x5a56c2[_0x7b26('0x4a')][_0x7b26('0x4d')]?_0x5a56c2[_0x7b26('0x4a')]:_0x26bdff[_0x7b26('0x4b')];if(!_0x4bedad[_0x7b26('0x47')][_0x7b26('0x4e')](_0x7b26('0x4f'))){_0x5a56c2['limit']=qs[_0x7b26('0x32')](_0x4bedad[_0x7b26('0x47')][_0x7b26('0x32')]);_0x5a56c2[_0x7b26('0x34')]=qs[_0x7b26('0x34')](_0x4bedad[_0x7b26('0x47')][_0x7b26('0x34')]);}_0x5a56c2[_0x7b26('0x50')]=qs['sort'](_0x4bedad[_0x7b26('0x47')]['sort']);_0x5a56c2[_0x7b26('0x52')]=qs[_0x7b26('0x48')](_[_0x7b26('0x53')](_0x4bedad[_0x7b26('0x47')],_0x26bdff[_0x7b26('0x48')]));_0x5a56c2[_0x7b26('0x52')][_0x7b26('0x6b')]=_0xdf5561['id'];if(_0x4bedad[_0x7b26('0x47')][_0x7b26('0x54')]){_0x5a56c2[_0x7b26('0x52')]=_[_0x7b26('0x55')](_0x5a56c2[_0x7b26('0x52')],{'$or':_[_0x7b26('0x42')](_0x5a56c2['attributes'],function(_0x58548e){var _0x1cb1ed={};_0x1cb1ed[_0x58548e]={'$like':'%'+_0x4bedad[_0x7b26('0x47')][_0x7b26('0x54')]+'%'};return _0x1cb1ed;})});}_0x5a56c2=_[_0x7b26('0x55')]({},_0x5a56c2,_0x4bedad[_0x7b26('0x6c')]);return db['Disposition'][_0x7b26('0x33')]({'where':_0x5a56c2[_0x7b26('0x52')]})['then'](function(_0x560c01){_0x383ac2[_0x7b26('0x33')]=_0x560c01;if(_0x4bedad[_0x7b26('0x47')]['includeAll']){_0x5a56c2[_0x7b26('0x5b')]=[{'all':!![]}];}return db[_0x7b26('0x69')][_0x7b26('0x6d')](_0x5a56c2);})[_0x7b26('0x3b')](function(_0x28b992){_0x383ac2[_0x7b26('0x57')]=_0x28b992;return _0x383ac2;});}})[_0x7b26('0x3b')](respondWithFilteredResult(_0x386b2c,_0x5a56c2))[_0x7b26('0x2c')](handleError(_0x386b2c,null));};exports['removeDispositions']=function(_0x3be5e9,_0x50733a,_0x141b4e){return db[_0x7b26('0x5c')]['find']({'where':{'id':_0x3be5e9['params']['id']}})[_0x7b26('0x3b')](handleEntityNotFound(_0x50733a,null))[_0x7b26('0x3b')](function(_0x306b84){if(_0x306b84){return _0x306b84[_0x7b26('0x6e')](_0x3be5e9[_0x7b26('0x47')][_0x7b26('0x6f')]);}})['then'](respondWithStatusCode(_0x50733a,null))['catch'](handleError(_0x50733a,null));};exports[_0x7b26('0x70')]=function(_0x36af1f,_0x3100f7,_0x5a1bb0){if(_0x36af1f[_0x7b26('0x5f')]['id']){delete _0x36af1f[_0x7b26('0x5f')]['id'];}return db[_0x7b26('0x5c')][_0x7b26('0x5d')]({'where':{'id':_0x36af1f['params']['id']}})['then'](handleEntityNotFound(_0x3100f7,null))[_0x7b26('0x3b')](function(_0x1d91d2){if(_0x1d91d2){_0x36af1f[_0x7b26('0x5f')]['FaxAccountId']=_0x1d91d2['id'];return db[_0x7b26('0x71')][_0x7b26('0x5e')](_0x36af1f[_0x7b26('0x5f')]);}})[_0x7b26('0x3b')](respondWithResult(_0x3100f7,null))['catch'](handleError(_0x3100f7,null));};exports['getAnswers']=function(_0x182cbb,_0x1789b0,_0x247e74){var _0x637ff6={'raw':![],'where':{}};var _0x24ef67={};var _0x2411bc={'count':0x0,'rows':[]};return db[_0x7b26('0x5c')]['findOne']({'where':{'id':_0x182cbb['params']['id']}})[_0x7b26('0x3b')](handleEntityNotFound(_0x1789b0,null))['then'](function(_0x199c49){if(_0x199c49){_0x24ef67[_0x7b26('0x4b')]=_[_0x7b26('0x46')](db[_0x7b26('0x71')][_0x7b26('0x43')]);_0x24ef67[_0x7b26('0x47')]=_[_0x7b26('0x46')](_0x182cbb[_0x7b26('0x47')]);_0x24ef67['filters']=_[_0x7b26('0x49')](_0x24ef67[_0x7b26('0x4b')],_0x24ef67['query']);_0x637ff6['attributes']=_[_0x7b26('0x49')](_0x24ef67[_0x7b26('0x4b')],qs[_0x7b26('0x4c')](_0x182cbb['query']['fields']));_0x637ff6[_0x7b26('0x4a')]=_0x637ff6[_0x7b26('0x4a')][_0x7b26('0x4d')]?_0x637ff6[_0x7b26('0x4a')]:_0x24ef67[_0x7b26('0x4b')];if(!_0x182cbb['query'][_0x7b26('0x4e')](_0x7b26('0x4f'))){_0x637ff6['limit']=qs[_0x7b26('0x32')](_0x182cbb['query'][_0x7b26('0x32')]);_0x637ff6[_0x7b26('0x34')]=qs[_0x7b26('0x34')](_0x182cbb[_0x7b26('0x47')][_0x7b26('0x34')]);}_0x637ff6[_0x7b26('0x50')]=qs['sort'](_0x182cbb[_0x7b26('0x47')]['sort']);_0x637ff6[_0x7b26('0x52')]=qs['filters'](_[_0x7b26('0x53')](_0x182cbb['query'],_0x24ef67[_0x7b26('0x48')]));_0x637ff6[_0x7b26('0x52')]['FaxAccountId']=_0x199c49['id'];if(_0x182cbb[_0x7b26('0x47')][_0x7b26('0x54')]){_0x637ff6['where']=_['merge'](_0x637ff6[_0x7b26('0x52')],{'$or':_[_0x7b26('0x42')](_0x637ff6['attributes'],function(_0x29e7e6){var _0x278dc7={};_0x278dc7[_0x29e7e6]={'$like':'%'+_0x182cbb[_0x7b26('0x47')][_0x7b26('0x54')]+'%'};return _0x278dc7;})});}_0x637ff6=_[_0x7b26('0x55')]({},_0x637ff6,_0x182cbb[_0x7b26('0x6c')]);return db[_0x7b26('0x71')][_0x7b26('0x33')]({'where':_0x637ff6[_0x7b26('0x52')]})[_0x7b26('0x3b')](function(_0xb26d95){_0x2411bc['count']=_0xb26d95;if(_0x182cbb[_0x7b26('0x47')]['includeAll']){_0x637ff6[_0x7b26('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7b26('0x6d')](_0x637ff6);})['then'](function(_0x1c0948){_0x2411bc[_0x7b26('0x57')]=_0x1c0948;return _0x2411bc;});}})[_0x7b26('0x3b')](respondWithFilteredResult(_0x1789b0,_0x637ff6))[_0x7b26('0x2c')](handleError(_0x1789b0,null));};exports[_0x7b26('0x72')]=function(_0x4fc84f,_0x50d0db,_0x2c0256){return db[_0x7b26('0x5c')]['find']({'where':{'id':_0x4fc84f[_0x7b26('0x59')]['id']}})[_0x7b26('0x3b')](handleEntityNotFound(_0x50d0db,null))[_0x7b26('0x3b')](function(_0x47621c){if(_0x47621c){return _0x47621c[_0x7b26('0x72')](_0x4fc84f[_0x7b26('0x47')][_0x7b26('0x6f')]);}})['then'](respondWithStatusCode(_0x50d0db,null))['catch'](handleError(_0x50d0db,null));};exports['addInteraction']=function(_0x14425d,_0x218537,_0x1190fc){return db[_0x7b26('0x73')][_0x7b26('0x5d')]({'where':{'id':_0x14425d[_0x7b26('0x59')]['id']}})['then'](handleEntityNotFound(_0x218537,null))[_0x7b26('0x3b')](function(_0x202bf9){if(_0x202bf9){return _0x202bf9[_0x7b26('0x74')](_0x14425d['body'][_0x7b26('0x6f')],_[_0x7b26('0x75')](_0x14425d[_0x7b26('0x5f')],[_0x7b26('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x218537,null))[_0x7b26('0x2c')](handleError(_0x218537,null));};exports[_0x7b26('0x76')]=function(_0x5e4c5c,_0x3cb4d2,_0xba07b3){var _0x51f2b9={'raw':![],'where':{}};var _0xec6f27={};var _0x4ba921={'count':0x0,'rows':[]};return db[_0x7b26('0x5c')]['findOne']({'where':{'id':_0x5e4c5c[_0x7b26('0x59')]['id']}})[_0x7b26('0x3b')](handleEntityNotFound(_0x3cb4d2,null))[_0x7b26('0x3b')](function(_0x3c0528){if(_0x3c0528){_0xec6f27[_0x7b26('0x4b')]=_[_0x7b26('0x46')](db[_0x7b26('0x73')]['rawAttributes']);_0xec6f27[_0x7b26('0x47')]=_[_0x7b26('0x46')](_0x5e4c5c[_0x7b26('0x47')]);_0xec6f27[_0x7b26('0x48')]=_[_0x7b26('0x49')](_0xec6f27['model'],_0xec6f27[_0x7b26('0x47')]);_0x51f2b9[_0x7b26('0x4a')]=_['intersection'](_0xec6f27[_0x7b26('0x4b')],qs[_0x7b26('0x4c')](_0x5e4c5c['query'][_0x7b26('0x4c')]));_0x51f2b9[_0x7b26('0x4a')]=_0x51f2b9[_0x7b26('0x4a')][_0x7b26('0x4d')]?_0x51f2b9[_0x7b26('0x4a')]:_0xec6f27[_0x7b26('0x4b')];if(!_0x5e4c5c[_0x7b26('0x47')][_0x7b26('0x4e')](_0x7b26('0x4f'))){_0x51f2b9[_0x7b26('0x32')]=qs[_0x7b26('0x32')](_0x5e4c5c['query'][_0x7b26('0x32')]);_0x51f2b9[_0x7b26('0x34')]=qs[_0x7b26('0x34')](_0x5e4c5c[_0x7b26('0x47')]['offset']);}_0x51f2b9[_0x7b26('0x50')]=qs['sort'](_0x5e4c5c['query'][_0x7b26('0x51')]);_0x51f2b9[_0x7b26('0x52')]=qs['filters'](_[_0x7b26('0x53')](_0x5e4c5c[_0x7b26('0x47')],_0xec6f27[_0x7b26('0x48')]));_0x51f2b9['where'][_0x7b26('0x6b')]=_0x3c0528['id'];if(_0x5e4c5c[_0x7b26('0x47')]['filter']){_0x51f2b9[_0x7b26('0x52')]=_[_0x7b26('0x55')](_0x51f2b9[_0x7b26('0x52')],{'$or':_[_0x7b26('0x42')](_0x51f2b9[_0x7b26('0x4a')],function(_0x5e6442){var _0x2e62f6={};_0x2e62f6[_0x5e6442]={'$like':'%'+_0x5e4c5c[_0x7b26('0x47')][_0x7b26('0x54')]+'%'};return _0x2e62f6;})});}_0x51f2b9=_[_0x7b26('0x55')]({},_0x51f2b9,_0x5e4c5c[_0x7b26('0x6c')]);return db[_0x7b26('0x73')][_0x7b26('0x33')]({'where':_0x51f2b9['where']})['then'](function(_0x186005){_0x4ba921[_0x7b26('0x33')]=_0x186005;if(_0x5e4c5c[_0x7b26('0x47')][_0x7b26('0x56')]){_0x51f2b9[_0x7b26('0x5b')]=[{'model':db[_0x7b26('0x77')],'as':_0x7b26('0x78'),'required':![]},{'model':db[_0x7b26('0x79')],'as':_0x7b26('0x7a'),'attributes':[_0x7b26('0x3f'),_0x7b26('0x7b'),'internal'],'required':![]},{'model':db[_0x7b26('0x7c')],'as':_0x7b26('0x7d'),'attributes':['id',_0x7b26('0x3f'),_0x7b26('0x7e')],'where':_0x5e4c5c[_0x7b26('0x47')][_0x7b26('0x7f')]?{'id':_0x5e4c5c[_0x7b26('0x47')][_0x7b26('0x7f')]}:undefined,'required':_0x5e4c5c['query'][_0x7b26('0x7f')]?!![]:![]}];}return db[_0x7b26('0x73')]['findAll'](_0x51f2b9);})[_0x7b26('0x3b')](function(_0x260967){_0x4ba921[_0x7b26('0x57')]=_0x260967;return _0x4ba921;});}})[_0x7b26('0x3b')](respondWithFilteredResult(_0x3cb4d2,_0x51f2b9))[_0x7b26('0x2c')](handleError(_0x3cb4d2,null));};exports[_0x7b26('0x80')]=function(_0x5ed99c,_0x14e76e){var _0x87b72b=_0x5ed99c['params']['id'];var _0x4c9ee4=_0x5ed99c[_0x7b26('0x5f')];var _0x2fc047=0xc8;var _0x25b6f5=null;return db[_0x7b26('0x81')][_0x7b26('0x82')]({'isolationLevel':db['sequelize'][_0x7b26('0x83')][_0x7b26('0x84')][_0x7b26('0x85')]},function(_0x493a5e){return db[_0x7b26('0x5c')][_0x7b26('0x86')]({'where':{'id':_0x87b72b},'transaction':_0x493a5e})['then'](function(_0x181583){if(_0x181583){return db[_0x7b26('0x87')][_0x7b26('0x3a')]({'where':{'FaxAccountId':_0x87b72b},'transaction':_0x493a5e})[_0x7b26('0x3b')](function(){var _0x2d4e21=_[_0x7b26('0x42')](_0x4c9ee4,function(_0x460db1){_0x460db1[_0x7b26('0x6b')]=_0x87b72b;return _0x460db1;});return db[_0x7b26('0x87')][_0x7b26('0x88')](_0x2d4e21,{'transaction':_0x493a5e});});}else{_0x2fc047=0x194;_0x25b6f5=[];}});})[_0x7b26('0x3b')](function(){if(_0x2fc047!==0x194){return db[_0x7b26('0x87')][_0x7b26('0x89')]({'where':{'FaxAccountId':_0x87b72b},'order':'priority'})[_0x7b26('0x3b')](function(_0xbf3e52){_0x25b6f5=_0xbf3e52;});}})[_0x7b26('0x2c')](function(_0x504c56){_0x2fc047=0x1f4;logger[_0x7b26('0x29')](_0x504c56['stack']);if(_0x504c56['name']){delete _0x504c56[_0x7b26('0x3f')];}_0x25b6f5=_0x504c56;})['finally'](function(){if(_0x25b6f5===null){_0x14e76e[_0x7b26('0x2d')](_0x2fc047);}else{if(_0x2fc047===0x1f4){_0x14e76e[_0x7b26('0x2e')](_0x2fc047)[_0x7b26('0x8a')](_0x25b6f5);}else{_0x14e76e[_0x7b26('0x2e')](_0x2fc047)['json'](_0x25b6f5);}}});};exports[_0x7b26('0x8b')]=function(_0x148ef6,_0x457c40,_0x499901){var _0x4c06a4={};var _0x2af457={};var _0x179ac4;var _0xa256fb;return db['FaxAccount'][_0x7b26('0x86')]({'where':{'id':_0x148ef6[_0x7b26('0x59')]['id']}})[_0x7b26('0x3b')](handleEntityNotFound(_0x457c40,null))[_0x7b26('0x3b')](function(_0x21fb76){if(_0x21fb76){_0x179ac4=_0x21fb76;_0x2af457[_0x7b26('0x4b')]=_['keys'](db['FaxApplication'][_0x7b26('0x43')]);_0x2af457[_0x7b26('0x47')]=_['keys'](_0x148ef6[_0x7b26('0x47')]);_0x2af457[_0x7b26('0x48')]=_[_0x7b26('0x49')](_0x2af457['model'],_0x2af457['query']);_0x4c06a4[_0x7b26('0x4a')]=_[_0x7b26('0x49')](_0x2af457[_0x7b26('0x4b')],qs[_0x7b26('0x4c')](_0x148ef6[_0x7b26('0x47')][_0x7b26('0x4c')]));_0x4c06a4['attributes']=_0x4c06a4[_0x7b26('0x4a')][_0x7b26('0x4d')]?_0x4c06a4['attributes']:_0x2af457[_0x7b26('0x4b')];_0x4c06a4[_0x7b26('0x50')]=qs[_0x7b26('0x51')](_0x148ef6['query'][_0x7b26('0x51')]);_0x4c06a4[_0x7b26('0x52')]=qs['filters'](_[_0x7b26('0x53')](_0x148ef6[_0x7b26('0x47')],_0x2af457[_0x7b26('0x48')]));if(_0x148ef6[_0x7b26('0x47')][_0x7b26('0x54')]){_0x4c06a4['where']=_[_0x7b26('0x55')](_0x4c06a4[_0x7b26('0x52')],{'$or':_[_0x7b26('0x42')](_0x4c06a4[_0x7b26('0x4a')],function(_0x32d929){var _0x4436f9={};_0x4436f9[_0x32d929]={'$like':'%'+_0x148ef6[_0x7b26('0x47')][_0x7b26('0x54')]+'%'};return _0x4436f9;})});}_0x4c06a4=_['merge']({},_0x4c06a4,_0x148ef6[_0x7b26('0x6c')]);return _0x179ac4[_0x7b26('0x8b')](_0x4c06a4);}})[_0x7b26('0x3b')](function(_0x5e63f1){if(_0x5e63f1){_0xa256fb=_0x5e63f1[_0x7b26('0x4d')];if(!_0x148ef6[_0x7b26('0x47')]['hasOwnProperty'](_0x7b26('0x4f'))){_0x4c06a4[_0x7b26('0x32')]=qs[_0x7b26('0x32')](_0x148ef6[_0x7b26('0x47')][_0x7b26('0x32')]);_0x4c06a4[_0x7b26('0x34')]=qs[_0x7b26('0x34')](_0x148ef6[_0x7b26('0x47')][_0x7b26('0x34')]);}return _0x179ac4[_0x7b26('0x8b')](_0x4c06a4);}})[_0x7b26('0x3b')](function(_0x2d2d94){if(_0x2d2d94){return _0x2d2d94?{'count':_0xa256fb,'rows':_0x2d2d94}:null;}})[_0x7b26('0x3b')](respondWithResult(_0x457c40,null))[_0x7b26('0x2c')](handleError(_0x457c40,null));};function Extension(_0x4a043e,_0x3598e8,_0x163735,_0x4bdaf1){this[_0x7b26('0x8c')]='from-voip-provider';this[_0x7b26('0x8d')]=_0x4a043e[_0x7b26('0x8e')];this['app']=_0x4bdaf1;this[_0x7b26('0x45')]=_0x7b26('0x8f');this['description']=_0x7b26('0x90');this[_0x7b26('0x6b')]=_0x4a043e['id'];this[_0x7b26('0x91')]=_0x3598e8;this[_0x7b26('0x92')]=_0x163735;}function createExtensionsReciveFax(_0x1f3cd6){var _0x374463=0x1;var _0x380a7b=[];_0x380a7b[_0x7b26('0x93')](new Extension(_0x1f3cd6,_0x374463,'',_0x7b26('0x94')));_0x374463+=0x1;_0x380a7b[_0x7b26('0x93')](new Extension(_0x1f3cd6,_0x374463,'CDR(type)=inbound-fax',_0x7b26('0x95')));_0x374463+=0x1;for(var _0x2776e7 in _0x1f3cd6){if(_0x1f3cd6[_0x7b26('0x4e')](_0x2776e7)&&(_0x2776e7===_0x7b26('0x96')||_0x2776e7===_0x7b26('0x8e')||_0x2776e7===_0x7b26('0x97')||_0x2776e7===_0x7b26('0x98')||_0x2776e7==='headerinfo'||_0x2776e7===_0x7b26('0x99')||_0x2776e7===_0x7b26('0x9a')||_0x2776e7===_0x7b26('0x9b')||_0x2776e7===_0x7b26('0x9c'))){_0x380a7b['push'](new Extension(_0x1f3cd6,_0x374463,_0x7b26('0x9d')+_0x2776e7+')='+_0x1f3cd6[_0x2776e7],_0x7b26('0x95')));_0x374463+=0x1;}}_0x380a7b[_0x7b26('0x93')](new Extension(_0x1f3cd6,_0x374463,'6',_0x7b26('0x9e')));_0x374463+=0x1;_0x380a7b[_0x7b26('0x93')](new Extension(_0x1f3cd6,_0x374463,_0x7b26('0x9f'),_0x7b26('0xa0')));_0x374463=0x0;return _0x380a7b;}exports[_0x7b26('0xa1')]=function(_0x394d3e,_0x1a6851,_0x19e974){var _0x2c313b;return db['sequelize'][_0x7b26('0x82')](function(_0x403721){return db['FaxAccount'][_0x7b26('0x5e')](_0x394d3e[_0x7b26('0x5f')],{'transaction':_0x403721})[_0x7b26('0x3b')](function(_0x5d6bca){_0x2c313b=_0x5d6bca[_0x7b26('0x61')]({'plain':!![]});return db[_0x7b26('0xa2')][_0x7b26('0x88')](createExtensionsReciveFax(_0x2c313b),{'transaction':_0x403721});});})[_0x7b26('0x3b')](function(){return _0x2c313b;})[_0x7b26('0x3b')](respondWithResult(_0x1a6851,null))[_0x7b26('0x2c')](handleError(_0x1a6851,null));};exports[_0x7b26('0xa3')]=function(_0x2eb4bc,_0x13299c,_0x3ee801){var _0x77139;return db[_0x7b26('0x81')][_0x7b26('0x82')](function(_0x2f27e4){return db['FaxAccount']['update'](_0x2eb4bc[_0x7b26('0x5f')],{'where':{'id':_0x2eb4bc[_0x7b26('0x5f')]['id']},'transaction':_0x2f27e4})[_0x7b26('0x3b')](function(_0x3ddd36){return db['VoiceExtension'][_0x7b26('0x3a')]({'where':{'FaxAccountId':_0x2eb4bc[_0x7b26('0x5f')]['id']},'transaction':_0x2f27e4})[_0x7b26('0x3b')](function(_0x2dc410){return db[_0x7b26('0xa2')][_0x7b26('0x88')](createExtensionsReciveFax(_[_0x7b26('0x75')](_0x2eb4bc['body'],['tech',_0x7b26('0xa4'),_0x7b26('0xa5'),'updatedAt',_0x7b26('0xa6'),_0x7b26('0xa7')])),{'transaction':_0x2f27e4});});});})[_0x7b26('0x3b')](function(){return db['FaxAccount'][_0x7b26('0xa8')](_0x2eb4bc[_0x7b26('0x5f')]['id']);})[_0x7b26('0x3b')](respondWithResult(_0x13299c,null))[_0x7b26('0x2c')](handleError(_0x13299c,null));};exports['getMessages']=function(_0x30f847,_0x583fcb,_0x276603){var _0x3e9bb0={'raw':!![],'where':{}};var _0x5364f0={};var _0x5898ec={'count':0x0,'rows':[]};return db[_0x7b26('0x5c')][_0x7b26('0x86')]({'where':{'id':_0x30f847[_0x7b26('0x59')]['id']}})[_0x7b26('0x3b')](handleEntityNotFound(_0x583fcb,null))[_0x7b26('0x3b')](function(_0x52ea71){if(_0x52ea71){_0x5364f0[_0x7b26('0x4b')]=_[_0x7b26('0x46')](db['FaxMessage'][_0x7b26('0x43')]);_0x5364f0['query']=_[_0x7b26('0x46')](_0x30f847[_0x7b26('0x47')]);_0x5364f0[_0x7b26('0x48')]=_[_0x7b26('0x49')](_0x5364f0[_0x7b26('0x4b')],_0x5364f0[_0x7b26('0x47')]);_0x3e9bb0['attributes']=_[_0x7b26('0x49')](_0x5364f0[_0x7b26('0x4b')],qs[_0x7b26('0x4c')](_0x30f847['query'][_0x7b26('0x4c')]));_0x3e9bb0[_0x7b26('0x4a')]=_0x3e9bb0[_0x7b26('0x4a')][_0x7b26('0x4d')]?_0x3e9bb0[_0x7b26('0x4a')]:_0x5364f0[_0x7b26('0x4b')];if(!_0x30f847[_0x7b26('0x47')]['hasOwnProperty'](_0x7b26('0x4f'))){_0x3e9bb0[_0x7b26('0x32')]=qs[_0x7b26('0x32')](_0x30f847['query'][_0x7b26('0x32')]);_0x3e9bb0[_0x7b26('0x34')]=qs[_0x7b26('0x34')](_0x30f847[_0x7b26('0x47')][_0x7b26('0x34')]);}_0x3e9bb0[_0x7b26('0x50')]=qs[_0x7b26('0x51')](_0x30f847[_0x7b26('0x47')][_0x7b26('0x51')]);_0x3e9bb0[_0x7b26('0x52')]=qs['filters'](_['pick'](_0x30f847['query'],_0x5364f0[_0x7b26('0x48')]));_0x3e9bb0[_0x7b26('0x52')]['FaxAccountId']=_0x52ea71['id'];if(_0x30f847['query'][_0x7b26('0x54')]){_0x3e9bb0[_0x7b26('0x52')]=_[_0x7b26('0x55')](_0x3e9bb0['where'],{'$or':_[_0x7b26('0x42')](_0x3e9bb0[_0x7b26('0x4a')],function(_0x413aad){var _0x411043={};_0x411043[_0x413aad]={'$like':'%'+_0x30f847[_0x7b26('0x47')][_0x7b26('0x54')]+'%'};return _0x411043;})});}if(_0x30f847[_0x7b26('0x47')]['$gte']){var _0x48b60b=_0x30f847[_0x7b26('0x47')][_0x7b26('0xa9')][_0x7b26('0xaa')](',');var _0x143b9a={};_0x143b9a[_0x48b60b[0x0]]={'$gte':moment(_0x48b60b[0x1])[_0x7b26('0xab')](_0x7b26('0xac'))};_0x3e9bb0[_0x7b26('0x52')]=_[_0x7b26('0x55')](_0x3e9bb0[_0x7b26('0x52')],_0x143b9a);}_0x3e9bb0=_[_0x7b26('0x55')]({},_0x3e9bb0,_0x30f847[_0x7b26('0x6c')]);return db[_0x7b26('0xad')][_0x7b26('0x33')]({'where':_0x3e9bb0[_0x7b26('0x52')]})['then'](function(_0x301d4f){_0x5898ec[_0x7b26('0x33')]=_0x301d4f;if(_0x30f847['query'][_0x7b26('0x56')]){_0x3e9bb0[_0x7b26('0x5b')]=[{'all':!![]}];}return db['FaxMessage'][_0x7b26('0x6d')](_0x3e9bb0);})[_0x7b26('0x3b')](function(_0x53754e){_0x5898ec[_0x7b26('0x57')]=_0x53754e;return _0x5898ec;});}})[_0x7b26('0x3b')](respondWithFilteredResult(_0x583fcb,_0x3e9bb0))[_0x7b26('0x2c')](handleError(_0x583fcb,null));};exports[_0x7b26('0x8a')]=function(_0x4cfe45,_0x5846ad,_0xcb1a7){var _0x50e238,_0x434b1e={},_0x3af102;if(_0x4cfe45[_0x7b26('0x5f')]['to']){_0x3af102=_0x4cfe45['body']['to'][0x0];}return db['FaxAccount'][_0x7b26('0x5d')]({'where':{'id':_0x4cfe45[_0x7b26('0x59')]['id']},'include':[{'model':db[_0x7b26('0xae')],'as':'List','include':[{'model':db[_0x7b26('0x77')],'as':'Contacts','where':{'fax':_0x3af102},'limit':0x1,'order':[[_0x7b26('0xaf'),_0x7b26('0xb0')]]}]}]})[_0x7b26('0x3b')](handleEntityNotFound(_0x5846ad,null))[_0x7b26('0x3b')](function(_0x36ee37){_0x50e238=_0x36ee37;if(_0x4cfe45['body'][_0x7b26('0xb1')]&&_0x4cfe45[_0x7b26('0x5f')][_0x7b26('0xb1')][_0x7b26('0x4d')]){for(var _0x29ec84=0x0;_0x29ec84<_0x4cfe45[_0x7b26('0x5f')][_0x7b26('0xb1')][_0x7b26('0x4d')];_0x29ec84+=0x1){_0x4cfe45['body'][_0x7b26('0xb1')][_0x29ec84]={'filename':_0x4cfe45[_0x7b26('0x5f')]['attachments'][_0x29ec84][_0x7b26('0x3f')],'id':_0x4cfe45['body'][_0x7b26('0xb1')][_0x29ec84]['id'],'path':path[_0x7b26('0xb2')](config[_0x7b26('0xb3')],_0x7b26('0xb4'),_0x4cfe45[_0x7b26('0x5f')]['attachments'][_0x29ec84][_0x7b26('0xb5')])};}}return respondWithRpcPromise('CheckAfterSend',_0x7b26('0xb6'),{'FaxAccountId':_[_0x7b26('0xb7')](_0x4cfe45[_0x7b26('0x59')]['id'])?undefined:_0x4cfe45[_0x7b26('0x59')]['id'],'path':_[_0x7b26('0xb7')](_0x4cfe45[_0x7b26('0x5f')]['attachments'][0x0][_0x7b26('0x6')])?undefined:_0x4cfe45[_0x7b26('0x5f')][_0x7b26('0xb1')][0x0]['path'],'fax':_['isNil'](_0x4cfe45['body']['to'][0x0])?undefined:_0x4cfe45[_0x7b26('0x5f')]['to'][0x0]},client9002);})[_0x7b26('0x3b')](function(){if(_0x50e238){if(_[_0x7b26('0xb7')](_0x4cfe45['body']['from'])){_0x4cfe45['body']['from']=util[_0x7b26('0xab')]('\x22%s\x22\x20<%s>',_0x50e238[_0x7b26('0x3f')],_0x50e238['fax']);}if(_0x50e238['List']){if(_0x50e238[_0x7b26('0xb8')][_0x7b26('0xb9')]['length']){return _0x50e238[_0x7b26('0xb8')][_0x7b26('0xb9')][0x0];}else{return db['CmContact'][_0x7b26('0x5e')](_['defaults'](_0x4cfe45[_0x7b26('0x5f')],{'firstName':_0x4cfe45[_0x7b26('0x5f')]['to'][0x0],'phone':_0x4cfe45[_0x7b26('0x5f')]['to'][0x0],'fax':_0x4cfe45[_0x7b26('0x5f')]['to'][0x0],'ListId':_0x50e238[_0x7b26('0xa7')]}));}}else{throw new Error(_0x7b26('0xba'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x7b26('0x3b')](function(_0x271093){if(_0x271093){return db[_0x7b26('0x73')][_0x7b26('0x5d')]({'where':{'ContactId':_0x271093['id'],'closed':![],'FaxAccountId':_0x50e238['id']}})[_0x7b26('0x3b')](function(_0x5785a4){if(_0x5785a4){return[_0x5785a4,![]];}return db[_0x7b26('0x73')][_0x7b26('0x5e')]({'UserId':_0x4cfe45['user']['id'],'ContactId':_0x271093['id'],'FaxAccountId':_0x50e238['id'],'fax':_0x4cfe45[_0x7b26('0x5f')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x7b26('0x55')](_0x4cfe45['body'],{'read':![],'body':_0x4cfe45[_0x7b26('0x5f')][_0x7b26('0xb1')][0x0][_0x7b26('0xbb')],'FaxAccountId':_0x50e238['id'],'UserId':_0x4cfe45[_0x7b26('0x60')]['id'],'ContactId':_0x271093['id'],'AttachmentId':_0x4cfe45[_0x7b26('0x5f')][_0x7b26('0xb1')][0x0]['id']})]},{'include':[{'model':db[_0x7b26('0xad')],'as':'Messages'}]})[_0x7b26('0x3b')](function(_0x58a9cd){return[_0x58a9cd,!![]];});});}else{throw new Error(_0x7b26('0xbc'));}})[_0x7b26('0xbd')](function(_0x24d7c4,_0x5f1bf3){if(_0x5f1bf3){return _0x24d7c4;}return db[_0x7b26('0xad')][_0x7b26('0x5e')]({'direction':_0x7b26('0xbe'),'read':![],'body':_0x4cfe45['body']['attachments'][0x0][_0x7b26('0xbb')],'FaxAccountId':_0x50e238['id'],'FaxInteractionId':_0x24d7c4['id'],'UserId':_0x4cfe45[_0x7b26('0x60')]['id'],'ContactId':_0x24d7c4[_0x7b26('0xbf')],'AttachmentId':_0x4cfe45[_0x7b26('0x5f')][_0x7b26('0xb1')][0x0]['id']})['then'](function(_0x3da26e){_0x24d7c4[_0x7b26('0xc0')]['Messages']=[];_0x24d7c4[_0x7b26('0xc0')]['Messages'][_0x7b26('0x93')](_0x3da26e[_0x7b26('0xc0')]);return _0x24d7c4;});})['then'](function(_0x38cbc7){respondWithRpcPromise(_0x7b26('0xc1'),'SendFax',{'FaxAccountId':_[_0x7b26('0xb7')](_0x4cfe45[_0x7b26('0x59')]['id'])?undefined:_0x4cfe45[_0x7b26('0x59')]['id'],'path':_[_0x7b26('0xb7')](_0x4cfe45['body'][_0x7b26('0xb1')][0x0][_0x7b26('0x6')])?undefined:_0x4cfe45[_0x7b26('0x5f')][_0x7b26('0xb1')][0x0][_0x7b26('0x6')],'fax':_['isNil'](_0x4cfe45[_0x7b26('0x5f')]['to'][0x0])?undefined:_0x4cfe45[_0x7b26('0x5f')]['to'][0x0],'AttachmentId':_0x4cfe45[_0x7b26('0x5f')][_0x7b26('0xb1')][0x0]['id']},client9002)['then'](function(_0x56aaf2){logger[_0x7b26('0x24')](_0x7b26('0xc2'),_0x56aaf2);})['catch'](function(_0x2cfad3){logger['info'](_0x7b26('0xc2'),_0x2cfad3);});return _0x38cbc7;})['then'](respondWithResult(_0x5846ad,null))[_0x7b26('0x2c')](handleError(_0x5846ad,null));};exports[_0x7b26('0xc3')]=function(_0xbd473f,_0xf462bb,_0xa1cae1){return db[_0x7b26('0x5c')][_0x7b26('0x5d')]({'where':{'id':_0xbd473f[_0x7b26('0x59')]['id']}})['then'](handleEntityNotFound(_0xf462bb,null))[_0x7b26('0x3b')](function(_0x5c2d6d){if(_0x5c2d6d){return _0x5c2d6d[_0x7b26('0xc3')](_0xbd473f[_0x7b26('0x5f')][_0x7b26('0x6f')],_[_0x7b26('0x75')](_0xbd473f[_0x7b26('0x5f')],[_0x7b26('0x6f'),'id'])||{})[_0x7b26('0xbd')](function(_0x105693){for(var _0x359a62=0x0;_0x359a62<_0xbd473f[_0x7b26('0x5f')]['ids'][_0x7b26('0x4d')];_0x359a62+=0x1){socket['emit'](_0x7b26('0xc4'),{'UserId':Number(_0xbd473f[_0x7b26('0x5f')][_0x7b26('0x6f')][_0x359a62]),'FaxAccountId':Number(_0xbd473f['params']['id'])});}return _0x105693;});}})[_0x7b26('0x3b')](respondWithResult(_0xf462bb,null))[_0x7b26('0x2c')](handleError(_0xf462bb,null));};exports[_0x7b26('0xc5')]=function(_0x4a3ff3,_0x2487a8,_0x428adb){return db[_0x7b26('0x5c')]['find']({'where':{'id':_0x4a3ff3[_0x7b26('0x59')]['id']}})[_0x7b26('0x3b')](handleEntityNotFound(_0x2487a8,null))['then'](function(_0x45e866){if(_0x45e866){return _0x45e866['removeAgents'](_0x4a3ff3[_0x7b26('0x47')][_0x7b26('0x6f')])[_0x7b26('0x3b')](function(){if(_[_0x7b26('0xc6')](_0x4a3ff3['query'][_0x7b26('0x6f')])){for(var _0x248de1=0x0;_0x248de1<_0x4a3ff3[_0x7b26('0x47')][_0x7b26('0x6f')][_0x7b26('0x4d')];_0x248de1+=0x1){socket['emit'](_0x7b26('0xc7'),{'UserId':Number(_0x4a3ff3[_0x7b26('0x47')][_0x7b26('0x6f')][_0x248de1]),'FaxAccountId':Number(_0x4a3ff3[_0x7b26('0x59')]['id'])});}}else{socket[_0x7b26('0xc8')](_0x7b26('0xc7'),{'UserId':Number(_0x4a3ff3['query'][_0x7b26('0x6f')]),'FaxAccountId':Number(_0x4a3ff3['params']['id'])});}});}})[_0x7b26('0x3b')](respondWithStatusCode(_0x2487a8,null))[_0x7b26('0x2c')](handleError(_0x2487a8,null));};exports[_0x7b26('0xc9')]=function(_0x3506ed,_0x5b3a59,_0xaa1fdc){var _0x2a963b={};var _0x2673ef={};var _0x2603af;var _0x4efb89;return db[_0x7b26('0x5c')][_0x7b26('0x86')]({'where':{'id':_0x3506ed[_0x7b26('0x59')]['id']}})[_0x7b26('0x3b')](handleEntityNotFound(_0x5b3a59,null))['then'](function(_0x5be1a5){if(_0x5be1a5){_0x2603af=_0x5be1a5;_0x2673ef[_0x7b26('0x4b')]=_['keys'](db[_0x7b26('0x79')][_0x7b26('0x43')]);_0x2673ef[_0x7b26('0x47')]=_['keys'](_0x3506ed[_0x7b26('0x47')]);_0x2673ef[_0x7b26('0x48')]=_[_0x7b26('0x49')](_0x2673ef['model'],_0x2673ef[_0x7b26('0x47')]);_0x2a963b['attributes']=_[_0x7b26('0x49')](_0x2673ef[_0x7b26('0x4b')],qs['fields'](_0x3506ed[_0x7b26('0x47')]['fields']));_0x2a963b[_0x7b26('0x4a')]=_0x2a963b[_0x7b26('0x4a')][_0x7b26('0x4d')]?_0x2a963b['attributes']:_0x2673ef[_0x7b26('0x4b')];_0x2a963b[_0x7b26('0x50')]=qs['sort'](_0x3506ed[_0x7b26('0x47')][_0x7b26('0x51')]);_0x2a963b[_0x7b26('0x52')]=qs[_0x7b26('0x48')](_[_0x7b26('0x53')](_0x3506ed[_0x7b26('0x47')],_0x2673ef[_0x7b26('0x48')]));if(_0x3506ed[_0x7b26('0x47')][_0x7b26('0x54')]){_0x2a963b['where']=_['merge'](_0x2a963b[_0x7b26('0x52')],{'$or':_['map'](_0x2a963b['attributes'],function(_0x4f95f1){var _0x10fc23={};_0x10fc23[_0x4f95f1]={'$like':'%'+_0x3506ed[_0x7b26('0x47')]['filter']+'%'};return _0x10fc23;})});}_0x2a963b=_[_0x7b26('0x55')]({},_0x2a963b,_0x3506ed['options']);return _0x2603af[_0x7b26('0xc9')](_0x2a963b);}})[_0x7b26('0x3b')](function(_0x465236){if(_0x465236){_0x4efb89=_0x465236['length'];if(!_0x3506ed[_0x7b26('0x47')]['hasOwnProperty'](_0x7b26('0x4f'))){_0x2a963b[_0x7b26('0x32')]=qs['limit'](_0x3506ed['query'][_0x7b26('0x32')]);_0x2a963b[_0x7b26('0x34')]=qs[_0x7b26('0x34')](_0x3506ed['query'][_0x7b26('0x34')]);}return _0x2603af['getAgents'](_0x2a963b);}})[_0x7b26('0x3b')](function(_0x26b987){if(_0x26b987){return _0x26b987?{'count':_0x4efb89,'rows':_0x26b987}:null;}})[_0x7b26('0x3b')](respondWithResult(_0x5b3a59,null))[_0x7b26('0x2c')](handleError(_0x5b3a59,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 00058e2..04f8636 100644 --- a/server/api/faxAccount/faxAccount.events.js +++ b/server/api/faxAccount/faxAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb40d=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1d41a5,_0x24c811){var _0xe0f359=function(_0x3d7c4d){while(--_0x3d7c4d){_0x1d41a5['push'](_0x1d41a5['shift']());}};_0xe0f359(++_0x24c811);}(_0xb40d,0xc8));var _0xdb40=function(_0x4dd56c,_0x3841c2){_0x4dd56c=_0x4dd56c-0x0;var _0x15eb34=_0xb40d[_0x4dd56c];return _0x15eb34;};'use strict';var EventEmitter=require(_0xdb40('0x0'));var FaxAccount=require(_0xdb40('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdb40('0x2')](0x0);var events={'afterCreate':_0xdb40('0x3'),'afterUpdate':_0xdb40('0x4'),'afterDestroy':'remove'};function emitEvent(_0x272601){return function(_0x5888c9,_0x8f71a4,_0x47311a){FaxAccountEvents['emit'](_0x272601+':'+_0x5888c9['id'],_0x5888c9);FaxAccountEvents[_0xdb40('0x5')](_0x272601,_0x5888c9);_0x47311a(null);};}for(var e in events){if(events[_0xdb40('0x6')](e)){var event=events[e];FaxAccount[_0xdb40('0x7')](e,emitEvent(event));}}module[_0xdb40('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xbded=['hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x414032,_0x3d8384){var _0x2fb672=function(_0x43d52b){while(--_0x43d52b){_0x414032['push'](_0x414032['shift']());}};_0x2fb672(++_0x3d8384);}(_0xbded,0x1c5));var _0xdbde=function(_0x520926,_0x13c788){_0x520926=_0x520926-0x0;var _0x3f19d7=_0xbded[_0x520926];return _0x3f19d7;};'use strict';var EventEmitter=require(_0xdbde('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xdbde('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdbde('0x2')](0x0);var events={'afterCreate':_0xdbde('0x3'),'afterUpdate':_0xdbde('0x4'),'afterDestroy':_0xdbde('0x5')};function emitEvent(_0x201871){return function(_0x59e4d4,_0x174c0a,_0x507c5f){FaxAccountEvents[_0xdbde('0x6')](_0x201871+':'+_0x59e4d4['id'],_0x59e4d4);FaxAccountEvents[_0xdbde('0x6')](_0x201871,_0x59e4d4);_0x507c5f(null);};}for(var e in events){if(events[_0xdbde('0x7')](e)){var event=events[e];FaxAccount[_0xdbde('0x8')](e,emitEvent(event));}}module[_0xdbde('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 3168c8b..b750475 100644 --- a/server/api/faxAccount/faxAccount.model.js +++ b/server/api/faxAccount/faxAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9bf=['request-promise','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x9979f9,_0x22dba0){var _0x53b7fe=function(_0x36dd9c){while(--_0x36dd9c){_0x9979f9['push'](_0x9979f9['shift']());}};_0x53b7fe(++_0x22dba0);}(_0xf9bf,0xa7));var _0xff9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9bf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xff9b('0x0'));var util=require(_0xff9b('0x1'));var logger=require(_0xff9b('0x2'))(_0xff9b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xff9b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xff9b('0x5')]=function(_0x300bae,_0x28e625){return _0x300bae[_0xff9b('0x6')](_0xff9b('0x7'),attributes,{'tableName':_0xff9b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0adc=['FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0adc,0x101));var _0xc0ad=function(_0x12e455,_0x581732){_0x12e455=_0x12e455-0x0;var _0x5d5ce7=_0x0adc[_0x12e455];return _0x5d5ce7;};'use strict';var _=require(_0xc0ad('0x0'));var util=require(_0xc0ad('0x1'));var logger=require(_0xc0ad('0x2'))(_0xc0ad('0x3'));var moment=require(_0xc0ad('0x4'));var BPromise=require(_0xc0ad('0x5'));var rp=require(_0xc0ad('0x6'));var fs=require('fs');var path=require(_0xc0ad('0x7'));var rimraf=require(_0xc0ad('0x8'));var config=require(_0xc0ad('0x9'));var attributes=require(_0xc0ad('0xa'));module[_0xc0ad('0xb')]=function(_0x26fc1a,_0x5f1b93){return _0x26fc1a[_0xc0ad('0xc')](_0xc0ad('0xd'),attributes,{'tableName':_0xc0ad('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 55ff5da..934f3ba 100644 --- a/server/api/faxAccount/faxAccount.rpc.js +++ b/server/api/faxAccount/faxAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e48=['queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxAccount','findAll','options','raw','where','limit','include','attributes','model','map','GetFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','updatedAt','DESC','FaxApplication','Applications','list','applications','orderBy','priority','asc','length','defaults','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','name','waitForTheAssignedAgent'];(function(_0x5f416b,_0x2d8810){var _0x14c815=function(_0x1fd5d2){while(--_0x1fd5d2){_0x5f416b['push'](_0x5f416b['shift']());}};_0x14c815(++_0x2d8810);}(_0x4e48,0xc0));var _0x84e4=function(_0x505a31,_0x14e2df){_0x505a31=_0x505a31-0x0;var _0x1e693c=_0x4e48[_0x505a31];return _0x1e693c;};'use strict';var _=require('lodash');var util=require(_0x84e4('0x0'));var moment=require('moment');var BPromise=require(_0x84e4('0x1'));var rs=require(_0x84e4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84e4('0x3'))['db'];var utils=require(_0x84e4('0x4'));var logger=require('../../config/logger')(_0x84e4('0x5'));var config=require(_0x84e4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x84e4('0x7')]({'port':0x232c});config[_0x84e4('0x8')]=_['defaults'](config['redis'],{'host':_0x84e4('0x9'),'port':0x18eb});var socket=require(_0x84e4('0xa'))(new Redis(config[_0x84e4('0x8')]));require(_0x84e4('0xb'))[_0x84e4('0xc')](socket);function respondWithRpcPromise(_0x57a9af,_0x280024,_0x6ef245){return new BPromise(function(_0x2cf4d8,_0x2c9204){return client[_0x84e4('0xd')](_0x57a9af,_0x6ef245)[_0x84e4('0xe')](function(_0x386c65){logger[_0x84e4('0xf')](_0x84e4('0x10'),_0x280024,_0x84e4('0x11'));logger[_0x84e4('0x12')](_0x84e4('0x13'),_0x280024,_0x84e4('0x11'),JSON[_0x84e4('0x14')](_0x386c65));if(_0x386c65['error']){if(_0x386c65[_0x84e4('0x15')][_0x84e4('0x16')]===0x1f4){logger[_0x84e4('0x15')]('FaxAccount,\x20%s,\x20%s',_0x280024,_0x386c65[_0x84e4('0x15')][_0x84e4('0x17')]);return _0x2c9204(_0x386c65[_0x84e4('0x15')]['message']);}logger[_0x84e4('0x15')](_0x84e4('0x10'),_0x280024,_0x386c65[_0x84e4('0x15')]['message']);return _0x2cf4d8(_0x386c65[_0x84e4('0x15')]['message']);}else{logger[_0x84e4('0xf')](_0x84e4('0x10'),_0x280024,_0x84e4('0x11'));_0x2cf4d8(_0x386c65['result'][_0x84e4('0x17')]);}})[_0x84e4('0x18')](function(_0x133bb0){logger[_0x84e4('0x15')](_0x84e4('0x10'),_0x280024,_0x133bb0);_0x2c9204(_0x133bb0);});});}exports['GetFaxAccount']=function(_0x38a3dc){var _0x5b2c53=this;return new Promise(function(_0x43bf37,_0xe05efb){return db[_0x84e4('0x19')][_0x84e4('0x1a')]({'raw':_0x38a3dc[_0x84e4('0x1b')]?_0x38a3dc['options'][_0x84e4('0x1c')]===undefined?!![]:![]:!![],'where':_0x38a3dc[_0x84e4('0x1b')]?_0x38a3dc[_0x84e4('0x1b')][_0x84e4('0x1d')]||null:null,'attributes':_0x38a3dc[_0x84e4('0x1b')]?_0x38a3dc[_0x84e4('0x1b')]['attributes']||null:null,'limit':_0x38a3dc[_0x84e4('0x1b')]?_0x38a3dc['options'][_0x84e4('0x1e')]||null:null,'include':_0x38a3dc[_0x84e4('0x1b')]?_0x38a3dc[_0x84e4('0x1b')][_0x84e4('0x1f')]?_['map'](_0x38a3dc[_0x84e4('0x1b')]['include'],function(_0x8276ea){return{'model':db[_0x8276ea['model']],'as':_0x8276ea['as'],'attributes':_0x8276ea[_0x84e4('0x20')],'include':_0x8276ea[_0x84e4('0x1f')]?_['map'](_0x8276ea[_0x84e4('0x1f')],function(_0x54dc43){return{'model':db[_0x54dc43[_0x84e4('0x21')]],'as':_0x54dc43['as'],'attributes':_0x54dc43[_0x84e4('0x20')],'include':_0x54dc43[_0x84e4('0x1f')]?_[_0x84e4('0x22')](_0x54dc43[_0x84e4('0x1f')],function(_0x38e9d2){return{'model':db[_0x38e9d2['model']],'as':_0x38e9d2['as'],'attributes':_0x38e9d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x84e4('0xe')](function(_0x2c7993){logger[_0x84e4('0xf')](_0x84e4('0x23'),_0x38a3dc);logger[_0x84e4('0x12')]('GetFaxAccount',_0x38a3dc,JSON[_0x84e4('0x14')](_0x2c7993));_0x43bf37(_0x2c7993);})[_0x84e4('0x18')](function(_0x1887f2){logger[_0x84e4('0x15')](_0x84e4('0x23'),_0x1887f2[_0x84e4('0x17')],_0x38a3dc);_0xe05efb(_0x5b2c53[_0x84e4('0x15')](0x1f4,_0x1887f2[_0x84e4('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x3feda6,_0x37cb08,_0x77404d){var _0x5bfc48=this;return new Promise(function(_0x2bbeed,_0x3a4ed0){var _0x4c581d={'body':_0x3feda6[_0x84e4('0x24')],'channel':'fax'};var _0x385c22=[];var _0x5e5f09=[];var _0xcea2b6={};return db[_0x84e4('0x25')][_0x84e4('0x26')]()['then'](function(_0x1633d7){if(!_0x1633d7){throw new db[(_0x84e4('0x27'))][(_0x84e4('0x28'))](_0x84e4('0x29'));}_0x385c22=_[_0x84e4('0x2a')](_[_0x84e4('0x2b')](_0x1633d7),[_0x84e4('0x2c'),'updatedAt']);_0x5e5f09=_[_0x84e4('0x2a')](_[_0x84e4('0x2b')](_0x1633d7),[_0x84e4('0x2c'),'updatedAt',_0x84e4('0x2d'),_0x84e4('0x2e')]);if(_0x3feda6['body']['id']){delete _0x3feda6[_0x84e4('0x24')]['id'];}if(_[_0x84e4('0x2f')](_0x3feda6[_0x84e4('0x24')][_0x84e4('0x30')])){throw new db['Sequelize'][(_0x84e4('0x28'))]('from\x20is\x20mandatory');}if(_[_0x84e4('0x2f')](_0x3feda6[_0x84e4('0x24')]['body'])||_0x3feda6['body'][_0x84e4('0x24')]===''){throw new db[(_0x84e4('0x27'))][(_0x84e4('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x84e4('0x2f')](_0x3feda6['body'][_0x84e4('0x31')])){throw new db[(_0x84e4('0x27'))][(_0x84e4('0x28'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e5f09);}if(!_[_0x84e4('0x32')](_0x5e5f09,_0x3feda6[_0x84e4('0x24')][_0x84e4('0x31')])){throw new db[(_0x84e4('0x27'))][(_0x84e4('0x28'))](_0x84e4('0x33')+_0x5e5f09);}_0xcea2b6[_0x3feda6['body'][_0x84e4('0x31')]]=_0x3feda6[_0x84e4('0x24')]['from'];})[_0x84e4('0xe')](function(){return db['FaxAccount'][_0x84e4('0x34')]({'where':{'id':_0x3feda6[_0x84e4('0x35')]['id']},'include':[{'model':db[_0x84e4('0x36')],'as':_0x84e4('0x37'),'include':[{'model':db['CmContact'],'as':_0x84e4('0x38'),'where':_0xcea2b6,'limit':0x1,'order':[[_0x84e4('0x39'),_0x84e4('0x3a')]]}]},{'model':db[_0x84e4('0x3b')],'as':_0x84e4('0x3c')}]});})[_0x84e4('0xe')](function(_0x5d3db7){if(_0x5d3db7&&_0x5d3db7['List']){var _0xe12687=_0x5d3db7['get']({'plain':!![]});_0x4c581d[_0x84e4('0x35')]=_0xe12687;_0x4c581d['applications']=_0xe12687[_0x84e4('0x3c')];_0x4c581d[_0x84e4('0x3d')]=_0xe12687['List'];_0x4c581d[_0x84e4('0x3e')]=_[_0x84e4('0x3f')](_0x4c581d[_0x84e4('0x3e')],[_0x84e4('0x40')],[_0x84e4('0x41')]);if(_0x4c581d[_0x84e4('0x35')][_0x84e4('0x3c')]){delete _0x4c581d[_0x84e4('0x35')][_0x84e4('0x3c')];}if(_0x4c581d[_0x84e4('0x35')][_0x84e4('0x37')]&&_0x4c581d[_0x84e4('0x35')][_0x84e4('0x37')][_0x84e4('0x38')][_0x84e4('0x42')]){return _0x4c581d[_0x84e4('0x35')][_0x84e4('0x37')]['Contacts'][0x0];}var _0x592b48=_[_0x84e4('0x43')](_0x3feda6['body'],{'firstName':_0x3feda6['body'][_0x84e4('0x30')],'ListId':_0xe12687[_0x84e4('0x2e')]});_0x592b48[_0x3feda6[_0x84e4('0x24')][_0x84e4('0x31')]]=_0x3feda6[_0x84e4('0x24')][_0x84e4('0x30')];return db[_0x84e4('0x25')][_0x84e4('0x44')](_0x592b48,{'fields':_0x385c22,'raw':!![]});}})[_0x84e4('0xe')](function(_0x2b948d){_0x4c581d[_0x84e4('0x45')]=_0x2b948d;if(_0x2b948d){var _0x383da6={'ContactId':_0x2b948d['id'],'FaxAccountId':_0x3feda6[_0x84e4('0x35')]['id'],'fax':_0x2b948d[_0x84e4('0x46')]};return db[_0x84e4('0x47')][_0x84e4('0x34')]({'where':{'ContactId':_0x2b948d['id'],'closed':![],'FaxAccountId':_0x3feda6[_0x84e4('0x35')]['id']}})[_0x84e4('0xe')](function(_0x84cbf0){if(_0x84cbf0){return[_0x84cbf0,![]];}return db[_0x84e4('0x47')][_0x84e4('0x44')](_0x383da6)[_0x84e4('0xe')](function(_0x5e14d3){return[_0x5e14d3,!![]];});});}else{throw new Error(_0x84e4('0x48'));}})[_0x84e4('0x49')](function(_0x1802e9,_0x1bbbb1){var _0x3ac135=_0x1802e9[_0x84e4('0x4a')]({'plain':!![]});if(_0x1bbbb1){if(_0x4c581d[_0x84e4('0x35')][_0x84e4('0x4b')]){_0x4c581d[_0x84e4('0x3e')][_0x84e4('0x4c')]({'id':0x0,'priority':_0x4c581d['applications'][_0x84e4('0x42')]+0x1,'app':'close','appdata':_0x84e4('0x4d'),'interval':_0x84e4('0x4e')});}_0x3ac135[_0x84e4('0x4f')]=!![];}else{_0x3ac135['created']=![];}_0x4c581d['interaction']=_0x3ac135;return db[_0x84e4('0x50')][_0x84e4('0x44')]({'body':_0x3feda6[_0x84e4('0x24')][_0x84e4('0x24')],'FaxAccountId':_0x3feda6['account']['id'],'FaxInteractionId':_0x1802e9['id'],'direction':'in','ContactId':_0x1802e9[_0x84e4('0x51')],'AttachmentId':_0x3feda6['body']['AttachmentId']});})[_0x84e4('0xe')](function(_0x3dc9c4){_0x4c581d[_0x84e4('0x17')]=_0x3dc9c4;if(!_0x4c581d[_0x84e4('0x52')][_0x84e4('0x53')])return;return db[_0x84e4('0x54')]['find']({'attributes':['id','name'],'where':{'id':_0x4c581d['interaction'][_0x84e4('0x53')]}});})['then'](function(_0x18e8e2){if(_0x18e8e2){_0x4c581d[_0x84e4('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x18e8e2[_0x84e4('0x55')]+','+(_0x4c581d[_0x84e4('0x35')][_0x84e4('0x56')]||0xa),'interval':'*,*,*,*'});}if(!_0x4c581d[_0x84e4('0x52')]['queueId'])return;return db['FaxQueue'][_0x84e4('0x34')]({'attributes':['id',_0x84e4('0x55')],'where':{'id':_0x4c581d['interaction'][_0x84e4('0x57')]}});})['then'](function(_0x169fc6){if(_0x169fc6){_0x4c581d[_0x84e4('0x3e')][_0x84e4('0x58')]({'id':0x0,'priority':0x1,'app':_0x84e4('0x59'),'appdata':_0x169fc6['name']+','+(_0x4c581d[_0x84e4('0x35')][_0x84e4('0x5a')]||0x12c),'interval':_0x84e4('0x4e')});}return respondWithRpcPromise(_0x84e4('0x5b'),_0x84e4('0x5c'),_0x4c581d);})[_0x84e4('0xe')](function(_0xdebd15){_0x2bbeed(_0xdebd15);})['catch'](function(_0x1e5885){_0x3a4ed0(_0x5bfc48[_0x84e4('0x15')](0x1f4,_0x1e5885['message']));});});}; \ No newline at end of file +var _0x2ca3=['unshift','waitForTheAssignedAgent','queueId','FaxQueue','startRouting','lodash','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','updatedAt','difference','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','Contacts','DESC','FaxApplication','List','get','applications','Applications','list','orderBy','asc','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','interaction','FaxMessage','ContactId','AttachmentId','UserId','name'];(function(_0x3d4e35,_0x83c145){var _0x2c4e89=function(_0x321f72){while(--_0x321f72){_0x3d4e35['push'](_0x3d4e35['shift']());}};_0x2c4e89(++_0x83c145);}(_0x2ca3,0x169));var _0x32ca=function(_0x53b39a,_0x43a89a){_0x53b39a=_0x53b39a-0x0;var _0x29d39f=_0x2ca3[_0x53b39a];return _0x29d39f;};'use strict';var _=require(_0x32ca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x32ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32ca('0x2'));var logger=require(_0x32ca('0x3'))(_0x32ca('0x4'));var config=require(_0x32ca('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x32ca('0x6')][_0x32ca('0x7')]({'port':0x232c});config[_0x32ca('0x8')]=_['defaults'](config[_0x32ca('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x32ca('0x9'))(new Redis(config[_0x32ca('0x8')]));require(_0x32ca('0xa'))['register'](socket);function respondWithRpcPromise(_0x353502,_0x1d3c76,_0x1ac6f8){return new BPromise(function(_0x9f91f6,_0x2d4898){return client[_0x32ca('0xb')](_0x353502,_0x1ac6f8)[_0x32ca('0xc')](function(_0x18bfaa){logger[_0x32ca('0xd')](_0x32ca('0xe'),_0x1d3c76,_0x32ca('0xf'));logger[_0x32ca('0x10')](_0x32ca('0x11'),_0x1d3c76,_0x32ca('0xf'),JSON[_0x32ca('0x12')](_0x18bfaa));if(_0x18bfaa[_0x32ca('0x13')]){if(_0x18bfaa[_0x32ca('0x13')][_0x32ca('0x14')]===0x1f4){logger[_0x32ca('0x13')](_0x32ca('0xe'),_0x1d3c76,_0x18bfaa['error'][_0x32ca('0x15')]);return _0x2d4898(_0x18bfaa[_0x32ca('0x13')][_0x32ca('0x15')]);}logger[_0x32ca('0x13')](_0x32ca('0xe'),_0x1d3c76,_0x18bfaa['error'][_0x32ca('0x15')]);return _0x9f91f6(_0x18bfaa[_0x32ca('0x13')][_0x32ca('0x15')]);}else{logger['info'](_0x32ca('0xe'),_0x1d3c76,'request\x20sent');_0x9f91f6(_0x18bfaa[_0x32ca('0x16')][_0x32ca('0x15')]);}})[_0x32ca('0x17')](function(_0x2bca28){logger['error'](_0x32ca('0xe'),_0x1d3c76,_0x2bca28);_0x2d4898(_0x2bca28);});});}exports[_0x32ca('0x18')]=function(_0xf4ad8f){var _0x291901=this;return new Promise(function(_0x16e4a3,_0x3420df){return db['FaxAccount'][_0x32ca('0x19')]({'raw':_0xf4ad8f[_0x32ca('0x1a')]?_0xf4ad8f[_0x32ca('0x1a')][_0x32ca('0x1b')]===undefined?!![]:![]:!![],'where':_0xf4ad8f[_0x32ca('0x1a')]?_0xf4ad8f[_0x32ca('0x1a')][_0x32ca('0x1c')]||null:null,'attributes':_0xf4ad8f[_0x32ca('0x1a')]?_0xf4ad8f[_0x32ca('0x1a')][_0x32ca('0x1d')]||null:null,'limit':_0xf4ad8f[_0x32ca('0x1a')]?_0xf4ad8f[_0x32ca('0x1a')]['limit']||null:null,'include':_0xf4ad8f[_0x32ca('0x1a')]?_0xf4ad8f[_0x32ca('0x1a')][_0x32ca('0x1e')]?_[_0x32ca('0x1f')](_0xf4ad8f[_0x32ca('0x1a')][_0x32ca('0x1e')],function(_0x8c624f){return{'model':db[_0x8c624f[_0x32ca('0x20')]],'as':_0x8c624f['as'],'attributes':_0x8c624f[_0x32ca('0x1d')],'include':_0x8c624f[_0x32ca('0x1e')]?_[_0x32ca('0x1f')](_0x8c624f[_0x32ca('0x1e')],function(_0x95322){return{'model':db[_0x95322[_0x32ca('0x20')]],'as':_0x95322['as'],'attributes':_0x95322[_0x32ca('0x1d')],'include':_0x95322[_0x32ca('0x1e')]?_[_0x32ca('0x1f')](_0x95322[_0x32ca('0x1e')],function(_0x249d09){return{'model':db[_0x249d09['model']],'as':_0x249d09['as'],'attributes':_0x249d09[_0x32ca('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x349890){logger[_0x32ca('0xd')](_0x32ca('0x18'),_0xf4ad8f);logger[_0x32ca('0x10')]('GetFaxAccount',_0xf4ad8f,JSON[_0x32ca('0x12')](_0x349890));_0x16e4a3(_0x349890);})[_0x32ca('0x17')](function(_0x413a10){logger[_0x32ca('0x13')](_0x32ca('0x18'),_0x413a10[_0x32ca('0x15')],_0xf4ad8f);_0x3420df(_0x291901[_0x32ca('0x13')](0x1f4,_0x413a10['message']));});});};exports[_0x32ca('0x21')]=function(_0x38707f,_0x4ce9ac,_0x4d3e0c){var _0xe3a554=this;return new Promise(function(_0x53b211,_0xa2d4c3){var _0x42affd={'body':_0x38707f[_0x32ca('0x22')],'channel':_0x32ca('0x23')};var _0x5260c4=[];var _0x3196bf=[];var _0x3d27bf={};return db[_0x32ca('0x24')][_0x32ca('0x25')]()[_0x32ca('0xc')](function(_0x1ef919){if(!_0x1ef919){throw new db['Sequelize'][(_0x32ca('0x26'))](_0x32ca('0x27'));}_0x5260c4=_['difference'](_['keys'](_0x1ef919),['createdAt',_0x32ca('0x28')]);_0x3196bf=_[_0x32ca('0x29')](_[_0x32ca('0x2a')](_0x1ef919),['createdAt',_0x32ca('0x28'),_0x32ca('0x2b'),_0x32ca('0x2c')]);if(_0x38707f[_0x32ca('0x22')]['id']){delete _0x38707f['body']['id'];}if(_[_0x32ca('0x2d')](_0x38707f[_0x32ca('0x22')][_0x32ca('0x2e')])){throw new db['Sequelize'][(_0x32ca('0x26'))](_0x32ca('0x2f'));}if(_[_0x32ca('0x2d')](_0x38707f[_0x32ca('0x22')][_0x32ca('0x22')])||_0x38707f[_0x32ca('0x22')][_0x32ca('0x22')]===''){throw new db[(_0x32ca('0x30'))][(_0x32ca('0x26'))](_0x32ca('0x31'));}if(_[_0x32ca('0x2d')](_0x38707f[_0x32ca('0x22')][_0x32ca('0x32')])){throw new db[(_0x32ca('0x30'))][(_0x32ca('0x26'))](_0x32ca('0x33')+_0x3196bf);}if(!_['includes'](_0x3196bf,_0x38707f['body'][_0x32ca('0x32')])){throw new db[(_0x32ca('0x30'))]['ValidationError'](_0x32ca('0x34')+_0x3196bf);}_0x3d27bf[_0x38707f[_0x32ca('0x22')][_0x32ca('0x32')]]=_0x38707f[_0x32ca('0x22')][_0x32ca('0x2e')];})[_0x32ca('0xc')](function(){return db[_0x32ca('0x35')][_0x32ca('0x36')]({'where':{'id':_0x38707f[_0x32ca('0x37')]['id']},'include':[{'model':db[_0x32ca('0x38')],'as':'List','include':[{'model':db[_0x32ca('0x24')],'as':_0x32ca('0x39'),'where':_0x3d27bf,'limit':0x1,'order':[[_0x32ca('0x28'),_0x32ca('0x3a')]]}]},{'model':db[_0x32ca('0x3b')],'as':'Applications'}]});})[_0x32ca('0xc')](function(_0x5dc3a2){if(_0x5dc3a2&&_0x5dc3a2[_0x32ca('0x3c')]){var _0x163bb1=_0x5dc3a2[_0x32ca('0x3d')]({'plain':!![]});_0x42affd['account']=_0x163bb1;_0x42affd[_0x32ca('0x3e')]=_0x163bb1[_0x32ca('0x3f')];_0x42affd[_0x32ca('0x40')]=_0x163bb1[_0x32ca('0x3c')];_0x42affd[_0x32ca('0x3e')]=_[_0x32ca('0x41')](_0x42affd[_0x32ca('0x3e')],['priority'],[_0x32ca('0x42')]);if(_0x42affd[_0x32ca('0x37')]['Applications']){delete _0x42affd[_0x32ca('0x37')][_0x32ca('0x3f')];}if(_0x42affd[_0x32ca('0x37')][_0x32ca('0x3c')]&&_0x42affd[_0x32ca('0x37')][_0x32ca('0x3c')][_0x32ca('0x39')][_0x32ca('0x43')]){return _0x42affd[_0x32ca('0x37')][_0x32ca('0x3c')]['Contacts'][0x0];}var _0x57511f=_[_0x32ca('0x44')](_0x38707f[_0x32ca('0x22')],{'firstName':_0x38707f[_0x32ca('0x22')][_0x32ca('0x2e')],'ListId':_0x163bb1[_0x32ca('0x2c')]});_0x57511f[_0x38707f['body'][_0x32ca('0x32')]]=_0x38707f[_0x32ca('0x22')]['from'];return db['CmContact'][_0x32ca('0x45')](_0x57511f,{'fields':_0x5260c4,'raw':!![]});}})[_0x32ca('0xc')](function(_0x3ce1cb){_0x42affd[_0x32ca('0x46')]=_0x3ce1cb;if(_0x3ce1cb){var _0x257791={'ContactId':_0x3ce1cb['id'],'FaxAccountId':_0x38707f['account']['id'],'fax':_0x3ce1cb[_0x32ca('0x23')]};return db[_0x32ca('0x47')]['find']({'where':{'ContactId':_0x3ce1cb['id'],'closed':![],'FaxAccountId':_0x38707f['account']['id']}})[_0x32ca('0xc')](function(_0x558966){if(_0x558966){return[_0x558966,![]];}return db[_0x32ca('0x47')][_0x32ca('0x45')](_0x257791)[_0x32ca('0xc')](function(_0x1f751a){return[_0x1f751a,!![]];});});}else{throw new Error(_0x32ca('0x48'));}})[_0x32ca('0x49')](function(_0x5388fb,_0x2f54fa){var _0x5f3b40=_0x5388fb[_0x32ca('0x3d')]({'plain':!![]});if(_0x2f54fa){if(_0x42affd['account']['autoclose']){_0x42affd[_0x32ca('0x3e')][_0x32ca('0x4a')]({'id':0x0,'priority':_0x42affd[_0x32ca('0x3e')][_0x32ca('0x43')]+0x1,'app':_0x32ca('0x4b'),'appdata':_0x32ca('0x4c'),'interval':_0x32ca('0x4d')});}_0x5f3b40['created']=!![];}else{_0x5f3b40['created']=![];}_0x42affd[_0x32ca('0x4e')]=_0x5f3b40;return db[_0x32ca('0x4f')][_0x32ca('0x45')]({'body':_0x38707f[_0x32ca('0x22')]['body'],'FaxAccountId':_0x38707f['account']['id'],'FaxInteractionId':_0x5388fb['id'],'direction':'in','ContactId':_0x5388fb[_0x32ca('0x50')],'AttachmentId':_0x38707f[_0x32ca('0x22')][_0x32ca('0x51')]});})[_0x32ca('0xc')](function(_0x4a070a){_0x42affd[_0x32ca('0x15')]=_0x4a070a;if(!_0x42affd[_0x32ca('0x4e')][_0x32ca('0x52')])return;return db['User'][_0x32ca('0x36')]({'attributes':['id',_0x32ca('0x53')],'where':{'id':_0x42affd['interaction'][_0x32ca('0x52')]}});})['then'](function(_0xea40fc){if(_0xea40fc){_0x42affd[_0x32ca('0x3e')][_0x32ca('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xea40fc['name']+','+(_0x42affd[_0x32ca('0x37')][_0x32ca('0x55')]||0xa),'interval':_0x32ca('0x4d')});}if(!_0x42affd['interaction'][_0x32ca('0x56')])return;return db[_0x32ca('0x57')][_0x32ca('0x36')]({'attributes':['id',_0x32ca('0x53')],'where':{'id':_0x42affd[_0x32ca('0x4e')][_0x32ca('0x56')]}});})[_0x32ca('0xc')](function(_0x84cdb8){if(_0x84cdb8){_0x42affd[_0x32ca('0x3e')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x84cdb8['name']+','+(_0x42affd[_0x32ca('0x37')]['waitForTheAssignedQueue']||0x12c),'interval':_0x32ca('0x4d')});}return respondWithRpcPromise('Start',_0x32ca('0x58'),_0x42affd);})[_0x32ca('0xc')](function(_0x3f31a2){_0x53b211(_0x3f31a2);})[_0x32ca('0x17')](function(_0x2309b8){_0xa2d4c3(_0xe3a554['error'](0x1f4,_0x2309b8[_0x32ca('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 23b2310..7ffc90a 100644 --- a/server/api/faxAccount/faxAccount.socket.js +++ b/server/api/faxAccount/faxAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c40=['emit','register','length','faxAccount:','./faxAccount.events','save','update'];(function(_0x362d5d,_0x44a708){var _0x54f2ec=function(_0x58d6bb){while(--_0x58d6bb){_0x362d5d['push'](_0x362d5d['shift']());}};_0x54f2ec(++_0x44a708);}(_0x1c40,0x10e));var _0x01c4=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x1c40[_0x5db657];return _0x2d6e70;};'use strict';var FaxAccountEvents=require(_0x01c4('0x0'));var events=[_0x01c4('0x1'),'remove',_0x01c4('0x2')];function createListener(_0x326c19,_0x17ec1c){return function(_0x1361f1){_0x17ec1c[_0x01c4('0x3')](_0x326c19,_0x1361f1);};}function removeListener(_0x1a02e3,_0xc564d3){return function(){FaxAccountEvents['removeListener'](_0x1a02e3,_0xc564d3);};}exports[_0x01c4('0x4')]=function(_0x2ccfa4){for(var _0x17d883=0x0,_0x3ab822=events[_0x01c4('0x5')];_0x17d883<_0x3ab822;_0x17d883++){var _0x69a309=events[_0x17d883];var _0x545b32=createListener(_0x01c4('0x6')+_0x69a309,_0x2ccfa4);FaxAccountEvents['on'](_0x69a309,_0x545b32);}}; \ No newline at end of file +var _0x06cb=['register','length','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0xac1ffd,_0x5129a7){var _0x4e4a86=function(_0x519572){while(--_0x519572){_0xac1ffd['push'](_0xac1ffd['shift']());}};_0x4e4a86(++_0x5129a7);}(_0x06cb,0x113));var _0xb06c=function(_0x3f74ed,_0x520f2a){_0x3f74ed=_0x3f74ed-0x0;var _0x507434=_0x06cb[_0x3f74ed];return _0x507434;};'use strict';var FaxAccountEvents=require(_0xb06c('0x0'));var events=[_0xb06c('0x1'),_0xb06c('0x2'),_0xb06c('0x3')];function createListener(_0x2bc169,_0x2b0c21){return function(_0x5c651a){_0x2b0c21[_0xb06c('0x4')](_0x2bc169,_0x5c651a);};}function removeListener(_0x27624c,_0x4b3c41){return function(){FaxAccountEvents['removeListener'](_0x27624c,_0x4b3c41);};}exports[_0xb06c('0x5')]=function(_0x5ede0a){for(var _0x2ad1c3=0x0,_0x241202=events[_0xb06c('0x6')];_0x2ad1c3<_0x241202;_0x2ad1c3++){var _0x291a3e=events[_0x2ad1c3];var _0x650d76=createListener(_0xb06c('0x7')+_0x291a3e,_0x5ede0a);FaxAccountEvents['on'](_0x291a3e,_0x650d76);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 2c45565..2e3b6c8 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5335=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x5335,0xec));var _0x5533=function(_0x1a7c70,_0x1d29fb){_0x1a7c70=_0x1a7c70-0x0;var _0x552e98=_0x5335[_0x1a7c70];return _0x552e98;};'use strict';var multer=require(_0x5533('0x0'));var util=require('util');var path=require(_0x5533('0x1'));var timeout=require(_0x5533('0x2'));var express=require(_0x5533('0x3'));var router=express['Router']();var fs_extra=require(_0x5533('0x4'));var auth=require(_0x5533('0x5'));var interaction=require(_0x5533('0x6'));var config=require(_0x5533('0x7'));var controller=require('./faxAccount.controller');router[_0x5533('0x8')]('/',auth['isAuthenticated'](),controller[_0x5533('0x9')]);router[_0x5533('0x8')](_0x5533('0xa'),auth[_0x5533('0xb')](),controller[_0x5533('0xc')]);router[_0x5533('0x8')](_0x5533('0xd'),auth[_0x5533('0xb')](),controller['show']);router[_0x5533('0x8')](_0x5533('0xe'),auth[_0x5533('0xb')](),controller['getDispositions']);router[_0x5533('0x8')](_0x5533('0xf'),auth['isAuthenticated'](),controller[_0x5533('0x10')]);router[_0x5533('0x8')](_0x5533('0x11'),auth[_0x5533('0xb')](),controller[_0x5533('0x12')]);router[_0x5533('0x8')]('/:id/applications',auth[_0x5533('0xb')](),controller['getApplications']);router[_0x5533('0x8')](_0x5533('0x13'),auth['isAuthenticated'](),controller[_0x5533('0x14')]);router[_0x5533('0x8')](_0x5533('0x15'),auth[_0x5533('0xb')](),controller[_0x5533('0x16')]);router[_0x5533('0x17')]('/',auth['isAuthenticated'](),controller[_0x5533('0x18')]);router['post'](_0x5533('0xe'),auth[_0x5533('0xb')](),controller[_0x5533('0x19')]);router[_0x5533('0x17')](_0x5533('0xf'),auth[_0x5533('0xb')](),controller[_0x5533('0x1a')]);router['post'](_0x5533('0x11'),auth[_0x5533('0xb')](),controller['addInteraction']);router[_0x5533('0x17')]('/:id/applications',auth[_0x5533('0xb')](),controller[_0x5533('0x1b')]);router['post'](_0x5533('0x1c'),auth['isAuthenticated'](),controller[_0x5533('0x1d')]);router[_0x5533('0x17')](_0x5533('0x1e'),auth[_0x5533('0xb')](),controller[_0x5533('0x1f')]);router[_0x5533('0x17')](_0x5533('0x20'),auth[_0x5533('0xb')](),controller[_0x5533('0x21')]);router['post']('/:id/users',auth[_0x5533('0xb')](),controller['addAgents']);router[_0x5533('0x22')]('/:id',auth[_0x5533('0xb')](),controller[_0x5533('0x23')]);router[_0x5533('0x24')](_0x5533('0xd'),auth[_0x5533('0xb')](),controller[_0x5533('0x25')]);router[_0x5533('0x24')](_0x5533('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5533('0x24')](_0x5533('0xf'),auth[_0x5533('0xb')](),controller['removeAnswers']);router[_0x5533('0x24')](_0x5533('0x15'),auth[_0x5533('0xb')](),controller[_0x5533('0x26')]);module[_0x5533('0x27')]=router; \ No newline at end of file +var _0x3f3d=['express','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout'];(function(_0xd12822,_0x3e2466){var _0x227129=function(_0x15776b){while(--_0x15776b){_0xd12822['push'](_0xd12822['shift']());}};_0x227129(++_0x3e2466);}(_0x3f3d,0xd4));var _0xd3f3=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0x3f3d[_0x5751e6];return _0x4199e4;};'use strict';var multer=require(_0xd3f3('0x0'));var util=require('util');var path=require(_0xd3f3('0x1'));var timeout=require(_0xd3f3('0x2'));var express=require(_0xd3f3('0x3'));var router=express['Router']();var fs_extra=require(_0xd3f3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd3f3('0x5'));var config=require(_0xd3f3('0x6'));var controller=require(_0xd3f3('0x7'));router[_0xd3f3('0x8')]('/',auth[_0xd3f3('0x9')](),controller[_0xd3f3('0xa')]);router[_0xd3f3('0x8')]('/describe',auth[_0xd3f3('0x9')](),controller[_0xd3f3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd3f3('0x8')](_0xd3f3('0xc'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0xd')]);router['get'](_0xd3f3('0xe'),auth[_0xd3f3('0x9')](),controller['getAnswers']);router[_0xd3f3('0x8')](_0xd3f3('0xf'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x10')]);router[_0xd3f3('0x8')](_0xd3f3('0x11'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x12')]);router['get'](_0xd3f3('0x13'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x14')]);router[_0xd3f3('0x8')](_0xd3f3('0x15'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x16')]);router['post']('/',auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x17')]);router[_0xd3f3('0x18')](_0xd3f3('0xc'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x19')]);router[_0xd3f3('0x18')](_0xd3f3('0xe'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x1a')]);router['post'](_0xd3f3('0xf'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x1b')]);router['post'](_0xd3f3('0x11'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x1c')]);router['post'](_0xd3f3('0x1d'),auth[_0xd3f3('0x9')](),controller['addAccountApplications']);router[_0xd3f3('0x18')]('/updateaccountapplications',auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x1e')]);router['post'](_0xd3f3('0x1f'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x20')]);router[_0xd3f3('0x18')](_0xd3f3('0x15'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x21')]);router[_0xd3f3('0x22')](_0xd3f3('0x23'),auth['isAuthenticated'](),controller[_0xd3f3('0x24')]);router[_0xd3f3('0x25')]('/:id',auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x26')]);router[_0xd3f3('0x25')]('/:id/dispositions',auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x27')]);router['delete'](_0xd3f3('0xe'),auth[_0xd3f3('0x9')](),controller[_0xd3f3('0x28')]);router[_0xd3f3('0x25')](_0xd3f3('0x15'),auth['isAuthenticated'](),controller[_0xd3f3('0x29')]);module[_0xd3f3('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 7a428a1..9fdb509 100644 --- a/server/api/faxApplication/faxApplication.attributes.js +++ b/server/api/faxApplication/faxApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaee5=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x39623d,_0x6a237c){var _0x54de83=function(_0x325e15){while(--_0x325e15){_0x39623d['push'](_0x39623d['shift']());}};_0x54de83(++_0x6a237c);}(_0xaee5,0x1c4));var _0x5aee=function(_0x593ea7,_0x1977ae){_0x593ea7=_0x593ea7-0x0;var _0x2e3138=_0xaee5[_0x593ea7];return _0x2e3138;};'use strict';var Sequelize=require(_0x5aee('0x0'));module[_0x5aee('0x1')]={'priority':{'type':Sequelize[_0x5aee('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5aee('0x3')],'allowNull':![],'defaultValue':_0x5aee('0x4')},'appdata':{'type':Sequelize[_0x5aee('0x5')]()},'description':{'type':Sequelize[_0x5aee('0x3')]},'interval':{'type':Sequelize[_0x5aee('0x3')],'defaultValue':_0x5aee('0x6')}}; \ No newline at end of file +var _0x677b=['noop','STRING','sequelize','exports','INTEGER'];(function(_0x4048ac,_0x439058){var _0x41bd07=function(_0x47ad29){while(--_0x47ad29){_0x4048ac['push'](_0x4048ac['shift']());}};_0x41bd07(++_0x439058);}(_0x677b,0x1d3));var _0xb677=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0x677b[_0x5c2e5e];return _0x46a5da;};'use strict';var Sequelize=require(_0xb677('0x0'));module[_0xb677('0x1')]={'priority':{'type':Sequelize[_0xb677('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb677('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb677('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ae6f0fe..b2b05b1 100644 --- a/server/api/faxApplication/faxApplication.controller.js +++ b/server/api/faxApplication/faxApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1521=['map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','count','include','FaxApplication','then','rows','catch','show','params','length','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','set','apply','reject','save','update','sendStatus','stack','name','send'];(function(_0x1fefb2,_0x5d2a04){var _0xbe88e4=function(_0x37a192){while(--_0x37a192){_0x1fefb2['push'](_0x1fefb2['shift']());}};_0xbe88e4(++_0x5d2a04);}(_0x1521,0x106));var _0x1152=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x1521[_0x151418];return _0x40e29a;};'use strict';var emlformat=require(_0x1152('0x0'));var rimraf=require(_0x1152('0x1'));var zipdir=require(_0x1152('0x2'));var jsonpatch=require(_0x1152('0x3'));var rp=require(_0x1152('0x4'));var moment=require(_0x1152('0x5'));var BPromise=require(_0x1152('0x6'));var Mustache=require('mustache');var util=require(_0x1152('0x7'));var path=require('path');var sox=require(_0x1152('0x8'));var csv=require('to-csv');var ejs=require(_0x1152('0x9'));var fs=require('fs');var fs_extra=require(_0x1152('0xa'));var _=require(_0x1152('0xb'));var squel=require(_0x1152('0xc'));var crypto=require('crypto');var jsforce=require(_0x1152('0xd'));var deskjs=require(_0x1152('0xe'));var toCsv=require(_0x1152('0xf'));var querystring=require(_0x1152('0x10'));var Papa=require(_0x1152('0x11'));var Redis=require(_0x1152('0x12'));var authService=require(_0x1152('0x13'));var qs=require(_0x1152('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1152('0x15'));var logger=require(_0x1152('0x16'))(_0x1152('0x17'));var utils=require(_0x1152('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1152('0x19'));var db=require(_0x1152('0x1a'))['db'];function respondWithStatusCode(_0x47a785,_0x56c72f){_0x56c72f=_0x56c72f||0xcc;return function(_0x3ab4a3){if(_0x3ab4a3){return _0x47a785['sendStatus'](_0x56c72f);}return _0x47a785['status'](_0x56c72f)[_0x1152('0x1b')]();};}function respondWithResult(_0x5e5f43,_0xdfcc38){_0xdfcc38=_0xdfcc38||0xc8;return function(_0x613989){if(_0x613989){return _0x5e5f43[_0x1152('0x1c')](_0xdfcc38)[_0x1152('0x1d')](_0x613989);}};}function respondWithFilteredResult(_0x35c510,_0x501ef9){return function(_0x3b7da2){if(_0x3b7da2){var _0xba493c=typeof _0x501ef9['offset']===_0x1152('0x1e')&&typeof _0x501ef9[_0x1152('0x1f')]===_0x1152('0x1e');var _0x125780=_0x3b7da2['count'];var _0x3dfb08=_0xba493c?0x0:_0x501ef9[_0x1152('0x20')];var _0x14cc93=_0xba493c?_0x3b7da2['count']:_0x501ef9[_0x1152('0x20')]+_0x501ef9[_0x1152('0x1f')];var _0xb387a9;if(_0x14cc93>=_0x125780){_0x14cc93=_0x125780;_0xb387a9=0xc8;}else{_0xb387a9=0xce;}_0x35c510[_0x1152('0x1c')](_0xb387a9);return _0x35c510[_0x1152('0x21')]('Content-Range',_0x3dfb08+'-'+_0x14cc93+'/'+_0x125780)[_0x1152('0x1d')](_0x3b7da2);}return null;};}function patchUpdates(_0x599351){return function(_0xbe3f57){try{jsonpatch[_0x1152('0x22')](_0xbe3f57,_0x599351,!![]);}catch(_0x517249){return BPromise[_0x1152('0x23')](_0x517249);}return _0xbe3f57[_0x1152('0x24')]();};}function saveUpdates(_0x42371c,_0x54762d){return function(_0x2971b7){if(_0x2971b7){return _0x2971b7[_0x1152('0x25')](_0x42371c)['then'](function(_0x5e910b){return _0x5e910b;});}return null;};}function removeEntity(_0x5e0e74,_0x417948){return function(_0x1d4c4b){if(_0x1d4c4b){return _0x1d4c4b['destroy']()['then'](function(){_0x5e0e74[_0x1152('0x1c')](0xcc)[_0x1152('0x1b')]();});}};}function handleEntityNotFound(_0x30d1b1,_0x335ed3){return function(_0x2eaf93){if(!_0x2eaf93){_0x30d1b1[_0x1152('0x26')](0x194);}return _0x2eaf93;};}function handleError(_0xb597fd,_0x33a7a6){_0x33a7a6=_0x33a7a6||0x1f4;return function(_0x33677b){logger['error'](_0x33677b[_0x1152('0x27')]);if(_0x33677b[_0x1152('0x28')]){delete _0x33677b[_0x1152('0x28')];}_0xb597fd['status'](_0x33a7a6)[_0x1152('0x29')](_0x33677b);};}exports['index']=function(_0x56412d,_0x41e89e){var _0x7ae877={},_0xc8d142={},_0x2a1131={'count':0x0,'rows':[]};var _0x475f71=_[_0x1152('0x2a')](db['FaxApplication'][_0x1152('0x2b')],function(_0x33b0aa){return{'name':_0x33b0aa[_0x1152('0x2c')],'type':_0x33b0aa[_0x1152('0x2d')][_0x1152('0x2e')]};});_0xc8d142[_0x1152('0x2f')]=_[_0x1152('0x2a')](_0x475f71,_0x1152('0x28'));_0xc8d142['query']=_[_0x1152('0x30')](_0x56412d['query']);_0xc8d142[_0x1152('0x31')]=_[_0x1152('0x32')](_0xc8d142[_0x1152('0x2f')],_0xc8d142[_0x1152('0x33')]);_0x7ae877[_0x1152('0x34')]=_[_0x1152('0x32')](_0xc8d142[_0x1152('0x2f')],qs[_0x1152('0x35')](_0x56412d[_0x1152('0x33')][_0x1152('0x35')]));_0x7ae877[_0x1152('0x34')]=_0x7ae877[_0x1152('0x34')]['length']?_0x7ae877[_0x1152('0x34')]:_0xc8d142[_0x1152('0x2f')];if(!_0x56412d[_0x1152('0x33')][_0x1152('0x36')]('nolimit')){_0x7ae877[_0x1152('0x1f')]=qs[_0x1152('0x1f')](_0x56412d[_0x1152('0x33')][_0x1152('0x1f')]);_0x7ae877['offset']=qs['offset'](_0x56412d[_0x1152('0x33')]['offset']);}_0x7ae877[_0x1152('0x37')]=qs[_0x1152('0x38')](_0x56412d['query']['sort']);_0x7ae877[_0x1152('0x39')]=qs[_0x1152('0x31')](_['pick'](_0x56412d[_0x1152('0x33')],_0xc8d142[_0x1152('0x31')]),_0x475f71);if(_0x56412d[_0x1152('0x33')]['filter']){_0x7ae877[_0x1152('0x39')]=_[_0x1152('0x3a')](_0x7ae877['where'],{'$or':_[_0x1152('0x2a')](_0x475f71,function(_0xa6f4be){if(_0xa6f4be[_0x1152('0x2d')]!==_0x1152('0x3b')){var _0x5a3514={};_0x5a3514[_0xa6f4be[_0x1152('0x28')]]={'$like':'%'+_0x56412d[_0x1152('0x33')][_0x1152('0x3c')]+'%'};return _0x5a3514;}})});}_0x7ae877=_[_0x1152('0x3a')]({},_0x7ae877,_0x56412d[_0x1152('0x3d')]);var _0x2b4689={'where':_0x7ae877[_0x1152('0x39')]};return db['FaxApplication'][_0x1152('0x3e')](_0x2b4689)['then'](function(_0x2e1738){_0x2a1131[_0x1152('0x3e')]=_0x2e1738;if(_0x56412d[_0x1152('0x33')]['includeAll']){_0x7ae877[_0x1152('0x3f')]=[{'all':!![]}];}return db[_0x1152('0x40')]['findAll'](_0x7ae877);})[_0x1152('0x41')](function(_0x1af0dd){_0x2a1131[_0x1152('0x42')]=_0x1af0dd;return _0x2a1131;})[_0x1152('0x41')](respondWithFilteredResult(_0x41e89e,_0x7ae877))[_0x1152('0x43')](handleError(_0x41e89e,null));};exports[_0x1152('0x44')]=function(_0x3ab0f3,_0x2f762d){var _0x3cc4b9={'raw':!![],'where':{'id':_0x3ab0f3[_0x1152('0x45')]['id']}},_0x27eb03={};_0x27eb03['model']=_['keys'](db['FaxApplication'][_0x1152('0x2b')]);_0x27eb03['query']=_[_0x1152('0x30')](_0x3ab0f3[_0x1152('0x33')]);_0x27eb03[_0x1152('0x31')]=_[_0x1152('0x32')](_0x27eb03[_0x1152('0x2f')],_0x27eb03[_0x1152('0x33')]);_0x3cc4b9[_0x1152('0x34')]=_[_0x1152('0x32')](_0x27eb03[_0x1152('0x2f')],qs['fields'](_0x3ab0f3[_0x1152('0x33')][_0x1152('0x35')]));_0x3cc4b9[_0x1152('0x34')]=_0x3cc4b9[_0x1152('0x34')][_0x1152('0x46')]?_0x3cc4b9['attributes']:_0x27eb03[_0x1152('0x2f')];if(_0x3ab0f3[_0x1152('0x33')][_0x1152('0x47')]){_0x3cc4b9[_0x1152('0x3f')]=[{'all':!![]}];}_0x3cc4b9=_[_0x1152('0x3a')]({},_0x3cc4b9,_0x3ab0f3[_0x1152('0x3d')]);return db[_0x1152('0x40')][_0x1152('0x48')](_0x3cc4b9)[_0x1152('0x41')](handleEntityNotFound(_0x2f762d,null))[_0x1152('0x41')](respondWithResult(_0x2f762d,null))[_0x1152('0x43')](handleError(_0x2f762d,null));};exports[_0x1152('0x49')]=function(_0x3df839,_0x3eb301){return db['FaxApplication']['create'](_0x3df839[_0x1152('0x4a')],{})[_0x1152('0x41')](respondWithResult(_0x3eb301,0xc9))[_0x1152('0x43')](handleError(_0x3eb301,null));};exports[_0x1152('0x25')]=function(_0x62e4e9,_0x35f25f){if(_0x62e4e9[_0x1152('0x4a')]['id']){delete _0x62e4e9[_0x1152('0x4a')]['id'];}return db[_0x1152('0x40')][_0x1152('0x48')]({'where':{'id':_0x62e4e9[_0x1152('0x45')]['id']}})[_0x1152('0x41')](handleEntityNotFound(_0x35f25f,null))[_0x1152('0x41')](saveUpdates(_0x62e4e9[_0x1152('0x4a')],null))['then'](respondWithResult(_0x35f25f,null))[_0x1152('0x43')](handleError(_0x35f25f,null));};exports[_0x1152('0x4b')]=function(_0xa70b18,_0x1364e6){return db[_0x1152('0x40')][_0x1152('0x48')]({'where':{'id':_0xa70b18[_0x1152('0x45')]['id']}})[_0x1152('0x41')](handleEntityNotFound(_0x1364e6,null))[_0x1152('0x41')](removeEntity(_0x1364e6,null))[_0x1152('0x43')](handleError(_0x1364e6,null));}; \ No newline at end of file +var _0x596a=['util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','map','FaxApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x10eb23,_0x58ab5d){var _0x2ae623=function(_0x1c750c){while(--_0x1c750c){_0x10eb23['push'](_0x10eb23['shift']());}};_0x2ae623(++_0x58ab5d);}(_0x596a,0x8d));var _0xa596=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x596a[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xa596('0x0'));var rimraf=require(_0xa596('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa596('0x2'));var rp=require(_0xa596('0x3'));var moment=require(_0xa596('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa596('0x5'));var path=require(_0xa596('0x6'));var sox=require('sox');var csv=require(_0xa596('0x7'));var ejs=require(_0xa596('0x8'));var fs=require('fs');var fs_extra=require(_0xa596('0x9'));var _=require('lodash');var squel=require(_0xa596('0xa'));var crypto=require(_0xa596('0xb'));var jsforce=require(_0xa596('0xc'));var deskjs=require(_0xa596('0xd'));var toCsv=require(_0xa596('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa596('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa596('0xf'));var as=require(_0xa596('0x10'));var hardwareService=require(_0xa596('0x11'));var logger=require(_0xa596('0x12'))(_0xa596('0x13'));var utils=require(_0xa596('0x14'));var config=require(_0xa596('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa596('0x16'))['db'];function respondWithStatusCode(_0x1f9f49,_0x492ea2){_0x492ea2=_0x492ea2||0xcc;return function(_0x1138f4){if(_0x1138f4){return _0x1f9f49[_0xa596('0x17')](_0x492ea2);}return _0x1f9f49[_0xa596('0x18')](_0x492ea2)[_0xa596('0x19')]();};}function respondWithResult(_0x58ffde,_0x91edd0){_0x91edd0=_0x91edd0||0xc8;return function(_0x961b6a){if(_0x961b6a){return _0x58ffde[_0xa596('0x18')](_0x91edd0)['json'](_0x961b6a);}};}function respondWithFilteredResult(_0x133484,_0x2ef076){return function(_0x208e62){if(_0x208e62){var _0x2c6d43=typeof _0x2ef076[_0xa596('0x1a')]==='undefined'&&typeof _0x2ef076[_0xa596('0x1b')]===_0xa596('0x1c');var _0x36921c=_0x208e62[_0xa596('0x1d')];var _0x33d68d=_0x2c6d43?0x0:_0x2ef076['offset'];var _0x5718b8=_0x2c6d43?_0x208e62[_0xa596('0x1d')]:_0x2ef076[_0xa596('0x1a')]+_0x2ef076[_0xa596('0x1b')];var _0x48ef8e;if(_0x5718b8>=_0x36921c){_0x5718b8=_0x36921c;_0x48ef8e=0xc8;}else{_0x48ef8e=0xce;}_0x133484['status'](_0x48ef8e);return _0x133484[_0xa596('0x1e')](_0xa596('0x1f'),_0x33d68d+'-'+_0x5718b8+'/'+_0x36921c)[_0xa596('0x20')](_0x208e62);}return null;};}function patchUpdates(_0x5942c4){return function(_0x44c1e3){try{jsonpatch[_0xa596('0x21')](_0x44c1e3,_0x5942c4,!![]);}catch(_0x5bf4bc){return BPromise[_0xa596('0x22')](_0x5bf4bc);}return _0x44c1e3[_0xa596('0x23')]();};}function saveUpdates(_0x45c84c,_0x5e2f11){return function(_0x42c762){if(_0x42c762){return _0x42c762['update'](_0x45c84c)[_0xa596('0x24')](function(_0x5c8bec){return _0x5c8bec;});}return null;};}function removeEntity(_0x487a89,_0x34ccea){return function(_0x2905d4){if(_0x2905d4){return _0x2905d4['destroy']()[_0xa596('0x24')](function(){_0x487a89[_0xa596('0x18')](0xcc)[_0xa596('0x19')]();});}};}function handleEntityNotFound(_0x3aa6aa,_0x4b3220){return function(_0x5a04d2){if(!_0x5a04d2){_0x3aa6aa['sendStatus'](0x194);}return _0x5a04d2;};}function handleError(_0x38a6c0,_0x3d7743){_0x3d7743=_0x3d7743||0x1f4;return function(_0x2fb268){logger[_0xa596('0x25')](_0x2fb268[_0xa596('0x26')]);if(_0x2fb268[_0xa596('0x27')]){delete _0x2fb268[_0xa596('0x27')];}_0x38a6c0[_0xa596('0x18')](_0x3d7743)[_0xa596('0x28')](_0x2fb268);};}exports['index']=function(_0x3e81c9,_0x11c4a8){var _0x39f8a3={},_0x58a3d2={},_0x125453={'count':0x0,'rows':[]};var _0x581318=_[_0xa596('0x29')](db[_0xa596('0x2a')][_0xa596('0x2b')],function(_0x2a0830){return{'name':_0x2a0830['fieldName'],'type':_0x2a0830[_0xa596('0x2c')][_0xa596('0x2d')]};});_0x58a3d2[_0xa596('0x2e')]=_[_0xa596('0x29')](_0x581318,_0xa596('0x27'));_0x58a3d2[_0xa596('0x2f')]=_[_0xa596('0x30')](_0x3e81c9[_0xa596('0x2f')]);_0x58a3d2[_0xa596('0x31')]=_[_0xa596('0x32')](_0x58a3d2[_0xa596('0x2e')],_0x58a3d2['query']);_0x39f8a3[_0xa596('0x33')]=_[_0xa596('0x32')](_0x58a3d2[_0xa596('0x2e')],qs[_0xa596('0x34')](_0x3e81c9[_0xa596('0x2f')][_0xa596('0x34')]));_0x39f8a3[_0xa596('0x33')]=_0x39f8a3[_0xa596('0x33')][_0xa596('0x35')]?_0x39f8a3[_0xa596('0x33')]:_0x58a3d2[_0xa596('0x2e')];if(!_0x3e81c9[_0xa596('0x2f')][_0xa596('0x36')](_0xa596('0x37'))){_0x39f8a3['limit']=qs[_0xa596('0x1b')](_0x3e81c9[_0xa596('0x2f')][_0xa596('0x1b')]);_0x39f8a3['offset']=qs['offset'](_0x3e81c9[_0xa596('0x2f')][_0xa596('0x1a')]);}_0x39f8a3['order']=qs[_0xa596('0x38')](_0x3e81c9['query'][_0xa596('0x38')]);_0x39f8a3[_0xa596('0x39')]=qs[_0xa596('0x31')](_[_0xa596('0x3a')](_0x3e81c9[_0xa596('0x2f')],_0x58a3d2['filters']),_0x581318);if(_0x3e81c9['query'][_0xa596('0x3b')]){_0x39f8a3[_0xa596('0x39')]=_[_0xa596('0x3c')](_0x39f8a3['where'],{'$or':_[_0xa596('0x29')](_0x581318,function(_0xb68dfc){if(_0xb68dfc[_0xa596('0x2c')]!==_0xa596('0x3d')){var _0x264498={};_0x264498[_0xb68dfc[_0xa596('0x27')]]={'$like':'%'+_0x3e81c9[_0xa596('0x2f')]['filter']+'%'};return _0x264498;}})});}_0x39f8a3=_[_0xa596('0x3c')]({},_0x39f8a3,_0x3e81c9[_0xa596('0x3e')]);var _0xce4501={'where':_0x39f8a3[_0xa596('0x39')]};return db[_0xa596('0x2a')]['count'](_0xce4501)['then'](function(_0x215e87){_0x125453['count']=_0x215e87;if(_0x3e81c9[_0xa596('0x2f')][_0xa596('0x3f')]){_0x39f8a3[_0xa596('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0xa596('0x41')](_0x39f8a3);})[_0xa596('0x24')](function(_0x365f13){_0x125453[_0xa596('0x42')]=_0x365f13;return _0x125453;})[_0xa596('0x24')](respondWithFilteredResult(_0x11c4a8,_0x39f8a3))[_0xa596('0x43')](handleError(_0x11c4a8,null));};exports['show']=function(_0x461a34,_0xad0cf8){var _0x5d662b={'raw':!![],'where':{'id':_0x461a34[_0xa596('0x44')]['id']}},_0x4b25b9={};_0x4b25b9[_0xa596('0x2e')]=_[_0xa596('0x30')](db[_0xa596('0x2a')][_0xa596('0x2b')]);_0x4b25b9[_0xa596('0x2f')]=_[_0xa596('0x30')](_0x461a34['query']);_0x4b25b9[_0xa596('0x31')]=_[_0xa596('0x32')](_0x4b25b9[_0xa596('0x2e')],_0x4b25b9[_0xa596('0x2f')]);_0x5d662b[_0xa596('0x33')]=_[_0xa596('0x32')](_0x4b25b9[_0xa596('0x2e')],qs[_0xa596('0x34')](_0x461a34['query'][_0xa596('0x34')]));_0x5d662b[_0xa596('0x33')]=_0x5d662b[_0xa596('0x33')][_0xa596('0x35')]?_0x5d662b[_0xa596('0x33')]:_0x4b25b9['model'];if(_0x461a34['query'][_0xa596('0x3f')]){_0x5d662b[_0xa596('0x40')]=[{'all':!![]}];}_0x5d662b=_[_0xa596('0x3c')]({},_0x5d662b,_0x461a34[_0xa596('0x3e')]);return db['FaxApplication'][_0xa596('0x45')](_0x5d662b)[_0xa596('0x24')](handleEntityNotFound(_0xad0cf8,null))[_0xa596('0x24')](respondWithResult(_0xad0cf8,null))[_0xa596('0x43')](handleError(_0xad0cf8,null));};exports[_0xa596('0x46')]=function(_0x58c551,_0x235f70){return db[_0xa596('0x2a')][_0xa596('0x46')](_0x58c551[_0xa596('0x47')],{})['then'](respondWithResult(_0x235f70,0xc9))[_0xa596('0x43')](handleError(_0x235f70,null));};exports['update']=function(_0xa75a3e,_0x3b9981){if(_0xa75a3e[_0xa596('0x47')]['id']){delete _0xa75a3e[_0xa596('0x47')]['id'];}return db[_0xa596('0x2a')][_0xa596('0x45')]({'where':{'id':_0xa75a3e[_0xa596('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b9981,null))[_0xa596('0x24')](saveUpdates(_0xa75a3e[_0xa596('0x47')],null))[_0xa596('0x24')](respondWithResult(_0x3b9981,null))[_0xa596('0x43')](handleError(_0x3b9981,null));};exports[_0xa596('0x48')]=function(_0x566f61,_0xb61a20){return db['FaxApplication']['find']({'where':{'id':_0x566f61[_0xa596('0x44')]['id']}})[_0xa596('0x24')](handleEntityNotFound(_0xb61a20,null))[_0xa596('0x24')](removeEntity(_0xb61a20,null))[_0xa596('0x43')](handleError(_0xb61a20,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 256a7a3..0b4c791 100644 --- a/server/api/faxApplication/faxApplication.model.js +++ b/server/api/faxApplication/faxApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8146=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8146,0xa2));var _0x6814=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x8146[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0x6814('0x0'));var util=require(_0x6814('0x1'));var logger=require(_0x6814('0x2'))(_0x6814('0x3'));var moment=require(_0x6814('0x4'));var BPromise=require(_0x6814('0x5'));var rp=require(_0x6814('0x6'));var fs=require('fs');var path=require(_0x6814('0x7'));var rimraf=require(_0x6814('0x8'));var config=require(_0x6814('0x9'));var attributes=require('./faxApplication.attributes');module[_0x6814('0xa')]=function(_0x5c18a4,_0x588ff5){return _0x5c18a4[_0x6814('0xb')](_0x6814('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6814('0xd'),'collate':_0x6814('0xe')});}; \ No newline at end of file +var _0x3370=['moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x39a3cb,_0x5bc57f){var _0x410720=function(_0x34b92b){while(--_0x34b92b){_0x39a3cb['push'](_0x39a3cb['shift']());}};_0x410720(++_0x5bc57f);}(_0x3370,0x83));var _0x0337=function(_0x2dec6b,_0x126741){_0x2dec6b=_0x2dec6b-0x0;var _0x1dc756=_0x3370[_0x2dec6b];return _0x1dc756;};'use strict';var _=require(_0x0337('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0337('0x1'));var BPromise=require(_0x0337('0x2'));var rp=require(_0x0337('0x3'));var fs=require('fs');var path=require(_0x0337('0x4'));var rimraf=require(_0x0337('0x5'));var config=require('../../config/environment');var attributes=require(_0x0337('0x6'));module['exports']=function(_0xd16ea9,_0x2c7b39){return _0xd16ea9[_0x0337('0x7')](_0x0337('0x8'),attributes,{'tableName':_0x0337('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0337('0xa'),'collate':_0x0337('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 8da4559..d7f44bb 100644 --- a/server/api/faxApplication/faxApplication.rpc.js +++ b/server/api/faxApplication/faxApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd772=['options','raw','where','attributes','limit','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','body'];(function(_0x52e122,_0x5e17f0){var _0x12c2ca=function(_0x6aa611){while(--_0x6aa611){_0x52e122['push'](_0x52e122['shift']());}};_0x12c2ca(++_0x5e17f0);}(_0xd772,0xd7));var _0x2d77=function(_0x59fee9,_0x4c5b04){_0x59fee9=_0x59fee9-0x0;var _0x1d8146=_0xd772[_0x59fee9];return _0x1d8146;};'use strict';var _=require('lodash');var util=require(_0x2d77('0x0'));var moment=require(_0x2d77('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d77('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d77('0x3'));var logger=require(_0x2d77('0x4'))(_0x2d77('0x5'));var config=require(_0x2d77('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2d77('0x7')][_0x2d77('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39365d,_0x478e27,_0x427da2){return new BPromise(function(_0x3a7e2d,_0x5e8f59){return client[_0x2d77('0x9')](_0x39365d,_0x427da2)[_0x2d77('0xa')](function(_0x27f698){logger[_0x2d77('0xb')]('FaxApplication,\x20%s,\x20%s',_0x478e27,_0x2d77('0xc'));logger[_0x2d77('0xd')](_0x2d77('0xe'),_0x478e27,_0x2d77('0xc'),JSON[_0x2d77('0xf')](_0x27f698));if(_0x27f698[_0x2d77('0x10')]){if(_0x27f698[_0x2d77('0x10')][_0x2d77('0x11')]===0x1f4){logger['error'](_0x2d77('0x12'),_0x478e27,_0x27f698[_0x2d77('0x10')][_0x2d77('0x13')]);return _0x5e8f59(_0x27f698[_0x2d77('0x10')][_0x2d77('0x13')]);}logger[_0x2d77('0x10')](_0x2d77('0x12'),_0x478e27,_0x27f698[_0x2d77('0x10')][_0x2d77('0x13')]);return _0x3a7e2d(_0x27f698[_0x2d77('0x10')][_0x2d77('0x13')]);}else{logger[_0x2d77('0xb')](_0x2d77('0x12'),_0x478e27,_0x2d77('0xc'));_0x3a7e2d(_0x27f698[_0x2d77('0x14')]['message']);}})[_0x2d77('0x15')](function(_0x4bd586){logger['error']('FaxApplication,\x20%s,\x20%s',_0x478e27,_0x4bd586);_0x5e8f59(_0x4bd586);});});}exports[_0x2d77('0x16')]=function(_0x4f78f8){var _0x502028=this;return new Promise(function(_0x3ea236,_0x54ea50){return db[_0x2d77('0x17')]['update'](_0x4f78f8[_0x2d77('0x18')],{'raw':_0x4f78f8['options']?_0x4f78f8[_0x2d77('0x19')][_0x2d77('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f78f8[_0x2d77('0x19')]?_0x4f78f8[_0x2d77('0x19')][_0x2d77('0x1b')]||null:null,'attributes':_0x4f78f8[_0x2d77('0x19')]?_0x4f78f8[_0x2d77('0x19')][_0x2d77('0x1c')]||null:null,'limit':_0x4f78f8[_0x2d77('0x19')]?_0x4f78f8[_0x2d77('0x19')][_0x2d77('0x1d')]||null:null})[_0x2d77('0xa')](function(_0xa4f4be){logger[_0x2d77('0xb')]('UpdateFaxApplication',_0x4f78f8);logger[_0x2d77('0xd')](_0x2d77('0x16'),_0x4f78f8,JSON[_0x2d77('0xf')](_0xa4f4be));_0x3ea236(_0xa4f4be);})[_0x2d77('0x15')](function(_0x2e5b72){logger[_0x2d77('0x10')](_0x2d77('0x16'),_0x2e5b72['message'],_0x4f78f8);_0x54ea50(_0x502028[_0x2d77('0x10')](0x1f4,_0x2e5b72[_0x2d77('0x13')]));});});}; \ No newline at end of file +var _0x8498=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','limit','lodash','moment','randomstring','ioredis'];(function(_0x34e111,_0x3c2abd){var _0x4dcc22=function(_0x5d9293){while(--_0x5d9293){_0x34e111['push'](_0x34e111['shift']());}};_0x4dcc22(++_0x3c2abd);}(_0x8498,0x70));var _0x8849=function(_0x16a71c,_0x1b2cd5){_0x16a71c=_0x16a71c-0x0;var _0xfb1a17=_0x8498[_0x16a71c];return _0xfb1a17;};'use strict';var _=require(_0x8849('0x0'));var util=require('util');var moment=require(_0x8849('0x1'));var BPromise=require('bluebird');var rs=require(_0x8849('0x2'));var fs=require('fs');var Redis=require(_0x8849('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8849('0x4'))(_0x8849('0x5'));var config=require(_0x8849('0x6'));var jayson=require(_0x8849('0x7'));var client=jayson[_0x8849('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e3ba5,_0x48adb8,_0x59a0c4){return new BPromise(function(_0x5a5ab9,_0x424824){return client[_0x8849('0x9')](_0x2e3ba5,_0x59a0c4)[_0x8849('0xa')](function(_0x56bde7){logger[_0x8849('0xb')](_0x8849('0xc'),_0x48adb8,_0x8849('0xd'));logger[_0x8849('0xe')](_0x8849('0xf'),_0x48adb8,'request\x20sent',JSON[_0x8849('0x10')](_0x56bde7));if(_0x56bde7[_0x8849('0x11')]){if(_0x56bde7['error']['code']===0x1f4){logger[_0x8849('0x11')](_0x8849('0xc'),_0x48adb8,_0x56bde7[_0x8849('0x11')]['message']);return _0x424824(_0x56bde7['error'][_0x8849('0x12')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x48adb8,_0x56bde7['error'][_0x8849('0x12')]);return _0x5a5ab9(_0x56bde7[_0x8849('0x11')][_0x8849('0x12')]);}else{logger[_0x8849('0xb')]('FaxApplication,\x20%s,\x20%s',_0x48adb8,'request\x20sent');_0x5a5ab9(_0x56bde7[_0x8849('0x13')]['message']);}})[_0x8849('0x14')](function(_0x2ec0a6){logger[_0x8849('0x11')](_0x8849('0xc'),_0x48adb8,_0x2ec0a6);_0x424824(_0x2ec0a6);});});}exports[_0x8849('0x15')]=function(_0x43125a){var _0x420bc3=this;return new Promise(function(_0x2b140a,_0x2d38b9){return db[_0x8849('0x16')][_0x8849('0x17')](_0x43125a[_0x8849('0x18')],{'raw':_0x43125a[_0x8849('0x19')]?_0x43125a[_0x8849('0x19')][_0x8849('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43125a[_0x8849('0x19')]?_0x43125a['options']['where']||null:null,'attributes':_0x43125a[_0x8849('0x19')]?_0x43125a[_0x8849('0x19')][_0x8849('0x1b')]||null:null,'limit':_0x43125a[_0x8849('0x19')]?_0x43125a['options'][_0x8849('0x1c')]||null:null})[_0x8849('0xa')](function(_0x24ae46){logger[_0x8849('0xb')](_0x8849('0x15'),_0x43125a);logger[_0x8849('0xe')](_0x8849('0x15'),_0x43125a,JSON['stringify'](_0x24ae46));_0x2b140a(_0x24ae46);})[_0x8849('0x14')](function(_0x3f4919){logger['error']('UpdateFaxApplication',_0x3f4919[_0x8849('0x12')],_0x43125a);_0x2d38b9(_0x420bc3[_0x8849('0x11')](0x1f4,_0x3f4919[_0x8849('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index f03600b..8c05a2e 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13f6=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','post','create','put','update'];(function(_0x21f551,_0x1008fe){var _0x4ece9c=function(_0x1b9888){while(--_0x1b9888){_0x21f551['push'](_0x21f551['shift']());}};_0x4ece9c(++_0x1008fe);}(_0x13f6,0x124));var _0x613f=function(_0x18a256,_0x348ac9){_0x18a256=_0x18a256-0x0;var _0xaf1b53=_0x13f6[_0x18a256];return _0xaf1b53;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x613f('0xa')]('/',auth[_0x613f('0x8')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xd')]);router[_0x613f('0xe')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xf')]);module[_0x613f('0x10')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./faxApplication.controller','get'];(function(_0x3e3f27,_0x2c2ecf){var _0x15c868=function(_0x4b348d){while(--_0x4b348d){_0x3e3f27['push'](_0x3e3f27['shift']());}};_0x15c868(++_0x2c2ecf);}(_0xda2d,0x102));var _0xdda2=function(_0x8680a1,_0x160fc0){_0x8680a1=_0x8680a1-0x0;var _0x3036c5=_0xda2d[_0x8680a1];return _0x3036c5;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 057eaec..225495b 100644 --- a/server/api/faxInteraction/faxInteraction.attributes.js +++ b/server/api/faxInteraction/faxInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['out','INTEGER','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x40783c,_0x1053f3){var _0x133700=function(_0x49dfdb){while(--_0x49dfdb){_0x40783c['push'](_0x40783c['shift']());}};_0x133700(++_0x1053f3);}(_0x14a0,0x8e));var _0x014a=function(_0x6a8067,_0x1bffec){_0x6a8067=_0x6a8067-0x0;var _0x1cc2aa=_0x14a0[_0x6a8067];return _0x1cc2aa;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'closed':{'type':Sequelize[_0x014a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x014a('0x2')]},'disposition':{'type':Sequelize[_0x014a('0x3')]},'secondDisposition':{'type':Sequelize[_0x014a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x014a('0x3')]},'note':{'type':Sequelize[_0x014a('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x014a('0x4')]('in',_0x014a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x014a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x014a('0x6')]}}; \ No newline at end of file +var _0xfb11=['STRING','ENUM','INTEGER','sequelize','BOOLEAN','DATE'];(function(_0x22c0c7,_0x4e19a8){var _0x644891=function(_0x3963a8){while(--_0x3963a8){_0x22c0c7['push'](_0x22c0c7['shift']());}};_0x644891(++_0x4e19a8);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xfb11[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x1fb1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1fb1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1fb1('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1fb1('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1fb1('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x1fb1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1fb1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1fb1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1fb1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x1fb1('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index f4fb0bb..42d3ee3 100644 --- a/server/api/faxInteraction/faxInteraction.controller.js +++ b/server/api/faxInteraction/faxInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb60c=['get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','log','err','sendStatus','rimraf','zip-dir','moment','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','count','set','update','then','destroy','name','send','index','map','rawAttributes','type','key','getOptions','findAll','fax','query','user','show','model','FaxInteraction','keys','filters','intersection','attributes','fields','length','include','merge','options','catch','body','find','params','describe','FaxMessage','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','limit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','includeAll','rows','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt'];(function(_0x269a6f,_0x4c43c5){var _0x29e1e6=function(_0xe6081e){while(--_0xe6081e){_0x269a6f['push'](_0x269a6f['shift']());}};_0x29e1e6(++_0x4c43c5);}(_0xb60c,0xd7));var _0xcb60=function(_0x4ec2c6,_0x4d14ec){_0x4ec2c6=_0x4ec2c6-0x0;var _0x4c75b3=_0xb60c[_0x4ec2c6];return _0x4c75b3;};'use strict';var rimraf=require(_0xcb60('0x0'));var zipdir=require(_0xcb60('0x1'));var moment=require(_0xcb60('0x2'));var BPromise=require('bluebird');var util=require(_0xcb60('0x3'));var path=require(_0xcb60('0x4'));var fs=require('fs');var _=require(_0xcb60('0x5'));var Redis=require('ioredis');var interaction=require(_0xcb60('0x6'));var qs=require(_0xcb60('0x7'));var logger=require('../../config/logger')(_0xcb60('0x8'));var config=require(_0xcb60('0x9'));var db=require(_0xcb60('0xa'))['db'];config[_0xcb60('0xb')]=_[_0xcb60('0xc')](config['redis'],{'host':_0xcb60('0xd'),'port':0x18eb});var socket=require(_0xcb60('0xe'))(new Redis(config[_0xcb60('0xb')]));require(_0xcb60('0xf'))[_0xcb60('0x10')](socket);function respondWithStatusCode(_0x34c365,_0x585d50){_0x585d50=_0x585d50||0xcc;return function(_0x36619e){if(_0x36619e){return _0x34c365['sendStatus'](_0x585d50);}return _0x34c365[_0xcb60('0x11')](_0x585d50)[_0xcb60('0x12')]();};}function respondWithResult(_0x51554a,_0xc52abb){_0xc52abb=_0xc52abb||0xc8;return function(_0x5abfd5){if(_0x5abfd5){return _0x51554a['status'](_0xc52abb)[_0xcb60('0x13')](_0x5abfd5);}};}function respondWithFilteredResult(_0x437efe,_0x9bb650){return function(_0x105743){if(_0x105743){var _0x55c612=typeof _0x9bb650[_0xcb60('0x14')]===_0xcb60('0x15')&&typeof _0x9bb650['limit']===_0xcb60('0x15');var _0x1bf972=_0x105743[_0xcb60('0x16')];var _0x28f8a3=_0x55c612?0x0:_0x9bb650[_0xcb60('0x14')];var _0x20bc7f=_0x55c612?_0x105743[_0xcb60('0x16')]:_0x9bb650[_0xcb60('0x14')]+_0x9bb650['limit'];var _0x30cfd9;if(_0x20bc7f>=_0x1bf972){_0x20bc7f=_0x1bf972;_0x30cfd9=0xc8;}else{_0x30cfd9=0xce;}_0x437efe['status'](_0x30cfd9);return _0x437efe[_0xcb60('0x17')]('Content-Range',_0x28f8a3+'-'+_0x20bc7f+'/'+_0x1bf972)[_0xcb60('0x13')](_0x105743);}return null;};}function saveUpdates(_0x1dbacd){return function(_0x2b1572){if(_0x2b1572){return _0x2b1572[_0xcb60('0x18')](_0x1dbacd)[_0xcb60('0x19')](function(_0xdf348a){return _0xdf348a;});}return null;};}function removeEntity(_0x441391){return function(_0x14c1de){if(_0x14c1de){return _0x14c1de[_0xcb60('0x1a')]()[_0xcb60('0x19')](function(){_0x441391[_0xcb60('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x153ff9){return function(_0x28fbb6){if(!_0x28fbb6){_0x153ff9['sendStatus'](0x194);}return _0x28fbb6;};}function handleError(_0x325f5a,_0x477c1d){_0x477c1d=_0x477c1d||0x1f4;return function(_0x44cced){logger['error'](_0x44cced['stack']);if(_0x44cced[_0xcb60('0x1b')]){delete _0x44cced[_0xcb60('0x1b')];}_0x325f5a[_0xcb60('0x11')](_0x477c1d)[_0xcb60('0x1c')](_0x44cced);};}exports[_0xcb60('0x1d')]=function(_0x458574,_0x31561c){var _0x26e9c1={};var _0x9ff874=_[_0xcb60('0x1e')](db['FaxInteraction'][_0xcb60('0x1f')],function(_0x3ed41c){return{'name':_0x3ed41c['fieldName'],'type':_0x3ed41c[_0xcb60('0x20')][_0xcb60('0x21')]};});_0x26e9c1=qs[_0xcb60('0x22')](_0x9ff874,_0x458574);return interaction[_0xcb60('0x23')](_0xcb60('0x24'),_0x458574[_0xcb60('0x25')],_0x458574[_0xcb60('0x26')],_0x26e9c1,_0x9ff874)[_0xcb60('0x19')](respondWithFilteredResult(_0x31561c,_0x26e9c1))['catch'](handleError(_0x31561c,null));};exports[_0xcb60('0x27')]=function(_0x4dd4ab,_0x3522c4){var _0x3ec0b5={'raw':![],'where':{'id':_0x4dd4ab['params']['id']}},_0x170266={};_0x170266[_0xcb60('0x28')]=_['keys'](db[_0xcb60('0x29')][_0xcb60('0x1f')]);_0x170266[_0xcb60('0x25')]=_[_0xcb60('0x2a')](_0x4dd4ab['query']);_0x170266[_0xcb60('0x2b')]=_[_0xcb60('0x2c')](_0x170266['model'],_0x170266[_0xcb60('0x25')]);_0x3ec0b5[_0xcb60('0x2d')]=_[_0xcb60('0x2c')](_0x170266['model'],qs[_0xcb60('0x2e')](_0x4dd4ab[_0xcb60('0x25')][_0xcb60('0x2e')]));_0x3ec0b5[_0xcb60('0x2d')]=_0x3ec0b5[_0xcb60('0x2d')][_0xcb60('0x2f')]?_0x3ec0b5[_0xcb60('0x2d')]:_0x170266[_0xcb60('0x28')];if(_0x4dd4ab['query']['includeAll']){_0x3ec0b5[_0xcb60('0x30')]=[{'all':!![]}];}_0x3ec0b5=_[_0xcb60('0x31')]({},_0x3ec0b5,_0x4dd4ab[_0xcb60('0x32')]);return db[_0xcb60('0x29')]['find'](_0x3ec0b5)['then'](handleEntityNotFound(_0x3522c4,null))[_0xcb60('0x19')](respondWithResult(_0x3522c4,null))[_0xcb60('0x33')](handleError(_0x3522c4,null));};exports['create']=function(_0xd47574,_0x4dded4){return db[_0xcb60('0x29')]['create'](_0xd47574[_0xcb60('0x34')],{})[_0xcb60('0x19')](respondWithResult(_0x4dded4,0xc9))[_0xcb60('0x33')](handleError(_0x4dded4,null));};exports[_0xcb60('0x18')]=function(_0x3e68a9,_0x1251e7){if(_0x3e68a9[_0xcb60('0x34')]['id']){delete _0x3e68a9[_0xcb60('0x34')]['id'];}return db[_0xcb60('0x29')][_0xcb60('0x35')]({'where':{'id':_0x3e68a9[_0xcb60('0x36')]['id']}})[_0xcb60('0x19')](handleEntityNotFound(_0x1251e7,null))[_0xcb60('0x19')](saveUpdates(_0x3e68a9[_0xcb60('0x34')],null))[_0xcb60('0x19')](respondWithResult(_0x1251e7,null))[_0xcb60('0x33')](handleError(_0x1251e7,null));};exports[_0xcb60('0x1a')]=function(_0x1bfb9b,_0x123ff1){return db['FaxInteraction'][_0xcb60('0x35')]({'where':{'id':_0x1bfb9b['params']['id']}})[_0xcb60('0x19')](handleEntityNotFound(_0x123ff1,null))['then'](removeEntity(_0x123ff1,null))[_0xcb60('0x33')](handleError(_0x123ff1,null));};exports['describe']=function(_0x14af41,_0x5d171f){return db['FaxInteraction'][_0xcb60('0x37')]()['then'](respondWithResult(_0x5d171f,null))[_0xcb60('0x33')](handleError(_0x5d171f,null));};exports['addMessage']=function(_0x8c0f02,_0x19462a){return db[_0xcb60('0x38')][_0xcb60('0x35')]({'where':{'id':_0x8c0f02[_0xcb60('0x36')]['id']}})[_0xcb60('0x19')](handleEntityNotFound(_0x19462a,null))['then'](function(_0x128f8b){if(_0x128f8b){return _0x128f8b[_0xcb60('0x39')](_0x8c0f02[_0xcb60('0x34')][_0xcb60('0x3a')],_[_0xcb60('0x3b')](_0x8c0f02[_0xcb60('0x34')],[_0xcb60('0x3a'),'id'])||{});}})[_0xcb60('0x19')](respondWithResult(_0x19462a,null))[_0xcb60('0x33')](handleError(_0x19462a,null));};exports[_0xcb60('0x3c')]=function(_0x494b4a,_0xf5245a){var _0x138e10={'raw':![],'where':{}};var _0x499d1b={};var _0x3c2c45={'count':0x0,'rows':[]};return db[_0xcb60('0x29')]['findOne']({'where':{'id':_0x494b4a[_0xcb60('0x36')]['id']}})[_0xcb60('0x19')](handleEntityNotFound(_0xf5245a,null))[_0xcb60('0x19')](function(_0x3da160){if(_0x3da160){_0x499d1b[_0xcb60('0x28')]=_['keys'](db[_0xcb60('0x38')][_0xcb60('0x1f')]);_0x499d1b[_0xcb60('0x25')]=_['keys'](_0x494b4a['query']);_0x499d1b[_0xcb60('0x2b')]=_[_0xcb60('0x2c')](_0x499d1b[_0xcb60('0x28')],_0x499d1b['query']);_0x138e10[_0xcb60('0x2d')]=_[_0xcb60('0x2c')](_0x499d1b['model'],qs[_0xcb60('0x2e')](_0x494b4a[_0xcb60('0x25')][_0xcb60('0x2e')]));_0x138e10['attributes']=_0x138e10[_0xcb60('0x2d')]['length']?_0x138e10['attributes']:_0x499d1b[_0xcb60('0x28')];if(!_0x494b4a[_0xcb60('0x25')][_0xcb60('0x3d')](_0xcb60('0x3e'))){_0x138e10[_0xcb60('0x3f')]=qs[_0xcb60('0x3f')](_0x494b4a[_0xcb60('0x25')][_0xcb60('0x3f')]);_0x138e10['offset']=qs['offset'](_0x494b4a[_0xcb60('0x25')][_0xcb60('0x14')]);}_0x138e10[_0xcb60('0x40')]=qs['sort'](_0x494b4a[_0xcb60('0x25')][_0xcb60('0x41')]);_0x138e10[_0xcb60('0x42')]=qs[_0xcb60('0x2b')](_[_0xcb60('0x43')](_0x494b4a[_0xcb60('0x25')],_0x499d1b[_0xcb60('0x2b')]));_0x138e10[_0xcb60('0x42')][_0xcb60('0x44')]=_0x3da160['id'];if(_0x494b4a[_0xcb60('0x25')][_0xcb60('0x45')]){_0x138e10[_0xcb60('0x42')]=_[_0xcb60('0x31')](_0x138e10[_0xcb60('0x42')],{'$or':_[_0xcb60('0x1e')](_0x138e10[_0xcb60('0x2d')],function(_0x1ca442){var _0x5d9124={};_0x5d9124[_0x1ca442]={'$like':'%'+_0x494b4a['query'][_0xcb60('0x45')]+'%'};return _0x5d9124;})});}if(_0x494b4a[_0xcb60('0x25')][_0xcb60('0x46')]){var _0x53a0b2=_0x494b4a[_0xcb60('0x25')][_0xcb60('0x46')][_0xcb60('0x47')](',');var _0x33dd6e={};_0x33dd6e[_0x53a0b2[0x0]]={'$gte':moment(_0x53a0b2[0x1])[_0xcb60('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x138e10[_0xcb60('0x42')]=_[_0xcb60('0x31')](_0x138e10[_0xcb60('0x42')],_0x33dd6e);}_0x138e10=_[_0xcb60('0x31')]({},_0x138e10,_0x494b4a[_0xcb60('0x32')]);return db[_0xcb60('0x38')][_0xcb60('0x16')]({'where':_0x138e10[_0xcb60('0x42')]})['then'](function(_0x1b35b8){_0x3c2c45[_0xcb60('0x16')]=_0x1b35b8;if(_0x494b4a['query'][_0xcb60('0x49')]){_0x138e10[_0xcb60('0x30')]=[{'all':!![]}];}return db[_0xcb60('0x38')]['findAll'](_0x138e10);})['then'](function(_0x932ada){_0x3c2c45[_0xcb60('0x4a')]=_0x932ada;return _0x3c2c45;});}})[_0xcb60('0x19')](respondWithFilteredResult(_0xf5245a,_0x138e10))[_0xcb60('0x33')](handleError(_0xf5245a,null));};exports['addTags']=function(_0x344c97,_0x51638c){return db[_0xcb60('0x29')][_0xcb60('0x35')]({'where':{'id':_0x344c97[_0xcb60('0x36')]['id']}})['then'](handleEntityNotFound(_0x51638c,null))[_0xcb60('0x19')](function(_0x2c139b){if(_0x2c139b){return _0x2c139b[_0xcb60('0x4b')](_0x344c97[_0xcb60('0x34')][_0xcb60('0x3a')],_['omit'](_0x344c97[_0xcb60('0x34')],[_0xcb60('0x3a'),'id'])||{})[_0xcb60('0x4c')](function(){return db[_0xcb60('0x4d')][_0xcb60('0x23')]({'attributes':['id',_0xcb60('0x1b'),_0xcb60('0x4e')],'where':{'id':_0x344c97[_0xcb60('0x34')][_0xcb60('0x3a')]}});})[_0xcb60('0x19')](function(_0x1c42b9){socket[_0xcb60('0x4f')](_0xcb60('0x50'),{'id':Number(_0x344c97[_0xcb60('0x36')]['id']),'tags':_0x1c42b9||[]});return{'id':Number(_0x344c97[_0xcb60('0x36')]['id']),'tags':_0x1c42b9||[]};});}})[_0xcb60('0x19')](respondWithResult(_0x51638c,null))[_0xcb60('0x33')](handleError(_0x51638c,null));};exports['removeTags']=function(_0xa3266e,_0x4fd6bb){return db['FaxInteraction']['find']({'where':{'id':_0xa3266e[_0xcb60('0x36')]['id']}})[_0xcb60('0x19')](handleEntityNotFound(_0x4fd6bb,null))[_0xcb60('0x19')](function(_0x4d3200){if(_0x4d3200){return _0x4d3200[_0xcb60('0x51')](_0xa3266e[_0xcb60('0x25')][_0xcb60('0x3a')]);}})[_0xcb60('0x19')](respondWithStatusCode(_0x4fd6bb,null))[_0xcb60('0x33')](handleError(_0x4fd6bb,null));};exports[_0xcb60('0x52')]=function(_0x4541a0,_0x417e1b){var _0x124238=moment()[_0xcb60('0x53')]()['toString']();var _0x479638=path[_0xcb60('0x54')](config[_0xcb60('0x55')],_0xcb60('0x56'),'files','tmp');var _0x1fc0f0=path[_0xcb60('0x54')](config[_0xcb60('0x55')],_0xcb60('0x56'),_0xcb60('0x57'),_0xcb60('0x58'));var _0xdfc2e6=path[_0xcb60('0x54')](_0x479638,_0x124238);var _0x481d0f=util[_0xcb60('0x48')](_0xcb60('0x59'),_0x4541a0[_0xcb60('0x36')]['id'],_0x124238);var _0x52f5dc=path[_0xcb60('0x54')](_0x479638,_0x481d0f);var _0x30a17b=[];_0x30a17b[_0xcb60('0x5a')]({'model':db[_0xcb60('0x5b')],'as':'Attachment','raw':!![]});var _0x1370ad=[{'model':db[_0xcb60('0x38')],'as':_0xcb60('0x5c'),'attributes':['id',_0xcb60('0x34'),_0xcb60('0x5d')],'include':_0x30a17b}];return db[_0xcb60('0x29')][_0xcb60('0x35')]({'where':{'id':_0x4541a0[_0xcb60('0x36')]['id']},'include':_0x1370ad})[_0xcb60('0x19')](handleEntityNotFound(_0x417e1b,null))[_0xcb60('0x19')](function(_0x25663d){if(_0x25663d&&_0x25663d[_0xcb60('0x5c')]){var _0x3f9df5=_0x25663d[_0xcb60('0x5e')]({'plain':!![]});fs[_0xcb60('0x5f')](_0xdfc2e6);for(var _0x304f82=0x0;_0x304f82<_0x3f9df5['Messages']['length'];_0x304f82++){var _0x2c3778=_0x3f9df5[_0xcb60('0x5c')][_0x304f82][_0xcb60('0x5b')];if(_0x2c3778){var _0x14220d=path['join'](_0x1fc0f0,_0x2c3778[_0xcb60('0x60')]);if(fs[_0xcb60('0x61')](_0x14220d)){fs[_0xcb60('0x62')](_0x14220d)['pipe'](fs[_0xcb60('0x63')](path['join'](_0xdfc2e6,_0x2c3778[_0xcb60('0x60')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x346208,_0x12243b){zipdir(_0xdfc2e6,{'saveTo':_0x52f5dc},function(_0x5940f6,_0x2be12f){if(_0x5940f6)return _0x12243b(_0x5940f6);return _0x346208(_0x2be12f);});})['then'](function(){return new BPromise(function(_0x14caff,_0x59c6ba){rimraf(_0xdfc2e6,function(_0x4e4934){if(_0x4e4934)_0x59c6ba(_0x4e4934);return _0x14caff();});});})[_0xcb60('0x19')](function(){return _0x417e1b[_0xcb60('0x52')](_0x52f5dc,_0x481d0f,function(_0x12c94d){if(_0x12c94d){console[_0xcb60('0x64')](_0xcb60('0x65'),_0x12c94d);}else{fs['unlinkSync'](_0x52f5dc);}});});});}else{return _0x417e1b[_0xcb60('0x66')](0xc8);}})[_0xcb60('0x33')](handleError(_0x417e1b,null));}; \ No newline at end of file +var _0x0bb5=['limit','set','Content-Range','update','then','destroy','error','stack','name','index','map','FaxInteraction','rawAttributes','fieldName','type','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','create','body','find','describe','addMessage','FaxMessage','ids','omit','getMessages','hasOwnProperty','nolimit','sort','pick','where','FaxInteractionId','filter','$gte','split','format','merge','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','join','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','zip-dir','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count'];(function(_0x9c08ca,_0x4d3960){var _0x26541e=function(_0x3a5967){while(--_0x3a5967){_0x9c08ca['push'](_0x9c08ca['shift']());}};_0x26541e(++_0x4d3960);}(_0x0bb5,0x123));var _0x50bb=function(_0x383771,_0x50572d){_0x383771=_0x383771-0x0;var _0x37461d=_0x0bb5[_0x383771];return _0x37461d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x50bb('0x0'));var moment=require('moment');var BPromise=require(_0x50bb('0x1'));var util=require(_0x50bb('0x2'));var path=require(_0x50bb('0x3'));var fs=require('fs');var _=require(_0x50bb('0x4'));var Redis=require(_0x50bb('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x50bb('0x6'));var logger=require(_0x50bb('0x7'))(_0x50bb('0x8'));var config=require(_0x50bb('0x9'));var db=require(_0x50bb('0xa'))['db'];config[_0x50bb('0xb')]=_[_0x50bb('0xc')](config['redis'],{'host':_0x50bb('0xd'),'port':0x18eb});var socket=require(_0x50bb('0xe'))(new Redis(config[_0x50bb('0xb')]));require(_0x50bb('0xf'))[_0x50bb('0x10')](socket);function respondWithStatusCode(_0x239ad0,_0x56f3df){_0x56f3df=_0x56f3df||0xcc;return function(_0x7489de){if(_0x7489de){return _0x239ad0[_0x50bb('0x11')](_0x56f3df);}return _0x239ad0[_0x50bb('0x12')](_0x56f3df)[_0x50bb('0x13')]();};}function respondWithResult(_0x219ac1,_0x41553e){_0x41553e=_0x41553e||0xc8;return function(_0x1b3ca5){if(_0x1b3ca5){return _0x219ac1[_0x50bb('0x12')](_0x41553e)[_0x50bb('0x14')](_0x1b3ca5);}};}function respondWithFilteredResult(_0x4f3fee,_0x702564){return function(_0x20f5c0){if(_0x20f5c0){var _0x43ca0b=typeof _0x702564[_0x50bb('0x15')]===_0x50bb('0x16')&&typeof _0x702564['limit']===_0x50bb('0x16');var _0x5e56a4=_0x20f5c0[_0x50bb('0x17')];var _0x4677b1=_0x43ca0b?0x0:_0x702564[_0x50bb('0x15')];var _0x110855=_0x43ca0b?_0x20f5c0[_0x50bb('0x17')]:_0x702564['offset']+_0x702564[_0x50bb('0x18')];var _0x221dc3;if(_0x110855>=_0x5e56a4){_0x110855=_0x5e56a4;_0x221dc3=0xc8;}else{_0x221dc3=0xce;}_0x4f3fee[_0x50bb('0x12')](_0x221dc3);return _0x4f3fee[_0x50bb('0x19')](_0x50bb('0x1a'),_0x4677b1+'-'+_0x110855+'/'+_0x5e56a4)[_0x50bb('0x14')](_0x20f5c0);}return null;};}function saveUpdates(_0x324c8c){return function(_0x37c84f){if(_0x37c84f){return _0x37c84f[_0x50bb('0x1b')](_0x324c8c)[_0x50bb('0x1c')](function(_0x5e26f0){return _0x5e26f0;});}return null;};}function removeEntity(_0x13a529){return function(_0x38f575){if(_0x38f575){return _0x38f575[_0x50bb('0x1d')]()['then'](function(){_0x13a529['status'](0xcc)[_0x50bb('0x13')]();});}};}function handleEntityNotFound(_0x5f5548){return function(_0x3f0874){if(!_0x3f0874){_0x5f5548[_0x50bb('0x11')](0x194);}return _0x3f0874;};}function handleError(_0xffda02,_0x300169){_0x300169=_0x300169||0x1f4;return function(_0x133fbc){logger[_0x50bb('0x1e')](_0x133fbc[_0x50bb('0x1f')]);if(_0x133fbc['name']){delete _0x133fbc[_0x50bb('0x20')];}_0xffda02[_0x50bb('0x12')](_0x300169)['send'](_0x133fbc);};}exports[_0x50bb('0x21')]=function(_0x543430,_0x276510){var _0xa7b231={};var _0x2c9c2c=_[_0x50bb('0x22')](db[_0x50bb('0x23')][_0x50bb('0x24')],function(_0x1335b5){return{'name':_0x1335b5[_0x50bb('0x25')],'type':_0x1335b5[_0x50bb('0x26')]['key']};});_0xa7b231=qs['getOptions'](_0x2c9c2c,_0x543430);return interaction[_0x50bb('0x27')](_0x50bb('0x28'),_0x543430[_0x50bb('0x29')],_0x543430[_0x50bb('0x2a')],_0xa7b231,_0x2c9c2c)['then'](respondWithFilteredResult(_0x276510,_0xa7b231))[_0x50bb('0x2b')](handleError(_0x276510,null));};exports[_0x50bb('0x2c')]=function(_0xd83b7a,_0x7af0a1){var _0x51d8f8={'raw':![],'where':{'id':_0xd83b7a[_0x50bb('0x2d')]['id']}},_0x43b995={};_0x43b995[_0x50bb('0x2e')]=_[_0x50bb('0x2f')](db[_0x50bb('0x23')][_0x50bb('0x24')]);_0x43b995['query']=_[_0x50bb('0x2f')](_0xd83b7a[_0x50bb('0x29')]);_0x43b995[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x43b995[_0x50bb('0x2e')],_0x43b995['query']);_0x51d8f8[_0x50bb('0x32')]=_['intersection'](_0x43b995['model'],qs[_0x50bb('0x33')](_0xd83b7a['query'][_0x50bb('0x33')]));_0x51d8f8[_0x50bb('0x32')]=_0x51d8f8[_0x50bb('0x32')][_0x50bb('0x34')]?_0x51d8f8['attributes']:_0x43b995[_0x50bb('0x2e')];if(_0xd83b7a[_0x50bb('0x29')][_0x50bb('0x35')]){_0x51d8f8[_0x50bb('0x36')]=[{'all':!![]}];}_0x51d8f8=_['merge']({},_0x51d8f8,_0xd83b7a[_0x50bb('0x37')]);return db[_0x50bb('0x23')]['find'](_0x51d8f8)[_0x50bb('0x1c')](handleEntityNotFound(_0x7af0a1,null))[_0x50bb('0x1c')](respondWithResult(_0x7af0a1,null))['catch'](handleError(_0x7af0a1,null));};exports[_0x50bb('0x38')]=function(_0x562eab,_0x5a5657){return db[_0x50bb('0x23')][_0x50bb('0x38')](_0x562eab[_0x50bb('0x39')],{})[_0x50bb('0x1c')](respondWithResult(_0x5a5657,0xc9))[_0x50bb('0x2b')](handleError(_0x5a5657,null));};exports[_0x50bb('0x1b')]=function(_0x5339af,_0x29bf78){if(_0x5339af[_0x50bb('0x39')]['id']){delete _0x5339af[_0x50bb('0x39')]['id'];}return db['FaxInteraction'][_0x50bb('0x3a')]({'where':{'id':_0x5339af[_0x50bb('0x2d')]['id']}})[_0x50bb('0x1c')](handleEntityNotFound(_0x29bf78,null))[_0x50bb('0x1c')](saveUpdates(_0x5339af[_0x50bb('0x39')],null))[_0x50bb('0x1c')](respondWithResult(_0x29bf78,null))[_0x50bb('0x2b')](handleError(_0x29bf78,null));};exports[_0x50bb('0x1d')]=function(_0x55b2a8,_0x47098f){return db[_0x50bb('0x23')][_0x50bb('0x3a')]({'where':{'id':_0x55b2a8['params']['id']}})[_0x50bb('0x1c')](handleEntityNotFound(_0x47098f,null))['then'](removeEntity(_0x47098f,null))['catch'](handleError(_0x47098f,null));};exports[_0x50bb('0x3b')]=function(_0x27c8fa,_0x351ef0){return db['FaxInteraction'][_0x50bb('0x3b')]()[_0x50bb('0x1c')](respondWithResult(_0x351ef0,null))[_0x50bb('0x2b')](handleError(_0x351ef0,null));};exports[_0x50bb('0x3c')]=function(_0xad30af,_0x4e8c09){return db[_0x50bb('0x3d')]['find']({'where':{'id':_0xad30af['params']['id']}})[_0x50bb('0x1c')](handleEntityNotFound(_0x4e8c09,null))['then'](function(_0x10bebe){if(_0x10bebe){return _0x10bebe[_0x50bb('0x3c')](_0xad30af[_0x50bb('0x39')][_0x50bb('0x3e')],_[_0x50bb('0x3f')](_0xad30af[_0x50bb('0x39')],[_0x50bb('0x3e'),'id'])||{});}})[_0x50bb('0x1c')](respondWithResult(_0x4e8c09,null))[_0x50bb('0x2b')](handleError(_0x4e8c09,null));};exports[_0x50bb('0x40')]=function(_0x272786,_0x3694d2){var _0x7a78bf={'raw':![],'where':{}};var _0x23a9a6={};var _0x3cc12e={'count':0x0,'rows':[]};return db[_0x50bb('0x23')]['findOne']({'where':{'id':_0x272786[_0x50bb('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3694d2,null))[_0x50bb('0x1c')](function(_0x7ad533){if(_0x7ad533){_0x23a9a6['model']=_[_0x50bb('0x2f')](db[_0x50bb('0x3d')][_0x50bb('0x24')]);_0x23a9a6[_0x50bb('0x29')]=_[_0x50bb('0x2f')](_0x272786[_0x50bb('0x29')]);_0x23a9a6[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x23a9a6[_0x50bb('0x2e')],_0x23a9a6[_0x50bb('0x29')]);_0x7a78bf['attributes']=_['intersection'](_0x23a9a6[_0x50bb('0x2e')],qs[_0x50bb('0x33')](_0x272786[_0x50bb('0x29')][_0x50bb('0x33')]));_0x7a78bf['attributes']=_0x7a78bf[_0x50bb('0x32')][_0x50bb('0x34')]?_0x7a78bf[_0x50bb('0x32')]:_0x23a9a6['model'];if(!_0x272786[_0x50bb('0x29')][_0x50bb('0x41')](_0x50bb('0x42'))){_0x7a78bf[_0x50bb('0x18')]=qs[_0x50bb('0x18')](_0x272786[_0x50bb('0x29')][_0x50bb('0x18')]);_0x7a78bf[_0x50bb('0x15')]=qs[_0x50bb('0x15')](_0x272786[_0x50bb('0x29')][_0x50bb('0x15')]);}_0x7a78bf['order']=qs[_0x50bb('0x43')](_0x272786[_0x50bb('0x29')][_0x50bb('0x43')]);_0x7a78bf['where']=qs[_0x50bb('0x30')](_[_0x50bb('0x44')](_0x272786[_0x50bb('0x29')],_0x23a9a6[_0x50bb('0x30')]));_0x7a78bf[_0x50bb('0x45')][_0x50bb('0x46')]=_0x7ad533['id'];if(_0x272786[_0x50bb('0x29')][_0x50bb('0x47')]){_0x7a78bf[_0x50bb('0x45')]=_['merge'](_0x7a78bf[_0x50bb('0x45')],{'$or':_[_0x50bb('0x22')](_0x7a78bf[_0x50bb('0x32')],function(_0x372893){var _0x36ce70={};_0x36ce70[_0x372893]={'$like':'%'+_0x272786[_0x50bb('0x29')][_0x50bb('0x47')]+'%'};return _0x36ce70;})});}if(_0x272786[_0x50bb('0x29')][_0x50bb('0x48')]){var _0xdb910e=_0x272786[_0x50bb('0x29')][_0x50bb('0x48')][_0x50bb('0x49')](',');var _0x4f23ff={};_0x4f23ff[_0xdb910e[0x0]]={'$gte':moment(_0xdb910e[0x1])[_0x50bb('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x7a78bf[_0x50bb('0x45')]=_[_0x50bb('0x4b')](_0x7a78bf[_0x50bb('0x45')],_0x4f23ff);}_0x7a78bf=_['merge']({},_0x7a78bf,_0x272786[_0x50bb('0x37')]);return db[_0x50bb('0x3d')][_0x50bb('0x17')]({'where':_0x7a78bf[_0x50bb('0x45')]})[_0x50bb('0x1c')](function(_0x20d850){_0x3cc12e['count']=_0x20d850;if(_0x272786[_0x50bb('0x29')][_0x50bb('0x35')]){_0x7a78bf['include']=[{'all':!![]}];}return db['FaxMessage'][_0x50bb('0x27')](_0x7a78bf);})[_0x50bb('0x1c')](function(_0x40100c){_0x3cc12e[_0x50bb('0x4c')]=_0x40100c;return _0x3cc12e;});}})[_0x50bb('0x1c')](respondWithFilteredResult(_0x3694d2,_0x7a78bf))[_0x50bb('0x2b')](handleError(_0x3694d2,null));};exports[_0x50bb('0x4d')]=function(_0x445abf,_0x2db78f){return db['FaxInteraction'][_0x50bb('0x3a')]({'where':{'id':_0x445abf['params']['id']}})['then'](handleEntityNotFound(_0x2db78f,null))[_0x50bb('0x1c')](function(_0x319ce0){if(_0x319ce0){return _0x319ce0[_0x50bb('0x4e')](_0x445abf[_0x50bb('0x39')][_0x50bb('0x3e')],_[_0x50bb('0x3f')](_0x445abf[_0x50bb('0x39')],[_0x50bb('0x3e'),'id'])||{})[_0x50bb('0x4f')](function(){return db[_0x50bb('0x50')]['findAll']({'attributes':['id',_0x50bb('0x20'),_0x50bb('0x51')],'where':{'id':_0x445abf['body']['ids']}});})[_0x50bb('0x1c')](function(_0x52b189){socket[_0x50bb('0x52')](_0x50bb('0x53'),{'id':Number(_0x445abf[_0x50bb('0x2d')]['id']),'tags':_0x52b189||[]});return{'id':Number(_0x445abf['params']['id']),'tags':_0x52b189||[]};});}})[_0x50bb('0x1c')](respondWithResult(_0x2db78f,null))[_0x50bb('0x2b')](handleError(_0x2db78f,null));};exports[_0x50bb('0x54')]=function(_0x3cc020,_0x4d95fc){return db['FaxInteraction']['find']({'where':{'id':_0x3cc020[_0x50bb('0x2d')]['id']}})[_0x50bb('0x1c')](handleEntityNotFound(_0x4d95fc,null))['then'](function(_0x2d04f4){if(_0x2d04f4){return _0x2d04f4[_0x50bb('0x54')](_0x3cc020[_0x50bb('0x29')][_0x50bb('0x3e')]);}})[_0x50bb('0x1c')](respondWithStatusCode(_0x4d95fc,null))[_0x50bb('0x2b')](handleError(_0x4d95fc,null));};exports[_0x50bb('0x55')]=function(_0x4e0b6a,_0x1c4919){var _0x4c3db0=moment()[_0x50bb('0x56')]()['toString']();var _0x56c398=path['join'](config[_0x50bb('0x57')],_0x50bb('0x58'),_0x50bb('0x59'),'tmp');var _0xc356a1=path[_0x50bb('0x5a')](config[_0x50bb('0x57')],'server',_0x50bb('0x59'),_0x50bb('0x5b'));var _0x3e29f1=path[_0x50bb('0x5a')](_0x56c398,_0x4c3db0);var _0x20d945=util['format'](_0x50bb('0x5c'),_0x4e0b6a['params']['id'],_0x4c3db0);var _0x29edf2=path['join'](_0x56c398,_0x20d945);var _0x131df5=[];_0x131df5[_0x50bb('0x5d')]({'model':db[_0x50bb('0x5e')],'as':_0x50bb('0x5e'),'raw':!![]});var _0x6a41da=[{'model':db[_0x50bb('0x3d')],'as':_0x50bb('0x5f'),'attributes':['id',_0x50bb('0x39'),_0x50bb('0x60')],'include':_0x131df5}];return db[_0x50bb('0x23')][_0x50bb('0x3a')]({'where':{'id':_0x4e0b6a[_0x50bb('0x2d')]['id']},'include':_0x6a41da})[_0x50bb('0x1c')](handleEntityNotFound(_0x1c4919,null))['then'](function(_0x17abe7){if(_0x17abe7&&_0x17abe7[_0x50bb('0x5f')]){var _0x8b4acc=_0x17abe7['get']({'plain':!![]});fs[_0x50bb('0x61')](_0x3e29f1);for(var _0x532f33=0x0;_0x532f33<_0x8b4acc[_0x50bb('0x5f')][_0x50bb('0x34')];_0x532f33++){var _0x35c25d=_0x8b4acc['Messages'][_0x532f33][_0x50bb('0x5e')];if(_0x35c25d){var _0x4298ad=path[_0x50bb('0x5a')](_0xc356a1,_0x35c25d['basename']);if(fs['existsSync'](_0x4298ad)){fs[_0x50bb('0x62')](_0x4298ad)[_0x50bb('0x63')](fs[_0x50bb('0x64')](path[_0x50bb('0x5a')](_0x3e29f1,_0x35c25d[_0x50bb('0x65')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x58ec2a,_0x5107d2){zipdir(_0x3e29f1,{'saveTo':_0x29edf2},function(_0x55e504,_0x3633dd){if(_0x55e504)return _0x5107d2(_0x55e504);return _0x58ec2a(_0x3633dd);});})[_0x50bb('0x1c')](function(){return new BPromise(function(_0x1c6179,_0x38fb33){rimraf(_0x3e29f1,function(_0x21178f){if(_0x21178f)_0x38fb33(_0x21178f);return _0x1c6179();});});})['then'](function(){return _0x1c4919['download'](_0x29edf2,_0x20d945,function(_0x2e4cf3){if(_0x2e4cf3){console[_0x50bb('0x66')](_0x50bb('0x67'),_0x2e4cf3);}else{fs[_0x50bb('0x68')](_0x29edf2);}});});});}else{return _0x1c4919[_0x50bb('0x11')](0xc8);}})[_0x50bb('0x2b')](handleError(_0x1c4919,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 0c772a4..9ffd8a5 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80b0=['FaxInteraction','FaxMessage','save','update','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x25a136,_0x57320e){var _0x5b7159=function(_0x32c8f9){while(--_0x32c8f9){_0x25a136['push'](_0x25a136['shift']());}};_0x5b7159(++_0x57320e);}(_0x80b0,0x95));var _0x080b=function(_0x8bbd6d,_0x1bcd5b){_0x8bbd6d=_0x8bbd6d-0x0;var _0x3d5539=_0x80b0[_0x8bbd6d];return _0x3d5539;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x080b('0x0'))['db'][_0x080b('0x1')];var FaxMessage=require(_0x080b('0x0'))['db'][_0x080b('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x080b('0x3'),'afterUpdate':_0x080b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x595093){return function(_0x5d1d41,_0x234a85,_0x3af6b9){_0x5d1d41['getUsers']({'attributes':['id'],'raw':!![]})[_0x080b('0x5')](function(_0x4cb5e2){_0x5d1d41[_0x080b('0x6')](_0x080b('0x7'),_0x4cb5e2[_0x080b('0x8')](function(_0x525307){return{'id':_0x525307['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x5d1d41['id'],'direction':'in','read':![]},'raw':!![]});})[_0x080b('0x5')](function(_0x46c4d1){_0x5d1d41[_0x080b('0x6')]('unreadMessages',_0x46c4d1[_0x080b('0x9')]);FaxInteractionEvents[_0x080b('0xa')](_0x595093+':'+_0x5d1d41['id'],_0x5d1d41);FaxInteractionEvents[_0x080b('0xa')](_0x595093,_0x5d1d41);_0x3af6b9(null);})[_0x080b('0xb')](_0x3af6b9(null));};}for(var e in events){if(events[_0x080b('0xc')](e)){var event=events[e];FaxInteraction[_0x080b('0xd')](e,emitEvent(event));}}module[_0x080b('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x727d=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x338253,_0x269685){var _0x549e8c=function(_0x180785){while(--_0x180785){_0x338253['push'](_0x338253['shift']());}};_0x549e8c(++_0x269685);}(_0x727d,0xa8));var _0xd727=function(_0x22f6f1,_0x1690df){_0x22f6f1=_0x22f6f1-0x0;var _0x3ec7f4=_0x727d[_0x22f6f1];return _0x3ec7f4;};'use strict';var EventEmitter=require(_0xd727('0x0'));var FaxInteraction=require(_0xd727('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xd727('0x1'))['db'][_0xd727('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd727('0x3'),'afterUpdate':'update','afterDestroy':_0xd727('0x4')};function emitEvent(_0x4442e0){return function(_0x2edfc9,_0x2a9525,_0x2b8352){_0x2edfc9[_0xd727('0x5')]({'attributes':['id'],'raw':!![]})[_0xd727('0x6')](function(_0x260c1a){_0x2edfc9[_0xd727('0x7')](_0xd727('0x8'),_0x260c1a[_0xd727('0x9')](function(_0xb4cec8){return{'id':_0xb4cec8['id']};}));return FaxMessage[_0xd727('0xa')]({'where':{'FaxInteractionId':_0x2edfc9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd727('0x6')](function(_0x57e140){_0x2edfc9[_0xd727('0x7')](_0xd727('0xb'),_0x57e140[_0xd727('0xc')]);FaxInteractionEvents[_0xd727('0xd')](_0x4442e0+':'+_0x2edfc9['id'],_0x2edfc9);FaxInteractionEvents[_0xd727('0xd')](_0x4442e0,_0x2edfc9);_0x2b8352(null);})[_0xd727('0xe')](_0x2b8352(null));};}for(var e in events){if(events[_0xd727('0xf')](e)){var event=events[e];FaxInteraction[_0xd727('0x10')](e,emitEvent(event));}}module[_0xd727('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 50663b4..528e294 100644 --- a/server/api/faxInteraction/faxInteraction.model.js +++ b/server/api/faxInteraction/faxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65a9=['path','rimraf','../../config/environment','exports','define','FaxInteraction','fax_interactions','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x67e59a,_0x119ae1){var _0x44c8ef=function(_0x540563){while(--_0x540563){_0x67e59a['push'](_0x67e59a['shift']());}};_0x44c8ef(++_0x119ae1);}(_0x65a9,0x81));var _0x965a=function(_0x3897a7,_0x572a12){_0x3897a7=_0x3897a7-0x0;var _0x15a70=_0x65a9[_0x3897a7];return _0x15a70;};'use strict';var _=require(_0x965a('0x0'));var util=require(_0x965a('0x1'));var logger=require(_0x965a('0x2'))(_0x965a('0x3'));var moment=require(_0x965a('0x4'));var BPromise=require(_0x965a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x965a('0x6'));var rimraf=require(_0x965a('0x7'));var config=require(_0x965a('0x8'));var attributes=require('./faxInteraction.attributes');module[_0x965a('0x9')]=function(_0x36524e,_0x952d9a){return _0x36524e[_0x965a('0xa')](_0x965a('0xb'),attributes,{'tableName':_0x965a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8a3728,_0x2cc5fd,_0x250bad){if(_0x8a3728['changed'](_0x965a('0xd'))){_0x8a3728[_0x965a('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x250bad(null,_0x8a3728);}}});}; \ No newline at end of file +var _0x4b02=['path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3b2028,_0x1ac361){var _0x38e443=function(_0x2799e5){while(--_0x2799e5){_0x3b2028['push'](_0x3b2028['shift']());}};_0x38e443(++_0x1ac361);}(_0x4b02,0xcd));var _0x24b0=function(_0x14ae7b,_0x3c26a4){_0x14ae7b=_0x14ae7b-0x0;var _0x28f774=_0x4b02[_0x14ae7b];return _0x28f774;};'use strict';var _=require('lodash');var util=require(_0x24b0('0x0'));var logger=require(_0x24b0('0x1'))('api');var moment=require(_0x24b0('0x2'));var BPromise=require(_0x24b0('0x3'));var rp=require(_0x24b0('0x4'));var fs=require('fs');var path=require(_0x24b0('0x5'));var rimraf=require(_0x24b0('0x6'));var config=require(_0x24b0('0x7'));var attributes=require(_0x24b0('0x8'));module[_0x24b0('0x9')]=function(_0x4ab406,_0x5a4f97){return _0x4ab406[_0x24b0('0xa')]('FaxInteraction',attributes,{'tableName':_0x24b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f3702,_0x52e238,_0x60cd9d){if(_0x4f3702['changed']('closed')){_0x4f3702['closedAt']=moment()[_0x24b0('0xc')](_0x24b0('0xd'));}_0x60cd9d(null,_0x4f3702);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index b5f6f66..c3cd4e6 100644 --- a/server/api/faxInteraction/faxInteraction.rpc.js +++ b/server/api/faxInteraction/faxInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8236=['defaults','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToFaxInteraction','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis'];(function(_0x3b9573,_0x53968a){var _0x318162=function(_0x997478){while(--_0x997478){_0x3b9573['push'](_0x3b9573['shift']());}};_0x318162(++_0x53968a);}(_0x8236,0xb0));var _0x6823=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x8236[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x6823('0x0'));var util=require(_0x6823('0x1'));var moment=require('moment');var BPromise=require(_0x6823('0x2'));var rs=require(_0x6823('0x3'));var fs=require('fs');var Redis=require(_0x6823('0x4'));var db=require(_0x6823('0x5'))['db'];var utils=require(_0x6823('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6823('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x6823('0x8')]=_[_0x6823('0x9')](config[_0x6823('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6823('0x8')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x55b663,_0xbe81b9,_0x5852a4){return new BPromise(function(_0xe17d50,_0x21e912){return client[_0x6823('0xa')](_0x55b663,_0x5852a4)[_0x6823('0xb')](function(_0x10988c){logger[_0x6823('0xc')]('FaxInteraction,\x20%s,\x20%s',_0xbe81b9,_0x6823('0xd'));logger['debug'](_0x6823('0xe'),_0xbe81b9,_0x6823('0xd'),JSON[_0x6823('0xf')](_0x10988c));if(_0x10988c['error']){if(_0x10988c[_0x6823('0x10')][_0x6823('0x11')]===0x1f4){logger['error'](_0x6823('0x12'),_0xbe81b9,_0x10988c[_0x6823('0x10')][_0x6823('0x13')]);return _0x21e912(_0x10988c[_0x6823('0x10')][_0x6823('0x13')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0xbe81b9,_0x10988c[_0x6823('0x10')][_0x6823('0x13')]);return _0xe17d50(_0x10988c[_0x6823('0x10')][_0x6823('0x13')]);}else{logger[_0x6823('0xc')]('FaxInteraction,\x20%s,\x20%s',_0xbe81b9,_0x6823('0xd'));_0xe17d50(_0x10988c[_0x6823('0x14')][_0x6823('0x13')]);}})[_0x6823('0x15')](function(_0x42c48b){logger['error'](_0x6823('0x12'),_0xbe81b9,_0x42c48b);_0x21e912(_0x42c48b);});});}exports[_0x6823('0x16')]=function(_0x5a6e2c){var _0x54d869=this;return new Promise(function(_0x44ddcb,_0x5720b5){return db[_0x6823('0x17')][_0x6823('0x18')](_0x5a6e2c[_0x6823('0x19')],{'raw':_0x5a6e2c[_0x6823('0x1a')]?_0x5a6e2c['options'][_0x6823('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a6e2c[_0x6823('0x1a')]?_0x5a6e2c[_0x6823('0x1a')][_0x6823('0x1c')]||null:null,'attributes':_0x5a6e2c['options']?_0x5a6e2c['options'][_0x6823('0x1d')]||null:null,'limit':_0x5a6e2c[_0x6823('0x1a')]?_0x5a6e2c['options'][_0x6823('0x1e')]||null:null})[_0x6823('0xb')](function(_0x53352a){logger[_0x6823('0xc')](_0x6823('0x16'),_0x5a6e2c);logger[_0x6823('0x1f')](_0x6823('0x16'),_0x5a6e2c,JSON[_0x6823('0xf')](_0x53352a));_0x44ddcb(_0x53352a);})[_0x6823('0x15')](function(_0x5277fe){logger[_0x6823('0x10')]('UpdateFaxInteraction',_0x5277fe[_0x6823('0x13')],_0x5a6e2c);_0x5720b5(_0x54d869[_0x6823('0x10')](0x1f4,_0x5277fe[_0x6823('0x13')]));});});};exports[_0x6823('0x20')]=function(_0x31915b){return new Promise(function(_0x496cef,_0x40b516){return db['FaxInteraction']['find']({'where':_0x31915b[_0x6823('0x1a')]?_0x31915b[_0x6823('0x1a')]['where']||null:null})[_0x6823('0xb')](function(_0x436c46){if(_0x436c46){return _0x436c46[_0x6823('0x21')](_0x31915b[_0x6823('0x19')][_0x6823('0x22')],_[_0x6823('0x23')](_0x31915b[_0x6823('0x19')],['ids','id'])||{});}})['spread'](function(_0x2211b0){logger['info'](_0x6823('0x24'),_0x31915b);logger[_0x6823('0x1f')](_0x6823('0x24'),_0x31915b,JSON[_0x6823('0xf')](_0x2211b0));_0x496cef(_0x2211b0);})[_0x6823('0x15')](function(_0x7c83d2){logger['error'](_0x6823('0x24'),_0x7c83d2[_0x6823('0x13')],_0x31915b);_0x40b516(_this[_0x6823('0x10')](0x1f4,_0x7c83d2[_0x6823('0x13')]));});});}; \ No newline at end of file +var _0x66e1=['jayson/promise','http','redis','defaults','localhost','./faxInteraction.socket','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','raw','options','where','limit','then','info','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1be9e4,_0x58925d){var _0x1cce7e=function(_0x25722b){while(--_0x25722b){_0x1be9e4['push'](_0x1be9e4['shift']());}};_0x1cce7e(++_0x58925d);}(_0x66e1,0x188));var _0x166e=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0x66e1[_0x507ac5];return _0x12c1bc;};'use strict';var _=require(_0x166e('0x0'));var util=require(_0x166e('0x1'));var moment=require(_0x166e('0x2'));var BPromise=require(_0x166e('0x3'));var rs=require(_0x166e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x166e('0x5'));var logger=require(_0x166e('0x6'))('rpc');var config=require(_0x166e('0x7'));var jayson=require(_0x166e('0x8'));var client=jayson['client'][_0x166e('0x9')]({'port':0x232a});config[_0x166e('0xa')]=_[_0x166e('0xb')](config[_0x166e('0xa')],{'host':_0x166e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x166e('0xd'))[_0x166e('0xe')](socket);function respondWithRpcPromise(_0x2e4432,_0x3dd1f4,_0x12b288){return new BPromise(function(_0x50b857,_0x5e654e){return client[_0x166e('0xf')](_0x2e4432,_0x12b288)['then'](function(_0xd7c840){logger['info'](_0x166e('0x10'),_0x3dd1f4,_0x166e('0x11'));logger[_0x166e('0x12')](_0x166e('0x13'),_0x3dd1f4,_0x166e('0x11'),JSON[_0x166e('0x14')](_0xd7c840));if(_0xd7c840[_0x166e('0x15')]){if(_0xd7c840['error'][_0x166e('0x16')]===0x1f4){logger['error'](_0x166e('0x10'),_0x3dd1f4,_0xd7c840[_0x166e('0x15')][_0x166e('0x17')]);return _0x5e654e(_0xd7c840[_0x166e('0x15')][_0x166e('0x17')]);}logger[_0x166e('0x15')](_0x166e('0x10'),_0x3dd1f4,_0xd7c840[_0x166e('0x15')][_0x166e('0x17')]);return _0x50b857(_0xd7c840['error']['message']);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x3dd1f4,_0x166e('0x11'));_0x50b857(_0xd7c840[_0x166e('0x18')][_0x166e('0x17')]);}})[_0x166e('0x19')](function(_0x4b39cb){logger['error'](_0x166e('0x10'),_0x3dd1f4,_0x4b39cb);_0x5e654e(_0x4b39cb);});});}exports[_0x166e('0x1a')]=function(_0x382f55){var _0x49d097=this;return new Promise(function(_0x1bbefc,_0x4e8725){return db[_0x166e('0x1b')]['update'](_0x382f55[_0x166e('0x1c')],{'raw':_0x382f55['options']?_0x382f55['options'][_0x166e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x382f55[_0x166e('0x1e')]?_0x382f55['options'][_0x166e('0x1f')]||null:null,'attributes':_0x382f55[_0x166e('0x1e')]?_0x382f55[_0x166e('0x1e')]['attributes']||null:null,'limit':_0x382f55['options']?_0x382f55[_0x166e('0x1e')][_0x166e('0x20')]||null:null})[_0x166e('0x21')](function(_0x57cdc1){logger[_0x166e('0x22')](_0x166e('0x1a'),_0x382f55);logger[_0x166e('0x12')](_0x166e('0x1a'),_0x382f55,JSON['stringify'](_0x57cdc1));_0x1bbefc(_0x57cdc1);})['catch'](function(_0x1bbb4e){logger['error']('UpdateFaxInteraction',_0x1bbb4e[_0x166e('0x17')],_0x382f55);_0x4e8725(_0x49d097[_0x166e('0x15')](0x1f4,_0x1bbb4e[_0x166e('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x3cbcdf){return new Promise(function(_0x30bba6,_0x4e6dd5){return db[_0x166e('0x1b')][_0x166e('0x23')]({'where':_0x3cbcdf['options']?_0x3cbcdf[_0x166e('0x1e')][_0x166e('0x1f')]||null:null})[_0x166e('0x21')](function(_0x5d5826){if(_0x5d5826){return _0x5d5826[_0x166e('0x24')](_0x3cbcdf[_0x166e('0x1c')][_0x166e('0x25')],_['omit'](_0x3cbcdf[_0x166e('0x1c')],[_0x166e('0x25'),'id'])||{});}})[_0x166e('0x26')](function(_0x2da307){logger[_0x166e('0x22')](_0x166e('0x27'),_0x3cbcdf);logger[_0x166e('0x12')]('AddTags',_0x3cbcdf,JSON['stringify'](_0x2da307));_0x30bba6(_0x2da307);})[_0x166e('0x19')](function(_0x247658){logger['error'](_0x166e('0x27'),_0x247658[_0x166e('0x17')],_0x3cbcdf);_0x4e6dd5(_this[_0x166e('0x15')](0x1f4,_0x247658[_0x166e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4197f60..f1240b5 100644 --- a/server/api/faxInteraction/faxInteraction.socket.js +++ b/server/api/faxInteraction/faxInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x386c=['update','removeListener','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x44b646,_0x2802e3){var _0x51726b=function(_0x548e1d){while(--_0x548e1d){_0x44b646['push'](_0x44b646['shift']());}};_0x51726b(++_0x2802e3);}(_0x386c,0x142));var _0xc386=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x386c[_0x42cae2];return _0x5f256f;};'use strict';var FaxInteractionEvents=require(_0xc386('0x0'));var events=[_0xc386('0x1'),'remove',_0xc386('0x2')];function createListener(_0x3ca98c,_0x4493a3){return function(_0x4a1461){_0x4493a3['emit'](_0x3ca98c,_0x4a1461);};}function removeListener(_0x43479b,_0x5101d6){return function(){FaxInteractionEvents[_0xc386('0x3')](_0x43479b,_0x5101d6);};}exports['register']=function(_0x5175b3){for(var _0x9d273a=0x0,_0xb3fe6d=events[_0xc386('0x4')];_0x9d273a<_0xb3fe6d;_0x9d273a++){var _0x1b6e3d=events[_0x9d273a];var _0x1bf344=createListener(_0xc386('0x5')+_0x1b6e3d,_0x5175b3);FaxInteractionEvents['on'](_0x1b6e3d,_0x1bf344);}}; \ No newline at end of file +var _0xe15a=['emit','register','length','faxInteraction:','./faxInteraction.events','save','update'];(function(_0x23b2c0,_0x1d62e6){var _0x55b333=function(_0x2f86a3){while(--_0x2f86a3){_0x23b2c0['push'](_0x23b2c0['shift']());}};_0x55b333(++_0x1d62e6);}(_0xe15a,0xc8));var _0xae15=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xe15a[_0x4fbfd9];return _0x31dc94;};'use strict';var FaxInteractionEvents=require(_0xae15('0x0'));var events=[_0xae15('0x1'),'remove',_0xae15('0x2')];function createListener(_0x2a6b7f,_0xee306c){return function(_0x4e4d9d){_0xee306c[_0xae15('0x3')](_0x2a6b7f,_0x4e4d9d);};}function removeListener(_0x2a2647,_0x16439f){return function(){FaxInteractionEvents['removeListener'](_0x2a2647,_0x16439f);};}exports[_0xae15('0x4')]=function(_0x1f0b27){for(var _0x105c51=0x0,_0x74b1a3=events[_0xae15('0x5')];_0x105c51<_0x74b1a3;_0x105c51++){var _0x3ad26f=events[_0x105c51];var _0x17ff72=createListener(_0xae15('0x6')+_0x3ad26f,_0x1f0b27);FaxInteractionEvents['on'](_0x3ad26f,_0x17ff72);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2313d8f..da7fc0a 100644 --- a/server/api/faxInteraction/index.js +++ b/server/api/faxInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x169c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','util','connect-timeout','express'];(function(_0x2e1777,_0x1f056a){var _0x35628f=function(_0x50499e){while(--_0x50499e){_0x2e1777['push'](_0x2e1777['shift']());}};_0x35628f(++_0x1f056a);}(_0x169c,0x1dc));var _0xc169=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0x169c[_0x2a453b];return _0x132f79;};'use strict';var multer=require(_0xc169('0x0'));var util=require(_0xc169('0x1'));var path=require('path');var timeout=require(_0xc169('0x2'));var express=require(_0xc169('0x3'));var router=express[_0xc169('0x4')]();var fs_extra=require(_0xc169('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc169('0x6'));var config=require(_0xc169('0x7'));var controller=require(_0xc169('0x8'));router[_0xc169('0x9')]('/',auth[_0xc169('0xa')](),controller[_0xc169('0xb')]);router[_0xc169('0x9')](_0xc169('0xc'),auth[_0xc169('0xa')](),controller['describe']);router[_0xc169('0x9')](_0xc169('0xd'),auth[_0xc169('0xa')](),controller[_0xc169('0xe')]);router['get'](_0xc169('0xf'),auth[_0xc169('0xa')](),controller[_0xc169('0x10')]);router[_0xc169('0x9')](_0xc169('0x11'),auth['isAuthenticated'](),controller[_0xc169('0x12')]);router['post']('/',auth[_0xc169('0xa')](),controller[_0xc169('0x13')]);router[_0xc169('0x14')](_0xc169('0xf'),auth[_0xc169('0xa')](),controller['addMessage']);router['post'](_0xc169('0x15'),auth['isAuthenticated'](),interaction[_0xc169('0x16')](_0xc169('0x17'),_0xc169('0x18')),controller['addTags']);router[_0xc169('0x19')](_0xc169('0xd'),auth[_0xc169('0xa')](),interaction['tracked']('fax',_0xc169('0x1a')),controller[_0xc169('0x1b')]);router[_0xc169('0x1c')]('/:id',auth[_0xc169('0xa')](),interaction['tracked'](_0xc169('0x17'),_0xc169('0x1d')),controller[_0xc169('0x1e')]);router[_0xc169('0x1c')](_0xc169('0x15'),auth[_0xc169('0xa')](),controller['removeTags']);module[_0xc169('0x1f')]=router; \ No newline at end of file +var _0x8365=['addMessage','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x381866,_0xaebd9d){var _0x44c7c7=function(_0x51b249){while(--_0x51b249){_0x381866['push'](_0x381866['shift']());}};_0x44c7c7(++_0xaebd9d);}(_0x8365,0x76));var _0x5836=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x8365[_0x3511d3];return _0x5d6321;};'use strict';var multer=require(_0x5836('0x0'));var util=require(_0x5836('0x1'));var path=require(_0x5836('0x2'));var timeout=require('connect-timeout');var express=require(_0x5836('0x3'));var router=express[_0x5836('0x4')]();var fs_extra=require(_0x5836('0x5'));var auth=require(_0x5836('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5836('0x7'));var controller=require(_0x5836('0x8'));router[_0x5836('0x9')]('/',auth['isAuthenticated'](),controller[_0x5836('0xa')]);router[_0x5836('0x9')](_0x5836('0xb'),auth[_0x5836('0xc')](),controller[_0x5836('0xd')]);router[_0x5836('0x9')](_0x5836('0xe'),auth[_0x5836('0xc')](),controller[_0x5836('0xf')]);router[_0x5836('0x9')](_0x5836('0x10'),auth[_0x5836('0xc')](),controller[_0x5836('0x11')]);router['get'](_0x5836('0x12'),auth[_0x5836('0xc')](),controller[_0x5836('0x13')]);router[_0x5836('0x14')]('/',auth[_0x5836('0xc')](),controller[_0x5836('0x15')]);router[_0x5836('0x14')](_0x5836('0x10'),auth[_0x5836('0xc')](),controller[_0x5836('0x16')]);router[_0x5836('0x14')]('/:id/tags',auth[_0x5836('0xc')](),interaction['tracked'](_0x5836('0x17'),_0x5836('0x18')),controller[_0x5836('0x19')]);router[_0x5836('0x1a')](_0x5836('0xe'),auth[_0x5836('0xc')](),interaction[_0x5836('0x1b')](_0x5836('0x17'),_0x5836('0x1c')),controller['update']);router[_0x5836('0x1d')](_0x5836('0xe'),auth['isAuthenticated'](),interaction[_0x5836('0x1b')](_0x5836('0x17'),_0x5836('0x1e')),controller[_0x5836('0x1f')]);router[_0x5836('0x1d')](_0x5836('0x20'),auth['isAuthenticated'](),controller[_0x5836('0x21')]);module[_0x5836('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7eb881a..ab3bcd0 100644 --- a/server/api/faxMessage/faxMessage.attributes.js +++ b/server/api/faxMessage/faxMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32ef=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x260b6f,_0x1edc36){var _0x3f672e=function(_0x4b536c){while(--_0x4b536c){_0x260b6f['push'](_0x260b6f['shift']());}};_0x3f672e(++_0x1edc36);}(_0x32ef,0xf9));var _0xf32e=function(_0x327f5a,_0x275253){_0x327f5a=_0x327f5a-0x0;var _0x4a3d43=_0x32ef[_0x327f5a];return _0x4a3d43;};'use strict';var Sequelize=require(_0xf32e('0x0'));module[_0xf32e('0x1')]={'body':{'type':Sequelize[_0xf32e('0x2')](_0xf32e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf32e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf32e('0x5')]('in','out'),'defaultValue':_0xf32e('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf32e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xc5c7=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x40998d,_0x48a09c){_0x40998d=_0x40998d-0x0;var _0x5bffbc=_0xc5c7[_0x40998d];return _0x5bffbc;};'use strict';var Sequelize=require('sequelize');module[_0x7c5c('0x0')]={'body':{'type':Sequelize[_0x7c5c('0x1')](_0x7c5c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7c5c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7c5c('0x4')]('in',_0x7c5c('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x7c5c('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7c5c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 2c48b8b..7d3d5d8 100644 --- a/server/api/faxMessage/faxMessage.controller.js +++ b/server/api/faxMessage/faxMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x409d=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxMessage.socket','jayson/promise','http','client','request','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','end','status','offset','undefined','count','set','json','apply','then','stack','send','index','map','type','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','catch','rawAttributes','find','body','params','describe','../../config/logger','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','update','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','ContactId','sequelize','Sequelize','SELECT','User','agent','fullname','email','internal','interface','SIP/%s','channel','accept','EventManager','acceptmessage','fax','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','motionChannel','event','reject','create','findOne','Attachment','SendFax','FaxAccountId','isNil','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','server','attachments'];(function(_0x9d489d,_0x4cc713){var _0x5a7b1d=function(_0x308be4){while(--_0x308be4){_0x9d489d['push'](_0x9d489d['shift']());}};_0x5a7b1d(++_0x4cc713);}(_0x409d,0x116));var _0xd409=function(_0x1e3e7c,_0xe7a8cc){_0x1e3e7c=_0x1e3e7c-0x0;var _0x4172ab=_0x409d[_0x1e3e7c];return _0x4172ab;};'use strict';var emlformat=require(_0xd409('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd409('0x1'));var jsonpatch=require(_0xd409('0x2'));var rp=require(_0xd409('0x3'));var moment=require(_0xd409('0x4'));var BPromise=require(_0xd409('0x5'));var Mustache=require(_0xd409('0x6'));var util=require(_0xd409('0x7'));var path=require(_0xd409('0x8'));var sox=require(_0xd409('0x9'));var csv=require(_0xd409('0xa'));var ejs=require(_0xd409('0xb'));var fs=require('fs');var fs_extra=require(_0xd409('0xc'));var _=require(_0xd409('0xd'));var squel=require(_0xd409('0xe'));var crypto=require(_0xd409('0xf'));var jsforce=require(_0xd409('0x10'));var deskjs=require(_0xd409('0x11'));var toCsv=require(_0xd409('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd409('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd409('0x13'));var as=require(_0xd409('0x14'));var hardwareService=require(_0xd409('0x15'));var logger=require('../../config/logger')(_0xd409('0x16'));var utils=require('../../config/utils');var config=require(_0xd409('0x17'));var licenseUtil=require(_0xd409('0x18'));var db=require(_0xd409('0x19'))['db'];config[_0xd409('0x1a')]=_[_0xd409('0x1b')](config[_0xd409('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd409('0x1a')]));require(_0xd409('0x1c'))['register'](socket);var jayson=require(_0xd409('0x1d'));var client=jayson['client'][_0xd409('0x1e')]({'port':0x232c});var client9002=jayson[_0xd409('0x1f')][_0xd409('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x70e25b,_0x2b6c47,_0x50be15,_0x404c1c){return new BPromise(function(_0x2baf6b,_0x1fd61d){var _0x5361af=_0x404c1c||client;return _0x5361af[_0xd409('0x20')](_0x70e25b,_0x50be15)['then'](function(_0x4d7639){logger['info'](_0xd409('0x21'),_0x2b6c47,_0xd409('0x22'));logger['debug'](_0xd409('0x23'),_0x2b6c47,_0xd409('0x22'),JSON['stringify'](_0x4d7639));if(_0x4d7639['error']){if(_0x4d7639[_0xd409('0x24')][_0xd409('0x25')]===0x1f4){logger[_0xd409('0x24')](_0xd409('0x21'),_0x2b6c47,_0x4d7639['error'][_0xd409('0x26')]);return _0x1fd61d(_0x4d7639['error'][_0xd409('0x26')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x2b6c47,_0x4d7639[_0xd409('0x24')][_0xd409('0x26')]);return _0x2baf6b(_0x4d7639[_0xd409('0x24')][_0xd409('0x26')]);}else{logger[_0xd409('0x27')](_0xd409('0x21'),_0x2b6c47,'request\x20sent');_0x2baf6b(_0x4d7639[_0xd409('0x28')]['message']);}})['catch'](function(_0x1d7c78){logger[_0xd409('0x24')](_0xd409('0x21'),_0x2b6c47,_0x1d7c78);_0x1fd61d(_0x1d7c78);});});}function respondWithStatusCode(_0x2f3402,_0x501821){_0x501821=_0x501821||0xcc;return function(_0x202741){if(_0x202741){return _0x2f3402[_0xd409('0x29')](_0x501821);}return _0x2f3402['status'](_0x501821)[_0xd409('0x2a')]();};}function respondWithResult(_0x34e8d3,_0x187a70){_0x187a70=_0x187a70||0xc8;return function(_0x58ee1d){if(_0x58ee1d){return _0x34e8d3[_0xd409('0x2b')](_0x187a70)['json'](_0x58ee1d);}};}function respondWithFilteredResult(_0x3d4887,_0x2dbaca){return function(_0x16510a){if(_0x16510a){var _0x238149=typeof _0x2dbaca[_0xd409('0x2c')]===_0xd409('0x2d')&&typeof _0x2dbaca['limit']===_0xd409('0x2d');var _0x2c33aa=_0x16510a[_0xd409('0x2e')];var _0x41bc63=_0x238149?0x0:_0x2dbaca[_0xd409('0x2c')];var _0x59e0eb=_0x238149?_0x16510a['count']:_0x2dbaca[_0xd409('0x2c')]+_0x2dbaca['limit'];var _0x4d06b0;if(_0x59e0eb>=_0x2c33aa){_0x59e0eb=_0x2c33aa;_0x4d06b0=0xc8;}else{_0x4d06b0=0xce;}_0x3d4887['status'](_0x4d06b0);return _0x3d4887[_0xd409('0x2f')]('Content-Range',_0x41bc63+'-'+_0x59e0eb+'/'+_0x2c33aa)[_0xd409('0x30')](_0x16510a);}return null;};}function patchUpdates(_0x5bd28f){return function(_0x4262dd){try{jsonpatch[_0xd409('0x31')](_0x4262dd,_0x5bd28f,!![]);}catch(_0x28140f){return BPromise['reject'](_0x28140f);}return _0x4262dd['save']();};}function saveUpdates(_0x586a2b,_0x35e499){return function(_0x3bdb31){if(_0x3bdb31){return _0x3bdb31['update'](_0x586a2b)[_0xd409('0x32')](function(_0x9800f7){return _0x9800f7;});}return null;};}function removeEntity(_0x2666c6,_0x3e197d){return function(_0x4dc769){if(_0x4dc769){return _0x4dc769['destroy']()[_0xd409('0x32')](function(){_0x2666c6[_0xd409('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c3922,_0x449f16){return function(_0x283926){if(!_0x283926){_0x5c3922[_0xd409('0x29')](0x194);}return _0x283926;};}function handleError(_0x2a4bfd,_0x2b3706){_0x2b3706=_0x2b3706||0x1f4;return function(_0x253c97){logger[_0xd409('0x24')](_0x253c97[_0xd409('0x33')]);if(_0x253c97['name']){delete _0x253c97['name'];}_0x2a4bfd[_0xd409('0x2b')](_0x2b3706)[_0xd409('0x34')](_0x253c97);};}exports[_0xd409('0x35')]=function(_0x7b5f2d,_0x3844a4){var _0x2223b2={},_0x5644fa={},_0x413890={'count':0x0,'rows':[]};var _0x3d4e56=_[_0xd409('0x36')](db['FaxMessage']['rawAttributes'],function(_0x46f855){return{'name':_0x46f855['fieldName'],'type':_0x46f855[_0xd409('0x37')]['key']};});_0x5644fa[_0xd409('0x38')]=_[_0xd409('0x36')](_0x3d4e56,_0xd409('0x39'));_0x5644fa[_0xd409('0x3a')]=_[_0xd409('0x3b')](_0x7b5f2d[_0xd409('0x3a')]);_0x5644fa[_0xd409('0x3c')]=_[_0xd409('0x3d')](_0x5644fa[_0xd409('0x38')],_0x5644fa[_0xd409('0x3a')]);_0x2223b2[_0xd409('0x3e')]=_['intersection'](_0x5644fa['model'],qs[_0xd409('0x3f')](_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x3f')]));_0x2223b2[_0xd409('0x3e')]=_0x2223b2['attributes']['length']?_0x2223b2[_0xd409('0x3e')]:_0x5644fa[_0xd409('0x38')];if(!_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x40')](_0xd409('0x41'))){_0x2223b2['limit']=qs[_0xd409('0x42')](_0x7b5f2d[_0xd409('0x3a')]['limit']);_0x2223b2[_0xd409('0x2c')]=qs[_0xd409('0x2c')](_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x2c')]);}_0x2223b2[_0xd409('0x43')]=qs['sort'](_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x44')]);_0x2223b2[_0xd409('0x45')]=qs[_0xd409('0x3c')](_[_0xd409('0x46')](_0x7b5f2d[_0xd409('0x3a')],_0x5644fa[_0xd409('0x3c')]),_0x3d4e56);if(_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x47')]){_0x2223b2['where']=_[_0xd409('0x48')](_0x2223b2[_0xd409('0x45')],{'$or':_['map'](_0x3d4e56,function(_0x3a0dea){if(_0x3a0dea['type']!==_0xd409('0x49')){var _0x398469={};_0x398469[_0x3a0dea[_0xd409('0x39')]]={'$like':'%'+_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x47')]+'%'};return _0x398469;}})});}_0x2223b2=_[_0xd409('0x48')]({},_0x2223b2,_0x7b5f2d[_0xd409('0x4a')]);var _0x36a9b9={'where':_0x2223b2[_0xd409('0x45')]};return db[_0xd409('0x4b')][_0xd409('0x2e')](_0x36a9b9)['then'](function(_0x4cd2b5){_0x413890[_0xd409('0x2e')]=_0x4cd2b5;if(_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x4c')]){_0x2223b2[_0xd409('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0xd409('0x4e')](_0x2223b2);})[_0xd409('0x32')](function(_0x5c049f){_0x413890['rows']=_0x5c049f;return _0x413890;})[_0xd409('0x32')](respondWithFilteredResult(_0x3844a4,_0x2223b2))[_0xd409('0x4f')](handleError(_0x3844a4,null));};exports['show']=function(_0x3152b8,_0x39c9f7){var _0x39f545={'raw':!![],'where':{'id':_0x3152b8['params']['id']}},_0x32048b={};_0x32048b[_0xd409('0x38')]=_[_0xd409('0x3b')](db['FaxMessage'][_0xd409('0x50')]);_0x32048b[_0xd409('0x3a')]=_[_0xd409('0x3b')](_0x3152b8[_0xd409('0x3a')]);_0x32048b['filters']=_[_0xd409('0x3d')](_0x32048b[_0xd409('0x38')],_0x32048b[_0xd409('0x3a')]);_0x39f545[_0xd409('0x3e')]=_[_0xd409('0x3d')](_0x32048b[_0xd409('0x38')],qs[_0xd409('0x3f')](_0x3152b8[_0xd409('0x3a')][_0xd409('0x3f')]));_0x39f545[_0xd409('0x3e')]=_0x39f545['attributes']['length']?_0x39f545[_0xd409('0x3e')]:_0x32048b[_0xd409('0x38')];if(_0x3152b8[_0xd409('0x3a')][_0xd409('0x4c')]){_0x39f545[_0xd409('0x4d')]=[{'all':!![]}];}_0x39f545=_[_0xd409('0x48')]({},_0x39f545,_0x3152b8[_0xd409('0x4a')]);return db[_0xd409('0x4b')][_0xd409('0x51')](_0x39f545)[_0xd409('0x32')](handleEntityNotFound(_0x39c9f7,null))[_0xd409('0x32')](respondWithResult(_0x39c9f7,null))[_0xd409('0x4f')](handleError(_0x39c9f7,null));};exports['update']=function(_0x234699,_0x373dbc){if(_0x234699[_0xd409('0x52')]['id']){delete _0x234699[_0xd409('0x52')]['id'];}return db[_0xd409('0x4b')][_0xd409('0x51')]({'where':{'id':_0x234699[_0xd409('0x53')]['id']}})[_0xd409('0x32')](handleEntityNotFound(_0x373dbc,null))[_0xd409('0x32')](saveUpdates(_0x234699[_0xd409('0x52')],null))[_0xd409('0x32')](respondWithResult(_0x373dbc,null))['catch'](handleError(_0x373dbc,null));};exports['destroy']=function(_0x354edd,_0x3970f9){return db[_0xd409('0x4b')][_0xd409('0x51')]({'where':{'id':_0x354edd[_0xd409('0x53')]['id']}})[_0xd409('0x32')](handleEntityNotFound(_0x3970f9,null))[_0xd409('0x32')](removeEntity(_0x3970f9,null))[_0xd409('0x4f')](handleError(_0x3970f9,null));};exports[_0xd409('0x54')]=function(_0x5b9c62,_0x334528){return db[_0xd409('0x4b')][_0xd409('0x54')]()[_0xd409('0x32')](respondWithResult(_0x334528,null))['catch'](handleError(_0x334528,null));};var interaction_log=require(_0xd409('0x55'))(_0xd409('0x56'));exports['accept']=function(_0x1f3539,_0x9d102f,_0x27f870){var _0x85dc0f={'agent':{},'channel':'fax'};if(_0x1f3539[_0xd409('0x52')]['id']){delete _0x1f3539[_0xd409('0x52')]['id'];}_0x1f3539['body'][_0xd409('0x57')]=!![];_0x1f3539[_0xd409('0x52')][_0xd409('0x58')]=moment()[_0xd409('0x59')](_0xd409('0x5a'));_0x1f3539[_0xd409('0x52')][_0xd409('0x5b')]=_0x1f3539[_0xd409('0x52')][_0xd409('0x5b')]||_0x1f3539[_0xd409('0x5c')]['id'];_0x85dc0f['agent']['id']=_0x1f3539[_0xd409('0x52')][_0xd409('0x5b')];return db[_0xd409('0x4b')][_0xd409('0x51')]({'where':{'id':_0x1f3539[_0xd409('0x53')]['id'],'UserId':null}})[_0xd409('0x32')](handleEntityNotFound(_0x9d102f,null))[_0xd409('0x32')](saveUpdates(_0x1f3539['body'],null))[_0xd409('0x32')](function(_0x42ec4d){if(_0x42ec4d){_0x85dc0f[_0xd409('0x26')]=_0x42ec4d[_0xd409('0x5d')]({'plain':!![]});return db[_0xd409('0x5e')][_0xd409('0x51')]({'where':{'id':_0x42ec4d[_0xd409('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x9d102f,null))['then'](function(_0x5e0774){if(_0x5e0774){return _0x5e0774[_0xd409('0x60')]({'UserId':_0x1f3539[_0xd409('0x52')][_0xd409('0x5b')],'read1stAt':_['isNil'](_0x5e0774[_0xd409('0x61')])?moment()[_0xd409('0x59')](_0xd409('0x5a')):undefined});}return null;})['then'](function(_0x1084b0){if(_0x1084b0){_0x85dc0f['interaction']=_0x1084b0[_0xd409('0x5d')]({'plain':!![]});interaction_log[_0xd409('0x27')](_0xd409('0x62'),_0x1f3539[_0xd409('0x5c')]['id'],_0x1f3539['user'][_0xd409('0x39')],_0x1f3539[_0xd409('0x5c')][_0xd409('0x63')],_0x85dc0f['interaction']['id'],_0x1f3539[_0xd409('0x52')]?JSON[_0xd409('0x64')](_0x1f3539[_0xd409('0x52')]):_0xd409('0x65'));return respondWithRpcPromise(_0xd409('0x66'),'acceptMessage',_0x85dc0f);}return null;})['then'](function(_0x2e1282){var _0x4af9e0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2e1282[_0xd409('0x26')][_0xd409('0x67')];return db[_0xd409('0x68')]['query'](_0x4af9e0,{'type':db[_0xd409('0x69')]['QueryTypes'][_0xd409('0x6a')],'raw':!![]})[_0xd409('0x32')](function(_0x1321ca){return _0x1321ca;});})[_0xd409('0x32')](function(_0x15db59){if(_0x15db59){_0x85dc0f['message']['contact']=_0x15db59[0x0];if(!_0x1f3539[_0xd409('0x52')][_0xd409('0x5b')])return;return db[_0xd409('0x6b')][_0xd409('0x51')]({'where':{'id':_0x1f3539['body'][_0xd409('0x5b')],'role':_0xd409('0x6c')},'attributes':['id','name',_0xd409('0x6d'),_0xd409('0x6e'),_0xd409('0x6f')],'raw':!![]});}return null;})[_0xd409('0x32')](function(_0x3bcf1e){if(!_0x3bcf1e)return null;_0x85dc0f['message'][_0xd409('0x6c')]=_0x3bcf1e;return _0x85dc0f;})['then'](function(_0x1b67dd){if(_0x1b67dd){if(_0x1f3539['body']['manual']){_0x85dc0f['message'][_0xd409('0x70')]=util[_0xd409('0x59')](_0xd409('0x71'),_0x1f3539[_0xd409('0x5c')][_0xd409('0x39')]);_0x85dc0f[_0xd409('0x26')][_0xd409('0x72')]=_0x85dc0f[_0xd409('0x72')];_0x85dc0f[_0xd409('0x26')]['motionChannel']=_0x85dc0f[_0xd409('0x72')];_0x85dc0f[_0xd409('0x26')]['event']=_0xd409('0x73');return respondWithRpcPromise(_0xd409('0x74'),_0xd409('0x74'),{'event':_0xd409('0x75'),'message':_0x85dc0f[_0xd409('0x26')]},client9002)[_0xd409('0x32')](function(){return _0x85dc0f;});}return _0x85dc0f;}return null;})['then'](respondWithResult(_0x9d102f,null))[_0xd409('0x4f')](handleError(_0x9d102f,null));};var interaction_log=require(_0xd409('0x55'))(_0xd409('0x56'));exports['reject']=function(_0x3a74e0,_0x3eb878,_0x3dd8fd){var _0x48406d={'agent':{},'channel':_0xd409('0x76')};if(_0x3a74e0[_0xd409('0x52')]['id']){delete _0x3a74e0[_0xd409('0x52')]['id'];}_0x3a74e0['body'][_0xd409('0x5b')]=_0x3a74e0[_0xd409('0x52')][_0xd409('0x5b')]||_0x3a74e0[_0xd409('0x5c')]['id'];_0x48406d[_0xd409('0x6c')]['id']=_0x3a74e0[_0xd409('0x52')][_0xd409('0x5b')];return db['FaxMessage'][_0xd409('0x51')]({'where':{'id':_0x3a74e0[_0xd409('0x53')]['id'],'UserId':null}})[_0xd409('0x32')](handleEntityNotFound(_0x3eb878,null))[_0xd409('0x32')](function(_0x501b01){if(_0x501b01){_0x48406d['message']=_0x501b01[_0xd409('0x5d')]({'plain':!![]});return db[_0xd409('0x5e')][_0xd409('0x51')]({'where':{'id':_0x501b01[_0xd409('0x5f')]}});}return null;})[_0xd409('0x32')](handleEntityNotFound(_0x3eb878,null))['then'](function(_0x2db6d7){if(_0x2db6d7){_0x48406d[_0xd409('0x77')]=_0x2db6d7[_0xd409('0x5d')]({'plain':!![]});interaction_log[_0xd409('0x27')](_0xd409('0x78'),_0x3a74e0[_0xd409('0x5c')]['id'],_0x3a74e0[_0xd409('0x5c')]['name'],_0x3a74e0[_0xd409('0x5c')][_0xd409('0x63')],_0x48406d[_0xd409('0x77')]['id'],_0x3a74e0[_0xd409('0x52')]?JSON[_0xd409('0x64')](_0x3a74e0[_0xd409('0x52')]):_0xd409('0x65'));return respondWithRpcPromise('RejectMessage',_0xd409('0x79'),_0x48406d);}return null;})[_0xd409('0x32')](function(_0x5b1592){var _0x883c7e=_0xd409('0x7a')+_0x5b1592[_0xd409('0x26')][_0xd409('0x67')];return db['sequelize'][_0xd409('0x3a')](_0x883c7e,{'type':db[_0xd409('0x69')][_0xd409('0x7b')]['SELECT'],'raw':!![]})[_0xd409('0x32')](function(_0xa60a50){return _0xa60a50;});})[_0xd409('0x32')](function(_0x136a89){if(_0x136a89){_0x48406d[_0xd409('0x26')]['contact']=_0x136a89[0x0];if(!_0x3a74e0[_0xd409('0x52')][_0xd409('0x5b')])return;return db[_0xd409('0x6b')][_0xd409('0x51')]({'where':{'id':_0x3a74e0[_0xd409('0x52')][_0xd409('0x5b')],'role':'agent'},'attributes':['id',_0xd409('0x39'),_0xd409('0x6d'),'email',_0xd409('0x6f')],'raw':!![]});}return null;})[_0xd409('0x32')](function(_0x1efc42){if(!_0x1efc42)return null;_0x48406d[_0xd409('0x26')][_0xd409('0x6c')]=_0x1efc42;return _0x48406d;})['then'](function(_0x3515ad){if(_0x3515ad){_0x3515ad['message']['interface']=util[_0xd409('0x59')](_0xd409('0x71'),_0x3a74e0['user'][_0xd409('0x39')]);_0x3515ad[_0xd409('0x26')]['channel']=_0x48406d['channel'];_0x3515ad[_0xd409('0x26')][_0xd409('0x7c')]=_0x48406d[_0xd409('0x72')];_0x3515ad[_0xd409('0x26')][_0xd409('0x7d')]=_0xd409('0x7e');respondWithRpcPromise(_0xd409('0x74'),_0xd409('0x74'),{'event':'rejectmessage','message':_0x3515ad[_0xd409('0x26')]},client9002);return _0x48406d;}return null;})[_0xd409('0x32')](respondWithResult(_0x3eb878,null))[_0xd409('0x4f')](handleError(_0x3eb878,null));};exports[_0xd409('0x7f')]=function(_0x40102e,_0xf24102){var _0x31ea4c;return db[_0xd409('0x4b')]['create'](_0x40102e[_0xd409('0x52')],{})[_0xd409('0x32')](function(_0x38f127){_0x31ea4c=_0x38f127;return db['CmContact'][_0xd409('0x80')]({'where':{'id':_0x31ea4c[_0xd409('0x67')]}});})[_0xd409('0x32')](function(_0x3d2ab7){if(_['isNil'](_0x3d2ab7)){return;}else{_0x31ea4c[_0xd409('0x76')]=_0x3d2ab7[_0xd409('0x76')];return db[_0xd409('0x81')]['findOne']({'where':{'id':_0x31ea4c['AttachmentId']}});}})['then'](function(_0x43cea5){return respondWithRpcPromise(_0xd409('0x82'),_0xd409('0x82'),{'FaxAccountId':_['isNil'](_0x40102e[_0xd409('0x52')])?undefined:_0x40102e[_0xd409('0x52')][_0xd409('0x83')],'path':_[_0xd409('0x84')](_0x43cea5)?undefined:util[_0xd409('0x59')](_0xd409('0x85'),_0x43cea5[_0xd409('0x86')]),'fax':_[_0xd409('0x84')](_0x31ea4c[_0xd409('0x76')])?undefined:_0x31ea4c['fax'],'AttachmentId':_0x31ea4c[_0xd409('0x87')]},client9002);})[_0xd409('0x32')](respondWithResult(_0xf24102,0xc9))[_0xd409('0x4f')](handleError(_0xf24102,null));};exports[_0xd409('0x88')]=function(_0x290181,_0x14e508){var _0xa6ceeb=path['join'](config['root'],_0xd409('0x89'),'files',_0xd409('0x8a'));return db[_0xd409('0x4b')]['find']({'where':{'id':_0x290181[_0xd409('0x53')]['id']},'include':[{'model':db[_0xd409('0x81')],'as':_0xd409('0x81')}]})['then'](handleEntityNotFound(_0x14e508,null))[_0xd409('0x32')](function(_0x4dd7b1){if(_0x4dd7b1){return _0x14e508[_0xd409('0x88')](path['join'](_0xa6ceeb,_0x4dd7b1['Attachment'][_0xd409('0x86')]));}})[_0xd409('0x4f')](handleError(_0x14e508,null));}; \ No newline at end of file +var _0xf062=['get','FaxInteraction','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT','contact','internal','rejectmessage','create','findOne','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','server','files','attachments','Attachment','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','message','FaxMessage,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','stack','name','send','map','FaxMessage','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','order','filters','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','find','body','describe','accept','fax','format','UserId','agent'];(function(_0x59142e,_0x549776){var _0x54d462=function(_0x4074e9){while(--_0x4074e9){_0x59142e['push'](_0x59142e['shift']());}};_0x54d462(++_0x549776);}(_0xf062,0x1c6));var _0x2f06=function(_0x2e44bf,_0x3b6594){_0x2e44bf=_0x2e44bf-0x0;var _0x3fa399=_0xf062[_0x2e44bf];return _0x3fa399;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f06('0x0'));var zipdir=require(_0x2f06('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f06('0x2'));var moment=require(_0x2f06('0x3'));var BPromise=require(_0x2f06('0x4'));var Mustache=require(_0x2f06('0x5'));var util=require('util');var path=require(_0x2f06('0x6'));var sox=require(_0x2f06('0x7'));var csv=require(_0x2f06('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f06('0x9'));var _=require(_0x2f06('0xa'));var squel=require(_0x2f06('0xb'));var crypto=require(_0x2f06('0xc'));var jsforce=require(_0x2f06('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2f06('0x8'));var querystring=require(_0x2f06('0xe'));var Papa=require(_0x2f06('0xf'));var Redis=require(_0x2f06('0x10'));var authService=require(_0x2f06('0x11'));var qs=require(_0x2f06('0x12'));var as=require(_0x2f06('0x13'));var hardwareService=require(_0x2f06('0x14'));var logger=require(_0x2f06('0x15'))(_0x2f06('0x16'));var utils=require('../../config/utils');var config=require(_0x2f06('0x17'));var licenseUtil=require(_0x2f06('0x18'));var db=require('../../mysqldb')['db'];config[_0x2f06('0x19')]=_[_0x2f06('0x1a')](config['redis'],{'host':_0x2f06('0x1b'),'port':0x18eb});var socket=require(_0x2f06('0x1c'))(new Redis(config['redis']));require(_0x2f06('0x1d'))['register'](socket);var jayson=require(_0x2f06('0x1e'));var client=jayson[_0x2f06('0x1f')][_0x2f06('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x2f06('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1a8d00,_0x3bdf2e,_0x3c8641,_0x46dfbb){return new BPromise(function(_0xde18c9,_0x432c6a){var _0x19aa12=_0x46dfbb||client;return _0x19aa12['request'](_0x1a8d00,_0x3c8641)[_0x2f06('0x21')](function(_0x549c06){logger[_0x2f06('0x22')]('FaxMessage,\x20%s,\x20%s',_0x3bdf2e,'request\x20sent');logger[_0x2f06('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3bdf2e,_0x2f06('0x24'),JSON[_0x2f06('0x25')](_0x549c06));if(_0x549c06[_0x2f06('0x26')]){if(_0x549c06[_0x2f06('0x26')]['code']===0x1f4){logger[_0x2f06('0x26')]('FaxMessage,\x20%s,\x20%s',_0x3bdf2e,_0x549c06[_0x2f06('0x26')][_0x2f06('0x27')]);return _0x432c6a(_0x549c06[_0x2f06('0x26')][_0x2f06('0x27')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x3bdf2e,_0x549c06[_0x2f06('0x26')][_0x2f06('0x27')]);return _0xde18c9(_0x549c06[_0x2f06('0x26')][_0x2f06('0x27')]);}else{logger['info'](_0x2f06('0x28'),_0x3bdf2e,_0x2f06('0x24'));_0xde18c9(_0x549c06['result'][_0x2f06('0x27')]);}})[_0x2f06('0x29')](function(_0x3f0e63){logger[_0x2f06('0x26')](_0x2f06('0x28'),_0x3bdf2e,_0x3f0e63);_0x432c6a(_0x3f0e63);});});}function respondWithStatusCode(_0x5e66d3,_0x362a39){_0x362a39=_0x362a39||0xcc;return function(_0x12b68f){if(_0x12b68f){return _0x5e66d3[_0x2f06('0x2a')](_0x362a39);}return _0x5e66d3[_0x2f06('0x2b')](_0x362a39)[_0x2f06('0x2c')]();};}function respondWithResult(_0x36a569,_0x64b585){_0x64b585=_0x64b585||0xc8;return function(_0x3b7bb5){if(_0x3b7bb5){return _0x36a569[_0x2f06('0x2b')](_0x64b585)[_0x2f06('0x2d')](_0x3b7bb5);}};}function respondWithFilteredResult(_0x501866,_0x2adc56){return function(_0x12041c){if(_0x12041c){var _0x53c206=typeof _0x2adc56[_0x2f06('0x2e')]===_0x2f06('0x2f')&&typeof _0x2adc56[_0x2f06('0x30')]===_0x2f06('0x2f');var _0x53e1f4=_0x12041c[_0x2f06('0x31')];var _0x3b4c62=_0x53c206?0x0:_0x2adc56[_0x2f06('0x2e')];var _0x263e4e=_0x53c206?_0x12041c[_0x2f06('0x31')]:_0x2adc56[_0x2f06('0x2e')]+_0x2adc56['limit'];var _0x22a42b;if(_0x263e4e>=_0x53e1f4){_0x263e4e=_0x53e1f4;_0x22a42b=0xc8;}else{_0x22a42b=0xce;}_0x501866['status'](_0x22a42b);return _0x501866[_0x2f06('0x32')]('Content-Range',_0x3b4c62+'-'+_0x263e4e+'/'+_0x53e1f4)[_0x2f06('0x2d')](_0x12041c);}return null;};}function patchUpdates(_0x3477bd){return function(_0x561b12){try{jsonpatch[_0x2f06('0x33')](_0x561b12,_0x3477bd,!![]);}catch(_0x1900a6){return BPromise['reject'](_0x1900a6);}return _0x561b12[_0x2f06('0x34')]();};}function saveUpdates(_0x328f46,_0x4f5a2a){return function(_0x37e318){if(_0x37e318){return _0x37e318[_0x2f06('0x35')](_0x328f46)[_0x2f06('0x21')](function(_0x3ba65f){return _0x3ba65f;});}return null;};}function removeEntity(_0x2217d1,_0x3e0095){return function(_0x513ef4){if(_0x513ef4){return _0x513ef4[_0x2f06('0x36')]()[_0x2f06('0x21')](function(){_0x2217d1[_0x2f06('0x2b')](0xcc)[_0x2f06('0x2c')]();});}};}function handleEntityNotFound(_0x370b75,_0x1762aa){return function(_0x3e3ab8){if(!_0x3e3ab8){_0x370b75[_0x2f06('0x2a')](0x194);}return _0x3e3ab8;};}function handleError(_0x435282,_0x4e7173){_0x4e7173=_0x4e7173||0x1f4;return function(_0x2df94d){logger[_0x2f06('0x26')](_0x2df94d[_0x2f06('0x37')]);if(_0x2df94d[_0x2f06('0x38')]){delete _0x2df94d[_0x2f06('0x38')];}_0x435282[_0x2f06('0x2b')](_0x4e7173)[_0x2f06('0x39')](_0x2df94d);};}exports['index']=function(_0x2c8027,_0x1f6655){var _0x50cf09={},_0x39ed0f={},_0x52ea13={'count':0x0,'rows':[]};var _0x4dce21=_[_0x2f06('0x3a')](db[_0x2f06('0x3b')][_0x2f06('0x3c')],function(_0x40260c){return{'name':_0x40260c['fieldName'],'type':_0x40260c[_0x2f06('0x3d')][_0x2f06('0x3e')]};});_0x39ed0f['model']=_['map'](_0x4dce21,_0x2f06('0x38'));_0x39ed0f[_0x2f06('0x3f')]=_[_0x2f06('0x40')](_0x2c8027[_0x2f06('0x3f')]);_0x39ed0f['filters']=_[_0x2f06('0x41')](_0x39ed0f['model'],_0x39ed0f[_0x2f06('0x3f')]);_0x50cf09[_0x2f06('0x42')]=_[_0x2f06('0x41')](_0x39ed0f[_0x2f06('0x43')],qs[_0x2f06('0x44')](_0x2c8027[_0x2f06('0x3f')][_0x2f06('0x44')]));_0x50cf09[_0x2f06('0x42')]=_0x50cf09[_0x2f06('0x42')][_0x2f06('0x45')]?_0x50cf09[_0x2f06('0x42')]:_0x39ed0f[_0x2f06('0x43')];if(!_0x2c8027[_0x2f06('0x3f')]['hasOwnProperty'](_0x2f06('0x46'))){_0x50cf09['limit']=qs[_0x2f06('0x30')](_0x2c8027['query'][_0x2f06('0x30')]);_0x50cf09[_0x2f06('0x2e')]=qs['offset'](_0x2c8027[_0x2f06('0x3f')][_0x2f06('0x2e')]);}_0x50cf09[_0x2f06('0x47')]=qs['sort'](_0x2c8027['query']['sort']);_0x50cf09['where']=qs[_0x2f06('0x48')](_['pick'](_0x2c8027['query'],_0x39ed0f[_0x2f06('0x48')]),_0x4dce21);if(_0x2c8027[_0x2f06('0x3f')][_0x2f06('0x49')]){_0x50cf09[_0x2f06('0x4a')]=_[_0x2f06('0x4b')](_0x50cf09['where'],{'$or':_[_0x2f06('0x3a')](_0x4dce21,function(_0x52c770){if(_0x52c770[_0x2f06('0x3d')]!==_0x2f06('0x4c')){var _0x5cfedc={};_0x5cfedc[_0x52c770[_0x2f06('0x38')]]={'$like':'%'+_0x2c8027[_0x2f06('0x3f')][_0x2f06('0x49')]+'%'};return _0x5cfedc;}})});}_0x50cf09=_['merge']({},_0x50cf09,_0x2c8027[_0x2f06('0x4d')]);var _0x5e0587={'where':_0x50cf09[_0x2f06('0x4a')]};return db[_0x2f06('0x3b')][_0x2f06('0x31')](_0x5e0587)[_0x2f06('0x21')](function(_0x10f98e){_0x52ea13[_0x2f06('0x31')]=_0x10f98e;if(_0x2c8027[_0x2f06('0x3f')][_0x2f06('0x4e')]){_0x50cf09['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x50cf09);})['then'](function(_0x2850f3){_0x52ea13[_0x2f06('0x4f')]=_0x2850f3;return _0x52ea13;})[_0x2f06('0x21')](respondWithFilteredResult(_0x1f6655,_0x50cf09))[_0x2f06('0x29')](handleError(_0x1f6655,null));};exports[_0x2f06('0x50')]=function(_0x1a49d7,_0x12e1e7){var _0x4382b6={'raw':!![],'where':{'id':_0x1a49d7[_0x2f06('0x51')]['id']}},_0xc84070={};_0xc84070[_0x2f06('0x43')]=_['keys'](db[_0x2f06('0x3b')][_0x2f06('0x3c')]);_0xc84070['query']=_['keys'](_0x1a49d7[_0x2f06('0x3f')]);_0xc84070['filters']=_['intersection'](_0xc84070['model'],_0xc84070[_0x2f06('0x3f')]);_0x4382b6[_0x2f06('0x42')]=_['intersection'](_0xc84070[_0x2f06('0x43')],qs[_0x2f06('0x44')](_0x1a49d7[_0x2f06('0x3f')]['fields']));_0x4382b6[_0x2f06('0x42')]=_0x4382b6[_0x2f06('0x42')][_0x2f06('0x45')]?_0x4382b6[_0x2f06('0x42')]:_0xc84070[_0x2f06('0x43')];if(_0x1a49d7[_0x2f06('0x3f')][_0x2f06('0x4e')]){_0x4382b6['include']=[{'all':!![]}];}_0x4382b6=_['merge']({},_0x4382b6,_0x1a49d7['options']);return db[_0x2f06('0x3b')][_0x2f06('0x52')](_0x4382b6)[_0x2f06('0x21')](handleEntityNotFound(_0x12e1e7,null))[_0x2f06('0x21')](respondWithResult(_0x12e1e7,null))[_0x2f06('0x29')](handleError(_0x12e1e7,null));};exports[_0x2f06('0x35')]=function(_0x5a0ae9,_0x1091ba){if(_0x5a0ae9[_0x2f06('0x53')]['id']){delete _0x5a0ae9[_0x2f06('0x53')]['id'];}return db['FaxMessage'][_0x2f06('0x52')]({'where':{'id':_0x5a0ae9[_0x2f06('0x51')]['id']}})[_0x2f06('0x21')](handleEntityNotFound(_0x1091ba,null))[_0x2f06('0x21')](saveUpdates(_0x5a0ae9[_0x2f06('0x53')],null))['then'](respondWithResult(_0x1091ba,null))[_0x2f06('0x29')](handleError(_0x1091ba,null));};exports['destroy']=function(_0x48981d,_0xbc9cd0){return db[_0x2f06('0x3b')][_0x2f06('0x52')]({'where':{'id':_0x48981d[_0x2f06('0x51')]['id']}})[_0x2f06('0x21')](handleEntityNotFound(_0xbc9cd0,null))['then'](removeEntity(_0xbc9cd0,null))[_0x2f06('0x29')](handleError(_0xbc9cd0,null));};exports[_0x2f06('0x54')]=function(_0x3d5900,_0xbdfa31){return db[_0x2f06('0x3b')][_0x2f06('0x54')]()['then'](respondWithResult(_0xbdfa31,null))[_0x2f06('0x29')](handleError(_0xbdfa31,null));};var interaction_log=require(_0x2f06('0x15'))('fax-interactions');exports[_0x2f06('0x55')]=function(_0x583c8b,_0x172d53,_0x6713ea){var _0x123136={'agent':{},'channel':_0x2f06('0x56')};if(_0x583c8b[_0x2f06('0x53')]['id']){delete _0x583c8b[_0x2f06('0x53')]['id'];}_0x583c8b[_0x2f06('0x53')]['read']=!![];_0x583c8b[_0x2f06('0x53')]['readAt']=moment()[_0x2f06('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x583c8b[_0x2f06('0x53')][_0x2f06('0x58')]=_0x583c8b[_0x2f06('0x53')][_0x2f06('0x58')]||_0x583c8b['user']['id'];_0x123136[_0x2f06('0x59')]['id']=_0x583c8b[_0x2f06('0x53')][_0x2f06('0x58')];return db[_0x2f06('0x3b')][_0x2f06('0x52')]({'where':{'id':_0x583c8b[_0x2f06('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x172d53,null))['then'](saveUpdates(_0x583c8b[_0x2f06('0x53')],null))[_0x2f06('0x21')](function(_0x3c101a){if(_0x3c101a){_0x123136[_0x2f06('0x27')]=_0x3c101a[_0x2f06('0x5a')]({'plain':!![]});return db[_0x2f06('0x5b')][_0x2f06('0x52')]({'where':{'id':_0x3c101a['FaxInteractionId']}});}return null;})[_0x2f06('0x21')](handleEntityNotFound(_0x172d53,null))[_0x2f06('0x21')](function(_0x1d8555){if(_0x1d8555){return _0x1d8555[_0x2f06('0x35')]({'UserId':_0x583c8b['body'][_0x2f06('0x58')],'read1stAt':_[_0x2f06('0x5c')](_0x1d8555[_0x2f06('0x5d')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2f06('0x21')](function(_0x10ec88){if(_0x10ec88){_0x123136['interaction']=_0x10ec88[_0x2f06('0x5a')]({'plain':!![]});interaction_log[_0x2f06('0x22')](_0x2f06('0x5e'),_0x583c8b[_0x2f06('0x5f')]['id'],_0x583c8b[_0x2f06('0x5f')][_0x2f06('0x38')],_0x583c8b[_0x2f06('0x5f')]['role'],_0x123136[_0x2f06('0x60')]['id'],_0x583c8b['body']?JSON['stringify'](_0x583c8b[_0x2f06('0x53')]):_0x2f06('0x61'));return respondWithRpcPromise(_0x2f06('0x62'),_0x2f06('0x63'),_0x123136);}return null;})['then'](function(_0x4912a8){var _0x236522=_0x2f06('0x64')+_0x4912a8[_0x2f06('0x27')][_0x2f06('0x65')];return db[_0x2f06('0x66')][_0x2f06('0x3f')](_0x236522,{'type':db['Sequelize'][_0x2f06('0x67')]['SELECT'],'raw':!![]})[_0x2f06('0x21')](function(_0x2ff114){return _0x2ff114;});})[_0x2f06('0x21')](function(_0x1ad5cd){if(_0x1ad5cd){_0x123136[_0x2f06('0x27')]['contact']=_0x1ad5cd[0x0];if(!_0x583c8b['body']['UserId'])return;return db[_0x2f06('0x68')][_0x2f06('0x52')]({'where':{'id':_0x583c8b[_0x2f06('0x53')][_0x2f06('0x58')],'role':'agent'},'attributes':['id',_0x2f06('0x38'),_0x2f06('0x69'),_0x2f06('0x6a'),'internal'],'raw':!![]});}return null;})[_0x2f06('0x21')](function(_0x21ac58){if(!_0x21ac58)return null;_0x123136[_0x2f06('0x27')]['agent']=_0x21ac58;return _0x123136;})[_0x2f06('0x21')](function(_0x203429){if(_0x203429){if(_0x583c8b['body'][_0x2f06('0x6b')]){_0x123136['message'][_0x2f06('0x6c')]=util[_0x2f06('0x57')](_0x2f06('0x6d'),_0x583c8b['user'][_0x2f06('0x38')]);_0x123136[_0x2f06('0x27')][_0x2f06('0x6e')]=_0x123136[_0x2f06('0x6e')];_0x123136[_0x2f06('0x27')][_0x2f06('0x6f')]=_0x123136['channel'];_0x123136[_0x2f06('0x27')][_0x2f06('0x70')]=_0x2f06('0x55');return respondWithRpcPromise('EventManager',_0x2f06('0x71'),{'event':_0x2f06('0x72'),'message':_0x123136[_0x2f06('0x27')]},client9002)[_0x2f06('0x21')](function(){return _0x123136;});}return _0x123136;}return null;})[_0x2f06('0x21')](respondWithResult(_0x172d53,null))[_0x2f06('0x29')](handleError(_0x172d53,null));};var interaction_log=require(_0x2f06('0x15'))('fax-interactions');exports[_0x2f06('0x73')]=function(_0x416703,_0x39fb0c,_0x24a54d){var _0x2fd9e1={'agent':{},'channel':_0x2f06('0x56')};if(_0x416703[_0x2f06('0x53')]['id']){delete _0x416703['body']['id'];}_0x416703[_0x2f06('0x53')][_0x2f06('0x58')]=_0x416703[_0x2f06('0x53')][_0x2f06('0x58')]||_0x416703['user']['id'];_0x2fd9e1[_0x2f06('0x59')]['id']=_0x416703[_0x2f06('0x53')][_0x2f06('0x58')];return db[_0x2f06('0x3b')][_0x2f06('0x52')]({'where':{'id':_0x416703[_0x2f06('0x51')]['id'],'UserId':null}})[_0x2f06('0x21')](handleEntityNotFound(_0x39fb0c,null))[_0x2f06('0x21')](function(_0x269b2a){if(_0x269b2a){_0x2fd9e1[_0x2f06('0x27')]=_0x269b2a['get']({'plain':!![]});return db[_0x2f06('0x5b')]['find']({'where':{'id':_0x269b2a[_0x2f06('0x74')]}});}return null;})[_0x2f06('0x21')](handleEntityNotFound(_0x39fb0c,null))[_0x2f06('0x21')](function(_0x33552c){if(_0x33552c){_0x2fd9e1[_0x2f06('0x60')]=_0x33552c[_0x2f06('0x5a')]({'plain':!![]});interaction_log[_0x2f06('0x22')](_0x2f06('0x75'),_0x416703[_0x2f06('0x5f')]['id'],_0x416703[_0x2f06('0x5f')][_0x2f06('0x38')],_0x416703[_0x2f06('0x5f')][_0x2f06('0x76')],_0x2fd9e1[_0x2f06('0x60')]['id'],_0x416703[_0x2f06('0x53')]?JSON[_0x2f06('0x25')](_0x416703[_0x2f06('0x53')]):_0x2f06('0x61'));return respondWithRpcPromise(_0x2f06('0x77'),_0x2f06('0x78'),_0x2fd9e1);}return null;})[_0x2f06('0x21')](function(_0x2ad07e){var _0x2f6d65=_0x2f06('0x64')+_0x2ad07e[_0x2f06('0x27')][_0x2f06('0x65')];return db[_0x2f06('0x66')][_0x2f06('0x3f')](_0x2f6d65,{'type':db['Sequelize'][_0x2f06('0x67')][_0x2f06('0x79')],'raw':!![]})[_0x2f06('0x21')](function(_0x5a798c){return _0x5a798c;});})[_0x2f06('0x21')](function(_0x4f52a9){if(_0x4f52a9){_0x2fd9e1[_0x2f06('0x27')][_0x2f06('0x7a')]=_0x4f52a9[0x0];if(!_0x416703[_0x2f06('0x53')][_0x2f06('0x58')])return;return db['User'][_0x2f06('0x52')]({'where':{'id':_0x416703['body'][_0x2f06('0x58')],'role':_0x2f06('0x59')},'attributes':['id','name','fullname',_0x2f06('0x6a'),_0x2f06('0x7b')],'raw':!![]});}return null;})[_0x2f06('0x21')](function(_0x1ce6b8){if(!_0x1ce6b8)return null;_0x2fd9e1[_0x2f06('0x27')][_0x2f06('0x59')]=_0x1ce6b8;return _0x2fd9e1;})[_0x2f06('0x21')](function(_0x4dfee4){if(_0x4dfee4){_0x4dfee4[_0x2f06('0x27')][_0x2f06('0x6c')]=util[_0x2f06('0x57')](_0x2f06('0x6d'),_0x416703[_0x2f06('0x5f')][_0x2f06('0x38')]);_0x4dfee4['message'][_0x2f06('0x6e')]=_0x2fd9e1[_0x2f06('0x6e')];_0x4dfee4[_0x2f06('0x27')][_0x2f06('0x6f')]=_0x2fd9e1[_0x2f06('0x6e')];_0x4dfee4[_0x2f06('0x27')][_0x2f06('0x70')]=_0x2f06('0x73');respondWithRpcPromise(_0x2f06('0x71'),_0x2f06('0x71'),{'event':_0x2f06('0x7c'),'message':_0x4dfee4[_0x2f06('0x27')]},client9002);return _0x2fd9e1;}return null;})[_0x2f06('0x21')](respondWithResult(_0x39fb0c,null))[_0x2f06('0x29')](handleError(_0x39fb0c,null));};exports[_0x2f06('0x7d')]=function(_0x3e07cb,_0x42018b){var _0x4b84ba;return db[_0x2f06('0x3b')][_0x2f06('0x7d')](_0x3e07cb[_0x2f06('0x53')],{})[_0x2f06('0x21')](function(_0xf59ec6){_0x4b84ba=_0xf59ec6;return db['CmContact'][_0x2f06('0x7e')]({'where':{'id':_0x4b84ba[_0x2f06('0x65')]}});})[_0x2f06('0x21')](function(_0x323cdc){if(_['isNil'](_0x323cdc)){return;}else{_0x4b84ba[_0x2f06('0x56')]=_0x323cdc[_0x2f06('0x56')];return db['Attachment'][_0x2f06('0x7e')]({'where':{'id':_0x4b84ba['AttachmentId']}});}})[_0x2f06('0x21')](function(_0x17081d){return respondWithRpcPromise(_0x2f06('0x7f'),_0x2f06('0x7f'),{'FaxAccountId':_[_0x2f06('0x5c')](_0x3e07cb[_0x2f06('0x53')])?undefined:_0x3e07cb[_0x2f06('0x53')]['FaxAccountId'],'path':_[_0x2f06('0x5c')](_0x17081d)?undefined:util['format'](_0x2f06('0x80'),_0x17081d[_0x2f06('0x81')]),'fax':_[_0x2f06('0x5c')](_0x4b84ba[_0x2f06('0x56')])?undefined:_0x4b84ba[_0x2f06('0x56')],'AttachmentId':_0x4b84ba[_0x2f06('0x82')]},client9002);})[_0x2f06('0x21')](respondWithResult(_0x42018b,0xc9))['catch'](handleError(_0x42018b,null));};exports[_0x2f06('0x83')]=function(_0x56690a,_0x4deb26){var _0xdfd365=path['join'](config['root'],_0x2f06('0x84'),_0x2f06('0x85'),_0x2f06('0x86'));return db[_0x2f06('0x3b')][_0x2f06('0x52')]({'where':{'id':_0x56690a[_0x2f06('0x51')]['id']},'include':[{'model':db[_0x2f06('0x87')],'as':_0x2f06('0x87')}]})['then'](handleEntityNotFound(_0x4deb26,null))[_0x2f06('0x21')](function(_0x3ea3dc){if(_0x3ea3dc){return _0x4deb26['download'](path['join'](_0xdfd365,_0x3ea3dc[_0x2f06('0x87')][_0x2f06('0x81')]));}})['catch'](handleError(_0x4deb26,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 364a76b..900c165 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9505=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x5887fb,_0x20db23){var _0x139d5c=function(_0x42d0db){while(--_0x42d0db){_0x5887fb['push'](_0x5887fb['shift']());}};_0x139d5c(++_0x20db23);}(_0x9505,0x1e5));var _0x5950=function(_0x77c858,_0x318c80){_0x77c858=_0x77c858-0x0;var _0x54e284=_0x9505[_0x77c858];return _0x54e284;};'use strict';var EventEmitter=require(_0x5950('0x0'));var FaxMessage=require(_0x5950('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5950('0x2')](0x0);var events={'afterCreate':_0x5950('0x3'),'afterUpdate':_0x5950('0x4'),'afterDestroy':_0x5950('0x5')};function emitEvent(_0x1344e4){return function(_0x4d3220,_0x48219e,_0x2494fc){FaxMessageEvents[_0x5950('0x6')](_0x1344e4+':'+_0x4d3220['id'],_0x4d3220);FaxMessageEvents[_0x5950('0x6')](_0x1344e4,_0x4d3220);_0x2494fc(null);};}for(var e in events){if(events[_0x5950('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xcf71=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x350131,_0x397f44){var _0xd280a5=function(_0x68e8ed){while(--_0x68e8ed){_0x350131['push'](_0x350131['shift']());}};_0xd280a5(++_0x397f44);}(_0xcf71,0xba));var _0x1cf7=function(_0x3b0b34,_0xe6a14f){_0x3b0b34=_0x3b0b34-0x0;var _0x5f5496=_0xcf71[_0x3b0b34];return _0x5f5496;};'use strict';var EventEmitter=require(_0x1cf7('0x0'));var FaxMessage=require(_0x1cf7('0x1'))['db'][_0x1cf7('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1cf7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1cf7('0x4'),'afterDestroy':_0x1cf7('0x5')};function emitEvent(_0xcc31bf){return function(_0x21307d,_0x11e462,_0x14d074){FaxMessageEvents[_0x1cf7('0x6')](_0xcc31bf+':'+_0x21307d['id'],_0x21307d);FaxMessageEvents[_0x1cf7('0x6')](_0xcc31bf,_0x21307d);_0x14d074(null);};}for(var e in events){if(events[_0x1cf7('0x7')](e)){var event=events[e];FaxMessage[_0x1cf7('0x8')](e,emitEvent(event));}}module[_0x1cf7('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 993d45b..9900268 100644 --- a/server/api/faxMessage/faxMessage.model.js +++ b/server/api/faxMessage/faxMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4eb4=['../../config/logger','api','moment','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eb4,0x185));var _0x44eb=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x4eb4[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0x44eb('0x0'));var util=require('util');var logger=require(_0x44eb('0x1'))(_0x44eb('0x2'));var moment=require(_0x44eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44eb('0x4'));var rimraf=require('rimraf');var config=require(_0x44eb('0x5'));var attributes=require(_0x44eb('0x6'));module['exports']=function(_0x1e2eed,_0x445736){return _0x1e2eed[_0x44eb('0x7')](_0x44eb('0x8'),attributes,{'tableName':_0x44eb('0x9'),'paranoid':![],'indexes':[{'name':_0x44eb('0xa'),'fields':[_0x44eb('0xb')],'type':_0x44eb('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c77bd,_0x14d40f,_0x15acdc){var _0x3a41fd=_0x1e2eed[_0x44eb('0xd')];var _0xc8eb7=_0x5c77bd[_0x44eb('0xe')]({'plain':!![]});if(_0xc8eb7[_0x44eb('0xf')][_0x44eb('0x10')]()==='in'||_0xc8eb7[_0x44eb('0xf')][_0x44eb('0x10')]()==='out'&&!_0xc8eb7['secret']&&!_['isNil'](_0xc8eb7[_0x44eb('0x11')])){_0x3a41fd['FaxInteraction']['findOne']({'where':{'id':_0xc8eb7[_0x44eb('0x12')]}})[_0x44eb('0x13')](function(_0x5dcee3){if(_0x5dcee3){_0x5dcee3[_0x44eb('0x14')]({'lastMsgAt':_0xc8eb7[_0x44eb('0x15')],'lastMsgDirection':_0xc8eb7[_0x44eb('0xf')][_0x44eb('0x10')]()});}})[_0x44eb('0x16')](function(_0x202a6a){console[_0x44eb('0x17')](_0x202a6a);});}_0x15acdc();}},'charset':_0x44eb('0x18'),'collate':_0x44eb('0x19')});}; \ No newline at end of file +var _0x4dd2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x4dd2,0x93));var _0x24dd=function(_0x366e51,_0x3a0178){_0x366e51=_0x366e51-0x0;var _0x4e23e3=_0x4dd2[_0x366e51];return _0x4e23e3;};'use strict';var _=require(_0x24dd('0x0'));var util=require(_0x24dd('0x1'));var logger=require(_0x24dd('0x2'))('api');var moment=require(_0x24dd('0x3'));var BPromise=require(_0x24dd('0x4'));var rp=require(_0x24dd('0x5'));var fs=require('fs');var path=require(_0x24dd('0x6'));var rimraf=require(_0x24dd('0x7'));var config=require(_0x24dd('0x8'));var attributes=require('./faxMessage.attributes');module[_0x24dd('0x9')]=function(_0x571235,_0x4b1769){return _0x571235['define'](_0x24dd('0xa'),attributes,{'tableName':_0x24dd('0xb'),'paranoid':![],'indexes':[{'name':_0x24dd('0xc'),'fields':['body'],'type':_0x24dd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42b7a7,_0x3bee64,_0x219da6){var _0x51d92c=_0x571235[_0x24dd('0xe')];var _0x3d6012=_0x42b7a7[_0x24dd('0xf')]({'plain':!![]});if(_0x3d6012[_0x24dd('0x10')][_0x24dd('0x11')]()==='in'||_0x3d6012[_0x24dd('0x10')]['toLowerCase']()===_0x24dd('0x12')&&!_0x3d6012['secret']&&!_[_0x24dd('0x13')](_0x3d6012[_0x24dd('0x14')])){_0x51d92c[_0x24dd('0x15')][_0x24dd('0x16')]({'where':{'id':_0x3d6012[_0x24dd('0x17')]}})[_0x24dd('0x18')](function(_0xbfbf70){if(_0xbfbf70){_0xbfbf70['update']({'lastMsgAt':_0x3d6012[_0x24dd('0x19')],'lastMsgDirection':_0x3d6012[_0x24dd('0x10')][_0x24dd('0x11')]()});}})[_0x24dd('0x1a')](function(_0x1befe7){console[_0x24dd('0x1b')](_0x1befe7);});}_0x219da6();}},'charset':_0x24dd('0x1c'),'collate':_0x24dd('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index c965d69..79c74ec 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','request','then','info','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x20f116,_0x2395ae){var _0x44a8a5=function(_0x445337){while(--_0x445337){_0x20f116['push'](_0x20f116['shift']());}};_0x44a8a5(++_0x2395ae);}(_0x54ef,0x112));var _0xf54e=function(_0xdd52b5,_0x413c3a){_0xdd52b5=_0xdd52b5-0x0;var _0x63f245=_0x54ef[_0xdd52b5];return _0x63f245;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('FaxMessage,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});}exports['CreateFaxMessage']=function(_0x48a7e1){var _0x23e14=this;return new Promise(function(_0x59f338,_0x3e1556){return db[_0xf54e('0x19')][_0xf54e('0x1a')](_0x48a7e1[_0xf54e('0x1b')],{'raw':_0x48a7e1[_0xf54e('0x1c')]?_0x48a7e1[_0xf54e('0x1c')][_0xf54e('0x1d')]===undefined?!![]:![]:!![]})[_0xf54e('0x10')](function(_0x3c0169){logger[_0xf54e('0x11')](_0xf54e('0x1e'),_0x48a7e1);logger['debug'](_0xf54e('0x1e'),_0x48a7e1,JSON['stringify'](_0x3c0169));_0x59f338(_0x3c0169);})[_0xf54e('0x18')](function(_0x272df6){logger[_0xf54e('0x14')](_0xf54e('0x1e'),_0x272df6[_0xf54e('0x16')],_0x48a7e1);_0x3e1556(_0x23e14[_0xf54e('0x14')](0x1f4,_0x272df6[_0xf54e('0x16')]));});});};exports[_0xf54e('0x1f')]=function(_0x2342a9){var _0x33457f=this;return new Promise(function(_0xf6cdd7,_0x39c0ae){return db[_0xf54e('0x19')]['update'](_0x2342a9[_0xf54e('0x1b')],{'raw':_0x2342a9['options']?_0x2342a9[_0xf54e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x20')]||null:null,'attributes':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x21')]||null:null,'limit':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9['options']['limit']||null:null})[_0xf54e('0x10')](function(_0x258d29){logger[_0xf54e('0x11')](_0xf54e('0x1f'),_0x2342a9);logger[_0xf54e('0x22')](_0xf54e('0x1f'),_0x2342a9,JSON[_0xf54e('0x13')](_0x258d29));_0xf6cdd7(_0x258d29);})[_0xf54e('0x18')](function(_0x3ae704){logger[_0xf54e('0x14')]('UpdateFaxMessage',_0x3ae704['message'],_0x2342a9);_0x39c0ae(_0x33457f[_0xf54e('0x14')](0x1f4,_0x3ae704[_0xf54e('0x16')]));});});}; \ No newline at end of file +var _0x84ab=['code','message','result','catch','FaxMessage','create','body','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x11f345,_0x3d1ac3){var _0x5d66c9=function(_0x8ac91a){while(--_0x8ac91a){_0x11f345['push'](_0x11f345['shift']());}};_0x5d66c9(++_0x3d1ac3);}(_0x84ab,0x12f));var _0xb84a=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x84ab[_0x557fd2];return _0x1b54a2;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb84a('0xa')](config['redis'],{'host':_0xb84a('0xb'),'port':0x18eb});var socket=require(_0xb84a('0xc'))(new Redis(config['redis']));require(_0xb84a('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e6a71,_0x1886e0,_0x42daf5){return new BPromise(function(_0x5d3b29,_0x5a34f7){return client['request'](_0x2e6a71,_0x42daf5)[_0xb84a('0xe')](function(_0x17379b){logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));logger['debug'](_0xb84a('0x12'),_0x1886e0,_0xb84a('0x11'),JSON[_0xb84a('0x13')](_0x17379b));if(_0x17379b[_0xb84a('0x14')]){if(_0x17379b[_0xb84a('0x14')][_0xb84a('0x15')]===0x1f4){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5a34f7(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}logger['error'](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5d3b29(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}else{logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));_0x5d3b29(_0x17379b[_0xb84a('0x17')][_0xb84a('0x16')]);}})[_0xb84a('0x18')](function(_0x2de49c){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x2de49c);_0x5a34f7(_0x2de49c);});});}exports['CreateFaxMessage']=function(_0x1a0056){var _0x319216=this;return new Promise(function(_0x55a633,_0xac76d3){return db[_0xb84a('0x19')][_0xb84a('0x1a')](_0x1a0056[_0xb84a('0x1b')],{'raw':_0x1a0056['options']?_0x1a0056['options'][_0xb84a('0x1c')]===undefined?!![]:![]:!![]})[_0xb84a('0xe')](function(_0x2d70fd){logger[_0xb84a('0xf')](_0xb84a('0x1d'),_0x1a0056);logger[_0xb84a('0x1e')](_0xb84a('0x1d'),_0x1a0056,JSON[_0xb84a('0x13')](_0x2d70fd));_0x55a633(_0x2d70fd);})[_0xb84a('0x18')](function(_0x26fe42){logger[_0xb84a('0x14')](_0xb84a('0x1d'),_0x26fe42[_0xb84a('0x16')],_0x1a0056);_0xac76d3(_0x319216[_0xb84a('0x14')](0x1f4,_0x26fe42[_0xb84a('0x16')]));});});};exports[_0xb84a('0x1f')]=function(_0x378ce1){var _0x3ff0bc=this;return new Promise(function(_0x3b6805,_0xd468c3){return db[_0xb84a('0x19')][_0xb84a('0x20')](_0x378ce1[_0xb84a('0x1b')],{'raw':_0x378ce1[_0xb84a('0x21')]?_0x378ce1[_0xb84a('0x21')][_0xb84a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378ce1['options']?_0x378ce1['options'][_0xb84a('0x22')]||null:null,'attributes':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options'][_0xb84a('0x23')]||null:null,'limit':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options']['limit']||null:null})[_0xb84a('0xe')](function(_0x8e9319){logger['info'](_0xb84a('0x1f'),_0x378ce1);logger[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x378ce1,JSON[_0xb84a('0x13')](_0x8e9319));_0x3b6805(_0x8e9319);})[_0xb84a('0x18')](function(_0x144c25){logger[_0xb84a('0x14')](_0xb84a('0x1f'),_0x144c25['message'],_0x378ce1);_0xd468c3(_0x3ff0bc[_0xb84a('0x14')](0x1f4,_0x144c25['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index df400ac..592e0f8 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd77b=['faxMessage:','./faxMessage.events','remove','update','emit','removeListener','length'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xd77b,0x86));var _0xbd77=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xd77b[_0x255d5b];return _0x3e141a;};'use strict';var FaxMessageEvents=require(_0xbd77('0x0'));var events=['save',_0xbd77('0x1'),_0xbd77('0x2')];function createListener(_0x10b937,_0x365bc1){return function(_0x7119e7){_0x365bc1[_0xbd77('0x3')](_0x10b937,_0x7119e7);};}function removeListener(_0x27c213,_0x140679){return function(){FaxMessageEvents[_0xbd77('0x4')](_0x27c213,_0x140679);};}exports['register']=function(_0x14542a){for(var _0x3de620=0x0,_0x2fd840=events[_0xbd77('0x5')];_0x3de620<_0x2fd840;_0x3de620++){var _0x5789f3=events[_0x3de620];var _0x41a0e8=createListener(_0xbd77('0x6')+_0x5789f3,_0x14542a);FaxMessageEvents['on'](_0x5789f3,_0x41a0e8);}}; \ No newline at end of file +var _0xb9dd=['length','faxMessage:','remove','emit','register'];(function(_0xb1174e,_0x1e68a7){var _0x285bac=function(_0x32c505){while(--_0x32c505){_0xb1174e['push'](_0xb1174e['shift']());}};_0x285bac(++_0x1e68a7);}(_0xb9dd,0xc5));var _0xdb9d=function(_0x209e24,_0x5421eb){_0x209e24=_0x209e24-0x0;var _0x395dd8=_0xb9dd[_0x209e24];return _0x395dd8;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0xdb9d('0x0'),'update'];function createListener(_0x327299,_0x5d1fd4){return function(_0x40ad5e){_0x5d1fd4[_0xdb9d('0x1')](_0x327299,_0x40ad5e);};}function removeListener(_0x3d57cb,_0xfc4e1c){return function(){FaxMessageEvents['removeListener'](_0x3d57cb,_0xfc4e1c);};}exports[_0xdb9d('0x2')]=function(_0x3dd438){for(var _0xaa023f=0x0,_0x5f3300=events[_0xdb9d('0x3')];_0xaa023f<_0x5f3300;_0xaa023f++){var _0x54ae15=events[_0xaa023f];var _0x1180a0=createListener(_0xdb9d('0x4')+_0x54ae15,_0x3dd438);FaxMessageEvents['on'](_0x54ae15,_0x1180a0);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 9d7553e..a88ef67 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7072=['/:id/download','download','post','tracked','fax','faxmessage:create','create','put','accept','/:id/reject','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x24e50e,_0x1513fb){var _0x1cc9e8=function(_0x952286){while(--_0x952286){_0x24e50e['push'](_0x24e50e['shift']());}};_0x1cc9e8(++_0x1513fb);}(_0x7072,0x138));var _0x2707=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x7072[_0x256b72];return _0x2183e3;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');var controller=require(_0x2707('0x6'));router[_0x2707('0x7')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0x7')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0x7')](_0x2707('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2707('0x7')](_0x2707('0xd'),auth[_0x2707('0x8')](),controller[_0x2707('0xe')]);router[_0x2707('0xf')]('/',auth[_0x2707('0x8')](),interaction[_0x2707('0x10')](_0x2707('0x11'),_0x2707('0x12')),controller[_0x2707('0x13')]);router[_0x2707('0x14')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller['update']);router[_0x2707('0x14')]('/:id/accept',auth[_0x2707('0x8')](),controller[_0x2707('0x15')]);router[_0x2707('0x14')](_0x2707('0x16'),auth[_0x2707('0x8')](),controller['reject']);router[_0x2707('0x17')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller['destroy']);module[_0x2707('0x18')]=router; \ No newline at end of file +var _0x750a=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','tracked','faxmessage:create','create','update','/:id/accept','accept','put','/:id/reject','delete','exports','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dbcd3,_0x49fd03){var _0x4ed28f=function(_0x4edd5e){while(--_0x4edd5e){_0x3dbcd3['push'](_0x3dbcd3['shift']());}};_0x4ed28f(++_0x49fd03);}(_0x750a,0x140));var _0xa750=function(_0x56c1f0,_0x3ddeba){_0x56c1f0=_0x56c1f0-0x0;var _0x36c094=_0x750a[_0x56c1f0];return _0x36c094;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['describe']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/download',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa750('0xf')]('fax',_0xa750('0x10')),controller[_0xa750('0x11')]);router['put'](_0xa750('0xc'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router['put'](_0xa750('0x13'),auth[_0xa750('0x9')](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0x16'),auth[_0xa750('0x9')](),controller['reject']);router[_0xa750('0x17')](_0xa750('0xc'),auth[_0xa750('0x9')](),controller['destroy']);module[_0xa750('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 63c1f13..8fc6c87 100644 --- a/server/api/faxQueue/faxQueue.attributes.js +++ b/server/api/faxQueue/faxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x297f=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x5c49b1,_0x55a7c7){var _0x291923=function(_0x508acc){while(--_0x508acc){_0x5c49b1['push'](_0x5c49b1['shift']());}};_0x291923(++_0x55a7c7);}(_0x297f,0x1f0));var _0xf297=function(_0x51104b,_0x2c97f2){_0x51104b=_0x51104b-0x0;var _0x185555=_0x297f[_0x51104b];return _0x185555;};'use strict';var Sequelize=require(_0xf297('0x0'));module[_0xf297('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf297('0x2')]},'timeout':{'type':Sequelize[_0xf297('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf297('0x4')](_0xf297('0x5'),'beepall',_0xf297('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc349=['STRING','INTEGER','ENUM','beepall','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc349,0x14e));var _0x9c34=function(_0x1c4f40,_0xad6707){_0x1c4f40=_0x1c4f40-0x0;var _0x502f6f=_0xc349[_0x1c4f40];return _0x502f6f;};'use strict';var Sequelize=require('sequelize');module[_0x9c34('0x0')]={'name':{'type':Sequelize[_0x9c34('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9c34('0x1')]},'timeout':{'type':Sequelize[_0x9c34('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9c34('0x3')]('rrmemory',_0x9c34('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9c34('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 9e15a73..b3178d8 100644 --- a/server/api/faxQueue/faxQueue.controller.js +++ b/server/api/faxQueue/faxQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b1b=['removeAgents','forEach','emit','userFaxQueue:remove','omit','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','update','then','destroy','get','FaxQueues','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','FaxQueue','include','query','findAll','rows','catch','params','model','keys','intersection','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','hasOwnProperty','nolimit','sort','filters','pick','filter','UserFaxQueue','User','UserId','agent','updatedAt','format','%s/%s','SIP','faxPause','getTeams','Team','order','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','sequelize','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty'];(function(_0x1abdcb,_0x2d2854){var _0x1362f7=function(_0x2ce2b1){while(--_0x2ce2b1){_0x1abdcb['push'](_0x1abdcb['shift']());}};_0x1362f7(++_0x2d2854);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x6b1b[_0x4e1d03];return _0x362d4b;};'use strict';var BPromise=require('bluebird');var util=require(_0xb6b1('0x0'));var _=require(_0xb6b1('0x1'));var squel=require(_0xb6b1('0x2'));var Redis=require('ioredis');var qs=require(_0xb6b1('0x3'));var logger=require(_0xb6b1('0x4'))(_0xb6b1('0x5'));var config=require(_0xb6b1('0x6'));var db=require(_0xb6b1('0x7'))['db'];config[_0xb6b1('0x8')]=_[_0xb6b1('0x9')](config[_0xb6b1('0x8')],{'host':_0xb6b1('0xa'),'port':0x18eb});var socket=require(_0xb6b1('0xb'))(new Redis(config[_0xb6b1('0x8')]));require('./faxQueue.socket')[_0xb6b1('0xc')](socket);function respondWithStatusCode(_0x52aa76,_0x4da7d3){_0x4da7d3=_0x4da7d3||0xcc;return function(_0x463b1d){if(_0x463b1d){return _0x52aa76['sendStatus'](_0x4da7d3);}return _0x52aa76[_0xb6b1('0xd')](_0x4da7d3)['end']();};}function respondWithResult(_0x4aa838,_0x49e83a){_0x49e83a=_0x49e83a||0xc8;return function(_0x593218){if(_0x593218){return _0x4aa838[_0xb6b1('0xd')](_0x49e83a)[_0xb6b1('0xe')](_0x593218);}};}function respondWithFilteredResult(_0x5d806b,_0x203121){return function(_0x59831e){if(_0x59831e){var _0x5c5837=typeof _0x203121[_0xb6b1('0xf')]===_0xb6b1('0x10')&&typeof _0x203121[_0xb6b1('0x11')]===_0xb6b1('0x10');var _0x23881d=_0x59831e[_0xb6b1('0x12')];var _0x360fc7=_0x5c5837?0x0:_0x203121[_0xb6b1('0xf')];var _0x2a4d72=_0x5c5837?_0x59831e[_0xb6b1('0x12')]:_0x203121[_0xb6b1('0xf')]+_0x203121[_0xb6b1('0x11')];var _0x4f770a;if(_0x2a4d72>=_0x23881d){_0x2a4d72=_0x23881d;_0x4f770a=0xc8;}else{_0x4f770a=0xce;}_0x5d806b['status'](_0x4f770a);return _0x5d806b['set']('Content-Range',_0x360fc7+'-'+_0x2a4d72+'/'+_0x23881d)[_0xb6b1('0xe')](_0x59831e);}return null;};}function saveUpdates(_0x12c595){return function(_0x4981fb){if(_0x4981fb){return _0x4981fb[_0xb6b1('0x13')](_0x12c595)[_0xb6b1('0x14')](function(_0x51fb33){return _0x51fb33;});}return null;};}function removeEntity(_0x47a204){return function(_0x581e28){if(_0x581e28){return _0x581e28[_0xb6b1('0x15')]()[_0xb6b1('0x14')](function(){var _0x16d969=_0x581e28[_0xb6b1('0x16')]({'plain':!![]});var _0x45d9e6=_0xb6b1('0x17');return db['UserProfileResource']['destroy']({'where':{'type':_0x45d9e6,'resourceId':_0x16d969['id']}})[_0xb6b1('0x14')](function(){return _0x581e28;});})[_0xb6b1('0x14')](function(){_0x47a204['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc247a){return function(_0x5c8529){if(!_0x5c8529){_0xfc247a['sendStatus'](0x194);}return _0x5c8529;};}function handleError(_0x232157,_0x2086ea){_0x2086ea=_0x2086ea||0x1f4;return function(_0x36ac63){logger[_0xb6b1('0x18')](_0x36ac63[_0xb6b1('0x19')]);if(_0x36ac63[_0xb6b1('0x1a')]){delete _0x36ac63[_0xb6b1('0x1a')];}_0x232157[_0xb6b1('0xd')](_0x2086ea)[_0xb6b1('0x1b')](_0x36ac63);};}exports[_0xb6b1('0x1c')]=function(_0x5069cd,_0x214cd0){var _0x4f1e2e={};var _0xd8e094={'count':0x0,'rows':[]};var _0x5864d6=_[_0xb6b1('0x1d')](db['FaxQueue'][_0xb6b1('0x1e')],function(_0x387603){return{'name':_0x387603[_0xb6b1('0x1f')],'type':_0x387603[_0xb6b1('0x20')][_0xb6b1('0x21')]};});_0x4f1e2e=qs[_0xb6b1('0x22')](_0x5864d6,_0x5069cd);var _0x3e0915={'where':_0x4f1e2e[_0xb6b1('0x23')]};return db[_0xb6b1('0x24')]['count'](_0x3e0915)[_0xb6b1('0x14')](function(_0x548f3f){_0xd8e094[_0xb6b1('0x12')]=_0x548f3f;_0x4f1e2e[_0xb6b1('0x25')]=qs[_0xb6b1('0x25')](_0x5069cd[_0xb6b1('0x26')]);return db[_0xb6b1('0x24')][_0xb6b1('0x27')](_0x4f1e2e);})[_0xb6b1('0x14')](function(_0x59094f){_0xd8e094[_0xb6b1('0x28')]=_0x59094f;return _0xd8e094;})[_0xb6b1('0x14')](respondWithFilteredResult(_0x214cd0,_0x4f1e2e))[_0xb6b1('0x29')](handleError(_0x214cd0,null));};exports['show']=function(_0x22beb9,_0x9045f7){var _0x5ed56c={'raw':!![],'where':{'id':_0x22beb9[_0xb6b1('0x2a')]['id']}},_0x3efb1d={};_0x3efb1d[_0xb6b1('0x2b')]=_[_0xb6b1('0x2c')](db[_0xb6b1('0x24')][_0xb6b1('0x1e')]);_0x3efb1d['query']=_[_0xb6b1('0x2c')](_0x22beb9[_0xb6b1('0x26')]);_0x3efb1d['filters']=_[_0xb6b1('0x2d')](_0x3efb1d['model'],_0x3efb1d[_0xb6b1('0x26')]);_0x5ed56c[_0xb6b1('0x2e')]=_[_0xb6b1('0x2d')](_0x3efb1d[_0xb6b1('0x2b')],qs[_0xb6b1('0x2f')](_0x22beb9[_0xb6b1('0x26')]['fields']));_0x5ed56c[_0xb6b1('0x2e')]=_0x5ed56c[_0xb6b1('0x2e')][_0xb6b1('0x30')]?_0x5ed56c[_0xb6b1('0x2e')]:_0x3efb1d['model'];if(_0x22beb9['query']['includeAll']){_0x5ed56c[_0xb6b1('0x25')]=[{'all':!![]}];}_0x5ed56c=_[_0xb6b1('0x31')]({},_0x5ed56c,_0x22beb9[_0xb6b1('0x32')]);return db[_0xb6b1('0x24')][_0xb6b1('0x33')](_0x5ed56c)[_0xb6b1('0x14')](handleEntityNotFound(_0x9045f7,null))[_0xb6b1('0x14')](respondWithResult(_0x9045f7,null))[_0xb6b1('0x29')](handleError(_0x9045f7,null));};exports[_0xb6b1('0x34')]=function(_0x25d6a2,_0x9abbe1){return db[_0xb6b1('0x24')]['create'](_0x25d6a2[_0xb6b1('0x35')],{})[_0xb6b1('0x14')](function(_0x2f0427){var _0x453484=_0x25d6a2[_0xb6b1('0x36')][_0xb6b1('0x16')]({'plain':!![]});if(!_0x453484)throw new Error(_0xb6b1('0x37'));if(_0x453484[_0xb6b1('0x38')]===_0xb6b1('0x36')){var _0x276801=_0x2f0427[_0xb6b1('0x16')]({'plain':!![]});var _0x56470a=_0xb6b1('0x17');return db[_0xb6b1('0x39')][_0xb6b1('0x33')]({'where':{'name':_0x56470a,'userProfileId':_0x453484[_0xb6b1('0x3a')]},'raw':!![]})[_0xb6b1('0x14')](function(_0x2c583f){if(_0x2c583f&&_0x2c583f[_0xb6b1('0x3b')]===0x0){return db[_0xb6b1('0x3c')]['create']({'name':_0x276801['name'],'resourceId':_0x276801['id'],'type':_0x2c583f[_0xb6b1('0x1a')],'sectionId':_0x2c583f['id']},{})[_0xb6b1('0x14')](function(){return _0x2f0427;});}else{return _0x2f0427;}})[_0xb6b1('0x29')](function(_0x541eb5){logger[_0xb6b1('0x18')](_0xb6b1('0x3d'),_0x541eb5);throw _0x541eb5;});}return _0x2f0427;})[_0xb6b1('0x14')](respondWithResult(_0x9abbe1,0xc9))[_0xb6b1('0x29')](handleError(_0x9abbe1,null));};exports[_0xb6b1('0x13')]=function(_0x3c2780,_0xa03b13){if(_0x3c2780[_0xb6b1('0x35')]['id']){delete _0x3c2780['body']['id'];}return db[_0xb6b1('0x24')]['find']({'where':{'id':_0x3c2780[_0xb6b1('0x2a')]['id']}})[_0xb6b1('0x14')](handleEntityNotFound(_0xa03b13,null))[_0xb6b1('0x14')](saveUpdates(_0x3c2780[_0xb6b1('0x35')],null))[_0xb6b1('0x14')](respondWithResult(_0xa03b13,null))[_0xb6b1('0x29')](handleError(_0xa03b13,null));};exports['destroy']=function(_0x1d1c92,_0x2c49bb){return db['FaxQueue'][_0xb6b1('0x33')]({'where':{'id':_0x1d1c92['params']['id']}})[_0xb6b1('0x14')](handleEntityNotFound(_0x2c49bb,null))[_0xb6b1('0x14')](removeEntity(_0x2c49bb,null))[_0xb6b1('0x29')](handleError(_0x2c49bb,null));};exports[_0xb6b1('0x3e')]=function(_0x2016a1,_0x20489a){return db[_0xb6b1('0x24')][_0xb6b1('0x3e')]()[_0xb6b1('0x14')](respondWithResult(_0x20489a,null))['catch'](handleError(_0x20489a,null));};exports['getMembers']=function(_0x3826bd,_0x2c00fb){var _0x5959ca={'raw':!![],'where':{}},_0x29cf46={},_0x185de9;return db[_0xb6b1('0x24')][_0xb6b1('0x3f')]({'where':{'id':_0x3826bd[_0xb6b1('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2c00fb,null))[_0xb6b1('0x14')](function(_0x1f4881){if(_0x1f4881){_0x185de9=_0x1f4881[_0xb6b1('0x16')]({'plain':!![]});_0x29cf46[_0xb6b1('0x2b')]=_['keys'](db['UserFaxQueue'][_0xb6b1('0x1e')]);_0x29cf46['query']=_[_0xb6b1('0x2c')](_0x3826bd[_0xb6b1('0x26')]);_0x29cf46['filters']=_[_0xb6b1('0x2d')](_0x29cf46['model'],_0x29cf46[_0xb6b1('0x26')]);_0x5959ca[_0xb6b1('0x2e')]=_[_0xb6b1('0x2d')](_0x29cf46[_0xb6b1('0x2b')],qs[_0xb6b1('0x2f')](_0x3826bd[_0xb6b1('0x26')][_0xb6b1('0x2f')]));_0x5959ca[_0xb6b1('0x2e')]=_0x5959ca[_0xb6b1('0x2e')][_0xb6b1('0x30')]?_0x5959ca['attributes']:_0x29cf46[_0xb6b1('0x2b')];if(!_0x3826bd[_0xb6b1('0x26')][_0xb6b1('0x40')](_0xb6b1('0x41'))){_0x5959ca[_0xb6b1('0x11')]=qs[_0xb6b1('0x11')](_0x3826bd[_0xb6b1('0x26')][_0xb6b1('0x11')]);_0x5959ca[_0xb6b1('0xf')]=qs['offset'](_0x3826bd[_0xb6b1('0x26')]['offset']);}_0x5959ca['order']=qs[_0xb6b1('0x42')](_0x3826bd[_0xb6b1('0x26')]['sort']);_0x5959ca[_0xb6b1('0x23')]=qs[_0xb6b1('0x43')](_[_0xb6b1('0x44')](_0x3826bd['query'],_0x29cf46[_0xb6b1('0x43')]));_0x5959ca['where']['FaxQueueId']=_0x1f4881['id'];if(_0x3826bd[_0xb6b1('0x26')][_0xb6b1('0x45')]){_0x5959ca['where']=_['merge'](_0x5959ca['where'],{'$or':_[_0xb6b1('0x1d')](_0x5959ca['attributes'],function(_0x54c88f){var _0x47e64e={};_0x47e64e[_0x54c88f]={'$like':'%'+_0x3826bd[_0xb6b1('0x26')][_0xb6b1('0x45')]+'%'};return _0x47e64e;})});}_0x5959ca=_[_0xb6b1('0x31')]({},_0x5959ca,_0x3826bd[_0xb6b1('0x32')]);return db[_0xb6b1('0x46')][_0xb6b1('0x27')](_0x5959ca);}})['then'](function(_0x4775e6){if(_0x4775e6){return db[_0xb6b1('0x47')]['findAndCountAll']({'where':{'id':_['map'](_0x4775e6,_0xb6b1('0x48')),'role':_0xb6b1('0x49')},'attributes':['id','name','faxPause',_0xb6b1('0x4a'),'createdAt']});}})[_0xb6b1('0x14')](function(_0x1ce8a2){if(_0x1ce8a2){return{'count':_0x1ce8a2['count'],'rows':_[_0xb6b1('0x1d')](_0x1ce8a2[_0xb6b1('0x28')],function(_0xd36a24){return{'membername':_0xd36a24[_0xb6b1('0x1a')],'UserId':_0xd36a24['id'],'queue_name':_0x185de9[_0xb6b1('0x1a')],'FaxQueueId':_0x185de9['id'],'interface':util[_0xb6b1('0x4b')](_0xb6b1('0x4c'),_0xb6b1('0x4d'),_0xd36a24[_0xb6b1('0x1a')]),'penalty':0x0,'paused':_0xd36a24[_0xb6b1('0x4e')],'createdAt':_0xd36a24['createdAt'],'updatedAt':_0xd36a24[_0xb6b1('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb6b1('0x14')](respondWithFilteredResult(_0x2c00fb,_0x5959ca))[_0xb6b1('0x29')](handleError(_0x2c00fb,null));};exports[_0xb6b1('0x4f')]=function(_0x4a7796,_0x431dd9){var _0xce50c3={};var _0x2da39e={};var _0xa150da;var _0x22c5f2;return db[_0xb6b1('0x24')][_0xb6b1('0x3f')]({'where':{'id':_0x4a7796['params']['id']}})['then'](handleEntityNotFound(_0x431dd9,null))[_0xb6b1('0x14')](function(_0x51c2ed){if(_0x51c2ed){_0xa150da=_0x51c2ed;_0x2da39e[_0xb6b1('0x2b')]=_[_0xb6b1('0x2c')](db[_0xb6b1('0x50')]['rawAttributes']);_0x2da39e[_0xb6b1('0x26')]=_[_0xb6b1('0x2c')](_0x4a7796[_0xb6b1('0x26')]);_0x2da39e[_0xb6b1('0x43')]=_[_0xb6b1('0x2d')](_0x2da39e['model'],_0x2da39e['query']);_0xce50c3[_0xb6b1('0x2e')]=_[_0xb6b1('0x2d')](_0x2da39e[_0xb6b1('0x2b')],qs[_0xb6b1('0x2f')](_0x4a7796[_0xb6b1('0x26')][_0xb6b1('0x2f')]));_0xce50c3[_0xb6b1('0x2e')]=_0xce50c3[_0xb6b1('0x2e')][_0xb6b1('0x30')]?_0xce50c3[_0xb6b1('0x2e')]:_0x2da39e[_0xb6b1('0x2b')];_0xce50c3[_0xb6b1('0x51')]=qs['sort'](_0x4a7796[_0xb6b1('0x26')]['sort']);_0xce50c3[_0xb6b1('0x23')]=qs[_0xb6b1('0x43')](_[_0xb6b1('0x44')](_0x4a7796['query'],_0x2da39e[_0xb6b1('0x43')]));if(_0x4a7796['query']['filter']){_0xce50c3[_0xb6b1('0x23')]=_['merge'](_0xce50c3[_0xb6b1('0x23')],{'$or':_[_0xb6b1('0x1d')](_0xce50c3['attributes'],function(_0x2780b0){var _0x58fddf={};_0x58fddf[_0x2780b0]={'$like':'%'+_0x4a7796[_0xb6b1('0x26')][_0xb6b1('0x45')]+'%'};return _0x58fddf;})});}_0xce50c3=_[_0xb6b1('0x31')]({},_0xce50c3,_0x4a7796['options']);return _0xa150da[_0xb6b1('0x4f')](_0xce50c3);}})['then'](function(_0x20f2f2){if(_0x20f2f2){_0x22c5f2=_0x20f2f2[_0xb6b1('0x30')];if(!_0x4a7796[_0xb6b1('0x26')][_0xb6b1('0x40')]('nolimit')){_0xce50c3[_0xb6b1('0x11')]=qs[_0xb6b1('0x11')](_0x4a7796[_0xb6b1('0x26')][_0xb6b1('0x11')]);_0xce50c3[_0xb6b1('0xf')]=qs[_0xb6b1('0xf')](_0x4a7796['query'][_0xb6b1('0xf')]);}return _0xa150da[_0xb6b1('0x4f')](_0xce50c3);}})[_0xb6b1('0x14')](function(_0x42d3c7){if(_0x42d3c7){return _0x42d3c7?{'count':_0x22c5f2,'rows':_0x42d3c7}:null;}})['then'](respondWithResult(_0x431dd9,null))[_0xb6b1('0x29')](handleError(_0x431dd9,null));};exports[_0xb6b1('0x52')]=function(_0x4a032e,_0x5497d2){var _0x579dde=_0x4a032e['body'][_0xb6b1('0x53')];return db[_0xb6b1('0x50')][_0xb6b1('0x27')]({'where':{'id':_0x579dde},'attributes':['id'],'include':[{'model':db[_0xb6b1('0x47')],'as':_0xb6b1('0x54'),'attributes':['id',_0xb6b1('0x1a'),_0xb6b1('0x55'),'voicePause',_0xb6b1('0x56')],'raw':!![]}]})['then'](function(_0x49be58){if(_0x49be58){var _0x15a64f=_[_0xb6b1('0x57')](_0x49be58,function(_0x56aaef){var _0x5ca38b=_0x56aaef[_0xb6b1('0x16')]({'plain':!![]});return _0x5ca38b[_0xb6b1('0x54')];});return db[_0xb6b1('0x24')][_0xb6b1('0x33')]({'where':{'id':_0x4a032e['params']['id']}})[_0xb6b1('0x14')](function(_0x3af3e2){return db['sequelize']['transaction'](function(_0x10461d){return _0x3af3e2[_0xb6b1('0x52')](_0x579dde,{'transaction':_0x10461d})[_0xb6b1('0x14')](function(){return BPromise[_0xb6b1('0x58')](_0x15a64f,function(_0x12bcf3){return db[_0xb6b1('0x46')][_0xb6b1('0x59')]({'where':{'UserId':_0x12bcf3['id'],'FaxQueueId':_0x4a032e[_0xb6b1('0x2a')]['id']},'transaction':_0x10461d});});})[_0xb6b1('0x14')](function(){_0x15a64f['forEach'](function(_0x1138f4){socket['emit'](_0xb6b1('0x5a'),{'UserId':_0x1138f4['id'],'FaxQueueId':_0x3af3e2['id']});});});});});}})[_0xb6b1('0x14')](respondWithStatusCode(_0x5497d2,null))[_0xb6b1('0x29')](handleError(_0x5497d2,null));};exports['removeTeams']=function(_0x1bf0e3,_0x457eb7){return db['Team'][_0xb6b1('0x27')]({'where':{'id':_0x1bf0e3[_0xb6b1('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb6b1('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb6b1('0x14')](handleEntityNotFound(_0x457eb7,null))['then'](function(_0x300508){var _0x15ef5e=_[_0xb6b1('0x1d')](_0x300508,'id');var _0xc27ba8=[];var _0x3765ca=[];var _0x58d0fa=squel[_0xb6b1('0x5b')]();_0x58d0fa[_0xb6b1('0x5c')](_0xb6b1('0x5d'))[_0xb6b1('0x5e')](_0xb6b1('0x5f'),'tq')[_0xb6b1('0x60')](_0xb6b1('0x61'),'ut',_0xb6b1('0x62'))[_0xb6b1('0x23')](_0xb6b1('0x63'),_0x1bf0e3[_0xb6b1('0x2a')]['id']);for(var _0x139180=0x0;_0x139180<_0x300508['length'];_0x139180+=0x1){let _0x10481c=_0x300508[_0x139180];for(var _0x385fd7=0x0;_0x385fd7<_0x10481c['Agents'][_0xb6b1('0x30')];_0x385fd7+=0x1){let _0x23298c=_0x10481c['Agents'][_0x385fd7];var _0x3d8119=_0x58d0fa['clone']();_0x3d8119[_0xb6b1('0x23')]('ut.UserId\x20=\x20?',_0x23298c['id']);_0x3765ca[_0xb6b1('0x64')](db['sequelize']['query'](_0x3d8119[_0xb6b1('0x65')](),{'type':db[_0xb6b1('0x66')]['QueryTypes'][_0xb6b1('0x67')]})[_0xb6b1('0x14')](function(_0x12ebb3){if(_0x12ebb3[_0xb6b1('0x30')]===0x1){return _0x23298c['id'];}else{var _0x292dbe=_[_0xb6b1('0x68')](_[_0xb6b1('0x1d')](_0x12ebb3,_0xb6b1('0x69')),function(_0x2f653d){return _[_0xb6b1('0x6a')](_0x15ef5e,_0x2f653d);});if(_0x292dbe){return _0x23298c['id'];}}}));}}return BPromise[_0xb6b1('0x6b')](_0x3765ca)[_0xb6b1('0x14')](function(_0x521366){_0xc27ba8=_(_0xc27ba8)[_0xb6b1('0x6c')](_0x521366)[_0xb6b1('0x6d')]()[_0xb6b1('0x6e')]();return db[_0xb6b1('0x24')]['find']({'where':{'id':_0x1bf0e3[_0xb6b1('0x2a')]['id']}})[_0xb6b1('0x14')](function(_0x15818e){return db[_0xb6b1('0x66')][_0xb6b1('0x6f')](function(_0x315f07){return _0x15818e['removeTeams'](_0x1bf0e3[_0xb6b1('0x26')][_0xb6b1('0x53')],{'transaction':_0x315f07})[_0xb6b1('0x14')](function(){if(!_[_0xb6b1('0x70')](_0xc27ba8)){return _0x15818e[_0xb6b1('0x71')](_0xc27ba8,{'transaction':_0x315f07});}})[_0xb6b1('0x14')](function(){_0xc27ba8[_0xb6b1('0x72')](function(_0x433ce8){socket[_0xb6b1('0x73')](_0xb6b1('0x74'),{'UserId':_0x433ce8,'FaxQueueId':_0x15818e['id']});});});});});});})[_0xb6b1('0x14')](respondWithStatusCode(_0x457eb7,null))[_0xb6b1('0x29')](handleError(_0x457eb7,null));};exports['addAgents']=function(_0x2046e5,_0x57feb3){return db[_0xb6b1('0x24')][_0xb6b1('0x33')]({'where':{'id':_0x2046e5[_0xb6b1('0x2a')]['id']}})[_0xb6b1('0x14')](handleEntityNotFound(_0x57feb3,null))[_0xb6b1('0x14')](function(_0x3fbff1){if(_0x3fbff1){return _0x3fbff1['addAgents'](_0x2046e5[_0xb6b1('0x35')][_0xb6b1('0x53')],_[_0xb6b1('0x75')](_0x2046e5['body'],[_0xb6b1('0x53'),'id'])||{})['spread'](function(_0x51a796){for(var _0x13f438=0x0;_0x13f438<_0x2046e5[_0xb6b1('0x35')][_0xb6b1('0x53')][_0xb6b1('0x30')];_0x13f438+=0x1){socket[_0xb6b1('0x73')](_0xb6b1('0x5a'),{'UserId':Number(_0x2046e5['body'][_0xb6b1('0x53')][_0x13f438]),'FaxQueueId':Number(_0x2046e5[_0xb6b1('0x2a')]['id'])});}return _0x51a796;});}})[_0xb6b1('0x14')](respondWithResult(_0x57feb3,null))[_0xb6b1('0x29')](handleError(_0x57feb3,null));};exports['removeAgents']=function(_0x4ea394,_0xdeaa28){return db['FaxQueue'][_0xb6b1('0x33')]({'where':{'id':_0x4ea394['params']['id']}})[_0xb6b1('0x14')](handleEntityNotFound(_0xdeaa28,null))['then'](function(_0x58b209){if(_0x58b209){return _0x58b209[_0xb6b1('0x71')](_0x4ea394[_0xb6b1('0x26')][_0xb6b1('0x53')])[_0xb6b1('0x14')](function(){if(_[_0xb6b1('0x76')](_0x4ea394['query'][_0xb6b1('0x53')])){for(var _0x170d5c=0x0;_0x170d5c<_0x4ea394[_0xb6b1('0x26')][_0xb6b1('0x53')]['length'];_0x170d5c+=0x1){socket[_0xb6b1('0x73')]('userFaxQueue:remove',{'UserId':Number(_0x4ea394[_0xb6b1('0x26')]['ids'][_0x170d5c]),'FaxQueueId':Number(_0x4ea394[_0xb6b1('0x2a')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x4ea394['query']['ids']),'FaxQueueId':Number(_0x4ea394[_0xb6b1('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0xdeaa28,null))[_0xb6b1('0x29')](handleError(_0xdeaa28,null));};exports[_0xb6b1('0x77')]=function(_0x15ca42,_0x371cb6){var _0x5d1c1d={};var _0x206833={};var _0x275b4b;var _0x4ce967;return db['FaxQueue']['findOne']({'where':{'id':_0x15ca42[_0xb6b1('0x2a')]['id']}})['then'](handleEntityNotFound(_0x371cb6,null))[_0xb6b1('0x14')](function(_0x490f9f){if(_0x490f9f){_0x275b4b=_0x490f9f;_0x206833[_0xb6b1('0x2b')]=_['keys'](db[_0xb6b1('0x47')]['rawAttributes']);_0x206833['query']=_[_0xb6b1('0x2c')](_0x15ca42[_0xb6b1('0x26')]);_0x206833[_0xb6b1('0x43')]=_[_0xb6b1('0x2d')](_0x206833[_0xb6b1('0x2b')],_0x206833[_0xb6b1('0x26')]);_0x5d1c1d['attributes']=_[_0xb6b1('0x2d')](_0x206833[_0xb6b1('0x2b')],qs['fields'](_0x15ca42[_0xb6b1('0x26')][_0xb6b1('0x2f')]));_0x5d1c1d[_0xb6b1('0x2e')]=_0x5d1c1d['attributes'][_0xb6b1('0x30')]?_0x5d1c1d[_0xb6b1('0x2e')]:_0x206833[_0xb6b1('0x2b')];_0x5d1c1d[_0xb6b1('0x51')]=qs[_0xb6b1('0x42')](_0x15ca42[_0xb6b1('0x26')][_0xb6b1('0x42')]);_0x5d1c1d[_0xb6b1('0x23')]=qs[_0xb6b1('0x43')](_[_0xb6b1('0x44')](_0x15ca42[_0xb6b1('0x26')],_0x206833['filters']));if(_0x15ca42['query']['filter']){_0x5d1c1d[_0xb6b1('0x23')]=_['merge'](_0x5d1c1d[_0xb6b1('0x23')],{'$or':_[_0xb6b1('0x1d')](_0x5d1c1d[_0xb6b1('0x2e')],function(_0xa392e9){var _0x5b74d7={};_0x5b74d7[_0xa392e9]={'$like':'%'+_0x15ca42[_0xb6b1('0x26')]['filter']+'%'};return _0x5b74d7;})});}_0x5d1c1d=_['merge']({},_0x5d1c1d,_0x15ca42['options']);return _0x275b4b[_0xb6b1('0x77')](_0x5d1c1d);}})[_0xb6b1('0x14')](function(_0x412619){if(_0x412619){_0x4ce967=_0x412619[_0xb6b1('0x30')];if(!_0x15ca42[_0xb6b1('0x26')][_0xb6b1('0x40')](_0xb6b1('0x41'))){_0x5d1c1d['limit']=qs['limit'](_0x15ca42[_0xb6b1('0x26')]['limit']);_0x5d1c1d[_0xb6b1('0xf')]=qs['offset'](_0x15ca42['query']['offset']);}return _0x275b4b['getAgents'](_0x5d1c1d);}})[_0xb6b1('0x14')](function(_0x269854){if(_0x269854){return _0x269854?{'count':_0x4ce967,'rows':_0x269854}:null;}})[_0xb6b1('0x14')](respondWithResult(_0x371cb6,null))[_0xb6b1('0x29')](handleError(_0x371cb6,null));}; \ No newline at end of file +var _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userFaxQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','index','FaxQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','FaxQueueId','merge','UserFaxQueue','User','findAndCountAll','map','UserId','agent','faxPause','updatedAt','createdAt','format'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xadb5,0xad));var _0x5adb=function(_0x2d9fd0,_0x29140d){_0x2d9fd0=_0x2d9fd0-0x0;var _0x33fcda=_0xadb5[_0x2d9fd0];return _0x33fcda;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserFaxQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'FaxQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['FaxQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['FaxQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'FaxQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'FaxQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'FaxQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'FaxQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['FaxQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'FaxQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'FaxQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 2012872..0aca145 100644 --- a/server/api/faxQueue/faxQueue.events.js +++ b/server/api/faxQueue/faxQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94ff=['emit','hasOwnProperty','events','FaxQueue','setMaxListeners','remove'];(function(_0x1eb05b,_0x190b22){var _0x134f13=function(_0x103c18){while(--_0x103c18){_0x1eb05b['push'](_0x1eb05b['shift']());}};_0x134f13(++_0x190b22);}(_0x94ff,0x9e));var _0xf94f=function(_0x5c873d,_0x29a887){_0x5c873d=_0x5c873d-0x0;var _0xf38a50=_0x94ff[_0x5c873d];return _0xf38a50;};'use strict';var EventEmitter=require(_0xf94f('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xf94f('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf94f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf94f('0x3')};function emitEvent(_0x54d007){return function(_0x32206e,_0x1e4134,_0x1c600e){FaxQueueEvents[_0xf94f('0x4')](_0x54d007+':'+_0x32206e['id'],_0x32206e);FaxQueueEvents[_0xf94f('0x4')](_0x54d007,_0x32206e);_0x1c600e(null);};}for(var e in events){if(events[_0xf94f('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x0405=['save','update','remove','emit','hasOwnProperty','hook','events','FaxQueue','setMaxListeners'];(function(_0x56a28a,_0x2ff4ed){var _0x1293b6=function(_0x3c8f04){while(--_0x3c8f04){_0x56a28a['push'](_0x56a28a['shift']());}};_0x1293b6(++_0x2ff4ed);}(_0x0405,0x7b));var _0x5040=function(_0x2f0024,_0x7a48e0){_0x2f0024=_0x2f0024-0x0;var _0x51f3af=_0x0405[_0x2f0024];return _0x51f3af;};'use strict';var EventEmitter=require(_0x5040('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x5040('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5040('0x2')](0x0);var events={'afterCreate':_0x5040('0x3'),'afterUpdate':_0x5040('0x4'),'afterDestroy':_0x5040('0x5')};function emitEvent(_0x1d7486){return function(_0x5b3f63,_0x3766cb,_0x243b06){FaxQueueEvents[_0x5040('0x6')](_0x1d7486+':'+_0x5b3f63['id'],_0x5b3f63);FaxQueueEvents[_0x5040('0x6')](_0x1d7486,_0x5b3f63);_0x243b06(null);};}for(var e in events){if(events[_0x5040('0x7')](e)){var event=events[e];FaxQueue[_0x5040('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 4186f9f..846b8cf 100644 --- a/server/api/faxQueue/faxQueue.model.js +++ b/server/api/faxQueue/faxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf533=['./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','../../config/logger','moment','path','rimraf'];(function(_0x260c1b,_0x5f4b2c){var _0x213e0a=function(_0x223390){while(--_0x223390){_0x260c1b['push'](_0x260c1b['shift']());}};_0x213e0a(++_0x5f4b2c);}(_0xf533,0x163));var _0x3f53=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0xf533[_0x4fa0ea];return _0x51d027;};'use strict';var _=require(_0x3f53('0x0'));var util=require('util');var logger=require(_0x3f53('0x1'))('api');var moment=require(_0x3f53('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f53('0x3'));var rimraf=require(_0x3f53('0x4'));var config=require('../../config/environment');var attributes=require(_0x3f53('0x5'));module['exports']=function(_0x27f991,_0x43510f){return _0x27f991[_0x3f53('0x6')](_0x3f53('0x7'),attributes,{'tableName':_0x3f53('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb41=['../../config/environment','./faxQueue.attributes','define','fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5f5399,_0x11166d){var _0x319b96=function(_0x1eb219){while(--_0x1eb219){_0x5f5399['push'](_0x5f5399['shift']());}};_0x319b96(++_0x11166d);}(_0xcb41,0xf4));var _0x1cb4=function(_0x452d58,_0x31e478){_0x452d58=_0x452d58-0x0;var _0x451825=_0xcb41[_0x452d58];return _0x451825;};'use strict';var _=require(_0x1cb4('0x0'));var util=require(_0x1cb4('0x1'));var logger=require(_0x1cb4('0x2'))(_0x1cb4('0x3'));var moment=require(_0x1cb4('0x4'));var BPromise=require('bluebird');var rp=require(_0x1cb4('0x5'));var fs=require('fs');var path=require(_0x1cb4('0x6'));var rimraf=require(_0x1cb4('0x7'));var config=require(_0x1cb4('0x8'));var attributes=require(_0x1cb4('0x9'));module['exports']=function(_0xe59fe6,_0x424060){return _0xe59fe6[_0x1cb4('0xa')]('FaxQueue',attributes,{'tableName':_0x1cb4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index c2feecd..2de49d4 100644 --- a/server/api/faxQueue/faxQueue.rpc.js +++ b/server/api/faxQueue/faxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0135=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','options','raw','where','limit','include','map','attributes','model','GetFaxQueue','ShowFaxQueue','FaxQueue','find','lodash','util'];(function(_0x27f269,_0x73067b){var _0x1fb1cc=function(_0x5c15e0){while(--_0x5c15e0){_0x27f269['push'](_0x27f269['shift']());}};_0x1fb1cc(++_0x73067b);}(_0x0135,0xcb));var _0x5013=function(_0x5ce537,_0x51a17d){_0x5ce537=_0x5ce537-0x0;var _0x263a76=_0x0135[_0x5ce537];return _0x263a76;};'use strict';var _=require(_0x5013('0x0'));var util=require(_0x5013('0x1'));var moment=require(_0x5013('0x2'));var BPromise=require(_0x5013('0x3'));var rs=require(_0x5013('0x4'));var fs=require('fs');var Redis=require(_0x5013('0x5'));var db=require(_0x5013('0x6'))['db'];var utils=require(_0x5013('0x7'));var logger=require(_0x5013('0x8'))(_0x5013('0x9'));var config=require(_0x5013('0xa'));var jayson=require(_0x5013('0xb'));var client=jayson['client'][_0x5013('0xc')]({'port':0x232a});config[_0x5013('0xd')]=_[_0x5013('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5013('0xf'))(new Redis(config['redis']));require(_0x5013('0x10'))[_0x5013('0x11')](socket);function respondWithRpcPromise(_0x3bce1e,_0x1ddf90,_0x167415){return new BPromise(function(_0x513dc2,_0x18e5ed){return client[_0x5013('0x12')](_0x3bce1e,_0x167415)[_0x5013('0x13')](function(_0x4ec50b){logger[_0x5013('0x14')](_0x5013('0x15'),_0x1ddf90,_0x5013('0x16'));logger[_0x5013('0x17')](_0x5013('0x18'),_0x1ddf90,_0x5013('0x16'),JSON[_0x5013('0x19')](_0x4ec50b));if(_0x4ec50b[_0x5013('0x1a')]){if(_0x4ec50b[_0x5013('0x1a')]['code']===0x1f4){logger[_0x5013('0x1a')](_0x5013('0x15'),_0x1ddf90,_0x4ec50b['error'][_0x5013('0x1b')]);return _0x18e5ed(_0x4ec50b[_0x5013('0x1a')][_0x5013('0x1b')]);}logger[_0x5013('0x1a')](_0x5013('0x15'),_0x1ddf90,_0x4ec50b[_0x5013('0x1a')][_0x5013('0x1b')]);return _0x513dc2(_0x4ec50b[_0x5013('0x1a')]['message']);}else{logger[_0x5013('0x14')]('FaxQueue,\x20%s,\x20%s',_0x1ddf90,_0x5013('0x16'));_0x513dc2(_0x4ec50b['result'][_0x5013('0x1b')]);}})[_0x5013('0x1c')](function(_0x1d0019){logger[_0x5013('0x1a')](_0x5013('0x15'),_0x1ddf90,_0x1d0019);_0x18e5ed(_0x1d0019);});});}exports['GetFaxQueue']=function(_0x5aff29){var _0x472561=this;return new Promise(function(_0x2e02ff,_0x29d3ba){return db['FaxQueue']['findAll']({'raw':_0x5aff29[_0x5013('0x1d')]?_0x5aff29[_0x5013('0x1d')][_0x5013('0x1e')]===undefined?!![]:![]:!![],'where':_0x5aff29[_0x5013('0x1d')]?_0x5aff29[_0x5013('0x1d')][_0x5013('0x1f')]||null:null,'attributes':_0x5aff29['options']?_0x5aff29[_0x5013('0x1d')]['attributes']||null:null,'limit':_0x5aff29['options']?_0x5aff29[_0x5013('0x1d')][_0x5013('0x20')]||null:null,'include':_0x5aff29[_0x5013('0x1d')]?_0x5aff29[_0x5013('0x1d')][_0x5013('0x21')]?_[_0x5013('0x22')](_0x5aff29[_0x5013('0x1d')][_0x5013('0x21')],function(_0x203360){return{'model':db[_0x203360['model']],'as':_0x203360['as'],'attributes':_0x203360[_0x5013('0x23')],'include':_0x203360['include']?_['map'](_0x203360[_0x5013('0x21')],function(_0x3de948){return{'model':db[_0x3de948[_0x5013('0x24')]],'as':_0x3de948['as'],'attributes':_0x3de948[_0x5013('0x23')],'include':_0x3de948['include']?_[_0x5013('0x22')](_0x3de948[_0x5013('0x21')],function(_0x22559){return{'model':db[_0x22559[_0x5013('0x24')]],'as':_0x22559['as'],'attributes':_0x22559[_0x5013('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5013('0x13')](function(_0x373739){logger[_0x5013('0x14')](_0x5013('0x25'),_0x5aff29);logger[_0x5013('0x17')](_0x5013('0x25'),_0x5aff29,JSON['stringify'](_0x373739));_0x2e02ff(_0x373739);})[_0x5013('0x1c')](function(_0x5e59b6){logger[_0x5013('0x1a')](_0x5013('0x25'),_0x5e59b6['message'],_0x5aff29);_0x29d3ba(_0x472561['error'](0x1f4,_0x5e59b6[_0x5013('0x1b')]));});});};exports[_0x5013('0x26')]=function(_0x5a07b5){var _0x3a5168=this;return new Promise(function(_0x39f46c,_0x26c5a9){return db[_0x5013('0x27')][_0x5013('0x28')]({'raw':_0x5a07b5[_0x5013('0x1d')]?_0x5a07b5['options'][_0x5013('0x1e')]===undefined?!![]:![]:!![],'where':_0x5a07b5[_0x5013('0x1d')]?_0x5a07b5['options']['where']||null:null,'attributes':_0x5a07b5[_0x5013('0x1d')]?_0x5a07b5[_0x5013('0x1d')][_0x5013('0x23')]||null:null,'include':_0x5a07b5[_0x5013('0x1d')]?_0x5a07b5[_0x5013('0x1d')][_0x5013('0x21')]?_[_0x5013('0x22')](_0x5a07b5[_0x5013('0x1d')][_0x5013('0x21')],function(_0x14a8cf){return{'model':db[_0x14a8cf['model']],'as':_0x14a8cf['as'],'attributes':_0x14a8cf['attributes'],'include':_0x14a8cf['include']?_[_0x5013('0x22')](_0x14a8cf[_0x5013('0x21')],function(_0x19e0b2){return{'model':db[_0x19e0b2['model']],'as':_0x19e0b2['as'],'attributes':_0x19e0b2[_0x5013('0x23')],'include':_0x19e0b2['include']?_[_0x5013('0x22')](_0x19e0b2[_0x5013('0x21')],function(_0x1e58b2){return{'model':db[_0x1e58b2['model']],'as':_0x1e58b2['as'],'attributes':_0x1e58b2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59b75){logger[_0x5013('0x14')](_0x5013('0x26'),_0x5a07b5);logger[_0x5013('0x17')]('ShowFaxQueue',_0x5a07b5,JSON['stringify'](_0x59b75));_0x39f46c(_0x59b75);})[_0x5013('0x1c')](function(_0x510dad){logger[_0x5013('0x1a')](_0x5013('0x26'),_0x510dad['message'],_0x5a07b5);_0x26c5a9(_0x3a5168[_0x5013('0x1a')](0x1f4,_0x510dad[_0x5013('0x1b')]));});});}; \ No newline at end of file +var _0xda17=['../../mysqldb','../../config/logger','rpc','client','http','redis','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFaxQueue','options','attributes','limit','include','map','model','ShowFaxQueue','FaxQueue','find','raw','where','util','moment','bluebird','randomstring'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0xda17,0x16e));var _0x7da1=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xda17[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x7da1('0x0'));var moment=require(_0x7da1('0x1'));var BPromise=require(_0x7da1('0x2'));var rs=require(_0x7da1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7da1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7da1('0x5'))(_0x7da1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7da1('0x7')][_0x7da1('0x8')]({'port':0x232a});config[_0x7da1('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7da1('0xa'))(new Redis(config['redis']));require(_0x7da1('0xb'))[_0x7da1('0xc')](socket);function respondWithRpcPromise(_0x3c9649,_0x4c865b,_0x4b9960){return new BPromise(function(_0x9b9aa5,_0x4f63d2){return client[_0x7da1('0xd')](_0x3c9649,_0x4b9960)[_0x7da1('0xe')](function(_0x2c8796){logger['info'](_0x7da1('0xf'),_0x4c865b,_0x7da1('0x10'));logger[_0x7da1('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x4c865b,'request\x20sent',JSON[_0x7da1('0x12')](_0x2c8796));if(_0x2c8796[_0x7da1('0x13')]){if(_0x2c8796[_0x7da1('0x13')][_0x7da1('0x14')]===0x1f4){logger['error'](_0x7da1('0xf'),_0x4c865b,_0x2c8796[_0x7da1('0x13')][_0x7da1('0x15')]);return _0x4f63d2(_0x2c8796['error']['message']);}logger[_0x7da1('0x13')](_0x7da1('0xf'),_0x4c865b,_0x2c8796[_0x7da1('0x13')][_0x7da1('0x15')]);return _0x9b9aa5(_0x2c8796[_0x7da1('0x13')]['message']);}else{logger[_0x7da1('0x16')](_0x7da1('0xf'),_0x4c865b,_0x7da1('0x10'));_0x9b9aa5(_0x2c8796[_0x7da1('0x17')][_0x7da1('0x15')]);}})[_0x7da1('0x18')](function(_0x219282){logger['error'](_0x7da1('0xf'),_0x4c865b,_0x219282);_0x4f63d2(_0x219282);});});}exports[_0x7da1('0x19')]=function(_0x3aaf0c){var _0x50a721=this;return new Promise(function(_0x150345,_0x2e36af){return db['FaxQueue']['findAll']({'raw':_0x3aaf0c[_0x7da1('0x1a')]?_0x3aaf0c[_0x7da1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3aaf0c[_0x7da1('0x1a')]?_0x3aaf0c[_0x7da1('0x1a')]['where']||null:null,'attributes':_0x3aaf0c[_0x7da1('0x1a')]?_0x3aaf0c['options'][_0x7da1('0x1b')]||null:null,'limit':_0x3aaf0c['options']?_0x3aaf0c[_0x7da1('0x1a')][_0x7da1('0x1c')]||null:null,'include':_0x3aaf0c['options']?_0x3aaf0c[_0x7da1('0x1a')][_0x7da1('0x1d')]?_[_0x7da1('0x1e')](_0x3aaf0c['options'][_0x7da1('0x1d')],function(_0x2f97d1){return{'model':db[_0x2f97d1[_0x7da1('0x1f')]],'as':_0x2f97d1['as'],'attributes':_0x2f97d1['attributes'],'include':_0x2f97d1[_0x7da1('0x1d')]?_[_0x7da1('0x1e')](_0x2f97d1[_0x7da1('0x1d')],function(_0x364016){return{'model':db[_0x364016['model']],'as':_0x364016['as'],'attributes':_0x364016[_0x7da1('0x1b')],'include':_0x364016[_0x7da1('0x1d')]?_[_0x7da1('0x1e')](_0x364016[_0x7da1('0x1d')],function(_0x268776){return{'model':db[_0x268776[_0x7da1('0x1f')]],'as':_0x268776['as'],'attributes':_0x268776[_0x7da1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7da1('0xe')](function(_0x33cebc){logger['info']('GetFaxQueue',_0x3aaf0c);logger[_0x7da1('0x11')](_0x7da1('0x19'),_0x3aaf0c,JSON[_0x7da1('0x12')](_0x33cebc));_0x150345(_0x33cebc);})[_0x7da1('0x18')](function(_0x314f55){logger[_0x7da1('0x13')](_0x7da1('0x19'),_0x314f55[_0x7da1('0x15')],_0x3aaf0c);_0x2e36af(_0x50a721[_0x7da1('0x13')](0x1f4,_0x314f55[_0x7da1('0x15')]));});});};exports[_0x7da1('0x20')]=function(_0x49cb4f){var _0x2ac398=this;return new Promise(function(_0x605529,_0x4ed806){return db[_0x7da1('0x21')][_0x7da1('0x22')]({'raw':_0x49cb4f[_0x7da1('0x1a')]?_0x49cb4f[_0x7da1('0x1a')][_0x7da1('0x23')]===undefined?!![]:![]:!![],'where':_0x49cb4f[_0x7da1('0x1a')]?_0x49cb4f['options'][_0x7da1('0x24')]||null:null,'attributes':_0x49cb4f['options']?_0x49cb4f['options']['attributes']||null:null,'include':_0x49cb4f['options']?_0x49cb4f['options'][_0x7da1('0x1d')]?_[_0x7da1('0x1e')](_0x49cb4f[_0x7da1('0x1a')][_0x7da1('0x1d')],function(_0x571f9c){return{'model':db[_0x571f9c[_0x7da1('0x1f')]],'as':_0x571f9c['as'],'attributes':_0x571f9c['attributes'],'include':_0x571f9c['include']?_['map'](_0x571f9c[_0x7da1('0x1d')],function(_0x310bc1){return{'model':db[_0x310bc1[_0x7da1('0x1f')]],'as':_0x310bc1['as'],'attributes':_0x310bc1[_0x7da1('0x1b')],'include':_0x310bc1['include']?_[_0x7da1('0x1e')](_0x310bc1[_0x7da1('0x1d')],function(_0xe82984){return{'model':db[_0xe82984[_0x7da1('0x1f')]],'as':_0xe82984['as'],'attributes':_0xe82984['attributes']};}):[]};}):[]};}):[]:[]})[_0x7da1('0xe')](function(_0x45e315){logger[_0x7da1('0x16')]('ShowFaxQueue',_0x49cb4f);logger['debug'](_0x7da1('0x20'),_0x49cb4f,JSON[_0x7da1('0x12')](_0x45e315));_0x605529(_0x45e315);})['catch'](function(_0x41129e){logger[_0x7da1('0x13')](_0x7da1('0x20'),_0x41129e[_0x7da1('0x15')],_0x49cb4f);_0x4ed806(_0x2ac398[_0x7da1('0x13')](0x1f4,_0x41129e[_0x7da1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 0e4c8a2..2677d30 100644 --- a/server/api/faxQueue/faxQueue.socket.js +++ b/server/api/faxQueue/faxQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d6a=['remove','update','emit','removeListener','length','faxQueue:','./faxQueue.events','save'];(function(_0x461560,_0x29ceda){var _0x3d0045=function(_0x411a1c){while(--_0x411a1c){_0x461560['push'](_0x461560['shift']());}};_0x3d0045(++_0x29ceda);}(_0x7d6a,0xf6));var _0xa7d6=function(_0x451c9f,_0x256c64){_0x451c9f=_0x451c9f-0x0;var _0x47d21f=_0x7d6a[_0x451c9f];return _0x47d21f;};'use strict';var FaxQueueEvents=require(_0xa7d6('0x0'));var events=[_0xa7d6('0x1'),_0xa7d6('0x2'),_0xa7d6('0x3')];function createListener(_0x2ca4d6,_0x2918f){return function(_0xa10d84){_0x2918f[_0xa7d6('0x4')](_0x2ca4d6,_0xa10d84);};}function removeListener(_0x222cc0,_0x321c25){return function(){FaxQueueEvents[_0xa7d6('0x5')](_0x222cc0,_0x321c25);};}exports['register']=function(_0x589a63){for(var _0x250a81=0x0,_0x1ab382=events[_0xa7d6('0x6')];_0x250a81<_0x1ab382;_0x250a81++){var _0x2bc22e=events[_0x250a81];var _0x62eb0d=createListener(_0xa7d6('0x7')+_0x2bc22e,_0x589a63);FaxQueueEvents['on'](_0x2bc22e,_0x62eb0d);}}; \ No newline at end of file +var _0x6b69=['remove','update','removeListener','register','faxQueue:','save'];(function(_0x4f69f2,_0x5464ac){var _0x53acb2=function(_0x374162){while(--_0x374162){_0x4f69f2['push'](_0x4f69f2['shift']());}};_0x53acb2(++_0x5464ac);}(_0x6b69,0x113));var _0x96b6=function(_0x186817,_0x2ab481){_0x186817=_0x186817-0x0;var _0x279a2e=_0x6b69[_0x186817];return _0x279a2e;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x96b6('0x0'),_0x96b6('0x1'),_0x96b6('0x2')];function createListener(_0x4a8eeb,_0x406a36){return function(_0x5ae3f0){_0x406a36['emit'](_0x4a8eeb,_0x5ae3f0);};}function removeListener(_0x1eb04f,_0x415ee3){return function(){FaxQueueEvents[_0x96b6('0x3')](_0x1eb04f,_0x415ee3);};}exports[_0x96b6('0x4')]=function(_0x48bbbe){for(var _0x2faa05=0x0,_0x13373f=events['length'];_0x2faa05<_0x13373f;_0x2faa05++){var _0x1ad299=events[_0x2faa05];var _0x30a1c7=createListener(_0x96b6('0x5')+_0x1ad299,_0x48bbbe);FaxQueueEvents['on'](_0x1ad299,_0x30a1c7);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 858be07..6220769 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7880=['delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update'];(function(_0x40e36f,_0x27e0e1){var _0x3a6d16=function(_0x1dcc88){while(--_0x1dcc88){_0x40e36f['push'](_0x40e36f['shift']());}};_0x3a6d16(++_0x27e0e1);}(_0x7880,0x1f4));var _0x0788=function(_0x48e885,_0x1b7f8a){_0x48e885=_0x48e885-0x0;var _0x3830a4=_0x7880[_0x48e885];return _0x3830a4;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['get'](_0x0788('0x10'),auth[_0x0788('0xa')](),controller[_0x0788('0x11')]);router[_0x0788('0x9')](_0x0788('0x12'),auth['isAuthenticated'](),controller[_0x0788('0x13')]);router[_0x0788('0x9')](_0x0788('0x14'),auth[_0x0788('0xa')](),controller[_0x0788('0x15')]);router[_0x0788('0x16')]('/',auth[_0x0788('0xa')](),controller['create']);router[_0x0788('0x16')](_0x0788('0x12'),auth[_0x0788('0xa')](),controller[_0x0788('0x17')]);router['post'](_0x0788('0x14'),auth['isAuthenticated'](),controller[_0x0788('0x18')]);router[_0x0788('0x19')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x1a')]);router[_0x0788('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x0788('0x1c')]);router[_0x0788('0x1b')]('/:id/teams',auth[_0x0788('0xa')](),controller[_0x0788('0x1d')]);router[_0x0788('0x1b')]('/:id/users',auth[_0x0788('0xa')](),controller[_0x0788('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xdb8b=['destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete'];(function(_0x7d0149,_0x1b6d23){var _0xaabd78=function(_0x3dfcef){while(--_0x3dfcef){_0x7d0149['push'](_0x7d0149['shift']());}};_0xaabd78(++_0x1b6d23);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0xfd0e2f,_0x301584){_0xfd0e2f=_0xfd0e2f-0x0;var _0x3640ee=_0xdb8b[_0xfd0e2f];return _0x3640ee;};'use strict';var multer=require('multer');var util=require(_0xbdb8('0x0'));var path=require(_0xbdb8('0x1'));var timeout=require(_0xbdb8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbdb8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbdb8('0x4'));var config=require(_0xbdb8('0x5'));var controller=require(_0xbdb8('0x6'));router[_0xbdb8('0x7')]('/',auth['isAuthenticated'](),controller[_0xbdb8('0x8')]);router['get'](_0xbdb8('0x9'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xb')]);router[_0xbdb8('0x7')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),controller['show']);router[_0xbdb8('0x7')](_0xbdb8('0xd'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xe')]);router[_0xbdb8('0x7')](_0xbdb8('0xf'),auth[_0xbdb8('0xa')](),controller['getTeams']);router['get'](_0xbdb8('0x10'),auth['isAuthenticated'](),controller[_0xbdb8('0x11')]);router['post']('/',auth[_0xbdb8('0xa')](),controller['create']);router[_0xbdb8('0x12')](_0xbdb8('0xf'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x13')]);router[_0xbdb8('0x12')](_0xbdb8('0x10'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x14')]);router[_0xbdb8('0x15')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x16')]);router[_0xbdb8('0x17')]('/:id',auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x18')]);router[_0xbdb8('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbdb8('0x19')]);router['delete'](_0xbdb8('0x10'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x1a')]);module[_0xbdb8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c9e460f..822f750 100644 --- a/server/api/faxQueueReport/faxQueueReport.attributes.js +++ b/server/api/faxQueueReport/faxQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c91=['sequelize','exports','STRING','DATE','moment'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x4c91,0x1da));var _0x14c9=function(_0x225d1c,_0x28de7f){_0x225d1c=_0x225d1c-0x0;var _0x31ff4c=_0x4c91[_0x225d1c];return _0x31ff4c;};'use strict';var moment=require(_0x14c9('0x0'));var Sequelize=require(_0x14c9('0x1'));module[_0x14c9('0x2')]={'uniqueid':{'type':Sequelize[_0x14c9('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x14c9('0x4')]},'leaveAt':{'type':Sequelize[_0x14c9('0x4')]},'acceptAt':{'type':Sequelize[_0x14c9('0x4')]},'exitAt':{'type':Sequelize[_0x14c9('0x4')]},'reason':{'type':Sequelize[_0x14c9('0x3')]}}; \ No newline at end of file +var _0x0cb6=['sequelize','STRING','DATE','moment'];(function(_0x3a4f61,_0x4fc841){var _0x56bcff=function(_0x452f4a){while(--_0x452f4a){_0x3a4f61['push'](_0x3a4f61['shift']());}};_0x56bcff(++_0x4fc841);}(_0x0cb6,0xb7));var _0x60cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cb6[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x60cb('0x0'));var Sequelize=require(_0x60cb('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x60cb('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x60cb('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x60cb('0x3')]},'reason':{'type':Sequelize[_0x60cb('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 6302298..bf24551 100644 --- a/server/api/faxQueueReport/faxQueueReport.controller.js +++ b/server/api/faxQueueReport/faxQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb458=['count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','FaxQueueReport','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x5db451,_0x410a5d){var _0x4f410d=function(_0x5abc83){while(--_0x5abc83){_0x5db451['push'](_0x5db451['shift']());}};_0x4f410d(++_0x410a5d);}(_0xb458,0xca));var _0x8b45=function(_0x55c71b,_0x399f51){_0x55c71b=_0x55c71b-0x0;var _0x14910c=_0xb458[_0x55c71b];return _0x14910c;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require(_0x8b45('0x3'));var rp=require('request-promise');var moment=require(_0x8b45('0x4'));var BPromise=require(_0x8b45('0x5'));var Mustache=require(_0x8b45('0x6'));var util=require(_0x8b45('0x7'));var path=require(_0x8b45('0x8'));var sox=require(_0x8b45('0x9'));var csv=require(_0x8b45('0xa'));var ejs=require(_0x8b45('0xb'));var fs=require('fs');var fs_extra=require(_0x8b45('0xc'));var _=require(_0x8b45('0xd'));var squel=require(_0x8b45('0xe'));var crypto=require(_0x8b45('0xf'));var jsforce=require(_0x8b45('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b45('0x11'));var authService=require(_0x8b45('0x12'));var qs=require(_0x8b45('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b45('0x14'));var logger=require('../../config/logger')(_0x8b45('0x15'));var utils=require(_0x8b45('0x16'));var config=require(_0x8b45('0x17'));var licenseUtil=require(_0x8b45('0x18'));var db=require(_0x8b45('0x19'))['db'];function respondWithStatusCode(_0x54c03c,_0x5559e7){_0x5559e7=_0x5559e7||0xcc;return function(_0x46a6c4){if(_0x46a6c4){return _0x54c03c[_0x8b45('0x1a')](_0x5559e7);}return _0x54c03c[_0x8b45('0x1b')](_0x5559e7)[_0x8b45('0x1c')]();};}function respondWithResult(_0x3b7c99,_0x1fdb2d){_0x1fdb2d=_0x1fdb2d||0xc8;return function(_0x1bd228){if(_0x1bd228){return _0x3b7c99[_0x8b45('0x1b')](_0x1fdb2d)[_0x8b45('0x1d')](_0x1bd228);}};}function respondWithFilteredResult(_0x83c355,_0x300dc9){return function(_0x153495){if(_0x153495){var _0x29180d=typeof _0x300dc9[_0x8b45('0x1e')]===_0x8b45('0x1f')&&typeof _0x300dc9['limit']==='undefined';var _0x777072=_0x153495[_0x8b45('0x20')];var _0xfb84af=_0x29180d?0x0:_0x300dc9[_0x8b45('0x1e')];var _0x39bffe=_0x29180d?_0x153495['count']:_0x300dc9[_0x8b45('0x1e')]+_0x300dc9['limit'];var _0x219c94;if(_0x39bffe>=_0x777072){_0x39bffe=_0x777072;_0x219c94=0xc8;}else{_0x219c94=0xce;}_0x83c355['status'](_0x219c94);return _0x83c355[_0x8b45('0x21')](_0x8b45('0x22'),_0xfb84af+'-'+_0x39bffe+'/'+_0x777072)[_0x8b45('0x1d')](_0x153495);}return null;};}function patchUpdates(_0x51fe21){return function(_0xc924dd){try{jsonpatch[_0x8b45('0x23')](_0xc924dd,_0x51fe21,!![]);}catch(_0x48f46a){return BPromise[_0x8b45('0x24')](_0x48f46a);}return _0xc924dd[_0x8b45('0x25')]();};}function saveUpdates(_0x2319c6,_0x4e57a9){return function(_0xc125c4){if(_0xc125c4){return _0xc125c4[_0x8b45('0x26')](_0x2319c6)[_0x8b45('0x27')](function(_0x557f5b){return _0x557f5b;});}return null;};}function removeEntity(_0x1dc7c2,_0x53205d){return function(_0x5cd08a){if(_0x5cd08a){return _0x5cd08a[_0x8b45('0x28')]()[_0x8b45('0x27')](function(){_0x1dc7c2[_0x8b45('0x1b')](0xcc)[_0x8b45('0x1c')]();});}};}function handleEntityNotFound(_0x40510c,_0x5ce26a){return function(_0x3dc3b8){if(!_0x3dc3b8){_0x40510c[_0x8b45('0x1a')](0x194);}return _0x3dc3b8;};}function handleError(_0x4acd00,_0x4b6465){_0x4b6465=_0x4b6465||0x1f4;return function(_0x5919e2){logger[_0x8b45('0x29')](_0x5919e2[_0x8b45('0x2a')]);if(_0x5919e2['name']){delete _0x5919e2['name'];}_0x4acd00['status'](_0x4b6465)['send'](_0x5919e2);};}exports['index']=function(_0x2b24f3,_0x53a363){var _0x28d540={},_0x275c07={},_0xde6b96={'count':0x0,'rows':[]};var _0x33dbb4=_['map'](db[_0x8b45('0x2b')]['rawAttributes'],function(_0x5b8f40){return{'name':_0x5b8f40[_0x8b45('0x2c')],'type':_0x5b8f40[_0x8b45('0x2d')][_0x8b45('0x2e')]};});_0x275c07[_0x8b45('0x2f')]=_[_0x8b45('0x30')](_0x33dbb4,_0x8b45('0x31'));_0x275c07[_0x8b45('0x32')]=_[_0x8b45('0x33')](_0x2b24f3[_0x8b45('0x32')]);_0x275c07[_0x8b45('0x34')]=_[_0x8b45('0x35')](_0x275c07[_0x8b45('0x2f')],_0x275c07[_0x8b45('0x32')]);_0x28d540[_0x8b45('0x36')]=_[_0x8b45('0x35')](_0x275c07[_0x8b45('0x2f')],qs['fields'](_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x37')]));_0x28d540['attributes']=_0x28d540[_0x8b45('0x36')][_0x8b45('0x38')]?_0x28d540[_0x8b45('0x36')]:_0x275c07['model'];if(!_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x39')]('nolimit')){_0x28d540[_0x8b45('0x3a')]=qs['limit'](_0x2b24f3[_0x8b45('0x32')]['limit']);_0x28d540['offset']=qs['offset'](_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x1e')]);}_0x28d540[_0x8b45('0x3b')]=qs[_0x8b45('0x3c')](_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x3c')]);_0x28d540['where']=qs[_0x8b45('0x34')](_[_0x8b45('0x3d')](_0x2b24f3['query'],_0x275c07['filters']),_0x33dbb4);if(_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x3e')]){_0x28d540[_0x8b45('0x3f')]=_[_0x8b45('0x40')](_0x28d540[_0x8b45('0x3f')],{'$or':_['map'](_0x33dbb4,function(_0x4e182e){if(_0x4e182e[_0x8b45('0x2d')]!=='VIRTUAL'){var _0x3abe4f={};_0x3abe4f[_0x4e182e[_0x8b45('0x31')]]={'$like':'%'+_0x2b24f3['query'][_0x8b45('0x3e')]+'%'};return _0x3abe4f;}})});}_0x28d540=_[_0x8b45('0x40')]({},_0x28d540,_0x2b24f3['options']);var _0x1df3b4={'where':_0x28d540['where']};return db[_0x8b45('0x2b')]['count'](_0x1df3b4)[_0x8b45('0x27')](function(_0x3952f6){_0xde6b96[_0x8b45('0x20')]=_0x3952f6;if(_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x41')]){_0x28d540[_0x8b45('0x42')]=[{'all':!![]}];}return db[_0x8b45('0x2b')][_0x8b45('0x43')](_0x28d540);})[_0x8b45('0x27')](function(_0xebc105){_0xde6b96[_0x8b45('0x44')]=_0xebc105;return _0xde6b96;})[_0x8b45('0x27')](respondWithFilteredResult(_0x53a363,_0x28d540))[_0x8b45('0x45')](handleError(_0x53a363,null));};exports[_0x8b45('0x46')]=function(_0x587b00,_0x2464cc){var _0x44e81c={'raw':!![],'where':{'id':_0x587b00[_0x8b45('0x47')]['id']}},_0x330118={};_0x330118[_0x8b45('0x2f')]=_[_0x8b45('0x33')](db[_0x8b45('0x2b')][_0x8b45('0x48')]);_0x330118[_0x8b45('0x32')]=_[_0x8b45('0x33')](_0x587b00['query']);_0x330118[_0x8b45('0x34')]=_[_0x8b45('0x35')](_0x330118[_0x8b45('0x2f')],_0x330118[_0x8b45('0x32')]);_0x44e81c['attributes']=_[_0x8b45('0x35')](_0x330118[_0x8b45('0x2f')],qs[_0x8b45('0x37')](_0x587b00[_0x8b45('0x32')][_0x8b45('0x37')]));_0x44e81c[_0x8b45('0x36')]=_0x44e81c[_0x8b45('0x36')][_0x8b45('0x38')]?_0x44e81c['attributes']:_0x330118[_0x8b45('0x2f')];if(_0x587b00[_0x8b45('0x32')][_0x8b45('0x41')]){_0x44e81c[_0x8b45('0x42')]=[{'all':!![]}];}_0x44e81c=_[_0x8b45('0x40')]({},_0x44e81c,_0x587b00[_0x8b45('0x49')]);return db[_0x8b45('0x2b')][_0x8b45('0x4a')](_0x44e81c)['then'](handleEntityNotFound(_0x2464cc,null))[_0x8b45('0x27')](respondWithResult(_0x2464cc,null))[_0x8b45('0x45')](handleError(_0x2464cc,null));};exports[_0x8b45('0x4b')]=function(_0x1e2d89,_0x58d58b){return db['FaxQueueReport'][_0x8b45('0x4b')](_0x1e2d89[_0x8b45('0x4c')],{})[_0x8b45('0x27')](respondWithResult(_0x58d58b,0xc9))['catch'](handleError(_0x58d58b,null));};exports[_0x8b45('0x26')]=function(_0x4020ed,_0x3833e0){if(_0x4020ed[_0x8b45('0x4c')]['id']){delete _0x4020ed[_0x8b45('0x4c')]['id'];}return db[_0x8b45('0x2b')][_0x8b45('0x4a')]({'where':{'id':_0x4020ed['params']['id']}})[_0x8b45('0x27')](handleEntityNotFound(_0x3833e0,null))[_0x8b45('0x27')](saveUpdates(_0x4020ed[_0x8b45('0x4c')],null))[_0x8b45('0x27')](respondWithResult(_0x3833e0,null))[_0x8b45('0x45')](handleError(_0x3833e0,null));};exports[_0x8b45('0x28')]=function(_0xb7d73b,_0xbbe7e2){return db[_0x8b45('0x2b')][_0x8b45('0x4a')]({'where':{'id':_0xb7d73b[_0x8b45('0x47')]['id']}})[_0x8b45('0x27')](handleEntityNotFound(_0xbbe7e2,null))[_0x8b45('0x27')](removeEntity(_0xbbe7e2,null))[_0x8b45('0x45')](handleError(_0xbbe7e2,null));};exports[_0x8b45('0x4d')]=function(_0x48275b,_0x3d5f7b){return db[_0x8b45('0x2b')][_0x8b45('0x4d')]()['then'](respondWithResult(_0x3d5f7b,null))[_0x8b45('0x45')](handleError(_0x3d5f7b,null));}; \ No newline at end of file +var _0x758e=['type','keys','query','model','attributes','intersection','limit','sort','where','filters','merge','map','VIRTUAL','filter','include','findAll','rows','catch','show','params','fields','length','includeAll','options','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','name','send','FaxQueueReport','rawAttributes','fieldName'];(function(_0x112a2f,_0x309346){var _0xa444c7=function(_0x370120){while(--_0x370120){_0x112a2f['push'](_0x112a2f['shift']());}};_0xa444c7(++_0x309346);}(_0x758e,0x1af));var _0xe758=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x758e[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0xe758('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe758('0x1'));var rp=require(_0xe758('0x2'));var moment=require(_0xe758('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe758('0x4'));var path=require(_0xe758('0x5'));var sox=require(_0xe758('0x6'));var csv=require(_0xe758('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe758('0x8'));var _=require(_0xe758('0x9'));var squel=require(_0xe758('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe758('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe758('0xc'));var qs=require(_0xe758('0xd'));var as=require(_0xe758('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe758('0xf'))('api');var utils=require(_0xe758('0x10'));var config=require(_0xe758('0x11'));var licenseUtil=require(_0xe758('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a29aa,_0x4bb0d8){_0x4bb0d8=_0x4bb0d8||0xcc;return function(_0x2571c1){if(_0x2571c1){return _0x1a29aa[_0xe758('0x13')](_0x4bb0d8);}return _0x1a29aa[_0xe758('0x14')](_0x4bb0d8)[_0xe758('0x15')]();};}function respondWithResult(_0x26dfcd,_0x27517f){_0x27517f=_0x27517f||0xc8;return function(_0xea5ea3){if(_0xea5ea3){return _0x26dfcd[_0xe758('0x14')](_0x27517f)[_0xe758('0x16')](_0xea5ea3);}};}function respondWithFilteredResult(_0x509431,_0x3c617a){return function(_0x551700){if(_0x551700){var _0x544b3a=typeof _0x3c617a[_0xe758('0x17')]===_0xe758('0x18')&&typeof _0x3c617a['limit']==='undefined';var _0x7ed4e9=_0x551700[_0xe758('0x19')];var _0x38c30c=_0x544b3a?0x0:_0x3c617a[_0xe758('0x17')];var _0x3fe7e8=_0x544b3a?_0x551700[_0xe758('0x19')]:_0x3c617a['offset']+_0x3c617a['limit'];var _0x44a6db;if(_0x3fe7e8>=_0x7ed4e9){_0x3fe7e8=_0x7ed4e9;_0x44a6db=0xc8;}else{_0x44a6db=0xce;}_0x509431[_0xe758('0x14')](_0x44a6db);return _0x509431[_0xe758('0x1a')](_0xe758('0x1b'),_0x38c30c+'-'+_0x3fe7e8+'/'+_0x7ed4e9)[_0xe758('0x16')](_0x551700);}return null;};}function patchUpdates(_0x4d35d3){return function(_0x4eeb82){try{jsonpatch[_0xe758('0x1c')](_0x4eeb82,_0x4d35d3,!![]);}catch(_0xc7afba){return BPromise[_0xe758('0x1d')](_0xc7afba);}return _0x4eeb82[_0xe758('0x1e')]();};}function saveUpdates(_0x523448,_0x3c441d){return function(_0x39fbb2){if(_0x39fbb2){return _0x39fbb2[_0xe758('0x1f')](_0x523448)[_0xe758('0x20')](function(_0x2ee309){return _0x2ee309;});}return null;};}function removeEntity(_0x992bb5,_0x108bfe){return function(_0x4b147b){if(_0x4b147b){return _0x4b147b['destroy']()['then'](function(){_0x992bb5['status'](0xcc)[_0xe758('0x15')]();});}};}function handleEntityNotFound(_0x145beb,_0x1cd620){return function(_0x130868){if(!_0x130868){_0x145beb['sendStatus'](0x194);}return _0x130868;};}function handleError(_0x374223,_0x5c0e38){_0x5c0e38=_0x5c0e38||0x1f4;return function(_0x3bcdac){logger['error'](_0x3bcdac['stack']);if(_0x3bcdac[_0xe758('0x21')]){delete _0x3bcdac[_0xe758('0x21')];}_0x374223[_0xe758('0x14')](_0x5c0e38)[_0xe758('0x22')](_0x3bcdac);};}exports['index']=function(_0xf00ed6,_0x32c693){var _0x258d5f={},_0x1934d9={},_0x52279e={'count':0x0,'rows':[]};var _0x3a7e96=_['map'](db[_0xe758('0x23')][_0xe758('0x24')],function(_0x14b59d){return{'name':_0x14b59d[_0xe758('0x25')],'type':_0x14b59d[_0xe758('0x26')]['key']};});_0x1934d9['model']=_['map'](_0x3a7e96,_0xe758('0x21'));_0x1934d9['query']=_[_0xe758('0x27')](_0xf00ed6[_0xe758('0x28')]);_0x1934d9['filters']=_['intersection'](_0x1934d9[_0xe758('0x29')],_0x1934d9['query']);_0x258d5f[_0xe758('0x2a')]=_[_0xe758('0x2b')](_0x1934d9[_0xe758('0x29')],qs['fields'](_0xf00ed6[_0xe758('0x28')]['fields']));_0x258d5f[_0xe758('0x2a')]=_0x258d5f[_0xe758('0x2a')]['length']?_0x258d5f[_0xe758('0x2a')]:_0x1934d9[_0xe758('0x29')];if(!_0xf00ed6[_0xe758('0x28')]['hasOwnProperty']('nolimit')){_0x258d5f[_0xe758('0x2c')]=qs['limit'](_0xf00ed6[_0xe758('0x28')][_0xe758('0x2c')]);_0x258d5f[_0xe758('0x17')]=qs[_0xe758('0x17')](_0xf00ed6[_0xe758('0x28')][_0xe758('0x17')]);}_0x258d5f['order']=qs[_0xe758('0x2d')](_0xf00ed6['query']['sort']);_0x258d5f[_0xe758('0x2e')]=qs[_0xe758('0x2f')](_['pick'](_0xf00ed6[_0xe758('0x28')],_0x1934d9[_0xe758('0x2f')]),_0x3a7e96);if(_0xf00ed6[_0xe758('0x28')]['filter']){_0x258d5f[_0xe758('0x2e')]=_[_0xe758('0x30')](_0x258d5f[_0xe758('0x2e')],{'$or':_[_0xe758('0x31')](_0x3a7e96,function(_0x4bbf04){if(_0x4bbf04[_0xe758('0x26')]!==_0xe758('0x32')){var _0xfb2038={};_0xfb2038[_0x4bbf04[_0xe758('0x21')]]={'$like':'%'+_0xf00ed6['query'][_0xe758('0x33')]+'%'};return _0xfb2038;}})});}_0x258d5f=_['merge']({},_0x258d5f,_0xf00ed6['options']);var _0x36e6e7={'where':_0x258d5f[_0xe758('0x2e')]};return db[_0xe758('0x23')]['count'](_0x36e6e7)[_0xe758('0x20')](function(_0x2a0a8c){_0x52279e[_0xe758('0x19')]=_0x2a0a8c;if(_0xf00ed6[_0xe758('0x28')]['includeAll']){_0x258d5f[_0xe758('0x34')]=[{'all':!![]}];}return db[_0xe758('0x23')][_0xe758('0x35')](_0x258d5f);})[_0xe758('0x20')](function(_0x4f9edc){_0x52279e[_0xe758('0x36')]=_0x4f9edc;return _0x52279e;})['then'](respondWithFilteredResult(_0x32c693,_0x258d5f))[_0xe758('0x37')](handleError(_0x32c693,null));};exports[_0xe758('0x38')]=function(_0x5816fc,_0xe4129a){var _0x2882d0={'raw':!![],'where':{'id':_0x5816fc[_0xe758('0x39')]['id']}},_0x4c2855={};_0x4c2855[_0xe758('0x29')]=_[_0xe758('0x27')](db[_0xe758('0x23')][_0xe758('0x24')]);_0x4c2855[_0xe758('0x28')]=_[_0xe758('0x27')](_0x5816fc[_0xe758('0x28')]);_0x4c2855[_0xe758('0x2f')]=_['intersection'](_0x4c2855['model'],_0x4c2855['query']);_0x2882d0['attributes']=_[_0xe758('0x2b')](_0x4c2855[_0xe758('0x29')],qs[_0xe758('0x3a')](_0x5816fc[_0xe758('0x28')][_0xe758('0x3a')]));_0x2882d0[_0xe758('0x2a')]=_0x2882d0['attributes'][_0xe758('0x3b')]?_0x2882d0[_0xe758('0x2a')]:_0x4c2855['model'];if(_0x5816fc['query'][_0xe758('0x3c')]){_0x2882d0[_0xe758('0x34')]=[{'all':!![]}];}_0x2882d0=_[_0xe758('0x30')]({},_0x2882d0,_0x5816fc[_0xe758('0x3d')]);return db['FaxQueueReport'][_0xe758('0x3e')](_0x2882d0)[_0xe758('0x20')](handleEntityNotFound(_0xe4129a,null))[_0xe758('0x20')](respondWithResult(_0xe4129a,null))['catch'](handleError(_0xe4129a,null));};exports['create']=function(_0x1a16b5,_0x2272b5){return db[_0xe758('0x23')][_0xe758('0x3f')](_0x1a16b5[_0xe758('0x40')],{})['then'](respondWithResult(_0x2272b5,0xc9))[_0xe758('0x37')](handleError(_0x2272b5,null));};exports[_0xe758('0x1f')]=function(_0x58ebcc,_0x4ab7c6){if(_0x58ebcc[_0xe758('0x40')]['id']){delete _0x58ebcc[_0xe758('0x40')]['id'];}return db['FaxQueueReport'][_0xe758('0x3e')]({'where':{'id':_0x58ebcc[_0xe758('0x39')]['id']}})[_0xe758('0x20')](handleEntityNotFound(_0x4ab7c6,null))['then'](saveUpdates(_0x58ebcc[_0xe758('0x40')],null))[_0xe758('0x20')](respondWithResult(_0x4ab7c6,null))['catch'](handleError(_0x4ab7c6,null));};exports[_0xe758('0x41')]=function(_0x206cc3,_0x49c6d9){return db['FaxQueueReport'][_0xe758('0x3e')]({'where':{'id':_0x206cc3[_0xe758('0x39')]['id']}})[_0xe758('0x20')](handleEntityNotFound(_0x49c6d9,null))[_0xe758('0x20')](removeEntity(_0x49c6d9,null))[_0xe758('0x37')](handleError(_0x49c6d9,null));};exports[_0xe758('0x42')]=function(_0x158fb3,_0x1c8364){return db['FaxQueueReport'][_0xe758('0x42')]()[_0xe758('0x20')](respondWithResult(_0x1c8364,null))[_0xe758('0x37')](handleError(_0x1c8364,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index dc0b9be..47f7d0b 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x438261,_0x5bfa45){var _0x2f77ab=function(_0x4a8d2a){while(--_0x4a8d2a){_0x438261['push'](_0x438261['shift']());}};_0x2f77ab(++_0x5bfa45);}(_0x1261,0x144));var _0x1126=function(_0x22889a,_0x4b75f7){_0x22889a=_0x22889a-0x0;var _0x763d34=_0x1261[_0x22889a];return _0x763d34;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x1cb9,0x14e));var _0x91cb=function(_0x419aaf,_0x5b5cb5){_0x419aaf=_0x419aaf-0x0;var _0x4cab8a=_0x1cb9[_0x419aaf];return _0x4cab8a;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e6e601c..ab685bf 100644 --- a/server/api/faxQueueReport/faxQueueReport.rpc.js +++ b/server/api/faxQueueReport/faxQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc495=['error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','where','attributes','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x116cc8,_0x23b22e){var _0x603ac2=function(_0x3b4045){while(--_0x3b4045){_0x116cc8['push'](_0x116cc8['shift']());}};_0x603ac2(++_0x23b22e);}(_0xc495,0x72));var _0x5c49=function(_0x465bba,_0x1e476f){_0x465bba=_0x465bba-0x0;var _0x2acb77=_0xc495[_0x465bba];return _0x2acb77;};'use strict';var _=require(_0x5c49('0x0'));var util=require(_0x5c49('0x1'));var moment=require(_0x5c49('0x2'));var BPromise=require(_0x5c49('0x3'));var rs=require(_0x5c49('0x4'));var fs=require('fs');var Redis=require(_0x5c49('0x5'));var db=require(_0x5c49('0x6'))['db'];var utils=require(_0x5c49('0x7'));var logger=require(_0x5c49('0x8'))(_0x5c49('0x9'));var config=require(_0x5c49('0xa'));var jayson=require(_0x5c49('0xb'));var client=jayson[_0x5c49('0xc')][_0x5c49('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x472bfa,_0x414303,_0x3ecb45){return new BPromise(function(_0x394ac8,_0x26eddb){return client[_0x5c49('0xe')](_0x472bfa,_0x3ecb45)[_0x5c49('0xf')](function(_0x5a4d06){logger[_0x5c49('0x10')](_0x5c49('0x11'),_0x414303,_0x5c49('0x12'));logger[_0x5c49('0x13')](_0x5c49('0x14'),_0x414303,_0x5c49('0x12'),JSON[_0x5c49('0x15')](_0x5a4d06));if(_0x5a4d06[_0x5c49('0x16')]){if(_0x5a4d06[_0x5c49('0x16')][_0x5c49('0x17')]===0x1f4){logger['error'](_0x5c49('0x11'),_0x414303,_0x5a4d06[_0x5c49('0x16')][_0x5c49('0x18')]);return _0x26eddb(_0x5a4d06[_0x5c49('0x16')][_0x5c49('0x18')]);}logger['error'](_0x5c49('0x11'),_0x414303,_0x5a4d06[_0x5c49('0x16')][_0x5c49('0x18')]);return _0x394ac8(_0x5a4d06[_0x5c49('0x16')][_0x5c49('0x18')]);}else{logger[_0x5c49('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x414303,'request\x20sent');_0x394ac8(_0x5a4d06['result'][_0x5c49('0x18')]);}})[_0x5c49('0x19')](function(_0x32703c){logger[_0x5c49('0x16')](_0x5c49('0x11'),_0x414303,_0x32703c);_0x26eddb(_0x32703c);});});}exports[_0x5c49('0x1a')]=function(_0x187874){var _0x3c6c2d=this;return new Promise(function(_0x3176d7,_0x2dd0ab){return db[_0x5c49('0x1b')][_0x5c49('0x1c')](_0x187874['body'],{'raw':_0x187874[_0x5c49('0x1d')]?_0x187874[_0x5c49('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x5c49('0xf')](function(_0x10de2c){logger[_0x5c49('0x10')](_0x5c49('0x1a'),_0x187874);logger[_0x5c49('0x13')]('CreateFaxQueueReport',_0x187874,JSON['stringify'](_0x10de2c));_0x3176d7(_0x10de2c);})[_0x5c49('0x19')](function(_0x56602b){logger['error'](_0x5c49('0x1a'),_0x56602b[_0x5c49('0x18')],_0x187874);_0x2dd0ab(_0x3c6c2d[_0x5c49('0x16')](0x1f4,_0x56602b[_0x5c49('0x18')]));});});};exports['UpdateFaxQueueReport']=function(_0xb73429){var _0x5a0a47=this;return new Promise(function(_0x1a8de5,_0xd7f634){return db[_0x5c49('0x1b')]['update'](_0xb73429['body'],{'raw':_0xb73429['options']?_0xb73429['options'][_0x5c49('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb73429['options']?_0xb73429['options'][_0x5c49('0x1f')]||null:null,'attributes':_0xb73429[_0x5c49('0x1d')]?_0xb73429[_0x5c49('0x1d')][_0x5c49('0x20')]||null:null,'limit':_0xb73429[_0x5c49('0x1d')]?_0xb73429[_0x5c49('0x1d')]['limit']||null:null})[_0x5c49('0xf')](function(_0x169a2e){logger[_0x5c49('0x10')](_0x5c49('0x21'),_0xb73429);logger['debug'](_0x5c49('0x21'),_0xb73429,JSON[_0x5c49('0x15')](_0x169a2e));_0x1a8de5(_0x169a2e);})[_0x5c49('0x19')](function(_0x305fef){logger[_0x5c49('0x16')](_0x5c49('0x21'),_0x305fef['message'],_0xb73429);_0xd7f634(_0x5a0a47[_0x5c49('0x16')](0x1f4,_0x305fef[_0x5c49('0x18')]));});});}; \ No newline at end of file +var _0xb0e7=['update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','FaxQueueReport'];(function(_0x2862f2,_0x4dc428){var _0x2eaac5=function(_0x37e814){while(--_0x37e814){_0x2862f2['push'](_0x2862f2['shift']());}};_0x2eaac5(++_0x4dc428);}(_0xb0e7,0x1c4));var _0x7b0e=function(_0x2c5d16,_0x234577){_0x2c5d16=_0x2c5d16-0x0;var _0x5e3f87=_0xb0e7[_0x2c5d16];return _0x5e3f87;};'use strict';var _=require(_0x7b0e('0x0'));var util=require('util');var moment=require(_0x7b0e('0x1'));var BPromise=require(_0x7b0e('0x2'));var rs=require(_0x7b0e('0x3'));var fs=require('fs');var Redis=require(_0x7b0e('0x4'));var db=require(_0x7b0e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b0e('0x6'));var config=require(_0x7b0e('0x7'));var jayson=require(_0x7b0e('0x8'));var client=jayson[_0x7b0e('0x9')][_0x7b0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x134054,_0x49316b,_0x4e3cac){return new BPromise(function(_0x5c5046,_0x3a3ced){return client['request'](_0x134054,_0x4e3cac)[_0x7b0e('0xb')](function(_0x5d80e2){logger[_0x7b0e('0xc')](_0x7b0e('0xd'),_0x49316b,_0x7b0e('0xe'));logger[_0x7b0e('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x49316b,_0x7b0e('0xe'),JSON[_0x7b0e('0x10')](_0x5d80e2));if(_0x5d80e2[_0x7b0e('0x11')]){if(_0x5d80e2[_0x7b0e('0x11')][_0x7b0e('0x12')]===0x1f4){logger[_0x7b0e('0x11')](_0x7b0e('0xd'),_0x49316b,_0x5d80e2[_0x7b0e('0x11')]['message']);return _0x3a3ced(_0x5d80e2[_0x7b0e('0x11')][_0x7b0e('0x13')]);}logger[_0x7b0e('0x11')](_0x7b0e('0xd'),_0x49316b,_0x5d80e2[_0x7b0e('0x11')][_0x7b0e('0x13')]);return _0x5c5046(_0x5d80e2['error'][_0x7b0e('0x13')]);}else{logger[_0x7b0e('0xc')](_0x7b0e('0xd'),_0x49316b,_0x7b0e('0xe'));_0x5c5046(_0x5d80e2['result'][_0x7b0e('0x13')]);}})[_0x7b0e('0x14')](function(_0x380e4d){logger[_0x7b0e('0x11')](_0x7b0e('0xd'),_0x49316b,_0x380e4d);_0x3a3ced(_0x380e4d);});});}exports[_0x7b0e('0x15')]=function(_0x3bc75c){var _0x495435=this;return new Promise(function(_0xce9bbf,_0x57da10){return db['FaxQueueReport'][_0x7b0e('0x16')](_0x3bc75c[_0x7b0e('0x17')],{'raw':_0x3bc75c['options']?_0x3bc75c[_0x7b0e('0x18')][_0x7b0e('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x50e41f){logger[_0x7b0e('0xc')](_0x7b0e('0x15'),_0x3bc75c);logger['debug'](_0x7b0e('0x15'),_0x3bc75c,JSON[_0x7b0e('0x10')](_0x50e41f));_0xce9bbf(_0x50e41f);})['catch'](function(_0x30854e){logger[_0x7b0e('0x11')](_0x7b0e('0x15'),_0x30854e['message'],_0x3bc75c);_0x57da10(_0x495435['error'](0x1f4,_0x30854e['message']));});});};exports[_0x7b0e('0x1a')]=function(_0x34d459){var _0x2c1c3c=this;return new Promise(function(_0x52b143,_0x2052f1){return db[_0x7b0e('0x1b')][_0x7b0e('0x1c')](_0x34d459['body'],{'raw':_0x34d459[_0x7b0e('0x18')]?_0x34d459['options'][_0x7b0e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d459[_0x7b0e('0x18')]?_0x34d459[_0x7b0e('0x18')][_0x7b0e('0x1d')]||null:null,'attributes':_0x34d459[_0x7b0e('0x18')]?_0x34d459[_0x7b0e('0x18')][_0x7b0e('0x1e')]||null:null,'limit':_0x34d459[_0x7b0e('0x18')]?_0x34d459[_0x7b0e('0x18')][_0x7b0e('0x1f')]||null:null})[_0x7b0e('0xb')](function(_0x3664b4){logger['info'](_0x7b0e('0x1a'),_0x34d459);logger[_0x7b0e('0xf')](_0x7b0e('0x1a'),_0x34d459,JSON[_0x7b0e('0x10')](_0x3664b4));_0x52b143(_0x3664b4);})[_0x7b0e('0x14')](function(_0x28f2fe){logger['error'](_0x7b0e('0x1a'),_0x28f2fe[_0x7b0e('0x13')],_0x34d459);_0x2052f1(_0x2c1c3c[_0x7b0e('0x11')](0x1f4,_0x28f2fe['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8971231..a929067 100644 --- a/server/api/faxQueueReport/index.js +++ b/server/api/faxQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56bc=['fs-extra','../../components/auth/service','../../components/interaction/service','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x54433f,_0x122689){var _0x4d024e=function(_0x5ef3bb){while(--_0x5ef3bb){_0x54433f['push'](_0x54433f['shift']());}};_0x4d024e(++_0x122689);}(_0x56bc,0x19d));var _0xc56b=function(_0xe13b37,_0x1e40a8){_0xe13b37=_0xe13b37-0x0;var _0x333e53=_0x56bc[_0xe13b37];return _0x333e53;};'use strict';var multer=require(_0xc56b('0x0'));var util=require('util');var path=require(_0xc56b('0x1'));var timeout=require(_0xc56b('0x2'));var express=require(_0xc56b('0x3'));var router=express[_0xc56b('0x4')]();var fs_extra=require(_0xc56b('0x5'));var auth=require(_0xc56b('0x6'));var interaction=require(_0xc56b('0x7'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc56b('0x8')]);router['get'](_0xc56b('0x9'),auth[_0xc56b('0xa')](),controller[_0xc56b('0xb')]);router[_0xc56b('0xc')](_0xc56b('0xd'),auth[_0xc56b('0xa')](),controller[_0xc56b('0xe')]);router[_0xc56b('0xf')]('/',auth[_0xc56b('0xa')](),controller[_0xc56b('0x10')]);router[_0xc56b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc56b('0x12')]);router[_0xc56b('0x13')](_0xc56b('0xd'),auth[_0xc56b('0xa')](),controller[_0xc56b('0x14')]);module[_0xc56b('0x15')]=router; \ No newline at end of file +var _0x23c2=['/:id','show','post','put','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x4ad046,_0x40b810){var _0x35c384=function(_0x54944e){while(--_0x54944e){_0x4ad046['push'](_0x4ad046['shift']());}};_0x35c384(++_0x40b810);}(_0x23c2,0xc4));var _0x223c=function(_0x1ce9ea,_0x32e6f4){_0x1ce9ea=_0x1ce9ea-0x0;var _0x2a95b9=_0x23c2[_0x1ce9ea];return _0x2a95b9;};'use strict';var multer=require(_0x223c('0x0'));var util=require(_0x223c('0x1'));var path=require(_0x223c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x223c('0x3')]();var fs_extra=require(_0x223c('0x4'));var auth=require(_0x223c('0x5'));var interaction=require(_0x223c('0x6'));var config=require(_0x223c('0x7'));var controller=require(_0x223c('0x8'));router[_0x223c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x223c('0xa'),auth[_0x223c('0xb')](),controller[_0x223c('0xc')]);router['get'](_0x223c('0xd'),auth[_0x223c('0xb')](),controller[_0x223c('0xe')]);router[_0x223c('0xf')]('/',auth[_0x223c('0xb')](),controller['create']);router[_0x223c('0x10')](_0x223c('0xd'),auth[_0x223c('0xb')](),controller['update']);router[_0x223c('0x11')](_0x223c('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x223c('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index baa1bee..8b59e2a 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4ec080,_0x3d0d1b){var _0x2eb279=function(_0x549a6b){while(--_0x549a6b){_0x4ec080['push'](_0x4ec080['shift']());}};_0x2eb279(++_0x3d0d1b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0xf3cd[_0x51ed62];return _0x34aee3;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xd72b2d,_0x196d6c){var _0x5b7e5f=function(_0x1d7580){while(--_0x1d7580){_0xd72b2d['push'](_0xd72b2d['shift']());}};_0x5b7e5f(++_0x196d6c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x00bb[_0x2d7f0e];return _0x110b07;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 66fe6c3..f644de6 100644 --- a/server/api/faxTransferReport/faxTransferReport.controller.js +++ b/server/api/faxTransferReport/faxTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d89=['count','Content-Range','apply','reject','update','then','error','name','send','FaxTransferReport','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit'];(function(_0x1f12ad,_0x1d0e2a){var _0x533d97=function(_0x54ffaf){while(--_0x54ffaf){_0x1f12ad['push'](_0x1f12ad['shift']());}};_0x533d97(++_0x1d0e2a);}(_0x3d89,0x157));var _0x93d8=function(_0x5d0dd2,_0x3c786d){_0x5d0dd2=_0x5d0dd2-0x0;var _0x369026=_0x3d89[_0x5d0dd2];return _0x369026;};'use strict';var emlformat=require(_0x93d8('0x0'));var rimraf=require(_0x93d8('0x1'));var zipdir=require(_0x93d8('0x2'));var jsonpatch=require(_0x93d8('0x3'));var rp=require(_0x93d8('0x4'));var moment=require(_0x93d8('0x5'));var BPromise=require(_0x93d8('0x6'));var Mustache=require(_0x93d8('0x7'));var util=require(_0x93d8('0x8'));var path=require(_0x93d8('0x9'));var sox=require(_0x93d8('0xa'));var csv=require(_0x93d8('0xb'));var ejs=require(_0x93d8('0xc'));var fs=require('fs');var fs_extra=require(_0x93d8('0xd'));var _=require(_0x93d8('0xe'));var squel=require(_0x93d8('0xf'));var crypto=require('crypto');var jsforce=require(_0x93d8('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x93d8('0x11'));var Redis=require(_0x93d8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x93d8('0x13'));var as=require(_0x93d8('0x14'));var hardwareService=require(_0x93d8('0x15'));var logger=require(_0x93d8('0x16'))(_0x93d8('0x17'));var utils=require(_0x93d8('0x18'));var config=require(_0x93d8('0x19'));var licenseUtil=require(_0x93d8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7d70df,_0x3475aa){_0x3475aa=_0x3475aa||0xcc;return function(_0x289aa0){if(_0x289aa0){return _0x7d70df['sendStatus'](_0x3475aa);}return _0x7d70df[_0x93d8('0x1b')](_0x3475aa)[_0x93d8('0x1c')]();};}function respondWithResult(_0x2cef08,_0x590e15){_0x590e15=_0x590e15||0xc8;return function(_0x1df4d7){if(_0x1df4d7){return _0x2cef08['status'](_0x590e15)[_0x93d8('0x1d')](_0x1df4d7);}};}function respondWithFilteredResult(_0x40f5b1,_0x33faf1){return function(_0x36ed94){if(_0x36ed94){var _0x17ac3a=typeof _0x33faf1['offset']===_0x93d8('0x1e')&&typeof _0x33faf1[_0x93d8('0x1f')]===_0x93d8('0x1e');var _0x58ced7=_0x36ed94[_0x93d8('0x20')];var _0x3bfc18=_0x17ac3a?0x0:_0x33faf1['offset'];var _0x655226=_0x17ac3a?_0x36ed94[_0x93d8('0x20')]:_0x33faf1['offset']+_0x33faf1[_0x93d8('0x1f')];var _0x3ce362;if(_0x655226>=_0x58ced7){_0x655226=_0x58ced7;_0x3ce362=0xc8;}else{_0x3ce362=0xce;}_0x40f5b1['status'](_0x3ce362);return _0x40f5b1['set'](_0x93d8('0x21'),_0x3bfc18+'-'+_0x655226+'/'+_0x58ced7)[_0x93d8('0x1d')](_0x36ed94);}return null;};}function patchUpdates(_0x1927ba){return function(_0x55d337){try{jsonpatch[_0x93d8('0x22')](_0x55d337,_0x1927ba,!![]);}catch(_0x201e22){return BPromise[_0x93d8('0x23')](_0x201e22);}return _0x55d337['save']();};}function saveUpdates(_0x225d15,_0x5114ba){return function(_0x526309){if(_0x526309){return _0x526309[_0x93d8('0x24')](_0x225d15)[_0x93d8('0x25')](function(_0x396ded){return _0x396ded;});}return null;};}function removeEntity(_0x4ecc68,_0x74c113){return function(_0x47b9dd){if(_0x47b9dd){return _0x47b9dd['destroy']()['then'](function(){_0x4ecc68[_0x93d8('0x1b')](0xcc)[_0x93d8('0x1c')]();});}};}function handleEntityNotFound(_0xe0d371,_0x18e57a){return function(_0x2b0b2c){if(!_0x2b0b2c){_0xe0d371['sendStatus'](0x194);}return _0x2b0b2c;};}function handleError(_0x348188,_0x10310b){_0x10310b=_0x10310b||0x1f4;return function(_0x45769c){logger[_0x93d8('0x26')](_0x45769c['stack']);if(_0x45769c['name']){delete _0x45769c[_0x93d8('0x27')];}_0x348188[_0x93d8('0x1b')](_0x10310b)[_0x93d8('0x28')](_0x45769c);};}exports['index']=function(_0x3cb095,_0xe37e8c){var _0x3e1b33={},_0x3df3aa={},_0x5286ae={'count':0x0,'rows':[]};var _0x9f2bc=_['map'](db[_0x93d8('0x29')][_0x93d8('0x2a')],function(_0x3167df){return{'name':_0x3167df['fieldName'],'type':_0x3167df[_0x93d8('0x2b')][_0x93d8('0x2c')]};});_0x3df3aa['model']=_['map'](_0x9f2bc,_0x93d8('0x27'));_0x3df3aa['query']=_[_0x93d8('0x2d')](_0x3cb095[_0x93d8('0x2e')]);_0x3df3aa[_0x93d8('0x2f')]=_[_0x93d8('0x30')](_0x3df3aa['model'],_0x3df3aa[_0x93d8('0x2e')]);_0x3e1b33[_0x93d8('0x31')]=_[_0x93d8('0x30')](_0x3df3aa[_0x93d8('0x32')],qs['fields'](_0x3cb095['query'][_0x93d8('0x33')]));_0x3e1b33[_0x93d8('0x31')]=_0x3e1b33[_0x93d8('0x31')][_0x93d8('0x34')]?_0x3e1b33['attributes']:_0x3df3aa[_0x93d8('0x32')];if(!_0x3cb095[_0x93d8('0x2e')][_0x93d8('0x35')](_0x93d8('0x36'))){_0x3e1b33[_0x93d8('0x1f')]=qs['limit'](_0x3cb095['query']['limit']);_0x3e1b33['offset']=qs['offset'](_0x3cb095[_0x93d8('0x2e')]['offset']);}_0x3e1b33[_0x93d8('0x37')]=qs['sort'](_0x3cb095['query']['sort']);_0x3e1b33[_0x93d8('0x38')]=qs[_0x93d8('0x2f')](_[_0x93d8('0x39')](_0x3cb095[_0x93d8('0x2e')],_0x3df3aa['filters']),_0x9f2bc);if(_0x3cb095[_0x93d8('0x2e')][_0x93d8('0x3a')]){_0x3e1b33[_0x93d8('0x38')]=_[_0x93d8('0x3b')](_0x3e1b33[_0x93d8('0x38')],{'$or':_[_0x93d8('0x3c')](_0x9f2bc,function(_0x44f2bc){if(_0x44f2bc['type']!==_0x93d8('0x3d')){var _0x11c159={};_0x11c159[_0x44f2bc[_0x93d8('0x27')]]={'$like':'%'+_0x3cb095[_0x93d8('0x2e')][_0x93d8('0x3a')]+'%'};return _0x11c159;}})});}_0x3e1b33=_[_0x93d8('0x3b')]({},_0x3e1b33,_0x3cb095[_0x93d8('0x3e')]);var _0xccfaa8={'where':_0x3e1b33['where']};return db['FaxTransferReport'][_0x93d8('0x20')](_0xccfaa8)[_0x93d8('0x25')](function(_0x53e7b4){_0x5286ae[_0x93d8('0x20')]=_0x53e7b4;if(_0x3cb095[_0x93d8('0x2e')][_0x93d8('0x3f')]){_0x3e1b33['include']=[{'all':!![]}];}return db[_0x93d8('0x29')][_0x93d8('0x40')](_0x3e1b33);})[_0x93d8('0x25')](function(_0xec1fe5){_0x5286ae[_0x93d8('0x41')]=_0xec1fe5;return _0x5286ae;})[_0x93d8('0x25')](respondWithFilteredResult(_0xe37e8c,_0x3e1b33))[_0x93d8('0x42')](handleError(_0xe37e8c,null));};exports[_0x93d8('0x43')]=function(_0x3e4158,_0x5a8340){var _0xf732af={'raw':!![],'where':{'id':_0x3e4158[_0x93d8('0x44')]['id']}},_0xa48b6f={};_0xa48b6f[_0x93d8('0x32')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0xa48b6f[_0x93d8('0x2e')]=_[_0x93d8('0x2d')](_0x3e4158['query']);_0xa48b6f['filters']=_['intersection'](_0xa48b6f[_0x93d8('0x32')],_0xa48b6f[_0x93d8('0x2e')]);_0xf732af[_0x93d8('0x31')]=_[_0x93d8('0x30')](_0xa48b6f[_0x93d8('0x32')],qs[_0x93d8('0x33')](_0x3e4158[_0x93d8('0x2e')][_0x93d8('0x33')]));_0xf732af[_0x93d8('0x31')]=_0xf732af[_0x93d8('0x31')][_0x93d8('0x34')]?_0xf732af[_0x93d8('0x31')]:_0xa48b6f[_0x93d8('0x32')];if(_0x3e4158[_0x93d8('0x2e')][_0x93d8('0x3f')]){_0xf732af[_0x93d8('0x45')]=[{'all':!![]}];}_0xf732af=_[_0x93d8('0x3b')]({},_0xf732af,_0x3e4158[_0x93d8('0x3e')]);return db[_0x93d8('0x29')][_0x93d8('0x46')](_0xf732af)[_0x93d8('0x25')](handleEntityNotFound(_0x5a8340,null))[_0x93d8('0x25')](respondWithResult(_0x5a8340,null))[_0x93d8('0x42')](handleError(_0x5a8340,null));};exports[_0x93d8('0x47')]=function(_0xa55174,_0x4999cf){return db[_0x93d8('0x29')][_0x93d8('0x47')](_0xa55174['body'],{})[_0x93d8('0x25')](respondWithResult(_0x4999cf,0xc9))['catch'](handleError(_0x4999cf,null));};exports[_0x93d8('0x24')]=function(_0x34fcee,_0x759416){if(_0x34fcee['body']['id']){delete _0x34fcee[_0x93d8('0x48')]['id'];}return db[_0x93d8('0x29')][_0x93d8('0x46')]({'where':{'id':_0x34fcee['params']['id']}})[_0x93d8('0x25')](handleEntityNotFound(_0x759416,null))[_0x93d8('0x25')](saveUpdates(_0x34fcee[_0x93d8('0x48')],null))[_0x93d8('0x25')](respondWithResult(_0x759416,null))[_0x93d8('0x42')](handleError(_0x759416,null));};exports[_0x93d8('0x49')]=function(_0x523117,_0x20c8c2){return db[_0x93d8('0x29')]['find']({'where':{'id':_0x523117['params']['id']}})[_0x93d8('0x25')](handleEntityNotFound(_0x20c8c2,null))['then'](removeEntity(_0x20c8c2,null))['catch'](handleError(_0x20c8c2,null));};exports[_0x93d8('0x4a')]=function(_0x25f045,_0x1036cc){return db[_0x93d8('0x29')]['describe']()['then'](respondWithResult(_0x1036cc,null))['catch'](handleError(_0x1036cc,null));}; \ No newline at end of file +var _0x8d59=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FaxTransferReport','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error'];(function(_0x3ae5a0,_0x152aaf){var _0x47be8c=function(_0x27b074){while(--_0x27b074){_0x3ae5a0['push'](_0x3ae5a0['shift']());}};_0x47be8c(++_0x152aaf);}(_0x8d59,0x161));var _0x98d5=function(_0x362cfe,_0x161591){_0x362cfe=_0x362cfe-0x0;var _0x5aa4b4=_0x8d59[_0x362cfe];return _0x5aa4b4;};'use strict';var emlformat=require(_0x98d5('0x0'));var rimraf=require(_0x98d5('0x1'));var zipdir=require(_0x98d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x98d5('0x3'));var BPromise=require(_0x98d5('0x4'));var Mustache=require('mustache');var util=require(_0x98d5('0x5'));var path=require(_0x98d5('0x6'));var sox=require(_0x98d5('0x7'));var csv=require(_0x98d5('0x8'));var ejs=require(_0x98d5('0x9'));var fs=require('fs');var fs_extra=require(_0x98d5('0xa'));var _=require(_0x98d5('0xb'));var squel=require(_0x98d5('0xc'));var crypto=require(_0x98d5('0xd'));var jsforce=require(_0x98d5('0xe'));var deskjs=require(_0x98d5('0xf'));var toCsv=require(_0x98d5('0x8'));var querystring=require(_0x98d5('0x10'));var Papa=require('papaparse');var Redis=require(_0x98d5('0x11'));var authService=require(_0x98d5('0x12'));var qs=require(_0x98d5('0x13'));var as=require(_0x98d5('0x14'));var hardwareService=require(_0x98d5('0x15'));var logger=require(_0x98d5('0x16'))(_0x98d5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x98d5('0x18'));var db=require(_0x98d5('0x19'))['db'];function respondWithStatusCode(_0x117a9f,_0x4c31ac){_0x4c31ac=_0x4c31ac||0xcc;return function(_0x5c7c3d){if(_0x5c7c3d){return _0x117a9f[_0x98d5('0x1a')](_0x4c31ac);}return _0x117a9f[_0x98d5('0x1b')](_0x4c31ac)[_0x98d5('0x1c')]();};}function respondWithResult(_0x26fbfd,_0x412833){_0x412833=_0x412833||0xc8;return function(_0x2e6fda){if(_0x2e6fda){return _0x26fbfd[_0x98d5('0x1b')](_0x412833)[_0x98d5('0x1d')](_0x2e6fda);}};}function respondWithFilteredResult(_0xfc4811,_0x5c6156){return function(_0x419333){if(_0x419333){var _0x28bdd3=typeof _0x5c6156[_0x98d5('0x1e')]===_0x98d5('0x1f')&&typeof _0x5c6156[_0x98d5('0x20')]===_0x98d5('0x1f');var _0x65021a=_0x419333[_0x98d5('0x21')];var _0x34a2d6=_0x28bdd3?0x0:_0x5c6156[_0x98d5('0x1e')];var _0x1c537e=_0x28bdd3?_0x419333['count']:_0x5c6156['offset']+_0x5c6156[_0x98d5('0x20')];var _0x41efc4;if(_0x1c537e>=_0x65021a){_0x1c537e=_0x65021a;_0x41efc4=0xc8;}else{_0x41efc4=0xce;}_0xfc4811[_0x98d5('0x1b')](_0x41efc4);return _0xfc4811[_0x98d5('0x22')]('Content-Range',_0x34a2d6+'-'+_0x1c537e+'/'+_0x65021a)['json'](_0x419333);}return null;};}function patchUpdates(_0x41c712){return function(_0x168144){try{jsonpatch[_0x98d5('0x23')](_0x168144,_0x41c712,!![]);}catch(_0x42aa65){return BPromise[_0x98d5('0x24')](_0x42aa65);}return _0x168144[_0x98d5('0x25')]();};}function saveUpdates(_0x4aa558,_0x4fb729){return function(_0x140e4c){if(_0x140e4c){return _0x140e4c[_0x98d5('0x26')](_0x4aa558)[_0x98d5('0x27')](function(_0xe90de2){return _0xe90de2;});}return null;};}function removeEntity(_0x2397f9,_0x382083){return function(_0x5d3081){if(_0x5d3081){return _0x5d3081[_0x98d5('0x28')]()[_0x98d5('0x27')](function(){_0x2397f9[_0x98d5('0x1b')](0xcc)[_0x98d5('0x1c')]();});}};}function handleEntityNotFound(_0x288d4f,_0x1c002c){return function(_0x1f8cf6){if(!_0x1f8cf6){_0x288d4f[_0x98d5('0x1a')](0x194);}return _0x1f8cf6;};}function handleError(_0x5ddcb9,_0x3500ab){_0x3500ab=_0x3500ab||0x1f4;return function(_0x28b0c2){logger[_0x98d5('0x29')](_0x28b0c2[_0x98d5('0x2a')]);if(_0x28b0c2[_0x98d5('0x2b')]){delete _0x28b0c2[_0x98d5('0x2b')];}_0x5ddcb9[_0x98d5('0x1b')](_0x3500ab)[_0x98d5('0x2c')](_0x28b0c2);};}exports[_0x98d5('0x2d')]=function(_0x3ea3ef,_0x37257){var _0x1ecce0={},_0x2c8d1b={},_0x5cab05={'count':0x0,'rows':[]};var _0xe1d075=_[_0x98d5('0x2e')](db['FaxTransferReport'][_0x98d5('0x2f')],function(_0x2e797b){return{'name':_0x2e797b[_0x98d5('0x30')],'type':_0x2e797b[_0x98d5('0x31')][_0x98d5('0x32')]};});_0x2c8d1b[_0x98d5('0x33')]=_[_0x98d5('0x2e')](_0xe1d075,_0x98d5('0x2b'));_0x2c8d1b[_0x98d5('0x34')]=_[_0x98d5('0x35')](_0x3ea3ef['query']);_0x2c8d1b[_0x98d5('0x36')]=_['intersection'](_0x2c8d1b[_0x98d5('0x33')],_0x2c8d1b['query']);_0x1ecce0['attributes']=_[_0x98d5('0x37')](_0x2c8d1b[_0x98d5('0x33')],qs[_0x98d5('0x38')](_0x3ea3ef[_0x98d5('0x34')][_0x98d5('0x38')]));_0x1ecce0['attributes']=_0x1ecce0[_0x98d5('0x39')][_0x98d5('0x3a')]?_0x1ecce0[_0x98d5('0x39')]:_0x2c8d1b[_0x98d5('0x33')];if(!_0x3ea3ef['query'][_0x98d5('0x3b')](_0x98d5('0x3c'))){_0x1ecce0[_0x98d5('0x20')]=qs[_0x98d5('0x20')](_0x3ea3ef[_0x98d5('0x34')]['limit']);_0x1ecce0[_0x98d5('0x1e')]=qs[_0x98d5('0x1e')](_0x3ea3ef[_0x98d5('0x34')][_0x98d5('0x1e')]);}_0x1ecce0[_0x98d5('0x3d')]=qs['sort'](_0x3ea3ef[_0x98d5('0x34')][_0x98d5('0x3e')]);_0x1ecce0[_0x98d5('0x3f')]=qs[_0x98d5('0x36')](_[_0x98d5('0x40')](_0x3ea3ef[_0x98d5('0x34')],_0x2c8d1b[_0x98d5('0x36')]),_0xe1d075);if(_0x3ea3ef[_0x98d5('0x34')][_0x98d5('0x41')]){_0x1ecce0[_0x98d5('0x3f')]=_[_0x98d5('0x42')](_0x1ecce0[_0x98d5('0x3f')],{'$or':_[_0x98d5('0x2e')](_0xe1d075,function(_0x25422a){if(_0x25422a[_0x98d5('0x31')]!=='VIRTUAL'){var _0x329d48={};_0x329d48[_0x25422a['name']]={'$like':'%'+_0x3ea3ef['query'][_0x98d5('0x41')]+'%'};return _0x329d48;}})});}_0x1ecce0=_[_0x98d5('0x42')]({},_0x1ecce0,_0x3ea3ef[_0x98d5('0x43')]);var _0x2ecb18={'where':_0x1ecce0['where']};return db[_0x98d5('0x44')][_0x98d5('0x21')](_0x2ecb18)['then'](function(_0x15a0e2){_0x5cab05[_0x98d5('0x21')]=_0x15a0e2;if(_0x3ea3ef[_0x98d5('0x34')][_0x98d5('0x45')]){_0x1ecce0['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x98d5('0x46')](_0x1ecce0);})[_0x98d5('0x27')](function(_0x342e45){_0x5cab05[_0x98d5('0x47')]=_0x342e45;return _0x5cab05;})[_0x98d5('0x27')](respondWithFilteredResult(_0x37257,_0x1ecce0))[_0x98d5('0x48')](handleError(_0x37257,null));};exports[_0x98d5('0x49')]=function(_0x2f64e4,_0x121805){var _0xd3dace={'raw':!![],'where':{'id':_0x2f64e4[_0x98d5('0x4a')]['id']}},_0x432a84={};_0x432a84[_0x98d5('0x33')]=_[_0x98d5('0x35')](db['FaxTransferReport'][_0x98d5('0x2f')]);_0x432a84['query']=_[_0x98d5('0x35')](_0x2f64e4[_0x98d5('0x34')]);_0x432a84[_0x98d5('0x36')]=_[_0x98d5('0x37')](_0x432a84[_0x98d5('0x33')],_0x432a84[_0x98d5('0x34')]);_0xd3dace[_0x98d5('0x39')]=_[_0x98d5('0x37')](_0x432a84[_0x98d5('0x33')],qs[_0x98d5('0x38')](_0x2f64e4['query'][_0x98d5('0x38')]));_0xd3dace[_0x98d5('0x39')]=_0xd3dace[_0x98d5('0x39')]['length']?_0xd3dace[_0x98d5('0x39')]:_0x432a84[_0x98d5('0x33')];if(_0x2f64e4[_0x98d5('0x34')][_0x98d5('0x45')]){_0xd3dace['include']=[{'all':!![]}];}_0xd3dace=_['merge']({},_0xd3dace,_0x2f64e4['options']);return db[_0x98d5('0x44')][_0x98d5('0x4b')](_0xd3dace)[_0x98d5('0x27')](handleEntityNotFound(_0x121805,null))[_0x98d5('0x27')](respondWithResult(_0x121805,null))[_0x98d5('0x48')](handleError(_0x121805,null));};exports[_0x98d5('0x4c')]=function(_0x497e59,_0x4044ad){return db[_0x98d5('0x44')]['create'](_0x497e59[_0x98d5('0x4d')],{})[_0x98d5('0x27')](respondWithResult(_0x4044ad,0xc9))[_0x98d5('0x48')](handleError(_0x4044ad,null));};exports[_0x98d5('0x26')]=function(_0x678df2,_0x282c6c){if(_0x678df2[_0x98d5('0x4d')]['id']){delete _0x678df2['body']['id'];}return db[_0x98d5('0x44')][_0x98d5('0x4b')]({'where':{'id':_0x678df2[_0x98d5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x282c6c,null))[_0x98d5('0x27')](saveUpdates(_0x678df2[_0x98d5('0x4d')],null))[_0x98d5('0x27')](respondWithResult(_0x282c6c,null))[_0x98d5('0x48')](handleError(_0x282c6c,null));};exports[_0x98d5('0x28')]=function(_0xc7b249,_0xce098){return db[_0x98d5('0x44')][_0x98d5('0x4b')]({'where':{'id':_0xc7b249[_0x98d5('0x4a')]['id']}})[_0x98d5('0x27')](handleEntityNotFound(_0xce098,null))['then'](removeEntity(_0xce098,null))['catch'](handleError(_0xce098,null));};exports[_0x98d5('0x4e')]=function(_0x46e9ca,_0xac43b1){return db[_0x98d5('0x44')][_0x98d5('0x4e')]()[_0x98d5('0x27')](respondWithResult(_0xac43b1,null))['catch'](handleError(_0xac43b1,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1b8284e..1a355d7 100644 --- a/server/api/faxTransferReport/faxTransferReport.model.js +++ b/server/api/faxTransferReport/faxTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b8f=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x45fc92,_0x28871a){var _0x572b13=function(_0x5e24b5){while(--_0x5e24b5){_0x45fc92['push'](_0x45fc92['shift']());}};_0x572b13(++_0x28871a);}(_0x7b8f,0x1cb));var _0xf7b8=function(_0x5e67f6,_0x44ef4b){_0x5e67f6=_0x5e67f6-0x0;var _0x48011e=_0x7b8f[_0x5e67f6];return _0x48011e;};'use strict';var _=require(_0xf7b8('0x0'));var util=require(_0xf7b8('0x1'));var logger=require(_0xf7b8('0x2'))(_0xf7b8('0x3'));var moment=require(_0xf7b8('0x4'));var BPromise=require(_0xf7b8('0x5'));var rp=require(_0xf7b8('0x6'));var fs=require('fs');var path=require(_0xf7b8('0x7'));var rimraf=require(_0xf7b8('0x8'));var config=require(_0xf7b8('0x9'));var attributes=require(_0xf7b8('0xa'));module[_0xf7b8('0xb')]=function(_0xa6e52e,_0x123ff6){return _0xa6e52e['define'](_0xf7b8('0xc'),attributes,{'tableName':_0xf7b8('0xd'),'paranoid':![],'indexes':[{'name':_0xf7b8('0xe'),'fields':[_0xf7b8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2b=['exports','define','FaxTransferReport','report_fax_transfer','lodash','util','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x410612,_0x551c48){var _0xbfa860=function(_0x4fb412){while(--_0x4fb412){_0x410612['push'](_0x410612['shift']());}};_0xbfa860(++_0x551c48);}(_0x7a2b,0x7c));var _0xb7a2=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7a2b[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xb7a2('0x0'));var util=require(_0xb7a2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb7a2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7a2('0x3'));var config=require(_0xb7a2('0x4'));var attributes=require(_0xb7a2('0x5'));module[_0xb7a2('0x6')]=function(_0x2cdf6d,_0x1d5fd0){return _0x2cdf6d[_0xb7a2('0x7')](_0xb7a2('0x8'),attributes,{'tableName':_0xb7a2('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index e54f8fa..8c65e4a 100644 --- a/server/api/faxTransferReport/faxTransferReport.rpc.js +++ b/server/api/faxTransferReport/faxTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8aa=['stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1d60b3,_0x65a805){var _0x2c5d8c=function(_0x4a252f){while(--_0x4a252f){_0x1d60b3['push'](_0x1d60b3['shift']());}};_0x2c5d8c(++_0x65a805);}(_0xf8aa,0xde));var _0xaf8a=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xf8aa[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xaf8a('0x0'));var util=require(_0xaf8a('0x1'));var moment=require(_0xaf8a('0x2'));var BPromise=require(_0xaf8a('0x3'));var rs=require(_0xaf8a('0x4'));var fs=require('fs');var Redis=require(_0xaf8a('0x5'));var db=require(_0xaf8a('0x6'))['db'];var utils=require(_0xaf8a('0x7'));var logger=require('../../config/logger')(_0xaf8a('0x8'));var config=require(_0xaf8a('0x9'));var jayson=require(_0xaf8a('0xa'));var client=jayson['client'][_0xaf8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cd93f,_0x39f337,_0x2811e6){return new BPromise(function(_0x201170,_0x262a06){return client[_0xaf8a('0xc')](_0x2cd93f,_0x2811e6)[_0xaf8a('0xd')](function(_0x1ec516){logger['info'](_0xaf8a('0xe'),_0x39f337,_0xaf8a('0xf'));logger[_0xaf8a('0x10')](_0xaf8a('0x11'),_0x39f337,_0xaf8a('0xf'),JSON[_0xaf8a('0x12')](_0x1ec516));if(_0x1ec516[_0xaf8a('0x13')]){if(_0x1ec516[_0xaf8a('0x13')][_0xaf8a('0x14')]===0x1f4){logger['error'](_0xaf8a('0xe'),_0x39f337,_0x1ec516[_0xaf8a('0x13')][_0xaf8a('0x15')]);return _0x262a06(_0x1ec516[_0xaf8a('0x13')][_0xaf8a('0x15')]);}logger['error'](_0xaf8a('0xe'),_0x39f337,_0x1ec516['error'][_0xaf8a('0x15')]);return _0x201170(_0x1ec516[_0xaf8a('0x13')][_0xaf8a('0x15')]);}else{logger[_0xaf8a('0x16')](_0xaf8a('0xe'),_0x39f337,_0xaf8a('0xf'));_0x201170(_0x1ec516['result'][_0xaf8a('0x15')]);}})[_0xaf8a('0x17')](function(_0x344cce){logger['error'](_0xaf8a('0xe'),_0x39f337,_0x344cce);_0x262a06(_0x344cce);});});} \ No newline at end of file +var _0xce2d=['jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1c5e6d,_0x4044a7){var _0x370758=function(_0x3f28e8){while(--_0x3f28e8){_0x1c5e6d['push'](_0x1c5e6d['shift']());}};_0x370758(++_0x4044a7);}(_0xce2d,0x19f));var _0xdce2=function(_0xe2b0bb,_0x1e6266){_0xe2b0bb=_0xe2b0bb-0x0;var _0x25ea3d=_0xce2d[_0xe2b0bb];return _0x25ea3d;};'use strict';var _=require(_0xdce2('0x0'));var util=require(_0xdce2('0x1'));var moment=require(_0xdce2('0x2'));var BPromise=require(_0xdce2('0x3'));var rs=require(_0xdce2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdce2('0x5'))['db'];var utils=require(_0xdce2('0x6'));var logger=require(_0xdce2('0x7'))(_0xdce2('0x8'));var config=require(_0xdce2('0x9'));var jayson=require(_0xdce2('0xa'));var client=jayson[_0xdce2('0xb')][_0xdce2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20b324,_0x599c0d,_0x70c862){return new BPromise(function(_0x93a10b,_0x493919){return client[_0xdce2('0xd')](_0x20b324,_0x70c862)[_0xdce2('0xe')](function(_0x38bad8){logger[_0xdce2('0xf')](_0xdce2('0x10'),_0x599c0d,_0xdce2('0x11'));logger['debug'](_0xdce2('0x12'),_0x599c0d,'request\x20sent',JSON[_0xdce2('0x13')](_0x38bad8));if(_0x38bad8[_0xdce2('0x14')]){if(_0x38bad8[_0xdce2('0x14')][_0xdce2('0x15')]===0x1f4){logger[_0xdce2('0x14')](_0xdce2('0x10'),_0x599c0d,_0x38bad8[_0xdce2('0x14')]['message']);return _0x493919(_0x38bad8[_0xdce2('0x14')][_0xdce2('0x16')]);}logger[_0xdce2('0x14')](_0xdce2('0x10'),_0x599c0d,_0x38bad8[_0xdce2('0x14')][_0xdce2('0x16')]);return _0x93a10b(_0x38bad8['error']['message']);}else{logger[_0xdce2('0xf')](_0xdce2('0x10'),_0x599c0d,_0xdce2('0x11'));_0x93a10b(_0x38bad8[_0xdce2('0x17')]['message']);}})[_0xdce2('0x18')](function(_0x5aa817){logger[_0xdce2('0x14')](_0xdce2('0x10'),_0x599c0d,_0x5aa817);_0x493919(_0x5aa817);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index ff1bb4b..a7c81a3 100644 --- a/server/api/faxTransferReport/index.js +++ b/server/api/faxTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc9a=['describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','/describe'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdc9a,0x185));var _0xadc9=function(_0x41f239,_0x2141fe){_0x41f239=_0x41f239-0x0;var _0x3e6ce7=_0xdc9a[_0x41f239];return _0x3e6ce7;};'use strict';var multer=require(_0xadc9('0x0'));var util=require('util');var path=require(_0xadc9('0x1'));var timeout=require(_0xadc9('0x2'));var express=require('express');var router=express[_0xadc9('0x3')]();var fs_extra=require(_0xadc9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xadc9('0x5'));var controller=require(_0xadc9('0x6'));router['get']('/',auth[_0xadc9('0x7')](),controller[_0xadc9('0x8')]);router['get'](_0xadc9('0x9'),auth[_0xadc9('0x7')](),controller[_0xadc9('0xa')]);router['get'](_0xadc9('0xb'),auth['isAuthenticated'](),controller[_0xadc9('0xc')]);router[_0xadc9('0xd')]('/',auth[_0xadc9('0x7')](),controller[_0xadc9('0xe')]);router[_0xadc9('0xf')](_0xadc9('0xb'),auth[_0xadc9('0x7')](),controller[_0xadc9('0x10')]);router[_0xadc9('0x11')](_0xadc9('0xb'),auth[_0xadc9('0x7')](),controller['destroy']);module[_0xadc9('0x12')]=router; \ No newline at end of file +var _0x5026=['/describe','describe','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5026,0xdc));var _0x6502=function(_0x2e20b6,_0x370595){_0x2e20b6=_0x2e20b6-0x0;var _0x876b19=_0x5026[_0x2e20b6];return _0x876b19;};'use strict';var multer=require(_0x6502('0x0'));var util=require(_0x6502('0x1'));var path=require(_0x6502('0x2'));var timeout=require(_0x6502('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6502('0x4'));var auth=require(_0x6502('0x5'));var interaction=require(_0x6502('0x6'));var config=require(_0x6502('0x7'));var controller=require(_0x6502('0x8'));router[_0x6502('0x9')]('/',auth[_0x6502('0xa')](),controller['index']);router[_0x6502('0x9')](_0x6502('0xb'),auth['isAuthenticated'](),controller[_0x6502('0xc')]);router[_0x6502('0x9')]('/:id',auth[_0x6502('0xa')](),controller[_0x6502('0xd')]);router[_0x6502('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6502('0xf')]('/:id',auth[_0x6502('0xa')](),controller[_0x6502('0x10')]);router[_0x6502('0x11')](_0x6502('0x12'),auth[_0x6502('0xa')](),controller[_0x6502('0x13')]);module[_0x6502('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 998bec2..841effd 100644 --- a/server/api/intDeskAccount/index.js +++ b/server/api/intDeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9432=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/fields','post','create','addConfiguration','put','update','delete','exports','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9432,0x117));var _0x2943=function(_0x5e667d,_0x453828){_0x5e667d=_0x5e667d-0x0;var _0x3a7dad=_0x9432[_0x5e667d];return _0x3a7dad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2943('0x0'));var timeout=require(_0x2943('0x1'));var express=require('express');var router=express[_0x2943('0x2')]();var fs_extra=require(_0x2943('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2943('0x4'));var config=require(_0x2943('0x5'));var controller=require(_0x2943('0x6'));router['get']('/',auth[_0x2943('0x7')](),controller[_0x2943('0x8')]);router[_0x2943('0x9')](_0x2943('0xa'),auth['isAuthenticated'](),controller[_0x2943('0xb')]);router[_0x2943('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2943('0x9')](_0x2943('0xc'),auth[_0x2943('0x7')](),controller['getFields']);router[_0x2943('0xd')]('/',auth[_0x2943('0x7')](),controller[_0x2943('0xe')]);router[_0x2943('0xd')]('/:id/configurations',auth[_0x2943('0x7')](),controller[_0x2943('0xf')]);router[_0x2943('0x10')](_0x2943('0xa'),auth[_0x2943('0x7')](),controller[_0x2943('0x11')]);router[_0x2943('0x12')]('/:id',auth[_0x2943('0x7')](),controller['destroy']);module[_0x2943('0x13')]=router; \ No newline at end of file +var _0x56ee=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x56ee,0x1d2));var _0xe56e=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x56ee[_0x3457b4];return _0xaa8fa9;};'use strict';var multer=require(_0xe56e('0x0'));var util=require(_0xe56e('0x1'));var path=require(_0xe56e('0x2'));var timeout=require(_0xe56e('0x3'));var express=require('express');var router=express[_0xe56e('0x4')]();var fs_extra=require(_0xe56e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe56e('0x6'));var config=require(_0xe56e('0x7'));var controller=require(_0xe56e('0x8'));router[_0xe56e('0x9')]('/',auth[_0xe56e('0xa')](),controller[_0xe56e('0xb')]);router[_0xe56e('0x9')](_0xe56e('0xc'),auth[_0xe56e('0xa')](),controller[_0xe56e('0xd')]);router[_0xe56e('0x9')](_0xe56e('0xe'),auth[_0xe56e('0xa')](),controller[_0xe56e('0xf')]);router[_0xe56e('0x9')](_0xe56e('0x10'),auth[_0xe56e('0xa')](),controller[_0xe56e('0x11')]);router[_0xe56e('0x12')]('/',auth[_0xe56e('0xa')](),controller[_0xe56e('0x13')]);router[_0xe56e('0x12')](_0xe56e('0xe'),auth[_0xe56e('0xa')](),controller[_0xe56e('0x14')]);router[_0xe56e('0x15')](_0xe56e('0xc'),auth['isAuthenticated'](),controller[_0xe56e('0x16')]);router[_0xe56e('0x17')](_0xe56e('0xc'),auth[_0xe56e('0xa')](),controller[_0xe56e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index f7753e8..fe3e7dd 100644 --- a/server/api/intDeskAccount/intDeskAccount.attributes.js +++ b/server/api/intDeskAccount/intDeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecf2=['integrationTab','newTab','sequelize','STRING','basic','ENUM'];(function(_0x3de39e,_0x3467c1){var _0x5be091=function(_0x1cdd65){while(--_0x1cdd65){_0x3de39e['push'](_0x3de39e['shift']());}};_0x5be091(++_0x3467c1);}(_0xecf2,0xc8));var _0x2ecf=function(_0x703ebb,_0x5b8345){_0x703ebb=_0x703ebb-0x0;var _0x25ab61=_0xecf2[_0x703ebb];return _0x25ab61;};'use strict';var Sequelize=require(_0x2ecf('0x0'));module['exports']={'name':{'type':Sequelize[_0x2ecf('0x1')]},'description':{'type':Sequelize[_0x2ecf('0x1')]},'username':{'type':Sequelize[_0x2ecf('0x1')]},'remoteUri':{'type':Sequelize[_0x2ecf('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x2ecf('0x2')),'defaultValue':_0x2ecf('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x2ecf('0x1')]},'token':{'type':Sequelize[_0x2ecf('0x1')]},'tokenSecret':{'type':Sequelize[_0x2ecf('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2ecf('0x3')](_0x2ecf('0x4'),_0x2ecf('0x5')),'defaultValue':_0x2ecf('0x4')}}; \ No newline at end of file +var _0x4299=['integrationTab','sequelize','exports','STRING','basic'];(function(_0x330513,_0x596cc2){var _0x3fca6e=function(_0x22e58a){while(--_0x22e58a){_0x330513['push'](_0x330513['shift']());}};_0x3fca6e(++_0x596cc2);}(_0x4299,0x169));var _0x9429=function(_0x452f55,_0x2b6e72){_0x452f55=_0x452f55-0x0;var _0x253456=_0x4299[_0x452f55];return _0x253456;};'use strict';var Sequelize=require(_0x9429('0x0'));module[_0x9429('0x1')]={'name':{'type':Sequelize[_0x9429('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9429('0x2')]},'remoteUri':{'type':Sequelize[_0x9429('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x9429('0x3')),'defaultValue':_0x9429('0x3')},'password':{'type':Sequelize[_0x9429('0x2')]},'consumerKey':{'type':Sequelize[_0x9429('0x2')]},'consumerSecret':{'type':Sequelize[_0x9429('0x2')]},'token':{'type':Sequelize[_0x9429('0x2')]},'tokenSecret':{'type':Sequelize[_0x9429('0x2')]},'serverUrl':{'type':Sequelize[_0x9429('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x9429('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 8a9c71d..fca51d1 100644 --- a/server/api/intDeskAccount/intDeskAccount.controller.js +++ b/server/api/intDeskAccount/intDeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad5a=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','getConfigurations','findOne','DeskConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskField','priority','authType','password','consumerKey','consumerSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username','toString','base64','_embedded','entries','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x15f276,_0x2fd123){var _0x42172f=function(_0x3d4731){while(--_0x3d4731){_0x15f276['push'](_0x15f276['shift']());}};_0x42172f(++_0x2fd123);}(_0xad5a,0x1d0));var _0xaad5=function(_0xe3fdc3,_0x24be22){_0xe3fdc3=_0xe3fdc3-0x0;var _0x2eb091=_0xad5a[_0xe3fdc3];return _0x2eb091;};'use strict';var emlformat=require(_0xaad5('0x0'));var rimraf=require(_0xaad5('0x1'));var zipdir=require(_0xaad5('0x2'));var jsonpatch=require(_0xaad5('0x3'));var rp=require(_0xaad5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaad5('0x5'));var util=require(_0xaad5('0x6'));var path=require(_0xaad5('0x7'));var sox=require(_0xaad5('0x8'));var csv=require('to-csv');var ejs=require(_0xaad5('0x9'));var fs=require('fs');var fs_extra=require(_0xaad5('0xa'));var _=require(_0xaad5('0xb'));var squel=require(_0xaad5('0xc'));var crypto=require(_0xaad5('0xd'));var jsforce=require(_0xaad5('0xe'));var deskjs=require(_0xaad5('0xf'));var toCsv=require(_0xaad5('0x10'));var querystring=require(_0xaad5('0x11'));var Papa=require(_0xaad5('0x12'));var Redis=require('ioredis');var authService=require(_0xaad5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaad5('0x14'));var hardwareService=require(_0xaad5('0x15'));var logger=require(_0xaad5('0x16'))(_0xaad5('0x17'));var utils=require(_0xaad5('0x18'));var config=require(_0xaad5('0x19'));var licenseUtil=require(_0xaad5('0x1a'));var db=require(_0xaad5('0x1b'))['db'];var integrations=require(_0xaad5('0x1c'));function respondWithStatusCode(_0xdead0d,_0x413af0){_0x413af0=_0x413af0||0xcc;return function(_0xaac18e){if(_0xaac18e){return _0xdead0d['sendStatus'](_0x413af0);}return _0xdead0d['status'](_0x413af0)[_0xaad5('0x1d')]();};}function respondWithResult(_0x3e0d32,_0x4956fb){_0x4956fb=_0x4956fb||0xc8;return function(_0x5e9bba){if(_0x5e9bba){return _0x3e0d32[_0xaad5('0x1e')](_0x4956fb)['json'](_0x5e9bba);}};}function respondWithFilteredResult(_0x4ea656,_0xa07185){return function(_0x4c822c){if(_0x4c822c){var _0xbfa44a=typeof _0xa07185[_0xaad5('0x1f')]==='undefined'&&typeof _0xa07185['limit']===_0xaad5('0x20');var _0x1d0436=_0x4c822c[_0xaad5('0x21')];var _0x21981a=_0xbfa44a?0x0:_0xa07185[_0xaad5('0x1f')];var _0x3f6f98=_0xbfa44a?_0x4c822c[_0xaad5('0x21')]:_0xa07185[_0xaad5('0x1f')]+_0xa07185[_0xaad5('0x22')];var _0x26560a;if(_0x3f6f98>=_0x1d0436){_0x3f6f98=_0x1d0436;_0x26560a=0xc8;}else{_0x26560a=0xce;}_0x4ea656['status'](_0x26560a);return _0x4ea656[_0xaad5('0x23')](_0xaad5('0x24'),_0x21981a+'-'+_0x3f6f98+'/'+_0x1d0436)[_0xaad5('0x25')](_0x4c822c);}return null;};}function patchUpdates(_0x46c8d0){return function(_0x35ad7f){try{jsonpatch[_0xaad5('0x26')](_0x35ad7f,_0x46c8d0,!![]);}catch(_0x3d3c06){return BPromise['reject'](_0x3d3c06);}return _0x35ad7f[_0xaad5('0x27')]();};}function saveUpdates(_0x3e18a1,_0x3ade6a){return function(_0x36f25f){if(_0x36f25f){return _0x36f25f[_0xaad5('0x28')](_0x3e18a1)['then'](function(_0x38f145){return _0x38f145;});}return null;};}function removeEntity(_0x65c224,_0x4bd163){return function(_0x29006a){if(_0x29006a){return _0x29006a[_0xaad5('0x29')]()[_0xaad5('0x2a')](function(){_0x65c224[_0xaad5('0x1e')](0xcc)[_0xaad5('0x1d')]();});}};}function handleEntityNotFound(_0x2f9f5c,_0x27c91c){return function(_0x21ba54){if(!_0x21ba54){_0x2f9f5c[_0xaad5('0x2b')](0x194);}return _0x21ba54;};}function handleError(_0x326d6b,_0x4f0772){_0x4f0772=_0x4f0772||0x1f4;return function(_0x302014){logger[_0xaad5('0x2c')](_0x302014[_0xaad5('0x2d')]);if(_0x302014[_0xaad5('0x2e')]){delete _0x302014['name'];}_0x326d6b[_0xaad5('0x1e')](_0x4f0772)['send'](_0x302014);};}exports[_0xaad5('0x2f')]=function(_0x160eea,_0x285de3){var _0x51d7fd={},_0xf667e4={},_0x5ab7c5={'count':0x0,'rows':[]};var _0x34d86e=_[_0xaad5('0x30')](db[_0xaad5('0x31')][_0xaad5('0x32')],function(_0x3c71e3){return{'name':_0x3c71e3[_0xaad5('0x33')],'type':_0x3c71e3['type'][_0xaad5('0x34')]};});_0xf667e4[_0xaad5('0x35')]=_[_0xaad5('0x30')](_0x34d86e,_0xaad5('0x2e'));_0xf667e4[_0xaad5('0x36')]=_['keys'](_0x160eea['query']);_0xf667e4[_0xaad5('0x37')]=_['intersection'](_0xf667e4[_0xaad5('0x35')],_0xf667e4[_0xaad5('0x36')]);_0x51d7fd['attributes']=_[_0xaad5('0x38')](_0xf667e4['model'],qs[_0xaad5('0x39')](_0x160eea[_0xaad5('0x36')][_0xaad5('0x39')]));_0x51d7fd[_0xaad5('0x3a')]=_0x51d7fd[_0xaad5('0x3a')]['length']?_0x51d7fd[_0xaad5('0x3a')]:_0xf667e4[_0xaad5('0x35')];if(!_0x160eea['query'][_0xaad5('0x3b')](_0xaad5('0x3c'))){_0x51d7fd['limit']=qs['limit'](_0x160eea[_0xaad5('0x36')][_0xaad5('0x22')]);_0x51d7fd[_0xaad5('0x1f')]=qs[_0xaad5('0x1f')](_0x160eea[_0xaad5('0x36')][_0xaad5('0x1f')]);}_0x51d7fd[_0xaad5('0x3d')]=qs['sort'](_0x160eea['query']['sort']);_0x51d7fd[_0xaad5('0x3e')]=qs[_0xaad5('0x37')](_[_0xaad5('0x3f')](_0x160eea['query'],_0xf667e4['filters']),_0x34d86e);if(_0x160eea['query']['filter']){_0x51d7fd[_0xaad5('0x3e')]=_[_0xaad5('0x40')](_0x51d7fd[_0xaad5('0x3e')],{'$or':_[_0xaad5('0x30')](_0x34d86e,function(_0x6fe090){if(_0x6fe090['type']!==_0xaad5('0x41')){var _0x385982={};_0x385982[_0x6fe090[_0xaad5('0x2e')]]={'$like':'%'+_0x160eea[_0xaad5('0x36')]['filter']+'%'};return _0x385982;}})});}_0x51d7fd=_[_0xaad5('0x40')]({},_0x51d7fd,_0x160eea[_0xaad5('0x42')]);var _0x1dc6b4={'where':_0x51d7fd[_0xaad5('0x3e')]};return db[_0xaad5('0x31')]['count'](_0x1dc6b4)[_0xaad5('0x2a')](function(_0x424660){_0x5ab7c5[_0xaad5('0x21')]=_0x424660;if(_0x160eea['query'][_0xaad5('0x43')]){_0x51d7fd[_0xaad5('0x44')]=[{'all':!![]}];}return db['DeskAccount'][_0xaad5('0x45')](_0x51d7fd);})[_0xaad5('0x2a')](function(_0x21298f){_0x5ab7c5[_0xaad5('0x46')]=_0x21298f;return _0x5ab7c5;})[_0xaad5('0x2a')](respondWithFilteredResult(_0x285de3,_0x51d7fd))[_0xaad5('0x47')](handleError(_0x285de3,null));};exports[_0xaad5('0x48')]=function(_0x4f2641,_0x4c60e8){var _0xc0a6bb={'raw':![],'where':{'id':_0x4f2641[_0xaad5('0x49')]['id']}},_0x4ed8b9={};_0x4ed8b9[_0xaad5('0x35')]=_[_0xaad5('0x4a')](db['DeskAccount'][_0xaad5('0x32')]);_0x4ed8b9[_0xaad5('0x36')]=_[_0xaad5('0x4a')](_0x4f2641['query']);_0x4ed8b9[_0xaad5('0x37')]=_[_0xaad5('0x38')](_0x4ed8b9[_0xaad5('0x35')],_0x4ed8b9[_0xaad5('0x36')]);_0xc0a6bb['attributes']=_[_0xaad5('0x38')](_0x4ed8b9[_0xaad5('0x35')],qs[_0xaad5('0x39')](_0x4f2641[_0xaad5('0x36')]['fields']));_0xc0a6bb[_0xaad5('0x3a')]=_0xc0a6bb[_0xaad5('0x3a')][_0xaad5('0x4b')]?_0xc0a6bb[_0xaad5('0x3a')]:_0x4ed8b9['model'];if(_0x4f2641[_0xaad5('0x36')]['includeAll']){_0xc0a6bb[_0xaad5('0x44')]=[{'all':!![]}];}_0xc0a6bb=_[_0xaad5('0x40')]({},_0xc0a6bb,_0x4f2641[_0xaad5('0x42')]);return db['DeskAccount'][_0xaad5('0x4c')](_0xc0a6bb)[_0xaad5('0x2a')](handleEntityNotFound(_0x4c60e8,null))[_0xaad5('0x2a')](respondWithResult(_0x4c60e8,null))[_0xaad5('0x47')](handleError(_0x4c60e8,null));};exports[_0xaad5('0x4d')]=function(_0x464b8d,_0x176d54){return db[_0xaad5('0x31')][_0xaad5('0x4d')](_0x464b8d[_0xaad5('0x4e')],{})['then'](respondWithResult(_0x176d54,0xc9))[_0xaad5('0x47')](handleError(_0x176d54,null));};exports['update']=function(_0xa0ed61,_0x10d780){if(_0xa0ed61[_0xaad5('0x4e')]['id']){delete _0xa0ed61['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0xa0ed61[_0xaad5('0x49')]['id']}})[_0xaad5('0x2a')](handleEntityNotFound(_0x10d780,null))[_0xaad5('0x2a')](saveUpdates(_0xa0ed61['body'],null))[_0xaad5('0x2a')](respondWithResult(_0x10d780,null))['catch'](handleError(_0x10d780,null));};exports[_0xaad5('0x29')]=function(_0x1b090b,_0x2086ea){return db['DeskAccount'][_0xaad5('0x4c')]({'where':{'id':_0x1b090b['params']['id']}})[_0xaad5('0x2a')](handleEntityNotFound(_0x2086ea,null))[_0xaad5('0x2a')](removeEntity(_0x2086ea,null))[_0xaad5('0x47')](handleError(_0x2086ea,null));};exports[_0xaad5('0x4f')]=function(_0x5b6553,_0x34d4a7,_0x3ef01a){var _0x4b424d={};var _0x58f389={};var _0x4fe05d;var _0x52dcdb;return db[_0xaad5('0x31')][_0xaad5('0x50')]({'where':{'id':_0x5b6553[_0xaad5('0x49')]['id']}})[_0xaad5('0x2a')](handleEntityNotFound(_0x34d4a7,null))[_0xaad5('0x2a')](function(_0xa226fd){if(_0xa226fd){_0x4fe05d=_0xa226fd;_0x58f389[_0xaad5('0x35')]=_[_0xaad5('0x4a')](db[_0xaad5('0x51')]['rawAttributes']);_0x58f389[_0xaad5('0x36')]=_[_0xaad5('0x4a')](_0x5b6553['query']);_0x58f389[_0xaad5('0x37')]=_[_0xaad5('0x38')](_0x58f389[_0xaad5('0x35')],_0x58f389[_0xaad5('0x36')]);_0x4b424d['attributes']=_['intersection'](_0x58f389['model'],qs[_0xaad5('0x39')](_0x5b6553['query'][_0xaad5('0x39')]));_0x4b424d[_0xaad5('0x3a')]=_0x4b424d[_0xaad5('0x3a')][_0xaad5('0x4b')]?_0x4b424d[_0xaad5('0x3a')]:_0x58f389[_0xaad5('0x35')];_0x4b424d[_0xaad5('0x3d')]=qs[_0xaad5('0x52')](_0x5b6553[_0xaad5('0x36')]['sort']);_0x4b424d[_0xaad5('0x3e')]=qs[_0xaad5('0x37')](_['pick'](_0x5b6553[_0xaad5('0x36')],_0x58f389[_0xaad5('0x37')]));if(_0x5b6553[_0xaad5('0x36')]['filter']){_0x4b424d[_0xaad5('0x3e')]=_[_0xaad5('0x40')](_0x4b424d[_0xaad5('0x3e')],{'$or':_[_0xaad5('0x30')](_0x4b424d[_0xaad5('0x3a')],function(_0x172eda){var _0x48533f={};_0x48533f[_0x172eda]={'$like':'%'+_0x5b6553[_0xaad5('0x36')]['filter']+'%'};return _0x48533f;})});}_0x4b424d=_[_0xaad5('0x40')]({},_0x4b424d,_0x5b6553[_0xaad5('0x42')]);return _0x4fe05d[_0xaad5('0x4f')](_0x4b424d);}})[_0xaad5('0x2a')](function(_0x58087a){if(_0x58087a){_0x52dcdb=_0x58087a['length'];if(!_0x5b6553[_0xaad5('0x36')][_0xaad5('0x3b')](_0xaad5('0x3c'))){_0x4b424d[_0xaad5('0x22')]=qs[_0xaad5('0x22')](_0x5b6553[_0xaad5('0x36')]['limit']);_0x4b424d[_0xaad5('0x1f')]=qs[_0xaad5('0x1f')](_0x5b6553['query'][_0xaad5('0x1f')]);}return _0x4fe05d['getConfigurations'](_0x4b424d);}})[_0xaad5('0x2a')](function(_0x40a9d0){if(_0x40a9d0){return _0x40a9d0?{'count':_0x52dcdb,'rows':_0x40a9d0}:null;}})[_0xaad5('0x2a')](respondWithResult(_0x34d4a7,null))[_0xaad5('0x47')](handleError(_0x34d4a7,null));};exports[_0xaad5('0x53')]=function(_0x16d2c8,_0x1b36a4,_0x14bb6e){if(_0x16d2c8[_0xaad5('0x4e')]['id']){delete _0x16d2c8[_0xaad5('0x4e')]['id'];}return db['DeskAccount'][_0xaad5('0x50')]({'where':{'id':_0x16d2c8[_0xaad5('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b36a4,null))[_0xaad5('0x2a')](function(_0x1427f3){if(_0x1427f3){_0x16d2c8['body'][_0xaad5('0x54')]=_0x1427f3['id'];_0x16d2c8[_0xaad5('0x4e')][_0xaad5('0x55')]=integrations[_0xaad5('0x56')](_0x16d2c8['body'][_0xaad5('0x57')],_0x16d2c8[_0xaad5('0x4e')][_0xaad5('0x58')]);_0x16d2c8['body'][_0xaad5('0x59')]=integrations[_0xaad5('0x5a')](_0x16d2c8[_0xaad5('0x4e')][_0xaad5('0x57')],_0x16d2c8[_0xaad5('0x4e')]['type']);return db[_0xaad5('0x51')]['create'](_0x16d2c8[_0xaad5('0x4e')],{'include':[{'model':db[_0xaad5('0x5b')],'as':_0xaad5('0x55')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xaad5('0x2a')](respondWithResult(_0x1b36a4,null))[_0xaad5('0x47')](handleError(_0x1b36a4,null));};exports['getFields']=function(_0x4c0fcc,_0x5deabf,_0x5b6588){var _0x1f5469=[{'name':_0xaad5('0x5c'),'label':_0xaad5('0x5c'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5a4ce5='';return db[_0xaad5('0x31')][_0xaad5('0x50')]({'where':{'id':_0x4c0fcc[_0xaad5('0x49')]['id']},'attributes':['id','remoteUri',_0xaad5('0x5d'),'username',_0xaad5('0x5e'),_0xaad5('0x5f'),_0xaad5('0x60'),'token','tokenSecret']})[_0xaad5('0x2a')](handleEntityNotFound(_0x5deabf,null))[_0xaad5('0x2a')](function(_0x29c156){if(_0x29c156){_0x5a4ce5=_0x29c156[_0xaad5('0x61')];var _0xd0774a=_0x5a4ce5[_0xaad5('0x62')](-0x1);if(_0xd0774a==='/'){_0x5a4ce5=_0x5a4ce5[_0xaad5('0x63')](0x0,_0x5a4ce5[_0xaad5('0x64')](_0xd0774a));}var _0x2ccf96={'method':_0xaad5('0x65'),'uri':util[_0xaad5('0x66')](_0xaad5('0x67'),_0x5a4ce5),'headers':{'Content-Type':_0xaad5('0x68'),'Accept':_0xaad5('0x68')},'json':!![]};if(_0x29c156['authType']===_0xaad5('0x69')){_0x2ccf96[_0xaad5('0x6a')][_0xaad5('0x6b')]=util[_0xaad5('0x66')](_0xaad5('0x6c'),new Buffer(util['format'](_0xaad5('0x6d'),_0x29c156[_0xaad5('0x6e')],_0x29c156[_0xaad5('0x5e')]))[_0xaad5('0x6f')](_0xaad5('0x70')));}return rp(_0x2ccf96)['then'](function(_0x3a51ad){return _0x1f5469['concat'](_[_0xaad5('0x30')](_0x3a51ad[_0xaad5('0x71')][_0xaad5('0x72')],function(_0x500def){return{'id':_0x500def[_0xaad5('0x2e')],'name':_0x500def[_0xaad5('0x2e')],'type':_0x500def['type'],'active':_0x500def['active'],'label':_0x500def['label'],'custom':!![]};}));});}})[_0xaad5('0x2a')](function(_0x2018a3){return{'count':_0x2018a3[_0xaad5('0x4b')],'rows':_0x2018a3};})[_0xaad5('0x2a')](respondWithResult(_0x5deabf,null))['catch'](function(_0x376c36){var _0x3db939=_0x4c0fcc[_0xaad5('0x36')][_0xaad5('0x73')]?0x1f4:_0x376c36[_0xaad5('0x74')]||0x1f4;logger['error'](_0xaad5('0x75'),'getFields',_0x3db939,JSON[_0xaad5('0x76')](_0x376c36));delete _0x376c36[_0xaad5('0x2e')];if(_0x3db939===0x191){_0x3db939=0x190;}_0x5deabf[_0xaad5('0x1e')](_0x3db939)[_0xaad5('0x77')](_0x4c0fcc[_0xaad5('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x376c36[_0xaad5('0x74')]}:_0x376c36);});}; \ No newline at end of file +var _0x9385=['rows','catch','params','include','create','body','find','destroy','getConfigurations','findOne','pick','Subjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','password','toString','base64','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','DeskAccount','includeAll','findAll'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x9385,0x175));var _0x5938=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x9385[_0x2850c0];return _0x21e830;};'use strict';var emlformat=require(_0x5938('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5938('0x1'));var moment=require(_0x5938('0x2'));var BPromise=require(_0x5938('0x3'));var Mustache=require(_0x5938('0x4'));var util=require(_0x5938('0x5'));var path=require(_0x5938('0x6'));var sox=require('sox');var csv=require(_0x5938('0x7'));var ejs=require(_0x5938('0x8'));var fs=require('fs');var fs_extra=require(_0x5938('0x9'));var _=require('lodash');var squel=require(_0x5938('0xa'));var crypto=require(_0x5938('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5938('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5938('0xd'));var Papa=require('papaparse');var Redis=require(_0x5938('0xe'));var authService=require(_0x5938('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5938('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5938('0x11'))(_0x5938('0x12'));var utils=require(_0x5938('0x13'));var config=require(_0x5938('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5938('0x15'))['db'];var integrations=require(_0x5938('0x16'));function respondWithStatusCode(_0x8afd00,_0x280722){_0x280722=_0x280722||0xcc;return function(_0x211f97){if(_0x211f97){return _0x8afd00[_0x5938('0x17')](_0x280722);}return _0x8afd00[_0x5938('0x18')](_0x280722)[_0x5938('0x19')]();};}function respondWithResult(_0x10c143,_0x2ab0de){_0x2ab0de=_0x2ab0de||0xc8;return function(_0x14a6e2){if(_0x14a6e2){return _0x10c143[_0x5938('0x18')](_0x2ab0de)[_0x5938('0x1a')](_0x14a6e2);}};}function respondWithFilteredResult(_0x565203,_0x447c41){return function(_0x27c7a2){if(_0x27c7a2){var _0x45a9b4=typeof _0x447c41[_0x5938('0x1b')]===_0x5938('0x1c')&&typeof _0x447c41[_0x5938('0x1d')]===_0x5938('0x1c');var _0x5c46d8=_0x27c7a2[_0x5938('0x1e')];var _0x234d50=_0x45a9b4?0x0:_0x447c41['offset'];var _0x3d1949=_0x45a9b4?_0x27c7a2[_0x5938('0x1e')]:_0x447c41[_0x5938('0x1b')]+_0x447c41['limit'];var _0x1b45c4;if(_0x3d1949>=_0x5c46d8){_0x3d1949=_0x5c46d8;_0x1b45c4=0xc8;}else{_0x1b45c4=0xce;}_0x565203[_0x5938('0x18')](_0x1b45c4);return _0x565203['set'](_0x5938('0x1f'),_0x234d50+'-'+_0x3d1949+'/'+_0x5c46d8)['json'](_0x27c7a2);}return null;};}function patchUpdates(_0x2c9680){return function(_0x125874){try{jsonpatch['apply'](_0x125874,_0x2c9680,!![]);}catch(_0x341669){return BPromise[_0x5938('0x20')](_0x341669);}return _0x125874['save']();};}function saveUpdates(_0x3471d3,_0x11d31d){return function(_0x30d101){if(_0x30d101){return _0x30d101[_0x5938('0x21')](_0x3471d3)['then'](function(_0x320952){return _0x320952;});}return null;};}function removeEntity(_0x13cd0d,_0x596fab){return function(_0xc6d9f5){if(_0xc6d9f5){return _0xc6d9f5['destroy']()[_0x5938('0x22')](function(){_0x13cd0d['status'](0xcc)[_0x5938('0x19')]();});}};}function handleEntityNotFound(_0x354b05,_0x247a12){return function(_0x1ff87e){if(!_0x1ff87e){_0x354b05[_0x5938('0x17')](0x194);}return _0x1ff87e;};}function handleError(_0x1399dc,_0x521679){_0x521679=_0x521679||0x1f4;return function(_0x47e952){logger[_0x5938('0x23')](_0x47e952['stack']);if(_0x47e952['name']){delete _0x47e952[_0x5938('0x24')];}_0x1399dc[_0x5938('0x18')](_0x521679)[_0x5938('0x25')](_0x47e952);};}exports[_0x5938('0x26')]=function(_0x1355b3,_0x8a028d){var _0x5b5df2={},_0x12e7de={},_0xfde067={'count':0x0,'rows':[]};var _0x2327aa=_[_0x5938('0x27')](db['DeskAccount'][_0x5938('0x28')],function(_0x14da8f){return{'name':_0x14da8f[_0x5938('0x29')],'type':_0x14da8f['type'][_0x5938('0x2a')]};});_0x12e7de[_0x5938('0x2b')]=_[_0x5938('0x27')](_0x2327aa,_0x5938('0x24'));_0x12e7de[_0x5938('0x2c')]=_[_0x5938('0x2d')](_0x1355b3[_0x5938('0x2c')]);_0x12e7de[_0x5938('0x2e')]=_[_0x5938('0x2f')](_0x12e7de[_0x5938('0x2b')],_0x12e7de[_0x5938('0x2c')]);_0x5b5df2[_0x5938('0x30')]=_['intersection'](_0x12e7de[_0x5938('0x2b')],qs[_0x5938('0x31')](_0x1355b3['query'][_0x5938('0x31')]));_0x5b5df2['attributes']=_0x5b5df2[_0x5938('0x30')][_0x5938('0x32')]?_0x5b5df2[_0x5938('0x30')]:_0x12e7de[_0x5938('0x2b')];if(!_0x1355b3[_0x5938('0x2c')][_0x5938('0x33')](_0x5938('0x34'))){_0x5b5df2[_0x5938('0x1d')]=qs[_0x5938('0x1d')](_0x1355b3[_0x5938('0x2c')][_0x5938('0x1d')]);_0x5b5df2[_0x5938('0x1b')]=qs[_0x5938('0x1b')](_0x1355b3[_0x5938('0x2c')][_0x5938('0x1b')]);}_0x5b5df2['order']=qs[_0x5938('0x35')](_0x1355b3[_0x5938('0x2c')][_0x5938('0x35')]);_0x5b5df2['where']=qs['filters'](_['pick'](_0x1355b3[_0x5938('0x2c')],_0x12e7de[_0x5938('0x2e')]),_0x2327aa);if(_0x1355b3[_0x5938('0x2c')][_0x5938('0x36')]){_0x5b5df2[_0x5938('0x37')]=_[_0x5938('0x38')](_0x5b5df2[_0x5938('0x37')],{'$or':_[_0x5938('0x27')](_0x2327aa,function(_0x109780){if(_0x109780[_0x5938('0x39')]!==_0x5938('0x3a')){var _0x38587d={};_0x38587d[_0x109780[_0x5938('0x24')]]={'$like':'%'+_0x1355b3['query']['filter']+'%'};return _0x38587d;}})});}_0x5b5df2=_['merge']({},_0x5b5df2,_0x1355b3[_0x5938('0x3b')]);var _0x11e0f3={'where':_0x5b5df2[_0x5938('0x37')]};return db[_0x5938('0x3c')][_0x5938('0x1e')](_0x11e0f3)['then'](function(_0x456c8c){_0xfde067[_0x5938('0x1e')]=_0x456c8c;if(_0x1355b3[_0x5938('0x2c')][_0x5938('0x3d')]){_0x5b5df2['include']=[{'all':!![]}];}return db[_0x5938('0x3c')][_0x5938('0x3e')](_0x5b5df2);})[_0x5938('0x22')](function(_0x1f25d0){_0xfde067[_0x5938('0x3f')]=_0x1f25d0;return _0xfde067;})['then'](respondWithFilteredResult(_0x8a028d,_0x5b5df2))[_0x5938('0x40')](handleError(_0x8a028d,null));};exports['show']=function(_0x2e830c,_0x3ba0f1){var _0x4969a5={'raw':![],'where':{'id':_0x2e830c[_0x5938('0x41')]['id']}},_0x373518={};_0x373518['model']=_[_0x5938('0x2d')](db[_0x5938('0x3c')][_0x5938('0x28')]);_0x373518[_0x5938('0x2c')]=_['keys'](_0x2e830c['query']);_0x373518[_0x5938('0x2e')]=_[_0x5938('0x2f')](_0x373518[_0x5938('0x2b')],_0x373518['query']);_0x4969a5['attributes']=_['intersection'](_0x373518[_0x5938('0x2b')],qs[_0x5938('0x31')](_0x2e830c[_0x5938('0x2c')]['fields']));_0x4969a5['attributes']=_0x4969a5[_0x5938('0x30')][_0x5938('0x32')]?_0x4969a5[_0x5938('0x30')]:_0x373518[_0x5938('0x2b')];if(_0x2e830c[_0x5938('0x2c')]['includeAll']){_0x4969a5[_0x5938('0x42')]=[{'all':!![]}];}_0x4969a5=_[_0x5938('0x38')]({},_0x4969a5,_0x2e830c[_0x5938('0x3b')]);return db[_0x5938('0x3c')]['find'](_0x4969a5)[_0x5938('0x22')](handleEntityNotFound(_0x3ba0f1,null))[_0x5938('0x22')](respondWithResult(_0x3ba0f1,null))[_0x5938('0x40')](handleError(_0x3ba0f1,null));};exports[_0x5938('0x43')]=function(_0x2492ab,_0x21f4e2){return db[_0x5938('0x3c')][_0x5938('0x43')](_0x2492ab['body'],{})[_0x5938('0x22')](respondWithResult(_0x21f4e2,0xc9))[_0x5938('0x40')](handleError(_0x21f4e2,null));};exports[_0x5938('0x21')]=function(_0xf344c,_0xf9fb05){if(_0xf344c[_0x5938('0x44')]['id']){delete _0xf344c[_0x5938('0x44')]['id'];}return db[_0x5938('0x3c')][_0x5938('0x45')]({'where':{'id':_0xf344c[_0x5938('0x41')]['id']}})[_0x5938('0x22')](handleEntityNotFound(_0xf9fb05,null))['then'](saveUpdates(_0xf344c[_0x5938('0x44')],null))[_0x5938('0x22')](respondWithResult(_0xf9fb05,null))[_0x5938('0x40')](handleError(_0xf9fb05,null));};exports[_0x5938('0x46')]=function(_0x53c49d,_0x9d0cf3){return db[_0x5938('0x3c')][_0x5938('0x45')]({'where':{'id':_0x53c49d['params']['id']}})[_0x5938('0x22')](handleEntityNotFound(_0x9d0cf3,null))[_0x5938('0x22')](removeEntity(_0x9d0cf3,null))[_0x5938('0x40')](handleError(_0x9d0cf3,null));};exports[_0x5938('0x47')]=function(_0x1eb614,_0x46f788,_0x440f43){var _0x24203a={};var _0x145a77={};var _0x25af82;var _0x2ab12b;return db[_0x5938('0x3c')][_0x5938('0x48')]({'where':{'id':_0x1eb614[_0x5938('0x41')]['id']}})[_0x5938('0x22')](handleEntityNotFound(_0x46f788,null))['then'](function(_0x436b39){if(_0x436b39){_0x25af82=_0x436b39;_0x145a77[_0x5938('0x2b')]=_[_0x5938('0x2d')](db['DeskConfiguration'][_0x5938('0x28')]);_0x145a77[_0x5938('0x2c')]=_['keys'](_0x1eb614[_0x5938('0x2c')]);_0x145a77['filters']=_['intersection'](_0x145a77[_0x5938('0x2b')],_0x145a77[_0x5938('0x2c')]);_0x24203a['attributes']=_[_0x5938('0x2f')](_0x145a77['model'],qs[_0x5938('0x31')](_0x1eb614[_0x5938('0x2c')]['fields']));_0x24203a[_0x5938('0x30')]=_0x24203a[_0x5938('0x30')][_0x5938('0x32')]?_0x24203a[_0x5938('0x30')]:_0x145a77[_0x5938('0x2b')];_0x24203a['order']=qs[_0x5938('0x35')](_0x1eb614[_0x5938('0x2c')][_0x5938('0x35')]);_0x24203a[_0x5938('0x37')]=qs[_0x5938('0x2e')](_[_0x5938('0x49')](_0x1eb614['query'],_0x145a77['filters']));if(_0x1eb614[_0x5938('0x2c')][_0x5938('0x36')]){_0x24203a[_0x5938('0x37')]=_[_0x5938('0x38')](_0x24203a[_0x5938('0x37')],{'$or':_[_0x5938('0x27')](_0x24203a[_0x5938('0x30')],function(_0x5f28b3){var _0x5cf968={};_0x5cf968[_0x5f28b3]={'$like':'%'+_0x1eb614[_0x5938('0x2c')][_0x5938('0x36')]+'%'};return _0x5cf968;})});}_0x24203a=_[_0x5938('0x38')]({},_0x24203a,_0x1eb614[_0x5938('0x3b')]);return _0x25af82[_0x5938('0x47')](_0x24203a);}})[_0x5938('0x22')](function(_0x53db58){if(_0x53db58){_0x2ab12b=_0x53db58[_0x5938('0x32')];if(!_0x1eb614[_0x5938('0x2c')][_0x5938('0x33')](_0x5938('0x34'))){_0x24203a[_0x5938('0x1d')]=qs[_0x5938('0x1d')](_0x1eb614[_0x5938('0x2c')][_0x5938('0x1d')]);_0x24203a['offset']=qs[_0x5938('0x1b')](_0x1eb614[_0x5938('0x2c')][_0x5938('0x1b')]);}return _0x25af82[_0x5938('0x47')](_0x24203a);}})['then'](function(_0x20f68d){if(_0x20f68d){return _0x20f68d?{'count':_0x2ab12b,'rows':_0x20f68d}:null;}})[_0x5938('0x22')](respondWithResult(_0x46f788,null))['catch'](handleError(_0x46f788,null));};exports['addConfiguration']=function(_0x62be96,_0x4ffa88,_0x5610f6){if(_0x62be96[_0x5938('0x44')]['id']){delete _0x62be96[_0x5938('0x44')]['id'];}return db[_0x5938('0x3c')][_0x5938('0x48')]({'where':{'id':_0x62be96[_0x5938('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ffa88,null))[_0x5938('0x22')](function(_0x88cfbd){if(_0x88cfbd){_0x62be96[_0x5938('0x44')]['AccountId']=_0x88cfbd['id'];_0x62be96['body'][_0x5938('0x4a')]=integrations['getSubjects'](_0x62be96[_0x5938('0x44')][_0x5938('0x4b')],_0x62be96[_0x5938('0x44')][_0x5938('0x39')]);_0x62be96['body'][_0x5938('0x4c')]=integrations[_0x5938('0x4d')](_0x62be96[_0x5938('0x44')][_0x5938('0x4b')],_0x62be96[_0x5938('0x44')][_0x5938('0x39')]);return db[_0x5938('0x4e')][_0x5938('0x43')](_0x62be96[_0x5938('0x44')],{'include':[{'model':db[_0x5938('0x4f')],'as':_0x5938('0x4a')},{'model':db[_0x5938('0x4f')],'as':_0x5938('0x4c')}]});}return null;})[_0x5938('0x22')](respondWithResult(_0x4ffa88,null))[_0x5938('0x40')](handleError(_0x4ffa88,null));};exports[_0x5938('0x50')]=function(_0x3814cf,_0x22ec3f,_0x5144e2){var _0x32daba=[{'name':_0x5938('0x51'),'label':_0x5938('0x51'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4bef93='';return db[_0x5938('0x3c')]['findOne']({'where':{'id':_0x3814cf[_0x5938('0x41')]['id']},'attributes':['id',_0x5938('0x52'),_0x5938('0x53'),_0x5938('0x54'),'password',_0x5938('0x55'),'consumerSecret',_0x5938('0x56'),_0x5938('0x57')]})[_0x5938('0x22')](handleEntityNotFound(_0x22ec3f,null))[_0x5938('0x22')](function(_0x29ba9c){if(_0x29ba9c){_0x4bef93=_0x29ba9c[_0x5938('0x52')];var _0x5cdd82=_0x4bef93[_0x5938('0x58')](-0x1);if(_0x5cdd82==='/'){_0x4bef93=_0x4bef93[_0x5938('0x59')](0x0,_0x4bef93[_0x5938('0x5a')](_0x5cdd82));}var _0x4456f7={'method':'GET','uri':util[_0x5938('0x5b')](_0x5938('0x5c'),_0x4bef93),'headers':{'Content-Type':_0x5938('0x5d'),'Accept':_0x5938('0x5d')},'json':!![]};if(_0x29ba9c[_0x5938('0x53')]===_0x5938('0x5e')){_0x4456f7[_0x5938('0x5f')]['Authorization']=util[_0x5938('0x5b')](_0x5938('0x60'),new Buffer(util[_0x5938('0x5b')]('%s:%s',_0x29ba9c[_0x5938('0x54')],_0x29ba9c[_0x5938('0x61')]))[_0x5938('0x62')](_0x5938('0x63')));}return rp(_0x4456f7)[_0x5938('0x22')](function(_0x1f4b3b){return _0x32daba[_0x5938('0x64')](_[_0x5938('0x27')](_0x1f4b3b[_0x5938('0x65')][_0x5938('0x66')],function(_0x23b037){return{'id':_0x23b037[_0x5938('0x24')],'name':_0x23b037[_0x5938('0x24')],'type':_0x23b037['type'],'active':_0x23b037[_0x5938('0x67')],'label':_0x23b037[_0x5938('0x68')],'custom':!![]};}));});}})[_0x5938('0x22')](function(_0x48a4d4){return{'count':_0x48a4d4[_0x5938('0x32')],'rows':_0x48a4d4};})[_0x5938('0x22')](respondWithResult(_0x22ec3f,null))[_0x5938('0x40')](function(_0xa057d1){var _0x2ef82d=_0x3814cf[_0x5938('0x2c')][_0x5938('0x69')]?0x1f4:_0xa057d1['statusCode']||0x1f4;logger[_0x5938('0x23')](_0x5938('0x6a'),_0x5938('0x50'),_0x2ef82d,JSON[_0x5938('0x6b')](_0xa057d1));delete _0xa057d1[_0x5938('0x24')];if(_0x2ef82d===0x191){_0x2ef82d=0x190;}_0x22ec3f[_0x5938('0x18')](_0x2ef82d)[_0x5938('0x25')](_0x3814cf[_0x5938('0x2c')][_0x5938('0x69')]?{'message':_0x5938('0x6c'),'statusCode':_0xa057d1['statusCode']}:_0xa057d1);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index e03b331..b72181e 100644 --- a/server/api/intDeskAccount/intDeskAccount.model.js +++ b/server/api/intDeskAccount/intDeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad7d=['api','bluebird','request-promise','path','exports','define','util','../../config/logger'];(function(_0x4374c3,_0x526baa){var _0x366577=function(_0x55c303){while(--_0x55c303){_0x4374c3['push'](_0x4374c3['shift']());}};_0x366577(++_0x526baa);}(_0xad7d,0x176));var _0xdad7=function(_0x2b94e,_0x267b5e){_0x2b94e=_0x2b94e-0x0;var _0x120c29=_0xad7d[_0x2b94e];return _0x120c29;};'use strict';var _=require('lodash');var util=require(_0xdad7('0x0'));var logger=require(_0xdad7('0x1'))(_0xdad7('0x2'));var moment=require('moment');var BPromise=require(_0xdad7('0x3'));var rp=require(_0xdad7('0x4'));var fs=require('fs');var path=require(_0xdad7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xdad7('0x6')]=function(_0x5e691f,_0x4dce70){return _0x5e691f[_0xdad7('0x7')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd2a=['moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','util','../../config/logger','api'];(function(_0x32ed89,_0x11d953){var _0x262961=function(_0x29727c){while(--_0x29727c){_0x32ed89['push'](_0x32ed89['shift']());}};_0x262961(++_0x11d953);}(_0xfd2a,0x1d1));var _0xafd2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xfd2a[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0xafd2('0x0'));var logger=require(_0xafd2('0x1'))(_0xafd2('0x2'));var moment=require(_0xafd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xafd2('0x4'));var fs=require('fs');var path=require(_0xafd2('0x5'));var rimraf=require(_0xafd2('0x6'));var config=require(_0xafd2('0x7'));var attributes=require(_0xafd2('0x8'));var integrations=require(_0xafd2('0x9'));module[_0xafd2('0xa')]=function(_0x45e9d2,_0xdf6900){return _0x45e9d2['define'](_0xafd2('0xb'),attributes,{'tableName':_0xafd2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 9288fe9..b70b860 100644 --- a/server/api/intDeskAccount/intDeskAccount.rpc.js +++ b/server/api/intDeskAccount/intDeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b7b=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','include','map','model','attributes','debug','stringify','ShowDeskAccount','lodash','util','moment'];(function(_0x1dcd60,_0x5f4525){var _0x5a7481=function(_0x54c5e4){while(--_0x54c5e4){_0x1dcd60['push'](_0x1dcd60['shift']());}};_0x5a7481(++_0x5f4525);}(_0x4b7b,0x195));var _0xb4b7=function(_0x570c7e,_0x5472bd){_0x570c7e=_0x570c7e-0x0;var _0x213a73=_0x4b7b[_0x570c7e];return _0x213a73;};'use strict';var _=require(_0xb4b7('0x0'));var util=require(_0xb4b7('0x1'));var moment=require(_0xb4b7('0x2'));var BPromise=require(_0xb4b7('0x3'));var rs=require(_0xb4b7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4b7('0x5'))['db'];var utils=require(_0xb4b7('0x6'));var logger=require(_0xb4b7('0x7'))('rpc');var config=require(_0xb4b7('0x8'));var jayson=require(_0xb4b7('0x9'));var client=jayson[_0xb4b7('0xa')][_0xb4b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f1ea4,_0x4f2b24,_0x63f7ab){return new BPromise(function(_0x2193d1,_0x2be4f4){return client[_0xb4b7('0xc')](_0x4f1ea4,_0x63f7ab)[_0xb4b7('0xd')](function(_0x3b88c8){logger[_0xb4b7('0xe')](_0xb4b7('0xf'),_0x4f2b24,_0xb4b7('0x10'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4f2b24,_0xb4b7('0x10'),JSON['stringify'](_0x3b88c8));if(_0x3b88c8['error']){if(_0x3b88c8[_0xb4b7('0x11')][_0xb4b7('0x12')]===0x1f4){logger[_0xb4b7('0x11')](_0xb4b7('0xf'),_0x4f2b24,_0x3b88c8[_0xb4b7('0x11')][_0xb4b7('0x13')]);return _0x2be4f4(_0x3b88c8[_0xb4b7('0x11')][_0xb4b7('0x13')]);}logger[_0xb4b7('0x11')](_0xb4b7('0xf'),_0x4f2b24,_0x3b88c8[_0xb4b7('0x11')]['message']);return _0x2193d1(_0x3b88c8[_0xb4b7('0x11')][_0xb4b7('0x13')]);}else{logger['info'](_0xb4b7('0xf'),_0x4f2b24,_0xb4b7('0x10'));_0x2193d1(_0x3b88c8[_0xb4b7('0x14')][_0xb4b7('0x13')]);}})[_0xb4b7('0x15')](function(_0x23e45b){logger[_0xb4b7('0x11')](_0xb4b7('0xf'),_0x4f2b24,_0x23e45b);_0x2be4f4(_0x23e45b);});});}exports[_0xb4b7('0x16')]=function(_0x5cb10a){var _0x3fddcd=this;return new Promise(function(_0x3592c0,_0x479182){return db[_0xb4b7('0x17')]['findAll']({'raw':_0x5cb10a[_0xb4b7('0x18')]?_0x5cb10a[_0xb4b7('0x18')][_0xb4b7('0x19')]===undefined?!![]:![]:!![],'where':_0x5cb10a[_0xb4b7('0x18')]?_0x5cb10a['options'][_0xb4b7('0x1a')]||null:null,'attributes':_0x5cb10a[_0xb4b7('0x18')]?_0x5cb10a[_0xb4b7('0x18')]['attributes']||null:null,'limit':_0x5cb10a[_0xb4b7('0x18')]?_0x5cb10a['options']['limit']||null:null,'include':_0x5cb10a['options']?_0x5cb10a[_0xb4b7('0x18')][_0xb4b7('0x1b')]?_[_0xb4b7('0x1c')](_0x5cb10a[_0xb4b7('0x18')]['include'],function(_0x99fef5){return{'model':db[_0x99fef5[_0xb4b7('0x1d')]],'as':_0x99fef5['as'],'attributes':_0x99fef5[_0xb4b7('0x1e')],'include':_0x99fef5[_0xb4b7('0x1b')]?_[_0xb4b7('0x1c')](_0x99fef5['include'],function(_0xa34b6b){return{'model':db[_0xa34b6b['model']],'as':_0xa34b6b['as'],'attributes':_0xa34b6b[_0xb4b7('0x1e')],'include':_0xa34b6b[_0xb4b7('0x1b')]?_[_0xb4b7('0x1c')](_0xa34b6b[_0xb4b7('0x1b')],function(_0x23991a){return{'model':db[_0x23991a[_0xb4b7('0x1d')]],'as':_0x23991a['as'],'attributes':_0x23991a[_0xb4b7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb4b7('0xd')](function(_0x41d27d){logger[_0xb4b7('0xe')](_0xb4b7('0x16'),_0x5cb10a);logger[_0xb4b7('0x1f')](_0xb4b7('0x16'),_0x5cb10a,JSON[_0xb4b7('0x20')](_0x41d27d));_0x3592c0(_0x41d27d);})[_0xb4b7('0x15')](function(_0x2ce2dc){logger['error'](_0xb4b7('0x16'),_0x2ce2dc['message'],_0x5cb10a);_0x479182(_0x3fddcd['error'](0x1f4,_0x2ce2dc[_0xb4b7('0x13')]));});});};exports[_0xb4b7('0x21')]=function(_0x450a51){var _0x5c7617=this;return new Promise(function(_0x32c12f,_0x41dfa8){return db['DeskAccount']['find']({'raw':_0x450a51['options']?_0x450a51[_0xb4b7('0x18')][_0xb4b7('0x19')]===undefined?!![]:![]:!![],'where':_0x450a51[_0xb4b7('0x18')]?_0x450a51[_0xb4b7('0x18')][_0xb4b7('0x1a')]||null:null,'attributes':_0x450a51[_0xb4b7('0x18')]?_0x450a51[_0xb4b7('0x18')]['attributes']||null:null,'include':_0x450a51[_0xb4b7('0x18')]?_0x450a51[_0xb4b7('0x18')][_0xb4b7('0x1b')]?_[_0xb4b7('0x1c')](_0x450a51[_0xb4b7('0x18')]['include'],function(_0x3183ba){return{'model':db[_0x3183ba[_0xb4b7('0x1d')]],'as':_0x3183ba['as'],'attributes':_0x3183ba[_0xb4b7('0x1e')],'include':_0x3183ba[_0xb4b7('0x1b')]?_['map'](_0x3183ba[_0xb4b7('0x1b')],function(_0x8352c5){return{'model':db[_0x8352c5[_0xb4b7('0x1d')]],'as':_0x8352c5['as'],'attributes':_0x8352c5[_0xb4b7('0x1e')],'include':_0x8352c5[_0xb4b7('0x1b')]?_[_0xb4b7('0x1c')](_0x8352c5[_0xb4b7('0x1b')],function(_0x5c95f7){return{'model':db[_0x5c95f7['model']],'as':_0x5c95f7['as'],'attributes':_0x5c95f7['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4b7('0xd')](function(_0x5da9cc){logger['info']('ShowDeskAccount',_0x450a51);logger[_0xb4b7('0x1f')]('ShowDeskAccount',_0x450a51,JSON[_0xb4b7('0x20')](_0x5da9cc));_0x32c12f(_0x5da9cc);})[_0xb4b7('0x15')](function(_0xe95a60){logger[_0xb4b7('0x11')](_0xb4b7('0x21'),_0xe95a60[_0xb4b7('0x13')],_0x450a51);_0x41dfa8(_0x5c7617[_0xb4b7('0x11')](0x1f4,_0xe95a60[_0xb4b7('0x13')]));});});}; \ No newline at end of file +var _0x4f17=['limit','include','map','model','then','stringify','ShowDeskAccount','find','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','options','raw','attributes'];(function(_0xf436fb,_0x25f9b8){var _0x188bca=function(_0x4c20aa){while(--_0x4c20aa){_0xf436fb['push'](_0xf436fb['shift']());}};_0x188bca(++_0x25f9b8);}(_0x4f17,0x1c3));var _0x74f1=function(_0x1a6007,_0x350755){_0x1a6007=_0x1a6007-0x0;var _0x120665=_0x4f17[_0x1a6007];return _0x120665;};'use strict';var _=require(_0x74f1('0x0'));var util=require(_0x74f1('0x1'));var moment=require(_0x74f1('0x2'));var BPromise=require(_0x74f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74f1('0x4'))['db'];var utils=require(_0x74f1('0x5'));var logger=require('../../config/logger')(_0x74f1('0x6'));var config=require('../../config/environment');var jayson=require(_0x74f1('0x7'));var client=jayson[_0x74f1('0x8')][_0x74f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45d358,_0x5c6700,_0x4d0ad5){return new BPromise(function(_0x2b6426,_0x5d6615){return client[_0x74f1('0xa')](_0x45d358,_0x4d0ad5)['then'](function(_0x485a4a){logger[_0x74f1('0xb')]('DeskAccount,\x20%s,\x20%s',_0x5c6700,_0x74f1('0xc'));logger[_0x74f1('0xd')](_0x74f1('0xe'),_0x5c6700,_0x74f1('0xc'),JSON['stringify'](_0x485a4a));if(_0x485a4a[_0x74f1('0xf')]){if(_0x485a4a[_0x74f1('0xf')]['code']===0x1f4){logger[_0x74f1('0xf')](_0x74f1('0x10'),_0x5c6700,_0x485a4a[_0x74f1('0xf')]['message']);return _0x5d6615(_0x485a4a[_0x74f1('0xf')]['message']);}logger[_0x74f1('0xf')]('DeskAccount,\x20%s,\x20%s',_0x5c6700,_0x485a4a[_0x74f1('0xf')][_0x74f1('0x11')]);return _0x2b6426(_0x485a4a[_0x74f1('0xf')]['message']);}else{logger[_0x74f1('0xb')]('DeskAccount,\x20%s,\x20%s',_0x5c6700,'request\x20sent');_0x2b6426(_0x485a4a[_0x74f1('0x12')][_0x74f1('0x11')]);}})[_0x74f1('0x13')](function(_0x39b0d4){logger[_0x74f1('0xf')](_0x74f1('0x10'),_0x5c6700,_0x39b0d4);_0x5d6615(_0x39b0d4);});});}exports[_0x74f1('0x14')]=function(_0x11be2f){var _0x1738e2=this;return new Promise(function(_0x456a8e,_0x3e1e90){return db[_0x74f1('0x15')]['findAll']({'raw':_0x11be2f['options']?_0x11be2f[_0x74f1('0x16')][_0x74f1('0x17')]===undefined?!![]:![]:!![],'where':_0x11be2f[_0x74f1('0x16')]?_0x11be2f[_0x74f1('0x16')]['where']||null:null,'attributes':_0x11be2f[_0x74f1('0x16')]?_0x11be2f['options'][_0x74f1('0x18')]||null:null,'limit':_0x11be2f[_0x74f1('0x16')]?_0x11be2f[_0x74f1('0x16')][_0x74f1('0x19')]||null:null,'include':_0x11be2f[_0x74f1('0x16')]?_0x11be2f[_0x74f1('0x16')][_0x74f1('0x1a')]?_['map'](_0x11be2f[_0x74f1('0x16')][_0x74f1('0x1a')],function(_0x110d69){return{'model':db[_0x110d69['model']],'as':_0x110d69['as'],'attributes':_0x110d69[_0x74f1('0x18')],'include':_0x110d69[_0x74f1('0x1a')]?_['map'](_0x110d69[_0x74f1('0x1a')],function(_0x4cadac){return{'model':db[_0x4cadac['model']],'as':_0x4cadac['as'],'attributes':_0x4cadac[_0x74f1('0x18')],'include':_0x4cadac[_0x74f1('0x1a')]?_[_0x74f1('0x1b')](_0x4cadac['include'],function(_0x4cca2b){return{'model':db[_0x4cca2b[_0x74f1('0x1c')]],'as':_0x4cca2b['as'],'attributes':_0x4cca2b['attributes']};}):[]};}):[]};}):[]:[]})[_0x74f1('0x1d')](function(_0x5da1e5){logger[_0x74f1('0xb')](_0x74f1('0x14'),_0x11be2f);logger[_0x74f1('0xd')](_0x74f1('0x14'),_0x11be2f,JSON[_0x74f1('0x1e')](_0x5da1e5));_0x456a8e(_0x5da1e5);})[_0x74f1('0x13')](function(_0x50305f){logger['error']('GetDeskAccount',_0x50305f[_0x74f1('0x11')],_0x11be2f);_0x3e1e90(_0x1738e2[_0x74f1('0xf')](0x1f4,_0x50305f['message']));});});};exports[_0x74f1('0x1f')]=function(_0x20ee18){var _0x1ac7b5=this;return new Promise(function(_0x369e35,_0x2bfe72){return db[_0x74f1('0x15')][_0x74f1('0x20')]({'raw':_0x20ee18['options']?_0x20ee18[_0x74f1('0x16')][_0x74f1('0x17')]===undefined?!![]:![]:!![],'where':_0x20ee18[_0x74f1('0x16')]?_0x20ee18[_0x74f1('0x16')][_0x74f1('0x21')]||null:null,'attributes':_0x20ee18[_0x74f1('0x16')]?_0x20ee18[_0x74f1('0x16')][_0x74f1('0x18')]||null:null,'include':_0x20ee18[_0x74f1('0x16')]?_0x20ee18[_0x74f1('0x16')][_0x74f1('0x1a')]?_[_0x74f1('0x1b')](_0x20ee18[_0x74f1('0x16')][_0x74f1('0x1a')],function(_0x19c862){return{'model':db[_0x19c862['model']],'as':_0x19c862['as'],'attributes':_0x19c862['attributes'],'include':_0x19c862[_0x74f1('0x1a')]?_[_0x74f1('0x1b')](_0x19c862['include'],function(_0x1d57ce){return{'model':db[_0x1d57ce[_0x74f1('0x1c')]],'as':_0x1d57ce['as'],'attributes':_0x1d57ce[_0x74f1('0x18')],'include':_0x1d57ce[_0x74f1('0x1a')]?_[_0x74f1('0x1b')](_0x1d57ce['include'],function(_0x447a13){return{'model':db[_0x447a13[_0x74f1('0x1c')]],'as':_0x447a13['as'],'attributes':_0x447a13['attributes']};}):[]};}):[]};}):[]:[]})[_0x74f1('0x1d')](function(_0x15b7ab){logger[_0x74f1('0xb')](_0x74f1('0x1f'),_0x20ee18);logger[_0x74f1('0xd')](_0x74f1('0x1f'),_0x20ee18,JSON[_0x74f1('0x1e')](_0x15b7ab));_0x369e35(_0x15b7ab);})[_0x74f1('0x13')](function(_0x3b00f5){logger['error']('ShowDeskAccount',_0x3b00f5[_0x74f1('0x11')],_0x20ee18);_0x2bfe72(_0x1ac7b5[_0x74f1('0xf')](0x1f4,_0x3b00f5[_0x74f1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 1cecbfd..9d7ed47 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x4325a5,_0x28661b){var _0x492651=function(_0x554139){while(--_0x554139){_0x4325a5['push'](_0x4325a5['shift']());}};_0x492651(++_0x28661b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2c87ca,_0x31a6f0){var _0x32e581=function(_0x230d39){while(--_0x230d39){_0x2c87ca['push'](_0x2c87ca['shift']());}};_0x32e581(++_0x31a6f0);}(_0x008c,0x188));var _0xc008=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x008c[_0x4953da];return _0x2d3780;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index efd601b..437c791 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9cd4=['sequelize','exports','STRING'];(function(_0x8a53f9,_0x3dca53){var _0x2432dc=function(_0x47d0a1){while(--_0x47d0a1){_0x8a53f9['push'](_0x8a53f9['shift']());}};_0x2432dc(++_0x3dca53);}(_0x9cd4,0x1e6));var _0x49cd=function(_0x4d1d2c,_0x44f4d8){_0x4d1d2c=_0x4d1d2c-0x0;var _0x2c4cb9=_0x9cd4[_0x4d1d2c];return _0x2c4cb9;};'use strict';var Sequelize=require(_0x49cd('0x0'));module[_0x49cd('0x1')]={'name':{'type':Sequelize[_0x49cd('0x2')]},'description':{'type':Sequelize[_0x49cd('0x2')]}}; \ No newline at end of file +var _0x37ef=['STRING','sequelize','exports'];(function(_0x2137a9,_0xa4748f){var _0x2be43f=function(_0x20faef){while(--_0x20faef){_0x2137a9['push'](_0x2137a9['shift']());}};_0x2be43f(++_0xa4748f);}(_0x37ef,0x94));var _0xf37e=function(_0x5abe82,_0x3f4b65){_0x5abe82=_0x5abe82-0x0;var _0x2f8f38=_0x37ef[_0x5abe82];return _0x2f8f38;};'use strict';var Sequelize=require(_0xf37e('0x0'));module[_0xf37e('0x1')]={'name':{'type':Sequelize[_0xf37e('0x2')]},'description':{'type':Sequelize[_0xf37e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 9eeff22..13748b4 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x406b=['lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','DeskConfiguration','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','rows','catch','show','params','merge','options','find','create','body','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0x4706c6,_0x23d052){var _0x2d7a25=function(_0xdb502f){while(--_0xdb502f){_0x4706c6['push'](_0x4706c6['shift']());}};_0x2d7a25(++_0x23d052);}(_0x406b,0xe7));var _0xb406=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x406b[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xb406('0x0'));var rimraf=require(_0xb406('0x1'));var zipdir=require(_0xb406('0x2'));var jsonpatch=require(_0xb406('0x3'));var rp=require(_0xb406('0x4'));var moment=require(_0xb406('0x5'));var BPromise=require(_0xb406('0x6'));var Mustache=require('mustache');var util=require(_0xb406('0x7'));var path=require(_0xb406('0x8'));var sox=require('sox');var csv=require(_0xb406('0x9'));var ejs=require(_0xb406('0xa'));var fs=require('fs');var fs_extra=require(_0xb406('0xb'));var _=require(_0xb406('0xc'));var squel=require(_0xb406('0xd'));var crypto=require(_0xb406('0xe'));var jsforce=require(_0xb406('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb406('0x9'));var querystring=require(_0xb406('0x10'));var Papa=require(_0xb406('0x11'));var Redis=require('ioredis');var authService=require(_0xb406('0x12'));var qs=require(_0xb406('0x13'));var as=require(_0xb406('0x14'));var hardwareService=require(_0xb406('0x15'));var logger=require('../../config/logger')(_0xb406('0x16'));var utils=require(_0xb406('0x17'));var config=require(_0xb406('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f8349,_0x1b3915){_0x1b3915=_0x1b3915||0xcc;return function(_0x11205b){if(_0x11205b){return _0x1f8349[_0xb406('0x19')](_0x1b3915);}return _0x1f8349['status'](_0x1b3915)[_0xb406('0x1a')]();};}function respondWithResult(_0x3b6c75,_0x456872){_0x456872=_0x456872||0xc8;return function(_0xf11d15){if(_0xf11d15){return _0x3b6c75[_0xb406('0x1b')](_0x456872)[_0xb406('0x1c')](_0xf11d15);}};}function respondWithFilteredResult(_0x2f00d1,_0x56f8db){return function(_0x4d44e0){if(_0x4d44e0){var _0x5f2d36=typeof _0x56f8db[_0xb406('0x1d')]==='undefined'&&typeof _0x56f8db[_0xb406('0x1e')]===_0xb406('0x1f');var _0x326033=_0x4d44e0[_0xb406('0x20')];var _0x1ab49b=_0x5f2d36?0x0:_0x56f8db['offset'];var _0x49f060=_0x5f2d36?_0x4d44e0[_0xb406('0x20')]:_0x56f8db[_0xb406('0x1d')]+_0x56f8db[_0xb406('0x1e')];var _0x22ff2e;if(_0x49f060>=_0x326033){_0x49f060=_0x326033;_0x22ff2e=0xc8;}else{_0x22ff2e=0xce;}_0x2f00d1[_0xb406('0x1b')](_0x22ff2e);return _0x2f00d1[_0xb406('0x21')](_0xb406('0x22'),_0x1ab49b+'-'+_0x49f060+'/'+_0x326033)['json'](_0x4d44e0);}return null;};}function patchUpdates(_0xc11bb6){return function(_0x145164){try{jsonpatch[_0xb406('0x23')](_0x145164,_0xc11bb6,!![]);}catch(_0x1ef420){return BPromise['reject'](_0x1ef420);}return _0x145164[_0xb406('0x24')]();};}function saveUpdates(_0x433b40,_0x4ba217){return function(_0x3d0a2f){if(_0x3d0a2f){return _0x3d0a2f[_0xb406('0x25')](_0x433b40)[_0xb406('0x26')](function(_0x3d13ec){return _0x3d13ec;});}return null;};}function removeEntity(_0x517002,_0x71baed){return function(_0x3c5963){if(_0x3c5963){return _0x3c5963[_0xb406('0x27')]()[_0xb406('0x26')](function(){_0x517002[_0xb406('0x1b')](0xcc)[_0xb406('0x1a')]();});}};}function handleEntityNotFound(_0x451005,_0x11921e){return function(_0x485216){if(!_0x485216){_0x451005[_0xb406('0x19')](0x194);}return _0x485216;};}function handleError(_0x4aa71d,_0x2ee215){_0x2ee215=_0x2ee215||0x1f4;return function(_0xe13798){logger[_0xb406('0x28')](_0xe13798['stack']);if(_0xe13798[_0xb406('0x29')]){delete _0xe13798[_0xb406('0x29')];}_0x4aa71d['status'](_0x2ee215)[_0xb406('0x2a')](_0xe13798);};}exports['index']=function(_0x514390,_0x58bc0a){var _0x52a533={},_0x3ed47f={},_0x38dc51={'count':0x0,'rows':[]};var _0x4f0ec9=_[_0xb406('0x2b')](db[_0xb406('0x2c')][_0xb406('0x2d')],function(_0x506f76){return{'name':_0x506f76['fieldName'],'type':_0x506f76[_0xb406('0x2e')]['key']};});_0x3ed47f[_0xb406('0x2f')]=_[_0xb406('0x2b')](_0x4f0ec9,_0xb406('0x29'));_0x3ed47f[_0xb406('0x30')]=_[_0xb406('0x31')](_0x514390['query']);_0x3ed47f['filters']=_[_0xb406('0x32')](_0x3ed47f[_0xb406('0x2f')],_0x3ed47f[_0xb406('0x30')]);_0x52a533['attributes']=_['intersection'](_0x3ed47f[_0xb406('0x2f')],qs[_0xb406('0x33')](_0x514390[_0xb406('0x30')]['fields']));_0x52a533[_0xb406('0x34')]=_0x52a533[_0xb406('0x34')][_0xb406('0x35')]?_0x52a533[_0xb406('0x34')]:_0x3ed47f[_0xb406('0x2f')];if(!_0x514390[_0xb406('0x30')][_0xb406('0x36')](_0xb406('0x37'))){_0x52a533[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x514390[_0xb406('0x30')][_0xb406('0x1e')]);_0x52a533[_0xb406('0x1d')]=qs[_0xb406('0x1d')](_0x514390['query']['offset']);}_0x52a533[_0xb406('0x38')]=qs[_0xb406('0x39')](_0x514390['query'][_0xb406('0x39')]);_0x52a533[_0xb406('0x3a')]=qs[_0xb406('0x3b')](_[_0xb406('0x3c')](_0x514390['query'],_0x3ed47f[_0xb406('0x3b')]),_0x4f0ec9);if(_0x514390[_0xb406('0x30')][_0xb406('0x3d')]){_0x52a533[_0xb406('0x3a')]=_['merge'](_0x52a533['where'],{'$or':_['map'](_0x4f0ec9,function(_0x1210f7){if(_0x1210f7[_0xb406('0x2e')]!==_0xb406('0x3e')){var _0x141237={};_0x141237[_0x1210f7[_0xb406('0x29')]]={'$like':'%'+_0x514390[_0xb406('0x30')][_0xb406('0x3d')]+'%'};return _0x141237;}})});}_0x52a533=_['merge']({},_0x52a533,_0x514390['options']);var _0x3cf726={'where':_0x52a533[_0xb406('0x3a')]};return db[_0xb406('0x2c')]['count'](_0x3cf726)[_0xb406('0x26')](function(_0x1f7ba5){_0x38dc51['count']=_0x1f7ba5;if(_0x514390[_0xb406('0x30')][_0xb406('0x3f')]){_0x52a533['include']=[{'all':!![]}];}return db[_0xb406('0x2c')]['findAll'](_0x52a533);})[_0xb406('0x26')](function(_0x563055){_0x38dc51[_0xb406('0x40')]=_0x563055;return _0x38dc51;})[_0xb406('0x26')](respondWithFilteredResult(_0x58bc0a,_0x52a533))[_0xb406('0x41')](handleError(_0x58bc0a,null));};exports[_0xb406('0x42')]=function(_0x4e4764,_0x1d273c){var _0x214be2={'raw':![],'where':{'id':_0x4e4764[_0xb406('0x43')]['id']}},_0x153a9b={};_0x153a9b['model']=_[_0xb406('0x31')](db[_0xb406('0x2c')][_0xb406('0x2d')]);_0x153a9b[_0xb406('0x30')]=_[_0xb406('0x31')](_0x4e4764[_0xb406('0x30')]);_0x153a9b[_0xb406('0x3b')]=_[_0xb406('0x32')](_0x153a9b[_0xb406('0x2f')],_0x153a9b[_0xb406('0x30')]);_0x214be2['attributes']=_[_0xb406('0x32')](_0x153a9b[_0xb406('0x2f')],qs['fields'](_0x4e4764[_0xb406('0x30')]['fields']));_0x214be2[_0xb406('0x34')]=_0x214be2[_0xb406('0x34')][_0xb406('0x35')]?_0x214be2[_0xb406('0x34')]:_0x153a9b[_0xb406('0x2f')];if(_0x4e4764[_0xb406('0x30')][_0xb406('0x3f')]){_0x214be2['include']=[{'all':!![]}];}_0x214be2=_[_0xb406('0x44')]({},_0x214be2,_0x4e4764[_0xb406('0x45')]);return db[_0xb406('0x2c')][_0xb406('0x46')](_0x214be2)['then'](handleEntityNotFound(_0x1d273c,null))[_0xb406('0x26')](respondWithResult(_0x1d273c,null))['catch'](handleError(_0x1d273c,null));};exports[_0xb406('0x47')]=function(_0x22d96f,_0xd30f94){return db[_0xb406('0x2c')]['create'](_0x22d96f[_0xb406('0x48')],{})[_0xb406('0x26')](respondWithResult(_0xd30f94,0xc9))[_0xb406('0x41')](handleError(_0xd30f94,null));};exports['update']=function(_0x417bea,_0x1ff9c2){if(_0x417bea[_0xb406('0x48')]['id']){delete _0x417bea['body']['id'];}return db[_0xb406('0x2c')][_0xb406('0x46')]({'where':{'id':_0x417bea[_0xb406('0x43')]['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x1ff9c2,null))[_0xb406('0x26')](saveUpdates(_0x417bea[_0xb406('0x48')],null))[_0xb406('0x26')](respondWithResult(_0x1ff9c2,null))[_0xb406('0x41')](handleError(_0x1ff9c2,null));};exports[_0xb406('0x27')]=function(_0x9a7002,_0x57fc6a){return db['DeskConfiguration'][_0xb406('0x46')]({'where':{'id':_0x9a7002['params']['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x57fc6a,null))[_0xb406('0x26')](removeEntity(_0x57fc6a,null))[_0xb406('0x41')](handleError(_0x57fc6a,null));};exports['getFields']=function(_0x45ff5f,_0x3c61c2,_0x301e7a){var _0x164e3f={};var _0x300d95={};var _0x39dd69;var _0x4fa34d;return db['DeskConfiguration'][_0xb406('0x49')]({'where':{'id':_0x45ff5f['params']['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x3c61c2,null))[_0xb406('0x26')](function(_0x315484){if(_0x315484){_0x39dd69=_0x315484;_0x300d95[_0xb406('0x2f')]=_['keys'](db[_0xb406('0x4a')][_0xb406('0x2d')]);_0x300d95[_0xb406('0x30')]=_['keys'](_0x45ff5f[_0xb406('0x30')]);_0x300d95[_0xb406('0x3b')]=_[_0xb406('0x32')](_0x300d95[_0xb406('0x2f')],_0x300d95[_0xb406('0x30')]);_0x164e3f['attributes']=_[_0xb406('0x32')](_0x300d95['model'],qs[_0xb406('0x33')](_0x45ff5f[_0xb406('0x30')]['fields']));_0x164e3f[_0xb406('0x34')]=_0x164e3f[_0xb406('0x34')][_0xb406('0x35')]?_0x164e3f['attributes']:_0x300d95[_0xb406('0x2f')];_0x164e3f['order']=qs[_0xb406('0x39')](_0x45ff5f['query'][_0xb406('0x39')]);_0x164e3f[_0xb406('0x3a')]=qs[_0xb406('0x3b')](_[_0xb406('0x3c')](_0x45ff5f[_0xb406('0x30')],_0x300d95[_0xb406('0x3b')]));if(_0x45ff5f['query'][_0xb406('0x3d')]){_0x164e3f[_0xb406('0x3a')]=_[_0xb406('0x44')](_0x164e3f[_0xb406('0x3a')],{'$or':_[_0xb406('0x2b')](_0x164e3f[_0xb406('0x34')],function(_0x5ef241){var _0xcd5950={};_0xcd5950[_0x5ef241]={'$like':'%'+_0x45ff5f['query'][_0xb406('0x3d')]+'%'};return _0xcd5950;})});}_0x164e3f=_[_0xb406('0x44')]({},_0x164e3f,_0x45ff5f[_0xb406('0x45')]);return _0x39dd69['getFields'](_0x164e3f);}})[_0xb406('0x26')](function(_0x4e143e){if(_0x4e143e){_0x4fa34d=_0x4e143e[_0xb406('0x35')];if(!_0x45ff5f[_0xb406('0x30')][_0xb406('0x36')](_0xb406('0x37'))){_0x164e3f[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x45ff5f[_0xb406('0x30')][_0xb406('0x1e')]);_0x164e3f[_0xb406('0x1d')]=qs[_0xb406('0x1d')](_0x45ff5f[_0xb406('0x30')][_0xb406('0x1d')]);}return _0x39dd69['getFields'](_0x164e3f);}})['then'](function(_0x349525){if(_0x349525){return _0x349525?{'count':_0x4fa34d,'rows':_0x349525}:null;}})[_0xb406('0x26')](respondWithResult(_0x3c61c2,null))[_0xb406('0x41')](handleError(_0x3c61c2,null));};exports['getSubjects']=function(_0x428b04,_0x305ec3,_0x1beb1d){var _0x4bcd62={};var _0x27801a={};var _0x14cdf9;var _0x1a0d38;return db[_0xb406('0x2c')]['findOne']({'where':{'id':_0x428b04[_0xb406('0x43')]['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x305ec3,null))[_0xb406('0x26')](function(_0x4ffca5){if(_0x4ffca5){_0x14cdf9=_0x4ffca5;_0x27801a[_0xb406('0x2f')]=_[_0xb406('0x31')](db[_0xb406('0x4a')][_0xb406('0x2d')]);_0x27801a['query']=_[_0xb406('0x31')](_0x428b04[_0xb406('0x30')]);_0x27801a[_0xb406('0x3b')]=_[_0xb406('0x32')](_0x27801a[_0xb406('0x2f')],_0x27801a['query']);_0x4bcd62[_0xb406('0x34')]=_[_0xb406('0x32')](_0x27801a[_0xb406('0x2f')],qs['fields'](_0x428b04[_0xb406('0x30')]['fields']));_0x4bcd62['attributes']=_0x4bcd62[_0xb406('0x34')][_0xb406('0x35')]?_0x4bcd62[_0xb406('0x34')]:_0x27801a[_0xb406('0x2f')];_0x4bcd62['order']=qs[_0xb406('0x39')](_0x428b04[_0xb406('0x30')][_0xb406('0x39')]);_0x4bcd62['where']=qs[_0xb406('0x3b')](_['pick'](_0x428b04['query'],_0x27801a[_0xb406('0x3b')]));if(_0x428b04['query'][_0xb406('0x3d')]){_0x4bcd62[_0xb406('0x3a')]=_[_0xb406('0x44')](_0x4bcd62['where'],{'$or':_['map'](_0x4bcd62[_0xb406('0x34')],function(_0xedc27e){var _0x442b20={};_0x442b20[_0xedc27e]={'$like':'%'+_0x428b04['query'][_0xb406('0x3d')]+'%'};return _0x442b20;})});}_0x4bcd62=_[_0xb406('0x44')]({},_0x4bcd62,_0x428b04['options']);return _0x14cdf9[_0xb406('0x4b')](_0x4bcd62);}})[_0xb406('0x26')](function(_0x556462){if(_0x556462){_0x1a0d38=_0x556462['length'];if(!_0x428b04[_0xb406('0x30')][_0xb406('0x36')](_0xb406('0x37'))){_0x4bcd62[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x428b04['query'][_0xb406('0x1e')]);_0x4bcd62[_0xb406('0x1d')]=qs['offset'](_0x428b04[_0xb406('0x30')]['offset']);}return _0x14cdf9[_0xb406('0x4b')](_0x4bcd62);}})[_0xb406('0x26')](function(_0x1ee8b5){if(_0x1ee8b5){return _0x1ee8b5?{'count':_0x1a0d38,'rows':_0x1ee8b5}:null;}})[_0xb406('0x26')](respondWithResult(_0x305ec3,null))['catch'](handleError(_0x305ec3,null));};exports[_0xb406('0x4c')]=function(_0x104276,_0x48ad73,_0x512fa8){var _0x1c8758={};var _0x1e8cfd={};var _0xe5f95d;var _0x89ee5b;return db[_0xb406('0x2c')][_0xb406('0x49')]({'where':{'id':_0x104276[_0xb406('0x43')]['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x48ad73,null))['then'](function(_0x2a2953){if(_0x2a2953){_0xe5f95d=_0x2a2953;_0x1e8cfd[_0xb406('0x2f')]=_[_0xb406('0x31')](db['DeskField'][_0xb406('0x2d')]);_0x1e8cfd[_0xb406('0x30')]=_['keys'](_0x104276[_0xb406('0x30')]);_0x1e8cfd['filters']=_[_0xb406('0x32')](_0x1e8cfd[_0xb406('0x2f')],_0x1e8cfd[_0xb406('0x30')]);_0x1c8758[_0xb406('0x34')]=_['intersection'](_0x1e8cfd['model'],qs[_0xb406('0x33')](_0x104276['query'][_0xb406('0x33')]));_0x1c8758[_0xb406('0x34')]=_0x1c8758[_0xb406('0x34')][_0xb406('0x35')]?_0x1c8758['attributes']:_0x1e8cfd[_0xb406('0x2f')];_0x1c8758[_0xb406('0x38')]=qs[_0xb406('0x39')](_0x104276[_0xb406('0x30')][_0xb406('0x39')]);_0x1c8758[_0xb406('0x3a')]=qs[_0xb406('0x3b')](_['pick'](_0x104276[_0xb406('0x30')],_0x1e8cfd[_0xb406('0x3b')]));if(_0x104276[_0xb406('0x30')][_0xb406('0x3d')]){_0x1c8758[_0xb406('0x3a')]=_[_0xb406('0x44')](_0x1c8758[_0xb406('0x3a')],{'$or':_[_0xb406('0x2b')](_0x1c8758[_0xb406('0x34')],function(_0x26ea11){var _0x52baa7={};_0x52baa7[_0x26ea11]={'$like':'%'+_0x104276[_0xb406('0x30')][_0xb406('0x3d')]+'%'};return _0x52baa7;})});}_0x1c8758=_[_0xb406('0x44')]({},_0x1c8758,_0x104276[_0xb406('0x45')]);return _0xe5f95d[_0xb406('0x4c')](_0x1c8758);}})['then'](function(_0x53517e){if(_0x53517e){_0x89ee5b=_0x53517e[_0xb406('0x35')];if(!_0x104276[_0xb406('0x30')]['hasOwnProperty'](_0xb406('0x37'))){_0x1c8758[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x104276['query'][_0xb406('0x1e')]);_0x1c8758[_0xb406('0x1d')]=qs[_0xb406('0x1d')](_0x104276['query']['offset']);}return _0xe5f95d['getDescriptions'](_0x1c8758);}})[_0xb406('0x26')](function(_0x2f548b){if(_0x2f548b){return _0x2f548b?{'count':_0x89ee5b,'rows':_0x2f548b}:null;}})['then'](respondWithResult(_0x48ad73,null))[_0xb406('0x41')](handleError(_0x48ad73,null));};exports[_0xb406('0x4d')]=function(_0x2ffaea,_0x500509,_0x514a5c){var _0x3b47ae={};var _0x84284e={};var _0x46b1f1;var _0x454457;return db['DeskConfiguration'][_0xb406('0x49')]({'where':{'id':_0x2ffaea[_0xb406('0x43')]['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x500509,null))['then'](function(_0x5c0d53){if(_0x5c0d53){_0x46b1f1=_0x5c0d53;_0x84284e['model']=_[_0xb406('0x31')](db[_0xb406('0x4e')][_0xb406('0x2d')]);_0x84284e[_0xb406('0x30')]=_[_0xb406('0x31')](_0x2ffaea[_0xb406('0x30')]);_0x84284e[_0xb406('0x3b')]=_[_0xb406('0x32')](_0x84284e[_0xb406('0x2f')],_0x84284e[_0xb406('0x30')]);_0x3b47ae[_0xb406('0x34')]=_[_0xb406('0x32')](_0x84284e[_0xb406('0x2f')],qs['fields'](_0x2ffaea[_0xb406('0x30')][_0xb406('0x33')]));_0x3b47ae[_0xb406('0x34')]=_0x3b47ae[_0xb406('0x34')][_0xb406('0x35')]?_0x3b47ae[_0xb406('0x34')]:_0x84284e['model'];_0x3b47ae[_0xb406('0x38')]=qs[_0xb406('0x39')](_0x2ffaea[_0xb406('0x30')][_0xb406('0x39')]);_0x3b47ae[_0xb406('0x3a')]=qs[_0xb406('0x3b')](_['pick'](_0x2ffaea['query'],_0x84284e[_0xb406('0x3b')]));if(_0x2ffaea['query'][_0xb406('0x3d')]){_0x3b47ae[_0xb406('0x3a')]=_['merge'](_0x3b47ae[_0xb406('0x3a')],{'$or':_[_0xb406('0x2b')](_0x3b47ae[_0xb406('0x34')],function(_0x326213){var _0x987173={};_0x987173[_0x326213]={'$like':'%'+_0x2ffaea['query'][_0xb406('0x3d')]+'%'};return _0x987173;})});}_0x3b47ae=_[_0xb406('0x44')]({},_0x3b47ae,_0x2ffaea[_0xb406('0x45')]);return _0x46b1f1[_0xb406('0x4d')](_0x3b47ae);}})[_0xb406('0x26')](function(_0x1d8b11){if(_0x1d8b11){_0x454457=_0x1d8b11[_0xb406('0x35')];if(!_0x2ffaea[_0xb406('0x30')][_0xb406('0x36')]('nolimit')){_0x3b47ae[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x2ffaea['query'][_0xb406('0x1e')]);_0x3b47ae[_0xb406('0x1d')]=qs[_0xb406('0x1d')](_0x2ffaea[_0xb406('0x30')][_0xb406('0x1d')]);}return _0x46b1f1[_0xb406('0x4d')](_0x3b47ae);}})[_0xb406('0x26')](function(_0x4c776b){if(_0x4c776b){return _0x4c776b?{'count':_0x454457,'rows':_0x4c776b}:null;}})[_0xb406('0x26')](respondWithResult(_0x500509,null))[_0xb406('0x41')](handleError(_0x500509,null));};exports[_0xb406('0x4f')]=function(_0x556e44,_0x35c0cd,_0x16b197){if(_0x556e44['body']['id']){delete _0x556e44['body']['id'];}return db[_0xb406('0x2c')][_0xb406('0x49')]({'where':{'id':_0x556e44[_0xb406('0x43')]['id']}})['then'](handleEntityNotFound(_0x35c0cd,null))[_0xb406('0x26')](function(_0x18c8d4){if(_0x18c8d4){return _0x18c8d4[_0xb406('0x4f')](_0x556e44[_0xb406('0x48')][_0xb406('0x50')]||[]);}return null;})[_0xb406('0x26')](respondWithResult(_0x35c0cd,null))['catch'](handleError(_0x35c0cd,null));}; \ No newline at end of file +var _0xb197=['pick','filter','merge','VIRTUAL','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','update','body','findOne','getFields','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range','json','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xb197,0x117));var _0x7b19=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0xb197[_0x4bed75];return _0x2dd8e8;};'use strict';var emlformat=require(_0x7b19('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b19('0x1'));var BPromise=require(_0x7b19('0x2'));var Mustache=require(_0x7b19('0x3'));var util=require(_0x7b19('0x4'));var path=require(_0x7b19('0x5'));var sox=require(_0x7b19('0x6'));var csv=require(_0x7b19('0x7'));var ejs=require(_0x7b19('0x8'));var fs=require('fs');var fs_extra=require(_0x7b19('0x9'));var _=require(_0x7b19('0xa'));var squel=require('squel');var crypto=require(_0x7b19('0xb'));var jsforce=require(_0x7b19('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7b19('0x7'));var querystring=require('querystring');var Papa=require(_0x7b19('0xd'));var Redis=require(_0x7b19('0xe'));var authService=require(_0x7b19('0xf'));var qs=require(_0x7b19('0x10'));var as=require(_0x7b19('0x11'));var hardwareService=require(_0x7b19('0x12'));var logger=require(_0x7b19('0x13'))(_0x7b19('0x14'));var utils=require(_0x7b19('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7b19('0x16'))['db'];function respondWithStatusCode(_0x5d38b3,_0x12a69c){_0x12a69c=_0x12a69c||0xcc;return function(_0x48d5f8){if(_0x48d5f8){return _0x5d38b3['sendStatus'](_0x12a69c);}return _0x5d38b3[_0x7b19('0x17')](_0x12a69c)[_0x7b19('0x18')]();};}function respondWithResult(_0x100d03,_0x1ce53d){_0x1ce53d=_0x1ce53d||0xc8;return function(_0x5e6c31){if(_0x5e6c31){return _0x100d03['status'](_0x1ce53d)['json'](_0x5e6c31);}};}function respondWithFilteredResult(_0xdad8a7,_0x602bdf){return function(_0x810f4){if(_0x810f4){var _0x2899d7=typeof _0x602bdf['offset']==='undefined'&&typeof _0x602bdf['limit']===_0x7b19('0x19');var _0x213bfe=_0x810f4[_0x7b19('0x1a')];var _0x15b5a4=_0x2899d7?0x0:_0x602bdf[_0x7b19('0x1b')];var _0x10ea23=_0x2899d7?_0x810f4[_0x7b19('0x1a')]:_0x602bdf['offset']+_0x602bdf[_0x7b19('0x1c')];var _0x476a44;if(_0x10ea23>=_0x213bfe){_0x10ea23=_0x213bfe;_0x476a44=0xc8;}else{_0x476a44=0xce;}_0xdad8a7['status'](_0x476a44);return _0xdad8a7[_0x7b19('0x1d')](_0x7b19('0x1e'),_0x15b5a4+'-'+_0x10ea23+'/'+_0x213bfe)[_0x7b19('0x1f')](_0x810f4);}return null;};}function patchUpdates(_0x577481){return function(_0x4331d7){try{jsonpatch['apply'](_0x4331d7,_0x577481,!![]);}catch(_0xd07a53){return BPromise['reject'](_0xd07a53);}return _0x4331d7[_0x7b19('0x20')]();};}function saveUpdates(_0x26afb2,_0x432921){return function(_0x19a01d){if(_0x19a01d){return _0x19a01d['update'](_0x26afb2)[_0x7b19('0x21')](function(_0x2d3b06){return _0x2d3b06;});}return null;};}function removeEntity(_0x255881,_0x4512d0){return function(_0x252a9d){if(_0x252a9d){return _0x252a9d[_0x7b19('0x22')]()[_0x7b19('0x21')](function(){_0x255881[_0x7b19('0x17')](0xcc)[_0x7b19('0x18')]();});}};}function handleEntityNotFound(_0x2c5871,_0xb1f03){return function(_0x8a32f5){if(!_0x8a32f5){_0x2c5871[_0x7b19('0x23')](0x194);}return _0x8a32f5;};}function handleError(_0x4c408b,_0x558f2e){_0x558f2e=_0x558f2e||0x1f4;return function(_0x403c83){logger[_0x7b19('0x24')](_0x403c83[_0x7b19('0x25')]);if(_0x403c83[_0x7b19('0x26')]){delete _0x403c83[_0x7b19('0x26')];}_0x4c408b['status'](_0x558f2e)[_0x7b19('0x27')](_0x403c83);};}exports[_0x7b19('0x28')]=function(_0x12d0e3,_0x286529){var _0x3f48de={},_0x1648c2={},_0x54b0d8={'count':0x0,'rows':[]};var _0x40c39d=_[_0x7b19('0x29')](db['DeskConfiguration'][_0x7b19('0x2a')],function(_0x172f63){return{'name':_0x172f63['fieldName'],'type':_0x172f63[_0x7b19('0x2b')][_0x7b19('0x2c')]};});_0x1648c2['model']=_[_0x7b19('0x29')](_0x40c39d,'name');_0x1648c2[_0x7b19('0x2d')]=_['keys'](_0x12d0e3[_0x7b19('0x2d')]);_0x1648c2[_0x7b19('0x2e')]=_[_0x7b19('0x2f')](_0x1648c2['model'],_0x1648c2[_0x7b19('0x2d')]);_0x3f48de[_0x7b19('0x30')]=_['intersection'](_0x1648c2[_0x7b19('0x31')],qs['fields'](_0x12d0e3['query'][_0x7b19('0x32')]));_0x3f48de['attributes']=_0x3f48de['attributes'][_0x7b19('0x33')]?_0x3f48de[_0x7b19('0x30')]:_0x1648c2[_0x7b19('0x31')];if(!_0x12d0e3['query'][_0x7b19('0x34')](_0x7b19('0x35'))){_0x3f48de[_0x7b19('0x1c')]=qs[_0x7b19('0x1c')](_0x12d0e3[_0x7b19('0x2d')]['limit']);_0x3f48de[_0x7b19('0x1b')]=qs[_0x7b19('0x1b')](_0x12d0e3['query'][_0x7b19('0x1b')]);}_0x3f48de[_0x7b19('0x36')]=qs[_0x7b19('0x37')](_0x12d0e3[_0x7b19('0x2d')]['sort']);_0x3f48de[_0x7b19('0x38')]=qs[_0x7b19('0x2e')](_[_0x7b19('0x39')](_0x12d0e3[_0x7b19('0x2d')],_0x1648c2[_0x7b19('0x2e')]),_0x40c39d);if(_0x12d0e3[_0x7b19('0x2d')][_0x7b19('0x3a')]){_0x3f48de[_0x7b19('0x38')]=_[_0x7b19('0x3b')](_0x3f48de[_0x7b19('0x38')],{'$or':_[_0x7b19('0x29')](_0x40c39d,function(_0x1152ba){if(_0x1152ba[_0x7b19('0x2b')]!==_0x7b19('0x3c')){var _0x3da3a4={};_0x3da3a4[_0x1152ba[_0x7b19('0x26')]]={'$like':'%'+_0x12d0e3[_0x7b19('0x2d')][_0x7b19('0x3a')]+'%'};return _0x3da3a4;}})});}_0x3f48de=_[_0x7b19('0x3b')]({},_0x3f48de,_0x12d0e3['options']);var _0x251d48={'where':_0x3f48de[_0x7b19('0x38')]};return db[_0x7b19('0x3d')][_0x7b19('0x1a')](_0x251d48)[_0x7b19('0x21')](function(_0x8fb2d){_0x54b0d8[_0x7b19('0x1a')]=_0x8fb2d;if(_0x12d0e3[_0x7b19('0x2d')][_0x7b19('0x3e')]){_0x3f48de[_0x7b19('0x3f')]=[{'all':!![]}];}return db[_0x7b19('0x3d')][_0x7b19('0x40')](_0x3f48de);})[_0x7b19('0x21')](function(_0x5ebfea){_0x54b0d8[_0x7b19('0x41')]=_0x5ebfea;return _0x54b0d8;})[_0x7b19('0x21')](respondWithFilteredResult(_0x286529,_0x3f48de))[_0x7b19('0x42')](handleError(_0x286529,null));};exports[_0x7b19('0x43')]=function(_0x57cffa,_0x41770a){var _0x19765a={'raw':![],'where':{'id':_0x57cffa[_0x7b19('0x44')]['id']}},_0x381837={};_0x381837[_0x7b19('0x31')]=_['keys'](db[_0x7b19('0x3d')][_0x7b19('0x2a')]);_0x381837[_0x7b19('0x2d')]=_[_0x7b19('0x45')](_0x57cffa['query']);_0x381837['filters']=_[_0x7b19('0x2f')](_0x381837[_0x7b19('0x31')],_0x381837['query']);_0x19765a[_0x7b19('0x30')]=_[_0x7b19('0x2f')](_0x381837[_0x7b19('0x31')],qs[_0x7b19('0x32')](_0x57cffa[_0x7b19('0x2d')]['fields']));_0x19765a['attributes']=_0x19765a[_0x7b19('0x30')][_0x7b19('0x33')]?_0x19765a[_0x7b19('0x30')]:_0x381837[_0x7b19('0x31')];if(_0x57cffa[_0x7b19('0x2d')]['includeAll']){_0x19765a[_0x7b19('0x3f')]=[{'all':!![]}];}_0x19765a=_[_0x7b19('0x3b')]({},_0x19765a,_0x57cffa[_0x7b19('0x46')]);return db['DeskConfiguration'][_0x7b19('0x47')](_0x19765a)[_0x7b19('0x21')](handleEntityNotFound(_0x41770a,null))[_0x7b19('0x21')](respondWithResult(_0x41770a,null))[_0x7b19('0x42')](handleError(_0x41770a,null));};exports[_0x7b19('0x48')]=function(_0x1620a2,_0x4224ad){return db[_0x7b19('0x3d')][_0x7b19('0x48')](_0x1620a2['body'],{})['then'](respondWithResult(_0x4224ad,0xc9))[_0x7b19('0x42')](handleError(_0x4224ad,null));};exports[_0x7b19('0x49')]=function(_0x11d77c,_0x895dca){if(_0x11d77c['body']['id']){delete _0x11d77c[_0x7b19('0x4a')]['id'];}return db[_0x7b19('0x3d')][_0x7b19('0x47')]({'where':{'id':_0x11d77c[_0x7b19('0x44')]['id']}})[_0x7b19('0x21')](handleEntityNotFound(_0x895dca,null))[_0x7b19('0x21')](saveUpdates(_0x11d77c[_0x7b19('0x4a')],null))[_0x7b19('0x21')](respondWithResult(_0x895dca,null))[_0x7b19('0x42')](handleError(_0x895dca,null));};exports[_0x7b19('0x22')]=function(_0x43558d,_0xedd99d){return db[_0x7b19('0x3d')][_0x7b19('0x47')]({'where':{'id':_0x43558d[_0x7b19('0x44')]['id']}})['then'](handleEntityNotFound(_0xedd99d,null))['then'](removeEntity(_0xedd99d,null))[_0x7b19('0x42')](handleError(_0xedd99d,null));};exports['getFields']=function(_0x7badfe,_0x56010a,_0x394d0f){var _0x5e3e21={};var _0x2b0146={};var _0x1d7bf2;var _0x20b20d;return db['DeskConfiguration'][_0x7b19('0x4b')]({'where':{'id':_0x7badfe[_0x7b19('0x44')]['id']}})['then'](handleEntityNotFound(_0x56010a,null))['then'](function(_0x54a0d6){if(_0x54a0d6){_0x1d7bf2=_0x54a0d6;_0x2b0146[_0x7b19('0x31')]=_[_0x7b19('0x45')](db['DeskField'][_0x7b19('0x2a')]);_0x2b0146[_0x7b19('0x2d')]=_['keys'](_0x7badfe[_0x7b19('0x2d')]);_0x2b0146[_0x7b19('0x2e')]=_[_0x7b19('0x2f')](_0x2b0146[_0x7b19('0x31')],_0x2b0146[_0x7b19('0x2d')]);_0x5e3e21[_0x7b19('0x30')]=_[_0x7b19('0x2f')](_0x2b0146[_0x7b19('0x31')],qs[_0x7b19('0x32')](_0x7badfe[_0x7b19('0x2d')][_0x7b19('0x32')]));_0x5e3e21[_0x7b19('0x30')]=_0x5e3e21[_0x7b19('0x30')][_0x7b19('0x33')]?_0x5e3e21[_0x7b19('0x30')]:_0x2b0146[_0x7b19('0x31')];_0x5e3e21[_0x7b19('0x36')]=qs[_0x7b19('0x37')](_0x7badfe[_0x7b19('0x2d')]['sort']);_0x5e3e21['where']=qs[_0x7b19('0x2e')](_[_0x7b19('0x39')](_0x7badfe['query'],_0x2b0146[_0x7b19('0x2e')]));if(_0x7badfe[_0x7b19('0x2d')][_0x7b19('0x3a')]){_0x5e3e21[_0x7b19('0x38')]=_['merge'](_0x5e3e21[_0x7b19('0x38')],{'$or':_[_0x7b19('0x29')](_0x5e3e21['attributes'],function(_0xcc09e8){var _0x3fd984={};_0x3fd984[_0xcc09e8]={'$like':'%'+_0x7badfe['query'][_0x7b19('0x3a')]+'%'};return _0x3fd984;})});}_0x5e3e21=_[_0x7b19('0x3b')]({},_0x5e3e21,_0x7badfe[_0x7b19('0x46')]);return _0x1d7bf2[_0x7b19('0x4c')](_0x5e3e21);}})[_0x7b19('0x21')](function(_0x52979d){if(_0x52979d){_0x20b20d=_0x52979d[_0x7b19('0x33')];if(!_0x7badfe[_0x7b19('0x2d')][_0x7b19('0x34')](_0x7b19('0x35'))){_0x5e3e21[_0x7b19('0x1c')]=qs['limit'](_0x7badfe[_0x7b19('0x2d')][_0x7b19('0x1c')]);_0x5e3e21[_0x7b19('0x1b')]=qs['offset'](_0x7badfe[_0x7b19('0x2d')][_0x7b19('0x1b')]);}return _0x1d7bf2['getFields'](_0x5e3e21);}})[_0x7b19('0x21')](function(_0x4c842d){if(_0x4c842d){return _0x4c842d?{'count':_0x20b20d,'rows':_0x4c842d}:null;}})[_0x7b19('0x21')](respondWithResult(_0x56010a,null))[_0x7b19('0x42')](handleError(_0x56010a,null));};exports[_0x7b19('0x4d')]=function(_0x395f33,_0x214c65,_0xbe8fad){var _0x362207={};var _0x3170c3={};var _0x59e286;var _0x2064b2;return db['DeskConfiguration'][_0x7b19('0x4b')]({'where':{'id':_0x395f33['params']['id']}})[_0x7b19('0x21')](handleEntityNotFound(_0x214c65,null))[_0x7b19('0x21')](function(_0x52edc8){if(_0x52edc8){_0x59e286=_0x52edc8;_0x3170c3[_0x7b19('0x31')]=_[_0x7b19('0x45')](db['DeskField'][_0x7b19('0x2a')]);_0x3170c3[_0x7b19('0x2d')]=_['keys'](_0x395f33[_0x7b19('0x2d')]);_0x3170c3[_0x7b19('0x2e')]=_[_0x7b19('0x2f')](_0x3170c3[_0x7b19('0x31')],_0x3170c3[_0x7b19('0x2d')]);_0x362207[_0x7b19('0x30')]=_['intersection'](_0x3170c3[_0x7b19('0x31')],qs[_0x7b19('0x32')](_0x395f33[_0x7b19('0x2d')][_0x7b19('0x32')]));_0x362207[_0x7b19('0x30')]=_0x362207[_0x7b19('0x30')][_0x7b19('0x33')]?_0x362207[_0x7b19('0x30')]:_0x3170c3[_0x7b19('0x31')];_0x362207[_0x7b19('0x36')]=qs['sort'](_0x395f33[_0x7b19('0x2d')][_0x7b19('0x37')]);_0x362207['where']=qs[_0x7b19('0x2e')](_[_0x7b19('0x39')](_0x395f33[_0x7b19('0x2d')],_0x3170c3[_0x7b19('0x2e')]));if(_0x395f33[_0x7b19('0x2d')][_0x7b19('0x3a')]){_0x362207[_0x7b19('0x38')]=_['merge'](_0x362207[_0x7b19('0x38')],{'$or':_[_0x7b19('0x29')](_0x362207[_0x7b19('0x30')],function(_0x48a3df){var _0x186919={};_0x186919[_0x48a3df]={'$like':'%'+_0x395f33[_0x7b19('0x2d')]['filter']+'%'};return _0x186919;})});}_0x362207=_[_0x7b19('0x3b')]({},_0x362207,_0x395f33[_0x7b19('0x46')]);return _0x59e286[_0x7b19('0x4d')](_0x362207);}})[_0x7b19('0x21')](function(_0x31e87c){if(_0x31e87c){_0x2064b2=_0x31e87c[_0x7b19('0x33')];if(!_0x395f33[_0x7b19('0x2d')][_0x7b19('0x34')](_0x7b19('0x35'))){_0x362207[_0x7b19('0x1c')]=qs[_0x7b19('0x1c')](_0x395f33['query'][_0x7b19('0x1c')]);_0x362207[_0x7b19('0x1b')]=qs[_0x7b19('0x1b')](_0x395f33[_0x7b19('0x2d')]['offset']);}return _0x59e286[_0x7b19('0x4d')](_0x362207);}})[_0x7b19('0x21')](function(_0x3761cd){if(_0x3761cd){return _0x3761cd?{'count':_0x2064b2,'rows':_0x3761cd}:null;}})[_0x7b19('0x21')](respondWithResult(_0x214c65,null))[_0x7b19('0x42')](handleError(_0x214c65,null));};exports['getDescriptions']=function(_0x3c1cfd,_0x54ffb1,_0x5dc88f){var _0x4ecf3a={};var _0x4636c6={};var _0x3938a9;var _0x51cfb9;return db[_0x7b19('0x3d')]['findOne']({'where':{'id':_0x3c1cfd[_0x7b19('0x44')]['id']}})[_0x7b19('0x21')](handleEntityNotFound(_0x54ffb1,null))[_0x7b19('0x21')](function(_0x35a058){if(_0x35a058){_0x3938a9=_0x35a058;_0x4636c6[_0x7b19('0x31')]=_[_0x7b19('0x45')](db[_0x7b19('0x4e')][_0x7b19('0x2a')]);_0x4636c6[_0x7b19('0x2d')]=_[_0x7b19('0x45')](_0x3c1cfd['query']);_0x4636c6[_0x7b19('0x2e')]=_['intersection'](_0x4636c6['model'],_0x4636c6[_0x7b19('0x2d')]);_0x4ecf3a[_0x7b19('0x30')]=_['intersection'](_0x4636c6['model'],qs['fields'](_0x3c1cfd[_0x7b19('0x2d')][_0x7b19('0x32')]));_0x4ecf3a[_0x7b19('0x30')]=_0x4ecf3a[_0x7b19('0x30')][_0x7b19('0x33')]?_0x4ecf3a['attributes']:_0x4636c6[_0x7b19('0x31')];_0x4ecf3a['order']=qs['sort'](_0x3c1cfd[_0x7b19('0x2d')][_0x7b19('0x37')]);_0x4ecf3a[_0x7b19('0x38')]=qs['filters'](_['pick'](_0x3c1cfd[_0x7b19('0x2d')],_0x4636c6[_0x7b19('0x2e')]));if(_0x3c1cfd[_0x7b19('0x2d')][_0x7b19('0x3a')]){_0x4ecf3a[_0x7b19('0x38')]=_[_0x7b19('0x3b')](_0x4ecf3a[_0x7b19('0x38')],{'$or':_['map'](_0x4ecf3a['attributes'],function(_0x168129){var _0x370dc4={};_0x370dc4[_0x168129]={'$like':'%'+_0x3c1cfd[_0x7b19('0x2d')][_0x7b19('0x3a')]+'%'};return _0x370dc4;})});}_0x4ecf3a=_[_0x7b19('0x3b')]({},_0x4ecf3a,_0x3c1cfd['options']);return _0x3938a9[_0x7b19('0x4f')](_0x4ecf3a);}})[_0x7b19('0x21')](function(_0x416eb8){if(_0x416eb8){_0x51cfb9=_0x416eb8[_0x7b19('0x33')];if(!_0x3c1cfd['query'][_0x7b19('0x34')]('nolimit')){_0x4ecf3a[_0x7b19('0x1c')]=qs['limit'](_0x3c1cfd[_0x7b19('0x2d')][_0x7b19('0x1c')]);_0x4ecf3a[_0x7b19('0x1b')]=qs[_0x7b19('0x1b')](_0x3c1cfd[_0x7b19('0x2d')][_0x7b19('0x1b')]);}return _0x3938a9[_0x7b19('0x4f')](_0x4ecf3a);}})[_0x7b19('0x21')](function(_0x5ef452){if(_0x5ef452){return _0x5ef452?{'count':_0x51cfb9,'rows':_0x5ef452}:null;}})[_0x7b19('0x21')](respondWithResult(_0x54ffb1,null))[_0x7b19('0x42')](handleError(_0x54ffb1,null));};exports[_0x7b19('0x50')]=function(_0x2f9499,_0x33a197,_0x365ab6){var _0x4d3bae={};var _0x1c17e4={};var _0x44a3b5;var _0x15dc3a;return db[_0x7b19('0x3d')][_0x7b19('0x4b')]({'where':{'id':_0x2f9499['params']['id']}})['then'](handleEntityNotFound(_0x33a197,null))[_0x7b19('0x21')](function(_0x190b61){if(_0x190b61){_0x44a3b5=_0x190b61;_0x1c17e4[_0x7b19('0x31')]=_['keys'](db[_0x7b19('0x51')][_0x7b19('0x2a')]);_0x1c17e4[_0x7b19('0x2d')]=_[_0x7b19('0x45')](_0x2f9499[_0x7b19('0x2d')]);_0x1c17e4[_0x7b19('0x2e')]=_[_0x7b19('0x2f')](_0x1c17e4['model'],_0x1c17e4[_0x7b19('0x2d')]);_0x4d3bae[_0x7b19('0x30')]=_[_0x7b19('0x2f')](_0x1c17e4['model'],qs[_0x7b19('0x32')](_0x2f9499[_0x7b19('0x2d')][_0x7b19('0x32')]));_0x4d3bae[_0x7b19('0x30')]=_0x4d3bae[_0x7b19('0x30')][_0x7b19('0x33')]?_0x4d3bae['attributes']:_0x1c17e4[_0x7b19('0x31')];_0x4d3bae['order']=qs[_0x7b19('0x37')](_0x2f9499[_0x7b19('0x2d')]['sort']);_0x4d3bae[_0x7b19('0x38')]=qs['filters'](_[_0x7b19('0x39')](_0x2f9499[_0x7b19('0x2d')],_0x1c17e4[_0x7b19('0x2e')]));if(_0x2f9499[_0x7b19('0x2d')][_0x7b19('0x3a')]){_0x4d3bae[_0x7b19('0x38')]=_['merge'](_0x4d3bae['where'],{'$or':_[_0x7b19('0x29')](_0x4d3bae['attributes'],function(_0x21694f){var _0x5a8be5={};_0x5a8be5[_0x21694f]={'$like':'%'+_0x2f9499[_0x7b19('0x2d')][_0x7b19('0x3a')]+'%'};return _0x5a8be5;})});}_0x4d3bae=_[_0x7b19('0x3b')]({},_0x4d3bae,_0x2f9499[_0x7b19('0x46')]);return _0x44a3b5[_0x7b19('0x50')](_0x4d3bae);}})[_0x7b19('0x21')](function(_0x82bcaa){if(_0x82bcaa){_0x15dc3a=_0x82bcaa[_0x7b19('0x33')];if(!_0x2f9499[_0x7b19('0x2d')][_0x7b19('0x34')](_0x7b19('0x35'))){_0x4d3bae[_0x7b19('0x1c')]=qs['limit'](_0x2f9499[_0x7b19('0x2d')][_0x7b19('0x1c')]);_0x4d3bae[_0x7b19('0x1b')]=qs[_0x7b19('0x1b')](_0x2f9499[_0x7b19('0x2d')]['offset']);}return _0x44a3b5[_0x7b19('0x50')](_0x4d3bae);}})['then'](function(_0x561248){if(_0x561248){return _0x561248?{'count':_0x15dc3a,'rows':_0x561248}:null;}})['then'](respondWithResult(_0x33a197,null))[_0x7b19('0x42')](handleError(_0x33a197,null));};exports[_0x7b19('0x52')]=function(_0xf4c0d5,_0x3ed897,_0x3f7925){if(_0xf4c0d5[_0x7b19('0x4a')]['id']){delete _0xf4c0d5[_0x7b19('0x4a')]['id'];}return db[_0x7b19('0x3d')]['findOne']({'where':{'id':_0xf4c0d5[_0x7b19('0x44')]['id']}})[_0x7b19('0x21')](handleEntityNotFound(_0x3ed897,null))['then'](function(_0x1f1a78){if(_0x1f1a78){return _0x1f1a78['setTags'](_0xf4c0d5['body'][_0x7b19('0x53')]||[]);}return null;})[_0x7b19('0x21')](respondWithResult(_0x3ed897,null))[_0x7b19('0x42')](handleError(_0x3ed897,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index a15aace..f1e6175 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.model.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1032=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xefe8c9,_0x8ef92b){var _0xbdc408=function(_0x22fac4){while(--_0x22fac4){_0xefe8c9['push'](_0xefe8c9['shift']());}};_0xbdc408(++_0x8ef92b);}(_0x1032,0x1cd));var _0x2103=function(_0x5eb7c3,_0x585115){_0x5eb7c3=_0x5eb7c3-0x0;var _0x395fa2=_0x1032[_0x5eb7c3];return _0x395fa2;};'use strict';var _=require(_0x2103('0x0'));var util=require(_0x2103('0x1'));var logger=require('../../config/logger')(_0x2103('0x2'));var moment=require(_0x2103('0x3'));var BPromise=require(_0x2103('0x4'));var rp=require(_0x2103('0x5'));var fs=require('fs');var path=require(_0x2103('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2103('0x7'));module[_0x2103('0x8')]=function(_0x1321fc,_0x3afb0d){return _0x1321fc[_0x2103('0x9')](_0x2103('0xa'),attributes,{'tableName':_0x2103('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d26=['moment','bluebird','request-promise','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x9d26,0x17d));var _0x69d2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d26[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x69d2('0x0'));var util=require('util');var logger=require(_0x69d2('0x1'))(_0x69d2('0x2'));var moment=require(_0x69d2('0x3'));var BPromise=require(_0x69d2('0x4'));var rp=require(_0x69d2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69d2('0x6'));var config=require('../../config/environment');var attributes=require(_0x69d2('0x7'));module[_0x69d2('0x8')]=function(_0x433136,_0x4f55b0){return _0x433136[_0x69d2('0x9')](_0x69d2('0xa'),attributes,{'tableName':_0x69d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index cea68ba..9969254 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57c3=['rpc','jayson/promise','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x11b918,_0xff7fa8){var _0x23acd5=function(_0x4b8d58){while(--_0x4b8d58){_0x11b918['push'](_0x11b918['shift']());}};_0x23acd5(++_0xff7fa8);}(_0x57c3,0xc2));var _0x357c=function(_0x4205d9,_0x16a883){_0x4205d9=_0x4205d9-0x0;var _0x5ded27=_0x57c3[_0x4205d9];return _0x5ded27;};'use strict';var _=require(_0x357c('0x0'));var util=require(_0x357c('0x1'));var moment=require(_0x357c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x357c('0x3'))['db'];var utils=require(_0x357c('0x4'));var logger=require(_0x357c('0x5'))(_0x357c('0x6'));var config=require('../../config/environment');var jayson=require(_0x357c('0x7'));var client=jayson['client'][_0x357c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x471e56,_0x2320eb,_0x44d3ee){return new BPromise(function(_0x1fc04b,_0x1e4977){return client[_0x357c('0x9')](_0x471e56,_0x44d3ee)['then'](function(_0x5dd3dd){logger[_0x357c('0xa')](_0x357c('0xb'),_0x2320eb,_0x357c('0xc'));logger[_0x357c('0xd')](_0x357c('0xe'),_0x2320eb,_0x357c('0xc'),JSON[_0x357c('0xf')](_0x5dd3dd));if(_0x5dd3dd[_0x357c('0x10')]){if(_0x5dd3dd[_0x357c('0x10')][_0x357c('0x11')]===0x1f4){logger[_0x357c('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2320eb,_0x5dd3dd[_0x357c('0x10')][_0x357c('0x12')]);return _0x1e4977(_0x5dd3dd[_0x357c('0x10')]['message']);}logger['error'](_0x357c('0xb'),_0x2320eb,_0x5dd3dd[_0x357c('0x10')][_0x357c('0x12')]);return _0x1fc04b(_0x5dd3dd[_0x357c('0x10')][_0x357c('0x12')]);}else{logger[_0x357c('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x2320eb,_0x357c('0xc'));_0x1fc04b(_0x5dd3dd[_0x357c('0x13')]['message']);}})['catch'](function(_0x105d19){logger[_0x357c('0x10')](_0x357c('0xb'),_0x2320eb,_0x105d19);_0x1e4977(_0x105d19);});});} \ No newline at end of file +var _0xce2f=['../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','DeskConfiguration,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1ba865,_0x110d26){var _0x35a964=function(_0x221267){while(--_0x221267){_0x1ba865['push'](_0x1ba865['shift']());}};_0x35a964(++_0x110d26);}(_0xce2f,0x18a));var _0xfce2=function(_0x3dcac4,_0x4819b0){_0x3dcac4=_0x3dcac4-0x0;var _0x5d68f4=_0xce2f[_0x3dcac4];return _0x5d68f4;};'use strict';var _=require('lodash');var util=require(_0xfce2('0x0'));var moment=require(_0xfce2('0x1'));var BPromise=require(_0xfce2('0x2'));var rs=require(_0xfce2('0x3'));var fs=require('fs');var Redis=require(_0xfce2('0x4'));var db=require(_0xfce2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfce2('0x6'))('rpc');var config=require(_0xfce2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfce2('0x8')][_0xfce2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13c378,_0x741a25,_0x442065){return new BPromise(function(_0x458b85,_0x27f1d1){return client[_0xfce2('0xa')](_0x13c378,_0x442065)['then'](function(_0x5ce1d6){logger[_0xfce2('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x741a25,_0xfce2('0xc'));logger['debug'](_0xfce2('0xd'),_0x741a25,'request\x20sent',JSON[_0xfce2('0xe')](_0x5ce1d6));if(_0x5ce1d6[_0xfce2('0xf')]){if(_0x5ce1d6[_0xfce2('0xf')]['code']===0x1f4){logger[_0xfce2('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x741a25,_0x5ce1d6[_0xfce2('0xf')][_0xfce2('0x10')]);return _0x27f1d1(_0x5ce1d6[_0xfce2('0xf')][_0xfce2('0x10')]);}logger[_0xfce2('0xf')](_0xfce2('0x11'),_0x741a25,_0x5ce1d6[_0xfce2('0xf')]['message']);return _0x458b85(_0x5ce1d6[_0xfce2('0xf')][_0xfce2('0x10')]);}else{logger['info'](_0xfce2('0x11'),_0x741a25,_0xfce2('0xc'));_0x458b85(_0x5ce1d6['result']['message']);}})[_0xfce2('0x12')](function(_0x4495be){logger['error'](_0xfce2('0x11'),_0x741a25,_0x4495be);_0x27f1d1(_0x4495be);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 36d1bef..e4aa0c9 100644 --- a/server/api/intDeskField/index.js +++ b/server/api/intDeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69c4=['put','update','delete','exports','multer','util','path','express','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4909bb,_0x25fc54){var _0x3423d7=function(_0x2effaa){while(--_0x2effaa){_0x4909bb['push'](_0x4909bb['shift']());}};_0x3423d7(++_0x25fc54);}(_0x69c4,0x1d4));var _0x469c=function(_0x46fb65,_0xeda331){_0x46fb65=_0x46fb65-0x0;var _0x8e1aee=_0x69c4[_0x46fb65];return _0x8e1aee;};'use strict';var multer=require(_0x469c('0x0'));var util=require(_0x469c('0x1'));var path=require(_0x469c('0x2'));var timeout=require('connect-timeout');var express=require(_0x469c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x469c('0x4'));router[_0x469c('0x5')]('/',auth[_0x469c('0x6')](),controller[_0x469c('0x7')]);router[_0x469c('0x5')](_0x469c('0x8'),auth['isAuthenticated'](),controller[_0x469c('0x9')]);router[_0x469c('0xa')]('/',auth[_0x469c('0x6')](),controller[_0x469c('0xb')]);router[_0x469c('0xc')](_0x469c('0x8'),auth[_0x469c('0x6')](),controller[_0x469c('0xd')]);router[_0x469c('0xe')](_0x469c('0x8'),auth[_0x469c('0x6')](),controller['destroy']);module[_0x469c('0xf')]=router; \ No newline at end of file +var _0x173c=['isAuthenticated','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','/:id','show','post','update'];(function(_0x42ea94,_0x127f76){var _0x269d12=function(_0x108ada){while(--_0x108ada){_0x42ea94['push'](_0x42ea94['shift']());}};_0x269d12(++_0x127f76);}(_0x173c,0xf2));var _0xc173=function(_0x4dd092,_0x459ce1){_0x4dd092=_0x4dd092-0x0;var _0x5d1086=_0x173c[_0x4dd092];return _0x5d1086;};'use strict';var multer=require(_0xc173('0x0'));var util=require(_0xc173('0x1'));var path=require(_0xc173('0x2'));var timeout=require(_0xc173('0x3'));var express=require(_0xc173('0x4'));var router=express[_0xc173('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc173('0x6'));var config=require(_0xc173('0x7'));var controller=require(_0xc173('0x8'));router[_0xc173('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc173('0x9')](_0xc173('0xa'),auth['isAuthenticated'](),controller[_0xc173('0xb')]);router[_0xc173('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc173('0xd')]);router['delete'](_0xc173('0xa'),auth[_0xc173('0xe')](),controller[_0xc173('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 1320da6..1e0d178 100644 --- a/server/api/intDeskField/intDeskField.attributes.js +++ b/server/api/intDeskField/intDeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6124=['customVariable','keyValue','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x52f0a6,_0xa3c19f){var _0x2dcee6=function(_0x5ad678){while(--_0x5ad678){_0x52f0a6['push'](_0x52f0a6['shift']());}};_0x2dcee6(++_0xa3c19f);}(_0x6124,0x94));var _0x4612=function(_0x269738,_0x4195d9){_0x269738=_0x269738-0x0;var _0x2b5f42=_0x6124[_0x269738];return _0x2b5f42;};'use strict';var Sequelize=require(_0x4612('0x0'));module['exports']={'type':{'type':Sequelize[_0x4612('0x1')](_0x4612('0x2'),_0x4612('0x3'),_0x4612('0x4'),_0x4612('0x5'),_0x4612('0x6')),'defaultValue':_0x4612('0x2')},'content':{'type':Sequelize[_0x4612('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x4612('0x2'),_0x4612('0x3'),_0x4612('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4612('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4612('0x7')]}}; \ No newline at end of file +var _0x9a61=['customVariable','keyValue','string','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x9e76d,_0x44e7a0){var _0x320985=function(_0x32c6c9){while(--_0x32c6c9){_0x9e76d['push'](_0x9e76d['shift']());}};_0x320985(++_0x44e7a0);}(_0x9a61,0x1ce));var _0x19a6=function(_0x57b10f,_0x39543b){_0x57b10f=_0x57b10f-0x0;var _0x4fdf86=_0x9a61[_0x57b10f];return _0x4fdf86;};'use strict';var Sequelize=require(_0x19a6('0x0'));module['exports']={'type':{'type':Sequelize[_0x19a6('0x1')]('string','variable',_0x19a6('0x2'),_0x19a6('0x3'),'picklist'),'defaultValue':_0x19a6('0x4')},'content':{'type':Sequelize[_0x19a6('0x5')]},'key':{'type':Sequelize[_0x19a6('0x5')]},'keyType':{'type':Sequelize[_0x19a6('0x1')](_0x19a6('0x4'),_0x19a6('0x6'),_0x19a6('0x2'))},'keyContent':{'type':Sequelize[_0x19a6('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x19a6('0x5')]},'customField':{'type':Sequelize[_0x19a6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x19a6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index bfc8ee7..640498d 100644 --- a/server/api/intDeskField/intDeskField.controller.js +++ b/server/api/intDeskField/intDeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9b7=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','DeskField','findAll','rows','catch','show','params','rawAttributes','create','body'];(function(_0xa78e4a,_0x74b0c1){var _0x103d8d=function(_0xddb237){while(--_0xddb237){_0xa78e4a['push'](_0xa78e4a['shift']());}};_0x103d8d(++_0x74b0c1);}(_0xf9b7,0x91));var _0x7f9b=function(_0x3cd8d2,_0xfbd1c8){_0x3cd8d2=_0x3cd8d2-0x0;var _0x2de19d=_0xf9b7[_0x3cd8d2];return _0x2de19d;};'use strict';var emlformat=require(_0x7f9b('0x0'));var rimraf=require(_0x7f9b('0x1'));var zipdir=require(_0x7f9b('0x2'));var jsonpatch=require(_0x7f9b('0x3'));var rp=require(_0x7f9b('0x4'));var moment=require(_0x7f9b('0x5'));var BPromise=require(_0x7f9b('0x6'));var Mustache=require(_0x7f9b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7f9b('0x8'));var csv=require('to-csv');var ejs=require(_0x7f9b('0x9'));var fs=require('fs');var fs_extra=require(_0x7f9b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f9b('0xb'));var jsforce=require(_0x7f9b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f9b('0xd'));var Redis=require(_0x7f9b('0xe'));var authService=require(_0x7f9b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7f9b('0x10'));var hardwareService=require(_0x7f9b('0x11'));var logger=require('../../config/logger')(_0x7f9b('0x12'));var utils=require('../../config/utils');var config=require(_0x7f9b('0x13'));var licenseUtil=require(_0x7f9b('0x14'));var db=require(_0x7f9b('0x15'))['db'];function respondWithStatusCode(_0x911217,_0x2c60e6){_0x2c60e6=_0x2c60e6||0xcc;return function(_0x48ea83){if(_0x48ea83){return _0x911217[_0x7f9b('0x16')](_0x2c60e6);}return _0x911217['status'](_0x2c60e6)[_0x7f9b('0x17')]();};}function respondWithResult(_0x27f63e,_0x38a0b1){_0x38a0b1=_0x38a0b1||0xc8;return function(_0x1f756c){if(_0x1f756c){return _0x27f63e[_0x7f9b('0x18')](_0x38a0b1)[_0x7f9b('0x19')](_0x1f756c);}};}function respondWithFilteredResult(_0x261c4c,_0x2ba158){return function(_0x447255){if(_0x447255){var _0x39ecbd=typeof _0x2ba158[_0x7f9b('0x1a')]===_0x7f9b('0x1b')&&typeof _0x2ba158[_0x7f9b('0x1c')]===_0x7f9b('0x1b');var _0x51debb=_0x447255[_0x7f9b('0x1d')];var _0x575643=_0x39ecbd?0x0:_0x2ba158[_0x7f9b('0x1a')];var _0x4d934b=_0x39ecbd?_0x447255[_0x7f9b('0x1d')]:_0x2ba158['offset']+_0x2ba158['limit'];var _0x5cec50;if(_0x4d934b>=_0x51debb){_0x4d934b=_0x51debb;_0x5cec50=0xc8;}else{_0x5cec50=0xce;}_0x261c4c[_0x7f9b('0x18')](_0x5cec50);return _0x261c4c['set'](_0x7f9b('0x1e'),_0x575643+'-'+_0x4d934b+'/'+_0x51debb)['json'](_0x447255);}return null;};}function patchUpdates(_0x4a1399){return function(_0x262857){try{jsonpatch[_0x7f9b('0x1f')](_0x262857,_0x4a1399,!![]);}catch(_0x318203){return BPromise['reject'](_0x318203);}return _0x262857[_0x7f9b('0x20')]();};}function saveUpdates(_0x12285b,_0x47142f){return function(_0x4e3f37){if(_0x4e3f37){return _0x4e3f37[_0x7f9b('0x21')](_0x12285b)[_0x7f9b('0x22')](function(_0x25b6ac){return _0x25b6ac;});}return null;};}function removeEntity(_0x28d6de,_0x38e7d6){return function(_0x527f30){if(_0x527f30){return _0x527f30['destroy']()[_0x7f9b('0x22')](function(){_0x28d6de[_0x7f9b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62295d,_0x17b31d){return function(_0x22c380){if(!_0x22c380){_0x62295d[_0x7f9b('0x16')](0x194);}return _0x22c380;};}function handleError(_0x3b9da4,_0x214347){_0x214347=_0x214347||0x1f4;return function(_0x1155f6){logger['error'](_0x1155f6[_0x7f9b('0x23')]);if(_0x1155f6[_0x7f9b('0x24')]){delete _0x1155f6[_0x7f9b('0x24')];}_0x3b9da4[_0x7f9b('0x18')](_0x214347)[_0x7f9b('0x25')](_0x1155f6);};}exports[_0x7f9b('0x26')]=function(_0x5f3a5c,_0x4ab6ad){var _0x49a678={},_0xe72154={},_0x122caf={'count':0x0,'rows':[]};var _0x4e5c5d=_[_0x7f9b('0x27')](db['DeskField']['rawAttributes'],function(_0x5aba6e){return{'name':_0x5aba6e[_0x7f9b('0x28')],'type':_0x5aba6e[_0x7f9b('0x29')][_0x7f9b('0x2a')]};});_0xe72154[_0x7f9b('0x2b')]=_[_0x7f9b('0x27')](_0x4e5c5d,_0x7f9b('0x24'));_0xe72154['query']=_[_0x7f9b('0x2c')](_0x5f3a5c['query']);_0xe72154[_0x7f9b('0x2d')]=_[_0x7f9b('0x2e')](_0xe72154[_0x7f9b('0x2b')],_0xe72154[_0x7f9b('0x2f')]);_0x49a678[_0x7f9b('0x30')]=_['intersection'](_0xe72154['model'],qs['fields'](_0x5f3a5c['query'][_0x7f9b('0x31')]));_0x49a678[_0x7f9b('0x30')]=_0x49a678['attributes'][_0x7f9b('0x32')]?_0x49a678[_0x7f9b('0x30')]:_0xe72154[_0x7f9b('0x2b')];if(!_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x33')](_0x7f9b('0x34'))){_0x49a678[_0x7f9b('0x1c')]=qs['limit'](_0x5f3a5c['query']['limit']);_0x49a678[_0x7f9b('0x1a')]=qs[_0x7f9b('0x1a')](_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x1a')]);}_0x49a678[_0x7f9b('0x35')]=qs[_0x7f9b('0x36')](_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x36')]);_0x49a678['where']=qs[_0x7f9b('0x2d')](_[_0x7f9b('0x37')](_0x5f3a5c[_0x7f9b('0x2f')],_0xe72154[_0x7f9b('0x2d')]),_0x4e5c5d);if(_0x5f3a5c['query'][_0x7f9b('0x38')]){_0x49a678[_0x7f9b('0x39')]=_[_0x7f9b('0x3a')](_0x49a678[_0x7f9b('0x39')],{'$or':_[_0x7f9b('0x27')](_0x4e5c5d,function(_0x325370){if(_0x325370[_0x7f9b('0x29')]!==_0x7f9b('0x3b')){var _0x55d618={};_0x55d618[_0x325370[_0x7f9b('0x24')]]={'$like':'%'+_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x38')]+'%'};return _0x55d618;}})});}_0x49a678=_[_0x7f9b('0x3a')]({},_0x49a678,_0x5f3a5c['options']);var _0xd937c0={'where':_0x49a678[_0x7f9b('0x39')]};return db['DeskField'][_0x7f9b('0x1d')](_0xd937c0)[_0x7f9b('0x22')](function(_0x413230){_0x122caf['count']=_0x413230;if(_0x5f3a5c['query'][_0x7f9b('0x3c')]){_0x49a678[_0x7f9b('0x3d')]=[{'all':!![]}];}return db[_0x7f9b('0x3e')][_0x7f9b('0x3f')](_0x49a678);})[_0x7f9b('0x22')](function(_0x1e3df5){_0x122caf[_0x7f9b('0x40')]=_0x1e3df5;return _0x122caf;})[_0x7f9b('0x22')](respondWithFilteredResult(_0x4ab6ad,_0x49a678))[_0x7f9b('0x41')](handleError(_0x4ab6ad,null));};exports[_0x7f9b('0x42')]=function(_0x22e485,_0x8ca3a8){var _0x5e2171={'raw':!![],'where':{'id':_0x22e485[_0x7f9b('0x43')]['id']}},_0x190ebc={};_0x190ebc[_0x7f9b('0x2b')]=_[_0x7f9b('0x2c')](db['DeskField'][_0x7f9b('0x44')]);_0x190ebc[_0x7f9b('0x2f')]=_['keys'](_0x22e485[_0x7f9b('0x2f')]);_0x190ebc['filters']=_[_0x7f9b('0x2e')](_0x190ebc[_0x7f9b('0x2b')],_0x190ebc['query']);_0x5e2171[_0x7f9b('0x30')]=_['intersection'](_0x190ebc[_0x7f9b('0x2b')],qs['fields'](_0x22e485['query'][_0x7f9b('0x31')]));_0x5e2171[_0x7f9b('0x30')]=_0x5e2171[_0x7f9b('0x30')][_0x7f9b('0x32')]?_0x5e2171[_0x7f9b('0x30')]:_0x190ebc[_0x7f9b('0x2b')];if(_0x22e485[_0x7f9b('0x2f')][_0x7f9b('0x3c')]){_0x5e2171[_0x7f9b('0x3d')]=[{'all':!![]}];}_0x5e2171=_[_0x7f9b('0x3a')]({},_0x5e2171,_0x22e485['options']);return db[_0x7f9b('0x3e')]['find'](_0x5e2171)[_0x7f9b('0x22')](handleEntityNotFound(_0x8ca3a8,null))[_0x7f9b('0x22')](respondWithResult(_0x8ca3a8,null))['catch'](handleError(_0x8ca3a8,null));};exports[_0x7f9b('0x45')]=function(_0xfe294d,_0x2c9173){return db[_0x7f9b('0x3e')]['create'](_0xfe294d['body'],{})[_0x7f9b('0x22')](respondWithResult(_0x2c9173,0xc9))[_0x7f9b('0x41')](handleError(_0x2c9173,null));};exports['update']=function(_0xd30798,_0x1a211b){if(_0xd30798[_0x7f9b('0x46')]['id']){delete _0xd30798[_0x7f9b('0x46')]['id'];}return db[_0x7f9b('0x3e')][_0x7f9b('0x47')]({'where':{'id':_0xd30798[_0x7f9b('0x43')]['id']}})[_0x7f9b('0x22')](handleEntityNotFound(_0x1a211b,null))[_0x7f9b('0x22')](saveUpdates(_0xd30798[_0x7f9b('0x46')],null))[_0x7f9b('0x22')](respondWithResult(_0x1a211b,null))[_0x7f9b('0x41')](handleError(_0x1a211b,null));};exports['destroy']=function(_0x30004f,_0x3e80d1){return db['DeskField']['find']({'where':{'id':_0x30004f[_0x7f9b('0x43')]['id']}})[_0x7f9b('0x22')](handleEntityNotFound(_0x3e80d1,null))[_0x7f9b('0x22')](removeEntity(_0x3e80d1,null))[_0x7f9b('0x41')](handleError(_0x3e80d1,null));}; \ No newline at end of file +var _0xe9e5=['filters','intersection','model','fields','attributes','length','query','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','keys'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0xe9e5,0x138));var _0x5e9e=function(_0x23983a,_0x38947d){_0x23983a=_0x23983a-0x0;var _0x127ff1=_0xe9e5[_0x23983a];return _0x127ff1;};'use strict';var emlformat=require(_0x5e9e('0x0'));var rimraf=require(_0x5e9e('0x1'));var zipdir=require(_0x5e9e('0x2'));var jsonpatch=require(_0x5e9e('0x3'));var rp=require(_0x5e9e('0x4'));var moment=require(_0x5e9e('0x5'));var BPromise=require(_0x5e9e('0x6'));var Mustache=require('mustache');var util=require(_0x5e9e('0x7'));var path=require(_0x5e9e('0x8'));var sox=require('sox');var csv=require(_0x5e9e('0x9'));var ejs=require(_0x5e9e('0xa'));var fs=require('fs');var fs_extra=require(_0x5e9e('0xb'));var _=require(_0x5e9e('0xc'));var squel=require(_0x5e9e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5e9e('0xe'));var toCsv=require(_0x5e9e('0x9'));var querystring=require(_0x5e9e('0xf'));var Papa=require('papaparse');var Redis=require(_0x5e9e('0x10'));var authService=require(_0x5e9e('0x11'));var qs=require(_0x5e9e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e9e('0x13'));var logger=require('../../config/logger')(_0x5e9e('0x14'));var utils=require('../../config/utils');var config=require(_0x5e9e('0x15'));var licenseUtil=require(_0x5e9e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e03d3,_0x48850c){_0x48850c=_0x48850c||0xcc;return function(_0x2a6442){if(_0x2a6442){return _0x3e03d3[_0x5e9e('0x17')](_0x48850c);}return _0x3e03d3[_0x5e9e('0x18')](_0x48850c)['end']();};}function respondWithResult(_0x5cc1af,_0xac65f5){_0xac65f5=_0xac65f5||0xc8;return function(_0x9dc7fd){if(_0x9dc7fd){return _0x5cc1af[_0x5e9e('0x18')](_0xac65f5)[_0x5e9e('0x19')](_0x9dc7fd);}};}function respondWithFilteredResult(_0x1b6475,_0x1d9955){return function(_0x124a46){if(_0x124a46){var _0x333db7=typeof _0x1d9955[_0x5e9e('0x1a')]===_0x5e9e('0x1b')&&typeof _0x1d9955[_0x5e9e('0x1c')]===_0x5e9e('0x1b');var _0x3f0542=_0x124a46[_0x5e9e('0x1d')];var _0x4516c9=_0x333db7?0x0:_0x1d9955[_0x5e9e('0x1a')];var _0x481c95=_0x333db7?_0x124a46['count']:_0x1d9955['offset']+_0x1d9955[_0x5e9e('0x1c')];var _0x2cddee;if(_0x481c95>=_0x3f0542){_0x481c95=_0x3f0542;_0x2cddee=0xc8;}else{_0x2cddee=0xce;}_0x1b6475[_0x5e9e('0x18')](_0x2cddee);return _0x1b6475[_0x5e9e('0x1e')](_0x5e9e('0x1f'),_0x4516c9+'-'+_0x481c95+'/'+_0x3f0542)[_0x5e9e('0x19')](_0x124a46);}return null;};}function patchUpdates(_0x4f8146){return function(_0x2b64b7){try{jsonpatch[_0x5e9e('0x20')](_0x2b64b7,_0x4f8146,!![]);}catch(_0xa3349f){return BPromise[_0x5e9e('0x21')](_0xa3349f);}return _0x2b64b7['save']();};}function saveUpdates(_0x5b59b3,_0xdf3a98){return function(_0x360f2d){if(_0x360f2d){return _0x360f2d[_0x5e9e('0x22')](_0x5b59b3)[_0x5e9e('0x23')](function(_0x2b8ef4){return _0x2b8ef4;});}return null;};}function removeEntity(_0xc4e3c4,_0x5048c7){return function(_0x31bbe9){if(_0x31bbe9){return _0x31bbe9[_0x5e9e('0x24')]()['then'](function(){_0xc4e3c4[_0x5e9e('0x18')](0xcc)[_0x5e9e('0x25')]();});}};}function handleEntityNotFound(_0x2a5e5b,_0x55f0c5){return function(_0x9358cd){if(!_0x9358cd){_0x2a5e5b[_0x5e9e('0x17')](0x194);}return _0x9358cd;};}function handleError(_0x5f329a,_0x5e7eff){_0x5e7eff=_0x5e7eff||0x1f4;return function(_0x57d2d4){logger[_0x5e9e('0x26')](_0x57d2d4[_0x5e9e('0x27')]);if(_0x57d2d4[_0x5e9e('0x28')]){delete _0x57d2d4['name'];}_0x5f329a[_0x5e9e('0x18')](_0x5e7eff)[_0x5e9e('0x29')](_0x57d2d4);};}exports['index']=function(_0x481402,_0x2e6cca){var _0x2c0123={},_0xe880a1={},_0xfc5430={'count':0x0,'rows':[]};var _0x59b7fd=_[_0x5e9e('0x2a')](db[_0x5e9e('0x2b')][_0x5e9e('0x2c')],function(_0x57bc32){return{'name':_0x57bc32[_0x5e9e('0x2d')],'type':_0x57bc32[_0x5e9e('0x2e')]['key']};});_0xe880a1['model']=_[_0x5e9e('0x2a')](_0x59b7fd,_0x5e9e('0x28'));_0xe880a1['query']=_[_0x5e9e('0x2f')](_0x481402['query']);_0xe880a1[_0x5e9e('0x30')]=_[_0x5e9e('0x31')](_0xe880a1[_0x5e9e('0x32')],_0xe880a1['query']);_0x2c0123['attributes']=_[_0x5e9e('0x31')](_0xe880a1[_0x5e9e('0x32')],qs['fields'](_0x481402['query'][_0x5e9e('0x33')]));_0x2c0123[_0x5e9e('0x34')]=_0x2c0123[_0x5e9e('0x34')][_0x5e9e('0x35')]?_0x2c0123[_0x5e9e('0x34')]:_0xe880a1[_0x5e9e('0x32')];if(!_0x481402[_0x5e9e('0x36')][_0x5e9e('0x37')](_0x5e9e('0x38'))){_0x2c0123[_0x5e9e('0x1c')]=qs[_0x5e9e('0x1c')](_0x481402[_0x5e9e('0x36')][_0x5e9e('0x1c')]);_0x2c0123[_0x5e9e('0x1a')]=qs[_0x5e9e('0x1a')](_0x481402['query']['offset']);}_0x2c0123['order']=qs[_0x5e9e('0x39')](_0x481402['query'][_0x5e9e('0x39')]);_0x2c0123[_0x5e9e('0x3a')]=qs['filters'](_['pick'](_0x481402['query'],_0xe880a1[_0x5e9e('0x30')]),_0x59b7fd);if(_0x481402['query'][_0x5e9e('0x3b')]){_0x2c0123[_0x5e9e('0x3a')]=_[_0x5e9e('0x3c')](_0x2c0123[_0x5e9e('0x3a')],{'$or':_['map'](_0x59b7fd,function(_0x182eec){if(_0x182eec[_0x5e9e('0x2e')]!=='VIRTUAL'){var _0x1b278d={};_0x1b278d[_0x182eec[_0x5e9e('0x28')]]={'$like':'%'+_0x481402[_0x5e9e('0x36')]['filter']+'%'};return _0x1b278d;}})});}_0x2c0123=_[_0x5e9e('0x3c')]({},_0x2c0123,_0x481402[_0x5e9e('0x3d')]);var _0x227a69={'where':_0x2c0123[_0x5e9e('0x3a')]};return db[_0x5e9e('0x2b')][_0x5e9e('0x1d')](_0x227a69)['then'](function(_0x364de6){_0xfc5430[_0x5e9e('0x1d')]=_0x364de6;if(_0x481402[_0x5e9e('0x36')]['includeAll']){_0x2c0123[_0x5e9e('0x3e')]=[{'all':!![]}];}return db[_0x5e9e('0x2b')][_0x5e9e('0x3f')](_0x2c0123);})[_0x5e9e('0x23')](function(_0x59549f){_0xfc5430[_0x5e9e('0x40')]=_0x59549f;return _0xfc5430;})[_0x5e9e('0x23')](respondWithFilteredResult(_0x2e6cca,_0x2c0123))[_0x5e9e('0x41')](handleError(_0x2e6cca,null));};exports[_0x5e9e('0x42')]=function(_0x7563e1,_0x45e2cc){var _0x5c5dd9={'raw':!![],'where':{'id':_0x7563e1[_0x5e9e('0x43')]['id']}},_0x4a5def={};_0x4a5def[_0x5e9e('0x32')]=_[_0x5e9e('0x2f')](db[_0x5e9e('0x2b')][_0x5e9e('0x2c')]);_0x4a5def['query']=_['keys'](_0x7563e1[_0x5e9e('0x36')]);_0x4a5def['filters']=_[_0x5e9e('0x31')](_0x4a5def[_0x5e9e('0x32')],_0x4a5def['query']);_0x5c5dd9[_0x5e9e('0x34')]=_[_0x5e9e('0x31')](_0x4a5def[_0x5e9e('0x32')],qs[_0x5e9e('0x33')](_0x7563e1[_0x5e9e('0x36')]['fields']));_0x5c5dd9['attributes']=_0x5c5dd9[_0x5e9e('0x34')][_0x5e9e('0x35')]?_0x5c5dd9[_0x5e9e('0x34')]:_0x4a5def['model'];if(_0x7563e1[_0x5e9e('0x36')][_0x5e9e('0x44')]){_0x5c5dd9[_0x5e9e('0x3e')]=[{'all':!![]}];}_0x5c5dd9=_['merge']({},_0x5c5dd9,_0x7563e1[_0x5e9e('0x3d')]);return db[_0x5e9e('0x2b')][_0x5e9e('0x45')](_0x5c5dd9)[_0x5e9e('0x23')](handleEntityNotFound(_0x45e2cc,null))[_0x5e9e('0x23')](respondWithResult(_0x45e2cc,null))[_0x5e9e('0x41')](handleError(_0x45e2cc,null));};exports[_0x5e9e('0x46')]=function(_0x5f0b8d,_0x30ac7d){return db[_0x5e9e('0x2b')][_0x5e9e('0x46')](_0x5f0b8d['body'],{})[_0x5e9e('0x23')](respondWithResult(_0x30ac7d,0xc9))[_0x5e9e('0x41')](handleError(_0x30ac7d,null));};exports[_0x5e9e('0x22')]=function(_0x308730,_0x28faef){if(_0x308730[_0x5e9e('0x47')]['id']){delete _0x308730[_0x5e9e('0x47')]['id'];}return db['DeskField'][_0x5e9e('0x45')]({'where':{'id':_0x308730[_0x5e9e('0x43')]['id']}})['then'](handleEntityNotFound(_0x28faef,null))[_0x5e9e('0x23')](saveUpdates(_0x308730['body'],null))[_0x5e9e('0x23')](respondWithResult(_0x28faef,null))['catch'](handleError(_0x28faef,null));};exports[_0x5e9e('0x24')]=function(_0x24493f,_0x587d3d){return db[_0x5e9e('0x2b')]['find']({'where':{'id':_0x24493f['params']['id']}})[_0x5e9e('0x23')](handleEntityNotFound(_0x587d3d,null))[_0x5e9e('0x23')](removeEntity(_0x587d3d,null))['catch'](handleError(_0x587d3d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 98fa6f5..48b127e 100644 --- a/server/api/intDeskField/intDeskField.model.js +++ b/server/api/intDeskField/intDeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf5e=['./intDeskField.attributes','exports','define','DeskField','desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x25e30f,_0x3ea59b){var _0x195a65=function(_0x26ef79){while(--_0x26ef79){_0x25e30f['push'](_0x25e30f['shift']());}};_0x195a65(++_0x3ea59b);}(_0xaf5e,0x105));var _0xeaf5=function(_0x2e4b74,_0x51ce22){_0x2e4b74=_0x2e4b74-0x0;var _0x2558ef=_0xaf5e[_0x2e4b74];return _0x2558ef;};'use strict';var _=require(_0xeaf5('0x0'));var util=require(_0xeaf5('0x1'));var logger=require(_0xeaf5('0x2'))(_0xeaf5('0x3'));var moment=require(_0xeaf5('0x4'));var BPromise=require(_0xeaf5('0x5'));var rp=require(_0xeaf5('0x6'));var fs=require('fs');var path=require(_0xeaf5('0x7'));var rimraf=require('rimraf');var config=require(_0xeaf5('0x8'));var attributes=require(_0xeaf5('0x9'));module[_0xeaf5('0xa')]=function(_0x2245cc,_0x5fd8cc){return _0x2245cc[_0xeaf5('0xb')](_0xeaf5('0xc'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xeaf5('0xd'),'fields':['idField',_0xeaf5('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x75c2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x5e20f0,_0x4d99a5){var _0x243eb9=function(_0x32c904){while(--_0x32c904){_0x5e20f0['push'](_0x5e20f0['shift']());}};_0x243eb9(++_0x4d99a5);}(_0x75c2,0x19f));var _0x275c=function(_0x59a4f1,_0x2fadda){_0x59a4f1=_0x59a4f1-0x0;var _0x23dd94=_0x75c2[_0x59a4f1];return _0x23dd94;};'use strict';var _=require(_0x275c('0x0'));var util=require('util');var logger=require(_0x275c('0x1'))(_0x275c('0x2'));var moment=require(_0x275c('0x3'));var BPromise=require(_0x275c('0x4'));var rp=require(_0x275c('0x5'));var fs=require('fs');var path=require(_0x275c('0x6'));var rimraf=require(_0x275c('0x7'));var config=require(_0x275c('0x8'));var attributes=require(_0x275c('0x9'));module[_0x275c('0xa')]=function(_0x561d64,_0xe77f0f){return _0x561d64[_0x275c('0xb')]('DeskField',attributes,{'tableName':_0x275c('0xc'),'paranoid':![],'indexes':[{'name':_0x275c('0xd'),'fields':[_0x275c('0xe'),_0x275c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index adf83e6..2a70c66 100644 --- a/server/api/intDeskField/intDeskField.rpc.js +++ b/server/api/intDeskField/intDeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9720=['http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','message','info','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xa522f,_0x5debbc){var _0x2083b0=function(_0x288f01){while(--_0x288f01){_0xa522f['push'](_0xa522f['shift']());}};_0x2083b0(++_0x5debbc);}(_0x9720,0xfb));var _0x0972=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x9720[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require(_0x0972('0x0'));var moment=require(_0x0972('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0972('0x2'));var db=require(_0x0972('0x3'))['db'];var utils=require(_0x0972('0x4'));var logger=require(_0x0972('0x5'))(_0x0972('0x6'));var config=require(_0x0972('0x7'));var jayson=require(_0x0972('0x8'));var client=jayson['client'][_0x0972('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x132052,_0x504701,_0x426195){return new BPromise(function(_0x314cbd,_0x22d1a1){return client[_0x0972('0xa')](_0x132052,_0x426195)[_0x0972('0xb')](function(_0x2af06a){logger['info'](_0x0972('0xc'),_0x504701,_0x0972('0xd'));logger[_0x0972('0xe')](_0x0972('0xf'),_0x504701,_0x0972('0xd'),JSON['stringify'](_0x2af06a));if(_0x2af06a[_0x0972('0x10')]){if(_0x2af06a[_0x0972('0x10')]['code']===0x1f4){logger[_0x0972('0x10')](_0x0972('0xc'),_0x504701,_0x2af06a[_0x0972('0x10')][_0x0972('0x11')]);return _0x22d1a1(_0x2af06a['error']['message']);}logger[_0x0972('0x10')](_0x0972('0xc'),_0x504701,_0x2af06a[_0x0972('0x10')][_0x0972('0x11')]);return _0x314cbd(_0x2af06a[_0x0972('0x10')]['message']);}else{logger[_0x0972('0x12')](_0x0972('0xc'),_0x504701,_0x0972('0xd'));_0x314cbd(_0x2af06a['result'][_0x0972('0x11')]);}})[_0x0972('0x13')](function(_0x390f03){logger[_0x0972('0x10')](_0x0972('0xc'),_0x504701,_0x390f03);_0x22d1a1(_0x390f03);});});} \ No newline at end of file +var _0xace4=['rpc','../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2f5556,_0x2b6c90){var _0x5523c1=function(_0x5c5886){while(--_0x5c5886){_0x2f5556['push'](_0x2f5556['shift']());}};_0x5523c1(++_0x2b6c90);}(_0xace4,0x88));var _0x4ace=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0xace4[_0x35ef6b];return _0x3ad145;};'use strict';var _=require(_0x4ace('0x0'));var util=require(_0x4ace('0x1'));var moment=require(_0x4ace('0x2'));var BPromise=require(_0x4ace('0x3'));var rs=require(_0x4ace('0x4'));var fs=require('fs');var Redis=require(_0x4ace('0x5'));var db=require(_0x4ace('0x6'))['db'];var utils=require(_0x4ace('0x7'));var logger=require('../../config/logger')(_0x4ace('0x8'));var config=require(_0x4ace('0x9'));var jayson=require(_0x4ace('0xa'));var client=jayson[_0x4ace('0xb')][_0x4ace('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c0018,_0xfe664f,_0x48416e){return new BPromise(function(_0x32db09,_0x13477f){return client[_0x4ace('0xd')](_0x2c0018,_0x48416e)[_0x4ace('0xe')](function(_0x107c9c){logger['info'](_0x4ace('0xf'),_0xfe664f,_0x4ace('0x10'));logger[_0x4ace('0x11')](_0x4ace('0x12'),_0xfe664f,_0x4ace('0x10'),JSON['stringify'](_0x107c9c));if(_0x107c9c[_0x4ace('0x13')]){if(_0x107c9c['error'][_0x4ace('0x14')]===0x1f4){logger[_0x4ace('0x13')](_0x4ace('0xf'),_0xfe664f,_0x107c9c[_0x4ace('0x13')]['message']);return _0x13477f(_0x107c9c[_0x4ace('0x13')][_0x4ace('0x15')]);}logger[_0x4ace('0x13')](_0x4ace('0xf'),_0xfe664f,_0x107c9c['error'][_0x4ace('0x15')]);return _0x32db09(_0x107c9c[_0x4ace('0x13')][_0x4ace('0x15')]);}else{logger[_0x4ace('0x16')](_0x4ace('0xf'),_0xfe664f,'request\x20sent');_0x32db09(_0x107c9c['result']['message']);}})[_0x4ace('0x17')](function(_0x5e7560){logger['error']('DeskField,\x20%s,\x20%s',_0xfe664f,_0x5e7560);_0x13477f(_0x5e7560);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 1a5442d..ac1391a 100644 --- a/server/api/intDynamics365Account/index.js +++ b/server/api/intDynamics365Account/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb5f=['multer','path','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xbb5f,0x93));var _0xfbb5=function(_0x36ebf7,_0xc3dd9b){_0x36ebf7=_0x36ebf7-0x0;var _0x60b23d=_0xbb5f[_0x36ebf7];return _0x60b23d;};'use strict';var multer=require(_0xfbb5('0x0'));var util=require('util');var path=require(_0xfbb5('0x1'));var timeout=require(_0xfbb5('0x2'));var express=require(_0xfbb5('0x3'));var router=express[_0xfbb5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfbb5('0x5'));var config=require('../../config/environment');var controller=require(_0xfbb5('0x6'));router['get']('/',auth[_0xfbb5('0x7')](),controller['index']);router[_0xfbb5('0x8')](_0xfbb5('0x9'),auth['isAuthenticated'](),controller[_0xfbb5('0xa')]);router[_0xfbb5('0x8')](_0xfbb5('0xb'),auth[_0xfbb5('0x7')](),controller['getConfigurations']);router[_0xfbb5('0x8')](_0xfbb5('0xc'),auth[_0xfbb5('0x7')](),controller[_0xfbb5('0xd')]);router[_0xfbb5('0xe')]('/',auth[_0xfbb5('0x7')](),controller[_0xfbb5('0xf')]);router['post'](_0xfbb5('0xb'),auth['isAuthenticated'](),controller[_0xfbb5('0x10')]);router['put'](_0xfbb5('0x9'),auth[_0xfbb5('0x7')](),controller[_0xfbb5('0x11')]);router[_0xfbb5('0x12')](_0xfbb5('0x9'),auth[_0xfbb5('0x7')](),controller[_0xfbb5('0x13')]);module[_0xfbb5('0x14')]=router; \ No newline at end of file +var _0xeab5=['post','create','put','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x1b0c7c,_0x468383){var _0x44f649=function(_0x56fbc6){while(--_0x56fbc6){_0x1b0c7c['push'](_0x1b0c7c['shift']());}};_0x44f649(++_0x468383);}(_0xeab5,0x98));var _0x5eab=function(_0xb2f24,_0x5ca905){_0xb2f24=_0xb2f24-0x0;var _0x4eed19=_0xeab5[_0xb2f24];return _0x4eed19;};'use strict';var multer=require(_0x5eab('0x0'));var util=require(_0x5eab('0x1'));var path=require('path');var timeout=require(_0x5eab('0x2'));var express=require(_0x5eab('0x3'));var router=express['Router']();var fs_extra=require(_0x5eab('0x4'));var auth=require(_0x5eab('0x5'));var interaction=require(_0x5eab('0x6'));var config=require('../../config/environment');var controller=require(_0x5eab('0x7'));router[_0x5eab('0x8')]('/',auth['isAuthenticated'](),controller[_0x5eab('0x9')]);router[_0x5eab('0x8')](_0x5eab('0xa'),auth[_0x5eab('0xb')](),controller[_0x5eab('0xc')]);router[_0x5eab('0x8')](_0x5eab('0xd'),auth[_0x5eab('0xb')](),controller[_0x5eab('0xe')]);router[_0x5eab('0x8')](_0x5eab('0xf'),auth[_0x5eab('0xb')](),controller['getFields']);router[_0x5eab('0x10')]('/',auth[_0x5eab('0xb')](),controller[_0x5eab('0x11')]);router[_0x5eab('0x10')](_0x5eab('0xd'),auth[_0x5eab('0xb')](),controller['addConfiguration']);router[_0x5eab('0x12')](_0x5eab('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5eab('0x13')](_0x5eab('0xa'),auth[_0x5eab('0xb')](),controller[_0x5eab('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f8dd371..98dd14a 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.attributes.js +++ b/server/api/intDynamics365Account/intDynamics365Account.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09f4=['STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09f4,0xe4));var _0x409f=function(_0x472443,_0x190547){_0x472443=_0x472443-0x0;var _0x171eef=_0x09f4[_0x472443];return _0x171eef;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x409f('0x0')]},'username':{'type':Sequelize[_0x409f('0x0')]},'password':{'type':Sequelize[_0x409f('0x0')]},'remoteUri':{'type':Sequelize[_0x409f('0x0')]},'tenantId':{'type':Sequelize[_0x409f('0x0')]},'clientId':{'type':Sequelize[_0x409f('0x0')]},'clientSecret':{'type':Sequelize[_0x409f('0x0')]},'serverUrl':{'type':Sequelize[_0x409f('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x409f('0x0')]},'modernAuthentication':{'type':Sequelize[_0x409f('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5292=['STRING','sequelize','exports'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x5292,0xf7));var _0x2529=function(_0x5a8e42,_0x1bdf90){_0x5a8e42=_0x5a8e42-0x0;var _0x3939ef=_0x5292[_0x5a8e42];return _0x3939ef;};'use strict';var Sequelize=require(_0x2529('0x0'));module[_0x2529('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2529('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2529('0x2')]},'tenantId':{'type':Sequelize[_0x2529('0x2')]},'clientId':{'type':Sequelize[_0x2529('0x2')]},'clientSecret':{'type':Sequelize[_0x2529('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2529('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 5ee2944..200698d 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.controller.js +++ b/server/api/intDynamics365Account/intDynamics365Account.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26e4=['data5','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','Bearer\x20','4.0','MetadataId','GET','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','test','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','stack','name','send','map','Dynamics365Account','rawAttributes','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','findOne','Dynamics365Configuration','order','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','slainvokedidname','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider'];(function(_0x25c044,_0xbd05f8){var _0x558ee5=function(_0x5de5d2){while(--_0x5de5d2){_0x25c044['push'](_0x25c044['shift']());}};_0x558ee5(++_0xbd05f8);}(_0x26e4,0xec));var _0x426e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x26e4[_0x17d9e3];return _0x14192d;};'use strict';var rp=require('request-promise');var util=require(_0x426e('0x0'));var _=require(_0x426e('0x1'));var qs=require(_0x426e('0x2'));var logger=require(_0x426e('0x3'))('api');var db=require('../../mysqldb')['db'];var integrations=require(_0x426e('0x4'));function respondWithResult(_0x335e12,_0x5141b0){_0x5141b0=_0x5141b0||0xc8;return function(_0x5b6f8b){if(_0x5b6f8b){return _0x335e12[_0x426e('0x5')](_0x5141b0)[_0x426e('0x6')](_0x5b6f8b);}};}function respondWithFilteredResult(_0x14300a,_0x4a8c5f){return function(_0x5c7001){if(_0x5c7001){var _0x4bb8ac=typeof _0x4a8c5f[_0x426e('0x7')]===_0x426e('0x8')&&typeof _0x4a8c5f[_0x426e('0x9')]===_0x426e('0x8');var _0x597999=_0x5c7001[_0x426e('0xa')];var _0x3023d8=_0x4bb8ac?0x0:_0x4a8c5f['offset'];var _0x2580cb=_0x4bb8ac?_0x5c7001[_0x426e('0xa')]:_0x4a8c5f[_0x426e('0x7')]+_0x4a8c5f['limit'];var _0x57a8c3;if(_0x2580cb>=_0x597999){_0x2580cb=_0x597999;_0x57a8c3=0xc8;}else{_0x57a8c3=0xce;}_0x14300a['status'](_0x57a8c3);return _0x14300a[_0x426e('0xb')](_0x426e('0xc'),_0x3023d8+'-'+_0x2580cb+'/'+_0x597999)[_0x426e('0x6')](_0x5c7001);}return null;};}function saveUpdates(_0x3ad93d){return function(_0x870370){if(_0x870370){return _0x870370[_0x426e('0xd')](_0x3ad93d)[_0x426e('0xe')](function(_0x20b871){return _0x20b871;});}return null;};}function removeEntity(_0x23a17e){return function(_0x3b639e){if(_0x3b639e){return _0x3b639e['destroy']()[_0x426e('0xe')](function(){_0x23a17e[_0x426e('0x5')](0xcc)[_0x426e('0xf')]();});}};}function handleEntityNotFound(_0x5f0c56){return function(_0x263a6e){if(!_0x263a6e){_0x5f0c56['sendStatus'](0x194);}return _0x263a6e;};}function handleError(_0x2981d6,_0x4ea621){_0x4ea621=_0x4ea621||0x1f4;return function(_0x1e9e38){logger[_0x426e('0x10')](_0x1e9e38[_0x426e('0x11')]);if(_0x1e9e38[_0x426e('0x12')]){delete _0x1e9e38['name'];}_0x2981d6['status'](_0x4ea621)[_0x426e('0x13')](_0x1e9e38);};}exports['index']=function(_0x2c2a05,_0x4cc897){var _0x288d95={},_0x48deb9={},_0x2df9da={'count':0x0,'rows':[]};var _0x25e700=_[_0x426e('0x14')](db[_0x426e('0x15')][_0x426e('0x16')],function(_0x3ad2e1){return{'name':_0x3ad2e1['fieldName'],'type':_0x3ad2e1[_0x426e('0x17')][_0x426e('0x18')]};});_0x48deb9['model']=_[_0x426e('0x14')](_0x25e700,'name');_0x48deb9[_0x426e('0x19')]=_[_0x426e('0x1a')](_0x2c2a05['query']);_0x48deb9['filters']=_['intersection'](_0x48deb9[_0x426e('0x1b')],_0x48deb9[_0x426e('0x19')]);_0x288d95['attributes']=_[_0x426e('0x1c')](_0x48deb9['model'],qs['fields'](_0x2c2a05['query'][_0x426e('0x1d')]));_0x288d95[_0x426e('0x1e')]=_0x288d95['attributes'][_0x426e('0x1f')]?_0x288d95['attributes']:_0x48deb9['model'];if(!_0x2c2a05[_0x426e('0x19')][_0x426e('0x20')]('nolimit')){_0x288d95[_0x426e('0x9')]=qs[_0x426e('0x9')](_0x2c2a05[_0x426e('0x19')][_0x426e('0x9')]);_0x288d95['offset']=qs['offset'](_0x2c2a05['query'][_0x426e('0x7')]);}_0x288d95['order']=qs[_0x426e('0x21')](_0x2c2a05[_0x426e('0x19')][_0x426e('0x21')]);_0x288d95[_0x426e('0x22')]=qs['filters'](_[_0x426e('0x23')](_0x2c2a05[_0x426e('0x19')],_0x48deb9[_0x426e('0x24')]),_0x25e700);if(_0x2c2a05[_0x426e('0x19')][_0x426e('0x25')]){_0x288d95[_0x426e('0x22')]=_[_0x426e('0x26')](_0x288d95['where'],{'$or':_[_0x426e('0x14')](_0x25e700,function(_0x31bb67){if(_0x31bb67[_0x426e('0x17')]!=='VIRTUAL'){var _0x3598e1={};_0x3598e1[_0x31bb67[_0x426e('0x12')]]={'$like':'%'+_0x2c2a05[_0x426e('0x19')][_0x426e('0x25')]+'%'};return _0x3598e1;}})});}_0x288d95=_[_0x426e('0x26')]({},_0x288d95,_0x2c2a05[_0x426e('0x27')]);var _0x3c325b={'where':_0x288d95[_0x426e('0x22')]};return db['Dynamics365Account'][_0x426e('0xa')](_0x3c325b)['then'](function(_0x475c81){_0x2df9da[_0x426e('0xa')]=_0x475c81;if(_0x2c2a05[_0x426e('0x19')][_0x426e('0x28')]){_0x288d95[_0x426e('0x29')]=[{'all':!![]}];}return db[_0x426e('0x15')][_0x426e('0x2a')](_0x288d95);})[_0x426e('0xe')](function(_0x5ba3d4){_0x2df9da[_0x426e('0x2b')]=_0x5ba3d4;return _0x2df9da;})[_0x426e('0xe')](respondWithFilteredResult(_0x4cc897,_0x288d95))[_0x426e('0x2c')](handleError(_0x4cc897,null));};exports['show']=function(_0x592027,_0x4fe3bf){var _0x5adc13={'raw':![],'where':{'id':_0x592027[_0x426e('0x2d')]['id']}},_0x47f864={};_0x47f864[_0x426e('0x1b')]=_[_0x426e('0x1a')](db['Dynamics365Account']['rawAttributes']);_0x47f864['query']=_[_0x426e('0x1a')](_0x592027['query']);_0x47f864[_0x426e('0x24')]=_[_0x426e('0x1c')](_0x47f864[_0x426e('0x1b')],_0x47f864['query']);_0x5adc13[_0x426e('0x1e')]=_[_0x426e('0x1c')](_0x47f864[_0x426e('0x1b')],qs[_0x426e('0x1d')](_0x592027['query'][_0x426e('0x1d')]));_0x5adc13['attributes']=_0x5adc13[_0x426e('0x1e')][_0x426e('0x1f')]?_0x5adc13[_0x426e('0x1e')]:_0x47f864[_0x426e('0x1b')];if(_0x592027['query'][_0x426e('0x28')]){_0x5adc13[_0x426e('0x29')]=[{'all':!![]}];}_0x5adc13=_[_0x426e('0x26')]({},_0x5adc13,_0x592027[_0x426e('0x27')]);return db[_0x426e('0x15')][_0x426e('0x2e')](_0x5adc13)[_0x426e('0xe')](handleEntityNotFound(_0x4fe3bf,null))[_0x426e('0xe')](respondWithResult(_0x4fe3bf,null))['catch'](handleError(_0x4fe3bf,null));};exports[_0x426e('0x2f')]=function(_0x4c6085,_0x3877fb){return db[_0x426e('0x15')][_0x426e('0x2f')](_0x4c6085['body'],{})[_0x426e('0xe')](respondWithResult(_0x3877fb,0xc9))['catch'](handleError(_0x3877fb,null));};exports[_0x426e('0xd')]=function(_0x2e6d02,_0xf0b9be){if(_0x2e6d02[_0x426e('0x30')]['id']){delete _0x2e6d02[_0x426e('0x30')]['id'];}return db[_0x426e('0x15')][_0x426e('0x2e')]({'where':{'id':_0x2e6d02[_0x426e('0x2d')]['id']}})[_0x426e('0xe')](handleEntityNotFound(_0xf0b9be,null))['then'](saveUpdates(_0x2e6d02[_0x426e('0x30')],null))['then'](respondWithResult(_0xf0b9be,null))[_0x426e('0x2c')](handleError(_0xf0b9be,null));};exports[_0x426e('0x31')]=function(_0x574cdf,_0x79084a){return db[_0x426e('0x15')][_0x426e('0x2e')]({'where':{'id':_0x574cdf[_0x426e('0x2d')]['id']}})[_0x426e('0xe')](handleEntityNotFound(_0x79084a,null))['then'](removeEntity(_0x79084a,null))['catch'](handleError(_0x79084a,null));};exports['getConfigurations']=function(_0x3fc16c,_0x22bc7c){var _0xb260a={};var _0x101b11={};var _0x2624dc;var _0x27cd48;return db[_0x426e('0x15')][_0x426e('0x32')]({'where':{'id':_0x3fc16c[_0x426e('0x2d')]['id']}})[_0x426e('0xe')](handleEntityNotFound(_0x22bc7c,null))[_0x426e('0xe')](function(_0x3d53b1){if(_0x3d53b1){_0x2624dc=_0x3d53b1;_0x101b11[_0x426e('0x1b')]=_['keys'](db[_0x426e('0x33')][_0x426e('0x16')]);_0x101b11[_0x426e('0x19')]=_[_0x426e('0x1a')](_0x3fc16c[_0x426e('0x19')]);_0x101b11[_0x426e('0x24')]=_[_0x426e('0x1c')](_0x101b11[_0x426e('0x1b')],_0x101b11[_0x426e('0x19')]);_0xb260a['attributes']=_[_0x426e('0x1c')](_0x101b11[_0x426e('0x1b')],qs[_0x426e('0x1d')](_0x3fc16c[_0x426e('0x19')][_0x426e('0x1d')]));_0xb260a[_0x426e('0x1e')]=_0xb260a[_0x426e('0x1e')][_0x426e('0x1f')]?_0xb260a[_0x426e('0x1e')]:_0x101b11[_0x426e('0x1b')];_0xb260a[_0x426e('0x34')]=qs[_0x426e('0x21')](_0x3fc16c['query']['sort']);_0xb260a['where']=qs[_0x426e('0x24')](_['pick'](_0x3fc16c[_0x426e('0x19')],_0x101b11[_0x426e('0x24')]));if(_0x3fc16c[_0x426e('0x19')][_0x426e('0x25')]){_0xb260a['where']=_[_0x426e('0x26')](_0xb260a['where'],{'$or':_['map'](_0xb260a[_0x426e('0x1e')],function(_0x16bcaf){var _0x433083={};_0x433083[_0x16bcaf]={'$like':'%'+_0x3fc16c['query'][_0x426e('0x25')]+'%'};return _0x433083;})});}_0xb260a=_[_0x426e('0x26')]({},_0xb260a,_0x3fc16c['options']);return _0x2624dc[_0x426e('0x35')](_0xb260a);}})[_0x426e('0xe')](function(_0x5490a4){if(_0x5490a4){_0x27cd48=_0x5490a4[_0x426e('0x1f')];if(!_0x3fc16c[_0x426e('0x19')]['hasOwnProperty'](_0x426e('0x36'))){_0xb260a[_0x426e('0x9')]=qs[_0x426e('0x9')](_0x3fc16c[_0x426e('0x19')][_0x426e('0x9')]);_0xb260a[_0x426e('0x7')]=qs['offset'](_0x3fc16c[_0x426e('0x19')][_0x426e('0x7')]);}return _0x2624dc['getConfigurations'](_0xb260a);}})[_0x426e('0xe')](function(_0x97d1c){if(_0x97d1c){return _0x97d1c?{'count':_0x27cd48,'rows':_0x97d1c}:null;}})[_0x426e('0xe')](respondWithResult(_0x22bc7c,null))[_0x426e('0x2c')](handleError(_0x22bc7c,null));};exports[_0x426e('0x37')]=function(_0x2ea407,_0x5b5084){if(_0x2ea407[_0x426e('0x30')]['id']){delete _0x2ea407[_0x426e('0x30')]['id'];}return db[_0x426e('0x15')][_0x426e('0x32')]({'where':{'id':_0x2ea407[_0x426e('0x2d')]['id']}})[_0x426e('0xe')](handleEntityNotFound(_0x5b5084,null))[_0x426e('0xe')](function(_0x536167){if(_0x536167){_0x2ea407[_0x426e('0x30')]['AccountId']=_0x536167['id'];_0x2ea407[_0x426e('0x30')][_0x426e('0x38')]=integrations[_0x426e('0x39')](_0x2ea407[_0x426e('0x30')]['channel'],_0x2ea407['body'][_0x426e('0x17')]);_0x2ea407['body'][_0x426e('0x3a')]=integrations[_0x426e('0x3b')](_0x2ea407['body']['channel'],_0x2ea407[_0x426e('0x30')][_0x426e('0x17')]);return db['Dynamics365Configuration'][_0x426e('0x2f')](_0x2ea407[_0x426e('0x30')],{'include':[{'model':db[_0x426e('0x3c')],'as':_0x426e('0x38')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x426e('0xe')](respondWithResult(_0x5b5084,null))[_0x426e('0x2c')](handleError(_0x5b5084,null));};function sanitizeRemoteUri(_0x56791f){var _0x25d65c=_0x56791f[_0x426e('0x3d')](-0x1);if(_0x25d65c==='/')return _0x56791f['substring'](0x0,_0x56791f[_0x426e('0x3e')](_0x25d65c));return _0x56791f;}function getWebApiUrl(_0x5359d5){return util['format'](_0x426e('0x3f'),_0x5359d5);}exports[_0x426e('0x40')]=function(_0x514b99,_0x364119){var _0x5c68fa=_0x514b99[_0x426e('0x19')][_0x426e('0x41')];var _0x4cabd0=_0x5c68fa===_0x426e('0x42')?_0x426e('0x43'):_0x426e('0x44');var _0x2900cc='';var _0x27dd8b='';var _0x52f8a2='';var _0x361c90='';var _0x5b8388='';var _0x487950='';var _0x9136a5='';var _0x5d8311='';var _0x511d73=[_0x426e('0x45'),_0x426e('0x46'),_0x426e('0x47'),'ownerid',_0x426e('0x48'),_0x426e('0x49'),'phonenumber',_0x426e('0x4a'),_0x426e('0x4b'),'phonecall_activity_parties'];var _0x2be501=[_0x426e('0x4c'),_0x426e('0x4d'),_0x426e('0x4e'),_0x426e('0x4f'),'contactidname',_0x426e('0x50'),_0x426e('0x51'),_0x426e('0x52'),_0x426e('0x53'),'createdbyexternalpartyyominame','createdbyname','createdbyyominame',_0x426e('0x54'),_0x426e('0x55'),_0x426e('0x56'),_0x426e('0x57'),_0x426e('0x58'),_0x426e('0x59'),'emailaddress',_0x426e('0x5a'),_0x426e('0x5b'),_0x426e('0x5c'),_0x426e('0x5d'),'exchangerate',_0x426e('0x5e'),_0x426e('0x5f'),_0x426e('0x60'),'influencescore',_0x426e('0x61'),'lastonholdtime','masteridname',_0x426e('0x62'),_0x426e('0x63'),_0x426e('0x64'),_0x426e('0x65'),_0x426e('0x66'),_0x426e('0x67'),_0x426e('0x68'),_0x426e('0x69'),_0x426e('0x6a'),_0x426e('0x6b'),_0x426e('0x6c'),_0x426e('0x6d'),'owneridname',_0x426e('0x6e'),'owneridyominame',_0x426e('0x6f'),_0x426e('0x70'),_0x426e('0x71'),_0x426e('0x72'),_0x426e('0x73'),_0x426e('0x74'),_0x426e('0x75'),'resolvebykpiidname',_0x426e('0x76'),'responsiblecontactidname',_0x426e('0x77'),'sentimentvalue',_0x426e('0x78'),_0x426e('0x79'),'socialprofileidname',_0x426e('0x7a'),_0x426e('0x7b'),'subjectidname',_0x426e('0x7c'),_0x426e('0x7d'),_0x426e('0x7e'),_0x426e('0x7f'),_0x426e('0x80'),_0x426e('0x81')];var _0x295677=_0x511d73[_0x426e('0x82')](_0x2be501);return db[_0x426e('0x15')][_0x426e('0x32')]({'where':{'id':_0x514b99[_0x426e('0x2d')]['id']},'attributes':['id',_0x426e('0x83'),_0x426e('0x84'),_0x426e('0x85'),_0x426e('0x86'),_0x426e('0x87'),'clientSecret',_0x426e('0x88')],'include':[{'model':db[_0x426e('0x89')],'as':_0x426e('0x89'),'attributes':['id',_0x426e('0x8a'),'data7']}]})[_0x426e('0xe')](handleEntityNotFound(_0x364119,null))[_0x426e('0xe')](function(_0x5a481b){if(_0x5a481b){if(_0x5a481b[_0x426e('0x88')]){_0x5a481b[_0x426e('0x8b')]=_0x5a481b[_0x426e('0x89')][_0x426e('0x8a')];_0x5d8311=sanitizeRemoteUri(_0x5a481b[_0x426e('0x89')][_0x426e('0x8c')]);_0x9136a5=getWebApiUrl(_0x5d8311);return _0x5a481b;}_0x5d8311=sanitizeRemoteUri(_0x5a481b[_0x426e('0x85')]);_0x9136a5=getWebApiUrl(_0x5d8311);var _0x44caa5={'method':_0x426e('0x8d'),'uri':_0x426e('0x8e')+_0x5a481b[_0x426e('0x86')]+_0x426e('0x8f'),'form':{'client_id':_0x5a481b[_0x426e('0x87')],'resource':_0x5d8311,'username':_0x5a481b[_0x426e('0x83')],'password':_0x5a481b[_0x426e('0x84')],'grant_type':_0x426e('0x84'),'client_secret':_0x5a481b[_0x426e('0x90')]},'json':!![]};return rp(_0x44caa5);}})[_0x426e('0xe')](function(_0x4843a6){_0x487950=_0x4843a6['access_token'];var _0x406462={'method':'GET','uri':encodeURI(_0x9136a5+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4cabd0+'\x27'),'headers':{'Authorization':_0x426e('0x91')+_0x487950,'If-None-Match':null,'OData-Version':_0x426e('0x92')},'json':!![]};return rp(_0x406462);})['then'](function(_0xc6885){var _0x22ae68=_0xc6885['value'][0x0];var _0x595de5=_0x22ae68[_0x426e('0x93')];var _0x29f1a9={'method':_0x426e('0x94'),'uri':_0x9136a5+'EntityDefinitions('+_0x595de5+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x487950,'If-None-Match':null,'OData-Version':_0x426e('0x92')},'json':!![]};return rp(_0x29f1a9);})[_0x426e('0xe')](function(_0x40c9a4){_0x2900cc=_0x40c9a4;_0x27dd8b=_0x2900cc[_0x426e('0x95')];_0x27dd8b=_[_0x426e('0x96')](_0x27dd8b,function(_0x2a3842){return!_0x295677[_0x426e('0x97')](_0x2a3842[_0x426e('0x98')]);});var _0x7b12eb=[];var _0x57c2b5=[];_0x27dd8b[_0x426e('0x99')](function(_0x2862d6){if(_0x2862d6[_0x426e('0x9a')]){var _0x3e04dd=_0x2862d6['@odata.type'][_0x426e('0x9b')](_0x2862d6[_0x426e('0x9a')][_0x426e('0x3e')]('.')+0x1);if(_0x3e04dd===_0x426e('0x9c')){_0x7b12eb['push'](getSelectList(_0x9136a5,_0x5c68fa,_0x57c2b5,_0x2900cc[_0x426e('0x93')],_0x2862d6['MetadataId'],_0x487950));}}});return Promise[_0x426e('0x9d')](_0x7b12eb);})['then'](function(_0x1a50b2){_0x52f8a2=_0x1a50b2[0x0];var _0x6064ae=[];var _0x775f87=[];_0x27dd8b['forEach'](function(_0x1d4660){if(!_[_0x426e('0x9e')](_0x1d4660[_0x426e('0x9a')])){var _0x51db08=_0x1d4660[_0x426e('0x9a')][_0x426e('0x9b')](_0x1d4660[_0x426e('0x9a')][_0x426e('0x3e')]('.')+0x1);if(_0x51db08===_0x426e('0x9f')){_0x6064ae['push'](getBooleanList(_0x9136a5,_0x5c68fa,_0x775f87,_0x2900cc['MetadataId'],_0x1d4660['MetadataId'],_0x487950));}}});return Promise[_0x426e('0x9d')](_0x6064ae);})['then'](function(_0x4fcdbe){_0x361c90=_0x4fcdbe[0x0];var _0x2d77c4=[];var _0x315c29=[];_0x27dd8b[_0x426e('0x99')](function(_0x50d130){if(_0x50d130['@odata.type']){var _0x545ee5=_0x50d130[_0x426e('0x9a')][_0x426e('0x9b')](_0x50d130[_0x426e('0x9a')][_0x426e('0x3e')]('.')+0x1);if(_0x545ee5==='StringAttributeMetadata'||_0x545ee5==='DoubleAttributeMetadata'||_0x545ee5===_0x426e('0xa0')||_0x545ee5===_0x426e('0xa1')||_0x545ee5==='MemoAttributeMetadata'||_0x545ee5===_0x426e('0xa2')||_0x545ee5===_0x426e('0xa3')||_0x545ee5===_0x426e('0xa4')||_0x545ee5===_0x426e('0xa5')||_0x545ee5===_0x426e('0xa6')){_0x2d77c4[_0x426e('0xa7')](getInputList(_0x9136a5,_0x5c68fa,_0x545ee5,_0x315c29,_0x2900cc[_0x426e('0x93')],_0x50d130[_0x426e('0x93')],_0x487950));}}});return Promise[_0x426e('0x9d')](_0x2d77c4);})[_0x426e('0xe')](function(_0x445fee){_0x5b8388=_0x445fee[0x0];var _0x28b230=_0x52f8a2[_0x426e('0x82')](_0x361c90)[_0x426e('0x82')](_0x5b8388);var _0x1b41da={'count':_0x28b230[_0x426e('0x1f')],'rows':_0x28b230};return _0x1b41da;})[_0x426e('0xe')](respondWithResult(_0x364119,null))[_0x426e('0x2c')](function(_0x18adf2){var _0x5e47de=_0x514b99[_0x426e('0x19')][_0x426e('0xa8')]?0x1f4:_0x18adf2['statusCode']||0x1f4;logger[_0x426e('0x10')](_0x18adf2[_0x426e('0x11')]);delete _0x18adf2[_0x426e('0x12')];if(_0x5e47de===0x191){_0x5e47de=0x190;}_0x364119[_0x426e('0x5')](_0x5e47de)[_0x426e('0x13')](_0x514b99['query'][_0x426e('0xa8')]?{'message':_0x426e('0xa9'),'statusCode':_0x18adf2[_0x426e('0xaa')]}:_0x18adf2);});};function getSelectList(_0x24ad23,_0x4c92e6,_0x95d306,_0x236b9b,_0x1bd9c8,_0x49d9a8){var _0x29a1b6={'method':_0x426e('0x94'),'uri':_0x24ad23+_0x426e('0xab')+_0x236b9b+_0x426e('0xac')+_0x1bd9c8+_0x426e('0xad')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x426e('0x91')+_0x49d9a8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x29a1b6)[_0x426e('0xe')](function(_0x42da22){var _0x27bd2f=[];var _0x32f2b6=_0x42da22[_0x426e('0xae')][_0x426e('0xaf')];_0x32f2b6['forEach'](function(_0x10ec3d){_0x27bd2f[_0x426e('0xa7')]({'name':_0x10ec3d[_0x426e('0xb0')][_0x426e('0xb1')][_0x426e('0xb0')],'value':String(_0x10ec3d[_0x426e('0xb2')])});});var _0x5b6c3c={'id':_0x4c92e6+'_'+_0x42da22['LogicalName'],'name':_0x42da22[_0x426e('0xb3')]['UserLocalizedLabel'][_0x426e('0xb0')],'custom':![],'options':_0x27bd2f};_0x95d306[_0x426e('0xa7')](_0x5b6c3c);return _0x95d306;});}function getBooleanList(_0x30a0d0,_0x54008b,_0x3920af,_0x2e4086,_0x3df844,_0x57cf1a){var _0x30f277={'method':_0x426e('0x94'),'uri':_0x30a0d0+_0x426e('0xab')+_0x2e4086+_0x426e('0xac')+_0x3df844+_0x426e('0xb4'),'headers':{'Authorization':_0x426e('0x91')+_0x57cf1a,'If-None-Match':null,'OData-Version':_0x426e('0x92')},'json':!![]};return rp(_0x30f277)[_0x426e('0xe')](function(_0x14f6d2){var _0x18af69=[];_0x18af69[_0x426e('0xa7')]({'name':_0x14f6d2[_0x426e('0xae')][_0x426e('0xb5')][_0x426e('0xb0')][_0x426e('0xb1')][_0x426e('0xb0')],'value':_0x426e('0xb6')},{'name':_0x14f6d2['OptionSet'][_0x426e('0xb7')][_0x426e('0xb0')][_0x426e('0xb1')]['Label'],'value':_0x426e('0xb8')});var _0x44cf7a={'id':_0x54008b+'_'+_0x14f6d2[_0x426e('0x98')],'name':_0x14f6d2[_0x426e('0xb3')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x18af69};_0x3920af['push'](_0x44cf7a);return _0x3920af;});}function getInputList(_0x3e39e1,_0x567357,_0x158813,_0x46b9c6,_0x166f00,_0x484d2e,_0x1c33aa){var _0x1c1a88={'method':_0x426e('0x94'),'uri':_0x3e39e1+_0x426e('0xab')+_0x166f00+_0x426e('0xac')+_0x484d2e+_0x426e('0xb9')+_0x158813+_0x426e('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x1c33aa,'If-None-Match':null,'OData-Version':_0x426e('0x92')},'json':!![]};return rp(_0x1c1a88)[_0x426e('0xe')](function(_0x35a435){var _0x286817={'id':_0x567357+'_'+_0x35a435[_0x426e('0x98')],'name':_0x35a435['DisplayName'][_0x426e('0xb1')]?_0x35a435[_0x426e('0xb3')][_0x426e('0xb1')][_0x426e('0xb0')]:_0x35a435['LogicalName'],'custom':![],'options':[]};_0x46b9c6[_0x426e('0xa7')](_0x286817);return _0x46b9c6;});} \ No newline at end of file +var _0xc7ea=['sendStatus','error','stack','name','send','map','Dynamics365Account','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','AccountId','Subjects','type','Descriptions','getDescriptions','channel','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','MetadataId','all','StringAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','end'];(function(_0x3015f9,_0x6eeb0d){var _0x3390b6=function(_0x4cff57){while(--_0x4cff57){_0x3015f9['push'](_0x3015f9['shift']());}};_0x3390b6(++_0x6eeb0d);}(_0xc7ea,0x171));var _0xac7e=function(_0x44c25c,_0x4bf0a6){_0x44c25c=_0x44c25c-0x0;var _0x5aa80a=_0xc7ea[_0x44c25c];return _0x5aa80a;};'use strict';var rp=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var _=require('lodash');var qs=require(_0xac7e('0x2'));var logger=require(_0xac7e('0x3'))(_0xac7e('0x4'));var db=require(_0xac7e('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x134a3d,_0x39bf60){_0x39bf60=_0x39bf60||0xc8;return function(_0x1c15cf){if(_0x1c15cf){return _0x134a3d[_0xac7e('0x6')](_0x39bf60)[_0xac7e('0x7')](_0x1c15cf);}};}function respondWithFilteredResult(_0x45e73f,_0x447bfe){return function(_0x1aca29){if(_0x1aca29){var _0x1612f3=typeof _0x447bfe[_0xac7e('0x8')]==='undefined'&&typeof _0x447bfe[_0xac7e('0x9')]===_0xac7e('0xa');var _0x2efbf4=_0x1aca29[_0xac7e('0xb')];var _0x39d2e3=_0x1612f3?0x0:_0x447bfe[_0xac7e('0x8')];var _0x10873d=_0x1612f3?_0x1aca29[_0xac7e('0xb')]:_0x447bfe[_0xac7e('0x8')]+_0x447bfe[_0xac7e('0x9')];var _0x404fc0;if(_0x10873d>=_0x2efbf4){_0x10873d=_0x2efbf4;_0x404fc0=0xc8;}else{_0x404fc0=0xce;}_0x45e73f[_0xac7e('0x6')](_0x404fc0);return _0x45e73f['set'](_0xac7e('0xc'),_0x39d2e3+'-'+_0x10873d+'/'+_0x2efbf4)[_0xac7e('0x7')](_0x1aca29);}return null;};}function saveUpdates(_0x5d4537){return function(_0x617cf9){if(_0x617cf9){return _0x617cf9[_0xac7e('0xd')](_0x5d4537)[_0xac7e('0xe')](function(_0x145382){return _0x145382;});}return null;};}function removeEntity(_0x31a8e7){return function(_0x52be09){if(_0x52be09){return _0x52be09[_0xac7e('0xf')]()[_0xac7e('0xe')](function(){_0x31a8e7[_0xac7e('0x6')](0xcc)[_0xac7e('0x10')]();});}};}function handleEntityNotFound(_0x333436){return function(_0x232ce5){if(!_0x232ce5){_0x333436[_0xac7e('0x11')](0x194);}return _0x232ce5;};}function handleError(_0x11ed74,_0x5f08f1){_0x5f08f1=_0x5f08f1||0x1f4;return function(_0x3f4869){logger[_0xac7e('0x12')](_0x3f4869[_0xac7e('0x13')]);if(_0x3f4869[_0xac7e('0x14')]){delete _0x3f4869[_0xac7e('0x14')];}_0x11ed74['status'](_0x5f08f1)[_0xac7e('0x15')](_0x3f4869);};}exports['index']=function(_0xba3d01,_0x5e89f1){var _0xa048e9={},_0x406f0a={},_0x231ab0={'count':0x0,'rows':[]};var _0x41ae40=_[_0xac7e('0x16')](db[_0xac7e('0x17')]['rawAttributes'],function(_0x12d34a){return{'name':_0x12d34a[_0xac7e('0x18')],'type':_0x12d34a['type'][_0xac7e('0x19')]};});_0x406f0a[_0xac7e('0x1a')]=_[_0xac7e('0x16')](_0x41ae40,_0xac7e('0x14'));_0x406f0a[_0xac7e('0x1b')]=_[_0xac7e('0x1c')](_0xba3d01[_0xac7e('0x1b')]);_0x406f0a[_0xac7e('0x1d')]=_[_0xac7e('0x1e')](_0x406f0a[_0xac7e('0x1a')],_0x406f0a[_0xac7e('0x1b')]);_0xa048e9['attributes']=_['intersection'](_0x406f0a[_0xac7e('0x1a')],qs[_0xac7e('0x1f')](_0xba3d01[_0xac7e('0x1b')]['fields']));_0xa048e9[_0xac7e('0x20')]=_0xa048e9[_0xac7e('0x20')][_0xac7e('0x21')]?_0xa048e9[_0xac7e('0x20')]:_0x406f0a['model'];if(!_0xba3d01['query'][_0xac7e('0x22')]('nolimit')){_0xa048e9['limit']=qs[_0xac7e('0x9')](_0xba3d01[_0xac7e('0x1b')][_0xac7e('0x9')]);_0xa048e9['offset']=qs[_0xac7e('0x8')](_0xba3d01[_0xac7e('0x1b')][_0xac7e('0x8')]);}_0xa048e9[_0xac7e('0x23')]=qs['sort'](_0xba3d01[_0xac7e('0x1b')][_0xac7e('0x24')]);_0xa048e9[_0xac7e('0x25')]=qs['filters'](_[_0xac7e('0x26')](_0xba3d01[_0xac7e('0x1b')],_0x406f0a[_0xac7e('0x1d')]),_0x41ae40);if(_0xba3d01[_0xac7e('0x1b')]['filter']){_0xa048e9[_0xac7e('0x25')]=_['merge'](_0xa048e9[_0xac7e('0x25')],{'$or':_[_0xac7e('0x16')](_0x41ae40,function(_0x3c08f6){if(_0x3c08f6['type']!==_0xac7e('0x27')){var _0x2e1fe3={};_0x2e1fe3[_0x3c08f6['name']]={'$like':'%'+_0xba3d01['query'][_0xac7e('0x28')]+'%'};return _0x2e1fe3;}})});}_0xa048e9=_[_0xac7e('0x29')]({},_0xa048e9,_0xba3d01[_0xac7e('0x2a')]);var _0x2133c7={'where':_0xa048e9[_0xac7e('0x25')]};return db[_0xac7e('0x17')][_0xac7e('0xb')](_0x2133c7)[_0xac7e('0xe')](function(_0x38bfb1){_0x231ab0['count']=_0x38bfb1;if(_0xba3d01[_0xac7e('0x1b')][_0xac7e('0x2b')]){_0xa048e9[_0xac7e('0x2c')]=[{'all':!![]}];}return db[_0xac7e('0x17')][_0xac7e('0x2d')](_0xa048e9);})[_0xac7e('0xe')](function(_0x4df140){_0x231ab0['rows']=_0x4df140;return _0x231ab0;})[_0xac7e('0xe')](respondWithFilteredResult(_0x5e89f1,_0xa048e9))[_0xac7e('0x2e')](handleError(_0x5e89f1,null));};exports[_0xac7e('0x2f')]=function(_0x411f47,_0xadc329){var _0x128298={'raw':![],'where':{'id':_0x411f47[_0xac7e('0x30')]['id']}},_0x278848={};_0x278848[_0xac7e('0x1a')]=_['keys'](db[_0xac7e('0x17')][_0xac7e('0x31')]);_0x278848['query']=_[_0xac7e('0x1c')](_0x411f47[_0xac7e('0x1b')]);_0x278848['filters']=_[_0xac7e('0x1e')](_0x278848[_0xac7e('0x1a')],_0x278848[_0xac7e('0x1b')]);_0x128298[_0xac7e('0x20')]=_[_0xac7e('0x1e')](_0x278848[_0xac7e('0x1a')],qs[_0xac7e('0x1f')](_0x411f47[_0xac7e('0x1b')]['fields']));_0x128298[_0xac7e('0x20')]=_0x128298[_0xac7e('0x20')]['length']?_0x128298[_0xac7e('0x20')]:_0x278848[_0xac7e('0x1a')];if(_0x411f47[_0xac7e('0x1b')]['includeAll']){_0x128298['include']=[{'all':!![]}];}_0x128298=_[_0xac7e('0x29')]({},_0x128298,_0x411f47[_0xac7e('0x2a')]);return db['Dynamics365Account'][_0xac7e('0x32')](_0x128298)[_0xac7e('0xe')](handleEntityNotFound(_0xadc329,null))[_0xac7e('0xe')](respondWithResult(_0xadc329,null))[_0xac7e('0x2e')](handleError(_0xadc329,null));};exports[_0xac7e('0x33')]=function(_0x21e628,_0x3794ad){return db[_0xac7e('0x17')][_0xac7e('0x33')](_0x21e628[_0xac7e('0x34')],{})[_0xac7e('0xe')](respondWithResult(_0x3794ad,0xc9))[_0xac7e('0x2e')](handleError(_0x3794ad,null));};exports[_0xac7e('0xd')]=function(_0x5c2437,_0x2f31d9){if(_0x5c2437[_0xac7e('0x34')]['id']){delete _0x5c2437['body']['id'];}return db[_0xac7e('0x17')][_0xac7e('0x32')]({'where':{'id':_0x5c2437[_0xac7e('0x30')]['id']}})[_0xac7e('0xe')](handleEntityNotFound(_0x2f31d9,null))['then'](saveUpdates(_0x5c2437[_0xac7e('0x34')],null))[_0xac7e('0xe')](respondWithResult(_0x2f31d9,null))['catch'](handleError(_0x2f31d9,null));};exports['destroy']=function(_0x4c5880,_0x309a8e){return db['Dynamics365Account'][_0xac7e('0x32')]({'where':{'id':_0x4c5880[_0xac7e('0x30')]['id']}})['then'](handleEntityNotFound(_0x309a8e,null))[_0xac7e('0xe')](removeEntity(_0x309a8e,null))[_0xac7e('0x2e')](handleError(_0x309a8e,null));};exports[_0xac7e('0x35')]=function(_0x2cc3bd,_0x156517){var _0x284724={};var _0x5c0642={};var _0x1808c2;var _0x1d4a60;return db[_0xac7e('0x17')]['findOne']({'where':{'id':_0x2cc3bd[_0xac7e('0x30')]['id']}})[_0xac7e('0xe')](handleEntityNotFound(_0x156517,null))['then'](function(_0x5dca76){if(_0x5dca76){_0x1808c2=_0x5dca76;_0x5c0642['model']=_['keys'](db[_0xac7e('0x36')]['rawAttributes']);_0x5c0642['query']=_['keys'](_0x2cc3bd['query']);_0x5c0642[_0xac7e('0x1d')]=_['intersection'](_0x5c0642[_0xac7e('0x1a')],_0x5c0642[_0xac7e('0x1b')]);_0x284724[_0xac7e('0x20')]=_['intersection'](_0x5c0642['model'],qs[_0xac7e('0x1f')](_0x2cc3bd['query']['fields']));_0x284724[_0xac7e('0x20')]=_0x284724[_0xac7e('0x20')][_0xac7e('0x21')]?_0x284724['attributes']:_0x5c0642['model'];_0x284724['order']=qs['sort'](_0x2cc3bd[_0xac7e('0x1b')][_0xac7e('0x24')]);_0x284724[_0xac7e('0x25')]=qs[_0xac7e('0x1d')](_[_0xac7e('0x26')](_0x2cc3bd[_0xac7e('0x1b')],_0x5c0642[_0xac7e('0x1d')]));if(_0x2cc3bd[_0xac7e('0x1b')][_0xac7e('0x28')]){_0x284724['where']=_[_0xac7e('0x29')](_0x284724[_0xac7e('0x25')],{'$or':_[_0xac7e('0x16')](_0x284724['attributes'],function(_0x1b2b9e){var _0x22a663={};_0x22a663[_0x1b2b9e]={'$like':'%'+_0x2cc3bd[_0xac7e('0x1b')][_0xac7e('0x28')]+'%'};return _0x22a663;})});}_0x284724=_[_0xac7e('0x29')]({},_0x284724,_0x2cc3bd[_0xac7e('0x2a')]);return _0x1808c2[_0xac7e('0x35')](_0x284724);}})[_0xac7e('0xe')](function(_0xbbef){if(_0xbbef){_0x1d4a60=_0xbbef[_0xac7e('0x21')];if(!_0x2cc3bd[_0xac7e('0x1b')][_0xac7e('0x22')]('nolimit')){_0x284724[_0xac7e('0x9')]=qs['limit'](_0x2cc3bd[_0xac7e('0x1b')]['limit']);_0x284724[_0xac7e('0x8')]=qs[_0xac7e('0x8')](_0x2cc3bd[_0xac7e('0x1b')]['offset']);}return _0x1808c2['getConfigurations'](_0x284724);}})[_0xac7e('0xe')](function(_0x4db4e9){if(_0x4db4e9){return _0x4db4e9?{'count':_0x1d4a60,'rows':_0x4db4e9}:null;}})[_0xac7e('0xe')](respondWithResult(_0x156517,null))[_0xac7e('0x2e')](handleError(_0x156517,null));};exports[_0xac7e('0x37')]=function(_0x34dd23,_0x36f9e0){if(_0x34dd23[_0xac7e('0x34')]['id']){delete _0x34dd23[_0xac7e('0x34')]['id'];}return db[_0xac7e('0x17')][_0xac7e('0x38')]({'where':{'id':_0x34dd23[_0xac7e('0x30')]['id']}})['then'](handleEntityNotFound(_0x36f9e0,null))['then'](function(_0x67410e){if(_0x67410e){_0x34dd23[_0xac7e('0x34')][_0xac7e('0x39')]=_0x67410e['id'];_0x34dd23[_0xac7e('0x34')][_0xac7e('0x3a')]=integrations['getSubjects'](_0x34dd23[_0xac7e('0x34')]['channel'],_0x34dd23[_0xac7e('0x34')][_0xac7e('0x3b')]);_0x34dd23[_0xac7e('0x34')][_0xac7e('0x3c')]=integrations[_0xac7e('0x3d')](_0x34dd23[_0xac7e('0x34')][_0xac7e('0x3e')],_0x34dd23[_0xac7e('0x34')]['type']);return db['Dynamics365Configuration'][_0xac7e('0x33')](_0x34dd23['body'],{'include':[{'model':db[_0xac7e('0x3f')],'as':'Subjects'},{'model':db[_0xac7e('0x3f')],'as':_0xac7e('0x3c')}]});}return null;})[_0xac7e('0xe')](respondWithResult(_0x36f9e0,null))[_0xac7e('0x2e')](handleError(_0x36f9e0,null));};function sanitizeRemoteUri(_0x4b3354){var _0x1f6553=_0x4b3354[_0xac7e('0x40')](-0x1);if(_0x1f6553==='/')return _0x4b3354['substring'](0x0,_0x4b3354[_0xac7e('0x41')](_0x1f6553));return _0x4b3354;}function getWebApiUrl(_0x4c5810){return util[_0xac7e('0x42')](_0xac7e('0x43'),_0x4c5810);}exports[_0xac7e('0x44')]=function(_0x532bad,_0x16d363){var _0x473919=_0x532bad['query'][_0xac7e('0x45')];var _0x56e54d=_0x473919===_0xac7e('0x46')?_0xac7e('0x47'):_0xac7e('0x48');var _0x590ab0='';var _0x13c1fa='';var _0x289b86='';var _0x37a79b='';var _0x2c8c69='';var _0x45853c='';var _0x35dd64='';var _0x4877db='';var _0x4b744f=['title',_0xac7e('0x49'),_0xac7e('0x4a'),_0xac7e('0x4b'),_0xac7e('0x4c'),'subject','phonenumber',_0xac7e('0x4d'),_0xac7e('0x4e'),_0xac7e('0x4f')];var _0x2ee255=[_0xac7e('0x50'),_0xac7e('0x51'),_0xac7e('0x52'),_0xac7e('0x53'),_0xac7e('0x54'),_0xac7e('0x55'),_0xac7e('0x56'),_0xac7e('0x57'),_0xac7e('0x58'),_0xac7e('0x59'),_0xac7e('0x5a'),_0xac7e('0x5b'),_0xac7e('0x5c'),_0xac7e('0x5d'),_0xac7e('0x5e'),_0xac7e('0x5f'),_0xac7e('0x60'),'customeridyominame',_0xac7e('0x61'),'entitlementidname',_0xac7e('0x62'),_0xac7e('0x63'),_0xac7e('0x64'),_0xac7e('0x65'),_0xac7e('0x66'),_0xac7e('0x67'),_0xac7e('0x68'),'influencescore',_0xac7e('0x69'),_0xac7e('0x6a'),'masteridname','modifiedbyexternalpartyname',_0xac7e('0x6b'),_0xac7e('0x6c'),_0xac7e('0x6d'),_0xac7e('0x6e'),'modifiedonbehalfbyname',_0xac7e('0x6f'),_0xac7e('0x70'),_0xac7e('0x71'),_0xac7e('0x72'),'onholdtime',_0xac7e('0x73'),'owneridname','owneridtype',_0xac7e('0x74'),_0xac7e('0x75'),_0xac7e('0x76'),_0xac7e('0x77'),_0xac7e('0x78'),_0xac7e('0x79'),_0xac7e('0x7a'),_0xac7e('0x7b'),_0xac7e('0x7c'),_0xac7e('0x7d'),'responsiblecontactidname',_0xac7e('0x7e'),'sentimentvalue',_0xac7e('0x7f'),_0xac7e('0x80'),_0xac7e('0x81'),_0xac7e('0x82'),_0xac7e('0x83'),_0xac7e('0x84'),_0xac7e('0x85'),_0xac7e('0x86'),'transactioncurrencyidname','traversedpath',_0xac7e('0x87'),_0xac7e('0x88')];var _0x1afeda=_0x4b744f[_0xac7e('0x89')](_0x2ee255);return db[_0xac7e('0x17')][_0xac7e('0x38')]({'where':{'id':_0x532bad[_0xac7e('0x30')]['id']},'attributes':['id',_0xac7e('0x8a'),'password',_0xac7e('0x8b'),_0xac7e('0x8c'),_0xac7e('0x8d'),_0xac7e('0x8e'),_0xac7e('0x8f')],'include':[{'model':db[_0xac7e('0x90')],'as':_0xac7e('0x90'),'attributes':['id',_0xac7e('0x91'),_0xac7e('0x92')]}]})[_0xac7e('0xe')](handleEntityNotFound(_0x16d363,null))['then'](function(_0x19db63){if(_0x19db63){if(_0x19db63[_0xac7e('0x8f')]){_0x19db63['access_token']=_0x19db63['CloudProvider']['data5'];_0x4877db=sanitizeRemoteUri(_0x19db63['CloudProvider'][_0xac7e('0x92')]);_0x35dd64=getWebApiUrl(_0x4877db);return _0x19db63;}_0x4877db=sanitizeRemoteUri(_0x19db63[_0xac7e('0x8b')]);_0x35dd64=getWebApiUrl(_0x4877db);var _0x2f02d9={'method':'POST','uri':_0xac7e('0x93')+_0x19db63[_0xac7e('0x8c')]+_0xac7e('0x94'),'form':{'client_id':_0x19db63[_0xac7e('0x8d')],'resource':_0x4877db,'username':_0x19db63[_0xac7e('0x8a')],'password':_0x19db63[_0xac7e('0x95')],'grant_type':_0xac7e('0x95'),'client_secret':_0x19db63[_0xac7e('0x8e')]},'json':!![]};return rp(_0x2f02d9);}})[_0xac7e('0xe')](function(_0x209dcd){_0x45853c=_0x209dcd['access_token'];var _0x550cfe={'method':_0xac7e('0x96'),'uri':encodeURI(_0x35dd64+_0xac7e('0x97')+_0x56e54d+'\x27'),'headers':{'Authorization':_0xac7e('0x98')+_0x45853c,'If-None-Match':null,'OData-Version':_0xac7e('0x99')},'json':!![]};return rp(_0x550cfe);})[_0xac7e('0xe')](function(_0x2c981f){var _0xa9a42b=_0x2c981f[_0xac7e('0x9a')][0x0];var _0x1e05f7=_0xa9a42b['MetadataId'];var _0x846630={'method':_0xac7e('0x96'),'uri':_0x35dd64+'EntityDefinitions('+_0x1e05f7+_0xac7e('0x9b'),'headers':{'Authorization':'Bearer\x20'+_0x45853c,'If-None-Match':null,'OData-Version':_0xac7e('0x99')},'json':!![]};return rp(_0x846630);})[_0xac7e('0xe')](function(_0x16a3aa){_0x590ab0=_0x16a3aa;_0x13c1fa=_0x590ab0[_0xac7e('0x9c')];_0x13c1fa=_[_0xac7e('0x9d')](_0x13c1fa,function(_0x580a24){return!_0x1afeda[_0xac7e('0x9e')](_0x580a24[_0xac7e('0x9f')]);});var _0x467b36=[];var _0x1010d2=[];_0x13c1fa[_0xac7e('0xa0')](function(_0x5d25d3){if(_0x5d25d3[_0xac7e('0xa1')]){var _0x330802=_0x5d25d3[_0xac7e('0xa1')][_0xac7e('0xa2')](_0x5d25d3[_0xac7e('0xa1')]['lastIndexOf']('.')+0x1);if(_0x330802===_0xac7e('0xa3')){_0x467b36[_0xac7e('0xa4')](getSelectList(_0x35dd64,_0x473919,_0x1010d2,_0x590ab0['MetadataId'],_0x5d25d3['MetadataId'],_0x45853c));}}});return Promise['all'](_0x467b36);})[_0xac7e('0xe')](function(_0x1e918a){_0x289b86=_0x1e918a[0x0];var _0x1df5ff=[];var _0x460847=[];_0x13c1fa[_0xac7e('0xa0')](function(_0x5f12c5){if(!_[_0xac7e('0xa5')](_0x5f12c5[_0xac7e('0xa1')])){var _0x15468e=_0x5f12c5[_0xac7e('0xa1')][_0xac7e('0xa2')](_0x5f12c5[_0xac7e('0xa1')][_0xac7e('0x41')]('.')+0x1);if(_0x15468e===_0xac7e('0xa6')){_0x1df5ff[_0xac7e('0xa4')](getBooleanList(_0x35dd64,_0x473919,_0x460847,_0x590ab0[_0xac7e('0xa7')],_0x5f12c5['MetadataId'],_0x45853c));}}});return Promise[_0xac7e('0xa8')](_0x1df5ff);})[_0xac7e('0xe')](function(_0x6123fa){_0x37a79b=_0x6123fa[0x0];var _0x2b12e3=[];var _0xca7703=[];_0x13c1fa[_0xac7e('0xa0')](function(_0x5e1a0b){if(_0x5e1a0b['@odata.type']){var _0x3d459f=_0x5e1a0b[_0xac7e('0xa1')][_0xac7e('0xa2')](_0x5e1a0b[_0xac7e('0xa1')][_0xac7e('0x41')]('.')+0x1);if(_0x3d459f===_0xac7e('0xa9')||_0x3d459f==='DoubleAttributeMetadata'||_0x3d459f==='BigIntAttributeMetadata'||_0x3d459f==='IntegerAttributeMetadata'||_0x3d459f===_0xac7e('0xaa')||_0x3d459f===_0xac7e('0xab')||_0x3d459f===_0xac7e('0xac')||_0x3d459f==='EntityNameAttributeMetadata'||_0x3d459f===_0xac7e('0xad')||_0x3d459f===_0xac7e('0xae')){_0x2b12e3[_0xac7e('0xa4')](getInputList(_0x35dd64,_0x473919,_0x3d459f,_0xca7703,_0x590ab0['MetadataId'],_0x5e1a0b[_0xac7e('0xa7')],_0x45853c));}}});return Promise[_0xac7e('0xa8')](_0x2b12e3);})[_0xac7e('0xe')](function(_0x26d69e){_0x2c8c69=_0x26d69e[0x0];var _0x56359a=_0x289b86['concat'](_0x37a79b)['concat'](_0x2c8c69);var _0x4429da={'count':_0x56359a[_0xac7e('0x21')],'rows':_0x56359a};return _0x4429da;})['then'](respondWithResult(_0x16d363,null))[_0xac7e('0x2e')](function(_0x1b0dce){var _0x4f18f7=_0x532bad[_0xac7e('0x1b')][_0xac7e('0xaf')]?0x1f4:_0x1b0dce['statusCode']||0x1f4;logger[_0xac7e('0x12')](_0x1b0dce['stack']);delete _0x1b0dce[_0xac7e('0x14')];if(_0x4f18f7===0x191){_0x4f18f7=0x190;}_0x16d363[_0xac7e('0x6')](_0x4f18f7)['send'](_0x532bad['query'][_0xac7e('0xaf')]?{'message':'Wrong\x20credentials','statusCode':_0x1b0dce[_0xac7e('0xb0')]}:_0x1b0dce);});};function getSelectList(_0x4c4084,_0x582446,_0x552bac,_0x4ae3dc,_0x943b4d,_0x257612){var _0x11b7c8={'method':_0xac7e('0x96'),'uri':_0x4c4084+_0xac7e('0xb1')+_0x4ae3dc+_0xac7e('0xb2')+_0x943b4d+_0xac7e('0xb3')+_0xac7e('0xb4'),'headers':{'Authorization':_0xac7e('0x98')+_0x257612,'If-None-Match':null,'OData-Version':_0xac7e('0x99')},'json':!![]};return rp(_0x11b7c8)['then'](function(_0x4bf1e4){var _0x5ddc63=[];var _0x5d5294=_0x4bf1e4[_0xac7e('0xb5')][_0xac7e('0xb6')];_0x5d5294['forEach'](function(_0x3f9c36){_0x5ddc63[_0xac7e('0xa4')]({'name':_0x3f9c36[_0xac7e('0xb7')][_0xac7e('0xb8')][_0xac7e('0xb7')],'value':String(_0x3f9c36['Value'])});});var _0x1564f6={'id':_0x582446+'_'+_0x4bf1e4[_0xac7e('0x9f')],'name':_0x4bf1e4[_0xac7e('0xb9')][_0xac7e('0xb8')][_0xac7e('0xb7')],'custom':![],'options':_0x5ddc63};_0x552bac[_0xac7e('0xa4')](_0x1564f6);return _0x552bac;});}function getBooleanList(_0x37da95,_0x115ef5,_0x1e15a2,_0x2126ea,_0x1551b5,_0x3142cc){var _0x415bc4={'method':_0xac7e('0x96'),'uri':_0x37da95+'EntityDefinitions('+_0x2126ea+')/Attributes('+_0x1551b5+_0xac7e('0xba'),'headers':{'Authorization':_0xac7e('0x98')+_0x3142cc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x415bc4)[_0xac7e('0xe')](function(_0x2df06f){var _0x291463=[];_0x291463[_0xac7e('0xa4')]({'name':_0x2df06f[_0xac7e('0xb5')][_0xac7e('0xbb')][_0xac7e('0xb7')][_0xac7e('0xb8')][_0xac7e('0xb7')],'value':_0xac7e('0xbc')},{'name':_0x2df06f[_0xac7e('0xb5')][_0xac7e('0xbd')][_0xac7e('0xb7')]['UserLocalizedLabel'][_0xac7e('0xb7')],'value':_0xac7e('0xbe')});var _0x269843={'id':_0x115ef5+'_'+_0x2df06f[_0xac7e('0x9f')],'name':_0x2df06f[_0xac7e('0xb9')][_0xac7e('0xb8')]['Label'],'custom':![],'options':_0x291463};_0x1e15a2[_0xac7e('0xa4')](_0x269843);return _0x1e15a2;});}function getInputList(_0xd1a651,_0x44b9a6,_0x3cd8d4,_0x3ffa05,_0x4fc859,_0x4b6604,_0x1690c){var _0x11f209={'method':_0xac7e('0x96'),'uri':_0xd1a651+_0xac7e('0xb1')+_0x4fc859+_0xac7e('0xb2')+_0x4b6604+_0xac7e('0xbf')+_0x3cd8d4+_0xac7e('0xc0'),'headers':{'Authorization':_0xac7e('0x98')+_0x1690c,'If-None-Match':null,'OData-Version':_0xac7e('0x99')},'json':!![]};return rp(_0x11f209)[_0xac7e('0xe')](function(_0x5b04c7){var _0x41d80b={'id':_0x44b9a6+'_'+_0x5b04c7[_0xac7e('0x9f')],'name':_0x5b04c7[_0xac7e('0xb9')][_0xac7e('0xb8')]?_0x5b04c7[_0xac7e('0xb9')][_0xac7e('0xb8')][_0xac7e('0xb7')]:_0x5b04c7['LogicalName'],'custom':![],'options':[]};_0x3ffa05[_0xac7e('0xa4')](_0x41d80b);return _0x3ffa05;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 1fdaf1a..9f61a79 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x48ed05,_0x1df487){var _0x22dd1e=function(_0x5e17d0){while(--_0x5e17d0){_0x48ed05['push'](_0x48ed05['shift']());}};_0x22dd1e(++_0x1df487);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x580705,_0x47233b){var _0x264300=function(_0x20cb18){while(--_0x20cb18){_0x580705['push'](_0x580705['shift']());}};_0x264300(++_0x47233b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 0647035..752a55b 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.rpc.js +++ b/server/api/intDynamics365Account/intDynamics365Account.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbb1=['map','model','info','debug','catch','ShowDynamics365Account','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','request\x20sent','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include'];(function(_0x6950d7,_0x5c2b4e){var _0x273632=function(_0x4d1845){while(--_0x4d1845){_0x6950d7['push'](_0x6950d7['shift']());}};_0x273632(++_0x5c2b4e);}(_0xbbb1,0x11e));var _0x1bbb=function(_0x2cd98f,_0x5d1e2b){_0x2cd98f=_0x2cd98f-0x0;var _0x429040=_0xbbb1[_0x2cd98f];return _0x429040;};'use strict';var _=require('lodash');var util=require(_0x1bbb('0x0'));var moment=require(_0x1bbb('0x1'));var BPromise=require(_0x1bbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bbb('0x3'))['db'];var utils=require(_0x1bbb('0x4'));var logger=require(_0x1bbb('0x5'))(_0x1bbb('0x6'));var config=require(_0x1bbb('0x7'));var jayson=require(_0x1bbb('0x8'));var client=jayson[_0x1bbb('0x9')][_0x1bbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14a4e6,_0x5e87c1,_0x435c02){return new BPromise(function(_0x31c8af,_0x521cb2){return client[_0x1bbb('0xb')](_0x14a4e6,_0x435c02)[_0x1bbb('0xc')](function(_0x453c7d){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5e87c1,'request\x20sent');logger['debug'](_0x1bbb('0xd'),_0x5e87c1,'request\x20sent',JSON[_0x1bbb('0xe')](_0x453c7d));if(_0x453c7d['error']){if(_0x453c7d[_0x1bbb('0xf')][_0x1bbb('0x10')]===0x1f4){logger[_0x1bbb('0xf')](_0x1bbb('0x11'),_0x5e87c1,_0x453c7d[_0x1bbb('0xf')][_0x1bbb('0x12')]);return _0x521cb2(_0x453c7d[_0x1bbb('0xf')][_0x1bbb('0x12')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5e87c1,_0x453c7d[_0x1bbb('0xf')]['message']);return _0x31c8af(_0x453c7d[_0x1bbb('0xf')][_0x1bbb('0x12')]);}else{logger['info'](_0x1bbb('0x11'),_0x5e87c1,_0x1bbb('0x13'));_0x31c8af(_0x453c7d['result'][_0x1bbb('0x12')]);}})['catch'](function(_0x5bc20b){logger[_0x1bbb('0xf')](_0x1bbb('0x11'),_0x5e87c1,_0x5bc20b);_0x521cb2(_0x5bc20b);});});}exports[_0x1bbb('0x14')]=function(_0x49bff6){var _0x157c53=this;return new Promise(function(_0x34be1c,_0x419039){return db[_0x1bbb('0x15')][_0x1bbb('0x16')]({'raw':_0x49bff6[_0x1bbb('0x17')]?_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x18')]===undefined?!![]:![]:!![],'where':_0x49bff6[_0x1bbb('0x17')]?_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x19')]||null:null,'attributes':_0x49bff6[_0x1bbb('0x17')]?_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x1a')]||null:null,'limit':_0x49bff6[_0x1bbb('0x17')]?_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x1b')]||null:null,'include':_0x49bff6[_0x1bbb('0x17')]?_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x1c')]?_[_0x1bbb('0x1d')](_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x1c')],function(_0x513bd3){return{'model':db[_0x513bd3[_0x1bbb('0x1e')]],'as':_0x513bd3['as'],'attributes':_0x513bd3['attributes'],'include':_0x513bd3['include']?_[_0x1bbb('0x1d')](_0x513bd3[_0x1bbb('0x1c')],function(_0x30e2b9){return{'model':db[_0x30e2b9[_0x1bbb('0x1e')]],'as':_0x30e2b9['as'],'attributes':_0x30e2b9[_0x1bbb('0x1a')],'include':_0x30e2b9[_0x1bbb('0x1c')]?_[_0x1bbb('0x1d')](_0x30e2b9[_0x1bbb('0x1c')],function(_0x112907){return{'model':db[_0x112907[_0x1bbb('0x1e')]],'as':_0x112907['as'],'attributes':_0x112907[_0x1bbb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1bbb('0xc')](function(_0x17980a){logger[_0x1bbb('0x1f')](_0x1bbb('0x14'),_0x49bff6);logger[_0x1bbb('0x20')](_0x1bbb('0x14'),_0x49bff6,JSON[_0x1bbb('0xe')](_0x17980a));_0x34be1c(_0x17980a);})[_0x1bbb('0x21')](function(_0x596677){logger['error']('GetDynamics365Account',_0x596677[_0x1bbb('0x12')],_0x49bff6);_0x419039(_0x157c53[_0x1bbb('0xf')](0x1f4,_0x596677[_0x1bbb('0x12')]));});});};exports[_0x1bbb('0x22')]=function(_0x3eb6da){var _0x35586e=this;return new Promise(function(_0x3fc925,_0x50035e){return db['Dynamics365Account']['find']({'raw':_0x3eb6da[_0x1bbb('0x17')]?_0x3eb6da['options'][_0x1bbb('0x18')]===undefined?!![]:![]:!![],'where':_0x3eb6da[_0x1bbb('0x17')]?_0x3eb6da['options'][_0x1bbb('0x19')]||null:null,'attributes':_0x3eb6da[_0x1bbb('0x17')]?_0x3eb6da[_0x1bbb('0x17')][_0x1bbb('0x1a')]||null:null,'include':_0x3eb6da['options']?_0x3eb6da['options'][_0x1bbb('0x1c')]?_[_0x1bbb('0x1d')](_0x3eb6da[_0x1bbb('0x17')]['include'],function(_0x34978c){return{'model':db[_0x34978c[_0x1bbb('0x1e')]],'as':_0x34978c['as'],'attributes':_0x34978c[_0x1bbb('0x1a')],'include':_0x34978c['include']?_[_0x1bbb('0x1d')](_0x34978c[_0x1bbb('0x1c')],function(_0x19938c){return{'model':db[_0x19938c[_0x1bbb('0x1e')]],'as':_0x19938c['as'],'attributes':_0x19938c[_0x1bbb('0x1a')],'include':_0x19938c[_0x1bbb('0x1c')]?_[_0x1bbb('0x1d')](_0x19938c['include'],function(_0x4a5e27){return{'model':db[_0x4a5e27[_0x1bbb('0x1e')]],'as':_0x4a5e27['as'],'attributes':_0x4a5e27[_0x1bbb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x102934){logger[_0x1bbb('0x1f')](_0x1bbb('0x22'),_0x3eb6da);logger[_0x1bbb('0x20')](_0x1bbb('0x22'),_0x3eb6da,JSON[_0x1bbb('0xe')](_0x102934));_0x3fc925(_0x102934);})[_0x1bbb('0x21')](function(_0x4ac66c){logger[_0x1bbb('0xf')](_0x1bbb('0x22'),_0x4ac66c[_0x1bbb('0x12')],_0x3eb6da);_0x50035e(_0x35586e[_0x1bbb('0xf')](0x1f4,_0x4ac66c[_0x1bbb('0x12')]));});});}; \ No newline at end of file +var _0x9cbc=['find','where','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','Dynamics365Account','findAll','options','raw','map','include','model','attributes','GetDynamics365Account','debug','stringify','ShowDynamics365Account'];(function(_0x12c72e,_0x306bd4){var _0x5190b5=function(_0x481f03){while(--_0x481f03){_0x12c72e['push'](_0x12c72e['shift']());}};_0x5190b5(++_0x306bd4);}(_0x9cbc,0x1e2));var _0xc9cb=function(_0x34bcf6,_0x2cc521){_0x34bcf6=_0x34bcf6-0x0;var _0x54adc9=_0x9cbc[_0x34bcf6];return _0x54adc9;};'use strict';var _=require(_0xc9cb('0x0'));var util=require(_0xc9cb('0x1'));var moment=require(_0xc9cb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9cb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9cb('0x4'));var logger=require('../../config/logger')(_0xc9cb('0x5'));var config=require(_0xc9cb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc9cb('0x7')][_0xc9cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x112449,_0x29ea83,_0x55fd64){return new BPromise(function(_0x5e442e,_0x306f94){return client[_0xc9cb('0x9')](_0x112449,_0x55fd64)[_0xc9cb('0xa')](function(_0x333c8c){logger['info'](_0xc9cb('0xb'),_0x29ea83,_0xc9cb('0xc'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x29ea83,_0xc9cb('0xc'),JSON['stringify'](_0x333c8c));if(_0x333c8c['error']){if(_0x333c8c[_0xc9cb('0xd')]['code']===0x1f4){logger[_0xc9cb('0xd')](_0xc9cb('0xb'),_0x29ea83,_0x333c8c[_0xc9cb('0xd')][_0xc9cb('0xe')]);return _0x306f94(_0x333c8c[_0xc9cb('0xd')][_0xc9cb('0xe')]);}logger[_0xc9cb('0xd')](_0xc9cb('0xb'),_0x29ea83,_0x333c8c['error']['message']);return _0x5e442e(_0x333c8c['error'][_0xc9cb('0xe')]);}else{logger[_0xc9cb('0xf')](_0xc9cb('0xb'),_0x29ea83,'request\x20sent');_0x5e442e(_0x333c8c[_0xc9cb('0x10')]['message']);}})[_0xc9cb('0x11')](function(_0x42fd25){logger[_0xc9cb('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x29ea83,_0x42fd25);_0x306f94(_0x42fd25);});});}exports['GetDynamics365Account']=function(_0x5580dc){var _0xd82260=this;return new Promise(function(_0x4c8d62,_0x2cf790){return db[_0xc9cb('0x12')][_0xc9cb('0x13')]({'raw':_0x5580dc[_0xc9cb('0x14')]?_0x5580dc[_0xc9cb('0x14')][_0xc9cb('0x15')]===undefined?!![]:![]:!![],'where':_0x5580dc[_0xc9cb('0x14')]?_0x5580dc[_0xc9cb('0x14')]['where']||null:null,'attributes':_0x5580dc['options']?_0x5580dc['options']['attributes']||null:null,'limit':_0x5580dc[_0xc9cb('0x14')]?_0x5580dc[_0xc9cb('0x14')]['limit']||null:null,'include':_0x5580dc['options']?_0x5580dc[_0xc9cb('0x14')]['include']?_[_0xc9cb('0x16')](_0x5580dc[_0xc9cb('0x14')][_0xc9cb('0x17')],function(_0x3645e0){return{'model':db[_0x3645e0[_0xc9cb('0x18')]],'as':_0x3645e0['as'],'attributes':_0x3645e0[_0xc9cb('0x19')],'include':_0x3645e0[_0xc9cb('0x17')]?_[_0xc9cb('0x16')](_0x3645e0[_0xc9cb('0x17')],function(_0x45beea){return{'model':db[_0x45beea[_0xc9cb('0x18')]],'as':_0x45beea['as'],'attributes':_0x45beea[_0xc9cb('0x19')],'include':_0x45beea[_0xc9cb('0x17')]?_[_0xc9cb('0x16')](_0x45beea['include'],function(_0x954475){return{'model':db[_0x954475['model']],'as':_0x954475['as'],'attributes':_0x954475[_0xc9cb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc9cb('0xa')](function(_0x342317){logger[_0xc9cb('0xf')](_0xc9cb('0x1a'),_0x5580dc);logger[_0xc9cb('0x1b')](_0xc9cb('0x1a'),_0x5580dc,JSON[_0xc9cb('0x1c')](_0x342317));_0x4c8d62(_0x342317);})[_0xc9cb('0x11')](function(_0x133366){logger[_0xc9cb('0xd')](_0xc9cb('0x1a'),_0x133366[_0xc9cb('0xe')],_0x5580dc);_0x2cf790(_0xd82260[_0xc9cb('0xd')](0x1f4,_0x133366[_0xc9cb('0xe')]));});});};exports[_0xc9cb('0x1d')]=function(_0x14ca99){var _0x8201f9=this;return new Promise(function(_0x9fee49,_0xe29aab){return db[_0xc9cb('0x12')][_0xc9cb('0x1e')]({'raw':_0x14ca99['options']?_0x14ca99['options'][_0xc9cb('0x15')]===undefined?!![]:![]:!![],'where':_0x14ca99[_0xc9cb('0x14')]?_0x14ca99[_0xc9cb('0x14')][_0xc9cb('0x1f')]||null:null,'attributes':_0x14ca99['options']?_0x14ca99['options'][_0xc9cb('0x19')]||null:null,'include':_0x14ca99[_0xc9cb('0x14')]?_0x14ca99['options'][_0xc9cb('0x17')]?_[_0xc9cb('0x16')](_0x14ca99[_0xc9cb('0x14')]['include'],function(_0x58a7d1){return{'model':db[_0x58a7d1[_0xc9cb('0x18')]],'as':_0x58a7d1['as'],'attributes':_0x58a7d1[_0xc9cb('0x19')],'include':_0x58a7d1[_0xc9cb('0x17')]?_[_0xc9cb('0x16')](_0x58a7d1[_0xc9cb('0x17')],function(_0x4e3f97){return{'model':db[_0x4e3f97[_0xc9cb('0x18')]],'as':_0x4e3f97['as'],'attributes':_0x4e3f97[_0xc9cb('0x19')],'include':_0x4e3f97[_0xc9cb('0x17')]?_[_0xc9cb('0x16')](_0x4e3f97[_0xc9cb('0x17')],function(_0x3846dc){return{'model':db[_0x3846dc[_0xc9cb('0x18')]],'as':_0x3846dc['as'],'attributes':_0x3846dc[_0xc9cb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4348db){logger[_0xc9cb('0xf')](_0xc9cb('0x1d'),_0x14ca99);logger[_0xc9cb('0x1b')]('ShowDynamics365Account',_0x14ca99,JSON[_0xc9cb('0x1c')](_0x4348db));_0x9fee49(_0x4348db);})['catch'](function(_0x37a744){logger[_0xc9cb('0xd')](_0xc9cb('0x1d'),_0x37a744[_0xc9cb('0xe')],_0x14ca99);_0xe29aab(_0x8201f9['error'](0x1f4,_0x37a744['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 2edabaa..dfa5d3f 100644 --- a/server/api/intDynamics365Configuration/index.js +++ b/server/api/intDynamics365Configuration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd878=['fs-extra','./intDynamics365Configuration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x57fd57,_0x197f3c){var _0x12e47f=function(_0x4f6e){while(--_0x4f6e){_0x57fd57['push'](_0x57fd57['shift']());}};_0x12e47f(++_0x197f3c);}(_0xd878,0x118));var _0x8d87=function(_0x40bcc8,_0x3b261a){_0x40bcc8=_0x40bcc8-0x0;var _0x4f8d3e=_0xd878[_0x40bcc8];return _0x4f8d3e;};'use strict';var multer=require(_0x8d87('0x0'));var util=require(_0x8d87('0x1'));var path=require(_0x8d87('0x2'));var timeout=require(_0x8d87('0x3'));var express=require(_0x8d87('0x4'));var router=express[_0x8d87('0x5')]();var fs_extra=require(_0x8d87('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8d87('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8d87('0x8')]);router[_0x8d87('0x9')](_0x8d87('0xa'),auth[_0x8d87('0xb')](),controller[_0x8d87('0xc')]);router[_0x8d87('0x9')](_0x8d87('0xd'),auth[_0x8d87('0xb')](),controller[_0x8d87('0xe')]);router['get'](_0x8d87('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8d87('0x9')](_0x8d87('0x10'),auth[_0x8d87('0xb')](),controller[_0x8d87('0x11')]);router[_0x8d87('0x12')]('/',auth[_0x8d87('0xb')](),controller['create']);router[_0x8d87('0x13')]('/:id',auth[_0x8d87('0xb')](),controller['update']);router[_0x8d87('0x14')](_0x8d87('0xa'),auth[_0x8d87('0xb')](),controller['destroy']);module[_0x8d87('0x15')]=router; \ No newline at end of file +var _0xfdb8=['/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xfdb8,0x120));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8fdb('0x0'));var util=require(_0x8fdb('0x1'));var path=require(_0x8fdb('0x2'));var timeout=require(_0x8fdb('0x3'));var express=require(_0x8fdb('0x4'));var router=express['Router']();var fs_extra=require(_0x8fdb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8fdb('0x6'));var config=require(_0x8fdb('0x7'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x8fdb('0x8')](),controller[_0x8fdb('0x9')]);router[_0x8fdb('0xa')](_0x8fdb('0xb'),auth[_0x8fdb('0x8')](),controller[_0x8fdb('0xc')]);router[_0x8fdb('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8fdb('0xd')]);router[_0x8fdb('0xa')](_0x8fdb('0xe'),auth[_0x8fdb('0x8')](),controller[_0x8fdb('0xf')]);router[_0x8fdb('0xa')](_0x8fdb('0x10'),auth[_0x8fdb('0x8')](),controller[_0x8fdb('0x11')]);router[_0x8fdb('0x12')]('/',auth[_0x8fdb('0x8')](),controller[_0x8fdb('0x13')]);router[_0x8fdb('0x14')](_0x8fdb('0xb'),auth[_0x8fdb('0x8')](),controller['update']);router[_0x8fdb('0x15')](_0x8fdb('0xb'),auth[_0x8fdb('0x8')](),controller[_0x8fdb('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 2937c67..0f5d3ba 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2dc=['incident','phonecall','contact','nothing','BOOLEAN','sequelize','STRING','ENUM'];(function(_0x58246c,_0x58d989){var _0x2dc3ab=function(_0x3f3b6a){while(--_0x3f3b6a){_0x58246c['push'](_0x58246c['shift']());}};_0x2dc3ab(++_0x58d989);}(_0xf2dc,0x13d));var _0xcf2d=function(_0x5db763,_0x3f71f7){_0x5db763=_0x5db763-0x0;var _0x1c8b53=_0xf2dc[_0x5db763];return _0x1c8b53;};'use strict';var Sequelize=require(_0xcf2d('0x0'));module['exports']={'name':{'type':Sequelize[_0xcf2d('0x1')]},'description':{'type':Sequelize[_0xcf2d('0x1')]},'ticketType':{'type':Sequelize[_0xcf2d('0x2')](_0xcf2d('0x3'),_0xcf2d('0x4')),'defaultValue':_0xcf2d('0x3')},'moduleCreate':{'type':Sequelize[_0xcf2d('0x2')](_0xcf2d('0x5'),_0xcf2d('0x6')),'defaultValue':_0xcf2d('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xcf2d('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7a88=['sequelize','STRING','ENUM','incident','contact','nothing','BOOLEAN'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x7a88,0x1b2));var _0x87a8=function(_0x2d283c,_0x1702d3){_0x2d283c=_0x2d283c-0x0;var _0xa8fbc0=_0x7a88[_0x2d283c];return _0xa8fbc0;};'use strict';var Sequelize=require(_0x87a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x87a8('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x87a8('0x2')](_0x87a8('0x3'),'phonecall'),'defaultValue':_0x87a8('0x3')},'moduleCreate':{'type':Sequelize[_0x87a8('0x2')](_0x87a8('0x4'),_0x87a8('0x5')),'defaultValue':_0x87a8('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x87a8('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x87a8('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index d34f373..3fa16f6 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x054c=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','create','body','getFields','findOne','Dynamics365Field','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x054c,0x8d));var _0xc054=function(_0xf4cbab,_0x52cee6){_0xf4cbab=_0xf4cbab-0x0;var _0x400a7e=_0x054c[_0xf4cbab];return _0x400a7e;};'use strict';var emlformat=require(_0xc054('0x0'));var rimraf=require(_0xc054('0x1'));var zipdir=require(_0xc054('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc054('0x3'));var moment=require(_0xc054('0x4'));var BPromise=require(_0xc054('0x5'));var Mustache=require(_0xc054('0x6'));var util=require('util');var path=require(_0xc054('0x7'));var sox=require(_0xc054('0x8'));var csv=require('to-csv');var ejs=require(_0xc054('0x9'));var fs=require('fs');var fs_extra=require(_0xc054('0xa'));var _=require('lodash');var squel=require(_0xc054('0xb'));var crypto=require(_0xc054('0xc'));var jsforce=require(_0xc054('0xd'));var deskjs=require(_0xc054('0xe'));var toCsv=require(_0xc054('0xf'));var querystring=require(_0xc054('0x10'));var Papa=require('papaparse');var Redis=require(_0xc054('0x11'));var authService=require(_0xc054('0x12'));var qs=require(_0xc054('0x13'));var as=require(_0xc054('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc054('0x15'))(_0xc054('0x16'));var utils=require(_0xc054('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc054('0x18'));var db=require(_0xc054('0x19'))['db'];function respondWithStatusCode(_0x49ac3a,_0x228b2b){_0x228b2b=_0x228b2b||0xcc;return function(_0x2423a1){if(_0x2423a1){return _0x49ac3a[_0xc054('0x1a')](_0x228b2b);}return _0x49ac3a[_0xc054('0x1b')](_0x228b2b)['end']();};}function respondWithResult(_0x56c69e,_0x4f7355){_0x4f7355=_0x4f7355||0xc8;return function(_0xfb8fa2){if(_0xfb8fa2){return _0x56c69e[_0xc054('0x1b')](_0x4f7355)[_0xc054('0x1c')](_0xfb8fa2);}};}function respondWithFilteredResult(_0x3b47a5,_0x4bd398){return function(_0x264601){if(_0x264601){var _0x2f91c1=typeof _0x4bd398[_0xc054('0x1d')]==='undefined'&&typeof _0x4bd398[_0xc054('0x1e')]==='undefined';var _0x54b744=_0x264601[_0xc054('0x1f')];var _0x2324f7=_0x2f91c1?0x0:_0x4bd398[_0xc054('0x1d')];var _0x4ff429=_0x2f91c1?_0x264601['count']:_0x4bd398[_0xc054('0x1d')]+_0x4bd398[_0xc054('0x1e')];var _0x236928;if(_0x4ff429>=_0x54b744){_0x4ff429=_0x54b744;_0x236928=0xc8;}else{_0x236928=0xce;}_0x3b47a5[_0xc054('0x1b')](_0x236928);return _0x3b47a5[_0xc054('0x20')](_0xc054('0x21'),_0x2324f7+'-'+_0x4ff429+'/'+_0x54b744)['json'](_0x264601);}return null;};}function patchUpdates(_0x2b8a93){return function(_0x3c0e5e){try{jsonpatch[_0xc054('0x22')](_0x3c0e5e,_0x2b8a93,!![]);}catch(_0x5bb25d){return BPromise[_0xc054('0x23')](_0x5bb25d);}return _0x3c0e5e[_0xc054('0x24')]();};}function saveUpdates(_0x220ea5,_0x3b1f53){return function(_0x328bcb){if(_0x328bcb){return _0x328bcb[_0xc054('0x25')](_0x220ea5)[_0xc054('0x26')](function(_0x4f1630){return _0x4f1630;});}return null;};}function removeEntity(_0x4e8d7f,_0x41546e){return function(_0x5d6f8f){if(_0x5d6f8f){return _0x5d6f8f[_0xc054('0x27')]()['then'](function(){_0x4e8d7f[_0xc054('0x1b')](0xcc)[_0xc054('0x28')]();});}};}function handleEntityNotFound(_0x2146a1,_0x3ac5a1){return function(_0x1f717d){if(!_0x1f717d){_0x2146a1[_0xc054('0x1a')](0x194);}return _0x1f717d;};}function handleError(_0x279274,_0x3f3460){_0x3f3460=_0x3f3460||0x1f4;return function(_0x16eb70){logger[_0xc054('0x29')](_0x16eb70['stack']);if(_0x16eb70['name']){delete _0x16eb70[_0xc054('0x2a')];}_0x279274[_0xc054('0x1b')](_0x3f3460)[_0xc054('0x2b')](_0x16eb70);};}exports[_0xc054('0x2c')]=function(_0x3ce17c,_0x2eec9c){var _0x3756e4={},_0x4f08b2={},_0x775fd1={'count':0x0,'rows':[]};var _0x4170a1=_['map'](db[_0xc054('0x2d')][_0xc054('0x2e')],function(_0x2ef12c){return{'name':_0x2ef12c[_0xc054('0x2f')],'type':_0x2ef12c[_0xc054('0x30')][_0xc054('0x31')]};});_0x4f08b2[_0xc054('0x32')]=_[_0xc054('0x33')](_0x4170a1,_0xc054('0x2a'));_0x4f08b2[_0xc054('0x34')]=_[_0xc054('0x35')](_0x3ce17c[_0xc054('0x34')]);_0x4f08b2[_0xc054('0x36')]=_['intersection'](_0x4f08b2[_0xc054('0x32')],_0x4f08b2['query']);_0x3756e4[_0xc054('0x37')]=_[_0xc054('0x38')](_0x4f08b2[_0xc054('0x32')],qs[_0xc054('0x39')](_0x3ce17c[_0xc054('0x34')][_0xc054('0x39')]));_0x3756e4[_0xc054('0x37')]=_0x3756e4[_0xc054('0x37')]['length']?_0x3756e4[_0xc054('0x37')]:_0x4f08b2[_0xc054('0x32')];if(!_0x3ce17c[_0xc054('0x34')][_0xc054('0x3a')](_0xc054('0x3b'))){_0x3756e4[_0xc054('0x1e')]=qs[_0xc054('0x1e')](_0x3ce17c['query']['limit']);_0x3756e4['offset']=qs[_0xc054('0x1d')](_0x3ce17c[_0xc054('0x34')][_0xc054('0x1d')]);}_0x3756e4[_0xc054('0x3c')]=qs['sort'](_0x3ce17c[_0xc054('0x34')][_0xc054('0x3d')]);_0x3756e4[_0xc054('0x3e')]=qs[_0xc054('0x36')](_[_0xc054('0x3f')](_0x3ce17c[_0xc054('0x34')],_0x4f08b2[_0xc054('0x36')]),_0x4170a1);if(_0x3ce17c[_0xc054('0x34')][_0xc054('0x40')]){_0x3756e4[_0xc054('0x3e')]=_[_0xc054('0x41')](_0x3756e4[_0xc054('0x3e')],{'$or':_[_0xc054('0x33')](_0x4170a1,function(_0x36a6fa){if(_0x36a6fa[_0xc054('0x30')]!=='VIRTUAL'){var _0x1f203e={};_0x1f203e[_0x36a6fa[_0xc054('0x2a')]]={'$like':'%'+_0x3ce17c[_0xc054('0x34')][_0xc054('0x40')]+'%'};return _0x1f203e;}})});}_0x3756e4=_[_0xc054('0x41')]({},_0x3756e4,_0x3ce17c['options']);var _0x1b96fd={'where':_0x3756e4[_0xc054('0x3e')]};return db[_0xc054('0x2d')][_0xc054('0x1f')](_0x1b96fd)[_0xc054('0x26')](function(_0x12cef0){_0x775fd1[_0xc054('0x1f')]=_0x12cef0;if(_0x3ce17c[_0xc054('0x34')][_0xc054('0x42')]){_0x3756e4[_0xc054('0x43')]=[{'all':!![]}];}return db[_0xc054('0x2d')][_0xc054('0x44')](_0x3756e4);})['then'](function(_0x2c683d){_0x775fd1[_0xc054('0x45')]=_0x2c683d;return _0x775fd1;})[_0xc054('0x26')](respondWithFilteredResult(_0x2eec9c,_0x3756e4))[_0xc054('0x46')](handleError(_0x2eec9c,null));};exports['show']=function(_0x285dce,_0x171c21){var _0x59d73a={'raw':![],'where':{'id':_0x285dce[_0xc054('0x47')]['id']}},_0x1d020a={};_0x1d020a[_0xc054('0x32')]=_['keys'](db[_0xc054('0x2d')][_0xc054('0x2e')]);_0x1d020a[_0xc054('0x34')]=_['keys'](_0x285dce[_0xc054('0x34')]);_0x1d020a[_0xc054('0x36')]=_[_0xc054('0x38')](_0x1d020a[_0xc054('0x32')],_0x1d020a[_0xc054('0x34')]);_0x59d73a['attributes']=_[_0xc054('0x38')](_0x1d020a[_0xc054('0x32')],qs[_0xc054('0x39')](_0x285dce['query'][_0xc054('0x39')]));_0x59d73a[_0xc054('0x37')]=_0x59d73a[_0xc054('0x37')][_0xc054('0x48')]?_0x59d73a[_0xc054('0x37')]:_0x1d020a[_0xc054('0x32')];if(_0x285dce[_0xc054('0x34')]['includeAll']){_0x59d73a[_0xc054('0x43')]=[{'all':!![]}];}_0x59d73a=_[_0xc054('0x41')]({},_0x59d73a,_0x285dce['options']);return db[_0xc054('0x2d')][_0xc054('0x49')](_0x59d73a)[_0xc054('0x26')](handleEntityNotFound(_0x171c21,null))[_0xc054('0x26')](respondWithResult(_0x171c21,null))[_0xc054('0x46')](handleError(_0x171c21,null));};exports[_0xc054('0x4a')]=function(_0x4b38a0,_0x5c800e){return db[_0xc054('0x2d')][_0xc054('0x4a')](_0x4b38a0[_0xc054('0x4b')],{})[_0xc054('0x26')](respondWithResult(_0x5c800e,0xc9))[_0xc054('0x46')](handleError(_0x5c800e,null));};exports['update']=function(_0x5d2645,_0x22db5b){if(_0x5d2645[_0xc054('0x4b')]['id']){delete _0x5d2645[_0xc054('0x4b')]['id'];}return db[_0xc054('0x2d')][_0xc054('0x49')]({'where':{'id':_0x5d2645[_0xc054('0x47')]['id']}})['then'](handleEntityNotFound(_0x22db5b,null))['then'](saveUpdates(_0x5d2645[_0xc054('0x4b')],null))[_0xc054('0x26')](respondWithResult(_0x22db5b,null))[_0xc054('0x46')](handleError(_0x22db5b,null));};exports['destroy']=function(_0x3acc54,_0xcae0ac){return db[_0xc054('0x2d')]['find']({'where':{'id':_0x3acc54[_0xc054('0x47')]['id']}})[_0xc054('0x26')](handleEntityNotFound(_0xcae0ac,null))[_0xc054('0x26')](removeEntity(_0xcae0ac,null))[_0xc054('0x46')](handleError(_0xcae0ac,null));};exports[_0xc054('0x4c')]=function(_0x13ce15,_0x223d0e,_0x400a20){var _0x1dac58={};var _0x1c49ec={};var _0x10e5c0;var _0xae2b30;return db[_0xc054('0x2d')][_0xc054('0x4d')]({'where':{'id':_0x13ce15[_0xc054('0x47')]['id']}})[_0xc054('0x26')](handleEntityNotFound(_0x223d0e,null))['then'](function(_0x390c1b){if(_0x390c1b){_0x10e5c0=_0x390c1b;_0x1c49ec[_0xc054('0x32')]=_['keys'](db[_0xc054('0x4e')]['rawAttributes']);_0x1c49ec[_0xc054('0x34')]=_[_0xc054('0x35')](_0x13ce15['query']);_0x1c49ec[_0xc054('0x36')]=_['intersection'](_0x1c49ec[_0xc054('0x32')],_0x1c49ec[_0xc054('0x34')]);_0x1dac58[_0xc054('0x37')]=_['intersection'](_0x1c49ec[_0xc054('0x32')],qs[_0xc054('0x39')](_0x13ce15[_0xc054('0x34')][_0xc054('0x39')]));_0x1dac58[_0xc054('0x37')]=_0x1dac58[_0xc054('0x37')][_0xc054('0x48')]?_0x1dac58[_0xc054('0x37')]:_0x1c49ec[_0xc054('0x32')];_0x1dac58[_0xc054('0x3c')]=qs[_0xc054('0x3d')](_0x13ce15['query'][_0xc054('0x3d')]);_0x1dac58[_0xc054('0x3e')]=qs['filters'](_[_0xc054('0x3f')](_0x13ce15[_0xc054('0x34')],_0x1c49ec[_0xc054('0x36')]));if(_0x13ce15[_0xc054('0x34')]['filter']){_0x1dac58[_0xc054('0x3e')]=_['merge'](_0x1dac58['where'],{'$or':_['map'](_0x1dac58[_0xc054('0x37')],function(_0x4fcfe7){var _0x4895da={};_0x4895da[_0x4fcfe7]={'$like':'%'+_0x13ce15['query'][_0xc054('0x40')]+'%'};return _0x4895da;})});}_0x1dac58=_[_0xc054('0x41')]({},_0x1dac58,_0x13ce15[_0xc054('0x4f')]);return _0x10e5c0[_0xc054('0x4c')](_0x1dac58);}})[_0xc054('0x26')](function(_0x1aa30e){if(_0x1aa30e){_0xae2b30=_0x1aa30e[_0xc054('0x48')];if(!_0x13ce15[_0xc054('0x34')][_0xc054('0x3a')](_0xc054('0x3b'))){_0x1dac58['limit']=qs[_0xc054('0x1e')](_0x13ce15[_0xc054('0x34')][_0xc054('0x1e')]);_0x1dac58[_0xc054('0x1d')]=qs[_0xc054('0x1d')](_0x13ce15[_0xc054('0x34')][_0xc054('0x1d')]);}return _0x10e5c0[_0xc054('0x4c')](_0x1dac58);}})['then'](function(_0xba8f6e){if(_0xba8f6e){return _0xba8f6e?{'count':_0xae2b30,'rows':_0xba8f6e}:null;}})[_0xc054('0x26')](respondWithResult(_0x223d0e,null))[_0xc054('0x46')](handleError(_0x223d0e,null));};exports[_0xc054('0x50')]=function(_0x5b534d,_0x4e02f1,_0x5a4aa3){var _0x131e43={};var _0x3205b7={};var _0x556588;var _0x230326;return db[_0xc054('0x2d')]['findOne']({'where':{'id':_0x5b534d[_0xc054('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e02f1,null))[_0xc054('0x26')](function(_0x3a03cc){if(_0x3a03cc){_0x556588=_0x3a03cc;_0x3205b7[_0xc054('0x32')]=_['keys'](db['Dynamics365Field'][_0xc054('0x2e')]);_0x3205b7['query']=_[_0xc054('0x35')](_0x5b534d['query']);_0x3205b7[_0xc054('0x36')]=_[_0xc054('0x38')](_0x3205b7[_0xc054('0x32')],_0x3205b7[_0xc054('0x34')]);_0x131e43[_0xc054('0x37')]=_[_0xc054('0x38')](_0x3205b7[_0xc054('0x32')],qs[_0xc054('0x39')](_0x5b534d['query'][_0xc054('0x39')]));_0x131e43[_0xc054('0x37')]=_0x131e43['attributes'][_0xc054('0x48')]?_0x131e43[_0xc054('0x37')]:_0x3205b7[_0xc054('0x32')];_0x131e43[_0xc054('0x3c')]=qs['sort'](_0x5b534d[_0xc054('0x34')][_0xc054('0x3d')]);_0x131e43[_0xc054('0x3e')]=qs['filters'](_[_0xc054('0x3f')](_0x5b534d[_0xc054('0x34')],_0x3205b7[_0xc054('0x36')]));if(_0x5b534d['query'][_0xc054('0x40')]){_0x131e43[_0xc054('0x3e')]=_[_0xc054('0x41')](_0x131e43[_0xc054('0x3e')],{'$or':_[_0xc054('0x33')](_0x131e43[_0xc054('0x37')],function(_0x312b5a){var _0x4b8a8a={};_0x4b8a8a[_0x312b5a]={'$like':'%'+_0x5b534d[_0xc054('0x34')][_0xc054('0x40')]+'%'};return _0x4b8a8a;})});}_0x131e43=_[_0xc054('0x41')]({},_0x131e43,_0x5b534d['options']);return _0x556588[_0xc054('0x50')](_0x131e43);}})[_0xc054('0x26')](function(_0x24f1a2){if(_0x24f1a2){_0x230326=_0x24f1a2[_0xc054('0x48')];if(!_0x5b534d[_0xc054('0x34')][_0xc054('0x3a')](_0xc054('0x3b'))){_0x131e43[_0xc054('0x1e')]=qs['limit'](_0x5b534d[_0xc054('0x34')][_0xc054('0x1e')]);_0x131e43[_0xc054('0x1d')]=qs['offset'](_0x5b534d['query'][_0xc054('0x1d')]);}return _0x556588['getSubjects'](_0x131e43);}})[_0xc054('0x26')](function(_0x1e5b6e){if(_0x1e5b6e){return _0x1e5b6e?{'count':_0x230326,'rows':_0x1e5b6e}:null;}})['then'](respondWithResult(_0x4e02f1,null))[_0xc054('0x46')](handleError(_0x4e02f1,null));};exports[_0xc054('0x51')]=function(_0xe40e17,_0x30e087,_0x1f47f2){var _0x171a5c={};var _0x3bee87={};var _0x1767d2;var _0x37b61e;return db[_0xc054('0x2d')]['findOne']({'where':{'id':_0xe40e17[_0xc054('0x47')]['id']}})['then'](handleEntityNotFound(_0x30e087,null))[_0xc054('0x26')](function(_0x3e4bee){if(_0x3e4bee){_0x1767d2=_0x3e4bee;_0x3bee87[_0xc054('0x32')]=_[_0xc054('0x35')](db[_0xc054('0x4e')][_0xc054('0x2e')]);_0x3bee87[_0xc054('0x34')]=_[_0xc054('0x35')](_0xe40e17[_0xc054('0x34')]);_0x3bee87['filters']=_[_0xc054('0x38')](_0x3bee87[_0xc054('0x32')],_0x3bee87[_0xc054('0x34')]);_0x171a5c[_0xc054('0x37')]=_[_0xc054('0x38')](_0x3bee87[_0xc054('0x32')],qs[_0xc054('0x39')](_0xe40e17[_0xc054('0x34')][_0xc054('0x39')]));_0x171a5c['attributes']=_0x171a5c[_0xc054('0x37')]['length']?_0x171a5c[_0xc054('0x37')]:_0x3bee87[_0xc054('0x32')];_0x171a5c['order']=qs[_0xc054('0x3d')](_0xe40e17[_0xc054('0x34')][_0xc054('0x3d')]);_0x171a5c[_0xc054('0x3e')]=qs[_0xc054('0x36')](_['pick'](_0xe40e17[_0xc054('0x34')],_0x3bee87['filters']));if(_0xe40e17[_0xc054('0x34')][_0xc054('0x40')]){_0x171a5c[_0xc054('0x3e')]=_[_0xc054('0x41')](_0x171a5c['where'],{'$or':_[_0xc054('0x33')](_0x171a5c['attributes'],function(_0x5c3705){var _0x5b3de9={};_0x5b3de9[_0x5c3705]={'$like':'%'+_0xe40e17[_0xc054('0x34')][_0xc054('0x40')]+'%'};return _0x5b3de9;})});}_0x171a5c=_['merge']({},_0x171a5c,_0xe40e17[_0xc054('0x4f')]);return _0x1767d2[_0xc054('0x51')](_0x171a5c);}})['then'](function(_0x564114){if(_0x564114){_0x37b61e=_0x564114['length'];if(!_0xe40e17['query'][_0xc054('0x3a')](_0xc054('0x3b'))){_0x171a5c[_0xc054('0x1e')]=qs[_0xc054('0x1e')](_0xe40e17[_0xc054('0x34')][_0xc054('0x1e')]);_0x171a5c[_0xc054('0x1d')]=qs[_0xc054('0x1d')](_0xe40e17[_0xc054('0x34')][_0xc054('0x1d')]);}return _0x1767d2[_0xc054('0x51')](_0x171a5c);}})['then'](function(_0x23810e){if(_0x23810e){return _0x23810e?{'count':_0x37b61e,'rows':_0x23810e}:null;}})['then'](respondWithResult(_0x30e087,null))['catch'](handleError(_0x30e087,null));}; \ No newline at end of file +var _0x0508=['then','end','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','getFields','findOne','filter','nolimit','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy'];(function(_0x1c7047,_0x2ad594){var _0x297e1f=function(_0x3de590){while(--_0x3de590){_0x1c7047['push'](_0x1c7047['shift']());}};_0x297e1f(++_0x2ad594);}(_0x0508,0x178));var _0x8050=function(_0xd2df21,_0xfe9e98){_0xd2df21=_0xd2df21-0x0;var _0x49edf5=_0x0508[_0xd2df21];return _0x49edf5;};'use strict';var emlformat=require(_0x8050('0x0'));var rimraf=require(_0x8050('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8050('0x2'));var rp=require('request-promise');var moment=require(_0x8050('0x3'));var BPromise=require(_0x8050('0x4'));var Mustache=require(_0x8050('0x5'));var util=require(_0x8050('0x6'));var path=require(_0x8050('0x7'));var sox=require(_0x8050('0x8'));var csv=require(_0x8050('0x9'));var ejs=require(_0x8050('0xa'));var fs=require('fs');var fs_extra=require(_0x8050('0xb'));var _=require(_0x8050('0xc'));var squel=require(_0x8050('0xd'));var crypto=require(_0x8050('0xe'));var jsforce=require(_0x8050('0xf'));var deskjs=require(_0x8050('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8050('0x11'));var Papa=require(_0x8050('0x12'));var Redis=require(_0x8050('0x13'));var authService=require(_0x8050('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8050('0x15'));var logger=require(_0x8050('0x16'))(_0x8050('0x17'));var utils=require('../../config/utils');var config=require(_0x8050('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8050('0x19'))['db'];function respondWithStatusCode(_0x3b1687,_0x5cf625){_0x5cf625=_0x5cf625||0xcc;return function(_0x13bcd8){if(_0x13bcd8){return _0x3b1687[_0x8050('0x1a')](_0x5cf625);}return _0x3b1687[_0x8050('0x1b')](_0x5cf625)['end']();};}function respondWithResult(_0x3ac566,_0x3ef94e){_0x3ef94e=_0x3ef94e||0xc8;return function(_0x10d532){if(_0x10d532){return _0x3ac566[_0x8050('0x1b')](_0x3ef94e)[_0x8050('0x1c')](_0x10d532);}};}function respondWithFilteredResult(_0x5585b2,_0x5ed195){return function(_0x3628cd){if(_0x3628cd){var _0x5b8a4d=typeof _0x5ed195[_0x8050('0x1d')]===_0x8050('0x1e')&&typeof _0x5ed195[_0x8050('0x1f')]===_0x8050('0x1e');var _0x5d13f3=_0x3628cd[_0x8050('0x20')];var _0x48308f=_0x5b8a4d?0x0:_0x5ed195[_0x8050('0x1d')];var _0x1c653a=_0x5b8a4d?_0x3628cd[_0x8050('0x20')]:_0x5ed195[_0x8050('0x1d')]+_0x5ed195['limit'];var _0x7c0722;if(_0x1c653a>=_0x5d13f3){_0x1c653a=_0x5d13f3;_0x7c0722=0xc8;}else{_0x7c0722=0xce;}_0x5585b2[_0x8050('0x1b')](_0x7c0722);return _0x5585b2['set'](_0x8050('0x21'),_0x48308f+'-'+_0x1c653a+'/'+_0x5d13f3)[_0x8050('0x1c')](_0x3628cd);}return null;};}function patchUpdates(_0x23fd3c){return function(_0x2d7bd7){try{jsonpatch[_0x8050('0x22')](_0x2d7bd7,_0x23fd3c,!![]);}catch(_0x46ed7f){return BPromise[_0x8050('0x23')](_0x46ed7f);}return _0x2d7bd7[_0x8050('0x24')]();};}function saveUpdates(_0x27aa3d,_0x6ebcc0){return function(_0x5653a6){if(_0x5653a6){return _0x5653a6[_0x8050('0x25')](_0x27aa3d)['then'](function(_0x1829c6){return _0x1829c6;});}return null;};}function removeEntity(_0x54f044,_0x47039a){return function(_0x4586d0){if(_0x4586d0){return _0x4586d0[_0x8050('0x26')]()[_0x8050('0x27')](function(){_0x54f044[_0x8050('0x1b')](0xcc)[_0x8050('0x28')]();});}};}function handleEntityNotFound(_0x4b0904,_0x330d8d){return function(_0x1d6a51){if(!_0x1d6a51){_0x4b0904['sendStatus'](0x194);}return _0x1d6a51;};}function handleError(_0x1a73e3,_0x1194b1){_0x1194b1=_0x1194b1||0x1f4;return function(_0x269399){logger[_0x8050('0x29')](_0x269399[_0x8050('0x2a')]);if(_0x269399[_0x8050('0x2b')]){delete _0x269399[_0x8050('0x2b')];}_0x1a73e3[_0x8050('0x1b')](_0x1194b1)[_0x8050('0x2c')](_0x269399);};}exports[_0x8050('0x2d')]=function(_0x45112a,_0x1f7388){var _0x1eb98f={},_0x2179cb={},_0x418609={'count':0x0,'rows':[]};var _0x59ef4e=_[_0x8050('0x2e')](db[_0x8050('0x2f')][_0x8050('0x30')],function(_0x301e0c){return{'name':_0x301e0c['fieldName'],'type':_0x301e0c[_0x8050('0x31')][_0x8050('0x32')]};});_0x2179cb[_0x8050('0x33')]=_[_0x8050('0x2e')](_0x59ef4e,'name');_0x2179cb['query']=_[_0x8050('0x34')](_0x45112a[_0x8050('0x35')]);_0x2179cb[_0x8050('0x36')]=_[_0x8050('0x37')](_0x2179cb['model'],_0x2179cb[_0x8050('0x35')]);_0x1eb98f['attributes']=_[_0x8050('0x37')](_0x2179cb[_0x8050('0x33')],qs[_0x8050('0x38')](_0x45112a[_0x8050('0x35')][_0x8050('0x38')]));_0x1eb98f[_0x8050('0x39')]=_0x1eb98f['attributes']['length']?_0x1eb98f[_0x8050('0x39')]:_0x2179cb[_0x8050('0x33')];if(!_0x45112a['query'][_0x8050('0x3a')]('nolimit')){_0x1eb98f['limit']=qs['limit'](_0x45112a['query'][_0x8050('0x1f')]);_0x1eb98f[_0x8050('0x1d')]=qs[_0x8050('0x1d')](_0x45112a[_0x8050('0x35')][_0x8050('0x1d')]);}_0x1eb98f[_0x8050('0x3b')]=qs[_0x8050('0x3c')](_0x45112a[_0x8050('0x35')][_0x8050('0x3c')]);_0x1eb98f[_0x8050('0x3d')]=qs[_0x8050('0x36')](_[_0x8050('0x3e')](_0x45112a[_0x8050('0x35')],_0x2179cb[_0x8050('0x36')]),_0x59ef4e);if(_0x45112a[_0x8050('0x35')]['filter']){_0x1eb98f[_0x8050('0x3d')]=_[_0x8050('0x3f')](_0x1eb98f[_0x8050('0x3d')],{'$or':_['map'](_0x59ef4e,function(_0x4f4af7){if(_0x4f4af7['type']!=='VIRTUAL'){var _0x4c59ab={};_0x4c59ab[_0x4f4af7[_0x8050('0x2b')]]={'$like':'%'+_0x45112a[_0x8050('0x35')]['filter']+'%'};return _0x4c59ab;}})});}_0x1eb98f=_[_0x8050('0x3f')]({},_0x1eb98f,_0x45112a[_0x8050('0x40')]);var _0x5661db={'where':_0x1eb98f[_0x8050('0x3d')]};return db[_0x8050('0x2f')][_0x8050('0x20')](_0x5661db)[_0x8050('0x27')](function(_0x2e29d9){_0x418609[_0x8050('0x20')]=_0x2e29d9;if(_0x45112a[_0x8050('0x35')][_0x8050('0x41')]){_0x1eb98f['include']=[{'all':!![]}];}return db[_0x8050('0x2f')][_0x8050('0x42')](_0x1eb98f);})[_0x8050('0x27')](function(_0x4be028){_0x418609[_0x8050('0x43')]=_0x4be028;return _0x418609;})[_0x8050('0x27')](respondWithFilteredResult(_0x1f7388,_0x1eb98f))[_0x8050('0x44')](handleError(_0x1f7388,null));};exports[_0x8050('0x45')]=function(_0x414e8a,_0x40a60d){var _0x1d6093={'raw':![],'where':{'id':_0x414e8a['params']['id']}},_0x5eda72={};_0x5eda72['model']=_[_0x8050('0x34')](db['Dynamics365Configuration'][_0x8050('0x30')]);_0x5eda72[_0x8050('0x35')]=_[_0x8050('0x34')](_0x414e8a[_0x8050('0x35')]);_0x5eda72[_0x8050('0x36')]=_[_0x8050('0x37')](_0x5eda72[_0x8050('0x33')],_0x5eda72[_0x8050('0x35')]);_0x1d6093['attributes']=_[_0x8050('0x37')](_0x5eda72['model'],qs['fields'](_0x414e8a[_0x8050('0x35')][_0x8050('0x38')]));_0x1d6093[_0x8050('0x39')]=_0x1d6093['attributes'][_0x8050('0x46')]?_0x1d6093['attributes']:_0x5eda72[_0x8050('0x33')];if(_0x414e8a[_0x8050('0x35')][_0x8050('0x41')]){_0x1d6093[_0x8050('0x47')]=[{'all':!![]}];}_0x1d6093=_[_0x8050('0x3f')]({},_0x1d6093,_0x414e8a['options']);return db[_0x8050('0x2f')][_0x8050('0x48')](_0x1d6093)[_0x8050('0x27')](handleEntityNotFound(_0x40a60d,null))[_0x8050('0x27')](respondWithResult(_0x40a60d,null))[_0x8050('0x44')](handleError(_0x40a60d,null));};exports[_0x8050('0x49')]=function(_0x6f60d3,_0xfeddb0){return db[_0x8050('0x2f')][_0x8050('0x49')](_0x6f60d3[_0x8050('0x4a')],{})[_0x8050('0x27')](respondWithResult(_0xfeddb0,0xc9))[_0x8050('0x44')](handleError(_0xfeddb0,null));};exports['update']=function(_0x5c8bcd,_0xdd34f3){if(_0x5c8bcd[_0x8050('0x4a')]['id']){delete _0x5c8bcd[_0x8050('0x4a')]['id'];}return db[_0x8050('0x2f')][_0x8050('0x48')]({'where':{'id':_0x5c8bcd[_0x8050('0x4b')]['id']}})[_0x8050('0x27')](handleEntityNotFound(_0xdd34f3,null))[_0x8050('0x27')](saveUpdates(_0x5c8bcd['body'],null))['then'](respondWithResult(_0xdd34f3,null))[_0x8050('0x44')](handleError(_0xdd34f3,null));};exports['destroy']=function(_0x4fd2f3,_0x17481d){return db[_0x8050('0x2f')][_0x8050('0x48')]({'where':{'id':_0x4fd2f3[_0x8050('0x4b')]['id']}})[_0x8050('0x27')](handleEntityNotFound(_0x17481d,null))[_0x8050('0x27')](removeEntity(_0x17481d,null))['catch'](handleError(_0x17481d,null));};exports[_0x8050('0x4c')]=function(_0x5bde80,_0x316c22,_0xe54f83){var _0x27206c={};var _0x400653={};var _0x37d01c;var _0x2acd13;return db['Dynamics365Configuration'][_0x8050('0x4d')]({'where':{'id':_0x5bde80['params']['id']}})[_0x8050('0x27')](handleEntityNotFound(_0x316c22,null))['then'](function(_0x56dd22){if(_0x56dd22){_0x37d01c=_0x56dd22;_0x400653[_0x8050('0x33')]=_[_0x8050('0x34')](db['Dynamics365Field'][_0x8050('0x30')]);_0x400653['query']=_[_0x8050('0x34')](_0x5bde80[_0x8050('0x35')]);_0x400653[_0x8050('0x36')]=_['intersection'](_0x400653['model'],_0x400653[_0x8050('0x35')]);_0x27206c[_0x8050('0x39')]=_[_0x8050('0x37')](_0x400653[_0x8050('0x33')],qs[_0x8050('0x38')](_0x5bde80[_0x8050('0x35')][_0x8050('0x38')]));_0x27206c[_0x8050('0x39')]=_0x27206c['attributes'][_0x8050('0x46')]?_0x27206c[_0x8050('0x39')]:_0x400653['model'];_0x27206c[_0x8050('0x3b')]=qs[_0x8050('0x3c')](_0x5bde80[_0x8050('0x35')][_0x8050('0x3c')]);_0x27206c['where']=qs[_0x8050('0x36')](_[_0x8050('0x3e')](_0x5bde80[_0x8050('0x35')],_0x400653[_0x8050('0x36')]));if(_0x5bde80['query'][_0x8050('0x4e')]){_0x27206c[_0x8050('0x3d')]=_['merge'](_0x27206c[_0x8050('0x3d')],{'$or':_['map'](_0x27206c[_0x8050('0x39')],function(_0x4c6f46){var _0x53f4b7={};_0x53f4b7[_0x4c6f46]={'$like':'%'+_0x5bde80[_0x8050('0x35')][_0x8050('0x4e')]+'%'};return _0x53f4b7;})});}_0x27206c=_[_0x8050('0x3f')]({},_0x27206c,_0x5bde80['options']);return _0x37d01c[_0x8050('0x4c')](_0x27206c);}})[_0x8050('0x27')](function(_0x2cc0cb){if(_0x2cc0cb){_0x2acd13=_0x2cc0cb['length'];if(!_0x5bde80[_0x8050('0x35')][_0x8050('0x3a')](_0x8050('0x4f'))){_0x27206c[_0x8050('0x1f')]=qs[_0x8050('0x1f')](_0x5bde80[_0x8050('0x35')]['limit']);_0x27206c[_0x8050('0x1d')]=qs['offset'](_0x5bde80[_0x8050('0x35')]['offset']);}return _0x37d01c[_0x8050('0x4c')](_0x27206c);}})[_0x8050('0x27')](function(_0x43288d){if(_0x43288d){return _0x43288d?{'count':_0x2acd13,'rows':_0x43288d}:null;}})['then'](respondWithResult(_0x316c22,null))[_0x8050('0x44')](handleError(_0x316c22,null));};exports[_0x8050('0x50')]=function(_0x262fb7,_0x4c3c64,_0x121efd){var _0x5d7a8c={};var _0xc9c72b={};var _0x239182;var _0x292d19;return db[_0x8050('0x2f')][_0x8050('0x4d')]({'where':{'id':_0x262fb7[_0x8050('0x4b')]['id']}})[_0x8050('0x27')](handleEntityNotFound(_0x4c3c64,null))[_0x8050('0x27')](function(_0x2ed214){if(_0x2ed214){_0x239182=_0x2ed214;_0xc9c72b[_0x8050('0x33')]=_['keys'](db[_0x8050('0x51')][_0x8050('0x30')]);_0xc9c72b[_0x8050('0x35')]=_[_0x8050('0x34')](_0x262fb7[_0x8050('0x35')]);_0xc9c72b[_0x8050('0x36')]=_[_0x8050('0x37')](_0xc9c72b['model'],_0xc9c72b[_0x8050('0x35')]);_0x5d7a8c[_0x8050('0x39')]=_['intersection'](_0xc9c72b[_0x8050('0x33')],qs[_0x8050('0x38')](_0x262fb7[_0x8050('0x35')]['fields']));_0x5d7a8c[_0x8050('0x39')]=_0x5d7a8c[_0x8050('0x39')][_0x8050('0x46')]?_0x5d7a8c[_0x8050('0x39')]:_0xc9c72b['model'];_0x5d7a8c[_0x8050('0x3b')]=qs[_0x8050('0x3c')](_0x262fb7['query'][_0x8050('0x3c')]);_0x5d7a8c[_0x8050('0x3d')]=qs[_0x8050('0x36')](_[_0x8050('0x3e')](_0x262fb7[_0x8050('0x35')],_0xc9c72b[_0x8050('0x36')]));if(_0x262fb7[_0x8050('0x35')][_0x8050('0x4e')]){_0x5d7a8c[_0x8050('0x3d')]=_[_0x8050('0x3f')](_0x5d7a8c[_0x8050('0x3d')],{'$or':_[_0x8050('0x2e')](_0x5d7a8c['attributes'],function(_0x4b3932){var _0x3375b9={};_0x3375b9[_0x4b3932]={'$like':'%'+_0x262fb7['query']['filter']+'%'};return _0x3375b9;})});}_0x5d7a8c=_[_0x8050('0x3f')]({},_0x5d7a8c,_0x262fb7['options']);return _0x239182[_0x8050('0x50')](_0x5d7a8c);}})['then'](function(_0x1d9e94){if(_0x1d9e94){_0x292d19=_0x1d9e94[_0x8050('0x46')];if(!_0x262fb7['query'][_0x8050('0x3a')](_0x8050('0x4f'))){_0x5d7a8c['limit']=qs[_0x8050('0x1f')](_0x262fb7[_0x8050('0x35')][_0x8050('0x1f')]);_0x5d7a8c['offset']=qs[_0x8050('0x1d')](_0x262fb7[_0x8050('0x35')]['offset']);}return _0x239182[_0x8050('0x50')](_0x5d7a8c);}})[_0x8050('0x27')](function(_0x5b078b){if(_0x5b078b){return _0x5b078b?{'count':_0x292d19,'rows':_0x5b078b}:null;}})['then'](respondWithResult(_0x4c3c64,null))[_0x8050('0x44')](handleError(_0x4c3c64,null));};exports[_0x8050('0x52')]=function(_0x43e0a5,_0x224897,_0x494579){var _0x463d15={};var _0x28a99f={};var _0x4afb70;var _0x1b5b91;return db[_0x8050('0x2f')]['findOne']({'where':{'id':_0x43e0a5[_0x8050('0x4b')]['id']}})['then'](handleEntityNotFound(_0x224897,null))['then'](function(_0xdd0e9d){if(_0xdd0e9d){_0x4afb70=_0xdd0e9d;_0x28a99f['model']=_[_0x8050('0x34')](db[_0x8050('0x51')][_0x8050('0x30')]);_0x28a99f[_0x8050('0x35')]=_['keys'](_0x43e0a5[_0x8050('0x35')]);_0x28a99f[_0x8050('0x36')]=_['intersection'](_0x28a99f[_0x8050('0x33')],_0x28a99f[_0x8050('0x35')]);_0x463d15[_0x8050('0x39')]=_['intersection'](_0x28a99f[_0x8050('0x33')],qs[_0x8050('0x38')](_0x43e0a5[_0x8050('0x35')][_0x8050('0x38')]));_0x463d15['attributes']=_0x463d15[_0x8050('0x39')]['length']?_0x463d15[_0x8050('0x39')]:_0x28a99f[_0x8050('0x33')];_0x463d15[_0x8050('0x3b')]=qs[_0x8050('0x3c')](_0x43e0a5[_0x8050('0x35')][_0x8050('0x3c')]);_0x463d15[_0x8050('0x3d')]=qs[_0x8050('0x36')](_[_0x8050('0x3e')](_0x43e0a5[_0x8050('0x35')],_0x28a99f[_0x8050('0x36')]));if(_0x43e0a5[_0x8050('0x35')][_0x8050('0x4e')]){_0x463d15['where']=_['merge'](_0x463d15[_0x8050('0x3d')],{'$or':_['map'](_0x463d15[_0x8050('0x39')],function(_0x342065){var _0x55a91f={};_0x55a91f[_0x342065]={'$like':'%'+_0x43e0a5[_0x8050('0x35')][_0x8050('0x4e')]+'%'};return _0x55a91f;})});}_0x463d15=_[_0x8050('0x3f')]({},_0x463d15,_0x43e0a5[_0x8050('0x40')]);return _0x4afb70[_0x8050('0x52')](_0x463d15);}})[_0x8050('0x27')](function(_0x354546){if(_0x354546){_0x1b5b91=_0x354546[_0x8050('0x46')];if(!_0x43e0a5[_0x8050('0x35')][_0x8050('0x3a')]('nolimit')){_0x463d15[_0x8050('0x1f')]=qs[_0x8050('0x1f')](_0x43e0a5[_0x8050('0x35')]['limit']);_0x463d15['offset']=qs[_0x8050('0x1d')](_0x43e0a5[_0x8050('0x35')]['offset']);}return _0x4afb70[_0x8050('0x52')](_0x463d15);}})[_0x8050('0x27')](function(_0x420953){if(_0x420953){return _0x420953?{'count':_0x1b5b91,'rows':_0x420953}:null;}})[_0x8050('0x27')](respondWithResult(_0x224897,null))[_0x8050('0x44')](handleError(_0x224897,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 8f4a297..cbd67e1 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x5b4f10,_0x566356){var _0x2f37bb=function(_0x160d0a){while(--_0x160d0a){_0x5b4f10['push'](_0x5b4f10['shift']());}};_0x2f37bb(++_0x566356);}(_0xb821,0xa7));var _0x1b82=function(_0xfba611,_0x1b54e9){_0xfba611=_0xfba611-0x0;var _0x1e500d=_0xb821[_0xfba611];return _0x1e500d;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x1df4c7,_0x57942e){var _0x175ece=function(_0x4d894b){while(--_0x4d894b){_0x1df4c7['push'](_0x1df4c7['shift']());}};_0x175ece(++_0x57942e);}(_0x54ef,0x112));var _0xf54e=function(_0x31f765,_0x4a70cc){_0x31f765=_0x31f765-0x0;var _0x3372be=_0x54ef[_0x31f765];return _0x3372be;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index db05824..63f5e84 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08fc=['request\x20sent','debug','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x08fc,0x182));var _0xc08f=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x08fc[_0x57fa33];return _0x12e724;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc08f('0x0'));var BPromise=require(_0xc08f('0x1'));var rs=require(_0xc08f('0x2'));var fs=require('fs');var Redis=require(_0xc08f('0x3'));var db=require(_0xc08f('0x4'))['db'];var utils=require(_0xc08f('0x5'));var logger=require(_0xc08f('0x6'))(_0xc08f('0x7'));var config=require(_0xc08f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc08f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33b206,_0x4fb68e,_0x47d6f7){return new BPromise(function(_0x517830,_0x34d7c0){return client[_0xc08f('0xa')](_0x33b206,_0x47d6f7)['then'](function(_0x18f11b){logger[_0xc08f('0xb')](_0xc08f('0xc'),_0x4fb68e,_0xc08f('0xd'));logger[_0xc08f('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4fb68e,'request\x20sent',JSON['stringify'](_0x18f11b));if(_0x18f11b[_0xc08f('0xf')]){if(_0x18f11b['error']['code']===0x1f4){logger[_0xc08f('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4fb68e,_0x18f11b['error'][_0xc08f('0x10')]);return _0x34d7c0(_0x18f11b[_0xc08f('0xf')]['message']);}logger[_0xc08f('0xf')](_0xc08f('0xc'),_0x4fb68e,_0x18f11b[_0xc08f('0xf')][_0xc08f('0x10')]);return _0x517830(_0x18f11b[_0xc08f('0xf')][_0xc08f('0x10')]);}else{logger['info'](_0xc08f('0xc'),_0x4fb68e,_0xc08f('0xd'));_0x517830(_0x18f11b[_0xc08f('0x11')][_0xc08f('0x10')]);}})[_0xc08f('0x12')](function(_0x51e387){logger[_0xc08f('0xf')](_0xc08f('0xc'),_0x4fb68e,_0x51e387);_0x34d7c0(_0x51e387);});});} \ No newline at end of file +var _0xc44f=['rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2c5390,_0x4a4fa2){var _0x418a74=function(_0x5c9ea2){while(--_0x5c9ea2){_0x2c5390['push'](_0x2c5390['shift']());}};_0x418a74(++_0x4a4fa2);}(_0xc44f,0x19c));var _0xfc44=function(_0x480390,_0xe34ede){_0x480390=_0x480390-0x0;var _0x346191=_0xc44f[_0x480390];return _0x346191;};'use strict';var _=require(_0xfc44('0x0'));var util=require(_0xfc44('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfc44('0x2'));var fs=require('fs');var Redis=require(_0xfc44('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc44('0x4'));var logger=require(_0xfc44('0x5'))(_0xfc44('0x6'));var config=require(_0xfc44('0x7'));var jayson=require(_0xfc44('0x8'));var client=jayson[_0xfc44('0x9')][_0xfc44('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x508e3d,_0x3684b3,_0x2ab1ca){return new BPromise(function(_0x488869,_0xaad2c4){return client[_0xfc44('0xb')](_0x508e3d,_0x2ab1ca)['then'](function(_0x51253a){logger[_0xfc44('0xc')](_0xfc44('0xd'),_0x3684b3,_0xfc44('0xe'));logger[_0xfc44('0xf')](_0xfc44('0x10'),_0x3684b3,_0xfc44('0xe'),JSON[_0xfc44('0x11')](_0x51253a));if(_0x51253a[_0xfc44('0x12')]){if(_0x51253a[_0xfc44('0x12')]['code']===0x1f4){logger[_0xfc44('0x12')](_0xfc44('0xd'),_0x3684b3,_0x51253a['error']['message']);return _0xaad2c4(_0x51253a[_0xfc44('0x12')][_0xfc44('0x13')]);}logger['error'](_0xfc44('0xd'),_0x3684b3,_0x51253a[_0xfc44('0x12')]['message']);return _0x488869(_0x51253a['error'][_0xfc44('0x13')]);}else{logger[_0xfc44('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3684b3,_0xfc44('0xe'));_0x488869(_0x51253a[_0xfc44('0x14')][_0xfc44('0x13')]);}})[_0xfc44('0x15')](function(_0xa82ec8){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3684b3,_0xa82ec8);_0xaad2c4(_0xa82ec8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 70396ea..69531f8 100644 --- a/server/api/intDynamics365Field/index.js +++ b/server/api/intDynamics365Field/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x823e=['put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','post','isAuthenticated','create'];(function(_0x2103aa,_0x204ccb){var _0x5c64a3=function(_0x41ae35){while(--_0x41ae35){_0x2103aa['push'](_0x2103aa['shift']());}};_0x5c64a3(++_0x204ccb);}(_0x823e,0xe8));var _0xe823=function(_0x25b49c,_0x7c83c5){_0x25b49c=_0x25b49c-0x0;var _0x1bd1c5=_0x823e[_0x25b49c];return _0x1bd1c5;};'use strict';var multer=require(_0xe823('0x0'));var util=require(_0xe823('0x1'));var path=require(_0xe823('0x2'));var timeout=require(_0xe823('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe823('0x4'));var auth=require(_0xe823('0x5'));var interaction=require(_0xe823('0x6'));var config=require(_0xe823('0x7'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe823('0x8')]);router[_0xe823('0x9')](_0xe823('0xa'),auth['isAuthenticated'](),controller[_0xe823('0xb')]);router[_0xe823('0xc')]('/',auth[_0xe823('0xd')](),controller[_0xe823('0xe')]);router[_0xe823('0xf')](_0xe823('0xa'),auth[_0xe823('0xd')](),controller[_0xe823('0x10')]);router[_0xe823('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe823('0x12')]=router; \ No newline at end of file +var _0xa0ee=['post','create','/:id','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','isAuthenticated','show'];(function(_0x1bd416,_0x52f4da){var _0x584a3b=function(_0x7e76ea){while(--_0x7e76ea){_0x1bd416['push'](_0x1bd416['shift']());}};_0x584a3b(++_0x52f4da);}(_0xa0ee,0xcc));var _0xea0e=function(_0x2cacef,_0xba1573){_0x2cacef=_0x2cacef-0x0;var _0x289ba6=_0xa0ee[_0x2cacef];return _0x289ba6;};'use strict';var multer=require('multer');var util=require(_0xea0e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xea0e('0x1'));var router=express[_0xea0e('0x2')]();var fs_extra=require(_0xea0e('0x3'));var auth=require(_0xea0e('0x4'));var interaction=require(_0xea0e('0x5'));var config=require(_0xea0e('0x6'));var controller=require(_0xea0e('0x7'));router[_0xea0e('0x8')]('/',auth['isAuthenticated'](),controller[_0xea0e('0x9')]);router['get']('/:id',auth[_0xea0e('0xa')](),controller[_0xea0e('0xb')]);router[_0xea0e('0xc')]('/',auth[_0xea0e('0xa')](),controller[_0xea0e('0xd')]);router['put'](_0xea0e('0xe'),auth[_0xea0e('0xa')](),controller[_0xea0e('0xf')]);router[_0xea0e('0x10')](_0xea0e('0xe'),auth[_0xea0e('0xa')](),controller[_0xea0e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 6ad3710..d27acd6 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.attributes.js +++ b/server/api/intDynamics365Field/intDynamics365Field.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58fd=['customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','string'];(function(_0x50e480,_0xb736f){var _0x672954=function(_0x5748a3){while(--_0x5748a3){_0x50e480['push'](_0x50e480['shift']());}};_0x672954(++_0xb736f);}(_0x58fd,0x178));var _0xd58f=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x58fd[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xd58f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xd58f('0x1'),'variable',_0xd58f('0x2'),_0xd58f('0x3'),_0xd58f('0x4')),'defaultValue':_0xd58f('0x1')},'content':{'type':Sequelize[_0xd58f('0x5')]},'key':{'type':Sequelize[_0xd58f('0x5')]},'keyType':{'type':Sequelize[_0xd58f('0x6')]('string',_0xd58f('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xd58f('0x5')]},'idField':{'type':Sequelize[_0xd58f('0x5')]},'nameField':{'type':Sequelize[_0xd58f('0x5')]},'customField':{'type':Sequelize[_0xd58f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd58f('0x5')]}}; \ No newline at end of file +var _0x2164=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x20634c,_0x5534fc){var _0x5d8936=function(_0x6b45f2){while(--_0x6b45f2){_0x20634c['push'](_0x20634c['shift']());}};_0x5d8936(++_0x5534fc);}(_0x2164,0x157));var _0x4216=function(_0x480e2e,_0x4ae64a){_0x480e2e=_0x480e2e-0x0;var _0x1d9691=_0x2164[_0x480e2e];return _0x1d9691;};'use strict';var Sequelize=require(_0x4216('0x0'));module[_0x4216('0x1')]={'type':{'type':Sequelize[_0x4216('0x2')]('string',_0x4216('0x3'),_0x4216('0x4'),_0x4216('0x5'),_0x4216('0x6')),'defaultValue':_0x4216('0x7')},'content':{'type':Sequelize[_0x4216('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x4216('0x3'),_0x4216('0x4'))},'keyContent':{'type':Sequelize[_0x4216('0x8')]},'idField':{'type':Sequelize[_0x4216('0x8')]},'nameField':{'type':Sequelize[_0x4216('0x8')]},'customField':{'type':Sequelize[_0x4216('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4216('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 08084b0..064aa32 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.controller.js +++ b/server/api/intDynamics365Field/intDynamics365Field.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x384c=['reject','save','then','destroy','error','stack','name','Dynamics365Field','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','find','catch','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x35cf89,_0x418485){var _0x100062=function(_0x4c36b5){while(--_0x4c36b5){_0x35cf89['push'](_0x35cf89['shift']());}};_0x100062(++_0x418485);}(_0x384c,0x1e3));var _0xc384=function(_0x402b7b,_0x1761ec){_0x402b7b=_0x402b7b-0x0;var _0xf21b7d=_0x384c[_0x402b7b];return _0xf21b7d;};'use strict';var emlformat=require(_0xc384('0x0'));var rimraf=require(_0xc384('0x1'));var zipdir=require(_0xc384('0x2'));var jsonpatch=require(_0xc384('0x3'));var rp=require(_0xc384('0x4'));var moment=require(_0xc384('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc384('0x6'));var util=require(_0xc384('0x7'));var path=require(_0xc384('0x8'));var sox=require('sox');var csv=require(_0xc384('0x9'));var ejs=require(_0xc384('0xa'));var fs=require('fs');var fs_extra=require(_0xc384('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc384('0xc'));var jsforce=require(_0xc384('0xd'));var deskjs=require(_0xc384('0xe'));var toCsv=require(_0xc384('0x9'));var querystring=require(_0xc384('0xf'));var Papa=require('papaparse');var Redis=require(_0xc384('0x10'));var authService=require(_0xc384('0x11'));var qs=require(_0xc384('0x12'));var as=require(_0xc384('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc384('0x14'))('api');var utils=require(_0xc384('0x15'));var config=require(_0xc384('0x16'));var licenseUtil=require(_0xc384('0x17'));var db=require(_0xc384('0x18'))['db'];function respondWithStatusCode(_0x591264,_0x1243c7){_0x1243c7=_0x1243c7||0xcc;return function(_0x567c30){if(_0x567c30){return _0x591264[_0xc384('0x19')](_0x1243c7);}return _0x591264[_0xc384('0x1a')](_0x1243c7)[_0xc384('0x1b')]();};}function respondWithResult(_0x1869f7,_0x3a5c1f){_0x3a5c1f=_0x3a5c1f||0xc8;return function(_0x3ef253){if(_0x3ef253){return _0x1869f7[_0xc384('0x1a')](_0x3a5c1f)['json'](_0x3ef253);}};}function respondWithFilteredResult(_0x1bc637,_0x2f91f8){return function(_0x299c82){if(_0x299c82){var _0x3f32b1=typeof _0x2f91f8[_0xc384('0x1c')]===_0xc384('0x1d')&&typeof _0x2f91f8[_0xc384('0x1e')]===_0xc384('0x1d');var _0x3552ad=_0x299c82[_0xc384('0x1f')];var _0x822c41=_0x3f32b1?0x0:_0x2f91f8[_0xc384('0x1c')];var _0x2331fa=_0x3f32b1?_0x299c82[_0xc384('0x1f')]:_0x2f91f8[_0xc384('0x1c')]+_0x2f91f8[_0xc384('0x1e')];var _0x3e61a6;if(_0x2331fa>=_0x3552ad){_0x2331fa=_0x3552ad;_0x3e61a6=0xc8;}else{_0x3e61a6=0xce;}_0x1bc637[_0xc384('0x1a')](_0x3e61a6);return _0x1bc637[_0xc384('0x20')](_0xc384('0x21'),_0x822c41+'-'+_0x2331fa+'/'+_0x3552ad)[_0xc384('0x22')](_0x299c82);}return null;};}function patchUpdates(_0x268d98){return function(_0x3428ac){try{jsonpatch['apply'](_0x3428ac,_0x268d98,!![]);}catch(_0x5477b3){return BPromise[_0xc384('0x23')](_0x5477b3);}return _0x3428ac[_0xc384('0x24')]();};}function saveUpdates(_0x371c5f,_0x37908e){return function(_0x45e6ed){if(_0x45e6ed){return _0x45e6ed['update'](_0x371c5f)[_0xc384('0x25')](function(_0x71d0fb){return _0x71d0fb;});}return null;};}function removeEntity(_0x27a01d,_0x57559f){return function(_0x50fbb4){if(_0x50fbb4){return _0x50fbb4[_0xc384('0x26')]()['then'](function(){_0x27a01d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x443460,_0x32562a){return function(_0x4f48a6){if(!_0x4f48a6){_0x443460['sendStatus'](0x194);}return _0x4f48a6;};}function handleError(_0x1a2caf,_0x18f9be){_0x18f9be=_0x18f9be||0x1f4;return function(_0x5befcf){logger[_0xc384('0x27')](_0x5befcf[_0xc384('0x28')]);if(_0x5befcf[_0xc384('0x29')]){delete _0x5befcf[_0xc384('0x29')];}_0x1a2caf['status'](_0x18f9be)['send'](_0x5befcf);};}exports['index']=function(_0x4c0614,_0x3e969b){var _0x3a9a99={},_0x6e8c49={},_0x4970d7={'count':0x0,'rows':[]};var _0x231d3c=_['map'](db[_0xc384('0x2a')]['rawAttributes'],function(_0x508b79){return{'name':_0x508b79[_0xc384('0x2b')],'type':_0x508b79['type'][_0xc384('0x2c')]};});_0x6e8c49[_0xc384('0x2d')]=_[_0xc384('0x2e')](_0x231d3c,_0xc384('0x29'));_0x6e8c49[_0xc384('0x2f')]=_[_0xc384('0x30')](_0x4c0614['query']);_0x6e8c49['filters']=_['intersection'](_0x6e8c49[_0xc384('0x2d')],_0x6e8c49[_0xc384('0x2f')]);_0x3a9a99[_0xc384('0x31')]=_[_0xc384('0x32')](_0x6e8c49[_0xc384('0x2d')],qs[_0xc384('0x33')](_0x4c0614[_0xc384('0x2f')]['fields']));_0x3a9a99['attributes']=_0x3a9a99[_0xc384('0x31')][_0xc384('0x34')]?_0x3a9a99[_0xc384('0x31')]:_0x6e8c49[_0xc384('0x2d')];if(!_0x4c0614[_0xc384('0x2f')][_0xc384('0x35')](_0xc384('0x36'))){_0x3a9a99[_0xc384('0x1e')]=qs[_0xc384('0x1e')](_0x4c0614['query'][_0xc384('0x1e')]);_0x3a9a99[_0xc384('0x1c')]=qs[_0xc384('0x1c')](_0x4c0614['query'][_0xc384('0x1c')]);}_0x3a9a99[_0xc384('0x37')]=qs[_0xc384('0x38')](_0x4c0614[_0xc384('0x2f')]['sort']);_0x3a9a99[_0xc384('0x39')]=qs[_0xc384('0x3a')](_[_0xc384('0x3b')](_0x4c0614[_0xc384('0x2f')],_0x6e8c49[_0xc384('0x3a')]),_0x231d3c);if(_0x4c0614[_0xc384('0x2f')][_0xc384('0x3c')]){_0x3a9a99[_0xc384('0x39')]=_[_0xc384('0x3d')](_0x3a9a99[_0xc384('0x39')],{'$or':_['map'](_0x231d3c,function(_0x1daa63){if(_0x1daa63['type']!==_0xc384('0x3e')){var _0x111c0c={};_0x111c0c[_0x1daa63[_0xc384('0x29')]]={'$like':'%'+_0x4c0614[_0xc384('0x2f')][_0xc384('0x3c')]+'%'};return _0x111c0c;}})});}_0x3a9a99=_['merge']({},_0x3a9a99,_0x4c0614[_0xc384('0x3f')]);var _0x3ef08d={'where':_0x3a9a99[_0xc384('0x39')]};return db[_0xc384('0x2a')][_0xc384('0x1f')](_0x3ef08d)[_0xc384('0x25')](function(_0x3a86ba){_0x4970d7[_0xc384('0x1f')]=_0x3a86ba;if(_0x4c0614['query']['includeAll']){_0x3a9a99['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xc384('0x40')](_0x3a9a99);})[_0xc384('0x25')](function(_0x3f69e1){_0x4970d7[_0xc384('0x41')]=_0x3f69e1;return _0x4970d7;})[_0xc384('0x25')](respondWithFilteredResult(_0x3e969b,_0x3a9a99))['catch'](handleError(_0x3e969b,null));};exports[_0xc384('0x42')]=function(_0x52dcd5,_0x1e4f8c){var _0xc25795={'raw':!![],'where':{'id':_0x52dcd5[_0xc384('0x43')]['id']}},_0x3d3e37={};_0x3d3e37['model']=_[_0xc384('0x30')](db[_0xc384('0x2a')][_0xc384('0x44')]);_0x3d3e37[_0xc384('0x2f')]=_[_0xc384('0x30')](_0x52dcd5[_0xc384('0x2f')]);_0x3d3e37['filters']=_[_0xc384('0x32')](_0x3d3e37['model'],_0x3d3e37[_0xc384('0x2f')]);_0xc25795[_0xc384('0x31')]=_['intersection'](_0x3d3e37[_0xc384('0x2d')],qs['fields'](_0x52dcd5['query']['fields']));_0xc25795[_0xc384('0x31')]=_0xc25795[_0xc384('0x31')][_0xc384('0x34')]?_0xc25795[_0xc384('0x31')]:_0x3d3e37[_0xc384('0x2d')];if(_0x52dcd5[_0xc384('0x2f')]['includeAll']){_0xc25795['include']=[{'all':!![]}];}_0xc25795=_[_0xc384('0x3d')]({},_0xc25795,_0x52dcd5[_0xc384('0x3f')]);return db[_0xc384('0x2a')][_0xc384('0x45')](_0xc25795)[_0xc384('0x25')](handleEntityNotFound(_0x1e4f8c,null))[_0xc384('0x25')](respondWithResult(_0x1e4f8c,null))[_0xc384('0x46')](handleError(_0x1e4f8c,null));};exports[_0xc384('0x47')]=function(_0x482ae0,_0x4f509d){return db[_0xc384('0x2a')]['create'](_0x482ae0['body'],{})[_0xc384('0x25')](respondWithResult(_0x4f509d,0xc9))[_0xc384('0x46')](handleError(_0x4f509d,null));};exports[_0xc384('0x48')]=function(_0x3963cc,_0x5497f2){if(_0x3963cc['body']['id']){delete _0x3963cc[_0xc384('0x49')]['id'];}return db[_0xc384('0x2a')]['find']({'where':{'id':_0x3963cc[_0xc384('0x43')]['id']}})[_0xc384('0x25')](handleEntityNotFound(_0x5497f2,null))[_0xc384('0x25')](saveUpdates(_0x3963cc[_0xc384('0x49')],null))['then'](respondWithResult(_0x5497f2,null))[_0xc384('0x46')](handleError(_0x5497f2,null));};exports[_0xc384('0x26')]=function(_0xedb407,_0x255c46){return db['Dynamics365Field'][_0xc384('0x45')]({'where':{'id':_0xedb407[_0xc384('0x43')]['id']}})[_0xc384('0x25')](handleEntityNotFound(_0x255c46,null))['then'](removeEntity(_0x255c46,null))[_0xc384('0x46')](handleError(_0x255c46,null));}; \ No newline at end of file +var _0x1f38=['filter','options','Dynamics365Field','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL'];(function(_0x49d7ca,_0x514fc4){var _0x12422f=function(_0x2bc407){while(--_0x2bc407){_0x49d7ca['push'](_0x49d7ca['shift']());}};_0x12422f(++_0x514fc4);}(_0x1f38,0x1c9));var _0x81f3=function(_0x17fdde,_0x4b3717){_0x17fdde=_0x17fdde-0x0;var _0x4fd885=_0x1f38[_0x17fdde];return _0x4fd885;};'use strict';var emlformat=require(_0x81f3('0x0'));var rimraf=require(_0x81f3('0x1'));var zipdir=require(_0x81f3('0x2'));var jsonpatch=require(_0x81f3('0x3'));var rp=require(_0x81f3('0x4'));var moment=require(_0x81f3('0x5'));var BPromise=require(_0x81f3('0x6'));var Mustache=require(_0x81f3('0x7'));var util=require(_0x81f3('0x8'));var path=require(_0x81f3('0x9'));var sox=require(_0x81f3('0xa'));var csv=require(_0x81f3('0xb'));var ejs=require(_0x81f3('0xc'));var fs=require('fs');var fs_extra=require(_0x81f3('0xd'));var _=require(_0x81f3('0xe'));var squel=require(_0x81f3('0xf'));var crypto=require(_0x81f3('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x81f3('0xb'));var querystring=require(_0x81f3('0x11'));var Papa=require(_0x81f3('0x12'));var Redis=require(_0x81f3('0x13'));var authService=require(_0x81f3('0x14'));var qs=require(_0x81f3('0x15'));var as=require(_0x81f3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81f3('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x81f3('0x18'));var db=require(_0x81f3('0x19'))['db'];function respondWithStatusCode(_0x4a1bcb,_0xee8968){_0xee8968=_0xee8968||0xcc;return function(_0x42110f){if(_0x42110f){return _0x4a1bcb[_0x81f3('0x1a')](_0xee8968);}return _0x4a1bcb[_0x81f3('0x1b')](_0xee8968)['end']();};}function respondWithResult(_0x4895c9,_0x1a202c){_0x1a202c=_0x1a202c||0xc8;return function(_0x43a063){if(_0x43a063){return _0x4895c9[_0x81f3('0x1b')](_0x1a202c)[_0x81f3('0x1c')](_0x43a063);}};}function respondWithFilteredResult(_0x28ebb0,_0x2270ec){return function(_0x1d052c){if(_0x1d052c){var _0x3415c2=typeof _0x2270ec[_0x81f3('0x1d')]===_0x81f3('0x1e')&&typeof _0x2270ec[_0x81f3('0x1f')]==='undefined';var _0x213ad0=_0x1d052c[_0x81f3('0x20')];var _0x5a6ca9=_0x3415c2?0x0:_0x2270ec[_0x81f3('0x1d')];var _0x567497=_0x3415c2?_0x1d052c['count']:_0x2270ec['offset']+_0x2270ec[_0x81f3('0x1f')];var _0x4e534f;if(_0x567497>=_0x213ad0){_0x567497=_0x213ad0;_0x4e534f=0xc8;}else{_0x4e534f=0xce;}_0x28ebb0[_0x81f3('0x1b')](_0x4e534f);return _0x28ebb0[_0x81f3('0x21')]('Content-Range',_0x5a6ca9+'-'+_0x567497+'/'+_0x213ad0)[_0x81f3('0x1c')](_0x1d052c);}return null;};}function patchUpdates(_0x6aede9){return function(_0x5590f0){try{jsonpatch[_0x81f3('0x22')](_0x5590f0,_0x6aede9,!![]);}catch(_0x185b90){return BPromise[_0x81f3('0x23')](_0x185b90);}return _0x5590f0[_0x81f3('0x24')]();};}function saveUpdates(_0x44df0c,_0x490cac){return function(_0x31f7c6){if(_0x31f7c6){return _0x31f7c6[_0x81f3('0x25')](_0x44df0c)[_0x81f3('0x26')](function(_0x5925cb){return _0x5925cb;});}return null;};}function removeEntity(_0x4fd862,_0x2fbc39){return function(_0x115325){if(_0x115325){return _0x115325['destroy']()[_0x81f3('0x26')](function(){_0x4fd862['status'](0xcc)[_0x81f3('0x27')]();});}};}function handleEntityNotFound(_0x34065c,_0x3827dd){return function(_0x1d8693){if(!_0x1d8693){_0x34065c['sendStatus'](0x194);}return _0x1d8693;};}function handleError(_0x3187f1,_0x53add9){_0x53add9=_0x53add9||0x1f4;return function(_0x3fbff6){logger['error'](_0x3fbff6[_0x81f3('0x28')]);if(_0x3fbff6[_0x81f3('0x29')]){delete _0x3fbff6['name'];}_0x3187f1[_0x81f3('0x1b')](_0x53add9)[_0x81f3('0x2a')](_0x3fbff6);};}exports['index']=function(_0x2882ce,_0x53371c){var _0x1e4f68={},_0x218cae={},_0x540c74={'count':0x0,'rows':[]};var _0x50f8d8=_[_0x81f3('0x2b')](db['Dynamics365Field'][_0x81f3('0x2c')],function(_0x8d528a){return{'name':_0x8d528a['fieldName'],'type':_0x8d528a[_0x81f3('0x2d')][_0x81f3('0x2e')]};});_0x218cae[_0x81f3('0x2f')]=_['map'](_0x50f8d8,'name');_0x218cae[_0x81f3('0x30')]=_[_0x81f3('0x31')](_0x2882ce[_0x81f3('0x30')]);_0x218cae[_0x81f3('0x32')]=_[_0x81f3('0x33')](_0x218cae[_0x81f3('0x2f')],_0x218cae[_0x81f3('0x30')]);_0x1e4f68[_0x81f3('0x34')]=_[_0x81f3('0x33')](_0x218cae[_0x81f3('0x2f')],qs[_0x81f3('0x35')](_0x2882ce[_0x81f3('0x30')][_0x81f3('0x35')]));_0x1e4f68[_0x81f3('0x34')]=_0x1e4f68[_0x81f3('0x34')][_0x81f3('0x36')]?_0x1e4f68[_0x81f3('0x34')]:_0x218cae[_0x81f3('0x2f')];if(!_0x2882ce[_0x81f3('0x30')][_0x81f3('0x37')](_0x81f3('0x38'))){_0x1e4f68[_0x81f3('0x1f')]=qs[_0x81f3('0x1f')](_0x2882ce['query'][_0x81f3('0x1f')]);_0x1e4f68[_0x81f3('0x1d')]=qs['offset'](_0x2882ce[_0x81f3('0x30')][_0x81f3('0x1d')]);}_0x1e4f68['order']=qs[_0x81f3('0x39')](_0x2882ce[_0x81f3('0x30')]['sort']);_0x1e4f68['where']=qs[_0x81f3('0x32')](_['pick'](_0x2882ce['query'],_0x218cae['filters']),_0x50f8d8);if(_0x2882ce[_0x81f3('0x30')]['filter']){_0x1e4f68[_0x81f3('0x3a')]=_[_0x81f3('0x3b')](_0x1e4f68[_0x81f3('0x3a')],{'$or':_[_0x81f3('0x2b')](_0x50f8d8,function(_0x2f9c57){if(_0x2f9c57[_0x81f3('0x2d')]!==_0x81f3('0x3c')){var _0x2cdea9={};_0x2cdea9[_0x2f9c57[_0x81f3('0x29')]]={'$like':'%'+_0x2882ce[_0x81f3('0x30')][_0x81f3('0x3d')]+'%'};return _0x2cdea9;}})});}_0x1e4f68=_[_0x81f3('0x3b')]({},_0x1e4f68,_0x2882ce[_0x81f3('0x3e')]);var _0xb00f65={'where':_0x1e4f68[_0x81f3('0x3a')]};return db[_0x81f3('0x3f')]['count'](_0xb00f65)[_0x81f3('0x26')](function(_0x499d5b){_0x540c74[_0x81f3('0x20')]=_0x499d5b;if(_0x2882ce[_0x81f3('0x30')][_0x81f3('0x40')]){_0x1e4f68[_0x81f3('0x41')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x81f3('0x42')](_0x1e4f68);})[_0x81f3('0x26')](function(_0x393750){_0x540c74['rows']=_0x393750;return _0x540c74;})[_0x81f3('0x26')](respondWithFilteredResult(_0x53371c,_0x1e4f68))[_0x81f3('0x43')](handleError(_0x53371c,null));};exports[_0x81f3('0x44')]=function(_0x5d8d56,_0x4ad078){var _0x47af7e={'raw':!![],'where':{'id':_0x5d8d56[_0x81f3('0x45')]['id']}},_0x44a919={};_0x44a919[_0x81f3('0x2f')]=_[_0x81f3('0x31')](db[_0x81f3('0x3f')][_0x81f3('0x2c')]);_0x44a919[_0x81f3('0x30')]=_[_0x81f3('0x31')](_0x5d8d56['query']);_0x44a919[_0x81f3('0x32')]=_['intersection'](_0x44a919[_0x81f3('0x2f')],_0x44a919['query']);_0x47af7e[_0x81f3('0x34')]=_[_0x81f3('0x33')](_0x44a919[_0x81f3('0x2f')],qs[_0x81f3('0x35')](_0x5d8d56['query']['fields']));_0x47af7e[_0x81f3('0x34')]=_0x47af7e[_0x81f3('0x34')][_0x81f3('0x36')]?_0x47af7e[_0x81f3('0x34')]:_0x44a919[_0x81f3('0x2f')];if(_0x5d8d56[_0x81f3('0x30')][_0x81f3('0x40')]){_0x47af7e['include']=[{'all':!![]}];}_0x47af7e=_['merge']({},_0x47af7e,_0x5d8d56[_0x81f3('0x3e')]);return db[_0x81f3('0x3f')][_0x81f3('0x46')](_0x47af7e)['then'](handleEntityNotFound(_0x4ad078,null))[_0x81f3('0x26')](respondWithResult(_0x4ad078,null))[_0x81f3('0x43')](handleError(_0x4ad078,null));};exports[_0x81f3('0x47')]=function(_0xbbda7d,_0x516a8a){return db[_0x81f3('0x3f')][_0x81f3('0x47')](_0xbbda7d['body'],{})['then'](respondWithResult(_0x516a8a,0xc9))['catch'](handleError(_0x516a8a,null));};exports[_0x81f3('0x25')]=function(_0x1c94ad,_0x29a206){if(_0x1c94ad[_0x81f3('0x48')]['id']){delete _0x1c94ad['body']['id'];}return db[_0x81f3('0x3f')][_0x81f3('0x46')]({'where':{'id':_0x1c94ad[_0x81f3('0x45')]['id']}})[_0x81f3('0x26')](handleEntityNotFound(_0x29a206,null))[_0x81f3('0x26')](saveUpdates(_0x1c94ad['body'],null))[_0x81f3('0x26')](respondWithResult(_0x29a206,null))[_0x81f3('0x43')](handleError(_0x29a206,null));};exports[_0x81f3('0x49')]=function(_0x5d9d6b,_0x596cb2){return db[_0x81f3('0x3f')][_0x81f3('0x46')]({'where':{'id':_0x5d9d6b[_0x81f3('0x45')]['id']}})[_0x81f3('0x26')](handleEntityNotFound(_0x596cb2,null))[_0x81f3('0x26')](removeEntity(_0x596cb2,null))[_0x81f3('0x43')](handleError(_0x596cb2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f9d52f1..31d878b 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.model.js +++ b/server/api/intDynamics365Field/intDynamics365Field.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e5e=['dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields'];(function(_0x31fcdc,_0x370b60){var _0x4da262=function(_0x597c25){while(--_0x597c25){_0x31fcdc['push'](_0x31fcdc['shift']());}};_0x4da262(++_0x370b60);}(_0x7e5e,0x1ce));var _0xe7e5=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x7e5e[_0x4191bc];return _0x1ffd4e;};'use strict';var _=require(_0xe7e5('0x0'));var util=require(_0xe7e5('0x1'));var logger=require(_0xe7e5('0x2'))(_0xe7e5('0x3'));var moment=require(_0xe7e5('0x4'));var BPromise=require('bluebird');var rp=require(_0xe7e5('0x5'));var fs=require('fs');var path=require(_0xe7e5('0x6'));var rimraf=require(_0xe7e5('0x7'));var config=require(_0xe7e5('0x8'));var attributes=require(_0xe7e5('0x9'));module[_0xe7e5('0xa')]=function(_0x458704,_0x1dac57){return _0x458704[_0xe7e5('0xb')](_0xe7e5('0xc'),attributes,{'tableName':_0xe7e5('0xd'),'paranoid':![],'indexes':[{'name':_0xe7e5('0xe'),'fields':[_0xe7e5('0xf'),_0xe7e5('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21db=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','FieldId','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5e9826,_0x1bc7a0){var _0x1de320=function(_0x1ea7f8){while(--_0x1ea7f8){_0x5e9826['push'](_0x5e9826['shift']());}};_0x1de320(++_0x1bc7a0);}(_0x21db,0xde));var _0xb21d=function(_0x545a02,_0x2efaab){_0x545a02=_0x545a02-0x0;var _0x70e3e=_0x21db[_0x545a02];return _0x70e3e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb21d('0x0'))(_0xb21d('0x1'));var moment=require('moment');var BPromise=require(_0xb21d('0x2'));var rp=require(_0xb21d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb21d('0x4'));var config=require(_0xb21d('0x5'));var attributes=require(_0xb21d('0x6'));module[_0xb21d('0x7')]=function(_0x558c4d,_0x23914c){return _0x558c4d[_0xb21d('0x8')](_0xb21d('0x9'),attributes,{'tableName':_0xb21d('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xb21d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 02083dd..5b911f7 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.rpc.js +++ b/server/api/intDynamics365Field/intDynamics365Field.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95ac=['rpc','../../config/environment','client','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2cf683,_0x3213de){var _0x5cddff=function(_0x454eed){while(--_0x454eed){_0x2cf683['push'](_0x2cf683['shift']());}};_0x5cddff(++_0x3213de);}(_0x95ac,0x108));var _0xc95a=function(_0x2453c3,_0x465bfa){_0x2453c3=_0x2453c3-0x0;var _0x457b60=_0x95ac[_0x2453c3];return _0x457b60;};'use strict';var _=require(_0xc95a('0x0'));var util=require(_0xc95a('0x1'));var moment=require(_0xc95a('0x2'));var BPromise=require(_0xc95a('0x3'));var rs=require(_0xc95a('0x4'));var fs=require('fs');var Redis=require(_0xc95a('0x5'));var db=require(_0xc95a('0x6'))['db'];var utils=require(_0xc95a('0x7'));var logger=require(_0xc95a('0x8'))(_0xc95a('0x9'));var config=require(_0xc95a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc95a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c4fcb,_0x33832e,_0x3dd8bd){return new BPromise(function(_0x86f21c,_0x1bef3b){return client['request'](_0x6c4fcb,_0x3dd8bd)['then'](function(_0x5534af){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x33832e,_0xc95a('0xc'));logger[_0xc95a('0xd')](_0xc95a('0xe'),_0x33832e,_0xc95a('0xc'),JSON[_0xc95a('0xf')](_0x5534af));if(_0x5534af[_0xc95a('0x10')]){if(_0x5534af[_0xc95a('0x10')]['code']===0x1f4){logger[_0xc95a('0x10')](_0xc95a('0x11'),_0x33832e,_0x5534af['error'][_0xc95a('0x12')]);return _0x1bef3b(_0x5534af[_0xc95a('0x10')]['message']);}logger[_0xc95a('0x10')](_0xc95a('0x11'),_0x33832e,_0x5534af[_0xc95a('0x10')][_0xc95a('0x12')]);return _0x86f21c(_0x5534af[_0xc95a('0x10')][_0xc95a('0x12')]);}else{logger[_0xc95a('0x13')](_0xc95a('0x11'),_0x33832e,_0xc95a('0xc'));_0x86f21c(_0x5534af[_0xc95a('0x14')][_0xc95a('0x12')]);}})['catch'](function(_0x26225d){logger[_0xc95a('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x33832e,_0x26225d);_0x1bef3b(_0x26225d);});});} \ No newline at end of file +var _0x747c=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x747c,0x1b7));var _0xc747=function(_0x39b2a8,_0x232671){_0x39b2a8=_0x39b2a8-0x0;var _0x168b5c=_0x747c[_0x39b2a8];return _0x168b5c;};'use strict';var _=require(_0xc747('0x0'));var util=require(_0xc747('0x1'));var moment=require(_0xc747('0x2'));var BPromise=require('bluebird');var rs=require(_0xc747('0x3'));var fs=require('fs');var Redis=require(_0xc747('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc747('0x5'));var logger=require('../../config/logger')(_0xc747('0x6'));var config=require(_0xc747('0x7'));var jayson=require(_0xc747('0x8'));var client=jayson[_0xc747('0x9')][_0xc747('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d2bbe,_0x5986da,_0x37012d){return new BPromise(function(_0x4885f1,_0x2b0908){return client[_0xc747('0xb')](_0x1d2bbe,_0x37012d)[_0xc747('0xc')](function(_0x18a166){logger[_0xc747('0xd')](_0xc747('0xe'),_0x5986da,'request\x20sent');logger[_0xc747('0xf')](_0xc747('0x10'),_0x5986da,_0xc747('0x11'),JSON[_0xc747('0x12')](_0x18a166));if(_0x18a166['error']){if(_0x18a166[_0xc747('0x13')][_0xc747('0x14')]===0x1f4){logger[_0xc747('0x13')](_0xc747('0xe'),_0x5986da,_0x18a166['error'][_0xc747('0x15')]);return _0x2b0908(_0x18a166[_0xc747('0x13')][_0xc747('0x15')]);}logger[_0xc747('0x13')](_0xc747('0xe'),_0x5986da,_0x18a166[_0xc747('0x13')]['message']);return _0x4885f1(_0x18a166['error']['message']);}else{logger[_0xc747('0xd')](_0xc747('0xe'),_0x5986da,_0xc747('0x11'));_0x4885f1(_0x18a166[_0xc747('0x16')][_0xc747('0x15')]);}})[_0xc747('0x17')](function(_0x26ce8f){logger[_0xc747('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x5986da,_0x26ce8f);_0x2b0908(_0x26ce8f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index be836c6..f03c3a5 100644 --- a/server/api/intFreshdeskAccount/index.js +++ b/server/api/intFreshdeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2260=['./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x496127,_0x306806){var _0x3dd286=function(_0x56c4b7){while(--_0x56c4b7){_0x496127['push'](_0x496127['shift']());}};_0x3dd286(++_0x306806);}(_0x2260,0x161));var _0x0226=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2260[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0226('0x0'));var util=require(_0x0226('0x1'));var path=require(_0x0226('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0226('0x3'));var auth=require(_0x0226('0x4'));var interaction=require(_0x0226('0x5'));var config=require(_0x0226('0x6'));var controller=require(_0x0226('0x7'));router[_0x0226('0x8')]('/',auth[_0x0226('0x9')](),controller['index']);router[_0x0226('0x8')](_0x0226('0xa'),auth[_0x0226('0x9')](),controller[_0x0226('0xb')]);router['get']('/:id/configurations',auth[_0x0226('0x9')](),controller[_0x0226('0xc')]);router[_0x0226('0x8')](_0x0226('0xd'),auth['isAuthenticated'](),controller[_0x0226('0xe')]);router[_0x0226('0xf')]('/',auth[_0x0226('0x9')](),controller[_0x0226('0x10')]);router[_0x0226('0xf')](_0x0226('0x11'),auth[_0x0226('0x9')](),controller[_0x0226('0x12')]);router[_0x0226('0x13')](_0x0226('0xa'),auth[_0x0226('0x9')](),controller[_0x0226('0x14')]);router[_0x0226('0x15')](_0x0226('0xa'),auth[_0x0226('0x9')](),controller[_0x0226('0x16')]);module[_0x0226('0x17')]=router; \ No newline at end of file +var _0x13c3=['addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getFields','create','/:id/configurations'];(function(_0xc19c2f,_0x1fbf65){var _0x33b335=function(_0xe9a7b8){while(--_0xe9a7b8){_0xc19c2f['push'](_0xc19c2f['shift']());}};_0x33b335(++_0x1fbf65);}(_0x13c3,0x6e));var _0x313c=function(_0x3f3567,_0x119f3e){_0x3f3567=_0x3f3567-0x0;var _0x1877a4=_0x13c3[_0x3f3567];return _0x1877a4;};'use strict';var multer=require(_0x313c('0x0'));var util=require(_0x313c('0x1'));var path=require('path');var timeout=require(_0x313c('0x2'));var express=require(_0x313c('0x3'));var router=express[_0x313c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x313c('0x5'));var interaction=require(_0x313c('0x6'));var config=require('../../config/environment');var controller=require(_0x313c('0x7'));router[_0x313c('0x8')]('/',auth[_0x313c('0x9')](),controller[_0x313c('0xa')]);router[_0x313c('0x8')](_0x313c('0xb'),auth[_0x313c('0x9')](),controller[_0x313c('0xc')]);router[_0x313c('0x8')]('/:id/configurations',auth[_0x313c('0x9')](),controller['getConfigurations']);router[_0x313c('0x8')]('/:id/fields',auth[_0x313c('0x9')](),controller[_0x313c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x313c('0xe')]);router['post'](_0x313c('0xf'),auth[_0x313c('0x9')](),controller[_0x313c('0x10')]);router[_0x313c('0x11')]('/:id',auth[_0x313c('0x9')](),controller[_0x313c('0x12')]);router['delete'](_0x313c('0xb'),auth[_0x313c('0x9')](),controller[_0x313c('0x13')]);module[_0x313c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index fffcf40..1f82cc4 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['STRING','username','remoteUri','exports'];(function(_0x2b8388,_0x246b8f){var _0x3ba12a=function(_0x848995){while(--_0x848995){_0x2b8388['push'](_0x2b8388['shift']());}};_0x3ba12a(++_0x246b8f);}(_0x1967,0x173));var _0x7196=function(_0x2da7f8,_0x32321e){_0x2da7f8=_0x2da7f8-0x0;var _0x571d57=_0x1967[_0x2da7f8];return _0x571d57;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'apiKey':{'type':Sequelize[_0x7196('0x1')]},'remoteUri':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x3')},'serverUrl':{'type':Sequelize[_0x7196('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7096=['exports','STRING','username','remoteUri'];(function(_0x1e928b,_0x7cb412){var _0x3e26c3=function(_0x1c41f8){while(--_0x1c41f8){_0x1e928b['push'](_0x1e928b['shift']());}};_0x3e26c3(++_0x7cb412);}(_0x7096,0x10c));var _0x6709=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7096[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index c1e316e..0628736 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e5e=['Basic\x20%s','%s:X','apiKey','toString','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','include','rows','catch','show','params','attributes','includeAll','find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x9e5e[_0x476bf4];return _0x788ffe;};'use strict';var emlformat=require(_0xe9e5('0x0'));var rimraf=require(_0xe9e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9e5('0x2'));var rp=require(_0xe9e5('0x3'));var moment=require(_0xe9e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9e5('0x5'));var util=require('util');var path=require(_0xe9e5('0x6'));var sox=require(_0xe9e5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9e5('0x8'));var _=require(_0xe9e5('0x9'));var squel=require('squel');var crypto=require(_0xe9e5('0xa'));var jsforce=require(_0xe9e5('0xb'));var deskjs=require(_0xe9e5('0xc'));var toCsv=require(_0xe9e5('0xd'));var querystring=require(_0xe9e5('0xe'));var Papa=require(_0xe9e5('0xf'));var Redis=require(_0xe9e5('0x10'));var authService=require(_0xe9e5('0x11'));var qs=require(_0xe9e5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9e5('0x13'));var logger=require(_0xe9e5('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe9e5('0x15'))['db'];var integrations=require(_0xe9e5('0x16'));function respondWithStatusCode(_0x42dcba,_0x272b49){_0x272b49=_0x272b49||0xcc;return function(_0x269ac4){if(_0x269ac4){return _0x42dcba[_0xe9e5('0x17')](_0x272b49);}return _0x42dcba[_0xe9e5('0x18')](_0x272b49)[_0xe9e5('0x19')]();};}function respondWithResult(_0x3097da,_0xfe19e8){_0xfe19e8=_0xfe19e8||0xc8;return function(_0x5c901a){if(_0x5c901a){return _0x3097da[_0xe9e5('0x18')](_0xfe19e8)[_0xe9e5('0x1a')](_0x5c901a);}};}function respondWithFilteredResult(_0x35c830,_0x3f0990){return function(_0x17990d){if(_0x17990d){var _0x695c52=typeof _0x3f0990[_0xe9e5('0x1b')]===_0xe9e5('0x1c')&&typeof _0x3f0990[_0xe9e5('0x1d')]===_0xe9e5('0x1c');var _0x4d779e=_0x17990d[_0xe9e5('0x1e')];var _0x30550=_0x695c52?0x0:_0x3f0990[_0xe9e5('0x1b')];var _0x3ad9f9=_0x695c52?_0x17990d[_0xe9e5('0x1e')]:_0x3f0990[_0xe9e5('0x1b')]+_0x3f0990[_0xe9e5('0x1d')];var _0x44e60d;if(_0x3ad9f9>=_0x4d779e){_0x3ad9f9=_0x4d779e;_0x44e60d=0xc8;}else{_0x44e60d=0xce;}_0x35c830[_0xe9e5('0x18')](_0x44e60d);return _0x35c830[_0xe9e5('0x1f')]('Content-Range',_0x30550+'-'+_0x3ad9f9+'/'+_0x4d779e)['json'](_0x17990d);}return null;};}function patchUpdates(_0x559d10){return function(_0x106b21){try{jsonpatch[_0xe9e5('0x20')](_0x106b21,_0x559d10,!![]);}catch(_0x2935a4){return BPromise[_0xe9e5('0x21')](_0x2935a4);}return _0x106b21[_0xe9e5('0x22')]();};}function saveUpdates(_0xb2a983,_0x22d394){return function(_0x15db4b){if(_0x15db4b){return _0x15db4b[_0xe9e5('0x23')](_0xb2a983)[_0xe9e5('0x24')](function(_0x1b9d2f){return _0x1b9d2f;});}return null;};}function removeEntity(_0x4c0fb9,_0x252fdc){return function(_0x579d9a){if(_0x579d9a){return _0x579d9a[_0xe9e5('0x25')]()['then'](function(){_0x4c0fb9[_0xe9e5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac8fc,_0x5e84dc){return function(_0xf88884){if(!_0xf88884){_0x5ac8fc[_0xe9e5('0x17')](0x194);}return _0xf88884;};}function handleError(_0x338076,_0x327cb2){_0x327cb2=_0x327cb2||0x1f4;return function(_0x3fcab2){logger[_0xe9e5('0x26')](_0x3fcab2[_0xe9e5('0x27')]);if(_0x3fcab2[_0xe9e5('0x28')]){delete _0x3fcab2[_0xe9e5('0x28')];}_0x338076[_0xe9e5('0x18')](_0x327cb2)['send'](_0x3fcab2);};}exports[_0xe9e5('0x29')]=function(_0x56f728,_0xe7d11e){var _0x18969d={},_0x554bcb={},_0x4161e9={'count':0x0,'rows':[]};var _0x881d0d=_[_0xe9e5('0x2a')](db['FreshdeskAccount'][_0xe9e5('0x2b')],function(_0x5d0593){return{'name':_0x5d0593[_0xe9e5('0x2c')],'type':_0x5d0593[_0xe9e5('0x2d')]['key']};});_0x554bcb[_0xe9e5('0x2e')]=_[_0xe9e5('0x2a')](_0x881d0d,'name');_0x554bcb[_0xe9e5('0x2f')]=_[_0xe9e5('0x30')](_0x56f728[_0xe9e5('0x2f')]);_0x554bcb[_0xe9e5('0x31')]=_[_0xe9e5('0x32')](_0x554bcb[_0xe9e5('0x2e')],_0x554bcb['query']);_0x18969d['attributes']=_[_0xe9e5('0x32')](_0x554bcb[_0xe9e5('0x2e')],qs['fields'](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x33')]));_0x18969d['attributes']=_0x18969d['attributes'][_0xe9e5('0x34')]?_0x18969d['attributes']:_0x554bcb['model'];if(!_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x35')](_0xe9e5('0x36'))){_0x18969d[_0xe9e5('0x1d')]=qs[_0xe9e5('0x1d')](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x1d')]);_0x18969d[_0xe9e5('0x1b')]=qs[_0xe9e5('0x1b')](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x1b')]);}_0x18969d[_0xe9e5('0x37')]=qs[_0xe9e5('0x38')](_0x56f728['query'][_0xe9e5('0x38')]);_0x18969d[_0xe9e5('0x39')]=qs[_0xe9e5('0x31')](_[_0xe9e5('0x3a')](_0x56f728[_0xe9e5('0x2f')],_0x554bcb[_0xe9e5('0x31')]),_0x881d0d);if(_0x56f728['query'][_0xe9e5('0x3b')]){_0x18969d[_0xe9e5('0x39')]=_[_0xe9e5('0x3c')](_0x18969d['where'],{'$or':_[_0xe9e5('0x2a')](_0x881d0d,function(_0x352903){if(_0x352903[_0xe9e5('0x2d')]!==_0xe9e5('0x3d')){var _0x3353d6={};_0x3353d6[_0x352903[_0xe9e5('0x28')]]={'$like':'%'+_0x56f728[_0xe9e5('0x2f')]['filter']+'%'};return _0x3353d6;}})});}_0x18969d=_['merge']({},_0x18969d,_0x56f728[_0xe9e5('0x3e')]);var _0x304571={'where':_0x18969d[_0xe9e5('0x39')]};return db[_0xe9e5('0x3f')][_0xe9e5('0x1e')](_0x304571)['then'](function(_0x2c44eb){_0x4161e9['count']=_0x2c44eb;if(_0x56f728[_0xe9e5('0x2f')]['includeAll']){_0x18969d[_0xe9e5('0x40')]=[{'all':!![]}];}return db[_0xe9e5('0x3f')]['findAll'](_0x18969d);})[_0xe9e5('0x24')](function(_0x47c5ea){_0x4161e9[_0xe9e5('0x41')]=_0x47c5ea;return _0x4161e9;})[_0xe9e5('0x24')](respondWithFilteredResult(_0xe7d11e,_0x18969d))[_0xe9e5('0x42')](handleError(_0xe7d11e,null));};exports[_0xe9e5('0x43')]=function(_0x10572d,_0x2bc934){var _0x1601fd={'raw':![],'where':{'id':_0x10572d[_0xe9e5('0x44')]['id']}},_0x147741={};_0x147741[_0xe9e5('0x2e')]=_[_0xe9e5('0x30')](db['FreshdeskAccount'][_0xe9e5('0x2b')]);_0x147741[_0xe9e5('0x2f')]=_[_0xe9e5('0x30')](_0x10572d[_0xe9e5('0x2f')]);_0x147741['filters']=_['intersection'](_0x147741[_0xe9e5('0x2e')],_0x147741['query']);_0x1601fd[_0xe9e5('0x45')]=_[_0xe9e5('0x32')](_0x147741[_0xe9e5('0x2e')],qs[_0xe9e5('0x33')](_0x10572d[_0xe9e5('0x2f')]['fields']));_0x1601fd[_0xe9e5('0x45')]=_0x1601fd['attributes']['length']?_0x1601fd['attributes']:_0x147741[_0xe9e5('0x2e')];if(_0x10572d[_0xe9e5('0x2f')][_0xe9e5('0x46')]){_0x1601fd[_0xe9e5('0x40')]=[{'all':!![]}];}_0x1601fd=_[_0xe9e5('0x3c')]({},_0x1601fd,_0x10572d[_0xe9e5('0x3e')]);return db[_0xe9e5('0x3f')][_0xe9e5('0x47')](_0x1601fd)['then'](handleEntityNotFound(_0x2bc934,null))[_0xe9e5('0x24')](respondWithResult(_0x2bc934,null))[_0xe9e5('0x42')](handleError(_0x2bc934,null));};exports[_0xe9e5('0x48')]=function(_0x441839,_0x2b785e){return db[_0xe9e5('0x3f')][_0xe9e5('0x48')](_0x441839['body'],{})['then'](respondWithResult(_0x2b785e,0xc9))[_0xe9e5('0x42')](handleError(_0x2b785e,null));};exports['update']=function(_0x1dc5cf,_0x20be8f){if(_0x1dc5cf[_0xe9e5('0x49')]['id']){delete _0x1dc5cf['body']['id'];}return db[_0xe9e5('0x3f')][_0xe9e5('0x47')]({'where':{'id':_0x1dc5cf[_0xe9e5('0x44')]['id']}})[_0xe9e5('0x24')](handleEntityNotFound(_0x20be8f,null))['then'](saveUpdates(_0x1dc5cf[_0xe9e5('0x49')],null))[_0xe9e5('0x24')](respondWithResult(_0x20be8f,null))[_0xe9e5('0x42')](handleError(_0x20be8f,null));};exports[_0xe9e5('0x25')]=function(_0x3f532d,_0x23cee5){return db[_0xe9e5('0x3f')][_0xe9e5('0x47')]({'where':{'id':_0x3f532d[_0xe9e5('0x44')]['id']}})['then'](handleEntityNotFound(_0x23cee5,null))['then'](removeEntity(_0x23cee5,null))[_0xe9e5('0x42')](handleError(_0x23cee5,null));};exports[_0xe9e5('0x4a')]=function(_0x275022,_0x3b673d,_0x219f73){var _0x19ad88={};var _0x42ce27={};var _0x28439f;var _0x47d74b;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x275022[_0xe9e5('0x44')]['id']}})[_0xe9e5('0x24')](handleEntityNotFound(_0x3b673d,null))[_0xe9e5('0x24')](function(_0x198ce0){if(_0x198ce0){_0x28439f=_0x198ce0;_0x42ce27[_0xe9e5('0x2e')]=_[_0xe9e5('0x30')](db[_0xe9e5('0x4b')]['rawAttributes']);_0x42ce27[_0xe9e5('0x2f')]=_['keys'](_0x275022[_0xe9e5('0x2f')]);_0x42ce27[_0xe9e5('0x31')]=_[_0xe9e5('0x32')](_0x42ce27['model'],_0x42ce27[_0xe9e5('0x2f')]);_0x19ad88[_0xe9e5('0x45')]=_['intersection'](_0x42ce27['model'],qs[_0xe9e5('0x33')](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x33')]));_0x19ad88[_0xe9e5('0x45')]=_0x19ad88[_0xe9e5('0x45')][_0xe9e5('0x34')]?_0x19ad88[_0xe9e5('0x45')]:_0x42ce27['model'];_0x19ad88[_0xe9e5('0x37')]=qs[_0xe9e5('0x38')](_0x275022[_0xe9e5('0x2f')]['sort']);_0x19ad88[_0xe9e5('0x39')]=qs[_0xe9e5('0x31')](_['pick'](_0x275022[_0xe9e5('0x2f')],_0x42ce27[_0xe9e5('0x31')]));if(_0x275022[_0xe9e5('0x2f')]['filter']){_0x19ad88[_0xe9e5('0x39')]=_[_0xe9e5('0x3c')](_0x19ad88[_0xe9e5('0x39')],{'$or':_[_0xe9e5('0x2a')](_0x19ad88[_0xe9e5('0x45')],function(_0x33ea59){var _0x10b48b={};_0x10b48b[_0x33ea59]={'$like':'%'+_0x275022[_0xe9e5('0x2f')]['filter']+'%'};return _0x10b48b;})});}_0x19ad88=_['merge']({},_0x19ad88,_0x275022[_0xe9e5('0x3e')]);return _0x28439f[_0xe9e5('0x4a')](_0x19ad88);}})[_0xe9e5('0x24')](function(_0x24e116){if(_0x24e116){_0x47d74b=_0x24e116[_0xe9e5('0x34')];if(!_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x35')]('nolimit')){_0x19ad88[_0xe9e5('0x1d')]=qs[_0xe9e5('0x1d')](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x1d')]);_0x19ad88['offset']=qs['offset'](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x1b')]);}return _0x28439f[_0xe9e5('0x4a')](_0x19ad88);}})['then'](function(_0x49d6bb){if(_0x49d6bb){return _0x49d6bb?{'count':_0x47d74b,'rows':_0x49d6bb}:null;}})['then'](respondWithResult(_0x3b673d,null))[_0xe9e5('0x42')](handleError(_0x3b673d,null));};exports[_0xe9e5('0x4c')]=function(_0x335685,_0x19bcd6,_0x2da8ad){if(_0x335685[_0xe9e5('0x49')]['id']){delete _0x335685[_0xe9e5('0x49')]['id'];}return db['FreshdeskAccount'][_0xe9e5('0x4d')]({'where':{'id':_0x335685['params']['id']}})['then'](handleEntityNotFound(_0x19bcd6,null))[_0xe9e5('0x24')](function(_0x1e3373){if(_0x1e3373){_0x335685[_0xe9e5('0x49')][_0xe9e5('0x4e')]=_0x1e3373['id'];_0x335685[_0xe9e5('0x49')][_0xe9e5('0x4f')]=integrations[_0xe9e5('0x50')](_0x335685[_0xe9e5('0x49')][_0xe9e5('0x51')],_0x335685['body'][_0xe9e5('0x2d')]);_0x335685[_0xe9e5('0x49')]['Descriptions']=integrations['getDescriptions'](_0x335685[_0xe9e5('0x49')][_0xe9e5('0x51')],_0x335685[_0xe9e5('0x49')][_0xe9e5('0x2d')]);return db[_0xe9e5('0x4b')][_0xe9e5('0x48')](_0x335685[_0xe9e5('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0xe9e5('0x4f')},{'model':db[_0xe9e5('0x52')],'as':_0xe9e5('0x53')}]});}return null;})[_0xe9e5('0x24')](respondWithResult(_0x19bcd6,null))[_0xe9e5('0x42')](handleError(_0x19bcd6,null));};exports[_0xe9e5('0x54')]=function(_0x15d799,_0x17dcb9,_0x3f655c){var _0x54ba7e='';return db[_0xe9e5('0x3f')]['findOne']({'where':{'id':_0x15d799['params']['id']},'attributes':['id',_0xe9e5('0x55'),'apiKey']})[_0xe9e5('0x24')](handleEntityNotFound(_0x17dcb9,null))[_0xe9e5('0x24')](function(_0x4aa632){if(_0x4aa632){_0x54ba7e=_0x4aa632[_0xe9e5('0x55')];var _0x50ee97=_0x54ba7e[_0xe9e5('0x56')](-0x1);if(_0x50ee97==='/'){_0x54ba7e=_0x54ba7e[_0xe9e5('0x57')](0x0,_0x54ba7e[_0xe9e5('0x58')](_0x50ee97));}return rp({'method':_0xe9e5('0x59'),'uri':util['format'](_0xe9e5('0x5a'),_0x54ba7e,_0xe9e5('0x5b')),'headers':{'Authorization':util[_0xe9e5('0x5c')](_0xe9e5('0x5d'),new Buffer(util['format'](_0xe9e5('0x5e'),_0x4aa632[_0xe9e5('0x5f')]))[_0xe9e5('0x60')]('base64'))},'json':!![]});}})[_0xe9e5('0x24')](function(_0x3b89b2){if(_0x3b89b2){var _0x59c87e=['requester','subject',_0xe9e5('0x61'),_0xe9e5('0x62'),'status',_0xe9e5('0x63'),_0xe9e5('0x64'),_0xe9e5('0x65'),_0xe9e5('0x66'),_0xe9e5('0x64'),'company'];_[_0xe9e5('0x67')](_0x3b89b2,function(_0x500f14){return _0x59c87e[_0xe9e5('0x68')](_0x500f14[_0xe9e5('0x28')])||!_0x500f14[_0xe9e5('0x69')]&&_0x500f14[_0xe9e5('0x2d')]!=='custom_text'&&_0x500f14[_0xe9e5('0x2d')]!==_0xe9e5('0x6a');});return{'count':_0x3b89b2['length'],'rows':_['map'](_0x3b89b2,function(_0x272f6d){return{'id':_0x272f6d[_0xe9e5('0x28')],'name':_0x272f6d[_0xe9e5('0x6b')],'custom':!_0x272f6d[_0xe9e5('0x69')],'options':_0x272f6d['choices']?_[_0xe9e5('0x2a')](_0x272f6d[_0xe9e5('0x6c')],function(_0x2e8bdf){return{'name':_[_0xe9e5('0x6d')](_0x2e8bdf),'value':_0x2e8bdf};}):[]};})};}})[_0xe9e5('0x24')](respondWithResult(_0x17dcb9,null))[_0xe9e5('0x42')](function(_0x26b885){var _0x58302a=_0x15d799[_0xe9e5('0x2f')]['test']?0x1f4:_0x26b885[_0xe9e5('0x6e')]||0x1f4;logger['error'](_0xe9e5('0x6f'),_0xe9e5('0x54'),_0x58302a,JSON['stringify'](_0x26b885));delete _0x26b885[_0xe9e5('0x28')];if(_0x58302a===0x191){_0x58302a=0x190;}_0x17dcb9[_0xe9e5('0x18')](_0x58302a)[_0xe9e5('0x70')](_0x15d799['query'][_0xe9e5('0x71')]?{'message':_0xe9e5('0x72'),'statusCode':_0x26b885[_0xe9e5('0x6e')]}:_0x26b885);});}; \ No newline at end of file +var _0x073e=['params','include','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','requester','subject','priority','group','source','ticket_type','company','remove','default','custom_text','label','choices','capitalize','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','query','keys','model','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch'];(function(_0x4165d4,_0x2702b0){var _0x105d05=function(_0x68f53e){while(--_0x68f53e){_0x4165d4['push'](_0x4165d4['shift']());}};_0x105d05(++_0x2702b0);}(_0x073e,0x181));var _0xe073=function(_0x290550,_0x21b822){_0x290550=_0x290550-0x0;var _0x30c88c=_0x073e[_0x290550];return _0x30c88c;};'use strict';var emlformat=require(_0xe073('0x0'));var rimraf=require(_0xe073('0x1'));var zipdir=require(_0xe073('0x2'));var jsonpatch=require(_0xe073('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe073('0x4'));var util=require(_0xe073('0x5'));var path=require(_0xe073('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe073('0x7'));var _=require(_0xe073('0x8'));var squel=require(_0xe073('0x9'));var crypto=require(_0xe073('0xa'));var jsforce=require(_0xe073('0xb'));var deskjs=require(_0xe073('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe073('0xd'));var Papa=require(_0xe073('0xe'));var Redis=require(_0xe073('0xf'));var authService=require(_0xe073('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe073('0x11'));var hardwareService=require(_0xe073('0x12'));var logger=require(_0xe073('0x13'))(_0xe073('0x14'));var utils=require(_0xe073('0x15'));var config=require(_0xe073('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe073('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3dedf7,_0x5d2f2f){_0x5d2f2f=_0x5d2f2f||0xcc;return function(_0x3549c4){if(_0x3549c4){return _0x3dedf7['sendStatus'](_0x5d2f2f);}return _0x3dedf7[_0xe073('0x18')](_0x5d2f2f)[_0xe073('0x19')]();};}function respondWithResult(_0x47828d,_0x2ce92d){_0x2ce92d=_0x2ce92d||0xc8;return function(_0x3fb05a){if(_0x3fb05a){return _0x47828d[_0xe073('0x18')](_0x2ce92d)[_0xe073('0x1a')](_0x3fb05a);}};}function respondWithFilteredResult(_0xfb28f5,_0x208f2e){return function(_0x26f3d3){if(_0x26f3d3){var _0x38f9e5=typeof _0x208f2e['offset']==='undefined'&&typeof _0x208f2e['limit']===_0xe073('0x1b');var _0x15488e=_0x26f3d3[_0xe073('0x1c')];var _0x16eaa6=_0x38f9e5?0x0:_0x208f2e['offset'];var _0x4fdd2c=_0x38f9e5?_0x26f3d3[_0xe073('0x1c')]:_0x208f2e[_0xe073('0x1d')]+_0x208f2e['limit'];var _0x21c02e;if(_0x4fdd2c>=_0x15488e){_0x4fdd2c=_0x15488e;_0x21c02e=0xc8;}else{_0x21c02e=0xce;}_0xfb28f5[_0xe073('0x18')](_0x21c02e);return _0xfb28f5[_0xe073('0x1e')](_0xe073('0x1f'),_0x16eaa6+'-'+_0x4fdd2c+'/'+_0x15488e)[_0xe073('0x1a')](_0x26f3d3);}return null;};}function patchUpdates(_0x17dd4b){return function(_0x41639a){try{jsonpatch[_0xe073('0x20')](_0x41639a,_0x17dd4b,!![]);}catch(_0xef9bf5){return BPromise[_0xe073('0x21')](_0xef9bf5);}return _0x41639a['save']();};}function saveUpdates(_0x4405fd,_0x21f9c2){return function(_0x419703){if(_0x419703){return _0x419703[_0xe073('0x22')](_0x4405fd)[_0xe073('0x23')](function(_0x275aa8){return _0x275aa8;});}return null;};}function removeEntity(_0x504c26,_0x4c76ef){return function(_0x42d112){if(_0x42d112){return _0x42d112['destroy']()['then'](function(){_0x504c26['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a38b,_0x50795f){return function(_0x23537f){if(!_0x23537f){_0x54a38b[_0xe073('0x24')](0x194);}return _0x23537f;};}function handleError(_0x5bd226,_0x1fca27){_0x1fca27=_0x1fca27||0x1f4;return function(_0x4548d8){logger[_0xe073('0x25')](_0x4548d8['stack']);if(_0x4548d8[_0xe073('0x26')]){delete _0x4548d8['name'];}_0x5bd226[_0xe073('0x18')](_0x1fca27)[_0xe073('0x27')](_0x4548d8);};}exports['index']=function(_0x5dfff9,_0x15adbb){var _0x859ed8={},_0x278fbb={},_0x2f1cd2={'count':0x0,'rows':[]};var _0x20fabe=_[_0xe073('0x28')](db[_0xe073('0x29')][_0xe073('0x2a')],function(_0x5c04fe){return{'name':_0x5c04fe[_0xe073('0x2b')],'type':_0x5c04fe[_0xe073('0x2c')]['key']};});_0x278fbb['model']=_[_0xe073('0x28')](_0x20fabe,'name');_0x278fbb[_0xe073('0x2d')]=_[_0xe073('0x2e')](_0x5dfff9[_0xe073('0x2d')]);_0x278fbb['filters']=_['intersection'](_0x278fbb[_0xe073('0x2f')],_0x278fbb[_0xe073('0x2d')]);_0x859ed8['attributes']=_[_0xe073('0x30')](_0x278fbb[_0xe073('0x2f')],qs[_0xe073('0x31')](_0x5dfff9['query'][_0xe073('0x31')]));_0x859ed8['attributes']=_0x859ed8['attributes'][_0xe073('0x32')]?_0x859ed8[_0xe073('0x33')]:_0x278fbb[_0xe073('0x2f')];if(!_0x5dfff9['query'][_0xe073('0x34')](_0xe073('0x35'))){_0x859ed8[_0xe073('0x36')]=qs['limit'](_0x5dfff9[_0xe073('0x2d')][_0xe073('0x36')]);_0x859ed8[_0xe073('0x1d')]=qs[_0xe073('0x1d')](_0x5dfff9[_0xe073('0x2d')][_0xe073('0x1d')]);}_0x859ed8['order']=qs[_0xe073('0x37')](_0x5dfff9[_0xe073('0x2d')][_0xe073('0x37')]);_0x859ed8['where']=qs[_0xe073('0x38')](_[_0xe073('0x39')](_0x5dfff9[_0xe073('0x2d')],_0x278fbb[_0xe073('0x38')]),_0x20fabe);if(_0x5dfff9[_0xe073('0x2d')]['filter']){_0x859ed8[_0xe073('0x3a')]=_['merge'](_0x859ed8[_0xe073('0x3a')],{'$or':_[_0xe073('0x28')](_0x20fabe,function(_0x469537){if(_0x469537[_0xe073('0x2c')]!==_0xe073('0x3b')){var _0x2e200c={};_0x2e200c[_0x469537[_0xe073('0x26')]]={'$like':'%'+_0x5dfff9[_0xe073('0x2d')][_0xe073('0x3c')]+'%'};return _0x2e200c;}})});}_0x859ed8=_[_0xe073('0x3d')]({},_0x859ed8,_0x5dfff9[_0xe073('0x3e')]);var _0x300ef8={'where':_0x859ed8[_0xe073('0x3a')]};return db['FreshdeskAccount'][_0xe073('0x1c')](_0x300ef8)['then'](function(_0x174207){_0x2f1cd2[_0xe073('0x1c')]=_0x174207;if(_0x5dfff9[_0xe073('0x2d')][_0xe073('0x3f')]){_0x859ed8['include']=[{'all':!![]}];}return db[_0xe073('0x29')][_0xe073('0x40')](_0x859ed8);})[_0xe073('0x23')](function(_0x3c44f1){_0x2f1cd2[_0xe073('0x41')]=_0x3c44f1;return _0x2f1cd2;})['then'](respondWithFilteredResult(_0x15adbb,_0x859ed8))[_0xe073('0x42')](handleError(_0x15adbb,null));};exports['show']=function(_0x764196,_0x2a8c57){var _0x125d1f={'raw':![],'where':{'id':_0x764196[_0xe073('0x43')]['id']}},_0x76ae2e={};_0x76ae2e[_0xe073('0x2f')]=_[_0xe073('0x2e')](db[_0xe073('0x29')][_0xe073('0x2a')]);_0x76ae2e[_0xe073('0x2d')]=_[_0xe073('0x2e')](_0x764196['query']);_0x76ae2e['filters']=_[_0xe073('0x30')](_0x76ae2e[_0xe073('0x2f')],_0x76ae2e[_0xe073('0x2d')]);_0x125d1f[_0xe073('0x33')]=_[_0xe073('0x30')](_0x76ae2e['model'],qs[_0xe073('0x31')](_0x764196[_0xe073('0x2d')][_0xe073('0x31')]));_0x125d1f[_0xe073('0x33')]=_0x125d1f[_0xe073('0x33')]['length']?_0x125d1f[_0xe073('0x33')]:_0x76ae2e['model'];if(_0x764196['query'][_0xe073('0x3f')]){_0x125d1f[_0xe073('0x44')]=[{'all':!![]}];}_0x125d1f=_['merge']({},_0x125d1f,_0x764196['options']);return db[_0xe073('0x29')][_0xe073('0x45')](_0x125d1f)[_0xe073('0x23')](handleEntityNotFound(_0x2a8c57,null))[_0xe073('0x23')](respondWithResult(_0x2a8c57,null))[_0xe073('0x42')](handleError(_0x2a8c57,null));};exports[_0xe073('0x46')]=function(_0x317159,_0x5c7c66){return db[_0xe073('0x29')]['create'](_0x317159[_0xe073('0x47')],{})[_0xe073('0x23')](respondWithResult(_0x5c7c66,0xc9))[_0xe073('0x42')](handleError(_0x5c7c66,null));};exports['update']=function(_0x4d5bcd,_0x20f918){if(_0x4d5bcd[_0xe073('0x47')]['id']){delete _0x4d5bcd[_0xe073('0x47')]['id'];}return db['FreshdeskAccount'][_0xe073('0x45')]({'where':{'id':_0x4d5bcd[_0xe073('0x43')]['id']}})[_0xe073('0x23')](handleEntityNotFound(_0x20f918,null))[_0xe073('0x23')](saveUpdates(_0x4d5bcd[_0xe073('0x47')],null))[_0xe073('0x23')](respondWithResult(_0x20f918,null))[_0xe073('0x42')](handleError(_0x20f918,null));};exports[_0xe073('0x48')]=function(_0x3238eb,_0x5626d4){return db[_0xe073('0x29')]['find']({'where':{'id':_0x3238eb[_0xe073('0x43')]['id']}})['then'](handleEntityNotFound(_0x5626d4,null))[_0xe073('0x23')](removeEntity(_0x5626d4,null))[_0xe073('0x42')](handleError(_0x5626d4,null));};exports[_0xe073('0x49')]=function(_0xc7ff7c,_0x527a35,_0x2a3d65){var _0x1090c4={};var _0x191005={};var _0x48a470;var _0x5503c2;return db[_0xe073('0x29')][_0xe073('0x4a')]({'where':{'id':_0xc7ff7c[_0xe073('0x43')]['id']}})[_0xe073('0x23')](handleEntityNotFound(_0x527a35,null))[_0xe073('0x23')](function(_0x5212d5){if(_0x5212d5){_0x48a470=_0x5212d5;_0x191005[_0xe073('0x2f')]=_[_0xe073('0x2e')](db[_0xe073('0x4b')][_0xe073('0x2a')]);_0x191005[_0xe073('0x2d')]=_[_0xe073('0x2e')](_0xc7ff7c[_0xe073('0x2d')]);_0x191005[_0xe073('0x38')]=_[_0xe073('0x30')](_0x191005[_0xe073('0x2f')],_0x191005['query']);_0x1090c4[_0xe073('0x33')]=_['intersection'](_0x191005['model'],qs[_0xe073('0x31')](_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x31')]));_0x1090c4['attributes']=_0x1090c4[_0xe073('0x33')][_0xe073('0x32')]?_0x1090c4[_0xe073('0x33')]:_0x191005['model'];_0x1090c4[_0xe073('0x4c')]=qs['sort'](_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x37')]);_0x1090c4[_0xe073('0x3a')]=qs[_0xe073('0x38')](_[_0xe073('0x39')](_0xc7ff7c[_0xe073('0x2d')],_0x191005[_0xe073('0x38')]));if(_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x3c')]){_0x1090c4[_0xe073('0x3a')]=_[_0xe073('0x3d')](_0x1090c4[_0xe073('0x3a')],{'$or':_[_0xe073('0x28')](_0x1090c4[_0xe073('0x33')],function(_0x9a824b){var _0x1dff1e={};_0x1dff1e[_0x9a824b]={'$like':'%'+_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x3c')]+'%'};return _0x1dff1e;})});}_0x1090c4=_[_0xe073('0x3d')]({},_0x1090c4,_0xc7ff7c[_0xe073('0x3e')]);return _0x48a470[_0xe073('0x49')](_0x1090c4);}})[_0xe073('0x23')](function(_0xce6a6d){if(_0xce6a6d){_0x5503c2=_0xce6a6d[_0xe073('0x32')];if(!_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x34')]('nolimit')){_0x1090c4[_0xe073('0x36')]=qs[_0xe073('0x36')](_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x36')]);_0x1090c4[_0xe073('0x1d')]=qs['offset'](_0xc7ff7c[_0xe073('0x2d')]['offset']);}return _0x48a470[_0xe073('0x49')](_0x1090c4);}})[_0xe073('0x23')](function(_0x1c941f){if(_0x1c941f){return _0x1c941f?{'count':_0x5503c2,'rows':_0x1c941f}:null;}})[_0xe073('0x23')](respondWithResult(_0x527a35,null))[_0xe073('0x42')](handleError(_0x527a35,null));};exports[_0xe073('0x4d')]=function(_0x5ada4e,_0x3ffd06,_0x5d05e1){if(_0x5ada4e[_0xe073('0x47')]['id']){delete _0x5ada4e['body']['id'];}return db[_0xe073('0x29')][_0xe073('0x4a')]({'where':{'id':_0x5ada4e[_0xe073('0x43')]['id']}})[_0xe073('0x23')](handleEntityNotFound(_0x3ffd06,null))[_0xe073('0x23')](function(_0x17db84){if(_0x17db84){_0x5ada4e[_0xe073('0x47')][_0xe073('0x4e')]=_0x17db84['id'];_0x5ada4e[_0xe073('0x47')][_0xe073('0x4f')]=integrations[_0xe073('0x50')](_0x5ada4e['body']['channel'],_0x5ada4e[_0xe073('0x47')][_0xe073('0x2c')]);_0x5ada4e['body']['Descriptions']=integrations[_0xe073('0x51')](_0x5ada4e[_0xe073('0x47')][_0xe073('0x52')],_0x5ada4e[_0xe073('0x47')][_0xe073('0x2c')]);return db['FreshdeskConfiguration'][_0xe073('0x46')](_0x5ada4e[_0xe073('0x47')],{'include':[{'model':db[_0xe073('0x53')],'as':_0xe073('0x4f')},{'model':db[_0xe073('0x53')],'as':_0xe073('0x54')}]});}return null;})[_0xe073('0x23')](respondWithResult(_0x3ffd06,null))[_0xe073('0x42')](handleError(_0x3ffd06,null));};exports[_0xe073('0x55')]=function(_0x35e2ae,_0x512cd5,_0x19a3e7){var _0x509fd5='';return db['FreshdeskAccount'][_0xe073('0x4a')]({'where':{'id':_0x35e2ae[_0xe073('0x43')]['id']},'attributes':['id',_0xe073('0x56'),_0xe073('0x57')]})[_0xe073('0x23')](handleEntityNotFound(_0x512cd5,null))[_0xe073('0x23')](function(_0x31a0e2){if(_0x31a0e2){_0x509fd5=_0x31a0e2[_0xe073('0x56')];var _0x1b4e7a=_0x509fd5[_0xe073('0x58')](-0x1);if(_0x1b4e7a==='/'){_0x509fd5=_0x509fd5['substring'](0x0,_0x509fd5[_0xe073('0x59')](_0x1b4e7a));}return rp({'method':_0xe073('0x5a'),'uri':util[_0xe073('0x5b')](_0xe073('0x5c'),_0x509fd5,_0xe073('0x5d')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe073('0x5b')](_0xe073('0x5e'),_0x31a0e2[_0xe073('0x57')]))[_0xe073('0x5f')]('base64'))},'json':!![]});}})['then'](function(_0x40a351){if(_0x40a351){var _0x164a8f=[_0xe073('0x60'),_0xe073('0x61'),'agent','description','status',_0xe073('0x62'),_0xe073('0x63'),_0xe073('0x64'),_0xe073('0x65'),_0xe073('0x63'),_0xe073('0x66')];_[_0xe073('0x67')](_0x40a351,function(_0x5bdb91){return _0x164a8f['includes'](_0x5bdb91[_0xe073('0x26')])||!_0x5bdb91[_0xe073('0x68')]&&_0x5bdb91[_0xe073('0x2c')]!==_0xe073('0x69')&&_0x5bdb91[_0xe073('0x2c')]!=='custom_dropdown';});return{'count':_0x40a351[_0xe073('0x32')],'rows':_['map'](_0x40a351,function(_0x5b6b21){return{'id':_0x5b6b21[_0xe073('0x26')],'name':_0x5b6b21[_0xe073('0x6a')],'custom':!_0x5b6b21[_0xe073('0x68')],'options':_0x5b6b21[_0xe073('0x6b')]?_['map'](_0x5b6b21['choices'],function(_0xb8b09f){return{'name':_[_0xe073('0x6c')](_0xb8b09f),'value':_0xb8b09f};}):[]};})};}})['then'](respondWithResult(_0x512cd5,null))[_0xe073('0x42')](function(_0x278717){var _0x624d5f=_0x35e2ae[_0xe073('0x2d')]['test']?0x1f4:_0x278717[_0xe073('0x6d')]||0x1f4;logger[_0xe073('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xe073('0x55'),_0x624d5f,JSON[_0xe073('0x6e')](_0x278717));delete _0x278717['name'];if(_0x624d5f===0x191){_0x624d5f=0x190;}_0x512cd5[_0xe073('0x18')](_0x624d5f)[_0xe073('0x27')](_0x35e2ae[_0xe073('0x2d')][_0xe073('0x6f')]?{'message':_0xe073('0x70'),'statusCode':_0x278717['statusCode']}:_0x278717);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 5088481..7e01f43 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b68=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x21860d,_0x3919b8){var _0x4efa9d=function(_0x2968a2){while(--_0x2968a2){_0x21860d['push'](_0x21860d['shift']());}};_0x4efa9d(++_0x3919b8);}(_0x3b68,0xa5));var _0x83b6=function(_0x32f1f2,_0x540977){_0x32f1f2=_0x32f1f2-0x0;var _0x2da63f=_0x3b68[_0x32f1f2];return _0x2da63f;};'use strict';var _=require(_0x83b6('0x0'));var util=require(_0x83b6('0x1'));var logger=require(_0x83b6('0x2'))(_0x83b6('0x3'));var moment=require(_0x83b6('0x4'));var BPromise=require('bluebird');var rp=require(_0x83b6('0x5'));var fs=require('fs');var path=require(_0x83b6('0x6'));var rimraf=require(_0x83b6('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x83b6('0x8'));module[_0x83b6('0x9')]=function(_0x2c1626,_0x729d40){return _0x2c1626[_0x83b6('0xa')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac1d=['int_freshdesk_accounts','util','../../config/logger','api','rimraf','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount'];(function(_0x52544a,_0x41e302){var _0x501ecf=function(_0x138fe3){while(--_0x138fe3){_0x52544a['push'](_0x52544a['shift']());}};_0x501ecf(++_0x41e302);}(_0xac1d,0x14e));var _0xdac1=function(_0x4146f2,_0x3e3f70){_0x4146f2=_0x4146f2-0x0;var _0x2ae924=_0xac1d[_0x4146f2];return _0x2ae924;};'use strict';var _=require('lodash');var util=require(_0xdac1('0x0'));var logger=require(_0xdac1('0x1'))(_0xdac1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdac1('0x3'));var config=require('../../config/environment');var attributes=require(_0xdac1('0x4'));var integrations=require('../../components/integrations/configuration');module[_0xdac1('0x5')]=function(_0x1b9855,_0x531a3e){return _0x1b9855[_0xdac1('0x6')](_0xdac1('0x7'),attributes,{'tableName':_0xdac1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index d70b247..3b00b6d 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cba=['find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetFreshdeskAccount','ShowFreshdeskAccount'];(function(_0x4ec42,_0x36177b){var _0x385e11=function(_0x44e535){while(--_0x44e535){_0x4ec42['push'](_0x4ec42['shift']());}};_0x385e11(++_0x36177b);}(_0x6cba,0x173));var _0xa6cb=function(_0x5ced04,_0x7989a2){_0x5ced04=_0x5ced04-0x0;var _0x573411=_0x6cba[_0x5ced04];return _0x573411;};'use strict';var _=require(_0xa6cb('0x0'));var util=require(_0xa6cb('0x1'));var moment=require(_0xa6cb('0x2'));var BPromise=require('bluebird');var rs=require(_0xa6cb('0x3'));var fs=require('fs');var Redis=require(_0xa6cb('0x4'));var db=require(_0xa6cb('0x5'))['db'];var utils=require(_0xa6cb('0x6'));var logger=require(_0xa6cb('0x7'))(_0xa6cb('0x8'));var config=require(_0xa6cb('0x9'));var jayson=require(_0xa6cb('0xa'));var client=jayson[_0xa6cb('0xb')][_0xa6cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51c14f,_0x4fa685,_0xcb0881){return new BPromise(function(_0x3169d6,_0x30a9a5){return client[_0xa6cb('0xd')](_0x51c14f,_0xcb0881)[_0xa6cb('0xe')](function(_0x300f67){logger[_0xa6cb('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x4fa685,_0xa6cb('0x10'));logger[_0xa6cb('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4fa685,'request\x20sent',JSON['stringify'](_0x300f67));if(_0x300f67[_0xa6cb('0x12')]){if(_0x300f67['error'][_0xa6cb('0x13')]===0x1f4){logger[_0xa6cb('0x12')](_0xa6cb('0x14'),_0x4fa685,_0x300f67[_0xa6cb('0x12')]['message']);return _0x30a9a5(_0x300f67[_0xa6cb('0x12')]['message']);}logger[_0xa6cb('0x12')](_0xa6cb('0x14'),_0x4fa685,_0x300f67[_0xa6cb('0x12')]['message']);return _0x3169d6(_0x300f67[_0xa6cb('0x12')][_0xa6cb('0x15')]);}else{logger[_0xa6cb('0xf')](_0xa6cb('0x14'),_0x4fa685,'request\x20sent');_0x3169d6(_0x300f67[_0xa6cb('0x16')][_0xa6cb('0x15')]);}})[_0xa6cb('0x17')](function(_0x968aa1){logger[_0xa6cb('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x4fa685,_0x968aa1);_0x30a9a5(_0x968aa1);});});}exports['GetFreshdeskAccount']=function(_0x25bfe3){var _0x112060=this;return new Promise(function(_0x566668,_0x28d46c){return db[_0xa6cb('0x18')][_0xa6cb('0x19')]({'raw':_0x25bfe3[_0xa6cb('0x1a')]?_0x25bfe3[_0xa6cb('0x1a')][_0xa6cb('0x1b')]===undefined?!![]:![]:!![],'where':_0x25bfe3[_0xa6cb('0x1a')]?_0x25bfe3[_0xa6cb('0x1a')][_0xa6cb('0x1c')]||null:null,'attributes':_0x25bfe3[_0xa6cb('0x1a')]?_0x25bfe3['options'][_0xa6cb('0x1d')]||null:null,'limit':_0x25bfe3[_0xa6cb('0x1a')]?_0x25bfe3[_0xa6cb('0x1a')][_0xa6cb('0x1e')]||null:null,'include':_0x25bfe3['options']?_0x25bfe3[_0xa6cb('0x1a')]['include']?_[_0xa6cb('0x1f')](_0x25bfe3[_0xa6cb('0x1a')][_0xa6cb('0x20')],function(_0x1abf9a){return{'model':db[_0x1abf9a[_0xa6cb('0x21')]],'as':_0x1abf9a['as'],'attributes':_0x1abf9a[_0xa6cb('0x1d')],'include':_0x1abf9a['include']?_[_0xa6cb('0x1f')](_0x1abf9a[_0xa6cb('0x20')],function(_0x13f945){return{'model':db[_0x13f945[_0xa6cb('0x21')]],'as':_0x13f945['as'],'attributes':_0x13f945['attributes'],'include':_0x13f945[_0xa6cb('0x20')]?_[_0xa6cb('0x1f')](_0x13f945[_0xa6cb('0x20')],function(_0x254e9a){return{'model':db[_0x254e9a[_0xa6cb('0x21')]],'as':_0x254e9a['as'],'attributes':_0x254e9a[_0xa6cb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa6cb('0xe')](function(_0x4992ff){logger[_0xa6cb('0xf')]('GetFreshdeskAccount',_0x25bfe3);logger['debug']('GetFreshdeskAccount',_0x25bfe3,JSON['stringify'](_0x4992ff));_0x566668(_0x4992ff);})['catch'](function(_0x180d21){logger['error'](_0xa6cb('0x22'),_0x180d21[_0xa6cb('0x15')],_0x25bfe3);_0x28d46c(_0x112060[_0xa6cb('0x12')](0x1f4,_0x180d21[_0xa6cb('0x15')]));});});};exports[_0xa6cb('0x23')]=function(_0xe0d73f){var _0x2b1742=this;return new Promise(function(_0x30478c,_0x12a12a){return db[_0xa6cb('0x18')][_0xa6cb('0x24')]({'raw':_0xe0d73f[_0xa6cb('0x1a')]?_0xe0d73f['options'][_0xa6cb('0x1b')]===undefined?!![]:![]:!![],'where':_0xe0d73f[_0xa6cb('0x1a')]?_0xe0d73f[_0xa6cb('0x1a')][_0xa6cb('0x1c')]||null:null,'attributes':_0xe0d73f['options']?_0xe0d73f['options'][_0xa6cb('0x1d')]||null:null,'include':_0xe0d73f[_0xa6cb('0x1a')]?_0xe0d73f[_0xa6cb('0x1a')][_0xa6cb('0x20')]?_[_0xa6cb('0x1f')](_0xe0d73f[_0xa6cb('0x1a')][_0xa6cb('0x20')],function(_0x23162c){return{'model':db[_0x23162c[_0xa6cb('0x21')]],'as':_0x23162c['as'],'attributes':_0x23162c[_0xa6cb('0x1d')],'include':_0x23162c['include']?_['map'](_0x23162c[_0xa6cb('0x20')],function(_0x30c282){return{'model':db[_0x30c282['model']],'as':_0x30c282['as'],'attributes':_0x30c282[_0xa6cb('0x1d')],'include':_0x30c282[_0xa6cb('0x20')]?_[_0xa6cb('0x1f')](_0x30c282[_0xa6cb('0x20')],function(_0x414f37){return{'model':db[_0x414f37[_0xa6cb('0x21')]],'as':_0x414f37['as'],'attributes':_0x414f37['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eb86b){logger[_0xa6cb('0xf')](_0xa6cb('0x23'),_0xe0d73f);logger[_0xa6cb('0x11')](_0xa6cb('0x23'),_0xe0d73f,JSON['stringify'](_0x4eb86b));_0x30478c(_0x4eb86b);})['catch'](function(_0x1bab56){logger[_0xa6cb('0x12')]('ShowFreshdeskAccount',_0x1bab56[_0xa6cb('0x15')],_0xe0d73f);_0x12a12a(_0x2b1742[_0xa6cb('0x12')](0x1f4,_0x1bab56[_0xa6cb('0x15')]));});});}; \ No newline at end of file +var _0x6c47=['include','model','debug','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','map'];(function(_0x5bd015,_0x4610d8){var _0x19356c=function(_0x4c4117){while(--_0x4c4117){_0x5bd015['push'](_0x5bd015['shift']());}};_0x19356c(++_0x4610d8);}(_0x6c47,0xae));var _0x76c4=function(_0xf78d55,_0x1904a1){_0xf78d55=_0xf78d55-0x0;var _0x5be011=_0x6c47[_0xf78d55];return _0x5be011;};'use strict';var _=require(_0x76c4('0x0'));var util=require(_0x76c4('0x1'));var moment=require('moment');var BPromise=require(_0x76c4('0x2'));var rs=require(_0x76c4('0x3'));var fs=require('fs');var Redis=require(_0x76c4('0x4'));var db=require(_0x76c4('0x5'))['db'];var utils=require(_0x76c4('0x6'));var logger=require('../../config/logger')(_0x76c4('0x7'));var config=require(_0x76c4('0x8'));var jayson=require(_0x76c4('0x9'));var client=jayson['client'][_0x76c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12f0f1,_0x28ec58,_0x1aec6e){return new BPromise(function(_0x5ee361,_0x1dfaa2){return client['request'](_0x12f0f1,_0x1aec6e)[_0x76c4('0xb')](function(_0x5aa4ae){logger[_0x76c4('0xc')](_0x76c4('0xd'),_0x28ec58,_0x76c4('0xe'));logger['debug'](_0x76c4('0xf'),_0x28ec58,_0x76c4('0xe'),JSON[_0x76c4('0x10')](_0x5aa4ae));if(_0x5aa4ae[_0x76c4('0x11')]){if(_0x5aa4ae[_0x76c4('0x11')][_0x76c4('0x12')]===0x1f4){logger[_0x76c4('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x28ec58,_0x5aa4ae[_0x76c4('0x11')][_0x76c4('0x13')]);return _0x1dfaa2(_0x5aa4ae[_0x76c4('0x11')]['message']);}logger[_0x76c4('0x11')](_0x76c4('0xd'),_0x28ec58,_0x5aa4ae[_0x76c4('0x11')][_0x76c4('0x13')]);return _0x5ee361(_0x5aa4ae['error'][_0x76c4('0x13')]);}else{logger[_0x76c4('0xc')](_0x76c4('0xd'),_0x28ec58,_0x76c4('0xe'));_0x5ee361(_0x5aa4ae[_0x76c4('0x14')]['message']);}})[_0x76c4('0x15')](function(_0x455734){logger[_0x76c4('0x11')](_0x76c4('0xd'),_0x28ec58,_0x455734);_0x1dfaa2(_0x455734);});});}exports[_0x76c4('0x16')]=function(_0x5445ed){var _0x53db23=this;return new Promise(function(_0xace765,_0x33054){return db[_0x76c4('0x17')][_0x76c4('0x18')]({'raw':_0x5445ed[_0x76c4('0x19')]?_0x5445ed[_0x76c4('0x19')][_0x76c4('0x1a')]===undefined?!![]:![]:!![],'where':_0x5445ed['options']?_0x5445ed['options'][_0x76c4('0x1b')]||null:null,'attributes':_0x5445ed[_0x76c4('0x19')]?_0x5445ed[_0x76c4('0x19')][_0x76c4('0x1c')]||null:null,'limit':_0x5445ed['options']?_0x5445ed[_0x76c4('0x19')]['limit']||null:null,'include':_0x5445ed[_0x76c4('0x19')]?_0x5445ed[_0x76c4('0x19')]['include']?_[_0x76c4('0x1d')](_0x5445ed[_0x76c4('0x19')][_0x76c4('0x1e')],function(_0x2529b6){return{'model':db[_0x2529b6[_0x76c4('0x1f')]],'as':_0x2529b6['as'],'attributes':_0x2529b6[_0x76c4('0x1c')],'include':_0x2529b6[_0x76c4('0x1e')]?_[_0x76c4('0x1d')](_0x2529b6['include'],function(_0x1357b4){return{'model':db[_0x1357b4[_0x76c4('0x1f')]],'as':_0x1357b4['as'],'attributes':_0x1357b4[_0x76c4('0x1c')],'include':_0x1357b4[_0x76c4('0x1e')]?_['map'](_0x1357b4[_0x76c4('0x1e')],function(_0x214908){return{'model':db[_0x214908['model']],'as':_0x214908['as'],'attributes':_0x214908[_0x76c4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3daf6e){logger[_0x76c4('0xc')](_0x76c4('0x16'),_0x5445ed);logger[_0x76c4('0x20')]('GetFreshdeskAccount',_0x5445ed,JSON[_0x76c4('0x10')](_0x3daf6e));_0xace765(_0x3daf6e);})[_0x76c4('0x15')](function(_0x3f5715){logger['error'](_0x76c4('0x16'),_0x3f5715[_0x76c4('0x13')],_0x5445ed);_0x33054(_0x53db23[_0x76c4('0x11')](0x1f4,_0x3f5715[_0x76c4('0x13')]));});});};exports[_0x76c4('0x21')]=function(_0x3e01d1){var _0x1c0198=this;return new Promise(function(_0x3deb9d,_0x2597bc){return db['FreshdeskAccount']['find']({'raw':_0x3e01d1[_0x76c4('0x19')]?_0x3e01d1['options'][_0x76c4('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e01d1[_0x76c4('0x19')]?_0x3e01d1[_0x76c4('0x19')][_0x76c4('0x1b')]||null:null,'attributes':_0x3e01d1[_0x76c4('0x19')]?_0x3e01d1['options'][_0x76c4('0x1c')]||null:null,'include':_0x3e01d1[_0x76c4('0x19')]?_0x3e01d1[_0x76c4('0x19')][_0x76c4('0x1e')]?_['map'](_0x3e01d1[_0x76c4('0x19')][_0x76c4('0x1e')],function(_0x53a449){return{'model':db[_0x53a449[_0x76c4('0x1f')]],'as':_0x53a449['as'],'attributes':_0x53a449[_0x76c4('0x1c')],'include':_0x53a449[_0x76c4('0x1e')]?_['map'](_0x53a449[_0x76c4('0x1e')],function(_0x1b33c0){return{'model':db[_0x1b33c0[_0x76c4('0x1f')]],'as':_0x1b33c0['as'],'attributes':_0x1b33c0['attributes'],'include':_0x1b33c0[_0x76c4('0x1e')]?_[_0x76c4('0x1d')](_0x1b33c0['include'],function(_0xdd8a78){return{'model':db[_0xdd8a78[_0x76c4('0x1f')]],'as':_0xdd8a78['as'],'attributes':_0xdd8a78['attributes']};}):[]};}):[]};}):[]:[]})[_0x76c4('0xb')](function(_0x2b32e1){logger[_0x76c4('0xc')]('ShowFreshdeskAccount',_0x3e01d1);logger[_0x76c4('0x20')](_0x76c4('0x21'),_0x3e01d1,JSON[_0x76c4('0x10')](_0x2b32e1));_0x3deb9d(_0x2b32e1);})['catch'](function(_0x1d9859){logger[_0x76c4('0x11')]('ShowFreshdeskAccount',_0x1d9859['message'],_0x3e01d1);_0x2597bc(_0x1c0198[_0x76c4('0x11')](0x1f4,_0x1d9859[_0x76c4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c3f27bb..286326d 100644 --- a/server/api/intFreshdeskConfiguration/index.js +++ b/server/api/intFreshdeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x299c=['path','connect-timeout','Router','fs-extra','isAuthenticated','index','get','show','/:id/fields','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x4f6baa,_0x2c1487){var _0x403ec5=function(_0x5dd0c3){while(--_0x5dd0c3){_0x4f6baa['push'](_0x4f6baa['shift']());}};_0x403ec5(++_0x2c1487);}(_0x299c,0xf0));var _0xc299=function(_0x374e88,_0x7966c6){_0x374e88=_0x374e88-0x0;var _0xa555ad=_0x299c[_0x374e88];return _0xa555ad;};'use strict';var multer=require(_0xc299('0x0'));var util=require(_0xc299('0x1'));var path=require(_0xc299('0x2'));var timeout=require(_0xc299('0x3'));var express=require('express');var router=express[_0xc299('0x4')]();var fs_extra=require(_0xc299('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xc299('0x6')](),controller[_0xc299('0x7')]);router[_0xc299('0x8')]('/:id',auth[_0xc299('0x6')](),controller[_0xc299('0x9')]);router[_0xc299('0x8')](_0xc299('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0xc299('0x8')]('/:id/subjects',auth[_0xc299('0x6')](),controller[_0xc299('0xb')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xc299('0xc')]);router[_0xc299('0x8')](_0xc299('0xd'),auth[_0xc299('0x6')](),controller[_0xc299('0xe')]);router[_0xc299('0xf')]('/',auth[_0xc299('0x6')](),controller[_0xc299('0x10')]);router[_0xc299('0xf')](_0xc299('0xd'),auth[_0xc299('0x6')](),controller['setTags']);router[_0xc299('0x11')](_0xc299('0x12'),auth[_0xc299('0x6')](),controller[_0xc299('0x13')]);router[_0xc299('0x14')](_0xc299('0x12'),auth[_0xc299('0x6')](),controller[_0xc299('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb5f7=['index','/:id','show','get','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','util','path','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated'];(function(_0x2a00d6,_0x263a31){var _0x214cfa=function(_0x26868a){while(--_0x26868a){_0x2a00d6['push'](_0x2a00d6['shift']());}};_0x214cfa(++_0x263a31);}(_0xb5f7,0xcd));var _0x7b5f=function(_0x424208,_0x38ddb2){_0x424208=_0x424208-0x0;var _0x476725=_0xb5f7[_0x424208];return _0x476725;};'use strict';var multer=require('multer');var util=require(_0x7b5f('0x0'));var path=require(_0x7b5f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7b5f('0x2'));var controller=require(_0x7b5f('0x3'));router['get']('/',auth[_0x7b5f('0x4')](),controller[_0x7b5f('0x5')]);router['get'](_0x7b5f('0x6'),auth['isAuthenticated'](),controller[_0x7b5f('0x7')]);router[_0x7b5f('0x8')](_0x7b5f('0x9'),auth[_0x7b5f('0x4')](),controller[_0x7b5f('0xa')]);router[_0x7b5f('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x7b5f('0x8')](_0x7b5f('0xb'),auth['isAuthenticated'](),controller[_0x7b5f('0xc')]);router[_0x7b5f('0x8')](_0x7b5f('0xd'),auth['isAuthenticated'](),controller[_0x7b5f('0xe')]);router[_0x7b5f('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7b5f('0xf')](_0x7b5f('0xd'),auth[_0x7b5f('0x4')](),controller[_0x7b5f('0x10')]);router[_0x7b5f('0x11')](_0x7b5f('0x6'),auth[_0x7b5f('0x4')](),controller[_0x7b5f('0x12')]);router[_0x7b5f('0x13')]('/:id',auth[_0x7b5f('0x4')](),controller[_0x7b5f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 952c6cf..853c72f 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['STRING','sequelize'];(function(_0x284d8f,_0x1afc9e){var _0x6acf64=function(_0x1f62fa){while(--_0x1f62fa){_0x284d8f['push'](_0x284d8f['shift']());}};_0x6acf64(++_0x1afc9e);}(_0x24ca,0x14b));var _0xa24c=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x24ca[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa24c('0x1')]}}; \ No newline at end of file +var _0x756e=['exports','STRING','sequelize'];(function(_0xbcc6e1,_0x4c42f6){var _0x4985f9=function(_0x2f96ec){while(--_0x2f96ec){_0xbcc6e1['push'](_0xbcc6e1['shift']());}};_0x4985f9(++_0x4c42f6);}(_0x756e,0xe3));var _0xe756=function(_0x275853,_0x59eeb6){_0x275853=_0x275853-0x0;var _0x3ca91c=_0x756e[_0x275853];return _0x3ca91c;};'use strict';var Sequelize=require(_0xe756('0x0'));module[_0xe756('0x1')]={'name':{'type':Sequelize[_0xe756('0x2')]},'description':{'type':Sequelize[_0xe756('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 5aab4ce..0c5c2bb 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33b4=['filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','update','body','getFields','FreshdeskField','sort','pick','getSubjects','getDescriptions','findOne','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','apply','then','destroy','sendStatus','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters'];(function(_0xe38dbe,_0x2648a7){var _0x536f04=function(_0x2867be){while(--_0x2867be){_0xe38dbe['push'](_0xe38dbe['shift']());}};_0x536f04(++_0x2648a7);}(_0x33b4,0xbb));var _0x433b=function(_0x4672fe,_0xc2cd1a){_0x4672fe=_0x4672fe-0x0;var _0x3545eb=_0x33b4[_0x4672fe];return _0x3545eb;};'use strict';var emlformat=require(_0x433b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x433b('0x1'));var jsonpatch=require(_0x433b('0x2'));var rp=require('request-promise');var moment=require(_0x433b('0x3'));var BPromise=require(_0x433b('0x4'));var Mustache=require('mustache');var util=require(_0x433b('0x5'));var path=require(_0x433b('0x6'));var sox=require(_0x433b('0x7'));var csv=require(_0x433b('0x8'));var ejs=require(_0x433b('0x9'));var fs=require('fs');var fs_extra=require(_0x433b('0xa'));var _=require('lodash');var squel=require(_0x433b('0xb'));var crypto=require(_0x433b('0xc'));var jsforce=require(_0x433b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x433b('0xe'));var Papa=require(_0x433b('0xf'));var Redis=require('ioredis');var authService=require(_0x433b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x433b('0x11'));var logger=require('../../config/logger')(_0x433b('0x12'));var utils=require(_0x433b('0x13'));var config=require(_0x433b('0x14'));var licenseUtil=require(_0x433b('0x15'));var db=require(_0x433b('0x16'))['db'];function respondWithStatusCode(_0x49f338,_0x44323f){_0x44323f=_0x44323f||0xcc;return function(_0x1b5b38){if(_0x1b5b38){return _0x49f338['sendStatus'](_0x44323f);}return _0x49f338['status'](_0x44323f)[_0x433b('0x17')]();};}function respondWithResult(_0x42522d,_0x594586){_0x594586=_0x594586||0xc8;return function(_0x2f72b4){if(_0x2f72b4){return _0x42522d[_0x433b('0x18')](_0x594586)['json'](_0x2f72b4);}};}function respondWithFilteredResult(_0x333117,_0x48bcb3){return function(_0x5eeaeb){if(_0x5eeaeb){var _0x3f5b74=typeof _0x48bcb3[_0x433b('0x19')]===_0x433b('0x1a')&&typeof _0x48bcb3[_0x433b('0x1b')]===_0x433b('0x1a');var _0x1955a0=_0x5eeaeb[_0x433b('0x1c')];var _0x36d76d=_0x3f5b74?0x0:_0x48bcb3[_0x433b('0x19')];var _0x3c778f=_0x3f5b74?_0x5eeaeb['count']:_0x48bcb3['offset']+_0x48bcb3['limit'];var _0x1d8a2d;if(_0x3c778f>=_0x1955a0){_0x3c778f=_0x1955a0;_0x1d8a2d=0xc8;}else{_0x1d8a2d=0xce;}_0x333117['status'](_0x1d8a2d);return _0x333117['set'](_0x433b('0x1d'),_0x36d76d+'-'+_0x3c778f+'/'+_0x1955a0)[_0x433b('0x1e')](_0x5eeaeb);}return null;};}function patchUpdates(_0x32e26a){return function(_0x26a2c2){try{jsonpatch[_0x433b('0x1f')](_0x26a2c2,_0x32e26a,!![]);}catch(_0x981bc4){return BPromise['reject'](_0x981bc4);}return _0x26a2c2['save']();};}function saveUpdates(_0x2e4161,_0x37f2c3){return function(_0x3c3dbb){if(_0x3c3dbb){return _0x3c3dbb['update'](_0x2e4161)[_0x433b('0x20')](function(_0xcdbf4f){return _0xcdbf4f;});}return null;};}function removeEntity(_0x489845,_0x40f63d){return function(_0x586339){if(_0x586339){return _0x586339[_0x433b('0x21')]()[_0x433b('0x20')](function(){_0x489845[_0x433b('0x18')](0xcc)[_0x433b('0x17')]();});}};}function handleEntityNotFound(_0x393210,_0x58497b){return function(_0x55b441){if(!_0x55b441){_0x393210[_0x433b('0x22')](0x194);}return _0x55b441;};}function handleError(_0x4919f8,_0x84e7e9){_0x84e7e9=_0x84e7e9||0x1f4;return function(_0x5afde0){logger[_0x433b('0x23')](_0x5afde0['stack']);if(_0x5afde0['name']){delete _0x5afde0[_0x433b('0x24')];}_0x4919f8[_0x433b('0x18')](_0x84e7e9)[_0x433b('0x25')](_0x5afde0);};}exports[_0x433b('0x26')]=function(_0x11eb9b,_0x5c0ef2){var _0x336729={},_0x5998a3={},_0x5b4b8c={'count':0x0,'rows':[]};var _0x50ba54=_[_0x433b('0x27')](db[_0x433b('0x28')][_0x433b('0x29')],function(_0x312e6b){return{'name':_0x312e6b[_0x433b('0x2a')],'type':_0x312e6b[_0x433b('0x2b')]['key']};});_0x5998a3['model']=_[_0x433b('0x27')](_0x50ba54,_0x433b('0x24'));_0x5998a3[_0x433b('0x2c')]=_[_0x433b('0x2d')](_0x11eb9b[_0x433b('0x2c')]);_0x5998a3['filters']=_[_0x433b('0x2e')](_0x5998a3[_0x433b('0x2f')],_0x5998a3[_0x433b('0x2c')]);_0x336729['attributes']=_['intersection'](_0x5998a3[_0x433b('0x2f')],qs[_0x433b('0x30')](_0x11eb9b[_0x433b('0x2c')][_0x433b('0x30')]));_0x336729['attributes']=_0x336729[_0x433b('0x31')][_0x433b('0x32')]?_0x336729[_0x433b('0x31')]:_0x5998a3[_0x433b('0x2f')];if(!_0x11eb9b[_0x433b('0x2c')][_0x433b('0x33')](_0x433b('0x34'))){_0x336729['limit']=qs[_0x433b('0x1b')](_0x11eb9b['query']['limit']);_0x336729['offset']=qs[_0x433b('0x19')](_0x11eb9b[_0x433b('0x2c')][_0x433b('0x19')]);}_0x336729[_0x433b('0x35')]=qs['sort'](_0x11eb9b[_0x433b('0x2c')]['sort']);_0x336729[_0x433b('0x36')]=qs[_0x433b('0x37')](_['pick'](_0x11eb9b[_0x433b('0x2c')],_0x5998a3[_0x433b('0x37')]),_0x50ba54);if(_0x11eb9b[_0x433b('0x2c')][_0x433b('0x38')]){_0x336729['where']=_[_0x433b('0x39')](_0x336729[_0x433b('0x36')],{'$or':_[_0x433b('0x27')](_0x50ba54,function(_0x5420b3){if(_0x5420b3['type']!==_0x433b('0x3a')){var _0x21a5ad={};_0x21a5ad[_0x5420b3[_0x433b('0x24')]]={'$like':'%'+_0x11eb9b[_0x433b('0x2c')][_0x433b('0x38')]+'%'};return _0x21a5ad;}})});}_0x336729=_[_0x433b('0x39')]({},_0x336729,_0x11eb9b[_0x433b('0x3b')]);var _0x16884e={'where':_0x336729['where']};return db['FreshdeskConfiguration']['count'](_0x16884e)[_0x433b('0x20')](function(_0x3d8506){_0x5b4b8c[_0x433b('0x1c')]=_0x3d8506;if(_0x11eb9b[_0x433b('0x2c')][_0x433b('0x3c')]){_0x336729[_0x433b('0x3d')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x433b('0x3e')](_0x336729);})[_0x433b('0x20')](function(_0x55f2ac){_0x5b4b8c['rows']=_0x55f2ac;return _0x5b4b8c;})['then'](respondWithFilteredResult(_0x5c0ef2,_0x336729))[_0x433b('0x3f')](handleError(_0x5c0ef2,null));};exports[_0x433b('0x40')]=function(_0x4f8ecc,_0xb80579){var _0xafb883={'raw':![],'where':{'id':_0x4f8ecc[_0x433b('0x41')]['id']}},_0x41fb2c={};_0x41fb2c[_0x433b('0x2f')]=_[_0x433b('0x2d')](db[_0x433b('0x28')]['rawAttributes']);_0x41fb2c[_0x433b('0x2c')]=_[_0x433b('0x2d')](_0x4f8ecc[_0x433b('0x2c')]);_0x41fb2c[_0x433b('0x37')]=_[_0x433b('0x2e')](_0x41fb2c[_0x433b('0x2f')],_0x41fb2c[_0x433b('0x2c')]);_0xafb883[_0x433b('0x31')]=_[_0x433b('0x2e')](_0x41fb2c[_0x433b('0x2f')],qs[_0x433b('0x30')](_0x4f8ecc['query']['fields']));_0xafb883[_0x433b('0x31')]=_0xafb883[_0x433b('0x31')]['length']?_0xafb883[_0x433b('0x31')]:_0x41fb2c[_0x433b('0x2f')];if(_0x4f8ecc['query'][_0x433b('0x3c')]){_0xafb883[_0x433b('0x3d')]=[{'all':!![]}];}_0xafb883=_[_0x433b('0x39')]({},_0xafb883,_0x4f8ecc[_0x433b('0x3b')]);return db['FreshdeskConfiguration'][_0x433b('0x42')](_0xafb883)[_0x433b('0x20')](handleEntityNotFound(_0xb80579,null))[_0x433b('0x20')](respondWithResult(_0xb80579,null))[_0x433b('0x3f')](handleError(_0xb80579,null));};exports['create']=function(_0x46fee5,_0x56acfd){return db[_0x433b('0x28')][_0x433b('0x43')](_0x46fee5['body'],{})[_0x433b('0x20')](respondWithResult(_0x56acfd,0xc9))[_0x433b('0x3f')](handleError(_0x56acfd,null));};exports[_0x433b('0x44')]=function(_0x29bcf5,_0xa9e6a){if(_0x29bcf5[_0x433b('0x45')]['id']){delete _0x29bcf5[_0x433b('0x45')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x29bcf5[_0x433b('0x41')]['id']}})[_0x433b('0x20')](handleEntityNotFound(_0xa9e6a,null))[_0x433b('0x20')](saveUpdates(_0x29bcf5[_0x433b('0x45')],null))[_0x433b('0x20')](respondWithResult(_0xa9e6a,null))[_0x433b('0x3f')](handleError(_0xa9e6a,null));};exports[_0x433b('0x21')]=function(_0x2dfd30,_0x5745ae){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x2dfd30[_0x433b('0x41')]['id']}})[_0x433b('0x20')](handleEntityNotFound(_0x5745ae,null))[_0x433b('0x20')](removeEntity(_0x5745ae,null))[_0x433b('0x3f')](handleError(_0x5745ae,null));};exports[_0x433b('0x46')]=function(_0x28a68e,_0x4aed7d,_0x14a204){var _0x868f2e={};var _0x3197a1={};var _0x37b692;var _0x4ed4ed;return db[_0x433b('0x28')]['findOne']({'where':{'id':_0x28a68e[_0x433b('0x41')]['id']}})[_0x433b('0x20')](handleEntityNotFound(_0x4aed7d,null))[_0x433b('0x20')](function(_0x28d36e){if(_0x28d36e){_0x37b692=_0x28d36e;_0x3197a1[_0x433b('0x2f')]=_[_0x433b('0x2d')](db[_0x433b('0x47')][_0x433b('0x29')]);_0x3197a1['query']=_['keys'](_0x28a68e[_0x433b('0x2c')]);_0x3197a1[_0x433b('0x37')]=_[_0x433b('0x2e')](_0x3197a1[_0x433b('0x2f')],_0x3197a1[_0x433b('0x2c')]);_0x868f2e[_0x433b('0x31')]=_[_0x433b('0x2e')](_0x3197a1['model'],qs['fields'](_0x28a68e['query']['fields']));_0x868f2e[_0x433b('0x31')]=_0x868f2e[_0x433b('0x31')]['length']?_0x868f2e[_0x433b('0x31')]:_0x3197a1[_0x433b('0x2f')];_0x868f2e['order']=qs[_0x433b('0x48')](_0x28a68e['query'][_0x433b('0x48')]);_0x868f2e['where']=qs['filters'](_[_0x433b('0x49')](_0x28a68e[_0x433b('0x2c')],_0x3197a1[_0x433b('0x37')]));if(_0x28a68e['query']['filter']){_0x868f2e[_0x433b('0x36')]=_['merge'](_0x868f2e[_0x433b('0x36')],{'$or':_[_0x433b('0x27')](_0x868f2e[_0x433b('0x31')],function(_0x34cfa7){var _0x4bcea9={};_0x4bcea9[_0x34cfa7]={'$like':'%'+_0x28a68e[_0x433b('0x2c')][_0x433b('0x38')]+'%'};return _0x4bcea9;})});}_0x868f2e=_[_0x433b('0x39')]({},_0x868f2e,_0x28a68e[_0x433b('0x3b')]);return _0x37b692[_0x433b('0x46')](_0x868f2e);}})[_0x433b('0x20')](function(_0x5d8e06){if(_0x5d8e06){_0x4ed4ed=_0x5d8e06['length'];if(!_0x28a68e['query'][_0x433b('0x33')](_0x433b('0x34'))){_0x868f2e[_0x433b('0x1b')]=qs['limit'](_0x28a68e[_0x433b('0x2c')][_0x433b('0x1b')]);_0x868f2e[_0x433b('0x19')]=qs[_0x433b('0x19')](_0x28a68e['query'][_0x433b('0x19')]);}return _0x37b692[_0x433b('0x46')](_0x868f2e);}})[_0x433b('0x20')](function(_0x8fcda7){if(_0x8fcda7){return _0x8fcda7?{'count':_0x4ed4ed,'rows':_0x8fcda7}:null;}})['then'](respondWithResult(_0x4aed7d,null))[_0x433b('0x3f')](handleError(_0x4aed7d,null));};exports['getSubjects']=function(_0x1deb69,_0x5dff9f,_0x36321a){var _0x3c01a8={};var _0x2e6ce3={};var _0x58d208;var _0x3fb8af;return db[_0x433b('0x28')]['findOne']({'where':{'id':_0x1deb69[_0x433b('0x41')]['id']}})[_0x433b('0x20')](handleEntityNotFound(_0x5dff9f,null))[_0x433b('0x20')](function(_0x283148){if(_0x283148){_0x58d208=_0x283148;_0x2e6ce3['model']=_[_0x433b('0x2d')](db[_0x433b('0x47')][_0x433b('0x29')]);_0x2e6ce3['query']=_[_0x433b('0x2d')](_0x1deb69['query']);_0x2e6ce3[_0x433b('0x37')]=_[_0x433b('0x2e')](_0x2e6ce3['model'],_0x2e6ce3['query']);_0x3c01a8['attributes']=_[_0x433b('0x2e')](_0x2e6ce3[_0x433b('0x2f')],qs['fields'](_0x1deb69[_0x433b('0x2c')][_0x433b('0x30')]));_0x3c01a8[_0x433b('0x31')]=_0x3c01a8['attributes'][_0x433b('0x32')]?_0x3c01a8[_0x433b('0x31')]:_0x2e6ce3['model'];_0x3c01a8[_0x433b('0x35')]=qs[_0x433b('0x48')](_0x1deb69['query'][_0x433b('0x48')]);_0x3c01a8[_0x433b('0x36')]=qs['filters'](_[_0x433b('0x49')](_0x1deb69['query'],_0x2e6ce3[_0x433b('0x37')]));if(_0x1deb69[_0x433b('0x2c')][_0x433b('0x38')]){_0x3c01a8[_0x433b('0x36')]=_[_0x433b('0x39')](_0x3c01a8[_0x433b('0x36')],{'$or':_[_0x433b('0x27')](_0x3c01a8[_0x433b('0x31')],function(_0x209959){var _0x593369={};_0x593369[_0x209959]={'$like':'%'+_0x1deb69[_0x433b('0x2c')][_0x433b('0x38')]+'%'};return _0x593369;})});}_0x3c01a8=_[_0x433b('0x39')]({},_0x3c01a8,_0x1deb69[_0x433b('0x3b')]);return _0x58d208[_0x433b('0x4a')](_0x3c01a8);}})['then'](function(_0x4555df){if(_0x4555df){_0x3fb8af=_0x4555df[_0x433b('0x32')];if(!_0x1deb69[_0x433b('0x2c')][_0x433b('0x33')](_0x433b('0x34'))){_0x3c01a8[_0x433b('0x1b')]=qs[_0x433b('0x1b')](_0x1deb69[_0x433b('0x2c')][_0x433b('0x1b')]);_0x3c01a8[_0x433b('0x19')]=qs[_0x433b('0x19')](_0x1deb69[_0x433b('0x2c')][_0x433b('0x19')]);}return _0x58d208[_0x433b('0x4a')](_0x3c01a8);}})['then'](function(_0x366f49){if(_0x366f49){return _0x366f49?{'count':_0x3fb8af,'rows':_0x366f49}:null;}})[_0x433b('0x20')](respondWithResult(_0x5dff9f,null))['catch'](handleError(_0x5dff9f,null));};exports[_0x433b('0x4b')]=function(_0x14b40d,_0x4d6024,_0x30865a){var _0x5c538e={};var _0x4baf59={};var _0xf875b0;var _0x4f2997;return db[_0x433b('0x28')][_0x433b('0x4c')]({'where':{'id':_0x14b40d['params']['id']}})['then'](handleEntityNotFound(_0x4d6024,null))['then'](function(_0x42aa25){if(_0x42aa25){_0xf875b0=_0x42aa25;_0x4baf59['model']=_[_0x433b('0x2d')](db[_0x433b('0x47')][_0x433b('0x29')]);_0x4baf59['query']=_['keys'](_0x14b40d[_0x433b('0x2c')]);_0x4baf59[_0x433b('0x37')]=_[_0x433b('0x2e')](_0x4baf59[_0x433b('0x2f')],_0x4baf59['query']);_0x5c538e['attributes']=_[_0x433b('0x2e')](_0x4baf59['model'],qs[_0x433b('0x30')](_0x14b40d[_0x433b('0x2c')][_0x433b('0x30')]));_0x5c538e[_0x433b('0x31')]=_0x5c538e[_0x433b('0x31')][_0x433b('0x32')]?_0x5c538e[_0x433b('0x31')]:_0x4baf59['model'];_0x5c538e[_0x433b('0x35')]=qs[_0x433b('0x48')](_0x14b40d['query']['sort']);_0x5c538e['where']=qs[_0x433b('0x37')](_[_0x433b('0x49')](_0x14b40d['query'],_0x4baf59[_0x433b('0x37')]));if(_0x14b40d[_0x433b('0x2c')]['filter']){_0x5c538e[_0x433b('0x36')]=_[_0x433b('0x39')](_0x5c538e[_0x433b('0x36')],{'$or':_[_0x433b('0x27')](_0x5c538e[_0x433b('0x31')],function(_0x4c1f2c){var _0x409a19={};_0x409a19[_0x4c1f2c]={'$like':'%'+_0x14b40d[_0x433b('0x2c')][_0x433b('0x38')]+'%'};return _0x409a19;})});}_0x5c538e=_['merge']({},_0x5c538e,_0x14b40d['options']);return _0xf875b0[_0x433b('0x4b')](_0x5c538e);}})[_0x433b('0x20')](function(_0x401161){if(_0x401161){_0x4f2997=_0x401161[_0x433b('0x32')];if(!_0x14b40d['query'][_0x433b('0x33')](_0x433b('0x34'))){_0x5c538e[_0x433b('0x1b')]=qs[_0x433b('0x1b')](_0x14b40d[_0x433b('0x2c')][_0x433b('0x1b')]);_0x5c538e[_0x433b('0x19')]=qs[_0x433b('0x19')](_0x14b40d[_0x433b('0x2c')][_0x433b('0x19')]);}return _0xf875b0['getDescriptions'](_0x5c538e);}})[_0x433b('0x20')](function(_0x25257b){if(_0x25257b){return _0x25257b?{'count':_0x4f2997,'rows':_0x25257b}:null;}})['then'](respondWithResult(_0x4d6024,null))[_0x433b('0x3f')](handleError(_0x4d6024,null));};exports['getTags']=function(_0x4ecca0,_0x3cab60,_0x38da21){var _0x1e3468={};var _0x315c03={};var _0x15c35b;var _0x45c1f6;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4ecca0['params']['id']}})[_0x433b('0x20')](handleEntityNotFound(_0x3cab60,null))[_0x433b('0x20')](function(_0xa58eb0){if(_0xa58eb0){_0x15c35b=_0xa58eb0;_0x315c03[_0x433b('0x2f')]=_['keys'](db[_0x433b('0x4d')][_0x433b('0x29')]);_0x315c03[_0x433b('0x2c')]=_[_0x433b('0x2d')](_0x4ecca0[_0x433b('0x2c')]);_0x315c03[_0x433b('0x37')]=_['intersection'](_0x315c03[_0x433b('0x2f')],_0x315c03[_0x433b('0x2c')]);_0x1e3468['attributes']=_[_0x433b('0x2e')](_0x315c03[_0x433b('0x2f')],qs[_0x433b('0x30')](_0x4ecca0['query'][_0x433b('0x30')]));_0x1e3468[_0x433b('0x31')]=_0x1e3468[_0x433b('0x31')][_0x433b('0x32')]?_0x1e3468['attributes']:_0x315c03[_0x433b('0x2f')];_0x1e3468[_0x433b('0x35')]=qs[_0x433b('0x48')](_0x4ecca0[_0x433b('0x2c')][_0x433b('0x48')]);_0x1e3468[_0x433b('0x36')]=qs[_0x433b('0x37')](_[_0x433b('0x49')](_0x4ecca0[_0x433b('0x2c')],_0x315c03[_0x433b('0x37')]));if(_0x4ecca0[_0x433b('0x2c')][_0x433b('0x38')]){_0x1e3468[_0x433b('0x36')]=_['merge'](_0x1e3468[_0x433b('0x36')],{'$or':_['map'](_0x1e3468[_0x433b('0x31')],function(_0xe03b34){var _0x6cfb81={};_0x6cfb81[_0xe03b34]={'$like':'%'+_0x4ecca0[_0x433b('0x2c')][_0x433b('0x38')]+'%'};return _0x6cfb81;})});}_0x1e3468=_[_0x433b('0x39')]({},_0x1e3468,_0x4ecca0['options']);return _0x15c35b[_0x433b('0x4e')](_0x1e3468);}})[_0x433b('0x20')](function(_0x12b609){if(_0x12b609){_0x45c1f6=_0x12b609[_0x433b('0x32')];if(!_0x4ecca0['query'][_0x433b('0x33')](_0x433b('0x34'))){_0x1e3468['limit']=qs[_0x433b('0x1b')](_0x4ecca0['query'][_0x433b('0x1b')]);_0x1e3468[_0x433b('0x19')]=qs[_0x433b('0x19')](_0x4ecca0[_0x433b('0x2c')][_0x433b('0x19')]);}return _0x15c35b[_0x433b('0x4e')](_0x1e3468);}})[_0x433b('0x20')](function(_0x1caa99){if(_0x1caa99){return _0x1caa99?{'count':_0x45c1f6,'rows':_0x1caa99}:null;}})[_0x433b('0x20')](respondWithResult(_0x3cab60,null))[_0x433b('0x3f')](handleError(_0x3cab60,null));};exports[_0x433b('0x4f')]=function(_0x4536b1,_0x360a6d,_0x259c1e){if(_0x4536b1[_0x433b('0x45')]['id']){delete _0x4536b1[_0x433b('0x45')]['id'];}return db[_0x433b('0x28')][_0x433b('0x4c')]({'where':{'id':_0x4536b1[_0x433b('0x41')]['id']}})[_0x433b('0x20')](handleEntityNotFound(_0x360a6d,null))[_0x433b('0x20')](function(_0x555651){if(_0x555651){return _0x555651[_0x433b('0x4f')](_0x4536b1['body'][_0x433b('0x50')]||[]);}return null;})['then'](respondWithResult(_0x360a6d,null))['catch'](handleError(_0x360a6d,null));}; \ No newline at end of file +var _0xc4c4=['map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options','find','create','body','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','index'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0xc4c4,0xd0));var _0x4c4c=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0xc4c4[_0x1d80be];return _0xf9a4f3;};'use strict';var emlformat=require(_0x4c4c('0x0'));var rimraf=require(_0x4c4c('0x1'));var zipdir=require(_0x4c4c('0x2'));var jsonpatch=require(_0x4c4c('0x3'));var rp=require('request-promise');var moment=require(_0x4c4c('0x4'));var BPromise=require(_0x4c4c('0x5'));var Mustache=require('mustache');var util=require(_0x4c4c('0x6'));var path=require(_0x4c4c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4c4c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c4c('0x9'));var squel=require('squel');var crypto=require(_0x4c4c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4c4c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4c4c('0xc'));var Papa=require(_0x4c4c('0xd'));var Redis=require('ioredis');var authService=require(_0x4c4c('0xe'));var qs=require(_0x4c4c('0xf'));var as=require(_0x4c4c('0x10'));var hardwareService=require(_0x4c4c('0x11'));var logger=require(_0x4c4c('0x12'))(_0x4c4c('0x13'));var utils=require(_0x4c4c('0x14'));var config=require(_0x4c4c('0x15'));var licenseUtil=require(_0x4c4c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bd569,_0x2b4dcf){_0x2b4dcf=_0x2b4dcf||0xcc;return function(_0x10d67a){if(_0x10d67a){return _0x4bd569[_0x4c4c('0x17')](_0x2b4dcf);}return _0x4bd569[_0x4c4c('0x18')](_0x2b4dcf)[_0x4c4c('0x19')]();};}function respondWithResult(_0x41a8be,_0x5c72d6){_0x5c72d6=_0x5c72d6||0xc8;return function(_0x296298){if(_0x296298){return _0x41a8be[_0x4c4c('0x18')](_0x5c72d6)['json'](_0x296298);}};}function respondWithFilteredResult(_0x230b4c,_0x4d6d6d){return function(_0x4f9b5d){if(_0x4f9b5d){var _0x42ad76=typeof _0x4d6d6d[_0x4c4c('0x1a')]===_0x4c4c('0x1b')&&typeof _0x4d6d6d[_0x4c4c('0x1c')]===_0x4c4c('0x1b');var _0x2a69b0=_0x4f9b5d[_0x4c4c('0x1d')];var _0x3b2b82=_0x42ad76?0x0:_0x4d6d6d[_0x4c4c('0x1a')];var _0x5d6f3f=_0x42ad76?_0x4f9b5d[_0x4c4c('0x1d')]:_0x4d6d6d[_0x4c4c('0x1a')]+_0x4d6d6d[_0x4c4c('0x1c')];var _0x138c7b;if(_0x5d6f3f>=_0x2a69b0){_0x5d6f3f=_0x2a69b0;_0x138c7b=0xc8;}else{_0x138c7b=0xce;}_0x230b4c[_0x4c4c('0x18')](_0x138c7b);return _0x230b4c[_0x4c4c('0x1e')](_0x4c4c('0x1f'),_0x3b2b82+'-'+_0x5d6f3f+'/'+_0x2a69b0)[_0x4c4c('0x20')](_0x4f9b5d);}return null;};}function patchUpdates(_0x144ad4){return function(_0x44633b){try{jsonpatch['apply'](_0x44633b,_0x144ad4,!![]);}catch(_0x3d0d5d){return BPromise['reject'](_0x3d0d5d);}return _0x44633b['save']();};}function saveUpdates(_0x1d865e,_0x1d868b){return function(_0x566d7f){if(_0x566d7f){return _0x566d7f[_0x4c4c('0x21')](_0x1d865e)[_0x4c4c('0x22')](function(_0x5059df){return _0x5059df;});}return null;};}function removeEntity(_0x57f0c6,_0x36fc6a){return function(_0x43bd9f){if(_0x43bd9f){return _0x43bd9f[_0x4c4c('0x23')]()[_0x4c4c('0x22')](function(){_0x57f0c6[_0x4c4c('0x18')](0xcc)[_0x4c4c('0x19')]();});}};}function handleEntityNotFound(_0x545f38,_0x94b325){return function(_0x1f3723){if(!_0x1f3723){_0x545f38[_0x4c4c('0x17')](0x194);}return _0x1f3723;};}function handleError(_0x1a9255,_0x31c9f4){_0x31c9f4=_0x31c9f4||0x1f4;return function(_0x2f5f3e){logger[_0x4c4c('0x24')](_0x2f5f3e[_0x4c4c('0x25')]);if(_0x2f5f3e[_0x4c4c('0x26')]){delete _0x2f5f3e[_0x4c4c('0x26')];}_0x1a9255[_0x4c4c('0x18')](_0x31c9f4)[_0x4c4c('0x27')](_0x2f5f3e);};}exports[_0x4c4c('0x28')]=function(_0x5fa41f,_0x643028){var _0x197364={},_0x18553b={},_0x152a8c={'count':0x0,'rows':[]};var _0x322348=_[_0x4c4c('0x29')](db[_0x4c4c('0x2a')][_0x4c4c('0x2b')],function(_0x3c41bb){return{'name':_0x3c41bb[_0x4c4c('0x2c')],'type':_0x3c41bb[_0x4c4c('0x2d')][_0x4c4c('0x2e')]};});_0x18553b[_0x4c4c('0x2f')]=_[_0x4c4c('0x29')](_0x322348,_0x4c4c('0x26'));_0x18553b[_0x4c4c('0x30')]=_[_0x4c4c('0x31')](_0x5fa41f[_0x4c4c('0x30')]);_0x18553b[_0x4c4c('0x32')]=_['intersection'](_0x18553b[_0x4c4c('0x2f')],_0x18553b[_0x4c4c('0x30')]);_0x197364[_0x4c4c('0x33')]=_[_0x4c4c('0x34')](_0x18553b[_0x4c4c('0x2f')],qs[_0x4c4c('0x35')](_0x5fa41f['query'][_0x4c4c('0x35')]));_0x197364[_0x4c4c('0x33')]=_0x197364['attributes'][_0x4c4c('0x36')]?_0x197364['attributes']:_0x18553b[_0x4c4c('0x2f')];if(!_0x5fa41f['query']['hasOwnProperty'](_0x4c4c('0x37'))){_0x197364[_0x4c4c('0x1c')]=qs[_0x4c4c('0x1c')](_0x5fa41f['query']['limit']);_0x197364[_0x4c4c('0x1a')]=qs[_0x4c4c('0x1a')](_0x5fa41f[_0x4c4c('0x30')][_0x4c4c('0x1a')]);}_0x197364[_0x4c4c('0x38')]=qs[_0x4c4c('0x39')](_0x5fa41f[_0x4c4c('0x30')][_0x4c4c('0x39')]);_0x197364['where']=qs[_0x4c4c('0x32')](_[_0x4c4c('0x3a')](_0x5fa41f[_0x4c4c('0x30')],_0x18553b['filters']),_0x322348);if(_0x5fa41f['query'][_0x4c4c('0x3b')]){_0x197364[_0x4c4c('0x3c')]=_['merge'](_0x197364[_0x4c4c('0x3c')],{'$or':_[_0x4c4c('0x29')](_0x322348,function(_0x3533ff){if(_0x3533ff[_0x4c4c('0x2d')]!==_0x4c4c('0x3d')){var _0x1dae8b={};_0x1dae8b[_0x3533ff['name']]={'$like':'%'+_0x5fa41f[_0x4c4c('0x30')]['filter']+'%'};return _0x1dae8b;}})});}_0x197364=_[_0x4c4c('0x3e')]({},_0x197364,_0x5fa41f['options']);var _0x67bf74={'where':_0x197364['where']};return db['FreshdeskConfiguration']['count'](_0x67bf74)[_0x4c4c('0x22')](function(_0x33a332){_0x152a8c['count']=_0x33a332;if(_0x5fa41f[_0x4c4c('0x30')][_0x4c4c('0x3f')]){_0x197364[_0x4c4c('0x40')]=[{'all':!![]}];}return db[_0x4c4c('0x2a')]['findAll'](_0x197364);})[_0x4c4c('0x22')](function(_0x8dc62e){_0x152a8c[_0x4c4c('0x41')]=_0x8dc62e;return _0x152a8c;})[_0x4c4c('0x22')](respondWithFilteredResult(_0x643028,_0x197364))[_0x4c4c('0x42')](handleError(_0x643028,null));};exports[_0x4c4c('0x43')]=function(_0x1ad964,_0x17ad2e){var _0x2246db={'raw':![],'where':{'id':_0x1ad964[_0x4c4c('0x44')]['id']}},_0xd354a0={};_0xd354a0[_0x4c4c('0x2f')]=_[_0x4c4c('0x31')](db['FreshdeskConfiguration']['rawAttributes']);_0xd354a0['query']=_['keys'](_0x1ad964['query']);_0xd354a0[_0x4c4c('0x32')]=_[_0x4c4c('0x34')](_0xd354a0[_0x4c4c('0x2f')],_0xd354a0[_0x4c4c('0x30')]);_0x2246db[_0x4c4c('0x33')]=_['intersection'](_0xd354a0[_0x4c4c('0x2f')],qs[_0x4c4c('0x35')](_0x1ad964['query'][_0x4c4c('0x35')]));_0x2246db[_0x4c4c('0x33')]=_0x2246db[_0x4c4c('0x33')]['length']?_0x2246db[_0x4c4c('0x33')]:_0xd354a0[_0x4c4c('0x2f')];if(_0x1ad964[_0x4c4c('0x30')][_0x4c4c('0x3f')]){_0x2246db[_0x4c4c('0x40')]=[{'all':!![]}];}_0x2246db=_[_0x4c4c('0x3e')]({},_0x2246db,_0x1ad964[_0x4c4c('0x45')]);return db[_0x4c4c('0x2a')][_0x4c4c('0x46')](_0x2246db)[_0x4c4c('0x22')](handleEntityNotFound(_0x17ad2e,null))[_0x4c4c('0x22')](respondWithResult(_0x17ad2e,null))['catch'](handleError(_0x17ad2e,null));};exports[_0x4c4c('0x47')]=function(_0x3c762a,_0x39156e){return db['FreshdeskConfiguration'][_0x4c4c('0x47')](_0x3c762a['body'],{})[_0x4c4c('0x22')](respondWithResult(_0x39156e,0xc9))[_0x4c4c('0x42')](handleError(_0x39156e,null));};exports[_0x4c4c('0x21')]=function(_0x36bad3,_0x4d3421){if(_0x36bad3['body']['id']){delete _0x36bad3[_0x4c4c('0x48')]['id'];}return db[_0x4c4c('0x2a')][_0x4c4c('0x46')]({'where':{'id':_0x36bad3[_0x4c4c('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d3421,null))['then'](saveUpdates(_0x36bad3[_0x4c4c('0x48')],null))[_0x4c4c('0x22')](respondWithResult(_0x4d3421,null))[_0x4c4c('0x42')](handleError(_0x4d3421,null));};exports[_0x4c4c('0x23')]=function(_0x89fac5,_0x584ee7){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x89fac5[_0x4c4c('0x44')]['id']}})[_0x4c4c('0x22')](handleEntityNotFound(_0x584ee7,null))[_0x4c4c('0x22')](removeEntity(_0x584ee7,null))['catch'](handleError(_0x584ee7,null));};exports[_0x4c4c('0x49')]=function(_0x1e6424,_0x38e2a0,_0x3adac8){var _0x1fdfcb={};var _0x6221b0={};var _0x5081a7;var _0x3c221e;return db[_0x4c4c('0x2a')][_0x4c4c('0x4a')]({'where':{'id':_0x1e6424[_0x4c4c('0x44')]['id']}})['then'](handleEntityNotFound(_0x38e2a0,null))[_0x4c4c('0x22')](function(_0x3a086c){if(_0x3a086c){_0x5081a7=_0x3a086c;_0x6221b0[_0x4c4c('0x2f')]=_[_0x4c4c('0x31')](db[_0x4c4c('0x4b')][_0x4c4c('0x2b')]);_0x6221b0[_0x4c4c('0x30')]=_[_0x4c4c('0x31')](_0x1e6424['query']);_0x6221b0['filters']=_[_0x4c4c('0x34')](_0x6221b0[_0x4c4c('0x2f')],_0x6221b0[_0x4c4c('0x30')]);_0x1fdfcb[_0x4c4c('0x33')]=_['intersection'](_0x6221b0['model'],qs['fields'](_0x1e6424[_0x4c4c('0x30')][_0x4c4c('0x35')]));_0x1fdfcb[_0x4c4c('0x33')]=_0x1fdfcb[_0x4c4c('0x33')][_0x4c4c('0x36')]?_0x1fdfcb['attributes']:_0x6221b0[_0x4c4c('0x2f')];_0x1fdfcb[_0x4c4c('0x38')]=qs[_0x4c4c('0x39')](_0x1e6424[_0x4c4c('0x30')][_0x4c4c('0x39')]);_0x1fdfcb[_0x4c4c('0x3c')]=qs[_0x4c4c('0x32')](_[_0x4c4c('0x3a')](_0x1e6424['query'],_0x6221b0['filters']));if(_0x1e6424[_0x4c4c('0x30')][_0x4c4c('0x3b')]){_0x1fdfcb['where']=_[_0x4c4c('0x3e')](_0x1fdfcb['where'],{'$or':_[_0x4c4c('0x29')](_0x1fdfcb[_0x4c4c('0x33')],function(_0x6361aa){var _0x15440e={};_0x15440e[_0x6361aa]={'$like':'%'+_0x1e6424[_0x4c4c('0x30')][_0x4c4c('0x3b')]+'%'};return _0x15440e;})});}_0x1fdfcb=_[_0x4c4c('0x3e')]({},_0x1fdfcb,_0x1e6424['options']);return _0x5081a7[_0x4c4c('0x49')](_0x1fdfcb);}})['then'](function(_0x106cb5){if(_0x106cb5){_0x3c221e=_0x106cb5['length'];if(!_0x1e6424[_0x4c4c('0x30')][_0x4c4c('0x4c')](_0x4c4c('0x37'))){_0x1fdfcb[_0x4c4c('0x1c')]=qs[_0x4c4c('0x1c')](_0x1e6424[_0x4c4c('0x30')][_0x4c4c('0x1c')]);_0x1fdfcb[_0x4c4c('0x1a')]=qs[_0x4c4c('0x1a')](_0x1e6424[_0x4c4c('0x30')][_0x4c4c('0x1a')]);}return _0x5081a7[_0x4c4c('0x49')](_0x1fdfcb);}})[_0x4c4c('0x22')](function(_0x352db0){if(_0x352db0){return _0x352db0?{'count':_0x3c221e,'rows':_0x352db0}:null;}})['then'](respondWithResult(_0x38e2a0,null))[_0x4c4c('0x42')](handleError(_0x38e2a0,null));};exports[_0x4c4c('0x4d')]=function(_0x58425f,_0x5ba89f,_0x5dad62){var _0xc6c804={};var _0x239040={};var _0xcf57ad;var _0x306ca2;return db[_0x4c4c('0x2a')][_0x4c4c('0x4a')]({'where':{'id':_0x58425f['params']['id']}})[_0x4c4c('0x22')](handleEntityNotFound(_0x5ba89f,null))[_0x4c4c('0x22')](function(_0x17dd4c){if(_0x17dd4c){_0xcf57ad=_0x17dd4c;_0x239040[_0x4c4c('0x2f')]=_[_0x4c4c('0x31')](db[_0x4c4c('0x4b')][_0x4c4c('0x2b')]);_0x239040[_0x4c4c('0x30')]=_[_0x4c4c('0x31')](_0x58425f[_0x4c4c('0x30')]);_0x239040['filters']=_[_0x4c4c('0x34')](_0x239040[_0x4c4c('0x2f')],_0x239040[_0x4c4c('0x30')]);_0xc6c804[_0x4c4c('0x33')]=_[_0x4c4c('0x34')](_0x239040[_0x4c4c('0x2f')],qs[_0x4c4c('0x35')](_0x58425f[_0x4c4c('0x30')]['fields']));_0xc6c804[_0x4c4c('0x33')]=_0xc6c804['attributes'][_0x4c4c('0x36')]?_0xc6c804['attributes']:_0x239040[_0x4c4c('0x2f')];_0xc6c804[_0x4c4c('0x38')]=qs['sort'](_0x58425f[_0x4c4c('0x30')]['sort']);_0xc6c804[_0x4c4c('0x3c')]=qs[_0x4c4c('0x32')](_[_0x4c4c('0x3a')](_0x58425f[_0x4c4c('0x30')],_0x239040[_0x4c4c('0x32')]));if(_0x58425f[_0x4c4c('0x30')][_0x4c4c('0x3b')]){_0xc6c804['where']=_[_0x4c4c('0x3e')](_0xc6c804[_0x4c4c('0x3c')],{'$or':_[_0x4c4c('0x29')](_0xc6c804['attributes'],function(_0x2233dc){var _0x375981={};_0x375981[_0x2233dc]={'$like':'%'+_0x58425f[_0x4c4c('0x30')][_0x4c4c('0x3b')]+'%'};return _0x375981;})});}_0xc6c804=_[_0x4c4c('0x3e')]({},_0xc6c804,_0x58425f['options']);return _0xcf57ad[_0x4c4c('0x4d')](_0xc6c804);}})['then'](function(_0x921a7c){if(_0x921a7c){_0x306ca2=_0x921a7c[_0x4c4c('0x36')];if(!_0x58425f[_0x4c4c('0x30')][_0x4c4c('0x4c')](_0x4c4c('0x37'))){_0xc6c804[_0x4c4c('0x1c')]=qs[_0x4c4c('0x1c')](_0x58425f[_0x4c4c('0x30')][_0x4c4c('0x1c')]);_0xc6c804[_0x4c4c('0x1a')]=qs[_0x4c4c('0x1a')](_0x58425f[_0x4c4c('0x30')][_0x4c4c('0x1a')]);}return _0xcf57ad[_0x4c4c('0x4d')](_0xc6c804);}})[_0x4c4c('0x22')](function(_0x4b6ccc){if(_0x4b6ccc){return _0x4b6ccc?{'count':_0x306ca2,'rows':_0x4b6ccc}:null;}})['then'](respondWithResult(_0x5ba89f,null))[_0x4c4c('0x42')](handleError(_0x5ba89f,null));};exports[_0x4c4c('0x4e')]=function(_0x24c0d9,_0x687cb1,_0x59547f){var _0x2f1b39={};var _0x463498={};var _0x2d4215;var _0x2d828f;return db['FreshdeskConfiguration'][_0x4c4c('0x4a')]({'where':{'id':_0x24c0d9[_0x4c4c('0x44')]['id']}})[_0x4c4c('0x22')](handleEntityNotFound(_0x687cb1,null))['then'](function(_0x157d01){if(_0x157d01){_0x2d4215=_0x157d01;_0x463498[_0x4c4c('0x2f')]=_[_0x4c4c('0x31')](db[_0x4c4c('0x4b')][_0x4c4c('0x2b')]);_0x463498[_0x4c4c('0x30')]=_[_0x4c4c('0x31')](_0x24c0d9['query']);_0x463498[_0x4c4c('0x32')]=_['intersection'](_0x463498[_0x4c4c('0x2f')],_0x463498['query']);_0x2f1b39[_0x4c4c('0x33')]=_[_0x4c4c('0x34')](_0x463498[_0x4c4c('0x2f')],qs[_0x4c4c('0x35')](_0x24c0d9[_0x4c4c('0x30')][_0x4c4c('0x35')]));_0x2f1b39[_0x4c4c('0x33')]=_0x2f1b39[_0x4c4c('0x33')][_0x4c4c('0x36')]?_0x2f1b39[_0x4c4c('0x33')]:_0x463498[_0x4c4c('0x2f')];_0x2f1b39[_0x4c4c('0x38')]=qs[_0x4c4c('0x39')](_0x24c0d9[_0x4c4c('0x30')][_0x4c4c('0x39')]);_0x2f1b39[_0x4c4c('0x3c')]=qs[_0x4c4c('0x32')](_[_0x4c4c('0x3a')](_0x24c0d9[_0x4c4c('0x30')],_0x463498[_0x4c4c('0x32')]));if(_0x24c0d9[_0x4c4c('0x30')][_0x4c4c('0x3b')]){_0x2f1b39[_0x4c4c('0x3c')]=_[_0x4c4c('0x3e')](_0x2f1b39[_0x4c4c('0x3c')],{'$or':_[_0x4c4c('0x29')](_0x2f1b39[_0x4c4c('0x33')],function(_0x5b95fa){var _0x556daf={};_0x556daf[_0x5b95fa]={'$like':'%'+_0x24c0d9[_0x4c4c('0x30')][_0x4c4c('0x3b')]+'%'};return _0x556daf;})});}_0x2f1b39=_[_0x4c4c('0x3e')]({},_0x2f1b39,_0x24c0d9[_0x4c4c('0x45')]);return _0x2d4215[_0x4c4c('0x4e')](_0x2f1b39);}})['then'](function(_0x26170f){if(_0x26170f){_0x2d828f=_0x26170f[_0x4c4c('0x36')];if(!_0x24c0d9[_0x4c4c('0x30')][_0x4c4c('0x4c')](_0x4c4c('0x37'))){_0x2f1b39[_0x4c4c('0x1c')]=qs[_0x4c4c('0x1c')](_0x24c0d9[_0x4c4c('0x30')][_0x4c4c('0x1c')]);_0x2f1b39[_0x4c4c('0x1a')]=qs['offset'](_0x24c0d9[_0x4c4c('0x30')][_0x4c4c('0x1a')]);}return _0x2d4215[_0x4c4c('0x4e')](_0x2f1b39);}})['then'](function(_0x1de9ff){if(_0x1de9ff){return _0x1de9ff?{'count':_0x2d828f,'rows':_0x1de9ff}:null;}})[_0x4c4c('0x22')](respondWithResult(_0x687cb1,null))['catch'](handleError(_0x687cb1,null));};exports[_0x4c4c('0x4f')]=function(_0x54b9e7,_0x55a230,_0x33692e){var _0x59f43e={};var _0xa99511={};var _0x3c693c;var _0x420c54;return db[_0x4c4c('0x2a')][_0x4c4c('0x4a')]({'where':{'id':_0x54b9e7[_0x4c4c('0x44')]['id']}})[_0x4c4c('0x22')](handleEntityNotFound(_0x55a230,null))['then'](function(_0x67050e){if(_0x67050e){_0x3c693c=_0x67050e;_0xa99511['model']=_[_0x4c4c('0x31')](db[_0x4c4c('0x50')]['rawAttributes']);_0xa99511[_0x4c4c('0x30')]=_['keys'](_0x54b9e7[_0x4c4c('0x30')]);_0xa99511[_0x4c4c('0x32')]=_[_0x4c4c('0x34')](_0xa99511['model'],_0xa99511[_0x4c4c('0x30')]);_0x59f43e['attributes']=_['intersection'](_0xa99511[_0x4c4c('0x2f')],qs[_0x4c4c('0x35')](_0x54b9e7[_0x4c4c('0x30')][_0x4c4c('0x35')]));_0x59f43e['attributes']=_0x59f43e['attributes'][_0x4c4c('0x36')]?_0x59f43e[_0x4c4c('0x33')]:_0xa99511[_0x4c4c('0x2f')];_0x59f43e[_0x4c4c('0x38')]=qs[_0x4c4c('0x39')](_0x54b9e7['query'][_0x4c4c('0x39')]);_0x59f43e[_0x4c4c('0x3c')]=qs[_0x4c4c('0x32')](_[_0x4c4c('0x3a')](_0x54b9e7[_0x4c4c('0x30')],_0xa99511[_0x4c4c('0x32')]));if(_0x54b9e7[_0x4c4c('0x30')][_0x4c4c('0x3b')]){_0x59f43e[_0x4c4c('0x3c')]=_[_0x4c4c('0x3e')](_0x59f43e[_0x4c4c('0x3c')],{'$or':_[_0x4c4c('0x29')](_0x59f43e[_0x4c4c('0x33')],function(_0x2ee774){var _0x3545f2={};_0x3545f2[_0x2ee774]={'$like':'%'+_0x54b9e7[_0x4c4c('0x30')][_0x4c4c('0x3b')]+'%'};return _0x3545f2;})});}_0x59f43e=_[_0x4c4c('0x3e')]({},_0x59f43e,_0x54b9e7[_0x4c4c('0x45')]);return _0x3c693c['getTags'](_0x59f43e);}})[_0x4c4c('0x22')](function(_0x31930d){if(_0x31930d){_0x420c54=_0x31930d[_0x4c4c('0x36')];if(!_0x54b9e7[_0x4c4c('0x30')][_0x4c4c('0x4c')](_0x4c4c('0x37'))){_0x59f43e[_0x4c4c('0x1c')]=qs['limit'](_0x54b9e7[_0x4c4c('0x30')][_0x4c4c('0x1c')]);_0x59f43e['offset']=qs[_0x4c4c('0x1a')](_0x54b9e7[_0x4c4c('0x30')][_0x4c4c('0x1a')]);}return _0x3c693c[_0x4c4c('0x4f')](_0x59f43e);}})[_0x4c4c('0x22')](function(_0x5ce98d){if(_0x5ce98d){return _0x5ce98d?{'count':_0x420c54,'rows':_0x5ce98d}:null;}})['then'](respondWithResult(_0x55a230,null))[_0x4c4c('0x42')](handleError(_0x55a230,null));};exports['setTags']=function(_0x43d588,_0x10af12,_0x1498a1){if(_0x43d588[_0x4c4c('0x48')]['id']){delete _0x43d588[_0x4c4c('0x48')]['id'];}return db[_0x4c4c('0x2a')][_0x4c4c('0x4a')]({'where':{'id':_0x43d588[_0x4c4c('0x44')]['id']}})[_0x4c4c('0x22')](handleEntityNotFound(_0x10af12,null))['then'](function(_0x561006){if(_0x561006){return _0x561006[_0x4c4c('0x51')](_0x43d588[_0x4c4c('0x48')][_0x4c4c('0x52')]||[]);}return null;})[_0x4c4c('0x22')](respondWithResult(_0x10af12,null))[_0x4c4c('0x42')](handleError(_0x10af12,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 9a7c75c..621e4af 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4e8=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xd4e8,0x1ec));var _0x8d4e=function(_0x37f6d8,_0x444925){_0x37f6d8=_0x37f6d8-0x0;var _0x49f67b=_0xd4e8[_0x37f6d8];return _0x49f67b;};'use strict';var _=require(_0x8d4e('0x0'));var util=require(_0x8d4e('0x1'));var logger=require(_0x8d4e('0x2'))(_0x8d4e('0x3'));var moment=require(_0x8d4e('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d4e('0x5'));var fs=require('fs');var path=require(_0x8d4e('0x6'));var rimraf=require(_0x8d4e('0x7'));var config=require(_0x8d4e('0x8'));var attributes=require(_0x8d4e('0x9'));module[_0x8d4e('0xa')]=function(_0x28956a,_0x31fc75){return _0x28956a[_0x8d4e('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0x8d4e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61f6=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x591d44,_0x2b43a3){var _0x41dd26=function(_0x4c91ee){while(--_0x4c91ee){_0x591d44['push'](_0x591d44['shift']());}};_0x41dd26(++_0x2b43a3);}(_0x61f6,0x119));var _0x661f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x61f6[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x661f('0x0'));var util=require(_0x661f('0x1'));var logger=require(_0x661f('0x2'))(_0x661f('0x3'));var moment=require('moment');var BPromise=require(_0x661f('0x4'));var rp=require(_0x661f('0x5'));var fs=require('fs');var path=require(_0x661f('0x6'));var rimraf=require('rimraf');var config=require(_0x661f('0x7'));var attributes=require(_0x661f('0x8'));module[_0x661f('0x9')]=function(_0x4811da,_0x85b061){return _0x4811da[_0x661f('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x661f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index ad0f064..0d9c338 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfef7=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x3e1226,_0x4199d6){var _0x1ff634=function(_0x4dbed0){while(--_0x4dbed0){_0x3e1226['push'](_0x3e1226['shift']());}};_0x1ff634(++_0x4199d6);}(_0xfef7,0x132));var _0x7fef=function(_0x1877ab,_0xdbf29b){_0x1877ab=_0x1877ab-0x0;var _0x1c3465=_0xfef7[_0x1877ab];return _0x1c3465;};'use strict';var _=require(_0x7fef('0x0'));var util=require(_0x7fef('0x1'));var moment=require(_0x7fef('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fef('0x3'));var db=require(_0x7fef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fef('0x5'))(_0x7fef('0x6'));var config=require(_0x7fef('0x7'));var jayson=require(_0x7fef('0x8'));var client=jayson[_0x7fef('0x9')][_0x7fef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bcf8f,_0x4aa708,_0x3f131c){return new BPromise(function(_0x31f4e7,_0x3a53b4){return client[_0x7fef('0xb')](_0x1bcf8f,_0x3f131c)[_0x7fef('0xc')](function(_0x32a42b){logger[_0x7fef('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4aa708,'request\x20sent');logger[_0x7fef('0xe')](_0x7fef('0xf'),_0x4aa708,_0x7fef('0x10'),JSON[_0x7fef('0x11')](_0x32a42b));if(_0x32a42b[_0x7fef('0x12')]){if(_0x32a42b['error'][_0x7fef('0x13')]===0x1f4){logger[_0x7fef('0x12')](_0x7fef('0x14'),_0x4aa708,_0x32a42b[_0x7fef('0x12')]['message']);return _0x3a53b4(_0x32a42b[_0x7fef('0x12')][_0x7fef('0x15')]);}logger[_0x7fef('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4aa708,_0x32a42b[_0x7fef('0x12')]['message']);return _0x31f4e7(_0x32a42b[_0x7fef('0x12')]['message']);}else{logger['info'](_0x7fef('0x14'),_0x4aa708,_0x7fef('0x10'));_0x31f4e7(_0x32a42b[_0x7fef('0x16')]['message']);}})[_0x7fef('0x17')](function(_0x3a40ba){logger[_0x7fef('0x12')](_0x7fef('0x14'),_0x4aa708,_0x3a40ba);_0x3a53b4(_0x3a40ba);});});} \ No newline at end of file +var _0xda26=['randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x572b5a,_0x56b877){var _0x1af519=function(_0x1ade42){while(--_0x1ade42){_0x572b5a['push'](_0x572b5a['shift']());}};_0x1af519(++_0x56b877);}(_0xda26,0x16c));var _0x6da2=function(_0x2ce0bf,_0x3dd6af){_0x2ce0bf=_0x2ce0bf-0x0;var _0x1e71b8=_0xda26[_0x2ce0bf];return _0x1e71b8;};'use strict';var _=require(_0x6da2('0x0'));var util=require(_0x6da2('0x1'));var moment=require(_0x6da2('0x2'));var BPromise=require(_0x6da2('0x3'));var rs=require(_0x6da2('0x4'));var fs=require('fs');var Redis=require(_0x6da2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6da2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6da2('0x7'));var jayson=require(_0x6da2('0x8'));var client=jayson[_0x6da2('0x9')][_0x6da2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1889b5,_0x4c9d63,_0x2ab4de){return new BPromise(function(_0x2a0ff2,_0x1a40a5){return client['request'](_0x1889b5,_0x2ab4de)[_0x6da2('0xb')](function(_0x40afbd){logger['info'](_0x6da2('0xc'),_0x4c9d63,_0x6da2('0xd'));logger[_0x6da2('0xe')](_0x6da2('0xf'),_0x4c9d63,_0x6da2('0xd'),JSON[_0x6da2('0x10')](_0x40afbd));if(_0x40afbd[_0x6da2('0x11')]){if(_0x40afbd[_0x6da2('0x11')][_0x6da2('0x12')]===0x1f4){logger['error'](_0x6da2('0xc'),_0x4c9d63,_0x40afbd[_0x6da2('0x11')][_0x6da2('0x13')]);return _0x1a40a5(_0x40afbd[_0x6da2('0x11')][_0x6da2('0x13')]);}logger[_0x6da2('0x11')](_0x6da2('0xc'),_0x4c9d63,_0x40afbd[_0x6da2('0x11')][_0x6da2('0x13')]);return _0x2a0ff2(_0x40afbd['error']['message']);}else{logger[_0x6da2('0x14')](_0x6da2('0xc'),_0x4c9d63,'request\x20sent');_0x2a0ff2(_0x40afbd[_0x6da2('0x15')][_0x6da2('0x13')]);}})[_0x6da2('0x16')](function(_0x4e2da6){logger[_0x6da2('0x11')](_0x6da2('0xc'),_0x4c9d63,_0x4e2da6);_0x1a40a5(_0x4e2da6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index cbf6148..7e8f57b 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3fd=['./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xbac1ec,_0x2f59dc){var _0x1d5ce9=function(_0x18c604){while(--_0x18c604){_0xbac1ec['push'](_0xbac1ec['shift']());}};_0x1d5ce9(++_0x2f59dc);}(_0xc3fd,0x175));var _0xdc3f=function(_0x2b9c7b,_0x54ec53){_0x2b9c7b=_0x2b9c7b-0x0;var _0x2a874a=_0xc3fd[_0x2b9c7b];return _0x2a874a;};'use strict';var multer=require(_0xdc3f('0x0'));var util=require(_0xdc3f('0x1'));var path=require(_0xdc3f('0x2'));var timeout=require(_0xdc3f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdc3f('0x4'));var auth=require(_0xdc3f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc3f('0x6'));var controller=require(_0xdc3f('0x7'));router['get']('/',auth[_0xdc3f('0x8')](),controller[_0xdc3f('0x9')]);router[_0xdc3f('0xa')](_0xdc3f('0xb'),auth['isAuthenticated'](),controller[_0xdc3f('0xc')]);router[_0xdc3f('0xd')]('/',auth[_0xdc3f('0x8')](),controller[_0xdc3f('0xe')]);router['put'](_0xdc3f('0xb'),auth[_0xdc3f('0x8')](),controller[_0xdc3f('0xf')]);router[_0xdc3f('0x10')](_0xdc3f('0xb'),auth[_0xdc3f('0x8')](),controller[_0xdc3f('0x11')]);module[_0xdc3f('0x12')]=router; \ No newline at end of file +var _0x924e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','put','/:id','delete','destroy','util','path'];(function(_0x5b407e,_0x1777c9){var _0x39c4ca=function(_0x2c20f4){while(--_0x2c20f4){_0x5b407e['push'](_0x5b407e['shift']());}};_0x39c4ca(++_0x1777c9);}(_0x924e,0xbe));var _0xe924=function(_0x104112,_0x342eb6){_0x104112=_0x104112-0x0;var _0x394ab4=_0x924e[_0x104112];return _0x394ab4;};'use strict';var multer=require('multer');var util=require(_0xe924('0x0'));var path=require(_0xe924('0x1'));var timeout=require(_0xe924('0x2'));var express=require(_0xe924('0x3'));var router=express[_0xe924('0x4')]();var fs_extra=require(_0xe924('0x5'));var auth=require(_0xe924('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe924('0x7'));router[_0xe924('0x8')]('/',auth[_0xe924('0x9')](),controller[_0xe924('0xa')]);router[_0xe924('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe924('0xb')]);router['post']('/',auth[_0xe924('0x9')](),controller['create']);router[_0xe924('0xc')](_0xe924('0xd'),auth[_0xe924('0x9')](),controller['update']);router[_0xe924('0xe')]('/:id',auth[_0xe924('0x9')](),controller[_0xe924('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index c076a19..fa4d437 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.attributes.js +++ b/server/api/intFreshdeskField/intFreshdeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0eb4=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0x0eb4,0xa7));var _0x40eb=function(_0x5ecc8b,_0xfeea30){_0x5ecc8b=_0x5ecc8b-0x0;var _0x3f6600=_0x0eb4[_0x5ecc8b];return _0x3f6600;};'use strict';var Sequelize=require(_0x40eb('0x0'));module['exports']={'type':{'type':Sequelize[_0x40eb('0x1')](_0x40eb('0x2'),_0x40eb('0x3'),'customVariable',_0x40eb('0x4'),_0x40eb('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x40eb('0x6')]},'key':{'type':Sequelize[_0x40eb('0x6')]},'keyType':{'type':Sequelize[_0x40eb('0x1')](_0x40eb('0x2'),'variable',_0x40eb('0x7'))},'keyContent':{'type':Sequelize[_0x40eb('0x6')]},'idField':{'type':Sequelize[_0x40eb('0x6')]},'nameField':{'type':Sequelize[_0x40eb('0x6')]},'customField':{'type':Sequelize[_0x40eb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x40eb('0x6')]}}; \ No newline at end of file +var _0x22e7=['STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','string'];(function(_0x4ac32f,_0x99d209){var _0x2ba3d0=function(_0x323db1){while(--_0x323db1){_0x4ac32f['push'](_0x4ac32f['shift']());}};_0x2ba3d0(++_0x99d209);}(_0x22e7,0x150));var _0x722e=function(_0x1b85ee,_0x96717c){_0x1b85ee=_0x1b85ee-0x0;var _0x5bc5d3=_0x22e7[_0x1b85ee];return _0x5bc5d3;};'use strict';var Sequelize=require(_0x722e('0x0'));module[_0x722e('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x722e('0x2'),_0x722e('0x3'),_0x722e('0x4'),'picklist'),'defaultValue':_0x722e('0x5')},'content':{'type':Sequelize[_0x722e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x722e('0x7')](_0x722e('0x5'),_0x722e('0x2'),_0x722e('0x3'))},'keyContent':{'type':Sequelize[_0x722e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x722e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 3f79860..5d03bf0 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.controller.js +++ b/server/api/intFreshdeskField/intFreshdeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd404=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x401b33,_0xf98e3e){var _0x1feb90=function(_0x4bf573){while(--_0x4bf573){_0x401b33['push'](_0x401b33['shift']());}};_0x1feb90(++_0xf98e3e);}(_0xd404,0x15b));var _0x4d40=function(_0x15522f,_0x5547aa){_0x15522f=_0x15522f-0x0;var _0x430e9b=_0xd404[_0x15522f];return _0x430e9b;};'use strict';var emlformat=require(_0x4d40('0x0'));var rimraf=require(_0x4d40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d40('0x2'));var rp=require(_0x4d40('0x3'));var moment=require('moment');var BPromise=require(_0x4d40('0x4'));var Mustache=require(_0x4d40('0x5'));var util=require(_0x4d40('0x6'));var path=require(_0x4d40('0x7'));var sox=require(_0x4d40('0x8'));var csv=require(_0x4d40('0x9'));var ejs=require(_0x4d40('0xa'));var fs=require('fs');var fs_extra=require(_0x4d40('0xb'));var _=require(_0x4d40('0xc'));var squel=require('squel');var crypto=require(_0x4d40('0xd'));var jsforce=require(_0x4d40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d40('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d40('0xf'));var authService=require(_0x4d40('0x10'));var qs=require(_0x4d40('0x11'));var as=require(_0x4d40('0x12'));var hardwareService=require(_0x4d40('0x13'));var logger=require(_0x4d40('0x14'))(_0x4d40('0x15'));var utils=require(_0x4d40('0x16'));var config=require(_0x4d40('0x17'));var licenseUtil=require(_0x4d40('0x18'));var db=require(_0x4d40('0x19'))['db'];function respondWithStatusCode(_0x3c3b7e,_0x28e5bf){_0x28e5bf=_0x28e5bf||0xcc;return function(_0x42a621){if(_0x42a621){return _0x3c3b7e['sendStatus'](_0x28e5bf);}return _0x3c3b7e[_0x4d40('0x1a')](_0x28e5bf)[_0x4d40('0x1b')]();};}function respondWithResult(_0x3b071b,_0x2083bd){_0x2083bd=_0x2083bd||0xc8;return function(_0x477a91){if(_0x477a91){return _0x3b071b['status'](_0x2083bd)[_0x4d40('0x1c')](_0x477a91);}};}function respondWithFilteredResult(_0x4077ce,_0x20bc1b){return function(_0xcee25a){if(_0xcee25a){var _0x453857=typeof _0x20bc1b[_0x4d40('0x1d')]===_0x4d40('0x1e')&&typeof _0x20bc1b[_0x4d40('0x1f')]===_0x4d40('0x1e');var _0x4b5d23=_0xcee25a['count'];var _0x1ae5c7=_0x453857?0x0:_0x20bc1b[_0x4d40('0x1d')];var _0x4e505f=_0x453857?_0xcee25a[_0x4d40('0x20')]:_0x20bc1b[_0x4d40('0x1d')]+_0x20bc1b['limit'];var _0x36d031;if(_0x4e505f>=_0x4b5d23){_0x4e505f=_0x4b5d23;_0x36d031=0xc8;}else{_0x36d031=0xce;}_0x4077ce['status'](_0x36d031);return _0x4077ce[_0x4d40('0x21')](_0x4d40('0x22'),_0x1ae5c7+'-'+_0x4e505f+'/'+_0x4b5d23)['json'](_0xcee25a);}return null;};}function patchUpdates(_0x57c997){return function(_0x375ce0){try{jsonpatch[_0x4d40('0x23')](_0x375ce0,_0x57c997,!![]);}catch(_0x4d52ce){return BPromise[_0x4d40('0x24')](_0x4d52ce);}return _0x375ce0[_0x4d40('0x25')]();};}function saveUpdates(_0x30f058,_0x5d4c24){return function(_0x356fd6){if(_0x356fd6){return _0x356fd6[_0x4d40('0x26')](_0x30f058)[_0x4d40('0x27')](function(_0x5ca0a0){return _0x5ca0a0;});}return null;};}function removeEntity(_0x4eebc3,_0x2df33a){return function(_0x90b652){if(_0x90b652){return _0x90b652[_0x4d40('0x28')]()[_0x4d40('0x27')](function(){_0x4eebc3[_0x4d40('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbcd540,_0x1f5e5b){return function(_0x560df8){if(!_0x560df8){_0xbcd540['sendStatus'](0x194);}return _0x560df8;};}function handleError(_0x274d44,_0x2a0c82){_0x2a0c82=_0x2a0c82||0x1f4;return function(_0x3fa83e){logger[_0x4d40('0x29')](_0x3fa83e[_0x4d40('0x2a')]);if(_0x3fa83e[_0x4d40('0x2b')]){delete _0x3fa83e[_0x4d40('0x2b')];}_0x274d44[_0x4d40('0x1a')](_0x2a0c82)[_0x4d40('0x2c')](_0x3fa83e);};}exports[_0x4d40('0x2d')]=function(_0x1c0fcf,_0x4ca431){var _0x4e4e61={},_0x52f706={},_0x158a86={'count':0x0,'rows':[]};var _0x350488=_[_0x4d40('0x2e')](db[_0x4d40('0x2f')]['rawAttributes'],function(_0x18e601){return{'name':_0x18e601[_0x4d40('0x30')],'type':_0x18e601[_0x4d40('0x31')]['key']};});_0x52f706[_0x4d40('0x32')]=_[_0x4d40('0x2e')](_0x350488,_0x4d40('0x2b'));_0x52f706[_0x4d40('0x33')]=_[_0x4d40('0x34')](_0x1c0fcf['query']);_0x52f706[_0x4d40('0x35')]=_['intersection'](_0x52f706[_0x4d40('0x32')],_0x52f706[_0x4d40('0x33')]);_0x4e4e61[_0x4d40('0x36')]=_[_0x4d40('0x37')](_0x52f706['model'],qs['fields'](_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x38')]));_0x4e4e61[_0x4d40('0x36')]=_0x4e4e61[_0x4d40('0x36')]['length']?_0x4e4e61[_0x4d40('0x36')]:_0x52f706['model'];if(!_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x39')](_0x4d40('0x3a'))){_0x4e4e61[_0x4d40('0x1f')]=qs[_0x4d40('0x1f')](_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x1f')]);_0x4e4e61[_0x4d40('0x1d')]=qs[_0x4d40('0x1d')](_0x1c0fcf[_0x4d40('0x33')]['offset']);}_0x4e4e61[_0x4d40('0x3b')]=qs[_0x4d40('0x3c')](_0x1c0fcf['query']['sort']);_0x4e4e61['where']=qs[_0x4d40('0x35')](_[_0x4d40('0x3d')](_0x1c0fcf['query'],_0x52f706[_0x4d40('0x35')]),_0x350488);if(_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x3e')]){_0x4e4e61[_0x4d40('0x3f')]=_[_0x4d40('0x40')](_0x4e4e61['where'],{'$or':_[_0x4d40('0x2e')](_0x350488,function(_0x21a4ec){if(_0x21a4ec['type']!=='VIRTUAL'){var _0x3a4924={};_0x3a4924[_0x21a4ec[_0x4d40('0x2b')]]={'$like':'%'+_0x1c0fcf['query'][_0x4d40('0x3e')]+'%'};return _0x3a4924;}})});}_0x4e4e61=_[_0x4d40('0x40')]({},_0x4e4e61,_0x1c0fcf['options']);var _0x1e8427={'where':_0x4e4e61[_0x4d40('0x3f')]};return db['FreshdeskField'][_0x4d40('0x20')](_0x1e8427)[_0x4d40('0x27')](function(_0x4841ac){_0x158a86[_0x4d40('0x20')]=_0x4841ac;if(_0x1c0fcf['query'][_0x4d40('0x41')]){_0x4e4e61[_0x4d40('0x42')]=[{'all':!![]}];}return db[_0x4d40('0x2f')][_0x4d40('0x43')](_0x4e4e61);})[_0x4d40('0x27')](function(_0x2ef0ca){_0x158a86[_0x4d40('0x44')]=_0x2ef0ca;return _0x158a86;})[_0x4d40('0x27')](respondWithFilteredResult(_0x4ca431,_0x4e4e61))[_0x4d40('0x45')](handleError(_0x4ca431,null));};exports['show']=function(_0x250847,_0x3718a8){var _0x1c2fa8={'raw':!![],'where':{'id':_0x250847[_0x4d40('0x46')]['id']}},_0xcdde22={};_0xcdde22['model']=_[_0x4d40('0x34')](db['FreshdeskField'][_0x4d40('0x47')]);_0xcdde22[_0x4d40('0x33')]=_[_0x4d40('0x34')](_0x250847[_0x4d40('0x33')]);_0xcdde22['filters']=_[_0x4d40('0x37')](_0xcdde22[_0x4d40('0x32')],_0xcdde22['query']);_0x1c2fa8[_0x4d40('0x36')]=_['intersection'](_0xcdde22[_0x4d40('0x32')],qs[_0x4d40('0x38')](_0x250847[_0x4d40('0x33')][_0x4d40('0x38')]));_0x1c2fa8['attributes']=_0x1c2fa8[_0x4d40('0x36')]['length']?_0x1c2fa8[_0x4d40('0x36')]:_0xcdde22[_0x4d40('0x32')];if(_0x250847[_0x4d40('0x33')][_0x4d40('0x41')]){_0x1c2fa8['include']=[{'all':!![]}];}_0x1c2fa8=_[_0x4d40('0x40')]({},_0x1c2fa8,_0x250847[_0x4d40('0x48')]);return db[_0x4d40('0x2f')][_0x4d40('0x49')](_0x1c2fa8)['then'](handleEntityNotFound(_0x3718a8,null))[_0x4d40('0x27')](respondWithResult(_0x3718a8,null))[_0x4d40('0x45')](handleError(_0x3718a8,null));};exports['create']=function(_0x200d29,_0x493d8e){return db[_0x4d40('0x2f')][_0x4d40('0x4a')](_0x200d29[_0x4d40('0x4b')],{})[_0x4d40('0x27')](respondWithResult(_0x493d8e,0xc9))[_0x4d40('0x45')](handleError(_0x493d8e,null));};exports[_0x4d40('0x26')]=function(_0x30be7b,_0x37b6bf){if(_0x30be7b[_0x4d40('0x4b')]['id']){delete _0x30be7b['body']['id'];}return db[_0x4d40('0x2f')][_0x4d40('0x49')]({'where':{'id':_0x30be7b[_0x4d40('0x46')]['id']}})[_0x4d40('0x27')](handleEntityNotFound(_0x37b6bf,null))[_0x4d40('0x27')](saveUpdates(_0x30be7b['body'],null))[_0x4d40('0x27')](respondWithResult(_0x37b6bf,null))[_0x4d40('0x45')](handleError(_0x37b6bf,null));};exports['destroy']=function(_0xdf0235,_0x48ffd7){return db[_0x4d40('0x2f')][_0x4d40('0x49')]({'where':{'id':_0xdf0235[_0x4d40('0x46')]['id']}})['then'](handleEntityNotFound(_0x48ffd7,null))[_0x4d40('0x27')](removeEntity(_0x48ffd7,null))[_0x4d40('0x45')](handleError(_0x48ffd7,null));}; \ No newline at end of file +var _0xf290=['body','update','destroy','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','error','send','index','map','rawAttributes','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','name','filter','FreshdeskField','includeAll','findAll','catch','show','params','include','options','find','create'];(function(_0x2f5ce7,_0x319a62){var _0x1297bc=function(_0x226a11){while(--_0x226a11){_0x2f5ce7['push'](_0x2f5ce7['shift']());}};_0x1297bc(++_0x319a62);}(_0xf290,0xde));var _0x0f29=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xf290[_0x2f3794];return _0x1c9fbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f29('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f29('0x1'));var rp=require('request-promise');var moment=require(_0x0f29('0x2'));var BPromise=require(_0x0f29('0x3'));var Mustache=require(_0x0f29('0x4'));var util=require(_0x0f29('0x5'));var path=require(_0x0f29('0x6'));var sox=require('sox');var csv=require(_0x0f29('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f29('0x8'));var _=require(_0x0f29('0x9'));var squel=require(_0x0f29('0xa'));var crypto=require(_0x0f29('0xb'));var jsforce=require(_0x0f29('0xc'));var deskjs=require(_0x0f29('0xd'));var toCsv=require(_0x0f29('0x7'));var querystring=require(_0x0f29('0xe'));var Papa=require(_0x0f29('0xf'));var Redis=require(_0x0f29('0x10'));var authService=require(_0x0f29('0x11'));var qs=require(_0x0f29('0x12'));var as=require(_0x0f29('0x13'));var hardwareService=require(_0x0f29('0x14'));var logger=require(_0x0f29('0x15'))('api');var utils=require(_0x0f29('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0f29('0x17'));var db=require(_0x0f29('0x18'))['db'];function respondWithStatusCode(_0x26bbec,_0x222c42){_0x222c42=_0x222c42||0xcc;return function(_0x195424){if(_0x195424){return _0x26bbec[_0x0f29('0x19')](_0x222c42);}return _0x26bbec['status'](_0x222c42)[_0x0f29('0x1a')]();};}function respondWithResult(_0x39961f,_0x2bb7b8){_0x2bb7b8=_0x2bb7b8||0xc8;return function(_0x368984){if(_0x368984){return _0x39961f[_0x0f29('0x1b')](_0x2bb7b8)[_0x0f29('0x1c')](_0x368984);}};}function respondWithFilteredResult(_0x1c518,_0x69df36){return function(_0x547404){if(_0x547404){var _0x4ac37d=typeof _0x69df36[_0x0f29('0x1d')]===_0x0f29('0x1e')&&typeof _0x69df36[_0x0f29('0x1f')]===_0x0f29('0x1e');var _0x4b3f0b=_0x547404[_0x0f29('0x20')];var _0x5d72a5=_0x4ac37d?0x0:_0x69df36[_0x0f29('0x1d')];var _0x4ca5e8=_0x4ac37d?_0x547404['count']:_0x69df36['offset']+_0x69df36[_0x0f29('0x1f')];var _0x8fc03f;if(_0x4ca5e8>=_0x4b3f0b){_0x4ca5e8=_0x4b3f0b;_0x8fc03f=0xc8;}else{_0x8fc03f=0xce;}_0x1c518[_0x0f29('0x1b')](_0x8fc03f);return _0x1c518[_0x0f29('0x21')](_0x0f29('0x22'),_0x5d72a5+'-'+_0x4ca5e8+'/'+_0x4b3f0b)[_0x0f29('0x1c')](_0x547404);}return null;};}function patchUpdates(_0x150271){return function(_0x4888b6){try{jsonpatch[_0x0f29('0x23')](_0x4888b6,_0x150271,!![]);}catch(_0x5a5a03){return BPromise['reject'](_0x5a5a03);}return _0x4888b6['save']();};}function saveUpdates(_0x5d94b9,_0x38a1ce){return function(_0x4a9dd8){if(_0x4a9dd8){return _0x4a9dd8['update'](_0x5d94b9)[_0x0f29('0x24')](function(_0x1840e0){return _0x1840e0;});}return null;};}function removeEntity(_0x346db8,_0x3402dc){return function(_0x29ca73){if(_0x29ca73){return _0x29ca73['destroy']()[_0x0f29('0x24')](function(){_0x346db8['status'](0xcc)[_0x0f29('0x1a')]();});}};}function handleEntityNotFound(_0x26f46f,_0x23c09e){return function(_0x28cfaa){if(!_0x28cfaa){_0x26f46f['sendStatus'](0x194);}return _0x28cfaa;};}function handleError(_0x13a2c7,_0x540d72){_0x540d72=_0x540d72||0x1f4;return function(_0x58b201){logger[_0x0f29('0x25')](_0x58b201['stack']);if(_0x58b201['name']){delete _0x58b201['name'];}_0x13a2c7['status'](_0x540d72)[_0x0f29('0x26')](_0x58b201);};}exports[_0x0f29('0x27')]=function(_0x4cc5a0,_0x1fc4fd){var _0x2ab528={},_0x274c9d={},_0x51e7dc={'count':0x0,'rows':[]};var _0x56e729=_[_0x0f29('0x28')](db['FreshdeskField'][_0x0f29('0x29')],function(_0x561c31){return{'name':_0x561c31['fieldName'],'type':_0x561c31[_0x0f29('0x2a')][_0x0f29('0x2b')]};});_0x274c9d[_0x0f29('0x2c')]=_[_0x0f29('0x28')](_0x56e729,'name');_0x274c9d['query']=_[_0x0f29('0x2d')](_0x4cc5a0['query']);_0x274c9d['filters']=_[_0x0f29('0x2e')](_0x274c9d['model'],_0x274c9d[_0x0f29('0x2f')]);_0x2ab528['attributes']=_['intersection'](_0x274c9d[_0x0f29('0x2c')],qs[_0x0f29('0x30')](_0x4cc5a0[_0x0f29('0x2f')][_0x0f29('0x30')]));_0x2ab528[_0x0f29('0x31')]=_0x2ab528['attributes'][_0x0f29('0x32')]?_0x2ab528['attributes']:_0x274c9d[_0x0f29('0x2c')];if(!_0x4cc5a0[_0x0f29('0x2f')][_0x0f29('0x33')](_0x0f29('0x34'))){_0x2ab528['limit']=qs[_0x0f29('0x1f')](_0x4cc5a0[_0x0f29('0x2f')]['limit']);_0x2ab528[_0x0f29('0x1d')]=qs[_0x0f29('0x1d')](_0x4cc5a0['query']['offset']);}_0x2ab528[_0x0f29('0x35')]=qs[_0x0f29('0x36')](_0x4cc5a0[_0x0f29('0x2f')][_0x0f29('0x36')]);_0x2ab528[_0x0f29('0x37')]=qs[_0x0f29('0x38')](_['pick'](_0x4cc5a0[_0x0f29('0x2f')],_0x274c9d['filters']),_0x56e729);if(_0x4cc5a0[_0x0f29('0x2f')]['filter']){_0x2ab528[_0x0f29('0x37')]=_[_0x0f29('0x39')](_0x2ab528[_0x0f29('0x37')],{'$or':_['map'](_0x56e729,function(_0x5f0d26){if(_0x5f0d26[_0x0f29('0x2a')]!=='VIRTUAL'){var _0x312c07={};_0x312c07[_0x5f0d26[_0x0f29('0x3a')]]={'$like':'%'+_0x4cc5a0[_0x0f29('0x2f')][_0x0f29('0x3b')]+'%'};return _0x312c07;}})});}_0x2ab528=_[_0x0f29('0x39')]({},_0x2ab528,_0x4cc5a0['options']);var _0x13c05c={'where':_0x2ab528[_0x0f29('0x37')]};return db[_0x0f29('0x3c')][_0x0f29('0x20')](_0x13c05c)[_0x0f29('0x24')](function(_0x4043d9){_0x51e7dc[_0x0f29('0x20')]=_0x4043d9;if(_0x4cc5a0[_0x0f29('0x2f')][_0x0f29('0x3d')]){_0x2ab528['include']=[{'all':!![]}];}return db[_0x0f29('0x3c')][_0x0f29('0x3e')](_0x2ab528);})[_0x0f29('0x24')](function(_0x11b1dc){_0x51e7dc['rows']=_0x11b1dc;return _0x51e7dc;})[_0x0f29('0x24')](respondWithFilteredResult(_0x1fc4fd,_0x2ab528))[_0x0f29('0x3f')](handleError(_0x1fc4fd,null));};exports[_0x0f29('0x40')]=function(_0x5c2282,_0x185493){var _0x56062d={'raw':!![],'where':{'id':_0x5c2282[_0x0f29('0x41')]['id']}},_0x410c59={};_0x410c59[_0x0f29('0x2c')]=_['keys'](db[_0x0f29('0x3c')][_0x0f29('0x29')]);_0x410c59[_0x0f29('0x2f')]=_[_0x0f29('0x2d')](_0x5c2282[_0x0f29('0x2f')]);_0x410c59[_0x0f29('0x38')]=_[_0x0f29('0x2e')](_0x410c59[_0x0f29('0x2c')],_0x410c59['query']);_0x56062d['attributes']=_['intersection'](_0x410c59[_0x0f29('0x2c')],qs[_0x0f29('0x30')](_0x5c2282[_0x0f29('0x2f')][_0x0f29('0x30')]));_0x56062d[_0x0f29('0x31')]=_0x56062d[_0x0f29('0x31')]['length']?_0x56062d[_0x0f29('0x31')]:_0x410c59['model'];if(_0x5c2282[_0x0f29('0x2f')]['includeAll']){_0x56062d[_0x0f29('0x42')]=[{'all':!![]}];}_0x56062d=_[_0x0f29('0x39')]({},_0x56062d,_0x5c2282[_0x0f29('0x43')]);return db[_0x0f29('0x3c')][_0x0f29('0x44')](_0x56062d)['then'](handleEntityNotFound(_0x185493,null))[_0x0f29('0x24')](respondWithResult(_0x185493,null))[_0x0f29('0x3f')](handleError(_0x185493,null));};exports[_0x0f29('0x45')]=function(_0x5a05b6,_0x14b747){return db['FreshdeskField']['create'](_0x5a05b6[_0x0f29('0x46')],{})[_0x0f29('0x24')](respondWithResult(_0x14b747,0xc9))[_0x0f29('0x3f')](handleError(_0x14b747,null));};exports[_0x0f29('0x47')]=function(_0x20aa53,_0x335435){if(_0x20aa53['body']['id']){delete _0x20aa53[_0x0f29('0x46')]['id'];}return db[_0x0f29('0x3c')][_0x0f29('0x44')]({'where':{'id':_0x20aa53[_0x0f29('0x41')]['id']}})[_0x0f29('0x24')](handleEntityNotFound(_0x335435,null))[_0x0f29('0x24')](saveUpdates(_0x20aa53[_0x0f29('0x46')],null))[_0x0f29('0x24')](respondWithResult(_0x335435,null))[_0x0f29('0x3f')](handleError(_0x335435,null));};exports[_0x0f29('0x48')]=function(_0x5cd4a9,_0x5e4479){return db[_0x0f29('0x3c')][_0x0f29('0x44')]({'where':{'id':_0x5cd4a9[_0x0f29('0x41')]['id']}})[_0x0f29('0x24')](handleEntityNotFound(_0x5e4479,null))['then'](removeEntity(_0x5e4479,null))[_0x0f29('0x3f')](handleError(_0x5e4479,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a49a6d6..152557d 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.model.js +++ b/server/api/intFreshdeskField/intFreshdeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb67d=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb67d,0x1ef));var _0xdb67=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb67d[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xdb67('0x0'));var util=require(_0xdb67('0x1'));var logger=require(_0xdb67('0x2'))(_0xdb67('0x3'));var moment=require(_0xdb67('0x4'));var BPromise=require(_0xdb67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb67('0x6'));var rimraf=require(_0xdb67('0x7'));var config=require(_0xdb67('0x8'));var attributes=require(_0xdb67('0x9'));module[_0xdb67('0xa')]=function(_0x166334,_0x5761f7){return _0x166334[_0xdb67('0xb')](_0xdb67('0xc'),attributes,{'tableName':_0xdb67('0xd'),'paranoid':![],'indexes':[{'name':_0xdb67('0xe'),'fields':[_0xdb67('0xf'),_0xdb67('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54f3=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x1fcc72,_0x191471){var _0x77731c=function(_0x36c407){while(--_0x36c407){_0x1fcc72['push'](_0x1fcc72['shift']());}};_0x77731c(++_0x191471);}(_0x54f3,0x120));var _0x354f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x54f3[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var logger=require(_0x354f('0x1'))(_0x354f('0x2'));var moment=require(_0x354f('0x3'));var BPromise=require(_0x354f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x354f('0x5'));var config=require(_0x354f('0x6'));var attributes=require(_0x354f('0x7'));module['exports']=function(_0x5618ac,_0x234ac6){return _0x5618ac['define'](_0x354f('0x8'),attributes,{'tableName':_0x354f('0x9'),'paranoid':![],'indexes':[{'name':_0x354f('0xa'),'fields':[_0x354f('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 49a874f..899d59d 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bd8=['FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','debug'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x5bd8,0x1ce));var _0x85bd=function(_0x1ae6b3,_0x3290bb){_0x1ae6b3=_0x1ae6b3-0x0;var _0x311586=_0x5bd8[_0x1ae6b3];return _0x311586;};'use strict';var _=require(_0x85bd('0x0'));var util=require(_0x85bd('0x1'));var moment=require(_0x85bd('0x2'));var BPromise=require(_0x85bd('0x3'));var rs=require(_0x85bd('0x4'));var fs=require('fs');var Redis=require(_0x85bd('0x5'));var db=require(_0x85bd('0x6'))['db'];var utils=require(_0x85bd('0x7'));var logger=require(_0x85bd('0x8'))(_0x85bd('0x9'));var config=require(_0x85bd('0xa'));var jayson=require(_0x85bd('0xb'));var client=jayson[_0x85bd('0xc')][_0x85bd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1e498a,_0x511eab,_0x2f64cc){return new BPromise(function(_0x2856e3,_0x13980e){return client[_0x85bd('0xe')](_0x1e498a,_0x2f64cc)['then'](function(_0x58d3e0){logger[_0x85bd('0xf')](_0x85bd('0x10'),_0x511eab,'request\x20sent');logger[_0x85bd('0x11')](_0x85bd('0x12'),_0x511eab,_0x85bd('0x13'),JSON[_0x85bd('0x14')](_0x58d3e0));if(_0x58d3e0[_0x85bd('0x15')]){if(_0x58d3e0[_0x85bd('0x15')][_0x85bd('0x16')]===0x1f4){logger['error'](_0x85bd('0x10'),_0x511eab,_0x58d3e0[_0x85bd('0x15')]['message']);return _0x13980e(_0x58d3e0['error'][_0x85bd('0x17')]);}logger[_0x85bd('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x511eab,_0x58d3e0['error'][_0x85bd('0x17')]);return _0x2856e3(_0x58d3e0['error'][_0x85bd('0x17')]);}else{logger[_0x85bd('0xf')](_0x85bd('0x10'),_0x511eab,_0x85bd('0x13'));_0x2856e3(_0x58d3e0['result'][_0x85bd('0x17')]);}})['catch'](function(_0x48255d){logger['error'](_0x85bd('0x10'),_0x511eab,_0x48255d);_0x13980e(_0x48255d);});});} \ No newline at end of file +var _0x1632=['../../config/utils','../../config/logger','rpc','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x1632,0x8e));var _0x2163=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1632[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2163('0x0'));var util=require(_0x2163('0x1'));var moment=require(_0x2163('0x2'));var BPromise=require(_0x2163('0x3'));var rs=require(_0x2163('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2163('0x5'));var logger=require(_0x2163('0x6'))(_0x2163('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2163('0x8')][_0x2163('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x210738,_0x24981c,_0x3bcb76){return new BPromise(function(_0x42c0dd,_0x3d8c85){return client[_0x2163('0xa')](_0x210738,_0x3bcb76)['then'](function(_0x2cfd22){logger[_0x2163('0xb')](_0x2163('0xc'),_0x24981c,_0x2163('0xd'));logger[_0x2163('0xe')](_0x2163('0xf'),_0x24981c,_0x2163('0xd'),JSON[_0x2163('0x10')](_0x2cfd22));if(_0x2cfd22[_0x2163('0x11')]){if(_0x2cfd22[_0x2163('0x11')][_0x2163('0x12')]===0x1f4){logger[_0x2163('0x11')](_0x2163('0xc'),_0x24981c,_0x2cfd22[_0x2163('0x11')][_0x2163('0x13')]);return _0x3d8c85(_0x2cfd22[_0x2163('0x11')]['message']);}logger[_0x2163('0x11')](_0x2163('0xc'),_0x24981c,_0x2cfd22[_0x2163('0x11')][_0x2163('0x13')]);return _0x42c0dd(_0x2cfd22['error'][_0x2163('0x13')]);}else{logger['info'](_0x2163('0xc'),_0x24981c,_0x2163('0xd'));_0x42c0dd(_0x2cfd22[_0x2163('0x14')][_0x2163('0x13')]);}})['catch'](function(_0x2837a0){logger[_0x2163('0x11')](_0x2163('0xc'),_0x24981c,_0x2837a0);_0x3d8c85(_0x2837a0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9243f8c..b963904 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path'];(function(_0x123cf0,_0x5ba204){var _0x321056=function(_0x3f505c){while(--_0x3f505c){_0x123cf0['push'](_0x123cf0['shift']());}};_0x321056(++_0x5ba204);}(_0x4fc2,0x111));var _0x24fc=function(_0x2a8ca3,_0x2626d7){_0x2a8ca3=_0x2a8ca3-0x0;var _0x2add49=_0x4fc2[_0x2a8ca3];return _0x2add49;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getConfigurations']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0x11')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router[_0x24fc('0x11')]('/:id/configurations',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller['destroy']);module[_0x24fc('0x16')]=router; \ No newline at end of file +var _0x5ec6=['exports','multer','util','path','express','fs-extra','../../components/interaction/service','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x5ec6,0x7f));var _0x65ec=function(_0x2544db,_0x570d3f){_0x2544db=_0x2544db-0x0;var _0x21421a=_0x5ec6[_0x2544db];return _0x21421a;};'use strict';var multer=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var path=require(_0x65ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x65ec('0x3'));var router=express['Router']();var fs_extra=require(_0x65ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x65ec('0x5'));var config=require('../../config/environment');var controller=require(_0x65ec('0x6'));router['get']('/',auth[_0x65ec('0x7')](),controller[_0x65ec('0x8')]);router['get'](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller['show']);router[_0x65ec('0xa')](_0x65ec('0xb'),auth[_0x65ec('0x7')](),controller['getConfigurations']);router['get'](_0x65ec('0xc'),auth['isAuthenticated'](),controller[_0x65ec('0xd')]);router[_0x65ec('0xe')]('/',auth['isAuthenticated'](),controller[_0x65ec('0xf')]);router[_0x65ec('0xe')]('/:id/configurations',auth[_0x65ec('0x7')](),controller[_0x65ec('0x10')]);router['put'](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller[_0x65ec('0x11')]);router[_0x65ec('0x12')](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller[_0x65ec('0x13')]);module[_0x65ec('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 94436d4..8f09e93 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93e9=['sequelize','exports','STRING','username'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x93e9,0xcc));var _0x993e=function(_0xac6e69,_0x40c113){_0xac6e69=_0xac6e69-0x0;var _0x3dfe58=_0x93e9[_0xac6e69];return _0x3dfe58;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'name':{'type':Sequelize[_0x993e('0x2')]},'description':{'type':Sequelize[_0x993e('0x2')]},'username':{'type':Sequelize[_0x993e('0x2')],'unique':_0x993e('0x3')},'apiKey':{'type':Sequelize[_0x993e('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x993e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x896e=['exports','STRING','username','remoteUri','sequelize'];(function(_0xddfe05,_0x57b987){var _0x42b95e=function(_0x30699b){while(--_0x30699b){_0xddfe05['push'](_0xddfe05['shift']());}};_0x42b95e(++_0x57b987);}(_0x896e,0x1e9));var _0xe896=function(_0x671c14,_0x3328f9){_0x671c14=_0x671c14-0x0;var _0x5513e7=_0x896e[_0x671c14];return _0x5513e7;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'name':{'type':Sequelize[_0xe896('0x2')]},'description':{'type':Sequelize[_0xe896('0x2')]},'username':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x3')},'apiKey':{'type':Sequelize[_0xe896('0x2')]},'remoteUri':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x4')},'serverUrl':{'type':Sequelize[_0xe896('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index efe8b66..b80b195 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbaa=['includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','getConfigurations','sort','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','FreshsalesConfiguration','FreshsalesField','Subjects','Descriptions','getFields','findOne','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options'];(function(_0x294726,_0x5db9e9){var _0x39e2e3=function(_0x50041d){while(--_0x50041d){_0x294726['push'](_0x294726['shift']());}};_0x39e2e3(++_0x5db9e9);}(_0xfbaa,0x100));var _0xafba=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0xfbaa[_0x186d17];return _0x5d4b89;};'use strict';var emlformat=require(_0xafba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xafba('0x1'));var jsonpatch=require(_0xafba('0x2'));var rp=require(_0xafba('0x3'));var moment=require('moment');var BPromise=require(_0xafba('0x4'));var Mustache=require(_0xafba('0x5'));var util=require(_0xafba('0x6'));var path=require(_0xafba('0x7'));var sox=require(_0xafba('0x8'));var csv=require(_0xafba('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xafba('0xa'));var crypto=require(_0xafba('0xb'));var jsforce=require(_0xafba('0xc'));var deskjs=require(_0xafba('0xd'));var toCsv=require(_0xafba('0x9'));var querystring=require('querystring');var Papa=require(_0xafba('0xe'));var Redis=require('ioredis');var authService=require(_0xafba('0xf'));var qs=require(_0xafba('0x10'));var as=require(_0xafba('0x11'));var hardwareService=require(_0xafba('0x12'));var logger=require('../../config/logger')(_0xafba('0x13'));var utils=require(_0xafba('0x14'));var config=require(_0xafba('0x15'));var licenseUtil=require(_0xafba('0x16'));var db=require(_0xafba('0x17'))['db'];var integrations=require(_0xafba('0x18'));function respondWithStatusCode(_0x11faff,_0x4bc68f){_0x4bc68f=_0x4bc68f||0xcc;return function(_0x497247){if(_0x497247){return _0x11faff[_0xafba('0x19')](_0x4bc68f);}return _0x11faff[_0xafba('0x1a')](_0x4bc68f)[_0xafba('0x1b')]();};}function respondWithResult(_0x3da04e,_0x5c08e0){_0x5c08e0=_0x5c08e0||0xc8;return function(_0x5685c5){if(_0x5685c5){return _0x3da04e[_0xafba('0x1a')](_0x5c08e0)[_0xafba('0x1c')](_0x5685c5);}};}function respondWithFilteredResult(_0x44cdc5,_0x18f29e){return function(_0xf68dd){if(_0xf68dd){var _0x1e5473=typeof _0x18f29e[_0xafba('0x1d')]===_0xafba('0x1e')&&typeof _0x18f29e[_0xafba('0x1f')]==='undefined';var _0x1dce91=_0xf68dd[_0xafba('0x20')];var _0xdbb7b2=_0x1e5473?0x0:_0x18f29e[_0xafba('0x1d')];var _0x386c92=_0x1e5473?_0xf68dd['count']:_0x18f29e['offset']+_0x18f29e[_0xafba('0x1f')];var _0x1c1e89;if(_0x386c92>=_0x1dce91){_0x386c92=_0x1dce91;_0x1c1e89=0xc8;}else{_0x1c1e89=0xce;}_0x44cdc5[_0xafba('0x1a')](_0x1c1e89);return _0x44cdc5[_0xafba('0x21')](_0xafba('0x22'),_0xdbb7b2+'-'+_0x386c92+'/'+_0x1dce91)[_0xafba('0x1c')](_0xf68dd);}return null;};}function patchUpdates(_0x1ab8e2){return function(_0x4df634){try{jsonpatch[_0xafba('0x23')](_0x4df634,_0x1ab8e2,!![]);}catch(_0x3542ae){return BPromise['reject'](_0x3542ae);}return _0x4df634[_0xafba('0x24')]();};}function saveUpdates(_0x3a2a93,_0x1fd960){return function(_0x26730e){if(_0x26730e){return _0x26730e[_0xafba('0x25')](_0x3a2a93)[_0xafba('0x26')](function(_0x36e087){return _0x36e087;});}return null;};}function removeEntity(_0x4c0c15,_0x1a0e8b){return function(_0x43d48a){if(_0x43d48a){return _0x43d48a['destroy']()[_0xafba('0x26')](function(){_0x4c0c15['status'](0xcc)[_0xafba('0x1b')]();});}};}function handleEntityNotFound(_0x1650ff,_0x12a8ac){return function(_0x5dd220){if(!_0x5dd220){_0x1650ff[_0xafba('0x19')](0x194);}return _0x5dd220;};}function handleError(_0x29bde5,_0x19c255){_0x19c255=_0x19c255||0x1f4;return function(_0x511e1c){logger[_0xafba('0x27')](_0x511e1c[_0xafba('0x28')]);if(_0x511e1c[_0xafba('0x29')]){delete _0x511e1c[_0xafba('0x29')];}_0x29bde5[_0xafba('0x1a')](_0x19c255)['send'](_0x511e1c);};}exports[_0xafba('0x2a')]=function(_0x5eef98,_0x13a68a){var _0xc98f85={},_0x27a139={},_0x5cd6ff={'count':0x0,'rows':[]};var _0x5bb1d9=_[_0xafba('0x2b')](db[_0xafba('0x2c')][_0xafba('0x2d')],function(_0x70da2d){return{'name':_0x70da2d[_0xafba('0x2e')],'type':_0x70da2d['type'][_0xafba('0x2f')]};});_0x27a139['model']=_[_0xafba('0x2b')](_0x5bb1d9,_0xafba('0x29'));_0x27a139[_0xafba('0x30')]=_[_0xafba('0x31')](_0x5eef98[_0xafba('0x30')]);_0x27a139['filters']=_[_0xafba('0x32')](_0x27a139[_0xafba('0x33')],_0x27a139[_0xafba('0x30')]);_0xc98f85[_0xafba('0x34')]=_[_0xafba('0x32')](_0x27a139[_0xafba('0x33')],qs[_0xafba('0x35')](_0x5eef98['query'][_0xafba('0x35')]));_0xc98f85[_0xafba('0x34')]=_0xc98f85[_0xafba('0x34')][_0xafba('0x36')]?_0xc98f85['attributes']:_0x27a139[_0xafba('0x33')];if(!_0x5eef98['query']['hasOwnProperty'](_0xafba('0x37'))){_0xc98f85['limit']=qs[_0xafba('0x1f')](_0x5eef98['query'][_0xafba('0x1f')]);_0xc98f85[_0xafba('0x1d')]=qs['offset'](_0x5eef98[_0xafba('0x30')][_0xafba('0x1d')]);}_0xc98f85[_0xafba('0x38')]=qs['sort'](_0x5eef98[_0xafba('0x30')]['sort']);_0xc98f85[_0xafba('0x39')]=qs[_0xafba('0x3a')](_[_0xafba('0x3b')](_0x5eef98[_0xafba('0x30')],_0x27a139[_0xafba('0x3a')]),_0x5bb1d9);if(_0x5eef98['query'][_0xafba('0x3c')]){_0xc98f85[_0xafba('0x39')]=_[_0xafba('0x3d')](_0xc98f85['where'],{'$or':_[_0xafba('0x2b')](_0x5bb1d9,function(_0xd8597e){if(_0xd8597e[_0xafba('0x3e')]!==_0xafba('0x3f')){var _0x2363c5={};_0x2363c5[_0xd8597e[_0xafba('0x29')]]={'$like':'%'+_0x5eef98[_0xafba('0x30')][_0xafba('0x3c')]+'%'};return _0x2363c5;}})});}_0xc98f85=_[_0xafba('0x3d')]({},_0xc98f85,_0x5eef98[_0xafba('0x40')]);var _0x3a3b6e={'where':_0xc98f85['where']};return db['FreshsalesAccount'][_0xafba('0x20')](_0x3a3b6e)[_0xafba('0x26')](function(_0x18fa92){_0x5cd6ff['count']=_0x18fa92;if(_0x5eef98[_0xafba('0x30')][_0xafba('0x41')]){_0xc98f85[_0xafba('0x42')]=[{'all':!![]}];}return db[_0xafba('0x2c')][_0xafba('0x43')](_0xc98f85);})[_0xafba('0x26')](function(_0x2c1a5f){_0x5cd6ff[_0xafba('0x44')]=_0x2c1a5f;return _0x5cd6ff;})[_0xafba('0x26')](respondWithFilteredResult(_0x13a68a,_0xc98f85))[_0xafba('0x45')](handleError(_0x13a68a,null));};exports[_0xafba('0x46')]=function(_0x2c1554,_0x5719bf){var _0x527df5={'raw':![],'where':{'id':_0x2c1554[_0xafba('0x47')]['id']}},_0x307039={};_0x307039[_0xafba('0x33')]=_[_0xafba('0x31')](db[_0xafba('0x2c')][_0xafba('0x2d')]);_0x307039[_0xafba('0x30')]=_[_0xafba('0x31')](_0x2c1554[_0xafba('0x30')]);_0x307039['filters']=_[_0xafba('0x32')](_0x307039['model'],_0x307039['query']);_0x527df5[_0xafba('0x34')]=_[_0xafba('0x32')](_0x307039[_0xafba('0x33')],qs[_0xafba('0x35')](_0x2c1554['query'][_0xafba('0x35')]));_0x527df5[_0xafba('0x34')]=_0x527df5[_0xafba('0x34')][_0xafba('0x36')]?_0x527df5[_0xafba('0x34')]:_0x307039['model'];if(_0x2c1554[_0xafba('0x30')][_0xafba('0x41')]){_0x527df5['include']=[{'all':!![]}];}_0x527df5=_[_0xafba('0x3d')]({},_0x527df5,_0x2c1554['options']);return db[_0xafba('0x2c')]['find'](_0x527df5)[_0xafba('0x26')](handleEntityNotFound(_0x5719bf,null))[_0xafba('0x26')](respondWithResult(_0x5719bf,null))['catch'](handleError(_0x5719bf,null));};exports['create']=function(_0x1ca411,_0x22728b){return db[_0xafba('0x2c')][_0xafba('0x48')](_0x1ca411[_0xafba('0x49')],{})['then'](respondWithResult(_0x22728b,0xc9))[_0xafba('0x45')](handleError(_0x22728b,null));};exports[_0xafba('0x25')]=function(_0x5c8c6c,_0x526a59){if(_0x5c8c6c[_0xafba('0x49')]['id']){delete _0x5c8c6c[_0xafba('0x49')]['id'];}return db[_0xafba('0x2c')][_0xafba('0x4a')]({'where':{'id':_0x5c8c6c[_0xafba('0x47')]['id']}})[_0xafba('0x26')](handleEntityNotFound(_0x526a59,null))[_0xafba('0x26')](saveUpdates(_0x5c8c6c['body'],null))[_0xafba('0x26')](respondWithResult(_0x526a59,null))[_0xafba('0x45')](handleError(_0x526a59,null));};exports[_0xafba('0x4b')]=function(_0x1f8634,_0x23edd2){return db['FreshsalesAccount'][_0xafba('0x4a')]({'where':{'id':_0x1f8634['params']['id']}})[_0xafba('0x26')](handleEntityNotFound(_0x23edd2,null))[_0xafba('0x26')](removeEntity(_0x23edd2,null))[_0xafba('0x45')](handleError(_0x23edd2,null));};exports[_0xafba('0x4c')]=function(_0x4fdee3,_0x13cb6d,_0x4eed73){var _0x215357={};var _0x27c834={};var _0x35718c;var _0x3821a2;return db[_0xafba('0x2c')]['findOne']({'where':{'id':_0x4fdee3[_0xafba('0x47')]['id']}})[_0xafba('0x26')](handleEntityNotFound(_0x13cb6d,null))[_0xafba('0x26')](function(_0x1970f1){if(_0x1970f1){_0x35718c=_0x1970f1;_0x27c834[_0xafba('0x33')]=_[_0xafba('0x31')](db['FreshsalesConfiguration'][_0xafba('0x2d')]);_0x27c834[_0xafba('0x30')]=_[_0xafba('0x31')](_0x4fdee3[_0xafba('0x30')]);_0x27c834['filters']=_[_0xafba('0x32')](_0x27c834[_0xafba('0x33')],_0x27c834['query']);_0x215357['attributes']=_[_0xafba('0x32')](_0x27c834[_0xafba('0x33')],qs[_0xafba('0x35')](_0x4fdee3[_0xafba('0x30')][_0xafba('0x35')]));_0x215357[_0xafba('0x34')]=_0x215357[_0xafba('0x34')]['length']?_0x215357[_0xafba('0x34')]:_0x27c834[_0xafba('0x33')];_0x215357[_0xafba('0x38')]=qs[_0xafba('0x4d')](_0x4fdee3[_0xafba('0x30')][_0xafba('0x4d')]);_0x215357[_0xafba('0x39')]=qs[_0xafba('0x3a')](_[_0xafba('0x3b')](_0x4fdee3[_0xafba('0x30')],_0x27c834[_0xafba('0x3a')]));if(_0x4fdee3['query'][_0xafba('0x3c')]){_0x215357[_0xafba('0x39')]=_[_0xafba('0x3d')](_0x215357['where'],{'$or':_['map'](_0x215357[_0xafba('0x34')],function(_0x402037){var _0x366c49={};_0x366c49[_0x402037]={'$like':'%'+_0x4fdee3[_0xafba('0x30')][_0xafba('0x3c')]+'%'};return _0x366c49;})});}_0x215357=_[_0xafba('0x3d')]({},_0x215357,_0x4fdee3[_0xafba('0x40')]);return _0x35718c['getConfigurations'](_0x215357);}})[_0xafba('0x26')](function(_0x47b47e){if(_0x47b47e){_0x3821a2=_0x47b47e['length'];if(!_0x4fdee3[_0xafba('0x30')][_0xafba('0x4e')](_0xafba('0x37'))){_0x215357[_0xafba('0x1f')]=qs[_0xafba('0x1f')](_0x4fdee3['query'][_0xafba('0x1f')]);_0x215357[_0xafba('0x1d')]=qs[_0xafba('0x1d')](_0x4fdee3[_0xafba('0x30')][_0xafba('0x1d')]);}return _0x35718c['getConfigurations'](_0x215357);}})[_0xafba('0x26')](function(_0x29b9a5){if(_0x29b9a5){return _0x29b9a5?{'count':_0x3821a2,'rows':_0x29b9a5}:null;}})[_0xafba('0x26')](respondWithResult(_0x13cb6d,null))[_0xafba('0x45')](handleError(_0x13cb6d,null));};exports[_0xafba('0x4f')]=function(_0x19316a,_0x57dca7,_0x11a6c5){if(_0x19316a[_0xafba('0x49')]['id']){delete _0x19316a[_0xafba('0x49')]['id'];}return db[_0xafba('0x2c')]['findOne']({'where':{'id':_0x19316a['params']['id']}})[_0xafba('0x26')](handleEntityNotFound(_0x57dca7,null))[_0xafba('0x26')](function(_0x2fc4b6){if(_0x2fc4b6){_0x19316a[_0xafba('0x49')][_0xafba('0x50')]=_0x2fc4b6['id'];_0x19316a[_0xafba('0x49')]['Subjects']=integrations[_0xafba('0x51')](_0x19316a[_0xafba('0x49')][_0xafba('0x52')],_0x19316a[_0xafba('0x49')][_0xafba('0x3e')]);_0x19316a[_0xafba('0x49')]['Descriptions']=integrations['getDescriptions'](_0x19316a[_0xafba('0x49')]['channel'],_0x19316a[_0xafba('0x49')][_0xafba('0x3e')]);return db[_0xafba('0x53')][_0xafba('0x48')](_0x19316a[_0xafba('0x49')],{'include':[{'model':db[_0xafba('0x54')],'as':_0xafba('0x55')},{'model':db[_0xafba('0x54')],'as':_0xafba('0x56')}]});}return null;})[_0xafba('0x26')](respondWithResult(_0x57dca7,null))['catch'](handleError(_0x57dca7,null));};exports[_0xafba('0x57')]=function(_0x2b1198,_0x53edf3,_0x4845be){var _0x54d996='';var _0x5acab4='';return db[_0xafba('0x2c')][_0xafba('0x58')]({'where':{'id':_0x2b1198[_0xafba('0x47')]['id']},'attributes':['id',_0xafba('0x59'),_0xafba('0x5a'),_0xafba('0x5b')]})[_0xafba('0x26')](handleEntityNotFound(_0x53edf3,null))[_0xafba('0x26')](function(_0x22040f){if(_0x22040f){_0x5acab4=_0x22040f[_0xafba('0x59')];_0x54d996=_0x22040f[_0xafba('0x5a')];var _0x4482bc=_0x22040f[_0xafba('0x5a')]['slice'](-0x1);if(_0x4482bc==='/'){_0x54d996=_0x54d996[_0xafba('0x5c')](0x0,_0x54d996[_0xafba('0x5d')](_0x4482bc));}return rp({'method':_0xafba('0x5e'),'uri':util[_0xafba('0x5f')](_0xafba('0x60'),_0x54d996,_0xafba('0x61')),'headers':{'Authorization':_0xafba('0x62')+_0x22040f['apiKey']},'json':!![]});}})[_0xafba('0x26')](function(_0x284dfc){if(_0x284dfc){var _0x34af80=_0x284dfc['users'];var _0x27eac8=![];var _0xdf5237=null;for(_0xdf5237=0x0;_0xdf5237<_0x34af80['length'];_0xdf5237++){if(_0x34af80[_0xdf5237][_0xafba('0x63')]===_0x5acab4){_0x27eac8=!![];}}if(_0x27eac8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xafba('0x64')});}}})[_0xafba('0x26')](respondWithResult(_0x53edf3,null))[_0xafba('0x45')](function(_0x3a9968){var _0x5c2e89=_0x2b1198[_0xafba('0x30')][_0xafba('0x65')]?0x1f4:_0x3a9968['statusCode']||0x1f4;logger[_0xafba('0x27')](_0xafba('0x66'),_0xafba('0x57'),_0x5c2e89,JSON[_0xafba('0x67')](_0x3a9968));delete _0x3a9968['name'];if(_0x5c2e89===0x191){_0x5c2e89=0x190;}_0x53edf3[_0xafba('0x1a')](_0x5c2e89)[_0xafba('0x68')](_0x2b1198[_0xafba('0x30')]['test']?{'message':_0xafba('0x69'),'statusCode':_0x3a9968[_0xafba('0x6a')]}:_0x3a9968);});}; \ No newline at end of file +var _0x5e1d=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','getConfigurations','findOne','pick','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshsalesConfiguration','Subjects','FreshsalesField','getFields','username','remoteUri','slice','lastIndexOf','format','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x37881d,_0x3e53db){var _0x397633=function(_0x4a84d3){while(--_0x4a84d3){_0x37881d['push'](_0x37881d['shift']());}};_0x397633(++_0x3e53db);}(_0x5e1d,0xc8));var _0xd5e1=function(_0x2fcadf,_0x401da6){_0x2fcadf=_0x2fcadf-0x0;var _0x2a2c05=_0x5e1d[_0x2fcadf];return _0x2a2c05;};'use strict';var emlformat=require(_0xd5e1('0x0'));var rimraf=require(_0xd5e1('0x1'));var zipdir=require(_0xd5e1('0x2'));var jsonpatch=require(_0xd5e1('0x3'));var rp=require(_0xd5e1('0x4'));var moment=require(_0xd5e1('0x5'));var BPromise=require(_0xd5e1('0x6'));var Mustache=require('mustache');var util=require(_0xd5e1('0x7'));var path=require(_0xd5e1('0x8'));var sox=require(_0xd5e1('0x9'));var csv=require(_0xd5e1('0xa'));var ejs=require(_0xd5e1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd5e1('0xc'));var crypto=require(_0xd5e1('0xd'));var jsforce=require(_0xd5e1('0xe'));var deskjs=require(_0xd5e1('0xf'));var toCsv=require(_0xd5e1('0xa'));var querystring=require(_0xd5e1('0x10'));var Papa=require(_0xd5e1('0x11'));var Redis=require('ioredis');var authService=require(_0xd5e1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd5e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5e1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd5e1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd5e1('0x16'))['db'];var integrations=require(_0xd5e1('0x17'));function respondWithStatusCode(_0x5839b3,_0x173a0e){_0x173a0e=_0x173a0e||0xcc;return function(_0x2d1a42){if(_0x2d1a42){return _0x5839b3[_0xd5e1('0x18')](_0x173a0e);}return _0x5839b3['status'](_0x173a0e)[_0xd5e1('0x19')]();};}function respondWithResult(_0x4af3ea,_0x7e1206){_0x7e1206=_0x7e1206||0xc8;return function(_0x253eb5){if(_0x253eb5){return _0x4af3ea[_0xd5e1('0x1a')](_0x7e1206)[_0xd5e1('0x1b')](_0x253eb5);}};}function respondWithFilteredResult(_0x43ca94,_0x370a4d){return function(_0x3191b5){if(_0x3191b5){var _0x2fd3a4=typeof _0x370a4d['offset']===_0xd5e1('0x1c')&&typeof _0x370a4d[_0xd5e1('0x1d')]==='undefined';var _0x55d7bf=_0x3191b5[_0xd5e1('0x1e')];var _0x1c1d89=_0x2fd3a4?0x0:_0x370a4d[_0xd5e1('0x1f')];var _0x64af69=_0x2fd3a4?_0x3191b5[_0xd5e1('0x1e')]:_0x370a4d[_0xd5e1('0x1f')]+_0x370a4d[_0xd5e1('0x1d')];var _0xce830f;if(_0x64af69>=_0x55d7bf){_0x64af69=_0x55d7bf;_0xce830f=0xc8;}else{_0xce830f=0xce;}_0x43ca94[_0xd5e1('0x1a')](_0xce830f);return _0x43ca94[_0xd5e1('0x20')](_0xd5e1('0x21'),_0x1c1d89+'-'+_0x64af69+'/'+_0x55d7bf)['json'](_0x3191b5);}return null;};}function patchUpdates(_0x4f8561){return function(_0x1921ef){try{jsonpatch[_0xd5e1('0x22')](_0x1921ef,_0x4f8561,!![]);}catch(_0x1ce9c8){return BPromise[_0xd5e1('0x23')](_0x1ce9c8);}return _0x1921ef[_0xd5e1('0x24')]();};}function saveUpdates(_0x74c78a,_0x461902){return function(_0x1a8be9){if(_0x1a8be9){return _0x1a8be9[_0xd5e1('0x25')](_0x74c78a)[_0xd5e1('0x26')](function(_0x731c8f){return _0x731c8f;});}return null;};}function removeEntity(_0x1da031,_0x5d61bf){return function(_0x4f0d14){if(_0x4f0d14){return _0x4f0d14['destroy']()[_0xd5e1('0x26')](function(){_0x1da031['status'](0xcc)[_0xd5e1('0x19')]();});}};}function handleEntityNotFound(_0x425f3e,_0xfed768){return function(_0x3996ef){if(!_0x3996ef){_0x425f3e[_0xd5e1('0x18')](0x194);}return _0x3996ef;};}function handleError(_0x3f583a,_0x11b5c4){_0x11b5c4=_0x11b5c4||0x1f4;return function(_0x5401f2){logger[_0xd5e1('0x27')](_0x5401f2['stack']);if(_0x5401f2[_0xd5e1('0x28')]){delete _0x5401f2[_0xd5e1('0x28')];}_0x3f583a[_0xd5e1('0x1a')](_0x11b5c4)[_0xd5e1('0x29')](_0x5401f2);};}exports[_0xd5e1('0x2a')]=function(_0x221b22,_0x30beca){var _0x361b1e={},_0x2c5327={},_0x152040={'count':0x0,'rows':[]};var _0x1bda2a=_[_0xd5e1('0x2b')](db[_0xd5e1('0x2c')][_0xd5e1('0x2d')],function(_0x5dddff){return{'name':_0x5dddff[_0xd5e1('0x2e')],'type':_0x5dddff[_0xd5e1('0x2f')][_0xd5e1('0x30')]};});_0x2c5327[_0xd5e1('0x31')]=_[_0xd5e1('0x2b')](_0x1bda2a,_0xd5e1('0x28'));_0x2c5327[_0xd5e1('0x32')]=_[_0xd5e1('0x33')](_0x221b22[_0xd5e1('0x32')]);_0x2c5327[_0xd5e1('0x34')]=_[_0xd5e1('0x35')](_0x2c5327['model'],_0x2c5327['query']);_0x361b1e[_0xd5e1('0x36')]=_[_0xd5e1('0x35')](_0x2c5327[_0xd5e1('0x31')],qs[_0xd5e1('0x37')](_0x221b22[_0xd5e1('0x32')][_0xd5e1('0x37')]));_0x361b1e[_0xd5e1('0x36')]=_0x361b1e[_0xd5e1('0x36')]['length']?_0x361b1e[_0xd5e1('0x36')]:_0x2c5327['model'];if(!_0x221b22[_0xd5e1('0x32')][_0xd5e1('0x38')](_0xd5e1('0x39'))){_0x361b1e[_0xd5e1('0x1d')]=qs['limit'](_0x221b22[_0xd5e1('0x32')]['limit']);_0x361b1e[_0xd5e1('0x1f')]=qs['offset'](_0x221b22[_0xd5e1('0x32')][_0xd5e1('0x1f')]);}_0x361b1e[_0xd5e1('0x3a')]=qs[_0xd5e1('0x3b')](_0x221b22['query'][_0xd5e1('0x3b')]);_0x361b1e[_0xd5e1('0x3c')]=qs['filters'](_['pick'](_0x221b22['query'],_0x2c5327[_0xd5e1('0x34')]),_0x1bda2a);if(_0x221b22[_0xd5e1('0x32')][_0xd5e1('0x3d')]){_0x361b1e[_0xd5e1('0x3c')]=_[_0xd5e1('0x3e')](_0x361b1e[_0xd5e1('0x3c')],{'$or':_[_0xd5e1('0x2b')](_0x1bda2a,function(_0x51be7e){if(_0x51be7e[_0xd5e1('0x2f')]!==_0xd5e1('0x3f')){var _0x3d44f2={};_0x3d44f2[_0x51be7e[_0xd5e1('0x28')]]={'$like':'%'+_0x221b22[_0xd5e1('0x32')]['filter']+'%'};return _0x3d44f2;}})});}_0x361b1e=_[_0xd5e1('0x3e')]({},_0x361b1e,_0x221b22[_0xd5e1('0x40')]);var _0x5d1a6a={'where':_0x361b1e[_0xd5e1('0x3c')]};return db['FreshsalesAccount'][_0xd5e1('0x1e')](_0x5d1a6a)[_0xd5e1('0x26')](function(_0x1b5adc){_0x152040[_0xd5e1('0x1e')]=_0x1b5adc;if(_0x221b22['query'][_0xd5e1('0x41')]){_0x361b1e[_0xd5e1('0x42')]=[{'all':!![]}];}return db[_0xd5e1('0x2c')]['findAll'](_0x361b1e);})[_0xd5e1('0x26')](function(_0x1e6466){_0x152040[_0xd5e1('0x43')]=_0x1e6466;return _0x152040;})['then'](respondWithFilteredResult(_0x30beca,_0x361b1e))[_0xd5e1('0x44')](handleError(_0x30beca,null));};exports[_0xd5e1('0x45')]=function(_0x3dc871,_0xd4805c){var _0x5710c8={'raw':![],'where':{'id':_0x3dc871[_0xd5e1('0x46')]['id']}},_0xb3ccb5={};_0xb3ccb5['model']=_[_0xd5e1('0x33')](db[_0xd5e1('0x2c')]['rawAttributes']);_0xb3ccb5['query']=_[_0xd5e1('0x33')](_0x3dc871['query']);_0xb3ccb5['filters']=_['intersection'](_0xb3ccb5[_0xd5e1('0x31')],_0xb3ccb5[_0xd5e1('0x32')]);_0x5710c8['attributes']=_[_0xd5e1('0x35')](_0xb3ccb5[_0xd5e1('0x31')],qs['fields'](_0x3dc871[_0xd5e1('0x32')][_0xd5e1('0x37')]));_0x5710c8[_0xd5e1('0x36')]=_0x5710c8[_0xd5e1('0x36')][_0xd5e1('0x47')]?_0x5710c8['attributes']:_0xb3ccb5[_0xd5e1('0x31')];if(_0x3dc871['query'][_0xd5e1('0x41')]){_0x5710c8['include']=[{'all':!![]}];}_0x5710c8=_[_0xd5e1('0x3e')]({},_0x5710c8,_0x3dc871[_0xd5e1('0x40')]);return db[_0xd5e1('0x2c')][_0xd5e1('0x48')](_0x5710c8)['then'](handleEntityNotFound(_0xd4805c,null))[_0xd5e1('0x26')](respondWithResult(_0xd4805c,null))[_0xd5e1('0x44')](handleError(_0xd4805c,null));};exports[_0xd5e1('0x49')]=function(_0x23b940,_0x11206b){return db[_0xd5e1('0x2c')][_0xd5e1('0x49')](_0x23b940[_0xd5e1('0x4a')],{})[_0xd5e1('0x26')](respondWithResult(_0x11206b,0xc9))[_0xd5e1('0x44')](handleError(_0x11206b,null));};exports[_0xd5e1('0x25')]=function(_0x9d12a5,_0x2b8591){if(_0x9d12a5[_0xd5e1('0x4a')]['id']){delete _0x9d12a5[_0xd5e1('0x4a')]['id'];}return db[_0xd5e1('0x2c')]['find']({'where':{'id':_0x9d12a5[_0xd5e1('0x46')]['id']}})[_0xd5e1('0x26')](handleEntityNotFound(_0x2b8591,null))[_0xd5e1('0x26')](saveUpdates(_0x9d12a5[_0xd5e1('0x4a')],null))[_0xd5e1('0x26')](respondWithResult(_0x2b8591,null))[_0xd5e1('0x44')](handleError(_0x2b8591,null));};exports[_0xd5e1('0x4b')]=function(_0x1d8740,_0x118c6a){return db['FreshsalesAccount']['find']({'where':{'id':_0x1d8740[_0xd5e1('0x46')]['id']}})[_0xd5e1('0x26')](handleEntityNotFound(_0x118c6a,null))[_0xd5e1('0x26')](removeEntity(_0x118c6a,null))['catch'](handleError(_0x118c6a,null));};exports[_0xd5e1('0x4c')]=function(_0x563df4,_0x42009f,_0x1e56d1){var _0x3bdac0={};var _0x5e541d={};var _0x1cd208;var _0xb8ce26;return db[_0xd5e1('0x2c')][_0xd5e1('0x4d')]({'where':{'id':_0x563df4[_0xd5e1('0x46')]['id']}})[_0xd5e1('0x26')](handleEntityNotFound(_0x42009f,null))['then'](function(_0x47a4c1){if(_0x47a4c1){_0x1cd208=_0x47a4c1;_0x5e541d[_0xd5e1('0x31')]=_[_0xd5e1('0x33')](db['FreshsalesConfiguration'][_0xd5e1('0x2d')]);_0x5e541d[_0xd5e1('0x32')]=_[_0xd5e1('0x33')](_0x563df4['query']);_0x5e541d['filters']=_[_0xd5e1('0x35')](_0x5e541d[_0xd5e1('0x31')],_0x5e541d[_0xd5e1('0x32')]);_0x3bdac0[_0xd5e1('0x36')]=_[_0xd5e1('0x35')](_0x5e541d[_0xd5e1('0x31')],qs[_0xd5e1('0x37')](_0x563df4[_0xd5e1('0x32')][_0xd5e1('0x37')]));_0x3bdac0[_0xd5e1('0x36')]=_0x3bdac0[_0xd5e1('0x36')][_0xd5e1('0x47')]?_0x3bdac0['attributes']:_0x5e541d[_0xd5e1('0x31')];_0x3bdac0[_0xd5e1('0x3a')]=qs['sort'](_0x563df4[_0xd5e1('0x32')][_0xd5e1('0x3b')]);_0x3bdac0['where']=qs[_0xd5e1('0x34')](_[_0xd5e1('0x4e')](_0x563df4['query'],_0x5e541d[_0xd5e1('0x34')]));if(_0x563df4['query'][_0xd5e1('0x3d')]){_0x3bdac0[_0xd5e1('0x3c')]=_[_0xd5e1('0x3e')](_0x3bdac0[_0xd5e1('0x3c')],{'$or':_[_0xd5e1('0x2b')](_0x3bdac0[_0xd5e1('0x36')],function(_0x3744ba){var _0x46d994={};_0x46d994[_0x3744ba]={'$like':'%'+_0x563df4[_0xd5e1('0x32')]['filter']+'%'};return _0x46d994;})});}_0x3bdac0=_[_0xd5e1('0x3e')]({},_0x3bdac0,_0x563df4[_0xd5e1('0x40')]);return _0x1cd208[_0xd5e1('0x4c')](_0x3bdac0);}})[_0xd5e1('0x26')](function(_0x52ab1b){if(_0x52ab1b){_0xb8ce26=_0x52ab1b[_0xd5e1('0x47')];if(!_0x563df4[_0xd5e1('0x32')][_0xd5e1('0x38')](_0xd5e1('0x39'))){_0x3bdac0[_0xd5e1('0x1d')]=qs[_0xd5e1('0x1d')](_0x563df4[_0xd5e1('0x32')][_0xd5e1('0x1d')]);_0x3bdac0[_0xd5e1('0x1f')]=qs[_0xd5e1('0x1f')](_0x563df4['query'][_0xd5e1('0x1f')]);}return _0x1cd208[_0xd5e1('0x4c')](_0x3bdac0);}})['then'](function(_0x26b0ad){if(_0x26b0ad){return _0x26b0ad?{'count':_0xb8ce26,'rows':_0x26b0ad}:null;}})[_0xd5e1('0x26')](respondWithResult(_0x42009f,null))[_0xd5e1('0x44')](handleError(_0x42009f,null));};exports[_0xd5e1('0x4f')]=function(_0x29a4d2,_0x28f84d,_0x485222){if(_0x29a4d2['body']['id']){delete _0x29a4d2[_0xd5e1('0x4a')]['id'];}return db[_0xd5e1('0x2c')][_0xd5e1('0x4d')]({'where':{'id':_0x29a4d2['params']['id']}})[_0xd5e1('0x26')](handleEntityNotFound(_0x28f84d,null))[_0xd5e1('0x26')](function(_0x1793a0){if(_0x1793a0){_0x29a4d2[_0xd5e1('0x4a')][_0xd5e1('0x50')]=_0x1793a0['id'];_0x29a4d2[_0xd5e1('0x4a')]['Subjects']=integrations['getSubjects'](_0x29a4d2[_0xd5e1('0x4a')][_0xd5e1('0x51')],_0x29a4d2[_0xd5e1('0x4a')][_0xd5e1('0x2f')]);_0x29a4d2[_0xd5e1('0x4a')][_0xd5e1('0x52')]=integrations[_0xd5e1('0x53')](_0x29a4d2['body'][_0xd5e1('0x51')],_0x29a4d2[_0xd5e1('0x4a')][_0xd5e1('0x2f')]);return db[_0xd5e1('0x54')][_0xd5e1('0x49')](_0x29a4d2[_0xd5e1('0x4a')],{'include':[{'model':db['FreshsalesField'],'as':_0xd5e1('0x55')},{'model':db[_0xd5e1('0x56')],'as':_0xd5e1('0x52')}]});}return null;})[_0xd5e1('0x26')](respondWithResult(_0x28f84d,null))[_0xd5e1('0x44')](handleError(_0x28f84d,null));};exports[_0xd5e1('0x57')]=function(_0x2476f2,_0x2acd9c,_0x25751c){var _0x1ae3b8='';var _0x500866='';return db[_0xd5e1('0x2c')]['findOne']({'where':{'id':_0x2476f2['params']['id']},'attributes':['id',_0xd5e1('0x58'),_0xd5e1('0x59'),'apiKey']})[_0xd5e1('0x26')](handleEntityNotFound(_0x2acd9c,null))[_0xd5e1('0x26')](function(_0x25b035){if(_0x25b035){_0x500866=_0x25b035[_0xd5e1('0x58')];_0x1ae3b8=_0x25b035[_0xd5e1('0x59')];var _0x40c3b6=_0x25b035[_0xd5e1('0x59')][_0xd5e1('0x5a')](-0x1);if(_0x40c3b6==='/'){_0x1ae3b8=_0x1ae3b8['substring'](0x0,_0x1ae3b8[_0xd5e1('0x5b')](_0x40c3b6));}return rp({'method':'GET','uri':util[_0xd5e1('0x5c')]('%s%s',_0x1ae3b8,_0xd5e1('0x5d')),'headers':{'Authorization':_0xd5e1('0x5e')+_0x25b035['apiKey']},'json':!![]});}})[_0xd5e1('0x26')](function(_0x1d78ad){if(_0x1d78ad){var _0x20c5ce=_0x1d78ad['users'];var _0x298ca0=![];var _0x16612c=null;for(_0x16612c=0x0;_0x16612c<_0x20c5ce[_0xd5e1('0x47')];_0x16612c++){if(_0x20c5ce[_0x16612c][_0xd5e1('0x5f')]===_0x500866){_0x298ca0=!![];}}if(_0x298ca0){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd5e1('0x60')});}}})[_0xd5e1('0x26')](respondWithResult(_0x2acd9c,null))['catch'](function(_0xcc5fc2){var _0x25fbad=_0x2476f2[_0xd5e1('0x32')][_0xd5e1('0x61')]?0x1f4:_0xcc5fc2[_0xd5e1('0x62')]||0x1f4;logger[_0xd5e1('0x27')](_0xd5e1('0x63'),_0xd5e1('0x57'),_0x25fbad,JSON[_0xd5e1('0x64')](_0xcc5fc2));delete _0xcc5fc2['name'];if(_0x25fbad===0x191){_0x25fbad=0x190;}_0x2acd9c['status'](_0x25fbad)['send'](_0x2476f2[_0xd5e1('0x32')]['test']?{'message':_0xd5e1('0x65'),'statusCode':_0xcc5fc2[_0xd5e1('0x62')]}:_0xcc5fc2);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 32a6ed7..f674d6c 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x430c=['define','FreshsalesAccount','int_freshsales_accounts','lodash','api','moment','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x4e4c02,_0x42cb3d){var _0x522aed=function(_0x98c2e1){while(--_0x98c2e1){_0x4e4c02['push'](_0x4e4c02['shift']());}};_0x522aed(++_0x42cb3d);}(_0x430c,0x1a1));var _0xc430=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x430c[_0xf0ec6e];return _0x8bbc27;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));var integrations=require(_0xc430('0x5'));module['exports']=function(_0x42aa9c,_0x4de44f){return _0x42aa9c[_0xc430('0x6')](_0xc430('0x7'),attributes,{'tableName':_0xc430('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x285505,_0x265976){var _0x3366af=function(_0x15087b){while(--_0x15087b){_0x285505['push'](_0x285505['shift']());}};_0x3366af(++_0x265976);}(_0x4975,0x86));var _0x5497=function(_0x5b92a7,_0x178d00){_0x5b92a7=_0x5b92a7-0x0;var _0x446c20=_0x4975[_0x5b92a7];return _0x446c20;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));var integrations=require(_0x5497('0xa'));module['exports']=function(_0x37e48d,_0x4f563d){return _0x37e48d[_0x5497('0xb')](_0x5497('0xc'),attributes,{'tableName':_0x5497('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 2093c01..961bdf7 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcf0=['request','info','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','FreshsalesAccount','find','ShowFreshsalesAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x8c1b55,_0x2082c0){var _0x33089d=function(_0x456e42){while(--_0x456e42){_0x8c1b55['push'](_0x8c1b55['shift']());}};_0x33089d(++_0x2082c0);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xfcf0[_0x3207aa];return _0x51758f;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}exports[_0x0fcf('0x15')]=function(_0x19cfbd){var _0x567320=this;return new Promise(function(_0x18ea32,_0x1a8f58){return db['FreshsalesAccount'][_0x0fcf('0x16')]({'raw':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1a')]||null:null,'limit':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x1b')]||null:null,'include':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x19cfbd[_0x0fcf('0x17')]['include'],function(_0x2eef74){return{'model':db[_0x2eef74[_0x0fcf('0x1e')]],'as':_0x2eef74['as'],'attributes':_0x2eef74[_0x0fcf('0x1a')],'include':_0x2eef74[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x2eef74[_0x0fcf('0x1c')],function(_0x2ce990){return{'model':db[_0x2ce990[_0x0fcf('0x1e')]],'as':_0x2ce990['as'],'attributes':_0x2ce990[_0x0fcf('0x1a')],'include':_0x2ce990['include']?_[_0x0fcf('0x1d')](_0x2ce990[_0x0fcf('0x1c')],function(_0x41b7a2){return{'model':db[_0x41b7a2[_0x0fcf('0x1e')]],'as':_0x41b7a2['as'],'attributes':_0x41b7a2[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0fcf('0x1f')](function(_0x2730b0){logger['info'](_0x0fcf('0x15'),_0x19cfbd);logger[_0x0fcf('0xf')](_0x0fcf('0x15'),_0x19cfbd,JSON[_0x0fcf('0x11')](_0x2730b0));_0x18ea32(_0x2730b0);})['catch'](function(_0x5d9bcd){logger['error'](_0x0fcf('0x15'),_0x5d9bcd['message'],_0x19cfbd);_0x1a8f58(_0x567320[_0x0fcf('0x12')](0x1f4,_0x5d9bcd[_0x0fcf('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xdfd3ec){var _0x117041=this;return new Promise(function(_0xa52f52,_0x161496){return db[_0x0fcf('0x20')][_0x0fcf('0x21')]({'raw':_0xdfd3ec['options']?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec['options'][_0x0fcf('0x1a')]||null:null,'include':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')],function(_0x344957){return{'model':db[_0x344957[_0x0fcf('0x1e')]],'as':_0x344957['as'],'attributes':_0x344957[_0x0fcf('0x1a')],'include':_0x344957[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x344957[_0x0fcf('0x1c')],function(_0x17346e){return{'model':db[_0x17346e['model']],'as':_0x17346e['as'],'attributes':_0x17346e['attributes'],'include':_0x17346e[_0x0fcf('0x1c')]?_['map'](_0x17346e['include'],function(_0x1a1e07){return{'model':db[_0x1a1e07[_0x0fcf('0x1e')]],'as':_0x1a1e07['as'],'attributes':_0x1a1e07[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e635){logger[_0x0fcf('0xd')](_0x0fcf('0x22'),_0xdfd3ec);logger[_0x0fcf('0xf')]('ShowFreshsalesAccount',_0xdfd3ec,JSON[_0x0fcf('0x11')](_0x57e635));_0xa52f52(_0x57e635);})[_0x0fcf('0x23')](function(_0x29067e){logger['error']('ShowFreshsalesAccount',_0x29067e['message'],_0xdfd3ec);_0x161496(_0x117041[_0x0fcf('0x12')](0x1f4,_0x29067e[_0x0fcf('0x13')]));});});}; \ No newline at end of file +var _0xe5af=['ShowFreshsalesAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','include','model','map','find','raw','debug'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xe5af,0x9c));var _0xfe5a=function(_0x4bcfc5,_0x1de741){_0x4bcfc5=_0x4bcfc5-0x0;var _0x3b1ed1=_0xe5af[_0x4bcfc5];return _0x3b1ed1;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eea2e,_0x356c69,_0x106492){return new BPromise(function(_0xfb4357,_0x3e683c){return client['request'](_0x5eea2e,_0x106492)[_0xfe5a('0x8')](function(_0x5a48ff){logger['info'](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));logger['debug'](_0xfe5a('0xb'),_0x356c69,_0xfe5a('0xa'),JSON[_0xfe5a('0xc')](_0x5a48ff));if(_0x5a48ff[_0xfe5a('0xd')]){if(_0x5a48ff[_0xfe5a('0xd')]['code']===0x1f4){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0x3e683c(_0x5a48ff[_0xfe5a('0xd')]['message']);}logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0xfb4357(_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));_0xfb4357(_0x5a48ff[_0xfe5a('0x10')][_0xfe5a('0xe')]);}})[_0xfe5a('0x11')](function(_0x22afa7){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x22afa7);_0x3e683c(_0x22afa7);});});}exports[_0xfe5a('0x12')]=function(_0x5bf597){var _0x20620b=this;return new Promise(function(_0x456707,_0x54d5fb){return db[_0xfe5a('0x13')][_0xfe5a('0x14')]({'raw':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x16')]||null:null,'attributes':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x17')]||null:null,'limit':_0x5bf597['options']?_0x5bf597[_0xfe5a('0x15')]['limit']||null:null,'include':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x18')]?_['map'](_0x5bf597['options'][_0xfe5a('0x18')],function(_0x3e55fd){return{'model':db[_0x3e55fd['model']],'as':_0x3e55fd['as'],'attributes':_0x3e55fd[_0xfe5a('0x17')],'include':_0x3e55fd[_0xfe5a('0x18')]?_['map'](_0x3e55fd[_0xfe5a('0x18')],function(_0x3a4f3c){return{'model':db[_0x3a4f3c[_0xfe5a('0x19')]],'as':_0x3a4f3c['as'],'attributes':_0x3a4f3c[_0xfe5a('0x17')],'include':_0x3a4f3c['include']?_[_0xfe5a('0x1a')](_0x3a4f3c[_0xfe5a('0x18')],function(_0x24481f){return{'model':db[_0x24481f[_0xfe5a('0x19')]],'as':_0x24481f['as'],'attributes':_0x24481f[_0xfe5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfe5a('0x8')](function(_0xdbf1e0){logger[_0xfe5a('0xf')]('GetFreshsalesAccount',_0x5bf597);logger['debug'](_0xfe5a('0x12'),_0x5bf597,JSON['stringify'](_0xdbf1e0));_0x456707(_0xdbf1e0);})[_0xfe5a('0x11')](function(_0xfcb05b){logger[_0xfe5a('0xd')]('GetFreshsalesAccount',_0xfcb05b['message'],_0x5bf597);_0x54d5fb(_0x20620b['error'](0x1f4,_0xfcb05b[_0xfe5a('0xe')]));});});};exports['ShowFreshsalesAccount']=function(_0x51d1f4){var _0x498b64=this;return new Promise(function(_0x3b6e4d,_0x14c66d){return db[_0xfe5a('0x13')][_0xfe5a('0x1b')]({'raw':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x1c')]===undefined?!![]:![]:!![],'where':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x16')]||null:null,'attributes':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4['options'][_0xfe5a('0x17')]||null:null,'include':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4['options'][_0xfe5a('0x18')]?_[_0xfe5a('0x1a')](_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x18')],function(_0xe5a992){return{'model':db[_0xe5a992['model']],'as':_0xe5a992['as'],'attributes':_0xe5a992['attributes'],'include':_0xe5a992[_0xfe5a('0x18')]?_['map'](_0xe5a992[_0xfe5a('0x18')],function(_0xb31d0){return{'model':db[_0xb31d0[_0xfe5a('0x19')]],'as':_0xb31d0['as'],'attributes':_0xb31d0[_0xfe5a('0x17')],'include':_0xb31d0['include']?_[_0xfe5a('0x1a')](_0xb31d0[_0xfe5a('0x18')],function(_0x2e3a36){return{'model':db[_0x2e3a36['model']],'as':_0x2e3a36['as'],'attributes':_0x2e3a36[_0xfe5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfe5a('0x8')](function(_0x4617f0){logger[_0xfe5a('0xf')]('ShowFreshsalesAccount',_0x51d1f4);logger[_0xfe5a('0x1d')]('ShowFreshsalesAccount',_0x51d1f4,JSON[_0xfe5a('0xc')](_0x4617f0));_0x3b6e4d(_0x4617f0);})[_0xfe5a('0x11')](function(_0x576189){logger[_0xfe5a('0xd')](_0xfe5a('0x1e'),_0x576189[_0xfe5a('0xe')],_0x51d1f4);_0x14c66d(_0x498b64[_0xfe5a('0xd')](0x1f4,_0x576189['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index d6b1827..e14af0a 100644 --- a/server/api/intFreshsalesConfiguration/index.js +++ b/server/api/intFreshsalesConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4cc=['index','get','show','/:id/subjects','/:id/descriptions','isAuthenticated','getFields','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xc4cc,0x158));var _0xcc4c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc4cc[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xcc4c('0x0'));var util=require('util');var path=require(_0xcc4c('0x1'));var timeout=require(_0xcc4c('0x2'));var express=require(_0xcc4c('0x3'));var router=express['Router']();var fs_extra=require(_0xcc4c('0x4'));var auth=require(_0xcc4c('0x5'));var interaction=require(_0xcc4c('0x6'));var config=require('../../config/environment');var controller=require(_0xcc4c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcc4c('0x8')]);router[_0xcc4c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xcc4c('0xa')]);router[_0xcc4c('0x9')](_0xcc4c('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xcc4c('0x9')](_0xcc4c('0xc'),auth[_0xcc4c('0xd')](),controller['getDescriptions']);router[_0xcc4c('0x9')]('/:id/fields',auth[_0xcc4c('0xd')](),controller[_0xcc4c('0xe')]);router[_0xcc4c('0xf')]('/',auth[_0xcc4c('0xd')](),controller[_0xcc4c('0x10')]);router[_0xcc4c('0x11')](_0xcc4c('0x12'),auth[_0xcc4c('0xd')](),controller[_0xcc4c('0x13')]);router[_0xcc4c('0x14')](_0xcc4c('0x12'),auth[_0xcc4c('0xd')](),controller['destroy']);module[_0xcc4c('0x15')]=router; \ No newline at end of file +var _0xafee=['update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','get','/:id/descriptions','getDescriptions','create','put'];(function(_0x254ced,_0x4d0897){var _0x3b81ca=function(_0x59e7ad){while(--_0x59e7ad){_0x254ced['push'](_0x254ced['shift']());}};_0x3b81ca(++_0x4d0897);}(_0xafee,0x7b));var _0xeafe=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xafee[_0x32f7d7];return _0x133d09;};'use strict';var multer=require(_0xeafe('0x0'));var util=require(_0xeafe('0x1'));var path=require(_0xeafe('0x2'));var timeout=require('connect-timeout');var express=require(_0xeafe('0x3'));var router=express[_0xeafe('0x4')]();var fs_extra=require(_0xeafe('0x5'));var auth=require(_0xeafe('0x6'));var interaction=require(_0xeafe('0x7'));var config=require(_0xeafe('0x8'));var controller=require(_0xeafe('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xeafe('0xa')]);router['get'](_0xeafe('0xb'),auth[_0xeafe('0xc')](),controller[_0xeafe('0xd')]);router['get'](_0xeafe('0xe'),auth[_0xeafe('0xc')](),controller[_0xeafe('0xf')]);router[_0xeafe('0x10')](_0xeafe('0x11'),auth[_0xeafe('0xc')](),controller[_0xeafe('0x12')]);router['get']('/:id/fields',auth[_0xeafe('0xc')](),controller['getFields']);router['post']('/',auth[_0xeafe('0xc')](),controller[_0xeafe('0x13')]);router[_0xeafe('0x14')](_0xeafe('0xb'),auth[_0xeafe('0xc')](),controller[_0xeafe('0x15')]);router[_0xeafe('0x16')]('/:id',auth[_0xeafe('0xc')](),controller['destroy']);module[_0xeafe('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 4c004ca..6f76429 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa29b=['sequelize','exports','STRING'];(function(_0x49e2ee,_0x1f0dc3){var _0x4c0f50=function(_0x1f34a2){while(--_0x1f34a2){_0x49e2ee['push'](_0x49e2ee['shift']());}};_0x4c0f50(++_0x1f0dc3);}(_0xa29b,0xae));var _0xba29=function(_0x34edc6,_0x4a0b01){_0x34edc6=_0x34edc6-0x0;var _0x5788b1=_0xa29b[_0x34edc6];return _0x5788b1;};'use strict';var Sequelize=require(_0xba29('0x0'));module[_0xba29('0x1')]={'name':{'type':Sequelize[_0xba29('0x2')]},'description':{'type':Sequelize[_0xba29('0x2')]}}; \ No newline at end of file +var _0x57c8=['STRING'];(function(_0x3b4875,_0x8c5ddf){var _0x15d576=function(_0x58ee4c){while(--_0x58ee4c){_0x3b4875['push'](_0x3b4875['shift']());}};_0x15d576(++_0x8c5ddf);}(_0x57c8,0x180));var _0x857c=function(_0xb025c8,_0x24bcc9){_0xb025c8=_0xb025c8-0x0;var _0x5cddfc=_0x57c8[_0xb025c8];return _0x5cddfc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x857c('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index cdbf698..b0295fb 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x885c=['body','find','params','getSubjects','findOne','FreshsalesField','pick','hasOwnProperty','getDescriptions','getFields','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','options','include','findAll','catch','show','includeAll','merge','create'];(function(_0x1bebe5,_0x32e0d3){var _0x568429=function(_0x2306f0){while(--_0x2306f0){_0x1bebe5['push'](_0x1bebe5['shift']());}};_0x568429(++_0x32e0d3);}(_0x885c,0x190));var _0xc885=function(_0x4f8d61,_0x29eff0){_0x4f8d61=_0x4f8d61-0x0;var _0x3bc078=_0x885c[_0x4f8d61];return _0x3bc078;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc885('0x0'));var jsonpatch=require(_0xc885('0x1'));var rp=require(_0xc885('0x2'));var moment=require('moment');var BPromise=require(_0xc885('0x3'));var Mustache=require(_0xc885('0x4'));var util=require(_0xc885('0x5'));var path=require(_0xc885('0x6'));var sox=require(_0xc885('0x7'));var csv=require(_0xc885('0x8'));var ejs=require(_0xc885('0x9'));var fs=require('fs');var fs_extra=require(_0xc885('0xa'));var _=require(_0xc885('0xb'));var squel=require(_0xc885('0xc'));var crypto=require(_0xc885('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc885('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc885('0xf'));var Papa=require('papaparse');var Redis=require(_0xc885('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc885('0x11'));var hardwareService=require(_0xc885('0x12'));var logger=require('../../config/logger')(_0xc885('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc885('0x14'));var db=require(_0xc885('0x15'))['db'];function respondWithStatusCode(_0x52065b,_0x53a5b8){_0x53a5b8=_0x53a5b8||0xcc;return function(_0x2ce96b){if(_0x2ce96b){return _0x52065b['sendStatus'](_0x53a5b8);}return _0x52065b[_0xc885('0x16')](_0x53a5b8)['end']();};}function respondWithResult(_0x20b73e,_0x1102bc){_0x1102bc=_0x1102bc||0xc8;return function(_0x245f5a){if(_0x245f5a){return _0x20b73e['status'](_0x1102bc)[_0xc885('0x17')](_0x245f5a);}};}function respondWithFilteredResult(_0x41667d,_0x5e5674){return function(_0x415a06){if(_0x415a06){var _0xa743a4=typeof _0x5e5674['offset']===_0xc885('0x18')&&typeof _0x5e5674[_0xc885('0x19')]===_0xc885('0x18');var _0xa830e2=_0x415a06[_0xc885('0x1a')];var _0x3139a9=_0xa743a4?0x0:_0x5e5674[_0xc885('0x1b')];var _0x12c6fb=_0xa743a4?_0x415a06[_0xc885('0x1a')]:_0x5e5674[_0xc885('0x1b')]+_0x5e5674[_0xc885('0x19')];var _0x52cad3;if(_0x12c6fb>=_0xa830e2){_0x12c6fb=_0xa830e2;_0x52cad3=0xc8;}else{_0x52cad3=0xce;}_0x41667d['status'](_0x52cad3);return _0x41667d[_0xc885('0x1c')](_0xc885('0x1d'),_0x3139a9+'-'+_0x12c6fb+'/'+_0xa830e2)[_0xc885('0x17')](_0x415a06);}return null;};}function patchUpdates(_0x88712a){return function(_0x392384){try{jsonpatch['apply'](_0x392384,_0x88712a,!![]);}catch(_0x553cac){return BPromise[_0xc885('0x1e')](_0x553cac);}return _0x392384[_0xc885('0x1f')]();};}function saveUpdates(_0x4015f0,_0x470ae6){return function(_0xe1f77b){if(_0xe1f77b){return _0xe1f77b[_0xc885('0x20')](_0x4015f0)[_0xc885('0x21')](function(_0x124afe){return _0x124afe;});}return null;};}function removeEntity(_0x4af318,_0x5a6fa2){return function(_0x57864d){if(_0x57864d){return _0x57864d['destroy']()[_0xc885('0x21')](function(){_0x4af318[_0xc885('0x16')](0xcc)[_0xc885('0x22')]();});}};}function handleEntityNotFound(_0x5d9fb6,_0x3ccf3c){return function(_0x1a1ec7){if(!_0x1a1ec7){_0x5d9fb6[_0xc885('0x23')](0x194);}return _0x1a1ec7;};}function handleError(_0x1787d6,_0xe0fa75){_0xe0fa75=_0xe0fa75||0x1f4;return function(_0x47f20d){logger[_0xc885('0x24')](_0x47f20d[_0xc885('0x25')]);if(_0x47f20d[_0xc885('0x26')]){delete _0x47f20d[_0xc885('0x26')];}_0x1787d6[_0xc885('0x16')](_0xe0fa75)[_0xc885('0x27')](_0x47f20d);};}exports[_0xc885('0x28')]=function(_0x5b8589,_0x5cb45d){var _0x3803de={},_0x4270ae={},_0x579386={'count':0x0,'rows':[]};var _0x4b808f=_[_0xc885('0x29')](db[_0xc885('0x2a')][_0xc885('0x2b')],function(_0x1fb9bf){return{'name':_0x1fb9bf[_0xc885('0x2c')],'type':_0x1fb9bf[_0xc885('0x2d')][_0xc885('0x2e')]};});_0x4270ae[_0xc885('0x2f')]=_['map'](_0x4b808f,_0xc885('0x26'));_0x4270ae['query']=_[_0xc885('0x30')](_0x5b8589[_0xc885('0x31')]);_0x4270ae[_0xc885('0x32')]=_[_0xc885('0x33')](_0x4270ae['model'],_0x4270ae[_0xc885('0x31')]);_0x3803de[_0xc885('0x34')]=_[_0xc885('0x33')](_0x4270ae['model'],qs[_0xc885('0x35')](_0x5b8589['query'][_0xc885('0x35')]));_0x3803de[_0xc885('0x34')]=_0x3803de['attributes'][_0xc885('0x36')]?_0x3803de[_0xc885('0x34')]:_0x4270ae['model'];if(!_0x5b8589['query']['hasOwnProperty'](_0xc885('0x37'))){_0x3803de['limit']=qs[_0xc885('0x19')](_0x5b8589['query'][_0xc885('0x19')]);_0x3803de[_0xc885('0x1b')]=qs[_0xc885('0x1b')](_0x5b8589[_0xc885('0x31')]['offset']);}_0x3803de[_0xc885('0x38')]=qs['sort'](_0x5b8589[_0xc885('0x31')][_0xc885('0x39')]);_0x3803de[_0xc885('0x3a')]=qs['filters'](_['pick'](_0x5b8589[_0xc885('0x31')],_0x4270ae[_0xc885('0x32')]),_0x4b808f);if(_0x5b8589[_0xc885('0x31')][_0xc885('0x3b')]){_0x3803de[_0xc885('0x3a')]=_['merge'](_0x3803de['where'],{'$or':_[_0xc885('0x29')](_0x4b808f,function(_0x169abf){if(_0x169abf[_0xc885('0x2d')]!=='VIRTUAL'){var _0xae83b5={};_0xae83b5[_0x169abf[_0xc885('0x26')]]={'$like':'%'+_0x5b8589['query'][_0xc885('0x3b')]+'%'};return _0xae83b5;}})});}_0x3803de=_['merge']({},_0x3803de,_0x5b8589[_0xc885('0x3c')]);var _0x3fb419={'where':_0x3803de[_0xc885('0x3a')]};return db[_0xc885('0x2a')]['count'](_0x3fb419)[_0xc885('0x21')](function(_0x461718){_0x579386['count']=_0x461718;if(_0x5b8589['query']['includeAll']){_0x3803de[_0xc885('0x3d')]=[{'all':!![]}];}return db[_0xc885('0x2a')][_0xc885('0x3e')](_0x3803de);})['then'](function(_0x2ea881){_0x579386['rows']=_0x2ea881;return _0x579386;})[_0xc885('0x21')](respondWithFilteredResult(_0x5cb45d,_0x3803de))[_0xc885('0x3f')](handleError(_0x5cb45d,null));};exports[_0xc885('0x40')]=function(_0x50558a,_0x15c648){var _0xbca078={'raw':![],'where':{'id':_0x50558a['params']['id']}},_0x4dc2f9={};_0x4dc2f9['model']=_['keys'](db[_0xc885('0x2a')][_0xc885('0x2b')]);_0x4dc2f9['query']=_[_0xc885('0x30')](_0x50558a[_0xc885('0x31')]);_0x4dc2f9[_0xc885('0x32')]=_[_0xc885('0x33')](_0x4dc2f9[_0xc885('0x2f')],_0x4dc2f9[_0xc885('0x31')]);_0xbca078[_0xc885('0x34')]=_[_0xc885('0x33')](_0x4dc2f9['model'],qs[_0xc885('0x35')](_0x50558a[_0xc885('0x31')][_0xc885('0x35')]));_0xbca078['attributes']=_0xbca078[_0xc885('0x34')]['length']?_0xbca078[_0xc885('0x34')]:_0x4dc2f9['model'];if(_0x50558a[_0xc885('0x31')][_0xc885('0x41')]){_0xbca078[_0xc885('0x3d')]=[{'all':!![]}];}_0xbca078=_[_0xc885('0x42')]({},_0xbca078,_0x50558a[_0xc885('0x3c')]);return db[_0xc885('0x2a')]['find'](_0xbca078)['then'](handleEntityNotFound(_0x15c648,null))[_0xc885('0x21')](respondWithResult(_0x15c648,null))['catch'](handleError(_0x15c648,null));};exports[_0xc885('0x43')]=function(_0x2fe97c,_0x71367c){return db[_0xc885('0x2a')]['create'](_0x2fe97c[_0xc885('0x44')],{})['then'](respondWithResult(_0x71367c,0xc9))['catch'](handleError(_0x71367c,null));};exports[_0xc885('0x20')]=function(_0x219039,_0x344906){if(_0x219039[_0xc885('0x44')]['id']){delete _0x219039[_0xc885('0x44')]['id'];}return db['FreshsalesConfiguration'][_0xc885('0x45')]({'where':{'id':_0x219039[_0xc885('0x46')]['id']}})['then'](handleEntityNotFound(_0x344906,null))[_0xc885('0x21')](saveUpdates(_0x219039[_0xc885('0x44')],null))[_0xc885('0x21')](respondWithResult(_0x344906,null))[_0xc885('0x3f')](handleError(_0x344906,null));};exports['destroy']=function(_0x2b409f,_0x54c0c6){return db[_0xc885('0x2a')]['find']({'where':{'id':_0x2b409f['params']['id']}})[_0xc885('0x21')](handleEntityNotFound(_0x54c0c6,null))[_0xc885('0x21')](removeEntity(_0x54c0c6,null))[_0xc885('0x3f')](handleError(_0x54c0c6,null));};exports[_0xc885('0x47')]=function(_0x1a2c0b,_0x1f6fef,_0x1f5b3c){var _0x5b620b={};var _0x735597={};var _0x258ad2;var _0x11c7cd;return db[_0xc885('0x2a')][_0xc885('0x48')]({'where':{'id':_0x1a2c0b['params']['id']}})[_0xc885('0x21')](handleEntityNotFound(_0x1f6fef,null))[_0xc885('0x21')](function(_0x1be493){if(_0x1be493){_0x258ad2=_0x1be493;_0x735597['model']=_[_0xc885('0x30')](db[_0xc885('0x49')][_0xc885('0x2b')]);_0x735597['query']=_[_0xc885('0x30')](_0x1a2c0b['query']);_0x735597[_0xc885('0x32')]=_[_0xc885('0x33')](_0x735597[_0xc885('0x2f')],_0x735597['query']);_0x5b620b['attributes']=_[_0xc885('0x33')](_0x735597[_0xc885('0x2f')],qs[_0xc885('0x35')](_0x1a2c0b[_0xc885('0x31')][_0xc885('0x35')]));_0x5b620b[_0xc885('0x34')]=_0x5b620b[_0xc885('0x34')][_0xc885('0x36')]?_0x5b620b[_0xc885('0x34')]:_0x735597['model'];_0x5b620b['order']=qs['sort'](_0x1a2c0b[_0xc885('0x31')][_0xc885('0x39')]);_0x5b620b[_0xc885('0x3a')]=qs['filters'](_[_0xc885('0x4a')](_0x1a2c0b[_0xc885('0x31')],_0x735597['filters']));if(_0x1a2c0b[_0xc885('0x31')][_0xc885('0x3b')]){_0x5b620b[_0xc885('0x3a')]=_['merge'](_0x5b620b[_0xc885('0x3a')],{'$or':_[_0xc885('0x29')](_0x5b620b[_0xc885('0x34')],function(_0x26226c){var _0x1dc414={};_0x1dc414[_0x26226c]={'$like':'%'+_0x1a2c0b['query'][_0xc885('0x3b')]+'%'};return _0x1dc414;})});}_0x5b620b=_['merge']({},_0x5b620b,_0x1a2c0b[_0xc885('0x3c')]);return _0x258ad2[_0xc885('0x47')](_0x5b620b);}})[_0xc885('0x21')](function(_0x4b289f){if(_0x4b289f){_0x11c7cd=_0x4b289f[_0xc885('0x36')];if(!_0x1a2c0b[_0xc885('0x31')][_0xc885('0x4b')](_0xc885('0x37'))){_0x5b620b[_0xc885('0x19')]=qs[_0xc885('0x19')](_0x1a2c0b[_0xc885('0x31')]['limit']);_0x5b620b['offset']=qs[_0xc885('0x1b')](_0x1a2c0b[_0xc885('0x31')][_0xc885('0x1b')]);}return _0x258ad2[_0xc885('0x47')](_0x5b620b);}})['then'](function(_0x38b593){if(_0x38b593){return _0x38b593?{'count':_0x11c7cd,'rows':_0x38b593}:null;}})['then'](respondWithResult(_0x1f6fef,null))[_0xc885('0x3f')](handleError(_0x1f6fef,null));};exports[_0xc885('0x4c')]=function(_0x495aa8,_0x216f55,_0x3fe06c){var _0x57aa8f={};var _0x3240c0={};var _0x1c3c03;var _0x5ee3bd;return db[_0xc885('0x2a')][_0xc885('0x48')]({'where':{'id':_0x495aa8['params']['id']}})[_0xc885('0x21')](handleEntityNotFound(_0x216f55,null))[_0xc885('0x21')](function(_0x57da16){if(_0x57da16){_0x1c3c03=_0x57da16;_0x3240c0[_0xc885('0x2f')]=_['keys'](db[_0xc885('0x49')][_0xc885('0x2b')]);_0x3240c0[_0xc885('0x31')]=_[_0xc885('0x30')](_0x495aa8[_0xc885('0x31')]);_0x3240c0[_0xc885('0x32')]=_[_0xc885('0x33')](_0x3240c0['model'],_0x3240c0[_0xc885('0x31')]);_0x57aa8f['attributes']=_['intersection'](_0x3240c0[_0xc885('0x2f')],qs[_0xc885('0x35')](_0x495aa8[_0xc885('0x31')][_0xc885('0x35')]));_0x57aa8f['attributes']=_0x57aa8f[_0xc885('0x34')]['length']?_0x57aa8f[_0xc885('0x34')]:_0x3240c0['model'];_0x57aa8f[_0xc885('0x38')]=qs[_0xc885('0x39')](_0x495aa8[_0xc885('0x31')][_0xc885('0x39')]);_0x57aa8f[_0xc885('0x3a')]=qs[_0xc885('0x32')](_[_0xc885('0x4a')](_0x495aa8[_0xc885('0x31')],_0x3240c0[_0xc885('0x32')]));if(_0x495aa8['query']['filter']){_0x57aa8f[_0xc885('0x3a')]=_[_0xc885('0x42')](_0x57aa8f['where'],{'$or':_[_0xc885('0x29')](_0x57aa8f['attributes'],function(_0x1155ff){var _0x7fc798={};_0x7fc798[_0x1155ff]={'$like':'%'+_0x495aa8[_0xc885('0x31')][_0xc885('0x3b')]+'%'};return _0x7fc798;})});}_0x57aa8f=_['merge']({},_0x57aa8f,_0x495aa8['options']);return _0x1c3c03[_0xc885('0x4c')](_0x57aa8f);}})['then'](function(_0xce5e16){if(_0xce5e16){_0x5ee3bd=_0xce5e16['length'];if(!_0x495aa8[_0xc885('0x31')][_0xc885('0x4b')]('nolimit')){_0x57aa8f[_0xc885('0x19')]=qs['limit'](_0x495aa8[_0xc885('0x31')][_0xc885('0x19')]);_0x57aa8f[_0xc885('0x1b')]=qs['offset'](_0x495aa8[_0xc885('0x31')][_0xc885('0x1b')]);}return _0x1c3c03[_0xc885('0x4c')](_0x57aa8f);}})['then'](function(_0x1cfeb){if(_0x1cfeb){return _0x1cfeb?{'count':_0x5ee3bd,'rows':_0x1cfeb}:null;}})[_0xc885('0x21')](respondWithResult(_0x216f55,null))[_0xc885('0x3f')](handleError(_0x216f55,null));};exports[_0xc885('0x4d')]=function(_0x5c928e,_0x1b00e1,_0x209a1a){var _0x142e8e={};var _0x5f3fce={};var _0x270314;var _0x524552;return db['FreshsalesConfiguration'][_0xc885('0x48')]({'where':{'id':_0x5c928e['params']['id']}})['then'](handleEntityNotFound(_0x1b00e1,null))[_0xc885('0x21')](function(_0x2b0554){if(_0x2b0554){_0x270314=_0x2b0554;_0x5f3fce[_0xc885('0x2f')]=_['keys'](db['FreshsalesField'][_0xc885('0x2b')]);_0x5f3fce[_0xc885('0x31')]=_['keys'](_0x5c928e['query']);_0x5f3fce[_0xc885('0x32')]=_[_0xc885('0x33')](_0x5f3fce[_0xc885('0x2f')],_0x5f3fce[_0xc885('0x31')]);_0x142e8e[_0xc885('0x34')]=_[_0xc885('0x33')](_0x5f3fce[_0xc885('0x2f')],qs[_0xc885('0x35')](_0x5c928e[_0xc885('0x31')][_0xc885('0x35')]));_0x142e8e[_0xc885('0x34')]=_0x142e8e['attributes']['length']?_0x142e8e[_0xc885('0x34')]:_0x5f3fce[_0xc885('0x2f')];_0x142e8e[_0xc885('0x38')]=qs[_0xc885('0x39')](_0x5c928e[_0xc885('0x31')][_0xc885('0x39')]);_0x142e8e[_0xc885('0x3a')]=qs[_0xc885('0x32')](_[_0xc885('0x4a')](_0x5c928e[_0xc885('0x31')],_0x5f3fce[_0xc885('0x32')]));if(_0x5c928e['query']['filter']){_0x142e8e[_0xc885('0x3a')]=_[_0xc885('0x42')](_0x142e8e['where'],{'$or':_[_0xc885('0x29')](_0x142e8e[_0xc885('0x34')],function(_0x424da3){var _0x248563={};_0x248563[_0x424da3]={'$like':'%'+_0x5c928e[_0xc885('0x31')]['filter']+'%'};return _0x248563;})});}_0x142e8e=_['merge']({},_0x142e8e,_0x5c928e[_0xc885('0x3c')]);return _0x270314['getFields'](_0x142e8e);}})[_0xc885('0x21')](function(_0x576fcb){if(_0x576fcb){_0x524552=_0x576fcb['length'];if(!_0x5c928e[_0xc885('0x31')][_0xc885('0x4b')](_0xc885('0x37'))){_0x142e8e[_0xc885('0x19')]=qs[_0xc885('0x19')](_0x5c928e[_0xc885('0x31')][_0xc885('0x19')]);_0x142e8e[_0xc885('0x1b')]=qs[_0xc885('0x1b')](_0x5c928e[_0xc885('0x31')][_0xc885('0x1b')]);}return _0x270314[_0xc885('0x4d')](_0x142e8e);}})['then'](function(_0xd0a11d){if(_0xd0a11d){return _0xd0a11d?{'count':_0x524552,'rows':_0xd0a11d}:null;}})['then'](respondWithResult(_0x1b00e1,null))[_0xc885('0x3f')](handleError(_0x1b00e1,null));}; \ No newline at end of file +var _0xf122=['order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','getSubjects','findOne','FreshsalesField','options','nolimit','getDescriptions','getFields','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x3a3ebe,_0x36a3f8){var _0x27ec79=function(_0x26c859){while(--_0x26c859){_0x3a3ebe['push'](_0x3a3ebe['shift']());}};_0x27ec79(++_0x36a3f8);}(_0xf122,0x10f));var _0x2f12=function(_0x1f5d8c,_0x4c1faf){_0x1f5d8c=_0x1f5d8c-0x0;var _0x3847d0=_0xf122[_0x1f5d8c];return _0x3847d0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2f12('0x0'));var jsonpatch=require(_0x2f12('0x1'));var rp=require(_0x2f12('0x2'));var moment=require(_0x2f12('0x3'));var BPromise=require(_0x2f12('0x4'));var Mustache=require('mustache');var util=require(_0x2f12('0x5'));var path=require(_0x2f12('0x6'));var sox=require(_0x2f12('0x7'));var csv=require(_0x2f12('0x8'));var ejs=require(_0x2f12('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f12('0xa'));var squel=require('squel');var crypto=require(_0x2f12('0xb'));var jsforce=require(_0x2f12('0xc'));var deskjs=require(_0x2f12('0xd'));var toCsv=require(_0x2f12('0x8'));var querystring=require(_0x2f12('0xe'));var Papa=require('papaparse');var Redis=require(_0x2f12('0xf'));var authService=require(_0x2f12('0x10'));var qs=require(_0x2f12('0x11'));var as=require(_0x2f12('0x12'));var hardwareService=require(_0x2f12('0x13'));var logger=require('../../config/logger')(_0x2f12('0x14'));var utils=require(_0x2f12('0x15'));var config=require(_0x2f12('0x16'));var licenseUtil=require(_0x2f12('0x17'));var db=require(_0x2f12('0x18'))['db'];function respondWithStatusCode(_0x4c64b0,_0x41a9e4){_0x41a9e4=_0x41a9e4||0xcc;return function(_0x249dc3){if(_0x249dc3){return _0x4c64b0[_0x2f12('0x19')](_0x41a9e4);}return _0x4c64b0[_0x2f12('0x1a')](_0x41a9e4)[_0x2f12('0x1b')]();};}function respondWithResult(_0xad5c6c,_0x4fa54d){_0x4fa54d=_0x4fa54d||0xc8;return function(_0x557a3f){if(_0x557a3f){return _0xad5c6c['status'](_0x4fa54d)[_0x2f12('0x1c')](_0x557a3f);}};}function respondWithFilteredResult(_0x4bce8e,_0x2e589b){return function(_0x3ad97f){if(_0x3ad97f){var _0x49777b=typeof _0x2e589b['offset']===_0x2f12('0x1d')&&typeof _0x2e589b[_0x2f12('0x1e')]===_0x2f12('0x1d');var _0x2c11f3=_0x3ad97f[_0x2f12('0x1f')];var _0x4749b4=_0x49777b?0x0:_0x2e589b[_0x2f12('0x20')];var _0x7d400d=_0x49777b?_0x3ad97f[_0x2f12('0x1f')]:_0x2e589b['offset']+_0x2e589b[_0x2f12('0x1e')];var _0x512960;if(_0x7d400d>=_0x2c11f3){_0x7d400d=_0x2c11f3;_0x512960=0xc8;}else{_0x512960=0xce;}_0x4bce8e[_0x2f12('0x1a')](_0x512960);return _0x4bce8e[_0x2f12('0x21')]('Content-Range',_0x4749b4+'-'+_0x7d400d+'/'+_0x2c11f3)[_0x2f12('0x1c')](_0x3ad97f);}return null;};}function patchUpdates(_0x5411c2){return function(_0x177927){try{jsonpatch[_0x2f12('0x22')](_0x177927,_0x5411c2,!![]);}catch(_0x1e0c50){return BPromise[_0x2f12('0x23')](_0x1e0c50);}return _0x177927['save']();};}function saveUpdates(_0xc5c518,_0x5d8999){return function(_0x2f67b6){if(_0x2f67b6){return _0x2f67b6[_0x2f12('0x24')](_0xc5c518)[_0x2f12('0x25')](function(_0x6b71f7){return _0x6b71f7;});}return null;};}function removeEntity(_0x5c977b,_0x321e0b){return function(_0x5d59d7){if(_0x5d59d7){return _0x5d59d7[_0x2f12('0x26')]()['then'](function(){_0x5c977b[_0x2f12('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cac06,_0x167182){return function(_0xa1715f){if(!_0xa1715f){_0x1cac06['sendStatus'](0x194);}return _0xa1715f;};}function handleError(_0x3684fd,_0x57db23){_0x57db23=_0x57db23||0x1f4;return function(_0x51ee9d){logger[_0x2f12('0x27')](_0x51ee9d[_0x2f12('0x28')]);if(_0x51ee9d[_0x2f12('0x29')]){delete _0x51ee9d['name'];}_0x3684fd[_0x2f12('0x1a')](_0x57db23)[_0x2f12('0x2a')](_0x51ee9d);};}exports['index']=function(_0x399a48,_0x45570c){var _0x204f81={},_0x542a45={},_0x5b52fc={'count':0x0,'rows':[]};var _0x33d0b2=_[_0x2f12('0x2b')](db[_0x2f12('0x2c')][_0x2f12('0x2d')],function(_0x12b3e2){return{'name':_0x12b3e2[_0x2f12('0x2e')],'type':_0x12b3e2[_0x2f12('0x2f')][_0x2f12('0x30')]};});_0x542a45['model']=_[_0x2f12('0x2b')](_0x33d0b2,_0x2f12('0x29'));_0x542a45[_0x2f12('0x31')]=_[_0x2f12('0x32')](_0x399a48[_0x2f12('0x31')]);_0x542a45['filters']=_[_0x2f12('0x33')](_0x542a45[_0x2f12('0x34')],_0x542a45[_0x2f12('0x31')]);_0x204f81[_0x2f12('0x35')]=_[_0x2f12('0x33')](_0x542a45[_0x2f12('0x34')],qs[_0x2f12('0x36')](_0x399a48[_0x2f12('0x31')][_0x2f12('0x36')]));_0x204f81[_0x2f12('0x35')]=_0x204f81[_0x2f12('0x35')][_0x2f12('0x37')]?_0x204f81[_0x2f12('0x35')]:_0x542a45[_0x2f12('0x34')];if(!_0x399a48[_0x2f12('0x31')][_0x2f12('0x38')]('nolimit')){_0x204f81[_0x2f12('0x1e')]=qs['limit'](_0x399a48[_0x2f12('0x31')][_0x2f12('0x1e')]);_0x204f81[_0x2f12('0x20')]=qs[_0x2f12('0x20')](_0x399a48[_0x2f12('0x31')][_0x2f12('0x20')]);}_0x204f81[_0x2f12('0x39')]=qs[_0x2f12('0x3a')](_0x399a48[_0x2f12('0x31')][_0x2f12('0x3a')]);_0x204f81[_0x2f12('0x3b')]=qs[_0x2f12('0x3c')](_[_0x2f12('0x3d')](_0x399a48[_0x2f12('0x31')],_0x542a45[_0x2f12('0x3c')]),_0x33d0b2);if(_0x399a48[_0x2f12('0x31')][_0x2f12('0x3e')]){_0x204f81[_0x2f12('0x3b')]=_[_0x2f12('0x3f')](_0x204f81[_0x2f12('0x3b')],{'$or':_[_0x2f12('0x2b')](_0x33d0b2,function(_0x4dfdc9){if(_0x4dfdc9[_0x2f12('0x2f')]!==_0x2f12('0x40')){var _0x436efd={};_0x436efd[_0x4dfdc9['name']]={'$like':'%'+_0x399a48[_0x2f12('0x31')][_0x2f12('0x3e')]+'%'};return _0x436efd;}})});}_0x204f81=_['merge']({},_0x204f81,_0x399a48['options']);var _0x14808b={'where':_0x204f81[_0x2f12('0x3b')]};return db[_0x2f12('0x2c')]['count'](_0x14808b)[_0x2f12('0x25')](function(_0x3ec7a8){_0x5b52fc[_0x2f12('0x1f')]=_0x3ec7a8;if(_0x399a48['query'][_0x2f12('0x41')]){_0x204f81[_0x2f12('0x42')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x2f12('0x43')](_0x204f81);})[_0x2f12('0x25')](function(_0x7cab90){_0x5b52fc[_0x2f12('0x44')]=_0x7cab90;return _0x5b52fc;})[_0x2f12('0x25')](respondWithFilteredResult(_0x45570c,_0x204f81))[_0x2f12('0x45')](handleError(_0x45570c,null));};exports[_0x2f12('0x46')]=function(_0x3c38ba,_0x18db1e){var _0x1fbf1f={'raw':![],'where':{'id':_0x3c38ba[_0x2f12('0x47')]['id']}},_0x449a30={};_0x449a30[_0x2f12('0x34')]=_[_0x2f12('0x32')](db[_0x2f12('0x2c')][_0x2f12('0x2d')]);_0x449a30['query']=_[_0x2f12('0x32')](_0x3c38ba[_0x2f12('0x31')]);_0x449a30['filters']=_[_0x2f12('0x33')](_0x449a30['model'],_0x449a30[_0x2f12('0x31')]);_0x1fbf1f[_0x2f12('0x35')]=_[_0x2f12('0x33')](_0x449a30[_0x2f12('0x34')],qs[_0x2f12('0x36')](_0x3c38ba['query'][_0x2f12('0x36')]));_0x1fbf1f['attributes']=_0x1fbf1f[_0x2f12('0x35')]['length']?_0x1fbf1f[_0x2f12('0x35')]:_0x449a30['model'];if(_0x3c38ba[_0x2f12('0x31')]['includeAll']){_0x1fbf1f[_0x2f12('0x42')]=[{'all':!![]}];}_0x1fbf1f=_[_0x2f12('0x3f')]({},_0x1fbf1f,_0x3c38ba['options']);return db['FreshsalesConfiguration'][_0x2f12('0x48')](_0x1fbf1f)['then'](handleEntityNotFound(_0x18db1e,null))[_0x2f12('0x25')](respondWithResult(_0x18db1e,null))[_0x2f12('0x45')](handleError(_0x18db1e,null));};exports[_0x2f12('0x49')]=function(_0x5eae96,_0x5293bc){return db[_0x2f12('0x2c')][_0x2f12('0x49')](_0x5eae96[_0x2f12('0x4a')],{})['then'](respondWithResult(_0x5293bc,0xc9))[_0x2f12('0x45')](handleError(_0x5293bc,null));};exports[_0x2f12('0x24')]=function(_0x330a2f,_0x35b375){if(_0x330a2f[_0x2f12('0x4a')]['id']){delete _0x330a2f['body']['id'];}return db[_0x2f12('0x2c')][_0x2f12('0x48')]({'where':{'id':_0x330a2f[_0x2f12('0x47')]['id']}})[_0x2f12('0x25')](handleEntityNotFound(_0x35b375,null))[_0x2f12('0x25')](saveUpdates(_0x330a2f[_0x2f12('0x4a')],null))[_0x2f12('0x25')](respondWithResult(_0x35b375,null))[_0x2f12('0x45')](handleError(_0x35b375,null));};exports[_0x2f12('0x26')]=function(_0x368699,_0x13798e){return db[_0x2f12('0x2c')][_0x2f12('0x48')]({'where':{'id':_0x368699[_0x2f12('0x47')]['id']}})[_0x2f12('0x25')](handleEntityNotFound(_0x13798e,null))[_0x2f12('0x25')](removeEntity(_0x13798e,null))[_0x2f12('0x45')](handleError(_0x13798e,null));};exports[_0x2f12('0x4b')]=function(_0x386439,_0x2f2526,_0x525d0a){var _0x580ea1={};var _0x3f7160={};var _0x5b4ff0;var _0x289360;return db['FreshsalesConfiguration'][_0x2f12('0x4c')]({'where':{'id':_0x386439[_0x2f12('0x47')]['id']}})[_0x2f12('0x25')](handleEntityNotFound(_0x2f2526,null))['then'](function(_0x776743){if(_0x776743){_0x5b4ff0=_0x776743;_0x3f7160[_0x2f12('0x34')]=_[_0x2f12('0x32')](db[_0x2f12('0x4d')][_0x2f12('0x2d')]);_0x3f7160['query']=_[_0x2f12('0x32')](_0x386439[_0x2f12('0x31')]);_0x3f7160[_0x2f12('0x3c')]=_['intersection'](_0x3f7160[_0x2f12('0x34')],_0x3f7160[_0x2f12('0x31')]);_0x580ea1[_0x2f12('0x35')]=_['intersection'](_0x3f7160['model'],qs[_0x2f12('0x36')](_0x386439[_0x2f12('0x31')][_0x2f12('0x36')]));_0x580ea1[_0x2f12('0x35')]=_0x580ea1['attributes'][_0x2f12('0x37')]?_0x580ea1['attributes']:_0x3f7160['model'];_0x580ea1['order']=qs[_0x2f12('0x3a')](_0x386439[_0x2f12('0x31')][_0x2f12('0x3a')]);_0x580ea1[_0x2f12('0x3b')]=qs['filters'](_[_0x2f12('0x3d')](_0x386439[_0x2f12('0x31')],_0x3f7160['filters']));if(_0x386439['query'][_0x2f12('0x3e')]){_0x580ea1[_0x2f12('0x3b')]=_[_0x2f12('0x3f')](_0x580ea1['where'],{'$or':_[_0x2f12('0x2b')](_0x580ea1['attributes'],function(_0x2a82ee){var _0x180051={};_0x180051[_0x2a82ee]={'$like':'%'+_0x386439[_0x2f12('0x31')][_0x2f12('0x3e')]+'%'};return _0x180051;})});}_0x580ea1=_[_0x2f12('0x3f')]({},_0x580ea1,_0x386439[_0x2f12('0x4e')]);return _0x5b4ff0[_0x2f12('0x4b')](_0x580ea1);}})[_0x2f12('0x25')](function(_0x36dcca){if(_0x36dcca){_0x289360=_0x36dcca[_0x2f12('0x37')];if(!_0x386439[_0x2f12('0x31')][_0x2f12('0x38')](_0x2f12('0x4f'))){_0x580ea1['limit']=qs[_0x2f12('0x1e')](_0x386439[_0x2f12('0x31')]['limit']);_0x580ea1[_0x2f12('0x20')]=qs[_0x2f12('0x20')](_0x386439[_0x2f12('0x31')][_0x2f12('0x20')]);}return _0x5b4ff0[_0x2f12('0x4b')](_0x580ea1);}})[_0x2f12('0x25')](function(_0x325d08){if(_0x325d08){return _0x325d08?{'count':_0x289360,'rows':_0x325d08}:null;}})[_0x2f12('0x25')](respondWithResult(_0x2f2526,null))[_0x2f12('0x45')](handleError(_0x2f2526,null));};exports[_0x2f12('0x50')]=function(_0x12ffd8,_0x5c1074,_0x2ede39){var _0x326c01={};var _0x490f23={};var _0x368f40;var _0x45f1a9;return db[_0x2f12('0x2c')][_0x2f12('0x4c')]({'where':{'id':_0x12ffd8['params']['id']}})[_0x2f12('0x25')](handleEntityNotFound(_0x5c1074,null))['then'](function(_0xc8cc95){if(_0xc8cc95){_0x368f40=_0xc8cc95;_0x490f23['model']=_['keys'](db[_0x2f12('0x4d')][_0x2f12('0x2d')]);_0x490f23[_0x2f12('0x31')]=_[_0x2f12('0x32')](_0x12ffd8[_0x2f12('0x31')]);_0x490f23[_0x2f12('0x3c')]=_[_0x2f12('0x33')](_0x490f23[_0x2f12('0x34')],_0x490f23[_0x2f12('0x31')]);_0x326c01[_0x2f12('0x35')]=_[_0x2f12('0x33')](_0x490f23['model'],qs['fields'](_0x12ffd8[_0x2f12('0x31')][_0x2f12('0x36')]));_0x326c01[_0x2f12('0x35')]=_0x326c01[_0x2f12('0x35')][_0x2f12('0x37')]?_0x326c01[_0x2f12('0x35')]:_0x490f23[_0x2f12('0x34')];_0x326c01['order']=qs[_0x2f12('0x3a')](_0x12ffd8[_0x2f12('0x31')][_0x2f12('0x3a')]);_0x326c01[_0x2f12('0x3b')]=qs[_0x2f12('0x3c')](_[_0x2f12('0x3d')](_0x12ffd8['query'],_0x490f23[_0x2f12('0x3c')]));if(_0x12ffd8[_0x2f12('0x31')][_0x2f12('0x3e')]){_0x326c01[_0x2f12('0x3b')]=_[_0x2f12('0x3f')](_0x326c01[_0x2f12('0x3b')],{'$or':_[_0x2f12('0x2b')](_0x326c01[_0x2f12('0x35')],function(_0x563100){var _0x3cd644={};_0x3cd644[_0x563100]={'$like':'%'+_0x12ffd8[_0x2f12('0x31')][_0x2f12('0x3e')]+'%'};return _0x3cd644;})});}_0x326c01=_['merge']({},_0x326c01,_0x12ffd8[_0x2f12('0x4e')]);return _0x368f40['getDescriptions'](_0x326c01);}})[_0x2f12('0x25')](function(_0x233d36){if(_0x233d36){_0x45f1a9=_0x233d36[_0x2f12('0x37')];if(!_0x12ffd8['query'][_0x2f12('0x38')](_0x2f12('0x4f'))){_0x326c01[_0x2f12('0x1e')]=qs[_0x2f12('0x1e')](_0x12ffd8['query'][_0x2f12('0x1e')]);_0x326c01[_0x2f12('0x20')]=qs[_0x2f12('0x20')](_0x12ffd8[_0x2f12('0x31')][_0x2f12('0x20')]);}return _0x368f40[_0x2f12('0x50')](_0x326c01);}})['then'](function(_0x59d6f9){if(_0x59d6f9){return _0x59d6f9?{'count':_0x45f1a9,'rows':_0x59d6f9}:null;}})['then'](respondWithResult(_0x5c1074,null))[_0x2f12('0x45')](handleError(_0x5c1074,null));};exports[_0x2f12('0x51')]=function(_0x439d10,_0x498e60,_0x2ef532){var _0x485392={};var _0x2831e3={};var _0x55caa1;var _0x4bdfb3;return db[_0x2f12('0x2c')][_0x2f12('0x4c')]({'where':{'id':_0x439d10['params']['id']}})[_0x2f12('0x25')](handleEntityNotFound(_0x498e60,null))[_0x2f12('0x25')](function(_0xc8fb79){if(_0xc8fb79){_0x55caa1=_0xc8fb79;_0x2831e3['model']=_['keys'](db[_0x2f12('0x4d')][_0x2f12('0x2d')]);_0x2831e3[_0x2f12('0x31')]=_[_0x2f12('0x32')](_0x439d10[_0x2f12('0x31')]);_0x2831e3[_0x2f12('0x3c')]=_[_0x2f12('0x33')](_0x2831e3[_0x2f12('0x34')],_0x2831e3['query']);_0x485392[_0x2f12('0x35')]=_[_0x2f12('0x33')](_0x2831e3[_0x2f12('0x34')],qs[_0x2f12('0x36')](_0x439d10[_0x2f12('0x31')][_0x2f12('0x36')]));_0x485392[_0x2f12('0x35')]=_0x485392[_0x2f12('0x35')][_0x2f12('0x37')]?_0x485392[_0x2f12('0x35')]:_0x2831e3['model'];_0x485392['order']=qs['sort'](_0x439d10[_0x2f12('0x31')][_0x2f12('0x3a')]);_0x485392[_0x2f12('0x3b')]=qs[_0x2f12('0x3c')](_[_0x2f12('0x3d')](_0x439d10[_0x2f12('0x31')],_0x2831e3[_0x2f12('0x3c')]));if(_0x439d10[_0x2f12('0x31')][_0x2f12('0x3e')]){_0x485392['where']=_[_0x2f12('0x3f')](_0x485392[_0x2f12('0x3b')],{'$or':_[_0x2f12('0x2b')](_0x485392[_0x2f12('0x35')],function(_0x1295fb){var _0x11cb11={};_0x11cb11[_0x1295fb]={'$like':'%'+_0x439d10[_0x2f12('0x31')][_0x2f12('0x3e')]+'%'};return _0x11cb11;})});}_0x485392=_[_0x2f12('0x3f')]({},_0x485392,_0x439d10[_0x2f12('0x4e')]);return _0x55caa1[_0x2f12('0x51')](_0x485392);}})[_0x2f12('0x25')](function(_0x4b5a2f){if(_0x4b5a2f){_0x4bdfb3=_0x4b5a2f[_0x2f12('0x37')];if(!_0x439d10[_0x2f12('0x31')][_0x2f12('0x38')]('nolimit')){_0x485392[_0x2f12('0x1e')]=qs['limit'](_0x439d10[_0x2f12('0x31')][_0x2f12('0x1e')]);_0x485392[_0x2f12('0x20')]=qs['offset'](_0x439d10[_0x2f12('0x31')][_0x2f12('0x20')]);}return _0x55caa1[_0x2f12('0x51')](_0x485392);}})[_0x2f12('0x25')](function(_0x26a7bc){if(_0x26a7bc){return _0x26a7bc?{'count':_0x4bdfb3,'rows':_0x26a7bc}:null;}})[_0x2f12('0x25')](respondWithResult(_0x498e60,null))[_0x2f12('0x45')](handleError(_0x498e60,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 6deeb30..700f2fe 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4eb3=['bluebird','rimraf','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','api','moment'];(function(_0x2671cf,_0x5293f8){var _0x18d8d9=function(_0x3ea75e){while(--_0x3ea75e){_0x2671cf['push'](_0x2671cf['shift']());}};_0x18d8d9(++_0x5293f8);}(_0x4eb3,0x76));var _0x34eb=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x4eb3[_0x284807];return _0x50c774;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x34eb('0x0'));var moment=require(_0x34eb('0x1'));var BPromise=require(_0x34eb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x34eb('0x3'));var config=require('../../config/environment');var attributes=require(_0x34eb('0x4'));module[_0x34eb('0x5')]=function(_0x198275,_0x42d3ac){return _0x198275[_0x34eb('0x6')]('FreshsalesConfiguration',attributes,{'tableName':_0x34eb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b0c=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesConfiguration.attributes'];(function(_0x5c02e6,_0x5848fd){var _0x2f0c79=function(_0x5da959){while(--_0x5da959){_0x5c02e6['push'](_0x5c02e6['shift']());}};_0x2f0c79(++_0x5848fd);}(_0x7b0c,0x1a4));var _0xc7b0=function(_0xbfb53e,_0x4d20ea){_0xbfb53e=_0xbfb53e-0x0;var _0x30ba7e=_0x7b0c[_0xbfb53e];return _0x30ba7e;};'use strict';var _=require(_0xc7b0('0x0'));var util=require(_0xc7b0('0x1'));var logger=require(_0xc7b0('0x2'))(_0xc7b0('0x3'));var moment=require(_0xc7b0('0x4'));var BPromise=require(_0xc7b0('0x5'));var rp=require(_0xc7b0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7b0('0x7'));var config=require('../../config/environment');var attributes=require(_0xc7b0('0x8'));module[_0xc7b0('0x9')]=function(_0x2509ec,_0x5d7f13){return _0x2509ec[_0xc7b0('0xa')](_0xc7b0('0xb'),attributes,{'tableName':_0xc7b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index dd010d6..5d76c72 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf754=['http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x488bba,_0x22829b){var _0x54b4b0=function(_0x42af4e){while(--_0x42af4e){_0x488bba['push'](_0x488bba['shift']());}};_0x54b4b0(++_0x22829b);}(_0xf754,0xd6));var _0x4f75=function(_0x5264d0,_0xeef3b8){_0x5264d0=_0x5264d0-0x0;var _0x3219bf=_0xf754[_0x5264d0];return _0x3219bf;};'use strict';var _=require('lodash');var util=require(_0x4f75('0x0'));var moment=require(_0x4f75('0x1'));var BPromise=require(_0x4f75('0x2'));var rs=require(_0x4f75('0x3'));var fs=require('fs');var Redis=require(_0x4f75('0x4'));var db=require(_0x4f75('0x5'))['db'];var utils=require(_0x4f75('0x6'));var logger=require(_0x4f75('0x7'))(_0x4f75('0x8'));var config=require('../../config/environment');var jayson=require(_0x4f75('0x9'));var client=jayson[_0x4f75('0xa')][_0x4f75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423c3d,_0x56b472,_0x405cbe){return new BPromise(function(_0x4f4163,_0x10a01d){return client[_0x4f75('0xc')](_0x423c3d,_0x405cbe)[_0x4f75('0xd')](function(_0x256609){logger[_0x4f75('0xe')](_0x4f75('0xf'),_0x56b472,_0x4f75('0x10'));logger[_0x4f75('0x11')](_0x4f75('0x12'),_0x56b472,_0x4f75('0x10'),JSON[_0x4f75('0x13')](_0x256609));if(_0x256609[_0x4f75('0x14')]){if(_0x256609[_0x4f75('0x14')][_0x4f75('0x15')]===0x1f4){logger[_0x4f75('0x14')](_0x4f75('0xf'),_0x56b472,_0x256609[_0x4f75('0x14')][_0x4f75('0x16')]);return _0x10a01d(_0x256609[_0x4f75('0x14')][_0x4f75('0x16')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x56b472,_0x256609['error'][_0x4f75('0x16')]);return _0x4f4163(_0x256609[_0x4f75('0x14')][_0x4f75('0x16')]);}else{logger['info'](_0x4f75('0xf'),_0x56b472,_0x4f75('0x10'));_0x4f4163(_0x256609[_0x4f75('0x17')]['message']);}})[_0x4f75('0x18')](function(_0x139213){logger[_0x4f75('0x14')](_0x4f75('0xf'),_0x56b472,_0x139213);_0x10a01d(_0x139213);});});} \ No newline at end of file +var _0x1644=['FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x10795b,_0x514e41){var _0x1356a3=function(_0x50b107){while(--_0x50b107){_0x10795b['push'](_0x10795b['shift']());}};_0x1356a3(++_0x514e41);}(_0x1644,0x1ab));var _0x4164=function(_0x11f598,_0x5a2990){_0x11f598=_0x11f598-0x0;var _0x2a37dc=_0x1644[_0x11f598];return _0x2a37dc;};'use strict';var _=require('lodash');var util=require(_0x4164('0x0'));var moment=require('moment');var BPromise=require(_0x4164('0x1'));var rs=require(_0x4164('0x2'));var fs=require('fs');var Redis=require(_0x4164('0x3'));var db=require(_0x4164('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4164('0x5'))(_0x4164('0x6'));var config=require(_0x4164('0x7'));var jayson=require(_0x4164('0x8'));var client=jayson[_0x4164('0x9')][_0x4164('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a6c13,_0x180e2c,_0x5d26a9){return new BPromise(function(_0x5bad90,_0x2fd388){return client['request'](_0x2a6c13,_0x5d26a9)[_0x4164('0xb')](function(_0x238e17){logger[_0x4164('0xc')](_0x4164('0xd'),_0x180e2c,'request\x20sent');logger['debug'](_0x4164('0xe'),_0x180e2c,_0x4164('0xf'),JSON[_0x4164('0x10')](_0x238e17));if(_0x238e17[_0x4164('0x11')]){if(_0x238e17[_0x4164('0x11')][_0x4164('0x12')]===0x1f4){logger[_0x4164('0x11')](_0x4164('0xd'),_0x180e2c,_0x238e17['error'][_0x4164('0x13')]);return _0x2fd388(_0x238e17[_0x4164('0x11')][_0x4164('0x13')]);}logger[_0x4164('0x11')](_0x4164('0xd'),_0x180e2c,_0x238e17[_0x4164('0x11')][_0x4164('0x13')]);return _0x5bad90(_0x238e17['error'][_0x4164('0x13')]);}else{logger[_0x4164('0xc')](_0x4164('0xd'),_0x180e2c,'request\x20sent');_0x5bad90(_0x238e17[_0x4164('0x14')][_0x4164('0x13')]);}})[_0x4164('0x15')](function(_0x2a970c){logger[_0x4164('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x180e2c,_0x2a970c);_0x2fd388(_0x2a970c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 0fea6fc..5f11b1d 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc03=['post','create','put','update','delete','/:id','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x1b2d69,_0x110fc5){var _0xde706a=function(_0x43b9d0){while(--_0x43b9d0){_0x1b2d69['push'](_0x1b2d69['shift']());}};_0xde706a(++_0x110fc5);}(_0xfc03,0x16f));var _0x3fc0=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xfc03[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0x3fc0('0x0'));var util=require('util');var path=require(_0x3fc0('0x1'));var timeout=require(_0x3fc0('0x2'));var express=require('express');var router=express[_0x3fc0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3fc0('0x4'));var interaction=require(_0x3fc0('0x5'));var config=require(_0x3fc0('0x6'));var controller=require(_0x3fc0('0x7'));router[_0x3fc0('0x8')]('/',auth[_0x3fc0('0x9')](),controller[_0x3fc0('0xa')]);router[_0x3fc0('0x8')]('/:id',auth[_0x3fc0('0x9')](),controller['show']);router[_0x3fc0('0xb')]('/',auth[_0x3fc0('0x9')](),controller[_0x3fc0('0xc')]);router[_0x3fc0('0xd')]('/:id',auth[_0x3fc0('0x9')](),controller[_0x3fc0('0xe')]);router[_0x3fc0('0xf')](_0x3fc0('0x10'),auth[_0x3fc0('0x9')](),controller['destroy']);module[_0x3fc0('0x11')]=router; \ No newline at end of file +var _0x0911=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x0911,0x1a9));var _0x1091=function(_0x280c4b,_0xfe785d){_0x280c4b=_0x280c4b-0x0;var _0x2a5e90=_0x0911[_0x280c4b];return _0x2a5e90;};'use strict';var multer=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var path=require(_0x1091('0x2'));var timeout=require(_0x1091('0x3'));var express=require(_0x1091('0x4'));var router=express['Router']();var fs_extra=require(_0x1091('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1091('0x6'));var config=require(_0x1091('0x7'));var controller=require(_0x1091('0x8'));router[_0x1091('0x9')]('/',auth[_0x1091('0xa')](),controller[_0x1091('0xb')]);router[_0x1091('0x9')](_0x1091('0xc'),auth[_0x1091('0xa')](),controller[_0x1091('0xd')]);router['post']('/',auth[_0x1091('0xa')](),controller[_0x1091('0xe')]);router[_0x1091('0xf')](_0x1091('0xc'),auth[_0x1091('0xa')](),controller[_0x1091('0x10')]);router['delete'](_0x1091('0xc'),auth[_0x1091('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2572989..1b87560 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.attributes.js +++ b/server/api/intFreshsalesField/intFreshsalesField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0234=['exports','ENUM','customVariable','keyValue','picklist','string','STRING','variable','sequelize'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0234,0xb3));var _0x4023=function(_0x5086f7,_0x35bb69){_0x5086f7=_0x5086f7-0x0;var _0x253f9b=_0x0234[_0x5086f7];return _0x253f9b;};'use strict';var Sequelize=require(_0x4023('0x0'));module[_0x4023('0x1')]={'type':{'type':Sequelize[_0x4023('0x2')]('string','variable',_0x4023('0x3'),_0x4023('0x4'),_0x4023('0x5')),'defaultValue':_0x4023('0x6')},'content':{'type':Sequelize[_0x4023('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4023('0x2')](_0x4023('0x6'),_0x4023('0x8'),_0x4023('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4023('0x7')]},'nameField':{'type':Sequelize[_0x4023('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4023('0x7')]}}; \ No newline at end of file +var _0x807e=['STRING','variable','sequelize','ENUM','string','customVariable','keyValue'];(function(_0x1a47b7,_0x19e548){var _0x33dad0=function(_0x5d2e29){while(--_0x5d2e29){_0x1a47b7['push'](_0x1a47b7['shift']());}};_0x33dad0(++_0x19e548);}(_0x807e,0x136));var _0xe807=function(_0x1cafb9,_0x1f3d29){_0x1cafb9=_0x1cafb9-0x0;var _0x32d7a3=_0x807e[_0x1cafb9];return _0x32d7a3;};'use strict';var Sequelize=require(_0xe807('0x0'));module['exports']={'type':{'type':Sequelize[_0xe807('0x1')](_0xe807('0x2'),'variable',_0xe807('0x3'),_0xe807('0x4'),'picklist'),'defaultValue':_0xe807('0x2')},'content':{'type':Sequelize[_0xe807('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xe807('0x6'),_0xe807('0x3'))},'keyContent':{'type':Sequelize[_0xe807('0x5')]},'idField':{'type':Sequelize[_0xe807('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe807('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 0c15291..b7b4a14 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.controller.js +++ b/server/api/intFreshsalesField/intFreshsalesField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdab6=['map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','findAll','catch','show','params','rawAttributes','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','apply','save','update','destroy','then','error','stack','name','index','FreshsalesField','fieldName','type','model'];(function(_0x41b5c9,_0x5e0bbb){var _0x359fb3=function(_0x2baeb){while(--_0x2baeb){_0x41b5c9['push'](_0x41b5c9['shift']());}};_0x359fb3(++_0x5e0bbb);}(_0xdab6,0x1d8));var _0x6dab=function(_0x50174f,_0xc095c1){_0x50174f=_0x50174f-0x0;var _0x352da3=_0xdab6[_0x50174f];return _0x352da3;};'use strict';var emlformat=require(_0x6dab('0x0'));var rimraf=require(_0x6dab('0x1'));var zipdir=require(_0x6dab('0x2'));var jsonpatch=require(_0x6dab('0x3'));var rp=require(_0x6dab('0x4'));var moment=require('moment');var BPromise=require(_0x6dab('0x5'));var Mustache=require(_0x6dab('0x6'));var util=require(_0x6dab('0x7'));var path=require(_0x6dab('0x8'));var sox=require('sox');var csv=require(_0x6dab('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6dab('0xa'));var _=require(_0x6dab('0xb'));var squel=require('squel');var crypto=require(_0x6dab('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6dab('0xd'));var toCsv=require(_0x6dab('0x9'));var querystring=require(_0x6dab('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6dab('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dab('0x10'))('api');var utils=require(_0x6dab('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6dab('0x12'));var db=require(_0x6dab('0x13'))['db'];function respondWithStatusCode(_0x343acb,_0xc5ba4f){_0xc5ba4f=_0xc5ba4f||0xcc;return function(_0x462564){if(_0x462564){return _0x343acb[_0x6dab('0x14')](_0xc5ba4f);}return _0x343acb['status'](_0xc5ba4f)[_0x6dab('0x15')]();};}function respondWithResult(_0x48cbb9,_0x1751e5){_0x1751e5=_0x1751e5||0xc8;return function(_0x1c6c32){if(_0x1c6c32){return _0x48cbb9[_0x6dab('0x16')](_0x1751e5)[_0x6dab('0x17')](_0x1c6c32);}};}function respondWithFilteredResult(_0x470c13,_0x158dad){return function(_0x3b32e5){if(_0x3b32e5){var _0x34692f=typeof _0x158dad[_0x6dab('0x18')]==='undefined'&&typeof _0x158dad[_0x6dab('0x19')]==='undefined';var _0x3da9ad=_0x3b32e5[_0x6dab('0x1a')];var _0x3d3e87=_0x34692f?0x0:_0x158dad[_0x6dab('0x18')];var _0x58dfec=_0x34692f?_0x3b32e5[_0x6dab('0x1a')]:_0x158dad[_0x6dab('0x18')]+_0x158dad['limit'];var _0x1be5a6;if(_0x58dfec>=_0x3da9ad){_0x58dfec=_0x3da9ad;_0x1be5a6=0xc8;}else{_0x1be5a6=0xce;}_0x470c13[_0x6dab('0x16')](_0x1be5a6);return _0x470c13['set']('Content-Range',_0x3d3e87+'-'+_0x58dfec+'/'+_0x3da9ad)[_0x6dab('0x17')](_0x3b32e5);}return null;};}function patchUpdates(_0x57adac){return function(_0x454046){try{jsonpatch[_0x6dab('0x1b')](_0x454046,_0x57adac,!![]);}catch(_0x1753e8){return BPromise['reject'](_0x1753e8);}return _0x454046[_0x6dab('0x1c')]();};}function saveUpdates(_0x2e470e,_0x48debe){return function(_0x3a9944){if(_0x3a9944){return _0x3a9944[_0x6dab('0x1d')](_0x2e470e)['then'](function(_0x1a6995){return _0x1a6995;});}return null;};}function removeEntity(_0x3b8d08,_0x12d105){return function(_0x2dfdd5){if(_0x2dfdd5){return _0x2dfdd5[_0x6dab('0x1e')]()[_0x6dab('0x1f')](function(){_0x3b8d08[_0x6dab('0x16')](0xcc)[_0x6dab('0x15')]();});}};}function handleEntityNotFound(_0x55232f,_0x589351){return function(_0xced469){if(!_0xced469){_0x55232f[_0x6dab('0x14')](0x194);}return _0xced469;};}function handleError(_0x4bd580,_0x4767db){_0x4767db=_0x4767db||0x1f4;return function(_0x216914){logger[_0x6dab('0x20')](_0x216914[_0x6dab('0x21')]);if(_0x216914[_0x6dab('0x22')]){delete _0x216914[_0x6dab('0x22')];}_0x4bd580[_0x6dab('0x16')](_0x4767db)['send'](_0x216914);};}exports[_0x6dab('0x23')]=function(_0x527e90,_0x2988c7){var _0x14c19e={},_0x156d83={},_0x3e5d72={'count':0x0,'rows':[]};var _0x10f842=_['map'](db[_0x6dab('0x24')]['rawAttributes'],function(_0x4f8251){return{'name':_0x4f8251[_0x6dab('0x25')],'type':_0x4f8251[_0x6dab('0x26')]['key']};});_0x156d83[_0x6dab('0x27')]=_[_0x6dab('0x28')](_0x10f842,_0x6dab('0x22'));_0x156d83['query']=_[_0x6dab('0x29')](_0x527e90[_0x6dab('0x2a')]);_0x156d83[_0x6dab('0x2b')]=_[_0x6dab('0x2c')](_0x156d83['model'],_0x156d83['query']);_0x14c19e[_0x6dab('0x2d')]=_['intersection'](_0x156d83[_0x6dab('0x27')],qs['fields'](_0x527e90['query'][_0x6dab('0x2e')]));_0x14c19e['attributes']=_0x14c19e[_0x6dab('0x2d')]['length']?_0x14c19e[_0x6dab('0x2d')]:_0x156d83[_0x6dab('0x27')];if(!_0x527e90[_0x6dab('0x2a')][_0x6dab('0x2f')]('nolimit')){_0x14c19e[_0x6dab('0x19')]=qs[_0x6dab('0x19')](_0x527e90['query'][_0x6dab('0x19')]);_0x14c19e[_0x6dab('0x18')]=qs[_0x6dab('0x18')](_0x527e90[_0x6dab('0x2a')][_0x6dab('0x18')]);}_0x14c19e[_0x6dab('0x30')]=qs[_0x6dab('0x31')](_0x527e90[_0x6dab('0x2a')]['sort']);_0x14c19e['where']=qs[_0x6dab('0x2b')](_[_0x6dab('0x32')](_0x527e90[_0x6dab('0x2a')],_0x156d83[_0x6dab('0x2b')]),_0x10f842);if(_0x527e90[_0x6dab('0x2a')][_0x6dab('0x33')]){_0x14c19e[_0x6dab('0x34')]=_[_0x6dab('0x35')](_0x14c19e[_0x6dab('0x34')],{'$or':_[_0x6dab('0x28')](_0x10f842,function(_0x2d7570){if(_0x2d7570[_0x6dab('0x26')]!=='VIRTUAL'){var _0x2ff318={};_0x2ff318[_0x2d7570['name']]={'$like':'%'+_0x527e90['query']['filter']+'%'};return _0x2ff318;}})});}_0x14c19e=_['merge']({},_0x14c19e,_0x527e90['options']);var _0x1d577e={'where':_0x14c19e['where']};return db[_0x6dab('0x24')]['count'](_0x1d577e)[_0x6dab('0x1f')](function(_0x3a4c91){_0x3e5d72[_0x6dab('0x1a')]=_0x3a4c91;if(_0x527e90[_0x6dab('0x2a')][_0x6dab('0x36')]){_0x14c19e['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x6dab('0x37')](_0x14c19e);})[_0x6dab('0x1f')](function(_0x451daa){_0x3e5d72['rows']=_0x451daa;return _0x3e5d72;})[_0x6dab('0x1f')](respondWithFilteredResult(_0x2988c7,_0x14c19e))[_0x6dab('0x38')](handleError(_0x2988c7,null));};exports[_0x6dab('0x39')]=function(_0x5e4764,_0x1d0387){var _0x18b2ed={'raw':!![],'where':{'id':_0x5e4764[_0x6dab('0x3a')]['id']}},_0x2fbd75={};_0x2fbd75[_0x6dab('0x27')]=_[_0x6dab('0x29')](db[_0x6dab('0x24')][_0x6dab('0x3b')]);_0x2fbd75[_0x6dab('0x2a')]=_['keys'](_0x5e4764[_0x6dab('0x2a')]);_0x2fbd75[_0x6dab('0x2b')]=_['intersection'](_0x2fbd75[_0x6dab('0x27')],_0x2fbd75['query']);_0x18b2ed[_0x6dab('0x2d')]=_[_0x6dab('0x2c')](_0x2fbd75[_0x6dab('0x27')],qs[_0x6dab('0x2e')](_0x5e4764[_0x6dab('0x2a')][_0x6dab('0x2e')]));_0x18b2ed[_0x6dab('0x2d')]=_0x18b2ed['attributes'][_0x6dab('0x3c')]?_0x18b2ed[_0x6dab('0x2d')]:_0x2fbd75['model'];if(_0x5e4764[_0x6dab('0x2a')][_0x6dab('0x36')]){_0x18b2ed['include']=[{'all':!![]}];}_0x18b2ed=_['merge']({},_0x18b2ed,_0x5e4764['options']);return db[_0x6dab('0x24')]['find'](_0x18b2ed)['then'](handleEntityNotFound(_0x1d0387,null))[_0x6dab('0x1f')](respondWithResult(_0x1d0387,null))[_0x6dab('0x38')](handleError(_0x1d0387,null));};exports['create']=function(_0x47556c,_0x2f3f74){return db[_0x6dab('0x24')][_0x6dab('0x3d')](_0x47556c[_0x6dab('0x3e')],{})[_0x6dab('0x1f')](respondWithResult(_0x2f3f74,0xc9))[_0x6dab('0x38')](handleError(_0x2f3f74,null));};exports[_0x6dab('0x1d')]=function(_0x322e43,_0x52ee4e){if(_0x322e43[_0x6dab('0x3e')]['id']){delete _0x322e43[_0x6dab('0x3e')]['id'];}return db['FreshsalesField'][_0x6dab('0x3f')]({'where':{'id':_0x322e43[_0x6dab('0x3a')]['id']}})[_0x6dab('0x1f')](handleEntityNotFound(_0x52ee4e,null))[_0x6dab('0x1f')](saveUpdates(_0x322e43[_0x6dab('0x3e')],null))[_0x6dab('0x1f')](respondWithResult(_0x52ee4e,null))[_0x6dab('0x38')](handleError(_0x52ee4e,null));};exports[_0x6dab('0x1e')]=function(_0x11af50,_0x1a46b7){return db[_0x6dab('0x24')][_0x6dab('0x3f')]({'where':{'id':_0x11af50[_0x6dab('0x3a')]['id']}})[_0x6dab('0x1f')](handleEntityNotFound(_0x1a46b7,null))[_0x6dab('0x1f')](removeEntity(_0x1a46b7,null))[_0x6dab('0x38')](handleError(_0x1a46b7,null));}; \ No newline at end of file +var _0xe4f4=['order','sort','where','filters','merge','type','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','index','map','FreshsalesField','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x443bd4,_0x9b1972){var _0x91a1d4=function(_0x1d46ed){while(--_0x1d46ed){_0x443bd4['push'](_0x443bd4['shift']());}};_0x91a1d4(++_0x9b1972);}(_0xe4f4,0x139));var _0x4e4f=function(_0x3c4e48,_0x43a5eb){_0x3c4e48=_0x3c4e48-0x0;var _0x37fd7e=_0xe4f4[_0x3c4e48];return _0x37fd7e;};'use strict';var emlformat=require(_0x4e4f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e4f('0x1'));var jsonpatch=require(_0x4e4f('0x2'));var rp=require('request-promise');var moment=require(_0x4e4f('0x3'));var BPromise=require(_0x4e4f('0x4'));var Mustache=require(_0x4e4f('0x5'));var util=require(_0x4e4f('0x6'));var path=require(_0x4e4f('0x7'));var sox=require(_0x4e4f('0x8'));var csv=require(_0x4e4f('0x9'));var ejs=require(_0x4e4f('0xa'));var fs=require('fs');var fs_extra=require(_0x4e4f('0xb'));var _=require(_0x4e4f('0xc'));var squel=require(_0x4e4f('0xd'));var crypto=require('crypto');var jsforce=require(_0x4e4f('0xe'));var deskjs=require(_0x4e4f('0xf'));var toCsv=require(_0x4e4f('0x9'));var querystring=require('querystring');var Papa=require(_0x4e4f('0x10'));var Redis=require(_0x4e4f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4e4f('0x12'));var as=require(_0x4e4f('0x13'));var hardwareService=require(_0x4e4f('0x14'));var logger=require(_0x4e4f('0x15'))(_0x4e4f('0x16'));var utils=require(_0x4e4f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29917f,_0x5017fe){_0x5017fe=_0x5017fe||0xcc;return function(_0x2d03b5){if(_0x2d03b5){return _0x29917f['sendStatus'](_0x5017fe);}return _0x29917f['status'](_0x5017fe)['end']();};}function respondWithResult(_0x58fbce,_0x143e6c){_0x143e6c=_0x143e6c||0xc8;return function(_0x4c7ad0){if(_0x4c7ad0){return _0x58fbce[_0x4e4f('0x18')](_0x143e6c)[_0x4e4f('0x19')](_0x4c7ad0);}};}function respondWithFilteredResult(_0xa6b02c,_0x45a408){return function(_0x47ef92){if(_0x47ef92){var _0x1c7a12=typeof _0x45a408[_0x4e4f('0x1a')]===_0x4e4f('0x1b')&&typeof _0x45a408[_0x4e4f('0x1c')]===_0x4e4f('0x1b');var _0x1f2fe9=_0x47ef92['count'];var _0x131cb6=_0x1c7a12?0x0:_0x45a408[_0x4e4f('0x1a')];var _0x54388a=_0x1c7a12?_0x47ef92[_0x4e4f('0x1d')]:_0x45a408['offset']+_0x45a408[_0x4e4f('0x1c')];var _0x467d35;if(_0x54388a>=_0x1f2fe9){_0x54388a=_0x1f2fe9;_0x467d35=0xc8;}else{_0x467d35=0xce;}_0xa6b02c['status'](_0x467d35);return _0xa6b02c[_0x4e4f('0x1e')](_0x4e4f('0x1f'),_0x131cb6+'-'+_0x54388a+'/'+_0x1f2fe9)[_0x4e4f('0x19')](_0x47ef92);}return null;};}function patchUpdates(_0x33175a){return function(_0x581bc6){try{jsonpatch[_0x4e4f('0x20')](_0x581bc6,_0x33175a,!![]);}catch(_0xe25acc){return BPromise[_0x4e4f('0x21')](_0xe25acc);}return _0x581bc6[_0x4e4f('0x22')]();};}function saveUpdates(_0x27644a,_0x27a46f){return function(_0x2bff56){if(_0x2bff56){return _0x2bff56[_0x4e4f('0x23')](_0x27644a)['then'](function(_0xdf076d){return _0xdf076d;});}return null;};}function removeEntity(_0x41a809,_0x38a7fe){return function(_0x124482){if(_0x124482){return _0x124482[_0x4e4f('0x24')]()[_0x4e4f('0x25')](function(){_0x41a809[_0x4e4f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x439970,_0x4b3907){return function(_0x1fbd30){if(!_0x1fbd30){_0x439970['sendStatus'](0x194);}return _0x1fbd30;};}function handleError(_0x4de24e,_0x2cb76c){_0x2cb76c=_0x2cb76c||0x1f4;return function(_0x312871){logger[_0x4e4f('0x26')](_0x312871['stack']);if(_0x312871['name']){delete _0x312871['name'];}_0x4de24e[_0x4e4f('0x18')](_0x2cb76c)['send'](_0x312871);};}exports[_0x4e4f('0x27')]=function(_0x1aab80,_0x52f4bd){var _0x579ac0={},_0x3fad7b={},_0x95c017={'count':0x0,'rows':[]};var _0x361a74=_[_0x4e4f('0x28')](db[_0x4e4f('0x29')][_0x4e4f('0x2a')],function(_0x3bf9e7){return{'name':_0x3bf9e7[_0x4e4f('0x2b')],'type':_0x3bf9e7['type']['key']};});_0x3fad7b[_0x4e4f('0x2c')]=_[_0x4e4f('0x28')](_0x361a74,'name');_0x3fad7b[_0x4e4f('0x2d')]=_[_0x4e4f('0x2e')](_0x1aab80[_0x4e4f('0x2d')]);_0x3fad7b['filters']=_[_0x4e4f('0x2f')](_0x3fad7b[_0x4e4f('0x2c')],_0x3fad7b['query']);_0x579ac0[_0x4e4f('0x30')]=_[_0x4e4f('0x2f')](_0x3fad7b[_0x4e4f('0x2c')],qs[_0x4e4f('0x31')](_0x1aab80['query'][_0x4e4f('0x31')]));_0x579ac0[_0x4e4f('0x30')]=_0x579ac0['attributes']['length']?_0x579ac0[_0x4e4f('0x30')]:_0x3fad7b[_0x4e4f('0x2c')];if(!_0x1aab80['query'][_0x4e4f('0x32')](_0x4e4f('0x33'))){_0x579ac0['limit']=qs[_0x4e4f('0x1c')](_0x1aab80['query'][_0x4e4f('0x1c')]);_0x579ac0[_0x4e4f('0x1a')]=qs[_0x4e4f('0x1a')](_0x1aab80['query'][_0x4e4f('0x1a')]);}_0x579ac0[_0x4e4f('0x34')]=qs['sort'](_0x1aab80[_0x4e4f('0x2d')][_0x4e4f('0x35')]);_0x579ac0[_0x4e4f('0x36')]=qs[_0x4e4f('0x37')](_['pick'](_0x1aab80[_0x4e4f('0x2d')],_0x3fad7b[_0x4e4f('0x37')]),_0x361a74);if(_0x1aab80[_0x4e4f('0x2d')]['filter']){_0x579ac0[_0x4e4f('0x36')]=_[_0x4e4f('0x38')](_0x579ac0[_0x4e4f('0x36')],{'$or':_['map'](_0x361a74,function(_0x456326){if(_0x456326[_0x4e4f('0x39')]!==_0x4e4f('0x3a')){var _0x53059c={};_0x53059c[_0x456326[_0x4e4f('0x3b')]]={'$like':'%'+_0x1aab80['query'][_0x4e4f('0x3c')]+'%'};return _0x53059c;}})});}_0x579ac0=_[_0x4e4f('0x38')]({},_0x579ac0,_0x1aab80[_0x4e4f('0x3d')]);var _0x3bba9e={'where':_0x579ac0['where']};return db[_0x4e4f('0x29')][_0x4e4f('0x1d')](_0x3bba9e)[_0x4e4f('0x25')](function(_0x3a638e){_0x95c017['count']=_0x3a638e;if(_0x1aab80['query'][_0x4e4f('0x3e')]){_0x579ac0[_0x4e4f('0x3f')]=[{'all':!![]}];}return db['FreshsalesField'][_0x4e4f('0x40')](_0x579ac0);})[_0x4e4f('0x25')](function(_0xbc5da9){_0x95c017[_0x4e4f('0x41')]=_0xbc5da9;return _0x95c017;})['then'](respondWithFilteredResult(_0x52f4bd,_0x579ac0))['catch'](handleError(_0x52f4bd,null));};exports[_0x4e4f('0x42')]=function(_0x30c61f,_0x70e03c){var _0x36858a={'raw':!![],'where':{'id':_0x30c61f[_0x4e4f('0x43')]['id']}},_0x49b4b0={};_0x49b4b0[_0x4e4f('0x2c')]=_[_0x4e4f('0x2e')](db['FreshsalesField'][_0x4e4f('0x2a')]);_0x49b4b0[_0x4e4f('0x2d')]=_[_0x4e4f('0x2e')](_0x30c61f['query']);_0x49b4b0['filters']=_['intersection'](_0x49b4b0[_0x4e4f('0x2c')],_0x49b4b0[_0x4e4f('0x2d')]);_0x36858a['attributes']=_[_0x4e4f('0x2f')](_0x49b4b0['model'],qs[_0x4e4f('0x31')](_0x30c61f['query'][_0x4e4f('0x31')]));_0x36858a['attributes']=_0x36858a[_0x4e4f('0x30')][_0x4e4f('0x44')]?_0x36858a[_0x4e4f('0x30')]:_0x49b4b0[_0x4e4f('0x2c')];if(_0x30c61f['query']['includeAll']){_0x36858a[_0x4e4f('0x3f')]=[{'all':!![]}];}_0x36858a=_[_0x4e4f('0x38')]({},_0x36858a,_0x30c61f['options']);return db[_0x4e4f('0x29')][_0x4e4f('0x45')](_0x36858a)[_0x4e4f('0x25')](handleEntityNotFound(_0x70e03c,null))['then'](respondWithResult(_0x70e03c,null))['catch'](handleError(_0x70e03c,null));};exports[_0x4e4f('0x46')]=function(_0x43f0c6,_0x42cf2a){return db['FreshsalesField'][_0x4e4f('0x46')](_0x43f0c6[_0x4e4f('0x47')],{})['then'](respondWithResult(_0x42cf2a,0xc9))[_0x4e4f('0x48')](handleError(_0x42cf2a,null));};exports['update']=function(_0x23fddc,_0x25d183){if(_0x23fddc[_0x4e4f('0x47')]['id']){delete _0x23fddc[_0x4e4f('0x47')]['id'];}return db[_0x4e4f('0x29')][_0x4e4f('0x45')]({'where':{'id':_0x23fddc['params']['id']}})[_0x4e4f('0x25')](handleEntityNotFound(_0x25d183,null))[_0x4e4f('0x25')](saveUpdates(_0x23fddc['body'],null))[_0x4e4f('0x25')](respondWithResult(_0x25d183,null))[_0x4e4f('0x48')](handleError(_0x25d183,null));};exports['destroy']=function(_0x27bd81,_0x36af2b){return db[_0x4e4f('0x29')][_0x4e4f('0x45')]({'where':{'id':_0x27bd81[_0x4e4f('0x43')]['id']}})[_0x4e4f('0x25')](handleEntityNotFound(_0x36af2b,null))['then'](removeEntity(_0x36af2b,null))['catch'](handleError(_0x36af2b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 1aa78fe..e505289 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.model.js +++ b/server/api/intFreshsalesField/intFreshsalesField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5c8=['rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xb5a39b,_0x24851a){var _0x28b630=function(_0x3031d3){while(--_0x3031d3){_0xb5a39b['push'](_0xb5a39b['shift']());}};_0x28b630(++_0x24851a);}(_0xd5c8,0x166));var _0x8d5c=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0xd5c8[_0xbc1a4b];return _0x108b87;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8d5c('0x0'))(_0x8d5c('0x1'));var moment=require(_0x8d5c('0x2'));var BPromise=require(_0x8d5c('0x3'));var rp=require(_0x8d5c('0x4'));var fs=require('fs');var path=require(_0x8d5c('0x5'));var rimraf=require(_0x8d5c('0x6'));var config=require(_0x8d5c('0x7'));var attributes=require(_0x8d5c('0x8'));module['exports']=function(_0xd72ba3,_0x5d3fff){return _0xd72ba3['define'](_0x8d5c('0x9'),attributes,{'tableName':_0x8d5c('0xa'),'paranoid':![],'indexes':[{'name':_0x8d5c('0xb'),'fields':[_0x8d5c('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1867=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash'];(function(_0x542b75,_0x599551){var _0x820dcc=function(_0x2e23f4){while(--_0x2e23f4){_0x542b75['push'](_0x542b75['shift']());}};_0x820dcc(++_0x599551);}(_0x1867,0xb5));var _0x7186=function(_0x7744c9,_0x2969ef){_0x7744c9=_0x7744c9-0x0;var _0x163826=_0x1867[_0x7744c9];return _0x163826;};'use strict';var _=require(_0x7186('0x0'));var util=require(_0x7186('0x1'));var logger=require('../../config/logger')(_0x7186('0x2'));var moment=require('moment');var BPromise=require(_0x7186('0x3'));var rp=require(_0x7186('0x4'));var fs=require('fs');var path=require(_0x7186('0x5'));var rimraf=require(_0x7186('0x6'));var config=require(_0x7186('0x7'));var attributes=require(_0x7186('0x8'));module[_0x7186('0x9')]=function(_0x27bd91,_0x349203){return _0x27bd91['define'](_0x7186('0xa'),attributes,{'tableName':_0x7186('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x7186('0xc'),_0x7186('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 885c92b..c208f6f 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x475619,_0x51659c){var _0x31eba1=function(_0x486ed2){while(--_0x486ed2){_0x475619['push'](_0x475619['shift']());}};_0x31eba1(++_0x51659c);}(_0x1261,0x144));var _0x1126=function(_0x206096,_0x1c6cfd){_0x206096=_0x206096-0x0;var _0x3f3b50=_0x1261[_0x206096];return _0x3f3b50;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x326f=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x16317d,_0x35ee2e){var _0x46a591=function(_0x24f932){while(--_0x24f932){_0x16317d['push'](_0x16317d['shift']());}};_0x46a591(++_0x35ee2e);}(_0x326f,0xd1));var _0xf326=function(_0x746e88,_0x14d63d){_0x746e88=_0x746e88-0x0;var _0x1f054a=_0x326f[_0x746e88];return _0x1f054a;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c4857ff..7a38284 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2ebc31,_0x336378){var _0x4a96ef=function(_0x547b83){while(--_0x547b83){_0x2ebc31['push'](_0x2ebc31['shift']());}};_0x4a96ef(++_0x336378);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x50e26a,_0x2f7a08){var _0x34f013=function(_0x3f4fba){while(--_0x3f4fba){_0x50e26a['push'](_0x50e26a['shift']());}};_0x34f013(++_0x2f7a08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 467a0ab..2f8186b 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58cc=['ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x37e505,_0x3bc266){var _0xf266a7=function(_0x519ef2){while(--_0x519ef2){_0x37e505['push'](_0x37e505['shift']());}};_0xf266a7(++_0x3bc266);}(_0x58cc,0x7a));var _0xc58c=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x58cc[_0x3da832];return _0xe602f2;};'use strict';var Sequelize=require(_0xc58c('0x0'));module[_0xc58c('0x1')]={'name':{'type':Sequelize[_0xc58c('0x2')]},'description':{'type':Sequelize[_0xc58c('0x2')]},'username':{'type':Sequelize[_0xc58c('0x2')],'unique':_0xc58c('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc58c('0x2')]},'clientId':{'type':Sequelize[_0xc58c('0x2')]},'clientSecret':{'type':Sequelize[_0xc58c('0x2')]},'securityToken':{'type':Sequelize[_0xc58c('0x2')]},'serverUrl':{'type':Sequelize[_0xc58c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc58c('0x4')]('integrationTab','newTab'),'defaultValue':_0xc58c('0x5')}}; \ No newline at end of file +var _0xcd6f=['newTab','sequelize','exports','STRING','username','ENUM'];(function(_0x229b57,_0x493781){var _0x27937f=function(_0x23d514){while(--_0x23d514){_0x229b57['push'](_0x229b57['shift']());}};_0x27937f(++_0x493781);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x330dcc,_0x30bf1c){_0x330dcc=_0x330dcc-0x0;var _0x37b076=_0xcd6f[_0x330dcc];return _0x37b076;};'use strict';var Sequelize=require(_0xfcd6('0x0'));module[_0xfcd6('0x1')]={'name':{'type':Sequelize[_0xfcd6('0x2')]},'description':{'type':Sequelize[_0xfcd6('0x2')]},'username':{'type':Sequelize[_0xfcd6('0x2')],'unique':_0xfcd6('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfcd6('0x2')]},'clientId':{'type':Sequelize[_0xfcd6('0x2')]},'clientSecret':{'type':Sequelize[_0xfcd6('0x2')]},'securityToken':{'type':Sequelize[_0xfcd6('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfcd6('0x4')]('integrationTab',_0xfcd6('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9916e3f..f011a52 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35a0=['query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','rows','catch','show','params','include','find','create','body','findOne','keys','SalesforceConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','remove','includes','picklistValues','label','value','True','true','false','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','mustache','util','path','sox','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','set','Content-Range','apply','update','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key'];(function(_0x4f21cd,_0x45c553){var _0x314ebb=function(_0x510601){while(--_0x510601){_0x4f21cd['push'](_0x4f21cd['shift']());}};_0x314ebb(++_0x45c553);}(_0x35a0,0xbd));var _0x035a=function(_0x14c00f,_0x11b192){_0x14c00f=_0x14c00f-0x0;var _0x19fbda=_0x35a0[_0x14c00f];return _0x19fbda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x035a('0x0'));var zipdir=require(_0x035a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x035a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x035a('0x3'));var util=require(_0x035a('0x4'));var path=require(_0x035a('0x5'));var sox=require(_0x035a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x035a('0x7'));var crypto=require(_0x035a('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x035a('0x9'));var querystring=require(_0x035a('0xa'));var Papa=require(_0x035a('0xb'));var Redis=require(_0x035a('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x035a('0xd'));var hardwareService=require(_0x035a('0xe'));var logger=require(_0x035a('0xf'))(_0x035a('0x10'));var utils=require(_0x035a('0x11'));var config=require(_0x035a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x035a('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ec710,_0x5b1007){_0x5b1007=_0x5b1007||0xcc;return function(_0xe38e2a){if(_0xe38e2a){return _0x4ec710[_0x035a('0x14')](_0x5b1007);}return _0x4ec710[_0x035a('0x15')](_0x5b1007)[_0x035a('0x16')]();};}function respondWithResult(_0x3cc5df,_0x34e7b5){_0x34e7b5=_0x34e7b5||0xc8;return function(_0x538291){if(_0x538291){return _0x3cc5df['status'](_0x34e7b5)['json'](_0x538291);}};}function respondWithFilteredResult(_0x12b97f,_0x36ba07){return function(_0x232f20){if(_0x232f20){var _0x27a1e1=typeof _0x36ba07[_0x035a('0x17')]===_0x035a('0x18')&&typeof _0x36ba07['limit']===_0x035a('0x18');var _0xe34c30=_0x232f20['count'];var _0x52709e=_0x27a1e1?0x0:_0x36ba07[_0x035a('0x17')];var _0x3342ec=_0x27a1e1?_0x232f20['count']:_0x36ba07['offset']+_0x36ba07['limit'];var _0x4e9965;if(_0x3342ec>=_0xe34c30){_0x3342ec=_0xe34c30;_0x4e9965=0xc8;}else{_0x4e9965=0xce;}_0x12b97f[_0x035a('0x15')](_0x4e9965);return _0x12b97f[_0x035a('0x19')](_0x035a('0x1a'),_0x52709e+'-'+_0x3342ec+'/'+_0xe34c30)['json'](_0x232f20);}return null;};}function patchUpdates(_0x3d2985){return function(_0x477174){try{jsonpatch[_0x035a('0x1b')](_0x477174,_0x3d2985,!![]);}catch(_0x5b1f86){return BPromise['reject'](_0x5b1f86);}return _0x477174['save']();};}function saveUpdates(_0x7f1577,_0x4af50c){return function(_0x4ee6e8){if(_0x4ee6e8){return _0x4ee6e8[_0x035a('0x1c')](_0x7f1577)['then'](function(_0x4b0f86){return _0x4b0f86;});}return null;};}function removeEntity(_0x18ff85,_0x430cb6){return function(_0x1c8cdb){if(_0x1c8cdb){return _0x1c8cdb['destroy']()[_0x035a('0x1d')](function(){_0x18ff85[_0x035a('0x15')](0xcc)[_0x035a('0x16')]();});}};}function handleEntityNotFound(_0x2f8389,_0x2b2795){return function(_0x555b8e){if(!_0x555b8e){_0x2f8389[_0x035a('0x14')](0x194);}return _0x555b8e;};}function handleError(_0x2f6135,_0x3b662b){_0x3b662b=_0x3b662b||0x1f4;return function(_0x49dff0){logger[_0x035a('0x1e')](_0x49dff0[_0x035a('0x1f')]);if(_0x49dff0[_0x035a('0x20')]){delete _0x49dff0[_0x035a('0x20')];}_0x2f6135[_0x035a('0x15')](_0x3b662b)[_0x035a('0x21')](_0x49dff0);};}exports[_0x035a('0x22')]=function(_0x281b23,_0x5d2817){var _0x1a6962={},_0x5111d6={},_0x35e3b0={'count':0x0,'rows':[]};var _0x30b948=_[_0x035a('0x23')](db[_0x035a('0x24')][_0x035a('0x25')],function(_0x5d840a){return{'name':_0x5d840a[_0x035a('0x26')],'type':_0x5d840a[_0x035a('0x27')][_0x035a('0x28')]};});_0x5111d6['model']=_[_0x035a('0x23')](_0x30b948,_0x035a('0x20'));_0x5111d6[_0x035a('0x29')]=_['keys'](_0x281b23[_0x035a('0x29')]);_0x5111d6[_0x035a('0x2a')]=_[_0x035a('0x2b')](_0x5111d6[_0x035a('0x2c')],_0x5111d6[_0x035a('0x29')]);_0x1a6962['attributes']=_[_0x035a('0x2b')](_0x5111d6[_0x035a('0x2c')],qs[_0x035a('0x2d')](_0x281b23[_0x035a('0x29')]['fields']));_0x1a6962[_0x035a('0x2e')]=_0x1a6962['attributes'][_0x035a('0x2f')]?_0x1a6962[_0x035a('0x2e')]:_0x5111d6[_0x035a('0x2c')];if(!_0x281b23['query'][_0x035a('0x30')](_0x035a('0x31'))){_0x1a6962[_0x035a('0x32')]=qs[_0x035a('0x32')](_0x281b23[_0x035a('0x29')]['limit']);_0x1a6962['offset']=qs['offset'](_0x281b23[_0x035a('0x29')][_0x035a('0x17')]);}_0x1a6962['order']=qs[_0x035a('0x33')](_0x281b23['query'][_0x035a('0x33')]);_0x1a6962[_0x035a('0x34')]=qs['filters'](_[_0x035a('0x35')](_0x281b23[_0x035a('0x29')],_0x5111d6[_0x035a('0x2a')]),_0x30b948);if(_0x281b23['query']['filter']){_0x1a6962[_0x035a('0x34')]=_[_0x035a('0x36')](_0x1a6962[_0x035a('0x34')],{'$or':_[_0x035a('0x23')](_0x30b948,function(_0x47cceb){if(_0x47cceb[_0x035a('0x27')]!==_0x035a('0x37')){var _0x363ed6={};_0x363ed6[_0x47cceb[_0x035a('0x20')]]={'$like':'%'+_0x281b23['query'][_0x035a('0x38')]+'%'};return _0x363ed6;}})});}_0x1a6962=_['merge']({},_0x1a6962,_0x281b23[_0x035a('0x39')]);var _0x29e295={'where':_0x1a6962['where']};return db[_0x035a('0x24')][_0x035a('0x3a')](_0x29e295)['then'](function(_0x4f9e0f){_0x35e3b0[_0x035a('0x3a')]=_0x4f9e0f;if(_0x281b23[_0x035a('0x29')]['includeAll']){_0x1a6962['include']=[{'all':!![]}];}return db[_0x035a('0x24')][_0x035a('0x3b')](_0x1a6962);})['then'](function(_0x8b0157){_0x35e3b0[_0x035a('0x3c')]=_0x8b0157;return _0x35e3b0;})[_0x035a('0x1d')](respondWithFilteredResult(_0x5d2817,_0x1a6962))[_0x035a('0x3d')](handleError(_0x5d2817,null));};exports[_0x035a('0x3e')]=function(_0x22d429,_0x36ff22){var _0x4f1836={'raw':![],'where':{'id':_0x22d429[_0x035a('0x3f')]['id']}},_0x27cbab={};_0x27cbab['model']=_['keys'](db['SalesforceAccount'][_0x035a('0x25')]);_0x27cbab[_0x035a('0x29')]=_['keys'](_0x22d429[_0x035a('0x29')]);_0x27cbab[_0x035a('0x2a')]=_['intersection'](_0x27cbab['model'],_0x27cbab[_0x035a('0x29')]);_0x4f1836[_0x035a('0x2e')]=_[_0x035a('0x2b')](_0x27cbab['model'],qs['fields'](_0x22d429['query'][_0x035a('0x2d')]));_0x4f1836[_0x035a('0x2e')]=_0x4f1836[_0x035a('0x2e')][_0x035a('0x2f')]?_0x4f1836['attributes']:_0x27cbab['model'];if(_0x22d429[_0x035a('0x29')]['includeAll']){_0x4f1836[_0x035a('0x40')]=[{'all':!![]}];}_0x4f1836=_[_0x035a('0x36')]({},_0x4f1836,_0x22d429[_0x035a('0x39')]);return db[_0x035a('0x24')][_0x035a('0x41')](_0x4f1836)['then'](handleEntityNotFound(_0x36ff22,null))[_0x035a('0x1d')](respondWithResult(_0x36ff22,null))[_0x035a('0x3d')](handleError(_0x36ff22,null));};exports[_0x035a('0x42')]=function(_0x3c2a82,_0x457bdb){return db[_0x035a('0x24')][_0x035a('0x42')](_0x3c2a82[_0x035a('0x43')],{})[_0x035a('0x1d')](respondWithResult(_0x457bdb,0xc9))['catch'](handleError(_0x457bdb,null));};exports[_0x035a('0x1c')]=function(_0x208742,_0x650e52){if(_0x208742['body']['id']){delete _0x208742[_0x035a('0x43')]['id'];}return db[_0x035a('0x24')][_0x035a('0x41')]({'where':{'id':_0x208742[_0x035a('0x3f')]['id']}})[_0x035a('0x1d')](handleEntityNotFound(_0x650e52,null))[_0x035a('0x1d')](saveUpdates(_0x208742[_0x035a('0x43')],null))[_0x035a('0x1d')](respondWithResult(_0x650e52,null))['catch'](handleError(_0x650e52,null));};exports['destroy']=function(_0x1dbe4e,_0x2bc1d3){return db['SalesforceAccount'][_0x035a('0x41')]({'where':{'id':_0x1dbe4e[_0x035a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2bc1d3,null))[_0x035a('0x1d')](removeEntity(_0x2bc1d3,null))[_0x035a('0x3d')](handleError(_0x2bc1d3,null));};exports['getConfigurations']=function(_0x445d9f,_0x2cca50,_0x2f1599){var _0x5f295c={};var _0x7bd1c3={};var _0x3cb626;var _0x2b00d5;return db[_0x035a('0x24')][_0x035a('0x44')]({'where':{'id':_0x445d9f['params']['id']}})[_0x035a('0x1d')](handleEntityNotFound(_0x2cca50,null))['then'](function(_0x52d239){if(_0x52d239){_0x3cb626=_0x52d239;_0x7bd1c3[_0x035a('0x2c')]=_[_0x035a('0x45')](db[_0x035a('0x46')]['rawAttributes']);_0x7bd1c3[_0x035a('0x29')]=_[_0x035a('0x45')](_0x445d9f['query']);_0x7bd1c3[_0x035a('0x2a')]=_[_0x035a('0x2b')](_0x7bd1c3['model'],_0x7bd1c3[_0x035a('0x29')]);_0x5f295c['attributes']=_['intersection'](_0x7bd1c3[_0x035a('0x2c')],qs[_0x035a('0x2d')](_0x445d9f[_0x035a('0x29')][_0x035a('0x2d')]));_0x5f295c['attributes']=_0x5f295c[_0x035a('0x2e')]['length']?_0x5f295c['attributes']:_0x7bd1c3[_0x035a('0x2c')];_0x5f295c[_0x035a('0x47')]=qs['sort'](_0x445d9f[_0x035a('0x29')][_0x035a('0x33')]);_0x5f295c[_0x035a('0x34')]=qs[_0x035a('0x2a')](_[_0x035a('0x35')](_0x445d9f['query'],_0x7bd1c3[_0x035a('0x2a')]));if(_0x445d9f['query'][_0x035a('0x38')]){_0x5f295c[_0x035a('0x34')]=_[_0x035a('0x36')](_0x5f295c[_0x035a('0x34')],{'$or':_['map'](_0x5f295c['attributes'],function(_0x1ef0cc){var _0x24ba45={};_0x24ba45[_0x1ef0cc]={'$like':'%'+_0x445d9f[_0x035a('0x29')][_0x035a('0x38')]+'%'};return _0x24ba45;})});}_0x5f295c=_[_0x035a('0x36')]({},_0x5f295c,_0x445d9f[_0x035a('0x39')]);return _0x3cb626['getConfigurations'](_0x5f295c);}})[_0x035a('0x1d')](function(_0x4c306c){if(_0x4c306c){_0x2b00d5=_0x4c306c[_0x035a('0x2f')];if(!_0x445d9f[_0x035a('0x29')][_0x035a('0x30')](_0x035a('0x31'))){_0x5f295c['limit']=qs[_0x035a('0x32')](_0x445d9f['query'][_0x035a('0x32')]);_0x5f295c['offset']=qs['offset'](_0x445d9f[_0x035a('0x29')][_0x035a('0x17')]);}return _0x3cb626[_0x035a('0x48')](_0x5f295c);}})['then'](function(_0x37082b){if(_0x37082b){return _0x37082b?{'count':_0x2b00d5,'rows':_0x37082b}:null;}})[_0x035a('0x1d')](respondWithResult(_0x2cca50,null))['catch'](handleError(_0x2cca50,null));};exports[_0x035a('0x49')]=function(_0x3328fc,_0x2afcd6,_0x55c2a4){if(_0x3328fc[_0x035a('0x43')]['id']){delete _0x3328fc[_0x035a('0x43')]['id'];}return db[_0x035a('0x24')]['findOne']({'where':{'id':_0x3328fc[_0x035a('0x3f')]['id']}})[_0x035a('0x1d')](handleEntityNotFound(_0x2afcd6,null))['then'](function(_0x1d79e6){if(_0x1d79e6){_0x3328fc[_0x035a('0x43')][_0x035a('0x4a')]=_0x1d79e6['id'];_0x3328fc[_0x035a('0x43')][_0x035a('0x4b')]=integrations['getSubjects'](_0x3328fc[_0x035a('0x43')][_0x035a('0x4c')],_0x3328fc[_0x035a('0x43')][_0x035a('0x27')]);_0x3328fc[_0x035a('0x43')][_0x035a('0x4d')]=integrations[_0x035a('0x4e')](_0x3328fc['body'][_0x035a('0x4c')],_0x3328fc['body'][_0x035a('0x27')]);return db[_0x035a('0x46')][_0x035a('0x42')](_0x3328fc[_0x035a('0x43')],{'include':[{'model':db[_0x035a('0x4f')],'as':_0x035a('0x4b')},{'model':db['SalesforceField'],'as':_0x035a('0x4d')}]});}return null;})[_0x035a('0x1d')](respondWithResult(_0x2afcd6,null))[_0x035a('0x3d')](handleError(_0x2afcd6,null));};exports[_0x035a('0x50')]=function(_0x9de96b,_0x5cdf08,_0x2f9e9b){var _0x14083a;var _0xcbbce='';var _0x152b59='Task';return db['SalesforceAccount']['findOne']({'where':{'id':_0x9de96b[_0x035a('0x3f')]['id']},'attributes':['id',_0x035a('0x51'),_0x035a('0x52'),_0x035a('0x53'),_0x035a('0x54'),_0x035a('0x55'),_0x035a('0x56')]})[_0x035a('0x1d')](handleEntityNotFound(_0x5cdf08,null))[_0x035a('0x1d')](function(_0x17a109){if(_0x17a109){_0xcbbce=_0x17a109['remoteUri'];var _0x366365=_0xcbbce[_0x035a('0x57')](-0x1);if(_0x366365==='/'){_0xcbbce=_0xcbbce[_0x035a('0x58')](0x0,_0xcbbce[_0x035a('0x59')](_0x366365));}_0x14083a=new jsforce[(_0x035a('0x5a'))]({'oauth2':{'loginUrl':_0xcbbce,'clientId':_0x17a109[_0x035a('0x52')],'clientSecret':_0x17a109[_0x035a('0x53')]}});return _0x14083a['login'](_0x17a109['username'],_0x17a109[_0x035a('0x55')]['concat'](_0x17a109[_0x035a('0x56')]));}})[_0x035a('0x1d')](function(_0x568fb3){if(_0x568fb3){if(!_[_0x035a('0x5b')](_0x9de96b[_0x035a('0x29')][_0x035a('0x5c')])){_0x152b59=_0x9de96b[_0x035a('0x29')][_0x035a('0x5c')];}return _0x14083a['sobject'](_0x152b59)[_0x035a('0x5d')]();}})[_0x035a('0x1d')](function(_0x4ed591){var _0x3901da=[_0x035a('0x5e'),_0x035a('0x5f'),_0x035a('0x60'),_0x035a('0x61'),_0x035a('0x62'),_0x035a('0x63')];var _0x56df66=[_0x035a('0x64'),_0x035a('0x65'),_0x035a('0x66'),'boolean','email','textarea','phone'];if(_0x4ed591){_[_0x035a('0x67')](_0x4ed591[_0x035a('0x2d')],function(_0x33b22e){return _0x3901da[_0x035a('0x68')](_0x33b22e[_0x035a('0x20')])||!_0x56df66[_0x035a('0x68')](_0x33b22e[_0x035a('0x27')]);});return{'count':_0x4ed591['fields']['length'],'rows':_[_0x035a('0x23')](_0x4ed591[_0x035a('0x2d')],function(_0x5804b7){return{'id':_0x5804b7[_0x035a('0x20')],'name':_0x5804b7['label'],'custom':_0x5804b7['custom'],'options':_0x5804b7[_0x035a('0x69')][_0x035a('0x2f')]>0x0?_[_0x035a('0x23')](_0x5804b7[_0x035a('0x69')],function(_0x245b6b){return{'name':_0x245b6b[_0x035a('0x6a')],'value':_0x245b6b[_0x035a('0x6b')]};}):_0x5804b7['type']=='boolean'?[{'name':_0x035a('0x6c'),'value':_0x035a('0x6d')},{'name':'False','value':_0x035a('0x6e')}]:[]};})};}})[_0x035a('0x1d')](respondWithResult(_0x5cdf08,null))[_0x035a('0x3d')](function(_0x422812){var _0x3b2b37=_0x9de96b[_0x035a('0x29')][_0x035a('0x6f')]?0x1f4:_0x422812['statusCode']||0x1f4;logger[_0x035a('0x1e')](_0x035a('0x70'),_0x035a('0x50'),_0x3b2b37,JSON['stringify'](_0x422812));delete _0x422812[_0x035a('0x20')];if(_0x3b2b37===0x191){_0x3b2b37=0x190;}_0x5cdf08[_0x035a('0x15')](_0x3b2b37)['send'](_0x9de96b[_0x035a('0x29')][_0x035a('0x6f')]?{'message':_0x035a('0x71'),'statusCode':_0x422812[_0x035a('0x72')]}:_0x422812);});}; \ No newline at end of file +var _0x2f03=['getConfigurations','findOne','keys','SalesforceConfiguration','rawAttributes','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','substring','lastIndexOf','concat','sobject','describe','OwnerId','IsRecurrence','Subject','Description','string','int','picklist','boolean','textarea','phone','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','update','then','destroy','stack','name','send','map','SalesforceAccount','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','create','body','find'];(function(_0x30e3b3,_0x2825db){var _0x4efc0d=function(_0x48c64c){while(--_0x48c64c){_0x30e3b3['push'](_0x30e3b3['shift']());}};_0x4efc0d(++_0x2825db);}(_0x2f03,0x194));var _0x32f0=function(_0x426955,_0x50778a){_0x426955=_0x426955-0x0;var _0x46c925=_0x2f03[_0x426955];return _0x46c925;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32f0('0x0'));var zipdir=require(_0x32f0('0x1'));var jsonpatch=require(_0x32f0('0x2'));var rp=require(_0x32f0('0x3'));var moment=require(_0x32f0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x32f0('0x5'));var path=require(_0x32f0('0x6'));var sox=require(_0x32f0('0x7'));var csv=require(_0x32f0('0x8'));var ejs=require(_0x32f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x32f0('0xa'));var crypto=require(_0x32f0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x32f0('0xc'));var toCsv=require(_0x32f0('0x8'));var querystring=require(_0x32f0('0xd'));var Papa=require(_0x32f0('0xe'));var Redis=require('ioredis');var authService=require(_0x32f0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x32f0('0x10'));var hardwareService=require(_0x32f0('0x11'));var logger=require(_0x32f0('0x12'))('api');var utils=require(_0x32f0('0x13'));var config=require(_0x32f0('0x14'));var licenseUtil=require(_0x32f0('0x15'));var db=require(_0x32f0('0x16'))['db'];var integrations=require(_0x32f0('0x17'));function respondWithStatusCode(_0x538ce5,_0x22c362){_0x22c362=_0x22c362||0xcc;return function(_0x2a1473){if(_0x2a1473){return _0x538ce5[_0x32f0('0x18')](_0x22c362);}return _0x538ce5[_0x32f0('0x19')](_0x22c362)[_0x32f0('0x1a')]();};}function respondWithResult(_0x411bee,_0x352360){_0x352360=_0x352360||0xc8;return function(_0xbfff54){if(_0xbfff54){return _0x411bee[_0x32f0('0x19')](_0x352360)[_0x32f0('0x1b')](_0xbfff54);}};}function respondWithFilteredResult(_0x27beb9,_0x1a321e){return function(_0x4ceff2){if(_0x4ceff2){var _0x4c2f14=typeof _0x1a321e['offset']==='undefined'&&typeof _0x1a321e[_0x32f0('0x1c')]===_0x32f0('0x1d');var _0x5d6a0d=_0x4ceff2[_0x32f0('0x1e')];var _0x536faa=_0x4c2f14?0x0:_0x1a321e[_0x32f0('0x1f')];var _0x164883=_0x4c2f14?_0x4ceff2['count']:_0x1a321e[_0x32f0('0x1f')]+_0x1a321e['limit'];var _0x54c02a;if(_0x164883>=_0x5d6a0d){_0x164883=_0x5d6a0d;_0x54c02a=0xc8;}else{_0x54c02a=0xce;}_0x27beb9[_0x32f0('0x19')](_0x54c02a);return _0x27beb9[_0x32f0('0x20')]('Content-Range',_0x536faa+'-'+_0x164883+'/'+_0x5d6a0d)[_0x32f0('0x1b')](_0x4ceff2);}return null;};}function patchUpdates(_0x11ad83){return function(_0x52ad77){try{jsonpatch[_0x32f0('0x21')](_0x52ad77,_0x11ad83,!![]);}catch(_0x27dda2){return BPromise['reject'](_0x27dda2);}return _0x52ad77['save']();};}function saveUpdates(_0x56867f,_0x4e897b){return function(_0x46bd46){if(_0x46bd46){return _0x46bd46[_0x32f0('0x22')](_0x56867f)[_0x32f0('0x23')](function(_0xa45067){return _0xa45067;});}return null;};}function removeEntity(_0x2fac49,_0xb54715){return function(_0x5ec434){if(_0x5ec434){return _0x5ec434[_0x32f0('0x24')]()['then'](function(){_0x2fac49[_0x32f0('0x19')](0xcc)[_0x32f0('0x1a')]();});}};}function handleEntityNotFound(_0x2c5884,_0x2f9aec){return function(_0x58eca3){if(!_0x58eca3){_0x2c5884[_0x32f0('0x18')](0x194);}return _0x58eca3;};}function handleError(_0xa9f4c4,_0x583755){_0x583755=_0x583755||0x1f4;return function(_0x39c6bc){logger['error'](_0x39c6bc[_0x32f0('0x25')]);if(_0x39c6bc[_0x32f0('0x26')]){delete _0x39c6bc['name'];}_0xa9f4c4[_0x32f0('0x19')](_0x583755)[_0x32f0('0x27')](_0x39c6bc);};}exports['index']=function(_0x2282fe,_0x5d0d5a){var _0x3399ab={},_0x141a3d={},_0x32bee0={'count':0x0,'rows':[]};var _0x52188b=_[_0x32f0('0x28')](db[_0x32f0('0x29')]['rawAttributes'],function(_0x350a0d){return{'name':_0x350a0d[_0x32f0('0x2a')],'type':_0x350a0d[_0x32f0('0x2b')]['key']};});_0x141a3d[_0x32f0('0x2c')]=_['map'](_0x52188b,'name');_0x141a3d[_0x32f0('0x2d')]=_['keys'](_0x2282fe[_0x32f0('0x2d')]);_0x141a3d[_0x32f0('0x2e')]=_[_0x32f0('0x2f')](_0x141a3d['model'],_0x141a3d[_0x32f0('0x2d')]);_0x3399ab[_0x32f0('0x30')]=_[_0x32f0('0x2f')](_0x141a3d[_0x32f0('0x2c')],qs['fields'](_0x2282fe[_0x32f0('0x2d')][_0x32f0('0x31')]));_0x3399ab[_0x32f0('0x30')]=_0x3399ab[_0x32f0('0x30')][_0x32f0('0x32')]?_0x3399ab[_0x32f0('0x30')]:_0x141a3d['model'];if(!_0x2282fe[_0x32f0('0x2d')]['hasOwnProperty'](_0x32f0('0x33'))){_0x3399ab[_0x32f0('0x1c')]=qs[_0x32f0('0x1c')](_0x2282fe[_0x32f0('0x2d')]['limit']);_0x3399ab[_0x32f0('0x1f')]=qs['offset'](_0x2282fe[_0x32f0('0x2d')]['offset']);}_0x3399ab[_0x32f0('0x34')]=qs[_0x32f0('0x35')](_0x2282fe['query'][_0x32f0('0x35')]);_0x3399ab[_0x32f0('0x36')]=qs['filters'](_['pick'](_0x2282fe[_0x32f0('0x2d')],_0x141a3d[_0x32f0('0x2e')]),_0x52188b);if(_0x2282fe[_0x32f0('0x2d')]['filter']){_0x3399ab[_0x32f0('0x36')]=_[_0x32f0('0x37')](_0x3399ab[_0x32f0('0x36')],{'$or':_[_0x32f0('0x28')](_0x52188b,function(_0x3c876b){if(_0x3c876b[_0x32f0('0x2b')]!==_0x32f0('0x38')){var _0x5909db={};_0x5909db[_0x3c876b[_0x32f0('0x26')]]={'$like':'%'+_0x2282fe[_0x32f0('0x2d')][_0x32f0('0x39')]+'%'};return _0x5909db;}})});}_0x3399ab=_[_0x32f0('0x37')]({},_0x3399ab,_0x2282fe[_0x32f0('0x3a')]);var _0x3a1948={'where':_0x3399ab['where']};return db[_0x32f0('0x29')]['count'](_0x3a1948)[_0x32f0('0x23')](function(_0x2b9483){_0x32bee0['count']=_0x2b9483;if(_0x2282fe[_0x32f0('0x2d')][_0x32f0('0x3b')]){_0x3399ab[_0x32f0('0x3c')]=[{'all':!![]}];}return db[_0x32f0('0x29')][_0x32f0('0x3d')](_0x3399ab);})[_0x32f0('0x23')](function(_0x1f263a){_0x32bee0[_0x32f0('0x3e')]=_0x1f263a;return _0x32bee0;})[_0x32f0('0x23')](respondWithFilteredResult(_0x5d0d5a,_0x3399ab))[_0x32f0('0x3f')](handleError(_0x5d0d5a,null));};exports['show']=function(_0x4b48b4,_0x4ff721){var _0x36717b={'raw':![],'where':{'id':_0x4b48b4[_0x32f0('0x40')]['id']}},_0xe79bd4={};_0xe79bd4[_0x32f0('0x2c')]=_['keys'](db[_0x32f0('0x29')]['rawAttributes']);_0xe79bd4[_0x32f0('0x2d')]=_['keys'](_0x4b48b4[_0x32f0('0x2d')]);_0xe79bd4['filters']=_[_0x32f0('0x2f')](_0xe79bd4[_0x32f0('0x2c')],_0xe79bd4['query']);_0x36717b[_0x32f0('0x30')]=_['intersection'](_0xe79bd4[_0x32f0('0x2c')],qs[_0x32f0('0x31')](_0x4b48b4[_0x32f0('0x2d')][_0x32f0('0x31')]));_0x36717b[_0x32f0('0x30')]=_0x36717b[_0x32f0('0x30')][_0x32f0('0x32')]?_0x36717b[_0x32f0('0x30')]:_0xe79bd4[_0x32f0('0x2c')];if(_0x4b48b4[_0x32f0('0x2d')][_0x32f0('0x3b')]){_0x36717b[_0x32f0('0x3c')]=[{'all':!![]}];}_0x36717b=_[_0x32f0('0x37')]({},_0x36717b,_0x4b48b4['options']);return db[_0x32f0('0x29')]['find'](_0x36717b)[_0x32f0('0x23')](handleEntityNotFound(_0x4ff721,null))[_0x32f0('0x23')](respondWithResult(_0x4ff721,null))['catch'](handleError(_0x4ff721,null));};exports[_0x32f0('0x41')]=function(_0x5de161,_0x285af9){return db[_0x32f0('0x29')][_0x32f0('0x41')](_0x5de161['body'],{})['then'](respondWithResult(_0x285af9,0xc9))[_0x32f0('0x3f')](handleError(_0x285af9,null));};exports[_0x32f0('0x22')]=function(_0x3875ab,_0x1ea0db){if(_0x3875ab[_0x32f0('0x42')]['id']){delete _0x3875ab[_0x32f0('0x42')]['id'];}return db[_0x32f0('0x29')][_0x32f0('0x43')]({'where':{'id':_0x3875ab[_0x32f0('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ea0db,null))['then'](saveUpdates(_0x3875ab[_0x32f0('0x42')],null))['then'](respondWithResult(_0x1ea0db,null))['catch'](handleError(_0x1ea0db,null));};exports[_0x32f0('0x24')]=function(_0x53f0ee,_0x40b485){return db[_0x32f0('0x29')][_0x32f0('0x43')]({'where':{'id':_0x53f0ee[_0x32f0('0x40')]['id']}})['then'](handleEntityNotFound(_0x40b485,null))['then'](removeEntity(_0x40b485,null))[_0x32f0('0x3f')](handleError(_0x40b485,null));};exports[_0x32f0('0x44')]=function(_0x391bfd,_0x29f051,_0x59acb7){var _0x566e3a={};var _0x287c70={};var _0x5d8a78;var _0x3ff299;return db[_0x32f0('0x29')][_0x32f0('0x45')]({'where':{'id':_0x391bfd[_0x32f0('0x40')]['id']}})[_0x32f0('0x23')](handleEntityNotFound(_0x29f051,null))['then'](function(_0x153457){if(_0x153457){_0x5d8a78=_0x153457;_0x287c70[_0x32f0('0x2c')]=_[_0x32f0('0x46')](db[_0x32f0('0x47')][_0x32f0('0x48')]);_0x287c70['query']=_[_0x32f0('0x46')](_0x391bfd[_0x32f0('0x2d')]);_0x287c70[_0x32f0('0x2e')]=_[_0x32f0('0x2f')](_0x287c70[_0x32f0('0x2c')],_0x287c70[_0x32f0('0x2d')]);_0x566e3a['attributes']=_[_0x32f0('0x2f')](_0x287c70[_0x32f0('0x2c')],qs[_0x32f0('0x31')](_0x391bfd[_0x32f0('0x2d')][_0x32f0('0x31')]));_0x566e3a[_0x32f0('0x30')]=_0x566e3a['attributes']['length']?_0x566e3a['attributes']:_0x287c70[_0x32f0('0x2c')];_0x566e3a['order']=qs['sort'](_0x391bfd[_0x32f0('0x2d')][_0x32f0('0x35')]);_0x566e3a[_0x32f0('0x36')]=qs[_0x32f0('0x2e')](_['pick'](_0x391bfd[_0x32f0('0x2d')],_0x287c70['filters']));if(_0x391bfd['query'][_0x32f0('0x39')]){_0x566e3a['where']=_[_0x32f0('0x37')](_0x566e3a[_0x32f0('0x36')],{'$or':_[_0x32f0('0x28')](_0x566e3a[_0x32f0('0x30')],function(_0x4eb7dd){var _0x422f64={};_0x422f64[_0x4eb7dd]={'$like':'%'+_0x391bfd[_0x32f0('0x2d')][_0x32f0('0x39')]+'%'};return _0x422f64;})});}_0x566e3a=_['merge']({},_0x566e3a,_0x391bfd['options']);return _0x5d8a78['getConfigurations'](_0x566e3a);}})[_0x32f0('0x23')](function(_0x40d8d6){if(_0x40d8d6){_0x3ff299=_0x40d8d6[_0x32f0('0x32')];if(!_0x391bfd[_0x32f0('0x2d')][_0x32f0('0x49')](_0x32f0('0x33'))){_0x566e3a['limit']=qs[_0x32f0('0x1c')](_0x391bfd['query'][_0x32f0('0x1c')]);_0x566e3a['offset']=qs[_0x32f0('0x1f')](_0x391bfd['query'][_0x32f0('0x1f')]);}return _0x5d8a78[_0x32f0('0x44')](_0x566e3a);}})[_0x32f0('0x23')](function(_0x53ad72){if(_0x53ad72){return _0x53ad72?{'count':_0x3ff299,'rows':_0x53ad72}:null;}})[_0x32f0('0x23')](respondWithResult(_0x29f051,null))['catch'](handleError(_0x29f051,null));};exports[_0x32f0('0x4a')]=function(_0x4a3a76,_0x1681d8,_0x28bc9e){if(_0x4a3a76['body']['id']){delete _0x4a3a76['body']['id'];}return db['SalesforceAccount'][_0x32f0('0x45')]({'where':{'id':_0x4a3a76['params']['id']}})[_0x32f0('0x23')](handleEntityNotFound(_0x1681d8,null))[_0x32f0('0x23')](function(_0x3eebf9){if(_0x3eebf9){_0x4a3a76['body']['AccountId']=_0x3eebf9['id'];_0x4a3a76['body'][_0x32f0('0x4b')]=integrations[_0x32f0('0x4c')](_0x4a3a76[_0x32f0('0x42')][_0x32f0('0x4d')],_0x4a3a76['body'][_0x32f0('0x2b')]);_0x4a3a76[_0x32f0('0x42')][_0x32f0('0x4e')]=integrations['getDescriptions'](_0x4a3a76['body'][_0x32f0('0x4d')],_0x4a3a76['body'][_0x32f0('0x2b')]);return db[_0x32f0('0x47')]['create'](_0x4a3a76[_0x32f0('0x42')],{'include':[{'model':db[_0x32f0('0x4f')],'as':_0x32f0('0x4b')},{'model':db[_0x32f0('0x4f')],'as':_0x32f0('0x4e')}]});}return null;})[_0x32f0('0x23')](respondWithResult(_0x1681d8,null))[_0x32f0('0x3f')](handleError(_0x1681d8,null));};exports[_0x32f0('0x50')]=function(_0x3054b0,_0x32187d,_0x18fac2){var _0x55c6ec;var _0x4117ee='';var _0x24fc3b=_0x32f0('0x51');return db[_0x32f0('0x29')][_0x32f0('0x45')]({'where':{'id':_0x3054b0[_0x32f0('0x40')]['id']},'attributes':['id',_0x32f0('0x52'),_0x32f0('0x53'),_0x32f0('0x54'),_0x32f0('0x55'),_0x32f0('0x56'),'securityToken']})['then'](handleEntityNotFound(_0x32187d,null))['then'](function(_0x409377){if(_0x409377){_0x4117ee=_0x409377['remoteUri'];var _0x570035=_0x4117ee[_0x32f0('0x57')](-0x1);if(_0x570035==='/'){_0x4117ee=_0x4117ee[_0x32f0('0x58')](0x0,_0x4117ee[_0x32f0('0x59')](_0x570035));}_0x55c6ec=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4117ee,'clientId':_0x409377['clientId'],'clientSecret':_0x409377['clientSecret']}});return _0x55c6ec['login'](_0x409377[_0x32f0('0x55')],_0x409377['password'][_0x32f0('0x5a')](_0x409377['securityToken']));}})[_0x32f0('0x23')](function(_0x42e8e2){if(_0x42e8e2){if(!_['isNil'](_0x3054b0[_0x32f0('0x2d')]['ticketType'])){_0x24fc3b=_0x3054b0[_0x32f0('0x2d')]['ticketType'];}return _0x55c6ec[_0x32f0('0x5b')](_0x24fc3b)[_0x32f0('0x5c')]();}})[_0x32f0('0x23')](function(_0x56f611){var _0x36c341=[_0x32f0('0x5d'),'ActivityDate','IsReminderSet',_0x32f0('0x5e'),_0x32f0('0x5f'),_0x32f0('0x60')];var _0x2e1285=[_0x32f0('0x61'),_0x32f0('0x62'),_0x32f0('0x63'),_0x32f0('0x64'),'email',_0x32f0('0x65'),_0x32f0('0x66')];if(_0x56f611){_['remove'](_0x56f611[_0x32f0('0x31')],function(_0x4f93cf){return _0x36c341[_0x32f0('0x67')](_0x4f93cf[_0x32f0('0x26')])||!_0x2e1285[_0x32f0('0x67')](_0x4f93cf['type']);});return{'count':_0x56f611[_0x32f0('0x31')]['length'],'rows':_['map'](_0x56f611[_0x32f0('0x31')],function(_0xc03461){return{'id':_0xc03461[_0x32f0('0x26')],'name':_0xc03461[_0x32f0('0x68')],'custom':_0xc03461[_0x32f0('0x69')],'options':_0xc03461[_0x32f0('0x6a')]['length']>0x0?_[_0x32f0('0x28')](_0xc03461[_0x32f0('0x6a')],function(_0x218ba1){return{'name':_0x218ba1[_0x32f0('0x68')],'value':_0x218ba1[_0x32f0('0x6b')]};}):_0xc03461[_0x32f0('0x2b')]=='boolean'?[{'name':_0x32f0('0x6c'),'value':_0x32f0('0x6d')},{'name':_0x32f0('0x6e'),'value':_0x32f0('0x6f')}]:[]};})};}})['then'](respondWithResult(_0x32187d,null))[_0x32f0('0x3f')](function(_0x4e2a7d){var _0x1639c6=_0x3054b0[_0x32f0('0x2d')][_0x32f0('0x70')]?0x1f4:_0x4e2a7d[_0x32f0('0x71')]||0x1f4;logger[_0x32f0('0x72')](_0x32f0('0x73'),_0x32f0('0x50'),_0x1639c6,JSON[_0x32f0('0x74')](_0x4e2a7d));delete _0x4e2a7d['name'];if(_0x1639c6===0x191){_0x1639c6=0x190;}_0x32187d['status'](_0x1639c6)[_0x32f0('0x27')](_0x3054b0['query'][_0x32f0('0x70')]?{'message':_0x32f0('0x75'),'statusCode':_0x4e2a7d[_0x32f0('0x71')]}:_0x4e2a7d);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b2b8630..e3b7645 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.model.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2035=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash','util'];(function(_0x3b5a59,_0x42bfb7){var _0x913da3=function(_0x105623){while(--_0x105623){_0x3b5a59['push'](_0x3b5a59['shift']());}};_0x913da3(++_0x42bfb7);}(_0x2035,0xb2));var _0x5203=function(_0x4d8c59,_0x365b9c){_0x4d8c59=_0x4d8c59-0x0;var _0xeac05c=_0x2035[_0x4d8c59];return _0xeac05c;};'use strict';var _=require(_0x5203('0x0'));var util=require(_0x5203('0x1'));var logger=require(_0x5203('0x2'))(_0x5203('0x3'));var moment=require(_0x5203('0x4'));var BPromise=require(_0x5203('0x5'));var rp=require(_0x5203('0x6'));var fs=require('fs');var path=require(_0x5203('0x7'));var rimraf=require(_0x5203('0x8'));var config=require(_0x5203('0x9'));var attributes=require(_0x5203('0xa'));var integrations=require(_0x5203('0xb'));module[_0x5203('0xc')]=function(_0x63aca4,_0x247d8e){return _0x63aca4[_0x5203('0xd')]('SalesforceAccount',attributes,{'tableName':_0x5203('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c68=['request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api'];(function(_0x491e36,_0x4579a7){var _0x2e7a3c=function(_0x34fa8d){while(--_0x34fa8d){_0x491e36['push'](_0x491e36['shift']());}};_0x2e7a3c(++_0x4579a7);}(_0x7c68,0x1d5));var _0x87c6=function(_0x5dab13,_0x1e6c9f){_0x5dab13=_0x5dab13-0x0;var _0x110f88=_0x7c68[_0x5dab13];return _0x110f88;};'use strict';var _=require(_0x87c6('0x0'));var util=require(_0x87c6('0x1'));var logger=require(_0x87c6('0x2'))(_0x87c6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x87c6('0x4'));var fs=require('fs');var path=require(_0x87c6('0x5'));var rimraf=require(_0x87c6('0x6'));var config=require('../../config/environment');var attributes=require(_0x87c6('0x7'));var integrations=require(_0x87c6('0x8'));module['exports']=function(_0x3cc9cf,_0x5b2be4){return _0x3cc9cf['define'](_0x87c6('0x9'),attributes,{'tableName':_0x87c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index b6020c0..73f66fe 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f8f=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','include','model','map','then','find','ShowSalesforceAccount','util','moment'];(function(_0x53c46c,_0x441e26){var _0x28b37c=function(_0x2c7657){while(--_0x2c7657){_0x53c46c['push'](_0x53c46c['shift']());}};_0x28b37c(++_0x441e26);}(_0x0f8f,0x1cc));var _0xf0f8=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0x0f8f[_0xb1174e];return _0x285bac;};'use strict';var _=require('lodash');var util=require(_0xf0f8('0x0'));var moment=require(_0xf0f8('0x1'));var BPromise=require('bluebird');var rs=require(_0xf0f8('0x2'));var fs=require('fs');var Redis=require(_0xf0f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0f8('0x4'));var logger=require(_0xf0f8('0x5'))(_0xf0f8('0x6'));var config=require(_0xf0f8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf0f8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x224a25,_0x8b125b,_0x4bb38b){return new BPromise(function(_0xaf78ff,_0x387340){return client[_0xf0f8('0x9')](_0x224a25,_0x4bb38b)['then'](function(_0x5b5193){logger[_0xf0f8('0xa')](_0xf0f8('0xb'),_0x8b125b,_0xf0f8('0xc'));logger[_0xf0f8('0xd')](_0xf0f8('0xe'),_0x8b125b,_0xf0f8('0xc'),JSON[_0xf0f8('0xf')](_0x5b5193));if(_0x5b5193[_0xf0f8('0x10')]){if(_0x5b5193[_0xf0f8('0x10')][_0xf0f8('0x11')]===0x1f4){logger[_0xf0f8('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x8b125b,_0x5b5193[_0xf0f8('0x10')][_0xf0f8('0x12')]);return _0x387340(_0x5b5193[_0xf0f8('0x10')][_0xf0f8('0x12')]);}logger[_0xf0f8('0x10')](_0xf0f8('0xb'),_0x8b125b,_0x5b5193[_0xf0f8('0x10')][_0xf0f8('0x12')]);return _0xaf78ff(_0x5b5193['error']['message']);}else{logger[_0xf0f8('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x8b125b,'request\x20sent');_0xaf78ff(_0x5b5193['result'][_0xf0f8('0x12')]);}})[_0xf0f8('0x13')](function(_0x100f2b){logger[_0xf0f8('0x10')](_0xf0f8('0xb'),_0x8b125b,_0x100f2b);_0x387340(_0x100f2b);});});}exports[_0xf0f8('0x14')]=function(_0x312aa9){var _0x56ef42=this;return new Promise(function(_0x1152ed,_0x542518){return db[_0xf0f8('0x15')][_0xf0f8('0x16')]({'raw':_0x312aa9[_0xf0f8('0x17')]?_0x312aa9[_0xf0f8('0x17')][_0xf0f8('0x18')]===undefined?!![]:![]:!![],'where':_0x312aa9[_0xf0f8('0x17')]?_0x312aa9[_0xf0f8('0x17')][_0xf0f8('0x19')]||null:null,'attributes':_0x312aa9[_0xf0f8('0x17')]?_0x312aa9['options'][_0xf0f8('0x1a')]||null:null,'limit':_0x312aa9['options']?_0x312aa9[_0xf0f8('0x17')]['limit']||null:null,'include':_0x312aa9[_0xf0f8('0x17')]?_0x312aa9[_0xf0f8('0x17')][_0xf0f8('0x1b')]?_['map'](_0x312aa9[_0xf0f8('0x17')][_0xf0f8('0x1b')],function(_0x5268fc){return{'model':db[_0x5268fc[_0xf0f8('0x1c')]],'as':_0x5268fc['as'],'attributes':_0x5268fc[_0xf0f8('0x1a')],'include':_0x5268fc[_0xf0f8('0x1b')]?_['map'](_0x5268fc[_0xf0f8('0x1b')],function(_0x2ae09d){return{'model':db[_0x2ae09d[_0xf0f8('0x1c')]],'as':_0x2ae09d['as'],'attributes':_0x2ae09d[_0xf0f8('0x1a')],'include':_0x2ae09d[_0xf0f8('0x1b')]?_[_0xf0f8('0x1d')](_0x2ae09d[_0xf0f8('0x1b')],function(_0x2ceb72){return{'model':db[_0x2ceb72[_0xf0f8('0x1c')]],'as':_0x2ceb72['as'],'attributes':_0x2ceb72['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0f8('0x1e')](function(_0x11e088){logger[_0xf0f8('0xa')](_0xf0f8('0x14'),_0x312aa9);logger['debug']('GetSalesforceAccount',_0x312aa9,JSON[_0xf0f8('0xf')](_0x11e088));_0x1152ed(_0x11e088);})[_0xf0f8('0x13')](function(_0x1f8eeb){logger[_0xf0f8('0x10')](_0xf0f8('0x14'),_0x1f8eeb[_0xf0f8('0x12')],_0x312aa9);_0x542518(_0x56ef42[_0xf0f8('0x10')](0x1f4,_0x1f8eeb[_0xf0f8('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x2be8be){var _0x1a3916=this;return new Promise(function(_0x222e9d,_0x4b7f9b){return db[_0xf0f8('0x15')][_0xf0f8('0x1f')]({'raw':_0x2be8be['options']?_0x2be8be['options'][_0xf0f8('0x18')]===undefined?!![]:![]:!![],'where':_0x2be8be[_0xf0f8('0x17')]?_0x2be8be[_0xf0f8('0x17')]['where']||null:null,'attributes':_0x2be8be['options']?_0x2be8be[_0xf0f8('0x17')][_0xf0f8('0x1a')]||null:null,'include':_0x2be8be['options']?_0x2be8be[_0xf0f8('0x17')][_0xf0f8('0x1b')]?_[_0xf0f8('0x1d')](_0x2be8be[_0xf0f8('0x17')]['include'],function(_0x25f5b9){return{'model':db[_0x25f5b9[_0xf0f8('0x1c')]],'as':_0x25f5b9['as'],'attributes':_0x25f5b9[_0xf0f8('0x1a')],'include':_0x25f5b9[_0xf0f8('0x1b')]?_[_0xf0f8('0x1d')](_0x25f5b9[_0xf0f8('0x1b')],function(_0x1aa540){return{'model':db[_0x1aa540[_0xf0f8('0x1c')]],'as':_0x1aa540['as'],'attributes':_0x1aa540[_0xf0f8('0x1a')],'include':_0x1aa540[_0xf0f8('0x1b')]?_[_0xf0f8('0x1d')](_0x1aa540[_0xf0f8('0x1b')],function(_0x174056){return{'model':db[_0x174056[_0xf0f8('0x1c')]],'as':_0x174056['as'],'attributes':_0x174056[_0xf0f8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf0f8('0x1e')](function(_0x437e46){logger[_0xf0f8('0xa')]('ShowSalesforceAccount',_0x2be8be);logger[_0xf0f8('0xd')]('ShowSalesforceAccount',_0x2be8be,JSON[_0xf0f8('0xf')](_0x437e46));_0x222e9d(_0x437e46);})[_0xf0f8('0x13')](function(_0x2f77b8){logger[_0xf0f8('0x10')](_0xf0f8('0x20'),_0x2f77b8['message'],_0x2be8be);_0x4b7f9b(_0x1a3916[_0xf0f8('0x10')](0x1f4,_0x2f77b8[_0xf0f8('0x12')]));});});}; \ No newline at end of file +var _0x964b=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSalesforceAccount','options','raw','attributes','include','model','map','stringify','ShowSalesforceAccount','where','then','lodash','util','bluebird','randomstring','ioredis'];(function(_0x47c958,_0x3cfe09){var _0x573eab=function(_0x380ec6){while(--_0x380ec6){_0x47c958['push'](_0x47c958['shift']());}};_0x573eab(++_0x3cfe09);}(_0x964b,0x112));var _0xb964=function(_0x572c91,_0x312ac9){_0x572c91=_0x572c91-0x0;var _0x36b873=_0x964b[_0x572c91];return _0x36b873;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var moment=require('moment');var BPromise=require(_0xb964('0x2'));var rs=require(_0xb964('0x3'));var fs=require('fs');var Redis=require(_0xb964('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb964('0x5'))('rpc');var config=require(_0xb964('0x6'));var jayson=require(_0xb964('0x7'));var client=jayson[_0xb964('0x8')][_0xb964('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x204c7d,_0xde47d5,_0x3fe401){return new BPromise(function(_0x53b463,_0x58e49e){return client[_0xb964('0xa')](_0x204c7d,_0x3fe401)['then'](function(_0x55e697){logger[_0xb964('0xb')](_0xb964('0xc'),_0xde47d5,_0xb964('0xd'));logger[_0xb964('0xe')](_0xb964('0xf'),_0xde47d5,_0xb964('0xd'),JSON['stringify'](_0x55e697));if(_0x55e697[_0xb964('0x10')]){if(_0x55e697[_0xb964('0x10')][_0xb964('0x11')]===0x1f4){logger[_0xb964('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0xde47d5,_0x55e697[_0xb964('0x10')]['message']);return _0x58e49e(_0x55e697['error'][_0xb964('0x12')]);}logger[_0xb964('0x10')](_0xb964('0xc'),_0xde47d5,_0x55e697[_0xb964('0x10')][_0xb964('0x12')]);return _0x53b463(_0x55e697[_0xb964('0x10')][_0xb964('0x12')]);}else{logger['info'](_0xb964('0xc'),_0xde47d5,'request\x20sent');_0x53b463(_0x55e697['result'][_0xb964('0x12')]);}})[_0xb964('0x13')](function(_0x26aa2c){logger[_0xb964('0x10')](_0xb964('0xc'),_0xde47d5,_0x26aa2c);_0x58e49e(_0x26aa2c);});});}exports[_0xb964('0x14')]=function(_0x263276){var _0x44d78a=this;return new Promise(function(_0x2bd9d5,_0x57772a){return db['SalesforceAccount']['findAll']({'raw':_0x263276[_0xb964('0x15')]?_0x263276[_0xb964('0x15')][_0xb964('0x16')]===undefined?!![]:![]:!![],'where':_0x263276[_0xb964('0x15')]?_0x263276[_0xb964('0x15')]['where']||null:null,'attributes':_0x263276['options']?_0x263276['options'][_0xb964('0x17')]||null:null,'limit':_0x263276[_0xb964('0x15')]?_0x263276[_0xb964('0x15')]['limit']||null:null,'include':_0x263276[_0xb964('0x15')]?_0x263276[_0xb964('0x15')][_0xb964('0x18')]?_['map'](_0x263276['options'][_0xb964('0x18')],function(_0x5469c2){return{'model':db[_0x5469c2[_0xb964('0x19')]],'as':_0x5469c2['as'],'attributes':_0x5469c2[_0xb964('0x17')],'include':_0x5469c2[_0xb964('0x18')]?_[_0xb964('0x1a')](_0x5469c2['include'],function(_0x1cecce){return{'model':db[_0x1cecce[_0xb964('0x19')]],'as':_0x1cecce['as'],'attributes':_0x1cecce[_0xb964('0x17')],'include':_0x1cecce[_0xb964('0x18')]?_[_0xb964('0x1a')](_0x1cecce[_0xb964('0x18')],function(_0x13d94d){return{'model':db[_0x13d94d[_0xb964('0x19')]],'as':_0x13d94d['as'],'attributes':_0x13d94d[_0xb964('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b5b7d){logger[_0xb964('0xb')](_0xb964('0x14'),_0x263276);logger[_0xb964('0xe')](_0xb964('0x14'),_0x263276,JSON[_0xb964('0x1b')](_0x2b5b7d));_0x2bd9d5(_0x2b5b7d);})[_0xb964('0x13')](function(_0x4fefa9){logger[_0xb964('0x10')](_0xb964('0x14'),_0x4fefa9[_0xb964('0x12')],_0x263276);_0x57772a(_0x44d78a['error'](0x1f4,_0x4fefa9[_0xb964('0x12')]));});});};exports[_0xb964('0x1c')]=function(_0xa0df8b){var _0x2cc8b6=this;return new Promise(function(_0x4321c3,_0x36117c){return db['SalesforceAccount']['find']({'raw':_0xa0df8b[_0xb964('0x15')]?_0xa0df8b[_0xb964('0x15')][_0xb964('0x16')]===undefined?!![]:![]:!![],'where':_0xa0df8b[_0xb964('0x15')]?_0xa0df8b['options'][_0xb964('0x1d')]||null:null,'attributes':_0xa0df8b['options']?_0xa0df8b[_0xb964('0x15')][_0xb964('0x17')]||null:null,'include':_0xa0df8b['options']?_0xa0df8b['options'][_0xb964('0x18')]?_[_0xb964('0x1a')](_0xa0df8b[_0xb964('0x15')][_0xb964('0x18')],function(_0x17fb50){return{'model':db[_0x17fb50[_0xb964('0x19')]],'as':_0x17fb50['as'],'attributes':_0x17fb50['attributes'],'include':_0x17fb50['include']?_['map'](_0x17fb50[_0xb964('0x18')],function(_0x726d32){return{'model':db[_0x726d32[_0xb964('0x19')]],'as':_0x726d32['as'],'attributes':_0x726d32[_0xb964('0x17')],'include':_0x726d32[_0xb964('0x18')]?_[_0xb964('0x1a')](_0x726d32['include'],function(_0x5aef1f){return{'model':db[_0x5aef1f[_0xb964('0x19')]],'as':_0x5aef1f['as'],'attributes':_0x5aef1f[_0xb964('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb964('0x1e')](function(_0x295863){logger[_0xb964('0xb')]('ShowSalesforceAccount',_0xa0df8b);logger[_0xb964('0xe')](_0xb964('0x1c'),_0xa0df8b,JSON[_0xb964('0x1b')](_0x295863));_0x4321c3(_0x295863);})[_0xb964('0x13')](function(_0x157726){logger[_0xb964('0x10')](_0xb964('0x1c'),_0x157726['message'],_0xa0df8b);_0x36117c(_0x2cc8b6[_0xb964('0x10')](0x1f4,_0x157726['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index d7d3a73..2c82fc3 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0b0e,0x187));var _0xe0b0=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0x0b0e[_0x35fabd];return _0x61a8ee;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x1cb85b,_0x3d86cc){var _0x29dbf2=function(_0x1daa3a){while(--_0x1daa3a){_0x1cb85b['push'](_0x1cb85b['shift']());}};_0x29dbf2(++_0x3d86cc);}(_0xadb5,0xad));var _0x5adb=function(_0x4c9535,_0x621932){_0x4c9535=_0x4c9535-0x0;var _0x433fa1=_0xadb5[_0x4c9535];return _0x433fa1;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index c536b87..9a5bef3 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61a8=['nothing','account','exports','STRING','ENUM','Task','contact_lead','contact','lead','account_contact_lead'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x61a8,0x1ce));var _0x861a=function(_0x1c1fba,_0xd5872d){_0x1c1fba=_0x1c1fba-0x0;var _0x37e346=_0x61a8[_0x1c1fba];return _0x37e346;};'use strict';var Sequelize=require('sequelize');module[_0x861a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x861a('0x1')]},'ticketType':{'type':Sequelize[_0x861a('0x2')](_0x861a('0x3'),'Case'),'defaultValue':_0x861a('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x861a('0x4'),_0x861a('0x5'),_0x861a('0x6'),_0x861a('0x7'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x861a('0x8'),_0x861a('0x5'),_0x861a('0x6'),_0x861a('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x861a('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x861a('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x861a('0x1')]}}; \ No newline at end of file +var _0x3b99=['lead','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','account','nothing'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x3b99,0x161));var _0x93b9=function(_0x402988,_0x33b094){_0x402988=_0x402988-0x0;var _0x3b0272=_0x3b99[_0x402988];return _0x3b0272;};'use strict';var Sequelize=require(_0x93b9('0x0'));module[_0x93b9('0x1')]={'name':{'type':Sequelize[_0x93b9('0x2')]},'description':{'type':Sequelize[_0x93b9('0x2')]},'ticketType':{'type':Sequelize[_0x93b9('0x3')](_0x93b9('0x4'),_0x93b9('0x5')),'defaultValue':_0x93b9('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x93b9('0x6'),_0x93b9('0x7'),'lead','account_contact_lead',_0x93b9('0x8')),'defaultValue':_0x93b9('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0x93b9('0x9'),_0x93b9('0x7'),_0x93b9('0xa'),_0x93b9('0x8')),'defaultValue':_0x93b9('0xa')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x93b9('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x93b9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 7d42b70..d9258ee 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4259=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','offset','json','save','update','then','destroy','end','error','stack','name','index','map','SalesforceConfiguration','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','count','include','findAll','rows','catch','show','rawAttributes','includeAll','options','find','create','body','params','getFields','findOne','SalesforceField','order','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x5095ab,_0x4260aa){var _0xbe337a=function(_0x3663cc){while(--_0x3663cc){_0x5095ab['push'](_0x5095ab['shift']());}};_0xbe337a(++_0x4260aa);}(_0x4259,0x188));var _0x9425=function(_0x584fe6,_0x22e10c){_0x584fe6=_0x584fe6-0x0;var _0x381ee2=_0x4259[_0x584fe6];return _0x381ee2;};'use strict';var emlformat=require(_0x9425('0x0'));var rimraf=require(_0x9425('0x1'));var zipdir=require(_0x9425('0x2'));var jsonpatch=require(_0x9425('0x3'));var rp=require(_0x9425('0x4'));var moment=require(_0x9425('0x5'));var BPromise=require(_0x9425('0x6'));var Mustache=require(_0x9425('0x7'));var util=require('util');var path=require(_0x9425('0x8'));var sox=require('sox');var csv=require(_0x9425('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9425('0xa'));var _=require(_0x9425('0xb'));var squel=require('squel');var crypto=require(_0x9425('0xc'));var jsforce=require(_0x9425('0xd'));var deskjs=require(_0x9425('0xe'));var toCsv=require(_0x9425('0x9'));var querystring=require(_0x9425('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9425('0x10'));var qs=require(_0x9425('0x11'));var as=require(_0x9425('0x12'));var hardwareService=require(_0x9425('0x13'));var logger=require(_0x9425('0x14'))(_0x9425('0x15'));var utils=require(_0x9425('0x16'));var config=require(_0x9425('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9425('0x18'))['db'];function respondWithStatusCode(_0x5eb79a,_0x33e074){_0x33e074=_0x33e074||0xcc;return function(_0x4fdab8){if(_0x4fdab8){return _0x5eb79a[_0x9425('0x19')](_0x33e074);}return _0x5eb79a[_0x9425('0x1a')](_0x33e074)['end']();};}function respondWithResult(_0x5b5d5d,_0x5c5425){_0x5c5425=_0x5c5425||0xc8;return function(_0x295d6f){if(_0x295d6f){return _0x5b5d5d['status'](_0x5c5425)['json'](_0x295d6f);}};}function respondWithFilteredResult(_0x4c7d8f,_0x597d95){return function(_0x406db4){if(_0x406db4){var _0x2f5c23=typeof _0x597d95['offset']===_0x9425('0x1b')&&typeof _0x597d95['limit']===_0x9425('0x1b');var _0x41aa8a=_0x406db4['count'];var _0x5e29cb=_0x2f5c23?0x0:_0x597d95[_0x9425('0x1c')];var _0x13eded=_0x2f5c23?_0x406db4['count']:_0x597d95[_0x9425('0x1c')]+_0x597d95['limit'];var _0xf4e371;if(_0x13eded>=_0x41aa8a){_0x13eded=_0x41aa8a;_0xf4e371=0xc8;}else{_0xf4e371=0xce;}_0x4c7d8f['status'](_0xf4e371);return _0x4c7d8f['set']('Content-Range',_0x5e29cb+'-'+_0x13eded+'/'+_0x41aa8a)[_0x9425('0x1d')](_0x406db4);}return null;};}function patchUpdates(_0x109a3a){return function(_0x39be0e){try{jsonpatch['apply'](_0x39be0e,_0x109a3a,!![]);}catch(_0x58ff97){return BPromise['reject'](_0x58ff97);}return _0x39be0e[_0x9425('0x1e')]();};}function saveUpdates(_0x5c7ebf,_0x52d9f6){return function(_0x3e0578){if(_0x3e0578){return _0x3e0578[_0x9425('0x1f')](_0x5c7ebf)[_0x9425('0x20')](function(_0x372a81){return _0x372a81;});}return null;};}function removeEntity(_0x6ff6aa,_0x4a957b){return function(_0x3be583){if(_0x3be583){return _0x3be583[_0x9425('0x21')]()['then'](function(){_0x6ff6aa[_0x9425('0x1a')](0xcc)[_0x9425('0x22')]();});}};}function handleEntityNotFound(_0x21fb8c,_0x131613){return function(_0x2a4d2c){if(!_0x2a4d2c){_0x21fb8c[_0x9425('0x19')](0x194);}return _0x2a4d2c;};}function handleError(_0x5c9c90,_0xdf6f7c){_0xdf6f7c=_0xdf6f7c||0x1f4;return function(_0x5748c1){logger[_0x9425('0x23')](_0x5748c1[_0x9425('0x24')]);if(_0x5748c1[_0x9425('0x25')]){delete _0x5748c1['name'];}_0x5c9c90[_0x9425('0x1a')](_0xdf6f7c)['send'](_0x5748c1);};}exports[_0x9425('0x26')]=function(_0x44780c,_0x3047d7){var _0x5b82d1={},_0x2188b2={},_0x122830={'count':0x0,'rows':[]};var _0x3e48e5=_[_0x9425('0x27')](db[_0x9425('0x28')]['rawAttributes'],function(_0x402462){return{'name':_0x402462[_0x9425('0x29')],'type':_0x402462[_0x9425('0x2a')][_0x9425('0x2b')]};});_0x2188b2['model']=_['map'](_0x3e48e5,_0x9425('0x25'));_0x2188b2[_0x9425('0x2c')]=_[_0x9425('0x2d')](_0x44780c[_0x9425('0x2c')]);_0x2188b2[_0x9425('0x2e')]=_[_0x9425('0x2f')](_0x2188b2[_0x9425('0x30')],_0x2188b2[_0x9425('0x2c')]);_0x5b82d1['attributes']=_[_0x9425('0x2f')](_0x2188b2['model'],qs[_0x9425('0x31')](_0x44780c[_0x9425('0x2c')][_0x9425('0x31')]));_0x5b82d1[_0x9425('0x32')]=_0x5b82d1[_0x9425('0x32')][_0x9425('0x33')]?_0x5b82d1['attributes']:_0x2188b2[_0x9425('0x30')];if(!_0x44780c[_0x9425('0x2c')][_0x9425('0x34')](_0x9425('0x35'))){_0x5b82d1[_0x9425('0x36')]=qs[_0x9425('0x36')](_0x44780c[_0x9425('0x2c')][_0x9425('0x36')]);_0x5b82d1['offset']=qs[_0x9425('0x1c')](_0x44780c[_0x9425('0x2c')][_0x9425('0x1c')]);}_0x5b82d1['order']=qs[_0x9425('0x37')](_0x44780c[_0x9425('0x2c')][_0x9425('0x37')]);_0x5b82d1[_0x9425('0x38')]=qs[_0x9425('0x2e')](_['pick'](_0x44780c[_0x9425('0x2c')],_0x2188b2[_0x9425('0x2e')]),_0x3e48e5);if(_0x44780c['query'][_0x9425('0x39')]){_0x5b82d1[_0x9425('0x38')]=_['merge'](_0x5b82d1['where'],{'$or':_[_0x9425('0x27')](_0x3e48e5,function(_0x21eddc){if(_0x21eddc['type']!=='VIRTUAL'){var _0x575030={};_0x575030[_0x21eddc['name']]={'$like':'%'+_0x44780c[_0x9425('0x2c')][_0x9425('0x39')]+'%'};return _0x575030;}})});}_0x5b82d1=_[_0x9425('0x3a')]({},_0x5b82d1,_0x44780c['options']);var _0x5d6b2c={'where':_0x5b82d1[_0x9425('0x38')]};return db[_0x9425('0x28')][_0x9425('0x3b')](_0x5d6b2c)[_0x9425('0x20')](function(_0x45a5af){_0x122830[_0x9425('0x3b')]=_0x45a5af;if(_0x44780c[_0x9425('0x2c')]['includeAll']){_0x5b82d1[_0x9425('0x3c')]=[{'all':!![]}];}return db[_0x9425('0x28')][_0x9425('0x3d')](_0x5b82d1);})[_0x9425('0x20')](function(_0xb5e47c){_0x122830[_0x9425('0x3e')]=_0xb5e47c;return _0x122830;})[_0x9425('0x20')](respondWithFilteredResult(_0x3047d7,_0x5b82d1))[_0x9425('0x3f')](handleError(_0x3047d7,null));};exports[_0x9425('0x40')]=function(_0x4a1cbf,_0x1ef722){var _0x3733b8={'raw':![],'where':{'id':_0x4a1cbf['params']['id']}},_0x37dd3c={};_0x37dd3c['model']=_['keys'](db['SalesforceConfiguration'][_0x9425('0x41')]);_0x37dd3c[_0x9425('0x2c')]=_[_0x9425('0x2d')](_0x4a1cbf[_0x9425('0x2c')]);_0x37dd3c[_0x9425('0x2e')]=_[_0x9425('0x2f')](_0x37dd3c[_0x9425('0x30')],_0x37dd3c[_0x9425('0x2c')]);_0x3733b8['attributes']=_['intersection'](_0x37dd3c[_0x9425('0x30')],qs[_0x9425('0x31')](_0x4a1cbf[_0x9425('0x2c')]['fields']));_0x3733b8[_0x9425('0x32')]=_0x3733b8[_0x9425('0x32')][_0x9425('0x33')]?_0x3733b8[_0x9425('0x32')]:_0x37dd3c[_0x9425('0x30')];if(_0x4a1cbf[_0x9425('0x2c')][_0x9425('0x42')]){_0x3733b8[_0x9425('0x3c')]=[{'all':!![]}];}_0x3733b8=_[_0x9425('0x3a')]({},_0x3733b8,_0x4a1cbf[_0x9425('0x43')]);return db[_0x9425('0x28')][_0x9425('0x44')](_0x3733b8)[_0x9425('0x20')](handleEntityNotFound(_0x1ef722,null))[_0x9425('0x20')](respondWithResult(_0x1ef722,null))[_0x9425('0x3f')](handleError(_0x1ef722,null));};exports[_0x9425('0x45')]=function(_0x273842,_0x26bad9){return db[_0x9425('0x28')][_0x9425('0x45')](_0x273842[_0x9425('0x46')],{})[_0x9425('0x20')](respondWithResult(_0x26bad9,0xc9))[_0x9425('0x3f')](handleError(_0x26bad9,null));};exports[_0x9425('0x1f')]=function(_0x7c4245,_0x3d8ad5){if(_0x7c4245[_0x9425('0x46')]['id']){delete _0x7c4245[_0x9425('0x46')]['id'];}return db['SalesforceConfiguration'][_0x9425('0x44')]({'where':{'id':_0x7c4245[_0x9425('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d8ad5,null))[_0x9425('0x20')](saveUpdates(_0x7c4245[_0x9425('0x46')],null))[_0x9425('0x20')](respondWithResult(_0x3d8ad5,null))[_0x9425('0x3f')](handleError(_0x3d8ad5,null));};exports[_0x9425('0x21')]=function(_0x25610d,_0x527c1c){return db[_0x9425('0x28')][_0x9425('0x44')]({'where':{'id':_0x25610d['params']['id']}})[_0x9425('0x20')](handleEntityNotFound(_0x527c1c,null))[_0x9425('0x20')](removeEntity(_0x527c1c,null))[_0x9425('0x3f')](handleError(_0x527c1c,null));};exports[_0x9425('0x48')]=function(_0x482a51,_0x1a3418,_0xb42275){var _0x2c9ad8={};var _0x442005={};var _0x3832ed;var _0x589f01;return db['SalesforceConfiguration'][_0x9425('0x49')]({'where':{'id':_0x482a51[_0x9425('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a3418,null))[_0x9425('0x20')](function(_0x2076cc){if(_0x2076cc){_0x3832ed=_0x2076cc;_0x442005[_0x9425('0x30')]=_[_0x9425('0x2d')](db[_0x9425('0x4a')][_0x9425('0x41')]);_0x442005[_0x9425('0x2c')]=_[_0x9425('0x2d')](_0x482a51[_0x9425('0x2c')]);_0x442005[_0x9425('0x2e')]=_[_0x9425('0x2f')](_0x442005[_0x9425('0x30')],_0x442005['query']);_0x2c9ad8[_0x9425('0x32')]=_[_0x9425('0x2f')](_0x442005[_0x9425('0x30')],qs[_0x9425('0x31')](_0x482a51[_0x9425('0x2c')][_0x9425('0x31')]));_0x2c9ad8['attributes']=_0x2c9ad8['attributes'][_0x9425('0x33')]?_0x2c9ad8[_0x9425('0x32')]:_0x442005[_0x9425('0x30')];_0x2c9ad8[_0x9425('0x4b')]=qs[_0x9425('0x37')](_0x482a51[_0x9425('0x2c')]['sort']);_0x2c9ad8[_0x9425('0x38')]=qs[_0x9425('0x2e')](_[_0x9425('0x4c')](_0x482a51['query'],_0x442005[_0x9425('0x2e')]));if(_0x482a51['query'][_0x9425('0x39')]){_0x2c9ad8[_0x9425('0x38')]=_[_0x9425('0x3a')](_0x2c9ad8[_0x9425('0x38')],{'$or':_[_0x9425('0x27')](_0x2c9ad8[_0x9425('0x32')],function(_0x34a48d){var _0x2deda9={};_0x2deda9[_0x34a48d]={'$like':'%'+_0x482a51[_0x9425('0x2c')][_0x9425('0x39')]+'%'};return _0x2deda9;})});}_0x2c9ad8=_[_0x9425('0x3a')]({},_0x2c9ad8,_0x482a51[_0x9425('0x43')]);return _0x3832ed['getFields'](_0x2c9ad8);}})[_0x9425('0x20')](function(_0x22347b){if(_0x22347b){_0x589f01=_0x22347b[_0x9425('0x33')];if(!_0x482a51[_0x9425('0x2c')][_0x9425('0x34')](_0x9425('0x35'))){_0x2c9ad8['limit']=qs[_0x9425('0x36')](_0x482a51[_0x9425('0x2c')]['limit']);_0x2c9ad8[_0x9425('0x1c')]=qs[_0x9425('0x1c')](_0x482a51[_0x9425('0x2c')][_0x9425('0x1c')]);}return _0x3832ed['getFields'](_0x2c9ad8);}})[_0x9425('0x20')](function(_0x1ec68c){if(_0x1ec68c){return _0x1ec68c?{'count':_0x589f01,'rows':_0x1ec68c}:null;}})[_0x9425('0x20')](respondWithResult(_0x1a3418,null))[_0x9425('0x3f')](handleError(_0x1a3418,null));};exports['getSubjects']=function(_0x3acead,_0x14230d,_0xd103b2){var _0x54782c={};var _0x2f684f={};var _0xfc237f;var _0x48a151;return db[_0x9425('0x28')][_0x9425('0x49')]({'where':{'id':_0x3acead[_0x9425('0x47')]['id']}})[_0x9425('0x20')](handleEntityNotFound(_0x14230d,null))[_0x9425('0x20')](function(_0x591414){if(_0x591414){_0xfc237f=_0x591414;_0x2f684f[_0x9425('0x30')]=_[_0x9425('0x2d')](db['SalesforceField'][_0x9425('0x41')]);_0x2f684f[_0x9425('0x2c')]=_[_0x9425('0x2d')](_0x3acead[_0x9425('0x2c')]);_0x2f684f['filters']=_[_0x9425('0x2f')](_0x2f684f[_0x9425('0x30')],_0x2f684f[_0x9425('0x2c')]);_0x54782c['attributes']=_[_0x9425('0x2f')](_0x2f684f[_0x9425('0x30')],qs['fields'](_0x3acead[_0x9425('0x2c')][_0x9425('0x31')]));_0x54782c[_0x9425('0x32')]=_0x54782c['attributes'][_0x9425('0x33')]?_0x54782c[_0x9425('0x32')]:_0x2f684f[_0x9425('0x30')];_0x54782c['order']=qs[_0x9425('0x37')](_0x3acead[_0x9425('0x2c')][_0x9425('0x37')]);_0x54782c['where']=qs[_0x9425('0x2e')](_[_0x9425('0x4c')](_0x3acead[_0x9425('0x2c')],_0x2f684f[_0x9425('0x2e')]));if(_0x3acead[_0x9425('0x2c')]['filter']){_0x54782c[_0x9425('0x38')]=_[_0x9425('0x3a')](_0x54782c[_0x9425('0x38')],{'$or':_[_0x9425('0x27')](_0x54782c[_0x9425('0x32')],function(_0x250832){var _0x517753={};_0x517753[_0x250832]={'$like':'%'+_0x3acead[_0x9425('0x2c')][_0x9425('0x39')]+'%'};return _0x517753;})});}_0x54782c=_['merge']({},_0x54782c,_0x3acead[_0x9425('0x43')]);return _0xfc237f[_0x9425('0x4d')](_0x54782c);}})[_0x9425('0x20')](function(_0x36698c){if(_0x36698c){_0x48a151=_0x36698c[_0x9425('0x33')];if(!_0x3acead[_0x9425('0x2c')][_0x9425('0x34')](_0x9425('0x35'))){_0x54782c['limit']=qs['limit'](_0x3acead[_0x9425('0x2c')][_0x9425('0x36')]);_0x54782c[_0x9425('0x1c')]=qs['offset'](_0x3acead[_0x9425('0x2c')][_0x9425('0x1c')]);}return _0xfc237f[_0x9425('0x4d')](_0x54782c);}})[_0x9425('0x20')](function(_0xb35884){if(_0xb35884){return _0xb35884?{'count':_0x48a151,'rows':_0xb35884}:null;}})[_0x9425('0x20')](respondWithResult(_0x14230d,null))[_0x9425('0x3f')](handleError(_0x14230d,null));};exports[_0x9425('0x4e')]=function(_0x3e41eb,_0x40c6c8,_0x2b66c3){var _0x2b04c6={};var _0x1f5bb5={};var _0x4b810c;var _0x51e827;return db[_0x9425('0x28')]['findOne']({'where':{'id':_0x3e41eb[_0x9425('0x47')]['id']}})[_0x9425('0x20')](handleEntityNotFound(_0x40c6c8,null))[_0x9425('0x20')](function(_0x3cfe06){if(_0x3cfe06){_0x4b810c=_0x3cfe06;_0x1f5bb5[_0x9425('0x30')]=_[_0x9425('0x2d')](db[_0x9425('0x4a')][_0x9425('0x41')]);_0x1f5bb5['query']=_['keys'](_0x3e41eb['query']);_0x1f5bb5[_0x9425('0x2e')]=_['intersection'](_0x1f5bb5['model'],_0x1f5bb5[_0x9425('0x2c')]);_0x2b04c6['attributes']=_[_0x9425('0x2f')](_0x1f5bb5[_0x9425('0x30')],qs[_0x9425('0x31')](_0x3e41eb[_0x9425('0x2c')]['fields']));_0x2b04c6['attributes']=_0x2b04c6[_0x9425('0x32')][_0x9425('0x33')]?_0x2b04c6[_0x9425('0x32')]:_0x1f5bb5[_0x9425('0x30')];_0x2b04c6[_0x9425('0x4b')]=qs[_0x9425('0x37')](_0x3e41eb[_0x9425('0x2c')][_0x9425('0x37')]);_0x2b04c6[_0x9425('0x38')]=qs[_0x9425('0x2e')](_[_0x9425('0x4c')](_0x3e41eb['query'],_0x1f5bb5[_0x9425('0x2e')]));if(_0x3e41eb[_0x9425('0x2c')][_0x9425('0x39')]){_0x2b04c6[_0x9425('0x38')]=_[_0x9425('0x3a')](_0x2b04c6[_0x9425('0x38')],{'$or':_['map'](_0x2b04c6[_0x9425('0x32')],function(_0x22ace6){var _0x5b07c8={};_0x5b07c8[_0x22ace6]={'$like':'%'+_0x3e41eb['query'][_0x9425('0x39')]+'%'};return _0x5b07c8;})});}_0x2b04c6=_[_0x9425('0x3a')]({},_0x2b04c6,_0x3e41eb['options']);return _0x4b810c[_0x9425('0x4e')](_0x2b04c6);}})['then'](function(_0x450429){if(_0x450429){_0x51e827=_0x450429[_0x9425('0x33')];if(!_0x3e41eb[_0x9425('0x2c')][_0x9425('0x34')](_0x9425('0x35'))){_0x2b04c6[_0x9425('0x36')]=qs[_0x9425('0x36')](_0x3e41eb[_0x9425('0x2c')]['limit']);_0x2b04c6['offset']=qs[_0x9425('0x1c')](_0x3e41eb[_0x9425('0x2c')][_0x9425('0x1c')]);}return _0x4b810c[_0x9425('0x4e')](_0x2b04c6);}})[_0x9425('0x20')](function(_0x4c2bc6){if(_0x4c2bc6){return _0x4c2bc6?{'count':_0x51e827,'rows':_0x4c2bc6}:null;}})[_0x9425('0x20')](respondWithResult(_0x40c6c8,null))[_0x9425('0x3f')](handleError(_0x40c6c8,null));}; \ No newline at end of file +var _0x528f=['create','body','getFields','findOne','SalesforceField','length','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x28b3bb,_0xa77ae5){var _0x379851=function(_0x1de628){while(--_0x1de628){_0x28b3bb['push'](_0x28b3bb['shift']());}};_0x379851(++_0xa77ae5);}(_0x528f,0x140));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf528('0x0'));var zipdir=require(_0xf528('0x1'));var jsonpatch=require(_0xf528('0x2'));var rp=require(_0xf528('0x3'));var moment=require(_0xf528('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf528('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf528('0x6'));var csv=require('to-csv');var ejs=require(_0xf528('0x7'));var fs=require('fs');var fs_extra=require(_0xf528('0x8'));var _=require('lodash');var squel=require(_0xf528('0x9'));var crypto=require(_0xf528('0xa'));var jsforce=require(_0xf528('0xb'));var deskjs=require(_0xf528('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf528('0xd'));var Redis=require('ioredis');var authService=require(_0xf528('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf528('0xf'));var logger=require('../../config/logger')(_0xf528('0x10'));var utils=require(_0xf528('0x11'));var config=require(_0xf528('0x12'));var licenseUtil=require(_0xf528('0x13'));var db=require(_0xf528('0x14'))['db'];function respondWithStatusCode(_0x2bc000,_0x57e721){_0x57e721=_0x57e721||0xcc;return function(_0x3ee03d){if(_0x3ee03d){return _0x2bc000[_0xf528('0x15')](_0x57e721);}return _0x2bc000[_0xf528('0x16')](_0x57e721)[_0xf528('0x17')]();};}function respondWithResult(_0x432ba2,_0x85b593){_0x85b593=_0x85b593||0xc8;return function(_0x233139){if(_0x233139){return _0x432ba2[_0xf528('0x16')](_0x85b593)[_0xf528('0x18')](_0x233139);}};}function respondWithFilteredResult(_0x155fe6,_0x490980){return function(_0x4d764a){if(_0x4d764a){var _0x1d9d2a=typeof _0x490980[_0xf528('0x19')]===_0xf528('0x1a')&&typeof _0x490980[_0xf528('0x1b')]===_0xf528('0x1a');var _0x4bae1a=_0x4d764a['count'];var _0x251fb5=_0x1d9d2a?0x0:_0x490980[_0xf528('0x19')];var _0x128be4=_0x1d9d2a?_0x4d764a['count']:_0x490980['offset']+_0x490980[_0xf528('0x1b')];var _0x5c23c8;if(_0x128be4>=_0x4bae1a){_0x128be4=_0x4bae1a;_0x5c23c8=0xc8;}else{_0x5c23c8=0xce;}_0x155fe6[_0xf528('0x16')](_0x5c23c8);return _0x155fe6[_0xf528('0x1c')](_0xf528('0x1d'),_0x251fb5+'-'+_0x128be4+'/'+_0x4bae1a)[_0xf528('0x18')](_0x4d764a);}return null;};}function patchUpdates(_0x11263d){return function(_0x3db01b){try{jsonpatch[_0xf528('0x1e')](_0x3db01b,_0x11263d,!![]);}catch(_0x35e150){return BPromise['reject'](_0x35e150);}return _0x3db01b[_0xf528('0x1f')]();};}function saveUpdates(_0x13db73,_0x2cd2d7){return function(_0x3d55cc){if(_0x3d55cc){return _0x3d55cc[_0xf528('0x20')](_0x13db73)[_0xf528('0x21')](function(_0x1293f9){return _0x1293f9;});}return null;};}function removeEntity(_0x28b80c,_0x5d7ca4){return function(_0x4b0a02){if(_0x4b0a02){return _0x4b0a02[_0xf528('0x22')]()[_0xf528('0x21')](function(){_0x28b80c[_0xf528('0x16')](0xcc)[_0xf528('0x17')]();});}};}function handleEntityNotFound(_0x3596ce,_0x4a7238){return function(_0x8c5bf1){if(!_0x8c5bf1){_0x3596ce[_0xf528('0x15')](0x194);}return _0x8c5bf1;};}function handleError(_0x5e0a44,_0x475e8e){_0x475e8e=_0x475e8e||0x1f4;return function(_0xe5d90c){logger['error'](_0xe5d90c[_0xf528('0x23')]);if(_0xe5d90c['name']){delete _0xe5d90c[_0xf528('0x24')];}_0x5e0a44[_0xf528('0x16')](_0x475e8e)[_0xf528('0x25')](_0xe5d90c);};}exports['index']=function(_0x4dd8fd,_0x9a5467){var _0x31a194={},_0x25cca4={},_0x2867fd={'count':0x0,'rows':[]};var _0xbeaa21=_[_0xf528('0x26')](db[_0xf528('0x27')][_0xf528('0x28')],function(_0x14b950){return{'name':_0x14b950[_0xf528('0x29')],'type':_0x14b950[_0xf528('0x2a')][_0xf528('0x2b')]};});_0x25cca4[_0xf528('0x2c')]=_[_0xf528('0x26')](_0xbeaa21,_0xf528('0x24'));_0x25cca4[_0xf528('0x2d')]=_[_0xf528('0x2e')](_0x4dd8fd['query']);_0x25cca4[_0xf528('0x2f')]=_[_0xf528('0x30')](_0x25cca4[_0xf528('0x2c')],_0x25cca4[_0xf528('0x2d')]);_0x31a194[_0xf528('0x31')]=_[_0xf528('0x30')](_0x25cca4['model'],qs['fields'](_0x4dd8fd[_0xf528('0x2d')][_0xf528('0x32')]));_0x31a194[_0xf528('0x31')]=_0x31a194[_0xf528('0x31')]['length']?_0x31a194[_0xf528('0x31')]:_0x25cca4[_0xf528('0x2c')];if(!_0x4dd8fd[_0xf528('0x2d')][_0xf528('0x33')](_0xf528('0x34'))){_0x31a194[_0xf528('0x1b')]=qs[_0xf528('0x1b')](_0x4dd8fd[_0xf528('0x2d')]['limit']);_0x31a194['offset']=qs[_0xf528('0x19')](_0x4dd8fd[_0xf528('0x2d')][_0xf528('0x19')]);}_0x31a194[_0xf528('0x35')]=qs[_0xf528('0x36')](_0x4dd8fd[_0xf528('0x2d')][_0xf528('0x36')]);_0x31a194[_0xf528('0x37')]=qs[_0xf528('0x2f')](_[_0xf528('0x38')](_0x4dd8fd['query'],_0x25cca4[_0xf528('0x2f')]),_0xbeaa21);if(_0x4dd8fd['query'][_0xf528('0x39')]){_0x31a194[_0xf528('0x37')]=_[_0xf528('0x3a')](_0x31a194['where'],{'$or':_[_0xf528('0x26')](_0xbeaa21,function(_0x6793e){if(_0x6793e[_0xf528('0x2a')]!==_0xf528('0x3b')){var _0x4e3ec4={};_0x4e3ec4[_0x6793e[_0xf528('0x24')]]={'$like':'%'+_0x4dd8fd['query'][_0xf528('0x39')]+'%'};return _0x4e3ec4;}})});}_0x31a194=_[_0xf528('0x3a')]({},_0x31a194,_0x4dd8fd[_0xf528('0x3c')]);var _0x14d76e={'where':_0x31a194['where']};return db[_0xf528('0x27')][_0xf528('0x3d')](_0x14d76e)[_0xf528('0x21')](function(_0x4bd6c8){_0x2867fd[_0xf528('0x3d')]=_0x4bd6c8;if(_0x4dd8fd['query'][_0xf528('0x3e')]){_0x31a194[_0xf528('0x3f')]=[{'all':!![]}];}return db[_0xf528('0x27')][_0xf528('0x40')](_0x31a194);})['then'](function(_0x304e74){_0x2867fd[_0xf528('0x41')]=_0x304e74;return _0x2867fd;})['then'](respondWithFilteredResult(_0x9a5467,_0x31a194))[_0xf528('0x42')](handleError(_0x9a5467,null));};exports[_0xf528('0x43')]=function(_0x5aae17,_0x1810b3){var _0x17f04b={'raw':![],'where':{'id':_0x5aae17[_0xf528('0x44')]['id']}},_0x4d2626={};_0x4d2626[_0xf528('0x2c')]=_['keys'](db['SalesforceConfiguration'][_0xf528('0x28')]);_0x4d2626[_0xf528('0x2d')]=_[_0xf528('0x2e')](_0x5aae17[_0xf528('0x2d')]);_0x4d2626[_0xf528('0x2f')]=_[_0xf528('0x30')](_0x4d2626['model'],_0x4d2626[_0xf528('0x2d')]);_0x17f04b[_0xf528('0x31')]=_['intersection'](_0x4d2626[_0xf528('0x2c')],qs[_0xf528('0x32')](_0x5aae17[_0xf528('0x2d')]['fields']));_0x17f04b['attributes']=_0x17f04b[_0xf528('0x31')]['length']?_0x17f04b[_0xf528('0x31')]:_0x4d2626[_0xf528('0x2c')];if(_0x5aae17['query'][_0xf528('0x3e')]){_0x17f04b[_0xf528('0x3f')]=[{'all':!![]}];}_0x17f04b=_[_0xf528('0x3a')]({},_0x17f04b,_0x5aae17[_0xf528('0x3c')]);return db[_0xf528('0x27')][_0xf528('0x45')](_0x17f04b)[_0xf528('0x21')](handleEntityNotFound(_0x1810b3,null))['then'](respondWithResult(_0x1810b3,null))[_0xf528('0x42')](handleError(_0x1810b3,null));};exports[_0xf528('0x46')]=function(_0x97cc3e,_0xc82ffe){return db[_0xf528('0x27')][_0xf528('0x46')](_0x97cc3e[_0xf528('0x47')],{})['then'](respondWithResult(_0xc82ffe,0xc9))['catch'](handleError(_0xc82ffe,null));};exports[_0xf528('0x20')]=function(_0xb90ef0,_0x4d08ab){if(_0xb90ef0[_0xf528('0x47')]['id']){delete _0xb90ef0[_0xf528('0x47')]['id'];}return db[_0xf528('0x27')][_0xf528('0x45')]({'where':{'id':_0xb90ef0[_0xf528('0x44')]['id']}})[_0xf528('0x21')](handleEntityNotFound(_0x4d08ab,null))[_0xf528('0x21')](saveUpdates(_0xb90ef0[_0xf528('0x47')],null))[_0xf528('0x21')](respondWithResult(_0x4d08ab,null))[_0xf528('0x42')](handleError(_0x4d08ab,null));};exports[_0xf528('0x22')]=function(_0x44af24,_0xb754cd){return db[_0xf528('0x27')][_0xf528('0x45')]({'where':{'id':_0x44af24['params']['id']}})[_0xf528('0x21')](handleEntityNotFound(_0xb754cd,null))[_0xf528('0x21')](removeEntity(_0xb754cd,null))[_0xf528('0x42')](handleError(_0xb754cd,null));};exports[_0xf528('0x48')]=function(_0x2002ed,_0x900f8d,_0x5062cb){var _0x10eb6c={};var _0x2d316a={};var _0x2413f2;var _0x30bda2;return db['SalesforceConfiguration'][_0xf528('0x49')]({'where':{'id':_0x2002ed[_0xf528('0x44')]['id']}})[_0xf528('0x21')](handleEntityNotFound(_0x900f8d,null))[_0xf528('0x21')](function(_0x27155d){if(_0x27155d){_0x2413f2=_0x27155d;_0x2d316a['model']=_['keys'](db[_0xf528('0x4a')][_0xf528('0x28')]);_0x2d316a[_0xf528('0x2d')]=_[_0xf528('0x2e')](_0x2002ed[_0xf528('0x2d')]);_0x2d316a[_0xf528('0x2f')]=_[_0xf528('0x30')](_0x2d316a[_0xf528('0x2c')],_0x2d316a['query']);_0x10eb6c[_0xf528('0x31')]=_[_0xf528('0x30')](_0x2d316a[_0xf528('0x2c')],qs['fields'](_0x2002ed[_0xf528('0x2d')][_0xf528('0x32')]));_0x10eb6c[_0xf528('0x31')]=_0x10eb6c[_0xf528('0x31')][_0xf528('0x4b')]?_0x10eb6c[_0xf528('0x31')]:_0x2d316a['model'];_0x10eb6c[_0xf528('0x35')]=qs[_0xf528('0x36')](_0x2002ed['query'][_0xf528('0x36')]);_0x10eb6c[_0xf528('0x37')]=qs[_0xf528('0x2f')](_['pick'](_0x2002ed[_0xf528('0x2d')],_0x2d316a['filters']));if(_0x2002ed[_0xf528('0x2d')][_0xf528('0x39')]){_0x10eb6c[_0xf528('0x37')]=_[_0xf528('0x3a')](_0x10eb6c[_0xf528('0x37')],{'$or':_[_0xf528('0x26')](_0x10eb6c['attributes'],function(_0xfd78ce){var _0x4153b4={};_0x4153b4[_0xfd78ce]={'$like':'%'+_0x2002ed[_0xf528('0x2d')]['filter']+'%'};return _0x4153b4;})});}_0x10eb6c=_[_0xf528('0x3a')]({},_0x10eb6c,_0x2002ed[_0xf528('0x3c')]);return _0x2413f2[_0xf528('0x48')](_0x10eb6c);}})[_0xf528('0x21')](function(_0x1fbed8){if(_0x1fbed8){_0x30bda2=_0x1fbed8['length'];if(!_0x2002ed[_0xf528('0x2d')][_0xf528('0x33')](_0xf528('0x34'))){_0x10eb6c[_0xf528('0x1b')]=qs[_0xf528('0x1b')](_0x2002ed['query'][_0xf528('0x1b')]);_0x10eb6c['offset']=qs[_0xf528('0x19')](_0x2002ed[_0xf528('0x2d')][_0xf528('0x19')]);}return _0x2413f2[_0xf528('0x48')](_0x10eb6c);}})[_0xf528('0x21')](function(_0x1b18c2){if(_0x1b18c2){return _0x1b18c2?{'count':_0x30bda2,'rows':_0x1b18c2}:null;}})[_0xf528('0x21')](respondWithResult(_0x900f8d,null))['catch'](handleError(_0x900f8d,null));};exports['getSubjects']=function(_0x348f61,_0x1ee478,_0x55bbf4){var _0x4ab2ac={};var _0x5fb9ec={};var _0x4f1667;var _0x4fae01;return db[_0xf528('0x27')]['findOne']({'where':{'id':_0x348f61[_0xf528('0x44')]['id']}})[_0xf528('0x21')](handleEntityNotFound(_0x1ee478,null))[_0xf528('0x21')](function(_0x4ffc82){if(_0x4ffc82){_0x4f1667=_0x4ffc82;_0x5fb9ec['model']=_[_0xf528('0x2e')](db[_0xf528('0x4a')][_0xf528('0x28')]);_0x5fb9ec['query']=_[_0xf528('0x2e')](_0x348f61['query']);_0x5fb9ec[_0xf528('0x2f')]=_[_0xf528('0x30')](_0x5fb9ec[_0xf528('0x2c')],_0x5fb9ec[_0xf528('0x2d')]);_0x4ab2ac[_0xf528('0x31')]=_[_0xf528('0x30')](_0x5fb9ec['model'],qs['fields'](_0x348f61[_0xf528('0x2d')][_0xf528('0x32')]));_0x4ab2ac[_0xf528('0x31')]=_0x4ab2ac['attributes'][_0xf528('0x4b')]?_0x4ab2ac['attributes']:_0x5fb9ec['model'];_0x4ab2ac[_0xf528('0x35')]=qs[_0xf528('0x36')](_0x348f61['query'][_0xf528('0x36')]);_0x4ab2ac[_0xf528('0x37')]=qs[_0xf528('0x2f')](_['pick'](_0x348f61['query'],_0x5fb9ec[_0xf528('0x2f')]));if(_0x348f61[_0xf528('0x2d')]['filter']){_0x4ab2ac[_0xf528('0x37')]=_[_0xf528('0x3a')](_0x4ab2ac[_0xf528('0x37')],{'$or':_[_0xf528('0x26')](_0x4ab2ac['attributes'],function(_0x5adfe6){var _0x359cb0={};_0x359cb0[_0x5adfe6]={'$like':'%'+_0x348f61[_0xf528('0x2d')]['filter']+'%'};return _0x359cb0;})});}_0x4ab2ac=_[_0xf528('0x3a')]({},_0x4ab2ac,_0x348f61[_0xf528('0x3c')]);return _0x4f1667[_0xf528('0x4c')](_0x4ab2ac);}})['then'](function(_0x15ec70){if(_0x15ec70){_0x4fae01=_0x15ec70[_0xf528('0x4b')];if(!_0x348f61[_0xf528('0x2d')]['hasOwnProperty'](_0xf528('0x34'))){_0x4ab2ac['limit']=qs[_0xf528('0x1b')](_0x348f61[_0xf528('0x2d')][_0xf528('0x1b')]);_0x4ab2ac[_0xf528('0x19')]=qs['offset'](_0x348f61[_0xf528('0x2d')][_0xf528('0x19')]);}return _0x4f1667[_0xf528('0x4c')](_0x4ab2ac);}})['then'](function(_0x4dc33c){if(_0x4dc33c){return _0x4dc33c?{'count':_0x4fae01,'rows':_0x4dc33c}:null;}})[_0xf528('0x21')](respondWithResult(_0x1ee478,null))[_0xf528('0x42')](handleError(_0x1ee478,null));};exports['getDescriptions']=function(_0xa5a873,_0x1ca4b5,_0x2b7030){var _0x398aaa={};var _0x3ab4c4={};var _0x58c56d;var _0x23f11a;return db[_0xf528('0x27')][_0xf528('0x49')]({'where':{'id':_0xa5a873[_0xf528('0x44')]['id']}})[_0xf528('0x21')](handleEntityNotFound(_0x1ca4b5,null))[_0xf528('0x21')](function(_0x2a84cc){if(_0x2a84cc){_0x58c56d=_0x2a84cc;_0x3ab4c4[_0xf528('0x2c')]=_[_0xf528('0x2e')](db[_0xf528('0x4a')][_0xf528('0x28')]);_0x3ab4c4[_0xf528('0x2d')]=_[_0xf528('0x2e')](_0xa5a873[_0xf528('0x2d')]);_0x3ab4c4[_0xf528('0x2f')]=_['intersection'](_0x3ab4c4[_0xf528('0x2c')],_0x3ab4c4['query']);_0x398aaa[_0xf528('0x31')]=_[_0xf528('0x30')](_0x3ab4c4[_0xf528('0x2c')],qs[_0xf528('0x32')](_0xa5a873[_0xf528('0x2d')][_0xf528('0x32')]));_0x398aaa[_0xf528('0x31')]=_0x398aaa[_0xf528('0x31')]['length']?_0x398aaa[_0xf528('0x31')]:_0x3ab4c4['model'];_0x398aaa[_0xf528('0x35')]=qs[_0xf528('0x36')](_0xa5a873[_0xf528('0x2d')][_0xf528('0x36')]);_0x398aaa[_0xf528('0x37')]=qs[_0xf528('0x2f')](_[_0xf528('0x38')](_0xa5a873[_0xf528('0x2d')],_0x3ab4c4[_0xf528('0x2f')]));if(_0xa5a873['query'][_0xf528('0x39')]){_0x398aaa['where']=_[_0xf528('0x3a')](_0x398aaa[_0xf528('0x37')],{'$or':_['map'](_0x398aaa[_0xf528('0x31')],function(_0x18dfbc){var _0x5edc42={};_0x5edc42[_0x18dfbc]={'$like':'%'+_0xa5a873[_0xf528('0x2d')][_0xf528('0x39')]+'%'};return _0x5edc42;})});}_0x398aaa=_[_0xf528('0x3a')]({},_0x398aaa,_0xa5a873[_0xf528('0x3c')]);return _0x58c56d[_0xf528('0x4d')](_0x398aaa);}})[_0xf528('0x21')](function(_0x4dbc1d){if(_0x4dbc1d){_0x23f11a=_0x4dbc1d[_0xf528('0x4b')];if(!_0xa5a873[_0xf528('0x2d')]['hasOwnProperty'](_0xf528('0x34'))){_0x398aaa[_0xf528('0x1b')]=qs[_0xf528('0x1b')](_0xa5a873[_0xf528('0x2d')][_0xf528('0x1b')]);_0x398aaa[_0xf528('0x19')]=qs[_0xf528('0x19')](_0xa5a873[_0xf528('0x2d')][_0xf528('0x19')]);}return _0x58c56d[_0xf528('0x4d')](_0x398aaa);}})['then'](function(_0x1a5755){if(_0x1a5755){return _0x1a5755?{'count':_0x23f11a,'rows':_0x1a5755}:null;}})[_0xf528('0x21')](respondWithResult(_0x1ca4b5,null))[_0xf528('0x42')](handleError(_0x1ca4b5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e443af7..690efe1 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd6a=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SalesforceConfiguration','lodash','util'];(function(_0x4a881e,_0xa4ce97){var _0x210714=function(_0x367d78){while(--_0x367d78){_0x4a881e['push'](_0x4a881e['shift']());}};_0x210714(++_0xa4ce97);}(_0xdd6a,0x15e));var _0xadd6=function(_0x191917,_0x552ff4){_0x191917=_0x191917-0x0;var _0x52a7ec=_0xdd6a[_0x191917];return _0x52a7ec;};'use strict';var _=require(_0xadd6('0x0'));var util=require(_0xadd6('0x1'));var logger=require(_0xadd6('0x2'))('api');var moment=require(_0xadd6('0x3'));var BPromise=require(_0xadd6('0x4'));var rp=require(_0xadd6('0x5'));var fs=require('fs');var path=require(_0xadd6('0x6'));var rimraf=require(_0xadd6('0x7'));var config=require(_0xadd6('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xadd6('0x9')]=function(_0x200977,_0x1449cb){return _0x200977['define'](_0xadd6('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82e5=['../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','api','moment','request-promise','path'];(function(_0x2eaabe,_0x42785c){var _0x6f3d05=function(_0x3347af){while(--_0x3347af){_0x2eaabe['push'](_0x2eaabe['shift']());}};_0x6f3d05(++_0x42785c);}(_0x82e5,0x109));var _0x582e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x82e5[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x582e('0x0'))(_0x582e('0x1'));var moment=require(_0x582e('0x2'));var BPromise=require('bluebird');var rp=require(_0x582e('0x3'));var fs=require('fs');var path=require(_0x582e('0x4'));var rimraf=require('rimraf');var config=require(_0x582e('0x5'));var attributes=require(_0x582e('0x6'));module[_0x582e('0x7')]=function(_0x3d8955,_0xf6925c){return _0x3d8955['define'](_0x582e('0x8'),attributes,{'tableName':_0x582e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 0d7695f..63c97cc 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6802=['message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x33e424,_0x45cce6){var _0x452430=function(_0xbabba){while(--_0xbabba){_0x33e424['push'](_0x33e424['shift']());}};_0x452430(++_0x45cce6);}(_0x6802,0x1a6));var _0x2680=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x6802[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0x2680('0x0'));var util=require('util');var moment=require(_0x2680('0x1'));var BPromise=require(_0x2680('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2680('0x3'));var db=require(_0x2680('0x4'))['db'];var utils=require(_0x2680('0x5'));var logger=require('../../config/logger')(_0x2680('0x6'));var config=require(_0x2680('0x7'));var jayson=require(_0x2680('0x8'));var client=jayson[_0x2680('0x9')][_0x2680('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38a9c9,_0x32b9c3,_0xf1b567){return new BPromise(function(_0x291994,_0x3aeeb9){return client[_0x2680('0xb')](_0x38a9c9,_0xf1b567)[_0x2680('0xc')](function(_0x5c0ba0){logger[_0x2680('0xd')](_0x2680('0xe'),_0x32b9c3,_0x2680('0xf'));logger['debug'](_0x2680('0x10'),_0x32b9c3,'request\x20sent',JSON['stringify'](_0x5c0ba0));if(_0x5c0ba0[_0x2680('0x11')]){if(_0x5c0ba0[_0x2680('0x11')][_0x2680('0x12')]===0x1f4){logger['error'](_0x2680('0xe'),_0x32b9c3,_0x5c0ba0[_0x2680('0x11')][_0x2680('0x13')]);return _0x3aeeb9(_0x5c0ba0[_0x2680('0x11')]['message']);}logger[_0x2680('0x11')](_0x2680('0xe'),_0x32b9c3,_0x5c0ba0[_0x2680('0x11')][_0x2680('0x13')]);return _0x291994(_0x5c0ba0[_0x2680('0x11')][_0x2680('0x13')]);}else{logger[_0x2680('0xd')](_0x2680('0xe'),_0x32b9c3,_0x2680('0xf'));_0x291994(_0x5c0ba0[_0x2680('0x14')][_0x2680('0x13')]);}})['catch'](function(_0x4553f6){logger[_0x2680('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x32b9c3,_0x4553f6);_0x3aeeb9(_0x4553f6);});});} \ No newline at end of file +var _0x6ec0=['request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http'];(function(_0x22f46f,_0x4655d4){var _0x554945=function(_0x472bb6){while(--_0x472bb6){_0x22f46f['push'](_0x22f46f['shift']());}};_0x554945(++_0x4655d4);}(_0x6ec0,0x1da));var _0x06ec=function(_0x2c26a0,_0x2b9577){_0x2c26a0=_0x2c26a0-0x0;var _0x3e26d2=_0x6ec0[_0x2c26a0];return _0x3e26d2;};'use strict';var _=require(_0x06ec('0x0'));var util=require('util');var moment=require(_0x06ec('0x1'));var BPromise=require(_0x06ec('0x2'));var rs=require(_0x06ec('0x3'));var fs=require('fs');var Redis=require(_0x06ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x06ec('0x5'))('rpc');var config=require(_0x06ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x06ec('0x7')][_0x06ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a029d,_0x483b35,_0x1b94cb){return new BPromise(function(_0x3640df,_0x57662e){return client[_0x06ec('0x9')](_0x3a029d,_0x1b94cb)[_0x06ec('0xa')](function(_0x1903b5){logger[_0x06ec('0xb')](_0x06ec('0xc'),_0x483b35,_0x06ec('0xd'));logger[_0x06ec('0xe')](_0x06ec('0xf'),_0x483b35,_0x06ec('0xd'),JSON[_0x06ec('0x10')](_0x1903b5));if(_0x1903b5[_0x06ec('0x11')]){if(_0x1903b5[_0x06ec('0x11')][_0x06ec('0x12')]===0x1f4){logger['error'](_0x06ec('0xc'),_0x483b35,_0x1903b5['error'][_0x06ec('0x13')]);return _0x57662e(_0x1903b5['error']['message']);}logger[_0x06ec('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x483b35,_0x1903b5[_0x06ec('0x11')][_0x06ec('0x13')]);return _0x3640df(_0x1903b5[_0x06ec('0x11')][_0x06ec('0x13')]);}else{logger[_0x06ec('0xb')](_0x06ec('0xc'),_0x483b35,'request\x20sent');_0x3640df(_0x1903b5[_0x06ec('0x14')]['message']);}})['catch'](function(_0x2ce0b5){logger[_0x06ec('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x483b35,_0x2ce0b5);_0x57662e(_0x2ce0b5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index f64ccab..d459a6a 100644 --- a/server/api/intSalesforceField/index.js +++ b/server/api/intSalesforceField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaf9=['index','/:id','show','post','create','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x276c4f,_0x1a044a){var _0x5bba7f=function(_0x45d423){while(--_0x45d423){_0x276c4f['push'](_0x276c4f['shift']());}};_0x5bba7f(++_0x1a044a);}(_0xfaf9,0x166));var _0x9faf=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xfaf9[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0x9faf('0x0'));var util=require(_0x9faf('0x1'));var path=require(_0x9faf('0x2'));var timeout=require(_0x9faf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9faf('0x4'));var auth=require(_0x9faf('0x5'));var interaction=require(_0x9faf('0x6'));var config=require(_0x9faf('0x7'));var controller=require('./intSalesforceField.controller');router[_0x9faf('0x8')]('/',auth[_0x9faf('0x9')](),controller[_0x9faf('0xa')]);router[_0x9faf('0x8')](_0x9faf('0xb'),auth[_0x9faf('0x9')](),controller[_0x9faf('0xc')]);router[_0x9faf('0xd')]('/',auth[_0x9faf('0x9')](),controller[_0x9faf('0xe')]);router['put'](_0x9faf('0xb'),auth[_0x9faf('0x9')](),controller['update']);router['delete'](_0x9faf('0xb'),auth[_0x9faf('0x9')](),controller[_0x9faf('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5aa2=['delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x5aa2,0xce));var _0x25aa=function(_0x6161b3,_0x5b61f1){_0x6161b3=_0x6161b3-0x0;var _0x403713=_0x5aa2[_0x6161b3];return _0x403713;};'use strict';var multer=require(_0x25aa('0x0'));var util=require('util');var path=require(_0x25aa('0x1'));var timeout=require(_0x25aa('0x2'));var express=require(_0x25aa('0x3'));var router=express[_0x25aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x25aa('0x5'));var interaction=require(_0x25aa('0x6'));var config=require(_0x25aa('0x7'));var controller=require(_0x25aa('0x8'));router['get']('/',auth[_0x25aa('0x9')](),controller[_0x25aa('0xa')]);router[_0x25aa('0xb')](_0x25aa('0xc'),auth['isAuthenticated'](),controller[_0x25aa('0xd')]);router['post']('/',auth[_0x25aa('0x9')](),controller[_0x25aa('0xe')]);router['put'](_0x25aa('0xc'),auth[_0x25aa('0x9')](),controller['update']);router[_0x25aa('0xf')](_0x25aa('0xc'),auth[_0x25aa('0x9')](),controller['destroy']);module[_0x25aa('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 9bb89d2..c6d686e 100644 --- a/server/api/intSalesforceField/intSalesforceField.attributes.js +++ b/server/api/intSalesforceField/intSalesforceField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91db=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','sequelize'];(function(_0x1bc387,_0x3dc7d9){var _0x17a8bc=function(_0x4b6da6){while(--_0x4b6da6){_0x1bc387['push'](_0x1bc387['shift']());}};_0x17a8bc(++_0x3dc7d9);}(_0x91db,0xce));var _0xb91d=function(_0x3b79fe,_0x1a92ac){_0x3b79fe=_0x3b79fe-0x0;var _0x56f433=_0x91db[_0x3b79fe];return _0x56f433;};'use strict';var Sequelize=require(_0xb91d('0x0'));module[_0xb91d('0x1')]={'type':{'type':Sequelize[_0xb91d('0x2')]('string',_0xb91d('0x3'),_0xb91d('0x4'),_0xb91d('0x5'),_0xb91d('0x6')),'defaultValue':_0xb91d('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb91d('0x8')]},'keyType':{'type':Sequelize[_0xb91d('0x2')](_0xb91d('0x7'),'variable',_0xb91d('0x4'))},'keyContent':{'type':Sequelize[_0xb91d('0x8')]},'idField':{'type':Sequelize[_0xb91d('0x8')]},'variableName':{'type':Sequelize[_0xb91d('0x8')]}}; \ No newline at end of file +var _0x8e16=['exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x8e16,0x1c7));var _0x68e1=function(_0x566bec,_0x464cad){_0x566bec=_0x566bec-0x0;var _0x4e4b99=_0x8e16[_0x566bec];return _0x4e4b99;};'use strict';var Sequelize=require('sequelize');module[_0x68e1('0x0')]={'type':{'type':Sequelize[_0x68e1('0x1')](_0x68e1('0x2'),'variable',_0x68e1('0x3'),_0x68e1('0x4'),'picklist'),'defaultValue':_0x68e1('0x2')},'content':{'type':Sequelize[_0x68e1('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x68e1('0x1')](_0x68e1('0x2'),_0x68e1('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x68e1('0x5')]},'idField':{'type':Sequelize[_0x68e1('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 7102338..31bf49b 100644 --- a/server/api/intSalesforceField/intSalesforceField.controller.js +++ b/server/api/intSalesforceField/intSalesforceField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f47=['fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','then','include','findAll','rows','show','params','keys','intersection','length','includeAll','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','model','query','filters','attributes'];(function(_0x5196f0,_0x57586f){var _0x5c462d=function(_0x330fad){while(--_0x330fad){_0x5196f0['push'](_0x5196f0['shift']());}};_0x5c462d(++_0x57586f);}(_0x7f47,0xfc));var _0x77f4=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x7f47[_0x491cbe];return _0x59449d;};'use strict';var emlformat=require(_0x77f4('0x0'));var rimraf=require(_0x77f4('0x1'));var zipdir=require(_0x77f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77f4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77f4('0x4'));var util=require(_0x77f4('0x5'));var path=require(_0x77f4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x77f4('0x7'));var fs=require('fs');var fs_extra=require(_0x77f4('0x8'));var _=require(_0x77f4('0x9'));var squel=require(_0x77f4('0xa'));var crypto=require(_0x77f4('0xb'));var jsforce=require(_0x77f4('0xc'));var deskjs=require(_0x77f4('0xd'));var toCsv=require(_0x77f4('0xe'));var querystring=require(_0x77f4('0xf'));var Papa=require('papaparse');var Redis=require(_0x77f4('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x77f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77f4('0x12'))(_0x77f4('0x13'));var utils=require(_0x77f4('0x14'));var config=require(_0x77f4('0x15'));var licenseUtil=require(_0x77f4('0x16'));var db=require(_0x77f4('0x17'))['db'];function respondWithStatusCode(_0x18467b,_0x29a084){_0x29a084=_0x29a084||0xcc;return function(_0x3b4a78){if(_0x3b4a78){return _0x18467b['sendStatus'](_0x29a084);}return _0x18467b['status'](_0x29a084)[_0x77f4('0x18')]();};}function respondWithResult(_0x3dec3c,_0x42c2b3){_0x42c2b3=_0x42c2b3||0xc8;return function(_0x197dd6){if(_0x197dd6){return _0x3dec3c[_0x77f4('0x19')](_0x42c2b3)[_0x77f4('0x1a')](_0x197dd6);}};}function respondWithFilteredResult(_0x2f1833,_0x56ff86){return function(_0x50d8ae){if(_0x50d8ae){var _0x1c0a29=typeof _0x56ff86[_0x77f4('0x1b')]===_0x77f4('0x1c')&&typeof _0x56ff86['limit']===_0x77f4('0x1c');var _0x2b0e71=_0x50d8ae[_0x77f4('0x1d')];var _0x9b261c=_0x1c0a29?0x0:_0x56ff86[_0x77f4('0x1b')];var _0x439c21=_0x1c0a29?_0x50d8ae[_0x77f4('0x1d')]:_0x56ff86['offset']+_0x56ff86[_0x77f4('0x1e')];var _0x2cd760;if(_0x439c21>=_0x2b0e71){_0x439c21=_0x2b0e71;_0x2cd760=0xc8;}else{_0x2cd760=0xce;}_0x2f1833['status'](_0x2cd760);return _0x2f1833[_0x77f4('0x1f')]('Content-Range',_0x9b261c+'-'+_0x439c21+'/'+_0x2b0e71)[_0x77f4('0x1a')](_0x50d8ae);}return null;};}function patchUpdates(_0x4e1d14){return function(_0x53ee24){try{jsonpatch[_0x77f4('0x20')](_0x53ee24,_0x4e1d14,!![]);}catch(_0x114cec){return BPromise[_0x77f4('0x21')](_0x114cec);}return _0x53ee24[_0x77f4('0x22')]();};}function saveUpdates(_0x276e45,_0x3caea4){return function(_0x47fee1){if(_0x47fee1){return _0x47fee1[_0x77f4('0x23')](_0x276e45)['then'](function(_0x371648){return _0x371648;});}return null;};}function removeEntity(_0x518187,_0x3e0049){return function(_0xa7f61a){if(_0xa7f61a){return _0xa7f61a[_0x77f4('0x24')]()['then'](function(){_0x518187[_0x77f4('0x19')](0xcc)[_0x77f4('0x18')]();});}};}function handleEntityNotFound(_0x16a821,_0x4301b0){return function(_0xe72a1c){if(!_0xe72a1c){_0x16a821[_0x77f4('0x25')](0x194);}return _0xe72a1c;};}function handleError(_0x1ba54d,_0x5a3e2e){_0x5a3e2e=_0x5a3e2e||0x1f4;return function(_0x3b518f){logger[_0x77f4('0x26')](_0x3b518f[_0x77f4('0x27')]);if(_0x3b518f[_0x77f4('0x28')]){delete _0x3b518f[_0x77f4('0x28')];}_0x1ba54d[_0x77f4('0x19')](_0x5a3e2e)[_0x77f4('0x29')](_0x3b518f);};}exports[_0x77f4('0x2a')]=function(_0x2ba428,_0x38a2c3){var _0x4721c6={},_0x113f10={},_0x39bca8={'count':0x0,'rows':[]};var _0x2008f9=_[_0x77f4('0x2b')](db[_0x77f4('0x2c')][_0x77f4('0x2d')],function(_0x3bb447){return{'name':_0x3bb447['fieldName'],'type':_0x3bb447[_0x77f4('0x2e')][_0x77f4('0x2f')]};});_0x113f10[_0x77f4('0x30')]=_[_0x77f4('0x2b')](_0x2008f9,_0x77f4('0x28'));_0x113f10[_0x77f4('0x31')]=_['keys'](_0x2ba428[_0x77f4('0x31')]);_0x113f10[_0x77f4('0x32')]=_['intersection'](_0x113f10['model'],_0x113f10['query']);_0x4721c6[_0x77f4('0x33')]=_['intersection'](_0x113f10[_0x77f4('0x30')],qs[_0x77f4('0x34')](_0x2ba428[_0x77f4('0x31')]['fields']));_0x4721c6['attributes']=_0x4721c6[_0x77f4('0x33')]['length']?_0x4721c6[_0x77f4('0x33')]:_0x113f10[_0x77f4('0x30')];if(!_0x2ba428[_0x77f4('0x31')][_0x77f4('0x35')]('nolimit')){_0x4721c6[_0x77f4('0x1e')]=qs[_0x77f4('0x1e')](_0x2ba428['query']['limit']);_0x4721c6[_0x77f4('0x1b')]=qs['offset'](_0x2ba428['query'][_0x77f4('0x1b')]);}_0x4721c6[_0x77f4('0x36')]=qs[_0x77f4('0x37')](_0x2ba428['query'][_0x77f4('0x37')]);_0x4721c6['where']=qs[_0x77f4('0x32')](_[_0x77f4('0x38')](_0x2ba428[_0x77f4('0x31')],_0x113f10[_0x77f4('0x32')]),_0x2008f9);if(_0x2ba428['query'][_0x77f4('0x39')]){_0x4721c6['where']=_['merge'](_0x4721c6[_0x77f4('0x3a')],{'$or':_[_0x77f4('0x2b')](_0x2008f9,function(_0x4dd287){if(_0x4dd287[_0x77f4('0x2e')]!==_0x77f4('0x3b')){var _0x28c246={};_0x28c246[_0x4dd287[_0x77f4('0x28')]]={'$like':'%'+_0x2ba428[_0x77f4('0x31')]['filter']+'%'};return _0x28c246;}})});}_0x4721c6=_[_0x77f4('0x3c')]({},_0x4721c6,_0x2ba428[_0x77f4('0x3d')]);var _0xa24ae0={'where':_0x4721c6['where']};return db[_0x77f4('0x2c')][_0x77f4('0x1d')](_0xa24ae0)[_0x77f4('0x3e')](function(_0x1bc8a3){_0x39bca8[_0x77f4('0x1d')]=_0x1bc8a3;if(_0x2ba428[_0x77f4('0x31')]['includeAll']){_0x4721c6[_0x77f4('0x3f')]=[{'all':!![]}];}return db[_0x77f4('0x2c')][_0x77f4('0x40')](_0x4721c6);})[_0x77f4('0x3e')](function(_0x3f2551){_0x39bca8[_0x77f4('0x41')]=_0x3f2551;return _0x39bca8;})[_0x77f4('0x3e')](respondWithFilteredResult(_0x38a2c3,_0x4721c6))['catch'](handleError(_0x38a2c3,null));};exports[_0x77f4('0x42')]=function(_0x16942a,_0x4932b6){var _0x2dcf62={'raw':!![],'where':{'id':_0x16942a[_0x77f4('0x43')]['id']}},_0x7aa091={};_0x7aa091[_0x77f4('0x30')]=_[_0x77f4('0x44')](db[_0x77f4('0x2c')]['rawAttributes']);_0x7aa091[_0x77f4('0x31')]=_['keys'](_0x16942a[_0x77f4('0x31')]);_0x7aa091[_0x77f4('0x32')]=_[_0x77f4('0x45')](_0x7aa091[_0x77f4('0x30')],_0x7aa091['query']);_0x2dcf62[_0x77f4('0x33')]=_[_0x77f4('0x45')](_0x7aa091[_0x77f4('0x30')],qs[_0x77f4('0x34')](_0x16942a[_0x77f4('0x31')][_0x77f4('0x34')]));_0x2dcf62['attributes']=_0x2dcf62[_0x77f4('0x33')][_0x77f4('0x46')]?_0x2dcf62[_0x77f4('0x33')]:_0x7aa091['model'];if(_0x16942a[_0x77f4('0x31')][_0x77f4('0x47')]){_0x2dcf62[_0x77f4('0x3f')]=[{'all':!![]}];}_0x2dcf62=_['merge']({},_0x2dcf62,_0x16942a[_0x77f4('0x3d')]);return db[_0x77f4('0x2c')]['find'](_0x2dcf62)[_0x77f4('0x3e')](handleEntityNotFound(_0x4932b6,null))[_0x77f4('0x3e')](respondWithResult(_0x4932b6,null))[_0x77f4('0x48')](handleError(_0x4932b6,null));};exports[_0x77f4('0x49')]=function(_0x48f1b5,_0x2babb8){return db[_0x77f4('0x2c')][_0x77f4('0x49')](_0x48f1b5[_0x77f4('0x4a')],{})[_0x77f4('0x3e')](respondWithResult(_0x2babb8,0xc9))[_0x77f4('0x48')](handleError(_0x2babb8,null));};exports[_0x77f4('0x23')]=function(_0x4362c0,_0x548825){if(_0x4362c0[_0x77f4('0x4a')]['id']){delete _0x4362c0[_0x77f4('0x4a')]['id'];}return db[_0x77f4('0x2c')][_0x77f4('0x4b')]({'where':{'id':_0x4362c0[_0x77f4('0x43')]['id']}})[_0x77f4('0x3e')](handleEntityNotFound(_0x548825,null))['then'](saveUpdates(_0x4362c0[_0x77f4('0x4a')],null))['then'](respondWithResult(_0x548825,null))['catch'](handleError(_0x548825,null));};exports[_0x77f4('0x24')]=function(_0x312800,_0x4fdb9d){return db[_0x77f4('0x2c')][_0x77f4('0x4b')]({'where':{'id':_0x312800[_0x77f4('0x43')]['id']}})[_0x77f4('0x3e')](handleEntityNotFound(_0x4fdb9d,null))[_0x77f4('0x3e')](removeEntity(_0x4fdb9d,null))[_0x77f4('0x48')](handleError(_0x4fdb9d,null));}; \ No newline at end of file +var _0x8bc1=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','find','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','model','query','keys'];(function(_0x4e3598,_0x24a224){var _0x40c42e=function(_0x3a82c2){while(--_0x3a82c2){_0x4e3598['push'](_0x4e3598['shift']());}};_0x40c42e(++_0x24a224);}(_0x8bc1,0x1c1));var _0x18bc=function(_0x254bb6,_0x28d0a8){_0x254bb6=_0x254bb6-0x0;var _0x32be0b=_0x8bc1[_0x254bb6];return _0x32be0b;};'use strict';var emlformat=require(_0x18bc('0x0'));var rimraf=require(_0x18bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x18bc('0x2'));var rp=require(_0x18bc('0x3'));var moment=require(_0x18bc('0x4'));var BPromise=require(_0x18bc('0x5'));var Mustache=require(_0x18bc('0x6'));var util=require(_0x18bc('0x7'));var path=require(_0x18bc('0x8'));var sox=require(_0x18bc('0x9'));var csv=require(_0x18bc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18bc('0xb'));var _=require(_0x18bc('0xc'));var squel=require(_0x18bc('0xd'));var crypto=require(_0x18bc('0xe'));var jsforce=require(_0x18bc('0xf'));var deskjs=require(_0x18bc('0x10'));var toCsv=require(_0x18bc('0xa'));var querystring=require(_0x18bc('0x11'));var Papa=require('papaparse');var Redis=require(_0x18bc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x18bc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18bc('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x18bc('0x15'))['db'];function respondWithStatusCode(_0x2630f0,_0x107620){_0x107620=_0x107620||0xcc;return function(_0x593419){if(_0x593419){return _0x2630f0[_0x18bc('0x16')](_0x107620);}return _0x2630f0[_0x18bc('0x17')](_0x107620)['end']();};}function respondWithResult(_0x54f65f,_0x5f1935){_0x5f1935=_0x5f1935||0xc8;return function(_0x923817){if(_0x923817){return _0x54f65f[_0x18bc('0x17')](_0x5f1935)['json'](_0x923817);}};}function respondWithFilteredResult(_0x400395,_0x43e0b8){return function(_0x2354b6){if(_0x2354b6){var _0x525f23=typeof _0x43e0b8[_0x18bc('0x18')]===_0x18bc('0x19')&&typeof _0x43e0b8[_0x18bc('0x1a')]===_0x18bc('0x19');var _0x4b7ccc=_0x2354b6['count'];var _0x4929c3=_0x525f23?0x0:_0x43e0b8[_0x18bc('0x18')];var _0x20f411=_0x525f23?_0x2354b6[_0x18bc('0x1b')]:_0x43e0b8[_0x18bc('0x18')]+_0x43e0b8[_0x18bc('0x1a')];var _0x4e20ac;if(_0x20f411>=_0x4b7ccc){_0x20f411=_0x4b7ccc;_0x4e20ac=0xc8;}else{_0x4e20ac=0xce;}_0x400395[_0x18bc('0x17')](_0x4e20ac);return _0x400395[_0x18bc('0x1c')](_0x18bc('0x1d'),_0x4929c3+'-'+_0x20f411+'/'+_0x4b7ccc)['json'](_0x2354b6);}return null;};}function patchUpdates(_0x1f82dd){return function(_0x1b2e8f){try{jsonpatch['apply'](_0x1b2e8f,_0x1f82dd,!![]);}catch(_0x11cab1){return BPromise[_0x18bc('0x1e')](_0x11cab1);}return _0x1b2e8f[_0x18bc('0x1f')]();};}function saveUpdates(_0x4087a3,_0x578fde){return function(_0x3ba06b){if(_0x3ba06b){return _0x3ba06b[_0x18bc('0x20')](_0x4087a3)[_0x18bc('0x21')](function(_0x246177){return _0x246177;});}return null;};}function removeEntity(_0x2941f5,_0x13c85a){return function(_0xaa328c){if(_0xaa328c){return _0xaa328c[_0x18bc('0x22')]()[_0x18bc('0x21')](function(){_0x2941f5['status'](0xcc)[_0x18bc('0x23')]();});}};}function handleEntityNotFound(_0x1d0532,_0x4c6a9d){return function(_0x3f8239){if(!_0x3f8239){_0x1d0532[_0x18bc('0x16')](0x194);}return _0x3f8239;};}function handleError(_0x3451fd,_0x58e692){_0x58e692=_0x58e692||0x1f4;return function(_0x62bb29){logger[_0x18bc('0x24')](_0x62bb29[_0x18bc('0x25')]);if(_0x62bb29[_0x18bc('0x26')]){delete _0x62bb29[_0x18bc('0x26')];}_0x3451fd[_0x18bc('0x17')](_0x58e692)[_0x18bc('0x27')](_0x62bb29);};}exports[_0x18bc('0x28')]=function(_0x326a42,_0x3dcac3){var _0x5e65a9={},_0x2e475f={},_0x1e0144={'count':0x0,'rows':[]};var _0x3cef9f=_[_0x18bc('0x29')](db[_0x18bc('0x2a')][_0x18bc('0x2b')],function(_0x5aaac3){return{'name':_0x5aaac3['fieldName'],'type':_0x5aaac3[_0x18bc('0x2c')]['key']};});_0x2e475f[_0x18bc('0x2d')]=_[_0x18bc('0x29')](_0x3cef9f,_0x18bc('0x26'));_0x2e475f[_0x18bc('0x2e')]=_[_0x18bc('0x2f')](_0x326a42[_0x18bc('0x2e')]);_0x2e475f[_0x18bc('0x30')]=_[_0x18bc('0x31')](_0x2e475f['model'],_0x2e475f[_0x18bc('0x2e')]);_0x5e65a9[_0x18bc('0x32')]=_[_0x18bc('0x31')](_0x2e475f[_0x18bc('0x2d')],qs['fields'](_0x326a42['query'][_0x18bc('0x33')]));_0x5e65a9['attributes']=_0x5e65a9['attributes'][_0x18bc('0x34')]?_0x5e65a9[_0x18bc('0x32')]:_0x2e475f['model'];if(!_0x326a42[_0x18bc('0x2e')][_0x18bc('0x35')](_0x18bc('0x36'))){_0x5e65a9[_0x18bc('0x1a')]=qs[_0x18bc('0x1a')](_0x326a42[_0x18bc('0x2e')][_0x18bc('0x1a')]);_0x5e65a9[_0x18bc('0x18')]=qs[_0x18bc('0x18')](_0x326a42['query'][_0x18bc('0x18')]);}_0x5e65a9[_0x18bc('0x37')]=qs[_0x18bc('0x38')](_0x326a42['query'][_0x18bc('0x38')]);_0x5e65a9[_0x18bc('0x39')]=qs[_0x18bc('0x30')](_[_0x18bc('0x3a')](_0x326a42[_0x18bc('0x2e')],_0x2e475f[_0x18bc('0x30')]),_0x3cef9f);if(_0x326a42[_0x18bc('0x2e')][_0x18bc('0x3b')]){_0x5e65a9['where']=_[_0x18bc('0x3c')](_0x5e65a9[_0x18bc('0x39')],{'$or':_['map'](_0x3cef9f,function(_0x3cc94f){if(_0x3cc94f[_0x18bc('0x2c')]!==_0x18bc('0x3d')){var _0x32535a={};_0x32535a[_0x3cc94f[_0x18bc('0x26')]]={'$like':'%'+_0x326a42[_0x18bc('0x2e')][_0x18bc('0x3b')]+'%'};return _0x32535a;}})});}_0x5e65a9=_['merge']({},_0x5e65a9,_0x326a42[_0x18bc('0x3e')]);var _0x453336={'where':_0x5e65a9[_0x18bc('0x39')]};return db[_0x18bc('0x2a')]['count'](_0x453336)[_0x18bc('0x21')](function(_0x533ec6){_0x1e0144[_0x18bc('0x1b')]=_0x533ec6;if(_0x326a42[_0x18bc('0x2e')][_0x18bc('0x3f')]){_0x5e65a9['include']=[{'all':!![]}];}return db[_0x18bc('0x2a')][_0x18bc('0x40')](_0x5e65a9);})[_0x18bc('0x21')](function(_0x13247d){_0x1e0144['rows']=_0x13247d;return _0x1e0144;})[_0x18bc('0x21')](respondWithFilteredResult(_0x3dcac3,_0x5e65a9))[_0x18bc('0x41')](handleError(_0x3dcac3,null));};exports[_0x18bc('0x42')]=function(_0x138682,_0x5304cd){var _0x19a018={'raw':!![],'where':{'id':_0x138682['params']['id']}},_0x4d8cdd={};_0x4d8cdd['model']=_['keys'](db[_0x18bc('0x2a')]['rawAttributes']);_0x4d8cdd[_0x18bc('0x2e')]=_[_0x18bc('0x2f')](_0x138682[_0x18bc('0x2e')]);_0x4d8cdd[_0x18bc('0x30')]=_[_0x18bc('0x31')](_0x4d8cdd[_0x18bc('0x2d')],_0x4d8cdd[_0x18bc('0x2e')]);_0x19a018['attributes']=_[_0x18bc('0x31')](_0x4d8cdd['model'],qs[_0x18bc('0x33')](_0x138682[_0x18bc('0x2e')][_0x18bc('0x33')]));_0x19a018['attributes']=_0x19a018[_0x18bc('0x32')][_0x18bc('0x34')]?_0x19a018[_0x18bc('0x32')]:_0x4d8cdd[_0x18bc('0x2d')];if(_0x138682['query'][_0x18bc('0x3f')]){_0x19a018[_0x18bc('0x43')]=[{'all':!![]}];}_0x19a018=_[_0x18bc('0x3c')]({},_0x19a018,_0x138682[_0x18bc('0x3e')]);return db[_0x18bc('0x2a')][_0x18bc('0x44')](_0x19a018)[_0x18bc('0x21')](handleEntityNotFound(_0x5304cd,null))[_0x18bc('0x21')](respondWithResult(_0x5304cd,null))[_0x18bc('0x41')](handleError(_0x5304cd,null));};exports['create']=function(_0x5a9a3d,_0x3dd9e5){return db['SalesforceField']['create'](_0x5a9a3d['body'],{})[_0x18bc('0x21')](respondWithResult(_0x3dd9e5,0xc9))[_0x18bc('0x41')](handleError(_0x3dd9e5,null));};exports[_0x18bc('0x20')]=function(_0x5f3a81,_0xcf6f17){if(_0x5f3a81[_0x18bc('0x45')]['id']){delete _0x5f3a81['body']['id'];}return db[_0x18bc('0x2a')]['find']({'where':{'id':_0x5f3a81[_0x18bc('0x46')]['id']}})[_0x18bc('0x21')](handleEntityNotFound(_0xcf6f17,null))[_0x18bc('0x21')](saveUpdates(_0x5f3a81[_0x18bc('0x45')],null))[_0x18bc('0x21')](respondWithResult(_0xcf6f17,null))['catch'](handleError(_0xcf6f17,null));};exports[_0x18bc('0x22')]=function(_0x4cef28,_0x313372){return db['SalesforceField']['find']({'where':{'id':_0x4cef28['params']['id']}})[_0x18bc('0x21')](handleEntityNotFound(_0x313372,null))[_0x18bc('0x21')](removeEntity(_0x313372,null))[_0x18bc('0x41')](handleError(_0x313372,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 248a825..a65d579 100644 --- a/server/api/intSalesforceField/intSalesforceField.model.js +++ b/server/api/intSalesforceField/intSalesforceField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c85=['moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger'];(function(_0x16390c,_0x462ee9){var _0x1f01d7=function(_0x238737){while(--_0x238737){_0x16390c['push'](_0x16390c['shift']());}};_0x1f01d7(++_0x462ee9);}(_0x4c85,0x129));var _0x54c8=function(_0x5232d2,_0xd3946b){_0x5232d2=_0x5232d2-0x0;var _0x50ac4a=_0x4c85[_0x5232d2];return _0x50ac4a;};'use strict';var _=require(_0x54c8('0x0'));var util=require('util');var logger=require(_0x54c8('0x1'))('api');var moment=require(_0x54c8('0x2'));var BPromise=require(_0x54c8('0x3'));var rp=require(_0x54c8('0x4'));var fs=require('fs');var path=require(_0x54c8('0x5'));var rimraf=require('rimraf');var config=require(_0x54c8('0x6'));var attributes=require(_0x54c8('0x7'));module['exports']=function(_0x216eb6,_0x3cc8cc){return _0x216eb6[_0x54c8('0x8')](_0x54c8('0x9'),attributes,{'tableName':_0x54c8('0xa'),'paranoid':![],'indexes':[{'name':_0x54c8('0xb'),'fields':['idField',_0x54c8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9bb=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','moment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xd9bb,0x128));var _0xbd9b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd9bb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbd9b('0x0'));var util=require(_0xbd9b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbd9b('0x2'));var BPromise=require('bluebird');var rp=require(_0xbd9b('0x3'));var fs=require('fs');var path=require(_0xbd9b('0x4'));var rimraf=require(_0xbd9b('0x5'));var config=require(_0xbd9b('0x6'));var attributes=require(_0xbd9b('0x7'));module[_0xbd9b('0x8')]=function(_0x86006d,_0x1c38da){return _0x86006d['define']('SalesforceField',attributes,{'tableName':_0xbd9b('0x9'),'paranoid':![],'indexes':[{'name':_0xbd9b('0xa'),'fields':[_0xbd9b('0xb'),_0xbd9b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 47e1114..a0ce224 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12de=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment'];(function(_0x5b1d80,_0x4230ba){var _0x4f344c=function(_0x50d40b){while(--_0x50d40b){_0x5b1d80['push'](_0x5b1d80['shift']());}};_0x4f344c(++_0x4230ba);}(_0x12de,0x66));var _0xe12d=function(_0x50f453,_0x39fabf){_0x50f453=_0x50f453-0x0;var _0xbce5bd=_0x12de[_0x50f453];return _0xbce5bd;};'use strict';var _=require(_0xe12d('0x0'));var util=require(_0xe12d('0x1'));var moment=require(_0xe12d('0x2'));var BPromise=require(_0xe12d('0x3'));var rs=require(_0xe12d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe12d('0x5'))['db'];var utils=require(_0xe12d('0x6'));var logger=require('../../config/logger')(_0xe12d('0x7'));var config=require(_0xe12d('0x8'));var jayson=require(_0xe12d('0x9'));var client=jayson[_0xe12d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46e604,_0x2c9216,_0x48fc16){return new BPromise(function(_0x559cb1,_0x2e9efc){return client[_0xe12d('0xb')](_0x46e604,_0x48fc16)[_0xe12d('0xc')](function(_0x4f7776){logger[_0xe12d('0xd')](_0xe12d('0xe'),_0x2c9216,_0xe12d('0xf'));logger[_0xe12d('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2c9216,'request\x20sent',JSON[_0xe12d('0x11')](_0x4f7776));if(_0x4f7776['error']){if(_0x4f7776[_0xe12d('0x12')]['code']===0x1f4){logger[_0xe12d('0x12')](_0xe12d('0xe'),_0x2c9216,_0x4f7776[_0xe12d('0x12')][_0xe12d('0x13')]);return _0x2e9efc(_0x4f7776[_0xe12d('0x12')][_0xe12d('0x13')]);}logger[_0xe12d('0x12')](_0xe12d('0xe'),_0x2c9216,_0x4f7776['error'][_0xe12d('0x13')]);return _0x559cb1(_0x4f7776[_0xe12d('0x12')]['message']);}else{logger[_0xe12d('0xd')](_0xe12d('0xe'),_0x2c9216,_0xe12d('0xf'));_0x559cb1(_0x4f7776['result']['message']);}})[_0xe12d('0x14')](function(_0x4e6a0f){logger[_0xe12d('0x12')](_0xe12d('0xe'),_0x2c9216,_0x4e6a0f);_0x2e9efc(_0x4e6a0f);});});} \ No newline at end of file +var _0x6e3b=['util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0xb3c018,_0x4f4082){var _0x3a0995=function(_0x3ee087){while(--_0x3ee087){_0xb3c018['push'](_0xb3c018['shift']());}};_0x3a0995(++_0x4f4082);}(_0x6e3b,0xc7));var _0xb6e3=function(_0x280ffe,_0x460fc9){_0x280ffe=_0x280ffe-0x0;var _0xad5f45=_0x6e3b[_0x280ffe];return _0xad5f45;};'use strict';var _=require(_0xb6e3('0x0'));var util=require(_0xb6e3('0x1'));var moment=require('moment');var BPromise=require(_0xb6e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb6e3('0x3'));var logger=require(_0xb6e3('0x4'))(_0xb6e3('0x5'));var config=require(_0xb6e3('0x6'));var jayson=require(_0xb6e3('0x7'));var client=jayson[_0xb6e3('0x8')][_0xb6e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2220ea,_0x53b5c3,_0x47c196){return new BPromise(function(_0xcc2088,_0x11a704){return client[_0xb6e3('0xa')](_0x2220ea,_0x47c196)['then'](function(_0x187316){logger[_0xb6e3('0xb')](_0xb6e3('0xc'),_0x53b5c3,_0xb6e3('0xd'));logger['debug'](_0xb6e3('0xe'),_0x53b5c3,_0xb6e3('0xd'),JSON['stringify'](_0x187316));if(_0x187316['error']){if(_0x187316[_0xb6e3('0xf')][_0xb6e3('0x10')]===0x1f4){logger[_0xb6e3('0xf')]('SalesforceField,\x20%s,\x20%s',_0x53b5c3,_0x187316[_0xb6e3('0xf')][_0xb6e3('0x11')]);return _0x11a704(_0x187316[_0xb6e3('0xf')]['message']);}logger[_0xb6e3('0xf')](_0xb6e3('0xc'),_0x53b5c3,_0x187316[_0xb6e3('0xf')][_0xb6e3('0x11')]);return _0xcc2088(_0x187316[_0xb6e3('0xf')][_0xb6e3('0x11')]);}else{logger[_0xb6e3('0xb')](_0xb6e3('0xc'),_0x53b5c3,'request\x20sent');_0xcc2088(_0x187316[_0xb6e3('0x12')]['message']);}})[_0xb6e3('0x13')](function(_0x223db8){logger['error'](_0xb6e3('0xc'),_0x53b5c3,_0x223db8);_0x11a704(_0x223db8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index eb9c593..5d6b011 100644 --- a/server/api/intServicenowAccount/index.js +++ b/server/api/intServicenowAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f5b=['show','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x225b2f,_0x456497){var _0x590320=function(_0x2f056d){while(--_0x2f056d){_0x225b2f['push'](_0x225b2f['shift']());}};_0x590320(++_0x456497);}(_0x0f5b,0xd1));var _0xb0f5=function(_0x32898a,_0x569193){_0x32898a=_0x32898a-0x0;var _0x575b2b=_0x0f5b[_0x32898a];return _0x575b2b;};'use strict';var multer=require('multer');var util=require(_0xb0f5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0f5('0x1'));var router=express[_0xb0f5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb0f5('0x3'));var interaction=require(_0xb0f5('0x4'));var config=require(_0xb0f5('0x5'));var controller=require(_0xb0f5('0x6'));router[_0xb0f5('0x7')]('/',auth[_0xb0f5('0x8')](),controller[_0xb0f5('0x9')]);router[_0xb0f5('0x7')](_0xb0f5('0xa'),auth[_0xb0f5('0x8')](),controller[_0xb0f5('0xb')]);router[_0xb0f5('0x7')]('/:id/configurations',auth[_0xb0f5('0x8')](),controller[_0xb0f5('0xc')]);router['get'](_0xb0f5('0xd'),auth['isAuthenticated'](),controller[_0xb0f5('0xe')]);router[_0xb0f5('0xf')]('/',auth[_0xb0f5('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xb0f5('0x10')]);router[_0xb0f5('0x11')](_0xb0f5('0xa'),auth[_0xb0f5('0x8')](),controller[_0xb0f5('0x12')]);router[_0xb0f5('0x13')](_0xb0f5('0xa'),auth[_0xb0f5('0x8')](),controller[_0xb0f5('0x14')]);module[_0xb0f5('0x15')]=router; \ No newline at end of file +var _0x699a=['addConfiguration','put','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','create','/:id/configurations'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x699a,0x12a));var _0xa699=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x699a[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0xa699('0x0'));var util=require(_0xa699('0x1'));var path=require(_0xa699('0x2'));var timeout=require(_0xa699('0x3'));var express=require('express');var router=express[_0xa699('0x4')]();var fs_extra=require(_0xa699('0x5'));var auth=require(_0xa699('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa699('0x7'));router[_0xa699('0x8')]('/',auth['isAuthenticated'](),controller[_0xa699('0x9')]);router[_0xa699('0x8')](_0xa699('0xa'),auth[_0xa699('0xb')](),controller['show']);router[_0xa699('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xa699('0xc')]);router[_0xa699('0x8')](_0xa699('0xd'),auth['isAuthenticated'](),controller[_0xa699('0xe')]);router['post']('/',auth[_0xa699('0xb')](),controller[_0xa699('0xf')]);router['post'](_0xa699('0x10'),auth[_0xa699('0xb')](),controller[_0xa699('0x11')]);router[_0xa699('0x12')]('/:id',auth[_0xa699('0xb')](),controller[_0xa699('0x13')]);router['delete'](_0xa699('0xa'),auth['isAuthenticated'](),controller[_0xa699('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index f1bc666..22457ed 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.attributes.js +++ b/server/api/intServicenowAccount/intServicenowAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8e0=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2e8c4c,_0x3738a7){var _0x567d65=function(_0x434a43){while(--_0x434a43){_0x2e8c4c['push'](_0x2e8c4c['shift']());}};_0x567d65(++_0x3738a7);}(_0xd8e0,0xdc));var _0x0d8e=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd8e0[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x0d8e('0x0'));module[_0x0d8e('0x1')]={'name':{'type':Sequelize[_0x0d8e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0d8e('0x3')},'password':{'type':Sequelize[_0x0d8e('0x2')]},'email':{'type':Sequelize[_0x0d8e('0x2')]},'remoteUri':{'type':Sequelize[_0x0d8e('0x2')],'unique':_0x0d8e('0x4')},'serverUrl':{'type':Sequelize[_0x0d8e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf85d=['remoteUri','sequelize','exports','STRING','username'];(function(_0x136199,_0x3beb39){var _0x44ec86=function(_0x58bf80){while(--_0x58bf80){_0x136199['push'](_0x136199['shift']());}};_0x44ec86(++_0x3beb39);}(_0xf85d,0x146));var _0xdf85=function(_0x4f98f2,_0x35d270){_0x4f98f2=_0x4f98f2-0x0;var _0x595a12=_0xf85d[_0x4f98f2];return _0x595a12;};'use strict';var Sequelize=require(_0xdf85('0x0'));module[_0xdf85('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdf85('0x2')]},'username':{'type':Sequelize[_0xdf85('0x2')],'unique':_0xdf85('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdf85('0x2')]},'remoteUri':{'type':Sequelize[_0xdf85('0x2')],'unique':_0xdf85('0x4')},'serverUrl':{'type':Sequelize[_0xdf85('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 84f2955..d88a003 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.controller.js +++ b/server/api/intServicenowAccount/intServicenowAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b24=['show','params','fields','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_domain','state','sys_created_by','delivery_plan','impact','work_notes_list','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','incident_state','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','correlation_id','location','username','password','email','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','True','False','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','false','value','push','eml-format','zip-dir','moment','mustache','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','index','map','ServicenowAccount','rawAttributes','type','name','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch'];(function(_0x56a2ee,_0x445a03){var _0x267c95=function(_0x37cae9){while(--_0x37cae9){_0x56a2ee['push'](_0x56a2ee['shift']());}};_0x267c95(++_0x445a03);}(_0x2b24,0x1dc));var _0x42b2=function(_0x3f21bf,_0x132682){_0x3f21bf=_0x3f21bf-0x0;var _0x9761a1=_0x2b24[_0x3f21bf];return _0x9761a1;};'use strict';var emlformat=require(_0x42b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x42b2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x42b2('0x3'));var util=require('util');var path=require(_0x42b2('0x4'));var sox=require(_0x42b2('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42b2('0x6'));var squel=require(_0x42b2('0x7'));var crypto=require(_0x42b2('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x42b2('0x9'));var querystring=require(_0x42b2('0xa'));var Papa=require(_0x42b2('0xb'));var Redis=require(_0x42b2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x42b2('0xd'));var as=require(_0x42b2('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x42b2('0xf'));var utils=require(_0x42b2('0x10'));var config=require(_0x42b2('0x11'));var licenseUtil=require(_0x42b2('0x12'));var db=require(_0x42b2('0x13'))['db'];var integrations=require(_0x42b2('0x14'));function respondWithStatusCode(_0x2a38aa,_0x419768){_0x419768=_0x419768||0xcc;return function(_0xcfd546){if(_0xcfd546){return _0x2a38aa[_0x42b2('0x15')](_0x419768);}return _0x2a38aa['status'](_0x419768)[_0x42b2('0x16')]();};}function respondWithResult(_0x34d762,_0x27ca63){_0x27ca63=_0x27ca63||0xc8;return function(_0x215fb2){if(_0x215fb2){return _0x34d762[_0x42b2('0x17')](_0x27ca63)[_0x42b2('0x18')](_0x215fb2);}};}function respondWithFilteredResult(_0x22961c,_0x244bf5){return function(_0x2179f1){if(_0x2179f1){var _0x381dab=typeof _0x244bf5[_0x42b2('0x19')]===_0x42b2('0x1a')&&typeof _0x244bf5['limit']===_0x42b2('0x1a');var _0x1fb8f8=_0x2179f1['count'];var _0x3867ce=_0x381dab?0x0:_0x244bf5[_0x42b2('0x19')];var _0x556e86=_0x381dab?_0x2179f1[_0x42b2('0x1b')]:_0x244bf5['offset']+_0x244bf5[_0x42b2('0x1c')];var _0x40b371;if(_0x556e86>=_0x1fb8f8){_0x556e86=_0x1fb8f8;_0x40b371=0xc8;}else{_0x40b371=0xce;}_0x22961c[_0x42b2('0x17')](_0x40b371);return _0x22961c[_0x42b2('0x1d')](_0x42b2('0x1e'),_0x3867ce+'-'+_0x556e86+'/'+_0x1fb8f8)['json'](_0x2179f1);}return null;};}function patchUpdates(_0x3f3e51){return function(_0x1d16d8){try{jsonpatch[_0x42b2('0x1f')](_0x1d16d8,_0x3f3e51,!![]);}catch(_0x357c74){return BPromise[_0x42b2('0x20')](_0x357c74);}return _0x1d16d8[_0x42b2('0x21')]();};}function saveUpdates(_0x41dafd,_0x31ebe3){return function(_0x35c62e){if(_0x35c62e){return _0x35c62e['update'](_0x41dafd)[_0x42b2('0x22')](function(_0x28c3e1){return _0x28c3e1;});}return null;};}function removeEntity(_0x16eac3,_0x2df11e){return function(_0x1c4365){if(_0x1c4365){return _0x1c4365[_0x42b2('0x23')]()[_0x42b2('0x22')](function(){_0x16eac3['status'](0xcc)[_0x42b2('0x16')]();});}};}function handleEntityNotFound(_0x1491dc,_0x26cff6){return function(_0x37f37b){if(!_0x37f37b){_0x1491dc['sendStatus'](0x194);}return _0x37f37b;};}function handleError(_0xe6db15,_0x371f15){_0x371f15=_0x371f15||0x1f4;return function(_0x2fae29){logger[_0x42b2('0x24')](_0x2fae29[_0x42b2('0x25')]);if(_0x2fae29['name']){delete _0x2fae29['name'];}_0xe6db15[_0x42b2('0x17')](_0x371f15)[_0x42b2('0x26')](_0x2fae29);};}exports[_0x42b2('0x27')]=function(_0x55216d,_0x2c61fe){var _0x2a794e={},_0x4ae6f7={},_0x3c1e65={'count':0x0,'rows':[]};var _0x5a3eae=_[_0x42b2('0x28')](db[_0x42b2('0x29')][_0x42b2('0x2a')],function(_0x461a15){return{'name':_0x461a15['fieldName'],'type':_0x461a15[_0x42b2('0x2b')]['key']};});_0x4ae6f7['model']=_['map'](_0x5a3eae,_0x42b2('0x2c'));_0x4ae6f7['query']=_[_0x42b2('0x2d')](_0x55216d[_0x42b2('0x2e')]);_0x4ae6f7[_0x42b2('0x2f')]=_[_0x42b2('0x30')](_0x4ae6f7[_0x42b2('0x31')],_0x4ae6f7[_0x42b2('0x2e')]);_0x2a794e[_0x42b2('0x32')]=_[_0x42b2('0x30')](_0x4ae6f7['model'],qs['fields'](_0x55216d[_0x42b2('0x2e')]['fields']));_0x2a794e[_0x42b2('0x32')]=_0x2a794e[_0x42b2('0x32')][_0x42b2('0x33')]?_0x2a794e[_0x42b2('0x32')]:_0x4ae6f7[_0x42b2('0x31')];if(!_0x55216d[_0x42b2('0x2e')][_0x42b2('0x34')]('nolimit')){_0x2a794e['limit']=qs[_0x42b2('0x1c')](_0x55216d[_0x42b2('0x2e')][_0x42b2('0x1c')]);_0x2a794e[_0x42b2('0x19')]=qs['offset'](_0x55216d[_0x42b2('0x2e')][_0x42b2('0x19')]);}_0x2a794e[_0x42b2('0x35')]=qs['sort'](_0x55216d[_0x42b2('0x2e')][_0x42b2('0x36')]);_0x2a794e[_0x42b2('0x37')]=qs['filters'](_[_0x42b2('0x38')](_0x55216d[_0x42b2('0x2e')],_0x4ae6f7[_0x42b2('0x2f')]),_0x5a3eae);if(_0x55216d['query'][_0x42b2('0x39')]){_0x2a794e['where']=_[_0x42b2('0x3a')](_0x2a794e[_0x42b2('0x37')],{'$or':_[_0x42b2('0x28')](_0x5a3eae,function(_0x52ce0b){if(_0x52ce0b[_0x42b2('0x2b')]!==_0x42b2('0x3b')){var _0x19cf61={};_0x19cf61[_0x52ce0b[_0x42b2('0x2c')]]={'$like':'%'+_0x55216d['query'][_0x42b2('0x39')]+'%'};return _0x19cf61;}})});}_0x2a794e=_['merge']({},_0x2a794e,_0x55216d[_0x42b2('0x3c')]);var _0x3bbe60={'where':_0x2a794e[_0x42b2('0x37')]};return db[_0x42b2('0x29')][_0x42b2('0x1b')](_0x3bbe60)[_0x42b2('0x22')](function(_0x605edb){_0x3c1e65[_0x42b2('0x1b')]=_0x605edb;if(_0x55216d[_0x42b2('0x2e')][_0x42b2('0x3d')]){_0x2a794e[_0x42b2('0x3e')]=[{'all':!![]}];}return db[_0x42b2('0x29')]['findAll'](_0x2a794e);})[_0x42b2('0x22')](function(_0x440c9a){_0x3c1e65['rows']=_0x440c9a;return _0x3c1e65;})[_0x42b2('0x22')](respondWithFilteredResult(_0x2c61fe,_0x2a794e))[_0x42b2('0x3f')](handleError(_0x2c61fe,null));};exports[_0x42b2('0x40')]=function(_0x49ae5b,_0x1ce1db){var _0x45a467={'raw':![],'where':{'id':_0x49ae5b[_0x42b2('0x41')]['id']}},_0x13cc73={};_0x13cc73[_0x42b2('0x31')]=_[_0x42b2('0x2d')](db[_0x42b2('0x29')][_0x42b2('0x2a')]);_0x13cc73[_0x42b2('0x2e')]=_['keys'](_0x49ae5b[_0x42b2('0x2e')]);_0x13cc73[_0x42b2('0x2f')]=_[_0x42b2('0x30')](_0x13cc73[_0x42b2('0x31')],_0x13cc73[_0x42b2('0x2e')]);_0x45a467[_0x42b2('0x32')]=_[_0x42b2('0x30')](_0x13cc73[_0x42b2('0x31')],qs[_0x42b2('0x42')](_0x49ae5b[_0x42b2('0x2e')]['fields']));_0x45a467[_0x42b2('0x32')]=_0x45a467[_0x42b2('0x32')]['length']?_0x45a467[_0x42b2('0x32')]:_0x13cc73[_0x42b2('0x31')];if(_0x49ae5b['query'][_0x42b2('0x3d')]){_0x45a467[_0x42b2('0x3e')]=[{'all':!![]}];}_0x45a467=_[_0x42b2('0x3a')]({},_0x45a467,_0x49ae5b[_0x42b2('0x3c')]);return db[_0x42b2('0x29')][_0x42b2('0x43')](_0x45a467)[_0x42b2('0x22')](handleEntityNotFound(_0x1ce1db,null))[_0x42b2('0x22')](respondWithResult(_0x1ce1db,null))['catch'](handleError(_0x1ce1db,null));};exports[_0x42b2('0x44')]=function(_0x1306a2,_0x4a440a){return db[_0x42b2('0x29')][_0x42b2('0x44')](_0x1306a2[_0x42b2('0x45')],{})[_0x42b2('0x22')](respondWithResult(_0x4a440a,0xc9))[_0x42b2('0x3f')](handleError(_0x4a440a,null));};exports[_0x42b2('0x46')]=function(_0x317681,_0x541f7b){if(_0x317681[_0x42b2('0x45')]['id']){delete _0x317681[_0x42b2('0x45')]['id'];}return db[_0x42b2('0x29')]['find']({'where':{'id':_0x317681[_0x42b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x541f7b,null))['then'](saveUpdates(_0x317681[_0x42b2('0x45')],null))[_0x42b2('0x22')](respondWithResult(_0x541f7b,null))['catch'](handleError(_0x541f7b,null));};exports[_0x42b2('0x23')]=function(_0x4c2303,_0x122712){return db[_0x42b2('0x29')][_0x42b2('0x43')]({'where':{'id':_0x4c2303[_0x42b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x122712,null))[_0x42b2('0x22')](removeEntity(_0x122712,null))[_0x42b2('0x3f')](handleError(_0x122712,null));};exports[_0x42b2('0x47')]=function(_0x14bce2,_0x51d6d0,_0x42976d){var _0x1577e7={};var _0x4d9e87={};var _0x40082d;var _0x2f8651;return db[_0x42b2('0x29')][_0x42b2('0x48')]({'where':{'id':_0x14bce2[_0x42b2('0x41')]['id']}})[_0x42b2('0x22')](handleEntityNotFound(_0x51d6d0,null))['then'](function(_0x378ecf){if(_0x378ecf){_0x40082d=_0x378ecf;_0x4d9e87[_0x42b2('0x31')]=_['keys'](db[_0x42b2('0x49')][_0x42b2('0x2a')]);_0x4d9e87[_0x42b2('0x2e')]=_[_0x42b2('0x2d')](_0x14bce2[_0x42b2('0x2e')]);_0x4d9e87[_0x42b2('0x2f')]=_['intersection'](_0x4d9e87[_0x42b2('0x31')],_0x4d9e87['query']);_0x1577e7[_0x42b2('0x32')]=_[_0x42b2('0x30')](_0x4d9e87['model'],qs[_0x42b2('0x42')](_0x14bce2[_0x42b2('0x2e')][_0x42b2('0x42')]));_0x1577e7[_0x42b2('0x32')]=_0x1577e7[_0x42b2('0x32')][_0x42b2('0x33')]?_0x1577e7[_0x42b2('0x32')]:_0x4d9e87[_0x42b2('0x31')];_0x1577e7['order']=qs[_0x42b2('0x36')](_0x14bce2['query'][_0x42b2('0x36')]);_0x1577e7[_0x42b2('0x37')]=qs[_0x42b2('0x2f')](_['pick'](_0x14bce2[_0x42b2('0x2e')],_0x4d9e87[_0x42b2('0x2f')]));if(_0x14bce2[_0x42b2('0x2e')][_0x42b2('0x39')]){_0x1577e7['where']=_[_0x42b2('0x3a')](_0x1577e7['where'],{'$or':_[_0x42b2('0x28')](_0x1577e7['attributes'],function(_0x1ba431){var _0x370621={};_0x370621[_0x1ba431]={'$like':'%'+_0x14bce2[_0x42b2('0x2e')][_0x42b2('0x39')]+'%'};return _0x370621;})});}_0x1577e7=_[_0x42b2('0x3a')]({},_0x1577e7,_0x14bce2[_0x42b2('0x3c')]);return _0x40082d[_0x42b2('0x47')](_0x1577e7);}})[_0x42b2('0x22')](function(_0x30d788){if(_0x30d788){_0x2f8651=_0x30d788[_0x42b2('0x33')];if(!_0x14bce2[_0x42b2('0x2e')]['hasOwnProperty'](_0x42b2('0x4a'))){_0x1577e7[_0x42b2('0x1c')]=qs[_0x42b2('0x1c')](_0x14bce2[_0x42b2('0x2e')][_0x42b2('0x1c')]);_0x1577e7[_0x42b2('0x19')]=qs[_0x42b2('0x19')](_0x14bce2['query']['offset']);}return _0x40082d[_0x42b2('0x47')](_0x1577e7);}})[_0x42b2('0x22')](function(_0x1cd44b){if(_0x1cd44b){return _0x1cd44b?{'count':_0x2f8651,'rows':_0x1cd44b}:null;}})['then'](respondWithResult(_0x51d6d0,null))[_0x42b2('0x3f')](handleError(_0x51d6d0,null));};exports[_0x42b2('0x4b')]=function(_0x16b367,_0x2e549b,_0xe3b39f){if(_0x16b367[_0x42b2('0x45')]['id']){delete _0x16b367[_0x42b2('0x45')]['id'];}return db[_0x42b2('0x29')][_0x42b2('0x48')]({'where':{'id':_0x16b367['params']['id']}})[_0x42b2('0x22')](handleEntityNotFound(_0x2e549b,null))[_0x42b2('0x22')](function(_0x4b2dd8){if(_0x4b2dd8){_0x16b367[_0x42b2('0x45')][_0x42b2('0x4c')]=_0x4b2dd8['id'];_0x16b367[_0x42b2('0x45')]['Subjects']=integrations[_0x42b2('0x4d')](_0x16b367[_0x42b2('0x45')]['channel'],_0x16b367[_0x42b2('0x45')]['type']);_0x16b367[_0x42b2('0x45')]['Descriptions']=integrations['getDescriptions'](_0x16b367[_0x42b2('0x45')][_0x42b2('0x4e')],_0x16b367[_0x42b2('0x45')][_0x42b2('0x2b')]);return db[_0x42b2('0x49')]['create'](_0x16b367[_0x42b2('0x45')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x42b2('0x4f')],'as':_0x42b2('0x50')}]});}return null;})[_0x42b2('0x22')](respondWithResult(_0x2e549b,null))[_0x42b2('0x3f')](handleError(_0x2e549b,null));};exports[_0x42b2('0x51')]=function(_0x4049ee,_0x173885,_0x4319e9){var _0xfbb7b7=[_0x42b2('0x52'),_0x42b2('0x53'),_0x42b2('0x54'),_0x42b2('0x55'),_0x42b2('0x56'),'notify','incident_state',_0x42b2('0x57'),_0x42b2('0x58')];var _0x2935f4=['parent',_0x42b2('0x52'),_0x42b2('0x59'),_0x42b2('0x5a'),_0x42b2('0x5b'),_0x42b2('0x5c'),_0x42b2('0x5d'),_0x42b2('0x53'),_0x42b2('0x5e'),_0x42b2('0x5f'),_0x42b2('0x60'),'sys_updated_by',_0x42b2('0x61'),_0x42b2('0x62'),'sys_created_on',_0x42b2('0x63'),_0x42b2('0x64'),_0x42b2('0x65'),_0x42b2('0x54'),'order','calendar_stc','closed_at','cmdb_ci',_0x42b2('0x66'),_0x42b2('0x67'),'active',_0x42b2('0x68'),'business_service','priority',_0x42b2('0x69'),_0x42b2('0x6a'),_0x42b2('0x6b'),_0x42b2('0x6c'),_0x42b2('0x6d'),_0x42b2('0x6e'),'group_list',_0x42b2('0x6f'),'reopened_time',_0x42b2('0x70'),_0x42b2('0x71'),_0x42b2('0x72'),'subcategory',_0x42b2('0x73'),_0x42b2('0x74'),_0x42b2('0x56'),_0x42b2('0x75'),_0x42b2('0x76'),_0x42b2('0x77'),_0x42b2('0x78'),'business_stc',_0x42b2('0x79'),_0x42b2('0x7a'),_0x42b2('0x7b'),'notify',_0x42b2('0x7c'),_0x42b2('0x7d'),'closed_by',_0x42b2('0x7e'),_0x42b2('0x7f'),_0x42b2('0x80'),_0x42b2('0x81'),'reopened_by',_0x42b2('0x82'),'urgency',_0x42b2('0x83'),_0x42b2('0x84'),_0x42b2('0x85'),_0x42b2('0x86'),'assigned_to','severity',_0x42b2('0x87'),_0x42b2('0x88'),_0x42b2('0x89'),_0x42b2('0x8a'),_0x42b2('0x8b'),_0x42b2('0x8c'),_0x42b2('0x8d'),_0x42b2('0x8e'),'escalation','upon_approval',_0x42b2('0x8f'),_0x42b2('0x90'),'category'];var _0x70a427='';var _0xb78ff4='';var _0x550870=[];var _0x46ebc8='';var _0x45ce26='';var _0x173ea2=[];var _0x1818f8='';var _0x27dcaa='';var _0x40e0f2={};var _0x1f7172='';return db[_0x42b2('0x29')][_0x42b2('0x48')]({'where':{'id':_0x4049ee[_0x42b2('0x41')]['id']},'attributes':['id',_0x42b2('0x91'),_0x42b2('0x92'),_0x42b2('0x93'),_0x42b2('0x94'),_0x42b2('0x95')]})[_0x42b2('0x22')](handleEntityNotFound(_0x173885,null))[_0x42b2('0x22')](function(_0x1a102d){if(_0x1a102d){_0x1f7172=_0x1a102d['remoteUri'];var _0x2bb93a=_0x1f7172['slice'](-0x1);if(_0x2bb93a==='/'){_0x1f7172=_0x1f7172['substring'](0x0,_0x1f7172[_0x42b2('0x96')](_0x2bb93a));}_0x27dcaa=util[_0x42b2('0x97')](_0x42b2('0x98'),_0x1f7172);_0x1818f8=util[_0x42b2('0x97')](_0x42b2('0x99'),_0x1f7172);_0x40e0f2={'user':_0x1a102d[_0x42b2('0x91')],'pass':_0x1a102d[_0x42b2('0x92')]};var _0x3bc3f7={'method':_0x42b2('0x9a'),'uri':_0x27dcaa+_0x42b2('0x9b'),'auth':_0x40e0f2,'json':!![]};return rp(_0x3bc3f7);}})[_0x42b2('0x22')](function(_0x3a0343){if(_0x3a0343[_0x42b2('0x9c')][_0x42b2('0x33')]>0x0){_0x70a427=_0x3a0343[_0x42b2('0x9c')];}console[_0x42b2('0x9d')](_0x42b2('0x9e'),_0x70a427);_0x173ea2=[];_0xb78ff4=Object[_0x42b2('0x9f')]([],_0x70a427);_[_0x42b2('0xa0')](_0xb78ff4,function(_0x1743bd){return!_0xfbb7b7[_0x42b2('0xa1')](_0x1743bd['name']);});_0xb78ff4['forEach'](function(_0x1038de){var _0x1dc98c=createFieldObject(_0x1818f8,_0x40e0f2,_0x1038de[_0x42b2('0xa2')],_0x1038de[_0x42b2('0x2c')],_0x1038de[_0x42b2('0xa3')],![]);_0x173ea2['push'](_0x1dc98c);});return Promise['all'](_0x173ea2);})[_0x42b2('0x22')](function(_0x373bf0){_0x550870=_0x373bf0;_0x46ebc8=Object[_0x42b2('0x9f')]([],_0x70a427);console[_0x42b2('0x9d')](_0x42b2('0xa4'),_0x70a427);_[_0x42b2('0xa0')](_0x46ebc8,function(_0x220e1d){return _0x2935f4[_0x42b2('0xa1')](_0x220e1d['name']);});console['log'](_0x42b2('0xa5'),_0x46ebc8);_0x173ea2=[];_0x46ebc8['forEach'](function(_0x4395d9){var _0x9a7e3c=createFieldObject(_0x1818f8,_0x40e0f2,_0x4395d9['internalType'],_0x4395d9[_0x42b2('0x2c')],_0x4395d9[_0x42b2('0xa3')],!![]);_0x173ea2['push'](_0x9a7e3c);});return Promise[_0x42b2('0xa6')](_0x173ea2);})[_0x42b2('0x22')](function(_0x45a82){_0x45ce26=_0x45a82;var _0x5e018c=_0x550870[_0x42b2('0xa7')](_0x45ce26);return{'count':_0x5e018c[_0x42b2('0x33')],'rows':_0x5e018c};})[_0x42b2('0x22')](respondWithResult(_0x173885,null))[_0x42b2('0x3f')](function(_0x4ef211){console[_0x42b2('0x9d')](_0x42b2('0xa8')+_0x4ef211);var _0x58ccf4=_0x4049ee[_0x42b2('0x2e')][_0x42b2('0xa9')]?0x1f4:_0x4ef211['statusCode']||0x1f4;logger[_0x42b2('0x24')](_0x4ef211['stack']);delete _0x4ef211['name'];if(_0x58ccf4===0x191){_0x58ccf4=0x190;}_0x173885['status'](_0x58ccf4)[_0x42b2('0x26')](_0x4049ee[_0x42b2('0x2e')][_0x42b2('0xa9')]?{'message':_0x42b2('0xaa'),'statusCode':_0x4ef211[_0x42b2('0xab')]}:_0x4ef211);});};function createFieldObject(_0x392c78,_0x10c10a,_0x3ac84d,_0x52f60b,_0x32855e,_0x361cd1){return new Promise(function(_0x4f23f7,_0x3ed49b){var _0x399a27={'id':_0x52f60b,'name':_0x32855e,'custom':_0x361cd1};if(_0x3ac84d==='boolean'){_0x399a27[_0x42b2('0x3c')]=[{'name':_0x42b2('0xac'),'value':'true'},{'name':_0x42b2('0xad'),'value':'false'}];_0x4f23f7(_0x399a27);}else{var _0x4c8a4b={'method':_0x42b2('0x9a'),'uri':_0x392c78+_0x42b2('0xae')+_0x52f60b,'auth':_0x10c10a,'json':!![]};return rp(_0x4c8a4b)['then'](function(_0x5f26f6){var _0x4c5887=[];if(_0x5f26f6[_0x42b2('0x9c')][_0x42b2('0x33')]>0x0){_0x5f26f6['result'][_0x42b2('0xaf')](function(_0x312b3e){if(_0x312b3e[_0x42b2('0xb0')]===_0x42b2('0xb1')){var _0x42df22={'name':_0x312b3e[_0x42b2('0xa3')],'value':_0x312b3e[_0x42b2('0xb2')]};_0x4c5887[_0x42b2('0xb3')](_0x42df22);}});}_0x399a27['options']=_0x4c5887;if(_0x399a27[_0x42b2('0x3c')][_0x42b2('0x33')]>0x0){_0x4f23f7(_0x399a27);}else{if(_0x361cd1==![]){_0x4f23f7();}else{_0x4f23f7(_0x399a27);}}});}});} \ No newline at end of file +var _0x21c2=['reopen_count','sys_tags','escalation','upon_approval','correlation_id','password','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','log','ServiceNow\x20error:\x20','test','statusCode','boolean','True','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','getConfigurations','findOne','length','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','subcategory','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','hold_reason','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','approval_set','close_code','correlation_display','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count'];(function(_0x2fca93,_0x4ef99b){var _0x391ce6=function(_0x48c832){while(--_0x48c832){_0x2fca93['push'](_0x2fca93['shift']());}};_0x391ce6(++_0x4ef99b);}(_0x21c2,0x19b));var _0x221c=function(_0x208126,_0x4c662f){_0x208126=_0x208126-0x0;var _0x4ba72a=_0x21c2[_0x208126];return _0x4ba72a;};'use strict';var emlformat=require(_0x221c('0x0'));var rimraf=require(_0x221c('0x1'));var zipdir=require(_0x221c('0x2'));var jsonpatch=require(_0x221c('0x3'));var rp=require(_0x221c('0x4'));var moment=require(_0x221c('0x5'));var BPromise=require(_0x221c('0x6'));var Mustache=require(_0x221c('0x7'));var util=require(_0x221c('0x8'));var path=require(_0x221c('0x9'));var sox=require('sox');var csv=require(_0x221c('0xa'));var ejs=require(_0x221c('0xb'));var fs=require('fs');var fs_extra=require(_0x221c('0xc'));var _=require(_0x221c('0xd'));var squel=require(_0x221c('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x221c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x221c('0x10'));var Papa=require(_0x221c('0x11'));var Redis=require('ioredis');var authService=require(_0x221c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x221c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x221c('0x14'))(_0x221c('0x15'));var utils=require(_0x221c('0x16'));var config=require(_0x221c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x221c('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x14fbb3,_0x1a45ac){_0x1a45ac=_0x1a45ac||0xcc;return function(_0x30f365){if(_0x30f365){return _0x14fbb3[_0x221c('0x19')](_0x1a45ac);}return _0x14fbb3['status'](_0x1a45ac)[_0x221c('0x1a')]();};}function respondWithResult(_0x4aed67,_0x5a3516){_0x5a3516=_0x5a3516||0xc8;return function(_0x38cfba){if(_0x38cfba){return _0x4aed67[_0x221c('0x1b')](_0x5a3516)[_0x221c('0x1c')](_0x38cfba);}};}function respondWithFilteredResult(_0x4e7f5d,_0x2994e2){return function(_0x1a8bf1){if(_0x1a8bf1){var _0x74bdca=typeof _0x2994e2[_0x221c('0x1d')]==='undefined'&&typeof _0x2994e2['limit']==='undefined';var _0x25895e=_0x1a8bf1[_0x221c('0x1e')];var _0x285457=_0x74bdca?0x0:_0x2994e2['offset'];var _0x4d664=_0x74bdca?_0x1a8bf1['count']:_0x2994e2[_0x221c('0x1d')]+_0x2994e2[_0x221c('0x1f')];var _0xd513f5;if(_0x4d664>=_0x25895e){_0x4d664=_0x25895e;_0xd513f5=0xc8;}else{_0xd513f5=0xce;}_0x4e7f5d['status'](_0xd513f5);return _0x4e7f5d['set'](_0x221c('0x20'),_0x285457+'-'+_0x4d664+'/'+_0x25895e)[_0x221c('0x1c')](_0x1a8bf1);}return null;};}function patchUpdates(_0x5ced64){return function(_0x61f5ff){try{jsonpatch[_0x221c('0x21')](_0x61f5ff,_0x5ced64,!![]);}catch(_0x33f2ce){return BPromise['reject'](_0x33f2ce);}return _0x61f5ff[_0x221c('0x22')]();};}function saveUpdates(_0xc3abc0,_0xac9928){return function(_0x20e5ea){if(_0x20e5ea){return _0x20e5ea[_0x221c('0x23')](_0xc3abc0)[_0x221c('0x24')](function(_0x51786a){return _0x51786a;});}return null;};}function removeEntity(_0x5b47d3,_0x17bedd){return function(_0x135b88){if(_0x135b88){return _0x135b88[_0x221c('0x25')]()['then'](function(){_0x5b47d3[_0x221c('0x1b')](0xcc)[_0x221c('0x1a')]();});}};}function handleEntityNotFound(_0x5445aa,_0x52a1b0){return function(_0x3afddc){if(!_0x3afddc){_0x5445aa[_0x221c('0x19')](0x194);}return _0x3afddc;};}function handleError(_0x4fc0e3,_0x766a14){_0x766a14=_0x766a14||0x1f4;return function(_0x5b6ae8){logger[_0x221c('0x26')](_0x5b6ae8[_0x221c('0x27')]);if(_0x5b6ae8[_0x221c('0x28')]){delete _0x5b6ae8[_0x221c('0x28')];}_0x4fc0e3[_0x221c('0x1b')](_0x766a14)['send'](_0x5b6ae8);};}exports[_0x221c('0x29')]=function(_0x37b38f,_0x188ea6){var _0x4daa4a={},_0x428110={},_0x21190b={'count':0x0,'rows':[]};var _0x14dc3e=_['map'](db[_0x221c('0x2a')][_0x221c('0x2b')],function(_0x2f9490){return{'name':_0x2f9490[_0x221c('0x2c')],'type':_0x2f9490[_0x221c('0x2d')][_0x221c('0x2e')]};});_0x428110[_0x221c('0x2f')]=_[_0x221c('0x30')](_0x14dc3e,_0x221c('0x28'));_0x428110[_0x221c('0x31')]=_[_0x221c('0x32')](_0x37b38f['query']);_0x428110['filters']=_[_0x221c('0x33')](_0x428110[_0x221c('0x2f')],_0x428110[_0x221c('0x31')]);_0x4daa4a[_0x221c('0x34')]=_[_0x221c('0x33')](_0x428110[_0x221c('0x2f')],qs[_0x221c('0x35')](_0x37b38f[_0x221c('0x31')][_0x221c('0x35')]));_0x4daa4a[_0x221c('0x34')]=_0x4daa4a[_0x221c('0x34')]['length']?_0x4daa4a[_0x221c('0x34')]:_0x428110[_0x221c('0x2f')];if(!_0x37b38f[_0x221c('0x31')]['hasOwnProperty'](_0x221c('0x36'))){_0x4daa4a['limit']=qs[_0x221c('0x1f')](_0x37b38f[_0x221c('0x31')][_0x221c('0x1f')]);_0x4daa4a[_0x221c('0x1d')]=qs['offset'](_0x37b38f[_0x221c('0x31')][_0x221c('0x1d')]);}_0x4daa4a[_0x221c('0x37')]=qs['sort'](_0x37b38f['query'][_0x221c('0x38')]);_0x4daa4a[_0x221c('0x39')]=qs[_0x221c('0x3a')](_[_0x221c('0x3b')](_0x37b38f[_0x221c('0x31')],_0x428110[_0x221c('0x3a')]),_0x14dc3e);if(_0x37b38f[_0x221c('0x31')][_0x221c('0x3c')]){_0x4daa4a[_0x221c('0x39')]=_[_0x221c('0x3d')](_0x4daa4a[_0x221c('0x39')],{'$or':_[_0x221c('0x30')](_0x14dc3e,function(_0x587ae7){if(_0x587ae7[_0x221c('0x2d')]!=='VIRTUAL'){var _0xd59e4f={};_0xd59e4f[_0x587ae7['name']]={'$like':'%'+_0x37b38f[_0x221c('0x31')][_0x221c('0x3c')]+'%'};return _0xd59e4f;}})});}_0x4daa4a=_[_0x221c('0x3d')]({},_0x4daa4a,_0x37b38f['options']);var _0x3c3094={'where':_0x4daa4a['where']};return db['ServicenowAccount'][_0x221c('0x1e')](_0x3c3094)[_0x221c('0x24')](function(_0x2bff3c){_0x21190b['count']=_0x2bff3c;if(_0x37b38f['query'][_0x221c('0x3e')]){_0x4daa4a[_0x221c('0x3f')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x221c('0x40')](_0x4daa4a);})[_0x221c('0x24')](function(_0x29172b){_0x21190b[_0x221c('0x41')]=_0x29172b;return _0x21190b;})[_0x221c('0x24')](respondWithFilteredResult(_0x188ea6,_0x4daa4a))[_0x221c('0x42')](handleError(_0x188ea6,null));};exports[_0x221c('0x43')]=function(_0x12b8c7,_0x1c3bee){var _0x436c93={'raw':![],'where':{'id':_0x12b8c7[_0x221c('0x44')]['id']}},_0x4a2618={};_0x4a2618[_0x221c('0x2f')]=_[_0x221c('0x32')](db[_0x221c('0x2a')]['rawAttributes']);_0x4a2618[_0x221c('0x31')]=_['keys'](_0x12b8c7['query']);_0x4a2618[_0x221c('0x3a')]=_[_0x221c('0x33')](_0x4a2618['model'],_0x4a2618[_0x221c('0x31')]);_0x436c93['attributes']=_[_0x221c('0x33')](_0x4a2618['model'],qs['fields'](_0x12b8c7[_0x221c('0x31')]['fields']));_0x436c93[_0x221c('0x34')]=_0x436c93[_0x221c('0x34')]['length']?_0x436c93[_0x221c('0x34')]:_0x4a2618[_0x221c('0x2f')];if(_0x12b8c7['query'][_0x221c('0x3e')]){_0x436c93[_0x221c('0x3f')]=[{'all':!![]}];}_0x436c93=_[_0x221c('0x3d')]({},_0x436c93,_0x12b8c7[_0x221c('0x45')]);return db['ServicenowAccount']['find'](_0x436c93)[_0x221c('0x24')](handleEntityNotFound(_0x1c3bee,null))['then'](respondWithResult(_0x1c3bee,null))[_0x221c('0x42')](handleError(_0x1c3bee,null));};exports[_0x221c('0x46')]=function(_0x3098dd,_0x33a17f){return db[_0x221c('0x2a')][_0x221c('0x46')](_0x3098dd[_0x221c('0x47')],{})['then'](respondWithResult(_0x33a17f,0xc9))[_0x221c('0x42')](handleError(_0x33a17f,null));};exports[_0x221c('0x23')]=function(_0x258522,_0x16038d){if(_0x258522[_0x221c('0x47')]['id']){delete _0x258522[_0x221c('0x47')]['id'];}return db[_0x221c('0x2a')][_0x221c('0x48')]({'where':{'id':_0x258522[_0x221c('0x44')]['id']}})[_0x221c('0x24')](handleEntityNotFound(_0x16038d,null))[_0x221c('0x24')](saveUpdates(_0x258522['body'],null))[_0x221c('0x24')](respondWithResult(_0x16038d,null))[_0x221c('0x42')](handleError(_0x16038d,null));};exports['destroy']=function(_0x328455,_0xd7c3ba){return db[_0x221c('0x2a')]['find']({'where':{'id':_0x328455[_0x221c('0x44')]['id']}})[_0x221c('0x24')](handleEntityNotFound(_0xd7c3ba,null))[_0x221c('0x24')](removeEntity(_0xd7c3ba,null))[_0x221c('0x42')](handleError(_0xd7c3ba,null));};exports[_0x221c('0x49')]=function(_0x59e206,_0x353171,_0x5869b8){var _0x408060={};var _0x18d96f={};var _0x441147;var _0x545461;return db[_0x221c('0x2a')][_0x221c('0x4a')]({'where':{'id':_0x59e206['params']['id']}})['then'](handleEntityNotFound(_0x353171,null))[_0x221c('0x24')](function(_0x152b99){if(_0x152b99){_0x441147=_0x152b99;_0x18d96f[_0x221c('0x2f')]=_[_0x221c('0x32')](db['ServicenowConfiguration'][_0x221c('0x2b')]);_0x18d96f['query']=_[_0x221c('0x32')](_0x59e206[_0x221c('0x31')]);_0x18d96f[_0x221c('0x3a')]=_['intersection'](_0x18d96f[_0x221c('0x2f')],_0x18d96f[_0x221c('0x31')]);_0x408060['attributes']=_[_0x221c('0x33')](_0x18d96f['model'],qs[_0x221c('0x35')](_0x59e206[_0x221c('0x31')]['fields']));_0x408060[_0x221c('0x34')]=_0x408060['attributes'][_0x221c('0x4b')]?_0x408060[_0x221c('0x34')]:_0x18d96f[_0x221c('0x2f')];_0x408060[_0x221c('0x37')]=qs['sort'](_0x59e206['query'][_0x221c('0x38')]);_0x408060[_0x221c('0x39')]=qs[_0x221c('0x3a')](_[_0x221c('0x3b')](_0x59e206[_0x221c('0x31')],_0x18d96f[_0x221c('0x3a')]));if(_0x59e206[_0x221c('0x31')][_0x221c('0x3c')]){_0x408060[_0x221c('0x39')]=_[_0x221c('0x3d')](_0x408060[_0x221c('0x39')],{'$or':_[_0x221c('0x30')](_0x408060[_0x221c('0x34')],function(_0x4d5860){var _0x48c8e7={};_0x48c8e7[_0x4d5860]={'$like':'%'+_0x59e206[_0x221c('0x31')][_0x221c('0x3c')]+'%'};return _0x48c8e7;})});}_0x408060=_[_0x221c('0x3d')]({},_0x408060,_0x59e206[_0x221c('0x45')]);return _0x441147[_0x221c('0x49')](_0x408060);}})[_0x221c('0x24')](function(_0x1e193a){if(_0x1e193a){_0x545461=_0x1e193a[_0x221c('0x4b')];if(!_0x59e206[_0x221c('0x31')][_0x221c('0x4c')](_0x221c('0x36'))){_0x408060[_0x221c('0x1f')]=qs['limit'](_0x59e206[_0x221c('0x31')]['limit']);_0x408060[_0x221c('0x1d')]=qs[_0x221c('0x1d')](_0x59e206[_0x221c('0x31')][_0x221c('0x1d')]);}return _0x441147[_0x221c('0x49')](_0x408060);}})['then'](function(_0x3477b5){if(_0x3477b5){return _0x3477b5?{'count':_0x545461,'rows':_0x3477b5}:null;}})[_0x221c('0x24')](respondWithResult(_0x353171,null))[_0x221c('0x42')](handleError(_0x353171,null));};exports[_0x221c('0x4d')]=function(_0x57f269,_0x1516b7,_0x5bff3e){if(_0x57f269[_0x221c('0x47')]['id']){delete _0x57f269[_0x221c('0x47')]['id'];}return db[_0x221c('0x2a')]['findOne']({'where':{'id':_0x57f269['params']['id']}})['then'](handleEntityNotFound(_0x1516b7,null))[_0x221c('0x24')](function(_0x47ea57){if(_0x47ea57){_0x57f269[_0x221c('0x47')][_0x221c('0x4e')]=_0x47ea57['id'];_0x57f269['body'][_0x221c('0x4f')]=integrations[_0x221c('0x50')](_0x57f269[_0x221c('0x47')][_0x221c('0x51')],_0x57f269[_0x221c('0x47')][_0x221c('0x2d')]);_0x57f269[_0x221c('0x47')][_0x221c('0x52')]=integrations[_0x221c('0x53')](_0x57f269['body'][_0x221c('0x51')],_0x57f269[_0x221c('0x47')][_0x221c('0x2d')]);return db[_0x221c('0x54')][_0x221c('0x46')](_0x57f269['body'],{'include':[{'model':db[_0x221c('0x55')],'as':'Subjects'},{'model':db[_0x221c('0x55')],'as':_0x221c('0x52')}]});}return null;})[_0x221c('0x24')](respondWithResult(_0x1516b7,null))[_0x221c('0x42')](handleError(_0x1516b7,null));};exports[_0x221c('0x56')]=function(_0x290513,_0x458584,_0x174568){var _0x42780e=['made_sla','hold_reason','knowledge',_0x221c('0x57'),'close_code',_0x221c('0x58'),_0x221c('0x59'),_0x221c('0x5a'),_0x221c('0x5b')];var _0xe75baa=[_0x221c('0x5c'),_0x221c('0x5d'),_0x221c('0x5e'),_0x221c('0x5f'),'upon_reject',_0x221c('0x60'),_0x221c('0x61'),_0x221c('0x62'),'approval_history',_0x221c('0x63'),_0x221c('0x64'),'sys_updated_by',_0x221c('0x65'),_0x221c('0x66'),_0x221c('0x67'),_0x221c('0x68'),_0x221c('0x69'),_0x221c('0x6a'),_0x221c('0x6b'),_0x221c('0x37'),_0x221c('0x6c'),_0x221c('0x6d'),_0x221c('0x6e'),_0x221c('0x6f'),'impact',_0x221c('0x70'),_0x221c('0x71'),_0x221c('0x72'),_0x221c('0x73'),_0x221c('0x74'),_0x221c('0x75'),'time_worked',_0x221c('0x76'),_0x221c('0x77'),_0x221c('0x78'),_0x221c('0x79'),_0x221c('0x7a'),'reopened_time','resolved_at','caller_id',_0x221c('0x7b'),_0x221c('0x57'),'work_notes','short_description',_0x221c('0x7c'),_0x221c('0x7d'),'delivery_task','work_start',_0x221c('0x7e'),_0x221c('0x7f'),'additional_assignee_list','description',_0x221c('0x80'),_0x221c('0x58'),_0x221c('0x81'),_0x221c('0x82'),_0x221c('0x83'),'follow_up',_0x221c('0x84'),_0x221c('0x85'),'contact_type',_0x221c('0x86'),_0x221c('0x59'),_0x221c('0x87'),_0x221c('0x88'),_0x221c('0x89'),_0x221c('0x8a'),_0x221c('0x8b'),_0x221c('0x8c'),_0x221c('0x5a'),_0x221c('0x8d'),_0x221c('0x8e'),_0x221c('0x8f'),_0x221c('0x90'),_0x221c('0x91'),_0x221c('0x92'),_0x221c('0x93'),_0x221c('0x94'),_0x221c('0x95'),_0x221c('0x96'),_0x221c('0x97'),'location',_0x221c('0x5b')];var _0x2d39b7='';var _0x3d22e0='';var _0x5bb709=[];var _0x347596='';var _0x2a03e7='';var _0x22a48f=[];var _0x375290='';var _0x187f12='';var _0x15f7b6={};var _0xc036ea='';return db[_0x221c('0x2a')]['findOne']({'where':{'id':_0x290513[_0x221c('0x44')]['id']},'attributes':['id','username',_0x221c('0x98'),'email',_0x221c('0x99'),_0x221c('0x9a')]})['then'](handleEntityNotFound(_0x458584,null))[_0x221c('0x24')](function(_0x289d97){if(_0x289d97){_0xc036ea=_0x289d97[_0x221c('0x99')];var _0x1e3249=_0xc036ea[_0x221c('0x9b')](-0x1);if(_0x1e3249==='/'){_0xc036ea=_0xc036ea[_0x221c('0x9c')](0x0,_0xc036ea['lastIndexOf'](_0x1e3249));}_0x187f12=util[_0x221c('0x9d')](_0x221c('0x9e'),_0xc036ea);_0x375290=util[_0x221c('0x9d')](_0x221c('0x9f'),_0xc036ea);_0x15f7b6={'user':_0x289d97[_0x221c('0xa0')],'pass':_0x289d97[_0x221c('0x98')]};var _0x591e63={'method':'GET','uri':_0x187f12+_0x221c('0xa1'),'auth':_0x15f7b6,'json':!![]};return rp(_0x591e63);}})[_0x221c('0x24')](function(_0x45dcb2){if(_0x45dcb2['result'][_0x221c('0x4b')]>0x0){_0x2d39b7=_0x45dcb2[_0x221c('0xa2')];}console['log'](_0x221c('0xa3'),_0x2d39b7);_0x22a48f=[];_0x3d22e0=Object[_0x221c('0xa4')]([],_0x2d39b7);_[_0x221c('0xa5')](_0x3d22e0,function(_0x72ee8a){return!_0x42780e['includes'](_0x72ee8a[_0x221c('0x28')]);});_0x3d22e0[_0x221c('0xa6')](function(_0x2d8495){var _0x1e8404=createFieldObject(_0x375290,_0x15f7b6,_0x2d8495[_0x221c('0xa7')],_0x2d8495[_0x221c('0x28')],_0x2d8495[_0x221c('0xa8')],![]);_0x22a48f[_0x221c('0xa9')](_0x1e8404);});return Promise[_0x221c('0xaa')](_0x22a48f);})[_0x221c('0x24')](function(_0x14c9fe){_0x5bb709=_0x14c9fe;_0x347596=Object[_0x221c('0xa4')]([],_0x2d39b7);console['log']('TCL:\x20_object',_0x2d39b7);_[_0x221c('0xa5')](_0x347596,function(_0x471afc){return _0xe75baa[_0x221c('0xab')](_0x471afc[_0x221c('0x28')]);});console['log'](_0x221c('0xac'),_0x347596);_0x22a48f=[];_0x347596[_0x221c('0xa6')](function(_0x6af12f){var _0x337251=createFieldObject(_0x375290,_0x15f7b6,_0x6af12f[_0x221c('0xa7')],_0x6af12f[_0x221c('0x28')],_0x6af12f[_0x221c('0xa8')],!![]);_0x22a48f[_0x221c('0xa9')](_0x337251);});return Promise['all'](_0x22a48f);})['then'](function(_0x191a26){_0x2a03e7=_0x191a26;var _0x596697=_0x5bb709[_0x221c('0xad')](_0x2a03e7);return{'count':_0x596697['length'],'rows':_0x596697};})[_0x221c('0x24')](respondWithResult(_0x458584,null))[_0x221c('0x42')](function(_0x3a1589){console[_0x221c('0xae')](_0x221c('0xaf')+_0x3a1589);var _0x4be797=_0x290513[_0x221c('0x31')][_0x221c('0xb0')]?0x1f4:_0x3a1589[_0x221c('0xb1')]||0x1f4;logger[_0x221c('0x26')](_0x3a1589[_0x221c('0x27')]);delete _0x3a1589[_0x221c('0x28')];if(_0x4be797===0x191){_0x4be797=0x190;}_0x458584[_0x221c('0x1b')](_0x4be797)['send'](_0x290513[_0x221c('0x31')][_0x221c('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x3a1589[_0x221c('0xb1')]}:_0x3a1589);});};function createFieldObject(_0x2f71ba,_0x444a6a,_0x3ade48,_0x3c381e,_0x429c7b,_0x2080d4){return new Promise(function(_0x78889c,_0x1b4e32){var _0x297bf9={'id':_0x3c381e,'name':_0x429c7b,'custom':_0x2080d4};if(_0x3ade48===_0x221c('0xb2')){_0x297bf9['options']=[{'name':_0x221c('0xb3'),'value':'true'},{'name':_0x221c('0xb4'),'value':_0x221c('0xb5')}];_0x78889c(_0x297bf9);}else{var _0x59b92c={'method':_0x221c('0xb6'),'uri':_0x2f71ba+_0x221c('0xb7')+_0x3c381e,'auth':_0x444a6a,'json':!![]};return rp(_0x59b92c)[_0x221c('0x24')](function(_0x19d862){var _0x2f85da=[];if(_0x19d862[_0x221c('0xa2')][_0x221c('0x4b')]>0x0){_0x19d862[_0x221c('0xa2')]['forEach'](function(_0x48309d){if(_0x48309d[_0x221c('0xb8')]==='false'){var _0x51eb5a={'name':_0x48309d[_0x221c('0xa8')],'value':_0x48309d[_0x221c('0xb9')]};_0x2f85da[_0x221c('0xa9')](_0x51eb5a);}});}_0x297bf9[_0x221c('0x45')]=_0x2f85da;if(_0x297bf9['options'][_0x221c('0x4b')]>0x0){_0x78889c(_0x297bf9);}else{if(_0x2080d4==![]){_0x78889c();}else{_0x78889c(_0x297bf9);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 99c1b65..0468ec4 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2675=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','moment','bluebird'];(function(_0x30fde3,_0x69fd6){var _0x45703f=function(_0x470c4e){while(--_0x470c4e){_0x30fde3['push'](_0x30fde3['shift']());}};_0x45703f(++_0x69fd6);}(_0x2675,0x75));var _0x5267=function(_0x96455d,_0x4a3ea1){_0x96455d=_0x96455d-0x0;var _0x55555f=_0x2675[_0x96455d];return _0x55555f;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));var integrations=require(_0x5267('0x6'));module[_0x5267('0x7')]=function(_0x10f92c,_0x20f065){return _0x10f92c[_0x5267('0x8')]('ServicenowAccount',attributes,{'tableName':_0x5267('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['moment','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api'];(function(_0x5264cf,_0x27f100){var _0x2324da=function(_0x164310){while(--_0x164310){_0x5264cf['push'](_0x5264cf['shift']());}};_0x2324da(++_0x27f100);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x583f7b,_0x164833){_0x583f7b=_0x583f7b-0x0;var _0x170859=_0xb4c7[_0x583f7b];return _0x170859;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7b4c('0xa')]=function(_0x10e197,_0x2dd5c7){return _0x10e197['define'](_0x7b4c('0xb'),attributes,{'tableName':_0x7b4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 65ef9da..96f855d 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.rpc.js +++ b/server/api/intServicenowAccount/intServicenowAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ca0=['model','attributes','GetServicenowAccount','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','ServicenowAccount','findAll','options','raw','limit','include','map'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x8ca0,0x141));var _0x08ca=function(_0x56558c,_0x559a88){_0x56558c=_0x56558c-0x0;var _0x756da7=_0x8ca0[_0x56558c];return _0x756da7;};'use strict';var _=require(_0x08ca('0x0'));var util=require(_0x08ca('0x1'));var moment=require(_0x08ca('0x2'));var BPromise=require(_0x08ca('0x3'));var rs=require(_0x08ca('0x4'));var fs=require('fs');var Redis=require(_0x08ca('0x5'));var db=require(_0x08ca('0x6'))['db'];var utils=require(_0x08ca('0x7'));var logger=require('../../config/logger')(_0x08ca('0x8'));var config=require(_0x08ca('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x08ca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f54e9,_0x2aef5d,_0x2ad0c3){return new BPromise(function(_0x5cb023,_0x58aa4d){return client[_0x08ca('0xb')](_0x1f54e9,_0x2ad0c3)[_0x08ca('0xc')](function(_0x30c945){logger['info'](_0x08ca('0xd'),_0x2aef5d,_0x08ca('0xe'));logger[_0x08ca('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2aef5d,_0x08ca('0xe'),JSON[_0x08ca('0x10')](_0x30c945));if(_0x30c945[_0x08ca('0x11')]){if(_0x30c945[_0x08ca('0x11')]['code']===0x1f4){logger[_0x08ca('0x11')](_0x08ca('0xd'),_0x2aef5d,_0x30c945[_0x08ca('0x11')]['message']);return _0x58aa4d(_0x30c945['error']['message']);}logger[_0x08ca('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2aef5d,_0x30c945[_0x08ca('0x11')][_0x08ca('0x12')]);return _0x5cb023(_0x30c945[_0x08ca('0x11')][_0x08ca('0x12')]);}else{logger[_0x08ca('0x13')](_0x08ca('0xd'),_0x2aef5d,_0x08ca('0xe'));_0x5cb023(_0x30c945[_0x08ca('0x14')][_0x08ca('0x12')]);}})[_0x08ca('0x15')](function(_0x1c8fb2){logger['error'](_0x08ca('0xd'),_0x2aef5d,_0x1c8fb2);_0x58aa4d(_0x1c8fb2);});});}exports['GetServicenowAccount']=function(_0x2bf322){var _0x1048b2=this;return new Promise(function(_0x300486,_0x1917d7){return db[_0x08ca('0x16')][_0x08ca('0x17')]({'raw':_0x2bf322[_0x08ca('0x18')]?_0x2bf322[_0x08ca('0x18')][_0x08ca('0x19')]===undefined?!![]:![]:!![],'where':_0x2bf322[_0x08ca('0x18')]?_0x2bf322[_0x08ca('0x18')]['where']||null:null,'attributes':_0x2bf322['options']?_0x2bf322[_0x08ca('0x18')]['attributes']||null:null,'limit':_0x2bf322['options']?_0x2bf322['options'][_0x08ca('0x1a')]||null:null,'include':_0x2bf322[_0x08ca('0x18')]?_0x2bf322[_0x08ca('0x18')][_0x08ca('0x1b')]?_[_0x08ca('0x1c')](_0x2bf322[_0x08ca('0x18')]['include'],function(_0x355c67){return{'model':db[_0x355c67[_0x08ca('0x1d')]],'as':_0x355c67['as'],'attributes':_0x355c67['attributes'],'include':_0x355c67[_0x08ca('0x1b')]?_['map'](_0x355c67[_0x08ca('0x1b')],function(_0x4b43f0){return{'model':db[_0x4b43f0[_0x08ca('0x1d')]],'as':_0x4b43f0['as'],'attributes':_0x4b43f0[_0x08ca('0x1e')],'include':_0x4b43f0[_0x08ca('0x1b')]?_[_0x08ca('0x1c')](_0x4b43f0[_0x08ca('0x1b')],function(_0x2423b6){return{'model':db[_0x2423b6[_0x08ca('0x1d')]],'as':_0x2423b6['as'],'attributes':_0x2423b6[_0x08ca('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ae83a){logger[_0x08ca('0x13')](_0x08ca('0x1f'),_0x2bf322);logger[_0x08ca('0xf')](_0x08ca('0x1f'),_0x2bf322,JSON['stringify'](_0x3ae83a));_0x300486(_0x3ae83a);})[_0x08ca('0x15')](function(_0x1358ae){logger[_0x08ca('0x11')](_0x08ca('0x1f'),_0x1358ae['message'],_0x2bf322);_0x1917d7(_0x1048b2[_0x08ca('0x11')](0x1f4,_0x1358ae[_0x08ca('0x12')]));});});};exports[_0x08ca('0x20')]=function(_0x5579f3){var _0x33328f=this;return new Promise(function(_0xd816cb,_0x30818f){return db[_0x08ca('0x16')][_0x08ca('0x21')]({'raw':_0x5579f3[_0x08ca('0x18')]?_0x5579f3[_0x08ca('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5579f3[_0x08ca('0x18')]?_0x5579f3[_0x08ca('0x18')][_0x08ca('0x22')]||null:null,'attributes':_0x5579f3['options']?_0x5579f3[_0x08ca('0x18')][_0x08ca('0x1e')]||null:null,'include':_0x5579f3[_0x08ca('0x18')]?_0x5579f3[_0x08ca('0x18')]['include']?_['map'](_0x5579f3['options'][_0x08ca('0x1b')],function(_0x4784d9){return{'model':db[_0x4784d9[_0x08ca('0x1d')]],'as':_0x4784d9['as'],'attributes':_0x4784d9[_0x08ca('0x1e')],'include':_0x4784d9[_0x08ca('0x1b')]?_['map'](_0x4784d9['include'],function(_0x25b91e){return{'model':db[_0x25b91e[_0x08ca('0x1d')]],'as':_0x25b91e['as'],'attributes':_0x25b91e['attributes'],'include':_0x25b91e[_0x08ca('0x1b')]?_[_0x08ca('0x1c')](_0x25b91e['include'],function(_0x3b097d){return{'model':db[_0x3b097d[_0x08ca('0x1d')]],'as':_0x3b097d['as'],'attributes':_0x3b097d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ddeed){logger[_0x08ca('0x13')](_0x08ca('0x20'),_0x5579f3);logger[_0x08ca('0xf')](_0x08ca('0x20'),_0x5579f3,JSON[_0x08ca('0x10')](_0x1ddeed));_0xd816cb(_0x1ddeed);})[_0x08ca('0x15')](function(_0x585043){logger['error'](_0x08ca('0x20'),_0x585043[_0x08ca('0x12')],_0x5579f3);_0x30818f(_0x33328f[_0x08ca('0x11')](0x1f4,_0x585043[_0x08ca('0x12')]));});});}; \ No newline at end of file +var _0x30ee=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','ShowServicenowAccount','ServicenowAccount','find','where','util','moment','bluebird'];(function(_0x440272,_0xf9fab1){var _0x44fcb3=function(_0x558c1b){while(--_0x558c1b){_0x440272['push'](_0x440272['shift']());}};_0x44fcb3(++_0xf9fab1);}(_0x30ee,0x107));var _0xe30e=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0x30ee[_0x2ab365];return _0x49fef3;};'use strict';var _=require('lodash');var util=require(_0xe30e('0x0'));var moment=require(_0xe30e('0x1'));var BPromise=require(_0xe30e('0x2'));var rs=require(_0xe30e('0x3'));var fs=require('fs');var Redis=require(_0xe30e('0x4'));var db=require(_0xe30e('0x5'))['db'];var utils=require(_0xe30e('0x6'));var logger=require(_0xe30e('0x7'))(_0xe30e('0x8'));var config=require(_0xe30e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe30e('0xa')][_0xe30e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15960f,_0x55be36,_0xac92aa){return new BPromise(function(_0x3e0898,_0x41fd4a){return client[_0xe30e('0xc')](_0x15960f,_0xac92aa)[_0xe30e('0xd')](function(_0x1f0c78){logger['info'](_0xe30e('0xe'),_0x55be36,_0xe30e('0xf'));logger[_0xe30e('0x10')](_0xe30e('0x11'),_0x55be36,'request\x20sent',JSON[_0xe30e('0x12')](_0x1f0c78));if(_0x1f0c78['error']){if(_0x1f0c78[_0xe30e('0x13')][_0xe30e('0x14')]===0x1f4){logger[_0xe30e('0x13')](_0xe30e('0xe'),_0x55be36,_0x1f0c78['error'][_0xe30e('0x15')]);return _0x41fd4a(_0x1f0c78['error'][_0xe30e('0x15')]);}logger[_0xe30e('0x13')](_0xe30e('0xe'),_0x55be36,_0x1f0c78[_0xe30e('0x13')][_0xe30e('0x15')]);return _0x3e0898(_0x1f0c78['error']['message']);}else{logger[_0xe30e('0x16')](_0xe30e('0xe'),_0x55be36,_0xe30e('0xf'));_0x3e0898(_0x1f0c78[_0xe30e('0x17')][_0xe30e('0x15')]);}})[_0xe30e('0x18')](function(_0x328e35){logger[_0xe30e('0x13')](_0xe30e('0xe'),_0x55be36,_0x328e35);_0x41fd4a(_0x328e35);});});}exports[_0xe30e('0x19')]=function(_0x4661e5){var _0x8b8b92=this;return new Promise(function(_0x22e354,_0x5c5529){return db['ServicenowAccount'][_0xe30e('0x1a')]({'raw':_0x4661e5[_0xe30e('0x1b')]?_0x4661e5['options'][_0xe30e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4661e5['options']?_0x4661e5['options']['where']||null:null,'attributes':_0x4661e5[_0xe30e('0x1b')]?_0x4661e5[_0xe30e('0x1b')][_0xe30e('0x1d')]||null:null,'limit':_0x4661e5[_0xe30e('0x1b')]?_0x4661e5[_0xe30e('0x1b')][_0xe30e('0x1e')]||null:null,'include':_0x4661e5[_0xe30e('0x1b')]?_0x4661e5[_0xe30e('0x1b')][_0xe30e('0x1f')]?_[_0xe30e('0x20')](_0x4661e5[_0xe30e('0x1b')][_0xe30e('0x1f')],function(_0xfeea5b){return{'model':db[_0xfeea5b[_0xe30e('0x21')]],'as':_0xfeea5b['as'],'attributes':_0xfeea5b[_0xe30e('0x1d')],'include':_0xfeea5b['include']?_['map'](_0xfeea5b[_0xe30e('0x1f')],function(_0x355e93){return{'model':db[_0x355e93[_0xe30e('0x21')]],'as':_0x355e93['as'],'attributes':_0x355e93['attributes'],'include':_0x355e93[_0xe30e('0x1f')]?_['map'](_0x355e93['include'],function(_0x2cb99c){return{'model':db[_0x2cb99c[_0xe30e('0x21')]],'as':_0x2cb99c['as'],'attributes':_0x2cb99c[_0xe30e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe30e('0xd')](function(_0x5358fc){logger['info'](_0xe30e('0x19'),_0x4661e5);logger[_0xe30e('0x10')](_0xe30e('0x19'),_0x4661e5,JSON[_0xe30e('0x12')](_0x5358fc));_0x22e354(_0x5358fc);})[_0xe30e('0x18')](function(_0x2e9765){logger['error'](_0xe30e('0x19'),_0x2e9765[_0xe30e('0x15')],_0x4661e5);_0x5c5529(_0x8b8b92[_0xe30e('0x13')](0x1f4,_0x2e9765[_0xe30e('0x15')]));});});};exports[_0xe30e('0x22')]=function(_0x27a9d5){var _0x3cc9de=this;return new Promise(function(_0x5bfc72,_0x11bcf9){return db[_0xe30e('0x23')][_0xe30e('0x24')]({'raw':_0x27a9d5[_0xe30e('0x1b')]?_0x27a9d5[_0xe30e('0x1b')][_0xe30e('0x1c')]===undefined?!![]:![]:!![],'where':_0x27a9d5[_0xe30e('0x1b')]?_0x27a9d5[_0xe30e('0x1b')][_0xe30e('0x25')]||null:null,'attributes':_0x27a9d5[_0xe30e('0x1b')]?_0x27a9d5['options'][_0xe30e('0x1d')]||null:null,'include':_0x27a9d5[_0xe30e('0x1b')]?_0x27a9d5['options'][_0xe30e('0x1f')]?_[_0xe30e('0x20')](_0x27a9d5[_0xe30e('0x1b')][_0xe30e('0x1f')],function(_0xf2137){return{'model':db[_0xf2137[_0xe30e('0x21')]],'as':_0xf2137['as'],'attributes':_0xf2137[_0xe30e('0x1d')],'include':_0xf2137[_0xe30e('0x1f')]?_['map'](_0xf2137[_0xe30e('0x1f')],function(_0x2b6099){return{'model':db[_0x2b6099['model']],'as':_0x2b6099['as'],'attributes':_0x2b6099[_0xe30e('0x1d')],'include':_0x2b6099[_0xe30e('0x1f')]?_[_0xe30e('0x20')](_0x2b6099[_0xe30e('0x1f')],function(_0xd11947){return{'model':db[_0xd11947[_0xe30e('0x21')]],'as':_0xd11947['as'],'attributes':_0xd11947[_0xe30e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe30e('0xd')](function(_0x5c86e2){logger[_0xe30e('0x16')](_0xe30e('0x22'),_0x27a9d5);logger['debug'](_0xe30e('0x22'),_0x27a9d5,JSON[_0xe30e('0x12')](_0x5c86e2));_0x5bfc72(_0x5c86e2);})[_0xe30e('0x18')](function(_0x5d84de){logger[_0xe30e('0x13')](_0xe30e('0x22'),_0x5d84de[_0xe30e('0x15')],_0x27a9d5);_0x11bcf9(_0x3cc9de[_0xe30e('0x13')](0x1f4,_0x5d84de[_0xe30e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 2566022..16ff10c 100644 --- a/server/api/intServicenowConfiguration/index.js +++ b/server/api/intServicenowConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d62=['../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3d62,0x94));var _0x23d6=function(_0x449bd8,_0x4a6e01){_0x449bd8=_0x449bd8-0x0;var _0x390afc=_0x3d62[_0x449bd8];return _0x390afc;};'use strict';var multer=require(_0x23d6('0x0'));var util=require(_0x23d6('0x1'));var path=require(_0x23d6('0x2'));var timeout=require('connect-timeout');var express=require(_0x23d6('0x3'));var router=express[_0x23d6('0x4')]();var fs_extra=require(_0x23d6('0x5'));var auth=require(_0x23d6('0x6'));var interaction=require(_0x23d6('0x7'));var config=require('../../config/environment');var controller=require(_0x23d6('0x8'));router[_0x23d6('0x9')]('/',auth['isAuthenticated'](),controller[_0x23d6('0xa')]);router[_0x23d6('0x9')](_0x23d6('0xb'),auth[_0x23d6('0xc')](),controller['show']);router[_0x23d6('0x9')]('/:id/fields',auth[_0x23d6('0xc')](),controller[_0x23d6('0xd')]);router[_0x23d6('0x9')]('/:id/subjects',auth[_0x23d6('0xc')](),controller[_0x23d6('0xe')]);router[_0x23d6('0x9')](_0x23d6('0xf'),auth['isAuthenticated'](),controller[_0x23d6('0x10')]);router[_0x23d6('0x11')]('/',auth[_0x23d6('0xc')](),controller[_0x23d6('0x12')]);router['put']('/:id',auth[_0x23d6('0xc')](),controller[_0x23d6('0x13')]);router[_0x23d6('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x23d6('0x15')]=router; \ No newline at end of file +var _0x7d82=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x21cff8,_0x36cabb){var _0x27fe3e=function(_0xadc3c6){while(--_0xadc3c6){_0x21cff8['push'](_0x21cff8['shift']());}};_0x27fe3e(++_0x36cabb);}(_0x7d82,0x1f2));var _0x27d8=function(_0x175fbd,_0x40f869){_0x175fbd=_0x175fbd-0x0;var _0x49598d=_0x7d82[_0x175fbd];return _0x49598d;};'use strict';var multer=require(_0x27d8('0x0'));var util=require(_0x27d8('0x1'));var path=require(_0x27d8('0x2'));var timeout=require(_0x27d8('0x3'));var express=require(_0x27d8('0x4'));var router=express[_0x27d8('0x5')]();var fs_extra=require(_0x27d8('0x6'));var auth=require(_0x27d8('0x7'));var interaction=require(_0x27d8('0x8'));var config=require(_0x27d8('0x9'));var controller=require(_0x27d8('0xa'));router['get']('/',auth[_0x27d8('0xb')](),controller[_0x27d8('0xc')]);router[_0x27d8('0xd')](_0x27d8('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x27d8('0xd')]('/:id/fields',auth['isAuthenticated'](),controller[_0x27d8('0xf')]);router[_0x27d8('0xd')]('/:id/subjects',auth[_0x27d8('0xb')](),controller[_0x27d8('0x10')]);router[_0x27d8('0xd')](_0x27d8('0x11'),auth['isAuthenticated'](),controller[_0x27d8('0x12')]);router[_0x27d8('0x13')]('/',auth[_0x27d8('0xb')](),controller['create']);router[_0x27d8('0x14')]('/:id',auth[_0x27d8('0xb')](),controller[_0x27d8('0x15')]);router[_0x27d8('0x16')](_0x27d8('0xe'),auth['isAuthenticated'](),controller[_0x27d8('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 0ef29a1..3001c92 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf09e=['exports','STRING','sequelize'];(function(_0x33a997,_0x1da2e){var _0x4c38fc=function(_0x3a6d58){while(--_0x3a6d58){_0x33a997['push'](_0x33a997['shift']());}};_0x4c38fc(++_0x1da2e);}(_0xf09e,0x1bb));var _0xef09=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf09e[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xef09('0x0'));module[_0xef09('0x1')]={'name':{'type':Sequelize[_0xef09('0x2')]},'description':{'type':Sequelize[_0xef09('0x2')]}}; \ No newline at end of file +var _0x2562=['STRING','sequelize','exports'];(function(_0x220726,_0x1ed10c){var _0x428ecb=function(_0x5992b2){while(--_0x5992b2){_0x220726['push'](_0x220726['shift']());}};_0x428ecb(++_0x1ed10c);}(_0x2562,0xd3));var _0x2256=function(_0x42c97a,_0x45cf4b){_0x42c97a=_0x42c97a-0x0;var _0xc9365b=_0x2562[_0x42c97a];return _0xc9365b;};'use strict';var Sequelize=require(_0x2256('0x0'));module[_0x2256('0x1')]={'name':{'type':Sequelize[_0x2256('0x2')]},'description':{'type':Sequelize[_0x2256('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 3eb3561..c7bd08e 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed86=['keys','intersection','attributes','fields','length','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','ServicenowConfiguration','count','includeAll','include','catch','show','params','find','create','body','getFields','findOne','ServicenowField','order','getSubjects','hasOwnProperty','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xed86,0x1aa));var _0x6ed8=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xed86[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ed8('0x0'));var rp=require(_0x6ed8('0x1'));var moment=require(_0x6ed8('0x2'));var BPromise=require(_0x6ed8('0x3'));var Mustache=require(_0x6ed8('0x4'));var util=require(_0x6ed8('0x5'));var path=require(_0x6ed8('0x6'));var sox=require(_0x6ed8('0x7'));var csv=require(_0x6ed8('0x8'));var ejs=require(_0x6ed8('0x9'));var fs=require('fs');var fs_extra=require(_0x6ed8('0xa'));var _=require('lodash');var squel=require(_0x6ed8('0xb'));var crypto=require(_0x6ed8('0xc'));var jsforce=require(_0x6ed8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6ed8('0x8'));var querystring=require('querystring');var Papa=require(_0x6ed8('0xe'));var Redis=require('ioredis');var authService=require(_0x6ed8('0xf'));var qs=require(_0x6ed8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ed8('0x11'));var logger=require(_0x6ed8('0x12'))(_0x6ed8('0x13'));var utils=require(_0x6ed8('0x14'));var config=require(_0x6ed8('0x15'));var licenseUtil=require(_0x6ed8('0x16'));var db=require(_0x6ed8('0x17'))['db'];function respondWithStatusCode(_0x55cc71,_0x2991d4){_0x2991d4=_0x2991d4||0xcc;return function(_0x459078){if(_0x459078){return _0x55cc71[_0x6ed8('0x18')](_0x2991d4);}return _0x55cc71[_0x6ed8('0x19')](_0x2991d4)[_0x6ed8('0x1a')]();};}function respondWithResult(_0x56d849,_0x32069d){_0x32069d=_0x32069d||0xc8;return function(_0x3b9314){if(_0x3b9314){return _0x56d849['status'](_0x32069d)[_0x6ed8('0x1b')](_0x3b9314);}};}function respondWithFilteredResult(_0x5510dc,_0x41e101){return function(_0x20eaed){if(_0x20eaed){var _0x467ffa=typeof _0x41e101[_0x6ed8('0x1c')]===_0x6ed8('0x1d')&&typeof _0x41e101['limit']===_0x6ed8('0x1d');var _0x95d11=_0x20eaed['count'];var _0xdfce89=_0x467ffa?0x0:_0x41e101[_0x6ed8('0x1c')];var _0xac0446=_0x467ffa?_0x20eaed['count']:_0x41e101[_0x6ed8('0x1c')]+_0x41e101[_0x6ed8('0x1e')];var _0xfffc8a;if(_0xac0446>=_0x95d11){_0xac0446=_0x95d11;_0xfffc8a=0xc8;}else{_0xfffc8a=0xce;}_0x5510dc[_0x6ed8('0x19')](_0xfffc8a);return _0x5510dc['set'](_0x6ed8('0x1f'),_0xdfce89+'-'+_0xac0446+'/'+_0x95d11)[_0x6ed8('0x1b')](_0x20eaed);}return null;};}function patchUpdates(_0xcb1478){return function(_0x4b4ca9){try{jsonpatch[_0x6ed8('0x20')](_0x4b4ca9,_0xcb1478,!![]);}catch(_0x219817){return BPromise[_0x6ed8('0x21')](_0x219817);}return _0x4b4ca9['save']();};}function saveUpdates(_0x42f8e4,_0x5281d2){return function(_0x10c7d5){if(_0x10c7d5){return _0x10c7d5[_0x6ed8('0x22')](_0x42f8e4)[_0x6ed8('0x23')](function(_0x9d9e56){return _0x9d9e56;});}return null;};}function removeEntity(_0x30f6e7,_0x2a35ba){return function(_0x514f6f){if(_0x514f6f){return _0x514f6f[_0x6ed8('0x24')]()['then'](function(){_0x30f6e7['status'](0xcc)[_0x6ed8('0x1a')]();});}};}function handleEntityNotFound(_0x2dd2de,_0x42b757){return function(_0x192ca8){if(!_0x192ca8){_0x2dd2de[_0x6ed8('0x18')](0x194);}return _0x192ca8;};}function handleError(_0x7aac61,_0x5b3527){_0x5b3527=_0x5b3527||0x1f4;return function(_0x3f2ff6){logger[_0x6ed8('0x25')](_0x3f2ff6['stack']);if(_0x3f2ff6[_0x6ed8('0x26')]){delete _0x3f2ff6[_0x6ed8('0x26')];}_0x7aac61[_0x6ed8('0x19')](_0x5b3527)[_0x6ed8('0x27')](_0x3f2ff6);};}exports[_0x6ed8('0x28')]=function(_0x34e908,_0xc54de1){var _0x432d55={},_0x41872f={},_0x5a6d2e={'count':0x0,'rows':[]};var _0x426ac3=_[_0x6ed8('0x29')](db['ServicenowConfiguration'][_0x6ed8('0x2a')],function(_0x45237c){return{'name':_0x45237c[_0x6ed8('0x2b')],'type':_0x45237c[_0x6ed8('0x2c')][_0x6ed8('0x2d')]};});_0x41872f[_0x6ed8('0x2e')]=_[_0x6ed8('0x29')](_0x426ac3,_0x6ed8('0x26'));_0x41872f[_0x6ed8('0x2f')]=_[_0x6ed8('0x30')](_0x34e908['query']);_0x41872f['filters']=_[_0x6ed8('0x31')](_0x41872f[_0x6ed8('0x2e')],_0x41872f[_0x6ed8('0x2f')]);_0x432d55[_0x6ed8('0x32')]=_[_0x6ed8('0x31')](_0x41872f['model'],qs['fields'](_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x33')]));_0x432d55['attributes']=_0x432d55[_0x6ed8('0x32')][_0x6ed8('0x34')]?_0x432d55['attributes']:_0x41872f['model'];if(!_0x34e908[_0x6ed8('0x2f')]['hasOwnProperty'](_0x6ed8('0x35'))){_0x432d55[_0x6ed8('0x1e')]=qs[_0x6ed8('0x1e')](_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x1e')]);_0x432d55[_0x6ed8('0x1c')]=qs['offset'](_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x1c')]);}_0x432d55['order']=qs[_0x6ed8('0x36')](_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x36')]);_0x432d55['where']=qs['filters'](_[_0x6ed8('0x37')](_0x34e908[_0x6ed8('0x2f')],_0x41872f[_0x6ed8('0x38')]),_0x426ac3);if(_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x39')]){_0x432d55[_0x6ed8('0x3a')]=_[_0x6ed8('0x3b')](_0x432d55['where'],{'$or':_[_0x6ed8('0x29')](_0x426ac3,function(_0x3b2f01){if(_0x3b2f01[_0x6ed8('0x2c')]!==_0x6ed8('0x3c')){var _0x18f397={};_0x18f397[_0x3b2f01['name']]={'$like':'%'+_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x39')]+'%'};return _0x18f397;}})});}_0x432d55=_[_0x6ed8('0x3b')]({},_0x432d55,_0x34e908[_0x6ed8('0x3d')]);var _0x54803b={'where':_0x432d55[_0x6ed8('0x3a')]};return db[_0x6ed8('0x3e')][_0x6ed8('0x3f')](_0x54803b)[_0x6ed8('0x23')](function(_0x4ad74d){_0x5a6d2e[_0x6ed8('0x3f')]=_0x4ad74d;if(_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x40')]){_0x432d55[_0x6ed8('0x41')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x432d55);})[_0x6ed8('0x23')](function(_0x44d1b8){_0x5a6d2e['rows']=_0x44d1b8;return _0x5a6d2e;})['then'](respondWithFilteredResult(_0xc54de1,_0x432d55))[_0x6ed8('0x42')](handleError(_0xc54de1,null));};exports[_0x6ed8('0x43')]=function(_0x3c844d,_0x751f97){var _0x5a4922={'raw':![],'where':{'id':_0x3c844d[_0x6ed8('0x44')]['id']}},_0x1a11e6={};_0x1a11e6[_0x6ed8('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0x6ed8('0x2a')]);_0x1a11e6[_0x6ed8('0x2f')]=_['keys'](_0x3c844d[_0x6ed8('0x2f')]);_0x1a11e6[_0x6ed8('0x38')]=_[_0x6ed8('0x31')](_0x1a11e6[_0x6ed8('0x2e')],_0x1a11e6[_0x6ed8('0x2f')]);_0x5a4922[_0x6ed8('0x32')]=_[_0x6ed8('0x31')](_0x1a11e6[_0x6ed8('0x2e')],qs[_0x6ed8('0x33')](_0x3c844d[_0x6ed8('0x2f')]['fields']));_0x5a4922[_0x6ed8('0x32')]=_0x5a4922[_0x6ed8('0x32')][_0x6ed8('0x34')]?_0x5a4922['attributes']:_0x1a11e6[_0x6ed8('0x2e')];if(_0x3c844d['query'][_0x6ed8('0x40')]){_0x5a4922[_0x6ed8('0x41')]=[{'all':!![]}];}_0x5a4922=_[_0x6ed8('0x3b')]({},_0x5a4922,_0x3c844d[_0x6ed8('0x3d')]);return db[_0x6ed8('0x3e')][_0x6ed8('0x45')](_0x5a4922)[_0x6ed8('0x23')](handleEntityNotFound(_0x751f97,null))[_0x6ed8('0x23')](respondWithResult(_0x751f97,null))['catch'](handleError(_0x751f97,null));};exports[_0x6ed8('0x46')]=function(_0x55d2eb,_0x2ded90){return db[_0x6ed8('0x3e')][_0x6ed8('0x46')](_0x55d2eb[_0x6ed8('0x47')],{})[_0x6ed8('0x23')](respondWithResult(_0x2ded90,0xc9))[_0x6ed8('0x42')](handleError(_0x2ded90,null));};exports[_0x6ed8('0x22')]=function(_0x1a9b30,_0x38ce8d){if(_0x1a9b30[_0x6ed8('0x47')]['id']){delete _0x1a9b30[_0x6ed8('0x47')]['id'];}return db[_0x6ed8('0x3e')][_0x6ed8('0x45')]({'where':{'id':_0x1a9b30[_0x6ed8('0x44')]['id']}})[_0x6ed8('0x23')](handleEntityNotFound(_0x38ce8d,null))[_0x6ed8('0x23')](saveUpdates(_0x1a9b30[_0x6ed8('0x47')],null))[_0x6ed8('0x23')](respondWithResult(_0x38ce8d,null))[_0x6ed8('0x42')](handleError(_0x38ce8d,null));};exports[_0x6ed8('0x24')]=function(_0x1defe6,_0x30d5ef){return db[_0x6ed8('0x3e')][_0x6ed8('0x45')]({'where':{'id':_0x1defe6[_0x6ed8('0x44')]['id']}})[_0x6ed8('0x23')](handleEntityNotFound(_0x30d5ef,null))['then'](removeEntity(_0x30d5ef,null))[_0x6ed8('0x42')](handleError(_0x30d5ef,null));};exports[_0x6ed8('0x48')]=function(_0x3edd47,_0x4a46d1,_0xfee193){var _0x53d585={};var _0x3c0113={};var _0x16e23f;var _0x326d35;return db[_0x6ed8('0x3e')][_0x6ed8('0x49')]({'where':{'id':_0x3edd47['params']['id']}})['then'](handleEntityNotFound(_0x4a46d1,null))[_0x6ed8('0x23')](function(_0x1d6387){if(_0x1d6387){_0x16e23f=_0x1d6387;_0x3c0113[_0x6ed8('0x2e')]=_[_0x6ed8('0x30')](db[_0x6ed8('0x4a')][_0x6ed8('0x2a')]);_0x3c0113['query']=_[_0x6ed8('0x30')](_0x3edd47[_0x6ed8('0x2f')]);_0x3c0113['filters']=_[_0x6ed8('0x31')](_0x3c0113[_0x6ed8('0x2e')],_0x3c0113[_0x6ed8('0x2f')]);_0x53d585[_0x6ed8('0x32')]=_['intersection'](_0x3c0113[_0x6ed8('0x2e')],qs[_0x6ed8('0x33')](_0x3edd47[_0x6ed8('0x2f')][_0x6ed8('0x33')]));_0x53d585['attributes']=_0x53d585[_0x6ed8('0x32')][_0x6ed8('0x34')]?_0x53d585[_0x6ed8('0x32')]:_0x3c0113[_0x6ed8('0x2e')];_0x53d585[_0x6ed8('0x4b')]=qs[_0x6ed8('0x36')](_0x3edd47[_0x6ed8('0x2f')][_0x6ed8('0x36')]);_0x53d585[_0x6ed8('0x3a')]=qs[_0x6ed8('0x38')](_[_0x6ed8('0x37')](_0x3edd47[_0x6ed8('0x2f')],_0x3c0113['filters']));if(_0x3edd47['query']['filter']){_0x53d585[_0x6ed8('0x3a')]=_[_0x6ed8('0x3b')](_0x53d585[_0x6ed8('0x3a')],{'$or':_['map'](_0x53d585[_0x6ed8('0x32')],function(_0x284efb){var _0x1d74bf={};_0x1d74bf[_0x284efb]={'$like':'%'+_0x3edd47[_0x6ed8('0x2f')][_0x6ed8('0x39')]+'%'};return _0x1d74bf;})});}_0x53d585=_[_0x6ed8('0x3b')]({},_0x53d585,_0x3edd47[_0x6ed8('0x3d')]);return _0x16e23f[_0x6ed8('0x48')](_0x53d585);}})['then'](function(_0x278820){if(_0x278820){_0x326d35=_0x278820[_0x6ed8('0x34')];if(!_0x3edd47['query']['hasOwnProperty'](_0x6ed8('0x35'))){_0x53d585['limit']=qs[_0x6ed8('0x1e')](_0x3edd47['query'][_0x6ed8('0x1e')]);_0x53d585[_0x6ed8('0x1c')]=qs[_0x6ed8('0x1c')](_0x3edd47[_0x6ed8('0x2f')]['offset']);}return _0x16e23f[_0x6ed8('0x48')](_0x53d585);}})[_0x6ed8('0x23')](function(_0x499d74){if(_0x499d74){return _0x499d74?{'count':_0x326d35,'rows':_0x499d74}:null;}})[_0x6ed8('0x23')](respondWithResult(_0x4a46d1,null))['catch'](handleError(_0x4a46d1,null));};exports[_0x6ed8('0x4c')]=function(_0x1c7c4b,_0x3e31bd,_0x4ce419){var _0x44a608={};var _0x22c555={};var _0x402255;var _0x5786a4;return db['ServicenowConfiguration'][_0x6ed8('0x49')]({'where':{'id':_0x1c7c4b[_0x6ed8('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e31bd,null))[_0x6ed8('0x23')](function(_0x295e46){if(_0x295e46){_0x402255=_0x295e46;_0x22c555[_0x6ed8('0x2e')]=_[_0x6ed8('0x30')](db[_0x6ed8('0x4a')][_0x6ed8('0x2a')]);_0x22c555[_0x6ed8('0x2f')]=_[_0x6ed8('0x30')](_0x1c7c4b[_0x6ed8('0x2f')]);_0x22c555['filters']=_[_0x6ed8('0x31')](_0x22c555[_0x6ed8('0x2e')],_0x22c555[_0x6ed8('0x2f')]);_0x44a608[_0x6ed8('0x32')]=_[_0x6ed8('0x31')](_0x22c555[_0x6ed8('0x2e')],qs['fields'](_0x1c7c4b['query'][_0x6ed8('0x33')]));_0x44a608['attributes']=_0x44a608[_0x6ed8('0x32')][_0x6ed8('0x34')]?_0x44a608[_0x6ed8('0x32')]:_0x22c555[_0x6ed8('0x2e')];_0x44a608[_0x6ed8('0x4b')]=qs[_0x6ed8('0x36')](_0x1c7c4b[_0x6ed8('0x2f')][_0x6ed8('0x36')]);_0x44a608[_0x6ed8('0x3a')]=qs[_0x6ed8('0x38')](_[_0x6ed8('0x37')](_0x1c7c4b[_0x6ed8('0x2f')],_0x22c555[_0x6ed8('0x38')]));if(_0x1c7c4b[_0x6ed8('0x2f')][_0x6ed8('0x39')]){_0x44a608[_0x6ed8('0x3a')]=_[_0x6ed8('0x3b')](_0x44a608[_0x6ed8('0x3a')],{'$or':_['map'](_0x44a608[_0x6ed8('0x32')],function(_0x5aafb8){var _0xc5cfc9={};_0xc5cfc9[_0x5aafb8]={'$like':'%'+_0x1c7c4b[_0x6ed8('0x2f')][_0x6ed8('0x39')]+'%'};return _0xc5cfc9;})});}_0x44a608=_['merge']({},_0x44a608,_0x1c7c4b[_0x6ed8('0x3d')]);return _0x402255['getSubjects'](_0x44a608);}})[_0x6ed8('0x23')](function(_0x40482c){if(_0x40482c){_0x5786a4=_0x40482c[_0x6ed8('0x34')];if(!_0x1c7c4b[_0x6ed8('0x2f')][_0x6ed8('0x4d')]('nolimit')){_0x44a608['limit']=qs[_0x6ed8('0x1e')](_0x1c7c4b['query']['limit']);_0x44a608['offset']=qs[_0x6ed8('0x1c')](_0x1c7c4b[_0x6ed8('0x2f')][_0x6ed8('0x1c')]);}return _0x402255['getSubjects'](_0x44a608);}})[_0x6ed8('0x23')](function(_0x19ea05){if(_0x19ea05){return _0x19ea05?{'count':_0x5786a4,'rows':_0x19ea05}:null;}})[_0x6ed8('0x23')](respondWithResult(_0x3e31bd,null))['catch'](handleError(_0x3e31bd,null));};exports[_0x6ed8('0x4e')]=function(_0x45a465,_0x325ca4,_0x468ef0){var _0x3f85db={};var _0x176651={};var _0x1a4bd2;var _0x4bce58;return db[_0x6ed8('0x3e')]['findOne']({'where':{'id':_0x45a465[_0x6ed8('0x44')]['id']}})[_0x6ed8('0x23')](handleEntityNotFound(_0x325ca4,null))[_0x6ed8('0x23')](function(_0x5598d5){if(_0x5598d5){_0x1a4bd2=_0x5598d5;_0x176651['model']=_[_0x6ed8('0x30')](db[_0x6ed8('0x4a')][_0x6ed8('0x2a')]);_0x176651[_0x6ed8('0x2f')]=_[_0x6ed8('0x30')](_0x45a465['query']);_0x176651[_0x6ed8('0x38')]=_['intersection'](_0x176651[_0x6ed8('0x2e')],_0x176651[_0x6ed8('0x2f')]);_0x3f85db[_0x6ed8('0x32')]=_[_0x6ed8('0x31')](_0x176651['model'],qs[_0x6ed8('0x33')](_0x45a465['query']['fields']));_0x3f85db['attributes']=_0x3f85db['attributes'][_0x6ed8('0x34')]?_0x3f85db[_0x6ed8('0x32')]:_0x176651[_0x6ed8('0x2e')];_0x3f85db[_0x6ed8('0x4b')]=qs[_0x6ed8('0x36')](_0x45a465[_0x6ed8('0x2f')]['sort']);_0x3f85db[_0x6ed8('0x3a')]=qs[_0x6ed8('0x38')](_[_0x6ed8('0x37')](_0x45a465[_0x6ed8('0x2f')],_0x176651['filters']));if(_0x45a465['query']['filter']){_0x3f85db[_0x6ed8('0x3a')]=_[_0x6ed8('0x3b')](_0x3f85db['where'],{'$or':_[_0x6ed8('0x29')](_0x3f85db[_0x6ed8('0x32')],function(_0x2a1bb6){var _0x262388={};_0x262388[_0x2a1bb6]={'$like':'%'+_0x45a465[_0x6ed8('0x2f')]['filter']+'%'};return _0x262388;})});}_0x3f85db=_[_0x6ed8('0x3b')]({},_0x3f85db,_0x45a465['options']);return _0x1a4bd2[_0x6ed8('0x4e')](_0x3f85db);}})[_0x6ed8('0x23')](function(_0x47707e){if(_0x47707e){_0x4bce58=_0x47707e[_0x6ed8('0x34')];if(!_0x45a465[_0x6ed8('0x2f')][_0x6ed8('0x4d')](_0x6ed8('0x35'))){_0x3f85db[_0x6ed8('0x1e')]=qs[_0x6ed8('0x1e')](_0x45a465[_0x6ed8('0x2f')][_0x6ed8('0x1e')]);_0x3f85db[_0x6ed8('0x1c')]=qs[_0x6ed8('0x1c')](_0x45a465[_0x6ed8('0x2f')][_0x6ed8('0x1c')]);}return _0x1a4bd2[_0x6ed8('0x4e')](_0x3f85db);}})['then'](function(_0x19cbd0){if(_0x19cbd0){return _0x19cbd0?{'count':_0x4bce58,'rows':_0x19cbd0}:null;}})['then'](respondWithResult(_0x325ca4,null))[_0x6ed8('0x42')](handleError(_0x325ca4,null));}; \ No newline at end of file +var _0x1043=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','ServicenowConfiguration','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','params','keys','rawAttributes','includeAll','find','create','body','getFields','findOne','ServicenowField','length','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end'];(function(_0x393438,_0x4883a6){var _0x2a0986=function(_0x15a93b){while(--_0x15a93b){_0x393438['push'](_0x393438['shift']());}};_0x2a0986(++_0x4883a6);}(_0x1043,0x123));var _0x3104=function(_0x7dedf2,_0x5cc54b){_0x7dedf2=_0x7dedf2-0x0;var _0x25b74d=_0x1043[_0x7dedf2];return _0x25b74d;};'use strict';var emlformat=require(_0x3104('0x0'));var rimraf=require(_0x3104('0x1'));var zipdir=require(_0x3104('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3104('0x3'));var moment=require(_0x3104('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3104('0x5'));var util=require(_0x3104('0x6'));var path=require(_0x3104('0x7'));var sox=require(_0x3104('0x8'));var csv=require(_0x3104('0x9'));var ejs=require(_0x3104('0xa'));var fs=require('fs');var fs_extra=require(_0x3104('0xb'));var _=require(_0x3104('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3104('0xd'));var deskjs=require(_0x3104('0xe'));var toCsv=require(_0x3104('0x9'));var querystring=require(_0x3104('0xf'));var Papa=require(_0x3104('0x10'));var Redis=require('ioredis');var authService=require(_0x3104('0x11'));var qs=require(_0x3104('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3104('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3104('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3104('0x15'));var db=require(_0x3104('0x16'))['db'];function respondWithStatusCode(_0x330058,_0x29d870){_0x29d870=_0x29d870||0xcc;return function(_0x2eb9e0){if(_0x2eb9e0){return _0x330058['sendStatus'](_0x29d870);}return _0x330058[_0x3104('0x17')](_0x29d870)[_0x3104('0x18')]();};}function respondWithResult(_0x3eec81,_0x56c617){_0x56c617=_0x56c617||0xc8;return function(_0x440588){if(_0x440588){return _0x3eec81[_0x3104('0x17')](_0x56c617)[_0x3104('0x19')](_0x440588);}};}function respondWithFilteredResult(_0xbde577,_0x13d170){return function(_0x416216){if(_0x416216){var _0x4656ee=typeof _0x13d170[_0x3104('0x1a')]==='undefined'&&typeof _0x13d170[_0x3104('0x1b')]===_0x3104('0x1c');var _0x2dbee0=_0x416216[_0x3104('0x1d')];var _0xd5d544=_0x4656ee?0x0:_0x13d170[_0x3104('0x1a')];var _0x5daebd=_0x4656ee?_0x416216[_0x3104('0x1d')]:_0x13d170[_0x3104('0x1a')]+_0x13d170[_0x3104('0x1b')];var _0x443a26;if(_0x5daebd>=_0x2dbee0){_0x5daebd=_0x2dbee0;_0x443a26=0xc8;}else{_0x443a26=0xce;}_0xbde577[_0x3104('0x17')](_0x443a26);return _0xbde577[_0x3104('0x1e')](_0x3104('0x1f'),_0xd5d544+'-'+_0x5daebd+'/'+_0x2dbee0)[_0x3104('0x19')](_0x416216);}return null;};}function patchUpdates(_0x1081ab){return function(_0x17575f){try{jsonpatch[_0x3104('0x20')](_0x17575f,_0x1081ab,!![]);}catch(_0x433a5c){return BPromise[_0x3104('0x21')](_0x433a5c);}return _0x17575f[_0x3104('0x22')]();};}function saveUpdates(_0x1aa914,_0x1c72ad){return function(_0x3838f8){if(_0x3838f8){return _0x3838f8[_0x3104('0x23')](_0x1aa914)[_0x3104('0x24')](function(_0x71f069){return _0x71f069;});}return null;};}function removeEntity(_0x2f4240,_0x36a7ab){return function(_0x4cc96d){if(_0x4cc96d){return _0x4cc96d[_0x3104('0x25')]()[_0x3104('0x24')](function(){_0x2f4240[_0x3104('0x17')](0xcc)[_0x3104('0x18')]();});}};}function handleEntityNotFound(_0x1778ec,_0x350110){return function(_0x585a37){if(!_0x585a37){_0x1778ec[_0x3104('0x26')](0x194);}return _0x585a37;};}function handleError(_0x6efebe,_0x18132e){_0x18132e=_0x18132e||0x1f4;return function(_0x1a8846){logger[_0x3104('0x27')](_0x1a8846['stack']);if(_0x1a8846[_0x3104('0x28')]){delete _0x1a8846['name'];}_0x6efebe['status'](_0x18132e)[_0x3104('0x29')](_0x1a8846);};}exports[_0x3104('0x2a')]=function(_0x57b783,_0x15be84){var _0x454e99={},_0x105567={},_0x18d713={'count':0x0,'rows':[]};var _0x1241f9=_[_0x3104('0x2b')](db[_0x3104('0x2c')]['rawAttributes'],function(_0xe3443c){return{'name':_0xe3443c['fieldName'],'type':_0xe3443c['type'][_0x3104('0x2d')]};});_0x105567[_0x3104('0x2e')]=_['map'](_0x1241f9,_0x3104('0x28'));_0x105567[_0x3104('0x2f')]=_['keys'](_0x57b783[_0x3104('0x2f')]);_0x105567[_0x3104('0x30')]=_[_0x3104('0x31')](_0x105567[_0x3104('0x2e')],_0x105567[_0x3104('0x2f')]);_0x454e99['attributes']=_[_0x3104('0x31')](_0x105567[_0x3104('0x2e')],qs['fields'](_0x57b783['query'][_0x3104('0x32')]));_0x454e99[_0x3104('0x33')]=_0x454e99['attributes']['length']?_0x454e99[_0x3104('0x33')]:_0x105567[_0x3104('0x2e')];if(!_0x57b783[_0x3104('0x2f')][_0x3104('0x34')](_0x3104('0x35'))){_0x454e99['limit']=qs[_0x3104('0x1b')](_0x57b783[_0x3104('0x2f')]['limit']);_0x454e99['offset']=qs[_0x3104('0x1a')](_0x57b783[_0x3104('0x2f')]['offset']);}_0x454e99[_0x3104('0x36')]=qs[_0x3104('0x37')](_0x57b783[_0x3104('0x2f')][_0x3104('0x37')]);_0x454e99[_0x3104('0x38')]=qs[_0x3104('0x30')](_[_0x3104('0x39')](_0x57b783[_0x3104('0x2f')],_0x105567[_0x3104('0x30')]),_0x1241f9);if(_0x57b783[_0x3104('0x2f')][_0x3104('0x3a')]){_0x454e99[_0x3104('0x38')]=_[_0x3104('0x3b')](_0x454e99[_0x3104('0x38')],{'$or':_[_0x3104('0x2b')](_0x1241f9,function(_0x3673cf){if(_0x3673cf[_0x3104('0x3c')]!==_0x3104('0x3d')){var _0x449c6f={};_0x449c6f[_0x3673cf['name']]={'$like':'%'+_0x57b783[_0x3104('0x2f')]['filter']+'%'};return _0x449c6f;}})});}_0x454e99=_[_0x3104('0x3b')]({},_0x454e99,_0x57b783[_0x3104('0x3e')]);var _0x4b8d38={'where':_0x454e99['where']};return db['ServicenowConfiguration'][_0x3104('0x1d')](_0x4b8d38)[_0x3104('0x24')](function(_0x412784){_0x18d713[_0x3104('0x1d')]=_0x412784;if(_0x57b783[_0x3104('0x2f')]['includeAll']){_0x454e99[_0x3104('0x3f')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x3104('0x40')](_0x454e99);})['then'](function(_0xbdfe9f){_0x18d713['rows']=_0xbdfe9f;return _0x18d713;})['then'](respondWithFilteredResult(_0x15be84,_0x454e99))[_0x3104('0x41')](handleError(_0x15be84,null));};exports['show']=function(_0x20eb1c,_0x115f72){var _0x3fce53={'raw':![],'where':{'id':_0x20eb1c[_0x3104('0x42')]['id']}},_0x180063={};_0x180063[_0x3104('0x2e')]=_[_0x3104('0x43')](db[_0x3104('0x2c')][_0x3104('0x44')]);_0x180063[_0x3104('0x2f')]=_[_0x3104('0x43')](_0x20eb1c[_0x3104('0x2f')]);_0x180063[_0x3104('0x30')]=_[_0x3104('0x31')](_0x180063['model'],_0x180063[_0x3104('0x2f')]);_0x3fce53[_0x3104('0x33')]=_[_0x3104('0x31')](_0x180063[_0x3104('0x2e')],qs[_0x3104('0x32')](_0x20eb1c[_0x3104('0x2f')][_0x3104('0x32')]));_0x3fce53['attributes']=_0x3fce53[_0x3104('0x33')]['length']?_0x3fce53[_0x3104('0x33')]:_0x180063[_0x3104('0x2e')];if(_0x20eb1c[_0x3104('0x2f')][_0x3104('0x45')]){_0x3fce53[_0x3104('0x3f')]=[{'all':!![]}];}_0x3fce53=_[_0x3104('0x3b')]({},_0x3fce53,_0x20eb1c[_0x3104('0x3e')]);return db[_0x3104('0x2c')][_0x3104('0x46')](_0x3fce53)[_0x3104('0x24')](handleEntityNotFound(_0x115f72,null))[_0x3104('0x24')](respondWithResult(_0x115f72,null))[_0x3104('0x41')](handleError(_0x115f72,null));};exports[_0x3104('0x47')]=function(_0x1eed77,_0x33ca6a){return db['ServicenowConfiguration'][_0x3104('0x47')](_0x1eed77[_0x3104('0x48')],{})[_0x3104('0x24')](respondWithResult(_0x33ca6a,0xc9))[_0x3104('0x41')](handleError(_0x33ca6a,null));};exports[_0x3104('0x23')]=function(_0x507e46,_0x365ae3){if(_0x507e46['body']['id']){delete _0x507e46[_0x3104('0x48')]['id'];}return db[_0x3104('0x2c')]['find']({'where':{'id':_0x507e46['params']['id']}})['then'](handleEntityNotFound(_0x365ae3,null))[_0x3104('0x24')](saveUpdates(_0x507e46[_0x3104('0x48')],null))[_0x3104('0x24')](respondWithResult(_0x365ae3,null))['catch'](handleError(_0x365ae3,null));};exports[_0x3104('0x25')]=function(_0x1fafe4,_0x3a3487){return db[_0x3104('0x2c')][_0x3104('0x46')]({'where':{'id':_0x1fafe4[_0x3104('0x42')]['id']}})[_0x3104('0x24')](handleEntityNotFound(_0x3a3487,null))[_0x3104('0x24')](removeEntity(_0x3a3487,null))[_0x3104('0x41')](handleError(_0x3a3487,null));};exports[_0x3104('0x49')]=function(_0x304cdb,_0x5f313f,_0x2129a8){var _0x49fe23={};var _0x1f9aba={};var _0x139da9;var _0x4f4b9e;return db[_0x3104('0x2c')][_0x3104('0x4a')]({'where':{'id':_0x304cdb['params']['id']}})[_0x3104('0x24')](handleEntityNotFound(_0x5f313f,null))[_0x3104('0x24')](function(_0x596c1c){if(_0x596c1c){_0x139da9=_0x596c1c;_0x1f9aba[_0x3104('0x2e')]=_[_0x3104('0x43')](db[_0x3104('0x4b')][_0x3104('0x44')]);_0x1f9aba[_0x3104('0x2f')]=_['keys'](_0x304cdb['query']);_0x1f9aba['filters']=_[_0x3104('0x31')](_0x1f9aba[_0x3104('0x2e')],_0x1f9aba[_0x3104('0x2f')]);_0x49fe23['attributes']=_[_0x3104('0x31')](_0x1f9aba[_0x3104('0x2e')],qs['fields'](_0x304cdb[_0x3104('0x2f')][_0x3104('0x32')]));_0x49fe23['attributes']=_0x49fe23['attributes'][_0x3104('0x4c')]?_0x49fe23[_0x3104('0x33')]:_0x1f9aba[_0x3104('0x2e')];_0x49fe23[_0x3104('0x36')]=qs[_0x3104('0x37')](_0x304cdb[_0x3104('0x2f')][_0x3104('0x37')]);_0x49fe23[_0x3104('0x38')]=qs[_0x3104('0x30')](_[_0x3104('0x39')](_0x304cdb[_0x3104('0x2f')],_0x1f9aba[_0x3104('0x30')]));if(_0x304cdb[_0x3104('0x2f')][_0x3104('0x3a')]){_0x49fe23['where']=_[_0x3104('0x3b')](_0x49fe23[_0x3104('0x38')],{'$or':_[_0x3104('0x2b')](_0x49fe23['attributes'],function(_0x4e6271){var _0x386721={};_0x386721[_0x4e6271]={'$like':'%'+_0x304cdb[_0x3104('0x2f')]['filter']+'%'};return _0x386721;})});}_0x49fe23=_[_0x3104('0x3b')]({},_0x49fe23,_0x304cdb[_0x3104('0x3e')]);return _0x139da9['getFields'](_0x49fe23);}})['then'](function(_0x554cd1){if(_0x554cd1){_0x4f4b9e=_0x554cd1[_0x3104('0x4c')];if(!_0x304cdb[_0x3104('0x2f')][_0x3104('0x34')](_0x3104('0x35'))){_0x49fe23['limit']=qs['limit'](_0x304cdb[_0x3104('0x2f')][_0x3104('0x1b')]);_0x49fe23[_0x3104('0x1a')]=qs['offset'](_0x304cdb[_0x3104('0x2f')][_0x3104('0x1a')]);}return _0x139da9[_0x3104('0x49')](_0x49fe23);}})[_0x3104('0x24')](function(_0x45931b){if(_0x45931b){return _0x45931b?{'count':_0x4f4b9e,'rows':_0x45931b}:null;}})[_0x3104('0x24')](respondWithResult(_0x5f313f,null))[_0x3104('0x41')](handleError(_0x5f313f,null));};exports[_0x3104('0x4d')]=function(_0x28d6ef,_0x38a39d,_0x5d9fe9){var _0x25c7e6={};var _0x216cf7={};var _0x3e8993;var _0x5cc532;return db['ServicenowConfiguration'][_0x3104('0x4a')]({'where':{'id':_0x28d6ef[_0x3104('0x42')]['id']}})[_0x3104('0x24')](handleEntityNotFound(_0x38a39d,null))[_0x3104('0x24')](function(_0x48dea9){if(_0x48dea9){_0x3e8993=_0x48dea9;_0x216cf7[_0x3104('0x2e')]=_[_0x3104('0x43')](db['ServicenowField'][_0x3104('0x44')]);_0x216cf7[_0x3104('0x2f')]=_[_0x3104('0x43')](_0x28d6ef[_0x3104('0x2f')]);_0x216cf7[_0x3104('0x30')]=_[_0x3104('0x31')](_0x216cf7[_0x3104('0x2e')],_0x216cf7['query']);_0x25c7e6[_0x3104('0x33')]=_[_0x3104('0x31')](_0x216cf7[_0x3104('0x2e')],qs[_0x3104('0x32')](_0x28d6ef[_0x3104('0x2f')][_0x3104('0x32')]));_0x25c7e6[_0x3104('0x33')]=_0x25c7e6[_0x3104('0x33')][_0x3104('0x4c')]?_0x25c7e6[_0x3104('0x33')]:_0x216cf7[_0x3104('0x2e')];_0x25c7e6[_0x3104('0x36')]=qs['sort'](_0x28d6ef[_0x3104('0x2f')][_0x3104('0x37')]);_0x25c7e6[_0x3104('0x38')]=qs[_0x3104('0x30')](_['pick'](_0x28d6ef['query'],_0x216cf7[_0x3104('0x30')]));if(_0x28d6ef[_0x3104('0x2f')][_0x3104('0x3a')]){_0x25c7e6[_0x3104('0x38')]=_[_0x3104('0x3b')](_0x25c7e6[_0x3104('0x38')],{'$or':_[_0x3104('0x2b')](_0x25c7e6[_0x3104('0x33')],function(_0x32c586){var _0x5ef28a={};_0x5ef28a[_0x32c586]={'$like':'%'+_0x28d6ef['query']['filter']+'%'};return _0x5ef28a;})});}_0x25c7e6=_[_0x3104('0x3b')]({},_0x25c7e6,_0x28d6ef[_0x3104('0x3e')]);return _0x3e8993['getSubjects'](_0x25c7e6);}})[_0x3104('0x24')](function(_0xcc5881){if(_0xcc5881){_0x5cc532=_0xcc5881['length'];if(!_0x28d6ef['query'][_0x3104('0x34')]('nolimit')){_0x25c7e6['limit']=qs[_0x3104('0x1b')](_0x28d6ef[_0x3104('0x2f')][_0x3104('0x1b')]);_0x25c7e6[_0x3104('0x1a')]=qs['offset'](_0x28d6ef[_0x3104('0x2f')][_0x3104('0x1a')]);}return _0x3e8993[_0x3104('0x4d')](_0x25c7e6);}})[_0x3104('0x24')](function(_0x32614c){if(_0x32614c){return _0x32614c?{'count':_0x5cc532,'rows':_0x32614c}:null;}})[_0x3104('0x24')](respondWithResult(_0x38a39d,null))['catch'](handleError(_0x38a39d,null));};exports[_0x3104('0x4e')]=function(_0x5b4832,_0x4266ff,_0x29e5bb){var _0x3c7379={};var _0x9df9e={};var _0x4fbec0;var _0x2a4905;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x5b4832[_0x3104('0x42')]['id']}})['then'](handleEntityNotFound(_0x4266ff,null))[_0x3104('0x24')](function(_0x68bbe1){if(_0x68bbe1){_0x4fbec0=_0x68bbe1;_0x9df9e[_0x3104('0x2e')]=_[_0x3104('0x43')](db[_0x3104('0x4b')]['rawAttributes']);_0x9df9e['query']=_[_0x3104('0x43')](_0x5b4832['query']);_0x9df9e[_0x3104('0x30')]=_[_0x3104('0x31')](_0x9df9e[_0x3104('0x2e')],_0x9df9e['query']);_0x3c7379[_0x3104('0x33')]=_[_0x3104('0x31')](_0x9df9e['model'],qs[_0x3104('0x32')](_0x5b4832[_0x3104('0x2f')][_0x3104('0x32')]));_0x3c7379[_0x3104('0x33')]=_0x3c7379[_0x3104('0x33')][_0x3104('0x4c')]?_0x3c7379[_0x3104('0x33')]:_0x9df9e['model'];_0x3c7379[_0x3104('0x36')]=qs[_0x3104('0x37')](_0x5b4832['query'][_0x3104('0x37')]);_0x3c7379[_0x3104('0x38')]=qs[_0x3104('0x30')](_['pick'](_0x5b4832[_0x3104('0x2f')],_0x9df9e['filters']));if(_0x5b4832['query']['filter']){_0x3c7379['where']=_[_0x3104('0x3b')](_0x3c7379[_0x3104('0x38')],{'$or':_['map'](_0x3c7379[_0x3104('0x33')],function(_0x359569){var _0x2b97fe={};_0x2b97fe[_0x359569]={'$like':'%'+_0x5b4832['query'][_0x3104('0x3a')]+'%'};return _0x2b97fe;})});}_0x3c7379=_[_0x3104('0x3b')]({},_0x3c7379,_0x5b4832[_0x3104('0x3e')]);return _0x4fbec0[_0x3104('0x4e')](_0x3c7379);}})[_0x3104('0x24')](function(_0x2f3c66){if(_0x2f3c66){_0x2a4905=_0x2f3c66[_0x3104('0x4c')];if(!_0x5b4832['query'][_0x3104('0x34')](_0x3104('0x35'))){_0x3c7379[_0x3104('0x1b')]=qs['limit'](_0x5b4832[_0x3104('0x2f')][_0x3104('0x1b')]);_0x3c7379['offset']=qs[_0x3104('0x1a')](_0x5b4832[_0x3104('0x2f')][_0x3104('0x1a')]);}return _0x4fbec0['getDescriptions'](_0x3c7379);}})[_0x3104('0x24')](function(_0x48990d){if(_0x48990d){return _0x48990d?{'count':_0x2a4905,'rows':_0x48990d}:null;}})['then'](respondWithResult(_0x4266ff,null))[_0x3104('0x41')](handleError(_0x4266ff,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 88e5399..d2e9072 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4f4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x5cd5a6,_0x884cf1){_0x5cd5a6=_0x5cd5a6-0x0;var _0x1e5ab8=_0xd4f4[_0x5cd5a6];return _0x1e5ab8;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var logger=require(_0x4d4f('0x2'))(_0x4d4f('0x3'));var moment=require(_0x4d4f('0x4'));var BPromise=require(_0x4d4f('0x5'));var rp=require(_0x4d4f('0x6'));var fs=require('fs');var path=require(_0x4d4f('0x7'));var rimraf=require(_0x4d4f('0x8'));var config=require(_0x4d4f('0x9'));var attributes=require(_0x4d4f('0xa'));module['exports']=function(_0x5f451b,_0x5e38d2){return _0x5f451b[_0x4d4f('0xb')](_0x4d4f('0xc'),attributes,{'tableName':_0x4d4f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa4d=['int_servicenow_configurations','lodash','util','api','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0x5168ac,_0x36128f){var _0x8a82e=function(_0xd20ed2){while(--_0xd20ed2){_0x5168ac['push'](_0x5168ac['shift']());}};_0x8a82e(++_0x36128f);}(_0xfa4d,0x90));var _0xdfa4=function(_0x994cde,_0x3558f5){_0x994cde=_0x994cde-0x0;var _0x1015e8=_0xfa4d[_0x994cde];return _0x1015e8;};'use strict';var _=require(_0xdfa4('0x0'));var util=require(_0xdfa4('0x1'));var logger=require('../../config/logger')(_0xdfa4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfa4('0x3'));var rimraf=require(_0xdfa4('0x4'));var config=require(_0xdfa4('0x5'));var attributes=require(_0xdfa4('0x6'));module[_0xdfa4('0x7')]=function(_0x383a02,_0x3e1c11){return _0x383a02[_0xdfa4('0x8')](_0xdfa4('0x9'),attributes,{'tableName':_0xdfa4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 836ae3a..054eeb1 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c59=['util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash'];(function(_0x288060,_0x14c878){var _0x9caf4f=function(_0x56b3a5){while(--_0x56b3a5){_0x288060['push'](_0x288060['shift']());}};_0x9caf4f(++_0x14c878);}(_0x1c59,0x18e));var _0x91c5=function(_0x521fc2,_0x185e7f){_0x521fc2=_0x521fc2-0x0;var _0x520006=_0x1c59[_0x521fc2];return _0x520006;};'use strict';var _=require(_0x91c5('0x0'));var util=require(_0x91c5('0x1'));var moment=require(_0x91c5('0x2'));var BPromise=require(_0x91c5('0x3'));var rs=require(_0x91c5('0x4'));var fs=require('fs');var Redis=require(_0x91c5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91c5('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x91c5('0x7'));var client=jayson['client'][_0x91c5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a9b48,_0x49f7f8,_0x580c32){return new BPromise(function(_0x1754b5,_0x1660a4){return client[_0x91c5('0x9')](_0x3a9b48,_0x580c32)['then'](function(_0x3ee905){logger[_0x91c5('0xa')](_0x91c5('0xb'),_0x49f7f8,_0x91c5('0xc'));logger[_0x91c5('0xd')](_0x91c5('0xe'),_0x49f7f8,'request\x20sent',JSON[_0x91c5('0xf')](_0x3ee905));if(_0x3ee905['error']){if(_0x3ee905['error'][_0x91c5('0x10')]===0x1f4){logger[_0x91c5('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49f7f8,_0x3ee905[_0x91c5('0x11')]['message']);return _0x1660a4(_0x3ee905[_0x91c5('0x11')][_0x91c5('0x12')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x49f7f8,_0x3ee905[_0x91c5('0x11')][_0x91c5('0x12')]);return _0x1754b5(_0x3ee905[_0x91c5('0x11')][_0x91c5('0x12')]);}else{logger['info'](_0x91c5('0xb'),_0x49f7f8,_0x91c5('0xc'));_0x1754b5(_0x3ee905[_0x91c5('0x13')][_0x91c5('0x12')]);}})[_0x91c5('0x14')](function(_0x5d7a45){logger[_0x91c5('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49f7f8,_0x5d7a45);_0x1660a4(_0x5d7a45);});});} \ No newline at end of file +var _0x5fa1=['request','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x5fa1,0xd2));var _0x15fa=function(_0x38178c,_0x2891e6){_0x38178c=_0x38178c-0x0;var _0x2fecd2=_0x5fa1[_0x38178c];return _0x2fecd2;};'use strict';var _=require(_0x15fa('0x0'));var util=require(_0x15fa('0x1'));var moment=require('moment');var BPromise=require(_0x15fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15fa('0x3'));var db=require(_0x15fa('0x4'))['db'];var utils=require(_0x15fa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x15fa('0x6'));var jayson=require(_0x15fa('0x7'));var client=jayson[_0x15fa('0x8')][_0x15fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eba46,_0x251f6d,_0x38fd8d){return new BPromise(function(_0x3de7f3,_0x557013){return client[_0x15fa('0xa')](_0x5eba46,_0x38fd8d)[_0x15fa('0xb')](function(_0x4a081e){logger[_0x15fa('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x251f6d,'request\x20sent');logger[_0x15fa('0xd')](_0x15fa('0xe'),_0x251f6d,_0x15fa('0xf'),JSON[_0x15fa('0x10')](_0x4a081e));if(_0x4a081e[_0x15fa('0x11')]){if(_0x4a081e[_0x15fa('0x11')][_0x15fa('0x12')]===0x1f4){logger['error'](_0x15fa('0x13'),_0x251f6d,_0x4a081e['error']['message']);return _0x557013(_0x4a081e[_0x15fa('0x11')][_0x15fa('0x14')]);}logger[_0x15fa('0x11')](_0x15fa('0x13'),_0x251f6d,_0x4a081e['error']['message']);return _0x3de7f3(_0x4a081e[_0x15fa('0x11')][_0x15fa('0x14')]);}else{logger[_0x15fa('0xc')](_0x15fa('0x13'),_0x251f6d,'request\x20sent');_0x3de7f3(_0x4a081e['result'][_0x15fa('0x14')]);}})[_0x15fa('0x15')](function(_0x444a73){logger['error'](_0x15fa('0x13'),_0x251f6d,_0x444a73);_0x557013(_0x444a73);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index cc48ac7..b9ce34a 100644 --- a/server/api/intServicenowField/index.js +++ b/server/api/intServicenowField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57fd=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','put','/:id','update'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x57fd,0x132));var _0xd57f=function(_0x1c674c,_0xc28da0){_0x1c674c=_0x1c674c-0x0;var _0x49605e=_0x57fd[_0x1c674c];return _0x49605e;};'use strict';var multer=require(_0xd57f('0x0'));var util=require(_0xd57f('0x1'));var path=require(_0xd57f('0x2'));var timeout=require(_0xd57f('0x3'));var express=require(_0xd57f('0x4'));var router=express['Router']();var fs_extra=require(_0xd57f('0x5'));var auth=require(_0xd57f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd57f('0x7'));var controller=require(_0xd57f('0x8'));router[_0xd57f('0x9')]('/',auth[_0xd57f('0xa')](),controller[_0xd57f('0xb')]);router[_0xd57f('0x9')]('/:id',auth[_0xd57f('0xa')](),controller[_0xd57f('0xc')]);router[_0xd57f('0xd')]('/',auth[_0xd57f('0xa')](),controller['create']);router[_0xd57f('0xe')](_0xd57f('0xf'),auth[_0xd57f('0xa')](),controller[_0xd57f('0x10')]);router[_0xd57f('0x11')]('/:id',auth[_0xd57f('0xa')](),controller[_0xd57f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x501d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','delete','destroy'];(function(_0x127a79,_0x5a272f){var _0x2f3517=function(_0x531f31){while(--_0x531f31){_0x127a79['push'](_0x127a79['shift']());}};_0x2f3517(++_0x5a272f);}(_0x501d,0x169));var _0xd501=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x501d[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xd501('0x0'));var util=require(_0xd501('0x1'));var path=require(_0xd501('0x2'));var timeout=require(_0xd501('0x3'));var express=require(_0xd501('0x4'));var router=express[_0xd501('0x5')]();var fs_extra=require(_0xd501('0x6'));var auth=require(_0xd501('0x7'));var interaction=require(_0xd501('0x8'));var config=require(_0xd501('0x9'));var controller=require('./intServicenowField.controller');router[_0xd501('0xa')]('/',auth['isAuthenticated'](),controller[_0xd501('0xb')]);router[_0xd501('0xa')](_0xd501('0xc'),auth[_0xd501('0xd')](),controller['show']);router[_0xd501('0xe')]('/',auth[_0xd501('0xd')](),controller[_0xd501('0xf')]);router[_0xd501('0x10')](_0xd501('0xc'),auth[_0xd501('0xd')](),controller['update']);router[_0xd501('0x11')]('/:id',auth[_0xd501('0xd')](),controller[_0xd501('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 2a2c865..2461194 100644 --- a/server/api/intServicenowField/intServicenowField.attributes.js +++ b/server/api/intServicenowField/intServicenowField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b46=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x5b5af1,_0x1db01b){var _0x45ab7b=function(_0x1e353a){while(--_0x1e353a){_0x5b5af1['push'](_0x5b5af1['shift']());}};_0x45ab7b(++_0x1db01b);}(_0x1b46,0x18f));var _0x61b4=function(_0x4cb21c,_0x1e0d7a){_0x4cb21c=_0x4cb21c-0x0;var _0x5c1d5c=_0x1b46[_0x4cb21c];return _0x5c1d5c;};'use strict';var Sequelize=require(_0x61b4('0x0'));module[_0x61b4('0x1')]={'type':{'type':Sequelize[_0x61b4('0x2')](_0x61b4('0x3'),_0x61b4('0x4'),_0x61b4('0x5'),_0x61b4('0x6'),_0x61b4('0x7')),'defaultValue':_0x61b4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x61b4('0x8')]},'keyType':{'type':Sequelize[_0x61b4('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x61b4('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x61b4('0x8')]},'customField':{'type':Sequelize[_0x61b4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x61b4('0x8')]}}; \ No newline at end of file +var _0x8a69=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x2a67ed,_0x71e1f5){var _0x2c21a5=function(_0x4d4d9d){while(--_0x4d4d9d){_0x2a67ed['push'](_0x2a67ed['shift']());}};_0x2c21a5(++_0x71e1f5);}(_0x8a69,0x1a7));var _0x98a6=function(_0x38ff23,_0x17e735){_0x38ff23=_0x38ff23-0x0;var _0x19bbcf=_0x8a69[_0x38ff23];return _0x19bbcf;};'use strict';var Sequelize=require(_0x98a6('0x0'));module[_0x98a6('0x1')]={'type':{'type':Sequelize[_0x98a6('0x2')](_0x98a6('0x3'),_0x98a6('0x4'),_0x98a6('0x5'),_0x98a6('0x6'),_0x98a6('0x7')),'defaultValue':_0x98a6('0x3')},'content':{'type':Sequelize[_0x98a6('0x8')]},'key':{'type':Sequelize[_0x98a6('0x8')]},'keyType':{'type':Sequelize[_0x98a6('0x2')](_0x98a6('0x3'),'variable',_0x98a6('0x5'))},'keyContent':{'type':Sequelize[_0x98a6('0x8')]},'idField':{'type':Sequelize[_0x98a6('0x8')]},'nameField':{'type':Sequelize[_0x98a6('0x8')]},'customField':{'type':Sequelize[_0x98a6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x98a6('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index ca8b34f..3cd5f98 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x200c=['end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','error','name','send','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','ServicenowField','findAll','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x358004,_0x26f5eb){var _0xea3c83=function(_0x3f2a3f){while(--_0x3f2a3f){_0x358004['push'](_0x358004['shift']());}};_0xea3c83(++_0x26f5eb);}(_0x200c,0xc3));var _0xc200=function(_0x5e455d,_0xadce9){_0x5e455d=_0x5e455d-0x0;var _0xe01a15=_0x200c[_0x5e455d];return _0xe01a15;};'use strict';var emlformat=require(_0xc200('0x0'));var rimraf=require(_0xc200('0x1'));var zipdir=require(_0xc200('0x2'));var jsonpatch=require(_0xc200('0x3'));var rp=require(_0xc200('0x4'));var moment=require(_0xc200('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc200('0x6'));var util=require(_0xc200('0x7'));var path=require('path');var sox=require(_0xc200('0x8'));var csv=require('to-csv');var ejs=require(_0xc200('0x9'));var fs=require('fs');var fs_extra=require(_0xc200('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc200('0xb'));var jsforce=require(_0xc200('0xc'));var deskjs=require(_0xc200('0xd'));var toCsv=require(_0xc200('0xe'));var querystring=require(_0xc200('0xf'));var Papa=require(_0xc200('0x10'));var Redis=require(_0xc200('0x11'));var authService=require(_0xc200('0x12'));var qs=require(_0xc200('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc200('0x14'));var logger=require(_0xc200('0x15'))(_0xc200('0x16'));var utils=require('../../config/utils');var config=require(_0xc200('0x17'));var licenseUtil=require(_0xc200('0x18'));var db=require(_0xc200('0x19'))['db'];function respondWithStatusCode(_0x9a7384,_0x47a2ff){_0x47a2ff=_0x47a2ff||0xcc;return function(_0x10d636){if(_0x10d636){return _0x9a7384[_0xc200('0x1a')](_0x47a2ff);}return _0x9a7384['status'](_0x47a2ff)[_0xc200('0x1b')]();};}function respondWithResult(_0x3eb722,_0x150f32){_0x150f32=_0x150f32||0xc8;return function(_0xba4f72){if(_0xba4f72){return _0x3eb722[_0xc200('0x1c')](_0x150f32)[_0xc200('0x1d')](_0xba4f72);}};}function respondWithFilteredResult(_0x54b864,_0xf7f8a6){return function(_0x3e9765){if(_0x3e9765){var _0x50e567=typeof _0xf7f8a6['offset']===_0xc200('0x1e')&&typeof _0xf7f8a6[_0xc200('0x1f')]===_0xc200('0x1e');var _0x5d1aa7=_0x3e9765['count'];var _0x568342=_0x50e567?0x0:_0xf7f8a6[_0xc200('0x20')];var _0x17f060=_0x50e567?_0x3e9765[_0xc200('0x21')]:_0xf7f8a6[_0xc200('0x20')]+_0xf7f8a6[_0xc200('0x1f')];var _0x9622c7;if(_0x17f060>=_0x5d1aa7){_0x17f060=_0x5d1aa7;_0x9622c7=0xc8;}else{_0x9622c7=0xce;}_0x54b864[_0xc200('0x1c')](_0x9622c7);return _0x54b864[_0xc200('0x22')](_0xc200('0x23'),_0x568342+'-'+_0x17f060+'/'+_0x5d1aa7)[_0xc200('0x1d')](_0x3e9765);}return null;};}function patchUpdates(_0x78c4e1){return function(_0x32c286){try{jsonpatch[_0xc200('0x24')](_0x32c286,_0x78c4e1,!![]);}catch(_0x5b309a){return BPromise['reject'](_0x5b309a);}return _0x32c286[_0xc200('0x25')]();};}function saveUpdates(_0x323078,_0x6f6dea){return function(_0x358a68){if(_0x358a68){return _0x358a68['update'](_0x323078)[_0xc200('0x26')](function(_0x35a37c){return _0x35a37c;});}return null;};}function removeEntity(_0x3aca38,_0x2047c5){return function(_0x12c4e8){if(_0x12c4e8){return _0x12c4e8[_0xc200('0x27')]()['then'](function(){_0x3aca38[_0xc200('0x1c')](0xcc)[_0xc200('0x1b')]();});}};}function handleEntityNotFound(_0x2084e2,_0x482a12){return function(_0x102f28){if(!_0x102f28){_0x2084e2[_0xc200('0x1a')](0x194);}return _0x102f28;};}function handleError(_0x5ad2d2,_0x1807be){_0x1807be=_0x1807be||0x1f4;return function(_0x4ec80d){logger[_0xc200('0x28')](_0x4ec80d['stack']);if(_0x4ec80d[_0xc200('0x29')]){delete _0x4ec80d[_0xc200('0x29')];}_0x5ad2d2[_0xc200('0x1c')](_0x1807be)[_0xc200('0x2a')](_0x4ec80d);};}exports['index']=function(_0x4e7268,_0x2d15e0){var _0x456a50={},_0xf8e46f={},_0x245906={'count':0x0,'rows':[]};var _0x5931ac=_['map'](db['ServicenowField'][_0xc200('0x2b')],function(_0x234ba1){return{'name':_0x234ba1['fieldName'],'type':_0x234ba1[_0xc200('0x2c')][_0xc200('0x2d')]};});_0xf8e46f[_0xc200('0x2e')]=_['map'](_0x5931ac,_0xc200('0x29'));_0xf8e46f[_0xc200('0x2f')]=_['keys'](_0x4e7268[_0xc200('0x2f')]);_0xf8e46f['filters']=_[_0xc200('0x30')](_0xf8e46f[_0xc200('0x2e')],_0xf8e46f[_0xc200('0x2f')]);_0x456a50[_0xc200('0x31')]=_[_0xc200('0x30')](_0xf8e46f['model'],qs[_0xc200('0x32')](_0x4e7268[_0xc200('0x2f')][_0xc200('0x32')]));_0x456a50['attributes']=_0x456a50[_0xc200('0x31')][_0xc200('0x33')]?_0x456a50['attributes']:_0xf8e46f[_0xc200('0x2e')];if(!_0x4e7268[_0xc200('0x2f')]['hasOwnProperty'](_0xc200('0x34'))){_0x456a50['limit']=qs['limit'](_0x4e7268[_0xc200('0x2f')][_0xc200('0x1f')]);_0x456a50[_0xc200('0x20')]=qs['offset'](_0x4e7268[_0xc200('0x2f')][_0xc200('0x20')]);}_0x456a50['order']=qs[_0xc200('0x35')](_0x4e7268[_0xc200('0x2f')]['sort']);_0x456a50[_0xc200('0x36')]=qs[_0xc200('0x37')](_[_0xc200('0x38')](_0x4e7268[_0xc200('0x2f')],_0xf8e46f[_0xc200('0x37')]),_0x5931ac);if(_0x4e7268['query'][_0xc200('0x39')]){_0x456a50[_0xc200('0x36')]=_[_0xc200('0x3a')](_0x456a50[_0xc200('0x36')],{'$or':_[_0xc200('0x3b')](_0x5931ac,function(_0x26e3ad){if(_0x26e3ad[_0xc200('0x2c')]!==_0xc200('0x3c')){var _0x2f6f6c={};_0x2f6f6c[_0x26e3ad[_0xc200('0x29')]]={'$like':'%'+_0x4e7268[_0xc200('0x2f')][_0xc200('0x39')]+'%'};return _0x2f6f6c;}})});}_0x456a50=_[_0xc200('0x3a')]({},_0x456a50,_0x4e7268[_0xc200('0x3d')]);var _0x100c24={'where':_0x456a50[_0xc200('0x36')]};return db['ServicenowField'][_0xc200('0x21')](_0x100c24)['then'](function(_0x4cba43){_0x245906[_0xc200('0x21')]=_0x4cba43;if(_0x4e7268[_0xc200('0x2f')][_0xc200('0x3e')]){_0x456a50[_0xc200('0x3f')]=[{'all':!![]}];}return db[_0xc200('0x40')][_0xc200('0x41')](_0x456a50);})[_0xc200('0x26')](function(_0x213451){_0x245906[_0xc200('0x42')]=_0x213451;return _0x245906;})[_0xc200('0x26')](respondWithFilteredResult(_0x2d15e0,_0x456a50))[_0xc200('0x43')](handleError(_0x2d15e0,null));};exports[_0xc200('0x44')]=function(_0x41c005,_0x3ab4e4){var _0x5b1248={'raw':!![],'where':{'id':_0x41c005['params']['id']}},_0x13fed0={};_0x13fed0[_0xc200('0x2e')]=_[_0xc200('0x45')](db['ServicenowField'][_0xc200('0x2b')]);_0x13fed0[_0xc200('0x2f')]=_[_0xc200('0x45')](_0x41c005['query']);_0x13fed0[_0xc200('0x37')]=_[_0xc200('0x30')](_0x13fed0['model'],_0x13fed0[_0xc200('0x2f')]);_0x5b1248[_0xc200('0x31')]=_['intersection'](_0x13fed0[_0xc200('0x2e')],qs[_0xc200('0x32')](_0x41c005[_0xc200('0x2f')]['fields']));_0x5b1248[_0xc200('0x31')]=_0x5b1248[_0xc200('0x31')][_0xc200('0x33')]?_0x5b1248['attributes']:_0x13fed0['model'];if(_0x41c005[_0xc200('0x2f')]['includeAll']){_0x5b1248[_0xc200('0x3f')]=[{'all':!![]}];}_0x5b1248=_[_0xc200('0x3a')]({},_0x5b1248,_0x41c005[_0xc200('0x3d')]);return db[_0xc200('0x40')][_0xc200('0x46')](_0x5b1248)[_0xc200('0x26')](handleEntityNotFound(_0x3ab4e4,null))[_0xc200('0x26')](respondWithResult(_0x3ab4e4,null))[_0xc200('0x43')](handleError(_0x3ab4e4,null));};exports[_0xc200('0x47')]=function(_0x7927f8,_0x425b10){return db['ServicenowField']['create'](_0x7927f8['body'],{})[_0xc200('0x26')](respondWithResult(_0x425b10,0xc9))[_0xc200('0x43')](handleError(_0x425b10,null));};exports['update']=function(_0x5db783,_0x1bba7e){if(_0x5db783[_0xc200('0x48')]['id']){delete _0x5db783['body']['id'];}return db[_0xc200('0x40')][_0xc200('0x46')]({'where':{'id':_0x5db783[_0xc200('0x49')]['id']}})[_0xc200('0x26')](handleEntityNotFound(_0x1bba7e,null))[_0xc200('0x26')](saveUpdates(_0x5db783[_0xc200('0x48')],null))[_0xc200('0x26')](respondWithResult(_0x1bba7e,null))[_0xc200('0x43')](handleError(_0x1bba7e,null));};exports['destroy']=function(_0x17d863,_0x5c13e7){return db[_0xc200('0x40')][_0xc200('0x46')]({'where':{'id':_0x17d863['params']['id']}})[_0xc200('0x26')](handleEntityNotFound(_0x5c13e7,null))[_0xc200('0x26')](removeEntity(_0x5c13e7,null))['catch'](handleError(_0x5c13e7,null));}; \ No newline at end of file +var _0xa8cf=['VIRTUAL','filter','merge','options','count','includeAll','include','rows','params','length','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','stack','name','index','ServicenowField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','where','type'];(function(_0x1d05da,_0x2e7039){var _0x243113=function(_0x314c92){while(--_0x314c92){_0x1d05da['push'](_0x1d05da['shift']());}};_0x243113(++_0x2e7039);}(_0xa8cf,0xf3));var _0xfa8c=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xa8cf[_0x4cd690];return _0x4a74a9;};'use strict';var emlformat=require(_0xfa8c('0x0'));var rimraf=require(_0xfa8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa8c('0x2'));var rp=require(_0xfa8c('0x3'));var moment=require(_0xfa8c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfa8c('0x5'));var util=require('util');var path=require(_0xfa8c('0x6'));var sox=require(_0xfa8c('0x7'));var csv=require(_0xfa8c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa8c('0x9'));var _=require(_0xfa8c('0xa'));var squel=require(_0xfa8c('0xb'));var crypto=require(_0xfa8c('0xc'));var jsforce=require(_0xfa8c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfa8c('0x8'));var querystring=require(_0xfa8c('0xe'));var Papa=require(_0xfa8c('0xf'));var Redis=require(_0xfa8c('0x10'));var authService=require(_0xfa8c('0x11'));var qs=require(_0xfa8c('0x12'));var as=require(_0xfa8c('0x13'));var hardwareService=require(_0xfa8c('0x14'));var logger=require(_0xfa8c('0x15'))(_0xfa8c('0x16'));var utils=require(_0xfa8c('0x17'));var config=require(_0xfa8c('0x18'));var licenseUtil=require(_0xfa8c('0x19'));var db=require(_0xfa8c('0x1a'))['db'];function respondWithStatusCode(_0xb0fe4b,_0x117aa5){_0x117aa5=_0x117aa5||0xcc;return function(_0x1d2f41){if(_0x1d2f41){return _0xb0fe4b[_0xfa8c('0x1b')](_0x117aa5);}return _0xb0fe4b['status'](_0x117aa5)[_0xfa8c('0x1c')]();};}function respondWithResult(_0x204448,_0x3432f0){_0x3432f0=_0x3432f0||0xc8;return function(_0x333576){if(_0x333576){return _0x204448[_0xfa8c('0x1d')](_0x3432f0)[_0xfa8c('0x1e')](_0x333576);}};}function respondWithFilteredResult(_0x29584d,_0x1bb109){return function(_0x8e567c){if(_0x8e567c){var _0x172871=typeof _0x1bb109[_0xfa8c('0x1f')]===_0xfa8c('0x20')&&typeof _0x1bb109[_0xfa8c('0x21')]===_0xfa8c('0x20');var _0x367548=_0x8e567c['count'];var _0x34955c=_0x172871?0x0:_0x1bb109[_0xfa8c('0x1f')];var _0x3f6bd3=_0x172871?_0x8e567c['count']:_0x1bb109[_0xfa8c('0x1f')]+_0x1bb109[_0xfa8c('0x21')];var _0x3ce21e;if(_0x3f6bd3>=_0x367548){_0x3f6bd3=_0x367548;_0x3ce21e=0xc8;}else{_0x3ce21e=0xce;}_0x29584d[_0xfa8c('0x1d')](_0x3ce21e);return _0x29584d[_0xfa8c('0x22')](_0xfa8c('0x23'),_0x34955c+'-'+_0x3f6bd3+'/'+_0x367548)[_0xfa8c('0x1e')](_0x8e567c);}return null;};}function patchUpdates(_0x637eef){return function(_0x44b6bb){try{jsonpatch[_0xfa8c('0x24')](_0x44b6bb,_0x637eef,!![]);}catch(_0x46e225){return BPromise['reject'](_0x46e225);}return _0x44b6bb[_0xfa8c('0x25')]();};}function saveUpdates(_0x3982bc,_0x3596d4){return function(_0x3b487d){if(_0x3b487d){return _0x3b487d[_0xfa8c('0x26')](_0x3982bc)[_0xfa8c('0x27')](function(_0x59a934){return _0x59a934;});}return null;};}function removeEntity(_0x31e3ea,_0x1830df){return function(_0xe6c14a){if(_0xe6c14a){return _0xe6c14a['destroy']()[_0xfa8c('0x27')](function(){_0x31e3ea[_0xfa8c('0x1d')](0xcc)[_0xfa8c('0x1c')]();});}};}function handleEntityNotFound(_0x5eb492,_0x509970){return function(_0x1c73ad){if(!_0x1c73ad){_0x5eb492[_0xfa8c('0x1b')](0x194);}return _0x1c73ad;};}function handleError(_0x56dcf9,_0x3667f0){_0x3667f0=_0x3667f0||0x1f4;return function(_0x8eed94){logger['error'](_0x8eed94[_0xfa8c('0x28')]);if(_0x8eed94[_0xfa8c('0x29')]){delete _0x8eed94[_0xfa8c('0x29')];}_0x56dcf9[_0xfa8c('0x1d')](_0x3667f0)['send'](_0x8eed94);};}exports[_0xfa8c('0x2a')]=function(_0x5d6db5,_0x4704a7){var _0x45b949={},_0x63e259={},_0x15a755={'count':0x0,'rows':[]};var _0x3facb2=_['map'](db[_0xfa8c('0x2b')][_0xfa8c('0x2c')],function(_0x107ea0){return{'name':_0x107ea0[_0xfa8c('0x2d')],'type':_0x107ea0['type'][_0xfa8c('0x2e')]};});_0x63e259[_0xfa8c('0x2f')]=_[_0xfa8c('0x30')](_0x3facb2,'name');_0x63e259[_0xfa8c('0x31')]=_[_0xfa8c('0x32')](_0x5d6db5[_0xfa8c('0x31')]);_0x63e259[_0xfa8c('0x33')]=_[_0xfa8c('0x34')](_0x63e259[_0xfa8c('0x2f')],_0x63e259['query']);_0x45b949['attributes']=_[_0xfa8c('0x34')](_0x63e259[_0xfa8c('0x2f')],qs[_0xfa8c('0x35')](_0x5d6db5['query'][_0xfa8c('0x35')]));_0x45b949['attributes']=_0x45b949[_0xfa8c('0x36')]['length']?_0x45b949[_0xfa8c('0x36')]:_0x63e259[_0xfa8c('0x2f')];if(!_0x5d6db5['query']['hasOwnProperty'](_0xfa8c('0x37'))){_0x45b949[_0xfa8c('0x21')]=qs[_0xfa8c('0x21')](_0x5d6db5[_0xfa8c('0x31')][_0xfa8c('0x21')]);_0x45b949[_0xfa8c('0x1f')]=qs[_0xfa8c('0x1f')](_0x5d6db5[_0xfa8c('0x31')][_0xfa8c('0x1f')]);}_0x45b949[_0xfa8c('0x38')]=qs[_0xfa8c('0x39')](_0x5d6db5['query'][_0xfa8c('0x39')]);_0x45b949['where']=qs[_0xfa8c('0x33')](_[_0xfa8c('0x3a')](_0x5d6db5[_0xfa8c('0x31')],_0x63e259[_0xfa8c('0x33')]),_0x3facb2);if(_0x5d6db5[_0xfa8c('0x31')]['filter']){_0x45b949[_0xfa8c('0x3b')]=_['merge'](_0x45b949[_0xfa8c('0x3b')],{'$or':_['map'](_0x3facb2,function(_0x1232bd){if(_0x1232bd[_0xfa8c('0x3c')]!==_0xfa8c('0x3d')){var _0x2aefe8={};_0x2aefe8[_0x1232bd[_0xfa8c('0x29')]]={'$like':'%'+_0x5d6db5[_0xfa8c('0x31')][_0xfa8c('0x3e')]+'%'};return _0x2aefe8;}})});}_0x45b949=_[_0xfa8c('0x3f')]({},_0x45b949,_0x5d6db5[_0xfa8c('0x40')]);var _0x5ea606={'where':_0x45b949[_0xfa8c('0x3b')]};return db[_0xfa8c('0x2b')][_0xfa8c('0x41')](_0x5ea606)['then'](function(_0x1dcd47){_0x15a755['count']=_0x1dcd47;if(_0x5d6db5[_0xfa8c('0x31')][_0xfa8c('0x42')]){_0x45b949[_0xfa8c('0x43')]=[{'all':!![]}];}return db[_0xfa8c('0x2b')]['findAll'](_0x45b949);})[_0xfa8c('0x27')](function(_0x34848d){_0x15a755[_0xfa8c('0x44')]=_0x34848d;return _0x15a755;})['then'](respondWithFilteredResult(_0x4704a7,_0x45b949))['catch'](handleError(_0x4704a7,null));};exports['show']=function(_0x5d9059,_0x2a1c78){var _0x3e1720={'raw':!![],'where':{'id':_0x5d9059[_0xfa8c('0x45')]['id']}},_0x384b19={};_0x384b19[_0xfa8c('0x2f')]=_['keys'](db[_0xfa8c('0x2b')][_0xfa8c('0x2c')]);_0x384b19[_0xfa8c('0x31')]=_['keys'](_0x5d9059[_0xfa8c('0x31')]);_0x384b19[_0xfa8c('0x33')]=_['intersection'](_0x384b19[_0xfa8c('0x2f')],_0x384b19['query']);_0x3e1720[_0xfa8c('0x36')]=_[_0xfa8c('0x34')](_0x384b19[_0xfa8c('0x2f')],qs['fields'](_0x5d9059[_0xfa8c('0x31')]['fields']));_0x3e1720[_0xfa8c('0x36')]=_0x3e1720[_0xfa8c('0x36')][_0xfa8c('0x46')]?_0x3e1720[_0xfa8c('0x36')]:_0x384b19['model'];if(_0x5d9059[_0xfa8c('0x31')]['includeAll']){_0x3e1720['include']=[{'all':!![]}];}_0x3e1720=_[_0xfa8c('0x3f')]({},_0x3e1720,_0x5d9059[_0xfa8c('0x40')]);return db[_0xfa8c('0x2b')][_0xfa8c('0x47')](_0x3e1720)['then'](handleEntityNotFound(_0x2a1c78,null))[_0xfa8c('0x27')](respondWithResult(_0x2a1c78,null))[_0xfa8c('0x48')](handleError(_0x2a1c78,null));};exports[_0xfa8c('0x49')]=function(_0x339a62,_0x632ed9){return db[_0xfa8c('0x2b')]['create'](_0x339a62[_0xfa8c('0x4a')],{})[_0xfa8c('0x27')](respondWithResult(_0x632ed9,0xc9))[_0xfa8c('0x48')](handleError(_0x632ed9,null));};exports[_0xfa8c('0x26')]=function(_0x17a8aa,_0x489d7e){if(_0x17a8aa[_0xfa8c('0x4a')]['id']){delete _0x17a8aa[_0xfa8c('0x4a')]['id'];}return db[_0xfa8c('0x2b')][_0xfa8c('0x47')]({'where':{'id':_0x17a8aa[_0xfa8c('0x45')]['id']}})[_0xfa8c('0x27')](handleEntityNotFound(_0x489d7e,null))[_0xfa8c('0x27')](saveUpdates(_0x17a8aa[_0xfa8c('0x4a')],null))[_0xfa8c('0x27')](respondWithResult(_0x489d7e,null))[_0xfa8c('0x48')](handleError(_0x489d7e,null));};exports[_0xfa8c('0x4b')]=function(_0x3bbc83,_0x2c0ac4){return db['ServicenowField'][_0xfa8c('0x47')]({'where':{'id':_0x3bbc83[_0xfa8c('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c0ac4,null))[_0xfa8c('0x27')](removeEntity(_0x2c0ac4,null))[_0xfa8c('0x48')](handleError(_0x2c0ac4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 2b017f0..602a275 100644 --- a/server/api/intServicenowField/intServicenowField.model.js +++ b/server/api/intServicenowField/intServicenowField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa169=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowField','servicenow_unique_index'];(function(_0x2222bf,_0x52b448){var _0x334ad0=function(_0x23b0a4){while(--_0x23b0a4){_0x2222bf['push'](_0x2222bf['shift']());}};_0x334ad0(++_0x52b448);}(_0xa169,0x1c0));var _0x9a16=function(_0x2e56ef,_0x582b72){_0x2e56ef=_0x2e56ef-0x0;var _0x3cb149=_0xa169[_0x2e56ef];return _0x3cb149;};'use strict';var _=require(_0x9a16('0x0'));var util=require(_0x9a16('0x1'));var logger=require(_0x9a16('0x2'))(_0x9a16('0x3'));var moment=require(_0x9a16('0x4'));var BPromise=require(_0x9a16('0x5'));var rp=require(_0x9a16('0x6'));var fs=require('fs');var path=require(_0x9a16('0x7'));var rimraf=require(_0x9a16('0x8'));var config=require(_0x9a16('0x9'));var attributes=require('./intServicenowField.attributes');module[_0x9a16('0xa')]=function(_0x29f605,_0x59f9cf){return _0x29f605[_0x9a16('0xb')](_0x9a16('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x9a16('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6adb=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields'];(function(_0x23fc17,_0x42ec81){var _0x792e68=function(_0x3da655){while(--_0x3da655){_0x23fc17['push'](_0x23fc17['shift']());}};_0x792e68(++_0x42ec81);}(_0x6adb,0x105));var _0xb6ad=function(_0xc53e3f,_0x445012){_0xc53e3f=_0xc53e3f-0x0;var _0x518308=_0x6adb[_0xc53e3f];return _0x518308;};'use strict';var _=require(_0xb6ad('0x0'));var util=require(_0xb6ad('0x1'));var logger=require(_0xb6ad('0x2'))(_0xb6ad('0x3'));var moment=require('moment');var BPromise=require(_0xb6ad('0x4'));var rp=require(_0xb6ad('0x5'));var fs=require('fs');var path=require(_0xb6ad('0x6'));var rimraf=require(_0xb6ad('0x7'));var config=require('../../config/environment');var attributes=require(_0xb6ad('0x8'));module[_0xb6ad('0x9')]=function(_0xf55bc8,_0x5e2387){return _0xf55bc8['define'](_0xb6ad('0xa'),attributes,{'tableName':_0xb6ad('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0xb6ad('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 90f4c62..0609bdf 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4de260,_0x152cf1){var _0x548d7d=function(_0x4467d8){while(--_0x4467d8){_0x4de260['push'](_0x4de260['shift']());}};_0x548d7d(++_0x152cf1);}(_0x70e0,0x17b));var _0x070e=function(_0x37d5e6,_0x480536){_0x37d5e6=_0x37d5e6-0x0;var _0x4448ac=_0x70e0[_0x37d5e6];return _0x4448ac;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x1c04fb,_0xe97f66){var _0x4fd0e1=function(_0x1bc9c8){while(--_0x1bc9c8){_0x1c04fb['push'](_0x1c04fb['shift']());}};_0x4fd0e1(++_0xe97f66);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3d235c,_0x3735f4){_0x3d235c=_0x3d235c-0x0;var _0x23a708=_0x9ffd[_0x3d235c];return _0x23a708;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e825e8e..761c797 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x35823c,_0x4eeabe){var _0x2f19a4=function(_0x773c32){while(--_0x773c32){_0x35823c['push'](_0x35823c['shift']());}};_0x2f19a4(++_0x4eeabe);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x19258d,_0x554f57){var _0x184f44=function(_0x45a3b2){while(--_0x45a3b2){_0x19258d['push'](_0x19258d['shift']());}};_0x184f44(++_0x554f57);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 15aca25..8173a38 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x6d1b71,_0x41ddc2){var _0x222e85=function(_0x587725){while(--_0x587725){_0x6d1b71['push'](_0x6d1b71['shift']());}};_0x222e85(++_0x41ddc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x45c5cb,_0x156554){var _0x1c8c95=function(_0x13a997){while(--_0x13a997){_0x45c5cb['push'](_0x45c5cb['shift']());}};_0x1c8c95(++_0x156554);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index a482d3e..a0238ff 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cc0=['params','length','find','create','body','destroy','getConfigurations','findOne','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','SugarcrmConfiguration','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','date_start','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','%s%s','Calls','values','module_fields','remove','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','json','undefined','count','offset','limit','set','reject','save','update','then','error','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x3c312e,_0x4e247f){var _0x40ce61=function(_0x1911f7){while(--_0x1911f7){_0x3c312e['push'](_0x3c312e['shift']());}};_0x40ce61(++_0x4e247f);}(_0x5cc0,0x11c));var _0x05cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5cc0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x05cc('0x0'));var rimraf=require(_0x05cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x05cc('0x2'));var moment=require(_0x05cc('0x3'));var BPromise=require(_0x05cc('0x4'));var Mustache=require(_0x05cc('0x5'));var util=require('util');var path=require(_0x05cc('0x6'));var sox=require(_0x05cc('0x7'));var csv=require(_0x05cc('0x8'));var ejs=require(_0x05cc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x05cc('0xa'));var crypto=require(_0x05cc('0xb'));var jsforce=require(_0x05cc('0xc'));var deskjs=require(_0x05cc('0xd'));var toCsv=require(_0x05cc('0x8'));var querystring=require(_0x05cc('0xe'));var Papa=require(_0x05cc('0xf'));var Redis=require(_0x05cc('0x10'));var authService=require(_0x05cc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x05cc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05cc('0x13'))(_0x05cc('0x14'));var utils=require(_0x05cc('0x15'));var config=require(_0x05cc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x05cc('0x17'))['db'];var integrations=require(_0x05cc('0x18'));function respondWithStatusCode(_0x48e9b6,_0x2f0306){_0x2f0306=_0x2f0306||0xcc;return function(_0x193a6e){if(_0x193a6e){return _0x48e9b6['sendStatus'](_0x2f0306);}return _0x48e9b6['status'](_0x2f0306)[_0x05cc('0x19')]();};}function respondWithResult(_0x5425a3,_0x161e46){_0x161e46=_0x161e46||0xc8;return function(_0x43c375){if(_0x43c375){return _0x5425a3[_0x05cc('0x1a')](_0x161e46)[_0x05cc('0x1b')](_0x43c375);}};}function respondWithFilteredResult(_0x2db400,_0x34cceb){return function(_0x4da5bb){if(_0x4da5bb){var _0x2578d3=typeof _0x34cceb['offset']==='undefined'&&typeof _0x34cceb['limit']===_0x05cc('0x1c');var _0x36b076=_0x4da5bb[_0x05cc('0x1d')];var _0x1c9c55=_0x2578d3?0x0:_0x34cceb[_0x05cc('0x1e')];var _0x55e086=_0x2578d3?_0x4da5bb[_0x05cc('0x1d')]:_0x34cceb['offset']+_0x34cceb[_0x05cc('0x1f')];var _0x32cc71;if(_0x55e086>=_0x36b076){_0x55e086=_0x36b076;_0x32cc71=0xc8;}else{_0x32cc71=0xce;}_0x2db400['status'](_0x32cc71);return _0x2db400[_0x05cc('0x20')]('Content-Range',_0x1c9c55+'-'+_0x55e086+'/'+_0x36b076)[_0x05cc('0x1b')](_0x4da5bb);}return null;};}function patchUpdates(_0x2b8690){return function(_0x473388){try{jsonpatch['apply'](_0x473388,_0x2b8690,!![]);}catch(_0x12c085){return BPromise[_0x05cc('0x21')](_0x12c085);}return _0x473388[_0x05cc('0x22')]();};}function saveUpdates(_0x11c39,_0x452464){return function(_0xbec3ec){if(_0xbec3ec){return _0xbec3ec[_0x05cc('0x23')](_0x11c39)[_0x05cc('0x24')](function(_0x4e3573){return _0x4e3573;});}return null;};}function removeEntity(_0x44d44e,_0x3bbb00){return function(_0xc3803a){if(_0xc3803a){return _0xc3803a['destroy']()[_0x05cc('0x24')](function(){_0x44d44e['status'](0xcc)[_0x05cc('0x19')]();});}};}function handleEntityNotFound(_0x2663ff,_0xb85d1a){return function(_0x3cc5cf){if(!_0x3cc5cf){_0x2663ff['sendStatus'](0x194);}return _0x3cc5cf;};}function handleError(_0x1d63f5,_0x5dc568){_0x5dc568=_0x5dc568||0x1f4;return function(_0x582a8f){logger[_0x05cc('0x25')](_0x582a8f['stack']);if(_0x582a8f[_0x05cc('0x26')]){delete _0x582a8f[_0x05cc('0x26')];}_0x1d63f5[_0x05cc('0x1a')](_0x5dc568)['send'](_0x582a8f);};}exports[_0x05cc('0x27')]=function(_0x5cb663,_0xb6412d){var _0x59768f={},_0x205624={},_0x585c51={'count':0x0,'rows':[]};var _0x4f0bbb=_[_0x05cc('0x28')](db[_0x05cc('0x29')][_0x05cc('0x2a')],function(_0x372806){return{'name':_0x372806[_0x05cc('0x2b')],'type':_0x372806[_0x05cc('0x2c')][_0x05cc('0x2d')]};});_0x205624[_0x05cc('0x2e')]=_[_0x05cc('0x28')](_0x4f0bbb,_0x05cc('0x26'));_0x205624[_0x05cc('0x2f')]=_[_0x05cc('0x30')](_0x5cb663[_0x05cc('0x2f')]);_0x205624[_0x05cc('0x31')]=_[_0x05cc('0x32')](_0x205624[_0x05cc('0x2e')],_0x205624[_0x05cc('0x2f')]);_0x59768f[_0x05cc('0x33')]=_['intersection'](_0x205624[_0x05cc('0x2e')],qs[_0x05cc('0x34')](_0x5cb663[_0x05cc('0x2f')]['fields']));_0x59768f['attributes']=_0x59768f[_0x05cc('0x33')]['length']?_0x59768f[_0x05cc('0x33')]:_0x205624[_0x05cc('0x2e')];if(!_0x5cb663[_0x05cc('0x2f')][_0x05cc('0x35')]('nolimit')){_0x59768f[_0x05cc('0x1f')]=qs[_0x05cc('0x1f')](_0x5cb663[_0x05cc('0x2f')][_0x05cc('0x1f')]);_0x59768f[_0x05cc('0x1e')]=qs[_0x05cc('0x1e')](_0x5cb663[_0x05cc('0x2f')][_0x05cc('0x1e')]);}_0x59768f[_0x05cc('0x36')]=qs[_0x05cc('0x37')](_0x5cb663[_0x05cc('0x2f')][_0x05cc('0x37')]);_0x59768f[_0x05cc('0x38')]=qs[_0x05cc('0x31')](_['pick'](_0x5cb663[_0x05cc('0x2f')],_0x205624[_0x05cc('0x31')]),_0x4f0bbb);if(_0x5cb663['query'][_0x05cc('0x39')]){_0x59768f['where']=_[_0x05cc('0x3a')](_0x59768f[_0x05cc('0x38')],{'$or':_[_0x05cc('0x28')](_0x4f0bbb,function(_0x5a645b){if(_0x5a645b[_0x05cc('0x2c')]!==_0x05cc('0x3b')){var _0x32895b={};_0x32895b[_0x5a645b[_0x05cc('0x26')]]={'$like':'%'+_0x5cb663[_0x05cc('0x2f')]['filter']+'%'};return _0x32895b;}})});}_0x59768f=_[_0x05cc('0x3a')]({},_0x59768f,_0x5cb663[_0x05cc('0x3c')]);var _0x4cae89={'where':_0x59768f[_0x05cc('0x38')]};return db[_0x05cc('0x29')][_0x05cc('0x1d')](_0x4cae89)[_0x05cc('0x24')](function(_0x5e8420){_0x585c51[_0x05cc('0x1d')]=_0x5e8420;if(_0x5cb663[_0x05cc('0x2f')][_0x05cc('0x3d')]){_0x59768f[_0x05cc('0x3e')]=[{'all':!![]}];}return db[_0x05cc('0x29')][_0x05cc('0x3f')](_0x59768f);})['then'](function(_0x2c63a3){_0x585c51[_0x05cc('0x40')]=_0x2c63a3;return _0x585c51;})[_0x05cc('0x24')](respondWithFilteredResult(_0xb6412d,_0x59768f))[_0x05cc('0x41')](handleError(_0xb6412d,null));};exports[_0x05cc('0x42')]=function(_0x3eedc5,_0x3a32ce){var _0x481b5c={'raw':![],'where':{'id':_0x3eedc5[_0x05cc('0x43')]['id']}},_0x15d842={};_0x15d842[_0x05cc('0x2e')]=_[_0x05cc('0x30')](db['SugarcrmAccount'][_0x05cc('0x2a')]);_0x15d842[_0x05cc('0x2f')]=_[_0x05cc('0x30')](_0x3eedc5[_0x05cc('0x2f')]);_0x15d842[_0x05cc('0x31')]=_[_0x05cc('0x32')](_0x15d842['model'],_0x15d842[_0x05cc('0x2f')]);_0x481b5c[_0x05cc('0x33')]=_[_0x05cc('0x32')](_0x15d842[_0x05cc('0x2e')],qs['fields'](_0x3eedc5[_0x05cc('0x2f')][_0x05cc('0x34')]));_0x481b5c[_0x05cc('0x33')]=_0x481b5c[_0x05cc('0x33')][_0x05cc('0x44')]?_0x481b5c[_0x05cc('0x33')]:_0x15d842['model'];if(_0x3eedc5[_0x05cc('0x2f')][_0x05cc('0x3d')]){_0x481b5c[_0x05cc('0x3e')]=[{'all':!![]}];}_0x481b5c=_[_0x05cc('0x3a')]({},_0x481b5c,_0x3eedc5[_0x05cc('0x3c')]);return db[_0x05cc('0x29')][_0x05cc('0x45')](_0x481b5c)[_0x05cc('0x24')](handleEntityNotFound(_0x3a32ce,null))[_0x05cc('0x24')](respondWithResult(_0x3a32ce,null))[_0x05cc('0x41')](handleError(_0x3a32ce,null));};exports[_0x05cc('0x46')]=function(_0x231ea1,_0x1d73b5){return db['SugarcrmAccount'][_0x05cc('0x46')](_0x231ea1[_0x05cc('0x47')],{})[_0x05cc('0x24')](respondWithResult(_0x1d73b5,0xc9))[_0x05cc('0x41')](handleError(_0x1d73b5,null));};exports[_0x05cc('0x23')]=function(_0x320cec,_0x33ac6a){if(_0x320cec[_0x05cc('0x47')]['id']){delete _0x320cec[_0x05cc('0x47')]['id'];}return db[_0x05cc('0x29')][_0x05cc('0x45')]({'where':{'id':_0x320cec['params']['id']}})[_0x05cc('0x24')](handleEntityNotFound(_0x33ac6a,null))[_0x05cc('0x24')](saveUpdates(_0x320cec[_0x05cc('0x47')],null))['then'](respondWithResult(_0x33ac6a,null))[_0x05cc('0x41')](handleError(_0x33ac6a,null));};exports[_0x05cc('0x48')]=function(_0x696600,_0x5b8afe){return db[_0x05cc('0x29')][_0x05cc('0x45')]({'where':{'id':_0x696600[_0x05cc('0x43')]['id']}})[_0x05cc('0x24')](handleEntityNotFound(_0x5b8afe,null))['then'](removeEntity(_0x5b8afe,null))[_0x05cc('0x41')](handleError(_0x5b8afe,null));};exports[_0x05cc('0x49')]=function(_0x294beb,_0x233cc8,_0x1c6e64){var _0x53fd2e={};var _0x26359f={};var _0x536212;var _0x1d6df3;return db[_0x05cc('0x29')][_0x05cc('0x4a')]({'where':{'id':_0x294beb[_0x05cc('0x43')]['id']}})[_0x05cc('0x24')](handleEntityNotFound(_0x233cc8,null))[_0x05cc('0x24')](function(_0x178bc7){if(_0x178bc7){_0x536212=_0x178bc7;_0x26359f[_0x05cc('0x2e')]=_[_0x05cc('0x30')](db['SugarcrmConfiguration']['rawAttributes']);_0x26359f[_0x05cc('0x2f')]=_['keys'](_0x294beb[_0x05cc('0x2f')]);_0x26359f[_0x05cc('0x31')]=_[_0x05cc('0x32')](_0x26359f[_0x05cc('0x2e')],_0x26359f['query']);_0x53fd2e[_0x05cc('0x33')]=_[_0x05cc('0x32')](_0x26359f['model'],qs[_0x05cc('0x34')](_0x294beb[_0x05cc('0x2f')]['fields']));_0x53fd2e[_0x05cc('0x33')]=_0x53fd2e[_0x05cc('0x33')][_0x05cc('0x44')]?_0x53fd2e[_0x05cc('0x33')]:_0x26359f['model'];_0x53fd2e['order']=qs[_0x05cc('0x37')](_0x294beb[_0x05cc('0x2f')][_0x05cc('0x37')]);_0x53fd2e[_0x05cc('0x38')]=qs['filters'](_['pick'](_0x294beb['query'],_0x26359f[_0x05cc('0x31')]));if(_0x294beb[_0x05cc('0x2f')][_0x05cc('0x39')]){_0x53fd2e[_0x05cc('0x38')]=_[_0x05cc('0x3a')](_0x53fd2e[_0x05cc('0x38')],{'$or':_['map'](_0x53fd2e[_0x05cc('0x33')],function(_0x1fc4dc){var _0x176514={};_0x176514[_0x1fc4dc]={'$like':'%'+_0x294beb[_0x05cc('0x2f')][_0x05cc('0x39')]+'%'};return _0x176514;})});}_0x53fd2e=_[_0x05cc('0x3a')]({},_0x53fd2e,_0x294beb[_0x05cc('0x3c')]);return _0x536212[_0x05cc('0x49')](_0x53fd2e);}})[_0x05cc('0x24')](function(_0x110186){if(_0x110186){_0x1d6df3=_0x110186['length'];if(!_0x294beb[_0x05cc('0x2f')]['hasOwnProperty'](_0x05cc('0x4b'))){_0x53fd2e[_0x05cc('0x1f')]=qs[_0x05cc('0x1f')](_0x294beb[_0x05cc('0x2f')][_0x05cc('0x1f')]);_0x53fd2e[_0x05cc('0x1e')]=qs['offset'](_0x294beb[_0x05cc('0x2f')][_0x05cc('0x1e')]);}return _0x536212[_0x05cc('0x49')](_0x53fd2e);}})['then'](function(_0x2c4593){if(_0x2c4593){return _0x2c4593?{'count':_0x1d6df3,'rows':_0x2c4593}:null;}})['then'](respondWithResult(_0x233cc8,null))[_0x05cc('0x41')](handleError(_0x233cc8,null));};exports[_0x05cc('0x4c')]=function(_0x5a9823,_0x5e2b00,_0x30f9f1){if(_0x5a9823[_0x05cc('0x47')]['id']){delete _0x5a9823[_0x05cc('0x47')]['id'];}return db[_0x05cc('0x29')][_0x05cc('0x4a')]({'where':{'id':_0x5a9823['params']['id']}})['then'](handleEntityNotFound(_0x5e2b00,null))[_0x05cc('0x24')](function(_0x1a532b){if(_0x1a532b){_0x5a9823[_0x05cc('0x47')][_0x05cc('0x4d')]=_0x1a532b['id'];_0x5a9823['body']['Subjects']=integrations[_0x05cc('0x4e')](_0x5a9823[_0x05cc('0x47')][_0x05cc('0x4f')],_0x5a9823['body']['type']);_0x5a9823[_0x05cc('0x47')][_0x05cc('0x50')]=integrations['getDescriptions'](_0x5a9823['body'][_0x05cc('0x4f')],_0x5a9823['body'][_0x05cc('0x2c')]);return db[_0x05cc('0x51')][_0x05cc('0x46')](_0x5a9823[_0x05cc('0x47')],{'include':[{'model':db[_0x05cc('0x52')],'as':_0x05cc('0x53')},{'model':db[_0x05cc('0x52')],'as':'Descriptions'}]});}return null;})[_0x05cc('0x24')](respondWithResult(_0x5e2b00,null))[_0x05cc('0x41')](handleError(_0x5e2b00,null));};exports[_0x05cc('0x54')]=function(_0x19a1c9,_0x1b6dbc,_0xea07b9){var _0x307f89='';var _0x49d437=['id',_0x05cc('0x26'),_0x05cc('0x55'),_0x05cc('0x56'),_0x05cc('0x57'),_0x05cc('0x58'),'duration_hours','duration_minutes',_0x05cc('0x59'),_0x05cc('0x5a'),_0x05cc('0x5b'),_0x05cc('0x5c')];return db[_0x05cc('0x29')]['findOne']({'where':{'id':_0x19a1c9[_0x05cc('0x43')]['id']},'attributes':['id',_0x05cc('0x5d'),_0x05cc('0x5e'),'remoteUri']})[_0x05cc('0x24')](handleEntityNotFound(_0x1b6dbc,null))[_0x05cc('0x24')](function(_0x5473b9){if(_0x5473b9){_0x307f89=_0x5473b9[_0x05cc('0x5f')];var _0x5ad24d=_0x307f89[_0x05cc('0x60')](-0x1);if(_0x5ad24d==='/'){_0x307f89=_0x307f89[_0x05cc('0x61')](0x0,_0x307f89[_0x05cc('0x62')](_0x5ad24d));}return rp({'method':'POST','uri':util[_0x05cc('0x63')]('%s%s',_0x307f89,_0x05cc('0x64')),'json':!![],'form':{'method':'login','input_type':_0x05cc('0x65'),'response_type':_0x05cc('0x65'),'rest_data':JSON[_0x05cc('0x66')]({'user_auth':{'user_name':_0x5473b9[_0x05cc('0x5d')],'password':_0x5473b9[_0x05cc('0x5e')],'encryption':_0x05cc('0x67')},'application':_0x05cc('0x68')})}});}})['then'](function(_0x42d1d5){if(_0x42d1d5&&_0x42d1d5['name']!=='Invalid\x20Login'&&_0x42d1d5[_0x05cc('0x26')]!==_0x05cc('0x69')){return rp({'method':'POST','uri':util[_0x05cc('0x63')](_0x05cc('0x6a'),_0x307f89,_0x05cc('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x05cc('0x65'),'rest_data':JSON[_0x05cc('0x66')]({'session':_0x42d1d5['id'],'module_name':_0x05cc('0x6b')})}})[_0x05cc('0x24')](function(_0x1eaf50){if(_0x1eaf50){var _0x46c025=_[_0x05cc('0x6c')](_0x1eaf50[_0x05cc('0x6d')]);_[_0x05cc('0x6e')](_0x46c025,function(_0x1ed4a8){return _0x49d437['includes'](_0x1ed4a8[_0x05cc('0x26')]);});return{'count':_0x46c025[_0x05cc('0x44')],'rows':_[_0x05cc('0x28')](_0x46c025,function(_0x337b4b){return{'id':_0x337b4b['name'],'name':_0x337b4b['label'],'custom':_['endsWith'](_0x337b4b['name'],'_c')?!![]:![],'options':_0x337b4b[_0x05cc('0x3c')]?_[_0x05cc('0x28')](_[_0x05cc('0x6c')](_0x337b4b['options']),function(_0x375eb5){return{'name':_0x375eb5[_0x05cc('0x6f')],'value':_0x375eb5[_0x05cc('0x26')]};}):[]};})};}})[_0x05cc('0x24')](respondWithResult(_0x1b6dbc,null))[_0x05cc('0x41')](function(_0x211435){var _0x356b7c=_0x19a1c9['query'][_0x05cc('0x70')]?0x1f4:_0x211435[_0x05cc('0x71')]||0x1f4;logger[_0x05cc('0x25')](_0x05cc('0x72'),_0x05cc('0x54'),_0x356b7c,JSON[_0x05cc('0x66')](_0x211435));delete _0x211435['name'];if(_0x356b7c===0x191){_0x356b7c=0x190;}_0x1b6dbc[_0x05cc('0x1a')](_0x356b7c)[_0x05cc('0x73')](_0x19a1c9['query'][_0x05cc('0x70')]?{'message':_0x05cc('0x74'),'statusCode':_0x211435['statusCode']}:_0x211435);});}else{var _0x179a0c=0x1f4;_0x1b6dbc[_0x05cc('0x1a')](_0x179a0c)[_0x05cc('0x73')]({'message':_0x05cc('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x2fe6=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','error','name','send','index','map','SugarcrmAccount','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','filter','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','values','module_fields','remove','label','endsWith','value'];(function(_0x201463,_0x303067){var _0xe009e=function(_0x28f141){while(--_0x28f141){_0x201463['push'](_0x201463['shift']());}};_0xe009e(++_0x303067);}(_0x2fe6,0x1e4));var _0x62fe=function(_0x105c63,_0x4e9eda){_0x105c63=_0x105c63-0x0;var _0x5de2b9=_0x2fe6[_0x105c63];return _0x5de2b9;};'use strict';var emlformat=require(_0x62fe('0x0'));var rimraf=require(_0x62fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x62fe('0x2'));var BPromise=require(_0x62fe('0x3'));var Mustache=require('mustache');var util=require(_0x62fe('0x4'));var path=require(_0x62fe('0x5'));var sox=require(_0x62fe('0x6'));var csv=require(_0x62fe('0x7'));var ejs=require(_0x62fe('0x8'));var fs=require('fs');var fs_extra=require(_0x62fe('0x9'));var _=require(_0x62fe('0xa'));var squel=require(_0x62fe('0xb'));var crypto=require('crypto');var jsforce=require(_0x62fe('0xc'));var deskjs=require(_0x62fe('0xd'));var toCsv=require(_0x62fe('0x7'));var querystring=require(_0x62fe('0xe'));var Papa=require('papaparse');var Redis=require(_0x62fe('0xf'));var authService=require(_0x62fe('0x10'));var qs=require(_0x62fe('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62fe('0x12'));var logger=require(_0x62fe('0x13'))(_0x62fe('0x14'));var utils=require('../../config/utils');var config=require(_0x62fe('0x15'));var licenseUtil=require(_0x62fe('0x16'));var db=require(_0x62fe('0x17'))['db'];var integrations=require(_0x62fe('0x18'));function respondWithStatusCode(_0x311659,_0x297a54){_0x297a54=_0x297a54||0xcc;return function(_0x277637){if(_0x277637){return _0x311659['sendStatus'](_0x297a54);}return _0x311659['status'](_0x297a54)[_0x62fe('0x19')]();};}function respondWithResult(_0x338538,_0x5d27d2){_0x5d27d2=_0x5d27d2||0xc8;return function(_0x4a8114){if(_0x4a8114){return _0x338538[_0x62fe('0x1a')](_0x5d27d2)['json'](_0x4a8114);}};}function respondWithFilteredResult(_0xeb38f9,_0x13a2f6){return function(_0x10f104){if(_0x10f104){var _0x108e9e=typeof _0x13a2f6[_0x62fe('0x1b')]===_0x62fe('0x1c')&&typeof _0x13a2f6['limit']===_0x62fe('0x1c');var _0x2b8763=_0x10f104[_0x62fe('0x1d')];var _0x54e6f8=_0x108e9e?0x0:_0x13a2f6[_0x62fe('0x1b')];var _0x5ad42e=_0x108e9e?_0x10f104[_0x62fe('0x1d')]:_0x13a2f6[_0x62fe('0x1b')]+_0x13a2f6[_0x62fe('0x1e')];var _0x5db2f6;if(_0x5ad42e>=_0x2b8763){_0x5ad42e=_0x2b8763;_0x5db2f6=0xc8;}else{_0x5db2f6=0xce;}_0xeb38f9[_0x62fe('0x1a')](_0x5db2f6);return _0xeb38f9[_0x62fe('0x1f')](_0x62fe('0x20'),_0x54e6f8+'-'+_0x5ad42e+'/'+_0x2b8763)[_0x62fe('0x21')](_0x10f104);}return null;};}function patchUpdates(_0x1508d7){return function(_0x396457){try{jsonpatch[_0x62fe('0x22')](_0x396457,_0x1508d7,!![]);}catch(_0x228742){return BPromise[_0x62fe('0x23')](_0x228742);}return _0x396457[_0x62fe('0x24')]();};}function saveUpdates(_0x1c5769,_0xa75fd8){return function(_0x1320f2){if(_0x1320f2){return _0x1320f2['update'](_0x1c5769)['then'](function(_0x2373b5){return _0x2373b5;});}return null;};}function removeEntity(_0x468e8b,_0x3030c0){return function(_0x4ab646){if(_0x4ab646){return _0x4ab646[_0x62fe('0x25')]()[_0x62fe('0x26')](function(){_0x468e8b[_0x62fe('0x1a')](0xcc)[_0x62fe('0x19')]();});}};}function handleEntityNotFound(_0x54d138,_0x534f97){return function(_0x34b43a){if(!_0x34b43a){_0x54d138[_0x62fe('0x27')](0x194);}return _0x34b43a;};}function handleError(_0x4c2975,_0x185940){_0x185940=_0x185940||0x1f4;return function(_0xd17853){logger[_0x62fe('0x28')](_0xd17853['stack']);if(_0xd17853[_0x62fe('0x29')]){delete _0xd17853[_0x62fe('0x29')];}_0x4c2975['status'](_0x185940)[_0x62fe('0x2a')](_0xd17853);};}exports[_0x62fe('0x2b')]=function(_0x1de847,_0x32a64e){var _0x2243ac={},_0x26d06b={},_0x42da52={'count':0x0,'rows':[]};var _0x204687=_[_0x62fe('0x2c')](db[_0x62fe('0x2d')]['rawAttributes'],function(_0x55011f){return{'name':_0x55011f[_0x62fe('0x2e')],'type':_0x55011f['type']['key']};});_0x26d06b[_0x62fe('0x2f')]=_[_0x62fe('0x2c')](_0x204687,_0x62fe('0x29'));_0x26d06b[_0x62fe('0x30')]=_[_0x62fe('0x31')](_0x1de847[_0x62fe('0x30')]);_0x26d06b[_0x62fe('0x32')]=_[_0x62fe('0x33')](_0x26d06b[_0x62fe('0x2f')],_0x26d06b[_0x62fe('0x30')]);_0x2243ac['attributes']=_[_0x62fe('0x33')](_0x26d06b[_0x62fe('0x2f')],qs['fields'](_0x1de847[_0x62fe('0x30')][_0x62fe('0x34')]));_0x2243ac[_0x62fe('0x35')]=_0x2243ac[_0x62fe('0x35')][_0x62fe('0x36')]?_0x2243ac[_0x62fe('0x35')]:_0x26d06b[_0x62fe('0x2f')];if(!_0x1de847[_0x62fe('0x30')][_0x62fe('0x37')](_0x62fe('0x38'))){_0x2243ac['limit']=qs[_0x62fe('0x1e')](_0x1de847[_0x62fe('0x30')][_0x62fe('0x1e')]);_0x2243ac[_0x62fe('0x1b')]=qs[_0x62fe('0x1b')](_0x1de847[_0x62fe('0x30')][_0x62fe('0x1b')]);}_0x2243ac['order']=qs['sort'](_0x1de847[_0x62fe('0x30')][_0x62fe('0x39')]);_0x2243ac[_0x62fe('0x3a')]=qs[_0x62fe('0x32')](_[_0x62fe('0x3b')](_0x1de847['query'],_0x26d06b['filters']),_0x204687);if(_0x1de847['query']['filter']){_0x2243ac['where']=_[_0x62fe('0x3c')](_0x2243ac[_0x62fe('0x3a')],{'$or':_[_0x62fe('0x2c')](_0x204687,function(_0x9f6d53){if(_0x9f6d53[_0x62fe('0x3d')]!==_0x62fe('0x3e')){var _0x41699b={};_0x41699b[_0x9f6d53[_0x62fe('0x29')]]={'$like':'%'+_0x1de847[_0x62fe('0x30')]['filter']+'%'};return _0x41699b;}})});}_0x2243ac=_[_0x62fe('0x3c')]({},_0x2243ac,_0x1de847[_0x62fe('0x3f')]);var _0x462201={'where':_0x2243ac[_0x62fe('0x3a')]};return db[_0x62fe('0x2d')][_0x62fe('0x1d')](_0x462201)[_0x62fe('0x26')](function(_0x3014a5){_0x42da52['count']=_0x3014a5;if(_0x1de847[_0x62fe('0x30')][_0x62fe('0x40')]){_0x2243ac[_0x62fe('0x41')]=[{'all':!![]}];}return db[_0x62fe('0x2d')]['findAll'](_0x2243ac);})[_0x62fe('0x26')](function(_0x96bdc4){_0x42da52['rows']=_0x96bdc4;return _0x42da52;})[_0x62fe('0x26')](respondWithFilteredResult(_0x32a64e,_0x2243ac))[_0x62fe('0x42')](handleError(_0x32a64e,null));};exports[_0x62fe('0x43')]=function(_0x23395d,_0x4e8d18){var _0x4e8a97={'raw':![],'where':{'id':_0x23395d[_0x62fe('0x44')]['id']}},_0x4b1e6d={};_0x4b1e6d['model']=_[_0x62fe('0x31')](db['SugarcrmAccount'][_0x62fe('0x45')]);_0x4b1e6d[_0x62fe('0x30')]=_['keys'](_0x23395d['query']);_0x4b1e6d[_0x62fe('0x32')]=_[_0x62fe('0x33')](_0x4b1e6d[_0x62fe('0x2f')],_0x4b1e6d[_0x62fe('0x30')]);_0x4e8a97[_0x62fe('0x35')]=_[_0x62fe('0x33')](_0x4b1e6d['model'],qs[_0x62fe('0x34')](_0x23395d['query'][_0x62fe('0x34')]));_0x4e8a97[_0x62fe('0x35')]=_0x4e8a97[_0x62fe('0x35')][_0x62fe('0x36')]?_0x4e8a97[_0x62fe('0x35')]:_0x4b1e6d[_0x62fe('0x2f')];if(_0x23395d[_0x62fe('0x30')]['includeAll']){_0x4e8a97[_0x62fe('0x41')]=[{'all':!![]}];}_0x4e8a97=_['merge']({},_0x4e8a97,_0x23395d['options']);return db[_0x62fe('0x2d')][_0x62fe('0x46')](_0x4e8a97)[_0x62fe('0x26')](handleEntityNotFound(_0x4e8d18,null))[_0x62fe('0x26')](respondWithResult(_0x4e8d18,null))[_0x62fe('0x42')](handleError(_0x4e8d18,null));};exports[_0x62fe('0x47')]=function(_0x4ca51a,_0x41a356){return db['SugarcrmAccount'][_0x62fe('0x47')](_0x4ca51a[_0x62fe('0x48')],{})['then'](respondWithResult(_0x41a356,0xc9))['catch'](handleError(_0x41a356,null));};exports[_0x62fe('0x49')]=function(_0x1c4606,_0x2689ea){if(_0x1c4606[_0x62fe('0x48')]['id']){delete _0x1c4606[_0x62fe('0x48')]['id'];}return db[_0x62fe('0x2d')][_0x62fe('0x46')]({'where':{'id':_0x1c4606[_0x62fe('0x44')]['id']}})['then'](handleEntityNotFound(_0x2689ea,null))[_0x62fe('0x26')](saveUpdates(_0x1c4606[_0x62fe('0x48')],null))[_0x62fe('0x26')](respondWithResult(_0x2689ea,null))[_0x62fe('0x42')](handleError(_0x2689ea,null));};exports[_0x62fe('0x25')]=function(_0x36de10,_0x96afa6){return db[_0x62fe('0x2d')][_0x62fe('0x46')]({'where':{'id':_0x36de10[_0x62fe('0x44')]['id']}})[_0x62fe('0x26')](handleEntityNotFound(_0x96afa6,null))[_0x62fe('0x26')](removeEntity(_0x96afa6,null))['catch'](handleError(_0x96afa6,null));};exports[_0x62fe('0x4a')]=function(_0x30d3b3,_0x3441ba,_0x3de7b4){var _0x10de4c={};var _0x3a4859={};var _0x14e5c8;var _0x4a45c6;return db[_0x62fe('0x2d')][_0x62fe('0x4b')]({'where':{'id':_0x30d3b3[_0x62fe('0x44')]['id']}})[_0x62fe('0x26')](handleEntityNotFound(_0x3441ba,null))[_0x62fe('0x26')](function(_0x1d14da){if(_0x1d14da){_0x14e5c8=_0x1d14da;_0x3a4859[_0x62fe('0x2f')]=_[_0x62fe('0x31')](db[_0x62fe('0x4c')][_0x62fe('0x45')]);_0x3a4859[_0x62fe('0x30')]=_[_0x62fe('0x31')](_0x30d3b3[_0x62fe('0x30')]);_0x3a4859[_0x62fe('0x32')]=_[_0x62fe('0x33')](_0x3a4859[_0x62fe('0x2f')],_0x3a4859[_0x62fe('0x30')]);_0x10de4c[_0x62fe('0x35')]=_[_0x62fe('0x33')](_0x3a4859[_0x62fe('0x2f')],qs['fields'](_0x30d3b3[_0x62fe('0x30')][_0x62fe('0x34')]));_0x10de4c['attributes']=_0x10de4c[_0x62fe('0x35')][_0x62fe('0x36')]?_0x10de4c[_0x62fe('0x35')]:_0x3a4859['model'];_0x10de4c['order']=qs[_0x62fe('0x39')](_0x30d3b3[_0x62fe('0x30')][_0x62fe('0x39')]);_0x10de4c['where']=qs[_0x62fe('0x32')](_[_0x62fe('0x3b')](_0x30d3b3[_0x62fe('0x30')],_0x3a4859['filters']));if(_0x30d3b3[_0x62fe('0x30')][_0x62fe('0x4d')]){_0x10de4c[_0x62fe('0x3a')]=_['merge'](_0x10de4c[_0x62fe('0x3a')],{'$or':_[_0x62fe('0x2c')](_0x10de4c[_0x62fe('0x35')],function(_0x5266e8){var _0x102c50={};_0x102c50[_0x5266e8]={'$like':'%'+_0x30d3b3[_0x62fe('0x30')]['filter']+'%'};return _0x102c50;})});}_0x10de4c=_[_0x62fe('0x3c')]({},_0x10de4c,_0x30d3b3['options']);return _0x14e5c8['getConfigurations'](_0x10de4c);}})[_0x62fe('0x26')](function(_0x51666a){if(_0x51666a){_0x4a45c6=_0x51666a['length'];if(!_0x30d3b3[_0x62fe('0x30')][_0x62fe('0x37')](_0x62fe('0x38'))){_0x10de4c[_0x62fe('0x1e')]=qs[_0x62fe('0x1e')](_0x30d3b3[_0x62fe('0x30')]['limit']);_0x10de4c['offset']=qs[_0x62fe('0x1b')](_0x30d3b3[_0x62fe('0x30')][_0x62fe('0x1b')]);}return _0x14e5c8['getConfigurations'](_0x10de4c);}})[_0x62fe('0x26')](function(_0x3f7da3){if(_0x3f7da3){return _0x3f7da3?{'count':_0x4a45c6,'rows':_0x3f7da3}:null;}})[_0x62fe('0x26')](respondWithResult(_0x3441ba,null))[_0x62fe('0x42')](handleError(_0x3441ba,null));};exports[_0x62fe('0x4e')]=function(_0x5936cd,_0x291119,_0x543fdf){if(_0x5936cd[_0x62fe('0x48')]['id']){delete _0x5936cd['body']['id'];}return db['SugarcrmAccount'][_0x62fe('0x4b')]({'where':{'id':_0x5936cd[_0x62fe('0x44')]['id']}})['then'](handleEntityNotFound(_0x291119,null))['then'](function(_0x416af6){if(_0x416af6){_0x5936cd[_0x62fe('0x48')]['AccountId']=_0x416af6['id'];_0x5936cd[_0x62fe('0x48')]['Subjects']=integrations[_0x62fe('0x4f')](_0x5936cd[_0x62fe('0x48')][_0x62fe('0x50')],_0x5936cd[_0x62fe('0x48')][_0x62fe('0x3d')]);_0x5936cd[_0x62fe('0x48')][_0x62fe('0x51')]=integrations[_0x62fe('0x52')](_0x5936cd[_0x62fe('0x48')][_0x62fe('0x50')],_0x5936cd[_0x62fe('0x48')][_0x62fe('0x3d')]);return db['SugarcrmConfiguration'][_0x62fe('0x47')](_0x5936cd['body'],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0x62fe('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x291119,null))[_0x62fe('0x42')](handleError(_0x291119,null));};exports[_0x62fe('0x54')]=function(_0x5ad202,_0x1b3280,_0x50ad10){var _0x4bc223='';var _0x100572=['id',_0x62fe('0x29'),_0x62fe('0x55'),_0x62fe('0x56'),_0x62fe('0x57'),_0x62fe('0x58'),_0x62fe('0x59'),_0x62fe('0x5a'),_0x62fe('0x5b'),'parent_type',_0x62fe('0x5c'),_0x62fe('0x5d')];return db[_0x62fe('0x2d')][_0x62fe('0x4b')]({'where':{'id':_0x5ad202[_0x62fe('0x44')]['id']},'attributes':['id','username',_0x62fe('0x5e'),_0x62fe('0x5f')]})['then'](handleEntityNotFound(_0x1b3280,null))[_0x62fe('0x26')](function(_0x2a9981){if(_0x2a9981){_0x4bc223=_0x2a9981[_0x62fe('0x5f')];var _0x3736bb=_0x4bc223[_0x62fe('0x60')](-0x1);if(_0x3736bb==='/'){_0x4bc223=_0x4bc223[_0x62fe('0x61')](0x0,_0x4bc223[_0x62fe('0x62')](_0x3736bb));}return rp({'method':_0x62fe('0x63'),'uri':util[_0x62fe('0x64')]('%s%s',_0x4bc223,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x62fe('0x65'),'input_type':_0x62fe('0x66'),'response_type':_0x62fe('0x66'),'rest_data':JSON[_0x62fe('0x67')]({'user_auth':{'user_name':_0x2a9981['username'],'password':_0x2a9981['password'],'encryption':_0x62fe('0x68')},'application':_0x62fe('0x69')})}});}})[_0x62fe('0x26')](function(_0x1f9f56){if(_0x1f9f56&&_0x1f9f56[_0x62fe('0x29')]!==_0x62fe('0x6a')&&_0x1f9f56['name']!==_0x62fe('0x6b')){return rp({'method':_0x62fe('0x63'),'uri':util['format'](_0x62fe('0x6c'),_0x4bc223,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x62fe('0x6d'),'input_type':_0x62fe('0x66'),'response_type':_0x62fe('0x66'),'rest_data':JSON[_0x62fe('0x67')]({'session':_0x1f9f56['id'],'module_name':'Calls'})}})['then'](function(_0x578da1){if(_0x578da1){var _0x2a4081=_[_0x62fe('0x6e')](_0x578da1[_0x62fe('0x6f')]);_[_0x62fe('0x70')](_0x2a4081,function(_0x46560c){return _0x100572['includes'](_0x46560c[_0x62fe('0x29')]);});return{'count':_0x2a4081[_0x62fe('0x36')],'rows':_[_0x62fe('0x2c')](_0x2a4081,function(_0x5ceb2f){return{'id':_0x5ceb2f[_0x62fe('0x29')],'name':_0x5ceb2f[_0x62fe('0x71')],'custom':_[_0x62fe('0x72')](_0x5ceb2f[_0x62fe('0x29')],'_c')?!![]:![],'options':_0x5ceb2f[_0x62fe('0x3f')]?_[_0x62fe('0x2c')](_[_0x62fe('0x6e')](_0x5ceb2f[_0x62fe('0x3f')]),function(_0xdc05f6){return{'name':_0xdc05f6[_0x62fe('0x73')],'value':_0xdc05f6[_0x62fe('0x29')]};}):[]};})};}})[_0x62fe('0x26')](respondWithResult(_0x1b3280,null))[_0x62fe('0x42')](function(_0x169ded){var _0x4dece0=_0x5ad202[_0x62fe('0x30')][_0x62fe('0x74')]?0x1f4:_0x169ded[_0x62fe('0x75')]||0x1f4;logger['error'](_0x62fe('0x76'),'getFields',_0x4dece0,JSON['stringify'](_0x169ded));delete _0x169ded[_0x62fe('0x29')];if(_0x4dece0===0x191){_0x4dece0=0x190;}_0x1b3280[_0x62fe('0x1a')](_0x4dece0)[_0x62fe('0x2a')](_0x5ad202['query'][_0x62fe('0x74')]?{'message':_0x62fe('0x77'),'statusCode':_0x169ded['statusCode']}:_0x169ded);});}else{var _0x57ac2d=0x1f4;_0x1b3280[_0x62fe('0x1a')](_0x57ac2d)[_0x62fe('0x2a')]({'message':_0x62fe('0x77'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index aeac589..65a3571 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44a8=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x17a7fa,_0x5599b8){var _0x4669c1=function(_0x48685d){while(--_0x48685d){_0x17a7fa['push'](_0x17a7fa['shift']());}};_0x4669c1(++_0x5599b8);}(_0x44a8,0x8f));var _0x844a=function(_0x3109d6,_0x461617){_0x3109d6=_0x3109d6-0x0;var _0x3776b3=_0x44a8[_0x3109d6];return _0x3776b3;};'use strict';var _=require(_0x844a('0x0'));var util=require(_0x844a('0x1'));var logger=require(_0x844a('0x2'))(_0x844a('0x3'));var moment=require('moment');var BPromise=require(_0x844a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x844a('0x5'));var rimraf=require(_0x844a('0x6'));var config=require(_0x844a('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x844a('0x8'));module[_0x844a('0x9')]=function(_0x374a84,_0x19f881){return _0x374a84[_0x844a('0xa')](_0x844a('0xb'),attributes,{'tableName':_0x844a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27c2=['../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x2c16e8,_0x20eb85){var _0x4cec93=function(_0x333c1d){while(--_0x333c1d){_0x2c16e8['push'](_0x2c16e8['shift']());}};_0x4cec93(++_0x20eb85);}(_0x27c2,0x71));var _0x227c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x27c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x227c('0x0'));var util=require(_0x227c('0x1'));var logger=require(_0x227c('0x2'))(_0x227c('0x3'));var moment=require(_0x227c('0x4'));var BPromise=require(_0x227c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x227c('0x6'));var config=require(_0x227c('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x227c('0x8'));module[_0x227c('0x9')]=function(_0x3dcb55,_0x45ba86){return _0x3dcb55[_0x227c('0xa')](_0x227c('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 1616a06..bc14081 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ef9=['rpc','../../config/environment','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1bf7d3,_0xaceb98){var _0x39facd=function(_0x319806){while(--_0x319806){_0x1bf7d3['push'](_0x1bf7d3['shift']());}};_0x39facd(++_0xaceb98);}(_0x7ef9,0x65));var _0x97ef=function(_0x56acd3,_0x1b1121){_0x56acd3=_0x56acd3-0x0;var _0x1bfeb9=_0x7ef9[_0x56acd3];return _0x1bfeb9;};'use strict';var _=require(_0x97ef('0x0'));var util=require(_0x97ef('0x1'));var moment=require(_0x97ef('0x2'));var BPromise=require(_0x97ef('0x3'));var rs=require(_0x97ef('0x4'));var fs=require('fs');var Redis=require(_0x97ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x97ef('0x6'));var logger=require('../../config/logger')(_0x97ef('0x7'));var config=require(_0x97ef('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x97ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c618d,_0x19697e,_0x5d5aca){return new BPromise(function(_0x199578,_0x6e5593){return client[_0x97ef('0xa')](_0x3c618d,_0x5d5aca)[_0x97ef('0xb')](function(_0x9ed803){logger[_0x97ef('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x19697e,_0x97ef('0xd'));logger[_0x97ef('0xe')](_0x97ef('0xf'),_0x19697e,_0x97ef('0xd'),JSON[_0x97ef('0x10')](_0x9ed803));if(_0x9ed803['error']){if(_0x9ed803[_0x97ef('0x11')][_0x97ef('0x12')]===0x1f4){logger[_0x97ef('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x19697e,_0x9ed803[_0x97ef('0x11')][_0x97ef('0x13')]);return _0x6e5593(_0x9ed803['error']['message']);}logger[_0x97ef('0x11')](_0x97ef('0x14'),_0x19697e,_0x9ed803[_0x97ef('0x11')][_0x97ef('0x13')]);return _0x199578(_0x9ed803[_0x97ef('0x11')][_0x97ef('0x13')]);}else{logger[_0x97ef('0xc')](_0x97ef('0x14'),_0x19697e,_0x97ef('0xd'));_0x199578(_0x9ed803[_0x97ef('0x15')][_0x97ef('0x13')]);}})[_0x97ef('0x16')](function(_0x5ad014){logger['error'](_0x97ef('0x14'),_0x19697e,_0x5ad014);_0x6e5593(_0x5ad014);});});}exports[_0x97ef('0x17')]=function(_0x2a6bcf){var _0x312b7a=this;return new Promise(function(_0x17cdb2,_0x162ad5){return db[_0x97ef('0x18')][_0x97ef('0x19')]({'raw':_0x2a6bcf['options']?_0x2a6bcf[_0x97ef('0x1a')][_0x97ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a6bcf[_0x97ef('0x1a')]?_0x2a6bcf[_0x97ef('0x1a')][_0x97ef('0x1c')]||null:null,'attributes':_0x2a6bcf[_0x97ef('0x1a')]?_0x2a6bcf[_0x97ef('0x1a')][_0x97ef('0x1d')]||null:null,'limit':_0x2a6bcf['options']?_0x2a6bcf['options'][_0x97ef('0x1e')]||null:null,'include':_0x2a6bcf[_0x97ef('0x1a')]?_0x2a6bcf['options'][_0x97ef('0x1f')]?_[_0x97ef('0x20')](_0x2a6bcf[_0x97ef('0x1a')][_0x97ef('0x1f')],function(_0x1ace6a){return{'model':db[_0x1ace6a['model']],'as':_0x1ace6a['as'],'attributes':_0x1ace6a[_0x97ef('0x1d')],'include':_0x1ace6a[_0x97ef('0x1f')]?_[_0x97ef('0x20')](_0x1ace6a['include'],function(_0x332916){return{'model':db[_0x332916[_0x97ef('0x21')]],'as':_0x332916['as'],'attributes':_0x332916['attributes'],'include':_0x332916[_0x97ef('0x1f')]?_[_0x97ef('0x20')](_0x332916[_0x97ef('0x1f')],function(_0x6297d5){return{'model':db[_0x6297d5[_0x97ef('0x21')]],'as':_0x6297d5['as'],'attributes':_0x6297d5[_0x97ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x97ef('0xb')](function(_0x442256){logger[_0x97ef('0xc')](_0x97ef('0x17'),_0x2a6bcf);logger[_0x97ef('0xe')](_0x97ef('0x17'),_0x2a6bcf,JSON['stringify'](_0x442256));_0x17cdb2(_0x442256);})['catch'](function(_0x4101a0){logger[_0x97ef('0x11')](_0x97ef('0x17'),_0x4101a0[_0x97ef('0x13')],_0x2a6bcf);_0x162ad5(_0x312b7a[_0x97ef('0x11')](0x1f4,_0x4101a0[_0x97ef('0x13')]));});});};exports[_0x97ef('0x22')]=function(_0x1607ce){var _0x160e25=this;return new Promise(function(_0x21626b,_0xccb660){return db['SugarcrmAccount'][_0x97ef('0x23')]({'raw':_0x1607ce[_0x97ef('0x1a')]?_0x1607ce[_0x97ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1607ce[_0x97ef('0x1a')]?_0x1607ce[_0x97ef('0x1a')][_0x97ef('0x1c')]||null:null,'attributes':_0x1607ce[_0x97ef('0x1a')]?_0x1607ce[_0x97ef('0x1a')][_0x97ef('0x1d')]||null:null,'include':_0x1607ce[_0x97ef('0x1a')]?_0x1607ce[_0x97ef('0x1a')][_0x97ef('0x1f')]?_['map'](_0x1607ce[_0x97ef('0x1a')]['include'],function(_0x4a4485){return{'model':db[_0x4a4485['model']],'as':_0x4a4485['as'],'attributes':_0x4a4485['attributes'],'include':_0x4a4485['include']?_[_0x97ef('0x20')](_0x4a4485[_0x97ef('0x1f')],function(_0x5291a4){return{'model':db[_0x5291a4[_0x97ef('0x21')]],'as':_0x5291a4['as'],'attributes':_0x5291a4['attributes'],'include':_0x5291a4['include']?_[_0x97ef('0x20')](_0x5291a4[_0x97ef('0x1f')],function(_0x1c1479){return{'model':db[_0x1c1479[_0x97ef('0x21')]],'as':_0x1c1479['as'],'attributes':_0x1c1479[_0x97ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x97ef('0xb')](function(_0x3375f9){logger[_0x97ef('0xc')](_0x97ef('0x22'),_0x1607ce);logger[_0x97ef('0xe')]('ShowSugarcrmAccount',_0x1607ce,JSON[_0x97ef('0x10')](_0x3375f9));_0x21626b(_0x3375f9);})[_0x97ef('0x16')](function(_0x54e6bd){logger[_0x97ef('0x11')](_0x97ef('0x22'),_0x54e6bd[_0x97ef('0x13')],_0x1607ce);_0xccb660(_0x160e25['error'](0x1f4,_0x54e6bd[_0x97ef('0x13')]));});});}; \ No newline at end of file +var _0xfdec=['where','ShowSugarcrmAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','findAll','options','raw','attributes','include','map','model','then','GetSugarcrmAccount','catch'];(function(_0x518775,_0x31ef03){var _0x1bdb17=function(_0x20e0c9){while(--_0x20e0c9){_0x518775['push'](_0x518775['shift']());}};_0x1bdb17(++_0x31ef03);}(_0xfdec,0x176));var _0xcfde=function(_0x3e78f4,_0x5d4c9a){_0x3e78f4=_0x3e78f4-0x0;var _0x5ca5eb=_0xfdec[_0x3e78f4];return _0x5ca5eb;};'use strict';var _=require('lodash');var util=require(_0xcfde('0x0'));var moment=require(_0xcfde('0x1'));var BPromise=require(_0xcfde('0x2'));var rs=require(_0xcfde('0x3'));var fs=require('fs');var Redis=require(_0xcfde('0x4'));var db=require(_0xcfde('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfde('0x6'))('rpc');var config=require(_0xcfde('0x7'));var jayson=require(_0xcfde('0x8'));var client=jayson['client'][_0xcfde('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ca077,_0x56a061,_0x2be811){return new BPromise(function(_0x35c591,_0x2a1285){return client['request'](_0x3ca077,_0x2be811)['then'](function(_0x17cc10){logger[_0xcfde('0xa')](_0xcfde('0xb'),_0x56a061,_0xcfde('0xc'));logger[_0xcfde('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x56a061,_0xcfde('0xc'),JSON[_0xcfde('0xe')](_0x17cc10));if(_0x17cc10[_0xcfde('0xf')]){if(_0x17cc10[_0xcfde('0xf')][_0xcfde('0x10')]===0x1f4){logger[_0xcfde('0xf')](_0xcfde('0xb'),_0x56a061,_0x17cc10[_0xcfde('0xf')][_0xcfde('0x11')]);return _0x2a1285(_0x17cc10[_0xcfde('0xf')]['message']);}logger[_0xcfde('0xf')](_0xcfde('0xb'),_0x56a061,_0x17cc10[_0xcfde('0xf')][_0xcfde('0x11')]);return _0x35c591(_0x17cc10[_0xcfde('0xf')][_0xcfde('0x11')]);}else{logger[_0xcfde('0xa')](_0xcfde('0xb'),_0x56a061,_0xcfde('0xc'));_0x35c591(_0x17cc10[_0xcfde('0x12')][_0xcfde('0x11')]);}})['catch'](function(_0x423bd7){logger[_0xcfde('0xf')](_0xcfde('0xb'),_0x56a061,_0x423bd7);_0x2a1285(_0x423bd7);});});}exports['GetSugarcrmAccount']=function(_0x5aa127){var _0x33921b=this;return new Promise(function(_0x2c6b39,_0x22ae51){return db['SugarcrmAccount'][_0xcfde('0x13')]({'raw':_0x5aa127[_0xcfde('0x14')]?_0x5aa127['options'][_0xcfde('0x15')]===undefined?!![]:![]:!![],'where':_0x5aa127[_0xcfde('0x14')]?_0x5aa127[_0xcfde('0x14')]['where']||null:null,'attributes':_0x5aa127['options']?_0x5aa127['options'][_0xcfde('0x16')]||null:null,'limit':_0x5aa127[_0xcfde('0x14')]?_0x5aa127[_0xcfde('0x14')]['limit']||null:null,'include':_0x5aa127[_0xcfde('0x14')]?_0x5aa127[_0xcfde('0x14')][_0xcfde('0x17')]?_[_0xcfde('0x18')](_0x5aa127[_0xcfde('0x14')][_0xcfde('0x17')],function(_0x5f5080){return{'model':db[_0x5f5080['model']],'as':_0x5f5080['as'],'attributes':_0x5f5080[_0xcfde('0x16')],'include':_0x5f5080[_0xcfde('0x17')]?_[_0xcfde('0x18')](_0x5f5080[_0xcfde('0x17')],function(_0x3faec9){return{'model':db[_0x3faec9[_0xcfde('0x19')]],'as':_0x3faec9['as'],'attributes':_0x3faec9['attributes'],'include':_0x3faec9['include']?_[_0xcfde('0x18')](_0x3faec9['include'],function(_0xe7909b){return{'model':db[_0xe7909b[_0xcfde('0x19')]],'as':_0xe7909b['as'],'attributes':_0xe7909b['attributes']};}):[]};}):[]};}):[]:[]})[_0xcfde('0x1a')](function(_0x3ae82d){logger[_0xcfde('0xa')](_0xcfde('0x1b'),_0x5aa127);logger[_0xcfde('0xd')](_0xcfde('0x1b'),_0x5aa127,JSON[_0xcfde('0xe')](_0x3ae82d));_0x2c6b39(_0x3ae82d);})[_0xcfde('0x1c')](function(_0x4df6e1){logger[_0xcfde('0xf')](_0xcfde('0x1b'),_0x4df6e1[_0xcfde('0x11')],_0x5aa127);_0x22ae51(_0x33921b['error'](0x1f4,_0x4df6e1[_0xcfde('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0xead28e){var _0x2a94a2=this;return new Promise(function(_0x1c236f,_0x596a7a){return db['SugarcrmAccount']['find']({'raw':_0xead28e[_0xcfde('0x14')]?_0xead28e[_0xcfde('0x14')][_0xcfde('0x15')]===undefined?!![]:![]:!![],'where':_0xead28e[_0xcfde('0x14')]?_0xead28e[_0xcfde('0x14')][_0xcfde('0x1d')]||null:null,'attributes':_0xead28e[_0xcfde('0x14')]?_0xead28e[_0xcfde('0x14')][_0xcfde('0x16')]||null:null,'include':_0xead28e['options']?_0xead28e[_0xcfde('0x14')]['include']?_[_0xcfde('0x18')](_0xead28e[_0xcfde('0x14')]['include'],function(_0x1c7025){return{'model':db[_0x1c7025[_0xcfde('0x19')]],'as':_0x1c7025['as'],'attributes':_0x1c7025['attributes'],'include':_0x1c7025[_0xcfde('0x17')]?_[_0xcfde('0x18')](_0x1c7025[_0xcfde('0x17')],function(_0x34f032){return{'model':db[_0x34f032[_0xcfde('0x19')]],'as':_0x34f032['as'],'attributes':_0x34f032['attributes'],'include':_0x34f032[_0xcfde('0x17')]?_[_0xcfde('0x18')](_0x34f032[_0xcfde('0x17')],function(_0x266d6d){return{'model':db[_0x266d6d[_0xcfde('0x19')]],'as':_0x266d6d['as'],'attributes':_0x266d6d[_0xcfde('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a5cd2){logger[_0xcfde('0xa')](_0xcfde('0x1e'),_0xead28e);logger[_0xcfde('0xd')](_0xcfde('0x1e'),_0xead28e,JSON[_0xcfde('0xe')](_0x1a5cd2));_0x1c236f(_0x1a5cd2);})[_0xcfde('0x1c')](function(_0x53e08c){logger['error'](_0xcfde('0x1e'),_0x53e08c[_0xcfde('0x11')],_0xead28e);_0x596a7a(_0x2a94a2[_0xcfde('0xf')](0x1f4,_0x53e08c[_0xcfde('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 392497a..0be0a4e 100644 --- a/server/api/intSugarcrmConfiguration/index.js +++ b/server/api/intSugarcrmConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3eb=['../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2695ae,_0x42b3e8){var _0x498db5=function(_0x282b9a){while(--_0x282b9a){_0x2695ae['push'](_0x2695ae['shift']());}};_0x498db5(++_0x42b3e8);}(_0xb3eb,0xea));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbb3e('0x0'));var util=require('util');var path=require(_0xbb3e('0x1'));var timeout=require(_0xbb3e('0x2'));var express=require(_0xbb3e('0x3'));var router=express[_0xbb3e('0x4')]();var fs_extra=require(_0xbb3e('0x5'));var auth=require(_0xbb3e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb3e('0x7'));var controller=require(_0xbb3e('0x8'));router[_0xbb3e('0x9')]('/',auth[_0xbb3e('0xa')](),controller[_0xbb3e('0xb')]);router[_0xbb3e('0x9')](_0xbb3e('0xc'),auth[_0xbb3e('0xa')](),controller[_0xbb3e('0xd')]);router['get'](_0xbb3e('0xe'),auth[_0xbb3e('0xa')](),controller['getFields']);router[_0xbb3e('0x9')](_0xbb3e('0xf'),auth[_0xbb3e('0xa')](),controller['getSubjects']);router[_0xbb3e('0x9')](_0xbb3e('0x10'),auth[_0xbb3e('0xa')](),controller[_0xbb3e('0x11')]);router[_0xbb3e('0x12')]('/',auth['isAuthenticated'](),controller[_0xbb3e('0x13')]);router[_0xbb3e('0x14')](_0xbb3e('0xc'),auth['isAuthenticated'](),controller[_0xbb3e('0x15')]);router[_0xbb3e('0x16')](_0xbb3e('0xc'),auth[_0xbb3e('0xa')](),controller['destroy']);module[_0xbb3e('0x17')]=router; \ No newline at end of file +var _0x70b2=['isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x66bfe8,_0x5e10fb){var _0x16b08a=function(_0x2ef6a5){while(--_0x2ef6a5){_0x66bfe8['push'](_0x66bfe8['shift']());}};_0x16b08a(++_0x5e10fb);}(_0x70b2,0x6e));var _0x270b=function(_0x15584a,_0x5870db){_0x15584a=_0x15584a-0x0;var _0x50df3a=_0x70b2[_0x15584a];return _0x50df3a;};'use strict';var multer=require('multer');var util=require(_0x270b('0x0'));var path=require(_0x270b('0x1'));var timeout=require('connect-timeout');var express=require(_0x270b('0x2'));var router=express[_0x270b('0x3')]();var fs_extra=require(_0x270b('0x4'));var auth=require(_0x270b('0x5'));var interaction=require(_0x270b('0x6'));var config=require(_0x270b('0x7'));var controller=require(_0x270b('0x8'));router[_0x270b('0x9')]('/',auth[_0x270b('0xa')](),controller[_0x270b('0xb')]);router[_0x270b('0x9')](_0x270b('0xc'),auth[_0x270b('0xa')](),controller[_0x270b('0xd')]);router[_0x270b('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x270b('0xe'),auth[_0x270b('0xa')](),controller[_0x270b('0xf')]);router[_0x270b('0x9')](_0x270b('0x10'),auth[_0x270b('0xa')](),controller[_0x270b('0x11')]);router[_0x270b('0x12')]('/',auth[_0x270b('0xa')](),controller[_0x270b('0x13')]);router[_0x270b('0x14')](_0x270b('0xc'),auth[_0x270b('0xa')](),controller[_0x270b('0x15')]);router[_0x270b('0x16')](_0x270b('0xc'),auth[_0x270b('0xa')](),controller[_0x270b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 0216a09..d22c833 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9984=['exports','STRING','sequelize'];(function(_0x2a7cd1,_0x2119fe){var _0x16681c=function(_0x108dea){while(--_0x108dea){_0x2a7cd1['push'](_0x2a7cd1['shift']());}};_0x16681c(++_0x2119fe);}(_0x9984,0xd4));var _0x4998=function(_0x10a627,_0x35a21c){_0x10a627=_0x10a627-0x0;var _0x2149a4=_0x9984[_0x10a627];return _0x2149a4;};'use strict';var Sequelize=require(_0x4998('0x0'));module[_0x4998('0x1')]={'name':{'type':Sequelize[_0x4998('0x2')]},'description':{'type':Sequelize[_0x4998('0x2')]}}; \ No newline at end of file +var _0xbfcc=['STRING','sequelize','exports'];(function(_0x26bbd9,_0x27f48f){var _0x57849c=function(_0xf6039d){while(--_0xf6039d){_0x26bbd9['push'](_0x26bbd9['shift']());}};_0x57849c(++_0x27f48f);}(_0xbfcc,0x6d));var _0xcbfc=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0xbfcc[_0x20cb20];return _0x2fcf4b;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module[_0xcbfc('0x1')]={'name':{'type':Sequelize[_0xcbfc('0x2')]},'description':{'type':Sequelize[_0xcbfc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 300b820..6c78ca3 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ef2=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','SugarcrmConfiguration','include','findAll','rows','catch','show','fields','includeAll','find','create','body','params','destroy','getFields','findOne','SugarcrmField','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus'];(function(_0x579dad,_0x200a74){var _0x3a53fa=function(_0x373cc0){while(--_0x373cc0){_0x579dad['push'](_0x579dad['shift']());}};_0x3a53fa(++_0x200a74);}(_0x5ef2,0x81));var _0x25ef=function(_0x475080,_0x4560c5){_0x475080=_0x475080-0x0;var _0x2c756b=_0x5ef2[_0x475080];return _0x2c756b;};'use strict';var emlformat=require(_0x25ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25ef('0x1'));var jsonpatch=require(_0x25ef('0x2'));var rp=require(_0x25ef('0x3'));var moment=require('moment');var BPromise=require(_0x25ef('0x4'));var Mustache=require(_0x25ef('0x5'));var util=require(_0x25ef('0x6'));var path=require(_0x25ef('0x7'));var sox=require(_0x25ef('0x8'));var csv=require('to-csv');var ejs=require(_0x25ef('0x9'));var fs=require('fs');var fs_extra=require(_0x25ef('0xa'));var _=require(_0x25ef('0xb'));var squel=require(_0x25ef('0xc'));var crypto=require(_0x25ef('0xd'));var jsforce=require(_0x25ef('0xe'));var deskjs=require(_0x25ef('0xf'));var toCsv=require(_0x25ef('0x10'));var querystring=require(_0x25ef('0x11'));var Papa=require('papaparse');var Redis=require(_0x25ef('0x12'));var authService=require(_0x25ef('0x13'));var qs=require(_0x25ef('0x14'));var as=require(_0x25ef('0x15'));var hardwareService=require(_0x25ef('0x16'));var logger=require('../../config/logger')(_0x25ef('0x17'));var utils=require(_0x25ef('0x18'));var config=require(_0x25ef('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x302bb6,_0x569b03){_0x569b03=_0x569b03||0xcc;return function(_0x3dd5f3){if(_0x3dd5f3){return _0x302bb6['sendStatus'](_0x569b03);}return _0x302bb6[_0x25ef('0x1a')](_0x569b03)[_0x25ef('0x1b')]();};}function respondWithResult(_0x1714ef,_0x4b92c8){_0x4b92c8=_0x4b92c8||0xc8;return function(_0x2ff450){if(_0x2ff450){return _0x1714ef[_0x25ef('0x1a')](_0x4b92c8)[_0x25ef('0x1c')](_0x2ff450);}};}function respondWithFilteredResult(_0x2618cc,_0x400de3){return function(_0x1ac6a6){if(_0x1ac6a6){var _0x311789=typeof _0x400de3[_0x25ef('0x1d')]===_0x25ef('0x1e')&&typeof _0x400de3[_0x25ef('0x1f')]===_0x25ef('0x1e');var _0x3aa1ce=_0x1ac6a6[_0x25ef('0x20')];var _0xd351a9=_0x311789?0x0:_0x400de3[_0x25ef('0x1d')];var _0x5c99b9=_0x311789?_0x1ac6a6['count']:_0x400de3[_0x25ef('0x1d')]+_0x400de3[_0x25ef('0x1f')];var _0x297845;if(_0x5c99b9>=_0x3aa1ce){_0x5c99b9=_0x3aa1ce;_0x297845=0xc8;}else{_0x297845=0xce;}_0x2618cc[_0x25ef('0x1a')](_0x297845);return _0x2618cc[_0x25ef('0x21')](_0x25ef('0x22'),_0xd351a9+'-'+_0x5c99b9+'/'+_0x3aa1ce)[_0x25ef('0x1c')](_0x1ac6a6);}return null;};}function patchUpdates(_0x52616c){return function(_0x3b3832){try{jsonpatch['apply'](_0x3b3832,_0x52616c,!![]);}catch(_0xc27d4f){return BPromise[_0x25ef('0x23')](_0xc27d4f);}return _0x3b3832[_0x25ef('0x24')]();};}function saveUpdates(_0x2c2ad3,_0x3de520){return function(_0x9d2882){if(_0x9d2882){return _0x9d2882['update'](_0x2c2ad3)[_0x25ef('0x25')](function(_0x10bd82){return _0x10bd82;});}return null;};}function removeEntity(_0x25bbc4,_0x56b7d4){return function(_0x57b40d){if(_0x57b40d){return _0x57b40d['destroy']()[_0x25ef('0x25')](function(){_0x25bbc4['status'](0xcc)[_0x25ef('0x1b')]();});}};}function handleEntityNotFound(_0x5e7077,_0xfa824e){return function(_0x3b6907){if(!_0x3b6907){_0x5e7077[_0x25ef('0x26')](0x194);}return _0x3b6907;};}function handleError(_0x98af3,_0x5cea07){_0x5cea07=_0x5cea07||0x1f4;return function(_0x279100){logger[_0x25ef('0x27')](_0x279100[_0x25ef('0x28')]);if(_0x279100[_0x25ef('0x29')]){delete _0x279100[_0x25ef('0x29')];}_0x98af3[_0x25ef('0x1a')](_0x5cea07)[_0x25ef('0x2a')](_0x279100);};}exports[_0x25ef('0x2b')]=function(_0xa14798,_0x3c4f57){var _0x1017d1={},_0x4010ed={},_0x32514b={'count':0x0,'rows':[]};var _0x447ff5=_[_0x25ef('0x2c')](db['SugarcrmConfiguration'][_0x25ef('0x2d')],function(_0xe54ba0){return{'name':_0xe54ba0[_0x25ef('0x2e')],'type':_0xe54ba0[_0x25ef('0x2f')][_0x25ef('0x30')]};});_0x4010ed[_0x25ef('0x31')]=_[_0x25ef('0x2c')](_0x447ff5,'name');_0x4010ed['query']=_[_0x25ef('0x32')](_0xa14798[_0x25ef('0x33')]);_0x4010ed['filters']=_[_0x25ef('0x34')](_0x4010ed['model'],_0x4010ed['query']);_0x1017d1[_0x25ef('0x35')]=_[_0x25ef('0x34')](_0x4010ed[_0x25ef('0x31')],qs['fields'](_0xa14798[_0x25ef('0x33')]['fields']));_0x1017d1[_0x25ef('0x35')]=_0x1017d1[_0x25ef('0x35')][_0x25ef('0x36')]?_0x1017d1[_0x25ef('0x35')]:_0x4010ed[_0x25ef('0x31')];if(!_0xa14798[_0x25ef('0x33')]['hasOwnProperty'](_0x25ef('0x37'))){_0x1017d1[_0x25ef('0x1f')]=qs['limit'](_0xa14798['query'][_0x25ef('0x1f')]);_0x1017d1[_0x25ef('0x1d')]=qs[_0x25ef('0x1d')](_0xa14798[_0x25ef('0x33')][_0x25ef('0x1d')]);}_0x1017d1[_0x25ef('0x38')]=qs[_0x25ef('0x39')](_0xa14798[_0x25ef('0x33')]['sort']);_0x1017d1[_0x25ef('0x3a')]=qs['filters'](_[_0x25ef('0x3b')](_0xa14798[_0x25ef('0x33')],_0x4010ed[_0x25ef('0x3c')]),_0x447ff5);if(_0xa14798['query'][_0x25ef('0x3d')]){_0x1017d1[_0x25ef('0x3a')]=_['merge'](_0x1017d1[_0x25ef('0x3a')],{'$or':_['map'](_0x447ff5,function(_0x3f4c4c){if(_0x3f4c4c[_0x25ef('0x2f')]!==_0x25ef('0x3e')){var _0x28a78c={};_0x28a78c[_0x3f4c4c['name']]={'$like':'%'+_0xa14798['query']['filter']+'%'};return _0x28a78c;}})});}_0x1017d1=_[_0x25ef('0x3f')]({},_0x1017d1,_0xa14798[_0x25ef('0x40')]);var _0x54bd1a={'where':_0x1017d1[_0x25ef('0x3a')]};return db[_0x25ef('0x41')][_0x25ef('0x20')](_0x54bd1a)['then'](function(_0x9f5439){_0x32514b[_0x25ef('0x20')]=_0x9f5439;if(_0xa14798[_0x25ef('0x33')]['includeAll']){_0x1017d1[_0x25ef('0x42')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x25ef('0x43')](_0x1017d1);})[_0x25ef('0x25')](function(_0x4c45ad){_0x32514b[_0x25ef('0x44')]=_0x4c45ad;return _0x32514b;})[_0x25ef('0x25')](respondWithFilteredResult(_0x3c4f57,_0x1017d1))[_0x25ef('0x45')](handleError(_0x3c4f57,null));};exports[_0x25ef('0x46')]=function(_0xaf4e6e,_0x4dc850){var _0x9cd0b3={'raw':![],'where':{'id':_0xaf4e6e['params']['id']}},_0x4343a7={};_0x4343a7[_0x25ef('0x31')]=_[_0x25ef('0x32')](db[_0x25ef('0x41')][_0x25ef('0x2d')]);_0x4343a7[_0x25ef('0x33')]=_['keys'](_0xaf4e6e[_0x25ef('0x33')]);_0x4343a7[_0x25ef('0x3c')]=_[_0x25ef('0x34')](_0x4343a7['model'],_0x4343a7[_0x25ef('0x33')]);_0x9cd0b3[_0x25ef('0x35')]=_['intersection'](_0x4343a7[_0x25ef('0x31')],qs[_0x25ef('0x47')](_0xaf4e6e['query']['fields']));_0x9cd0b3[_0x25ef('0x35')]=_0x9cd0b3['attributes']['length']?_0x9cd0b3[_0x25ef('0x35')]:_0x4343a7[_0x25ef('0x31')];if(_0xaf4e6e[_0x25ef('0x33')][_0x25ef('0x48')]){_0x9cd0b3[_0x25ef('0x42')]=[{'all':!![]}];}_0x9cd0b3=_[_0x25ef('0x3f')]({},_0x9cd0b3,_0xaf4e6e['options']);return db[_0x25ef('0x41')][_0x25ef('0x49')](_0x9cd0b3)['then'](handleEntityNotFound(_0x4dc850,null))['then'](respondWithResult(_0x4dc850,null))[_0x25ef('0x45')](handleError(_0x4dc850,null));};exports[_0x25ef('0x4a')]=function(_0x45bedf,_0x326741){return db[_0x25ef('0x41')][_0x25ef('0x4a')](_0x45bedf['body'],{})['then'](respondWithResult(_0x326741,0xc9))[_0x25ef('0x45')](handleError(_0x326741,null));};exports['update']=function(_0x2ddee7,_0x11ccbc){if(_0x2ddee7['body']['id']){delete _0x2ddee7[_0x25ef('0x4b')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2ddee7[_0x25ef('0x4c')]['id']}})[_0x25ef('0x25')](handleEntityNotFound(_0x11ccbc,null))[_0x25ef('0x25')](saveUpdates(_0x2ddee7['body'],null))['then'](respondWithResult(_0x11ccbc,null))[_0x25ef('0x45')](handleError(_0x11ccbc,null));};exports[_0x25ef('0x4d')]=function(_0x5b9a89,_0x3bf2e6){return db[_0x25ef('0x41')]['find']({'where':{'id':_0x5b9a89[_0x25ef('0x4c')]['id']}})[_0x25ef('0x25')](handleEntityNotFound(_0x3bf2e6,null))[_0x25ef('0x25')](removeEntity(_0x3bf2e6,null))[_0x25ef('0x45')](handleError(_0x3bf2e6,null));};exports[_0x25ef('0x4e')]=function(_0x189c04,_0x4173fe,_0x759f41){var _0x4469f1={};var _0x1e3e1c={};var _0x1f924c;var _0x588ad9;return db[_0x25ef('0x41')][_0x25ef('0x4f')]({'where':{'id':_0x189c04[_0x25ef('0x4c')]['id']}})[_0x25ef('0x25')](handleEntityNotFound(_0x4173fe,null))[_0x25ef('0x25')](function(_0x494e4d){if(_0x494e4d){_0x1f924c=_0x494e4d;_0x1e3e1c[_0x25ef('0x31')]=_['keys'](db[_0x25ef('0x50')][_0x25ef('0x2d')]);_0x1e3e1c['query']=_['keys'](_0x189c04['query']);_0x1e3e1c[_0x25ef('0x3c')]=_[_0x25ef('0x34')](_0x1e3e1c[_0x25ef('0x31')],_0x1e3e1c[_0x25ef('0x33')]);_0x4469f1[_0x25ef('0x35')]=_['intersection'](_0x1e3e1c[_0x25ef('0x31')],qs[_0x25ef('0x47')](_0x189c04[_0x25ef('0x33')][_0x25ef('0x47')]));_0x4469f1['attributes']=_0x4469f1['attributes'][_0x25ef('0x36')]?_0x4469f1[_0x25ef('0x35')]:_0x1e3e1c[_0x25ef('0x31')];_0x4469f1[_0x25ef('0x38')]=qs[_0x25ef('0x39')](_0x189c04[_0x25ef('0x33')][_0x25ef('0x39')]);_0x4469f1[_0x25ef('0x3a')]=qs['filters'](_[_0x25ef('0x3b')](_0x189c04['query'],_0x1e3e1c[_0x25ef('0x3c')]));if(_0x189c04['query'][_0x25ef('0x3d')]){_0x4469f1[_0x25ef('0x3a')]=_[_0x25ef('0x3f')](_0x4469f1[_0x25ef('0x3a')],{'$or':_[_0x25ef('0x2c')](_0x4469f1[_0x25ef('0x35')],function(_0x12b5c2){var _0x1ae841={};_0x1ae841[_0x12b5c2]={'$like':'%'+_0x189c04[_0x25ef('0x33')][_0x25ef('0x3d')]+'%'};return _0x1ae841;})});}_0x4469f1=_[_0x25ef('0x3f')]({},_0x4469f1,_0x189c04[_0x25ef('0x40')]);return _0x1f924c[_0x25ef('0x4e')](_0x4469f1);}})[_0x25ef('0x25')](function(_0x41d850){if(_0x41d850){_0x588ad9=_0x41d850[_0x25ef('0x36')];if(!_0x189c04[_0x25ef('0x33')]['hasOwnProperty']('nolimit')){_0x4469f1[_0x25ef('0x1f')]=qs[_0x25ef('0x1f')](_0x189c04[_0x25ef('0x33')][_0x25ef('0x1f')]);_0x4469f1[_0x25ef('0x1d')]=qs[_0x25ef('0x1d')](_0x189c04[_0x25ef('0x33')][_0x25ef('0x1d')]);}return _0x1f924c[_0x25ef('0x4e')](_0x4469f1);}})[_0x25ef('0x25')](function(_0x1b120f){if(_0x1b120f){return _0x1b120f?{'count':_0x588ad9,'rows':_0x1b120f}:null;}})['then'](respondWithResult(_0x4173fe,null))['catch'](handleError(_0x4173fe,null));};exports[_0x25ef('0x51')]=function(_0x4aa20d,_0x37233c,_0x385baf){var _0xa6bcf7={};var _0x2431d0={};var _0x513aa4;var _0x212863;return db[_0x25ef('0x41')][_0x25ef('0x4f')]({'where':{'id':_0x4aa20d[_0x25ef('0x4c')]['id']}})[_0x25ef('0x25')](handleEntityNotFound(_0x37233c,null))[_0x25ef('0x25')](function(_0x36ae12){if(_0x36ae12){_0x513aa4=_0x36ae12;_0x2431d0[_0x25ef('0x31')]=_['keys'](db[_0x25ef('0x50')]['rawAttributes']);_0x2431d0[_0x25ef('0x33')]=_[_0x25ef('0x32')](_0x4aa20d[_0x25ef('0x33')]);_0x2431d0[_0x25ef('0x3c')]=_[_0x25ef('0x34')](_0x2431d0['model'],_0x2431d0[_0x25ef('0x33')]);_0xa6bcf7['attributes']=_[_0x25ef('0x34')](_0x2431d0[_0x25ef('0x31')],qs[_0x25ef('0x47')](_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x47')]));_0xa6bcf7[_0x25ef('0x35')]=_0xa6bcf7[_0x25ef('0x35')][_0x25ef('0x36')]?_0xa6bcf7[_0x25ef('0x35')]:_0x2431d0[_0x25ef('0x31')];_0xa6bcf7[_0x25ef('0x38')]=qs['sort'](_0x4aa20d['query']['sort']);_0xa6bcf7[_0x25ef('0x3a')]=qs['filters'](_['pick'](_0x4aa20d[_0x25ef('0x33')],_0x2431d0[_0x25ef('0x3c')]));if(_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x3d')]){_0xa6bcf7[_0x25ef('0x3a')]=_[_0x25ef('0x3f')](_0xa6bcf7[_0x25ef('0x3a')],{'$or':_[_0x25ef('0x2c')](_0xa6bcf7['attributes'],function(_0x1f07a6){var _0x20d485={};_0x20d485[_0x1f07a6]={'$like':'%'+_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x3d')]+'%'};return _0x20d485;})});}_0xa6bcf7=_[_0x25ef('0x3f')]({},_0xa6bcf7,_0x4aa20d[_0x25ef('0x40')]);return _0x513aa4[_0x25ef('0x51')](_0xa6bcf7);}})[_0x25ef('0x25')](function(_0x5f136b){if(_0x5f136b){_0x212863=_0x5f136b['length'];if(!_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x52')](_0x25ef('0x37'))){_0xa6bcf7[_0x25ef('0x1f')]=qs[_0x25ef('0x1f')](_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x1f')]);_0xa6bcf7[_0x25ef('0x1d')]=qs[_0x25ef('0x1d')](_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x1d')]);}return _0x513aa4[_0x25ef('0x51')](_0xa6bcf7);}})['then'](function(_0x56bd56){if(_0x56bd56){return _0x56bd56?{'count':_0x212863,'rows':_0x56bd56}:null;}})['then'](respondWithResult(_0x37233c,null))[_0x25ef('0x45')](handleError(_0x37233c,null));};exports[_0x25ef('0x53')]=function(_0xd7d7cf,_0x1079f7,_0x206ad6){var _0x487f79={};var _0x2b305a={};var _0x40a8cd;var _0x13076e;return db[_0x25ef('0x41')][_0x25ef('0x4f')]({'where':{'id':_0xd7d7cf['params']['id']}})['then'](handleEntityNotFound(_0x1079f7,null))[_0x25ef('0x25')](function(_0x1c4eda){if(_0x1c4eda){_0x40a8cd=_0x1c4eda;_0x2b305a[_0x25ef('0x31')]=_['keys'](db[_0x25ef('0x50')]['rawAttributes']);_0x2b305a['query']=_['keys'](_0xd7d7cf[_0x25ef('0x33')]);_0x2b305a[_0x25ef('0x3c')]=_['intersection'](_0x2b305a['model'],_0x2b305a[_0x25ef('0x33')]);_0x487f79['attributes']=_[_0x25ef('0x34')](_0x2b305a['model'],qs[_0x25ef('0x47')](_0xd7d7cf[_0x25ef('0x33')]['fields']));_0x487f79['attributes']=_0x487f79['attributes'][_0x25ef('0x36')]?_0x487f79['attributes']:_0x2b305a[_0x25ef('0x31')];_0x487f79[_0x25ef('0x38')]=qs[_0x25ef('0x39')](_0xd7d7cf[_0x25ef('0x33')][_0x25ef('0x39')]);_0x487f79[_0x25ef('0x3a')]=qs[_0x25ef('0x3c')](_[_0x25ef('0x3b')](_0xd7d7cf['query'],_0x2b305a['filters']));if(_0xd7d7cf[_0x25ef('0x33')][_0x25ef('0x3d')]){_0x487f79[_0x25ef('0x3a')]=_['merge'](_0x487f79[_0x25ef('0x3a')],{'$or':_[_0x25ef('0x2c')](_0x487f79[_0x25ef('0x35')],function(_0x28ce8e){var _0x3b137d={};_0x3b137d[_0x28ce8e]={'$like':'%'+_0xd7d7cf[_0x25ef('0x33')][_0x25ef('0x3d')]+'%'};return _0x3b137d;})});}_0x487f79=_[_0x25ef('0x3f')]({},_0x487f79,_0xd7d7cf[_0x25ef('0x40')]);return _0x40a8cd[_0x25ef('0x53')](_0x487f79);}})[_0x25ef('0x25')](function(_0x1ceed9){if(_0x1ceed9){_0x13076e=_0x1ceed9[_0x25ef('0x36')];if(!_0xd7d7cf[_0x25ef('0x33')][_0x25ef('0x52')](_0x25ef('0x37'))){_0x487f79[_0x25ef('0x1f')]=qs['limit'](_0xd7d7cf[_0x25ef('0x33')][_0x25ef('0x1f')]);_0x487f79[_0x25ef('0x1d')]=qs[_0x25ef('0x1d')](_0xd7d7cf[_0x25ef('0x33')]['offset']);}return _0x40a8cd[_0x25ef('0x53')](_0x487f79);}})['then'](function(_0x4ae13c){if(_0x4ae13c){return _0x4ae13c?{'count':_0x13076e,'rows':_0x4ae13c}:null;}})['then'](respondWithResult(_0x1079f7,null))['catch'](handleError(_0x1079f7,null));}; \ No newline at end of file +var _0xfe24=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','name','send','index','SugarcrmConfiguration','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SugarcrmField','filters','hasOwnProperty','getSubjects','getDescriptions','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis'];(function(_0x1a21d4,_0x42f41a){var _0x2434a9=function(_0x564512){while(--_0x564512){_0x1a21d4['push'](_0x1a21d4['shift']());}};_0x2434a9(++_0x42f41a);}(_0xfe24,0x129));var _0x4fe2=function(_0x42234e,_0x556ec2){_0x42234e=_0x42234e-0x0;var _0x3d8cf2=_0xfe24[_0x42234e];return _0x3d8cf2;};'use strict';var emlformat=require(_0x4fe2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4fe2('0x1'));var rp=require('request-promise');var moment=require(_0x4fe2('0x2'));var BPromise=require(_0x4fe2('0x3'));var Mustache=require(_0x4fe2('0x4'));var util=require(_0x4fe2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4fe2('0x6'));var ejs=require(_0x4fe2('0x7'));var fs=require('fs');var fs_extra=require(_0x4fe2('0x8'));var _=require(_0x4fe2('0x9'));var squel=require(_0x4fe2('0xa'));var crypto=require(_0x4fe2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4fe2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4fe2('0xd'));var Redis=require(_0x4fe2('0xe'));var authService=require(_0x4fe2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4fe2('0x10'));var hardwareService=require(_0x4fe2('0x11'));var logger=require(_0x4fe2('0x12'))(_0x4fe2('0x13'));var utils=require(_0x4fe2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4fe2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27f020,_0x4637d8){_0x4637d8=_0x4637d8||0xcc;return function(_0x3a5ff3){if(_0x3a5ff3){return _0x27f020[_0x4fe2('0x16')](_0x4637d8);}return _0x27f020[_0x4fe2('0x17')](_0x4637d8)[_0x4fe2('0x18')]();};}function respondWithResult(_0x35b231,_0x2e23d4){_0x2e23d4=_0x2e23d4||0xc8;return function(_0x1ec93e){if(_0x1ec93e){return _0x35b231[_0x4fe2('0x17')](_0x2e23d4)[_0x4fe2('0x19')](_0x1ec93e);}};}function respondWithFilteredResult(_0x588711,_0x41db10){return function(_0x477143){if(_0x477143){var _0x555074=typeof _0x41db10[_0x4fe2('0x1a')]===_0x4fe2('0x1b')&&typeof _0x41db10[_0x4fe2('0x1c')]===_0x4fe2('0x1b');var _0x159f8c=_0x477143[_0x4fe2('0x1d')];var _0x2079d0=_0x555074?0x0:_0x41db10[_0x4fe2('0x1a')];var _0x103e40=_0x555074?_0x477143[_0x4fe2('0x1d')]:_0x41db10[_0x4fe2('0x1a')]+_0x41db10[_0x4fe2('0x1c')];var _0x49332c;if(_0x103e40>=_0x159f8c){_0x103e40=_0x159f8c;_0x49332c=0xc8;}else{_0x49332c=0xce;}_0x588711[_0x4fe2('0x17')](_0x49332c);return _0x588711[_0x4fe2('0x1e')]('Content-Range',_0x2079d0+'-'+_0x103e40+'/'+_0x159f8c)[_0x4fe2('0x19')](_0x477143);}return null;};}function patchUpdates(_0x1ccccd){return function(_0x4f2285){try{jsonpatch['apply'](_0x4f2285,_0x1ccccd,!![]);}catch(_0x3156be){return BPromise[_0x4fe2('0x1f')](_0x3156be);}return _0x4f2285[_0x4fe2('0x20')]();};}function saveUpdates(_0x2a8e49,_0xa8cf74){return function(_0x32f103){if(_0x32f103){return _0x32f103[_0x4fe2('0x21')](_0x2a8e49)['then'](function(_0x47daeb){return _0x47daeb;});}return null;};}function removeEntity(_0x6ccac3,_0x2fa9d0){return function(_0x407fed){if(_0x407fed){return _0x407fed[_0x4fe2('0x22')]()[_0x4fe2('0x23')](function(){_0x6ccac3['status'](0xcc)[_0x4fe2('0x18')]();});}};}function handleEntityNotFound(_0xfd8374,_0x30a857){return function(_0x131619){if(!_0x131619){_0xfd8374[_0x4fe2('0x16')](0x194);}return _0x131619;};}function handleError(_0x292d43,_0x2f089f){_0x2f089f=_0x2f089f||0x1f4;return function(_0xc5394e){logger[_0x4fe2('0x24')](_0xc5394e['stack']);if(_0xc5394e[_0x4fe2('0x25')]){delete _0xc5394e[_0x4fe2('0x25')];}_0x292d43[_0x4fe2('0x17')](_0x2f089f)[_0x4fe2('0x26')](_0xc5394e);};}exports[_0x4fe2('0x27')]=function(_0x575318,_0xe92c48){var _0x1386c6={},_0x325dce={},_0x55222e={'count':0x0,'rows':[]};var _0x464879=_['map'](db[_0x4fe2('0x28')][_0x4fe2('0x29')],function(_0x4f4730){return{'name':_0x4f4730['fieldName'],'type':_0x4f4730[_0x4fe2('0x2a')][_0x4fe2('0x2b')]};});_0x325dce[_0x4fe2('0x2c')]=_[_0x4fe2('0x2d')](_0x464879,_0x4fe2('0x25'));_0x325dce[_0x4fe2('0x2e')]=_[_0x4fe2('0x2f')](_0x575318[_0x4fe2('0x2e')]);_0x325dce['filters']=_['intersection'](_0x325dce[_0x4fe2('0x2c')],_0x325dce[_0x4fe2('0x2e')]);_0x1386c6[_0x4fe2('0x30')]=_[_0x4fe2('0x31')](_0x325dce[_0x4fe2('0x2c')],qs[_0x4fe2('0x32')](_0x575318['query'][_0x4fe2('0x32')]));_0x1386c6[_0x4fe2('0x30')]=_0x1386c6['attributes'][_0x4fe2('0x33')]?_0x1386c6['attributes']:_0x325dce[_0x4fe2('0x2c')];if(!_0x575318[_0x4fe2('0x2e')]['hasOwnProperty'](_0x4fe2('0x34'))){_0x1386c6[_0x4fe2('0x1c')]=qs[_0x4fe2('0x1c')](_0x575318[_0x4fe2('0x2e')]['limit']);_0x1386c6[_0x4fe2('0x1a')]=qs[_0x4fe2('0x1a')](_0x575318[_0x4fe2('0x2e')][_0x4fe2('0x1a')]);}_0x1386c6[_0x4fe2('0x35')]=qs[_0x4fe2('0x36')](_0x575318[_0x4fe2('0x2e')][_0x4fe2('0x36')]);_0x1386c6[_0x4fe2('0x37')]=qs['filters'](_[_0x4fe2('0x38')](_0x575318[_0x4fe2('0x2e')],_0x325dce['filters']),_0x464879);if(_0x575318[_0x4fe2('0x2e')]['filter']){_0x1386c6[_0x4fe2('0x37')]=_[_0x4fe2('0x39')](_0x1386c6[_0x4fe2('0x37')],{'$or':_['map'](_0x464879,function(_0x372f9e){if(_0x372f9e[_0x4fe2('0x2a')]!==_0x4fe2('0x3a')){var _0x56711b={};_0x56711b[_0x372f9e[_0x4fe2('0x25')]]={'$like':'%'+_0x575318[_0x4fe2('0x2e')][_0x4fe2('0x3b')]+'%'};return _0x56711b;}})});}_0x1386c6=_[_0x4fe2('0x39')]({},_0x1386c6,_0x575318[_0x4fe2('0x3c')]);var _0x5e0caa={'where':_0x1386c6[_0x4fe2('0x37')]};return db[_0x4fe2('0x28')][_0x4fe2('0x1d')](_0x5e0caa)['then'](function(_0x304a40){_0x55222e[_0x4fe2('0x1d')]=_0x304a40;if(_0x575318[_0x4fe2('0x2e')][_0x4fe2('0x3d')]){_0x1386c6[_0x4fe2('0x3e')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x4fe2('0x3f')](_0x1386c6);})[_0x4fe2('0x23')](function(_0x629505){_0x55222e[_0x4fe2('0x40')]=_0x629505;return _0x55222e;})[_0x4fe2('0x23')](respondWithFilteredResult(_0xe92c48,_0x1386c6))[_0x4fe2('0x41')](handleError(_0xe92c48,null));};exports[_0x4fe2('0x42')]=function(_0x27357f,_0x182a69){var _0x11a2f={'raw':![],'where':{'id':_0x27357f[_0x4fe2('0x43')]['id']}},_0x238c6e={};_0x238c6e['model']=_[_0x4fe2('0x2f')](db[_0x4fe2('0x28')][_0x4fe2('0x29')]);_0x238c6e['query']=_[_0x4fe2('0x2f')](_0x27357f[_0x4fe2('0x2e')]);_0x238c6e['filters']=_[_0x4fe2('0x31')](_0x238c6e['model'],_0x238c6e[_0x4fe2('0x2e')]);_0x11a2f[_0x4fe2('0x30')]=_[_0x4fe2('0x31')](_0x238c6e['model'],qs['fields'](_0x27357f[_0x4fe2('0x2e')]['fields']));_0x11a2f[_0x4fe2('0x30')]=_0x11a2f[_0x4fe2('0x30')][_0x4fe2('0x33')]?_0x11a2f[_0x4fe2('0x30')]:_0x238c6e['model'];if(_0x27357f['query']['includeAll']){_0x11a2f[_0x4fe2('0x3e')]=[{'all':!![]}];}_0x11a2f=_[_0x4fe2('0x39')]({},_0x11a2f,_0x27357f[_0x4fe2('0x3c')]);return db[_0x4fe2('0x28')][_0x4fe2('0x44')](_0x11a2f)[_0x4fe2('0x23')](handleEntityNotFound(_0x182a69,null))[_0x4fe2('0x23')](respondWithResult(_0x182a69,null))['catch'](handleError(_0x182a69,null));};exports[_0x4fe2('0x45')]=function(_0x170112,_0x529a73){return db[_0x4fe2('0x28')][_0x4fe2('0x45')](_0x170112[_0x4fe2('0x46')],{})['then'](respondWithResult(_0x529a73,0xc9))[_0x4fe2('0x41')](handleError(_0x529a73,null));};exports[_0x4fe2('0x21')]=function(_0x4ec6b8,_0x281afb){if(_0x4ec6b8[_0x4fe2('0x46')]['id']){delete _0x4ec6b8[_0x4fe2('0x46')]['id'];}return db[_0x4fe2('0x28')][_0x4fe2('0x44')]({'where':{'id':_0x4ec6b8[_0x4fe2('0x43')]['id']}})[_0x4fe2('0x23')](handleEntityNotFound(_0x281afb,null))[_0x4fe2('0x23')](saveUpdates(_0x4ec6b8[_0x4fe2('0x46')],null))[_0x4fe2('0x23')](respondWithResult(_0x281afb,null))[_0x4fe2('0x41')](handleError(_0x281afb,null));};exports[_0x4fe2('0x22')]=function(_0x5c5820,_0x34b6cd){return db['SugarcrmConfiguration'][_0x4fe2('0x44')]({'where':{'id':_0x5c5820['params']['id']}})[_0x4fe2('0x23')](handleEntityNotFound(_0x34b6cd,null))[_0x4fe2('0x23')](removeEntity(_0x34b6cd,null))['catch'](handleError(_0x34b6cd,null));};exports[_0x4fe2('0x47')]=function(_0x10b7c3,_0x535363,_0x5e2af8){var _0x599d79={};var _0x4d369e={};var _0x3da89d;var _0x335511;return db[_0x4fe2('0x28')][_0x4fe2('0x48')]({'where':{'id':_0x10b7c3[_0x4fe2('0x43')]['id']}})[_0x4fe2('0x23')](handleEntityNotFound(_0x535363,null))[_0x4fe2('0x23')](function(_0x461736){if(_0x461736){_0x3da89d=_0x461736;_0x4d369e['model']=_[_0x4fe2('0x2f')](db[_0x4fe2('0x49')]['rawAttributes']);_0x4d369e[_0x4fe2('0x2e')]=_[_0x4fe2('0x2f')](_0x10b7c3[_0x4fe2('0x2e')]);_0x4d369e[_0x4fe2('0x4a')]=_[_0x4fe2('0x31')](_0x4d369e['model'],_0x4d369e[_0x4fe2('0x2e')]);_0x599d79[_0x4fe2('0x30')]=_[_0x4fe2('0x31')](_0x4d369e['model'],qs[_0x4fe2('0x32')](_0x10b7c3[_0x4fe2('0x2e')][_0x4fe2('0x32')]));_0x599d79[_0x4fe2('0x30')]=_0x599d79['attributes'][_0x4fe2('0x33')]?_0x599d79[_0x4fe2('0x30')]:_0x4d369e[_0x4fe2('0x2c')];_0x599d79['order']=qs['sort'](_0x10b7c3['query'][_0x4fe2('0x36')]);_0x599d79[_0x4fe2('0x37')]=qs['filters'](_[_0x4fe2('0x38')](_0x10b7c3['query'],_0x4d369e[_0x4fe2('0x4a')]));if(_0x10b7c3[_0x4fe2('0x2e')]['filter']){_0x599d79[_0x4fe2('0x37')]=_['merge'](_0x599d79[_0x4fe2('0x37')],{'$or':_['map'](_0x599d79[_0x4fe2('0x30')],function(_0x44309a){var _0x104d90={};_0x104d90[_0x44309a]={'$like':'%'+_0x10b7c3[_0x4fe2('0x2e')][_0x4fe2('0x3b')]+'%'};return _0x104d90;})});}_0x599d79=_[_0x4fe2('0x39')]({},_0x599d79,_0x10b7c3[_0x4fe2('0x3c')]);return _0x3da89d[_0x4fe2('0x47')](_0x599d79);}})[_0x4fe2('0x23')](function(_0x5cd10c){if(_0x5cd10c){_0x335511=_0x5cd10c['length'];if(!_0x10b7c3[_0x4fe2('0x2e')][_0x4fe2('0x4b')](_0x4fe2('0x34'))){_0x599d79[_0x4fe2('0x1c')]=qs['limit'](_0x10b7c3[_0x4fe2('0x2e')][_0x4fe2('0x1c')]);_0x599d79[_0x4fe2('0x1a')]=qs['offset'](_0x10b7c3[_0x4fe2('0x2e')]['offset']);}return _0x3da89d['getFields'](_0x599d79);}})[_0x4fe2('0x23')](function(_0x738939){if(_0x738939){return _0x738939?{'count':_0x335511,'rows':_0x738939}:null;}})[_0x4fe2('0x23')](respondWithResult(_0x535363,null))['catch'](handleError(_0x535363,null));};exports[_0x4fe2('0x4c')]=function(_0x403c95,_0x2a6076,_0x5836e4){var _0x47cd6a={};var _0x23dcb9={};var _0x2d2a1f;var _0x119ff3;return db['SugarcrmConfiguration'][_0x4fe2('0x48')]({'where':{'id':_0x403c95[_0x4fe2('0x43')]['id']}})[_0x4fe2('0x23')](handleEntityNotFound(_0x2a6076,null))['then'](function(_0x3fd462){if(_0x3fd462){_0x2d2a1f=_0x3fd462;_0x23dcb9[_0x4fe2('0x2c')]=_[_0x4fe2('0x2f')](db['SugarcrmField'][_0x4fe2('0x29')]);_0x23dcb9[_0x4fe2('0x2e')]=_[_0x4fe2('0x2f')](_0x403c95['query']);_0x23dcb9[_0x4fe2('0x4a')]=_[_0x4fe2('0x31')](_0x23dcb9[_0x4fe2('0x2c')],_0x23dcb9[_0x4fe2('0x2e')]);_0x47cd6a['attributes']=_['intersection'](_0x23dcb9[_0x4fe2('0x2c')],qs[_0x4fe2('0x32')](_0x403c95[_0x4fe2('0x2e')][_0x4fe2('0x32')]));_0x47cd6a['attributes']=_0x47cd6a[_0x4fe2('0x30')][_0x4fe2('0x33')]?_0x47cd6a[_0x4fe2('0x30')]:_0x23dcb9[_0x4fe2('0x2c')];_0x47cd6a[_0x4fe2('0x35')]=qs[_0x4fe2('0x36')](_0x403c95[_0x4fe2('0x2e')][_0x4fe2('0x36')]);_0x47cd6a[_0x4fe2('0x37')]=qs[_0x4fe2('0x4a')](_[_0x4fe2('0x38')](_0x403c95['query'],_0x23dcb9['filters']));if(_0x403c95[_0x4fe2('0x2e')][_0x4fe2('0x3b')]){_0x47cd6a['where']=_[_0x4fe2('0x39')](_0x47cd6a['where'],{'$or':_[_0x4fe2('0x2d')](_0x47cd6a[_0x4fe2('0x30')],function(_0x5cdc90){var _0x10f881={};_0x10f881[_0x5cdc90]={'$like':'%'+_0x403c95[_0x4fe2('0x2e')][_0x4fe2('0x3b')]+'%'};return _0x10f881;})});}_0x47cd6a=_[_0x4fe2('0x39')]({},_0x47cd6a,_0x403c95[_0x4fe2('0x3c')]);return _0x2d2a1f['getSubjects'](_0x47cd6a);}})[_0x4fe2('0x23')](function(_0x5e981e){if(_0x5e981e){_0x119ff3=_0x5e981e[_0x4fe2('0x33')];if(!_0x403c95[_0x4fe2('0x2e')]['hasOwnProperty'](_0x4fe2('0x34'))){_0x47cd6a[_0x4fe2('0x1c')]=qs[_0x4fe2('0x1c')](_0x403c95[_0x4fe2('0x2e')]['limit']);_0x47cd6a[_0x4fe2('0x1a')]=qs[_0x4fe2('0x1a')](_0x403c95[_0x4fe2('0x2e')][_0x4fe2('0x1a')]);}return _0x2d2a1f['getSubjects'](_0x47cd6a);}})['then'](function(_0x51bdf0){if(_0x51bdf0){return _0x51bdf0?{'count':_0x119ff3,'rows':_0x51bdf0}:null;}})[_0x4fe2('0x23')](respondWithResult(_0x2a6076,null))['catch'](handleError(_0x2a6076,null));};exports[_0x4fe2('0x4d')]=function(_0x17bb1d,_0x5297c3,_0x1ab18a){var _0x2b4c9c={};var _0x37eae0={};var _0x370c9c;var _0x2e1f77;return db[_0x4fe2('0x28')]['findOne']({'where':{'id':_0x17bb1d[_0x4fe2('0x43')]['id']}})[_0x4fe2('0x23')](handleEntityNotFound(_0x5297c3,null))[_0x4fe2('0x23')](function(_0x7996ac){if(_0x7996ac){_0x370c9c=_0x7996ac;_0x37eae0[_0x4fe2('0x2c')]=_[_0x4fe2('0x2f')](db[_0x4fe2('0x49')]['rawAttributes']);_0x37eae0[_0x4fe2('0x2e')]=_[_0x4fe2('0x2f')](_0x17bb1d[_0x4fe2('0x2e')]);_0x37eae0[_0x4fe2('0x4a')]=_[_0x4fe2('0x31')](_0x37eae0['model'],_0x37eae0[_0x4fe2('0x2e')]);_0x2b4c9c[_0x4fe2('0x30')]=_[_0x4fe2('0x31')](_0x37eae0[_0x4fe2('0x2c')],qs['fields'](_0x17bb1d[_0x4fe2('0x2e')]['fields']));_0x2b4c9c[_0x4fe2('0x30')]=_0x2b4c9c[_0x4fe2('0x30')][_0x4fe2('0x33')]?_0x2b4c9c[_0x4fe2('0x30')]:_0x37eae0[_0x4fe2('0x2c')];_0x2b4c9c['order']=qs['sort'](_0x17bb1d[_0x4fe2('0x2e')][_0x4fe2('0x36')]);_0x2b4c9c[_0x4fe2('0x37')]=qs['filters'](_['pick'](_0x17bb1d['query'],_0x37eae0[_0x4fe2('0x4a')]));if(_0x17bb1d[_0x4fe2('0x2e')][_0x4fe2('0x3b')]){_0x2b4c9c[_0x4fe2('0x37')]=_['merge'](_0x2b4c9c[_0x4fe2('0x37')],{'$or':_[_0x4fe2('0x2d')](_0x2b4c9c[_0x4fe2('0x30')],function(_0x1a5995){var _0x5155fc={};_0x5155fc[_0x1a5995]={'$like':'%'+_0x17bb1d[_0x4fe2('0x2e')]['filter']+'%'};return _0x5155fc;})});}_0x2b4c9c=_['merge']({},_0x2b4c9c,_0x17bb1d['options']);return _0x370c9c[_0x4fe2('0x4d')](_0x2b4c9c);}})[_0x4fe2('0x23')](function(_0x3672b3){if(_0x3672b3){_0x2e1f77=_0x3672b3[_0x4fe2('0x33')];if(!_0x17bb1d['query'][_0x4fe2('0x4b')](_0x4fe2('0x34'))){_0x2b4c9c[_0x4fe2('0x1c')]=qs[_0x4fe2('0x1c')](_0x17bb1d[_0x4fe2('0x2e')][_0x4fe2('0x1c')]);_0x2b4c9c[_0x4fe2('0x1a')]=qs['offset'](_0x17bb1d[_0x4fe2('0x2e')][_0x4fe2('0x1a')]);}return _0x370c9c[_0x4fe2('0x4d')](_0x2b4c9c);}})['then'](function(_0x464f8b){if(_0x464f8b){return _0x464f8b?{'count':_0x2e1f77,'rows':_0x464f8b}:null;}})[_0x4fe2('0x23')](respondWithResult(_0x5297c3,null))[_0x4fe2('0x41')](handleError(_0x5297c3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 88910c7..8d30188 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4004=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4004,0x9a));var _0x4400=function(_0x29b046,_0x3d830f){_0x29b046=_0x29b046-0x0;var _0x204735=_0x4004[_0x29b046];return _0x204735;};'use strict';var _=require('lodash');var util=require(_0x4400('0x0'));var logger=require(_0x4400('0x1'))('api');var moment=require(_0x4400('0x2'));var BPromise=require(_0x4400('0x3'));var rp=require(_0x4400('0x4'));var fs=require('fs');var path=require(_0x4400('0x5'));var rimraf=require(_0x4400('0x6'));var config=require(_0x4400('0x7'));var attributes=require(_0x4400('0x8'));module[_0x4400('0x9')]=function(_0x4fe343,_0x1c5a6a){return _0x4fe343[_0x4400('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x4400('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe90d=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x50718d,_0x4b4936){var _0x360e93=function(_0x1c2ae0){while(--_0x1c2ae0){_0x50718d['push'](_0x50718d['shift']());}};_0x360e93(++_0x4b4936);}(_0xe90d,0x10e));var _0xde90=function(_0x7985e5,_0x11afdc){_0x7985e5=_0x7985e5-0x0;var _0x1ef9e3=_0xe90d[_0x7985e5];return _0x1ef9e3;};'use strict';var _=require(_0xde90('0x0'));var util=require(_0xde90('0x1'));var logger=require(_0xde90('0x2'))(_0xde90('0x3'));var moment=require(_0xde90('0x4'));var BPromise=require(_0xde90('0x5'));var rp=require(_0xde90('0x6'));var fs=require('fs');var path=require(_0xde90('0x7'));var rimraf=require(_0xde90('0x8'));var config=require(_0xde90('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xde90('0xa')]=function(_0x30151e,_0x1362fc){return _0x30151e[_0xde90('0xb')](_0xde90('0xc'),attributes,{'tableName':_0xde90('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 02a7e5f..005a76a 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x094f=['client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x094f,0xa3));var _0xf094=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x094f[_0x1589dd];return _0x1bddd1;};'use strict';var _=require('lodash');var util=require(_0xf094('0x0'));var moment=require(_0xf094('0x1'));var BPromise=require('bluebird');var rs=require(_0xf094('0x2'));var fs=require('fs');var Redis=require(_0xf094('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf094('0x4'));var logger=require('../../config/logger')(_0xf094('0x5'));var config=require(_0xf094('0x6'));var jayson=require(_0xf094('0x7'));var client=jayson[_0xf094('0x8')][_0xf094('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34f4f9,_0x45b02d,_0xd91a07){return new BPromise(function(_0x5d44f3,_0x5a4b6a){return client[_0xf094('0xa')](_0x34f4f9,_0xd91a07)[_0xf094('0xb')](function(_0x58d9f3){logger['info'](_0xf094('0xc'),_0x45b02d,_0xf094('0xd'));logger[_0xf094('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x45b02d,_0xf094('0xd'),JSON['stringify'](_0x58d9f3));if(_0x58d9f3[_0xf094('0xf')]){if(_0x58d9f3['error'][_0xf094('0x10')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x45b02d,_0x58d9f3[_0xf094('0xf')][_0xf094('0x11')]);return _0x5a4b6a(_0x58d9f3['error'][_0xf094('0x11')]);}logger[_0xf094('0xf')](_0xf094('0xc'),_0x45b02d,_0x58d9f3[_0xf094('0xf')][_0xf094('0x11')]);return _0x5d44f3(_0x58d9f3[_0xf094('0xf')][_0xf094('0x11')]);}else{logger[_0xf094('0x12')](_0xf094('0xc'),_0x45b02d,_0xf094('0xd'));_0x5d44f3(_0x58d9f3['result']['message']);}})['catch'](function(_0x574e39){logger[_0xf094('0xf')](_0xf094('0xc'),_0x45b02d,_0x574e39);_0x5a4b6a(_0x574e39);});});} \ No newline at end of file +var _0xeb54=['SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xeb54,0x149));var _0x4eb5=function(_0x1f6737,_0x40e5c1){_0x1f6737=_0x1f6737-0x0;var _0x2dcf1f=_0xeb54[_0x1f6737];return _0x2dcf1f;};'use strict';var _=require(_0x4eb5('0x0'));var util=require(_0x4eb5('0x1'));var moment=require(_0x4eb5('0x2'));var BPromise=require(_0x4eb5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4eb5('0x4'));var logger=require('../../config/logger')(_0x4eb5('0x5'));var config=require(_0x4eb5('0x6'));var jayson=require(_0x4eb5('0x7'));var client=jayson[_0x4eb5('0x8')][_0x4eb5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x122987,_0x427cc5,_0x3b5adb){return new BPromise(function(_0x29002b,_0x1ab40b){return client[_0x4eb5('0xa')](_0x122987,_0x3b5adb)[_0x4eb5('0xb')](function(_0x1b4f0b){logger[_0x4eb5('0xc')](_0x4eb5('0xd'),_0x427cc5,_0x4eb5('0xe'));logger[_0x4eb5('0xf')](_0x4eb5('0x10'),_0x427cc5,_0x4eb5('0xe'),JSON[_0x4eb5('0x11')](_0x1b4f0b));if(_0x1b4f0b[_0x4eb5('0x12')]){if(_0x1b4f0b[_0x4eb5('0x12')][_0x4eb5('0x13')]===0x1f4){logger[_0x4eb5('0x12')](_0x4eb5('0xd'),_0x427cc5,_0x1b4f0b[_0x4eb5('0x12')][_0x4eb5('0x14')]);return _0x1ab40b(_0x1b4f0b[_0x4eb5('0x12')][_0x4eb5('0x14')]);}logger['error'](_0x4eb5('0xd'),_0x427cc5,_0x1b4f0b['error']['message']);return _0x29002b(_0x1b4f0b[_0x4eb5('0x12')][_0x4eb5('0x14')]);}else{logger['info'](_0x4eb5('0xd'),_0x427cc5,'request\x20sent');_0x29002b(_0x1b4f0b[_0x4eb5('0x15')][_0x4eb5('0x14')]);}})[_0x4eb5('0x16')](function(_0x15ca65){logger['error'](_0x4eb5('0xd'),_0x427cc5,_0x15ca65);_0x1ab40b(_0x15ca65);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 5d49406..5e7befa 100644 --- a/server/api/intSugarcrmField/index.js +++ b/server/api/intSugarcrmField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46d4=['update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','create','put','/:id'];(function(_0x21deff,_0x203677){var _0x146c95=function(_0x11aced){while(--_0x11aced){_0x21deff['push'](_0x21deff['shift']());}};_0x146c95(++_0x203677);}(_0x46d4,0x145));var _0x446d=function(_0x47872a,_0x2919a9){_0x47872a=_0x47872a-0x0;var _0x1cc71b=_0x46d4[_0x47872a];return _0x1cc71b;};'use strict';var multer=require(_0x446d('0x0'));var util=require(_0x446d('0x1'));var path=require(_0x446d('0x2'));var timeout=require(_0x446d('0x3'));var express=require(_0x446d('0x4'));var router=express[_0x446d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x446d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x446d('0x7'));var controller=require(_0x446d('0x8'));router[_0x446d('0x9')]('/',auth[_0x446d('0xa')](),controller['index']);router['get']('/:id',auth[_0x446d('0xa')](),controller[_0x446d('0xb')]);router['post']('/',auth[_0x446d('0xa')](),controller[_0x446d('0xc')]);router[_0x446d('0xd')](_0x446d('0xe'),auth[_0x446d('0xa')](),controller[_0x446d('0xf')]);router[_0x446d('0x10')](_0x446d('0xe'),auth[_0x446d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6f35=['isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x217b70,_0x289ae3){var _0xc7b236=function(_0x3c24fc){while(--_0x3c24fc){_0x217b70['push'](_0x217b70['shift']());}};_0xc7b236(++_0x289ae3);}(_0x6f35,0x139));var _0x56f3=function(_0x182f05,_0x46cc14){_0x182f05=_0x182f05-0x0;var _0x2808d2=_0x6f35[_0x182f05];return _0x2808d2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x56f3('0x0'));var timeout=require(_0x56f3('0x1'));var express=require(_0x56f3('0x2'));var router=express[_0x56f3('0x3')]();var fs_extra=require(_0x56f3('0x4'));var auth=require(_0x56f3('0x5'));var interaction=require(_0x56f3('0x6'));var config=require(_0x56f3('0x7'));var controller=require(_0x56f3('0x8'));router[_0x56f3('0x9')]('/',auth[_0x56f3('0xa')](),controller['index']);router[_0x56f3('0x9')]('/:id',auth[_0x56f3('0xa')](),controller[_0x56f3('0xb')]);router[_0x56f3('0xc')]('/',auth[_0x56f3('0xa')](),controller[_0x56f3('0xd')]);router['put'](_0x56f3('0xe'),auth[_0x56f3('0xa')](),controller[_0x56f3('0xf')]);router[_0x56f3('0x10')](_0x56f3('0xe'),auth[_0x56f3('0xa')](),controller[_0x56f3('0x11')]);module[_0x56f3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5319ee6..339ec2e 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.attributes.js +++ b/server/api/intSugarcrmField/intSugarcrmField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe01d=['sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable','BOOLEAN'];(function(_0x35f5bb,_0x354149){var _0xf8d19e=function(_0x391754){while(--_0x391754){_0x35f5bb['push'](_0x35f5bb['shift']());}};_0xf8d19e(++_0x354149);}(_0xe01d,0x195));var _0xde01=function(_0x260f23,_0x2d90ee){_0x260f23=_0x260f23-0x0;var _0x222dc1=_0xe01d[_0x260f23];return _0x222dc1;};'use strict';var Sequelize=require(_0xde01('0x0'));module[_0xde01('0x1')]={'type':{'type':Sequelize[_0xde01('0x2')](_0xde01('0x3'),_0xde01('0x4'),'customVariable','keyValue',_0xde01('0x5')),'defaultValue':_0xde01('0x3')},'content':{'type':Sequelize[_0xde01('0x6')]},'key':{'type':Sequelize[_0xde01('0x6')]},'keyType':{'type':Sequelize[_0xde01('0x2')](_0xde01('0x3'),_0xde01('0x4'),_0xde01('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xde01('0x6')]},'nameField':{'type':Sequelize[_0xde01('0x6')]},'customField':{'type':Sequelize[_0xde01('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde01('0x6')]}}; \ No newline at end of file +var _0xeb49=['picklist','STRING','sequelize','string','variable','customVariable'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xeb49,0x176));var _0x9eb4=function(_0x428a64,_0x16085a){_0x428a64=_0x428a64-0x0;var _0x386b79=_0xeb49[_0x428a64];return _0x386b79;};'use strict';var Sequelize=require(_0x9eb4('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x9eb4('0x1'),_0x9eb4('0x2'),_0x9eb4('0x3'),'keyValue',_0x9eb4('0x4')),'defaultValue':_0x9eb4('0x1')},'content':{'type':Sequelize[_0x9eb4('0x5')]},'key':{'type':Sequelize[_0x9eb4('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x9eb4('0x5')]},'idField':{'type':Sequelize[_0x9eb4('0x5')]},'nameField':{'type':Sequelize[_0x9eb4('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9eb4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 61b9f4f..a45a570 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.controller.js +++ b/server/api/intSugarcrmField/intSugarcrmField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa637=['offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','catch','show','params','keys','include','options','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x52c971,_0x4ddd1d){var _0x599827=function(_0xcb5a37){while(--_0xcb5a37){_0x52c971['push'](_0x52c971['shift']());}};_0x599827(++_0x4ddd1d);}(_0xa637,0x194));var _0x7a63=function(_0x293838,_0x541252){_0x293838=_0x293838-0x0;var _0x5b50c3=_0xa637[_0x293838];return _0x5b50c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a63('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a63('0x1'));var rp=require(_0x7a63('0x2'));var moment=require(_0x7a63('0x3'));var BPromise=require(_0x7a63('0x4'));var Mustache=require(_0x7a63('0x5'));var util=require(_0x7a63('0x6'));var path=require(_0x7a63('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a63('0x8'));var fs=require('fs');var fs_extra=require(_0x7a63('0x9'));var _=require(_0x7a63('0xa'));var squel=require(_0x7a63('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7a63('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7a63('0xd'));var Papa=require('papaparse');var Redis=require(_0x7a63('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7a63('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a63('0x10'));var logger=require(_0x7a63('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a63('0x12'));var db=require(_0x7a63('0x13'))['db'];function respondWithStatusCode(_0x188169,_0x57c05a){_0x57c05a=_0x57c05a||0xcc;return function(_0x35a14b){if(_0x35a14b){return _0x188169[_0x7a63('0x14')](_0x57c05a);}return _0x188169[_0x7a63('0x15')](_0x57c05a)['end']();};}function respondWithResult(_0x4cb0ed,_0x1b21ed){_0x1b21ed=_0x1b21ed||0xc8;return function(_0x134e60){if(_0x134e60){return _0x4cb0ed[_0x7a63('0x15')](_0x1b21ed)['json'](_0x134e60);}};}function respondWithFilteredResult(_0x4e1a1c,_0x5a1810){return function(_0xe8f5fb){if(_0xe8f5fb){var _0xcb9c28=typeof _0x5a1810[_0x7a63('0x16')]==='undefined'&&typeof _0x5a1810['limit']===_0x7a63('0x17');var _0x4b5c70=_0xe8f5fb['count'];var _0x38341=_0xcb9c28?0x0:_0x5a1810[_0x7a63('0x16')];var _0x172789=_0xcb9c28?_0xe8f5fb[_0x7a63('0x18')]:_0x5a1810[_0x7a63('0x16')]+_0x5a1810[_0x7a63('0x19')];var _0x3a9af0;if(_0x172789>=_0x4b5c70){_0x172789=_0x4b5c70;_0x3a9af0=0xc8;}else{_0x3a9af0=0xce;}_0x4e1a1c[_0x7a63('0x15')](_0x3a9af0);return _0x4e1a1c[_0x7a63('0x1a')](_0x7a63('0x1b'),_0x38341+'-'+_0x172789+'/'+_0x4b5c70)[_0x7a63('0x1c')](_0xe8f5fb);}return null;};}function patchUpdates(_0x2ff08f){return function(_0x351129){try{jsonpatch[_0x7a63('0x1d')](_0x351129,_0x2ff08f,!![]);}catch(_0x11aeea){return BPromise[_0x7a63('0x1e')](_0x11aeea);}return _0x351129[_0x7a63('0x1f')]();};}function saveUpdates(_0x14e06e,_0x1b77ef){return function(_0x11983b){if(_0x11983b){return _0x11983b[_0x7a63('0x20')](_0x14e06e)[_0x7a63('0x21')](function(_0x582e10){return _0x582e10;});}return null;};}function removeEntity(_0x58005a,_0x10da9d){return function(_0x2e1632){if(_0x2e1632){return _0x2e1632[_0x7a63('0x22')]()[_0x7a63('0x21')](function(){_0x58005a[_0x7a63('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1412e2,_0x118ede){return function(_0x54add3){if(!_0x54add3){_0x1412e2[_0x7a63('0x14')](0x194);}return _0x54add3;};}function handleError(_0x3f101c,_0x2cad52){_0x2cad52=_0x2cad52||0x1f4;return function(_0x4c47b5){logger[_0x7a63('0x23')](_0x4c47b5[_0x7a63('0x24')]);if(_0x4c47b5[_0x7a63('0x25')]){delete _0x4c47b5[_0x7a63('0x25')];}_0x3f101c[_0x7a63('0x15')](_0x2cad52)[_0x7a63('0x26')](_0x4c47b5);};}exports[_0x7a63('0x27')]=function(_0x18300c,_0xe3feb9){var _0x2cf21f={},_0x52c2a6={},_0x55cae1={'count':0x0,'rows':[]};var _0x537510=_[_0x7a63('0x28')](db[_0x7a63('0x29')][_0x7a63('0x2a')],function(_0x284508){return{'name':_0x284508[_0x7a63('0x2b')],'type':_0x284508[_0x7a63('0x2c')][_0x7a63('0x2d')]};});_0x52c2a6[_0x7a63('0x2e')]=_[_0x7a63('0x28')](_0x537510,_0x7a63('0x25'));_0x52c2a6['query']=_['keys'](_0x18300c[_0x7a63('0x2f')]);_0x52c2a6[_0x7a63('0x30')]=_['intersection'](_0x52c2a6[_0x7a63('0x2e')],_0x52c2a6[_0x7a63('0x2f')]);_0x2cf21f[_0x7a63('0x31')]=_[_0x7a63('0x32')](_0x52c2a6[_0x7a63('0x2e')],qs[_0x7a63('0x33')](_0x18300c['query'][_0x7a63('0x33')]));_0x2cf21f['attributes']=_0x2cf21f[_0x7a63('0x31')][_0x7a63('0x34')]?_0x2cf21f[_0x7a63('0x31')]:_0x52c2a6[_0x7a63('0x2e')];if(!_0x18300c[_0x7a63('0x2f')][_0x7a63('0x35')]('nolimit')){_0x2cf21f[_0x7a63('0x19')]=qs[_0x7a63('0x19')](_0x18300c['query'][_0x7a63('0x19')]);_0x2cf21f['offset']=qs[_0x7a63('0x16')](_0x18300c[_0x7a63('0x2f')][_0x7a63('0x16')]);}_0x2cf21f[_0x7a63('0x36')]=qs[_0x7a63('0x37')](_0x18300c[_0x7a63('0x2f')][_0x7a63('0x37')]);_0x2cf21f[_0x7a63('0x38')]=qs['filters'](_[_0x7a63('0x39')](_0x18300c[_0x7a63('0x2f')],_0x52c2a6['filters']),_0x537510);if(_0x18300c[_0x7a63('0x2f')][_0x7a63('0x3a')]){_0x2cf21f[_0x7a63('0x38')]=_[_0x7a63('0x3b')](_0x2cf21f['where'],{'$or':_[_0x7a63('0x28')](_0x537510,function(_0xced85d){if(_0xced85d[_0x7a63('0x2c')]!=='VIRTUAL'){var _0xd556d1={};_0xd556d1[_0xced85d[_0x7a63('0x25')]]={'$like':'%'+_0x18300c['query']['filter']+'%'};return _0xd556d1;}})});}_0x2cf21f=_[_0x7a63('0x3b')]({},_0x2cf21f,_0x18300c['options']);var _0x1a1ae7={'where':_0x2cf21f[_0x7a63('0x38')]};return db[_0x7a63('0x29')][_0x7a63('0x18')](_0x1a1ae7)[_0x7a63('0x21')](function(_0x1c0f55){_0x55cae1[_0x7a63('0x18')]=_0x1c0f55;if(_0x18300c[_0x7a63('0x2f')][_0x7a63('0x3c')]){_0x2cf21f['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x7a63('0x3d')](_0x2cf21f);})[_0x7a63('0x21')](function(_0x26901a){_0x55cae1['rows']=_0x26901a;return _0x55cae1;})[_0x7a63('0x21')](respondWithFilteredResult(_0xe3feb9,_0x2cf21f))[_0x7a63('0x3e')](handleError(_0xe3feb9,null));};exports[_0x7a63('0x3f')]=function(_0x3f9bbe,_0x5291f8){var _0x2d8324={'raw':!![],'where':{'id':_0x3f9bbe[_0x7a63('0x40')]['id']}},_0x6d2e36={};_0x6d2e36[_0x7a63('0x2e')]=_[_0x7a63('0x41')](db[_0x7a63('0x29')][_0x7a63('0x2a')]);_0x6d2e36[_0x7a63('0x2f')]=_[_0x7a63('0x41')](_0x3f9bbe[_0x7a63('0x2f')]);_0x6d2e36['filters']=_[_0x7a63('0x32')](_0x6d2e36[_0x7a63('0x2e')],_0x6d2e36[_0x7a63('0x2f')]);_0x2d8324[_0x7a63('0x31')]=_[_0x7a63('0x32')](_0x6d2e36['model'],qs['fields'](_0x3f9bbe[_0x7a63('0x2f')]['fields']));_0x2d8324['attributes']=_0x2d8324[_0x7a63('0x31')]['length']?_0x2d8324[_0x7a63('0x31')]:_0x6d2e36[_0x7a63('0x2e')];if(_0x3f9bbe['query'][_0x7a63('0x3c')]){_0x2d8324[_0x7a63('0x42')]=[{'all':!![]}];}_0x2d8324=_[_0x7a63('0x3b')]({},_0x2d8324,_0x3f9bbe[_0x7a63('0x43')]);return db[_0x7a63('0x29')]['find'](_0x2d8324)[_0x7a63('0x21')](handleEntityNotFound(_0x5291f8,null))[_0x7a63('0x21')](respondWithResult(_0x5291f8,null))[_0x7a63('0x3e')](handleError(_0x5291f8,null));};exports[_0x7a63('0x44')]=function(_0x4fff42,_0x4c988a){return db[_0x7a63('0x29')][_0x7a63('0x44')](_0x4fff42[_0x7a63('0x45')],{})[_0x7a63('0x21')](respondWithResult(_0x4c988a,0xc9))[_0x7a63('0x3e')](handleError(_0x4c988a,null));};exports[_0x7a63('0x20')]=function(_0x2dc479,_0x5bb999){if(_0x2dc479[_0x7a63('0x45')]['id']){delete _0x2dc479[_0x7a63('0x45')]['id'];}return db[_0x7a63('0x29')][_0x7a63('0x46')]({'where':{'id':_0x2dc479[_0x7a63('0x40')]['id']}})['then'](handleEntityNotFound(_0x5bb999,null))['then'](saveUpdates(_0x2dc479[_0x7a63('0x45')],null))[_0x7a63('0x21')](respondWithResult(_0x5bb999,null))[_0x7a63('0x3e')](handleError(_0x5bb999,null));};exports[_0x7a63('0x22')]=function(_0x44b951,_0x4d3640){return db[_0x7a63('0x29')][_0x7a63('0x46')]({'where':{'id':_0x44b951[_0x7a63('0x40')]['id']}})[_0x7a63('0x21')](handleEntityNotFound(_0x4d3640,null))[_0x7a63('0x21')](removeEntity(_0x4d3640,null))['catch'](handleError(_0x4d3640,null));}; \ No newline at end of file +var _0x2d73=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','save','update','then','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','body','params','destroy','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv'];(function(_0x54e36f,_0x278434){var _0x22e333=function(_0x2a9eca){while(--_0x2a9eca){_0x54e36f['push'](_0x54e36f['shift']());}};_0x22e333(++_0x278434);}(_0x2d73,0x165));var _0x32d7=function(_0x170310,_0x31acf9){_0x170310=_0x170310-0x0;var _0x1b6006=_0x2d73[_0x170310];return _0x1b6006;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32d7('0x0'));var zipdir=require(_0x32d7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32d7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x32d7('0x3'));var util=require(_0x32d7('0x4'));var path=require(_0x32d7('0x5'));var sox=require(_0x32d7('0x6'));var csv=require(_0x32d7('0x7'));var ejs=require(_0x32d7('0x8'));var fs=require('fs');var fs_extra=require(_0x32d7('0x9'));var _=require(_0x32d7('0xa'));var squel=require(_0x32d7('0xb'));var crypto=require(_0x32d7('0xc'));var jsforce=require(_0x32d7('0xd'));var deskjs=require(_0x32d7('0xe'));var toCsv=require(_0x32d7('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x32d7('0xf'));var authService=require(_0x32d7('0x10'));var qs=require(_0x32d7('0x11'));var as=require(_0x32d7('0x12'));var hardwareService=require(_0x32d7('0x13'));var logger=require(_0x32d7('0x14'))(_0x32d7('0x15'));var utils=require(_0x32d7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32d7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e2644,_0x3fdf86){_0x3fdf86=_0x3fdf86||0xcc;return function(_0x141375){if(_0x141375){return _0x4e2644[_0x32d7('0x18')](_0x3fdf86);}return _0x4e2644['status'](_0x3fdf86)[_0x32d7('0x19')]();};}function respondWithResult(_0x50d96b,_0x2711d5){_0x2711d5=_0x2711d5||0xc8;return function(_0x2b2b60){if(_0x2b2b60){return _0x50d96b[_0x32d7('0x1a')](_0x2711d5)[_0x32d7('0x1b')](_0x2b2b60);}};}function respondWithFilteredResult(_0x45a06d,_0x49d09d){return function(_0x42a8f8){if(_0x42a8f8){var _0x5511c0=typeof _0x49d09d['offset']===_0x32d7('0x1c')&&typeof _0x49d09d['limit']===_0x32d7('0x1c');var _0x3e8e62=_0x42a8f8[_0x32d7('0x1d')];var _0x52dae9=_0x5511c0?0x0:_0x49d09d[_0x32d7('0x1e')];var _0x543ebc=_0x5511c0?_0x42a8f8['count']:_0x49d09d['offset']+_0x49d09d[_0x32d7('0x1f')];var _0x4caef5;if(_0x543ebc>=_0x3e8e62){_0x543ebc=_0x3e8e62;_0x4caef5=0xc8;}else{_0x4caef5=0xce;}_0x45a06d[_0x32d7('0x1a')](_0x4caef5);return _0x45a06d[_0x32d7('0x20')]('Content-Range',_0x52dae9+'-'+_0x543ebc+'/'+_0x3e8e62)[_0x32d7('0x1b')](_0x42a8f8);}return null;};}function patchUpdates(_0x54994e){return function(_0x603afc){try{jsonpatch['apply'](_0x603afc,_0x54994e,!![]);}catch(_0x4536b4){return BPromise[_0x32d7('0x21')](_0x4536b4);}return _0x603afc[_0x32d7('0x22')]();};}function saveUpdates(_0x4b3281,_0x4a5913){return function(_0x54aebe){if(_0x54aebe){return _0x54aebe[_0x32d7('0x23')](_0x4b3281)['then'](function(_0x4f9105){return _0x4f9105;});}return null;};}function removeEntity(_0x375e20,_0xa67e8f){return function(_0x5ef1c6){if(_0x5ef1c6){return _0x5ef1c6['destroy']()[_0x32d7('0x24')](function(){_0x375e20['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1de84e,_0x38b6cf){return function(_0x40ad45){if(!_0x40ad45){_0x1de84e[_0x32d7('0x18')](0x194);}return _0x40ad45;};}function handleError(_0x58242b,_0x418abd){_0x418abd=_0x418abd||0x1f4;return function(_0x32bdc9){logger[_0x32d7('0x25')](_0x32bdc9['stack']);if(_0x32bdc9[_0x32d7('0x26')]){delete _0x32bdc9['name'];}_0x58242b[_0x32d7('0x1a')](_0x418abd)[_0x32d7('0x27')](_0x32bdc9);};}exports[_0x32d7('0x28')]=function(_0xae2334,_0x268c0d){var _0x1ec982={},_0x53e68e={},_0x2e87b4={'count':0x0,'rows':[]};var _0x5bc484=_[_0x32d7('0x29')](db[_0x32d7('0x2a')][_0x32d7('0x2b')],function(_0x474d51){return{'name':_0x474d51[_0x32d7('0x2c')],'type':_0x474d51[_0x32d7('0x2d')]['key']};});_0x53e68e['model']=_[_0x32d7('0x29')](_0x5bc484,_0x32d7('0x26'));_0x53e68e[_0x32d7('0x2e')]=_[_0x32d7('0x2f')](_0xae2334[_0x32d7('0x2e')]);_0x53e68e[_0x32d7('0x30')]=_[_0x32d7('0x31')](_0x53e68e['model'],_0x53e68e[_0x32d7('0x2e')]);_0x1ec982[_0x32d7('0x32')]=_[_0x32d7('0x31')](_0x53e68e[_0x32d7('0x33')],qs['fields'](_0xae2334['query'][_0x32d7('0x34')]));_0x1ec982[_0x32d7('0x32')]=_0x1ec982[_0x32d7('0x32')][_0x32d7('0x35')]?_0x1ec982[_0x32d7('0x32')]:_0x53e68e[_0x32d7('0x33')];if(!_0xae2334[_0x32d7('0x2e')]['hasOwnProperty'](_0x32d7('0x36'))){_0x1ec982[_0x32d7('0x1f')]=qs[_0x32d7('0x1f')](_0xae2334[_0x32d7('0x2e')][_0x32d7('0x1f')]);_0x1ec982[_0x32d7('0x1e')]=qs[_0x32d7('0x1e')](_0xae2334[_0x32d7('0x2e')][_0x32d7('0x1e')]);}_0x1ec982[_0x32d7('0x37')]=qs[_0x32d7('0x38')](_0xae2334[_0x32d7('0x2e')][_0x32d7('0x38')]);_0x1ec982[_0x32d7('0x39')]=qs[_0x32d7('0x30')](_[_0x32d7('0x3a')](_0xae2334[_0x32d7('0x2e')],_0x53e68e['filters']),_0x5bc484);if(_0xae2334[_0x32d7('0x2e')][_0x32d7('0x3b')]){_0x1ec982[_0x32d7('0x39')]=_[_0x32d7('0x3c')](_0x1ec982[_0x32d7('0x39')],{'$or':_[_0x32d7('0x29')](_0x5bc484,function(_0x3a181b){if(_0x3a181b['type']!==_0x32d7('0x3d')){var _0x536aff={};_0x536aff[_0x3a181b[_0x32d7('0x26')]]={'$like':'%'+_0xae2334['query'][_0x32d7('0x3b')]+'%'};return _0x536aff;}})});}_0x1ec982=_['merge']({},_0x1ec982,_0xae2334['options']);var _0x269217={'where':_0x1ec982[_0x32d7('0x39')]};return db['SugarcrmField'][_0x32d7('0x1d')](_0x269217)[_0x32d7('0x24')](function(_0xd1df1e){_0x2e87b4[_0x32d7('0x1d')]=_0xd1df1e;if(_0xae2334[_0x32d7('0x2e')][_0x32d7('0x3e')]){_0x1ec982[_0x32d7('0x3f')]=[{'all':!![]}];}return db[_0x32d7('0x2a')][_0x32d7('0x40')](_0x1ec982);})[_0x32d7('0x24')](function(_0x250e52){_0x2e87b4[_0x32d7('0x41')]=_0x250e52;return _0x2e87b4;})['then'](respondWithFilteredResult(_0x268c0d,_0x1ec982))[_0x32d7('0x42')](handleError(_0x268c0d,null));};exports[_0x32d7('0x43')]=function(_0x15602c,_0x5148f5){var _0x8c732f={'raw':!![],'where':{'id':_0x15602c['params']['id']}},_0x2cfe78={};_0x2cfe78['model']=_['keys'](db[_0x32d7('0x2a')][_0x32d7('0x2b')]);_0x2cfe78['query']=_[_0x32d7('0x2f')](_0x15602c[_0x32d7('0x2e')]);_0x2cfe78[_0x32d7('0x30')]=_[_0x32d7('0x31')](_0x2cfe78['model'],_0x2cfe78[_0x32d7('0x2e')]);_0x8c732f[_0x32d7('0x32')]=_['intersection'](_0x2cfe78['model'],qs[_0x32d7('0x34')](_0x15602c[_0x32d7('0x2e')][_0x32d7('0x34')]));_0x8c732f[_0x32d7('0x32')]=_0x8c732f[_0x32d7('0x32')][_0x32d7('0x35')]?_0x8c732f[_0x32d7('0x32')]:_0x2cfe78[_0x32d7('0x33')];if(_0x15602c['query'][_0x32d7('0x3e')]){_0x8c732f[_0x32d7('0x3f')]=[{'all':!![]}];}_0x8c732f=_[_0x32d7('0x3c')]({},_0x8c732f,_0x15602c[_0x32d7('0x44')]);return db[_0x32d7('0x2a')]['find'](_0x8c732f)['then'](handleEntityNotFound(_0x5148f5,null))[_0x32d7('0x24')](respondWithResult(_0x5148f5,null))['catch'](handleError(_0x5148f5,null));};exports['create']=function(_0xa23423,_0x288528){return db[_0x32d7('0x2a')][_0x32d7('0x45')](_0xa23423[_0x32d7('0x46')],{})['then'](respondWithResult(_0x288528,0xc9))[_0x32d7('0x42')](handleError(_0x288528,null));};exports[_0x32d7('0x23')]=function(_0x5204e4,_0x1d5268){if(_0x5204e4['body']['id']){delete _0x5204e4[_0x32d7('0x46')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x5204e4[_0x32d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d5268,null))[_0x32d7('0x24')](saveUpdates(_0x5204e4[_0x32d7('0x46')],null))['then'](respondWithResult(_0x1d5268,null))['catch'](handleError(_0x1d5268,null));};exports[_0x32d7('0x48')]=function(_0x8c0c08,_0x276571){return db['SugarcrmField']['find']({'where':{'id':_0x8c0c08[_0x32d7('0x47')]['id']}})[_0x32d7('0x24')](handleEntityNotFound(_0x276571,null))[_0x32d7('0x24')](removeEntity(_0x276571,null))[_0x32d7('0x42')](handleError(_0x276571,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6d54606..7dc0118 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.model.js +++ b/server/api/intSugarcrmField/intSugarcrmField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1b7=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','sugarcrm_unique_index','FieldId'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xa1b7,0x188));var _0x7a1b=function(_0x519553,_0x5a66e8){_0x519553=_0x519553-0x0;var _0x5cf03a=_0xa1b7[_0x519553];return _0x5cf03a;};'use strict';var _=require(_0x7a1b('0x0'));var util=require(_0x7a1b('0x1'));var logger=require(_0x7a1b('0x2'))(_0x7a1b('0x3'));var moment=require(_0x7a1b('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a1b('0x5'));var fs=require('fs');var path=require(_0x7a1b('0x6'));var rimraf=require(_0x7a1b('0x7'));var config=require(_0x7a1b('0x8'));var attributes=require(_0x7a1b('0x9'));module['exports']=function(_0x3ddcd6,_0x261eee){return _0x3ddcd6[_0x7a1b('0xa')](_0x7a1b('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x7a1b('0xc'),'fields':['idField',_0x7a1b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x360e=['path','rimraf','../../config/environment','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0x360e,0x112));var _0xe360=function(_0x42f270,_0x452dec){_0x42f270=_0x42f270-0x0;var _0x57bc5b=_0x360e[_0x42f270];return _0x57bc5b;};'use strict';var _=require(_0xe360('0x0'));var util=require(_0xe360('0x1'));var logger=require(_0xe360('0x2'))(_0xe360('0x3'));var moment=require(_0xe360('0x4'));var BPromise=require(_0xe360('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe360('0x6'));var rimraf=require(_0xe360('0x7'));var config=require(_0xe360('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0xe360('0x9')]=function(_0x526af5,_0x4c6b5b){return _0x526af5['define'](_0xe360('0xa'),attributes,{'tableName':_0xe360('0xb'),'paranoid':![],'indexes':[{'name':_0xe360('0xc'),'fields':['idField',_0xe360('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 0e9ac8d..81ea4ad 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa041=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','util','moment'];(function(_0x24ad36,_0x34fe8a){var _0x472d92=function(_0x4c639c){while(--_0x4c639c){_0x24ad36['push'](_0x24ad36['shift']());}};_0x472d92(++_0x34fe8a);}(_0xa041,0x163));var _0x1a04=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa041[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x1a04('0x0'));var moment=require(_0x1a04('0x1'));var BPromise=require('bluebird');var rs=require(_0x1a04('0x2'));var fs=require('fs');var Redis=require(_0x1a04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a04('0x4'));var logger=require(_0x1a04('0x5'))(_0x1a04('0x6'));var config=require(_0x1a04('0x7'));var jayson=require(_0x1a04('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeeae6d,_0x38cbbb,_0x5cc209){return new BPromise(function(_0x21d5f9,_0x24b816){return client[_0x1a04('0x9')](_0xeeae6d,_0x5cc209)[_0x1a04('0xa')](function(_0xaaf4d7){logger[_0x1a04('0xb')](_0x1a04('0xc'),_0x38cbbb,_0x1a04('0xd'));logger[_0x1a04('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x38cbbb,'request\x20sent',JSON[_0x1a04('0xf')](_0xaaf4d7));if(_0xaaf4d7['error']){if(_0xaaf4d7['error'][_0x1a04('0x10')]===0x1f4){logger[_0x1a04('0x11')](_0x1a04('0xc'),_0x38cbbb,_0xaaf4d7[_0x1a04('0x11')][_0x1a04('0x12')]);return _0x24b816(_0xaaf4d7[_0x1a04('0x11')][_0x1a04('0x12')]);}logger[_0x1a04('0x11')](_0x1a04('0xc'),_0x38cbbb,_0xaaf4d7[_0x1a04('0x11')][_0x1a04('0x12')]);return _0x21d5f9(_0xaaf4d7[_0x1a04('0x11')]['message']);}else{logger[_0x1a04('0xb')](_0x1a04('0xc'),_0x38cbbb,'request\x20sent');_0x21d5f9(_0xaaf4d7[_0x1a04('0x13')][_0x1a04('0x12')]);}})[_0x1a04('0x14')](function(_0x1bbac4){logger[_0x1a04('0x11')](_0x1a04('0xc'),_0x38cbbb,_0x1bbac4);_0x24b816(_0x1bbac4);});});} \ No newline at end of file +var _0xd69e=['error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x70a8a5,_0x35a384){var _0x2b563b=function(_0x4bbb5b){while(--_0x4bbb5b){_0x70a8a5['push'](_0x70a8a5['shift']());}};_0x2b563b(++_0x35a384);}(_0xd69e,0x193));var _0xed69=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd69e[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xed69('0x0'));var util=require(_0xed69('0x1'));var moment=require(_0xed69('0x2'));var BPromise=require('bluebird');var rs=require(_0xed69('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed69('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xed69('0x5'))(_0xed69('0x6'));var config=require(_0xed69('0x7'));var jayson=require(_0xed69('0x8'));var client=jayson['client'][_0xed69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x103562,_0x205045,_0x20534d){return new BPromise(function(_0x27f49d,_0xe3acc7){return client[_0xed69('0xa')](_0x103562,_0x20534d)[_0xed69('0xb')](function(_0x18d0f4){logger[_0xed69('0xc')](_0xed69('0xd'),_0x205045,_0xed69('0xe'));logger[_0xed69('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x205045,_0xed69('0xe'),JSON[_0xed69('0x10')](_0x18d0f4));if(_0x18d0f4[_0xed69('0x11')]){if(_0x18d0f4[_0xed69('0x11')][_0xed69('0x12')]===0x1f4){logger[_0xed69('0x11')](_0xed69('0xd'),_0x205045,_0x18d0f4[_0xed69('0x11')]['message']);return _0xe3acc7(_0x18d0f4[_0xed69('0x11')][_0xed69('0x13')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x205045,_0x18d0f4['error'][_0xed69('0x13')]);return _0x27f49d(_0x18d0f4[_0xed69('0x11')][_0xed69('0x13')]);}else{logger[_0xed69('0xc')](_0xed69('0xd'),_0x205045,'request\x20sent');_0x27f49d(_0x18d0f4[_0xed69('0x14')][_0xed69('0x13')]);}})['catch'](function(_0x2c5282){logger[_0xed69('0x11')](_0xed69('0xd'),_0x205045,_0x2c5282);_0xe3acc7(_0x2c5282);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0fc4580..c531ceb 100644 --- a/server/api/intVtigerAccount/index.js +++ b/server/api/intVtigerAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd3b=['isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x5b45da,_0x52bb87){var _0x2327f7=function(_0x35c430){while(--_0x35c430){_0x5b45da['push'](_0x5b45da['shift']());}};_0x2327f7(++_0x52bb87);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0xcad9e7,_0x255d6f){_0xcad9e7=_0xcad9e7-0x0;var _0x170a86=_0xbd3b[_0xcad9e7];return _0x170a86;};'use strict';var multer=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var path=require(_0xbbd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbd3('0x3'));var router=express[_0xbbd3('0x4')]();var fs_extra=require(_0xbbd3('0x5'));var auth=require(_0xbbd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd3('0x7'));var controller=require(_0xbbd3('0x8'));router['get']('/',auth[_0xbbd3('0x9')](),controller['index']);router[_0xbbd3('0xa')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller['show']);router[_0xbbd3('0xa')](_0xbbd3('0xc'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xd')]);router['get'](_0xbbd3('0xe'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xf')]);router[_0xbbd3('0x10')]('/',auth['isAuthenticated'](),controller[_0xbbd3('0x11')]);router['post']('/:id/configurations',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0x12')]);router[_0xbbd3('0x13')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0x14')]);router[_0xbbd3('0x15')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0x16')]);module['exports']=router; \ No newline at end of file +var _0x777f=['./intVtigerAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0x777f,0x9f));var _0xf777=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x777f[_0x336376];return _0x1d2a8e;};'use strict';var multer=require(_0xf777('0x0'));var util=require(_0xf777('0x1'));var path=require(_0xf777('0x2'));var timeout=require(_0xf777('0x3'));var express=require(_0xf777('0x4'));var router=express[_0xf777('0x5')]();var fs_extra=require(_0xf777('0x6'));var auth=require(_0xf777('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf777('0x8'));var controller=require(_0xf777('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf777('0xa')](_0xf777('0xb'),auth[_0xf777('0xc')](),controller[_0xf777('0xd')]);router[_0xf777('0xa')](_0xf777('0xe'),auth[_0xf777('0xc')](),controller[_0xf777('0xf')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xf777('0x10')]);router[_0xf777('0x11')]('/',auth['isAuthenticated'](),controller[_0xf777('0x12')]);router[_0xf777('0x11')](_0xf777('0xe'),auth['isAuthenticated'](),controller[_0xf777('0x13')]);router[_0xf777('0x14')](_0xf777('0xb'),auth[_0xf777('0xc')](),controller[_0xf777('0x15')]);router[_0xf777('0x16')](_0xf777('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf777('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 3269c44..986aa46 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.attributes.js +++ b/server/api/intVtigerAccount/intVtigerAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5aae=['HelpDesk','exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5aae,0x7f));var _0xe5aa=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0x5aae[_0x23ca4d];return _0x435432;};'use strict';var Sequelize=require('sequelize');module[_0xe5aa('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe5aa('0x1')]},'username':{'type':Sequelize[_0xe5aa('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe5aa('0x1')],'allowNull':![],'defaultValue':_0xe5aa('0x2')},'remoteUri':{'type':Sequelize[_0xe5aa('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe5aa('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7e09=['STRING','HelpDesk','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7e09,0x1b2));var _0x97e0=function(_0x2c7b5c,_0x331adf){_0x2c7b5c=_0x2c7b5c-0x0;var _0x1df5f3=_0x7e09[_0x2c7b5c];return _0x1df5f3;};'use strict';var Sequelize=require(_0x97e0('0x0'));module[_0x97e0('0x1')]={'name':{'type':Sequelize[_0x97e0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x97e0('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x97e0('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x97e0('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x97e0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 925ad03..9129dce 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.controller.js +++ b/server/api/intVtigerAccount/intVtigerAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca1b=['Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','catch','show','params','find','create','body','getConfigurations','VtigerConfiguration','order','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','VtigerField','Subjects','md5','getFields','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','format','%s/webservice.php','GET','success','POST','result','describe','sessionName','reference','owner','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x90c365,_0x5aadef){var _0x3c5b37=function(_0xe2a7fe){while(--_0xe2a7fe){_0x90c365['push'](_0x90c365['shift']());}};_0x3c5b37(++_0x5aadef);}(_0xca1b,0x1da));var _0xbca1=function(_0x5b149a,_0x1d4b98){_0x5b149a=_0x5b149a-0x0;var _0x58875e=_0xca1b[_0x5b149a];return _0x58875e;};'use strict';var emlformat=require(_0xbca1('0x0'));var rimraf=require(_0xbca1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbca1('0x2'));var rp=require(_0xbca1('0x3'));var moment=require('moment');var BPromise=require(_0xbca1('0x4'));var Mustache=require(_0xbca1('0x5'));var util=require('util');var path=require(_0xbca1('0x6'));var sox=require(_0xbca1('0x7'));var csv=require(_0xbca1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbca1('0x9'));var squel=require(_0xbca1('0xa'));var crypto=require(_0xbca1('0xb'));var jsforce=require(_0xbca1('0xc'));var deskjs=require(_0xbca1('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbca1('0xe'));var Papa=require(_0xbca1('0xf'));var Redis=require(_0xbca1('0x10'));var authService=require(_0xbca1('0x11'));var qs=require(_0xbca1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbca1('0x13'));var utils=require(_0xbca1('0x14'));var config=require(_0xbca1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xbca1('0x16'));function respondWithStatusCode(_0x47efca,_0xd29dcd){_0xd29dcd=_0xd29dcd||0xcc;return function(_0x5c72a0){if(_0x5c72a0){return _0x47efca['sendStatus'](_0xd29dcd);}return _0x47efca[_0xbca1('0x17')](_0xd29dcd)[_0xbca1('0x18')]();};}function respondWithResult(_0x15f892,_0x2300a3){_0x2300a3=_0x2300a3||0xc8;return function(_0x46eea4){if(_0x46eea4){return _0x15f892[_0xbca1('0x17')](_0x2300a3)[_0xbca1('0x19')](_0x46eea4);}};}function respondWithFilteredResult(_0x350101,_0x30c597){return function(_0x548883){if(_0x548883){var _0x3b0e76=typeof _0x30c597[_0xbca1('0x1a')]===_0xbca1('0x1b')&&typeof _0x30c597[_0xbca1('0x1c')]===_0xbca1('0x1b');var _0x5b8a74=_0x548883['count'];var _0x559363=_0x3b0e76?0x0:_0x30c597['offset'];var _0x5f124e=_0x3b0e76?_0x548883[_0xbca1('0x1d')]:_0x30c597[_0xbca1('0x1a')]+_0x30c597[_0xbca1('0x1c')];var _0x371187;if(_0x5f124e>=_0x5b8a74){_0x5f124e=_0x5b8a74;_0x371187=0xc8;}else{_0x371187=0xce;}_0x350101[_0xbca1('0x17')](_0x371187);return _0x350101[_0xbca1('0x1e')](_0xbca1('0x1f'),_0x559363+'-'+_0x5f124e+'/'+_0x5b8a74)[_0xbca1('0x19')](_0x548883);}return null;};}function patchUpdates(_0x2f7001){return function(_0xf1cac1){try{jsonpatch[_0xbca1('0x20')](_0xf1cac1,_0x2f7001,!![]);}catch(_0x1245a0){return BPromise[_0xbca1('0x21')](_0x1245a0);}return _0xf1cac1[_0xbca1('0x22')]();};}function saveUpdates(_0x210f66,_0x4cdedb){return function(_0x30761d){if(_0x30761d){return _0x30761d[_0xbca1('0x23')](_0x210f66)[_0xbca1('0x24')](function(_0x3e5fa8){return _0x3e5fa8;});}return null;};}function removeEntity(_0xee009,_0x4910f6){return function(_0x22cdef){if(_0x22cdef){return _0x22cdef[_0xbca1('0x25')]()[_0xbca1('0x24')](function(){_0xee009['status'](0xcc)[_0xbca1('0x18')]();});}};}function handleEntityNotFound(_0x29ce0a,_0xddbf17){return function(_0x5e6292){if(!_0x5e6292){_0x29ce0a['sendStatus'](0x194);}return _0x5e6292;};}function handleError(_0x29b7df,_0x13d20e){_0x13d20e=_0x13d20e||0x1f4;return function(_0x501867){logger[_0xbca1('0x26')](_0x501867[_0xbca1('0x27')]);if(_0x501867[_0xbca1('0x28')]){delete _0x501867['name'];}_0x29b7df['status'](_0x13d20e)[_0xbca1('0x29')](_0x501867);};}exports[_0xbca1('0x2a')]=function(_0x360511,_0x107368){var _0x4069c6={},_0x303cb0={},_0x130b2b={'count':0x0,'rows':[]};var _0x510dee=_[_0xbca1('0x2b')](db[_0xbca1('0x2c')][_0xbca1('0x2d')],function(_0x448998){return{'name':_0x448998[_0xbca1('0x2e')],'type':_0x448998[_0xbca1('0x2f')][_0xbca1('0x30')]};});_0x303cb0[_0xbca1('0x31')]=_['map'](_0x510dee,_0xbca1('0x28'));_0x303cb0['query']=_[_0xbca1('0x32')](_0x360511['query']);_0x303cb0['filters']=_[_0xbca1('0x33')](_0x303cb0['model'],_0x303cb0[_0xbca1('0x34')]);_0x4069c6[_0xbca1('0x35')]=_['intersection'](_0x303cb0[_0xbca1('0x31')],qs[_0xbca1('0x36')](_0x360511[_0xbca1('0x34')][_0xbca1('0x36')]));_0x4069c6[_0xbca1('0x35')]=_0x4069c6[_0xbca1('0x35')][_0xbca1('0x37')]?_0x4069c6[_0xbca1('0x35')]:_0x303cb0['model'];if(!_0x360511[_0xbca1('0x34')][_0xbca1('0x38')](_0xbca1('0x39'))){_0x4069c6[_0xbca1('0x1c')]=qs['limit'](_0x360511[_0xbca1('0x34')][_0xbca1('0x1c')]);_0x4069c6[_0xbca1('0x1a')]=qs['offset'](_0x360511[_0xbca1('0x34')][_0xbca1('0x1a')]);}_0x4069c6['order']=qs[_0xbca1('0x3a')](_0x360511[_0xbca1('0x34')]['sort']);_0x4069c6[_0xbca1('0x3b')]=qs[_0xbca1('0x3c')](_[_0xbca1('0x3d')](_0x360511[_0xbca1('0x34')],_0x303cb0[_0xbca1('0x3c')]),_0x510dee);if(_0x360511[_0xbca1('0x34')][_0xbca1('0x3e')]){_0x4069c6[_0xbca1('0x3b')]=_['merge'](_0x4069c6['where'],{'$or':_[_0xbca1('0x2b')](_0x510dee,function(_0x30737f){if(_0x30737f[_0xbca1('0x2f')]!=='VIRTUAL'){var _0x412a8e={};_0x412a8e[_0x30737f[_0xbca1('0x28')]]={'$like':'%'+_0x360511['query'][_0xbca1('0x3e')]+'%'};return _0x412a8e;}})});}_0x4069c6=_[_0xbca1('0x3f')]({},_0x4069c6,_0x360511[_0xbca1('0x40')]);var _0x19ea1a={'where':_0x4069c6[_0xbca1('0x3b')]};return db['VtigerAccount'][_0xbca1('0x1d')](_0x19ea1a)['then'](function(_0x586998){_0x130b2b[_0xbca1('0x1d')]=_0x586998;if(_0x360511['query']['includeAll']){_0x4069c6[_0xbca1('0x41')]=[{'all':!![]}];}return db[_0xbca1('0x2c')][_0xbca1('0x42')](_0x4069c6);})['then'](function(_0x4822e3){_0x130b2b['rows']=_0x4822e3;return _0x130b2b;})[_0xbca1('0x24')](respondWithFilteredResult(_0x107368,_0x4069c6))[_0xbca1('0x43')](handleError(_0x107368,null));};exports[_0xbca1('0x44')]=function(_0x5eab5e,_0x3c5dfa){var _0x26063f={'raw':![],'where':{'id':_0x5eab5e[_0xbca1('0x45')]['id']}},_0xda0479={};_0xda0479[_0xbca1('0x31')]=_[_0xbca1('0x32')](db[_0xbca1('0x2c')][_0xbca1('0x2d')]);_0xda0479[_0xbca1('0x34')]=_[_0xbca1('0x32')](_0x5eab5e[_0xbca1('0x34')]);_0xda0479['filters']=_[_0xbca1('0x33')](_0xda0479[_0xbca1('0x31')],_0xda0479[_0xbca1('0x34')]);_0x26063f['attributes']=_[_0xbca1('0x33')](_0xda0479[_0xbca1('0x31')],qs[_0xbca1('0x36')](_0x5eab5e[_0xbca1('0x34')][_0xbca1('0x36')]));_0x26063f[_0xbca1('0x35')]=_0x26063f[_0xbca1('0x35')][_0xbca1('0x37')]?_0x26063f[_0xbca1('0x35')]:_0xda0479[_0xbca1('0x31')];if(_0x5eab5e['query']['includeAll']){_0x26063f[_0xbca1('0x41')]=[{'all':!![]}];}_0x26063f=_['merge']({},_0x26063f,_0x5eab5e[_0xbca1('0x40')]);return db[_0xbca1('0x2c')][_0xbca1('0x46')](_0x26063f)[_0xbca1('0x24')](handleEntityNotFound(_0x3c5dfa,null))[_0xbca1('0x24')](respondWithResult(_0x3c5dfa,null))[_0xbca1('0x43')](handleError(_0x3c5dfa,null));};exports[_0xbca1('0x47')]=function(_0x547903,_0x122453){return db[_0xbca1('0x2c')]['create'](_0x547903[_0xbca1('0x48')],{})['then'](respondWithResult(_0x122453,0xc9))[_0xbca1('0x43')](handleError(_0x122453,null));};exports[_0xbca1('0x23')]=function(_0x13b619,_0x2e77e5){if(_0x13b619['body']['id']){delete _0x13b619[_0xbca1('0x48')]['id'];}return db[_0xbca1('0x2c')]['find']({'where':{'id':_0x13b619[_0xbca1('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e77e5,null))[_0xbca1('0x24')](saveUpdates(_0x13b619['body'],null))[_0xbca1('0x24')](respondWithResult(_0x2e77e5,null))[_0xbca1('0x43')](handleError(_0x2e77e5,null));};exports[_0xbca1('0x25')]=function(_0x1cdffb,_0x17369b){return db[_0xbca1('0x2c')][_0xbca1('0x46')]({'where':{'id':_0x1cdffb[_0xbca1('0x45')]['id']}})[_0xbca1('0x24')](handleEntityNotFound(_0x17369b,null))[_0xbca1('0x24')](removeEntity(_0x17369b,null))[_0xbca1('0x43')](handleError(_0x17369b,null));};exports[_0xbca1('0x49')]=function(_0x5718da,_0x407f0c,_0x47493d){var _0xadda6a={};var _0x549f4e={};var _0x584f37;var _0x26ee66;return db[_0xbca1('0x2c')]['findOne']({'where':{'id':_0x5718da[_0xbca1('0x45')]['id']}})[_0xbca1('0x24')](handleEntityNotFound(_0x407f0c,null))[_0xbca1('0x24')](function(_0x2ddea5){if(_0x2ddea5){_0x584f37=_0x2ddea5;_0x549f4e[_0xbca1('0x31')]=_[_0xbca1('0x32')](db[_0xbca1('0x4a')][_0xbca1('0x2d')]);_0x549f4e['query']=_[_0xbca1('0x32')](_0x5718da[_0xbca1('0x34')]);_0x549f4e[_0xbca1('0x3c')]=_['intersection'](_0x549f4e[_0xbca1('0x31')],_0x549f4e[_0xbca1('0x34')]);_0xadda6a['attributes']=_[_0xbca1('0x33')](_0x549f4e['model'],qs[_0xbca1('0x36')](_0x5718da[_0xbca1('0x34')]['fields']));_0xadda6a[_0xbca1('0x35')]=_0xadda6a[_0xbca1('0x35')][_0xbca1('0x37')]?_0xadda6a[_0xbca1('0x35')]:_0x549f4e[_0xbca1('0x31')];_0xadda6a[_0xbca1('0x4b')]=qs['sort'](_0x5718da[_0xbca1('0x34')][_0xbca1('0x3a')]);_0xadda6a[_0xbca1('0x3b')]=qs[_0xbca1('0x3c')](_[_0xbca1('0x3d')](_0x5718da[_0xbca1('0x34')],_0x549f4e[_0xbca1('0x3c')]));if(_0x5718da[_0xbca1('0x34')][_0xbca1('0x3e')]){_0xadda6a[_0xbca1('0x3b')]=_[_0xbca1('0x3f')](_0xadda6a['where'],{'$or':_[_0xbca1('0x2b')](_0xadda6a['attributes'],function(_0x36b316){var _0x4e1c36={};_0x4e1c36[_0x36b316]={'$like':'%'+_0x5718da[_0xbca1('0x34')][_0xbca1('0x3e')]+'%'};return _0x4e1c36;})});}_0xadda6a=_[_0xbca1('0x3f')]({},_0xadda6a,_0x5718da[_0xbca1('0x40')]);return _0x584f37[_0xbca1('0x49')](_0xadda6a);}})[_0xbca1('0x24')](function(_0x3b3479){if(_0x3b3479){_0x26ee66=_0x3b3479['length'];if(!_0x5718da[_0xbca1('0x34')][_0xbca1('0x38')]('nolimit')){_0xadda6a[_0xbca1('0x1c')]=qs[_0xbca1('0x1c')](_0x5718da[_0xbca1('0x34')]['limit']);_0xadda6a[_0xbca1('0x1a')]=qs[_0xbca1('0x1a')](_0x5718da[_0xbca1('0x34')][_0xbca1('0x1a')]);}return _0x584f37[_0xbca1('0x49')](_0xadda6a);}})[_0xbca1('0x24')](function(_0x438b7c){if(_0x438b7c){return _0x438b7c?{'count':_0x26ee66,'rows':_0x438b7c}:null;}})[_0xbca1('0x24')](respondWithResult(_0x407f0c,null))[_0xbca1('0x43')](handleError(_0x407f0c,null));};exports[_0xbca1('0x4c')]=function(_0x4bb75c,_0x1a2331,_0x57fbac){if(_0x4bb75c[_0xbca1('0x48')]['id']){delete _0x4bb75c[_0xbca1('0x48')]['id'];}return db[_0xbca1('0x2c')][_0xbca1('0x4d')]({'where':{'id':_0x4bb75c[_0xbca1('0x45')]['id']}})[_0xbca1('0x24')](handleEntityNotFound(_0x1a2331,null))[_0xbca1('0x24')](function(_0x9c6f01){if(_0x9c6f01){_0x4bb75c[_0xbca1('0x48')][_0xbca1('0x4e')]=_0x9c6f01['id'];_0x4bb75c['body']['Subjects']=integrations[_0xbca1('0x4f')](_0x4bb75c['body'][_0xbca1('0x50')],_0x4bb75c[_0xbca1('0x48')]['type']);_0x4bb75c[_0xbca1('0x48')][_0xbca1('0x51')]=integrations['getDescriptions'](_0x4bb75c[_0xbca1('0x48')][_0xbca1('0x50')],_0x4bb75c[_0xbca1('0x48')][_0xbca1('0x2f')]);return db['VtigerConfiguration'][_0xbca1('0x47')](_0x4bb75c[_0xbca1('0x48')],{'include':[{'model':db[_0xbca1('0x52')],'as':_0xbca1('0x53')},{'model':db[_0xbca1('0x52')],'as':'Descriptions'}]});}return null;})[_0xbca1('0x24')](respondWithResult(_0x1a2331,null))[_0xbca1('0x43')](handleError(_0x1a2331,null));};var md5=require(_0xbca1('0x54'));exports[_0xbca1('0x55')]=function(_0x35740f,_0x4ed0f1,_0x3b27cc){var _0x46ac25=null;var _0x5ad33d=null;var _0x4705fc=null;var _0x283623=null;var _0xe58362='';return db[_0xbca1('0x2c')][_0xbca1('0x4d')]({'where':{'id':_0x35740f[_0xbca1('0x45')]['id']},'attributes':['id',_0xbca1('0x28'),'username','description',_0xbca1('0x56'),_0xbca1('0x57'),_0xbca1('0x58'),_0xbca1('0x59')]})[_0xbca1('0x24')](handleEntityNotFound(_0x4ed0f1,null))[_0xbca1('0x24')](function(_0x559848){if(_0x559848){_0x46ac25=_0x559848[_0xbca1('0x5a')];_0x5ad33d=_0x559848[_0xbca1('0x59')];_0x4705fc=_0x559848['moduleName'];_0xe58362=_0x559848[_0xbca1('0x57')];var _0x45b456=_0xe58362[_0xbca1('0x5b')](-0x1);if(_0x45b456==='/'){_0xe58362=_0xe58362[_0xbca1('0x5c')](0x0,_0xe58362['lastIndexOf'](_0x45b456));}_0x283623=util[_0xbca1('0x5d')](_0xbca1('0x5e'),_0xe58362);var _0x1021dc={'method':_0xbca1('0x5f'),'uri':_0x283623,'qs':{'operation':'getchallenge','username':_0x559848[_0xbca1('0x5a')]},'json':!![]};return rp(_0x1021dc);}})[_0xbca1('0x24')](function(_0x1b4534){if(_0x1b4534[_0xbca1('0x60')]){var _0x43e0fa={'method':_0xbca1('0x61'),'uri':_0x283623,'form':{'operation':'login','username':_0x46ac25,'accessKey':md5(_0x1b4534[_0xbca1('0x62')]['token']+_0x5ad33d)},'json':!![]};return rp(_0x43e0fa);}})[_0xbca1('0x24')](function(_0x29e184){if(_0x29e184['success']){var _0x735ef1={'method':_0xbca1('0x5f'),'uri':_0x283623,'qs':{'operation':_0xbca1('0x63'),'username':_0x46ac25,'sessionName':_0x29e184[_0xbca1('0x62')][_0xbca1('0x64')],'elementType':_0x4705fc},'json':!![]};return rp(_0x735ef1);}})[_0xbca1('0x24')](function(_0x48c211){if(_0x48c211[_0xbca1('0x60')]){var _0x4fd5ec=['autogenerated',_0xbca1('0x65'),_0xbca1('0x66')];_[_0xbca1('0x67')](_0x48c211[_0xbca1('0x62')][_0xbca1('0x36')],function(_0x4a37bb){return _0x4fd5ec[_0xbca1('0x68')](_0x4a37bb[_0xbca1('0x2f')][_0xbca1('0x28')]);});_[_0xbca1('0x67')](_0x48c211['result'][_0xbca1('0x36')],function(_0x44dca5){return _0x44dca5['editable']===_0xbca1('0x69');});return{'count':_0x48c211[_0xbca1('0x62')][_0xbca1('0x36')][_0xbca1('0x37')],'rows':_[_0xbca1('0x2b')](_0x48c211['result']['fields'],function(_0x306b88){return{'id':_0x306b88[_0xbca1('0x28')],'name':_0x306b88[_0xbca1('0x6a')],'custom':_[_0xbca1('0x6b')](_0x306b88[_0xbca1('0x28')],_0xbca1('0x6c'))?!![]:![],'options':_0x306b88[_0xbca1('0x2f')][_0xbca1('0x28')]===_0xbca1('0x6d')&&_0x306b88[_0xbca1('0x2f')][_0xbca1('0x6e')]['length']>0x0?_[_0xbca1('0x2b')](_0x306b88[_0xbca1('0x2f')][_0xbca1('0x6e')],function(_0x36f485){return{'name':_0x36f485['label'],'value':_0x36f485['value']};}):[]};})};}})[_0xbca1('0x24')](respondWithResult(_0x4ed0f1,null))['catch'](function(_0x26868e){console[_0xbca1('0x6f')](_0xbca1('0x70')+_0x26868e);var _0x19834d=_0x35740f[_0xbca1('0x34')][_0xbca1('0x71')]?0x1f4:_0x26868e['statusCode']||0x1f4;logger[_0xbca1('0x26')](_0xbca1('0x72'),_0xbca1('0x55'),_0x19834d,JSON[_0xbca1('0x73')](_0x26868e));delete _0x26868e[_0xbca1('0x28')];if(_0x19834d===0x191){_0x19834d=0x190;}_0x4ed0f1['status'](_0x19834d)[_0xbca1('0x29')](_0x35740f[_0xbca1('0x34')][_0xbca1('0x71')]?{'message':_0xbca1('0x74'),'statusCode':_0x26868e[_0xbca1('0x75')]}:_0x26868e);});}; \ No newline at end of file +var _0x5ddf=['length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','VtigerAccount','includeAll','include','findAll','params','keys','find','create','body','catch','update','getConfigurations','findOne','order','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','Subjects','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','sessionName','owner','includes','remove','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','then','error','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields'];(function(_0x391d91,_0xb372c2){var _0x41f762=function(_0x14b121){while(--_0x14b121){_0x391d91['push'](_0x391d91['shift']());}};_0x41f762(++_0xb372c2);}(_0x5ddf,0x1a0));var _0xf5dd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5ddf[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xf5dd('0x0'));var rimraf=require(_0xf5dd('0x1'));var zipdir=require(_0xf5dd('0x2'));var jsonpatch=require(_0xf5dd('0x3'));var rp=require('request-promise');var moment=require(_0xf5dd('0x4'));var BPromise=require(_0xf5dd('0x5'));var Mustache=require(_0xf5dd('0x6'));var util=require('util');var path=require(_0xf5dd('0x7'));var sox=require(_0xf5dd('0x8'));var csv=require(_0xf5dd('0x9'));var ejs=require(_0xf5dd('0xa'));var fs=require('fs');var fs_extra=require(_0xf5dd('0xb'));var _=require(_0xf5dd('0xc'));var squel=require('squel');var crypto=require(_0xf5dd('0xd'));var jsforce=require(_0xf5dd('0xe'));var deskjs=require(_0xf5dd('0xf'));var toCsv=require(_0xf5dd('0x9'));var querystring=require(_0xf5dd('0x10'));var Papa=require(_0xf5dd('0x11'));var Redis=require('ioredis');var authService=require(_0xf5dd('0x12'));var qs=require(_0xf5dd('0x13'));var as=require(_0xf5dd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5dd('0x15'))(_0xf5dd('0x16'));var utils=require(_0xf5dd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf5dd('0x18'));function respondWithStatusCode(_0xa2581d,_0x1d98fe){_0x1d98fe=_0x1d98fe||0xcc;return function(_0x405800){if(_0x405800){return _0xa2581d[_0xf5dd('0x19')](_0x1d98fe);}return _0xa2581d[_0xf5dd('0x1a')](_0x1d98fe)[_0xf5dd('0x1b')]();};}function respondWithResult(_0xc8e10c,_0x4246c1){_0x4246c1=_0x4246c1||0xc8;return function(_0x13152f){if(_0x13152f){return _0xc8e10c[_0xf5dd('0x1a')](_0x4246c1)[_0xf5dd('0x1c')](_0x13152f);}};}function respondWithFilteredResult(_0x2eb990,_0x47d435){return function(_0x44c334){if(_0x44c334){var _0x4e3107=typeof _0x47d435[_0xf5dd('0x1d')]===_0xf5dd('0x1e')&&typeof _0x47d435[_0xf5dd('0x1f')]==='undefined';var _0x222fc5=_0x44c334[_0xf5dd('0x20')];var _0x1b3ef6=_0x4e3107?0x0:_0x47d435['offset'];var _0x3f96cc=_0x4e3107?_0x44c334[_0xf5dd('0x20')]:_0x47d435['offset']+_0x47d435[_0xf5dd('0x1f')];var _0x7489af;if(_0x3f96cc>=_0x222fc5){_0x3f96cc=_0x222fc5;_0x7489af=0xc8;}else{_0x7489af=0xce;}_0x2eb990['status'](_0x7489af);return _0x2eb990['set'](_0xf5dd('0x21'),_0x1b3ef6+'-'+_0x3f96cc+'/'+_0x222fc5)[_0xf5dd('0x1c')](_0x44c334);}return null;};}function patchUpdates(_0x1f0ef7){return function(_0x485968){try{jsonpatch['apply'](_0x485968,_0x1f0ef7,!![]);}catch(_0x3528b9){return BPromise[_0xf5dd('0x22')](_0x3528b9);}return _0x485968[_0xf5dd('0x23')]();};}function saveUpdates(_0x51afff,_0x26bbc9){return function(_0x5e2677){if(_0x5e2677){return _0x5e2677['update'](_0x51afff)['then'](function(_0x4f10ec){return _0x4f10ec;});}return null;};}function removeEntity(_0xdd5d6f,_0x36bee9){return function(_0x519594){if(_0x519594){return _0x519594[_0xf5dd('0x24')]()[_0xf5dd('0x25')](function(){_0xdd5d6f['status'](0xcc)[_0xf5dd('0x1b')]();});}};}function handleEntityNotFound(_0x41683f,_0x1bea2d){return function(_0x379423){if(!_0x379423){_0x41683f[_0xf5dd('0x19')](0x194);}return _0x379423;};}function handleError(_0x3c96a1,_0x473f88){_0x473f88=_0x473f88||0x1f4;return function(_0xdec13b){logger[_0xf5dd('0x26')](_0xdec13b['stack']);if(_0xdec13b[_0xf5dd('0x27')]){delete _0xdec13b[_0xf5dd('0x27')];}_0x3c96a1[_0xf5dd('0x1a')](_0x473f88)['send'](_0xdec13b);};}exports[_0xf5dd('0x28')]=function(_0x227105,_0x5011ad){var _0x48d343={},_0x497210={},_0x25b46d={'count':0x0,'rows':[]};var _0x14e4d9=_[_0xf5dd('0x29')](db['VtigerAccount'][_0xf5dd('0x2a')],function(_0x1655f3){return{'name':_0x1655f3[_0xf5dd('0x2b')],'type':_0x1655f3[_0xf5dd('0x2c')][_0xf5dd('0x2d')]};});_0x497210['model']=_[_0xf5dd('0x29')](_0x14e4d9,_0xf5dd('0x27'));_0x497210['query']=_['keys'](_0x227105[_0xf5dd('0x2e')]);_0x497210[_0xf5dd('0x2f')]=_[_0xf5dd('0x30')](_0x497210[_0xf5dd('0x31')],_0x497210['query']);_0x48d343[_0xf5dd('0x32')]=_[_0xf5dd('0x30')](_0x497210['model'],qs[_0xf5dd('0x33')](_0x227105[_0xf5dd('0x2e')][_0xf5dd('0x33')]));_0x48d343[_0xf5dd('0x32')]=_0x48d343[_0xf5dd('0x32')][_0xf5dd('0x34')]?_0x48d343[_0xf5dd('0x32')]:_0x497210['model'];if(!_0x227105[_0xf5dd('0x2e')][_0xf5dd('0x35')]('nolimit')){_0x48d343[_0xf5dd('0x1f')]=qs[_0xf5dd('0x1f')](_0x227105['query'][_0xf5dd('0x1f')]);_0x48d343['offset']=qs[_0xf5dd('0x1d')](_0x227105[_0xf5dd('0x2e')]['offset']);}_0x48d343['order']=qs[_0xf5dd('0x36')](_0x227105[_0xf5dd('0x2e')][_0xf5dd('0x36')]);_0x48d343[_0xf5dd('0x37')]=qs[_0xf5dd('0x2f')](_[_0xf5dd('0x38')](_0x227105[_0xf5dd('0x2e')],_0x497210[_0xf5dd('0x2f')]),_0x14e4d9);if(_0x227105[_0xf5dd('0x2e')][_0xf5dd('0x39')]){_0x48d343[_0xf5dd('0x37')]=_[_0xf5dd('0x3a')](_0x48d343['where'],{'$or':_[_0xf5dd('0x29')](_0x14e4d9,function(_0x177688){if(_0x177688[_0xf5dd('0x2c')]!==_0xf5dd('0x3b')){var _0x4009e7={};_0x4009e7[_0x177688['name']]={'$like':'%'+_0x227105[_0xf5dd('0x2e')][_0xf5dd('0x39')]+'%'};return _0x4009e7;}})});}_0x48d343=_[_0xf5dd('0x3a')]({},_0x48d343,_0x227105['options']);var _0x20a418={'where':_0x48d343[_0xf5dd('0x37')]};return db[_0xf5dd('0x3c')]['count'](_0x20a418)[_0xf5dd('0x25')](function(_0x2b8d81){_0x25b46d[_0xf5dd('0x20')]=_0x2b8d81;if(_0x227105[_0xf5dd('0x2e')][_0xf5dd('0x3d')]){_0x48d343[_0xf5dd('0x3e')]=[{'all':!![]}];}return db[_0xf5dd('0x3c')][_0xf5dd('0x3f')](_0x48d343);})[_0xf5dd('0x25')](function(_0x16ef7a){_0x25b46d['rows']=_0x16ef7a;return _0x25b46d;})[_0xf5dd('0x25')](respondWithFilteredResult(_0x5011ad,_0x48d343))['catch'](handleError(_0x5011ad,null));};exports['show']=function(_0x47ad01,_0x31e846){var _0x2b98c0={'raw':![],'where':{'id':_0x47ad01[_0xf5dd('0x40')]['id']}},_0x296e28={};_0x296e28[_0xf5dd('0x31')]=_['keys'](db[_0xf5dd('0x3c')][_0xf5dd('0x2a')]);_0x296e28[_0xf5dd('0x2e')]=_[_0xf5dd('0x41')](_0x47ad01[_0xf5dd('0x2e')]);_0x296e28['filters']=_[_0xf5dd('0x30')](_0x296e28[_0xf5dd('0x31')],_0x296e28['query']);_0x2b98c0['attributes']=_[_0xf5dd('0x30')](_0x296e28['model'],qs[_0xf5dd('0x33')](_0x47ad01['query']['fields']));_0x2b98c0[_0xf5dd('0x32')]=_0x2b98c0['attributes'][_0xf5dd('0x34')]?_0x2b98c0[_0xf5dd('0x32')]:_0x296e28['model'];if(_0x47ad01[_0xf5dd('0x2e')]['includeAll']){_0x2b98c0[_0xf5dd('0x3e')]=[{'all':!![]}];}_0x2b98c0=_[_0xf5dd('0x3a')]({},_0x2b98c0,_0x47ad01['options']);return db[_0xf5dd('0x3c')][_0xf5dd('0x42')](_0x2b98c0)['then'](handleEntityNotFound(_0x31e846,null))[_0xf5dd('0x25')](respondWithResult(_0x31e846,null))['catch'](handleError(_0x31e846,null));};exports['create']=function(_0x28f3ba,_0x57304f){return db[_0xf5dd('0x3c')][_0xf5dd('0x43')](_0x28f3ba[_0xf5dd('0x44')],{})[_0xf5dd('0x25')](respondWithResult(_0x57304f,0xc9))[_0xf5dd('0x45')](handleError(_0x57304f,null));};exports[_0xf5dd('0x46')]=function(_0x400011,_0x1d576c){if(_0x400011[_0xf5dd('0x44')]['id']){delete _0x400011['body']['id'];}return db['VtigerAccount'][_0xf5dd('0x42')]({'where':{'id':_0x400011[_0xf5dd('0x40')]['id']}})[_0xf5dd('0x25')](handleEntityNotFound(_0x1d576c,null))['then'](saveUpdates(_0x400011['body'],null))['then'](respondWithResult(_0x1d576c,null))[_0xf5dd('0x45')](handleError(_0x1d576c,null));};exports[_0xf5dd('0x24')]=function(_0x15a7cb,_0xa5ec77){return db[_0xf5dd('0x3c')][_0xf5dd('0x42')]({'where':{'id':_0x15a7cb[_0xf5dd('0x40')]['id']}})[_0xf5dd('0x25')](handleEntityNotFound(_0xa5ec77,null))['then'](removeEntity(_0xa5ec77,null))['catch'](handleError(_0xa5ec77,null));};exports[_0xf5dd('0x47')]=function(_0x4cf269,_0x20a19e,_0x2496b4){var _0x57bb0c={};var _0x5911f9={};var _0x5bf045;var _0x2d772b;return db['VtigerAccount'][_0xf5dd('0x48')]({'where':{'id':_0x4cf269[_0xf5dd('0x40')]['id']}})['then'](handleEntityNotFound(_0x20a19e,null))[_0xf5dd('0x25')](function(_0x3a98d4){if(_0x3a98d4){_0x5bf045=_0x3a98d4;_0x5911f9[_0xf5dd('0x31')]=_[_0xf5dd('0x41')](db['VtigerConfiguration']['rawAttributes']);_0x5911f9['query']=_[_0xf5dd('0x41')](_0x4cf269[_0xf5dd('0x2e')]);_0x5911f9[_0xf5dd('0x2f')]=_['intersection'](_0x5911f9['model'],_0x5911f9[_0xf5dd('0x2e')]);_0x57bb0c[_0xf5dd('0x32')]=_[_0xf5dd('0x30')](_0x5911f9[_0xf5dd('0x31')],qs[_0xf5dd('0x33')](_0x4cf269[_0xf5dd('0x2e')][_0xf5dd('0x33')]));_0x57bb0c[_0xf5dd('0x32')]=_0x57bb0c[_0xf5dd('0x32')][_0xf5dd('0x34')]?_0x57bb0c['attributes']:_0x5911f9[_0xf5dd('0x31')];_0x57bb0c[_0xf5dd('0x49')]=qs['sort'](_0x4cf269[_0xf5dd('0x2e')]['sort']);_0x57bb0c[_0xf5dd('0x37')]=qs[_0xf5dd('0x2f')](_[_0xf5dd('0x38')](_0x4cf269['query'],_0x5911f9[_0xf5dd('0x2f')]));if(_0x4cf269[_0xf5dd('0x2e')][_0xf5dd('0x39')]){_0x57bb0c[_0xf5dd('0x37')]=_[_0xf5dd('0x3a')](_0x57bb0c[_0xf5dd('0x37')],{'$or':_[_0xf5dd('0x29')](_0x57bb0c[_0xf5dd('0x32')],function(_0x3cf1df){var _0x2ae7b8={};_0x2ae7b8[_0x3cf1df]={'$like':'%'+_0x4cf269[_0xf5dd('0x2e')][_0xf5dd('0x39')]+'%'};return _0x2ae7b8;})});}_0x57bb0c=_['merge']({},_0x57bb0c,_0x4cf269['options']);return _0x5bf045[_0xf5dd('0x47')](_0x57bb0c);}})['then'](function(_0x4ac89e){if(_0x4ac89e){_0x2d772b=_0x4ac89e['length'];if(!_0x4cf269['query'][_0xf5dd('0x35')](_0xf5dd('0x4a'))){_0x57bb0c[_0xf5dd('0x1f')]=qs[_0xf5dd('0x1f')](_0x4cf269['query'][_0xf5dd('0x1f')]);_0x57bb0c['offset']=qs[_0xf5dd('0x1d')](_0x4cf269[_0xf5dd('0x2e')][_0xf5dd('0x1d')]);}return _0x5bf045[_0xf5dd('0x47')](_0x57bb0c);}})[_0xf5dd('0x25')](function(_0xbdb05f){if(_0xbdb05f){return _0xbdb05f?{'count':_0x2d772b,'rows':_0xbdb05f}:null;}})[_0xf5dd('0x25')](respondWithResult(_0x20a19e,null))[_0xf5dd('0x45')](handleError(_0x20a19e,null));};exports['addConfiguration']=function(_0x5f18f4,_0x367b02,_0xe068c3){if(_0x5f18f4[_0xf5dd('0x44')]['id']){delete _0x5f18f4['body']['id'];}return db[_0xf5dd('0x3c')]['findOne']({'where':{'id':_0x5f18f4[_0xf5dd('0x40')]['id']}})[_0xf5dd('0x25')](handleEntityNotFound(_0x367b02,null))[_0xf5dd('0x25')](function(_0x704484){if(_0x704484){_0x5f18f4[_0xf5dd('0x44')][_0xf5dd('0x4b')]=_0x704484['id'];_0x5f18f4[_0xf5dd('0x44')]['Subjects']=integrations[_0xf5dd('0x4c')](_0x5f18f4[_0xf5dd('0x44')][_0xf5dd('0x4d')],_0x5f18f4[_0xf5dd('0x44')][_0xf5dd('0x2c')]);_0x5f18f4[_0xf5dd('0x44')][_0xf5dd('0x4e')]=integrations[_0xf5dd('0x4f')](_0x5f18f4[_0xf5dd('0x44')][_0xf5dd('0x4d')],_0x5f18f4[_0xf5dd('0x44')][_0xf5dd('0x2c')]);return db[_0xf5dd('0x50')]['create'](_0x5f18f4[_0xf5dd('0x44')],{'include':[{'model':db[_0xf5dd('0x51')],'as':_0xf5dd('0x52')},{'model':db[_0xf5dd('0x51')],'as':_0xf5dd('0x4e')}]});}return null;})[_0xf5dd('0x25')](respondWithResult(_0x367b02,null))['catch'](handleError(_0x367b02,null));};var md5=require('md5');exports[_0xf5dd('0x53')]=function(_0x48ef7b,_0x1db320,_0x434c6d){var _0x20e1ec=null;var _0x48cb53=null;var _0x9149f=null;var _0x3fbd2f=null;var _0x4c017a='';return db['VtigerAccount'][_0xf5dd('0x48')]({'where':{'id':_0x48ef7b[_0xf5dd('0x40')]['id']},'attributes':['id','name',_0xf5dd('0x54'),_0xf5dd('0x55'),_0xf5dd('0x56'),_0xf5dd('0x57'),'serverUrl',_0xf5dd('0x58')]})['then'](handleEntityNotFound(_0x1db320,null))['then'](function(_0x1cf8b3){if(_0x1cf8b3){_0x20e1ec=_0x1cf8b3[_0xf5dd('0x54')];_0x48cb53=_0x1cf8b3['accessKey'];_0x9149f=_0x1cf8b3[_0xf5dd('0x56')];_0x4c017a=_0x1cf8b3[_0xf5dd('0x57')];var _0x16830e=_0x4c017a[_0xf5dd('0x59')](-0x1);if(_0x16830e==='/'){_0x4c017a=_0x4c017a[_0xf5dd('0x5a')](0x0,_0x4c017a['lastIndexOf'](_0x16830e));}_0x3fbd2f=util[_0xf5dd('0x5b')](_0xf5dd('0x5c'),_0x4c017a);var _0x5bb9da={'method':_0xf5dd('0x5d'),'uri':_0x3fbd2f,'qs':{'operation':_0xf5dd('0x5e'),'username':_0x1cf8b3[_0xf5dd('0x54')]},'json':!![]};return rp(_0x5bb9da);}})[_0xf5dd('0x25')](function(_0x4eea2d){if(_0x4eea2d[_0xf5dd('0x5f')]){var _0x43219b={'method':_0xf5dd('0x60'),'uri':_0x3fbd2f,'form':{'operation':'login','username':_0x20e1ec,'accessKey':md5(_0x4eea2d[_0xf5dd('0x61')][_0xf5dd('0x62')]+_0x48cb53)},'json':!![]};return rp(_0x43219b);}})[_0xf5dd('0x25')](function(_0x3d4bcc){if(_0x3d4bcc[_0xf5dd('0x5f')]){var _0x47e39f={'method':_0xf5dd('0x5d'),'uri':_0x3fbd2f,'qs':{'operation':_0xf5dd('0x63'),'username':_0x20e1ec,'sessionName':_0x3d4bcc['result'][_0xf5dd('0x64')],'elementType':_0x9149f},'json':!![]};return rp(_0x47e39f);}})['then'](function(_0x4b3abc){if(_0x4b3abc['success']){var _0x116c38=['autogenerated','reference',_0xf5dd('0x65')];_['remove'](_0x4b3abc[_0xf5dd('0x61')][_0xf5dd('0x33')],function(_0x1c091e){return _0x116c38[_0xf5dd('0x66')](_0x1c091e[_0xf5dd('0x2c')][_0xf5dd('0x27')]);});_[_0xf5dd('0x67')](_0x4b3abc[_0xf5dd('0x61')]['fields'],function(_0x4a876f){return _0x4a876f[_0xf5dd('0x68')]===_0xf5dd('0x69');});return{'count':_0x4b3abc[_0xf5dd('0x61')][_0xf5dd('0x33')][_0xf5dd('0x34')],'rows':_[_0xf5dd('0x29')](_0x4b3abc['result'][_0xf5dd('0x33')],function(_0xbd26c5){return{'id':_0xbd26c5[_0xf5dd('0x27')],'name':_0xbd26c5[_0xf5dd('0x6a')],'custom':_[_0xf5dd('0x6b')](_0xbd26c5[_0xf5dd('0x27')],'cf_')?!![]:![],'options':_0xbd26c5[_0xf5dd('0x2c')][_0xf5dd('0x27')]===_0xf5dd('0x6c')&&_0xbd26c5[_0xf5dd('0x2c')]['picklistValues'][_0xf5dd('0x34')]>0x0?_[_0xf5dd('0x29')](_0xbd26c5[_0xf5dd('0x2c')][_0xf5dd('0x6d')],function(_0x5baef6){return{'name':_0x5baef6[_0xf5dd('0x6a')],'value':_0x5baef6[_0xf5dd('0x6e')]};}):[]};})};}})[_0xf5dd('0x25')](respondWithResult(_0x1db320,null))[_0xf5dd('0x45')](function(_0x53b71e){console[_0xf5dd('0x6f')](_0xf5dd('0x70')+_0x53b71e);var _0x1b0b98=_0x48ef7b['query']['test']?0x1f4:_0x53b71e['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xf5dd('0x53'),_0x1b0b98,JSON[_0xf5dd('0x71')](_0x53b71e));delete _0x53b71e[_0xf5dd('0x27')];if(_0x1b0b98===0x191){_0x1b0b98=0x190;}_0x1db320['status'](_0x1b0b98)[_0xf5dd('0x72')](_0x48ef7b[_0xf5dd('0x2e')]['test']?{'message':_0xf5dd('0x73'),'statusCode':_0x53b71e[_0xf5dd('0x74')]}:_0x53b71e);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index a818c0e..c73970d 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.model.js +++ b/server/api/intVtigerAccount/intVtigerAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe922=['util','api','bluebird','request-promise','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x8e8337,_0x33639e){var _0x35950c=function(_0x441dfd){while(--_0x441dfd){_0x8e8337['push'](_0x8e8337['shift']());}};_0x35950c(++_0x33639e);}(_0xe922,0x121));var _0x2e92=function(_0x11167c,_0xb0ff07){_0x11167c=_0x11167c-0x0;var _0x34bdb0=_0xe922[_0x11167c];return _0x34bdb0;};'use strict';var _=require(_0x2e92('0x0'));var util=require(_0x2e92('0x1'));var logger=require('../../config/logger')(_0x2e92('0x2'));var moment=require('moment');var BPromise=require(_0x2e92('0x3'));var rp=require(_0x2e92('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2e92('0x5'));var attributes=require(_0x2e92('0x6'));var integrations=require(_0x2e92('0x7'));module[_0x2e92('0x8')]=function(_0x4822af,_0x25f70b){return _0x4822af[_0x2e92('0x9')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a72=['VtigerAccount','int_vtiger_accounts','lodash','util','api','moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x421e29,_0x1fd647){var _0x193716=function(_0x1c42d7){while(--_0x1c42d7){_0x421e29['push'](_0x421e29['shift']());}};_0x193716(++_0x1fd647);}(_0x9a72,0x12d));var _0x29a7=function(_0x5896c8,_0x44d791){_0x5896c8=_0x5896c8-0x0;var _0x52c0fb=_0x9a72[_0x5896c8];return _0x52c0fb;};'use strict';var _=require(_0x29a7('0x0'));var util=require(_0x29a7('0x1'));var logger=require('../../config/logger')(_0x29a7('0x2'));var moment=require(_0x29a7('0x3'));var BPromise=require(_0x29a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29a7('0x5'));var rimraf=require('rimraf');var config=require(_0x29a7('0x6'));var attributes=require(_0x29a7('0x7'));var integrations=require(_0x29a7('0x8'));module[_0x29a7('0x9')]=function(_0x1fa125,_0xa0fc1c){return _0x1fa125[_0x29a7('0xa')](_0x29a7('0xb'),attributes,{'tableName':_0x29a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index bd00ba2..b7a6154 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7b4=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVtigerAccount','find','ShowVtigerAccount','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1b7086,_0x58f082){var _0x15a774=function(_0x1260dc){while(--_0x1260dc){_0x1b7086['push'](_0x1b7086['shift']());}};_0x15a774(++_0x58f082);}(_0xf7b4,0x152));var _0x4f7b=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0xf7b4[_0x441563];return _0x2369ec;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['GetVtigerAccount']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')]({'raw':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'limit':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1b')]||null:null,'include':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x24e5cf[_0x4f7b('0x17')]['include'],function(_0x150f57){return{'model':db[_0x150f57[_0x4f7b('0x1e')]],'as':_0x150f57['as'],'attributes':_0x150f57['attributes'],'include':_0x150f57[_0x4f7b('0x1c')]?_['map'](_0x150f57[_0x4f7b('0x1c')],function(_0x2429be){return{'model':db[_0x2429be[_0x4f7b('0x1e')]],'as':_0x2429be['as'],'attributes':_0x2429be[_0x4f7b('0x1a')],'include':_0x2429be[_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x2429be[_0x4f7b('0x1c')],function(_0x3ad769){return{'model':db[_0x3ad769['model']],'as':_0x3ad769['as'],'attributes':_0x3ad769[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x311675){logger['info'](_0x4f7b('0x20'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x20'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x311675));_0x519d90(_0x311675);})[_0x4f7b('0x14')](function(_0x4ebffa){logger[_0x4f7b('0x10')](_0x4f7b('0x20'),_0x4ebffa[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da['error'](0x1f4,_0x4ebffa[_0x4f7b('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x4e4828){var _0x1a2346=this;return new Promise(function(_0x52a5b1,_0x1aad4b){return db[_0x4f7b('0x15')][_0x4f7b('0x21')]({'raw':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'include':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')],function(_0x35f1ed){return{'model':db[_0x35f1ed[_0x4f7b('0x1e')]],'as':_0x35f1ed['as'],'attributes':_0x35f1ed[_0x4f7b('0x1a')],'include':_0x35f1ed[_0x4f7b('0x1c')]?_['map'](_0x35f1ed[_0x4f7b('0x1c')],function(_0x5127a2){return{'model':db[_0x5127a2[_0x4f7b('0x1e')]],'as':_0x5127a2['as'],'attributes':_0x5127a2[_0x4f7b('0x1a')],'include':_0x5127a2['include']?_[_0x4f7b('0x1d')](_0x5127a2[_0x4f7b('0x1c')],function(_0x1347b6){return{'model':db[_0x1347b6['model']],'as':_0x1347b6['as'],'attributes':_0x1347b6[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x446f6e){logger[_0x4f7b('0xb')](_0x4f7b('0x22'),_0x4e4828);logger[_0x4f7b('0xd')](_0x4f7b('0x22'),_0x4e4828,JSON['stringify'](_0x446f6e));_0x52a5b1(_0x446f6e);})[_0x4f7b('0x14')](function(_0x486187){logger[_0x4f7b('0x10')](_0x4f7b('0x22'),_0x486187[_0x4f7b('0x12')],_0x4e4828);_0x1aad4b(_0x1a2346['error'](0x1f4,_0x486187[_0x4f7b('0x12')]));});});}; \ No newline at end of file +var _0x065e=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','find','ShowVtigerAccount','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x552318,_0x71a891){var _0x2e7bee=function(_0xb48d9c){while(--_0xb48d9c){_0x552318['push'](_0x552318['shift']());}};_0x2e7bee(++_0x71a891);}(_0x065e,0x1a7));var _0xe065=function(_0xc5f804,_0x2f3ea2){_0xc5f804=_0xc5f804-0x0;var _0x10412e=_0x065e[_0xc5f804];return _0x10412e;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x189d72,_0x52403a,_0x267122){return new BPromise(function(_0x5afbd4,_0x273e22){return client[_0xe065('0x8')](_0x189d72,_0x267122)[_0xe065('0x9')](function(_0x114497){logger[_0xe065('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0xe065('0xb'));logger[_0xe065('0xc')](_0xe065('0xd'),_0x52403a,_0xe065('0xb'),JSON[_0xe065('0xe')](_0x114497));if(_0x114497[_0xe065('0xf')]){if(_0x114497['error']['code']===0x1f4){logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x273e22(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x5afbd4(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}else{logger[_0xe065('0xa')](_0xe065('0x10'),_0x52403a,_0xe065('0xb'));_0x5afbd4(_0x114497[_0xe065('0x12')][_0xe065('0x11')]);}})['catch'](function(_0x1ba88d){logger[_0xe065('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0x1ba88d);_0x273e22(_0x1ba88d);});});}exports[_0xe065('0x13')]=function(_0x1d2f7a){var _0x397f05=this;return new Promise(function(_0x14c97c,_0x1e7177){return db[_0xe065('0x14')][_0xe065('0x15')]({'raw':_0x1d2f7a['options']?_0x1d2f7a[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')]['where']||null:null,'attributes':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a['options'][_0xe065('0x17')]||null:null,'limit':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x18')]||null:null,'include':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1d2f7a[_0xe065('0x16')]['include'],function(_0x7208af){return{'model':db[_0x7208af[_0xe065('0x1b')]],'as':_0x7208af['as'],'attributes':_0x7208af[_0xe065('0x17')],'include':_0x7208af[_0xe065('0x19')]?_['map'](_0x7208af['include'],function(_0x164965){return{'model':db[_0x164965['model']],'as':_0x164965['as'],'attributes':_0x164965[_0xe065('0x17')],'include':_0x164965[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x164965[_0xe065('0x19')],function(_0x418731){return{'model':db[_0x418731[_0xe065('0x1b')]],'as':_0x418731['as'],'attributes':_0x418731[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x52cd9c){logger['info'](_0xe065('0x13'),_0x1d2f7a);logger[_0xe065('0xc')](_0xe065('0x13'),_0x1d2f7a,JSON[_0xe065('0xe')](_0x52cd9c));_0x14c97c(_0x52cd9c);})['catch'](function(_0x23f573){logger['error']('GetVtigerAccount',_0x23f573[_0xe065('0x11')],_0x1d2f7a);_0x1e7177(_0x397f05[_0xe065('0xf')](0x1f4,_0x23f573[_0xe065('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x883747){var _0x59b915=this;return new Promise(function(_0x12679d,_0x46db7e){return db[_0xe065('0x14')][_0xe065('0x1c')]({'raw':_0x883747['options']?_0x883747[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x883747[_0xe065('0x16')]?_0x883747[_0xe065('0x16')]['where']||null:null,'attributes':_0x883747[_0xe065('0x16')]?_0x883747['options'][_0xe065('0x17')]||null:null,'include':_0x883747['options']?_0x883747[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x883747[_0xe065('0x16')]['include'],function(_0x1fe1dc){return{'model':db[_0x1fe1dc[_0xe065('0x1b')]],'as':_0x1fe1dc['as'],'attributes':_0x1fe1dc[_0xe065('0x17')],'include':_0x1fe1dc[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1fe1dc[_0xe065('0x19')],function(_0x4b822a){return{'model':db[_0x4b822a[_0xe065('0x1b')]],'as':_0x4b822a['as'],'attributes':_0x4b822a[_0xe065('0x17')],'include':_0x4b822a['include']?_[_0xe065('0x1a')](_0x4b822a[_0xe065('0x19')],function(_0x5afc23){return{'model':db[_0x5afc23[_0xe065('0x1b')]],'as':_0x5afc23['as'],'attributes':_0x5afc23[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x35135f){logger['info'](_0xe065('0x1d'),_0x883747);logger['debug'](_0xe065('0x1d'),_0x883747,JSON[_0xe065('0xe')](_0x35135f));_0x12679d(_0x35135f);})[_0xe065('0x1e')](function(_0xcceb12){logger[_0xe065('0xf')](_0xe065('0x1d'),_0xcceb12['message'],_0x883747);_0x46db7e(_0x59b915[_0xe065('0xf')](0x1f4,_0xcceb12[_0xe065('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index d295cc4..e06aa8a 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3587=['exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','post','create','put','/:id','update','delete','destroy'];(function(_0x18f5bd,_0xc02ad7){var _0x2426d6=function(_0x412975){while(--_0x412975){_0x18f5bd['push'](_0x18f5bd['shift']());}};_0x2426d6(++_0xc02ad7);}(_0x3587,0xa2));var _0x7358=function(_0x253497,_0x38f442){_0x253497=_0x253497-0x0;var _0x128a84=_0x3587[_0x253497];return _0x128a84;};'use strict';var multer=require('multer');var util=require(_0x7358('0x0'));var path=require(_0x7358('0x1'));var timeout=require('connect-timeout');var express=require(_0x7358('0x2'));var router=express[_0x7358('0x3')]();var fs_extra=require(_0x7358('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7358('0x5'));var config=require(_0x7358('0x6'));var controller=require(_0x7358('0x7'));router[_0x7358('0x8')]('/',auth[_0x7358('0x9')](),controller[_0x7358('0xa')]);router[_0x7358('0x8')]('/:id',auth[_0x7358('0x9')](),controller[_0x7358('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x7358('0xc')]);router[_0x7358('0x8')](_0x7358('0xd'),auth['isAuthenticated'](),controller[_0x7358('0xe')]);router[_0x7358('0x8')]('/:id/descriptions',auth[_0x7358('0x9')](),controller['getDescriptions']);router[_0x7358('0xf')]('/',auth[_0x7358('0x9')](),controller[_0x7358('0x10')]);router[_0x7358('0x11')](_0x7358('0x12'),auth[_0x7358('0x9')](),controller[_0x7358('0x13')]);router[_0x7358('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7358('0x15')]);module[_0x7358('0x16')]=router; \ No newline at end of file +var _0x4ba0=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x340e40,_0x27c03b){var _0x4b85e5=function(_0x14f4a3){while(--_0x14f4a3){_0x340e40['push'](_0x340e40['shift']());}};_0x4b85e5(++_0x27c03b);}(_0x4ba0,0xdc));var _0x04ba=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x4ba0[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require(_0x04ba('0x0'));var util=require(_0x04ba('0x1'));var path=require(_0x04ba('0x2'));var timeout=require('connect-timeout');var express=require(_0x04ba('0x3'));var router=express[_0x04ba('0x4')]();var fs_extra=require(_0x04ba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x04ba('0x6'));var config=require('../../config/environment');var controller=require(_0x04ba('0x7'));router['get']('/',auth[_0x04ba('0x8')](),controller[_0x04ba('0x9')]);router[_0x04ba('0xa')](_0x04ba('0xb'),auth[_0x04ba('0x8')](),controller[_0x04ba('0xc')]);router['get'](_0x04ba('0xd'),auth[_0x04ba('0x8')](),controller['getFields']);router[_0x04ba('0xa')](_0x04ba('0xe'),auth[_0x04ba('0x8')](),controller[_0x04ba('0xf')]);router['get'](_0x04ba('0x10'),auth[_0x04ba('0x8')](),controller[_0x04ba('0x11')]);router[_0x04ba('0x12')]('/',auth[_0x04ba('0x8')](),controller['create']);router[_0x04ba('0x13')]('/:id',auth[_0x04ba('0x8')](),controller[_0x04ba('0x14')]);router[_0x04ba('0x15')]('/:id',auth[_0x04ba('0x8')](),controller[_0x04ba('0x16')]);module[_0x04ba('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index f21cc46..7952896 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b8a=['STRING','sequelize'];(function(_0x5354ef,_0x50ba64){var _0x404374=function(_0x11da4b){while(--_0x11da4b){_0x5354ef['push'](_0x5354ef['shift']());}};_0x404374(++_0x50ba64);}(_0x1b8a,0x79));var _0xa1b8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1b8a[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xa1b8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa1b8('0x1')]}}; \ No newline at end of file +var _0xf0dd=['STRING'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xf0dd,0x184));var _0xdf0d=function(_0x5e7692,_0x1caa40){_0x5e7692=_0x5e7692-0x0;var _0x120367=_0xf0dd[_0x5e7692];return _0x120367;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdf0d('0x0')]},'description':{'type':Sequelize[_0xdf0d('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index eb95a7a..c39d9e3 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78c0=['intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x78c0,0x70));var _0x078c=function(_0x1045f8,_0x3c5a5c){_0x1045f8=_0x1045f8-0x0;var _0x535a59=_0x78c0[_0x1045f8];return _0x535a59;};'use strict';var emlformat=require(_0x078c('0x0'));var rimraf=require(_0x078c('0x1'));var zipdir=require(_0x078c('0x2'));var jsonpatch=require(_0x078c('0x3'));var rp=require(_0x078c('0x4'));var moment=require('moment');var BPromise=require(_0x078c('0x5'));var Mustache=require(_0x078c('0x6'));var util=require(_0x078c('0x7'));var path=require(_0x078c('0x8'));var sox=require(_0x078c('0x9'));var csv=require(_0x078c('0xa'));var ejs=require(_0x078c('0xb'));var fs=require('fs');var fs_extra=require(_0x078c('0xc'));var _=require(_0x078c('0xd'));var squel=require(_0x078c('0xe'));var crypto=require('crypto');var jsforce=require(_0x078c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x078c('0x10'));var Papa=require('papaparse');var Redis=require(_0x078c('0x11'));var authService=require(_0x078c('0x12'));var qs=require(_0x078c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x078c('0x14'))(_0x078c('0x15'));var utils=require(_0x078c('0x16'));var config=require(_0x078c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fa251,_0x253182){_0x253182=_0x253182||0xcc;return function(_0x5b0d54){if(_0x5b0d54){return _0x1fa251[_0x078c('0x18')](_0x253182);}return _0x1fa251[_0x078c('0x19')](_0x253182)[_0x078c('0x1a')]();};}function respondWithResult(_0xc683f0,_0x5bbdf6){_0x5bbdf6=_0x5bbdf6||0xc8;return function(_0x39efe0){if(_0x39efe0){return _0xc683f0[_0x078c('0x19')](_0x5bbdf6)[_0x078c('0x1b')](_0x39efe0);}};}function respondWithFilteredResult(_0x10f561,_0x31d02b){return function(_0x599e7f){if(_0x599e7f){var _0x3e2c57=typeof _0x31d02b[_0x078c('0x1c')]===_0x078c('0x1d')&&typeof _0x31d02b[_0x078c('0x1e')]==='undefined';var _0x2c036a=_0x599e7f[_0x078c('0x1f')];var _0xfdeb92=_0x3e2c57?0x0:_0x31d02b[_0x078c('0x1c')];var _0x7982c8=_0x3e2c57?_0x599e7f[_0x078c('0x1f')]:_0x31d02b[_0x078c('0x1c')]+_0x31d02b[_0x078c('0x1e')];var _0x3b4a30;if(_0x7982c8>=_0x2c036a){_0x7982c8=_0x2c036a;_0x3b4a30=0xc8;}else{_0x3b4a30=0xce;}_0x10f561[_0x078c('0x19')](_0x3b4a30);return _0x10f561[_0x078c('0x20')](_0x078c('0x21'),_0xfdeb92+'-'+_0x7982c8+'/'+_0x2c036a)['json'](_0x599e7f);}return null;};}function patchUpdates(_0x21e7ac){return function(_0x27aa12){try{jsonpatch[_0x078c('0x22')](_0x27aa12,_0x21e7ac,!![]);}catch(_0x4a7865){return BPromise[_0x078c('0x23')](_0x4a7865);}return _0x27aa12[_0x078c('0x24')]();};}function saveUpdates(_0x4e1738,_0x5c3380){return function(_0x462248){if(_0x462248){return _0x462248['update'](_0x4e1738)[_0x078c('0x25')](function(_0x5cd02f){return _0x5cd02f;});}return null;};}function removeEntity(_0x10b996,_0xca38bd){return function(_0x144a39){if(_0x144a39){return _0x144a39[_0x078c('0x26')]()[_0x078c('0x25')](function(){_0x10b996['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53b1ca,_0x2c4f35){return function(_0x3fcdce){if(!_0x3fcdce){_0x53b1ca[_0x078c('0x18')](0x194);}return _0x3fcdce;};}function handleError(_0x23746d,_0x4aa1a5){_0x4aa1a5=_0x4aa1a5||0x1f4;return function(_0x944ad2){logger[_0x078c('0x27')](_0x944ad2[_0x078c('0x28')]);if(_0x944ad2[_0x078c('0x29')]){delete _0x944ad2[_0x078c('0x29')];}_0x23746d[_0x078c('0x19')](_0x4aa1a5)['send'](_0x944ad2);};}exports[_0x078c('0x2a')]=function(_0x18fff4,_0xaf1c74){var _0x1efe9e={},_0x2841c9={},_0x2ae3a6={'count':0x0,'rows':[]};var _0x249efb=_[_0x078c('0x2b')](db[_0x078c('0x2c')][_0x078c('0x2d')],function(_0x3748bd){return{'name':_0x3748bd[_0x078c('0x2e')],'type':_0x3748bd['type'][_0x078c('0x2f')]};});_0x2841c9[_0x078c('0x30')]=_[_0x078c('0x2b')](_0x249efb,'name');_0x2841c9[_0x078c('0x31')]=_[_0x078c('0x32')](_0x18fff4[_0x078c('0x31')]);_0x2841c9[_0x078c('0x33')]=_['intersection'](_0x2841c9[_0x078c('0x30')],_0x2841c9[_0x078c('0x31')]);_0x1efe9e['attributes']=_[_0x078c('0x34')](_0x2841c9[_0x078c('0x30')],qs['fields'](_0x18fff4[_0x078c('0x31')][_0x078c('0x35')]));_0x1efe9e[_0x078c('0x36')]=_0x1efe9e[_0x078c('0x36')][_0x078c('0x37')]?_0x1efe9e[_0x078c('0x36')]:_0x2841c9['model'];if(!_0x18fff4[_0x078c('0x31')]['hasOwnProperty'](_0x078c('0x38'))){_0x1efe9e[_0x078c('0x1e')]=qs['limit'](_0x18fff4[_0x078c('0x31')][_0x078c('0x1e')]);_0x1efe9e[_0x078c('0x1c')]=qs['offset'](_0x18fff4[_0x078c('0x31')][_0x078c('0x1c')]);}_0x1efe9e['order']=qs[_0x078c('0x39')](_0x18fff4[_0x078c('0x31')]['sort']);_0x1efe9e[_0x078c('0x3a')]=qs[_0x078c('0x33')](_[_0x078c('0x3b')](_0x18fff4[_0x078c('0x31')],_0x2841c9[_0x078c('0x33')]),_0x249efb);if(_0x18fff4[_0x078c('0x31')][_0x078c('0x3c')]){_0x1efe9e[_0x078c('0x3a')]=_[_0x078c('0x3d')](_0x1efe9e[_0x078c('0x3a')],{'$or':_[_0x078c('0x2b')](_0x249efb,function(_0x4fc710){if(_0x4fc710['type']!==_0x078c('0x3e')){var _0x96f054={};_0x96f054[_0x4fc710[_0x078c('0x29')]]={'$like':'%'+_0x18fff4[_0x078c('0x31')][_0x078c('0x3c')]+'%'};return _0x96f054;}})});}_0x1efe9e=_[_0x078c('0x3d')]({},_0x1efe9e,_0x18fff4[_0x078c('0x3f')]);var _0x452ad1={'where':_0x1efe9e[_0x078c('0x3a')]};return db[_0x078c('0x2c')][_0x078c('0x1f')](_0x452ad1)[_0x078c('0x25')](function(_0x192656){_0x2ae3a6['count']=_0x192656;if(_0x18fff4[_0x078c('0x31')]['includeAll']){_0x1efe9e[_0x078c('0x40')]=[{'all':!![]}];}return db[_0x078c('0x2c')][_0x078c('0x41')](_0x1efe9e);})[_0x078c('0x25')](function(_0x2a18a2){_0x2ae3a6[_0x078c('0x42')]=_0x2a18a2;return _0x2ae3a6;})[_0x078c('0x25')](respondWithFilteredResult(_0xaf1c74,_0x1efe9e))[_0x078c('0x43')](handleError(_0xaf1c74,null));};exports[_0x078c('0x44')]=function(_0x2df93f,_0x39ac7c){var _0x1b4e86={'raw':![],'where':{'id':_0x2df93f[_0x078c('0x45')]['id']}},_0x1bc5e0={};_0x1bc5e0[_0x078c('0x30')]=_[_0x078c('0x32')](db[_0x078c('0x2c')][_0x078c('0x2d')]);_0x1bc5e0['query']=_[_0x078c('0x32')](_0x2df93f[_0x078c('0x31')]);_0x1bc5e0[_0x078c('0x33')]=_[_0x078c('0x34')](_0x1bc5e0[_0x078c('0x30')],_0x1bc5e0[_0x078c('0x31')]);_0x1b4e86[_0x078c('0x36')]=_[_0x078c('0x34')](_0x1bc5e0[_0x078c('0x30')],qs[_0x078c('0x35')](_0x2df93f[_0x078c('0x31')][_0x078c('0x35')]));_0x1b4e86['attributes']=_0x1b4e86[_0x078c('0x36')][_0x078c('0x37')]?_0x1b4e86['attributes']:_0x1bc5e0[_0x078c('0x30')];if(_0x2df93f[_0x078c('0x31')][_0x078c('0x46')]){_0x1b4e86[_0x078c('0x40')]=[{'all':!![]}];}_0x1b4e86=_['merge']({},_0x1b4e86,_0x2df93f[_0x078c('0x3f')]);return db['VtigerConfiguration'][_0x078c('0x47')](_0x1b4e86)[_0x078c('0x25')](handleEntityNotFound(_0x39ac7c,null))['then'](respondWithResult(_0x39ac7c,null))[_0x078c('0x43')](handleError(_0x39ac7c,null));};exports[_0x078c('0x48')]=function(_0x56d152,_0x29f087){return db[_0x078c('0x2c')]['create'](_0x56d152['body'],{})['then'](respondWithResult(_0x29f087,0xc9))[_0x078c('0x43')](handleError(_0x29f087,null));};exports[_0x078c('0x49')]=function(_0x1ceae3,_0x1197d9){if(_0x1ceae3[_0x078c('0x4a')]['id']){delete _0x1ceae3[_0x078c('0x4a')]['id'];}return db[_0x078c('0x2c')][_0x078c('0x47')]({'where':{'id':_0x1ceae3['params']['id']}})[_0x078c('0x25')](handleEntityNotFound(_0x1197d9,null))[_0x078c('0x25')](saveUpdates(_0x1ceae3[_0x078c('0x4a')],null))[_0x078c('0x25')](respondWithResult(_0x1197d9,null))[_0x078c('0x43')](handleError(_0x1197d9,null));};exports['destroy']=function(_0x364b93,_0x2064f1){return db[_0x078c('0x2c')]['find']({'where':{'id':_0x364b93[_0x078c('0x45')]['id']}})[_0x078c('0x25')](handleEntityNotFound(_0x2064f1,null))[_0x078c('0x25')](removeEntity(_0x2064f1,null))['catch'](handleError(_0x2064f1,null));};exports[_0x078c('0x4b')]=function(_0x462454,_0x36f2e2,_0x3ac78f){var _0xfa7622={};var _0x125eb4={};var _0x1922b4;var _0x449581;return db[_0x078c('0x2c')][_0x078c('0x4c')]({'where':{'id':_0x462454[_0x078c('0x45')]['id']}})['then'](handleEntityNotFound(_0x36f2e2,null))[_0x078c('0x25')](function(_0x2da5b3){if(_0x2da5b3){_0x1922b4=_0x2da5b3;_0x125eb4[_0x078c('0x30')]=_[_0x078c('0x32')](db[_0x078c('0x4d')][_0x078c('0x2d')]);_0x125eb4['query']=_[_0x078c('0x32')](_0x462454[_0x078c('0x31')]);_0x125eb4['filters']=_[_0x078c('0x34')](_0x125eb4[_0x078c('0x30')],_0x125eb4['query']);_0xfa7622[_0x078c('0x36')]=_[_0x078c('0x34')](_0x125eb4['model'],qs[_0x078c('0x35')](_0x462454[_0x078c('0x31')][_0x078c('0x35')]));_0xfa7622[_0x078c('0x36')]=_0xfa7622['attributes'][_0x078c('0x37')]?_0xfa7622[_0x078c('0x36')]:_0x125eb4[_0x078c('0x30')];_0xfa7622[_0x078c('0x4e')]=qs['sort'](_0x462454[_0x078c('0x31')][_0x078c('0x39')]);_0xfa7622[_0x078c('0x3a')]=qs['filters'](_[_0x078c('0x3b')](_0x462454[_0x078c('0x31')],_0x125eb4[_0x078c('0x33')]));if(_0x462454['query'][_0x078c('0x3c')]){_0xfa7622[_0x078c('0x3a')]=_[_0x078c('0x3d')](_0xfa7622[_0x078c('0x3a')],{'$or':_[_0x078c('0x2b')](_0xfa7622[_0x078c('0x36')],function(_0x280ea2){var _0x1aec49={};_0x1aec49[_0x280ea2]={'$like':'%'+_0x462454['query']['filter']+'%'};return _0x1aec49;})});}_0xfa7622=_[_0x078c('0x3d')]({},_0xfa7622,_0x462454[_0x078c('0x3f')]);return _0x1922b4['getFields'](_0xfa7622);}})[_0x078c('0x25')](function(_0x5e2c8e){if(_0x5e2c8e){_0x449581=_0x5e2c8e['length'];if(!_0x462454[_0x078c('0x31')]['hasOwnProperty'](_0x078c('0x38'))){_0xfa7622[_0x078c('0x1e')]=qs['limit'](_0x462454['query'][_0x078c('0x1e')]);_0xfa7622['offset']=qs[_0x078c('0x1c')](_0x462454[_0x078c('0x31')]['offset']);}return _0x1922b4[_0x078c('0x4b')](_0xfa7622);}})[_0x078c('0x25')](function(_0x2bf047){if(_0x2bf047){return _0x2bf047?{'count':_0x449581,'rows':_0x2bf047}:null;}})[_0x078c('0x25')](respondWithResult(_0x36f2e2,null))['catch'](handleError(_0x36f2e2,null));};exports[_0x078c('0x4f')]=function(_0x37b6d4,_0x112485,_0x1f63a0){var _0x5247de={};var _0x58c1cd={};var _0x4d3d9b;var _0x19ffe2;return db[_0x078c('0x2c')][_0x078c('0x4c')]({'where':{'id':_0x37b6d4[_0x078c('0x45')]['id']}})[_0x078c('0x25')](handleEntityNotFound(_0x112485,null))[_0x078c('0x25')](function(_0x4f708b){if(_0x4f708b){_0x4d3d9b=_0x4f708b;_0x58c1cd[_0x078c('0x30')]=_[_0x078c('0x32')](db[_0x078c('0x4d')][_0x078c('0x2d')]);_0x58c1cd[_0x078c('0x31')]=_['keys'](_0x37b6d4[_0x078c('0x31')]);_0x58c1cd[_0x078c('0x33')]=_[_0x078c('0x34')](_0x58c1cd[_0x078c('0x30')],_0x58c1cd[_0x078c('0x31')]);_0x5247de[_0x078c('0x36')]=_[_0x078c('0x34')](_0x58c1cd[_0x078c('0x30')],qs['fields'](_0x37b6d4['query']['fields']));_0x5247de[_0x078c('0x36')]=_0x5247de[_0x078c('0x36')][_0x078c('0x37')]?_0x5247de[_0x078c('0x36')]:_0x58c1cd[_0x078c('0x30')];_0x5247de[_0x078c('0x4e')]=qs[_0x078c('0x39')](_0x37b6d4[_0x078c('0x31')][_0x078c('0x39')]);_0x5247de[_0x078c('0x3a')]=qs[_0x078c('0x33')](_[_0x078c('0x3b')](_0x37b6d4[_0x078c('0x31')],_0x58c1cd['filters']));if(_0x37b6d4[_0x078c('0x31')]['filter']){_0x5247de[_0x078c('0x3a')]=_[_0x078c('0x3d')](_0x5247de[_0x078c('0x3a')],{'$or':_[_0x078c('0x2b')](_0x5247de[_0x078c('0x36')],function(_0x4cbf34){var _0x7c3712={};_0x7c3712[_0x4cbf34]={'$like':'%'+_0x37b6d4[_0x078c('0x31')][_0x078c('0x3c')]+'%'};return _0x7c3712;})});}_0x5247de=_[_0x078c('0x3d')]({},_0x5247de,_0x37b6d4[_0x078c('0x3f')]);return _0x4d3d9b[_0x078c('0x4f')](_0x5247de);}})['then'](function(_0x7397d1){if(_0x7397d1){_0x19ffe2=_0x7397d1[_0x078c('0x37')];if(!_0x37b6d4[_0x078c('0x31')]['hasOwnProperty'](_0x078c('0x38'))){_0x5247de[_0x078c('0x1e')]=qs[_0x078c('0x1e')](_0x37b6d4[_0x078c('0x31')][_0x078c('0x1e')]);_0x5247de[_0x078c('0x1c')]=qs['offset'](_0x37b6d4[_0x078c('0x31')][_0x078c('0x1c')]);}return _0x4d3d9b[_0x078c('0x4f')](_0x5247de);}})[_0x078c('0x25')](function(_0x4c5aa2){if(_0x4c5aa2){return _0x4c5aa2?{'count':_0x19ffe2,'rows':_0x4c5aa2}:null;}})[_0x078c('0x25')](respondWithResult(_0x112485,null))[_0x078c('0x43')](handleError(_0x112485,null));};exports['getDescriptions']=function(_0xfe632a,_0x37f16a,_0xc33382){var _0x59aef0={};var _0xfc9a60={};var _0x13fd3a;var _0x51e499;return db['VtigerConfiguration'][_0x078c('0x4c')]({'where':{'id':_0xfe632a['params']['id']}})['then'](handleEntityNotFound(_0x37f16a,null))[_0x078c('0x25')](function(_0x22aeb8){if(_0x22aeb8){_0x13fd3a=_0x22aeb8;_0xfc9a60[_0x078c('0x30')]=_[_0x078c('0x32')](db[_0x078c('0x4d')][_0x078c('0x2d')]);_0xfc9a60['query']=_[_0x078c('0x32')](_0xfe632a['query']);_0xfc9a60['filters']=_['intersection'](_0xfc9a60['model'],_0xfc9a60[_0x078c('0x31')]);_0x59aef0[_0x078c('0x36')]=_[_0x078c('0x34')](_0xfc9a60[_0x078c('0x30')],qs[_0x078c('0x35')](_0xfe632a['query'][_0x078c('0x35')]));_0x59aef0[_0x078c('0x36')]=_0x59aef0[_0x078c('0x36')]['length']?_0x59aef0['attributes']:_0xfc9a60[_0x078c('0x30')];_0x59aef0[_0x078c('0x4e')]=qs[_0x078c('0x39')](_0xfe632a[_0x078c('0x31')]['sort']);_0x59aef0[_0x078c('0x3a')]=qs[_0x078c('0x33')](_[_0x078c('0x3b')](_0xfe632a[_0x078c('0x31')],_0xfc9a60[_0x078c('0x33')]));if(_0xfe632a[_0x078c('0x31')]['filter']){_0x59aef0[_0x078c('0x3a')]=_['merge'](_0x59aef0['where'],{'$or':_[_0x078c('0x2b')](_0x59aef0['attributes'],function(_0x24ad8d){var _0xbd3226={};_0xbd3226[_0x24ad8d]={'$like':'%'+_0xfe632a[_0x078c('0x31')][_0x078c('0x3c')]+'%'};return _0xbd3226;})});}_0x59aef0=_[_0x078c('0x3d')]({},_0x59aef0,_0xfe632a[_0x078c('0x3f')]);return _0x13fd3a[_0x078c('0x50')](_0x59aef0);}})[_0x078c('0x25')](function(_0x300f80){if(_0x300f80){_0x51e499=_0x300f80[_0x078c('0x37')];if(!_0xfe632a[_0x078c('0x31')][_0x078c('0x51')](_0x078c('0x38'))){_0x59aef0[_0x078c('0x1e')]=qs[_0x078c('0x1e')](_0xfe632a['query'][_0x078c('0x1e')]);_0x59aef0[_0x078c('0x1c')]=qs[_0x078c('0x1c')](_0xfe632a[_0x078c('0x31')]['offset']);}return _0x13fd3a[_0x078c('0x50')](_0x59aef0);}})[_0x078c('0x25')](function(_0x56cd14){if(_0x56cd14){return _0x56cd14?{'count':_0x51e499,'rows':_0x56cd14}:null;}})[_0x078c('0x25')](respondWithResult(_0x37f16a,null))['catch'](handleError(_0x37f16a,null));}; \ No newline at end of file +var _0xc912=['mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','then','includeAll','include','rows','show','find','catch','create','body','update','params','getFields','VtigerField','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0xa5a920,_0x2d8772){var _0x596618=function(_0x5eab42){while(--_0x5eab42){_0xa5a920['push'](_0xa5a920['shift']());}};_0x596618(++_0x2d8772);}(_0xc912,0x9a));var _0x2c91=function(_0x532e2a,_0xddbe97){_0x532e2a=_0x532e2a-0x0;var _0xa025b6=_0xc912[_0x532e2a];return _0xa025b6;};'use strict';var emlformat=require(_0x2c91('0x0'));var rimraf=require(_0x2c91('0x1'));var zipdir=require(_0x2c91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c91('0x3'));var moment=require(_0x2c91('0x4'));var BPromise=require(_0x2c91('0x5'));var Mustache=require(_0x2c91('0x6'));var util=require('util');var path=require(_0x2c91('0x7'));var sox=require(_0x2c91('0x8'));var csv=require('to-csv');var ejs=require(_0x2c91('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c91('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2c91('0xb'));var deskjs=require(_0x2c91('0xc'));var toCsv=require(_0x2c91('0xd'));var querystring=require(_0x2c91('0xe'));var Papa=require(_0x2c91('0xf'));var Redis=require(_0x2c91('0x10'));var authService=require(_0x2c91('0x11'));var qs=require(_0x2c91('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c91('0x13'));var logger=require(_0x2c91('0x14'))(_0x2c91('0x15'));var utils=require(_0x2c91('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2c91('0x17'));var db=require(_0x2c91('0x18'))['db'];function respondWithStatusCode(_0x23fa50,_0x4214bf){_0x4214bf=_0x4214bf||0xcc;return function(_0x1a9648){if(_0x1a9648){return _0x23fa50[_0x2c91('0x19')](_0x4214bf);}return _0x23fa50[_0x2c91('0x1a')](_0x4214bf)['end']();};}function respondWithResult(_0x3ba70a,_0x1e0f85){_0x1e0f85=_0x1e0f85||0xc8;return function(_0x444892){if(_0x444892){return _0x3ba70a['status'](_0x1e0f85)[_0x2c91('0x1b')](_0x444892);}};}function respondWithFilteredResult(_0x429464,_0x5bc76f){return function(_0x1b10cf){if(_0x1b10cf){var _0x327b4c=typeof _0x5bc76f[_0x2c91('0x1c')]==='undefined'&&typeof _0x5bc76f[_0x2c91('0x1d')]===_0x2c91('0x1e');var _0x5203eb=_0x1b10cf[_0x2c91('0x1f')];var _0x10d27e=_0x327b4c?0x0:_0x5bc76f['offset'];var _0x267f61=_0x327b4c?_0x1b10cf[_0x2c91('0x1f')]:_0x5bc76f[_0x2c91('0x1c')]+_0x5bc76f[_0x2c91('0x1d')];var _0x5f42cb;if(_0x267f61>=_0x5203eb){_0x267f61=_0x5203eb;_0x5f42cb=0xc8;}else{_0x5f42cb=0xce;}_0x429464[_0x2c91('0x1a')](_0x5f42cb);return _0x429464['set'](_0x2c91('0x20'),_0x10d27e+'-'+_0x267f61+'/'+_0x5203eb)[_0x2c91('0x1b')](_0x1b10cf);}return null;};}function patchUpdates(_0x5ad120){return function(_0x1c0ba4){try{jsonpatch[_0x2c91('0x21')](_0x1c0ba4,_0x5ad120,!![]);}catch(_0x1c79b1){return BPromise['reject'](_0x1c79b1);}return _0x1c0ba4[_0x2c91('0x22')]();};}function saveUpdates(_0x4be60c,_0x11612e){return function(_0xb4fffe){if(_0xb4fffe){return _0xb4fffe['update'](_0x4be60c)['then'](function(_0x540e69){return _0x540e69;});}return null;};}function removeEntity(_0x43c05f,_0x3fc210){return function(_0x1f5ac7){if(_0x1f5ac7){return _0x1f5ac7[_0x2c91('0x23')]()['then'](function(){_0x43c05f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32396b,_0x2b4c72){return function(_0x266415){if(!_0x266415){_0x32396b[_0x2c91('0x19')](0x194);}return _0x266415;};}function handleError(_0x4d7a75,_0x496d23){_0x496d23=_0x496d23||0x1f4;return function(_0x52c048){logger[_0x2c91('0x24')](_0x52c048[_0x2c91('0x25')]);if(_0x52c048[_0x2c91('0x26')]){delete _0x52c048[_0x2c91('0x26')];}_0x4d7a75[_0x2c91('0x1a')](_0x496d23)[_0x2c91('0x27')](_0x52c048);};}exports[_0x2c91('0x28')]=function(_0x346bfe,_0x40561b){var _0x42e73a={},_0xca01a4={},_0x2b96a4={'count':0x0,'rows':[]};var _0x52c410=_[_0x2c91('0x29')](db[_0x2c91('0x2a')][_0x2c91('0x2b')],function(_0x2117a8){return{'name':_0x2117a8['fieldName'],'type':_0x2117a8[_0x2c91('0x2c')][_0x2c91('0x2d')]};});_0xca01a4['model']=_[_0x2c91('0x29')](_0x52c410,_0x2c91('0x26'));_0xca01a4[_0x2c91('0x2e')]=_[_0x2c91('0x2f')](_0x346bfe[_0x2c91('0x2e')]);_0xca01a4['filters']=_['intersection'](_0xca01a4[_0x2c91('0x30')],_0xca01a4[_0x2c91('0x2e')]);_0x42e73a[_0x2c91('0x31')]=_[_0x2c91('0x32')](_0xca01a4['model'],qs['fields'](_0x346bfe['query'][_0x2c91('0x33')]));_0x42e73a[_0x2c91('0x31')]=_0x42e73a[_0x2c91('0x31')][_0x2c91('0x34')]?_0x42e73a[_0x2c91('0x31')]:_0xca01a4['model'];if(!_0x346bfe[_0x2c91('0x2e')]['hasOwnProperty'](_0x2c91('0x35'))){_0x42e73a[_0x2c91('0x1d')]=qs['limit'](_0x346bfe[_0x2c91('0x2e')][_0x2c91('0x1d')]);_0x42e73a['offset']=qs[_0x2c91('0x1c')](_0x346bfe[_0x2c91('0x2e')]['offset']);}_0x42e73a[_0x2c91('0x36')]=qs[_0x2c91('0x37')](_0x346bfe[_0x2c91('0x2e')][_0x2c91('0x37')]);_0x42e73a[_0x2c91('0x38')]=qs[_0x2c91('0x39')](_[_0x2c91('0x3a')](_0x346bfe[_0x2c91('0x2e')],_0xca01a4['filters']),_0x52c410);if(_0x346bfe[_0x2c91('0x2e')]['filter']){_0x42e73a[_0x2c91('0x38')]=_[_0x2c91('0x3b')](_0x42e73a['where'],{'$or':_['map'](_0x52c410,function(_0x1b2bfd){if(_0x1b2bfd[_0x2c91('0x2c')]!==_0x2c91('0x3c')){var _0x4dae17={};_0x4dae17[_0x1b2bfd[_0x2c91('0x26')]]={'$like':'%'+_0x346bfe[_0x2c91('0x2e')][_0x2c91('0x3d')]+'%'};return _0x4dae17;}})});}_0x42e73a=_[_0x2c91('0x3b')]({},_0x42e73a,_0x346bfe[_0x2c91('0x3e')]);var _0x8ef228={'where':_0x42e73a[_0x2c91('0x38')]};return db[_0x2c91('0x2a')][_0x2c91('0x1f')](_0x8ef228)[_0x2c91('0x3f')](function(_0x1b6acd){_0x2b96a4[_0x2c91('0x1f')]=_0x1b6acd;if(_0x346bfe['query'][_0x2c91('0x40')]){_0x42e73a[_0x2c91('0x41')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x42e73a);})[_0x2c91('0x3f')](function(_0x336f90){_0x2b96a4[_0x2c91('0x42')]=_0x336f90;return _0x2b96a4;})[_0x2c91('0x3f')](respondWithFilteredResult(_0x40561b,_0x42e73a))['catch'](handleError(_0x40561b,null));};exports[_0x2c91('0x43')]=function(_0x4aa88d,_0x134702){var _0x113f10={'raw':![],'where':{'id':_0x4aa88d['params']['id']}},_0x4f0c6f={};_0x4f0c6f[_0x2c91('0x30')]=_[_0x2c91('0x2f')](db[_0x2c91('0x2a')]['rawAttributes']);_0x4f0c6f[_0x2c91('0x2e')]=_[_0x2c91('0x2f')](_0x4aa88d[_0x2c91('0x2e')]);_0x4f0c6f['filters']=_[_0x2c91('0x32')](_0x4f0c6f[_0x2c91('0x30')],_0x4f0c6f['query']);_0x113f10['attributes']=_[_0x2c91('0x32')](_0x4f0c6f[_0x2c91('0x30')],qs['fields'](_0x4aa88d[_0x2c91('0x2e')][_0x2c91('0x33')]));_0x113f10[_0x2c91('0x31')]=_0x113f10['attributes']['length']?_0x113f10[_0x2c91('0x31')]:_0x4f0c6f[_0x2c91('0x30')];if(_0x4aa88d['query'][_0x2c91('0x40')]){_0x113f10[_0x2c91('0x41')]=[{'all':!![]}];}_0x113f10=_[_0x2c91('0x3b')]({},_0x113f10,_0x4aa88d[_0x2c91('0x3e')]);return db[_0x2c91('0x2a')][_0x2c91('0x44')](_0x113f10)[_0x2c91('0x3f')](handleEntityNotFound(_0x134702,null))['then'](respondWithResult(_0x134702,null))[_0x2c91('0x45')](handleError(_0x134702,null));};exports[_0x2c91('0x46')]=function(_0x495c6a,_0x7ee57e){return db[_0x2c91('0x2a')][_0x2c91('0x46')](_0x495c6a[_0x2c91('0x47')],{})['then'](respondWithResult(_0x7ee57e,0xc9))['catch'](handleError(_0x7ee57e,null));};exports[_0x2c91('0x48')]=function(_0x141006,_0x3a4967){if(_0x141006['body']['id']){delete _0x141006[_0x2c91('0x47')]['id'];}return db[_0x2c91('0x2a')]['find']({'where':{'id':_0x141006['params']['id']}})['then'](handleEntityNotFound(_0x3a4967,null))['then'](saveUpdates(_0x141006[_0x2c91('0x47')],null))['then'](respondWithResult(_0x3a4967,null))[_0x2c91('0x45')](handleError(_0x3a4967,null));};exports[_0x2c91('0x23')]=function(_0x291971,_0x315115){return db[_0x2c91('0x2a')][_0x2c91('0x44')]({'where':{'id':_0x291971[_0x2c91('0x49')]['id']}})['then'](handleEntityNotFound(_0x315115,null))[_0x2c91('0x3f')](removeEntity(_0x315115,null))[_0x2c91('0x45')](handleError(_0x315115,null));};exports[_0x2c91('0x4a')]=function(_0x421229,_0x724772,_0x3f2c3c){var _0xb06d98={};var _0x198afb={};var _0x4c0c02;var _0x319339;return db[_0x2c91('0x2a')]['findOne']({'where':{'id':_0x421229['params']['id']}})[_0x2c91('0x3f')](handleEntityNotFound(_0x724772,null))['then'](function(_0x2dd6d6){if(_0x2dd6d6){_0x4c0c02=_0x2dd6d6;_0x198afb[_0x2c91('0x30')]=_[_0x2c91('0x2f')](db[_0x2c91('0x4b')][_0x2c91('0x2b')]);_0x198afb[_0x2c91('0x2e')]=_[_0x2c91('0x2f')](_0x421229[_0x2c91('0x2e')]);_0x198afb[_0x2c91('0x39')]=_[_0x2c91('0x32')](_0x198afb['model'],_0x198afb[_0x2c91('0x2e')]);_0xb06d98[_0x2c91('0x31')]=_['intersection'](_0x198afb[_0x2c91('0x30')],qs[_0x2c91('0x33')](_0x421229[_0x2c91('0x2e')][_0x2c91('0x33')]));_0xb06d98[_0x2c91('0x31')]=_0xb06d98['attributes']['length']?_0xb06d98[_0x2c91('0x31')]:_0x198afb[_0x2c91('0x30')];_0xb06d98[_0x2c91('0x36')]=qs['sort'](_0x421229['query'][_0x2c91('0x37')]);_0xb06d98[_0x2c91('0x38')]=qs[_0x2c91('0x39')](_[_0x2c91('0x3a')](_0x421229['query'],_0x198afb['filters']));if(_0x421229[_0x2c91('0x2e')][_0x2c91('0x3d')]){_0xb06d98[_0x2c91('0x38')]=_[_0x2c91('0x3b')](_0xb06d98[_0x2c91('0x38')],{'$or':_[_0x2c91('0x29')](_0xb06d98[_0x2c91('0x31')],function(_0x53d0ae){var _0x2f20a5={};_0x2f20a5[_0x53d0ae]={'$like':'%'+_0x421229[_0x2c91('0x2e')][_0x2c91('0x3d')]+'%'};return _0x2f20a5;})});}_0xb06d98=_[_0x2c91('0x3b')]({},_0xb06d98,_0x421229['options']);return _0x4c0c02['getFields'](_0xb06d98);}})[_0x2c91('0x3f')](function(_0x54dd3f){if(_0x54dd3f){_0x319339=_0x54dd3f[_0x2c91('0x34')];if(!_0x421229[_0x2c91('0x2e')][_0x2c91('0x4c')](_0x2c91('0x35'))){_0xb06d98[_0x2c91('0x1d')]=qs[_0x2c91('0x1d')](_0x421229['query'][_0x2c91('0x1d')]);_0xb06d98[_0x2c91('0x1c')]=qs[_0x2c91('0x1c')](_0x421229[_0x2c91('0x2e')]['offset']);}return _0x4c0c02['getFields'](_0xb06d98);}})[_0x2c91('0x3f')](function(_0x1aceb1){if(_0x1aceb1){return _0x1aceb1?{'count':_0x319339,'rows':_0x1aceb1}:null;}})[_0x2c91('0x3f')](respondWithResult(_0x724772,null))[_0x2c91('0x45')](handleError(_0x724772,null));};exports[_0x2c91('0x4d')]=function(_0x5cb0b8,_0x31f46b,_0x2729a0){var _0x34c0df={};var _0x321252={};var _0xdfae43;var _0x3c1d48;return db[_0x2c91('0x2a')][_0x2c91('0x4e')]({'where':{'id':_0x5cb0b8[_0x2c91('0x49')]['id']}})[_0x2c91('0x3f')](handleEntityNotFound(_0x31f46b,null))['then'](function(_0x5f2136){if(_0x5f2136){_0xdfae43=_0x5f2136;_0x321252['model']=_['keys'](db['VtigerField'][_0x2c91('0x2b')]);_0x321252['query']=_[_0x2c91('0x2f')](_0x5cb0b8[_0x2c91('0x2e')]);_0x321252[_0x2c91('0x39')]=_[_0x2c91('0x32')](_0x321252[_0x2c91('0x30')],_0x321252[_0x2c91('0x2e')]);_0x34c0df[_0x2c91('0x31')]=_[_0x2c91('0x32')](_0x321252['model'],qs[_0x2c91('0x33')](_0x5cb0b8[_0x2c91('0x2e')][_0x2c91('0x33')]));_0x34c0df['attributes']=_0x34c0df[_0x2c91('0x31')][_0x2c91('0x34')]?_0x34c0df[_0x2c91('0x31')]:_0x321252['model'];_0x34c0df[_0x2c91('0x36')]=qs[_0x2c91('0x37')](_0x5cb0b8[_0x2c91('0x2e')]['sort']);_0x34c0df[_0x2c91('0x38')]=qs[_0x2c91('0x39')](_[_0x2c91('0x3a')](_0x5cb0b8['query'],_0x321252['filters']));if(_0x5cb0b8['query'][_0x2c91('0x3d')]){_0x34c0df['where']=_[_0x2c91('0x3b')](_0x34c0df['where'],{'$or':_[_0x2c91('0x29')](_0x34c0df['attributes'],function(_0x57a20e){var _0x4cee01={};_0x4cee01[_0x57a20e]={'$like':'%'+_0x5cb0b8[_0x2c91('0x2e')][_0x2c91('0x3d')]+'%'};return _0x4cee01;})});}_0x34c0df=_[_0x2c91('0x3b')]({},_0x34c0df,_0x5cb0b8[_0x2c91('0x3e')]);return _0xdfae43[_0x2c91('0x4d')](_0x34c0df);}})['then'](function(_0x27982b){if(_0x27982b){_0x3c1d48=_0x27982b['length'];if(!_0x5cb0b8[_0x2c91('0x2e')][_0x2c91('0x4c')](_0x2c91('0x35'))){_0x34c0df[_0x2c91('0x1d')]=qs['limit'](_0x5cb0b8[_0x2c91('0x2e')][_0x2c91('0x1d')]);_0x34c0df['offset']=qs[_0x2c91('0x1c')](_0x5cb0b8[_0x2c91('0x2e')][_0x2c91('0x1c')]);}return _0xdfae43['getSubjects'](_0x34c0df);}})['then'](function(_0x2a0213){if(_0x2a0213){return _0x2a0213?{'count':_0x3c1d48,'rows':_0x2a0213}:null;}})[_0x2c91('0x3f')](respondWithResult(_0x31f46b,null))['catch'](handleError(_0x31f46b,null));};exports[_0x2c91('0x4f')]=function(_0x559e57,_0x7cd24f,_0x3f1934){var _0x497492={};var _0x6ef320={};var _0x479a23;var _0x3a34f3;return db[_0x2c91('0x2a')][_0x2c91('0x4e')]({'where':{'id':_0x559e57['params']['id']}})[_0x2c91('0x3f')](handleEntityNotFound(_0x7cd24f,null))['then'](function(_0x266d3e){if(_0x266d3e){_0x479a23=_0x266d3e;_0x6ef320[_0x2c91('0x30')]=_[_0x2c91('0x2f')](db[_0x2c91('0x4b')][_0x2c91('0x2b')]);_0x6ef320[_0x2c91('0x2e')]=_[_0x2c91('0x2f')](_0x559e57[_0x2c91('0x2e')]);_0x6ef320[_0x2c91('0x39')]=_[_0x2c91('0x32')](_0x6ef320['model'],_0x6ef320[_0x2c91('0x2e')]);_0x497492[_0x2c91('0x31')]=_[_0x2c91('0x32')](_0x6ef320[_0x2c91('0x30')],qs['fields'](_0x559e57[_0x2c91('0x2e')][_0x2c91('0x33')]));_0x497492['attributes']=_0x497492[_0x2c91('0x31')][_0x2c91('0x34')]?_0x497492['attributes']:_0x6ef320[_0x2c91('0x30')];_0x497492[_0x2c91('0x36')]=qs[_0x2c91('0x37')](_0x559e57[_0x2c91('0x2e')][_0x2c91('0x37')]);_0x497492[_0x2c91('0x38')]=qs[_0x2c91('0x39')](_[_0x2c91('0x3a')](_0x559e57[_0x2c91('0x2e')],_0x6ef320[_0x2c91('0x39')]));if(_0x559e57['query']['filter']){_0x497492[_0x2c91('0x38')]=_['merge'](_0x497492[_0x2c91('0x38')],{'$or':_[_0x2c91('0x29')](_0x497492[_0x2c91('0x31')],function(_0x1cff3c){var _0x2560aa={};_0x2560aa[_0x1cff3c]={'$like':'%'+_0x559e57[_0x2c91('0x2e')][_0x2c91('0x3d')]+'%'};return _0x2560aa;})});}_0x497492=_['merge']({},_0x497492,_0x559e57[_0x2c91('0x3e')]);return _0x479a23['getDescriptions'](_0x497492);}})['then'](function(_0x1eb70f){if(_0x1eb70f){_0x3a34f3=_0x1eb70f['length'];if(!_0x559e57[_0x2c91('0x2e')][_0x2c91('0x4c')](_0x2c91('0x35'))){_0x497492[_0x2c91('0x1d')]=qs[_0x2c91('0x1d')](_0x559e57[_0x2c91('0x2e')][_0x2c91('0x1d')]);_0x497492[_0x2c91('0x1c')]=qs[_0x2c91('0x1c')](_0x559e57[_0x2c91('0x2e')]['offset']);}return _0x479a23[_0x2c91('0x4f')](_0x497492);}})[_0x2c91('0x3f')](function(_0xf08ea7){if(_0xf08ea7){return _0xf08ea7?{'count':_0x3a34f3,'rows':_0xf08ea7}:null;}})[_0x2c91('0x3f')](respondWithResult(_0x7cd24f,null))[_0x2c91('0x45')](handleError(_0x7cd24f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b61910e..e243d03 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb63=['./intVtigerConfiguration.attributes','exports','int_vtiger_configurations','util','moment','bluebird','request-promise','rimraf'];(function(_0x2e2175,_0x25a8d9){var _0x3ed4c4=function(_0x3839d4){while(--_0x3839d4){_0x2e2175['push'](_0x2e2175['shift']());}};_0x3ed4c4(++_0x25a8d9);}(_0xbb63,0x1e3));var _0x3bb6=function(_0x503325,_0x24a407){_0x503325=_0x503325-0x0;var _0x452fff=_0xbb63[_0x503325];return _0x452fff;};'use strict';var _=require('lodash');var util=require(_0x3bb6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3bb6('0x1'));var BPromise=require(_0x3bb6('0x2'));var rp=require(_0x3bb6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3bb6('0x4'));var config=require('../../config/environment');var attributes=require(_0x3bb6('0x5'));module[_0x3bb6('0x6')]=function(_0x2be307,_0x30739b){return _0x2be307['define']('VtigerConfiguration',attributes,{'tableName':_0x3bb6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f44=['request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','define','util','bluebird'];(function(_0x71d2ea,_0x4281b3){var _0x353576=function(_0x2f4699){while(--_0x2f4699){_0x71d2ea['push'](_0x71d2ea['shift']());}};_0x353576(++_0x4281b3);}(_0x9f44,0x8a));var _0x49f4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9f44[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0x49f4('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x49f4('0x1'));var rp=require(_0x49f4('0x2'));var fs=require('fs');var path=require(_0x49f4('0x3'));var rimraf=require('rimraf');var config=require(_0x49f4('0x4'));var attributes=require(_0x49f4('0x5'));module['exports']=function(_0xc954a7,_0x2ae132){return _0xc954a7[_0x49f4('0x6')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index a52671c..62e5e9e 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe68d=['request','then','info','request\x20sent','debug','error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4089c7,_0x120195){var _0x33dd04=function(_0x4e4fea){while(--_0x4e4fea){_0x4089c7['push'](_0x4089c7['shift']());}};_0x33dd04(++_0x120195);}(_0xe68d,0x1ee));var _0xde68=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0xe68d[_0x223c0d];return _0x207827;};'use strict';var _=require('lodash');var util=require(_0xde68('0x0'));var moment=require(_0xde68('0x1'));var BPromise=require('bluebird');var rs=require(_0xde68('0x2'));var fs=require('fs');var Redis=require(_0xde68('0x3'));var db=require(_0xde68('0x4'))['db'];var utils=require(_0xde68('0x5'));var logger=require(_0xde68('0x6'))(_0xde68('0x7'));var config=require(_0xde68('0x8'));var jayson=require(_0xde68('0x9'));var client=jayson[_0xde68('0xa')][_0xde68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12c253,_0x31372a,_0x304c09){return new BPromise(function(_0x2029b6,_0x462f88){return client[_0xde68('0xc')](_0x12c253,_0x304c09)[_0xde68('0xd')](function(_0x53536f){logger[_0xde68('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x31372a,_0xde68('0xf'));logger[_0xde68('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x31372a,_0xde68('0xf'),JSON['stringify'](_0x53536f));if(_0x53536f[_0xde68('0x11')]){if(_0x53536f[_0xde68('0x11')][_0xde68('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x31372a,_0x53536f['error'][_0xde68('0x13')]);return _0x462f88(_0x53536f['error'][_0xde68('0x13')]);}logger[_0xde68('0x11')](_0xde68('0x14'),_0x31372a,_0x53536f[_0xde68('0x11')][_0xde68('0x13')]);return _0x2029b6(_0x53536f[_0xde68('0x11')][_0xde68('0x13')]);}else{logger['info'](_0xde68('0x14'),_0x31372a,'request\x20sent');_0x2029b6(_0x53536f[_0xde68('0x15')][_0xde68('0x13')]);}})[_0xde68('0x16')](function(_0x15fe99){logger[_0xde68('0x11')](_0xde68('0x14'),_0x31372a,_0x15fe99);_0x462f88(_0x15fe99);});});} \ No newline at end of file +var _0xc6a1=['http','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xc6a1,0x1c0));var _0x1c6a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc6a1[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1c6a('0x0'));var fs=require('fs');var Redis=require(_0x1c6a('0x1'));var db=require(_0x1c6a('0x2'))['db'];var utils=require(_0x1c6a('0x3'));var logger=require(_0x1c6a('0x4'))('rpc');var config=require(_0x1c6a('0x5'));var jayson=require(_0x1c6a('0x6'));var client=jayson[_0x1c6a('0x7')][_0x1c6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47a764,_0xbb5391,_0x43e9ef){return new BPromise(function(_0x4f7375,_0x4f8f4e){return client['request'](_0x47a764,_0x43e9ef)[_0x1c6a('0x9')](function(_0x75d6f4){logger['info'](_0x1c6a('0xa'),_0xbb5391,_0x1c6a('0xb'));logger[_0x1c6a('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xbb5391,_0x1c6a('0xb'),JSON[_0x1c6a('0xd')](_0x75d6f4));if(_0x75d6f4[_0x1c6a('0xe')]){if(_0x75d6f4[_0x1c6a('0xe')]['code']===0x1f4){logger[_0x1c6a('0xe')](_0x1c6a('0xa'),_0xbb5391,_0x75d6f4['error'][_0x1c6a('0xf')]);return _0x4f8f4e(_0x75d6f4[_0x1c6a('0xe')][_0x1c6a('0xf')]);}logger[_0x1c6a('0xe')](_0x1c6a('0xa'),_0xbb5391,_0x75d6f4[_0x1c6a('0xe')][_0x1c6a('0xf')]);return _0x4f7375(_0x75d6f4[_0x1c6a('0xe')]['message']);}else{logger[_0x1c6a('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0xbb5391,'request\x20sent');_0x4f7375(_0x75d6f4[_0x1c6a('0x11')][_0x1c6a('0xf')]);}})[_0x1c6a('0x12')](function(_0x28143d){logger['error'](_0x1c6a('0xa'),_0xbb5391,_0x28143d);_0x4f8f4e(_0x28143d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 1bdab81..c524cab 100644 --- a/server/api/intVtigerField/index.js +++ b/server/api/intVtigerField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x905f=['../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','express','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x905f,0x14d));var _0xf905=function(_0x10fc8b,_0xb7fca){_0x10fc8b=_0x10fc8b-0x0;var _0x4b8c84=_0x905f[_0x10fc8b];return _0x4b8c84;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf905('0x0'));var timeout=require('connect-timeout');var express=require(_0xf905('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf905('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf905('0x3'));var controller=require(_0xf905('0x4'));router[_0xf905('0x5')]('/',auth[_0xf905('0x6')](),controller[_0xf905('0x7')]);router[_0xf905('0x5')](_0xf905('0x8'),auth[_0xf905('0x6')](),controller[_0xf905('0x9')]);router[_0xf905('0xa')]('/',auth['isAuthenticated'](),controller[_0xf905('0xb')]);router[_0xf905('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xf905('0xd')]);router['delete']('/:id',auth[_0xf905('0x6')](),controller[_0xf905('0xe')]);module[_0xf905('0xf')]=router; \ No newline at end of file +var _0x945b=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x436985,_0x2e7f0b){var _0x2a8d4d=function(_0x9aadd4){while(--_0x9aadd4){_0x436985['push'](_0x436985['shift']());}};_0x2a8d4d(++_0x2e7f0b);}(_0x945b,0x116));var _0xb945=function(_0x5c08ae,_0x504511){_0x5c08ae=_0x5c08ae-0x0;var _0x191f67=_0x945b[_0x5c08ae];return _0x191f67;};'use strict';var multer=require(_0xb945('0x0'));var util=require(_0xb945('0x1'));var path=require(_0xb945('0x2'));var timeout=require(_0xb945('0x3'));var express=require(_0xb945('0x4'));var router=express['Router']();var fs_extra=require(_0xb945('0x5'));var auth=require(_0xb945('0x6'));var interaction=require(_0xb945('0x7'));var config=require('../../config/environment');var controller=require(_0xb945('0x8'));router[_0xb945('0x9')]('/',auth['isAuthenticated'](),controller[_0xb945('0xa')]);router[_0xb945('0x9')](_0xb945('0xb'),auth[_0xb945('0xc')](),controller[_0xb945('0xd')]);router[_0xb945('0xe')]('/',auth['isAuthenticated'](),controller[_0xb945('0xf')]);router[_0xb945('0x10')]('/:id',auth[_0xb945('0xc')](),controller[_0xb945('0x11')]);router[_0xb945('0x12')](_0xb945('0xb'),auth[_0xb945('0xc')](),controller[_0xb945('0x13')]);module[_0xb945('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 2e33503..fd7d17b 100644 --- a/server/api/intVtigerField/intVtigerField.attributes.js +++ b/server/api/intVtigerField/intVtigerField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12e3=['string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x269776,_0x285d86){var _0x236a10=function(_0x22314e){while(--_0x22314e){_0x269776['push'](_0x269776['shift']());}};_0x236a10(++_0x285d86);}(_0x12e3,0x1d2));var _0x312e=function(_0x32e2e3,_0x4098c6){_0x32e2e3=_0x32e2e3-0x0;var _0x5e885a=_0x12e3[_0x32e2e3];return _0x5e885a;};'use strict';var Sequelize=require(_0x312e('0x0'));module[_0x312e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x312e('0x2'),_0x312e('0x3'),_0x312e('0x4'),'keyValue',_0x312e('0x5')),'defaultValue':_0x312e('0x2')},'content':{'type':Sequelize[_0x312e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x312e('0x7')]('string','variable',_0x312e('0x4'))},'keyContent':{'type':Sequelize[_0x312e('0x6')]},'idField':{'type':Sequelize[_0x312e('0x6')]},'nameField':{'type':Sequelize[_0x312e('0x6')]},'customField':{'type':Sequelize[_0x312e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x312e('0x6')]}}; \ No newline at end of file +var _0xa42b=['exports','ENUM','customVariable','picklist','string','STRING','variable','BOOLEAN'];(function(_0x3f2ba2,_0x1490e6){var _0x27e878=function(_0x4ab2d6){while(--_0x4ab2d6){_0x3f2ba2['push'](_0x3f2ba2['shift']());}};_0x27e878(++_0x1490e6);}(_0xa42b,0x130));var _0xba42=function(_0x173a3a,_0x528f6c){_0x173a3a=_0x173a3a-0x0;var _0x5c8923=_0xa42b[_0x173a3a];return _0x5c8923;};'use strict';var Sequelize=require('sequelize');module[_0xba42('0x0')]={'type':{'type':Sequelize[_0xba42('0x1')]('string','variable',_0xba42('0x2'),'keyValue',_0xba42('0x3')),'defaultValue':_0xba42('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xba42('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xba42('0x6'),_0xba42('0x2'))},'keyContent':{'type':Sequelize[_0xba42('0x5')]},'idField':{'type':Sequelize[_0xba42('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xba42('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3f5d443..8efbdb1 100644 --- a/server/api/intVtigerField/intVtigerField.controller.js +++ b/server/api/intVtigerField/intVtigerField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5efa=['findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','sendStatus','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x5efa,0xe1));var _0xa5ef=function(_0x578793,_0x687d25){_0x578793=_0x578793-0x0;var _0xa85ea7=_0x5efa[_0x578793];return _0xa85ea7;};'use strict';var emlformat=require(_0xa5ef('0x0'));var rimraf=require(_0xa5ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5ef('0x2'));var rp=require(_0xa5ef('0x3'));var moment=require('moment');var BPromise=require(_0xa5ef('0x4'));var Mustache=require(_0xa5ef('0x5'));var util=require(_0xa5ef('0x6'));var path=require(_0xa5ef('0x7'));var sox=require(_0xa5ef('0x8'));var csv=require(_0xa5ef('0x9'));var ejs=require(_0xa5ef('0xa'));var fs=require('fs');var fs_extra=require(_0xa5ef('0xb'));var _=require(_0xa5ef('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5ef('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa5ef('0xe'));var Papa=require(_0xa5ef('0xf'));var Redis=require(_0xa5ef('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa5ef('0x11'));var hardwareService=require(_0xa5ef('0x12'));var logger=require(_0xa5ef('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa5ef('0x14'));var licenseUtil=require(_0xa5ef('0x15'));var db=require(_0xa5ef('0x16'))['db'];function respondWithStatusCode(_0x45fab9,_0x2096c0){_0x2096c0=_0x2096c0||0xcc;return function(_0x3fa0c4){if(_0x3fa0c4){return _0x45fab9['sendStatus'](_0x2096c0);}return _0x45fab9[_0xa5ef('0x17')](_0x2096c0)[_0xa5ef('0x18')]();};}function respondWithResult(_0x29d3c1,_0x5ae454){_0x5ae454=_0x5ae454||0xc8;return function(_0x4d0284){if(_0x4d0284){return _0x29d3c1['status'](_0x5ae454)[_0xa5ef('0x19')](_0x4d0284);}};}function respondWithFilteredResult(_0x253add,_0x466994){return function(_0xb94bb6){if(_0xb94bb6){var _0x3a85cd=typeof _0x466994[_0xa5ef('0x1a')]==='undefined'&&typeof _0x466994[_0xa5ef('0x1b')]===_0xa5ef('0x1c');var _0x39a9cc=_0xb94bb6[_0xa5ef('0x1d')];var _0x4419b7=_0x3a85cd?0x0:_0x466994['offset'];var _0x4c2b58=_0x3a85cd?_0xb94bb6['count']:_0x466994[_0xa5ef('0x1a')]+_0x466994['limit'];var _0x403b31;if(_0x4c2b58>=_0x39a9cc){_0x4c2b58=_0x39a9cc;_0x403b31=0xc8;}else{_0x403b31=0xce;}_0x253add[_0xa5ef('0x17')](_0x403b31);return _0x253add[_0xa5ef('0x1e')](_0xa5ef('0x1f'),_0x4419b7+'-'+_0x4c2b58+'/'+_0x39a9cc)[_0xa5ef('0x19')](_0xb94bb6);}return null;};}function patchUpdates(_0x31b61b){return function(_0x2f319b){try{jsonpatch[_0xa5ef('0x20')](_0x2f319b,_0x31b61b,!![]);}catch(_0x407810){return BPromise['reject'](_0x407810);}return _0x2f319b['save']();};}function saveUpdates(_0x2a15c0,_0x1510b1){return function(_0x791c87){if(_0x791c87){return _0x791c87[_0xa5ef('0x21')](_0x2a15c0)[_0xa5ef('0x22')](function(_0x189fca){return _0x189fca;});}return null;};}function removeEntity(_0x2383cc,_0xf6e2bd){return function(_0x3a5668){if(_0x3a5668){return _0x3a5668['destroy']()['then'](function(){_0x2383cc[_0xa5ef('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a3e0d,_0x37551a){return function(_0x234ad4){if(!_0x234ad4){_0x3a3e0d[_0xa5ef('0x23')](0x194);}return _0x234ad4;};}function handleError(_0x196657,_0x1cfd8b){_0x1cfd8b=_0x1cfd8b||0x1f4;return function(_0x11779d){logger['error'](_0x11779d[_0xa5ef('0x24')]);if(_0x11779d[_0xa5ef('0x25')]){delete _0x11779d[_0xa5ef('0x25')];}_0x196657[_0xa5ef('0x17')](_0x1cfd8b)[_0xa5ef('0x26')](_0x11779d);};}exports[_0xa5ef('0x27')]=function(_0x2e8871,_0x1ed280){var _0x748061={},_0x47f4bc={},_0x451e87={'count':0x0,'rows':[]};var _0x34524c=_[_0xa5ef('0x28')](db[_0xa5ef('0x29')][_0xa5ef('0x2a')],function(_0x19c4c1){return{'name':_0x19c4c1[_0xa5ef('0x2b')],'type':_0x19c4c1[_0xa5ef('0x2c')][_0xa5ef('0x2d')]};});_0x47f4bc['model']=_[_0xa5ef('0x28')](_0x34524c,'name');_0x47f4bc[_0xa5ef('0x2e')]=_[_0xa5ef('0x2f')](_0x2e8871[_0xa5ef('0x2e')]);_0x47f4bc[_0xa5ef('0x30')]=_[_0xa5ef('0x31')](_0x47f4bc[_0xa5ef('0x32')],_0x47f4bc[_0xa5ef('0x2e')]);_0x748061[_0xa5ef('0x33')]=_[_0xa5ef('0x31')](_0x47f4bc['model'],qs[_0xa5ef('0x34')](_0x2e8871[_0xa5ef('0x2e')]['fields']));_0x748061[_0xa5ef('0x33')]=_0x748061[_0xa5ef('0x33')][_0xa5ef('0x35')]?_0x748061['attributes']:_0x47f4bc[_0xa5ef('0x32')];if(!_0x2e8871[_0xa5ef('0x2e')][_0xa5ef('0x36')]('nolimit')){_0x748061[_0xa5ef('0x1b')]=qs[_0xa5ef('0x1b')](_0x2e8871[_0xa5ef('0x2e')]['limit']);_0x748061[_0xa5ef('0x1a')]=qs[_0xa5ef('0x1a')](_0x2e8871[_0xa5ef('0x2e')]['offset']);}_0x748061[_0xa5ef('0x37')]=qs[_0xa5ef('0x38')](_0x2e8871[_0xa5ef('0x2e')][_0xa5ef('0x38')]);_0x748061[_0xa5ef('0x39')]=qs[_0xa5ef('0x30')](_['pick'](_0x2e8871[_0xa5ef('0x2e')],_0x47f4bc['filters']),_0x34524c);if(_0x2e8871[_0xa5ef('0x2e')][_0xa5ef('0x3a')]){_0x748061['where']=_[_0xa5ef('0x3b')](_0x748061['where'],{'$or':_[_0xa5ef('0x28')](_0x34524c,function(_0xdfb54f){if(_0xdfb54f[_0xa5ef('0x2c')]!=='VIRTUAL'){var _0x17cac1={};_0x17cac1[_0xdfb54f['name']]={'$like':'%'+_0x2e8871[_0xa5ef('0x2e')][_0xa5ef('0x3a')]+'%'};return _0x17cac1;}})});}_0x748061=_[_0xa5ef('0x3b')]({},_0x748061,_0x2e8871[_0xa5ef('0x3c')]);var _0x2fa921={'where':_0x748061[_0xa5ef('0x39')]};return db[_0xa5ef('0x29')]['count'](_0x2fa921)[_0xa5ef('0x22')](function(_0x40ac6e){_0x451e87[_0xa5ef('0x1d')]=_0x40ac6e;if(_0x2e8871[_0xa5ef('0x2e')][_0xa5ef('0x3d')]){_0x748061[_0xa5ef('0x3e')]=[{'all':!![]}];}return db[_0xa5ef('0x29')][_0xa5ef('0x3f')](_0x748061);})['then'](function(_0x18642f){_0x451e87[_0xa5ef('0x40')]=_0x18642f;return _0x451e87;})[_0xa5ef('0x22')](respondWithFilteredResult(_0x1ed280,_0x748061))[_0xa5ef('0x41')](handleError(_0x1ed280,null));};exports[_0xa5ef('0x42')]=function(_0x3edf90,_0x225547){var _0x189dbc={'raw':!![],'where':{'id':_0x3edf90[_0xa5ef('0x43')]['id']}},_0xea3704={};_0xea3704['model']=_[_0xa5ef('0x2f')](db[_0xa5ef('0x29')][_0xa5ef('0x2a')]);_0xea3704['query']=_['keys'](_0x3edf90[_0xa5ef('0x2e')]);_0xea3704[_0xa5ef('0x30')]=_[_0xa5ef('0x31')](_0xea3704[_0xa5ef('0x32')],_0xea3704[_0xa5ef('0x2e')]);_0x189dbc[_0xa5ef('0x33')]=_[_0xa5ef('0x31')](_0xea3704[_0xa5ef('0x32')],qs['fields'](_0x3edf90['query'][_0xa5ef('0x34')]));_0x189dbc[_0xa5ef('0x33')]=_0x189dbc[_0xa5ef('0x33')][_0xa5ef('0x35')]?_0x189dbc['attributes']:_0xea3704['model'];if(_0x3edf90[_0xa5ef('0x2e')]['includeAll']){_0x189dbc[_0xa5ef('0x3e')]=[{'all':!![]}];}_0x189dbc=_[_0xa5ef('0x3b')]({},_0x189dbc,_0x3edf90[_0xa5ef('0x3c')]);return db[_0xa5ef('0x29')][_0xa5ef('0x44')](_0x189dbc)['then'](handleEntityNotFound(_0x225547,null))[_0xa5ef('0x22')](respondWithResult(_0x225547,null))[_0xa5ef('0x41')](handleError(_0x225547,null));};exports[_0xa5ef('0x45')]=function(_0x394040,_0x2ff72e){return db[_0xa5ef('0x29')]['create'](_0x394040[_0xa5ef('0x46')],{})[_0xa5ef('0x22')](respondWithResult(_0x2ff72e,0xc9))['catch'](handleError(_0x2ff72e,null));};exports[_0xa5ef('0x21')]=function(_0xe6adff,_0x1b12b7){if(_0xe6adff[_0xa5ef('0x46')]['id']){delete _0xe6adff[_0xa5ef('0x46')]['id'];}return db[_0xa5ef('0x29')]['find']({'where':{'id':_0xe6adff['params']['id']}})[_0xa5ef('0x22')](handleEntityNotFound(_0x1b12b7,null))[_0xa5ef('0x22')](saveUpdates(_0xe6adff[_0xa5ef('0x46')],null))[_0xa5ef('0x22')](respondWithResult(_0x1b12b7,null))[_0xa5ef('0x41')](handleError(_0x1b12b7,null));};exports[_0xa5ef('0x47')]=function(_0x3dfad3,_0xd21ee4){return db[_0xa5ef('0x29')][_0xa5ef('0x44')]({'where':{'id':_0x3dfad3[_0xa5ef('0x43')]['id']}})[_0xa5ef('0x22')](handleEntityNotFound(_0xd21ee4,null))[_0xa5ef('0x22')](removeEntity(_0xd21ee4,null))[_0xa5ef('0x41')](handleError(_0xd21ee4,null));}; \ No newline at end of file +var _0x2525=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','VtigerField','includeAll','include','findAll','catch','show','params','fields','length','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x2525,0x1ea));var _0x5252=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2525[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x5252('0x0'));var rimraf=require(_0x5252('0x1'));var zipdir=require(_0x5252('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5252('0x3'));var Mustache=require(_0x5252('0x4'));var util=require('util');var path=require(_0x5252('0x5'));var sox=require(_0x5252('0x6'));var csv=require(_0x5252('0x7'));var ejs=require(_0x5252('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5252('0x9'));var squel=require(_0x5252('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5252('0xb'));var Papa=require('papaparse');var Redis=require(_0x5252('0xc'));var authService=require(_0x5252('0xd'));var qs=require(_0x5252('0xe'));var as=require(_0x5252('0xf'));var hardwareService=require(_0x5252('0x10'));var logger=require('../../config/logger')(_0x5252('0x11'));var utils=require(_0x5252('0x12'));var config=require(_0x5252('0x13'));var licenseUtil=require(_0x5252('0x14'));var db=require(_0x5252('0x15'))['db'];function respondWithStatusCode(_0x5bf59e,_0x3ea92c){_0x3ea92c=_0x3ea92c||0xcc;return function(_0x4125bf){if(_0x4125bf){return _0x5bf59e[_0x5252('0x16')](_0x3ea92c);}return _0x5bf59e[_0x5252('0x17')](_0x3ea92c)[_0x5252('0x18')]();};}function respondWithResult(_0x31b8ef,_0x48fd9a){_0x48fd9a=_0x48fd9a||0xc8;return function(_0x4d8c82){if(_0x4d8c82){return _0x31b8ef['status'](_0x48fd9a)[_0x5252('0x19')](_0x4d8c82);}};}function respondWithFilteredResult(_0x480762,_0x507866){return function(_0x12f3a2){if(_0x12f3a2){var _0x21bfe5=typeof _0x507866[_0x5252('0x1a')]===_0x5252('0x1b')&&typeof _0x507866['limit']===_0x5252('0x1b');var _0x9bd3e5=_0x12f3a2['count'];var _0x1c586b=_0x21bfe5?0x0:_0x507866['offset'];var _0xf4d7ee=_0x21bfe5?_0x12f3a2[_0x5252('0x1c')]:_0x507866[_0x5252('0x1a')]+_0x507866['limit'];var _0x32a9cb;if(_0xf4d7ee>=_0x9bd3e5){_0xf4d7ee=_0x9bd3e5;_0x32a9cb=0xc8;}else{_0x32a9cb=0xce;}_0x480762[_0x5252('0x17')](_0x32a9cb);return _0x480762['set']('Content-Range',_0x1c586b+'-'+_0xf4d7ee+'/'+_0x9bd3e5)[_0x5252('0x19')](_0x12f3a2);}return null;};}function patchUpdates(_0x2f9848){return function(_0x1be447){try{jsonpatch[_0x5252('0x1d')](_0x1be447,_0x2f9848,!![]);}catch(_0x1a9ea7){return BPromise['reject'](_0x1a9ea7);}return _0x1be447[_0x5252('0x1e')]();};}function saveUpdates(_0x2c1d9c,_0x271bce){return function(_0x7566e3){if(_0x7566e3){return _0x7566e3[_0x5252('0x1f')](_0x2c1d9c)[_0x5252('0x20')](function(_0x49139b){return _0x49139b;});}return null;};}function removeEntity(_0x221b8e,_0x10b452){return function(_0x5498ee){if(_0x5498ee){return _0x5498ee[_0x5252('0x21')]()[_0x5252('0x20')](function(){_0x221b8e[_0x5252('0x17')](0xcc)[_0x5252('0x18')]();});}};}function handleEntityNotFound(_0x230ac2,_0x4ba4c3){return function(_0x59e50e){if(!_0x59e50e){_0x230ac2[_0x5252('0x16')](0x194);}return _0x59e50e;};}function handleError(_0x2ae255,_0x423eeb){_0x423eeb=_0x423eeb||0x1f4;return function(_0x25b2ba){logger[_0x5252('0x22')](_0x25b2ba[_0x5252('0x23')]);if(_0x25b2ba[_0x5252('0x24')]){delete _0x25b2ba[_0x5252('0x24')];}_0x2ae255[_0x5252('0x17')](_0x423eeb)[_0x5252('0x25')](_0x25b2ba);};}exports[_0x5252('0x26')]=function(_0x2e7923,_0x4edd60){var _0x57661f={},_0x151a43={},_0x4adb22={'count':0x0,'rows':[]};var _0x19ba8d=_['map'](db['VtigerField'][_0x5252('0x27')],function(_0x14403f){return{'name':_0x14403f[_0x5252('0x28')],'type':_0x14403f[_0x5252('0x29')][_0x5252('0x2a')]};});_0x151a43[_0x5252('0x2b')]=_[_0x5252('0x2c')](_0x19ba8d,'name');_0x151a43['query']=_[_0x5252('0x2d')](_0x2e7923['query']);_0x151a43['filters']=_['intersection'](_0x151a43['model'],_0x151a43[_0x5252('0x2e')]);_0x57661f['attributes']=_[_0x5252('0x2f')](_0x151a43[_0x5252('0x2b')],qs['fields'](_0x2e7923[_0x5252('0x2e')]['fields']));_0x57661f[_0x5252('0x30')]=_0x57661f[_0x5252('0x30')]['length']?_0x57661f['attributes']:_0x151a43[_0x5252('0x2b')];if(!_0x2e7923[_0x5252('0x2e')][_0x5252('0x31')](_0x5252('0x32'))){_0x57661f[_0x5252('0x33')]=qs['limit'](_0x2e7923[_0x5252('0x2e')][_0x5252('0x33')]);_0x57661f[_0x5252('0x1a')]=qs['offset'](_0x2e7923[_0x5252('0x2e')][_0x5252('0x1a')]);}_0x57661f[_0x5252('0x34')]=qs[_0x5252('0x35')](_0x2e7923[_0x5252('0x2e')][_0x5252('0x35')]);_0x57661f['where']=qs['filters'](_[_0x5252('0x36')](_0x2e7923[_0x5252('0x2e')],_0x151a43[_0x5252('0x37')]),_0x19ba8d);if(_0x2e7923[_0x5252('0x2e')][_0x5252('0x38')]){_0x57661f[_0x5252('0x39')]=_['merge'](_0x57661f[_0x5252('0x39')],{'$or':_['map'](_0x19ba8d,function(_0x2c9524){if(_0x2c9524[_0x5252('0x29')]!==_0x5252('0x3a')){var _0x3f1a55={};_0x3f1a55[_0x2c9524[_0x5252('0x24')]]={'$like':'%'+_0x2e7923['query']['filter']+'%'};return _0x3f1a55;}})});}_0x57661f=_[_0x5252('0x3b')]({},_0x57661f,_0x2e7923[_0x5252('0x3c')]);var _0x561e36={'where':_0x57661f[_0x5252('0x39')]};return db[_0x5252('0x3d')]['count'](_0x561e36)[_0x5252('0x20')](function(_0x1c855d){_0x4adb22[_0x5252('0x1c')]=_0x1c855d;if(_0x2e7923['query'][_0x5252('0x3e')]){_0x57661f[_0x5252('0x3f')]=[{'all':!![]}];}return db[_0x5252('0x3d')][_0x5252('0x40')](_0x57661f);})[_0x5252('0x20')](function(_0x3b154b){_0x4adb22['rows']=_0x3b154b;return _0x4adb22;})['then'](respondWithFilteredResult(_0x4edd60,_0x57661f))[_0x5252('0x41')](handleError(_0x4edd60,null));};exports[_0x5252('0x42')]=function(_0x4e0fb6,_0x24c275){var _0xb50e19={'raw':!![],'where':{'id':_0x4e0fb6[_0x5252('0x43')]['id']}},_0x4e1c27={};_0x4e1c27[_0x5252('0x2b')]=_[_0x5252('0x2d')](db[_0x5252('0x3d')][_0x5252('0x27')]);_0x4e1c27['query']=_['keys'](_0x4e0fb6['query']);_0x4e1c27[_0x5252('0x37')]=_[_0x5252('0x2f')](_0x4e1c27['model'],_0x4e1c27[_0x5252('0x2e')]);_0xb50e19[_0x5252('0x30')]=_[_0x5252('0x2f')](_0x4e1c27[_0x5252('0x2b')],qs[_0x5252('0x44')](_0x4e0fb6[_0x5252('0x2e')][_0x5252('0x44')]));_0xb50e19[_0x5252('0x30')]=_0xb50e19[_0x5252('0x30')][_0x5252('0x45')]?_0xb50e19[_0x5252('0x30')]:_0x4e1c27['model'];if(_0x4e0fb6[_0x5252('0x2e')][_0x5252('0x3e')]){_0xb50e19['include']=[{'all':!![]}];}_0xb50e19=_[_0x5252('0x3b')]({},_0xb50e19,_0x4e0fb6[_0x5252('0x3c')]);return db['VtigerField'][_0x5252('0x46')](_0xb50e19)[_0x5252('0x20')](handleEntityNotFound(_0x24c275,null))[_0x5252('0x20')](respondWithResult(_0x24c275,null))['catch'](handleError(_0x24c275,null));};exports[_0x5252('0x47')]=function(_0xe219f,_0x5bcf72){return db[_0x5252('0x3d')][_0x5252('0x47')](_0xe219f[_0x5252('0x48')],{})['then'](respondWithResult(_0x5bcf72,0xc9))['catch'](handleError(_0x5bcf72,null));};exports['update']=function(_0x1ad14f,_0xfb7711){if(_0x1ad14f['body']['id']){delete _0x1ad14f[_0x5252('0x48')]['id'];}return db['VtigerField'][_0x5252('0x46')]({'where':{'id':_0x1ad14f[_0x5252('0x43')]['id']}})[_0x5252('0x20')](handleEntityNotFound(_0xfb7711,null))['then'](saveUpdates(_0x1ad14f[_0x5252('0x48')],null))[_0x5252('0x20')](respondWithResult(_0xfb7711,null))[_0x5252('0x41')](handleError(_0xfb7711,null));};exports['destroy']=function(_0x484a16,_0x53607c){return db['VtigerField']['find']({'where':{'id':_0x484a16[_0x5252('0x43')]['id']}})[_0x5252('0x20')](handleEntityNotFound(_0x53607c,null))[_0x5252('0x20')](removeEntity(_0x53607c,null))['catch'](handleError(_0x53607c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 23e4fcf..c7ec356 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cb1=['./intVtigerField.attributes','VtigerField','int_vtiger_fields','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x7a6f2e,_0x5c93ec){var _0x14480b=function(_0x2a1336){while(--_0x2a1336){_0x7a6f2e['push'](_0x7a6f2e['shift']());}};_0x14480b(++_0x5c93ec);}(_0x4cb1,0xba));var _0x14cb=function(_0x5528b0,_0x899aa4){_0x5528b0=_0x5528b0-0x0;var _0xb28fd8=_0x4cb1[_0x5528b0];return _0xb28fd8;};'use strict';var _=require(_0x14cb('0x0'));var util=require(_0x14cb('0x1'));var logger=require(_0x14cb('0x2'))('api');var moment=require(_0x14cb('0x3'));var BPromise=require(_0x14cb('0x4'));var rp=require(_0x14cb('0x5'));var fs=require('fs');var path=require(_0x14cb('0x6'));var rimraf=require(_0x14cb('0x7'));var config=require(_0x14cb('0x8'));var attributes=require(_0x14cb('0x9'));module['exports']=function(_0x16f169,_0x4a4675){return _0x16f169['define'](_0x14cb('0xa'),attributes,{'tableName':_0x14cb('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x14cb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x037e=['request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x26707c,_0x1ee0cc){var _0x11e7aa=function(_0x2354b3){while(--_0x2354b3){_0x26707c['push'](_0x26707c['shift']());}};_0x11e7aa(++_0x1ee0cc);}(_0x037e,0x1ca));var _0xe037=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x037e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe037('0x0'));var util=require(_0xe037('0x1'));var logger=require(_0xe037('0x2'))('api');var moment=require(_0xe037('0x3'));var BPromise=require('bluebird');var rp=require(_0xe037('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe037('0x5'));var config=require(_0xe037('0x6'));var attributes=require(_0xe037('0x7'));module[_0xe037('0x8')]=function(_0x4b8444,_0x5be704){return _0x4b8444[_0xe037('0x9')](_0xe037('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xe037('0xb'),'fields':[_0xe037('0xc'),_0xe037('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 2a7f1fb..998ed81 100644 --- a/server/api/intVtigerField/intVtigerField.rpc.js +++ b/server/api/intVtigerField/intVtigerField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8643=['lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','client','request','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x8643,0xdd));var _0x3864=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x8643[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x3864('0x0'));var util=require(_0x3864('0x1'));var moment=require(_0x3864('0x2'));var BPromise=require('bluebird');var rs=require(_0x3864('0x3'));var fs=require('fs');var Redis=require(_0x3864('0x4'));var db=require(_0x3864('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3864('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3864('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4eb3e3,_0x1af9c9,_0x5524cb){return new BPromise(function(_0x15ffa6,_0x324cf7){return client[_0x3864('0x8')](_0x4eb3e3,_0x5524cb)['then'](function(_0x473b1d){logger['info']('VtigerField,\x20%s,\x20%s',_0x1af9c9,_0x3864('0x9'));logger['debug'](_0x3864('0xa'),_0x1af9c9,_0x3864('0x9'),JSON[_0x3864('0xb')](_0x473b1d));if(_0x473b1d[_0x3864('0xc')]){if(_0x473b1d['error'][_0x3864('0xd')]===0x1f4){logger['error'](_0x3864('0xe'),_0x1af9c9,_0x473b1d['error'][_0x3864('0xf')]);return _0x324cf7(_0x473b1d[_0x3864('0xc')]['message']);}logger[_0x3864('0xc')](_0x3864('0xe'),_0x1af9c9,_0x473b1d[_0x3864('0xc')][_0x3864('0xf')]);return _0x15ffa6(_0x473b1d[_0x3864('0xc')][_0x3864('0xf')]);}else{logger[_0x3864('0x10')](_0x3864('0xe'),_0x1af9c9,_0x3864('0x9'));_0x15ffa6(_0x473b1d['result'][_0x3864('0xf')]);}})['catch'](function(_0x38b9c0){logger['error'](_0x3864('0xe'),_0x1af9c9,_0x38b9c0);_0x324cf7(_0x38b9c0);});});} \ No newline at end of file +var _0x70f8=['result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x70f8,0x6b));var _0x870f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x70f8[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x870f('0x0'));var BPromise=require(_0x870f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x870f('0x2'));var db=require(_0x870f('0x3'))['db'];var utils=require(_0x870f('0x4'));var logger=require('../../config/logger')(_0x870f('0x5'));var config=require(_0x870f('0x6'));var jayson=require(_0x870f('0x7'));var client=jayson['client'][_0x870f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d698f,_0x199d79,_0x1922b1){return new BPromise(function(_0x4c68fc,_0x311d74){return client[_0x870f('0x9')](_0x5d698f,_0x1922b1)[_0x870f('0xa')](function(_0x3cf0bf){logger['info'](_0x870f('0xb'),_0x199d79,'request\x20sent');logger['debug'](_0x870f('0xc'),_0x199d79,_0x870f('0xd'),JSON[_0x870f('0xe')](_0x3cf0bf));if(_0x3cf0bf[_0x870f('0xf')]){if(_0x3cf0bf[_0x870f('0xf')][_0x870f('0x10')]===0x1f4){logger[_0x870f('0xf')](_0x870f('0xb'),_0x199d79,_0x3cf0bf[_0x870f('0xf')][_0x870f('0x11')]);return _0x311d74(_0x3cf0bf[_0x870f('0xf')][_0x870f('0x11')]);}logger[_0x870f('0xf')](_0x870f('0xb'),_0x199d79,_0x3cf0bf['error'][_0x870f('0x11')]);return _0x4c68fc(_0x3cf0bf[_0x870f('0xf')][_0x870f('0x11')]);}else{logger[_0x870f('0x12')](_0x870f('0xb'),_0x199d79,_0x870f('0xd'));_0x4c68fc(_0x3cf0bf[_0x870f('0x13')][_0x870f('0x11')]);}})[_0x870f('0x14')](function(_0x484676){logger[_0x870f('0xf')](_0x870f('0xb'),_0x199d79,_0x484676);_0x311d74(_0x484676);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e3ea7ab..db8e636 100644 --- a/server/api/intZendeskAccount/index.js +++ b/server/api/intZendeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb76b=['get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller'];(function(_0x3cd3cc,_0x4a3eb6){var _0x287942=function(_0x21d5b9){while(--_0x21d5b9){_0x3cd3cc['push'](_0x3cd3cc['shift']());}};_0x287942(++_0x4a3eb6);}(_0xb76b,0x12f));var _0xbb76=function(_0x1db16f,_0x2223ae){_0x1db16f=_0x1db16f-0x0;var _0x382c53=_0xb76b[_0x1db16f];return _0x382c53;};'use strict';var multer=require('multer');var util=require(_0xbb76('0x0'));var path=require(_0xbb76('0x1'));var timeout=require(_0xbb76('0x2'));var express=require('express');var router=express[_0xbb76('0x3')]();var fs_extra=require(_0xbb76('0x4'));var auth=require(_0xbb76('0x5'));var interaction=require(_0xbb76('0x6'));var config=require(_0xbb76('0x7'));var controller=require(_0xbb76('0x8'));router[_0xbb76('0x9')]('/',auth[_0xbb76('0xa')](),controller[_0xbb76('0xb')]);router[_0xbb76('0x9')]('/:id',auth[_0xbb76('0xa')](),controller[_0xbb76('0xc')]);router['get'](_0xbb76('0xd'),auth[_0xbb76('0xa')](),controller[_0xbb76('0xe')]);router[_0xbb76('0x9')](_0xbb76('0xf'),auth[_0xbb76('0xa')](),controller[_0xbb76('0x10')]);router[_0xbb76('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xbb76('0xd'),auth[_0xbb76('0xa')](),controller[_0xbb76('0x12')]);router[_0xbb76('0x13')](_0xbb76('0x14'),auth[_0xbb76('0xa')](),controller['update']);router[_0xbb76('0x15')](_0xbb76('0x14'),auth[_0xbb76('0xa')](),controller[_0xbb76('0x16')]);module[_0xbb76('0x17')]=router; \ No newline at end of file +var _0xe432=['/:id/fields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations'];(function(_0x281b6c,_0x54a8ac){var _0x5e28aa=function(_0x9178f2){while(--_0x9178f2){_0x281b6c['push'](_0x281b6c['shift']());}};_0x5e28aa(++_0x54a8ac);}(_0xe432,0x9a));var _0x2e43=function(_0x1c1aec,_0x1a6131){_0x1c1aec=_0x1c1aec-0x0;var _0x2e4a37=_0xe432[_0x1c1aec];return _0x2e4a37;};'use strict';var multer=require('multer');var util=require(_0x2e43('0x0'));var path=require(_0x2e43('0x1'));var timeout=require(_0x2e43('0x2'));var express=require('express');var router=express[_0x2e43('0x3')]();var fs_extra=require(_0x2e43('0x4'));var auth=require(_0x2e43('0x5'));var interaction=require(_0x2e43('0x6'));var config=require(_0x2e43('0x7'));var controller=require(_0x2e43('0x8'));router[_0x2e43('0x9')]('/',auth[_0x2e43('0xa')](),controller[_0x2e43('0xb')]);router[_0x2e43('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2e43('0x9')](_0x2e43('0xc'),auth[_0x2e43('0xa')](),controller[_0x2e43('0xd')]);router[_0x2e43('0x9')](_0x2e43('0xe'),auth[_0x2e43('0xa')](),controller['getFields']);router[_0x2e43('0xf')]('/',auth['isAuthenticated'](),controller[_0x2e43('0x10')]);router[_0x2e43('0xf')](_0x2e43('0xc'),auth['isAuthenticated'](),controller[_0x2e43('0x11')]);router[_0x2e43('0x12')](_0x2e43('0x13'),auth[_0x2e43('0xa')](),controller[_0x2e43('0x14')]);router[_0x2e43('0x15')](_0x2e43('0x13'),auth[_0x2e43('0xa')](),controller[_0x2e43('0x16')]);module[_0x2e43('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 2161163..7f23f29 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.attributes.js +++ b/server/api/intZendeskAccount/intZendeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9eb=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd9eb,0xca));var _0xbd9e=function(_0x53d0f2,_0x461fff){_0x53d0f2=_0x53d0f2-0x0;var _0x4039fe=_0xd9eb[_0x53d0f2];return _0x4039fe;};'use strict';var Sequelize=require(_0xbd9e('0x0'));module[_0xbd9e('0x1')]={'name':{'type':Sequelize[_0xbd9e('0x2')]},'description':{'type':Sequelize[_0xbd9e('0x2')]},'username':{'type':Sequelize[_0xbd9e('0x2')],'unique':_0xbd9e('0x3')},'password':{'type':Sequelize[_0xbd9e('0x2')]},'token':{'type':Sequelize[_0xbd9e('0x2')]},'remoteUri':{'type':Sequelize[_0xbd9e('0x2')],'unique':_0xbd9e('0x4')},'authType':{'type':Sequelize[_0xbd9e('0x5')](_0xbd9e('0x6'),_0xbd9e('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xbd9e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbd9e('0x5')](_0xbd9e('0x8'),_0xbd9e('0x9')),'defaultValue':_0xbd9e('0x8')}}; \ No newline at end of file +var _0x7524=['username','ENUM','password','token','integrationTab','newTab','exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7524,0xce));var _0x4752=function(_0x3fe397,_0x309778){_0x3fe397=_0x3fe397-0x0;var _0x366b33=_0x7524[_0x3fe397];return _0x366b33;};'use strict';var Sequelize=require('sequelize');module[_0x4752('0x0')]={'name':{'type':Sequelize[_0x4752('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4752('0x1')],'unique':_0x4752('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4752('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x4752('0x3')](_0x4752('0x4'),_0x4752('0x5')),'defaultValue':_0x4752('0x4')},'serverUrl':{'type':Sequelize[_0x4752('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4752('0x6'),_0x4752('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 5a142a8..1c9c9ca 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb62e=['custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','include','rows','catch','keys','rawAttributes','length','find','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','position','system_field_options'];(function(_0x1f75bb,_0x4cc9ed){var _0x14b2b2=function(_0x1e3e93){while(--_0x1e3e93){_0x1f75bb['push'](_0x1f75bb['shift']());}};_0x14b2b2(++_0x4cc9ed);}(_0xb62e,0x1de));var _0xeb62=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb62e[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb62('0x1b'));function respondWithStatusCode(_0xcc11c4,_0x27671e){_0x27671e=_0x27671e||0xcc;return function(_0x6822bc){if(_0x6822bc){return _0xcc11c4['sendStatus'](_0x27671e);}return _0xcc11c4[_0xeb62('0x1c')](_0x27671e)[_0xeb62('0x1d')]();};}function respondWithResult(_0x23fb15,_0x4da178){_0x4da178=_0x4da178||0xc8;return function(_0x26c3fd){if(_0x26c3fd){return _0x23fb15[_0xeb62('0x1c')](_0x4da178)[_0xeb62('0x1e')](_0x26c3fd);}};}function respondWithFilteredResult(_0x4ce9fa,_0x1f6a1f){return function(_0x15b3e8){if(_0x15b3e8){var _0x184106=typeof _0x1f6a1f[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x1f6a1f[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1324d7=_0x15b3e8[_0xeb62('0x22')];var _0x27fd84=_0x184106?0x0:_0x1f6a1f[_0xeb62('0x1f')];var _0x11d516=_0x184106?_0x15b3e8[_0xeb62('0x22')]:_0x1f6a1f['offset']+_0x1f6a1f[_0xeb62('0x21')];var _0x130e2f;if(_0x11d516>=_0x1324d7){_0x11d516=_0x1324d7;_0x130e2f=0xc8;}else{_0x130e2f=0xce;}_0x4ce9fa[_0xeb62('0x1c')](_0x130e2f);return _0x4ce9fa[_0xeb62('0x23')](_0xeb62('0x24'),_0x27fd84+'-'+_0x11d516+'/'+_0x1324d7)[_0xeb62('0x1e')](_0x15b3e8);}return null;};}function patchUpdates(_0x2ed96d){return function(_0x589bf2){try{jsonpatch['apply'](_0x589bf2,_0x2ed96d,!![]);}catch(_0x1fbfaa){return BPromise[_0xeb62('0x25')](_0x1fbfaa);}return _0x589bf2[_0xeb62('0x26')]();};}function saveUpdates(_0x13243f,_0x122b15){return function(_0x4cafcf){if(_0x4cafcf){return _0x4cafcf['update'](_0x13243f)[_0xeb62('0x27')](function(_0x132861){return _0x132861;});}return null;};}function removeEntity(_0x182781,_0x395b70){return function(_0x55a169){if(_0x55a169){return _0x55a169['destroy']()[_0xeb62('0x27')](function(){_0x182781['status'](0xcc)[_0xeb62('0x1d')]();});}};}function handleEntityNotFound(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(!_0x516a72){_0x4b0f46[_0xeb62('0x28')](0x194);}return _0x516a72;};}function handleError(_0x6bfbbc,_0x46d1bb){_0x46d1bb=_0x46d1bb||0x1f4;return function(_0x4e4268){logger[_0xeb62('0x29')](_0x4e4268[_0xeb62('0x2a')]);if(_0x4e4268[_0xeb62('0x2b')]){delete _0x4e4268[_0xeb62('0x2b')];}_0x6bfbbc[_0xeb62('0x1c')](_0x46d1bb)[_0xeb62('0x2c')](_0x4e4268);};}exports['index']=function(_0x192517,_0x1616ee){var _0x57169a={},_0x157474={},_0x2b51b2={'count':0x0,'rows':[]};var _0x2c967c=_[_0xeb62('0x2d')](db[_0xeb62('0x2e')]['rawAttributes'],function(_0x4b58af){return{'name':_0x4b58af[_0xeb62('0x2f')],'type':_0x4b58af[_0xeb62('0x30')][_0xeb62('0x31')]};});_0x157474[_0xeb62('0x32')]=_[_0xeb62('0x2d')](_0x2c967c,_0xeb62('0x2b'));_0x157474[_0xeb62('0x33')]=_['keys'](_0x192517[_0xeb62('0x33')]);_0x157474['filters']=_['intersection'](_0x157474[_0xeb62('0x32')],_0x157474[_0xeb62('0x33')]);_0x57169a['attributes']=_[_0xeb62('0x34')](_0x157474['model'],qs[_0xeb62('0x35')](_0x192517[_0xeb62('0x33')]['fields']));_0x57169a[_0xeb62('0x36')]=_0x57169a[_0xeb62('0x36')]['length']?_0x57169a[_0xeb62('0x36')]:_0x157474[_0xeb62('0x32')];if(!_0x192517[_0xeb62('0x33')][_0xeb62('0x37')]('nolimit')){_0x57169a[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x192517['query']['limit']);_0x57169a[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x192517['query'][_0xeb62('0x1f')]);}_0x57169a[_0xeb62('0x38')]=qs[_0xeb62('0x39')](_0x192517[_0xeb62('0x33')][_0xeb62('0x39')]);_0x57169a[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_['pick'](_0x192517['query'],_0x157474[_0xeb62('0x3b')]),_0x2c967c);if(_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x57169a[_0xeb62('0x3a')]=_['merge'](_0x57169a[_0xeb62('0x3a')],{'$or':_['map'](_0x2c967c,function(_0x20fd7a){if(_0x20fd7a[_0xeb62('0x30')]!==_0xeb62('0x3d')){var _0x136c5a={};_0x136c5a[_0x20fd7a[_0xeb62('0x2b')]]={'$like':'%'+_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x136c5a;}})});}_0x57169a=_[_0xeb62('0x3e')]({},_0x57169a,_0x192517['options']);var _0x38f91b={'where':_0x57169a[_0xeb62('0x3a')]};return db[_0xeb62('0x2e')][_0xeb62('0x22')](_0x38f91b)['then'](function(_0x4eda8b){_0x2b51b2[_0xeb62('0x22')]=_0x4eda8b;if(_0x192517[_0xeb62('0x33')]['includeAll']){_0x57169a[_0xeb62('0x3f')]=[{'all':!![]}];}return db[_0xeb62('0x2e')]['findAll'](_0x57169a);})[_0xeb62('0x27')](function(_0x478a54){_0x2b51b2[_0xeb62('0x40')]=_0x478a54;return _0x2b51b2;})['then'](respondWithFilteredResult(_0x1616ee,_0x57169a))[_0xeb62('0x41')](handleError(_0x1616ee,null));};exports['show']=function(_0x2bf77f,_0x609b2d){var _0x317f50={'raw':![],'where':{'id':_0x2bf77f['params']['id']}},_0x594274={};_0x594274[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x2e')][_0xeb62('0x43')]);_0x594274[_0xeb62('0x33')]=_['keys'](_0x2bf77f[_0xeb62('0x33')]);_0x594274['filters']=_[_0xeb62('0x34')](_0x594274['model'],_0x594274[_0xeb62('0x33')]);_0x317f50['attributes']=_[_0xeb62('0x34')](_0x594274['model'],qs[_0xeb62('0x35')](_0x2bf77f[_0xeb62('0x33')][_0xeb62('0x35')]));_0x317f50[_0xeb62('0x36')]=_0x317f50[_0xeb62('0x36')][_0xeb62('0x44')]?_0x317f50['attributes']:_0x594274[_0xeb62('0x32')];if(_0x2bf77f[_0xeb62('0x33')]['includeAll']){_0x317f50['include']=[{'all':!![]}];}_0x317f50=_['merge']({},_0x317f50,_0x2bf77f['options']);return db[_0xeb62('0x2e')][_0xeb62('0x45')](_0x317f50)['then'](handleEntityNotFound(_0x609b2d,null))[_0xeb62('0x27')](respondWithResult(_0x609b2d,null))[_0xeb62('0x41')](handleError(_0x609b2d,null));};exports[_0xeb62('0x46')]=function(_0x16e262,_0x39595c){return db['ZendeskAccount'][_0xeb62('0x46')](_0x16e262['body'],{})[_0xeb62('0x27')](respondWithResult(_0x39595c,0xc9))[_0xeb62('0x41')](handleError(_0x39595c,null));};exports[_0xeb62('0x47')]=function(_0x18c40d,_0x1f2d87){if(_0x18c40d[_0xeb62('0x48')]['id']){delete _0x18c40d[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x45')]({'where':{'id':_0x18c40d[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x1f2d87,null))[_0xeb62('0x27')](saveUpdates(_0x18c40d['body'],null))[_0xeb62('0x27')](respondWithResult(_0x1f2d87,null))['catch'](handleError(_0x1f2d87,null));};exports['destroy']=function(_0x2dcb2d,_0x31fd4a){return db['ZendeskAccount'][_0xeb62('0x45')]({'where':{'id':_0x2dcb2d[_0xeb62('0x49')]['id']}})['then'](handleEntityNotFound(_0x31fd4a,null))[_0xeb62('0x27')](removeEntity(_0x31fd4a,null))[_0xeb62('0x41')](handleError(_0x31fd4a,null));};exports[_0xeb62('0x4a')]=function(_0x60617,_0xe71e83,_0x1e6238){var _0x351027={};var _0x190e65={};var _0x497714;var _0x3e2be9;return db['ZendeskAccount'][_0xeb62('0x4b')]({'where':{'id':_0x60617[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0xe71e83,null))[_0xeb62('0x27')](function(_0x35d92d){if(_0x35d92d){_0x497714=_0x35d92d;_0x190e65[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x4c')]['rawAttributes']);_0x190e65['query']=_['keys'](_0x60617['query']);_0x190e65[_0xeb62('0x3b')]=_['intersection'](_0x190e65[_0xeb62('0x32')],_0x190e65['query']);_0x351027[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x190e65[_0xeb62('0x32')],qs['fields'](_0x60617[_0xeb62('0x33')][_0xeb62('0x35')]));_0x351027['attributes']=_0x351027[_0xeb62('0x36')][_0xeb62('0x44')]?_0x351027[_0xeb62('0x36')]:_0x190e65[_0xeb62('0x32')];_0x351027['order']=qs[_0xeb62('0x39')](_0x60617[_0xeb62('0x33')]['sort']);_0x351027[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_[_0xeb62('0x4d')](_0x60617[_0xeb62('0x33')],_0x190e65[_0xeb62('0x3b')]));if(_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x351027[_0xeb62('0x3a')]=_[_0xeb62('0x3e')](_0x351027[_0xeb62('0x3a')],{'$or':_[_0xeb62('0x2d')](_0x351027[_0xeb62('0x36')],function(_0x200b43){var _0x3ae984={};_0x3ae984[_0x200b43]={'$like':'%'+_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x3ae984;})});}_0x351027=_['merge']({},_0x351027,_0x60617['options']);return _0x497714['getConfigurations'](_0x351027);}})['then'](function(_0x279b83){if(_0x279b83){_0x3e2be9=_0x279b83['length'];if(!_0x60617[_0xeb62('0x33')][_0xeb62('0x37')](_0xeb62('0x4e'))){_0x351027[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x60617[_0xeb62('0x33')][_0xeb62('0x21')]);_0x351027[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x60617[_0xeb62('0x33')]['offset']);}return _0x497714[_0xeb62('0x4a')](_0x351027);}})[_0xeb62('0x27')](function(_0x42e992){if(_0x42e992){return _0x42e992?{'count':_0x3e2be9,'rows':_0x42e992}:null;}})[_0xeb62('0x27')](respondWithResult(_0xe71e83,null))['catch'](handleError(_0xe71e83,null));};exports[_0xeb62('0x4f')]=function(_0x2e5456,_0x3ff00a,_0x2abd21){if(_0x2e5456[_0xeb62('0x48')]['id']){delete _0x2e5456[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x2e5456[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x3ff00a,null))[_0xeb62('0x27')](function(_0x510275){if(_0x510275){_0x2e5456[_0xeb62('0x48')][_0xeb62('0x50')]=_0x510275['id'];_0x2e5456[_0xeb62('0x48')][_0xeb62('0x51')]=integrations[_0xeb62('0x52')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')][_0xeb62('0x30')]);_0x2e5456[_0xeb62('0x48')]['Descriptions']=integrations[_0xeb62('0x54')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')]['type']);return db[_0xeb62('0x4c')][_0xeb62('0x46')](_0x2e5456[_0xeb62('0x48')],{'include':[{'model':db[_0xeb62('0x55')],'as':_0xeb62('0x51')},{'model':db[_0xeb62('0x55')],'as':'Descriptions'}]});}return null;})[_0xeb62('0x27')](respondWithResult(_0x3ff00a,null))[_0xeb62('0x41')](handleError(_0x3ff00a,null));};exports[_0xeb62('0x56')]=function(_0x173c07,_0x351acf,_0x28d0ff){var _0x2e4502='';return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x173c07[_0xeb62('0x49')]['id']},'attributes':['id',_0xeb62('0x57'),_0xeb62('0x58'),_0xeb62('0x59'),_0xeb62('0x5a'),_0xeb62('0x5b')]})[_0xeb62('0x27')](handleEntityNotFound(_0x351acf,null))['then'](function(_0x3b3eb1){if(_0x3b3eb1){_0x2e4502=_0x3b3eb1['remoteUri'];var _0x6ea297=_0x2e4502[_0xeb62('0x5c')](-0x1);if(_0x6ea297==='/'){_0x2e4502=_0x2e4502['substring'](0x0,_0x2e4502[_0xeb62('0x5d')](_0x6ea297));}var _0x10986a={'method':_0xeb62('0x5e'),'uri':util[_0xeb62('0x5f')](_0xeb62('0x60'),_0x2e4502,_0xeb62('0x61')),'json':!![]};switch(_0x3b3eb1[_0xeb62('0x5a')]){case _0xeb62('0x58'):_0x10986a[_0xeb62('0x62')]={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x64'),_0x3b3eb1['username'],_0x3b3eb1[_0xeb62('0x58')]))[_0xeb62('0x65')]('base64'))};break;case _0xeb62('0x59'):_0x10986a['headers']={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x66'),_0x3b3eb1[_0xeb62('0x57')],_0x3b3eb1[_0xeb62('0x59')]))['toString'](_0xeb62('0x67')))};break;default:throw new db['Sequelize'][(_0xeb62('0x68'))](_0xeb62('0x69'));}return rp(_0x10986a);}})[_0xeb62('0x27')](function(_0x489410){if(_0x489410){var _0x1dcd96=['subject',_0xeb62('0x6a'),_0xeb62('0x6b'),_0xeb62('0x6c')];_['remove'](_0x489410[_0xeb62('0x61')],function(_0x3ad496){return _0x1dcd96[_0xeb62('0x6d')](_0x3ad496[_0xeb62('0x30')]);});return{'count':_0x489410[_0xeb62('0x61')][_0xeb62('0x44')],'rows':_['map'](_0x489410['ticket_fields'],function(_0x4c7a56){return{'id':_0x4c7a56['id'],'name':_0x4c7a56['position']>0x7?_0x4c7a56['title']:_0x4c7a56[_0xeb62('0x30')],'custom':_0x4c7a56[_0xeb62('0x6e')]>0x7?!![]:![],'options':_0x4c7a56[_0xeb62('0x6f')]?_0x4c7a56[_0xeb62('0x6f')]:_0x4c7a56[_0xeb62('0x70')]?_0x4c7a56[_0xeb62('0x70')]:[]};})};}})[_0xeb62('0x27')](respondWithResult(_0x351acf,null))[_0xeb62('0x41')](function(_0xb28adb){var _0x2c6bb3=_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?0x1f4:_0xb28adb['statusCode']||0x1f4;logger[_0xeb62('0x29')](_0xeb62('0x72'),_0xeb62('0x56'),_0x2c6bb3,JSON[_0xeb62('0x73')](_0xb28adb));delete _0xb28adb[_0xeb62('0x2b')];if(_0x2c6bb3===0x191){_0x2c6bb3=0x190;}_0x351acf[_0xeb62('0x1c')](_0x2c6bb3)[_0xeb62('0x2c')](_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?{'message':_0xeb62('0x74'),'statusCode':_0xb28adb[_0xeb62('0x75')]}:_0xb28adb);});}; \ No newline at end of file +var _0xe605=['password','token','authType','remoteUri','slice','GET','format','headers','Basic\x20%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','ZendeskAccount','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username'];(function(_0x32b30c,_0x4c5567){var _0x59bc79=function(_0x5ef43d){while(--_0x5ef43d){_0x32b30c['push'](_0x32b30c['shift']());}};_0x59bc79(++_0x4c5567);}(_0xe605,0x92));var _0x5e60=function(_0x1d6d59,_0x4aa77d){_0x1d6d59=_0x1d6d59-0x0;var _0x358617=_0xe605[_0x1d6d59];return _0x358617;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5e60('0x19'));function respondWithStatusCode(_0x178782,_0x1f4e14){_0x1f4e14=_0x1f4e14||0xcc;return function(_0xe039de){if(_0xe039de){return _0x178782[_0x5e60('0x1a')](_0x1f4e14);}return _0x178782[_0x5e60('0x1b')](_0x1f4e14)['end']();};}function respondWithResult(_0x209adb,_0x45304f){_0x45304f=_0x45304f||0xc8;return function(_0x21e3c8){if(_0x21e3c8){return _0x209adb[_0x5e60('0x1b')](_0x45304f)['json'](_0x21e3c8);}};}function respondWithFilteredResult(_0x20af5f,_0x529ffe){return function(_0x1ffd77){if(_0x1ffd77){var _0x3bc7d8=typeof _0x529ffe['offset']===_0x5e60('0x1c')&&typeof _0x529ffe[_0x5e60('0x1d')]===_0x5e60('0x1c');var _0x43045a=_0x1ffd77['count'];var _0xdd0a71=_0x3bc7d8?0x0:_0x529ffe[_0x5e60('0x1e')];var _0x52cc15=_0x3bc7d8?_0x1ffd77[_0x5e60('0x1f')]:_0x529ffe[_0x5e60('0x1e')]+_0x529ffe[_0x5e60('0x1d')];var _0x311fef;if(_0x52cc15>=_0x43045a){_0x52cc15=_0x43045a;_0x311fef=0xc8;}else{_0x311fef=0xce;}_0x20af5f[_0x5e60('0x1b')](_0x311fef);return _0x20af5f[_0x5e60('0x20')](_0x5e60('0x21'),_0xdd0a71+'-'+_0x52cc15+'/'+_0x43045a)[_0x5e60('0x22')](_0x1ffd77);}return null;};}function patchUpdates(_0x3282e4){return function(_0x45f1a6){try{jsonpatch[_0x5e60('0x23')](_0x45f1a6,_0x3282e4,!![]);}catch(_0x578437){return BPromise[_0x5e60('0x24')](_0x578437);}return _0x45f1a6['save']();};}function saveUpdates(_0x376069,_0x1a44e5){return function(_0x2b0bae){if(_0x2b0bae){return _0x2b0bae[_0x5e60('0x25')](_0x376069)[_0x5e60('0x26')](function(_0x2a499e){return _0x2a499e;});}return null;};}function removeEntity(_0x2636f1,_0x5d2c03){return function(_0x18d527){if(_0x18d527){return _0x18d527[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){_0x2636f1['status'](0xcc)[_0x5e60('0x28')]();});}};}function handleEntityNotFound(_0x56e3a5,_0x2d8aac){return function(_0x153459){if(!_0x153459){_0x56e3a5['sendStatus'](0x194);}return _0x153459;};}function handleError(_0x3bedea,_0x5712f7){_0x5712f7=_0x5712f7||0x1f4;return function(_0x23d187){logger[_0x5e60('0x29')](_0x23d187['stack']);if(_0x23d187[_0x5e60('0x2a')]){delete _0x23d187[_0x5e60('0x2a')];}_0x3bedea['status'](_0x5712f7)[_0x5e60('0x2b')](_0x23d187);};}exports[_0x5e60('0x2c')]=function(_0x52c97c,_0x5431a8){var _0x52f668={},_0xf25956={},_0x235cc7={'count':0x0,'rows':[]};var _0x2e8e9e=_[_0x5e60('0x2d')](db[_0x5e60('0x2e')]['rawAttributes'],function(_0x168ce6){return{'name':_0x168ce6[_0x5e60('0x2f')],'type':_0x168ce6['type'][_0x5e60('0x30')]};});_0xf25956['model']=_['map'](_0x2e8e9e,_0x5e60('0x2a'));_0xf25956[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x52c97c[_0x5e60('0x31')]);_0xf25956[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0xf25956[_0x5e60('0x35')],_0xf25956[_0x5e60('0x31')]);_0x52f668[_0x5e60('0x36')]=_[_0x5e60('0x34')](_0xf25956['model'],qs[_0x5e60('0x37')](_0x52c97c['query']['fields']));_0x52f668[_0x5e60('0x36')]=_0x52f668[_0x5e60('0x36')]['length']?_0x52f668[_0x5e60('0x36')]:_0xf25956['model'];if(!_0x52c97c[_0x5e60('0x31')][_0x5e60('0x38')](_0x5e60('0x39'))){_0x52f668[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x1d')]);_0x52f668[_0x5e60('0x1e')]=qs['offset'](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x1e')]);}_0x52f668[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x3b')]);_0x52f668[_0x5e60('0x3c')]=qs['filters'](_[_0x5e60('0x3d')](_0x52c97c[_0x5e60('0x31')],_0xf25956['filters']),_0x2e8e9e);if(_0x52c97c['query'][_0x5e60('0x3e')]){_0x52f668[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x52f668[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2d')](_0x2e8e9e,function(_0x4d2cd0){if(_0x4d2cd0[_0x5e60('0x40')]!==_0x5e60('0x41')){var _0x415208={};_0x415208[_0x4d2cd0[_0x5e60('0x2a')]]={'$like':'%'+_0x52c97c[_0x5e60('0x31')][_0x5e60('0x3e')]+'%'};return _0x415208;}})});}_0x52f668=_[_0x5e60('0x3f')]({},_0x52f668,_0x52c97c['options']);var _0x401bf1={'where':_0x52f668[_0x5e60('0x3c')]};return db['ZendeskAccount']['count'](_0x401bf1)['then'](function(_0x15a97b){_0x235cc7[_0x5e60('0x1f')]=_0x15a97b;if(_0x52c97c[_0x5e60('0x31')][_0x5e60('0x42')]){_0x52f668['include']=[{'all':!![]}];}return db[_0x5e60('0x2e')][_0x5e60('0x43')](_0x52f668);})['then'](function(_0x5bda22){_0x235cc7[_0x5e60('0x44')]=_0x5bda22;return _0x235cc7;})[_0x5e60('0x26')](respondWithFilteredResult(_0x5431a8,_0x52f668))[_0x5e60('0x45')](handleError(_0x5431a8,null));};exports[_0x5e60('0x46')]=function(_0x39ab09,_0x3899ae){var _0x2522d2={'raw':![],'where':{'id':_0x39ab09[_0x5e60('0x47')]['id']}},_0x2812e1={};_0x2812e1['model']=_[_0x5e60('0x32')](db[_0x5e60('0x2e')]['rawAttributes']);_0x2812e1[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x39ab09[_0x5e60('0x31')]);_0x2812e1[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2812e1['model'],_0x2812e1[_0x5e60('0x31')]);_0x2522d2[_0x5e60('0x36')]=_[_0x5e60('0x34')](_0x2812e1[_0x5e60('0x35')],qs['fields'](_0x39ab09['query']['fields']));_0x2522d2[_0x5e60('0x36')]=_0x2522d2[_0x5e60('0x36')][_0x5e60('0x48')]?_0x2522d2[_0x5e60('0x36')]:_0x2812e1[_0x5e60('0x35')];if(_0x39ab09[_0x5e60('0x31')]['includeAll']){_0x2522d2[_0x5e60('0x49')]=[{'all':!![]}];}_0x2522d2=_[_0x5e60('0x3f')]({},_0x2522d2,_0x39ab09[_0x5e60('0x4a')]);return db[_0x5e60('0x2e')][_0x5e60('0x4b')](_0x2522d2)[_0x5e60('0x26')](handleEntityNotFound(_0x3899ae,null))[_0x5e60('0x26')](respondWithResult(_0x3899ae,null))['catch'](handleError(_0x3899ae,null));};exports[_0x5e60('0x4c')]=function(_0x3ed45d,_0x21a116){return db[_0x5e60('0x2e')][_0x5e60('0x4c')](_0x3ed45d[_0x5e60('0x4d')],{})[_0x5e60('0x26')](respondWithResult(_0x21a116,0xc9))[_0x5e60('0x45')](handleError(_0x21a116,null));};exports[_0x5e60('0x25')]=function(_0x350d6d,_0xe5e675){if(_0x350d6d[_0x5e60('0x4d')]['id']){delete _0x350d6d[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2e')][_0x5e60('0x4b')]({'where':{'id':_0x350d6d[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0xe5e675,null))[_0x5e60('0x26')](saveUpdates(_0x350d6d['body'],null))['then'](respondWithResult(_0xe5e675,null))[_0x5e60('0x45')](handleError(_0xe5e675,null));};exports['destroy']=function(_0x3525d,_0x1d247e){return db[_0x5e60('0x2e')][_0x5e60('0x4b')]({'where':{'id':_0x3525d[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x1d247e,null))['then'](removeEntity(_0x1d247e,null))['catch'](handleError(_0x1d247e,null));};exports[_0x5e60('0x4e')]=function(_0x1e4e41,_0x457c37,_0x4a2d67){var _0x594068={};var _0x31ced8={};var _0x46f3ba;var _0x179cc6;return db['ZendeskAccount'][_0x5e60('0x4f')]({'where':{'id':_0x1e4e41[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x457c37,null))[_0x5e60('0x26')](function(_0x17d002){if(_0x17d002){_0x46f3ba=_0x17d002;_0x31ced8[_0x5e60('0x35')]=_['keys'](db[_0x5e60('0x50')][_0x5e60('0x51')]);_0x31ced8['query']=_[_0x5e60('0x32')](_0x1e4e41[_0x5e60('0x31')]);_0x31ced8[_0x5e60('0x33')]=_['intersection'](_0x31ced8[_0x5e60('0x35')],_0x31ced8[_0x5e60('0x31')]);_0x594068['attributes']=_[_0x5e60('0x34')](_0x31ced8[_0x5e60('0x35')],qs[_0x5e60('0x37')](_0x1e4e41[_0x5e60('0x31')]['fields']));_0x594068[_0x5e60('0x36')]=_0x594068[_0x5e60('0x36')]['length']?_0x594068[_0x5e60('0x36')]:_0x31ced8['model'];_0x594068[_0x5e60('0x3a')]=qs['sort'](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x3b')]);_0x594068['where']=qs[_0x5e60('0x33')](_['pick'](_0x1e4e41[_0x5e60('0x31')],_0x31ced8['filters']));if(_0x1e4e41[_0x5e60('0x31')]['filter']){_0x594068[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x594068[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2d')](_0x594068[_0x5e60('0x36')],function(_0x2b8343){var _0x3d1e35={};_0x3d1e35[_0x2b8343]={'$like':'%'+_0x1e4e41['query'][_0x5e60('0x3e')]+'%'};return _0x3d1e35;})});}_0x594068=_[_0x5e60('0x3f')]({},_0x594068,_0x1e4e41[_0x5e60('0x4a')]);return _0x46f3ba[_0x5e60('0x4e')](_0x594068);}})[_0x5e60('0x26')](function(_0x35aad7){if(_0x35aad7){_0x179cc6=_0x35aad7['length'];if(!_0x1e4e41['query']['hasOwnProperty'](_0x5e60('0x39'))){_0x594068[_0x5e60('0x1d')]=qs['limit'](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x1d')]);_0x594068['offset']=qs[_0x5e60('0x1e')](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x1e')]);}return _0x46f3ba[_0x5e60('0x4e')](_0x594068);}})[_0x5e60('0x26')](function(_0xcd2232){if(_0xcd2232){return _0xcd2232?{'count':_0x179cc6,'rows':_0xcd2232}:null;}})[_0x5e60('0x26')](respondWithResult(_0x457c37,null))[_0x5e60('0x45')](handleError(_0x457c37,null));};exports[_0x5e60('0x52')]=function(_0x406c3a,_0x157aad,_0x15921d){if(_0x406c3a[_0x5e60('0x4d')]['id']){delete _0x406c3a[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2e')][_0x5e60('0x4f')]({'where':{'id':_0x406c3a[_0x5e60('0x47')]['id']}})['then'](handleEntityNotFound(_0x157aad,null))[_0x5e60('0x26')](function(_0x1706d6){if(_0x1706d6){_0x406c3a[_0x5e60('0x4d')]['AccountId']=_0x1706d6['id'];_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x53')]=integrations['getSubjects'](_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x54')],_0x406c3a['body'][_0x5e60('0x40')]);_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x55')]=integrations[_0x5e60('0x56')](_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x54')],_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x40')]);return db[_0x5e60('0x50')]['create'](_0x406c3a[_0x5e60('0x4d')],{'include':[{'model':db[_0x5e60('0x57')],'as':_0x5e60('0x53')},{'model':db['ZendeskField'],'as':_0x5e60('0x55')}]});}return null;})[_0x5e60('0x26')](respondWithResult(_0x157aad,null))[_0x5e60('0x45')](handleError(_0x157aad,null));};exports[_0x5e60('0x58')]=function(_0x3e85fe,_0x559f8c,_0x4560e1){var _0x213c7e='';return db[_0x5e60('0x2e')]['findOne']({'where':{'id':_0x3e85fe['params']['id']},'attributes':['id',_0x5e60('0x59'),_0x5e60('0x5a'),_0x5e60('0x5b'),_0x5e60('0x5c'),_0x5e60('0x5d')]})[_0x5e60('0x26')](handleEntityNotFound(_0x559f8c,null))[_0x5e60('0x26')](function(_0x563e69){if(_0x563e69){_0x213c7e=_0x563e69[_0x5e60('0x5d')];var _0x199edd=_0x213c7e[_0x5e60('0x5e')](-0x1);if(_0x199edd==='/'){_0x213c7e=_0x213c7e['substring'](0x0,_0x213c7e['lastIndexOf'](_0x199edd));}var _0x447bd3={'method':_0x5e60('0x5f'),'uri':util[_0x5e60('0x60')]('%s/%s',_0x213c7e,'ticket_fields'),'json':!![]};switch(_0x563e69[_0x5e60('0x5c')]){case _0x5e60('0x5a'):_0x447bd3[_0x5e60('0x61')]={'Authorization':util[_0x5e60('0x60')](_0x5e60('0x62'),new Buffer(util[_0x5e60('0x60')]('%s:%s',_0x563e69[_0x5e60('0x59')],_0x563e69[_0x5e60('0x5a')]))[_0x5e60('0x63')](_0x5e60('0x64')))};break;case _0x5e60('0x5b'):_0x447bd3[_0x5e60('0x61')]={'Authorization':util[_0x5e60('0x60')](_0x5e60('0x62'),new Buffer(util[_0x5e60('0x60')]('%s/token:%s',_0x563e69[_0x5e60('0x59')],_0x563e69[_0x5e60('0x5b')]))['toString'](_0x5e60('0x64')))};break;default:throw new db[(_0x5e60('0x65'))]['ValidationError'](_0x5e60('0x66'));}return rp(_0x447bd3);}})[_0x5e60('0x26')](function(_0x391505){if(_0x391505){var _0x1b4aee=[_0x5e60('0x67'),_0x5e60('0x68'),'group',_0x5e60('0x69')];_[_0x5e60('0x6a')](_0x391505[_0x5e60('0x6b')],function(_0x222d94){return _0x1b4aee[_0x5e60('0x6c')](_0x222d94[_0x5e60('0x40')]);});return{'count':_0x391505[_0x5e60('0x6b')][_0x5e60('0x48')],'rows':_[_0x5e60('0x2d')](_0x391505['ticket_fields'],function(_0x10b77b){return{'id':_0x10b77b['id'],'name':_0x10b77b[_0x5e60('0x6d')]>0x7?_0x10b77b[_0x5e60('0x6e')]:_0x10b77b[_0x5e60('0x40')],'custom':_0x10b77b[_0x5e60('0x6d')]>0x7?!![]:![],'options':_0x10b77b[_0x5e60('0x6f')]?_0x10b77b[_0x5e60('0x6f')]:_0x10b77b[_0x5e60('0x70')]?_0x10b77b[_0x5e60('0x70')]:[]};})};}})[_0x5e60('0x26')](respondWithResult(_0x559f8c,null))['catch'](function(_0x5ab78f){var _0x5d2839=_0x3e85fe[_0x5e60('0x31')][_0x5e60('0x71')]?0x1f4:_0x5ab78f[_0x5e60('0x72')]||0x1f4;logger[_0x5e60('0x29')](_0x5e60('0x73'),_0x5e60('0x58'),_0x5d2839,JSON[_0x5e60('0x74')](_0x5ab78f));delete _0x5ab78f[_0x5e60('0x2a')];if(_0x5d2839===0x191){_0x5d2839=0x190;}_0x559f8c[_0x5e60('0x1b')](_0x5d2839)['send'](_0x3e85fe[_0x5e60('0x31')][_0x5e60('0x71')]?{'message':_0x5e60('0x75'),'statusCode':_0x5ab78f['statusCode']}:_0x5ab78f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 171e118..3b95f7b 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.model.js +++ b/server/api/intZendeskAccount/intZendeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0162=['ZendeskAccount','int_zendesk_accounts','lodash','util','api','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2a5c46,_0x3dd3cd){var _0x25dc89=function(_0xd73b2b){while(--_0xd73b2b){_0x2a5c46['push'](_0x2a5c46['shift']());}};_0x25dc89(++_0x3dd3cd);}(_0x0162,0x13a));var _0x2016=function(_0x5b7c62,_0x25327d){_0x5b7c62=_0x5b7c62-0x0;var _0x5292fc=_0x0162[_0x5b7c62];return _0x5292fc;};'use strict';var _=require(_0x2016('0x0'));var util=require(_0x2016('0x1'));var logger=require('../../config/logger')(_0x2016('0x2'));var moment=require('moment');var BPromise=require(_0x2016('0x3'));var rp=require(_0x2016('0x4'));var fs=require('fs');var path=require(_0x2016('0x5'));var rimraf=require('rimraf');var config=require(_0x2016('0x6'));var attributes=require(_0x2016('0x7'));var integrations=require(_0x2016('0x8'));module[_0x2016('0x9')]=function(_0x179d81,_0x127f4d){return _0x179d81['define'](_0x2016('0xa'),attributes,{'tableName':_0x2016('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2059=['../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2059,0x1be));var _0x9205=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x2059[_0x2f6f50];return _0x2cf365;};'use strict';var _=require(_0x9205('0x0'));var util=require(_0x9205('0x1'));var logger=require(_0x9205('0x2'))(_0x9205('0x3'));var moment=require('moment');var BPromise=require(_0x9205('0x4'));var rp=require(_0x9205('0x5'));var fs=require('fs');var path=require(_0x9205('0x6'));var rimraf=require('rimraf');var config=require(_0x9205('0x7'));var attributes=require(_0x9205('0x8'));var integrations=require(_0x9205('0x9'));module[_0x9205('0xa')]=function(_0x5e4914,_0x159c3d){return _0x5e4914[_0x9205('0xb')]('ZendeskAccount',attributes,{'tableName':_0x9205('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 242f4d2..b96fcde 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb64=['attributes','map','model','include','ZendeskAccount','find','raw','ShowZendeskAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetZendeskAccount','findAll','options','where'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xfb64,0x17b));var _0x4fb6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfb64[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x4fb6('0x0'));var util=require(_0x4fb6('0x1'));var moment=require(_0x4fb6('0x2'));var BPromise=require(_0x4fb6('0x3'));var rs=require(_0x4fb6('0x4'));var fs=require('fs');var Redis=require(_0x4fb6('0x5'));var db=require(_0x4fb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fb6('0x7'))(_0x4fb6('0x8'));var config=require(_0x4fb6('0x9'));var jayson=require(_0x4fb6('0xa'));var client=jayson[_0x4fb6('0xb')][_0x4fb6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b7453,_0x12b028,_0x21eff1){return new BPromise(function(_0x41b765,_0x72d841){return client[_0x4fb6('0xd')](_0x3b7453,_0x21eff1)[_0x4fb6('0xe')](function(_0x3ca701){logger[_0x4fb6('0xf')](_0x4fb6('0x10'),_0x12b028,_0x4fb6('0x11'));logger[_0x4fb6('0x12')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x12b028,_0x4fb6('0x11'),JSON[_0x4fb6('0x13')](_0x3ca701));if(_0x3ca701[_0x4fb6('0x14')]){if(_0x3ca701[_0x4fb6('0x14')][_0x4fb6('0x15')]===0x1f4){logger['error'](_0x4fb6('0x10'),_0x12b028,_0x3ca701[_0x4fb6('0x14')][_0x4fb6('0x16')]);return _0x72d841(_0x3ca701['error']['message']);}logger['error'](_0x4fb6('0x10'),_0x12b028,_0x3ca701[_0x4fb6('0x14')][_0x4fb6('0x16')]);return _0x41b765(_0x3ca701['error'][_0x4fb6('0x16')]);}else{logger[_0x4fb6('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x12b028,_0x4fb6('0x11'));_0x41b765(_0x3ca701[_0x4fb6('0x17')][_0x4fb6('0x16')]);}})['catch'](function(_0x3db82c){logger[_0x4fb6('0x14')](_0x4fb6('0x10'),_0x12b028,_0x3db82c);_0x72d841(_0x3db82c);});});}exports[_0x4fb6('0x18')]=function(_0x220738){var _0x29b3bd=this;return new Promise(function(_0x17a602,_0x4d85e3){return db['ZendeskAccount'][_0x4fb6('0x19')]({'raw':_0x220738['options']?_0x220738[_0x4fb6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x220738[_0x4fb6('0x1a')]?_0x220738[_0x4fb6('0x1a')][_0x4fb6('0x1b')]||null:null,'attributes':_0x220738[_0x4fb6('0x1a')]?_0x220738[_0x4fb6('0x1a')][_0x4fb6('0x1c')]||null:null,'limit':_0x220738['options']?_0x220738[_0x4fb6('0x1a')]['limit']||null:null,'include':_0x220738['options']?_0x220738[_0x4fb6('0x1a')]['include']?_[_0x4fb6('0x1d')](_0x220738[_0x4fb6('0x1a')]['include'],function(_0x39f0ff){return{'model':db[_0x39f0ff['model']],'as':_0x39f0ff['as'],'attributes':_0x39f0ff[_0x4fb6('0x1c')],'include':_0x39f0ff['include']?_[_0x4fb6('0x1d')](_0x39f0ff['include'],function(_0x35c2ae){return{'model':db[_0x35c2ae[_0x4fb6('0x1e')]],'as':_0x35c2ae['as'],'attributes':_0x35c2ae[_0x4fb6('0x1c')],'include':_0x35c2ae[_0x4fb6('0x1f')]?_[_0x4fb6('0x1d')](_0x35c2ae[_0x4fb6('0x1f')],function(_0x28273b){return{'model':db[_0x28273b[_0x4fb6('0x1e')]],'as':_0x28273b['as'],'attributes':_0x28273b[_0x4fb6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4fb6('0xe')](function(_0x3934af){logger[_0x4fb6('0xf')]('GetZendeskAccount',_0x220738);logger[_0x4fb6('0x12')](_0x4fb6('0x18'),_0x220738,JSON['stringify'](_0x3934af));_0x17a602(_0x3934af);})['catch'](function(_0x4821ca){logger[_0x4fb6('0x14')]('GetZendeskAccount',_0x4821ca[_0x4fb6('0x16')],_0x220738);_0x4d85e3(_0x29b3bd[_0x4fb6('0x14')](0x1f4,_0x4821ca[_0x4fb6('0x16')]));});});};exports['ShowZendeskAccount']=function(_0x53d36e){var _0x4819ec=this;return new Promise(function(_0x3ce857,_0x1e9566){return db[_0x4fb6('0x20')][_0x4fb6('0x21')]({'raw':_0x53d36e[_0x4fb6('0x1a')]?_0x53d36e[_0x4fb6('0x1a')][_0x4fb6('0x22')]===undefined?!![]:![]:!![],'where':_0x53d36e['options']?_0x53d36e[_0x4fb6('0x1a')][_0x4fb6('0x1b')]||null:null,'attributes':_0x53d36e['options']?_0x53d36e[_0x4fb6('0x1a')][_0x4fb6('0x1c')]||null:null,'include':_0x53d36e[_0x4fb6('0x1a')]?_0x53d36e[_0x4fb6('0x1a')][_0x4fb6('0x1f')]?_[_0x4fb6('0x1d')](_0x53d36e[_0x4fb6('0x1a')]['include'],function(_0x18fcd5){return{'model':db[_0x18fcd5[_0x4fb6('0x1e')]],'as':_0x18fcd5['as'],'attributes':_0x18fcd5[_0x4fb6('0x1c')],'include':_0x18fcd5[_0x4fb6('0x1f')]?_[_0x4fb6('0x1d')](_0x18fcd5[_0x4fb6('0x1f')],function(_0x335286){return{'model':db[_0x335286[_0x4fb6('0x1e')]],'as':_0x335286['as'],'attributes':_0x335286[_0x4fb6('0x1c')],'include':_0x335286[_0x4fb6('0x1f')]?_['map'](_0x335286['include'],function(_0x3e7d86){return{'model':db[_0x3e7d86[_0x4fb6('0x1e')]],'as':_0x3e7d86['as'],'attributes':_0x3e7d86['attributes']};}):[]};}):[]};}):[]:[]})[_0x4fb6('0xe')](function(_0x1d0e3d){logger['info'](_0x4fb6('0x23'),_0x53d36e);logger[_0x4fb6('0x12')](_0x4fb6('0x23'),_0x53d36e,JSON[_0x4fb6('0x13')](_0x1d0e3d));_0x3ce857(_0x1d0e3d);})[_0x4fb6('0x24')](function(_0x5c3caf){logger[_0x4fb6('0x14')](_0x4fb6('0x23'),_0x5c3caf[_0x4fb6('0x16')],_0x53d36e);_0x1e9566(_0x4819ec['error'](0x1f4,_0x5c3caf[_0x4fb6('0x16')]));});});}; \ No newline at end of file +var _0x8cc1=['error','message','info','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','find','ShowZendeskAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x26033c,_0x4d224e){var _0x369213=function(_0x3face8){while(--_0x3face8){_0x26033c['push'](_0x26033c['shift']());}};_0x369213(++_0x4d224e);}(_0x8cc1,0x14e));var _0x18cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x18cc('0x0'));var moment=require('moment');var BPromise=require(_0x18cc('0x1'));var rs=require(_0x18cc('0x2'));var fs=require('fs');var Redis=require(_0x18cc('0x3'));var db=require(_0x18cc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x18cc('0x5'))('rpc');var config=require(_0x18cc('0x6'));var jayson=require(_0x18cc('0x7'));var client=jayson[_0x18cc('0x8')][_0x18cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a0ca,_0x569265,_0x97fdde){return new BPromise(function(_0x379c7f,_0xf1edea){return client[_0x18cc('0xa')](_0x32a0ca,_0x97fdde)[_0x18cc('0xb')](function(_0x4749b1){logger['info'](_0x18cc('0xc'),_0x569265,_0x18cc('0xd'));logger[_0x18cc('0xe')](_0x18cc('0xf'),_0x569265,'request\x20sent',JSON['stringify'](_0x4749b1));if(_0x4749b1[_0x18cc('0x10')]){if(_0x4749b1['error']['code']===0x1f4){logger[_0x18cc('0x10')](_0x18cc('0xc'),_0x569265,_0x4749b1[_0x18cc('0x10')]['message']);return _0xf1edea(_0x4749b1[_0x18cc('0x10')][_0x18cc('0x11')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x569265,_0x4749b1[_0x18cc('0x10')]['message']);return _0x379c7f(_0x4749b1[_0x18cc('0x10')]['message']);}else{logger[_0x18cc('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x569265,_0x18cc('0xd'));_0x379c7f(_0x4749b1[_0x18cc('0x13')][_0x18cc('0x11')]);}})['catch'](function(_0x1f7ec8){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x569265,_0x1f7ec8);_0xf1edea(_0x1f7ec8);});});}exports[_0x18cc('0x14')]=function(_0x104fc4){var _0x20a5ac=this;return new Promise(function(_0x19884a,_0x591a24){return db[_0x18cc('0x15')][_0x18cc('0x16')]({'raw':_0x104fc4[_0x18cc('0x17')]?_0x104fc4[_0x18cc('0x17')][_0x18cc('0x18')]===undefined?!![]:![]:!![],'where':_0x104fc4[_0x18cc('0x17')]?_0x104fc4[_0x18cc('0x17')][_0x18cc('0x19')]||null:null,'attributes':_0x104fc4[_0x18cc('0x17')]?_0x104fc4[_0x18cc('0x17')][_0x18cc('0x1a')]||null:null,'limit':_0x104fc4[_0x18cc('0x17')]?_0x104fc4[_0x18cc('0x17')][_0x18cc('0x1b')]||null:null,'include':_0x104fc4[_0x18cc('0x17')]?_0x104fc4[_0x18cc('0x17')][_0x18cc('0x1c')]?_[_0x18cc('0x1d')](_0x104fc4[_0x18cc('0x17')]['include'],function(_0x4b2358){return{'model':db[_0x4b2358[_0x18cc('0x1e')]],'as':_0x4b2358['as'],'attributes':_0x4b2358['attributes'],'include':_0x4b2358['include']?_[_0x18cc('0x1d')](_0x4b2358[_0x18cc('0x1c')],function(_0x8ebbf4){return{'model':db[_0x8ebbf4[_0x18cc('0x1e')]],'as':_0x8ebbf4['as'],'attributes':_0x8ebbf4[_0x18cc('0x1a')],'include':_0x8ebbf4[_0x18cc('0x1c')]?_[_0x18cc('0x1d')](_0x8ebbf4[_0x18cc('0x1c')],function(_0x217793){return{'model':db[_0x217793['model']],'as':_0x217793['as'],'attributes':_0x217793['attributes']};}):[]};}):[]};}):[]:[]})[_0x18cc('0xb')](function(_0x25c68e){logger[_0x18cc('0x12')]('GetZendeskAccount',_0x104fc4);logger[_0x18cc('0xe')]('GetZendeskAccount',_0x104fc4,JSON[_0x18cc('0x1f')](_0x25c68e));_0x19884a(_0x25c68e);})[_0x18cc('0x20')](function(_0x3f1a24){logger[_0x18cc('0x10')](_0x18cc('0x14'),_0x3f1a24[_0x18cc('0x11')],_0x104fc4);_0x591a24(_0x20a5ac[_0x18cc('0x10')](0x1f4,_0x3f1a24[_0x18cc('0x11')]));});});};exports['ShowZendeskAccount']=function(_0x29119d){var _0x399d07=this;return new Promise(function(_0x5bb35e,_0xd98c63){return db[_0x18cc('0x15')][_0x18cc('0x21')]({'raw':_0x29119d[_0x18cc('0x17')]?_0x29119d[_0x18cc('0x17')][_0x18cc('0x18')]===undefined?!![]:![]:!![],'where':_0x29119d[_0x18cc('0x17')]?_0x29119d['options']['where']||null:null,'attributes':_0x29119d[_0x18cc('0x17')]?_0x29119d[_0x18cc('0x17')]['attributes']||null:null,'include':_0x29119d['options']?_0x29119d[_0x18cc('0x17')][_0x18cc('0x1c')]?_[_0x18cc('0x1d')](_0x29119d[_0x18cc('0x17')][_0x18cc('0x1c')],function(_0x42206c){return{'model':db[_0x42206c['model']],'as':_0x42206c['as'],'attributes':_0x42206c[_0x18cc('0x1a')],'include':_0x42206c[_0x18cc('0x1c')]?_[_0x18cc('0x1d')](_0x42206c[_0x18cc('0x1c')],function(_0x13557a){return{'model':db[_0x13557a['model']],'as':_0x13557a['as'],'attributes':_0x13557a[_0x18cc('0x1a')],'include':_0x13557a[_0x18cc('0x1c')]?_[_0x18cc('0x1d')](_0x13557a[_0x18cc('0x1c')],function(_0x1c45db){return{'model':db[_0x1c45db[_0x18cc('0x1e')]],'as':_0x1c45db['as'],'attributes':_0x1c45db[_0x18cc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ae09e){logger[_0x18cc('0x12')]('ShowZendeskAccount',_0x29119d);logger[_0x18cc('0xe')](_0x18cc('0x22'),_0x29119d,JSON[_0x18cc('0x1f')](_0x3ae09e));_0x5bb35e(_0x3ae09e);})[_0x18cc('0x20')](function(_0xe2ab32){logger['error'](_0x18cc('0x22'),_0xe2ab32[_0x18cc('0x11')],_0x29119d);_0xd98c63(_0x399d07[_0x18cc('0x10')](0x1f4,_0xe2ab32['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 1bbaba9..6d257d0 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b5=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4f8942,_0x586651){var _0x6310b9=function(_0x2d429d){while(--_0x2d429d){_0x4f8942['push'](_0x4f8942['shift']());}};_0x6310b9(++_0x586651);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xe5b5[_0x1646fa];return _0x5a47a5;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/subjects',auth[_0x5e5b('0xc')](),controller['getSubjects']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller['setTags']);router[_0x5e5b('0x18')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x19')]);router['delete']('/:id',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x1a')]);module[_0x5e5b('0x1b')]=router; \ No newline at end of file +var _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x28bddc,_0x1883e5){var _0x547ba5=function(_0x4fbffb){while(--_0x4fbffb){_0x28bddc['push'](_0x28bddc['shift']());}};_0x547ba5(++_0x1883e5);}(_0x4fc2,0x111));var _0x24fc=function(_0x875527,_0x2234fb){_0x875527=_0x875527-0x0;var _0x23c22c=_0x4fc2[_0x875527];return _0x23c22c;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6628bfc..8f7e855 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0aa=['sequelize','exports'];(function(_0x2b8d9e,_0x38f52a){var _0x380e14=function(_0xfc9680){while(--_0xfc9680){_0x2b8d9e['push'](_0x2b8d9e['shift']());}};_0x380e14(++_0x38f52a);}(_0xe0aa,0xa2));var _0xae0a=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xe0aa[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require(_0xae0a('0x0'));module[_0xae0a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4a2d=['sequelize','STRING'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x4a2d,0x19e));var _0xd4a2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4a2d[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xd4a2('0x0'));module['exports']={'name':{'type':Sequelize[_0xd4a2('0x1')]},'description':{'type':Sequelize[_0xd4a2('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index de2db89..58f22f9 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41b7=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41b7,0x143));var _0x741b=function(_0x209511,_0x231622){_0x209511=_0x209511-0x0;var _0x39b937=_0x41b7[_0x209511];return _0x39b937;};'use strict';var emlformat=require(_0x741b('0x0'));var rimraf=require(_0x741b('0x1'));var zipdir=require(_0x741b('0x2'));var jsonpatch=require(_0x741b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x741b('0x4'));var Mustache=require(_0x741b('0x5'));var util=require('util');var path=require(_0x741b('0x6'));var sox=require(_0x741b('0x7'));var csv=require(_0x741b('0x8'));var ejs=require(_0x741b('0x9'));var fs=require('fs');var fs_extra=require(_0x741b('0xa'));var _=require(_0x741b('0xb'));var squel=require(_0x741b('0xc'));var crypto=require('crypto');var jsforce=require(_0x741b('0xd'));var deskjs=require(_0x741b('0xe'));var toCsv=require(_0x741b('0x8'));var querystring=require('querystring');var Papa=require(_0x741b('0xf'));var Redis=require(_0x741b('0x10'));var authService=require(_0x741b('0x11'));var qs=require(_0x741b('0x12'));var as=require(_0x741b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x741b('0x14'))(_0x741b('0x15'));var utils=require(_0x741b('0x16'));var config=require(_0x741b('0x17'));var licenseUtil=require(_0x741b('0x18'));var db=require(_0x741b('0x19'))['db'];function respondWithStatusCode(_0x380074,_0x1d2af2){_0x1d2af2=_0x1d2af2||0xcc;return function(_0x1d7392){if(_0x1d7392){return _0x380074[_0x741b('0x1a')](_0x1d2af2);}return _0x380074[_0x741b('0x1b')](_0x1d2af2)[_0x741b('0x1c')]();};}function respondWithResult(_0x430005,_0x3f8f26){_0x3f8f26=_0x3f8f26||0xc8;return function(_0x497ce1){if(_0x497ce1){return _0x430005[_0x741b('0x1b')](_0x3f8f26)['json'](_0x497ce1);}};}function respondWithFilteredResult(_0x40eb42,_0x22beec){return function(_0x12f2dd){if(_0x12f2dd){var _0xb938d=typeof _0x22beec[_0x741b('0x1d')]===_0x741b('0x1e')&&typeof _0x22beec['limit']===_0x741b('0x1e');var _0x324ee3=_0x12f2dd[_0x741b('0x1f')];var _0x9bb25f=_0xb938d?0x0:_0x22beec[_0x741b('0x1d')];var _0x48dc8c=_0xb938d?_0x12f2dd[_0x741b('0x1f')]:_0x22beec['offset']+_0x22beec[_0x741b('0x20')];var _0x4ce707;if(_0x48dc8c>=_0x324ee3){_0x48dc8c=_0x324ee3;_0x4ce707=0xc8;}else{_0x4ce707=0xce;}_0x40eb42['status'](_0x4ce707);return _0x40eb42['set'](_0x741b('0x21'),_0x9bb25f+'-'+_0x48dc8c+'/'+_0x324ee3)[_0x741b('0x22')](_0x12f2dd);}return null;};}function patchUpdates(_0x4dc352){return function(_0x4c7102){try{jsonpatch[_0x741b('0x23')](_0x4c7102,_0x4dc352,!![]);}catch(_0x34752b){return BPromise[_0x741b('0x24')](_0x34752b);}return _0x4c7102[_0x741b('0x25')]();};}function saveUpdates(_0x327682,_0x2f1c50){return function(_0x28a246){if(_0x28a246){return _0x28a246[_0x741b('0x26')](_0x327682)[_0x741b('0x27')](function(_0x613f4b){return _0x613f4b;});}return null;};}function removeEntity(_0x5a2802,_0x114d0f){return function(_0x433c9e){if(_0x433c9e){return _0x433c9e[_0x741b('0x28')]()[_0x741b('0x27')](function(){_0x5a2802[_0x741b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c605,_0x5f1da7){return function(_0x368cac){if(!_0x368cac){_0x58c605[_0x741b('0x1a')](0x194);}return _0x368cac;};}function handleError(_0x37ae1a,_0x2c4916){_0x2c4916=_0x2c4916||0x1f4;return function(_0x4ecd3a){logger['error'](_0x4ecd3a['stack']);if(_0x4ecd3a[_0x741b('0x29')]){delete _0x4ecd3a['name'];}_0x37ae1a[_0x741b('0x1b')](_0x2c4916)[_0x741b('0x2a')](_0x4ecd3a);};}exports[_0x741b('0x2b')]=function(_0x4e3c01,_0x1dbde9){var _0x2eb6e8={},_0x3895fe={},_0x3e3eb5={'count':0x0,'rows':[]};var _0x3fb82d=_[_0x741b('0x2c')](db[_0x741b('0x2d')][_0x741b('0x2e')],function(_0x37844a){return{'name':_0x37844a[_0x741b('0x2f')],'type':_0x37844a[_0x741b('0x30')]['key']};});_0x3895fe[_0x741b('0x31')]=_[_0x741b('0x2c')](_0x3fb82d,_0x741b('0x29'));_0x3895fe[_0x741b('0x32')]=_[_0x741b('0x33')](_0x4e3c01['query']);_0x3895fe[_0x741b('0x34')]=_[_0x741b('0x35')](_0x3895fe['model'],_0x3895fe[_0x741b('0x32')]);_0x2eb6e8[_0x741b('0x36')]=_[_0x741b('0x35')](_0x3895fe[_0x741b('0x31')],qs['fields'](_0x4e3c01[_0x741b('0x32')][_0x741b('0x37')]));_0x2eb6e8[_0x741b('0x36')]=_0x2eb6e8['attributes'][_0x741b('0x38')]?_0x2eb6e8[_0x741b('0x36')]:_0x3895fe['model'];if(!_0x4e3c01[_0x741b('0x32')][_0x741b('0x39')](_0x741b('0x3a'))){_0x2eb6e8['limit']=qs[_0x741b('0x20')](_0x4e3c01[_0x741b('0x32')][_0x741b('0x20')]);_0x2eb6e8[_0x741b('0x1d')]=qs[_0x741b('0x1d')](_0x4e3c01[_0x741b('0x32')]['offset']);}_0x2eb6e8[_0x741b('0x3b')]=qs[_0x741b('0x3c')](_0x4e3c01['query'][_0x741b('0x3c')]);_0x2eb6e8[_0x741b('0x3d')]=qs[_0x741b('0x34')](_[_0x741b('0x3e')](_0x4e3c01[_0x741b('0x32')],_0x3895fe[_0x741b('0x34')]),_0x3fb82d);if(_0x4e3c01['query']['filter']){_0x2eb6e8[_0x741b('0x3d')]=_[_0x741b('0x3f')](_0x2eb6e8[_0x741b('0x3d')],{'$or':_['map'](_0x3fb82d,function(_0x48cc9f){if(_0x48cc9f[_0x741b('0x30')]!==_0x741b('0x40')){var _0x154576={};_0x154576[_0x48cc9f['name']]={'$like':'%'+_0x4e3c01[_0x741b('0x32')][_0x741b('0x41')]+'%'};return _0x154576;}})});}_0x2eb6e8=_[_0x741b('0x3f')]({},_0x2eb6e8,_0x4e3c01[_0x741b('0x42')]);var _0x4aee3f={'where':_0x2eb6e8[_0x741b('0x3d')]};return db['ZendeskConfiguration']['count'](_0x4aee3f)['then'](function(_0x1b7b09){_0x3e3eb5['count']=_0x1b7b09;if(_0x4e3c01[_0x741b('0x32')][_0x741b('0x43')]){_0x2eb6e8[_0x741b('0x44')]=[{'all':!![]}];}return db[_0x741b('0x2d')][_0x741b('0x45')](_0x2eb6e8);})['then'](function(_0x7ffa19){_0x3e3eb5['rows']=_0x7ffa19;return _0x3e3eb5;})[_0x741b('0x27')](respondWithFilteredResult(_0x1dbde9,_0x2eb6e8))[_0x741b('0x46')](handleError(_0x1dbde9,null));};exports['show']=function(_0x3f5cfb,_0x2ed801){var _0x452393={'raw':![],'where':{'id':_0x3f5cfb[_0x741b('0x47')]['id']}},_0x36a238={};_0x36a238['model']=_[_0x741b('0x33')](db[_0x741b('0x2d')]['rawAttributes']);_0x36a238[_0x741b('0x32')]=_['keys'](_0x3f5cfb[_0x741b('0x32')]);_0x36a238[_0x741b('0x34')]=_['intersection'](_0x36a238[_0x741b('0x31')],_0x36a238[_0x741b('0x32')]);_0x452393[_0x741b('0x36')]=_[_0x741b('0x35')](_0x36a238[_0x741b('0x31')],qs[_0x741b('0x37')](_0x3f5cfb['query'][_0x741b('0x37')]));_0x452393[_0x741b('0x36')]=_0x452393[_0x741b('0x36')][_0x741b('0x38')]?_0x452393[_0x741b('0x36')]:_0x36a238['model'];if(_0x3f5cfb[_0x741b('0x32')][_0x741b('0x43')]){_0x452393[_0x741b('0x44')]=[{'all':!![]}];}_0x452393=_[_0x741b('0x3f')]({},_0x452393,_0x3f5cfb['options']);return db[_0x741b('0x2d')][_0x741b('0x48')](_0x452393)[_0x741b('0x27')](handleEntityNotFound(_0x2ed801,null))[_0x741b('0x27')](respondWithResult(_0x2ed801,null))[_0x741b('0x46')](handleError(_0x2ed801,null));};exports['create']=function(_0x4fec61,_0x118c04){return db['ZendeskConfiguration'][_0x741b('0x49')](_0x4fec61[_0x741b('0x4a')],{})[_0x741b('0x27')](respondWithResult(_0x118c04,0xc9))[_0x741b('0x46')](handleError(_0x118c04,null));};exports['update']=function(_0x372217,_0x49831a){if(_0x372217[_0x741b('0x4a')]['id']){delete _0x372217[_0x741b('0x4a')]['id'];}return db[_0x741b('0x2d')][_0x741b('0x48')]({'where':{'id':_0x372217[_0x741b('0x47')]['id']}})[_0x741b('0x27')](handleEntityNotFound(_0x49831a,null))[_0x741b('0x27')](saveUpdates(_0x372217['body'],null))[_0x741b('0x27')](respondWithResult(_0x49831a,null))['catch'](handleError(_0x49831a,null));};exports[_0x741b('0x28')]=function(_0x34fe5c,_0x15f024){return db['ZendeskConfiguration'][_0x741b('0x48')]({'where':{'id':_0x34fe5c[_0x741b('0x47')]['id']}})['then'](handleEntityNotFound(_0x15f024,null))[_0x741b('0x27')](removeEntity(_0x15f024,null))[_0x741b('0x46')](handleError(_0x15f024,null));};exports[_0x741b('0x4b')]=function(_0x5c6c2e,_0x5589cb,_0x33fc3c){var _0x34bddd={};var _0xc66015={};var _0x5496d7;var _0x4ccf83;return db[_0x741b('0x2d')][_0x741b('0x4c')]({'where':{'id':_0x5c6c2e[_0x741b('0x47')]['id']}})[_0x741b('0x27')](handleEntityNotFound(_0x5589cb,null))[_0x741b('0x27')](function(_0x419c20){if(_0x419c20){_0x5496d7=_0x419c20;_0xc66015[_0x741b('0x31')]=_[_0x741b('0x33')](db['ZendeskField']['rawAttributes']);_0xc66015[_0x741b('0x32')]=_[_0x741b('0x33')](_0x5c6c2e[_0x741b('0x32')]);_0xc66015['filters']=_[_0x741b('0x35')](_0xc66015[_0x741b('0x31')],_0xc66015[_0x741b('0x32')]);_0x34bddd[_0x741b('0x36')]=_[_0x741b('0x35')](_0xc66015['model'],qs[_0x741b('0x37')](_0x5c6c2e['query']['fields']));_0x34bddd['attributes']=_0x34bddd['attributes']['length']?_0x34bddd[_0x741b('0x36')]:_0xc66015[_0x741b('0x31')];_0x34bddd['order']=qs[_0x741b('0x3c')](_0x5c6c2e[_0x741b('0x32')][_0x741b('0x3c')]);_0x34bddd[_0x741b('0x3d')]=qs[_0x741b('0x34')](_[_0x741b('0x3e')](_0x5c6c2e[_0x741b('0x32')],_0xc66015[_0x741b('0x34')]));if(_0x5c6c2e['query']['filter']){_0x34bddd[_0x741b('0x3d')]=_[_0x741b('0x3f')](_0x34bddd[_0x741b('0x3d')],{'$or':_[_0x741b('0x2c')](_0x34bddd[_0x741b('0x36')],function(_0x36f1ec){var _0x302c2e={};_0x302c2e[_0x36f1ec]={'$like':'%'+_0x5c6c2e[_0x741b('0x32')][_0x741b('0x41')]+'%'};return _0x302c2e;})});}_0x34bddd=_[_0x741b('0x3f')]({},_0x34bddd,_0x5c6c2e[_0x741b('0x42')]);return _0x5496d7['getFields'](_0x34bddd);}})[_0x741b('0x27')](function(_0x1260d9){if(_0x1260d9){_0x4ccf83=_0x1260d9[_0x741b('0x38')];if(!_0x5c6c2e[_0x741b('0x32')][_0x741b('0x39')](_0x741b('0x3a'))){_0x34bddd['limit']=qs['limit'](_0x5c6c2e[_0x741b('0x32')][_0x741b('0x20')]);_0x34bddd[_0x741b('0x1d')]=qs['offset'](_0x5c6c2e['query'][_0x741b('0x1d')]);}return _0x5496d7[_0x741b('0x4b')](_0x34bddd);}})[_0x741b('0x27')](function(_0x1c841c){if(_0x1c841c){return _0x1c841c?{'count':_0x4ccf83,'rows':_0x1c841c}:null;}})[_0x741b('0x27')](respondWithResult(_0x5589cb,null))[_0x741b('0x46')](handleError(_0x5589cb,null));};exports['getSubjects']=function(_0x1df768,_0x36eb17,_0x37b895){var _0x499fe4={};var _0x393b3a={};var _0x13404a;var _0x291389;return db[_0x741b('0x2d')][_0x741b('0x4c')]({'where':{'id':_0x1df768['params']['id']}})[_0x741b('0x27')](handleEntityNotFound(_0x36eb17,null))[_0x741b('0x27')](function(_0x580ce8){if(_0x580ce8){_0x13404a=_0x580ce8;_0x393b3a[_0x741b('0x31')]=_[_0x741b('0x33')](db[_0x741b('0x4d')][_0x741b('0x2e')]);_0x393b3a[_0x741b('0x32')]=_[_0x741b('0x33')](_0x1df768[_0x741b('0x32')]);_0x393b3a['filters']=_[_0x741b('0x35')](_0x393b3a[_0x741b('0x31')],_0x393b3a[_0x741b('0x32')]);_0x499fe4[_0x741b('0x36')]=_[_0x741b('0x35')](_0x393b3a[_0x741b('0x31')],qs[_0x741b('0x37')](_0x1df768[_0x741b('0x32')][_0x741b('0x37')]));_0x499fe4['attributes']=_0x499fe4['attributes'][_0x741b('0x38')]?_0x499fe4[_0x741b('0x36')]:_0x393b3a[_0x741b('0x31')];_0x499fe4['order']=qs[_0x741b('0x3c')](_0x1df768[_0x741b('0x32')]['sort']);_0x499fe4['where']=qs[_0x741b('0x34')](_[_0x741b('0x3e')](_0x1df768['query'],_0x393b3a[_0x741b('0x34')]));if(_0x1df768[_0x741b('0x32')][_0x741b('0x41')]){_0x499fe4[_0x741b('0x3d')]=_[_0x741b('0x3f')](_0x499fe4[_0x741b('0x3d')],{'$or':_[_0x741b('0x2c')](_0x499fe4[_0x741b('0x36')],function(_0x1da164){var _0x1f132f={};_0x1f132f[_0x1da164]={'$like':'%'+_0x1df768['query'][_0x741b('0x41')]+'%'};return _0x1f132f;})});}_0x499fe4=_[_0x741b('0x3f')]({},_0x499fe4,_0x1df768['options']);return _0x13404a['getSubjects'](_0x499fe4);}})[_0x741b('0x27')](function(_0x308c77){if(_0x308c77){_0x291389=_0x308c77[_0x741b('0x38')];if(!_0x1df768['query'][_0x741b('0x39')](_0x741b('0x3a'))){_0x499fe4['limit']=qs[_0x741b('0x20')](_0x1df768[_0x741b('0x32')][_0x741b('0x20')]);_0x499fe4['offset']=qs[_0x741b('0x1d')](_0x1df768[_0x741b('0x32')]['offset']);}return _0x13404a[_0x741b('0x4e')](_0x499fe4);}})[_0x741b('0x27')](function(_0x531434){if(_0x531434){return _0x531434?{'count':_0x291389,'rows':_0x531434}:null;}})['then'](respondWithResult(_0x36eb17,null))[_0x741b('0x46')](handleError(_0x36eb17,null));};exports['getDescriptions']=function(_0x23dcbc,_0x24f299,_0x17c3ce){var _0x50e86f={};var _0x47787c={};var _0x2d1e04;var _0x3d6db6;return db['ZendeskConfiguration'][_0x741b('0x4c')]({'where':{'id':_0x23dcbc[_0x741b('0x47')]['id']}})[_0x741b('0x27')](handleEntityNotFound(_0x24f299,null))['then'](function(_0x2008cf){if(_0x2008cf){_0x2d1e04=_0x2008cf;_0x47787c[_0x741b('0x31')]=_[_0x741b('0x33')](db[_0x741b('0x4d')][_0x741b('0x2e')]);_0x47787c[_0x741b('0x32')]=_['keys'](_0x23dcbc['query']);_0x47787c[_0x741b('0x34')]=_[_0x741b('0x35')](_0x47787c[_0x741b('0x31')],_0x47787c[_0x741b('0x32')]);_0x50e86f[_0x741b('0x36')]=_[_0x741b('0x35')](_0x47787c[_0x741b('0x31')],qs[_0x741b('0x37')](_0x23dcbc['query'][_0x741b('0x37')]));_0x50e86f['attributes']=_0x50e86f[_0x741b('0x36')]['length']?_0x50e86f[_0x741b('0x36')]:_0x47787c[_0x741b('0x31')];_0x50e86f[_0x741b('0x3b')]=qs['sort'](_0x23dcbc['query'][_0x741b('0x3c')]);_0x50e86f['where']=qs[_0x741b('0x34')](_[_0x741b('0x3e')](_0x23dcbc[_0x741b('0x32')],_0x47787c[_0x741b('0x34')]));if(_0x23dcbc[_0x741b('0x32')][_0x741b('0x41')]){_0x50e86f[_0x741b('0x3d')]=_[_0x741b('0x3f')](_0x50e86f[_0x741b('0x3d')],{'$or':_[_0x741b('0x2c')](_0x50e86f[_0x741b('0x36')],function(_0x467e26){var _0x4f5426={};_0x4f5426[_0x467e26]={'$like':'%'+_0x23dcbc['query'][_0x741b('0x41')]+'%'};return _0x4f5426;})});}_0x50e86f=_[_0x741b('0x3f')]({},_0x50e86f,_0x23dcbc[_0x741b('0x42')]);return _0x2d1e04[_0x741b('0x4f')](_0x50e86f);}})['then'](function(_0x46de3c){if(_0x46de3c){_0x3d6db6=_0x46de3c['length'];if(!_0x23dcbc[_0x741b('0x32')][_0x741b('0x39')](_0x741b('0x3a'))){_0x50e86f['limit']=qs['limit'](_0x23dcbc['query'][_0x741b('0x20')]);_0x50e86f[_0x741b('0x1d')]=qs[_0x741b('0x1d')](_0x23dcbc[_0x741b('0x32')][_0x741b('0x1d')]);}return _0x2d1e04[_0x741b('0x4f')](_0x50e86f);}})[_0x741b('0x27')](function(_0x22dfce){if(_0x22dfce){return _0x22dfce?{'count':_0x3d6db6,'rows':_0x22dfce}:null;}})[_0x741b('0x27')](respondWithResult(_0x24f299,null))[_0x741b('0x46')](handleError(_0x24f299,null));};exports[_0x741b('0x50')]=function(_0x41653c,_0xb8b27,_0x3ca5c2){var _0x2e5bb5={};var _0x531feb={};var _0x4c9b01;var _0x2796b6;return db[_0x741b('0x2d')]['findOne']({'where':{'id':_0x41653c[_0x741b('0x47')]['id']}})[_0x741b('0x27')](handleEntityNotFound(_0xb8b27,null))[_0x741b('0x27')](function(_0x16cc95){if(_0x16cc95){_0x4c9b01=_0x16cc95;_0x531feb[_0x741b('0x31')]=_[_0x741b('0x33')](db[_0x741b('0x51')][_0x741b('0x2e')]);_0x531feb[_0x741b('0x32')]=_[_0x741b('0x33')](_0x41653c[_0x741b('0x32')]);_0x531feb[_0x741b('0x34')]=_[_0x741b('0x35')](_0x531feb[_0x741b('0x31')],_0x531feb['query']);_0x2e5bb5[_0x741b('0x36')]=_[_0x741b('0x35')](_0x531feb[_0x741b('0x31')],qs['fields'](_0x41653c[_0x741b('0x32')]['fields']));_0x2e5bb5['attributes']=_0x2e5bb5[_0x741b('0x36')][_0x741b('0x38')]?_0x2e5bb5[_0x741b('0x36')]:_0x531feb[_0x741b('0x31')];_0x2e5bb5['order']=qs['sort'](_0x41653c[_0x741b('0x32')][_0x741b('0x3c')]);_0x2e5bb5[_0x741b('0x3d')]=qs['filters'](_['pick'](_0x41653c[_0x741b('0x32')],_0x531feb[_0x741b('0x34')]));if(_0x41653c['query']['filter']){_0x2e5bb5['where']=_[_0x741b('0x3f')](_0x2e5bb5[_0x741b('0x3d')],{'$or':_[_0x741b('0x2c')](_0x2e5bb5['attributes'],function(_0x5ddaa7){var _0x110d84={};_0x110d84[_0x5ddaa7]={'$like':'%'+_0x41653c[_0x741b('0x32')][_0x741b('0x41')]+'%'};return _0x110d84;})});}_0x2e5bb5=_[_0x741b('0x3f')]({},_0x2e5bb5,_0x41653c[_0x741b('0x42')]);return _0x4c9b01[_0x741b('0x50')](_0x2e5bb5);}})[_0x741b('0x27')](function(_0x4ed258){if(_0x4ed258){_0x2796b6=_0x4ed258[_0x741b('0x38')];if(!_0x41653c['query'][_0x741b('0x39')](_0x741b('0x3a'))){_0x2e5bb5[_0x741b('0x20')]=qs[_0x741b('0x20')](_0x41653c[_0x741b('0x32')][_0x741b('0x20')]);_0x2e5bb5['offset']=qs[_0x741b('0x1d')](_0x41653c[_0x741b('0x32')]['offset']);}return _0x4c9b01[_0x741b('0x50')](_0x2e5bb5);}})['then'](function(_0x4df1da){if(_0x4df1da){return _0x4df1da?{'count':_0x2796b6,'rows':_0x4df1da}:null;}})['then'](respondWithResult(_0xb8b27,null))[_0x741b('0x46')](handleError(_0xb8b27,null));};exports[_0x741b('0x52')]=function(_0x357575,_0x42d856,_0x46b75c){if(_0x357575['body']['id']){delete _0x357575[_0x741b('0x4a')]['id'];}return db[_0x741b('0x2d')][_0x741b('0x4c')]({'where':{'id':_0x357575[_0x741b('0x47')]['id']}})[_0x741b('0x27')](handleEntityNotFound(_0x42d856,null))['then'](function(_0x52470d){if(_0x52470d){return _0x52470d[_0x741b('0x52')](_0x357575[_0x741b('0x4a')][_0x741b('0x53')]||[]);}return null;})['then'](respondWithResult(_0x42d856,null))[_0x741b('0x46')](handleError(_0x42d856,null));}; \ No newline at end of file +var _0x62c6=['getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','key','model','keys','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','getFields','ZendeskField'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x62c6,0x14e));var _0x662c=function(_0x270cce,_0x4e5f7f){_0x270cce=_0x270cce-0x0;var _0x19375b=_0x62c6[_0x270cce];return _0x19375b;};'use strict';var emlformat=require(_0x662c('0x0'));var rimraf=require(_0x662c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x662c('0x2'));var rp=require(_0x662c('0x3'));var moment=require('moment');var BPromise=require(_0x662c('0x4'));var Mustache=require('mustache');var util=require(_0x662c('0x5'));var path=require(_0x662c('0x6'));var sox=require(_0x662c('0x7'));var csv=require(_0x662c('0x8'));var ejs=require(_0x662c('0x9'));var fs=require('fs');var fs_extra=require(_0x662c('0xa'));var _=require(_0x662c('0xb'));var squel=require(_0x662c('0xc'));var crypto=require(_0x662c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x662c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x662c('0xe'));var authService=require(_0x662c('0xf'));var qs=require(_0x662c('0x10'));var as=require(_0x662c('0x11'));var hardwareService=require(_0x662c('0x12'));var logger=require(_0x662c('0x13'))(_0x662c('0x14'));var utils=require(_0x662c('0x15'));var config=require(_0x662c('0x16'));var licenseUtil=require(_0x662c('0x17'));var db=require(_0x662c('0x18'))['db'];function respondWithStatusCode(_0x2fce67,_0x1d2cfe){_0x1d2cfe=_0x1d2cfe||0xcc;return function(_0x5b57b1){if(_0x5b57b1){return _0x2fce67[_0x662c('0x19')](_0x1d2cfe);}return _0x2fce67[_0x662c('0x1a')](_0x1d2cfe)['end']();};}function respondWithResult(_0x247581,_0x54313c){_0x54313c=_0x54313c||0xc8;return function(_0xcd3d76){if(_0xcd3d76){return _0x247581[_0x662c('0x1a')](_0x54313c)['json'](_0xcd3d76);}};}function respondWithFilteredResult(_0x5931e9,_0x173529){return function(_0x128041){if(_0x128041){var _0x27d06e=typeof _0x173529[_0x662c('0x1b')]===_0x662c('0x1c')&&typeof _0x173529[_0x662c('0x1d')]===_0x662c('0x1c');var _0x40e4d1=_0x128041[_0x662c('0x1e')];var _0x149c28=_0x27d06e?0x0:_0x173529[_0x662c('0x1b')];var _0x6770f2=_0x27d06e?_0x128041[_0x662c('0x1e')]:_0x173529['offset']+_0x173529[_0x662c('0x1d')];var _0x59758d;if(_0x6770f2>=_0x40e4d1){_0x6770f2=_0x40e4d1;_0x59758d=0xc8;}else{_0x59758d=0xce;}_0x5931e9[_0x662c('0x1a')](_0x59758d);return _0x5931e9[_0x662c('0x1f')]('Content-Range',_0x149c28+'-'+_0x6770f2+'/'+_0x40e4d1)['json'](_0x128041);}return null;};}function patchUpdates(_0x21b1b5){return function(_0x123265){try{jsonpatch['apply'](_0x123265,_0x21b1b5,!![]);}catch(_0x2821e2){return BPromise[_0x662c('0x20')](_0x2821e2);}return _0x123265[_0x662c('0x21')]();};}function saveUpdates(_0xdcc124,_0x564372){return function(_0xb97b0e){if(_0xb97b0e){return _0xb97b0e[_0x662c('0x22')](_0xdcc124)[_0x662c('0x23')](function(_0x285d7c){return _0x285d7c;});}return null;};}function removeEntity(_0x4eb287,_0x276b3f){return function(_0x4f80a2){if(_0x4f80a2){return _0x4f80a2[_0x662c('0x24')]()[_0x662c('0x23')](function(){_0x4eb287[_0x662c('0x1a')](0xcc)[_0x662c('0x25')]();});}};}function handleEntityNotFound(_0x4bc571,_0x59bee0){return function(_0x53d445){if(!_0x53d445){_0x4bc571['sendStatus'](0x194);}return _0x53d445;};}function handleError(_0x52e8bb,_0x56f471){_0x56f471=_0x56f471||0x1f4;return function(_0x2dc8eb){logger['error'](_0x2dc8eb[_0x662c('0x26')]);if(_0x2dc8eb[_0x662c('0x27')]){delete _0x2dc8eb['name'];}_0x52e8bb[_0x662c('0x1a')](_0x56f471)[_0x662c('0x28')](_0x2dc8eb);};}exports[_0x662c('0x29')]=function(_0x141e2d,_0x45b7a8){var _0x6bc7e0={},_0x527c52={},_0x2988d1={'count':0x0,'rows':[]};var _0x4f1268=_[_0x662c('0x2a')](db[_0x662c('0x2b')][_0x662c('0x2c')],function(_0x124c68){return{'name':_0x124c68['fieldName'],'type':_0x124c68['type'][_0x662c('0x2d')]};});_0x527c52[_0x662c('0x2e')]=_[_0x662c('0x2a')](_0x4f1268,_0x662c('0x27'));_0x527c52['query']=_[_0x662c('0x2f')](_0x141e2d['query']);_0x527c52['filters']=_[_0x662c('0x30')](_0x527c52['model'],_0x527c52['query']);_0x6bc7e0[_0x662c('0x31')]=_[_0x662c('0x30')](_0x527c52[_0x662c('0x2e')],qs[_0x662c('0x32')](_0x141e2d[_0x662c('0x33')]['fields']));_0x6bc7e0[_0x662c('0x31')]=_0x6bc7e0[_0x662c('0x31')]['length']?_0x6bc7e0[_0x662c('0x31')]:_0x527c52[_0x662c('0x2e')];if(!_0x141e2d[_0x662c('0x33')][_0x662c('0x34')](_0x662c('0x35'))){_0x6bc7e0[_0x662c('0x1d')]=qs['limit'](_0x141e2d[_0x662c('0x33')][_0x662c('0x1d')]);_0x6bc7e0[_0x662c('0x1b')]=qs[_0x662c('0x1b')](_0x141e2d[_0x662c('0x33')][_0x662c('0x1b')]);}_0x6bc7e0[_0x662c('0x36')]=qs['sort'](_0x141e2d[_0x662c('0x33')][_0x662c('0x37')]);_0x6bc7e0[_0x662c('0x38')]=qs[_0x662c('0x39')](_[_0x662c('0x3a')](_0x141e2d[_0x662c('0x33')],_0x527c52['filters']),_0x4f1268);if(_0x141e2d[_0x662c('0x33')][_0x662c('0x3b')]){_0x6bc7e0['where']=_[_0x662c('0x3c')](_0x6bc7e0[_0x662c('0x38')],{'$or':_['map'](_0x4f1268,function(_0x4e2fd4){if(_0x4e2fd4[_0x662c('0x3d')]!==_0x662c('0x3e')){var _0x470d75={};_0x470d75[_0x4e2fd4[_0x662c('0x27')]]={'$like':'%'+_0x141e2d[_0x662c('0x33')][_0x662c('0x3b')]+'%'};return _0x470d75;}})});}_0x6bc7e0=_[_0x662c('0x3c')]({},_0x6bc7e0,_0x141e2d[_0x662c('0x3f')]);var _0x383564={'where':_0x6bc7e0['where']};return db[_0x662c('0x2b')][_0x662c('0x1e')](_0x383564)['then'](function(_0x42f626){_0x2988d1[_0x662c('0x1e')]=_0x42f626;if(_0x141e2d[_0x662c('0x33')][_0x662c('0x40')]){_0x6bc7e0['include']=[{'all':!![]}];}return db[_0x662c('0x2b')]['findAll'](_0x6bc7e0);})['then'](function(_0x93b474){_0x2988d1[_0x662c('0x41')]=_0x93b474;return _0x2988d1;})[_0x662c('0x23')](respondWithFilteredResult(_0x45b7a8,_0x6bc7e0))[_0x662c('0x42')](handleError(_0x45b7a8,null));};exports[_0x662c('0x43')]=function(_0x3e1f4f,_0x134de8){var _0x5b535f={'raw':![],'where':{'id':_0x3e1f4f[_0x662c('0x44')]['id']}},_0x1711ef={};_0x1711ef['model']=_[_0x662c('0x2f')](db['ZendeskConfiguration'][_0x662c('0x2c')]);_0x1711ef[_0x662c('0x33')]=_[_0x662c('0x2f')](_0x3e1f4f['query']);_0x1711ef[_0x662c('0x39')]=_['intersection'](_0x1711ef['model'],_0x1711ef[_0x662c('0x33')]);_0x5b535f[_0x662c('0x31')]=_[_0x662c('0x30')](_0x1711ef['model'],qs[_0x662c('0x32')](_0x3e1f4f[_0x662c('0x33')]['fields']));_0x5b535f[_0x662c('0x31')]=_0x5b535f[_0x662c('0x31')][_0x662c('0x45')]?_0x5b535f[_0x662c('0x31')]:_0x1711ef[_0x662c('0x2e')];if(_0x3e1f4f['query'][_0x662c('0x40')]){_0x5b535f[_0x662c('0x46')]=[{'all':!![]}];}_0x5b535f=_['merge']({},_0x5b535f,_0x3e1f4f[_0x662c('0x3f')]);return db['ZendeskConfiguration'][_0x662c('0x47')](_0x5b535f)[_0x662c('0x23')](handleEntityNotFound(_0x134de8,null))['then'](respondWithResult(_0x134de8,null))['catch'](handleError(_0x134de8,null));};exports[_0x662c('0x48')]=function(_0x305569,_0x3596dd){return db[_0x662c('0x2b')][_0x662c('0x48')](_0x305569['body'],{})['then'](respondWithResult(_0x3596dd,0xc9))[_0x662c('0x42')](handleError(_0x3596dd,null));};exports['update']=function(_0x35fbdb,_0x4690a2){if(_0x35fbdb['body']['id']){delete _0x35fbdb[_0x662c('0x49')]['id'];}return db[_0x662c('0x2b')]['find']({'where':{'id':_0x35fbdb[_0x662c('0x44')]['id']}})[_0x662c('0x23')](handleEntityNotFound(_0x4690a2,null))['then'](saveUpdates(_0x35fbdb[_0x662c('0x49')],null))[_0x662c('0x23')](respondWithResult(_0x4690a2,null))[_0x662c('0x42')](handleError(_0x4690a2,null));};exports[_0x662c('0x24')]=function(_0x116e85,_0x566628){return db[_0x662c('0x2b')][_0x662c('0x47')]({'where':{'id':_0x116e85[_0x662c('0x44')]['id']}})[_0x662c('0x23')](handleEntityNotFound(_0x566628,null))[_0x662c('0x23')](removeEntity(_0x566628,null))[_0x662c('0x42')](handleError(_0x566628,null));};exports[_0x662c('0x4a')]=function(_0x5d6b3e,_0x5cb5f0,_0x3f881e){var _0x27464f={};var _0x2370ee={};var _0x5a4246;var _0x202705;return db[_0x662c('0x2b')]['findOne']({'where':{'id':_0x5d6b3e[_0x662c('0x44')]['id']}})['then'](handleEntityNotFound(_0x5cb5f0,null))[_0x662c('0x23')](function(_0x8b368e){if(_0x8b368e){_0x5a4246=_0x8b368e;_0x2370ee['model']=_['keys'](db[_0x662c('0x4b')][_0x662c('0x2c')]);_0x2370ee['query']=_[_0x662c('0x2f')](_0x5d6b3e['query']);_0x2370ee[_0x662c('0x39')]=_[_0x662c('0x30')](_0x2370ee[_0x662c('0x2e')],_0x2370ee[_0x662c('0x33')]);_0x27464f[_0x662c('0x31')]=_['intersection'](_0x2370ee[_0x662c('0x2e')],qs[_0x662c('0x32')](_0x5d6b3e['query'][_0x662c('0x32')]));_0x27464f[_0x662c('0x31')]=_0x27464f[_0x662c('0x31')]['length']?_0x27464f[_0x662c('0x31')]:_0x2370ee[_0x662c('0x2e')];_0x27464f[_0x662c('0x36')]=qs[_0x662c('0x37')](_0x5d6b3e[_0x662c('0x33')][_0x662c('0x37')]);_0x27464f[_0x662c('0x38')]=qs[_0x662c('0x39')](_[_0x662c('0x3a')](_0x5d6b3e[_0x662c('0x33')],_0x2370ee[_0x662c('0x39')]));if(_0x5d6b3e[_0x662c('0x33')][_0x662c('0x3b')]){_0x27464f['where']=_[_0x662c('0x3c')](_0x27464f[_0x662c('0x38')],{'$or':_[_0x662c('0x2a')](_0x27464f[_0x662c('0x31')],function(_0x5c1701){var _0x42d591={};_0x42d591[_0x5c1701]={'$like':'%'+_0x5d6b3e[_0x662c('0x33')][_0x662c('0x3b')]+'%'};return _0x42d591;})});}_0x27464f=_[_0x662c('0x3c')]({},_0x27464f,_0x5d6b3e[_0x662c('0x3f')]);return _0x5a4246['getFields'](_0x27464f);}})[_0x662c('0x23')](function(_0x552703){if(_0x552703){_0x202705=_0x552703['length'];if(!_0x5d6b3e[_0x662c('0x33')]['hasOwnProperty'](_0x662c('0x35'))){_0x27464f['limit']=qs[_0x662c('0x1d')](_0x5d6b3e[_0x662c('0x33')][_0x662c('0x1d')]);_0x27464f['offset']=qs[_0x662c('0x1b')](_0x5d6b3e['query'][_0x662c('0x1b')]);}return _0x5a4246[_0x662c('0x4a')](_0x27464f);}})['then'](function(_0x3c3e28){if(_0x3c3e28){return _0x3c3e28?{'count':_0x202705,'rows':_0x3c3e28}:null;}})[_0x662c('0x23')](respondWithResult(_0x5cb5f0,null))['catch'](handleError(_0x5cb5f0,null));};exports[_0x662c('0x4c')]=function(_0xd6b18f,_0x19968d,_0xabbf31){var _0x39d3db={};var _0x540d22={};var _0x5cb0e8;var _0xb973d4;return db[_0x662c('0x2b')][_0x662c('0x4d')]({'where':{'id':_0xd6b18f['params']['id']}})[_0x662c('0x23')](handleEntityNotFound(_0x19968d,null))[_0x662c('0x23')](function(_0x4ba7dc){if(_0x4ba7dc){_0x5cb0e8=_0x4ba7dc;_0x540d22[_0x662c('0x2e')]=_[_0x662c('0x2f')](db['ZendeskField'][_0x662c('0x2c')]);_0x540d22[_0x662c('0x33')]=_[_0x662c('0x2f')](_0xd6b18f['query']);_0x540d22['filters']=_[_0x662c('0x30')](_0x540d22[_0x662c('0x2e')],_0x540d22[_0x662c('0x33')]);_0x39d3db[_0x662c('0x31')]=_[_0x662c('0x30')](_0x540d22[_0x662c('0x2e')],qs[_0x662c('0x32')](_0xd6b18f['query'][_0x662c('0x32')]));_0x39d3db[_0x662c('0x31')]=_0x39d3db['attributes']['length']?_0x39d3db[_0x662c('0x31')]:_0x540d22['model'];_0x39d3db[_0x662c('0x36')]=qs[_0x662c('0x37')](_0xd6b18f[_0x662c('0x33')][_0x662c('0x37')]);_0x39d3db[_0x662c('0x38')]=qs[_0x662c('0x39')](_[_0x662c('0x3a')](_0xd6b18f[_0x662c('0x33')],_0x540d22[_0x662c('0x39')]));if(_0xd6b18f['query'][_0x662c('0x3b')]){_0x39d3db['where']=_[_0x662c('0x3c')](_0x39d3db[_0x662c('0x38')],{'$or':_[_0x662c('0x2a')](_0x39d3db[_0x662c('0x31')],function(_0x5ab83d){var _0x3d8ad1={};_0x3d8ad1[_0x5ab83d]={'$like':'%'+_0xd6b18f[_0x662c('0x33')]['filter']+'%'};return _0x3d8ad1;})});}_0x39d3db=_['merge']({},_0x39d3db,_0xd6b18f[_0x662c('0x3f')]);return _0x5cb0e8[_0x662c('0x4c')](_0x39d3db);}})[_0x662c('0x23')](function(_0x5cb727){if(_0x5cb727){_0xb973d4=_0x5cb727['length'];if(!_0xd6b18f[_0x662c('0x33')][_0x662c('0x34')](_0x662c('0x35'))){_0x39d3db['limit']=qs[_0x662c('0x1d')](_0xd6b18f[_0x662c('0x33')][_0x662c('0x1d')]);_0x39d3db[_0x662c('0x1b')]=qs[_0x662c('0x1b')](_0xd6b18f[_0x662c('0x33')]['offset']);}return _0x5cb0e8['getSubjects'](_0x39d3db);}})['then'](function(_0x1badab){if(_0x1badab){return _0x1badab?{'count':_0xb973d4,'rows':_0x1badab}:null;}})[_0x662c('0x23')](respondWithResult(_0x19968d,null))[_0x662c('0x42')](handleError(_0x19968d,null));};exports[_0x662c('0x4e')]=function(_0x46f6cc,_0x4ee373,_0x1cc4e2){var _0x2bb4d9={};var _0x5ba991={};var _0x531612;var _0xf72df0;return db[_0x662c('0x2b')][_0x662c('0x4d')]({'where':{'id':_0x46f6cc[_0x662c('0x44')]['id']}})[_0x662c('0x23')](handleEntityNotFound(_0x4ee373,null))[_0x662c('0x23')](function(_0xbbbf90){if(_0xbbbf90){_0x531612=_0xbbbf90;_0x5ba991[_0x662c('0x2e')]=_[_0x662c('0x2f')](db[_0x662c('0x4b')]['rawAttributes']);_0x5ba991[_0x662c('0x33')]=_[_0x662c('0x2f')](_0x46f6cc['query']);_0x5ba991[_0x662c('0x39')]=_[_0x662c('0x30')](_0x5ba991[_0x662c('0x2e')],_0x5ba991['query']);_0x2bb4d9[_0x662c('0x31')]=_['intersection'](_0x5ba991['model'],qs[_0x662c('0x32')](_0x46f6cc['query'][_0x662c('0x32')]));_0x2bb4d9[_0x662c('0x31')]=_0x2bb4d9['attributes'][_0x662c('0x45')]?_0x2bb4d9[_0x662c('0x31')]:_0x5ba991['model'];_0x2bb4d9[_0x662c('0x36')]=qs['sort'](_0x46f6cc[_0x662c('0x33')][_0x662c('0x37')]);_0x2bb4d9[_0x662c('0x38')]=qs[_0x662c('0x39')](_[_0x662c('0x3a')](_0x46f6cc['query'],_0x5ba991[_0x662c('0x39')]));if(_0x46f6cc[_0x662c('0x33')]['filter']){_0x2bb4d9[_0x662c('0x38')]=_[_0x662c('0x3c')](_0x2bb4d9['where'],{'$or':_['map'](_0x2bb4d9['attributes'],function(_0x32253b){var _0x58e73a={};_0x58e73a[_0x32253b]={'$like':'%'+_0x46f6cc[_0x662c('0x33')][_0x662c('0x3b')]+'%'};return _0x58e73a;})});}_0x2bb4d9=_[_0x662c('0x3c')]({},_0x2bb4d9,_0x46f6cc[_0x662c('0x3f')]);return _0x531612['getDescriptions'](_0x2bb4d9);}})[_0x662c('0x23')](function(_0x10bf84){if(_0x10bf84){_0xf72df0=_0x10bf84[_0x662c('0x45')];if(!_0x46f6cc['query'][_0x662c('0x34')]('nolimit')){_0x2bb4d9[_0x662c('0x1d')]=qs['limit'](_0x46f6cc[_0x662c('0x33')]['limit']);_0x2bb4d9['offset']=qs[_0x662c('0x1b')](_0x46f6cc[_0x662c('0x33')]['offset']);}return _0x531612[_0x662c('0x4e')](_0x2bb4d9);}})[_0x662c('0x23')](function(_0x1c8345){if(_0x1c8345){return _0x1c8345?{'count':_0xf72df0,'rows':_0x1c8345}:null;}})[_0x662c('0x23')](respondWithResult(_0x4ee373,null))[_0x662c('0x42')](handleError(_0x4ee373,null));};exports['getTags']=function(_0x44fa2f,_0x42899f,_0x16c997){var _0x5e4fd7={};var _0x1713b2={};var _0xd9455c;var _0x177701;return db[_0x662c('0x2b')][_0x662c('0x4d')]({'where':{'id':_0x44fa2f['params']['id']}})[_0x662c('0x23')](handleEntityNotFound(_0x42899f,null))[_0x662c('0x23')](function(_0x14f667){if(_0x14f667){_0xd9455c=_0x14f667;_0x1713b2[_0x662c('0x2e')]=_[_0x662c('0x2f')](db['Tag'][_0x662c('0x2c')]);_0x1713b2[_0x662c('0x33')]=_[_0x662c('0x2f')](_0x44fa2f[_0x662c('0x33')]);_0x1713b2['filters']=_[_0x662c('0x30')](_0x1713b2['model'],_0x1713b2[_0x662c('0x33')]);_0x5e4fd7[_0x662c('0x31')]=_[_0x662c('0x30')](_0x1713b2[_0x662c('0x2e')],qs[_0x662c('0x32')](_0x44fa2f['query'][_0x662c('0x32')]));_0x5e4fd7[_0x662c('0x31')]=_0x5e4fd7[_0x662c('0x31')]['length']?_0x5e4fd7['attributes']:_0x1713b2[_0x662c('0x2e')];_0x5e4fd7[_0x662c('0x36')]=qs[_0x662c('0x37')](_0x44fa2f[_0x662c('0x33')][_0x662c('0x37')]);_0x5e4fd7[_0x662c('0x38')]=qs[_0x662c('0x39')](_[_0x662c('0x3a')](_0x44fa2f[_0x662c('0x33')],_0x1713b2[_0x662c('0x39')]));if(_0x44fa2f['query']['filter']){_0x5e4fd7['where']=_[_0x662c('0x3c')](_0x5e4fd7[_0x662c('0x38')],{'$or':_[_0x662c('0x2a')](_0x5e4fd7[_0x662c('0x31')],function(_0x306242){var _0x2232c5={};_0x2232c5[_0x306242]={'$like':'%'+_0x44fa2f[_0x662c('0x33')][_0x662c('0x3b')]+'%'};return _0x2232c5;})});}_0x5e4fd7=_['merge']({},_0x5e4fd7,_0x44fa2f[_0x662c('0x3f')]);return _0xd9455c[_0x662c('0x4f')](_0x5e4fd7);}})['then'](function(_0x1f09c7){if(_0x1f09c7){_0x177701=_0x1f09c7[_0x662c('0x45')];if(!_0x44fa2f['query']['hasOwnProperty']('nolimit')){_0x5e4fd7['limit']=qs[_0x662c('0x1d')](_0x44fa2f[_0x662c('0x33')][_0x662c('0x1d')]);_0x5e4fd7[_0x662c('0x1b')]=qs[_0x662c('0x1b')](_0x44fa2f[_0x662c('0x33')]['offset']);}return _0xd9455c[_0x662c('0x4f')](_0x5e4fd7);}})[_0x662c('0x23')](function(_0x1ddd8b){if(_0x1ddd8b){return _0x1ddd8b?{'count':_0x177701,'rows':_0x1ddd8b}:null;}})[_0x662c('0x23')](respondWithResult(_0x42899f,null))[_0x662c('0x42')](handleError(_0x42899f,null));};exports[_0x662c('0x50')]=function(_0x353aca,_0x4cf7f6,_0x454dce){if(_0x353aca['body']['id']){delete _0x353aca[_0x662c('0x49')]['id'];}return db[_0x662c('0x2b')][_0x662c('0x4d')]({'where':{'id':_0x353aca[_0x662c('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cf7f6,null))[_0x662c('0x23')](function(_0x1e9b0){if(_0x1e9b0){return _0x1e9b0[_0x662c('0x50')](_0x353aca['body'][_0x662c('0x51')]||[]);}return null;})['then'](respondWithResult(_0x4cf7f6,null))[_0x662c('0x42')](handleError(_0x4cf7f6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6314c69..4805563 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x282b=['moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x1b4e30,_0x3693db){var _0x440cf2=function(_0x4f8078){while(--_0x4f8078){_0x1b4e30['push'](_0x1b4e30['shift']());}};_0x440cf2(++_0x3693db);}(_0x282b,0xec));var _0xb282=function(_0x730f26,_0x5e3902){_0x730f26=_0x730f26-0x0;var _0x407ce0=_0x282b[_0x730f26];return _0x407ce0;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var logger=require(_0xb282('0x2'))(_0xb282('0x3'));var moment=require(_0xb282('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb282('0x5'));var rimraf=require('rimraf');var config=require(_0xb282('0x6'));var attributes=require(_0xb282('0x7'));module[_0xb282('0x8')]=function(_0x1dd19b,_0x3cad41){return _0x1dd19b[_0xb282('0x9')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb03e=['int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1596ba,_0x2ceb3c){_0x1596ba=_0x1596ba-0x0;var _0xbf6cee=_0xb03e[_0x1596ba];return _0xbf6cee;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index ae1aa20..c6feff1 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4950=['stringify','error','code','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x372c04,_0x5cc2cd){var _0x49b325=function(_0x7970ea){while(--_0x7970ea){_0x372c04['push'](_0x372c04['shift']());}};_0x49b325(++_0x5cc2cd);}(_0x4950,0x124));var _0x0495=function(_0x15819b,_0x469bfd){_0x15819b=_0x15819b-0x0;var _0x3a4fe1=_0x4950[_0x15819b];return _0x3a4fe1;};'use strict';var _=require(_0x0495('0x0'));var util=require(_0x0495('0x1'));var moment=require(_0x0495('0x2'));var BPromise=require(_0x0495('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0495('0x4'))['db'];var utils=require(_0x0495('0x5'));var logger=require(_0x0495('0x6'))('rpc');var config=require(_0x0495('0x7'));var jayson=require(_0x0495('0x8'));var client=jayson[_0x0495('0x9')][_0x0495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x282ca8,_0x4efdb7,_0xa3be6){return new BPromise(function(_0x1f9a8d,_0x507e6f){return client[_0x0495('0xb')](_0x282ca8,_0xa3be6)[_0x0495('0xc')](function(_0x490369){logger['info'](_0x0495('0xd'),_0x4efdb7,_0x0495('0xe'));logger['debug'](_0x0495('0xf'),_0x4efdb7,'request\x20sent',JSON[_0x0495('0x10')](_0x490369));if(_0x490369['error']){if(_0x490369[_0x0495('0x11')][_0x0495('0x12')]===0x1f4){logger['error'](_0x0495('0xd'),_0x4efdb7,_0x490369[_0x0495('0x11')][_0x0495('0x13')]);return _0x507e6f(_0x490369[_0x0495('0x11')][_0x0495('0x13')]);}logger[_0x0495('0x11')](_0x0495('0xd'),_0x4efdb7,_0x490369[_0x0495('0x11')][_0x0495('0x13')]);return _0x1f9a8d(_0x490369[_0x0495('0x11')][_0x0495('0x13')]);}else{logger[_0x0495('0x14')](_0x0495('0xd'),_0x4efdb7,_0x0495('0xe'));_0x1f9a8d(_0x490369[_0x0495('0x15')][_0x0495('0x13')]);}})['catch'](function(_0x41c99d){logger[_0x0495('0x11')](_0x0495('0xd'),_0x4efdb7,_0x41c99d);_0x507e6f(_0x41c99d);});});} \ No newline at end of file +var _0xd0a6=['ioredis','../../config/utils','../../config/environment','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2fef36,_0x2d9657){var _0x36cb38=function(_0xe2d130){while(--_0xe2d130){_0x2fef36['push'](_0x2fef36['shift']());}};_0x36cb38(++_0x2d9657);}(_0xd0a6,0x8c));var _0x6d0a=function(_0x131656,_0x4a6ac2){_0x131656=_0x131656-0x0;var _0x1bd163=_0xd0a6[_0x131656];return _0x1bd163;};'use strict';var _=require(_0x6d0a('0x0'));var util=require(_0x6d0a('0x1'));var moment=require(_0x6d0a('0x2'));var BPromise=require(_0x6d0a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d0a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d0a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6d0a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6d0a('0x7')][_0x6d0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52efb3,_0x449dfd,_0x335f04){return new BPromise(function(_0x5bb4fa,_0x54175e){return client['request'](_0x52efb3,_0x335f04)[_0x6d0a('0x9')](function(_0x4d688c){logger[_0x6d0a('0xa')](_0x6d0a('0xb'),_0x449dfd,_0x6d0a('0xc'));logger[_0x6d0a('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x449dfd,_0x6d0a('0xc'),JSON['stringify'](_0x4d688c));if(_0x4d688c['error']){if(_0x4d688c[_0x6d0a('0xe')]['code']===0x1f4){logger[_0x6d0a('0xe')](_0x6d0a('0xb'),_0x449dfd,_0x4d688c[_0x6d0a('0xe')][_0x6d0a('0xf')]);return _0x54175e(_0x4d688c['error'][_0x6d0a('0xf')]);}logger[_0x6d0a('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x449dfd,_0x4d688c[_0x6d0a('0xe')][_0x6d0a('0xf')]);return _0x5bb4fa(_0x4d688c['error'][_0x6d0a('0xf')]);}else{logger[_0x6d0a('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x449dfd,_0x6d0a('0xc'));_0x5bb4fa(_0x4d688c[_0x6d0a('0x10')]['message']);}})[_0x6d0a('0x11')](function(_0x236d98){logger[_0x6d0a('0xe')](_0x6d0a('0xb'),_0x449dfd,_0x236d98);_0x54175e(_0x236d98);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 2a6d8ec..13b4406 100644 --- a/server/api/intZendeskField/index.js +++ b/server/api/intZendeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38f6=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3311ae,_0x362cee){var _0x107949=function(_0x2082a3){while(--_0x2082a3){_0x3311ae['push'](_0x3311ae['shift']());}};_0x107949(++_0x362cee);}(_0x38f6,0x175));var _0x638f=function(_0x4844c5,_0x43b64d){_0x4844c5=_0x4844c5-0x0;var _0x426280=_0x38f6[_0x4844c5];return _0x426280;};'use strict';var multer=require('multer');var util=require(_0x638f('0x0'));var path=require('path');var timeout=require(_0x638f('0x1'));var express=require(_0x638f('0x2'));var router=express['Router']();var fs_extra=require(_0x638f('0x3'));var auth=require(_0x638f('0x4'));var interaction=require(_0x638f('0x5'));var config=require(_0x638f('0x6'));var controller=require(_0x638f('0x7'));router[_0x638f('0x8')]('/',auth[_0x638f('0x9')](),controller['index']);router['get'](_0x638f('0xa'),auth[_0x638f('0x9')](),controller[_0x638f('0xb')]);router[_0x638f('0xc')]('/',auth[_0x638f('0x9')](),controller[_0x638f('0xd')]);router[_0x638f('0xe')](_0x638f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x638f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x638f('0x10')]);module[_0x638f('0x11')]=router; \ No newline at end of file +var _0x83b2=['index','/:id','show','post','isAuthenticated','put','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','./intZendeskField.controller','get'];(function(_0x4e4d50,_0x474f24){var _0x2bb378=function(_0x43029a){while(--_0x43029a){_0x4e4d50['push'](_0x4e4d50['shift']());}};_0x2bb378(++_0x474f24);}(_0x83b2,0xd8));var _0x283b=function(_0x265f9d,_0x39389c){_0x265f9d=_0x265f9d-0x0;var _0x235e87=_0x83b2[_0x265f9d];return _0x235e87;};'use strict';var multer=require(_0x283b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x283b('0x1'));var express=require(_0x283b('0x2'));var router=express[_0x283b('0x3')]();var fs_extra=require(_0x283b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x283b('0x5'));var controller=require(_0x283b('0x6'));router[_0x283b('0x7')]('/',auth['isAuthenticated'](),controller[_0x283b('0x8')]);router[_0x283b('0x7')](_0x283b('0x9'),auth['isAuthenticated'](),controller[_0x283b('0xa')]);router[_0x283b('0xb')]('/',auth[_0x283b('0xc')](),controller['create']);router[_0x283b('0xd')]('/:id',auth[_0x283b('0xc')](),controller['update']);router['delete']('/:id',auth[_0x283b('0xc')](),controller[_0x283b('0xe')]);module[_0x283b('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 7c3287a..ed31dac 100644 --- a/server/api/intZendeskField/intZendeskField.attributes.js +++ b/server/api/intZendeskField/intZendeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15d3=['string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist'];(function(_0x295ea9,_0x19d658){var _0x59a3fe=function(_0x35be54){while(--_0x35be54){_0x295ea9['push'](_0x295ea9['shift']());}};_0x59a3fe(++_0x19d658);}(_0x15d3,0x1d0));var _0x315d=function(_0x4ee0a0,_0x27bdee){_0x4ee0a0=_0x4ee0a0-0x0;var _0xfc5b2f=_0x15d3[_0x4ee0a0];return _0xfc5b2f;};'use strict';var Sequelize=require(_0x315d('0x0'));module[_0x315d('0x1')]={'type':{'type':Sequelize[_0x315d('0x2')]('string','variable',_0x315d('0x3'),_0x315d('0x4'),_0x315d('0x5')),'defaultValue':_0x315d('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x315d('0x7')]},'keyType':{'type':Sequelize[_0x315d('0x2')](_0x315d('0x6'),_0x315d('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x315d('0x7')]},'idField':{'type':Sequelize[_0x315d('0x7')]},'nameField':{'type':Sequelize[_0x315d('0x7')]},'customField':{'type':Sequelize[_0x315d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf46e=['BOOLEAN','sequelize','ENUM','string','keyValue','picklist','STRING','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf46e,0x1e9));var _0xef46=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf46e[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xef46('0x0'));module['exports']={'type':{'type':Sequelize[_0xef46('0x1')](_0xef46('0x2'),'variable','customVariable',_0xef46('0x3'),_0xef46('0x4')),'defaultValue':_0xef46('0x2')},'content':{'type':Sequelize[_0xef46('0x5')]},'key':{'type':Sequelize[_0xef46('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xef46('0x2'),_0xef46('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xef46('0x5')]},'idField':{'type':Sequelize[_0xef46('0x5')]},'nameField':{'type':Sequelize[_0xef46('0x5')]},'customField':{'type':Sequelize[_0xef46('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xef46('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 182f513..d8680ea 100644 --- a/server/api/intZendeskField/intZendeskField.controller.js +++ b/server/api/intZendeskField/intZendeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0e7=['../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x371d28,_0x5ae85c){var _0x4073ec=function(_0x580cbe){while(--_0x580cbe){_0x371d28['push'](_0x371d28['shift']());}};_0x4073ec(++_0x5ae85c);}(_0xe0e7,0x1a2));var _0x7e0e=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0xe0e7[_0x1627ae];return _0x34b38f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e0e('0x0'));var zipdir=require(_0x7e0e('0x1'));var jsonpatch=require(_0x7e0e('0x2'));var rp=require(_0x7e0e('0x3'));var moment=require(_0x7e0e('0x4'));var BPromise=require(_0x7e0e('0x5'));var Mustache=require('mustache');var util=require(_0x7e0e('0x6'));var path=require(_0x7e0e('0x7'));var sox=require(_0x7e0e('0x8'));var csv=require(_0x7e0e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e0e('0xa'));var _=require(_0x7e0e('0xb'));var squel=require(_0x7e0e('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e0e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e0e('0x9'));var querystring=require('querystring');var Papa=require(_0x7e0e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7e0e('0xf'));var as=require(_0x7e0e('0x10'));var hardwareService=require(_0x7e0e('0x11'));var logger=require(_0x7e0e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7e0e('0x13'));var licenseUtil=require(_0x7e0e('0x14'));var db=require(_0x7e0e('0x15'))['db'];function respondWithStatusCode(_0x49ef0a,_0x3b3f80){_0x3b3f80=_0x3b3f80||0xcc;return function(_0x2bfaed){if(_0x2bfaed){return _0x49ef0a['sendStatus'](_0x3b3f80);}return _0x49ef0a[_0x7e0e('0x16')](_0x3b3f80)[_0x7e0e('0x17')]();};}function respondWithResult(_0x353702,_0x1b67df){_0x1b67df=_0x1b67df||0xc8;return function(_0x4ddcfe){if(_0x4ddcfe){return _0x353702[_0x7e0e('0x16')](_0x1b67df)[_0x7e0e('0x18')](_0x4ddcfe);}};}function respondWithFilteredResult(_0x473b64,_0x2e2717){return function(_0x47900e){if(_0x47900e){var _0x59c988=typeof _0x2e2717[_0x7e0e('0x19')]===_0x7e0e('0x1a')&&typeof _0x2e2717[_0x7e0e('0x1b')]==='undefined';var _0x5ecb73=_0x47900e[_0x7e0e('0x1c')];var _0x379d48=_0x59c988?0x0:_0x2e2717[_0x7e0e('0x19')];var _0x1fac1c=_0x59c988?_0x47900e[_0x7e0e('0x1c')]:_0x2e2717['offset']+_0x2e2717[_0x7e0e('0x1b')];var _0x39959f;if(_0x1fac1c>=_0x5ecb73){_0x1fac1c=_0x5ecb73;_0x39959f=0xc8;}else{_0x39959f=0xce;}_0x473b64[_0x7e0e('0x16')](_0x39959f);return _0x473b64[_0x7e0e('0x1d')](_0x7e0e('0x1e'),_0x379d48+'-'+_0x1fac1c+'/'+_0x5ecb73)[_0x7e0e('0x18')](_0x47900e);}return null;};}function patchUpdates(_0x8ae7ae){return function(_0x29f4c2){try{jsonpatch[_0x7e0e('0x1f')](_0x29f4c2,_0x8ae7ae,!![]);}catch(_0x30321d){return BPromise[_0x7e0e('0x20')](_0x30321d);}return _0x29f4c2[_0x7e0e('0x21')]();};}function saveUpdates(_0x2867b5,_0x145002){return function(_0x23007c){if(_0x23007c){return _0x23007c['update'](_0x2867b5)['then'](function(_0x4631f2){return _0x4631f2;});}return null;};}function removeEntity(_0x375061,_0x5e1cf9){return function(_0x102cfa){if(_0x102cfa){return _0x102cfa[_0x7e0e('0x22')]()[_0x7e0e('0x23')](function(){_0x375061['status'](0xcc)[_0x7e0e('0x17')]();});}};}function handleEntityNotFound(_0x34e2c5,_0x5beb92){return function(_0xa56cd3){if(!_0xa56cd3){_0x34e2c5[_0x7e0e('0x24')](0x194);}return _0xa56cd3;};}function handleError(_0xe1cf7b,_0x4382b3){_0x4382b3=_0x4382b3||0x1f4;return function(_0x26c71c){logger[_0x7e0e('0x25')](_0x26c71c[_0x7e0e('0x26')]);if(_0x26c71c[_0x7e0e('0x27')]){delete _0x26c71c[_0x7e0e('0x27')];}_0xe1cf7b[_0x7e0e('0x16')](_0x4382b3)[_0x7e0e('0x28')](_0x26c71c);};}exports[_0x7e0e('0x29')]=function(_0x371b5f,_0x76ad63){var _0x8c4b36={},_0x3c7505={},_0x2f2c9f={'count':0x0,'rows':[]};var _0x8d5338=_[_0x7e0e('0x2a')](db[_0x7e0e('0x2b')][_0x7e0e('0x2c')],function(_0x3304c2){return{'name':_0x3304c2['fieldName'],'type':_0x3304c2['type'][_0x7e0e('0x2d')]};});_0x3c7505[_0x7e0e('0x2e')]=_[_0x7e0e('0x2a')](_0x8d5338,_0x7e0e('0x27'));_0x3c7505[_0x7e0e('0x2f')]=_[_0x7e0e('0x30')](_0x371b5f['query']);_0x3c7505[_0x7e0e('0x31')]=_['intersection'](_0x3c7505[_0x7e0e('0x2e')],_0x3c7505[_0x7e0e('0x2f')]);_0x8c4b36[_0x7e0e('0x32')]=_[_0x7e0e('0x33')](_0x3c7505[_0x7e0e('0x2e')],qs[_0x7e0e('0x34')](_0x371b5f[_0x7e0e('0x2f')][_0x7e0e('0x34')]));_0x8c4b36['attributes']=_0x8c4b36[_0x7e0e('0x32')]['length']?_0x8c4b36[_0x7e0e('0x32')]:_0x3c7505[_0x7e0e('0x2e')];if(!_0x371b5f['query'][_0x7e0e('0x35')](_0x7e0e('0x36'))){_0x8c4b36['limit']=qs[_0x7e0e('0x1b')](_0x371b5f['query'][_0x7e0e('0x1b')]);_0x8c4b36[_0x7e0e('0x19')]=qs[_0x7e0e('0x19')](_0x371b5f[_0x7e0e('0x2f')][_0x7e0e('0x19')]);}_0x8c4b36['order']=qs[_0x7e0e('0x37')](_0x371b5f[_0x7e0e('0x2f')][_0x7e0e('0x37')]);_0x8c4b36[_0x7e0e('0x38')]=qs['filters'](_[_0x7e0e('0x39')](_0x371b5f['query'],_0x3c7505['filters']),_0x8d5338);if(_0x371b5f['query'][_0x7e0e('0x3a')]){_0x8c4b36[_0x7e0e('0x38')]=_[_0x7e0e('0x3b')](_0x8c4b36[_0x7e0e('0x38')],{'$or':_[_0x7e0e('0x2a')](_0x8d5338,function(_0xa2ca3f){if(_0xa2ca3f[_0x7e0e('0x3c')]!=='VIRTUAL'){var _0x29b30c={};_0x29b30c[_0xa2ca3f[_0x7e0e('0x27')]]={'$like':'%'+_0x371b5f[_0x7e0e('0x2f')]['filter']+'%'};return _0x29b30c;}})});}_0x8c4b36=_[_0x7e0e('0x3b')]({},_0x8c4b36,_0x371b5f[_0x7e0e('0x3d')]);var _0x453b66={'where':_0x8c4b36[_0x7e0e('0x38')]};return db[_0x7e0e('0x2b')]['count'](_0x453b66)[_0x7e0e('0x23')](function(_0x1ac456){_0x2f2c9f['count']=_0x1ac456;if(_0x371b5f[_0x7e0e('0x2f')][_0x7e0e('0x3e')]){_0x8c4b36[_0x7e0e('0x3f')]=[{'all':!![]}];}return db[_0x7e0e('0x2b')][_0x7e0e('0x40')](_0x8c4b36);})[_0x7e0e('0x23')](function(_0x51e871){_0x2f2c9f[_0x7e0e('0x41')]=_0x51e871;return _0x2f2c9f;})['then'](respondWithFilteredResult(_0x76ad63,_0x8c4b36))[_0x7e0e('0x42')](handleError(_0x76ad63,null));};exports[_0x7e0e('0x43')]=function(_0x5d3008,_0x356d12){var _0x5f25bb={'raw':!![],'where':{'id':_0x5d3008['params']['id']}},_0xe25171={};_0xe25171['model']=_['keys'](db[_0x7e0e('0x2b')][_0x7e0e('0x2c')]);_0xe25171['query']=_['keys'](_0x5d3008[_0x7e0e('0x2f')]);_0xe25171['filters']=_['intersection'](_0xe25171[_0x7e0e('0x2e')],_0xe25171[_0x7e0e('0x2f')]);_0x5f25bb[_0x7e0e('0x32')]=_[_0x7e0e('0x33')](_0xe25171[_0x7e0e('0x2e')],qs[_0x7e0e('0x34')](_0x5d3008['query'][_0x7e0e('0x34')]));_0x5f25bb[_0x7e0e('0x32')]=_0x5f25bb[_0x7e0e('0x32')]['length']?_0x5f25bb['attributes']:_0xe25171['model'];if(_0x5d3008[_0x7e0e('0x2f')]['includeAll']){_0x5f25bb[_0x7e0e('0x3f')]=[{'all':!![]}];}_0x5f25bb=_[_0x7e0e('0x3b')]({},_0x5f25bb,_0x5d3008[_0x7e0e('0x3d')]);return db[_0x7e0e('0x2b')][_0x7e0e('0x44')](_0x5f25bb)[_0x7e0e('0x23')](handleEntityNotFound(_0x356d12,null))[_0x7e0e('0x23')](respondWithResult(_0x356d12,null))[_0x7e0e('0x42')](handleError(_0x356d12,null));};exports[_0x7e0e('0x45')]=function(_0x56eb19,_0x2163c8){return db[_0x7e0e('0x2b')]['create'](_0x56eb19['body'],{})['then'](respondWithResult(_0x2163c8,0xc9))[_0x7e0e('0x42')](handleError(_0x2163c8,null));};exports[_0x7e0e('0x46')]=function(_0x14cbce,_0xc69fc4){if(_0x14cbce[_0x7e0e('0x47')]['id']){delete _0x14cbce[_0x7e0e('0x47')]['id'];}return db['ZendeskField'][_0x7e0e('0x44')]({'where':{'id':_0x14cbce[_0x7e0e('0x48')]['id']}})[_0x7e0e('0x23')](handleEntityNotFound(_0xc69fc4,null))['then'](saveUpdates(_0x14cbce['body'],null))[_0x7e0e('0x23')](respondWithResult(_0xc69fc4,null))[_0x7e0e('0x42')](handleError(_0xc69fc4,null));};exports[_0x7e0e('0x22')]=function(_0x1342a6,_0x2f1c7d){return db['ZendeskField'][_0x7e0e('0x44')]({'where':{'id':_0x1342a6[_0x7e0e('0x48')]['id']}})[_0x7e0e('0x23')](handleEntityNotFound(_0x2f1c7d,null))[_0x7e0e('0x23')](removeEntity(_0x2f1c7d,null))[_0x7e0e('0x42')](handleError(_0x2f1c7d,null));}; \ No newline at end of file +var _0x9ffd=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','options','ZendeskField','includeAll','include','findAll','rows','catch','show','params','keys','merge','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x503b95,_0x43b0e0){var _0x122ac6=function(_0x15089e){while(--_0x15089e){_0x503b95['push'](_0x503b95['shift']());}};_0x122ac6(++_0x43b0e0);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x268b25,_0x37ab8f){_0x268b25=_0x268b25-0x0;var _0x3b8d84=_0x9ffd[_0x268b25];return _0x3b8d84;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require(_0xd9ff('0x3'));var rp=require('request-promise');var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require(_0xd9ff('0x7'));var path=require(_0xd9ff('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd9ff('0xa'));var squel=require(_0xd9ff('0xb'));var crypto=require('crypto');var jsforce=require(_0xd9ff('0xc'));var deskjs=require(_0xd9ff('0xd'));var toCsv=require(_0xd9ff('0xe'));var querystring=require(_0xd9ff('0xf'));var Papa=require('papaparse');var Redis=require(_0xd9ff('0x10'));var authService=require(_0xd9ff('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd9ff('0x13'));var licenseUtil=require(_0xd9ff('0x14'));var db=require(_0xd9ff('0x15'))['db'];function respondWithStatusCode(_0x2bb498,_0x28c488){_0x28c488=_0x28c488||0xcc;return function(_0x41c849){if(_0x41c849){return _0x2bb498[_0xd9ff('0x16')](_0x28c488);}return _0x2bb498[_0xd9ff('0x17')](_0x28c488)[_0xd9ff('0x18')]();};}function respondWithResult(_0x1912fb,_0x470802){_0x470802=_0x470802||0xc8;return function(_0x2b4cab){if(_0x2b4cab){return _0x1912fb[_0xd9ff('0x17')](_0x470802)[_0xd9ff('0x19')](_0x2b4cab);}};}function respondWithFilteredResult(_0x3865d7,_0x40ae90){return function(_0xa44d2e){if(_0xa44d2e){var _0x34b515=typeof _0x40ae90[_0xd9ff('0x1a')]===_0xd9ff('0x1b')&&typeof _0x40ae90['limit']===_0xd9ff('0x1b');var _0x15dca0=_0xa44d2e[_0xd9ff('0x1c')];var _0x161908=_0x34b515?0x0:_0x40ae90[_0xd9ff('0x1a')];var _0x5e4b6f=_0x34b515?_0xa44d2e[_0xd9ff('0x1c')]:_0x40ae90[_0xd9ff('0x1a')]+_0x40ae90[_0xd9ff('0x1d')];var _0x195822;if(_0x5e4b6f>=_0x15dca0){_0x5e4b6f=_0x15dca0;_0x195822=0xc8;}else{_0x195822=0xce;}_0x3865d7['status'](_0x195822);return _0x3865d7[_0xd9ff('0x1e')](_0xd9ff('0x1f'),_0x161908+'-'+_0x5e4b6f+'/'+_0x15dca0)[_0xd9ff('0x19')](_0xa44d2e);}return null;};}function patchUpdates(_0x3bd1a9){return function(_0x200fb9){try{jsonpatch['apply'](_0x200fb9,_0x3bd1a9,!![]);}catch(_0x4b293e){return BPromise['reject'](_0x4b293e);}return _0x200fb9['save']();};}function saveUpdates(_0x54f9da,_0x510b79){return function(_0x19ca9b){if(_0x19ca9b){return _0x19ca9b[_0xd9ff('0x20')](_0x54f9da)[_0xd9ff('0x21')](function(_0x3430fc){return _0x3430fc;});}return null;};}function removeEntity(_0x746dc4,_0x446d1b){return function(_0x496bf0){if(_0x496bf0){return _0x496bf0[_0xd9ff('0x22')]()['then'](function(){_0x746dc4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26237b,_0x5dd2b1){return function(_0x195021){if(!_0x195021){_0x26237b[_0xd9ff('0x16')](0x194);}return _0x195021;};}function handleError(_0x220d9d,_0x41d0b0){_0x41d0b0=_0x41d0b0||0x1f4;return function(_0x124899){logger[_0xd9ff('0x23')](_0x124899[_0xd9ff('0x24')]);if(_0x124899[_0xd9ff('0x25')]){delete _0x124899['name'];}_0x220d9d[_0xd9ff('0x17')](_0x41d0b0)['send'](_0x124899);};}exports[_0xd9ff('0x26')]=function(_0x5afd,_0x321a87){var _0x542394={},_0x4b00a4={},_0x58281c={'count':0x0,'rows':[]};var _0x865586=_['map'](db['ZendeskField'][_0xd9ff('0x27')],function(_0xa35152){return{'name':_0xa35152[_0xd9ff('0x28')],'type':_0xa35152['type'][_0xd9ff('0x29')]};});_0x4b00a4['model']=_[_0xd9ff('0x2a')](_0x865586,_0xd9ff('0x25'));_0x4b00a4[_0xd9ff('0x2b')]=_['keys'](_0x5afd[_0xd9ff('0x2b')]);_0x4b00a4[_0xd9ff('0x2c')]=_[_0xd9ff('0x2d')](_0x4b00a4[_0xd9ff('0x2e')],_0x4b00a4['query']);_0x542394[_0xd9ff('0x2f')]=_['intersection'](_0x4b00a4[_0xd9ff('0x2e')],qs[_0xd9ff('0x30')](_0x5afd['query'][_0xd9ff('0x30')]));_0x542394[_0xd9ff('0x2f')]=_0x542394[_0xd9ff('0x2f')][_0xd9ff('0x31')]?_0x542394['attributes']:_0x4b00a4[_0xd9ff('0x2e')];if(!_0x5afd[_0xd9ff('0x2b')][_0xd9ff('0x32')]('nolimit')){_0x542394[_0xd9ff('0x1d')]=qs[_0xd9ff('0x1d')](_0x5afd[_0xd9ff('0x2b')][_0xd9ff('0x1d')]);_0x542394[_0xd9ff('0x1a')]=qs[_0xd9ff('0x1a')](_0x5afd[_0xd9ff('0x2b')][_0xd9ff('0x1a')]);}_0x542394[_0xd9ff('0x33')]=qs['sort'](_0x5afd[_0xd9ff('0x2b')][_0xd9ff('0x34')]);_0x542394['where']=qs[_0xd9ff('0x2c')](_[_0xd9ff('0x35')](_0x5afd[_0xd9ff('0x2b')],_0x4b00a4[_0xd9ff('0x2c')]),_0x865586);if(_0x5afd['query'][_0xd9ff('0x36')]){_0x542394[_0xd9ff('0x37')]=_['merge'](_0x542394['where'],{'$or':_[_0xd9ff('0x2a')](_0x865586,function(_0x271f4a){if(_0x271f4a['type']!=='VIRTUAL'){var _0x757db2={};_0x757db2[_0x271f4a['name']]={'$like':'%'+_0x5afd[_0xd9ff('0x2b')][_0xd9ff('0x36')]+'%'};return _0x757db2;}})});}_0x542394=_['merge']({},_0x542394,_0x5afd[_0xd9ff('0x38')]);var _0x559095={'where':_0x542394['where']};return db[_0xd9ff('0x39')][_0xd9ff('0x1c')](_0x559095)[_0xd9ff('0x21')](function(_0x346bdd){_0x58281c[_0xd9ff('0x1c')]=_0x346bdd;if(_0x5afd[_0xd9ff('0x2b')][_0xd9ff('0x3a')]){_0x542394[_0xd9ff('0x3b')]=[{'all':!![]}];}return db['ZendeskField'][_0xd9ff('0x3c')](_0x542394);})['then'](function(_0x3e7d1c){_0x58281c[_0xd9ff('0x3d')]=_0x3e7d1c;return _0x58281c;})['then'](respondWithFilteredResult(_0x321a87,_0x542394))[_0xd9ff('0x3e')](handleError(_0x321a87,null));};exports[_0xd9ff('0x3f')]=function(_0x217aef,_0x2b8225){var _0x383bf2={'raw':!![],'where':{'id':_0x217aef[_0xd9ff('0x40')]['id']}},_0x450416={};_0x450416[_0xd9ff('0x2e')]=_[_0xd9ff('0x41')](db[_0xd9ff('0x39')]['rawAttributes']);_0x450416[_0xd9ff('0x2b')]=_[_0xd9ff('0x41')](_0x217aef[_0xd9ff('0x2b')]);_0x450416[_0xd9ff('0x2c')]=_[_0xd9ff('0x2d')](_0x450416['model'],_0x450416[_0xd9ff('0x2b')]);_0x383bf2[_0xd9ff('0x2f')]=_[_0xd9ff('0x2d')](_0x450416[_0xd9ff('0x2e')],qs['fields'](_0x217aef[_0xd9ff('0x2b')][_0xd9ff('0x30')]));_0x383bf2['attributes']=_0x383bf2[_0xd9ff('0x2f')][_0xd9ff('0x31')]?_0x383bf2['attributes']:_0x450416['model'];if(_0x217aef[_0xd9ff('0x2b')]['includeAll']){_0x383bf2[_0xd9ff('0x3b')]=[{'all':!![]}];}_0x383bf2=_[_0xd9ff('0x42')]({},_0x383bf2,_0x217aef['options']);return db[_0xd9ff('0x39')]['find'](_0x383bf2)[_0xd9ff('0x21')](handleEntityNotFound(_0x2b8225,null))[_0xd9ff('0x21')](respondWithResult(_0x2b8225,null))['catch'](handleError(_0x2b8225,null));};exports[_0xd9ff('0x43')]=function(_0x133f21,_0x11dd75){return db['ZendeskField'][_0xd9ff('0x43')](_0x133f21[_0xd9ff('0x44')],{})[_0xd9ff('0x21')](respondWithResult(_0x11dd75,0xc9))[_0xd9ff('0x3e')](handleError(_0x11dd75,null));};exports[_0xd9ff('0x20')]=function(_0x37aa68,_0x43bcce){if(_0x37aa68[_0xd9ff('0x44')]['id']){delete _0x37aa68[_0xd9ff('0x44')]['id'];}return db[_0xd9ff('0x39')][_0xd9ff('0x45')]({'where':{'id':_0x37aa68[_0xd9ff('0x40')]['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x43bcce,null))['then'](saveUpdates(_0x37aa68[_0xd9ff('0x44')],null))[_0xd9ff('0x21')](respondWithResult(_0x43bcce,null))[_0xd9ff('0x3e')](handleError(_0x43bcce,null));};exports[_0xd9ff('0x22')]=function(_0x51d987,_0x349738){return db[_0xd9ff('0x39')][_0xd9ff('0x45')]({'where':{'id':_0x51d987['params']['id']}})['then'](handleEntityNotFound(_0x349738,null))[_0xd9ff('0x21')](removeEntity(_0x349738,null))['catch'](handleError(_0x349738,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 641451d..5eefaf4 100644 --- a/server/api/intZendeskField/intZendeskField.model.js +++ b/server/api/intZendeskField/intZendeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x040a=['../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index','FieldId','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x49eb06,_0x47d2b6){var _0x4b8d67=function(_0xe1161e){while(--_0xe1161e){_0x49eb06['push'](_0x49eb06['shift']());}};_0x4b8d67(++_0x47d2b6);}(_0x040a,0x13e));var _0xa040=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0x040a[_0xb7cb72];return _0x4b7570;};'use strict';var _=require('lodash');var util=require(_0xa040('0x0'));var logger=require(_0xa040('0x1'))(_0xa040('0x2'));var moment=require('moment');var BPromise=require(_0xa040('0x3'));var rp=require(_0xa040('0x4'));var fs=require('fs');var path=require(_0xa040('0x5'));var rimraf=require('rimraf');var config=require(_0xa040('0x6'));var attributes=require(_0xa040('0x7'));module[_0xa040('0x8')]=function(_0x224f88,_0x508b95){return _0x224f88['define']('ZendeskField',attributes,{'tableName':_0xa040('0x9'),'paranoid':![],'indexes':[{'name':_0xa040('0xa'),'fields':['idField',_0xa040('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x865c=['bluebird','request-promise','path','rimraf','../../config/environment','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x865c,0xa7));var _0xc865=function(_0xc8d11a,_0x3d085b){_0xc8d11a=_0xc8d11a-0x0;var _0x461a6e=_0x865c[_0xc8d11a];return _0x461a6e;};'use strict';var _=require(_0xc865('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc865('0x1'));var rp=require(_0xc865('0x2'));var fs=require('fs');var path=require(_0xc865('0x3'));var rimraf=require(_0xc865('0x4'));var config=require(_0xc865('0x5'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x2078b0,_0x282e76){return _0x2078b0[_0xc865('0x6')](_0xc865('0x7'),attributes,{'tableName':_0xc865('0x8'),'paranoid':![],'indexes':[{'name':_0xc865('0x9'),'fields':[_0xc865('0xa'),_0xc865('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 6b00282..8b4fb14 100644 --- a/server/api/intZendeskField/intZendeskField.rpc.js +++ b/server/api/intZendeskField/intZendeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x700e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x29b07d,_0x5567c2){var _0x1a6eaf=function(_0x266a8a){while(--_0x266a8a){_0x29b07d['push'](_0x29b07d['shift']());}};_0x1a6eaf(++_0x5567c2);}(_0x700e,0x1dd));var _0xe700=function(_0x5d30f8,_0x5e9426){_0x5d30f8=_0x5d30f8-0x0;var _0x2d82f7=_0x700e[_0x5d30f8];return _0x2d82f7;};'use strict';var _=require(_0xe700('0x0'));var util=require(_0xe700('0x1'));var moment=require(_0xe700('0x2'));var BPromise=require(_0xe700('0x3'));var rs=require(_0xe700('0x4'));var fs=require('fs');var Redis=require(_0xe700('0x5'));var db=require(_0xe700('0x6'))['db'];var utils=require(_0xe700('0x7'));var logger=require(_0xe700('0x8'))(_0xe700('0x9'));var config=require(_0xe700('0xa'));var jayson=require(_0xe700('0xb'));var client=jayson[_0xe700('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e6a2e,_0x2f46ae,_0xdb11fd){return new BPromise(function(_0x1b672d,_0x2fcd9c){return client[_0xe700('0xd')](_0x4e6a2e,_0xdb11fd)['then'](function(_0xc7ee48){logger[_0xe700('0xe')]('ZendeskField,\x20%s,\x20%s',_0x2f46ae,_0xe700('0xf'));logger['debug'](_0xe700('0x10'),_0x2f46ae,_0xe700('0xf'),JSON[_0xe700('0x11')](_0xc7ee48));if(_0xc7ee48[_0xe700('0x12')]){if(_0xc7ee48[_0xe700('0x12')][_0xe700('0x13')]===0x1f4){logger['error'](_0xe700('0x14'),_0x2f46ae,_0xc7ee48[_0xe700('0x12')][_0xe700('0x15')]);return _0x2fcd9c(_0xc7ee48[_0xe700('0x12')]['message']);}logger[_0xe700('0x12')](_0xe700('0x14'),_0x2f46ae,_0xc7ee48[_0xe700('0x12')][_0xe700('0x15')]);return _0x1b672d(_0xc7ee48[_0xe700('0x12')][_0xe700('0x15')]);}else{logger['info'](_0xe700('0x14'),_0x2f46ae,_0xe700('0xf'));_0x1b672d(_0xc7ee48[_0xe700('0x16')][_0xe700('0x15')]);}})[_0xe700('0x17')](function(_0x3e0ea1){logger[_0xe700('0x12')](_0xe700('0x14'),_0x2f46ae,_0x3e0ea1);_0x2fcd9c(_0x3e0ea1);});});} \ No newline at end of file +var _0xc0e8=['../../config/logger','../../config/environment','client','http','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0e8,0x18b));var _0x8c0e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc0e8[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x8c0e('0x0'));var moment=require(_0x8c0e('0x1'));var BPromise=require(_0x8c0e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c0e('0x3'));var db=require(_0x8c0e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c0e('0x5'))('rpc');var config=require(_0x8c0e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8c0e('0x7')][_0x8c0e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a8e44,_0x59ed11,_0x1676a4){return new BPromise(function(_0x29ab71,_0x37ed06){return client['request'](_0x5a8e44,_0x1676a4)['then'](function(_0x22f469){logger[_0x8c0e('0x9')](_0x8c0e('0xa'),_0x59ed11,_0x8c0e('0xb'));logger[_0x8c0e('0xc')](_0x8c0e('0xd'),_0x59ed11,_0x8c0e('0xb'),JSON[_0x8c0e('0xe')](_0x22f469));if(_0x22f469['error']){if(_0x22f469['error'][_0x8c0e('0xf')]===0x1f4){logger[_0x8c0e('0x10')]('ZendeskField,\x20%s,\x20%s',_0x59ed11,_0x22f469[_0x8c0e('0x10')][_0x8c0e('0x11')]);return _0x37ed06(_0x22f469[_0x8c0e('0x10')]['message']);}logger[_0x8c0e('0x10')](_0x8c0e('0xa'),_0x59ed11,_0x22f469[_0x8c0e('0x10')][_0x8c0e('0x11')]);return _0x29ab71(_0x22f469[_0x8c0e('0x10')][_0x8c0e('0x11')]);}else{logger['info'](_0x8c0e('0xa'),_0x59ed11,_0x8c0e('0xb'));_0x29ab71(_0x22f469[_0x8c0e('0x12')][_0x8c0e('0x11')]);}})[_0x8c0e('0x13')](function(_0x5a417f){logger[_0x8c0e('0x10')](_0x8c0e('0xa'),_0x59ed11,_0x5a417f);_0x37ed06(_0x5a417f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index e5b8fce..ac848a4 100644 --- a/server/api/intZohoAccount/index.js +++ b/server/api/intZohoAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b70=['../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','index','show','get','/:id/configurations','post','create','addConfiguration','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x933443,_0x247567){var _0x457612=function(_0x5a89d3){while(--_0x5a89d3){_0x933443['push'](_0x933443['shift']());}};_0x457612(++_0x247567);}(_0x7b70,0x1de));var _0x07b7=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x7b70[_0x346737];return _0x1ade2e;};'use strict';var multer=require(_0x07b7('0x0'));var util=require(_0x07b7('0x1'));var path=require(_0x07b7('0x2'));var timeout=require(_0x07b7('0x3'));var express=require(_0x07b7('0x4'));var router=express['Router']();var fs_extra=require(_0x07b7('0x5'));var auth=require(_0x07b7('0x6'));var interaction=require(_0x07b7('0x7'));var config=require('../../config/environment');var controller=require(_0x07b7('0x8'));router['get']('/',auth[_0x07b7('0x9')](),controller[_0x07b7('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x07b7('0xb')]);router[_0x07b7('0xc')](_0x07b7('0xd'),auth[_0x07b7('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x07b7('0x9')](),controller['getFields']);router[_0x07b7('0xe')]('/',auth[_0x07b7('0x9')](),controller[_0x07b7('0xf')]);router[_0x07b7('0xe')]('/:id/configurations',auth[_0x07b7('0x9')](),controller[_0x07b7('0x10')]);router['put']('/:id',auth[_0x07b7('0x9')](),controller[_0x07b7('0x11')]);router[_0x07b7('0x12')](_0x07b7('0x13'),auth[_0x07b7('0x9')](),controller[_0x07b7('0x14')]);module[_0x07b7('0x15')]=router; \ No newline at end of file +var _0xba63=['post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x13ef48,_0x590e55){var _0xdb691d=function(_0x2a299b){while(--_0x2a299b){_0x13ef48['push'](_0x13ef48['shift']());}};_0xdb691d(++_0x590e55);}(_0xba63,0xc1));var _0x3ba6=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xba63[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x3ba6('0x0'));var util=require(_0x3ba6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3ba6('0x2'));var router=express[_0x3ba6('0x3')]();var fs_extra=require(_0x3ba6('0x4'));var auth=require(_0x3ba6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x3ba6('0x6')]('/',auth[_0x3ba6('0x7')](),controller[_0x3ba6('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3ba6('0x9')]);router[_0x3ba6('0x6')](_0x3ba6('0xa'),auth[_0x3ba6('0x7')](),controller[_0x3ba6('0xb')]);router[_0x3ba6('0x6')](_0x3ba6('0xc'),auth[_0x3ba6('0x7')](),controller[_0x3ba6('0xd')]);router[_0x3ba6('0xe')]('/',auth[_0x3ba6('0x7')](),controller[_0x3ba6('0xf')]);router[_0x3ba6('0xe')](_0x3ba6('0xa'),auth[_0x3ba6('0x7')](),controller[_0x3ba6('0x10')]);router[_0x3ba6('0x11')](_0x3ba6('0x12'),auth['isAuthenticated'](),controller[_0x3ba6('0x13')]);router[_0x3ba6('0x14')](_0x3ba6('0x12'),auth['isAuthenticated'](),controller[_0x3ba6('0x15')]);module[_0x3ba6('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index fe8713f..ed71a00 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a19=['sequelize','exports','STRING'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x9a19,0x114));var _0x99a1=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x9a19[_0x2ae2ad];return _0x26dbd7;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'name':{'type':Sequelize[_0x99a1('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x99a1('0x2')]},'zone':{'type':Sequelize[_0x99a1('0x2')]},'clientId':{'type':Sequelize[_0x99a1('0x2')]},'clientSecret':{'type':Sequelize[_0x99a1('0x2')]},'serverUrl':{'type':Sequelize[_0x99a1('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x99a1('0x2')]},'refreshToken':{'type':Sequelize[_0x99a1('0x2')]}}; \ No newline at end of file +var _0x4b84=['STRING','sequelize','exports'];(function(_0x44ed28,_0xe6ea1d){var _0x3090ad=function(_0x57b12e){while(--_0x57b12e){_0x44ed28['push'](_0x44ed28['shift']());}};_0x3090ad(++_0xe6ea1d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x4b84[_0x3c51d4];return _0x53c45f;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x44b8('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x44b8('0x2')]},'serverUrl':{'type':Sequelize[_0x44b8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x44b8('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index ac12c1b..6b6429f 100644 --- a/server/api/intZohoAccount/intZohoAccount.controller.js +++ b/server/api/intZohoAccount/intZohoAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe591=['Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ZohoAccount','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','host','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test'];(function(_0x2f384e,_0x237f8b){var _0x56f0dd=function(_0x5087ff){while(--_0x5087ff){_0x2f384e['push'](_0x2f384e['shift']());}};_0x56f0dd(++_0x237f8b);}(_0xe591,0x103));var _0x1e59=function(_0x579f8e,_0x468418){_0x579f8e=_0x579f8e-0x0;var _0x227fa4=_0xe591[_0x579f8e];return _0x227fa4;};'use strict';var emlformat=require(_0x1e59('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e59('0x1'));var jsonpatch=require(_0x1e59('0x2'));var rp=require(_0x1e59('0x3'));var moment=require(_0x1e59('0x4'));var BPromise=require(_0x1e59('0x5'));var Mustache=require('mustache');var util=require(_0x1e59('0x6'));var path=require(_0x1e59('0x7'));var sox=require(_0x1e59('0x8'));var csv=require(_0x1e59('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1e59('0xa'));var crypto=require('crypto');var jsforce=require(_0x1e59('0xb'));var deskjs=require(_0x1e59('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1e59('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1e59('0xe'));var as=require(_0x1e59('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e59('0x10'));var utils=require(_0x1e59('0x11'));var config=require(_0x1e59('0x12'));var licenseUtil=require(_0x1e59('0x13'));var db=require(_0x1e59('0x14'))['db'];var integrations=require(_0x1e59('0x15'));function respondWithStatusCode(_0x31a900,_0x698198){_0x698198=_0x698198||0xcc;return function(_0x2664db){if(_0x2664db){return _0x31a900[_0x1e59('0x16')](_0x698198);}return _0x31a900['status'](_0x698198)[_0x1e59('0x17')]();};}function respondWithResult(_0x36d369,_0x2efc79){_0x2efc79=_0x2efc79||0xc8;return function(_0x523fbd){if(_0x523fbd){return _0x36d369[_0x1e59('0x18')](_0x2efc79)['json'](_0x523fbd);}};}function respondWithFilteredResult(_0x43a9dd,_0x1c1459){return function(_0x270465){if(_0x270465){var _0x5112cd=typeof _0x1c1459[_0x1e59('0x19')]===_0x1e59('0x1a')&&typeof _0x1c1459['limit']===_0x1e59('0x1a');var _0x2d03aa=_0x270465['count'];var _0x11639f=_0x5112cd?0x0:_0x1c1459[_0x1e59('0x19')];var _0xb4f3c3=_0x5112cd?_0x270465[_0x1e59('0x1b')]:_0x1c1459[_0x1e59('0x19')]+_0x1c1459[_0x1e59('0x1c')];var _0x4b2938;if(_0xb4f3c3>=_0x2d03aa){_0xb4f3c3=_0x2d03aa;_0x4b2938=0xc8;}else{_0x4b2938=0xce;}_0x43a9dd[_0x1e59('0x18')](_0x4b2938);return _0x43a9dd['set'](_0x1e59('0x1d'),_0x11639f+'-'+_0xb4f3c3+'/'+_0x2d03aa)['json'](_0x270465);}return null;};}function patchUpdates(_0x3bed4f){return function(_0xa85198){try{jsonpatch[_0x1e59('0x1e')](_0xa85198,_0x3bed4f,!![]);}catch(_0x5eabce){return BPromise[_0x1e59('0x1f')](_0x5eabce);}return _0xa85198[_0x1e59('0x20')]();};}function saveUpdates(_0x192a0b,_0x181fe9){return function(_0x2bb8f9){if(_0x2bb8f9){return _0x2bb8f9[_0x1e59('0x21')](_0x192a0b)[_0x1e59('0x22')](function(_0x588f8b){return _0x588f8b;});}return null;};}function removeEntity(_0x103263,_0x55b42a){return function(_0x1bec71){if(_0x1bec71){return _0x1bec71[_0x1e59('0x23')]()[_0x1e59('0x22')](function(){_0x103263[_0x1e59('0x18')](0xcc)[_0x1e59('0x17')]();});}};}function handleEntityNotFound(_0x53dc24,_0xd528b6){return function(_0x3e2f16){if(!_0x3e2f16){_0x53dc24[_0x1e59('0x16')](0x194);}return _0x3e2f16;};}function handleError(_0xa46895,_0x11c469){_0x11c469=_0x11c469||0x1f4;return function(_0x2baa76){logger[_0x1e59('0x24')](_0x2baa76['stack']);if(_0x2baa76[_0x1e59('0x25')]){delete _0x2baa76[_0x1e59('0x25')];}_0xa46895[_0x1e59('0x18')](_0x11c469)[_0x1e59('0x26')](_0x2baa76);};}exports[_0x1e59('0x27')]=function(_0xc40d32,_0x3fd6c8){var _0x366765={},_0x211523={},_0x306b88={'count':0x0,'rows':[]};var _0x383085=_[_0x1e59('0x28')](db['ZohoAccount'][_0x1e59('0x29')],function(_0x1aa7ff){return{'name':_0x1aa7ff[_0x1e59('0x2a')],'type':_0x1aa7ff[_0x1e59('0x2b')][_0x1e59('0x2c')]};});_0x211523[_0x1e59('0x2d')]=_[_0x1e59('0x28')](_0x383085,_0x1e59('0x25'));_0x211523[_0x1e59('0x2e')]=_[_0x1e59('0x2f')](_0xc40d32['query']);_0x211523[_0x1e59('0x30')]=_[_0x1e59('0x31')](_0x211523[_0x1e59('0x2d')],_0x211523[_0x1e59('0x2e')]);_0x366765[_0x1e59('0x32')]=_[_0x1e59('0x31')](_0x211523['model'],qs[_0x1e59('0x33')](_0xc40d32[_0x1e59('0x2e')]['fields']));_0x366765[_0x1e59('0x32')]=_0x366765[_0x1e59('0x32')][_0x1e59('0x34')]?_0x366765[_0x1e59('0x32')]:_0x211523[_0x1e59('0x2d')];if(!_0xc40d32['query'][_0x1e59('0x35')](_0x1e59('0x36'))){_0x366765['limit']=qs[_0x1e59('0x1c')](_0xc40d32['query'][_0x1e59('0x1c')]);_0x366765['offset']=qs[_0x1e59('0x19')](_0xc40d32['query'][_0x1e59('0x19')]);}_0x366765[_0x1e59('0x37')]=qs[_0x1e59('0x38')](_0xc40d32['query'][_0x1e59('0x38')]);_0x366765[_0x1e59('0x39')]=qs[_0x1e59('0x30')](_[_0x1e59('0x3a')](_0xc40d32[_0x1e59('0x2e')],_0x211523[_0x1e59('0x30')]),_0x383085);if(_0xc40d32[_0x1e59('0x2e')][_0x1e59('0x3b')]){_0x366765['where']=_[_0x1e59('0x3c')](_0x366765[_0x1e59('0x39')],{'$or':_['map'](_0x383085,function(_0x10c1f6){if(_0x10c1f6[_0x1e59('0x2b')]!==_0x1e59('0x3d')){var _0x21fbd0={};_0x21fbd0[_0x10c1f6[_0x1e59('0x25')]]={'$like':'%'+_0xc40d32[_0x1e59('0x2e')][_0x1e59('0x3b')]+'%'};return _0x21fbd0;}})});}_0x366765=_[_0x1e59('0x3c')]({},_0x366765,_0xc40d32['options']);var _0xddc982={'where':_0x366765[_0x1e59('0x39')]};return db[_0x1e59('0x3e')]['count'](_0xddc982)[_0x1e59('0x22')](function(_0xc2ad59){_0x306b88[_0x1e59('0x1b')]=_0xc2ad59;if(_0xc40d32[_0x1e59('0x2e')][_0x1e59('0x3f')]){_0x366765['include']=[{'all':!![]}];}return db[_0x1e59('0x3e')][_0x1e59('0x40')](_0x366765);})[_0x1e59('0x22')](function(_0x4462a4){_0x306b88[_0x1e59('0x41')]=_0x4462a4;return _0x306b88;})['then'](respondWithFilteredResult(_0x3fd6c8,_0x366765))['catch'](handleError(_0x3fd6c8,null));};exports[_0x1e59('0x42')]=function(_0x58a611,_0xc8aa93){var _0x527380={'raw':![],'where':{'id':_0x58a611[_0x1e59('0x43')]['id']}},_0x55f561={};_0x55f561[_0x1e59('0x2d')]=_['keys'](db[_0x1e59('0x3e')][_0x1e59('0x29')]);_0x55f561[_0x1e59('0x2e')]=_[_0x1e59('0x2f')](_0x58a611['query']);_0x55f561[_0x1e59('0x30')]=_['intersection'](_0x55f561[_0x1e59('0x2d')],_0x55f561[_0x1e59('0x2e')]);_0x527380[_0x1e59('0x32')]=_['intersection'](_0x55f561[_0x1e59('0x2d')],qs[_0x1e59('0x33')](_0x58a611[_0x1e59('0x2e')][_0x1e59('0x33')]));_0x527380[_0x1e59('0x32')]=_0x527380['attributes']['length']?_0x527380[_0x1e59('0x32')]:_0x55f561['model'];if(_0x58a611[_0x1e59('0x2e')][_0x1e59('0x3f')]){_0x527380[_0x1e59('0x44')]=[{'all':!![]}];}_0x527380=_[_0x1e59('0x3c')]({},_0x527380,_0x58a611[_0x1e59('0x45')]);return db['ZohoAccount'][_0x1e59('0x46')](_0x527380)[_0x1e59('0x22')](handleEntityNotFound(_0xc8aa93,null))[_0x1e59('0x22')](respondWithResult(_0xc8aa93,null))[_0x1e59('0x47')](handleError(_0xc8aa93,null));};exports[_0x1e59('0x48')]=function(_0xa9198a,_0xbce277){return db['ZohoAccount'][_0x1e59('0x48')](_0xa9198a[_0x1e59('0x49')],{})[_0x1e59('0x22')](respondWithResult(_0xbce277,0xc9))[_0x1e59('0x47')](handleError(_0xbce277,null));};exports[_0x1e59('0x21')]=function(_0xf5be46,_0x532871){if(_0xf5be46[_0x1e59('0x49')]['id']){delete _0xf5be46[_0x1e59('0x49')]['id'];}return db[_0x1e59('0x3e')]['find']({'where':{'id':_0xf5be46[_0x1e59('0x43')]['id']}})[_0x1e59('0x22')](handleEntityNotFound(_0x532871,null))[_0x1e59('0x22')](saveUpdates(_0xf5be46['body'],null))[_0x1e59('0x22')](respondWithResult(_0x532871,null))[_0x1e59('0x47')](handleError(_0x532871,null));};exports[_0x1e59('0x23')]=function(_0x5d218d,_0x5b7bd7){return db[_0x1e59('0x3e')][_0x1e59('0x46')]({'where':{'id':_0x5d218d['params']['id']}})[_0x1e59('0x22')](handleEntityNotFound(_0x5b7bd7,null))['then'](removeEntity(_0x5b7bd7,null))[_0x1e59('0x47')](handleError(_0x5b7bd7,null));};exports[_0x1e59('0x4a')]=function(_0x50c9d7,_0xaf8e65,_0x46a4c9){var _0x192611={};var _0x4c5e80={};var _0x58bf26;var _0x23c662;return db[_0x1e59('0x3e')][_0x1e59('0x4b')]({'where':{'id':_0x50c9d7['params']['id']}})[_0x1e59('0x22')](handleEntityNotFound(_0xaf8e65,null))['then'](function(_0x3eb2d1){if(_0x3eb2d1){_0x58bf26=_0x3eb2d1;_0x4c5e80['model']=_[_0x1e59('0x2f')](db['ZohoConfiguration'][_0x1e59('0x29')]);_0x4c5e80[_0x1e59('0x2e')]=_[_0x1e59('0x2f')](_0x50c9d7[_0x1e59('0x2e')]);_0x4c5e80['filters']=_[_0x1e59('0x31')](_0x4c5e80[_0x1e59('0x2d')],_0x4c5e80[_0x1e59('0x2e')]);_0x192611[_0x1e59('0x32')]=_[_0x1e59('0x31')](_0x4c5e80[_0x1e59('0x2d')],qs['fields'](_0x50c9d7['query'][_0x1e59('0x33')]));_0x192611[_0x1e59('0x32')]=_0x192611[_0x1e59('0x32')][_0x1e59('0x34')]?_0x192611[_0x1e59('0x32')]:_0x4c5e80[_0x1e59('0x2d')];_0x192611[_0x1e59('0x37')]=qs[_0x1e59('0x38')](_0x50c9d7[_0x1e59('0x2e')][_0x1e59('0x38')]);_0x192611[_0x1e59('0x39')]=qs[_0x1e59('0x30')](_['pick'](_0x50c9d7[_0x1e59('0x2e')],_0x4c5e80[_0x1e59('0x30')]));if(_0x50c9d7[_0x1e59('0x2e')][_0x1e59('0x3b')]){_0x192611[_0x1e59('0x39')]=_[_0x1e59('0x3c')](_0x192611[_0x1e59('0x39')],{'$or':_[_0x1e59('0x28')](_0x192611[_0x1e59('0x32')],function(_0x299880){var _0x1c9967={};_0x1c9967[_0x299880]={'$like':'%'+_0x50c9d7[_0x1e59('0x2e')][_0x1e59('0x3b')]+'%'};return _0x1c9967;})});}_0x192611=_[_0x1e59('0x3c')]({},_0x192611,_0x50c9d7['options']);return _0x58bf26[_0x1e59('0x4a')](_0x192611);}})[_0x1e59('0x22')](function(_0xce6528){if(_0xce6528){_0x23c662=_0xce6528[_0x1e59('0x34')];if(!_0x50c9d7['query'][_0x1e59('0x35')](_0x1e59('0x36'))){_0x192611[_0x1e59('0x1c')]=qs[_0x1e59('0x1c')](_0x50c9d7[_0x1e59('0x2e')]['limit']);_0x192611['offset']=qs[_0x1e59('0x19')](_0x50c9d7[_0x1e59('0x2e')]['offset']);}return _0x58bf26[_0x1e59('0x4a')](_0x192611);}})[_0x1e59('0x22')](function(_0x3265d5){if(_0x3265d5){return _0x3265d5?{'count':_0x23c662,'rows':_0x3265d5}:null;}})[_0x1e59('0x22')](respondWithResult(_0xaf8e65,null))[_0x1e59('0x47')](handleError(_0xaf8e65,null));};exports[_0x1e59('0x4c')]=function(_0x16cb24,_0x2bc2b6,_0x382dc1){if(_0x16cb24[_0x1e59('0x49')]['id']){delete _0x16cb24[_0x1e59('0x49')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x16cb24['params']['id']}})[_0x1e59('0x22')](handleEntityNotFound(_0x2bc2b6,null))[_0x1e59('0x22')](function(_0x67cdca){if(_0x67cdca){_0x16cb24[_0x1e59('0x49')][_0x1e59('0x4d')]=_0x67cdca['id'];_0x16cb24[_0x1e59('0x49')][_0x1e59('0x4e')]=integrations[_0x1e59('0x4f')](_0x16cb24[_0x1e59('0x49')][_0x1e59('0x50')],_0x16cb24[_0x1e59('0x49')][_0x1e59('0x2b')]);_0x16cb24[_0x1e59('0x49')]['Descriptions']=integrations[_0x1e59('0x51')](_0x16cb24['body'][_0x1e59('0x50')],_0x16cb24['body']['type']);return db['ZohoConfiguration'][_0x1e59('0x48')](_0x16cb24['body'],{'include':[{'model':db['ZohoField'],'as':_0x1e59('0x4e')},{'model':db[_0x1e59('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2bc2b6,null))[_0x1e59('0x47')](handleError(_0x2bc2b6,null));};function getAccessToken(_0x3b646a){return new Promise(function(_0x6a5b7e,_0x4cf643){var _0x39fe89;switch(_0x3b646a[_0x1e59('0x53')]){case'US':_0x39fe89=_0x1e59('0x54');break;case'AU':_0x39fe89=_0x1e59('0x55');break;case'EU':_0x39fe89=_0x1e59('0x56');break;case'IN':_0x39fe89=_0x1e59('0x57');break;case'CN':_0x39fe89='https://accounts.zoho.com.cn';break;default:_0x39fe89=_0x1e59('0x56');break;}var _0x35d906={'method':_0x1e59('0x58'),'uri':_0x39fe89+_0x1e59('0x59'),'qs':{'refresh_token':_0x3b646a[_0x1e59('0x5a')],'client_id':_0x3b646a[_0x1e59('0x5b')],'client_secret':_0x3b646a[_0x1e59('0x5c')],'grant_type':_0x1e59('0x5d')},'json':!![]};return rp(_0x35d906)[_0x1e59('0x22')](function(_0x37033c){if(_0x37033c[_0x1e59('0x5e')]){_0x6a5b7e(_0x37033c[_0x1e59('0x5e')]);}else{_0x4cf643(_0x1e59('0x5f'));}})['catch'](function(_0x45b066){_0x4cf643(_0x45b066);});});}exports[_0x1e59('0x60')]=function(_0x4ca69a,_0x411413,_0x2949f7){var _0xc8a1ac,_0x286a27,_0x58852d,_0x4960e1,_0x4dc35e;return db[_0x1e59('0x3e')]['findOne']({'where':{'id':_0x4ca69a['params']['id']},'attributes':['id','host',_0x1e59('0x53'),_0x1e59('0x5b'),_0x1e59('0x5c'),_0x1e59('0x61'),_0x1e59('0x62'),_0x1e59('0x5a')]})[_0x1e59('0x22')](handleEntityNotFound(_0x411413,null))['then'](function(_0x1243f8){_0x4dc35e=_0x1243f8;_0xc8a1ac=_0x4dc35e[_0x1e59('0x63')];_0x286a27=_0xc8a1ac==='zoho.eu'?'eu':'com';_0x58852d=_0x4dc35e[_0x1e59('0x61')];var _0xe588bd=_0x58852d[_0x1e59('0x64')](-0x1);if(_0xe588bd==='/'||_0xe588bd==='\x5c'||_0xe588bd===':'){_0x58852d=_0x58852d[_0x1e59('0x65')](0x0,_0x58852d['lastIndexOf'](_0xe588bd));}if(!_0x4dc35e['refreshToken']){throw new Error(_0x1e59('0x66'));}return getAccessToken(_0x4dc35e);})[_0x1e59('0x22')](function(_0x2be8fd){if(_0x2be8fd){return rp({'method':_0x1e59('0x67'),'uri':util[_0x1e59('0x68')](_0x1e59('0x69'),_0x286a27),'qs':{'module':_0x1e59('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2be8fd},'json':!![]});}})[_0x1e59('0x22')](function(_0x1ce9ea){if(_0x1ce9ea){if(_0x1ce9ea['response']&&_0x1ce9ea['response']['error']){throw new Error(_0x1ce9ea[_0x1e59('0x6b')][_0x1e59('0x24')][_0x1e59('0x6c')]);}var _0x3937dc=[];var _0x3cf4b4=[];var _0x19c257=['Owner','Subject',_0x1e59('0x6d'),_0x1e59('0x6e'),_0x1e59('0x6f'),_0x1e59('0x70'),'Call_Start_Time',_0x1e59('0x71')];_0x3cf4b4=_[_0x1e59('0x72')](_0x1ce9ea[_0x1e59('0x33')],function(_0x27590d){return _0x19c257[_0x1e59('0x73')](_0x27590d[_0x1e59('0x74')]);});for(var _0x119b57=0x0;_0x119b57<_0x3cf4b4[_0x1e59('0x34')];_0x119b57++){if(_0x3cf4b4[_0x119b57][_0x1e59('0x75')]===![]){_0x3937dc[_0x1e59('0x76')]({'id':_0x3cf4b4[_0x119b57]['id'],'name':_0x3cf4b4[_0x119b57][_0x1e59('0x77')],'custom':_0x3cf4b4[_0x119b57][_0x1e59('0x78')],'options':_0x3cf4b4[_0x119b57][_0x1e59('0x79')]===_0x1e59('0x7a')&&_0x3cf4b4[_0x119b57][_0x1e59('0x7b')]['length']>-0x1?_[_0x1e59('0x28')](_0x3cf4b4[_0x119b57][_0x1e59('0x7b')],function(_0x3f25d0){return{'name':_0x3f25d0,'value':_0x3f25d0};}):[]});}}return{'count':_0x3937dc[_0x1e59('0x34')],'rows':_0x3937dc};}else{return{'count':0x0,'rows':[]};}})[_0x1e59('0x22')](respondWithResult(_0x411413,null))['catch'](function(_0x3ea4a0){var _0x583623=_0x4ca69a[_0x1e59('0x2e')]['test']?0x1f4:_0x3ea4a0[_0x1e59('0x7c')]||0x1f4;logger[_0x1e59('0x24')](_0x1e59('0x7d'),'getFields',_0x583623,JSON[_0x1e59('0x7e')](_0x3ea4a0));delete _0x3ea4a0[_0x1e59('0x25')];if(_0x583623===0x191){_0x583623=0x190;}_0x411413[_0x1e59('0x18')](_0x583623)[_0x1e59('0x26')](_0x4ca69a[_0x1e59('0x2e')][_0x1e59('0x7f')]?{'message':_0x1e59('0x80'),'statusCode':_0x3ea4a0[_0x1e59('0x7c')]}:_0x3ea4a0);});}; \ No newline at end of file +var _0x1781=['../../config/license/util','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','include','findAll','rows','catch','find','create','body','params','ZohoConfiguration','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','clientSecret','serverUrl','code','com','substring','lastIndexOf','GET','format','Calls','response','message','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x18b9a8,_0x1770b6){var _0x4a0a8f=function(_0x80ea93){while(--_0x80ea93){_0x18b9a8['push'](_0x18b9a8['shift']());}};_0x4a0a8f(++_0x1770b6);}(_0x1781,0xeb));var _0x1178=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1781[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x1178('0x0'));var rimraf=require(_0x1178('0x1'));var zipdir=require(_0x1178('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1178('0x3'));var moment=require('moment');var BPromise=require(_0x1178('0x4'));var Mustache=require('mustache');var util=require(_0x1178('0x5'));var path=require(_0x1178('0x6'));var sox=require(_0x1178('0x7'));var csv=require(_0x1178('0x8'));var ejs=require(_0x1178('0x9'));var fs=require('fs');var fs_extra=require(_0x1178('0xa'));var _=require('lodash');var squel=require(_0x1178('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1178('0xc'));var toCsv=require(_0x1178('0x8'));var querystring=require(_0x1178('0xd'));var Papa=require(_0x1178('0xe'));var Redis=require('ioredis');var authService=require(_0x1178('0xf'));var qs=require(_0x1178('0x10'));var as=require(_0x1178('0x11'));var hardwareService=require(_0x1178('0x12'));var logger=require(_0x1178('0x13'))(_0x1178('0x14'));var utils=require(_0x1178('0x15'));var config=require(_0x1178('0x16'));var licenseUtil=require(_0x1178('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x156a50,_0x1c9dca){_0x1c9dca=_0x1c9dca||0xcc;return function(_0x5a7c88){if(_0x5a7c88){return _0x156a50[_0x1178('0x18')](_0x1c9dca);}return _0x156a50[_0x1178('0x19')](_0x1c9dca)[_0x1178('0x1a')]();};}function respondWithResult(_0x3b2bda,_0x5b4293){_0x5b4293=_0x5b4293||0xc8;return function(_0x50c31f){if(_0x50c31f){return _0x3b2bda[_0x1178('0x19')](_0x5b4293)['json'](_0x50c31f);}};}function respondWithFilteredResult(_0xa2f4cc,_0x3bc5fa){return function(_0x597b06){if(_0x597b06){var _0x2f3319=typeof _0x3bc5fa[_0x1178('0x1b')]===_0x1178('0x1c')&&typeof _0x3bc5fa[_0x1178('0x1d')]===_0x1178('0x1c');var _0x49fb54=_0x597b06['count'];var _0x38431b=_0x2f3319?0x0:_0x3bc5fa[_0x1178('0x1b')];var _0xb0202=_0x2f3319?_0x597b06['count']:_0x3bc5fa['offset']+_0x3bc5fa['limit'];var _0x2fa2eb;if(_0xb0202>=_0x49fb54){_0xb0202=_0x49fb54;_0x2fa2eb=0xc8;}else{_0x2fa2eb=0xce;}_0xa2f4cc[_0x1178('0x19')](_0x2fa2eb);return _0xa2f4cc['set'](_0x1178('0x1e'),_0x38431b+'-'+_0xb0202+'/'+_0x49fb54)[_0x1178('0x1f')](_0x597b06);}return null;};}function patchUpdates(_0x39ec1a){return function(_0x41f1ca){try{jsonpatch[_0x1178('0x20')](_0x41f1ca,_0x39ec1a,!![]);}catch(_0x5376e2){return BPromise[_0x1178('0x21')](_0x5376e2);}return _0x41f1ca[_0x1178('0x22')]();};}function saveUpdates(_0xc3d893,_0x47ae2d){return function(_0x10ccfd){if(_0x10ccfd){return _0x10ccfd[_0x1178('0x23')](_0xc3d893)[_0x1178('0x24')](function(_0x34e733){return _0x34e733;});}return null;};}function removeEntity(_0x4bc57a,_0x5bc0d7){return function(_0x121c67){if(_0x121c67){return _0x121c67[_0x1178('0x25')]()[_0x1178('0x24')](function(){_0x4bc57a['status'](0xcc)[_0x1178('0x1a')]();});}};}function handleEntityNotFound(_0x3e57a5,_0x3c0e40){return function(_0x24b713){if(!_0x24b713){_0x3e57a5[_0x1178('0x18')](0x194);}return _0x24b713;};}function handleError(_0x376f83,_0x15340e){_0x15340e=_0x15340e||0x1f4;return function(_0x564eb8){logger[_0x1178('0x26')](_0x564eb8['stack']);if(_0x564eb8[_0x1178('0x27')]){delete _0x564eb8[_0x1178('0x27')];}_0x376f83[_0x1178('0x19')](_0x15340e)[_0x1178('0x28')](_0x564eb8);};}exports[_0x1178('0x29')]=function(_0x3fc49f,_0x409c90){var _0x15bf2f={},_0x434856={},_0x5cc40c={'count':0x0,'rows':[]};var _0x2d0ea2=_['map'](db[_0x1178('0x2a')][_0x1178('0x2b')],function(_0x35de47){return{'name':_0x35de47[_0x1178('0x2c')],'type':_0x35de47[_0x1178('0x2d')][_0x1178('0x2e')]};});_0x434856[_0x1178('0x2f')]=_[_0x1178('0x30')](_0x2d0ea2,'name');_0x434856[_0x1178('0x31')]=_[_0x1178('0x32')](_0x3fc49f[_0x1178('0x31')]);_0x434856[_0x1178('0x33')]=_[_0x1178('0x34')](_0x434856[_0x1178('0x2f')],_0x434856[_0x1178('0x31')]);_0x15bf2f['attributes']=_[_0x1178('0x34')](_0x434856[_0x1178('0x2f')],qs[_0x1178('0x35')](_0x3fc49f[_0x1178('0x31')][_0x1178('0x35')]));_0x15bf2f[_0x1178('0x36')]=_0x15bf2f[_0x1178('0x36')][_0x1178('0x37')]?_0x15bf2f['attributes']:_0x434856[_0x1178('0x2f')];if(!_0x3fc49f[_0x1178('0x31')][_0x1178('0x38')](_0x1178('0x39'))){_0x15bf2f['limit']=qs['limit'](_0x3fc49f['query'][_0x1178('0x1d')]);_0x15bf2f[_0x1178('0x1b')]=qs[_0x1178('0x1b')](_0x3fc49f[_0x1178('0x31')]['offset']);}_0x15bf2f[_0x1178('0x3a')]=qs[_0x1178('0x3b')](_0x3fc49f[_0x1178('0x31')][_0x1178('0x3b')]);_0x15bf2f[_0x1178('0x3c')]=qs[_0x1178('0x33')](_['pick'](_0x3fc49f[_0x1178('0x31')],_0x434856[_0x1178('0x33')]),_0x2d0ea2);if(_0x3fc49f[_0x1178('0x31')][_0x1178('0x3d')]){_0x15bf2f[_0x1178('0x3c')]=_[_0x1178('0x3e')](_0x15bf2f[_0x1178('0x3c')],{'$or':_['map'](_0x2d0ea2,function(_0x2cb853){if(_0x2cb853[_0x1178('0x2d')]!=='VIRTUAL'){var _0x3daa96={};_0x3daa96[_0x2cb853[_0x1178('0x27')]]={'$like':'%'+_0x3fc49f['query'][_0x1178('0x3d')]+'%'};return _0x3daa96;}})});}_0x15bf2f=_[_0x1178('0x3e')]({},_0x15bf2f,_0x3fc49f[_0x1178('0x3f')]);var _0xf814db={'where':_0x15bf2f[_0x1178('0x3c')]};return db[_0x1178('0x2a')][_0x1178('0x40')](_0xf814db)['then'](function(_0x388739){_0x5cc40c[_0x1178('0x40')]=_0x388739;if(_0x3fc49f[_0x1178('0x31')]['includeAll']){_0x15bf2f[_0x1178('0x41')]=[{'all':!![]}];}return db[_0x1178('0x2a')][_0x1178('0x42')](_0x15bf2f);})[_0x1178('0x24')](function(_0x3046ff){_0x5cc40c[_0x1178('0x43')]=_0x3046ff;return _0x5cc40c;})[_0x1178('0x24')](respondWithFilteredResult(_0x409c90,_0x15bf2f))[_0x1178('0x44')](handleError(_0x409c90,null));};exports['show']=function(_0x2e605a,_0x3f6621){var _0x570a5d={'raw':![],'where':{'id':_0x2e605a['params']['id']}},_0x12a98f={};_0x12a98f[_0x1178('0x2f')]=_['keys'](db[_0x1178('0x2a')][_0x1178('0x2b')]);_0x12a98f['query']=_[_0x1178('0x32')](_0x2e605a[_0x1178('0x31')]);_0x12a98f[_0x1178('0x33')]=_[_0x1178('0x34')](_0x12a98f['model'],_0x12a98f[_0x1178('0x31')]);_0x570a5d['attributes']=_['intersection'](_0x12a98f[_0x1178('0x2f')],qs[_0x1178('0x35')](_0x2e605a[_0x1178('0x31')]['fields']));_0x570a5d[_0x1178('0x36')]=_0x570a5d[_0x1178('0x36')][_0x1178('0x37')]?_0x570a5d['attributes']:_0x12a98f[_0x1178('0x2f')];if(_0x2e605a[_0x1178('0x31')]['includeAll']){_0x570a5d[_0x1178('0x41')]=[{'all':!![]}];}_0x570a5d=_[_0x1178('0x3e')]({},_0x570a5d,_0x2e605a[_0x1178('0x3f')]);return db[_0x1178('0x2a')][_0x1178('0x45')](_0x570a5d)[_0x1178('0x24')](handleEntityNotFound(_0x3f6621,null))['then'](respondWithResult(_0x3f6621,null))[_0x1178('0x44')](handleError(_0x3f6621,null));};exports[_0x1178('0x46')]=function(_0x5a305e,_0x164ac6){return db['ZohoAccount'][_0x1178('0x46')](_0x5a305e[_0x1178('0x47')],{})[_0x1178('0x24')](respondWithResult(_0x164ac6,0xc9))[_0x1178('0x44')](handleError(_0x164ac6,null));};exports[_0x1178('0x23')]=function(_0x10d8eb,_0x294f67){if(_0x10d8eb[_0x1178('0x47')]['id']){delete _0x10d8eb[_0x1178('0x47')]['id'];}return db[_0x1178('0x2a')][_0x1178('0x45')]({'where':{'id':_0x10d8eb[_0x1178('0x48')]['id']}})[_0x1178('0x24')](handleEntityNotFound(_0x294f67,null))['then'](saveUpdates(_0x10d8eb[_0x1178('0x47')],null))[_0x1178('0x24')](respondWithResult(_0x294f67,null))[_0x1178('0x44')](handleError(_0x294f67,null));};exports[_0x1178('0x25')]=function(_0x3691c3,_0x2dcc74){return db['ZohoAccount']['find']({'where':{'id':_0x3691c3[_0x1178('0x48')]['id']}})['then'](handleEntityNotFound(_0x2dcc74,null))[_0x1178('0x24')](removeEntity(_0x2dcc74,null))[_0x1178('0x44')](handleError(_0x2dcc74,null));};exports['getConfigurations']=function(_0x35619c,_0xef8f06,_0xd04095){var _0x36d925={};var _0x3cc87f={};var _0x3e7ce3;var _0x3156f1;return db[_0x1178('0x2a')]['findOne']({'where':{'id':_0x35619c['params']['id']}})[_0x1178('0x24')](handleEntityNotFound(_0xef8f06,null))[_0x1178('0x24')](function(_0x2c144a){if(_0x2c144a){_0x3e7ce3=_0x2c144a;_0x3cc87f['model']=_['keys'](db[_0x1178('0x49')][_0x1178('0x2b')]);_0x3cc87f[_0x1178('0x31')]=_[_0x1178('0x32')](_0x35619c[_0x1178('0x31')]);_0x3cc87f[_0x1178('0x33')]=_['intersection'](_0x3cc87f['model'],_0x3cc87f[_0x1178('0x31')]);_0x36d925[_0x1178('0x36')]=_[_0x1178('0x34')](_0x3cc87f[_0x1178('0x2f')],qs[_0x1178('0x35')](_0x35619c[_0x1178('0x31')]['fields']));_0x36d925['attributes']=_0x36d925['attributes'][_0x1178('0x37')]?_0x36d925['attributes']:_0x3cc87f['model'];_0x36d925[_0x1178('0x3a')]=qs[_0x1178('0x3b')](_0x35619c[_0x1178('0x31')]['sort']);_0x36d925[_0x1178('0x3c')]=qs[_0x1178('0x33')](_[_0x1178('0x4a')](_0x35619c[_0x1178('0x31')],_0x3cc87f[_0x1178('0x33')]));if(_0x35619c[_0x1178('0x31')][_0x1178('0x3d')]){_0x36d925[_0x1178('0x3c')]=_[_0x1178('0x3e')](_0x36d925[_0x1178('0x3c')],{'$or':_['map'](_0x36d925[_0x1178('0x36')],function(_0x3cfbc1){var _0x3e322={};_0x3e322[_0x3cfbc1]={'$like':'%'+_0x35619c[_0x1178('0x31')]['filter']+'%'};return _0x3e322;})});}_0x36d925=_[_0x1178('0x3e')]({},_0x36d925,_0x35619c[_0x1178('0x3f')]);return _0x3e7ce3['getConfigurations'](_0x36d925);}})[_0x1178('0x24')](function(_0x563655){if(_0x563655){_0x3156f1=_0x563655[_0x1178('0x37')];if(!_0x35619c['query']['hasOwnProperty'](_0x1178('0x39'))){_0x36d925[_0x1178('0x1d')]=qs[_0x1178('0x1d')](_0x35619c[_0x1178('0x31')][_0x1178('0x1d')]);_0x36d925['offset']=qs[_0x1178('0x1b')](_0x35619c['query'][_0x1178('0x1b')]);}return _0x3e7ce3['getConfigurations'](_0x36d925);}})[_0x1178('0x24')](function(_0x5b4129){if(_0x5b4129){return _0x5b4129?{'count':_0x3156f1,'rows':_0x5b4129}:null;}})[_0x1178('0x24')](respondWithResult(_0xef8f06,null))[_0x1178('0x44')](handleError(_0xef8f06,null));};exports[_0x1178('0x4b')]=function(_0x54941a,_0x33d352,_0x10512b){if(_0x54941a[_0x1178('0x47')]['id']){delete _0x54941a[_0x1178('0x47')]['id'];}return db[_0x1178('0x2a')][_0x1178('0x4c')]({'where':{'id':_0x54941a[_0x1178('0x48')]['id']}})[_0x1178('0x24')](handleEntityNotFound(_0x33d352,null))[_0x1178('0x24')](function(_0x3a2b14){if(_0x3a2b14){_0x54941a[_0x1178('0x47')][_0x1178('0x4d')]=_0x3a2b14['id'];_0x54941a['body'][_0x1178('0x4e')]=integrations[_0x1178('0x4f')](_0x54941a[_0x1178('0x47')][_0x1178('0x50')],_0x54941a[_0x1178('0x47')]['type']);_0x54941a['body']['Descriptions']=integrations[_0x1178('0x51')](_0x54941a['body']['channel'],_0x54941a['body'][_0x1178('0x2d')]);return db[_0x1178('0x49')][_0x1178('0x46')](_0x54941a[_0x1178('0x47')],{'include':[{'model':db[_0x1178('0x52')],'as':_0x1178('0x4e')},{'model':db['ZohoField'],'as':_0x1178('0x53')}]});}return null;})[_0x1178('0x24')](respondWithResult(_0x33d352,null))[_0x1178('0x44')](handleError(_0x33d352,null));};function getAccessToken(_0x2640d0){return new Promise(function(_0x4a8cbe,_0xe9f72f){var _0x475657;switch(_0x2640d0[_0x1178('0x54')]){case'US':_0x475657='https://accounts.zoho.com';break;case'AU':_0x475657=_0x1178('0x55');break;case'EU':_0x475657=_0x1178('0x56');break;case'IN':_0x475657=_0x1178('0x57');break;case'CN':_0x475657=_0x1178('0x58');break;default:_0x475657=_0x1178('0x56');break;}var _0x5bd1e5={'method':_0x1178('0x59'),'uri':_0x475657+_0x1178('0x5a'),'qs':{'refresh_token':_0x2640d0[_0x1178('0x5b')],'client_id':_0x2640d0['clientId'],'client_secret':_0x2640d0['clientSecret'],'grant_type':_0x1178('0x5c')},'json':!![]};return rp(_0x5bd1e5)[_0x1178('0x24')](function(_0x15a1d5){if(_0x15a1d5['access_token']){_0x4a8cbe(_0x15a1d5[_0x1178('0x5d')]);}else{_0xe9f72f(_0x1178('0x5e'));}})['catch'](function(_0x37d84d){_0xe9f72f(_0x37d84d);});});}exports['getFields']=function(_0x154b8d,_0x4eecf9,_0x3b9d1f){var _0x2f973d,_0x20cf41,_0x5e3404,_0xf71e58,_0x2976ed;return db['ZohoAccount']['findOne']({'where':{'id':_0x154b8d['params']['id']},'attributes':['id',_0x1178('0x5f'),'zone',_0x1178('0x60'),_0x1178('0x61'),_0x1178('0x62'),_0x1178('0x63'),_0x1178('0x5b')]})['then'](handleEntityNotFound(_0x4eecf9,null))[_0x1178('0x24')](function(_0x598d01){_0x2976ed=_0x598d01;_0x2f973d=_0x2976ed[_0x1178('0x5f')];_0x20cf41=_0x2f973d==='zoho.eu'?'eu':_0x1178('0x64');_0x5e3404=_0x2976ed[_0x1178('0x62')];var _0x3e4d64=_0x5e3404['slice'](-0x1);if(_0x3e4d64==='/'||_0x3e4d64==='\x5c'||_0x3e4d64===':'){_0x5e3404=_0x5e3404[_0x1178('0x65')](0x0,_0x5e3404[_0x1178('0x66')](_0x3e4d64));}if(!_0x2976ed[_0x1178('0x5b')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2976ed);})[_0x1178('0x24')](function(_0x5bb0d8){if(_0x5bb0d8){return rp({'method':_0x1178('0x67'),'uri':util[_0x1178('0x68')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x20cf41),'qs':{'module':_0x1178('0x69')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5bb0d8},'json':!![]});}})['then'](function(_0x3417b0){if(_0x3417b0){if(_0x3417b0[_0x1178('0x6a')]&&_0x3417b0['response'][_0x1178('0x26')]){throw new Error(_0x3417b0[_0x1178('0x6a')]['error'][_0x1178('0x6b')]);}var _0xc45f63=[];var _0x195833=[];var _0x958f0=['Owner',_0x1178('0x6c'),'Description',_0x1178('0x6d'),_0x1178('0x6e'),_0x1178('0x6f'),_0x1178('0x70'),_0x1178('0x71')];_0x195833=_[_0x1178('0x72')](_0x3417b0['fields'],function(_0x2aeec5){return _0x958f0[_0x1178('0x73')](_0x2aeec5['api_name']);});for(var _0x38decf=0x0;_0x38decf<_0x195833['length'];_0x38decf++){if(_0x195833[_0x38decf][_0x1178('0x74')]===![]){_0xc45f63[_0x1178('0x75')]({'id':_0x195833[_0x38decf]['id'],'name':_0x195833[_0x38decf][_0x1178('0x76')],'custom':_0x195833[_0x38decf][_0x1178('0x77')],'options':_0x195833[_0x38decf][_0x1178('0x78')]===_0x1178('0x79')&&_0x195833[_0x38decf][_0x1178('0x7a')][_0x1178('0x37')]>-0x1?_[_0x1178('0x30')](_0x195833[_0x38decf][_0x1178('0x7a')],function(_0x2f3557){return{'name':_0x2f3557,'value':_0x2f3557};}):[]});}}return{'count':_0xc45f63[_0x1178('0x37')],'rows':_0xc45f63};}else{return{'count':0x0,'rows':[]};}})[_0x1178('0x24')](respondWithResult(_0x4eecf9,null))[_0x1178('0x44')](function(_0x399546){var _0x2e20c0=_0x154b8d['query'][_0x1178('0x7b')]?0x1f4:_0x399546[_0x1178('0x7c')]||0x1f4;logger['error'](_0x1178('0x7d'),_0x1178('0x7e'),_0x2e20c0,JSON[_0x1178('0x7f')](_0x399546));delete _0x399546[_0x1178('0x27')];if(_0x2e20c0===0x191){_0x2e20c0=0x190;}_0x4eecf9[_0x1178('0x19')](_0x2e20c0)[_0x1178('0x28')](_0x154b8d[_0x1178('0x31')][_0x1178('0x7b')]?{'message':_0x1178('0x80'),'statusCode':_0x399546[_0x1178('0x7c')]}:_0x399546);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6e3101e..963c225 100644 --- a/server/api/intZohoAccount/intZohoAccount.model.js +++ b/server/api/intZohoAccount/intZohoAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2664=['substring','lastIndexOf','https://accounts.zoho.com','POST','authorization_code','application/x-www-form-urlencoded','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ZohoAccount','zone','changed','serverUrl','clientId','clientSecret','host','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','code','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0xec338d,_0x26aa7c){var _0x510522=function(_0x2c3505){while(--_0x2c3505){_0xec338d['push'](_0xec338d['shift']());}};_0x510522(++_0x26aa7c);}(_0x2664,0x146));var _0x4266=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2664[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x4266('0x0'));var util=require('util');var logger=require(_0x4266('0x1'))(_0x4266('0x2'));var moment=require(_0x4266('0x3'));var BPromise=require(_0x4266('0x4'));var rp=require(_0x4266('0x5'));var fs=require('fs');var path=require(_0x4266('0x6'));var rimraf=require(_0x4266('0x7'));var config=require(_0x4266('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4266('0x9')]=function(_0x144291,_0x60f20c){return _0x144291['define'](_0x4266('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x139d4c,_0x40d44f,_0x505ccd){if(_0x139d4c['changed'](_0x4266('0xb'))||_0x139d4c[_0x4266('0xc')](_0x4266('0xd'))||_0x139d4c[_0x4266('0xc')](_0x4266('0xe'))||_0x139d4c[_0x4266('0xc')](_0x4266('0xf'))||_0x139d4c[_0x4266('0xc')]('code')||_0x139d4c[_0x4266('0xc')](_0x4266('0x10'))){var _0x341395,_0x1c37a4;_0x341395=_0x139d4c[_0x4266('0xd')];var _0x21366e=_0x341395['slice'](-0x1);if(_0x21366e==='/'||_0x21366e==='\x5c'||_0x21366e===':'){_0x341395=_0x341395['substring'](0x0,_0x341395['lastIndexOf'](_0x21366e));}switch(_0x139d4c[_0x4266('0xb')]){case'US':_0x1c37a4='https://accounts.zoho.com';break;case'AU':_0x1c37a4=_0x4266('0x11');break;case'IN':_0x1c37a4=_0x4266('0x12');break;case'CN':_0x1c37a4=_0x4266('0x13');break;default:_0x1c37a4='https://accounts.zoho.eu';break;}var _0x506945={'method':'POST','uri':_0x1c37a4+_0x4266('0x14'),'form':{'grant_type':'authorization_code','client_id':_0x139d4c['clientId'],'client_secret':_0x139d4c[_0x4266('0xf')],'redirect_uri':_0x139d4c[_0x4266('0xd')],'code':_0x139d4c[_0x4266('0x15')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x506945)[_0x4266('0x16')](function(_0x2e59ab){var _0x51e765=JSON[_0x4266('0x17')](_0x2e59ab);if(_0x51e765[_0x4266('0x18')]){_0x139d4c[_0x4266('0x19')]=_0x51e765[_0x4266('0x18')];logger[_0x4266('0x1a')](util['format'](_0x4266('0x1b'),_0x139d4c[_0x4266('0x1c')],_0x139d4c['id']));}else{logger[_0x4266('0x1d')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x139d4c[_0x4266('0x1c')],_0x139d4c['id']),util[_0x4266('0x1e')](_0x51e765,{'showHidden':![],'depth':null}));}return _0x505ccd(null,_0x40d44f);})[_0x4266('0x1f')](function(_0x22b44c){logger[_0x4266('0x1d')](util[_0x4266('0x20')](_0x4266('0x21'),_0x139d4c[_0x4266('0x1c')],_0x139d4c['id']),util[_0x4266('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x505ccd(_0x22b44c);});}else{return _0x505ccd(null,_0x40d44f);}},'beforeUpdate':function(_0x269c65,_0x55e4bf,_0x3054da){if(_0x269c65[_0x4266('0xc')](_0x4266('0xb'))||_0x269c65[_0x4266('0xc')]('serverUrl')||_0x269c65[_0x4266('0xc')](_0x4266('0xe'))||_0x269c65[_0x4266('0xc')](_0x4266('0xf'))||_0x269c65[_0x4266('0xc')]('code')||_0x269c65['changed']('host')){var _0x35ce5b,_0x5deb66;_0x35ce5b=_0x269c65[_0x4266('0xd')];var _0x5ef6bc=_0x35ce5b['slice'](-0x1);if(_0x5ef6bc==='/'||_0x5ef6bc==='\x5c'||_0x5ef6bc===':'){_0x35ce5b=_0x35ce5b[_0x4266('0x22')](0x0,_0x35ce5b[_0x4266('0x23')](_0x5ef6bc));}switch(_0x269c65[_0x4266('0xb')]){case'US':_0x5deb66=_0x4266('0x24');break;case'AU':_0x5deb66='https://accounts.zoho.com.au';break;case'IN':_0x5deb66=_0x4266('0x12');break;case'CN':_0x5deb66=_0x4266('0x13');break;default:_0x5deb66='https://accounts.zoho.eu';break;}var _0x540fc5={'method':_0x4266('0x25'),'uri':_0x5deb66+_0x4266('0x14'),'form':{'grant_type':_0x4266('0x26'),'client_id':_0x269c65[_0x4266('0xe')],'client_secret':_0x269c65[_0x4266('0xf')],'redirect_uri':_0x269c65['serverUrl'],'code':_0x269c65[_0x4266('0x15')]},'headers':{'Content-Type':_0x4266('0x27')}};return rp(_0x540fc5)['then'](function(_0x3537db){var _0x4bd4c1=JSON['parse'](_0x3537db);if(_0x4bd4c1[_0x4266('0x18')]){_0x269c65[_0x4266('0x19')]=_0x4bd4c1['refresh_token'];logger[_0x4266('0x1a')](util['format'](_0x4266('0x1b'),_0x269c65['name'],_0x269c65['id']));}else{logger['error'](util[_0x4266('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x269c65[_0x4266('0x1c')],_0x269c65['id']),util[_0x4266('0x1e')](_0x4bd4c1,{'showHidden':![],'depth':null}));}return _0x3054da(null,_0x55e4bf);})['catch'](function(_0x2c7141){logger[_0x4266('0x1d')](util[_0x4266('0x20')](_0x4266('0x21'),_0x269c65[_0x4266('0x1c')],_0x269c65['id']),util[_0x4266('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x3054da(_0x2c7141);});}else{return _0x3054da(null,_0x55e4bf);}}}});}; \ No newline at end of file +var _0x114a=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','name','error','inspect','catch','slice','/oauth/v2/token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x1ce8bf,_0x3e393b){var _0x3821ce=function(_0x346cc6){while(--_0x346cc6){_0x1ce8bf['push'](_0x1ce8bf['shift']());}};_0x3821ce(++_0x3e393b);}(_0x114a,0xb1));var _0xa114=function(_0x484878,_0x2b6002){_0x484878=_0x484878-0x0;var _0x550ee8=_0x114a[_0x484878];return _0x550ee8;};'use strict';var _=require(_0xa114('0x0'));var util=require('util');var logger=require(_0xa114('0x1'))(_0xa114('0x2'));var moment=require(_0xa114('0x3'));var BPromise=require(_0xa114('0x4'));var rp=require(_0xa114('0x5'));var fs=require('fs');var path=require(_0xa114('0x6'));var rimraf=require('rimraf');var config=require(_0xa114('0x7'));var attributes=require(_0xa114('0x8'));var integrations=require(_0xa114('0x9'));module[_0xa114('0xa')]=function(_0x1742fb,_0x3eef95){return _0x1742fb[_0xa114('0xb')](_0xa114('0xc'),attributes,{'tableName':_0xa114('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b39e9,_0x2d688d,_0x3abbc0){if(_0x1b39e9[_0xa114('0xe')]('zone')||_0x1b39e9[_0xa114('0xe')](_0xa114('0xf'))||_0x1b39e9['changed'](_0xa114('0x10'))||_0x1b39e9[_0xa114('0xe')](_0xa114('0x11'))||_0x1b39e9[_0xa114('0xe')]('code')||_0x1b39e9[_0xa114('0xe')]('host')){var _0x5c3f84,_0x3e7ee9;_0x5c3f84=_0x1b39e9[_0xa114('0xf')];var _0x5dfabb=_0x5c3f84['slice'](-0x1);if(_0x5dfabb==='/'||_0x5dfabb==='\x5c'||_0x5dfabb===':'){_0x5c3f84=_0x5c3f84[_0xa114('0x12')](0x0,_0x5c3f84[_0xa114('0x13')](_0x5dfabb));}switch(_0x1b39e9[_0xa114('0x14')]){case'US':_0x3e7ee9=_0xa114('0x15');break;case'AU':_0x3e7ee9=_0xa114('0x16');break;case'IN':_0x3e7ee9=_0xa114('0x17');break;case'CN':_0x3e7ee9=_0xa114('0x18');break;default:_0x3e7ee9=_0xa114('0x19');break;}var _0x17359b={'method':_0xa114('0x1a'),'uri':_0x3e7ee9+'/oauth/v2/token','form':{'grant_type':_0xa114('0x1b'),'client_id':_0x1b39e9[_0xa114('0x10')],'client_secret':_0x1b39e9['clientSecret'],'redirect_uri':_0x1b39e9[_0xa114('0xf')],'code':_0x1b39e9[_0xa114('0x1c')]},'headers':{'Content-Type':_0xa114('0x1d')}};return rp(_0x17359b)[_0xa114('0x1e')](function(_0x32702d){var _0x29e7e6=JSON[_0xa114('0x1f')](_0x32702d);if(_0x29e7e6[_0xa114('0x20')]){_0x1b39e9['refreshToken']=_0x29e7e6[_0xa114('0x20')];logger[_0xa114('0x21')](util[_0xa114('0x22')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1b39e9[_0xa114('0x23')],_0x1b39e9['id']));}else{logger[_0xa114('0x24')](util[_0xa114('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1b39e9[_0xa114('0x23')],_0x1b39e9['id']),util[_0xa114('0x25')](_0x29e7e6,{'showHidden':![],'depth':null}));}return _0x3abbc0(null,_0x2d688d);})[_0xa114('0x26')](function(_0x3c10e7){logger[_0xa114('0x24')](util[_0xa114('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1b39e9[_0xa114('0x23')],_0x1b39e9['id']),util[_0xa114('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3abbc0(_0x3c10e7);});}else{return _0x3abbc0(null,_0x2d688d);}},'beforeUpdate':function(_0x253113,_0x2dc4ce,_0x59e8db){if(_0x253113[_0xa114('0xe')]('zone')||_0x253113[_0xa114('0xe')](_0xa114('0xf'))||_0x253113['changed'](_0xa114('0x10'))||_0x253113['changed']('clientSecret')||_0x253113[_0xa114('0xe')](_0xa114('0x1c'))||_0x253113[_0xa114('0xe')]('host')){var _0x1dbf71,_0x238e80;_0x1dbf71=_0x253113['serverUrl'];var _0x2d87ae=_0x1dbf71[_0xa114('0x27')](-0x1);if(_0x2d87ae==='/'||_0x2d87ae==='\x5c'||_0x2d87ae===':'){_0x1dbf71=_0x1dbf71[_0xa114('0x12')](0x0,_0x1dbf71[_0xa114('0x13')](_0x2d87ae));}switch(_0x253113['zone']){case'US':_0x238e80='https://accounts.zoho.com';break;case'AU':_0x238e80='https://accounts.zoho.com.au';break;case'IN':_0x238e80=_0xa114('0x17');break;case'CN':_0x238e80=_0xa114('0x18');break;default:_0x238e80=_0xa114('0x19');break;}var _0x354dc5={'method':_0xa114('0x1a'),'uri':_0x238e80+_0xa114('0x28'),'form':{'grant_type':_0xa114('0x1b'),'client_id':_0x253113['clientId'],'client_secret':_0x253113[_0xa114('0x11')],'redirect_uri':_0x253113['serverUrl'],'code':_0x253113['code']},'headers':{'Content-Type':_0xa114('0x1d')}};return rp(_0x354dc5)['then'](function(_0x32b716){var _0x4e7e54=JSON[_0xa114('0x1f')](_0x32b716);if(_0x4e7e54['refresh_token']){_0x253113[_0xa114('0x29')]=_0x4e7e54[_0xa114('0x20')];logger[_0xa114('0x21')](util[_0xa114('0x22')](_0xa114('0x2a'),_0x253113[_0xa114('0x23')],_0x253113['id']));}else{logger[_0xa114('0x24')](util[_0xa114('0x22')](_0xa114('0x2b'),_0x253113['name'],_0x253113['id']),util[_0xa114('0x25')](_0x4e7e54,{'showHidden':![],'depth':null}));}return _0x59e8db(null,_0x2dc4ce);})[_0xa114('0x26')](function(_0x388d0a){logger[_0xa114('0x24')](util[_0xa114('0x22')](_0xa114('0x2b'),_0x253113['name'],_0x253113['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x59e8db(_0x388d0a);});}else{return _0x59e8db(null,_0x2dc4ce);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 938bb4d..0b9817d 100644 --- a/server/api/intZohoAccount/intZohoAccount.rpc.js +++ b/server/api/intZohoAccount/intZohoAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2aa3=['jayson/promise','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','stringify','ShowZohoAccount','ZohoAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x139e39,_0x1b3f77){var _0x8e1bd7=function(_0x26a921){while(--_0x26a921){_0x139e39['push'](_0x139e39['shift']());}};_0x8e1bd7(++_0x1b3f77);}(_0x2aa3,0x83));var _0x32aa=function(_0x3ad8d7,_0x225758){_0x3ad8d7=_0x3ad8d7-0x0;var _0xa4047c=_0x2aa3[_0x3ad8d7];return _0xa4047c;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var moment=require(_0x32aa('0x2'));var BPromise=require(_0x32aa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32aa('0x4'))['db'];var utils=require(_0x32aa('0x5'));var logger=require(_0x32aa('0x6'))(_0x32aa('0x7'));var config=require(_0x32aa('0x8'));var jayson=require(_0x32aa('0x9'));var client=jayson['client'][_0x32aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x112396,_0x3ee18a,_0x20efbe){return new BPromise(function(_0x18ded0,_0x40c96a){return client[_0x32aa('0xb')](_0x112396,_0x20efbe)[_0x32aa('0xc')](function(_0x5d280e){logger[_0x32aa('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x3ee18a,_0x32aa('0xe'));logger[_0x32aa('0xf')](_0x32aa('0x10'),_0x3ee18a,_0x32aa('0xe'),JSON['stringify'](_0x5d280e));if(_0x5d280e[_0x32aa('0x11')]){if(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x12')]===0x1f4){logger['error'](_0x32aa('0x13'),_0x3ee18a,_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);return _0x40c96a(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);}logger[_0x32aa('0x11')](_0x32aa('0x13'),_0x3ee18a,_0x5d280e[_0x32aa('0x11')]['message']);return _0x18ded0(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);}else{logger[_0x32aa('0xd')](_0x32aa('0x13'),_0x3ee18a,_0x32aa('0xe'));_0x18ded0(_0x5d280e['result'][_0x32aa('0x14')]);}})[_0x32aa('0x15')](function(_0x463b91){logger[_0x32aa('0x11')](_0x32aa('0x13'),_0x3ee18a,_0x463b91);_0x40c96a(_0x463b91);});});}exports['GetZohoAccount']=function(_0x5196c0){var _0x3e0a23=this;return new Promise(function(_0x34dcaf,_0x257be0){return db['ZohoAccount']['findAll']({'raw':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x17')]===undefined?!![]:![]:!![],'where':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x18')]||null:null,'attributes':_0x5196c0['options']?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x19')]||null:null,'limit':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x1a')]||null:null,'include':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x5196c0['options'][_0x32aa('0x1b')],function(_0x5c82d2){return{'model':db[_0x5c82d2[_0x32aa('0x1d')]],'as':_0x5c82d2['as'],'attributes':_0x5c82d2[_0x32aa('0x19')],'include':_0x5c82d2['include']?_['map'](_0x5c82d2[_0x32aa('0x1b')],function(_0x313930){return{'model':db[_0x313930[_0x32aa('0x1d')]],'as':_0x313930['as'],'attributes':_0x313930[_0x32aa('0x19')],'include':_0x313930[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x313930[_0x32aa('0x1b')],function(_0x405b03){return{'model':db[_0x405b03[_0x32aa('0x1d')]],'as':_0x405b03['as'],'attributes':_0x405b03['attributes']};}):[]};}):[]};}):[]:[]})[_0x32aa('0xc')](function(_0x2e3a5d){logger['info'](_0x32aa('0x1e'),_0x5196c0);logger['debug']('GetZohoAccount',_0x5196c0,JSON[_0x32aa('0x1f')](_0x2e3a5d));_0x34dcaf(_0x2e3a5d);})[_0x32aa('0x15')](function(_0x1d1c80){logger[_0x32aa('0x11')]('GetZohoAccount',_0x1d1c80[_0x32aa('0x14')],_0x5196c0);_0x257be0(_0x3e0a23[_0x32aa('0x11')](0x1f4,_0x1d1c80[_0x32aa('0x14')]));});});};exports[_0x32aa('0x20')]=function(_0x19efc6){var _0x44887c=this;return new Promise(function(_0x4b0d5a,_0x5b410f){return db[_0x32aa('0x21')][_0x32aa('0x22')]({'raw':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x19efc6['options']?_0x19efc6[_0x32aa('0x16')]['where']||null:null,'attributes':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['attributes']||null:null,'include':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['include']?_[_0x32aa('0x1c')](_0x19efc6[_0x32aa('0x16')][_0x32aa('0x1b')],function(_0xd23473){return{'model':db[_0xd23473[_0x32aa('0x1d')]],'as':_0xd23473['as'],'attributes':_0xd23473[_0x32aa('0x19')],'include':_0xd23473[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0xd23473[_0x32aa('0x1b')],function(_0x2a2f9d){return{'model':db[_0x2a2f9d[_0x32aa('0x1d')]],'as':_0x2a2f9d['as'],'attributes':_0x2a2f9d[_0x32aa('0x19')],'include':_0x2a2f9d[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x2a2f9d['include'],function(_0x5b0fe2){return{'model':db[_0x5b0fe2[_0x32aa('0x1d')]],'as':_0x5b0fe2['as'],'attributes':_0x5b0fe2[_0x32aa('0x19')]};}):[]};}):[]};}):[]:[]})[_0x32aa('0xc')](function(_0x193d10){logger['info'](_0x32aa('0x20'),_0x19efc6);logger[_0x32aa('0xf')](_0x32aa('0x20'),_0x19efc6,JSON[_0x32aa('0x1f')](_0x193d10));_0x4b0d5a(_0x193d10);})[_0x32aa('0x15')](function(_0xa48198){logger[_0x32aa('0x11')](_0x32aa('0x20'),_0xa48198[_0x32aa('0x14')],_0x19efc6);_0x5b410f(_0x44887c[_0x32aa('0x11')](0x1f4,_0xa48198[_0x32aa('0x14')]));});});}; \ No newline at end of file +var _0x6ac2=['find','raw','ShowZohoAccount','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZohoAccount','ZohoAccount','options','attributes','limit','include','model','map','then'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6ac2,0x184));var _0x26ac=function(_0x3974f1,_0x1e3709){_0x3974f1=_0x3974f1-0x0;var _0x2b9f50=_0x6ac2[_0x3974f1];return _0x2b9f50;};'use strict';var _=require(_0x26ac('0x0'));var util=require('util');var moment=require(_0x26ac('0x1'));var BPromise=require(_0x26ac('0x2'));var rs=require(_0x26ac('0x3'));var fs=require('fs');var Redis=require(_0x26ac('0x4'));var db=require(_0x26ac('0x5'))['db'];var utils=require(_0x26ac('0x6'));var logger=require('../../config/logger')(_0x26ac('0x7'));var config=require('../../config/environment');var jayson=require(_0x26ac('0x8'));var client=jayson[_0x26ac('0x9')][_0x26ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x159ba6,_0x36389c,_0x444ca1){return new BPromise(function(_0x1906d0,_0xd8b1e5){return client['request'](_0x159ba6,_0x444ca1)['then'](function(_0x27ff15){logger[_0x26ac('0xb')](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));logger['debug'](_0x26ac('0xe'),_0x36389c,_0x26ac('0xd'),JSON[_0x26ac('0xf')](_0x27ff15));if(_0x27ff15[_0x26ac('0x10')]){if(_0x27ff15['error']['code']===0x1f4){logger[_0x26ac('0x10')](_0x26ac('0xc'),_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0xd8b1e5(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}logger[_0x26ac('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0x1906d0(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}else{logger['info'](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));_0x1906d0(_0x27ff15['result'][_0x26ac('0x11')]);}})[_0x26ac('0x12')](function(_0x3b7c5d){logger[_0x26ac('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x36389c,_0x3b7c5d);_0xd8b1e5(_0x3b7c5d);});});}exports[_0x26ac('0x13')]=function(_0xb03bbc){var _0x5cd737=this;return new Promise(function(_0x539eda,_0x111613){return db[_0x26ac('0x14')]['findAll']({'raw':_0xb03bbc[_0x26ac('0x15')]?_0xb03bbc['options']['raw']===undefined?!![]:![]:!![],'where':_0xb03bbc['options']?_0xb03bbc[_0x26ac('0x15')]['where']||null:null,'attributes':_0xb03bbc[_0x26ac('0x15')]?_0xb03bbc[_0x26ac('0x15')][_0x26ac('0x16')]||null:null,'limit':_0xb03bbc[_0x26ac('0x15')]?_0xb03bbc[_0x26ac('0x15')][_0x26ac('0x17')]||null:null,'include':_0xb03bbc[_0x26ac('0x15')]?_0xb03bbc[_0x26ac('0x15')][_0x26ac('0x18')]?_['map'](_0xb03bbc[_0x26ac('0x15')][_0x26ac('0x18')],function(_0x2b8299){return{'model':db[_0x2b8299[_0x26ac('0x19')]],'as':_0x2b8299['as'],'attributes':_0x2b8299[_0x26ac('0x16')],'include':_0x2b8299[_0x26ac('0x18')]?_[_0x26ac('0x1a')](_0x2b8299[_0x26ac('0x18')],function(_0x4172c2){return{'model':db[_0x4172c2[_0x26ac('0x19')]],'as':_0x4172c2['as'],'attributes':_0x4172c2['attributes'],'include':_0x4172c2['include']?_[_0x26ac('0x1a')](_0x4172c2['include'],function(_0x185296){return{'model':db[_0x185296[_0x26ac('0x19')]],'as':_0x185296['as'],'attributes':_0x185296[_0x26ac('0x16')]};}):[]};}):[]};}):[]:[]})[_0x26ac('0x1b')](function(_0x31cb17){logger[_0x26ac('0xb')]('GetZohoAccount',_0xb03bbc);logger['debug'](_0x26ac('0x13'),_0xb03bbc,JSON[_0x26ac('0xf')](_0x31cb17));_0x539eda(_0x31cb17);})[_0x26ac('0x12')](function(_0x4d873e){logger['error'](_0x26ac('0x13'),_0x4d873e[_0x26ac('0x11')],_0xb03bbc);_0x111613(_0x5cd737[_0x26ac('0x10')](0x1f4,_0x4d873e[_0x26ac('0x11')]));});});};exports['ShowZohoAccount']=function(_0x5e1cbc){var _0x3ea2f0=this;return new Promise(function(_0x3e2148,_0x17691a){return db[_0x26ac('0x14')][_0x26ac('0x1c')]({'raw':_0x5e1cbc[_0x26ac('0x15')]?_0x5e1cbc[_0x26ac('0x15')][_0x26ac('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e1cbc[_0x26ac('0x15')]?_0x5e1cbc[_0x26ac('0x15')]['where']||null:null,'attributes':_0x5e1cbc[_0x26ac('0x15')]?_0x5e1cbc[_0x26ac('0x15')]['attributes']||null:null,'include':_0x5e1cbc[_0x26ac('0x15')]?_0x5e1cbc[_0x26ac('0x15')][_0x26ac('0x18')]?_[_0x26ac('0x1a')](_0x5e1cbc[_0x26ac('0x15')][_0x26ac('0x18')],function(_0x375f83){return{'model':db[_0x375f83[_0x26ac('0x19')]],'as':_0x375f83['as'],'attributes':_0x375f83[_0x26ac('0x16')],'include':_0x375f83[_0x26ac('0x18')]?_[_0x26ac('0x1a')](_0x375f83[_0x26ac('0x18')],function(_0x583109){return{'model':db[_0x583109[_0x26ac('0x19')]],'as':_0x583109['as'],'attributes':_0x583109[_0x26ac('0x16')],'include':_0x583109[_0x26ac('0x18')]?_['map'](_0x583109[_0x26ac('0x18')],function(_0x4a842a){return{'model':db[_0x4a842a[_0x26ac('0x19')]],'as':_0x4a842a['as'],'attributes':_0x4a842a[_0x26ac('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x66dc0c){logger[_0x26ac('0xb')](_0x26ac('0x1e'),_0x5e1cbc);logger[_0x26ac('0x1f')](_0x26ac('0x1e'),_0x5e1cbc,JSON[_0x26ac('0xf')](_0x66dc0c));_0x3e2148(_0x66dc0c);})['catch'](function(_0x76f6c4){logger['error'](_0x26ac('0x1e'),_0x76f6c4['message'],_0x5e1cbc);_0x17691a(_0x3ea2f0[_0x26ac('0x10')](0x1f4,_0x76f6c4['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9c26d64..5a48659 100644 --- a/server/api/intZohoConfiguration/index.js +++ b/server/api/intZohoConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75fb=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','destroy','exports','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x75fb,0x137));var _0xb75f=function(_0x7f6de0,_0x362c05){_0x7f6de0=_0x7f6de0-0x0;var _0x358901=_0x75fb[_0x7f6de0];return _0x358901;};'use strict';var multer=require(_0xb75f('0x0'));var util=require(_0xb75f('0x1'));var path=require(_0xb75f('0x2'));var timeout=require(_0xb75f('0x3'));var express=require(_0xb75f('0x4'));var router=express[_0xb75f('0x5')]();var fs_extra=require(_0xb75f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb75f('0x7'));var config=require(_0xb75f('0x8'));var controller=require(_0xb75f('0x9'));router[_0xb75f('0xa')]('/',auth[_0xb75f('0xb')](),controller[_0xb75f('0xc')]);router[_0xb75f('0xa')](_0xb75f('0xd'),auth[_0xb75f('0xb')](),controller['show']);router['get'](_0xb75f('0xe'),auth[_0xb75f('0xb')](),controller[_0xb75f('0xf')]);router['get'](_0xb75f('0x10'),auth[_0xb75f('0xb')](),controller[_0xb75f('0x11')]);router[_0xb75f('0xa')]('/:id/descriptions',auth[_0xb75f('0xb')](),controller[_0xb75f('0x12')]);router[_0xb75f('0x13')]('/',auth[_0xb75f('0xb')](),controller[_0xb75f('0x14')]);router[_0xb75f('0x15')]('/:id',auth[_0xb75f('0xb')](),controller['update']);router['delete'](_0xb75f('0xd'),auth['isAuthenticated'](),controller[_0xb75f('0x16')]);module[_0xb75f('0x17')]=router; \ No newline at end of file +var _0x3043=['getFields','/:id/subjects','getSubjects','post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','index','get','/:id','isAuthenticated','show'];(function(_0x1659c1,_0x24882f){var _0xaefe5a=function(_0x41a1a6){while(--_0x41a1a6){_0x1659c1['push'](_0x1659c1['shift']());}};_0xaefe5a(++_0x24882f);}(_0x3043,0x172));var _0x3304=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x3043[_0x504df1];return _0x1063b5;};'use strict';var multer=require(_0x3304('0x0'));var util=require('util');var path=require(_0x3304('0x1'));var timeout=require('connect-timeout');var express=require(_0x3304('0x2'));var router=express[_0x3304('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3304('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3304('0x5')]);router[_0x3304('0x6')](_0x3304('0x7'),auth[_0x3304('0x8')](),controller[_0x3304('0x9')]);router[_0x3304('0x6')]('/:id/fields',auth[_0x3304('0x8')](),controller[_0x3304('0xa')]);router[_0x3304('0x6')](_0x3304('0xb'),auth[_0x3304('0x8')](),controller[_0x3304('0xc')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3304('0xd')]('/',auth[_0x3304('0x8')](),controller['create']);router[_0x3304('0xe')](_0x3304('0x7'),auth['isAuthenticated'](),controller[_0x3304('0xf')]);router[_0x3304('0x10')](_0x3304('0x7'),auth[_0x3304('0x8')](),controller[_0x3304('0x11')]);module[_0x3304('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 343e77b..be0c70b 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc090=['nothing','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xc090,0x112));var _0x0c09=function(_0x3b170f,_0x111b6b){_0x3b170f=_0x3b170f-0x0;var _0x40f073=_0xc090[_0x3b170f];return _0x40f073;};'use strict';var Sequelize=require(_0x0c09('0x0'));module[_0x0c09('0x1')]={'name':{'type':Sequelize[_0x0c09('0x2')]},'moduleCreate':{'type':Sequelize[_0x0c09('0x3')](_0x0c09('0x4'),_0x0c09('0x5'),_0x0c09('0x6')),'defaultValue':_0x0c09('0x4')},'moduleSearch':{'type':Sequelize[_0x0c09('0x3')]('contact_lead',_0x0c09('0x5'),_0x0c09('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x130f=['lead','contact','contact_lead','STRING','sequelize','ENUM'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x130f,0xbe));var _0xf130=function(_0x37f6cb,_0x3fe4f6){_0x37f6cb=_0x37f6cb-0x0;var _0x1dc2ab=_0x130f[_0x37f6cb];return _0x1dc2ab;};'use strict';var Sequelize=require(_0xf130('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xf130('0x1')](_0xf130('0x2'),_0xf130('0x3'),'nothing'),'defaultValue':_0xf130('0x2')},'moduleSearch':{'type':Sequelize[_0xf130('0x1')]('contact_lead',_0xf130('0x3'),'lead'),'defaultValue':_0xf130('0x4')},'description':{'type':Sequelize[_0xf130('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b206eb5..fe507b3 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1de8=['type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','update','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes'];(function(_0x5131e3,_0x42afa0){var _0x4cb7ce=function(_0x4a377c){while(--_0x4a377c){_0x5131e3['push'](_0x5131e3['shift']());}};_0x4cb7ce(++_0x42afa0);}(_0x1de8,0xc5));var _0x81de=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0x1de8[_0x4ca6a4];return _0x120555;};'use strict';var emlformat=require(_0x81de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x81de('0x1'));var jsonpatch=require(_0x81de('0x2'));var rp=require(_0x81de('0x3'));var moment=require(_0x81de('0x4'));var BPromise=require(_0x81de('0x5'));var Mustache=require(_0x81de('0x6'));var util=require(_0x81de('0x7'));var path=require(_0x81de('0x8'));var sox=require('sox');var csv=require(_0x81de('0x9'));var ejs=require(_0x81de('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81de('0xb'));var squel=require(_0x81de('0xc'));var crypto=require('crypto');var jsforce=require(_0x81de('0xd'));var deskjs=require(_0x81de('0xe'));var toCsv=require(_0x81de('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x81de('0xf'));var authService=require(_0x81de('0x10'));var qs=require(_0x81de('0x11'));var as=require(_0x81de('0x12'));var hardwareService=require(_0x81de('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x81de('0x14'));var licenseUtil=require(_0x81de('0x15'));var db=require(_0x81de('0x16'))['db'];function respondWithStatusCode(_0x47cbf2,_0x295ebe){_0x295ebe=_0x295ebe||0xcc;return function(_0x4a4d46){if(_0x4a4d46){return _0x47cbf2[_0x81de('0x17')](_0x295ebe);}return _0x47cbf2[_0x81de('0x18')](_0x295ebe)[_0x81de('0x19')]();};}function respondWithResult(_0x5481c6,_0x28de61){_0x28de61=_0x28de61||0xc8;return function(_0x25d4a){if(_0x25d4a){return _0x5481c6[_0x81de('0x18')](_0x28de61)[_0x81de('0x1a')](_0x25d4a);}};}function respondWithFilteredResult(_0x493f4d,_0x3ea621){return function(_0x4e7c83){if(_0x4e7c83){var _0x4f4c69=typeof _0x3ea621[_0x81de('0x1b')]===_0x81de('0x1c')&&typeof _0x3ea621[_0x81de('0x1d')]===_0x81de('0x1c');var _0x227658=_0x4e7c83[_0x81de('0x1e')];var _0x13a7d3=_0x4f4c69?0x0:_0x3ea621[_0x81de('0x1b')];var _0xcfee96=_0x4f4c69?_0x4e7c83[_0x81de('0x1e')]:_0x3ea621['offset']+_0x3ea621[_0x81de('0x1d')];var _0x571afb;if(_0xcfee96>=_0x227658){_0xcfee96=_0x227658;_0x571afb=0xc8;}else{_0x571afb=0xce;}_0x493f4d[_0x81de('0x18')](_0x571afb);return _0x493f4d[_0x81de('0x1f')](_0x81de('0x20'),_0x13a7d3+'-'+_0xcfee96+'/'+_0x227658)[_0x81de('0x1a')](_0x4e7c83);}return null;};}function patchUpdates(_0xbc52f7){return function(_0x56c2f4){try{jsonpatch[_0x81de('0x21')](_0x56c2f4,_0xbc52f7,!![]);}catch(_0x4d64a4){return BPromise[_0x81de('0x22')](_0x4d64a4);}return _0x56c2f4[_0x81de('0x23')]();};}function saveUpdates(_0x44db90,_0x44906d){return function(_0x1150a4){if(_0x1150a4){return _0x1150a4['update'](_0x44db90)[_0x81de('0x24')](function(_0x3dea59){return _0x3dea59;});}return null;};}function removeEntity(_0x324cea,_0x17b176){return function(_0x24c31f){if(_0x24c31f){return _0x24c31f[_0x81de('0x25')]()['then'](function(){_0x324cea[_0x81de('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b5577,_0x492ffb){return function(_0x18e991){if(!_0x18e991){_0x5b5577['sendStatus'](0x194);}return _0x18e991;};}function handleError(_0x3e013a,_0x58e570){_0x58e570=_0x58e570||0x1f4;return function(_0x169f57){logger[_0x81de('0x26')](_0x169f57[_0x81de('0x27')]);if(_0x169f57['name']){delete _0x169f57[_0x81de('0x28')];}_0x3e013a[_0x81de('0x18')](_0x58e570)[_0x81de('0x29')](_0x169f57);};}exports[_0x81de('0x2a')]=function(_0xa6d357,_0x533687){var _0x2f5c8f={},_0x39ac6f={},_0x2e8c88={'count':0x0,'rows':[]};var _0x4a86a8=_[_0x81de('0x2b')](db[_0x81de('0x2c')][_0x81de('0x2d')],function(_0x2f7799){return{'name':_0x2f7799['fieldName'],'type':_0x2f7799[_0x81de('0x2e')][_0x81de('0x2f')]};});_0x39ac6f[_0x81de('0x30')]=_[_0x81de('0x2b')](_0x4a86a8,'name');_0x39ac6f[_0x81de('0x31')]=_['keys'](_0xa6d357['query']);_0x39ac6f[_0x81de('0x32')]=_['intersection'](_0x39ac6f[_0x81de('0x30')],_0x39ac6f[_0x81de('0x31')]);_0x2f5c8f[_0x81de('0x33')]=_[_0x81de('0x34')](_0x39ac6f[_0x81de('0x30')],qs[_0x81de('0x35')](_0xa6d357[_0x81de('0x31')][_0x81de('0x35')]));_0x2f5c8f[_0x81de('0x33')]=_0x2f5c8f[_0x81de('0x33')][_0x81de('0x36')]?_0x2f5c8f[_0x81de('0x33')]:_0x39ac6f[_0x81de('0x30')];if(!_0xa6d357[_0x81de('0x31')][_0x81de('0x37')](_0x81de('0x38'))){_0x2f5c8f['limit']=qs[_0x81de('0x1d')](_0xa6d357[_0x81de('0x31')][_0x81de('0x1d')]);_0x2f5c8f[_0x81de('0x1b')]=qs[_0x81de('0x1b')](_0xa6d357[_0x81de('0x31')]['offset']);}_0x2f5c8f[_0x81de('0x39')]=qs[_0x81de('0x3a')](_0xa6d357[_0x81de('0x31')][_0x81de('0x3a')]);_0x2f5c8f[_0x81de('0x3b')]=qs[_0x81de('0x32')](_[_0x81de('0x3c')](_0xa6d357['query'],_0x39ac6f[_0x81de('0x32')]),_0x4a86a8);if(_0xa6d357[_0x81de('0x31')]['filter']){_0x2f5c8f[_0x81de('0x3b')]=_[_0x81de('0x3d')](_0x2f5c8f[_0x81de('0x3b')],{'$or':_['map'](_0x4a86a8,function(_0x1cfca7){if(_0x1cfca7[_0x81de('0x2e')]!=='VIRTUAL'){var _0x31b51c={};_0x31b51c[_0x1cfca7[_0x81de('0x28')]]={'$like':'%'+_0xa6d357[_0x81de('0x31')][_0x81de('0x3e')]+'%'};return _0x31b51c;}})});}_0x2f5c8f=_[_0x81de('0x3d')]({},_0x2f5c8f,_0xa6d357[_0x81de('0x3f')]);var _0x4ef086={'where':_0x2f5c8f[_0x81de('0x3b')]};return db[_0x81de('0x2c')]['count'](_0x4ef086)[_0x81de('0x24')](function(_0x8a9d49){_0x2e8c88['count']=_0x8a9d49;if(_0xa6d357[_0x81de('0x31')][_0x81de('0x40')]){_0x2f5c8f[_0x81de('0x41')]=[{'all':!![]}];}return db[_0x81de('0x2c')][_0x81de('0x42')](_0x2f5c8f);})['then'](function(_0x1783d7){_0x2e8c88[_0x81de('0x43')]=_0x1783d7;return _0x2e8c88;})[_0x81de('0x24')](respondWithFilteredResult(_0x533687,_0x2f5c8f))[_0x81de('0x44')](handleError(_0x533687,null));};exports[_0x81de('0x45')]=function(_0x3984e3,_0x495340){var _0x2c5421={'raw':![],'where':{'id':_0x3984e3[_0x81de('0x46')]['id']}},_0x355d42={};_0x355d42[_0x81de('0x30')]=_[_0x81de('0x47')](db[_0x81de('0x2c')][_0x81de('0x2d')]);_0x355d42[_0x81de('0x31')]=_[_0x81de('0x47')](_0x3984e3[_0x81de('0x31')]);_0x355d42[_0x81de('0x32')]=_[_0x81de('0x34')](_0x355d42[_0x81de('0x30')],_0x355d42[_0x81de('0x31')]);_0x2c5421[_0x81de('0x33')]=_[_0x81de('0x34')](_0x355d42[_0x81de('0x30')],qs['fields'](_0x3984e3[_0x81de('0x31')][_0x81de('0x35')]));_0x2c5421['attributes']=_0x2c5421['attributes'][_0x81de('0x36')]?_0x2c5421['attributes']:_0x355d42[_0x81de('0x30')];if(_0x3984e3[_0x81de('0x31')][_0x81de('0x40')]){_0x2c5421[_0x81de('0x41')]=[{'all':!![]}];}_0x2c5421=_[_0x81de('0x3d')]({},_0x2c5421,_0x3984e3[_0x81de('0x3f')]);return db[_0x81de('0x2c')][_0x81de('0x48')](_0x2c5421)[_0x81de('0x24')](handleEntityNotFound(_0x495340,null))[_0x81de('0x24')](respondWithResult(_0x495340,null))['catch'](handleError(_0x495340,null));};exports[_0x81de('0x49')]=function(_0x333359,_0x18a046){return db[_0x81de('0x2c')][_0x81de('0x49')](_0x333359['body'],{})[_0x81de('0x24')](respondWithResult(_0x18a046,0xc9))[_0x81de('0x44')](handleError(_0x18a046,null));};exports[_0x81de('0x4a')]=function(_0x524329,_0xb1de71){if(_0x524329[_0x81de('0x4b')]['id']){delete _0x524329[_0x81de('0x4b')]['id'];}return db[_0x81de('0x2c')]['find']({'where':{'id':_0x524329[_0x81de('0x46')]['id']}})['then'](handleEntityNotFound(_0xb1de71,null))['then'](saveUpdates(_0x524329['body'],null))[_0x81de('0x24')](respondWithResult(_0xb1de71,null))[_0x81de('0x44')](handleError(_0xb1de71,null));};exports['destroy']=function(_0x9db674,_0x52f75b){return db[_0x81de('0x2c')][_0x81de('0x48')]({'where':{'id':_0x9db674['params']['id']}})[_0x81de('0x24')](handleEntityNotFound(_0x52f75b,null))[_0x81de('0x24')](removeEntity(_0x52f75b,null))['catch'](handleError(_0x52f75b,null));};exports[_0x81de('0x4c')]=function(_0x5d8d3c,_0x1cd801,_0x322ef6){var _0x331b59={};var _0x487f23={};var _0x21c014;var _0x39c9a0;return db[_0x81de('0x2c')][_0x81de('0x4d')]({'where':{'id':_0x5d8d3c['params']['id']}})[_0x81de('0x24')](handleEntityNotFound(_0x1cd801,null))[_0x81de('0x24')](function(_0x50f7fb){if(_0x50f7fb){_0x21c014=_0x50f7fb;_0x487f23[_0x81de('0x30')]=_[_0x81de('0x47')](db[_0x81de('0x4e')]['rawAttributes']);_0x487f23['query']=_[_0x81de('0x47')](_0x5d8d3c[_0x81de('0x31')]);_0x487f23['filters']=_[_0x81de('0x34')](_0x487f23[_0x81de('0x30')],_0x487f23['query']);_0x331b59[_0x81de('0x33')]=_['intersection'](_0x487f23['model'],qs[_0x81de('0x35')](_0x5d8d3c[_0x81de('0x31')][_0x81de('0x35')]));_0x331b59['attributes']=_0x331b59[_0x81de('0x33')][_0x81de('0x36')]?_0x331b59[_0x81de('0x33')]:_0x487f23[_0x81de('0x30')];_0x331b59['order']=qs[_0x81de('0x3a')](_0x5d8d3c[_0x81de('0x31')][_0x81de('0x3a')]);_0x331b59[_0x81de('0x3b')]=qs[_0x81de('0x32')](_['pick'](_0x5d8d3c[_0x81de('0x31')],_0x487f23[_0x81de('0x32')]));if(_0x5d8d3c[_0x81de('0x31')][_0x81de('0x3e')]){_0x331b59[_0x81de('0x3b')]=_[_0x81de('0x3d')](_0x331b59[_0x81de('0x3b')],{'$or':_[_0x81de('0x2b')](_0x331b59['attributes'],function(_0x1397e1){var _0x58d602={};_0x58d602[_0x1397e1]={'$like':'%'+_0x5d8d3c[_0x81de('0x31')][_0x81de('0x3e')]+'%'};return _0x58d602;})});}_0x331b59=_[_0x81de('0x3d')]({},_0x331b59,_0x5d8d3c[_0x81de('0x3f')]);return _0x21c014[_0x81de('0x4c')](_0x331b59);}})[_0x81de('0x24')](function(_0x5e1e36){if(_0x5e1e36){_0x39c9a0=_0x5e1e36[_0x81de('0x36')];if(!_0x5d8d3c[_0x81de('0x31')][_0x81de('0x37')]('nolimit')){_0x331b59[_0x81de('0x1d')]=qs['limit'](_0x5d8d3c[_0x81de('0x31')][_0x81de('0x1d')]);_0x331b59[_0x81de('0x1b')]=qs[_0x81de('0x1b')](_0x5d8d3c[_0x81de('0x31')]['offset']);}return _0x21c014['getFields'](_0x331b59);}})[_0x81de('0x24')](function(_0xb7d39b){if(_0xb7d39b){return _0xb7d39b?{'count':_0x39c9a0,'rows':_0xb7d39b}:null;}})[_0x81de('0x24')](respondWithResult(_0x1cd801,null))['catch'](handleError(_0x1cd801,null));};exports[_0x81de('0x4f')]=function(_0x3750bf,_0x3361ff,_0x540fe2){var _0x47e94b={};var _0x2bc2bb={};var _0x315250;var _0x59582b;return db['ZohoConfiguration'][_0x81de('0x4d')]({'where':{'id':_0x3750bf[_0x81de('0x46')]['id']}})['then'](handleEntityNotFound(_0x3361ff,null))[_0x81de('0x24')](function(_0x1cd0e5){if(_0x1cd0e5){_0x315250=_0x1cd0e5;_0x2bc2bb[_0x81de('0x30')]=_['keys'](db[_0x81de('0x4e')]['rawAttributes']);_0x2bc2bb[_0x81de('0x31')]=_[_0x81de('0x47')](_0x3750bf['query']);_0x2bc2bb['filters']=_['intersection'](_0x2bc2bb[_0x81de('0x30')],_0x2bc2bb['query']);_0x47e94b[_0x81de('0x33')]=_[_0x81de('0x34')](_0x2bc2bb['model'],qs[_0x81de('0x35')](_0x3750bf['query'][_0x81de('0x35')]));_0x47e94b[_0x81de('0x33')]=_0x47e94b['attributes']['length']?_0x47e94b[_0x81de('0x33')]:_0x2bc2bb[_0x81de('0x30')];_0x47e94b[_0x81de('0x39')]=qs[_0x81de('0x3a')](_0x3750bf[_0x81de('0x31')][_0x81de('0x3a')]);_0x47e94b[_0x81de('0x3b')]=qs[_0x81de('0x32')](_[_0x81de('0x3c')](_0x3750bf[_0x81de('0x31')],_0x2bc2bb[_0x81de('0x32')]));if(_0x3750bf[_0x81de('0x31')][_0x81de('0x3e')]){_0x47e94b[_0x81de('0x3b')]=_[_0x81de('0x3d')](_0x47e94b[_0x81de('0x3b')],{'$or':_['map'](_0x47e94b['attributes'],function(_0x58fbf6){var _0x32615f={};_0x32615f[_0x58fbf6]={'$like':'%'+_0x3750bf[_0x81de('0x31')][_0x81de('0x3e')]+'%'};return _0x32615f;})});}_0x47e94b=_[_0x81de('0x3d')]({},_0x47e94b,_0x3750bf[_0x81de('0x3f')]);return _0x315250[_0x81de('0x4f')](_0x47e94b);}})[_0x81de('0x24')](function(_0x3ad9ff){if(_0x3ad9ff){_0x59582b=_0x3ad9ff[_0x81de('0x36')];if(!_0x3750bf[_0x81de('0x31')][_0x81de('0x37')]('nolimit')){_0x47e94b['limit']=qs[_0x81de('0x1d')](_0x3750bf[_0x81de('0x31')][_0x81de('0x1d')]);_0x47e94b[_0x81de('0x1b')]=qs[_0x81de('0x1b')](_0x3750bf[_0x81de('0x31')][_0x81de('0x1b')]);}return _0x315250[_0x81de('0x4f')](_0x47e94b);}})['then'](function(_0x10e413){if(_0x10e413){return _0x10e413?{'count':_0x59582b,'rows':_0x10e413}:null;}})[_0x81de('0x24')](respondWithResult(_0x3361ff,null))[_0x81de('0x44')](handleError(_0x3361ff,null));};exports[_0x81de('0x50')]=function(_0x44d481,_0x2ab8ce,_0x118a9a){var _0x5b054f={};var _0x4dce30={};var _0x5266bf;var _0x2d39f5;return db['ZohoConfiguration'][_0x81de('0x4d')]({'where':{'id':_0x44d481[_0x81de('0x46')]['id']}})[_0x81de('0x24')](handleEntityNotFound(_0x2ab8ce,null))['then'](function(_0x57730c){if(_0x57730c){_0x5266bf=_0x57730c;_0x4dce30[_0x81de('0x30')]=_['keys'](db[_0x81de('0x4e')]['rawAttributes']);_0x4dce30['query']=_['keys'](_0x44d481[_0x81de('0x31')]);_0x4dce30[_0x81de('0x32')]=_[_0x81de('0x34')](_0x4dce30[_0x81de('0x30')],_0x4dce30[_0x81de('0x31')]);_0x5b054f[_0x81de('0x33')]=_[_0x81de('0x34')](_0x4dce30[_0x81de('0x30')],qs[_0x81de('0x35')](_0x44d481[_0x81de('0x31')]['fields']));_0x5b054f['attributes']=_0x5b054f[_0x81de('0x33')][_0x81de('0x36')]?_0x5b054f[_0x81de('0x33')]:_0x4dce30['model'];_0x5b054f[_0x81de('0x39')]=qs[_0x81de('0x3a')](_0x44d481['query'][_0x81de('0x3a')]);_0x5b054f['where']=qs['filters'](_[_0x81de('0x3c')](_0x44d481['query'],_0x4dce30[_0x81de('0x32')]));if(_0x44d481['query'][_0x81de('0x3e')]){_0x5b054f[_0x81de('0x3b')]=_[_0x81de('0x3d')](_0x5b054f[_0x81de('0x3b')],{'$or':_[_0x81de('0x2b')](_0x5b054f['attributes'],function(_0x3a359c){var _0x7f0786={};_0x7f0786[_0x3a359c]={'$like':'%'+_0x44d481[_0x81de('0x31')][_0x81de('0x3e')]+'%'};return _0x7f0786;})});}_0x5b054f=_[_0x81de('0x3d')]({},_0x5b054f,_0x44d481['options']);return _0x5266bf[_0x81de('0x50')](_0x5b054f);}})[_0x81de('0x24')](function(_0x4d4c6f){if(_0x4d4c6f){_0x2d39f5=_0x4d4c6f[_0x81de('0x36')];if(!_0x44d481[_0x81de('0x31')][_0x81de('0x37')](_0x81de('0x38'))){_0x5b054f[_0x81de('0x1d')]=qs[_0x81de('0x1d')](_0x44d481[_0x81de('0x31')][_0x81de('0x1d')]);_0x5b054f[_0x81de('0x1b')]=qs[_0x81de('0x1b')](_0x44d481[_0x81de('0x31')][_0x81de('0x1b')]);}return _0x5266bf[_0x81de('0x50')](_0x5b054f);}})['then'](function(_0x1cc624){if(_0x1cc624){return _0x1cc624?{'count':_0x2d39f5,'rows':_0x1cc624}:null;}})[_0x81de('0x24')](respondWithResult(_0x2ab8ce,null))[_0x81de('0x44')](handleError(_0x2ab8ce,null));}; \ No newline at end of file +var _0xc756=['send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','limit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','catch','create','body','find','params','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name'];(function(_0x16799e,_0x546351){var _0x53e76a=function(_0x3077a9){while(--_0x3077a9){_0x16799e['push'](_0x16799e['shift']());}};_0x53e76a(++_0x546351);}(_0xc756,0x1ae));var _0x6c75=function(_0x155020,_0x2fb2ae){_0x155020=_0x155020-0x0;var _0x5dd641=_0xc756[_0x155020];return _0x5dd641;};'use strict';var emlformat=require(_0x6c75('0x0'));var rimraf=require(_0x6c75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c75('0x2'));var rp=require('request-promise');var moment=require(_0x6c75('0x3'));var BPromise=require(_0x6c75('0x4'));var Mustache=require(_0x6c75('0x5'));var util=require(_0x6c75('0x6'));var path=require(_0x6c75('0x7'));var sox=require('sox');var csv=require(_0x6c75('0x8'));var ejs=require(_0x6c75('0x9'));var fs=require('fs');var fs_extra=require(_0x6c75('0xa'));var _=require('lodash');var squel=require(_0x6c75('0xb'));var crypto=require(_0x6c75('0xc'));var jsforce=require(_0x6c75('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6c75('0xe'));var Redis=require('ioredis');var authService=require(_0x6c75('0xf'));var qs=require(_0x6c75('0x10'));var as=require(_0x6c75('0x11'));var hardwareService=require(_0x6c75('0x12'));var logger=require(_0x6c75('0x13'))(_0x6c75('0x14'));var utils=require(_0x6c75('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fe27,_0x39bb20){_0x39bb20=_0x39bb20||0xcc;return function(_0x402ff3){if(_0x402ff3){return _0x44fe27[_0x6c75('0x16')](_0x39bb20);}return _0x44fe27[_0x6c75('0x17')](_0x39bb20)['end']();};}function respondWithResult(_0x4fbab3,_0x971e04){_0x971e04=_0x971e04||0xc8;return function(_0x3424d4){if(_0x3424d4){return _0x4fbab3[_0x6c75('0x17')](_0x971e04)[_0x6c75('0x18')](_0x3424d4);}};}function respondWithFilteredResult(_0x2894b1,_0x3ebe33){return function(_0x34ee95){if(_0x34ee95){var _0x3972f6=typeof _0x3ebe33[_0x6c75('0x19')]===_0x6c75('0x1a')&&typeof _0x3ebe33['limit']===_0x6c75('0x1a');var _0x959723=_0x34ee95[_0x6c75('0x1b')];var _0x1657ed=_0x3972f6?0x0:_0x3ebe33['offset'];var _0x296e2f=_0x3972f6?_0x34ee95['count']:_0x3ebe33[_0x6c75('0x19')]+_0x3ebe33['limit'];var _0x4e63a9;if(_0x296e2f>=_0x959723){_0x296e2f=_0x959723;_0x4e63a9=0xc8;}else{_0x4e63a9=0xce;}_0x2894b1[_0x6c75('0x17')](_0x4e63a9);return _0x2894b1[_0x6c75('0x1c')](_0x6c75('0x1d'),_0x1657ed+'-'+_0x296e2f+'/'+_0x959723)['json'](_0x34ee95);}return null;};}function patchUpdates(_0x25bdc9){return function(_0xc3de0a){try{jsonpatch['apply'](_0xc3de0a,_0x25bdc9,!![]);}catch(_0x32fad9){return BPromise['reject'](_0x32fad9);}return _0xc3de0a[_0x6c75('0x1e')]();};}function saveUpdates(_0x8f54b3,_0xa3001b){return function(_0x2a6259){if(_0x2a6259){return _0x2a6259[_0x6c75('0x1f')](_0x8f54b3)[_0x6c75('0x20')](function(_0x2f1d76){return _0x2f1d76;});}return null;};}function removeEntity(_0x15232d,_0x263d0a){return function(_0x1dde13){if(_0x1dde13){return _0x1dde13[_0x6c75('0x21')]()[_0x6c75('0x20')](function(){_0x15232d[_0x6c75('0x17')](0xcc)[_0x6c75('0x22')]();});}};}function handleEntityNotFound(_0x5dae81,_0x145c01){return function(_0x3f89b7){if(!_0x3f89b7){_0x5dae81['sendStatus'](0x194);}return _0x3f89b7;};}function handleError(_0x548896,_0x5f3b5a){_0x5f3b5a=_0x5f3b5a||0x1f4;return function(_0x7c67ad){logger[_0x6c75('0x23')](_0x7c67ad[_0x6c75('0x24')]);if(_0x7c67ad['name']){delete _0x7c67ad[_0x6c75('0x25')];}_0x548896[_0x6c75('0x17')](_0x5f3b5a)[_0x6c75('0x26')](_0x7c67ad);};}exports[_0x6c75('0x27')]=function(_0x35883d,_0x2aa6e8){var _0x3a0432={},_0x2fcd78={},_0x1a1280={'count':0x0,'rows':[]};var _0x10d7d0=_[_0x6c75('0x28')](db[_0x6c75('0x29')][_0x6c75('0x2a')],function(_0xd26af7){return{'name':_0xd26af7[_0x6c75('0x2b')],'type':_0xd26af7[_0x6c75('0x2c')]['key']};});_0x2fcd78[_0x6c75('0x2d')]=_[_0x6c75('0x28')](_0x10d7d0,'name');_0x2fcd78[_0x6c75('0x2e')]=_[_0x6c75('0x2f')](_0x35883d[_0x6c75('0x2e')]);_0x2fcd78['filters']=_['intersection'](_0x2fcd78[_0x6c75('0x2d')],_0x2fcd78[_0x6c75('0x2e')]);_0x3a0432[_0x6c75('0x30')]=_[_0x6c75('0x31')](_0x2fcd78['model'],qs[_0x6c75('0x32')](_0x35883d['query'][_0x6c75('0x32')]));_0x3a0432['attributes']=_0x3a0432[_0x6c75('0x30')][_0x6c75('0x33')]?_0x3a0432[_0x6c75('0x30')]:_0x2fcd78[_0x6c75('0x2d')];if(!_0x35883d[_0x6c75('0x2e')]['hasOwnProperty']('nolimit')){_0x3a0432[_0x6c75('0x34')]=qs[_0x6c75('0x34')](_0x35883d[_0x6c75('0x2e')][_0x6c75('0x34')]);_0x3a0432[_0x6c75('0x19')]=qs['offset'](_0x35883d['query'][_0x6c75('0x19')]);}_0x3a0432[_0x6c75('0x35')]=qs[_0x6c75('0x36')](_0x35883d[_0x6c75('0x2e')][_0x6c75('0x36')]);_0x3a0432[_0x6c75('0x37')]=qs['filters'](_[_0x6c75('0x38')](_0x35883d[_0x6c75('0x2e')],_0x2fcd78[_0x6c75('0x39')]),_0x10d7d0);if(_0x35883d[_0x6c75('0x2e')]['filter']){_0x3a0432['where']=_['merge'](_0x3a0432[_0x6c75('0x37')],{'$or':_[_0x6c75('0x28')](_0x10d7d0,function(_0x46420b){if(_0x46420b[_0x6c75('0x2c')]!==_0x6c75('0x3a')){var _0x292962={};_0x292962[_0x46420b['name']]={'$like':'%'+_0x35883d[_0x6c75('0x2e')][_0x6c75('0x3b')]+'%'};return _0x292962;}})});}_0x3a0432=_[_0x6c75('0x3c')]({},_0x3a0432,_0x35883d[_0x6c75('0x3d')]);var _0x61f971={'where':_0x3a0432[_0x6c75('0x37')]};return db[_0x6c75('0x29')][_0x6c75('0x1b')](_0x61f971)['then'](function(_0x1be7f2){_0x1a1280[_0x6c75('0x1b')]=_0x1be7f2;if(_0x35883d[_0x6c75('0x2e')][_0x6c75('0x3e')]){_0x3a0432[_0x6c75('0x3f')]=[{'all':!![]}];}return db[_0x6c75('0x29')][_0x6c75('0x40')](_0x3a0432);})['then'](function(_0x2f3946){_0x1a1280['rows']=_0x2f3946;return _0x1a1280;})[_0x6c75('0x20')](respondWithFilteredResult(_0x2aa6e8,_0x3a0432))['catch'](handleError(_0x2aa6e8,null));};exports[_0x6c75('0x41')]=function(_0x33b972,_0x2da95a){var _0x59f02f={'raw':![],'where':{'id':_0x33b972['params']['id']}},_0x262dda={};_0x262dda[_0x6c75('0x2d')]=_[_0x6c75('0x2f')](db[_0x6c75('0x29')][_0x6c75('0x2a')]);_0x262dda[_0x6c75('0x2e')]=_['keys'](_0x33b972[_0x6c75('0x2e')]);_0x262dda[_0x6c75('0x39')]=_[_0x6c75('0x31')](_0x262dda[_0x6c75('0x2d')],_0x262dda['query']);_0x59f02f[_0x6c75('0x30')]=_[_0x6c75('0x31')](_0x262dda[_0x6c75('0x2d')],qs[_0x6c75('0x32')](_0x33b972[_0x6c75('0x2e')][_0x6c75('0x32')]));_0x59f02f[_0x6c75('0x30')]=_0x59f02f[_0x6c75('0x30')][_0x6c75('0x33')]?_0x59f02f[_0x6c75('0x30')]:_0x262dda['model'];if(_0x33b972[_0x6c75('0x2e')]['includeAll']){_0x59f02f[_0x6c75('0x3f')]=[{'all':!![]}];}_0x59f02f=_[_0x6c75('0x3c')]({},_0x59f02f,_0x33b972[_0x6c75('0x3d')]);return db[_0x6c75('0x29')]['find'](_0x59f02f)[_0x6c75('0x20')](handleEntityNotFound(_0x2da95a,null))[_0x6c75('0x20')](respondWithResult(_0x2da95a,null))[_0x6c75('0x42')](handleError(_0x2da95a,null));};exports[_0x6c75('0x43')]=function(_0x50edcf,_0x3082d4){return db[_0x6c75('0x29')][_0x6c75('0x43')](_0x50edcf[_0x6c75('0x44')],{})[_0x6c75('0x20')](respondWithResult(_0x3082d4,0xc9))[_0x6c75('0x42')](handleError(_0x3082d4,null));};exports[_0x6c75('0x1f')]=function(_0x413e2a,_0x4bce74){if(_0x413e2a[_0x6c75('0x44')]['id']){delete _0x413e2a[_0x6c75('0x44')]['id'];}return db[_0x6c75('0x29')]['find']({'where':{'id':_0x413e2a['params']['id']}})[_0x6c75('0x20')](handleEntityNotFound(_0x4bce74,null))[_0x6c75('0x20')](saveUpdates(_0x413e2a[_0x6c75('0x44')],null))[_0x6c75('0x20')](respondWithResult(_0x4bce74,null))['catch'](handleError(_0x4bce74,null));};exports['destroy']=function(_0x53858e,_0x1c620b){return db['ZohoConfiguration'][_0x6c75('0x45')]({'where':{'id':_0x53858e[_0x6c75('0x46')]['id']}})[_0x6c75('0x20')](handleEntityNotFound(_0x1c620b,null))[_0x6c75('0x20')](removeEntity(_0x1c620b,null))[_0x6c75('0x42')](handleError(_0x1c620b,null));};exports[_0x6c75('0x47')]=function(_0x5c8b04,_0x4ef9be,_0x26aa40){var _0x5eac1c={};var _0x2f87bc={};var _0x2e01e5;var _0x1bc420;return db[_0x6c75('0x29')][_0x6c75('0x48')]({'where':{'id':_0x5c8b04['params']['id']}})['then'](handleEntityNotFound(_0x4ef9be,null))[_0x6c75('0x20')](function(_0xe4c058){if(_0xe4c058){_0x2e01e5=_0xe4c058;_0x2f87bc[_0x6c75('0x2d')]=_[_0x6c75('0x2f')](db[_0x6c75('0x49')][_0x6c75('0x2a')]);_0x2f87bc[_0x6c75('0x2e')]=_['keys'](_0x5c8b04[_0x6c75('0x2e')]);_0x2f87bc[_0x6c75('0x39')]=_[_0x6c75('0x31')](_0x2f87bc[_0x6c75('0x2d')],_0x2f87bc[_0x6c75('0x2e')]);_0x5eac1c['attributes']=_[_0x6c75('0x31')](_0x2f87bc[_0x6c75('0x2d')],qs['fields'](_0x5c8b04['query'][_0x6c75('0x32')]));_0x5eac1c[_0x6c75('0x30')]=_0x5eac1c[_0x6c75('0x30')][_0x6c75('0x33')]?_0x5eac1c[_0x6c75('0x30')]:_0x2f87bc[_0x6c75('0x2d')];_0x5eac1c[_0x6c75('0x35')]=qs['sort'](_0x5c8b04[_0x6c75('0x2e')][_0x6c75('0x36')]);_0x5eac1c['where']=qs[_0x6c75('0x39')](_[_0x6c75('0x38')](_0x5c8b04[_0x6c75('0x2e')],_0x2f87bc[_0x6c75('0x39')]));if(_0x5c8b04[_0x6c75('0x2e')][_0x6c75('0x3b')]){_0x5eac1c[_0x6c75('0x37')]=_[_0x6c75('0x3c')](_0x5eac1c[_0x6c75('0x37')],{'$or':_[_0x6c75('0x28')](_0x5eac1c[_0x6c75('0x30')],function(_0x3dd78d){var _0x408ba2={};_0x408ba2[_0x3dd78d]={'$like':'%'+_0x5c8b04[_0x6c75('0x2e')][_0x6c75('0x3b')]+'%'};return _0x408ba2;})});}_0x5eac1c=_[_0x6c75('0x3c')]({},_0x5eac1c,_0x5c8b04['options']);return _0x2e01e5[_0x6c75('0x47')](_0x5eac1c);}})[_0x6c75('0x20')](function(_0x3d787d){if(_0x3d787d){_0x1bc420=_0x3d787d[_0x6c75('0x33')];if(!_0x5c8b04[_0x6c75('0x2e')][_0x6c75('0x4a')]('nolimit')){_0x5eac1c[_0x6c75('0x34')]=qs[_0x6c75('0x34')](_0x5c8b04[_0x6c75('0x2e')]['limit']);_0x5eac1c[_0x6c75('0x19')]=qs[_0x6c75('0x19')](_0x5c8b04[_0x6c75('0x2e')][_0x6c75('0x19')]);}return _0x2e01e5[_0x6c75('0x47')](_0x5eac1c);}})[_0x6c75('0x20')](function(_0x48660c){if(_0x48660c){return _0x48660c?{'count':_0x1bc420,'rows':_0x48660c}:null;}})[_0x6c75('0x20')](respondWithResult(_0x4ef9be,null))['catch'](handleError(_0x4ef9be,null));};exports[_0x6c75('0x4b')]=function(_0x468e28,_0x162998,_0x1593f6){var _0x40fe30={};var _0x12efe6={};var _0x4ac5ff;var _0x4727cc;return db[_0x6c75('0x29')]['findOne']({'where':{'id':_0x468e28['params']['id']}})[_0x6c75('0x20')](handleEntityNotFound(_0x162998,null))['then'](function(_0x1271f2){if(_0x1271f2){_0x4ac5ff=_0x1271f2;_0x12efe6[_0x6c75('0x2d')]=_['keys'](db['ZohoField'][_0x6c75('0x2a')]);_0x12efe6[_0x6c75('0x2e')]=_[_0x6c75('0x2f')](_0x468e28[_0x6c75('0x2e')]);_0x12efe6[_0x6c75('0x39')]=_['intersection'](_0x12efe6[_0x6c75('0x2d')],_0x12efe6[_0x6c75('0x2e')]);_0x40fe30[_0x6c75('0x30')]=_[_0x6c75('0x31')](_0x12efe6['model'],qs['fields'](_0x468e28[_0x6c75('0x2e')][_0x6c75('0x32')]));_0x40fe30['attributes']=_0x40fe30[_0x6c75('0x30')][_0x6c75('0x33')]?_0x40fe30[_0x6c75('0x30')]:_0x12efe6[_0x6c75('0x2d')];_0x40fe30[_0x6c75('0x35')]=qs[_0x6c75('0x36')](_0x468e28[_0x6c75('0x2e')]['sort']);_0x40fe30[_0x6c75('0x37')]=qs[_0x6c75('0x39')](_[_0x6c75('0x38')](_0x468e28[_0x6c75('0x2e')],_0x12efe6[_0x6c75('0x39')]));if(_0x468e28[_0x6c75('0x2e')][_0x6c75('0x3b')]){_0x40fe30[_0x6c75('0x37')]=_[_0x6c75('0x3c')](_0x40fe30[_0x6c75('0x37')],{'$or':_[_0x6c75('0x28')](_0x40fe30[_0x6c75('0x30')],function(_0x332f6f){var _0x402336={};_0x402336[_0x332f6f]={'$like':'%'+_0x468e28[_0x6c75('0x2e')][_0x6c75('0x3b')]+'%'};return _0x402336;})});}_0x40fe30=_[_0x6c75('0x3c')]({},_0x40fe30,_0x468e28[_0x6c75('0x3d')]);return _0x4ac5ff['getSubjects'](_0x40fe30);}})[_0x6c75('0x20')](function(_0xe1ef7){if(_0xe1ef7){_0x4727cc=_0xe1ef7[_0x6c75('0x33')];if(!_0x468e28[_0x6c75('0x2e')]['hasOwnProperty'](_0x6c75('0x4c'))){_0x40fe30[_0x6c75('0x34')]=qs[_0x6c75('0x34')](_0x468e28[_0x6c75('0x2e')][_0x6c75('0x34')]);_0x40fe30[_0x6c75('0x19')]=qs[_0x6c75('0x19')](_0x468e28[_0x6c75('0x2e')][_0x6c75('0x19')]);}return _0x4ac5ff[_0x6c75('0x4b')](_0x40fe30);}})[_0x6c75('0x20')](function(_0x5a76d1){if(_0x5a76d1){return _0x5a76d1?{'count':_0x4727cc,'rows':_0x5a76d1}:null;}})['then'](respondWithResult(_0x162998,null))[_0x6c75('0x42')](handleError(_0x162998,null));};exports[_0x6c75('0x4d')]=function(_0x1dfa8e,_0x3bd7cb,_0x51f675){var _0x54cf64={};var _0x5bab35={};var _0x32b4f3;var _0x288511;return db[_0x6c75('0x29')][_0x6c75('0x48')]({'where':{'id':_0x1dfa8e['params']['id']}})['then'](handleEntityNotFound(_0x3bd7cb,null))[_0x6c75('0x20')](function(_0x171a17){if(_0x171a17){_0x32b4f3=_0x171a17;_0x5bab35['model']=_['keys'](db[_0x6c75('0x49')][_0x6c75('0x2a')]);_0x5bab35[_0x6c75('0x2e')]=_[_0x6c75('0x2f')](_0x1dfa8e[_0x6c75('0x2e')]);_0x5bab35[_0x6c75('0x39')]=_[_0x6c75('0x31')](_0x5bab35[_0x6c75('0x2d')],_0x5bab35[_0x6c75('0x2e')]);_0x54cf64[_0x6c75('0x30')]=_[_0x6c75('0x31')](_0x5bab35[_0x6c75('0x2d')],qs[_0x6c75('0x32')](_0x1dfa8e['query'][_0x6c75('0x32')]));_0x54cf64[_0x6c75('0x30')]=_0x54cf64[_0x6c75('0x30')]['length']?_0x54cf64[_0x6c75('0x30')]:_0x5bab35[_0x6c75('0x2d')];_0x54cf64[_0x6c75('0x35')]=qs[_0x6c75('0x36')](_0x1dfa8e[_0x6c75('0x2e')][_0x6c75('0x36')]);_0x54cf64['where']=qs['filters'](_[_0x6c75('0x38')](_0x1dfa8e['query'],_0x5bab35[_0x6c75('0x39')]));if(_0x1dfa8e[_0x6c75('0x2e')][_0x6c75('0x3b')]){_0x54cf64[_0x6c75('0x37')]=_[_0x6c75('0x3c')](_0x54cf64[_0x6c75('0x37')],{'$or':_[_0x6c75('0x28')](_0x54cf64[_0x6c75('0x30')],function(_0x36260){var _0x102a78={};_0x102a78[_0x36260]={'$like':'%'+_0x1dfa8e[_0x6c75('0x2e')][_0x6c75('0x3b')]+'%'};return _0x102a78;})});}_0x54cf64=_[_0x6c75('0x3c')]({},_0x54cf64,_0x1dfa8e[_0x6c75('0x3d')]);return _0x32b4f3[_0x6c75('0x4d')](_0x54cf64);}})[_0x6c75('0x20')](function(_0xe14b9c){if(_0xe14b9c){_0x288511=_0xe14b9c[_0x6c75('0x33')];if(!_0x1dfa8e['query'][_0x6c75('0x4a')]('nolimit')){_0x54cf64[_0x6c75('0x34')]=qs[_0x6c75('0x34')](_0x1dfa8e[_0x6c75('0x2e')][_0x6c75('0x34')]);_0x54cf64[_0x6c75('0x19')]=qs['offset'](_0x1dfa8e[_0x6c75('0x2e')][_0x6c75('0x19')]);}return _0x32b4f3[_0x6c75('0x4d')](_0x54cf64);}})['then'](function(_0x129cdc){if(_0x129cdc){return _0x129cdc?{'count':_0x288511,'rows':_0x129cdc}:null;}})[_0x6c75('0x20')](respondWithResult(_0x3bd7cb,null))[_0x6c75('0x42')](handleError(_0x3bd7cb,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index fa62fa9..79afb66 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.model.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc3b=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','../../config/logger','api','bluebird'];(function(_0x3bdc1b,_0x38ff12){var _0x2209bb=function(_0x5458fe){while(--_0x5458fe){_0x3bdc1b['push'](_0x3bdc1b['shift']());}};_0x2209bb(++_0x38ff12);}(_0xcc3b,0x189));var _0xbcc3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcc3b[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbcc3('0x0'))(_0xbcc3('0x1'));var moment=require('moment');var BPromise=require(_0xbcc3('0x2'));var rp=require(_0xbcc3('0x3'));var fs=require('fs');var path=require(_0xbcc3('0x4'));var rimraf=require(_0xbcc3('0x5'));var config=require(_0xbcc3('0x6'));var attributes=require(_0xbcc3('0x7'));module['exports']=function(_0x549671,_0x3eb89f){return _0x549671[_0xbcc3('0x8')](_0xbcc3('0x9'),attributes,{'tableName':_0xbcc3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d18=['./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d18,0xf6));var _0x86d1=function(_0x45aa87,_0x5eca09){_0x45aa87=_0x45aa87-0x0;var _0x24cc34=_0x6d18[_0x45aa87];return _0x24cc34;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x86d1('0x0'))(_0x86d1('0x1'));var moment=require(_0x86d1('0x2'));var BPromise=require('bluebird');var rp=require(_0x86d1('0x3'));var fs=require('fs');var path=require(_0x86d1('0x4'));var rimraf=require(_0x86d1('0x5'));var config=require('../../config/environment');var attributes=require(_0x86d1('0x6'));module['exports']=function(_0x180693,_0x4f653b){return _0x180693['define'](_0x86d1('0x7'),attributes,{'tableName':_0x86d1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 0740f34..5a25086 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa18=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xfa18,0x14b));var _0x8fa1=function(_0x15ccc0,_0x2ceee3){_0x15ccc0=_0x15ccc0-0x0;var _0x251353=_0xfa18[_0x15ccc0];return _0x251353;};'use strict';var _=require(_0x8fa1('0x0'));var util=require(_0x8fa1('0x1'));var moment=require(_0x8fa1('0x2'));var BPromise=require(_0x8fa1('0x3'));var rs=require(_0x8fa1('0x4'));var fs=require('fs');var Redis=require(_0x8fa1('0x5'));var db=require(_0x8fa1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fa1('0x7'))(_0x8fa1('0x8'));var config=require(_0x8fa1('0x9'));var jayson=require(_0x8fa1('0xa'));var client=jayson[_0x8fa1('0xb')][_0x8fa1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x139723,_0x20f3c2,_0x2edb91){return new BPromise(function(_0x11fa5f,_0x265af3){return client[_0x8fa1('0xd')](_0x139723,_0x2edb91)[_0x8fa1('0xe')](function(_0x3cca2e){logger[_0x8fa1('0xf')](_0x8fa1('0x10'),_0x20f3c2,_0x8fa1('0x11'));logger[_0x8fa1('0x12')](_0x8fa1('0x13'),_0x20f3c2,_0x8fa1('0x11'),JSON[_0x8fa1('0x14')](_0x3cca2e));if(_0x3cca2e['error']){if(_0x3cca2e[_0x8fa1('0x15')][_0x8fa1('0x16')]===0x1f4){logger['error'](_0x8fa1('0x10'),_0x20f3c2,_0x3cca2e[_0x8fa1('0x15')][_0x8fa1('0x17')]);return _0x265af3(_0x3cca2e['error']['message']);}logger[_0x8fa1('0x15')](_0x8fa1('0x10'),_0x20f3c2,_0x3cca2e[_0x8fa1('0x15')][_0x8fa1('0x17')]);return _0x11fa5f(_0x3cca2e[_0x8fa1('0x15')]['message']);}else{logger['info'](_0x8fa1('0x10'),_0x20f3c2,_0x8fa1('0x11'));_0x11fa5f(_0x3cca2e[_0x8fa1('0x18')][_0x8fa1('0x17')]);}})[_0x8fa1('0x19')](function(_0x23a97b){logger[_0x8fa1('0x15')](_0x8fa1('0x10'),_0x20f3c2,_0x23a97b);_0x265af3(_0x23a97b);});});} \ No newline at end of file +var _0x8333=['bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x49088a,_0xa2b35c){var _0x3a522d=function(_0x19cf27){while(--_0x19cf27){_0x49088a['push'](_0x49088a['shift']());}};_0x3a522d(++_0xa2b35c);}(_0x8333,0xc6));var _0x3833=function(_0x542333,_0x27051e){_0x542333=_0x542333-0x0;var _0x5d34b2=_0x8333[_0x542333];return _0x5d34b2;};'use strict';var _=require(_0x3833('0x0'));var util=require(_0x3833('0x1'));var moment=require('moment');var BPromise=require(_0x3833('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3833('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3833('0x4'));var logger=require(_0x3833('0x5'))('rpc');var config=require(_0x3833('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3833('0x7')][_0x3833('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ab351,_0x13ce7a,_0xa98d70){return new BPromise(function(_0x2232d6,_0x30c0ea){return client[_0x3833('0x9')](_0x2ab351,_0xa98d70)[_0x3833('0xa')](function(_0x191d7b){logger[_0x3833('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x13ce7a,_0x3833('0xc'));logger['debug'](_0x3833('0xd'),_0x13ce7a,_0x3833('0xc'),JSON[_0x3833('0xe')](_0x191d7b));if(_0x191d7b[_0x3833('0xf')]){if(_0x191d7b[_0x3833('0xf')][_0x3833('0x10')]===0x1f4){logger[_0x3833('0xf')](_0x3833('0x11'),_0x13ce7a,_0x191d7b[_0x3833('0xf')][_0x3833('0x12')]);return _0x30c0ea(_0x191d7b[_0x3833('0xf')][_0x3833('0x12')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x13ce7a,_0x191d7b[_0x3833('0xf')][_0x3833('0x12')]);return _0x2232d6(_0x191d7b[_0x3833('0xf')][_0x3833('0x12')]);}else{logger[_0x3833('0xb')](_0x3833('0x11'),_0x13ce7a,_0x3833('0xc'));_0x2232d6(_0x191d7b['result'][_0x3833('0x12')]);}})[_0x3833('0x13')](function(_0x1e3cce){logger['error'](_0x3833('0x11'),_0x13ce7a,_0x1e3cce);_0x30c0ea(_0x1e3cce);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e6cce44..08bd5df 100644 --- a/server/api/intZohoField/index.js +++ b/server/api/intZohoField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf60=['get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xcf60,0x122));var _0x0cf6=function(_0x510118,_0x381c75){_0x510118=_0x510118-0x0;var _0x153431=_0xcf60[_0x510118];return _0x153431;};'use strict';var multer=require(_0x0cf6('0x0'));var util=require(_0x0cf6('0x1'));var path=require(_0x0cf6('0x2'));var timeout=require(_0x0cf6('0x3'));var express=require(_0x0cf6('0x4'));var router=express[_0x0cf6('0x5')]();var fs_extra=require(_0x0cf6('0x6'));var auth=require(_0x0cf6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0cf6('0x8'));var controller=require(_0x0cf6('0x9'));router[_0x0cf6('0xa')]('/',auth[_0x0cf6('0xb')](),controller[_0x0cf6('0xc')]);router[_0x0cf6('0xa')](_0x0cf6('0xd'),auth[_0x0cf6('0xb')](),controller[_0x0cf6('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0cf6('0xf')]);router[_0x0cf6('0x10')](_0x0cf6('0xd'),auth[_0x0cf6('0xb')](),controller[_0x0cf6('0x11')]);router['delete']('/:id',auth[_0x0cf6('0xb')](),controller[_0x0cf6('0x12')]);module[_0x0cf6('0x13')]=router; \ No newline at end of file +var _0x6211=['isAuthenticated','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','/:id'];(function(_0x3322e4,_0x473b9d){var _0x292653=function(_0x2e12c6){while(--_0x2e12c6){_0x3322e4['push'](_0x3322e4['shift']());}};_0x292653(++_0x473b9d);}(_0x6211,0xc2));var _0x1621=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6211[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x1621('0x0'));var path=require(_0x1621('0x1'));var timeout=require(_0x1621('0x2'));var express=require(_0x1621('0x3'));var router=express[_0x1621('0x4')]();var fs_extra=require(_0x1621('0x5'));var auth=require(_0x1621('0x6'));var interaction=require(_0x1621('0x7'));var config=require('../../config/environment');var controller=require(_0x1621('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1621('0x9'),auth[_0x1621('0xa')](),controller['show']);router[_0x1621('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1621('0xc')](_0x1621('0x9'),auth[_0x1621('0xa')](),controller[_0x1621('0xd')]);router[_0x1621('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1621('0xf')]);module[_0x1621('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 5f3fe2f..6eeb6a8 100644 --- a/server/api/intZohoField/intZohoField.attributes.js +++ b/server/api/intZohoField/intZohoField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2203=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x1b8f52,_0x111226){var _0x17c536=function(_0x3cbea5){while(--_0x3cbea5){_0x1b8f52['push'](_0x1b8f52['shift']());}};_0x17c536(++_0x111226);}(_0x2203,0x127));var _0x3220=function(_0x2276f4,_0x4b0ee5){_0x2276f4=_0x2276f4-0x0;var _0x17186c=_0x2203[_0x2276f4];return _0x17186c;};'use strict';var Sequelize=require(_0x3220('0x0'));module[_0x3220('0x1')]={'type':{'type':Sequelize[_0x3220('0x2')](_0x3220('0x3'),'variable',_0x3220('0x4'),_0x3220('0x5'),'picklist'),'defaultValue':_0x3220('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3220('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3220('0x7'),_0x3220('0x4'))},'keyContent':{'type':Sequelize[_0x3220('0x6')]},'idField':{'type':Sequelize[_0x3220('0x6')]},'nameField':{'type':Sequelize[_0x3220('0x6')]},'customField':{'type':Sequelize[_0x3220('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3220('0x6')]}}; \ No newline at end of file +var _0xdc0a=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x344d05,_0x5e73b1){var _0x22ece5=function(_0x6a9bc){while(--_0x6a9bc){_0x344d05['push'](_0x344d05['shift']());}};_0x22ece5(++_0x5e73b1);}(_0xdc0a,0x70));var _0xadc0=function(_0x5498d6,_0x210612){_0x5498d6=_0x5498d6-0x0;var _0x275f87=_0xdc0a[_0x5498d6];return _0x275f87;};'use strict';var Sequelize=require(_0xadc0('0x0'));module['exports']={'type':{'type':Sequelize[_0xadc0('0x1')](_0xadc0('0x2'),_0xadc0('0x3'),_0xadc0('0x4'),_0xadc0('0x5'),'picklist'),'defaultValue':_0xadc0('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xadc0('0x1')]('string',_0xadc0('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xadc0('0x6')]},'idField':{'type':Sequelize[_0xadc0('0x6')]},'nameField':{'type':Sequelize[_0xadc0('0x6')]},'customField':{'type':Sequelize[_0xadc0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 1c140e5..03e9def 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xada7=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','error','send','index','map','fieldName','key','model','name','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ZohoField','then','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','create','body'];(function(_0x24b47d,_0x8780cf){var _0x4ab1a7=function(_0x3d754a){while(--_0x3d754a){_0x24b47d['push'](_0x24b47d['shift']());}};_0x4ab1a7(++_0x8780cf);}(_0xada7,0x186));var _0x7ada=function(_0x4433aa,_0xe66175){_0x4433aa=_0x4433aa-0x0;var _0x111c1b=_0xada7[_0x4433aa];return _0x111c1b;};'use strict';var emlformat=require(_0x7ada('0x0'));var rimraf=require(_0x7ada('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ada('0x2'));var rp=require(_0x7ada('0x3'));var moment=require(_0x7ada('0x4'));var BPromise=require(_0x7ada('0x5'));var Mustache=require(_0x7ada('0x6'));var util=require('util');var path=require(_0x7ada('0x7'));var sox=require(_0x7ada('0x8'));var csv=require(_0x7ada('0x9'));var ejs=require(_0x7ada('0xa'));var fs=require('fs');var fs_extra=require(_0x7ada('0xb'));var _=require(_0x7ada('0xc'));var squel=require('squel');var crypto=require(_0x7ada('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7ada('0x9'));var querystring=require(_0x7ada('0xe'));var Papa=require('papaparse');var Redis=require(_0x7ada('0xf'));var authService=require(_0x7ada('0x10'));var qs=require(_0x7ada('0x11'));var as=require(_0x7ada('0x12'));var hardwareService=require(_0x7ada('0x13'));var logger=require('../../config/logger')(_0x7ada('0x14'));var utils=require(_0x7ada('0x15'));var config=require(_0x7ada('0x16'));var licenseUtil=require(_0x7ada('0x17'));var db=require(_0x7ada('0x18'))['db'];function respondWithStatusCode(_0x1dbcda,_0x3c243f){_0x3c243f=_0x3c243f||0xcc;return function(_0x1af15c){if(_0x1af15c){return _0x1dbcda[_0x7ada('0x19')](_0x3c243f);}return _0x1dbcda[_0x7ada('0x1a')](_0x3c243f)[_0x7ada('0x1b')]();};}function respondWithResult(_0x38672a,_0x19c2ec){_0x19c2ec=_0x19c2ec||0xc8;return function(_0x4cabda){if(_0x4cabda){return _0x38672a['status'](_0x19c2ec)[_0x7ada('0x1c')](_0x4cabda);}};}function respondWithFilteredResult(_0x2d07ef,_0x4f2346){return function(_0x225a29){if(_0x225a29){var _0xd6efd=typeof _0x4f2346['offset']===_0x7ada('0x1d')&&typeof _0x4f2346[_0x7ada('0x1e')]===_0x7ada('0x1d');var _0x349a30=_0x225a29[_0x7ada('0x1f')];var _0x434e65=_0xd6efd?0x0:_0x4f2346[_0x7ada('0x20')];var _0x1e9376=_0xd6efd?_0x225a29[_0x7ada('0x1f')]:_0x4f2346[_0x7ada('0x20')]+_0x4f2346[_0x7ada('0x1e')];var _0x4fef9b;if(_0x1e9376>=_0x349a30){_0x1e9376=_0x349a30;_0x4fef9b=0xc8;}else{_0x4fef9b=0xce;}_0x2d07ef[_0x7ada('0x1a')](_0x4fef9b);return _0x2d07ef[_0x7ada('0x21')](_0x7ada('0x22'),_0x434e65+'-'+_0x1e9376+'/'+_0x349a30)['json'](_0x225a29);}return null;};}function patchUpdates(_0x2b6146){return function(_0x2c7119){try{jsonpatch[_0x7ada('0x23')](_0x2c7119,_0x2b6146,!![]);}catch(_0x48e273){return BPromise[_0x7ada('0x24')](_0x48e273);}return _0x2c7119[_0x7ada('0x25')]();};}function saveUpdates(_0x21a7ac,_0x25daef){return function(_0x44c842){if(_0x44c842){return _0x44c842[_0x7ada('0x26')](_0x21a7ac)['then'](function(_0x24bc11){return _0x24bc11;});}return null;};}function removeEntity(_0xf5f7ff,_0x16cdd2){return function(_0x241095){if(_0x241095){return _0x241095['destroy']()['then'](function(){_0xf5f7ff[_0x7ada('0x1a')](0xcc)[_0x7ada('0x1b')]();});}};}function handleEntityNotFound(_0x24be33,_0x4a3211){return function(_0x3f9ab1){if(!_0x3f9ab1){_0x24be33[_0x7ada('0x19')](0x194);}return _0x3f9ab1;};}function handleError(_0x275cbf,_0x58054a){_0x58054a=_0x58054a||0x1f4;return function(_0x1f29bd){logger[_0x7ada('0x27')](_0x1f29bd['stack']);if(_0x1f29bd['name']){delete _0x1f29bd['name'];}_0x275cbf[_0x7ada('0x1a')](_0x58054a)[_0x7ada('0x28')](_0x1f29bd);};}exports[_0x7ada('0x29')]=function(_0x552132,_0xdae7bb){var _0x187302={},_0x1510f3={},_0xa4b9be={'count':0x0,'rows':[]};var _0x16b9db=_[_0x7ada('0x2a')](db['ZohoField']['rawAttributes'],function(_0x1de558){return{'name':_0x1de558[_0x7ada('0x2b')],'type':_0x1de558['type'][_0x7ada('0x2c')]};});_0x1510f3[_0x7ada('0x2d')]=_['map'](_0x16b9db,_0x7ada('0x2e'));_0x1510f3[_0x7ada('0x2f')]=_['keys'](_0x552132[_0x7ada('0x2f')]);_0x1510f3[_0x7ada('0x30')]=_['intersection'](_0x1510f3[_0x7ada('0x2d')],_0x1510f3['query']);_0x187302[_0x7ada('0x31')]=_[_0x7ada('0x32')](_0x1510f3['model'],qs['fields'](_0x552132[_0x7ada('0x2f')]['fields']));_0x187302[_0x7ada('0x31')]=_0x187302[_0x7ada('0x31')][_0x7ada('0x33')]?_0x187302['attributes']:_0x1510f3[_0x7ada('0x2d')];if(!_0x552132['query'][_0x7ada('0x34')](_0x7ada('0x35'))){_0x187302[_0x7ada('0x1e')]=qs[_0x7ada('0x1e')](_0x552132[_0x7ada('0x2f')]['limit']);_0x187302['offset']=qs[_0x7ada('0x20')](_0x552132[_0x7ada('0x2f')][_0x7ada('0x20')]);}_0x187302[_0x7ada('0x36')]=qs['sort'](_0x552132['query'][_0x7ada('0x37')]);_0x187302[_0x7ada('0x38')]=qs[_0x7ada('0x30')](_[_0x7ada('0x39')](_0x552132[_0x7ada('0x2f')],_0x1510f3[_0x7ada('0x30')]),_0x16b9db);if(_0x552132[_0x7ada('0x2f')][_0x7ada('0x3a')]){_0x187302['where']=_[_0x7ada('0x3b')](_0x187302[_0x7ada('0x38')],{'$or':_[_0x7ada('0x2a')](_0x16b9db,function(_0x1f42b3){if(_0x1f42b3[_0x7ada('0x3c')]!==_0x7ada('0x3d')){var _0x3a43dc={};_0x3a43dc[_0x1f42b3['name']]={'$like':'%'+_0x552132[_0x7ada('0x2f')][_0x7ada('0x3a')]+'%'};return _0x3a43dc;}})});}_0x187302=_[_0x7ada('0x3b')]({},_0x187302,_0x552132[_0x7ada('0x3e')]);var _0x34a571={'where':_0x187302['where']};return db[_0x7ada('0x3f')][_0x7ada('0x1f')](_0x34a571)[_0x7ada('0x40')](function(_0x2a617e){_0xa4b9be['count']=_0x2a617e;if(_0x552132[_0x7ada('0x2f')][_0x7ada('0x41')]){_0x187302[_0x7ada('0x42')]=[{'all':!![]}];}return db[_0x7ada('0x3f')][_0x7ada('0x43')](_0x187302);})[_0x7ada('0x40')](function(_0x54969f){_0xa4b9be[_0x7ada('0x44')]=_0x54969f;return _0xa4b9be;})[_0x7ada('0x40')](respondWithFilteredResult(_0xdae7bb,_0x187302))[_0x7ada('0x45')](handleError(_0xdae7bb,null));};exports[_0x7ada('0x46')]=function(_0x237f73,_0x15184e){var _0x3a1926={'raw':!![],'where':{'id':_0x237f73[_0x7ada('0x47')]['id']}},_0x5c9a33={};_0x5c9a33[_0x7ada('0x2d')]=_[_0x7ada('0x48')](db[_0x7ada('0x3f')][_0x7ada('0x49')]);_0x5c9a33[_0x7ada('0x2f')]=_[_0x7ada('0x48')](_0x237f73['query']);_0x5c9a33['filters']=_[_0x7ada('0x32')](_0x5c9a33['model'],_0x5c9a33[_0x7ada('0x2f')]);_0x3a1926['attributes']=_[_0x7ada('0x32')](_0x5c9a33[_0x7ada('0x2d')],qs[_0x7ada('0x4a')](_0x237f73[_0x7ada('0x2f')][_0x7ada('0x4a')]));_0x3a1926[_0x7ada('0x31')]=_0x3a1926['attributes'][_0x7ada('0x33')]?_0x3a1926['attributes']:_0x5c9a33[_0x7ada('0x2d')];if(_0x237f73[_0x7ada('0x2f')][_0x7ada('0x41')]){_0x3a1926[_0x7ada('0x42')]=[{'all':!![]}];}_0x3a1926=_['merge']({},_0x3a1926,_0x237f73[_0x7ada('0x3e')]);return db[_0x7ada('0x3f')][_0x7ada('0x4b')](_0x3a1926)[_0x7ada('0x40')](handleEntityNotFound(_0x15184e,null))[_0x7ada('0x40')](respondWithResult(_0x15184e,null))['catch'](handleError(_0x15184e,null));};exports[_0x7ada('0x4c')]=function(_0x2d958d,_0x31cb19){return db[_0x7ada('0x3f')]['create'](_0x2d958d[_0x7ada('0x4d')],{})[_0x7ada('0x40')](respondWithResult(_0x31cb19,0xc9))[_0x7ada('0x45')](handleError(_0x31cb19,null));};exports[_0x7ada('0x26')]=function(_0x44d17c,_0x13310b){if(_0x44d17c['body']['id']){delete _0x44d17c['body']['id'];}return db[_0x7ada('0x3f')][_0x7ada('0x4b')]({'where':{'id':_0x44d17c[_0x7ada('0x47')]['id']}})[_0x7ada('0x40')](handleEntityNotFound(_0x13310b,null))[_0x7ada('0x40')](saveUpdates(_0x44d17c['body'],null))[_0x7ada('0x40')](respondWithResult(_0x13310b,null))['catch'](handleError(_0x13310b,null));};exports['destroy']=function(_0x25ead2,_0x2f7891){return db[_0x7ada('0x3f')][_0x7ada('0x4b')]({'where':{'id':_0x25ead2[_0x7ada('0x47')]['id']}})[_0x7ada('0x40')](handleEntityNotFound(_0x2f7891,null))['then'](removeEntity(_0x2f7891,null))[_0x7ada('0x45')](handleError(_0x2f7891,null));}; \ No newline at end of file +var _0x357d=['offset','limit','undefined','count','status','Content-Range','json','apply','reject','save','update','then','destroy','error','index','ZohoField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','filter','where','type','VIRTUAL','name','merge','options','includeAll','include','findAll','catch','show','length','find','body','params','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x1bd51d,_0x46f25e){var _0x116b83=function(_0x2d447c){while(--_0x2d447c){_0x1bd51d['push'](_0x1bd51d['shift']());}};_0x116b83(++_0x46f25e);}(_0x357d,0x17a));var _0xd357=function(_0x447fa9,_0x3c995c){_0x447fa9=_0x447fa9-0x0;var _0x2c7bb6=_0x357d[_0x447fa9];return _0x2c7bb6;};'use strict';var emlformat=require(_0xd357('0x0'));var rimraf=require(_0xd357('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd357('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd357('0x3'));var util=require(_0xd357('0x4'));var path=require(_0xd357('0x5'));var sox=require(_0xd357('0x6'));var csv=require(_0xd357('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd357('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd357('0x9'));var jsforce=require(_0xd357('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd357('0xb'));var Redis=require(_0xd357('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd357('0xd'));var as=require(_0xd357('0xe'));var hardwareService=require(_0xd357('0xf'));var logger=require(_0xd357('0x10'))(_0xd357('0x11'));var utils=require(_0xd357('0x12'));var config=require(_0xd357('0x13'));var licenseUtil=require(_0xd357('0x14'));var db=require(_0xd357('0x15'))['db'];function respondWithStatusCode(_0x2a28f6,_0xe74393){_0xe74393=_0xe74393||0xcc;return function(_0x2beef8){if(_0x2beef8){return _0x2a28f6[_0xd357('0x16')](_0xe74393);}return _0x2a28f6['status'](_0xe74393)[_0xd357('0x17')]();};}function respondWithResult(_0x12f3b4,_0x1c9abe){_0x1c9abe=_0x1c9abe||0xc8;return function(_0x2a4d50){if(_0x2a4d50){return _0x12f3b4['status'](_0x1c9abe)['json'](_0x2a4d50);}};}function respondWithFilteredResult(_0x3e2393,_0x3308c1){return function(_0x28dbc2){if(_0x28dbc2){var _0x511753=typeof _0x3308c1[_0xd357('0x18')]==='undefined'&&typeof _0x3308c1[_0xd357('0x19')]===_0xd357('0x1a');var _0x236b3a=_0x28dbc2[_0xd357('0x1b')];var _0x31f6b2=_0x511753?0x0:_0x3308c1[_0xd357('0x18')];var _0x14dc23=_0x511753?_0x28dbc2['count']:_0x3308c1['offset']+_0x3308c1[_0xd357('0x19')];var _0x5d8b30;if(_0x14dc23>=_0x236b3a){_0x14dc23=_0x236b3a;_0x5d8b30=0xc8;}else{_0x5d8b30=0xce;}_0x3e2393[_0xd357('0x1c')](_0x5d8b30);return _0x3e2393['set'](_0xd357('0x1d'),_0x31f6b2+'-'+_0x14dc23+'/'+_0x236b3a)[_0xd357('0x1e')](_0x28dbc2);}return null;};}function patchUpdates(_0x55e797){return function(_0x4cecb0){try{jsonpatch[_0xd357('0x1f')](_0x4cecb0,_0x55e797,!![]);}catch(_0x48d61d){return BPromise[_0xd357('0x20')](_0x48d61d);}return _0x4cecb0[_0xd357('0x21')]();};}function saveUpdates(_0x23039d,_0x44a855){return function(_0x22b17c){if(_0x22b17c){return _0x22b17c[_0xd357('0x22')](_0x23039d)[_0xd357('0x23')](function(_0xbe1db5){return _0xbe1db5;});}return null;};}function removeEntity(_0x533086,_0x51311e){return function(_0x48cdb3){if(_0x48cdb3){return _0x48cdb3[_0xd357('0x24')]()[_0xd357('0x23')](function(){_0x533086['status'](0xcc)[_0xd357('0x17')]();});}};}function handleEntityNotFound(_0x15fa6f,_0xa1fb27){return function(_0x5bf3fe){if(!_0x5bf3fe){_0x15fa6f[_0xd357('0x16')](0x194);}return _0x5bf3fe;};}function handleError(_0x150d02,_0x179144){_0x179144=_0x179144||0x1f4;return function(_0x3f5239){logger[_0xd357('0x25')](_0x3f5239['stack']);if(_0x3f5239['name']){delete _0x3f5239['name'];}_0x150d02[_0xd357('0x1c')](_0x179144)['send'](_0x3f5239);};}exports[_0xd357('0x26')]=function(_0x1610a9,_0x4790d6){var _0x5c9f07={},_0x22507c={},_0x15c608={'count':0x0,'rows':[]};var _0x4cf919=_['map'](db[_0xd357('0x27')][_0xd357('0x28')],function(_0x37de43){return{'name':_0x37de43[_0xd357('0x29')],'type':_0x37de43['type']['key']};});_0x22507c[_0xd357('0x2a')]=_['map'](_0x4cf919,'name');_0x22507c[_0xd357('0x2b')]=_[_0xd357('0x2c')](_0x1610a9[_0xd357('0x2b')]);_0x22507c[_0xd357('0x2d')]=_[_0xd357('0x2e')](_0x22507c['model'],_0x22507c['query']);_0x5c9f07[_0xd357('0x2f')]=_[_0xd357('0x2e')](_0x22507c['model'],qs[_0xd357('0x30')](_0x1610a9[_0xd357('0x2b')][_0xd357('0x30')]));_0x5c9f07['attributes']=_0x5c9f07[_0xd357('0x2f')]['length']?_0x5c9f07[_0xd357('0x2f')]:_0x22507c[_0xd357('0x2a')];if(!_0x1610a9[_0xd357('0x2b')][_0xd357('0x31')]('nolimit')){_0x5c9f07[_0xd357('0x19')]=qs[_0xd357('0x19')](_0x1610a9['query'][_0xd357('0x19')]);_0x5c9f07['offset']=qs['offset'](_0x1610a9[_0xd357('0x2b')][_0xd357('0x18')]);}_0x5c9f07['order']=qs[_0xd357('0x32')](_0x1610a9[_0xd357('0x2b')][_0xd357('0x32')]);_0x5c9f07['where']=qs[_0xd357('0x2d')](_['pick'](_0x1610a9[_0xd357('0x2b')],_0x22507c[_0xd357('0x2d')]),_0x4cf919);if(_0x1610a9[_0xd357('0x2b')][_0xd357('0x33')]){_0x5c9f07[_0xd357('0x34')]=_['merge'](_0x5c9f07[_0xd357('0x34')],{'$or':_['map'](_0x4cf919,function(_0x5ab9f2){if(_0x5ab9f2[_0xd357('0x35')]!==_0xd357('0x36')){var _0x58a07a={};_0x58a07a[_0x5ab9f2[_0xd357('0x37')]]={'$like':'%'+_0x1610a9[_0xd357('0x2b')][_0xd357('0x33')]+'%'};return _0x58a07a;}})});}_0x5c9f07=_[_0xd357('0x38')]({},_0x5c9f07,_0x1610a9[_0xd357('0x39')]);var _0x17ec5e={'where':_0x5c9f07['where']};return db[_0xd357('0x27')]['count'](_0x17ec5e)[_0xd357('0x23')](function(_0x5b7b7d){_0x15c608[_0xd357('0x1b')]=_0x5b7b7d;if(_0x1610a9[_0xd357('0x2b')][_0xd357('0x3a')]){_0x5c9f07[_0xd357('0x3b')]=[{'all':!![]}];}return db[_0xd357('0x27')][_0xd357('0x3c')](_0x5c9f07);})['then'](function(_0x3990fc){_0x15c608['rows']=_0x3990fc;return _0x15c608;})['then'](respondWithFilteredResult(_0x4790d6,_0x5c9f07))[_0xd357('0x3d')](handleError(_0x4790d6,null));};exports[_0xd357('0x3e')]=function(_0x1e1ff3,_0x49b997){var _0x477f8d={'raw':!![],'where':{'id':_0x1e1ff3['params']['id']}},_0x182373={};_0x182373[_0xd357('0x2a')]=_[_0xd357('0x2c')](db[_0xd357('0x27')][_0xd357('0x28')]);_0x182373[_0xd357('0x2b')]=_[_0xd357('0x2c')](_0x1e1ff3[_0xd357('0x2b')]);_0x182373['filters']=_[_0xd357('0x2e')](_0x182373[_0xd357('0x2a')],_0x182373['query']);_0x477f8d[_0xd357('0x2f')]=_['intersection'](_0x182373[_0xd357('0x2a')],qs[_0xd357('0x30')](_0x1e1ff3['query'][_0xd357('0x30')]));_0x477f8d['attributes']=_0x477f8d['attributes'][_0xd357('0x3f')]?_0x477f8d['attributes']:_0x182373[_0xd357('0x2a')];if(_0x1e1ff3['query'][_0xd357('0x3a')]){_0x477f8d[_0xd357('0x3b')]=[{'all':!![]}];}_0x477f8d=_[_0xd357('0x38')]({},_0x477f8d,_0x1e1ff3['options']);return db[_0xd357('0x27')][_0xd357('0x40')](_0x477f8d)['then'](handleEntityNotFound(_0x49b997,null))[_0xd357('0x23')](respondWithResult(_0x49b997,null))[_0xd357('0x3d')](handleError(_0x49b997,null));};exports['create']=function(_0x6fcb41,_0x2f4bf9){return db[_0xd357('0x27')]['create'](_0x6fcb41[_0xd357('0x41')],{})[_0xd357('0x23')](respondWithResult(_0x2f4bf9,0xc9))['catch'](handleError(_0x2f4bf9,null));};exports[_0xd357('0x22')]=function(_0x51514a,_0x46ad75){if(_0x51514a['body']['id']){delete _0x51514a['body']['id'];}return db[_0xd357('0x27')][_0xd357('0x40')]({'where':{'id':_0x51514a[_0xd357('0x42')]['id']}})[_0xd357('0x23')](handleEntityNotFound(_0x46ad75,null))[_0xd357('0x23')](saveUpdates(_0x51514a['body'],null))['then'](respondWithResult(_0x46ad75,null))['catch'](handleError(_0x46ad75,null));};exports[_0xd357('0x24')]=function(_0x27b532,_0x47a8f0){return db[_0xd357('0x27')]['find']({'where':{'id':_0x27b532[_0xd357('0x42')]['id']}})['then'](handleEntityNotFound(_0x47a8f0,null))[_0xd357('0x23')](removeEntity(_0x47a8f0,null))[_0xd357('0x3d')](handleError(_0x47a8f0,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 75e7722..ec6a088 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['zoho_unique_index','FieldId','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intZohoField.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['idField',_0xee2f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47c5=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intZohoField.attributes','exports','define'];(function(_0x1dc0b9,_0x43ffca){var _0x20013a=function(_0x147ffa){while(--_0x147ffa){_0x1dc0b9['push'](_0x1dc0b9['shift']());}};_0x20013a(++_0x43ffca);}(_0x47c5,0x165));var _0x547c=function(_0x3dc85,_0x4f2d39){_0x3dc85=_0x3dc85-0x0;var _0x3e938e=_0x47c5[_0x3dc85];return _0x3e938e;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var logger=require(_0x547c('0x2'))(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x547c('0x6'));var rimraf=require(_0x547c('0x7'));var config=require('../../config/environment');var attributes=require(_0x547c('0x8'));module[_0x547c('0x9')]=function(_0x51ab7f,_0x2e5b57){return _0x51ab7f[_0x547c('0xa')](_0x547c('0xb'),attributes,{'tableName':_0x547c('0xc'),'paranoid':![],'indexes':[{'name':_0x547c('0xd'),'fields':[_0x547c('0xe'),_0x547c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index ead30af..8286a70 100644 --- a/server/api/intZohoField/intZohoField.rpc.js +++ b/server/api/intZohoField/intZohoField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8033=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2ae2c3,_0x3a79b8){var _0x2b30d1=function(_0xad4f88){while(--_0xad4f88){_0x2ae2c3['push'](_0x2ae2c3['shift']());}};_0x2b30d1(++_0x3a79b8);}(_0x8033,0x78));var _0x3803=function(_0x19d3f2,_0x20bd43){_0x19d3f2=_0x19d3f2-0x0;var _0x17bfca=_0x8033[_0x19d3f2];return _0x17bfca;};'use strict';var _=require('lodash');var util=require(_0x3803('0x0'));var moment=require(_0x3803('0x1'));var BPromise=require(_0x3803('0x2'));var rs=require(_0x3803('0x3'));var fs=require('fs');var Redis=require(_0x3803('0x4'));var db=require(_0x3803('0x5'))['db'];var utils=require(_0x3803('0x6'));var logger=require(_0x3803('0x7'))(_0x3803('0x8'));var config=require(_0x3803('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3803('0xa')][_0x3803('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ee3d3,_0x379cdf,_0x429d65){return new BPromise(function(_0x3504f6,_0x5b3128){return client[_0x3803('0xc')](_0x5ee3d3,_0x429d65)[_0x3803('0xd')](function(_0xf84703){logger[_0x3803('0xe')](_0x3803('0xf'),_0x379cdf,_0x3803('0x10'));logger[_0x3803('0x11')](_0x3803('0x12'),_0x379cdf,'request\x20sent',JSON['stringify'](_0xf84703));if(_0xf84703[_0x3803('0x13')]){if(_0xf84703[_0x3803('0x13')][_0x3803('0x14')]===0x1f4){logger['error'](_0x3803('0xf'),_0x379cdf,_0xf84703[_0x3803('0x13')][_0x3803('0x15')]);return _0x5b3128(_0xf84703[_0x3803('0x13')][_0x3803('0x15')]);}logger['error'](_0x3803('0xf'),_0x379cdf,_0xf84703[_0x3803('0x13')][_0x3803('0x15')]);return _0x3504f6(_0xf84703[_0x3803('0x13')][_0x3803('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x379cdf,_0x3803('0x10'));_0x3504f6(_0xf84703[_0x3803('0x16')][_0x3803('0x15')]);}})[_0x3803('0x17')](function(_0x2666d2){logger[_0x3803('0x13')]('ZohoField,\x20%s,\x20%s',_0x379cdf,_0x2666d2);_0x5b3128(_0x2666d2);});});} \ No newline at end of file +var _0x5e1b=['http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5e1b,0x150));var _0xb5e1=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x5e1b[_0x155c64];return _0x1f154a;};'use strict';var _=require('lodash');var util=require(_0xb5e1('0x0'));var moment=require('moment');var BPromise=require(_0xb5e1('0x1'));var rs=require(_0xb5e1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5e1('0x3'))['db'];var utils=require(_0xb5e1('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb5e1('0x5'));var client=jayson['client'][_0xb5e1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1944cd,_0x323d2e,_0x1e4be2){return new BPromise(function(_0x238367,_0xa98af3){return client[_0xb5e1('0x7')](_0x1944cd,_0x1e4be2)[_0xb5e1('0x8')](function(_0x36c572){logger[_0xb5e1('0x9')](_0xb5e1('0xa'),_0x323d2e,_0xb5e1('0xb'));logger[_0xb5e1('0xc')](_0xb5e1('0xd'),_0x323d2e,_0xb5e1('0xb'),JSON['stringify'](_0x36c572));if(_0x36c572['error']){if(_0x36c572[_0xb5e1('0xe')]['code']===0x1f4){logger[_0xb5e1('0xe')](_0xb5e1('0xa'),_0x323d2e,_0x36c572[_0xb5e1('0xe')][_0xb5e1('0xf')]);return _0xa98af3(_0x36c572[_0xb5e1('0xe')][_0xb5e1('0xf')]);}logger[_0xb5e1('0xe')](_0xb5e1('0xa'),_0x323d2e,_0x36c572[_0xb5e1('0xe')][_0xb5e1('0xf')]);return _0x238367(_0x36c572[_0xb5e1('0xe')][_0xb5e1('0xf')]);}else{logger[_0xb5e1('0x9')](_0xb5e1('0xa'),_0x323d2e,_0xb5e1('0xb'));_0x238367(_0x36c572[_0xb5e1('0x10')][_0xb5e1('0xf')]);}})[_0xb5e1('0x11')](function(_0x266161){logger[_0xb5e1('0xe')](_0xb5e1('0xa'),_0x323d2e,_0x266161);_0xa98af3(_0x266161);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 6ca949b..d0b5850 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x27d135,_0x16015e){var _0x1463d1=function(_0x3da67d){while(--_0x3da67d){_0x27d135['push'](_0x27d135['shift']());}};_0x1463d1(++_0x16015e);}(_0xe706,0xa3));var _0x6e70=function(_0x22a3f0,_0x513d0e){_0x22a3f0=_0x22a3f0-0x0;var _0x2d8a9c=_0xe706[_0x22a3f0];return _0x2d8a9c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x27d442,_0x47a4b6){var _0x1ffab8=function(_0x207748){while(--_0x207748){_0x27d442['push'](_0x27d442['shift']());}};_0x1ffab8(++_0x47a4b6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9dac0cb..866e664 100644 --- a/server/api/integration/integration.attributes.js +++ b/server/api/integration/integration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1a4=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb1a4,0x80));var _0x4b1a=function(_0x4ebe2e,_0x2edd20){_0x4ebe2e=_0x4ebe2e-0x0;var _0x1a2515=_0xb1a4[_0x4ebe2e];return _0x1a2515;};'use strict';var Sequelize=require(_0x4b1a('0x0'));module[_0x4b1a('0x1')]={'name':{'type':Sequelize[_0x4b1a('0x2')],'allowNull':![],'unique':_0x4b1a('0x3')},'version':{'type':Sequelize[_0x4b1a('0x2')],'allowNull':![],'unique':_0x4b1a('0x3')},'main':{'type':Sequelize[_0x4b1a('0x2')],'defaultValue':_0x4b1a('0x4')},'filename':{'type':Sequelize[_0x4b1a('0x2')]},'path':{'type':Sequelize[_0x4b1a('0x2')]},'type':{'type':Sequelize[_0x4b1a('0x2')]},'size':{'type':Sequelize[_0x4b1a('0x5')]},'active':{'type':Sequelize[_0x4b1a('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x4b1a('0x2')]},'logo':{'type':Sequelize[_0x4b1a('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x4b1a('0x7')},'description':{'type':Sequelize[_0x4b1a('0x2')]},'title':{'type':Sequelize[_0x4b1a('0x2')]},'remoteUri':{'type':Sequelize[_0x4b1a('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x08ff=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0xb0268d,_0x19c5aa){var _0x59c8f5=function(_0x5b9b47){while(--_0x5b9b47){_0xb0268d['push'](_0xb0268d['shift']());}};_0x59c8f5(++_0x19c5aa);}(_0x08ff,0x72));var _0xf08f=function(_0x29bb0a,_0x4a49e6){_0x29bb0a=_0x29bb0a-0x0;var _0x1725e4=_0x08ff[_0x29bb0a];return _0x1725e4;};'use strict';var Sequelize=require(_0xf08f('0x0'));module[_0xf08f('0x1')]={'name':{'type':Sequelize[_0xf08f('0x2')],'allowNull':![],'unique':_0xf08f('0x3')},'version':{'type':Sequelize[_0xf08f('0x2')],'allowNull':![],'unique':_0xf08f('0x3')},'main':{'type':Sequelize[_0xf08f('0x2')],'defaultValue':_0xf08f('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xf08f('0x2')]},'type':{'type':Sequelize[_0xf08f('0x2')]},'size':{'type':Sequelize[_0xf08f('0x5')]},'active':{'type':Sequelize[_0xf08f('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xf08f('0x2')],'unique':_0xf08f('0x7')},'description':{'type':Sequelize[_0xf08f('0x2')]},'title':{'type':Sequelize[_0xf08f('0x2')]},'remoteUri':{'type':Sequelize[_0xf08f('0x2')]},'link':{'type':Sequelize[_0xf08f('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 8029b36..01b54c5 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc4=['reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','Integration','includeAll','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x2d4ab9,_0x24d1eb){var _0x336c9b=function(_0x24e611){while(--_0x24e611){_0x2d4ab9['push'](_0x2d4ab9['shift']());}};_0x336c9b(++_0x24d1eb);}(_0xafc4,0x69));var _0x4afc=function(_0x13b62c,_0x32d8cd){_0x13b62c=_0x13b62c-0x0;var _0x4fe781=_0xafc4[_0x13b62c];return _0x4fe781;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['Integration'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['Integration']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));}; \ No newline at end of file +var _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','Integration','fieldName','type','key'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xadb5,0xad));var _0x5adb=function(_0x498970,_0x19ca43){_0x498970=_0x498970-0x0;var _0x27b285=_0xadb5[_0x498970];return _0x27b285;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['Integration']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f7d9c38..dc68fe8 100644 --- a/server/api/integration/integration.model.js +++ b/server/api/integration/integration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0780=['define','Integration','integrations','lodash','api','moment','path','rimraf','../../config/environment','./integration.attributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0780,0x1e3));var _0x0078=function(_0x395619,_0x1e0cef){_0x395619=_0x395619-0x0;var _0x561a46=_0x0780[_0x395619];return _0x561a46;};'use strict';var _=require(_0x0078('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0078('0x1'));var moment=require(_0x0078('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0078('0x3'));var rimraf=require(_0x0078('0x4'));var config=require(_0x0078('0x5'));var attributes=require(_0x0078('0x6'));module['exports']=function(_0x50503c,_0x291052){return _0x50503c[_0x0078('0x7')](_0x0078('0x8'),attributes,{'tableName':_0x0078('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6104=['./integration.attributes','exports','Integration','integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c9296,_0x5d07f5){var _0x3d8557=function(_0x2143e6){while(--_0x2143e6){_0x4c9296['push'](_0x4c9296['shift']());}};_0x3d8557(++_0x5d07f5);}(_0x6104,0x12f));var _0x4610=function(_0x55ce43,_0x31b1f8){_0x55ce43=_0x55ce43-0x0;var _0x402dd3=_0x6104[_0x55ce43];return _0x402dd3;};'use strict';var _=require(_0x4610('0x0'));var util=require('util');var logger=require(_0x4610('0x1'))(_0x4610('0x2'));var moment=require(_0x4610('0x3'));var BPromise=require(_0x4610('0x4'));var rp=require(_0x4610('0x5'));var fs=require('fs');var path=require(_0x4610('0x6'));var rimraf=require(_0x4610('0x7'));var config=require(_0x4610('0x8'));var attributes=require(_0x4610('0x9'));module[_0x4610('0xa')]=function(_0x4f8b3c,_0x46213f){return _0x4f8b3c['define'](_0x4610('0xb'),attributes,{'tableName':_0x4610('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 06199b9..2c2bccd 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x524e,0x15e));var _0xe524=function(_0x139456,_0x2ea98d){_0x139456=_0x139456-0x0;var _0x5e08a6=_0x524e[_0x139456];return _0x5e08a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x2f0534,_0xa894bc){var _0x521591=function(_0x160f1f){while(--_0x160f1f){_0x2f0534['push'](_0x2f0534['shift']());}};_0x521591(++_0xa894bc);}(_0x9f0e,0x116));var _0xe9f0=function(_0x5b84b3,_0xf74fe){_0x5b84b3=_0x5b84b3-0x0;var _0xe17246=_0x9f0e[_0x5b84b3];return _0xe17246;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index c311f89..4a9fdcf 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x3a40cd,_0x4f8883){var _0x2ff433=function(_0x516b2b){while(--_0x516b2b){_0x3a40cd['push'](_0x3a40cd['shift']());}};_0x2ff433(++_0x4f8883);}(_0x57ca,0x108));var _0xa57c=function(_0x1eb6b4,_0x1a394c){_0x1eb6b4=_0x1eb6b4-0x0;var _0x46ec3e=_0x57ca[_0x1eb6b4];return _0x46ec3e;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file +var _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x28ada7,_0x37256e){var _0x53c1c0=function(_0x385b37){while(--_0x385b37){_0x28ada7['push'](_0x28ada7['shift']());}};_0x53c1c0(++_0x37256e);}(_0xba34,0x119));var _0x4ba3=function(_0x102306,_0x26e4ed){_0x102306=_0x102306-0x0;var _0x46c62b=_0xba34[_0x102306];return _0x46c62b;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f79244d..e924f25 100644 --- a/server/api/integrationReport/integrationReport.attributes.js +++ b/server/api/integrationReport/integrationReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd0e=['BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x273422,_0x11abe1){var _0x144440=function(_0x257f41){while(--_0x257f41){_0x273422['push'](_0x273422['shift']());}};_0x144440(++_0x11abe1);}(_0xfd0e,0xcc));var _0xefd0=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0xfd0e[_0x457b64];return _0x437111;};'use strict';var Sequelize=require(_0xefd0('0x0'));module[_0xefd0('0x1')]={'integration':{'type':Sequelize[_0xefd0('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xefd0('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xefd0('0x3')]},'contacts':{'type':Sequelize[_0xefd0('0x2')]},'uniqueid':{'type':Sequelize[_0xefd0('0x2')]},'calleridnum':{'type':Sequelize[_0xefd0('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xefd0('0x2')]},'membername':{'type':Sequelize[_0xefd0('0x2')]},'agentcalledAt':{'type':Sequelize[_0xefd0('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xefd0('0x3')]},'agentcomplete':{'type':Sequelize[_0xefd0('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xefd0('0x4')]},'talktime':{'type':Sequelize[_0xefd0('0x3')]},'agentacw':{'type':Sequelize[_0xefd0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xefd0('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xefd0('0x4')]},'agentdump':{'type':Sequelize[_0xefd0('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xefd0('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xefd0('0x2')]},'connectedlinename':{'type':Sequelize[_0xefd0('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xefd0('0x2')]},'context':{'type':Sequelize[_0xefd0('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xefd0('0x2')]},'destchannel':{'type':Sequelize[_0xefd0('0x2')]},'destchannelstate':{'type':Sequelize[_0xefd0('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xefd0('0x2')]},'destcalleridname':{'type':Sequelize[_0xefd0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xefd0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xefd0('0x2')]},'destlanguage':{'type':Sequelize[_0xefd0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xefd0('0x2')]},'destexten':{'type':Sequelize[_0xefd0('0x2')]},'destpriority':{'type':Sequelize[_0xefd0('0x2')]},'destuniqueid':{'type':Sequelize[_0xefd0('0x2')]},'messageId':{'type':Sequelize[_0xefd0('0x2')]},'inReplyTo':{'type':Sequelize[_0xefd0('0x2')]},'subject':{'type':Sequelize[_0xefd0('0x2')]},'from':{'type':Sequelize[_0xefd0('0x2')]},'to':{'type':Sequelize[_0xefd0('0x2')]},'cc':{'type':Sequelize[_0xefd0('0x2')]},'attachment':{'type':Sequelize[_0xefd0('0x6')]},'html':{'type':Sequelize[_0xefd0('0x6')]},'text':{'type':Sequelize[_0xefd0('0x6')]},'status':{'type':Sequelize[_0xefd0('0x7')](_0xefd0('0x8'),'SENDING',_0xefd0('0x9'),_0xefd0('0xa'))},'url':{'type':Sequelize[_0xefd0('0x2')]},'app':{'type':Sequelize[_0xefd0('0x2')]},'appdata':{'type':Sequelize[_0xefd0('0x2')]},'projectId':{'type':Sequelize[_0xefd0('0x3')]}}; \ No newline at end of file +var _0x1415=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x5cb608,_0x315164){var _0x2e8363=function(_0x1cf8d9){while(--_0x1cf8d9){_0x5cb608['push'](_0x5cb608['shift']());}};_0x2e8363(++_0x315164);}(_0x1415,0x78));var _0x5141=function(_0x41fb9c,_0x4e3b60){_0x41fb9c=_0x41fb9c-0x0;var _0x46099b=_0x1415[_0x41fb9c];return _0x46099b;};'use strict';var Sequelize=require(_0x5141('0x0'));module['exports']={'integration':{'type':Sequelize[_0x5141('0x1')]},'eventChannel':{'type':Sequelize[_0x5141('0x1')]},'exitStatus':{'type':Sequelize[_0x5141('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x5141('0x2')]},'contacts':{'type':Sequelize[_0x5141('0x1')]},'uniqueid':{'type':Sequelize[_0x5141('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5141('0x1')]},'queue':{'type':Sequelize[_0x5141('0x1')]},'interface':{'type':Sequelize[_0x5141('0x1')]},'membername':{'type':Sequelize[_0x5141('0x1')]},'agentcalledAt':{'type':Sequelize[_0x5141('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5141('0x3')]},'holdtime':{'type':Sequelize[_0x5141('0x2')]},'agentcomplete':{'type':Sequelize[_0x5141('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5141('0x3')]},'talktime':{'type':Sequelize[_0x5141('0x2')]},'agentacw':{'type':Sequelize[_0x5141('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5141('0x2')]},'reason':{'type':Sequelize[_0x5141('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x5141('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5141('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5141('0x3')]},'lastevent':{'type':Sequelize[_0x5141('0x1')]},'channel':{'type':Sequelize[_0x5141('0x1')]},'channelstate':{'type':Sequelize[_0x5141('0x2')]},'channelstatedesc':{'type':Sequelize[_0x5141('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5141('0x1')]},'connectedlinename':{'type':Sequelize[_0x5141('0x1')]},'language':{'type':Sequelize[_0x5141('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5141('0x1')]},'exten':{'type':Sequelize[_0x5141('0x1')]},'priority':{'type':Sequelize[_0x5141('0x1')]},'destchannel':{'type':Sequelize[_0x5141('0x1')]},'destchannelstate':{'type':Sequelize[_0x5141('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x5141('0x1')]},'destcalleridnum':{'type':Sequelize[_0x5141('0x1')]},'destcalleridname':{'type':Sequelize[_0x5141('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x5141('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x5141('0x1')]},'destlanguage':{'type':Sequelize[_0x5141('0x1')]},'destaccountcode':{'type':Sequelize[_0x5141('0x1')]},'destcontext':{'type':Sequelize[_0x5141('0x1')]},'destexten':{'type':Sequelize[_0x5141('0x1')]},'destpriority':{'type':Sequelize[_0x5141('0x1')]},'destuniqueid':{'type':Sequelize[_0x5141('0x1')]},'messageId':{'type':Sequelize[_0x5141('0x1')]},'inReplyTo':{'type':Sequelize[_0x5141('0x1')]},'subject':{'type':Sequelize[_0x5141('0x1')]},'from':{'type':Sequelize[_0x5141('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5141('0x1')]},'attachment':{'type':Sequelize[_0x5141('0x5')]},'html':{'type':Sequelize[_0x5141('0x5')]},'text':{'type':Sequelize[_0x5141('0x5')]},'status':{'type':Sequelize[_0x5141('0x6')](_0x5141('0x7'),_0x5141('0x8'),_0x5141('0x9'),_0x5141('0xa'))},'url':{'type':Sequelize[_0x5141('0x1')]},'app':{'type':Sequelize[_0x5141('0x1')]},'appdata':{'type':Sequelize[_0x5141('0x1')]},'projectId':{'type':Sequelize[_0x5141('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c84f78b..a4f40ed 100644 --- a/server/api/integrationReport/integrationReport.controller.js +++ b/server/api/integrationReport/integrationReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee7a=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','IntegrationReport','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x2eb6a9,_0x32574c){var _0x4c3f11=function(_0x366570){while(--_0x366570){_0x2eb6a9['push'](_0x2eb6a9['shift']());}};_0x4c3f11(++_0x32574c);}(_0xee7a,0x1d3));var _0xaee7=function(_0x2822c5,_0x1162bb){_0x2822c5=_0x2822c5-0x0;var _0x3face5=_0xee7a[_0x2822c5];return _0x3face5;};'use strict';var emlformat=require(_0xaee7('0x0'));var rimraf=require(_0xaee7('0x1'));var zipdir=require(_0xaee7('0x2'));var jsonpatch=require(_0xaee7('0x3'));var rp=require(_0xaee7('0x4'));var moment=require(_0xaee7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaee7('0x6'));var path=require(_0xaee7('0x7'));var sox=require(_0xaee7('0x8'));var csv=require(_0xaee7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaee7('0xa'));var _=require(_0xaee7('0xb'));var squel=require(_0xaee7('0xc'));var crypto=require(_0xaee7('0xd'));var jsforce=require(_0xaee7('0xe'));var deskjs=require(_0xaee7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaee7('0x10'));var Redis=require(_0xaee7('0x11'));var authService=require(_0xaee7('0x12'));var qs=require(_0xaee7('0x13'));var as=require(_0xaee7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaee7('0x15'))('api');var utils=require(_0xaee7('0x16'));var config=require(_0xaee7('0x17'));var licenseUtil=require(_0xaee7('0x18'));var db=require(_0xaee7('0x19'))['db'];function respondWithStatusCode(_0xeb0dd8,_0x36977){_0x36977=_0x36977||0xcc;return function(_0xe105b7){if(_0xe105b7){return _0xeb0dd8[_0xaee7('0x1a')](_0x36977);}return _0xeb0dd8[_0xaee7('0x1b')](_0x36977)['end']();};}function respondWithResult(_0xa93e5c,_0x351596){_0x351596=_0x351596||0xc8;return function(_0x42ed02){if(_0x42ed02){return _0xa93e5c[_0xaee7('0x1b')](_0x351596)['json'](_0x42ed02);}};}function respondWithFilteredResult(_0x108229,_0x590b94){return function(_0x3c041b){if(_0x3c041b){var _0x574831=typeof _0x590b94[_0xaee7('0x1c')]===_0xaee7('0x1d')&&typeof _0x590b94[_0xaee7('0x1e')]===_0xaee7('0x1d');var _0x5e4514=_0x3c041b[_0xaee7('0x1f')];var _0x59444d=_0x574831?0x0:_0x590b94[_0xaee7('0x1c')];var _0x3a690e=_0x574831?_0x3c041b[_0xaee7('0x1f')]:_0x590b94[_0xaee7('0x1c')]+_0x590b94[_0xaee7('0x1e')];var _0x4faf37;if(_0x3a690e>=_0x5e4514){_0x3a690e=_0x5e4514;_0x4faf37=0xc8;}else{_0x4faf37=0xce;}_0x108229[_0xaee7('0x1b')](_0x4faf37);return _0x108229[_0xaee7('0x20')]('Content-Range',_0x59444d+'-'+_0x3a690e+'/'+_0x5e4514)[_0xaee7('0x21')](_0x3c041b);}return null;};}function patchUpdates(_0x185f97){return function(_0x457841){try{jsonpatch[_0xaee7('0x22')](_0x457841,_0x185f97,!![]);}catch(_0x59f9ba){return BPromise[_0xaee7('0x23')](_0x59f9ba);}return _0x457841[_0xaee7('0x24')]();};}function saveUpdates(_0x3d09e3,_0x5a735d){return function(_0x234923){if(_0x234923){return _0x234923[_0xaee7('0x25')](_0x3d09e3)[_0xaee7('0x26')](function(_0x2d1363){return _0x2d1363;});}return null;};}function removeEntity(_0xcb2aeb,_0x3ff1af){return function(_0xadc417){if(_0xadc417){return _0xadc417['destroy']()[_0xaee7('0x26')](function(){_0xcb2aeb[_0xaee7('0x1b')](0xcc)[_0xaee7('0x27')]();});}};}function handleEntityNotFound(_0x3b51f1,_0x4ad266){return function(_0x3ff743){if(!_0x3ff743){_0x3b51f1['sendStatus'](0x194);}return _0x3ff743;};}function handleError(_0x3d71a7,_0x2817b2){_0x2817b2=_0x2817b2||0x1f4;return function(_0x39455a){logger['error'](_0x39455a[_0xaee7('0x28')]);if(_0x39455a[_0xaee7('0x29')]){delete _0x39455a[_0xaee7('0x29')];}_0x3d71a7[_0xaee7('0x1b')](_0x2817b2)[_0xaee7('0x2a')](_0x39455a);};}exports[_0xaee7('0x2b')]=function(_0x5986b9,_0x86a4b2){var _0x4e2224={},_0x213ef9={},_0x2a75ea={'count':0x0,'rows':[]};var _0x37d83d=_[_0xaee7('0x2c')](db['IntegrationReport'][_0xaee7('0x2d')],function(_0x342515){return{'name':_0x342515[_0xaee7('0x2e')],'type':_0x342515['type']['key']};});_0x213ef9[_0xaee7('0x2f')]=_[_0xaee7('0x2c')](_0x37d83d,_0xaee7('0x29'));_0x213ef9[_0xaee7('0x30')]=_[_0xaee7('0x31')](_0x5986b9[_0xaee7('0x30')]);_0x213ef9[_0xaee7('0x32')]=_[_0xaee7('0x33')](_0x213ef9[_0xaee7('0x2f')],_0x213ef9[_0xaee7('0x30')]);_0x4e2224[_0xaee7('0x34')]=_['intersection'](_0x213ef9[_0xaee7('0x2f')],qs[_0xaee7('0x35')](_0x5986b9[_0xaee7('0x30')][_0xaee7('0x35')]));_0x4e2224['attributes']=_0x4e2224['attributes'][_0xaee7('0x36')]?_0x4e2224['attributes']:_0x213ef9[_0xaee7('0x2f')];if(!_0x5986b9[_0xaee7('0x30')][_0xaee7('0x37')](_0xaee7('0x38'))){_0x4e2224['limit']=qs[_0xaee7('0x1e')](_0x5986b9[_0xaee7('0x30')]['limit']);_0x4e2224[_0xaee7('0x1c')]=qs[_0xaee7('0x1c')](_0x5986b9['query'][_0xaee7('0x1c')]);}_0x4e2224[_0xaee7('0x39')]=qs[_0xaee7('0x3a')](_0x5986b9[_0xaee7('0x30')]['sort']);_0x4e2224[_0xaee7('0x3b')]=qs[_0xaee7('0x32')](_[_0xaee7('0x3c')](_0x5986b9['query'],_0x213ef9[_0xaee7('0x32')]),_0x37d83d);if(_0x5986b9[_0xaee7('0x30')][_0xaee7('0x3d')]){_0x4e2224['where']=_[_0xaee7('0x3e')](_0x4e2224['where'],{'$or':_[_0xaee7('0x2c')](_0x37d83d,function(_0x22b29b){if(_0x22b29b[_0xaee7('0x3f')]!==_0xaee7('0x40')){var _0x592c30={};_0x592c30[_0x22b29b['name']]={'$like':'%'+_0x5986b9[_0xaee7('0x30')][_0xaee7('0x3d')]+'%'};return _0x592c30;}})});}_0x4e2224=_['merge']({},_0x4e2224,_0x5986b9[_0xaee7('0x41')]);var _0x4631a8={'where':_0x4e2224['where']};return db['IntegrationReport'][_0xaee7('0x1f')](_0x4631a8)[_0xaee7('0x26')](function(_0x3d012a){_0x2a75ea[_0xaee7('0x1f')]=_0x3d012a;if(_0x5986b9[_0xaee7('0x30')]['includeAll']){_0x4e2224[_0xaee7('0x42')]=[{'all':!![]}];}return db[_0xaee7('0x43')][_0xaee7('0x44')](_0x4e2224);})[_0xaee7('0x26')](function(_0x3a83f5){_0x2a75ea[_0xaee7('0x45')]=_0x3a83f5;return _0x2a75ea;})[_0xaee7('0x26')](respondWithFilteredResult(_0x86a4b2,_0x4e2224))[_0xaee7('0x46')](handleError(_0x86a4b2,null));};exports[_0xaee7('0x47')]=function(_0x283d49,_0x4c10cf){var _0x242d23={'raw':![],'where':{'id':_0x283d49['params']['id']}},_0x110be1={};_0x110be1[_0xaee7('0x2f')]=_[_0xaee7('0x31')](db['IntegrationReport'][_0xaee7('0x2d')]);_0x110be1[_0xaee7('0x30')]=_[_0xaee7('0x31')](_0x283d49[_0xaee7('0x30')]);_0x110be1[_0xaee7('0x32')]=_[_0xaee7('0x33')](_0x110be1[_0xaee7('0x2f')],_0x110be1['query']);_0x242d23[_0xaee7('0x34')]=_[_0xaee7('0x33')](_0x110be1[_0xaee7('0x2f')],qs[_0xaee7('0x35')](_0x283d49[_0xaee7('0x30')][_0xaee7('0x35')]));_0x242d23[_0xaee7('0x34')]=_0x242d23[_0xaee7('0x34')][_0xaee7('0x36')]?_0x242d23[_0xaee7('0x34')]:_0x110be1[_0xaee7('0x2f')];if(_0x283d49['query'][_0xaee7('0x48')]){_0x242d23[_0xaee7('0x42')]=[{'all':!![]}];}_0x242d23=_[_0xaee7('0x3e')]({},_0x242d23,_0x283d49['options']);return db[_0xaee7('0x43')][_0xaee7('0x49')](_0x242d23)['then'](handleEntityNotFound(_0x4c10cf,null))[_0xaee7('0x26')](respondWithResult(_0x4c10cf,null))[_0xaee7('0x46')](handleError(_0x4c10cf,null));};exports[_0xaee7('0x4a')]=function(_0x38a4ac,_0x116012){return db[_0xaee7('0x43')][_0xaee7('0x4a')](_0x38a4ac[_0xaee7('0x4b')],{})[_0xaee7('0x26')](respondWithResult(_0x116012,0xc9))[_0xaee7('0x46')](handleError(_0x116012,null));};exports['update']=function(_0x59e232,_0x1b54a0){if(_0x59e232[_0xaee7('0x4b')]['id']){delete _0x59e232[_0xaee7('0x4b')]['id'];}return db[_0xaee7('0x43')][_0xaee7('0x49')]({'where':{'id':_0x59e232[_0xaee7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b54a0,null))[_0xaee7('0x26')](saveUpdates(_0x59e232[_0xaee7('0x4b')],null))[_0xaee7('0x26')](respondWithResult(_0x1b54a0,null))['catch'](handleError(_0x1b54a0,null));};exports[_0xaee7('0x4d')]=function(_0x34731c,_0x381489){return db['IntegrationReport'][_0xaee7('0x49')]({'where':{'id':_0x34731c[_0xaee7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x381489,null))[_0xaee7('0x26')](removeEntity(_0x381489,null))[_0xaee7('0x46')](handleError(_0x381489,null));};exports[_0xaee7('0x4e')]=function(_0xda5c8b,_0x36f3b4){return db[_0xaee7('0x43')]['describe']()['then'](respondWithResult(_0x36f3b4,null))[_0xaee7('0x46')](handleError(_0x36f3b4,null));}; \ No newline at end of file +var _0xefa1=['limit','set','Content-Range','apply','save','update','then','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','IntegrationReport','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xefa1,0x15d));var _0x1efa=function(_0x183eee,_0x1c0246){_0x183eee=_0x183eee-0x0;var _0x247399=_0xefa1[_0x183eee];return _0x247399;};'use strict';var emlformat=require(_0x1efa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1efa('0x1'));var jsonpatch=require(_0x1efa('0x2'));var rp=require('request-promise');var moment=require(_0x1efa('0x3'));var BPromise=require(_0x1efa('0x4'));var Mustache=require(_0x1efa('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1efa('0x6'));var ejs=require(_0x1efa('0x7'));var fs=require('fs');var fs_extra=require(_0x1efa('0x8'));var _=require(_0x1efa('0x9'));var squel=require(_0x1efa('0xa'));var crypto=require(_0x1efa('0xb'));var jsforce=require(_0x1efa('0xc'));var deskjs=require(_0x1efa('0xd'));var toCsv=require(_0x1efa('0x6'));var querystring=require(_0x1efa('0xe'));var Papa=require(_0x1efa('0xf'));var Redis=require(_0x1efa('0x10'));var authService=require(_0x1efa('0x11'));var qs=require(_0x1efa('0x12'));var as=require(_0x1efa('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1efa('0x14'))('api');var utils=require(_0x1efa('0x15'));var config=require(_0x1efa('0x16'));var licenseUtil=require(_0x1efa('0x17'));var db=require(_0x1efa('0x18'))['db'];function respondWithStatusCode(_0x4a18fd,_0x5f0bf5){_0x5f0bf5=_0x5f0bf5||0xcc;return function(_0x10a0b9){if(_0x10a0b9){return _0x4a18fd[_0x1efa('0x19')](_0x5f0bf5);}return _0x4a18fd[_0x1efa('0x1a')](_0x5f0bf5)[_0x1efa('0x1b')]();};}function respondWithResult(_0x7fa10a,_0x206763){_0x206763=_0x206763||0xc8;return function(_0x32cf57){if(_0x32cf57){return _0x7fa10a['status'](_0x206763)[_0x1efa('0x1c')](_0x32cf57);}};}function respondWithFilteredResult(_0x3a2875,_0x542781){return function(_0x372f58){if(_0x372f58){var _0x2a8a9b=typeof _0x542781[_0x1efa('0x1d')]===_0x1efa('0x1e')&&typeof _0x542781[_0x1efa('0x1f')]===_0x1efa('0x1e');var _0x41cf89=_0x372f58['count'];var _0x451c19=_0x2a8a9b?0x0:_0x542781['offset'];var _0x429498=_0x2a8a9b?_0x372f58['count']:_0x542781[_0x1efa('0x1d')]+_0x542781['limit'];var _0x2b42f3;if(_0x429498>=_0x41cf89){_0x429498=_0x41cf89;_0x2b42f3=0xc8;}else{_0x2b42f3=0xce;}_0x3a2875[_0x1efa('0x1a')](_0x2b42f3);return _0x3a2875[_0x1efa('0x20')](_0x1efa('0x21'),_0x451c19+'-'+_0x429498+'/'+_0x41cf89)[_0x1efa('0x1c')](_0x372f58);}return null;};}function patchUpdates(_0x202420){return function(_0x38fd7b){try{jsonpatch[_0x1efa('0x22')](_0x38fd7b,_0x202420,!![]);}catch(_0x416e0c){return BPromise['reject'](_0x416e0c);}return _0x38fd7b[_0x1efa('0x23')]();};}function saveUpdates(_0x157775,_0x468e51){return function(_0xee370a){if(_0xee370a){return _0xee370a[_0x1efa('0x24')](_0x157775)[_0x1efa('0x25')](function(_0x515666){return _0x515666;});}return null;};}function removeEntity(_0x57a1f9,_0x24bd4c){return function(_0x14063c){if(_0x14063c){return _0x14063c['destroy']()[_0x1efa('0x25')](function(){_0x57a1f9['status'](0xcc)[_0x1efa('0x1b')]();});}};}function handleEntityNotFound(_0x50b5a7,_0x52b95a){return function(_0x2ea1c9){if(!_0x2ea1c9){_0x50b5a7[_0x1efa('0x19')](0x194);}return _0x2ea1c9;};}function handleError(_0x7ef38c,_0x3a2a93){_0x3a2a93=_0x3a2a93||0x1f4;return function(_0x595de0){logger[_0x1efa('0x26')](_0x595de0['stack']);if(_0x595de0[_0x1efa('0x27')]){delete _0x595de0[_0x1efa('0x27')];}_0x7ef38c['status'](_0x3a2a93)[_0x1efa('0x28')](_0x595de0);};}exports[_0x1efa('0x29')]=function(_0x596736,_0x1a54cb){var _0x257d9d={},_0xe12b7c={},_0x1f4f82={'count':0x0,'rows':[]};var _0x2d1b26=_[_0x1efa('0x2a')](db['IntegrationReport'][_0x1efa('0x2b')],function(_0x388ec0){return{'name':_0x388ec0[_0x1efa('0x2c')],'type':_0x388ec0['type'][_0x1efa('0x2d')]};});_0xe12b7c[_0x1efa('0x2e')]=_[_0x1efa('0x2a')](_0x2d1b26,_0x1efa('0x27'));_0xe12b7c[_0x1efa('0x2f')]=_[_0x1efa('0x30')](_0x596736[_0x1efa('0x2f')]);_0xe12b7c[_0x1efa('0x31')]=_[_0x1efa('0x32')](_0xe12b7c[_0x1efa('0x2e')],_0xe12b7c[_0x1efa('0x2f')]);_0x257d9d[_0x1efa('0x33')]=_[_0x1efa('0x32')](_0xe12b7c[_0x1efa('0x2e')],qs['fields'](_0x596736['query'][_0x1efa('0x34')]));_0x257d9d[_0x1efa('0x33')]=_0x257d9d[_0x1efa('0x33')][_0x1efa('0x35')]?_0x257d9d[_0x1efa('0x33')]:_0xe12b7c[_0x1efa('0x2e')];if(!_0x596736[_0x1efa('0x2f')][_0x1efa('0x36')](_0x1efa('0x37'))){_0x257d9d[_0x1efa('0x1f')]=qs[_0x1efa('0x1f')](_0x596736['query']['limit']);_0x257d9d['offset']=qs[_0x1efa('0x1d')](_0x596736[_0x1efa('0x2f')][_0x1efa('0x1d')]);}_0x257d9d['order']=qs[_0x1efa('0x38')](_0x596736[_0x1efa('0x2f')]['sort']);_0x257d9d[_0x1efa('0x39')]=qs[_0x1efa('0x31')](_[_0x1efa('0x3a')](_0x596736[_0x1efa('0x2f')],_0xe12b7c[_0x1efa('0x31')]),_0x2d1b26);if(_0x596736[_0x1efa('0x2f')]['filter']){_0x257d9d[_0x1efa('0x39')]=_[_0x1efa('0x3b')](_0x257d9d['where'],{'$or':_[_0x1efa('0x2a')](_0x2d1b26,function(_0x2a53c8){if(_0x2a53c8[_0x1efa('0x3c')]!==_0x1efa('0x3d')){var _0x49c13e={};_0x49c13e[_0x2a53c8[_0x1efa('0x27')]]={'$like':'%'+_0x596736[_0x1efa('0x2f')][_0x1efa('0x3e')]+'%'};return _0x49c13e;}})});}_0x257d9d=_['merge']({},_0x257d9d,_0x596736[_0x1efa('0x3f')]);var _0x5393b8={'where':_0x257d9d[_0x1efa('0x39')]};return db[_0x1efa('0x40')]['count'](_0x5393b8)[_0x1efa('0x25')](function(_0x2af2ca){_0x1f4f82['count']=_0x2af2ca;if(_0x596736['query'][_0x1efa('0x41')]){_0x257d9d[_0x1efa('0x42')]=[{'all':!![]}];}return db[_0x1efa('0x40')]['findAll'](_0x257d9d);})[_0x1efa('0x25')](function(_0x18b87d){_0x1f4f82[_0x1efa('0x43')]=_0x18b87d;return _0x1f4f82;})[_0x1efa('0x25')](respondWithFilteredResult(_0x1a54cb,_0x257d9d))[_0x1efa('0x44')](handleError(_0x1a54cb,null));};exports[_0x1efa('0x45')]=function(_0x86af38,_0x4f3811){var _0x8117d2={'raw':![],'where':{'id':_0x86af38[_0x1efa('0x46')]['id']}},_0x2758ed={};_0x2758ed['model']=_[_0x1efa('0x30')](db[_0x1efa('0x40')][_0x1efa('0x2b')]);_0x2758ed['query']=_[_0x1efa('0x30')](_0x86af38['query']);_0x2758ed[_0x1efa('0x31')]=_['intersection'](_0x2758ed['model'],_0x2758ed[_0x1efa('0x2f')]);_0x8117d2[_0x1efa('0x33')]=_['intersection'](_0x2758ed[_0x1efa('0x2e')],qs[_0x1efa('0x34')](_0x86af38[_0x1efa('0x2f')][_0x1efa('0x34')]));_0x8117d2[_0x1efa('0x33')]=_0x8117d2[_0x1efa('0x33')][_0x1efa('0x35')]?_0x8117d2[_0x1efa('0x33')]:_0x2758ed['model'];if(_0x86af38[_0x1efa('0x2f')][_0x1efa('0x41')]){_0x8117d2[_0x1efa('0x42')]=[{'all':!![]}];}_0x8117d2=_[_0x1efa('0x3b')]({},_0x8117d2,_0x86af38['options']);return db['IntegrationReport'][_0x1efa('0x47')](_0x8117d2)[_0x1efa('0x25')](handleEntityNotFound(_0x4f3811,null))[_0x1efa('0x25')](respondWithResult(_0x4f3811,null))[_0x1efa('0x44')](handleError(_0x4f3811,null));};exports[_0x1efa('0x48')]=function(_0x4f8770,_0x7446f5){return db[_0x1efa('0x40')][_0x1efa('0x48')](_0x4f8770[_0x1efa('0x49')],{})[_0x1efa('0x25')](respondWithResult(_0x7446f5,0xc9))[_0x1efa('0x44')](handleError(_0x7446f5,null));};exports[_0x1efa('0x24')]=function(_0x187dea,_0x379452){if(_0x187dea[_0x1efa('0x49')]['id']){delete _0x187dea[_0x1efa('0x49')]['id'];}return db[_0x1efa('0x40')]['find']({'where':{'id':_0x187dea[_0x1efa('0x46')]['id']}})[_0x1efa('0x25')](handleEntityNotFound(_0x379452,null))[_0x1efa('0x25')](saveUpdates(_0x187dea['body'],null))[_0x1efa('0x25')](respondWithResult(_0x379452,null))['catch'](handleError(_0x379452,null));};exports[_0x1efa('0x4a')]=function(_0x224e1b,_0xc1327d){return db[_0x1efa('0x40')][_0x1efa('0x47')]({'where':{'id':_0x224e1b[_0x1efa('0x46')]['id']}})[_0x1efa('0x25')](handleEntityNotFound(_0xc1327d,null))[_0x1efa('0x25')](removeEntity(_0xc1327d,null))[_0x1efa('0x44')](handleError(_0xc1327d,null));};exports[_0x1efa('0x4b')]=function(_0x5266ed,_0xd5bf2d){return db[_0x1efa('0x40')][_0x1efa('0x4b')]()[_0x1efa('0x25')](respondWithResult(_0xd5bf2d,null))[_0x1efa('0x44')](handleError(_0xd5bf2d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index ff5e740..be43707 100644 --- a/server/api/integrationReport/integrationReport.model.js +++ b/server/api/integrationReport/integrationReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae34=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','report_integration','util','../../config/logger'];(function(_0x5aecb1,_0x384094){var _0x2098f2=function(_0x4a9c0b){while(--_0x4a9c0b){_0x5aecb1['push'](_0x5aecb1['shift']());}};_0x2098f2(++_0x384094);}(_0xae34,0x1ab));var _0x4ae3=function(_0x4ff481,_0x34e7ce){_0x4ff481=_0x4ff481-0x0;var _0x4f6cfa=_0xae34[_0x4ff481];return _0x4f6cfa;};'use strict';var _=require('lodash');var util=require(_0x4ae3('0x0'));var logger=require(_0x4ae3('0x1'))(_0x4ae3('0x2'));var moment=require(_0x4ae3('0x3'));var BPromise=require(_0x4ae3('0x4'));var rp=require(_0x4ae3('0x5'));var fs=require('fs');var path=require(_0x4ae3('0x6'));var rimraf=require('rimraf');var config=require(_0x4ae3('0x7'));var attributes=require('./integrationReport.attributes');module[_0x4ae3('0x8')]=function(_0x13525f,_0x11d23d){return _0x13525f[_0x4ae3('0x9')]('IntegrationReport',attributes,{'tableName':_0x4ae3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5235=['request-promise','path','rimraf','./integrationReport.attributes','exports','define','report_integration','lodash','util','../../config/logger','api','moment'];(function(_0x36f6fc,_0x1c806b){var _0x16a908=function(_0x549d92){while(--_0x549d92){_0x36f6fc['push'](_0x36f6fc['shift']());}};_0x16a908(++_0x1c806b);}(_0x5235,0x7f));var _0x5523=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0x5235[_0x299784];return _0x5ab008;};'use strict';var _=require(_0x5523('0x0'));var util=require(_0x5523('0x1'));var logger=require(_0x5523('0x2'))(_0x5523('0x3'));var moment=require(_0x5523('0x4'));var BPromise=require('bluebird');var rp=require(_0x5523('0x5'));var fs=require('fs');var path=require(_0x5523('0x6'));var rimraf=require(_0x5523('0x7'));var config=require('../../config/environment');var attributes=require(_0x5523('0x8'));module[_0x5523('0x9')]=function(_0x56cf8e,_0x2a9765){return _0x56cf8e[_0x5523('0xa')]('IntegrationReport',attributes,{'tableName':_0x5523('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index c395857..66ead81 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x43ae27,_0x4196a1){var _0x183305=function(_0x1e4f3b){while(--_0x1e4f3b){_0x43ae27['push'](_0x43ae27['shift']());}};_0x183305(++_0x4196a1);}(_0x187d,0x93));var _0xd187=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x187d[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0xa84d7d,_0x21e27a){var _0x1af144=function(_0x230062){while(--_0x230062){_0xa84d7d['push'](_0xa84d7d['shift']());}};_0x1af144(++_0x21e27a);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 88e4bdc..792f87d 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc61=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update'];(function(_0x203aea,_0x5ce05d){var _0x418c25=function(_0x4b01dd){while(--_0x4b01dd){_0x203aea['push'](_0x203aea['shift']());}};_0x418c25(++_0x5ce05d);}(_0xbc61,0x1b2));var _0x1bc6=function(_0x27265b,_0x3760f3){_0x27265b=_0x27265b-0x0;var _0x357bf0=_0xbc61[_0x27265b];return _0x357bf0;};'use strict';var multer=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var path=require(_0x1bc6('0x2'));var timeout=require(_0x1bc6('0x3'));var express=require('express');var router=express[_0x1bc6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1bc6('0x5'));var interaction=require(_0x1bc6('0x6'));var config=require('../../config/environment');var controller=require(_0x1bc6('0x7'));router[_0x1bc6('0x8')]('/',auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xa')]);router['get'](_0x1bc6('0xb'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xc')]);router[_0x1bc6('0x8')](_0x1bc6('0xd'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xe')]);router['post']('/',auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xf')]);router[_0x1bc6('0x10')](_0x1bc6('0xd'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0x11')]);router[_0x1bc6('0x10')](_0x1bc6('0x12'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0x13')]);router[_0x1bc6('0x14')](_0x1bc6('0xb'),auth['isAuthenticated'](),controller[_0x1bc6('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1bc6('0x16')]);module[_0x1bc6('0x17')]=router; \ No newline at end of file +var _0xf228=['../../components/interaction/service','get','index','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xd3770b,_0xa0f81a){var _0x4bad1e=function(_0x151dce){while(--_0x151dce){_0xd3770b['push'](_0xd3770b['shift']());}};_0x4bad1e(++_0xa0f81a);}(_0xf228,0x1a9));var _0x8f22=function(_0x5a0ec3,_0x4477ec){_0x5a0ec3=_0x5a0ec3-0x0;var _0x287135=_0xf228[_0x5a0ec3];return _0x287135;};'use strict';var multer=require(_0x8f22('0x0'));var util=require(_0x8f22('0x1'));var path=require('path');var timeout=require(_0x8f22('0x2'));var express=require(_0x8f22('0x3'));var router=express[_0x8f22('0x4')]();var fs_extra=require(_0x8f22('0x5'));var auth=require(_0x8f22('0x6'));var interaction=require(_0x8f22('0x7'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x8f22('0x8')]('/',auth['isAuthenticated'](),controller[_0x8f22('0x9')]);router[_0x8f22('0x8')]('/:id',auth[_0x8f22('0xa')](),controller[_0x8f22('0xb')]);router['get'](_0x8f22('0xc'),auth[_0x8f22('0xa')](),controller[_0x8f22('0xd')]);router[_0x8f22('0xe')]('/',auth[_0x8f22('0xa')](),controller[_0x8f22('0xf')]);router[_0x8f22('0xe')](_0x8f22('0xc'),auth['isAuthenticated'](),controller[_0x8f22('0x10')]);router[_0x8f22('0xe')](_0x8f22('0x11'),auth['isAuthenticated'](),controller[_0x8f22('0x12')]);router['put'](_0x8f22('0x13'),auth[_0x8f22('0xa')](),controller[_0x8f22('0x14')]);router[_0x8f22('0x15')](_0x8f22('0x13'),auth['isAuthenticated'](),controller[_0x8f22('0x16')]);module[_0x8f22('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index bf81043..3f6b1b5 100644 --- a/server/api/interval/interval.attributes.js +++ b/server/api/interval/interval.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8b0=['exports','STRING','sequelize'];(function(_0x4d0afa,_0x1992eb){var _0x250f63=function(_0xdd8728){while(--_0xdd8728){_0x4d0afa['push'](_0x4d0afa['shift']());}};_0x250f63(++_0x1992eb);}(_0xe8b0,0x1b2));var _0x0e8b=function(_0x3d1d96,_0x590a35){_0x3d1d96=_0x3d1d96-0x0;var _0x56e5d1=_0xe8b0[_0x3d1d96];return _0x56e5d1;};'use strict';var Sequelize=require(_0x0e8b('0x0'));module[_0x0e8b('0x1')]={'name':{'type':Sequelize[_0x0e8b('0x2')]},'description':{'type':Sequelize[_0x0e8b('0x2')]},'interval':{'type':Sequelize[_0x0e8b('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x421c=['STRING','sequelize','exports'];(function(_0x176860,_0x2fbf0f){var _0x5f4a69=function(_0x54fc47){while(--_0x54fc47){_0x176860['push'](_0x176860['shift']());}};_0x5f4a69(++_0x2fbf0f);}(_0x421c,0x9d));var _0xc421=function(_0x43b784,_0x276b57){_0x43b784=_0x43b784-0x0;var _0x468fe1=_0x421c[_0x43b784];return _0x468fe1;};'use strict';var Sequelize=require(_0xc421('0x0'));module[_0xc421('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc421('0x2')]},'interval':{'type':Sequelize[_0xc421('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index ddc17f1..d9abc63 100644 --- a/server/api/interval/interval.controller.js +++ b/server/api/interval/interval.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc730=['index','map','Interval','rawAttributes','fieldName','type','filters','intersection','query','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','transaction','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','get','Intervals','UserProfileResource','destroy','then','error','stack','name'];(function(_0x38a50e,_0x3abb25){var _0x2db726=function(_0x32499d){while(--_0x32499d){_0x38a50e['push'](_0x38a50e['shift']());}};_0x2db726(++_0x3abb25);}(_0xc730,0x18b));var _0x0c73=function(_0x482c2c,_0x1f38a5){_0x482c2c=_0x482c2c-0x0;var _0xfae66d=_0xc730[_0x482c2c];return _0xfae66d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c73('0x0'));var zipdir=require(_0x0c73('0x1'));var jsonpatch=require(_0x0c73('0x2'));var rp=require(_0x0c73('0x3'));var moment=require(_0x0c73('0x4'));var BPromise=require(_0x0c73('0x5'));var Mustache=require(_0x0c73('0x6'));var util=require('util');var path=require(_0x0c73('0x7'));var sox=require(_0x0c73('0x8'));var csv=require(_0x0c73('0x9'));var ejs=require(_0x0c73('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0c73('0xb'));var crypto=require(_0x0c73('0xc'));var jsforce=require(_0x0c73('0xd'));var deskjs=require(_0x0c73('0xe'));var toCsv=require(_0x0c73('0x9'));var querystring=require(_0x0c73('0xf'));var Papa=require(_0x0c73('0x10'));var Redis=require(_0x0c73('0x11'));var authService=require(_0x0c73('0x12'));var qs=require(_0x0c73('0x13'));var as=require(_0x0c73('0x14'));var hardwareService=require(_0x0c73('0x15'));var logger=require(_0x0c73('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c73('0x17'))['db'];var extensions=require(_0x0c73('0x18'));function respondWithStatusCode(_0x36bc36,_0x8beada){_0x8beada=_0x8beada||0xcc;return function(_0x572bd4){if(_0x572bd4){return _0x36bc36[_0x0c73('0x19')](_0x8beada);}return _0x36bc36[_0x0c73('0x1a')](_0x8beada)[_0x0c73('0x1b')]();};}function respondWithResult(_0x13530e,_0x14860f){_0x14860f=_0x14860f||0xc8;return function(_0x33f6f3){if(_0x33f6f3){return _0x13530e[_0x0c73('0x1a')](_0x14860f)[_0x0c73('0x1c')](_0x33f6f3);}};}function respondWithFilteredResult(_0x3031f0,_0x480ea2){return function(_0x1fbc66){if(_0x1fbc66){var _0x5ba9cf=typeof _0x480ea2[_0x0c73('0x1d')]==='undefined'&&typeof _0x480ea2[_0x0c73('0x1e')]===_0x0c73('0x1f');var _0x22f72f=_0x1fbc66[_0x0c73('0x20')];var _0xc80f9d=_0x5ba9cf?0x0:_0x480ea2[_0x0c73('0x1d')];var _0x5b38d5=_0x5ba9cf?_0x1fbc66[_0x0c73('0x20')]:_0x480ea2['offset']+_0x480ea2['limit'];var _0x93963a;if(_0x5b38d5>=_0x22f72f){_0x5b38d5=_0x22f72f;_0x93963a=0xc8;}else{_0x93963a=0xce;}_0x3031f0[_0x0c73('0x1a')](_0x93963a);return _0x3031f0[_0x0c73('0x21')](_0x0c73('0x22'),_0xc80f9d+'-'+_0x5b38d5+'/'+_0x22f72f)[_0x0c73('0x1c')](_0x1fbc66);}return null;};}function patchUpdates(_0x40ac5a){return function(_0x88f2f0){try{jsonpatch[_0x0c73('0x23')](_0x88f2f0,_0x40ac5a,!![]);}catch(_0x2b209b){return BPromise[_0x0c73('0x24')](_0x2b209b);}return _0x88f2f0['save']();};}function saveUpdates(_0x1648f5,_0xbc3094){return function(_0x2898c3){if(_0x2898c3){return _0x2898c3['update'](_0x1648f5)['then'](function(_0x17ba25){return _0x17ba25;});}return null;};}function removeEntity(_0x23c066,_0x376acb){return function(_0x4f6049){if(_0x4f6049){return _0x4f6049['destroy']()['then'](function(){var _0x3bf6ee=_0x4f6049[_0x0c73('0x25')]({'plain':!![]});var _0x38389a=_0x0c73('0x26');return db[_0x0c73('0x27')][_0x0c73('0x28')]({'where':{'type':_0x38389a,'resourceId':_0x3bf6ee['id']}})[_0x0c73('0x29')](function(){return _0x4f6049;});})[_0x0c73('0x29')](function(){_0x23c066[_0x0c73('0x1a')](0xcc)[_0x0c73('0x1b')]();});}};}function handleEntityNotFound(_0x424ea1,_0x2f664e){return function(_0xfb70f1){if(!_0xfb70f1){_0x424ea1['sendStatus'](0x194);}return _0xfb70f1;};}function handleError(_0x54ab70,_0xbdc4ad){_0xbdc4ad=_0xbdc4ad||0x1f4;return function(_0x36b00e){logger[_0x0c73('0x2a')](_0x36b00e[_0x0c73('0x2b')]);if(_0x36b00e[_0x0c73('0x2c')]){delete _0x36b00e[_0x0c73('0x2c')];}_0x54ab70['status'](_0xbdc4ad)['send'](_0x36b00e);};}exports[_0x0c73('0x2d')]=function(_0x8892ed,_0x21224a){var _0x3ac04c={},_0x5c4856={},_0xf94fa1={'count':0x0,'rows':[]};var _0x542c94=_[_0x0c73('0x2e')](db[_0x0c73('0x2f')][_0x0c73('0x30')],function(_0x419d58){return{'name':_0x419d58[_0x0c73('0x31')],'type':_0x419d58[_0x0c73('0x32')]['key']};});_0x5c4856['model']=_[_0x0c73('0x2e')](_0x542c94,'name');_0x5c4856['query']=_['keys'](_0x8892ed['query']);_0x5c4856[_0x0c73('0x33')]=_[_0x0c73('0x34')](_0x5c4856['model'],_0x5c4856[_0x0c73('0x35')]);_0x3ac04c[_0x0c73('0x36')]=_[_0x0c73('0x34')](_0x5c4856[_0x0c73('0x37')],qs[_0x0c73('0x38')](_0x8892ed[_0x0c73('0x35')][_0x0c73('0x38')]));_0x3ac04c[_0x0c73('0x36')]=_0x3ac04c['attributes'][_0x0c73('0x39')]?_0x3ac04c[_0x0c73('0x36')]:_0x5c4856[_0x0c73('0x37')];if(!_0x8892ed[_0x0c73('0x35')]['hasOwnProperty'](_0x0c73('0x3a'))){_0x3ac04c[_0x0c73('0x1e')]=qs[_0x0c73('0x1e')](_0x8892ed['query'][_0x0c73('0x1e')]);_0x3ac04c['offset']=qs[_0x0c73('0x1d')](_0x8892ed[_0x0c73('0x35')][_0x0c73('0x1d')]);}_0x3ac04c[_0x0c73('0x3b')]=qs[_0x0c73('0x3c')](_0x8892ed[_0x0c73('0x35')][_0x0c73('0x3c')]);_0x3ac04c[_0x0c73('0x3d')]=qs['filters'](_[_0x0c73('0x3e')](_0x8892ed[_0x0c73('0x35')],_0x5c4856[_0x0c73('0x33')]),_0x542c94);if(_0x8892ed[_0x0c73('0x35')][_0x0c73('0x3f')]){_0x3ac04c[_0x0c73('0x3d')]=_[_0x0c73('0x40')](_0x3ac04c[_0x0c73('0x3d')],{'$or':_[_0x0c73('0x2e')](_0x542c94,function(_0x1d3f5a){if(_0x1d3f5a['type']!==_0x0c73('0x41')){var _0x3449f0={};_0x3449f0[_0x1d3f5a[_0x0c73('0x2c')]]={'$like':'%'+_0x8892ed['query']['filter']+'%'};return _0x3449f0;}})});}_0x3ac04c=_['merge']({},_0x3ac04c,_0x8892ed[_0x0c73('0x42')]);var _0x3fb128={'where':_0x3ac04c[_0x0c73('0x3d')]};return db[_0x0c73('0x2f')]['count'](_0x3fb128)[_0x0c73('0x29')](function(_0x1a8380){_0xf94fa1['count']=_0x1a8380;if(_0x8892ed[_0x0c73('0x35')][_0x0c73('0x43')]){_0x3ac04c[_0x0c73('0x44')]=[{'all':!![]}];}return db[_0x0c73('0x2f')][_0x0c73('0x45')](_0x3ac04c);})[_0x0c73('0x29')](function(_0x53fa4a){_0xf94fa1['rows']=_0x53fa4a;return _0xf94fa1;})[_0x0c73('0x29')](respondWithFilteredResult(_0x21224a,_0x3ac04c))[_0x0c73('0x46')](handleError(_0x21224a,null));};exports['show']=function(_0x5cd480,_0x2b0882){var _0x1ebcc7={'raw':!![],'where':{'id':_0x5cd480[_0x0c73('0x47')]['id']}},_0x59050c={};_0x59050c[_0x0c73('0x37')]=_[_0x0c73('0x48')](db[_0x0c73('0x2f')][_0x0c73('0x30')]);_0x59050c[_0x0c73('0x35')]=_[_0x0c73('0x48')](_0x5cd480[_0x0c73('0x35')]);_0x59050c[_0x0c73('0x33')]=_[_0x0c73('0x34')](_0x59050c[_0x0c73('0x37')],_0x59050c[_0x0c73('0x35')]);_0x1ebcc7[_0x0c73('0x36')]=_[_0x0c73('0x34')](_0x59050c[_0x0c73('0x37')],qs[_0x0c73('0x38')](_0x5cd480['query'][_0x0c73('0x38')]));_0x1ebcc7[_0x0c73('0x36')]=_0x1ebcc7[_0x0c73('0x36')][_0x0c73('0x39')]?_0x1ebcc7[_0x0c73('0x36')]:_0x59050c[_0x0c73('0x37')];if(_0x5cd480[_0x0c73('0x35')]['includeAll']){_0x1ebcc7['include']=[{'all':!![]}];}_0x1ebcc7=_[_0x0c73('0x40')]({},_0x1ebcc7,_0x5cd480[_0x0c73('0x42')]);return db[_0x0c73('0x2f')][_0x0c73('0x49')](_0x1ebcc7)[_0x0c73('0x29')](handleEntityNotFound(_0x2b0882,null))[_0x0c73('0x29')](respondWithResult(_0x2b0882,null))[_0x0c73('0x46')](handleError(_0x2b0882,null));};exports[_0x0c73('0x4a')]=function(_0x2b7a32,_0x36a3cc){return db[_0x0c73('0x2f')][_0x0c73('0x4a')](_0x2b7a32[_0x0c73('0x4b')],{})[_0x0c73('0x29')](function(_0x1c8bdf){var _0x5ea008=_0x2b7a32[_0x0c73('0x4c')][_0x0c73('0x25')]({'plain':!![]});if(!_0x5ea008)throw new Error(_0x0c73('0x4d'));if(_0x5ea008[_0x0c73('0x4e')]===_0x0c73('0x4c')){var _0x4e31c7=_0x1c8bdf[_0x0c73('0x25')]({'plain':!![]});var _0x2c4b05=_0x0c73('0x26');return db[_0x0c73('0x4f')][_0x0c73('0x49')]({'where':{'name':_0x2c4b05,'userProfileId':_0x5ea008[_0x0c73('0x50')]},'raw':!![]})[_0x0c73('0x29')](function(_0x3a4fed){if(_0x3a4fed&&_0x3a4fed[_0x0c73('0x51')]===0x0){return db[_0x0c73('0x27')][_0x0c73('0x4a')]({'name':_0x4e31c7[_0x0c73('0x2c')],'resourceId':_0x4e31c7['id'],'type':_0x3a4fed['name'],'sectionId':_0x3a4fed['id']},{})[_0x0c73('0x29')](function(){return _0x1c8bdf;});}else{return _0x1c8bdf;}})['catch'](function(_0x316b96){logger[_0x0c73('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x316b96);throw _0x316b96;});}return _0x1c8bdf;})[_0x0c73('0x29')](respondWithResult(_0x36a3cc,0xc9))[_0x0c73('0x46')](handleError(_0x36a3cc,null));};exports['update']=function(_0x2579fb,_0x47c357){if(_0x2579fb['body']['id']){delete _0x2579fb[_0x0c73('0x4b')]['id'];}return db[_0x0c73('0x2f')][_0x0c73('0x49')]({'where':{'id':_0x2579fb[_0x0c73('0x47')]['id']}})[_0x0c73('0x29')](handleEntityNotFound(_0x47c357,null))[_0x0c73('0x29')](saveUpdates(_0x2579fb[_0x0c73('0x4b')],null))[_0x0c73('0x29')](respondWithResult(_0x47c357,null))[_0x0c73('0x46')](handleError(_0x47c357,null));};exports[_0x0c73('0x28')]=function(_0x41570c,_0x51a78a){return db['Interval'][_0x0c73('0x49')]({'where':{'id':_0x41570c[_0x0c73('0x47')]['id']}})[_0x0c73('0x29')](handleEntityNotFound(_0x51a78a,null))[_0x0c73('0x29')](removeEntity(_0x51a78a,null))[_0x0c73('0x46')](handleError(_0x51a78a,null));};exports[_0x0c73('0x52')]=function(_0x40f93e,_0x2f72dd,_0x3d0ac8){if(_0x40f93e[_0x0c73('0x4b')]['id']){delete _0x40f93e[_0x0c73('0x4b')]['id'];}return db[_0x0c73('0x2f')][_0x0c73('0x49')]({'where':{'id':_0x40f93e[_0x0c73('0x47')]['id']}})[_0x0c73('0x29')](handleEntityNotFound(_0x2f72dd,null))[_0x0c73('0x29')](function(_0x20ced5){if(_0x20ced5){_0x40f93e[_0x0c73('0x4b')][_0x0c73('0x53')]=_0x20ced5['id'];return db[_0x0c73('0x2f')][_0x0c73('0x4a')](_0x40f93e[_0x0c73('0x4b')]);}})[_0x0c73('0x29')](respondWithResult(_0x2f72dd,null))[_0x0c73('0x46')](handleError(_0x2f72dd,null));};exports[_0x0c73('0x54')]=function(_0x4c0076,_0x5d7464,_0x362b17){var _0x51abf2={};var _0x330e1d={};var _0x32867e;var _0x363cf2;return db[_0x0c73('0x2f')][_0x0c73('0x55')]({'where':{'id':_0x4c0076[_0x0c73('0x47')]['id']}})[_0x0c73('0x29')](handleEntityNotFound(_0x5d7464,null))[_0x0c73('0x29')](function(_0x3575d6){if(_0x3575d6){_0x32867e=_0x3575d6;_0x330e1d['model']=_['keys'](db[_0x0c73('0x2f')][_0x0c73('0x30')]);_0x330e1d[_0x0c73('0x35')]=_[_0x0c73('0x48')](_0x4c0076[_0x0c73('0x35')]);_0x330e1d[_0x0c73('0x33')]=_[_0x0c73('0x34')](_0x330e1d[_0x0c73('0x37')],_0x330e1d[_0x0c73('0x35')]);_0x51abf2['attributes']=_['intersection'](_0x330e1d['model'],qs[_0x0c73('0x38')](_0x4c0076[_0x0c73('0x35')][_0x0c73('0x38')]));_0x51abf2['attributes']=_0x51abf2[_0x0c73('0x36')][_0x0c73('0x39')]?_0x51abf2[_0x0c73('0x36')]:_0x330e1d[_0x0c73('0x37')];_0x51abf2[_0x0c73('0x3b')]=qs[_0x0c73('0x3c')](_0x4c0076[_0x0c73('0x35')][_0x0c73('0x3c')]);_0x51abf2['where']=qs[_0x0c73('0x33')](_[_0x0c73('0x3e')](_0x4c0076[_0x0c73('0x35')],_0x330e1d[_0x0c73('0x33')]));if(_0x4c0076['query']['filter']){_0x51abf2[_0x0c73('0x3d')]=_[_0x0c73('0x40')](_0x51abf2['where'],{'$or':_[_0x0c73('0x2e')](_0x51abf2[_0x0c73('0x36')],function(_0x3e26a9){var _0x279cd0={};_0x279cd0[_0x3e26a9]={'$like':'%'+_0x4c0076[_0x0c73('0x35')][_0x0c73('0x3f')]+'%'};return _0x279cd0;})});}_0x51abf2=_[_0x0c73('0x40')]({},_0x51abf2,_0x4c0076[_0x0c73('0x42')]);return _0x32867e[_0x0c73('0x54')](_0x51abf2);}})['then'](function(_0x13c29c){if(_0x13c29c){_0x363cf2=_0x13c29c[_0x0c73('0x39')];if(!_0x4c0076[_0x0c73('0x35')][_0x0c73('0x56')](_0x0c73('0x3a'))){_0x51abf2[_0x0c73('0x1e')]=qs[_0x0c73('0x1e')](_0x4c0076[_0x0c73('0x35')][_0x0c73('0x1e')]);_0x51abf2['offset']=qs['offset'](_0x4c0076['query'][_0x0c73('0x1d')]);}return _0x32867e[_0x0c73('0x54')](_0x51abf2);}})['then'](function(_0x487146){if(_0x487146){return _0x487146?{'count':_0x363cf2,'rows':_0x487146}:null;}})[_0x0c73('0x29')](respondWithResult(_0x5d7464,null))[_0x0c73('0x46')](handleError(_0x5d7464,null));};exports['addIntervals']=function(_0x30596e,_0x4e5c33,_0x5c8837){return db[_0x0c73('0x2f')][_0x0c73('0x55')]({'where':{'id':_0x30596e['params']['id']}})[_0x0c73('0x29')](handleEntityNotFound(_0x4e5c33,null))[_0x0c73('0x29')](function(_0xc1c448){if(_0xc1c448){return db['sequelize'][_0x0c73('0x57')](function(_0x25a6b9){return db['Interval'][_0x0c73('0x28')]({'where':{'IntervalId':_0x30596e[_0x0c73('0x47')]['id']},'transaction':_0x25a6b9})['then'](function(_0x469c57){var _0x26fa4c=_[_0x0c73('0x2e')](_0x30596e[_0x0c73('0x4b')],function(_0x50946b){delete _0x50946b['id'];_0x50946b[_0x0c73('0x53')]=_0x30596e['params']['id'];return _0x50946b;});return db['Interval']['bulkCreate'](_0x26fa4c,{'transaction':_0x25a6b9});});})[_0x0c73('0x29')](function(){return db[_0x0c73('0x2f')]['findAll']({'where':{'IntervalId':_0x30596e[_0x0c73('0x47')]['id']}});});}})['then'](respondWithResult(_0x4e5c33,null))[_0x0c73('0x46')](handleError(_0x4e5c33,null));}; \ No newline at end of file +var _0x0ee1=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','intersection','options','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','keys','sequelize','transaction','bulkCreate','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status'];(function(_0x172b9b,_0xebddaf){var _0x46853c=function(_0x20d902){while(--_0x20d902){_0x172b9b['push'](_0x172b9b['shift']());}};_0x46853c(++_0xebddaf);}(_0x0ee1,0xf5));var _0x10ee=function(_0x18dc32,_0x26d38e){_0x18dc32=_0x18dc32-0x0;var _0x2adfaf=_0x0ee1[_0x18dc32];return _0x2adfaf;};'use strict';var emlformat=require(_0x10ee('0x0'));var rimraf=require(_0x10ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x10ee('0x2'));var moment=require(_0x10ee('0x3'));var BPromise=require(_0x10ee('0x4'));var Mustache=require('mustache');var util=require(_0x10ee('0x5'));var path=require('path');var sox=require(_0x10ee('0x6'));var csv=require(_0x10ee('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10ee('0x8'));var _=require(_0x10ee('0x9'));var squel=require(_0x10ee('0xa'));var crypto=require(_0x10ee('0xb'));var jsforce=require(_0x10ee('0xc'));var deskjs=require(_0x10ee('0xd'));var toCsv=require(_0x10ee('0x7'));var querystring=require(_0x10ee('0xe'));var Papa=require(_0x10ee('0xf'));var Redis=require(_0x10ee('0x10'));var authService=require(_0x10ee('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x10ee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x10ee('0x13'));var utils=require('../../config/utils');var config=require(_0x10ee('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x10ee('0x15'))['db'];var extensions=require(_0x10ee('0x16'));function respondWithStatusCode(_0x196495,_0x332174){_0x332174=_0x332174||0xcc;return function(_0x4422a0){if(_0x4422a0){return _0x196495[_0x10ee('0x17')](_0x332174);}return _0x196495[_0x10ee('0x18')](_0x332174)[_0x10ee('0x19')]();};}function respondWithResult(_0x342ac3,_0x409695){_0x409695=_0x409695||0xc8;return function(_0x503542){if(_0x503542){return _0x342ac3[_0x10ee('0x18')](_0x409695)[_0x10ee('0x1a')](_0x503542);}};}function respondWithFilteredResult(_0x40dcb8,_0xe3fec3){return function(_0x4554f8){if(_0x4554f8){var _0x15deef=typeof _0xe3fec3[_0x10ee('0x1b')]===_0x10ee('0x1c')&&typeof _0xe3fec3[_0x10ee('0x1d')]===_0x10ee('0x1c');var _0x5a2915=_0x4554f8[_0x10ee('0x1e')];var _0x333ff1=_0x15deef?0x0:_0xe3fec3['offset'];var _0xf1242b=_0x15deef?_0x4554f8[_0x10ee('0x1e')]:_0xe3fec3[_0x10ee('0x1b')]+_0xe3fec3[_0x10ee('0x1d')];var _0x133ceb;if(_0xf1242b>=_0x5a2915){_0xf1242b=_0x5a2915;_0x133ceb=0xc8;}else{_0x133ceb=0xce;}_0x40dcb8['status'](_0x133ceb);return _0x40dcb8[_0x10ee('0x1f')](_0x10ee('0x20'),_0x333ff1+'-'+_0xf1242b+'/'+_0x5a2915)['json'](_0x4554f8);}return null;};}function patchUpdates(_0x396d59){return function(_0x3e4648){try{jsonpatch[_0x10ee('0x21')](_0x3e4648,_0x396d59,!![]);}catch(_0x3d5f46){return BPromise[_0x10ee('0x22')](_0x3d5f46);}return _0x3e4648['save']();};}function saveUpdates(_0x390172,_0x6b4596){return function(_0x2c220f){if(_0x2c220f){return _0x2c220f[_0x10ee('0x23')](_0x390172)[_0x10ee('0x24')](function(_0x592a36){return _0x592a36;});}return null;};}function removeEntity(_0xf2ca54,_0x2ab907){return function(_0x3f1b81){if(_0x3f1b81){return _0x3f1b81[_0x10ee('0x25')]()[_0x10ee('0x24')](function(){var _0x208c01=_0x3f1b81[_0x10ee('0x26')]({'plain':!![]});var _0x42c1d7=_0x10ee('0x27');return db[_0x10ee('0x28')]['destroy']({'where':{'type':_0x42c1d7,'resourceId':_0x208c01['id']}})['then'](function(){return _0x3f1b81;});})[_0x10ee('0x24')](function(){_0xf2ca54['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9dca,_0xf238d){return function(_0x386c94){if(!_0x386c94){_0x5b9dca['sendStatus'](0x194);}return _0x386c94;};}function handleError(_0x1c3574,_0x250356){_0x250356=_0x250356||0x1f4;return function(_0x344c28){logger[_0x10ee('0x29')](_0x344c28[_0x10ee('0x2a')]);if(_0x344c28['name']){delete _0x344c28[_0x10ee('0x2b')];}_0x1c3574['status'](_0x250356)[_0x10ee('0x2c')](_0x344c28);};}exports[_0x10ee('0x2d')]=function(_0x3e50fc,_0x36257d){var _0x2ea20e={},_0x8c4086={},_0x24f0f4={'count':0x0,'rows':[]};var _0x1504a0=_[_0x10ee('0x2e')](db[_0x10ee('0x2f')][_0x10ee('0x30')],function(_0x32d890){return{'name':_0x32d890[_0x10ee('0x31')],'type':_0x32d890[_0x10ee('0x32')]['key']};});_0x8c4086['model']=_[_0x10ee('0x2e')](_0x1504a0,_0x10ee('0x2b'));_0x8c4086[_0x10ee('0x33')]=_['keys'](_0x3e50fc[_0x10ee('0x33')]);_0x8c4086[_0x10ee('0x34')]=_['intersection'](_0x8c4086[_0x10ee('0x35')],_0x8c4086[_0x10ee('0x33')]);_0x2ea20e['attributes']=_['intersection'](_0x8c4086[_0x10ee('0x35')],qs[_0x10ee('0x36')](_0x3e50fc[_0x10ee('0x33')][_0x10ee('0x36')]));_0x2ea20e[_0x10ee('0x37')]=_0x2ea20e[_0x10ee('0x37')][_0x10ee('0x38')]?_0x2ea20e['attributes']:_0x8c4086[_0x10ee('0x35')];if(!_0x3e50fc[_0x10ee('0x33')][_0x10ee('0x39')](_0x10ee('0x3a'))){_0x2ea20e[_0x10ee('0x1d')]=qs[_0x10ee('0x1d')](_0x3e50fc[_0x10ee('0x33')][_0x10ee('0x1d')]);_0x2ea20e[_0x10ee('0x1b')]=qs['offset'](_0x3e50fc['query'][_0x10ee('0x1b')]);}_0x2ea20e[_0x10ee('0x3b')]=qs[_0x10ee('0x3c')](_0x3e50fc[_0x10ee('0x33')][_0x10ee('0x3c')]);_0x2ea20e['where']=qs[_0x10ee('0x34')](_[_0x10ee('0x3d')](_0x3e50fc[_0x10ee('0x33')],_0x8c4086[_0x10ee('0x34')]),_0x1504a0);if(_0x3e50fc['query'][_0x10ee('0x3e')]){_0x2ea20e[_0x10ee('0x3f')]=_['merge'](_0x2ea20e[_0x10ee('0x3f')],{'$or':_['map'](_0x1504a0,function(_0x382f77){if(_0x382f77[_0x10ee('0x32')]!==_0x10ee('0x40')){var _0x2002f6={};_0x2002f6[_0x382f77['name']]={'$like':'%'+_0x3e50fc[_0x10ee('0x33')][_0x10ee('0x3e')]+'%'};return _0x2002f6;}})});}_0x2ea20e=_[_0x10ee('0x41')]({},_0x2ea20e,_0x3e50fc['options']);var _0x1b113d={'where':_0x2ea20e['where']};return db[_0x10ee('0x2f')][_0x10ee('0x1e')](_0x1b113d)['then'](function(_0x1cf03e){_0x24f0f4[_0x10ee('0x1e')]=_0x1cf03e;if(_0x3e50fc['query'][_0x10ee('0x42')]){_0x2ea20e[_0x10ee('0x43')]=[{'all':!![]}];}return db[_0x10ee('0x2f')][_0x10ee('0x44')](_0x2ea20e);})[_0x10ee('0x24')](function(_0x4fbf2d){_0x24f0f4['rows']=_0x4fbf2d;return _0x24f0f4;})[_0x10ee('0x24')](respondWithFilteredResult(_0x36257d,_0x2ea20e))[_0x10ee('0x45')](handleError(_0x36257d,null));};exports[_0x10ee('0x46')]=function(_0x320130,_0x1b484d){var _0x1ee009={'raw':!![],'where':{'id':_0x320130[_0x10ee('0x47')]['id']}},_0x172f22={};_0x172f22[_0x10ee('0x35')]=_['keys'](db[_0x10ee('0x2f')][_0x10ee('0x30')]);_0x172f22[_0x10ee('0x33')]=_['keys'](_0x320130[_0x10ee('0x33')]);_0x172f22[_0x10ee('0x34')]=_[_0x10ee('0x48')](_0x172f22[_0x10ee('0x35')],_0x172f22[_0x10ee('0x33')]);_0x1ee009['attributes']=_[_0x10ee('0x48')](_0x172f22['model'],qs[_0x10ee('0x36')](_0x320130['query'][_0x10ee('0x36')]));_0x1ee009[_0x10ee('0x37')]=_0x1ee009[_0x10ee('0x37')][_0x10ee('0x38')]?_0x1ee009[_0x10ee('0x37')]:_0x172f22['model'];if(_0x320130[_0x10ee('0x33')]['includeAll']){_0x1ee009['include']=[{'all':!![]}];}_0x1ee009=_[_0x10ee('0x41')]({},_0x1ee009,_0x320130[_0x10ee('0x49')]);return db[_0x10ee('0x2f')][_0x10ee('0x4a')](_0x1ee009)['then'](handleEntityNotFound(_0x1b484d,null))[_0x10ee('0x24')](respondWithResult(_0x1b484d,null))[_0x10ee('0x45')](handleError(_0x1b484d,null));};exports[_0x10ee('0x4b')]=function(_0x1b0cd6,_0x11ca38){return db['Interval']['create'](_0x1b0cd6[_0x10ee('0x4c')],{})[_0x10ee('0x24')](function(_0x3b87d8){var _0x59417c=_0x1b0cd6[_0x10ee('0x4d')][_0x10ee('0x26')]({'plain':!![]});if(!_0x59417c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59417c[_0x10ee('0x4e')]===_0x10ee('0x4d')){var _0x3ee069=_0x3b87d8[_0x10ee('0x26')]({'plain':!![]});var _0x37cb95=_0x10ee('0x27');return db[_0x10ee('0x4f')][_0x10ee('0x4a')]({'where':{'name':_0x37cb95,'userProfileId':_0x59417c['userProfileId']},'raw':!![]})[_0x10ee('0x24')](function(_0x3d0af4){if(_0x3d0af4&&_0x3d0af4[_0x10ee('0x50')]===0x0){return db[_0x10ee('0x28')][_0x10ee('0x4b')]({'name':_0x3ee069[_0x10ee('0x2b')],'resourceId':_0x3ee069['id'],'type':_0x3d0af4[_0x10ee('0x2b')],'sectionId':_0x3d0af4['id']},{})[_0x10ee('0x24')](function(){return _0x3b87d8;});}else{return _0x3b87d8;}})['catch'](function(_0x3fbbb7){logger['error'](_0x10ee('0x51'),_0x3fbbb7);throw _0x3fbbb7;});}return _0x3b87d8;})[_0x10ee('0x24')](respondWithResult(_0x11ca38,0xc9))[_0x10ee('0x45')](handleError(_0x11ca38,null));};exports['update']=function(_0x3d4e53,_0x384fc){if(_0x3d4e53[_0x10ee('0x4c')]['id']){delete _0x3d4e53[_0x10ee('0x4c')]['id'];}return db['Interval'][_0x10ee('0x4a')]({'where':{'id':_0x3d4e53[_0x10ee('0x47')]['id']}})[_0x10ee('0x24')](handleEntityNotFound(_0x384fc,null))[_0x10ee('0x24')](saveUpdates(_0x3d4e53[_0x10ee('0x4c')],null))[_0x10ee('0x24')](respondWithResult(_0x384fc,null))[_0x10ee('0x45')](handleError(_0x384fc,null));};exports[_0x10ee('0x25')]=function(_0x1a7e6e,_0xf12fa6){return db['Interval']['find']({'where':{'id':_0x1a7e6e[_0x10ee('0x47')]['id']}})[_0x10ee('0x24')](handleEntityNotFound(_0xf12fa6,null))[_0x10ee('0x24')](removeEntity(_0xf12fa6,null))[_0x10ee('0x45')](handleError(_0xf12fa6,null));};exports[_0x10ee('0x52')]=function(_0x21c18c,_0x53649c,_0x50eb6d){if(_0x21c18c['body']['id']){delete _0x21c18c[_0x10ee('0x4c')]['id'];}return db[_0x10ee('0x2f')]['find']({'where':{'id':_0x21c18c[_0x10ee('0x47')]['id']}})[_0x10ee('0x24')](handleEntityNotFound(_0x53649c,null))['then'](function(_0x4fdb90){if(_0x4fdb90){_0x21c18c['body'][_0x10ee('0x53')]=_0x4fdb90['id'];return db[_0x10ee('0x2f')][_0x10ee('0x4b')](_0x21c18c[_0x10ee('0x4c')]);}})[_0x10ee('0x24')](respondWithResult(_0x53649c,null))[_0x10ee('0x45')](handleError(_0x53649c,null));};exports[_0x10ee('0x54')]=function(_0x156753,_0x1659e1,_0x3bc834){var _0x1147fd={};var _0x26850f={};var _0x125095;var _0x35c09e;return db[_0x10ee('0x2f')][_0x10ee('0x55')]({'where':{'id':_0x156753[_0x10ee('0x47')]['id']}})['then'](handleEntityNotFound(_0x1659e1,null))['then'](function(_0x125f01){if(_0x125f01){_0x125095=_0x125f01;_0x26850f[_0x10ee('0x35')]=_[_0x10ee('0x56')](db[_0x10ee('0x2f')][_0x10ee('0x30')]);_0x26850f[_0x10ee('0x33')]=_[_0x10ee('0x56')](_0x156753[_0x10ee('0x33')]);_0x26850f[_0x10ee('0x34')]=_[_0x10ee('0x48')](_0x26850f[_0x10ee('0x35')],_0x26850f[_0x10ee('0x33')]);_0x1147fd[_0x10ee('0x37')]=_[_0x10ee('0x48')](_0x26850f[_0x10ee('0x35')],qs['fields'](_0x156753[_0x10ee('0x33')][_0x10ee('0x36')]));_0x1147fd['attributes']=_0x1147fd['attributes'][_0x10ee('0x38')]?_0x1147fd['attributes']:_0x26850f[_0x10ee('0x35')];_0x1147fd[_0x10ee('0x3b')]=qs[_0x10ee('0x3c')](_0x156753['query'][_0x10ee('0x3c')]);_0x1147fd[_0x10ee('0x3f')]=qs[_0x10ee('0x34')](_['pick'](_0x156753['query'],_0x26850f[_0x10ee('0x34')]));if(_0x156753['query'][_0x10ee('0x3e')]){_0x1147fd[_0x10ee('0x3f')]=_[_0x10ee('0x41')](_0x1147fd['where'],{'$or':_['map'](_0x1147fd[_0x10ee('0x37')],function(_0x1d7789){var _0x54dcb3={};_0x54dcb3[_0x1d7789]={'$like':'%'+_0x156753['query'][_0x10ee('0x3e')]+'%'};return _0x54dcb3;})});}_0x1147fd=_['merge']({},_0x1147fd,_0x156753[_0x10ee('0x49')]);return _0x125095[_0x10ee('0x54')](_0x1147fd);}})['then'](function(_0x3163cc){if(_0x3163cc){_0x35c09e=_0x3163cc[_0x10ee('0x38')];if(!_0x156753[_0x10ee('0x33')][_0x10ee('0x39')](_0x10ee('0x3a'))){_0x1147fd['limit']=qs[_0x10ee('0x1d')](_0x156753['query']['limit']);_0x1147fd[_0x10ee('0x1b')]=qs[_0x10ee('0x1b')](_0x156753[_0x10ee('0x33')][_0x10ee('0x1b')]);}return _0x125095[_0x10ee('0x54')](_0x1147fd);}})['then'](function(_0x11d49b){if(_0x11d49b){return _0x11d49b?{'count':_0x35c09e,'rows':_0x11d49b}:null;}})['then'](respondWithResult(_0x1659e1,null))[_0x10ee('0x45')](handleError(_0x1659e1,null));};exports['addIntervals']=function(_0x2e0788,_0x904771,_0x530b76){return db[_0x10ee('0x2f')][_0x10ee('0x55')]({'where':{'id':_0x2e0788['params']['id']}})['then'](handleEntityNotFound(_0x904771,null))[_0x10ee('0x24')](function(_0x1c44e0){if(_0x1c44e0){return db[_0x10ee('0x57')][_0x10ee('0x58')](function(_0x5d4226){return db[_0x10ee('0x2f')][_0x10ee('0x25')]({'where':{'IntervalId':_0x2e0788[_0x10ee('0x47')]['id']},'transaction':_0x5d4226})[_0x10ee('0x24')](function(_0x408a6e){var _0x9e21e1=_[_0x10ee('0x2e')](_0x2e0788[_0x10ee('0x4c')],function(_0x4fcd60){delete _0x4fcd60['id'];_0x4fcd60[_0x10ee('0x53')]=_0x2e0788['params']['id'];return _0x4fcd60;});return db['Interval'][_0x10ee('0x59')](_0x9e21e1,{'transaction':_0x5d4226});});})[_0x10ee('0x24')](function(){return db[_0x10ee('0x2f')][_0x10ee('0x44')]({'where':{'IntervalId':_0x2e0788[_0x10ee('0x47')]['id']}});});}})['then'](respondWithResult(_0x904771,null))[_0x10ee('0x45')](handleError(_0x904771,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 8472a3e..321315b 100644 --- a/server/api/interval/interval.model.js +++ b/server/api/interval/interval.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa174=['then','all','map','ifTime','reduce','./interval.attributes','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','string','getIntervals'];(function(_0x58edb2,_0x513405){var _0x262e52=function(_0x122be6){while(--_0x122be6){_0x58edb2['push'](_0x58edb2['shift']());}};_0x262e52(++_0x513405);}(_0xa174,0x122));var _0x4a17=function(_0x58f014,_0x28e078){_0x58f014=_0x58f014-0x0;var _0x49177d=_0xa174[_0x58f014];return _0x49177d;};'use strict';var attributes=require(_0x4a17('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x4a17('0x1'))[_0x4a17('0x2')];module[_0x4a17('0x3')]=function(_0x24da62){return _0x24da62[_0x4a17('0x4')](_0x4a17('0x5'),attributes,{'tableName':_0x4a17('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a5001){extensions['rewrite'](_0x24da62,_0x2a5001);},'afterBulkCreate':function(_0x2d7903,_0x1ab959,_0x2550eb){_0x2550eb();extensions[_0x4a17('0x7')](_0x24da62,_0x2d7903[0x0]);},'afterUpdate':function(_0x26d8b7){extensions['rewrite'](_0x24da62,_0x26d8b7);},'afterDestroy':function(_0x534952){extensions['rewrite'](_0x24da62,_0x534952);}},'instanceMethods':{'ifTime':function(_0x114a62=undefined,_0x303ab2=new Date()){if(typeof this['interval']===_0x4a17('0x8')){return iftime(this['interval'],_0x114a62,_0x303ab2);}else{return this[_0x4a17('0x9')]()[_0x4a17('0xa')](function(_0xf50d85){return Promise[_0x4a17('0xb')](_0xf50d85[_0x4a17('0xc')](function(_0x5b6a3e){return _0x5b6a3e[_0x4a17('0xd')](_0x114a62,_0x303ab2);}));})['then'](function(_0x2924e0){return _0x2924e0[_0x4a17('0xe')](function(_0x1998d2,_0x57ff3e){return _0x1998d2||_0x57ff3e;},![]);});}}}});}; \ No newline at end of file +var _0xe3c4=['string','then','all','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xe3c4,0xe7));var _0x4e3c=function(_0x58c2cf,_0x2677bd){_0x58c2cf=_0x58c2cf-0x0;var _0x5b1b1a=_0xe3c4[_0x58c2cf];return _0x5b1b1a;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x4e3c('0x0'));var iftime=require(_0x4e3c('0x1'))[_0x4e3c('0x2')];module[_0x4e3c('0x3')]=function(_0x2421a9){return _0x2421a9[_0x4e3c('0x4')](_0x4e3c('0x5'),attributes,{'tableName':_0x4e3c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b2fc1){extensions['rewrite'](_0x2421a9,_0x5b2fc1);},'afterBulkCreate':function(_0x5cab6c,_0x2035dc,_0x40029a){_0x40029a();extensions[_0x4e3c('0x7')](_0x2421a9,_0x5cab6c[0x0]);},'afterUpdate':function(_0xd2692d){extensions[_0x4e3c('0x7')](_0x2421a9,_0xd2692d);},'afterDestroy':function(_0x5cc141){extensions['rewrite'](_0x2421a9,_0x5cc141);}},'instanceMethods':{'ifTime':function(_0x4fe4c8=undefined,_0x46f477=new Date()){if(typeof this[_0x4e3c('0x8')]===_0x4e3c('0x9')){return iftime(this['interval'],_0x4fe4c8,_0x46f477);}else{return this['getIntervals']()[_0x4e3c('0xa')](function(_0x20f336){return Promise[_0x4e3c('0xb')](_0x20f336[_0x4e3c('0xc')](function(_0x8d3e9c){return _0x8d3e9c[_0x4e3c('0xd')](_0x4fe4c8,_0x46f477);}));})['then'](function(_0x1726fb){return _0x1726fb[_0x4e3c('0xe')](function(_0x12de75,_0x23bc9b){return _0x12de75||_0x23bc9b;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 497c616..1918d7e 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x100d=['format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','isArray','lodash','util','../../mysqldb','iftime','../../config/logger','rpc','Interval','options','raw','attributes','limit','map','include','model','then','GetInterval','debug','stringify','error','message','ShowInterval','find','where','info','catch','findAll','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById'];(function(_0x1f715f,_0x20f65c){var _0xa72ef7=function(_0xe7a142){while(--_0xe7a142){_0x1f715f['push'](_0x1f715f['shift']());}};_0xa72ef7(++_0x20f65c);}(_0x100d,0x1c4));var _0xd100=function(_0x45192d,_0x20560a){_0x45192d=_0x45192d-0x0;var _0x3ad190=_0x100d[_0x45192d];return _0x3ad190;};'use strict';var _=require(_0xd100('0x0'));var util=require(_0xd100('0x1'));var db=require(_0xd100('0x2'))['db'];var iftime=require('../../utils/iftime')[_0xd100('0x3')];var logger=require(_0xd100('0x4'))(_0xd100('0x5'));exports['GetInterval']=function(_0x5d721c){var _0x5d1d43=this;return new Promise(function(_0x2ca836,_0x1cb13a){return db[_0xd100('0x6')]['findAll']({'raw':_0x5d721c[_0xd100('0x7')]?_0x5d721c[_0xd100('0x7')][_0xd100('0x8')]===undefined?!![]:![]:!![],'where':_0x5d721c[_0xd100('0x7')]?_0x5d721c[_0xd100('0x7')]['where']||null:null,'attributes':_0x5d721c[_0xd100('0x7')]?_0x5d721c[_0xd100('0x7')][_0xd100('0x9')]||null:null,'limit':_0x5d721c[_0xd100('0x7')]?_0x5d721c[_0xd100('0x7')][_0xd100('0xa')]||null:null,'include':_0x5d721c[_0xd100('0x7')]?_0x5d721c[_0xd100('0x7')]['include']?_[_0xd100('0xb')](_0x5d721c['options'][_0xd100('0xc')],function(_0x2374a0){return{'model':db[_0x2374a0['model']],'as':_0x2374a0['as'],'attributes':_0x2374a0['attributes'],'include':_0x2374a0[_0xd100('0xc')]?_[_0xd100('0xb')](_0x2374a0['include'],function(_0x272edd){return{'model':db[_0x272edd[_0xd100('0xd')]],'as':_0x272edd['as'],'attributes':_0x272edd[_0xd100('0x9')],'include':_0x272edd['include']?_[_0xd100('0xb')](_0x272edd[_0xd100('0xc')],function(_0x5da69e){return{'model':db[_0x5da69e[_0xd100('0xd')]],'as':_0x5da69e['as'],'attributes':_0x5da69e[_0xd100('0x9')]};}):[]};}):[]};}):[]:[]})[_0xd100('0xe')](function(_0x52294e){logger['info'](_0xd100('0xf'),_0x5d721c);logger[_0xd100('0x10')](_0xd100('0xf'),_0x5d721c,JSON[_0xd100('0x11')](_0x52294e));_0x2ca836(_0x52294e);})['catch'](function(_0x1600f9){logger[_0xd100('0x12')](_0xd100('0xf'),_0x1600f9[_0xd100('0x13')],_0x5d721c);_0x1cb13a(_0x5d1d43[_0xd100('0x12')](0x1f4,_0x1600f9[_0xd100('0x13')]));});});};exports[_0xd100('0x14')]=function(_0x3e4ce3){var _0x1e8293=this;return new Promise(function(_0x4c17d6,_0x3bddb1){return db[_0xd100('0x6')][_0xd100('0x15')]({'raw':_0x3e4ce3[_0xd100('0x7')]?_0x3e4ce3[_0xd100('0x7')][_0xd100('0x8')]===undefined?!![]:![]:!![],'where':_0x3e4ce3[_0xd100('0x7')]?_0x3e4ce3[_0xd100('0x7')][_0xd100('0x16')]||null:null,'attributes':_0x3e4ce3['options']?_0x3e4ce3[_0xd100('0x7')][_0xd100('0x9')]||null:null,'include':_0x3e4ce3['options']?_0x3e4ce3[_0xd100('0x7')][_0xd100('0xc')]?_[_0xd100('0xb')](_0x3e4ce3[_0xd100('0x7')][_0xd100('0xc')],function(_0x1033d9){return{'model':db[_0x1033d9[_0xd100('0xd')]],'as':_0x1033d9['as'],'attributes':_0x1033d9['attributes'],'include':_0x1033d9['include']?_['map'](_0x1033d9[_0xd100('0xc')],function(_0x55dbba){return{'model':db[_0x55dbba['model']],'as':_0x55dbba['as'],'attributes':_0x55dbba[_0xd100('0x9')],'include':_0x55dbba[_0xd100('0xc')]?_[_0xd100('0xb')](_0x55dbba['include'],function(_0x2f595b){return{'model':db[_0x2f595b[_0xd100('0xd')]],'as':_0x2f595b['as'],'attributes':_0x2f595b['attributes']};}):[]};}):[]};}):[]:[]})[_0xd100('0xe')](function(_0x31dbe5){logger[_0xd100('0x17')](_0xd100('0x14'),_0x3e4ce3);logger[_0xd100('0x10')](_0xd100('0x14'),_0x3e4ce3,JSON[_0xd100('0x11')](_0x31dbe5));_0x4c17d6(_0x31dbe5);})[_0xd100('0x18')](function(_0x2e686c){logger[_0xd100('0x12')](_0xd100('0x14'),_0x2e686c[_0xd100('0x13')],_0x3e4ce3);_0x3bddb1(_0x1e8293[_0xd100('0x12')](0x1f4,_0x2e686c[_0xd100('0x13')]));});});};function checkArrayOfIntervals(_0x2efa39,_0x35031c){var _0x14fd7e=[];return db[_0xd100('0x6')][_0xd100('0x19')]({'where':{'id':_0x2efa39}})[_0xd100('0xe')](function(_0x3b7a3f){_0x14fd7e=_0x3b7a3f;return Promise['all'](_0x14fd7e[_0xd100('0xb')](function(_0x1536e4){return _0x1536e4[_0xd100('0x1a')](_0x35031c);}));})[_0xd100('0xe')](function(_0x435715){var _0x3d81c3=_0x435715[_0xd100('0x1b')](function(_0xa9480,_0x756934){return _0xa9480||_0x756934;},![]);logger[_0xd100('0x17')](util['format'](_0xd100('0x1c'),_0x14fd7e[_0xd100('0xb')](function(_0x641df8){return _0x641df8[_0xd100('0x1d')];})[_0xd100('0x1e')](',\x20'),_0x14fd7e[_0xd100('0xb')](function(_0x39ef36){return _0x39ef36['id'];})[_0xd100('0x1e')](',\x20')));return _0x3d81c3;});}function checkSingleInterval(_0x5ad65a,_0x349f99){return db[_0xd100('0x6')][_0xd100('0x1f')](_0x5ad65a)[_0xd100('0xe')](function(_0x31a49a){if(_0x31a49a){logger['info'](util[_0xd100('0x20')](_0xd100('0x21'),_0x31a49a['name'],_0x31a49a['id']));return _0x31a49a['ifTime'](_0x349f99);}});}exports['IntervalIftime']=function(_0x4e74f0){var _0x3a153d=_0x4e74f0[_0xd100('0x22')];var _0x5ade41=Array['isArray'](_0x4e74f0[_0xd100('0x23')])?_0x4e74f0[_0xd100('0x23')]:typeof _0x4e74f0[_0xd100('0x23')]===_0xd100('0x24')?[_0x4e74f0[_0xd100('0x23')]]:[];var _0x506d7d=_0x4e74f0[_0xd100('0x25')]||undefined;var _0x33a8bd=![];if(_0x5ade41[_0xd100('0x26')]){logger[_0xd100('0x17')](util[_0xd100('0x20')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x5ade41[_0xd100('0x1e')](';\x20')));}if(_0x506d7d){logger[_0xd100('0x17')](util[_0xd100('0x20')](_0xd100('0x27'),_0x506d7d));}logger[_0xd100('0x10')](_0xd100('0x28'),_0x33a8bd);logger[_0xd100('0x29')](_0xd100('0x2a'),_0x4e74f0);return Promise['resolve']()['then'](function(){if(Array[_0xd100('0x2b')](_0x3a153d)){return checkArrayOfIntervals(_0x3a153d,_0x506d7d);}else if(_0x3a153d){return checkSingleInterval(_0x3a153d,_0x506d7d);}})[_0xd100('0xe')](function(_0x2ce5a1){var _0x5433f7=_0x5ade41[_0xd100('0x1b')](function(_0x5c791e,_0x4ba938){return _0x5c791e||iftime(_0x4ba938,_0x506d7d);},![]);_0x33a8bd=_0x2ce5a1||_0x5433f7;return _0x33a8bd;})[_0xd100('0x18')](function(_0x562a70){logger[_0xd100('0x12')](_0xd100('0x2a'),_0x4e74f0,_0x562a70);throw this[_0xd100('0x12')](0x1f4,_0x562a70[_0xd100('0x13')]);});}; \ No newline at end of file +var _0x9964=['info','debug','stringify','catch','message','find','ShowInterval','error','then','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','name','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','reduce','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x9964,0x76));var _0x4996=function(_0x6c0123,_0x4c8d3b){_0x6c0123=_0x6c0123-0x0;var _0x5a87d2=_0x9964[_0x6c0123];return _0x5a87d2;};'use strict';var _=require('lodash');var util=require(_0x4996('0x0'));var db=require(_0x4996('0x1'))['db'];var iftime=require(_0x4996('0x2'))[_0x4996('0x3')];var logger=require(_0x4996('0x4'))(_0x4996('0x5'));exports[_0x4996('0x6')]=function(_0xc102a6){var _0xb650ce=this;return new Promise(function(_0x2f938a,_0x2c9738){return db[_0x4996('0x7')][_0x4996('0x8')]({'raw':_0xc102a6[_0x4996('0x9')]?_0xc102a6[_0x4996('0x9')][_0x4996('0xa')]===undefined?!![]:![]:!![],'where':_0xc102a6[_0x4996('0x9')]?_0xc102a6['options'][_0x4996('0xb')]||null:null,'attributes':_0xc102a6[_0x4996('0x9')]?_0xc102a6['options'][_0x4996('0xc')]||null:null,'limit':_0xc102a6[_0x4996('0x9')]?_0xc102a6['options'][_0x4996('0xd')]||null:null,'include':_0xc102a6['options']?_0xc102a6[_0x4996('0x9')][_0x4996('0xe')]?_[_0x4996('0xf')](_0xc102a6['options']['include'],function(_0x16ff47){return{'model':db[_0x16ff47['model']],'as':_0x16ff47['as'],'attributes':_0x16ff47[_0x4996('0xc')],'include':_0x16ff47[_0x4996('0xe')]?_[_0x4996('0xf')](_0x16ff47[_0x4996('0xe')],function(_0x366fc5){return{'model':db[_0x366fc5[_0x4996('0x10')]],'as':_0x366fc5['as'],'attributes':_0x366fc5[_0x4996('0xc')],'include':_0x366fc5[_0x4996('0xe')]?_[_0x4996('0xf')](_0x366fc5['include'],function(_0x1206f0){return{'model':db[_0x1206f0[_0x4996('0x10')]],'as':_0x1206f0['as'],'attributes':_0x1206f0[_0x4996('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a1a09){logger[_0x4996('0x11')]('GetInterval',_0xc102a6);logger[_0x4996('0x12')](_0x4996('0x6'),_0xc102a6,JSON[_0x4996('0x13')](_0x2a1a09));_0x2f938a(_0x2a1a09);})[_0x4996('0x14')](function(_0x53b109){logger['error'](_0x4996('0x6'),_0x53b109[_0x4996('0x15')],_0xc102a6);_0x2c9738(_0xb650ce['error'](0x1f4,_0x53b109[_0x4996('0x15')]));});});};exports['ShowInterval']=function(_0x55a313){var _0x54254c=this;return new Promise(function(_0x2d5e43,_0x4f2f82){return db[_0x4996('0x7')][_0x4996('0x16')]({'raw':_0x55a313[_0x4996('0x9')]?_0x55a313[_0x4996('0x9')][_0x4996('0xa')]===undefined?!![]:![]:!![],'where':_0x55a313[_0x4996('0x9')]?_0x55a313['options'][_0x4996('0xb')]||null:null,'attributes':_0x55a313[_0x4996('0x9')]?_0x55a313[_0x4996('0x9')][_0x4996('0xc')]||null:null,'include':_0x55a313[_0x4996('0x9')]?_0x55a313[_0x4996('0x9')]['include']?_[_0x4996('0xf')](_0x55a313['options'][_0x4996('0xe')],function(_0x421b51){return{'model':db[_0x421b51[_0x4996('0x10')]],'as':_0x421b51['as'],'attributes':_0x421b51['attributes'],'include':_0x421b51['include']?_[_0x4996('0xf')](_0x421b51[_0x4996('0xe')],function(_0x24c42){return{'model':db[_0x24c42[_0x4996('0x10')]],'as':_0x24c42['as'],'attributes':_0x24c42[_0x4996('0xc')],'include':_0x24c42[_0x4996('0xe')]?_[_0x4996('0xf')](_0x24c42[_0x4996('0xe')],function(_0x32121e){return{'model':db[_0x32121e[_0x4996('0x10')]],'as':_0x32121e['as'],'attributes':_0x32121e[_0x4996('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x453a92){logger[_0x4996('0x11')](_0x4996('0x17'),_0x55a313);logger[_0x4996('0x12')]('ShowInterval',_0x55a313,JSON[_0x4996('0x13')](_0x453a92));_0x2d5e43(_0x453a92);})[_0x4996('0x14')](function(_0x50d707){logger[_0x4996('0x18')](_0x4996('0x17'),_0x50d707[_0x4996('0x15')],_0x55a313);_0x4f2f82(_0x54254c[_0x4996('0x18')](0x1f4,_0x50d707[_0x4996('0x15')]));});});};function checkArrayOfIntervals(_0x1c8c25,_0x30ffbe){var _0x22ebb2=[];return db[_0x4996('0x7')][_0x4996('0x8')]({'where':{'id':_0x1c8c25}})[_0x4996('0x19')](function(_0x3ade4c){_0x22ebb2=_0x3ade4c;return Promise[_0x4996('0x1a')](_0x22ebb2[_0x4996('0xf')](function(_0x4f9781){return _0x4f9781[_0x4996('0x1b')](_0x30ffbe);}));})[_0x4996('0x19')](function(_0x1f616c){var _0x5c8497=_0x1f616c['reduce'](function(_0x22c8a0,_0x14b732){return _0x22c8a0||_0x14b732;},![]);logger[_0x4996('0x11')](util[_0x4996('0x1c')](_0x4996('0x1d'),_0x22ebb2[_0x4996('0xf')](function(_0x4a4003){return _0x4a4003['name'];})[_0x4996('0x1e')](',\x20'),_0x22ebb2[_0x4996('0xf')](function(_0x58fad5){return _0x58fad5['id'];})[_0x4996('0x1e')](',\x20')));return _0x5c8497;});}function checkSingleInterval(_0x537eb4,_0x2b833f){return db['Interval'][_0x4996('0x1f')](_0x537eb4)['then'](function(_0x447211){if(_0x447211){logger[_0x4996('0x11')](util[_0x4996('0x1c')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x447211[_0x4996('0x20')],_0x447211['id']));return _0x447211[_0x4996('0x1b')](_0x2b833f);}});}exports[_0x4996('0x21')]=function(_0x1929e7){var _0x225342=_0x1929e7[_0x4996('0x22')];var _0x23bc7a=Array[_0x4996('0x23')](_0x1929e7['intervals'])?_0x1929e7[_0x4996('0x24')]:typeof _0x1929e7[_0x4996('0x24')]===_0x4996('0x25')?[_0x1929e7[_0x4996('0x24')]]:[];var _0xdcea16=_0x1929e7[_0x4996('0x26')]||undefined;var _0xe4f9e7=![];if(_0x23bc7a[_0x4996('0x27')]){logger[_0x4996('0x11')](util['format'](_0x4996('0x28'),_0x23bc7a[_0x4996('0x1e')](';\x20')));}if(_0xdcea16){logger[_0x4996('0x11')](util[_0x4996('0x1c')](_0x4996('0x29'),_0xdcea16));}logger[_0x4996('0x12')]('Iftime',_0xe4f9e7);logger[_0x4996('0x2a')](_0x4996('0x21'),_0x1929e7);return Promise[_0x4996('0x2b')]()[_0x4996('0x19')](function(){if(Array[_0x4996('0x23')](_0x225342)){return checkArrayOfIntervals(_0x225342,_0xdcea16);}else if(_0x225342){return checkSingleInterval(_0x225342,_0xdcea16);}})[_0x4996('0x19')](function(_0x20b3ca){var _0x4980c8=_0x23bc7a[_0x4996('0x2c')](function(_0x977f51,_0x2cb0ad){return _0x977f51||iftime(_0x2cb0ad,_0xdcea16);},![]);_0xe4f9e7=_0x20b3ca||_0x4980c8;return _0xe4f9e7;})['catch'](function(_0x2eb981){logger[_0x4996('0x18')]('IntervalIftime',_0x1929e7,_0x2eb981);throw this[_0x4996('0x18')](0x1f4,_0x2eb981['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 0270038..0d13493 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x2b797a,_0x23314b){var _0xeafab1=function(_0x35bc87){while(--_0x35bc87){_0x2b797a['push'](_0x2b797a['shift']());}};_0xeafab1(++_0x23314b);}(_0x2ef3,0xba));var _0x32ef=function(_0x297467,_0x1d74d8){_0x297467=_0x297467-0x0;var _0x443ec1=_0x2ef3[_0x297467];return _0x443ec1;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x660756,_0x4ee39a){var _0x122fd2=function(_0x21a861){while(--_0x21a861){_0x660756['push'](_0x660756['shift']());}};_0x122fd2(++_0x4ee39a);}(_0xdb28,0x106));var _0x8db2=function(_0x3854c2,_0x15e92b){_0x3854c2=_0x3854c2-0x0;var _0xdf8965=_0xdb28[_0x3854c2];return _0xdf8965;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 205eb1c..809233f 100644 --- a/server/api/jira/jira.controller.js +++ b/server/api/jira/jira.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe321=['data','status','statusCode','parse','error','json','api.jira','write','end','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','stringify','request','setEncoding'];(function(_0x579681,_0x181f3f){var _0x3054e0=function(_0x3c57ac){while(--_0x3c57ac){_0x579681['push'](_0x579681['shift']());}};_0x3054e0(++_0x181f3f);}(_0xe321,0x6e));var _0x1e32=function(_0x3f77f0,_0x1d5022){_0x3f77f0=_0x3f77f0-0x0;var _0x514414=_0xe321[_0x3f77f0];return _0x514414;};'use strict';var BPromise=require(_0x1e32('0x0'));var https=require(_0x1e32('0x1'));var logger=require(_0x1e32('0x2'))(_0x1e32('0x3'));var USERNAME=_0x1e32('0x4');var PASSWORD=_0x1e32('0x5');function openIssue(_0x5c4ee6,_0x27baff){var _0x5637ae={'fields':{'project':{'key':_0x5c4ee6[_0x1e32('0x6')]||_0x1e32('0x7')},'summary':(_0x5c4ee6[_0x1e32('0x8')]||_0x1e32('0x9'))+_0x1e32('0xa')+_0x5c4ee6['ip'],'description':_0x5c4ee6[_0x1e32('0xb')]||JSON['stringify'](_0x5c4ee6),'issuetype':{'name':_0x5c4ee6[_0x1e32('0xc')]||_0x1e32('0xd')}}};_0x5637ae[_0x1e32('0xe')][_0x1e32('0xf')]=_0x5c4ee6[_0x1e32('0x10')];_0x5637ae[_0x1e32('0xe')][_0x1e32('0x11')]=_0x5c4ee6[_0x1e32('0x12')];_0x5637ae['fields'][_0x1e32('0x13')]=_0x5c4ee6[_0x1e32('0x14')];_0x5637ae['fields']['customfield_11503']=_0x5c4ee6['name'];_0x5637ae[_0x1e32('0xe')]['customfield_11504']=_0x5c4ee6[_0x1e32('0x15')];_0x5637ae['fields']['customfield_10102']=_0x5c4ee6['ip'];var _0x5341c1={'host':_0x1e32('0x16'),'port':0x1bb,'path':_0x1e32('0x17'),'method':_0x1e32('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x1e32('0x19'),'Authorization':_0x1e32('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x1e32('0x1b')]('base64')}};var _0x5aa3ad=JSON[_0x1e32('0x1c')](_0x5637ae);var _0x44b0e1=https[_0x1e32('0x1d')](_0x5341c1,function(_0xa1a546){_0xa1a546[_0x1e32('0x1e')]('utf8');var _0x252e68='';_0xa1a546['on'](_0x1e32('0x1f'),function(_0x35777c){_0x252e68+=_0x35777c;});_0xa1a546['on']('end',function(){if(_0x27baff){return _0x27baff[_0x1e32('0x20')](_0xa1a546[_0x1e32('0x21')])['json'](JSON[_0x1e32('0x22')](_0x252e68));}});});_0x44b0e1['on'](_0x1e32('0x23'),function(_0x3287e5){if(_0x27baff){return _0x27baff['status'](0x1f4)[_0x1e32('0x24')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x1e32('0x25')}]});}});_0x44b0e1[_0x1e32('0x26')](_0x5aa3ad);_0x44b0e1[_0x1e32('0x27')]();}exports['openIssue']=openIssue;exports[_0x1e32('0x28')]=function(_0x1a3d16,_0x2d6536){_0x1a3d16[_0x1e32('0x29')]['ip']=_0x1a3d16[_0x1e32('0x2a')][_0x1e32('0x2b')]||_0x1a3d16[_0x1e32('0x2c')][_0x1e32('0x2d')]||_0x1a3d16[_0x1e32('0x2e')]['remoteAddress']||_0x1a3d16[_0x1e32('0x2c')][_0x1e32('0x2e')]['remoteAddress'];return openIssue(_0x1a3d16[_0x1e32('0x29')],_0x2d6536);}; \ No newline at end of file +var _0x50b4=['base64','request','setEncoding','utf8','end','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','x-forwarded-for','connection','socket','remoteAddress','body','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST'];(function(_0x5f10b4,_0x22270e){var _0x1c9424=function(_0x2ade8a){while(--_0x2ade8a){_0x5f10b4['push'](_0x5f10b4['shift']());}};_0x1c9424(++_0x22270e);}(_0x50b4,0xe3));var _0x450b=function(_0x27d0d6,_0xc29871){_0x27d0d6=_0x27d0d6-0x0;var _0x8c2773=_0x50b4[_0x27d0d6];return _0x8c2773;};'use strict';var BPromise=require('bluebird');var https=require(_0x450b('0x0'));var logger=require(_0x450b('0x1'))(_0x450b('0x2'));var USERNAME=_0x450b('0x3');var PASSWORD=_0x450b('0x4');function openIssue(_0x5c487d,_0x795248){var _0x284372={'fields':{'project':{'key':_0x5c487d[_0x450b('0x5')]||'MOTGUI'},'summary':(_0x5c487d[_0x450b('0x6')]||_0x450b('0x7'))+_0x450b('0x8')+_0x5c487d['ip'],'description':_0x5c487d['description']||JSON[_0x450b('0x9')](_0x5c487d),'issuetype':{'name':_0x5c487d[_0x450b('0xa')]||_0x450b('0xb')}}};_0x284372[_0x450b('0xc')][_0x450b('0xd')]=_0x5c487d['email'];_0x284372[_0x450b('0xc')][_0x450b('0xe')]=_0x5c487d[_0x450b('0xf')];_0x284372[_0x450b('0xc')][_0x450b('0x10')]=_0x5c487d[_0x450b('0x11')];_0x284372['fields'][_0x450b('0x12')]=_0x5c487d[_0x450b('0x13')];_0x284372[_0x450b('0xc')][_0x450b('0x14')]=_0x5c487d[_0x450b('0x15')];_0x284372[_0x450b('0xc')][_0x450b('0x16')]=_0x5c487d['ip'];var _0x22b055={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x450b('0x17'),'method':_0x450b('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x450b('0x19'))}};var _0x20ee4f=JSON['stringify'](_0x284372);var _0x1a3975=https[_0x450b('0x1a')](_0x22b055,function(_0x2a480b){_0x2a480b[_0x450b('0x1b')](_0x450b('0x1c'));var _0x227800='';_0x2a480b['on']('data',function(_0x2e354e){_0x227800+=_0x2e354e;});_0x2a480b['on'](_0x450b('0x1d'),function(){if(_0x795248){return _0x795248[_0x450b('0x1e')](_0x2a480b['statusCode'])[_0x450b('0x1f')](JSON[_0x450b('0x20')](_0x227800));}});});_0x1a3975['on']('error',function(_0x240164){if(_0x795248){return _0x795248[_0x450b('0x1e')](0x1f4)[_0x450b('0x1f')]({'errors':[{'message':_0x450b('0x21'),'type':_0x450b('0x22')}]});}});_0x1a3975[_0x450b('0x23')](_0x20ee4f);_0x1a3975[_0x450b('0x1d')]();}exports[_0x450b('0x24')]=openIssue;exports['send']=function(_0x4719b2,_0x27d998){_0x4719b2['body']['ip']=_0x4719b2['headers'][_0x450b('0x25')]||_0x4719b2[_0x450b('0x26')]['remoteAddress']||_0x4719b2[_0x450b('0x27')][_0x450b('0x28')]||_0x4719b2['connection'][_0x450b('0x27')][_0x450b('0x28')];return openIssue(_0x4719b2[_0x450b('0x29')],_0x27d998);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 33a2886..e8185ee 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda55=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0xda55,0x6d));var _0x5da5=function(_0x5305c0,_0x2588e3){_0x5305c0=_0x5305c0-0x0;var _0x5c27bd=_0xda55[_0x5305c0];return _0x5c27bd;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy','exports'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0xc')]('/',auth[_0x34ea('0x8')](),controller['create']);router['put'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['delete'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xe')]);module[_0x34ea('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 93bc1d2..9f87350 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7a54,0x106));var _0x47a5=function(_0x8f1045,_0x4f2b35){_0x8f1045=_0x8f1045-0x0;var _0x5c3235=_0x7a54[_0x8f1045];return _0x5c3235;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x3eb937,_0x277135){_0x3eb937=_0x3eb937-0x0;var _0xe16869=_0x7a54[_0x3eb937];return _0xe16869;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 93a828d..fe8532e 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e8a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','JscriptyAnswerReport','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x450fd2,_0x11023b){var _0x1b2168=function(_0x4e2bc8){while(--_0x4e2bc8){_0x450fd2['push'](_0x450fd2['shift']());}};_0x1b2168(++_0x11023b);}(_0x9e8a,0x112));var _0xa9e8=function(_0x2b3193,_0x51c7e7){_0x2b3193=_0x2b3193-0x0;var _0x29251a=_0x9e8a[_0x2b3193];return _0x29251a;};'use strict';var emlformat=require(_0xa9e8('0x0'));var rimraf=require(_0xa9e8('0x1'));var zipdir=require(_0xa9e8('0x2'));var jsonpatch=require(_0xa9e8('0x3'));var rp=require(_0xa9e8('0x4'));var moment=require(_0xa9e8('0x5'));var BPromise=require(_0xa9e8('0x6'));var Mustache=require(_0xa9e8('0x7'));var util=require(_0xa9e8('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9e8('0x9'));var _=require(_0xa9e8('0xa'));var squel=require(_0xa9e8('0xb'));var crypto=require(_0xa9e8('0xc'));var jsforce=require(_0xa9e8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa9e8('0xe'));var querystring=require(_0xa9e8('0xf'));var Papa=require(_0xa9e8('0x10'));var Redis=require(_0xa9e8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa9e8('0x12'));var as=require(_0xa9e8('0x13'));var hardwareService=require(_0xa9e8('0x14'));var logger=require(_0xa9e8('0x15'))('api');var utils=require(_0xa9e8('0x16'));var config=require(_0xa9e8('0x17'));var licenseUtil=require(_0xa9e8('0x18'));var db=require(_0xa9e8('0x19'))['db'];function respondWithStatusCode(_0x42cee1,_0x328918){_0x328918=_0x328918||0xcc;return function(_0xa982d){if(_0xa982d){return _0x42cee1[_0xa9e8('0x1a')](_0x328918);}return _0x42cee1['status'](_0x328918)[_0xa9e8('0x1b')]();};}function respondWithResult(_0x5e2cbf,_0x514de0){_0x514de0=_0x514de0||0xc8;return function(_0x56ddfb){if(_0x56ddfb){return _0x5e2cbf['status'](_0x514de0)['json'](_0x56ddfb);}};}function respondWithFilteredResult(_0x391969,_0x62ee19){return function(_0x185068){if(_0x185068){var _0x403645=typeof _0x62ee19[_0xa9e8('0x1c')]===_0xa9e8('0x1d')&&typeof _0x62ee19[_0xa9e8('0x1e')]===_0xa9e8('0x1d');var _0x5db208=_0x185068['count'];var _0x524e4e=_0x403645?0x0:_0x62ee19[_0xa9e8('0x1c')];var _0x757a54=_0x403645?_0x185068[_0xa9e8('0x1f')]:_0x62ee19['offset']+_0x62ee19[_0xa9e8('0x1e')];var _0x29b91b;if(_0x757a54>=_0x5db208){_0x757a54=_0x5db208;_0x29b91b=0xc8;}else{_0x29b91b=0xce;}_0x391969[_0xa9e8('0x20')](_0x29b91b);return _0x391969[_0xa9e8('0x21')](_0xa9e8('0x22'),_0x524e4e+'-'+_0x757a54+'/'+_0x5db208)[_0xa9e8('0x23')](_0x185068);}return null;};}function patchUpdates(_0x266d07){return function(_0x25a5d5){try{jsonpatch[_0xa9e8('0x24')](_0x25a5d5,_0x266d07,!![]);}catch(_0x1f9fbb){return BPromise[_0xa9e8('0x25')](_0x1f9fbb);}return _0x25a5d5['save']();};}function saveUpdates(_0x51ee03,_0x40b9ea){return function(_0x6b6fab){if(_0x6b6fab){return _0x6b6fab[_0xa9e8('0x26')](_0x51ee03)[_0xa9e8('0x27')](function(_0x1ea9b6){return _0x1ea9b6;});}return null;};}function removeEntity(_0x588aea,_0x74fe20){return function(_0x561a40){if(_0x561a40){return _0x561a40[_0xa9e8('0x28')]()[_0xa9e8('0x27')](function(){_0x588aea[_0xa9e8('0x20')](0xcc)[_0xa9e8('0x1b')]();});}};}function handleEntityNotFound(_0xc015c5,_0x38672a){return function(_0x499502){if(!_0x499502){_0xc015c5[_0xa9e8('0x1a')](0x194);}return _0x499502;};}function handleError(_0x5bc39b,_0x225b36){_0x225b36=_0x225b36||0x1f4;return function(_0x3a7b7a){logger['error'](_0x3a7b7a[_0xa9e8('0x29')]);if(_0x3a7b7a['name']){delete _0x3a7b7a[_0xa9e8('0x2a')];}_0x5bc39b[_0xa9e8('0x20')](_0x225b36)[_0xa9e8('0x2b')](_0x3a7b7a);};}exports['index']=function(_0x34791e,_0x56e9bf){var _0x3a706e={},_0x3e6c63={},_0x45ade7={'count':0x0,'rows':[]};var _0x44d28b=_['map'](db[_0xa9e8('0x2c')][_0xa9e8('0x2d')],function(_0x2a966f){return{'name':_0x2a966f['fieldName'],'type':_0x2a966f[_0xa9e8('0x2e')]['key']};});_0x3e6c63[_0xa9e8('0x2f')]=_[_0xa9e8('0x30')](_0x44d28b,_0xa9e8('0x2a'));_0x3e6c63[_0xa9e8('0x31')]=_[_0xa9e8('0x32')](_0x34791e[_0xa9e8('0x31')]);_0x3e6c63[_0xa9e8('0x33')]=_[_0xa9e8('0x34')](_0x3e6c63[_0xa9e8('0x2f')],_0x3e6c63[_0xa9e8('0x31')]);_0x3a706e[_0xa9e8('0x35')]=_[_0xa9e8('0x34')](_0x3e6c63[_0xa9e8('0x2f')],qs['fields'](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x36')]));_0x3a706e[_0xa9e8('0x35')]=_0x3a706e['attributes']['length']?_0x3a706e[_0xa9e8('0x35')]:_0x3e6c63[_0xa9e8('0x2f')];if(!_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x37')](_0xa9e8('0x38'))){_0x3a706e[_0xa9e8('0x1e')]=qs[_0xa9e8('0x1e')](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x1e')]);_0x3a706e[_0xa9e8('0x1c')]=qs[_0xa9e8('0x1c')](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x1c')]);}_0x3a706e[_0xa9e8('0x39')]=qs[_0xa9e8('0x3a')](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x3a')]);_0x3a706e[_0xa9e8('0x3b')]=qs[_0xa9e8('0x33')](_['pick'](_0x34791e['query'],_0x3e6c63[_0xa9e8('0x33')]),_0x44d28b);if(_0x34791e['query'][_0xa9e8('0x3c')]){_0x3a706e[_0xa9e8('0x3b')]=_[_0xa9e8('0x3d')](_0x3a706e[_0xa9e8('0x3b')],{'$or':_[_0xa9e8('0x30')](_0x44d28b,function(_0x55be1b){if(_0x55be1b[_0xa9e8('0x2e')]!==_0xa9e8('0x3e')){var _0x2c03ba={};_0x2c03ba[_0x55be1b[_0xa9e8('0x2a')]]={'$like':'%'+_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x3c')]+'%'};return _0x2c03ba;}})});}_0x3a706e=_[_0xa9e8('0x3d')]({},_0x3a706e,_0x34791e[_0xa9e8('0x3f')]);var _0x1fb8a8={'where':_0x3a706e[_0xa9e8('0x3b')]};return db[_0xa9e8('0x2c')][_0xa9e8('0x1f')](_0x1fb8a8)[_0xa9e8('0x27')](function(_0x4d7dce){_0x45ade7[_0xa9e8('0x1f')]=_0x4d7dce;if(_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x40')]){_0x3a706e[_0xa9e8('0x41')]=[{'all':!![]}];}return db[_0xa9e8('0x2c')]['findAll'](_0x3a706e);})['then'](function(_0x4c08e4){_0x45ade7[_0xa9e8('0x42')]=_0x4c08e4;return _0x45ade7;})[_0xa9e8('0x27')](respondWithFilteredResult(_0x56e9bf,_0x3a706e))[_0xa9e8('0x43')](handleError(_0x56e9bf,null));};exports[_0xa9e8('0x44')]=function(_0x4bf7f9,_0x3a05cc){var _0x1c489c={'raw':!![],'where':{'id':_0x4bf7f9[_0xa9e8('0x45')]['id']}},_0x157c05={};_0x157c05[_0xa9e8('0x2f')]=_[_0xa9e8('0x32')](db[_0xa9e8('0x2c')][_0xa9e8('0x2d')]);_0x157c05[_0xa9e8('0x31')]=_['keys'](_0x4bf7f9['query']);_0x157c05[_0xa9e8('0x33')]=_['intersection'](_0x157c05['model'],_0x157c05[_0xa9e8('0x31')]);_0x1c489c['attributes']=_[_0xa9e8('0x34')](_0x157c05[_0xa9e8('0x2f')],qs[_0xa9e8('0x36')](_0x4bf7f9['query'][_0xa9e8('0x36')]));_0x1c489c[_0xa9e8('0x35')]=_0x1c489c[_0xa9e8('0x35')]['length']?_0x1c489c[_0xa9e8('0x35')]:_0x157c05[_0xa9e8('0x2f')];if(_0x4bf7f9['query'][_0xa9e8('0x40')]){_0x1c489c['include']=[{'all':!![]}];}_0x1c489c=_['merge']({},_0x1c489c,_0x4bf7f9[_0xa9e8('0x3f')]);return db[_0xa9e8('0x2c')][_0xa9e8('0x46')](_0x1c489c)[_0xa9e8('0x27')](handleEntityNotFound(_0x3a05cc,null))[_0xa9e8('0x27')](respondWithResult(_0x3a05cc,null))[_0xa9e8('0x43')](handleError(_0x3a05cc,null));};exports['create']=function(_0x2759ea,_0x271be4){return db[_0xa9e8('0x2c')][_0xa9e8('0x47')](_0x2759ea[_0xa9e8('0x48')],{})[_0xa9e8('0x27')](respondWithResult(_0x271be4,0xc9))[_0xa9e8('0x43')](handleError(_0x271be4,null));};exports[_0xa9e8('0x26')]=function(_0x1ce67a,_0x25f55c){if(_0x1ce67a[_0xa9e8('0x48')]['id']){delete _0x1ce67a[_0xa9e8('0x48')]['id'];}return db[_0xa9e8('0x2c')][_0xa9e8('0x46')]({'where':{'id':_0x1ce67a[_0xa9e8('0x45')]['id']}})[_0xa9e8('0x27')](handleEntityNotFound(_0x25f55c,null))[_0xa9e8('0x27')](saveUpdates(_0x1ce67a[_0xa9e8('0x48')],null))[_0xa9e8('0x27')](respondWithResult(_0x25f55c,null))[_0xa9e8('0x43')](handleError(_0x25f55c,null));};exports['destroy']=function(_0x34c29e,_0x11264f){return db[_0xa9e8('0x2c')][_0xa9e8('0x46')]({'where':{'id':_0x34c29e['params']['id']}})[_0xa9e8('0x27')](handleEntityNotFound(_0x11264f,null))[_0xa9e8('0x27')](removeEntity(_0x11264f,null))[_0xa9e8('0x43')](handleError(_0x11264f,null));};exports[_0xa9e8('0x49')]=function(_0x2e5d34,_0xa2b9b5){return db[_0xa9e8('0x2c')]['describe']()['then'](respondWithResult(_0xa2b9b5,null))[_0xa9e8('0x43')](handleError(_0xa2b9b5,null));}; \ No newline at end of file +var _0xd9ef=['describe','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','map','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','body','destroy'];(function(_0x19921b,_0x5c0c2d){var _0x273545=function(_0x387462){while(--_0x387462){_0x19921b['push'](_0x19921b['shift']());}};_0x273545(++_0x5c0c2d);}(_0xd9ef,0x95));var _0xfd9e=function(_0x2cfc5a,_0x4bea57){_0x2cfc5a=_0x2cfc5a-0x0;var _0x44d603=_0xd9ef[_0x2cfc5a];return _0x44d603;};'use strict';var emlformat=require(_0xfd9e('0x0'));var rimraf=require(_0xfd9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd9e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfd9e('0x3'));var util=require(_0xfd9e('0x4'));var path=require(_0xfd9e('0x5'));var sox=require(_0xfd9e('0x6'));var csv=require(_0xfd9e('0x7'));var ejs=require(_0xfd9e('0x8'));var fs=require('fs');var fs_extra=require(_0xfd9e('0x9'));var _=require(_0xfd9e('0xa'));var squel=require(_0xfd9e('0xb'));var crypto=require(_0xfd9e('0xc'));var jsforce=require(_0xfd9e('0xd'));var deskjs=require(_0xfd9e('0xe'));var toCsv=require(_0xfd9e('0x7'));var querystring=require('querystring');var Papa=require(_0xfd9e('0xf'));var Redis=require(_0xfd9e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfd9e('0x11'));var as=require(_0xfd9e('0x12'));var hardwareService=require(_0xfd9e('0x13'));var logger=require('../../config/logger')(_0xfd9e('0x14'));var utils=require(_0xfd9e('0x15'));var config=require(_0xfd9e('0x16'));var licenseUtil=require(_0xfd9e('0x17'));var db=require(_0xfd9e('0x18'))['db'];function respondWithStatusCode(_0x5c2f96,_0x3d76bb){_0x3d76bb=_0x3d76bb||0xcc;return function(_0x19d0e6){if(_0x19d0e6){return _0x5c2f96[_0xfd9e('0x19')](_0x3d76bb);}return _0x5c2f96[_0xfd9e('0x1a')](_0x3d76bb)[_0xfd9e('0x1b')]();};}function respondWithResult(_0x5087b8,_0x94224a){_0x94224a=_0x94224a||0xc8;return function(_0x3df6fa){if(_0x3df6fa){return _0x5087b8[_0xfd9e('0x1a')](_0x94224a)[_0xfd9e('0x1c')](_0x3df6fa);}};}function respondWithFilteredResult(_0x585d6d,_0x1577ba){return function(_0x4cf251){if(_0x4cf251){var _0x5e7d67=typeof _0x1577ba[_0xfd9e('0x1d')]===_0xfd9e('0x1e')&&typeof _0x1577ba[_0xfd9e('0x1f')]==='undefined';var _0x3c329e=_0x4cf251[_0xfd9e('0x20')];var _0x64c8f6=_0x5e7d67?0x0:_0x1577ba[_0xfd9e('0x1d')];var _0x3de235=_0x5e7d67?_0x4cf251[_0xfd9e('0x20')]:_0x1577ba[_0xfd9e('0x1d')]+_0x1577ba['limit'];var _0x44ae3c;if(_0x3de235>=_0x3c329e){_0x3de235=_0x3c329e;_0x44ae3c=0xc8;}else{_0x44ae3c=0xce;}_0x585d6d[_0xfd9e('0x1a')](_0x44ae3c);return _0x585d6d[_0xfd9e('0x21')](_0xfd9e('0x22'),_0x64c8f6+'-'+_0x3de235+'/'+_0x3c329e)[_0xfd9e('0x1c')](_0x4cf251);}return null;};}function patchUpdates(_0x2e48da){return function(_0x16213b){try{jsonpatch[_0xfd9e('0x23')](_0x16213b,_0x2e48da,!![]);}catch(_0x46fb76){return BPromise[_0xfd9e('0x24')](_0x46fb76);}return _0x16213b['save']();};}function saveUpdates(_0x2afb3c,_0x24bc2c){return function(_0x140992){if(_0x140992){return _0x140992[_0xfd9e('0x25')](_0x2afb3c)[_0xfd9e('0x26')](function(_0x4d9ea4){return _0x4d9ea4;});}return null;};}function removeEntity(_0x19b72d,_0x40ef13){return function(_0x4c465e){if(_0x4c465e){return _0x4c465e['destroy']()[_0xfd9e('0x26')](function(){_0x19b72d[_0xfd9e('0x1a')](0xcc)[_0xfd9e('0x1b')]();});}};}function handleEntityNotFound(_0x16768a,_0x14fd94){return function(_0x4b83e0){if(!_0x4b83e0){_0x16768a[_0xfd9e('0x19')](0x194);}return _0x4b83e0;};}function handleError(_0x2c7f53,_0x9bf44f){_0x9bf44f=_0x9bf44f||0x1f4;return function(_0x33b57a){logger[_0xfd9e('0x27')](_0x33b57a['stack']);if(_0x33b57a['name']){delete _0x33b57a['name'];}_0x2c7f53[_0xfd9e('0x1a')](_0x9bf44f)['send'](_0x33b57a);};}exports['index']=function(_0x2f35ee,_0x143ae7){var _0x53272f={},_0x1f4193={},_0x2e49e2={'count':0x0,'rows':[]};var _0x303718=_[_0xfd9e('0x28')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x182c58){return{'name':_0x182c58[_0xfd9e('0x29')],'type':_0x182c58[_0xfd9e('0x2a')][_0xfd9e('0x2b')]};});_0x1f4193['model']=_[_0xfd9e('0x28')](_0x303718,_0xfd9e('0x2c'));_0x1f4193['query']=_['keys'](_0x2f35ee[_0xfd9e('0x2d')]);_0x1f4193[_0xfd9e('0x2e')]=_[_0xfd9e('0x2f')](_0x1f4193[_0xfd9e('0x30')],_0x1f4193[_0xfd9e('0x2d')]);_0x53272f[_0xfd9e('0x31')]=_[_0xfd9e('0x2f')](_0x1f4193[_0xfd9e('0x30')],qs[_0xfd9e('0x32')](_0x2f35ee['query'][_0xfd9e('0x32')]));_0x53272f[_0xfd9e('0x31')]=_0x53272f[_0xfd9e('0x31')][_0xfd9e('0x33')]?_0x53272f[_0xfd9e('0x31')]:_0x1f4193[_0xfd9e('0x30')];if(!_0x2f35ee[_0xfd9e('0x2d')][_0xfd9e('0x34')](_0xfd9e('0x35'))){_0x53272f[_0xfd9e('0x1f')]=qs[_0xfd9e('0x1f')](_0x2f35ee['query']['limit']);_0x53272f['offset']=qs[_0xfd9e('0x1d')](_0x2f35ee[_0xfd9e('0x2d')]['offset']);}_0x53272f['order']=qs['sort'](_0x2f35ee[_0xfd9e('0x2d')][_0xfd9e('0x36')]);_0x53272f[_0xfd9e('0x37')]=qs[_0xfd9e('0x2e')](_[_0xfd9e('0x38')](_0x2f35ee[_0xfd9e('0x2d')],_0x1f4193[_0xfd9e('0x2e')]),_0x303718);if(_0x2f35ee['query']['filter']){_0x53272f[_0xfd9e('0x37')]=_['merge'](_0x53272f[_0xfd9e('0x37')],{'$or':_[_0xfd9e('0x28')](_0x303718,function(_0x1d2f1e){if(_0x1d2f1e[_0xfd9e('0x2a')]!==_0xfd9e('0x39')){var _0x660200={};_0x660200[_0x1d2f1e['name']]={'$like':'%'+_0x2f35ee['query'][_0xfd9e('0x3a')]+'%'};return _0x660200;}})});}_0x53272f=_['merge']({},_0x53272f,_0x2f35ee[_0xfd9e('0x3b')]);var _0x28845a={'where':_0x53272f[_0xfd9e('0x37')]};return db[_0xfd9e('0x3c')][_0xfd9e('0x20')](_0x28845a)[_0xfd9e('0x26')](function(_0x182cc8){_0x2e49e2[_0xfd9e('0x20')]=_0x182cc8;if(_0x2f35ee[_0xfd9e('0x2d')][_0xfd9e('0x3d')]){_0x53272f[_0xfd9e('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xfd9e('0x3f')](_0x53272f);})[_0xfd9e('0x26')](function(_0x29e2a2){_0x2e49e2[_0xfd9e('0x40')]=_0x29e2a2;return _0x2e49e2;})[_0xfd9e('0x26')](respondWithFilteredResult(_0x143ae7,_0x53272f))[_0xfd9e('0x41')](handleError(_0x143ae7,null));};exports[_0xfd9e('0x42')]=function(_0xe7728f,_0x4272d9){var _0x101d8e={'raw':!![],'where':{'id':_0xe7728f[_0xfd9e('0x43')]['id']}},_0x27c587={};_0x27c587[_0xfd9e('0x30')]=_[_0xfd9e('0x44')](db[_0xfd9e('0x3c')][_0xfd9e('0x45')]);_0x27c587[_0xfd9e('0x2d')]=_[_0xfd9e('0x44')](_0xe7728f[_0xfd9e('0x2d')]);_0x27c587[_0xfd9e('0x2e')]=_[_0xfd9e('0x2f')](_0x27c587[_0xfd9e('0x30')],_0x27c587['query']);_0x101d8e['attributes']=_['intersection'](_0x27c587[_0xfd9e('0x30')],qs[_0xfd9e('0x32')](_0xe7728f[_0xfd9e('0x2d')][_0xfd9e('0x32')]));_0x101d8e['attributes']=_0x101d8e['attributes'][_0xfd9e('0x33')]?_0x101d8e[_0xfd9e('0x31')]:_0x27c587['model'];if(_0xe7728f['query']['includeAll']){_0x101d8e[_0xfd9e('0x3e')]=[{'all':!![]}];}_0x101d8e=_['merge']({},_0x101d8e,_0xe7728f[_0xfd9e('0x3b')]);return db['JscriptyAnswerReport'][_0xfd9e('0x46')](_0x101d8e)[_0xfd9e('0x26')](handleEntityNotFound(_0x4272d9,null))[_0xfd9e('0x26')](respondWithResult(_0x4272d9,null))[_0xfd9e('0x41')](handleError(_0x4272d9,null));};exports['create']=function(_0x2763aa,_0x103dc9){return db[_0xfd9e('0x3c')]['create'](_0x2763aa[_0xfd9e('0x47')],{})[_0xfd9e('0x26')](respondWithResult(_0x103dc9,0xc9))[_0xfd9e('0x41')](handleError(_0x103dc9,null));};exports[_0xfd9e('0x25')]=function(_0x11d471,_0x2e8834){if(_0x11d471[_0xfd9e('0x47')]['id']){delete _0x11d471[_0xfd9e('0x47')]['id'];}return db[_0xfd9e('0x3c')][_0xfd9e('0x46')]({'where':{'id':_0x11d471[_0xfd9e('0x43')]['id']}})[_0xfd9e('0x26')](handleEntityNotFound(_0x2e8834,null))[_0xfd9e('0x26')](saveUpdates(_0x11d471[_0xfd9e('0x47')],null))[_0xfd9e('0x26')](respondWithResult(_0x2e8834,null))[_0xfd9e('0x41')](handleError(_0x2e8834,null));};exports[_0xfd9e('0x48')]=function(_0xc28004,_0x8e6cd0){return db[_0xfd9e('0x3c')]['find']({'where':{'id':_0xc28004[_0xfd9e('0x43')]['id']}})[_0xfd9e('0x26')](handleEntityNotFound(_0x8e6cd0,null))['then'](removeEntity(_0x8e6cd0,null))[_0xfd9e('0x41')](handleError(_0x8e6cd0,null));};exports['describe']=function(_0x13524e,_0x23a7e9){return db[_0xfd9e('0x3c')][_0xfd9e('0x49')]()[_0xfd9e('0x26')](respondWithResult(_0x23a7e9,null))['catch'](handleError(_0x23a7e9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 5f19ec3..d1b058a 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x457f=['api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x457f,0x1a1));var _0xf457=function(_0x373e79,_0x4a4628){_0x373e79=_0x373e79-0x0;var _0x1c45fa=_0x457f[_0x373e79];return _0x1c45fa;};'use strict';var _=require(_0xf457('0x0'));var util=require(_0xf457('0x1'));var logger=require(_0xf457('0x2'))(_0xf457('0x3'));var moment=require(_0xf457('0x4'));var BPromise=require(_0xf457('0x5'));var rp=require(_0xf457('0x6'));var fs=require('fs');var path=require(_0xf457('0x7'));var rimraf=require('rimraf');var config=require(_0xf457('0x8'));var attributes=require(_0xf457('0x9'));module[_0xf457('0xa')]=function(_0x57e59f,_0x44eb63){return _0x57e59f[_0xf457('0xb')](_0xf457('0xc'),attributes,{'tableName':_0xf457('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c60=['path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1e283d,_0x44e3fd){var _0x33a864=function(_0x30b4ff){while(--_0x30b4ff){_0x1e283d['push'](_0x1e283d['shift']());}};_0x33a864(++_0x44e3fd);}(_0x6c60,0x7c));var _0x06c6=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x6c60[_0x238671];return _0x474844;};'use strict';var _=require(_0x06c6('0x0'));var util=require(_0x06c6('0x1'));var logger=require('../../config/logger')(_0x06c6('0x2'));var moment=require(_0x06c6('0x3'));var BPromise=require(_0x06c6('0x4'));var rp=require(_0x06c6('0x5'));var fs=require('fs');var path=require(_0x06c6('0x6'));var rimraf=require(_0x06c6('0x7'));var config=require('../../config/environment');var attributes=require(_0x06c6('0x8'));module[_0x06c6('0x9')]=function(_0x247b51,_0x1e327d){return _0x247b51[_0x06c6('0xa')](_0x06c6('0xb'),attributes,{'tableName':_0x06c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 6aca49f..e4c213f 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e75=['error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3f9eb6,_0x95d852){var _0x40cac4=function(_0x3bf497){while(--_0x3bf497){_0x3f9eb6['push'](_0x3f9eb6['shift']());}};_0x40cac4(++_0x95d852);}(_0x6e75,0x101));var _0x56e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e75[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x56e7('0x0'));var util=require('util');var moment=require(_0x56e7('0x1'));var BPromise=require(_0x56e7('0x2'));var rs=require(_0x56e7('0x3'));var fs=require('fs');var Redis=require(_0x56e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x56e7('0x5'));var logger=require('../../config/logger')(_0x56e7('0x6'));var config=require(_0x56e7('0x7'));var jayson=require(_0x56e7('0x8'));var client=jayson[_0x56e7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b253a,_0x205bb0,_0x1ea764){return new BPromise(function(_0xb29f58,_0x1e09ac){return client[_0x56e7('0xa')](_0x3b253a,_0x1ea764)['then'](function(_0x5e3591){logger[_0x56e7('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x205bb0,_0x56e7('0xc'));logger[_0x56e7('0xd')](_0x56e7('0xe'),_0x205bb0,_0x56e7('0xc'),JSON[_0x56e7('0xf')](_0x5e3591));if(_0x5e3591[_0x56e7('0x10')]){if(_0x5e3591[_0x56e7('0x10')][_0x56e7('0x11')]===0x1f4){logger[_0x56e7('0x10')](_0x56e7('0x12'),_0x205bb0,_0x5e3591['error'][_0x56e7('0x13')]);return _0x1e09ac(_0x5e3591[_0x56e7('0x10')]['message']);}logger[_0x56e7('0x10')](_0x56e7('0x12'),_0x205bb0,_0x5e3591[_0x56e7('0x10')][_0x56e7('0x13')]);return _0xb29f58(_0x5e3591['error']['message']);}else{logger[_0x56e7('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x205bb0,_0x56e7('0xc'));_0xb29f58(_0x5e3591[_0x56e7('0x14')]['message']);}})['catch'](function(_0x4e1a6d){logger[_0x56e7('0x10')](_0x56e7('0x12'),_0x205bb0,_0x4e1a6d);_0x1e09ac(_0x4e1a6d);});});} \ No newline at end of file +var _0x7d02=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x3c2a60,_0x2ea767){var _0x2ea5d3=function(_0x5c6739){while(--_0x5c6739){_0x3c2a60['push'](_0x3c2a60['shift']());}};_0x2ea5d3(++_0x2ea767);}(_0x7d02,0xe0));var _0x27d0=function(_0x268e40,_0x1a77ac){_0x268e40=_0x268e40-0x0;var _0x4a6376=_0x7d02[_0x268e40];return _0x4a6376;};'use strict';var _=require(_0x27d0('0x0'));var util=require(_0x27d0('0x1'));var moment=require(_0x27d0('0x2'));var BPromise=require(_0x27d0('0x3'));var rs=require(_0x27d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x27d0('0x5'));var logger=require(_0x27d0('0x6'))(_0x27d0('0x7'));var config=require(_0x27d0('0x8'));var jayson=require(_0x27d0('0x9'));var client=jayson['client'][_0x27d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35448e,_0x325a3d,_0x2a4f13){return new BPromise(function(_0x49474b,_0x10731c){return client[_0x27d0('0xb')](_0x35448e,_0x2a4f13)[_0x27d0('0xc')](function(_0x36d12c){logger[_0x27d0('0xd')](_0x27d0('0xe'),_0x325a3d,'request\x20sent');logger[_0x27d0('0xf')](_0x27d0('0x10'),_0x325a3d,'request\x20sent',JSON['stringify'](_0x36d12c));if(_0x36d12c[_0x27d0('0x11')]){if(_0x36d12c[_0x27d0('0x11')][_0x27d0('0x12')]===0x1f4){logger[_0x27d0('0x11')](_0x27d0('0xe'),_0x325a3d,_0x36d12c['error'][_0x27d0('0x13')]);return _0x10731c(_0x36d12c['error'][_0x27d0('0x13')]);}logger[_0x27d0('0x11')](_0x27d0('0xe'),_0x325a3d,_0x36d12c[_0x27d0('0x11')][_0x27d0('0x13')]);return _0x49474b(_0x36d12c['error']['message']);}else{logger['info'](_0x27d0('0xe'),_0x325a3d,_0x27d0('0x14'));_0x49474b(_0x36d12c[_0x27d0('0x15')][_0x27d0('0x13')]);}})[_0x27d0('0x16')](function(_0x3b01f5){logger[_0x27d0('0x11')](_0x27d0('0xe'),_0x325a3d,_0x3b01f5);_0x10731c(_0x3b01f5);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d96efbe..ec2fa6f 100644 --- a/server/api/jscriptyProject/index.js +++ b/server/api/jscriptyProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ad=['exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','/:id','/:id/sessions','isAuthenticated','/:id/answers','getAnswers','getSummary','post','create','clone','put','update','delete','destroy'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x24ad,0xfe));var _0xd24a=function(_0x34bb8f,_0x139ef5){_0x34bb8f=_0x34bb8f-0x0;var _0x196994=_0x24ad[_0x34bb8f];return _0x196994;};'use strict';var multer=require(_0xd24a('0x0'));var util=require('util');var path=require(_0xd24a('0x1'));var timeout=require('connect-timeout');var express=require(_0xd24a('0x2'));var router=express['Router']();var fs_extra=require(_0xd24a('0x3'));var auth=require(_0xd24a('0x4'));var interaction=require(_0xd24a('0x5'));var config=require('../../config/environment');var controller=require(_0xd24a('0x6'));router[_0xd24a('0x7')]('/',auth['isAuthenticated'](),controller[_0xd24a('0x8')]);router[_0xd24a('0x7')](_0xd24a('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xd24a('0x7')](_0xd24a('0xa'),auth[_0xd24a('0xb')](),controller['getSessions']);router[_0xd24a('0x7')](_0xd24a('0xc'),auth['isAuthenticated'](),controller[_0xd24a('0xd')]);router[_0xd24a('0x7')]('/:id/summary',auth[_0xd24a('0xb')](),timeout('30s'),controller[_0xd24a('0xe')]);router[_0xd24a('0xf')]('/',auth['isAuthenticated'](),controller[_0xd24a('0x10')]);router[_0xd24a('0xf')]('/:id/clone',auth[_0xd24a('0xb')](),controller[_0xd24a('0x11')]);router[_0xd24a('0x12')](_0xd24a('0x9'),auth[_0xd24a('0xb')](),controller[_0xd24a('0x13')]);router[_0xd24a('0x14')]('/:id',auth[_0xd24a('0xb')](),controller[_0xd24a('0x15')]);module[_0xd24a('0x16')]=router; \ No newline at end of file +var _0x3f40=['getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','clone','delete','destroy','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions'];(function(_0x467889,_0x3a7a4a){var _0x3f828e=function(_0x4b5890){while(--_0x4b5890){_0x467889['push'](_0x467889['shift']());}};_0x3f828e(++_0x3a7a4a);}(_0x3f40,0xcb));var _0x03f4=function(_0x3c1ec0,_0x1f5108){_0x3c1ec0=_0x3c1ec0-0x0;var _0x216225=_0x3f40[_0x3c1ec0];return _0x216225;};'use strict';var multer=require(_0x03f4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x03f4('0x1'));var express=require(_0x03f4('0x2'));var router=express[_0x03f4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x03f4('0x4'));var config=require(_0x03f4('0x5'));var controller=require(_0x03f4('0x6'));router['get']('/',auth[_0x03f4('0x7')](),controller[_0x03f4('0x8')]);router[_0x03f4('0x9')](_0x03f4('0xa'),auth['isAuthenticated'](),controller[_0x03f4('0xb')]);router[_0x03f4('0x9')](_0x03f4('0xc'),auth[_0x03f4('0x7')](),controller[_0x03f4('0xd')]);router[_0x03f4('0x9')](_0x03f4('0xe'),auth['isAuthenticated'](),controller[_0x03f4('0xf')]);router[_0x03f4('0x9')](_0x03f4('0x10'),auth[_0x03f4('0x7')](),timeout('30s'),controller[_0x03f4('0x11')]);router[_0x03f4('0x12')]('/',auth[_0x03f4('0x7')](),controller[_0x03f4('0x13')]);router[_0x03f4('0x12')](_0x03f4('0x14'),auth['isAuthenticated'](),controller[_0x03f4('0x15')]);router['put']('/:id',auth[_0x03f4('0x7')](),controller['update']);router[_0x03f4('0x16')](_0x03f4('0xa'),auth[_0x03f4('0x7')](),controller[_0x03f4('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index af4879c..1243ff5 100644 --- a/server/api/jscriptyProject/jscriptyProject.attributes.js +++ b/server/api/jscriptyProject/jscriptyProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd714=['STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xd714,0x8c));var _0x4d71=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0xd714[_0x37ffea];return _0x2e2615;};'use strict';var Sequelize=require(_0x4d71('0x0'));var _=require(_0x4d71('0x1'));var util=require(_0x4d71('0x2'));module[_0x4d71('0x3')]={'name':{'type':Sequelize[_0x4d71('0x4')],'unique':_0x4d71('0x5')},'description':{'type':Sequelize[_0x4d71('0x4')]},'formData':{'type':Sequelize[_0x4d71('0x6')](_0x4d71('0x7')),'set':function(_0x475664){if(_[_0x4d71('0x8')](_0x475664)){this[_0x4d71('0x9')](_0x4d71('0xa'),JSON[_0x4d71('0xb')](_0x475664));}else if(_['isString'](_0x475664)){this['setDataValue'](_0x4d71('0xa'),_0x475664);}else{this[_0x4d71('0x9')](_0x4d71('0xa'),util['format'](_0x4d71('0xc'),this[_0x4d71('0xd')]('name')||'',this['getDataValue'](_0x4d71('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4d71('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xde8f=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','name','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString'];(function(_0x1c5793,_0x2027ee){var _0x561815=function(_0x3079e){while(--_0x3079e){_0x1c5793['push'](_0x1c5793['shift']());}};_0x561815(++_0x2027ee);}(_0xde8f,0x1eb));var _0xfde8=function(_0x1528cf,_0x27ef21){_0x1528cf=_0x1528cf-0x0;var _0x249f28=_0xde8f[_0x1528cf];return _0x249f28;};'use strict';var Sequelize=require(_0xfde8('0x0'));var _=require(_0xfde8('0x1'));var util=require(_0xfde8('0x2'));module[_0xfde8('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0xfde8('0x4')},'description':{'type':Sequelize[_0xfde8('0x5')]},'formData':{'type':Sequelize[_0xfde8('0x6')](_0xfde8('0x7')),'set':function(_0x2ab481){if(_[_0xfde8('0x8')](_0x2ab481)){this[_0xfde8('0x9')](_0xfde8('0xa'),JSON[_0xfde8('0xb')](_0x2ab481));}else if(_[_0xfde8('0xc')](_0x2ab481)){this[_0xfde8('0x9')](_0xfde8('0xa'),_0x2ab481);}else{this[_0xfde8('0x9')](_0xfde8('0xa'),util[_0xfde8('0xd')](_0xfde8('0xe'),this[_0xfde8('0xf')](_0xfde8('0x4'))||'',this[_0xfde8('0xf')](_0xfde8('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xfde8('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfde8('0x11')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d415f19..3889027 100644 --- a/server/api/jscriptyProject/jscriptyProject.controller.js +++ b/server/api/jscriptyProject/jscriptyProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaebd=['indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','setHeader','Content-disposition','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Projects','destroy','stack','name','send','map','JscriptyProject','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','keys','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','role','userProfileId','UserProfileResource','params','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','findAll','number','toString'];(function(_0x4e6227,_0x5508e1){var _0x23b9bc=function(_0xe93b0d){while(--_0xe93b0d){_0x4e6227['push'](_0x4e6227['shift']());}};_0x23b9bc(++_0x5508e1);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x1daa3f,_0x5c2d6a){_0x1daa3f=_0x1daa3f-0x0;var _0x389b67=_0xaebd[_0x1daa3f];return _0x389b67;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){var _0x398616=_0x254c3b[_0xdaeb('0x24')]({'plain':!![]});var _0x3b0770=_0xdaeb('0x25');return db['UserProfileResource'][_0xdaeb('0x26')]({'where':{'type':_0x3b0770,'resourceId':_0x398616['id']}})[_0xdaeb('0x23')](function(){return _0x254c3b;});})[_0xdaeb('0x23')](function(){_0x39dfae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43095f,_0x4e7f44){return function(_0x5045f8){if(!_0x5045f8){_0x43095f[_0xdaeb('0x15')](0x194);}return _0x5045f8;};}function handleError(_0x1ff9af,_0x3e2b8c){_0x3e2b8c=_0x3e2b8c||0x1f4;return function(_0x5eb7b5){logger['error'](_0x5eb7b5[_0xdaeb('0x27')]);if(_0x5eb7b5[_0xdaeb('0x28')]){delete _0x5eb7b5[_0xdaeb('0x28')];}_0x1ff9af['status'](_0x3e2b8c)[_0xdaeb('0x29')](_0x5eb7b5);};}exports['index']=function(_0x4da82d,_0x28812c){var _0x21f6cf={},_0x2fb019={},_0x28c15c={'count':0x0,'rows':[]};var _0x3276c2=_[_0xdaeb('0x2a')](db[_0xdaeb('0x2b')]['rawAttributes'],function(_0x1c1c7c){return{'name':_0x1c1c7c[_0xdaeb('0x2c')],'type':_0x1c1c7c[_0xdaeb('0x2d')][_0xdaeb('0x2e')]};});_0x2fb019[_0xdaeb('0x2f')]=_['map'](_0x3276c2,_0xdaeb('0x28'));_0x2fb019[_0xdaeb('0x30')]=_['keys'](_0x4da82d[_0xdaeb('0x30')]);_0x2fb019[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],_0x2fb019[_0xdaeb('0x30')]);_0x21f6cf[_0xdaeb('0x33')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x4da82d[_0xdaeb('0x30')]['fields']));_0x21f6cf['attributes']=_0x21f6cf[_0xdaeb('0x33')]['length']?_0x21f6cf[_0xdaeb('0x33')]:_0x2fb019[_0xdaeb('0x2f')];if(!_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x35')](_0xdaeb('0x36'))){_0x21f6cf[_0xdaeb('0x1c')]=qs['limit'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0x21f6cf[_0xdaeb('0x1b')]=qs['offset'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1b')]);}_0x21f6cf[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x21f6cf[_0xdaeb('0x39')]=qs['filters'](_[_0xdaeb('0x3a')](_0x4da82d[_0xdaeb('0x30')],_0x2fb019['filters']),_0x3276c2);if(_0x4da82d['query'][_0xdaeb('0x3b')]){_0x21f6cf[_0xdaeb('0x39')]=_['merge'](_0x21f6cf[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x2a')](_0x3276c2,function(_0x5a4de2){if(_0x5a4de2[_0xdaeb('0x2d')]!==_0xdaeb('0x3c')){var _0x4ecba7={};_0x4ecba7[_0x5a4de2['name']]={'$like':'%'+_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x4ecba7;}})});}_0x21f6cf=_[_0xdaeb('0x3d')]({},_0x21f6cf,_0x4da82d[_0xdaeb('0x3e')]);var _0x2ea883={'where':_0x21f6cf[_0xdaeb('0x39')]};return db['JscriptyProject'][_0xdaeb('0x1a')](_0x2ea883)['then'](function(_0x46aa44){_0x28c15c['count']=_0x46aa44;if(_0x4da82d['query'][_0xdaeb('0x3f')]){_0x21f6cf['include']=[{'all':!![]}];}return db[_0xdaeb('0x2b')]['findAll'](_0x21f6cf);})[_0xdaeb('0x23')](function(_0x244369){_0x28c15c[_0xdaeb('0x40')]=_0x244369;return _0x28c15c;})[_0xdaeb('0x23')](respondWithFilteredResult(_0x28812c,_0x21f6cf))['catch'](handleError(_0x28812c,null));};exports[_0xdaeb('0x41')]=function(_0x5a4b41,_0x3cc6a4){var _0xfb250e={'raw':![],'where':{'id':_0x5a4b41['params']['id']}},_0x447ef0={};_0x447ef0[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x2b')][_0xdaeb('0x43')]);_0x447ef0[_0xdaeb('0x30')]=_[_0xdaeb('0x42')](_0x5a4b41[_0xdaeb('0x30')]);_0x447ef0[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x447ef0[_0xdaeb('0x2f')],_0x447ef0[_0xdaeb('0x30')]);_0xfb250e[_0xdaeb('0x33')]=_['intersection'](_0x447ef0[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x5a4b41['query']['fields']));_0xfb250e[_0xdaeb('0x33')]=_0xfb250e[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0xfb250e['attributes']:_0x447ef0[_0xdaeb('0x2f')];if(_0x5a4b41[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0xfb250e[_0xdaeb('0x45')]=[{'all':!![]}];}_0xfb250e=_[_0xdaeb('0x3d')]({},_0xfb250e,_0x5a4b41[_0xdaeb('0x3e')]);return db[_0xdaeb('0x2b')][_0xdaeb('0x46')](_0xfb250e)['then'](handleEntityNotFound(_0x3cc6a4,null))[_0xdaeb('0x23')](respondWithResult(_0x3cc6a4,null))[_0xdaeb('0x47')](handleError(_0x3cc6a4,null));};exports['create']=function(_0x38d2ee,_0x4dd70c){return db[_0xdaeb('0x2b')][_0xdaeb('0x48')](_0x38d2ee[_0xdaeb('0x49')],{})[_0xdaeb('0x23')](function(_0x5df403){var _0x449f64=_0x38d2ee[_0xdaeb('0x4a')][_0xdaeb('0x24')]({'plain':!![]});if(!_0x449f64)throw new Error(_0xdaeb('0x4b'));if(_0x449f64['role']==='user'){var _0x1403c8=_0x5df403[_0xdaeb('0x24')]({'plain':!![]});var _0x311219=_0xdaeb('0x25');return db[_0xdaeb('0x4c')][_0xdaeb('0x46')]({'where':{'name':_0x311219,'userProfileId':_0x449f64['userProfileId']},'raw':!![]})[_0xdaeb('0x23')](function(_0x42af1a){if(_0x42af1a&&_0x42af1a[_0xdaeb('0x4d')]===0x0){return db['UserProfileResource'][_0xdaeb('0x48')]({'name':_0x1403c8['name'],'resourceId':_0x1403c8['id'],'type':_0x42af1a[_0xdaeb('0x28')],'sectionId':_0x42af1a['id']},{})[_0xdaeb('0x23')](function(){return _0x5df403;});}else{return _0x5df403;}})[_0xdaeb('0x47')](function(_0x395e2c){logger[_0xdaeb('0x4e')](_0xdaeb('0x4f'),_0x395e2c);throw _0x395e2c;});}return _0x5df403;})['then'](respondWithResult(_0x4dd70c,0xc9))['catch'](handleError(_0x4dd70c,null));};exports['clone']=function(_0x2260c5,_0x10287e){var _0x4dbcb5={'where':{'id':_0x2260c5['params']['id']}},_0x4faf72={};_0x4faf72[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x2b')][_0xdaeb('0x43')]);_0x4dbcb5[_0xdaeb('0x33')]=_['intersection'](_0x4faf72[_0xdaeb('0x2f')],qs['fields'](_0x2260c5[_0xdaeb('0x30')][_0xdaeb('0x34')]));_0x4dbcb5[_0xdaeb('0x33')]=_0x4dbcb5[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0x4dbcb5[_0xdaeb('0x33')]:_0x4faf72['model'];if(_0x2260c5['query'][_0xdaeb('0x3f')]){_0x4dbcb5['include']=[{'all':!![]}];}_0x4dbcb5=_[_0xdaeb('0x3d')]({},_0x4dbcb5,_0x2260c5[_0xdaeb('0x3e')]);return db[_0xdaeb('0x2b')]['find'](_0x4dbcb5)[_0xdaeb('0x23')](handleEntityNotFound(_0x10287e,null))[_0xdaeb('0x23')](function(_0x2432ef){if(_0x2432ef){var _0x1b8729=_0x2432ef[_0xdaeb('0x24')]({'plain':!![]});_0x1b8729=qs[_0xdaeb('0x50')](_0x1b8729,['id',_0xdaeb('0x51'),_0xdaeb('0x52')]);_0x2260c5[_0xdaeb('0x49')]=_['omit'](_0x2260c5[_0xdaeb('0x49')],['id',_0xdaeb('0x51'),_0xdaeb('0x52')]);return db[_0xdaeb('0x2b')]['create'](_['merge'](_0x1b8729,_0x2260c5[_0xdaeb('0x49')]),{'include':_0x2260c5[_0xdaeb('0x30')][_0xdaeb('0x3f')]?[{'all':!![]}]:undefined})[_0xdaeb('0x23')](function(_0x4c734e){var _0x3147ec=_0x2260c5['user'][_0xdaeb('0x24')]({'plain':!![]});if(!_0x3147ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3147ec[_0xdaeb('0x53')]==='user'){var _0x240701=_0x4c734e[_0xdaeb('0x24')]({'plain':!![]});var _0x11d066=_0xdaeb('0x25');return db[_0xdaeb('0x4c')][_0xdaeb('0x46')]({'where':{'name':_0x11d066,'userProfileId':_0x3147ec[_0xdaeb('0x54')]},'raw':!![]})[_0xdaeb('0x23')](function(_0x40aec7){if(_0x40aec7&&_0x40aec7[_0xdaeb('0x4d')]===0x0){return db[_0xdaeb('0x55')][_0xdaeb('0x48')]({'name':_0x240701['name'],'resourceId':_0x240701['id'],'type':_0x40aec7[_0xdaeb('0x28')],'sectionId':_0x40aec7['id']},{})[_0xdaeb('0x23')](function(){return _0x4c734e;});}else{return _0x4c734e;}})['catch'](function(_0x469781){logger['error'](_0xdaeb('0x4f'),_0x469781);throw _0x469781;});}return _0x4c734e;});}})[_0xdaeb('0x23')](respondWithResult(_0x10287e,0xc9))['catch'](handleError(_0x10287e,null));};exports[_0xdaeb('0x22')]=function(_0x3f86f4,_0x22981f){if(_0x3f86f4[_0xdaeb('0x49')]['id']){delete _0x3f86f4[_0xdaeb('0x49')]['id'];}return db[_0xdaeb('0x2b')]['find']({'where':{'id':_0x3f86f4[_0xdaeb('0x56')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x22981f,null))[_0xdaeb('0x23')](saveUpdates(_0x3f86f4[_0xdaeb('0x49')],null))[_0xdaeb('0x23')](respondWithResult(_0x22981f,null))[_0xdaeb('0x47')](handleError(_0x22981f,null));};exports[_0xdaeb('0x26')]=function(_0x4dc2d0,_0x333954){return db[_0xdaeb('0x2b')][_0xdaeb('0x46')]({'where':{'id':_0x4dc2d0[_0xdaeb('0x56')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x333954,null))['then'](removeEntity(_0x333954,null))[_0xdaeb('0x47')](handleError(_0x333954,null));};exports[_0xdaeb('0x57')]=function(_0x29a06f,_0x2d4d57,_0x4e8b64){var _0xc0c7ad={'raw':!![],'where':{}};var _0x1e2e56={};var _0x3a7af9={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xdaeb('0x58')]({'where':{'id':_0x29a06f[_0xdaeb('0x56')]['id']}})['then'](handleEntityNotFound(_0x2d4d57,null))[_0xdaeb('0x23')](function(_0x36a54e){if(_0x36a54e){_0x1e2e56[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db['JscriptySessionReport'][_0xdaeb('0x43')]);_0x1e2e56['query']=_[_0xdaeb('0x42')](_0x29a06f[_0xdaeb('0x30')]);_0x1e2e56[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x1e2e56[_0xdaeb('0x2f')],_0x1e2e56[_0xdaeb('0x30')]);_0xc0c7ad[_0xdaeb('0x33')]=_[_0xdaeb('0x32')](_0x1e2e56['model'],qs[_0xdaeb('0x34')](_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x34')]));_0xc0c7ad[_0xdaeb('0x33')]=_0xc0c7ad[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0xc0c7ad[_0xdaeb('0x33')]:_0x1e2e56[_0xdaeb('0x2f')];if(!_0x29a06f['query']['hasOwnProperty'](_0xdaeb('0x36'))){_0xc0c7ad[_0xdaeb('0x1c')]=qs[_0xdaeb('0x1c')](_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0xc0c7ad[_0xdaeb('0x1b')]=qs['offset'](_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x1b')]);}_0xc0c7ad[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x29a06f[_0xdaeb('0x30')]['sort']);_0xc0c7ad['where']=qs[_0xdaeb('0x31')](_[_0xdaeb('0x3a')](_0x29a06f[_0xdaeb('0x30')],_0x1e2e56['filters']));_0xc0c7ad[_0xdaeb('0x39')][_0xdaeb('0x59')]=_0x36a54e['id'];if(_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x3b')]){_0xc0c7ad[_0xdaeb('0x39')]=_[_0xdaeb('0x3d')](_0xc0c7ad['where'],{'$or':_[_0xdaeb('0x2a')](_0xc0c7ad['attributes'],function(_0x3b41bb){var _0x34bbc2={};_0x34bbc2[_0x3b41bb]={'$like':'%'+_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x34bbc2;})});}_0xc0c7ad=_['merge']({},_0xc0c7ad,_0x29a06f[_0xdaeb('0x3e')]);return db[_0xdaeb('0x5a')][_0xdaeb('0x1a')]({'where':_0xc0c7ad['where']})[_0xdaeb('0x23')](function(_0x2ec82c){_0x3a7af9[_0xdaeb('0x1a')]=_0x2ec82c;if(_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0xc0c7ad['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xc0c7ad);})[_0xdaeb('0x23')](function(_0x590319){_0x3a7af9[_0xdaeb('0x40')]=_0x590319;return _0x3a7af9;});}})[_0xdaeb('0x23')](respondWithFilteredResult(_0x2d4d57,_0xc0c7ad))['catch'](handleError(_0x2d4d57,null));};exports[_0xdaeb('0x5b')]=function(_0x5ebfb8,_0x2a2b73,_0x40e630){var _0x7420cc={'raw':!![],'where':{}};var _0x33c455={};var _0x3f0162={'count':0x0,'rows':[]};return db[_0xdaeb('0x2b')]['findOne']({'where':{'id':_0x5ebfb8[_0xdaeb('0x56')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x2a2b73,null))[_0xdaeb('0x23')](function(_0x52c908){if(_0x52c908){_0x33c455[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x5c')]['rawAttributes']);_0x33c455[_0xdaeb('0x30')]=_['keys'](_0x5ebfb8[_0xdaeb('0x30')]);_0x33c455[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x33c455[_0xdaeb('0x2f')],_0x33c455['query']);_0x7420cc['attributes']=_[_0xdaeb('0x32')](_0x33c455[_0xdaeb('0x2f')],qs['fields'](_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x34')]));_0x7420cc[_0xdaeb('0x33')]=_0x7420cc[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0x7420cc[_0xdaeb('0x33')]:_0x33c455[_0xdaeb('0x2f')];if(!_0x5ebfb8[_0xdaeb('0x30')]['hasOwnProperty'](_0xdaeb('0x36'))){_0x7420cc[_0xdaeb('0x1c')]=qs[_0xdaeb('0x1c')](_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0x7420cc[_0xdaeb('0x1b')]=qs[_0xdaeb('0x1b')](_0x5ebfb8['query'][_0xdaeb('0x1b')]);}_0x7420cc[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x7420cc[_0xdaeb('0x39')]=qs['filters'](_[_0xdaeb('0x3a')](_0x5ebfb8[_0xdaeb('0x30')],_0x33c455['filters']));_0x7420cc['where'][_0xdaeb('0x59')]=_0x52c908['id'];if(_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x3b')]){_0x7420cc['where']=_[_0xdaeb('0x3d')](_0x7420cc[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x2a')](_0x7420cc[_0xdaeb('0x33')],function(_0x38171d){var _0x5774c1={};_0x5774c1[_0x38171d]={'$like':'%'+_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x5774c1;})});}_0x7420cc=_['merge']({},_0x7420cc,_0x5ebfb8[_0xdaeb('0x3e')]);return db[_0xdaeb('0x5c')]['count']({'where':_0x7420cc['where']})[_0xdaeb('0x23')](function(_0x1850a3){_0x3f0162[_0xdaeb('0x1a')]=_0x1850a3;if(_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0x7420cc[_0xdaeb('0x45')]=[{'all':!![]}];}return db[_0xdaeb('0x5c')][_0xdaeb('0x5d')](_0x7420cc);})[_0xdaeb('0x23')](function(_0x1c9ff7){_0x3f0162[_0xdaeb('0x40')]=_0x1c9ff7;return _0x3f0162;});}})[_0xdaeb('0x23')](respondWithFilteredResult(_0x2a2b73,_0x7420cc))['catch'](handleError(_0x2a2b73,null));};function char(_0x2d5152){return _0xdaeb('0x5e')===typeof _0x2d5152?String['fromCharCode']['apply'](null,arguments):_0x2d5152;}function needsEncapsulation(_0x332b3a){return!!_0x332b3a&&(_0x332b3a[_0xdaeb('0x5f')]()[_0xdaeb('0x60')](char(0xd))>=0x0||_0x332b3a[_0xdaeb('0x5f')]()['indexOf'](char(0xa))>=0x0||_0x332b3a[_0xdaeb('0x5f')]()[_0xdaeb('0x60')](char(0x2c))>=0x0||_0x332b3a[_0xdaeb('0x5f')]()[_0xdaeb('0x60')](char(0x22))>=0x0);}function encapsulate(_0x3c1237){var _0x5676d3=char(0x22),_0x52d225='\x5c'+char(0x22),_0x20cc70=_0x3c1237[_0xdaeb('0x5f')]()[_0xdaeb('0x61')](new RegExp(_0x5676d3,'g'),_0x52d225);return _0x5676d3+_0x20cc70+_0x5676d3;}exports[_0xdaeb('0x62')]=function(_0x2c56e2,_0x407c42,_0x440798){var _0x4a2a7d,_0x4ca39d;var _0x5f471c={'where':{'ProjectId':_0x2c56e2[_0xdaeb('0x56')]['id']}};if(_0x2c56e2['query'][_0xdaeb('0x63')]){_0x5f471c['where']['starttime']=JSON[_0xdaeb('0x64')](_0x2c56e2['query'][_0xdaeb('0x63')]);}return db[_0xdaeb('0x5a')][_0xdaeb('0x5d')](_0x5f471c)[_0xdaeb('0x23')](handleEntityNotFound(_0x407c42,null))[_0xdaeb('0x23')](function(_0x154187){if(_0x154187){_0x4a2a7d=_0x154187;return db[_0xdaeb('0x65')][_0xdaeb('0x5d')]({'where':{'SessionId':{'$in':_[_0xdaeb('0x2a')](_0x4a2a7d,'id')},'ProjectId':_0x2c56e2[_0xdaeb('0x56')]['id']},'order':_0xdaeb('0x66')});}})['then'](handleEntityNotFound(_0x407c42,null))[_0xdaeb('0x23')](function(_0x5cedea){if(_0x5cedea){_0x4ca39d=_0x5cedea;var _0x34ca2d={};for(var _0x5660c6=0x0,_0x5af1ef=_0x4ca39d[_0xdaeb('0x44')];_0x5660c6<_0x5af1ef;_0x5660c6++){if(!_0x34ca2d[_0xdaeb('0x35')](_0x4ca39d[_0x5660c6][_0xdaeb('0x67')])){_0x34ca2d[_0x4ca39d[_0x5660c6][_0xdaeb('0x67')]]=needsEncapsulation(_0x4ca39d[_0x5660c6][_0xdaeb('0x68')])?encapsulate(_0x4ca39d[_0x5660c6][_0xdaeb('0x68')]):_0x4ca39d[_0x5660c6][_0xdaeb('0x68')];}}var _0x393d47=[],_0x40c3c4={};for(var _0x264bc6=0x0,_0x2f8e60=_0x4a2a7d[_0xdaeb('0x44')];_0x264bc6<_0x2f8e60;_0x264bc6++){_0x40c3c4={'ProjectId':_0x2c56e2[_0xdaeb('0x56')]['id'],'SessionId':_0x4a2a7d[_0x264bc6]['id'],'StartTime':moment(_0x4a2a7d[_0x264bc6][_0xdaeb('0x69')])[_0xdaeb('0x6a')](_0xdaeb('0x6b'))};for(var _0x13b074=0x0,_0x1f8666=_0x4ca39d['length'];_0x13b074<_0x1f8666;_0x13b074++){if(_0x4ca39d[_0x13b074][_0xdaeb('0x6c')]==_0x4a2a7d[_0x264bc6]['id']&&_0x34ca2d[_0xdaeb('0x35')](_0x4ca39d[_0x13b074][_0xdaeb('0x67')])){_0x40c3c4[_0x34ca2d[_0x4ca39d[_0x13b074]['questionId']]]=_0x4ca39d[_0x13b074][_0xdaeb('0x6d')];}}for(var _0x504dc3 in _0x34ca2d){if(!_0x40c3c4[_0xdaeb('0x35')](_0x34ca2d[_0x504dc3])){_0x40c3c4[_0x34ca2d[_0x504dc3]]=null;}}_0x393d47['push'](_0x40c3c4);}return _0x393d47;}})[_0xdaeb('0x23')](function(_0x397580){if(!_['isEmpty'](_0x397580)){var _0x450e95=toCsv(_0x397580);var _0x4ce598=Date[_0xdaeb('0x6e')]();fs['writeFileSync'](util[_0xdaeb('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2c56e2[_0xdaeb('0x56')]['id'],_0x4ce598),_0x450e95);_0x407c42[_0xdaeb('0x6f')](_0xdaeb('0x70'),'attachment;\x20filename='+util[_0xdaeb('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x2c56e2[_0xdaeb('0x56')]['id'],_0x4ce598));_0x407c42[_0xdaeb('0x6f')](_0xdaeb('0x71'),_0xdaeb('0x72'));return _0x407c42[_0xdaeb('0x73')](util['format'](_0xdaeb('0x74'),_0x2c56e2[_0xdaeb('0x56')]['id'],_0x4ce598));}else{return _0x407c42[_0xdaeb('0x15')](0xcc);}})['catch'](handleError(_0x407c42,null));}; \ No newline at end of file +var _0x38c1=['question','format','SessionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','Projects','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','JscriptyProject','findAll','rows','catch','show','rawAttributes','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','getSessions','findOne','JscriptySessionReport','order','getAnswers','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x38c1,0x7f));var _0x138c=function(_0x54c42d,_0x23975d){_0x54c42d=_0x54c42d-0x0;var _0x16d161=_0x38c1[_0x54c42d];return _0x16d161;};'use strict';var emlformat=require(_0x138c('0x0'));var rimraf=require(_0x138c('0x1'));var zipdir=require(_0x138c('0x2'));var jsonpatch=require(_0x138c('0x3'));var rp=require(_0x138c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x138c('0x5'));var util=require(_0x138c('0x6'));var path=require(_0x138c('0x7'));var sox=require(_0x138c('0x8'));var csv=require(_0x138c('0x9'));var ejs=require(_0x138c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x138c('0xb'));var squel=require(_0x138c('0xc'));var crypto=require(_0x138c('0xd'));var jsforce=require(_0x138c('0xe'));var deskjs=require(_0x138c('0xf'));var toCsv=require(_0x138c('0x9'));var querystring=require(_0x138c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x138c('0x11'));var qs=require(_0x138c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x138c('0x13'))('api');var utils=require(_0x138c('0x14'));var config=require(_0x138c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x138c('0x16'))['db'];function respondWithStatusCode(_0x11f8b5,_0x518468){_0x518468=_0x518468||0xcc;return function(_0x2da971){if(_0x2da971){return _0x11f8b5[_0x138c('0x17')](_0x518468);}return _0x11f8b5[_0x138c('0x18')](_0x518468)[_0x138c('0x19')]();};}function respondWithResult(_0x5313c6,_0xf42e9b){_0xf42e9b=_0xf42e9b||0xc8;return function(_0x28896a){if(_0x28896a){return _0x5313c6[_0x138c('0x18')](_0xf42e9b)['json'](_0x28896a);}};}function respondWithFilteredResult(_0x2a4ae3,_0x1a3560){return function(_0x2ab6ae){if(_0x2ab6ae){var _0x2b2fd8=typeof _0x1a3560[_0x138c('0x1a')]===_0x138c('0x1b')&&typeof _0x1a3560['limit']===_0x138c('0x1b');var _0x15a778=_0x2ab6ae[_0x138c('0x1c')];var _0x1a7bdf=_0x2b2fd8?0x0:_0x1a3560[_0x138c('0x1a')];var _0x393f2a=_0x2b2fd8?_0x2ab6ae['count']:_0x1a3560[_0x138c('0x1a')]+_0x1a3560[_0x138c('0x1d')];var _0x351f5e;if(_0x393f2a>=_0x15a778){_0x393f2a=_0x15a778;_0x351f5e=0xc8;}else{_0x351f5e=0xce;}_0x2a4ae3[_0x138c('0x18')](_0x351f5e);return _0x2a4ae3[_0x138c('0x1e')](_0x138c('0x1f'),_0x1a7bdf+'-'+_0x393f2a+'/'+_0x15a778)[_0x138c('0x20')](_0x2ab6ae);}return null;};}function patchUpdates(_0x156738){return function(_0xb4b501){try{jsonpatch[_0x138c('0x21')](_0xb4b501,_0x156738,!![]);}catch(_0x4a4741){return BPromise[_0x138c('0x22')](_0x4a4741);}return _0xb4b501['save']();};}function saveUpdates(_0x9225f6,_0x5db8e0){return function(_0x5a93df){if(_0x5a93df){return _0x5a93df[_0x138c('0x23')](_0x9225f6)['then'](function(_0x377acc){return _0x377acc;});}return null;};}function removeEntity(_0x114df4,_0x2aa302){return function(_0x14ad50){if(_0x14ad50){return _0x14ad50[_0x138c('0x24')]()[_0x138c('0x25')](function(){var _0xd6cc72=_0x14ad50[_0x138c('0x26')]({'plain':!![]});var _0x1fb283=_0x138c('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x1fb283,'resourceId':_0xd6cc72['id']}})[_0x138c('0x25')](function(){return _0x14ad50;});})[_0x138c('0x25')](function(){_0x114df4[_0x138c('0x18')](0xcc)[_0x138c('0x19')]();});}};}function handleEntityNotFound(_0x3185c9,_0x6db084){return function(_0x5da206){if(!_0x5da206){_0x3185c9[_0x138c('0x17')](0x194);}return _0x5da206;};}function handleError(_0x3fbce2,_0xe2a39e){_0xe2a39e=_0xe2a39e||0x1f4;return function(_0x12e446){logger[_0x138c('0x28')](_0x12e446['stack']);if(_0x12e446[_0x138c('0x29')]){delete _0x12e446[_0x138c('0x29')];}_0x3fbce2[_0x138c('0x18')](_0xe2a39e)[_0x138c('0x2a')](_0x12e446);};}exports['index']=function(_0x24818b,_0x4e5244){var _0x4b6d85={},_0x329d1b={},_0x54480e={'count':0x0,'rows':[]};var _0xd27648=_[_0x138c('0x2b')](db['JscriptyProject']['rawAttributes'],function(_0x38d29b){return{'name':_0x38d29b[_0x138c('0x2c')],'type':_0x38d29b[_0x138c('0x2d')][_0x138c('0x2e')]};});_0x329d1b[_0x138c('0x2f')]=_[_0x138c('0x2b')](_0xd27648,_0x138c('0x29'));_0x329d1b[_0x138c('0x30')]=_[_0x138c('0x31')](_0x24818b[_0x138c('0x30')]);_0x329d1b[_0x138c('0x32')]=_[_0x138c('0x33')](_0x329d1b[_0x138c('0x2f')],_0x329d1b[_0x138c('0x30')]);_0x4b6d85['attributes']=_[_0x138c('0x33')](_0x329d1b['model'],qs['fields'](_0x24818b[_0x138c('0x30')][_0x138c('0x34')]));_0x4b6d85['attributes']=_0x4b6d85[_0x138c('0x35')][_0x138c('0x36')]?_0x4b6d85[_0x138c('0x35')]:_0x329d1b[_0x138c('0x2f')];if(!_0x24818b[_0x138c('0x30')][_0x138c('0x37')](_0x138c('0x38'))){_0x4b6d85['limit']=qs[_0x138c('0x1d')](_0x24818b[_0x138c('0x30')][_0x138c('0x1d')]);_0x4b6d85[_0x138c('0x1a')]=qs[_0x138c('0x1a')](_0x24818b[_0x138c('0x30')][_0x138c('0x1a')]);}_0x4b6d85['order']=qs[_0x138c('0x39')](_0x24818b[_0x138c('0x30')]['sort']);_0x4b6d85['where']=qs['filters'](_[_0x138c('0x3a')](_0x24818b['query'],_0x329d1b['filters']),_0xd27648);if(_0x24818b[_0x138c('0x30')][_0x138c('0x3b')]){_0x4b6d85['where']=_[_0x138c('0x3c')](_0x4b6d85[_0x138c('0x3d')],{'$or':_['map'](_0xd27648,function(_0x380c7f){if(_0x380c7f['type']!==_0x138c('0x3e')){var _0x14b377={};_0x14b377[_0x380c7f[_0x138c('0x29')]]={'$like':'%'+_0x24818b[_0x138c('0x30')][_0x138c('0x3b')]+'%'};return _0x14b377;}})});}_0x4b6d85=_[_0x138c('0x3c')]({},_0x4b6d85,_0x24818b[_0x138c('0x3f')]);var _0x5ab18f={'where':_0x4b6d85[_0x138c('0x3d')]};return db['JscriptyProject']['count'](_0x5ab18f)['then'](function(_0x59f013){_0x54480e[_0x138c('0x1c')]=_0x59f013;if(_0x24818b[_0x138c('0x30')][_0x138c('0x40')]){_0x4b6d85[_0x138c('0x41')]=[{'all':!![]}];}return db[_0x138c('0x42')][_0x138c('0x43')](_0x4b6d85);})[_0x138c('0x25')](function(_0x120e68){_0x54480e[_0x138c('0x44')]=_0x120e68;return _0x54480e;})[_0x138c('0x25')](respondWithFilteredResult(_0x4e5244,_0x4b6d85))[_0x138c('0x45')](handleError(_0x4e5244,null));};exports[_0x138c('0x46')]=function(_0x4bba77,_0x119a62){var _0x2b091a={'raw':![],'where':{'id':_0x4bba77['params']['id']}},_0x1f9a43={};_0x1f9a43[_0x138c('0x2f')]=_[_0x138c('0x31')](db[_0x138c('0x42')][_0x138c('0x47')]);_0x1f9a43[_0x138c('0x30')]=_[_0x138c('0x31')](_0x4bba77['query']);_0x1f9a43[_0x138c('0x32')]=_[_0x138c('0x33')](_0x1f9a43['model'],_0x1f9a43[_0x138c('0x30')]);_0x2b091a['attributes']=_[_0x138c('0x33')](_0x1f9a43[_0x138c('0x2f')],qs[_0x138c('0x34')](_0x4bba77[_0x138c('0x30')]['fields']));_0x2b091a[_0x138c('0x35')]=_0x2b091a[_0x138c('0x35')][_0x138c('0x36')]?_0x2b091a[_0x138c('0x35')]:_0x1f9a43[_0x138c('0x2f')];if(_0x4bba77[_0x138c('0x30')]['includeAll']){_0x2b091a[_0x138c('0x41')]=[{'all':!![]}];}_0x2b091a=_[_0x138c('0x3c')]({},_0x2b091a,_0x4bba77[_0x138c('0x3f')]);return db[_0x138c('0x42')]['find'](_0x2b091a)['then'](handleEntityNotFound(_0x119a62,null))['then'](respondWithResult(_0x119a62,null))[_0x138c('0x45')](handleError(_0x119a62,null));};exports[_0x138c('0x48')]=function(_0x2d701c,_0x3efd7d){return db['JscriptyProject']['create'](_0x2d701c[_0x138c('0x49')],{})[_0x138c('0x25')](function(_0x29765c){var _0x178c8e=_0x2d701c[_0x138c('0x4a')][_0x138c('0x26')]({'plain':!![]});if(!_0x178c8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x178c8e[_0x138c('0x4b')]==='user'){var _0xfa3a08=_0x29765c[_0x138c('0x26')]({'plain':!![]});var _0x31916b=_0x138c('0x27');return db[_0x138c('0x4c')]['find']({'where':{'name':_0x31916b,'userProfileId':_0x178c8e[_0x138c('0x4d')]},'raw':!![]})[_0x138c('0x25')](function(_0x21ab56){if(_0x21ab56&&_0x21ab56[_0x138c('0x4e')]===0x0){return db[_0x138c('0x4f')]['create']({'name':_0xfa3a08[_0x138c('0x29')],'resourceId':_0xfa3a08['id'],'type':_0x21ab56[_0x138c('0x29')],'sectionId':_0x21ab56['id']},{})['then'](function(){return _0x29765c;});}else{return _0x29765c;}})['catch'](function(_0x24997b){logger[_0x138c('0x28')](_0x138c('0x50'),_0x24997b);throw _0x24997b;});}return _0x29765c;})[_0x138c('0x25')](respondWithResult(_0x3efd7d,0xc9))['catch'](handleError(_0x3efd7d,null));};exports['clone']=function(_0x124399,_0x4202fb){var _0x4a2870={'where':{'id':_0x124399[_0x138c('0x51')]['id']}},_0x136fa2={};_0x136fa2[_0x138c('0x2f')]=_[_0x138c('0x31')](db[_0x138c('0x42')][_0x138c('0x47')]);_0x4a2870[_0x138c('0x35')]=_[_0x138c('0x33')](_0x136fa2[_0x138c('0x2f')],qs['fields'](_0x124399[_0x138c('0x30')][_0x138c('0x34')]));_0x4a2870[_0x138c('0x35')]=_0x4a2870['attributes'][_0x138c('0x36')]?_0x4a2870[_0x138c('0x35')]:_0x136fa2['model'];if(_0x124399[_0x138c('0x30')][_0x138c('0x40')]){_0x4a2870[_0x138c('0x41')]=[{'all':!![]}];}_0x4a2870=_[_0x138c('0x3c')]({},_0x4a2870,_0x124399[_0x138c('0x3f')]);return db[_0x138c('0x42')]['find'](_0x4a2870)[_0x138c('0x25')](handleEntityNotFound(_0x4202fb,null))[_0x138c('0x25')](function(_0x7d0ff5){if(_0x7d0ff5){var _0xba8150=_0x7d0ff5['get']({'plain':!![]});_0xba8150=qs[_0x138c('0x52')](_0xba8150,['id',_0x138c('0x53'),_0x138c('0x54')]);_0x124399[_0x138c('0x49')]=_[_0x138c('0x52')](_0x124399['body'],['id','createdAt',_0x138c('0x54')]);return db[_0x138c('0x42')][_0x138c('0x48')](_['merge'](_0xba8150,_0x124399[_0x138c('0x49')]),{'include':_0x124399[_0x138c('0x30')][_0x138c('0x40')]?[{'all':!![]}]:undefined})[_0x138c('0x25')](function(_0x202485){var _0x3f2f5a=_0x124399[_0x138c('0x4a')][_0x138c('0x26')]({'plain':!![]});if(!_0x3f2f5a)throw new Error(_0x138c('0x55'));if(_0x3f2f5a['role']===_0x138c('0x4a')){var _0x277702=_0x202485[_0x138c('0x26')]({'plain':!![]});var _0x3eab87=_0x138c('0x27');return db[_0x138c('0x4c')][_0x138c('0x56')]({'where':{'name':_0x3eab87,'userProfileId':_0x3f2f5a[_0x138c('0x4d')]},'raw':!![]})[_0x138c('0x25')](function(_0x181510){if(_0x181510&&_0x181510[_0x138c('0x4e')]===0x0){return db[_0x138c('0x4f')]['create']({'name':_0x277702[_0x138c('0x29')],'resourceId':_0x277702['id'],'type':_0x181510[_0x138c('0x29')],'sectionId':_0x181510['id']},{})['then'](function(){return _0x202485;});}else{return _0x202485;}})[_0x138c('0x45')](function(_0x1592c7){logger['error'](_0x138c('0x50'),_0x1592c7);throw _0x1592c7;});}return _0x202485;});}})[_0x138c('0x25')](respondWithResult(_0x4202fb,0xc9))[_0x138c('0x45')](handleError(_0x4202fb,null));};exports[_0x138c('0x23')]=function(_0x4dee2d,_0x569dfc){if(_0x4dee2d[_0x138c('0x49')]['id']){delete _0x4dee2d[_0x138c('0x49')]['id'];}return db[_0x138c('0x42')]['find']({'where':{'id':_0x4dee2d[_0x138c('0x51')]['id']}})['then'](handleEntityNotFound(_0x569dfc,null))[_0x138c('0x25')](saveUpdates(_0x4dee2d[_0x138c('0x49')],null))[_0x138c('0x25')](respondWithResult(_0x569dfc,null))[_0x138c('0x45')](handleError(_0x569dfc,null));};exports['destroy']=function(_0x3cbd85,_0x2dc53a){return db['JscriptyProject'][_0x138c('0x56')]({'where':{'id':_0x3cbd85[_0x138c('0x51')]['id']}})[_0x138c('0x25')](handleEntityNotFound(_0x2dc53a,null))[_0x138c('0x25')](removeEntity(_0x2dc53a,null))['catch'](handleError(_0x2dc53a,null));};exports[_0x138c('0x57')]=function(_0x2f4f00,_0x44457a,_0x1c88ed){var _0x5eca5a={'raw':!![],'where':{}};var _0x25488a={};var _0x57fa9e={'count':0x0,'rows':[]};return db[_0x138c('0x42')][_0x138c('0x58')]({'where':{'id':_0x2f4f00['params']['id']}})[_0x138c('0x25')](handleEntityNotFound(_0x44457a,null))['then'](function(_0x2bf923){if(_0x2bf923){_0x25488a[_0x138c('0x2f')]=_[_0x138c('0x31')](db[_0x138c('0x59')][_0x138c('0x47')]);_0x25488a['query']=_['keys'](_0x2f4f00[_0x138c('0x30')]);_0x25488a['filters']=_[_0x138c('0x33')](_0x25488a[_0x138c('0x2f')],_0x25488a['query']);_0x5eca5a[_0x138c('0x35')]=_['intersection'](_0x25488a[_0x138c('0x2f')],qs['fields'](_0x2f4f00['query']['fields']));_0x5eca5a[_0x138c('0x35')]=_0x5eca5a[_0x138c('0x35')]['length']?_0x5eca5a['attributes']:_0x25488a[_0x138c('0x2f')];if(!_0x2f4f00[_0x138c('0x30')][_0x138c('0x37')](_0x138c('0x38'))){_0x5eca5a[_0x138c('0x1d')]=qs[_0x138c('0x1d')](_0x2f4f00[_0x138c('0x30')][_0x138c('0x1d')]);_0x5eca5a[_0x138c('0x1a')]=qs[_0x138c('0x1a')](_0x2f4f00[_0x138c('0x30')][_0x138c('0x1a')]);}_0x5eca5a[_0x138c('0x5a')]=qs['sort'](_0x2f4f00[_0x138c('0x30')][_0x138c('0x39')]);_0x5eca5a['where']=qs[_0x138c('0x32')](_[_0x138c('0x3a')](_0x2f4f00[_0x138c('0x30')],_0x25488a[_0x138c('0x32')]));_0x5eca5a['where']['ProjectId']=_0x2bf923['id'];if(_0x2f4f00['query']['filter']){_0x5eca5a[_0x138c('0x3d')]=_[_0x138c('0x3c')](_0x5eca5a[_0x138c('0x3d')],{'$or':_[_0x138c('0x2b')](_0x5eca5a[_0x138c('0x35')],function(_0x888d){var _0x15704b={};_0x15704b[_0x888d]={'$like':'%'+_0x2f4f00[_0x138c('0x30')][_0x138c('0x3b')]+'%'};return _0x15704b;})});}_0x5eca5a=_['merge']({},_0x5eca5a,_0x2f4f00[_0x138c('0x3f')]);return db[_0x138c('0x59')][_0x138c('0x1c')]({'where':_0x5eca5a[_0x138c('0x3d')]})['then'](function(_0x5e6503){_0x57fa9e['count']=_0x5e6503;if(_0x2f4f00[_0x138c('0x30')][_0x138c('0x40')]){_0x5eca5a[_0x138c('0x41')]=[{'all':!![]}];}return db[_0x138c('0x59')][_0x138c('0x43')](_0x5eca5a);})[_0x138c('0x25')](function(_0x2632e6){_0x57fa9e[_0x138c('0x44')]=_0x2632e6;return _0x57fa9e;});}})[_0x138c('0x25')](respondWithFilteredResult(_0x44457a,_0x5eca5a))[_0x138c('0x45')](handleError(_0x44457a,null));};exports[_0x138c('0x5b')]=function(_0x5c5093,_0x5323c6,_0x132a75){var _0x12da58={'raw':!![],'where':{}};var _0x3f0d2d={};var _0x3ab285={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x5c5093[_0x138c('0x51')]['id']}})['then'](handleEntityNotFound(_0x5323c6,null))[_0x138c('0x25')](function(_0x32413e){if(_0x32413e){_0x3f0d2d[_0x138c('0x2f')]=_[_0x138c('0x31')](db[_0x138c('0x5c')][_0x138c('0x47')]);_0x3f0d2d[_0x138c('0x30')]=_[_0x138c('0x31')](_0x5c5093[_0x138c('0x30')]);_0x3f0d2d['filters']=_['intersection'](_0x3f0d2d[_0x138c('0x2f')],_0x3f0d2d[_0x138c('0x30')]);_0x12da58[_0x138c('0x35')]=_[_0x138c('0x33')](_0x3f0d2d[_0x138c('0x2f')],qs[_0x138c('0x34')](_0x5c5093['query']['fields']));_0x12da58[_0x138c('0x35')]=_0x12da58[_0x138c('0x35')][_0x138c('0x36')]?_0x12da58[_0x138c('0x35')]:_0x3f0d2d[_0x138c('0x2f')];if(!_0x5c5093[_0x138c('0x30')][_0x138c('0x37')](_0x138c('0x38'))){_0x12da58['limit']=qs['limit'](_0x5c5093[_0x138c('0x30')][_0x138c('0x1d')]);_0x12da58[_0x138c('0x1a')]=qs[_0x138c('0x1a')](_0x5c5093['query']['offset']);}_0x12da58[_0x138c('0x5a')]=qs['sort'](_0x5c5093[_0x138c('0x30')][_0x138c('0x39')]);_0x12da58['where']=qs[_0x138c('0x32')](_[_0x138c('0x3a')](_0x5c5093[_0x138c('0x30')],_0x3f0d2d[_0x138c('0x32')]));_0x12da58[_0x138c('0x3d')]['ProjectId']=_0x32413e['id'];if(_0x5c5093[_0x138c('0x30')][_0x138c('0x3b')]){_0x12da58[_0x138c('0x3d')]=_[_0x138c('0x3c')](_0x12da58[_0x138c('0x3d')],{'$or':_[_0x138c('0x2b')](_0x12da58[_0x138c('0x35')],function(_0x2ef7b6){var _0x462464={};_0x462464[_0x2ef7b6]={'$like':'%'+_0x5c5093[_0x138c('0x30')][_0x138c('0x3b')]+'%'};return _0x462464;})});}_0x12da58=_[_0x138c('0x3c')]({},_0x12da58,_0x5c5093[_0x138c('0x3f')]);return db[_0x138c('0x5c')]['count']({'where':_0x12da58[_0x138c('0x3d')]})[_0x138c('0x25')](function(_0x929e85){_0x3ab285[_0x138c('0x1c')]=_0x929e85;if(_0x5c5093[_0x138c('0x30')][_0x138c('0x40')]){_0x12da58[_0x138c('0x41')]=[{'all':!![]}];}return db[_0x138c('0x5c')][_0x138c('0x43')](_0x12da58);})[_0x138c('0x25')](function(_0x146961){_0x3ab285['rows']=_0x146961;return _0x3ab285;});}})[_0x138c('0x25')](respondWithFilteredResult(_0x5323c6,_0x12da58))[_0x138c('0x45')](handleError(_0x5323c6,null));};function char(_0x34f01){return _0x138c('0x5d')===typeof _0x34f01?String[_0x138c('0x5e')][_0x138c('0x21')](null,arguments):_0x34f01;}function needsEncapsulation(_0x5a7c52){return!!_0x5a7c52&&(_0x5a7c52['toString']()[_0x138c('0x5f')](char(0xd))>=0x0||_0x5a7c52[_0x138c('0x60')]()['indexOf'](char(0xa))>=0x0||_0x5a7c52[_0x138c('0x60')]()[_0x138c('0x5f')](char(0x2c))>=0x0||_0x5a7c52['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0xd3c404){var _0x2ea16f=char(0x22),_0x3b2491='\x5c'+char(0x22),_0x5bf4dc=_0xd3c404[_0x138c('0x60')]()[_0x138c('0x61')](new RegExp(_0x2ea16f,'g'),_0x3b2491);return _0x2ea16f+_0x5bf4dc+_0x2ea16f;}exports['getSummary']=function(_0x4a511d,_0x3d6be5,_0x71eb02){var _0x228038,_0x592d22;var _0x121703={'where':{'ProjectId':_0x4a511d['params']['id']}};if(_0x4a511d[_0x138c('0x30')][_0x138c('0x62')]){_0x121703[_0x138c('0x3d')][_0x138c('0x63')]=JSON['parse'](_0x4a511d['query'][_0x138c('0x62')]);}return db['JscriptySessionReport'][_0x138c('0x43')](_0x121703)[_0x138c('0x25')](handleEntityNotFound(_0x3d6be5,null))[_0x138c('0x25')](function(_0x3ee1fa){if(_0x3ee1fa){_0x228038=_0x3ee1fa;return db[_0x138c('0x64')][_0x138c('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x228038,'id')},'ProjectId':_0x4a511d['params']['id']},'order':_0x138c('0x65')});}})[_0x138c('0x25')](handleEntityNotFound(_0x3d6be5,null))[_0x138c('0x25')](function(_0x39ac57){if(_0x39ac57){_0x592d22=_0x39ac57;var _0x41f32e={};for(var _0x307c99=0x0,_0xb4e8ca=_0x592d22[_0x138c('0x36')];_0x307c99<_0xb4e8ca;_0x307c99++){if(!_0x41f32e[_0x138c('0x37')](_0x592d22[_0x307c99][_0x138c('0x66')])){_0x41f32e[_0x592d22[_0x307c99][_0x138c('0x66')]]=needsEncapsulation(_0x592d22[_0x307c99][_0x138c('0x67')])?encapsulate(_0x592d22[_0x307c99][_0x138c('0x67')]):_0x592d22[_0x307c99][_0x138c('0x67')];}}var _0x45848d=[],_0x39398f={};for(var _0x53f959=0x0,_0x4b9c1c=_0x228038[_0x138c('0x36')];_0x53f959<_0x4b9c1c;_0x53f959++){_0x39398f={'ProjectId':_0x4a511d[_0x138c('0x51')]['id'],'SessionId':_0x228038[_0x53f959]['id'],'StartTime':moment(_0x228038[_0x53f959][_0x138c('0x63')])[_0x138c('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x18f6cb=0x0,_0xa98b2b=_0x592d22['length'];_0x18f6cb<_0xa98b2b;_0x18f6cb++){if(_0x592d22[_0x18f6cb][_0x138c('0x69')]==_0x228038[_0x53f959]['id']&&_0x41f32e[_0x138c('0x37')](_0x592d22[_0x18f6cb]['questionId'])){_0x39398f[_0x41f32e[_0x592d22[_0x18f6cb][_0x138c('0x66')]]]=_0x592d22[_0x18f6cb][_0x138c('0x6a')];}}for(var _0x48edc1 in _0x41f32e){if(!_0x39398f['hasOwnProperty'](_0x41f32e[_0x48edc1])){_0x39398f[_0x41f32e[_0x48edc1]]=null;}}_0x45848d['push'](_0x39398f);}return _0x45848d;}})[_0x138c('0x25')](function(_0x246426){if(!_['isEmpty'](_0x246426)){var _0x28496f=toCsv(_0x246426);var _0x545328=Date[_0x138c('0x6b')]();fs[_0x138c('0x6c')](util[_0x138c('0x68')](_0x138c('0x6d'),_0x4a511d['params']['id'],_0x545328),_0x28496f);_0x3d6be5[_0x138c('0x6e')]('Content-disposition',_0x138c('0x6f')+util[_0x138c('0x68')]('Jscripty_Project_%d_Summary_%s.csv',_0x4a511d[_0x138c('0x51')]['id'],_0x545328));_0x3d6be5['setHeader'](_0x138c('0x70'),_0x138c('0x71'));return _0x3d6be5[_0x138c('0x72')](util[_0x138c('0x68')](_0x138c('0x6d'),_0x4a511d[_0x138c('0x51')]['id'],_0x545328));}else{return _0x3d6be5[_0x138c('0x17')](0xcc);}})[_0x138c('0x45')](handleError(_0x3d6be5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 11cd1cf..d8b13a5 100644 --- a/server/api/jscriptyProject/jscriptyProject.model.js +++ b/server/api/jscriptyProject/jscriptyProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf23b=['util','../../config/logger','api','moment','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define','lodash'];(function(_0x4b1c78,_0x3ddc23){var _0x4c2d9b=function(_0xcdf308){while(--_0xcdf308){_0x4b1c78['push'](_0x4b1c78['shift']());}};_0x4c2d9b(++_0x3ddc23);}(_0xf23b,0x133));var _0xbf23=function(_0xedfb41,_0x4dc5a9){_0xedfb41=_0xedfb41-0x0;var _0x492adc=_0xf23b[_0xedfb41];return _0x492adc;};'use strict';var _=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var logger=require(_0xbf23('0x2'))(_0xbf23('0x3'));var moment=require(_0xbf23('0x4'));var BPromise=require('bluebird');var rp=require(_0xbf23('0x5'));var fs=require('fs');var path=require(_0xbf23('0x6'));var rimraf=require(_0xbf23('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf23('0x8'));module[_0xbf23('0x9')]=function(_0xc5e7dd,_0x393a52){return _0xc5e7dd[_0xbf23('0xa')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33c5=['JscriptyProject','jscripty_projects','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x33c5,0xe6));var _0x533c=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x33c5[_0x4b1032];return _0x5a1d55;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var logger=require(_0x533c('0x1'))('api');var moment=require(_0x533c('0x2'));var BPromise=require(_0x533c('0x3'));var rp=require(_0x533c('0x4'));var fs=require('fs');var path=require(_0x533c('0x5'));var rimraf=require(_0x533c('0x6'));var config=require('../../config/environment');var attributes=require(_0x533c('0x7'));module[_0x533c('0x8')]=function(_0x31d912,_0x151732){return _0x31d912[_0x533c('0x9')](_0x533c('0xa'),attributes,{'tableName':_0x533c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 5c11dba..e687167 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x14f4f2,_0x1d36d7){var _0x6bc92b=function(_0x1bce2b){while(--_0x1bce2b){_0x14f4f2['push'](_0x14f4f2['shift']());}};_0x6bc92b(++_0x1d36d7);}(_0xe706,0xa3));var _0x6e70=function(_0x55555f,_0x505b88){_0x55555f=_0x55555f-0x0;var _0x208602=_0xe706[_0x55555f];return _0x208602;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xac4a,0x13f));var _0xaac4=function(_0x104619,_0x8e20e5){_0x104619=_0x104619-0x0;var _0x2afbde=_0xac4a[_0x104619];return _0x2afbde;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e10de96..ba6c94a 100644 --- a/server/api/jscriptyQuestionReport/index.js +++ b/server/api/jscriptyQuestionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcafe=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcafe,0x18f));var _0xecaf=function(_0x1e139e,_0x33c78f){_0x1e139e=_0x1e139e-0x0;var _0x26e52e=_0xcafe[_0x1e139e];return _0x26e52e;};'use strict';var multer=require(_0xecaf('0x0'));var util=require('util');var path=require(_0xecaf('0x1'));var timeout=require(_0xecaf('0x2'));var express=require(_0xecaf('0x3'));var router=express['Router']();var fs_extra=require(_0xecaf('0x4'));var auth=require(_0xecaf('0x5'));var interaction=require(_0xecaf('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xecaf('0x7')]('/',auth[_0xecaf('0x8')](),controller[_0xecaf('0x9')]);router[_0xecaf('0x7')](_0xecaf('0xa'),auth['isAuthenticated'](),controller[_0xecaf('0xb')]);router['get'](_0xecaf('0xc'),auth['isAuthenticated'](),controller[_0xecaf('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xecaf('0xe')]);router[_0xecaf('0xf')](_0xecaf('0xc'),auth['isAuthenticated'](),controller[_0xecaf('0x10')]);router[_0xecaf('0x11')](_0xecaf('0xc'),auth[_0xecaf('0x8')](),controller[_0xecaf('0x12')]);module[_0xecaf('0x13')]=router; \ No newline at end of file +var _0x87f4=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0x87f4,0x194));var _0x487f=function(_0x166146,_0x1f34c6){_0x166146=_0x166146-0x0;var _0x9c7390=_0x87f4[_0x166146];return _0x9c7390;};'use strict';var multer=require('multer');var util=require(_0x487f('0x0'));var path=require(_0x487f('0x1'));var timeout=require(_0x487f('0x2'));var express=require(_0x487f('0x3'));var router=express['Router']();var fs_extra=require(_0x487f('0x4'));var auth=require(_0x487f('0x5'));var interaction=require(_0x487f('0x6'));var config=require(_0x487f('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x487f('0x8')]('/',auth[_0x487f('0x9')](),controller[_0x487f('0xa')]);router['get'](_0x487f('0xb'),auth[_0x487f('0x9')](),controller[_0x487f('0xc')]);router['get'](_0x487f('0xd'),auth[_0x487f('0x9')](),controller[_0x487f('0xe')]);router['post']('/',auth[_0x487f('0x9')](),controller[_0x487f('0xf')]);router['put']('/:id',auth[_0x487f('0x9')](),controller[_0x487f('0x10')]);router[_0x487f('0x11')](_0x487f('0xd'),auth[_0x487f('0x9')](),controller[_0x487f('0x12')]);module[_0x487f('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 092a4be..9357ace 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7a54,0x106));var _0x47a5=function(_0x3a9420,_0x3992df){_0x3a9420=_0x3a9420-0x0;var _0xaec894=_0x7a54[_0x3a9420];return _0xaec894;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x2076e3,_0x4b1581){_0x2076e3=_0x2076e3-0x0;var _0x3fe6d3=_0x7a54[_0x2076e3];return _0x3fe6d3;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 1f01fc3..467a974 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd58e=['limit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','create','body','destroy','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','end','sendStatus','error','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','length','hasOwnProperty'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd58e,0xa6));var _0xed58=function(_0x354493,_0x56433a){_0x354493=_0x354493-0x0;var _0x1cddca=_0xd58e[_0x354493];return _0x1cddca;};'use strict';var emlformat=require(_0xed58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed58('0x1'));var jsonpatch=require(_0xed58('0x2'));var rp=require(_0xed58('0x3'));var moment=require(_0xed58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed58('0x5'));var util=require(_0xed58('0x6'));var path=require(_0xed58('0x7'));var sox=require('sox');var csv=require(_0xed58('0x8'));var ejs=require(_0xed58('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed58('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xed58('0xb'));var deskjs=require(_0xed58('0xc'));var toCsv=require(_0xed58('0x8'));var querystring=require(_0xed58('0xd'));var Papa=require(_0xed58('0xe'));var Redis=require(_0xed58('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xed58('0x10'))(_0xed58('0x11'));var utils=require('../../config/utils');var config=require(_0xed58('0x12'));var licenseUtil=require(_0xed58('0x13'));var db=require(_0xed58('0x14'))['db'];function respondWithStatusCode(_0x505240,_0x406036){_0x406036=_0x406036||0xcc;return function(_0x43e397){if(_0x43e397){return _0x505240['sendStatus'](_0x406036);}return _0x505240['status'](_0x406036)['end']();};}function respondWithResult(_0x3d19ac,_0x3f44b2){_0x3f44b2=_0x3f44b2||0xc8;return function(_0x4f0165){if(_0x4f0165){return _0x3d19ac[_0xed58('0x15')](_0x3f44b2)[_0xed58('0x16')](_0x4f0165);}};}function respondWithFilteredResult(_0x4544ed,_0x1c8431){return function(_0x22ab46){if(_0x22ab46){var _0x2e63a8=typeof _0x1c8431[_0xed58('0x17')]===_0xed58('0x18')&&typeof _0x1c8431['limit']===_0xed58('0x18');var _0x71cefc=_0x22ab46[_0xed58('0x19')];var _0x4e2d6b=_0x2e63a8?0x0:_0x1c8431[_0xed58('0x17')];var _0x5ccd86=_0x2e63a8?_0x22ab46[_0xed58('0x19')]:_0x1c8431[_0xed58('0x17')]+_0x1c8431['limit'];var _0x5309a2;if(_0x5ccd86>=_0x71cefc){_0x5ccd86=_0x71cefc;_0x5309a2=0xc8;}else{_0x5309a2=0xce;}_0x4544ed[_0xed58('0x15')](_0x5309a2);return _0x4544ed[_0xed58('0x1a')](_0xed58('0x1b'),_0x4e2d6b+'-'+_0x5ccd86+'/'+_0x71cefc)[_0xed58('0x16')](_0x22ab46);}return null;};}function patchUpdates(_0x43d1b5){return function(_0x25e4d7){try{jsonpatch['apply'](_0x25e4d7,_0x43d1b5,!![]);}catch(_0x5304fd){return BPromise[_0xed58('0x1c')](_0x5304fd);}return _0x25e4d7[_0xed58('0x1d')]();};}function saveUpdates(_0x2119e6,_0x222721){return function(_0x2f56e9){if(_0x2f56e9){return _0x2f56e9[_0xed58('0x1e')](_0x2119e6)[_0xed58('0x1f')](function(_0x492cec){return _0x492cec;});}return null;};}function removeEntity(_0x295d07,_0x3815c5){return function(_0x589530){if(_0x589530){return _0x589530['destroy']()[_0xed58('0x1f')](function(){_0x295d07[_0xed58('0x15')](0xcc)[_0xed58('0x20')]();});}};}function handleEntityNotFound(_0x12a916,_0x3b96d3){return function(_0x5a4447){if(!_0x5a4447){_0x12a916[_0xed58('0x21')](0x194);}return _0x5a4447;};}function handleError(_0x463cdf,_0xebcdbd){_0xebcdbd=_0xebcdbd||0x1f4;return function(_0x6abd8){logger[_0xed58('0x22')](_0x6abd8['stack']);if(_0x6abd8['name']){delete _0x6abd8[_0xed58('0x23')];}_0x463cdf[_0xed58('0x15')](_0xebcdbd)['send'](_0x6abd8);};}exports[_0xed58('0x24')]=function(_0x5eabe8,_0xbce9bd){var _0xe04075={},_0x2310b6={},_0x2809b3={'count':0x0,'rows':[]};var _0x240f7b=_[_0xed58('0x25')](db[_0xed58('0x26')][_0xed58('0x27')],function(_0x501c77){return{'name':_0x501c77[_0xed58('0x28')],'type':_0x501c77[_0xed58('0x29')][_0xed58('0x2a')]};});_0x2310b6['model']=_[_0xed58('0x25')](_0x240f7b,_0xed58('0x23'));_0x2310b6[_0xed58('0x2b')]=_[_0xed58('0x2c')](_0x5eabe8[_0xed58('0x2b')]);_0x2310b6['filters']=_['intersection'](_0x2310b6['model'],_0x2310b6[_0xed58('0x2b')]);_0xe04075[_0xed58('0x2d')]=_[_0xed58('0x2e')](_0x2310b6[_0xed58('0x2f')],qs['fields'](_0x5eabe8[_0xed58('0x2b')]['fields']));_0xe04075[_0xed58('0x2d')]=_0xe04075[_0xed58('0x2d')][_0xed58('0x30')]?_0xe04075[_0xed58('0x2d')]:_0x2310b6[_0xed58('0x2f')];if(!_0x5eabe8['query'][_0xed58('0x31')]('nolimit')){_0xe04075[_0xed58('0x32')]=qs[_0xed58('0x32')](_0x5eabe8['query']['limit']);_0xe04075[_0xed58('0x17')]=qs[_0xed58('0x17')](_0x5eabe8[_0xed58('0x2b')][_0xed58('0x17')]);}_0xe04075[_0xed58('0x33')]=qs['sort'](_0x5eabe8['query']['sort']);_0xe04075[_0xed58('0x34')]=qs[_0xed58('0x35')](_[_0xed58('0x36')](_0x5eabe8[_0xed58('0x2b')],_0x2310b6['filters']),_0x240f7b);if(_0x5eabe8[_0xed58('0x2b')][_0xed58('0x37')]){_0xe04075[_0xed58('0x34')]=_[_0xed58('0x38')](_0xe04075['where'],{'$or':_[_0xed58('0x25')](_0x240f7b,function(_0x1bd63c){if(_0x1bd63c[_0xed58('0x29')]!==_0xed58('0x39')){var _0x16f377={};_0x16f377[_0x1bd63c['name']]={'$like':'%'+_0x5eabe8['query'][_0xed58('0x37')]+'%'};return _0x16f377;}})});}_0xe04075=_['merge']({},_0xe04075,_0x5eabe8['options']);var _0x5bdbb6={'where':_0xe04075[_0xed58('0x34')]};return db[_0xed58('0x26')][_0xed58('0x19')](_0x5bdbb6)['then'](function(_0x1d04ba){_0x2809b3[_0xed58('0x19')]=_0x1d04ba;if(_0x5eabe8[_0xed58('0x2b')][_0xed58('0x3a')]){_0xe04075[_0xed58('0x3b')]=[{'all':!![]}];}return db[_0xed58('0x26')][_0xed58('0x3c')](_0xe04075);})[_0xed58('0x1f')](function(_0x50f65c){_0x2809b3[_0xed58('0x3d')]=_0x50f65c;return _0x2809b3;})[_0xed58('0x1f')](respondWithFilteredResult(_0xbce9bd,_0xe04075))[_0xed58('0x3e')](handleError(_0xbce9bd,null));};exports[_0xed58('0x3f')]=function(_0x3c8945,_0x356f3f){var _0x5df95f={'raw':!![],'where':{'id':_0x3c8945[_0xed58('0x40')]['id']}},_0x3abcbe={};_0x3abcbe[_0xed58('0x2f')]=_[_0xed58('0x2c')](db[_0xed58('0x26')]['rawAttributes']);_0x3abcbe[_0xed58('0x2b')]=_[_0xed58('0x2c')](_0x3c8945[_0xed58('0x2b')]);_0x3abcbe[_0xed58('0x35')]=_[_0xed58('0x2e')](_0x3abcbe['model'],_0x3abcbe[_0xed58('0x2b')]);_0x5df95f[_0xed58('0x2d')]=_[_0xed58('0x2e')](_0x3abcbe[_0xed58('0x2f')],qs[_0xed58('0x41')](_0x3c8945[_0xed58('0x2b')][_0xed58('0x41')]));_0x5df95f[_0xed58('0x2d')]=_0x5df95f[_0xed58('0x2d')][_0xed58('0x30')]?_0x5df95f[_0xed58('0x2d')]:_0x3abcbe[_0xed58('0x2f')];if(_0x3c8945[_0xed58('0x2b')][_0xed58('0x3a')]){_0x5df95f[_0xed58('0x3b')]=[{'all':!![]}];}_0x5df95f=_['merge']({},_0x5df95f,_0x3c8945[_0xed58('0x42')]);return db[_0xed58('0x26')]['find'](_0x5df95f)[_0xed58('0x1f')](handleEntityNotFound(_0x356f3f,null))[_0xed58('0x1f')](respondWithResult(_0x356f3f,null))['catch'](handleError(_0x356f3f,null));};exports[_0xed58('0x43')]=function(_0x46f4d8,_0x1e09c3){return db[_0xed58('0x26')][_0xed58('0x43')](_0x46f4d8[_0xed58('0x44')],{})[_0xed58('0x1f')](respondWithResult(_0x1e09c3,0xc9))[_0xed58('0x3e')](handleError(_0x1e09c3,null));};exports['update']=function(_0x5251c8,_0x5dd4aa){if(_0x5251c8[_0xed58('0x44')]['id']){delete _0x5251c8['body']['id'];}return db[_0xed58('0x26')]['find']({'where':{'id':_0x5251c8[_0xed58('0x40')]['id']}})[_0xed58('0x1f')](handleEntityNotFound(_0x5dd4aa,null))[_0xed58('0x1f')](saveUpdates(_0x5251c8[_0xed58('0x44')],null))[_0xed58('0x1f')](respondWithResult(_0x5dd4aa,null))['catch'](handleError(_0x5dd4aa,null));};exports[_0xed58('0x45')]=function(_0x2b396a,_0x46d79b){return db[_0xed58('0x26')][_0xed58('0x46')]({'where':{'id':_0x2b396a[_0xed58('0x40')]['id']}})[_0xed58('0x1f')](handleEntityNotFound(_0x46d79b,null))['then'](removeEntity(_0x46d79b,null))[_0xed58('0x3e')](handleError(_0x46d79b,null));};exports[_0xed58('0x47')]=function(_0x49339a,_0xa0fb21){return db[_0xed58('0x26')][_0xed58('0x47')]()[_0xed58('0x1f')](respondWithResult(_0xa0fb21,null))[_0xed58('0x3e')](handleError(_0xa0fb21,null));}; \ No newline at end of file +var _0xe423=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','then','destroy','error','name','send','index','JscriptyQuestionReport','rawAttributes','type'];(function(_0x2fd4a1,_0x58ad1c){var _0x4945f0=function(_0x57d45c){while(--_0x57d45c){_0x2fd4a1['push'](_0x2fd4a1['shift']());}};_0x4945f0(++_0x58ad1c);}(_0xe423,0x19b));var _0x3e42=function(_0x5e4a71,_0x108169){_0x5e4a71=_0x5e4a71-0x0;var _0x14e65e=_0xe423[_0x5e4a71];return _0x14e65e;};'use strict';var emlformat=require(_0x3e42('0x0'));var rimraf=require(_0x3e42('0x1'));var zipdir=require(_0x3e42('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3e42('0x3'));var BPromise=require(_0x3e42('0x4'));var Mustache=require(_0x3e42('0x5'));var util=require('util');var path=require(_0x3e42('0x6'));var sox=require(_0x3e42('0x7'));var csv=require('to-csv');var ejs=require(_0x3e42('0x8'));var fs=require('fs');var fs_extra=require(_0x3e42('0x9'));var _=require(_0x3e42('0xa'));var squel=require(_0x3e42('0xb'));var crypto=require(_0x3e42('0xc'));var jsforce=require(_0x3e42('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3e42('0xe'));var querystring=require('querystring');var Papa=require(_0x3e42('0xf'));var Redis=require(_0x3e42('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3e42('0x11'));var as=require(_0x3e42('0x12'));var hardwareService=require(_0x3e42('0x13'));var logger=require(_0x3e42('0x14'))(_0x3e42('0x15'));var utils=require(_0x3e42('0x16'));var config=require(_0x3e42('0x17'));var licenseUtil=require(_0x3e42('0x18'));var db=require(_0x3e42('0x19'))['db'];function respondWithStatusCode(_0x29dd4d,_0x28fdec){_0x28fdec=_0x28fdec||0xcc;return function(_0x505986){if(_0x505986){return _0x29dd4d[_0x3e42('0x1a')](_0x28fdec);}return _0x29dd4d[_0x3e42('0x1b')](_0x28fdec)[_0x3e42('0x1c')]();};}function respondWithResult(_0x218ace,_0x336e37){_0x336e37=_0x336e37||0xc8;return function(_0x1992f6){if(_0x1992f6){return _0x218ace[_0x3e42('0x1b')](_0x336e37)['json'](_0x1992f6);}};}function respondWithFilteredResult(_0x324693,_0x1559bb){return function(_0x274cc6){if(_0x274cc6){var _0x2eb0bb=typeof _0x1559bb[_0x3e42('0x1d')]===_0x3e42('0x1e')&&typeof _0x1559bb[_0x3e42('0x1f')]===_0x3e42('0x1e');var _0x4b485f=_0x274cc6[_0x3e42('0x20')];var _0x54884e=_0x2eb0bb?0x0:_0x1559bb[_0x3e42('0x1d')];var _0x545420=_0x2eb0bb?_0x274cc6['count']:_0x1559bb[_0x3e42('0x1d')]+_0x1559bb[_0x3e42('0x1f')];var _0x33af8d;if(_0x545420>=_0x4b485f){_0x545420=_0x4b485f;_0x33af8d=0xc8;}else{_0x33af8d=0xce;}_0x324693[_0x3e42('0x1b')](_0x33af8d);return _0x324693[_0x3e42('0x21')]('Content-Range',_0x54884e+'-'+_0x545420+'/'+_0x4b485f)['json'](_0x274cc6);}return null;};}function patchUpdates(_0x573776){return function(_0x227c21){try{jsonpatch[_0x3e42('0x22')](_0x227c21,_0x573776,!![]);}catch(_0x3b5e79){return BPromise['reject'](_0x3b5e79);}return _0x227c21[_0x3e42('0x23')]();};}function saveUpdates(_0x54e271,_0x3ec713){return function(_0x5458c2){if(_0x5458c2){return _0x5458c2['update'](_0x54e271)[_0x3e42('0x24')](function(_0x45e751){return _0x45e751;});}return null;};}function removeEntity(_0x406190,_0x1b921c){return function(_0x3af2af){if(_0x3af2af){return _0x3af2af[_0x3e42('0x25')]()[_0x3e42('0x24')](function(){_0x406190['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c1a48,_0x647d72){return function(_0x46420d){if(!_0x46420d){_0x5c1a48['sendStatus'](0x194);}return _0x46420d;};}function handleError(_0x503f5c,_0x392837){_0x392837=_0x392837||0x1f4;return function(_0x5c7e66){logger[_0x3e42('0x26')](_0x5c7e66['stack']);if(_0x5c7e66[_0x3e42('0x27')]){delete _0x5c7e66[_0x3e42('0x27')];}_0x503f5c[_0x3e42('0x1b')](_0x392837)[_0x3e42('0x28')](_0x5c7e66);};}exports[_0x3e42('0x29')]=function(_0x4bcac3,_0x1b0b10){var _0x1ed7fd={},_0x1d219c={},_0x478c48={'count':0x0,'rows':[]};var _0x4d722e=_['map'](db[_0x3e42('0x2a')][_0x3e42('0x2b')],function(_0x300485){return{'name':_0x300485['fieldName'],'type':_0x300485[_0x3e42('0x2c')][_0x3e42('0x2d')]};});_0x1d219c[_0x3e42('0x2e')]=_['map'](_0x4d722e,'name');_0x1d219c[_0x3e42('0x2f')]=_[_0x3e42('0x30')](_0x4bcac3['query']);_0x1d219c['filters']=_[_0x3e42('0x31')](_0x1d219c[_0x3e42('0x2e')],_0x1d219c['query']);_0x1ed7fd[_0x3e42('0x32')]=_['intersection'](_0x1d219c[_0x3e42('0x2e')],qs['fields'](_0x4bcac3[_0x3e42('0x2f')][_0x3e42('0x33')]));_0x1ed7fd[_0x3e42('0x32')]=_0x1ed7fd[_0x3e42('0x32')][_0x3e42('0x34')]?_0x1ed7fd[_0x3e42('0x32')]:_0x1d219c[_0x3e42('0x2e')];if(!_0x4bcac3[_0x3e42('0x2f')][_0x3e42('0x35')](_0x3e42('0x36'))){_0x1ed7fd[_0x3e42('0x1f')]=qs[_0x3e42('0x1f')](_0x4bcac3[_0x3e42('0x2f')][_0x3e42('0x1f')]);_0x1ed7fd[_0x3e42('0x1d')]=qs[_0x3e42('0x1d')](_0x4bcac3[_0x3e42('0x2f')][_0x3e42('0x1d')]);}_0x1ed7fd[_0x3e42('0x37')]=qs[_0x3e42('0x38')](_0x4bcac3[_0x3e42('0x2f')][_0x3e42('0x38')]);_0x1ed7fd[_0x3e42('0x39')]=qs[_0x3e42('0x3a')](_[_0x3e42('0x3b')](_0x4bcac3[_0x3e42('0x2f')],_0x1d219c[_0x3e42('0x3a')]),_0x4d722e);if(_0x4bcac3[_0x3e42('0x2f')][_0x3e42('0x3c')]){_0x1ed7fd[_0x3e42('0x39')]=_[_0x3e42('0x3d')](_0x1ed7fd[_0x3e42('0x39')],{'$or':_[_0x3e42('0x3e')](_0x4d722e,function(_0x1edb0e){if(_0x1edb0e[_0x3e42('0x2c')]!=='VIRTUAL'){var _0x479e96={};_0x479e96[_0x1edb0e[_0x3e42('0x27')]]={'$like':'%'+_0x4bcac3[_0x3e42('0x2f')]['filter']+'%'};return _0x479e96;}})});}_0x1ed7fd=_[_0x3e42('0x3d')]({},_0x1ed7fd,_0x4bcac3[_0x3e42('0x3f')]);var _0x4a338e={'where':_0x1ed7fd[_0x3e42('0x39')]};return db[_0x3e42('0x2a')][_0x3e42('0x20')](_0x4a338e)[_0x3e42('0x24')](function(_0x54e5db){_0x478c48[_0x3e42('0x20')]=_0x54e5db;if(_0x4bcac3['query'][_0x3e42('0x40')]){_0x1ed7fd[_0x3e42('0x41')]=[{'all':!![]}];}return db[_0x3e42('0x2a')][_0x3e42('0x42')](_0x1ed7fd);})['then'](function(_0x2ec16b){_0x478c48[_0x3e42('0x43')]=_0x2ec16b;return _0x478c48;})['then'](respondWithFilteredResult(_0x1b0b10,_0x1ed7fd))[_0x3e42('0x44')](handleError(_0x1b0b10,null));};exports[_0x3e42('0x45')]=function(_0x58a6f0,_0x535617){var _0x2bed50={'raw':!![],'where':{'id':_0x58a6f0[_0x3e42('0x46')]['id']}},_0x5d21c3={};_0x5d21c3[_0x3e42('0x2e')]=_[_0x3e42('0x30')](db[_0x3e42('0x2a')][_0x3e42('0x2b')]);_0x5d21c3[_0x3e42('0x2f')]=_[_0x3e42('0x30')](_0x58a6f0[_0x3e42('0x2f')]);_0x5d21c3[_0x3e42('0x3a')]=_[_0x3e42('0x31')](_0x5d21c3[_0x3e42('0x2e')],_0x5d21c3['query']);_0x2bed50['attributes']=_[_0x3e42('0x31')](_0x5d21c3[_0x3e42('0x2e')],qs[_0x3e42('0x33')](_0x58a6f0['query'][_0x3e42('0x33')]));_0x2bed50[_0x3e42('0x32')]=_0x2bed50[_0x3e42('0x32')]['length']?_0x2bed50[_0x3e42('0x32')]:_0x5d21c3['model'];if(_0x58a6f0['query'][_0x3e42('0x40')]){_0x2bed50[_0x3e42('0x41')]=[{'all':!![]}];}_0x2bed50=_[_0x3e42('0x3d')]({},_0x2bed50,_0x58a6f0['options']);return db['JscriptyQuestionReport']['find'](_0x2bed50)['then'](handleEntityNotFound(_0x535617,null))[_0x3e42('0x24')](respondWithResult(_0x535617,null))[_0x3e42('0x44')](handleError(_0x535617,null));};exports[_0x3e42('0x47')]=function(_0x1ac913,_0x2816b9){return db['JscriptyQuestionReport'][_0x3e42('0x47')](_0x1ac913['body'],{})[_0x3e42('0x24')](respondWithResult(_0x2816b9,0xc9))[_0x3e42('0x44')](handleError(_0x2816b9,null));};exports[_0x3e42('0x48')]=function(_0x48c43d,_0x56c157){if(_0x48c43d[_0x3e42('0x49')]['id']){delete _0x48c43d[_0x3e42('0x49')]['id'];}return db[_0x3e42('0x2a')][_0x3e42('0x4a')]({'where':{'id':_0x48c43d[_0x3e42('0x46')]['id']}})['then'](handleEntityNotFound(_0x56c157,null))['then'](saveUpdates(_0x48c43d[_0x3e42('0x49')],null))[_0x3e42('0x24')](respondWithResult(_0x56c157,null))[_0x3e42('0x44')](handleError(_0x56c157,null));};exports[_0x3e42('0x25')]=function(_0x58b9c9,_0x25916a){return db['JscriptyQuestionReport'][_0x3e42('0x4a')]({'where':{'id':_0x58b9c9[_0x3e42('0x46')]['id']}})[_0x3e42('0x24')](handleEntityNotFound(_0x25916a,null))['then'](removeEntity(_0x25916a,null))[_0x3e42('0x44')](handleError(_0x25916a,null));};exports[_0x3e42('0x4b')]=function(_0x42e98c,_0x459e9b){return db['JscriptyQuestionReport'][_0x3e42('0x4b')]()['then'](respondWithResult(_0x459e9b,null))[_0x3e42('0x44')](handleError(_0x459e9b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 4e65a53..405e62f 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5d3=['../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','bluebird','path'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0xe5d3,0x16d));var _0x3e5d=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xe5d3[_0x31dde9];return _0x1fbf2d;};'use strict';var _=require(_0x3e5d('0x0'));var util=require('util');var logger=require(_0x3e5d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3e5d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e5d('0x3'));var rimraf=require('rimraf');var config=require(_0x3e5d('0x4'));var attributes=require(_0x3e5d('0x5'));module[_0x3e5d('0x6')]=function(_0x3dffe5,_0x9bddbb){return _0x3dffe5['define'](_0x3e5d('0x7'),attributes,{'tableName':_0x3e5d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79cb=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','report_jscripty_questions','lodash','util','../../config/logger','api','moment'];(function(_0x1536da,_0x547393){var _0x19a38c=function(_0x1ce149){while(--_0x1ce149){_0x1536da['push'](_0x1536da['shift']());}};_0x19a38c(++_0x547393);}(_0x79cb,0xdf));var _0xb79c=function(_0x208774,_0xfd724){_0x208774=_0x208774-0x0;var _0x25bcac=_0x79cb[_0x208774];return _0x25bcac;};'use strict';var _=require(_0xb79c('0x0'));var util=require(_0xb79c('0x1'));var logger=require(_0xb79c('0x2'))(_0xb79c('0x3'));var moment=require(_0xb79c('0x4'));var BPromise=require(_0xb79c('0x5'));var rp=require(_0xb79c('0x6'));var fs=require('fs');var path=require(_0xb79c('0x7'));var rimraf=require(_0xb79c('0x8'));var config=require(_0xb79c('0x9'));var attributes=require(_0xb79c('0xa'));module['exports']=function(_0x1b0ebf,_0xe2b23f){return _0x1b0ebf['define']('JscriptyQuestionReport',attributes,{'tableName':_0xb79c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index a750e61..5965add 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47cd=['message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0x47cd,0xfb));var _0xd47c=function(_0x3a5c14,_0x1faee8){_0x3a5c14=_0x3a5c14-0x0;var _0x261413=_0x47cd[_0x3a5c14];return _0x261413;};'use strict';var _=require(_0xd47c('0x0'));var util=require('util');var moment=require(_0xd47c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd47c('0x2'));var db=require(_0xd47c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd47c('0x4'))('rpc');var config=require(_0xd47c('0x5'));var jayson=require(_0xd47c('0x6'));var client=jayson[_0xd47c('0x7')][_0xd47c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fd6b4,_0x40cb3c,_0x31a500){return new BPromise(function(_0x401e76,_0x85101){return client[_0xd47c('0x9')](_0x3fd6b4,_0x31a500)['then'](function(_0x5cf84f){logger['info'](_0xd47c('0xa'),_0x40cb3c,_0xd47c('0xb'));logger[_0xd47c('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x40cb3c,_0xd47c('0xb'),JSON[_0xd47c('0xd')](_0x5cf84f));if(_0x5cf84f['error']){if(_0x5cf84f[_0xd47c('0xe')]['code']===0x1f4){logger[_0xd47c('0xe')](_0xd47c('0xa'),_0x40cb3c,_0x5cf84f[_0xd47c('0xe')][_0xd47c('0xf')]);return _0x85101(_0x5cf84f['error'][_0xd47c('0xf')]);}logger[_0xd47c('0xe')](_0xd47c('0xa'),_0x40cb3c,_0x5cf84f['error'][_0xd47c('0xf')]);return _0x401e76(_0x5cf84f[_0xd47c('0xe')][_0xd47c('0xf')]);}else{logger[_0xd47c('0x10')](_0xd47c('0xa'),_0x40cb3c,_0xd47c('0xb'));_0x401e76(_0x5cf84f[_0xd47c('0x11')][_0xd47c('0xf')]);}})[_0xd47c('0x12')](function(_0x3ef6a8){logger['error'](_0xd47c('0xa'),_0x40cb3c,_0x3ef6a8);_0x85101(_0x3ef6a8);});});} \ No newline at end of file +var _0x9071=['then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x36f29d,_0x59e8e4){var _0x675979=function(_0xdf509a){while(--_0xdf509a){_0x36f29d['push'](_0x36f29d['shift']());}};_0x675979(++_0x59e8e4);}(_0x9071,0x16f));var _0x1907=function(_0x57df36,_0x207a1b){_0x57df36=_0x57df36-0x0;var _0x59ea0a=_0x9071[_0x57df36];return _0x59ea0a;};'use strict';var _=require(_0x1907('0x0'));var util=require(_0x1907('0x1'));var moment=require(_0x1907('0x2'));var BPromise=require(_0x1907('0x3'));var rs=require(_0x1907('0x4'));var fs=require('fs');var Redis=require(_0x1907('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1907('0x6'));var logger=require(_0x1907('0x7'))('rpc');var config=require(_0x1907('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1907('0x9')][_0x1907('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fdef,_0x4a0190,_0x15f03a){return new BPromise(function(_0x2f186f,_0x9bb018){return client['request'](_0x46fdef,_0x15f03a)[_0x1907('0xb')](function(_0x334b24){logger[_0x1907('0xc')](_0x1907('0xd'),_0x4a0190,_0x1907('0xe'));logger[_0x1907('0xf')](_0x1907('0x10'),_0x4a0190,'request\x20sent',JSON['stringify'](_0x334b24));if(_0x334b24[_0x1907('0x11')]){if(_0x334b24[_0x1907('0x11')]['code']===0x1f4){logger['error'](_0x1907('0xd'),_0x4a0190,_0x334b24[_0x1907('0x11')][_0x1907('0x12')]);return _0x9bb018(_0x334b24['error']['message']);}logger[_0x1907('0x11')](_0x1907('0xd'),_0x4a0190,_0x334b24[_0x1907('0x11')][_0x1907('0x12')]);return _0x2f186f(_0x334b24[_0x1907('0x11')]['message']);}else{logger[_0x1907('0xc')](_0x1907('0xd'),_0x4a0190,_0x1907('0xe'));_0x2f186f(_0x334b24[_0x1907('0x13')][_0x1907('0x12')]);}})[_0x1907('0x14')](function(_0x40f612){logger[_0x1907('0x11')](_0x1907('0xd'),_0x4a0190,_0x40f612);_0x9bb018(_0x40f612);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index acdba25..db907b1 100644 --- a/server/api/jscriptySessionReport/index.js +++ b/server/api/jscriptySessionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ff6=['destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','update','delete'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x3ff6,0x141));var _0x63ff=function(_0x321aa9,_0x581408){_0x321aa9=_0x321aa9-0x0;var _0x4c80cc=_0x3ff6[_0x321aa9];return _0x4c80cc;};'use strict';var multer=require(_0x63ff('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x63ff('0x1'));var express=require(_0x63ff('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x63ff('0x3'));var interaction=require(_0x63ff('0x4'));var config=require(_0x63ff('0x5'));var controller=require('./jscriptySessionReport.controller');router[_0x63ff('0x6')]('/',auth[_0x63ff('0x7')](),controller[_0x63ff('0x8')]);router[_0x63ff('0x6')](_0x63ff('0x9'),auth[_0x63ff('0x7')](),controller[_0x63ff('0xa')]);router[_0x63ff('0x6')](_0x63ff('0xb'),auth['isAuthenticated'](),controller[_0x63ff('0xc')]);router[_0x63ff('0x6')](_0x63ff('0xd'),auth[_0x63ff('0x7')](),controller[_0x63ff('0xe')]);router[_0x63ff('0xf')]('/',auth['isAuthenticated'](),controller[_0x63ff('0x10')]);router['put']('/:id',auth[_0x63ff('0x7')](),controller[_0x63ff('0x11')]);router[_0x63ff('0x12')](_0x63ff('0xb'),auth[_0x63ff('0x7')](),controller[_0x63ff('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa726=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','/:id','show','/:id/questions','create','update','delete','destroy'];(function(_0x3d585f,_0x20d755){var _0x453ea1=function(_0x33d5c3){while(--_0x33d5c3){_0x3d585f['push'](_0x3d585f['shift']());}};_0x453ea1(++_0x20d755);}(_0xa726,0xa1));var _0x6a72=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xa726[_0x4e4f0e];return _0x1a7219;};'use strict';var multer=require(_0x6a72('0x0'));var util=require(_0x6a72('0x1'));var path=require('path');var timeout=require(_0x6a72('0x2'));var express=require(_0x6a72('0x3'));var router=express[_0x6a72('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6a72('0x5'));var interaction=require(_0x6a72('0x6'));var config=require(_0x6a72('0x7'));var controller=require(_0x6a72('0x8'));router[_0x6a72('0x9')]('/',auth[_0x6a72('0xa')](),controller['index']);router['get'](_0x6a72('0xb'),auth[_0x6a72('0xa')](),controller['describe']);router[_0x6a72('0x9')](_0x6a72('0xc'),auth[_0x6a72('0xa')](),controller[_0x6a72('0xd')]);router['get'](_0x6a72('0xe'),auth['isAuthenticated'](),controller['getQuestions']);router['post']('/',auth[_0x6a72('0xa')](),controller[_0x6a72('0xf')]);router['put'](_0x6a72('0xc'),auth[_0x6a72('0xa')](),controller[_0x6a72('0x10')]);router[_0x6a72('0x11')](_0x6a72('0xc'),auth[_0x6a72('0xa')](),controller[_0x6a72('0x12')]);module[_0x6a72('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index dd3a1a5..4a7516d 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x657b=['setDataValue','STRING','moment','sequelize','exports','DATE'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x657b,0x98));var _0xb657=function(_0x3286e9,_0x48f107){_0x3286e9=_0x3286e9-0x0;var _0x5bb3b0=_0x657b[_0x3286e9];return _0x5bb3b0;};'use strict';var moment=require(_0xb657('0x0'));var Sequelize=require(_0xb657('0x1'));module[_0xb657('0x2')]={'starttime':{'type':Sequelize[_0xb657('0x3')],'set':function(_0x2483bf){this[_0xb657('0x4')]('starttime',_0x2483bf);this['setDataValue']('endtime',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xb657('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb657('0x5')]},'uniqueid':{'type':Sequelize[_0xb657('0x5')]},'calleridname':{'type':Sequelize[_0xb657('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x78e7=['DATE','setDataValue','starttime','endtime','format','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x4cba6b,_0x5584e3){var _0x49db68=function(_0x228885){while(--_0x228885){_0x4cba6b['push'](_0x4cba6b['shift']());}};_0x49db68(++_0x5584e3);}(_0x78e7,0xb1));var _0x778e=function(_0x43f39c,_0x1544e8){_0x43f39c=_0x43f39c-0x0;var _0x31b09e=_0x78e7[_0x43f39c];return _0x31b09e;};'use strict';var moment=require(_0x778e('0x0'));var Sequelize=require(_0x778e('0x1'));module[_0x778e('0x2')]={'starttime':{'type':Sequelize[_0x778e('0x3')],'set':function(_0x40434c){this[_0x778e('0x4')](_0x778e('0x5'),_0x40434c);this[_0x778e('0x4')](_0x778e('0x6'),moment()[_0x778e('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x778e('0x3')]},'membername':{'type':Sequelize[_0x778e('0x8')]},'projectname':{'type':Sequelize[_0x778e('0x8')]},'queue':{'type':Sequelize[_0x778e('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x778e('0x8')]},'calleridnum':{'type':Sequelize[_0x778e('0x8')]},'completed':{'type':Sequelize[_0x778e('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ce7a5ea..3723a8d 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92a5=['pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','length','include','options','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','fieldName','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x92a5,0xbe));var _0x592a=function(_0x22da61,_0x237ba9){_0x22da61=_0x22da61-0x0;var _0x40b728=_0x92a5[_0x22da61];return _0x40b728;};'use strict';var emlformat=require(_0x592a('0x0'));var rimraf=require(_0x592a('0x1'));var zipdir=require(_0x592a('0x2'));var jsonpatch=require(_0x592a('0x3'));var rp=require(_0x592a('0x4'));var moment=require(_0x592a('0x5'));var BPromise=require(_0x592a('0x6'));var Mustache=require(_0x592a('0x7'));var util=require(_0x592a('0x8'));var path=require(_0x592a('0x9'));var sox=require('sox');var csv=require(_0x592a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x592a('0xb'));var jsforce=require(_0x592a('0xc'));var deskjs=require(_0x592a('0xd'));var toCsv=require(_0x592a('0xa'));var querystring=require(_0x592a('0xe'));var Papa=require(_0x592a('0xf'));var Redis=require(_0x592a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x592a('0x11'));var as=require(_0x592a('0x12'));var hardwareService=require(_0x592a('0x13'));var logger=require(_0x592a('0x14'))('api');var utils=require(_0x592a('0x15'));var config=require(_0x592a('0x16'));var licenseUtil=require(_0x592a('0x17'));var db=require(_0x592a('0x18'))['db'];function respondWithStatusCode(_0x433f49,_0x17a737){_0x17a737=_0x17a737||0xcc;return function(_0x329f78){if(_0x329f78){return _0x433f49[_0x592a('0x19')](_0x17a737);}return _0x433f49[_0x592a('0x1a')](_0x17a737)[_0x592a('0x1b')]();};}function respondWithResult(_0x2b1a92,_0xe92af6){_0xe92af6=_0xe92af6||0xc8;return function(_0x47a3f0){if(_0x47a3f0){return _0x2b1a92[_0x592a('0x1a')](_0xe92af6)[_0x592a('0x1c')](_0x47a3f0);}};}function respondWithFilteredResult(_0x1fc168,_0x30cc21){return function(_0x3554e8){if(_0x3554e8){var _0x56de7b=typeof _0x30cc21['offset']==='undefined'&&typeof _0x30cc21[_0x592a('0x1d')]==='undefined';var _0x1a4e39=_0x3554e8[_0x592a('0x1e')];var _0x17e648=_0x56de7b?0x0:_0x30cc21[_0x592a('0x1f')];var _0x8db931=_0x56de7b?_0x3554e8[_0x592a('0x1e')]:_0x30cc21['offset']+_0x30cc21[_0x592a('0x1d')];var _0x2350ce;if(_0x8db931>=_0x1a4e39){_0x8db931=_0x1a4e39;_0x2350ce=0xc8;}else{_0x2350ce=0xce;}_0x1fc168[_0x592a('0x1a')](_0x2350ce);return _0x1fc168[_0x592a('0x20')](_0x592a('0x21'),_0x17e648+'-'+_0x8db931+'/'+_0x1a4e39)['json'](_0x3554e8);}return null;};}function patchUpdates(_0x182778){return function(_0x26b067){try{jsonpatch[_0x592a('0x22')](_0x26b067,_0x182778,!![]);}catch(_0x15d99a){return BPromise[_0x592a('0x23')](_0x15d99a);}return _0x26b067[_0x592a('0x24')]();};}function saveUpdates(_0x414c03,_0x331b2c){return function(_0x330620){if(_0x330620){return _0x330620['update'](_0x414c03)[_0x592a('0x25')](function(_0x1bfb14){return _0x1bfb14;});}return null;};}function removeEntity(_0x2d3ae1,_0x45b6d3){return function(_0x529706){if(_0x529706){return _0x529706[_0x592a('0x26')]()[_0x592a('0x25')](function(){_0x2d3ae1['status'](0xcc)[_0x592a('0x1b')]();});}};}function handleEntityNotFound(_0x2c3622,_0x58b990){return function(_0x4d9621){if(!_0x4d9621){_0x2c3622[_0x592a('0x19')](0x194);}return _0x4d9621;};}function handleError(_0x1c164d,_0x5e4da3){_0x5e4da3=_0x5e4da3||0x1f4;return function(_0x5995da){logger[_0x592a('0x27')](_0x5995da[_0x592a('0x28')]);if(_0x5995da['name']){delete _0x5995da[_0x592a('0x29')];}_0x1c164d['status'](_0x5e4da3)[_0x592a('0x2a')](_0x5995da);};}exports[_0x592a('0x2b')]=function(_0x3a8dc2,_0x5eb5d5){var _0x2af815={},_0x563670={},_0x4621d9={'count':0x0,'rows':[]};var _0x5835f8=_[_0x592a('0x2c')](db[_0x592a('0x2d')]['rawAttributes'],function(_0x3b0374){return{'name':_0x3b0374[_0x592a('0x2e')],'type':_0x3b0374['type']['key']};});_0x563670[_0x592a('0x2f')]=_['map'](_0x5835f8,'name');_0x563670['query']=_[_0x592a('0x30')](_0x3a8dc2['query']);_0x563670[_0x592a('0x31')]=_[_0x592a('0x32')](_0x563670[_0x592a('0x2f')],_0x563670[_0x592a('0x33')]);_0x2af815['attributes']=_[_0x592a('0x32')](_0x563670[_0x592a('0x2f')],qs[_0x592a('0x34')](_0x3a8dc2[_0x592a('0x33')]['fields']));_0x2af815[_0x592a('0x35')]=_0x2af815['attributes']['length']?_0x2af815[_0x592a('0x35')]:_0x563670[_0x592a('0x2f')];if(!_0x3a8dc2[_0x592a('0x33')][_0x592a('0x36')](_0x592a('0x37'))){_0x2af815[_0x592a('0x1d')]=qs['limit'](_0x3a8dc2[_0x592a('0x33')][_0x592a('0x1d')]);_0x2af815['offset']=qs[_0x592a('0x1f')](_0x3a8dc2[_0x592a('0x33')][_0x592a('0x1f')]);}_0x2af815[_0x592a('0x38')]=qs['sort'](_0x3a8dc2[_0x592a('0x33')][_0x592a('0x39')]);_0x2af815[_0x592a('0x3a')]=qs[_0x592a('0x31')](_[_0x592a('0x3b')](_0x3a8dc2[_0x592a('0x33')],_0x563670[_0x592a('0x31')]),_0x5835f8);if(_0x3a8dc2[_0x592a('0x33')][_0x592a('0x3c')]){_0x2af815[_0x592a('0x3a')]=_[_0x592a('0x3d')](_0x2af815[_0x592a('0x3a')],{'$or':_[_0x592a('0x2c')](_0x5835f8,function(_0x55d20f){if(_0x55d20f[_0x592a('0x3e')]!==_0x592a('0x3f')){var _0x5aee59={};_0x5aee59[_0x55d20f[_0x592a('0x29')]]={'$like':'%'+_0x3a8dc2[_0x592a('0x33')]['filter']+'%'};return _0x5aee59;}})});}_0x2af815=_['merge']({},_0x2af815,_0x3a8dc2['options']);var _0x44622a={'where':_0x2af815[_0x592a('0x3a')]};return db[_0x592a('0x2d')][_0x592a('0x1e')](_0x44622a)['then'](function(_0x55734d){_0x4621d9[_0x592a('0x1e')]=_0x55734d;if(_0x3a8dc2[_0x592a('0x33')][_0x592a('0x40')]){_0x2af815['include']=[{'all':!![]}];}return db[_0x592a('0x2d')][_0x592a('0x41')](_0x2af815);})[_0x592a('0x25')](function(_0x5ed82e){_0x4621d9['rows']=_0x5ed82e;return _0x4621d9;})[_0x592a('0x25')](respondWithFilteredResult(_0x5eb5d5,_0x2af815))[_0x592a('0x42')](handleError(_0x5eb5d5,null));};exports[_0x592a('0x43')]=function(_0x32e589,_0x4735cb){var _0x14f087={'raw':!![],'where':{'id':_0x32e589[_0x592a('0x44')]['id']}},_0x958732={};_0x958732['model']=_['keys'](db[_0x592a('0x2d')][_0x592a('0x45')]);_0x958732[_0x592a('0x33')]=_[_0x592a('0x30')](_0x32e589['query']);_0x958732[_0x592a('0x31')]=_[_0x592a('0x32')](_0x958732[_0x592a('0x2f')],_0x958732['query']);_0x14f087[_0x592a('0x35')]=_[_0x592a('0x32')](_0x958732['model'],qs[_0x592a('0x34')](_0x32e589['query'][_0x592a('0x34')]));_0x14f087[_0x592a('0x35')]=_0x14f087[_0x592a('0x35')][_0x592a('0x46')]?_0x14f087[_0x592a('0x35')]:_0x958732[_0x592a('0x2f')];if(_0x32e589[_0x592a('0x33')][_0x592a('0x40')]){_0x14f087[_0x592a('0x47')]=[{'all':!![]}];}_0x14f087=_[_0x592a('0x3d')]({},_0x14f087,_0x32e589[_0x592a('0x48')]);return db[_0x592a('0x2d')][_0x592a('0x49')](_0x14f087)[_0x592a('0x25')](handleEntityNotFound(_0x4735cb,null))['then'](respondWithResult(_0x4735cb,null))['catch'](handleError(_0x4735cb,null));};exports[_0x592a('0x4a')]=function(_0x59f3ed,_0x2ef5b0){return db[_0x592a('0x2d')]['create'](_0x59f3ed[_0x592a('0x4b')],{})['then'](respondWithResult(_0x2ef5b0,0xc9))[_0x592a('0x42')](handleError(_0x2ef5b0,null));};exports[_0x592a('0x4c')]=function(_0x52b802,_0xcc763a){if(_0x52b802[_0x592a('0x4b')]['id']){delete _0x52b802[_0x592a('0x4b')]['id'];}return db[_0x592a('0x2d')][_0x592a('0x49')]({'where':{'id':_0x52b802[_0x592a('0x44')]['id']}})[_0x592a('0x25')](handleEntityNotFound(_0xcc763a,null))[_0x592a('0x25')](saveUpdates(_0x52b802[_0x592a('0x4b')],null))[_0x592a('0x25')](respondWithResult(_0xcc763a,null))[_0x592a('0x42')](handleError(_0xcc763a,null));};exports[_0x592a('0x26')]=function(_0x27b707,_0x53fe67){return db[_0x592a('0x2d')][_0x592a('0x49')]({'where':{'id':_0x27b707['params']['id']}})[_0x592a('0x25')](handleEntityNotFound(_0x53fe67,null))['then'](removeEntity(_0x53fe67,null))[_0x592a('0x42')](handleError(_0x53fe67,null));};exports[_0x592a('0x4d')]=function(_0x1bb62d,_0x5b803d){return db[_0x592a('0x2d')][_0x592a('0x4d')]()[_0x592a('0x25')](respondWithResult(_0x5b803d,null))[_0x592a('0x42')](handleError(_0x5b803d,null));};exports[_0x592a('0x4e')]=function(_0x18257b,_0x47738b,_0x27d8b0){var _0x5c5931={'raw':!![],'where':{}};var _0x44ebf2={};var _0x18e105={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x592a('0x4f')]({'where':{'id':_0x18257b[_0x592a('0x44')]['id']}})[_0x592a('0x25')](handleEntityNotFound(_0x47738b,null))[_0x592a('0x25')](function(_0x27640d){if(_0x27640d){_0x44ebf2[_0x592a('0x2f')]=_[_0x592a('0x30')](db[_0x592a('0x50')][_0x592a('0x45')]);_0x44ebf2[_0x592a('0x33')]=_[_0x592a('0x30')](_0x18257b['query']);_0x44ebf2['filters']=_[_0x592a('0x32')](_0x44ebf2[_0x592a('0x2f')],_0x44ebf2[_0x592a('0x33')]);_0x5c5931[_0x592a('0x35')]=_[_0x592a('0x32')](_0x44ebf2[_0x592a('0x2f')],qs[_0x592a('0x34')](_0x18257b[_0x592a('0x33')]['fields']));_0x5c5931[_0x592a('0x35')]=_0x5c5931['attributes']['length']?_0x5c5931[_0x592a('0x35')]:_0x44ebf2['model'];if(!_0x18257b['query']['hasOwnProperty'](_0x592a('0x37'))){_0x5c5931[_0x592a('0x1d')]=qs['limit'](_0x18257b[_0x592a('0x33')][_0x592a('0x1d')]);_0x5c5931['offset']=qs[_0x592a('0x1f')](_0x18257b[_0x592a('0x33')][_0x592a('0x1f')]);}_0x5c5931[_0x592a('0x38')]=qs[_0x592a('0x39')](_0x18257b[_0x592a('0x33')][_0x592a('0x39')]);_0x5c5931[_0x592a('0x3a')]=qs[_0x592a('0x31')](_['pick'](_0x18257b[_0x592a('0x33')],_0x44ebf2[_0x592a('0x31')]));_0x5c5931['where'][_0x592a('0x51')]=_0x27640d['id'];if(_0x18257b[_0x592a('0x33')][_0x592a('0x3c')]){_0x5c5931['where']=_['merge'](_0x5c5931[_0x592a('0x3a')],{'$or':_['map'](_0x5c5931[_0x592a('0x35')],function(_0x14a294){var _0x342314={};_0x342314[_0x14a294]={'$like':'%'+_0x18257b[_0x592a('0x33')][_0x592a('0x3c')]+'%'};return _0x342314;})});}_0x5c5931=_[_0x592a('0x3d')]({},_0x5c5931,_0x18257b[_0x592a('0x48')]);return db['JscriptyQuestionReport'][_0x592a('0x1e')]({'where':_0x5c5931['where']})[_0x592a('0x25')](function(_0x295661){_0x18e105[_0x592a('0x1e')]=_0x295661;if(_0x18257b[_0x592a('0x33')][_0x592a('0x40')]){_0x5c5931[_0x592a('0x47')]=[{'all':!![]}];}return db[_0x592a('0x50')][_0x592a('0x41')](_0x5c5931);})['then'](function(_0x29342c){_0x18e105[_0x592a('0x52')]=_0x29342c;return _0x18e105;});}})['then'](respondWithFilteredResult(_0x47738b,_0x5c5931))[_0x592a('0x42')](handleError(_0x47738b,null));}; \ No newline at end of file +var _0x7d93=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','count','limit','set','apply','save','status','end','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','include','create','update','body','find','destroy','describe','findOne','JscriptyQuestionReport','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x2915dd,_0xf36c26){var _0x549593=function(_0x3176ae){while(--_0x3176ae){_0x2915dd['push'](_0x2915dd['shift']());}};_0x549593(++_0xf36c26);}(_0x7d93,0x135));var _0x37d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d93[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x37d9('0x0'));var rimraf=require(_0x37d9('0x1'));var zipdir=require(_0x37d9('0x2'));var jsonpatch=require(_0x37d9('0x3'));var rp=require(_0x37d9('0x4'));var moment=require(_0x37d9('0x5'));var BPromise=require(_0x37d9('0x6'));var Mustache=require(_0x37d9('0x7'));var util=require(_0x37d9('0x8'));var path=require(_0x37d9('0x9'));var sox=require('sox');var csv=require(_0x37d9('0xa'));var ejs=require(_0x37d9('0xb'));var fs=require('fs');var fs_extra=require(_0x37d9('0xc'));var _=require(_0x37d9('0xd'));var squel=require(_0x37d9('0xe'));var crypto=require(_0x37d9('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x37d9('0x10'));var toCsv=require(_0x37d9('0xa'));var querystring=require(_0x37d9('0x11'));var Papa=require('papaparse');var Redis=require(_0x37d9('0x12'));var authService=require(_0x37d9('0x13'));var qs=require(_0x37d9('0x14'));var as=require(_0x37d9('0x15'));var hardwareService=require(_0x37d9('0x16'));var logger=require(_0x37d9('0x17'))(_0x37d9('0x18'));var utils=require(_0x37d9('0x19'));var config=require(_0x37d9('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x37d9('0x1b'))['db'];function respondWithStatusCode(_0x3dec64,_0x537573){_0x537573=_0x537573||0xcc;return function(_0x9e58ec){if(_0x9e58ec){return _0x3dec64[_0x37d9('0x1c')](_0x537573);}return _0x3dec64['status'](_0x537573)['end']();};}function respondWithResult(_0x30c082,_0x5037ba){_0x5037ba=_0x5037ba||0xc8;return function(_0x4a7081){if(_0x4a7081){return _0x30c082['status'](_0x5037ba)[_0x37d9('0x1d')](_0x4a7081);}};}function respondWithFilteredResult(_0x5b0faa,_0x821dc3){return function(_0x35bb33){if(_0x35bb33){var _0x5a5aee=typeof _0x821dc3[_0x37d9('0x1e')]==='undefined'&&typeof _0x821dc3['limit']===_0x37d9('0x1f');var _0x5679d0=_0x35bb33[_0x37d9('0x20')];var _0x32c952=_0x5a5aee?0x0:_0x821dc3[_0x37d9('0x1e')];var _0x12393b=_0x5a5aee?_0x35bb33[_0x37d9('0x20')]:_0x821dc3[_0x37d9('0x1e')]+_0x821dc3[_0x37d9('0x21')];var _0x1e8146;if(_0x12393b>=_0x5679d0){_0x12393b=_0x5679d0;_0x1e8146=0xc8;}else{_0x1e8146=0xce;}_0x5b0faa['status'](_0x1e8146);return _0x5b0faa[_0x37d9('0x22')]('Content-Range',_0x32c952+'-'+_0x12393b+'/'+_0x5679d0)[_0x37d9('0x1d')](_0x35bb33);}return null;};}function patchUpdates(_0x149bdb){return function(_0x1b78b7){try{jsonpatch[_0x37d9('0x23')](_0x1b78b7,_0x149bdb,!![]);}catch(_0x4916f7){return BPromise['reject'](_0x4916f7);}return _0x1b78b7[_0x37d9('0x24')]();};}function saveUpdates(_0x17aa74,_0x226757){return function(_0x45a8c3){if(_0x45a8c3){return _0x45a8c3['update'](_0x17aa74)['then'](function(_0x48ba94){return _0x48ba94;});}return null;};}function removeEntity(_0x3d5faf,_0x11c885){return function(_0x2cc254){if(_0x2cc254){return _0x2cc254['destroy']()['then'](function(){_0x3d5faf[_0x37d9('0x25')](0xcc)[_0x37d9('0x26')]();});}};}function handleEntityNotFound(_0x393fdb,_0x2b2b2b){return function(_0x1c25bf){if(!_0x1c25bf){_0x393fdb[_0x37d9('0x1c')](0x194);}return _0x1c25bf;};}function handleError(_0x493237,_0x28ae91){_0x28ae91=_0x28ae91||0x1f4;return function(_0x3b9ef7){logger['error'](_0x3b9ef7['stack']);if(_0x3b9ef7['name']){delete _0x3b9ef7[_0x37d9('0x27')];}_0x493237[_0x37d9('0x25')](_0x28ae91)[_0x37d9('0x28')](_0x3b9ef7);};}exports[_0x37d9('0x29')]=function(_0x348c51,_0x488b69){var _0x3b6105={},_0x2b7cd1={},_0x378b7e={'count':0x0,'rows':[]};var _0x1c79ba=_[_0x37d9('0x2a')](db[_0x37d9('0x2b')][_0x37d9('0x2c')],function(_0x36b8c6){return{'name':_0x36b8c6[_0x37d9('0x2d')],'type':_0x36b8c6[_0x37d9('0x2e')][_0x37d9('0x2f')]};});_0x2b7cd1[_0x37d9('0x30')]=_[_0x37d9('0x2a')](_0x1c79ba,'name');_0x2b7cd1[_0x37d9('0x31')]=_[_0x37d9('0x32')](_0x348c51[_0x37d9('0x31')]);_0x2b7cd1[_0x37d9('0x33')]=_[_0x37d9('0x34')](_0x2b7cd1[_0x37d9('0x30')],_0x2b7cd1['query']);_0x3b6105[_0x37d9('0x35')]=_['intersection'](_0x2b7cd1[_0x37d9('0x30')],qs[_0x37d9('0x36')](_0x348c51[_0x37d9('0x31')][_0x37d9('0x36')]));_0x3b6105[_0x37d9('0x35')]=_0x3b6105[_0x37d9('0x35')][_0x37d9('0x37')]?_0x3b6105[_0x37d9('0x35')]:_0x2b7cd1['model'];if(!_0x348c51[_0x37d9('0x31')]['hasOwnProperty'](_0x37d9('0x38'))){_0x3b6105[_0x37d9('0x21')]=qs[_0x37d9('0x21')](_0x348c51[_0x37d9('0x31')]['limit']);_0x3b6105['offset']=qs[_0x37d9('0x1e')](_0x348c51[_0x37d9('0x31')][_0x37d9('0x1e')]);}_0x3b6105[_0x37d9('0x39')]=qs[_0x37d9('0x3a')](_0x348c51[_0x37d9('0x31')]['sort']);_0x3b6105['where']=qs[_0x37d9('0x33')](_[_0x37d9('0x3b')](_0x348c51[_0x37d9('0x31')],_0x2b7cd1[_0x37d9('0x33')]),_0x1c79ba);if(_0x348c51[_0x37d9('0x31')][_0x37d9('0x3c')]){_0x3b6105[_0x37d9('0x3d')]=_[_0x37d9('0x3e')](_0x3b6105['where'],{'$or':_[_0x37d9('0x2a')](_0x1c79ba,function(_0x5f0ebe){if(_0x5f0ebe[_0x37d9('0x2e')]!==_0x37d9('0x3f')){var _0xe639fe={};_0xe639fe[_0x5f0ebe[_0x37d9('0x27')]]={'$like':'%'+_0x348c51['query'][_0x37d9('0x3c')]+'%'};return _0xe639fe;}})});}_0x3b6105=_[_0x37d9('0x3e')]({},_0x3b6105,_0x348c51[_0x37d9('0x40')]);var _0x1900d6={'where':_0x3b6105[_0x37d9('0x3d')]};return db[_0x37d9('0x2b')]['count'](_0x1900d6)[_0x37d9('0x41')](function(_0x29e48c){_0x378b7e[_0x37d9('0x20')]=_0x29e48c;if(_0x348c51['query'][_0x37d9('0x42')]){_0x3b6105['include']=[{'all':!![]}];}return db[_0x37d9('0x2b')][_0x37d9('0x43')](_0x3b6105);})[_0x37d9('0x41')](function(_0x26db88){_0x378b7e[_0x37d9('0x44')]=_0x26db88;return _0x378b7e;})[_0x37d9('0x41')](respondWithFilteredResult(_0x488b69,_0x3b6105))[_0x37d9('0x45')](handleError(_0x488b69,null));};exports[_0x37d9('0x46')]=function(_0x48ea42,_0x3c8c50){var _0x4bb050={'raw':!![],'where':{'id':_0x48ea42[_0x37d9('0x47')]['id']}},_0x6fa13={};_0x6fa13[_0x37d9('0x30')]=_[_0x37d9('0x32')](db[_0x37d9('0x2b')]['rawAttributes']);_0x6fa13[_0x37d9('0x31')]=_[_0x37d9('0x32')](_0x48ea42['query']);_0x6fa13[_0x37d9('0x33')]=_[_0x37d9('0x34')](_0x6fa13[_0x37d9('0x30')],_0x6fa13[_0x37d9('0x31')]);_0x4bb050[_0x37d9('0x35')]=_[_0x37d9('0x34')](_0x6fa13[_0x37d9('0x30')],qs[_0x37d9('0x36')](_0x48ea42[_0x37d9('0x31')][_0x37d9('0x36')]));_0x4bb050[_0x37d9('0x35')]=_0x4bb050[_0x37d9('0x35')][_0x37d9('0x37')]?_0x4bb050[_0x37d9('0x35')]:_0x6fa13[_0x37d9('0x30')];if(_0x48ea42[_0x37d9('0x31')][_0x37d9('0x42')]){_0x4bb050[_0x37d9('0x48')]=[{'all':!![]}];}_0x4bb050=_[_0x37d9('0x3e')]({},_0x4bb050,_0x48ea42[_0x37d9('0x40')]);return db[_0x37d9('0x2b')]['find'](_0x4bb050)['then'](handleEntityNotFound(_0x3c8c50,null))[_0x37d9('0x41')](respondWithResult(_0x3c8c50,null))[_0x37d9('0x45')](handleError(_0x3c8c50,null));};exports[_0x37d9('0x49')]=function(_0x3e2b52,_0x2772ae){return db[_0x37d9('0x2b')][_0x37d9('0x49')](_0x3e2b52['body'],{})[_0x37d9('0x41')](respondWithResult(_0x2772ae,0xc9))[_0x37d9('0x45')](handleError(_0x2772ae,null));};exports[_0x37d9('0x4a')]=function(_0x56a627,_0x542e75){if(_0x56a627[_0x37d9('0x4b')]['id']){delete _0x56a627['body']['id'];}return db['JscriptySessionReport'][_0x37d9('0x4c')]({'where':{'id':_0x56a627[_0x37d9('0x47')]['id']}})[_0x37d9('0x41')](handleEntityNotFound(_0x542e75,null))['then'](saveUpdates(_0x56a627[_0x37d9('0x4b')],null))['then'](respondWithResult(_0x542e75,null))[_0x37d9('0x45')](handleError(_0x542e75,null));};exports[_0x37d9('0x4d')]=function(_0x5e4813,_0x43374b){return db[_0x37d9('0x2b')][_0x37d9('0x4c')]({'where':{'id':_0x5e4813[_0x37d9('0x47')]['id']}})[_0x37d9('0x41')](handleEntityNotFound(_0x43374b,null))[_0x37d9('0x41')](removeEntity(_0x43374b,null))['catch'](handleError(_0x43374b,null));};exports['describe']=function(_0x2a95bc,_0x285ea8){return db['JscriptySessionReport'][_0x37d9('0x4e')]()[_0x37d9('0x41')](respondWithResult(_0x285ea8,null))['catch'](handleError(_0x285ea8,null));};exports['getQuestions']=function(_0x45aa77,_0x97867a,_0x5ae11f){var _0x5bfa01={'raw':!![],'where':{}};var _0x1a2f87={};var _0x2b7a72={'count':0x0,'rows':[]};return db[_0x37d9('0x2b')][_0x37d9('0x4f')]({'where':{'id':_0x45aa77[_0x37d9('0x47')]['id']}})['then'](handleEntityNotFound(_0x97867a,null))[_0x37d9('0x41')](function(_0x39a93c){if(_0x39a93c){_0x1a2f87[_0x37d9('0x30')]=_['keys'](db[_0x37d9('0x50')][_0x37d9('0x2c')]);_0x1a2f87[_0x37d9('0x31')]=_[_0x37d9('0x32')](_0x45aa77[_0x37d9('0x31')]);_0x1a2f87['filters']=_[_0x37d9('0x34')](_0x1a2f87['model'],_0x1a2f87[_0x37d9('0x31')]);_0x5bfa01[_0x37d9('0x35')]=_['intersection'](_0x1a2f87['model'],qs[_0x37d9('0x36')](_0x45aa77[_0x37d9('0x31')]['fields']));_0x5bfa01['attributes']=_0x5bfa01[_0x37d9('0x35')]['length']?_0x5bfa01[_0x37d9('0x35')]:_0x1a2f87[_0x37d9('0x30')];if(!_0x45aa77[_0x37d9('0x31')][_0x37d9('0x51')](_0x37d9('0x38'))){_0x5bfa01[_0x37d9('0x21')]=qs[_0x37d9('0x21')](_0x45aa77[_0x37d9('0x31')]['limit']);_0x5bfa01[_0x37d9('0x1e')]=qs[_0x37d9('0x1e')](_0x45aa77[_0x37d9('0x31')][_0x37d9('0x1e')]);}_0x5bfa01[_0x37d9('0x39')]=qs[_0x37d9('0x3a')](_0x45aa77['query'][_0x37d9('0x3a')]);_0x5bfa01[_0x37d9('0x3d')]=qs[_0x37d9('0x33')](_['pick'](_0x45aa77[_0x37d9('0x31')],_0x1a2f87['filters']));_0x5bfa01[_0x37d9('0x3d')]['SessionId']=_0x39a93c['id'];if(_0x45aa77[_0x37d9('0x31')][_0x37d9('0x3c')]){_0x5bfa01[_0x37d9('0x3d')]=_[_0x37d9('0x3e')](_0x5bfa01['where'],{'$or':_[_0x37d9('0x2a')](_0x5bfa01['attributes'],function(_0x5d65ee){var _0x100d71={};_0x100d71[_0x5d65ee]={'$like':'%'+_0x45aa77[_0x37d9('0x31')]['filter']+'%'};return _0x100d71;})});}_0x5bfa01=_[_0x37d9('0x3e')]({},_0x5bfa01,_0x45aa77['options']);return db[_0x37d9('0x50')]['count']({'where':_0x5bfa01[_0x37d9('0x3d')]})['then'](function(_0x59704c){_0x2b7a72[_0x37d9('0x20')]=_0x59704c;if(_0x45aa77[_0x37d9('0x31')][_0x37d9('0x42')]){_0x5bfa01[_0x37d9('0x48')]=[{'all':!![]}];}return db[_0x37d9('0x50')][_0x37d9('0x43')](_0x5bfa01);})[_0x37d9('0x41')](function(_0x2ed35b){_0x2b7a72['rows']=_0x2ed35b;return _0x2b7a72;});}})[_0x37d9('0x41')](respondWithFilteredResult(_0x97867a,_0x5bfa01))[_0x37d9('0x45')](handleError(_0x97867a,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0d9cb59..e251372 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.model.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc4=['path','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xafc4,0x69));var _0x4afc=function(_0x84a52d,_0x1003fb){_0x84a52d=_0x84a52d-0x0;var _0x58f63f=_0xafc4[_0x84a52d];return _0x58f63f;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb9=['request-promise','path','rimraf','exports','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x974b47,_0x110244){var _0x1bfabd=function(_0xdb8b4b){while(--_0xdb8b4b){_0x974b47['push'](_0x974b47['shift']());}};_0x1bfabd(++_0x110244);}(_0xafb9,0x68));var _0x9afb=function(_0x146096,_0x2968e5){_0x146096=_0x146096-0x0;var _0x3071d8=_0xafb9[_0x146096];return _0x3071d8;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var logger=require(_0x9afb('0x2'))(_0x9afb('0x3'));var moment=require(_0x9afb('0x4'));var BPromise=require(_0x9afb('0x5'));var rp=require(_0x9afb('0x6'));var fs=require('fs');var path=require(_0x9afb('0x7'));var rimraf=require(_0x9afb('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x9afb('0x9')]=function(_0x56a139,_0x1ccf93){return _0x56a139['define']('JscriptySessionReport',attributes,{'tableName':_0x9afb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 38eeef2..aed7995 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf55=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x35c4e8,_0x18ff04){var _0x4a958a=function(_0x43b341){while(--_0x43b341){_0x35c4e8['push'](_0x35c4e8['shift']());}};_0x4a958a(++_0x18ff04);}(_0xdf55,0x83));var _0x5df5=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0xdf55[_0x581960];return _0x4ee892;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});} \ No newline at end of file +var _0x2542=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4f8192,_0x220187){var _0x1ce025=function(_0x15c68c){while(--_0x15c68c){_0x4f8192['push'](_0x4f8192['shift']());}};_0x1ce025(++_0x220187);}(_0x2542,0x169));var _0x2254=function(_0x129b59,_0x5a33ee){_0x129b59=_0x129b59-0x0;var _0x44d106=_0x2542[_0x129b59];return _0x44d106;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index db25d21..369c3fd 100644 --- a/server/api/license/index.js +++ b/server/api/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3079=['isAuthenticated','downloadLogFile','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','update','/download_log_file'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x3079,0x1ac));var _0x9307=function(_0x5a0c42,_0x5211ad){_0x5a0c42=_0x5a0c42-0x0;var _0xa993a8=_0x3079[_0x5a0c42];return _0xa993a8;};'use strict';var multer=require(_0x9307('0x0'));var util=require(_0x9307('0x1'));var path=require('path');var timeout=require(_0x9307('0x2'));var express=require(_0x9307('0x3'));var router=express['Router']();var fs_extra=require(_0x9307('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9307('0x5'));var config=require(_0x9307('0x6'));var controller=require(_0x9307('0x7'));router[_0x9307('0x8')]('/',controller[_0x9307('0x9')]);router[_0x9307('0xa')](_0x9307('0xb'),auth['isAuthenticated'](),controller[_0x9307('0xc')]);router[_0x9307('0x8')](_0x9307('0xd'),auth[_0x9307('0xe')](),controller[_0x9307('0xf')]);module[_0x9307('0x10')]=router; \ No newline at end of file +var _0x4d9d=['get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x4d9d,0x8e));var _0xd4d9=function(_0x57411a,_0x59328f){_0x57411a=_0x57411a-0x0;var _0xd487ba=_0x4d9d[_0x57411a];return _0xd487ba;};'use strict';var multer=require(_0xd4d9('0x0'));var util=require('util');var path=require(_0xd4d9('0x1'));var timeout=require(_0xd4d9('0x2'));var express=require(_0xd4d9('0x3'));var router=express[_0xd4d9('0x4')]();var fs_extra=require(_0xd4d9('0x5'));var auth=require(_0xd4d9('0x6'));var interaction=require(_0xd4d9('0x7'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xd4d9('0x8')]('/',controller[_0xd4d9('0x9')]);router['put'](_0xd4d9('0xa'),auth[_0xd4d9('0xb')](),controller[_0xd4d9('0xc')]);router[_0xd4d9('0x8')](_0xd4d9('0xd'),auth[_0xd4d9('0xb')](),controller[_0xd4d9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 4cdcbf3..8042a0d 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0adc=['sequelize','exports','TEXT','STRING'];(function(_0x2f562e,_0x291639){var _0x49e218=function(_0x2ba7cc){while(--_0x2ba7cc){_0x2f562e['push'](_0x2f562e['shift']());}};_0x49e218(++_0x291639);}(_0x0adc,0x18c));var _0xc0ad=function(_0x2d6d5e,_0x214948){_0x2d6d5e=_0x2d6d5e-0x0;var _0x5ea03d=_0x0adc[_0x2d6d5e];return _0x5ea03d;};'use strict';var Sequelize=require(_0xc0ad('0x0'));module[_0xc0ad('0x1')]={'license':{'type':Sequelize[_0xc0ad('0x2')]},'data1':{'type':Sequelize[_0xc0ad('0x3')]},'data2':{'type':Sequelize[_0xc0ad('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fc9=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fc9,0x77));var _0x95fc=function(_0x57adbf,_0x5ccd30){_0x57adbf=_0x57adbf-0x0;var _0x5c85f6=_0x5fc9[_0x57adbf];return _0x5c85f6;};'use strict';var Sequelize=require(_0x95fc('0x0'));module[_0x95fc('0x1')]={'license':{'type':Sequelize[_0x95fc('0x2')]},'data1':{'type':Sequelize[_0x95fc('0x3')]},'data2':{'type':Sequelize[_0x95fc('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x95fc('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index b71e6b8..3266bdc 100644 --- a/server/api/license/license.controller.js +++ b/server/api/license/license.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbfa=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','sendStatus','error','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','merge','options','getLicense','catch','body','find','get','demo','license-info.log','join','log','xcally','setHeader','Content-disposition','text/plain','download','eml-format','rimraf','zip-dir','moment','mustache','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdbfa,0x7f));var _0xadbf=function(_0x1ab885,_0x5da58f){_0x1ab885=_0x1ab885-0x0;var _0x438e2a=_0xdbfa[_0x1ab885];return _0x438e2a;};'use strict';var emlformat=require(_0xadbf('0x0'));var rimraf=require(_0xadbf('0x1'));var zipdir=require(_0xadbf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xadbf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xadbf('0x4'));var util=require(_0xadbf('0x5'));var path=require(_0xadbf('0x6'));var sox=require(_0xadbf('0x7'));var csv=require(_0xadbf('0x8'));var ejs=require(_0xadbf('0x9'));var fs=require('fs');var fs_extra=require(_0xadbf('0xa'));var _=require('lodash');var squel=require(_0xadbf('0xb'));var crypto=require(_0xadbf('0xc'));var jsforce=require(_0xadbf('0xd'));var deskjs=require(_0xadbf('0xe'));var toCsv=require(_0xadbf('0x8'));var querystring=require(_0xadbf('0xf'));var Papa=require('papaparse');var Redis=require(_0xadbf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xadbf('0x11'));var as=require(_0xadbf('0x12'));var hardwareService=require(_0xadbf('0x13'));var logger=require('../../config/logger')(_0xadbf('0x14'));var utils=require(_0xadbf('0x15'));var config=require(_0xadbf('0x16'));var licenseUtil=require(_0xadbf('0x17'));var db=require(_0xadbf('0x18'))['db'];function respondWithStatusCode(_0x3b21df,_0x415aca){_0x415aca=_0x415aca||0xcc;return function(_0x5c39f7){if(_0x5c39f7){return _0x3b21df['sendStatus'](_0x415aca);}return _0x3b21df[_0xadbf('0x19')](_0x415aca)[_0xadbf('0x1a')]();};}function respondWithResult(_0x32a339,_0x424c5a){_0x424c5a=_0x424c5a||0xc8;return function(_0x1b0de7){if(_0x1b0de7){return _0x32a339[_0xadbf('0x19')](_0x424c5a)['json'](_0x1b0de7);}};}function respondWithFilteredResult(_0x58ae04,_0x2c3bb7){return function(_0x1df804){if(_0x1df804){var _0x4308cb=typeof _0x2c3bb7[_0xadbf('0x1b')]===_0xadbf('0x1c')&&typeof _0x2c3bb7[_0xadbf('0x1d')]===_0xadbf('0x1c');var _0x4baa59=_0x1df804['count'];var _0x288d7c=_0x4308cb?0x0:_0x2c3bb7[_0xadbf('0x1b')];var _0x5e4d46=_0x4308cb?_0x1df804[_0xadbf('0x1e')]:_0x2c3bb7[_0xadbf('0x1b')]+_0x2c3bb7[_0xadbf('0x1d')];var _0x54b83e;if(_0x5e4d46>=_0x4baa59){_0x5e4d46=_0x4baa59;_0x54b83e=0xc8;}else{_0x54b83e=0xce;}_0x58ae04[_0xadbf('0x19')](_0x54b83e);return _0x58ae04['set'](_0xadbf('0x1f'),_0x288d7c+'-'+_0x5e4d46+'/'+_0x4baa59)[_0xadbf('0x20')](_0x1df804);}return null;};}function patchUpdates(_0x569c95){return function(_0x254e74){try{jsonpatch['apply'](_0x254e74,_0x569c95,!![]);}catch(_0x28a745){return BPromise['reject'](_0x28a745);}return _0x254e74[_0xadbf('0x21')]();};}function saveUpdates(_0x270f8f,_0x193ea5){return function(_0x34a489){if(_0x34a489){return _0x34a489[_0xadbf('0x22')](_0x270f8f)[_0xadbf('0x23')](function(_0x312c6e){return _0x312c6e;});}return null;};}function removeEntity(_0x927cff,_0x44e76b){return function(_0x70a877){if(_0x70a877){return _0x70a877[_0xadbf('0x24')]()[_0xadbf('0x23')](function(){_0x927cff[_0xadbf('0x19')](0xcc)[_0xadbf('0x1a')]();});}};}function handleEntityNotFound(_0x36e3bf,_0x3e1d17){return function(_0x2e1ed9){if(!_0x2e1ed9){_0x36e3bf[_0xadbf('0x25')](0x194);}return _0x2e1ed9;};}function handleError(_0xa34aa4,_0x94809e){_0x94809e=_0x94809e||0x1f4;return function(_0x22f237){logger[_0xadbf('0x26')](_0x22f237['stack']);if(_0x22f237[_0xadbf('0x27')]){delete _0x22f237[_0xadbf('0x27')];}_0xa34aa4['status'](_0x94809e)[_0xadbf('0x28')](_0x22f237);};}var utilLicense=require(_0xadbf('0x17'));exports[_0xadbf('0x29')]=function(_0x359ba5,_0x4e61bc){var _0x46468e={'raw':!![],'where':{'id':0x1}},_0x4a90f8={};_0x4a90f8['model']=_[_0xadbf('0x2a')](db[_0xadbf('0x2b')][_0xadbf('0x2c')]);_0x4a90f8['query']=_['keys'](_0x359ba5[_0xadbf('0x2d')]);_0x4a90f8[_0xadbf('0x2e')]=_[_0xadbf('0x2f')](_0x4a90f8[_0xadbf('0x30')],_0x4a90f8['query']);_0x46468e[_0xadbf('0x31')]=_[_0xadbf('0x2f')](_0x4a90f8[_0xadbf('0x30')],qs[_0xadbf('0x32')](_0x359ba5[_0xadbf('0x2d')][_0xadbf('0x32')]));_0x46468e[_0xadbf('0x31')]=_0x46468e[_0xadbf('0x31')]['length']?_0x46468e[_0xadbf('0x31')]:_0x4a90f8['model'];_0x46468e=_[_0xadbf('0x33')]({},_0x46468e,_0x359ba5[_0xadbf('0x34')]);return utilLicense[_0xadbf('0x35')](_0x46468e)[_0xadbf('0x23')](respondWithResult(_0x4e61bc,null))[_0xadbf('0x36')](handleError(_0x4e61bc,null));};exports['update']=function(_0x33e037,_0x4de8d9){if(_0x33e037[_0xadbf('0x37')]['id']){delete _0x33e037[_0xadbf('0x37')]['id'];}return db[_0xadbf('0x2b')][_0xadbf('0x38')]({'where':{'id':_0x33e037['params']['id']}})['then'](handleEntityNotFound(_0x4de8d9,null))['then'](function(_0x314c34){var _0x3a7aa7=_0x314c34[_0xadbf('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x3a7aa7,_0x33e037[_0xadbf('0x37')]['key']);})[_0xadbf('0x23')](function(_0x1eb67c){if(!_0x1eb67c[_0xadbf('0x3a')]){return saveUpdates(_0x33e037[_0xadbf('0x37')],null);}return _0x1eb67c;})[_0xadbf('0x23')](respondWithResult(_0x4de8d9,null))[_0xadbf('0x36')](handleError(_0x4de8d9,null));};exports['downloadLogFile']=function(_0x3f07ab,_0x473526){var _0x471f8d=_0xadbf('0x3b');var _0x4b8206=path[_0xadbf('0x3c')]('/var',_0xadbf('0x3d'),_0xadbf('0x3e'),_0x471f8d);_0x473526[_0xadbf('0x3f')](_0xadbf('0x40'),'attachment;\x20filename='+_0x471f8d);_0x473526['set']('Content-Type',_0xadbf('0x41'));_0x473526[_0xadbf('0x42')](_0x4b8206);}; \ No newline at end of file +var _0x76d5=['attributes','length','merge','options','getLicense','catch','update','body','find','params','get','checkLicense','key','demo','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','../../config/license/util','index','License','rawAttributes','query','keys','intersection','model','fields'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x76d5,0x1c0));var _0x576d=function(_0x43e4a1,_0x352350){_0x43e4a1=_0x43e4a1-0x0;var _0x3ca7a9=_0x76d5[_0x43e4a1];return _0x3ca7a9;};'use strict';var emlformat=require(_0x576d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x576d('0x1'));var jsonpatch=require(_0x576d('0x2'));var rp=require(_0x576d('0x3'));var moment=require(_0x576d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x576d('0x5'));var util=require('util');var path=require(_0x576d('0x6'));var sox=require(_0x576d('0x7'));var csv=require('to-csv');var ejs=require(_0x576d('0x8'));var fs=require('fs');var fs_extra=require(_0x576d('0x9'));var _=require(_0x576d('0xa'));var squel=require(_0x576d('0xb'));var crypto=require('crypto');var jsforce=require(_0x576d('0xc'));var deskjs=require(_0x576d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x576d('0xe'));var Papa=require(_0x576d('0xf'));var Redis=require(_0x576d('0x10'));var authService=require(_0x576d('0x11'));var qs=require(_0x576d('0x12'));var as=require(_0x576d('0x13'));var hardwareService=require(_0x576d('0x14'));var logger=require(_0x576d('0x15'))(_0x576d('0x16'));var utils=require(_0x576d('0x17'));var config=require(_0x576d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x215090,_0x4cf861){_0x4cf861=_0x4cf861||0xcc;return function(_0x28c442){if(_0x28c442){return _0x215090[_0x576d('0x19')](_0x4cf861);}return _0x215090[_0x576d('0x1a')](_0x4cf861)['end']();};}function respondWithResult(_0x174b59,_0x57294a){_0x57294a=_0x57294a||0xc8;return function(_0x330fd5){if(_0x330fd5){return _0x174b59[_0x576d('0x1a')](_0x57294a)[_0x576d('0x1b')](_0x330fd5);}};}function respondWithFilteredResult(_0x5ed2e0,_0x398181){return function(_0x1cac59){if(_0x1cac59){var _0x1a6edc=typeof _0x398181[_0x576d('0x1c')]===_0x576d('0x1d')&&typeof _0x398181[_0x576d('0x1e')]===_0x576d('0x1d');var _0xa2c562=_0x1cac59[_0x576d('0x1f')];var _0x6c9239=_0x1a6edc?0x0:_0x398181[_0x576d('0x1c')];var _0x439505=_0x1a6edc?_0x1cac59[_0x576d('0x1f')]:_0x398181['offset']+_0x398181[_0x576d('0x1e')];var _0x4d8fdc;if(_0x439505>=_0xa2c562){_0x439505=_0xa2c562;_0x4d8fdc=0xc8;}else{_0x4d8fdc=0xce;}_0x5ed2e0[_0x576d('0x1a')](_0x4d8fdc);return _0x5ed2e0[_0x576d('0x20')]('Content-Range',_0x6c9239+'-'+_0x439505+'/'+_0xa2c562)['json'](_0x1cac59);}return null;};}function patchUpdates(_0x18a21f){return function(_0x3fd3f2){try{jsonpatch[_0x576d('0x21')](_0x3fd3f2,_0x18a21f,!![]);}catch(_0x21f9de){return BPromise[_0x576d('0x22')](_0x21f9de);}return _0x3fd3f2[_0x576d('0x23')]();};}function saveUpdates(_0x21d843,_0x45ec69){return function(_0x3b241c){if(_0x3b241c){return _0x3b241c['update'](_0x21d843)[_0x576d('0x24')](function(_0x5ddb39){return _0x5ddb39;});}return null;};}function removeEntity(_0x3bdb0c,_0x55a4c2){return function(_0x1ed71b){if(_0x1ed71b){return _0x1ed71b[_0x576d('0x25')]()[_0x576d('0x24')](function(){_0x3bdb0c[_0x576d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdec607,_0x5e66fc){return function(_0x1b9a7a){if(!_0x1b9a7a){_0xdec607[_0x576d('0x19')](0x194);}return _0x1b9a7a;};}function handleError(_0x27b294,_0x160d02){_0x160d02=_0x160d02||0x1f4;return function(_0x1bf070){logger[_0x576d('0x26')](_0x1bf070['stack']);if(_0x1bf070[_0x576d('0x27')]){delete _0x1bf070['name'];}_0x27b294[_0x576d('0x1a')](_0x160d02)['send'](_0x1bf070);};}var utilLicense=require(_0x576d('0x28'));exports[_0x576d('0x29')]=function(_0x3b8da1,_0x334a55){var _0x1e82ca={'raw':!![],'where':{'id':0x1}},_0x4840f9={};_0x4840f9['model']=_['keys'](db[_0x576d('0x2a')][_0x576d('0x2b')]);_0x4840f9[_0x576d('0x2c')]=_[_0x576d('0x2d')](_0x3b8da1[_0x576d('0x2c')]);_0x4840f9['filters']=_[_0x576d('0x2e')](_0x4840f9['model'],_0x4840f9[_0x576d('0x2c')]);_0x1e82ca['attributes']=_[_0x576d('0x2e')](_0x4840f9[_0x576d('0x2f')],qs[_0x576d('0x30')](_0x3b8da1[_0x576d('0x2c')][_0x576d('0x30')]));_0x1e82ca[_0x576d('0x31')]=_0x1e82ca[_0x576d('0x31')][_0x576d('0x32')]?_0x1e82ca[_0x576d('0x31')]:_0x4840f9[_0x576d('0x2f')];_0x1e82ca=_[_0x576d('0x33')]({},_0x1e82ca,_0x3b8da1[_0x576d('0x34')]);return utilLicense[_0x576d('0x35')](_0x1e82ca)[_0x576d('0x24')](respondWithResult(_0x334a55,null))[_0x576d('0x36')](handleError(_0x334a55,null));};exports[_0x576d('0x37')]=function(_0x4baa57,_0x2c5b22){if(_0x4baa57[_0x576d('0x38')]['id']){delete _0x4baa57[_0x576d('0x38')]['id'];}return db['License'][_0x576d('0x39')]({'where':{'id':_0x4baa57[_0x576d('0x3a')]['id']}})[_0x576d('0x24')](handleEntityNotFound(_0x2c5b22,null))['then'](function(_0x16567e){var _0x4599b0=_0x16567e[_0x576d('0x3b')]({'plain':!![]});return utilLicense[_0x576d('0x3c')](_0x4599b0,_0x4baa57[_0x576d('0x38')][_0x576d('0x3d')]);})[_0x576d('0x24')](function(_0x16f846){if(!_0x16f846[_0x576d('0x3e')]){return saveUpdates(_0x4baa57[_0x576d('0x38')],null);}return _0x16f846;})[_0x576d('0x24')](respondWithResult(_0x2c5b22,null))[_0x576d('0x36')](handleError(_0x2c5b22,null));};exports['downloadLogFile']=function(_0x40a6b8,_0xa42aed){var _0xfe5844='license-info.log';var _0x5d650a=path[_0x576d('0x3f')]('/var',_0x576d('0x40'),_0x576d('0x41'),_0xfe5844);_0xa42aed[_0x576d('0x42')](_0x576d('0x43'),_0x576d('0x44')+_0xfe5844);_0xa42aed[_0x576d('0x20')](_0x576d('0x45'),_0x576d('0x46'));_0xa42aed['download'](_0x5d650a);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 3f5244b..848fbed 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaba6=['rimraf','../../config/environment','License','license','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4e6d12,_0x51e28c){var _0x45dd07=function(_0x44362b){while(--_0x44362b){_0x4e6d12['push'](_0x4e6d12['shift']());}};_0x45dd07(++_0x51e28c);}(_0xaba6,0x86));var _0x6aba=function(_0xb984a7,_0x564ef9){_0xb984a7=_0xb984a7-0x0;var _0x247044=_0xaba6[_0xb984a7];return _0x247044;};'use strict';var _=require(_0x6aba('0x0'));var util=require('util');var logger=require(_0x6aba('0x1'))(_0x6aba('0x2'));var moment=require('moment');var BPromise=require(_0x6aba('0x3'));var rp=require(_0x6aba('0x4'));var fs=require('fs');var path=require(_0x6aba('0x5'));var rimraf=require(_0x6aba('0x6'));var config=require(_0x6aba('0x7'));var attributes=require('./license.attributes');module['exports']=function(_0x224835,_0x40941){return _0x224835['define'](_0x6aba('0x8'),attributes,{'tableName':_0x6aba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98f2=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./license.attributes','exports','define','util'];(function(_0x4d9767,_0x4a0490){var _0x43bab4=function(_0x140682){while(--_0x140682){_0x4d9767['push'](_0x4d9767['shift']());}};_0x43bab4(++_0x4a0490);}(_0x98f2,0x8b));var _0x298f=function(_0x1e7189,_0x2d1c4f){_0x1e7189=_0x1e7189-0x0;var _0x4e9f23=_0x98f2[_0x1e7189];return _0x4e9f23;};'use strict';var _=require('lodash');var util=require(_0x298f('0x0'));var logger=require(_0x298f('0x1'))('api');var moment=require(_0x298f('0x2'));var BPromise=require(_0x298f('0x3'));var rp=require(_0x298f('0x4'));var fs=require('fs');var path=require(_0x298f('0x5'));var rimraf=require(_0x298f('0x6'));var config=require('../../config/environment');var attributes=require(_0x298f('0x7'));module[_0x298f('0x8')]=function(_0x561e9f,_0x19e482){return _0x561e9f[_0x298f('0x9')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index d2f5223..b959a1a 100644 --- a/server/api/license/license.rpc.js +++ b/server/api/license/license.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef60=['License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x45b473,_0x196ffa){var _0x186ea3=function(_0x321d09){while(--_0x321d09){_0x45b473['push'](_0x45b473['shift']());}};_0x186ea3(++_0x196ffa);}(_0xef60,0x190));var _0x0ef6=function(_0x5d35e6,_0x144b0e){_0x5d35e6=_0x5d35e6-0x0;var _0x57a5a4=_0xef60[_0x5d35e6];return _0x57a5a4;};'use strict';var _=require(_0x0ef6('0x0'));var util=require(_0x0ef6('0x1'));var moment=require(_0x0ef6('0x2'));var BPromise=require(_0x0ef6('0x3'));var rs=require(_0x0ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0ef6('0x5'));var logger=require(_0x0ef6('0x6'))('rpc');var config=require(_0x0ef6('0x7'));var jayson=require(_0x0ef6('0x8'));var client=jayson[_0x0ef6('0x9')][_0x0ef6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x154799,_0xc5aae8,_0x118956){return new BPromise(function(_0x34c57f,_0xc522cb){return client[_0x0ef6('0xb')](_0x154799,_0x118956)[_0x0ef6('0xc')](function(_0x4f5341){logger[_0x0ef6('0xd')](_0x0ef6('0xe'),_0xc5aae8,'request\x20sent');logger['debug'](_0x0ef6('0xf'),_0xc5aae8,_0x0ef6('0x10'),JSON[_0x0ef6('0x11')](_0x4f5341));if(_0x4f5341[_0x0ef6('0x12')]){if(_0x4f5341[_0x0ef6('0x12')][_0x0ef6('0x13')]===0x1f4){logger['error'](_0x0ef6('0xe'),_0xc5aae8,_0x4f5341[_0x0ef6('0x12')]['message']);return _0xc522cb(_0x4f5341[_0x0ef6('0x12')][_0x0ef6('0x14')]);}logger[_0x0ef6('0x12')]('License,\x20%s,\x20%s',_0xc5aae8,_0x4f5341[_0x0ef6('0x12')]['message']);return _0x34c57f(_0x4f5341[_0x0ef6('0x12')]['message']);}else{logger[_0x0ef6('0xd')](_0x0ef6('0xe'),_0xc5aae8,_0x0ef6('0x10'));_0x34c57f(_0x4f5341[_0x0ef6('0x15')]['message']);}})[_0x0ef6('0x16')](function(_0x49ef8a){logger['error'](_0x0ef6('0xe'),_0xc5aae8,_0x49ef8a);_0xc522cb(_0x49ef8a);});});} \ No newline at end of file +var _0xaba4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','License,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xaba4,0x1f0));var _0x4aba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaba4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4aba('0x0'));var util=require(_0x4aba('0x1'));var moment=require(_0x4aba('0x2'));var BPromise=require(_0x4aba('0x3'));var rs=require(_0x4aba('0x4'));var fs=require('fs');var Redis=require(_0x4aba('0x5'));var db=require(_0x4aba('0x6'))['db'];var utils=require(_0x4aba('0x7'));var logger=require(_0x4aba('0x8'))(_0x4aba('0x9'));var config=require(_0x4aba('0xa'));var jayson=require(_0x4aba('0xb'));var client=jayson[_0x4aba('0xc')][_0x4aba('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x238287,_0x4bcc00,_0x5bd29e){return new BPromise(function(_0x5658a9,_0x463b1e){return client[_0x4aba('0xe')](_0x238287,_0x5bd29e)[_0x4aba('0xf')](function(_0x562161){logger[_0x4aba('0x10')]('License,\x20%s,\x20%s',_0x4bcc00,_0x4aba('0x11'));logger[_0x4aba('0x12')]('License,\x20%s,\x20%s,\x20%s',_0x4bcc00,_0x4aba('0x11'),JSON[_0x4aba('0x13')](_0x562161));if(_0x562161[_0x4aba('0x14')]){if(_0x562161[_0x4aba('0x14')][_0x4aba('0x15')]===0x1f4){logger[_0x4aba('0x14')](_0x4aba('0x16'),_0x4bcc00,_0x562161[_0x4aba('0x14')][_0x4aba('0x17')]);return _0x463b1e(_0x562161[_0x4aba('0x14')][_0x4aba('0x17')]);}logger[_0x4aba('0x14')](_0x4aba('0x16'),_0x4bcc00,_0x562161[_0x4aba('0x14')][_0x4aba('0x17')]);return _0x5658a9(_0x562161[_0x4aba('0x14')]['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x4bcc00,_0x4aba('0x11'));_0x5658a9(_0x562161['result'][_0x4aba('0x17')]);}})[_0x4aba('0x18')](function(_0x5d0b51){logger['error']('License,\x20%s,\x20%s',_0x4bcc00,_0x5d0b51);_0x463b1e(_0x5d0b51);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 55136e1..2a037f9 100644 --- a/server/api/mailAccount/index.js +++ b/server/api/mailAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf48=['/:id/verify','/:id/users','getAgents','/:id/dispositions','post','addAnswer','create','addImap','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','getInteractions','getApplications'];(function(_0x53ab1b,_0x52355b){var _0x5d2916=function(_0x30613a){while(--_0x30613a){_0x53ab1b['push'](_0x53ab1b['shift']());}};_0x5d2916(++_0x52355b);}(_0xbf48,0x9b));var _0x8bf4=function(_0x33f8d7,_0x3a1165){_0x33f8d7=_0x33f8d7-0x0;var _0x1364ce=_0xbf48[_0x33f8d7];return _0x1364ce;};'use strict';var multer=require(_0x8bf4('0x0'));var util=require(_0x8bf4('0x1'));var path=require(_0x8bf4('0x2'));var timeout=require(_0x8bf4('0x3'));var express=require('express');var router=express[_0x8bf4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8bf4('0x5'));var config=require(_0x8bf4('0x6'));var controller=require(_0x8bf4('0x7'));router[_0x8bf4('0x8')]('/',auth[_0x8bf4('0x9')](),controller['index']);router['get'](_0x8bf4('0xa'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0xb')]);router[_0x8bf4('0x8')](_0x8bf4('0xc'),auth['isAuthenticated'](),controller[_0x8bf4('0xd')]);router[_0x8bf4('0x8')]('/:id/dispositions',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0xe')]);router[_0x8bf4('0x8')]('/:id/canned_answers',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0xf')]);router[_0x8bf4('0x8')](_0x8bf4('0x10'),auth['isAuthenticated'](),controller['getImap']);router[_0x8bf4('0x8')](_0x8bf4('0x11'),auth[_0x8bf4('0x9')](),controller['getSmtp']);router[_0x8bf4('0x8')](_0x8bf4('0x12'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x13')]);router[_0x8bf4('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8bf4('0x14')]);router[_0x8bf4('0x8')]('/:id/messages',auth[_0x8bf4('0x9')](),controller['getMessages']);router[_0x8bf4('0x8')](_0x8bf4('0x15'),auth[_0x8bf4('0x9')](),controller['verifySmtp']);router[_0x8bf4('0x8')](_0x8bf4('0x16'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x17')]);router['post'](_0x8bf4('0x18'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x8bf4('0x19')]('/:id/canned_answers',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x1a')]);router[_0x8bf4('0x19')]('/',auth['isAuthenticated'](),controller[_0x8bf4('0x1b')]);router[_0x8bf4('0x19')](_0x8bf4('0x10'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x1c')]);router[_0x8bf4('0x19')](_0x8bf4('0x11'),auth[_0x8bf4('0x9')](),controller['addSmtp']);router[_0x8bf4('0x19')](_0x8bf4('0x12'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x1d')]);router[_0x8bf4('0x19')]('/:id/applications',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x1e')]);router[_0x8bf4('0x19')](_0x8bf4('0x1f'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x20')]);router[_0x8bf4('0x19')]('/:id/users',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x21')]);router[_0x8bf4('0x22')]('/:id',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x23')]);router[_0x8bf4('0x24')](_0x8bf4('0x18'),auth[_0x8bf4('0x9')](),controller['removeDispositions']);router[_0x8bf4('0x24')](_0x8bf4('0x25'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x26')]);router['delete'](_0x8bf4('0x10'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x27')]);router[_0x8bf4('0x24')](_0x8bf4('0x11'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x28')]);router['delete']('/:id',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x29')]);router[_0x8bf4('0x24')](_0x8bf4('0x16'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x2a')]);module[_0x8bf4('0x2b')]=router; \ No newline at end of file +var _0x4207=['delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','update'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x4207,0x6a));var _0x7420=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4207[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7420('0x0'));var util=require(_0x7420('0x1'));var path=require(_0x7420('0x2'));var timeout=require('connect-timeout');var express=require(_0x7420('0x3'));var router=express[_0x7420('0x4')]();var fs_extra=require(_0x7420('0x5'));var auth=require(_0x7420('0x6'));var interaction=require(_0x7420('0x7'));var config=require(_0x7420('0x8'));var controller=require(_0x7420('0x9'));router[_0x7420('0xa')]('/',auth[_0x7420('0xb')](),controller[_0x7420('0xc')]);router['get'](_0x7420('0xd'),auth[_0x7420('0xb')](),controller[_0x7420('0xe')]);router['get'](_0x7420('0xf'),auth[_0x7420('0xb')](),controller[_0x7420('0x10')]);router['get'](_0x7420('0x11'),auth[_0x7420('0xb')](),controller[_0x7420('0x12')]);router[_0x7420('0xa')](_0x7420('0x13'),auth[_0x7420('0xb')](),controller[_0x7420('0x14')]);router[_0x7420('0xa')](_0x7420('0x15'),auth[_0x7420('0xb')](),controller[_0x7420('0x16')]);router[_0x7420('0xa')](_0x7420('0x17'),auth[_0x7420('0xb')](),controller['getSmtp']);router[_0x7420('0xa')](_0x7420('0x18'),auth[_0x7420('0xb')](),controller[_0x7420('0x19')]);router[_0x7420('0xa')]('/:id/applications',auth[_0x7420('0xb')](),controller[_0x7420('0x1a')]);router[_0x7420('0xa')](_0x7420('0x1b'),auth[_0x7420('0xb')](),controller['getMessages']);router[_0x7420('0xa')](_0x7420('0x1c'),auth['isAuthenticated'](),controller[_0x7420('0x1d')]);router[_0x7420('0xa')](_0x7420('0x1e'),auth[_0x7420('0xb')](),controller[_0x7420('0x1f')]);router[_0x7420('0x20')](_0x7420('0x11'),auth[_0x7420('0xb')](),controller[_0x7420('0x21')]);router['post'](_0x7420('0x13'),auth[_0x7420('0xb')](),controller[_0x7420('0x22')]);router[_0x7420('0x20')]('/',auth[_0x7420('0xb')](),controller[_0x7420('0x23')]);router[_0x7420('0x20')](_0x7420('0x15'),auth[_0x7420('0xb')](),controller[_0x7420('0x24')]);router[_0x7420('0x20')](_0x7420('0x17'),auth[_0x7420('0xb')](),controller['addSmtp']);router[_0x7420('0x20')](_0x7420('0x18'),auth[_0x7420('0xb')](),controller[_0x7420('0x25')]);router[_0x7420('0x20')](_0x7420('0x26'),auth['isAuthenticated'](),controller[_0x7420('0x27')]);router[_0x7420('0x20')](_0x7420('0x28'),auth[_0x7420('0xb')](),controller[_0x7420('0x29')]);router[_0x7420('0x20')](_0x7420('0x1e'),auth[_0x7420('0xb')](),controller[_0x7420('0x2a')]);router['put']('/:id',auth[_0x7420('0xb')](),controller[_0x7420('0x2b')]);router[_0x7420('0x2c')](_0x7420('0x11'),auth[_0x7420('0xb')](),controller['removeDispositions']);router['delete'](_0x7420('0x13'),auth['isAuthenticated'](),controller[_0x7420('0x2d')]);router[_0x7420('0x2c')](_0x7420('0x15'),auth[_0x7420('0xb')](),controller[_0x7420('0x2e')]);router[_0x7420('0x2c')](_0x7420('0x17'),auth[_0x7420('0xb')](),controller[_0x7420('0x2f')]);router[_0x7420('0x2c')](_0x7420('0xf'),auth[_0x7420('0xb')](),controller[_0x7420('0x30')]);router['delete'](_0x7420('0x1e'),auth[_0x7420('0xb')](),controller[_0x7420('0x31')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a2f3990..d56e6b7 100644 --- a/server/api/mailAccount/mailAccount.attributes.js +++ b/server/api/mailAccount/mailAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90c8=['Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','provider','custom','exports','STRING','BOOLEAN','TEXT'];(function(_0x4be677,_0x376b45){var _0xb4bb3c=function(_0x4ff1d0){while(--_0x4ff1d0){_0x4be677['push'](_0x4be677['shift']());}};_0xb4bb3c(++_0x376b45);}(_0x90c8,0x1eb));var _0x890c=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x90c8[_0x2892da];return _0x28cff2;};'use strict';var Sequelize=require('sequelize');module[_0x890c('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x890c('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x890c('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x890c('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x890c('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x890c('0x1')],'allowNull':![],'defaultValue':_0x890c('0x4')},'fontSize':{'type':Sequelize[_0x890c('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x890c('0x3')],'defaultValue':function(){return _0x890c('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x890c('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x890c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x890c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x890c('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x890c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x890c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x890c('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x890c('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x484769){if(!_0x484769)this[_0x890c('0x7')]('mandatoryDispositionPauseId',null);this[_0x890c('0x7')](_0x890c('0x8'),_0x484769);}},'provider':{'type':Sequelize[_0x890c('0x9')](_0x890c('0xa'),'hotmail',_0x890c('0xb'),_0x890c('0xc')),'defaultValue':null,'get':function(){var _0x4d92ba=this['getDataValue'](_0x890c('0xd'));return _0x4d92ba||_0x890c('0xe');},'set':function(_0x5f0746){if(_0x5f0746===_0x890c('0xe')){_0x5f0746=null;}return this['setDataValue']('provider',_0x5f0746);}}}; \ No newline at end of file +var _0xf30d=['yahoo','outlook365','getDataValue','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf30d,0x70));var _0xdf30=function(_0xad2f8f,_0x1fe6ab){_0xad2f8f=_0xad2f8f-0x0;var _0x492417=_0xf30d[_0xad2f8f];return _0x492417;};'use strict';var Sequelize=require(_0xdf30('0x0'));module[_0xdf30('0x1')]={'description':{'type':Sequelize[_0xdf30('0x2')]},'name':{'type':Sequelize[_0xdf30('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xdf30('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdf30('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xdf30('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xdf30('0x4')]},'markAsUnread':{'type':Sequelize[_0xdf30('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdf30('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdf30('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdf30('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdf30('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdf30('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdf30('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdf30('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdf30('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdf30('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xdf30('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xdf30('0x8'),'set':function(_0x42635d){if(!_0x42635d)this[_0xdf30('0x9')](_0xdf30('0xa'),null);this[_0xdf30('0x9')]('mandatoryDisposition',_0x42635d);}},'provider':{'type':Sequelize[_0xdf30('0xb')](_0xdf30('0xc'),_0xdf30('0xd'),_0xdf30('0xe'),_0xdf30('0xf')),'defaultValue':null,'get':function(){var _0x23b1aa=this[_0xdf30('0x10')]('provider');return _0x23b1aa||_0xdf30('0x11');},'set':function(_0x1ca4b6){if(_0x1ca4b6==='custom'){_0x1ca4b6=null;}return this[_0xdf30('0x9')]('provider',_0x1ca4b6);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 18009d7..bb800d7 100644 --- a/server/api/mailAccount/mailAccount.controller.js +++ b/server/api/mailAccount/mailAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd5=['attach','out','Interaction','verifySmtp','CloudProvider','VerifySmtp','ValidationError','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','moment','util','path','juice','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','get','MailAccounts','end','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','filter','options','includeAll','include','rows','show','Pause','find','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','hasOwnProperty','MailAccountId','findAll','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','key','email','ListId','active','description','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','List','CmContact','Contacts','updatedAt','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','messageId','subject'];(function(_0x2e2393,_0x1d2474){var _0x548b33=function(_0x105522){while(--_0x105522){_0x2e2393['push'](_0x2e2393['shift']());}};_0x548b33(++_0x1d2474);}(_0xedd5,0x18f));var _0x5edd=function(_0x460358,_0x45d45e){_0x460358=_0x460358-0x0;var _0x2e6a60=_0xedd5[_0x460358];return _0x2e6a60;};'use strict';var moment=require(_0x5edd('0x0'));var BPromise=require('bluebird');var util=require(_0x5edd('0x1'));var path=require(_0x5edd('0x2'));var _=require('lodash');var juice=require(_0x5edd('0x3'));var Redis=require('ioredis');var qs=require(_0x5edd('0x4'));var logger=require('../../config/logger')(_0x5edd('0x5'));var config=require(_0x5edd('0x6'));var db=require(_0x5edd('0x7'))['db'];config[_0x5edd('0x8')]=_[_0x5edd('0x9')](config['redis'],{'host':_0x5edd('0xa'),'port':0x18eb});var socket=require(_0x5edd('0xb'))(new Redis(config[_0x5edd('0x8')]));require(_0x5edd('0xc'))['register'](socket);var jayson=require(_0x5edd('0xd'));var client=jayson['client'][_0x5edd('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x531a3b,_0x5f241d,_0x4a4b97,_0x158406){return new BPromise(function(_0x21bedf,_0xb4513d){var _0x3dd543=_0x158406||client;return _0x3dd543[_0x5edd('0xf')](_0x531a3b,_0x4a4b97)[_0x5edd('0x10')](function(_0x3f0245){logger[_0x5edd('0x11')](_0x5edd('0x12'),_0x5f241d,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x5f241d,'request\x20sent',JSON[_0x5edd('0x13')](_0x3f0245));if(_0x3f0245[_0x5edd('0x14')]){if(_0x3f0245[_0x5edd('0x14')][_0x5edd('0x15')]===0x1f4){logger[_0x5edd('0x14')](_0x5edd('0x12'),_0x5f241d,_0x3f0245[_0x5edd('0x14')][_0x5edd('0x16')]);return _0xb4513d(_0x3f0245['error'][_0x5edd('0x16')]);}logger[_0x5edd('0x14')](_0x5edd('0x12'),_0x5f241d,_0x3f0245[_0x5edd('0x14')][_0x5edd('0x16')]);return _0x21bedf(_0x3f0245[_0x5edd('0x14')][_0x5edd('0x16')]);}else{logger[_0x5edd('0x11')](_0x5edd('0x12'),_0x5f241d,_0x5edd('0x17'));_0x21bedf(_0x3f0245[_0x5edd('0x18')][_0x5edd('0x16')]);}})[_0x5edd('0x19')](function(_0x32659b){logger[_0x5edd('0x14')](_0x5edd('0x12'),_0x5f241d,_0x32659b);_0xb4513d(_0x32659b);});});}function respondWithStatusCode(_0x5a9898,_0x3780ee){_0x3780ee=_0x3780ee||0xcc;return function(_0x49afa9){if(_0x49afa9){return _0x5a9898[_0x5edd('0x1a')](_0x3780ee);}return _0x5a9898[_0x5edd('0x1b')](_0x3780ee)['end']();};}function respondWithResult(_0xc437f7,_0x4e19fc){_0x4e19fc=_0x4e19fc||0xc8;return function(_0x3b65d5){if(_0x3b65d5){return _0xc437f7[_0x5edd('0x1b')](_0x4e19fc)[_0x5edd('0x1c')](_0x3b65d5);}};}function respondWithFilteredResult(_0x4b26d4,_0x5efe3b){return function(_0x63b17a){if(_0x63b17a){var _0x328f2b=typeof _0x5efe3b[_0x5edd('0x1d')]===_0x5edd('0x1e')&&typeof _0x5efe3b[_0x5edd('0x1f')]===_0x5edd('0x1e');var _0x4e760b=_0x63b17a[_0x5edd('0x20')];var _0x5c997=_0x328f2b?0x0:_0x5efe3b[_0x5edd('0x1d')];var _0xb46efb=_0x328f2b?_0x63b17a[_0x5edd('0x20')]:_0x5efe3b[_0x5edd('0x1d')]+_0x5efe3b[_0x5edd('0x1f')];var _0x447f86;if(_0xb46efb>=_0x4e760b){_0xb46efb=_0x4e760b;_0x447f86=0xc8;}else{_0x447f86=0xce;}_0x4b26d4['status'](_0x447f86);return _0x4b26d4[_0x5edd('0x21')]('Content-Range',_0x5c997+'-'+_0xb46efb+'/'+_0x4e760b)[_0x5edd('0x1c')](_0x63b17a);}return null;};}function saveUpdates(_0x595a96){return function(_0x57f9f5){if(_0x57f9f5){return _0x57f9f5[_0x5edd('0x22')](_0x595a96)['then'](function(_0x4e700f){return _0x4e700f;});}return null;};}function removeEntity(_0xd70ecc){return function(_0x4a4cfc){if(_0x4a4cfc){return _0x4a4cfc[_0x5edd('0x23')]()['then'](function(){var _0x6299d6=_0x4a4cfc[_0x5edd('0x24')]({'plain':!![]});var _0x239c11=_0x5edd('0x25');return db['UserProfileResource'][_0x5edd('0x23')]({'where':{'type':_0x239c11,'resourceId':_0x6299d6['id']}})[_0x5edd('0x10')](function(){return _0x4a4cfc;});})[_0x5edd('0x10')](function(){_0xd70ecc[_0x5edd('0x1b')](0xcc)[_0x5edd('0x26')]();});}};}function handleEntityNotFound(_0x324f6a){return function(_0x1de687){if(!_0x1de687){_0x324f6a[_0x5edd('0x1a')](0x194);}return _0x1de687;};}function handleError(_0x333b22,_0x560da2){_0x560da2=_0x560da2||0x1f4;return function(_0x2314bb){logger['error'](_0x2314bb[_0x5edd('0x27')]);if(_0x2314bb[_0x5edd('0x28')]){delete _0x2314bb[_0x5edd('0x28')];}_0x333b22[_0x5edd('0x1b')](_0x560da2)[_0x5edd('0x29')](_0x2314bb);};}function getImapHost(_0x3801ab){switch(_0x3801ab){case _0x5edd('0x2a'):return _0x5edd('0x2b');case _0x5edd('0x2c'):return _0x5edd('0x2d');case _0x5edd('0x2e'):return _0x5edd('0x2f');case _0x5edd('0x30'):return _0x5edd('0x31');}throw new Error(_0x5edd('0x32'),_0x3801ab);}function getSmtpHost(_0x138e5a){switch(_0x138e5a){case _0x5edd('0x2a'):return'smtp.gmail.com';case _0x5edd('0x2c'):return _0x5edd('0x33');case _0x5edd('0x2e'):return _0x5edd('0x34');case'outlook365':return _0x5edd('0x35');}throw new Error(_0x5edd('0x32'),_0x138e5a);}function getAuthenticationOptions(_0xb6b8bb,_0x1a2d2e){var _0x598aea={};var _0x2d27ab={};if(_0xb6b8bb){_0x598aea[_0x5edd('0x36')]=_0x2d27ab[_0x5edd('0x36')]=_0x1a2d2e['username'];_0x598aea['password']=_0x2d27ab[_0x5edd('0x37')]=_0x1a2d2e[_0x5edd('0x38')];if(_0x1a2d2e['modernAuthentication']){_0x598aea[_0x5edd('0x39')]=_0x2d27ab[_0x5edd('0x39')]=!![];_0x598aea['CloudProviderId']=_0x2d27ab[_0x5edd('0x3a')]=_0x1a2d2e[_0x5edd('0x3a')];_0x598aea[_0x5edd('0x38')]=_0x2d27ab[_0x5edd('0x37')]=null;}else{_0x598aea[_0x5edd('0x3a')]=_0x2d27ab[_0x5edd('0x3a')]=null;}_0x598aea[_0x5edd('0x3b')]=getImapHost(_0xb6b8bb);_0x598aea['port']=0x3e1;_0x2d27ab[_0x5edd('0x3b')]=getSmtpHost(_0xb6b8bb);_0x2d27ab[_0x5edd('0x3c')]=0x24b;_0x2d27ab[_0x5edd('0x3d')]=![];_0x598aea[_0x5edd('0x3e')]=_0x2d27ab['service']=null;}else{if(_0x1a2d2e[_0x5edd('0x3f')]){_0x598aea[_0x5edd('0x36')]=_0x2d27ab[_0x5edd('0x36')]=_0x1a2d2e['username'];_0x598aea[_0x5edd('0x38')]=_0x2d27ab[_0x5edd('0x37')]=_0x1a2d2e['password'];}else{_0x598aea[_0x5edd('0x3f')]=_0x2d27ab[_0x5edd('0x3f')]=![];_0x598aea[_0x5edd('0x36')]=_0x2d27ab['user']=null;_0x598aea[_0x5edd('0x38')]=_0x2d27ab['pass']=null;}_0x598aea[_0x5edd('0x3b')]=_0x1a2d2e[_0x5edd('0x40')]['host'];_0x598aea['port']=_0x1a2d2e[_0x5edd('0x40')]['port'];_0x2d27ab[_0x5edd('0x3b')]=_0x1a2d2e['Smtp']['host'];_0x2d27ab[_0x5edd('0x3c')]=_0x1a2d2e[_0x5edd('0x41')][_0x5edd('0x3c')];}return{'Imap':_0x598aea,'Smtp':_0x2d27ab};}exports[_0x5edd('0x42')]=function(_0x4ce080,_0xf53308){var _0x391d66={'include':[{'model':db[_0x5edd('0x43')],'as':'Imap'},{'model':db[_0x5edd('0x44')],'as':_0x5edd('0x41')},{'model':db['Pause'],'as':_0x5edd('0x45')}]},_0xe26365={},_0x339b58={'count':0x0,'rows':[]};var _0x5555e5=_[_0x5edd('0x46')](db[_0x5edd('0x47')][_0x5edd('0x48')],function(_0x63d7c1){return{'name':_0x63d7c1['fieldName'],'type':_0x63d7c1[_0x5edd('0x49')]['key']};});_0xe26365['model']=_[_0x5edd('0x46')](_0x5555e5,'name');_0xe26365['query']=_[_0x5edd('0x4a')](_0x4ce080[_0x5edd('0x4b')]);_0xe26365['filters']=_[_0x5edd('0x4c')](_0xe26365[_0x5edd('0x4d')],_0xe26365['query']);_0x391d66[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0xe26365[_0x5edd('0x4d')],qs[_0x5edd('0x4f')](_0x4ce080[_0x5edd('0x4b')]['fields']));_0x391d66['attributes']=_0x391d66[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x391d66[_0x5edd('0x4e')]:_0xe26365[_0x5edd('0x4d')];if(!_0x4ce080[_0x5edd('0x4b')]['hasOwnProperty'](_0x5edd('0x51'))){_0x391d66['limit']=qs['limit'](_0x4ce080[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x391d66[_0x5edd('0x1d')]=qs[_0x5edd('0x1d')](_0x4ce080[_0x5edd('0x4b')][_0x5edd('0x1d')]);}_0x391d66[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x4ce080[_0x5edd('0x4b')][_0x5edd('0x53')]);_0x391d66['where']=qs[_0x5edd('0x54')](_[_0x5edd('0x55')](_0x4ce080[_0x5edd('0x4b')],_0xe26365[_0x5edd('0x54')]),_0x5555e5);if(_0x4ce080[_0x5edd('0x4b')]['filter']){_0x391d66[_0x5edd('0x56')]=_[_0x5edd('0x57')](_0x391d66[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x5555e5,function(_0x2d7abb){if(_0x2d7abb[_0x5edd('0x49')]!=='VIRTUAL'){var _0x3e0be6={};_0x3e0be6[_0x2d7abb[_0x5edd('0x28')]]={'$like':'%'+_0x4ce080[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x3e0be6;}})});}_0x391d66=_[_0x5edd('0x57')]({},_0x391d66,_0x4ce080[_0x5edd('0x59')]);var _0x5d55ce={'where':_0x391d66['where']};return db[_0x5edd('0x47')]['count'](_0x5d55ce)[_0x5edd('0x10')](function(_0x1c6cc7){_0x339b58[_0x5edd('0x20')]=_0x1c6cc7;if(_0x4ce080[_0x5edd('0x4b')][_0x5edd('0x5a')]){_0x391d66[_0x5edd('0x5b')]=[{'all':!![]}];}return db[_0x5edd('0x47')]['findAll'](_0x391d66);})[_0x5edd('0x10')](function(_0xac44e3){_0x339b58[_0x5edd('0x5c')]=_0xac44e3;return _0x339b58;})[_0x5edd('0x10')](respondWithFilteredResult(_0xf53308,_0x391d66))['catch'](handleError(_0xf53308,null));};exports[_0x5edd('0x5d')]=function(_0x3f6499,_0x537a9f){var _0x43eb91={'raw':![],'where':{'id':_0x3f6499['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x5edd('0x40')},{'model':db[_0x5edd('0x44')],'as':_0x5edd('0x41')},{'model':db[_0x5edd('0x5e')],'as':'mandatoryDispositionPause'}]},_0x135ee6={};_0x135ee6['model']=_['keys'](db[_0x5edd('0x47')][_0x5edd('0x48')]);_0x135ee6[_0x5edd('0x4b')]=_['keys'](_0x3f6499['query']);_0x135ee6[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0x135ee6[_0x5edd('0x4d')],_0x135ee6[_0x5edd('0x4b')]);_0x43eb91[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0x135ee6[_0x5edd('0x4d')],qs[_0x5edd('0x4f')](_0x3f6499['query'][_0x5edd('0x4f')]));_0x43eb91[_0x5edd('0x4e')]=_0x43eb91[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x43eb91[_0x5edd('0x4e')]:_0x135ee6[_0x5edd('0x4d')];if(_0x3f6499[_0x5edd('0x4b')][_0x5edd('0x5a')]){_0x43eb91[_0x5edd('0x5b')]=[{'all':!![]}];}_0x43eb91=_[_0x5edd('0x57')]({},_0x43eb91,_0x3f6499[_0x5edd('0x59')]);return db['MailAccount'][_0x5edd('0x5f')](_0x43eb91)[_0x5edd('0x10')](handleEntityNotFound(_0x537a9f,null))[_0x5edd('0x10')](respondWithResult(_0x537a9f,null))[_0x5edd('0x19')](handleError(_0x537a9f,null));};exports[_0x5edd('0x22')]=function(_0x37d31b,_0xbfeaf9){if(_0x37d31b['body']['id']){delete _0x37d31b[_0x5edd('0x60')]['id'];}var _0x77b6a0=_0x37d31b[_0x5edd('0x60')][_0x5edd('0x61')]===_0x5edd('0x62')?null:_0x37d31b[_0x5edd('0x60')][_0x5edd('0x61')];var _0x1c1537=_0x37d31b['body'][_0x5edd('0x40')]||{};var _0xc3eab0=_0x37d31b[_0x5edd('0x60')]['Smtp']||{};if(_0x77b6a0){_0x1c1537[_0x5edd('0x3b')]=getImapHost(_0x77b6a0);_0x1c1537[_0x5edd('0x3c')]=0x3e1;_0xc3eab0[_0x5edd('0x3b')]=getSmtpHost(_0x77b6a0);_0xc3eab0[_0x5edd('0x3c')]=0x24b;_0xc3eab0[_0x5edd('0x3d')]=![];}if(_0xc3eab0[_0x5edd('0x39')]){_0xc3eab0['secure']=![];}else{_0xc3eab0[_0x5edd('0x3a')]=null;}if(!_0x1c1537['modernAuthentication'])_0x1c1537[_0x5edd('0x3a')]=null;_0x37d31b[_0x5edd('0x60')][_0x5edd('0x40')]=_0x1c1537;_0x37d31b['body']['Smtp']=_0xc3eab0;return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x37d31b[_0x5edd('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x5edd('0x40')},{'model':db[_0x5edd('0x44')],'as':_0x5edd('0x41')},{'model':db[_0x5edd('0x5e')],'as':_0x5edd('0x45')}]})[_0x5edd('0x10')](handleEntityNotFound(_0xbfeaf9,null))[_0x5edd('0x10')](function(_0x2e5c5d){if(!_0x2e5c5d)throw new Error(_0x5edd('0x64'));if(_0x2e5c5d[_0x5edd('0x3e')])delete _0x37d31b[_0x5edd('0x60')][_0x5edd('0x40')];return _0x2e5c5d;})[_0x5edd('0x10')](saveUpdates(_0x37d31b[_0x5edd('0x60')],null))[_0x5edd('0x10')](function(_0x26f2af){if(!_0x37d31b[_0x5edd('0x60')]['Imap'])return _0x26f2af;return db[_0x5edd('0x43')][_0x5edd('0x22')](_0x37d31b[_0x5edd('0x60')][_0x5edd('0x40')],{'where':{'MailAccountId':_0x26f2af['id']}})['then'](function(){return _0x26f2af;});})[_0x5edd('0x10')](function(_0x91ffb6){if(!_0x37d31b[_0x5edd('0x60')][_0x5edd('0x41')])return _0x91ffb6;return db['MailServerOut'][_0x5edd('0x22')](_0x37d31b[_0x5edd('0x60')][_0x5edd('0x41')],{'where':{'MailAccountId':_0x91ffb6['id']}})[_0x5edd('0x10')](function(){return _0x91ffb6;});})[_0x5edd('0x10')](respondWithResult(_0xbfeaf9,null))[_0x5edd('0x19')](handleError(_0xbfeaf9,null));};exports[_0x5edd('0x65')]=function(_0x4a94e7,_0xbdf63a){return db[_0x5edd('0x47')][_0x5edd('0x65')]()[_0x5edd('0x10')](respondWithResult(_0xbdf63a,null))['catch'](handleError(_0xbdf63a,null));};exports[_0x5edd('0x66')]=function(_0xd0e669,_0x1a6791){if(_0xd0e669['body']['id']){delete _0xd0e669[_0x5edd('0x60')]['id'];}return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0xd0e669[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x1a6791,null))[_0x5edd('0x10')](function(_0x569ca9){if(_0x569ca9){_0xd0e669[_0x5edd('0x60')]['MailAccountId']=_0x569ca9['id'];return db[_0x5edd('0x67')][_0x5edd('0x68')](_0xd0e669['body']);}})['then'](respondWithResult(_0x1a6791,null))[_0x5edd('0x19')](handleError(_0x1a6791,null));};exports['getDispositions']=function(_0x3e83c0,_0x20cb46){var _0x3417d7={'raw':![],'where':{}};var _0x1b48a5={};var _0x36f87b={'count':0x0,'rows':[]};return db[_0x5edd('0x47')]['findOne']({'where':{'id':_0x3e83c0[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x20cb46,null))[_0x5edd('0x10')](function(_0x650257){if(_0x650257){_0x1b48a5[_0x5edd('0x4d')]=_['keys'](db['Disposition'][_0x5edd('0x48')]);_0x1b48a5[_0x5edd('0x4b')]=_[_0x5edd('0x4a')](_0x3e83c0['query']);_0x1b48a5[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0x1b48a5['model'],_0x1b48a5[_0x5edd('0x4b')]);_0x3417d7['attributes']=_[_0x5edd('0x4c')](_0x1b48a5[_0x5edd('0x4d')],qs['fields'](_0x3e83c0['query']['fields']));_0x3417d7[_0x5edd('0x4e')]=_0x3417d7[_0x5edd('0x4e')]['length']?_0x3417d7['attributes']:_0x1b48a5[_0x5edd('0x4d')];if(!_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x69')](_0x5edd('0x51'))){_0x3417d7[_0x5edd('0x1f')]=qs[_0x5edd('0x1f')](_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x3417d7[_0x5edd('0x1d')]=qs[_0x5edd('0x1d')](_0x3e83c0['query'][_0x5edd('0x1d')]);}_0x3417d7[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x53')]);_0x3417d7[_0x5edd('0x56')]=qs['filters'](_[_0x5edd('0x55')](_0x3e83c0[_0x5edd('0x4b')],_0x1b48a5[_0x5edd('0x54')]));_0x3417d7[_0x5edd('0x56')][_0x5edd('0x6a')]=_0x650257['id'];if(_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x58')]){_0x3417d7[_0x5edd('0x56')]=_[_0x5edd('0x57')](_0x3417d7[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x3417d7['attributes'],function(_0x2804c4){var _0x4c3e7a={};_0x4c3e7a[_0x2804c4]={'$like':'%'+_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x4c3e7a;})});}_0x3417d7=_[_0x5edd('0x57')]({},_0x3417d7,_0x3e83c0[_0x5edd('0x59')]);return db['Disposition'][_0x5edd('0x20')]({'where':_0x3417d7[_0x5edd('0x56')]})['then'](function(_0x3071c8){_0x36f87b[_0x5edd('0x20')]=_0x3071c8;if(_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x5a')]){_0x3417d7[_0x5edd('0x5b')]=[{'all':!![]}];}return db[_0x5edd('0x67')][_0x5edd('0x6b')](_0x3417d7);})['then'](function(_0x1c6a6d){_0x36f87b[_0x5edd('0x5c')]=_0x1c6a6d;return _0x36f87b;});}})[_0x5edd('0x10')](respondWithFilteredResult(_0x20cb46,_0x3417d7))[_0x5edd('0x19')](handleError(_0x20cb46,null));};exports['removeDispositions']=function(_0x5df6a0,_0x213ffb){return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x5df6a0[_0x5edd('0x63')]['id']}})['then'](handleEntityNotFound(_0x213ffb,null))[_0x5edd('0x10')](function(_0x2596d0){if(_0x2596d0){return _0x2596d0['removeDispositions'](_0x5df6a0['query'][_0x5edd('0x6c')]);}})[_0x5edd('0x10')](respondWithStatusCode(_0x213ffb,null))[_0x5edd('0x19')](handleError(_0x213ffb,null));};exports[_0x5edd('0x6d')]=function(_0x1e14ef,_0x108ace){if(_0x1e14ef[_0x5edd('0x60')]['id']){delete _0x1e14ef[_0x5edd('0x60')]['id'];}return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x1e14ef[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x108ace,null))[_0x5edd('0x10')](function(_0x2c1753){if(_0x2c1753){_0x1e14ef[_0x5edd('0x60')][_0x5edd('0x6a')]=_0x2c1753['id'];return db['CannedAnswer'][_0x5edd('0x68')](_0x1e14ef[_0x5edd('0x60')]);}})[_0x5edd('0x10')](respondWithResult(_0x108ace,null))[_0x5edd('0x19')](handleError(_0x108ace,null));};exports[_0x5edd('0x6e')]=function(_0x4b51d7,_0x4931c6){var _0x581dfd={'raw':![],'where':{}};var _0xc16ada={};var _0x37bb96={'count':0x0,'rows':[]};return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0x4b51d7[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x4931c6,null))[_0x5edd('0x10')](function(_0x4c6a14){if(_0x4c6a14){_0xc16ada[_0x5edd('0x4d')]=_[_0x5edd('0x4a')](db[_0x5edd('0x70')][_0x5edd('0x48')]);_0xc16ada[_0x5edd('0x4b')]=_[_0x5edd('0x4a')](_0x4b51d7[_0x5edd('0x4b')]);_0xc16ada[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0xc16ada['model'],_0xc16ada['query']);_0x581dfd[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0xc16ada[_0x5edd('0x4d')],qs[_0x5edd('0x4f')](_0x4b51d7['query'][_0x5edd('0x4f')]));_0x581dfd[_0x5edd('0x4e')]=_0x581dfd[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x581dfd[_0x5edd('0x4e')]:_0xc16ada['model'];if(!_0x4b51d7['query'][_0x5edd('0x69')]('nolimit')){_0x581dfd[_0x5edd('0x1f')]=qs[_0x5edd('0x1f')](_0x4b51d7[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x581dfd['offset']=qs[_0x5edd('0x1d')](_0x4b51d7['query'][_0x5edd('0x1d')]);}_0x581dfd[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x4b51d7['query'][_0x5edd('0x53')]);_0x581dfd['where']=qs[_0x5edd('0x54')](_['pick'](_0x4b51d7[_0x5edd('0x4b')],_0xc16ada[_0x5edd('0x54')]));_0x581dfd['where'][_0x5edd('0x6a')]=_0x4c6a14['id'];if(_0x4b51d7[_0x5edd('0x4b')][_0x5edd('0x58')]){_0x581dfd[_0x5edd('0x56')]=_['merge'](_0x581dfd[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x581dfd[_0x5edd('0x4e')],function(_0x44bd18){var _0x380a41={};_0x380a41[_0x44bd18]={'$like':'%'+_0x4b51d7[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x380a41;})});}_0x581dfd=_[_0x5edd('0x57')]({},_0x581dfd,_0x4b51d7[_0x5edd('0x59')]);return db[_0x5edd('0x70')][_0x5edd('0x20')]({'where':_0x581dfd['where']})[_0x5edd('0x10')](function(_0x447a56){_0x37bb96[_0x5edd('0x20')]=_0x447a56;if(_0x4b51d7[_0x5edd('0x4b')][_0x5edd('0x5a')]){_0x581dfd[_0x5edd('0x5b')]=[{'all':!![]}];}return db[_0x5edd('0x70')][_0x5edd('0x6b')](_0x581dfd);})[_0x5edd('0x10')](function(_0x49ac34){_0x37bb96['rows']=_0x49ac34;return _0x37bb96;});}})['then'](respondWithFilteredResult(_0x4931c6,_0x581dfd))[_0x5edd('0x19')](handleError(_0x4931c6,null));};exports[_0x5edd('0x71')]=function(_0xddff23,_0x51371d){return db[_0x5edd('0x47')]['find']({'where':{'id':_0xddff23['params']['id']}})['then'](handleEntityNotFound(_0x51371d,null))[_0x5edd('0x10')](function(_0x4ddf90){if(_0x4ddf90){return _0x4ddf90[_0x5edd('0x71')](_0xddff23[_0x5edd('0x4b')][_0x5edd('0x6c')]);}})[_0x5edd('0x10')](respondWithStatusCode(_0x51371d,null))[_0x5edd('0x19')](handleError(_0x51371d,null));};exports['create']=function(_0x350c50,_0x585945){var _0x4a67dc={'name':_0x350c50[_0x5edd('0x60')]['name'],'key':_0x350c50['body'][_0x5edd('0x72')],'provider':_0x350c50[_0x5edd('0x60')][_0x5edd('0x61')]==='custom'?null:_0x350c50[_0x5edd('0x60')][_0x5edd('0x61')],'email':_0x350c50[_0x5edd('0x60')][_0x5edd('0x73')],'ListId':_0x350c50[_0x5edd('0x60')][_0x5edd('0x74')],'active':!_['isNil'](_0x350c50[_0x5edd('0x60')][_0x5edd('0x75')])?_0x350c50[_0x5edd('0x60')]['active']:!![],'description':_0x350c50[_0x5edd('0x60')][_0x5edd('0x76')]||null};var _0x873a2b=getAuthenticationOptions(_0x4a67dc[_0x5edd('0x61')],_0x350c50[_0x5edd('0x60')]);_0x4a67dc[_0x5edd('0x40')]=_0x873a2b[_0x5edd('0x40')];_0x4a67dc[_0x5edd('0x41')]=_0x873a2b[_0x5edd('0x41')];return db[_0x5edd('0x47')][_0x5edd('0x68')](_0x4a67dc,{'include':[{'model':db[_0x5edd('0x44')],'as':_0x5edd('0x41')},{'model':db['MailServerIn'],'as':_0x5edd('0x40')}]})[_0x5edd('0x10')](function(_0x49e068){var _0xf4fcad=_0x350c50[_0x5edd('0x36')][_0x5edd('0x24')]({'plain':!![]});if(!_0xf4fcad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf4fcad[_0x5edd('0x77')]===_0x5edd('0x36')){var _0x263c41=_0x49e068[_0x5edd('0x24')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x5edd('0x25'),'userProfileId':_0xf4fcad[_0x5edd('0x78')]},'raw':!![]})[_0x5edd('0x10')](function(_0x11e5a5){if(_0x11e5a5&&_0x11e5a5[_0x5edd('0x79')]===0x0){return db[_0x5edd('0x7a')][_0x5edd('0x68')]({'name':_0x263c41[_0x5edd('0x28')],'resourceId':_0x263c41['id'],'type':_0x11e5a5['name'],'sectionId':_0x11e5a5['id']},{})[_0x5edd('0x10')](function(){return _0x49e068;});}else{return _0x49e068;}})[_0x5edd('0x19')](function(_0x27aab){logger[_0x5edd('0x14')](_0x5edd('0x7b'),_0x27aab);throw _0x27aab;});}return _0x49e068;})[_0x5edd('0x10')](respondWithResult(_0x585945,0xc9))[_0x5edd('0x19')](handleError(_0x585945,null));};exports['getImap']=function(_0x48849f,_0x4b6dd7){return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0x48849f['params']['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x4b6dd7,null))[_0x5edd('0x10')](function(_0x4484bf){if(_0x4484bf){return _0x4484bf[_0x5edd('0x7c')]();}return null;})[_0x5edd('0x10')](respondWithResult(_0x4b6dd7,null))[_0x5edd('0x19')](handleError(_0x4b6dd7,null));};exports[_0x5edd('0x7d')]=function(_0x1ee459,_0x33204b){if(_0x1ee459[_0x5edd('0x60')]['id']){delete _0x1ee459[_0x5edd('0x60')]['id'];}return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x1ee459[_0x5edd('0x63')]['id']}})['then'](handleEntityNotFound(_0x33204b,null))[_0x5edd('0x10')](function(_0x296acb){if(_0x296acb){_0x1ee459[_0x5edd('0x60')]['MailAccountId']=_0x296acb['id'];return db[_0x5edd('0x43')][_0x5edd('0x68')](_0x1ee459[_0x5edd('0x60')]);}})[_0x5edd('0x10')](respondWithResult(_0x33204b,null))[_0x5edd('0x19')](handleError(_0x33204b,null));};exports[_0x5edd('0x7e')]=function(_0x4df390,_0x572b11){return db['MailAccount'][_0x5edd('0x6f')]({'where':{'id':_0x4df390[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x572b11,null))['then'](function(_0x5b0e2e){if(_0x5b0e2e){return _0x5b0e2e[_0x5edd('0x7f')](null);}return null;})[_0x5edd('0x10')](respondWithStatusCode(_0x572b11,null))[_0x5edd('0x19')](handleError(_0x572b11,null));};exports[_0x5edd('0x80')]=function(_0xfb88d0,_0x57d83d){return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0xfb88d0[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x57d83d,null))[_0x5edd('0x10')](function(_0xb495c2){if(_0xb495c2){return _0xb495c2[_0x5edd('0x80')]();}return null;})[_0x5edd('0x10')](respondWithResult(_0x57d83d,null))[_0x5edd('0x19')](handleError(_0x57d83d,null));};exports[_0x5edd('0x81')]=function(_0x5eeb3a,_0x2d36e5){if(_0x5eeb3a[_0x5edd('0x60')]['id']){delete _0x5eeb3a['body']['id'];}return db[_0x5edd('0x47')]['find']({'where':{'id':_0x5eeb3a[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x2d36e5,null))[_0x5edd('0x10')](function(_0x52953e){if(_0x52953e){_0x5eeb3a[_0x5edd('0x60')][_0x5edd('0x6a')]=_0x52953e['id'];return db[_0x5edd('0x44')][_0x5edd('0x68')](_0x5eeb3a[_0x5edd('0x60')]);}})[_0x5edd('0x10')](respondWithResult(_0x2d36e5,null))[_0x5edd('0x19')](handleError(_0x2d36e5,null));};exports[_0x5edd('0x82')]=function(_0x5e5566,_0x288528){return db['MailAccount'][_0x5edd('0x6f')]({'where':{'id':_0x5e5566['params']['id']}})['then'](handleEntityNotFound(_0x288528,null))['then'](function(_0x392e39){if(_0x392e39){return _0x392e39[_0x5edd('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x288528,null))[_0x5edd('0x19')](handleError(_0x288528,null));};exports[_0x5edd('0x84')]=function(_0x48ed82,_0x1d5c4e){return db[_0x5edd('0x85')][_0x5edd('0x5f')]({'where':{'id':_0x48ed82[_0x5edd('0x63')]['id']}})['then'](handleEntityNotFound(_0x1d5c4e,null))['then'](function(_0x1ab4bb){if(_0x1ab4bb){return _0x1ab4bb['addInteraction'](_0x48ed82[_0x5edd('0x60')][_0x5edd('0x6c')],_['omit'](_0x48ed82[_0x5edd('0x60')],['ids','id'])||{});}})[_0x5edd('0x10')](respondWithResult(_0x1d5c4e,null))['catch'](handleError(_0x1d5c4e,null));};exports[_0x5edd('0x86')]=function(_0x42a242,_0x353c3a){var _0x3ba5db={'raw':![],'where':{}};var _0x51156d={};var _0x141917={'count':0x0,'rows':[]};return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0x42a242['params']['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x353c3a,null))[_0x5edd('0x10')](function(_0x5d7cf7){if(_0x5d7cf7){_0x51156d[_0x5edd('0x4d')]=_[_0x5edd('0x4a')](db['MailInteraction'][_0x5edd('0x48')]);_0x51156d['query']=_[_0x5edd('0x4a')](_0x42a242[_0x5edd('0x4b')]);_0x51156d[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0x51156d[_0x5edd('0x4d')],_0x51156d[_0x5edd('0x4b')]);_0x3ba5db[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0x51156d[_0x5edd('0x4d')],qs[_0x5edd('0x4f')](_0x42a242[_0x5edd('0x4b')][_0x5edd('0x4f')]));_0x3ba5db[_0x5edd('0x4e')]=_0x3ba5db[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x3ba5db[_0x5edd('0x4e')]:_0x51156d[_0x5edd('0x4d')];if(!_0x42a242[_0x5edd('0x4b')][_0x5edd('0x69')](_0x5edd('0x51'))){_0x3ba5db[_0x5edd('0x1f')]=qs[_0x5edd('0x1f')](_0x42a242[_0x5edd('0x4b')]['limit']);_0x3ba5db['offset']=qs['offset'](_0x42a242[_0x5edd('0x4b')][_0x5edd('0x1d')]);}_0x3ba5db[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x42a242['query'][_0x5edd('0x53')]);_0x3ba5db[_0x5edd('0x56')]=qs[_0x5edd('0x54')](_[_0x5edd('0x55')](_0x42a242[_0x5edd('0x4b')],_0x51156d['filters']));_0x3ba5db[_0x5edd('0x56')][_0x5edd('0x6a')]=_0x5d7cf7['id'];if(_0x42a242['query'][_0x5edd('0x58')]){_0x3ba5db['where']=_[_0x5edd('0x57')](_0x3ba5db['where'],{'$or':_['map'](_0x3ba5db[_0x5edd('0x4e')],function(_0x4e3bcd){var _0x167284={};_0x167284[_0x4e3bcd]={'$like':'%'+_0x42a242[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x167284;})});}_0x3ba5db=_[_0x5edd('0x57')]({},_0x3ba5db,_0x42a242[_0x5edd('0x59')]);return db[_0x5edd('0x85')][_0x5edd('0x20')]({'where':_0x3ba5db[_0x5edd('0x56')]})['then'](function(_0x2504f2){_0x141917[_0x5edd('0x20')]=_0x2504f2;if(_0x42a242[_0x5edd('0x4b')][_0x5edd('0x5a')]){_0x3ba5db['include']=[{'model':db['CmContact'],'as':_0x5edd('0x87'),'required':![]},{'model':db[_0x5edd('0x88')],'as':_0x5edd('0x89'),'attributes':['name',_0x5edd('0x8a'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x5edd('0x8b'),'attributes':['id',_0x5edd('0x28'),_0x5edd('0x8c')],'where':_0x42a242[_0x5edd('0x4b')][_0x5edd('0x8d')]?{'id':_0x42a242[_0x5edd('0x4b')][_0x5edd('0x8d')]}:undefined,'required':_0x42a242['query'][_0x5edd('0x8d')]?!![]:![]}];}return db[_0x5edd('0x85')][_0x5edd('0x6b')](_0x3ba5db);})['then'](function(_0x38ba6b){_0x141917['rows']=_0x38ba6b;return _0x141917;});}})[_0x5edd('0x10')](respondWithFilteredResult(_0x353c3a,_0x3ba5db))['catch'](handleError(_0x353c3a,null));};exports[_0x5edd('0x8e')]=function addApplications(_0x57c54b,_0x3b9a1f){var _0x4507fb=_0x57c54b[_0x5edd('0x63')]['id'];var _0x1d5baa=_0x57c54b[_0x5edd('0x60')];var _0x418c7b=0xc8;var _0x15bad5=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x5edd('0x8f')][_0x5edd('0x90')][_0x5edd('0x91')][_0x5edd('0x92')]},function(_0x540aa3){return db['MailAccount'][_0x5edd('0x6f')]({'where':{'id':_0x4507fb},'transaction':_0x540aa3})['then'](function(_0x2010da){if(_0x2010da){return db[_0x5edd('0x93')][_0x5edd('0x23')]({'where':{'MailAccountId':_0x4507fb},'transaction':_0x540aa3})[_0x5edd('0x10')](function(){var _0xcc51c3=_[_0x5edd('0x46')](_0x1d5baa,function(_0x5ce24c){_0x5ce24c[_0x5edd('0x6a')]=_0x4507fb;return _0x5ce24c;});return db['MailApplication'][_0x5edd('0x94')](_0xcc51c3,{'transaction':_0x540aa3});});}else{_0x418c7b=0x194;_0x15bad5=[];}});})[_0x5edd('0x10')](function(){if(_0x418c7b!==0x194){return db[_0x5edd('0x93')][_0x5edd('0x95')]({'where':{'MailAccountId':_0x4507fb},'order':'priority'})['then'](function(_0x354887){_0x15bad5=_0x354887;});}})[_0x5edd('0x19')](function(_0x572244){_0x418c7b=0x1f4;logger[_0x5edd('0x14')](_0x572244['stack']);if(_0x572244[_0x5edd('0x28')]){delete _0x572244[_0x5edd('0x28')];}_0x15bad5=_0x572244;})[_0x5edd('0x96')](function(){if(_0x15bad5===null){_0x3b9a1f[_0x5edd('0x1a')](_0x418c7b);}else{if(_0x418c7b===0x1f4){_0x3b9a1f[_0x5edd('0x1b')](_0x418c7b)[_0x5edd('0x29')](_0x15bad5);}else{_0x3b9a1f[_0x5edd('0x1b')](_0x418c7b)[_0x5edd('0x1c')](_0x15bad5);}}});};exports[_0x5edd('0x97')]=function(_0x59d91d,_0x293406){var _0x15a72c={};var _0x4d57bc={};var _0x57a6ea;var _0x2ab52a;return db[_0x5edd('0x47')]['findOne']({'where':{'id':_0x59d91d['params']['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x293406,null))[_0x5edd('0x10')](function(_0x41b34a){if(_0x41b34a){_0x57a6ea=_0x41b34a;_0x4d57bc[_0x5edd('0x4d')]=_['keys'](db['MailApplication'][_0x5edd('0x48')]);_0x4d57bc['query']=_[_0x5edd('0x4a')](_0x59d91d['query']);_0x4d57bc[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0x4d57bc[_0x5edd('0x4d')],_0x4d57bc[_0x5edd('0x4b')]);_0x15a72c[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0x4d57bc['model'],qs['fields'](_0x59d91d[_0x5edd('0x4b')]['fields']));_0x15a72c[_0x5edd('0x4e')]=_0x15a72c[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x15a72c[_0x5edd('0x4e')]:_0x4d57bc[_0x5edd('0x4d')];_0x15a72c[_0x5edd('0x52')]=qs['sort'](_0x59d91d[_0x5edd('0x4b')][_0x5edd('0x53')]);_0x15a72c[_0x5edd('0x56')]=qs[_0x5edd('0x54')](_[_0x5edd('0x55')](_0x59d91d[_0x5edd('0x4b')],_0x4d57bc[_0x5edd('0x54')]));if(_0x59d91d[_0x5edd('0x4b')][_0x5edd('0x58')]){_0x15a72c['where']=_[_0x5edd('0x57')](_0x15a72c[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x15a72c[_0x5edd('0x4e')],function(_0x245250){var _0x271195={};_0x271195[_0x245250]={'$like':'%'+_0x59d91d[_0x5edd('0x4b')]['filter']+'%'};return _0x271195;})});}_0x15a72c=_['merge']({},_0x15a72c,_0x59d91d[_0x5edd('0x59')]);return _0x57a6ea[_0x5edd('0x97')](_0x15a72c);}})['then'](function(_0x4b39ed){if(_0x4b39ed){_0x2ab52a=_0x4b39ed['length'];if(!_0x59d91d[_0x5edd('0x4b')][_0x5edd('0x69')](_0x5edd('0x51'))){_0x15a72c['limit']=qs[_0x5edd('0x1f')](_0x59d91d[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x15a72c[_0x5edd('0x1d')]=qs['offset'](_0x59d91d['query'][_0x5edd('0x1d')]);}return _0x57a6ea[_0x5edd('0x97')](_0x15a72c);}})[_0x5edd('0x10')](function(_0x170355){if(_0x170355){return _0x170355?{'count':_0x2ab52a,'rows':_0x170355}:null;}})[_0x5edd('0x10')](respondWithResult(_0x293406,null))[_0x5edd('0x19')](handleError(_0x293406,null));};exports[_0x5edd('0x98')]=function(_0x5a7676,_0x4e3af5){var _0x973cbf={'raw':!![],'where':{}};var _0x388aed={};var _0x49cf6b={'count':0x0,'rows':[]};return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0x5a7676[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x4e3af5,null))[_0x5edd('0x10')](function(_0x570660){if(_0x570660){_0x388aed[_0x5edd('0x4d')]=_[_0x5edd('0x4a')](db['MailMessage'][_0x5edd('0x48')]);_0x388aed[_0x5edd('0x4b')]=_[_0x5edd('0x4a')](_0x5a7676[_0x5edd('0x4b')]);_0x388aed['filters']=_['intersection'](_0x388aed[_0x5edd('0x4d')],_0x388aed[_0x5edd('0x4b')]);_0x973cbf[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0x388aed[_0x5edd('0x4d')],qs['fields'](_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x4f')]));_0x973cbf[_0x5edd('0x4e')]=_0x973cbf[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x973cbf[_0x5edd('0x4e')]:_0x388aed[_0x5edd('0x4d')];if(!_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x69')](_0x5edd('0x51'))){_0x973cbf[_0x5edd('0x1f')]=qs[_0x5edd('0x1f')](_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x973cbf[_0x5edd('0x1d')]=qs[_0x5edd('0x1d')](_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x1d')]);}_0x973cbf[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x53')]);_0x973cbf[_0x5edd('0x56')]=qs[_0x5edd('0x54')](_[_0x5edd('0x55')](_0x5a7676[_0x5edd('0x4b')],_0x388aed[_0x5edd('0x54')]));_0x973cbf[_0x5edd('0x56')][_0x5edd('0x6a')]=_0x570660['id'];if(_0x5a7676['query'][_0x5edd('0x58')]){_0x973cbf[_0x5edd('0x56')]=_[_0x5edd('0x57')](_0x973cbf[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x973cbf['attributes'],function(_0x4d8b01){var _0x697562={};_0x697562[_0x4d8b01]={'$like':'%'+_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x697562;})});}if(_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x99')]){var _0x206cb2=_0x5a7676[_0x5edd('0x4b')]['$gte'][_0x5edd('0x9a')](',');var _0x2a28f6={};_0x2a28f6[_0x206cb2[0x0]]={'$gte':moment(_0x206cb2[0x1])[_0x5edd('0x9b')](_0x5edd('0x9c'))};_0x973cbf[_0x5edd('0x56')]=_[_0x5edd('0x57')](_0x973cbf[_0x5edd('0x56')],_0x2a28f6);}_0x973cbf=_[_0x5edd('0x57')]({},_0x973cbf,_0x5a7676[_0x5edd('0x59')]);return db[_0x5edd('0x9d')][_0x5edd('0x20')]({'where':_0x973cbf['where']})[_0x5edd('0x10')](function(_0x2a91ea){_0x49cf6b['count']=_0x2a91ea;if(_0x5a7676['query'][_0x5edd('0x5a')]){_0x973cbf['include']=[{'all':!![]}];}return db[_0x5edd('0x9d')]['findAll'](_0x973cbf);})[_0x5edd('0x10')](function(_0x1dce95){if(_0x5a7676[_0x5edd('0x4b')]['inlineCss']===_0x5edd('0x9e')){for(var _0x5d0944=0x0;_0x5d0944<_0x1dce95[_0x5edd('0x50')];_0x5d0944++){_0x1dce95[_0x5d0944][_0x5edd('0x60')]=juice(_0x1dce95[_0x5d0944][_0x5edd('0x60')]);}}_0x49cf6b['rows']=_0x1dce95;return _0x49cf6b;});}})[_0x5edd('0x10')](respondWithFilteredResult(_0x4e3af5,_0x973cbf))['catch'](handleError(_0x4e3af5,null));};exports[_0x5edd('0x29')]=function(_0x65acfc,_0x1b6b2d){var _0x22db91,_0x1fcb81={},_0x3b63b6;if(_0x65acfc[_0x5edd('0x60')]['to']){_0x3b63b6=_0x65acfc['body']['to']['split'](',')[0x0];}return db[_0x5edd('0x47')]['find']({'where':{'id':_0x65acfc[_0x5edd('0x63')]['id']},'include':[{'model':db[_0x5edd('0x9f')],'as':_0x5edd('0xa0'),'include':[{'model':db[_0x5edd('0xa1')],'as':_0x5edd('0xa2'),'where':{'email':_0x3b63b6},'limit':0x1,'order':[[_0x5edd('0xa3'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x5edd('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x5edd('0x10')](handleEntityNotFound(_0x1b6b2d,null))['then'](function(_0x25f3a8){if(!_0x25f3a8)return;_0x22db91=_0x25f3a8;if(!_0x25f3a8['Smtp'])throw new Error(_0x5edd('0xa4'));if(_[_0x5edd('0xa5')](_0x65acfc['body'][_0x5edd('0xa6')])){_0x65acfc[_0x5edd('0x60')]['from']=util['format'](_0x5edd('0xa7'),_0x25f3a8[_0x5edd('0x28')],_0x25f3a8[_0x5edd('0x73')]||_0x25f3a8[_0x5edd('0x41')][_0x5edd('0x36')]);}if(_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')]&&_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')][_0x5edd('0x50')]){for(var _0x3a7d4b=0x0;_0x3a7d4b<_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')][_0x5edd('0x50')];_0x3a7d4b+=0x1){_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')][_0x3a7d4b]={'filename':_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')][_0x3a7d4b][_0x5edd('0x28')],'path':path[_0x5edd('0xa9')](config[_0x5edd('0xaa')],_0x5edd('0xab'),_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')][_0x3a7d4b][_0x5edd('0xac')])};}}var _0x5d004c=_0x25f3a8[_0x5edd('0xad')]();return respondWithRpcPromise(_0x5edd('0xae'),'sendMail',{'account':_0x5d004c,'message':_0x65acfc['body']});})[_0x5edd('0x10')](function(_0xf1ed22){if(!_0xf1ed22)return;_0x1fcb81=_0xf1ed22;if(!_0x22db91['List'])throw new Error('List\x20not\x20found');if(_0x22db91[_0x5edd('0xa0')]['Contacts'][_0x5edd('0x50')])return _0x22db91['List']['Contacts'][0x0];return db['CmContact'][_0x5edd('0x68')](_['defaults'](_0x65acfc[_0x5edd('0x60')],{'firstName':_0x65acfc[_0x5edd('0x60')]['to'],'email':_0x65acfc['body']['to'],'phone':_0x65acfc[_0x5edd('0x60')]['to'],'ListId':_0x22db91[_0x5edd('0x74')]}));})[_0x5edd('0x10')](function(_0x1d7ce2){if(!_0x1d7ce2)return;var _0x47ceb2={'UserId':_0x65acfc[_0x5edd('0x36')]['id'],'ContactId':_0x1d7ce2['id'],'MailAccountId':_0x22db91['id'],'inReplyTo':_0x1fcb81[_0x5edd('0xaf')],'to':_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa6')],'cc':_0x65acfc['body']['cc'],'subject':_0x65acfc[_0x5edd('0x60')][_0x5edd('0xb0')],'attach':_0x65acfc[_0x5edd('0x60')][_0x5edd('0xb1')],'firstMsgDirection':_0x5edd('0xb2'),'lastMsgAt':moment()['format'](_0x5edd('0x9c')),'lastMsgDirection':'out','Messages':[_[_0x5edd('0x57')](_0x65acfc[_0x5edd('0x60')],{'messageId':_0x1fcb81[_0x5edd('0xaf')],'sentAt':moment()['format'](_0x5edd('0x9c')),'read':!![],'MailAccountId':_0x22db91['id'],'UserId':_0x65acfc['user']['id'],'ContactId':_0x1d7ce2['id']})]};if(_0x65acfc['body'][_0x5edd('0xb3')]){_0x47ceb2=_[_0x5edd('0x57')](_0x47ceb2,_0x65acfc[_0x5edd('0x60')][_0x5edd('0xb3')]);}return db[_0x5edd('0x85')]['create'](_0x47ceb2,{'include':[{'model':db[_0x5edd('0x9d')],'as':'Messages'}]});})['then'](respondWithResult(_0x1b6b2d,null))[_0x5edd('0x19')](handleError(_0x1b6b2d,null));};exports[_0x5edd('0xb4')]=function(_0x1ec4af,_0x366fa7){return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x1ec4af[_0x5edd('0x63')]['id']},'include':[{'model':db[_0x5edd('0x44')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x5edd('0xb5')],'as':_0x5edd('0xb5'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x366fa7,null))['then'](function(_0x277bc8){if(!_0x277bc8[_0x5edd('0x41')])return;var _0x54ef89=_0x277bc8[_0x5edd('0xad')]();return respondWithRpcPromise(_0x5edd('0xb6'),'verifySmtp',{'account':_0x54ef89});})[_0x5edd('0x10')](respondWithResult(_0x366fa7,null))[_0x5edd('0x19')](handleError(_0x366fa7,null));};exports[_0x5edd('0x23')]=function(_0x373272,_0x288b1e){return db['MailAccount'][_0x5edd('0x5f')]({'where':{'id':_0x373272[_0x5edd('0x63')]['id']}})['then'](handleEntityNotFound(_0x288b1e,null))['then'](function(_0x53f591){if(_0x53f591&&_0x53f591[_0x5edd('0x3e')]){throw new db['Sequelize'][(_0x5edd('0xb7'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x53f591;})[_0x5edd('0x10')](removeEntity(_0x288b1e,null))[_0x5edd('0x19')](handleError(_0x288b1e,null));};exports[_0x5edd('0xb8')]=function(_0x4c5d69,_0x1c03af){return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x4c5d69[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x1c03af,null))['then'](function(_0x3d23ab){if(_0x3d23ab){return _0x3d23ab['addAgents'](_0x4c5d69['body']['ids'],_[_0x5edd('0xb9')](_0x4c5d69[_0x5edd('0x60')],[_0x5edd('0x6c'),'id'])||{})[_0x5edd('0xba')](function(_0x67055c){for(var _0x3f8744=0x0;_0x3f8744<_0x4c5d69[_0x5edd('0x60')][_0x5edd('0x6c')][_0x5edd('0x50')];_0x3f8744+=0x1){socket[_0x5edd('0xbb')](_0x5edd('0xbc'),{'UserId':Number(_0x4c5d69[_0x5edd('0x60')]['ids'][_0x3f8744]),'MailAccountId':Number(_0x4c5d69[_0x5edd('0x63')]['id'])});}return _0x67055c;});}})[_0x5edd('0x10')](respondWithResult(_0x1c03af,null))['catch'](handleError(_0x1c03af,null));};exports['removeAgents']=function(_0x22bc7d,_0x4c8ade){return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x22bc7d['params']['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x4c8ade,null))['then'](function(_0x2aebf9){if(_0x2aebf9){return _0x2aebf9[_0x5edd('0xbd')](_0x22bc7d[_0x5edd('0x4b')][_0x5edd('0x6c')])[_0x5edd('0x10')](function(){if(_[_0x5edd('0xbe')](_0x22bc7d[_0x5edd('0x4b')][_0x5edd('0x6c')])){for(var _0x2e1270=0x0;_0x2e1270<_0x22bc7d['query'][_0x5edd('0x6c')][_0x5edd('0x50')];_0x2e1270+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x22bc7d[_0x5edd('0x4b')][_0x5edd('0x6c')][_0x2e1270]),'MailAccountId':Number(_0x22bc7d[_0x5edd('0x63')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x22bc7d[_0x5edd('0x4b')]['ids']),'MailAccountId':Number(_0x22bc7d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4c8ade,null))['catch'](handleError(_0x4c8ade,null));};exports[_0x5edd('0xbf')]=function(_0x1730f4,_0x71524f){var _0x5ce76f={};var _0x1ec850={};var _0xa3eee8;var _0x3e841e;return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0x1730f4['params']['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x71524f,null))[_0x5edd('0x10')](function(_0x1c7406){if(_0x1c7406){_0xa3eee8=_0x1c7406;_0x1ec850['model']=_[_0x5edd('0x4a')](db['User']['rawAttributes']);_0x1ec850[_0x5edd('0x4b')]=_['keys'](_0x1730f4[_0x5edd('0x4b')]);_0x1ec850[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0x1ec850['model'],_0x1ec850[_0x5edd('0x4b')]);_0x5ce76f[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0x1ec850[_0x5edd('0x4d')],qs[_0x5edd('0x4f')](_0x1730f4[_0x5edd('0x4b')][_0x5edd('0x4f')]));_0x5ce76f[_0x5edd('0x4e')]=_0x5ce76f[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x5ce76f[_0x5edd('0x4e')]:_0x1ec850[_0x5edd('0x4d')];_0x5ce76f[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x1730f4[_0x5edd('0x4b')]['sort']);_0x5ce76f[_0x5edd('0x56')]=qs['filters'](_['pick'](_0x1730f4[_0x5edd('0x4b')],_0x1ec850['filters']));if(_0x1730f4[_0x5edd('0x4b')][_0x5edd('0x58')]){_0x5ce76f[_0x5edd('0x56')]=_['merge'](_0x5ce76f[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x5ce76f['attributes'],function(_0x5f02c1){var _0x4dddc9={};_0x4dddc9[_0x5f02c1]={'$like':'%'+_0x1730f4[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x4dddc9;})});}_0x5ce76f=_[_0x5edd('0x57')]({},_0x5ce76f,_0x1730f4[_0x5edd('0x59')]);return _0xa3eee8[_0x5edd('0xbf')](_0x5ce76f);}})[_0x5edd('0x10')](function(_0x4188d1){if(_0x4188d1){_0x3e841e=_0x4188d1[_0x5edd('0x50')];if(!_0x1730f4[_0x5edd('0x4b')][_0x5edd('0x69')](_0x5edd('0x51'))){_0x5ce76f[_0x5edd('0x1f')]=qs[_0x5edd('0x1f')](_0x1730f4[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x5ce76f['offset']=qs[_0x5edd('0x1d')](_0x1730f4['query'][_0x5edd('0x1d')]);}return _0xa3eee8['getAgents'](_0x5ce76f);}})[_0x5edd('0x10')](function(_0x3bb373){if(_0x3bb373){return _0x3bb373?{'count':_0x3e841e,'rows':_0x3bb373}:null;}})['then'](respondWithResult(_0x71524f,null))[_0x5edd('0x19')](handleError(_0x71524f,null));}; \ No newline at end of file +var _0x6358=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MailAccount','findAll','rows','show','params','MailServerIn','includeAll','include','find','body','provider','custom','modernAuthentication','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','findOne','rawAttributes','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','length','CmContact','Contact','User','Owner','internal','Tag','Tags','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','destroy','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','juice','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','offset','limit','undefined','count','Content-Range','json','update','then','get','UserProfileResource','end','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','CloudProviderId','password','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','map','fieldName','key','model','query','keys','filters','intersection'];(function(_0x1f71d8,_0x278518){var _0x10b045=function(_0x57aea4){while(--_0x57aea4){_0x1f71d8['push'](_0x1f71d8['shift']());}};_0x10b045(++_0x278518);}(_0x6358,0x77));var _0x8635=function(_0x462803,_0x4c17b2){_0x462803=_0x462803-0x0;var _0x46217c=_0x6358[_0x462803];return _0x46217c;};'use strict';var moment=require(_0x8635('0x0'));var BPromise=require(_0x8635('0x1'));var util=require('util');var path=require(_0x8635('0x2'));var _=require('lodash');var juice=require(_0x8635('0x3'));var Redis=require('ioredis');var qs=require(_0x8635('0x4'));var logger=require(_0x8635('0x5'))(_0x8635('0x6'));var config=require('../../config/environment');var db=require(_0x8635('0x7'))['db'];config[_0x8635('0x8')]=_[_0x8635('0x9')](config['redis'],{'host':_0x8635('0xa'),'port':0x18eb});var socket=require(_0x8635('0xb'))(new Redis(config[_0x8635('0x8')]));require(_0x8635('0xc'))['register'](socket);var jayson=require(_0x8635('0xd'));var client=jayson[_0x8635('0xe')][_0x8635('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x53ccc2,_0x10b767,_0x14938f,_0x183e4f){return new BPromise(function(_0x5ba5e7,_0x224547){var _0x3bf1d0=_0x183e4f||client;return _0x3bf1d0['request'](_0x53ccc2,_0x14938f)['then'](function(_0x5742c5){logger['info'](_0x8635('0x10'),_0x10b767,_0x8635('0x11'));logger[_0x8635('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x10b767,_0x8635('0x11'),JSON[_0x8635('0x13')](_0x5742c5));if(_0x5742c5[_0x8635('0x14')]){if(_0x5742c5['error'][_0x8635('0x15')]===0x1f4){logger[_0x8635('0x14')](_0x8635('0x10'),_0x10b767,_0x5742c5[_0x8635('0x14')]['message']);return _0x224547(_0x5742c5['error'][_0x8635('0x16')]);}logger[_0x8635('0x14')](_0x8635('0x10'),_0x10b767,_0x5742c5['error'][_0x8635('0x16')]);return _0x5ba5e7(_0x5742c5[_0x8635('0x14')][_0x8635('0x16')]);}else{logger[_0x8635('0x17')](_0x8635('0x10'),_0x10b767,_0x8635('0x11'));_0x5ba5e7(_0x5742c5[_0x8635('0x18')][_0x8635('0x16')]);}})[_0x8635('0x19')](function(_0x4f11e0){logger[_0x8635('0x14')](_0x8635('0x10'),_0x10b767,_0x4f11e0);_0x224547(_0x4f11e0);});});}function respondWithStatusCode(_0x4ff5eb,_0x589e83){_0x589e83=_0x589e83||0xcc;return function(_0x43d10e){if(_0x43d10e){return _0x4ff5eb[_0x8635('0x1a')](_0x589e83);}return _0x4ff5eb['status'](_0x589e83)['end']();};}function respondWithResult(_0x22e76a,_0xa1c347){_0xa1c347=_0xa1c347||0xc8;return function(_0x1036b3){if(_0x1036b3){return _0x22e76a[_0x8635('0x1b')](_0xa1c347)['json'](_0x1036b3);}};}function respondWithFilteredResult(_0x3b55fd,_0x2fb7fd){return function(_0x190647){if(_0x190647){var _0x5a5f94=typeof _0x2fb7fd[_0x8635('0x1c')]==='undefined'&&typeof _0x2fb7fd[_0x8635('0x1d')]===_0x8635('0x1e');var _0x2ccaa3=_0x190647[_0x8635('0x1f')];var _0x168297=_0x5a5f94?0x0:_0x2fb7fd[_0x8635('0x1c')];var _0x267871=_0x5a5f94?_0x190647[_0x8635('0x1f')]:_0x2fb7fd[_0x8635('0x1c')]+_0x2fb7fd[_0x8635('0x1d')];var _0x38d3f2;if(_0x267871>=_0x2ccaa3){_0x267871=_0x2ccaa3;_0x38d3f2=0xc8;}else{_0x38d3f2=0xce;}_0x3b55fd[_0x8635('0x1b')](_0x38d3f2);return _0x3b55fd['set'](_0x8635('0x20'),_0x168297+'-'+_0x267871+'/'+_0x2ccaa3)[_0x8635('0x21')](_0x190647);}return null;};}function saveUpdates(_0x2c88b0){return function(_0x4c6b30){if(_0x4c6b30){return _0x4c6b30[_0x8635('0x22')](_0x2c88b0)['then'](function(_0x48ebed){return _0x48ebed;});}return null;};}function removeEntity(_0x2a8f31){return function(_0xb35fd3){if(_0xb35fd3){return _0xb35fd3['destroy']()[_0x8635('0x23')](function(){var _0x5c286c=_0xb35fd3[_0x8635('0x24')]({'plain':!![]});var _0x54e676='MailAccounts';return db[_0x8635('0x25')]['destroy']({'where':{'type':_0x54e676,'resourceId':_0x5c286c['id']}})[_0x8635('0x23')](function(){return _0xb35fd3;});})['then'](function(){_0x2a8f31['status'](0xcc)[_0x8635('0x26')]();});}};}function handleEntityNotFound(_0x281544){return function(_0x3f5ab9){if(!_0x3f5ab9){_0x281544[_0x8635('0x1a')](0x194);}return _0x3f5ab9;};}function handleError(_0x3053f3,_0x4faf49){_0x4faf49=_0x4faf49||0x1f4;return function(_0x18388e){logger[_0x8635('0x14')](_0x18388e[_0x8635('0x27')]);if(_0x18388e[_0x8635('0x28')]){delete _0x18388e['name'];}_0x3053f3['status'](_0x4faf49)[_0x8635('0x29')](_0x18388e);};}function getImapHost(_0x5001af){switch(_0x5001af){case _0x8635('0x2a'):return _0x8635('0x2b');case _0x8635('0x2c'):return _0x8635('0x2d');case _0x8635('0x2e'):return _0x8635('0x2f');case _0x8635('0x30'):return _0x8635('0x31');}throw new Error(_0x8635('0x32'),_0x5001af);}function getSmtpHost(_0x423161){switch(_0x423161){case _0x8635('0x2a'):return _0x8635('0x33');case _0x8635('0x2c'):return _0x8635('0x34');case _0x8635('0x2e'):return _0x8635('0x35');case'outlook365':return _0x8635('0x36');}throw new Error(_0x8635('0x32'),_0x423161);}function getAuthenticationOptions(_0x2c1602,_0x2de917){var _0x31ea72={};var _0x4fe3d7={};if(_0x2c1602){_0x31ea72[_0x8635('0x37')]=_0x4fe3d7[_0x8635('0x37')]=_0x2de917[_0x8635('0x38')];_0x31ea72['password']=_0x4fe3d7[_0x8635('0x39')]=_0x2de917['password'];if(_0x2de917['modernAuthentication']){_0x31ea72['modernAuthentication']=_0x4fe3d7['modernAuthentication']=!![];_0x31ea72['CloudProviderId']=_0x4fe3d7[_0x8635('0x3a')]=_0x2de917[_0x8635('0x3a')];_0x31ea72[_0x8635('0x3b')]=_0x4fe3d7[_0x8635('0x39')]=null;}else{_0x31ea72['CloudProviderId']=_0x4fe3d7['CloudProviderId']=null;}_0x31ea72[_0x8635('0x3c')]=getImapHost(_0x2c1602);_0x31ea72[_0x8635('0x3d')]=0x3e1;_0x4fe3d7[_0x8635('0x3c')]=getSmtpHost(_0x2c1602);_0x4fe3d7[_0x8635('0x3d')]=0x24b;_0x4fe3d7[_0x8635('0x3e')]=![];_0x31ea72[_0x8635('0x3f')]=_0x4fe3d7[_0x8635('0x3f')]=null;}else{if(_0x2de917[_0x8635('0x40')]){_0x31ea72[_0x8635('0x37')]=_0x4fe3d7[_0x8635('0x37')]=_0x2de917[_0x8635('0x38')];_0x31ea72['password']=_0x4fe3d7[_0x8635('0x39')]=_0x2de917[_0x8635('0x3b')];}else{_0x31ea72[_0x8635('0x40')]=_0x4fe3d7[_0x8635('0x40')]=![];_0x31ea72[_0x8635('0x37')]=_0x4fe3d7[_0x8635('0x37')]=null;_0x31ea72[_0x8635('0x3b')]=_0x4fe3d7[_0x8635('0x39')]=null;}_0x31ea72[_0x8635('0x3c')]=_0x2de917[_0x8635('0x41')]['host'];_0x31ea72['port']=_0x2de917[_0x8635('0x41')]['port'];_0x4fe3d7['host']=_0x2de917[_0x8635('0x42')][_0x8635('0x3c')];_0x4fe3d7[_0x8635('0x3d')]=_0x2de917[_0x8635('0x42')][_0x8635('0x3d')];}return{'Imap':_0x31ea72,'Smtp':_0x4fe3d7};}exports[_0x8635('0x43')]=function(_0x50be3c,_0xd47610){var _0x542b4b={'include':[{'model':db['MailServerIn'],'as':_0x8635('0x41')},{'model':db[_0x8635('0x44')],'as':_0x8635('0x42')},{'model':db[_0x8635('0x45')],'as':'mandatoryDispositionPause'}]},_0xd19c1={},_0x123e97={'count':0x0,'rows':[]};var _0x3e3f3a=_[_0x8635('0x46')](db['MailAccount']['rawAttributes'],function(_0x470671){return{'name':_0x470671[_0x8635('0x47')],'type':_0x470671['type'][_0x8635('0x48')]};});_0xd19c1[_0x8635('0x49')]=_['map'](_0x3e3f3a,_0x8635('0x28'));_0xd19c1[_0x8635('0x4a')]=_[_0x8635('0x4b')](_0x50be3c[_0x8635('0x4a')]);_0xd19c1[_0x8635('0x4c')]=_[_0x8635('0x4d')](_0xd19c1[_0x8635('0x49')],_0xd19c1[_0x8635('0x4a')]);_0x542b4b[_0x8635('0x4e')]=_[_0x8635('0x4d')](_0xd19c1[_0x8635('0x49')],qs['fields'](_0x50be3c['query'][_0x8635('0x4f')]));_0x542b4b[_0x8635('0x4e')]=_0x542b4b[_0x8635('0x4e')]['length']?_0x542b4b['attributes']:_0xd19c1[_0x8635('0x49')];if(!_0x50be3c[_0x8635('0x4a')][_0x8635('0x50')](_0x8635('0x51'))){_0x542b4b[_0x8635('0x1d')]=qs[_0x8635('0x1d')](_0x50be3c['query'][_0x8635('0x1d')]);_0x542b4b[_0x8635('0x1c')]=qs[_0x8635('0x1c')](_0x50be3c[_0x8635('0x4a')]['offset']);}_0x542b4b[_0x8635('0x52')]=qs['sort'](_0x50be3c[_0x8635('0x4a')][_0x8635('0x53')]);_0x542b4b[_0x8635('0x54')]=qs[_0x8635('0x4c')](_[_0x8635('0x55')](_0x50be3c[_0x8635('0x4a')],_0xd19c1[_0x8635('0x4c')]),_0x3e3f3a);if(_0x50be3c[_0x8635('0x4a')][_0x8635('0x56')]){_0x542b4b['where']=_[_0x8635('0x57')](_0x542b4b[_0x8635('0x54')],{'$or':_[_0x8635('0x46')](_0x3e3f3a,function(_0x8a9351){if(_0x8a9351[_0x8635('0x58')]!==_0x8635('0x59')){var _0x36edf4={};_0x36edf4[_0x8a9351[_0x8635('0x28')]]={'$like':'%'+_0x50be3c[_0x8635('0x4a')]['filter']+'%'};return _0x36edf4;}})});}_0x542b4b=_[_0x8635('0x57')]({},_0x542b4b,_0x50be3c[_0x8635('0x5a')]);var _0x692768={'where':_0x542b4b[_0x8635('0x54')]};return db[_0x8635('0x5b')][_0x8635('0x1f')](_0x692768)[_0x8635('0x23')](function(_0x5cab5a){_0x123e97['count']=_0x5cab5a;if(_0x50be3c[_0x8635('0x4a')]['includeAll']){_0x542b4b['include']=[{'all':!![]}];}return db[_0x8635('0x5b')][_0x8635('0x5c')](_0x542b4b);})[_0x8635('0x23')](function(_0x4fce31){_0x123e97[_0x8635('0x5d')]=_0x4fce31;return _0x123e97;})[_0x8635('0x23')](respondWithFilteredResult(_0xd47610,_0x542b4b))[_0x8635('0x19')](handleError(_0xd47610,null));};exports[_0x8635('0x5e')]=function(_0x4dfa98,_0x2453aa){var _0x3270f5={'raw':![],'where':{'id':_0x4dfa98[_0x8635('0x5f')]['id']},'include':[{'model':db[_0x8635('0x60')],'as':_0x8635('0x41')},{'model':db[_0x8635('0x44')],'as':_0x8635('0x42')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x21a6ec={};_0x21a6ec['model']=_['keys'](db[_0x8635('0x5b')]['rawAttributes']);_0x21a6ec[_0x8635('0x4a')]=_[_0x8635('0x4b')](_0x4dfa98['query']);_0x21a6ec['filters']=_[_0x8635('0x4d')](_0x21a6ec[_0x8635('0x49')],_0x21a6ec['query']);_0x3270f5[_0x8635('0x4e')]=_['intersection'](_0x21a6ec['model'],qs[_0x8635('0x4f')](_0x4dfa98['query'][_0x8635('0x4f')]));_0x3270f5[_0x8635('0x4e')]=_0x3270f5[_0x8635('0x4e')]['length']?_0x3270f5[_0x8635('0x4e')]:_0x21a6ec[_0x8635('0x49')];if(_0x4dfa98[_0x8635('0x4a')][_0x8635('0x61')]){_0x3270f5[_0x8635('0x62')]=[{'all':!![]}];}_0x3270f5=_[_0x8635('0x57')]({},_0x3270f5,_0x4dfa98[_0x8635('0x5a')]);return db[_0x8635('0x5b')][_0x8635('0x63')](_0x3270f5)[_0x8635('0x23')](handleEntityNotFound(_0x2453aa,null))[_0x8635('0x23')](respondWithResult(_0x2453aa,null))['catch'](handleError(_0x2453aa,null));};exports['update']=function(_0x188cd0,_0x41a9a1){if(_0x188cd0[_0x8635('0x64')]['id']){delete _0x188cd0[_0x8635('0x64')]['id'];}var _0x71ba8c=_0x188cd0[_0x8635('0x64')][_0x8635('0x65')]===_0x8635('0x66')?null:_0x188cd0[_0x8635('0x64')]['provider'];var _0x522fbe=_0x188cd0[_0x8635('0x64')][_0x8635('0x41')]||{};var _0x276547=_0x188cd0[_0x8635('0x64')]['Smtp']||{};if(_0x71ba8c){_0x522fbe['host']=getImapHost(_0x71ba8c);_0x522fbe[_0x8635('0x3d')]=0x3e1;_0x276547['host']=getSmtpHost(_0x71ba8c);_0x276547[_0x8635('0x3d')]=0x24b;_0x276547[_0x8635('0x3e')]=![];}if(_0x276547[_0x8635('0x67')]){_0x276547['secure']=![];}else{_0x276547[_0x8635('0x3a')]=null;}if(!_0x522fbe['modernAuthentication'])_0x522fbe[_0x8635('0x3a')]=null;_0x188cd0[_0x8635('0x64')][_0x8635('0x41')]=_0x522fbe;_0x188cd0['body'][_0x8635('0x42')]=_0x276547;return db[_0x8635('0x5b')]['find']({'where':{'id':_0x188cd0[_0x8635('0x5f')]['id']},'include':[{'model':db[_0x8635('0x60')],'as':'Imap'},{'model':db[_0x8635('0x44')],'as':_0x8635('0x42')},{'model':db[_0x8635('0x45')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x41a9a1,null))[_0x8635('0x23')](function(_0x4b888c){if(!_0x4b888c)throw new Error(_0x8635('0x68'));if(_0x4b888c[_0x8635('0x3f')])delete _0x188cd0[_0x8635('0x64')][_0x8635('0x41')];return _0x4b888c;})[_0x8635('0x23')](saveUpdates(_0x188cd0[_0x8635('0x64')],null))[_0x8635('0x23')](function(_0x2eedaf){if(!_0x188cd0[_0x8635('0x64')][_0x8635('0x41')])return _0x2eedaf;return db['MailServerIn'][_0x8635('0x22')](_0x188cd0['body']['Imap'],{'where':{'MailAccountId':_0x2eedaf['id']}})[_0x8635('0x23')](function(){return _0x2eedaf;});})['then'](function(_0x54b5fc){if(!_0x188cd0['body'][_0x8635('0x42')])return _0x54b5fc;return db[_0x8635('0x44')][_0x8635('0x22')](_0x188cd0[_0x8635('0x64')][_0x8635('0x42')],{'where':{'MailAccountId':_0x54b5fc['id']}})['then'](function(){return _0x54b5fc;});})[_0x8635('0x23')](respondWithResult(_0x41a9a1,null))[_0x8635('0x19')](handleError(_0x41a9a1,null));};exports[_0x8635('0x69')]=function(_0x8ae079,_0x2f1c51){return db[_0x8635('0x5b')][_0x8635('0x69')]()['then'](respondWithResult(_0x2f1c51,null))[_0x8635('0x19')](handleError(_0x2f1c51,null));};exports[_0x8635('0x6a')]=function(_0xbf9136,_0x2e680d){if(_0xbf9136[_0x8635('0x64')]['id']){delete _0xbf9136[_0x8635('0x64')]['id'];}return db['MailAccount']['find']({'where':{'id':_0xbf9136[_0x8635('0x5f')]['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x2e680d,null))[_0x8635('0x23')](function(_0x35acc3){if(_0x35acc3){_0xbf9136['body'][_0x8635('0x6b')]=_0x35acc3['id'];return db[_0x8635('0x6c')]['create'](_0xbf9136[_0x8635('0x64')]);}})[_0x8635('0x23')](respondWithResult(_0x2e680d,null))[_0x8635('0x19')](handleError(_0x2e680d,null));};exports['getDispositions']=function(_0x24cf20,_0x23cdb4){var _0x2fdba1={'raw':![],'where':{}};var _0xe008ec={};var _0x52c119={'count':0x0,'rows':[]};return db[_0x8635('0x5b')][_0x8635('0x6d')]({'where':{'id':_0x24cf20[_0x8635('0x5f')]['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x23cdb4,null))['then'](function(_0x17dff1){if(_0x17dff1){_0xe008ec['model']=_[_0x8635('0x4b')](db['Disposition'][_0x8635('0x6e')]);_0xe008ec[_0x8635('0x4a')]=_[_0x8635('0x4b')](_0x24cf20[_0x8635('0x4a')]);_0xe008ec[_0x8635('0x4c')]=_[_0x8635('0x4d')](_0xe008ec['model'],_0xe008ec[_0x8635('0x4a')]);_0x2fdba1[_0x8635('0x4e')]=_['intersection'](_0xe008ec['model'],qs[_0x8635('0x4f')](_0x24cf20[_0x8635('0x4a')][_0x8635('0x4f')]));_0x2fdba1[_0x8635('0x4e')]=_0x2fdba1[_0x8635('0x4e')]['length']?_0x2fdba1[_0x8635('0x4e')]:_0xe008ec['model'];if(!_0x24cf20[_0x8635('0x4a')][_0x8635('0x50')]('nolimit')){_0x2fdba1[_0x8635('0x1d')]=qs[_0x8635('0x1d')](_0x24cf20['query']['limit']);_0x2fdba1[_0x8635('0x1c')]=qs['offset'](_0x24cf20[_0x8635('0x4a')][_0x8635('0x1c')]);}_0x2fdba1[_0x8635('0x52')]=qs[_0x8635('0x53')](_0x24cf20[_0x8635('0x4a')][_0x8635('0x53')]);_0x2fdba1[_0x8635('0x54')]=qs[_0x8635('0x4c')](_[_0x8635('0x55')](_0x24cf20['query'],_0xe008ec[_0x8635('0x4c')]));_0x2fdba1['where'][_0x8635('0x6b')]=_0x17dff1['id'];if(_0x24cf20[_0x8635('0x4a')][_0x8635('0x56')]){_0x2fdba1[_0x8635('0x54')]=_['merge'](_0x2fdba1[_0x8635('0x54')],{'$or':_[_0x8635('0x46')](_0x2fdba1['attributes'],function(_0x2bf4d9){var _0x38fefb={};_0x38fefb[_0x2bf4d9]={'$like':'%'+_0x24cf20[_0x8635('0x4a')][_0x8635('0x56')]+'%'};return _0x38fefb;})});}_0x2fdba1=_[_0x8635('0x57')]({},_0x2fdba1,_0x24cf20[_0x8635('0x5a')]);return db['Disposition'][_0x8635('0x1f')]({'where':_0x2fdba1[_0x8635('0x54')]})[_0x8635('0x23')](function(_0x41116a){_0x52c119[_0x8635('0x1f')]=_0x41116a;if(_0x24cf20[_0x8635('0x4a')]['includeAll']){_0x2fdba1[_0x8635('0x62')]=[{'all':!![]}];}return db[_0x8635('0x6c')]['findAll'](_0x2fdba1);})[_0x8635('0x23')](function(_0x31cf17){_0x52c119[_0x8635('0x5d')]=_0x31cf17;return _0x52c119;});}})[_0x8635('0x23')](respondWithFilteredResult(_0x23cdb4,_0x2fdba1))[_0x8635('0x19')](handleError(_0x23cdb4,null));};exports[_0x8635('0x6f')]=function(_0x16f969,_0x759f86){return db[_0x8635('0x5b')]['find']({'where':{'id':_0x16f969[_0x8635('0x5f')]['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x759f86,null))[_0x8635('0x23')](function(_0x191955){if(_0x191955){return _0x191955[_0x8635('0x6f')](_0x16f969[_0x8635('0x4a')][_0x8635('0x70')]);}})[_0x8635('0x23')](respondWithStatusCode(_0x759f86,null))[_0x8635('0x19')](handleError(_0x759f86,null));};exports[_0x8635('0x71')]=function(_0x108e86,_0x4e8f99){if(_0x108e86[_0x8635('0x64')]['id']){delete _0x108e86[_0x8635('0x64')]['id'];}return db['MailAccount'][_0x8635('0x63')]({'where':{'id':_0x108e86['params']['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x4e8f99,null))[_0x8635('0x23')](function(_0x5667bd){if(_0x5667bd){_0x108e86[_0x8635('0x64')][_0x8635('0x6b')]=_0x5667bd['id'];return db[_0x8635('0x72')][_0x8635('0x73')](_0x108e86[_0x8635('0x64')]);}})[_0x8635('0x23')](respondWithResult(_0x4e8f99,null))[_0x8635('0x19')](handleError(_0x4e8f99,null));};exports[_0x8635('0x74')]=function(_0xc53725,_0x2da60e){var _0x51b644={'raw':![],'where':{}};var _0x4918b8={};var _0x4ce1b5={'count':0x0,'rows':[]};return db[_0x8635('0x5b')][_0x8635('0x6d')]({'where':{'id':_0xc53725[_0x8635('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2da60e,null))[_0x8635('0x23')](function(_0x2f35eb){if(_0x2f35eb){_0x4918b8[_0x8635('0x49')]=_[_0x8635('0x4b')](db[_0x8635('0x72')][_0x8635('0x6e')]);_0x4918b8[_0x8635('0x4a')]=_[_0x8635('0x4b')](_0xc53725[_0x8635('0x4a')]);_0x4918b8[_0x8635('0x4c')]=_['intersection'](_0x4918b8[_0x8635('0x49')],_0x4918b8[_0x8635('0x4a')]);_0x51b644[_0x8635('0x4e')]=_[_0x8635('0x4d')](_0x4918b8[_0x8635('0x49')],qs[_0x8635('0x4f')](_0xc53725[_0x8635('0x4a')][_0x8635('0x4f')]));_0x51b644[_0x8635('0x4e')]=_0x51b644[_0x8635('0x4e')]['length']?_0x51b644['attributes']:_0x4918b8[_0x8635('0x49')];if(!_0xc53725[_0x8635('0x4a')]['hasOwnProperty'](_0x8635('0x51'))){_0x51b644['limit']=qs[_0x8635('0x1d')](_0xc53725['query'][_0x8635('0x1d')]);_0x51b644[_0x8635('0x1c')]=qs[_0x8635('0x1c')](_0xc53725[_0x8635('0x4a')][_0x8635('0x1c')]);}_0x51b644['order']=qs[_0x8635('0x53')](_0xc53725[_0x8635('0x4a')][_0x8635('0x53')]);_0x51b644[_0x8635('0x54')]=qs[_0x8635('0x4c')](_[_0x8635('0x55')](_0xc53725[_0x8635('0x4a')],_0x4918b8[_0x8635('0x4c')]));_0x51b644[_0x8635('0x54')][_0x8635('0x6b')]=_0x2f35eb['id'];if(_0xc53725[_0x8635('0x4a')][_0x8635('0x56')]){_0x51b644[_0x8635('0x54')]=_['merge'](_0x51b644[_0x8635('0x54')],{'$or':_['map'](_0x51b644[_0x8635('0x4e')],function(_0xaa0853){var _0x4a875d={};_0x4a875d[_0xaa0853]={'$like':'%'+_0xc53725[_0x8635('0x4a')][_0x8635('0x56')]+'%'};return _0x4a875d;})});}_0x51b644=_[_0x8635('0x57')]({},_0x51b644,_0xc53725[_0x8635('0x5a')]);return db[_0x8635('0x72')][_0x8635('0x1f')]({'where':_0x51b644[_0x8635('0x54')]})[_0x8635('0x23')](function(_0x5b72d0){_0x4ce1b5[_0x8635('0x1f')]=_0x5b72d0;if(_0xc53725[_0x8635('0x4a')][_0x8635('0x61')]){_0x51b644[_0x8635('0x62')]=[{'all':!![]}];}return db[_0x8635('0x72')][_0x8635('0x5c')](_0x51b644);})[_0x8635('0x23')](function(_0xa49c5d){_0x4ce1b5[_0x8635('0x5d')]=_0xa49c5d;return _0x4ce1b5;});}})['then'](respondWithFilteredResult(_0x2da60e,_0x51b644))[_0x8635('0x19')](handleError(_0x2da60e,null));};exports[_0x8635('0x75')]=function(_0x1f21fc,_0xa3b8f1){return db['MailAccount']['find']({'where':{'id':_0x1f21fc[_0x8635('0x5f')]['id']}})[_0x8635('0x23')](handleEntityNotFound(_0xa3b8f1,null))[_0x8635('0x23')](function(_0x286b76){if(_0x286b76){return _0x286b76['removeAnswers'](_0x1f21fc[_0x8635('0x4a')][_0x8635('0x70')]);}})['then'](respondWithStatusCode(_0xa3b8f1,null))['catch'](handleError(_0xa3b8f1,null));};exports[_0x8635('0x73')]=function(_0x374344,_0x1c5095){var _0x8e0cd0={'name':_0x374344[_0x8635('0x64')][_0x8635('0x28')],'key':_0x374344['body'][_0x8635('0x48')],'provider':_0x374344[_0x8635('0x64')][_0x8635('0x65')]===_0x8635('0x66')?null:_0x374344[_0x8635('0x64')][_0x8635('0x65')],'email':_0x374344[_0x8635('0x64')][_0x8635('0x76')],'ListId':_0x374344['body'][_0x8635('0x77')],'active':!_[_0x8635('0x78')](_0x374344[_0x8635('0x64')][_0x8635('0x79')])?_0x374344[_0x8635('0x64')][_0x8635('0x79')]:!![],'description':_0x374344[_0x8635('0x64')]['description']||null};var _0x58134f=getAuthenticationOptions(_0x8e0cd0[_0x8635('0x65')],_0x374344['body']);_0x8e0cd0[_0x8635('0x41')]=_0x58134f[_0x8635('0x41')];_0x8e0cd0['Smtp']=_0x58134f['Smtp'];return db['MailAccount'][_0x8635('0x73')](_0x8e0cd0,{'include':[{'model':db[_0x8635('0x44')],'as':_0x8635('0x42')},{'model':db[_0x8635('0x60')],'as':_0x8635('0x41')}]})[_0x8635('0x23')](function(_0x23ed98){var _0x7c3282=_0x374344[_0x8635('0x37')][_0x8635('0x24')]({'plain':!![]});if(!_0x7c3282)throw new Error(_0x8635('0x7a'));if(_0x7c3282[_0x8635('0x7b')]==='user'){var _0x2222c6=_0x23ed98['get']({'plain':!![]});return db[_0x8635('0x7c')][_0x8635('0x63')]({'where':{'name':'MailAccounts','userProfileId':_0x7c3282[_0x8635('0x7d')]},'raw':!![]})['then'](function(_0x25c5f2){if(_0x25c5f2&&_0x25c5f2['autoAssociation']===0x0){return db[_0x8635('0x25')][_0x8635('0x73')]({'name':_0x2222c6[_0x8635('0x28')],'resourceId':_0x2222c6['id'],'type':_0x25c5f2[_0x8635('0x28')],'sectionId':_0x25c5f2['id']},{})[_0x8635('0x23')](function(){return _0x23ed98;});}else{return _0x23ed98;}})[_0x8635('0x19')](function(_0x550885){logger[_0x8635('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x550885);throw _0x550885;});}return _0x23ed98;})[_0x8635('0x23')](respondWithResult(_0x1c5095,0xc9))[_0x8635('0x19')](handleError(_0x1c5095,null));};exports[_0x8635('0x7e')]=function(_0x248e15,_0x376bf0){return db['MailAccount'][_0x8635('0x6d')]({'where':{'id':_0x248e15[_0x8635('0x5f')]['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x376bf0,null))[_0x8635('0x23')](function(_0x3c8407){if(_0x3c8407){return _0x3c8407[_0x8635('0x7e')]();}return null;})['then'](respondWithResult(_0x376bf0,null))['catch'](handleError(_0x376bf0,null));};exports['addImap']=function(_0x1d7aa9,_0x1be978){if(_0x1d7aa9[_0x8635('0x64')]['id']){delete _0x1d7aa9[_0x8635('0x64')]['id'];}return db[_0x8635('0x5b')][_0x8635('0x63')]({'where':{'id':_0x1d7aa9['params']['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x1be978,null))[_0x8635('0x23')](function(_0x2d75d9){if(_0x2d75d9){_0x1d7aa9[_0x8635('0x64')][_0x8635('0x6b')]=_0x2d75d9['id'];return db[_0x8635('0x60')][_0x8635('0x73')](_0x1d7aa9[_0x8635('0x64')]);}})[_0x8635('0x23')](respondWithResult(_0x1be978,null))[_0x8635('0x19')](handleError(_0x1be978,null));};exports[_0x8635('0x7f')]=function(_0x33f4ca,_0x23bf18){return db[_0x8635('0x5b')][_0x8635('0x6d')]({'where':{'id':_0x33f4ca[_0x8635('0x5f')]['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x23bf18,null))['then'](function(_0xe25c12){if(_0xe25c12){return _0xe25c12[_0x8635('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x23bf18,null))[_0x8635('0x19')](handleError(_0x23bf18,null));};exports[_0x8635('0x81')]=function(_0x372340,_0x4e04e8){return db['MailAccount'][_0x8635('0x6d')]({'where':{'id':_0x372340[_0x8635('0x5f')]['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x4e04e8,null))[_0x8635('0x23')](function(_0x4c5a6f){if(_0x4c5a6f){return _0x4c5a6f[_0x8635('0x81')]();}return null;})[_0x8635('0x23')](respondWithResult(_0x4e04e8,null))[_0x8635('0x19')](handleError(_0x4e04e8,null));};exports[_0x8635('0x82')]=function(_0x443798,_0x407454){if(_0x443798[_0x8635('0x64')]['id']){delete _0x443798[_0x8635('0x64')]['id'];}return db[_0x8635('0x5b')][_0x8635('0x63')]({'where':{'id':_0x443798[_0x8635('0x5f')]['id']}})['then'](handleEntityNotFound(_0x407454,null))['then'](function(_0x5c5b4c){if(_0x5c5b4c){_0x443798['body']['MailAccountId']=_0x5c5b4c['id'];return db[_0x8635('0x44')][_0x8635('0x73')](_0x443798['body']);}})['then'](respondWithResult(_0x407454,null))['catch'](handleError(_0x407454,null));};exports[_0x8635('0x83')]=function(_0x3b27f7,_0x4015d6){return db[_0x8635('0x5b')][_0x8635('0x6d')]({'where':{'id':_0x3b27f7['params']['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x4015d6,null))[_0x8635('0x23')](function(_0x517482){if(_0x517482){return _0x517482[_0x8635('0x84')](null);}return null;})[_0x8635('0x23')](respondWithStatusCode(_0x4015d6,null))[_0x8635('0x19')](handleError(_0x4015d6,null));};exports[_0x8635('0x85')]=function(_0x58178e,_0x4b3f0b){return db[_0x8635('0x86')][_0x8635('0x63')]({'where':{'id':_0x58178e[_0x8635('0x5f')]['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x4b3f0b,null))['then'](function(_0x535049){if(_0x535049){return _0x535049['addInteraction'](_0x58178e['body'][_0x8635('0x70')],_['omit'](_0x58178e[_0x8635('0x64')],['ids','id'])||{});}})['then'](respondWithResult(_0x4b3f0b,null))[_0x8635('0x19')](handleError(_0x4b3f0b,null));};exports[_0x8635('0x87')]=function(_0x8475a8,_0xc9f09a){var _0x501247={'raw':![],'where':{}};var _0x2a054e={};var _0xed3887={'count':0x0,'rows':[]};return db[_0x8635('0x5b')]['findOne']({'where':{'id':_0x8475a8[_0x8635('0x5f')]['id']}})['then'](handleEntityNotFound(_0xc9f09a,null))['then'](function(_0x39a3d2){if(_0x39a3d2){_0x2a054e['model']=_[_0x8635('0x4b')](db[_0x8635('0x86')][_0x8635('0x6e')]);_0x2a054e['query']=_[_0x8635('0x4b')](_0x8475a8[_0x8635('0x4a')]);_0x2a054e[_0x8635('0x4c')]=_[_0x8635('0x4d')](_0x2a054e['model'],_0x2a054e[_0x8635('0x4a')]);_0x501247[_0x8635('0x4e')]=_[_0x8635('0x4d')](_0x2a054e[_0x8635('0x49')],qs[_0x8635('0x4f')](_0x8475a8[_0x8635('0x4a')][_0x8635('0x4f')]));_0x501247[_0x8635('0x4e')]=_0x501247[_0x8635('0x4e')][_0x8635('0x88')]?_0x501247['attributes']:_0x2a054e[_0x8635('0x49')];if(!_0x8475a8[_0x8635('0x4a')][_0x8635('0x50')]('nolimit')){_0x501247[_0x8635('0x1d')]=qs[_0x8635('0x1d')](_0x8475a8[_0x8635('0x4a')][_0x8635('0x1d')]);_0x501247['offset']=qs[_0x8635('0x1c')](_0x8475a8['query'][_0x8635('0x1c')]);}_0x501247[_0x8635('0x52')]=qs[_0x8635('0x53')](_0x8475a8[_0x8635('0x4a')][_0x8635('0x53')]);_0x501247['where']=qs['filters'](_[_0x8635('0x55')](_0x8475a8['query'],_0x2a054e[_0x8635('0x4c')]));_0x501247[_0x8635('0x54')][_0x8635('0x6b')]=_0x39a3d2['id'];if(_0x8475a8[_0x8635('0x4a')][_0x8635('0x56')]){_0x501247[_0x8635('0x54')]=_[_0x8635('0x57')](_0x501247[_0x8635('0x54')],{'$or':_[_0x8635('0x46')](_0x501247[_0x8635('0x4e')],function(_0x4cbd9d){var _0x1a25bb={};_0x1a25bb[_0x4cbd9d]={'$like':'%'+_0x8475a8[_0x8635('0x4a')][_0x8635('0x56')]+'%'};return _0x1a25bb;})});}_0x501247=_['merge']({},_0x501247,_0x8475a8['options']);return db[_0x8635('0x86')][_0x8635('0x1f')]({'where':_0x501247[_0x8635('0x54')]})['then'](function(_0x156037){_0xed3887[_0x8635('0x1f')]=_0x156037;if(_0x8475a8[_0x8635('0x4a')][_0x8635('0x61')]){_0x501247['include']=[{'model':db[_0x8635('0x89')],'as':_0x8635('0x8a'),'required':![]},{'model':db[_0x8635('0x8b')],'as':_0x8635('0x8c'),'attributes':[_0x8635('0x28'),'fullname',_0x8635('0x8d')],'required':![]},{'model':db[_0x8635('0x8e')],'as':_0x8635('0x8f'),'attributes':['id','name','color'],'where':_0x8475a8[_0x8635('0x4a')][_0x8635('0x90')]?{'id':_0x8475a8[_0x8635('0x4a')][_0x8635('0x90')]}:undefined,'required':_0x8475a8[_0x8635('0x4a')]['tag']?!![]:![]}];}return db[_0x8635('0x86')][_0x8635('0x5c')](_0x501247);})[_0x8635('0x23')](function(_0x41bbd0){_0xed3887[_0x8635('0x5d')]=_0x41bbd0;return _0xed3887;});}})[_0x8635('0x23')](respondWithFilteredResult(_0xc9f09a,_0x501247))[_0x8635('0x19')](handleError(_0xc9f09a,null));};exports[_0x8635('0x91')]=function addApplications(_0x4c2bec,_0x1f173c){var _0xd8bbc5=_0x4c2bec[_0x8635('0x5f')]['id'];var _0x59b925=_0x4c2bec['body'];var _0x3ef688=0xc8;var _0x2024f4=null;return db[_0x8635('0x92')][_0x8635('0x93')]({'isolationLevel':db[_0x8635('0x92')]['Transaction'][_0x8635('0x94')][_0x8635('0x95')]},function(_0x5b676b){return db['MailAccount'][_0x8635('0x6d')]({'where':{'id':_0xd8bbc5},'transaction':_0x5b676b})['then'](function(_0x1e5776){if(_0x1e5776){return db[_0x8635('0x96')]['destroy']({'where':{'MailAccountId':_0xd8bbc5},'transaction':_0x5b676b})[_0x8635('0x23')](function(){var _0x1b415b=_[_0x8635('0x46')](_0x59b925,function(_0x171482){_0x171482[_0x8635('0x6b')]=_0xd8bbc5;return _0x171482;});return db[_0x8635('0x96')][_0x8635('0x97')](_0x1b415b,{'transaction':_0x5b676b});});}else{_0x3ef688=0x194;_0x2024f4=[];}});})[_0x8635('0x23')](function(){if(_0x3ef688!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0xd8bbc5},'order':_0x8635('0x98')})[_0x8635('0x23')](function(_0x4a12b4){_0x2024f4=_0x4a12b4;});}})[_0x8635('0x19')](function(_0x4975f4){_0x3ef688=0x1f4;logger[_0x8635('0x14')](_0x4975f4[_0x8635('0x27')]);if(_0x4975f4[_0x8635('0x28')]){delete _0x4975f4[_0x8635('0x28')];}_0x2024f4=_0x4975f4;})[_0x8635('0x99')](function(){if(_0x2024f4===null){_0x1f173c['sendStatus'](_0x3ef688);}else{if(_0x3ef688===0x1f4){_0x1f173c[_0x8635('0x1b')](_0x3ef688)[_0x8635('0x29')](_0x2024f4);}else{_0x1f173c[_0x8635('0x1b')](_0x3ef688)[_0x8635('0x21')](_0x2024f4);}}});};exports[_0x8635('0x9a')]=function(_0x5c84c2,_0xc24aa6){var _0xb9cc8={};var _0xec6617={};var _0x3f4690;var _0x248e3c;return db[_0x8635('0x5b')][_0x8635('0x6d')]({'where':{'id':_0x5c84c2[_0x8635('0x5f')]['id']}})[_0x8635('0x23')](handleEntityNotFound(_0xc24aa6,null))[_0x8635('0x23')](function(_0x278f3f){if(_0x278f3f){_0x3f4690=_0x278f3f;_0xec6617[_0x8635('0x49')]=_['keys'](db[_0x8635('0x96')][_0x8635('0x6e')]);_0xec6617[_0x8635('0x4a')]=_['keys'](_0x5c84c2[_0x8635('0x4a')]);_0xec6617[_0x8635('0x4c')]=_[_0x8635('0x4d')](_0xec6617['model'],_0xec6617[_0x8635('0x4a')]);_0xb9cc8['attributes']=_['intersection'](_0xec6617['model'],qs[_0x8635('0x4f')](_0x5c84c2[_0x8635('0x4a')][_0x8635('0x4f')]));_0xb9cc8[_0x8635('0x4e')]=_0xb9cc8[_0x8635('0x4e')][_0x8635('0x88')]?_0xb9cc8[_0x8635('0x4e')]:_0xec6617[_0x8635('0x49')];_0xb9cc8[_0x8635('0x52')]=qs[_0x8635('0x53')](_0x5c84c2['query'][_0x8635('0x53')]);_0xb9cc8[_0x8635('0x54')]=qs[_0x8635('0x4c')](_[_0x8635('0x55')](_0x5c84c2['query'],_0xec6617['filters']));if(_0x5c84c2[_0x8635('0x4a')][_0x8635('0x56')]){_0xb9cc8[_0x8635('0x54')]=_['merge'](_0xb9cc8[_0x8635('0x54')],{'$or':_['map'](_0xb9cc8[_0x8635('0x4e')],function(_0x5ae2e1){var _0x3b0d7c={};_0x3b0d7c[_0x5ae2e1]={'$like':'%'+_0x5c84c2[_0x8635('0x4a')][_0x8635('0x56')]+'%'};return _0x3b0d7c;})});}_0xb9cc8=_[_0x8635('0x57')]({},_0xb9cc8,_0x5c84c2[_0x8635('0x5a')]);return _0x3f4690[_0x8635('0x9a')](_0xb9cc8);}})[_0x8635('0x23')](function(_0x560259){if(_0x560259){_0x248e3c=_0x560259[_0x8635('0x88')];if(!_0x5c84c2['query'][_0x8635('0x50')](_0x8635('0x51'))){_0xb9cc8[_0x8635('0x1d')]=qs['limit'](_0x5c84c2[_0x8635('0x4a')][_0x8635('0x1d')]);_0xb9cc8[_0x8635('0x1c')]=qs[_0x8635('0x1c')](_0x5c84c2[_0x8635('0x4a')][_0x8635('0x1c')]);}return _0x3f4690[_0x8635('0x9a')](_0xb9cc8);}})[_0x8635('0x23')](function(_0x16cf9e){if(_0x16cf9e){return _0x16cf9e?{'count':_0x248e3c,'rows':_0x16cf9e}:null;}})[_0x8635('0x23')](respondWithResult(_0xc24aa6,null))[_0x8635('0x19')](handleError(_0xc24aa6,null));};exports[_0x8635('0x9b')]=function(_0xb2e26e,_0xf2084b){var _0x627b0b={'raw':!![],'where':{}};var _0x4472a6={};var _0x19de9d={'count':0x0,'rows':[]};return db[_0x8635('0x5b')][_0x8635('0x6d')]({'where':{'id':_0xb2e26e[_0x8635('0x5f')]['id']}})[_0x8635('0x23')](handleEntityNotFound(_0xf2084b,null))[_0x8635('0x23')](function(_0xd6829d){if(_0xd6829d){_0x4472a6[_0x8635('0x49')]=_[_0x8635('0x4b')](db[_0x8635('0x9c')][_0x8635('0x6e')]);_0x4472a6[_0x8635('0x4a')]=_[_0x8635('0x4b')](_0xb2e26e[_0x8635('0x4a')]);_0x4472a6['filters']=_[_0x8635('0x4d')](_0x4472a6['model'],_0x4472a6[_0x8635('0x4a')]);_0x627b0b[_0x8635('0x4e')]=_['intersection'](_0x4472a6[_0x8635('0x49')],qs[_0x8635('0x4f')](_0xb2e26e[_0x8635('0x4a')][_0x8635('0x4f')]));_0x627b0b[_0x8635('0x4e')]=_0x627b0b[_0x8635('0x4e')]['length']?_0x627b0b['attributes']:_0x4472a6['model'];if(!_0xb2e26e[_0x8635('0x4a')][_0x8635('0x50')](_0x8635('0x51'))){_0x627b0b[_0x8635('0x1d')]=qs[_0x8635('0x1d')](_0xb2e26e[_0x8635('0x4a')][_0x8635('0x1d')]);_0x627b0b[_0x8635('0x1c')]=qs['offset'](_0xb2e26e[_0x8635('0x4a')][_0x8635('0x1c')]);}_0x627b0b[_0x8635('0x52')]=qs['sort'](_0xb2e26e[_0x8635('0x4a')]['sort']);_0x627b0b['where']=qs[_0x8635('0x4c')](_[_0x8635('0x55')](_0xb2e26e[_0x8635('0x4a')],_0x4472a6[_0x8635('0x4c')]));_0x627b0b[_0x8635('0x54')]['MailAccountId']=_0xd6829d['id'];if(_0xb2e26e[_0x8635('0x4a')][_0x8635('0x56')]){_0x627b0b[_0x8635('0x54')]=_['merge'](_0x627b0b['where'],{'$or':_[_0x8635('0x46')](_0x627b0b[_0x8635('0x4e')],function(_0x5046c8){var _0x4859f7={};_0x4859f7[_0x5046c8]={'$like':'%'+_0xb2e26e[_0x8635('0x4a')][_0x8635('0x56')]+'%'};return _0x4859f7;})});}if(_0xb2e26e[_0x8635('0x4a')][_0x8635('0x9d')]){var _0x345628=_0xb2e26e[_0x8635('0x4a')][_0x8635('0x9d')][_0x8635('0x9e')](',');var _0x426354={};_0x426354[_0x345628[0x0]]={'$gte':moment(_0x345628[0x1])[_0x8635('0x9f')](_0x8635('0xa0'))};_0x627b0b['where']=_[_0x8635('0x57')](_0x627b0b[_0x8635('0x54')],_0x426354);}_0x627b0b=_[_0x8635('0x57')]({},_0x627b0b,_0xb2e26e[_0x8635('0x5a')]);return db[_0x8635('0x9c')][_0x8635('0x1f')]({'where':_0x627b0b[_0x8635('0x54')]})[_0x8635('0x23')](function(_0x564ff4){_0x19de9d['count']=_0x564ff4;if(_0xb2e26e[_0x8635('0x4a')]['includeAll']){_0x627b0b[_0x8635('0x62')]=[{'all':!![]}];}return db[_0x8635('0x9c')][_0x8635('0x5c')](_0x627b0b);})[_0x8635('0x23')](function(_0x4eb713){if(_0xb2e26e['query'][_0x8635('0xa1')]===_0x8635('0xa2')){for(var _0x3e7c35=0x0;_0x3e7c35<_0x4eb713['length'];_0x3e7c35++){_0x4eb713[_0x3e7c35][_0x8635('0x64')]=juice(_0x4eb713[_0x3e7c35][_0x8635('0x64')]);}}_0x19de9d[_0x8635('0x5d')]=_0x4eb713;return _0x19de9d;});}})['then'](respondWithFilteredResult(_0xf2084b,_0x627b0b))[_0x8635('0x19')](handleError(_0xf2084b,null));};exports[_0x8635('0x29')]=function(_0x38435a,_0x119719){var _0x6583af,_0x3763a8={},_0x5515a8;if(_0x38435a[_0x8635('0x64')]['to']){_0x5515a8=_0x38435a[_0x8635('0x64')]['to']['split'](',')[0x0];}return db[_0x8635('0x5b')]['find']({'where':{'id':_0x38435a['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8635('0x89')],'as':_0x8635('0xa3'),'where':{'email':_0x5515a8},'limit':0x1,'order':[[_0x8635('0xa4'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x8635('0x42'),'raw':!![],'include':[{'model':db[_0x8635('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0x8635('0x23')](handleEntityNotFound(_0x119719,null))[_0x8635('0x23')](function(_0x3b4301){if(!_0x3b4301)return;_0x6583af=_0x3b4301;if(!_0x3b4301[_0x8635('0x42')])throw new Error(_0x8635('0xa6'));if(_[_0x8635('0x78')](_0x38435a[_0x8635('0x64')]['from'])){_0x38435a[_0x8635('0x64')][_0x8635('0xa7')]=util[_0x8635('0x9f')](_0x8635('0xa8'),_0x3b4301[_0x8635('0x28')],_0x3b4301['email']||_0x3b4301[_0x8635('0x42')][_0x8635('0x37')]);}if(_0x38435a[_0x8635('0x64')][_0x8635('0xa9')]&&_0x38435a[_0x8635('0x64')]['attachments'][_0x8635('0x88')]){for(var _0x463443=0x0;_0x463443<_0x38435a[_0x8635('0x64')][_0x8635('0xa9')]['length'];_0x463443+=0x1){_0x38435a['body']['attachments'][_0x463443]={'filename':_0x38435a[_0x8635('0x64')][_0x8635('0xa9')][_0x463443][_0x8635('0x28')],'path':path[_0x8635('0xaa')](config[_0x8635('0xab')],_0x8635('0xac'),_0x38435a[_0x8635('0x64')][_0x8635('0xa9')][_0x463443][_0x8635('0xad')])};}}var _0x234335=_0x3b4301['getSmtpOptions']();return respondWithRpcPromise(_0x8635('0xae'),_0x8635('0xaf'),{'account':_0x234335,'message':_0x38435a[_0x8635('0x64')]});})[_0x8635('0x23')](function(_0x6b5f41){if(!_0x6b5f41)return;_0x3763a8=_0x6b5f41;if(!_0x6583af[_0x8635('0xb0')])throw new Error(_0x8635('0xb1'));if(_0x6583af[_0x8635('0xb0')][_0x8635('0xa3')]['length'])return _0x6583af[_0x8635('0xb0')]['Contacts'][0x0];return db[_0x8635('0x89')][_0x8635('0x73')](_[_0x8635('0x9')](_0x38435a[_0x8635('0x64')],{'firstName':_0x38435a['body']['to'],'email':_0x38435a[_0x8635('0x64')]['to'],'phone':_0x38435a[_0x8635('0x64')]['to'],'ListId':_0x6583af[_0x8635('0x77')]}));})['then'](function(_0x19b708){if(!_0x19b708)return;var _0x32068b={'UserId':_0x38435a[_0x8635('0x37')]['id'],'ContactId':_0x19b708['id'],'MailAccountId':_0x6583af['id'],'inReplyTo':_0x3763a8[_0x8635('0xb2')],'to':_0x38435a[_0x8635('0x64')][_0x8635('0xa7')],'cc':_0x38435a[_0x8635('0x64')]['cc'],'subject':_0x38435a[_0x8635('0x64')][_0x8635('0xb3')],'attach':_0x38435a[_0x8635('0x64')][_0x8635('0xb4')],'firstMsgDirection':_0x8635('0xb5'),'lastMsgAt':moment()[_0x8635('0x9f')](_0x8635('0xa0')),'lastMsgDirection':'out','Messages':[_[_0x8635('0x57')](_0x38435a['body'],{'messageId':_0x3763a8[_0x8635('0xb2')],'sentAt':moment()['format'](_0x8635('0xa0')),'read':!![],'MailAccountId':_0x6583af['id'],'UserId':_0x38435a['user']['id'],'ContactId':_0x19b708['id']})]};if(_0x38435a[_0x8635('0x64')][_0x8635('0xb6')]){_0x32068b=_[_0x8635('0x57')](_0x32068b,_0x38435a[_0x8635('0x64')]['Interaction']);}return db[_0x8635('0x86')][_0x8635('0x73')](_0x32068b,{'include':[{'model':db[_0x8635('0x9c')],'as':_0x8635('0xb7')}]});})[_0x8635('0x23')](respondWithResult(_0x119719,null))[_0x8635('0x19')](handleError(_0x119719,null));};exports['verifySmtp']=function(_0x55a2c4,_0x1d0a6f){return db[_0x8635('0x5b')]['find']({'where':{'id':_0x55a2c4['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x8635('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x8635('0xa5'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1d0a6f,null))['then'](function(_0xd7bfcd){if(!_0xd7bfcd[_0x8635('0x42')])return;var _0x2f53c2=_0xd7bfcd['getSmtpOptions']();return respondWithRpcPromise(_0x8635('0xb8'),_0x8635('0xb9'),{'account':_0x2f53c2});})['then'](respondWithResult(_0x1d0a6f,null))[_0x8635('0x19')](handleError(_0x1d0a6f,null));};exports[_0x8635('0xba')]=function(_0x1e94ef,_0x5efab2){return db[_0x8635('0x5b')][_0x8635('0x63')]({'where':{'id':_0x1e94ef['params']['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x5efab2,null))[_0x8635('0x23')](function(_0xcaed15){if(_0xcaed15&&_0xcaed15[_0x8635('0x3f')]){throw new db[(_0x8635('0xbb'))][(_0x8635('0xbc'))](_0x8635('0xbd'));}return _0xcaed15;})[_0x8635('0x23')](removeEntity(_0x5efab2,null))[_0x8635('0x19')](handleError(_0x5efab2,null));};exports[_0x8635('0xbe')]=function(_0x4a75b3,_0x1f8b33){return db[_0x8635('0x5b')][_0x8635('0x63')]({'where':{'id':_0x4a75b3[_0x8635('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1f8b33,null))[_0x8635('0x23')](function(_0x3da3f7){if(_0x3da3f7){return _0x3da3f7['addAgents'](_0x4a75b3[_0x8635('0x64')][_0x8635('0x70')],_['omit'](_0x4a75b3[_0x8635('0x64')],[_0x8635('0x70'),'id'])||{})[_0x8635('0xbf')](function(_0x26ad45){for(var _0x4a7a66=0x0;_0x4a7a66<_0x4a75b3[_0x8635('0x64')][_0x8635('0x70')][_0x8635('0x88')];_0x4a7a66+=0x1){socket[_0x8635('0xc0')]('userMailAccount:save',{'UserId':Number(_0x4a75b3[_0x8635('0x64')][_0x8635('0x70')][_0x4a7a66]),'MailAccountId':Number(_0x4a75b3['params']['id'])});}return _0x26ad45;});}})[_0x8635('0x23')](respondWithResult(_0x1f8b33,null))['catch'](handleError(_0x1f8b33,null));};exports[_0x8635('0xc1')]=function(_0x527c8c,_0x16533a){return db[_0x8635('0x5b')][_0x8635('0x63')]({'where':{'id':_0x527c8c['params']['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x16533a,null))[_0x8635('0x23')](function(_0x46f00e){if(_0x46f00e){return _0x46f00e['removeAgents'](_0x527c8c['query']['ids'])[_0x8635('0x23')](function(){if(_[_0x8635('0xc2')](_0x527c8c[_0x8635('0x4a')][_0x8635('0x70')])){for(var _0xa969e6=0x0;_0xa969e6<_0x527c8c['query'][_0x8635('0x70')][_0x8635('0x88')];_0xa969e6+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x527c8c['query'][_0x8635('0x70')][_0xa969e6]),'MailAccountId':Number(_0x527c8c['params']['id'])});}}else{socket['emit'](_0x8635('0xc3'),{'UserId':Number(_0x527c8c[_0x8635('0x4a')]['ids']),'MailAccountId':Number(_0x527c8c[_0x8635('0x5f')]['id'])});}});}})[_0x8635('0x23')](respondWithStatusCode(_0x16533a,null))[_0x8635('0x19')](handleError(_0x16533a,null));};exports[_0x8635('0xc4')]=function(_0xfd0b2e,_0x291440){var _0x1f4710={};var _0x48aefe={};var _0x4de3d2;var _0x287f90;return db[_0x8635('0x5b')][_0x8635('0x6d')]({'where':{'id':_0xfd0b2e['params']['id']}})[_0x8635('0x23')](handleEntityNotFound(_0x291440,null))[_0x8635('0x23')](function(_0x40b14f){if(_0x40b14f){_0x4de3d2=_0x40b14f;_0x48aefe['model']=_[_0x8635('0x4b')](db[_0x8635('0x8b')]['rawAttributes']);_0x48aefe[_0x8635('0x4a')]=_[_0x8635('0x4b')](_0xfd0b2e[_0x8635('0x4a')]);_0x48aefe['filters']=_[_0x8635('0x4d')](_0x48aefe['model'],_0x48aefe[_0x8635('0x4a')]);_0x1f4710['attributes']=_[_0x8635('0x4d')](_0x48aefe['model'],qs[_0x8635('0x4f')](_0xfd0b2e['query']['fields']));_0x1f4710[_0x8635('0x4e')]=_0x1f4710['attributes']['length']?_0x1f4710[_0x8635('0x4e')]:_0x48aefe[_0x8635('0x49')];_0x1f4710['order']=qs[_0x8635('0x53')](_0xfd0b2e[_0x8635('0x4a')]['sort']);_0x1f4710[_0x8635('0x54')]=qs[_0x8635('0x4c')](_[_0x8635('0x55')](_0xfd0b2e['query'],_0x48aefe[_0x8635('0x4c')]));if(_0xfd0b2e[_0x8635('0x4a')][_0x8635('0x56')]){_0x1f4710[_0x8635('0x54')]=_[_0x8635('0x57')](_0x1f4710[_0x8635('0x54')],{'$or':_[_0x8635('0x46')](_0x1f4710[_0x8635('0x4e')],function(_0x44d0ba){var _0x2a0a13={};_0x2a0a13[_0x44d0ba]={'$like':'%'+_0xfd0b2e['query'][_0x8635('0x56')]+'%'};return _0x2a0a13;})});}_0x1f4710=_[_0x8635('0x57')]({},_0x1f4710,_0xfd0b2e[_0x8635('0x5a')]);return _0x4de3d2[_0x8635('0xc4')](_0x1f4710);}})['then'](function(_0x3eefcf){if(_0x3eefcf){_0x287f90=_0x3eefcf[_0x8635('0x88')];if(!_0xfd0b2e[_0x8635('0x4a')][_0x8635('0x50')](_0x8635('0x51'))){_0x1f4710[_0x8635('0x1d')]=qs[_0x8635('0x1d')](_0xfd0b2e[_0x8635('0x4a')][_0x8635('0x1d')]);_0x1f4710['offset']=qs[_0x8635('0x1c')](_0xfd0b2e[_0x8635('0x4a')][_0x8635('0x1c')]);}return _0x4de3d2[_0x8635('0xc4')](_0x1f4710);}})[_0x8635('0x23')](function(_0x29521f){if(_0x29521f){return _0x29521f?{'count':_0x287f90,'rows':_0x29521f}:null;}})[_0x8635('0x23')](respondWithResult(_0x291440,null))[_0x8635('0x19')](handleError(_0x291440,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4f5c653..50d0077 100644 --- a/server/api/mailAccount/mailAccount.events.js +++ b/server/api/mailAccount/mailAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd868=['emit','hasOwnProperty','hook','exports','events','MailAccount','update','remove'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xd868,0x1ec));var _0x8d86=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xd868[_0x18cd5b];return _0x5eaa52;};'use strict';var EventEmitter=require(_0x8d86('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x8d86('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d86('0x2'),'afterDestroy':_0x8d86('0x3')};function emitEvent(_0xf04d37){return function(_0x5be215,_0x346c2d,_0x3ed3d1){MailAccountEvents['emit'](_0xf04d37+':'+_0x5be215['id'],_0x5be215);MailAccountEvents[_0x8d86('0x4')](_0xf04d37,_0x5be215);_0x3ed3d1(null);};}for(var e in events){if(events[_0x8d86('0x5')](e)){var event=events[e];MailAccount[_0x8d86('0x6')](e,emitEvent(event));}}module[_0x8d86('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x49fe=['remove','emit','hasOwnProperty','hook','exports','events','save','update'];(function(_0x6da129,_0x40948d){var _0x1349d6=function(_0x3b1bc){while(--_0x3b1bc){_0x6da129['push'](_0x6da129['shift']());}};_0x1349d6(++_0x40948d);}(_0x49fe,0x75));var _0xe49f=function(_0x15c382,_0x3aa93f){_0x15c382=_0x15c382-0x0;var _0x5f5649=_0x49fe[_0x15c382];return _0x5f5649;};'use strict';var EventEmitter=require(_0xe49f('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe49f('0x1'),'afterUpdate':_0xe49f('0x2'),'afterDestroy':_0xe49f('0x3')};function emitEvent(_0xb99c7){return function(_0x1cac40,_0x2db0ec,_0x1235f4){MailAccountEvents[_0xe49f('0x4')](_0xb99c7+':'+_0x1cac40['id'],_0x1cac40);MailAccountEvents[_0xe49f('0x4')](_0xb99c7,_0x1cac40);_0x1235f4(null);};}for(var e in events){if(events[_0xe49f('0x5')](e)){var event=events[e];MailAccount[_0xe49f('0x6')](e,emitEvent(event));}}module[_0xe49f('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 316f3bb..4d700b5 100644 --- a/server/api/mailAccount/mailAccount.model.js +++ b/server/api/mailAccount/mailAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f70=['Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host'];(function(_0x1c6e58,_0x471ada){var _0x38f14b=function(_0x46dc14){while(--_0x46dc14){_0x1c6e58['push'](_0x1c6e58['shift']());}};_0x38f14b(++_0x471ada);}(_0x1f70,0x123));var _0x01f7=function(_0x577f71,_0x43458f){_0x577f71=_0x577f71-0x0;var _0x3180be=_0x1f70[_0x577f71];return _0x3180be;};'use strict';var attributes=require(_0x01f7('0x0'));module[_0x01f7('0x1')]=function(_0x44dadc){return _0x44dadc[_0x01f7('0x2')](_0x01f7('0x3'),attributes,{'tableName':_0x01f7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x13d8b4=this;var _0x12a6fb={'id':_0x13d8b4['id'],'tls':{'rejectUnauthorized':![]}};if(_0x13d8b4[_0x01f7('0x5')]!==_0x01f7('0x6')){_0x12a6fb[_0x01f7('0x7')]=_0x13d8b4[_0x01f7('0x5')];}else{_0x12a6fb[_0x01f7('0x8')]=_0x13d8b4[_0x01f7('0x9')][_0x01f7('0x8')];_0x12a6fb[_0x01f7('0xa')]=_0x13d8b4['Smtp'][_0x01f7('0xa')];_0x12a6fb[_0x01f7('0xb')]=_0x13d8b4[_0x01f7('0x9')][_0x01f7('0xb')];}if(_0x13d8b4[_0x01f7('0x9')][_0x01f7('0xc')]){if(_0x13d8b4[_0x01f7('0x9')][_0x01f7('0xd')]){if(!_0x13d8b4[_0x01f7('0x9')][_0x01f7('0xe')])throw new Error(_0x01f7('0xf'));_0x12a6fb['auth']={'type':_0x01f7('0x10'),'user':_0x13d8b4[_0x01f7('0x9')][_0x01f7('0x11')],'accessToken':_0x13d8b4[_0x01f7('0x9')][_0x01f7('0xe')]['data5']};}else{_0x12a6fb[_0x01f7('0x12')]={'user':_0x13d8b4[_0x01f7('0x9')][_0x01f7('0x11')],'pass':_0x13d8b4['Smtp'][_0x01f7('0x13')]};}}return _0x12a6fb;}}});}; \ No newline at end of file +var _0x7936=['Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','./mailAccount.attributes','exports','define','mail_accounts','custom','service','provider','Smtp','host','port','secure','authentication','CloudProvider'];(function(_0x36a947,_0x1f0510){var _0x34e818=function(_0x117bca){while(--_0x117bca){_0x36a947['push'](_0x36a947['shift']());}};_0x34e818(++_0x1f0510);}(_0x7936,0x1cf));var _0x6793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7936[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x6793('0x0'));module[_0x6793('0x1')]=function(_0x540a07){return _0x540a07[_0x6793('0x2')]('MailAccount',attributes,{'tableName':_0x6793('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x56ce00=this;var _0x2d3904={'id':_0x56ce00['id'],'tls':{'rejectUnauthorized':![]}};if(_0x56ce00['provider']!==_0x6793('0x4')){_0x2d3904[_0x6793('0x5')]=_0x56ce00[_0x6793('0x6')];}else{_0x2d3904['host']=_0x56ce00[_0x6793('0x7')][_0x6793('0x8')];_0x2d3904[_0x6793('0x9')]=_0x56ce00['Smtp'][_0x6793('0x9')];_0x2d3904[_0x6793('0xa')]=_0x56ce00['Smtp'][_0x6793('0xa')];}if(_0x56ce00[_0x6793('0x7')][_0x6793('0xb')]){if(_0x56ce00[_0x6793('0x7')]['modernAuthentication']){if(!_0x56ce00[_0x6793('0x7')][_0x6793('0xc')])throw new Error(_0x6793('0xd'));_0x2d3904[_0x6793('0xe')]={'type':_0x6793('0xf'),'user':_0x56ce00['Smtp'][_0x6793('0x10')],'accessToken':_0x56ce00['Smtp'][_0x6793('0xc')]['data5']};}else{_0x2d3904[_0x6793('0xe')]={'user':_0x56ce00['Smtp']['user'],'pass':_0x56ce00[_0x6793('0x7')]['pass']};}}return _0x2d3904;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 3e45b46..6fd6c38 100644 --- a/server/api/mailAccount/mailAccount.rpc.js +++ b/server/api/mailAccount/mailAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa990=['info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','map','include','model','debug','stringify','find','setDataValue','smtpOptions','body','difference','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','mapKey','includes','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','autoclose','push','length','*,*,*,*','Contacts','from','create','List\x20not\x20found','contact','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','subject','format','interaction','created','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','agent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then'];(function(_0x360b62,_0x586c78){var _0x42eae5=function(_0x200665){while(--_0x200665){_0x360b62['push'](_0x360b62['shift']());}};_0x42eae5(++_0x586c78);}(_0xa990,0xc9));var _0x0a99=function(_0x1cf2ec,_0x25c2bf){_0x1cf2ec=_0x1cf2ec-0x0;var _0x4320b2=_0xa990[_0x1cf2ec];return _0x4320b2;};'use strict';var _=require(_0x0a99('0x0'));var moment=require(_0x0a99('0x1'));var BPromise=require(_0x0a99('0x2'));var rs=require(_0x0a99('0x3'));var Redis=require(_0x0a99('0x4'));var db=require(_0x0a99('0x5'))['db'];var logger=require(_0x0a99('0x6'))(_0x0a99('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a99('0x8')][_0x0a99('0x9')]({'port':0x232c});config[_0x0a99('0xa')]=_[_0x0a99('0xb')](config[_0x0a99('0xa')],{'host':_0x0a99('0xc'),'port':0x18eb});var socket=require(_0x0a99('0xd'))(new Redis(config[_0x0a99('0xa')]));require(_0x0a99('0xe'))[_0x0a99('0xf')](socket);function respondWithRpcPromise(_0x1eaa2a,_0x56810b,_0x813e91){return new BPromise(function(_0x38e89b,_0x5b5ec3){return client['request'](_0x1eaa2a,_0x813e91)[_0x0a99('0x10')](function(_0x35f37f){logger[_0x0a99('0x11')](_0x0a99('0x12'),_0x56810b,_0x0a99('0x13'));logger['debug'](_0x0a99('0x14'),_0x56810b,_0x0a99('0x13'),JSON['stringify'](_0x35f37f));if(_0x35f37f[_0x0a99('0x15')]){if(_0x35f37f[_0x0a99('0x15')][_0x0a99('0x16')]===0x1f4){logger[_0x0a99('0x15')](_0x0a99('0x12'),_0x56810b,_0x35f37f[_0x0a99('0x15')][_0x0a99('0x17')]);return _0x5b5ec3(_0x35f37f[_0x0a99('0x15')]['message']);}logger['error'](_0x0a99('0x12'),_0x56810b,_0x35f37f[_0x0a99('0x15')][_0x0a99('0x17')]);return _0x38e89b(_0x35f37f['error'][_0x0a99('0x17')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x56810b,_0x0a99('0x13'));_0x38e89b(_0x35f37f[_0x0a99('0x18')][_0x0a99('0x17')]);}})[_0x0a99('0x19')](function(_0x572ce5){logger['error'](_0x0a99('0x12'),_0x56810b,_0x572ce5);_0x5b5ec3(_0x572ce5);});});}exports[_0x0a99('0x1a')]=function(_0xbe23f3){var _0x416d32=this;return new Promise(function(_0x5e6c7e,_0x58c86d){return db[_0x0a99('0x1b')]['findAll']({'raw':_0xbe23f3[_0x0a99('0x1c')]?_0xbe23f3['options'][_0x0a99('0x1d')]===undefined?!![]:![]:!![],'where':_0xbe23f3['options']?_0xbe23f3[_0x0a99('0x1c')][_0x0a99('0x1e')]||null:null,'attributes':_0xbe23f3[_0x0a99('0x1c')]?_0xbe23f3[_0x0a99('0x1c')][_0x0a99('0x1f')]||null:null,'limit':_0xbe23f3[_0x0a99('0x1c')]?_0xbe23f3[_0x0a99('0x1c')][_0x0a99('0x20')]||null:null,'include':_0xbe23f3[_0x0a99('0x1c')]?_0xbe23f3['options']['include']?_[_0x0a99('0x21')](_0xbe23f3[_0x0a99('0x1c')][_0x0a99('0x22')],function(_0x518617){return{'model':db[_0x518617['model']],'as':_0x518617['as'],'attributes':_0x518617[_0x0a99('0x1f')],'include':_0x518617[_0x0a99('0x22')]?_[_0x0a99('0x21')](_0x518617[_0x0a99('0x22')],function(_0x10e70f){return{'model':db[_0x10e70f[_0x0a99('0x23')]],'as':_0x10e70f['as'],'attributes':_0x10e70f[_0x0a99('0x1f')],'include':_0x10e70f[_0x0a99('0x22')]?_[_0x0a99('0x21')](_0x10e70f['include'],function(_0x411233){return{'model':db[_0x411233['model']],'as':_0x411233['as'],'attributes':_0x411233['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x223bdb){logger[_0x0a99('0x11')](_0x0a99('0x1a'),_0xbe23f3);logger[_0x0a99('0x24')](_0x0a99('0x1a'),_0xbe23f3,JSON[_0x0a99('0x25')](_0x223bdb));_0x5e6c7e(_0x223bdb);})[_0x0a99('0x19')](function(_0x47da33){logger[_0x0a99('0x15')](_0x0a99('0x1a'),_0x47da33[_0x0a99('0x17')],_0xbe23f3);_0x58c86d(_0x416d32[_0x0a99('0x15')](0x1f4,_0x47da33['message']));});});};exports['ShowMailAccount']=function(_0x563ee9){var _0x225e0f=this;return new Promise(function(_0x302da8,_0x1047a2){return db['MailAccount'][_0x0a99('0x26')]({'raw':_0x563ee9[_0x0a99('0x1c')]?_0x563ee9[_0x0a99('0x1c')][_0x0a99('0x1d')]===undefined?!![]:![]:!![],'where':_0x563ee9[_0x0a99('0x1c')]?_0x563ee9[_0x0a99('0x1c')][_0x0a99('0x1e')]||null:null,'attributes':_0x563ee9['options']?_0x563ee9[_0x0a99('0x1c')][_0x0a99('0x1f')]||null:null,'include':_0x563ee9[_0x0a99('0x1c')]?_0x563ee9[_0x0a99('0x1c')][_0x0a99('0x22')]?_['map'](_0x563ee9[_0x0a99('0x1c')]['include'],function(_0x555de8){return{'model':db[_0x555de8['model']],'as':_0x555de8['as'],'attributes':_0x555de8['attributes'],'include':_0x555de8[_0x0a99('0x22')]?_['map'](_0x555de8[_0x0a99('0x22')],function(_0x3d5e0f){return{'model':db[_0x3d5e0f[_0x0a99('0x23')]],'as':_0x3d5e0f['as'],'attributes':_0x3d5e0f[_0x0a99('0x1f')],'include':_0x3d5e0f[_0x0a99('0x22')]?_[_0x0a99('0x21')](_0x3d5e0f[_0x0a99('0x22')],function(_0x3bc3fc){return{'model':db[_0x3bc3fc[_0x0a99('0x23')]],'as':_0x3bc3fc['as'],'attributes':_0x3bc3fc[_0x0a99('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0a99('0x10')](function(_0x3a2a78){if(_0x563ee9[_0x0a99('0x1c')]['smtp']===!![])_0x3a2a78[_0x0a99('0x27')](_0x0a99('0x28'),_0x3a2a78['getSmtpOptions']());logger[_0x0a99('0x11')]('ShowMailAccount',_0x563ee9);logger[_0x0a99('0x24')]('ShowMailAccount',_0x563ee9,JSON[_0x0a99('0x25')](_0x3a2a78));_0x302da8(_0x3a2a78);})[_0x0a99('0x19')](function(_0x27af76){logger[_0x0a99('0x15')]('ShowMailAccount',_0x27af76[_0x0a99('0x17')],_0x563ee9);_0x1047a2(_0x225e0f[_0x0a99('0x15')](0x1f4,_0x27af76[_0x0a99('0x17')]));});});};exports['NotifyMailAccount']=function(_0x426638){var _0x1f5c01=this;return new Promise(function(_0x23e4b9,_0x1abeb0){var _0x5acfbc={'body':_0x426638[_0x0a99('0x29')],'channel':'mail'};var _0x4e552c=_[_0x0a99('0x2a')](_['keys'](db[_0x0a99('0x2b')]['rawAttributes']),[_0x0a99('0x2c'),_0x0a99('0x2d'),_0x0a99('0x2e'),_0x0a99('0x2f')]);var _0x57b999=![];if(_0x426638[_0x0a99('0x29')]['id']){delete _0x426638[_0x0a99('0x29')]['id'];}if(_[_0x0a99('0x30')](_0x426638[_0x0a99('0x29')]['from'])){return _0x1abeb0(_0x1f5c01['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x0a99('0x30')](_0x426638['body'][_0x0a99('0x29')])||_0x426638['body']['body']===''){return _0x1abeb0(_0x1f5c01['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0a99('0x30')](_0x426638['body'][_0x0a99('0x31')])){return _0x1abeb0(_0x1f5c01[_0x0a99('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e552c));}if(!_[_0x0a99('0x32')](_0x4e552c,_0x426638[_0x0a99('0x29')]['mapKey'])){return _0x1abeb0(_0x1f5c01[_0x0a99('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e552c));}var _0x3107bc={};_0x3107bc[_0x426638[_0x0a99('0x29')]['mapKey']]=_0x426638[_0x0a99('0x29')]['from'];return db['MailAccount'][_0x0a99('0x26')]({'where':{'id':_0x426638[_0x0a99('0x33')]['id']},'include':[{'model':db[_0x0a99('0x34')],'as':_0x0a99('0x35'),'include':[{'model':db[_0x0a99('0x2b')],'as':'Contacts','where':_0x3107bc,'limit':0x1,'order':[[_0x0a99('0x2d'),_0x0a99('0x36')]]}]},{'model':db[_0x0a99('0x37')],'as':_0x0a99('0x38')},{'model':db[_0x0a99('0x39')],'as':_0x0a99('0x3a'),'include':[{'model':db[_0x0a99('0x3b')],'as':_0x0a99('0x3b')}]}]})[_0x0a99('0x10')](function(_0x1621d9){if(_0x1621d9&&_0x1621d9['List']){var _0x50e04f=_0x1621d9[_0x0a99('0x3c')]({'plain':!![]});_0x5acfbc[_0x0a99('0x33')]=_[_0x0a99('0x3d')](_0x50e04f,[_0x0a99('0x38'),_0x0a99('0x35')]);_0x5acfbc[_0x0a99('0x33')]['smtpOptions']=_0x1621d9[_0x0a99('0x3e')]();_0x5acfbc[_0x0a99('0x3f')]=_0x50e04f['Applications'];_0x5acfbc[_0x0a99('0x40')]=_0x50e04f[_0x0a99('0x35')];_0x5acfbc['applications']=_[_0x0a99('0x41')](_0x5acfbc[_0x0a99('0x3f')],[_0x0a99('0x42')],[_0x0a99('0x43')]);if(_0x5acfbc[_0x0a99('0x33')]&&_0x5acfbc[_0x0a99('0x33')][_0x0a99('0x44')]){_0x5acfbc['applications'][_0x0a99('0x45')]({'id':0x0,'priority':_0x5acfbc[_0x0a99('0x3f')][_0x0a99('0x46')]+0x1,'app':'close','appdata':_0x0a99('0x44'),'interval':_0x0a99('0x47')});}if(_0x5acfbc[_0x0a99('0x33')]['Applications']){delete _0x5acfbc[_0x0a99('0x33')][_0x0a99('0x38')];}if(_0x5acfbc[_0x0a99('0x33')][_0x0a99('0x35')]){delete _0x5acfbc[_0x0a99('0x33')][_0x0a99('0x35')];}if(_0x50e04f['List'][_0x0a99('0x48')]['length']){return _0x50e04f[_0x0a99('0x35')][_0x0a99('0x48')][0x0];}var _0x330ff8=_[_0x0a99('0xb')](_0x426638['body'],{'firstName':_0x426638[_0x0a99('0x29')]['from'],'ListId':_0x50e04f[_0x0a99('0x2f')]});_0x330ff8[_0x426638[_0x0a99('0x29')][_0x0a99('0x31')]]=_0x426638[_0x0a99('0x29')][_0x0a99('0x49')];return db[_0x0a99('0x2b')][_0x0a99('0x4a')](_0x330ff8);}else{throw new Error(_0x0a99('0x4b'));}})[_0x0a99('0x10')](function(_0xb3a5b2){_0x5acfbc[_0x0a99('0x4c')]=_0xb3a5b2;if(_0xb3a5b2){if(!_0x426638[_0x0a99('0x29')][_0x0a99('0x17')]['messageId']){_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x4d')]=rs['generate']()+'\x20'+_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x49')];}var _0x50aaa0={'ContactId':_0xb3a5b2['id'],'MailAccountId':_0x426638[_0x0a99('0x33')]['id'],'inReplyTo':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x4d')],'to':_0x426638['body'][_0x0a99('0x17')][_0x0a99('0x49')],'cc':_0x426638[_0x0a99('0x29')]['message']['cc'],'subject':_0x426638['body'][_0x0a99('0x17')]['subject'],'attach':_0x426638['body']['message'][_0x0a99('0x4e')],'lastMsgAt':moment()['format'](_0x0a99('0x4f')),'lastMsgDirection':'in'};return db[_0x0a99('0x50')][_0x0a99('0x26')]({'where':{'closed':![],'MailAccountId':_0x426638[_0x0a99('0x33')]['id']},'include':[{'model':db[_0x0a99('0x51')],'as':_0x0a99('0x52'),'attributes':[_0x0a99('0x4d')],'where':{'messageId':_0x426638['body'][_0x0a99('0x17')][_0x0a99('0x53')]}}]})[_0x0a99('0x10')](function(_0x520889){if(_0x520889){return[_0x520889,![]];}return db[_0x0a99('0x50')]['create'](_0x50aaa0)[_0x0a99('0x10')](function(_0x51d18a){return[_0x51d18a,!![]];});});}else{throw new Error(_0x0a99('0x54'));}})[_0x0a99('0x55')](function(_0x544a23,_0x420c2d){if(_0x544a23){_0x57b999=_0x420c2d;if(!_0x420c2d){return _0x544a23['update']({'inReplyTo':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x4d')],'to':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x49')],'cc':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')]['cc'],'subject':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x56')],'attach':_0x544a23[_0x0a99('0x4e')]?_0x544a23[_0x0a99('0x4e')]:_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x4e')],'substatus':null,'substatusAt':moment()[_0x0a99('0x57')](_0x0a99('0x4f')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x544a23;}}})['then'](function(_0x40b1bb){_0x5acfbc[_0x0a99('0x58')]=_0x40b1bb[_0x0a99('0x3c')]({'plain':!![]});_0x5acfbc['interaction'][_0x0a99('0x59')]=_0x57b999;return db[_0x0a99('0x51')][_0x0a99('0x4a')]({'body':_0x426638[_0x0a99('0x29')]['body'],'MailAccountId':_0x426638[_0x0a99('0x33')]['id'],'MailInteractionId':_0x40b1bb['id'],'direction':'in','ContactId':_0x5acfbc[_0x0a99('0x4c')]['id'],'messageId':_0x426638['body']['message'][_0x0a99('0x4d')],'from':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x49')],'to':_0x426638[_0x0a99('0x29')]['message']['to'],'cc':_0x426638['body'][_0x0a99('0x17')]['cc'],'subject':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x56')],'attach':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x4e')],'Attachments':_0x426638[_0x0a99('0x29')]['message'][_0x0a99('0x5a')],'originTo':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')]['originTo'],'originCc':_0x426638[_0x0a99('0x29')]['message'][_0x0a99('0x5b')],'bcc':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x5c')],'ChatWebsiteId':_0x426638['body'][_0x0a99('0x17')][_0x0a99('0x5d')]||null,'originChannel':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x5e')]||_0x0a99('0x5f'),'ChatOfflineMessageId':_0x426638[_0x0a99('0x29')]['message'][_0x0a99('0x60')]||null},{'include':[{'model':db[_0x0a99('0x61')],'as':_0x0a99('0x62')}]});})[_0x0a99('0x10')](function(_0x4fc4a4){_0x5acfbc[_0x0a99('0x17')]=_0x4fc4a4;if(!_0x5acfbc['interaction']['UserId']){return;}return db[_0x0a99('0x63')][_0x0a99('0x26')]({'attributes':['id',_0x0a99('0x64')],'where':{'id':_0x5acfbc[_0x0a99('0x58')][_0x0a99('0x65')]}});})[_0x0a99('0x10')](function(_0x24a389){if(_0x24a389){_0x5acfbc[_0x0a99('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0a99('0x66'),'appdata':_0x24a389['name']+','+(_0x5acfbc['account']['waitForTheAssignedAgent']||0xa),'interval':_0x0a99('0x47')});}if(!_0x5acfbc[_0x0a99('0x58')]['queueId']){return;}return db['MailQueue'][_0x0a99('0x26')]({'attributes':['id',_0x0a99('0x64')],'where':{'id':_0x5acfbc[_0x0a99('0x58')][_0x0a99('0x67')]}});})[_0x0a99('0x10')](function(_0x3ed54e){if(_0x3ed54e){_0x5acfbc[_0x0a99('0x3f')][_0x0a99('0x68')]({'id':0x0,'priority':0x1,'app':_0x0a99('0x69'),'appdata':_0x3ed54e['name']+','+(_0x5acfbc['account'][_0x0a99('0x6a')]||0x12c),'interval':_0x0a99('0x47')});}return respondWithRpcPromise(_0x0a99('0x6b'),_0x0a99('0x6c'),_0x5acfbc);})[_0x0a99('0x10')](function(_0x22b737){_0x23e4b9(_0x22b737);})[_0x0a99('0x19')](function(_0x5588dc){_0x1abeb0(_0x1f5c01['error'](0x1f4,_0x5588dc[_0x0a99('0x17')]));});});}; \ No newline at end of file +var _0x3248=['GetMailAccount','findAll','options','where','attributes','limit','include','map','model','then','stringify','ShowMailAccount','MailAccount','raw','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','from','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','applications','list','orderBy','priority','asc','push','length','close','autoclose','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','MailMessage','Messages','Contact\x20not\x20found','spread','update','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','MailQueue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x25fa25,_0x26b171){var _0x1a9bbd=function(_0x1b4d2f){while(--_0x1b4d2f){_0x25fa25['push'](_0x25fa25['shift']());}};_0x1a9bbd(++_0x26b171);}(_0x3248,0x1b0));var _0x8324=function(_0x68e7af,_0x5bfa24){_0x68e7af=_0x68e7af-0x0;var _0x318240=_0x3248[_0x68e7af];return _0x318240;};'use strict';var _=require(_0x8324('0x0'));var moment=require(_0x8324('0x1'));var BPromise=require(_0x8324('0x2'));var rs=require(_0x8324('0x3'));var Redis=require(_0x8324('0x4'));var db=require(_0x8324('0x5'))['db'];var logger=require(_0x8324('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8324('0x7'));var client=jayson[_0x8324('0x8')]['http']({'port':0x232c});config[_0x8324('0x9')]=_[_0x8324('0xa')](config[_0x8324('0x9')],{'host':_0x8324('0xb'),'port':0x18eb});var socket=require(_0x8324('0xc'))(new Redis(config['redis']));require(_0x8324('0xd'))[_0x8324('0xe')](socket);function respondWithRpcPromise(_0x423b3f,_0x52b5f2,_0x55e1d2){return new BPromise(function(_0x1722ae,_0x3ad4e9){return client[_0x8324('0xf')](_0x423b3f,_0x55e1d2)['then'](function(_0xe358eb){logger[_0x8324('0x10')](_0x8324('0x11'),_0x52b5f2,_0x8324('0x12'));logger[_0x8324('0x13')](_0x8324('0x14'),_0x52b5f2,'request\x20sent',JSON['stringify'](_0xe358eb));if(_0xe358eb['error']){if(_0xe358eb[_0x8324('0x15')]['code']===0x1f4){logger['error'](_0x8324('0x11'),_0x52b5f2,_0xe358eb[_0x8324('0x15')][_0x8324('0x16')]);return _0x3ad4e9(_0xe358eb['error'][_0x8324('0x16')]);}logger[_0x8324('0x15')](_0x8324('0x11'),_0x52b5f2,_0xe358eb['error'][_0x8324('0x16')]);return _0x1722ae(_0xe358eb[_0x8324('0x15')][_0x8324('0x16')]);}else{logger[_0x8324('0x10')](_0x8324('0x11'),_0x52b5f2,_0x8324('0x12'));_0x1722ae(_0xe358eb['result']['message']);}})[_0x8324('0x17')](function(_0x404d16){logger[_0x8324('0x15')]('MailAccount,\x20%s,\x20%s',_0x52b5f2,_0x404d16);_0x3ad4e9(_0x404d16);});});}exports[_0x8324('0x18')]=function(_0x19a888){var _0x43df53=this;return new Promise(function(_0x3162d8,_0x3b816b){return db['MailAccount'][_0x8324('0x19')]({'raw':_0x19a888['options']?_0x19a888[_0x8324('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x19a888[_0x8324('0x1a')]?_0x19a888['options'][_0x8324('0x1b')]||null:null,'attributes':_0x19a888[_0x8324('0x1a')]?_0x19a888[_0x8324('0x1a')][_0x8324('0x1c')]||null:null,'limit':_0x19a888[_0x8324('0x1a')]?_0x19a888[_0x8324('0x1a')][_0x8324('0x1d')]||null:null,'include':_0x19a888[_0x8324('0x1a')]?_0x19a888[_0x8324('0x1a')][_0x8324('0x1e')]?_[_0x8324('0x1f')](_0x19a888[_0x8324('0x1a')][_0x8324('0x1e')],function(_0x38a09a){return{'model':db[_0x38a09a[_0x8324('0x20')]],'as':_0x38a09a['as'],'attributes':_0x38a09a[_0x8324('0x1c')],'include':_0x38a09a[_0x8324('0x1e')]?_[_0x8324('0x1f')](_0x38a09a[_0x8324('0x1e')],function(_0x2b77e4){return{'model':db[_0x2b77e4[_0x8324('0x20')]],'as':_0x2b77e4['as'],'attributes':_0x2b77e4[_0x8324('0x1c')],'include':_0x2b77e4[_0x8324('0x1e')]?_[_0x8324('0x1f')](_0x2b77e4[_0x8324('0x1e')],function(_0x4e022b){return{'model':db[_0x4e022b[_0x8324('0x20')]],'as':_0x4e022b['as'],'attributes':_0x4e022b[_0x8324('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8324('0x21')](function(_0x17bda7){logger['info'](_0x8324('0x18'),_0x19a888);logger[_0x8324('0x13')](_0x8324('0x18'),_0x19a888,JSON[_0x8324('0x22')](_0x17bda7));_0x3162d8(_0x17bda7);})[_0x8324('0x17')](function(_0x7dc4c9){logger[_0x8324('0x15')]('GetMailAccount',_0x7dc4c9[_0x8324('0x16')],_0x19a888);_0x3b816b(_0x43df53[_0x8324('0x15')](0x1f4,_0x7dc4c9[_0x8324('0x16')]));});});};exports[_0x8324('0x23')]=function(_0x27b46d){var _0x2cb126=this;return new Promise(function(_0x50a23c,_0x39f37){return db[_0x8324('0x24')]['find']({'raw':_0x27b46d[_0x8324('0x1a')]?_0x27b46d[_0x8324('0x1a')][_0x8324('0x25')]===undefined?!![]:![]:!![],'where':_0x27b46d['options']?_0x27b46d[_0x8324('0x1a')][_0x8324('0x1b')]||null:null,'attributes':_0x27b46d['options']?_0x27b46d['options'][_0x8324('0x1c')]||null:null,'include':_0x27b46d[_0x8324('0x1a')]?_0x27b46d[_0x8324('0x1a')]['include']?_['map'](_0x27b46d['options'][_0x8324('0x1e')],function(_0x139f69){return{'model':db[_0x139f69[_0x8324('0x20')]],'as':_0x139f69['as'],'attributes':_0x139f69[_0x8324('0x1c')],'include':_0x139f69['include']?_[_0x8324('0x1f')](_0x139f69[_0x8324('0x1e')],function(_0x23c811){return{'model':db[_0x23c811[_0x8324('0x20')]],'as':_0x23c811['as'],'attributes':_0x23c811['attributes'],'include':_0x23c811[_0x8324('0x1e')]?_[_0x8324('0x1f')](_0x23c811[_0x8324('0x1e')],function(_0x3484fc){return{'model':db[_0x3484fc['model']],'as':_0x3484fc['as'],'attributes':_0x3484fc[_0x8324('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8324('0x21')](function(_0xde725){if(_0x27b46d[_0x8324('0x1a')][_0x8324('0x26')]===!![])_0xde725[_0x8324('0x27')](_0x8324('0x28'),_0xde725[_0x8324('0x29')]());logger[_0x8324('0x10')]('ShowMailAccount',_0x27b46d);logger['debug']('ShowMailAccount',_0x27b46d,JSON[_0x8324('0x22')](_0xde725));_0x50a23c(_0xde725);})[_0x8324('0x17')](function(_0xc762f6){logger[_0x8324('0x15')]('ShowMailAccount',_0xc762f6[_0x8324('0x16')],_0x27b46d);_0x39f37(_0x2cb126['error'](0x1f4,_0xc762f6[_0x8324('0x16')]));});});};exports[_0x8324('0x2a')]=function(_0x59ad42){var _0x462f66=this;return new Promise(function(_0x21113d,_0x8fa450){var _0x391ee6={'body':_0x59ad42[_0x8324('0x2b')],'channel':_0x8324('0x2c')};var _0x21b0ce=_[_0x8324('0x2d')](_[_0x8324('0x2e')](db[_0x8324('0x2f')][_0x8324('0x30')]),[_0x8324('0x31'),_0x8324('0x32'),'CompanyId',_0x8324('0x33')]);var _0x270e95=![];if(_0x59ad42['body']['id']){delete _0x59ad42[_0x8324('0x2b')]['id'];}if(_['isNil'](_0x59ad42[_0x8324('0x2b')]['from'])){return _0x8fa450(_0x462f66[_0x8324('0x15')](0x1f4,_0x8324('0x34')));}if(_[_0x8324('0x35')](_0x59ad42[_0x8324('0x2b')][_0x8324('0x2b')])||_0x59ad42['body']['body']===''){return _0x8fa450(_0x462f66[_0x8324('0x15')](0x1f4,_0x8324('0x36')));}if(_[_0x8324('0x35')](_0x59ad42[_0x8324('0x2b')]['mapKey'])){return _0x8fa450(_0x462f66[_0x8324('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21b0ce));}if(!_[_0x8324('0x37')](_0x21b0ce,_0x59ad42[_0x8324('0x2b')][_0x8324('0x38')])){return _0x8fa450(_0x462f66[_0x8324('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21b0ce));}var _0x2d7730={};_0x2d7730[_0x59ad42['body'][_0x8324('0x38')]]=_0x59ad42[_0x8324('0x2b')][_0x8324('0x39')];return db[_0x8324('0x24')]['find']({'where':{'id':_0x59ad42[_0x8324('0x3a')]['id']},'include':[{'model':db[_0x8324('0x3b')],'as':_0x8324('0x3c'),'include':[{'model':db['CmContact'],'as':_0x8324('0x3d'),'where':_0x2d7730,'limit':0x1,'order':[['updatedAt',_0x8324('0x3e')]]}]},{'model':db[_0x8324('0x3f')],'as':_0x8324('0x40')},{'model':db[_0x8324('0x41')],'as':'Smtp','include':[{'model':db[_0x8324('0x42')],'as':_0x8324('0x42')}]}]})[_0x8324('0x21')](function(_0x18f459){if(_0x18f459&&_0x18f459[_0x8324('0x3c')]){var _0x51cf35=_0x18f459[_0x8324('0x43')]({'plain':!![]});_0x391ee6[_0x8324('0x3a')]=_['omit'](_0x51cf35,['Applications',_0x8324('0x3c')]);_0x391ee6['account']['smtpOptions']=_0x18f459[_0x8324('0x29')]();_0x391ee6[_0x8324('0x44')]=_0x51cf35['Applications'];_0x391ee6[_0x8324('0x45')]=_0x51cf35['List'];_0x391ee6['applications']=_[_0x8324('0x46')](_0x391ee6['applications'],[_0x8324('0x47')],[_0x8324('0x48')]);if(_0x391ee6[_0x8324('0x3a')]&&_0x391ee6[_0x8324('0x3a')]['autoclose']){_0x391ee6[_0x8324('0x44')][_0x8324('0x49')]({'id':0x0,'priority':_0x391ee6[_0x8324('0x44')][_0x8324('0x4a')]+0x1,'app':_0x8324('0x4b'),'appdata':_0x8324('0x4c'),'interval':'*,*,*,*'});}if(_0x391ee6['account'][_0x8324('0x40')]){delete _0x391ee6[_0x8324('0x3a')][_0x8324('0x40')];}if(_0x391ee6[_0x8324('0x3a')][_0x8324('0x3c')]){delete _0x391ee6[_0x8324('0x3a')]['List'];}if(_0x51cf35[_0x8324('0x3c')][_0x8324('0x3d')][_0x8324('0x4a')]){return _0x51cf35[_0x8324('0x3c')][_0x8324('0x3d')][0x0];}var _0xb0f321=_[_0x8324('0xa')](_0x59ad42['body'],{'firstName':_0x59ad42[_0x8324('0x2b')][_0x8324('0x39')],'ListId':_0x51cf35[_0x8324('0x33')]});_0xb0f321[_0x59ad42['body'][_0x8324('0x38')]]=_0x59ad42['body'][_0x8324('0x39')];return db[_0x8324('0x2f')][_0x8324('0x4d')](_0xb0f321);}else{throw new Error(_0x8324('0x4e'));}})[_0x8324('0x21')](function(_0x578a9f){_0x391ee6[_0x8324('0x4f')]=_0x578a9f;if(_0x578a9f){if(!_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')][_0x8324('0x50')]){_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')]['messageId']=rs[_0x8324('0x51')]()+'\x20'+_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')][_0x8324('0x39')];}var _0x5400d8={'ContactId':_0x578a9f['id'],'MailAccountId':_0x59ad42['account']['id'],'inReplyTo':_0x59ad42['body'][_0x8324('0x16')][_0x8324('0x50')],'to':_0x59ad42['body']['message'][_0x8324('0x39')],'cc':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')]['cc'],'subject':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')][_0x8324('0x52')],'attach':_0x59ad42['body'][_0x8324('0x16')][_0x8324('0x53')],'lastMsgAt':moment()[_0x8324('0x54')](_0x8324('0x55')),'lastMsgDirection':'in'};return db[_0x8324('0x56')][_0x8324('0x57')]({'where':{'closed':![],'MailAccountId':_0x59ad42[_0x8324('0x3a')]['id']},'include':[{'model':db[_0x8324('0x58')],'as':_0x8324('0x59'),'attributes':[_0x8324('0x50')],'where':{'messageId':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')]['inReplyTo']}}]})[_0x8324('0x21')](function(_0x48f09f){if(_0x48f09f){return[_0x48f09f,![]];}return db[_0x8324('0x56')][_0x8324('0x4d')](_0x5400d8)['then'](function(_0x50e96c){return[_0x50e96c,!![]];});});}else{throw new Error(_0x8324('0x5a'));}})[_0x8324('0x5b')](function(_0x12fea6,_0x361d21){if(_0x12fea6){_0x270e95=_0x361d21;if(!_0x361d21){return _0x12fea6[_0x8324('0x5c')]({'inReplyTo':_0x59ad42['body']['message'][_0x8324('0x50')],'to':_0x59ad42['body'][_0x8324('0x16')]['from'],'cc':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')]['cc'],'subject':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')][_0x8324('0x52')],'attach':_0x12fea6['attach']?_0x12fea6[_0x8324('0x53')]:_0x59ad42[_0x8324('0x2b')]['message'][_0x8324('0x53')],'substatus':null,'substatusAt':moment()['format'](_0x8324('0x55')),'lastMsgAt':moment()['format'](_0x8324('0x55')),'lastMsgDirection':'in'});}else{return _0x12fea6;}}})[_0x8324('0x21')](function(_0x216cae){_0x391ee6[_0x8324('0x5d')]=_0x216cae[_0x8324('0x43')]({'plain':!![]});_0x391ee6[_0x8324('0x5d')]['created']=_0x270e95;return db[_0x8324('0x58')][_0x8324('0x4d')]({'body':_0x59ad42[_0x8324('0x2b')]['body'],'MailAccountId':_0x59ad42[_0x8324('0x3a')]['id'],'MailInteractionId':_0x216cae['id'],'direction':'in','ContactId':_0x391ee6[_0x8324('0x4f')]['id'],'messageId':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')][_0x8324('0x50')],'from':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')]['from'],'to':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')]['to'],'cc':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')]['cc'],'subject':_0x59ad42['body'][_0x8324('0x16')][_0x8324('0x52')],'attach':_0x59ad42[_0x8324('0x2b')]['message']['attach'],'Attachments':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')][_0x8324('0x5e')],'originTo':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')][_0x8324('0x5f')],'originCc':_0x59ad42[_0x8324('0x2b')]['message'][_0x8324('0x60')],'bcc':_0x59ad42[_0x8324('0x2b')]['message'][_0x8324('0x61')],'ChatWebsiteId':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')][_0x8324('0x62')]||null,'originChannel':_0x59ad42[_0x8324('0x2b')][_0x8324('0x16')][_0x8324('0x63')]||_0x8324('0x64'),'ChatOfflineMessageId':_0x59ad42['body']['message'][_0x8324('0x65')]||null},{'include':[{'model':db[_0x8324('0x66')],'as':_0x8324('0x67')}]});})[_0x8324('0x21')](function(_0x595ddd){_0x391ee6[_0x8324('0x16')]=_0x595ddd;if(!_0x391ee6['interaction']['UserId']){return;}return db[_0x8324('0x68')][_0x8324('0x57')]({'attributes':['id',_0x8324('0x69')],'where':{'id':_0x391ee6[_0x8324('0x5d')]['UserId']}});})[_0x8324('0x21')](function(_0x4c0e76){if(_0x4c0e76){_0x391ee6[_0x8324('0x44')][_0x8324('0x6a')]({'id':0x0,'priority':0x0,'app':_0x8324('0x6b'),'appdata':_0x4c0e76['name']+','+(_0x391ee6['account'][_0x8324('0x6c')]||0xa),'interval':_0x8324('0x6d')});}if(!_0x391ee6[_0x8324('0x5d')]['queueId']){return;}return db[_0x8324('0x6e')][_0x8324('0x57')]({'attributes':['id',_0x8324('0x69')],'where':{'id':_0x391ee6[_0x8324('0x5d')]['queueId']}});})['then'](function(_0x46af04){if(_0x46af04){_0x391ee6[_0x8324('0x44')][_0x8324('0x6a')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x46af04[_0x8324('0x69')]+','+(_0x391ee6[_0x8324('0x3a')][_0x8324('0x6f')]||0x12c),'interval':_0x8324('0x6d')});}return respondWithRpcPromise(_0x8324('0x70'),_0x8324('0x71'),_0x391ee6);})['then'](function(_0x59c9c3){_0x21113d(_0x59c9c3);})[_0x8324('0x17')](function(_0x3625b6){_0x8fa450(_0x462f66['error'](0x1f4,_0x3625b6['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 6607942..4069e4d 100644 --- a/server/api/mailAccount/mailAccount.socket.js +++ b/server/api/mailAccount/mailAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9699=['length','mailAccount:','./mailAccount.events','save','emit','removeListener','register'];(function(_0x384231,_0x50be41){var _0x2480bf=function(_0x1c4838){while(--_0x1c4838){_0x384231['push'](_0x384231['shift']());}};_0x2480bf(++_0x50be41);}(_0x9699,0xd4));var _0x9969=function(_0x4d741e,_0x39f4d3){_0x4d741e=_0x4d741e-0x0;var _0x368894=_0x9699[_0x4d741e];return _0x368894;};'use strict';var MailAccountEvents=require(_0x9969('0x0'));var events=[_0x9969('0x1'),'remove','update'];function createListener(_0x11697f,_0x2e9660){return function(_0x54d7f2){_0x2e9660[_0x9969('0x2')](_0x11697f,_0x54d7f2);};}function removeListener(_0x4e633d,_0x5efafc){return function(){MailAccountEvents[_0x9969('0x3')](_0x4e633d,_0x5efafc);};}exports[_0x9969('0x4')]=function(_0x3e2b68){for(var _0x41c8b3=0x0,_0x1efa92=events[_0x9969('0x5')];_0x41c8b3<_0x1efa92;_0x41c8b3++){var _0x70260f=events[_0x41c8b3];var _0x5a052d=createListener(_0x9969('0x6')+_0x70260f,_0x3e2b68);MailAccountEvents['on'](_0x70260f,_0x5a052d);}}; \ No newline at end of file +var _0x7d31=['removeListener','register','length','mailAccount:','./mailAccount.events','remove','update','emit'];(function(_0x49fc60,_0x1a477a){var _0x373950=function(_0x39b456){while(--_0x39b456){_0x49fc60['push'](_0x49fc60['shift']());}};_0x373950(++_0x1a477a);}(_0x7d31,0x1e4));var _0x17d3=function(_0x10346c,_0x183ce6){_0x10346c=_0x10346c-0x0;var _0x262bd4=_0x7d31[_0x10346c];return _0x262bd4;};'use strict';var MailAccountEvents=require(_0x17d3('0x0'));var events=['save',_0x17d3('0x1'),_0x17d3('0x2')];function createListener(_0x8c13b4,_0x5bf57b){return function(_0x172ed3){_0x5bf57b[_0x17d3('0x3')](_0x8c13b4,_0x172ed3);};}function removeListener(_0x1dc1a8,_0x2315cf){return function(){MailAccountEvents[_0x17d3('0x4')](_0x1dc1a8,_0x2315cf);};}exports[_0x17d3('0x5')]=function(_0x274059){for(var _0x2e5216=0x0,_0x14c515=events[_0x17d3('0x6')];_0x2e5216<_0x14c515;_0x2e5216++){var _0x59589f=events[_0x2e5216];var _0x3d7936=createListener(_0x17d3('0x7')+_0x59589f,_0x274059);MailAccountEvents['on'](_0x59589f,_0x3d7936);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 828db63..331c113 100644 --- a/server/api/mailApplication/index.js +++ b/server/api/mailApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbabb=['update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated','show'];(function(_0x148303,_0x1e221e){var _0x17e53f=function(_0x35e26f){while(--_0x35e26f){_0x148303['push'](_0x148303['shift']());}};_0x17e53f(++_0x1e221e);}(_0xbabb,0x73));var _0xbbab=function(_0x2bbdde,_0x340b60){_0x2bbdde=_0x2bbdde-0x0;var _0x326378=_0xbabb[_0x2bbdde];return _0x326378;};'use strict';var multer=require(_0xbbab('0x0'));var util=require(_0xbbab('0x1'));var path=require('path');var timeout=require(_0xbbab('0x2'));var express=require(_0xbbab('0x3'));var router=express['Router']();var fs_extra=require(_0xbbab('0x4'));var auth=require(_0xbbab('0x5'));var interaction=require(_0xbbab('0x6'));var config=require('../../config/environment');var controller=require(_0xbbab('0x7'));router['get'](_0xbbab('0x8'),auth[_0xbbab('0x9')](),controller[_0xbbab('0xa')]);router['put'](_0xbbab('0x8'),auth[_0xbbab('0x9')](),controller[_0xbbab('0xb')]);router['delete'](_0xbbab('0x8'),auth['isAuthenticated'](),controller[_0xbbab('0xc')]);module[_0xbbab('0xd')]=router; \ No newline at end of file +var _0x2078=['isAuthenticated','show','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./mailApplication.controller','/:id'];(function(_0xcd81b8,_0x18d9fd){var _0xc3ae18=function(_0x2bd4e0){while(--_0x2bd4e0){_0xcd81b8['push'](_0xcd81b8['shift']());}};_0xc3ae18(++_0x18d9fd);}(_0x2078,0xca));var _0x8207=function(_0x24f0fe,_0x51e150){_0x24f0fe=_0x24f0fe-0x0;var _0xcb6804=_0x2078[_0x24f0fe];return _0xcb6804;};'use strict';var multer=require(_0x8207('0x0'));var util=require(_0x8207('0x1'));var path=require(_0x8207('0x2'));var timeout=require('connect-timeout');var express=require(_0x8207('0x3'));var router=express[_0x8207('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8207('0x5'));var config=require('../../config/environment');var controller=require(_0x8207('0x6'));router['get'](_0x8207('0x7'),auth[_0x8207('0x8')](),controller[_0x8207('0x9')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8207('0xa')]);router[_0x8207('0xb')]('/:id',auth[_0x8207('0x8')](),controller[_0x8207('0xc')]);module[_0x8207('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index cbfdb3f..9ece91c 100644 --- a/server/api/mailApplication/mailApplication.attributes.js +++ b/server/api/mailApplication/mailApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdee6=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x4e5c3e,_0x32abf1){var _0x58e1a0=function(_0x4ca18b){while(--_0x4ca18b){_0x4e5c3e['push'](_0x4e5c3e['shift']());}};_0x58e1a0(++_0x32abf1);}(_0xdee6,0x9f));var _0x6dee=function(_0x4b47e9,_0x41dc3a){_0x4b47e9=_0x4b47e9-0x0;var _0x1e8ac2=_0xdee6[_0x4b47e9];return _0x1e8ac2;};'use strict';var Sequelize=require(_0x6dee('0x0'));module[_0x6dee('0x1')]={'priority':{'type':Sequelize[_0x6dee('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6dee('0x3')},'appdata':{'type':Sequelize[_0x6dee('0x4')]()},'description':{'type':Sequelize[_0x6dee('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6dee('0x6')}}; \ No newline at end of file +var _0x9e63=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x5d9475,_0x59b0b0){var _0x5bfa40=function(_0x52e2ce){while(--_0x52e2ce){_0x5d9475['push'](_0x5d9475['shift']());}};_0x5bfa40(++_0x59b0b0);}(_0x9e63,0x65));var _0x39e6=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x9e63[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x39e6('0x0'));module[_0x39e6('0x1')]={'priority':{'type':Sequelize[_0x39e6('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x39e6('0x3')},'appdata':{'type':Sequelize[_0x39e6('0x4')]()},'description':{'type':Sequelize[_0x39e6('0x5')]},'interval':{'type':Sequelize[_0x39e6('0x5')],'defaultValue':_0x39e6('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index ca77cea..7ca3b33 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x47aded,_0xb76625){var _0x505e9a=function(_0x68696d){while(--_0x68696d){_0x47aded['push'](_0x47aded['shift']());}};_0x505e9a(++_0xb76625);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x1d5ccb,_0x136776){var _0x49fc07=function(_0x3c29c6){while(--_0x3c29c6){_0x1d5ccb['push'](_0x1d5ccb['shift']());}};_0x49fc07(++_0x136776);}(_0x70e0,0x17b));var _0x070e=function(_0x5008eb,_0x1b54aa){_0x5008eb=_0x5008eb-0x0;var _0x5caaf6=_0x70e0[_0x5008eb];return _0x5caaf6;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index fde2ebf..3c77ac8 100644 --- a/server/api/mailApplication/mailApplication.model.js +++ b/server/api/mailApplication/mailApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa208=['path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise'];(function(_0x10265e,_0xf3d38c){var _0x491c0e=function(_0x35b007){while(--_0x35b007){_0x10265e['push'](_0x10265e['shift']());}};_0x491c0e(++_0xf3d38c);}(_0xa208,0x159));var _0x8a20=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa208[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x8a20('0x0'));var util=require('util');var logger=require(_0x8a20('0x1'))(_0x8a20('0x2'));var moment=require(_0x8a20('0x3'));var BPromise=require('bluebird');var rp=require(_0x8a20('0x4'));var fs=require('fs');var path=require(_0x8a20('0x5'));var rimraf=require(_0x8a20('0x6'));var config=require(_0x8a20('0x7'));var attributes=require(_0x8a20('0x8'));module[_0x8a20('0x9')]=function(_0x39f41b,_0x552c7e){return _0x39f41b['define'](_0x8a20('0xa'),attributes,{'tableName':_0x8a20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8a20('0xc'),'collate':_0x8a20('0xd')});}; \ No newline at end of file +var _0x75b4=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x26ebdd,_0x383423){var _0x14a50a=function(_0x51a775){while(--_0x51a775){_0x26ebdd['push'](_0x26ebdd['shift']());}};_0x14a50a(++_0x383423);}(_0x75b4,0x12b));var _0x475b=function(_0x35d4a5,_0x2523f0){_0x35d4a5=_0x35d4a5-0x0;var _0x330e78=_0x75b4[_0x35d4a5];return _0x330e78;};'use strict';var _=require(_0x475b('0x0'));var util=require(_0x475b('0x1'));var logger=require(_0x475b('0x2'))('api');var moment=require(_0x475b('0x3'));var BPromise=require(_0x475b('0x4'));var rp=require(_0x475b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x475b('0x6'));var config=require(_0x475b('0x7'));var attributes=require(_0x475b('0x8'));module['exports']=function(_0x19e929,_0x2017ca){return _0x19e929[_0x475b('0x9')](_0x475b('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x475b('0xb'),'collate':_0x475b('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9bd3dfa..fe271e6 100644 --- a/server/api/mailApplication/mailApplication.rpc.js +++ b/server/api/mailApplication/mailApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99b2=['options','raw','attributes','limit','UpdateMailApplication','debug','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','MailApplication,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','update','body'];(function(_0x4eeebc,_0x1579e7){var _0x1316e1=function(_0x46cfc3){while(--_0x46cfc3){_0x4eeebc['push'](_0x4eeebc['shift']());}};_0x1316e1(++_0x1579e7);}(_0x99b2,0x12f));var _0x299b=function(_0x2cd31c,_0x10721e){_0x2cd31c=_0x2cd31c-0x0;var _0x150d3e=_0x99b2[_0x2cd31c];return _0x150d3e;};'use strict';var _=require(_0x299b('0x0'));var util=require(_0x299b('0x1'));var moment=require('moment');var BPromise=require(_0x299b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x299b('0x3'))['db'];var utils=require(_0x299b('0x4'));var logger=require(_0x299b('0x5'))(_0x299b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x299b('0x7')][_0x299b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb7a492,_0xa00406,_0x209448){return new BPromise(function(_0x23a9ee,_0x4854dc){return client['request'](_0xb7a492,_0x209448)[_0x299b('0x9')](function(_0x2cbf4c){logger[_0x299b('0xa')](_0x299b('0xb'),_0xa00406,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0xa00406,'request\x20sent',JSON[_0x299b('0xc')](_0x2cbf4c));if(_0x2cbf4c[_0x299b('0xd')]){if(_0x2cbf4c[_0x299b('0xd')][_0x299b('0xe')]===0x1f4){logger[_0x299b('0xd')](_0x299b('0xb'),_0xa00406,_0x2cbf4c['error'][_0x299b('0xf')]);return _0x4854dc(_0x2cbf4c[_0x299b('0xd')][_0x299b('0xf')]);}logger[_0x299b('0xd')]('MailApplication,\x20%s,\x20%s',_0xa00406,_0x2cbf4c[_0x299b('0xd')][_0x299b('0xf')]);return _0x23a9ee(_0x2cbf4c[_0x299b('0xd')][_0x299b('0xf')]);}else{logger[_0x299b('0xa')](_0x299b('0xb'),_0xa00406,_0x299b('0x10'));_0x23a9ee(_0x2cbf4c[_0x299b('0x11')]['message']);}})[_0x299b('0x12')](function(_0x262423){logger[_0x299b('0xd')](_0x299b('0xb'),_0xa00406,_0x262423);_0x4854dc(_0x262423);});});}exports['UpdateMailApplication']=function(_0x49d414){var _0x265532=this;return new Promise(function(_0x243494,_0x35d627){return db['MailApplication'][_0x299b('0x13')](_0x49d414[_0x299b('0x14')],{'raw':_0x49d414[_0x299b('0x15')]?_0x49d414[_0x299b('0x15')][_0x299b('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49d414[_0x299b('0x15')]?_0x49d414[_0x299b('0x15')]['where']||null:null,'attributes':_0x49d414[_0x299b('0x15')]?_0x49d414['options'][_0x299b('0x17')]||null:null,'limit':_0x49d414[_0x299b('0x15')]?_0x49d414[_0x299b('0x15')][_0x299b('0x18')]||null:null})[_0x299b('0x9')](function(_0x187be6){logger[_0x299b('0xa')](_0x299b('0x19'),_0x49d414);logger[_0x299b('0x1a')]('UpdateMailApplication',_0x49d414,JSON[_0x299b('0xc')](_0x187be6));_0x243494(_0x187be6);})[_0x299b('0x12')](function(_0x332090){logger[_0x299b('0xd')](_0x299b('0x19'),_0x332090[_0x299b('0xf')],_0x49d414);_0x35d627(_0x265532[_0x299b('0xd')](0x1f4,_0x332090[_0x299b('0xf')]));});});}; \ No newline at end of file +var _0x13fb=['message','info','catch','MailApplication','update','body','raw','options','limit','UpdateMailApplication','lodash','util','randomstring','../../mysqldb','../../config/logger','client','http','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x36ac6a,_0x1195e1){var _0x1f992b=function(_0x16f319){while(--_0x16f319){_0x36ac6a['push'](_0x36ac6a['shift']());}};_0x1f992b(++_0x1195e1);}(_0x13fb,0xa0));var _0xb13f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x13fb[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xb13f('0x0'));var util=require(_0xb13f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb13f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb13f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb13f('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb13f('0x5')][_0xb13f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x15c710,_0x94cd87,_0x46c6e4){return new BPromise(function(_0x3a3024,_0x341019){return client['request'](_0x15c710,_0x46c6e4)[_0xb13f('0x7')](function(_0x2c7e31){logger['info'](_0xb13f('0x8'),_0x94cd87,_0xb13f('0x9'));logger[_0xb13f('0xa')](_0xb13f('0xb'),_0x94cd87,_0xb13f('0x9'),JSON[_0xb13f('0xc')](_0x2c7e31));if(_0x2c7e31[_0xb13f('0xd')]){if(_0x2c7e31[_0xb13f('0xd')][_0xb13f('0xe')]===0x1f4){logger[_0xb13f('0xd')](_0xb13f('0x8'),_0x94cd87,_0x2c7e31[_0xb13f('0xd')][_0xb13f('0xf')]);return _0x341019(_0x2c7e31[_0xb13f('0xd')][_0xb13f('0xf')]);}logger[_0xb13f('0xd')]('MailApplication,\x20%s,\x20%s',_0x94cd87,_0x2c7e31[_0xb13f('0xd')][_0xb13f('0xf')]);return _0x3a3024(_0x2c7e31['error'][_0xb13f('0xf')]);}else{logger[_0xb13f('0x10')](_0xb13f('0x8'),_0x94cd87,'request\x20sent');_0x3a3024(_0x2c7e31['result'][_0xb13f('0xf')]);}})[_0xb13f('0x11')](function(_0x2e436e){logger[_0xb13f('0xd')](_0xb13f('0x8'),_0x94cd87,_0x2e436e);_0x341019(_0x2e436e);});});}exports['UpdateMailApplication']=function(_0xf27198){var _0x4009c6=this;return new Promise(function(_0x6fa10a,_0x4ea7c6){return db[_0xb13f('0x12')][_0xb13f('0x13')](_0xf27198[_0xb13f('0x14')],{'raw':_0xf27198['options']?_0xf27198['options'][_0xb13f('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf27198[_0xb13f('0x16')]?_0xf27198[_0xb13f('0x16')]['where']||null:null,'attributes':_0xf27198['options']?_0xf27198[_0xb13f('0x16')]['attributes']||null:null,'limit':_0xf27198[_0xb13f('0x16')]?_0xf27198[_0xb13f('0x16')][_0xb13f('0x17')]||null:null})['then'](function(_0x4e2e62){logger[_0xb13f('0x10')]('UpdateMailApplication',_0xf27198);logger[_0xb13f('0xa')](_0xb13f('0x18'),_0xf27198,JSON[_0xb13f('0xc')](_0x4e2e62));_0x6fa10a(_0x4e2e62);})[_0xb13f('0x11')](function(_0x419e8d){logger[_0xb13f('0xd')](_0xb13f('0x18'),_0x419e8d[_0xb13f('0xf')],_0xf27198);_0x4ea7c6(_0x4009c6[_0xb13f('0xd')](0x1f4,_0x419e8d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 0c5cf8c..04b49e0 100644 --- a/server/api/mailInteraction/index.js +++ b/server/api/mailInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1101=['delete','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','mailinteraction:destroy','destroy'];(function(_0xfb8e9c,_0x4bfaec){var _0x432968=function(_0x574cce){while(--_0x574cce){_0xfb8e9c['push'](_0xfb8e9c['shift']());}};_0x432968(++_0x4bfaec);}(_0x1101,0x99));var _0x1110=function(_0x745a7,_0xac4926){_0x745a7=_0x745a7-0x0;var _0x46e175=_0x1101[_0x745a7];return _0x46e175;};'use strict';var express=require(_0x1110('0x0'));var router=express['Router']();var auth=require(_0x1110('0x1'));var interaction=require(_0x1110('0x2'));var controller=require(_0x1110('0x3'));router[_0x1110('0x4')]('/',auth['isAuthenticated'](),controller[_0x1110('0x5')]);router[_0x1110('0x4')]('/describe',auth[_0x1110('0x6')](),controller[_0x1110('0x7')]);router['get'](_0x1110('0x8'),auth['isAuthenticated'](),controller[_0x1110('0x9')]);router[_0x1110('0x4')]('/:id/messages',auth[_0x1110('0x6')](),controller[_0x1110('0xa')]);router[_0x1110('0x4')](_0x1110('0xb'),auth[_0x1110('0x6')](),controller[_0x1110('0xc')]);router[_0x1110('0xd')]('/',auth[_0x1110('0x6')](),controller[_0x1110('0xe')]);router[_0x1110('0xd')](_0x1110('0xf'),auth[_0x1110('0x6')](),controller[_0x1110('0x10')]);router[_0x1110('0xd')](_0x1110('0x11'),auth['isAuthenticated'](),interaction[_0x1110('0x12')](_0x1110('0x13'),_0x1110('0x14')),controller[_0x1110('0x15')]);router[_0x1110('0x16')](_0x1110('0x8'),auth['isAuthenticated'](),interaction[_0x1110('0x12')](_0x1110('0x13'),_0x1110('0x17')),controller[_0x1110('0x18')]);router['delete'](_0x1110('0x8'),auth[_0x1110('0x6')](),interaction[_0x1110('0x12')]('mail',_0x1110('0x19')),controller[_0x1110('0x1a')]);router[_0x1110('0x1b')](_0x1110('0x11'),auth[_0x1110('0x6')](),controller[_0x1110('0x1c')]);module[_0x1110('0x1d')]=router; \ No newline at end of file +var _0x8605=['index','/describe','describe','/:id','show','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated'];(function(_0x9454ca,_0x859c39){var _0x423535=function(_0x3a962f){while(--_0x3a962f){_0x9454ca['push'](_0x9454ca['shift']());}};_0x423535(++_0x859c39);}(_0x8605,0x1e0));var _0x5860=function(_0x351f42,_0x78ecd){_0x351f42=_0x351f42-0x0;var _0x91074d=_0x8605[_0x351f42];return _0x91074d;};'use strict';var express=require(_0x5860('0x0'));var router=express[_0x5860('0x1')]();var auth=require(_0x5860('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x5860('0x3'));router[_0x5860('0x4')]('/',auth[_0x5860('0x5')](),controller[_0x5860('0x6')]);router[_0x5860('0x4')](_0x5860('0x7'),auth[_0x5860('0x5')](),controller[_0x5860('0x8')]);router['get'](_0x5860('0x9'),auth['isAuthenticated'](),controller[_0x5860('0xa')]);router[_0x5860('0x4')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x5860('0xb'),auth[_0x5860('0x5')](),controller[_0x5860('0xc')]);router[_0x5860('0xd')]('/',auth[_0x5860('0x5')](),controller[_0x5860('0xe')]);router[_0x5860('0xd')]('/:id/messages',auth[_0x5860('0x5')](),controller[_0x5860('0xf')]);router[_0x5860('0xd')](_0x5860('0x10'),auth[_0x5860('0x5')](),interaction[_0x5860('0x11')]('mail',_0x5860('0x12')),controller[_0x5860('0x13')]);router[_0x5860('0x14')]('/:id',auth[_0x5860('0x5')](),interaction[_0x5860('0x11')]('mail',_0x5860('0x15')),controller[_0x5860('0x16')]);router[_0x5860('0x17')](_0x5860('0x9'),auth['isAuthenticated'](),interaction[_0x5860('0x11')]('mail',_0x5860('0x18')),controller[_0x5860('0x19')]);router['delete']('/:id/tags',auth[_0x5860('0x5')](),controller['removeTags']);module[_0x5860('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 3ca2718..5688f2c 100644 --- a/server/api/mailInteraction/mailInteraction.attributes.js +++ b/server/api/mailInteraction/mailInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd876=['exports','BOOLEAN','DATE','STRING','TEXT','long','out','INTEGER'];(function(_0x5b8597,_0x55067d){var _0x2c6474=function(_0x1f1099){while(--_0x1f1099){_0x5b8597['push'](_0x5b8597['shift']());}};_0x2c6474(++_0x55067d);}(_0xd876,0xb8));var _0x6d87=function(_0x3a8d96,_0x10b6a8){_0x3a8d96=_0x3a8d96-0x0;var _0x8332c1=_0xd876[_0x3a8d96];return _0x8332c1;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x6d87('0x0')]={'closed':{'type':Sequelize[_0x6d87('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6d87('0x2')]},'disposition':{'type':Sequelize[_0x6d87('0x3')]},'secondDisposition':{'type':Sequelize[_0x6d87('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6d87('0x3')](0x1fe)},'to':{'type':Sequelize[_0x6d87('0x3')]},'cc':{'type':Sequelize[_0x6d87('0x4')](_0x6d87('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x6d87('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6d87('0x2')]},'substatus':{'type':Sequelize[_0x6d87('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d87('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6d87('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6d87('0x7')]}}; \ No newline at end of file +var _0xb571=['sequelize','iconv','DATE','STRING','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb571,0x19e));var _0x1b57=function(_0x395e47,_0x22d63e){_0x395e47=_0x395e47-0x0;var _0x329d09=_0xb571[_0x395e47];return _0x329d09;};'use strict';var Sequelize=require(_0x1b57('0x0'));var iconv=require(_0x1b57('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1b57('0x2')]},'disposition':{'type':Sequelize[_0x1b57('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1b57('0x3')]},'note':{'type':Sequelize[_0x1b57('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x1b57('0x3')]},'cc':{'type':Sequelize[_0x1b57('0x4')](_0x1b57('0x5'))},'subject':{'type':Sequelize[_0x1b57('0x4')]()},'attach':{'type':Sequelize[_0x1b57('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1b57('0x2')]},'substatus':{'type':Sequelize[_0x1b57('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x1b57('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1b57('0x7')]('in',_0x1b57('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1b57('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1b57('0x7')]('in',_0x1b57('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1b57('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 56fe88a..04937c0 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1aa=['api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','error','stack','name','send','index','map','MailInteraction','rawAttributes','type','key','findAll','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','destroy','describe','MailMessage','addMessage','ids','omit','getMessages','findOne','nolimit','sort','pick','where','MailInteractionId','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','subject','decode','Bcc','basename','existsSync','readFileSync','build','message%d.eml','eml-format','rimraf','zip-dir','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger'];(function(_0x39efa9,_0x28ae45){var _0x3d0802=function(_0x49481d){while(--_0x49481d){_0x39efa9['push'](_0x39efa9['shift']());}};_0x3d0802(++_0x28ae45);}(_0xe1aa,0xdb));var _0xae1a=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe1aa[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xae1a('0x0'));var rimraf=require(_0xae1a('0x1'));var zipdir=require(_0xae1a('0x2'));var moment=require('moment');var BPromise=require(_0xae1a('0x3'));var util=require('util');var path=require(_0xae1a('0x4'));var fs=require('fs');var _=require(_0xae1a('0x5'));var juice=require(_0xae1a('0x6'));var Redis=require(_0xae1a('0x7'));var interaction=require(_0xae1a('0x8'));var qs=require(_0xae1a('0x9'));var logger=require(_0xae1a('0xa'))(_0xae1a('0xb'));var config=require(_0xae1a('0xc'));var db=require(_0xae1a('0xd'))['db'];var htmlEntities=require(_0xae1a('0xe'));config[_0xae1a('0xf')]=_[_0xae1a('0x10')](config[_0xae1a('0xf')],{'host':_0xae1a('0x11'),'port':0x18eb});var socket=require(_0xae1a('0x12'))(new Redis(config[_0xae1a('0xf')]));require(_0xae1a('0x13'))[_0xae1a('0x14')](socket);function respondWithStatusCode(_0x534d41,_0xa3c414){_0xa3c414=_0xa3c414||0xcc;return function(_0x53f1ed){if(_0x53f1ed){return _0x534d41[_0xae1a('0x15')](_0xa3c414);}return _0x534d41[_0xae1a('0x16')](_0xa3c414)[_0xae1a('0x17')]();};}function respondWithResult(_0x4401f4,_0x43165c){_0x43165c=_0x43165c||0xc8;return function(_0x10c953){if(_0x10c953){return _0x4401f4[_0xae1a('0x16')](_0x43165c)['json'](_0x10c953);}};}function respondWithFilteredResult(_0x241cb7,_0x31477f){return function(_0x5bf06b){if(_0x5bf06b){var _0x1051fc=typeof _0x31477f[_0xae1a('0x18')]===_0xae1a('0x19')&&typeof _0x31477f[_0xae1a('0x1a')]===_0xae1a('0x19');var _0x4572f4=_0x5bf06b[_0xae1a('0x1b')];var _0x1e042d=_0x1051fc?0x0:_0x31477f['offset'];var _0xa3e2e5=_0x1051fc?_0x5bf06b[_0xae1a('0x1b')]:_0x31477f[_0xae1a('0x18')]+_0x31477f['limit'];var _0x174c44;if(_0xa3e2e5>=_0x4572f4){_0xa3e2e5=_0x4572f4;_0x174c44=0xc8;}else{_0x174c44=0xce;}_0x241cb7[_0xae1a('0x16')](_0x174c44);return _0x241cb7[_0xae1a('0x1c')]('Content-Range',_0x1e042d+'-'+_0xa3e2e5+'/'+_0x4572f4)[_0xae1a('0x1d')](_0x5bf06b);}return null;};}function saveUpdates(_0x222c16){return function(_0x2d7f78){if(_0x2d7f78){return _0x2d7f78[_0xae1a('0x1e')](_0x222c16)['then'](function(_0x21e9c2){return _0x21e9c2;});}return null;};}function removeEntity(_0x12a70){return function(_0x4d0ad8){if(_0x4d0ad8){return _0x4d0ad8['destroy']()[_0xae1a('0x1f')](function(){_0x12a70[_0xae1a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x314129){return function(_0x51d1eb){if(!_0x51d1eb){_0x314129[_0xae1a('0x15')](0x194);}return _0x51d1eb;};}function handleError(_0xbdc2,_0x4c2dee){_0x4c2dee=_0x4c2dee||0x1f4;return function(_0x4e7429){logger[_0xae1a('0x20')](_0x4e7429[_0xae1a('0x21')]);if(_0x4e7429[_0xae1a('0x22')]){delete _0x4e7429['name'];}_0xbdc2[_0xae1a('0x16')](_0x4c2dee)[_0xae1a('0x23')](_0x4e7429);};}exports[_0xae1a('0x24')]=function(_0x3bdc8e,_0x2c6a0a){var _0x25cd8b={};var _0x28123d=_[_0xae1a('0x25')](db[_0xae1a('0x26')][_0xae1a('0x27')],function(_0x400bca){return{'name':_0x400bca['fieldName'],'type':_0x400bca[_0xae1a('0x28')][_0xae1a('0x29')]};});_0x25cd8b=qs['getOptions'](_0x28123d,_0x3bdc8e);return interaction[_0xae1a('0x2a')](_0xae1a('0x2b'),_0x3bdc8e[_0xae1a('0x2c')],_0x3bdc8e[_0xae1a('0x2d')],_0x25cd8b,_0x28123d)[_0xae1a('0x1f')](respondWithFilteredResult(_0x2c6a0a,_0x25cd8b))[_0xae1a('0x2e')](handleError(_0x2c6a0a,null));};exports[_0xae1a('0x2f')]=function(_0x3d8fad,_0xd58f32){var _0x515bf8={'raw':![],'where':{'id':_0x3d8fad[_0xae1a('0x30')]['id']}},_0x14b230={};_0x14b230[_0xae1a('0x31')]=_['keys'](db[_0xae1a('0x26')][_0xae1a('0x27')]);_0x14b230[_0xae1a('0x2c')]=_[_0xae1a('0x32')](_0x3d8fad[_0xae1a('0x2c')]);_0x14b230[_0xae1a('0x33')]=_[_0xae1a('0x34')](_0x14b230[_0xae1a('0x31')],_0x14b230[_0xae1a('0x2c')]);_0x515bf8[_0xae1a('0x35')]=_[_0xae1a('0x34')](_0x14b230['model'],qs[_0xae1a('0x36')](_0x3d8fad['query'][_0xae1a('0x36')]));_0x515bf8[_0xae1a('0x35')]=_0x515bf8[_0xae1a('0x35')][_0xae1a('0x37')]?_0x515bf8['attributes']:_0x14b230[_0xae1a('0x31')];if(_0x3d8fad[_0xae1a('0x2c')][_0xae1a('0x38')]){_0x515bf8[_0xae1a('0x39')]=[{'all':!![]}];}_0x515bf8=_['merge']({},_0x515bf8,_0x3d8fad[_0xae1a('0x3a')]);return db[_0xae1a('0x26')][_0xae1a('0x3b')](_0x515bf8)['then'](handleEntityNotFound(_0xd58f32,null))[_0xae1a('0x1f')](respondWithResult(_0xd58f32,null))[_0xae1a('0x2e')](handleError(_0xd58f32,null));};exports[_0xae1a('0x3c')]=function(_0x301a34,_0x29db22){return db[_0xae1a('0x26')][_0xae1a('0x3c')](_0x301a34[_0xae1a('0x3d')],{})['then'](respondWithResult(_0x29db22,0xc9))[_0xae1a('0x2e')](handleError(_0x29db22,null));};exports[_0xae1a('0x1e')]=function(_0x1cb602,_0x3c634f){if(_0x1cb602[_0xae1a('0x3d')]['id']){delete _0x1cb602[_0xae1a('0x3d')]['id'];}return db[_0xae1a('0x26')][_0xae1a('0x3b')]({'where':{'id':_0x1cb602[_0xae1a('0x30')]['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0x3c634f,null))['then'](saveUpdates(_0x1cb602['body'],null))[_0xae1a('0x1f')](respondWithResult(_0x3c634f,null))[_0xae1a('0x2e')](handleError(_0x3c634f,null));};exports[_0xae1a('0x3e')]=function(_0x54adbd,_0xa4ad38){return db[_0xae1a('0x26')][_0xae1a('0x3b')]({'where':{'id':_0x54adbd[_0xae1a('0x30')]['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0xa4ad38,null))[_0xae1a('0x1f')](removeEntity(_0xa4ad38,null))[_0xae1a('0x2e')](handleError(_0xa4ad38,null));};exports[_0xae1a('0x3f')]=function(_0x4f2ab8,_0x250139){return db[_0xae1a('0x26')][_0xae1a('0x3f')]()[_0xae1a('0x1f')](respondWithResult(_0x250139,null))[_0xae1a('0x2e')](handleError(_0x250139,null));};exports['addMessage']=function(_0x5aeb4a,_0x46ed24){return db[_0xae1a('0x40')]['find']({'where':{'id':_0x5aeb4a['params']['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0x46ed24,null))['then'](function(_0x5acc44){if(_0x5acc44){return _0x5acc44[_0xae1a('0x41')](_0x5aeb4a[_0xae1a('0x3d')][_0xae1a('0x42')],_[_0xae1a('0x43')](_0x5aeb4a['body'],[_0xae1a('0x42'),'id'])||{});}})[_0xae1a('0x1f')](respondWithResult(_0x46ed24,null))[_0xae1a('0x2e')](handleError(_0x46ed24,null));};exports[_0xae1a('0x44')]=function(_0x1f3595,_0x160884){var _0x2d262f={'raw':![],'where':{}};var _0xabfd3e={};var _0xee8b18={'count':0x0,'rows':[]};return db[_0xae1a('0x26')][_0xae1a('0x45')]({'where':{'id':_0x1f3595['params']['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0x160884,null))[_0xae1a('0x1f')](function(_0x4c7e87){if(_0x4c7e87){_0xabfd3e[_0xae1a('0x31')]=_[_0xae1a('0x32')](db[_0xae1a('0x40')]['rawAttributes']);_0xabfd3e[_0xae1a('0x2c')]=_[_0xae1a('0x32')](_0x1f3595[_0xae1a('0x2c')]);_0xabfd3e[_0xae1a('0x33')]=_[_0xae1a('0x34')](_0xabfd3e[_0xae1a('0x31')],_0xabfd3e['query']);_0x2d262f[_0xae1a('0x35')]=_[_0xae1a('0x34')](_0xabfd3e[_0xae1a('0x31')],qs[_0xae1a('0x36')](_0x1f3595[_0xae1a('0x2c')][_0xae1a('0x36')]));_0x2d262f['attributes']=_0x2d262f[_0xae1a('0x35')][_0xae1a('0x37')]?_0x2d262f[_0xae1a('0x35')]:_0xabfd3e[_0xae1a('0x31')];if(!_0x1f3595['query']['hasOwnProperty'](_0xae1a('0x46'))){_0x2d262f[_0xae1a('0x1a')]=qs[_0xae1a('0x1a')](_0x1f3595['query'][_0xae1a('0x1a')]);_0x2d262f[_0xae1a('0x18')]=qs[_0xae1a('0x18')](_0x1f3595['query']['offset']);}_0x2d262f['order']=qs[_0xae1a('0x47')](_0x1f3595['query']['sort']);_0x2d262f['where']=qs[_0xae1a('0x33')](_[_0xae1a('0x48')](_0x1f3595[_0xae1a('0x2c')],_0xabfd3e[_0xae1a('0x33')]));_0x2d262f[_0xae1a('0x49')][_0xae1a('0x4a')]=_0x4c7e87['id'];if(_0x1f3595[_0xae1a('0x2c')][_0xae1a('0x4b')]){_0x2d262f[_0xae1a('0x49')]=_[_0xae1a('0x4c')](_0x2d262f['where'],{'$or':_[_0xae1a('0x25')](_0x2d262f[_0xae1a('0x35')],function(_0x11ea83){var _0x2a8a49={};_0x2a8a49[_0x11ea83]={'$like':'%'+_0x1f3595[_0xae1a('0x2c')]['filter']+'%'};return _0x2a8a49;})});}if(_0x1f3595[_0xae1a('0x2c')][_0xae1a('0x4d')]){var _0x26624b=_0x1f3595['query'][_0xae1a('0x4d')]['split'](',');var _0x5599b5={};_0x5599b5[_0x26624b[0x0]]={'$gte':moment(_0x26624b[0x1])[_0xae1a('0x4e')](_0xae1a('0x4f'))};_0x2d262f[_0xae1a('0x49')]=_['merge'](_0x2d262f[_0xae1a('0x49')],_0x5599b5);}_0x2d262f=_['merge']({},_0x2d262f,_0x1f3595[_0xae1a('0x3a')]);return db['MailMessage'][_0xae1a('0x1b')]({'where':_0x2d262f[_0xae1a('0x49')]})[_0xae1a('0x1f')](function(_0x4b6dd9){_0xee8b18[_0xae1a('0x1b')]=_0x4b6dd9;if(_0x1f3595['query']['includeAll']){_0x2d262f[_0xae1a('0x39')]=[{'all':!![]}];}return db[_0xae1a('0x40')][_0xae1a('0x2a')](_0x2d262f);})[_0xae1a('0x1f')](function(_0x41841d){if(_0x1f3595['query'][_0xae1a('0x50')]==='true'){for(var _0x4c1a79=0x0;_0x4c1a79<_0x41841d[_0xae1a('0x37')];_0x4c1a79++){_0x41841d[_0x4c1a79][_0xae1a('0x3d')]=juice(_0x41841d[_0x4c1a79][_0xae1a('0x3d')]);}}_0xee8b18['rows']=_0x41841d;return _0xee8b18;});}})[_0xae1a('0x1f')](respondWithFilteredResult(_0x160884,_0x2d262f))['catch'](handleError(_0x160884,null));};exports[_0xae1a('0x51')]=function(_0xf64ca7,_0x4deaac){return db[_0xae1a('0x26')][_0xae1a('0x3b')]({'where':{'id':_0xf64ca7[_0xae1a('0x30')]['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0x4deaac,null))[_0xae1a('0x1f')](function(_0x535bd4){if(_0x535bd4){return _0x535bd4['setTags'](_0xf64ca7[_0xae1a('0x3d')]['ids'],_[_0xae1a('0x43')](_0xf64ca7[_0xae1a('0x3d')],['ids','id'])||{})[_0xae1a('0x52')](function(){return db[_0xae1a('0x53')][_0xae1a('0x2a')]({'attributes':['id',_0xae1a('0x22'),_0xae1a('0x54')],'where':{'id':_0xf64ca7[_0xae1a('0x3d')][_0xae1a('0x42')]}});})[_0xae1a('0x1f')](function(_0x54c219){socket[_0xae1a('0x55')](_0xae1a('0x56'),{'id':Number(_0xf64ca7[_0xae1a('0x30')]['id']),'tags':_0x54c219||[]});return{'id':Number(_0xf64ca7[_0xae1a('0x30')]['id']),'tags':_0x54c219||[]};});}})[_0xae1a('0x1f')](respondWithResult(_0x4deaac,null))[_0xae1a('0x2e')](handleError(_0x4deaac,null));};exports[_0xae1a('0x57')]=function(_0x31bb38,_0x9dddd){return db[_0xae1a('0x26')][_0xae1a('0x3b')]({'where':{'id':_0x31bb38['params']['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0x9dddd,null))[_0xae1a('0x1f')](function(_0x407e92){if(_0x407e92){return _0x407e92[_0xae1a('0x57')](_0x31bb38[_0xae1a('0x2c')][_0xae1a('0x42')]);}})[_0xae1a('0x1f')](respondWithStatusCode(_0x9dddd,null))[_0xae1a('0x2e')](handleError(_0x9dddd,null));};exports[_0xae1a('0x58')]=function(_0x1c0c18,_0x52b8fe){var _0x16d777=moment()['unix']()['toString']();var _0x41c75d=path['join'](config['root'],_0xae1a('0x59'),_0xae1a('0x5a'),_0xae1a('0x5b'));var _0x45e633=path[_0xae1a('0x5c')](config[_0xae1a('0x5d')],_0xae1a('0x59'),_0xae1a('0x5a'),_0xae1a('0x5e'));var _0x5312f5=path[_0xae1a('0x5c')](_0x41c75d,_0x16d777);var _0x4a337f=util[_0xae1a('0x4e')](_0xae1a('0x5f'),_0x1c0c18[_0xae1a('0x30')]['id'],_0x16d777);var _0x4c375f=path[_0xae1a('0x5c')](_0x41c75d,_0x4a337f);var _0x3b6c50=[];if(_0x1c0c18[_0xae1a('0x2c')]['attachments']){_0x3b6c50[_0xae1a('0x60')]({'model':db[_0xae1a('0x61')],'as':_0xae1a('0x62'),'raw':!![]});}var _0xd79c6f=[{'model':db[_0xae1a('0x40')],'as':_0xae1a('0x63'),'attributes':['id',_0xae1a('0x3d'),_0xae1a('0x64'),'to','cc',_0xae1a('0x65'),'subject',_0xae1a('0x66')],'where':{'secret':![]},'order':qs[_0xae1a('0x47')]('id'),'include':_0x3b6c50}];return db[_0xae1a('0x26')][_0xae1a('0x3b')]({'where':{'id':_0x1c0c18[_0xae1a('0x30')]['id']},'include':_0xd79c6f})[_0xae1a('0x1f')](handleEntityNotFound(_0x52b8fe,null))[_0xae1a('0x1f')](function(_0x4b266b){if(_0x4b266b&&_0x4b266b[_0xae1a('0x63')]){var _0x2e1b0d=_0x4b266b[_0xae1a('0x67')]({'plain':!![]});fs[_0xae1a('0x68')](_0x5312f5);return BPromise[_0xae1a('0x69')](_0x2e1b0d[_0xae1a('0x63')],function(_0x115d52,_0x3b70fd){var _0x5e12f0={'from':_0x115d52['from'],'to':_0x115d52['to']||_0xae1a('0x6a'),'subject':_0x115d52[_0xae1a('0x6b')],'html':htmlEntities[_0xae1a('0x6c')](_0x115d52[_0xae1a('0x3d')]),'headers':{'Date':moment(_0x115d52['createdAt'])[_0xae1a('0x4e')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x115d52['cc']){_0x5e12f0['headers']['Cc']=_0x115d52['cc'];}if(_0x115d52['bcc']){_0x5e12f0['headers'][_0xae1a('0x6d')]=_0x115d52[_0xae1a('0x65')];}return new BPromise(function(_0x58853f,_0x361d62){if(_0x115d52[_0xae1a('0x62')]){for(var _0x51b24d=0x0;_0x51b24d<_0x115d52[_0xae1a('0x62')][_0xae1a('0x37')];_0x51b24d++){var _0x5ad585=_0x115d52[_0xae1a('0x62')][_0x51b24d];var _0x5c14e9=path[_0xae1a('0x5c')](_0x45e633,_0x5ad585[_0xae1a('0x6e')]);if(fs[_0xae1a('0x6f')](_0x5c14e9)){_0x5e12f0['attachments'][_0xae1a('0x60')]({'name':_0x5ad585[_0xae1a('0x22')],'contentType':_0x5ad585['type'],'data':fs[_0xae1a('0x70')](_0x5c14e9)});}}}emlformat[_0xae1a('0x71')](_0x5e12f0,function(_0x2fe050,_0x4ccc5e){if(_0x2fe050)return _0x361d62(_0x2fe050);fs['writeFileSync'](path[_0xae1a('0x5c')](_0x5312f5,util[_0xae1a('0x4e')](_0xae1a('0x72'),_0x3b70fd)),_0x4ccc5e);return _0x58853f(_0x4ccc5e);});});})['then'](function(){return new BPromise(function(_0x364301,_0x2de564){zipdir(_0x5312f5,{'saveTo':_0x4c375f},function(_0x3596d9,_0x4ea13f){if(_0x3596d9)return _0x2de564(_0x3596d9);return _0x364301(_0x4ea13f);});})[_0xae1a('0x1f')](function(){return new BPromise(function(_0xe237ea,_0x35ea8e){rimraf(_0x5312f5,function(_0x59d308){if(_0x59d308)_0x35ea8e(_0x59d308);return _0xe237ea();});});})[_0xae1a('0x1f')](function(){return _0x52b8fe[_0xae1a('0x58')](_0x4c375f,_0x4a337f,function(_0x29b49c){if(!_0x29b49c)fs['unlinkSync'](_0x4c375f);});});});}else{return _0x52b8fe[_0xae1a('0x15')](0xc8);}})[_0xae1a('0x2e')](handleError(_0x52b8fe,null));}; \ No newline at end of file +var _0x8002=['model','keys','query','filters','intersection','fields','attributes','length','merge','options','MailInteraction','catch','create','body','find','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','split','includeAll','inlineCss','true','rows','addTags','setTags','spread','Tag','emit','removeTags','join','root','server','tmp','attachments','push','Attachment','Attachments','Messages','from','subject','createdAt','get','each','missing.recipient@your.company.com','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','download','sendStatus','rimraf','zip-dir','moment','bluebird','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','end','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','findAll','mail','user','show','params'];(function(_0x10995f,_0x12a3f0){var _0x40b1b3=function(_0x5ed4d0){while(--_0x5ed4d0){_0x10995f['push'](_0x10995f['shift']());}};_0x40b1b3(++_0x12a3f0);}(_0x8002,0x191));var _0x2800=function(_0x4b241f,_0x5c2fdc){_0x4b241f=_0x4b241f-0x0;var _0x47fc08=_0x8002[_0x4b241f];return _0x47fc08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2800('0x0'));var zipdir=require(_0x2800('0x1'));var moment=require(_0x2800('0x2'));var BPromise=require(_0x2800('0x3'));var util=require('util');var path=require(_0x2800('0x4'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0x2800('0x5'));var interaction=require(_0x2800('0x6'));var qs=require(_0x2800('0x7'));var logger=require(_0x2800('0x8'))(_0x2800('0x9'));var config=require(_0x2800('0xa'));var db=require(_0x2800('0xb'))['db'];var htmlEntities=require(_0x2800('0xc'));config[_0x2800('0xd')]=_[_0x2800('0xe')](config[_0x2800('0xd')],{'host':_0x2800('0xf'),'port':0x18eb});var socket=require(_0x2800('0x10'))(new Redis(config[_0x2800('0xd')]));require('./mailInteraction.socket')[_0x2800('0x11')](socket);function respondWithStatusCode(_0x552532,_0x17d0db){_0x17d0db=_0x17d0db||0xcc;return function(_0x580b30){if(_0x580b30){return _0x552532['sendStatus'](_0x17d0db);}return _0x552532['status'](_0x17d0db)[_0x2800('0x12')]();};}function respondWithResult(_0x160792,_0x28cd83){_0x28cd83=_0x28cd83||0xc8;return function(_0x50770b){if(_0x50770b){return _0x160792[_0x2800('0x13')](_0x28cd83)['json'](_0x50770b);}};}function respondWithFilteredResult(_0x418617,_0x5a1fe0){return function(_0x3364ee){if(_0x3364ee){var _0x1aeae8=typeof _0x5a1fe0['offset']===_0x2800('0x14')&&typeof _0x5a1fe0[_0x2800('0x15')]===_0x2800('0x14');var _0x2e6a25=_0x3364ee[_0x2800('0x16')];var _0x434a09=_0x1aeae8?0x0:_0x5a1fe0[_0x2800('0x17')];var _0x5b691b=_0x1aeae8?_0x3364ee[_0x2800('0x16')]:_0x5a1fe0[_0x2800('0x17')]+_0x5a1fe0[_0x2800('0x15')];var _0x3fa783;if(_0x5b691b>=_0x2e6a25){_0x5b691b=_0x2e6a25;_0x3fa783=0xc8;}else{_0x3fa783=0xce;}_0x418617['status'](_0x3fa783);return _0x418617[_0x2800('0x18')](_0x2800('0x19'),_0x434a09+'-'+_0x5b691b+'/'+_0x2e6a25)[_0x2800('0x1a')](_0x3364ee);}return null;};}function saveUpdates(_0x36514c){return function(_0x37e09a){if(_0x37e09a){return _0x37e09a[_0x2800('0x1b')](_0x36514c)[_0x2800('0x1c')](function(_0x4d1876){return _0x4d1876;});}return null;};}function removeEntity(_0x16c14c){return function(_0x72e045){if(_0x72e045){return _0x72e045[_0x2800('0x1d')]()[_0x2800('0x1c')](function(){_0x16c14c[_0x2800('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f614d){return function(_0x2a4028){if(!_0x2a4028){_0x2f614d['sendStatus'](0x194);}return _0x2a4028;};}function handleError(_0x6337a2,_0x3860eb){_0x3860eb=_0x3860eb||0x1f4;return function(_0x405860){logger[_0x2800('0x1e')](_0x405860['stack']);if(_0x405860[_0x2800('0x1f')]){delete _0x405860[_0x2800('0x1f')];}_0x6337a2[_0x2800('0x13')](_0x3860eb)[_0x2800('0x20')](_0x405860);};}exports[_0x2800('0x21')]=function(_0x5ec8d8,_0x3858ca){var _0x1d0a53={};var _0x47f757=_[_0x2800('0x22')](db['MailInteraction'][_0x2800('0x23')],function(_0x22141a){return{'name':_0x22141a['fieldName'],'type':_0x22141a[_0x2800('0x24')][_0x2800('0x25')]};});_0x1d0a53=qs['getOptions'](_0x47f757,_0x5ec8d8);return interaction[_0x2800('0x26')](_0x2800('0x27'),_0x5ec8d8['query'],_0x5ec8d8[_0x2800('0x28')],_0x1d0a53,_0x47f757)[_0x2800('0x1c')](respondWithFilteredResult(_0x3858ca,_0x1d0a53))['catch'](handleError(_0x3858ca,null));};exports[_0x2800('0x29')]=function(_0x32fb46,_0x2bffd9){var _0x55f2d8={'raw':![],'where':{'id':_0x32fb46[_0x2800('0x2a')]['id']}},_0x489804={};_0x489804[_0x2800('0x2b')]=_[_0x2800('0x2c')](db['MailInteraction'][_0x2800('0x23')]);_0x489804[_0x2800('0x2d')]=_[_0x2800('0x2c')](_0x32fb46['query']);_0x489804[_0x2800('0x2e')]=_[_0x2800('0x2f')](_0x489804['model'],_0x489804[_0x2800('0x2d')]);_0x55f2d8['attributes']=_[_0x2800('0x2f')](_0x489804[_0x2800('0x2b')],qs[_0x2800('0x30')](_0x32fb46['query'][_0x2800('0x30')]));_0x55f2d8[_0x2800('0x31')]=_0x55f2d8[_0x2800('0x31')][_0x2800('0x32')]?_0x55f2d8[_0x2800('0x31')]:_0x489804['model'];if(_0x32fb46['query']['includeAll']){_0x55f2d8['include']=[{'all':!![]}];}_0x55f2d8=_[_0x2800('0x33')]({},_0x55f2d8,_0x32fb46[_0x2800('0x34')]);return db[_0x2800('0x35')]['find'](_0x55f2d8)[_0x2800('0x1c')](handleEntityNotFound(_0x2bffd9,null))['then'](respondWithResult(_0x2bffd9,null))[_0x2800('0x36')](handleError(_0x2bffd9,null));};exports[_0x2800('0x37')]=function(_0xc8858f,_0x340e6f){return db[_0x2800('0x35')]['create'](_0xc8858f[_0x2800('0x38')],{})[_0x2800('0x1c')](respondWithResult(_0x340e6f,0xc9))[_0x2800('0x36')](handleError(_0x340e6f,null));};exports[_0x2800('0x1b')]=function(_0x5a7a54,_0x5d11e8){if(_0x5a7a54['body']['id']){delete _0x5a7a54['body']['id'];}return db[_0x2800('0x35')][_0x2800('0x39')]({'where':{'id':_0x5a7a54[_0x2800('0x2a')]['id']}})[_0x2800('0x1c')](handleEntityNotFound(_0x5d11e8,null))[_0x2800('0x1c')](saveUpdates(_0x5a7a54[_0x2800('0x38')],null))['then'](respondWithResult(_0x5d11e8,null))[_0x2800('0x36')](handleError(_0x5d11e8,null));};exports['destroy']=function(_0x513b3a,_0x10e046){return db[_0x2800('0x35')][_0x2800('0x39')]({'where':{'id':_0x513b3a['params']['id']}})[_0x2800('0x1c')](handleEntityNotFound(_0x10e046,null))[_0x2800('0x1c')](removeEntity(_0x10e046,null))[_0x2800('0x36')](handleError(_0x10e046,null));};exports['describe']=function(_0x5bb9ce,_0x108401){return db['MailInteraction'][_0x2800('0x3a')]()['then'](respondWithResult(_0x108401,null))[_0x2800('0x36')](handleError(_0x108401,null));};exports[_0x2800('0x3b')]=function(_0x39f512,_0x14719b){return db[_0x2800('0x3c')][_0x2800('0x39')]({'where':{'id':_0x39f512[_0x2800('0x2a')]['id']}})['then'](handleEntityNotFound(_0x14719b,null))[_0x2800('0x1c')](function(_0x41a47c){if(_0x41a47c){return _0x41a47c[_0x2800('0x3b')](_0x39f512[_0x2800('0x38')][_0x2800('0x3d')],_[_0x2800('0x3e')](_0x39f512[_0x2800('0x38')],['ids','id'])||{});}})[_0x2800('0x1c')](respondWithResult(_0x14719b,null))[_0x2800('0x36')](handleError(_0x14719b,null));};exports[_0x2800('0x3f')]=function(_0x53fd04,_0xf7b25e){var _0x5897ba={'raw':![],'where':{}};var _0x4c060e={};var _0x573fd6={'count':0x0,'rows':[]};return db['MailInteraction'][_0x2800('0x40')]({'where':{'id':_0x53fd04['params']['id']}})['then'](handleEntityNotFound(_0xf7b25e,null))[_0x2800('0x1c')](function(_0x590fb8){if(_0x590fb8){_0x4c060e[_0x2800('0x2b')]=_['keys'](db[_0x2800('0x3c')]['rawAttributes']);_0x4c060e['query']=_[_0x2800('0x2c')](_0x53fd04[_0x2800('0x2d')]);_0x4c060e[_0x2800('0x2e')]=_[_0x2800('0x2f')](_0x4c060e['model'],_0x4c060e[_0x2800('0x2d')]);_0x5897ba['attributes']=_[_0x2800('0x2f')](_0x4c060e[_0x2800('0x2b')],qs['fields'](_0x53fd04[_0x2800('0x2d')][_0x2800('0x30')]));_0x5897ba[_0x2800('0x31')]=_0x5897ba[_0x2800('0x31')][_0x2800('0x32')]?_0x5897ba[_0x2800('0x31')]:_0x4c060e[_0x2800('0x2b')];if(!_0x53fd04[_0x2800('0x2d')][_0x2800('0x41')](_0x2800('0x42'))){_0x5897ba[_0x2800('0x15')]=qs[_0x2800('0x15')](_0x53fd04[_0x2800('0x2d')]['limit']);_0x5897ba[_0x2800('0x17')]=qs[_0x2800('0x17')](_0x53fd04[_0x2800('0x2d')]['offset']);}_0x5897ba['order']=qs[_0x2800('0x43')](_0x53fd04[_0x2800('0x2d')]['sort']);_0x5897ba[_0x2800('0x44')]=qs[_0x2800('0x2e')](_[_0x2800('0x45')](_0x53fd04[_0x2800('0x2d')],_0x4c060e[_0x2800('0x2e')]));_0x5897ba[_0x2800('0x44')][_0x2800('0x46')]=_0x590fb8['id'];if(_0x53fd04['query'][_0x2800('0x47')]){_0x5897ba[_0x2800('0x44')]=_[_0x2800('0x33')](_0x5897ba[_0x2800('0x44')],{'$or':_[_0x2800('0x22')](_0x5897ba[_0x2800('0x31')],function(_0x2d92bd){var _0x50836a={};_0x50836a[_0x2d92bd]={'$like':'%'+_0x53fd04[_0x2800('0x2d')][_0x2800('0x47')]+'%'};return _0x50836a;})});}if(_0x53fd04['query']['$gte']){var _0x15a26d=_0x53fd04[_0x2800('0x2d')][_0x2800('0x48')][_0x2800('0x49')](',');var _0x5de15d={};_0x5de15d[_0x15a26d[0x0]]={'$gte':moment(_0x15a26d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5897ba[_0x2800('0x44')]=_['merge'](_0x5897ba['where'],_0x5de15d);}_0x5897ba=_['merge']({},_0x5897ba,_0x53fd04[_0x2800('0x34')]);return db[_0x2800('0x3c')][_0x2800('0x16')]({'where':_0x5897ba[_0x2800('0x44')]})[_0x2800('0x1c')](function(_0x2c6261){_0x573fd6[_0x2800('0x16')]=_0x2c6261;if(_0x53fd04['query'][_0x2800('0x4a')]){_0x5897ba['include']=[{'all':!![]}];}return db[_0x2800('0x3c')][_0x2800('0x26')](_0x5897ba);})['then'](function(_0xbd619e){if(_0x53fd04[_0x2800('0x2d')][_0x2800('0x4b')]===_0x2800('0x4c')){for(var _0x320363=0x0;_0x320363<_0xbd619e['length'];_0x320363++){_0xbd619e[_0x320363][_0x2800('0x38')]=juice(_0xbd619e[_0x320363][_0x2800('0x38')]);}}_0x573fd6[_0x2800('0x4d')]=_0xbd619e;return _0x573fd6;});}})['then'](respondWithFilteredResult(_0xf7b25e,_0x5897ba))[_0x2800('0x36')](handleError(_0xf7b25e,null));};exports[_0x2800('0x4e')]=function(_0x480b64,_0x14ff7d){return db[_0x2800('0x35')][_0x2800('0x39')]({'where':{'id':_0x480b64[_0x2800('0x2a')]['id']}})['then'](handleEntityNotFound(_0x14ff7d,null))['then'](function(_0x20618b){if(_0x20618b){return _0x20618b[_0x2800('0x4f')](_0x480b64['body']['ids'],_[_0x2800('0x3e')](_0x480b64[_0x2800('0x38')],[_0x2800('0x3d'),'id'])||{})[_0x2800('0x50')](function(){return db[_0x2800('0x51')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x480b64[_0x2800('0x38')][_0x2800('0x3d')]}});})[_0x2800('0x1c')](function(_0x2ec835){socket[_0x2800('0x52')]('mailInteractionTags:save',{'id':Number(_0x480b64[_0x2800('0x2a')]['id']),'tags':_0x2ec835||[]});return{'id':Number(_0x480b64[_0x2800('0x2a')]['id']),'tags':_0x2ec835||[]};});}})[_0x2800('0x1c')](respondWithResult(_0x14ff7d,null))[_0x2800('0x36')](handleError(_0x14ff7d,null));};exports[_0x2800('0x53')]=function(_0x444711,_0x1162c7){return db[_0x2800('0x35')][_0x2800('0x39')]({'where':{'id':_0x444711[_0x2800('0x2a')]['id']}})[_0x2800('0x1c')](handleEntityNotFound(_0x1162c7,null))[_0x2800('0x1c')](function(_0x15925c){if(_0x15925c){return _0x15925c[_0x2800('0x53')](_0x444711['query'][_0x2800('0x3d')]);}})[_0x2800('0x1c')](respondWithStatusCode(_0x1162c7,null))[_0x2800('0x36')](handleError(_0x1162c7,null));};exports['download']=function(_0x29eb83,_0x4edba2){var _0x3f2f0a=moment()['unix']()['toString']();var _0x530027=path[_0x2800('0x54')](config[_0x2800('0x55')],_0x2800('0x56'),'files',_0x2800('0x57'));var _0x3d1711=path[_0x2800('0x54')](config['root'],_0x2800('0x56'),'files',_0x2800('0x58'));var _0x26739a=path[_0x2800('0x54')](_0x530027,_0x3f2f0a);var _0x591594=util['format']('transcript-%d-%s.zip',_0x29eb83[_0x2800('0x2a')]['id'],_0x3f2f0a);var _0x123507=path[_0x2800('0x54')](_0x530027,_0x591594);var _0x1ef03b=[];if(_0x29eb83[_0x2800('0x2d')][_0x2800('0x58')]){_0x1ef03b[_0x2800('0x59')]({'model':db[_0x2800('0x5a')],'as':_0x2800('0x5b'),'raw':!![]});}var _0x6ad567=[{'model':db['MailMessage'],'as':_0x2800('0x5c'),'attributes':['id','body',_0x2800('0x5d'),'to','cc','bcc',_0x2800('0x5e'),_0x2800('0x5f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x1ef03b}];return db[_0x2800('0x35')]['find']({'where':{'id':_0x29eb83[_0x2800('0x2a')]['id']},'include':_0x6ad567})[_0x2800('0x1c')](handleEntityNotFound(_0x4edba2,null))[_0x2800('0x1c')](function(_0x27a733){if(_0x27a733&&_0x27a733[_0x2800('0x5c')]){var _0x3c25ba=_0x27a733[_0x2800('0x60')]({'plain':!![]});fs['mkdirSync'](_0x26739a);return BPromise[_0x2800('0x61')](_0x3c25ba['Messages'],function(_0x29a576,_0x2000ca){var _0x12a4df={'from':_0x29a576[_0x2800('0x5d')],'to':_0x29a576['to']||_0x2800('0x62'),'subject':_0x29a576['subject'],'html':htmlEntities['decode'](_0x29a576[_0x2800('0x38')]),'headers':{'Date':moment(_0x29a576[_0x2800('0x5f')])[_0x2800('0x63')](_0x2800('0x64'))},'attachments':[]};if(_0x29a576['cc']){_0x12a4df['headers']['Cc']=_0x29a576['cc'];}if(_0x29a576[_0x2800('0x65')]){_0x12a4df[_0x2800('0x66')][_0x2800('0x67')]=_0x29a576[_0x2800('0x65')];}return new BPromise(function(_0x568995,_0x18cd30){if(_0x29a576['Attachments']){for(var _0x483ee2=0x0;_0x483ee2<_0x29a576['Attachments'][_0x2800('0x32')];_0x483ee2++){var _0xe2afda=_0x29a576[_0x2800('0x5b')][_0x483ee2];var _0x3a6b58=path[_0x2800('0x54')](_0x3d1711,_0xe2afda[_0x2800('0x68')]);if(fs['existsSync'](_0x3a6b58)){_0x12a4df[_0x2800('0x58')][_0x2800('0x59')]({'name':_0xe2afda['name'],'contentType':_0xe2afda['type'],'data':fs[_0x2800('0x69')](_0x3a6b58)});}}}emlformat[_0x2800('0x6a')](_0x12a4df,function(_0x408f8f,_0x32fb3a){if(_0x408f8f)return _0x18cd30(_0x408f8f);fs[_0x2800('0x6b')](path[_0x2800('0x54')](_0x26739a,util['format'](_0x2800('0x6c'),_0x2000ca)),_0x32fb3a);return _0x568995(_0x32fb3a);});});})[_0x2800('0x1c')](function(){return new BPromise(function(_0x5a694f,_0x5c642c){zipdir(_0x26739a,{'saveTo':_0x123507},function(_0x57f732,_0x32c44e){if(_0x57f732)return _0x5c642c(_0x57f732);return _0x5a694f(_0x32c44e);});})[_0x2800('0x1c')](function(){return new BPromise(function(_0x111d62,_0x4a9b96){rimraf(_0x26739a,function(_0x4403ee){if(_0x4403ee)_0x4a9b96(_0x4403ee);return _0x111d62();});});})[_0x2800('0x1c')](function(){return _0x4edba2[_0x2800('0x6d')](_0x123507,_0x591594,function(_0x311c73){if(!_0x311c73)fs['unlinkSync'](_0x123507);});});});}else{return _0x4edba2[_0x2800('0x6e')](0xc8);}})['catch'](handleError(_0x4edba2,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b917186..794061c 100644 --- a/server/api/mailInteraction/mailInteraction.events.js +++ b/server/api/mailInteraction/mailInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67c2=['MailInteraction','MailMessage','save','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','hook','exports','events'];(function(_0x514989,_0x40e433){var _0x4aed35=function(_0x1ce39b){while(--_0x1ce39b){_0x514989['push'](_0x514989['shift']());}};_0x4aed35(++_0x40e433);}(_0x67c2,0xc3));var _0x267c=function(_0x565973,_0x45e3ca){_0x565973=_0x565973-0x0;var _0x577dd2=_0x67c2[_0x565973];return _0x577dd2;};'use strict';var EventEmitter=require(_0x267c('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x267c('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x267c('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x267c('0x3'),'afterUpdate':'update','afterDestroy':_0x267c('0x4')};function emitEvent(_0x66fea3){return function(_0x385da6,_0x9f7f3f,_0xb0bbf1){_0x385da6['getUsers']({'attributes':['id'],'raw':!![]})[_0x267c('0x5')](function(_0x4a4d23){_0x385da6[_0x267c('0x6')]('Users',_0x4a4d23[_0x267c('0x7')](function(_0x180ff8){return{'id':_0x180ff8['id']};}));return MailMessage[_0x267c('0x8')]({'where':{'MailInteractionId':_0x385da6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x267c('0x5')](function(_0x32bf72){_0x385da6['setDataValue'](_0x267c('0x9'),_0x32bf72[_0x267c('0xa')]);MailInteractionEvents[_0x267c('0xb')](_0x66fea3+':'+_0x385da6['id'],_0x385da6);MailInteractionEvents['emit'](_0x66fea3,_0x385da6);_0xb0bbf1(null);})['catch'](_0xb0bbf1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x267c('0xc')](e,emitEvent(event));}}module[_0x267c('0xd')]=MailInteractionEvents; \ No newline at end of file +var _0x4a7c=['MailMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','exports','events','../../mysqldb','MailInteraction'];(function(_0x19e829,_0x2f55b4){var _0x188db=function(_0xbeb6c9){while(--_0xbeb6c9){_0x19e829['push'](_0x19e829['shift']());}};_0x188db(++_0x2f55b4);}(_0x4a7c,0x15d));var _0xc4a7=function(_0xb77c9c,_0x49d278){_0xb77c9c=_0xb77c9c-0x0;var _0x186557=_0x4a7c[_0xb77c9c];return _0x186557;};'use strict';var EventEmitter=require(_0xc4a7('0x0'));var MailInteraction=require(_0xc4a7('0x1'))['db'][_0xc4a7('0x2')];var MailMessage=require(_0xc4a7('0x1'))['db'][_0xc4a7('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc4a7('0x4')](0x0);var events={'afterCreate':_0xc4a7('0x5'),'afterUpdate':_0xc4a7('0x6'),'afterDestroy':'remove'};function emitEvent(_0x5edc95){return function(_0x474496,_0x3775e3,_0x40d26b){_0x474496[_0xc4a7('0x7')]({'attributes':['id'],'raw':!![]})[_0xc4a7('0x8')](function(_0x191ecc){_0x474496[_0xc4a7('0x9')](_0xc4a7('0xa'),_0x191ecc['map'](function(_0x526139){return{'id':_0x526139['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x474496['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc4a7('0x8')](function(_0x2973dc){_0x474496[_0xc4a7('0x9')](_0xc4a7('0xb'),_0x2973dc[_0xc4a7('0xc')]);MailInteractionEvents[_0xc4a7('0xd')](_0x5edc95+':'+_0x474496['id'],_0x474496);MailInteractionEvents[_0xc4a7('0xd')](_0x5edc95,_0x474496);_0x40d26b(null);})[_0xc4a7('0xe')](_0x40d26b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xc4a7('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 2ee7cde..ded0dde 100644 --- a/server/api/mailInteraction/mailInteraction.model.js +++ b/server/api/mailInteraction/mailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3637=['moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','FULLTEXT','substatus','substatusAt','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','closed','models','get','update','then','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3637,0x1d9));var _0x7363=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0x3637[_0xea343d];return _0x2c6e9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7363('0x0'))(_0x7363('0x1'));var moment=require(_0x7363('0x2'));var BPromise=require(_0x7363('0x3'));var rp=require(_0x7363('0x4'));var fs=require('fs');var path=require(_0x7363('0x5'));var rimraf=require(_0x7363('0x6'));var config=require('../../config/environment');var attributes=require(_0x7363('0x7'));module[_0x7363('0x8')]=function(_0x11324f,_0xd73c63){return _0x11324f[_0x7363('0x9')](_0x7363('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x7363('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x39c711,_0x5db3af,_0x3f432a){if(_0x39c711[_0x7363('0xc')]){_0x39c711[_0x7363('0xd')]=moment()[_0x7363('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x39c711['closed']){_0x39c711[_0x7363('0xf')]=moment()[_0x7363('0xe')](_0x7363('0x10'));}_0x3f432a(null,_0x5db3af);},'beforeUpdate':function(_0x185bb1,_0x386adc,_0xdd1475){if(_0x185bb1['changed'](_0x7363('0xc'))){_0x185bb1['substatusAt']=_0x185bb1[_0x7363('0xc')]?moment()[_0x7363('0xe')](_0x7363('0x10')):null;}if(_0x185bb1[_0x7363('0x11')](_0x7363('0x12'))){_0x185bb1[_0x7363('0xf')]=moment()[_0x7363('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x185bb1[_0x7363('0xc')]=null;_0x185bb1['substatusAt']=null;}_0xdd1475(null,_0x185bb1);},'afterUpdate':function(_0x453d3d,_0x2f86e4,_0x268f65){var _0xf4bac4=_0x11324f[_0x7363('0x13')];var _0x5bd852=_0x453d3d[_0x7363('0x14')]({'plain':!![]});if(_0x5bd852[_0x7363('0x12')]){return _0xf4bac4['MailMessage'][_0x7363('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5bd852['id']}})[_0x7363('0x16')](function(){_0x268f65();})['catch'](function(_0x2486f2){_0x268f65(_0x2486f2);});}else{_0x268f65();}}},'charset':_0x7363('0x17'),'collate':_0x7363('0x18')});}; \ No newline at end of file +var _0xd74f=['subject','FULLTEXT','substatus','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','closed','substatusAt','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xd74f,0xf8));var _0xfd74=function(_0xae324d,_0xce7397){_0xae324d=_0xae324d-0x0;var _0x102407=_0xd74f[_0xae324d];return _0x102407;};'use strict';var _=require(_0xfd74('0x0'));var util=require(_0xfd74('0x1'));var logger=require(_0xfd74('0x2'))(_0xfd74('0x3'));var moment=require(_0xfd74('0x4'));var BPromise=require(_0xfd74('0x5'));var rp=require(_0xfd74('0x6'));var fs=require('fs');var path=require(_0xfd74('0x7'));var rimraf=require(_0xfd74('0x8'));var config=require(_0xfd74('0x9'));var attributes=require(_0xfd74('0xa'));module[_0xfd74('0xb')]=function(_0x57267a,_0x2e22a8){return _0x57267a[_0xfd74('0xc')](_0xfd74('0xd'),attributes,{'tableName':_0xfd74('0xe'),'paranoid':![],'indexes':[{'name':_0xfd74('0xf'),'fields':[_0xfd74('0x10'),'to'],'type':_0xfd74('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x41031c,_0x433219,_0x540b40){if(_0x41031c[_0xfd74('0x12')]){_0x41031c['substatusAt']=moment()[_0xfd74('0x13')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x41031c['closed']){_0x41031c[_0xfd74('0x14')]=moment()[_0xfd74('0x13')](_0xfd74('0x15'));}_0x540b40(null,_0x433219);},'beforeUpdate':function(_0x305b00,_0x5a7567,_0x247119){if(_0x305b00[_0xfd74('0x16')](_0xfd74('0x12'))){_0x305b00['substatusAt']=_0x305b00[_0xfd74('0x12')]?moment()[_0xfd74('0x13')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x305b00[_0xfd74('0x16')](_0xfd74('0x17'))){_0x305b00[_0xfd74('0x14')]=moment()['format'](_0xfd74('0x15'));_0x305b00['substatus']=null;_0x305b00[_0xfd74('0x18')]=null;}_0x247119(null,_0x305b00);},'afterUpdate':function(_0x8bd527,_0x739362,_0x3eee33){var _0x51cabb=_0x57267a[_0xfd74('0x19')];var _0x540020=_0x8bd527[_0xfd74('0x1a')]({'plain':!![]});if(_0x540020[_0xfd74('0x17')]){return _0x51cabb[_0xfd74('0x1b')][_0xfd74('0x1c')]({'read':!![]},{'where':{'MailInteractionId':_0x540020['id']}})[_0xfd74('0x1d')](function(){_0x3eee33();})[_0xfd74('0x1e')](function(_0x5b6092){_0x3eee33(_0x5b6092);});}else{_0x3eee33();}}},'charset':_0xfd74('0x1f'),'collate':_0xfd74('0x20')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index e3ffd6d..1f031c2 100644 --- a/server/api/mailInteraction/mailInteraction.rpc.js +++ b/server/api/mailInteraction/mailInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7455=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','body','options','where','attributes','find','addTags','ids','omit','spread','AddTags'];(function(_0x79c292,_0x4d0c1a){var _0x3bca86=function(_0x17901a){while(--_0x17901a){_0x79c292['push'](_0x79c292['shift']());}};_0x3bca86(++_0x4d0c1a);}(_0x7455,0x197));var _0x5745=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7455[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x5745('0x0'));var moment=require(_0x5745('0x1'));var BPromise=require(_0x5745('0x2'));var rs=require(_0x5745('0x3'));var fs=require('fs');var Redis=require(_0x5745('0x4'));var db=require(_0x5745('0x5'))['db'];var utils=require(_0x5745('0x6'));var logger=require(_0x5745('0x7'))('rpc');var config=require(_0x5745('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5745('0x9')][_0x5745('0xa')]({'port':0x232a});config[_0x5745('0xb')]=_['defaults'](config[_0x5745('0xb')],{'host':_0x5745('0xc'),'port':0x18eb});var socket=require(_0x5745('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x5745('0xe')](socket);function respondWithRpcPromise(_0x2ce3dc,_0x2283e3,_0x4bb433){return new BPromise(function(_0x16dd13,_0x45d5be){return client[_0x5745('0xf')](_0x2ce3dc,_0x4bb433)[_0x5745('0x10')](function(_0x54376e){logger['info'](_0x5745('0x11'),_0x2283e3,_0x5745('0x12'));logger[_0x5745('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2283e3,_0x5745('0x12'),JSON[_0x5745('0x14')](_0x54376e));if(_0x54376e[_0x5745('0x15')]){if(_0x54376e[_0x5745('0x15')][_0x5745('0x16')]===0x1f4){logger[_0x5745('0x15')](_0x5745('0x11'),_0x2283e3,_0x54376e['error']['message']);return _0x45d5be(_0x54376e[_0x5745('0x15')][_0x5745('0x17')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x2283e3,_0x54376e['error'][_0x5745('0x17')]);return _0x16dd13(_0x54376e[_0x5745('0x15')][_0x5745('0x17')]);}else{logger['info'](_0x5745('0x11'),_0x2283e3,_0x5745('0x12'));_0x16dd13(_0x54376e['result']['message']);}})[_0x5745('0x18')](function(_0x498f39){logger[_0x5745('0x15')](_0x5745('0x11'),_0x2283e3,_0x498f39);_0x45d5be(_0x498f39);});});}exports[_0x5745('0x19')]=function(_0x161d9d){var _0x7277d5=this;return new Promise(function(_0x5e58ec,_0x3ed94c){return db[_0x5745('0x1a')]['update'](_0x161d9d[_0x5745('0x1b')],{'raw':_0x161d9d['options']?_0x161d9d[_0x5745('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x161d9d['options']?_0x161d9d[_0x5745('0x1c')][_0x5745('0x1d')]||null:null,'attributes':_0x161d9d['options']?_0x161d9d['options'][_0x5745('0x1e')]||null:null,'limit':_0x161d9d[_0x5745('0x1c')]?_0x161d9d[_0x5745('0x1c')]['limit']||null:null})[_0x5745('0x10')](function(_0x3becbe){logger['info'](_0x5745('0x19'),_0x161d9d);logger['debug'](_0x5745('0x19'),_0x161d9d,JSON[_0x5745('0x14')](_0x3becbe));_0x5e58ec(_0x3becbe);})[_0x5745('0x18')](function(_0x5c5ea6){logger[_0x5745('0x15')](_0x5745('0x19'),_0x5c5ea6['message'],_0x161d9d);_0x3ed94c(_0x7277d5['error'](0x1f4,_0x5c5ea6['message']));});});};exports['AddTagsToMailInteraction']=function(_0x2ec9d1){return new Promise(function(_0x1e86fa,_0xa01c5f){return db[_0x5745('0x1a')][_0x5745('0x1f')]({'where':_0x2ec9d1['options']?_0x2ec9d1[_0x5745('0x1c')][_0x5745('0x1d')]||null:null})['then'](function(_0x4437c4){if(_0x4437c4){return _0x4437c4[_0x5745('0x20')](_0x2ec9d1[_0x5745('0x1b')][_0x5745('0x21')],_[_0x5745('0x22')](_0x2ec9d1[_0x5745('0x1b')],[_0x5745('0x21'),'id'])||{});}})[_0x5745('0x23')](function(_0x585209){logger['info'](_0x5745('0x24'),_0x2ec9d1);logger[_0x5745('0x13')](_0x5745('0x24'),_0x2ec9d1,JSON[_0x5745('0x14')](_0x585209));_0x1e86fa(_0x585209);})[_0x5745('0x18')](function(_0x34b632){logger[_0x5745('0x15')](_0x5745('0x24'),_0x34b632[_0x5745('0x17')],_0x2ec9d1);_0xa01c5f(_this[_0x5745('0x15')](0x1f4,_0x34b632[_0x5745('0x17')]));});});}; \ No newline at end of file +var _0x66da=['defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','then','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x5d8631,_0x44944b){var _0x34c15e=function(_0x4448f8){while(--_0x4448f8){_0x5d8631['push'](_0x5d8631['shift']());}};_0x34c15e(++_0x44944b);}(_0x66da,0x16f));var _0xa66d=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x66da[_0x35e92e];return _0x1205a8;};'use strict';var _=require(_0xa66d('0x0'));var util=require(_0xa66d('0x1'));var moment=require(_0xa66d('0x2'));var BPromise=require(_0xa66d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa66d('0x4'));var logger=require(_0xa66d('0x5'))(_0xa66d('0x6'));var config=require(_0xa66d('0x7'));var jayson=require(_0xa66d('0x8'));var client=jayson['client'][_0xa66d('0x9')]({'port':0x232a});config[_0xa66d('0xa')]=_[_0xa66d('0xb')](config[_0xa66d('0xa')],{'host':_0xa66d('0xc'),'port':0x18eb});var socket=require(_0xa66d('0xd'))(new Redis(config[_0xa66d('0xa')]));require(_0xa66d('0xe'))[_0xa66d('0xf')](socket);function respondWithRpcPromise(_0x9becae,_0x22b38f,_0x1e65b0){return new BPromise(function(_0x4c0dde,_0x92016b){return client[_0xa66d('0x10')](_0x9becae,_0x1e65b0)['then'](function(_0x4906cd){logger['info'](_0xa66d('0x11'),_0x22b38f,'request\x20sent');logger[_0xa66d('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x22b38f,_0xa66d('0x13'),JSON[_0xa66d('0x14')](_0x4906cd));if(_0x4906cd['error']){if(_0x4906cd[_0xa66d('0x15')][_0xa66d('0x16')]===0x1f4){logger['error'](_0xa66d('0x11'),_0x22b38f,_0x4906cd['error'][_0xa66d('0x17')]);return _0x92016b(_0x4906cd['error'][_0xa66d('0x17')]);}logger[_0xa66d('0x15')]('MailInteraction,\x20%s,\x20%s',_0x22b38f,_0x4906cd[_0xa66d('0x15')][_0xa66d('0x17')]);return _0x4c0dde(_0x4906cd[_0xa66d('0x15')][_0xa66d('0x17')]);}else{logger[_0xa66d('0x18')]('MailInteraction,\x20%s,\x20%s',_0x22b38f,_0xa66d('0x13'));_0x4c0dde(_0x4906cd['result'][_0xa66d('0x17')]);}})[_0xa66d('0x19')](function(_0x55db3b){logger[_0xa66d('0x15')](_0xa66d('0x11'),_0x22b38f,_0x55db3b);_0x92016b(_0x55db3b);});});}exports[_0xa66d('0x1a')]=function(_0x3d0219){var _0x5082de=this;return new Promise(function(_0xee7546,_0x232fe3){return db[_0xa66d('0x1b')][_0xa66d('0x1c')](_0x3d0219[_0xa66d('0x1d')],{'raw':_0x3d0219[_0xa66d('0x1e')]?_0x3d0219['options'][_0xa66d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d0219['options']?_0x3d0219[_0xa66d('0x1e')][_0xa66d('0x20')]||null:null,'attributes':_0x3d0219[_0xa66d('0x1e')]?_0x3d0219[_0xa66d('0x1e')][_0xa66d('0x21')]||null:null,'limit':_0x3d0219[_0xa66d('0x1e')]?_0x3d0219['options'][_0xa66d('0x22')]||null:null})['then'](function(_0x8e3fe4){logger[_0xa66d('0x18')](_0xa66d('0x1a'),_0x3d0219);logger[_0xa66d('0x12')](_0xa66d('0x1a'),_0x3d0219,JSON['stringify'](_0x8e3fe4));_0xee7546(_0x8e3fe4);})['catch'](function(_0x1d51ca){logger[_0xa66d('0x15')]('UpdateMailInteraction',_0x1d51ca[_0xa66d('0x17')],_0x3d0219);_0x232fe3(_0x5082de['error'](0x1f4,_0x1d51ca[_0xa66d('0x17')]));});});};exports[_0xa66d('0x23')]=function(_0x86e964){return new Promise(function(_0x3ff4a2,_0x2d87f1){return db['MailInteraction'][_0xa66d('0x24')]({'where':_0x86e964[_0xa66d('0x1e')]?_0x86e964[_0xa66d('0x1e')][_0xa66d('0x20')]||null:null})[_0xa66d('0x25')](function(_0x178e4a){if(_0x178e4a){return _0x178e4a[_0xa66d('0x26')](_0x86e964[_0xa66d('0x1d')]['ids'],_[_0xa66d('0x27')](_0x86e964[_0xa66d('0x1d')],[_0xa66d('0x28'),'id'])||{});}})['spread'](function(_0xd98e1d){logger['info'](_0xa66d('0x29'),_0x86e964);logger['debug'](_0xa66d('0x29'),_0x86e964,JSON[_0xa66d('0x14')](_0xd98e1d));_0x3ff4a2(_0xd98e1d);})[_0xa66d('0x19')](function(_0x17674c){logger[_0xa66d('0x15')](_0xa66d('0x29'),_0x17674c[_0xa66d('0x17')],_0x86e964);_0x2d87f1(_this[_0xa66d('0x15')](0x1f4,_0x17674c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c5724fc..fc66c43 100644 --- a/server/api/mailInteraction/mailInteraction.socket.js +++ b/server/api/mailInteraction/mailInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06fc=['mailInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x58841a,_0x1edb87){var _0x46c020=function(_0x497c4c){while(--_0x497c4c){_0x58841a['push'](_0x58841a['shift']());}};_0x46c020(++_0x1edb87);}(_0x06fc,0x86));var _0xc06f=function(_0x1626aa,_0xe38ee2){_0x1626aa=_0x1626aa-0x0;var _0x8b4fe7=_0x06fc[_0x1626aa];return _0x8b4fe7;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xc06f('0x0'),_0xc06f('0x1'),_0xc06f('0x2')];function createListener(_0x106a13,_0x5cf9c0){return function(_0x11ce8a){_0x5cf9c0[_0xc06f('0x3')](_0x106a13,_0x11ce8a);};}function removeListener(_0x3cd53a,_0x1c12b7){return function(){MailInteractionEvents[_0xc06f('0x4')](_0x3cd53a,_0x1c12b7);};}exports[_0xc06f('0x5')]=function(_0xb3e8d3){for(var _0x3b170f=0x0,_0x15fe71=events['length'];_0x3b170f<_0x15fe71;_0x3b170f++){var _0x441935=events[_0x3b170f];var _0x157e26=createListener(_0xc06f('0x6')+_0x441935,_0xb3e8d3);MailInteractionEvents['on'](_0x441935,_0x157e26);}}; \ No newline at end of file +var _0xebc6=['mailInteraction:','save','remove','update','emit','removeListener','register','length'];(function(_0xddad7e,_0x280ac1){var _0x166637=function(_0x49b229){while(--_0x49b229){_0xddad7e['push'](_0xddad7e['shift']());}};_0x166637(++_0x280ac1);}(_0xebc6,0xf1));var _0x6ebc=function(_0x3ddb2,_0x386ec3){_0x3ddb2=_0x3ddb2-0x0;var _0x41cc1f=_0xebc6[_0x3ddb2];return _0x41cc1f;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x6ebc('0x0'),_0x6ebc('0x1'),_0x6ebc('0x2')];function createListener(_0x4bd67f,_0x301bd1){return function(_0x1f28a8){_0x301bd1[_0x6ebc('0x3')](_0x4bd67f,_0x1f28a8);};}function removeListener(_0x1b31d7,_0x3bb836){return function(){MailInteractionEvents[_0x6ebc('0x4')](_0x1b31d7,_0x3bb836);};}exports[_0x6ebc('0x5')]=function(_0x1ecb34){for(var _0x1fcec0=0x0,_0x30e6b6=events[_0x6ebc('0x6')];_0x1fcec0<_0x30e6b6;_0x1fcec0++){var _0x3a040d=events[_0x1fcec0];var _0x4ffa87=createListener(_0x6ebc('0x7')+_0x3a040d,_0x1ecb34);MailInteractionEvents['on'](_0x3a040d,_0x4ffa87);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index eaa086d..b5f0796 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8dd6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','mail','update','put','/:id/accept','accept','/:id/reject','reject','delete','multer','path','connect-timeout'];(function(_0x553c28,_0x3c868d){var _0x571e4e=function(_0x2cd0a6){while(--_0x2cd0a6){_0x553c28['push'](_0x553c28['shift']());}};_0x571e4e(++_0x3c868d);}(_0x8dd6,0xcd));var _0x68dd=function(_0x6b823f,_0x414adb){_0x6b823f=_0x6b823f-0x0;var _0x24eff1=_0x8dd6[_0x6b823f];return _0x24eff1;};'use strict';var multer=require(_0x68dd('0x0'));var util=require('util');var path=require(_0x68dd('0x1'));var timeout=require(_0x68dd('0x2'));var express=require(_0x68dd('0x3'));var router=express[_0x68dd('0x4')]();var fs_extra=require(_0x68dd('0x5'));var auth=require(_0x68dd('0x6'));var interaction=require(_0x68dd('0x7'));var config=require(_0x68dd('0x8'));var controller=require('./mailMessage.controller');router[_0x68dd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68dd('0x9')](_0x68dd('0xa'),auth[_0x68dd('0xb')](),controller[_0x68dd('0xc')]);router[_0x68dd('0x9')](_0x68dd('0xd'),auth[_0x68dd('0xb')](),controller[_0x68dd('0xe')]);router[_0x68dd('0x9')](_0x68dd('0xf'),auth['isAuthenticated'](),controller[_0x68dd('0x10')]);router[_0x68dd('0x11')]('/',auth[_0x68dd('0xb')](),interaction['tracked'](_0x68dd('0x12'),'mailmessage:create'),controller['create']);router['put'](_0x68dd('0xd'),auth[_0x68dd('0xb')](),controller[_0x68dd('0x13')]);router[_0x68dd('0x14')](_0x68dd('0x15'),auth['isAuthenticated'](),controller[_0x68dd('0x16')]);router[_0x68dd('0x14')](_0x68dd('0x17'),auth[_0x68dd('0xb')](),controller[_0x68dd('0x18')]);router[_0x68dd('0x19')](_0x68dd('0xd'),auth[_0x68dd('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa4db=['/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','/:id/reject','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0xa4db,0x139));var _0xba4d=function(_0x37c17b,_0x24e818){_0x37c17b=_0x37c17b-0x0;var _0x3102ec=_0xa4db[_0x37c17b];return _0x3102ec;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xba4d('0x0'));var express=require(_0xba4d('0x1'));var router=express[_0xba4d('0x2')]();var fs_extra=require(_0xba4d('0x3'));var auth=require(_0xba4d('0x4'));var interaction=require(_0xba4d('0x5'));var config=require('../../config/environment');var controller=require(_0xba4d('0x6'));router['get']('/',auth[_0xba4d('0x7')](),controller[_0xba4d('0x8')]);router[_0xba4d('0x9')](_0xba4d('0xa'),auth[_0xba4d('0x7')](),controller[_0xba4d('0xb')]);router[_0xba4d('0x9')](_0xba4d('0xc'),auth[_0xba4d('0x7')](),controller['show']);router[_0xba4d('0x9')](_0xba4d('0xd'),auth[_0xba4d('0x7')](),controller[_0xba4d('0xe')]);router[_0xba4d('0xf')]('/',auth[_0xba4d('0x7')](),interaction[_0xba4d('0x10')](_0xba4d('0x11'),_0xba4d('0x12')),controller[_0xba4d('0x13')]);router[_0xba4d('0x14')](_0xba4d('0xc'),auth['isAuthenticated'](),controller['update']);router['put'](_0xba4d('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0xba4d('0x14')](_0xba4d('0x16'),auth[_0xba4d('0x7')](),controller['reject']);router['delete']('/:id',auth[_0xba4d('0x7')](),controller[_0xba4d('0x17')]);module[_0xba4d('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index b3139a9..0a7ded0 100644 --- a/server/api/mailMessage/mailMessage.attributes.js +++ b/server/api/mailMessage/mailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff9d=['INTEGER','Email','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4138f5,_0x51b97b){var _0x57125b=function(_0x34ce8c){while(--_0x34ce8c){_0x4138f5['push'](_0x4138f5['shift']());}};_0x57125b(++_0x51b97b);}(_0xff9d,0x16a));var _0xdff9=function(_0x2142ea,_0x5a8f39){_0x2142ea=_0x2142ea-0x0;var _0x53e2a9=_0xff9d[_0x2142ea];return _0x53e2a9;};'use strict';var Sequelize=require('sequelize');var _=require(_0xdff9('0x0'));module[_0xdff9('0x1')]={'body':{'type':Sequelize[_0xdff9('0x2')](_0xdff9('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xdff9('0x2')](_0xdff9('0x4'))},'read':{'type':Sequelize[_0xdff9('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdff9('0x6')]('in',_0xdff9('0x7')),'defaultValue':_0xdff9('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdff9('0x8')](0x1fe)},'from':{'type':Sequelize[_0xdff9('0x8')]},'to':{'type':Sequelize[_0xdff9('0x2')](_0xdff9('0x3'))},'cc':{'type':Sequelize[_0xdff9('0x2')](_0xdff9('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xdff9('0x2')]},'sentAt':{'type':Sequelize[_0xdff9('0x9')]},'attach':{'type':Sequelize[_0xdff9('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xdff9('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0xdff9('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0xdff9('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0xdff9('0xb'),'Chat'),'defaultValue':_0xdff9('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xdde5=['medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Chat','Email','sequelize','lodash','exports','long','TEXT'];(function(_0x1138c4,_0x841d33){var _0x200cc1=function(_0x2f6d85){while(--_0x2f6d85){_0x1138c4['push'](_0x1138c4['shift']());}};_0x200cc1(++_0x841d33);}(_0xdde5,0x87));var _0x5dde=function(_0x1ae78f,_0x122ed2){_0x1ae78f=_0x1ae78f-0x0;var _0x5baf80=_0xdde5[_0x1ae78f];return _0x5baf80;};'use strict';var Sequelize=require(_0x5dde('0x0'));var _=require(_0x5dde('0x1'));module[_0x5dde('0x2')]={'body':{'type':Sequelize['TEXT'](_0x5dde('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5dde('0x4')](_0x5dde('0x5'))},'read':{'type':Sequelize[_0x5dde('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5dde('0x7')]('in',_0x5dde('0x8')),'defaultValue':_0x5dde('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5dde('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x5dde('0x4')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x5dde('0x3'))},'subject':{'type':Sequelize[_0x5dde('0x4')]},'sentAt':{'type':Sequelize[_0x5dde('0xa')]},'attach':{'type':Sequelize[_0x5dde('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5dde('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5dde('0xa')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize['TEXT'](_0x5dde('0x3'))},'originChannel':{'type':Sequelize[_0x5dde('0x7')]('Email',_0x5dde('0xc')),'defaultValue':_0x5dde('0xd'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 543a3d0..7f98bad 100644 --- a/server/api/mailMessage/mailMessage.controller.js +++ b/server/api/mailMessage/mailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48ff=['count','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','body','find','describe','direction','secret','split','MailAccount','MailAccountId','List','CmContact','updatedAt','DESC','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','create','ListId','List\x20not\x20found','SendMail','sendMail','update','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','reject','role','null','RejectMessage','rejectMessage','ContactId','contact','rejectmessage','unix','toString','files','tmp','server','message-%s.eml','from','bcc','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','download','eml-format','moment','bluebird','lodash','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','limit'];(function(_0x40b378,_0x5b048c){var _0x636965=function(_0x2232cc){while(--_0x2232cc){_0x40b378['push'](_0x40b378['shift']());}};_0x636965(++_0x5b048c);}(_0x48ff,0x1bb));var _0xf48f=function(_0x23ef2a,_0x19bcd2){_0x23ef2a=_0x23ef2a-0x0;var _0x3eda6f=_0x48ff[_0x23ef2a];return _0x3eda6f;};'use strict';var emlformat=require(_0xf48f('0x0'));var moment=require(_0xf48f('0x1'));var BPromise=require(_0xf48f('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xf48f('0x3'));var Redis=require('ioredis');var htmlToText=require(_0xf48f('0x4'));var qs=require(_0xf48f('0x5'));var logger=require('../../config/logger')(_0xf48f('0x6'));var interaction_log=require(_0xf48f('0x7'))('mail-interactions');var config=require(_0xf48f('0x8'));var db=require(_0xf48f('0x9'))['db'];config[_0xf48f('0xa')]=_[_0xf48f('0xb')](config[_0xf48f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf48f('0xc'))(new Redis(config[_0xf48f('0xa')]));var htmlEntities=require(_0xf48f('0xd'));require(_0xf48f('0xe'))[_0xf48f('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf48f('0x10')][_0xf48f('0x11')]({'port':0x232c});var client9003=jayson[_0xf48f('0x10')][_0xf48f('0x11')]({'port':0x232b});var client9002=jayson['client'][_0xf48f('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x190f5a,_0x163613,_0x292b7e,_0x371b7f){return new BPromise(function(_0x4f5dfd,_0x286997){var _0x155a2d=_0x371b7f||client;return _0x155a2d[_0xf48f('0x12')](_0x190f5a,_0x292b7e)[_0xf48f('0x13')](function(_0x161232){logger[_0xf48f('0x14')]('MailMessage,\x20%s,\x20%s',_0x163613,_0xf48f('0x15'));logger[_0xf48f('0x16')](_0xf48f('0x17'),_0x163613,_0xf48f('0x15'),JSON[_0xf48f('0x18')](_0x161232));if(_0x161232[_0xf48f('0x19')]){if(_0x161232['error']['code']===0x1f4){logger[_0xf48f('0x19')](_0xf48f('0x1a'),_0x163613,_0x161232['error'][_0xf48f('0x1b')]);return _0x286997(_0x161232[_0xf48f('0x19')]['message']);}logger[_0xf48f('0x19')](_0xf48f('0x1a'),_0x163613,_0x161232[_0xf48f('0x19')][_0xf48f('0x1b')]);return _0x4f5dfd(_0x161232['error'][_0xf48f('0x1b')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x163613,'request\x20sent');_0x4f5dfd(_0x161232['result'][_0xf48f('0x1b')]);}})[_0xf48f('0x1c')](function(_0x2e17ea){logger[_0xf48f('0x19')](_0xf48f('0x1a'),_0x163613,_0x2e17ea);_0x286997(_0x2e17ea);});});}function respondWithResult(_0x3932cb,_0x38f7e2){_0x38f7e2=_0x38f7e2||0xc8;return function(_0x4b4e24){if(_0x4b4e24){return _0x3932cb[_0xf48f('0x1d')](_0x38f7e2)[_0xf48f('0x1e')](_0x4b4e24);}};}function respondWithFilteredResult(_0x3f95bb,_0xd58437){return function(_0x357329){if(_0x357329){var _0x1084e8=typeof _0xd58437[_0xf48f('0x1f')]===_0xf48f('0x20')&&typeof _0xd58437[_0xf48f('0x21')]===_0xf48f('0x20');var _0x28ab7f=_0x357329['count'];var _0x12d870=_0x1084e8?0x0:_0xd58437['offset'];var _0xd6dcd2=_0x1084e8?_0x357329[_0xf48f('0x22')]:_0xd58437[_0xf48f('0x1f')]+_0xd58437[_0xf48f('0x21')];var _0xbfc413;if(_0xd6dcd2>=_0x28ab7f){_0xd6dcd2=_0x28ab7f;_0xbfc413=0xc8;}else{_0xbfc413=0xce;}_0x3f95bb[_0xf48f('0x1d')](_0xbfc413);return _0x3f95bb[_0xf48f('0x23')](_0xf48f('0x24'),_0x12d870+'-'+_0xd6dcd2+'/'+_0x28ab7f)[_0xf48f('0x1e')](_0x357329);}return null;};}function saveUpdates(_0x40828c){return function(_0x381df4){if(_0x381df4){return _0x381df4['update'](_0x40828c)[_0xf48f('0x13')](function(_0x5049f1){return _0x5049f1;});}return null;};}function removeEntity(_0x41a35e){return function(_0x52ff8c){if(_0x52ff8c){return _0x52ff8c[_0xf48f('0x25')]()[_0xf48f('0x13')](function(){_0x41a35e[_0xf48f('0x1d')](0xcc)[_0xf48f('0x26')]();});}};}function handleEntityNotFound(_0x507ab7){return function(_0x412f66){if(!_0x412f66){_0x507ab7[_0xf48f('0x27')](0x194);}return _0x412f66;};}function handleError(_0x14cca7,_0x41988e){_0x41988e=_0x41988e||0x1f4;return function(_0x51a521){logger[_0xf48f('0x19')](_0x51a521[_0xf48f('0x28')]);if(_0x51a521[_0xf48f('0x29')]){delete _0x51a521[_0xf48f('0x29')];}_0x14cca7[_0xf48f('0x1d')](_0x41988e)[_0xf48f('0x2a')](_0x51a521);};}exports[_0xf48f('0x2b')]=function(_0x1c8f5e,_0x305d6f){var _0x3ab5da={},_0x40bbb2={},_0x5c490a={'count':0x0,'rows':[]};var _0x31cab5=_[_0xf48f('0x2c')](db[_0xf48f('0x2d')]['rawAttributes'],function(_0x3fd7c9){return{'name':_0x3fd7c9[_0xf48f('0x2e')],'type':_0x3fd7c9[_0xf48f('0x2f')][_0xf48f('0x30')]};});_0x40bbb2[_0xf48f('0x31')]=_[_0xf48f('0x2c')](_0x31cab5,_0xf48f('0x29'));_0x40bbb2[_0xf48f('0x32')]=_[_0xf48f('0x33')](_0x1c8f5e['query']);_0x40bbb2[_0xf48f('0x34')]=_['intersection'](_0x40bbb2[_0xf48f('0x31')],_0x40bbb2[_0xf48f('0x32')]);_0x3ab5da['attributes']=_[_0xf48f('0x35')](_0x40bbb2[_0xf48f('0x31')],qs[_0xf48f('0x36')](_0x1c8f5e[_0xf48f('0x32')]['fields']));_0x3ab5da[_0xf48f('0x37')]=_0x3ab5da['attributes'][_0xf48f('0x38')]?_0x3ab5da['attributes']:_0x40bbb2['model'];if(!_0x1c8f5e[_0xf48f('0x32')]['hasOwnProperty'](_0xf48f('0x39'))){_0x3ab5da['limit']=qs['limit'](_0x1c8f5e[_0xf48f('0x32')][_0xf48f('0x21')]);_0x3ab5da[_0xf48f('0x1f')]=qs[_0xf48f('0x1f')](_0x1c8f5e['query'][_0xf48f('0x1f')]);}_0x3ab5da['order']=qs[_0xf48f('0x3a')](_0x1c8f5e['query']['sort']);_0x3ab5da[_0xf48f('0x3b')]=qs[_0xf48f('0x34')](_['pick'](_0x1c8f5e['query'],_0x40bbb2[_0xf48f('0x34')]),_0x31cab5);if(_0x1c8f5e['query'][_0xf48f('0x3c')]){_0x3ab5da[_0xf48f('0x3b')]=_[_0xf48f('0x3d')](_0x3ab5da[_0xf48f('0x3b')],{'$or':_[_0xf48f('0x2c')](_0x31cab5,function(_0x59c850){if(_0x59c850[_0xf48f('0x2f')]!==_0xf48f('0x3e')){var _0x40325d={};_0x40325d[_0x59c850['name']]={'$like':'%'+_0x1c8f5e[_0xf48f('0x32')][_0xf48f('0x3c')]+'%'};return _0x40325d;}})});}_0x3ab5da=_[_0xf48f('0x3d')]({},_0x3ab5da,_0x1c8f5e[_0xf48f('0x3f')]);var _0x687d88={'where':_0x3ab5da['where']};return db[_0xf48f('0x2d')][_0xf48f('0x22')](_0x687d88)[_0xf48f('0x13')](function(_0x4e91a0){_0x5c490a[_0xf48f('0x22')]=_0x4e91a0;if(_0x1c8f5e[_0xf48f('0x32')][_0xf48f('0x40')]){_0x3ab5da['include']=[{'all':!![]}];}return db[_0xf48f('0x2d')][_0xf48f('0x41')](_0x3ab5da);})[_0xf48f('0x13')](function(_0x5e6003){_0x5c490a[_0xf48f('0x42')]=_0x5e6003;return _0x5c490a;})[_0xf48f('0x13')](respondWithFilteredResult(_0x305d6f,_0x3ab5da))[_0xf48f('0x1c')](handleError(_0x305d6f,null));};exports[_0xf48f('0x43')]=function(_0x840fd1,_0x9b4db9){var _0x2b2016={'raw':!![],'where':{'id':_0x840fd1[_0xf48f('0x44')]['id']}},_0x4cbad1={};_0x4cbad1[_0xf48f('0x31')]=_[_0xf48f('0x33')](db[_0xf48f('0x2d')][_0xf48f('0x45')]);_0x4cbad1[_0xf48f('0x32')]=_[_0xf48f('0x33')](_0x840fd1[_0xf48f('0x32')]);_0x4cbad1[_0xf48f('0x34')]=_[_0xf48f('0x35')](_0x4cbad1[_0xf48f('0x31')],_0x4cbad1[_0xf48f('0x32')]);_0x2b2016[_0xf48f('0x37')]=_['intersection'](_0x4cbad1[_0xf48f('0x31')],qs[_0xf48f('0x36')](_0x840fd1['query']['fields']));_0x2b2016['attributes']=_0x2b2016['attributes']['length']?_0x2b2016[_0xf48f('0x37')]:_0x4cbad1[_0xf48f('0x31')];if(_0x840fd1['query'][_0xf48f('0x40')]){_0x2b2016['include']=[{'all':!![]}];}_0x2b2016=_['merge']({},_0x2b2016,_0x840fd1[_0xf48f('0x3f')]);return db[_0xf48f('0x2d')]['find'](_0x2b2016)[_0xf48f('0x13')](handleEntityNotFound(_0x9b4db9,null))[_0xf48f('0x13')](respondWithResult(_0x9b4db9,null))[_0xf48f('0x1c')](handleError(_0x9b4db9,null));};exports['update']=function(_0x2531e3,_0x37acef){if(_0x2531e3[_0xf48f('0x46')]['id']){delete _0x2531e3['body']['id'];}return db[_0xf48f('0x2d')][_0xf48f('0x47')]({'where':{'id':_0x2531e3[_0xf48f('0x44')]['id']}})[_0xf48f('0x13')](handleEntityNotFound(_0x37acef,null))[_0xf48f('0x13')](saveUpdates(_0x2531e3[_0xf48f('0x46')],null))[_0xf48f('0x13')](respondWithResult(_0x37acef,null))[_0xf48f('0x1c')](handleError(_0x37acef,null));};exports[_0xf48f('0x25')]=function(_0x27591f,_0x22ceef){return db[_0xf48f('0x2d')][_0xf48f('0x47')]({'where':{'id':_0x27591f[_0xf48f('0x44')]['id']}})[_0xf48f('0x13')](handleEntityNotFound(_0x22ceef,null))[_0xf48f('0x13')](removeEntity(_0x22ceef,null))[_0xf48f('0x1c')](handleError(_0x22ceef,null));};exports['describe']=function(_0x119474,_0x24c8c4){return db[_0xf48f('0x2d')][_0xf48f('0x48')]()[_0xf48f('0x13')](respondWithResult(_0x24c8c4,null))[_0xf48f('0x1c')](handleError(_0x24c8c4,null));};exports['create']=function(_0x2a1ed3,_0x2b34f5){return db[_0xf48f('0x2d')]['create'](_0x2a1ed3[_0xf48f('0x46')])['then'](function(_0xde6431){if(_0xde6431){if(_0xde6431[_0xf48f('0x49')]==='out'&&!_0xde6431[_0xf48f('0x4a')]){var _0x5851fa,_0x1e727f,_0x1b4c46;if(_0x2a1ed3[_0xf48f('0x46')]['to']){_0x1e727f=_0x2a1ed3['body']['to'][_0xf48f('0x4b')](',')[0x0];}return db[_0xf48f('0x4c')]['findOne']({'where':{'id':_0xde6431[_0xf48f('0x4d')]},'include':[{'model':db['CmList'],'as':_0xf48f('0x4e'),'include':[{'model':db[_0xf48f('0x4f')],'as':'Contacts','where':{'email':_0x1e727f},'limit':0x1,'order':[[_0xf48f('0x50'),_0xf48f('0x51')]]}]},{'model':db['MailServerOut'],'as':_0xf48f('0x52'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x26cea1){_0x5851fa=_0x26cea1;if(!_0x5851fa||!_0x5851fa[_0xf48f('0x52')])return;var _0x176985=_0x5851fa[_0xf48f('0x53')]();if(_0x2a1ed3[_0xf48f('0x46')][_0xf48f('0x54')]&&_0x2a1ed3['body']['attachments'][_0xf48f('0x38')]){for(var _0x1ef5a9=0x0;_0x1ef5a9<_0x2a1ed3['body'][_0xf48f('0x54')][_0xf48f('0x38')];_0x1ef5a9+=0x1){_0x2a1ed3['body']['attachments'][_0x1ef5a9]={'filename':_0x2a1ed3[_0xf48f('0x46')][_0xf48f('0x54')][_0x1ef5a9][_0xf48f('0x29')],'path':path[_0xf48f('0x55')](config[_0xf48f('0x56')],_0xf48f('0x57'),_0x2a1ed3[_0xf48f('0x46')][_0xf48f('0x54')][_0x1ef5a9][_0xf48f('0x58')])};}}_0x1b4c46={'account':_0x176985,'message':_0x2a1ed3[_0xf48f('0x46')]};return;})[_0xf48f('0x13')](function(){if(_0x5851fa[_0xf48f('0x4e')]){if(_0x5851fa[_0xf48f('0x4e')][_0xf48f('0x59')][_0xf48f('0x38')]){return _0x5851fa[_0xf48f('0x4e')][_0xf48f('0x59')][0x0];}else{return db['CmContact'][_0xf48f('0x5a')](_['defaults'](_0x2a1ed3['body'],{'firstName':_0x2a1ed3[_0xf48f('0x46')]['to'],'email':_0x2a1ed3[_0xf48f('0x46')]['to'],'phone':_0x2a1ed3[_0xf48f('0x46')]['to'],'ListId':_0x5851fa[_0xf48f('0x5b')]}));}}else{throw new Error(_0xf48f('0x5c'));}})[_0xf48f('0x13')](function(){if(_0x1b4c46){return respondWithRpcPromise(_0xf48f('0x5d'),_0xf48f('0x5e'),_0x1b4c46,client9003)[_0xf48f('0x13')](function(_0x26b560){return _0xde6431[_0xf48f('0x5f')]({'read':!![],'messageId':_0x26b560[_0xf48f('0x60')],'sentAt':moment()[_0xf48f('0x61')](_0xf48f('0x62'))});})[_0xf48f('0x1c')](function(_0xf429eb){logger[_0xf48f('0x19')]('%s',JSON[_0xf48f('0x18')](_0xf429eb));return _0xde6431;});}return _0xde6431;});}return _0xde6431;}})[_0xf48f('0x13')](respondWithResult(_0x2b34f5,0xc9))[_0xf48f('0x1c')](handleError(_0x2b34f5,null));};exports[_0xf48f('0x63')]=function(_0x11306b,_0x5a79bc){var _0x2b5577={'agent':{},'channel':_0xf48f('0x64')};if(_0x11306b['body']['id']){delete _0x11306b[_0xf48f('0x46')]['id'];}_0x11306b[_0xf48f('0x46')][_0xf48f('0x65')]=!![];_0x11306b[_0xf48f('0x46')][_0xf48f('0x66')]=moment()[_0xf48f('0x61')](_0xf48f('0x62'));_0x11306b['body']['UserId']=_0x11306b['body'][_0xf48f('0x67')]||_0x11306b[_0xf48f('0x68')]['id'];_0x2b5577[_0xf48f('0x69')]['id']=_0x11306b[_0xf48f('0x46')][_0xf48f('0x67')];return db[_0xf48f('0x2d')][_0xf48f('0x47')]({'where':{'id':_0x11306b[_0xf48f('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a79bc,null))['then'](saveUpdates(_0x11306b[_0xf48f('0x46')],null))[_0xf48f('0x13')](function(_0x2f6cf9){if(_0x2f6cf9){_0x2b5577['message']=_0x2f6cf9[_0xf48f('0x6a')]({'plain':!![]});return db[_0xf48f('0x6b')]['find']({'where':{'id':_0x2f6cf9[_0xf48f('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x5a79bc,null))[_0xf48f('0x13')](function(_0x2f5cb5){if(_0x2f5cb5){return _0x2f5cb5[_0xf48f('0x5f')]({'UserId':_0x11306b['body']['UserId'],'read1stAt':_[_0xf48f('0x6d')](_0x2f5cb5[_0xf48f('0x6e')])?moment()[_0xf48f('0x61')](_0xf48f('0x62')):undefined});}return null;})['then'](function(_0x596f9b){if(_0x596f9b){_0x2b5577[_0xf48f('0x6f')]=_0x596f9b[_0xf48f('0x6a')]({'plain':!![]});interaction_log['info'](_0xf48f('0x70'),_0x11306b[_0xf48f('0x68')]['id'],_0x11306b[_0xf48f('0x68')]['name'],_0x11306b[_0xf48f('0x68')]['role'],_0x2b5577[_0xf48f('0x6f')]['id'],_0x11306b['body']?JSON[_0xf48f('0x18')](_0x11306b['body']):'null');return respondWithRpcPromise(_0xf48f('0x71'),_0xf48f('0x72'),_0x2b5577);}return null;})['then'](function(_0x385537){var _0xca65dd=_0xf48f('0x73')+_0x385537[_0xf48f('0x1b')]['ContactId'];return db[_0xf48f('0x74')][_0xf48f('0x32')](_0xca65dd,{'type':db[_0xf48f('0x75')][_0xf48f('0x76')][_0xf48f('0x77')],'raw':!![]})['then'](function(_0x377d41){return _0x377d41;});})[_0xf48f('0x13')](function(_0x359928){if(_0x359928){_0x2b5577['message']['contact']=_0x359928[0x0];if(!_0x11306b['body']['UserId'])return;return db[_0xf48f('0x78')][_0xf48f('0x47')]({'where':{'id':_0x11306b['body'][_0xf48f('0x67')],'role':'agent'},'attributes':['id','name',_0xf48f('0x79'),_0xf48f('0x7a'),_0xf48f('0x7b')],'raw':!![]});}return null;})[_0xf48f('0x13')](function(_0x4161d9){if(!_0x4161d9)return null;_0x2b5577['message']['agent']=_0x4161d9;return _0x2b5577;})[_0xf48f('0x13')](function(_0x58f0fe){if(_0x58f0fe){if(_0x11306b[_0xf48f('0x46')][_0xf48f('0x7c')]){_0x2b5577['message'][_0xf48f('0x7d')]=util['format'](_0xf48f('0x7e'),_0x11306b['user'][_0xf48f('0x29')]);_0x2b5577['message'][_0xf48f('0x7f')]=_0x2b5577['channel'];_0x2b5577[_0xf48f('0x1b')][_0xf48f('0x80')]=_0x2b5577[_0xf48f('0x7f')];_0x2b5577['message']['event']=_0xf48f('0x63');_0x2b5577[_0xf48f('0x1b')][_0xf48f('0x46')]=htmlToText[_0xf48f('0x81')](_0x2b5577[_0xf48f('0x1b')][_0xf48f('0x46')]);return respondWithRpcPromise(_0xf48f('0x82'),_0xf48f('0x82'),{'event':'acceptmessage','message':_0x2b5577[_0xf48f('0x1b')]},client9002)['then'](function(){return _0x2b5577;});}return _0x2b5577;}return null;})[_0xf48f('0x13')](respondWithResult(_0x5a79bc,null))['catch'](handleError(_0x5a79bc,null));};exports[_0xf48f('0x83')]=function(_0x2656da,_0x3f04ee){var _0x1b3392={'agent':{},'channel':_0xf48f('0x64')};if(_0x2656da[_0xf48f('0x46')]['id']){delete _0x2656da[_0xf48f('0x46')]['id'];}_0x2656da[_0xf48f('0x46')][_0xf48f('0x67')]=_0x2656da[_0xf48f('0x46')][_0xf48f('0x67')]||_0x2656da[_0xf48f('0x68')]['id'];_0x1b3392[_0xf48f('0x69')]['id']=_0x2656da[_0xf48f('0x46')][_0xf48f('0x67')];return db[_0xf48f('0x2d')][_0xf48f('0x47')]({'where':{'id':_0x2656da['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f04ee,null))[_0xf48f('0x13')](function(_0xc076cd){if(_0xc076cd){_0x1b3392[_0xf48f('0x1b')]=_0xc076cd[_0xf48f('0x6a')]({'plain':!![]});return db['MailInteraction'][_0xf48f('0x47')]({'where':{'id':_0xc076cd[_0xf48f('0x6c')]}});}return null;})[_0xf48f('0x13')](handleEntityNotFound(_0x3f04ee,null))[_0xf48f('0x13')](function(_0x2a48d2){if(_0x2a48d2){_0x1b3392[_0xf48f('0x6f')]=_0x2a48d2['get']({'plain':!![]});interaction_log[_0xf48f('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2656da[_0xf48f('0x68')]['id'],_0x2656da[_0xf48f('0x68')][_0xf48f('0x29')],_0x2656da['user'][_0xf48f('0x84')],_0x1b3392[_0xf48f('0x6f')]['id'],_0x2656da[_0xf48f('0x46')]?JSON[_0xf48f('0x18')](_0x2656da[_0xf48f('0x46')]):_0xf48f('0x85'));return respondWithRpcPromise(_0xf48f('0x86'),_0xf48f('0x87'),_0x1b3392);}return null;})[_0xf48f('0x13')](function(_0x385a24){var _0x4d6288=_0xf48f('0x73')+_0x385a24['message'][_0xf48f('0x88')];return db[_0xf48f('0x74')][_0xf48f('0x32')](_0x4d6288,{'type':db[_0xf48f('0x75')][_0xf48f('0x76')][_0xf48f('0x77')],'raw':!![]})['then'](function(_0x195dc2){return _0x195dc2;});})[_0xf48f('0x13')](function(_0x5a2920){if(_0x5a2920){_0x1b3392[_0xf48f('0x1b')][_0xf48f('0x89')]=_0x5a2920[0x0];if(!_0x2656da[_0xf48f('0x46')][_0xf48f('0x67')])return;return db['User']['find']({'where':{'id':_0x2656da['body'][_0xf48f('0x67')],'role':_0xf48f('0x69')},'attributes':['id',_0xf48f('0x29'),_0xf48f('0x79'),_0xf48f('0x7a'),_0xf48f('0x7b')],'raw':!![]});}return null;})[_0xf48f('0x13')](function(_0x1d2156){if(!_0x1d2156)return null;_0x1b3392[_0xf48f('0x1b')][_0xf48f('0x69')]=_0x1d2156;return _0x1b3392;})['then'](function(_0xa47d91){if(_0xa47d91){_0xa47d91[_0xf48f('0x1b')]['interface']=util[_0xf48f('0x61')](_0xf48f('0x7e'),_0x2656da['user'][_0xf48f('0x29')]);_0xa47d91[_0xf48f('0x1b')]['channel']=_0x1b3392['channel'];_0xa47d91['message'][_0xf48f('0x80')]=_0x1b3392[_0xf48f('0x7f')];_0xa47d91['message']['event']='reject';_0xa47d91['message']['body']=htmlToText['fromString'](_0x1b3392[_0xf48f('0x1b')]['body']);respondWithRpcPromise(_0xf48f('0x82'),_0xf48f('0x82'),{'event':_0xf48f('0x8a'),'message':_0xa47d91['message']},client9002);return _0x1b3392;}return null;})[_0xf48f('0x13')](respondWithResult(_0x3f04ee,null))['catch'](handleError(_0x3f04ee,null));};exports['download']=function(_0x13925e,_0x15ffde){var _0x4a280d=moment()[_0xf48f('0x8b')]()[_0xf48f('0x8c')]();var _0x1899cd=path[_0xf48f('0x55')](config['root'],'server',_0xf48f('0x8d'),_0xf48f('0x8e'));var _0x3fe04a=path[_0xf48f('0x55')](config['root'],_0xf48f('0x8f'),_0xf48f('0x8d'),_0xf48f('0x54'));var _0x2c86e7=util[_0xf48f('0x61')](_0xf48f('0x90'),_0x4a280d);return db[_0xf48f('0x2d')][_0xf48f('0x47')]({'where':{'id':_0x13925e['params']['id']},'attributes':['id','body',_0xf48f('0x91'),'to','cc',_0xf48f('0x92'),'subject','createdAt'],'include':_0x13925e['query'][_0xf48f('0x54')]?[{'model':db[_0xf48f('0x93')],'as':'Attachments'}]:undefined})[_0xf48f('0x13')](handleEntityNotFound(_0x15ffde,null))[_0xf48f('0x13')](function(_0x454301){if(_0x454301){var _0x8fecd1=_0x454301;var _0x3711bb={'from':_0x8fecd1[_0xf48f('0x91')],'to':_0x8fecd1['to'],'subject':_0x8fecd1['subject'],'html':htmlEntities[_0xf48f('0x94')](_0x8fecd1[_0xf48f('0x46')]),'headers':{'Date':moment(_0x8fecd1['createdAt'])['format'](_0xf48f('0x95'))},'attachments':[]};if(_0x454301['cc']){_0x3711bb[_0xf48f('0x96')]['Cc']=_0x454301['cc'];}if(_0x454301['bcc']){_0x3711bb[_0xf48f('0x96')][_0xf48f('0x97')]=_0x454301['bcc'];}return new BPromise(function(_0x1ba0bf,_0x59f198){if(_0x454301['Attachments']){for(var _0x34bcad=0x0;_0x34bcad<_0x454301[_0xf48f('0x98')][_0xf48f('0x38')];_0x34bcad++){var _0x1a51d4=_0x454301[_0xf48f('0x98')][_0x34bcad];var _0x58bbf5=path[_0xf48f('0x55')](_0x3fe04a,_0x1a51d4[_0xf48f('0x58')]);if(fs[_0xf48f('0x99')](_0x58bbf5)){_0x3711bb[_0xf48f('0x54')][_0xf48f('0x9a')]({'name':_0x1a51d4['name'],'contentType':_0x1a51d4['type'],'data':fs[_0xf48f('0x9b')](_0x58bbf5)});}}}emlformat[_0xf48f('0x9c')](_0x3711bb,function(_0x50f2cb,_0xb0cc1f){if(_0x50f2cb)return _0x59f198(_0x50f2cb);fs[_0xf48f('0x9d')](path[_0xf48f('0x55')](_0x1899cd,_0x2c86e7),_0xb0cc1f);return _0x1ba0bf(_0xb0cc1f);});});}})[_0xf48f('0x13')](function(_0x534afc){if(_0x534afc){return _0x15ffde[_0xf48f('0x9e')](path[_0xf48f('0x55')](_0x1899cd,_0x2c86e7),_0x2c86e7,function(_0x427124){if(!_0x427124)fs['unlinkSync'](path[_0xf48f('0x55')](_0x1899cd,_0x2c86e7));});}})[_0xf48f('0x1c')](handleError(_0x15ffde,null));}; \ No newline at end of file +var _0x7af8=['redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','json','offset','limit','undefined','count','status','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','type','key','keys','query','filters','model','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','fields','merge','find','body','catch','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','List','Contacts','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','ListId','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','Sequelize','QueryTypes','contact','fullname','email','manual','interface','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','User','internal','motionChannel','event','rejectmessage','download','unix','files','tmp','server','from','bcc','subject','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','readFileSync','writeFileSync','unlinkSync','bluebird','util','path','ioredis','mail-interactions','../../config/environment','../../mysqldb','defaults'];(function(_0x3b08de,_0x63ddd0){var _0x53fbe4=function(_0x16eea2){while(--_0x16eea2){_0x3b08de['push'](_0x3b08de['shift']());}};_0x53fbe4(++_0x63ddd0);}(_0x7af8,0x130));var _0x87af=function(_0x4bbdb8,_0x2f0491){_0x4bbdb8=_0x4bbdb8-0x0;var _0xa703fb=_0x7af8[_0x4bbdb8];return _0xa703fb;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x87af('0x0'));var util=require(_0x87af('0x1'));var path=require(_0x87af('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x87af('0x3'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var interaction_log=require('../../config/logger')(_0x87af('0x4'));var config=require(_0x87af('0x5'));var db=require(_0x87af('0x6'))['db'];config['redis']=_[_0x87af('0x7')](config[_0x87af('0x8')],{'host':_0x87af('0x9'),'port':0x18eb});var socket=require(_0x87af('0xa'))(new Redis(config[_0x87af('0x8')]));var htmlEntities=require(_0x87af('0xb'));require(_0x87af('0xc'))[_0x87af('0xd')](socket);var jayson=require(_0x87af('0xe'));var client=jayson[_0x87af('0xf')][_0x87af('0x10')]({'port':0x232c});var client9003=jayson['client'][_0x87af('0x10')]({'port':0x232b});var client9002=jayson[_0x87af('0xf')][_0x87af('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x1e28f5,_0x426746,_0x16be2f,_0x368c9f){return new BPromise(function(_0x2ba710,_0x5a6e67){var _0x52f491=_0x368c9f||client;return _0x52f491['request'](_0x1e28f5,_0x16be2f)['then'](function(_0xda19a6){logger[_0x87af('0x11')](_0x87af('0x12'),_0x426746,'request\x20sent');logger[_0x87af('0x13')](_0x87af('0x14'),_0x426746,_0x87af('0x15'),JSON[_0x87af('0x16')](_0xda19a6));if(_0xda19a6[_0x87af('0x17')]){if(_0xda19a6[_0x87af('0x17')][_0x87af('0x18')]===0x1f4){logger[_0x87af('0x17')](_0x87af('0x12'),_0x426746,_0xda19a6[_0x87af('0x17')][_0x87af('0x19')]);return _0x5a6e67(_0xda19a6['error'][_0x87af('0x19')]);}logger[_0x87af('0x17')](_0x87af('0x12'),_0x426746,_0xda19a6[_0x87af('0x17')][_0x87af('0x19')]);return _0x2ba710(_0xda19a6[_0x87af('0x17')]['message']);}else{logger[_0x87af('0x11')]('MailMessage,\x20%s,\x20%s',_0x426746,_0x87af('0x15'));_0x2ba710(_0xda19a6[_0x87af('0x1a')][_0x87af('0x19')]);}})['catch'](function(_0x2d4856){logger[_0x87af('0x17')](_0x87af('0x12'),_0x426746,_0x2d4856);_0x5a6e67(_0x2d4856);});});}function respondWithResult(_0x337c90,_0x3d9711){_0x3d9711=_0x3d9711||0xc8;return function(_0x443cca){if(_0x443cca){return _0x337c90['status'](_0x3d9711)[_0x87af('0x1b')](_0x443cca);}};}function respondWithFilteredResult(_0x2c7226,_0x1477b8){return function(_0x3327bd){if(_0x3327bd){var _0x4df16d=typeof _0x1477b8[_0x87af('0x1c')]==='undefined'&&typeof _0x1477b8[_0x87af('0x1d')]===_0x87af('0x1e');var _0xdcbbbf=_0x3327bd[_0x87af('0x1f')];var _0x360c33=_0x4df16d?0x0:_0x1477b8[_0x87af('0x1c')];var _0x47ebc2=_0x4df16d?_0x3327bd['count']:_0x1477b8[_0x87af('0x1c')]+_0x1477b8['limit'];var _0x26c8e2;if(_0x47ebc2>=_0xdcbbbf){_0x47ebc2=_0xdcbbbf;_0x26c8e2=0xc8;}else{_0x26c8e2=0xce;}_0x2c7226[_0x87af('0x20')](_0x26c8e2);return _0x2c7226[_0x87af('0x21')](_0x87af('0x22'),_0x360c33+'-'+_0x47ebc2+'/'+_0xdcbbbf)[_0x87af('0x1b')](_0x3327bd);}return null;};}function saveUpdates(_0x451f10){return function(_0x52aa3b){if(_0x52aa3b){return _0x52aa3b[_0x87af('0x23')](_0x451f10)[_0x87af('0x24')](function(_0x8f185c){return _0x8f185c;});}return null;};}function removeEntity(_0x225d5a){return function(_0x356375){if(_0x356375){return _0x356375[_0x87af('0x25')]()[_0x87af('0x24')](function(){_0x225d5a['status'](0xcc)[_0x87af('0x26')]();});}};}function handleEntityNotFound(_0x2cebda){return function(_0x437cc2){if(!_0x437cc2){_0x2cebda[_0x87af('0x27')](0x194);}return _0x437cc2;};}function handleError(_0x4c7ffb,_0x1af476){_0x1af476=_0x1af476||0x1f4;return function(_0x2cecc2){logger[_0x87af('0x17')](_0x2cecc2[_0x87af('0x28')]);if(_0x2cecc2[_0x87af('0x29')]){delete _0x2cecc2[_0x87af('0x29')];}_0x4c7ffb['status'](_0x1af476)[_0x87af('0x2a')](_0x2cecc2);};}exports[_0x87af('0x2b')]=function(_0x307910,_0xa522ee){var _0x47f4f1={},_0x25d1dd={},_0x4ed97d={'count':0x0,'rows':[]};var _0x5d3c91=_[_0x87af('0x2c')](db[_0x87af('0x2d')][_0x87af('0x2e')],function(_0x14b06f){return{'name':_0x14b06f['fieldName'],'type':_0x14b06f[_0x87af('0x2f')][_0x87af('0x30')]};});_0x25d1dd['model']=_['map'](_0x5d3c91,_0x87af('0x29'));_0x25d1dd['query']=_[_0x87af('0x31')](_0x307910[_0x87af('0x32')]);_0x25d1dd[_0x87af('0x33')]=_['intersection'](_0x25d1dd[_0x87af('0x34')],_0x25d1dd['query']);_0x47f4f1[_0x87af('0x35')]=_['intersection'](_0x25d1dd['model'],qs['fields'](_0x307910[_0x87af('0x32')]['fields']));_0x47f4f1[_0x87af('0x35')]=_0x47f4f1[_0x87af('0x35')][_0x87af('0x36')]?_0x47f4f1[_0x87af('0x35')]:_0x25d1dd[_0x87af('0x34')];if(!_0x307910[_0x87af('0x32')][_0x87af('0x37')]('nolimit')){_0x47f4f1['limit']=qs['limit'](_0x307910[_0x87af('0x32')][_0x87af('0x1d')]);_0x47f4f1[_0x87af('0x1c')]=qs['offset'](_0x307910['query']['offset']);}_0x47f4f1[_0x87af('0x38')]=qs[_0x87af('0x39')](_0x307910[_0x87af('0x32')][_0x87af('0x39')]);_0x47f4f1['where']=qs[_0x87af('0x33')](_[_0x87af('0x3a')](_0x307910[_0x87af('0x32')],_0x25d1dd[_0x87af('0x33')]),_0x5d3c91);if(_0x307910[_0x87af('0x32')][_0x87af('0x3b')]){_0x47f4f1[_0x87af('0x3c')]=_['merge'](_0x47f4f1[_0x87af('0x3c')],{'$or':_[_0x87af('0x2c')](_0x5d3c91,function(_0x232fbe){if(_0x232fbe[_0x87af('0x2f')]!==_0x87af('0x3d')){var _0x39b8e2={};_0x39b8e2[_0x232fbe[_0x87af('0x29')]]={'$like':'%'+_0x307910[_0x87af('0x32')][_0x87af('0x3b')]+'%'};return _0x39b8e2;}})});}_0x47f4f1=_['merge']({},_0x47f4f1,_0x307910[_0x87af('0x3e')]);var _0x182687={'where':_0x47f4f1[_0x87af('0x3c')]};return db[_0x87af('0x2d')]['count'](_0x182687)[_0x87af('0x24')](function(_0x2c63bf){_0x4ed97d[_0x87af('0x1f')]=_0x2c63bf;if(_0x307910[_0x87af('0x32')][_0x87af('0x3f')]){_0x47f4f1[_0x87af('0x40')]=[{'all':!![]}];}return db[_0x87af('0x2d')][_0x87af('0x41')](_0x47f4f1);})[_0x87af('0x24')](function(_0x34112f){_0x4ed97d[_0x87af('0x42')]=_0x34112f;return _0x4ed97d;})[_0x87af('0x24')](respondWithFilteredResult(_0xa522ee,_0x47f4f1))['catch'](handleError(_0xa522ee,null));};exports[_0x87af('0x43')]=function(_0x5882a5,_0x1a4642){var _0xb3c30d={'raw':!![],'where':{'id':_0x5882a5[_0x87af('0x44')]['id']}},_0x33f336={};_0x33f336['model']=_['keys'](db[_0x87af('0x2d')][_0x87af('0x2e')]);_0x33f336[_0x87af('0x32')]=_['keys'](_0x5882a5[_0x87af('0x32')]);_0x33f336[_0x87af('0x33')]=_[_0x87af('0x45')](_0x33f336[_0x87af('0x34')],_0x33f336[_0x87af('0x32')]);_0xb3c30d['attributes']=_[_0x87af('0x45')](_0x33f336[_0x87af('0x34')],qs[_0x87af('0x46')](_0x5882a5[_0x87af('0x32')][_0x87af('0x46')]));_0xb3c30d[_0x87af('0x35')]=_0xb3c30d[_0x87af('0x35')][_0x87af('0x36')]?_0xb3c30d[_0x87af('0x35')]:_0x33f336[_0x87af('0x34')];if(_0x5882a5[_0x87af('0x32')]['includeAll']){_0xb3c30d[_0x87af('0x40')]=[{'all':!![]}];}_0xb3c30d=_[_0x87af('0x47')]({},_0xb3c30d,_0x5882a5[_0x87af('0x3e')]);return db[_0x87af('0x2d')][_0x87af('0x48')](_0xb3c30d)[_0x87af('0x24')](handleEntityNotFound(_0x1a4642,null))[_0x87af('0x24')](respondWithResult(_0x1a4642,null))['catch'](handleError(_0x1a4642,null));};exports['update']=function(_0x3c1945,_0x7a9a2c){if(_0x3c1945[_0x87af('0x49')]['id']){delete _0x3c1945['body']['id'];}return db['MailMessage'][_0x87af('0x48')]({'where':{'id':_0x3c1945[_0x87af('0x44')]['id']}})[_0x87af('0x24')](handleEntityNotFound(_0x7a9a2c,null))[_0x87af('0x24')](saveUpdates(_0x3c1945[_0x87af('0x49')],null))[_0x87af('0x24')](respondWithResult(_0x7a9a2c,null))[_0x87af('0x4a')](handleError(_0x7a9a2c,null));};exports[_0x87af('0x25')]=function(_0x55a61d,_0xec5ebb){return db['MailMessage'][_0x87af('0x48')]({'where':{'id':_0x55a61d[_0x87af('0x44')]['id']}})[_0x87af('0x24')](handleEntityNotFound(_0xec5ebb,null))['then'](removeEntity(_0xec5ebb,null))[_0x87af('0x4a')](handleError(_0xec5ebb,null));};exports[_0x87af('0x4b')]=function(_0x119765,_0x3d44f7){return db[_0x87af('0x2d')]['describe']()[_0x87af('0x24')](respondWithResult(_0x3d44f7,null))['catch'](handleError(_0x3d44f7,null));};exports[_0x87af('0x4c')]=function(_0x28a3a5,_0x1c7b5f){return db['MailMessage'][_0x87af('0x4c')](_0x28a3a5[_0x87af('0x49')])[_0x87af('0x24')](function(_0x33f001){if(_0x33f001){if(_0x33f001[_0x87af('0x4d')]===_0x87af('0x4e')&&!_0x33f001['secret']){var _0x2b068f,_0x24293e,_0x399912;if(_0x28a3a5[_0x87af('0x49')]['to']){_0x24293e=_0x28a3a5['body']['to'][_0x87af('0x4f')](',')[0x0];}return db[_0x87af('0x50')][_0x87af('0x51')]({'where':{'id':_0x33f001[_0x87af('0x52')]},'include':[{'model':db['CmList'],'as':_0x87af('0x53'),'include':[{'model':db['CmContact'],'as':_0x87af('0x54'),'where':{'email':_0x24293e},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x87af('0x55')],'as':_0x87af('0x56'),'raw':!![],'include':[{'model':db[_0x87af('0x57')],'as':_0x87af('0x57'),'raw':!![]}]}]})['then'](function(_0x29b83a){_0x2b068f=_0x29b83a;if(!_0x2b068f||!_0x2b068f[_0x87af('0x56')])return;var _0x5d40b2=_0x2b068f[_0x87af('0x58')]();if(_0x28a3a5[_0x87af('0x49')][_0x87af('0x59')]&&_0x28a3a5[_0x87af('0x49')][_0x87af('0x59')][_0x87af('0x36')]){for(var _0x27c660=0x0;_0x27c660<_0x28a3a5[_0x87af('0x49')][_0x87af('0x59')][_0x87af('0x36')];_0x27c660+=0x1){_0x28a3a5[_0x87af('0x49')][_0x87af('0x59')][_0x27c660]={'filename':_0x28a3a5[_0x87af('0x49')][_0x87af('0x59')][_0x27c660][_0x87af('0x29')],'path':path[_0x87af('0x5a')](config[_0x87af('0x5b')],_0x87af('0x5c'),_0x28a3a5[_0x87af('0x49')]['attachments'][_0x27c660]['basename'])};}}_0x399912={'account':_0x5d40b2,'message':_0x28a3a5['body']};return;})['then'](function(){if(_0x2b068f['List']){if(_0x2b068f['List'][_0x87af('0x54')][_0x87af('0x36')]){return _0x2b068f[_0x87af('0x53')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x87af('0x7')](_0x28a3a5[_0x87af('0x49')],{'firstName':_0x28a3a5[_0x87af('0x49')]['to'],'email':_0x28a3a5[_0x87af('0x49')]['to'],'phone':_0x28a3a5['body']['to'],'ListId':_0x2b068f[_0x87af('0x5d')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x399912){return respondWithRpcPromise('SendMail','sendMail',_0x399912,client9003)[_0x87af('0x24')](function(_0x6df94d){return _0x33f001['update']({'read':!![],'messageId':_0x6df94d[_0x87af('0x5e')],'sentAt':moment()[_0x87af('0x5f')](_0x87af('0x60'))});})[_0x87af('0x4a')](function(_0x55add4){logger[_0x87af('0x17')]('%s',JSON[_0x87af('0x16')](_0x55add4));return _0x33f001;});}return _0x33f001;});}return _0x33f001;}})['then'](respondWithResult(_0x1c7b5f,0xc9))['catch'](handleError(_0x1c7b5f,null));};exports[_0x87af('0x61')]=function(_0x117323,_0x592873){var _0x1a3735={'agent':{},'channel':_0x87af('0x62')};if(_0x117323[_0x87af('0x49')]['id']){delete _0x117323[_0x87af('0x49')]['id'];}_0x117323[_0x87af('0x49')][_0x87af('0x63')]=!![];_0x117323[_0x87af('0x49')][_0x87af('0x64')]=moment()[_0x87af('0x5f')](_0x87af('0x60'));_0x117323[_0x87af('0x49')]['UserId']=_0x117323['body'][_0x87af('0x65')]||_0x117323[_0x87af('0x66')]['id'];_0x1a3735[_0x87af('0x67')]['id']=_0x117323[_0x87af('0x49')][_0x87af('0x65')];return db[_0x87af('0x2d')][_0x87af('0x48')]({'where':{'id':_0x117323[_0x87af('0x44')]['id'],'UserId':null}})[_0x87af('0x24')](handleEntityNotFound(_0x592873,null))[_0x87af('0x24')](saveUpdates(_0x117323[_0x87af('0x49')],null))[_0x87af('0x24')](function(_0xccd746){if(_0xccd746){_0x1a3735['message']=_0xccd746[_0x87af('0x68')]({'plain':!![]});return db[_0x87af('0x69')][_0x87af('0x48')]({'where':{'id':_0xccd746[_0x87af('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x592873,null))[_0x87af('0x24')](function(_0x3e2778){if(_0x3e2778){return _0x3e2778[_0x87af('0x23')]({'UserId':_0x117323[_0x87af('0x49')][_0x87af('0x65')],'read1stAt':_[_0x87af('0x6b')](_0x3e2778['read1stAt'])?moment()['format'](_0x87af('0x60')):undefined});}return null;})[_0x87af('0x24')](function(_0x281641){if(_0x281641){_0x1a3735['interaction']=_0x281641[_0x87af('0x68')]({'plain':!![]});interaction_log[_0x87af('0x11')](_0x87af('0x6c'),_0x117323[_0x87af('0x66')]['id'],_0x117323[_0x87af('0x66')][_0x87af('0x29')],_0x117323['user']['role'],_0x1a3735[_0x87af('0x6d')]['id'],_0x117323[_0x87af('0x49')]?JSON[_0x87af('0x16')](_0x117323[_0x87af('0x49')]):_0x87af('0x6e'));return respondWithRpcPromise(_0x87af('0x6f'),_0x87af('0x70'),_0x1a3735);}return null;})[_0x87af('0x24')](function(_0x3c101c){var _0x1fb3ef='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c101c[_0x87af('0x19')]['ContactId'];return db['sequelize']['query'](_0x1fb3ef,{'type':db[_0x87af('0x71')][_0x87af('0x72')]['SELECT'],'raw':!![]})[_0x87af('0x24')](function(_0x4e6416){return _0x4e6416;});})[_0x87af('0x24')](function(_0x5b1357){if(_0x5b1357){_0x1a3735[_0x87af('0x19')][_0x87af('0x73')]=_0x5b1357[0x0];if(!_0x117323[_0x87af('0x49')][_0x87af('0x65')])return;return db['User'][_0x87af('0x48')]({'where':{'id':_0x117323[_0x87af('0x49')][_0x87af('0x65')],'role':_0x87af('0x67')},'attributes':['id',_0x87af('0x29'),_0x87af('0x74'),_0x87af('0x75'),'internal'],'raw':!![]});}return null;})[_0x87af('0x24')](function(_0x12e3d0){if(!_0x12e3d0)return null;_0x1a3735[_0x87af('0x19')][_0x87af('0x67')]=_0x12e3d0;return _0x1a3735;})[_0x87af('0x24')](function(_0x261d15){if(_0x261d15){if(_0x117323[_0x87af('0x49')][_0x87af('0x76')]){_0x1a3735[_0x87af('0x19')][_0x87af('0x77')]=util[_0x87af('0x5f')](_0x87af('0x78'),_0x117323['user'][_0x87af('0x29')]);_0x1a3735[_0x87af('0x19')][_0x87af('0x79')]=_0x1a3735[_0x87af('0x79')];_0x1a3735[_0x87af('0x19')]['motionChannel']=_0x1a3735[_0x87af('0x79')];_0x1a3735[_0x87af('0x19')]['event']=_0x87af('0x61');_0x1a3735[_0x87af('0x19')][_0x87af('0x49')]=htmlToText[_0x87af('0x7a')](_0x1a3735[_0x87af('0x19')][_0x87af('0x49')]);return respondWithRpcPromise(_0x87af('0x7b'),_0x87af('0x7b'),{'event':_0x87af('0x7c'),'message':_0x1a3735['message']},client9002)[_0x87af('0x24')](function(){return _0x1a3735;});}return _0x1a3735;}return null;})[_0x87af('0x24')](respondWithResult(_0x592873,null))['catch'](handleError(_0x592873,null));};exports[_0x87af('0x7d')]=function(_0x332e59,_0x4985c9){var _0x17e27c={'agent':{},'channel':'mail'};if(_0x332e59['body']['id']){delete _0x332e59[_0x87af('0x49')]['id'];}_0x332e59['body']['UserId']=_0x332e59[_0x87af('0x49')][_0x87af('0x65')]||_0x332e59[_0x87af('0x66')]['id'];_0x17e27c[_0x87af('0x67')]['id']=_0x332e59[_0x87af('0x49')]['UserId'];return db[_0x87af('0x2d')][_0x87af('0x48')]({'where':{'id':_0x332e59['params']['id'],'UserId':null}})[_0x87af('0x24')](handleEntityNotFound(_0x4985c9,null))[_0x87af('0x24')](function(_0x127b18){if(_0x127b18){_0x17e27c['message']=_0x127b18[_0x87af('0x68')]({'plain':!![]});return db[_0x87af('0x69')][_0x87af('0x48')]({'where':{'id':_0x127b18['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4985c9,null))[_0x87af('0x24')](function(_0x1da592){if(_0x1da592){_0x17e27c[_0x87af('0x6d')]=_0x1da592[_0x87af('0x68')]({'plain':!![]});interaction_log[_0x87af('0x11')](_0x87af('0x7e'),_0x332e59['user']['id'],_0x332e59['user'][_0x87af('0x29')],_0x332e59[_0x87af('0x66')][_0x87af('0x7f')],_0x17e27c[_0x87af('0x6d')]['id'],_0x332e59['body']?JSON[_0x87af('0x16')](_0x332e59['body']):_0x87af('0x6e'));return respondWithRpcPromise('RejectMessage',_0x87af('0x80'),_0x17e27c);}return null;})['then'](function(_0x49562c){var _0x119854=_0x87af('0x81')+_0x49562c[_0x87af('0x19')][_0x87af('0x82')];return db[_0x87af('0x83')][_0x87af('0x32')](_0x119854,{'type':db[_0x87af('0x71')][_0x87af('0x72')][_0x87af('0x84')],'raw':!![]})[_0x87af('0x24')](function(_0x523d82){return _0x523d82;});})['then'](function(_0x5ad8bd){if(_0x5ad8bd){_0x17e27c['message']['contact']=_0x5ad8bd[0x0];if(!_0x332e59[_0x87af('0x49')]['UserId'])return;return db[_0x87af('0x85')]['find']({'where':{'id':_0x332e59[_0x87af('0x49')][_0x87af('0x65')],'role':_0x87af('0x67')},'attributes':['id',_0x87af('0x29'),_0x87af('0x74'),_0x87af('0x75'),_0x87af('0x86')],'raw':!![]});}return null;})[_0x87af('0x24')](function(_0x2b27d5){if(!_0x2b27d5)return null;_0x17e27c[_0x87af('0x19')][_0x87af('0x67')]=_0x2b27d5;return _0x17e27c;})[_0x87af('0x24')](function(_0x1e9225){if(_0x1e9225){_0x1e9225['message'][_0x87af('0x77')]=util[_0x87af('0x5f')]('SIP/%s',_0x332e59[_0x87af('0x66')][_0x87af('0x29')]);_0x1e9225[_0x87af('0x19')][_0x87af('0x79')]=_0x17e27c['channel'];_0x1e9225[_0x87af('0x19')][_0x87af('0x87')]=_0x17e27c[_0x87af('0x79')];_0x1e9225[_0x87af('0x19')][_0x87af('0x88')]='reject';_0x1e9225[_0x87af('0x19')][_0x87af('0x49')]=htmlToText[_0x87af('0x7a')](_0x17e27c[_0x87af('0x19')][_0x87af('0x49')]);respondWithRpcPromise(_0x87af('0x7b'),_0x87af('0x7b'),{'event':_0x87af('0x89'),'message':_0x1e9225[_0x87af('0x19')]},client9002);return _0x17e27c;}return null;})['then'](respondWithResult(_0x4985c9,null))[_0x87af('0x4a')](handleError(_0x4985c9,null));};exports[_0x87af('0x8a')]=function(_0x127b6b,_0x4f6ce1){var _0x36f7d3=moment()[_0x87af('0x8b')]()['toString']();var _0x21ee31=path['join'](config[_0x87af('0x5b')],'server',_0x87af('0x8c'),_0x87af('0x8d'));var _0x38ebe2=path['join'](config[_0x87af('0x5b')],_0x87af('0x8e'),'files',_0x87af('0x59'));var _0x2fb819=util[_0x87af('0x5f')]('message-%s.eml',_0x36f7d3);return db[_0x87af('0x2d')]['find']({'where':{'id':_0x127b6b['params']['id']},'attributes':['id',_0x87af('0x49'),_0x87af('0x8f'),'to','cc',_0x87af('0x90'),_0x87af('0x91'),_0x87af('0x92')],'include':_0x127b6b[_0x87af('0x32')][_0x87af('0x59')]?[{'model':db['Attachment'],'as':_0x87af('0x93')}]:undefined})[_0x87af('0x24')](handleEntityNotFound(_0x4f6ce1,null))[_0x87af('0x24')](function(_0x52581e){if(_0x52581e){var _0x54d550=_0x52581e;var _0x385808={'from':_0x54d550[_0x87af('0x8f')],'to':_0x54d550['to'],'subject':_0x54d550[_0x87af('0x91')],'html':htmlEntities['decode'](_0x54d550[_0x87af('0x49')]),'headers':{'Date':moment(_0x54d550[_0x87af('0x92')])[_0x87af('0x5f')](_0x87af('0x94'))},'attachments':[]};if(_0x52581e['cc']){_0x385808[_0x87af('0x95')]['Cc']=_0x52581e['cc'];}if(_0x52581e['bcc']){_0x385808['headers'][_0x87af('0x96')]=_0x52581e['bcc'];}return new BPromise(function(_0x4d0427,_0x33eedf){if(_0x52581e[_0x87af('0x93')]){for(var _0x26e770=0x0;_0x26e770<_0x52581e[_0x87af('0x93')][_0x87af('0x36')];_0x26e770++){var _0x236f42=_0x52581e['Attachments'][_0x26e770];var _0x4cf913=path[_0x87af('0x5a')](_0x38ebe2,_0x236f42[_0x87af('0x97')]);if(fs['existsSync'](_0x4cf913)){_0x385808[_0x87af('0x59')][_0x87af('0x98')]({'name':_0x236f42[_0x87af('0x29')],'contentType':_0x236f42['type'],'data':fs[_0x87af('0x99')](_0x4cf913)});}}}emlformat['build'](_0x385808,function(_0x1d421c,_0xa88289){if(_0x1d421c)return _0x33eedf(_0x1d421c);fs[_0x87af('0x9a')](path[_0x87af('0x5a')](_0x21ee31,_0x2fb819),_0xa88289);return _0x4d0427(_0xa88289);});});}})[_0x87af('0x24')](function(_0x47a7fe){if(_0x47a7fe){return _0x4f6ce1['download'](path[_0x87af('0x5a')](_0x21ee31,_0x2fb819),_0x2fb819,function(_0x224bd2){if(!_0x224bd2)fs[_0x87af('0x9b')](path[_0x87af('0x5a')](_0x21ee31,_0x2fb819));});}})[_0x87af('0x4a')](handleError(_0x4f6ce1,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 13b7ff5..e6a2c5f 100644 --- a/server/api/mailMessage/mailMessage.events.js +++ b/server/api/mailMessage/mailMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8571=['events','../../mysqldb','MailMessage','save','update','emit','hasOwnProperty','hook','exports'];(function(_0xd1af8a,_0x2cb96f){var _0x3080fc=function(_0x83f0d8){while(--_0x83f0d8){_0xd1af8a['push'](_0xd1af8a['shift']());}};_0x3080fc(++_0x2cb96f);}(_0x8571,0x1dd));var _0x1857=function(_0x38bbfa,_0x5b0957){_0x38bbfa=_0x38bbfa-0x0;var _0x179f34=_0x8571[_0x38bbfa];return _0x179f34;};'use strict';var EventEmitter=require(_0x1857('0x0'));var MailMessage=require(_0x1857('0x1'))['db'][_0x1857('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1857('0x3'),'afterUpdate':_0x1857('0x4'),'afterDestroy':'remove'};function emitEvent(_0x163d97){return function(_0x466c4c,_0x214727,_0x331da2){MailMessageEvents[_0x1857('0x5')](_0x163d97+':'+_0x466c4c['id'],_0x466c4c);MailMessageEvents['emit'](_0x163d97,_0x466c4c);_0x331da2(null);};}for(var e in events){if(events[_0x1857('0x6')](e)){var event=events[e];MailMessage[_0x1857('0x7')](e,emitEvent(event));}}module[_0x1857('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xb5d8=['events','remove','emit','hasOwnProperty','exports'];(function(_0xd3c928,_0x199672){var _0x343de6=function(_0x2a97b3){while(--_0x2a97b3){_0xd3c928['push'](_0xd3c928['shift']());}};_0x343de6(++_0x199672);}(_0xb5d8,0x19a));var _0x8b5d=function(_0x5d2942,_0x511f23){_0x5d2942=_0x5d2942-0x0;var _0x3329db=_0xb5d8[_0x5d2942];return _0x3329db;};'use strict';var EventEmitter=require(_0x8b5d('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8b5d('0x1')};function emitEvent(_0x3a506a){return function(_0x2fa76e,_0x4874ca,_0x52c8dc){MailMessageEvents[_0x8b5d('0x2')](_0x3a506a+':'+_0x2fa76e['id'],_0x2fa76e);MailMessageEvents[_0x8b5d('0x2')](_0x3a506a,_0x2fa76e);_0x52c8dc(null);};}for(var e in events){if(events[_0x8b5d('0x3')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x8b5d('0x4')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 4fbdfc7..6197f55 100644 --- a/server/api/mailMessage/mailMessage.model.js +++ b/server/api/mailMessage/mailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c76=['MailInteraction','findOne','MailInteractionId','then','createdAt','direction','toLowerCase','catch','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','plainBody','fromString','body','models','get','out','isNil','UserId'];(function(_0x357e43,_0x3769a2){var _0xf0aa1c=function(_0xce71ae){while(--_0xce71ae){_0x357e43['push'](_0x357e43['shift']());}};_0xf0aa1c(++_0x3769a2);}(_0x2c76,0xe3));var _0x62c7=function(_0x3ac65e,_0x42bc09){_0x3ac65e=_0x3ac65e-0x0;var _0x139827=_0x2c76[_0x3ac65e];return _0x139827;};'use strict';var _=require(_0x62c7('0x0'));var util=require(_0x62c7('0x1'));var logger=require('../../config/logger')(_0x62c7('0x2'));var moment=require(_0x62c7('0x3'));var BPromise=require(_0x62c7('0x4'));var rp=require(_0x62c7('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62c7('0x6'));module[_0x62c7('0x7')]=function(_0x2dd55a,_0x11b06e){return _0x2dd55a['define']('MailMessage',attributes,{'tableName':_0x62c7('0x8'),'paranoid':![],'indexes':[{'name':_0x62c7('0x9'),'fields':[_0x62c7('0x9')]},{'name':_0x62c7('0xa'),'fields':['plainBody',_0x62c7('0xb')],'type':_0x62c7('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x48127c,_0x100fb2,_0x220454){if(_0x48127c['body']){_0x48127c[_0x62c7('0xd')]=htmlToText[_0x62c7('0xe')](_0x48127c[_0x62c7('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x220454(null,_0x100fb2);},'afterCreate':function(_0x132f89,_0x1e64e2,_0x309d31){var _0x5760f8=_0x2dd55a[_0x62c7('0x10')];var _0x51461c=_0x132f89[_0x62c7('0x11')]({'plain':!![]});if(_0x51461c['direction']['toLowerCase']()==='in'||_0x51461c['direction']['toLowerCase']()===_0x62c7('0x12')&&!_0x51461c['secret']&&!_[_0x62c7('0x13')](_0x51461c[_0x62c7('0x14')])){_0x5760f8[_0x62c7('0x15')][_0x62c7('0x16')]({'where':{'id':_0x51461c[_0x62c7('0x17')]}})[_0x62c7('0x18')](function(_0x2cb6d3){if(_0x2cb6d3){_0x2cb6d3['update']({'lastMsgAt':_0x51461c[_0x62c7('0x19')],'lastMsgDirection':_0x51461c[_0x62c7('0x1a')][_0x62c7('0x1b')]()});}})[_0x62c7('0x1c')](function(_0x5369d5){console[_0x62c7('0x1d')](_0x5369d5);});}_0x309d31();}},'charset':_0x62c7('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1e72=['fromString','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','plainBody'];(function(_0x33976d,_0x24729b){var _0x2723fd=function(_0x519d60){while(--_0x519d60){_0x33976d['push'](_0x33976d['shift']());}};_0x2723fd(++_0x24729b);}(_0x1e72,0x194));var _0x21e7=function(_0x153590,_0x1a426f){_0x153590=_0x153590-0x0;var _0x25bb5d=_0x1e72[_0x153590];return _0x25bb5d;};'use strict';var _=require('lodash');var util=require(_0x21e7('0x0'));var logger=require(_0x21e7('0x1'))(_0x21e7('0x2'));var moment=require(_0x21e7('0x3'));var BPromise=require(_0x21e7('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x21e7('0x5'));var rimraf=require(_0x21e7('0x6'));var config=require(_0x21e7('0x7'));var attributes=require(_0x21e7('0x8'));module[_0x21e7('0x9')]=function(_0x1f221b,_0x1a8275){return _0x1f221b['define'](_0x21e7('0xa'),attributes,{'tableName':_0x21e7('0xb'),'paranoid':![],'indexes':[{'name':_0x21e7('0xc'),'fields':['messageId']},{'name':_0x21e7('0xd'),'fields':['plainBody','subject'],'type':_0x21e7('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x12e7d1,_0x3cebee,_0x192e17){if(_0x12e7d1['body']){_0x12e7d1[_0x21e7('0xf')]=htmlToText[_0x21e7('0x10')](_0x12e7d1[_0x21e7('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x192e17(null,_0x3cebee);},'afterCreate':function(_0x3be257,_0x1d68a4,_0x19af1f){var _0x277894=_0x1f221b[_0x21e7('0x12')];var _0x17155f=_0x3be257[_0x21e7('0x13')]({'plain':!![]});if(_0x17155f[_0x21e7('0x14')][_0x21e7('0x15')]()==='in'||_0x17155f['direction']['toLowerCase']()===_0x21e7('0x16')&&!_0x17155f[_0x21e7('0x17')]&&!_[_0x21e7('0x18')](_0x17155f[_0x21e7('0x19')])){_0x277894[_0x21e7('0x1a')][_0x21e7('0x1b')]({'where':{'id':_0x17155f[_0x21e7('0x1c')]}})[_0x21e7('0x1d')](function(_0x4e2e07){if(_0x4e2e07){_0x4e2e07[_0x21e7('0x1e')]({'lastMsgAt':_0x17155f[_0x21e7('0x1f')],'lastMsgDirection':_0x17155f[_0x21e7('0x14')]['toLowerCase']()});}})[_0x21e7('0x20')](function(_0x2a2f33){console[_0x21e7('0x21')](_0x2a2f33);});}_0x19af1f();}},'charset':'utf8mb4','collate':_0x21e7('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 0582498..803fe45 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb78e=['http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x123874,_0x3b9ed3){var _0x3f552e=function(_0x3cd52f){while(--_0x3cd52f){_0x123874['push'](_0x123874['shift']());}};_0x3f552e(++_0x3b9ed3);}(_0xb78e,0x1c9));var _0xeb78=function(_0x164512,_0x4dd65f){_0x164512=_0x164512-0x0;var _0x19255e=_0xb78e[_0x164512];return _0x19255e;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});config[_0xeb78('0xc')]=_[_0xeb78('0xd')](config[_0xeb78('0xc')],{'host':_0xeb78('0xe'),'port':0x18eb});var socket=require(_0xeb78('0xf'))(new Redis(config['redis']));require(_0xeb78('0x10'))[_0xeb78('0x11')](socket);function respondWithRpcPromise(_0xa1ca82,_0x46fbad,_0x125e97){return new BPromise(function(_0x402680,_0x15137b){return client[_0xeb78('0x12')](_0xa1ca82,_0x125e97)[_0xeb78('0x13')](function(_0x59d8d8){logger[_0xeb78('0x14')](_0xeb78('0x15'),_0x46fbad,_0xeb78('0x16'));logger[_0xeb78('0x17')](_0xeb78('0x18'),_0x46fbad,_0xeb78('0x16'),JSON[_0xeb78('0x19')](_0x59d8d8));if(_0x59d8d8[_0xeb78('0x1a')]){if(_0x59d8d8[_0xeb78('0x1a')][_0xeb78('0x1b')]===0x1f4){logger['error'](_0xeb78('0x15'),_0x46fbad,_0x59d8d8[_0xeb78('0x1a')]['message']);return _0x15137b(_0x59d8d8['error']['message']);}logger[_0xeb78('0x1a')]('MailMessage,\x20%s,\x20%s',_0x46fbad,_0x59d8d8[_0xeb78('0x1a')][_0xeb78('0x1c')]);return _0x402680(_0x59d8d8['error'][_0xeb78('0x1c')]);}else{logger['info'](_0xeb78('0x15'),_0x46fbad,_0xeb78('0x16'));_0x402680(_0x59d8d8['result'][_0xeb78('0x1c')]);}})[_0xeb78('0x1d')](function(_0x1cb338){logger['error'](_0xeb78('0x15'),_0x46fbad,_0x1cb338);_0x15137b(_0x1cb338);});});}exports[_0xeb78('0x1e')]=function(_0x4ab933){var _0x48b106=this;return new Promise(function(_0x455e30,_0x106c5d){return db[_0xeb78('0x1f')][_0xeb78('0x20')](_0x4ab933[_0xeb78('0x21')],{'raw':_0x4ab933[_0xeb78('0x22')]?_0x4ab933[_0xeb78('0x22')][_0xeb78('0x23')]===undefined?!![]:![]:!![]})[_0xeb78('0x13')](function(_0x52b8c1){logger['info']('CreateMailMessage',_0x4ab933);logger['debug'](_0xeb78('0x1e'),_0x4ab933,JSON['stringify'](_0x52b8c1));_0x455e30(_0x52b8c1);})[_0xeb78('0x1d')](function(_0x1fbf2f){logger['error'](_0xeb78('0x1e'),_0x1fbf2f['message'],_0x4ab933);_0x106c5d(_0x48b106[_0xeb78('0x1a')](0x1f4,_0x1fbf2f[_0xeb78('0x1c')]));});});}; \ No newline at end of file +var _0xd4a2=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateMailMessage','create','body','options','raw','then','catch','lodash'];(function(_0x577e6f,_0x2d8ddb){var _0x3eaf46=function(_0x2f7ff4){while(--_0x2f7ff4){_0x577e6f['push'](_0x577e6f['shift']());}};_0x3eaf46(++_0x2d8ddb);}(_0xd4a2,0x173));var _0x2d4a=function(_0x4c81ce,_0x23f069){_0x4c81ce=_0x4c81ce-0x0;var _0x201b3b=_0xd4a2[_0x4c81ce];return _0x201b3b;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4a('0x3'));var logger=require('../../config/logger')(_0x2d4a('0x4'));var config=require(_0x2d4a('0x5'));var jayson=require(_0x2d4a('0x6'));var client=jayson[_0x2d4a('0x7')][_0x2d4a('0x8')]({'port':0x232a});config['redis']=_[_0x2d4a('0x9')](config[_0x2d4a('0xa')],{'host':_0x2d4a('0xb'),'port':0x18eb});var socket=require(_0x2d4a('0xc'))(new Redis(config[_0x2d4a('0xa')]));require(_0x2d4a('0xd'))[_0x2d4a('0xe')](socket);function respondWithRpcPromise(_0x113839,_0x33b786,_0x4738dc){return new BPromise(function(_0x3abbbd,_0xce6af6){return client['request'](_0x113839,_0x4738dc)['then'](function(_0x4002de){logger['info'](_0x2d4a('0xf'),_0x33b786,_0x2d4a('0x10'));logger[_0x2d4a('0x11')](_0x2d4a('0x12'),_0x33b786,_0x2d4a('0x10'),JSON[_0x2d4a('0x13')](_0x4002de));if(_0x4002de[_0x2d4a('0x14')]){if(_0x4002de[_0x2d4a('0x14')]['code']===0x1f4){logger['error'](_0x2d4a('0xf'),_0x33b786,_0x4002de['error'][_0x2d4a('0x15')]);return _0xce6af6(_0x4002de[_0x2d4a('0x14')][_0x2d4a('0x15')]);}logger[_0x2d4a('0x14')]('MailMessage,\x20%s,\x20%s',_0x33b786,_0x4002de[_0x2d4a('0x14')]['message']);return _0x3abbbd(_0x4002de[_0x2d4a('0x14')]['message']);}else{logger[_0x2d4a('0x16')](_0x2d4a('0xf'),_0x33b786,_0x2d4a('0x10'));_0x3abbbd(_0x4002de[_0x2d4a('0x17')]['message']);}})['catch'](function(_0x5ac74b){logger[_0x2d4a('0x14')](_0x2d4a('0xf'),_0x33b786,_0x5ac74b);_0xce6af6(_0x5ac74b);});});}exports[_0x2d4a('0x18')]=function(_0x419df5){var _0x46c331=this;return new Promise(function(_0x2e4069,_0x56445a){return db['MailMessage'][_0x2d4a('0x19')](_0x419df5[_0x2d4a('0x1a')],{'raw':_0x419df5[_0x2d4a('0x1b')]?_0x419df5[_0x2d4a('0x1b')][_0x2d4a('0x1c')]===undefined?!![]:![]:!![]})[_0x2d4a('0x1d')](function(_0x22dd0b){logger[_0x2d4a('0x16')]('CreateMailMessage',_0x419df5);logger[_0x2d4a('0x11')](_0x2d4a('0x18'),_0x419df5,JSON[_0x2d4a('0x13')](_0x22dd0b));_0x2e4069(_0x22dd0b);})[_0x2d4a('0x1e')](function(_0x2c845c){logger[_0x2d4a('0x14')](_0x2d4a('0x18'),_0x2c845c[_0x2d4a('0x15')],_0x419df5);_0x56445a(_0x46c331['error'](0x1f4,_0x2c845c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 2cf9c94..6cca3f0 100644 --- a/server/api/mailMessage/mailMessage.socket.js +++ b/server/api/mailMessage/mailMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c92=['update','emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x378909,_0x54613d){var _0x6395c5=function(_0x2c8c93){while(--_0x2c8c93){_0x378909['push'](_0x378909['shift']());}};_0x6395c5(++_0x54613d);}(_0x2c92,0x16e));var _0x22c9=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x2c92[_0x5774be];return _0x4914b4;};'use strict';var MailMessageEvents=require(_0x22c9('0x0'));var events=[_0x22c9('0x1'),_0x22c9('0x2'),_0x22c9('0x3')];function createListener(_0xd4c1b6,_0x5ad125){return function(_0x45e248){_0x5ad125[_0x22c9('0x4')](_0xd4c1b6,_0x45e248);};}function removeListener(_0x2bb36d,_0x1e0bcd){return function(){MailMessageEvents[_0x22c9('0x5')](_0x2bb36d,_0x1e0bcd);};}exports[_0x22c9('0x6')]=function(_0x447b85){for(var _0x431473=0x0,_0x5ddd34=events[_0x22c9('0x7')];_0x431473<_0x5ddd34;_0x431473++){var _0x5e9d74=events[_0x431473];var _0x51389b=createListener(_0x22c9('0x8')+_0x5e9d74,_0x447b85);MailMessageEvents['on'](_0x5e9d74,_0x51389b);}}; \ No newline at end of file +var _0xfbf0=['mailMessage:','save','remove','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbf0,0x141));var _0x0fbf=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xfbf0[_0x474bc0];return _0x4b24cf;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x0fbf('0x0'),_0x0fbf('0x1'),'update'];function createListener(_0x55ae3f,_0x112fd3){return function(_0x15f376){_0x112fd3['emit'](_0x55ae3f,_0x15f376);};}function removeListener(_0x200f9c,_0x4a244a){return function(){MailMessageEvents[_0x0fbf('0x2')](_0x200f9c,_0x4a244a);};}exports['register']=function(_0xe258f6){for(var _0x29c1cb=0x0,_0x5210d3=events[_0x0fbf('0x3')];_0x29c1cb<_0x5210d3;_0x29c1cb++){var _0x32f4e0=events[_0x29c1cb];var _0x64e97=createListener(_0x0fbf('0x4')+_0x32f4e0,_0xe258f6);MailMessageEvents['on'](_0x32f4e0,_0x64e97);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 1e4c5fb..bb4e091 100644 --- a/server/api/mailQueue/index.js +++ b/server/api/mailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dbf=['getAgents','create','addTeams','post','addAgents','put','delete','destroy','/:id/teams','removeTeams','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/members','/:id/users'];(function(_0x36072d,_0x24f414){var _0x32a52c=function(_0x19834c){while(--_0x19834c){_0x36072d['push'](_0x36072d['shift']());}};_0x32a52c(++_0x24f414);}(_0x3dbf,0x1e6));var _0xf3db=function(_0x3027c2,_0x2ee658){_0x3027c2=_0x3027c2-0x0;var _0x5af63c=_0x3dbf[_0x3027c2];return _0x5af63c;};'use strict';var multer=require('multer');var util=require(_0xf3db('0x0'));var path=require(_0xf3db('0x1'));var timeout=require(_0xf3db('0x2'));var express=require(_0xf3db('0x3'));var router=express['Router']();var fs_extra=require(_0xf3db('0x4'));var auth=require(_0xf3db('0x5'));var interaction=require(_0xf3db('0x6'));var config=require(_0xf3db('0x7'));var controller=require(_0xf3db('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf3db('0x9')]);router[_0xf3db('0xa')](_0xf3db('0xb'),auth['isAuthenticated'](),controller[_0xf3db('0xc')]);router[_0xf3db('0xa')](_0xf3db('0xd'),auth[_0xf3db('0xe')](),controller[_0xf3db('0xf')]);router[_0xf3db('0xa')](_0xf3db('0x10'),auth[_0xf3db('0xe')](),controller['getMembers']);router[_0xf3db('0xa')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xf3db('0x11'),auth[_0xf3db('0xe')](),controller[_0xf3db('0x12')]);router['post']('/',auth[_0xf3db('0xe')](),controller[_0xf3db('0x13')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xf3db('0x14')]);router[_0xf3db('0x15')](_0xf3db('0x11'),auth[_0xf3db('0xe')](),controller[_0xf3db('0x16')]);router[_0xf3db('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf3db('0x18')](_0xf3db('0xd'),auth['isAuthenticated'](),controller[_0xf3db('0x19')]);router[_0xf3db('0x18')](_0xf3db('0x1a'),auth[_0xf3db('0xe')](),controller[_0xf3db('0x1b')]);router[_0xf3db('0x18')](_0xf3db('0x11'),auth[_0xf3db('0xe')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xc640=['index','/:id','show','getTeams','post','create','addTeams','put','delete','destroy','/:id/teams','removeTeams','/:id/users','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated'];(function(_0x4a94d0,_0x374e5d){var _0x50128a=function(_0x595a2c){while(--_0x595a2c){_0x4a94d0['push'](_0x4a94d0['shift']());}};_0x50128a(++_0x374e5d);}(_0xc640,0x1c5));var _0x0c64=function(_0x369f42,_0x3a9150){_0x369f42=_0x369f42-0x0;var _0x5281c4=_0xc640[_0x369f42];return _0x5281c4;};'use strict';var multer=require('multer');var util=require(_0x0c64('0x0'));var path=require(_0x0c64('0x1'));var timeout=require(_0x0c64('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c64('0x3'));var auth=require(_0x0c64('0x4'));var interaction=require(_0x0c64('0x5'));var config=require('../../config/environment');var controller=require(_0x0c64('0x6'));router[_0x0c64('0x7')]('/',auth[_0x0c64('0x8')](),controller[_0x0c64('0x9')]);router[_0x0c64('0x7')]('/describe',auth[_0x0c64('0x8')](),controller['describe']);router['get'](_0x0c64('0xa'),auth['isAuthenticated'](),controller[_0x0c64('0xb')]);router['get']('/:id/members',auth[_0x0c64('0x8')](),controller['getMembers']);router[_0x0c64('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0c64('0xc')]);router[_0x0c64('0x7')]('/:id/users',auth[_0x0c64('0x8')](),controller['getAgents']);router[_0x0c64('0xd')]('/',auth['isAuthenticated'](),controller[_0x0c64('0xe')]);router[_0x0c64('0xd')]('/:id/teams',auth[_0x0c64('0x8')](),controller[_0x0c64('0xf')]);router[_0x0c64('0xd')]('/:id/users',auth[_0x0c64('0x8')](),controller['addAgents']);router[_0x0c64('0x10')](_0x0c64('0xa'),auth[_0x0c64('0x8')](),controller['update']);router[_0x0c64('0x11')](_0x0c64('0xa'),auth[_0x0c64('0x8')](),controller[_0x0c64('0x12')]);router[_0x0c64('0x11')](_0x0c64('0x13'),auth[_0x0c64('0x8')](),controller[_0x0c64('0x14')]);router[_0x0c64('0x11')](_0x0c64('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b0cc367..4d9581e 100644 --- a/server/api/mailQueue/mailQueue.attributes.js +++ b/server/api/mailQueue/mailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e47=['sequelize','exports','STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0x42e587,_0x5cffa7){var _0x3a7996=function(_0xf02b56){while(--_0xf02b56){_0x42e587['push'](_0x42e587['shift']());}};_0x3a7996(++_0x5cffa7);}(_0x9e47,0x118));var _0x79e4=function(_0x4bc3cd,_0x1aaf64){_0x4bc3cd=_0x4bc3cd-0x0;var _0x1ddb7e=_0x9e47[_0x4bc3cd];return _0x1ddb7e;};'use strict';var Sequelize=require(_0x79e4('0x0'));module[_0x79e4('0x1')]={'name':{'type':Sequelize[_0x79e4('0x2')],'unique':_0x79e4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x79e4('0x2')]},'timeout':{'type':Sequelize[_0x79e4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x79e4('0x5'),'beepall',_0x79e4('0x6'))}}; \ No newline at end of file +var _0x8f1a=['sequelize','exports','STRING','INTEGER','rrmemory','roundrobin'];(function(_0x43ef5c,_0x383a41){var _0xf8c2f1=function(_0x26b627){while(--_0x26b627){_0x43ef5c['push'](_0x43ef5c['shift']());}};_0xf8c2f1(++_0x383a41);}(_0x8f1a,0x126));var _0xa8f1=function(_0xb6c2b7,_0x6176ff){_0xb6c2b7=_0xb6c2b7-0x0;var _0x27bfe7=_0x8f1a[_0xb6c2b7];return _0x27bfe7;};'use strict';var Sequelize=require(_0xa8f1('0x0'));module[_0xa8f1('0x1')]={'name':{'type':Sequelize[_0xa8f1('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa8f1('0x2')]},'timeout':{'type':Sequelize[_0xa8f1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa8f1('0x4'),'beepall',_0xa8f1('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 248afca..97360a0 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b0f=['Agents','online','interface','flatMap','sequelize','transaction','each','forEach','emit','userMailQueue:save','removeTeams','field','tq.TeamId','from','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','findOne','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','then','get','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','rawAttributes','getOptions','where','count','include','query','findAll','rows','catch','params','keys','model','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','filters','intersection','nolimit','order','sort','pick','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9b0f,0x187));var _0xf9b0=function(_0x4d7c86,_0x9b62a6){_0x4d7c86=_0x4d7c86-0x0;var _0x59443d=_0x9b0f[_0x4d7c86];return _0x59443d;};'use strict';var BPromise=require(_0xf9b0('0x0'));var util=require(_0xf9b0('0x1'));var _=require(_0xf9b0('0x2'));var squel=require(_0xf9b0('0x3'));var Redis=require(_0xf9b0('0x4'));var qs=require(_0xf9b0('0x5'));var logger=require('../../config/logger')(_0xf9b0('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf9b0('0x7')](config['redis'],{'host':_0xf9b0('0x8'),'port':0x18eb});var socket=require(_0xf9b0('0x9'))(new Redis(config[_0xf9b0('0xa')]));require('./mailQueue.socket')[_0xf9b0('0xb')](socket);function respondWithStatusCode(_0x3eb07e,_0x353667){_0x353667=_0x353667||0xcc;return function(_0x554a90){if(_0x554a90){return _0x3eb07e[_0xf9b0('0xc')](_0x353667);}return _0x3eb07e[_0xf9b0('0xd')](_0x353667)[_0xf9b0('0xe')]();};}function respondWithResult(_0x27e545,_0x450bc9){_0x450bc9=_0x450bc9||0xc8;return function(_0x4597b2){if(_0x4597b2){return _0x27e545[_0xf9b0('0xd')](_0x450bc9)[_0xf9b0('0xf')](_0x4597b2);}};}function respondWithFilteredResult(_0x11c2aa,_0x195602){return function(_0x58aacd){if(_0x58aacd){var _0x21e6b5=typeof _0x195602[_0xf9b0('0x10')]===_0xf9b0('0x11')&&typeof _0x195602[_0xf9b0('0x12')]===_0xf9b0('0x11');var _0x2f6179=_0x58aacd['count'];var _0x55fdb0=_0x21e6b5?0x0:_0x195602['offset'];var _0x16268a=_0x21e6b5?_0x58aacd['count']:_0x195602[_0xf9b0('0x10')]+_0x195602[_0xf9b0('0x12')];var _0x3996f5;if(_0x16268a>=_0x2f6179){_0x16268a=_0x2f6179;_0x3996f5=0xc8;}else{_0x3996f5=0xce;}_0x11c2aa['status'](_0x3996f5);return _0x11c2aa[_0xf9b0('0x13')](_0xf9b0('0x14'),_0x55fdb0+'-'+_0x16268a+'/'+_0x2f6179)[_0xf9b0('0xf')](_0x58aacd);}return null;};}function saveUpdates(_0x332b2b){return function(_0x427504){if(_0x427504){return _0x427504[_0xf9b0('0x15')](_0x332b2b)['then'](function(_0x1cfad3){return _0x1cfad3;});}return null;};}function removeEntity(_0x5d7b66){return function(_0x3f57d8){if(_0x3f57d8){return _0x3f57d8[_0xf9b0('0x16')]()[_0xf9b0('0x17')](function(){var _0x3d84a5=_0x3f57d8[_0xf9b0('0x18')]({'plain':!![]});var _0x2bb8a0=_0xf9b0('0x19');return db[_0xf9b0('0x1a')][_0xf9b0('0x16')]({'where':{'type':_0x2bb8a0,'resourceId':_0x3d84a5['id']}})[_0xf9b0('0x17')](function(){return _0x3f57d8;});})[_0xf9b0('0x17')](function(){_0x5d7b66['status'](0xcc)[_0xf9b0('0xe')]();});}};}function handleEntityNotFound(_0x5bedcd){return function(_0x3ad0fe){if(!_0x3ad0fe){_0x5bedcd[_0xf9b0('0xc')](0x194);}return _0x3ad0fe;};}function handleError(_0x250317,_0x1b40f7){_0x1b40f7=_0x1b40f7||0x1f4;return function(_0x22be80){logger[_0xf9b0('0x1b')](_0x22be80['stack']);if(_0x22be80[_0xf9b0('0x1c')]){delete _0x22be80[_0xf9b0('0x1c')];}_0x250317['status'](_0x1b40f7)[_0xf9b0('0x1d')](_0x22be80);};}exports[_0xf9b0('0x1e')]=function(_0x2299fe,_0x48a624){var _0x5dc718={};var _0x2b1ea4={'count':0x0,'rows':[]};var _0x2cc721=_[_0xf9b0('0x1f')](db[_0xf9b0('0x20')][_0xf9b0('0x21')],function(_0x4b0b52){return{'name':_0x4b0b52['fieldName'],'type':_0x4b0b52['type']['key']};});_0x5dc718=qs[_0xf9b0('0x22')](_0x2cc721,_0x2299fe);var _0x145ced={'where':_0x5dc718[_0xf9b0('0x23')]};return db['MailQueue'][_0xf9b0('0x24')](_0x145ced)[_0xf9b0('0x17')](function(_0x435d22){_0x2b1ea4[_0xf9b0('0x24')]=_0x435d22;_0x5dc718[_0xf9b0('0x25')]=qs[_0xf9b0('0x25')](_0x2299fe[_0xf9b0('0x26')]);return db[_0xf9b0('0x20')][_0xf9b0('0x27')](_0x5dc718);})[_0xf9b0('0x17')](function(_0x3b0e9a){_0x2b1ea4[_0xf9b0('0x28')]=_0x3b0e9a;return _0x2b1ea4;})[_0xf9b0('0x17')](respondWithFilteredResult(_0x48a624,_0x5dc718))[_0xf9b0('0x29')](handleError(_0x48a624,null));};exports['show']=function(_0x14c835,_0x3333c2){var _0x1ac154={'raw':!![],'where':{'id':_0x14c835[_0xf9b0('0x2a')]['id']}},_0x3cb944={};_0x3cb944['model']=_[_0xf9b0('0x2b')](db[_0xf9b0('0x20')][_0xf9b0('0x21')]);_0x3cb944['query']=_[_0xf9b0('0x2b')](_0x14c835[_0xf9b0('0x26')]);_0x3cb944['filters']=_['intersection'](_0x3cb944[_0xf9b0('0x2c')],_0x3cb944[_0xf9b0('0x26')]);_0x1ac154[_0xf9b0('0x2d')]=_['intersection'](_0x3cb944[_0xf9b0('0x2c')],qs['fields'](_0x14c835[_0xf9b0('0x26')][_0xf9b0('0x2e')]));_0x1ac154[_0xf9b0('0x2d')]=_0x1ac154[_0xf9b0('0x2d')][_0xf9b0('0x2f')]?_0x1ac154[_0xf9b0('0x2d')]:_0x3cb944['model'];if(_0x14c835['query'][_0xf9b0('0x30')]){_0x1ac154[_0xf9b0('0x25')]=[{'all':!![]}];}_0x1ac154=_[_0xf9b0('0x31')]({},_0x1ac154,_0x14c835[_0xf9b0('0x32')]);return db['MailQueue'][_0xf9b0('0x33')](_0x1ac154)[_0xf9b0('0x17')](handleEntityNotFound(_0x3333c2,null))[_0xf9b0('0x17')](respondWithResult(_0x3333c2,null))[_0xf9b0('0x29')](handleError(_0x3333c2,null));};exports[_0xf9b0('0x34')]=function(_0x3e4e5e,_0x9bee64){return db[_0xf9b0('0x20')][_0xf9b0('0x34')](_0x3e4e5e[_0xf9b0('0x35')],{})[_0xf9b0('0x17')](function(_0x51a408){var _0x24863a=_0x3e4e5e[_0xf9b0('0x36')][_0xf9b0('0x18')]({'plain':!![]});if(!_0x24863a)throw new Error(_0xf9b0('0x37'));if(_0x24863a[_0xf9b0('0x38')]==='user'){var _0x432d59=_0x51a408[_0xf9b0('0x18')]({'plain':!![]});var _0x237d71='MailQueues';return db[_0xf9b0('0x39')][_0xf9b0('0x33')]({'where':{'name':_0x237d71,'userProfileId':_0x24863a[_0xf9b0('0x3a')]},'raw':!![]})['then'](function(_0x43ea75){if(_0x43ea75&&_0x43ea75[_0xf9b0('0x3b')]===0x0){return db[_0xf9b0('0x1a')]['create']({'name':_0x432d59['name'],'resourceId':_0x432d59['id'],'type':_0x43ea75['name'],'sectionId':_0x43ea75['id']},{})[_0xf9b0('0x17')](function(){return _0x51a408;});}else{return _0x51a408;}})['catch'](function(_0xe144a8){logger['error'](_0xf9b0('0x3c'),_0xe144a8);throw _0xe144a8;});}return _0x51a408;})[_0xf9b0('0x17')](respondWithResult(_0x9bee64,0xc9))['catch'](handleError(_0x9bee64,null));};exports['update']=function(_0x1c1719,_0x3d94bb){if(_0x1c1719['body']['id']){delete _0x1c1719['body']['id'];}return db[_0xf9b0('0x20')][_0xf9b0('0x33')]({'where':{'id':_0x1c1719[_0xf9b0('0x2a')]['id']}})[_0xf9b0('0x17')](handleEntityNotFound(_0x3d94bb,null))[_0xf9b0('0x17')](saveUpdates(_0x1c1719[_0xf9b0('0x35')],null))['then'](respondWithResult(_0x3d94bb,null))['catch'](handleError(_0x3d94bb,null));};exports[_0xf9b0('0x16')]=function(_0x1d972c,_0x483bc5){return db['MailQueue'][_0xf9b0('0x33')]({'where':{'id':_0x1d972c['params']['id']}})['then'](handleEntityNotFound(_0x483bc5,null))[_0xf9b0('0x17')](removeEntity(_0x483bc5,null))[_0xf9b0('0x29')](handleError(_0x483bc5,null));};exports[_0xf9b0('0x3d')]=function(_0xe33aaf,_0x21f267){return db['MailQueue']['describe']()[_0xf9b0('0x17')](respondWithResult(_0x21f267,null))[_0xf9b0('0x29')](handleError(_0x21f267,null));};exports[_0xf9b0('0x3e')]=function(_0x590c15,_0x395fb4){var _0x1ffa8a={'raw':!![],'where':{}},_0x1494e5={},_0x462081;return db[_0xf9b0('0x20')]['findOne']({'where':{'id':_0x590c15[_0xf9b0('0x2a')]['id']}})['then'](handleEntityNotFound(_0x395fb4,null))['then'](function(_0x173392){if(_0x173392){_0x462081=_0x173392[_0xf9b0('0x18')]({'plain':!![]});_0x1494e5['model']=_[_0xf9b0('0x2b')](db[_0xf9b0('0x3f')]['rawAttributes']);_0x1494e5[_0xf9b0('0x26')]=_['keys'](_0x590c15[_0xf9b0('0x26')]);_0x1494e5[_0xf9b0('0x40')]=_['intersection'](_0x1494e5[_0xf9b0('0x2c')],_0x1494e5['query']);_0x1ffa8a[_0xf9b0('0x2d')]=_[_0xf9b0('0x41')](_0x1494e5[_0xf9b0('0x2c')],qs['fields'](_0x590c15[_0xf9b0('0x26')][_0xf9b0('0x2e')]));_0x1ffa8a[_0xf9b0('0x2d')]=_0x1ffa8a[_0xf9b0('0x2d')][_0xf9b0('0x2f')]?_0x1ffa8a[_0xf9b0('0x2d')]:_0x1494e5[_0xf9b0('0x2c')];if(!_0x590c15['query']['hasOwnProperty'](_0xf9b0('0x42'))){_0x1ffa8a[_0xf9b0('0x12')]=qs[_0xf9b0('0x12')](_0x590c15[_0xf9b0('0x26')][_0xf9b0('0x12')]);_0x1ffa8a['offset']=qs['offset'](_0x590c15[_0xf9b0('0x26')][_0xf9b0('0x10')]);}_0x1ffa8a[_0xf9b0('0x43')]=qs[_0xf9b0('0x44')](_0x590c15['query'][_0xf9b0('0x44')]);_0x1ffa8a[_0xf9b0('0x23')]=qs[_0xf9b0('0x40')](_[_0xf9b0('0x45')](_0x590c15[_0xf9b0('0x26')],_0x1494e5[_0xf9b0('0x40')]));_0x1ffa8a[_0xf9b0('0x23')][_0xf9b0('0x46')]=_0x173392['id'];if(_0x590c15[_0xf9b0('0x26')]['filter']){_0x1ffa8a[_0xf9b0('0x23')]=_['merge'](_0x1ffa8a[_0xf9b0('0x23')],{'$or':_[_0xf9b0('0x1f')](_0x1ffa8a['attributes'],function(_0x264382){var _0x3b81df={};_0x3b81df[_0x264382]={'$like':'%'+_0x590c15['query'][_0xf9b0('0x47')]+'%'};return _0x3b81df;})});}_0x1ffa8a=_[_0xf9b0('0x31')]({},_0x1ffa8a,_0x590c15[_0xf9b0('0x32')]);return db[_0xf9b0('0x3f')][_0xf9b0('0x27')](_0x1ffa8a);}})[_0xf9b0('0x17')](function(_0xa7e0d5){if(_0xa7e0d5){return db[_0xf9b0('0x48')][_0xf9b0('0x49')]({'where':{'id':_['map'](_0xa7e0d5,_0xf9b0('0x4a')),'role':_0xf9b0('0x4b')},'attributes':['id',_0xf9b0('0x1c'),_0xf9b0('0x4c'),'updatedAt',_0xf9b0('0x4d')]});}})['then'](function(_0x3aced4){if(_0x3aced4){return{'count':_0x3aced4[_0xf9b0('0x24')],'rows':_[_0xf9b0('0x1f')](_0x3aced4[_0xf9b0('0x28')],function(_0x79905d){return{'membername':_0x79905d[_0xf9b0('0x1c')],'UserId':_0x79905d['id'],'queue_name':_0x462081['name'],'MailQueueId':_0x462081['id'],'interface':util[_0xf9b0('0x4e')](_0xf9b0('0x4f'),'SIP',_0x79905d['name']),'penalty':0x0,'paused':_0x79905d[_0xf9b0('0x4c')],'createdAt':_0x79905d[_0xf9b0('0x4d')],'updatedAt':_0x79905d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf9b0('0x17')](respondWithFilteredResult(_0x395fb4,_0x1ffa8a))['catch'](handleError(_0x395fb4,null));};exports[_0xf9b0('0x50')]=function(_0x592ed4,_0x1af11b){var _0x62ffc3={};var _0x766c3={};var _0x50a87c;var _0x303636;return db[_0xf9b0('0x20')]['findOne']({'where':{'id':_0x592ed4['params']['id']}})[_0xf9b0('0x17')](handleEntityNotFound(_0x1af11b,null))[_0xf9b0('0x17')](function(_0x2437ae){if(_0x2437ae){_0x50a87c=_0x2437ae;_0x766c3[_0xf9b0('0x2c')]=_[_0xf9b0('0x2b')](db[_0xf9b0('0x51')][_0xf9b0('0x21')]);_0x766c3[_0xf9b0('0x26')]=_[_0xf9b0('0x2b')](_0x592ed4['query']);_0x766c3[_0xf9b0('0x40')]=_['intersection'](_0x766c3[_0xf9b0('0x2c')],_0x766c3[_0xf9b0('0x26')]);_0x62ffc3[_0xf9b0('0x2d')]=_[_0xf9b0('0x41')](_0x766c3[_0xf9b0('0x2c')],qs[_0xf9b0('0x2e')](_0x592ed4[_0xf9b0('0x26')][_0xf9b0('0x2e')]));_0x62ffc3[_0xf9b0('0x2d')]=_0x62ffc3['attributes'][_0xf9b0('0x2f')]?_0x62ffc3[_0xf9b0('0x2d')]:_0x766c3[_0xf9b0('0x2c')];_0x62ffc3[_0xf9b0('0x43')]=qs[_0xf9b0('0x44')](_0x592ed4[_0xf9b0('0x26')]['sort']);_0x62ffc3[_0xf9b0('0x23')]=qs[_0xf9b0('0x40')](_[_0xf9b0('0x45')](_0x592ed4[_0xf9b0('0x26')],_0x766c3['filters']));if(_0x592ed4['query'][_0xf9b0('0x47')]){_0x62ffc3[_0xf9b0('0x23')]=_['merge'](_0x62ffc3['where'],{'$or':_[_0xf9b0('0x1f')](_0x62ffc3[_0xf9b0('0x2d')],function(_0x3a55bb){var _0x4e524f={};_0x4e524f[_0x3a55bb]={'$like':'%'+_0x592ed4[_0xf9b0('0x26')][_0xf9b0('0x47')]+'%'};return _0x4e524f;})});}_0x62ffc3=_[_0xf9b0('0x31')]({},_0x62ffc3,_0x592ed4[_0xf9b0('0x32')]);return _0x50a87c[_0xf9b0('0x50')](_0x62ffc3);}})['then'](function(_0x5df4f4){if(_0x5df4f4){_0x303636=_0x5df4f4[_0xf9b0('0x2f')];if(!_0x592ed4['query'][_0xf9b0('0x52')](_0xf9b0('0x42'))){_0x62ffc3[_0xf9b0('0x12')]=qs['limit'](_0x592ed4['query'][_0xf9b0('0x12')]);_0x62ffc3['offset']=qs[_0xf9b0('0x10')](_0x592ed4[_0xf9b0('0x26')]['offset']);}return _0x50a87c['getTeams'](_0x62ffc3);}})[_0xf9b0('0x17')](function(_0x102c7a){if(_0x102c7a){return _0x102c7a?{'count':_0x303636,'rows':_0x102c7a}:null;}})[_0xf9b0('0x17')](respondWithResult(_0x1af11b,null))['catch'](handleError(_0x1af11b,null));};exports[_0xf9b0('0x53')]=function(_0x34c27e,_0x33ccf7){var _0x34fc49=_0x34c27e['body'][_0xf9b0('0x54')];return db['Team']['findAll']({'where':{'id':_0x34fc49},'attributes':['id'],'include':[{'model':db[_0xf9b0('0x48')],'as':_0xf9b0('0x55'),'attributes':['id',_0xf9b0('0x1c'),_0xf9b0('0x56'),'voicePause',_0xf9b0('0x57')],'raw':!![]}]})[_0xf9b0('0x17')](function(_0x38ad05){if(_0x38ad05){var _0x121523=_[_0xf9b0('0x58')](_0x38ad05,function(_0x2d9873){var _0x2c35b1=_0x2d9873[_0xf9b0('0x18')]({'plain':!![]});return _0x2c35b1['Agents'];});return db[_0xf9b0('0x20')][_0xf9b0('0x33')]({'where':{'id':_0x34c27e[_0xf9b0('0x2a')]['id']}})[_0xf9b0('0x17')](function(_0x3aa3aa){return db[_0xf9b0('0x59')][_0xf9b0('0x5a')](function(_0xec8c71){return _0x3aa3aa[_0xf9b0('0x53')](_0x34fc49,{'transaction':_0xec8c71})[_0xf9b0('0x17')](function(){return BPromise[_0xf9b0('0x5b')](_0x121523,function(_0x3356b7){return db[_0xf9b0('0x3f')]['findOrCreate']({'where':{'UserId':_0x3356b7['id'],'MailQueueId':_0x34c27e[_0xf9b0('0x2a')]['id']},'transaction':_0xec8c71});});})[_0xf9b0('0x17')](function(){_0x121523[_0xf9b0('0x5c')](function(_0x3abbb1){socket[_0xf9b0('0x5d')](_0xf9b0('0x5e'),{'UserId':_0x3abbb1['id'],'MailQueueId':_0x3aa3aa['id']});});});});});}})[_0xf9b0('0x17')](respondWithStatusCode(_0x33ccf7,null))[_0xf9b0('0x29')](handleError(_0x33ccf7,null));};exports[_0xf9b0('0x5f')]=function(_0x981d27,_0x4d8feb){return db[_0xf9b0('0x51')]['findAll']({'where':{'id':_0x981d27[_0xf9b0('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf9b0('0x48')],'as':_0xf9b0('0x55'),'attributes':['id'],'raw':!![]}]})[_0xf9b0('0x17')](handleEntityNotFound(_0x4d8feb,null))[_0xf9b0('0x17')](function(_0x2d1b39){var _0x3d4e7b=_[_0xf9b0('0x1f')](_0x2d1b39,'id');var _0x5e6d41=[];var _0x547deb=[];var _0x24d2f1=squel['select']();_0x24d2f1[_0xf9b0('0x60')](_0xf9b0('0x61'))[_0xf9b0('0x62')]('team_has_mail_queues','tq')['join'](_0xf9b0('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf9b0('0x23')]('MailQueueId\x20=\x20?',_0x981d27[_0xf9b0('0x2a')]['id']);for(var _0x493fae=0x0;_0x493fae<_0x2d1b39[_0xf9b0('0x2f')];_0x493fae+=0x1){let _0x16a42d=_0x2d1b39[_0x493fae];for(var _0x239916=0x0;_0x239916<_0x16a42d[_0xf9b0('0x55')][_0xf9b0('0x2f')];_0x239916+=0x1){let _0x242d20=_0x16a42d['Agents'][_0x239916];var _0x5e9a73=_0x24d2f1[_0xf9b0('0x64')]();_0x5e9a73[_0xf9b0('0x23')](_0xf9b0('0x65'),_0x242d20['id']);_0x547deb[_0xf9b0('0x66')](db['sequelize'][_0xf9b0('0x26')](_0x5e9a73[_0xf9b0('0x67')](),{'type':db[_0xf9b0('0x59')][_0xf9b0('0x68')][_0xf9b0('0x69')]})['then'](function(_0x2b89e9){if(_0x2b89e9[_0xf9b0('0x2f')]===0x1){return _0x242d20['id'];}else{var _0x3ab149=_[_0xf9b0('0x6a')](_[_0xf9b0('0x1f')](_0x2b89e9,'TeamId'),function(_0x44de90){return _[_0xf9b0('0x6b')](_0x3d4e7b,_0x44de90);});if(_0x3ab149){return _0x242d20['id'];}}}));}}return BPromise['all'](_0x547deb)[_0xf9b0('0x17')](function(_0x1ed1b0){_0x5e6d41=_(_0x5e6d41)[_0xf9b0('0x6c')](_0x1ed1b0)['compact']()[_0xf9b0('0x6d')]();return db[_0xf9b0('0x20')][_0xf9b0('0x33')]({'where':{'id':_0x981d27[_0xf9b0('0x2a')]['id']}})[_0xf9b0('0x17')](function(_0x458c62){return db[_0xf9b0('0x59')][_0xf9b0('0x5a')](function(_0x3821d2){return _0x458c62['removeTeams'](_0x981d27[_0xf9b0('0x26')][_0xf9b0('0x54')],{'transaction':_0x3821d2})[_0xf9b0('0x17')](function(){if(!_[_0xf9b0('0x6e')](_0x5e6d41)){return _0x458c62[_0xf9b0('0x6f')](_0x5e6d41,{'transaction':_0x3821d2});}})[_0xf9b0('0x17')](function(){_0x5e6d41[_0xf9b0('0x5c')](function(_0x4069e3){socket[_0xf9b0('0x5d')]('userMailQueue:remove',{'UserId':_0x4069e3,'MailQueueId':_0x458c62['id']});});});});});});})[_0xf9b0('0x17')](respondWithStatusCode(_0x4d8feb,null))[_0xf9b0('0x29')](handleError(_0x4d8feb,null));};exports[_0xf9b0('0x70')]=function(_0x4f2434,_0x4fdcd9){return db['MailQueue'][_0xf9b0('0x33')]({'where':{'id':_0x4f2434[_0xf9b0('0x2a')]['id']}})[_0xf9b0('0x17')](handleEntityNotFound(_0x4fdcd9,null))[_0xf9b0('0x17')](function(_0x9656e2){if(_0x9656e2){return _0x9656e2[_0xf9b0('0x70')](_0x4f2434[_0xf9b0('0x35')][_0xf9b0('0x54')],_[_0xf9b0('0x71')](_0x4f2434[_0xf9b0('0x35')],['ids','id'])||{})[_0xf9b0('0x72')](function(_0x2f2947){for(var _0x3411a7=0x0;_0x3411a7<_0x4f2434[_0xf9b0('0x35')]['ids']['length'];_0x3411a7+=0x1){socket[_0xf9b0('0x5d')](_0xf9b0('0x5e'),{'UserId':Number(_0x4f2434[_0xf9b0('0x35')][_0xf9b0('0x54')][_0x3411a7]),'MailQueueId':Number(_0x4f2434[_0xf9b0('0x2a')]['id'])});}return _0x2f2947;});}})[_0xf9b0('0x17')](respondWithResult(_0x4fdcd9,null))[_0xf9b0('0x29')](handleError(_0x4fdcd9,null));};exports[_0xf9b0('0x6f')]=function(_0x242fec,_0x2b2619){return db[_0xf9b0('0x20')][_0xf9b0('0x33')]({'where':{'id':_0x242fec['params']['id']}})[_0xf9b0('0x17')](handleEntityNotFound(_0x2b2619,null))['then'](function(_0x190431){if(_0x190431){return _0x190431['removeAgents'](_0x242fec[_0xf9b0('0x26')]['ids'])[_0xf9b0('0x17')](function(){if(_[_0xf9b0('0x73')](_0x242fec['query']['ids'])){for(var _0x163f7e=0x0;_0x163f7e<_0x242fec[_0xf9b0('0x26')][_0xf9b0('0x54')][_0xf9b0('0x2f')];_0x163f7e+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x242fec[_0xf9b0('0x26')]['ids'][_0x163f7e]),'MailQueueId':Number(_0x242fec[_0xf9b0('0x2a')]['id'])});}}else{socket['emit'](_0xf9b0('0x74'),{'UserId':Number(_0x242fec[_0xf9b0('0x26')][_0xf9b0('0x54')]),'MailQueueId':Number(_0x242fec[_0xf9b0('0x2a')]['id'])});}});}})[_0xf9b0('0x17')](respondWithStatusCode(_0x2b2619,null))[_0xf9b0('0x29')](handleError(_0x2b2619,null));};exports[_0xf9b0('0x75')]=function(_0x3fe53a,_0x2e58ce){var _0x3c34f0={};var _0x423de3={};var _0x4d915f;var _0x3a7dbb;return db[_0xf9b0('0x20')][_0xf9b0('0x76')]({'where':{'id':_0x3fe53a[_0xf9b0('0x2a')]['id']}})[_0xf9b0('0x17')](handleEntityNotFound(_0x2e58ce,null))[_0xf9b0('0x17')](function(_0x3fc20b){if(_0x3fc20b){_0x4d915f=_0x3fc20b;_0x423de3['model']=_[_0xf9b0('0x2b')](db['User'][_0xf9b0('0x21')]);_0x423de3[_0xf9b0('0x26')]=_[_0xf9b0('0x2b')](_0x3fe53a[_0xf9b0('0x26')]);_0x423de3[_0xf9b0('0x40')]=_[_0xf9b0('0x41')](_0x423de3['model'],_0x423de3[_0xf9b0('0x26')]);_0x3c34f0[_0xf9b0('0x2d')]=_['intersection'](_0x423de3[_0xf9b0('0x2c')],qs[_0xf9b0('0x2e')](_0x3fe53a[_0xf9b0('0x26')][_0xf9b0('0x2e')]));_0x3c34f0[_0xf9b0('0x2d')]=_0x3c34f0['attributes'][_0xf9b0('0x2f')]?_0x3c34f0[_0xf9b0('0x2d')]:_0x423de3[_0xf9b0('0x2c')];_0x3c34f0[_0xf9b0('0x43')]=qs[_0xf9b0('0x44')](_0x3fe53a[_0xf9b0('0x26')]['sort']);_0x3c34f0[_0xf9b0('0x23')]=qs[_0xf9b0('0x40')](_[_0xf9b0('0x45')](_0x3fe53a['query'],_0x423de3[_0xf9b0('0x40')]));if(_0x3fe53a[_0xf9b0('0x26')][_0xf9b0('0x47')]){_0x3c34f0[_0xf9b0('0x23')]=_[_0xf9b0('0x31')](_0x3c34f0['where'],{'$or':_[_0xf9b0('0x1f')](_0x3c34f0[_0xf9b0('0x2d')],function(_0x3d58dc){var _0x4910c0={};_0x4910c0[_0x3d58dc]={'$like':'%'+_0x3fe53a[_0xf9b0('0x26')]['filter']+'%'};return _0x4910c0;})});}_0x3c34f0=_[_0xf9b0('0x31')]({},_0x3c34f0,_0x3fe53a[_0xf9b0('0x32')]);return _0x4d915f[_0xf9b0('0x75')](_0x3c34f0);}})[_0xf9b0('0x17')](function(_0xb82b73){if(_0xb82b73){_0x3a7dbb=_0xb82b73[_0xf9b0('0x2f')];if(!_0x3fe53a['query']['hasOwnProperty']('nolimit')){_0x3c34f0[_0xf9b0('0x12')]=qs[_0xf9b0('0x12')](_0x3fe53a['query'][_0xf9b0('0x12')]);_0x3c34f0[_0xf9b0('0x10')]=qs[_0xf9b0('0x10')](_0x3fe53a[_0xf9b0('0x26')][_0xf9b0('0x10')]);}return _0x4d915f[_0xf9b0('0x75')](_0x3c34f0);}})['then'](function(_0x2c8192){if(_0x2c8192){return _0x2c8192?{'count':_0x3a7dbb,'rows':_0x2c8192}:null;}})[_0xf9b0('0x17')](respondWithResult(_0x2e58ce,null))['catch'](handleError(_0x2e58ce,null));}; \ No newline at end of file +var _0xedd3=['lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./mailQueue.socket','sendStatus','end','json','offset','undefined','count','status','set','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','getOptions','where','include','query','findAll','rows','catch','show','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','body','role','user','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','findOne','nolimit','limit','order','sort','pick','filter','UserMailQueue','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','getTeams','hasOwnProperty','addTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','removeTeams','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xedd3,0x74));var _0x3edd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xedd3[_0x167cc1];return _0x10bc4b;};'use strict';var BPromise=require(_0x3edd('0x0'));var util=require(_0x3edd('0x1'));var _=require(_0x3edd('0x2'));var squel=require(_0x3edd('0x3'));var Redis=require(_0x3edd('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x3edd('0x5'))(_0x3edd('0x6'));var config=require(_0x3edd('0x7'));var db=require('../../mysqldb')['db'];config[_0x3edd('0x8')]=_[_0x3edd('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3edd('0xa'))(new Redis(config[_0x3edd('0x8')]));require(_0x3edd('0xb'))['register'](socket);function respondWithStatusCode(_0x3d4035,_0x113893){_0x113893=_0x113893||0xcc;return function(_0x44741d){if(_0x44741d){return _0x3d4035[_0x3edd('0xc')](_0x113893);}return _0x3d4035['status'](_0x113893)[_0x3edd('0xd')]();};}function respondWithResult(_0x327341,_0x16aa03){_0x16aa03=_0x16aa03||0xc8;return function(_0x467255){if(_0x467255){return _0x327341['status'](_0x16aa03)[_0x3edd('0xe')](_0x467255);}};}function respondWithFilteredResult(_0x2ab012,_0x3f25fd){return function(_0x27fdd9){if(_0x27fdd9){var _0x1f28bd=typeof _0x3f25fd[_0x3edd('0xf')]===_0x3edd('0x10')&&typeof _0x3f25fd['limit']==='undefined';var _0x433d3c=_0x27fdd9[_0x3edd('0x11')];var _0x4a6587=_0x1f28bd?0x0:_0x3f25fd[_0x3edd('0xf')];var _0x4b67d7=_0x1f28bd?_0x27fdd9['count']:_0x3f25fd[_0x3edd('0xf')]+_0x3f25fd['limit'];var _0x4a29f6;if(_0x4b67d7>=_0x433d3c){_0x4b67d7=_0x433d3c;_0x4a29f6=0xc8;}else{_0x4a29f6=0xce;}_0x2ab012[_0x3edd('0x12')](_0x4a29f6);return _0x2ab012[_0x3edd('0x13')]('Content-Range',_0x4a6587+'-'+_0x4b67d7+'/'+_0x433d3c)[_0x3edd('0xe')](_0x27fdd9);}return null;};}function saveUpdates(_0x5c7556){return function(_0x57beb3){if(_0x57beb3){return _0x57beb3[_0x3edd('0x14')](_0x5c7556)[_0x3edd('0x15')](function(_0x87da07){return _0x87da07;});}return null;};}function removeEntity(_0x314da6){return function(_0x3bd341){if(_0x3bd341){return _0x3bd341[_0x3edd('0x16')]()[_0x3edd('0x15')](function(){var _0x1a14f7=_0x3bd341[_0x3edd('0x17')]({'plain':!![]});var _0x2ec717='MailQueues';return db[_0x3edd('0x18')]['destroy']({'where':{'type':_0x2ec717,'resourceId':_0x1a14f7['id']}})['then'](function(){return _0x3bd341;});})['then'](function(){_0x314da6[_0x3edd('0x12')](0xcc)[_0x3edd('0xd')]();});}};}function handleEntityNotFound(_0x43c5ce){return function(_0x2e23c9){if(!_0x2e23c9){_0x43c5ce['sendStatus'](0x194);}return _0x2e23c9;};}function handleError(_0x7d3b2b,_0x5f3aa9){_0x5f3aa9=_0x5f3aa9||0x1f4;return function(_0x458c9b){logger[_0x3edd('0x19')](_0x458c9b[_0x3edd('0x1a')]);if(_0x458c9b[_0x3edd('0x1b')]){delete _0x458c9b[_0x3edd('0x1b')];}_0x7d3b2b['status'](_0x5f3aa9)['send'](_0x458c9b);};}exports[_0x3edd('0x1c')]=function(_0x36c85c,_0x16827d){var _0x22305c={};var _0x247b96={'count':0x0,'rows':[]};var _0x21433b=_[_0x3edd('0x1d')](db[_0x3edd('0x1e')][_0x3edd('0x1f')],function(_0x12f152){return{'name':_0x12f152[_0x3edd('0x20')],'type':_0x12f152[_0x3edd('0x21')]['key']};});_0x22305c=qs[_0x3edd('0x22')](_0x21433b,_0x36c85c);var _0x538a47={'where':_0x22305c[_0x3edd('0x23')]};return db[_0x3edd('0x1e')][_0x3edd('0x11')](_0x538a47)[_0x3edd('0x15')](function(_0x338760){_0x247b96[_0x3edd('0x11')]=_0x338760;_0x22305c[_0x3edd('0x24')]=qs[_0x3edd('0x24')](_0x36c85c[_0x3edd('0x25')]);return db[_0x3edd('0x1e')][_0x3edd('0x26')](_0x22305c);})[_0x3edd('0x15')](function(_0x4ad8e2){_0x247b96[_0x3edd('0x27')]=_0x4ad8e2;return _0x247b96;})[_0x3edd('0x15')](respondWithFilteredResult(_0x16827d,_0x22305c))[_0x3edd('0x28')](handleError(_0x16827d,null));};exports[_0x3edd('0x29')]=function(_0x264b0f,_0x5ef4cf){var _0x52e4bb={'raw':!![],'where':{'id':_0x264b0f['params']['id']}},_0x501cd5={};_0x501cd5['model']=_[_0x3edd('0x2a')](db['MailQueue'][_0x3edd('0x1f')]);_0x501cd5[_0x3edd('0x25')]=_[_0x3edd('0x2a')](_0x264b0f['query']);_0x501cd5[_0x3edd('0x2b')]=_[_0x3edd('0x2c')](_0x501cd5[_0x3edd('0x2d')],_0x501cd5[_0x3edd('0x25')]);_0x52e4bb[_0x3edd('0x2e')]=_['intersection'](_0x501cd5['model'],qs[_0x3edd('0x2f')](_0x264b0f[_0x3edd('0x25')][_0x3edd('0x2f')]));_0x52e4bb[_0x3edd('0x2e')]=_0x52e4bb['attributes'][_0x3edd('0x30')]?_0x52e4bb[_0x3edd('0x2e')]:_0x501cd5[_0x3edd('0x2d')];if(_0x264b0f['query'][_0x3edd('0x31')]){_0x52e4bb['include']=[{'all':!![]}];}_0x52e4bb=_[_0x3edd('0x32')]({},_0x52e4bb,_0x264b0f[_0x3edd('0x33')]);return db[_0x3edd('0x1e')]['find'](_0x52e4bb)['then'](handleEntityNotFound(_0x5ef4cf,null))[_0x3edd('0x15')](respondWithResult(_0x5ef4cf,null))[_0x3edd('0x28')](handleError(_0x5ef4cf,null));};exports['create']=function(_0x5a065c,_0x1c078b){return db[_0x3edd('0x1e')]['create'](_0x5a065c[_0x3edd('0x34')],{})[_0x3edd('0x15')](function(_0x4e7e03){var _0x5efc9b=_0x5a065c['user'][_0x3edd('0x17')]({'plain':!![]});if(!_0x5efc9b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5efc9b[_0x3edd('0x35')]===_0x3edd('0x36')){var _0x39c418=_0x4e7e03[_0x3edd('0x17')]({'plain':!![]});var _0x5405f5='MailQueues';return db[_0x3edd('0x37')]['find']({'where':{'name':_0x5405f5,'userProfileId':_0x5efc9b['userProfileId']},'raw':!![]})[_0x3edd('0x15')](function(_0xec9e3d){if(_0xec9e3d&&_0xec9e3d['autoAssociation']===0x0){return db[_0x3edd('0x18')][_0x3edd('0x38')]({'name':_0x39c418[_0x3edd('0x1b')],'resourceId':_0x39c418['id'],'type':_0xec9e3d[_0x3edd('0x1b')],'sectionId':_0xec9e3d['id']},{})[_0x3edd('0x15')](function(){return _0x4e7e03;});}else{return _0x4e7e03;}})[_0x3edd('0x28')](function(_0x2abc10){logger['error'](_0x3edd('0x39'),_0x2abc10);throw _0x2abc10;});}return _0x4e7e03;})['then'](respondWithResult(_0x1c078b,0xc9))[_0x3edd('0x28')](handleError(_0x1c078b,null));};exports[_0x3edd('0x14')]=function(_0x217425,_0x2b82c9){if(_0x217425['body']['id']){delete _0x217425[_0x3edd('0x34')]['id'];}return db[_0x3edd('0x1e')]['find']({'where':{'id':_0x217425['params']['id']}})['then'](handleEntityNotFound(_0x2b82c9,null))[_0x3edd('0x15')](saveUpdates(_0x217425[_0x3edd('0x34')],null))[_0x3edd('0x15')](respondWithResult(_0x2b82c9,null))[_0x3edd('0x28')](handleError(_0x2b82c9,null));};exports[_0x3edd('0x16')]=function(_0x37506f,_0x2b6558){return db[_0x3edd('0x1e')][_0x3edd('0x3a')]({'where':{'id':_0x37506f[_0x3edd('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2b6558,null))[_0x3edd('0x15')](removeEntity(_0x2b6558,null))['catch'](handleError(_0x2b6558,null));};exports[_0x3edd('0x3c')]=function(_0x46a813,_0x356db5){return db[_0x3edd('0x1e')]['describe']()[_0x3edd('0x15')](respondWithResult(_0x356db5,null))['catch'](handleError(_0x356db5,null));};exports['getMembers']=function(_0x4f3cd2,_0x497efa){var _0x5eb9b4={'raw':!![],'where':{}},_0x58ab2d={},_0x44e8fd;return db[_0x3edd('0x1e')][_0x3edd('0x3d')]({'where':{'id':_0x4f3cd2[_0x3edd('0x3b')]['id']}})[_0x3edd('0x15')](handleEntityNotFound(_0x497efa,null))['then'](function(_0x380979){if(_0x380979){_0x44e8fd=_0x380979[_0x3edd('0x17')]({'plain':!![]});_0x58ab2d[_0x3edd('0x2d')]=_[_0x3edd('0x2a')](db['UserMailQueue']['rawAttributes']);_0x58ab2d['query']=_['keys'](_0x4f3cd2[_0x3edd('0x25')]);_0x58ab2d[_0x3edd('0x2b')]=_[_0x3edd('0x2c')](_0x58ab2d[_0x3edd('0x2d')],_0x58ab2d[_0x3edd('0x25')]);_0x5eb9b4[_0x3edd('0x2e')]=_[_0x3edd('0x2c')](_0x58ab2d[_0x3edd('0x2d')],qs[_0x3edd('0x2f')](_0x4f3cd2[_0x3edd('0x25')][_0x3edd('0x2f')]));_0x5eb9b4[_0x3edd('0x2e')]=_0x5eb9b4[_0x3edd('0x2e')][_0x3edd('0x30')]?_0x5eb9b4[_0x3edd('0x2e')]:_0x58ab2d['model'];if(!_0x4f3cd2[_0x3edd('0x25')]['hasOwnProperty'](_0x3edd('0x3e'))){_0x5eb9b4[_0x3edd('0x3f')]=qs[_0x3edd('0x3f')](_0x4f3cd2[_0x3edd('0x25')][_0x3edd('0x3f')]);_0x5eb9b4[_0x3edd('0xf')]=qs['offset'](_0x4f3cd2[_0x3edd('0x25')][_0x3edd('0xf')]);}_0x5eb9b4[_0x3edd('0x40')]=qs['sort'](_0x4f3cd2['query'][_0x3edd('0x41')]);_0x5eb9b4[_0x3edd('0x23')]=qs[_0x3edd('0x2b')](_[_0x3edd('0x42')](_0x4f3cd2[_0x3edd('0x25')],_0x58ab2d[_0x3edd('0x2b')]));_0x5eb9b4['where']['MailQueueId']=_0x380979['id'];if(_0x4f3cd2[_0x3edd('0x25')][_0x3edd('0x43')]){_0x5eb9b4[_0x3edd('0x23')]=_[_0x3edd('0x32')](_0x5eb9b4['where'],{'$or':_[_0x3edd('0x1d')](_0x5eb9b4[_0x3edd('0x2e')],function(_0x2907c9){var _0x555fb9={};_0x555fb9[_0x2907c9]={'$like':'%'+_0x4f3cd2[_0x3edd('0x25')][_0x3edd('0x43')]+'%'};return _0x555fb9;})});}_0x5eb9b4=_[_0x3edd('0x32')]({},_0x5eb9b4,_0x4f3cd2[_0x3edd('0x33')]);return db[_0x3edd('0x44')]['findAll'](_0x5eb9b4);}})[_0x3edd('0x15')](function(_0x11183e){if(_0x11183e){return db['User'][_0x3edd('0x45')]({'where':{'id':_[_0x3edd('0x1d')](_0x11183e,_0x3edd('0x46')),'role':_0x3edd('0x47')},'attributes':['id',_0x3edd('0x1b'),_0x3edd('0x48'),'updatedAt',_0x3edd('0x49')]});}})['then'](function(_0x56a7f4){if(_0x56a7f4){return{'count':_0x56a7f4[_0x3edd('0x11')],'rows':_[_0x3edd('0x1d')](_0x56a7f4['rows'],function(_0x129d40){return{'membername':_0x129d40[_0x3edd('0x1b')],'UserId':_0x129d40['id'],'queue_name':_0x44e8fd['name'],'MailQueueId':_0x44e8fd['id'],'interface':util[_0x3edd('0x4a')](_0x3edd('0x4b'),_0x3edd('0x4c'),_0x129d40['name']),'penalty':0x0,'paused':_0x129d40['mailPause'],'createdAt':_0x129d40[_0x3edd('0x49')],'updatedAt':_0x129d40['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3edd('0x15')](respondWithFilteredResult(_0x497efa,_0x5eb9b4))[_0x3edd('0x28')](handleError(_0x497efa,null));};exports[_0x3edd('0x4d')]=function(_0x34cbcf,_0xbac34e){var _0x3b3043={};var _0xfe3420={};var _0x2bc3b4;var _0x44c908;return db[_0x3edd('0x1e')]['findOne']({'where':{'id':_0x34cbcf[_0x3edd('0x3b')]['id']}})[_0x3edd('0x15')](handleEntityNotFound(_0xbac34e,null))[_0x3edd('0x15')](function(_0x151f17){if(_0x151f17){_0x2bc3b4=_0x151f17;_0xfe3420['model']=_[_0x3edd('0x2a')](db['Team'][_0x3edd('0x1f')]);_0xfe3420['query']=_['keys'](_0x34cbcf['query']);_0xfe3420[_0x3edd('0x2b')]=_['intersection'](_0xfe3420[_0x3edd('0x2d')],_0xfe3420[_0x3edd('0x25')]);_0x3b3043[_0x3edd('0x2e')]=_[_0x3edd('0x2c')](_0xfe3420['model'],qs['fields'](_0x34cbcf[_0x3edd('0x25')][_0x3edd('0x2f')]));_0x3b3043[_0x3edd('0x2e')]=_0x3b3043[_0x3edd('0x2e')][_0x3edd('0x30')]?_0x3b3043[_0x3edd('0x2e')]:_0xfe3420[_0x3edd('0x2d')];_0x3b3043[_0x3edd('0x40')]=qs[_0x3edd('0x41')](_0x34cbcf[_0x3edd('0x25')][_0x3edd('0x41')]);_0x3b3043[_0x3edd('0x23')]=qs[_0x3edd('0x2b')](_['pick'](_0x34cbcf[_0x3edd('0x25')],_0xfe3420['filters']));if(_0x34cbcf[_0x3edd('0x25')][_0x3edd('0x43')]){_0x3b3043['where']=_[_0x3edd('0x32')](_0x3b3043[_0x3edd('0x23')],{'$or':_['map'](_0x3b3043[_0x3edd('0x2e')],function(_0x241823){var _0x116ef4={};_0x116ef4[_0x241823]={'$like':'%'+_0x34cbcf['query'][_0x3edd('0x43')]+'%'};return _0x116ef4;})});}_0x3b3043=_[_0x3edd('0x32')]({},_0x3b3043,_0x34cbcf[_0x3edd('0x33')]);return _0x2bc3b4[_0x3edd('0x4d')](_0x3b3043);}})['then'](function(_0x4e4613){if(_0x4e4613){_0x44c908=_0x4e4613[_0x3edd('0x30')];if(!_0x34cbcf['query'][_0x3edd('0x4e')](_0x3edd('0x3e'))){_0x3b3043[_0x3edd('0x3f')]=qs[_0x3edd('0x3f')](_0x34cbcf[_0x3edd('0x25')][_0x3edd('0x3f')]);_0x3b3043[_0x3edd('0xf')]=qs[_0x3edd('0xf')](_0x34cbcf[_0x3edd('0x25')]['offset']);}return _0x2bc3b4['getTeams'](_0x3b3043);}})[_0x3edd('0x15')](function(_0x150672){if(_0x150672){return _0x150672?{'count':_0x44c908,'rows':_0x150672}:null;}})[_0x3edd('0x15')](respondWithResult(_0xbac34e,null))['catch'](handleError(_0xbac34e,null));};exports[_0x3edd('0x4f')]=function(_0x5b5a0e,_0x1ad5fb){var _0x99c3c9=_0x5b5a0e[_0x3edd('0x34')][_0x3edd('0x50')];return db[_0x3edd('0x51')]['findAll']({'where':{'id':_0x99c3c9},'attributes':['id'],'include':[{'model':db[_0x3edd('0x52')],'as':_0x3edd('0x53'),'attributes':['id',_0x3edd('0x1b'),_0x3edd('0x54'),_0x3edd('0x55'),_0x3edd('0x56')],'raw':!![]}]})['then'](function(_0xd325de){if(_0xd325de){var _0x4382eb=_[_0x3edd('0x57')](_0xd325de,function(_0x636dfb){var _0x5e7b2d=_0x636dfb[_0x3edd('0x17')]({'plain':!![]});return _0x5e7b2d[_0x3edd('0x53')];});return db[_0x3edd('0x1e')][_0x3edd('0x3a')]({'where':{'id':_0x5b5a0e[_0x3edd('0x3b')]['id']}})[_0x3edd('0x15')](function(_0x54308d){return db[_0x3edd('0x58')][_0x3edd('0x59')](function(_0x5101b1){return _0x54308d[_0x3edd('0x4f')](_0x99c3c9,{'transaction':_0x5101b1})[_0x3edd('0x15')](function(){return BPromise['each'](_0x4382eb,function(_0x4663ce){return db[_0x3edd('0x44')][_0x3edd('0x5a')]({'where':{'UserId':_0x4663ce['id'],'MailQueueId':_0x5b5a0e['params']['id']},'transaction':_0x5101b1});});})[_0x3edd('0x15')](function(){_0x4382eb['forEach'](function(_0x3cb28a){socket[_0x3edd('0x5b')]('userMailQueue:save',{'UserId':_0x3cb28a['id'],'MailQueueId':_0x54308d['id']});});});});});}})['then'](respondWithStatusCode(_0x1ad5fb,null))[_0x3edd('0x28')](handleError(_0x1ad5fb,null));};exports[_0x3edd('0x5c')]=function(_0x51af86,_0x43babd){return db[_0x3edd('0x51')]['findAll']({'where':{'id':_0x51af86[_0x3edd('0x25')][_0x3edd('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3edd('0x15')](handleEntityNotFound(_0x43babd,null))[_0x3edd('0x15')](function(_0x284b1f){var _0x3ca6f6=_['map'](_0x284b1f,'id');var _0x327ca8=[];var _0x11353c=[];var _0x1b5e81=squel['select']();_0x1b5e81[_0x3edd('0x5d')](_0x3edd('0x5e'))[_0x3edd('0x5f')](_0x3edd('0x60'),'tq')[_0x3edd('0x61')]('user_has_teams','ut',_0x3edd('0x62'))[_0x3edd('0x23')]('MailQueueId\x20=\x20?',_0x51af86[_0x3edd('0x3b')]['id']);for(var _0x598554=0x0;_0x598554<_0x284b1f['length'];_0x598554+=0x1){let _0xa4e22e=_0x284b1f[_0x598554];for(var _0x3a1258=0x0;_0x3a1258<_0xa4e22e[_0x3edd('0x53')][_0x3edd('0x30')];_0x3a1258+=0x1){let _0x3edf17=_0xa4e22e[_0x3edd('0x53')][_0x3a1258];var _0x3f597f=_0x1b5e81['clone']();_0x3f597f[_0x3edd('0x23')](_0x3edd('0x63'),_0x3edf17['id']);_0x11353c[_0x3edd('0x64')](db[_0x3edd('0x58')]['query'](_0x3f597f[_0x3edd('0x65')](),{'type':db[_0x3edd('0x58')][_0x3edd('0x66')][_0x3edd('0x67')]})[_0x3edd('0x15')](function(_0x3ffc26){if(_0x3ffc26[_0x3edd('0x30')]===0x1){return _0x3edf17['id'];}else{var _0x5c716f=_[_0x3edd('0x68')](_[_0x3edd('0x1d')](_0x3ffc26,_0x3edd('0x69')),function(_0x2bec27){return _['includes'](_0x3ca6f6,_0x2bec27);});if(_0x5c716f){return _0x3edf17['id'];}}}));}}return BPromise[_0x3edd('0x6a')](_0x11353c)[_0x3edd('0x15')](function(_0x406fb2){_0x327ca8=_(_0x327ca8)[_0x3edd('0x6b')](_0x406fb2)[_0x3edd('0x6c')]()[_0x3edd('0x6d')]();return db['MailQueue'][_0x3edd('0x3a')]({'where':{'id':_0x51af86[_0x3edd('0x3b')]['id']}})[_0x3edd('0x15')](function(_0x1d8d77){return db[_0x3edd('0x58')][_0x3edd('0x59')](function(_0x5b264a){return _0x1d8d77[_0x3edd('0x5c')](_0x51af86[_0x3edd('0x25')][_0x3edd('0x50')],{'transaction':_0x5b264a})['then'](function(){if(!_[_0x3edd('0x6e')](_0x327ca8)){return _0x1d8d77[_0x3edd('0x6f')](_0x327ca8,{'transaction':_0x5b264a});}})['then'](function(){_0x327ca8[_0x3edd('0x70')](function(_0x361a0e){socket[_0x3edd('0x5b')](_0x3edd('0x71'),{'UserId':_0x361a0e,'MailQueueId':_0x1d8d77['id']});});});});});});})[_0x3edd('0x15')](respondWithStatusCode(_0x43babd,null))[_0x3edd('0x28')](handleError(_0x43babd,null));};exports['addAgents']=function(_0x5d6977,_0x121ef7){return db[_0x3edd('0x1e')][_0x3edd('0x3a')]({'where':{'id':_0x5d6977['params']['id']}})[_0x3edd('0x15')](handleEntityNotFound(_0x121ef7,null))[_0x3edd('0x15')](function(_0xdfb12){if(_0xdfb12){return _0xdfb12[_0x3edd('0x72')](_0x5d6977[_0x3edd('0x34')][_0x3edd('0x50')],_[_0x3edd('0x73')](_0x5d6977[_0x3edd('0x34')],[_0x3edd('0x50'),'id'])||{})['spread'](function(_0xa7de0c){for(var _0x250b37=0x0;_0x250b37<_0x5d6977[_0x3edd('0x34')][_0x3edd('0x50')][_0x3edd('0x30')];_0x250b37+=0x1){socket[_0x3edd('0x5b')]('userMailQueue:save',{'UserId':Number(_0x5d6977[_0x3edd('0x34')][_0x3edd('0x50')][_0x250b37]),'MailQueueId':Number(_0x5d6977[_0x3edd('0x3b')]['id'])});}return _0xa7de0c;});}})['then'](respondWithResult(_0x121ef7,null))[_0x3edd('0x28')](handleError(_0x121ef7,null));};exports[_0x3edd('0x6f')]=function(_0x184d87,_0x21f81f){return db[_0x3edd('0x1e')][_0x3edd('0x3a')]({'where':{'id':_0x184d87[_0x3edd('0x3b')]['id']}})[_0x3edd('0x15')](handleEntityNotFound(_0x21f81f,null))[_0x3edd('0x15')](function(_0x55c4d){if(_0x55c4d){return _0x55c4d[_0x3edd('0x6f')](_0x184d87[_0x3edd('0x25')]['ids'])['then'](function(){if(_[_0x3edd('0x74')](_0x184d87[_0x3edd('0x25')][_0x3edd('0x50')])){for(var _0x85d427=0x0;_0x85d427<_0x184d87[_0x3edd('0x25')][_0x3edd('0x50')][_0x3edd('0x30')];_0x85d427+=0x1){socket['emit'](_0x3edd('0x71'),{'UserId':Number(_0x184d87[_0x3edd('0x25')][_0x3edd('0x50')][_0x85d427]),'MailQueueId':Number(_0x184d87[_0x3edd('0x3b')]['id'])});}}else{socket[_0x3edd('0x5b')](_0x3edd('0x71'),{'UserId':Number(_0x184d87['query'][_0x3edd('0x50')]),'MailQueueId':Number(_0x184d87[_0x3edd('0x3b')]['id'])});}});}})['then'](respondWithStatusCode(_0x21f81f,null))['catch'](handleError(_0x21f81f,null));};exports[_0x3edd('0x75')]=function(_0x3a0fcc,_0x5a82a3){var _0x49a2f7={};var _0x11d8f0={};var _0x561f1a;var _0x4d96cc;return db['MailQueue'][_0x3edd('0x3d')]({'where':{'id':_0x3a0fcc[_0x3edd('0x3b')]['id']}})[_0x3edd('0x15')](handleEntityNotFound(_0x5a82a3,null))[_0x3edd('0x15')](function(_0x2cce68){if(_0x2cce68){_0x561f1a=_0x2cce68;_0x11d8f0[_0x3edd('0x2d')]=_[_0x3edd('0x2a')](db[_0x3edd('0x52')][_0x3edd('0x1f')]);_0x11d8f0['query']=_[_0x3edd('0x2a')](_0x3a0fcc[_0x3edd('0x25')]);_0x11d8f0['filters']=_[_0x3edd('0x2c')](_0x11d8f0['model'],_0x11d8f0[_0x3edd('0x25')]);_0x49a2f7[_0x3edd('0x2e')]=_[_0x3edd('0x2c')](_0x11d8f0['model'],qs[_0x3edd('0x2f')](_0x3a0fcc[_0x3edd('0x25')][_0x3edd('0x2f')]));_0x49a2f7[_0x3edd('0x2e')]=_0x49a2f7[_0x3edd('0x2e')][_0x3edd('0x30')]?_0x49a2f7[_0x3edd('0x2e')]:_0x11d8f0[_0x3edd('0x2d')];_0x49a2f7['order']=qs['sort'](_0x3a0fcc[_0x3edd('0x25')][_0x3edd('0x41')]);_0x49a2f7['where']=qs[_0x3edd('0x2b')](_['pick'](_0x3a0fcc['query'],_0x11d8f0[_0x3edd('0x2b')]));if(_0x3a0fcc[_0x3edd('0x25')]['filter']){_0x49a2f7[_0x3edd('0x23')]=_['merge'](_0x49a2f7[_0x3edd('0x23')],{'$or':_[_0x3edd('0x1d')](_0x49a2f7['attributes'],function(_0x30037a){var _0xbacb59={};_0xbacb59[_0x30037a]={'$like':'%'+_0x3a0fcc[_0x3edd('0x25')]['filter']+'%'};return _0xbacb59;})});}_0x49a2f7=_['merge']({},_0x49a2f7,_0x3a0fcc[_0x3edd('0x33')]);return _0x561f1a[_0x3edd('0x75')](_0x49a2f7);}})[_0x3edd('0x15')](function(_0x43902d){if(_0x43902d){_0x4d96cc=_0x43902d[_0x3edd('0x30')];if(!_0x3a0fcc[_0x3edd('0x25')]['hasOwnProperty'](_0x3edd('0x3e'))){_0x49a2f7[_0x3edd('0x3f')]=qs['limit'](_0x3a0fcc[_0x3edd('0x25')][_0x3edd('0x3f')]);_0x49a2f7[_0x3edd('0xf')]=qs[_0x3edd('0xf')](_0x3a0fcc[_0x3edd('0x25')][_0x3edd('0xf')]);}return _0x561f1a[_0x3edd('0x75')](_0x49a2f7);}})['then'](function(_0x11ebb5){if(_0x11ebb5){return _0x11ebb5?{'count':_0x4d96cc,'rows':_0x11ebb5}:null;}})[_0x3edd('0x15')](respondWithResult(_0x5a82a3,null))[_0x3edd('0x28')](handleError(_0x5a82a3,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a98345a..f02873c 100644 --- a/server/api/mailQueue/mailQueue.events.js +++ b/server/api/mailQueue/mailQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80cb=['hook','events','../../mysqldb','MailQueue','setMaxListeners','remove','emit'];(function(_0x1b7807,_0x205ccd){var _0x4d2bec=function(_0x43e586){while(--_0x43e586){_0x1b7807['push'](_0x1b7807['shift']());}};_0x4d2bec(++_0x205ccd);}(_0x80cb,0x94));var _0xb80c=function(_0x1144b9,_0x58585e){_0x1144b9=_0x1144b9-0x0;var _0x58552c=_0x80cb[_0x1144b9];return _0x58552c;};'use strict';var EventEmitter=require(_0xb80c('0x0'));var MailQueue=require(_0xb80c('0x1'))['db'][_0xb80c('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb80c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb80c('0x4')};function emitEvent(_0x1dabf1){return function(_0x5180f9,_0x1545b2,_0x33e927){MailQueueEvents['emit'](_0x1dabf1+':'+_0x5180f9['id'],_0x5180f9);MailQueueEvents[_0xb80c('0x5')](_0x1dabf1,_0x5180f9);_0x33e927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xb80c('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x843a=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x3cd888,_0x2a370a){var _0x449b3c=function(_0x2aadb5){while(--_0x2aadb5){_0x3cd888['push'](_0x3cd888['shift']());}};_0x449b3c(++_0x2a370a);}(_0x843a,0x13d));var _0xa843=function(_0x4ff2ad,_0x1a6927){_0x4ff2ad=_0x4ff2ad-0x0;var _0x379fd3=_0x843a[_0x4ff2ad];return _0x379fd3;};'use strict';var EventEmitter=require(_0xa843('0x0'));var MailQueue=require(_0xa843('0x1'))['db'][_0xa843('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa843('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa843('0x4'),'afterDestroy':_0xa843('0x5')};function emitEvent(_0x145c02){return function(_0x352226,_0x1c73ee,_0x52c8ff){MailQueueEvents['emit'](_0x145c02+':'+_0x352226['id'],_0x352226);MailQueueEvents[_0xa843('0x6')](_0x145c02,_0x352226);_0x52c8ff(null);};}for(var e in events){if(events[_0xa843('0x7')](e)){var event=events[e];MailQueue[_0xa843('0x8')](e,emitEvent(event));}}module[_0xa843('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index bb96791..aa0cfaa 100644 --- a/server/api/mailQueue/mailQueue.model.js +++ b/server/api/mailQueue/mailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8066=['exports','define','MailQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8066,0x155));var _0x6806=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x8066[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require('lodash');var util=require(_0x6806('0x0'));var logger=require(_0x6806('0x1'))(_0x6806('0x2'));var moment=require(_0x6806('0x3'));var BPromise=require(_0x6806('0x4'));var rp=require(_0x6806('0x5'));var fs=require('fs');var path=require(_0x6806('0x6'));var rimraf=require(_0x6806('0x7'));var config=require(_0x6806('0x8'));var attributes=require(_0x6806('0x9'));module[_0x6806('0xa')]=function(_0xa1c882,_0x25ea81){return _0xa1c882[_0x6806('0xb')](_0x6806('0xc'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0515=['path','../../config/environment','./mailQueue.attributes','exports','MailQueue','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x0515,0x1d3));var _0x5051=function(_0x4db22b,_0x30003f){_0x4db22b=_0x4db22b-0x0;var _0x534552=_0x0515[_0x4db22b];return _0x534552;};'use strict';var _=require(_0x5051('0x0'));var util=require(_0x5051('0x1'));var logger=require(_0x5051('0x2'))('api');var moment=require(_0x5051('0x3'));var BPromise=require(_0x5051('0x4'));var rp=require(_0x5051('0x5'));var fs=require('fs');var path=require(_0x5051('0x6'));var rimraf=require('rimraf');var config=require(_0x5051('0x7'));var attributes=require(_0x5051('0x8'));module[_0x5051('0x9')]=function(_0x256bae,_0x1a1891){return _0x256bae['define'](_0x5051('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 4067838..681a931 100644 --- a/server/api/mailQueue/mailQueue.rpc.js +++ b/server/api/mailQueue/mailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd68a=['stringify','error','MailQueue,\x20%s,\x20%s','message','result','MailQueue','options','raw','where','attributes','limit','include','model','then','GetMailQueue','catch','ShowMailQueue','map','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','info','request\x20sent','debug'];(function(_0x5bf221,_0x139837){var _0x7b00a8=function(_0x536a79){while(--_0x536a79){_0x5bf221['push'](_0x5bf221['shift']());}};_0x7b00a8(++_0x139837);}(_0xd68a,0xc6));var _0xad68=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xd68a[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0xad68('0x0'));var util=require(_0xad68('0x1'));var moment=require(_0xad68('0x2'));var BPromise=require(_0xad68('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad68('0x4'))['db'];var utils=require(_0xad68('0x5'));var logger=require(_0xad68('0x6'))(_0xad68('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xad68('0x8')]['http']({'port':0x232a});config['redis']=_[_0xad68('0x9')](config[_0xad68('0xa')],{'host':_0xad68('0xb'),'port':0x18eb});var socket=require(_0xad68('0xc'))(new Redis(config[_0xad68('0xa')]));require(_0xad68('0xd'))[_0xad68('0xe')](socket);function respondWithRpcPromise(_0x25fc03,_0x50ddf1,_0x3c7c04){return new BPromise(function(_0x1a55b7,_0x55bdd0){return client['request'](_0x25fc03,_0x3c7c04)['then'](function(_0x5177c9){logger[_0xad68('0xf')]('MailQueue,\x20%s,\x20%s',_0x50ddf1,_0xad68('0x10'));logger[_0xad68('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x50ddf1,_0xad68('0x10'),JSON[_0xad68('0x12')](_0x5177c9));if(_0x5177c9[_0xad68('0x13')]){if(_0x5177c9[_0xad68('0x13')]['code']===0x1f4){logger['error'](_0xad68('0x14'),_0x50ddf1,_0x5177c9[_0xad68('0x13')]['message']);return _0x55bdd0(_0x5177c9['error']['message']);}logger[_0xad68('0x13')]('MailQueue,\x20%s,\x20%s',_0x50ddf1,_0x5177c9[_0xad68('0x13')][_0xad68('0x15')]);return _0x1a55b7(_0x5177c9[_0xad68('0x13')][_0xad68('0x15')]);}else{logger[_0xad68('0xf')]('MailQueue,\x20%s,\x20%s',_0x50ddf1,'request\x20sent');_0x1a55b7(_0x5177c9[_0xad68('0x16')][_0xad68('0x15')]);}})['catch'](function(_0x40d7d0){logger['error'](_0xad68('0x14'),_0x50ddf1,_0x40d7d0);_0x55bdd0(_0x40d7d0);});});}exports['GetMailQueue']=function(_0x578e77){var _0x3b4bff=this;return new Promise(function(_0x5c2a58,_0x463d40){return db[_0xad68('0x17')]['findAll']({'raw':_0x578e77[_0xad68('0x18')]?_0x578e77['options'][_0xad68('0x19')]===undefined?!![]:![]:!![],'where':_0x578e77[_0xad68('0x18')]?_0x578e77[_0xad68('0x18')][_0xad68('0x1a')]||null:null,'attributes':_0x578e77[_0xad68('0x18')]?_0x578e77[_0xad68('0x18')][_0xad68('0x1b')]||null:null,'limit':_0x578e77['options']?_0x578e77[_0xad68('0x18')][_0xad68('0x1c')]||null:null,'include':_0x578e77[_0xad68('0x18')]?_0x578e77['options'][_0xad68('0x1d')]?_['map'](_0x578e77[_0xad68('0x18')][_0xad68('0x1d')],function(_0x415eed){return{'model':db[_0x415eed['model']],'as':_0x415eed['as'],'attributes':_0x415eed[_0xad68('0x1b')],'include':_0x415eed['include']?_['map'](_0x415eed['include'],function(_0x171675){return{'model':db[_0x171675[_0xad68('0x1e')]],'as':_0x171675['as'],'attributes':_0x171675[_0xad68('0x1b')],'include':_0x171675[_0xad68('0x1d')]?_['map'](_0x171675[_0xad68('0x1d')],function(_0x267f34){return{'model':db[_0x267f34[_0xad68('0x1e')]],'as':_0x267f34['as'],'attributes':_0x267f34['attributes']};}):[]};}):[]};}):[]:[]})[_0xad68('0x1f')](function(_0x4c0d2f){logger['info'](_0xad68('0x20'),_0x578e77);logger[_0xad68('0x11')]('GetMailQueue',_0x578e77,JSON[_0xad68('0x12')](_0x4c0d2f));_0x5c2a58(_0x4c0d2f);})[_0xad68('0x21')](function(_0x30e23e){logger['error']('GetMailQueue',_0x30e23e[_0xad68('0x15')],_0x578e77);_0x463d40(_0x3b4bff[_0xad68('0x13')](0x1f4,_0x30e23e[_0xad68('0x15')]));});});};exports[_0xad68('0x22')]=function(_0x5cedd5){var _0x46b531=this;return new Promise(function(_0x293eb0,_0x533678){return db[_0xad68('0x17')]['find']({'raw':_0x5cedd5[_0xad68('0x18')]?_0x5cedd5[_0xad68('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5cedd5['options']?_0x5cedd5['options'][_0xad68('0x1a')]||null:null,'attributes':_0x5cedd5[_0xad68('0x18')]?_0x5cedd5[_0xad68('0x18')][_0xad68('0x1b')]||null:null,'include':_0x5cedd5[_0xad68('0x18')]?_0x5cedd5[_0xad68('0x18')][_0xad68('0x1d')]?_[_0xad68('0x23')](_0x5cedd5['options'][_0xad68('0x1d')],function(_0xc476bc){return{'model':db[_0xc476bc[_0xad68('0x1e')]],'as':_0xc476bc['as'],'attributes':_0xc476bc[_0xad68('0x1b')],'include':_0xc476bc['include']?_[_0xad68('0x23')](_0xc476bc[_0xad68('0x1d')],function(_0x47b819){return{'model':db[_0x47b819['model']],'as':_0x47b819['as'],'attributes':_0x47b819[_0xad68('0x1b')],'include':_0x47b819[_0xad68('0x1d')]?_['map'](_0x47b819[_0xad68('0x1d')],function(_0x647476){return{'model':db[_0x647476[_0xad68('0x1e')]],'as':_0x647476['as'],'attributes':_0x647476[_0xad68('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x425114){logger['info'](_0xad68('0x22'),_0x5cedd5);logger[_0xad68('0x11')](_0xad68('0x22'),_0x5cedd5,JSON[_0xad68('0x12')](_0x425114));_0x293eb0(_0x425114);})[_0xad68('0x21')](function(_0x286844){logger[_0xad68('0x13')]('ShowMailQueue',_0x286844['message'],_0x5cedd5);_0x533678(_0x46b531['error'](0x1f4,_0x286844[_0xad68('0x15')]));});});}; \ No newline at end of file +var _0x01ab=['MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowMailQueue','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info'];(function(_0x32c15f,_0x4935d6){var _0x40a545=function(_0x38b98c){while(--_0x38b98c){_0x32c15f['push'](_0x32c15f['shift']());}};_0x40a545(++_0x4935d6);}(_0x01ab,0x1ab));var _0xb01a=function(_0x276ab9,_0x13fc29){_0x276ab9=_0x276ab9-0x0;var _0x58317d=_0x01ab[_0x276ab9];return _0x58317d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb01a('0x0'));var rs=require(_0xb01a('0x1'));var fs=require('fs');var Redis=require(_0xb01a('0x2'));var db=require(_0xb01a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb01a('0x4'));var config=require(_0xb01a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb01a('0x6')][_0xb01a('0x7')]({'port':0x232a});config[_0xb01a('0x8')]=_[_0xb01a('0x9')](config['redis'],{'host':_0xb01a('0xa'),'port':0x18eb});var socket=require(_0xb01a('0xb'))(new Redis(config[_0xb01a('0x8')]));require(_0xb01a('0xc'))[_0xb01a('0xd')](socket);function respondWithRpcPromise(_0x430ae9,_0x1a8db8,_0x1b23b1){return new BPromise(function(_0x2ae3b2,_0x249063){return client[_0xb01a('0xe')](_0x430ae9,_0x1b23b1)[_0xb01a('0xf')](function(_0x8cb2bf){logger[_0xb01a('0x10')](_0xb01a('0x11'),_0x1a8db8,_0xb01a('0x12'));logger[_0xb01a('0x13')](_0xb01a('0x14'),_0x1a8db8,_0xb01a('0x12'),JSON[_0xb01a('0x15')](_0x8cb2bf));if(_0x8cb2bf[_0xb01a('0x16')]){if(_0x8cb2bf[_0xb01a('0x16')]['code']===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x1a8db8,_0x8cb2bf['error'][_0xb01a('0x17')]);return _0x249063(_0x8cb2bf['error']['message']);}logger[_0xb01a('0x16')]('MailQueue,\x20%s,\x20%s',_0x1a8db8,_0x8cb2bf[_0xb01a('0x16')]['message']);return _0x2ae3b2(_0x8cb2bf[_0xb01a('0x16')][_0xb01a('0x17')]);}else{logger[_0xb01a('0x10')](_0xb01a('0x11'),_0x1a8db8,'request\x20sent');_0x2ae3b2(_0x8cb2bf[_0xb01a('0x18')]['message']);}})['catch'](function(_0x2f8eff){logger[_0xb01a('0x16')](_0xb01a('0x11'),_0x1a8db8,_0x2f8eff);_0x249063(_0x2f8eff);});});}exports[_0xb01a('0x19')]=function(_0x185b24){var _0x39f195=this;return new Promise(function(_0x2cd80a,_0x283ba){return db['MailQueue'][_0xb01a('0x1a')]({'raw':_0x185b24[_0xb01a('0x1b')]?_0x185b24[_0xb01a('0x1b')][_0xb01a('0x1c')]===undefined?!![]:![]:!![],'where':_0x185b24[_0xb01a('0x1b')]?_0x185b24[_0xb01a('0x1b')][_0xb01a('0x1d')]||null:null,'attributes':_0x185b24[_0xb01a('0x1b')]?_0x185b24['options'][_0xb01a('0x1e')]||null:null,'limit':_0x185b24[_0xb01a('0x1b')]?_0x185b24[_0xb01a('0x1b')][_0xb01a('0x1f')]||null:null,'include':_0x185b24[_0xb01a('0x1b')]?_0x185b24[_0xb01a('0x1b')]['include']?_['map'](_0x185b24[_0xb01a('0x1b')][_0xb01a('0x20')],function(_0x102e57){return{'model':db[_0x102e57['model']],'as':_0x102e57['as'],'attributes':_0x102e57['attributes'],'include':_0x102e57[_0xb01a('0x20')]?_[_0xb01a('0x21')](_0x102e57[_0xb01a('0x20')],function(_0x32b902){return{'model':db[_0x32b902[_0xb01a('0x22')]],'as':_0x32b902['as'],'attributes':_0x32b902[_0xb01a('0x1e')],'include':_0x32b902['include']?_['map'](_0x32b902[_0xb01a('0x20')],function(_0x5b2fb7){return{'model':db[_0x5b2fb7[_0xb01a('0x22')]],'as':_0x5b2fb7['as'],'attributes':_0x5b2fb7[_0xb01a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb01a('0xf')](function(_0x55c39e){logger[_0xb01a('0x10')](_0xb01a('0x19'),_0x185b24);logger[_0xb01a('0x13')]('GetMailQueue',_0x185b24,JSON['stringify'](_0x55c39e));_0x2cd80a(_0x55c39e);})[_0xb01a('0x23')](function(_0x28f413){logger[_0xb01a('0x16')](_0xb01a('0x19'),_0x28f413['message'],_0x185b24);_0x283ba(_0x39f195[_0xb01a('0x16')](0x1f4,_0x28f413[_0xb01a('0x17')]));});});};exports[_0xb01a('0x24')]=function(_0x1699a4){var _0x29a045=this;return new Promise(function(_0x244d0a,_0x19b07d){return db['MailQueue']['find']({'raw':_0x1699a4[_0xb01a('0x1b')]?_0x1699a4['options'][_0xb01a('0x1c')]===undefined?!![]:![]:!![],'where':_0x1699a4['options']?_0x1699a4['options']['where']||null:null,'attributes':_0x1699a4[_0xb01a('0x1b')]?_0x1699a4[_0xb01a('0x1b')][_0xb01a('0x1e')]||null:null,'include':_0x1699a4['options']?_0x1699a4['options'][_0xb01a('0x20')]?_['map'](_0x1699a4[_0xb01a('0x1b')][_0xb01a('0x20')],function(_0x5d60d5){return{'model':db[_0x5d60d5[_0xb01a('0x22')]],'as':_0x5d60d5['as'],'attributes':_0x5d60d5[_0xb01a('0x1e')],'include':_0x5d60d5[_0xb01a('0x20')]?_[_0xb01a('0x21')](_0x5d60d5[_0xb01a('0x20')],function(_0x1ac4ea){return{'model':db[_0x1ac4ea[_0xb01a('0x22')]],'as':_0x1ac4ea['as'],'attributes':_0x1ac4ea[_0xb01a('0x1e')],'include':_0x1ac4ea['include']?_[_0xb01a('0x21')](_0x1ac4ea[_0xb01a('0x20')],function(_0x44f4d5){return{'model':db[_0x44f4d5['model']],'as':_0x44f4d5['as'],'attributes':_0x44f4d5[_0xb01a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ee30a){logger[_0xb01a('0x10')](_0xb01a('0x24'),_0x1699a4);logger[_0xb01a('0x13')](_0xb01a('0x24'),_0x1699a4,JSON[_0xb01a('0x15')](_0x2ee30a));_0x244d0a(_0x2ee30a);})[_0xb01a('0x23')](function(_0x546d6c){logger[_0xb01a('0x16')](_0xb01a('0x24'),_0x546d6c[_0xb01a('0x17')],_0x1699a4);_0x19b07d(_0x29a045['error'](0x1f4,_0x546d6c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index d925c14..e939d2b 100644 --- a/server/api/mailQueue/mailQueue.socket.js +++ b/server/api/mailQueue/mailQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x221f=['./mailQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x1a62ec,_0x5357a1){var _0x1f114e=function(_0x1f99da){while(--_0x1f99da){_0x1a62ec['push'](_0x1a62ec['shift']());}};_0x1f114e(++_0x5357a1);}(_0x221f,0x19d));var _0xf221=function(_0x3a544a,_0x73a217){_0x3a544a=_0x3a544a-0x0;var _0x342f1e=_0x221f[_0x3a544a];return _0x342f1e;};'use strict';var MailQueueEvents=require(_0xf221('0x0'));var events=['save',_0xf221('0x1'),_0xf221('0x2')];function createListener(_0x4205c2,_0x57fd5b){return function(_0x2f0745){_0x57fd5b[_0xf221('0x3')](_0x4205c2,_0x2f0745);};}function removeListener(_0xe279d1,_0x363a9c){return function(){MailQueueEvents[_0xf221('0x4')](_0xe279d1,_0x363a9c);};}exports[_0xf221('0x5')]=function(_0x122935){for(var _0x4baae7=0x0,_0xe00b7=events[_0xf221('0x6')];_0x4baae7<_0xe00b7;_0x4baae7++){var _0x2c5c94=events[_0x4baae7];var _0x5a6e17=createListener('mailQueue:'+_0x2c5c94,_0x122935);MailQueueEvents['on'](_0x2c5c94,_0x5a6e17);}}; \ No newline at end of file +var _0x24b3=['length','./mailQueue.events','save','remove','register'];(function(_0x54b723,_0xeb0f22){var _0x3c88ee=function(_0x3c9dec){while(--_0x3c9dec){_0x54b723['push'](_0x54b723['shift']());}};_0x3c88ee(++_0xeb0f22);}(_0x24b3,0xd3));var _0x324b=function(_0x113a23,_0x8d4f9d){_0x113a23=_0x113a23-0x0;var _0x41f9dc=_0x24b3[_0x113a23];return _0x41f9dc;};'use strict';var MailQueueEvents=require(_0x324b('0x0'));var events=[_0x324b('0x1'),_0x324b('0x2'),'update'];function createListener(_0x369824,_0x5691ab){return function(_0x49ce20){_0x5691ab['emit'](_0x369824,_0x49ce20);};}function removeListener(_0xd7068f,_0x1c3e34){return function(){MailQueueEvents['removeListener'](_0xd7068f,_0x1c3e34);};}exports[_0x324b('0x3')]=function(_0x4ff65e){for(var _0x5a244c=0x0,_0x563222=events[_0x324b('0x4')];_0x5a244c<_0x563222;_0x5a244c++){var _0x39d42c=events[_0x5a244c];var _0x7da7d0=createListener('mailQueue:'+_0x39d42c,_0x4ff65e);MailQueueEvents['on'](_0x39d42c,_0x7da7d0);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index da010b1..355c11c 100644 --- a/server/api/mailQueueReport/index.js +++ b/server/api/mailQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d43=['Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','show','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x137cea,_0x20e60d){var _0x480882=function(_0x280975){while(--_0x280975){_0x137cea['push'](_0x137cea['shift']());}};_0x480882(++_0x20e60d);}(_0x4d43,0x100));var _0x34d4=function(_0x3c31d8,_0x5ae5d9){_0x3c31d8=_0x3c31d8-0x0;var _0xec33e0=_0x4d43[_0x3c31d8];return _0xec33e0;};'use strict';var multer=require(_0x34d4('0x0'));var util=require(_0x34d4('0x1'));var path=require('path');var timeout=require(_0x34d4('0x2'));var express=require(_0x34d4('0x3'));var router=express[_0x34d4('0x4')]();var fs_extra=require(_0x34d4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x34d4('0x6'));var config=require(_0x34d4('0x7'));var controller=require(_0x34d4('0x8'));router[_0x34d4('0x9')]('/',auth[_0x34d4('0xa')](),controller[_0x34d4('0xb')]);router[_0x34d4('0x9')]('/describe',auth[_0x34d4('0xa')](),controller[_0x34d4('0xc')]);router[_0x34d4('0x9')]('/:id',auth[_0x34d4('0xa')](),controller[_0x34d4('0xd')]);router['post']('/',auth[_0x34d4('0xa')](),controller[_0x34d4('0xe')]);router['put'](_0x34d4('0xf'),auth[_0x34d4('0xa')](),controller[_0x34d4('0x10')]);router[_0x34d4('0x11')](_0x34d4('0xf'),auth[_0x34d4('0xa')](),controller[_0x34d4('0x12')]);module[_0x34d4('0x13')]=router; \ No newline at end of file +var _0x3691=['/:id','show','post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x3691,0x8b));var _0x1369=function(_0x5d7ab0,_0x473b27){_0x5d7ab0=_0x5d7ab0-0x0;var _0xbbbf7f=_0x3691[_0x5d7ab0];return _0xbbbf7f;};'use strict';var multer=require(_0x1369('0x0'));var util=require(_0x1369('0x1'));var path=require(_0x1369('0x2'));var timeout=require('connect-timeout');var express=require(_0x1369('0x3'));var router=express[_0x1369('0x4')]();var fs_extra=require(_0x1369('0x5'));var auth=require(_0x1369('0x6'));var interaction=require(_0x1369('0x7'));var config=require(_0x1369('0x8'));var controller=require(_0x1369('0x9'));router[_0x1369('0xa')]('/',auth[_0x1369('0xb')](),controller[_0x1369('0xc')]);router[_0x1369('0xa')](_0x1369('0xd'),auth['isAuthenticated'](),controller[_0x1369('0xe')]);router[_0x1369('0xa')](_0x1369('0xf'),auth[_0x1369('0xb')](),controller[_0x1369('0x10')]);router[_0x1369('0x11')]('/',auth['isAuthenticated'](),controller[_0x1369('0x12')]);router[_0x1369('0x13')](_0x1369('0xf'),auth[_0x1369('0xb')](),controller[_0x1369('0x14')]);router[_0x1369('0x15')](_0x1369('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index c089af8..b900500 100644 --- a/server/api/mailQueueReport/mailQueueReport.attributes.js +++ b/server/api/mailQueueReport/mailQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43c0=['moment','sequelize','exports','STRING','DATE'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x43c0,0x13b));var _0x043c=function(_0x390b80,_0x4d434b){_0x390b80=_0x390b80-0x0;var _0x4d857b=_0x43c0[_0x390b80];return _0x4d857b;};'use strict';var moment=require(_0x043c('0x0'));var Sequelize=require(_0x043c('0x1'));module[_0x043c('0x2')]={'uniqueid':{'type':Sequelize[_0x043c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x043c('0x3')]},'joinAt':{'type':Sequelize[_0x043c('0x4')]},'leaveAt':{'type':Sequelize[_0x043c('0x4')]},'acceptAt':{'type':Sequelize[_0x043c('0x4')]},'exitAt':{'type':Sequelize[_0x043c('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4c83=['STRING','DATE','moment','sequelize','exports'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x4c83,0x183));var _0x34c8=function(_0x1c8ca1,_0x5b8884){_0x1c8ca1=_0x1c8ca1-0x0;var _0x32af96=_0x4c83[_0x1c8ca1];return _0x32af96;};'use strict';var moment=require(_0x34c8('0x0'));var Sequelize=require(_0x34c8('0x1'));module[_0x34c8('0x2')]={'uniqueid':{'type':Sequelize[_0x34c8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x34c8('0x3')]},'joinAt':{'type':Sequelize[_0x34c8('0x4')]},'leaveAt':{'type':Sequelize[_0x34c8('0x4')]},'acceptAt':{'type':Sequelize[_0x34c8('0x4')]},'exitAt':{'type':Sequelize[_0x34c8('0x4')]},'reason':{'type':Sequelize[_0x34c8('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index a5139ff..97c8e02 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb145=['includeAll','findAll','rows','catch','show','params','include','options','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','MailQueueReport','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x448ae1,_0x144bec){var _0xa75890=function(_0xf7d076){while(--_0xf7d076){_0x448ae1['push'](_0x448ae1['shift']());}};_0xa75890(++_0x144bec);}(_0xb145,0xa3));var _0x5b14=function(_0x4ccccd,_0x4dfbfc){_0x4ccccd=_0x4ccccd-0x0;var _0xb16b31=_0xb145[_0x4ccccd];return _0xb16b31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b14('0x0'));var zipdir=require(_0x5b14('0x1'));var jsonpatch=require(_0x5b14('0x2'));var rp=require(_0x5b14('0x3'));var moment=require(_0x5b14('0x4'));var BPromise=require(_0x5b14('0x5'));var Mustache=require(_0x5b14('0x6'));var util=require(_0x5b14('0x7'));var path=require('path');var sox=require(_0x5b14('0x8'));var csv=require(_0x5b14('0x9'));var ejs=require(_0x5b14('0xa'));var fs=require('fs');var fs_extra=require(_0x5b14('0xb'));var _=require('lodash');var squel=require(_0x5b14('0xc'));var crypto=require(_0x5b14('0xd'));var jsforce=require(_0x5b14('0xe'));var deskjs=require(_0x5b14('0xf'));var toCsv=require(_0x5b14('0x9'));var querystring=require('querystring');var Papa=require(_0x5b14('0x10'));var Redis=require(_0x5b14('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b14('0x12'));var as=require(_0x5b14('0x13'));var hardwareService=require(_0x5b14('0x14'));var logger=require(_0x5b14('0x15'))(_0x5b14('0x16'));var utils=require('../../config/utils');var config=require(_0x5b14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b14('0x18'))['db'];function respondWithStatusCode(_0x1903a5,_0xc33723){_0xc33723=_0xc33723||0xcc;return function(_0x1cb56b){if(_0x1cb56b){return _0x1903a5[_0x5b14('0x19')](_0xc33723);}return _0x1903a5[_0x5b14('0x1a')](_0xc33723)['end']();};}function respondWithResult(_0x27b34b,_0x16f2a1){_0x16f2a1=_0x16f2a1||0xc8;return function(_0x35fb8b){if(_0x35fb8b){return _0x27b34b[_0x5b14('0x1a')](_0x16f2a1)[_0x5b14('0x1b')](_0x35fb8b);}};}function respondWithFilteredResult(_0x2a8fe5,_0x68f695){return function(_0xe5af75){if(_0xe5af75){var _0x183b0a=typeof _0x68f695[_0x5b14('0x1c')]===_0x5b14('0x1d')&&typeof _0x68f695[_0x5b14('0x1e')]==='undefined';var _0x24cfd0=_0xe5af75['count'];var _0x48d395=_0x183b0a?0x0:_0x68f695['offset'];var _0x3f397d=_0x183b0a?_0xe5af75[_0x5b14('0x1f')]:_0x68f695[_0x5b14('0x1c')]+_0x68f695[_0x5b14('0x1e')];var _0x3786f7;if(_0x3f397d>=_0x24cfd0){_0x3f397d=_0x24cfd0;_0x3786f7=0xc8;}else{_0x3786f7=0xce;}_0x2a8fe5[_0x5b14('0x1a')](_0x3786f7);return _0x2a8fe5[_0x5b14('0x20')]('Content-Range',_0x48d395+'-'+_0x3f397d+'/'+_0x24cfd0)['json'](_0xe5af75);}return null;};}function patchUpdates(_0x4fa079){return function(_0x4f4717){try{jsonpatch[_0x5b14('0x21')](_0x4f4717,_0x4fa079,!![]);}catch(_0x9a9495){return BPromise[_0x5b14('0x22')](_0x9a9495);}return _0x4f4717['save']();};}function saveUpdates(_0x1018d9,_0x1577f7){return function(_0x4857c7){if(_0x4857c7){return _0x4857c7[_0x5b14('0x23')](_0x1018d9)[_0x5b14('0x24')](function(_0x50951f){return _0x50951f;});}return null;};}function removeEntity(_0x33a293,_0x54073f){return function(_0x59282c){if(_0x59282c){return _0x59282c['destroy']()['then'](function(){_0x33a293[_0x5b14('0x1a')](0xcc)[_0x5b14('0x25')]();});}};}function handleEntityNotFound(_0x153a25,_0x5da505){return function(_0x46f86a){if(!_0x46f86a){_0x153a25[_0x5b14('0x19')](0x194);}return _0x46f86a;};}function handleError(_0x2ac7b0,_0x143648){_0x143648=_0x143648||0x1f4;return function(_0xe6851b){logger[_0x5b14('0x26')](_0xe6851b[_0x5b14('0x27')]);if(_0xe6851b[_0x5b14('0x28')]){delete _0xe6851b[_0x5b14('0x28')];}_0x2ac7b0[_0x5b14('0x1a')](_0x143648)[_0x5b14('0x29')](_0xe6851b);};}exports[_0x5b14('0x2a')]=function(_0x1c3c52,_0x266bbe){var _0x4cfd66={},_0x370fcd={},_0x18a76d={'count':0x0,'rows':[]};var _0x53b13d=_['map'](db[_0x5b14('0x2b')][_0x5b14('0x2c')],function(_0x5dca4f){return{'name':_0x5dca4f['fieldName'],'type':_0x5dca4f[_0x5b14('0x2d')]['key']};});_0x370fcd[_0x5b14('0x2e')]=_[_0x5b14('0x2f')](_0x53b13d,'name');_0x370fcd['query']=_[_0x5b14('0x30')](_0x1c3c52[_0x5b14('0x31')]);_0x370fcd[_0x5b14('0x32')]=_['intersection'](_0x370fcd[_0x5b14('0x2e')],_0x370fcd['query']);_0x4cfd66[_0x5b14('0x33')]=_[_0x5b14('0x34')](_0x370fcd[_0x5b14('0x2e')],qs[_0x5b14('0x35')](_0x1c3c52['query'][_0x5b14('0x35')]));_0x4cfd66[_0x5b14('0x33')]=_0x4cfd66[_0x5b14('0x33')][_0x5b14('0x36')]?_0x4cfd66['attributes']:_0x370fcd[_0x5b14('0x2e')];if(!_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x37')]('nolimit')){_0x4cfd66[_0x5b14('0x1e')]=qs['limit'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x1e')]);_0x4cfd66['offset']=qs[_0x5b14('0x1c')](_0x1c3c52[_0x5b14('0x31')]['offset']);}_0x4cfd66[_0x5b14('0x38')]=qs['sort'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x39')]);_0x4cfd66[_0x5b14('0x3a')]=qs[_0x5b14('0x32')](_['pick'](_0x1c3c52[_0x5b14('0x31')],_0x370fcd[_0x5b14('0x32')]),_0x53b13d);if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]){_0x4cfd66[_0x5b14('0x3a')]=_[_0x5b14('0x3c')](_0x4cfd66[_0x5b14('0x3a')],{'$or':_[_0x5b14('0x2f')](_0x53b13d,function(_0x4f647c){if(_0x4f647c[_0x5b14('0x2d')]!==_0x5b14('0x3d')){var _0x3f9d1d={};_0x3f9d1d[_0x4f647c[_0x5b14('0x28')]]={'$like':'%'+_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]+'%'};return _0x3f9d1d;}})});}_0x4cfd66=_[_0x5b14('0x3c')]({},_0x4cfd66,_0x1c3c52['options']);var _0x2ebaa8={'where':_0x4cfd66['where']};return db[_0x5b14('0x2b')][_0x5b14('0x1f')](_0x2ebaa8)['then'](function(_0x4c05ac){_0x18a76d['count']=_0x4c05ac;if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3e')]){_0x4cfd66['include']=[{'all':!![]}];}return db[_0x5b14('0x2b')][_0x5b14('0x3f')](_0x4cfd66);})[_0x5b14('0x24')](function(_0x3d0369){_0x18a76d[_0x5b14('0x40')]=_0x3d0369;return _0x18a76d;})['then'](respondWithFilteredResult(_0x266bbe,_0x4cfd66))[_0x5b14('0x41')](handleError(_0x266bbe,null));};exports[_0x5b14('0x42')]=function(_0x4fb46e,_0x996aee){var _0x985e69={'raw':!![],'where':{'id':_0x4fb46e[_0x5b14('0x43')]['id']}},_0x5cc257={};_0x5cc257['model']=_[_0x5b14('0x30')](db[_0x5b14('0x2b')][_0x5b14('0x2c')]);_0x5cc257[_0x5b14('0x31')]=_['keys'](_0x4fb46e[_0x5b14('0x31')]);_0x5cc257[_0x5b14('0x32')]=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],_0x5cc257['query']);_0x985e69['attributes']=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],qs['fields'](_0x4fb46e[_0x5b14('0x31')]['fields']));_0x985e69[_0x5b14('0x33')]=_0x985e69[_0x5b14('0x33')][_0x5b14('0x36')]?_0x985e69[_0x5b14('0x33')]:_0x5cc257[_0x5b14('0x2e')];if(_0x4fb46e['query'][_0x5b14('0x3e')]){_0x985e69[_0x5b14('0x44')]=[{'all':!![]}];}_0x985e69=_[_0x5b14('0x3c')]({},_0x985e69,_0x4fb46e[_0x5b14('0x45')]);return db[_0x5b14('0x2b')]['find'](_0x985e69)['then'](handleEntityNotFound(_0x996aee,null))[_0x5b14('0x24')](respondWithResult(_0x996aee,null))['catch'](handleError(_0x996aee,null));};exports['create']=function(_0x4825b4,_0x35d00d){return db[_0x5b14('0x2b')][_0x5b14('0x46')](_0x4825b4[_0x5b14('0x47')],{})[_0x5b14('0x24')](respondWithResult(_0x35d00d,0xc9))[_0x5b14('0x41')](handleError(_0x35d00d,null));};exports[_0x5b14('0x23')]=function(_0x4d2bee,_0x548e1c){if(_0x4d2bee['body']['id']){delete _0x4d2bee['body']['id'];}return db['MailQueueReport'][_0x5b14('0x48')]({'where':{'id':_0x4d2bee[_0x5b14('0x43')]['id']}})[_0x5b14('0x24')](handleEntityNotFound(_0x548e1c,null))[_0x5b14('0x24')](saveUpdates(_0x4d2bee[_0x5b14('0x47')],null))['then'](respondWithResult(_0x548e1c,null))['catch'](handleError(_0x548e1c,null));};exports[_0x5b14('0x49')]=function(_0xd6ea50,_0x58b18e){return db[_0x5b14('0x2b')][_0x5b14('0x48')]({'where':{'id':_0xd6ea50['params']['id']}})['then'](handleEntityNotFound(_0x58b18e,null))[_0x5b14('0x24')](removeEntity(_0x58b18e,null))[_0x5b14('0x41')](handleError(_0x58b18e,null));};exports[_0x5b14('0x4a')]=function(_0x5d3782,_0x1a51d5){return db[_0x5b14('0x2b')][_0x5b14('0x4a')]()[_0x5b14('0x24')](respondWithResult(_0x1a51d5,null))[_0x5b14('0x41')](handleError(_0x1a51d5,null));}; \ No newline at end of file +var _0x5fdc=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x5fdc,0x127));var _0xc5fd=function(_0x3fee7c,_0x37147a){_0x3fee7c=_0x3fee7c-0x0;var _0xcb00e4=_0x5fdc[_0x3fee7c];return _0xcb00e4;};'use strict';var emlformat=require(_0xc5fd('0x0'));var rimraf=require(_0xc5fd('0x1'));var zipdir=require(_0xc5fd('0x2'));var jsonpatch=require(_0xc5fd('0x3'));var rp=require(_0xc5fd('0x4'));var moment=require(_0xc5fd('0x5'));var BPromise=require(_0xc5fd('0x6'));var Mustache=require(_0xc5fd('0x7'));var util=require(_0xc5fd('0x8'));var path=require(_0xc5fd('0x9'));var sox=require(_0xc5fd('0xa'));var csv=require(_0xc5fd('0xb'));var ejs=require(_0xc5fd('0xc'));var fs=require('fs');var fs_extra=require(_0xc5fd('0xd'));var _=require(_0xc5fd('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5fd('0xf'));var toCsv=require(_0xc5fd('0xb'));var querystring=require(_0xc5fd('0x10'));var Papa=require(_0xc5fd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc5fd('0x12'));var as=require(_0xc5fd('0x13'));var hardwareService=require(_0xc5fd('0x14'));var logger=require(_0xc5fd('0x15'))(_0xc5fd('0x16'));var utils=require(_0xc5fd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc5fd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x558939,_0x1b1b2b){_0x1b1b2b=_0x1b1b2b||0xcc;return function(_0x1bc6d1){if(_0x1bc6d1){return _0x558939[_0xc5fd('0x19')](_0x1b1b2b);}return _0x558939[_0xc5fd('0x1a')](_0x1b1b2b)[_0xc5fd('0x1b')]();};}function respondWithResult(_0x40b0f8,_0x27447e){_0x27447e=_0x27447e||0xc8;return function(_0xa7a954){if(_0xa7a954){return _0x40b0f8['status'](_0x27447e)[_0xc5fd('0x1c')](_0xa7a954);}};}function respondWithFilteredResult(_0x103c3d,_0x2221da){return function(_0x3404e0){if(_0x3404e0){var _0x4d3636=typeof _0x2221da['offset']==='undefined'&&typeof _0x2221da['limit']==='undefined';var _0x35a9d0=_0x3404e0[_0xc5fd('0x1d')];var _0x27f611=_0x4d3636?0x0:_0x2221da[_0xc5fd('0x1e')];var _0x2ee392=_0x4d3636?_0x3404e0[_0xc5fd('0x1d')]:_0x2221da[_0xc5fd('0x1e')]+_0x2221da['limit'];var _0xb7bab1;if(_0x2ee392>=_0x35a9d0){_0x2ee392=_0x35a9d0;_0xb7bab1=0xc8;}else{_0xb7bab1=0xce;}_0x103c3d[_0xc5fd('0x1a')](_0xb7bab1);return _0x103c3d[_0xc5fd('0x1f')](_0xc5fd('0x20'),_0x27f611+'-'+_0x2ee392+'/'+_0x35a9d0)[_0xc5fd('0x1c')](_0x3404e0);}return null;};}function patchUpdates(_0x48024e){return function(_0x3966a2){try{jsonpatch[_0xc5fd('0x21')](_0x3966a2,_0x48024e,!![]);}catch(_0x18048e){return BPromise[_0xc5fd('0x22')](_0x18048e);}return _0x3966a2['save']();};}function saveUpdates(_0x4c85d5,_0x13cc42){return function(_0x2ab935){if(_0x2ab935){return _0x2ab935[_0xc5fd('0x23')](_0x4c85d5)[_0xc5fd('0x24')](function(_0x334401){return _0x334401;});}return null;};}function removeEntity(_0x311952,_0x56d473){return function(_0x1a3f21){if(_0x1a3f21){return _0x1a3f21[_0xc5fd('0x25')]()[_0xc5fd('0x24')](function(){_0x311952[_0xc5fd('0x1a')](0xcc)[_0xc5fd('0x1b')]();});}};}function handleEntityNotFound(_0x4020af,_0x475b91){return function(_0x527018){if(!_0x527018){_0x4020af[_0xc5fd('0x19')](0x194);}return _0x527018;};}function handleError(_0x48cd1d,_0x2ee700){_0x2ee700=_0x2ee700||0x1f4;return function(_0x231368){logger[_0xc5fd('0x26')](_0x231368[_0xc5fd('0x27')]);if(_0x231368['name']){delete _0x231368[_0xc5fd('0x28')];}_0x48cd1d[_0xc5fd('0x1a')](_0x2ee700)[_0xc5fd('0x29')](_0x231368);};}exports[_0xc5fd('0x2a')]=function(_0x19df33,_0x209975){var _0x541c12={},_0x412ef7={},_0x5d4f70={'count':0x0,'rows':[]};var _0x4859f7=_[_0xc5fd('0x2b')](db[_0xc5fd('0x2c')][_0xc5fd('0x2d')],function(_0x38db1d){return{'name':_0x38db1d[_0xc5fd('0x2e')],'type':_0x38db1d[_0xc5fd('0x2f')][_0xc5fd('0x30')]};});_0x412ef7[_0xc5fd('0x31')]=_['map'](_0x4859f7,_0xc5fd('0x28'));_0x412ef7[_0xc5fd('0x32')]=_[_0xc5fd('0x33')](_0x19df33[_0xc5fd('0x32')]);_0x412ef7[_0xc5fd('0x34')]=_[_0xc5fd('0x35')](_0x412ef7[_0xc5fd('0x31')],_0x412ef7[_0xc5fd('0x32')]);_0x541c12[_0xc5fd('0x36')]=_[_0xc5fd('0x35')](_0x412ef7[_0xc5fd('0x31')],qs[_0xc5fd('0x37')](_0x19df33['query'][_0xc5fd('0x37')]));_0x541c12[_0xc5fd('0x36')]=_0x541c12[_0xc5fd('0x36')][_0xc5fd('0x38')]?_0x541c12[_0xc5fd('0x36')]:_0x412ef7[_0xc5fd('0x31')];if(!_0x19df33[_0xc5fd('0x32')][_0xc5fd('0x39')](_0xc5fd('0x3a'))){_0x541c12['limit']=qs[_0xc5fd('0x3b')](_0x19df33[_0xc5fd('0x32')][_0xc5fd('0x3b')]);_0x541c12[_0xc5fd('0x1e')]=qs[_0xc5fd('0x1e')](_0x19df33[_0xc5fd('0x32')][_0xc5fd('0x1e')]);}_0x541c12['order']=qs[_0xc5fd('0x3c')](_0x19df33[_0xc5fd('0x32')]['sort']);_0x541c12[_0xc5fd('0x3d')]=qs['filters'](_[_0xc5fd('0x3e')](_0x19df33[_0xc5fd('0x32')],_0x412ef7[_0xc5fd('0x34')]),_0x4859f7);if(_0x19df33['query'][_0xc5fd('0x3f')]){_0x541c12[_0xc5fd('0x3d')]=_['merge'](_0x541c12[_0xc5fd('0x3d')],{'$or':_[_0xc5fd('0x2b')](_0x4859f7,function(_0x31b457){if(_0x31b457[_0xc5fd('0x2f')]!==_0xc5fd('0x40')){var _0x33f669={};_0x33f669[_0x31b457['name']]={'$like':'%'+_0x19df33[_0xc5fd('0x32')][_0xc5fd('0x3f')]+'%'};return _0x33f669;}})});}_0x541c12=_[_0xc5fd('0x41')]({},_0x541c12,_0x19df33[_0xc5fd('0x42')]);var _0x5d3fce={'where':_0x541c12['where']};return db['MailQueueReport'][_0xc5fd('0x1d')](_0x5d3fce)[_0xc5fd('0x24')](function(_0x2dd4ca){_0x5d4f70[_0xc5fd('0x1d')]=_0x2dd4ca;if(_0x19df33[_0xc5fd('0x32')][_0xc5fd('0x43')]){_0x541c12[_0xc5fd('0x44')]=[{'all':!![]}];}return db[_0xc5fd('0x2c')][_0xc5fd('0x45')](_0x541c12);})['then'](function(_0x5a2199){_0x5d4f70[_0xc5fd('0x46')]=_0x5a2199;return _0x5d4f70;})['then'](respondWithFilteredResult(_0x209975,_0x541c12))[_0xc5fd('0x47')](handleError(_0x209975,null));};exports[_0xc5fd('0x48')]=function(_0x2259e4,_0x57fd81){var _0x6ebcbf={'raw':!![],'where':{'id':_0x2259e4['params']['id']}},_0x350753={};_0x350753[_0xc5fd('0x31')]=_[_0xc5fd('0x33')](db['MailQueueReport'][_0xc5fd('0x2d')]);_0x350753['query']=_[_0xc5fd('0x33')](_0x2259e4[_0xc5fd('0x32')]);_0x350753['filters']=_[_0xc5fd('0x35')](_0x350753[_0xc5fd('0x31')],_0x350753[_0xc5fd('0x32')]);_0x6ebcbf['attributes']=_[_0xc5fd('0x35')](_0x350753[_0xc5fd('0x31')],qs['fields'](_0x2259e4['query'][_0xc5fd('0x37')]));_0x6ebcbf['attributes']=_0x6ebcbf['attributes']['length']?_0x6ebcbf[_0xc5fd('0x36')]:_0x350753[_0xc5fd('0x31')];if(_0x2259e4[_0xc5fd('0x32')][_0xc5fd('0x43')]){_0x6ebcbf[_0xc5fd('0x44')]=[{'all':!![]}];}_0x6ebcbf=_[_0xc5fd('0x41')]({},_0x6ebcbf,_0x2259e4['options']);return db['MailQueueReport']['find'](_0x6ebcbf)[_0xc5fd('0x24')](handleEntityNotFound(_0x57fd81,null))[_0xc5fd('0x24')](respondWithResult(_0x57fd81,null))[_0xc5fd('0x47')](handleError(_0x57fd81,null));};exports['create']=function(_0x1a2200,_0x51641b){return db[_0xc5fd('0x2c')][_0xc5fd('0x49')](_0x1a2200[_0xc5fd('0x4a')],{})[_0xc5fd('0x24')](respondWithResult(_0x51641b,0xc9))[_0xc5fd('0x47')](handleError(_0x51641b,null));};exports[_0xc5fd('0x23')]=function(_0x54d86c,_0x6b2f77){if(_0x54d86c[_0xc5fd('0x4a')]['id']){delete _0x54d86c['body']['id'];}return db['MailQueueReport'][_0xc5fd('0x4b')]({'where':{'id':_0x54d86c['params']['id']}})['then'](handleEntityNotFound(_0x6b2f77,null))[_0xc5fd('0x24')](saveUpdates(_0x54d86c[_0xc5fd('0x4a')],null))['then'](respondWithResult(_0x6b2f77,null))[_0xc5fd('0x47')](handleError(_0x6b2f77,null));};exports[_0xc5fd('0x25')]=function(_0x5c49e7,_0x21d418){return db[_0xc5fd('0x2c')][_0xc5fd('0x4b')]({'where':{'id':_0x5c49e7[_0xc5fd('0x4c')]['id']}})[_0xc5fd('0x24')](handleEntityNotFound(_0x21d418,null))[_0xc5fd('0x24')](removeEntity(_0x21d418,null))[_0xc5fd('0x47')](handleError(_0x21d418,null));};exports[_0xc5fd('0x4d')]=function(_0x4217f7,_0x32721e){return db[_0xc5fd('0x2c')]['describe']()[_0xc5fd('0x24')](respondWithResult(_0x32721e,null))[_0xc5fd('0x47')](handleError(_0x32721e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index dcb19db..5e06619 100644 --- a/server/api/mailQueueReport/mailQueueReport.model.js +++ b/server/api/mailQueueReport/mailQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d9f=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash'];(function(_0x265029,_0xd1823b){var _0x41852e=function(_0x345f01){while(--_0x345f01){_0x265029['push'](_0x265029['shift']());}};_0x41852e(++_0xd1823b);}(_0x1d9f,0x167));var _0xf1d9=function(_0x360902,_0x14b396){_0x360902=_0x360902-0x0;var _0x4c199f=_0x1d9f[_0x360902];return _0x4c199f;};'use strict';var _=require(_0xf1d9('0x0'));var util=require(_0xf1d9('0x1'));var logger=require(_0xf1d9('0x2'))(_0xf1d9('0x3'));var moment=require('moment');var BPromise=require(_0xf1d9('0x4'));var rp=require(_0xf1d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf1d9('0x6'));var attributes=require(_0xf1d9('0x7'));module[_0xf1d9('0x8')]=function(_0x2f10de,_0x3e4408){return _0x2f10de[_0xf1d9('0x9')]('MailQueueReport',attributes,{'tableName':_0xf1d9('0xa'),'paranoid':![],'indexes':[{'name':_0xf1d9('0xb'),'fields':[_0xf1d9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e99=['exports','report_mail_queue','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./mailQueueReport.attributes'];(function(_0x28382e,_0x4c82ae){var _0xf2998a=function(_0x21f324){while(--_0x21f324){_0x28382e['push'](_0x28382e['shift']());}};_0xf2998a(++_0x4c82ae);}(_0x9e99,0x99));var _0x99e9=function(_0xfe10a1,_0x2a08dc){_0xfe10a1=_0xfe10a1-0x0;var _0x37028a=_0x9e99[_0xfe10a1];return _0x37028a;};'use strict';var _=require(_0x99e9('0x0'));var util=require('util');var logger=require(_0x99e9('0x1'))(_0x99e9('0x2'));var moment=require('moment');var BPromise=require(_0x99e9('0x3'));var rp=require(_0x99e9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x99e9('0x5'));var attributes=require(_0x99e9('0x6'));module[_0x99e9('0x7')]=function(_0x2bb1cf,_0x542dca){return _0x2bb1cf['define']('MailQueueReport',attributes,{'tableName':_0x99e9('0x8'),'paranoid':![],'indexes':[{'name':_0x99e9('0x9'),'fields':[_0x99e9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8fdbae0..50078ac 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x522f90,_0x5b9824){var _0x747188=function(_0x37353e){while(--_0x37353e){_0x522f90['push'](_0x522f90['shift']());}};_0x747188(++_0x5b9824);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x2c6fe7,_0x122d06){var _0x4b6a0d=function(_0x3185a8){while(--_0x3185a8){_0x2c6fe7['push'](_0x2c6fe7['shift']());}};_0x4b6a0d(++_0x122d06);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index a975978..b282d11 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5ce143,_0x426112){var _0x3490ad=function(_0x38cbd8){while(--_0x38cbd8){_0x5ce143['push'](_0x5ce143['shift']());}};_0x3490ad(++_0x426112);}(_0xedd9,0xfc));var _0x9edd=function(_0x21b144,_0x48d472){_0x21b144=_0x21b144-0x0;var _0x2dbfb4=_0xedd9[_0x21b144];return _0x2dbfb4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1d7b87,_0x1da526){var _0x57e64d=function(_0x18060f){while(--_0x18060f){_0x1d7b87['push'](_0x1d7b87['shift']());}};_0x57e64d(++_0x1da526);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 72f9fc2..9e8106d 100644 --- a/server/api/mailServerIn/mailServerIn.attributes.js +++ b/server/api/mailServerIn/mailServerIn.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a6b=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x2df2e7,_0xb0d148){var _0x40d0dd=function(_0x4d1e9b){while(--_0x4d1e9b){_0x2df2e7['push'](_0x2df2e7['shift']());}};_0x40d0dd(++_0xb0d148);}(_0x5a6b,0x8b));var _0xb5a6=function(_0x1d34e5,_0x37f9c8){_0x1d34e5=_0x1d34e5-0x0;var _0x1b073f=_0x5a6b[_0x1d34e5];return _0x1b073f;};'use strict';var Sequelize=require(_0xb5a6('0x0'));module[_0xb5a6('0x1')]={'description':{'type':Sequelize[_0xb5a6('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb5a6('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb5a6('0x2')]},'password':{'type':Sequelize[_0xb5a6('0x2')]},'port':{'type':Sequelize[_0xb5a6('0x4')]},'tls':{'type':Sequelize[_0xb5a6('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xb5a6('0x5')},'connTimeout':{'type':Sequelize[_0xb5a6('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb5a6('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xb5a6('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc38b=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x6cef85,_0x3614e4){var _0x521f19=function(_0xb4398f){while(--_0xb4398f){_0x6cef85['push'](_0x6cef85['shift']());}};_0x521f19(++_0x3614e4);}(_0xc38b,0x192));var _0xbc38=function(_0x480801,_0x49d868){_0x480801=_0x480801-0x0;var _0x4d7c75=_0xc38b[_0x480801];return _0x4d7c75;};'use strict';var Sequelize=require(_0xbc38('0x0'));module[_0xbc38('0x1')]={'description':{'type':Sequelize[_0xbc38('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xbc38('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xbc38('0x2')]},'password':{'type':Sequelize[_0xbc38('0x2')]},'port':{'type':Sequelize[_0xbc38('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xbc38('0x2')],'defaultValue':_0xbc38('0x5')},'connTimeout':{'type':Sequelize[_0xbc38('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xbc38('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1982136..246b739 100644 --- a/server/api/mailServerIn/mailServerIn.model.js +++ b/server/api/mailServerIn/mailServerIn.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99d2=['exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x23bba9,_0x2dbee5){var _0x14e2b6=function(_0x133b26){while(--_0x133b26){_0x23bba9['push'](_0x23bba9['shift']());}};_0x14e2b6(++_0x2dbee5);}(_0x99d2,0x1c7));var _0x299d=function(_0x5b3ce4,_0x5130c6){_0x5b3ce4=_0x5b3ce4-0x0;var _0x4c13cf=_0x99d2[_0x5b3ce4];return _0x4c13cf;};'use strict';var _=require(_0x299d('0x0'));var util=require(_0x299d('0x1'));var logger=require(_0x299d('0x2'))(_0x299d('0x3'));var moment=require('moment');var BPromise=require(_0x299d('0x4'));var rp=require(_0x299d('0x5'));var fs=require('fs');var path=require(_0x299d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x299d('0x7')]=function(_0x28e5d2,_0x1c62e6){return _0x28e5d2[_0x299d('0x8')](_0x299d('0x9'),attributes,{'tableName':_0x299d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0bf=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','MailServerIn','mail_servers_in','util'];(function(_0x498b38,_0x2d9583){var _0x10feb7=function(_0x5a4949){while(--_0x5a4949){_0x498b38['push'](_0x498b38['shift']());}};_0x10feb7(++_0x2d9583);}(_0xf0bf,0x1f3));var _0xff0b=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xf0bf[_0x59d0cc];return _0x2ae79f;};'use strict';var _=require('lodash');var util=require(_0xff0b('0x0'));var logger=require(_0xff0b('0x1'))(_0xff0b('0x2'));var moment=require('moment');var BPromise=require(_0xff0b('0x3'));var rp=require(_0xff0b('0x4'));var fs=require('fs');var path=require(_0xff0b('0x5'));var rimraf=require(_0xff0b('0x6'));var config=require(_0xff0b('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x3c4ab4,_0x352252){return _0x3c4ab4['define'](_0xff0b('0x8'),attributes,{'tableName':_0xff0b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 4cca4b4..a30a8db 100644 --- a/server/api/mailServerIn/mailServerIn.rpc.js +++ b/server/api/mailServerIn/mailServerIn.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea70=['info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x5541b3,_0x2c8973){var _0x5884aa=function(_0x47fb48){while(--_0x47fb48){_0x5541b3['push'](_0x5541b3['shift']());}};_0x5884aa(++_0x2c8973);}(_0xea70,0x175));var _0x0ea7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea70[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var moment=require(_0x0ea7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ea7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ea7('0x5'))(_0x0ea7('0x6'));var config=require(_0x0ea7('0x7'));var jayson=require(_0x0ea7('0x8'));var client=jayson[_0x0ea7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144497,_0x1ebefe,_0x51b516){return new BPromise(function(_0x48dedd,_0xc97410){return client['request'](_0x144497,_0x51b516)[_0x0ea7('0xa')](function(_0x107f04){logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,'request\x20sent');logger[_0x0ea7('0xd')](_0x0ea7('0xe'),_0x1ebefe,_0x0ea7('0xf'),JSON[_0x0ea7('0x10')](_0x107f04));if(_0x107f04[_0x0ea7('0x11')]){if(_0x107f04['error'][_0x0ea7('0x12')]===0x1f4){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04['error']['message']);return _0xc97410(_0x107f04['error'][_0x0ea7('0x13')]);}logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04[_0x0ea7('0x11')]['message']);return _0x48dedd(_0x107f04['error']['message']);}else{logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,_0x0ea7('0xf'));_0x48dedd(_0x107f04['result']['message']);}})[_0x0ea7('0x14')](function(_0x2aa4e9){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x2aa4e9);_0xc97410(_0x2aa4e9);});});}exports[_0x0ea7('0x15')]=function(_0x987032){var _0x1b1cb5=this;return new Promise(function(_0x48f10a,_0x4deb29){return db[_0x0ea7('0x16')][_0x0ea7('0x17')]({'raw':_0x987032['options']?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x19')]===undefined?!![]:![]:!![],'where':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x1a')]||null:null,'attributes':_0x987032[_0x0ea7('0x18')]?_0x987032['options'][_0x0ea7('0x1b')]||null:null,'limit':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x1c')]||null:null,'include':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x1d')]?_[_0x0ea7('0x1e')](_0x987032['options'][_0x0ea7('0x1d')],function(_0x2a0f71){return{'model':db[_0x2a0f71[_0x0ea7('0x1f')]],'as':_0x2a0f71['as'],'attributes':_0x2a0f71['attributes'],'include':_0x2a0f71[_0x0ea7('0x1d')]?_[_0x0ea7('0x1e')](_0x2a0f71['include'],function(_0x3ba808){return{'model':db[_0x3ba808['model']],'as':_0x3ba808['as'],'attributes':_0x3ba808['attributes'],'include':_0x3ba808['include']?_[_0x0ea7('0x1e')](_0x3ba808[_0x0ea7('0x1d')],function(_0x462715){return{'model':db[_0x462715['model']],'as':_0x462715['as'],'attributes':_0x462715[_0x0ea7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0ea7('0xa')](function(_0x608119){logger[_0x0ea7('0xb')](_0x0ea7('0x15'),_0x987032);logger[_0x0ea7('0xd')](_0x0ea7('0x15'),_0x987032,JSON[_0x0ea7('0x10')](_0x608119));_0x48f10a(_0x608119);})['catch'](function(_0x27e9fd){logger[_0x0ea7('0x11')]('GetMailServerIn',_0x27e9fd[_0x0ea7('0x13')],_0x987032);_0x4deb29(_0x1b1cb5[_0x0ea7('0x11')](0x1f4,_0x27e9fd[_0x0ea7('0x13')]));});});}; \ No newline at end of file +var _0xbb35=['jayson/promise','client','http','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailServerIn','options','raw','where','limit','include','map','model','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1ff92d,_0x3bfdeb){var _0x129a98=function(_0x45a90b){while(--_0x45a90b){_0x1ff92d['push'](_0x1ff92d['shift']());}};_0x129a98(++_0x3bfdeb);}(_0xbb35,0x88));var _0x5bb3=function(_0xbfc9a7,_0x3ff6fb){_0xbfc9a7=_0xbfc9a7-0x0;var _0x1140e3=_0xbb35[_0xbfc9a7];return _0x1140e3;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var moment=require(_0x5bb3('0x1'));var BPromise=require(_0x5bb3('0x2'));var rs=require(_0x5bb3('0x3'));var fs=require('fs');var Redis=require(_0x5bb3('0x4'));var db=require(_0x5bb3('0x5'))['db'];var utils=require(_0x5bb3('0x6'));var logger=require(_0x5bb3('0x7'))('rpc');var config=require(_0x5bb3('0x8'));var jayson=require(_0x5bb3('0x9'));var client=jayson[_0x5bb3('0xa')][_0x5bb3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e7ae3,_0x8af987,_0x1b5307){return new BPromise(function(_0x19d5e6,_0x53cb89){return client['request'](_0x4e7ae3,_0x1b5307)['then'](function(_0x501589){logger[_0x5bb3('0xc')](_0x5bb3('0xd'),_0x8af987,'request\x20sent');logger[_0x5bb3('0xe')](_0x5bb3('0xf'),_0x8af987,'request\x20sent',JSON[_0x5bb3('0x10')](_0x501589));if(_0x501589[_0x5bb3('0x11')]){if(_0x501589[_0x5bb3('0x11')][_0x5bb3('0x12')]===0x1f4){logger[_0x5bb3('0x11')](_0x5bb3('0xd'),_0x8af987,_0x501589[_0x5bb3('0x11')][_0x5bb3('0x13')]);return _0x53cb89(_0x501589[_0x5bb3('0x11')][_0x5bb3('0x13')]);}logger[_0x5bb3('0x11')](_0x5bb3('0xd'),_0x8af987,_0x501589[_0x5bb3('0x11')][_0x5bb3('0x13')]);return _0x19d5e6(_0x501589[_0x5bb3('0x11')][_0x5bb3('0x13')]);}else{logger[_0x5bb3('0xc')]('MailServerIn,\x20%s,\x20%s',_0x8af987,'request\x20sent');_0x19d5e6(_0x501589['result'][_0x5bb3('0x13')]);}})['catch'](function(_0x591c40){logger['error']('MailServerIn,\x20%s,\x20%s',_0x8af987,_0x591c40);_0x53cb89(_0x591c40);});});}exports[_0x5bb3('0x14')]=function(_0x27b88f){var _0x588ca7=this;return new Promise(function(_0x22547a,_0x3dee69){return db['MailServerIn']['findAll']({'raw':_0x27b88f['options']?_0x27b88f[_0x5bb3('0x15')][_0x5bb3('0x16')]===undefined?!![]:![]:!![],'where':_0x27b88f[_0x5bb3('0x15')]?_0x27b88f[_0x5bb3('0x15')][_0x5bb3('0x17')]||null:null,'attributes':_0x27b88f[_0x5bb3('0x15')]?_0x27b88f[_0x5bb3('0x15')]['attributes']||null:null,'limit':_0x27b88f['options']?_0x27b88f[_0x5bb3('0x15')][_0x5bb3('0x18')]||null:null,'include':_0x27b88f[_0x5bb3('0x15')]?_0x27b88f[_0x5bb3('0x15')][_0x5bb3('0x19')]?_[_0x5bb3('0x1a')](_0x27b88f['options'][_0x5bb3('0x19')],function(_0x5b99e1){return{'model':db[_0x5b99e1[_0x5bb3('0x1b')]],'as':_0x5b99e1['as'],'attributes':_0x5b99e1[_0x5bb3('0x1c')],'include':_0x5b99e1[_0x5bb3('0x19')]?_[_0x5bb3('0x1a')](_0x5b99e1[_0x5bb3('0x19')],function(_0x5ad827){return{'model':db[_0x5ad827[_0x5bb3('0x1b')]],'as':_0x5ad827['as'],'attributes':_0x5ad827['attributes'],'include':_0x5ad827[_0x5bb3('0x19')]?_['map'](_0x5ad827['include'],function(_0x4b0efb){return{'model':db[_0x4b0efb[_0x5bb3('0x1b')]],'as':_0x4b0efb['as'],'attributes':_0x4b0efb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dc16f){logger[_0x5bb3('0xc')](_0x5bb3('0x14'),_0x27b88f);logger['debug'](_0x5bb3('0x14'),_0x27b88f,JSON['stringify'](_0x2dc16f));_0x22547a(_0x2dc16f);})['catch'](function(_0x38ced4){logger[_0x5bb3('0x11')](_0x5bb3('0x14'),_0x38ced4[_0x5bb3('0x13')],_0x27b88f);_0x3dee69(_0x588ca7[_0x5bb3('0x11')](0x1f4,_0x38ced4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 07e8fd4..363c89b 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7a54,0x106));var _0x47a5=function(_0x262f76,_0x29e9af){_0x262f76=_0x262f76-0x0;var _0x2375a8=_0x7a54[_0x262f76];return _0x2375a8;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index f2ee842..35c5bdf 100644 --- a/server/api/mailServerOut/mailServerOut.attributes.js +++ b/server/api/mailServerOut/mailServerOut.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3de3=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x2ae240,_0x4a158b){var _0x3789f0=function(_0x2165a2){while(--_0x2165a2){_0x2ae240['push'](_0x2ae240['shift']());}};_0x3789f0(++_0x4a158b);}(_0x3de3,0x1ce));var _0x33de=function(_0x43a2ca,_0x4014b4){_0x43a2ca=_0x43a2ca-0x0;var _0x40ef89=_0x3de3[_0x43a2ca];return _0x40ef89;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'description':{'type':Sequelize[_0x33de('0x1')]},'host':{'type':Sequelize[_0x33de('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x33de('0x1')]},'port':{'type':Sequelize[_0x33de('0x2')]},'secure':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x33de('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x087b=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x2fc5ce,_0x177847){var _0xcb2f1=function(_0xc56076){while(--_0xc56076){_0x2fc5ce['push'](_0x2fc5ce['shift']());}};_0xcb2f1(++_0x177847);}(_0x087b,0x11a));var _0xb087=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x087b[_0x47fd36];return _0x21a0fc;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xb087('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xb087('0x3')]},'secure':{'type':Sequelize[_0xb087('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xb087('0x2')]},'authentication':{'type':Sequelize[_0xb087('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xb087('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index f0a2b72..8d64140 100644 --- a/server/api/mailServerOut/mailServerOut.controller.js +++ b/server/api/mailServerOut/mailServerOut.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc27=['update','then','destroy','error','stack','name','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x2cd2db,_0x590227){var _0xde6140=function(_0x19c020){while(--_0x19c020){_0x2cd2db['push'](_0x2cd2db['shift']());}};_0xde6140(++_0x590227);}(_0xbc27,0x1dd));var _0x7bc2=function(_0x2a27be,_0x5db239){_0x2a27be=_0x2a27be-0x0;var _0x4f9558=_0xbc27[_0x2a27be];return _0x4f9558;};'use strict';var emlformat=require(_0x7bc2('0x0'));var rimraf=require(_0x7bc2('0x1'));var zipdir=require(_0x7bc2('0x2'));var jsonpatch=require(_0x7bc2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bc2('0x4'));var Mustache=require(_0x7bc2('0x5'));var util=require('util');var path=require(_0x7bc2('0x6'));var sox=require(_0x7bc2('0x7'));var csv=require(_0x7bc2('0x8'));var ejs=require(_0x7bc2('0x9'));var fs=require('fs');var fs_extra=require(_0x7bc2('0xa'));var _=require('lodash');var squel=require(_0x7bc2('0xb'));var crypto=require(_0x7bc2('0xc'));var jsforce=require(_0x7bc2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bc2('0xe'));var Redis=require(_0x7bc2('0xf'));var authService=require(_0x7bc2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7bc2('0x11'));var hardwareService=require(_0x7bc2('0x12'));var logger=require('../../config/logger')(_0x7bc2('0x13'));var utils=require(_0x7bc2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7bc2('0x15'));var db=require(_0x7bc2('0x16'))['db'];function respondWithStatusCode(_0x16afd9,_0x37301e){_0x37301e=_0x37301e||0xcc;return function(_0x2bea96){if(_0x2bea96){return _0x16afd9[_0x7bc2('0x17')](_0x37301e);}return _0x16afd9[_0x7bc2('0x18')](_0x37301e)['end']();};}function respondWithResult(_0x3d6e49,_0x2a891f){_0x2a891f=_0x2a891f||0xc8;return function(_0x59dce5){if(_0x59dce5){return _0x3d6e49['status'](_0x2a891f)[_0x7bc2('0x19')](_0x59dce5);}};}function respondWithFilteredResult(_0x22f339,_0x389c23){return function(_0xb10bd6){if(_0xb10bd6){var _0x48b749=typeof _0x389c23[_0x7bc2('0x1a')]===_0x7bc2('0x1b')&&typeof _0x389c23[_0x7bc2('0x1c')]===_0x7bc2('0x1b');var _0x35b491=_0xb10bd6[_0x7bc2('0x1d')];var _0xbe8872=_0x48b749?0x0:_0x389c23[_0x7bc2('0x1a')];var _0x3c68c4=_0x48b749?_0xb10bd6[_0x7bc2('0x1d')]:_0x389c23[_0x7bc2('0x1a')]+_0x389c23[_0x7bc2('0x1c')];var _0x3c48dd;if(_0x3c68c4>=_0x35b491){_0x3c68c4=_0x35b491;_0x3c48dd=0xc8;}else{_0x3c48dd=0xce;}_0x22f339[_0x7bc2('0x18')](_0x3c48dd);return _0x22f339['set'](_0x7bc2('0x1e'),_0xbe8872+'-'+_0x3c68c4+'/'+_0x35b491)[_0x7bc2('0x19')](_0xb10bd6);}return null;};}function patchUpdates(_0x1b6b04){return function(_0x15ae8f){try{jsonpatch[_0x7bc2('0x1f')](_0x15ae8f,_0x1b6b04,!![]);}catch(_0x331a4f){return BPromise[_0x7bc2('0x20')](_0x331a4f);}return _0x15ae8f[_0x7bc2('0x21')]();};}function saveUpdates(_0x51471c,_0x597edc){return function(_0x4ca6a1){if(_0x4ca6a1){return _0x4ca6a1[_0x7bc2('0x22')](_0x51471c)[_0x7bc2('0x23')](function(_0x32b527){return _0x32b527;});}return null;};}function removeEntity(_0x1e4df3,_0xfc9b){return function(_0x2ca92c){if(_0x2ca92c){return _0x2ca92c[_0x7bc2('0x24')]()[_0x7bc2('0x23')](function(){_0x1e4df3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bda08,_0x5cc818){return function(_0x3eb452){if(!_0x3eb452){_0x2bda08[_0x7bc2('0x17')](0x194);}return _0x3eb452;};}function handleError(_0x2ab3fe,_0x1e7fd9){_0x1e7fd9=_0x1e7fd9||0x1f4;return function(_0x2c6879){logger[_0x7bc2('0x25')](_0x2c6879[_0x7bc2('0x26')]);if(_0x2c6879[_0x7bc2('0x27')]){delete _0x2c6879['name'];}_0x2ab3fe[_0x7bc2('0x18')](_0x1e7fd9)['send'](_0x2c6879);};}exports[_0x7bc2('0x28')]=function(_0x50b340,_0x5ec284){var _0x4ae8ad={},_0x8c8d0a={},_0x45af09={'count':0x0,'rows':[]};var _0x4b371c=_[_0x7bc2('0x29')](db[_0x7bc2('0x2a')]['rawAttributes'],function(_0x1dd4aa){return{'name':_0x1dd4aa[_0x7bc2('0x2b')],'type':_0x1dd4aa[_0x7bc2('0x2c')][_0x7bc2('0x2d')]};});_0x8c8d0a[_0x7bc2('0x2e')]=_['map'](_0x4b371c,_0x7bc2('0x27'));_0x8c8d0a[_0x7bc2('0x2f')]=_[_0x7bc2('0x30')](_0x50b340[_0x7bc2('0x2f')]);_0x8c8d0a[_0x7bc2('0x31')]=_[_0x7bc2('0x32')](_0x8c8d0a[_0x7bc2('0x2e')],_0x8c8d0a[_0x7bc2('0x2f')]);_0x4ae8ad[_0x7bc2('0x33')]=_[_0x7bc2('0x32')](_0x8c8d0a[_0x7bc2('0x2e')],qs[_0x7bc2('0x34')](_0x50b340[_0x7bc2('0x2f')][_0x7bc2('0x34')]));_0x4ae8ad['attributes']=_0x4ae8ad[_0x7bc2('0x33')][_0x7bc2('0x35')]?_0x4ae8ad['attributes']:_0x8c8d0a[_0x7bc2('0x2e')];if(!_0x50b340['query'][_0x7bc2('0x36')](_0x7bc2('0x37'))){_0x4ae8ad['limit']=qs[_0x7bc2('0x1c')](_0x50b340['query'][_0x7bc2('0x1c')]);_0x4ae8ad[_0x7bc2('0x1a')]=qs[_0x7bc2('0x1a')](_0x50b340[_0x7bc2('0x2f')]['offset']);}_0x4ae8ad[_0x7bc2('0x38')]=qs[_0x7bc2('0x39')](_0x50b340['query'][_0x7bc2('0x39')]);_0x4ae8ad[_0x7bc2('0x3a')]=qs[_0x7bc2('0x31')](_[_0x7bc2('0x3b')](_0x50b340[_0x7bc2('0x2f')],_0x8c8d0a[_0x7bc2('0x31')]),_0x4b371c);if(_0x50b340['query']['filter']){_0x4ae8ad[_0x7bc2('0x3a')]=_[_0x7bc2('0x3c')](_0x4ae8ad[_0x7bc2('0x3a')],{'$or':_[_0x7bc2('0x29')](_0x4b371c,function(_0x2262e9){if(_0x2262e9[_0x7bc2('0x2c')]!==_0x7bc2('0x3d')){var _0x36d127={};_0x36d127[_0x2262e9[_0x7bc2('0x27')]]={'$like':'%'+_0x50b340[_0x7bc2('0x2f')][_0x7bc2('0x3e')]+'%'};return _0x36d127;}})});}_0x4ae8ad=_['merge']({},_0x4ae8ad,_0x50b340[_0x7bc2('0x3f')]);var _0x255ecf={'where':_0x4ae8ad[_0x7bc2('0x3a')]};return db[_0x7bc2('0x2a')][_0x7bc2('0x1d')](_0x255ecf)['then'](function(_0x994026){_0x45af09['count']=_0x994026;if(_0x50b340[_0x7bc2('0x2f')][_0x7bc2('0x40')]){_0x4ae8ad['include']=[{'all':!![]}];}return db[_0x7bc2('0x2a')][_0x7bc2('0x41')](_0x4ae8ad);})[_0x7bc2('0x23')](function(_0x27b7aa){_0x45af09['rows']=_0x27b7aa;return _0x45af09;})[_0x7bc2('0x23')](respondWithFilteredResult(_0x5ec284,_0x4ae8ad))[_0x7bc2('0x42')](handleError(_0x5ec284,null));};exports[_0x7bc2('0x43')]=function(_0x197db7,_0x3e48eb){var _0x1def0e={'raw':!![],'where':{'id':_0x197db7[_0x7bc2('0x44')]['id']}},_0x472367={};_0x472367[_0x7bc2('0x2e')]=_[_0x7bc2('0x30')](db['MailServerOut'][_0x7bc2('0x45')]);_0x472367[_0x7bc2('0x2f')]=_[_0x7bc2('0x30')](_0x197db7[_0x7bc2('0x2f')]);_0x472367[_0x7bc2('0x31')]=_['intersection'](_0x472367[_0x7bc2('0x2e')],_0x472367[_0x7bc2('0x2f')]);_0x1def0e[_0x7bc2('0x33')]=_[_0x7bc2('0x32')](_0x472367[_0x7bc2('0x2e')],qs[_0x7bc2('0x34')](_0x197db7[_0x7bc2('0x2f')][_0x7bc2('0x34')]));_0x1def0e['attributes']=_0x1def0e['attributes'][_0x7bc2('0x35')]?_0x1def0e[_0x7bc2('0x33')]:_0x472367['model'];if(_0x197db7[_0x7bc2('0x2f')]['includeAll']){_0x1def0e[_0x7bc2('0x46')]=[{'all':!![]}];}_0x1def0e=_[_0x7bc2('0x3c')]({},_0x1def0e,_0x197db7[_0x7bc2('0x3f')]);return db[_0x7bc2('0x2a')]['find'](_0x1def0e)[_0x7bc2('0x23')](handleEntityNotFound(_0x3e48eb,null))['then'](respondWithResult(_0x3e48eb,null))[_0x7bc2('0x42')](handleError(_0x3e48eb,null));};exports['create']=function(_0x69e285,_0x36e9ee){return db[_0x7bc2('0x2a')]['create'](_0x69e285[_0x7bc2('0x47')],{})['then'](respondWithResult(_0x36e9ee,0xc9))['catch'](handleError(_0x36e9ee,null));};exports[_0x7bc2('0x22')]=function(_0x21ec36,_0x5dde55){if(_0x21ec36[_0x7bc2('0x47')]['id']){delete _0x21ec36['body']['id'];}return db[_0x7bc2('0x2a')][_0x7bc2('0x48')]({'where':{'id':_0x21ec36['params']['id']}})['then'](handleEntityNotFound(_0x5dde55,null))['then'](saveUpdates(_0x21ec36[_0x7bc2('0x47')],null))[_0x7bc2('0x23')](respondWithResult(_0x5dde55,null))['catch'](handleError(_0x5dde55,null));};exports[_0x7bc2('0x24')]=function(_0x52897a,_0x46fe26){return db[_0x7bc2('0x2a')][_0x7bc2('0x48')]({'where':{'id':_0x52897a[_0x7bc2('0x44')]['id']}})['then'](handleEntityNotFound(_0x46fe26,null))[_0x7bc2('0x23')](removeEntity(_0x46fe26,null))[_0x7bc2('0x42')](handleError(_0x46fe26,null));}; \ No newline at end of file +var _0x6e4c=['stack','name','send','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','merge','options','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error'];(function(_0x55aaff,_0x219ab0){var _0x58c67d=function(_0x583506){while(--_0x583506){_0x55aaff['push'](_0x55aaff['shift']());}};_0x58c67d(++_0x219ab0);}(_0x6e4c,0xbc));var _0xc6e4=function(_0x43bed9,_0x26adca){_0x43bed9=_0x43bed9-0x0;var _0x27b03d=_0x6e4c[_0x43bed9];return _0x27b03d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6e4('0x0'));var zipdir=require(_0xc6e4('0x1'));var jsonpatch=require(_0xc6e4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6e4('0x3'));var Mustache=require(_0xc6e4('0x4'));var util=require(_0xc6e4('0x5'));var path=require(_0xc6e4('0x6'));var sox=require(_0xc6e4('0x7'));var csv=require(_0xc6e4('0x8'));var ejs=require(_0xc6e4('0x9'));var fs=require('fs');var fs_extra=require(_0xc6e4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc6e4('0xb'));var deskjs=require(_0xc6e4('0xc'));var toCsv=require(_0xc6e4('0x8'));var querystring=require(_0xc6e4('0xd'));var Papa=require(_0xc6e4('0xe'));var Redis=require(_0xc6e4('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc6e4('0x10'));var hardwareService=require(_0xc6e4('0x11'));var logger=require(_0xc6e4('0x12'))(_0xc6e4('0x13'));var utils=require(_0xc6e4('0x14'));var config=require(_0xc6e4('0x15'));var licenseUtil=require(_0xc6e4('0x16'));var db=require(_0xc6e4('0x17'))['db'];function respondWithStatusCode(_0x3148c6,_0x20c10e){_0x20c10e=_0x20c10e||0xcc;return function(_0x274b82){if(_0x274b82){return _0x3148c6[_0xc6e4('0x18')](_0x20c10e);}return _0x3148c6['status'](_0x20c10e)[_0xc6e4('0x19')]();};}function respondWithResult(_0x3a3b37,_0x16cce){_0x16cce=_0x16cce||0xc8;return function(_0x433039){if(_0x433039){return _0x3a3b37[_0xc6e4('0x1a')](_0x16cce)[_0xc6e4('0x1b')](_0x433039);}};}function respondWithFilteredResult(_0x5aad01,_0x5134dc){return function(_0x4eebe3){if(_0x4eebe3){var _0x4b64aa=typeof _0x5134dc[_0xc6e4('0x1c')]===_0xc6e4('0x1d')&&typeof _0x5134dc['limit']===_0xc6e4('0x1d');var _0xa38827=_0x4eebe3[_0xc6e4('0x1e')];var _0x47d5a7=_0x4b64aa?0x0:_0x5134dc[_0xc6e4('0x1c')];var _0x1dbc1a=_0x4b64aa?_0x4eebe3[_0xc6e4('0x1e')]:_0x5134dc['offset']+_0x5134dc[_0xc6e4('0x1f')];var _0x2ec474;if(_0x1dbc1a>=_0xa38827){_0x1dbc1a=_0xa38827;_0x2ec474=0xc8;}else{_0x2ec474=0xce;}_0x5aad01[_0xc6e4('0x1a')](_0x2ec474);return _0x5aad01[_0xc6e4('0x20')](_0xc6e4('0x21'),_0x47d5a7+'-'+_0x1dbc1a+'/'+_0xa38827)['json'](_0x4eebe3);}return null;};}function patchUpdates(_0x2dab86){return function(_0x2b3c58){try{jsonpatch['apply'](_0x2b3c58,_0x2dab86,!![]);}catch(_0x5cfd68){return BPromise[_0xc6e4('0x22')](_0x5cfd68);}return _0x2b3c58[_0xc6e4('0x23')]();};}function saveUpdates(_0x123ef5,_0x2baef3){return function(_0x5515d3){if(_0x5515d3){return _0x5515d3[_0xc6e4('0x24')](_0x123ef5)[_0xc6e4('0x25')](function(_0x24ad53){return _0x24ad53;});}return null;};}function removeEntity(_0x1a0f01,_0x446610){return function(_0x11c6d5){if(_0x11c6d5){return _0x11c6d5[_0xc6e4('0x26')]()['then'](function(){_0x1a0f01['status'](0xcc)[_0xc6e4('0x19')]();});}};}function handleEntityNotFound(_0x5a6ee0,_0x2bf6fa){return function(_0x4e6b2b){if(!_0x4e6b2b){_0x5a6ee0['sendStatus'](0x194);}return _0x4e6b2b;};}function handleError(_0x1c6d56,_0x3b0d58){_0x3b0d58=_0x3b0d58||0x1f4;return function(_0x69c8b9){logger[_0xc6e4('0x27')](_0x69c8b9[_0xc6e4('0x28')]);if(_0x69c8b9[_0xc6e4('0x29')]){delete _0x69c8b9[_0xc6e4('0x29')];}_0x1c6d56['status'](_0x3b0d58)[_0xc6e4('0x2a')](_0x69c8b9);};}exports['index']=function(_0x124aa9,_0x2afd7b){var _0x21930e={},_0x1a8c12={},_0x3b5ea3={'count':0x0,'rows':[]};var _0x2b3a01=_[_0xc6e4('0x2b')](db[_0xc6e4('0x2c')]['rawAttributes'],function(_0x51040a){return{'name':_0x51040a[_0xc6e4('0x2d')],'type':_0x51040a[_0xc6e4('0x2e')][_0xc6e4('0x2f')]};});_0x1a8c12[_0xc6e4('0x30')]=_[_0xc6e4('0x2b')](_0x2b3a01,_0xc6e4('0x29'));_0x1a8c12[_0xc6e4('0x31')]=_[_0xc6e4('0x32')](_0x124aa9[_0xc6e4('0x31')]);_0x1a8c12[_0xc6e4('0x33')]=_[_0xc6e4('0x34')](_0x1a8c12[_0xc6e4('0x30')],_0x1a8c12[_0xc6e4('0x31')]);_0x21930e[_0xc6e4('0x35')]=_[_0xc6e4('0x34')](_0x1a8c12['model'],qs[_0xc6e4('0x36')](_0x124aa9[_0xc6e4('0x31')]['fields']));_0x21930e[_0xc6e4('0x35')]=_0x21930e[_0xc6e4('0x35')][_0xc6e4('0x37')]?_0x21930e[_0xc6e4('0x35')]:_0x1a8c12[_0xc6e4('0x30')];if(!_0x124aa9[_0xc6e4('0x31')][_0xc6e4('0x38')](_0xc6e4('0x39'))){_0x21930e[_0xc6e4('0x1f')]=qs[_0xc6e4('0x1f')](_0x124aa9[_0xc6e4('0x31')][_0xc6e4('0x1f')]);_0x21930e[_0xc6e4('0x1c')]=qs[_0xc6e4('0x1c')](_0x124aa9[_0xc6e4('0x31')][_0xc6e4('0x1c')]);}_0x21930e[_0xc6e4('0x3a')]=qs[_0xc6e4('0x3b')](_0x124aa9[_0xc6e4('0x31')][_0xc6e4('0x3b')]);_0x21930e[_0xc6e4('0x3c')]=qs['filters'](_['pick'](_0x124aa9[_0xc6e4('0x31')],_0x1a8c12[_0xc6e4('0x33')]),_0x2b3a01);if(_0x124aa9[_0xc6e4('0x31')][_0xc6e4('0x3d')]){_0x21930e[_0xc6e4('0x3c')]=_['merge'](_0x21930e[_0xc6e4('0x3c')],{'$or':_[_0xc6e4('0x2b')](_0x2b3a01,function(_0xd06c05){if(_0xd06c05['type']!==_0xc6e4('0x3e')){var _0xc76079={};_0xc76079[_0xd06c05[_0xc6e4('0x29')]]={'$like':'%'+_0x124aa9[_0xc6e4('0x31')][_0xc6e4('0x3d')]+'%'};return _0xc76079;}})});}_0x21930e=_['merge']({},_0x21930e,_0x124aa9['options']);var _0x1c49a3={'where':_0x21930e[_0xc6e4('0x3c')]};return db['MailServerOut']['count'](_0x1c49a3)[_0xc6e4('0x25')](function(_0x80e14e){_0x3b5ea3[_0xc6e4('0x1e')]=_0x80e14e;if(_0x124aa9[_0xc6e4('0x31')][_0xc6e4('0x3f')]){_0x21930e['include']=[{'all':!![]}];}return db[_0xc6e4('0x2c')][_0xc6e4('0x40')](_0x21930e);})[_0xc6e4('0x25')](function(_0x44b2a7){_0x3b5ea3[_0xc6e4('0x41')]=_0x44b2a7;return _0x3b5ea3;})[_0xc6e4('0x25')](respondWithFilteredResult(_0x2afd7b,_0x21930e))[_0xc6e4('0x42')](handleError(_0x2afd7b,null));};exports[_0xc6e4('0x43')]=function(_0x3df2c3,_0x4d5c98){var _0x34aec4={'raw':!![],'where':{'id':_0x3df2c3[_0xc6e4('0x44')]['id']}},_0xb5dd6c={};_0xb5dd6c[_0xc6e4('0x30')]=_[_0xc6e4('0x32')](db['MailServerOut'][_0xc6e4('0x45')]);_0xb5dd6c[_0xc6e4('0x31')]=_[_0xc6e4('0x32')](_0x3df2c3[_0xc6e4('0x31')]);_0xb5dd6c[_0xc6e4('0x33')]=_[_0xc6e4('0x34')](_0xb5dd6c[_0xc6e4('0x30')],_0xb5dd6c[_0xc6e4('0x31')]);_0x34aec4[_0xc6e4('0x35')]=_['intersection'](_0xb5dd6c['model'],qs['fields'](_0x3df2c3[_0xc6e4('0x31')][_0xc6e4('0x36')]));_0x34aec4[_0xc6e4('0x35')]=_0x34aec4[_0xc6e4('0x35')][_0xc6e4('0x37')]?_0x34aec4[_0xc6e4('0x35')]:_0xb5dd6c[_0xc6e4('0x30')];if(_0x3df2c3[_0xc6e4('0x31')][_0xc6e4('0x3f')]){_0x34aec4[_0xc6e4('0x46')]=[{'all':!![]}];}_0x34aec4=_[_0xc6e4('0x47')]({},_0x34aec4,_0x3df2c3[_0xc6e4('0x48')]);return db['MailServerOut'][_0xc6e4('0x49')](_0x34aec4)[_0xc6e4('0x25')](handleEntityNotFound(_0x4d5c98,null))[_0xc6e4('0x25')](respondWithResult(_0x4d5c98,null))[_0xc6e4('0x42')](handleError(_0x4d5c98,null));};exports['create']=function(_0x1d277e,_0x30f872){return db[_0xc6e4('0x2c')][_0xc6e4('0x4a')](_0x1d277e[_0xc6e4('0x4b')],{})[_0xc6e4('0x25')](respondWithResult(_0x30f872,0xc9))['catch'](handleError(_0x30f872,null));};exports[_0xc6e4('0x24')]=function(_0x53c96f,_0x43206c){if(_0x53c96f[_0xc6e4('0x4b')]['id']){delete _0x53c96f['body']['id'];}return db[_0xc6e4('0x2c')][_0xc6e4('0x49')]({'where':{'id':_0x53c96f['params']['id']}})[_0xc6e4('0x25')](handleEntityNotFound(_0x43206c,null))['then'](saveUpdates(_0x53c96f[_0xc6e4('0x4b')],null))['then'](respondWithResult(_0x43206c,null))['catch'](handleError(_0x43206c,null));};exports[_0xc6e4('0x26')]=function(_0x44c8ce,_0x30345e){return db[_0xc6e4('0x2c')][_0xc6e4('0x49')]({'where':{'id':_0x44c8ce[_0xc6e4('0x44')]['id']}})[_0xc6e4('0x25')](handleEntityNotFound(_0x30345e,null))[_0xc6e4('0x25')](removeEntity(_0x30345e,null))[_0xc6e4('0x42')](handleError(_0x30345e,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4cacd88..70cc083 100644 --- a/server/api/mailServerOut/mailServerOut.model.js +++ b/server/api/mailServerOut/mailServerOut.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0323=['bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x42907e,_0x5de9c5){var _0x176db7=function(_0x5930e0){while(--_0x5930e0){_0x42907e['push'](_0x42907e['shift']());}};_0x176db7(++_0x5de9c5);}(_0x0323,0x134));var _0x3032=function(_0x31d9c6,_0x1c9109){_0x31d9c6=_0x31d9c6-0x0;var _0x1371c0=_0x0323[_0x31d9c6];return _0x1371c0;};'use strict';var _=require(_0x3032('0x0'));var util=require(_0x3032('0x1'));var logger=require(_0x3032('0x2'))(_0x3032('0x3'));var moment=require('moment');var BPromise=require(_0x3032('0x4'));var rp=require(_0x3032('0x5'));var fs=require('fs');var path=require(_0x3032('0x6'));var rimraf=require('rimraf');var config=require(_0x3032('0x7'));var attributes=require(_0x3032('0x8'));module[_0x3032('0x9')]=function(_0x592c52,_0x1adefb){return _0x592c52[_0x3032('0xa')](_0x3032('0xb'),attributes,{'tableName':_0x3032('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc90=['mail_servers_out','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerOut'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbc90,0x1d5));var _0x0bc9=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xbc90[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0bc9('0x0'))(_0x0bc9('0x1'));var moment=require(_0x0bc9('0x2'));var BPromise=require(_0x0bc9('0x3'));var rp=require(_0x0bc9('0x4'));var fs=require('fs');var path=require(_0x0bc9('0x5'));var rimraf=require(_0x0bc9('0x6'));var config=require(_0x0bc9('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x0bc9('0x8')]=function(_0x4a5dd9,_0x2b1b74){return _0x4a5dd9[_0x0bc9('0x9')](_0x0bc9('0xa'),attributes,{'tableName':_0x0bc9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 7723a94..b85844a 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3ed95e,_0x2d2d13){var _0x4ab531=function(_0x4823b4){while(--_0x4823b4){_0x3ed95e['push'](_0x3ed95e['shift']());}};_0x4ab531(++_0x2d2d13);}(_0xadb5,0xad));var _0x5adb=function(_0x23d4f5,_0x1af9c4){_0x23d4f5=_0x23d4f5-0x0;var _0x1563f3=_0xadb5[_0x23d4f5];return _0x1563f3;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1a0e4d,_0x477e6f){var _0x302af1=function(_0x412821){while(--_0x412821){_0x1a0e4d['push'](_0x1a0e4d['shift']());}};_0x302af1(++_0x477e6f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 04be328..17532af 100644 --- a/server/api/mailSubstatus/index.js +++ b/server/api/mailSubstatus/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe331=['path','connect-timeout','express','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util'];(function(_0x58cedc,_0x4d7b72){var _0x183884=function(_0x5b5473){while(--_0x5b5473){_0x58cedc['push'](_0x58cedc['shift']());}};_0x183884(++_0x4d7b72);}(_0xe331,0x18d));var _0x1e33=function(_0x2e8c9a,_0x1658f4){_0x2e8c9a=_0x2e8c9a-0x0;var _0xe24e6d=_0xe331[_0x2e8c9a];return _0xe24e6d;};'use strict';var multer=require(_0x1e33('0x0'));var util=require(_0x1e33('0x1'));var path=require(_0x1e33('0x2'));var timeout=require(_0x1e33('0x3'));var express=require(_0x1e33('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1e33('0x5'));var config=require('../../config/environment');var controller=require(_0x1e33('0x6'));router['get']('/',auth[_0x1e33('0x7')](),controller[_0x1e33('0x8')]);router[_0x1e33('0x9')](_0x1e33('0xa'),auth['isAuthenticated'](),controller[_0x1e33('0xb')]);router[_0x1e33('0x9')](_0x1e33('0xc'),auth[_0x1e33('0x7')](),controller[_0x1e33('0xd')]);router[_0x1e33('0xe')]('/',auth[_0x1e33('0x7')](),controller['create']);router[_0x1e33('0xf')](_0x1e33('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1e33('0x10')](_0x1e33('0xc'),auth[_0x1e33('0x7')](),controller[_0x1e33('0x11')]);module[_0x1e33('0x12')]=router; \ No newline at end of file +var _0xaedc=['/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index'];(function(_0x52a768,_0x44b395){var _0x2059d9=function(_0x224093){while(--_0x224093){_0x52a768['push'](_0x52a768['shift']());}};_0x2059d9(++_0x44b395);}(_0xaedc,0xfa));var _0xcaed=function(_0x4b1dcd,_0x24091c){_0x4b1dcd=_0x4b1dcd-0x0;var _0x4038bb=_0xaedc[_0x4b1dcd];return _0x4038bb;};'use strict';var multer=require(_0xcaed('0x0'));var util=require(_0xcaed('0x1'));var path=require(_0xcaed('0x2'));var timeout=require(_0xcaed('0x3'));var express=require(_0xcaed('0x4'));var router=express[_0xcaed('0x5')]();var fs_extra=require(_0xcaed('0x6'));var auth=require(_0xcaed('0x7'));var interaction=require(_0xcaed('0x8'));var config=require(_0xcaed('0x9'));var controller=require(_0xcaed('0xa'));router[_0xcaed('0xb')]('/',auth[_0xcaed('0xc')](),controller[_0xcaed('0xd')]);router[_0xcaed('0xb')](_0xcaed('0xe'),auth[_0xcaed('0xc')](),controller['describe']);router['get'](_0xcaed('0xf'),auth[_0xcaed('0xc')](),controller[_0xcaed('0x10')]);router[_0xcaed('0x11')]('/',auth[_0xcaed('0xc')](),controller[_0xcaed('0x12')]);router[_0xcaed('0x13')]('/:id',auth[_0xcaed('0xc')](),controller[_0xcaed('0x14')]);router[_0xcaed('0x15')]('/:id',auth[_0xcaed('0xc')](),controller[_0xcaed('0x16')]);module[_0xcaed('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index fa00425..4413cdc 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['exports','name','STRING','sequelize'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x5fab,0x177));var _0xb5fa=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x5fab[_0x320b8e];return _0x55a10a;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb5fa('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file +var _0x687b=['STRING','name','sequelize','exports'];(function(_0x3b79c4,_0x25f59d){var _0xb7fc89=function(_0x2b24ee){while(--_0x2b24ee){_0x3b79c4['push'](_0x3b79c4['shift']());}};_0xb7fc89(++_0x25f59d);}(_0x687b,0x14a));var _0xb687=function(_0x55cf9d,_0x2795b3){_0x55cf9d=_0x55cf9d-0x0;var _0x2fd425=_0x687b[_0x55cf9d];return _0x2fd425;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'unique':_0xb687('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index adcb32e..b676404 100644 --- a/server/api/mailSubstatus/mailSubstatus.controller.js +++ b/server/api/mailSubstatus/mailSubstatus.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8840=['attributes','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x8840,0x13c));var _0x0884=function(_0x36103d,_0x3453b9){_0x36103d=_0x36103d-0x0;var _0x4edadd=_0x8840[_0x36103d];return _0x4edadd;};'use strict';var emlformat=require(_0x0884('0x0'));var rimraf=require(_0x0884('0x1'));var zipdir=require(_0x0884('0x2'));var jsonpatch=require(_0x0884('0x3'));var rp=require(_0x0884('0x4'));var moment=require('moment');var BPromise=require(_0x0884('0x5'));var Mustache=require('mustache');var util=require(_0x0884('0x6'));var path=require(_0x0884('0x7'));var sox=require(_0x0884('0x8'));var csv=require('to-csv');var ejs=require(_0x0884('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0884('0xa'));var squel=require(_0x0884('0xb'));var crypto=require(_0x0884('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0884('0xd'));var toCsv=require(_0x0884('0xe'));var querystring=require('querystring');var Papa=require(_0x0884('0xf'));var Redis=require('ioredis');var authService=require(_0x0884('0x10'));var qs=require(_0x0884('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0884('0x12'));var logger=require(_0x0884('0x13'))('api');var utils=require(_0x0884('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0884('0x15'));var db=require(_0x0884('0x16'))['db'];function respondWithStatusCode(_0x47f5c3,_0x40d3dc){_0x40d3dc=_0x40d3dc||0xcc;return function(_0xc6fcfc){if(_0xc6fcfc){return _0x47f5c3[_0x0884('0x17')](_0x40d3dc);}return _0x47f5c3[_0x0884('0x18')](_0x40d3dc)[_0x0884('0x19')]();};}function respondWithResult(_0x5a3735,_0x1e4162){_0x1e4162=_0x1e4162||0xc8;return function(_0x33c02a){if(_0x33c02a){return _0x5a3735['status'](_0x1e4162)[_0x0884('0x1a')](_0x33c02a);}};}function respondWithFilteredResult(_0x47ac37,_0x334ae8){return function(_0x21ba86){if(_0x21ba86){var _0x5add2b=typeof _0x334ae8[_0x0884('0x1b')]===_0x0884('0x1c')&&typeof _0x334ae8['limit']===_0x0884('0x1c');var _0x5ea3ef=_0x21ba86[_0x0884('0x1d')];var _0x429550=_0x5add2b?0x0:_0x334ae8[_0x0884('0x1b')];var _0x47e894=_0x5add2b?_0x21ba86[_0x0884('0x1d')]:_0x334ae8[_0x0884('0x1b')]+_0x334ae8[_0x0884('0x1e')];var _0x4ba0b5;if(_0x47e894>=_0x5ea3ef){_0x47e894=_0x5ea3ef;_0x4ba0b5=0xc8;}else{_0x4ba0b5=0xce;}_0x47ac37[_0x0884('0x18')](_0x4ba0b5);return _0x47ac37[_0x0884('0x1f')](_0x0884('0x20'),_0x429550+'-'+_0x47e894+'/'+_0x5ea3ef)[_0x0884('0x1a')](_0x21ba86);}return null;};}function patchUpdates(_0x34b5e9){return function(_0xaa777b){try{jsonpatch[_0x0884('0x21')](_0xaa777b,_0x34b5e9,!![]);}catch(_0x2c3e0c){return BPromise[_0x0884('0x22')](_0x2c3e0c);}return _0xaa777b[_0x0884('0x23')]();};}function saveUpdates(_0x5cc42b,_0x41617d){return function(_0x1766d3){if(_0x1766d3){return _0x1766d3[_0x0884('0x24')](_0x5cc42b)[_0x0884('0x25')](function(_0xbedf78){return _0xbedf78;});}return null;};}function removeEntity(_0x4c156e,_0x20dfc){return function(_0x244df7){if(_0x244df7){return _0x244df7[_0x0884('0x26')]()[_0x0884('0x25')](function(){_0x4c156e[_0x0884('0x18')](0xcc)[_0x0884('0x19')]();});}};}function handleEntityNotFound(_0x2f103b,_0x6e00f0){return function(_0x14bb3f){if(!_0x14bb3f){_0x2f103b[_0x0884('0x17')](0x194);}return _0x14bb3f;};}function handleError(_0x308c06,_0x434b2e){_0x434b2e=_0x434b2e||0x1f4;return function(_0x5071a8){logger[_0x0884('0x27')](_0x5071a8[_0x0884('0x28')]);if(_0x5071a8[_0x0884('0x29')]){delete _0x5071a8[_0x0884('0x29')];}_0x308c06[_0x0884('0x18')](_0x434b2e)['send'](_0x5071a8);};}exports[_0x0884('0x2a')]=function(_0x1cab8b,_0x5b7aee){var _0x2c4a43={},_0xcb389a={},_0x1d52af={'count':0x0,'rows':[]};var _0x1bc8b1=_[_0x0884('0x2b')](db[_0x0884('0x2c')]['rawAttributes'],function(_0x4c5d5a){return{'name':_0x4c5d5a[_0x0884('0x2d')],'type':_0x4c5d5a[_0x0884('0x2e')][_0x0884('0x2f')]};});_0xcb389a[_0x0884('0x30')]=_['map'](_0x1bc8b1,_0x0884('0x29'));_0xcb389a[_0x0884('0x31')]=_[_0x0884('0x32')](_0x1cab8b[_0x0884('0x31')]);_0xcb389a[_0x0884('0x33')]=_['intersection'](_0xcb389a[_0x0884('0x30')],_0xcb389a[_0x0884('0x31')]);_0x2c4a43['attributes']=_[_0x0884('0x34')](_0xcb389a[_0x0884('0x30')],qs[_0x0884('0x35')](_0x1cab8b[_0x0884('0x31')]['fields']));_0x2c4a43[_0x0884('0x36')]=_0x2c4a43['attributes']['length']?_0x2c4a43[_0x0884('0x36')]:_0xcb389a[_0x0884('0x30')];if(!_0x1cab8b[_0x0884('0x31')][_0x0884('0x37')](_0x0884('0x38'))){_0x2c4a43[_0x0884('0x1e')]=qs[_0x0884('0x1e')](_0x1cab8b[_0x0884('0x31')][_0x0884('0x1e')]);_0x2c4a43[_0x0884('0x1b')]=qs[_0x0884('0x1b')](_0x1cab8b['query'][_0x0884('0x1b')]);}_0x2c4a43[_0x0884('0x39')]=qs[_0x0884('0x3a')](_0x1cab8b[_0x0884('0x31')][_0x0884('0x3a')]);_0x2c4a43['where']=qs[_0x0884('0x33')](_['pick'](_0x1cab8b['query'],_0xcb389a[_0x0884('0x33')]),_0x1bc8b1);if(_0x1cab8b[_0x0884('0x31')][_0x0884('0x3b')]){_0x2c4a43['where']=_[_0x0884('0x3c')](_0x2c4a43[_0x0884('0x3d')],{'$or':_[_0x0884('0x2b')](_0x1bc8b1,function(_0x521d34){if(_0x521d34[_0x0884('0x2e')]!==_0x0884('0x3e')){var _0x5ecb55={};_0x5ecb55[_0x521d34[_0x0884('0x29')]]={'$like':'%'+_0x1cab8b['query'][_0x0884('0x3b')]+'%'};return _0x5ecb55;}})});}_0x2c4a43=_[_0x0884('0x3c')]({},_0x2c4a43,_0x1cab8b[_0x0884('0x3f')]);var _0x2cc2ea={'where':_0x2c4a43[_0x0884('0x3d')]};return db[_0x0884('0x2c')][_0x0884('0x1d')](_0x2cc2ea)['then'](function(_0x27f2a6){_0x1d52af[_0x0884('0x1d')]=_0x27f2a6;if(_0x1cab8b[_0x0884('0x31')][_0x0884('0x40')]){_0x2c4a43[_0x0884('0x41')]=[{'all':!![]}];}return db[_0x0884('0x2c')]['findAll'](_0x2c4a43);})[_0x0884('0x25')](function(_0x271d17){_0x1d52af[_0x0884('0x42')]=_0x271d17;return _0x1d52af;})[_0x0884('0x25')](respondWithFilteredResult(_0x5b7aee,_0x2c4a43))[_0x0884('0x43')](handleError(_0x5b7aee,null));};exports[_0x0884('0x44')]=function(_0x15e92f,_0x1a6c00){var _0x4ea8b4={'raw':!![],'where':{'id':_0x15e92f['params']['id']}},_0x4b5cee={};_0x4b5cee[_0x0884('0x30')]=_[_0x0884('0x32')](db[_0x0884('0x2c')]['rawAttributes']);_0x4b5cee['query']=_['keys'](_0x15e92f[_0x0884('0x31')]);_0x4b5cee['filters']=_[_0x0884('0x34')](_0x4b5cee[_0x0884('0x30')],_0x4b5cee['query']);_0x4ea8b4[_0x0884('0x36')]=_[_0x0884('0x34')](_0x4b5cee[_0x0884('0x30')],qs[_0x0884('0x35')](_0x15e92f['query'][_0x0884('0x35')]));_0x4ea8b4['attributes']=_0x4ea8b4[_0x0884('0x36')]['length']?_0x4ea8b4[_0x0884('0x36')]:_0x4b5cee[_0x0884('0x30')];if(_0x15e92f['query']['includeAll']){_0x4ea8b4[_0x0884('0x41')]=[{'all':!![]}];}_0x4ea8b4=_[_0x0884('0x3c')]({},_0x4ea8b4,_0x15e92f[_0x0884('0x3f')]);return db[_0x0884('0x2c')][_0x0884('0x45')](_0x4ea8b4)[_0x0884('0x25')](handleEntityNotFound(_0x1a6c00,null))['then'](respondWithResult(_0x1a6c00,null))[_0x0884('0x43')](handleError(_0x1a6c00,null));};exports[_0x0884('0x46')]=function(_0x404fd8,_0x1f6de5){return db[_0x0884('0x2c')]['create'](_0x404fd8[_0x0884('0x47')],{})[_0x0884('0x25')](respondWithResult(_0x1f6de5,0xc9))['catch'](handleError(_0x1f6de5,null));};exports['update']=function(_0x212376,_0x4069d8){if(_0x212376[_0x0884('0x47')]['id']){delete _0x212376[_0x0884('0x47')]['id'];}return db[_0x0884('0x2c')][_0x0884('0x45')]({'where':{'id':_0x212376[_0x0884('0x48')]['id']}})[_0x0884('0x25')](handleEntityNotFound(_0x4069d8,null))[_0x0884('0x25')](saveUpdates(_0x212376['body'],null))[_0x0884('0x25')](respondWithResult(_0x4069d8,null))[_0x0884('0x43')](handleError(_0x4069d8,null));};exports[_0x0884('0x26')]=function(_0x54f683,_0x47684a){return db[_0x0884('0x2c')]['find']({'where':{'id':_0x54f683[_0x0884('0x48')]['id']}})[_0x0884('0x25')](handleEntityNotFound(_0x47684a,null))[_0x0884('0x25')](removeEntity(_0x47684a,null))['catch'](handleError(_0x47684a,null));};exports[_0x0884('0x49')]=function(_0x3fb59f,_0x36943a){return db[_0x0884('0x2c')][_0x0884('0x49')]()[_0x0884('0x25')](respondWithResult(_0x36943a,null))['catch'](handleError(_0x36943a,null));}; \ No newline at end of file +var _0xce6a=['hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','MailSubstatus','rawAttributes','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x962cfd,_0x1dc549){var _0x389071=function(_0x23efc7){while(--_0x23efc7){_0x962cfd['push'](_0x962cfd['shift']());}};_0x389071(++_0x1dc549);}(_0xce6a,0x1c8));var _0xace6=function(_0xfb3645,_0xcfe2c5){_0xfb3645=_0xfb3645-0x0;var _0x36aef8=_0xce6a[_0xfb3645];return _0x36aef8;};'use strict';var emlformat=require(_0xace6('0x0'));var rimraf=require(_0xace6('0x1'));var zipdir=require(_0xace6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xace6('0x3'));var moment=require(_0xace6('0x4'));var BPromise=require(_0xace6('0x5'));var Mustache=require(_0xace6('0x6'));var util=require(_0xace6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xace6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xace6('0x9'));var _=require(_0xace6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xace6('0xb'));var deskjs=require(_0xace6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xace6('0xd'));var qs=require(_0xace6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xace6('0xf'));var logger=require(_0xace6('0x10'))(_0xace6('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b91fd,_0x40def7){_0x40def7=_0x40def7||0xcc;return function(_0x44f8b7){if(_0x44f8b7){return _0x5b91fd[_0xace6('0x12')](_0x40def7);}return _0x5b91fd['status'](_0x40def7)[_0xace6('0x13')]();};}function respondWithResult(_0x187279,_0x1bda05){_0x1bda05=_0x1bda05||0xc8;return function(_0x109988){if(_0x109988){return _0x187279[_0xace6('0x14')](_0x1bda05)[_0xace6('0x15')](_0x109988);}};}function respondWithFilteredResult(_0x3a3954,_0x13fff0){return function(_0x129b46){if(_0x129b46){var _0x4a3dbd=typeof _0x13fff0[_0xace6('0x16')]===_0xace6('0x17')&&typeof _0x13fff0[_0xace6('0x18')]===_0xace6('0x17');var _0x559b35=_0x129b46[_0xace6('0x19')];var _0x345d31=_0x4a3dbd?0x0:_0x13fff0[_0xace6('0x16')];var _0x249e03=_0x4a3dbd?_0x129b46[_0xace6('0x19')]:_0x13fff0[_0xace6('0x16')]+_0x13fff0[_0xace6('0x18')];var _0x1b9e13;if(_0x249e03>=_0x559b35){_0x249e03=_0x559b35;_0x1b9e13=0xc8;}else{_0x1b9e13=0xce;}_0x3a3954[_0xace6('0x14')](_0x1b9e13);return _0x3a3954[_0xace6('0x1a')](_0xace6('0x1b'),_0x345d31+'-'+_0x249e03+'/'+_0x559b35)[_0xace6('0x15')](_0x129b46);}return null;};}function patchUpdates(_0x2817d8){return function(_0x4dc66f){try{jsonpatch[_0xace6('0x1c')](_0x4dc66f,_0x2817d8,!![]);}catch(_0x78f79){return BPromise[_0xace6('0x1d')](_0x78f79);}return _0x4dc66f[_0xace6('0x1e')]();};}function saveUpdates(_0x4796ca,_0x3e5921){return function(_0x2c7f93){if(_0x2c7f93){return _0x2c7f93[_0xace6('0x1f')](_0x4796ca)[_0xace6('0x20')](function(_0x2fcc29){return _0x2fcc29;});}return null;};}function removeEntity(_0x2944e9,_0x3fb3eb){return function(_0x365357){if(_0x365357){return _0x365357['destroy']()['then'](function(){_0x2944e9[_0xace6('0x14')](0xcc)[_0xace6('0x13')]();});}};}function handleEntityNotFound(_0x5e652d,_0x5002a6){return function(_0x34bcd1){if(!_0x34bcd1){_0x5e652d[_0xace6('0x12')](0x194);}return _0x34bcd1;};}function handleError(_0x56ba79,_0x3bf2fa){_0x3bf2fa=_0x3bf2fa||0x1f4;return function(_0x2536b6){logger['error'](_0x2536b6[_0xace6('0x21')]);if(_0x2536b6[_0xace6('0x22')]){delete _0x2536b6['name'];}_0x56ba79['status'](_0x3bf2fa)[_0xace6('0x23')](_0x2536b6);};}exports[_0xace6('0x24')]=function(_0x574a4d,_0x509f74){var _0x177e36={},_0x10d8d2={},_0x2a7b57={'count':0x0,'rows':[]};var _0x488c9d=_[_0xace6('0x25')](db[_0xace6('0x26')][_0xace6('0x27')],function(_0x5e3a93){return{'name':_0x5e3a93['fieldName'],'type':_0x5e3a93['type'][_0xace6('0x28')]};});_0x10d8d2['model']=_[_0xace6('0x25')](_0x488c9d,'name');_0x10d8d2[_0xace6('0x29')]=_['keys'](_0x574a4d[_0xace6('0x29')]);_0x10d8d2[_0xace6('0x2a')]=_[_0xace6('0x2b')](_0x10d8d2[_0xace6('0x2c')],_0x10d8d2[_0xace6('0x29')]);_0x177e36[_0xace6('0x2d')]=_[_0xace6('0x2b')](_0x10d8d2[_0xace6('0x2c')],qs[_0xace6('0x2e')](_0x574a4d[_0xace6('0x29')][_0xace6('0x2e')]));_0x177e36[_0xace6('0x2d')]=_0x177e36[_0xace6('0x2d')][_0xace6('0x2f')]?_0x177e36['attributes']:_0x10d8d2['model'];if(!_0x574a4d[_0xace6('0x29')][_0xace6('0x30')](_0xace6('0x31'))){_0x177e36[_0xace6('0x18')]=qs[_0xace6('0x18')](_0x574a4d[_0xace6('0x29')][_0xace6('0x18')]);_0x177e36[_0xace6('0x16')]=qs['offset'](_0x574a4d['query']['offset']);}_0x177e36[_0xace6('0x32')]=qs['sort'](_0x574a4d['query'][_0xace6('0x33')]);_0x177e36['where']=qs[_0xace6('0x2a')](_[_0xace6('0x34')](_0x574a4d[_0xace6('0x29')],_0x10d8d2[_0xace6('0x2a')]),_0x488c9d);if(_0x574a4d[_0xace6('0x29')][_0xace6('0x35')]){_0x177e36['where']=_[_0xace6('0x36')](_0x177e36[_0xace6('0x37')],{'$or':_[_0xace6('0x25')](_0x488c9d,function(_0x57a3ae){if(_0x57a3ae[_0xace6('0x38')]!==_0xace6('0x39')){var _0x5de40f={};_0x5de40f[_0x57a3ae[_0xace6('0x22')]]={'$like':'%'+_0x574a4d[_0xace6('0x29')][_0xace6('0x35')]+'%'};return _0x5de40f;}})});}_0x177e36=_[_0xace6('0x36')]({},_0x177e36,_0x574a4d[_0xace6('0x3a')]);var _0x5533a5={'where':_0x177e36['where']};return db[_0xace6('0x26')][_0xace6('0x19')](_0x5533a5)[_0xace6('0x20')](function(_0xf0844){_0x2a7b57[_0xace6('0x19')]=_0xf0844;if(_0x574a4d[_0xace6('0x29')][_0xace6('0x3b')]){_0x177e36['include']=[{'all':!![]}];}return db[_0xace6('0x26')][_0xace6('0x3c')](_0x177e36);})[_0xace6('0x20')](function(_0x962192){_0x2a7b57[_0xace6('0x3d')]=_0x962192;return _0x2a7b57;})[_0xace6('0x20')](respondWithFilteredResult(_0x509f74,_0x177e36))[_0xace6('0x3e')](handleError(_0x509f74,null));};exports[_0xace6('0x3f')]=function(_0x1d67b3,_0x4816b4){var _0x22ea82={'raw':!![],'where':{'id':_0x1d67b3[_0xace6('0x40')]['id']}},_0x5ddf0d={};_0x5ddf0d[_0xace6('0x2c')]=_['keys'](db['MailSubstatus'][_0xace6('0x27')]);_0x5ddf0d[_0xace6('0x29')]=_[_0xace6('0x41')](_0x1d67b3['query']);_0x5ddf0d[_0xace6('0x2a')]=_['intersection'](_0x5ddf0d[_0xace6('0x2c')],_0x5ddf0d[_0xace6('0x29')]);_0x22ea82[_0xace6('0x2d')]=_[_0xace6('0x2b')](_0x5ddf0d[_0xace6('0x2c')],qs[_0xace6('0x2e')](_0x1d67b3['query']['fields']));_0x22ea82[_0xace6('0x2d')]=_0x22ea82[_0xace6('0x2d')][_0xace6('0x2f')]?_0x22ea82[_0xace6('0x2d')]:_0x5ddf0d[_0xace6('0x2c')];if(_0x1d67b3[_0xace6('0x29')]['includeAll']){_0x22ea82[_0xace6('0x42')]=[{'all':!![]}];}_0x22ea82=_[_0xace6('0x36')]({},_0x22ea82,_0x1d67b3[_0xace6('0x3a')]);return db['MailSubstatus'][_0xace6('0x43')](_0x22ea82)[_0xace6('0x20')](handleEntityNotFound(_0x4816b4,null))[_0xace6('0x20')](respondWithResult(_0x4816b4,null))[_0xace6('0x3e')](handleError(_0x4816b4,null));};exports[_0xace6('0x44')]=function(_0x45ae88,_0x49950a){return db['MailSubstatus'][_0xace6('0x44')](_0x45ae88['body'],{})[_0xace6('0x20')](respondWithResult(_0x49950a,0xc9))['catch'](handleError(_0x49950a,null));};exports['update']=function(_0x2b940e,_0x313a2b){if(_0x2b940e['body']['id']){delete _0x2b940e['body']['id'];}return db[_0xace6('0x26')][_0xace6('0x43')]({'where':{'id':_0x2b940e[_0xace6('0x40')]['id']}})['then'](handleEntityNotFound(_0x313a2b,null))[_0xace6('0x20')](saveUpdates(_0x2b940e[_0xace6('0x45')],null))[_0xace6('0x20')](respondWithResult(_0x313a2b,null))[_0xace6('0x3e')](handleError(_0x313a2b,null));};exports[_0xace6('0x46')]=function(_0x4a215b,_0x308720){return db[_0xace6('0x26')][_0xace6('0x43')]({'where':{'id':_0x4a215b['params']['id']}})[_0xace6('0x20')](handleEntityNotFound(_0x308720,null))[_0xace6('0x20')](removeEntity(_0x308720,null))['catch'](handleError(_0x308720,null));};exports[_0xace6('0x47')]=function(_0x46df75,_0x5cdc70){return db[_0xace6('0x26')][_0xace6('0x47')]()[_0xace6('0x20')](respondWithResult(_0x5cdc70,null))[_0xace6('0x3e')](handleError(_0x5cdc70,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 67c1f14..a2e0b65 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8aa=['exports','events','../../mysqldb','MailSubstatus','update','emit','hook'];(function(_0x3c29a7,_0x1bec88){var _0x1482db=function(_0x4093f7){while(--_0x4093f7){_0x3c29a7['push'](_0x3c29a7['shift']());}};_0x1482db(++_0x1bec88);}(_0xc8aa,0x9b));var _0xac8a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc8aa[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0xac8a('0x0'));var MailSubstatus=require(_0xac8a('0x1'))['db'][_0xac8a('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xac8a('0x3')};function emitEvent(_0x5609d3){return function(_0x2a125c,_0x5bc570,_0x3f2994){MailSubstatusEvents[_0xac8a('0x4')](_0x5609d3+':'+_0x2a125c['id'],_0x2a125c);MailSubstatusEvents[_0xac8a('0x4')](_0x5609d3,_0x2a125c);_0x3f2994(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xac8a('0x5')](e,emitEvent(event));}}module[_0xac8a('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x65f7=['events','../../mysqldb','MailSubstatus','setMaxListeners','update','hasOwnProperty','hook','exports'];(function(_0x1d088a,_0x481c76){var _0x59b5ac=function(_0x487582){while(--_0x487582){_0x1d088a['push'](_0x1d088a['shift']());}};_0x59b5ac(++_0x481c76);}(_0x65f7,0xa8));var _0x765f=function(_0x2dfea8,_0x1fc7c5){_0x2dfea8=_0x2dfea8-0x0;var _0x4653b7=_0x65f7[_0x2dfea8];return _0x4653b7;};'use strict';var EventEmitter=require(_0x765f('0x0'));var MailSubstatus=require(_0x765f('0x1'))['db'][_0x765f('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x765f('0x3')](0x0);var events={'afterUpdate':_0x765f('0x4')};function emitEvent(_0x1bdb2e){return function(_0x33939a,_0x5d35e7,_0x1aee11){MailSubstatusEvents['emit'](_0x1bdb2e+':'+_0x33939a['id'],_0x33939a);MailSubstatusEvents['emit'](_0x1bdb2e,_0x33939a);_0x1aee11(null);};}for(var e in events){if(events[_0x765f('0x5')](e)){var event=events[e];MailSubstatus[_0x765f('0x6')](e,emitEvent(event));}}module[_0x765f('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 64ae119..7b4334e 100644 --- a/server/api/mailSubstatus/mailSubstatus.model.js +++ b/server/api/mailSubstatus/mailSubstatus.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0053=['MailSubstatus','update','name','mailSubstatus','_previousDataValues','then','catch','exports','models'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x0053,0x14b));var _0x3005=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0053[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x3005('0x0')]=function(_0x25a2d8){var _0xd0a3ea=_0x25a2d8[_0x3005('0x1')];return _0x25a2d8['define'](_0x3005('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x7ae3f2,_0x4bd8e8,_0x96a6cb){return _0xd0a3ea['Condition'][_0x3005('0x3')]({'value':_0x7ae3f2[_0x3005('0x4')]},{'where':{'field':_0x3005('0x5'),'value':_0x7ae3f2[_0x3005('0x6')][_0x3005('0x4')]}})[_0x3005('0x7')](function(){_0x96a6cb();})[_0x3005('0x8')](function(_0x1081eb){_0x96a6cb(_0x1081eb);});}}});}; \ No newline at end of file +var _0x1d66=['models','define','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports'];(function(_0xfbf699,_0x235ce1){var _0x3e8b28=function(_0x4b4a4f){while(--_0x4b4a4f){_0xfbf699['push'](_0xfbf699['shift']());}};_0x3e8b28(++_0x235ce1);}(_0x1d66,0x1c6));var _0x61d6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1d66[_0x122ef9];return _0x42fba0;};'use strict';var attributes=require(_0x61d6('0x0'));module[_0x61d6('0x1')]=function(_0x581302){var _0x4f4571=_0x581302[_0x61d6('0x2')];return _0x581302[_0x61d6('0x3')]('MailSubstatus',attributes,{'tableName':_0x61d6('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4de9da,_0x3d9f26,_0x104bfa){return _0x4f4571[_0x61d6('0x5')][_0x61d6('0x6')]({'value':_0x4de9da[_0x61d6('0x7')]},{'where':{'field':_0x61d6('0x8'),'value':_0x4de9da[_0x61d6('0x9')][_0x61d6('0x7')]}})[_0x61d6('0xa')](function(){_0x104bfa();})[_0x61d6('0xb')](function(_0x1a2b0b){_0x104bfa(_0x1a2b0b);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index ff1e318..f7ae917 100644 --- a/server/api/mailSubstatus/mailSubstatus.rpc.js +++ b/server/api/mailSubstatus/mailSubstatus.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3769=['then','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x19abc7,_0x5aadb6){var _0xc24f10=function(_0x16dd95){while(--_0x16dd95){_0x19abc7['push'](_0x19abc7['shift']());}};_0xc24f10(++_0x5aadb6);}(_0x3769,0x15c));var _0x9376=function(_0x108885,_0x4ce059){_0x108885=_0x108885-0x0;var _0x416c9b=_0x3769[_0x108885];return _0x416c9b;};'use strict';var _=require(_0x9376('0x0'));var util=require('util');var moment=require(_0x9376('0x1'));var BPromise=require(_0x9376('0x2'));var rs=require(_0x9376('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9376('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9376('0x5'))(_0x9376('0x6'));var config=require(_0x9376('0x7'));var jayson=require(_0x9376('0x8'));var client=jayson[_0x9376('0x9')][_0x9376('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fb666,_0x489455,_0x46c3bd){return new BPromise(function(_0x236aeb,_0x170d15){return client[_0x9376('0xb')](_0x2fb666,_0x46c3bd)[_0x9376('0xc')](function(_0x3a60b8){logger['info'](_0x9376('0xd'),_0x489455,_0x9376('0xe'));logger['debug'](_0x9376('0xf'),_0x489455,_0x9376('0xe'),JSON['stringify'](_0x3a60b8));if(_0x3a60b8['error']){if(_0x3a60b8[_0x9376('0x10')]['code']===0x1f4){logger[_0x9376('0x10')](_0x9376('0xd'),_0x489455,_0x3a60b8[_0x9376('0x10')][_0x9376('0x11')]);return _0x170d15(_0x3a60b8[_0x9376('0x10')][_0x9376('0x11')]);}logger[_0x9376('0x10')](_0x9376('0xd'),_0x489455,_0x3a60b8[_0x9376('0x10')][_0x9376('0x11')]);return _0x236aeb(_0x3a60b8[_0x9376('0x10')]['message']);}else{logger[_0x9376('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x489455,_0x9376('0xe'));_0x236aeb(_0x3a60b8[_0x9376('0x13')][_0x9376('0x11')]);}})['catch'](function(_0x34fced){logger[_0x9376('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x489455,_0x34fced);_0x170d15(_0x34fced);});});} \ No newline at end of file +var _0x1a93=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x57fa70,_0x3d8b79){var _0x39e896=function(_0x5cbf3a){while(--_0x5cbf3a){_0x57fa70['push'](_0x57fa70['shift']());}};_0x39e896(++_0x3d8b79);}(_0x1a93,0xa0));var _0x31a9=function(_0x58cb7a,_0x3ef62b){_0x58cb7a=_0x58cb7a-0x0;var _0x246cf1=_0x1a93[_0x58cb7a];return _0x246cf1;};'use strict';var _=require(_0x31a9('0x0'));var util=require(_0x31a9('0x1'));var moment=require(_0x31a9('0x2'));var BPromise=require(_0x31a9('0x3'));var rs=require(_0x31a9('0x4'));var fs=require('fs');var Redis=require(_0x31a9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x31a9('0x6'));var logger=require('../../config/logger')(_0x31a9('0x7'));var config=require('../../config/environment');var jayson=require(_0x31a9('0x8'));var client=jayson[_0x31a9('0x9')][_0x31a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bc299,_0x485763,_0x49f25c){return new BPromise(function(_0x470fd5,_0x5dc737){return client['request'](_0x2bc299,_0x49f25c)['then'](function(_0x24b30a){logger[_0x31a9('0xb')](_0x31a9('0xc'),_0x485763,_0x31a9('0xd'));logger['debug'](_0x31a9('0xe'),_0x485763,'request\x20sent',JSON[_0x31a9('0xf')](_0x24b30a));if(_0x24b30a['error']){if(_0x24b30a[_0x31a9('0x10')][_0x31a9('0x11')]===0x1f4){logger[_0x31a9('0x10')](_0x31a9('0xc'),_0x485763,_0x24b30a[_0x31a9('0x10')][_0x31a9('0x12')]);return _0x5dc737(_0x24b30a[_0x31a9('0x10')]['message']);}logger[_0x31a9('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x485763,_0x24b30a[_0x31a9('0x10')]['message']);return _0x470fd5(_0x24b30a[_0x31a9('0x10')][_0x31a9('0x12')]);}else{logger[_0x31a9('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x485763,_0x31a9('0xd'));_0x470fd5(_0x24b30a['result'][_0x31a9('0x12')]);}})[_0x31a9('0x13')](function(_0x248113){logger[_0x31a9('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x485763,_0x248113);_0x5dc737(_0x248113);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 66aaabd..624901f 100644 --- a/server/api/mailTransferReport/index.js +++ b/server/api/mailTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4888=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x31d012,_0x46b6f7){var _0x340687=function(_0x218f0c){while(--_0x218f0c){_0x31d012['push'](_0x31d012['shift']());}};_0x340687(++_0x46b6f7);}(_0x4888,0xd7));var _0x8488=function(_0x4e15f4,_0x5a72f2){_0x4e15f4=_0x4e15f4-0x0;var _0x5a9643=_0x4888[_0x4e15f4];return _0x5a9643;};'use strict';var multer=require(_0x8488('0x0'));var util=require(_0x8488('0x1'));var path=require(_0x8488('0x2'));var timeout=require(_0x8488('0x3'));var express=require('express');var router=express[_0x8488('0x4')]();var fs_extra=require(_0x8488('0x5'));var auth=require(_0x8488('0x6'));var interaction=require(_0x8488('0x7'));var config=require(_0x8488('0x8'));var controller=require(_0x8488('0x9'));router[_0x8488('0xa')]('/',auth[_0x8488('0xb')](),controller[_0x8488('0xc')]);router[_0x8488('0xa')](_0x8488('0xd'),auth[_0x8488('0xb')](),controller[_0x8488('0xe')]);router[_0x8488('0xa')](_0x8488('0xf'),auth['isAuthenticated'](),controller[_0x8488('0x10')]);router[_0x8488('0x11')]('/',auth[_0x8488('0xb')](),controller[_0x8488('0x12')]);router['put']('/:id',auth[_0x8488('0xb')](),controller[_0x8488('0x13')]);router[_0x8488('0x14')](_0x8488('0xf'),auth['isAuthenticated'](),controller[_0x8488('0x15')]);module[_0x8488('0x16')]=router; \ No newline at end of file +var _0xeb1f=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0xeb1f,0x12a));var _0xfeb1=function(_0x5ca160,_0x952390){_0x5ca160=_0x5ca160-0x0;var _0x5cb8e0=_0xeb1f[_0x5ca160];return _0x5cb8e0;};'use strict';var multer=require(_0xfeb1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfeb1('0x1'));var express=require(_0xfeb1('0x2'));var router=express[_0xfeb1('0x3')]();var fs_extra=require(_0xfeb1('0x4'));var auth=require(_0xfeb1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfeb1('0x6'));var controller=require(_0xfeb1('0x7'));router[_0xfeb1('0x8')]('/',auth[_0xfeb1('0x9')](),controller[_0xfeb1('0xa')]);router['get']('/describe',auth[_0xfeb1('0x9')](),controller[_0xfeb1('0xb')]);router[_0xfeb1('0x8')](_0xfeb1('0xc'),auth[_0xfeb1('0x9')](),controller['show']);router[_0xfeb1('0xd')]('/',auth[_0xfeb1('0x9')](),controller[_0xfeb1('0xe')]);router['put'](_0xfeb1('0xc'),auth[_0xfeb1('0x9')](),controller[_0xfeb1('0xf')]);router[_0xfeb1('0x10')](_0xfeb1('0xc'),auth['isAuthenticated'](),controller[_0xfeb1('0x11')]);module[_0xfeb1('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 1fb10aa..7329139 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x15cd14,_0x5624ec){var _0x54f603=function(_0x314bd3){while(--_0x314bd3){_0x15cd14['push'](_0x15cd14['shift']());}};_0x54f603(++_0x5624ec);}(_0x70e0,0x17b));var _0x070e=function(_0xc253c9,_0x2d2889){_0xc253c9=_0xc253c9-0x0;var _0x3a805c=_0x70e0[_0xc253c9];return _0x3a805c;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5b845b,_0x5f5cc0){_0x5b845b=_0x5b845b-0x0;var _0x9ffc64=_0x9bde[_0x5b845b];return _0x9ffc64;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 6fa4fc6..40a20b5 100644 --- a/server/api/mailTransferReport/mailTransferReport.controller.js +++ b/server/api/mailTransferReport/mailTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9507=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','MailTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','includeAll','show','params','rawAttributes','options','catch'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x9507,0x166));var _0x7950=function(_0x5f5657,_0x4cf3c2){_0x5f5657=_0x5f5657-0x0;var _0x29a276=_0x9507[_0x5f5657];return _0x29a276;};'use strict';var emlformat=require(_0x7950('0x0'));var rimraf=require(_0x7950('0x1'));var zipdir=require(_0x7950('0x2'));var jsonpatch=require(_0x7950('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7950('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7950('0x5'));var csv=require(_0x7950('0x6'));var ejs=require(_0x7950('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7950('0x8'));var squel=require(_0x7950('0x9'));var crypto=require(_0x7950('0xa'));var jsforce=require(_0x7950('0xb'));var deskjs=require(_0x7950('0xc'));var toCsv=require(_0x7950('0x6'));var querystring=require('querystring');var Papa=require(_0x7950('0xd'));var Redis=require(_0x7950('0xe'));var authService=require(_0x7950('0xf'));var qs=require(_0x7950('0x10'));var as=require(_0x7950('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7950('0x12'));var config=require(_0x7950('0x13'));var licenseUtil=require(_0x7950('0x14'));var db=require(_0x7950('0x15'))['db'];function respondWithStatusCode(_0x1b87d0,_0x5e8249){_0x5e8249=_0x5e8249||0xcc;return function(_0x220b97){if(_0x220b97){return _0x1b87d0[_0x7950('0x16')](_0x5e8249);}return _0x1b87d0[_0x7950('0x17')](_0x5e8249)['end']();};}function respondWithResult(_0x13db6e,_0x8c470e){_0x8c470e=_0x8c470e||0xc8;return function(_0x841fa7){if(_0x841fa7){return _0x13db6e[_0x7950('0x17')](_0x8c470e)[_0x7950('0x18')](_0x841fa7);}};}function respondWithFilteredResult(_0x51ff5e,_0x2333ba){return function(_0x472416){if(_0x472416){var _0x2dfb0c=typeof _0x2333ba[_0x7950('0x19')]===_0x7950('0x1a')&&typeof _0x2333ba[_0x7950('0x1b')]==='undefined';var _0x502e72=_0x472416[_0x7950('0x1c')];var _0x3b1e74=_0x2dfb0c?0x0:_0x2333ba[_0x7950('0x19')];var _0x406030=_0x2dfb0c?_0x472416[_0x7950('0x1c')]:_0x2333ba['offset']+_0x2333ba[_0x7950('0x1b')];var _0x24e37c;if(_0x406030>=_0x502e72){_0x406030=_0x502e72;_0x24e37c=0xc8;}else{_0x24e37c=0xce;}_0x51ff5e[_0x7950('0x17')](_0x24e37c);return _0x51ff5e[_0x7950('0x1d')](_0x7950('0x1e'),_0x3b1e74+'-'+_0x406030+'/'+_0x502e72)['json'](_0x472416);}return null;};}function patchUpdates(_0x4b0d5a){return function(_0x32554c){try{jsonpatch[_0x7950('0x1f')](_0x32554c,_0x4b0d5a,!![]);}catch(_0x267c38){return BPromise[_0x7950('0x20')](_0x267c38);}return _0x32554c[_0x7950('0x21')]();};}function saveUpdates(_0x48ca7a,_0x46ec0c){return function(_0xb16266){if(_0xb16266){return _0xb16266[_0x7950('0x22')](_0x48ca7a)['then'](function(_0x2ef4dd){return _0x2ef4dd;});}return null;};}function removeEntity(_0x15e52c,_0x44039d){return function(_0x42228f){if(_0x42228f){return _0x42228f[_0x7950('0x23')]()[_0x7950('0x24')](function(){_0x15e52c[_0x7950('0x17')](0xcc)[_0x7950('0x25')]();});}};}function handleEntityNotFound(_0x1c9151,_0x1cbd7a){return function(_0x1fd7df){if(!_0x1fd7df){_0x1c9151[_0x7950('0x16')](0x194);}return _0x1fd7df;};}function handleError(_0x519aa6,_0x32c6e8){_0x32c6e8=_0x32c6e8||0x1f4;return function(_0x6ed69f){logger[_0x7950('0x26')](_0x6ed69f[_0x7950('0x27')]);if(_0x6ed69f[_0x7950('0x28')]){delete _0x6ed69f[_0x7950('0x28')];}_0x519aa6[_0x7950('0x17')](_0x32c6e8)[_0x7950('0x29')](_0x6ed69f);};}exports[_0x7950('0x2a')]=function(_0x262aa0,_0x22080f){var _0x499376={},_0x23925d={},_0xa41e87={'count':0x0,'rows':[]};var _0x51a526=_[_0x7950('0x2b')](db[_0x7950('0x2c')]['rawAttributes'],function(_0x14cea9){return{'name':_0x14cea9[_0x7950('0x2d')],'type':_0x14cea9['type'][_0x7950('0x2e')]};});_0x23925d[_0x7950('0x2f')]=_['map'](_0x51a526,_0x7950('0x28'));_0x23925d[_0x7950('0x30')]=_[_0x7950('0x31')](_0x262aa0[_0x7950('0x30')]);_0x23925d[_0x7950('0x32')]=_[_0x7950('0x33')](_0x23925d['model'],_0x23925d[_0x7950('0x30')]);_0x499376[_0x7950('0x34')]=_['intersection'](_0x23925d[_0x7950('0x2f')],qs[_0x7950('0x35')](_0x262aa0[_0x7950('0x30')][_0x7950('0x35')]));_0x499376[_0x7950('0x34')]=_0x499376[_0x7950('0x34')][_0x7950('0x36')]?_0x499376[_0x7950('0x34')]:_0x23925d[_0x7950('0x2f')];if(!_0x262aa0[_0x7950('0x30')][_0x7950('0x37')]('nolimit')){_0x499376[_0x7950('0x1b')]=qs[_0x7950('0x1b')](_0x262aa0[_0x7950('0x30')][_0x7950('0x1b')]);_0x499376[_0x7950('0x19')]=qs[_0x7950('0x19')](_0x262aa0['query']['offset']);}_0x499376['order']=qs['sort'](_0x262aa0['query']['sort']);_0x499376[_0x7950('0x38')]=qs[_0x7950('0x32')](_[_0x7950('0x39')](_0x262aa0['query'],_0x23925d[_0x7950('0x32')]),_0x51a526);if(_0x262aa0[_0x7950('0x30')][_0x7950('0x3a')]){_0x499376[_0x7950('0x38')]=_[_0x7950('0x3b')](_0x499376['where'],{'$or':_[_0x7950('0x2b')](_0x51a526,function(_0xd112ff){if(_0xd112ff[_0x7950('0x3c')]!==_0x7950('0x3d')){var _0x37a8d7={};_0x37a8d7[_0xd112ff[_0x7950('0x28')]]={'$like':'%'+_0x262aa0[_0x7950('0x30')]['filter']+'%'};return _0x37a8d7;}})});}_0x499376=_[_0x7950('0x3b')]({},_0x499376,_0x262aa0['options']);var _0xef69bb={'where':_0x499376[_0x7950('0x38')]};return db[_0x7950('0x2c')][_0x7950('0x1c')](_0xef69bb)['then'](function(_0x24a2b7){_0xa41e87[_0x7950('0x1c')]=_0x24a2b7;if(_0x262aa0[_0x7950('0x30')][_0x7950('0x3e')]){_0x499376['include']=[{'all':!![]}];}return db[_0x7950('0x2c')]['findAll'](_0x499376);})[_0x7950('0x24')](function(_0x5d3c65){_0xa41e87['rows']=_0x5d3c65;return _0xa41e87;})[_0x7950('0x24')](respondWithFilteredResult(_0x22080f,_0x499376))['catch'](handleError(_0x22080f,null));};exports[_0x7950('0x3f')]=function(_0x2f4082,_0x17fb3f){var _0x1ac537={'raw':!![],'where':{'id':_0x2f4082[_0x7950('0x40')]['id']}},_0x43942a={};_0x43942a[_0x7950('0x2f')]=_[_0x7950('0x31')](db[_0x7950('0x2c')][_0x7950('0x41')]);_0x43942a[_0x7950('0x30')]=_['keys'](_0x2f4082[_0x7950('0x30')]);_0x43942a[_0x7950('0x32')]=_[_0x7950('0x33')](_0x43942a['model'],_0x43942a['query']);_0x1ac537[_0x7950('0x34')]=_[_0x7950('0x33')](_0x43942a[_0x7950('0x2f')],qs[_0x7950('0x35')](_0x2f4082[_0x7950('0x30')][_0x7950('0x35')]));_0x1ac537['attributes']=_0x1ac537[_0x7950('0x34')][_0x7950('0x36')]?_0x1ac537[_0x7950('0x34')]:_0x43942a[_0x7950('0x2f')];if(_0x2f4082[_0x7950('0x30')]['includeAll']){_0x1ac537['include']=[{'all':!![]}];}_0x1ac537=_[_0x7950('0x3b')]({},_0x1ac537,_0x2f4082[_0x7950('0x42')]);return db[_0x7950('0x2c')]['find'](_0x1ac537)['then'](handleEntityNotFound(_0x17fb3f,null))['then'](respondWithResult(_0x17fb3f,null))[_0x7950('0x43')](handleError(_0x17fb3f,null));};exports[_0x7950('0x44')]=function(_0x445541,_0x4a3a1b){return db[_0x7950('0x2c')]['create'](_0x445541[_0x7950('0x45')],{})[_0x7950('0x24')](respondWithResult(_0x4a3a1b,0xc9))[_0x7950('0x43')](handleError(_0x4a3a1b,null));};exports['update']=function(_0x4f426d,_0x27ee7f){if(_0x4f426d[_0x7950('0x45')]['id']){delete _0x4f426d[_0x7950('0x45')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x4f426d[_0x7950('0x40')]['id']}})[_0x7950('0x24')](handleEntityNotFound(_0x27ee7f,null))['then'](saveUpdates(_0x4f426d['body'],null))['then'](respondWithResult(_0x27ee7f,null))['catch'](handleError(_0x27ee7f,null));};exports[_0x7950('0x23')]=function(_0x402140,_0x39c45e){return db[_0x7950('0x2c')]['find']({'where':{'id':_0x402140[_0x7950('0x40')]['id']}})[_0x7950('0x24')](handleEntityNotFound(_0x39c45e,null))['then'](removeEntity(_0x39c45e,null))[_0x7950('0x43')](handleError(_0x39c45e,null));};exports[_0x7950('0x46')]=function(_0x5c4638,_0x462508){return db[_0x7950('0x2c')]['describe']()[_0x7950('0x24')](respondWithResult(_0x462508,null))[_0x7950('0x43')](handleError(_0x462508,null));}; \ No newline at end of file +var _0x207d=['body','update','params','describe','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','then','include','rows','catch','includeAll','find','create'];(function(_0xcecc7d,_0x2f2899){var _0x5883ba=function(_0x4f618d){while(--_0x4f618d){_0xcecc7d['push'](_0xcecc7d['shift']());}};_0x5883ba(++_0x2f2899);}(_0x207d,0xdf));var _0xd207=function(_0x3d2288,_0x32731a){_0x3d2288=_0x3d2288-0x0;var _0x50f7f2=_0x207d[_0x3d2288];return _0x50f7f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd207('0x0'));var jsonpatch=require(_0xd207('0x1'));var rp=require('request-promise');var moment=require(_0xd207('0x2'));var BPromise=require(_0xd207('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd207('0x4'));var sox=require(_0xd207('0x5'));var csv=require('to-csv');var ejs=require(_0xd207('0x6'));var fs=require('fs');var fs_extra=require(_0xd207('0x7'));var _=require(_0xd207('0x8'));var squel=require(_0xd207('0x9'));var crypto=require(_0xd207('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd207('0xb'));var querystring=require(_0xd207('0xc'));var Papa=require(_0xd207('0xd'));var Redis=require(_0xd207('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd207('0xf'));var as=require(_0xd207('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd207('0x11'))(_0xd207('0x12'));var utils=require(_0xd207('0x13'));var config=require(_0xd207('0x14'));var licenseUtil=require(_0xd207('0x15'));var db=require(_0xd207('0x16'))['db'];function respondWithStatusCode(_0x4f6752,_0x10454f){_0x10454f=_0x10454f||0xcc;return function(_0x26568e){if(_0x26568e){return _0x4f6752[_0xd207('0x17')](_0x10454f);}return _0x4f6752[_0xd207('0x18')](_0x10454f)[_0xd207('0x19')]();};}function respondWithResult(_0x25b1d4,_0x547ce5){_0x547ce5=_0x547ce5||0xc8;return function(_0x5ce91b){if(_0x5ce91b){return _0x25b1d4[_0xd207('0x18')](_0x547ce5)['json'](_0x5ce91b);}};}function respondWithFilteredResult(_0x5532cb,_0x125d76){return function(_0x3c7df5){if(_0x3c7df5){var _0x178cef=typeof _0x125d76[_0xd207('0x1a')]==='undefined'&&typeof _0x125d76[_0xd207('0x1b')]==='undefined';var _0x33a25e=_0x3c7df5[_0xd207('0x1c')];var _0x409bd0=_0x178cef?0x0:_0x125d76['offset'];var _0x5232bc=_0x178cef?_0x3c7df5[_0xd207('0x1c')]:_0x125d76[_0xd207('0x1a')]+_0x125d76[_0xd207('0x1b')];var _0x4765ae;if(_0x5232bc>=_0x33a25e){_0x5232bc=_0x33a25e;_0x4765ae=0xc8;}else{_0x4765ae=0xce;}_0x5532cb['status'](_0x4765ae);return _0x5532cb[_0xd207('0x1d')](_0xd207('0x1e'),_0x409bd0+'-'+_0x5232bc+'/'+_0x33a25e)[_0xd207('0x1f')](_0x3c7df5);}return null;};}function patchUpdates(_0x398a3d){return function(_0x29a4dd){try{jsonpatch[_0xd207('0x20')](_0x29a4dd,_0x398a3d,!![]);}catch(_0x2f46e0){return BPromise[_0xd207('0x21')](_0x2f46e0);}return _0x29a4dd[_0xd207('0x22')]();};}function saveUpdates(_0x5a338c,_0x5f3d0e){return function(_0x397637){if(_0x397637){return _0x397637['update'](_0x5a338c)['then'](function(_0x1d5321){return _0x1d5321;});}return null;};}function removeEntity(_0x3ef153,_0x1c6b45){return function(_0x55fc1c){if(_0x55fc1c){return _0x55fc1c[_0xd207('0x23')]()['then'](function(){_0x3ef153[_0xd207('0x18')](0xcc)[_0xd207('0x19')]();});}};}function handleEntityNotFound(_0x37a19c,_0x42a599){return function(_0x29135c){if(!_0x29135c){_0x37a19c['sendStatus'](0x194);}return _0x29135c;};}function handleError(_0x90dc4b,_0x1a2662){_0x1a2662=_0x1a2662||0x1f4;return function(_0x2d28eb){logger[_0xd207('0x24')](_0x2d28eb[_0xd207('0x25')]);if(_0x2d28eb[_0xd207('0x26')]){delete _0x2d28eb['name'];}_0x90dc4b[_0xd207('0x18')](_0x1a2662)[_0xd207('0x27')](_0x2d28eb);};}exports[_0xd207('0x28')]=function(_0x3738f4,_0x38aa70){var _0x5b9d79={},_0xbfc587={},_0x11a959={'count':0x0,'rows':[]};var _0x56f201=_['map'](db[_0xd207('0x29')][_0xd207('0x2a')],function(_0x1895be){return{'name':_0x1895be[_0xd207('0x2b')],'type':_0x1895be[_0xd207('0x2c')]['key']};});_0xbfc587[_0xd207('0x2d')]=_[_0xd207('0x2e')](_0x56f201,_0xd207('0x26'));_0xbfc587[_0xd207('0x2f')]=_[_0xd207('0x30')](_0x3738f4['query']);_0xbfc587[_0xd207('0x31')]=_[_0xd207('0x32')](_0xbfc587[_0xd207('0x2d')],_0xbfc587[_0xd207('0x2f')]);_0x5b9d79[_0xd207('0x33')]=_[_0xd207('0x32')](_0xbfc587['model'],qs[_0xd207('0x34')](_0x3738f4[_0xd207('0x2f')][_0xd207('0x34')]));_0x5b9d79['attributes']=_0x5b9d79[_0xd207('0x33')]['length']?_0x5b9d79[_0xd207('0x33')]:_0xbfc587[_0xd207('0x2d')];if(!_0x3738f4['query'][_0xd207('0x35')](_0xd207('0x36'))){_0x5b9d79['limit']=qs[_0xd207('0x1b')](_0x3738f4[_0xd207('0x2f')][_0xd207('0x1b')]);_0x5b9d79[_0xd207('0x1a')]=qs['offset'](_0x3738f4[_0xd207('0x2f')][_0xd207('0x1a')]);}_0x5b9d79[_0xd207('0x37')]=qs[_0xd207('0x38')](_0x3738f4[_0xd207('0x2f')][_0xd207('0x38')]);_0x5b9d79['where']=qs['filters'](_[_0xd207('0x39')](_0x3738f4[_0xd207('0x2f')],_0xbfc587[_0xd207('0x31')]),_0x56f201);if(_0x3738f4['query'][_0xd207('0x3a')]){_0x5b9d79['where']=_[_0xd207('0x3b')](_0x5b9d79[_0xd207('0x3c')],{'$or':_[_0xd207('0x2e')](_0x56f201,function(_0x83d4f0){if(_0x83d4f0[_0xd207('0x2c')]!=='VIRTUAL'){var _0xe593c9={};_0xe593c9[_0x83d4f0[_0xd207('0x26')]]={'$like':'%'+_0x3738f4[_0xd207('0x2f')][_0xd207('0x3a')]+'%'};return _0xe593c9;}})});}_0x5b9d79=_[_0xd207('0x3b')]({},_0x5b9d79,_0x3738f4[_0xd207('0x3d')]);var _0x27ccb9={'where':_0x5b9d79[_0xd207('0x3c')]};return db[_0xd207('0x29')][_0xd207('0x1c')](_0x27ccb9)[_0xd207('0x3e')](function(_0x25ce54){_0x11a959[_0xd207('0x1c')]=_0x25ce54;if(_0x3738f4[_0xd207('0x2f')]['includeAll']){_0x5b9d79[_0xd207('0x3f')]=[{'all':!![]}];}return db[_0xd207('0x29')]['findAll'](_0x5b9d79);})['then'](function(_0x1d2d5d){_0x11a959[_0xd207('0x40')]=_0x1d2d5d;return _0x11a959;})[_0xd207('0x3e')](respondWithFilteredResult(_0x38aa70,_0x5b9d79))[_0xd207('0x41')](handleError(_0x38aa70,null));};exports['show']=function(_0x41b94f,_0xe152d5){var _0x4e12bc={'raw':!![],'where':{'id':_0x41b94f['params']['id']}},_0x50928a={};_0x50928a['model']=_['keys'](db[_0xd207('0x29')][_0xd207('0x2a')]);_0x50928a[_0xd207('0x2f')]=_[_0xd207('0x30')](_0x41b94f[_0xd207('0x2f')]);_0x50928a['filters']=_[_0xd207('0x32')](_0x50928a[_0xd207('0x2d')],_0x50928a[_0xd207('0x2f')]);_0x4e12bc[_0xd207('0x33')]=_[_0xd207('0x32')](_0x50928a[_0xd207('0x2d')],qs['fields'](_0x41b94f[_0xd207('0x2f')][_0xd207('0x34')]));_0x4e12bc[_0xd207('0x33')]=_0x4e12bc[_0xd207('0x33')]['length']?_0x4e12bc[_0xd207('0x33')]:_0x50928a[_0xd207('0x2d')];if(_0x41b94f[_0xd207('0x2f')][_0xd207('0x42')]){_0x4e12bc[_0xd207('0x3f')]=[{'all':!![]}];}_0x4e12bc=_[_0xd207('0x3b')]({},_0x4e12bc,_0x41b94f['options']);return db[_0xd207('0x29')][_0xd207('0x43')](_0x4e12bc)[_0xd207('0x3e')](handleEntityNotFound(_0xe152d5,null))['then'](respondWithResult(_0xe152d5,null))[_0xd207('0x41')](handleError(_0xe152d5,null));};exports[_0xd207('0x44')]=function(_0x3f01c5,_0x8e5118){return db['MailTransferReport'][_0xd207('0x44')](_0x3f01c5[_0xd207('0x45')],{})[_0xd207('0x3e')](respondWithResult(_0x8e5118,0xc9))['catch'](handleError(_0x8e5118,null));};exports[_0xd207('0x46')]=function(_0x7ef6aa,_0x501c69){if(_0x7ef6aa['body']['id']){delete _0x7ef6aa['body']['id'];}return db[_0xd207('0x29')][_0xd207('0x43')]({'where':{'id':_0x7ef6aa[_0xd207('0x47')]['id']}})[_0xd207('0x3e')](handleEntityNotFound(_0x501c69,null))[_0xd207('0x3e')](saveUpdates(_0x7ef6aa['body'],null))[_0xd207('0x3e')](respondWithResult(_0x501c69,null))[_0xd207('0x41')](handleError(_0x501c69,null));};exports[_0xd207('0x23')]=function(_0x2c1dc9,_0x47a5d0){return db[_0xd207('0x29')][_0xd207('0x43')]({'where':{'id':_0x2c1dc9[_0xd207('0x47')]['id']}})[_0xd207('0x3e')](handleEntityNotFound(_0x47a5d0,null))['then'](removeEntity(_0x47a5d0,null))[_0xd207('0x41')](handleError(_0x47a5d0,null));};exports[_0xd207('0x48')]=function(_0x465e13,_0x15d931){return db[_0xd207('0x29')][_0xd207('0x48')]()[_0xd207('0x3e')](respondWithResult(_0x15d931,null))[_0xd207('0x41')](handleError(_0x15d931,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e15e32c..05cebdd 100644 --- a/server/api/mailTransferReport/mailTransferReport.model.js +++ b/server/api/mailTransferReport/mailTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c2a=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0xfc961a,_0x5bd592){_0xfc961a=_0xfc961a-0x0;var _0x8c9021=_0x3c2a[_0xfc961a];return _0x8c9021;};'use strict';var _=require(_0xa3c2('0x0'));var util=require(_0xa3c2('0x1'));var logger=require('../../config/logger')(_0xa3c2('0x2'));var moment=require('moment');var BPromise=require(_0xa3c2('0x3'));var rp=require(_0xa3c2('0x4'));var fs=require('fs');var path=require(_0xa3c2('0x5'));var rimraf=require(_0xa3c2('0x6'));var config=require(_0xa3c2('0x7'));var attributes=require(_0xa3c2('0x8'));module[_0xa3c2('0x9')]=function(_0x230a89,_0x45a0b6){return _0x230a89[_0xa3c2('0xa')](_0xa3c2('0xb'),attributes,{'tableName':_0xa3c2('0xc'),'paranoid':![],'indexes':[{'name':_0xa3c2('0xd'),'fields':[_0xa3c2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a81=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','define','report_mail_transfer','uniqueid','lodash'];(function(_0x5db8e5,_0x35e3d5){var _0x4f800d=function(_0x54d993){while(--_0x54d993){_0x5db8e5['push'](_0x5db8e5['shift']());}};_0x4f800d(++_0x35e3d5);}(_0x4a81,0x1b7));var _0x14a8=function(_0x4f2dc3,_0x52b529){_0x4f2dc3=_0x4f2dc3-0x0;var _0x246103=_0x4a81[_0x4f2dc3];return _0x246103;};'use strict';var _=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var logger=require(_0x14a8('0x2'))(_0x14a8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14a8('0x5'));var config=require(_0x14a8('0x6'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x2cd6d2,_0x4aa19e){return _0x2cd6d2[_0x14a8('0x7')]('MailTransferReport',attributes,{'tableName':_0x14a8('0x8'),'paranoid':![],'indexes':[{'name':_0x14a8('0x9'),'fields':[_0x14a8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 5b5467b..837a40e 100644 --- a/server/api/mailTransferReport/mailTransferReport.rpc.js +++ b/server/api/mailTransferReport/mailTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf79c=['http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x26ed6e,_0x5ac011){var _0x4df57=function(_0x3643f2){while(--_0x3643f2){_0x26ed6e['push'](_0x26ed6e['shift']());}};_0x4df57(++_0x5ac011);}(_0xf79c,0x114));var _0xcf79=function(_0x38ffd4,_0x38c469){_0x38ffd4=_0x38ffd4-0x0;var _0x5d46b7=_0xf79c[_0x38ffd4];return _0x5d46b7;};'use strict';var _=require(_0xcf79('0x0'));var util=require(_0xcf79('0x1'));var moment=require(_0xcf79('0x2'));var BPromise=require(_0xcf79('0x3'));var rs=require(_0xcf79('0x4'));var fs=require('fs');var Redis=require(_0xcf79('0x5'));var db=require(_0xcf79('0x6'))['db'];var utils=require(_0xcf79('0x7'));var logger=require(_0xcf79('0x8'))(_0xcf79('0x9'));var config=require(_0xcf79('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcf79('0xb')][_0xcf79('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c4ce3,_0x3c44ec,_0x32e123){return new BPromise(function(_0x4e3dd7,_0x1b87fd){return client[_0xcf79('0xd')](_0x2c4ce3,_0x32e123)[_0xcf79('0xe')](function(_0x577932){logger['info'](_0xcf79('0xf'),_0x3c44ec,_0xcf79('0x10'));logger['debug'](_0xcf79('0x11'),_0x3c44ec,_0xcf79('0x10'),JSON[_0xcf79('0x12')](_0x577932));if(_0x577932['error']){if(_0x577932['error']['code']===0x1f4){logger[_0xcf79('0x13')](_0xcf79('0xf'),_0x3c44ec,_0x577932['error'][_0xcf79('0x14')]);return _0x1b87fd(_0x577932[_0xcf79('0x13')][_0xcf79('0x14')]);}logger[_0xcf79('0x13')](_0xcf79('0xf'),_0x3c44ec,_0x577932[_0xcf79('0x13')]['message']);return _0x4e3dd7(_0x577932['error'][_0xcf79('0x14')]);}else{logger[_0xcf79('0x15')](_0xcf79('0xf'),_0x3c44ec,_0xcf79('0x10'));_0x4e3dd7(_0x577932[_0xcf79('0x16')]['message']);}})[_0xcf79('0x17')](function(_0x46c269){logger[_0xcf79('0x13')](_0xcf79('0xf'),_0x3c44ec,_0x46c269);_0x1b87fd(_0x46c269);});});} \ No newline at end of file +var _0x8b4c=['../../config/environment','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0xd3c0e9,_0x2a4782){var _0x512d90=function(_0x19b183){while(--_0x19b183){_0xd3c0e9['push'](_0xd3c0e9['shift']());}};_0x512d90(++_0x2a4782);}(_0x8b4c,0x1f1));var _0xc8b4=function(_0xdd20f,_0x326d15){_0xdd20f=_0xdd20f-0x0;var _0x13093d=_0x8b4c[_0xdd20f];return _0x13093d;};'use strict';var _=require('lodash');var util=require(_0xc8b4('0x0'));var moment=require(_0xc8b4('0x1'));var BPromise=require(_0xc8b4('0x2'));var rs=require(_0xc8b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8b4('0x4'))['db'];var utils=require(_0xc8b4('0x5'));var logger=require('../../config/logger')(_0xc8b4('0x6'));var config=require(_0xc8b4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc8b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37a389,_0x5bbbd3,_0x597a6b){return new BPromise(function(_0x16f697,_0x9ac724){return client[_0xc8b4('0x9')](_0x37a389,_0x597a6b)['then'](function(_0x715e52){logger['info'](_0xc8b4('0xa'),_0x5bbbd3,_0xc8b4('0xb'));logger[_0xc8b4('0xc')](_0xc8b4('0xd'),_0x5bbbd3,_0xc8b4('0xb'),JSON[_0xc8b4('0xe')](_0x715e52));if(_0x715e52[_0xc8b4('0xf')]){if(_0x715e52[_0xc8b4('0xf')]['code']===0x1f4){logger[_0xc8b4('0xf')](_0xc8b4('0xa'),_0x5bbbd3,_0x715e52[_0xc8b4('0xf')]['message']);return _0x9ac724(_0x715e52[_0xc8b4('0xf')][_0xc8b4('0x10')]);}logger[_0xc8b4('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x5bbbd3,_0x715e52[_0xc8b4('0xf')][_0xc8b4('0x10')]);return _0x16f697(_0x715e52['error'][_0xc8b4('0x10')]);}else{logger['info'](_0xc8b4('0xa'),_0x5bbbd3,_0xc8b4('0xb'));_0x16f697(_0x715e52[_0xc8b4('0x11')][_0xc8b4('0x10')]);}})['catch'](function(_0x307e0f){logger[_0xc8b4('0xf')](_0xc8b4('0xa'),_0x5bbbd3,_0x307e0f);_0x9ac724(_0x307e0f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index b518a24..a6c8340 100644 --- a/server/api/memberReport/index.js +++ b/server/api/memberReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1f1=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','post','create','put','/:id'];(function(_0x345692,_0x48757e){var _0x508cf3=function(_0x236b69){while(--_0x236b69){_0x345692['push'](_0x345692['shift']());}};_0x508cf3(++_0x48757e);}(_0xd1f1,0xfb));var _0x1d1f=function(_0x6ab30c,_0x2c713b){_0x6ab30c=_0x6ab30c-0x0;var _0x36e953=_0xd1f1[_0x6ab30c];return _0x36e953;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1d1f('0x0'));var timeout=require(_0x1d1f('0x1'));var express=require(_0x1d1f('0x2'));var router=express[_0x1d1f('0x3')]();var fs_extra=require(_0x1d1f('0x4'));var auth=require(_0x1d1f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1d1f('0x6'));var controller=require(_0x1d1f('0x7'));router[_0x1d1f('0x8')]('/',auth[_0x1d1f('0x9')](),controller['index']);router[_0x1d1f('0x8')](_0x1d1f('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1d1f('0xb')]('/',auth[_0x1d1f('0x9')](),controller[_0x1d1f('0xc')]);router[_0x1d1f('0xd')](_0x1d1f('0xe'),auth[_0x1d1f('0x9')](),controller[_0x1d1f('0xf')]);router[_0x1d1f('0x10')](_0x1d1f('0xe'),auth[_0x1d1f('0x9')](),controller[_0x1d1f('0x11')]);module[_0x1d1f('0x12')]=router; \ No newline at end of file +var _0x6840=['delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update'];(function(_0x2ea66f,_0x195499){var _0x2386dc=function(_0x1d0336){while(--_0x1d0336){_0x2ea66f['push'](_0x2ea66f['shift']());}};_0x2386dc(++_0x195499);}(_0x6840,0x12f));var _0x0684=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6840[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x0684('0x0'));var path=require('path');var timeout=require(_0x0684('0x1'));var express=require('express');var router=express[_0x0684('0x2')]();var fs_extra=require(_0x0684('0x3'));var auth=require(_0x0684('0x4'));var interaction=require(_0x0684('0x5'));var config=require(_0x0684('0x6'));var controller=require(_0x0684('0x7'));router[_0x0684('0x8')]('/',auth[_0x0684('0x9')](),controller[_0x0684('0xa')]);router[_0x0684('0x8')](_0x0684('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x0684('0xc'),auth['isAuthenticated'](),controller[_0x0684('0xd')]);router['post']('/',auth[_0x0684('0x9')](),controller[_0x0684('0xe')]);router[_0x0684('0xf')](_0x0684('0xc'),auth[_0x0684('0x9')](),controller[_0x0684('0x10')]);router[_0x0684('0x11')](_0x0684('0xc'),auth[_0x0684('0x9')](),controller[_0x0684('0x12')]);module[_0x0684('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index bec7f57..3fba4f1 100644 --- a/server/api/memberReport/memberReport.attributes.js +++ b/server/api/memberReport/memberReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3101=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','exitAt','setDataValue'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0x3101,0x136));var _0x1310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3101[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1310('0x0'));var moment=require(_0x1310('0x1'));module[_0x1310('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1310('0x3')]},'interface':{'type':Sequelize[_0x1310('0x3')]},'type':{'type':Sequelize[_0x1310('0x3')],'defaultValue':_0x1310('0x4'),'comment':_0x1310('0x5')},'duration':{'type':Sequelize[_0x1310('0x6')]},'enterAt':{'type':Sequelize[_0x1310('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x517947){var _0x334005=moment(_0x517947);var _0x500e7e=moment(this[_0x1310('0x8')]('enterAt'));var _0x2a7da7=_0x334005[_0x1310('0x9')](_0x500e7e,_0x1310('0xa'));this['setDataValue'](_0x1310('0xb'),_0x517947);this[_0x1310('0xc')]('duration',_0x2a7da7>=0x0?_0x2a7da7:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x1310('0xd')},'data2':{'type':Sequelize[_0x1310('0x3')],'comment':_0x1310('0xe')},'data3':{'type':Sequelize[_0x1310('0x3')],'comment':_0x1310('0xf')},'data4':{'type':Sequelize[_0x1310('0x3')],'comment':_0x1310('0x10')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x1310('0x6')]},'uniqueid':{'type':Sequelize[_0x1310('0x3')]}}; \ No newline at end of file +var _0xe02e=['LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x1b45d0,_0x4a1bbc){var _0x5ba92f=function(_0x2efac6){while(--_0x2efac6){_0x1b45d0['push'](_0x1b45d0['shift']());}};_0x5ba92f(++_0x4a1bbc);}(_0xe02e,0x1b3));var _0xee02=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xe02e[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require(_0xee02('0x0'));var moment=require(_0xee02('0x1'));module[_0xee02('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xee02('0x3')]},'type':{'type':Sequelize[_0xee02('0x3')],'defaultValue':_0xee02('0x4'),'comment':_0xee02('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xee02('0x6')]},'exitAt':{'type':Sequelize[_0xee02('0x6')],'set':function(_0x55ba54){var _0x1ab8ec=moment(_0x55ba54);var _0x472c85=moment(this[_0xee02('0x7')](_0xee02('0x8')));var _0x2d9c4c=_0x1ab8ec[_0xee02('0x9')](_0x472c85,_0xee02('0xa'));this[_0xee02('0xb')](_0xee02('0xc'),_0x55ba54);this[_0xee02('0xb')](_0xee02('0xd'),_0x2d9c4c>=0x0?_0x2d9c4c:null);}},'data1':{'type':Sequelize[_0xee02('0x3')],'comment':_0xee02('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0xee02('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0xee02('0x10')},'data4':{'type':Sequelize[_0xee02('0x3')],'comment':_0xee02('0x11')},'data5':{'type':Sequelize[_0xee02('0x3')],'comment':_0xee02('0x12')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xee02('0x13')]},'uniqueid':{'type':Sequelize[_0xee02('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e925f3f..d68cab0 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x10fd98,_0x5209db){var _0x5347d5=function(_0x570103){while(--_0x570103){_0x10fd98['push'](_0x10fd98['shift']());}};_0x5347d5(++_0x5209db);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x55ca,0x126));var _0xa55c=function(_0x1b08d4,_0x8a710c){_0x1b08d4=_0x1b08d4-0x0;var _0x9aef3e=_0x55ca[_0x1b08d4];return _0x9aef3e;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 7d89ac7..c47e9eb 100644 --- a/server/api/memberReport/memberReport.model.js +++ b/server/api/memberReport/memberReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c9f=['api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','util','../../config/logger'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x3c9f,0x148));var _0xf3c9=function(_0x56da1a,_0xbcdb3c){_0x56da1a=_0x56da1a-0x0;var _0x572f58=_0x3c9f[_0x56da1a];return _0x572f58;};'use strict';var _=require('lodash');var util=require(_0xf3c9('0x0'));var logger=require(_0xf3c9('0x1'))(_0xf3c9('0x2'));var moment=require(_0xf3c9('0x3'));var BPromise=require(_0xf3c9('0x4'));var rp=require(_0xf3c9('0x5'));var fs=require('fs');var path=require(_0xf3c9('0x6'));var rimraf=require('rimraf');var config=require(_0xf3c9('0x7'));var attributes=require(_0xf3c9('0x8'));module[_0xf3c9('0x9')]=function(_0x3e5410,_0x574941){return _0x3e5410[_0xf3c9('0xa')]('MemberReport',attributes,{'tableName':_0xf3c9('0xb'),'paranoid':![],'indexes':[{'name':_0xf3c9('0xc'),'fields':[_0xf3c9('0xd'),_0xf3c9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d64=['rimraf','../../config/environment','exports','MemberReport','membername_interface','membername','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x50f019,_0x12c95f){var _0x4c5b50=function(_0x235865){while(--_0x235865){_0x50f019['push'](_0x50f019['shift']());}};_0x4c5b50(++_0x12c95f);}(_0x1d64,0x1cd));var _0x41d6=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x1d64[_0x25a42a];return _0x1129b1;};'use strict';var _=require(_0x41d6('0x0'));var util=require(_0x41d6('0x1'));var logger=require(_0x41d6('0x2'))(_0x41d6('0x3'));var moment=require(_0x41d6('0x4'));var BPromise=require('bluebird');var rp=require(_0x41d6('0x5'));var fs=require('fs');var path=require(_0x41d6('0x6'));var rimraf=require(_0x41d6('0x7'));var config=require(_0x41d6('0x8'));var attributes=require('./memberReport.attributes');module[_0x41d6('0x9')]=function(_0x639309,_0x570d14){return _0x639309['define'](_0x41d6('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x41d6('0xb'),'fields':[_0x41d6('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 2d74e04..645a3c4 100644 --- a/server/api/memberReport/memberReport.rpc.js +++ b/server/api/memberReport/memberReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bac=['message','info','result','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','catch','MemberReport','create','body','CreateMemberReport','debug','UpdateMemberReport','update','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','then','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MemberReport,\x20%s,\x20%s'];(function(_0xffac86,_0xe0dd87){var _0x3c32e7=function(_0x4265a3){while(--_0x4265a3){_0xffac86['push'](_0xffac86['shift']());}};_0x3c32e7(++_0xe0dd87);}(_0x6bac,0xa5));var _0xc6ba=function(_0x45fcda,_0x468fa4){_0x45fcda=_0x45fcda-0x0;var _0x4675a0=_0x6bac[_0x45fcda];return _0x4675a0;};'use strict';var _=require(_0xc6ba('0x0'));var util=require('util');var moment=require(_0xc6ba('0x1'));var BPromise=require(_0xc6ba('0x2'));var rs=require(_0xc6ba('0x3'));var fs=require('fs');var Redis=require(_0xc6ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc6ba('0x5'));var config=require(_0xc6ba('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc6ba('0x7')][_0xc6ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33167e,_0x42858b,_0x12d6e9){return new BPromise(function(_0x1fa2a8,_0x5b98f9){return client['request'](_0x33167e,_0x12d6e9)[_0xc6ba('0x9')](function(_0x481755){logger['info']('MemberReport,\x20%s,\x20%s',_0x42858b,'request\x20sent');logger['debug'](_0xc6ba('0xa'),_0x42858b,_0xc6ba('0xb'),JSON[_0xc6ba('0xc')](_0x481755));if(_0x481755[_0xc6ba('0xd')]){if(_0x481755[_0xc6ba('0xd')]['code']===0x1f4){logger['error'](_0xc6ba('0xe'),_0x42858b,_0x481755[_0xc6ba('0xd')][_0xc6ba('0xf')]);return _0x5b98f9(_0x481755[_0xc6ba('0xd')][_0xc6ba('0xf')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x42858b,_0x481755['error'][_0xc6ba('0xf')]);return _0x1fa2a8(_0x481755[_0xc6ba('0xd')][_0xc6ba('0xf')]);}else{logger[_0xc6ba('0x10')](_0xc6ba('0xe'),_0x42858b,_0xc6ba('0xb'));_0x1fa2a8(_0x481755[_0xc6ba('0x11')][_0xc6ba('0xf')]);}})['catch'](function(_0x52c811){logger['error']('MemberReport,\x20%s,\x20%s',_0x42858b,_0x52c811);_0x5b98f9(_0x52c811);});});}exports['GetMemberReport']=function(_0x494d17){var _0x171eca=this;return new Promise(function(_0x15a135,_0x58f4c3){return db['MemberReport'][_0xc6ba('0x12')]({'raw':_0x494d17['options']?_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x14')]===undefined?!![]:![]:!![],'where':_0x494d17['options']?_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x15')]||null:null,'attributes':_0x494d17['options']?_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x16')]||null:null,'limit':_0x494d17[_0xc6ba('0x13')]?_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x17')]||null:null,'include':_0x494d17[_0xc6ba('0x13')]?_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x18')]?_[_0xc6ba('0x19')](_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x18')],function(_0xf326f9){return{'model':db[_0xf326f9[_0xc6ba('0x1a')]],'as':_0xf326f9['as'],'attributes':_0xf326f9[_0xc6ba('0x16')],'include':_0xf326f9[_0xc6ba('0x18')]?_['map'](_0xf326f9[_0xc6ba('0x18')],function(_0x29a175){return{'model':db[_0x29a175[_0xc6ba('0x1a')]],'as':_0x29a175['as'],'attributes':_0x29a175[_0xc6ba('0x16')],'include':_0x29a175[_0xc6ba('0x18')]?_[_0xc6ba('0x19')](_0x29a175['include'],function(_0x447407){return{'model':db[_0x447407[_0xc6ba('0x1a')]],'as':_0x447407['as'],'attributes':_0x447407['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6ba('0x9')](function(_0x384240){logger['info'](_0xc6ba('0x1b'),_0x494d17);logger['debug'](_0xc6ba('0x1b'),_0x494d17,JSON[_0xc6ba('0xc')](_0x384240));_0x15a135(_0x384240);})[_0xc6ba('0x1c')](function(_0x393d4d){logger['error']('GetMemberReport',_0x393d4d[_0xc6ba('0xf')],_0x494d17);_0x58f4c3(_0x171eca['error'](0x1f4,_0x393d4d[_0xc6ba('0xf')]));});});};exports['CreateMemberReport']=function(_0x3ffa66){var _0x1181ca=this;return new Promise(function(_0x4cf6fb,_0xa079a){return db[_0xc6ba('0x1d')][_0xc6ba('0x1e')](_0x3ffa66[_0xc6ba('0x1f')],{'raw':_0x3ffa66[_0xc6ba('0x13')]?_0x3ffa66[_0xc6ba('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xc6ba('0x9')](function(_0x8949fe){logger['info'](_0xc6ba('0x20'),_0x3ffa66);logger[_0xc6ba('0x21')]('CreateMemberReport',_0x3ffa66,JSON[_0xc6ba('0xc')](_0x8949fe));_0x4cf6fb(_0x8949fe);})[_0xc6ba('0x1c')](function(_0x5e78d3){logger[_0xc6ba('0xd')](_0xc6ba('0x20'),_0x5e78d3[_0xc6ba('0xf')],_0x3ffa66);_0xa079a(_0x1181ca[_0xc6ba('0xd')](0x1f4,_0x5e78d3[_0xc6ba('0xf')]));});});};exports[_0xc6ba('0x22')]=function(_0x582a4e){var _0x3b6c15=this;return new Promise(function(_0x1518cc,_0x355eca){return db[_0xc6ba('0x1d')][_0xc6ba('0x23')](_0x582a4e[_0xc6ba('0x1f')],{'raw':_0x582a4e[_0xc6ba('0x13')]?_0x582a4e[_0xc6ba('0x13')][_0xc6ba('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x582a4e[_0xc6ba('0x13')]?_0x582a4e[_0xc6ba('0x13')][_0xc6ba('0x15')]||null:null,'attributes':_0x582a4e[_0xc6ba('0x13')]?_0x582a4e[_0xc6ba('0x13')]['attributes']||null:null,'limit':_0x582a4e[_0xc6ba('0x13')]?_0x582a4e[_0xc6ba('0x13')][_0xc6ba('0x17')]||null:null})['then'](function(_0x2b2964){logger['info'](_0xc6ba('0x22'),_0x582a4e);logger['debug'](_0xc6ba('0x22'),_0x582a4e,JSON['stringify'](_0x2b2964));_0x1518cc(_0x2b2964);})[_0xc6ba('0x1c')](function(_0x4b1d2f){logger['error'](_0xc6ba('0x22'),_0x4b1d2f[_0xc6ba('0xf')],_0x582a4e);_0x355eca(_0x3b6c15[_0xc6ba('0xd')](0x1f4,_0x4b1d2f[_0xc6ba('0xf')]));});});}; \ No newline at end of file +var _0x27a0=['map','model','then','catch','CreateMemberReport','create','body','raw','UpdateMemberReport','update','where','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetMemberReport','MemberReport','options','attributes','limit','include'];(function(_0xac399a,_0x3f0514){var _0x2e4c79=function(_0x5e5b47){while(--_0x5e5b47){_0xac399a['push'](_0xac399a['shift']());}};_0x2e4c79(++_0x3f0514);}(_0x27a0,0xbf));var _0x027a=function(_0x185dc2,_0xdba755){_0x185dc2=_0x185dc2-0x0;var _0x4d87a2=_0x27a0[_0x185dc2];return _0x4d87a2;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var moment=require(_0x027a('0x1'));var BPromise=require(_0x027a('0x2'));var rs=require(_0x027a('0x3'));var fs=require('fs');var Redis=require(_0x027a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x027a('0x5'));var jayson=require(_0x027a('0x6'));var client=jayson[_0x027a('0x7')][_0x027a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe233ed,_0x3c7d67,_0x550fbb){return new BPromise(function(_0x3d1429,_0x271dfe){return client[_0x027a('0x9')](_0xe233ed,_0x550fbb)['then'](function(_0x44c56a){logger[_0x027a('0xa')](_0x027a('0xb'),_0x3c7d67,'request\x20sent');logger[_0x027a('0xc')](_0x027a('0xd'),_0x3c7d67,_0x027a('0xe'),JSON[_0x027a('0xf')](_0x44c56a));if(_0x44c56a[_0x027a('0x10')]){if(_0x44c56a[_0x027a('0x10')][_0x027a('0x11')]===0x1f4){logger[_0x027a('0x10')](_0x027a('0xb'),_0x3c7d67,_0x44c56a[_0x027a('0x10')][_0x027a('0x12')]);return _0x271dfe(_0x44c56a['error'][_0x027a('0x12')]);}logger[_0x027a('0x10')](_0x027a('0xb'),_0x3c7d67,_0x44c56a[_0x027a('0x10')][_0x027a('0x12')]);return _0x3d1429(_0x44c56a['error']['message']);}else{logger[_0x027a('0xa')]('MemberReport,\x20%s,\x20%s',_0x3c7d67,_0x027a('0xe'));_0x3d1429(_0x44c56a['result'][_0x027a('0x12')]);}})['catch'](function(_0x4dc3ab){logger['error'](_0x027a('0xb'),_0x3c7d67,_0x4dc3ab);_0x271dfe(_0x4dc3ab);});});}exports[_0x027a('0x13')]=function(_0x826d19){var _0x1fb40b=this;return new Promise(function(_0x52125e,_0x282e70){return db[_0x027a('0x14')]['findAll']({'raw':_0x826d19['options']?_0x826d19[_0x027a('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x826d19[_0x027a('0x15')]?_0x826d19['options']['where']||null:null,'attributes':_0x826d19['options']?_0x826d19['options'][_0x027a('0x16')]||null:null,'limit':_0x826d19[_0x027a('0x15')]?_0x826d19[_0x027a('0x15')][_0x027a('0x17')]||null:null,'include':_0x826d19['options']?_0x826d19[_0x027a('0x15')][_0x027a('0x18')]?_[_0x027a('0x19')](_0x826d19[_0x027a('0x15')][_0x027a('0x18')],function(_0x3bbd46){return{'model':db[_0x3bbd46['model']],'as':_0x3bbd46['as'],'attributes':_0x3bbd46[_0x027a('0x16')],'include':_0x3bbd46['include']?_[_0x027a('0x19')](_0x3bbd46[_0x027a('0x18')],function(_0x1b1a13){return{'model':db[_0x1b1a13[_0x027a('0x1a')]],'as':_0x1b1a13['as'],'attributes':_0x1b1a13['attributes'],'include':_0x1b1a13['include']?_[_0x027a('0x19')](_0x1b1a13[_0x027a('0x18')],function(_0x338141){return{'model':db[_0x338141[_0x027a('0x1a')]],'as':_0x338141['as'],'attributes':_0x338141['attributes']};}):[]};}):[]};}):[]:[]})[_0x027a('0x1b')](function(_0x55a8cd){logger[_0x027a('0xa')]('GetMemberReport',_0x826d19);logger[_0x027a('0xc')]('GetMemberReport',_0x826d19,JSON['stringify'](_0x55a8cd));_0x52125e(_0x55a8cd);})[_0x027a('0x1c')](function(_0x5782ac){logger['error'](_0x027a('0x13'),_0x5782ac['message'],_0x826d19);_0x282e70(_0x1fb40b[_0x027a('0x10')](0x1f4,_0x5782ac['message']));});});};exports[_0x027a('0x1d')]=function(_0xc99acc){var _0x4d9a29=this;return new Promise(function(_0xe4ea7d,_0x4b4ac4){return db[_0x027a('0x14')][_0x027a('0x1e')](_0xc99acc[_0x027a('0x1f')],{'raw':_0xc99acc[_0x027a('0x15')]?_0xc99acc[_0x027a('0x15')][_0x027a('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x3926e8){logger['info'](_0x027a('0x1d'),_0xc99acc);logger['debug'](_0x027a('0x1d'),_0xc99acc,JSON[_0x027a('0xf')](_0x3926e8));_0xe4ea7d(_0x3926e8);})[_0x027a('0x1c')](function(_0x307e3c){logger[_0x027a('0x10')]('CreateMemberReport',_0x307e3c[_0x027a('0x12')],_0xc99acc);_0x4b4ac4(_0x4d9a29[_0x027a('0x10')](0x1f4,_0x307e3c[_0x027a('0x12')]));});});};exports[_0x027a('0x21')]=function(_0x14cb87){var _0x476ab8=this;return new Promise(function(_0x1bc29f,_0xd09e6){return db[_0x027a('0x14')][_0x027a('0x22')](_0x14cb87[_0x027a('0x1f')],{'raw':_0x14cb87['options']?_0x14cb87[_0x027a('0x15')][_0x027a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14cb87[_0x027a('0x15')]?_0x14cb87[_0x027a('0x15')][_0x027a('0x23')]||null:null,'attributes':_0x14cb87[_0x027a('0x15')]?_0x14cb87[_0x027a('0x15')]['attributes']||null:null,'limit':_0x14cb87[_0x027a('0x15')]?_0x14cb87[_0x027a('0x15')][_0x027a('0x17')]||null:null})['then'](function(_0x22f96b){logger['info'](_0x027a('0x21'),_0x14cb87);logger[_0x027a('0xc')](_0x027a('0x21'),_0x14cb87,JSON['stringify'](_0x22f96b));_0x1bc29f(_0x22f96b);})['catch'](function(_0x32a44e){logger[_0x027a('0x10')]('UpdateMemberReport',_0x32a44e[_0x027a('0x12')],_0x14cb87);_0xd09e6(_0x476ab8[_0x027a('0x10')](0x1f4,_0x32a44e[_0x027a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 03071dd..f1a02c1 100644 --- a/server/api/migration/index.js +++ b/server/api/migration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a28=['../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8a28,0xfd));var _0x88a2=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x8a28[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var path=require(_0x88a2('0x2'));var timeout=require(_0x88a2('0x3'));var express=require(_0x88a2('0x4'));var router=express[_0x88a2('0x5')]();var fs_extra=require(_0x88a2('0x6'));var auth=require(_0x88a2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x88a2('0x8'));var controller=require(_0x88a2('0x9'));router[_0x88a2('0xa')]('/',controller[_0x88a2('0xb')]);module[_0x88a2('0xc')]=router; \ No newline at end of file +var _0x76fd=['../../components/interaction/service','../../config/environment','get','index','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0xac0284,_0xe5bea8){var _0x5e2b81=function(_0x1cb4f3){while(--_0x1cb4f3){_0xac0284['push'](_0xac0284['shift']());}};_0x5e2b81(++_0xe5bea8);}(_0x76fd,0x186));var _0xd76f=function(_0x4d05f8,_0x3efc70){_0x4d05f8=_0x4d05f8-0x0;var _0x220513=_0x76fd[_0x4d05f8];return _0x220513;};'use strict';var multer=require(_0xd76f('0x0'));var util=require(_0xd76f('0x1'));var path=require(_0xd76f('0x2'));var timeout=require(_0xd76f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd76f('0x4'));var auth=require(_0xd76f('0x5'));var interaction=require(_0xd76f('0x6'));var config=require(_0xd76f('0x7'));var controller=require('./migration.controller');router[_0xd76f('0x8')]('/',controller[_0xd76f('0x9')]);module[_0xd76f('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 80906ad..a851e00 100644 --- a/server/api/migration/migration.attributes.js +++ b/server/api/migration/migration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d88=['STRING','sequelize'];(function(_0x3e1996,_0xe61a43){var _0x536b3b=function(_0x5c7c51){while(--_0x5c7c51){_0x3e1996['push'](_0x3e1996['shift']());}};_0x536b3b(++_0xe61a43);}(_0x3d88,0x11b));var _0x83d8=function(_0x5ef87e,_0x105083){_0x5ef87e=_0x5ef87e-0x0;var _0x131150=_0x3d88[_0x5ef87e];return _0x131150;};'use strict';var Sequelize=require(_0x83d8('0x0'));module['exports']={'version':{'type':Sequelize[_0x83d8('0x1')],'unique':'version'}}; \ No newline at end of file +var _0xb643=['version','sequelize','exports','STRING'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xb643,0x111));var _0x3b64=function(_0x296c48,_0x20816a){_0x296c48=_0x296c48-0x0;var _0x234dea=_0xb643[_0x296c48];return _0x234dea;};'use strict';var Sequelize=require(_0x3b64('0x0'));module[_0x3b64('0x1')]={'version':{'type':Sequelize[_0x3b64('0x2')],'unique':_0x3b64('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a6acd53..23fe266 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0deb=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','Migration','include','rows','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x51a164,_0x4e6fb0){var _0x4ac595=function(_0x87c1d1){while(--_0x87c1d1){_0x51a164['push'](_0x51a164['shift']());}};_0x4ac595(++_0x4e6fb0);}(_0x0deb,0x1e5));var _0xb0de=function(_0x53f394,_0x59c122){_0x53f394=_0x53f394-0x0;var _0x1920e0=_0x0deb[_0x53f394];return _0x1920e0;};'use strict';var emlformat=require(_0xb0de('0x0'));var rimraf=require(_0xb0de('0x1'));var zipdir=require(_0xb0de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb0de('0x3'));var BPromise=require(_0xb0de('0x4'));var Mustache=require(_0xb0de('0x5'));var util=require(_0xb0de('0x6'));var path=require(_0xb0de('0x7'));var sox=require(_0xb0de('0x8'));var csv=require(_0xb0de('0x9'));var ejs=require(_0xb0de('0xa'));var fs=require('fs');var fs_extra=require(_0xb0de('0xb'));var _=require(_0xb0de('0xc'));var squel=require(_0xb0de('0xd'));var crypto=require(_0xb0de('0xe'));var jsforce=require(_0xb0de('0xf'));var deskjs=require(_0xb0de('0x10'));var toCsv=require(_0xb0de('0x9'));var querystring=require(_0xb0de('0x11'));var Papa=require(_0xb0de('0x12'));var Redis=require(_0xb0de('0x13'));var authService=require(_0xb0de('0x14'));var qs=require(_0xb0de('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0de('0x16'));var logger=require(_0xb0de('0x17'))('api');var utils=require(_0xb0de('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb0de('0x19'));var db=require(_0xb0de('0x1a'))['db'];function respondWithStatusCode(_0x5a306b,_0x3bc2dc){_0x3bc2dc=_0x3bc2dc||0xcc;return function(_0xb279ec){if(_0xb279ec){return _0x5a306b[_0xb0de('0x1b')](_0x3bc2dc);}return _0x5a306b[_0xb0de('0x1c')](_0x3bc2dc)[_0xb0de('0x1d')]();};}function respondWithResult(_0x493a8c,_0x3b02fa){_0x3b02fa=_0x3b02fa||0xc8;return function(_0x4f21e1){if(_0x4f21e1){return _0x493a8c['status'](_0x3b02fa)[_0xb0de('0x1e')](_0x4f21e1);}};}function respondWithFilteredResult(_0x2ac317,_0x3cb30e){return function(_0x4a0d10){if(_0x4a0d10){var _0x180d1f=typeof _0x3cb30e['offset']==='undefined'&&typeof _0x3cb30e[_0xb0de('0x1f')]===_0xb0de('0x20');var _0x4dee08=_0x4a0d10[_0xb0de('0x21')];var _0x408fd9=_0x180d1f?0x0:_0x3cb30e[_0xb0de('0x22')];var _0x281004=_0x180d1f?_0x4a0d10['count']:_0x3cb30e[_0xb0de('0x22')]+_0x3cb30e['limit'];var _0x53ce92;if(_0x281004>=_0x4dee08){_0x281004=_0x4dee08;_0x53ce92=0xc8;}else{_0x53ce92=0xce;}_0x2ac317[_0xb0de('0x1c')](_0x53ce92);return _0x2ac317[_0xb0de('0x23')](_0xb0de('0x24'),_0x408fd9+'-'+_0x281004+'/'+_0x4dee08)['json'](_0x4a0d10);}return null;};}function patchUpdates(_0x2ae297){return function(_0x1a244d){try{jsonpatch[_0xb0de('0x25')](_0x1a244d,_0x2ae297,!![]);}catch(_0x484402){return BPromise['reject'](_0x484402);}return _0x1a244d[_0xb0de('0x26')]();};}function saveUpdates(_0xb5096b,_0x40c42a){return function(_0xb8cf42){if(_0xb8cf42){return _0xb8cf42[_0xb0de('0x27')](_0xb5096b)[_0xb0de('0x28')](function(_0x4cbb57){return _0x4cbb57;});}return null;};}function removeEntity(_0xfcb13c,_0x539331){return function(_0x5aa4a7){if(_0x5aa4a7){return _0x5aa4a7[_0xb0de('0x29')]()[_0xb0de('0x28')](function(){_0xfcb13c[_0xb0de('0x1c')](0xcc)[_0xb0de('0x1d')]();});}};}function handleEntityNotFound(_0x5a2228,_0x16da64){return function(_0x2b4196){if(!_0x2b4196){_0x5a2228[_0xb0de('0x1b')](0x194);}return _0x2b4196;};}function handleError(_0x3a514b,_0x21d955){_0x21d955=_0x21d955||0x1f4;return function(_0x444f2b){logger[_0xb0de('0x2a')](_0x444f2b[_0xb0de('0x2b')]);if(_0x444f2b[_0xb0de('0x2c')]){delete _0x444f2b[_0xb0de('0x2c')];}_0x3a514b[_0xb0de('0x1c')](_0x21d955)['send'](_0x444f2b);};}exports[_0xb0de('0x2d')]=function(_0x5ec0ce,_0x4ef6c9){var _0x5cc03f={},_0x266487={},_0x1be47a={'count':0x0,'rows':[]};var _0x317445=_[_0xb0de('0x2e')](db['Migration'][_0xb0de('0x2f')],function(_0x57178f){return{'name':_0x57178f[_0xb0de('0x30')],'type':_0x57178f['type'][_0xb0de('0x31')]};});_0x266487['model']=_['map'](_0x317445,_0xb0de('0x2c'));_0x266487[_0xb0de('0x32')]=_[_0xb0de('0x33')](_0x5ec0ce['query']);_0x266487[_0xb0de('0x34')]=_[_0xb0de('0x35')](_0x266487[_0xb0de('0x36')],_0x266487[_0xb0de('0x32')]);_0x5cc03f[_0xb0de('0x37')]=_['intersection'](_0x266487[_0xb0de('0x36')],qs['fields'](_0x5ec0ce[_0xb0de('0x32')][_0xb0de('0x38')]));_0x5cc03f[_0xb0de('0x37')]=_0x5cc03f['attributes'][_0xb0de('0x39')]?_0x5cc03f[_0xb0de('0x37')]:_0x266487['model'];if(!_0x5ec0ce[_0xb0de('0x32')][_0xb0de('0x3a')](_0xb0de('0x3b'))){_0x5cc03f[_0xb0de('0x1f')]=qs[_0xb0de('0x1f')](_0x5ec0ce['query'][_0xb0de('0x1f')]);_0x5cc03f['offset']=qs[_0xb0de('0x22')](_0x5ec0ce['query'][_0xb0de('0x22')]);}_0x5cc03f[_0xb0de('0x3c')]=qs['sort'](_0x5ec0ce[_0xb0de('0x32')][_0xb0de('0x3d')]);_0x5cc03f['where']=qs['filters'](_[_0xb0de('0x3e')](_0x5ec0ce[_0xb0de('0x32')],_0x266487['filters']),_0x317445);if(_0x5ec0ce['query'][_0xb0de('0x3f')]){_0x5cc03f[_0xb0de('0x40')]=_[_0xb0de('0x41')](_0x5cc03f[_0xb0de('0x40')],{'$or':_[_0xb0de('0x2e')](_0x317445,function(_0x36f2f5){if(_0x36f2f5[_0xb0de('0x42')]!==_0xb0de('0x43')){var _0x5a37dc={};_0x5a37dc[_0x36f2f5[_0xb0de('0x2c')]]={'$like':'%'+_0x5ec0ce[_0xb0de('0x32')][_0xb0de('0x3f')]+'%'};return _0x5a37dc;}})});}_0x5cc03f=_[_0xb0de('0x41')]({},_0x5cc03f,_0x5ec0ce['options']);var _0x5076c1={'where':_0x5cc03f['where']};return db[_0xb0de('0x44')][_0xb0de('0x21')](_0x5076c1)[_0xb0de('0x28')](function(_0x34fdb8){_0x1be47a[_0xb0de('0x21')]=_0x34fdb8;if(_0x5ec0ce[_0xb0de('0x32')]['includeAll']){_0x5cc03f[_0xb0de('0x45')]=[{'all':!![]}];}return db[_0xb0de('0x44')]['findAll'](_0x5cc03f);})[_0xb0de('0x28')](function(_0x3dd98f){_0x1be47a[_0xb0de('0x46')]=_0x3dd98f;return _0x1be47a;})['then'](respondWithFilteredResult(_0x4ef6c9,_0x5cc03f))[_0xb0de('0x47')](handleError(_0x4ef6c9,null));}; \ No newline at end of file +var _0xad05=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','save','update','then','destroy','end','error','stack','send','map','Migration','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0xad05,0xcc));var _0x5ad0=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0xad05[_0x5a7d41];return _0x98d8fa;};'use strict';var emlformat=require(_0x5ad0('0x0'));var rimraf=require(_0x5ad0('0x1'));var zipdir=require(_0x5ad0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ad0('0x3'));var moment=require(_0x5ad0('0x4'));var BPromise=require(_0x5ad0('0x5'));var Mustache=require(_0x5ad0('0x6'));var util=require(_0x5ad0('0x7'));var path=require(_0x5ad0('0x8'));var sox=require(_0x5ad0('0x9'));var csv=require(_0x5ad0('0xa'));var ejs=require(_0x5ad0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ad0('0xc'));var squel=require('squel');var crypto=require(_0x5ad0('0xd'));var jsforce=require(_0x5ad0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5ad0('0xa'));var querystring=require(_0x5ad0('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ad0('0x10'));var authService=require(_0x5ad0('0x11'));var qs=require(_0x5ad0('0x12'));var as=require(_0x5ad0('0x13'));var hardwareService=require(_0x5ad0('0x14'));var logger=require(_0x5ad0('0x15'))(_0x5ad0('0x16'));var utils=require(_0x5ad0('0x17'));var config=require(_0x5ad0('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x430326,_0x56d640){_0x56d640=_0x56d640||0xcc;return function(_0x1e6836){if(_0x1e6836){return _0x430326[_0x5ad0('0x19')](_0x56d640);}return _0x430326[_0x5ad0('0x1a')](_0x56d640)['end']();};}function respondWithResult(_0x27860e,_0x18b137){_0x18b137=_0x18b137||0xc8;return function(_0x513b07){if(_0x513b07){return _0x27860e['status'](_0x18b137)[_0x5ad0('0x1b')](_0x513b07);}};}function respondWithFilteredResult(_0x5bacee,_0x42308b){return function(_0x4b301f){if(_0x4b301f){var _0x172bd3=typeof _0x42308b['offset']===_0x5ad0('0x1c')&&typeof _0x42308b['limit']===_0x5ad0('0x1c');var _0x87a821=_0x4b301f[_0x5ad0('0x1d')];var _0x4b02ff=_0x172bd3?0x0:_0x42308b[_0x5ad0('0x1e')];var _0x3ead85=_0x172bd3?_0x4b301f[_0x5ad0('0x1d')]:_0x42308b[_0x5ad0('0x1e')]+_0x42308b[_0x5ad0('0x1f')];var _0x3fadf4;if(_0x3ead85>=_0x87a821){_0x3ead85=_0x87a821;_0x3fadf4=0xc8;}else{_0x3fadf4=0xce;}_0x5bacee[_0x5ad0('0x1a')](_0x3fadf4);return _0x5bacee[_0x5ad0('0x20')](_0x5ad0('0x21'),_0x4b02ff+'-'+_0x3ead85+'/'+_0x87a821)[_0x5ad0('0x1b')](_0x4b301f);}return null;};}function patchUpdates(_0x109a49){return function(_0x1b5000){try{jsonpatch['apply'](_0x1b5000,_0x109a49,!![]);}catch(_0xe0566d){return BPromise['reject'](_0xe0566d);}return _0x1b5000[_0x5ad0('0x22')]();};}function saveUpdates(_0x89dc3c,_0x2b6858){return function(_0x997404){if(_0x997404){return _0x997404[_0x5ad0('0x23')](_0x89dc3c)[_0x5ad0('0x24')](function(_0x1376dd){return _0x1376dd;});}return null;};}function removeEntity(_0x30cd98,_0xc50aeb){return function(_0x29d7cc){if(_0x29d7cc){return _0x29d7cc[_0x5ad0('0x25')]()[_0x5ad0('0x24')](function(){_0x30cd98['status'](0xcc)[_0x5ad0('0x26')]();});}};}function handleEntityNotFound(_0xee2345,_0x51c4f7){return function(_0x5eda2f){if(!_0x5eda2f){_0xee2345[_0x5ad0('0x19')](0x194);}return _0x5eda2f;};}function handleError(_0x4631c4,_0x3ae89e){_0x3ae89e=_0x3ae89e||0x1f4;return function(_0x2aa2de){logger[_0x5ad0('0x27')](_0x2aa2de[_0x5ad0('0x28')]);if(_0x2aa2de['name']){delete _0x2aa2de['name'];}_0x4631c4['status'](_0x3ae89e)[_0x5ad0('0x29')](_0x2aa2de);};}exports['index']=function(_0x148728,_0x384f51){var _0x288ae1={},_0x4abb7f={},_0x405444={'count':0x0,'rows':[]};var _0x27785a=_[_0x5ad0('0x2a')](db[_0x5ad0('0x2b')]['rawAttributes'],function(_0x135ffc){return{'name':_0x135ffc[_0x5ad0('0x2c')],'type':_0x135ffc[_0x5ad0('0x2d')][_0x5ad0('0x2e')]};});_0x4abb7f[_0x5ad0('0x2f')]=_['map'](_0x27785a,_0x5ad0('0x30'));_0x4abb7f[_0x5ad0('0x31')]=_[_0x5ad0('0x32')](_0x148728[_0x5ad0('0x31')]);_0x4abb7f[_0x5ad0('0x33')]=_[_0x5ad0('0x34')](_0x4abb7f[_0x5ad0('0x2f')],_0x4abb7f[_0x5ad0('0x31')]);_0x288ae1['attributes']=_[_0x5ad0('0x34')](_0x4abb7f['model'],qs[_0x5ad0('0x35')](_0x148728['query'][_0x5ad0('0x35')]));_0x288ae1[_0x5ad0('0x36')]=_0x288ae1[_0x5ad0('0x36')][_0x5ad0('0x37')]?_0x288ae1[_0x5ad0('0x36')]:_0x4abb7f['model'];if(!_0x148728['query']['hasOwnProperty'](_0x5ad0('0x38'))){_0x288ae1['limit']=qs[_0x5ad0('0x1f')](_0x148728[_0x5ad0('0x31')][_0x5ad0('0x1f')]);_0x288ae1[_0x5ad0('0x1e')]=qs[_0x5ad0('0x1e')](_0x148728[_0x5ad0('0x31')][_0x5ad0('0x1e')]);}_0x288ae1[_0x5ad0('0x39')]=qs['sort'](_0x148728[_0x5ad0('0x31')][_0x5ad0('0x3a')]);_0x288ae1[_0x5ad0('0x3b')]=qs[_0x5ad0('0x33')](_[_0x5ad0('0x3c')](_0x148728['query'],_0x4abb7f[_0x5ad0('0x33')]),_0x27785a);if(_0x148728['query'][_0x5ad0('0x3d')]){_0x288ae1[_0x5ad0('0x3b')]=_[_0x5ad0('0x3e')](_0x288ae1[_0x5ad0('0x3b')],{'$or':_[_0x5ad0('0x2a')](_0x27785a,function(_0x2fb29a){if(_0x2fb29a[_0x5ad0('0x2d')]!=='VIRTUAL'){var _0x1c16a5={};_0x1c16a5[_0x2fb29a[_0x5ad0('0x30')]]={'$like':'%'+_0x148728[_0x5ad0('0x31')]['filter']+'%'};return _0x1c16a5;}})});}_0x288ae1=_[_0x5ad0('0x3e')]({},_0x288ae1,_0x148728[_0x5ad0('0x3f')]);var _0x14d05a={'where':_0x288ae1[_0x5ad0('0x3b')]};return db[_0x5ad0('0x2b')][_0x5ad0('0x1d')](_0x14d05a)[_0x5ad0('0x24')](function(_0xd02f24){_0x405444[_0x5ad0('0x1d')]=_0xd02f24;if(_0x148728[_0x5ad0('0x31')][_0x5ad0('0x40')]){_0x288ae1[_0x5ad0('0x41')]=[{'all':!![]}];}return db[_0x5ad0('0x2b')][_0x5ad0('0x42')](_0x288ae1);})[_0x5ad0('0x24')](function(_0x1d7ded){_0x405444['rows']=_0x1d7ded;return _0x405444;})[_0x5ad0('0x24')](respondWithFilteredResult(_0x384f51,_0x288ae1))[_0x5ad0('0x43')](handleError(_0x384f51,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index dde8019..1a0a16b 100644 --- a/server/api/migration/migration.model.js +++ b/server/api/migration/migration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5dbe=['path','../../config/environment','exports','Migration','migrations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x5dbe,0x170));var _0xe5db=function(_0x2a1465,_0x8bf785){_0x2a1465=_0x2a1465-0x0;var _0x128933=_0x5dbe[_0x2a1465];return _0x128933;};'use strict';var _=require('lodash');var util=require(_0xe5db('0x0'));var logger=require(_0xe5db('0x1'))(_0xe5db('0x2'));var moment=require(_0xe5db('0x3'));var BPromise=require(_0xe5db('0x4'));var rp=require(_0xe5db('0x5'));var fs=require('fs');var path=require(_0xe5db('0x6'));var rimraf=require('rimraf');var config=require(_0xe5db('0x7'));var attributes=require('./migration.attributes');module[_0xe5db('0x8')]=function(_0x3d5d94,_0x7f115){return _0x3d5d94['define'](_0xe5db('0x9'),attributes,{'tableName':_0xe5db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1890=['rimraf','./migration.attributes','exports','define','migrations','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x1890,0xcb));var _0x0189=function(_0x284408,_0x257e80){_0x284408=_0x284408-0x0;var _0x4985d5=_0x1890[_0x284408];return _0x4985d5;};'use strict';var _=require('lodash');var util=require(_0x0189('0x0'));var logger=require(_0x0189('0x1'))('api');var moment=require(_0x0189('0x2'));var BPromise=require(_0x0189('0x3'));var rp=require(_0x0189('0x4'));var fs=require('fs');var path=require(_0x0189('0x5'));var rimraf=require(_0x0189('0x6'));var config=require('../../config/environment');var attributes=require(_0x0189('0x7'));module[_0x0189('0x8')]=function(_0x5c06b1,_0x2356a0){return _0x5c06b1[_0x0189('0x9')]('Migration',attributes,{'tableName':_0x0189('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index e2cd15b..8b74d5f 100644 --- a/server/api/migration/migration.rpc.js +++ b/server/api/migration/migration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6be1=['code','message','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x135921,_0x186ef7){var _0xbdc52b=function(_0x4f17ff){while(--_0x4f17ff){_0x135921['push'](_0x135921['shift']());}};_0xbdc52b(++_0x186ef7);}(_0x6be1,0x12f));var _0x16be=function(_0x5b1b17,_0x146be4){_0x5b1b17=_0x5b1b17-0x0;var _0x241ce8=_0x6be1[_0x5b1b17];return _0x241ce8;};'use strict';var _=require(_0x16be('0x0'));var util=require(_0x16be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16be('0x2'))['db'];var utils=require(_0x16be('0x3'));var logger=require(_0x16be('0x4'))(_0x16be('0x5'));var config=require(_0x16be('0x6'));var jayson=require(_0x16be('0x7'));var client=jayson[_0x16be('0x8')][_0x16be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f6c26,_0x1c5e94,_0x4eaedb){return new BPromise(function(_0x36438c,_0x32ff9a){return client[_0x16be('0xa')](_0x2f6c26,_0x4eaedb)[_0x16be('0xb')](function(_0x1a820e){logger[_0x16be('0xc')](_0x16be('0xd'),_0x1c5e94,_0x16be('0xe'));logger[_0x16be('0xf')](_0x16be('0x10'),_0x1c5e94,_0x16be('0xe'),JSON[_0x16be('0x11')](_0x1a820e));if(_0x1a820e[_0x16be('0x12')]){if(_0x1a820e[_0x16be('0x12')][_0x16be('0x13')]===0x1f4){logger[_0x16be('0x12')]('Migration,\x20%s,\x20%s',_0x1c5e94,_0x1a820e[_0x16be('0x12')][_0x16be('0x14')]);return _0x32ff9a(_0x1a820e[_0x16be('0x12')][_0x16be('0x14')]);}logger[_0x16be('0x12')]('Migration,\x20%s,\x20%s',_0x1c5e94,_0x1a820e[_0x16be('0x12')][_0x16be('0x14')]);return _0x36438c(_0x1a820e['error'][_0x16be('0x14')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x1c5e94,'request\x20sent');_0x36438c(_0x1a820e[_0x16be('0x15')][_0x16be('0x14')]);}})[_0x16be('0x16')](function(_0x5e8eeb){logger[_0x16be('0x12')]('Migration,\x20%s,\x20%s',_0x1c5e94,_0x5e8eeb);_0x32ff9a(_0x5e8eeb);});});} \ No newline at end of file +var _0xc964=['request\x20sent','stringify','error','Migration,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x3fb041,_0x559f76){var _0x17b10e=function(_0x1c24a6){while(--_0x1c24a6){_0x3fb041['push'](_0x3fb041['shift']());}};_0x17b10e(++_0x559f76);}(_0xc964,0x7e));var _0x4c96=function(_0x3b7ad9,_0x2ba56f){_0x3b7ad9=_0x3b7ad9-0x0;var _0x552bd2=_0xc964[_0x3b7ad9];return _0x552bd2;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var moment=require('moment');var BPromise=require(_0x4c96('0x2'));var rs=require(_0x4c96('0x3'));var fs=require('fs');var Redis=require(_0x4c96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c96('0x5'));var logger=require('../../config/logger')(_0x4c96('0x6'));var config=require(_0x4c96('0x7'));var jayson=require(_0x4c96('0x8'));var client=jayson[_0x4c96('0x9')][_0x4c96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fa8a0,_0x4070a5,_0x493618){return new BPromise(function(_0x19ed76,_0xaa3f20){return client[_0x4c96('0xb')](_0x1fa8a0,_0x493618)['then'](function(_0x208911){logger[_0x4c96('0xc')]('Migration,\x20%s,\x20%s',_0x4070a5,'request\x20sent');logger['debug'](_0x4c96('0xd'),_0x4070a5,_0x4c96('0xe'),JSON[_0x4c96('0xf')](_0x208911));if(_0x208911['error']){if(_0x208911[_0x4c96('0x10')]['code']===0x1f4){logger['error'](_0x4c96('0x11'),_0x4070a5,_0x208911[_0x4c96('0x10')][_0x4c96('0x12')]);return _0xaa3f20(_0x208911['error']['message']);}logger[_0x4c96('0x10')](_0x4c96('0x11'),_0x4070a5,_0x208911[_0x4c96('0x10')]['message']);return _0x19ed76(_0x208911[_0x4c96('0x10')][_0x4c96('0x12')]);}else{logger[_0x4c96('0xc')](_0x4c96('0x11'),_0x4070a5,_0x4c96('0xe'));_0x19ed76(_0x208911[_0x4c96('0x13')][_0x4c96('0x12')]);}})['catch'](function(_0x388237){logger['error'](_0x4c96('0x11'),_0x4070a5,_0x388237);_0xaa3f20(_0x388237);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index b265a4f..e030b5a 100644 --- a/server/api/network/index.js +++ b/server/api/network/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbb1=['destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','index','get','/:id','show','post','isAuthenticated','create'];(function(_0x27330f,_0x31bc6e){var _0x2db58b=function(_0x27386b){while(--_0x27386b){_0x27330f['push'](_0x27330f['shift']());}};_0x2db58b(++_0x31bc6e);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x42888c,_0x23bd98){_0x42888c=_0x42888c-0x0;var _0x2439ca=_0xcbb1[_0x42888c];return _0x2439ca;};'use strict';var multer=require('multer');var util=require(_0x1cbb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1cbb('0x1'));var router=express[_0x1cbb('0x2')]();var fs_extra=require(_0x1cbb('0x3'));var auth=require(_0x1cbb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1cbb('0x5'));var controller=require(_0x1cbb('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1cbb('0x7')]);router[_0x1cbb('0x8')](_0x1cbb('0x9'),auth['isAuthenticated'](),controller[_0x1cbb('0xa')]);router[_0x1cbb('0xb')]('/',auth[_0x1cbb('0xc')](),controller[_0x1cbb('0xd')]);router['put'](_0x1cbb('0x9'),auth[_0x1cbb('0xc')](),controller['update']);router['delete']('/:id',auth[_0x1cbb('0xc')](),controller[_0x1cbb('0xe')]);module[_0x1cbb('0xf')]=router; \ No newline at end of file +var _0x4815=['Router','fs-extra','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0x4815,0xff));var _0x5481=function(_0x39238a,_0x32ac0c){_0x39238a=_0x39238a-0x0;var _0x5ecc32=_0x4815[_0x39238a];return _0x5ecc32;};'use strict';var multer=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var path=require(_0x5481('0x2'));var timeout=require(_0x5481('0x3'));var express=require(_0x5481('0x4'));var router=express[_0x5481('0x5')]();var fs_extra=require(_0x5481('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5481('0x7'));var controller=require(_0x5481('0x8'));router[_0x5481('0x9')]('/',auth[_0x5481('0xa')](),controller[_0x5481('0xb')]);router[_0x5481('0x9')](_0x5481('0xc'),auth[_0x5481('0xa')](),controller[_0x5481('0xd')]);router[_0x5481('0xe')]('/',auth[_0x5481('0xa')](),controller[_0x5481('0xf')]);router[_0x5481('0x10')](_0x5481('0xc'),auth[_0x5481('0xa')](),controller[_0x5481('0x11')]);router['delete']('/:id',auth[_0x5481('0xa')](),controller[_0x5481('0x12')]);module[_0x5481('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 1df9858..6ba431b 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dcc=['localnet','externip','stun','STRING','sequelize','ENUM'];(function(_0x3b342c,_0xf029e5){var _0x3246af=function(_0x2895b3){while(--_0x2895b3){_0x3b342c['push'](_0x3b342c['shift']());}};_0x3246af(++_0xf029e5);}(_0x4dcc,0xf4));var _0xc4dc=function(_0xfa874a,_0x990e70){_0xfa874a=_0xfa874a-0x0;var _0x3ffce4=_0x4dcc[_0xfa874a];return _0x3ffce4;};'use strict';var Sequelize=require(_0xc4dc('0x0'));module['exports']={'type':{'type':Sequelize[_0xc4dc('0x1')](_0xc4dc('0x2'),_0xc4dc('0x3'),_0xc4dc('0x4'),'turn')},'value':{'type':Sequelize[_0xc4dc('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc4dc('0x5')]}}; \ No newline at end of file +var _0x17dc=['stun','turn','STRING','sequelize','exports','externip'];(function(_0x39c684,_0x1e0093){var _0x3da800=function(_0x2ac946){while(--_0x2ac946){_0x39c684['push'](_0x39c684['shift']());}};_0x3da800(++_0x1e0093);}(_0x17dc,0x1cb));var _0xc17d=function(_0x3bbef8,_0x12e461){_0x3bbef8=_0x3bbef8-0x0;var _0x653d1c=_0x17dc[_0x3bbef8];return _0x653d1c;};'use strict';var Sequelize=require(_0xc17d('0x0'));module[_0xc17d('0x1')]={'type':{'type':Sequelize['ENUM']('localnet',_0xc17d('0x2'),_0xc17d('0x3'),_0xc17d('0x4'))},'value':{'type':Sequelize[_0xc17d('0x5')]},'username':{'type':Sequelize[_0xc17d('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index e3dd187..48b453f 100644 --- a/server/api/network/network.controller.js +++ b/server/api/network/network.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00eb=['res_stun_monitor.so','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','format','toLowerCase','chan_sip.so','update','TURN','writeFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','offset','undefined','count','limit','Content-Range','json','destroy','end','stack','name','send','index','Network','fieldName','type','map','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload'];(function(_0x41c93a,_0x4b79c5){var _0xac3834=function(_0x1a2c36){while(--_0x1a2c36){_0x41c93a['push'](_0x41c93a['shift']());}};_0xac3834(++_0x4b79c5);}(_0x00eb,0x1ab));var _0xb00e=function(_0x283b18,_0x44295f){_0x283b18=_0x283b18-0x0;var _0x327826=_0x00eb[_0x283b18];return _0x327826;};'use strict';var util=require(_0xb00e('0x0'));var path=require(_0xb00e('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00e('0x2'));var qs=require(_0xb00e('0x3'));var logger=require(_0xb00e('0x4'))(_0xb00e('0x5'));var config=require(_0xb00e('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb00e('0x7'));var client=jayson['client'][_0xb00e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2040f2,_0x13bcc8,_0x192ade,_0x1f2342){return new Promise(function(_0xb2a13b,_0x452d19){var _0x542673=_0x1f2342||client;return _0x542673[_0xb00e('0x9')](_0x2040f2,_0x192ade)[_0xb00e('0xa')](function(_0x3a34ee){logger['info'](_0xb00e('0xb'),_0x13bcc8,_0xb00e('0xc'));logger[_0xb00e('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x13bcc8,_0xb00e('0xc'),JSON[_0xb00e('0xe')](_0x3a34ee));if(_0x3a34ee[_0xb00e('0xf')]){if(_0x3a34ee['error'][_0xb00e('0x10')]===0x1f4){logger[_0xb00e('0xf')](_0xb00e('0xb'),_0x13bcc8,_0x3a34ee[_0xb00e('0xf')][_0xb00e('0x11')]);return _0x452d19(_0x3a34ee[_0xb00e('0xf')][_0xb00e('0x11')]);}logger[_0xb00e('0xf')](_0xb00e('0xb'),_0x13bcc8,_0x3a34ee['error'][_0xb00e('0x11')]);return _0xb2a13b(_0x3a34ee[_0xb00e('0xf')][_0xb00e('0x11')]);}else{logger['info'](_0xb00e('0xb'),_0x13bcc8,'request\x20sent');_0xb2a13b(_0x3a34ee[_0xb00e('0x12')][_0xb00e('0x11')]);}})[_0xb00e('0x13')](function(_0x4af4ab){logger[_0xb00e('0xf')]('Network,\x20%s,\x20%s',_0x13bcc8,_0x4af4ab);_0x452d19(_0x4af4ab);});});}function respondWithResult(_0x591c25,_0x4ca4f2){_0x4ca4f2=_0x4ca4f2||0xc8;return function(_0x55b1b7){if(_0x55b1b7){return _0x591c25[_0xb00e('0x14')](_0x4ca4f2)['json'](_0x55b1b7);}};}function respondWithFilteredResult(_0x3fe83f,_0x1104b6){return function(_0x4a9443){if(_0x4a9443){var _0x17c4cf=typeof _0x1104b6[_0xb00e('0x15')]==='undefined'&&typeof _0x1104b6['limit']===_0xb00e('0x16');var _0x275f29=_0x4a9443[_0xb00e('0x17')];var _0x3926b4=_0x17c4cf?0x0:_0x1104b6['offset'];var _0x300d43=_0x17c4cf?_0x4a9443[_0xb00e('0x17')]:_0x1104b6[_0xb00e('0x15')]+_0x1104b6[_0xb00e('0x18')];var _0x2c4ccb;if(_0x300d43>=_0x275f29){_0x300d43=_0x275f29;_0x2c4ccb=0xc8;}else{_0x2c4ccb=0xce;}_0x3fe83f['status'](_0x2c4ccb);return _0x3fe83f['set'](_0xb00e('0x19'),_0x3926b4+'-'+_0x300d43+'/'+_0x275f29)[_0xb00e('0x1a')](_0x4a9443);}return null;};}function saveUpdates(_0x5631bc){return function(_0x348c41){if(_0x348c41){return _0x348c41['update'](_0x5631bc)['then'](function(_0x55217f){return _0x55217f;});}return null;};}function removeEntity(_0x432d3e){return function(_0x3e5dff){if(_0x3e5dff){return _0x3e5dff[_0xb00e('0x1b')]()[_0xb00e('0xa')](function(){_0x432d3e[_0xb00e('0x14')](0xcc)[_0xb00e('0x1c')]();});}};}function handleEntityNotFound(_0x8a2b){return function(_0x474704){if(!_0x474704){_0x8a2b['sendStatus'](0x194);}return _0x474704;};}function handleError(_0xadc47f,_0x200542){_0x200542=_0x200542||0x1f4;return function(_0x2d680a){logger['error'](_0x2d680a[_0xb00e('0x1d')]);if(_0x2d680a['name']){delete _0x2d680a[_0xb00e('0x1e')];}_0xadc47f[_0xb00e('0x14')](_0x200542)[_0xb00e('0x1f')](_0x2d680a);};}exports[_0xb00e('0x20')]=function(_0x3d174c,_0x52eba9){var _0x30c43e={},_0xa656e={},_0x342d5a={'count':0x0,'rows':[]};var _0x19d921=_['map'](db[_0xb00e('0x21')]['rawAttributes'],function(_0x1fb767){return{'name':_0x1fb767[_0xb00e('0x22')],'type':_0x1fb767[_0xb00e('0x23')]['key']};});_0xa656e['model']=_[_0xb00e('0x24')](_0x19d921,'name');_0xa656e[_0xb00e('0x25')]=_['keys'](_0x3d174c[_0xb00e('0x25')]);_0xa656e[_0xb00e('0x26')]=_[_0xb00e('0x27')](_0xa656e[_0xb00e('0x28')],_0xa656e[_0xb00e('0x25')]);_0x30c43e['attributes']=_[_0xb00e('0x27')](_0xa656e['model'],qs['fields'](_0x3d174c[_0xb00e('0x25')][_0xb00e('0x29')]));_0x30c43e['attributes']=_0x30c43e['attributes'][_0xb00e('0x2a')]?_0x30c43e[_0xb00e('0x2b')]:_0xa656e[_0xb00e('0x28')];if(!_0x3d174c[_0xb00e('0x25')][_0xb00e('0x2c')](_0xb00e('0x2d'))){_0x30c43e[_0xb00e('0x18')]=qs[_0xb00e('0x18')](_0x3d174c['query'][_0xb00e('0x18')]);_0x30c43e[_0xb00e('0x15')]=qs[_0xb00e('0x15')](_0x3d174c[_0xb00e('0x25')][_0xb00e('0x15')]);}_0x30c43e[_0xb00e('0x2e')]=qs['sort'](_0x3d174c[_0xb00e('0x25')]['sort']);_0x30c43e[_0xb00e('0x2f')]=qs[_0xb00e('0x26')](_[_0xb00e('0x30')](_0x3d174c[_0xb00e('0x25')],_0xa656e['filters']),_0x19d921);if(_0x3d174c['query'][_0xb00e('0x31')]){_0x30c43e[_0xb00e('0x2f')]=_[_0xb00e('0x32')](_0x30c43e[_0xb00e('0x2f')],{'$or':_[_0xb00e('0x24')](_0x19d921,function(_0x2f2104){if(_0x2f2104[_0xb00e('0x23')]!==_0xb00e('0x33')){var _0x45d642={};_0x45d642[_0x2f2104['name']]={'$like':'%'+_0x3d174c[_0xb00e('0x25')][_0xb00e('0x31')]+'%'};return _0x45d642;}})});}_0x30c43e=_[_0xb00e('0x32')]({},_0x30c43e,_0x3d174c['options']);var _0x415efb={'where':_0x30c43e[_0xb00e('0x2f')]};return db['Network'][_0xb00e('0x17')](_0x415efb)[_0xb00e('0xa')](function(_0xae452a){_0x342d5a['count']=_0xae452a;if(_0x3d174c['query'][_0xb00e('0x34')]){_0x30c43e[_0xb00e('0x35')]=[{'all':!![]}];}return db[_0xb00e('0x21')][_0xb00e('0x36')](_0x30c43e);})['then'](function(_0x25f826){_0x342d5a[_0xb00e('0x37')]=_0x25f826;return _0x342d5a;})[_0xb00e('0xa')](respondWithFilteredResult(_0x52eba9,_0x30c43e))[_0xb00e('0x13')](handleError(_0x52eba9,null));};exports['show']=function(_0x17df83,_0x74616a){var _0x28d4c6={'raw':!![],'where':{'id':_0x17df83[_0xb00e('0x38')]['id']}},_0xa226a7={};_0xa226a7[_0xb00e('0x28')]=_[_0xb00e('0x39')](db[_0xb00e('0x21')]['rawAttributes']);_0xa226a7[_0xb00e('0x25')]=_[_0xb00e('0x39')](_0x17df83['query']);_0xa226a7[_0xb00e('0x26')]=_['intersection'](_0xa226a7['model'],_0xa226a7['query']);_0x28d4c6[_0xb00e('0x2b')]=_['intersection'](_0xa226a7[_0xb00e('0x28')],qs[_0xb00e('0x29')](_0x17df83[_0xb00e('0x25')][_0xb00e('0x29')]));_0x28d4c6[_0xb00e('0x2b')]=_0x28d4c6[_0xb00e('0x2b')][_0xb00e('0x2a')]?_0x28d4c6[_0xb00e('0x2b')]:_0xa226a7[_0xb00e('0x28')];if(_0x17df83[_0xb00e('0x25')][_0xb00e('0x34')]){_0x28d4c6[_0xb00e('0x35')]=[{'all':!![]}];}_0x28d4c6=_[_0xb00e('0x32')]({},_0x28d4c6,_0x17df83[_0xb00e('0x3a')]);return db[_0xb00e('0x21')][_0xb00e('0x3b')](_0x28d4c6)[_0xb00e('0xa')](handleEntityNotFound(_0x74616a,null))['then'](respondWithResult(_0x74616a,null))[_0xb00e('0x13')](handleError(_0x74616a,null));};exports[_0xb00e('0x3c')]=function(_0xfb50da,_0x60a3cc){var _0x5e863d;return db[_0xb00e('0x21')]['create'](_0xfb50da[_0xb00e('0x3d')],{'raw':!![]})[_0xb00e('0xa')](function(_0x63f1c8){_0x5e863d=_0x63f1c8;return db['Network']['findAll']({'where':{'type':_0xfb50da[_0xb00e('0x3d')][_0xb00e('0x23')]},'raw':!![]});})[_0xb00e('0xa')](function(_0x32a2f1){if(_0x5e863d[_0xb00e('0x23')][_0xb00e('0x3e')]()==_0xb00e('0x3f')){var _0x3aabcb=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x43')),'utf8');var _0x2b8e43=ejs[_0xb00e('0x44')](_0x3aabcb,{'networks':_0x32a2f1||[]});fs['writeFileSync'](_0xb00e('0x45'),_0x2b8e43);return respondWithRpcPromise(_0xb00e('0x46'),'create',{'module':_0xb00e('0x47')});}else if(_0x5e863d['type'][_0xb00e('0x3e')]()=='TURN'){var _0x449174=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x48')),_0xb00e('0x49'));var _0x99b5f6=ejs['render'](_0x449174,{'networks':_0x32a2f1||[]});fs['writeFileSync'](_0xb00e('0x4a'),_0x99b5f6);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x27fb1d=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],'server/files/templates/network.ejs'),_0xb00e('0x49'));var _0x2b1b77=ejs[_0xb00e('0x44')](_0x27fb1d,{'networks':_0x32a2f1||[]});fs['writeFileSync'](util[_0xb00e('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0xfb50da[_0xb00e('0x3d')][_0xb00e('0x23')][_0xb00e('0x4c')]()),_0x2b1b77);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x3c'),{'module':_0xb00e('0x4d')});}})[_0xb00e('0xa')](function(){return _0x5e863d;})[_0xb00e('0xa')](respondWithResult(_0x60a3cc,0xc9))[_0xb00e('0x13')](handleError(_0x60a3cc,null));};exports[_0xb00e('0x4e')]=function(_0x347bbd,_0x5cdd86){var _0x3bcf7e;return db[_0xb00e('0x21')]['find']({'where':{'id':_0x347bbd[_0xb00e('0x38')]['id']}})[_0xb00e('0xa')](handleEntityNotFound(_0x5cdd86,null))[_0xb00e('0xa')](saveUpdates(_0x347bbd[_0xb00e('0x3d')],null))[_0xb00e('0xa')](function(_0x4e6a37){if(_0x4e6a37){_0x3bcf7e=_0x4e6a37;return db[_0xb00e('0x21')][_0xb00e('0x36')]({'where':{'type':_0x3bcf7e[_0xb00e('0x23')]},'raw':!![]});}return null;})[_0xb00e('0xa')](function(_0x1c6366){if(_0x3bcf7e[_0xb00e('0x23')][_0xb00e('0x3e')]()==_0xb00e('0x3f')){var _0x186318=fs['readFileSync'](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x43')),'utf8');var _0x369182=ejs[_0xb00e('0x44')](_0x186318,{'networks':_0x1c6366||[]});fs['writeFileSync'](_0xb00e('0x45'),_0x369182);return respondWithRpcPromise('Reload',_0xb00e('0x4e'),{'module':_0xb00e('0x47')});}else if(_0x3bcf7e['type'][_0xb00e('0x3e')]()==_0xb00e('0x4f')){var _0x11db93=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x48')),_0xb00e('0x49'));var _0x327941=ejs[_0xb00e('0x44')](_0x11db93,{'networks':_0x1c6366||[]});fs[_0xb00e('0x50')](_0xb00e('0x4a'),_0x327941);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x4e'),{'module':'res_stun_monitor.so'});}else{var _0x3ede58=fs['readFileSync'](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x51')),'utf8');var _0x4ce55b=ejs[_0xb00e('0x44')](_0x3ede58,{'networks':_0x1c6366||[]});fs[_0xb00e('0x50')](util['format'](_0xb00e('0x52'),_0x347bbd[_0xb00e('0x3d')]['type']['toLowerCase']()),_0x4ce55b);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x4e'),{'module':_0xb00e('0x4d')});}})[_0xb00e('0xa')](function(_0x1a1d30){if(_0x1a1d30){return _0x3bcf7e;}return null;})[_0xb00e('0xa')](respondWithResult(_0x5cdd86,null))[_0xb00e('0x13')](handleError(_0x5cdd86,null));};exports[_0xb00e('0x1b')]=function(_0x143881,_0x142770){var _0x1ddd96;return db[_0xb00e('0x21')]['find']({'where':{'id':_0x143881[_0xb00e('0x38')]['id']}})[_0xb00e('0xa')](function(_0x1ad692){_0x1ddd96=_0x1ad692;return _0x1ad692;})[_0xb00e('0xa')](handleEntityNotFound(_0x142770,null))[_0xb00e('0xa')](removeEntity(_0x142770,null))[_0xb00e('0xa')](function(){if(_0x1ddd96){return db[_0xb00e('0x21')]['findAll']({'where':{'type':_0x1ddd96[_0xb00e('0x23')]},'raw':!![]});}})[_0xb00e('0xa')](function(_0x34e326){if(_0x1ddd96[_0xb00e('0x23')][_0xb00e('0x3e')]()==_0xb00e('0x3f')){var _0x264a05=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x43')),_0xb00e('0x49'));var _0x18203e=ejs['render'](_0x264a05,{'networks':_0x34e326||[]});fs[_0xb00e('0x50')](_0xb00e('0x45'),_0x18203e);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x1b'),{'module':_0xb00e('0x47')});}else if(_0x1ddd96[_0xb00e('0x23')][_0xb00e('0x3e')]()==_0xb00e('0x4f')){var _0x2b9664=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0xf903fe=ejs['render'](_0x2b9664,{'networks':_0x34e326||[]});fs[_0xb00e('0x50')](_0xb00e('0x4a'),_0xf903fe);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x1b'),{'module':_0xb00e('0x47')});}else{var _0x26d858=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config['root'],_0xb00e('0x51')),'utf8');var _0x128f3b=ejs[_0xb00e('0x44')](_0x26d858,{'networks':_0x34e326||[]});fs['writeFileSync'](util[_0xb00e('0x4b')](_0xb00e('0x52'),_0x1ddd96['type']['toLowerCase']()),_0x128f3b);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x1b'),{'module':'chan_sip.so'});}})[_0xb00e('0x13')](handleError(_0x142770,null));}; \ No newline at end of file +var _0x68f6=['options','includeAll','include','findAll','rows','show','params','find','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','Reload','root','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','server/files/templates/turn_multiple.ejs','chan_sip.so','/etc/asterisk/turn_xcally.conf','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','Content-Range','update','destroy','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x4dbdec,_0x44e0df){var _0x1b4fde=function(_0xad190b){while(--_0xad190b){_0x4dbdec['push'](_0x4dbdec['shift']());}};_0x1b4fde(++_0x44e0df);}(_0x68f6,0x1d0));var _0x668f=function(_0xdc49e4,_0x1d1193){_0xdc49e4=_0xdc49e4-0x0;var _0xc93c80=_0x68f6[_0xdc49e4];return _0xc93c80;};'use strict';var util=require(_0x668f('0x0'));var path=require(_0x668f('0x1'));var ejs=require(_0x668f('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x668f('0x3'));var logger=require(_0x668f('0x4'))(_0x668f('0x5'));var config=require(_0x668f('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0x668f('0x7'));var client=jayson[_0x668f('0x8')][_0x668f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1af241,_0x2e61d9,_0x342190,_0x20a050){return new Promise(function(_0x124807,_0x822361){var _0x4cb19c=_0x20a050||client;return _0x4cb19c[_0x668f('0xa')](_0x1af241,_0x342190)[_0x668f('0xb')](function(_0x5b438e){logger[_0x668f('0xc')](_0x668f('0xd'),_0x2e61d9,_0x668f('0xe'));logger[_0x668f('0xf')]('Network,\x20%s,\x20%s,\x20%s',_0x2e61d9,_0x668f('0xe'),JSON[_0x668f('0x10')](_0x5b438e));if(_0x5b438e['error']){if(_0x5b438e[_0x668f('0x11')][_0x668f('0x12')]===0x1f4){logger[_0x668f('0x11')]('Network,\x20%s,\x20%s',_0x2e61d9,_0x5b438e[_0x668f('0x11')][_0x668f('0x13')]);return _0x822361(_0x5b438e[_0x668f('0x11')][_0x668f('0x13')]);}logger[_0x668f('0x11')](_0x668f('0xd'),_0x2e61d9,_0x5b438e[_0x668f('0x11')]['message']);return _0x124807(_0x5b438e[_0x668f('0x11')][_0x668f('0x13')]);}else{logger[_0x668f('0xc')](_0x668f('0xd'),_0x2e61d9,'request\x20sent');_0x124807(_0x5b438e[_0x668f('0x14')][_0x668f('0x13')]);}})[_0x668f('0x15')](function(_0x35c6d4){logger[_0x668f('0x11')](_0x668f('0xd'),_0x2e61d9,_0x35c6d4);_0x822361(_0x35c6d4);});});}function respondWithResult(_0x57d177,_0x1c8664){_0x1c8664=_0x1c8664||0xc8;return function(_0x5b0605){if(_0x5b0605){return _0x57d177[_0x668f('0x16')](_0x1c8664)[_0x668f('0x17')](_0x5b0605);}};}function respondWithFilteredResult(_0xb2b5e9,_0x5a7cb1){return function(_0x54258c){if(_0x54258c){var _0x43c92b=typeof _0x5a7cb1['offset']===_0x668f('0x18')&&typeof _0x5a7cb1[_0x668f('0x19')]==='undefined';var _0xd287a8=_0x54258c[_0x668f('0x1a')];var _0x1a46f9=_0x43c92b?0x0:_0x5a7cb1['offset'];var _0x3ad282=_0x43c92b?_0x54258c[_0x668f('0x1a')]:_0x5a7cb1[_0x668f('0x1b')]+_0x5a7cb1[_0x668f('0x19')];var _0x3608bb;if(_0x3ad282>=_0xd287a8){_0x3ad282=_0xd287a8;_0x3608bb=0xc8;}else{_0x3608bb=0xce;}_0xb2b5e9[_0x668f('0x16')](_0x3608bb);return _0xb2b5e9['set'](_0x668f('0x1c'),_0x1a46f9+'-'+_0x3ad282+'/'+_0xd287a8)[_0x668f('0x17')](_0x54258c);}return null;};}function saveUpdates(_0x2d081d){return function(_0x5bc728){if(_0x5bc728){return _0x5bc728[_0x668f('0x1d')](_0x2d081d)[_0x668f('0xb')](function(_0x313c3e){return _0x313c3e;});}return null;};}function removeEntity(_0xbe59b6){return function(_0x5407e6){if(_0x5407e6){return _0x5407e6[_0x668f('0x1e')]()[_0x668f('0xb')](function(){_0xbe59b6[_0x668f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b7cb5){return function(_0x3222bb){if(!_0x3222bb){_0x4b7cb5[_0x668f('0x1f')](0x194);}return _0x3222bb;};}function handleError(_0x1721d9,_0x36bf77){_0x36bf77=_0x36bf77||0x1f4;return function(_0x2fc122){logger['error'](_0x2fc122[_0x668f('0x20')]);if(_0x2fc122[_0x668f('0x21')]){delete _0x2fc122[_0x668f('0x21')];}_0x1721d9[_0x668f('0x16')](_0x36bf77)[_0x668f('0x22')](_0x2fc122);};}exports[_0x668f('0x23')]=function(_0xe2753,_0xcd8af3){var _0xefddb0={},_0xd1b7dc={},_0x1bc3f1={'count':0x0,'rows':[]};var _0x23f712=_[_0x668f('0x24')](db[_0x668f('0x25')][_0x668f('0x26')],function(_0x4bffd9){return{'name':_0x4bffd9['fieldName'],'type':_0x4bffd9[_0x668f('0x27')][_0x668f('0x28')]};});_0xd1b7dc[_0x668f('0x29')]=_[_0x668f('0x24')](_0x23f712,'name');_0xd1b7dc[_0x668f('0x2a')]=_[_0x668f('0x2b')](_0xe2753[_0x668f('0x2a')]);_0xd1b7dc[_0x668f('0x2c')]=_['intersection'](_0xd1b7dc[_0x668f('0x29')],_0xd1b7dc[_0x668f('0x2a')]);_0xefddb0['attributes']=_[_0x668f('0x2d')](_0xd1b7dc[_0x668f('0x29')],qs[_0x668f('0x2e')](_0xe2753[_0x668f('0x2a')][_0x668f('0x2e')]));_0xefddb0['attributes']=_0xefddb0[_0x668f('0x2f')][_0x668f('0x30')]?_0xefddb0[_0x668f('0x2f')]:_0xd1b7dc[_0x668f('0x29')];if(!_0xe2753['query'][_0x668f('0x31')](_0x668f('0x32'))){_0xefddb0[_0x668f('0x19')]=qs[_0x668f('0x19')](_0xe2753[_0x668f('0x2a')][_0x668f('0x19')]);_0xefddb0[_0x668f('0x1b')]=qs[_0x668f('0x1b')](_0xe2753['query'][_0x668f('0x1b')]);}_0xefddb0[_0x668f('0x33')]=qs[_0x668f('0x34')](_0xe2753[_0x668f('0x2a')][_0x668f('0x34')]);_0xefddb0[_0x668f('0x35')]=qs[_0x668f('0x2c')](_[_0x668f('0x36')](_0xe2753[_0x668f('0x2a')],_0xd1b7dc[_0x668f('0x2c')]),_0x23f712);if(_0xe2753[_0x668f('0x2a')][_0x668f('0x37')]){_0xefddb0[_0x668f('0x35')]=_['merge'](_0xefddb0[_0x668f('0x35')],{'$or':_['map'](_0x23f712,function(_0x3d29c5){if(_0x3d29c5[_0x668f('0x27')]!==_0x668f('0x38')){var _0x29fbcf={};_0x29fbcf[_0x3d29c5['name']]={'$like':'%'+_0xe2753[_0x668f('0x2a')][_0x668f('0x37')]+'%'};return _0x29fbcf;}})});}_0xefddb0=_[_0x668f('0x39')]({},_0xefddb0,_0xe2753[_0x668f('0x3a')]);var _0x5d102a={'where':_0xefddb0[_0x668f('0x35')]};return db[_0x668f('0x25')][_0x668f('0x1a')](_0x5d102a)[_0x668f('0xb')](function(_0x3c2239){_0x1bc3f1[_0x668f('0x1a')]=_0x3c2239;if(_0xe2753['query'][_0x668f('0x3b')]){_0xefddb0[_0x668f('0x3c')]=[{'all':!![]}];}return db[_0x668f('0x25')][_0x668f('0x3d')](_0xefddb0);})['then'](function(_0x326ad1){_0x1bc3f1[_0x668f('0x3e')]=_0x326ad1;return _0x1bc3f1;})[_0x668f('0xb')](respondWithFilteredResult(_0xcd8af3,_0xefddb0))['catch'](handleError(_0xcd8af3,null));};exports[_0x668f('0x3f')]=function(_0x5a127,_0x2f3ace){var _0x1f8e30={'raw':!![],'where':{'id':_0x5a127[_0x668f('0x40')]['id']}},_0x2ca57c={};_0x2ca57c[_0x668f('0x29')]=_[_0x668f('0x2b')](db[_0x668f('0x25')][_0x668f('0x26')]);_0x2ca57c[_0x668f('0x2a')]=_[_0x668f('0x2b')](_0x5a127[_0x668f('0x2a')]);_0x2ca57c[_0x668f('0x2c')]=_[_0x668f('0x2d')](_0x2ca57c[_0x668f('0x29')],_0x2ca57c[_0x668f('0x2a')]);_0x1f8e30['attributes']=_['intersection'](_0x2ca57c[_0x668f('0x29')],qs[_0x668f('0x2e')](_0x5a127['query'][_0x668f('0x2e')]));_0x1f8e30[_0x668f('0x2f')]=_0x1f8e30[_0x668f('0x2f')][_0x668f('0x30')]?_0x1f8e30[_0x668f('0x2f')]:_0x2ca57c['model'];if(_0x5a127['query'][_0x668f('0x3b')]){_0x1f8e30['include']=[{'all':!![]}];}_0x1f8e30=_[_0x668f('0x39')]({},_0x1f8e30,_0x5a127['options']);return db[_0x668f('0x25')][_0x668f('0x41')](_0x1f8e30)[_0x668f('0xb')](handleEntityNotFound(_0x2f3ace,null))[_0x668f('0xb')](respondWithResult(_0x2f3ace,null))[_0x668f('0x15')](handleError(_0x2f3ace,null));};exports['create']=function(_0x3c1e3a,_0x236251){var _0x27bc9f;return db[_0x668f('0x25')][_0x668f('0x42')](_0x3c1e3a[_0x668f('0x43')],{'raw':!![]})[_0x668f('0xb')](function(_0x485bf6){_0x27bc9f=_0x485bf6;return db[_0x668f('0x25')][_0x668f('0x3d')]({'where':{'type':_0x3c1e3a['body']['type']},'raw':!![]});})[_0x668f('0xb')](function(_0x158bdc){if(_0x27bc9f['type'][_0x668f('0x44')]()==_0x668f('0x45')){var _0x65e930=fs[_0x668f('0x46')](path[_0x668f('0x47')](config['root'],_0x668f('0x48')),_0x668f('0x49'));var _0x48c814=ejs[_0x668f('0x4a')](_0x65e930,{'networks':_0x158bdc||[]});fs[_0x668f('0x4b')](_0x668f('0x4c'),_0x48c814);return respondWithRpcPromise('Reload',_0x668f('0x42'),{'module':_0x668f('0x4d')});}else if(_0x27bc9f[_0x668f('0x27')][_0x668f('0x44')]()==_0x668f('0x4e')){var _0x105c7f=fs[_0x668f('0x46')](path[_0x668f('0x47')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x668f('0x49'));var _0x394549=ejs[_0x668f('0x4a')](_0x105c7f,{'networks':_0x158bdc||[]});fs[_0x668f('0x4b')]('/etc/asterisk/turn_xcally.conf',_0x394549);return respondWithRpcPromise(_0x668f('0x4f'),'create',{'module':'res_stun_monitor.so'});}else{var _0x2be092=fs[_0x668f('0x46')](path['join'](config[_0x668f('0x50')],_0x668f('0x51')),_0x668f('0x49'));var _0x7976d0=ejs[_0x668f('0x4a')](_0x2be092,{'networks':_0x158bdc||[]});fs['writeFileSync'](util[_0x668f('0x52')](_0x668f('0x53'),_0x3c1e3a['body'][_0x668f('0x27')]['toLowerCase']()),_0x7976d0);return respondWithRpcPromise('Reload',_0x668f('0x42'),{'module':'chan_sip.so'});}})['then'](function(){return _0x27bc9f;})['then'](respondWithResult(_0x236251,0xc9))[_0x668f('0x15')](handleError(_0x236251,null));};exports[_0x668f('0x1d')]=function(_0x34df95,_0xa381ca){var _0x3c11b5;return db[_0x668f('0x25')][_0x668f('0x41')]({'where':{'id':_0x34df95[_0x668f('0x40')]['id']}})[_0x668f('0xb')](handleEntityNotFound(_0xa381ca,null))['then'](saveUpdates(_0x34df95[_0x668f('0x43')],null))[_0x668f('0xb')](function(_0x351627){if(_0x351627){_0x3c11b5=_0x351627;return db[_0x668f('0x25')][_0x668f('0x3d')]({'where':{'type':_0x3c11b5[_0x668f('0x27')]},'raw':!![]});}return null;})[_0x668f('0xb')](function(_0x208280){if(_0x3c11b5[_0x668f('0x27')]['toUpperCase']()==_0x668f('0x45')){var _0x1510f1=fs[_0x668f('0x46')](path[_0x668f('0x47')](config[_0x668f('0x50')],_0x668f('0x48')),_0x668f('0x49'));var _0x2f16cc=ejs[_0x668f('0x4a')](_0x1510f1,{'networks':_0x208280||[]});fs['writeFileSync'](_0x668f('0x4c'),_0x2f16cc);return respondWithRpcPromise(_0x668f('0x4f'),'update',{'module':_0x668f('0x4d')});}else if(_0x3c11b5[_0x668f('0x27')]['toUpperCase']()=='TURN'){var _0x153537=fs['readFileSync'](path[_0x668f('0x47')](config[_0x668f('0x50')],_0x668f('0x54')),'utf8');var _0x104d1f=ejs[_0x668f('0x4a')](_0x153537,{'networks':_0x208280||[]});fs[_0x668f('0x4b')]('/etc/asterisk/turn_xcally.conf',_0x104d1f);return respondWithRpcPromise(_0x668f('0x4f'),_0x668f('0x1d'),{'module':_0x668f('0x4d')});}else{var _0x43100a=fs['readFileSync'](path[_0x668f('0x47')](config[_0x668f('0x50')],_0x668f('0x51')),_0x668f('0x49'));var _0x133048=ejs[_0x668f('0x4a')](_0x43100a,{'networks':_0x208280||[]});fs['writeFileSync'](util['format'](_0x668f('0x53'),_0x34df95[_0x668f('0x43')][_0x668f('0x27')]['toLowerCase']()),_0x133048);return respondWithRpcPromise(_0x668f('0x4f'),'update',{'module':_0x668f('0x55')});}})[_0x668f('0xb')](function(_0x5749e0){if(_0x5749e0){return _0x3c11b5;}return null;})[_0x668f('0xb')](respondWithResult(_0xa381ca,null))[_0x668f('0x15')](handleError(_0xa381ca,null));};exports['destroy']=function(_0x1ee9ae,_0x294a80){var _0x50b8dc;return db[_0x668f('0x25')]['find']({'where':{'id':_0x1ee9ae['params']['id']}})[_0x668f('0xb')](function(_0x5944d5){_0x50b8dc=_0x5944d5;return _0x5944d5;})[_0x668f('0xb')](handleEntityNotFound(_0x294a80,null))[_0x668f('0xb')](removeEntity(_0x294a80,null))[_0x668f('0xb')](function(){if(_0x50b8dc){return db[_0x668f('0x25')][_0x668f('0x3d')]({'where':{'type':_0x50b8dc['type']},'raw':!![]});}})[_0x668f('0xb')](function(_0x2e0b00){if(_0x50b8dc[_0x668f('0x27')][_0x668f('0x44')]()==_0x668f('0x45')){var _0x4cb21b=fs['readFileSync'](path[_0x668f('0x47')](config[_0x668f('0x50')],_0x668f('0x48')),_0x668f('0x49'));var _0x45da2d=ejs[_0x668f('0x4a')](_0x4cb21b,{'networks':_0x2e0b00||[]});fs[_0x668f('0x4b')](_0x668f('0x4c'),_0x45da2d);return respondWithRpcPromise(_0x668f('0x4f'),_0x668f('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x50b8dc[_0x668f('0x27')][_0x668f('0x44')]()=='TURN'){var _0x10a2cf=fs[_0x668f('0x46')](path[_0x668f('0x47')](config[_0x668f('0x50')],_0x668f('0x54')),'utf8');var _0x36c164=ejs['render'](_0x10a2cf,{'networks':_0x2e0b00||[]});fs[_0x668f('0x4b')](_0x668f('0x56'),_0x36c164);return respondWithRpcPromise(_0x668f('0x4f'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x5d750a=fs[_0x668f('0x46')](path['join'](config['root'],_0x668f('0x51')),_0x668f('0x49'));var _0x521a45=ejs[_0x668f('0x4a')](_0x5d750a,{'networks':_0x2e0b00||[]});fs['writeFileSync'](util[_0x668f('0x52')](_0x668f('0x53'),_0x50b8dc[_0x668f('0x27')]['toLowerCase']()),_0x521a45);return respondWithRpcPromise('Reload',_0x668f('0x1e'),{'module':_0x668f('0x55')});}})[_0x668f('0x15')](handleError(_0x294a80,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a40104a..20bc1df 100644 --- a/server/api/network/network.model.js +++ b/server/api/network/network.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a2c=['path','rimraf','../../config/environment','exports','network','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x8bb488,_0x4198ca){var _0x13c9e4=function(_0x4c6327){while(--_0x4c6327){_0x8bb488['push'](_0x8bb488['shift']());}};_0x13c9e4(++_0x4198ca);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x4853fd,_0x18238d){_0x4853fd=_0x4853fd-0x0;var _0x4711ac=_0x7a2c[_0x4853fd];return _0x4711ac;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var rp=require(_0xc7a2('0x5'));var fs=require('fs');var path=require(_0xc7a2('0x6'));var rimraf=require(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var attributes=require('./network.attributes');module[_0xc7a2('0x9')]=function(_0x1ddbae,_0x5f334e){return _0x1ddbae['define']('Network',attributes,{'tableName':_0xc7a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe57=['Network','network','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x1405bb,_0x3a0a72){var _0x13b172=function(_0x27abdb){while(--_0x27abdb){_0x1405bb['push'](_0x1405bb['shift']());}};_0x13b172(++_0x3a0a72);}(_0xfe57,0x195));var _0x7fe5=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0xfe57[_0x2984d0];return _0x2885f2;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7fe5('0x2'));var BPromise=require(_0x7fe5('0x3'));var rp=require(_0x7fe5('0x4'));var fs=require('fs');var path=require(_0x7fe5('0x5'));var rimraf=require(_0x7fe5('0x6'));var config=require(_0x7fe5('0x7'));var attributes=require(_0x7fe5('0x8'));module[_0x7fe5('0x9')]=function(_0x22e850,_0x188cfb){return _0x22e850[_0x7fe5('0xa')](_0x7fe5('0xb'),attributes,{'tableName':_0x7fe5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 17cc041..74d572e 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x47fa92,_0x18327f){_0x47fa92=_0x47fa92-0x0;var _0x3e7fae=_0x7a54[_0x47fa92];return _0x3e7fae;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x452433,_0x49a0af){_0x452433=_0x452433-0x0;var _0x32a3f4=_0x7a54[_0x452433];return _0x32a3f4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 387ddd5..3b9e00b 100644 --- a/server/api/openchannelAccount/index.js +++ b/server/api/openchannelAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6343=['/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','send','update','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers'];(function(_0x41b214,_0x1edcaa){var _0x56b447=function(_0x1616e1){while(--_0x1616e1){_0x41b214['push'](_0x41b214['shift']());}};_0x56b447(++_0x1edcaa);}(_0x6343,0x168));var _0x3634=function(_0x2900cb,_0x3c99d4){_0x2900cb=_0x2900cb-0x0;var _0x3f3a87=_0x6343[_0x2900cb];return _0x3f3a87;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3634('0x0'));var timeout=require(_0x3634('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var controller=require('./openchannelAccount.controller');router[_0x3634('0x4')]('/',auth[_0x3634('0x5')](),controller['index']);router[_0x3634('0x4')](_0x3634('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x3634('0x4')](_0x3634('0x7'),auth[_0x3634('0x5')](),controller[_0x3634('0x8')]);router[_0x3634('0x4')](_0x3634('0x9'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x3634('0x4')](_0x3634('0xa'),auth['isAuthenticated'](),controller[_0x3634('0xb')]);router[_0x3634('0x4')](_0x3634('0xc'),auth[_0x3634('0x5')](),controller[_0x3634('0xd')]);router[_0x3634('0x4')](_0x3634('0xe'),auth[_0x3634('0x5')](),controller[_0x3634('0xf')]);router[_0x3634('0x4')](_0x3634('0x10'),auth[_0x3634('0x5')](),controller[_0x3634('0x11')]);router[_0x3634('0x12')]('/',auth['isAuthenticated'](),controller[_0x3634('0x13')]);router['post'](_0x3634('0x9'),auth[_0x3634('0x5')](),controller[_0x3634('0x14')]);router[_0x3634('0x12')](_0x3634('0xa'),auth['isAuthenticated'](),controller[_0x3634('0x15')]);router['post']('/:id/notify',controller[_0x3634('0x16')]);router['post'](_0x3634('0xc'),auth[_0x3634('0x5')](),controller[_0x3634('0x17')]);router['post'](_0x3634('0x10'),auth[_0x3634('0x5')](),controller['addAgents']);router[_0x3634('0x12')]('/:id/send',auth[_0x3634('0x5')](),controller[_0x3634('0x18')]);router['put'](_0x3634('0x7'),auth[_0x3634('0x5')](),controller[_0x3634('0x19')]);router['delete'](_0x3634('0x7'),auth[_0x3634('0x5')](),controller['destroy']);router[_0x3634('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3634('0x1b')]);router[_0x3634('0x1a')]('/:id/canned_answers',auth[_0x3634('0x5')](),controller[_0x3634('0x1c')]);router[_0x3634('0x1a')](_0x3634('0x10'),auth[_0x3634('0x5')](),controller[_0x3634('0x1d')]);module[_0x3634('0x1e')]=router; \ No newline at end of file +var _0x8603=['/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','isAuthenticated','index','get','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0x8603,0x190));var _0x3860=function(_0x1742b8,_0x2a48dd){_0x1742b8=_0x1742b8-0x0;var _0x64cd5a=_0x8603[_0x1742b8];return _0x64cd5a;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['describe']);router['get']('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xb')]);router['get'](_0x3860('0xc'),auth[_0x3860('0x7')](),controller['getDispositions']);router[_0x3860('0x9')](_0x3860('0xd'),auth['isAuthenticated'](),controller[_0x3860('0xe')]);router[_0x3860('0x9')]('/:id/applications',auth[_0x3860('0x7')](),controller[_0x3860('0xf')]);router[_0x3860('0x9')](_0x3860('0x10'),auth[_0x3860('0x7')](),controller[_0x3860('0x11')]);router[_0x3860('0x9')](_0x3860('0x12'),auth[_0x3860('0x7')](),controller[_0x3860('0x13')]);router['post']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x14')]);router[_0x3860('0x15')](_0x3860('0xc'),auth[_0x3860('0x7')](),controller[_0x3860('0x16')]);router[_0x3860('0x15')](_0x3860('0xd'),auth[_0x3860('0x7')](),controller[_0x3860('0x17')]);router[_0x3860('0x15')](_0x3860('0x18'),controller['notify']);router['post'](_0x3860('0x19'),auth[_0x3860('0x7')](),controller[_0x3860('0x1a')]);router['post'](_0x3860('0x12'),auth[_0x3860('0x7')](),controller[_0x3860('0x1b')]);router[_0x3860('0x15')](_0x3860('0x1c'),auth[_0x3860('0x7')](),controller[_0x3860('0x1d')]);router[_0x3860('0x1e')](_0x3860('0x1f'),auth[_0x3860('0x7')](),controller[_0x3860('0x20')]);router[_0x3860('0x21')](_0x3860('0x1f'),auth[_0x3860('0x7')](),controller[_0x3860('0x22')]);router['delete'](_0x3860('0xc'),auth[_0x3860('0x7')](),controller[_0x3860('0x23')]);router[_0x3860('0x21')](_0x3860('0xd'),auth['isAuthenticated'](),controller[_0x3860('0x24')]);router['delete']('/:id/users',auth[_0x3860('0x7')](),controller[_0x3860('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 1a2c2d5..cdba9c2 100644 --- a/server/api/openchannelAccount/openchannelAccount.attributes.js +++ b/server/api/openchannelAccount/openchannelAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e9a=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e9a,0x7b));var _0xa8e9=function(_0x171846,_0x134d2c){_0x171846=_0x171846-0x0;var _0x1a0010=_0x8e9a[_0x171846];return _0x1a0010;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xa8e9('0x0')]={'name':{'type':Sequelize[_0xa8e9('0x1')],'unique':_0xa8e9('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa8e9('0x1')]},'token':{'type':Sequelize[_0xa8e9('0x1')],'defaultValue':function(){return rs[_0xa8e9('0x3')]();}},'replyUri':{'type':Sequelize[_0xa8e9('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa8e9('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa8e9('0x4')],'defaultValue':function(){return _0xa8e9('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa8e9('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa8e9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa8e9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa8e9('0x1')]},'queueTransfer':{'type':Sequelize[_0xa8e9('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa8e9('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa8e9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa8e9('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xa8e9('0x6')],'defaultValue':![],'comment':_0xa8e9('0x9'),'set':function(_0x55bb18){if(!_0x55bb18)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xa8e9('0xa'),_0x55bb18);}}}; \ No newline at end of file +var _0x47ea=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT'];(function(_0x4be094,_0x326265){var _0x1c272a=function(_0x32984b){while(--_0x32984b){_0x4be094['push'](_0x4be094['shift']());}};_0x1c272a(++_0x326265);}(_0x47ea,0xde));var _0xa47e=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x47ea[_0x2ca9d4];return _0x258956;};'use strict';var Sequelize=require(_0xa47e('0x0'));var rs=require(_0xa47e('0x1'));module[_0xa47e('0x2')]={'name':{'type':Sequelize[_0xa47e('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xa47e('0x3')],'defaultValue':function(){return rs[_0xa47e('0x4')]();}},'replyUri':{'type':Sequelize[_0xa47e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa47e('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa47e('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa47e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa47e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa47e('0x3')]},'queueTransfer':{'type':Sequelize[_0xa47e('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa47e('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa47e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa47e('0x6')],'defaultValue':![],'comment':_0xa47e('0x8'),'set':function(_0x26135f){if(!_0x26135f)this[_0xa47e('0x9')](_0xa47e('0xa'),null);this[_0xa47e('0x9')](_0xa47e('0xb'),_0x26135f);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 52d1baf..600a349 100644 --- a/server/api/openchannelAccount/openchannelAccount.controller.js +++ b/server/api/openchannelAccount/openchannelAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5692=['destroy','get','OpenchannelAccounts','UserProfileResource','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','params','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','removeAnswers','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','Contacts','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','contact','messageId','interaction','created','autoclose','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','json','getApplications','getInteractions','Contact','fullname','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','apply','update'];(function(_0x3dceeb,_0x5ee3e5){var _0x24900f=function(_0x6de0ec){while(--_0x6de0ec){_0x3dceeb['push'](_0x3dceeb['shift']());}};_0x24900f(++_0x5ee3e5);}(_0x5692,0x8b));var _0x2569=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5692[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2569('0x0'));var zipdir=require(_0x2569('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2569('0x2'));var moment=require(_0x2569('0x3'));var BPromise=require(_0x2569('0x4'));var Mustache=require('mustache');var util=require(_0x2569('0x5'));var path=require(_0x2569('0x6'));var sox=require(_0x2569('0x7'));var csv=require(_0x2569('0x8'));var ejs=require(_0x2569('0x9'));var fs=require('fs');var fs_extra=require(_0x2569('0xa'));var _=require(_0x2569('0xb'));var squel=require('squel');var crypto=require(_0x2569('0xc'));var jsforce=require(_0x2569('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2569('0x8'));var querystring=require(_0x2569('0xe'));var Papa=require(_0x2569('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2569('0x10'));var logger=require('../../config/logger')(_0x2569('0x11'));var utils=require(_0x2569('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2569('0x13'))['db'];config[_0x2569('0x14')]=_['defaults'](config[_0x2569('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x2569('0x15'))(new Redis(config[_0x2569('0x14')]));require(_0x2569('0x16'))[_0x2569('0x17')](socket);var jayson=require(_0x2569('0x18'));var client=jayson[_0x2569('0x19')][_0x2569('0x1a')]({'port':0x232c});var client9002=jayson[_0x2569('0x19')][_0x2569('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x20e118,_0x57d5eb,_0x96a784,_0x9ea2b5){return new BPromise(function(_0x4ef9ca,_0x2df903){var _0x126375=_0x9ea2b5||client;return _0x126375[_0x2569('0x1b')](_0x20e118,_0x96a784)[_0x2569('0x1c')](function(_0x200cf6){logger[_0x2569('0x1d')](_0x2569('0x1e'),_0x57d5eb,_0x2569('0x1f'));logger[_0x2569('0x20')](_0x2569('0x21'),_0x57d5eb,_0x2569('0x1f'),JSON[_0x2569('0x22')](_0x200cf6));if(_0x200cf6['error']){if(_0x200cf6[_0x2569('0x23')][_0x2569('0x24')]===0x1f4){logger[_0x2569('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x57d5eb,_0x200cf6['error'][_0x2569('0x25')]);return _0x2df903(_0x200cf6['error'][_0x2569('0x25')]);}logger[_0x2569('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x57d5eb,_0x200cf6[_0x2569('0x23')][_0x2569('0x25')]);return _0x4ef9ca(_0x200cf6[_0x2569('0x23')][_0x2569('0x25')]);}else{logger['info'](_0x2569('0x1e'),_0x57d5eb,_0x2569('0x1f'));_0x4ef9ca(_0x200cf6[_0x2569('0x26')][_0x2569('0x25')]);}})[_0x2569('0x27')](function(_0x1072b1){logger['error'](_0x2569('0x1e'),_0x57d5eb,_0x1072b1);_0x2df903(_0x1072b1);});});}function respondWithStatusCode(_0x2d02f3,_0x329e13){_0x329e13=_0x329e13||0xcc;return function(_0x416b84){if(_0x416b84){return _0x2d02f3[_0x2569('0x28')](_0x329e13);}return _0x2d02f3['status'](_0x329e13)[_0x2569('0x29')]();};}function respondWithResult(_0x3c126b,_0x126718){_0x126718=_0x126718||0xc8;return function(_0x4322cf){if(_0x4322cf){return _0x3c126b['status'](_0x126718)['json'](_0x4322cf);}};}function respondWithFilteredResult(_0x4b9a7e,_0x37bc10){return function(_0x16b93d){if(_0x16b93d){var _0x3cb7e5=typeof _0x37bc10['offset']===_0x2569('0x2a')&&typeof _0x37bc10[_0x2569('0x2b')]==='undefined';var _0x1e7457=_0x16b93d[_0x2569('0x2c')];var _0x34e7e2=_0x3cb7e5?0x0:_0x37bc10[_0x2569('0x2d')];var _0x1e4ce6=_0x3cb7e5?_0x16b93d[_0x2569('0x2c')]:_0x37bc10[_0x2569('0x2d')]+_0x37bc10[_0x2569('0x2b')];var _0xd67d84;if(_0x1e4ce6>=_0x1e7457){_0x1e4ce6=_0x1e7457;_0xd67d84=0xc8;}else{_0xd67d84=0xce;}_0x4b9a7e[_0x2569('0x2e')](_0xd67d84);return _0x4b9a7e[_0x2569('0x2f')](_0x2569('0x30'),_0x34e7e2+'-'+_0x1e4ce6+'/'+_0x1e7457)['json'](_0x16b93d);}return null;};}function patchUpdates(_0x2d913c){return function(_0xac989c){try{jsonpatch[_0x2569('0x31')](_0xac989c,_0x2d913c,!![]);}catch(_0x1a0b24){return BPromise['reject'](_0x1a0b24);}return _0xac989c['save']();};}function saveUpdates(_0x4e1164,_0x3a43bb){return function(_0x29125d){if(_0x29125d){return _0x29125d[_0x2569('0x32')](_0x4e1164)[_0x2569('0x1c')](function(_0x30c234){return _0x30c234;});}return null;};}function removeEntity(_0x4085ae,_0x2e0e6c){return function(_0x31f509){if(_0x31f509){return _0x31f509[_0x2569('0x33')]()[_0x2569('0x1c')](function(){var _0x22e0df=_0x31f509[_0x2569('0x34')]({'plain':!![]});var _0x457603=_0x2569('0x35');return db[_0x2569('0x36')][_0x2569('0x33')]({'where':{'type':_0x457603,'resourceId':_0x22e0df['id']}})[_0x2569('0x1c')](function(){return _0x31f509;});})[_0x2569('0x1c')](function(){_0x4085ae[_0x2569('0x2e')](0xcc)[_0x2569('0x29')]();});}};}function handleEntityNotFound(_0x503ed5,_0x2115a9){return function(_0x5ec734){if(!_0x5ec734){_0x503ed5[_0x2569('0x28')](0x194);}return _0x5ec734;};}function handleError(_0x4b9b16,_0x6c8cdf){_0x6c8cdf=_0x6c8cdf||0x1f4;return function(_0x2e149a){logger[_0x2569('0x23')](_0x2e149a['stack']);if(_0x2e149a[_0x2569('0x37')]){delete _0x2e149a[_0x2569('0x37')];}_0x4b9b16[_0x2569('0x2e')](_0x6c8cdf)['send'](_0x2e149a);};}exports['index']=function(_0x3dc89d,_0x4f91a2){var _0x209836={'include':[{'model':db[_0x2569('0x38')],'as':_0x2569('0x39')}]},_0x299748={},_0x195f4c={'count':0x0,'rows':[]};var _0x4e63b6=_[_0x2569('0x3a')](db[_0x2569('0x3b')]['rawAttributes'],function(_0x47777f){return{'name':_0x47777f['fieldName'],'type':_0x47777f['type']['key']};});_0x299748[_0x2569('0x3c')]=_[_0x2569('0x3a')](_0x4e63b6,_0x2569('0x37'));_0x299748[_0x2569('0x3d')]=_[_0x2569('0x3e')](_0x3dc89d[_0x2569('0x3d')]);_0x299748[_0x2569('0x3f')]=_[_0x2569('0x40')](_0x299748[_0x2569('0x3c')],_0x299748['query']);_0x209836['attributes']=_[_0x2569('0x40')](_0x299748[_0x2569('0x3c')],qs[_0x2569('0x41')](_0x3dc89d[_0x2569('0x3d')][_0x2569('0x41')]));_0x209836[_0x2569('0x42')]=_0x209836[_0x2569('0x42')][_0x2569('0x43')]?_0x209836[_0x2569('0x42')]:_0x299748[_0x2569('0x3c')];if(!_0x3dc89d[_0x2569('0x3d')][_0x2569('0x44')](_0x2569('0x45'))){_0x209836[_0x2569('0x2b')]=qs[_0x2569('0x2b')](_0x3dc89d[_0x2569('0x3d')]['limit']);_0x209836[_0x2569('0x2d')]=qs[_0x2569('0x2d')](_0x3dc89d[_0x2569('0x3d')][_0x2569('0x2d')]);}_0x209836[_0x2569('0x46')]=qs[_0x2569('0x47')](_0x3dc89d[_0x2569('0x3d')][_0x2569('0x47')]);_0x209836[_0x2569('0x48')]=qs['filters'](_[_0x2569('0x49')](_0x3dc89d[_0x2569('0x3d')],_0x299748['filters']),_0x4e63b6);if(_0x3dc89d[_0x2569('0x3d')][_0x2569('0x4a')]){_0x209836['where']=_[_0x2569('0x4b')](_0x209836['where'],{'$or':_[_0x2569('0x3a')](_0x4e63b6,function(_0x20601b){if(_0x20601b[_0x2569('0x4c')]!==_0x2569('0x4d')){var _0x518e8c={};_0x518e8c[_0x20601b[_0x2569('0x37')]]={'$like':'%'+_0x3dc89d[_0x2569('0x3d')][_0x2569('0x4a')]+'%'};return _0x518e8c;}})});}_0x209836=_[_0x2569('0x4b')]({},_0x209836,_0x3dc89d['options']);var _0x42f736={'where':_0x209836[_0x2569('0x48')]};return db[_0x2569('0x3b')][_0x2569('0x2c')](_0x42f736)[_0x2569('0x1c')](function(_0x5a4bd6){_0x195f4c[_0x2569('0x2c')]=_0x5a4bd6;if(_0x3dc89d[_0x2569('0x3d')]['includeAll']){_0x209836[_0x2569('0x4e')]=[{'all':!![]}];}return db[_0x2569('0x3b')][_0x2569('0x4f')](_0x209836);})['then'](function(_0x5904fe){_0x195f4c[_0x2569('0x50')]=_0x5904fe;return _0x195f4c;})['then'](respondWithFilteredResult(_0x4f91a2,_0x209836))[_0x2569('0x27')](handleError(_0x4f91a2,null));};exports['show']=function(_0x541262,_0x1e530b){var _0x557439={'raw':![],'where':{'id':_0x541262[_0x2569('0x51')]['id']},'include':[{'model':db[_0x2569('0x38')],'as':_0x2569('0x39')}]},_0x527a0f={};_0x527a0f[_0x2569('0x3c')]=_[_0x2569('0x3e')](db['OpenchannelAccount'][_0x2569('0x52')]);_0x527a0f[_0x2569('0x3d')]=_[_0x2569('0x3e')](_0x541262['query']);_0x527a0f[_0x2569('0x3f')]=_[_0x2569('0x40')](_0x527a0f[_0x2569('0x3c')],_0x527a0f[_0x2569('0x3d')]);_0x557439['attributes']=_['intersection'](_0x527a0f[_0x2569('0x3c')],qs['fields'](_0x541262[_0x2569('0x3d')][_0x2569('0x41')]));_0x557439[_0x2569('0x42')]=_0x557439[_0x2569('0x42')][_0x2569('0x43')]?_0x557439[_0x2569('0x42')]:_0x527a0f[_0x2569('0x3c')];if(_0x541262[_0x2569('0x3d')][_0x2569('0x53')]){_0x557439['include']=[{'all':!![]}];}_0x557439=_['merge']({},_0x557439,_0x541262[_0x2569('0x54')]);return db[_0x2569('0x3b')][_0x2569('0x55')](_0x557439)['then'](handleEntityNotFound(_0x1e530b,null))[_0x2569('0x1c')](respondWithResult(_0x1e530b,null))[_0x2569('0x27')](handleError(_0x1e530b,null));};exports['create']=function(_0x5d4f54,_0x5d48b2){return db[_0x2569('0x3b')][_0x2569('0x56')](_0x5d4f54['body'],{})[_0x2569('0x1c')](function(_0x2071b6){var _0x2c2d05=_0x5d4f54[_0x2569('0x57')][_0x2569('0x34')]({'plain':!![]});if(!_0x2c2d05)throw new Error(_0x2569('0x58'));if(_0x2c2d05[_0x2569('0x59')]===_0x2569('0x57')){var _0x3337d6=_0x2071b6['get']({'plain':!![]});var _0x15b4a1='OpenchannelAccounts';return db[_0x2569('0x5a')][_0x2569('0x55')]({'where':{'name':_0x15b4a1,'userProfileId':_0x2c2d05[_0x2569('0x5b')]},'raw':!![]})[_0x2569('0x1c')](function(_0x1080e3){if(_0x1080e3&&_0x1080e3[_0x2569('0x5c')]===0x0){return db[_0x2569('0x36')][_0x2569('0x56')]({'name':_0x3337d6[_0x2569('0x37')],'resourceId':_0x3337d6['id'],'type':_0x1080e3['name'],'sectionId':_0x1080e3['id']},{})[_0x2569('0x1c')](function(){return _0x2071b6;});}else{return _0x2071b6;}})[_0x2569('0x27')](function(_0x2006d3){logger[_0x2569('0x23')](_0x2569('0x5d'),_0x2006d3);throw _0x2006d3;});}return _0x2071b6;})[_0x2569('0x1c')](respondWithResult(_0x5d48b2,0xc9))['catch'](handleError(_0x5d48b2,null));};exports[_0x2569('0x32')]=function(_0x2dca1a,_0x4a5d05){if(_0x2dca1a['body']['id']){delete _0x2dca1a[_0x2569('0x5e')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2dca1a[_0x2569('0x51')]['id']},'include':[{'model':db[_0x2569('0x38')],'as':_0x2569('0x39')}]})[_0x2569('0x1c')](handleEntityNotFound(_0x4a5d05,null))[_0x2569('0x1c')](saveUpdates(_0x2dca1a[_0x2569('0x5e')],null))[_0x2569('0x1c')](respondWithResult(_0x4a5d05,null))['catch'](handleError(_0x4a5d05,null));};exports[_0x2569('0x33')]=function(_0x232ecd,_0x1df6ee){return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x232ecd['params']['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x1df6ee,null))[_0x2569('0x1c')](removeEntity(_0x1df6ee,null))[_0x2569('0x27')](handleError(_0x1df6ee,null));};exports['describe']=function(_0x585080,_0x38010b){return db[_0x2569('0x3b')][_0x2569('0x5f')]()['then'](respondWithResult(_0x38010b,null))['catch'](handleError(_0x38010b,null));};exports[_0x2569('0x60')]=function(_0x2a56aa,_0x43cf8e,_0x5024af){if(_0x2a56aa[_0x2569('0x5e')]['id']){delete _0x2a56aa[_0x2569('0x5e')]['id'];}return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x2a56aa['params']['id']}})['then'](handleEntityNotFound(_0x43cf8e,null))[_0x2569('0x1c')](function(_0x352b86){if(_0x352b86){_0x2a56aa[_0x2569('0x5e')][_0x2569('0x61')]=_0x352b86['id'];return db[_0x2569('0x62')][_0x2569('0x56')](_0x2a56aa[_0x2569('0x5e')]);}})[_0x2569('0x1c')](respondWithResult(_0x43cf8e,null))[_0x2569('0x27')](handleError(_0x43cf8e,null));};exports[_0x2569('0x63')]=function(_0x46fbe4,_0xac2ab2,_0x10248f){var _0x526d50={'raw':![],'where':{}};var _0x207d3b={};var _0x5244c5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2569('0x64')]({'where':{'id':_0x46fbe4[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0xac2ab2,null))[_0x2569('0x1c')](function(_0x55a5e0){if(_0x55a5e0){_0x207d3b[_0x2569('0x3c')]=_[_0x2569('0x3e')](db[_0x2569('0x62')][_0x2569('0x52')]);_0x207d3b[_0x2569('0x3d')]=_['keys'](_0x46fbe4[_0x2569('0x3d')]);_0x207d3b[_0x2569('0x3f')]=_['intersection'](_0x207d3b[_0x2569('0x3c')],_0x207d3b[_0x2569('0x3d')]);_0x526d50[_0x2569('0x42')]=_[_0x2569('0x40')](_0x207d3b['model'],qs['fields'](_0x46fbe4[_0x2569('0x3d')][_0x2569('0x41')]));_0x526d50['attributes']=_0x526d50[_0x2569('0x42')]['length']?_0x526d50[_0x2569('0x42')]:_0x207d3b['model'];if(!_0x46fbe4[_0x2569('0x3d')][_0x2569('0x44')](_0x2569('0x45'))){_0x526d50[_0x2569('0x2b')]=qs[_0x2569('0x2b')](_0x46fbe4['query']['limit']);_0x526d50[_0x2569('0x2d')]=qs[_0x2569('0x2d')](_0x46fbe4[_0x2569('0x3d')][_0x2569('0x2d')]);}_0x526d50[_0x2569('0x46')]=qs[_0x2569('0x47')](_0x46fbe4['query']['sort']);_0x526d50[_0x2569('0x48')]=qs[_0x2569('0x3f')](_['pick'](_0x46fbe4[_0x2569('0x3d')],_0x207d3b[_0x2569('0x3f')]));_0x526d50['where']['OpenchannelAccountId']=_0x55a5e0['id'];if(_0x46fbe4[_0x2569('0x3d')][_0x2569('0x4a')]){_0x526d50[_0x2569('0x48')]=_[_0x2569('0x4b')](_0x526d50[_0x2569('0x48')],{'$or':_[_0x2569('0x3a')](_0x526d50[_0x2569('0x42')],function(_0x4fa9ff){var _0xe7eabc={};_0xe7eabc[_0x4fa9ff]={'$like':'%'+_0x46fbe4['query']['filter']+'%'};return _0xe7eabc;})});}_0x526d50=_[_0x2569('0x4b')]({},_0x526d50,_0x46fbe4[_0x2569('0x54')]);return db[_0x2569('0x62')][_0x2569('0x2c')]({'where':_0x526d50['where']})[_0x2569('0x1c')](function(_0x3da119){_0x5244c5['count']=_0x3da119;if(_0x46fbe4['query'][_0x2569('0x53')]){_0x526d50[_0x2569('0x4e')]=[{'all':!![]}];}return db[_0x2569('0x62')][_0x2569('0x4f')](_0x526d50);})[_0x2569('0x1c')](function(_0x597bfd){_0x5244c5[_0x2569('0x50')]=_0x597bfd;return _0x5244c5;});}})[_0x2569('0x1c')](respondWithFilteredResult(_0xac2ab2,_0x526d50))[_0x2569('0x27')](handleError(_0xac2ab2,null));};exports[_0x2569('0x65')]=function(_0x4f94b4,_0x3cd889,_0x2f3f09){return db[_0x2569('0x3b')]['find']({'where':{'id':_0x4f94b4['params']['id']}})['then'](handleEntityNotFound(_0x3cd889,null))[_0x2569('0x1c')](function(_0x29541c){if(_0x29541c){return _0x29541c[_0x2569('0x65')](_0x4f94b4[_0x2569('0x3d')][_0x2569('0x66')]);}})[_0x2569('0x1c')](respondWithStatusCode(_0x3cd889,null))[_0x2569('0x27')](handleError(_0x3cd889,null));};exports['addAnswer']=function(_0x2612dc,_0x405f5e,_0x1dd031){if(_0x2612dc[_0x2569('0x5e')]['id']){delete _0x2612dc[_0x2569('0x5e')]['id'];}return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x2612dc[_0x2569('0x51')]['id']}})['then'](handleEntityNotFound(_0x405f5e,null))[_0x2569('0x1c')](function(_0x55504b){if(_0x55504b){_0x2612dc[_0x2569('0x5e')][_0x2569('0x61')]=_0x55504b['id'];return db[_0x2569('0x67')][_0x2569('0x56')](_0x2612dc['body']);}})[_0x2569('0x1c')](respondWithResult(_0x405f5e,null))[_0x2569('0x27')](handleError(_0x405f5e,null));};exports['getAnswers']=function(_0x557526,_0x1184cc,_0x3b28fc){var _0x2fa88f={'raw':![],'where':{}};var _0x20891a={};var _0x4c2157={'count':0x0,'rows':[]};return db[_0x2569('0x3b')][_0x2569('0x64')]({'where':{'id':_0x557526[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x1184cc,null))[_0x2569('0x1c')](function(_0x39a3d7){if(_0x39a3d7){_0x20891a[_0x2569('0x3c')]=_[_0x2569('0x3e')](db[_0x2569('0x67')][_0x2569('0x52')]);_0x20891a[_0x2569('0x3d')]=_[_0x2569('0x3e')](_0x557526['query']);_0x20891a[_0x2569('0x3f')]=_[_0x2569('0x40')](_0x20891a[_0x2569('0x3c')],_0x20891a[_0x2569('0x3d')]);_0x2fa88f[_0x2569('0x42')]=_['intersection'](_0x20891a['model'],qs[_0x2569('0x41')](_0x557526[_0x2569('0x3d')][_0x2569('0x41')]));_0x2fa88f[_0x2569('0x42')]=_0x2fa88f['attributes'][_0x2569('0x43')]?_0x2fa88f[_0x2569('0x42')]:_0x20891a[_0x2569('0x3c')];if(!_0x557526['query'][_0x2569('0x44')](_0x2569('0x45'))){_0x2fa88f['limit']=qs[_0x2569('0x2b')](_0x557526[_0x2569('0x3d')][_0x2569('0x2b')]);_0x2fa88f['offset']=qs[_0x2569('0x2d')](_0x557526['query'][_0x2569('0x2d')]);}_0x2fa88f['order']=qs['sort'](_0x557526[_0x2569('0x3d')][_0x2569('0x47')]);_0x2fa88f[_0x2569('0x48')]=qs[_0x2569('0x3f')](_[_0x2569('0x49')](_0x557526['query'],_0x20891a['filters']));_0x2fa88f[_0x2569('0x48')][_0x2569('0x61')]=_0x39a3d7['id'];if(_0x557526[_0x2569('0x3d')][_0x2569('0x4a')]){_0x2fa88f[_0x2569('0x48')]=_[_0x2569('0x4b')](_0x2fa88f[_0x2569('0x48')],{'$or':_['map'](_0x2fa88f[_0x2569('0x42')],function(_0x300f17){var _0x4b42e9={};_0x4b42e9[_0x300f17]={'$like':'%'+_0x557526[_0x2569('0x3d')][_0x2569('0x4a')]+'%'};return _0x4b42e9;})});}_0x2fa88f=_['merge']({},_0x2fa88f,_0x557526[_0x2569('0x54')]);return db[_0x2569('0x67')][_0x2569('0x2c')]({'where':_0x2fa88f[_0x2569('0x48')]})[_0x2569('0x1c')](function(_0x1ccabd){_0x4c2157[_0x2569('0x2c')]=_0x1ccabd;if(_0x557526[_0x2569('0x3d')][_0x2569('0x53')]){_0x2fa88f[_0x2569('0x4e')]=[{'all':!![]}];}return db[_0x2569('0x67')]['findAll'](_0x2fa88f);})[_0x2569('0x1c')](function(_0x57b8d8){_0x4c2157[_0x2569('0x50')]=_0x57b8d8;return _0x4c2157;});}})['then'](respondWithFilteredResult(_0x1184cc,_0x2fa88f))[_0x2569('0x27')](handleError(_0x1184cc,null));};exports['removeAnswers']=function(_0x16c6af,_0x21949b,_0x2c1631){return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x16c6af[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x21949b,null))[_0x2569('0x1c')](function(_0x71291b){if(_0x71291b){return _0x71291b[_0x2569('0x68')](_0x16c6af['query']['ids']);}})[_0x2569('0x1c')](respondWithStatusCode(_0x21949b,null))[_0x2569('0x27')](handleError(_0x21949b,null));};exports['notify']=function(_0x2027b6,_0x1cb979,_0x3f56db){var _0x101418={'body':_0x2027b6[_0x2569('0x5e')],'channel':_0x2569('0x69')};var _0x1cd3c2=[];var _0x3a01a0=[];var _0x2ce7d5={};var _0x47455e=![];return db['CmContact'][_0x2569('0x5f')]()[_0x2569('0x1c')](function(_0xc3bee6){if(!_0xc3bee6){throw new db['Sequelize'][(_0x2569('0x6a'))](_0x2569('0x6b'));}_0x1cd3c2=_[_0x2569('0x6c')](_[_0x2569('0x3e')](_0xc3bee6),[_0x2569('0x6d'),'updatedAt']);_0x3a01a0=_[_0x2569('0x6c')](_['keys'](_0xc3bee6),[_0x2569('0x6d'),_0x2569('0x6e'),_0x2569('0x6f'),_0x2569('0x70')]);if(_0x2027b6[_0x2569('0x5e')]['id']){delete _0x2027b6[_0x2569('0x5e')]['id'];}if(_[_0x2569('0x71')](_0x2027b6[_0x2569('0x5e')][_0x2569('0x72')])){throw new db[(_0x2569('0x73'))][(_0x2569('0x6a'))](_0x2569('0x74'));}if(_[_0x2569('0x71')](_0x2027b6[_0x2569('0x5e')][_0x2569('0x5e')])||_0x2027b6['body'][_0x2569('0x5e')]===''){throw new db[(_0x2569('0x73'))][(_0x2569('0x6a'))](_0x2569('0x75'));}if(_[_0x2569('0x71')](_0x2027b6['body'][_0x2569('0x76')])){throw new db[(_0x2569('0x73'))][(_0x2569('0x6a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a01a0);}if(!_[_0x2569('0x77')](_0x3a01a0,_0x2027b6[_0x2569('0x5e')]['mapKey'])){throw new db[(_0x2569('0x73'))][(_0x2569('0x6a'))](_0x2569('0x78')+_0x3a01a0);}_0x2ce7d5[_0x2027b6[_0x2569('0x5e')][_0x2569('0x76')]]=_0x2027b6[_0x2569('0x5e')][_0x2569('0x72')];})[_0x2569('0x1c')](function(){return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x2027b6[_0x2569('0x51')]['id']},'include':[{'model':db[_0x2569('0x79')],'as':_0x2569('0x7a'),'include':[{'model':db[_0x2569('0x7b')],'as':'Contacts','where':_0x2ce7d5,'limit':0x1,'order':[[_0x2569('0x6e'),'DESC']]}]},{'model':db[_0x2569('0x7c')],'as':_0x2569('0x7d')}]});})['then'](handleEntityNotFound(_0x1cb979,null))[_0x2569('0x1c')](function(_0x440e27){if(_0x440e27&&_0x440e27[_0x2569('0x7a')]){_0x101418['account']=_0x440e27;_0x101418[_0x2569('0x7e')]=_0x440e27[_0x2569('0x7d')];_0x101418[_0x2569('0x7f')]=_0x440e27['List'];_0x101418[_0x2569('0x7e')]=_[_0x2569('0x80')](_0x101418['applications'],[_0x2569('0x81')],[_0x2569('0x82')]);if(_0x101418[_0x2569('0x83')][_0x2569('0x7d')]){delete _0x101418[_0x2569('0x83')][_0x2569('0x7d')];}if(_0x101418[_0x2569('0x83')]['List']&&_0x101418[_0x2569('0x83')][_0x2569('0x7a')][_0x2569('0x84')]['length']){return _0x101418['account'][_0x2569('0x7a')][_0x2569('0x84')][0x0];}var _0x163017=_[_0x2569('0x85')](_0x2027b6['body'],{'firstName':_0x2027b6['body'][_0x2569('0x72')],'ListId':_0x440e27[_0x2569('0x70')]});_0x163017[_0x2027b6[_0x2569('0x5e')][_0x2569('0x76')]]=_0x2027b6['body'][_0x2569('0x72')];return db['CmContact'][_0x2569('0x56')](_0x163017,{'fields':_0x1cd3c2,'raw':!![]});}})['then'](handleEntityNotFound(_0x1cb979,null))[_0x2569('0x1c')](function(_0x846b3a){_0x101418['contact']=_0x846b3a;if(_0x846b3a){var _0x1578c5={'ContactId':_0x846b3a['id'],'OpenchannelAccountId':_0x2027b6[_0x2569('0x51')]['id'],'from':(_0x846b3a[_0x2569('0x86')]||'')+'\x20'+(_0x846b3a[_0x2569('0x87')]||'')};var _0x3686dc={'OpenchannelAccountId':_0x2027b6[_0x2569('0x51')]['id'],'closed':![]};if(_0x2027b6[_0x2569('0x5e')][_0x2569('0x88')]){_0x3686dc[_0x2569('0x88')]=_0x2027b6[_0x2569('0x5e')][_0x2569('0x88')];return db[_0x2569('0x89')]['find']({'where':_0x3686dc})[_0x2569('0x1c')](function(_0x345151){if(_0x345151){return[_0x345151,![]];}_0x1578c5[_0x2569('0x88')]=_0x2027b6[_0x2569('0x5e')][_0x2569('0x88')];_0x1578c5[_0x2569('0x8a')]=_0x2027b6['body'][_0x2569('0x8a')];return db[_0x2569('0x89')][_0x2569('0x56')](_0x1578c5)[_0x2569('0x1c')](function(_0x419e1b){return[_0x419e1b,!![]];});});}else{_0x3686dc[_0x2569('0x88')]=null;}_0x3686dc[_0x2569('0x8b')]=_0x846b3a['id'];return db[_0x2569('0x89')][_0x2569('0x55')]({'where':_0x3686dc})[_0x2569('0x1c')](function(_0x27e1ca){if(_0x27e1ca){return[_0x27e1ca,![]];}return db[_0x2569('0x89')][_0x2569('0x56')](_0x1578c5)['then'](function(_0xca5441){return[_0xca5441,!![]];});});}})['spread'](function(_0x7e445,_0x2a67bb){if(_0x7e445){_0x47455e=_0x2a67bb;if(!_0x2a67bb){var _0x565b43={'from':(_0x101418[_0x2569('0x8c')][_0x2569('0x86')]||'')+'\x20'+(_0x101418[_0x2569('0x8c')][_0x2569('0x87')]||'')};if(_0x2027b6['body']['threadId']&&_0x2027b6['body'][_0x2569('0x8d')]&&_0x2027b6['body'][_0x2569('0x88')]!=_0x2027b6['body'][_0x2569('0x8d')]){_0x565b43[_0x2569('0x88')]=_0x2027b6[_0x2569('0x5e')][_0x2569('0x8d')];}return _0x7e445[_0x2569('0x32')](_0x565b43);}else{return _0x7e445;}}})[_0x2569('0x1c')](function(_0xcbd235){_0x101418[_0x2569('0x8e')]=_0xcbd235['get']({'plain':!![]});_0x101418[_0x2569('0x8e')][_0x2569('0x8f')]=_0x47455e;if(_0x101418[_0x2569('0x8e')][_0x2569('0x8f')]){if(_0x101418[_0x2569('0x83')][_0x2569('0x90')]){_0x101418[_0x2569('0x7e')]['push']({'id':0x0,'priority':_0x101418[_0x2569('0x7e')][_0x2569('0x43')]+0x1,'app':'close','appdata':_0x2569('0x91'),'interval':_0x2569('0x92')});}}return db[_0x2569('0x93')][_0x2569('0x56')]({'body':_0x2027b6[_0x2569('0x5e')][_0x2569('0x5e')],'OpenchannelAccountId':_0x2027b6[_0x2569('0x51')]['id'],'OpenchannelInteractionId':_0xcbd235['id'],'direction':'in','ContactId':_0x101418[_0x2569('0x8c')]['id'],'AttachmentId':_0x2027b6[_0x2569('0x5e')][_0x2569('0x94')]});})[_0x2569('0x1c')](function(_0x5ac3f8){_0x101418[_0x2569('0x25')]=_0x5ac3f8;if(!_0x101418[_0x2569('0x8e')][_0x2569('0x95')])return;return db[_0x2569('0x96')]['find']({'attributes':['id',_0x2569('0x37')],'where':{'id':_0x101418['interaction'][_0x2569('0x95')]}});})[_0x2569('0x1c')](function(_0x587764){if(_0x587764){_0x101418['applications'][_0x2569('0x97')]({'id':0x0,'priority':0x0,'app':_0x2569('0x98'),'appdata':_0x587764[_0x2569('0x37')]+','+(_0x101418[_0x2569('0x83')][_0x2569('0x99')]||0xa),'interval':_0x2569('0x92')});}if(!_0x101418['interaction'][_0x2569('0x9a')])return;return db['OpenchannelQueue'][_0x2569('0x55')]({'attributes':['id',_0x2569('0x37')],'where':{'id':_0x101418['interaction'][_0x2569('0x9a')]}});})[_0x2569('0x1c')](function(_0x1142c6){if(_0x1142c6){_0x101418[_0x2569('0x7e')]['unshift']({'id':0x0,'priority':0x1,'app':_0x2569('0x9b'),'appdata':_0x1142c6[_0x2569('0x37')]+','+(_0x101418[_0x2569('0x83')][_0x2569('0x9c')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2569('0x9d'),_0x2569('0x9e'),_0x101418);})[_0x2569('0x1c')](function(_0x9514e2){respondWithRpcPromise(_0x2569('0x9f'),_0x2569('0x9f'),{'event':_0x2569('0xa0'),'message':_0x9514e2},client9002);return _0x9514e2;})[_0x2569('0x1c')](respondWithResult(_0x1cb979,null))[_0x2569('0x27')](handleError(_0x1cb979,null));};exports['addApplications']=function(_0x356fe3,_0x29f363){var _0x2e6bab=_0x356fe3[_0x2569('0x51')]['id'];var _0x2ab53e=_0x356fe3[_0x2569('0x5e')];var _0x470d1d=0xc8;var _0x5727fd=null;return db[_0x2569('0xa1')][_0x2569('0xa2')]({'isolationLevel':db['sequelize'][_0x2569('0xa3')][_0x2569('0xa4')]['READ_COMMITTED']},function(_0x11c6ad){return db['OpenchannelAccount'][_0x2569('0x64')]({'where':{'id':_0x2e6bab},'transaction':_0x11c6ad})[_0x2569('0x1c')](function(_0x28bea0){if(_0x28bea0){return db[_0x2569('0x7c')][_0x2569('0x33')]({'where':{'OpenchannelAccountId':_0x2e6bab},'transaction':_0x11c6ad})[_0x2569('0x1c')](function(){var _0x56b8f6=_['map'](_0x2ab53e,function(_0x20f1d4){_0x20f1d4[_0x2569('0x61')]=_0x2e6bab;return _0x20f1d4;});return db[_0x2569('0x7c')][_0x2569('0xa5')](_0x56b8f6,{'transaction':_0x11c6ad});});}else{_0x470d1d=0x194;_0x5727fd=[];}});})[_0x2569('0x1c')](function(){if(_0x470d1d!==0x194){return db['OpenchannelApplication'][_0x2569('0xa6')]({'where':{'OpenchannelAccountId':_0x2e6bab},'order':_0x2569('0x81')})[_0x2569('0x1c')](function(_0x3b794b){_0x5727fd=_0x3b794b;});}})[_0x2569('0x27')](function(_0x22210b){_0x470d1d=0x1f4;logger[_0x2569('0x23')](_0x22210b['stack']);if(_0x22210b[_0x2569('0x37')]){delete _0x22210b['name'];}_0x5727fd=_0x22210b;})['finally'](function(){if(_0x5727fd===null){_0x29f363['sendStatus'](_0x470d1d);}else{if(_0x470d1d===0x1f4){_0x29f363[_0x2569('0x2e')](_0x470d1d)['send'](_0x5727fd);}else{_0x29f363['status'](_0x470d1d)[_0x2569('0xa7')](_0x5727fd);}}});};exports[_0x2569('0xa8')]=function(_0x4a6ae8,_0x3a6ee4,_0x564bf0){var _0x273337={};var _0x42252d={};var _0x372a6e;var _0x405689;return db[_0x2569('0x3b')]['findOne']({'where':{'id':_0x4a6ae8[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x3a6ee4,null))[_0x2569('0x1c')](function(_0x2166c2){if(_0x2166c2){_0x372a6e=_0x2166c2;_0x42252d[_0x2569('0x3c')]=_[_0x2569('0x3e')](db[_0x2569('0x7c')][_0x2569('0x52')]);_0x42252d[_0x2569('0x3d')]=_[_0x2569('0x3e')](_0x4a6ae8['query']);_0x42252d[_0x2569('0x3f')]=_[_0x2569('0x40')](_0x42252d[_0x2569('0x3c')],_0x42252d['query']);_0x273337['attributes']=_[_0x2569('0x40')](_0x42252d[_0x2569('0x3c')],qs[_0x2569('0x41')](_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x41')]));_0x273337[_0x2569('0x42')]=_0x273337[_0x2569('0x42')]['length']?_0x273337[_0x2569('0x42')]:_0x42252d[_0x2569('0x3c')];_0x273337[_0x2569('0x46')]=qs[_0x2569('0x47')](_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x47')]);_0x273337['where']=qs[_0x2569('0x3f')](_[_0x2569('0x49')](_0x4a6ae8[_0x2569('0x3d')],_0x42252d[_0x2569('0x3f')]));if(_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x4a')]){_0x273337[_0x2569('0x48')]=_['merge'](_0x273337['where'],{'$or':_[_0x2569('0x3a')](_0x273337[_0x2569('0x42')],function(_0x2fb6b8){var _0x56d1ac={};_0x56d1ac[_0x2fb6b8]={'$like':'%'+_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x4a')]+'%'};return _0x56d1ac;})});}_0x273337=_[_0x2569('0x4b')]({},_0x273337,_0x4a6ae8[_0x2569('0x54')]);return _0x372a6e[_0x2569('0xa8')](_0x273337);}})['then'](function(_0x31d1d6){if(_0x31d1d6){_0x405689=_0x31d1d6[_0x2569('0x43')];if(!_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x44')](_0x2569('0x45'))){_0x273337['limit']=qs[_0x2569('0x2b')](_0x4a6ae8['query']['limit']);_0x273337[_0x2569('0x2d')]=qs[_0x2569('0x2d')](_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x2d')]);}return _0x372a6e[_0x2569('0xa8')](_0x273337);}})[_0x2569('0x1c')](function(_0x3c54ec){if(_0x3c54ec){return _0x3c54ec?{'count':_0x405689,'rows':_0x3c54ec}:null;}})[_0x2569('0x1c')](respondWithResult(_0x3a6ee4,null))[_0x2569('0x27')](handleError(_0x3a6ee4,null));};exports[_0x2569('0xa9')]=function(_0x5dab93,_0x5133b1,_0x5366ab){var _0x2c12e4={'raw':![],'where':{}};var _0x56c8ea={};var _0x402143={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5dab93[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x5133b1,null))[_0x2569('0x1c')](function(_0x26f226){if(_0x26f226){_0x56c8ea[_0x2569('0x3c')]=_[_0x2569('0x3e')](db[_0x2569('0x89')][_0x2569('0x52')]);_0x56c8ea[_0x2569('0x3d')]=_[_0x2569('0x3e')](_0x5dab93[_0x2569('0x3d')]);_0x56c8ea['filters']=_[_0x2569('0x40')](_0x56c8ea[_0x2569('0x3c')],_0x56c8ea[_0x2569('0x3d')]);_0x2c12e4[_0x2569('0x42')]=_[_0x2569('0x40')](_0x56c8ea[_0x2569('0x3c')],qs['fields'](_0x5dab93['query'][_0x2569('0x41')]));_0x2c12e4['attributes']=_0x2c12e4['attributes'][_0x2569('0x43')]?_0x2c12e4[_0x2569('0x42')]:_0x56c8ea[_0x2569('0x3c')];if(!_0x5dab93[_0x2569('0x3d')][_0x2569('0x44')]('nolimit')){_0x2c12e4[_0x2569('0x2b')]=qs[_0x2569('0x2b')](_0x5dab93[_0x2569('0x3d')][_0x2569('0x2b')]);_0x2c12e4[_0x2569('0x2d')]=qs['offset'](_0x5dab93[_0x2569('0x3d')]['offset']);}_0x2c12e4['order']=qs[_0x2569('0x47')](_0x5dab93[_0x2569('0x3d')][_0x2569('0x47')]);_0x2c12e4[_0x2569('0x48')]=qs[_0x2569('0x3f')](_['pick'](_0x5dab93[_0x2569('0x3d')],_0x56c8ea['filters']));_0x2c12e4[_0x2569('0x48')][_0x2569('0x61')]=_0x26f226['id'];if(_0x5dab93[_0x2569('0x3d')][_0x2569('0x4a')]){_0x2c12e4[_0x2569('0x48')]=_[_0x2569('0x4b')](_0x2c12e4[_0x2569('0x48')],{'$or':_['map'](_0x2c12e4[_0x2569('0x42')],function(_0x349839){var _0x28d3ab={};_0x28d3ab[_0x349839]={'$like':'%'+_0x5dab93[_0x2569('0x3d')][_0x2569('0x4a')]+'%'};return _0x28d3ab;})});}_0x2c12e4=_[_0x2569('0x4b')]({},_0x2c12e4,_0x5dab93[_0x2569('0x54')]);return db[_0x2569('0x89')][_0x2569('0x2c')]({'where':_0x2c12e4[_0x2569('0x48')]})[_0x2569('0x1c')](function(_0x45e703){_0x402143['count']=_0x45e703;if(_0x5dab93[_0x2569('0x3d')][_0x2569('0x53')]){_0x2c12e4['include']=[{'model':db[_0x2569('0x7b')],'as':_0x2569('0xaa'),'required':![]},{'model':db[_0x2569('0x96')],'as':'Owner','attributes':[_0x2569('0x37'),_0x2569('0xab'),'internal'],'required':![]},{'model':db[_0x2569('0xac')],'as':_0x2569('0xad'),'attributes':['id',_0x2569('0x37'),_0x2569('0xae')],'where':_0x5dab93[_0x2569('0x3d')][_0x2569('0xaf')]?{'id':_0x5dab93['query'][_0x2569('0xaf')]}:undefined,'required':_0x5dab93[_0x2569('0x3d')][_0x2569('0xaf')]?!![]:![]}];}return db[_0x2569('0x89')][_0x2569('0x4f')](_0x2c12e4);})[_0x2569('0x1c')](function(_0x1c95b6){_0x402143[_0x2569('0x50')]=_0x1c95b6;return _0x402143;});}})[_0x2569('0x1c')](respondWithFilteredResult(_0x5133b1,_0x2c12e4))[_0x2569('0x27')](handleError(_0x5133b1,null));};exports[_0x2569('0xb0')]=function(_0x59ae7d,_0x2a2e5d,_0x3e7556){return db['OpenchannelAccount'][_0x2569('0x55')]({'where':{'id':_0x59ae7d[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x2a2e5d,null))[_0x2569('0x1c')](function(_0x1795da){if(_0x1795da){return _0x1795da[_0x2569('0xb0')](_0x59ae7d[_0x2569('0x5e')][_0x2569('0x66')],_[_0x2569('0xb1')](_0x59ae7d[_0x2569('0x5e')],['ids','id'])||{})[_0x2569('0xb2')](function(_0x31c463){for(var _0x5c4029=0x0;_0x5c4029<_0x59ae7d['body'][_0x2569('0x66')][_0x2569('0x43')];_0x5c4029+=0x1){socket[_0x2569('0xb3')](_0x2569('0xb4'),{'UserId':Number(_0x59ae7d[_0x2569('0x5e')][_0x2569('0x66')][_0x5c4029]),'OpenchannelAccountId':Number(_0x59ae7d[_0x2569('0x51')]['id'])});}return _0x31c463;});}})[_0x2569('0x1c')](respondWithResult(_0x2a2e5d,null))['catch'](handleError(_0x2a2e5d,null));};exports[_0x2569('0xb5')]=function(_0x45b34d,_0x5cbc46,_0x4b4068){return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x45b34d[_0x2569('0x51')]['id']}})['then'](handleEntityNotFound(_0x5cbc46,null))[_0x2569('0x1c')](function(_0x4baa28){if(_0x4baa28){return _0x4baa28[_0x2569('0xb5')](_0x45b34d[_0x2569('0x3d')][_0x2569('0x66')])['then'](function(){if(_[_0x2569('0xb6')](_0x45b34d[_0x2569('0x3d')][_0x2569('0x66')])){for(var _0x13351a=0x0;_0x13351a<_0x45b34d['query'][_0x2569('0x66')][_0x2569('0x43')];_0x13351a+=0x1){socket[_0x2569('0xb3')](_0x2569('0xb7'),{'UserId':Number(_0x45b34d[_0x2569('0x3d')][_0x2569('0x66')][_0x13351a]),'OpenchannelAccountId':Number(_0x45b34d[_0x2569('0x51')]['id'])});}}else{socket[_0x2569('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x45b34d[_0x2569('0x3d')][_0x2569('0x66')]),'OpenchannelAccountId':Number(_0x45b34d[_0x2569('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x5cbc46,null))[_0x2569('0x27')](handleError(_0x5cbc46,null));};exports['getAgents']=function(_0x484428,_0x125726,_0x48530c){var _0x1a6615={};var _0x1d8ead={};var _0x279953;var _0x83a47c;return db[_0x2569('0x3b')][_0x2569('0x64')]({'where':{'id':_0x484428['params']['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x125726,null))[_0x2569('0x1c')](function(_0x2531a9){if(_0x2531a9){_0x279953=_0x2531a9;_0x1d8ead[_0x2569('0x3c')]=_[_0x2569('0x3e')](db[_0x2569('0x96')][_0x2569('0x52')]);_0x1d8ead[_0x2569('0x3d')]=_['keys'](_0x484428[_0x2569('0x3d')]);_0x1d8ead[_0x2569('0x3f')]=_[_0x2569('0x40')](_0x1d8ead[_0x2569('0x3c')],_0x1d8ead['query']);_0x1a6615[_0x2569('0x42')]=_['intersection'](_0x1d8ead[_0x2569('0x3c')],qs[_0x2569('0x41')](_0x484428[_0x2569('0x3d')][_0x2569('0x41')]));_0x1a6615['attributes']=_0x1a6615['attributes'][_0x2569('0x43')]?_0x1a6615[_0x2569('0x42')]:_0x1d8ead[_0x2569('0x3c')];_0x1a6615[_0x2569('0x46')]=qs[_0x2569('0x47')](_0x484428[_0x2569('0x3d')]['sort']);_0x1a6615[_0x2569('0x48')]=qs[_0x2569('0x3f')](_[_0x2569('0x49')](_0x484428[_0x2569('0x3d')],_0x1d8ead[_0x2569('0x3f')]));if(_0x484428['query']['filter']){_0x1a6615[_0x2569('0x48')]=_['merge'](_0x1a6615['where'],{'$or':_[_0x2569('0x3a')](_0x1a6615[_0x2569('0x42')],function(_0x11b718){var _0x305662={};_0x305662[_0x11b718]={'$like':'%'+_0x484428[_0x2569('0x3d')][_0x2569('0x4a')]+'%'};return _0x305662;})});}_0x1a6615=_['merge']({},_0x1a6615,_0x484428[_0x2569('0x54')]);return _0x279953[_0x2569('0xb8')](_0x1a6615);}})['then'](function(_0x1f27a3){if(_0x1f27a3){_0x83a47c=_0x1f27a3[_0x2569('0x43')];if(!_0x484428['query']['hasOwnProperty']('nolimit')){_0x1a6615[_0x2569('0x2b')]=qs[_0x2569('0x2b')](_0x484428['query'][_0x2569('0x2b')]);_0x1a6615[_0x2569('0x2d')]=qs[_0x2569('0x2d')](_0x484428[_0x2569('0x3d')]['offset']);}return _0x279953[_0x2569('0xb8')](_0x1a6615);}})['then'](function(_0x50fba3){if(_0x50fba3){return _0x50fba3?{'count':_0x83a47c,'rows':_0x50fba3}:null;}})['then'](respondWithResult(_0x125726,null))[_0x2569('0x27')](handleError(_0x125726,null));};exports['send']=function(_0x378558,_0x37ad24,_0x2bc328){var _0x9eee57,_0x2064b7,_0x9eae1c;if(_[_0x2569('0x71')](_0x378558[_0x2569('0x5e')][_0x2569('0x5e')])||_0x378558[_0x2569('0x5e')][_0x2569('0x5e')]===''){throw new db[(_0x2569('0x73'))][(_0x2569('0x6a'))](_0x2569('0x75'));}if(_['isNil'](_0x378558[_0x2569('0x5e')]['to'])){}_0x9eee57=_0x378558['body']['to'];return db[_0x2569('0x3b')][_0x2569('0x64')]({'where':{'id':_0x378558[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x37ad24,null))['then'](function(_0x3c2a0a){if(_0x3c2a0a){return db['OpenchannelAccount'][_0x2569('0x55')]({'where':{'id':_0x3c2a0a['id']},'include':[{'model':db[_0x2569('0x79')],'as':_0x2569('0x7a'),'include':[{'model':db['CmContact'],'as':_0x2569('0x84'),'where':{[_0x3c2a0a[_0x2569('0x76')]]:_0x9eee57},'limit':0x1,'order':[[_0x2569('0x6e'),_0x2569('0xb9')]]}]}]})[_0x2569('0x1c')](handleEntityNotFound(_0x37ad24,null))[_0x2569('0x1c')](function(_0x57d844){if(_0x57d844&&_0x57d844[_0x2569('0x7a')]){_0x2064b7=_0x57d844[_0x2569('0x34')]({'plain':!![]});if(_0x2064b7[_0x2569('0x7a')]&&_0x2064b7[_0x2569('0x7a')][_0x2569('0x84')]['length']){return _0x2064b7[_0x2569('0x7a')][_0x2569('0x84')][0x0];}return db[_0x2569('0x7b')][_0x2569('0x56')](_['defaults'](_0x378558[_0x2569('0x5e')],{'firstName':_0x9eee57,[_0x57d844[_0x2569('0x76')]]:_0x9eee57,'phone':_0x9eee57,'ListId':_0x2064b7[_0x2569('0x70')]}));}})['then'](handleEntityNotFound(_0x37ad24,null))[_0x2569('0x1c')](function(_0x62ab72){if(_0x62ab72){_0x9eae1c=_0x62ab72;return db[_0x2569('0x89')][_0x2569('0x55')]({'where':{'ContactId':_0x9eae1c['id'],'closed':![],'OpenchannelAccountId':_0x2064b7['id']}})[_0x2569('0x1c')](function(_0x101705){if(_0x101705){return[_0x101705,![]];}return db[_0x2569('0x89')][_0x2569('0x56')]({'UserId':_0x378558[_0x2569('0x57')]['id'],'ContactId':_0x9eae1c['id'],'OpenchannelAccountId':_0x2064b7['id'],'lastMsgDirection':_0x2569('0xba'),'firstMsgDirection':_0x2569('0xba'),'Messages':[_[_0x2569('0x4b')](_0x378558[_0x2569('0x5e')],{'read':![],'body':_0x378558[_0x2569('0x5e')]['body'],'OpenchannelAccountId':_0x2064b7['id'],'UserId':_0x378558[_0x2569('0x57')]['id'],'ContactId':_0x9eae1c['id']})]},{'include':[{'model':db[_0x2569('0x93')],'as':_0x2569('0xbb')}]})[_0x2569('0x1c')](function(_0x7c8344){return[_0x7c8344,!![]];});});}})[_0x2569('0xb2')](function(_0x231aa5,_0x59bb5e){if(_0x59bb5e){return _0x231aa5;}return db[_0x2569('0x93')][_0x2569('0x56')](_['merge'](_0x378558['body'],{'read':![],'body':_0x378558['body'][_0x2569('0x5e')],'OpenchannelAccountId':_0x2064b7['id'],'OpenchannelInteractionId':_0x231aa5['id'],'UserId':_0x378558[_0x2569('0x57')]['id'],'ContactId':_0x9eae1c['id']}))['then'](function(_0x3a012e){_0x231aa5[_0x2569('0xbc')][_0x2569('0xbb')]=[];_0x231aa5[_0x2569('0xbc')][_0x2569('0xbb')][_0x2569('0xbd')](_0x3a012e[_0x2569('0xbc')]);return _0x231aa5;});});}})[_0x2569('0x1c')](respondWithResult(_0x37ad24,null))[_0x2569('0x27')](handleError(_0x37ad24,null));}; \ No newline at end of file +var _0x4300=['notify','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','findOne','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','tag','omit','spread','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','DESC','out','Messages','dataValues','eml-format','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','hasOwnProperty','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','from','CmList','List','Contacts','OpenchannelApplication','Applications','applications','list','priority','account','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','interaction','created','autoclose','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager'];(function(_0x45e43,_0x338d7b){var _0xd93d4a=function(_0x37a238){while(--_0x37a238){_0x45e43['push'](_0x45e43['shift']());}};_0xd93d4a(++_0x338d7b);}(_0x4300,0x1a6));var _0x0430=function(_0x305cde,_0x4c2437){_0x305cde=_0x305cde-0x0;var _0x45b651=_0x4300[_0x305cde];return _0x45b651;};'use strict';var emlformat=require(_0x0430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0430('0x1'));var BPromise=require(_0x0430('0x2'));var Mustache=require(_0x0430('0x3'));var util=require(_0x0430('0x4'));var path=require(_0x0430('0x5'));var sox=require('sox');var csv=require(_0x0430('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0430('0x7'));var _=require('lodash');var squel=require(_0x0430('0x8'));var crypto=require(_0x0430('0x9'));var jsforce=require(_0x0430('0xa'));var deskjs=require(_0x0430('0xb'));var toCsv=require(_0x0430('0x6'));var querystring=require(_0x0430('0xc'));var Papa=require(_0x0430('0xd'));var Redis=require(_0x0430('0xe'));var authService=require(_0x0430('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0430('0x10'));var hardwareService=require(_0x0430('0x11'));var logger=require(_0x0430('0x12'))(_0x0430('0x13'));var utils=require(_0x0430('0x14'));var config=require(_0x0430('0x15'));var licenseUtil=require(_0x0430('0x16'));var db=require(_0x0430('0x17'))['db'];config['redis']=_['defaults'](config[_0x0430('0x18')],{'host':_0x0430('0x19'),'port':0x18eb});var socket=require(_0x0430('0x1a'))(new Redis(config[_0x0430('0x18')]));require(_0x0430('0x1b'))[_0x0430('0x1c')](socket);var jayson=require(_0x0430('0x1d'));var client=jayson['client'][_0x0430('0x1e')]({'port':0x232c});var client9002=jayson[_0x0430('0x1f')][_0x0430('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3b34af,_0x5c98c9,_0x57b648,_0x48568a){return new BPromise(function(_0x54fbf8,_0x5ecd6b){var _0x495094=_0x48568a||client;return _0x495094[_0x0430('0x20')](_0x3b34af,_0x57b648)[_0x0430('0x21')](function(_0x391791){logger[_0x0430('0x22')](_0x0430('0x23'),_0x5c98c9,'request\x20sent');logger['debug'](_0x0430('0x24'),_0x5c98c9,_0x0430('0x25'),JSON[_0x0430('0x26')](_0x391791));if(_0x391791[_0x0430('0x27')]){if(_0x391791['error']['code']===0x1f4){logger[_0x0430('0x27')](_0x0430('0x23'),_0x5c98c9,_0x391791[_0x0430('0x27')][_0x0430('0x28')]);return _0x5ecd6b(_0x391791[_0x0430('0x27')][_0x0430('0x28')]);}logger['error'](_0x0430('0x23'),_0x5c98c9,_0x391791[_0x0430('0x27')][_0x0430('0x28')]);return _0x54fbf8(_0x391791[_0x0430('0x27')]['message']);}else{logger[_0x0430('0x22')](_0x0430('0x23'),_0x5c98c9,_0x0430('0x25'));_0x54fbf8(_0x391791[_0x0430('0x29')][_0x0430('0x28')]);}})[_0x0430('0x2a')](function(_0x345b8c){logger[_0x0430('0x27')](_0x0430('0x23'),_0x5c98c9,_0x345b8c);_0x5ecd6b(_0x345b8c);});});}function respondWithStatusCode(_0x58b343,_0x375e54){_0x375e54=_0x375e54||0xcc;return function(_0x531611){if(_0x531611){return _0x58b343['sendStatus'](_0x375e54);}return _0x58b343[_0x0430('0x2b')](_0x375e54)[_0x0430('0x2c')]();};}function respondWithResult(_0x54b07c,_0x2d302b){_0x2d302b=_0x2d302b||0xc8;return function(_0x175fb1){if(_0x175fb1){return _0x54b07c[_0x0430('0x2b')](_0x2d302b)[_0x0430('0x2d')](_0x175fb1);}};}function respondWithFilteredResult(_0x2b94e4,_0x3805f7){return function(_0x1df9ec){if(_0x1df9ec){var _0xd6b31a=typeof _0x3805f7[_0x0430('0x2e')]==='undefined'&&typeof _0x3805f7['limit']==='undefined';var _0x1e888d=_0x1df9ec['count'];var _0x41645c=_0xd6b31a?0x0:_0x3805f7['offset'];var _0x52d382=_0xd6b31a?_0x1df9ec[_0x0430('0x2f')]:_0x3805f7[_0x0430('0x2e')]+_0x3805f7[_0x0430('0x30')];var _0x2be726;if(_0x52d382>=_0x1e888d){_0x52d382=_0x1e888d;_0x2be726=0xc8;}else{_0x2be726=0xce;}_0x2b94e4['status'](_0x2be726);return _0x2b94e4['set'](_0x0430('0x31'),_0x41645c+'-'+_0x52d382+'/'+_0x1e888d)[_0x0430('0x2d')](_0x1df9ec);}return null;};}function patchUpdates(_0x530a09){return function(_0x582eec){try{jsonpatch[_0x0430('0x32')](_0x582eec,_0x530a09,!![]);}catch(_0x2010fd){return BPromise[_0x0430('0x33')](_0x2010fd);}return _0x582eec[_0x0430('0x34')]();};}function saveUpdates(_0x1b75cf,_0x28f9cc){return function(_0x124354){if(_0x124354){return _0x124354[_0x0430('0x35')](_0x1b75cf)[_0x0430('0x21')](function(_0x57a621){return _0x57a621;});}return null;};}function removeEntity(_0x548071,_0xcfe157){return function(_0x472f54){if(_0x472f54){return _0x472f54['destroy']()[_0x0430('0x21')](function(){var _0x5bd2b7=_0x472f54[_0x0430('0x36')]({'plain':!![]});var _0x504b68='OpenchannelAccounts';return db[_0x0430('0x37')][_0x0430('0x38')]({'where':{'type':_0x504b68,'resourceId':_0x5bd2b7['id']}})[_0x0430('0x21')](function(){return _0x472f54;});})[_0x0430('0x21')](function(){_0x548071[_0x0430('0x2b')](0xcc)[_0x0430('0x2c')]();});}};}function handleEntityNotFound(_0x56072c,_0x659aca){return function(_0x8169b6){if(!_0x8169b6){_0x56072c[_0x0430('0x39')](0x194);}return _0x8169b6;};}function handleError(_0xb2baa5,_0x4224e4){_0x4224e4=_0x4224e4||0x1f4;return function(_0x41490f){logger[_0x0430('0x27')](_0x41490f[_0x0430('0x3a')]);if(_0x41490f[_0x0430('0x3b')]){delete _0x41490f[_0x0430('0x3b')];}_0xb2baa5['status'](_0x4224e4)[_0x0430('0x3c')](_0x41490f);};}exports[_0x0430('0x3d')]=function(_0x418255,_0x314b27){var _0x1eed1a={'include':[{'model':db[_0x0430('0x3e')],'as':_0x0430('0x3f')}]},_0x29854f={},_0x5d1a80={'count':0x0,'rows':[]};var _0x50cdcd=_[_0x0430('0x40')](db[_0x0430('0x41')][_0x0430('0x42')],function(_0x2ef408){return{'name':_0x2ef408[_0x0430('0x43')],'type':_0x2ef408[_0x0430('0x44')][_0x0430('0x45')]};});_0x29854f[_0x0430('0x46')]=_[_0x0430('0x40')](_0x50cdcd,'name');_0x29854f[_0x0430('0x47')]=_[_0x0430('0x48')](_0x418255[_0x0430('0x47')]);_0x29854f[_0x0430('0x49')]=_['intersection'](_0x29854f[_0x0430('0x46')],_0x29854f[_0x0430('0x47')]);_0x1eed1a[_0x0430('0x4a')]=_[_0x0430('0x4b')](_0x29854f[_0x0430('0x46')],qs[_0x0430('0x4c')](_0x418255[_0x0430('0x47')][_0x0430('0x4c')]));_0x1eed1a[_0x0430('0x4a')]=_0x1eed1a[_0x0430('0x4a')][_0x0430('0x4d')]?_0x1eed1a['attributes']:_0x29854f[_0x0430('0x46')];if(!_0x418255['query']['hasOwnProperty'](_0x0430('0x4e'))){_0x1eed1a['limit']=qs['limit'](_0x418255[_0x0430('0x47')]['limit']);_0x1eed1a['offset']=qs[_0x0430('0x2e')](_0x418255['query']['offset']);}_0x1eed1a[_0x0430('0x4f')]=qs['sort'](_0x418255['query'][_0x0430('0x50')]);_0x1eed1a[_0x0430('0x51')]=qs[_0x0430('0x49')](_['pick'](_0x418255[_0x0430('0x47')],_0x29854f[_0x0430('0x49')]),_0x50cdcd);if(_0x418255[_0x0430('0x47')]['filter']){_0x1eed1a['where']=_[_0x0430('0x52')](_0x1eed1a[_0x0430('0x51')],{'$or':_[_0x0430('0x40')](_0x50cdcd,function(_0x3c79a2){if(_0x3c79a2['type']!=='VIRTUAL'){var _0x5b107e={};_0x5b107e[_0x3c79a2[_0x0430('0x3b')]]={'$like':'%'+_0x418255[_0x0430('0x47')][_0x0430('0x53')]+'%'};return _0x5b107e;}})});}_0x1eed1a=_[_0x0430('0x52')]({},_0x1eed1a,_0x418255[_0x0430('0x54')]);var _0x421280={'where':_0x1eed1a['where']};return db['OpenchannelAccount'][_0x0430('0x2f')](_0x421280)[_0x0430('0x21')](function(_0x4761b0){_0x5d1a80[_0x0430('0x2f')]=_0x4761b0;if(_0x418255[_0x0430('0x47')][_0x0430('0x55')]){_0x1eed1a[_0x0430('0x56')]=[{'all':!![]}];}return db[_0x0430('0x41')][_0x0430('0x57')](_0x1eed1a);})[_0x0430('0x21')](function(_0x4387db){_0x5d1a80[_0x0430('0x58')]=_0x4387db;return _0x5d1a80;})['then'](respondWithFilteredResult(_0x314b27,_0x1eed1a))['catch'](handleError(_0x314b27,null));};exports[_0x0430('0x59')]=function(_0x37d77b,_0x25dbb4){var _0x1c769a={'raw':![],'where':{'id':_0x37d77b[_0x0430('0x5a')]['id']},'include':[{'model':db[_0x0430('0x3e')],'as':_0x0430('0x3f')}]},_0xdff52b={};_0xdff52b[_0x0430('0x46')]=_[_0x0430('0x48')](db[_0x0430('0x41')][_0x0430('0x42')]);_0xdff52b[_0x0430('0x47')]=_[_0x0430('0x48')](_0x37d77b[_0x0430('0x47')]);_0xdff52b[_0x0430('0x49')]=_[_0x0430('0x4b')](_0xdff52b[_0x0430('0x46')],_0xdff52b['query']);_0x1c769a[_0x0430('0x4a')]=_[_0x0430('0x4b')](_0xdff52b[_0x0430('0x46')],qs[_0x0430('0x4c')](_0x37d77b[_0x0430('0x47')][_0x0430('0x4c')]));_0x1c769a[_0x0430('0x4a')]=_0x1c769a[_0x0430('0x4a')][_0x0430('0x4d')]?_0x1c769a['attributes']:_0xdff52b[_0x0430('0x46')];if(_0x37d77b[_0x0430('0x47')][_0x0430('0x55')]){_0x1c769a['include']=[{'all':!![]}];}_0x1c769a=_[_0x0430('0x52')]({},_0x1c769a,_0x37d77b['options']);return db[_0x0430('0x41')][_0x0430('0x5b')](_0x1c769a)[_0x0430('0x21')](handleEntityNotFound(_0x25dbb4,null))[_0x0430('0x21')](respondWithResult(_0x25dbb4,null))[_0x0430('0x2a')](handleError(_0x25dbb4,null));};exports[_0x0430('0x5c')]=function(_0x4d40c4,_0x1b0f0b){return db[_0x0430('0x41')][_0x0430('0x5c')](_0x4d40c4[_0x0430('0x5d')],{})[_0x0430('0x21')](function(_0x41b49c){var _0x110d1c=_0x4d40c4[_0x0430('0x5e')][_0x0430('0x36')]({'plain':!![]});if(!_0x110d1c)throw new Error(_0x0430('0x5f'));if(_0x110d1c[_0x0430('0x60')]===_0x0430('0x5e')){var _0x4f5a5e=_0x41b49c[_0x0430('0x36')]({'plain':!![]});var _0x2102b0=_0x0430('0x61');return db[_0x0430('0x62')][_0x0430('0x5b')]({'where':{'name':_0x2102b0,'userProfileId':_0x110d1c[_0x0430('0x63')]},'raw':!![]})[_0x0430('0x21')](function(_0x33c896){if(_0x33c896&&_0x33c896[_0x0430('0x64')]===0x0){return db['UserProfileResource'][_0x0430('0x5c')]({'name':_0x4f5a5e[_0x0430('0x3b')],'resourceId':_0x4f5a5e['id'],'type':_0x33c896[_0x0430('0x3b')],'sectionId':_0x33c896['id']},{})[_0x0430('0x21')](function(){return _0x41b49c;});}else{return _0x41b49c;}})[_0x0430('0x2a')](function(_0x693d30){logger[_0x0430('0x27')](_0x0430('0x65'),_0x693d30);throw _0x693d30;});}return _0x41b49c;})[_0x0430('0x21')](respondWithResult(_0x1b0f0b,0xc9))[_0x0430('0x2a')](handleError(_0x1b0f0b,null));};exports[_0x0430('0x35')]=function(_0xfd43d9,_0x168ea6){if(_0xfd43d9[_0x0430('0x5d')]['id']){delete _0xfd43d9['body']['id'];}return db[_0x0430('0x41')][_0x0430('0x5b')]({'where':{'id':_0xfd43d9[_0x0430('0x5a')]['id']},'include':[{'model':db[_0x0430('0x3e')],'as':_0x0430('0x3f')}]})['then'](handleEntityNotFound(_0x168ea6,null))['then'](saveUpdates(_0xfd43d9[_0x0430('0x5d')],null))[_0x0430('0x21')](respondWithResult(_0x168ea6,null))[_0x0430('0x2a')](handleError(_0x168ea6,null));};exports[_0x0430('0x38')]=function(_0x415304,_0x49eef5){return db[_0x0430('0x41')][_0x0430('0x5b')]({'where':{'id':_0x415304['params']['id']}})[_0x0430('0x21')](handleEntityNotFound(_0x49eef5,null))[_0x0430('0x21')](removeEntity(_0x49eef5,null))[_0x0430('0x2a')](handleError(_0x49eef5,null));};exports['describe']=function(_0x40d2a1,_0x106e55){return db[_0x0430('0x41')][_0x0430('0x66')]()[_0x0430('0x21')](respondWithResult(_0x106e55,null))[_0x0430('0x2a')](handleError(_0x106e55,null));};exports[_0x0430('0x67')]=function(_0x10d3d3,_0x1b1a89,_0x147440){if(_0x10d3d3[_0x0430('0x5d')]['id']){delete _0x10d3d3['body']['id'];}return db[_0x0430('0x41')][_0x0430('0x5b')]({'where':{'id':_0x10d3d3[_0x0430('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1b1a89,null))[_0x0430('0x21')](function(_0x475e84){if(_0x475e84){_0x10d3d3[_0x0430('0x5d')][_0x0430('0x68')]=_0x475e84['id'];return db[_0x0430('0x69')][_0x0430('0x5c')](_0x10d3d3[_0x0430('0x5d')]);}})[_0x0430('0x21')](respondWithResult(_0x1b1a89,null))[_0x0430('0x2a')](handleError(_0x1b1a89,null));};exports[_0x0430('0x6a')]=function(_0x1b850f,_0xeade32,_0x2f8c11){var _0x53ec5f={'raw':![],'where':{}};var _0x3e72a7={};var _0x1fa22d={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1b850f[_0x0430('0x5a')]['id']}})[_0x0430('0x21')](handleEntityNotFound(_0xeade32,null))[_0x0430('0x21')](function(_0x526673){if(_0x526673){_0x3e72a7[_0x0430('0x46')]=_['keys'](db[_0x0430('0x69')][_0x0430('0x42')]);_0x3e72a7[_0x0430('0x47')]=_[_0x0430('0x48')](_0x1b850f['query']);_0x3e72a7[_0x0430('0x49')]=_['intersection'](_0x3e72a7[_0x0430('0x46')],_0x3e72a7[_0x0430('0x47')]);_0x53ec5f[_0x0430('0x4a')]=_[_0x0430('0x4b')](_0x3e72a7[_0x0430('0x46')],qs[_0x0430('0x4c')](_0x1b850f[_0x0430('0x47')]['fields']));_0x53ec5f['attributes']=_0x53ec5f[_0x0430('0x4a')][_0x0430('0x4d')]?_0x53ec5f[_0x0430('0x4a')]:_0x3e72a7[_0x0430('0x46')];if(!_0x1b850f['query'][_0x0430('0x6b')](_0x0430('0x4e'))){_0x53ec5f[_0x0430('0x30')]=qs['limit'](_0x1b850f[_0x0430('0x47')][_0x0430('0x30')]);_0x53ec5f['offset']=qs['offset'](_0x1b850f['query'][_0x0430('0x2e')]);}_0x53ec5f[_0x0430('0x4f')]=qs[_0x0430('0x50')](_0x1b850f[_0x0430('0x47')][_0x0430('0x50')]);_0x53ec5f[_0x0430('0x51')]=qs[_0x0430('0x49')](_[_0x0430('0x6c')](_0x1b850f[_0x0430('0x47')],_0x3e72a7['filters']));_0x53ec5f['where'][_0x0430('0x68')]=_0x526673['id'];if(_0x1b850f[_0x0430('0x47')][_0x0430('0x53')]){_0x53ec5f[_0x0430('0x51')]=_['merge'](_0x53ec5f[_0x0430('0x51')],{'$or':_[_0x0430('0x40')](_0x53ec5f[_0x0430('0x4a')],function(_0x528ef3){var _0x51b52b={};_0x51b52b[_0x528ef3]={'$like':'%'+_0x1b850f[_0x0430('0x47')][_0x0430('0x53')]+'%'};return _0x51b52b;})});}_0x53ec5f=_[_0x0430('0x52')]({},_0x53ec5f,_0x1b850f[_0x0430('0x54')]);return db[_0x0430('0x69')][_0x0430('0x2f')]({'where':_0x53ec5f['where']})[_0x0430('0x21')](function(_0xd86bbd){_0x1fa22d[_0x0430('0x2f')]=_0xd86bbd;if(_0x1b850f[_0x0430('0x47')][_0x0430('0x55')]){_0x53ec5f['include']=[{'all':!![]}];}return db['Disposition'][_0x0430('0x57')](_0x53ec5f);})[_0x0430('0x21')](function(_0x5b9971){_0x1fa22d[_0x0430('0x58')]=_0x5b9971;return _0x1fa22d;});}})['then'](respondWithFilteredResult(_0xeade32,_0x53ec5f))[_0x0430('0x2a')](handleError(_0xeade32,null));};exports[_0x0430('0x6d')]=function(_0x1b7369,_0xcb5448,_0x19da9c){return db['OpenchannelAccount']['find']({'where':{'id':_0x1b7369[_0x0430('0x5a')]['id']}})['then'](handleEntityNotFound(_0xcb5448,null))[_0x0430('0x21')](function(_0x177987){if(_0x177987){return _0x177987[_0x0430('0x6d')](_0x1b7369[_0x0430('0x47')][_0x0430('0x6e')]);}})[_0x0430('0x21')](respondWithStatusCode(_0xcb5448,null))[_0x0430('0x2a')](handleError(_0xcb5448,null));};exports[_0x0430('0x6f')]=function(_0x4f91cc,_0x162766,_0x1bb341){if(_0x4f91cc['body']['id']){delete _0x4f91cc[_0x0430('0x5d')]['id'];}return db[_0x0430('0x41')][_0x0430('0x5b')]({'where':{'id':_0x4f91cc[_0x0430('0x5a')]['id']}})[_0x0430('0x21')](handleEntityNotFound(_0x162766,null))[_0x0430('0x21')](function(_0x43cb2a){if(_0x43cb2a){_0x4f91cc[_0x0430('0x5d')][_0x0430('0x68')]=_0x43cb2a['id'];return db['CannedAnswer'][_0x0430('0x5c')](_0x4f91cc[_0x0430('0x5d')]);}})[_0x0430('0x21')](respondWithResult(_0x162766,null))[_0x0430('0x2a')](handleError(_0x162766,null));};exports[_0x0430('0x70')]=function(_0xd974ef,_0x4c7b9e,_0x1afabe){var _0x5655bb={'raw':![],'where':{}};var _0x321606={};var _0x164369={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xd974ef['params']['id']}})[_0x0430('0x21')](handleEntityNotFound(_0x4c7b9e,null))[_0x0430('0x21')](function(_0x5b7009){if(_0x5b7009){_0x321606[_0x0430('0x46')]=_[_0x0430('0x48')](db[_0x0430('0x71')][_0x0430('0x42')]);_0x321606[_0x0430('0x47')]=_['keys'](_0xd974ef[_0x0430('0x47')]);_0x321606['filters']=_[_0x0430('0x4b')](_0x321606[_0x0430('0x46')],_0x321606['query']);_0x5655bb['attributes']=_[_0x0430('0x4b')](_0x321606[_0x0430('0x46')],qs[_0x0430('0x4c')](_0xd974ef[_0x0430('0x47')][_0x0430('0x4c')]));_0x5655bb[_0x0430('0x4a')]=_0x5655bb[_0x0430('0x4a')][_0x0430('0x4d')]?_0x5655bb['attributes']:_0x321606[_0x0430('0x46')];if(!_0xd974ef[_0x0430('0x47')][_0x0430('0x6b')]('nolimit')){_0x5655bb[_0x0430('0x30')]=qs[_0x0430('0x30')](_0xd974ef[_0x0430('0x47')][_0x0430('0x30')]);_0x5655bb[_0x0430('0x2e')]=qs[_0x0430('0x2e')](_0xd974ef[_0x0430('0x47')][_0x0430('0x2e')]);}_0x5655bb[_0x0430('0x4f')]=qs[_0x0430('0x50')](_0xd974ef[_0x0430('0x47')][_0x0430('0x50')]);_0x5655bb[_0x0430('0x51')]=qs['filters'](_[_0x0430('0x6c')](_0xd974ef[_0x0430('0x47')],_0x321606[_0x0430('0x49')]));_0x5655bb['where']['OpenchannelAccountId']=_0x5b7009['id'];if(_0xd974ef[_0x0430('0x47')][_0x0430('0x53')]){_0x5655bb['where']=_['merge'](_0x5655bb[_0x0430('0x51')],{'$or':_[_0x0430('0x40')](_0x5655bb[_0x0430('0x4a')],function(_0x42d6b1){var _0x24338b={};_0x24338b[_0x42d6b1]={'$like':'%'+_0xd974ef['query'][_0x0430('0x53')]+'%'};return _0x24338b;})});}_0x5655bb=_[_0x0430('0x52')]({},_0x5655bb,_0xd974ef[_0x0430('0x54')]);return db[_0x0430('0x71')][_0x0430('0x2f')]({'where':_0x5655bb[_0x0430('0x51')]})[_0x0430('0x21')](function(_0xbfedbf){_0x164369[_0x0430('0x2f')]=_0xbfedbf;if(_0xd974ef[_0x0430('0x47')][_0x0430('0x55')]){_0x5655bb[_0x0430('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0430('0x57')](_0x5655bb);})[_0x0430('0x21')](function(_0x3353f5){_0x164369[_0x0430('0x58')]=_0x3353f5;return _0x164369;});}})['then'](respondWithFilteredResult(_0x4c7b9e,_0x5655bb))[_0x0430('0x2a')](handleError(_0x4c7b9e,null));};exports[_0x0430('0x72')]=function(_0x1130dc,_0x5be3e2,_0x34cdba){return db[_0x0430('0x41')]['find']({'where':{'id':_0x1130dc[_0x0430('0x5a')]['id']}})[_0x0430('0x21')](handleEntityNotFound(_0x5be3e2,null))['then'](function(_0x31a344){if(_0x31a344){return _0x31a344[_0x0430('0x72')](_0x1130dc[_0x0430('0x47')][_0x0430('0x6e')]);}})[_0x0430('0x21')](respondWithStatusCode(_0x5be3e2,null))[_0x0430('0x2a')](handleError(_0x5be3e2,null));};exports['notify']=function(_0x566259,_0x4f4654,_0x398179){var _0x4b5960={'body':_0x566259['body'],'channel':'openchannel'};var _0x47378f=[];var _0x11881f=[];var _0x17ba00={};var _0x5635e1=![];return db[_0x0430('0x73')]['describe']()[_0x0430('0x21')](function(_0x4af092){if(!_0x4af092){throw new db[(_0x0430('0x74'))]['ValidationError'](_0x0430('0x75'));}_0x47378f=_[_0x0430('0x76')](_['keys'](_0x4af092),[_0x0430('0x77'),_0x0430('0x78')]);_0x11881f=_['difference'](_[_0x0430('0x48')](_0x4af092),['createdAt',_0x0430('0x78'),_0x0430('0x79'),_0x0430('0x7a')]);if(_0x566259[_0x0430('0x5d')]['id']){delete _0x566259[_0x0430('0x5d')]['id'];}if(_[_0x0430('0x7b')](_0x566259['body']['from'])){throw new db[(_0x0430('0x74'))][(_0x0430('0x7c'))](_0x0430('0x7d'));}if(_[_0x0430('0x7b')](_0x566259[_0x0430('0x5d')][_0x0430('0x5d')])||_0x566259[_0x0430('0x5d')]['body']===''){throw new db[(_0x0430('0x74'))]['ValidationError'](_0x0430('0x7e'));}if(_[_0x0430('0x7b')](_0x566259[_0x0430('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x0430('0x7c'))](_0x0430('0x7f')+_0x11881f);}if(!_[_0x0430('0x80')](_0x11881f,_0x566259[_0x0430('0x5d')][_0x0430('0x81')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11881f);}_0x17ba00[_0x566259[_0x0430('0x5d')][_0x0430('0x81')]]=_0x566259[_0x0430('0x5d')][_0x0430('0x82')];})[_0x0430('0x21')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x566259[_0x0430('0x5a')]['id']},'include':[{'model':db[_0x0430('0x83')],'as':_0x0430('0x84'),'include':[{'model':db['CmContact'],'as':_0x0430('0x85'),'where':_0x17ba00,'limit':0x1,'order':[[_0x0430('0x78'),'DESC']]}]},{'model':db[_0x0430('0x86')],'as':_0x0430('0x87')}]});})['then'](handleEntityNotFound(_0x4f4654,null))[_0x0430('0x21')](function(_0x23e34a){if(_0x23e34a&&_0x23e34a[_0x0430('0x84')]){_0x4b5960['account']=_0x23e34a;_0x4b5960[_0x0430('0x88')]=_0x23e34a[_0x0430('0x87')];_0x4b5960[_0x0430('0x89')]=_0x23e34a[_0x0430('0x84')];_0x4b5960[_0x0430('0x88')]=_['orderBy'](_0x4b5960[_0x0430('0x88')],[_0x0430('0x8a')],['asc']);if(_0x4b5960[_0x0430('0x8b')][_0x0430('0x87')]){delete _0x4b5960[_0x0430('0x8b')][_0x0430('0x87')];}if(_0x4b5960['account']['List']&&_0x4b5960[_0x0430('0x8b')][_0x0430('0x84')][_0x0430('0x85')][_0x0430('0x4d')]){return _0x4b5960['account'][_0x0430('0x84')][_0x0430('0x85')][0x0];}var _0x25f5ef=_[_0x0430('0x8c')](_0x566259[_0x0430('0x5d')],{'firstName':_0x566259[_0x0430('0x5d')][_0x0430('0x82')],'ListId':_0x23e34a[_0x0430('0x7a')]});_0x25f5ef[_0x566259[_0x0430('0x5d')][_0x0430('0x81')]]=_0x566259['body'][_0x0430('0x82')];return db[_0x0430('0x73')][_0x0430('0x5c')](_0x25f5ef,{'fields':_0x47378f,'raw':!![]});}})[_0x0430('0x21')](handleEntityNotFound(_0x4f4654,null))[_0x0430('0x21')](function(_0xe1bbeb){_0x4b5960[_0x0430('0x8d')]=_0xe1bbeb;if(_0xe1bbeb){var _0x5213f7={'ContactId':_0xe1bbeb['id'],'OpenchannelAccountId':_0x566259[_0x0430('0x5a')]['id'],'from':(_0xe1bbeb[_0x0430('0x8e')]||'')+'\x20'+(_0xe1bbeb[_0x0430('0x8f')]||'')};var _0x4da76b={'OpenchannelAccountId':_0x566259['params']['id'],'closed':![]};if(_0x566259[_0x0430('0x5d')][_0x0430('0x90')]){_0x4da76b['threadId']=_0x566259[_0x0430('0x5d')][_0x0430('0x90')];return db[_0x0430('0x91')][_0x0430('0x5b')]({'where':_0x4da76b})[_0x0430('0x21')](function(_0x3f75db){if(_0x3f75db){return[_0x3f75db,![]];}_0x5213f7[_0x0430('0x90')]=_0x566259[_0x0430('0x5d')]['threadId'];_0x5213f7[_0x0430('0x92')]=_0x566259[_0x0430('0x5d')][_0x0430('0x92')];return db[_0x0430('0x91')]['create'](_0x5213f7)[_0x0430('0x21')](function(_0x6f0fea){return[_0x6f0fea,!![]];});});}else{_0x4da76b[_0x0430('0x90')]=null;}_0x4da76b[_0x0430('0x93')]=_0xe1bbeb['id'];return db[_0x0430('0x91')][_0x0430('0x5b')]({'where':_0x4da76b})[_0x0430('0x21')](function(_0x37eb03){if(_0x37eb03){return[_0x37eb03,![]];}return db[_0x0430('0x91')][_0x0430('0x5c')](_0x5213f7)[_0x0430('0x21')](function(_0xd1d1c9){return[_0xd1d1c9,!![]];});});}})['spread'](function(_0x11163d,_0xca1b3e){if(_0x11163d){_0x5635e1=_0xca1b3e;if(!_0xca1b3e){var _0x15b94a={'from':(_0x4b5960[_0x0430('0x8d')][_0x0430('0x8e')]||'')+'\x20'+(_0x4b5960[_0x0430('0x8d')]['lastName']||'')};if(_0x566259['body'][_0x0430('0x90')]&&_0x566259[_0x0430('0x5d')]['messageId']&&_0x566259[_0x0430('0x5d')][_0x0430('0x90')]!=_0x566259['body']['messageId']){_0x15b94a[_0x0430('0x90')]=_0x566259[_0x0430('0x5d')]['messageId'];}return _0x11163d['update'](_0x15b94a);}else{return _0x11163d;}}})[_0x0430('0x21')](function(_0x13939a){_0x4b5960['interaction']=_0x13939a[_0x0430('0x36')]({'plain':!![]});_0x4b5960[_0x0430('0x94')][_0x0430('0x95')]=_0x5635e1;if(_0x4b5960[_0x0430('0x94')][_0x0430('0x95')]){if(_0x4b5960[_0x0430('0x8b')][_0x0430('0x96')]){_0x4b5960[_0x0430('0x88')]['push']({'id':0x0,'priority':_0x4b5960[_0x0430('0x88')]['length']+0x1,'app':'close','appdata':_0x0430('0x97'),'interval':_0x0430('0x98')});}}return db[_0x0430('0x99')][_0x0430('0x5c')]({'body':_0x566259[_0x0430('0x5d')][_0x0430('0x5d')],'OpenchannelAccountId':_0x566259[_0x0430('0x5a')]['id'],'OpenchannelInteractionId':_0x13939a['id'],'direction':'in','ContactId':_0x4b5960[_0x0430('0x8d')]['id'],'AttachmentId':_0x566259['body'][_0x0430('0x9a')]});})[_0x0430('0x21')](function(_0x109174){_0x4b5960[_0x0430('0x28')]=_0x109174;if(!_0x4b5960['interaction'][_0x0430('0x9b')])return;return db[_0x0430('0x9c')][_0x0430('0x5b')]({'attributes':['id','name'],'where':{'id':_0x4b5960[_0x0430('0x94')]['UserId']}});})[_0x0430('0x21')](function(_0xe9187c){if(_0xe9187c){_0x4b5960[_0x0430('0x88')][_0x0430('0x9d')]({'id':0x0,'priority':0x0,'app':_0x0430('0x9e'),'appdata':_0xe9187c[_0x0430('0x3b')]+','+(_0x4b5960['account'][_0x0430('0x9f')]||0xa),'interval':'*,*,*,*'});}if(!_0x4b5960[_0x0430('0x94')][_0x0430('0xa0')])return;return db[_0x0430('0xa1')][_0x0430('0x5b')]({'attributes':['id','name'],'where':{'id':_0x4b5960[_0x0430('0x94')][_0x0430('0xa0')]}});})[_0x0430('0x21')](function(_0x3a80f1){if(_0x3a80f1){_0x4b5960['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x0430('0xa2'),'appdata':_0x3a80f1[_0x0430('0x3b')]+','+(_0x4b5960[_0x0430('0x8b')][_0x0430('0xa3')]||0x12c),'interval':_0x0430('0x98')});}return respondWithRpcPromise(_0x0430('0xa4'),'startRouting',_0x4b5960);})[_0x0430('0x21')](function(_0x178884){respondWithRpcPromise(_0x0430('0xa5'),_0x0430('0xa5'),{'event':_0x0430('0xa6'),'message':_0x178884},client9002);return _0x178884;})[_0x0430('0x21')](respondWithResult(_0x4f4654,null))[_0x0430('0x2a')](handleError(_0x4f4654,null));};exports[_0x0430('0xa7')]=function(_0x3358e7,_0x2ef21e){var _0x3c5ef2=_0x3358e7[_0x0430('0x5a')]['id'];var _0xac196b=_0x3358e7[_0x0430('0x5d')];var _0x2fa934=0xc8;var _0xa01902=null;return db['sequelize'][_0x0430('0xa8')]({'isolationLevel':db[_0x0430('0xa9')][_0x0430('0xaa')][_0x0430('0xab')]['READ_COMMITTED']},function(_0x2f6488){return db[_0x0430('0x41')][_0x0430('0xac')]({'where':{'id':_0x3c5ef2},'transaction':_0x2f6488})[_0x0430('0x21')](function(_0x23f9ff){if(_0x23f9ff){return db[_0x0430('0x86')]['destroy']({'where':{'OpenchannelAccountId':_0x3c5ef2},'transaction':_0x2f6488})[_0x0430('0x21')](function(){var _0x48cb44=_['map'](_0xac196b,function(_0x147926){_0x147926['OpenchannelAccountId']=_0x3c5ef2;return _0x147926;});return db['OpenchannelApplication'][_0x0430('0xad')](_0x48cb44,{'transaction':_0x2f6488});});}else{_0x2fa934=0x194;_0xa01902=[];}});})['then'](function(){if(_0x2fa934!==0x194){return db[_0x0430('0x86')][_0x0430('0xae')]({'where':{'OpenchannelAccountId':_0x3c5ef2},'order':_0x0430('0x8a')})[_0x0430('0x21')](function(_0x3103c9){_0xa01902=_0x3103c9;});}})['catch'](function(_0x46b130){_0x2fa934=0x1f4;logger['error'](_0x46b130[_0x0430('0x3a')]);if(_0x46b130[_0x0430('0x3b')]){delete _0x46b130[_0x0430('0x3b')];}_0xa01902=_0x46b130;})[_0x0430('0xaf')](function(){if(_0xa01902===null){_0x2ef21e[_0x0430('0x39')](_0x2fa934);}else{if(_0x2fa934===0x1f4){_0x2ef21e[_0x0430('0x2b')](_0x2fa934)[_0x0430('0x3c')](_0xa01902);}else{_0x2ef21e['status'](_0x2fa934)[_0x0430('0x2d')](_0xa01902);}}});};exports[_0x0430('0xb0')]=function(_0x5dd404,_0x37e0fa,_0x227b84){var _0x4d0bcd={};var _0x369cc5={};var _0x4a113f;var _0x488ca7;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5dd404[_0x0430('0x5a')]['id']}})[_0x0430('0x21')](handleEntityNotFound(_0x37e0fa,null))['then'](function(_0x51db2d){if(_0x51db2d){_0x4a113f=_0x51db2d;_0x369cc5[_0x0430('0x46')]=_[_0x0430('0x48')](db[_0x0430('0x86')][_0x0430('0x42')]);_0x369cc5[_0x0430('0x47')]=_[_0x0430('0x48')](_0x5dd404[_0x0430('0x47')]);_0x369cc5['filters']=_[_0x0430('0x4b')](_0x369cc5['model'],_0x369cc5[_0x0430('0x47')]);_0x4d0bcd[_0x0430('0x4a')]=_[_0x0430('0x4b')](_0x369cc5['model'],qs[_0x0430('0x4c')](_0x5dd404[_0x0430('0x47')]['fields']));_0x4d0bcd[_0x0430('0x4a')]=_0x4d0bcd[_0x0430('0x4a')]['length']?_0x4d0bcd[_0x0430('0x4a')]:_0x369cc5[_0x0430('0x46')];_0x4d0bcd[_0x0430('0x4f')]=qs[_0x0430('0x50')](_0x5dd404[_0x0430('0x47')][_0x0430('0x50')]);_0x4d0bcd[_0x0430('0x51')]=qs[_0x0430('0x49')](_['pick'](_0x5dd404[_0x0430('0x47')],_0x369cc5[_0x0430('0x49')]));if(_0x5dd404[_0x0430('0x47')]['filter']){_0x4d0bcd['where']=_[_0x0430('0x52')](_0x4d0bcd[_0x0430('0x51')],{'$or':_[_0x0430('0x40')](_0x4d0bcd[_0x0430('0x4a')],function(_0x3b11ce){var _0x2a4840={};_0x2a4840[_0x3b11ce]={'$like':'%'+_0x5dd404['query'][_0x0430('0x53')]+'%'};return _0x2a4840;})});}_0x4d0bcd=_['merge']({},_0x4d0bcd,_0x5dd404['options']);return _0x4a113f[_0x0430('0xb0')](_0x4d0bcd);}})[_0x0430('0x21')](function(_0x2ef4f6){if(_0x2ef4f6){_0x488ca7=_0x2ef4f6['length'];if(!_0x5dd404['query'][_0x0430('0x6b')](_0x0430('0x4e'))){_0x4d0bcd[_0x0430('0x30')]=qs['limit'](_0x5dd404[_0x0430('0x47')][_0x0430('0x30')]);_0x4d0bcd[_0x0430('0x2e')]=qs[_0x0430('0x2e')](_0x5dd404[_0x0430('0x47')]['offset']);}return _0x4a113f[_0x0430('0xb0')](_0x4d0bcd);}})[_0x0430('0x21')](function(_0x68f689){if(_0x68f689){return _0x68f689?{'count':_0x488ca7,'rows':_0x68f689}:null;}})[_0x0430('0x21')](respondWithResult(_0x37e0fa,null))[_0x0430('0x2a')](handleError(_0x37e0fa,null));};exports[_0x0430('0xb1')]=function(_0x24fafa,_0x42e960,_0x513b9c){var _0x58121b={'raw':![],'where':{}};var _0x121e21={};var _0x5b24e2={'count':0x0,'rows':[]};return db[_0x0430('0x41')][_0x0430('0xac')]({'where':{'id':_0x24fafa['params']['id']}})[_0x0430('0x21')](handleEntityNotFound(_0x42e960,null))[_0x0430('0x21')](function(_0x207de7){if(_0x207de7){_0x121e21[_0x0430('0x46')]=_[_0x0430('0x48')](db[_0x0430('0x91')]['rawAttributes']);_0x121e21[_0x0430('0x47')]=_[_0x0430('0x48')](_0x24fafa['query']);_0x121e21['filters']=_['intersection'](_0x121e21[_0x0430('0x46')],_0x121e21['query']);_0x58121b['attributes']=_['intersection'](_0x121e21[_0x0430('0x46')],qs[_0x0430('0x4c')](_0x24fafa[_0x0430('0x47')]['fields']));_0x58121b['attributes']=_0x58121b[_0x0430('0x4a')][_0x0430('0x4d')]?_0x58121b[_0x0430('0x4a')]:_0x121e21[_0x0430('0x46')];if(!_0x24fafa[_0x0430('0x47')][_0x0430('0x6b')](_0x0430('0x4e'))){_0x58121b['limit']=qs[_0x0430('0x30')](_0x24fafa[_0x0430('0x47')]['limit']);_0x58121b[_0x0430('0x2e')]=qs[_0x0430('0x2e')](_0x24fafa[_0x0430('0x47')][_0x0430('0x2e')]);}_0x58121b['order']=qs[_0x0430('0x50')](_0x24fafa[_0x0430('0x47')][_0x0430('0x50')]);_0x58121b[_0x0430('0x51')]=qs[_0x0430('0x49')](_['pick'](_0x24fafa[_0x0430('0x47')],_0x121e21['filters']));_0x58121b[_0x0430('0x51')][_0x0430('0x68')]=_0x207de7['id'];if(_0x24fafa['query'][_0x0430('0x53')]){_0x58121b[_0x0430('0x51')]=_['merge'](_0x58121b[_0x0430('0x51')],{'$or':_['map'](_0x58121b[_0x0430('0x4a')],function(_0x413ba1){var _0x325474={};_0x325474[_0x413ba1]={'$like':'%'+_0x24fafa[_0x0430('0x47')][_0x0430('0x53')]+'%'};return _0x325474;})});}_0x58121b=_[_0x0430('0x52')]({},_0x58121b,_0x24fafa[_0x0430('0x54')]);return db['OpenchannelInteraction'][_0x0430('0x2f')]({'where':_0x58121b[_0x0430('0x51')]})['then'](function(_0x3a8a4c){_0x5b24e2[_0x0430('0x2f')]=_0x3a8a4c;if(_0x24fafa['query']['includeAll']){_0x58121b[_0x0430('0x56')]=[{'model':db[_0x0430('0x73')],'as':_0x0430('0xb2'),'required':![]},{'model':db[_0x0430('0x9c')],'as':_0x0430('0xb3'),'attributes':[_0x0430('0x3b'),_0x0430('0xb4'),_0x0430('0xb5')],'required':![]},{'model':db['Tag'],'as':_0x0430('0xb6'),'attributes':['id',_0x0430('0x3b'),'color'],'where':_0x24fafa[_0x0430('0x47')]['tag']?{'id':_0x24fafa[_0x0430('0x47')][_0x0430('0xb7')]}:undefined,'required':_0x24fafa[_0x0430('0x47')]['tag']?!![]:![]}];}return db[_0x0430('0x91')][_0x0430('0x57')](_0x58121b);})[_0x0430('0x21')](function(_0x6542fc){_0x5b24e2[_0x0430('0x58')]=_0x6542fc;return _0x5b24e2;});}})[_0x0430('0x21')](respondWithFilteredResult(_0x42e960,_0x58121b))[_0x0430('0x2a')](handleError(_0x42e960,null));};exports['addAgents']=function(_0x409884,_0x1ff496,_0x3e57a3){return db[_0x0430('0x41')][_0x0430('0x5b')]({'where':{'id':_0x409884['params']['id']}})['then'](handleEntityNotFound(_0x1ff496,null))[_0x0430('0x21')](function(_0x458504){if(_0x458504){return _0x458504['addAgents'](_0x409884[_0x0430('0x5d')][_0x0430('0x6e')],_[_0x0430('0xb8')](_0x409884[_0x0430('0x5d')],[_0x0430('0x6e'),'id'])||{})[_0x0430('0xb9')](function(_0x36301a){for(var _0x3863bd=0x0;_0x3863bd<_0x409884[_0x0430('0x5d')][_0x0430('0x6e')][_0x0430('0x4d')];_0x3863bd+=0x1){socket['emit'](_0x0430('0xba'),{'UserId':Number(_0x409884[_0x0430('0x5d')]['ids'][_0x3863bd]),'OpenchannelAccountId':Number(_0x409884['params']['id'])});}return _0x36301a;});}})[_0x0430('0x21')](respondWithResult(_0x1ff496,null))[_0x0430('0x2a')](handleError(_0x1ff496,null));};exports[_0x0430('0xbb')]=function(_0x5ce9e9,_0x400eee,_0x30932d){return db['OpenchannelAccount'][_0x0430('0x5b')]({'where':{'id':_0x5ce9e9[_0x0430('0x5a')]['id']}})[_0x0430('0x21')](handleEntityNotFound(_0x400eee,null))[_0x0430('0x21')](function(_0x3c2009){if(_0x3c2009){return _0x3c2009[_0x0430('0xbb')](_0x5ce9e9[_0x0430('0x47')][_0x0430('0x6e')])[_0x0430('0x21')](function(){if(_[_0x0430('0xbc')](_0x5ce9e9['query'][_0x0430('0x6e')])){for(var _0x5ffe4c=0x0;_0x5ffe4c<_0x5ce9e9[_0x0430('0x47')]['ids'][_0x0430('0x4d')];_0x5ffe4c+=0x1){socket['emit'](_0x0430('0xbd'),{'UserId':Number(_0x5ce9e9['query'][_0x0430('0x6e')][_0x5ffe4c]),'OpenchannelAccountId':Number(_0x5ce9e9['params']['id'])});}}else{socket[_0x0430('0xbe')](_0x0430('0xbd'),{'UserId':Number(_0x5ce9e9['query'][_0x0430('0x6e')]),'OpenchannelAccountId':Number(_0x5ce9e9[_0x0430('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x400eee,null))[_0x0430('0x2a')](handleError(_0x400eee,null));};exports[_0x0430('0xbf')]=function(_0x1f4d9f,_0x1beb8f,_0x45c600){var _0x133aa6={};var _0x3d52d3={};var _0x5c1fb3;var _0x3136e5;return db['OpenchannelAccount'][_0x0430('0xac')]({'where':{'id':_0x1f4d9f[_0x0430('0x5a')]['id']}})[_0x0430('0x21')](handleEntityNotFound(_0x1beb8f,null))[_0x0430('0x21')](function(_0x374635){if(_0x374635){_0x5c1fb3=_0x374635;_0x3d52d3['model']=_[_0x0430('0x48')](db['User'][_0x0430('0x42')]);_0x3d52d3[_0x0430('0x47')]=_[_0x0430('0x48')](_0x1f4d9f[_0x0430('0x47')]);_0x3d52d3[_0x0430('0x49')]=_[_0x0430('0x4b')](_0x3d52d3[_0x0430('0x46')],_0x3d52d3[_0x0430('0x47')]);_0x133aa6['attributes']=_[_0x0430('0x4b')](_0x3d52d3[_0x0430('0x46')],qs[_0x0430('0x4c')](_0x1f4d9f[_0x0430('0x47')][_0x0430('0x4c')]));_0x133aa6['attributes']=_0x133aa6[_0x0430('0x4a')][_0x0430('0x4d')]?_0x133aa6[_0x0430('0x4a')]:_0x3d52d3[_0x0430('0x46')];_0x133aa6[_0x0430('0x4f')]=qs[_0x0430('0x50')](_0x1f4d9f['query']['sort']);_0x133aa6[_0x0430('0x51')]=qs[_0x0430('0x49')](_[_0x0430('0x6c')](_0x1f4d9f[_0x0430('0x47')],_0x3d52d3[_0x0430('0x49')]));if(_0x1f4d9f[_0x0430('0x47')]['filter']){_0x133aa6[_0x0430('0x51')]=_[_0x0430('0x52')](_0x133aa6[_0x0430('0x51')],{'$or':_[_0x0430('0x40')](_0x133aa6[_0x0430('0x4a')],function(_0x8e3603){var _0x753fda={};_0x753fda[_0x8e3603]={'$like':'%'+_0x1f4d9f[_0x0430('0x47')][_0x0430('0x53')]+'%'};return _0x753fda;})});}_0x133aa6=_[_0x0430('0x52')]({},_0x133aa6,_0x1f4d9f[_0x0430('0x54')]);return _0x5c1fb3[_0x0430('0xbf')](_0x133aa6);}})[_0x0430('0x21')](function(_0x23349c){if(_0x23349c){_0x3136e5=_0x23349c[_0x0430('0x4d')];if(!_0x1f4d9f[_0x0430('0x47')]['hasOwnProperty'](_0x0430('0x4e'))){_0x133aa6['limit']=qs[_0x0430('0x30')](_0x1f4d9f[_0x0430('0x47')][_0x0430('0x30')]);_0x133aa6[_0x0430('0x2e')]=qs[_0x0430('0x2e')](_0x1f4d9f[_0x0430('0x47')][_0x0430('0x2e')]);}return _0x5c1fb3[_0x0430('0xbf')](_0x133aa6);}})[_0x0430('0x21')](function(_0x50c544){if(_0x50c544){return _0x50c544?{'count':_0x3136e5,'rows':_0x50c544}:null;}})[_0x0430('0x21')](respondWithResult(_0x1beb8f,null))['catch'](handleError(_0x1beb8f,null));};exports[_0x0430('0x3c')]=function(_0x49dede,_0x2775f6,_0x21a3f8){var _0x5c828a,_0x2a6351,_0x43e066;if(_[_0x0430('0x7b')](_0x49dede[_0x0430('0x5d')][_0x0430('0x5d')])||_0x49dede['body'][_0x0430('0x5d')]===''){throw new db[(_0x0430('0x74'))][(_0x0430('0x7c'))](_0x0430('0x7e'));}if(_[_0x0430('0x7b')](_0x49dede['body']['to'])){}_0x5c828a=_0x49dede[_0x0430('0x5d')]['to'];return db[_0x0430('0x41')][_0x0430('0xac')]({'where':{'id':_0x49dede[_0x0430('0x5a')]['id']}})[_0x0430('0x21')](handleEntityNotFound(_0x2775f6,null))[_0x0430('0x21')](function(_0x39fed4){if(_0x39fed4){return db[_0x0430('0x41')][_0x0430('0x5b')]({'where':{'id':_0x39fed4['id']},'include':[{'model':db[_0x0430('0x83')],'as':_0x0430('0x84'),'include':[{'model':db[_0x0430('0x73')],'as':_0x0430('0x85'),'where':{[_0x39fed4[_0x0430('0x81')]]:_0x5c828a},'limit':0x1,'order':[[_0x0430('0x78'),_0x0430('0xc0')]]}]}]})[_0x0430('0x21')](handleEntityNotFound(_0x2775f6,null))[_0x0430('0x21')](function(_0x55cd2d){if(_0x55cd2d&&_0x55cd2d[_0x0430('0x84')]){_0x2a6351=_0x55cd2d['get']({'plain':!![]});if(_0x2a6351[_0x0430('0x84')]&&_0x2a6351[_0x0430('0x84')][_0x0430('0x85')][_0x0430('0x4d')]){return _0x2a6351[_0x0430('0x84')][_0x0430('0x85')][0x0];}return db[_0x0430('0x73')][_0x0430('0x5c')](_[_0x0430('0x8c')](_0x49dede[_0x0430('0x5d')],{'firstName':_0x5c828a,[_0x55cd2d['mapKey']]:_0x5c828a,'phone':_0x5c828a,'ListId':_0x2a6351[_0x0430('0x7a')]}));}})['then'](handleEntityNotFound(_0x2775f6,null))['then'](function(_0x18cd3d){if(_0x18cd3d){_0x43e066=_0x18cd3d;return db[_0x0430('0x91')][_0x0430('0x5b')]({'where':{'ContactId':_0x43e066['id'],'closed':![],'OpenchannelAccountId':_0x2a6351['id']}})[_0x0430('0x21')](function(_0x1dd333){if(_0x1dd333){return[_0x1dd333,![]];}return db['OpenchannelInteraction'][_0x0430('0x5c')]({'UserId':_0x49dede[_0x0430('0x5e')]['id'],'ContactId':_0x43e066['id'],'OpenchannelAccountId':_0x2a6351['id'],'lastMsgDirection':_0x0430('0xc1'),'firstMsgDirection':_0x0430('0xc1'),'Messages':[_[_0x0430('0x52')](_0x49dede[_0x0430('0x5d')],{'read':![],'body':_0x49dede[_0x0430('0x5d')][_0x0430('0x5d')],'OpenchannelAccountId':_0x2a6351['id'],'UserId':_0x49dede[_0x0430('0x5e')]['id'],'ContactId':_0x43e066['id']})]},{'include':[{'model':db[_0x0430('0x99')],'as':_0x0430('0xc2')}]})['then'](function(_0x6e7c80){return[_0x6e7c80,!![]];});});}})[_0x0430('0xb9')](function(_0x47d321,_0x3a548d){if(_0x3a548d){return _0x47d321;}return db['OpenchannelMessage'][_0x0430('0x5c')](_[_0x0430('0x52')](_0x49dede[_0x0430('0x5d')],{'read':![],'body':_0x49dede[_0x0430('0x5d')][_0x0430('0x5d')],'OpenchannelAccountId':_0x2a6351['id'],'OpenchannelInteractionId':_0x47d321['id'],'UserId':_0x49dede['user']['id'],'ContactId':_0x43e066['id']}))[_0x0430('0x21')](function(_0x58da19){_0x47d321[_0x0430('0xc3')][_0x0430('0xc2')]=[];_0x47d321[_0x0430('0xc3')][_0x0430('0xc2')]['push'](_0x58da19['dataValues']);return _0x47d321;});});}})[_0x0430('0x21')](respondWithResult(_0x2775f6,null))[_0x0430('0x2a')](handleError(_0x2775f6,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a4d5234..2d80403 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x2858bd,_0x169bc2){var _0x4d3493=function(_0x6232f5){while(--_0x6232f5){_0x2858bd['push'](_0x2858bd['shift']());}};_0x4d3493(++_0x169bc2);}(_0x878f,0x173));var _0xf878=function(_0x55a030,_0x460cbd){_0x55a030=_0x55a030-0x0;var _0x1c5fc7=_0x878f[_0x55a030];return _0x1c5fc7;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){OpenchannelAccountEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);OpenchannelAccountEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0xf647d5,_0x3f26a4){var _0xa37852=function(_0x3c82a8){while(--_0x3c82a8){_0xf647d5['push'](_0xf647d5['shift']());}};_0xa37852(++_0x3f26a4);}(_0x13f6,0x124));var _0x613f=function(_0x137827,_0x46fbdd){_0x137827=_0x137827-0x0;var _0x1dbc3c=_0x13f6[_0x137827];return _0x1dbc3c;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 5ff1412..731d0f7 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3ec0c2,_0x5c7846){var _0x3d12a3=function(_0xbca893){while(--_0xbca893){_0x3ec0c2['push'](_0x3ec0c2['shift']());}};_0x3d12a3(++_0x5c7846);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3a8bc6,_0xf954e5){var _0x397b1e=function(_0x27f15b){while(--_0x27f15b){_0x3a8bc6['push'](_0x3a8bc6['shift']());}};_0x397b1e(++_0xf954e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index b71d140..1e9d571 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb5=['redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1afb1b,_0x178e18){var _0x55004d=function(_0x4b56c6){while(--_0x4b56c6){_0x1afb1b['push'](_0x1afb1b['shift']());}};_0x55004d(++_0x178e18);}(_0x0bb5,0x148));var _0x50bb=function(_0x30cfaf,_0x1dedc8){_0x30cfaf=_0x30cfaf-0x0;var _0x28d832=_0x0bb5[_0x30cfaf];return _0x28d832;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x50bb('0xa')]=_[_0x50bb('0xb')](config[_0x50bb('0xa')],{'host':_0x50bb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x50bb('0xd'))[_0x50bb('0xe')](socket);function respondWithRpcPromise(_0x3ae598,_0x239a89,_0x5512e1){return new BPromise(function(_0x36f7a1,_0x2edeeb){return client[_0x50bb('0xf')](_0x3ae598,_0x5512e1)[_0x50bb('0x10')](function(_0x346422){logger[_0x50bb('0x11')](_0x50bb('0x12'),_0x239a89,'request\x20sent');logger[_0x50bb('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x239a89,_0x50bb('0x14'),JSON[_0x50bb('0x15')](_0x346422));if(_0x346422[_0x50bb('0x16')]){if(_0x346422['error'][_0x50bb('0x17')]===0x1f4){logger[_0x50bb('0x16')](_0x50bb('0x12'),_0x239a89,_0x346422['error'][_0x50bb('0x18')]);return _0x2edeeb(_0x346422['error'][_0x50bb('0x18')]);}logger[_0x50bb('0x16')](_0x50bb('0x12'),_0x239a89,_0x346422[_0x50bb('0x16')][_0x50bb('0x18')]);return _0x36f7a1(_0x346422['error'][_0x50bb('0x18')]);}else{logger[_0x50bb('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x239a89,_0x50bb('0x14'));_0x36f7a1(_0x346422['result'][_0x50bb('0x18')]);}})[_0x50bb('0x19')](function(_0x4b06f5){logger['error'](_0x50bb('0x12'),_0x239a89,_0x4b06f5);_0x2edeeb(_0x4b06f5);});});} \ No newline at end of file +var _0x9ffd=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5f1dc6,_0x25c24c){_0x5f1dc6=_0x5f1dc6-0x0;var _0x2bfc69=_0x9ffd[_0x5f1dc6];return _0x2bfc69;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});config[_0xd9ff('0xb')]=_[_0xd9ff('0xc')](config[_0xd9ff('0xb')],{'host':_0xd9ff('0xd'),'port':0x18eb});var socket=require(_0xd9ff('0xe'))(new Redis(config[_0xd9ff('0xb')]));require(_0xd9ff('0xf'))['register'](socket);function respondWithRpcPromise(_0x54a555,_0x567f79,_0x5aa954){return new BPromise(function(_0x2355ab,_0x2fd77a){return client[_0xd9ff('0x10')](_0x54a555,_0x5aa954)[_0xd9ff('0x11')](function(_0x37d2c0){logger[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x567f79,_0xd9ff('0x14'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x567f79,_0xd9ff('0x14'),JSON[_0xd9ff('0x15')](_0x37d2c0));if(_0x37d2c0[_0xd9ff('0x16')]){if(_0x37d2c0[_0xd9ff('0x16')][_0xd9ff('0x17')]===0x1f4){logger['error'](_0xd9ff('0x13'),_0x567f79,_0x37d2c0[_0xd9ff('0x16')]['message']);return _0x2fd77a(_0x37d2c0[_0xd9ff('0x16')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x567f79,_0x37d2c0['error'][_0xd9ff('0x18')]);return _0x2355ab(_0x37d2c0['error'][_0xd9ff('0x18')]);}else{logger[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x567f79,_0xd9ff('0x14'));_0x2355ab(_0x37d2c0[_0xd9ff('0x19')][_0xd9ff('0x18')]);}})[_0xd9ff('0x1a')](function(_0x128588){logger[_0xd9ff('0x16')](_0xd9ff('0x13'),_0x567f79,_0x128588);_0x2fd77a(_0x128588);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 4bfd7b7..bebe4a1 100644 --- a/server/api/openchannelAccount/openchannelAccount.socket.js +++ b/server/api/openchannelAccount/openchannelAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa12=['register','openchannelAccount:','./openchannelAccount.events','save','update','removeListener'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x429735,_0x4db24b){_0x429735=_0x429735-0x0;var _0x470d06=_0xfa12[_0x429735];return _0x470d06;};'use strict';var OpenchannelAccountEvents=require(_0x2fa1('0x0'));var events=[_0x2fa1('0x1'),'remove',_0x2fa1('0x2')];function createListener(_0x1d3d90,_0x1abe62){return function(_0x877ea9){_0x1abe62['emit'](_0x1d3d90,_0x877ea9);};}function removeListener(_0x2022bf,_0x358fe1){return function(){OpenchannelAccountEvents[_0x2fa1('0x3')](_0x2022bf,_0x358fe1);};}exports[_0x2fa1('0x4')]=function(_0x4d61b0){for(var _0x166949=0x0,_0x25b233=events['length'];_0x166949<_0x25b233;_0x166949++){var _0x3449c3=events[_0x166949];var _0x30a897=createListener(_0x2fa1('0x5')+_0x3449c3,_0x4d61b0);OpenchannelAccountEvents['on'](_0x3449c3,_0x30a897);}}; \ No newline at end of file +var _0xe3ee=['register','length','openchannelAccount:','remove','update'];(function(_0x43cccb,_0x16be52){var _0x814975=function(_0x56c353){while(--_0x56c353){_0x43cccb['push'](_0x43cccb['shift']());}};_0x814975(++_0x16be52);}(_0xe3ee,0x116));var _0xee3e=function(_0x53a966,_0x522f55){_0x53a966=_0x53a966-0x0;var _0x5d9463=_0xe3ee[_0x53a966];return _0x5d9463;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xee3e('0x0'),_0xee3e('0x1')];function createListener(_0x5927b6,_0x52bcf2){return function(_0x45bf25){_0x52bcf2['emit'](_0x5927b6,_0x45bf25);};}function removeListener(_0x4c48ed,_0x12b41d){return function(){OpenchannelAccountEvents['removeListener'](_0x4c48ed,_0x12b41d);};}exports[_0xee3e('0x2')]=function(_0x352eca){for(var _0x3907a7=0x0,_0xd893ca=events[_0xee3e('0x3')];_0x3907a7<_0xd893ca;_0x3907a7++){var _0x39a770=events[_0x3907a7];var _0x43ab67=createListener(_0xee3e('0x4')+_0x39a770,_0x352eca);OpenchannelAccountEvents['on'](_0x39a770,_0x43ab67);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index ee8e520..7e86ae6 100644 --- a/server/api/openchannelApplication/index.js +++ b/server/api/openchannelApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe70b=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','/:id','isAuthenticated','post','create','put','delete'];(function(_0x3cddd8,_0x4706a8){var _0x592f06=function(_0x115345){while(--_0x115345){_0x3cddd8['push'](_0x3cddd8['shift']());}};_0x592f06(++_0x4706a8);}(_0xe70b,0x178));var _0xbe70=function(_0x15503f,_0x5af8c0){_0x15503f=_0x15503f-0x0;var _0x391ee0=_0xe70b[_0x15503f];return _0x391ee0;};'use strict';var multer=require(_0xbe70('0x0'));var util=require(_0xbe70('0x1'));var path=require(_0xbe70('0x2'));var timeout=require('connect-timeout');var express=require(_0xbe70('0x3'));var router=express[_0xbe70('0x4')]();var fs_extra=require(_0xbe70('0x5'));var auth=require(_0xbe70('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbe70('0x7'));var controller=require(_0xbe70('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbe70('0x9'),auth[_0xbe70('0xa')](),controller['show']);router[_0xbe70('0xb')]('/',auth['isAuthenticated'](),controller[_0xbe70('0xc')]);router[_0xbe70('0xd')](_0xbe70('0x9'),auth[_0xbe70('0xa')](),controller['update']);router[_0xbe70('0xe')](_0xbe70('0x9'),auth[_0xbe70('0xa')](),controller[_0xbe70('0xf')]);module[_0xbe70('0x10')]=router; \ No newline at end of file +var _0xc31b=['isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','path','Router','../../components/auth/service','./openchannelApplication.controller','get'];(function(_0x85b56f,_0x274ebf){var _0x2f3d98=function(_0x1386b5){while(--_0x1386b5){_0x85b56f['push'](_0x85b56f['shift']());}};_0x2f3d98(++_0x274ebf);}(_0xc31b,0x153));var _0xbc31=function(_0x411283,_0x56809f){_0x411283=_0x411283-0x0;var _0x3340bd=_0xc31b[_0x411283];return _0x3340bd;};'use strict';var multer=require(_0xbc31('0x0'));var util=require('util');var path=require(_0xbc31('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbc31('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbc31('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbc31('0x4'));router[_0xbc31('0x5')]('/',auth[_0xbc31('0x6')](),controller[_0xbc31('0x7')]);router[_0xbc31('0x5')](_0xbc31('0x8'),auth['isAuthenticated'](),controller[_0xbc31('0x9')]);router[_0xbc31('0xa')]('/',auth[_0xbc31('0x6')](),controller[_0xbc31('0xb')]);router[_0xbc31('0xc')]('/:id',auth[_0xbc31('0x6')](),controller[_0xbc31('0xd')]);router[_0xbc31('0xe')](_0xbc31('0x8'),auth[_0xbc31('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 33a8170..a73421e 100644 --- a/server/api/openchannelApplication/openchannelApplication.attributes.js +++ b/server/api/openchannelApplication/openchannelApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1c4=['STRING','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x41174e,_0x57bce3){var _0x1233b7=function(_0x248456){while(--_0x248456){_0x41174e['push'](_0x41174e['shift']());}};_0x1233b7(++_0x57bce3);}(_0xe1c4,0x12f));var _0x4e1c=function(_0x2744b3,_0x4ca3e8){_0x2744b3=_0x2744b3-0x0;var _0x3f4087=_0xe1c4[_0x2744b3];return _0x3f4087;};'use strict';var Sequelize=require(_0x4e1c('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4e1c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4e1c('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4e1c('0x3')]()},'description':{'type':Sequelize[_0x4e1c('0x2')]},'interval':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':_0x4e1c('0x4')}}; \ No newline at end of file +var _0x0b2a=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0x22e402,_0x1d0979){var _0x27c7dc=function(_0x393ac5){while(--_0x393ac5){_0x22e402['push'](_0x22e402['shift']());}};_0x27c7dc(++_0x1d0979);}(_0x0b2a,0x189));var _0xa0b2=function(_0x2a1db5,_0x1b7707){_0x2a1db5=_0x2a1db5-0x0;var _0x16cc55=_0x0b2a[_0x2a1db5];return _0x16cc55;};'use strict';var Sequelize=require(_0xa0b2('0x0'));module[_0xa0b2('0x1')]={'priority':{'type':Sequelize[_0xa0b2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa0b2('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa0b2('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index fd49c99..d0849d7 100644 --- a/server/api/openchannelApplication/openchannelApplication.controller.js +++ b/server/api/openchannelApplication/openchannelApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9af=['sendStatus','status','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','end','name','index','OpenchannelApplication','rawAttributes','fieldName','type','model','map','filters','intersection','query','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb'];(function(_0x561661,_0x2354e7){var _0x30262b=function(_0x28d5b9){while(--_0x28d5b9){_0x561661['push'](_0x561661['shift']());}};_0x30262b(++_0x2354e7);}(_0xc9af,0x78));var _0xfc9a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc9af[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xfc9a('0x0'));var rimraf=require(_0xfc9a('0x1'));var zipdir=require(_0xfc9a('0x2'));var jsonpatch=require(_0xfc9a('0x3'));var rp=require(_0xfc9a('0x4'));var moment=require(_0xfc9a('0x5'));var BPromise=require(_0xfc9a('0x6'));var Mustache=require(_0xfc9a('0x7'));var util=require(_0xfc9a('0x8'));var path=require(_0xfc9a('0x9'));var sox=require(_0xfc9a('0xa'));var csv=require(_0xfc9a('0xb'));var ejs=require(_0xfc9a('0xc'));var fs=require('fs');var fs_extra=require(_0xfc9a('0xd'));var _=require(_0xfc9a('0xe'));var squel=require(_0xfc9a('0xf'));var crypto=require(_0xfc9a('0x10'));var jsforce=require(_0xfc9a('0x11'));var deskjs=require(_0xfc9a('0x12'));var toCsv=require(_0xfc9a('0xb'));var querystring=require(_0xfc9a('0x13'));var Papa=require(_0xfc9a('0x14'));var Redis=require(_0xfc9a('0x15'));var authService=require(_0xfc9a('0x16'));var qs=require(_0xfc9a('0x17'));var as=require(_0xfc9a('0x18'));var hardwareService=require(_0xfc9a('0x19'));var logger=require(_0xfc9a('0x1a'))(_0xfc9a('0x1b'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc9a('0x1c'));var db=require(_0xfc9a('0x1d'))['db'];function respondWithStatusCode(_0x48a20e,_0x2c4fa5){_0x2c4fa5=_0x2c4fa5||0xcc;return function(_0x172028){if(_0x172028){return _0x48a20e[_0xfc9a('0x1e')](_0x2c4fa5);}return _0x48a20e[_0xfc9a('0x1f')](_0x2c4fa5)['end']();};}function respondWithResult(_0x5247da,_0x47d40a){_0x47d40a=_0x47d40a||0xc8;return function(_0x25b99f){if(_0x25b99f){return _0x5247da[_0xfc9a('0x1f')](_0x47d40a)[_0xfc9a('0x20')](_0x25b99f);}};}function respondWithFilteredResult(_0x207098,_0x56d462){return function(_0x2adc78){if(_0x2adc78){var _0x1183ed=typeof _0x56d462[_0xfc9a('0x21')]===_0xfc9a('0x22')&&typeof _0x56d462['limit']===_0xfc9a('0x22');var _0x2644aa=_0x2adc78[_0xfc9a('0x23')];var _0x5c7494=_0x1183ed?0x0:_0x56d462[_0xfc9a('0x21')];var _0x10fac7=_0x1183ed?_0x2adc78['count']:_0x56d462[_0xfc9a('0x21')]+_0x56d462['limit'];var _0x21cd65;if(_0x10fac7>=_0x2644aa){_0x10fac7=_0x2644aa;_0x21cd65=0xc8;}else{_0x21cd65=0xce;}_0x207098[_0xfc9a('0x1f')](_0x21cd65);return _0x207098['set'](_0xfc9a('0x24'),_0x5c7494+'-'+_0x10fac7+'/'+_0x2644aa)[_0xfc9a('0x20')](_0x2adc78);}return null;};}function patchUpdates(_0xfb2fd0){return function(_0x4e29ad){try{jsonpatch[_0xfc9a('0x25')](_0x4e29ad,_0xfb2fd0,!![]);}catch(_0x747ebf){return BPromise['reject'](_0x747ebf);}return _0x4e29ad[_0xfc9a('0x26')]();};}function saveUpdates(_0x132a6b,_0x220cb1){return function(_0x3d205e){if(_0x3d205e){return _0x3d205e[_0xfc9a('0x27')](_0x132a6b)[_0xfc9a('0x28')](function(_0x51e87b){return _0x51e87b;});}return null;};}function removeEntity(_0x345de0,_0x317de2){return function(_0x66288b){if(_0x66288b){return _0x66288b[_0xfc9a('0x29')]()[_0xfc9a('0x28')](function(){_0x345de0['status'](0xcc)[_0xfc9a('0x2a')]();});}};}function handleEntityNotFound(_0x131277,_0x59d9ec){return function(_0x572079){if(!_0x572079){_0x131277['sendStatus'](0x194);}return _0x572079;};}function handleError(_0x51cc4c,_0x341bf6){_0x341bf6=_0x341bf6||0x1f4;return function(_0x234a76){logger['error'](_0x234a76['stack']);if(_0x234a76[_0xfc9a('0x2b')]){delete _0x234a76[_0xfc9a('0x2b')];}_0x51cc4c['status'](_0x341bf6)['send'](_0x234a76);};}exports[_0xfc9a('0x2c')]=function(_0xb02631,_0x5de256){var _0x519b98={},_0x4a323d={},_0x15f876={'count':0x0,'rows':[]};var _0x80a9f5=_['map'](db[_0xfc9a('0x2d')][_0xfc9a('0x2e')],function(_0x44336e){return{'name':_0x44336e[_0xfc9a('0x2f')],'type':_0x44336e[_0xfc9a('0x30')]['key']};});_0x4a323d[_0xfc9a('0x31')]=_[_0xfc9a('0x32')](_0x80a9f5,_0xfc9a('0x2b'));_0x4a323d['query']=_['keys'](_0xb02631['query']);_0x4a323d[_0xfc9a('0x33')]=_[_0xfc9a('0x34')](_0x4a323d[_0xfc9a('0x31')],_0x4a323d[_0xfc9a('0x35')]);_0x519b98[_0xfc9a('0x36')]=_[_0xfc9a('0x34')](_0x4a323d[_0xfc9a('0x31')],qs[_0xfc9a('0x37')](_0xb02631[_0xfc9a('0x35')][_0xfc9a('0x37')]));_0x519b98[_0xfc9a('0x36')]=_0x519b98[_0xfc9a('0x36')][_0xfc9a('0x38')]?_0x519b98[_0xfc9a('0x36')]:_0x4a323d[_0xfc9a('0x31')];if(!_0xb02631[_0xfc9a('0x35')]['hasOwnProperty'](_0xfc9a('0x39'))){_0x519b98['limit']=qs[_0xfc9a('0x3a')](_0xb02631[_0xfc9a('0x35')][_0xfc9a('0x3a')]);_0x519b98[_0xfc9a('0x21')]=qs[_0xfc9a('0x21')](_0xb02631['query'][_0xfc9a('0x21')]);}_0x519b98[_0xfc9a('0x3b')]=qs[_0xfc9a('0x3c')](_0xb02631['query'][_0xfc9a('0x3c')]);_0x519b98[_0xfc9a('0x3d')]=qs['filters'](_['pick'](_0xb02631['query'],_0x4a323d[_0xfc9a('0x33')]),_0x80a9f5);if(_0xb02631[_0xfc9a('0x35')][_0xfc9a('0x3e')]){_0x519b98[_0xfc9a('0x3d')]=_[_0xfc9a('0x3f')](_0x519b98[_0xfc9a('0x3d')],{'$or':_['map'](_0x80a9f5,function(_0x59f1d5){if(_0x59f1d5[_0xfc9a('0x30')]!==_0xfc9a('0x40')){var _0x43758a={};_0x43758a[_0x59f1d5[_0xfc9a('0x2b')]]={'$like':'%'+_0xb02631['query'][_0xfc9a('0x3e')]+'%'};return _0x43758a;}})});}_0x519b98=_[_0xfc9a('0x3f')]({},_0x519b98,_0xb02631[_0xfc9a('0x41')]);var _0x35632f={'where':_0x519b98['where']};return db[_0xfc9a('0x2d')]['count'](_0x35632f)[_0xfc9a('0x28')](function(_0x51d072){_0x15f876[_0xfc9a('0x23')]=_0x51d072;if(_0xb02631['query'][_0xfc9a('0x42')]){_0x519b98[_0xfc9a('0x43')]=[{'all':!![]}];}return db[_0xfc9a('0x2d')][_0xfc9a('0x44')](_0x519b98);})[_0xfc9a('0x28')](function(_0x104f33){_0x15f876[_0xfc9a('0x45')]=_0x104f33;return _0x15f876;})['then'](respondWithFilteredResult(_0x5de256,_0x519b98))[_0xfc9a('0x46')](handleError(_0x5de256,null));};exports['show']=function(_0xd067c,_0x1c7187){var _0x89015f={'raw':!![],'where':{'id':_0xd067c[_0xfc9a('0x47')]['id']}},_0x933131={};_0x933131[_0xfc9a('0x31')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x933131[_0xfc9a('0x35')]=_[_0xfc9a('0x48')](_0xd067c['query']);_0x933131['filters']=_[_0xfc9a('0x34')](_0x933131['model'],_0x933131['query']);_0x89015f['attributes']=_[_0xfc9a('0x34')](_0x933131[_0xfc9a('0x31')],qs[_0xfc9a('0x37')](_0xd067c[_0xfc9a('0x35')]['fields']));_0x89015f[_0xfc9a('0x36')]=_0x89015f[_0xfc9a('0x36')]['length']?_0x89015f[_0xfc9a('0x36')]:_0x933131['model'];if(_0xd067c['query'][_0xfc9a('0x42')]){_0x89015f[_0xfc9a('0x43')]=[{'all':!![]}];}_0x89015f=_['merge']({},_0x89015f,_0xd067c[_0xfc9a('0x41')]);return db[_0xfc9a('0x2d')][_0xfc9a('0x49')](_0x89015f)[_0xfc9a('0x28')](handleEntityNotFound(_0x1c7187,null))[_0xfc9a('0x28')](respondWithResult(_0x1c7187,null))[_0xfc9a('0x46')](handleError(_0x1c7187,null));};exports['create']=function(_0x5c2fa2,_0x3d2d8b){return db[_0xfc9a('0x2d')]['create'](_0x5c2fa2[_0xfc9a('0x4a')],{})[_0xfc9a('0x28')](respondWithResult(_0x3d2d8b,0xc9))[_0xfc9a('0x46')](handleError(_0x3d2d8b,null));};exports['update']=function(_0x5f1f4a,_0x11ea63){if(_0x5f1f4a['body']['id']){delete _0x5f1f4a[_0xfc9a('0x4a')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x5f1f4a['params']['id']}})['then'](handleEntityNotFound(_0x11ea63,null))[_0xfc9a('0x28')](saveUpdates(_0x5f1f4a[_0xfc9a('0x4a')],null))[_0xfc9a('0x28')](respondWithResult(_0x11ea63,null))[_0xfc9a('0x46')](handleError(_0x11ea63,null));};exports[_0xfc9a('0x29')]=function(_0x364975,_0x522b96){return db[_0xfc9a('0x2d')][_0xfc9a('0x49')]({'where':{'id':_0x364975[_0xfc9a('0x47')]['id']}})['then'](handleEntityNotFound(_0x522b96,null))[_0xfc9a('0x28')](removeEntity(_0x522b96,null))[_0xfc9a('0x46')](handleError(_0x522b96,null));}; \ No newline at end of file +var _0xc5f8=['limit','offset','count','set','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','eml-format','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x3c96e9,_0x5a8abd){var _0x546772=function(_0x55a7b6){while(--_0x55a7b6){_0x3c96e9['push'](_0x3c96e9['shift']());}};_0x546772(++_0x5a8abd);}(_0xc5f8,0x15c));var _0x8c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8c5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c5f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c5f('0x2'));var moment=require('moment');var BPromise=require(_0x8c5f('0x3'));var Mustache=require('mustache');var util=require(_0x8c5f('0x4'));var path=require(_0x8c5f('0x5'));var sox=require('sox');var csv=require(_0x8c5f('0x6'));var ejs=require(_0x8c5f('0x7'));var fs=require('fs');var fs_extra=require(_0x8c5f('0x8'));var _=require(_0x8c5f('0x9'));var squel=require(_0x8c5f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c5f('0xb'));var Redis=require(_0x8c5f('0xc'));var authService=require(_0x8c5f('0xd'));var qs=require(_0x8c5f('0xe'));var as=require(_0x8c5f('0xf'));var hardwareService=require(_0x8c5f('0x10'));var logger=require(_0x8c5f('0x11'))(_0x8c5f('0x12'));var utils=require(_0x8c5f('0x13'));var config=require(_0x8c5f('0x14'));var licenseUtil=require(_0x8c5f('0x15'));var db=require(_0x8c5f('0x16'))['db'];function respondWithStatusCode(_0x4e76e7,_0x58915d){_0x58915d=_0x58915d||0xcc;return function(_0x5df27d){if(_0x5df27d){return _0x4e76e7['sendStatus'](_0x58915d);}return _0x4e76e7[_0x8c5f('0x17')](_0x58915d)[_0x8c5f('0x18')]();};}function respondWithResult(_0x4f789b,_0x500841){_0x500841=_0x500841||0xc8;return function(_0x489671){if(_0x489671){return _0x4f789b[_0x8c5f('0x17')](_0x500841)[_0x8c5f('0x19')](_0x489671);}};}function respondWithFilteredResult(_0x1dd1ee,_0x32207e){return function(_0x82f33a){if(_0x82f33a){var _0x1e885b=typeof _0x32207e['offset']===_0x8c5f('0x1a')&&typeof _0x32207e[_0x8c5f('0x1b')]===_0x8c5f('0x1a');var _0x32a2ef=_0x82f33a['count'];var _0x2dae74=_0x1e885b?0x0:_0x32207e[_0x8c5f('0x1c')];var _0x414742=_0x1e885b?_0x82f33a[_0x8c5f('0x1d')]:_0x32207e[_0x8c5f('0x1c')]+_0x32207e[_0x8c5f('0x1b')];var _0x1a9761;if(_0x414742>=_0x32a2ef){_0x414742=_0x32a2ef;_0x1a9761=0xc8;}else{_0x1a9761=0xce;}_0x1dd1ee[_0x8c5f('0x17')](_0x1a9761);return _0x1dd1ee[_0x8c5f('0x1e')]('Content-Range',_0x2dae74+'-'+_0x414742+'/'+_0x32a2ef)[_0x8c5f('0x19')](_0x82f33a);}return null;};}function patchUpdates(_0x18b826){return function(_0x18ed2c){try{jsonpatch[_0x8c5f('0x1f')](_0x18ed2c,_0x18b826,!![]);}catch(_0x10ead6){return BPromise['reject'](_0x10ead6);}return _0x18ed2c[_0x8c5f('0x20')]();};}function saveUpdates(_0x1e4045,_0x444b94){return function(_0x2fe4a7){if(_0x2fe4a7){return _0x2fe4a7['update'](_0x1e4045)[_0x8c5f('0x21')](function(_0x4823fb){return _0x4823fb;});}return null;};}function removeEntity(_0x17f39c,_0x3f1887){return function(_0x4e2adf){if(_0x4e2adf){return _0x4e2adf[_0x8c5f('0x22')]()[_0x8c5f('0x21')](function(){_0x17f39c[_0x8c5f('0x17')](0xcc)[_0x8c5f('0x18')]();});}};}function handleEntityNotFound(_0x189f5b,_0xf8a5fb){return function(_0x499c9a){if(!_0x499c9a){_0x189f5b[_0x8c5f('0x23')](0x194);}return _0x499c9a;};}function handleError(_0x3ebf31,_0x19069b){_0x19069b=_0x19069b||0x1f4;return function(_0x2cb402){logger[_0x8c5f('0x24')](_0x2cb402[_0x8c5f('0x25')]);if(_0x2cb402[_0x8c5f('0x26')]){delete _0x2cb402[_0x8c5f('0x26')];}_0x3ebf31['status'](_0x19069b)[_0x8c5f('0x27')](_0x2cb402);};}exports[_0x8c5f('0x28')]=function(_0x5557a6,_0x4982c2){var _0x464117={},_0xab145b={},_0x424519={'count':0x0,'rows':[]};var _0x534e6c=_[_0x8c5f('0x29')](db[_0x8c5f('0x2a')][_0x8c5f('0x2b')],function(_0x3157a3){return{'name':_0x3157a3[_0x8c5f('0x2c')],'type':_0x3157a3['type'][_0x8c5f('0x2d')]};});_0xab145b[_0x8c5f('0x2e')]=_['map'](_0x534e6c,'name');_0xab145b[_0x8c5f('0x2f')]=_[_0x8c5f('0x30')](_0x5557a6[_0x8c5f('0x2f')]);_0xab145b[_0x8c5f('0x31')]=_[_0x8c5f('0x32')](_0xab145b[_0x8c5f('0x2e')],_0xab145b[_0x8c5f('0x2f')]);_0x464117[_0x8c5f('0x33')]=_['intersection'](_0xab145b[_0x8c5f('0x2e')],qs['fields'](_0x5557a6[_0x8c5f('0x2f')][_0x8c5f('0x34')]));_0x464117[_0x8c5f('0x33')]=_0x464117[_0x8c5f('0x33')][_0x8c5f('0x35')]?_0x464117['attributes']:_0xab145b[_0x8c5f('0x2e')];if(!_0x5557a6[_0x8c5f('0x2f')][_0x8c5f('0x36')]('nolimit')){_0x464117[_0x8c5f('0x1b')]=qs[_0x8c5f('0x1b')](_0x5557a6[_0x8c5f('0x2f')]['limit']);_0x464117['offset']=qs[_0x8c5f('0x1c')](_0x5557a6['query'][_0x8c5f('0x1c')]);}_0x464117[_0x8c5f('0x37')]=qs[_0x8c5f('0x38')](_0x5557a6['query'][_0x8c5f('0x38')]);_0x464117[_0x8c5f('0x39')]=qs[_0x8c5f('0x31')](_[_0x8c5f('0x3a')](_0x5557a6[_0x8c5f('0x2f')],_0xab145b['filters']),_0x534e6c);if(_0x5557a6['query']['filter']){_0x464117[_0x8c5f('0x39')]=_[_0x8c5f('0x3b')](_0x464117[_0x8c5f('0x39')],{'$or':_[_0x8c5f('0x29')](_0x534e6c,function(_0x12bb51){if(_0x12bb51[_0x8c5f('0x3c')]!==_0x8c5f('0x3d')){var _0x11c633={};_0x11c633[_0x12bb51['name']]={'$like':'%'+_0x5557a6[_0x8c5f('0x2f')][_0x8c5f('0x3e')]+'%'};return _0x11c633;}})});}_0x464117=_['merge']({},_0x464117,_0x5557a6[_0x8c5f('0x3f')]);var _0x4ed3a7={'where':_0x464117['where']};return db[_0x8c5f('0x2a')][_0x8c5f('0x1d')](_0x4ed3a7)[_0x8c5f('0x21')](function(_0x2f0ed5){_0x424519[_0x8c5f('0x1d')]=_0x2f0ed5;if(_0x5557a6[_0x8c5f('0x2f')]['includeAll']){_0x464117[_0x8c5f('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x8c5f('0x41')](_0x464117);})[_0x8c5f('0x21')](function(_0x38361f){_0x424519[_0x8c5f('0x42')]=_0x38361f;return _0x424519;})[_0x8c5f('0x21')](respondWithFilteredResult(_0x4982c2,_0x464117))[_0x8c5f('0x43')](handleError(_0x4982c2,null));};exports[_0x8c5f('0x44')]=function(_0x421e33,_0x1c0366){var _0x1ea923={'raw':!![],'where':{'id':_0x421e33[_0x8c5f('0x45')]['id']}},_0x372647={};_0x372647[_0x8c5f('0x2e')]=_[_0x8c5f('0x30')](db['OpenchannelApplication'][_0x8c5f('0x2b')]);_0x372647[_0x8c5f('0x2f')]=_['keys'](_0x421e33['query']);_0x372647[_0x8c5f('0x31')]=_['intersection'](_0x372647[_0x8c5f('0x2e')],_0x372647[_0x8c5f('0x2f')]);_0x1ea923[_0x8c5f('0x33')]=_[_0x8c5f('0x32')](_0x372647['model'],qs[_0x8c5f('0x34')](_0x421e33[_0x8c5f('0x2f')][_0x8c5f('0x34')]));_0x1ea923[_0x8c5f('0x33')]=_0x1ea923[_0x8c5f('0x33')]['length']?_0x1ea923['attributes']:_0x372647[_0x8c5f('0x2e')];if(_0x421e33[_0x8c5f('0x2f')][_0x8c5f('0x46')]){_0x1ea923[_0x8c5f('0x40')]=[{'all':!![]}];}_0x1ea923=_[_0x8c5f('0x3b')]({},_0x1ea923,_0x421e33[_0x8c5f('0x3f')]);return db[_0x8c5f('0x2a')][_0x8c5f('0x47')](_0x1ea923)[_0x8c5f('0x21')](handleEntityNotFound(_0x1c0366,null))[_0x8c5f('0x21')](respondWithResult(_0x1c0366,null))[_0x8c5f('0x43')](handleError(_0x1c0366,null));};exports[_0x8c5f('0x48')]=function(_0x477ddc,_0x2a80fa){return db[_0x8c5f('0x2a')]['create'](_0x477ddc[_0x8c5f('0x49')],{})[_0x8c5f('0x21')](respondWithResult(_0x2a80fa,0xc9))[_0x8c5f('0x43')](handleError(_0x2a80fa,null));};exports[_0x8c5f('0x4a')]=function(_0x9d94db,_0x170aff){if(_0x9d94db['body']['id']){delete _0x9d94db[_0x8c5f('0x49')]['id'];}return db[_0x8c5f('0x2a')]['find']({'where':{'id':_0x9d94db[_0x8c5f('0x45')]['id']}})[_0x8c5f('0x21')](handleEntityNotFound(_0x170aff,null))[_0x8c5f('0x21')](saveUpdates(_0x9d94db[_0x8c5f('0x49')],null))[_0x8c5f('0x21')](respondWithResult(_0x170aff,null))[_0x8c5f('0x43')](handleError(_0x170aff,null));};exports[_0x8c5f('0x22')]=function(_0xc77c6a,_0x40b8b1){return db[_0x8c5f('0x2a')][_0x8c5f('0x47')]({'where':{'id':_0xc77c6a[_0x8c5f('0x45')]['id']}})[_0x8c5f('0x21')](handleEntityNotFound(_0x40b8b1,null))[_0x8c5f('0x21')](removeEntity(_0x40b8b1,null))[_0x8c5f('0x43')](handleError(_0x40b8b1,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f84747a..094e4db 100644 --- a/server/api/openchannelApplication/openchannelApplication.model.js +++ b/server/api/openchannelApplication/openchannelApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf45c=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4'];(function(_0x23ddec,_0x5af62c){var _0x1123f6=function(_0x161e85){while(--_0x161e85){_0x23ddec['push'](_0x23ddec['shift']());}};_0x1123f6(++_0x5af62c);}(_0xf45c,0x1b1));var _0xcf45=function(_0x4edad6,_0x151ce1){_0x4edad6=_0x4edad6-0x0;var _0x2c8c36=_0xf45c[_0x4edad6];return _0x2c8c36;};'use strict';var _=require('lodash');var util=require(_0xcf45('0x0'));var logger=require(_0xcf45('0x1'))(_0xcf45('0x2'));var moment=require(_0xcf45('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf45('0x4'));var fs=require('fs');var path=require(_0xcf45('0x5'));var rimraf=require('rimraf');var config=require(_0xcf45('0x6'));var attributes=require(_0xcf45('0x7'));module['exports']=function(_0x8c4f22,_0x33616c){return _0x8c4f22[_0xcf45('0x8')]('OpenchannelApplication',attributes,{'tableName':_0xcf45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcf45('0xa'),'collate':_0xcf45('0xb')});}; \ No newline at end of file +var _0xc746=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes'];(function(_0xbe0844,_0x467903){var _0x2a75b8=function(_0x1e8745){while(--_0x1e8745){_0xbe0844['push'](_0xbe0844['shift']());}};_0x2a75b8(++_0x467903);}(_0xc746,0xd6));var _0x6c74=function(_0x3aa658,_0x49b23b){_0x3aa658=_0x3aa658-0x0;var _0x338b9f=_0xc746[_0x3aa658];return _0x338b9f;};'use strict';var _=require(_0x6c74('0x0'));var util=require(_0x6c74('0x1'));var logger=require(_0x6c74('0x2'))(_0x6c74('0x3'));var moment=require(_0x6c74('0x4'));var BPromise=require(_0x6c74('0x5'));var rp=require(_0x6c74('0x6'));var fs=require('fs');var path=require(_0x6c74('0x7'));var rimraf=require(_0x6c74('0x8'));var config=require('../../config/environment');var attributes=require(_0x6c74('0x9'));module[_0x6c74('0xa')]=function(_0x2ad790,_0x420ab0){return _0x2ad790[_0x6c74('0xb')](_0x6c74('0xc'),attributes,{'tableName':_0x6c74('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6c74('0xe'),'collate':_0x6c74('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 69dc399..0ed548c 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14d8=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x26593d,_0x2e3bbd){var _0x1f127f=function(_0x4ef022){while(--_0x4ef022){_0x26593d['push'](_0x26593d['shift']());}};_0x1f127f(++_0x2e3bbd);}(_0x14d8,0xcb));var _0x814d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x14d8[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var moment=require(_0x814d('0x2'));var BPromise=require(_0x814d('0x3'));var rs=require(_0x814d('0x4'));var fs=require('fs');var Redis=require(_0x814d('0x5'));var db=require(_0x814d('0x6'))['db'];var utils=require(_0x814d('0x7'));var logger=require('../../config/logger')(_0x814d('0x8'));var config=require(_0x814d('0x9'));var jayson=require(_0x814d('0xa'));var client=jayson[_0x814d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21369f,_0x3c5a3b,_0x214eda){return new BPromise(function(_0x38da7f,_0x539afe){return client[_0x814d('0xc')](_0x21369f,_0x214eda)[_0x814d('0xd')](function(_0x16f936){logger[_0x814d('0xe')](_0x814d('0xf'),_0x3c5a3b,'request\x20sent');logger[_0x814d('0x10')](_0x814d('0x11'),_0x3c5a3b,_0x814d('0x12'),JSON['stringify'](_0x16f936));if(_0x16f936['error']){if(_0x16f936[_0x814d('0x13')][_0x814d('0x14')]===0x1f4){logger['error'](_0x814d('0xf'),_0x3c5a3b,_0x16f936['error']['message']);return _0x539afe(_0x16f936[_0x814d('0x13')][_0x814d('0x15')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x3c5a3b,_0x16f936[_0x814d('0x13')][_0x814d('0x15')]);return _0x38da7f(_0x16f936[_0x814d('0x13')][_0x814d('0x15')]);}else{logger[_0x814d('0xe')](_0x814d('0xf'),_0x3c5a3b,_0x814d('0x12'));_0x38da7f(_0x16f936[_0x814d('0x16')][_0x814d('0x15')]);}})[_0x814d('0x17')](function(_0x4ab309){logger[_0x814d('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x3c5a3b,_0x4ab309);_0x539afe(_0x4ab309);});});}exports[_0x814d('0x18')]=function(_0x41f2c5){var _0x241c91=this;return new Promise(function(_0x4dfb66,_0x1fee50){return db[_0x814d('0x19')]['update'](_0x41f2c5[_0x814d('0x1a')],{'raw':_0x41f2c5['options']?_0x41f2c5[_0x814d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41f2c5[_0x814d('0x1b')]?_0x41f2c5[_0x814d('0x1b')]['where']||null:null,'attributes':_0x41f2c5[_0x814d('0x1b')]?_0x41f2c5['options'][_0x814d('0x1c')]||null:null,'limit':_0x41f2c5['options']?_0x41f2c5[_0x814d('0x1b')][_0x814d('0x1d')]||null:null})[_0x814d('0xd')](function(_0x1c4f59){logger[_0x814d('0xe')]('UpdateOpenchannelApplication',_0x41f2c5);logger[_0x814d('0x10')](_0x814d('0x18'),_0x41f2c5,JSON['stringify'](_0x1c4f59));_0x4dfb66(_0x1c4f59);})[_0x814d('0x17')](function(_0xc094f3){logger['error'](_0x814d('0x18'),_0xc094f3[_0x814d('0x15')],_0x41f2c5);_0x1fee50(_0x241c91[_0x814d('0x13')](0x1f4,_0xc094f3[_0x814d('0x15')]));});});}; \ No newline at end of file +var _0x680c=['update','body','options','raw','where','limit','then','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelApplication'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x680c,0x1d8));var _0xc680=function(_0x202cfe,_0x4684eb){_0x202cfe=_0x202cfe-0x0;var _0x1b5f7e=_0x680c[_0x202cfe];return _0x1b5f7e;};'use strict';var _=require(_0xc680('0x0'));var util=require(_0xc680('0x1'));var moment=require(_0xc680('0x2'));var BPromise=require(_0xc680('0x3'));var rs=require(_0xc680('0x4'));var fs=require('fs');var Redis=require(_0xc680('0x5'));var db=require(_0xc680('0x6'))['db'];var utils=require(_0xc680('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc680('0x8')][_0xc680('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a5732,_0xc6ef4d,_0x30e40c){return new BPromise(function(_0x25559f,_0x2ef833){return client['request'](_0x4a5732,_0x30e40c)['then'](function(_0x2d892a){logger[_0xc680('0xa')](_0xc680('0xb'),_0xc6ef4d,_0xc680('0xc'));logger[_0xc680('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xc6ef4d,_0xc680('0xc'),JSON[_0xc680('0xe')](_0x2d892a));if(_0x2d892a[_0xc680('0xf')]){if(_0x2d892a[_0xc680('0xf')][_0xc680('0x10')]===0x1f4){logger[_0xc680('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0xc6ef4d,_0x2d892a[_0xc680('0xf')][_0xc680('0x11')]);return _0x2ef833(_0x2d892a[_0xc680('0xf')][_0xc680('0x11')]);}logger[_0xc680('0xf')](_0xc680('0xb'),_0xc6ef4d,_0x2d892a[_0xc680('0xf')][_0xc680('0x11')]);return _0x25559f(_0x2d892a['error'][_0xc680('0x11')]);}else{logger[_0xc680('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0xc6ef4d,_0xc680('0xc'));_0x25559f(_0x2d892a[_0xc680('0x12')][_0xc680('0x11')]);}})[_0xc680('0x13')](function(_0x5b8674){logger[_0xc680('0xf')](_0xc680('0xb'),_0xc6ef4d,_0x5b8674);_0x2ef833(_0x5b8674);});});}exports['UpdateOpenchannelApplication']=function(_0x417c9f){var _0x24ed4b=this;return new Promise(function(_0x44766a,_0x5c73b0){return db[_0xc680('0x14')][_0xc680('0x15')](_0x417c9f[_0xc680('0x16')],{'raw':_0x417c9f[_0xc680('0x17')]?_0x417c9f['options'][_0xc680('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417c9f[_0xc680('0x17')]?_0x417c9f[_0xc680('0x17')][_0xc680('0x19')]||null:null,'attributes':_0x417c9f[_0xc680('0x17')]?_0x417c9f[_0xc680('0x17')]['attributes']||null:null,'limit':_0x417c9f[_0xc680('0x17')]?_0x417c9f[_0xc680('0x17')][_0xc680('0x1a')]||null:null})[_0xc680('0x1b')](function(_0x4a4628){logger[_0xc680('0xa')]('UpdateOpenchannelApplication',_0x417c9f);logger[_0xc680('0xd')](_0xc680('0x1c'),_0x417c9f,JSON[_0xc680('0xe')](_0x4a4628));_0x44766a(_0x4a4628);})['catch'](function(_0x42e4f4){logger[_0xc680('0xf')]('UpdateOpenchannelApplication',_0x42e4f4[_0xc680('0x11')],_0x417c9f);_0x5c73b0(_0x24ed4b['error'](0x1f4,_0x42e4f4[_0xc680('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 72af55c..3e6632e 100644 --- a/server/api/openchannelInteraction/index.js +++ b/server/api/openchannelInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa0d=['multer','util','path','connect-timeout','express','Router','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','/:id','openchannelinteraction:destroy','destroy','/:id/tags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa0d,0x168));var _0xdaa0=function(_0x41aebc,_0x17c485){_0x41aebc=_0x41aebc-0x0;var _0x32711c=_0xaa0d[_0x41aebc];return _0x32711c;};'use strict';var multer=require(_0xdaa0('0x0'));var util=require(_0xdaa0('0x1'));var path=require(_0xdaa0('0x2'));var timeout=require(_0xdaa0('0x3'));var express=require(_0xdaa0('0x4'));var router=express[_0xdaa0('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdaa0('0x6'));var controller=require(_0xdaa0('0x7'));router[_0xdaa0('0x8')]('/',auth[_0xdaa0('0x9')](),controller[_0xdaa0('0xa')]);router[_0xdaa0('0x8')](_0xdaa0('0xb'),auth[_0xdaa0('0x9')](),controller[_0xdaa0('0xc')]);router[_0xdaa0('0x8')]('/:id',auth[_0xdaa0('0x9')](),controller['show']);router[_0xdaa0('0x8')](_0xdaa0('0xd'),auth[_0xdaa0('0x9')](),controller[_0xdaa0('0xe')]);router['get'](_0xdaa0('0xf'),auth[_0xdaa0('0x9')](),controller[_0xdaa0('0x10')]);router[_0xdaa0('0x11')]('/',auth[_0xdaa0('0x9')](),controller['create']);router[_0xdaa0('0x11')](_0xdaa0('0xd'),auth[_0xdaa0('0x9')](),controller[_0xdaa0('0x12')]);router[_0xdaa0('0x11')]('/:id/tags',auth[_0xdaa0('0x9')](),interaction[_0xdaa0('0x13')](_0xdaa0('0x14'),_0xdaa0('0x15')),controller[_0xdaa0('0x16')]);router[_0xdaa0('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0xdaa0('0x13')](_0xdaa0('0x14'),_0xdaa0('0x18')),controller['update']);router[_0xdaa0('0x19')](_0xdaa0('0x1a'),auth['isAuthenticated'](),interaction[_0xdaa0('0x13')](_0xdaa0('0x14'),_0xdaa0('0x1b')),controller[_0xdaa0('0x1c')]);router[_0xdaa0('0x19')](_0xdaa0('0x1d'),auth[_0xdaa0('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xa074=['./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','destroy','/:id/tags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x15f311,_0x40eedf){var _0x2545d1=function(_0x49c648){while(--_0x49c648){_0x15f311['push'](_0x15f311['shift']());}};_0x2545d1(++_0x40eedf);}(_0xa074,0xd7));var _0x4a07=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa074[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x4a07('0x0'));var util=require(_0x4a07('0x1'));var path=require(_0x4a07('0x2'));var timeout=require(_0x4a07('0x3'));var express=require('express');var router=express[_0x4a07('0x4')]();var fs_extra=require(_0x4a07('0x5'));var auth=require(_0x4a07('0x6'));var interaction=require(_0x4a07('0x7'));var config=require(_0x4a07('0x8'));var controller=require(_0x4a07('0x9'));router[_0x4a07('0xa')]('/',auth[_0x4a07('0xb')](),controller[_0x4a07('0xc')]);router[_0x4a07('0xa')](_0x4a07('0xd'),auth[_0x4a07('0xb')](),controller[_0x4a07('0xe')]);router[_0x4a07('0xa')](_0x4a07('0xf'),auth[_0x4a07('0xb')](),controller['show']);router[_0x4a07('0xa')](_0x4a07('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0x4a07('0xa')](_0x4a07('0x11'),auth[_0x4a07('0xb')](),controller[_0x4a07('0x12')]);router[_0x4a07('0x13')]('/',auth[_0x4a07('0xb')](),controller[_0x4a07('0x14')]);router[_0x4a07('0x13')]('/:id/messages',auth['isAuthenticated'](),controller[_0x4a07('0x15')]);router['post']('/:id/tags',auth[_0x4a07('0xb')](),interaction[_0x4a07('0x16')](_0x4a07('0x17'),_0x4a07('0x18')),controller[_0x4a07('0x19')]);router[_0x4a07('0x1a')]('/:id',auth[_0x4a07('0xb')](),interaction[_0x4a07('0x16')](_0x4a07('0x17'),_0x4a07('0x1b')),controller[_0x4a07('0x1c')]);router[_0x4a07('0x1d')](_0x4a07('0xf'),auth[_0x4a07('0xb')](),interaction[_0x4a07('0x16')](_0x4a07('0x17'),'openchannelinteraction:destroy'),controller[_0x4a07('0x1e')]);router[_0x4a07('0x1d')](_0x4a07('0x1f'),auth[_0x4a07('0xb')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 36cac53..caafba2 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.attributes.js +++ b/server/api/openchannelInteraction/openchannelInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c00=['sequelize','exports','STRING','DATE','ENUM','out','BOOLEAN','INTEGER'];(function(_0x2fda9e,_0x388ebf){var _0x214384=function(_0x36ea5a){while(--_0x36ea5a){_0x2fda9e['push'](_0x2fda9e['shift']());}};_0x214384(++_0x388ebf);}(_0x9c00,0x1a0));var _0x09c0=function(_0x55c06b,_0x1ab2da){_0x55c06b=_0x55c06b-0x0;var _0x12eb36=_0x9c00[_0x55c06b];return _0x12eb36;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x09c0('0x2')]},'secondDisposition':{'type':Sequelize[_0x09c0('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x09c0('0x2')]},'read1stAt':{'type':Sequelize[_0x09c0('0x3')]},'threadId':{'type':Sequelize[_0x09c0('0x2')]},'externalUrl':{'type':Sequelize[_0x09c0('0x2')]},'lastMsgAt':{'type':Sequelize[_0x09c0('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x09c0('0x4')]('in',_0x09c0('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x09c0('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x09c0('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x09c0('0x7')]}}; \ No newline at end of file +var _0x7348=['BOOLEAN','STRING','DATE','ENUM','out','INTEGER','exports'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7348,0x16b));var _0x8734=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7348[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0x8734('0x0')]={'closed':{'type':Sequelize[_0x8734('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8734('0x2')]},'secondDisposition':{'type':Sequelize[_0x8734('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8734('0x2')]},'note':{'type':Sequelize[_0x8734('0x2')]},'read1stAt':{'type':Sequelize[_0x8734('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x8734('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8734('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x8734('0x4')]('in',_0x8734('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8734('0x2')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8734('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f0649ee..115a71a 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.controller.js +++ b/server/api/openchannelInteraction/openchannelInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd92c=['where','filter','map','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','tmp','server','files','attachments','push','User','fullname','CmContact','lastName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','toString','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','Contact','secret','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','offset','limit','count','set','Content-Range','update','destroy','end','sendStatus','error','stack','name','send','index','OpenchannelInteraction','rawAttributes','type','getOptions','openchannel','query','user','then','show','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','catch','describe','addMessage','OpenchannelMessage','ids','getMessages','nolimit','order','sort'];(function(_0x4a6a4c,_0x5149d1){var _0xdb0e5b=function(_0x319640){while(--_0x319640){_0x4a6a4c['push'](_0x4a6a4c['shift']());}};_0xdb0e5b(++_0x5149d1);}(_0xd92c,0x1c2));var _0xcd92=function(_0x1bcf69,_0x20f815){_0x1bcf69=_0x1bcf69-0x0;var _0x2f056c=_0xd92c[_0x1bcf69];return _0x2f056c;};'use strict';var rimraf=require(_0xcd92('0x0'));var zipdir=require(_0xcd92('0x1'));var moment=require('moment');var util=require('util');var path=require(_0xcd92('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcd92('0x3'));var Redis=require(_0xcd92('0x4'));var interaction=require(_0xcd92('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0xcd92('0x6'));var logger=require(_0xcd92('0x7'))(_0xcd92('0x8'));var config=require(_0xcd92('0x9'));var db=require(_0xcd92('0xa'))['db'];config[_0xcd92('0xb')]=_['defaults'](config[_0xcd92('0xb')],{'host':_0xcd92('0xc'),'port':0x18eb});var socket=require(_0xcd92('0xd'))(new Redis(config['redis']));require(_0xcd92('0xe'))[_0xcd92('0xf')](socket);function respondWithStatusCode(_0x559d05,_0x1670dc){_0x1670dc=_0x1670dc||0xcc;return function(_0x3ce019){if(_0x3ce019){return _0x559d05['sendStatus'](_0x1670dc);}return _0x559d05[_0xcd92('0x10')](_0x1670dc)['end']();};}function respondWithResult(_0x3f9f20,_0x59f237){_0x59f237=_0x59f237||0xc8;return function(_0x3d3b5d){if(_0x3d3b5d){return _0x3f9f20[_0xcd92('0x10')](_0x59f237)[_0xcd92('0x11')](_0x3d3b5d);}};}function respondWithFilteredResult(_0x19025f,_0x1c7dc5){return function(_0x5206bc){if(_0x5206bc){var _0x496b0c=typeof _0x1c7dc5[_0xcd92('0x12')]==='undefined'&&typeof _0x1c7dc5[_0xcd92('0x13')]==='undefined';var _0x4b42b0=_0x5206bc[_0xcd92('0x14')];var _0x303c03=_0x496b0c?0x0:_0x1c7dc5[_0xcd92('0x12')];var _0x1d4cef=_0x496b0c?_0x5206bc['count']:_0x1c7dc5[_0xcd92('0x12')]+_0x1c7dc5['limit'];var _0x322166;if(_0x1d4cef>=_0x4b42b0){_0x1d4cef=_0x4b42b0;_0x322166=0xc8;}else{_0x322166=0xce;}_0x19025f['status'](_0x322166);return _0x19025f[_0xcd92('0x15')](_0xcd92('0x16'),_0x303c03+'-'+_0x1d4cef+'/'+_0x4b42b0)[_0xcd92('0x11')](_0x5206bc);}return null;};}function saveUpdates(_0x2c7cf6){return function(_0x20e228){if(_0x20e228){return _0x20e228[_0xcd92('0x17')](_0x2c7cf6)['then'](function(_0x340530){return _0x340530;});}return null;};}function removeEntity(_0x21ac53){return function(_0x3073ea){if(_0x3073ea){return _0x3073ea[_0xcd92('0x18')]()['then'](function(){_0x21ac53[_0xcd92('0x10')](0xcc)[_0xcd92('0x19')]();});}};}function handleEntityNotFound(_0x5b2d40){return function(_0x137dd7){if(!_0x137dd7){_0x5b2d40[_0xcd92('0x1a')](0x194);}return _0x137dd7;};}function handleError(_0x51014f,_0xcf7179){_0xcf7179=_0xcf7179||0x1f4;return function(_0x300adc){logger[_0xcd92('0x1b')](_0x300adc[_0xcd92('0x1c')]);if(_0x300adc[_0xcd92('0x1d')]){delete _0x300adc[_0xcd92('0x1d')];}_0x51014f[_0xcd92('0x10')](_0xcf7179)[_0xcd92('0x1e')](_0x300adc);};}exports[_0xcd92('0x1f')]=function(_0xbf77be,_0x5e78c8){var _0xfa7769={};var _0x32c17b=_['map'](db[_0xcd92('0x20')][_0xcd92('0x21')],function(_0x136989){return{'name':_0x136989['fieldName'],'type':_0x136989[_0xcd92('0x22')]['key']};});_0xfa7769=qs[_0xcd92('0x23')](_0x32c17b,_0xbf77be);return interaction['findAll'](_0xcd92('0x24'),_0xbf77be[_0xcd92('0x25')],_0xbf77be[_0xcd92('0x26')],_0xfa7769,_0x32c17b)[_0xcd92('0x27')](respondWithFilteredResult(_0x5e78c8,_0xfa7769))['catch'](handleError(_0x5e78c8,null));};exports[_0xcd92('0x28')]=function(_0x110dd6,_0x460025){var _0x148e3e={};if(_0x110dd6['query']['type']&&_0x110dd6[_0xcd92('0x25')][_0xcd92('0x22')]===_0xcd92('0x29')){_0x148e3e[_0xcd92('0x29')]=_0x110dd6[_0xcd92('0x2a')]['id'];}else{_0x148e3e['id']=_0x110dd6[_0xcd92('0x2a')]['id'];}var _0x4acb5b={'raw':![],'where':_0x148e3e},_0x43f0d8={};_0x43f0d8[_0xcd92('0x2b')]=_[_0xcd92('0x2c')](db[_0xcd92('0x20')][_0xcd92('0x21')]);_0x43f0d8['query']=_['keys'](_0x110dd6[_0xcd92('0x25')]);_0x43f0d8[_0xcd92('0x2d')]=_[_0xcd92('0x2e')](_0x43f0d8[_0xcd92('0x2b')],_0x43f0d8['query']);_0x4acb5b[_0xcd92('0x2f')]=_[_0xcd92('0x2e')](_0x43f0d8['model'],qs[_0xcd92('0x30')](_0x110dd6['query'][_0xcd92('0x30')]));_0x4acb5b[_0xcd92('0x2f')]=_0x4acb5b[_0xcd92('0x2f')][_0xcd92('0x31')]?_0x4acb5b[_0xcd92('0x2f')]:_0x43f0d8[_0xcd92('0x2b')];if(_0x110dd6[_0xcd92('0x25')][_0xcd92('0x32')]){_0x4acb5b[_0xcd92('0x33')]=[{'all':!![]}];}_0x4acb5b=_[_0xcd92('0x34')]({},_0x4acb5b,_0x110dd6[_0xcd92('0x35')]);return db['OpenchannelInteraction']['find'](_0x4acb5b)[_0xcd92('0x27')](handleEntityNotFound(_0x460025,null))[_0xcd92('0x27')](respondWithResult(_0x460025,null))['catch'](handleError(_0x460025,null));};exports[_0xcd92('0x36')]=function(_0x5892b0,_0x285198){return db[_0xcd92('0x20')][_0xcd92('0x36')](_0x5892b0[_0xcd92('0x37')],{})['then'](respondWithResult(_0x285198,0xc9))['catch'](handleError(_0x285198,null));};exports['update']=function(_0x1e187c,_0xf5d657){if(_0x1e187c['body']['id']){delete _0x1e187c[_0xcd92('0x37')]['id'];}return db['OpenchannelInteraction'][_0xcd92('0x38')]({'where':{'id':_0x1e187c[_0xcd92('0x2a')]['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0xf5d657,null))[_0xcd92('0x27')](saveUpdates(_0x1e187c[_0xcd92('0x37')],null))[_0xcd92('0x27')](respondWithResult(_0xf5d657,null))[_0xcd92('0x39')](handleError(_0xf5d657,null));};exports[_0xcd92('0x18')]=function(_0x4517e2,_0x5154b0){return db[_0xcd92('0x20')][_0xcd92('0x38')]({'where':{'id':_0x4517e2[_0xcd92('0x2a')]['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0x5154b0,null))[_0xcd92('0x27')](removeEntity(_0x5154b0,null))[_0xcd92('0x39')](handleError(_0x5154b0,null));};exports[_0xcd92('0x3a')]=function(_0x55b988,_0x1093f7){return db[_0xcd92('0x20')]['describe']()[_0xcd92('0x27')](respondWithResult(_0x1093f7,null))['catch'](handleError(_0x1093f7,null));};exports[_0xcd92('0x3b')]=function(_0x19bc9f,_0x578943){return db[_0xcd92('0x3c')][_0xcd92('0x38')]({'where':{'id':_0x19bc9f['params']['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0x578943,null))[_0xcd92('0x27')](function(_0x38d0e9){if(_0x38d0e9){return _0x38d0e9['addMessage'](_0x19bc9f[_0xcd92('0x37')][_0xcd92('0x3d')],_['omit'](_0x19bc9f['body'],[_0xcd92('0x3d'),'id'])||{});}})[_0xcd92('0x27')](respondWithResult(_0x578943,null))['catch'](handleError(_0x578943,null));};exports[_0xcd92('0x3e')]=function(_0x3b98c4,_0x8a9da7){var _0x25e252={'raw':![],'where':{}};var _0x3586d7={};var _0x2042a5={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x3b98c4['params']['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0x8a9da7,null))[_0xcd92('0x27')](function(_0x5d44ed){if(_0x5d44ed){_0x3586d7[_0xcd92('0x2b')]=_['keys'](db['OpenchannelMessage'][_0xcd92('0x21')]);_0x3586d7[_0xcd92('0x25')]=_[_0xcd92('0x2c')](_0x3b98c4[_0xcd92('0x25')]);_0x3586d7['filters']=_['intersection'](_0x3586d7[_0xcd92('0x2b')],_0x3586d7[_0xcd92('0x25')]);_0x25e252[_0xcd92('0x2f')]=_['intersection'](_0x3586d7[_0xcd92('0x2b')],qs[_0xcd92('0x30')](_0x3b98c4[_0xcd92('0x25')]['fields']));_0x25e252[_0xcd92('0x2f')]=_0x25e252['attributes'][_0xcd92('0x31')]?_0x25e252['attributes']:_0x3586d7['model'];if(!_0x3b98c4[_0xcd92('0x25')]['hasOwnProperty'](_0xcd92('0x3f'))){_0x25e252['limit']=qs[_0xcd92('0x13')](_0x3b98c4[_0xcd92('0x25')]['limit']);_0x25e252[_0xcd92('0x12')]=qs['offset'](_0x3b98c4[_0xcd92('0x25')][_0xcd92('0x12')]);}_0x25e252[_0xcd92('0x40')]=qs[_0xcd92('0x41')](_0x3b98c4['query']['sort']);_0x25e252[_0xcd92('0x42')]=qs['filters'](_['pick'](_0x3b98c4[_0xcd92('0x25')],_0x3586d7[_0xcd92('0x2d')]));_0x25e252[_0xcd92('0x42')]['OpenchannelInteractionId']=_0x5d44ed['id'];if(_0x3b98c4[_0xcd92('0x25')][_0xcd92('0x43')]){_0x25e252['where']=_[_0xcd92('0x34')](_0x25e252[_0xcd92('0x42')],{'$or':_[_0xcd92('0x44')](_0x25e252[_0xcd92('0x2f')],function(_0x3e5abe){var _0x5c399f={};_0x5c399f[_0x3e5abe]={'$like':'%'+_0x3b98c4[_0xcd92('0x25')][_0xcd92('0x43')]+'%'};return _0x5c399f;})});}if(_0x3b98c4[_0xcd92('0x25')]['$gte']){var _0x2c1fbf=_0x3b98c4[_0xcd92('0x25')]['$gte'][_0xcd92('0x45')](',');var _0x3df040={};_0x3df040[_0x2c1fbf[0x0]]={'$gte':moment(_0x2c1fbf[0x1])[_0xcd92('0x46')](_0xcd92('0x47'))};_0x25e252['where']=_[_0xcd92('0x34')](_0x25e252['where'],_0x3df040);}_0x25e252=_[_0xcd92('0x34')]({},_0x25e252,_0x3b98c4[_0xcd92('0x35')]);return db[_0xcd92('0x3c')]['count']({'where':_0x25e252[_0xcd92('0x42')]})[_0xcd92('0x27')](function(_0x39aa5f){_0x2042a5[_0xcd92('0x14')]=_0x39aa5f;if(_0x3b98c4['query'][_0xcd92('0x32')]){_0x25e252[_0xcd92('0x33')]=[{'all':!![]}];}return db[_0xcd92('0x3c')]['findAll'](_0x25e252);})[_0xcd92('0x27')](function(_0x183e70){_0x2042a5[_0xcd92('0x48')]=_0x183e70;return _0x2042a5;});}})[_0xcd92('0x27')](respondWithFilteredResult(_0x8a9da7,_0x25e252))[_0xcd92('0x39')](handleError(_0x8a9da7,null));};exports[_0xcd92('0x49')]=function(_0x4179ce,_0x51ac21){return db[_0xcd92('0x20')][_0xcd92('0x38')]({'where':{'id':_0x4179ce[_0xcd92('0x2a')]['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0x51ac21,null))['then'](function(_0xa6df5a){if(_0xa6df5a){return _0xa6df5a['setTags'](_0x4179ce[_0xcd92('0x37')][_0xcd92('0x3d')],_['omit'](_0x4179ce[_0xcd92('0x37')],[_0xcd92('0x3d'),'id'])||{})[_0xcd92('0x4a')](function(){return db[_0xcd92('0x4b')]['findAll']({'attributes':['id','name',_0xcd92('0x4c')],'where':{'id':_0x4179ce[_0xcd92('0x37')][_0xcd92('0x3d')]}});})[_0xcd92('0x27')](function(_0x25806d){socket[_0xcd92('0x4d')](_0xcd92('0x4e'),{'id':Number(_0x4179ce[_0xcd92('0x2a')]['id']),'tags':_0x25806d||[]});return{'id':Number(_0x4179ce[_0xcd92('0x2a')]['id']),'tags':_0x25806d||[]};});}})[_0xcd92('0x27')](respondWithResult(_0x51ac21,null))[_0xcd92('0x39')](handleError(_0x51ac21,null));};exports[_0xcd92('0x4f')]=function(_0x5a9165,_0x37fec1){return db[_0xcd92('0x20')]['find']({'where':{'id':_0x5a9165[_0xcd92('0x2a')]['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0x37fec1,null))[_0xcd92('0x27')](function(_0x4d7a3f){if(_0x4d7a3f){return _0x4d7a3f[_0xcd92('0x4f')](_0x5a9165['query'][_0xcd92('0x3d')]);}})[_0xcd92('0x27')](respondWithStatusCode(_0x37fec1,null))[_0xcd92('0x39')](handleError(_0x37fec1,null));};exports[_0xcd92('0x50')]=function(_0x54b12c,_0x13aa8c){var _0x523394=moment()[_0xcd92('0x51')]()['toString']();var _0x11fadf=path[_0xcd92('0x52')](config[_0xcd92('0x53')],'server','files',_0xcd92('0x54'));var _0x1a6ad5=path[_0xcd92('0x52')](config['root'],_0xcd92('0x55'),_0xcd92('0x56'),_0xcd92('0x57'));var _0x100b9b=path[_0xcd92('0x52')](_0x11fadf,_0x523394);var _0x59811a=util[_0xcd92('0x46')]('transcript-%d-%s.zip',_0x54b12c[_0xcd92('0x2a')]['id'],_0x523394);var _0xb76d38=path[_0xcd92('0x52')](_0x11fadf,_0x59811a);var _0x584838=[];_0x584838[_0xcd92('0x58')]({'model':db[_0xcd92('0x59')],'as':_0xcd92('0x59'),'attributes':['id',_0xcd92('0x5a')],'raw':!![]});_0x584838[_0xcd92('0x58')]({'model':db[_0xcd92('0x5b')],'as':'Contact','attributes':['id','firstName',_0xcd92('0x5c')],'raw':!![]});if(_0x54b12c['query'][_0xcd92('0x57')]){_0x584838['push']({'model':db[_0xcd92('0x5d')],'as':_0xcd92('0x5d'),'raw':!![]});}var _0x37d8d2=[{'model':db[_0xcd92('0x3c')],'as':_0xcd92('0x5e'),'attributes':['id',_0xcd92('0x37'),_0xcd92('0x5f'),_0xcd92('0x60'),'secret',_0xcd92('0x61')],'include':_0x584838}];_0x37d8d2[_0xcd92('0x58')]({'model':db[_0xcd92('0x62')],'as':_0xcd92('0x63'),'attributes':['id',_0xcd92('0x1d')]});_0x37d8d2[_0xcd92('0x58')]({'model':db[_0xcd92('0x59')],'as':'Owner','attributes':['id',_0xcd92('0x5a')]});return db['OpenchannelInteraction'][_0xcd92('0x38')]({'where':{'id':_0x54b12c['params']['id']},'include':_0x37d8d2})[_0xcd92('0x27')](handleEntityNotFound(_0x13aa8c,null))[_0xcd92('0x27')](function(_0x33b2b4){if(_0x33b2b4){var _0x1c018f=_0x33b2b4[_0xcd92('0x64')]({'plain':!![]});fs[_0xcd92('0x65')](_0x100b9b);var _0x225db1={'channel':_0xcd92('0x66'),'account':_0x1c018f[_0xcd92('0x63')][_0xcd92('0x1d')],'agent':_0x1c018f[_0xcd92('0x67')]?_0x1c018f[_0xcd92('0x67')][_0xcd92('0x5a')]:'N.A.','createdAt':moment(_0x1c018f[_0xcd92('0x5f')])['format'](_0xcd92('0x47'))[_0xcd92('0x68')](),'closedAt':_0x1c018f[_0xcd92('0x69')]?moment(_0x1c018f[_0xcd92('0x6a')])[_0xcd92('0x46')](_0xcd92('0x47'))[_0xcd92('0x68')]():'','disposition':_0x1c018f[_0xcd92('0x6b')],'visibility':_0x1c018f[_0xcd92('0x6c')]?_0xcd92('0x6d'):_0xcd92('0x6e'),'messages':_(_0x1c018f[_0xcd92('0x5e')])[_0xcd92('0x43')]({'secret':![]})[_0xcd92('0x44')](function(_0x4f6523){if(_0x4f6523[_0xcd92('0x5d')]){var _0x331865=path[_0xcd92('0x52')](_0x1a6ad5,_0x4f6523[_0xcd92('0x5d')][_0xcd92('0x6f')]);if(fs[_0xcd92('0x70')](_0x331865)){fs[_0xcd92('0x71')](_0x331865)[_0xcd92('0x72')](fs[_0xcd92('0x73')](path[_0xcd92('0x52')](_0x100b9b,_0x4f6523['Attachment'][_0xcd92('0x6f')])));}}return{'date':moment(_0x4f6523[_0xcd92('0x5f')])['format'](_0xcd92('0x47'))[_0xcd92('0x68')](),'sender':_0x4f6523['direction']===_0xcd92('0x74')?_0x4f6523[_0xcd92('0x59')]?_0x4f6523[_0xcd92('0x59')][_0xcd92('0x5a')]:_0xcd92('0x75'):_0x4f6523['Contact'][_0xcd92('0x76')]+(_0x4f6523[_0xcd92('0x77')]['lastName']?'\x20'+_0x4f6523['Contact'][_0xcd92('0x5c')]:''),'body':_0x4f6523[_0xcd92('0x5d')]?_0x4f6523[_0xcd92('0x5d')]['basename']:_0x4f6523['body'],'direction':_0x4f6523[_0xcd92('0x60')]==='out'?'A':'C','secret':_0x4f6523[_0xcd92('0x78')],'read':_0x4f6523[_0xcd92('0x61')],'attachment':_0x4f6523[_0xcd92('0x5d')]};})[_0xcd92('0x79')]()};return ejs[_0xcd92('0x7a')](path[_0xcd92('0x52')](config[_0xcd92('0x53')],_0xcd92('0x55'),_0xcd92('0x7b'),'downloadInteraction.ejs'),{'interaction':_0x225db1})[_0xcd92('0x27')](function(_0xedb60d){var _0xe8ef85=path[_0xcd92('0x52')](_0x100b9b,_0xcd92('0x7c')+_0x1c018f['id']+'-'+_0x523394+_0xcd92('0x7d'));var _0x11de33={'path':_0xe8ef85,'channel':_0xcd92('0x66'),'interactionId':_0x1c018f['id']};return pdf[_0xcd92('0x7e')](_0xedb60d,_0x11de33);})['then'](function(){return new Promise(function(_0xf6d5bb,_0x315dca){zipdir(_0x100b9b,{'saveTo':_0xb76d38},function(_0x564774,_0x3a69eb){if(_0x564774)return _0x315dca(_0x564774);return _0xf6d5bb(_0x3a69eb);});})['then'](function(){return new Promise(function(_0x159673,_0x2138f){rimraf(_0x100b9b,function(_0x4069e4){if(_0x4069e4)_0x2138f(_0x4069e4);return _0x159673();});});})[_0xcd92('0x27')](function(){return _0x13aa8c[_0xcd92('0x50')](_0xb76d38,_0x59811a,function(_0x186415){if(_0x186415){logger[_0xcd92('0x1b')](_0xcd92('0x7f'),_0x186415);}else{fs[_0xcd92('0x80')](_0xb76d38);}});});});}else{return _0x13aa8c['sendStatus'](0xc8);}})[_0xcd92('0x39')](handleError(_0x13aa8c,null));}; \ No newline at end of file +var _0x1f0b=['direction','read','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','createdAt','closed','closedAt','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','secret','value','downloadInteraction.ejs','transcript-','.pdf','download','rimraf','zip-dir','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','sendStatus','error','name','send','index','map','OpenchannelInteraction','rawAttributes','key','getOptions','openchannel','query','user','show','type','from','params','keys','filters','intersection','model','fields','length','attributes','includeAll','merge','options','find','catch','body','update','describe','addMessage','ids','omit','OpenchannelMessage','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','Attachment','Messages'];(function(_0x58836f,_0x5351e2){var _0x28f9b1=function(_0x30a6cc){while(--_0x30a6cc){_0x58836f['push'](_0x58836f['shift']());}};_0x28f9b1(++_0x5351e2);}(_0x1f0b,0x114));var _0xb1f0=function(_0x42bf9e,_0x54a2f0){_0x42bf9e=_0x42bf9e-0x0;var _0x48b8f0=_0x1f0b[_0x42bf9e];return _0x48b8f0;};'use strict';var rimraf=require(_0xb1f0('0x0'));var zipdir=require(_0xb1f0('0x1'));var moment=require('moment');var util=require(_0xb1f0('0x2'));var path=require('path');var ejs=require(_0xb1f0('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xb1f0('0x4'));var interaction=require(_0xb1f0('0x5'));var qs=require(_0xb1f0('0x6'));var pdf=require(_0xb1f0('0x7'));var logger=require(_0xb1f0('0x8'))(_0xb1f0('0x9'));var config=require(_0xb1f0('0xa'));var db=require(_0xb1f0('0xb'))['db'];config[_0xb1f0('0xc')]=_[_0xb1f0('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb1f0('0xe'))[_0xb1f0('0xf')](socket);function respondWithStatusCode(_0x233a87,_0x4180b7){_0x4180b7=_0x4180b7||0xcc;return function(_0x5b984e){if(_0x5b984e){return _0x233a87['sendStatus'](_0x4180b7);}return _0x233a87[_0xb1f0('0x10')](_0x4180b7)[_0xb1f0('0x11')]();};}function respondWithResult(_0xbd11e5,_0x8e6e8){_0x8e6e8=_0x8e6e8||0xc8;return function(_0x2b248c){if(_0x2b248c){return _0xbd11e5[_0xb1f0('0x10')](_0x8e6e8)[_0xb1f0('0x12')](_0x2b248c);}};}function respondWithFilteredResult(_0x590ee8,_0x223208){return function(_0x5dedf4){if(_0x5dedf4){var _0x282ce4=typeof _0x223208[_0xb1f0('0x13')]===_0xb1f0('0x14')&&typeof _0x223208[_0xb1f0('0x15')]===_0xb1f0('0x14');var _0x5a6a1a=_0x5dedf4[_0xb1f0('0x16')];var _0x422b3b=_0x282ce4?0x0:_0x223208[_0xb1f0('0x13')];var _0xfa13c3=_0x282ce4?_0x5dedf4[_0xb1f0('0x16')]:_0x223208[_0xb1f0('0x13')]+_0x223208[_0xb1f0('0x15')];var _0x13a928;if(_0xfa13c3>=_0x5a6a1a){_0xfa13c3=_0x5a6a1a;_0x13a928=0xc8;}else{_0x13a928=0xce;}_0x590ee8[_0xb1f0('0x10')](_0x13a928);return _0x590ee8['set'](_0xb1f0('0x17'),_0x422b3b+'-'+_0xfa13c3+'/'+_0x5a6a1a)[_0xb1f0('0x12')](_0x5dedf4);}return null;};}function saveUpdates(_0xec7ba2){return function(_0x3cfe3c){if(_0x3cfe3c){return _0x3cfe3c['update'](_0xec7ba2)[_0xb1f0('0x18')](function(_0x3c7469){return _0x3c7469;});}return null;};}function removeEntity(_0x42eb75){return function(_0x1021ee){if(_0x1021ee){return _0x1021ee[_0xb1f0('0x19')]()[_0xb1f0('0x18')](function(){_0x42eb75[_0xb1f0('0x10')](0xcc)[_0xb1f0('0x11')]();});}};}function handleEntityNotFound(_0x9cd817){return function(_0x39cc70){if(!_0x39cc70){_0x9cd817[_0xb1f0('0x1a')](0x194);}return _0x39cc70;};}function handleError(_0x3bacab,_0x13882f){_0x13882f=_0x13882f||0x1f4;return function(_0x1068cb){logger[_0xb1f0('0x1b')](_0x1068cb['stack']);if(_0x1068cb[_0xb1f0('0x1c')]){delete _0x1068cb[_0xb1f0('0x1c')];}_0x3bacab['status'](_0x13882f)[_0xb1f0('0x1d')](_0x1068cb);};}exports[_0xb1f0('0x1e')]=function(_0x3ac22c,_0x50e492){var _0x296fd7={};var _0xa70278=_[_0xb1f0('0x1f')](db[_0xb1f0('0x20')][_0xb1f0('0x21')],function(_0x22335b){return{'name':_0x22335b['fieldName'],'type':_0x22335b['type'][_0xb1f0('0x22')]};});_0x296fd7=qs[_0xb1f0('0x23')](_0xa70278,_0x3ac22c);return interaction['findAll'](_0xb1f0('0x24'),_0x3ac22c[_0xb1f0('0x25')],_0x3ac22c[_0xb1f0('0x26')],_0x296fd7,_0xa70278)[_0xb1f0('0x18')](respondWithFilteredResult(_0x50e492,_0x296fd7))['catch'](handleError(_0x50e492,null));};exports[_0xb1f0('0x27')]=function(_0x535097,_0x487bf3){var _0x3cb157={};if(_0x535097['query'][_0xb1f0('0x28')]&&_0x535097[_0xb1f0('0x25')][_0xb1f0('0x28')]===_0xb1f0('0x29')){_0x3cb157[_0xb1f0('0x29')]=_0x535097[_0xb1f0('0x2a')]['id'];}else{_0x3cb157['id']=_0x535097[_0xb1f0('0x2a')]['id'];}var _0x3efaea={'raw':![],'where':_0x3cb157},_0x4cfca5={};_0x4cfca5['model']=_['keys'](db[_0xb1f0('0x20')][_0xb1f0('0x21')]);_0x4cfca5[_0xb1f0('0x25')]=_[_0xb1f0('0x2b')](_0x535097['query']);_0x4cfca5[_0xb1f0('0x2c')]=_[_0xb1f0('0x2d')](_0x4cfca5[_0xb1f0('0x2e')],_0x4cfca5['query']);_0x3efaea['attributes']=_[_0xb1f0('0x2d')](_0x4cfca5[_0xb1f0('0x2e')],qs[_0xb1f0('0x2f')](_0x535097['query'][_0xb1f0('0x2f')]));_0x3efaea['attributes']=_0x3efaea['attributes'][_0xb1f0('0x30')]?_0x3efaea[_0xb1f0('0x31')]:_0x4cfca5['model'];if(_0x535097[_0xb1f0('0x25')][_0xb1f0('0x32')]){_0x3efaea['include']=[{'all':!![]}];}_0x3efaea=_[_0xb1f0('0x33')]({},_0x3efaea,_0x535097[_0xb1f0('0x34')]);return db['OpenchannelInteraction'][_0xb1f0('0x35')](_0x3efaea)[_0xb1f0('0x18')](handleEntityNotFound(_0x487bf3,null))['then'](respondWithResult(_0x487bf3,null))[_0xb1f0('0x36')](handleError(_0x487bf3,null));};exports['create']=function(_0x21e839,_0x356243){return db['OpenchannelInteraction']['create'](_0x21e839[_0xb1f0('0x37')],{})[_0xb1f0('0x18')](respondWithResult(_0x356243,0xc9))[_0xb1f0('0x36')](handleError(_0x356243,null));};exports[_0xb1f0('0x38')]=function(_0x2b8261,_0x665c1e){if(_0x2b8261[_0xb1f0('0x37')]['id']){delete _0x2b8261[_0xb1f0('0x37')]['id'];}return db['OpenchannelInteraction'][_0xb1f0('0x35')]({'where':{'id':_0x2b8261['params']['id']}})[_0xb1f0('0x18')](handleEntityNotFound(_0x665c1e,null))[_0xb1f0('0x18')](saveUpdates(_0x2b8261[_0xb1f0('0x37')],null))[_0xb1f0('0x18')](respondWithResult(_0x665c1e,null))[_0xb1f0('0x36')](handleError(_0x665c1e,null));};exports[_0xb1f0('0x19')]=function(_0x3a6432,_0x22b419){return db[_0xb1f0('0x20')]['find']({'where':{'id':_0x3a6432[_0xb1f0('0x2a')]['id']}})[_0xb1f0('0x18')](handleEntityNotFound(_0x22b419,null))[_0xb1f0('0x18')](removeEntity(_0x22b419,null))[_0xb1f0('0x36')](handleError(_0x22b419,null));};exports[_0xb1f0('0x39')]=function(_0x29304d,_0x4872be){return db[_0xb1f0('0x20')]['describe']()[_0xb1f0('0x18')](respondWithResult(_0x4872be,null))['catch'](handleError(_0x4872be,null));};exports[_0xb1f0('0x3a')]=function(_0xd57e52,_0x3632e2){return db['OpenchannelMessage'][_0xb1f0('0x35')]({'where':{'id':_0xd57e52[_0xb1f0('0x2a')]['id']}})[_0xb1f0('0x18')](handleEntityNotFound(_0x3632e2,null))[_0xb1f0('0x18')](function(_0x10cbc7){if(_0x10cbc7){return _0x10cbc7[_0xb1f0('0x3a')](_0xd57e52['body'][_0xb1f0('0x3b')],_[_0xb1f0('0x3c')](_0xd57e52['body'],[_0xb1f0('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x3632e2,null))[_0xb1f0('0x36')](handleError(_0x3632e2,null));};exports['getMessages']=function(_0xf3f06d,_0x1781aa){var _0x48d8bc={'raw':![],'where':{}};var _0x5194fe={};var _0x5cf29d={'count':0x0,'rows':[]};return db[_0xb1f0('0x20')]['findOne']({'where':{'id':_0xf3f06d[_0xb1f0('0x2a')]['id']}})[_0xb1f0('0x18')](handleEntityNotFound(_0x1781aa,null))[_0xb1f0('0x18')](function(_0x36cbfe){if(_0x36cbfe){_0x5194fe[_0xb1f0('0x2e')]=_[_0xb1f0('0x2b')](db[_0xb1f0('0x3d')]['rawAttributes']);_0x5194fe[_0xb1f0('0x25')]=_[_0xb1f0('0x2b')](_0xf3f06d[_0xb1f0('0x25')]);_0x5194fe[_0xb1f0('0x2c')]=_['intersection'](_0x5194fe[_0xb1f0('0x2e')],_0x5194fe[_0xb1f0('0x25')]);_0x48d8bc[_0xb1f0('0x31')]=_['intersection'](_0x5194fe[_0xb1f0('0x2e')],qs[_0xb1f0('0x2f')](_0xf3f06d[_0xb1f0('0x25')][_0xb1f0('0x2f')]));_0x48d8bc[_0xb1f0('0x31')]=_0x48d8bc[_0xb1f0('0x31')][_0xb1f0('0x30')]?_0x48d8bc[_0xb1f0('0x31')]:_0x5194fe[_0xb1f0('0x2e')];if(!_0xf3f06d[_0xb1f0('0x25')][_0xb1f0('0x3e')](_0xb1f0('0x3f'))){_0x48d8bc[_0xb1f0('0x15')]=qs[_0xb1f0('0x15')](_0xf3f06d['query'][_0xb1f0('0x15')]);_0x48d8bc[_0xb1f0('0x13')]=qs[_0xb1f0('0x13')](_0xf3f06d[_0xb1f0('0x25')][_0xb1f0('0x13')]);}_0x48d8bc[_0xb1f0('0x40')]=qs[_0xb1f0('0x41')](_0xf3f06d[_0xb1f0('0x25')][_0xb1f0('0x41')]);_0x48d8bc[_0xb1f0('0x42')]=qs[_0xb1f0('0x2c')](_[_0xb1f0('0x43')](_0xf3f06d[_0xb1f0('0x25')],_0x5194fe[_0xb1f0('0x2c')]));_0x48d8bc[_0xb1f0('0x42')][_0xb1f0('0x44')]=_0x36cbfe['id'];if(_0xf3f06d['query'][_0xb1f0('0x45')]){_0x48d8bc[_0xb1f0('0x42')]=_[_0xb1f0('0x33')](_0x48d8bc[_0xb1f0('0x42')],{'$or':_[_0xb1f0('0x1f')](_0x48d8bc['attributes'],function(_0x24b411){var _0x57f1d8={};_0x57f1d8[_0x24b411]={'$like':'%'+_0xf3f06d[_0xb1f0('0x25')][_0xb1f0('0x45')]+'%'};return _0x57f1d8;})});}if(_0xf3f06d[_0xb1f0('0x25')][_0xb1f0('0x46')]){var _0x3f27c4=_0xf3f06d['query'][_0xb1f0('0x46')][_0xb1f0('0x47')](',');var _0xcad636={};_0xcad636[_0x3f27c4[0x0]]={'$gte':moment(_0x3f27c4[0x1])[_0xb1f0('0x48')](_0xb1f0('0x49'))};_0x48d8bc[_0xb1f0('0x42')]=_[_0xb1f0('0x33')](_0x48d8bc[_0xb1f0('0x42')],_0xcad636);}_0x48d8bc=_[_0xb1f0('0x33')]({},_0x48d8bc,_0xf3f06d[_0xb1f0('0x34')]);return db[_0xb1f0('0x3d')][_0xb1f0('0x16')]({'where':_0x48d8bc[_0xb1f0('0x42')]})[_0xb1f0('0x18')](function(_0x304c25){_0x5cf29d[_0xb1f0('0x16')]=_0x304c25;if(_0xf3f06d['query'][_0xb1f0('0x32')]){_0x48d8bc['include']=[{'all':!![]}];}return db[_0xb1f0('0x3d')][_0xb1f0('0x4a')](_0x48d8bc);})[_0xb1f0('0x18')](function(_0x5df6da){_0x5cf29d['rows']=_0x5df6da;return _0x5cf29d;});}})[_0xb1f0('0x18')](respondWithFilteredResult(_0x1781aa,_0x48d8bc))['catch'](handleError(_0x1781aa,null));};exports[_0xb1f0('0x4b')]=function(_0x334ed1,_0x3c3198){return db[_0xb1f0('0x20')][_0xb1f0('0x35')]({'where':{'id':_0x334ed1[_0xb1f0('0x2a')]['id']}})[_0xb1f0('0x18')](handleEntityNotFound(_0x3c3198,null))[_0xb1f0('0x18')](function(_0x441ff3){if(_0x441ff3){return _0x441ff3[_0xb1f0('0x4c')](_0x334ed1['body'][_0xb1f0('0x3b')],_[_0xb1f0('0x3c')](_0x334ed1[_0xb1f0('0x37')],[_0xb1f0('0x3b'),'id'])||{})['spread'](function(){return db[_0xb1f0('0x4d')][_0xb1f0('0x4a')]({'attributes':['id',_0xb1f0('0x1c'),_0xb1f0('0x4e')],'where':{'id':_0x334ed1['body'][_0xb1f0('0x3b')]}});})['then'](function(_0x4f9ed4){socket[_0xb1f0('0x4f')](_0xb1f0('0x50'),{'id':Number(_0x334ed1[_0xb1f0('0x2a')]['id']),'tags':_0x4f9ed4||[]});return{'id':Number(_0x334ed1['params']['id']),'tags':_0x4f9ed4||[]};});}})['then'](respondWithResult(_0x3c3198,null))['catch'](handleError(_0x3c3198,null));};exports['removeTags']=function(_0x364bcd,_0x56886e){return db[_0xb1f0('0x20')]['find']({'where':{'id':_0x364bcd[_0xb1f0('0x2a')]['id']}})[_0xb1f0('0x18')](handleEntityNotFound(_0x56886e,null))['then'](function(_0x3ae491){if(_0x3ae491){return _0x3ae491[_0xb1f0('0x51')](_0x364bcd['query'][_0xb1f0('0x3b')]);}})[_0xb1f0('0x18')](respondWithStatusCode(_0x56886e,null))[_0xb1f0('0x36')](handleError(_0x56886e,null));};exports['download']=function(_0x3ec290,_0x40f202){var _0x186e1e=moment()[_0xb1f0('0x52')]()[_0xb1f0('0x53')]();var _0x24d133=path[_0xb1f0('0x54')](config['root'],_0xb1f0('0x55'),_0xb1f0('0x56'),_0xb1f0('0x57'));var _0x2031bf=path[_0xb1f0('0x54')](config[_0xb1f0('0x58')],_0xb1f0('0x55'),'files',_0xb1f0('0x59'));var _0x58447b=path[_0xb1f0('0x54')](_0x24d133,_0x186e1e);var _0x14fbec=util[_0xb1f0('0x48')](_0xb1f0('0x5a'),_0x3ec290['params']['id'],_0x186e1e);var _0x5cf4e4=path['join'](_0x24d133,_0x14fbec);var _0x5e3c6c=[];_0x5e3c6c['push']({'model':db['User'],'as':_0xb1f0('0x5b'),'attributes':['id',_0xb1f0('0x5c')],'raw':!![]});_0x5e3c6c[_0xb1f0('0x5d')]({'model':db[_0xb1f0('0x5e')],'as':_0xb1f0('0x5f'),'attributes':['id',_0xb1f0('0x60'),'lastName'],'raw':!![]});if(_0x3ec290[_0xb1f0('0x25')][_0xb1f0('0x59')]){_0x5e3c6c[_0xb1f0('0x5d')]({'model':db[_0xb1f0('0x61')],'as':_0xb1f0('0x61'),'raw':!![]});}var _0x29ab9f=[{'model':db[_0xb1f0('0x3d')],'as':_0xb1f0('0x62'),'attributes':['id',_0xb1f0('0x37'),'createdAt',_0xb1f0('0x63'),'secret',_0xb1f0('0x64')],'include':_0x5e3c6c}];_0x29ab9f['push']({'model':db[_0xb1f0('0x65')],'as':_0xb1f0('0x66'),'attributes':['id',_0xb1f0('0x1c')]});_0x29ab9f[_0xb1f0('0x5d')]({'model':db[_0xb1f0('0x5b')],'as':'Owner','attributes':['id',_0xb1f0('0x5c')]});return db[_0xb1f0('0x20')][_0xb1f0('0x35')]({'where':{'id':_0x3ec290[_0xb1f0('0x2a')]['id']},'include':_0x29ab9f})[_0xb1f0('0x18')](handleEntityNotFound(_0x40f202,null))[_0xb1f0('0x18')](function(_0x56e21f){if(_0x56e21f){var _0x1fc007=_0x56e21f[_0xb1f0('0x67')]({'plain':!![]});fs[_0xb1f0('0x68')](_0x58447b);var _0x3b863d={'channel':_0xb1f0('0x69'),'account':_0x1fc007[_0xb1f0('0x66')][_0xb1f0('0x1c')],'agent':_0x1fc007[_0xb1f0('0x6a')]?_0x1fc007[_0xb1f0('0x6a')]['fullname']:_0xb1f0('0x6b'),'createdAt':moment(_0x1fc007[_0xb1f0('0x6c')])[_0xb1f0('0x48')](_0xb1f0('0x49'))['toString'](),'closedAt':_0x1fc007[_0xb1f0('0x6d')]?moment(_0x1fc007[_0xb1f0('0x6e')])['format'](_0xb1f0('0x49'))[_0xb1f0('0x53')]():'','disposition':_0x1fc007['disposition'],'visibility':_0x1fc007[_0xb1f0('0x6f')]?_0xb1f0('0x70'):'Private','messages':_(_0x1fc007[_0xb1f0('0x62')])[_0xb1f0('0x45')]({'secret':![]})[_0xb1f0('0x1f')](function(_0x2b40f6){if(_0x2b40f6['Attachment']){var _0x5e8263=path[_0xb1f0('0x54')](_0x2031bf,_0x2b40f6[_0xb1f0('0x61')][_0xb1f0('0x71')]);if(fs[_0xb1f0('0x72')](_0x5e8263)){fs[_0xb1f0('0x73')](_0x5e8263)[_0xb1f0('0x74')](fs[_0xb1f0('0x75')](path[_0xb1f0('0x54')](_0x58447b,_0x2b40f6[_0xb1f0('0x61')]['basename'])));}}return{'date':moment(_0x2b40f6['createdAt'])[_0xb1f0('0x48')](_0xb1f0('0x49'))[_0xb1f0('0x53')](),'sender':_0x2b40f6['direction']===_0xb1f0('0x76')?_0x2b40f6[_0xb1f0('0x5b')]?_0x2b40f6[_0xb1f0('0x5b')][_0xb1f0('0x5c')]:'System':_0x2b40f6[_0xb1f0('0x5f')][_0xb1f0('0x60')]+(_0x2b40f6[_0xb1f0('0x5f')]['lastName']?'\x20'+_0x2b40f6['Contact']['lastName']:''),'body':_0x2b40f6['Attachment']?_0x2b40f6['Attachment']['basename']:_0x2b40f6[_0xb1f0('0x37')],'direction':_0x2b40f6[_0xb1f0('0x63')]===_0xb1f0('0x76')?'A':'C','secret':_0x2b40f6[_0xb1f0('0x77')],'read':_0x2b40f6[_0xb1f0('0x64')],'attachment':_0x2b40f6[_0xb1f0('0x61')]};})[_0xb1f0('0x78')]()};return ejs['renderFile'](path['join'](config[_0xb1f0('0x58')],_0xb1f0('0x55'),'views',_0xb1f0('0x79')),{'interaction':_0x3b863d})[_0xb1f0('0x18')](function(_0x355aab){var _0x32811a=path[_0xb1f0('0x54')](_0x58447b,_0xb1f0('0x7a')+_0x1fc007['id']+'-'+_0x186e1e+_0xb1f0('0x7b'));var _0x373e84={'path':_0x32811a,'channel':_0xb1f0('0x69'),'interactionId':_0x1fc007['id']};return pdf['createPdfFromHTML'](_0x355aab,_0x373e84);})['then'](function(){return new Promise(function(_0x2ca58a,_0x3548b4){zipdir(_0x58447b,{'saveTo':_0x5cf4e4},function(_0x5318f4,_0x425dbb){if(_0x5318f4)return _0x3548b4(_0x5318f4);return _0x2ca58a(_0x425dbb);});})[_0xb1f0('0x18')](function(){return new Promise(function(_0x3c6339,_0x49cb67){rimraf(_0x58447b,function(_0x4d4ba1){if(_0x4d4ba1)_0x49cb67(_0x4d4ba1);return _0x3c6339();});});})[_0xb1f0('0x18')](function(){return _0x40f202[_0xb1f0('0x7c')](_0x5cf4e4,_0x14fbec,function(_0x3a8d77){if(_0x3a8d77){logger[_0xb1f0('0x1b')]('Unable\x20to\x20delete\x20zip\x20file',_0x3a8d77);}else{fs['unlinkSync'](_0x5cf4e4);}});});});}else{return _0x40f202[_0xb1f0('0x1a')](0xc8);}})['catch'](handleError(_0x40f202,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f95987f..d84c2b4 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.events.js +++ b/server/api/openchannelInteraction/openchannelInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f27=['catch','hasOwnProperty','exports','events','OpenchannelInteraction','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x2f27,0x1d4));var _0x72f2=function(_0x32a039,_0x3323de){_0x32a039=_0x32a039-0x0;var _0x2b3986=_0x2f27[_0x32a039];return _0x2b3986;};'use strict';var EventEmitter=require(_0x72f2('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x72f2('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x72f2('0x2')](0x0);var events={'afterCreate':_0x72f2('0x3'),'afterUpdate':'update','afterDestroy':_0x72f2('0x4')};function emitEvent(_0x4bbd99){return function(_0x5c25c3,_0x5a25b5,_0x14ce20){_0x5c25c3['getUsers']({'attributes':['id'],'raw':!![]})[_0x72f2('0x5')](function(_0x3c599e){_0x5c25c3[_0x72f2('0x6')](_0x72f2('0x7'),_0x3c599e[_0x72f2('0x8')](function(_0x4df763){return{'id':_0x4df763['id']};}));return OpenchannelMessage[_0x72f2('0x9')]({'where':{'OpenchannelInteractionId':_0x5c25c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x72f2('0x5')](function(_0x1d782e){_0x5c25c3[_0x72f2('0x6')](_0x72f2('0xa'),_0x1d782e['length']);OpenchannelInteractionEvents['emit'](_0x4bbd99+':'+_0x5c25c3['id'],_0x5c25c3);OpenchannelInteractionEvents[_0x72f2('0xb')](_0x4bbd99,_0x5c25c3);_0x14ce20(null);})[_0x72f2('0xc')](_0x14ce20(null));};}for(var e in events){if(events[_0x72f2('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x72f2('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3f2b=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','save','update','getUsers','then','setDataValue'];(function(_0x24cc72,_0x4dc73a){var _0xd49f1e=function(_0x39f581){while(--_0x39f581){_0x24cc72['push'](_0x24cc72['shift']());}};_0xd49f1e(++_0x4dc73a);}(_0x3f2b,0x64));var _0xb3f2=function(_0x4208c4,_0x4fa88e){_0x4208c4=_0x4208c4-0x0;var _0x31457c=_0x3f2b[_0x4208c4];return _0x31457c;};'use strict';var EventEmitter=require(_0xb3f2('0x0'));var OpenchannelInteraction=require(_0xb3f2('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xb3f2('0x1'))['db'][_0xb3f2('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb3f2('0x3'),'afterUpdate':_0xb3f2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21693d){return function(_0x26de8c,_0x58967d,_0x25987b){_0x26de8c[_0xb3f2('0x5')]({'attributes':['id'],'raw':!![]})[_0xb3f2('0x6')](function(_0x26f05e){_0x26de8c[_0xb3f2('0x7')](_0xb3f2('0x8'),_0x26f05e[_0xb3f2('0x9')](function(_0x31eb2d){return{'id':_0x31eb2d['id']};}));return OpenchannelMessage[_0xb3f2('0xa')]({'where':{'OpenchannelInteractionId':_0x26de8c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb3f2('0x6')](function(_0x2369db){_0x26de8c[_0xb3f2('0x7')](_0xb3f2('0xb'),_0x2369db[_0xb3f2('0xc')]);OpenchannelInteractionEvents[_0xb3f2('0xd')](_0x21693d+':'+_0x26de8c['id'],_0x26de8c);OpenchannelInteractionEvents['emit'](_0x21693d,_0x26de8c);_0x25987b(null);})[_0xb3f2('0xe')](_0x25987b(null));};}for(var e in events){if(events[_0xb3f2('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xb3f2('0x10')](e,emitEvent(event));}}module[_0xb3f2('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0b00c33..a9b7bdf 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.model.js +++ b/server/api/openchannelInteraction/openchannelInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b74=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2ccb01,_0x56aedc){var _0x408035=function(_0x6f2b48){while(--_0x6f2b48){_0x2ccb01['push'](_0x2ccb01['shift']());}};_0x408035(++_0x56aedc);}(_0x3b74,0x80));var _0x43b7=function(_0x1a20fe,_0x5ac383){_0x1a20fe=_0x1a20fe-0x0;var _0x20c7c7=_0x3b74[_0x1a20fe];return _0x20c7c7;};'use strict';var _=require(_0x43b7('0x0'));var util=require(_0x43b7('0x1'));var logger=require(_0x43b7('0x2'))(_0x43b7('0x3'));var moment=require('moment');var BPromise=require(_0x43b7('0x4'));var rp=require(_0x43b7('0x5'));var fs=require('fs');var path=require(_0x43b7('0x6'));var rimraf=require(_0x43b7('0x7'));var config=require('../../config/environment');var attributes=require(_0x43b7('0x8'));module[_0x43b7('0x9')]=function(_0x3e62b0,_0x444109){return _0x3e62b0[_0x43b7('0xa')](_0x43b7('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x43b7('0xc'),'hooks':{'beforeUpdate':function(_0xb07b65,_0x593add,_0x11662a){if(_0xb07b65[_0x43b7('0xd')]('closed')){_0xb07b65[_0x43b7('0xe')]=moment()['format'](_0x43b7('0xf'));}_0x11662a(null,_0xb07b65);}}});}; \ No newline at end of file +var _0x0309=['utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0x0309,0x165));var _0x9030=function(_0x33d2be,_0x4e11c0){_0x33d2be=_0x33d2be-0x0;var _0x5ddb9b=_0x0309[_0x33d2be];return _0x5ddb9b;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));module['exports']=function(_0x5a3334,_0x1c9c7b){return _0x5a3334[_0x9030('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x9030('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9030('0xb'),'hooks':{'beforeUpdate':function(_0x32d47d,_0x289add,_0x5711b4){if(_0x32d47d[_0x9030('0xc')](_0x9030('0xd'))){_0x32d47d[_0x9030('0xe')]=moment()['format'](_0x9030('0xf'));}_0x5711b4(null,_0x32d47d);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index b893b86..4bcc989 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.rpc.js +++ b/server/api/openchannelInteraction/openchannelInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31e4=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','limit','find','addTags','body','omit','ids','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1d4b38,_0x31cc9f){var _0x341c2d=function(_0x1952f7){while(--_0x1952f7){_0x1d4b38['push'](_0x1d4b38['shift']());}};_0x341c2d(++_0x31cc9f);}(_0x31e4,0x133));var _0x431e=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0x31e4[_0xb6e2ea];return _0x2a57bb;};'use strict';var _=require(_0x431e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x431e('0x1'));var rs=require(_0x431e('0x2'));var fs=require('fs');var Redis=require(_0x431e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x431e('0x4'));var logger=require(_0x431e('0x5'))(_0x431e('0x6'));var config=require(_0x431e('0x7'));var jayson=require(_0x431e('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x431e('0x9')]=_[_0x431e('0xa')](config[_0x431e('0x9')],{'host':_0x431e('0xb'),'port':0x18eb});var socket=require(_0x431e('0xc'))(new Redis(config[_0x431e('0x9')]));require(_0x431e('0xd'))['register'](socket);function respondWithRpcPromise(_0x153cf2,_0x5f110b,_0x13c100){return new BPromise(function(_0x3c1b93,_0x32b78a){return client[_0x431e('0xe')](_0x153cf2,_0x13c100)[_0x431e('0xf')](function(_0x3ab77f){logger[_0x431e('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5f110b,_0x431e('0x11'));logger[_0x431e('0x12')](_0x431e('0x13'),_0x5f110b,_0x431e('0x11'),JSON[_0x431e('0x14')](_0x3ab77f));if(_0x3ab77f[_0x431e('0x15')]){if(_0x3ab77f['error'][_0x431e('0x16')]===0x1f4){logger[_0x431e('0x15')](_0x431e('0x17'),_0x5f110b,_0x3ab77f[_0x431e('0x15')][_0x431e('0x18')]);return _0x32b78a(_0x3ab77f['error']['message']);}logger[_0x431e('0x15')](_0x431e('0x17'),_0x5f110b,_0x3ab77f[_0x431e('0x15')][_0x431e('0x18')]);return _0x3c1b93(_0x3ab77f[_0x431e('0x15')][_0x431e('0x18')]);}else{logger[_0x431e('0x10')](_0x431e('0x17'),_0x5f110b,'request\x20sent');_0x3c1b93(_0x3ab77f['result'][_0x431e('0x18')]);}})[_0x431e('0x19')](function(_0x5da8c9){logger[_0x431e('0x15')](_0x431e('0x17'),_0x5f110b,_0x5da8c9);_0x32b78a(_0x5da8c9);});});}exports[_0x431e('0x1a')]=function(_0x131d4b){var _0x29a992=this;return new Promise(function(_0x1664a2,_0x30e2ea){return db[_0x431e('0x1b')]['update'](_0x131d4b['body'],{'raw':_0x131d4b[_0x431e('0x1c')]?_0x131d4b[_0x431e('0x1c')][_0x431e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x131d4b[_0x431e('0x1c')]?_0x131d4b[_0x431e('0x1c')][_0x431e('0x1e')]||null:null,'attributes':_0x131d4b[_0x431e('0x1c')]?_0x131d4b[_0x431e('0x1c')]['attributes']||null:null,'limit':_0x131d4b[_0x431e('0x1c')]?_0x131d4b[_0x431e('0x1c')][_0x431e('0x1f')]||null:null})[_0x431e('0xf')](function(_0x4be05d){logger['info']('UpdateOpenchannelInteraction',_0x131d4b);logger[_0x431e('0x12')](_0x431e('0x1a'),_0x131d4b,JSON['stringify'](_0x4be05d));_0x1664a2(_0x4be05d);})[_0x431e('0x19')](function(_0x313066){logger[_0x431e('0x15')](_0x431e('0x1a'),_0x313066[_0x431e('0x18')],_0x131d4b);_0x30e2ea(_0x29a992[_0x431e('0x15')](0x1f4,_0x313066[_0x431e('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x15513d){return new Promise(function(_0x155cb1,_0x3989ab){return db[_0x431e('0x1b')][_0x431e('0x20')]({'where':_0x15513d[_0x431e('0x1c')]?_0x15513d[_0x431e('0x1c')][_0x431e('0x1e')]||null:null})[_0x431e('0xf')](function(_0x41c948){if(_0x41c948){return _0x41c948[_0x431e('0x21')](_0x15513d[_0x431e('0x22')]['ids'],_[_0x431e('0x23')](_0x15513d[_0x431e('0x22')],[_0x431e('0x24'),'id'])||{});}})[_0x431e('0x25')](function(_0x1a5709){logger[_0x431e('0x10')](_0x431e('0x26'),_0x15513d);logger[_0x431e('0x12')](_0x431e('0x26'),_0x15513d,JSON['stringify'](_0x1a5709));_0x155cb1(_0x1a5709);})[_0x431e('0x19')](function(_0x17be37){logger[_0x431e('0x15')](_0x431e('0x26'),_0x17be37[_0x431e('0x18')],_0x15513d);_0x3989ab(_this['error'](0x1f4,_0x17be37['message']));});});}; \ No newline at end of file +var _0xafa7=['limit','catch','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes'];(function(_0x4435c2,_0x3c12f2){var _0x160402=function(_0x45e34b){while(--_0x45e34b){_0x4435c2['push'](_0x4435c2['shift']());}};_0x160402(++_0x3c12f2);}(_0xafa7,0x126));var _0x7afa=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0xafa7[_0xb8cfbe];return _0x227d51;};'use strict';var _=require(_0x7afa('0x0'));var util=require(_0x7afa('0x1'));var moment=require(_0x7afa('0x2'));var BPromise=require(_0x7afa('0x3'));var rs=require(_0x7afa('0x4'));var fs=require('fs');var Redis=require(_0x7afa('0x5'));var db=require(_0x7afa('0x6'))['db'];var utils=require(_0x7afa('0x7'));var logger=require(_0x7afa('0x8'))(_0x7afa('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7afa('0xa')]['http']({'port':0x232a});config[_0x7afa('0xb')]=_['defaults'](config[_0x7afa('0xb')],{'host':_0x7afa('0xc'),'port':0x18eb});var socket=require(_0x7afa('0xd'))(new Redis(config[_0x7afa('0xb')]));require(_0x7afa('0xe'))['register'](socket);function respondWithRpcPromise(_0x454b95,_0x1c3206,_0x58a8ad){return new BPromise(function(_0x5e2530,_0x53fd0a){return client[_0x7afa('0xf')](_0x454b95,_0x58a8ad)[_0x7afa('0x10')](function(_0x6b0ac5){logger[_0x7afa('0x11')](_0x7afa('0x12'),_0x1c3206,'request\x20sent');logger[_0x7afa('0x13')](_0x7afa('0x14'),_0x1c3206,_0x7afa('0x15'),JSON[_0x7afa('0x16')](_0x6b0ac5));if(_0x6b0ac5['error']){if(_0x6b0ac5[_0x7afa('0x17')][_0x7afa('0x18')]===0x1f4){logger[_0x7afa('0x17')](_0x7afa('0x12'),_0x1c3206,_0x6b0ac5[_0x7afa('0x17')]['message']);return _0x53fd0a(_0x6b0ac5[_0x7afa('0x17')][_0x7afa('0x19')]);}logger[_0x7afa('0x17')](_0x7afa('0x12'),_0x1c3206,_0x6b0ac5[_0x7afa('0x17')]['message']);return _0x5e2530(_0x6b0ac5['error'][_0x7afa('0x19')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1c3206,_0x7afa('0x15'));_0x5e2530(_0x6b0ac5[_0x7afa('0x1a')]['message']);}})['catch'](function(_0xb78f14){logger[_0x7afa('0x17')](_0x7afa('0x12'),_0x1c3206,_0xb78f14);_0x53fd0a(_0xb78f14);});});}exports[_0x7afa('0x1b')]=function(_0x2eeb41){var _0x31237e=this;return new Promise(function(_0x1b0ee9,_0x2be454){return db[_0x7afa('0x1c')][_0x7afa('0x1d')](_0x2eeb41[_0x7afa('0x1e')],{'raw':_0x2eeb41[_0x7afa('0x1f')]?_0x2eeb41[_0x7afa('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eeb41['options']?_0x2eeb41[_0x7afa('0x1f')][_0x7afa('0x20')]||null:null,'attributes':_0x2eeb41[_0x7afa('0x1f')]?_0x2eeb41[_0x7afa('0x1f')][_0x7afa('0x21')]||null:null,'limit':_0x2eeb41[_0x7afa('0x1f')]?_0x2eeb41[_0x7afa('0x1f')][_0x7afa('0x22')]||null:null})[_0x7afa('0x10')](function(_0x13e4f5){logger[_0x7afa('0x11')]('UpdateOpenchannelInteraction',_0x2eeb41);logger['debug'](_0x7afa('0x1b'),_0x2eeb41,JSON[_0x7afa('0x16')](_0x13e4f5));_0x1b0ee9(_0x13e4f5);})[_0x7afa('0x23')](function(_0x4eadee){logger['error'](_0x7afa('0x1b'),_0x4eadee[_0x7afa('0x19')],_0x2eeb41);_0x2be454(_0x31237e['error'](0x1f4,_0x4eadee[_0x7afa('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x576f91){return new Promise(function(_0x20ec14,_0x1f5c45){return db[_0x7afa('0x1c')][_0x7afa('0x24')]({'where':_0x576f91[_0x7afa('0x1f')]?_0x576f91[_0x7afa('0x1f')][_0x7afa('0x20')]||null:null})[_0x7afa('0x10')](function(_0x5871ec){if(_0x5871ec){return _0x5871ec['addTags'](_0x576f91[_0x7afa('0x1e')][_0x7afa('0x25')],_[_0x7afa('0x26')](_0x576f91[_0x7afa('0x1e')],[_0x7afa('0x25'),'id'])||{});}})[_0x7afa('0x27')](function(_0x2fcec3){logger['info'](_0x7afa('0x28'),_0x576f91);logger[_0x7afa('0x13')]('AddTags',_0x576f91,JSON['stringify'](_0x2fcec3));_0x20ec14(_0x2fcec3);})[_0x7afa('0x23')](function(_0x2b1a40){logger[_0x7afa('0x17')]('AddTags',_0x2b1a40[_0x7afa('0x19')],_0x576f91);_0x1f5c45(_this['error'](0x1f4,_0x2b1a40[_0x7afa('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7ea4a36..0a6667a 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.socket.js +++ b/server/api/openchannelInteraction/openchannelInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x853e=['./openchannelInteraction.events','save','remove','update','emit','register','openchannelInteraction:'];(function(_0x59aeb3,_0x32f513){var _0x3c6521=function(_0x1129b2){while(--_0x1129b2){_0x59aeb3['push'](_0x59aeb3['shift']());}};_0x3c6521(++_0x32f513);}(_0x853e,0x15e));var _0xe853=function(_0x352299,_0x5298a1){_0x352299=_0x352299-0x0;var _0x309e1e=_0x853e[_0x352299];return _0x309e1e;};'use strict';var OpenchannelInteractionEvents=require(_0xe853('0x0'));var events=[_0xe853('0x1'),_0xe853('0x2'),_0xe853('0x3')];function createListener(_0x29eb62,_0x451595){return function(_0x4c718f){_0x451595[_0xe853('0x4')](_0x29eb62,_0x4c718f);};}function removeListener(_0x208349,_0x3646de){return function(){OpenchannelInteractionEvents['removeListener'](_0x208349,_0x3646de);};}exports[_0xe853('0x5')]=function(_0x554c05){for(var _0x484058=0x0,_0x4ee8aa=events['length'];_0x484058<_0x4ee8aa;_0x484058++){var _0x379966=events[_0x484058];var _0x4302c0=createListener(_0xe853('0x6')+_0x379966,_0x554c05);OpenchannelInteractionEvents['on'](_0x379966,_0x4302c0);}}; \ No newline at end of file +var _0xf237=['openchannelInteraction:','save','remove','update','emit','removeListener','register','length'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf237,0x1d9));var _0x7f23=function(_0x23456d,_0x3a0fbd){_0x23456d=_0x23456d-0x0;var _0x3b9517=_0xf237[_0x23456d];return _0x3b9517;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x7f23('0x0'),_0x7f23('0x1'),_0x7f23('0x2')];function createListener(_0x24e545,_0x3806d9){return function(_0x9a69ef){_0x3806d9[_0x7f23('0x3')](_0x24e545,_0x9a69ef);};}function removeListener(_0x28fc86,_0x1825d0){return function(){OpenchannelInteractionEvents[_0x7f23('0x4')](_0x28fc86,_0x1825d0);};}exports[_0x7f23('0x5')]=function(_0x171675){for(var _0x2c3001=0x0,_0x2bf21c=events[_0x7f23('0x6')];_0x2c3001<_0x2bf21c;_0x2c3001++){var _0x22d4e2=events[_0x2c3001];var _0x166184=createListener(_0x7f23('0x7')+_0x22d4e2,_0x171675);OpenchannelInteractionEvents['on'](_0x22d4e2,_0x166184);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index fcac3ac..1245e89 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x411296,_0x3431d4){var _0x3347f8=function(_0x12bde0){while(--_0x12bde0){_0x411296['push'](_0x411296['shift']());}};_0x3347f8(++_0x3431d4);}(_0xe706,0xa3));var _0x6e70=function(_0x5384ae,_0x32e603){_0x5384ae=_0x5384ae-0x0;var _0x4bcf2d=_0xe706[_0x5384ae];return _0x4bcf2d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x1da46b,_0x109ac4){var _0x3a94ef=function(_0x31a2b4){while(--_0x31a2b4){_0x1da46b['push'](_0x1da46b['shift']());}};_0x3a94ef(++_0x109ac4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xcb91[_0x26b5ff];return _0x58603e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 90b9df1..7588a20 100644 --- a/server/api/openchannelMessage/openchannelMessage.attributes.js +++ b/server/api/openchannelMessage/openchannelMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5fb=['medium','BOOLEAN','out','DATE','STRING','TEXT','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe5fb,0xce));var _0xbe5f=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0xe5fb[_0x2706da];return _0x3ba87e;};'use strict';var Sequelize=require(_0xbe5f('0x0'));module[_0xbe5f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbe5f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbe5f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbe5f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbe5f('0x4')),'defaultValue':_0xbe5f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbe5f('0x5')]},'providerName':{'type':Sequelize[_0xbe5f('0x6')]},'providerResponse':{'type':Sequelize[_0xbe5f('0x7')]}}; \ No newline at end of file +var _0x676c=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x1732a4,_0x596d24){var _0x4687de=function(_0x363e01){while(--_0x363e01){_0x1732a4['push'](_0x1732a4['shift']());}};_0x4687de(++_0x596d24);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc676('0x0'));module[_0xc676('0x1')]={'body':{'type':Sequelize[_0xc676('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc676('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc676('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc676('0x4')]('in',_0xc676('0x5')),'defaultValue':_0xc676('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc676('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc676('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 103e71a..002cfc9 100644 --- a/server/api/openchannelMessage/openchannelMessage.controller.js +++ b/server/api/openchannelMessage/openchannelMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9d9=['reject','rejectmessage','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf9d9,0x182));var _0x9f9d=function(_0x401ec9,_0x77c73f){_0x401ec9=_0x401ec9-0x0;var _0x8ef3a1=_0xf9d9[_0x401ec9];return _0x8ef3a1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9f9d('0x0'));var jsonpatch=require(_0x9f9d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f9d('0x2'));var Mustache=require(_0x9f9d('0x3'));var util=require(_0x9f9d('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x9f9d('0x5'));var ejs=require(_0x9f9d('0x6'));var fs=require('fs');var fs_extra=require(_0x9f9d('0x7'));var _=require('lodash');var squel=require(_0x9f9d('0x8'));var crypto=require(_0x9f9d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9f9d('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9f9d('0xb'));var Redis=require(_0x9f9d('0xc'));var authService=require(_0x9f9d('0xd'));var qs=require(_0x9f9d('0xe'));var as=require(_0x9f9d('0xf'));var hardwareService=require(_0x9f9d('0x10'));var logger=require(_0x9f9d('0x11'))('api');var utils=require(_0x9f9d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9f9d('0x13'));var db=require(_0x9f9d('0x14'))['db'];config[_0x9f9d('0x15')]=_[_0x9f9d('0x16')](config[_0x9f9d('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f9d('0x17'))(new Redis(config[_0x9f9d('0x15')]));require(_0x9f9d('0x18'))[_0x9f9d('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9f9d('0x1a')][_0x9f9d('0x1b')]({'port':0x232c});var client9002=jayson[_0x9f9d('0x1a')][_0x9f9d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x54b6bd,_0x107fe8,_0x746654,_0x3d7902){return new BPromise(function(_0x21d6f3,_0x3203bb){var _0x5613f5=_0x3d7902||client;return _0x5613f5['request'](_0x54b6bd,_0x746654)['then'](function(_0x52d144){logger[_0x9f9d('0x1c')](_0x9f9d('0x1d'),_0x107fe8,_0x9f9d('0x1e'));logger[_0x9f9d('0x1f')](_0x9f9d('0x20'),_0x107fe8,'request\x20sent',JSON[_0x9f9d('0x21')](_0x52d144));if(_0x52d144[_0x9f9d('0x22')]){if(_0x52d144[_0x9f9d('0x22')][_0x9f9d('0x23')]===0x1f4){logger['error'](_0x9f9d('0x1d'),_0x107fe8,_0x52d144[_0x9f9d('0x22')][_0x9f9d('0x24')]);return _0x3203bb(_0x52d144['error']['message']);}logger['error'](_0x9f9d('0x1d'),_0x107fe8,_0x52d144['error'][_0x9f9d('0x24')]);return _0x21d6f3(_0x52d144[_0x9f9d('0x22')][_0x9f9d('0x24')]);}else{logger[_0x9f9d('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x107fe8,_0x9f9d('0x1e'));_0x21d6f3(_0x52d144['result'][_0x9f9d('0x24')]);}})[_0x9f9d('0x25')](function(_0x5119d4){logger[_0x9f9d('0x22')](_0x9f9d('0x1d'),_0x107fe8,_0x5119d4);_0x3203bb(_0x5119d4);});});}function respondWithStatusCode(_0x5cc76c,_0x3fc841){_0x3fc841=_0x3fc841||0xcc;return function(_0x590905){if(_0x590905){return _0x5cc76c[_0x9f9d('0x26')](_0x3fc841);}return _0x5cc76c['status'](_0x3fc841)[_0x9f9d('0x27')]();};}function respondWithResult(_0x15d1ba,_0x2c0d6d){_0x2c0d6d=_0x2c0d6d||0xc8;return function(_0x3e063d){if(_0x3e063d){return _0x15d1ba[_0x9f9d('0x28')](_0x2c0d6d)['json'](_0x3e063d);}};}function respondWithFilteredResult(_0x11b0b0,_0x10d8cd){return function(_0xf3ac74){if(_0xf3ac74){var _0x508089=typeof _0x10d8cd[_0x9f9d('0x29')]===_0x9f9d('0x2a')&&typeof _0x10d8cd[_0x9f9d('0x2b')]==='undefined';var _0x3e55f7=_0xf3ac74['count'];var _0x1514d5=_0x508089?0x0:_0x10d8cd['offset'];var _0x338fab=_0x508089?_0xf3ac74[_0x9f9d('0x2c')]:_0x10d8cd[_0x9f9d('0x29')]+_0x10d8cd[_0x9f9d('0x2b')];var _0x396b39;if(_0x338fab>=_0x3e55f7){_0x338fab=_0x3e55f7;_0x396b39=0xc8;}else{_0x396b39=0xce;}_0x11b0b0[_0x9f9d('0x28')](_0x396b39);return _0x11b0b0[_0x9f9d('0x2d')](_0x9f9d('0x2e'),_0x1514d5+'-'+_0x338fab+'/'+_0x3e55f7)[_0x9f9d('0x2f')](_0xf3ac74);}return null;};}function patchUpdates(_0x3e4119){return function(_0x3e77a1){try{jsonpatch['apply'](_0x3e77a1,_0x3e4119,!![]);}catch(_0x54f791){return BPromise['reject'](_0x54f791);}return _0x3e77a1['save']();};}function saveUpdates(_0x2cd199,_0xa6cffa){return function(_0x3a1fa0){if(_0x3a1fa0){return _0x3a1fa0[_0x9f9d('0x30')](_0x2cd199)[_0x9f9d('0x31')](function(_0x5635d3){return _0x5635d3;});}return null;};}function removeEntity(_0x241de7,_0x207ca4){return function(_0x2580ec){if(_0x2580ec){return _0x2580ec['destroy']()[_0x9f9d('0x31')](function(){_0x241de7[_0x9f9d('0x28')](0xcc)[_0x9f9d('0x27')]();});}};}function handleEntityNotFound(_0x2345d5,_0x2bce19){return function(_0xb4a2fa){if(!_0xb4a2fa){_0x2345d5['sendStatus'](0x194);}return _0xb4a2fa;};}function handleError(_0x3f35db,_0x3d57ed){_0x3d57ed=_0x3d57ed||0x1f4;return function(_0x38fc1a){logger['error'](_0x38fc1a['stack']);if(_0x38fc1a[_0x9f9d('0x32')]){delete _0x38fc1a[_0x9f9d('0x32')];}_0x3f35db[_0x9f9d('0x28')](_0x3d57ed)[_0x9f9d('0x33')](_0x38fc1a);};}exports[_0x9f9d('0x34')]=function(_0xd381e4,_0x3b6b87){var _0x35a485={},_0x271c05={},_0xda30cf={'count':0x0,'rows':[]};var _0x442343=_[_0x9f9d('0x35')](db['OpenchannelMessage']['rawAttributes'],function(_0x1c6f17){return{'name':_0x1c6f17[_0x9f9d('0x36')],'type':_0x1c6f17[_0x9f9d('0x37')][_0x9f9d('0x38')]};});_0x271c05[_0x9f9d('0x39')]=_[_0x9f9d('0x35')](_0x442343,_0x9f9d('0x32'));_0x271c05[_0x9f9d('0x3a')]=_[_0x9f9d('0x3b')](_0xd381e4[_0x9f9d('0x3a')]);_0x271c05[_0x9f9d('0x3c')]=_[_0x9f9d('0x3d')](_0x271c05[_0x9f9d('0x39')],_0x271c05[_0x9f9d('0x3a')]);_0x35a485[_0x9f9d('0x3e')]=_[_0x9f9d('0x3d')](_0x271c05[_0x9f9d('0x39')],qs[_0x9f9d('0x3f')](_0xd381e4[_0x9f9d('0x3a')]['fields']));_0x35a485['attributes']=_0x35a485[_0x9f9d('0x3e')][_0x9f9d('0x40')]?_0x35a485[_0x9f9d('0x3e')]:_0x271c05[_0x9f9d('0x39')];if(!_0xd381e4[_0x9f9d('0x3a')][_0x9f9d('0x41')](_0x9f9d('0x42'))){_0x35a485[_0x9f9d('0x2b')]=qs[_0x9f9d('0x2b')](_0xd381e4[_0x9f9d('0x3a')][_0x9f9d('0x2b')]);_0x35a485[_0x9f9d('0x29')]=qs['offset'](_0xd381e4[_0x9f9d('0x3a')][_0x9f9d('0x29')]);}_0x35a485[_0x9f9d('0x43')]=qs[_0x9f9d('0x44')](_0xd381e4[_0x9f9d('0x3a')]['sort']);_0x35a485['where']=qs[_0x9f9d('0x3c')](_[_0x9f9d('0x45')](_0xd381e4[_0x9f9d('0x3a')],_0x271c05['filters']),_0x442343);if(_0xd381e4[_0x9f9d('0x3a')]['filter']){_0x35a485[_0x9f9d('0x46')]=_[_0x9f9d('0x47')](_0x35a485['where'],{'$or':_[_0x9f9d('0x35')](_0x442343,function(_0x2963a0){if(_0x2963a0[_0x9f9d('0x37')]!==_0x9f9d('0x48')){var _0x1bdf0a={};_0x1bdf0a[_0x2963a0[_0x9f9d('0x32')]]={'$like':'%'+_0xd381e4[_0x9f9d('0x3a')][_0x9f9d('0x49')]+'%'};return _0x1bdf0a;}})});}_0x35a485=_['merge']({},_0x35a485,_0xd381e4[_0x9f9d('0x4a')]);var _0x409acd={'where':_0x35a485['where']};return db[_0x9f9d('0x4b')][_0x9f9d('0x2c')](_0x409acd)[_0x9f9d('0x31')](function(_0xe770d5){_0xda30cf[_0x9f9d('0x2c')]=_0xe770d5;if(_0xd381e4[_0x9f9d('0x3a')][_0x9f9d('0x4c')]){_0x35a485[_0x9f9d('0x4d')]=[{'all':!![]}];}return db[_0x9f9d('0x4b')][_0x9f9d('0x4e')](_0x35a485);})['then'](function(_0x47d60b){_0xda30cf[_0x9f9d('0x4f')]=_0x47d60b;return _0xda30cf;})[_0x9f9d('0x31')](respondWithFilteredResult(_0x3b6b87,_0x35a485))[_0x9f9d('0x25')](handleError(_0x3b6b87,null));};exports[_0x9f9d('0x50')]=function(_0x4a8299,_0x17762e){var _0x303e47={'raw':!![],'where':{'id':_0x4a8299[_0x9f9d('0x51')]['id']}},_0x5ed5fb={};_0x5ed5fb[_0x9f9d('0x39')]=_[_0x9f9d('0x3b')](db[_0x9f9d('0x4b')][_0x9f9d('0x52')]);_0x5ed5fb[_0x9f9d('0x3a')]=_['keys'](_0x4a8299[_0x9f9d('0x3a')]);_0x5ed5fb[_0x9f9d('0x3c')]=_[_0x9f9d('0x3d')](_0x5ed5fb['model'],_0x5ed5fb['query']);_0x303e47[_0x9f9d('0x3e')]=_[_0x9f9d('0x3d')](_0x5ed5fb['model'],qs[_0x9f9d('0x3f')](_0x4a8299['query'][_0x9f9d('0x3f')]));_0x303e47[_0x9f9d('0x3e')]=_0x303e47['attributes'][_0x9f9d('0x40')]?_0x303e47[_0x9f9d('0x3e')]:_0x5ed5fb[_0x9f9d('0x39')];if(_0x4a8299[_0x9f9d('0x3a')][_0x9f9d('0x4c')]){_0x303e47[_0x9f9d('0x4d')]=[{'all':!![]}];}_0x303e47=_[_0x9f9d('0x47')]({},_0x303e47,_0x4a8299[_0x9f9d('0x4a')]);return db['OpenchannelMessage'][_0x9f9d('0x53')](_0x303e47)[_0x9f9d('0x31')](handleEntityNotFound(_0x17762e,null))['then'](respondWithResult(_0x17762e,null))[_0x9f9d('0x25')](handleError(_0x17762e,null));};exports[_0x9f9d('0x54')]=function(_0x50b186,_0x3bf7de){return db[_0x9f9d('0x4b')][_0x9f9d('0x54')](_0x50b186[_0x9f9d('0x55')],{})[_0x9f9d('0x31')](respondWithResult(_0x3bf7de,0xc9))[_0x9f9d('0x25')](handleError(_0x3bf7de,null));};exports[_0x9f9d('0x30')]=function(_0x876440,_0x3be5a3){if(_0x876440['body']['id']){delete _0x876440[_0x9f9d('0x55')]['id'];}return db[_0x9f9d('0x4b')][_0x9f9d('0x53')]({'where':{'id':_0x876440['params']['id']}})[_0x9f9d('0x31')](handleEntityNotFound(_0x3be5a3,null))[_0x9f9d('0x31')](saveUpdates(_0x876440[_0x9f9d('0x55')],null))[_0x9f9d('0x31')](respondWithResult(_0x3be5a3,null))[_0x9f9d('0x25')](handleError(_0x3be5a3,null));};exports['destroy']=function(_0x520769,_0x197385){return db[_0x9f9d('0x4b')]['find']({'where':{'id':_0x520769[_0x9f9d('0x51')]['id']}})[_0x9f9d('0x31')](handleEntityNotFound(_0x197385,null))['then'](removeEntity(_0x197385,null))[_0x9f9d('0x25')](handleError(_0x197385,null));};exports[_0x9f9d('0x56')]=function(_0x515649,_0x442ca3){return db['OpenchannelMessage'][_0x9f9d('0x56')]()[_0x9f9d('0x31')](respondWithResult(_0x442ca3,null))[_0x9f9d('0x25')](handleError(_0x442ca3,null));};var interaction_log=require(_0x9f9d('0x11'))(_0x9f9d('0x57'));exports['accept']=function(_0x5a2c1c,_0x267d9a,_0x41a329){var _0x55f6b9={'agent':{},'channel':_0x9f9d('0x58')};if(_0x5a2c1c[_0x9f9d('0x55')]['id']){delete _0x5a2c1c[_0x9f9d('0x55')]['id'];}_0x5a2c1c['body'][_0x9f9d('0x59')]=!![];_0x5a2c1c[_0x9f9d('0x55')][_0x9f9d('0x5a')]=moment()[_0x9f9d('0x5b')](_0x9f9d('0x5c'));_0x5a2c1c['body'][_0x9f9d('0x5d')]=_0x5a2c1c['body'][_0x9f9d('0x5d')]||_0x5a2c1c[_0x9f9d('0x5e')]['id'];_0x55f6b9[_0x9f9d('0x5f')]['id']=_0x5a2c1c[_0x9f9d('0x55')]['UserId'];return db['OpenchannelMessage'][_0x9f9d('0x53')]({'where':{'id':_0x5a2c1c[_0x9f9d('0x51')]['id'],'UserId':null}})[_0x9f9d('0x31')](handleEntityNotFound(_0x267d9a,null))[_0x9f9d('0x31')](saveUpdates(_0x5a2c1c[_0x9f9d('0x55')],null))[_0x9f9d('0x31')](function(_0x502ea7){if(_0x502ea7){_0x55f6b9[_0x9f9d('0x24')]=_0x502ea7['get']({'plain':!![]});return db[_0x9f9d('0x60')][_0x9f9d('0x53')]({'where':{'id':_0x502ea7[_0x9f9d('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x267d9a,null))[_0x9f9d('0x31')](function(_0x352990){if(_0x352990){return _0x352990['update']({'UserId':_0x5a2c1c[_0x9f9d('0x55')][_0x9f9d('0x5d')],'read1stAt':_[_0x9f9d('0x62')](_0x352990[_0x9f9d('0x63')])?moment()[_0x9f9d('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x19ebc5){if(_0x19ebc5){_0x55f6b9[_0x9f9d('0x64')]=_0x19ebc5[_0x9f9d('0x65')]({'plain':!![]});interaction_log[_0x9f9d('0x1c')](_0x9f9d('0x66'),_0x5a2c1c[_0x9f9d('0x5e')]['id'],_0x5a2c1c[_0x9f9d('0x5e')]['name'],_0x5a2c1c[_0x9f9d('0x5e')][_0x9f9d('0x67')],_0x55f6b9['interaction']['id'],_0x5a2c1c['body']?JSON[_0x9f9d('0x21')](_0x5a2c1c[_0x9f9d('0x55')]):'null');return respondWithRpcPromise(_0x9f9d('0x68'),_0x9f9d('0x69'),_0x55f6b9);}return null;})[_0x9f9d('0x31')](function(_0x3984cc){var _0x2e6dba=_0x9f9d('0x6a')+_0x3984cc[_0x9f9d('0x24')][_0x9f9d('0x6b')];return db[_0x9f9d('0x6c')][_0x9f9d('0x3a')](_0x2e6dba,{'type':db[_0x9f9d('0x6d')]['QueryTypes'][_0x9f9d('0x6e')],'raw':!![]})['then'](function(_0xa160e2){return _0xa160e2;});})[_0x9f9d('0x31')](function(_0x23bd08){if(_0x23bd08){_0x55f6b9[_0x9f9d('0x24')][_0x9f9d('0x6f')]=_0x23bd08[0x0];if(!_0x5a2c1c[_0x9f9d('0x55')][_0x9f9d('0x5d')])return;return db[_0x9f9d('0x70')][_0x9f9d('0x53')]({'where':{'id':_0x5a2c1c[_0x9f9d('0x55')][_0x9f9d('0x5d')],'role':'agent'},'attributes':['id',_0x9f9d('0x32'),_0x9f9d('0x71'),_0x9f9d('0x72'),_0x9f9d('0x73')],'raw':!![]});}return null;})[_0x9f9d('0x31')](function(_0x4a7f66){if(!_0x4a7f66)return null;_0x55f6b9[_0x9f9d('0x24')][_0x9f9d('0x5f')]=_0x4a7f66;return _0x55f6b9;})[_0x9f9d('0x31')](function(_0x3eff04){if(_0x3eff04){if(_0x5a2c1c['body'][_0x9f9d('0x74')]){_0x55f6b9[_0x9f9d('0x24')][_0x9f9d('0x75')]=util[_0x9f9d('0x5b')](_0x9f9d('0x76'),_0x5a2c1c[_0x9f9d('0x5e')]['name']);_0x55f6b9['message'][_0x9f9d('0x77')]=_0x55f6b9[_0x9f9d('0x77')];_0x55f6b9[_0x9f9d('0x24')][_0x9f9d('0x78')]=_0x55f6b9[_0x9f9d('0x77')];_0x55f6b9[_0x9f9d('0x24')]['event']=_0x9f9d('0x79');return respondWithRpcPromise(_0x9f9d('0x7a'),_0x9f9d('0x7a'),{'event':'acceptmessage','message':_0x55f6b9[_0x9f9d('0x24')]},client9002)[_0x9f9d('0x31')](function(){return _0x55f6b9;});}return _0x55f6b9;}return null;})['then'](respondWithResult(_0x267d9a,null))[_0x9f9d('0x25')](handleError(_0x267d9a,null));};var interaction_log=require(_0x9f9d('0x11'))('openchannel-interactions');exports['reject']=function(_0x4d4a6e,_0x48de36,_0x1d66a8){var _0x41c229={'agent':{},'channel':_0x9f9d('0x58')};if(_0x4d4a6e[_0x9f9d('0x55')]['id']){delete _0x4d4a6e['body']['id'];}_0x4d4a6e[_0x9f9d('0x55')][_0x9f9d('0x5d')]=_0x4d4a6e[_0x9f9d('0x55')][_0x9f9d('0x5d')]||_0x4d4a6e[_0x9f9d('0x5e')]['id'];_0x41c229['agent']['id']=_0x4d4a6e[_0x9f9d('0x55')]['UserId'];return db[_0x9f9d('0x4b')][_0x9f9d('0x53')]({'where':{'id':_0x4d4a6e[_0x9f9d('0x51')]['id'],'UserId':null}})[_0x9f9d('0x31')](handleEntityNotFound(_0x48de36,null))['then'](function(_0x51ebc1){if(_0x51ebc1){_0x41c229[_0x9f9d('0x24')]=_0x51ebc1['get']({'plain':!![]});return db[_0x9f9d('0x60')][_0x9f9d('0x53')]({'where':{'id':_0x51ebc1[_0x9f9d('0x61')]}});}return null;})[_0x9f9d('0x31')](handleEntityNotFound(_0x48de36,null))['then'](function(_0x20d54a){if(_0x20d54a){_0x41c229['interaction']=_0x20d54a[_0x9f9d('0x65')]({'plain':!![]});interaction_log['info'](_0x9f9d('0x7b'),_0x4d4a6e[_0x9f9d('0x5e')]['id'],_0x4d4a6e[_0x9f9d('0x5e')][_0x9f9d('0x32')],_0x4d4a6e[_0x9f9d('0x5e')][_0x9f9d('0x67')],_0x41c229[_0x9f9d('0x64')]['id'],_0x4d4a6e[_0x9f9d('0x55')]?JSON[_0x9f9d('0x21')](_0x4d4a6e[_0x9f9d('0x55')]):'null');return respondWithRpcPromise(_0x9f9d('0x7c'),_0x9f9d('0x7d'),_0x41c229);}return null;})[_0x9f9d('0x31')](function(_0x2a3569){var _0x12a095=_0x9f9d('0x6a')+_0x2a3569[_0x9f9d('0x24')][_0x9f9d('0x6b')];return db[_0x9f9d('0x6c')][_0x9f9d('0x3a')](_0x12a095,{'type':db[_0x9f9d('0x6d')]['QueryTypes'][_0x9f9d('0x6e')],'raw':!![]})['then'](function(_0x4806a3){return _0x4806a3;});})[_0x9f9d('0x31')](function(_0x53e9f6){if(_0x53e9f6){_0x41c229['message'][_0x9f9d('0x6f')]=_0x53e9f6[0x0];if(!_0x4d4a6e[_0x9f9d('0x55')]['UserId'])return;return db[_0x9f9d('0x70')]['find']({'where':{'id':_0x4d4a6e[_0x9f9d('0x55')]['UserId'],'role':_0x9f9d('0x5f')},'attributes':['id',_0x9f9d('0x32'),_0x9f9d('0x71'),_0x9f9d('0x72'),_0x9f9d('0x73')],'raw':!![]});}return null;})[_0x9f9d('0x31')](function(_0x424a6a){if(!_0x424a6a)return null;_0x41c229[_0x9f9d('0x24')][_0x9f9d('0x5f')]=_0x424a6a;return _0x41c229;})[_0x9f9d('0x31')](function(_0x10ceb0){if(_0x10ceb0){_0x10ceb0[_0x9f9d('0x24')][_0x9f9d('0x75')]=util[_0x9f9d('0x5b')](_0x9f9d('0x76'),_0x4d4a6e[_0x9f9d('0x5e')][_0x9f9d('0x32')]);_0x10ceb0['message'][_0x9f9d('0x77')]=_0x41c229[_0x9f9d('0x77')];_0x10ceb0[_0x9f9d('0x24')]['motionChannel']=_0x41c229[_0x9f9d('0x77')];_0x10ceb0[_0x9f9d('0x24')]['event']=_0x9f9d('0x7e');respondWithRpcPromise(_0x9f9d('0x7a'),_0x9f9d('0x7a'),{'event':_0x9f9d('0x7f'),'message':_0x10ceb0[_0x9f9d('0x24')]},client9002);return _0x41c229;}return null;})[_0x9f9d('0x31')](respondWithResult(_0x48de36,null))['catch'](handleError(_0x48de36,null));}; \ No newline at end of file +var _0x1bc3=['fullname','manual','interface','channel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','sequelize','SELECT','internal','SIP/%s','rejectmessage','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','length','sort','where','filter','merge','type','VIRTUAL','options','OpenchannelMessage','count','includeAll','findAll','rows','show','params','fields','find','create','body','update','describe','openchannel-interactions','accept','openchannel','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','format','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','Sequelize','QueryTypes','contact','User'];(function(_0x2a0c5c,_0x2cf076){var _0x3cc675=function(_0x4f6779){while(--_0x4f6779){_0x2a0c5c['push'](_0x2a0c5c['shift']());}};_0x3cc675(++_0x2cf076);}(_0x1bc3,0x8d));var _0x31bc=function(_0x4536e8,_0x51ce7a){_0x4536e8=_0x4536e8-0x0;var _0x59a52f=_0x1bc3[_0x4536e8];return _0x59a52f;};'use strict';var emlformat=require(_0x31bc('0x0'));var rimraf=require(_0x31bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31bc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x31bc('0x3'));var Mustache=require(_0x31bc('0x4'));var util=require(_0x31bc('0x5'));var path=require(_0x31bc('0x6'));var sox=require(_0x31bc('0x7'));var csv=require(_0x31bc('0x8'));var ejs=require(_0x31bc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31bc('0xa'));var squel=require(_0x31bc('0xb'));var crypto=require(_0x31bc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x31bc('0xd'));var toCsv=require(_0x31bc('0x8'));var querystring=require(_0x31bc('0xe'));var Papa=require(_0x31bc('0xf'));var Redis=require('ioredis');var authService=require(_0x31bc('0x10'));var qs=require(_0x31bc('0x11'));var as=require(_0x31bc('0x12'));var hardwareService=require(_0x31bc('0x13'));var logger=require(_0x31bc('0x14'))(_0x31bc('0x15'));var utils=require(_0x31bc('0x16'));var config=require(_0x31bc('0x17'));var licenseUtil=require(_0x31bc('0x18'));var db=require(_0x31bc('0x19'))['db'];config[_0x31bc('0x1a')]=_[_0x31bc('0x1b')](config[_0x31bc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x31bc('0x1c'))(new Redis(config[_0x31bc('0x1a')]));require(_0x31bc('0x1d'))['register'](socket);var jayson=require(_0x31bc('0x1e'));var client=jayson['client'][_0x31bc('0x1f')]({'port':0x232c});var client9002=jayson[_0x31bc('0x20')][_0x31bc('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2cc21b,_0x2bc0da,_0x3e4df7,_0x5b438a){return new BPromise(function(_0x12bf57,_0x2c47b5){var _0x1fedbc=_0x5b438a||client;return _0x1fedbc['request'](_0x2cc21b,_0x3e4df7)[_0x31bc('0x21')](function(_0x4d7603){logger[_0x31bc('0x22')](_0x31bc('0x23'),_0x2bc0da,_0x31bc('0x24'));logger[_0x31bc('0x25')](_0x31bc('0x26'),_0x2bc0da,_0x31bc('0x24'),JSON[_0x31bc('0x27')](_0x4d7603));if(_0x4d7603['error']){if(_0x4d7603[_0x31bc('0x28')]['code']===0x1f4){logger['error'](_0x31bc('0x23'),_0x2bc0da,_0x4d7603['error']['message']);return _0x2c47b5(_0x4d7603[_0x31bc('0x28')][_0x31bc('0x29')]);}logger['error'](_0x31bc('0x23'),_0x2bc0da,_0x4d7603[_0x31bc('0x28')][_0x31bc('0x29')]);return _0x12bf57(_0x4d7603[_0x31bc('0x28')][_0x31bc('0x29')]);}else{logger[_0x31bc('0x22')](_0x31bc('0x23'),_0x2bc0da,'request\x20sent');_0x12bf57(_0x4d7603[_0x31bc('0x2a')]['message']);}})[_0x31bc('0x2b')](function(_0x4c64e1){logger[_0x31bc('0x28')](_0x31bc('0x23'),_0x2bc0da,_0x4c64e1);_0x2c47b5(_0x4c64e1);});});}function respondWithStatusCode(_0x5141aa,_0x27f519){_0x27f519=_0x27f519||0xcc;return function(_0xe4b21f){if(_0xe4b21f){return _0x5141aa[_0x31bc('0x2c')](_0x27f519);}return _0x5141aa[_0x31bc('0x2d')](_0x27f519)[_0x31bc('0x2e')]();};}function respondWithResult(_0x148a48,_0x532410){_0x532410=_0x532410||0xc8;return function(_0x280652){if(_0x280652){return _0x148a48[_0x31bc('0x2d')](_0x532410)[_0x31bc('0x2f')](_0x280652);}};}function respondWithFilteredResult(_0x3c8b40,_0x136c5b){return function(_0x5cc57c){if(_0x5cc57c){var _0x9e31f5=typeof _0x136c5b['offset']===_0x31bc('0x30')&&typeof _0x136c5b[_0x31bc('0x31')]==='undefined';var _0x33f963=_0x5cc57c['count'];var _0x2bb539=_0x9e31f5?0x0:_0x136c5b[_0x31bc('0x32')];var _0x4e9c78=_0x9e31f5?_0x5cc57c['count']:_0x136c5b[_0x31bc('0x32')]+_0x136c5b[_0x31bc('0x31')];var _0x250bc9;if(_0x4e9c78>=_0x33f963){_0x4e9c78=_0x33f963;_0x250bc9=0xc8;}else{_0x250bc9=0xce;}_0x3c8b40['status'](_0x250bc9);return _0x3c8b40[_0x31bc('0x33')](_0x31bc('0x34'),_0x2bb539+'-'+_0x4e9c78+'/'+_0x33f963)[_0x31bc('0x2f')](_0x5cc57c);}return null;};}function patchUpdates(_0x35fe6c){return function(_0x523f1c){try{jsonpatch[_0x31bc('0x35')](_0x523f1c,_0x35fe6c,!![]);}catch(_0x31586c){return BPromise[_0x31bc('0x36')](_0x31586c);}return _0x523f1c[_0x31bc('0x37')]();};}function saveUpdates(_0x37ba17,_0x1df46f){return function(_0x266fb7){if(_0x266fb7){return _0x266fb7['update'](_0x37ba17)[_0x31bc('0x21')](function(_0x3816da){return _0x3816da;});}return null;};}function removeEntity(_0x2359da,_0x2744c0){return function(_0x9247d8){if(_0x9247d8){return _0x9247d8['destroy']()['then'](function(){_0x2359da[_0x31bc('0x2d')](0xcc)[_0x31bc('0x2e')]();});}};}function handleEntityNotFound(_0x5162bf,_0x4353c2){return function(_0x478f5c){if(!_0x478f5c){_0x5162bf['sendStatus'](0x194);}return _0x478f5c;};}function handleError(_0x14e402,_0x5b2728){_0x5b2728=_0x5b2728||0x1f4;return function(_0x4e4d5e){logger[_0x31bc('0x28')](_0x4e4d5e[_0x31bc('0x38')]);if(_0x4e4d5e[_0x31bc('0x39')]){delete _0x4e4d5e[_0x31bc('0x39')];}_0x14e402['status'](_0x5b2728)[_0x31bc('0x3a')](_0x4e4d5e);};}exports[_0x31bc('0x3b')]=function(_0x51383a,_0x6f423){var _0x465fba={},_0x4cbc39={},_0x2df7f9={'count':0x0,'rows':[]};var _0x18f613=_['map'](db['OpenchannelMessage'][_0x31bc('0x3c')],function(_0x20df36){return{'name':_0x20df36[_0x31bc('0x3d')],'type':_0x20df36['type']['key']};});_0x4cbc39[_0x31bc('0x3e')]=_[_0x31bc('0x3f')](_0x18f613,_0x31bc('0x39'));_0x4cbc39[_0x31bc('0x40')]=_[_0x31bc('0x41')](_0x51383a[_0x31bc('0x40')]);_0x4cbc39[_0x31bc('0x42')]=_[_0x31bc('0x43')](_0x4cbc39[_0x31bc('0x3e')],_0x4cbc39[_0x31bc('0x40')]);_0x465fba[_0x31bc('0x44')]=_[_0x31bc('0x43')](_0x4cbc39[_0x31bc('0x3e')],qs['fields'](_0x51383a['query']['fields']));_0x465fba[_0x31bc('0x44')]=_0x465fba['attributes'][_0x31bc('0x45')]?_0x465fba[_0x31bc('0x44')]:_0x4cbc39[_0x31bc('0x3e')];if(!_0x51383a[_0x31bc('0x40')]['hasOwnProperty']('nolimit')){_0x465fba[_0x31bc('0x31')]=qs[_0x31bc('0x31')](_0x51383a[_0x31bc('0x40')][_0x31bc('0x31')]);_0x465fba['offset']=qs[_0x31bc('0x32')](_0x51383a[_0x31bc('0x40')][_0x31bc('0x32')]);}_0x465fba['order']=qs[_0x31bc('0x46')](_0x51383a[_0x31bc('0x40')]['sort']);_0x465fba[_0x31bc('0x47')]=qs[_0x31bc('0x42')](_['pick'](_0x51383a['query'],_0x4cbc39[_0x31bc('0x42')]),_0x18f613);if(_0x51383a['query'][_0x31bc('0x48')]){_0x465fba[_0x31bc('0x47')]=_[_0x31bc('0x49')](_0x465fba['where'],{'$or':_['map'](_0x18f613,function(_0x25e4fa){if(_0x25e4fa[_0x31bc('0x4a')]!==_0x31bc('0x4b')){var _0x533cfa={};_0x533cfa[_0x25e4fa[_0x31bc('0x39')]]={'$like':'%'+_0x51383a[_0x31bc('0x40')]['filter']+'%'};return _0x533cfa;}})});}_0x465fba=_[_0x31bc('0x49')]({},_0x465fba,_0x51383a[_0x31bc('0x4c')]);var _0x568b8b={'where':_0x465fba[_0x31bc('0x47')]};return db[_0x31bc('0x4d')][_0x31bc('0x4e')](_0x568b8b)['then'](function(_0x47734d){_0x2df7f9[_0x31bc('0x4e')]=_0x47734d;if(_0x51383a[_0x31bc('0x40')][_0x31bc('0x4f')]){_0x465fba['include']=[{'all':!![]}];}return db[_0x31bc('0x4d')][_0x31bc('0x50')](_0x465fba);})[_0x31bc('0x21')](function(_0x408077){_0x2df7f9[_0x31bc('0x51')]=_0x408077;return _0x2df7f9;})['then'](respondWithFilteredResult(_0x6f423,_0x465fba))['catch'](handleError(_0x6f423,null));};exports[_0x31bc('0x52')]=function(_0x2f9359,_0x234f19){var _0xc991fd={'raw':!![],'where':{'id':_0x2f9359[_0x31bc('0x53')]['id']}},_0x395a7c={};_0x395a7c[_0x31bc('0x3e')]=_[_0x31bc('0x41')](db[_0x31bc('0x4d')]['rawAttributes']);_0x395a7c['query']=_['keys'](_0x2f9359[_0x31bc('0x40')]);_0x395a7c[_0x31bc('0x42')]=_[_0x31bc('0x43')](_0x395a7c[_0x31bc('0x3e')],_0x395a7c[_0x31bc('0x40')]);_0xc991fd[_0x31bc('0x44')]=_[_0x31bc('0x43')](_0x395a7c[_0x31bc('0x3e')],qs[_0x31bc('0x54')](_0x2f9359[_0x31bc('0x40')]['fields']));_0xc991fd['attributes']=_0xc991fd['attributes'][_0x31bc('0x45')]?_0xc991fd[_0x31bc('0x44')]:_0x395a7c[_0x31bc('0x3e')];if(_0x2f9359[_0x31bc('0x40')]['includeAll']){_0xc991fd['include']=[{'all':!![]}];}_0xc991fd=_[_0x31bc('0x49')]({},_0xc991fd,_0x2f9359['options']);return db[_0x31bc('0x4d')][_0x31bc('0x55')](_0xc991fd)[_0x31bc('0x21')](handleEntityNotFound(_0x234f19,null))[_0x31bc('0x21')](respondWithResult(_0x234f19,null))['catch'](handleError(_0x234f19,null));};exports['create']=function(_0x3e2d31,_0x4a9d12){return db[_0x31bc('0x4d')][_0x31bc('0x56')](_0x3e2d31[_0x31bc('0x57')],{})['then'](respondWithResult(_0x4a9d12,0xc9))[_0x31bc('0x2b')](handleError(_0x4a9d12,null));};exports[_0x31bc('0x58')]=function(_0x5f188b,_0xfb9646){if(_0x5f188b[_0x31bc('0x57')]['id']){delete _0x5f188b[_0x31bc('0x57')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x5f188b['params']['id']}})[_0x31bc('0x21')](handleEntityNotFound(_0xfb9646,null))['then'](saveUpdates(_0x5f188b[_0x31bc('0x57')],null))[_0x31bc('0x21')](respondWithResult(_0xfb9646,null))['catch'](handleError(_0xfb9646,null));};exports['destroy']=function(_0x6ec8fb,_0x29e70f){return db[_0x31bc('0x4d')][_0x31bc('0x55')]({'where':{'id':_0x6ec8fb[_0x31bc('0x53')]['id']}})[_0x31bc('0x21')](handleEntityNotFound(_0x29e70f,null))[_0x31bc('0x21')](removeEntity(_0x29e70f,null))[_0x31bc('0x2b')](handleError(_0x29e70f,null));};exports[_0x31bc('0x59')]=function(_0x28b548,_0x1db1a8){return db['OpenchannelMessage']['describe']()[_0x31bc('0x21')](respondWithResult(_0x1db1a8,null))[_0x31bc('0x2b')](handleError(_0x1db1a8,null));};var interaction_log=require(_0x31bc('0x14'))(_0x31bc('0x5a'));exports[_0x31bc('0x5b')]=function(_0x5c848c,_0x1281bb,_0x16a5f6){var _0xc9d97b={'agent':{},'channel':_0x31bc('0x5c')};if(_0x5c848c[_0x31bc('0x57')]['id']){delete _0x5c848c[_0x31bc('0x57')]['id'];}_0x5c848c['body'][_0x31bc('0x5d')]=!![];_0x5c848c[_0x31bc('0x57')]['readAt']=moment()['format'](_0x31bc('0x5e'));_0x5c848c[_0x31bc('0x57')][_0x31bc('0x5f')]=_0x5c848c['body'][_0x31bc('0x5f')]||_0x5c848c[_0x31bc('0x60')]['id'];_0xc9d97b[_0x31bc('0x61')]['id']=_0x5c848c[_0x31bc('0x57')][_0x31bc('0x5f')];return db[_0x31bc('0x4d')][_0x31bc('0x55')]({'where':{'id':_0x5c848c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1281bb,null))[_0x31bc('0x21')](saveUpdates(_0x5c848c[_0x31bc('0x57')],null))[_0x31bc('0x21')](function(_0x250cb5){if(_0x250cb5){_0xc9d97b[_0x31bc('0x29')]=_0x250cb5['get']({'plain':!![]});return db[_0x31bc('0x62')][_0x31bc('0x55')]({'where':{'id':_0x250cb5[_0x31bc('0x63')]}});}return null;})[_0x31bc('0x21')](handleEntityNotFound(_0x1281bb,null))[_0x31bc('0x21')](function(_0x2618f2){if(_0x2618f2){return _0x2618f2[_0x31bc('0x58')]({'UserId':_0x5c848c[_0x31bc('0x57')][_0x31bc('0x5f')],'read1stAt':_[_0x31bc('0x64')](_0x2618f2['read1stAt'])?moment()[_0x31bc('0x65')](_0x31bc('0x5e')):undefined});}return null;})[_0x31bc('0x21')](function(_0x59d540){if(_0x59d540){_0xc9d97b[_0x31bc('0x66')]=_0x59d540[_0x31bc('0x67')]({'plain':!![]});interaction_log[_0x31bc('0x22')](_0x31bc('0x68'),_0x5c848c[_0x31bc('0x60')]['id'],_0x5c848c['user'][_0x31bc('0x39')],_0x5c848c['user']['role'],_0xc9d97b['interaction']['id'],_0x5c848c[_0x31bc('0x57')]?JSON[_0x31bc('0x27')](_0x5c848c[_0x31bc('0x57')]):_0x31bc('0x69'));return respondWithRpcPromise('AcceptMessage',_0x31bc('0x6a'),_0xc9d97b);}return null;})['then'](function(_0x28c1ad){var _0x306bbe='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x28c1ad['message']['ContactId'];return db['sequelize']['query'](_0x306bbe,{'type':db[_0x31bc('0x6b')][_0x31bc('0x6c')]['SELECT'],'raw':!![]})[_0x31bc('0x21')](function(_0x4c59fa){return _0x4c59fa;});})['then'](function(_0x6cd037){if(_0x6cd037){_0xc9d97b['message'][_0x31bc('0x6d')]=_0x6cd037[0x0];if(!_0x5c848c['body'][_0x31bc('0x5f')])return;return db[_0x31bc('0x6e')][_0x31bc('0x55')]({'where':{'id':_0x5c848c[_0x31bc('0x57')]['UserId'],'role':_0x31bc('0x61')},'attributes':['id',_0x31bc('0x39'),_0x31bc('0x6f'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x26ca29){if(!_0x26ca29)return null;_0xc9d97b['message'][_0x31bc('0x61')]=_0x26ca29;return _0xc9d97b;})[_0x31bc('0x21')](function(_0x23ef99){if(_0x23ef99){if(_0x5c848c[_0x31bc('0x57')][_0x31bc('0x70')]){_0xc9d97b[_0x31bc('0x29')][_0x31bc('0x71')]=util['format']('SIP/%s',_0x5c848c[_0x31bc('0x60')][_0x31bc('0x39')]);_0xc9d97b[_0x31bc('0x29')][_0x31bc('0x72')]=_0xc9d97b['channel'];_0xc9d97b[_0x31bc('0x29')]['motionChannel']=_0xc9d97b[_0x31bc('0x72')];_0xc9d97b[_0x31bc('0x29')][_0x31bc('0x73')]=_0x31bc('0x5b');return respondWithRpcPromise(_0x31bc('0x74'),_0x31bc('0x74'),{'event':_0x31bc('0x75'),'message':_0xc9d97b[_0x31bc('0x29')]},client9002)[_0x31bc('0x21')](function(){return _0xc9d97b;});}return _0xc9d97b;}return null;})[_0x31bc('0x21')](respondWithResult(_0x1281bb,null))[_0x31bc('0x2b')](handleError(_0x1281bb,null));};var interaction_log=require('../../config/logger')(_0x31bc('0x5a'));exports[_0x31bc('0x36')]=function(_0x4788a6,_0x494af4,_0x48eb26){var _0x13088b={'agent':{},'channel':_0x31bc('0x5c')};if(_0x4788a6[_0x31bc('0x57')]['id']){delete _0x4788a6[_0x31bc('0x57')]['id'];}_0x4788a6[_0x31bc('0x57')]['UserId']=_0x4788a6['body'][_0x31bc('0x5f')]||_0x4788a6[_0x31bc('0x60')]['id'];_0x13088b['agent']['id']=_0x4788a6[_0x31bc('0x57')][_0x31bc('0x5f')];return db[_0x31bc('0x4d')]['find']({'where':{'id':_0x4788a6['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x494af4,null))['then'](function(_0x162222){if(_0x162222){_0x13088b[_0x31bc('0x29')]=_0x162222[_0x31bc('0x67')]({'plain':!![]});return db['OpenchannelInteraction'][_0x31bc('0x55')]({'where':{'id':_0x162222['OpenchannelInteractionId']}});}return null;})[_0x31bc('0x21')](handleEntityNotFound(_0x494af4,null))['then'](function(_0x3a4e62){if(_0x3a4e62){_0x13088b['interaction']=_0x3a4e62[_0x31bc('0x67')]({'plain':!![]});interaction_log['info'](_0x31bc('0x76'),_0x4788a6[_0x31bc('0x60')]['id'],_0x4788a6[_0x31bc('0x60')]['name'],_0x4788a6[_0x31bc('0x60')]['role'],_0x13088b['interaction']['id'],_0x4788a6[_0x31bc('0x57')]?JSON['stringify'](_0x4788a6[_0x31bc('0x57')]):'null');return respondWithRpcPromise('RejectMessage',_0x31bc('0x77'),_0x13088b);}return null;})[_0x31bc('0x21')](function(_0x45a5d4){var _0x16a2c7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x45a5d4[_0x31bc('0x29')][_0x31bc('0x78')];return db[_0x31bc('0x79')][_0x31bc('0x40')](_0x16a2c7,{'type':db[_0x31bc('0x6b')][_0x31bc('0x6c')][_0x31bc('0x7a')],'raw':!![]})[_0x31bc('0x21')](function(_0x3fd6cf){return _0x3fd6cf;});})[_0x31bc('0x21')](function(_0x1de610){if(_0x1de610){_0x13088b['message'][_0x31bc('0x6d')]=_0x1de610[0x0];if(!_0x4788a6[_0x31bc('0x57')][_0x31bc('0x5f')])return;return db[_0x31bc('0x6e')][_0x31bc('0x55')]({'where':{'id':_0x4788a6[_0x31bc('0x57')][_0x31bc('0x5f')],'role':'agent'},'attributes':['id','name','fullname','email',_0x31bc('0x7b')],'raw':!![]});}return null;})[_0x31bc('0x21')](function(_0x575bab){if(!_0x575bab)return null;_0x13088b[_0x31bc('0x29')]['agent']=_0x575bab;return _0x13088b;})[_0x31bc('0x21')](function(_0x494416){if(_0x494416){_0x494416[_0x31bc('0x29')][_0x31bc('0x71')]=util[_0x31bc('0x65')](_0x31bc('0x7c'),_0x4788a6[_0x31bc('0x60')][_0x31bc('0x39')]);_0x494416[_0x31bc('0x29')][_0x31bc('0x72')]=_0x13088b['channel'];_0x494416['message']['motionChannel']=_0x13088b[_0x31bc('0x72')];_0x494416[_0x31bc('0x29')][_0x31bc('0x73')]=_0x31bc('0x36');respondWithRpcPromise(_0x31bc('0x74'),_0x31bc('0x74'),{'event':_0x31bc('0x7d'),'message':_0x494416[_0x31bc('0x29')]},client9002);return _0x13088b;}return null;})['then'](respondWithResult(_0x494af4,null))[_0x31bc('0x2b')](handleError(_0x494af4,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 748b27f..5427391 100644 --- a/server/api/openchannelMessage/openchannelMessage.events.js +++ b/server/api/openchannelMessage/openchannelMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x460a=['emit','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x5d113d,_0x56e44c){var _0xb85406=function(_0x50440e){while(--_0x50440e){_0x5d113d['push'](_0x5d113d['shift']());}};_0xb85406(++_0x56e44c);}(_0x460a,0x10f));var _0xa460=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0x460a[_0x56608c];return _0x3c7fb0;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xa460('0x0'))['db'][_0xa460('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa460('0x2')](0x0);var events={'afterCreate':_0xa460('0x3'),'afterUpdate':_0xa460('0x4'),'afterDestroy':'remove'};function emitEvent(_0x206b8b){return function(_0xf343b9,_0x44ecfb,_0x22d09c){OpenchannelMessageEvents[_0xa460('0x5')](_0x206b8b+':'+_0xf343b9['id'],_0xf343b9);OpenchannelMessageEvents[_0xa460('0x5')](_0x206b8b,_0xf343b9);_0x22d09c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x330d=['exports','events','../../mysqldb','OpenchannelMessage','save','update','emit','hasOwnProperty'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x330d,0x1b1));var _0xd330=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x330d[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0xd330('0x0'));var OpenchannelMessage=require(_0xd330('0x1'))['db'][_0xd330('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd330('0x3'),'afterUpdate':_0xd330('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4f573b){return function(_0x40e093,_0x898536,_0x377a7e){OpenchannelMessageEvents['emit'](_0x4f573b+':'+_0x40e093['id'],_0x40e093);OpenchannelMessageEvents[_0xd330('0x5')](_0x4f573b,_0x40e093);_0x377a7e(null);};}for(var e in events){if(events[_0xd330('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xd330('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index ae0becb..c39eb2e 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19f7=['length','Interaction','omit','Contact','POST','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','out','secret','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions'];(function(_0x21b1c1,_0x4ba63f){var _0x3a181a=function(_0x14a7f1){while(--_0x14a7f1){_0x21b1c1['push'](_0x21b1c1['shift']());}};_0x3a181a(++_0x4ba63f);}(_0x19f7,0x1ea));var _0x719f=function(_0x419f64,_0x82fc7a){_0x419f64=_0x419f64-0x0;var _0x399e39=_0x19f7[_0x419f64];return _0x399e39;};'use strict';var _=require('lodash');var util=require(_0x719f('0x0'));var logger=require(_0x719f('0x1'))('api');var moment=require(_0x719f('0x2'));var BPromise=require(_0x719f('0x3'));var rp=require(_0x719f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x719f('0x5'));var config=require(_0x719f('0x6'));var attributes=require(_0x719f('0x7'));module[_0x719f('0x8')]=function(_0x5a8a5,_0x4f3f08){return _0x5a8a5[_0x719f('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x719f('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x719f('0xb')],'type':_0x719f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x443815,_0x36bda8,_0x5907b1){var _0xd7ad20=_0x5a8a5[_0x719f('0xd')];var _0x35d479=_0x443815[_0x719f('0xe')]({'plain':!![]});if(_0x35d479[_0x719f('0xf')][_0x719f('0x10')]()==='in'||_0x35d479[_0x719f('0xf')][_0x719f('0x10')]()==='out'&&!_0x35d479['secret']&&!_[_0x719f('0x11')](_0x35d479[_0x719f('0x12')])){_0xd7ad20[_0x719f('0x13')][_0x719f('0x14')]({'where':{'id':_0x35d479[_0x719f('0x15')]}})[_0x719f('0x16')](function(_0xea3a1e){if(_0xea3a1e){_0xea3a1e[_0x719f('0x17')]({'lastMsgAt':_0x35d479[_0x719f('0x18')],'lastMsgDirection':_0x35d479['direction'][_0x719f('0x10')]()});}})[_0x719f('0x19')](function(_0x527311){console[_0x719f('0x1a')](_0x527311);});}if(_0x35d479[_0x719f('0xf')]===_0x719f('0x1b')&&!_0x35d479[_0x719f('0x1c')]){var _0x53301e;_0xd7ad20[_0x719f('0x1d')][_0x719f('0x1e')]()[_0x719f('0x16')](function(_0x1e5006){return _0xd7ad20[_0x719f('0x1f')]['find']({'where':{'id':_0x35d479[_0x719f('0x20')]},'include':[{'model':_0xd7ad20[_0x719f('0x13')],'as':'Interactions','where':{'id':_0x35d479[_0x719f('0x15')]},'limit':0x1,'include':[{'model':_0xd7ad20[_0x719f('0x1d')],'as':'Contact','attributes':_[_0x719f('0x21')](_0x1e5006)}]}]});})['then'](function(_0x51e7cf){_0x53301e=_0x51e7cf['get']({'plain':!![]});if(_0x53301e&&_0x53301e[_0x719f('0x22')]){logger[_0x719f('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x719f('0x24'),util[_0x719f('0x25')](_0x719f('0x26'),_0x35d479['id'],_0x53301e['replyUri']));if(_0x53301e[_0x719f('0x27')]&&_0x53301e['Interactions'][_0x719f('0x28')]){_0x35d479[_0x719f('0x29')]=_[_0x719f('0x2a')](_0x53301e[_0x719f('0x27')][0x0],'Contact');_0x35d479[_0x719f('0x2b')]=_0x53301e[_0x719f('0x27')][0x0]['Contact'];}var _0x36bda8={'method':_0x719f('0x2c'),'uri':encodeURI(_0x53301e[_0x719f('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x36bda8['method']){case _0x719f('0x2d'):_0x36bda8['qs']=_0x35d479;break;case _0x719f('0x2c'):_0x36bda8[_0x719f('0xb')]=_0x35d479;break;}return rp(_0x36bda8)[_0x719f('0x16')](function(_0x25e3b2){logger[_0x719f('0x23')](_0x719f('0x2e'),'afterCreate',util['format'](_0x719f('0x2f'),_0x35d479['id'],_0x53301e[_0x719f('0x22')]));if(_0x25e3b2[_0x719f('0xb')][_0x719f('0x30')]&&_0x25e3b2[_0x719f('0xb')][_0x719f('0x30')]!=_0x35d479[_0x719f('0x29')][_0x719f('0x30')]){return _0xd7ad20[_0x719f('0x13')][_0x719f('0x17')]({'threadId':_0x25e3b2[_0x719f('0xb')][_0x719f('0x30')]},{'where':{'id':_0x35d479[_0x719f('0x29')]['id']}});}else{return;}})[_0x719f('0x16')](function(){return _0x443815[_0x719f('0x17')]({'read':!![]});})[_0x719f('0x19')](function(_0x649ac3){logger['error'](_0x719f('0x2e'),_0x719f('0x24'),util[_0x719f('0x31')](_0x649ac3,{'showHidden':![],'depth':null}));_0x5907b1();});}else{_0x5907b1();}})[_0x719f('0x32')](function(){_0x5907b1();});}else{_0x5907b1();}}},'charset':_0x719f('0x33'),'collate':_0x719f('0x34')});}; \ No newline at end of file +var _0xdd31=['CmContact','describe','then','OpenchannelAccount','find','Interactions','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','body','threadId','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error'];(function(_0x4a96ad,_0x44e88d){var _0x21f0e2=function(_0x2bf007){while(--_0x2bf007){_0x4a96ad['push'](_0x4a96ad['shift']());}};_0x21f0e2(++_0x44e88d);}(_0xdd31,0x1a7));var _0x1dd3=function(_0x31f553,_0x460ea4){_0x31f553=_0x31f553-0x0;var _0x36d548=_0xdd31[_0x31f553];return _0x36d548;};'use strict';var _=require(_0x1dd3('0x0'));var util=require(_0x1dd3('0x1'));var logger=require(_0x1dd3('0x2'))(_0x1dd3('0x3'));var moment=require(_0x1dd3('0x4'));var BPromise=require('bluebird');var rp=require(_0x1dd3('0x5'));var fs=require('fs');var path=require(_0x1dd3('0x6'));var rimraf=require('rimraf');var config=require(_0x1dd3('0x7'));var attributes=require(_0x1dd3('0x8'));module[_0x1dd3('0x9')]=function(_0xfdc1b6,_0x505c7b){return _0xfdc1b6['define'](_0x1dd3('0xa'),attributes,{'tableName':_0x1dd3('0xb'),'paranoid':![],'indexes':[{'name':_0x1dd3('0xc'),'fields':['body'],'type':_0x1dd3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15908d,_0x5b627c,_0x56c2fb){var _0x455cdd=_0xfdc1b6[_0x1dd3('0xe')];var _0x43b2ab=_0x15908d['get']({'plain':!![]});if(_0x43b2ab['direction'][_0x1dd3('0xf')]()==='in'||_0x43b2ab[_0x1dd3('0x10')][_0x1dd3('0xf')]()===_0x1dd3('0x11')&&!_0x43b2ab[_0x1dd3('0x12')]&&!_[_0x1dd3('0x13')](_0x43b2ab['UserId'])){_0x455cdd[_0x1dd3('0x14')][_0x1dd3('0x15')]({'where':{'id':_0x43b2ab[_0x1dd3('0x16')]}})['then'](function(_0xafd905){if(_0xafd905){_0xafd905[_0x1dd3('0x17')]({'lastMsgAt':_0x43b2ab[_0x1dd3('0x18')],'lastMsgDirection':_0x43b2ab[_0x1dd3('0x10')]['toLowerCase']()});}})[_0x1dd3('0x19')](function(_0x56941c){console[_0x1dd3('0x1a')](_0x56941c);});}if(_0x43b2ab['direction']===_0x1dd3('0x11')&&!_0x43b2ab[_0x1dd3('0x12')]){var _0x1cfc6f;_0x455cdd[_0x1dd3('0x1b')][_0x1dd3('0x1c')]()[_0x1dd3('0x1d')](function(_0x309773){return _0x455cdd[_0x1dd3('0x1e')][_0x1dd3('0x1f')]({'where':{'id':_0x43b2ab['OpenchannelAccountId']},'include':[{'model':_0x455cdd[_0x1dd3('0x14')],'as':_0x1dd3('0x20'),'where':{'id':_0x43b2ab[_0x1dd3('0x16')]},'limit':0x1,'include':[{'model':_0x455cdd['CmContact'],'as':_0x1dd3('0x21'),'attributes':_[_0x1dd3('0x22')](_0x309773)}]}]});})[_0x1dd3('0x1d')](function(_0x15b35f){_0x1cfc6f=_0x15b35f[_0x1dd3('0x23')]({'plain':!![]});if(_0x1cfc6f&&_0x1cfc6f[_0x1dd3('0x24')]){logger[_0x1dd3('0x25')](_0x1dd3('0x26'),_0x1dd3('0x27'),util[_0x1dd3('0x28')](_0x1dd3('0x29'),_0x43b2ab['id'],_0x1cfc6f['replyUri']));if(_0x1cfc6f[_0x1dd3('0x20')]&&_0x1cfc6f[_0x1dd3('0x20')]['length']){_0x43b2ab[_0x1dd3('0x2a')]=_[_0x1dd3('0x2b')](_0x1cfc6f[_0x1dd3('0x20')][0x0],_0x1dd3('0x21'));_0x43b2ab[_0x1dd3('0x21')]=_0x1cfc6f[_0x1dd3('0x20')][0x0][_0x1dd3('0x21')];}var _0x5b627c={'method':_0x1dd3('0x2c'),'uri':encodeURI(_0x1cfc6f[_0x1dd3('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5b627c['method']){case'GET':_0x5b627c['qs']=_0x43b2ab;break;case _0x1dd3('0x2c'):_0x5b627c[_0x1dd3('0x2d')]=_0x43b2ab;break;}return rp(_0x5b627c)[_0x1dd3('0x1d')](function(_0x5a941a){logger[_0x1dd3('0x25')](_0x1dd3('0x26'),_0x1dd3('0x27'),util[_0x1dd3('0x28')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x43b2ab['id'],_0x1cfc6f[_0x1dd3('0x24')]));if(_0x5a941a[_0x1dd3('0x2d')][_0x1dd3('0x2e')]&&_0x5a941a['body'][_0x1dd3('0x2e')]!=_0x43b2ab[_0x1dd3('0x2a')]['threadId']){return _0x455cdd[_0x1dd3('0x14')][_0x1dd3('0x17')]({'threadId':_0x5a941a[_0x1dd3('0x2d')]['threadId']},{'where':{'id':_0x43b2ab[_0x1dd3('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x15908d['update']({'read':!![]});})[_0x1dd3('0x19')](function(_0x2aaf5e){logger[_0x1dd3('0x1a')](_0x1dd3('0x26'),'afterCreate',util[_0x1dd3('0x2f')](_0x2aaf5e,{'showHidden':![],'depth':null}));_0x56c2fb();});}else{_0x56c2fb();}})[_0x1dd3('0x30')](function(){_0x56c2fb();});}else{_0x56c2fb();}}},'charset':'utf8mb4','collate':_0x1dd3('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index afbce01..2c27782 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x585cc8,_0x57eb85){var _0x426191=function(_0x40d087){while(--_0x40d087){_0x585cc8['push'](_0x585cc8['shift']());}};_0x426191(++_0x57eb85);}(_0xadb5,0xad));var _0x5adb=function(_0x490fcd,_0xe400ce){_0x490fcd=_0x490fcd-0x0;var _0x46adcb=_0xadb5[_0x490fcd];return _0x46adcb;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x471a86,_0x2c4ae1){var _0x4520d9=function(_0x338494){while(--_0x338494){_0x471a86['push'](_0x471a86['shift']());}};_0x4520d9(++_0x2c4ae1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 13b8762..9e7b372 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61bb=['openchannelMessage:','./openchannelMessage.events','save','update','emit','removeListener'];(function(_0x5cee86,_0x137379){var _0x3c1c28=function(_0x2a82a1){while(--_0x2a82a1){_0x5cee86['push'](_0x5cee86['shift']());}};_0x3c1c28(++_0x137379);}(_0x61bb,0x1b1));var _0xb61b=function(_0x1e01b1,_0x5b68f6){_0x1e01b1=_0x1e01b1-0x0;var _0xe6054f=_0x61bb[_0x1e01b1];return _0xe6054f;};'use strict';var OpenchannelMessageEvents=require(_0xb61b('0x0'));var events=[_0xb61b('0x1'),'remove',_0xb61b('0x2')];function createListener(_0x5916d0,_0x574bb9){return function(_0x480795){_0x574bb9[_0xb61b('0x3')](_0x5916d0,_0x480795);};}function removeListener(_0x4b8d24,_0x7754ef){return function(){OpenchannelMessageEvents[_0xb61b('0x4')](_0x4b8d24,_0x7754ef);};}exports['register']=function(_0x17cbc5){for(var _0x11fcb4=0x0,_0x6d2684=events['length'];_0x11fcb4<_0x6d2684;_0x11fcb4++){var _0x57ccae=events[_0x11fcb4];var _0x9d6919=createListener(_0xb61b('0x5')+_0x57ccae,_0x17cbc5);OpenchannelMessageEvents['on'](_0x57ccae,_0x9d6919);}}; \ No newline at end of file +var _0xe6a5=['update','removeListener','register','length','openchannelMessage:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe6a5,0x13b));var _0x5e6a=function(_0x32561a,_0x29eacb){_0x32561a=_0x32561a-0x0;var _0x3b2981=_0xe6a5[_0x32561a];return _0x3b2981;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save','remove',_0x5e6a('0x0')];function createListener(_0x22e563,_0x242e6d){return function(_0xf72b24){_0x242e6d['emit'](_0x22e563,_0xf72b24);};}function removeListener(_0x4641c6,_0x5a464f){return function(){OpenchannelMessageEvents[_0x5e6a('0x1')](_0x4641c6,_0x5a464f);};}exports[_0x5e6a('0x2')]=function(_0x15db90){for(var _0x346e04=0x0,_0x1aa798=events[_0x5e6a('0x3')];_0x346e04<_0x1aa798;_0x346e04++){var _0x2f34a0=events[_0x346e04];var _0x26ea18=createListener(_0x5e6a('0x4')+_0x2f34a0,_0x15db90);OpenchannelMessageEvents['on'](_0x2f34a0,_0x26ea18);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4462793..9699c33 100644 --- a/server/api/openchannelQueue/index.js +++ b/server/api/openchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x035d=['./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','create','addTeams','post','addAgents','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x1d331c,_0x4f48b9){var _0x1dcc1e=function(_0x4dae33){while(--_0x4dae33){_0x1d331c['push'](_0x1d331c['shift']());}};_0x1dcc1e(++_0x4f48b9);}(_0x035d,0x6b));var _0xd035=function(_0x4b192a,_0x48d869){_0x4b192a=_0x4b192a-0x0;var _0x1613db=_0x035d[_0x4b192a];return _0x1613db;};'use strict';var multer=require(_0xd035('0x0'));var util=require('util');var path=require(_0xd035('0x1'));var timeout=require(_0xd035('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd035('0x3'));var config=require(_0xd035('0x4'));var controller=require(_0xd035('0x5'));router[_0xd035('0x6')]('/',auth[_0xd035('0x7')](),controller[_0xd035('0x8')]);router[_0xd035('0x6')](_0xd035('0x9'),auth['isAuthenticated'](),controller[_0xd035('0xa')]);router['get'](_0xd035('0xb'),auth[_0xd035('0x7')](),controller[_0xd035('0xc')]);router[_0xd035('0x6')]('/:id/members',auth[_0xd035('0x7')](),controller[_0xd035('0xd')]);router['get'](_0xd035('0xe'),auth[_0xd035('0x7')](),controller[_0xd035('0xf')]);router[_0xd035('0x6')]('/:id/users',auth[_0xd035('0x7')](),controller[_0xd035('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd035('0x11')]);router['post'](_0xd035('0xe'),auth[_0xd035('0x7')](),controller[_0xd035('0x12')]);router[_0xd035('0x13')]('/:id/users',auth[_0xd035('0x7')](),controller[_0xd035('0x14')]);router['put']('/:id',auth[_0xd035('0x7')](),controller[_0xd035('0x15')]);router[_0xd035('0x16')](_0xd035('0xb'),auth[_0xd035('0x7')](),controller[_0xd035('0x17')]);router[_0xd035('0x16')]('/:id/teams',auth[_0xd035('0x7')](),controller[_0xd035('0x18')]);router[_0xd035('0x16')](_0xd035('0x19'),auth[_0xd035('0x7')](),controller[_0xd035('0x1a')]);module[_0xd035('0x1b')]=router; \ No newline at end of file +var _0xd985=['multer','util','path','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xd985,0x16c));var _0x5d98=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xd985[_0x4ae829];return _0x256b31;};'use strict';var multer=require(_0x5d98('0x0'));var util=require(_0x5d98('0x1'));var path=require(_0x5d98('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5d98('0x3'));var config=require(_0x5d98('0x4'));var controller=require(_0x5d98('0x5'));router[_0x5d98('0x6')]('/',auth[_0x5d98('0x7')](),controller[_0x5d98('0x8')]);router[_0x5d98('0x6')](_0x5d98('0x9'),auth[_0x5d98('0x7')](),controller[_0x5d98('0xa')]);router['get'](_0x5d98('0xb'),auth[_0x5d98('0x7')](),controller[_0x5d98('0xc')]);router[_0x5d98('0x6')](_0x5d98('0xd'),auth[_0x5d98('0x7')](),controller[_0x5d98('0xe')]);router[_0x5d98('0x6')](_0x5d98('0xf'),auth[_0x5d98('0x7')](),controller['getTeams']);router[_0x5d98('0x6')](_0x5d98('0x10'),auth[_0x5d98('0x7')](),controller[_0x5d98('0x11')]);router[_0x5d98('0x12')]('/',auth[_0x5d98('0x7')](),controller[_0x5d98('0x13')]);router[_0x5d98('0x12')](_0x5d98('0xf'),auth[_0x5d98('0x7')](),controller[_0x5d98('0x14')]);router[_0x5d98('0x12')](_0x5d98('0x10'),auth[_0x5d98('0x7')](),controller[_0x5d98('0x15')]);router[_0x5d98('0x16')]('/:id',auth[_0x5d98('0x7')](),controller[_0x5d98('0x17')]);router[_0x5d98('0x18')](_0x5d98('0xb'),auth[_0x5d98('0x7')](),controller[_0x5d98('0x19')]);router[_0x5d98('0x18')](_0x5d98('0xf'),auth[_0x5d98('0x7')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x5d98('0x7')](),controller[_0x5d98('0x1a')]);module[_0x5d98('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 16bd2b8..4daef39 100644 --- a/server/api/openchannelQueue/openchannelQueue.attributes.js +++ b/server/api/openchannelQueue/openchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2eb=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x4a0198,_0x587b06){var _0x4332fc=function(_0x381660){while(--_0x381660){_0x4a0198['push'](_0x4a0198['shift']());}};_0x4332fc(++_0x587b06);}(_0xb2eb,0x193));var _0xbb2e=function(_0x3e3936,_0x24c3a6){_0x3e3936=_0x3e3936-0x0;var _0x10be4e=_0xb2eb[_0x3e3936];return _0x10be4e;};'use strict';var Sequelize=require(_0xbb2e('0x0'));module[_0xbb2e('0x1')]={'name':{'type':Sequelize[_0xbb2e('0x2')],'unique':_0xbb2e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb2e('0x2')]},'timeout':{'type':Sequelize[_0xbb2e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb2e('0x5')]('rrmemory',_0xbb2e('0x6'),_0xbb2e('0x7'))}}; \ No newline at end of file +var _0xecd9=['rrmemory','beepall','roundrobin','sequelize','STRING','ENUM'];(function(_0xe18b7d,_0x23bac4){var _0x5e5af1=function(_0x49393f){while(--_0x49393f){_0xe18b7d['push'](_0xe18b7d['shift']());}};_0x5e5af1(++_0x23bac4);}(_0xecd9,0x1a7));var _0x9ecd=function(_0x6e573e,_0x124bd4){_0x6e573e=_0x6e573e-0x0;var _0x3fa5d3=_0xecd9[_0x6e573e];return _0x3fa5d3;};'use strict';var Sequelize=require(_0x9ecd('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ecd('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9ecd('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9ecd('0x2')](_0x9ecd('0x3'),_0x9ecd('0x4'),_0x9ecd('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index ca59c76..54b5eb1 100644 --- a/server/api/openchannelQueue/openchannelQueue.controller.js +++ b/server/api/openchannelQueue/openchannelQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1667=['attributes','fields','length','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','keys','intersection','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','Team','order','addTeams','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','Agents','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','userOpenchannelQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','json','undefined','limit','count','offset','set','Content-Range','update','then','UserProfileResource','status','end','sendStatus','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','params','model','filters'];(function(_0x49e5d8,_0x177875){var _0x4533d8=function(_0x1680a5){while(--_0x1680a5){_0x49e5d8['push'](_0x49e5d8['shift']());}};_0x4533d8(++_0x177875);}(_0x1667,0x1d3));var _0x7166=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x1667[_0x4defd6];return _0x4c9276;};'use strict';var BPromise=require('bluebird');var util=require(_0x7166('0x0'));var _=require('lodash');var squel=require(_0x7166('0x1'));var Redis=require(_0x7166('0x2'));var qs=require(_0x7166('0x3'));var logger=require(_0x7166('0x4'))(_0x7166('0x5'));var config=require(_0x7166('0x6'));var db=require(_0x7166('0x7'))['db'];config[_0x7166('0x8')]=_[_0x7166('0x9')](config['redis'],{'host':_0x7166('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7166('0x8')]));require(_0x7166('0xb'))[_0x7166('0xc')](socket);function respondWithStatusCode(_0x4389aa,_0xa7d3de){_0xa7d3de=_0xa7d3de||0xcc;return function(_0x2974b6){if(_0x2974b6){return _0x4389aa['sendStatus'](_0xa7d3de);}return _0x4389aa['status'](_0xa7d3de)['end']();};}function respondWithResult(_0x4fb8db,_0x2a88e3){_0x2a88e3=_0x2a88e3||0xc8;return function(_0x3f9aa5){if(_0x3f9aa5){return _0x4fb8db['status'](_0x2a88e3)[_0x7166('0xd')](_0x3f9aa5);}};}function respondWithFilteredResult(_0x4f128c,_0x431dd5){return function(_0x5cbb69){if(_0x5cbb69){var _0x423e2d=typeof _0x431dd5['offset']===_0x7166('0xe')&&typeof _0x431dd5[_0x7166('0xf')]===_0x7166('0xe');var _0xd90335=_0x5cbb69[_0x7166('0x10')];var _0x1cc7e6=_0x423e2d?0x0:_0x431dd5[_0x7166('0x11')];var _0x4d930a=_0x423e2d?_0x5cbb69[_0x7166('0x10')]:_0x431dd5[_0x7166('0x11')]+_0x431dd5[_0x7166('0xf')];var _0x535d4d;if(_0x4d930a>=_0xd90335){_0x4d930a=_0xd90335;_0x535d4d=0xc8;}else{_0x535d4d=0xce;}_0x4f128c['status'](_0x535d4d);return _0x4f128c[_0x7166('0x12')](_0x7166('0x13'),_0x1cc7e6+'-'+_0x4d930a+'/'+_0xd90335)[_0x7166('0xd')](_0x5cbb69);}return null;};}function saveUpdates(_0x1386db){return function(_0x3333bf){if(_0x3333bf){return _0x3333bf[_0x7166('0x14')](_0x1386db)[_0x7166('0x15')](function(_0x4b3c99){return _0x4b3c99;});}return null;};}function removeEntity(_0x2a5779){return function(_0x3b15d1){if(_0x3b15d1){return _0x3b15d1['destroy']()['then'](function(){var _0x31769f=_0x3b15d1['get']({'plain':!![]});var _0x5997e8='OpenchannelQueues';return db[_0x7166('0x16')]['destroy']({'where':{'type':_0x5997e8,'resourceId':_0x31769f['id']}})[_0x7166('0x15')](function(){return _0x3b15d1;});})[_0x7166('0x15')](function(){_0x2a5779[_0x7166('0x17')](0xcc)[_0x7166('0x18')]();});}};}function handleEntityNotFound(_0x210b15){return function(_0x37cf45){if(!_0x37cf45){_0x210b15[_0x7166('0x19')](0x194);}return _0x37cf45;};}function handleError(_0x58c0da,_0x179dac){_0x179dac=_0x179dac||0x1f4;return function(_0x127032){logger[_0x7166('0x1a')](_0x127032[_0x7166('0x1b')]);if(_0x127032[_0x7166('0x1c')]){delete _0x127032['name'];}_0x58c0da[_0x7166('0x17')](_0x179dac)['send'](_0x127032);};}exports[_0x7166('0x1d')]=function(_0x370177,_0x415ee1){var _0x2328fa={};var _0x3407b9={'count':0x0,'rows':[]};var _0x4f8982=_[_0x7166('0x1e')](db[_0x7166('0x1f')][_0x7166('0x20')],function(_0x265892){return{'name':_0x265892[_0x7166('0x21')],'type':_0x265892['type'][_0x7166('0x22')]};});_0x2328fa=qs[_0x7166('0x23')](_0x4f8982,_0x370177);var _0x3604c5={'where':_0x2328fa[_0x7166('0x24')]};return db[_0x7166('0x1f')][_0x7166('0x10')](_0x3604c5)[_0x7166('0x15')](function(_0x327b15){_0x3407b9[_0x7166('0x10')]=_0x327b15;_0x2328fa[_0x7166('0x25')]=qs[_0x7166('0x25')](_0x370177[_0x7166('0x26')]);return db[_0x7166('0x1f')][_0x7166('0x27')](_0x2328fa);})['then'](function(_0x3b6d5b){_0x3407b9['rows']=_0x3b6d5b;return _0x3407b9;})[_0x7166('0x15')](respondWithFilteredResult(_0x415ee1,_0x2328fa))[_0x7166('0x28')](handleError(_0x415ee1,null));};exports[_0x7166('0x29')]=function(_0x51ba62,_0x482f52){var _0x4cdc5b={'raw':!![],'where':{'id':_0x51ba62[_0x7166('0x2a')]['id']}},_0x38f987={};_0x38f987[_0x7166('0x2b')]=_['keys'](db[_0x7166('0x1f')][_0x7166('0x20')]);_0x38f987[_0x7166('0x26')]=_['keys'](_0x51ba62[_0x7166('0x26')]);_0x38f987[_0x7166('0x2c')]=_['intersection'](_0x38f987[_0x7166('0x2b')],_0x38f987[_0x7166('0x26')]);_0x4cdc5b[_0x7166('0x2d')]=_['intersection'](_0x38f987[_0x7166('0x2b')],qs[_0x7166('0x2e')](_0x51ba62[_0x7166('0x26')]['fields']));_0x4cdc5b[_0x7166('0x2d')]=_0x4cdc5b['attributes'][_0x7166('0x2f')]?_0x4cdc5b[_0x7166('0x2d')]:_0x38f987[_0x7166('0x2b')];if(_0x51ba62[_0x7166('0x26')][_0x7166('0x30')]){_0x4cdc5b[_0x7166('0x25')]=[{'all':!![]}];}_0x4cdc5b=_[_0x7166('0x31')]({},_0x4cdc5b,_0x51ba62[_0x7166('0x32')]);return db[_0x7166('0x1f')][_0x7166('0x33')](_0x4cdc5b)[_0x7166('0x15')](handleEntityNotFound(_0x482f52,null))[_0x7166('0x15')](respondWithResult(_0x482f52,null))['catch'](handleError(_0x482f52,null));};exports['create']=function(_0x45f9a4,_0x3df891){return db['OpenchannelQueue'][_0x7166('0x34')](_0x45f9a4[_0x7166('0x35')],{})[_0x7166('0x15')](function(_0x3f2d48){var _0x4331ca=_0x45f9a4[_0x7166('0x36')][_0x7166('0x37')]({'plain':!![]});if(!_0x4331ca)throw new Error(_0x7166('0x38'));if(_0x4331ca[_0x7166('0x39')]===_0x7166('0x36')){var _0x5c18c1=_0x3f2d48[_0x7166('0x37')]({'plain':!![]});var _0x41f0b9=_0x7166('0x3a');return db[_0x7166('0x3b')]['find']({'where':{'name':_0x41f0b9,'userProfileId':_0x4331ca[_0x7166('0x3c')]},'raw':!![]})[_0x7166('0x15')](function(_0x4a2bd0){if(_0x4a2bd0&&_0x4a2bd0[_0x7166('0x3d')]===0x0){return db[_0x7166('0x16')]['create']({'name':_0x5c18c1['name'],'resourceId':_0x5c18c1['id'],'type':_0x4a2bd0['name'],'sectionId':_0x4a2bd0['id']},{})[_0x7166('0x15')](function(){return _0x3f2d48;});}else{return _0x3f2d48;}})[_0x7166('0x28')](function(_0x473a18){logger[_0x7166('0x1a')](_0x7166('0x3e'),_0x473a18);throw _0x473a18;});}return _0x3f2d48;})[_0x7166('0x15')](respondWithResult(_0x3df891,0xc9))[_0x7166('0x28')](handleError(_0x3df891,null));};exports['update']=function(_0x586083,_0xc733ce){if(_0x586083['body']['id']){delete _0x586083['body']['id'];}return db[_0x7166('0x1f')][_0x7166('0x33')]({'where':{'id':_0x586083['params']['id']}})[_0x7166('0x15')](handleEntityNotFound(_0xc733ce,null))[_0x7166('0x15')](saveUpdates(_0x586083['body'],null))['then'](respondWithResult(_0xc733ce,null))['catch'](handleError(_0xc733ce,null));};exports[_0x7166('0x3f')]=function(_0x32a53e,_0x23691e){return db[_0x7166('0x1f')][_0x7166('0x33')]({'where':{'id':_0x32a53e[_0x7166('0x2a')]['id']}})[_0x7166('0x15')](handleEntityNotFound(_0x23691e,null))[_0x7166('0x15')](removeEntity(_0x23691e,null))[_0x7166('0x28')](handleError(_0x23691e,null));};exports[_0x7166('0x40')]=function(_0x31a114,_0x69cf10){return db[_0x7166('0x1f')][_0x7166('0x40')]()['then'](respondWithResult(_0x69cf10,null))['catch'](handleError(_0x69cf10,null));};exports[_0x7166('0x41')]=function(_0xacb728,_0x1db47b){var _0xbb1053={'raw':!![],'where':{}},_0x157114={},_0x53ad4e;return db[_0x7166('0x1f')][_0x7166('0x42')]({'where':{'id':_0xacb728[_0x7166('0x2a')]['id']}})[_0x7166('0x15')](handleEntityNotFound(_0x1db47b,null))[_0x7166('0x15')](function(_0x5c0f44){if(_0x5c0f44){_0x53ad4e=_0x5c0f44[_0x7166('0x37')]({'plain':!![]});_0x157114[_0x7166('0x2b')]=_[_0x7166('0x43')](db['UserOpenchannelQueue']['rawAttributes']);_0x157114[_0x7166('0x26')]=_['keys'](_0xacb728['query']);_0x157114[_0x7166('0x2c')]=_[_0x7166('0x44')](_0x157114[_0x7166('0x2b')],_0x157114[_0x7166('0x26')]);_0xbb1053[_0x7166('0x2d')]=_[_0x7166('0x44')](_0x157114['model'],qs[_0x7166('0x2e')](_0xacb728[_0x7166('0x26')][_0x7166('0x2e')]));_0xbb1053[_0x7166('0x2d')]=_0xbb1053[_0x7166('0x2d')][_0x7166('0x2f')]?_0xbb1053[_0x7166('0x2d')]:_0x157114['model'];if(!_0xacb728[_0x7166('0x26')][_0x7166('0x45')](_0x7166('0x46'))){_0xbb1053[_0x7166('0xf')]=qs['limit'](_0xacb728[_0x7166('0x26')][_0x7166('0xf')]);_0xbb1053[_0x7166('0x11')]=qs[_0x7166('0x11')](_0xacb728[_0x7166('0x26')]['offset']);}_0xbb1053['order']=qs['sort'](_0xacb728[_0x7166('0x26')][_0x7166('0x47')]);_0xbb1053[_0x7166('0x24')]=qs[_0x7166('0x2c')](_[_0x7166('0x48')](_0xacb728[_0x7166('0x26')],_0x157114[_0x7166('0x2c')]));_0xbb1053['where'][_0x7166('0x49')]=_0x5c0f44['id'];if(_0xacb728[_0x7166('0x26')][_0x7166('0x4a')]){_0xbb1053[_0x7166('0x24')]=_[_0x7166('0x31')](_0xbb1053['where'],{'$or':_[_0x7166('0x1e')](_0xbb1053[_0x7166('0x2d')],function(_0x3cc683){var _0x51e6c3={};_0x51e6c3[_0x3cc683]={'$like':'%'+_0xacb728[_0x7166('0x26')][_0x7166('0x4a')]+'%'};return _0x51e6c3;})});}_0xbb1053=_['merge']({},_0xbb1053,_0xacb728['options']);return db[_0x7166('0x4b')]['findAll'](_0xbb1053);}})[_0x7166('0x15')](function(_0x22561a){if(_0x22561a){return db[_0x7166('0x4c')][_0x7166('0x4d')]({'where':{'id':_['map'](_0x22561a,_0x7166('0x4e')),'role':_0x7166('0x4f')},'attributes':['id',_0x7166('0x1c'),'openchannelPause',_0x7166('0x50'),_0x7166('0x51')]});}})[_0x7166('0x15')](function(_0x2e0ff9){if(_0x2e0ff9){return{'count':_0x2e0ff9['count'],'rows':_['map'](_0x2e0ff9[_0x7166('0x52')],function(_0x36f6a5){return{'membername':_0x36f6a5['name'],'UserId':_0x36f6a5['id'],'queue_name':_0x53ad4e[_0x7166('0x1c')],'OpenchannelQueueId':_0x53ad4e['id'],'interface':util['format'](_0x7166('0x53'),_0x7166('0x54'),_0x36f6a5[_0x7166('0x1c')]),'penalty':0x0,'paused':_0x36f6a5['openchannelPause'],'createdAt':_0x36f6a5[_0x7166('0x51')],'updatedAt':_0x36f6a5[_0x7166('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7166('0x15')](respondWithFilteredResult(_0x1db47b,_0xbb1053))[_0x7166('0x28')](handleError(_0x1db47b,null));};exports[_0x7166('0x55')]=function(_0x564ce2,_0x22c841){var _0x6bc628={};var _0x388c51={};var _0x5f1469;var _0x42d118;return db[_0x7166('0x1f')][_0x7166('0x42')]({'where':{'id':_0x564ce2['params']['id']}})['then'](handleEntityNotFound(_0x22c841,null))[_0x7166('0x15')](function(_0x51aae2){if(_0x51aae2){_0x5f1469=_0x51aae2;_0x388c51[_0x7166('0x2b')]=_[_0x7166('0x43')](db[_0x7166('0x56')][_0x7166('0x20')]);_0x388c51[_0x7166('0x26')]=_['keys'](_0x564ce2[_0x7166('0x26')]);_0x388c51['filters']=_['intersection'](_0x388c51[_0x7166('0x2b')],_0x388c51['query']);_0x6bc628[_0x7166('0x2d')]=_[_0x7166('0x44')](_0x388c51[_0x7166('0x2b')],qs[_0x7166('0x2e')](_0x564ce2[_0x7166('0x26')]['fields']));_0x6bc628['attributes']=_0x6bc628[_0x7166('0x2d')][_0x7166('0x2f')]?_0x6bc628[_0x7166('0x2d')]:_0x388c51['model'];_0x6bc628[_0x7166('0x57')]=qs['sort'](_0x564ce2[_0x7166('0x26')]['sort']);_0x6bc628[_0x7166('0x24')]=qs[_0x7166('0x2c')](_[_0x7166('0x48')](_0x564ce2[_0x7166('0x26')],_0x388c51[_0x7166('0x2c')]));if(_0x564ce2[_0x7166('0x26')][_0x7166('0x4a')]){_0x6bc628[_0x7166('0x24')]=_[_0x7166('0x31')](_0x6bc628[_0x7166('0x24')],{'$or':_[_0x7166('0x1e')](_0x6bc628[_0x7166('0x2d')],function(_0x113728){var _0x1ca7af={};_0x1ca7af[_0x113728]={'$like':'%'+_0x564ce2[_0x7166('0x26')][_0x7166('0x4a')]+'%'};return _0x1ca7af;})});}_0x6bc628=_[_0x7166('0x31')]({},_0x6bc628,_0x564ce2[_0x7166('0x32')]);return _0x5f1469[_0x7166('0x55')](_0x6bc628);}})[_0x7166('0x15')](function(_0x54d07e){if(_0x54d07e){_0x42d118=_0x54d07e['length'];if(!_0x564ce2['query'][_0x7166('0x45')](_0x7166('0x46'))){_0x6bc628[_0x7166('0xf')]=qs[_0x7166('0xf')](_0x564ce2[_0x7166('0x26')]['limit']);_0x6bc628['offset']=qs[_0x7166('0x11')](_0x564ce2[_0x7166('0x26')]['offset']);}return _0x5f1469[_0x7166('0x55')](_0x6bc628);}})[_0x7166('0x15')](function(_0x42bd3c){if(_0x42bd3c){return _0x42bd3c?{'count':_0x42d118,'rows':_0x42bd3c}:null;}})[_0x7166('0x15')](respondWithResult(_0x22c841,null))[_0x7166('0x28')](handleError(_0x22c841,null));};exports[_0x7166('0x58')]=function(_0x488e43,_0x92695c){var _0x1c15de=_0x488e43[_0x7166('0x35')]['ids'];return db[_0x7166('0x56')]['findAll']({'where':{'id':_0x1c15de},'attributes':['id'],'include':[{'model':db[_0x7166('0x4c')],'as':'Agents','attributes':['id','name',_0x7166('0x59'),_0x7166('0x5a'),_0x7166('0x5b')],'raw':!![]}]})['then'](function(_0x2af550){if(_0x2af550){var _0x125ef4=_[_0x7166('0x5c')](_0x2af550,function(_0x2fbf26){var _0x9afad9=_0x2fbf26[_0x7166('0x37')]({'plain':!![]});return _0x9afad9['Agents'];});return db['OpenchannelQueue']['find']({'where':{'id':_0x488e43['params']['id']}})[_0x7166('0x15')](function(_0x1bff7c){return db[_0x7166('0x5d')]['transaction'](function(_0x558e0a){return _0x1bff7c[_0x7166('0x58')](_0x1c15de,{'transaction':_0x558e0a})[_0x7166('0x15')](function(){return BPromise[_0x7166('0x5e')](_0x125ef4,function(_0x391d68){return db[_0x7166('0x4b')][_0x7166('0x5f')]({'where':{'UserId':_0x391d68['id'],'OpenchannelQueueId':_0x488e43[_0x7166('0x2a')]['id']},'transaction':_0x558e0a});});})[_0x7166('0x15')](function(){_0x125ef4[_0x7166('0x60')](function(_0x1c98fa){socket[_0x7166('0x61')](_0x7166('0x62'),{'UserId':_0x1c98fa['id'],'OpenchannelQueueId':_0x1bff7c['id']});});});});});}})[_0x7166('0x15')](respondWithStatusCode(_0x92695c,null))[_0x7166('0x28')](handleError(_0x92695c,null));};exports[_0x7166('0x63')]=function(_0x7e33a2,_0x1f083e){return db['Team'][_0x7166('0x27')]({'where':{'id':_0x7e33a2[_0x7166('0x26')][_0x7166('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7166('0x15')](handleEntityNotFound(_0x1f083e,null))[_0x7166('0x15')](function(_0xd2d613){var _0x360908=_[_0x7166('0x1e')](_0xd2d613,'id');var _0x1817d6=[];var _0xc5d3e=[];var _0x5e4cb5=squel[_0x7166('0x65')]();_0x5e4cb5[_0x7166('0x66')](_0x7166('0x67'))[_0x7166('0x68')]('team_has_openchannel_queues','tq')[_0x7166('0x69')](_0x7166('0x6a'),'ut',_0x7166('0x6b'))['where'](_0x7166('0x6c'),_0x7e33a2[_0x7166('0x2a')]['id']);for(var _0x230052=0x0;_0x230052<_0xd2d613['length'];_0x230052+=0x1){let _0x60be12=_0xd2d613[_0x230052];for(var _0x31443d=0x0;_0x31443d<_0x60be12[_0x7166('0x6d')]['length'];_0x31443d+=0x1){let _0x2e9c9c=_0x60be12[_0x7166('0x6d')][_0x31443d];var _0x2d769d=_0x5e4cb5['clone']();_0x2d769d[_0x7166('0x24')]('ut.UserId\x20=\x20?',_0x2e9c9c['id']);_0xc5d3e[_0x7166('0x6e')](db['sequelize'][_0x7166('0x26')](_0x2d769d[_0x7166('0x6f')](),{'type':db[_0x7166('0x5d')][_0x7166('0x70')][_0x7166('0x71')]})[_0x7166('0x15')](function(_0x4e05a6){if(_0x4e05a6[_0x7166('0x2f')]===0x1){return _0x2e9c9c['id'];}else{var _0x16e81=_[_0x7166('0x72')](_[_0x7166('0x1e')](_0x4e05a6,_0x7166('0x73')),function(_0x464e3d){return _[_0x7166('0x74')](_0x360908,_0x464e3d);});if(_0x16e81){return _0x2e9c9c['id'];}}}));}}return BPromise[_0x7166('0x75')](_0xc5d3e)['then'](function(_0x6d4729){_0x1817d6=_(_0x1817d6)['union'](_0x6d4729)[_0x7166('0x76')]()[_0x7166('0x77')]();return db[_0x7166('0x1f')][_0x7166('0x33')]({'where':{'id':_0x7e33a2[_0x7166('0x2a')]['id']}})[_0x7166('0x15')](function(_0x178487){return db[_0x7166('0x5d')][_0x7166('0x78')](function(_0x2cf1c2){return _0x178487['removeTeams'](_0x7e33a2[_0x7166('0x26')][_0x7166('0x64')],{'transaction':_0x2cf1c2})['then'](function(){if(!_[_0x7166('0x79')](_0x1817d6)){return _0x178487['removeAgents'](_0x1817d6,{'transaction':_0x2cf1c2});}})[_0x7166('0x15')](function(){_0x1817d6[_0x7166('0x60')](function(_0xb45e70){socket[_0x7166('0x61')](_0x7166('0x7a'),{'UserId':_0xb45e70,'OpenchannelQueueId':_0x178487['id']});});});});});});})['then'](respondWithStatusCode(_0x1f083e,null))[_0x7166('0x28')](handleError(_0x1f083e,null));};exports[_0x7166('0x7b')]=function(_0x142926,_0x444585){return db['OpenchannelQueue']['find']({'where':{'id':_0x142926[_0x7166('0x2a')]['id']}})[_0x7166('0x15')](handleEntityNotFound(_0x444585,null))[_0x7166('0x15')](function(_0x432bfb){if(_0x432bfb){return _0x432bfb[_0x7166('0x7b')](_0x142926[_0x7166('0x35')]['ids'],_[_0x7166('0x7c')](_0x142926[_0x7166('0x35')],[_0x7166('0x64'),'id'])||{})['spread'](function(_0x43ebe1){for(var _0x56b5cc=0x0;_0x56b5cc<_0x142926[_0x7166('0x35')]['ids'][_0x7166('0x2f')];_0x56b5cc+=0x1){socket[_0x7166('0x61')]('userOpenchannelQueue:save',{'UserId':Number(_0x142926[_0x7166('0x35')][_0x7166('0x64')][_0x56b5cc]),'OpenchannelQueueId':Number(_0x142926[_0x7166('0x2a')]['id'])});}return _0x43ebe1;});}})['then'](respondWithResult(_0x444585,null))[_0x7166('0x28')](handleError(_0x444585,null));};exports['removeAgents']=function(_0x64e32f,_0x2200c7){return db['OpenchannelQueue'][_0x7166('0x33')]({'where':{'id':_0x64e32f[_0x7166('0x2a')]['id']}})[_0x7166('0x15')](handleEntityNotFound(_0x2200c7,null))['then'](function(_0x32c13e){if(_0x32c13e){return _0x32c13e[_0x7166('0x7d')](_0x64e32f[_0x7166('0x26')][_0x7166('0x64')])[_0x7166('0x15')](function(){if(_[_0x7166('0x7e')](_0x64e32f[_0x7166('0x26')][_0x7166('0x64')])){for(var _0x20b63b=0x0;_0x20b63b<_0x64e32f[_0x7166('0x26')]['ids'][_0x7166('0x2f')];_0x20b63b+=0x1){socket['emit'](_0x7166('0x7a'),{'UserId':Number(_0x64e32f['query'][_0x7166('0x64')][_0x20b63b]),'OpenchannelQueueId':Number(_0x64e32f[_0x7166('0x2a')]['id'])});}}else{socket[_0x7166('0x61')](_0x7166('0x7a'),{'UserId':Number(_0x64e32f[_0x7166('0x26')][_0x7166('0x64')]),'OpenchannelQueueId':Number(_0x64e32f[_0x7166('0x2a')]['id'])});}});}})[_0x7166('0x15')](respondWithStatusCode(_0x2200c7,null))[_0x7166('0x28')](handleError(_0x2200c7,null));};exports[_0x7166('0x7f')]=function(_0x21cd02,_0x410746){var _0x358462={};var _0x178db9={};var _0x9ef605;var _0x462377;return db[_0x7166('0x1f')][_0x7166('0x42')]({'where':{'id':_0x21cd02[_0x7166('0x2a')]['id']}})['then'](handleEntityNotFound(_0x410746,null))[_0x7166('0x15')](function(_0x4a8470){if(_0x4a8470){_0x9ef605=_0x4a8470;_0x178db9[_0x7166('0x2b')]=_[_0x7166('0x43')](db[_0x7166('0x4c')][_0x7166('0x20')]);_0x178db9[_0x7166('0x26')]=_[_0x7166('0x43')](_0x21cd02['query']);_0x178db9[_0x7166('0x2c')]=_[_0x7166('0x44')](_0x178db9['model'],_0x178db9[_0x7166('0x26')]);_0x358462['attributes']=_[_0x7166('0x44')](_0x178db9[_0x7166('0x2b')],qs['fields'](_0x21cd02['query'][_0x7166('0x2e')]));_0x358462[_0x7166('0x2d')]=_0x358462[_0x7166('0x2d')]['length']?_0x358462[_0x7166('0x2d')]:_0x178db9[_0x7166('0x2b')];_0x358462[_0x7166('0x57')]=qs['sort'](_0x21cd02[_0x7166('0x26')][_0x7166('0x47')]);_0x358462[_0x7166('0x24')]=qs[_0x7166('0x2c')](_[_0x7166('0x48')](_0x21cd02[_0x7166('0x26')],_0x178db9[_0x7166('0x2c')]));if(_0x21cd02['query']['filter']){_0x358462[_0x7166('0x24')]=_[_0x7166('0x31')](_0x358462[_0x7166('0x24')],{'$or':_[_0x7166('0x1e')](_0x358462['attributes'],function(_0xcfaf79){var _0x4d74cc={};_0x4d74cc[_0xcfaf79]={'$like':'%'+_0x21cd02[_0x7166('0x26')][_0x7166('0x4a')]+'%'};return _0x4d74cc;})});}_0x358462=_[_0x7166('0x31')]({},_0x358462,_0x21cd02[_0x7166('0x32')]);return _0x9ef605[_0x7166('0x7f')](_0x358462);}})[_0x7166('0x15')](function(_0x203a61){if(_0x203a61){_0x462377=_0x203a61[_0x7166('0x2f')];if(!_0x21cd02[_0x7166('0x26')][_0x7166('0x45')](_0x7166('0x46'))){_0x358462[_0x7166('0xf')]=qs['limit'](_0x21cd02[_0x7166('0x26')]['limit']);_0x358462[_0x7166('0x11')]=qs[_0x7166('0x11')](_0x21cd02['query'][_0x7166('0x11')]);}return _0x9ef605[_0x7166('0x7f')](_0x358462);}})[_0x7166('0x15')](function(_0x1a021f){if(_0x1a021f){return _0x1a021f?{'count':_0x462377,'rows':_0x1a021f}:null;}})[_0x7166('0x15')](respondWithResult(_0x410746,null))[_0x7166('0x28')](handleError(_0x410746,null));}; \ No newline at end of file +var _0x2a6b=['limit','count','set','Content-Range','json','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','getOptions','where','include','query','rows','show','params','model','keys','filters','fields','attributes','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserOpenchannelQueue','intersection','hasOwnProperty','nolimit','order','sort','pick','filter','map','findAll','User','UserId','agent','openchannelPause','createdAt','format','getTeams','findOne','addTeams','ids','Team','Agents','interface','flatMap','sequelize','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','spread','isArray','userOpenchannelQueue:remove','getAgents','bluebird','lodash','squel','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x2a6b,0x68));var _0xb2a6=function(_0x24ebe1,_0x43cb13){_0x24ebe1=_0x24ebe1-0x0;var _0xe82341=_0x2a6b[_0x24ebe1];return _0xe82341;};'use strict';var BPromise=require(_0xb2a6('0x0'));var util=require('util');var _=require(_0xb2a6('0x1'));var squel=require(_0xb2a6('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xb2a6('0x3'))('api');var config=require(_0xb2a6('0x4'));var db=require(_0xb2a6('0x5'))['db'];config[_0xb2a6('0x6')]=_[_0xb2a6('0x7')](config['redis'],{'host':_0xb2a6('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb2a6('0x6')]));require(_0xb2a6('0x9'))[_0xb2a6('0xa')](socket);function respondWithStatusCode(_0x5b2e8b,_0x1f22a1){_0x1f22a1=_0x1f22a1||0xcc;return function(_0x308c6a){if(_0x308c6a){return _0x5b2e8b[_0xb2a6('0xb')](_0x1f22a1);}return _0x5b2e8b[_0xb2a6('0xc')](_0x1f22a1)[_0xb2a6('0xd')]();};}function respondWithResult(_0x23727a,_0x207752){_0x207752=_0x207752||0xc8;return function(_0x19d76d){if(_0x19d76d){return _0x23727a['status'](_0x207752)['json'](_0x19d76d);}};}function respondWithFilteredResult(_0x285155,_0xc3f682){return function(_0x302eb9){if(_0x302eb9){var _0x9cbeeb=typeof _0xc3f682[_0xb2a6('0xe')]===_0xb2a6('0xf')&&typeof _0xc3f682[_0xb2a6('0x10')]===_0xb2a6('0xf');var _0x447462=_0x302eb9[_0xb2a6('0x11')];var _0x345254=_0x9cbeeb?0x0:_0xc3f682[_0xb2a6('0xe')];var _0x22c428=_0x9cbeeb?_0x302eb9['count']:_0xc3f682[_0xb2a6('0xe')]+_0xc3f682['limit'];var _0x57f700;if(_0x22c428>=_0x447462){_0x22c428=_0x447462;_0x57f700=0xc8;}else{_0x57f700=0xce;}_0x285155[_0xb2a6('0xc')](_0x57f700);return _0x285155[_0xb2a6('0x12')](_0xb2a6('0x13'),_0x345254+'-'+_0x22c428+'/'+_0x447462)[_0xb2a6('0x14')](_0x302eb9);}return null;};}function saveUpdates(_0x3ec6cb){return function(_0x43f50b){if(_0x43f50b){return _0x43f50b['update'](_0x3ec6cb)[_0xb2a6('0x15')](function(_0x252638){return _0x252638;});}return null;};}function removeEntity(_0x496745){return function(_0x5b5ddb){if(_0x5b5ddb){return _0x5b5ddb[_0xb2a6('0x16')]()[_0xb2a6('0x15')](function(){var _0x4996b3=_0x5b5ddb[_0xb2a6('0x17')]({'plain':!![]});var _0xbef634=_0xb2a6('0x18');return db[_0xb2a6('0x19')][_0xb2a6('0x16')]({'where':{'type':_0xbef634,'resourceId':_0x4996b3['id']}})[_0xb2a6('0x15')](function(){return _0x5b5ddb;});})[_0xb2a6('0x15')](function(){_0x496745[_0xb2a6('0xc')](0xcc)[_0xb2a6('0xd')]();});}};}function handleEntityNotFound(_0xfdb1cc){return function(_0x51d67f){if(!_0x51d67f){_0xfdb1cc[_0xb2a6('0xb')](0x194);}return _0x51d67f;};}function handleError(_0x11d4d7,_0x9db22f){_0x9db22f=_0x9db22f||0x1f4;return function(_0x8c9023){logger['error'](_0x8c9023[_0xb2a6('0x1a')]);if(_0x8c9023[_0xb2a6('0x1b')]){delete _0x8c9023['name'];}_0x11d4d7['status'](_0x9db22f)[_0xb2a6('0x1c')](_0x8c9023);};}exports[_0xb2a6('0x1d')]=function(_0x5e488d,_0x5624fc){var _0x4995ed={};var _0x5b284a={'count':0x0,'rows':[]};var _0x476ab1=_['map'](db[_0xb2a6('0x1e')][_0xb2a6('0x1f')],function(_0x1d83c8){return{'name':_0x1d83c8[_0xb2a6('0x20')],'type':_0x1d83c8['type'][_0xb2a6('0x21')]};});_0x4995ed=qs[_0xb2a6('0x22')](_0x476ab1,_0x5e488d);var _0x3b8ceb={'where':_0x4995ed[_0xb2a6('0x23')]};return db[_0xb2a6('0x1e')][_0xb2a6('0x11')](_0x3b8ceb)[_0xb2a6('0x15')](function(_0x19f2b9){_0x5b284a['count']=_0x19f2b9;_0x4995ed[_0xb2a6('0x24')]=qs[_0xb2a6('0x24')](_0x5e488d[_0xb2a6('0x25')]);return db['OpenchannelQueue']['findAll'](_0x4995ed);})[_0xb2a6('0x15')](function(_0x47ec7b){_0x5b284a[_0xb2a6('0x26')]=_0x47ec7b;return _0x5b284a;})[_0xb2a6('0x15')](respondWithFilteredResult(_0x5624fc,_0x4995ed))['catch'](handleError(_0x5624fc,null));};exports[_0xb2a6('0x27')]=function(_0x14d4aa,_0x465af2){var _0x34d190={'raw':!![],'where':{'id':_0x14d4aa[_0xb2a6('0x28')]['id']}},_0xe67456={};_0xe67456[_0xb2a6('0x29')]=_[_0xb2a6('0x2a')](db[_0xb2a6('0x1e')][_0xb2a6('0x1f')]);_0xe67456['query']=_[_0xb2a6('0x2a')](_0x14d4aa[_0xb2a6('0x25')]);_0xe67456[_0xb2a6('0x2b')]=_['intersection'](_0xe67456[_0xb2a6('0x29')],_0xe67456['query']);_0x34d190['attributes']=_['intersection'](_0xe67456[_0xb2a6('0x29')],qs[_0xb2a6('0x2c')](_0x14d4aa['query']['fields']));_0x34d190[_0xb2a6('0x2d')]=_0x34d190[_0xb2a6('0x2d')][_0xb2a6('0x2e')]?_0x34d190[_0xb2a6('0x2d')]:_0xe67456['model'];if(_0x14d4aa[_0xb2a6('0x25')][_0xb2a6('0x2f')]){_0x34d190[_0xb2a6('0x24')]=[{'all':!![]}];}_0x34d190=_[_0xb2a6('0x30')]({},_0x34d190,_0x14d4aa[_0xb2a6('0x31')]);return db[_0xb2a6('0x1e')][_0xb2a6('0x32')](_0x34d190)[_0xb2a6('0x15')](handleEntityNotFound(_0x465af2,null))[_0xb2a6('0x15')](respondWithResult(_0x465af2,null))[_0xb2a6('0x33')](handleError(_0x465af2,null));};exports[_0xb2a6('0x34')]=function(_0x54ce38,_0x5da384){return db[_0xb2a6('0x1e')][_0xb2a6('0x34')](_0x54ce38[_0xb2a6('0x35')],{})[_0xb2a6('0x15')](function(_0x5bd947){var _0x261477=_0x54ce38[_0xb2a6('0x36')][_0xb2a6('0x17')]({'plain':!![]});if(!_0x261477)throw new Error(_0xb2a6('0x37'));if(_0x261477[_0xb2a6('0x38')]===_0xb2a6('0x36')){var _0x137b0e=_0x5bd947[_0xb2a6('0x17')]({'plain':!![]});var _0x57d0e6=_0xb2a6('0x18');return db['UserProfileSection'][_0xb2a6('0x32')]({'where':{'name':_0x57d0e6,'userProfileId':_0x261477[_0xb2a6('0x39')]},'raw':!![]})[_0xb2a6('0x15')](function(_0x4add06){if(_0x4add06&&_0x4add06['autoAssociation']===0x0){return db[_0xb2a6('0x19')]['create']({'name':_0x137b0e['name'],'resourceId':_0x137b0e['id'],'type':_0x4add06[_0xb2a6('0x1b')],'sectionId':_0x4add06['id']},{})[_0xb2a6('0x15')](function(){return _0x5bd947;});}else{return _0x5bd947;}})[_0xb2a6('0x33')](function(_0x56481d){logger[_0xb2a6('0x3a')](_0xb2a6('0x3b'),_0x56481d);throw _0x56481d;});}return _0x5bd947;})['then'](respondWithResult(_0x5da384,0xc9))['catch'](handleError(_0x5da384,null));};exports[_0xb2a6('0x3c')]=function(_0x4d8da9,_0x2bba27){if(_0x4d8da9[_0xb2a6('0x35')]['id']){delete _0x4d8da9['body']['id'];}return db[_0xb2a6('0x1e')][_0xb2a6('0x32')]({'where':{'id':_0x4d8da9[_0xb2a6('0x28')]['id']}})['then'](handleEntityNotFound(_0x2bba27,null))[_0xb2a6('0x15')](saveUpdates(_0x4d8da9[_0xb2a6('0x35')],null))[_0xb2a6('0x15')](respondWithResult(_0x2bba27,null))[_0xb2a6('0x33')](handleError(_0x2bba27,null));};exports['destroy']=function(_0x57c075,_0x2a98f3){return db['OpenchannelQueue']['find']({'where':{'id':_0x57c075[_0xb2a6('0x28')]['id']}})['then'](handleEntityNotFound(_0x2a98f3,null))[_0xb2a6('0x15')](removeEntity(_0x2a98f3,null))[_0xb2a6('0x33')](handleError(_0x2a98f3,null));};exports[_0xb2a6('0x3d')]=function(_0x2cb3a4,_0x755b61){return db[_0xb2a6('0x1e')][_0xb2a6('0x3d')]()[_0xb2a6('0x15')](respondWithResult(_0x755b61,null))[_0xb2a6('0x33')](handleError(_0x755b61,null));};exports[_0xb2a6('0x3e')]=function(_0xd583ef,_0x462aef){var _0x4083ba={'raw':!![],'where':{}},_0xb9ef1f={},_0x633963;return db[_0xb2a6('0x1e')]['findOne']({'where':{'id':_0xd583ef[_0xb2a6('0x28')]['id']}})[_0xb2a6('0x15')](handleEntityNotFound(_0x462aef,null))[_0xb2a6('0x15')](function(_0x32776a){if(_0x32776a){_0x633963=_0x32776a['get']({'plain':!![]});_0xb9ef1f['model']=_['keys'](db[_0xb2a6('0x3f')][_0xb2a6('0x1f')]);_0xb9ef1f['query']=_[_0xb2a6('0x2a')](_0xd583ef[_0xb2a6('0x25')]);_0xb9ef1f[_0xb2a6('0x2b')]=_['intersection'](_0xb9ef1f['model'],_0xb9ef1f[_0xb2a6('0x25')]);_0x4083ba['attributes']=_[_0xb2a6('0x40')](_0xb9ef1f[_0xb2a6('0x29')],qs[_0xb2a6('0x2c')](_0xd583ef[_0xb2a6('0x25')]['fields']));_0x4083ba[_0xb2a6('0x2d')]=_0x4083ba[_0xb2a6('0x2d')]['length']?_0x4083ba[_0xb2a6('0x2d')]:_0xb9ef1f['model'];if(!_0xd583ef[_0xb2a6('0x25')][_0xb2a6('0x41')](_0xb2a6('0x42'))){_0x4083ba['limit']=qs[_0xb2a6('0x10')](_0xd583ef[_0xb2a6('0x25')][_0xb2a6('0x10')]);_0x4083ba[_0xb2a6('0xe')]=qs[_0xb2a6('0xe')](_0xd583ef[_0xb2a6('0x25')]['offset']);}_0x4083ba[_0xb2a6('0x43')]=qs[_0xb2a6('0x44')](_0xd583ef[_0xb2a6('0x25')][_0xb2a6('0x44')]);_0x4083ba[_0xb2a6('0x23')]=qs[_0xb2a6('0x2b')](_[_0xb2a6('0x45')](_0xd583ef[_0xb2a6('0x25')],_0xb9ef1f[_0xb2a6('0x2b')]));_0x4083ba['where']['OpenchannelQueueId']=_0x32776a['id'];if(_0xd583ef['query'][_0xb2a6('0x46')]){_0x4083ba['where']=_[_0xb2a6('0x30')](_0x4083ba['where'],{'$or':_[_0xb2a6('0x47')](_0x4083ba[_0xb2a6('0x2d')],function(_0x291512){var _0x1da491={};_0x1da491[_0x291512]={'$like':'%'+_0xd583ef[_0xb2a6('0x25')]['filter']+'%'};return _0x1da491;})});}_0x4083ba=_[_0xb2a6('0x30')]({},_0x4083ba,_0xd583ef[_0xb2a6('0x31')]);return db[_0xb2a6('0x3f')][_0xb2a6('0x48')](_0x4083ba);}})[_0xb2a6('0x15')](function(_0x371874){if(_0x371874){return db[_0xb2a6('0x49')]['findAndCountAll']({'where':{'id':_[_0xb2a6('0x47')](_0x371874,_0xb2a6('0x4a')),'role':_0xb2a6('0x4b')},'attributes':['id',_0xb2a6('0x1b'),_0xb2a6('0x4c'),'updatedAt',_0xb2a6('0x4d')]});}})['then'](function(_0x3e53a7){if(_0x3e53a7){return{'count':_0x3e53a7[_0xb2a6('0x11')],'rows':_[_0xb2a6('0x47')](_0x3e53a7['rows'],function(_0x4adc38){return{'membername':_0x4adc38[_0xb2a6('0x1b')],'UserId':_0x4adc38['id'],'queue_name':_0x633963['name'],'OpenchannelQueueId':_0x633963['id'],'interface':util[_0xb2a6('0x4e')]('%s/%s','SIP',_0x4adc38['name']),'penalty':0x0,'paused':_0x4adc38[_0xb2a6('0x4c')],'createdAt':_0x4adc38[_0xb2a6('0x4d')],'updatedAt':_0x4adc38['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x462aef,_0x4083ba))[_0xb2a6('0x33')](handleError(_0x462aef,null));};exports[_0xb2a6('0x4f')]=function(_0x427537,_0x1e4c4a){var _0x5b99b1={};var _0xe21432={};var _0x4f72c8;var _0x4a3750;return db['OpenchannelQueue'][_0xb2a6('0x50')]({'where':{'id':_0x427537[_0xb2a6('0x28')]['id']}})[_0xb2a6('0x15')](handleEntityNotFound(_0x1e4c4a,null))[_0xb2a6('0x15')](function(_0x321be5){if(_0x321be5){_0x4f72c8=_0x321be5;_0xe21432[_0xb2a6('0x29')]=_[_0xb2a6('0x2a')](db['Team'][_0xb2a6('0x1f')]);_0xe21432[_0xb2a6('0x25')]=_[_0xb2a6('0x2a')](_0x427537[_0xb2a6('0x25')]);_0xe21432['filters']=_[_0xb2a6('0x40')](_0xe21432[_0xb2a6('0x29')],_0xe21432[_0xb2a6('0x25')]);_0x5b99b1[_0xb2a6('0x2d')]=_['intersection'](_0xe21432['model'],qs[_0xb2a6('0x2c')](_0x427537[_0xb2a6('0x25')][_0xb2a6('0x2c')]));_0x5b99b1[_0xb2a6('0x2d')]=_0x5b99b1['attributes'][_0xb2a6('0x2e')]?_0x5b99b1[_0xb2a6('0x2d')]:_0xe21432['model'];_0x5b99b1[_0xb2a6('0x43')]=qs['sort'](_0x427537[_0xb2a6('0x25')][_0xb2a6('0x44')]);_0x5b99b1[_0xb2a6('0x23')]=qs[_0xb2a6('0x2b')](_['pick'](_0x427537[_0xb2a6('0x25')],_0xe21432[_0xb2a6('0x2b')]));if(_0x427537[_0xb2a6('0x25')][_0xb2a6('0x46')]){_0x5b99b1['where']=_['merge'](_0x5b99b1[_0xb2a6('0x23')],{'$or':_[_0xb2a6('0x47')](_0x5b99b1[_0xb2a6('0x2d')],function(_0x262ba9){var _0x3eeed2={};_0x3eeed2[_0x262ba9]={'$like':'%'+_0x427537['query'][_0xb2a6('0x46')]+'%'};return _0x3eeed2;})});}_0x5b99b1=_[_0xb2a6('0x30')]({},_0x5b99b1,_0x427537[_0xb2a6('0x31')]);return _0x4f72c8['getTeams'](_0x5b99b1);}})[_0xb2a6('0x15')](function(_0x1aae83){if(_0x1aae83){_0x4a3750=_0x1aae83[_0xb2a6('0x2e')];if(!_0x427537[_0xb2a6('0x25')]['hasOwnProperty'](_0xb2a6('0x42'))){_0x5b99b1[_0xb2a6('0x10')]=qs[_0xb2a6('0x10')](_0x427537[_0xb2a6('0x25')][_0xb2a6('0x10')]);_0x5b99b1[_0xb2a6('0xe')]=qs['offset'](_0x427537[_0xb2a6('0x25')]['offset']);}return _0x4f72c8[_0xb2a6('0x4f')](_0x5b99b1);}})[_0xb2a6('0x15')](function(_0x19bbda){if(_0x19bbda){return _0x19bbda?{'count':_0x4a3750,'rows':_0x19bbda}:null;}})['then'](respondWithResult(_0x1e4c4a,null))['catch'](handleError(_0x1e4c4a,null));};exports[_0xb2a6('0x51')]=function(_0x981768,_0xdeccbe){var _0x57c3e7=_0x981768[_0xb2a6('0x35')][_0xb2a6('0x52')];return db[_0xb2a6('0x53')]['findAll']({'where':{'id':_0x57c3e7},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb2a6('0x54'),'attributes':['id','name','online','voicePause',_0xb2a6('0x55')],'raw':!![]}]})[_0xb2a6('0x15')](function(_0x44b407){if(_0x44b407){var _0x2544e2=_[_0xb2a6('0x56')](_0x44b407,function(_0x3a2514){var _0x1ad08f=_0x3a2514['get']({'plain':!![]});return _0x1ad08f[_0xb2a6('0x54')];});return db[_0xb2a6('0x1e')][_0xb2a6('0x32')]({'where':{'id':_0x981768[_0xb2a6('0x28')]['id']}})[_0xb2a6('0x15')](function(_0x14eaec){return db[_0xb2a6('0x57')]['transaction'](function(_0xc6d282){return _0x14eaec[_0xb2a6('0x51')](_0x57c3e7,{'transaction':_0xc6d282})['then'](function(){return BPromise['each'](_0x2544e2,function(_0x234c66){return db[_0xb2a6('0x3f')][_0xb2a6('0x58')]({'where':{'UserId':_0x234c66['id'],'OpenchannelQueueId':_0x981768[_0xb2a6('0x28')]['id']},'transaction':_0xc6d282});});})['then'](function(){_0x2544e2[_0xb2a6('0x59')](function(_0x474d86){socket[_0xb2a6('0x5a')](_0xb2a6('0x5b'),{'UserId':_0x474d86['id'],'OpenchannelQueueId':_0x14eaec['id']});});});});});}})[_0xb2a6('0x15')](respondWithStatusCode(_0xdeccbe,null))[_0xb2a6('0x33')](handleError(_0xdeccbe,null));};exports[_0xb2a6('0x5c')]=function(_0x4c15e5,_0x4f0e17){return db[_0xb2a6('0x53')]['findAll']({'where':{'id':_0x4c15e5[_0xb2a6('0x25')][_0xb2a6('0x52')]},'attributes':['id'],'include':[{'model':db[_0xb2a6('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4f0e17,null))[_0xb2a6('0x15')](function(_0x2b6acf){var _0x4812a6=_['map'](_0x2b6acf,'id');var _0x3db285=[];var _0x2a6c76=[];var _0x2abc86=squel[_0xb2a6('0x5d')]();_0x2abc86[_0xb2a6('0x5e')](_0xb2a6('0x5f'))[_0xb2a6('0x60')](_0xb2a6('0x61'),'tq')['join'](_0xb2a6('0x62'),'ut',_0xb2a6('0x63'))[_0xb2a6('0x23')]('OpenchannelQueueId\x20=\x20?',_0x4c15e5[_0xb2a6('0x28')]['id']);for(var _0x4556b4=0x0;_0x4556b4<_0x2b6acf['length'];_0x4556b4+=0x1){let _0x58f1d2=_0x2b6acf[_0x4556b4];for(var _0x4909e8=0x0;_0x4909e8<_0x58f1d2[_0xb2a6('0x54')]['length'];_0x4909e8+=0x1){let _0x579ff9=_0x58f1d2[_0xb2a6('0x54')][_0x4909e8];var _0x1b02c9=_0x2abc86[_0xb2a6('0x64')]();_0x1b02c9[_0xb2a6('0x23')](_0xb2a6('0x65'),_0x579ff9['id']);_0x2a6c76[_0xb2a6('0x66')](db['sequelize'][_0xb2a6('0x25')](_0x1b02c9[_0xb2a6('0x67')](),{'type':db['sequelize']['QueryTypes'][_0xb2a6('0x68')]})[_0xb2a6('0x15')](function(_0x17d376){if(_0x17d376[_0xb2a6('0x2e')]===0x1){return _0x579ff9['id'];}else{var _0x51ce0c=_[_0xb2a6('0x69')](_[_0xb2a6('0x47')](_0x17d376,_0xb2a6('0x6a')),function(_0x321978){return _[_0xb2a6('0x6b')](_0x4812a6,_0x321978);});if(_0x51ce0c){return _0x579ff9['id'];}}}));}}return BPromise[_0xb2a6('0x6c')](_0x2a6c76)[_0xb2a6('0x15')](function(_0x572694){_0x3db285=_(_0x3db285)[_0xb2a6('0x6d')](_0x572694)[_0xb2a6('0x6e')]()[_0xb2a6('0x6f')]();return db[_0xb2a6('0x1e')]['find']({'where':{'id':_0x4c15e5[_0xb2a6('0x28')]['id']}})[_0xb2a6('0x15')](function(_0x4c3d6d){return db[_0xb2a6('0x57')][_0xb2a6('0x70')](function(_0xa03d1c){return _0x4c3d6d[_0xb2a6('0x5c')](_0x4c15e5[_0xb2a6('0x25')][_0xb2a6('0x52')],{'transaction':_0xa03d1c})[_0xb2a6('0x15')](function(){if(!_[_0xb2a6('0x71')](_0x3db285)){return _0x4c3d6d[_0xb2a6('0x72')](_0x3db285,{'transaction':_0xa03d1c});}})[_0xb2a6('0x15')](function(){_0x3db285['forEach'](function(_0x2e7f53){socket[_0xb2a6('0x5a')]('userOpenchannelQueue:remove',{'UserId':_0x2e7f53,'OpenchannelQueueId':_0x4c3d6d['id']});});});});});});})[_0xb2a6('0x15')](respondWithStatusCode(_0x4f0e17,null))[_0xb2a6('0x33')](handleError(_0x4f0e17,null));};exports['addAgents']=function(_0x43ce83,_0x5f2842){return db['OpenchannelQueue'][_0xb2a6('0x32')]({'where':{'id':_0x43ce83['params']['id']}})[_0xb2a6('0x15')](handleEntityNotFound(_0x5f2842,null))[_0xb2a6('0x15')](function(_0x50f3f4){if(_0x50f3f4){return _0x50f3f4[_0xb2a6('0x73')](_0x43ce83[_0xb2a6('0x35')][_0xb2a6('0x52')],_['omit'](_0x43ce83[_0xb2a6('0x35')],[_0xb2a6('0x52'),'id'])||{})[_0xb2a6('0x74')](function(_0x5e0ee7){for(var _0x23eb14=0x0;_0x23eb14<_0x43ce83[_0xb2a6('0x35')][_0xb2a6('0x52')][_0xb2a6('0x2e')];_0x23eb14+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x43ce83[_0xb2a6('0x35')][_0xb2a6('0x52')][_0x23eb14]),'OpenchannelQueueId':Number(_0x43ce83['params']['id'])});}return _0x5e0ee7;});}})[_0xb2a6('0x15')](respondWithResult(_0x5f2842,null))[_0xb2a6('0x33')](handleError(_0x5f2842,null));};exports['removeAgents']=function(_0x365e1b,_0x16dd8c){return db[_0xb2a6('0x1e')][_0xb2a6('0x32')]({'where':{'id':_0x365e1b['params']['id']}})[_0xb2a6('0x15')](handleEntityNotFound(_0x16dd8c,null))[_0xb2a6('0x15')](function(_0x322b65){if(_0x322b65){return _0x322b65[_0xb2a6('0x72')](_0x365e1b[_0xb2a6('0x25')][_0xb2a6('0x52')])[_0xb2a6('0x15')](function(){if(_[_0xb2a6('0x75')](_0x365e1b[_0xb2a6('0x25')]['ids'])){for(var _0x3c05d7=0x0;_0x3c05d7<_0x365e1b['query'][_0xb2a6('0x52')][_0xb2a6('0x2e')];_0x3c05d7+=0x1){socket[_0xb2a6('0x5a')](_0xb2a6('0x76'),{'UserId':Number(_0x365e1b[_0xb2a6('0x25')][_0xb2a6('0x52')][_0x3c05d7]),'OpenchannelQueueId':Number(_0x365e1b[_0xb2a6('0x28')]['id'])});}}else{socket[_0xb2a6('0x5a')](_0xb2a6('0x76'),{'UserId':Number(_0x365e1b['query']['ids']),'OpenchannelQueueId':Number(_0x365e1b[_0xb2a6('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x16dd8c,null))[_0xb2a6('0x33')](handleError(_0x16dd8c,null));};exports[_0xb2a6('0x77')]=function(_0x46e9aa,_0x216499){var _0x41eba8={};var _0xdb70b8={};var _0x40b1df;var _0x189ec4;return db[_0xb2a6('0x1e')]['findOne']({'where':{'id':_0x46e9aa[_0xb2a6('0x28')]['id']}})['then'](handleEntityNotFound(_0x216499,null))['then'](function(_0x356993){if(_0x356993){_0x40b1df=_0x356993;_0xdb70b8[_0xb2a6('0x29')]=_[_0xb2a6('0x2a')](db[_0xb2a6('0x49')][_0xb2a6('0x1f')]);_0xdb70b8[_0xb2a6('0x25')]=_['keys'](_0x46e9aa['query']);_0xdb70b8[_0xb2a6('0x2b')]=_['intersection'](_0xdb70b8[_0xb2a6('0x29')],_0xdb70b8[_0xb2a6('0x25')]);_0x41eba8['attributes']=_[_0xb2a6('0x40')](_0xdb70b8[_0xb2a6('0x29')],qs['fields'](_0x46e9aa['query'][_0xb2a6('0x2c')]));_0x41eba8[_0xb2a6('0x2d')]=_0x41eba8['attributes'][_0xb2a6('0x2e')]?_0x41eba8[_0xb2a6('0x2d')]:_0xdb70b8['model'];_0x41eba8[_0xb2a6('0x43')]=qs[_0xb2a6('0x44')](_0x46e9aa[_0xb2a6('0x25')][_0xb2a6('0x44')]);_0x41eba8[_0xb2a6('0x23')]=qs[_0xb2a6('0x2b')](_[_0xb2a6('0x45')](_0x46e9aa[_0xb2a6('0x25')],_0xdb70b8[_0xb2a6('0x2b')]));if(_0x46e9aa['query'][_0xb2a6('0x46')]){_0x41eba8[_0xb2a6('0x23')]=_[_0xb2a6('0x30')](_0x41eba8[_0xb2a6('0x23')],{'$or':_[_0xb2a6('0x47')](_0x41eba8[_0xb2a6('0x2d')],function(_0x5006ef){var _0x50da6b={};_0x50da6b[_0x5006ef]={'$like':'%'+_0x46e9aa[_0xb2a6('0x25')][_0xb2a6('0x46')]+'%'};return _0x50da6b;})});}_0x41eba8=_[_0xb2a6('0x30')]({},_0x41eba8,_0x46e9aa['options']);return _0x40b1df[_0xb2a6('0x77')](_0x41eba8);}})[_0xb2a6('0x15')](function(_0x5e70e3){if(_0x5e70e3){_0x189ec4=_0x5e70e3[_0xb2a6('0x2e')];if(!_0x46e9aa['query'][_0xb2a6('0x41')](_0xb2a6('0x42'))){_0x41eba8['limit']=qs[_0xb2a6('0x10')](_0x46e9aa[_0xb2a6('0x25')][_0xb2a6('0x10')]);_0x41eba8[_0xb2a6('0xe')]=qs[_0xb2a6('0xe')](_0x46e9aa[_0xb2a6('0x25')]['offset']);}return _0x40b1df['getAgents'](_0x41eba8);}})['then'](function(_0x3474f8){if(_0x3474f8){return _0x3474f8?{'count':_0x189ec4,'rows':_0x3474f8}:null;}})[_0xb2a6('0x15')](respondWithResult(_0x216499,null))['catch'](handleError(_0x216499,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d62a92f..949ebe1 100644 --- a/server/api/openchannelQueue/openchannelQueue.events.js +++ b/server/api/openchannelQueue/openchannelQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf76a=['OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xd4f447,_0x4e1d02){var _0x3f5115=function(_0x26e62f){while(--_0x26e62f){_0xd4f447['push'](_0xd4f447['shift']());}};_0x3f5115(++_0x4e1d02);}(_0xf76a,0xfa));var _0xaf76=function(_0x529773,_0x292c4d){_0x529773=_0x529773-0x0;var _0x17b930=_0xf76a[_0x529773];return _0x17b930;};'use strict';var EventEmitter=require(_0xaf76('0x0'));var OpenchannelQueue=require(_0xaf76('0x1'))['db'][_0xaf76('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xaf76('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaf76('0x4'),'afterDestroy':_0xaf76('0x5')};function emitEvent(_0x29f6dd){return function(_0x1f04a4,_0x508512,_0x3d9c58){OpenchannelQueueEvents['emit'](_0x29f6dd+':'+_0x1f04a4['id'],_0x1f04a4);OpenchannelQueueEvents[_0xaf76('0x6')](_0x29f6dd,_0x1f04a4);_0x3d9c58(null);};}for(var e in events){if(events[_0xaf76('0x7')](e)){var event=events[e];OpenchannelQueue[_0xaf76('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x3afc=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1eb193,_0x2dea5b){var _0x52dab2=function(_0x34005){while(--_0x34005){_0x1eb193['push'](_0x1eb193['shift']());}};_0x52dab2(++_0x2dea5b);}(_0x3afc,0x172));var _0xc3af=function(_0x5e2248,_0x140e9d){_0x5e2248=_0x5e2248-0x0;var _0x2bdb09=_0x3afc[_0x5e2248];return _0x2bdb09;};'use strict';var EventEmitter=require(_0xc3af('0x0'));var OpenchannelQueue=require(_0xc3af('0x1'))['db'][_0xc3af('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc3af('0x3')](0x0);var events={'afterCreate':_0xc3af('0x4'),'afterUpdate':'update','afterDestroy':_0xc3af('0x5')};function emitEvent(_0xdb5fd4){return function(_0xdec2e4,_0x2ed1c3,_0x33a09c){OpenchannelQueueEvents[_0xc3af('0x6')](_0xdb5fd4+':'+_0xdec2e4['id'],_0xdec2e4);OpenchannelQueueEvents[_0xc3af('0x6')](_0xdb5fd4,_0xdec2e4);_0x33a09c(null);};}for(var e in events){if(events[_0xc3af('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xc3af('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 80f8365..80a0e9e 100644 --- a/server/api/openchannelQueue/openchannelQueue.model.js +++ b/server/api/openchannelQueue/openchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5236=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x339a78,_0x19418a){var _0x2b9252=function(_0x2a53db){while(--_0x2a53db){_0x339a78['push'](_0x339a78['shift']());}};_0x2b9252(++_0x19418a);}(_0x5236,0x1d4));var _0x6523=function(_0x21e976,_0x335ac5){_0x21e976=_0x21e976-0x0;var _0x532bea=_0x5236[_0x21e976];return _0x532bea;};'use strict';var _=require(_0x6523('0x0'));var util=require(_0x6523('0x1'));var logger=require(_0x6523('0x2'))(_0x6523('0x3'));var moment=require(_0x6523('0x4'));var BPromise=require('bluebird');var rp=require(_0x6523('0x5'));var fs=require('fs');var path=require(_0x6523('0x6'));var rimraf=require('rimraf');var config=require(_0x6523('0x7'));var attributes=require(_0x6523('0x8'));module[_0x6523('0x9')]=function(_0x35fa7b,_0xb06b8b){return _0x35fa7b[_0x6523('0xa')](_0x6523('0xb'),attributes,{'tableName':_0x6523('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33a7=['bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','define','openchannel_queues','util','../../config/logger','moment'];(function(_0xed4881,_0x45771c){var _0x7fcbd5=function(_0x36b960){while(--_0x36b960){_0xed4881['push'](_0xed4881['shift']());}};_0x7fcbd5(++_0x45771c);}(_0x33a7,0x115));var _0x733a=function(_0x18776a,_0x4fecab){_0x18776a=_0x18776a-0x0;var _0x484e4a=_0x33a7[_0x18776a];return _0x484e4a;};'use strict';var _=require('lodash');var util=require(_0x733a('0x0'));var logger=require(_0x733a('0x1'))('api');var moment=require(_0x733a('0x2'));var BPromise=require(_0x733a('0x3'));var rp=require(_0x733a('0x4'));var fs=require('fs');var path=require(_0x733a('0x5'));var rimraf=require(_0x733a('0x6'));var config=require('../../config/environment');var attributes=require(_0x733a('0x7'));module['exports']=function(_0x56356f,_0x398dc2){return _0x56356f[_0x733a('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x733a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index ccd84d7..709ca62 100644 --- a/server/api/openchannelQueue/openchannelQueue.rpc.js +++ b/server/api/openchannelQueue/openchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c59=['client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetOpenchannelQueue','findAll','options','raw','limit','include','model','map','attributes','debug','ShowOpenchannelQueue','find','where','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0xbddfbf,_0x27b320){var _0x276844=function(_0x196646){while(--_0x196646){_0xbddfbf['push'](_0xbddfbf['shift']());}};_0x276844(++_0x27b320);}(_0x9c59,0x68));var _0x99c5=function(_0x5c398e,_0x42d518){_0x5c398e=_0x5c398e-0x0;var _0x17fac1=_0x9c59[_0x5c398e];return _0x17fac1;};'use strict';var _=require(_0x99c5('0x0'));var util=require('util');var moment=require(_0x99c5('0x1'));var BPromise=require('bluebird');var rs=require(_0x99c5('0x2'));var fs=require('fs');var Redis=require(_0x99c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x99c5('0x4'));var logger=require('../../config/logger')(_0x99c5('0x5'));var config=require(_0x99c5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x99c5('0x7')][_0x99c5('0x8')]({'port':0x232a});config[_0x99c5('0x9')]=_[_0x99c5('0xa')](config[_0x99c5('0x9')],{'host':_0x99c5('0xb'),'port':0x18eb});var socket=require(_0x99c5('0xc'))(new Redis(config[_0x99c5('0x9')]));require(_0x99c5('0xd'))[_0x99c5('0xe')](socket);function respondWithRpcPromise(_0x2620d1,_0x122bad,_0x13b699){return new BPromise(function(_0x4c3719,_0x3811d3){return client[_0x99c5('0xf')](_0x2620d1,_0x13b699)['then'](function(_0x13b642){logger[_0x99c5('0x10')](_0x99c5('0x11'),_0x122bad,'request\x20sent');logger['debug'](_0x99c5('0x12'),_0x122bad,_0x99c5('0x13'),JSON[_0x99c5('0x14')](_0x13b642));if(_0x13b642[_0x99c5('0x15')]){if(_0x13b642[_0x99c5('0x15')]['code']===0x1f4){logger[_0x99c5('0x15')](_0x99c5('0x11'),_0x122bad,_0x13b642['error'][_0x99c5('0x16')]);return _0x3811d3(_0x13b642['error']['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x122bad,_0x13b642[_0x99c5('0x15')][_0x99c5('0x16')]);return _0x4c3719(_0x13b642[_0x99c5('0x15')][_0x99c5('0x16')]);}else{logger[_0x99c5('0x10')](_0x99c5('0x11'),_0x122bad,'request\x20sent');_0x4c3719(_0x13b642['result'][_0x99c5('0x16')]);}})[_0x99c5('0x17')](function(_0x1fb4eb){logger[_0x99c5('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x122bad,_0x1fb4eb);_0x3811d3(_0x1fb4eb);});});}exports[_0x99c5('0x18')]=function(_0x2891ab){var _0x4a3816=this;return new Promise(function(_0x53caa8,_0x4f1368){return db['OpenchannelQueue'][_0x99c5('0x19')]({'raw':_0x2891ab[_0x99c5('0x1a')]?_0x2891ab[_0x99c5('0x1a')][_0x99c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x2891ab['options']?_0x2891ab[_0x99c5('0x1a')]['where']||null:null,'attributes':_0x2891ab[_0x99c5('0x1a')]?_0x2891ab[_0x99c5('0x1a')]['attributes']||null:null,'limit':_0x2891ab[_0x99c5('0x1a')]?_0x2891ab[_0x99c5('0x1a')][_0x99c5('0x1c')]||null:null,'include':_0x2891ab['options']?_0x2891ab[_0x99c5('0x1a')][_0x99c5('0x1d')]?_['map'](_0x2891ab[_0x99c5('0x1a')]['include'],function(_0x3c5b74){return{'model':db[_0x3c5b74[_0x99c5('0x1e')]],'as':_0x3c5b74['as'],'attributes':_0x3c5b74['attributes'],'include':_0x3c5b74[_0x99c5('0x1d')]?_[_0x99c5('0x1f')](_0x3c5b74[_0x99c5('0x1d')],function(_0x365ec1){return{'model':db[_0x365ec1[_0x99c5('0x1e')]],'as':_0x365ec1['as'],'attributes':_0x365ec1[_0x99c5('0x20')],'include':_0x365ec1[_0x99c5('0x1d')]?_[_0x99c5('0x1f')](_0x365ec1[_0x99c5('0x1d')],function(_0x2ef14f){return{'model':db[_0x2ef14f['model']],'as':_0x2ef14f['as'],'attributes':_0x2ef14f[_0x99c5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x262300){logger[_0x99c5('0x10')]('GetOpenchannelQueue',_0x2891ab);logger[_0x99c5('0x21')](_0x99c5('0x18'),_0x2891ab,JSON['stringify'](_0x262300));_0x53caa8(_0x262300);})['catch'](function(_0x388ed4){logger[_0x99c5('0x15')](_0x99c5('0x18'),_0x388ed4['message'],_0x2891ab);_0x4f1368(_0x4a3816['error'](0x1f4,_0x388ed4['message']));});});};exports[_0x99c5('0x22')]=function(_0x46e12d){var _0x21cdbb=this;return new Promise(function(_0x443d90,_0x572072){return db['OpenchannelQueue'][_0x99c5('0x23')]({'raw':_0x46e12d[_0x99c5('0x1a')]?_0x46e12d[_0x99c5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x46e12d[_0x99c5('0x1a')]?_0x46e12d['options'][_0x99c5('0x24')]||null:null,'attributes':_0x46e12d[_0x99c5('0x1a')]?_0x46e12d[_0x99c5('0x1a')][_0x99c5('0x20')]||null:null,'include':_0x46e12d['options']?_0x46e12d[_0x99c5('0x1a')][_0x99c5('0x1d')]?_[_0x99c5('0x1f')](_0x46e12d[_0x99c5('0x1a')]['include'],function(_0x2ea8f7){return{'model':db[_0x2ea8f7[_0x99c5('0x1e')]],'as':_0x2ea8f7['as'],'attributes':_0x2ea8f7[_0x99c5('0x20')],'include':_0x2ea8f7['include']?_[_0x99c5('0x1f')](_0x2ea8f7['include'],function(_0x241285){return{'model':db[_0x241285[_0x99c5('0x1e')]],'as':_0x241285['as'],'attributes':_0x241285[_0x99c5('0x20')],'include':_0x241285['include']?_[_0x99c5('0x1f')](_0x241285[_0x99c5('0x1d')],function(_0x58ac19){return{'model':db[_0x58ac19[_0x99c5('0x1e')]],'as':_0x58ac19['as'],'attributes':_0x58ac19[_0x99c5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5106fa){logger[_0x99c5('0x10')](_0x99c5('0x22'),_0x46e12d);logger[_0x99c5('0x21')](_0x99c5('0x22'),_0x46e12d,JSON[_0x99c5('0x14')](_0x5106fa));_0x443d90(_0x5106fa);})[_0x99c5('0x17')](function(_0x73a728){logger[_0x99c5('0x15')](_0x99c5('0x22'),_0x73a728[_0x99c5('0x16')],_0x46e12d);_0x572072(_0x21cdbb[_0x99c5('0x15')](0x1f4,_0x73a728[_0x99c5('0x16')]));});});}; \ No newline at end of file +var _0x4082=['../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','map','include','model','then','debug','find','where','ShowOpenchannelQueue','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x47269d,_0x3fdba1){var _0x186a6e=function(_0x38d4){while(--_0x38d4){_0x47269d['push'](_0x47269d['shift']());}};_0x186a6e(++_0x3fdba1);}(_0x4082,0x1cf));var _0x2408=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x4082[_0xbe200f];return _0x192597;};'use strict';var _=require('lodash');var util=require(_0x2408('0x0'));var moment=require('moment');var BPromise=require(_0x2408('0x1'));var rs=require(_0x2408('0x2'));var fs=require('fs');var Redis=require(_0x2408('0x3'));var db=require(_0x2408('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2408('0x5'))(_0x2408('0x6'));var config=require(_0x2408('0x7'));var jayson=require(_0x2408('0x8'));var client=jayson['client'][_0x2408('0x9')]({'port':0x232a});config['redis']=_[_0x2408('0xa')](config[_0x2408('0xb')],{'host':_0x2408('0xc'),'port':0x18eb});var socket=require(_0x2408('0xd'))(new Redis(config[_0x2408('0xb')]));require(_0x2408('0xe'))[_0x2408('0xf')](socket);function respondWithRpcPromise(_0x304b8b,_0x139d7a,_0x4ec76e){return new BPromise(function(_0x51105a,_0x40c996){return client['request'](_0x304b8b,_0x4ec76e)['then'](function(_0xdcfd65){logger[_0x2408('0x10')](_0x2408('0x11'),_0x139d7a,_0x2408('0x12'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x139d7a,_0x2408('0x12'),JSON[_0x2408('0x13')](_0xdcfd65));if(_0xdcfd65[_0x2408('0x14')]){if(_0xdcfd65[_0x2408('0x14')]['code']===0x1f4){logger[_0x2408('0x14')](_0x2408('0x11'),_0x139d7a,_0xdcfd65[_0x2408('0x14')]['message']);return _0x40c996(_0xdcfd65[_0x2408('0x14')]['message']);}logger[_0x2408('0x14')](_0x2408('0x11'),_0x139d7a,_0xdcfd65['error'][_0x2408('0x15')]);return _0x51105a(_0xdcfd65[_0x2408('0x14')]['message']);}else{logger[_0x2408('0x10')](_0x2408('0x11'),_0x139d7a,_0x2408('0x12'));_0x51105a(_0xdcfd65[_0x2408('0x16')][_0x2408('0x15')]);}})[_0x2408('0x17')](function(_0x3416f9){logger[_0x2408('0x14')](_0x2408('0x11'),_0x139d7a,_0x3416f9);_0x40c996(_0x3416f9);});});}exports[_0x2408('0x18')]=function(_0x123135){var _0x458553=this;return new Promise(function(_0x525f4c,_0x2f8e82){return db[_0x2408('0x19')][_0x2408('0x1a')]({'raw':_0x123135[_0x2408('0x1b')]?_0x123135['options'][_0x2408('0x1c')]===undefined?!![]:![]:!![],'where':_0x123135[_0x2408('0x1b')]?_0x123135[_0x2408('0x1b')]['where']||null:null,'attributes':_0x123135[_0x2408('0x1b')]?_0x123135[_0x2408('0x1b')][_0x2408('0x1d')]||null:null,'limit':_0x123135[_0x2408('0x1b')]?_0x123135[_0x2408('0x1b')][_0x2408('0x1e')]||null:null,'include':_0x123135[_0x2408('0x1b')]?_0x123135[_0x2408('0x1b')]['include']?_[_0x2408('0x1f')](_0x123135[_0x2408('0x1b')][_0x2408('0x20')],function(_0x554e70){return{'model':db[_0x554e70[_0x2408('0x21')]],'as':_0x554e70['as'],'attributes':_0x554e70['attributes'],'include':_0x554e70['include']?_['map'](_0x554e70['include'],function(_0x276961){return{'model':db[_0x276961[_0x2408('0x21')]],'as':_0x276961['as'],'attributes':_0x276961[_0x2408('0x1d')],'include':_0x276961[_0x2408('0x20')]?_[_0x2408('0x1f')](_0x276961['include'],function(_0x44f746){return{'model':db[_0x44f746[_0x2408('0x21')]],'as':_0x44f746['as'],'attributes':_0x44f746[_0x2408('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2408('0x22')](function(_0x68b86c){logger[_0x2408('0x10')]('GetOpenchannelQueue',_0x123135);logger[_0x2408('0x23')](_0x2408('0x18'),_0x123135,JSON['stringify'](_0x68b86c));_0x525f4c(_0x68b86c);})[_0x2408('0x17')](function(_0x4422f8){logger[_0x2408('0x14')](_0x2408('0x18'),_0x4422f8['message'],_0x123135);_0x2f8e82(_0x458553[_0x2408('0x14')](0x1f4,_0x4422f8[_0x2408('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x25aeaa){var _0x43f84f=this;return new Promise(function(_0x599fbd,_0x3813db){return db[_0x2408('0x19')][_0x2408('0x24')]({'raw':_0x25aeaa[_0x2408('0x1b')]?_0x25aeaa[_0x2408('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x25aeaa[_0x2408('0x1b')]?_0x25aeaa[_0x2408('0x1b')][_0x2408('0x25')]||null:null,'attributes':_0x25aeaa[_0x2408('0x1b')]?_0x25aeaa[_0x2408('0x1b')][_0x2408('0x1d')]||null:null,'include':_0x25aeaa[_0x2408('0x1b')]?_0x25aeaa[_0x2408('0x1b')][_0x2408('0x20')]?_['map'](_0x25aeaa[_0x2408('0x1b')][_0x2408('0x20')],function(_0x497706){return{'model':db[_0x497706[_0x2408('0x21')]],'as':_0x497706['as'],'attributes':_0x497706['attributes'],'include':_0x497706[_0x2408('0x20')]?_[_0x2408('0x1f')](_0x497706[_0x2408('0x20')],function(_0x3d96d7){return{'model':db[_0x3d96d7[_0x2408('0x21')]],'as':_0x3d96d7['as'],'attributes':_0x3d96d7['attributes'],'include':_0x3d96d7[_0x2408('0x20')]?_['map'](_0x3d96d7[_0x2408('0x20')],function(_0x5accf8){return{'model':db[_0x5accf8[_0x2408('0x21')]],'as':_0x5accf8['as'],'attributes':_0x5accf8[_0x2408('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50addc){logger[_0x2408('0x10')](_0x2408('0x26'),_0x25aeaa);logger[_0x2408('0x23')](_0x2408('0x26'),_0x25aeaa,JSON[_0x2408('0x13')](_0x50addc));_0x599fbd(_0x50addc);})[_0x2408('0x17')](function(_0x2f0bde){logger['error'](_0x2408('0x26'),_0x2f0bde[_0x2408('0x15')],_0x25aeaa);_0x3813db(_0x43f84f[_0x2408('0x14')](0x1f4,_0x2f0bde[_0x2408('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c2ed0b0..c7aa6bb 100644 --- a/server/api/openchannelQueue/openchannelQueue.socket.js +++ b/server/api/openchannelQueue/openchannelQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9568=['emit','removeListener','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x1daf2e,_0x1c2415){var _0x3b1148=function(_0x510527){while(--_0x510527){_0x1daf2e['push'](_0x1daf2e['shift']());}};_0x3b1148(++_0x1c2415);}(_0x9568,0xc7));var _0x8956=function(_0x482393,_0x355061){_0x482393=_0x482393-0x0;var _0x4c07ae=_0x9568[_0x482393];return _0x4c07ae;};'use strict';var OpenchannelQueueEvents=require(_0x8956('0x0'));var events=[_0x8956('0x1'),_0x8956('0x2'),_0x8956('0x3')];function createListener(_0x31185d,_0x5c43e7){return function(_0x5d8f5b){_0x5c43e7[_0x8956('0x4')](_0x31185d,_0x5d8f5b);};}function removeListener(_0x2d9297,_0x567bea){return function(){OpenchannelQueueEvents[_0x8956('0x5')](_0x2d9297,_0x567bea);};}exports['register']=function(_0x3bc61b){for(var _0x20393b=0x0,_0x220b36=events['length'];_0x20393b<_0x220b36;_0x20393b++){var _0x100d13=events[_0x20393b];var _0x4b907d=createListener(_0x8956('0x6')+_0x100d13,_0x3bc61b);OpenchannelQueueEvents['on'](_0x100d13,_0x4b907d);}}; \ No newline at end of file +var _0xc3cd=['./openchannelQueue.events','remove','update','removeListener','length','openchannelQueue:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc3cd,0x186));var _0xdc3c=function(_0x2c2b74,_0x47e891){_0x2c2b74=_0x2c2b74-0x0;var _0x27cb17=_0xc3cd[_0x2c2b74];return _0x27cb17;};'use strict';var OpenchannelQueueEvents=require(_0xdc3c('0x0'));var events=['save',_0xdc3c('0x1'),_0xdc3c('0x2')];function createListener(_0x4dfa6a,_0x5a985f){return function(_0x3867ed){_0x5a985f['emit'](_0x4dfa6a,_0x3867ed);};}function removeListener(_0x33d5a0,_0x33d0ea){return function(){OpenchannelQueueEvents[_0xdc3c('0x3')](_0x33d5a0,_0x33d0ea);};}exports['register']=function(_0x5e75d8){for(var _0x139029=0x0,_0x47f400=events[_0xdc3c('0x4')];_0x139029<_0x47f400;_0x139029++){var _0x49cc7d=events[_0x139029];var _0x44c563=createListener(_0xdc3c('0x5')+_0x49cc7d,_0x5e75d8);OpenchannelQueueEvents['on'](_0x49cc7d,_0x44c563);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index c6d7995..c37b6b7 100644 --- a/server/api/openchannelQueueReport/index.js +++ b/server/api/openchannelQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d6f=['/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5488cc,_0x57b187){var _0xa8962e=function(_0x4be4d5){while(--_0x4be4d5){_0x5488cc['push'](_0x5488cc['shift']());}};_0xa8962e(++_0x57b187);}(_0x7d6f,0x126));var _0xf7d6=function(_0x188d50,_0x4e8f69){_0x188d50=_0x188d50-0x0;var _0x18a3d3=_0x7d6f[_0x188d50];return _0x18a3d3;};'use strict';var multer=require('multer');var util=require(_0xf7d6('0x0'));var path=require(_0xf7d6('0x1'));var timeout=require(_0xf7d6('0x2'));var express=require(_0xf7d6('0x3'));var router=express[_0xf7d6('0x4')]();var fs_extra=require(_0xf7d6('0x5'));var auth=require(_0xf7d6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf7d6('0x7'));var controller=require(_0xf7d6('0x8'));router[_0xf7d6('0x9')]('/',auth[_0xf7d6('0xa')](),controller[_0xf7d6('0xb')]);router[_0xf7d6('0x9')](_0xf7d6('0xc'),auth[_0xf7d6('0xa')](),controller[_0xf7d6('0xd')]);router[_0xf7d6('0x9')](_0xf7d6('0xe'),auth['isAuthenticated'](),controller[_0xf7d6('0xf')]);router[_0xf7d6('0x10')]('/',auth[_0xf7d6('0xa')](),controller[_0xf7d6('0x11')]);router[_0xf7d6('0x12')](_0xf7d6('0xe'),auth[_0xf7d6('0xa')](),controller['update']);router[_0xf7d6('0x13')]('/:id',auth[_0xf7d6('0xa')](),controller[_0xf7d6('0x14')]);module[_0xf7d6('0x15')]=router; \ No newline at end of file +var _0x8246=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path'];(function(_0x4f4ee0,_0x16d4a4){var _0x19fc3f=function(_0x2b9d42){while(--_0x2b9d42){_0x4f4ee0['push'](_0x4f4ee0['shift']());}};_0x19fc3f(++_0x16d4a4);}(_0x8246,0xd0));var _0x6824=function(_0x56d6de,_0xa3500d){_0x56d6de=_0x56d6de-0x0;var _0x437187=_0x8246[_0x56d6de];return _0x437187;};'use strict';var multer=require('multer');var util=require(_0x6824('0x0'));var path=require(_0x6824('0x1'));var timeout=require(_0x6824('0x2'));var express=require(_0x6824('0x3'));var router=express[_0x6824('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6824('0x5'));var interaction=require(_0x6824('0x6'));var config=require('../../config/environment');var controller=require(_0x6824('0x7'));router['get']('/',auth[_0x6824('0x8')](),controller[_0x6824('0x9')]);router[_0x6824('0xa')](_0x6824('0xb'),auth['isAuthenticated'](),controller[_0x6824('0xc')]);router[_0x6824('0xa')](_0x6824('0xd'),auth['isAuthenticated'](),controller[_0x6824('0xe')]);router[_0x6824('0xf')]('/',auth[_0x6824('0x8')](),controller[_0x6824('0x10')]);router[_0x6824('0x11')](_0x6824('0xd'),auth[_0x6824('0x8')](),controller[_0x6824('0x12')]);router[_0x6824('0x13')](_0x6824('0xd'),auth[_0x6824('0x8')](),controller['destroy']);module[_0x6824('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 4f972f0..04d6bfa 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4840=['sequelize','exports','STRING','DATE','moment'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x4840,0x6d));var _0x0484=function(_0x200960,_0x36ea91){_0x200960=_0x200960-0x0;var _0x188d9f=_0x4840[_0x200960];return _0x188d9f;};'use strict';var moment=require(_0x0484('0x0'));var Sequelize=require(_0x0484('0x1'));module[_0x0484('0x2')]={'uniqueid':{'type':Sequelize[_0x0484('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0484('0x3')]},'joinAt':{'type':Sequelize[_0x0484('0x4')]},'leaveAt':{'type':Sequelize[_0x0484('0x4')]},'acceptAt':{'type':Sequelize[_0x0484('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0484('0x3')]}}; \ No newline at end of file +var _0xf1a0=['DATE','exports','STRING'];(function(_0x37862a,_0x2bc98e){var _0x5b0104=function(_0x391413){while(--_0x391413){_0x37862a['push'](_0x37862a['shift']());}};_0x5b0104(++_0x2bc98e);}(_0xf1a0,0x1a2));var _0x0f1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1a0[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x0f1a('0x0')]={'uniqueid':{'type':Sequelize[_0x0f1a('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0f1a('0x2')]},'leaveAt':{'type':Sequelize[_0x0f1a('0x2')]},'acceptAt':{'type':Sequelize[_0x0f1a('0x2')]},'exitAt':{'type':Sequelize[_0x0f1a('0x2')]},'reason':{'type':Sequelize[_0x0f1a('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 09aa6e2..337a7c3 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc25c=['Content-Range','reject','save','update','then','destroy','error','stack','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','findAll','catch','params','includeAll','include','merge','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0xc25c,0x105));var _0xcc25=function(_0x37c44e,_0x5eb96f){_0x37c44e=_0x37c44e-0x0;var _0x10a9db=_0xc25c[_0x37c44e];return _0x10a9db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc25('0x0'));var zipdir=require(_0xcc25('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc25('0x2'));var moment=require(_0xcc25('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc25('0x4'));var util=require(_0xcc25('0x5'));var path=require(_0xcc25('0x6'));var sox=require(_0xcc25('0x7'));var csv=require(_0xcc25('0x8'));var ejs=require(_0xcc25('0x9'));var fs=require('fs');var fs_extra=require(_0xcc25('0xa'));var _=require(_0xcc25('0xb'));var squel=require(_0xcc25('0xc'));var crypto=require(_0xcc25('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcc25('0xe'));var toCsv=require(_0xcc25('0x8'));var querystring=require(_0xcc25('0xf'));var Papa=require(_0xcc25('0x10'));var Redis=require(_0xcc25('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcc25('0x12'));var as=require(_0xcc25('0x13'));var hardwareService=require(_0xcc25('0x14'));var logger=require(_0xcc25('0x15'))(_0xcc25('0x16'));var utils=require('../../config/utils');var config=require(_0xcc25('0x17'));var licenseUtil=require(_0xcc25('0x18'));var db=require(_0xcc25('0x19'))['db'];function respondWithStatusCode(_0x455061,_0x19f8c0){_0x19f8c0=_0x19f8c0||0xcc;return function(_0x1f3136){if(_0x1f3136){return _0x455061[_0xcc25('0x1a')](_0x19f8c0);}return _0x455061['status'](_0x19f8c0)[_0xcc25('0x1b')]();};}function respondWithResult(_0x49ce31,_0x498247){_0x498247=_0x498247||0xc8;return function(_0x8e81a1){if(_0x8e81a1){return _0x49ce31[_0xcc25('0x1c')](_0x498247)[_0xcc25('0x1d')](_0x8e81a1);}};}function respondWithFilteredResult(_0x5875d9,_0xf4eef){return function(_0x3d1100){if(_0x3d1100){var _0x3d79f5=typeof _0xf4eef[_0xcc25('0x1e')]===_0xcc25('0x1f')&&typeof _0xf4eef[_0xcc25('0x20')]===_0xcc25('0x1f');var _0x132372=_0x3d1100[_0xcc25('0x21')];var _0x487826=_0x3d79f5?0x0:_0xf4eef[_0xcc25('0x1e')];var _0x5a1351=_0x3d79f5?_0x3d1100[_0xcc25('0x21')]:_0xf4eef[_0xcc25('0x1e')]+_0xf4eef['limit'];var _0x5b2978;if(_0x5a1351>=_0x132372){_0x5a1351=_0x132372;_0x5b2978=0xc8;}else{_0x5b2978=0xce;}_0x5875d9[_0xcc25('0x1c')](_0x5b2978);return _0x5875d9[_0xcc25('0x22')](_0xcc25('0x23'),_0x487826+'-'+_0x5a1351+'/'+_0x132372)[_0xcc25('0x1d')](_0x3d1100);}return null;};}function patchUpdates(_0x143181){return function(_0x3fd1df){try{jsonpatch['apply'](_0x3fd1df,_0x143181,!![]);}catch(_0x5bc50c){return BPromise[_0xcc25('0x24')](_0x5bc50c);}return _0x3fd1df[_0xcc25('0x25')]();};}function saveUpdates(_0x343cc9,_0x4457f4){return function(_0x1103b7){if(_0x1103b7){return _0x1103b7[_0xcc25('0x26')](_0x343cc9)[_0xcc25('0x27')](function(_0x453201){return _0x453201;});}return null;};}function removeEntity(_0xaa3ea6,_0x4a3795){return function(_0x42da9f){if(_0x42da9f){return _0x42da9f[_0xcc25('0x28')]()[_0xcc25('0x27')](function(){_0xaa3ea6['status'](0xcc)[_0xcc25('0x1b')]();});}};}function handleEntityNotFound(_0xaa329e,_0x11cfdc){return function(_0x5c18e6){if(!_0x5c18e6){_0xaa329e[_0xcc25('0x1a')](0x194);}return _0x5c18e6;};}function handleError(_0x8f6592,_0x4ff544){_0x4ff544=_0x4ff544||0x1f4;return function(_0x80b86e){logger[_0xcc25('0x29')](_0x80b86e[_0xcc25('0x2a')]);if(_0x80b86e['name']){delete _0x80b86e['name'];}_0x8f6592[_0xcc25('0x1c')](_0x4ff544)[_0xcc25('0x2b')](_0x80b86e);};}exports['index']=function(_0x4bd144,_0x6207f2){var _0x2dc79f={},_0x115e06={},_0x26a5ed={'count':0x0,'rows':[]};var _0x291891=_[_0xcc25('0x2c')](db[_0xcc25('0x2d')][_0xcc25('0x2e')],function(_0x49a7f4){return{'name':_0x49a7f4[_0xcc25('0x2f')],'type':_0x49a7f4[_0xcc25('0x30')][_0xcc25('0x31')]};});_0x115e06[_0xcc25('0x32')]=_['map'](_0x291891,_0xcc25('0x33'));_0x115e06[_0xcc25('0x34')]=_[_0xcc25('0x35')](_0x4bd144[_0xcc25('0x34')]);_0x115e06[_0xcc25('0x36')]=_[_0xcc25('0x37')](_0x115e06[_0xcc25('0x32')],_0x115e06[_0xcc25('0x34')]);_0x2dc79f[_0xcc25('0x38')]=_[_0xcc25('0x37')](_0x115e06['model'],qs[_0xcc25('0x39')](_0x4bd144[_0xcc25('0x34')]['fields']));_0x2dc79f[_0xcc25('0x38')]=_0x2dc79f[_0xcc25('0x38')][_0xcc25('0x3a')]?_0x2dc79f[_0xcc25('0x38')]:_0x115e06[_0xcc25('0x32')];if(!_0x4bd144[_0xcc25('0x34')][_0xcc25('0x3b')]('nolimit')){_0x2dc79f[_0xcc25('0x20')]=qs['limit'](_0x4bd144['query'][_0xcc25('0x20')]);_0x2dc79f['offset']=qs['offset'](_0x4bd144['query']['offset']);}_0x2dc79f[_0xcc25('0x3c')]=qs['sort'](_0x4bd144[_0xcc25('0x34')][_0xcc25('0x3d')]);_0x2dc79f['where']=qs[_0xcc25('0x36')](_['pick'](_0x4bd144[_0xcc25('0x34')],_0x115e06[_0xcc25('0x36')]),_0x291891);if(_0x4bd144[_0xcc25('0x34')]['filter']){_0x2dc79f[_0xcc25('0x3e')]=_['merge'](_0x2dc79f[_0xcc25('0x3e')],{'$or':_[_0xcc25('0x2c')](_0x291891,function(_0x1b19a5){if(_0x1b19a5['type']!=='VIRTUAL'){var _0xfd75b={};_0xfd75b[_0x1b19a5[_0xcc25('0x33')]]={'$like':'%'+_0x4bd144[_0xcc25('0x34')][_0xcc25('0x3f')]+'%'};return _0xfd75b;}})});}_0x2dc79f=_['merge']({},_0x2dc79f,_0x4bd144['options']);var _0x1319b5={'where':_0x2dc79f['where']};return db[_0xcc25('0x2d')][_0xcc25('0x21')](_0x1319b5)[_0xcc25('0x27')](function(_0x4e6d7d){_0x26a5ed[_0xcc25('0x21')]=_0x4e6d7d;if(_0x4bd144[_0xcc25('0x34')]['includeAll']){_0x2dc79f['include']=[{'all':!![]}];}return db[_0xcc25('0x2d')][_0xcc25('0x40')](_0x2dc79f);})[_0xcc25('0x27')](function(_0x38f3eb){_0x26a5ed['rows']=_0x38f3eb;return _0x26a5ed;})['then'](respondWithFilteredResult(_0x6207f2,_0x2dc79f))[_0xcc25('0x41')](handleError(_0x6207f2,null));};exports['show']=function(_0x358c80,_0x4ac2cd){var _0x4af40c={'raw':!![],'where':{'id':_0x358c80[_0xcc25('0x42')]['id']}},_0x58eea9={};_0x58eea9['model']=_[_0xcc25('0x35')](db[_0xcc25('0x2d')][_0xcc25('0x2e')]);_0x58eea9[_0xcc25('0x34')]=_[_0xcc25('0x35')](_0x358c80[_0xcc25('0x34')]);_0x58eea9[_0xcc25('0x36')]=_['intersection'](_0x58eea9[_0xcc25('0x32')],_0x58eea9[_0xcc25('0x34')]);_0x4af40c[_0xcc25('0x38')]=_['intersection'](_0x58eea9['model'],qs[_0xcc25('0x39')](_0x358c80['query'][_0xcc25('0x39')]));_0x4af40c['attributes']=_0x4af40c[_0xcc25('0x38')][_0xcc25('0x3a')]?_0x4af40c[_0xcc25('0x38')]:_0x58eea9[_0xcc25('0x32')];if(_0x358c80['query'][_0xcc25('0x43')]){_0x4af40c[_0xcc25('0x44')]=[{'all':!![]}];}_0x4af40c=_[_0xcc25('0x45')]({},_0x4af40c,_0x358c80['options']);return db[_0xcc25('0x2d')][_0xcc25('0x46')](_0x4af40c)[_0xcc25('0x27')](handleEntityNotFound(_0x4ac2cd,null))[_0xcc25('0x27')](respondWithResult(_0x4ac2cd,null))[_0xcc25('0x41')](handleError(_0x4ac2cd,null));};exports[_0xcc25('0x47')]=function(_0x33024f,_0x349f76){return db[_0xcc25('0x2d')][_0xcc25('0x47')](_0x33024f[_0xcc25('0x48')],{})['then'](respondWithResult(_0x349f76,0xc9))[_0xcc25('0x41')](handleError(_0x349f76,null));};exports[_0xcc25('0x26')]=function(_0x278be6,_0x2b3ac1){if(_0x278be6[_0xcc25('0x48')]['id']){delete _0x278be6['body']['id'];}return db[_0xcc25('0x2d')][_0xcc25('0x46')]({'where':{'id':_0x278be6[_0xcc25('0x42')]['id']}})[_0xcc25('0x27')](handleEntityNotFound(_0x2b3ac1,null))[_0xcc25('0x27')](saveUpdates(_0x278be6[_0xcc25('0x48')],null))['then'](respondWithResult(_0x2b3ac1,null))[_0xcc25('0x41')](handleError(_0x2b3ac1,null));};exports[_0xcc25('0x28')]=function(_0x9c5aaf,_0x4d57a1){return db[_0xcc25('0x2d')]['find']({'where':{'id':_0x9c5aaf[_0xcc25('0x42')]['id']}})[_0xcc25('0x27')](handleEntityNotFound(_0x4d57a1,null))[_0xcc25('0x27')](removeEntity(_0x4d57a1,null))[_0xcc25('0x41')](handleError(_0x4d57a1,null));};exports[_0xcc25('0x49')]=function(_0xc5eed1,_0x39835e){return db[_0xcc25('0x2d')][_0xcc25('0x49')]()[_0xcc25('0x27')](respondWithResult(_0x39835e,null))[_0xcc25('0x41')](handleError(_0x39835e,null));}; \ No newline at end of file +var _0xf2ec=['then','error','name','send','OpenchannelQueueReport','rawAttributes','fieldName','type','map','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','update'];(function(_0x4a47c7,_0x5ea713){var _0x2c1d1d=function(_0x56fca1){while(--_0x56fca1){_0x4a47c7['push'](_0x4a47c7['shift']());}};_0x2c1d1d(++_0x5ea713);}(_0xf2ec,0xb5));var _0xcf2e=function(_0x23ef63,_0x12a70b){_0x23ef63=_0x23ef63-0x0;var _0x2fe5ef=_0xf2ec[_0x23ef63];return _0x2fe5ef;};'use strict';var emlformat=require(_0xcf2e('0x0'));var rimraf=require(_0xcf2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf2e('0x2'));var rp=require(_0xcf2e('0x3'));var moment=require(_0xcf2e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcf2e('0x5'));var util=require(_0xcf2e('0x6'));var path=require('path');var sox=require(_0xcf2e('0x7'));var csv=require(_0xcf2e('0x8'));var ejs=require(_0xcf2e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcf2e('0xa'));var crypto=require(_0xcf2e('0xb'));var jsforce=require(_0xcf2e('0xc'));var deskjs=require(_0xcf2e('0xd'));var toCsv=require(_0xcf2e('0x8'));var querystring=require(_0xcf2e('0xe'));var Papa=require('papaparse');var Redis=require(_0xcf2e('0xf'));var authService=require(_0xcf2e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf2e('0x11'));var logger=require(_0xcf2e('0x12'))('api');var utils=require(_0xcf2e('0x13'));var config=require(_0xcf2e('0x14'));var licenseUtil=require(_0xcf2e('0x15'));var db=require(_0xcf2e('0x16'))['db'];function respondWithStatusCode(_0x44617a,_0x1395a3){_0x1395a3=_0x1395a3||0xcc;return function(_0x2d1c3a){if(_0x2d1c3a){return _0x44617a[_0xcf2e('0x17')](_0x1395a3);}return _0x44617a[_0xcf2e('0x18')](_0x1395a3)[_0xcf2e('0x19')]();};}function respondWithResult(_0x360cfc,_0x424069){_0x424069=_0x424069||0xc8;return function(_0x305f3f){if(_0x305f3f){return _0x360cfc[_0xcf2e('0x18')](_0x424069)[_0xcf2e('0x1a')](_0x305f3f);}};}function respondWithFilteredResult(_0x5787e5,_0x151319){return function(_0x157547){if(_0x157547){var _0x3f805e=typeof _0x151319['offset']==='undefined'&&typeof _0x151319[_0xcf2e('0x1b')]===_0xcf2e('0x1c');var _0x5bf130=_0x157547['count'];var _0x29646a=_0x3f805e?0x0:_0x151319[_0xcf2e('0x1d')];var _0x2db3a4=_0x3f805e?_0x157547[_0xcf2e('0x1e')]:_0x151319[_0xcf2e('0x1d')]+_0x151319[_0xcf2e('0x1b')];var _0x1631c9;if(_0x2db3a4>=_0x5bf130){_0x2db3a4=_0x5bf130;_0x1631c9=0xc8;}else{_0x1631c9=0xce;}_0x5787e5[_0xcf2e('0x18')](_0x1631c9);return _0x5787e5['set'](_0xcf2e('0x1f'),_0x29646a+'-'+_0x2db3a4+'/'+_0x5bf130)['json'](_0x157547);}return null;};}function patchUpdates(_0x1f90d7){return function(_0x1697a0){try{jsonpatch[_0xcf2e('0x20')](_0x1697a0,_0x1f90d7,!![]);}catch(_0x120336){return BPromise[_0xcf2e('0x21')](_0x120336);}return _0x1697a0['save']();};}function saveUpdates(_0xdbe61c,_0x5b17c7){return function(_0x4c47d5){if(_0x4c47d5){return _0x4c47d5[_0xcf2e('0x22')](_0xdbe61c)[_0xcf2e('0x23')](function(_0x271ac3){return _0x271ac3;});}return null;};}function removeEntity(_0x121915,_0x20cb42){return function(_0x597ea7){if(_0x597ea7){return _0x597ea7['destroy']()['then'](function(){_0x121915[_0xcf2e('0x18')](0xcc)[_0xcf2e('0x19')]();});}};}function handleEntityNotFound(_0x15c3fe,_0x4c685c){return function(_0x46668c){if(!_0x46668c){_0x15c3fe[_0xcf2e('0x17')](0x194);}return _0x46668c;};}function handleError(_0x5eb4d9,_0x1ad104){_0x1ad104=_0x1ad104||0x1f4;return function(_0x46a58e){logger[_0xcf2e('0x24')](_0x46a58e['stack']);if(_0x46a58e[_0xcf2e('0x25')]){delete _0x46a58e[_0xcf2e('0x25')];}_0x5eb4d9[_0xcf2e('0x18')](_0x1ad104)[_0xcf2e('0x26')](_0x46a58e);};}exports['index']=function(_0x47f022,_0x29691c){var _0x14a2c8={},_0x19dff8={},_0x20f038={'count':0x0,'rows':[]};var _0x33ebce=_['map'](db[_0xcf2e('0x27')][_0xcf2e('0x28')],function(_0xbb4f0f){return{'name':_0xbb4f0f[_0xcf2e('0x29')],'type':_0xbb4f0f[_0xcf2e('0x2a')]['key']};});_0x19dff8['model']=_[_0xcf2e('0x2b')](_0x33ebce,_0xcf2e('0x25'));_0x19dff8['query']=_[_0xcf2e('0x2c')](_0x47f022[_0xcf2e('0x2d')]);_0x19dff8[_0xcf2e('0x2e')]=_[_0xcf2e('0x2f')](_0x19dff8['model'],_0x19dff8[_0xcf2e('0x2d')]);_0x14a2c8[_0xcf2e('0x30')]=_['intersection'](_0x19dff8[_0xcf2e('0x31')],qs[_0xcf2e('0x32')](_0x47f022[_0xcf2e('0x2d')][_0xcf2e('0x32')]));_0x14a2c8[_0xcf2e('0x30')]=_0x14a2c8[_0xcf2e('0x30')][_0xcf2e('0x33')]?_0x14a2c8[_0xcf2e('0x30')]:_0x19dff8[_0xcf2e('0x31')];if(!_0x47f022['query']['hasOwnProperty'](_0xcf2e('0x34'))){_0x14a2c8[_0xcf2e('0x1b')]=qs[_0xcf2e('0x1b')](_0x47f022[_0xcf2e('0x2d')][_0xcf2e('0x1b')]);_0x14a2c8[_0xcf2e('0x1d')]=qs['offset'](_0x47f022[_0xcf2e('0x2d')][_0xcf2e('0x1d')]);}_0x14a2c8[_0xcf2e('0x35')]=qs[_0xcf2e('0x36')](_0x47f022['query'][_0xcf2e('0x36')]);_0x14a2c8[_0xcf2e('0x37')]=qs[_0xcf2e('0x2e')](_[_0xcf2e('0x38')](_0x47f022[_0xcf2e('0x2d')],_0x19dff8['filters']),_0x33ebce);if(_0x47f022['query'][_0xcf2e('0x39')]){_0x14a2c8[_0xcf2e('0x37')]=_[_0xcf2e('0x3a')](_0x14a2c8[_0xcf2e('0x37')],{'$or':_[_0xcf2e('0x2b')](_0x33ebce,function(_0x1f0e03){if(_0x1f0e03['type']!==_0xcf2e('0x3b')){var _0x2ed2a6={};_0x2ed2a6[_0x1f0e03['name']]={'$like':'%'+_0x47f022[_0xcf2e('0x2d')]['filter']+'%'};return _0x2ed2a6;}})});}_0x14a2c8=_[_0xcf2e('0x3a')]({},_0x14a2c8,_0x47f022['options']);var _0x20f0b6={'where':_0x14a2c8['where']};return db['OpenchannelQueueReport'][_0xcf2e('0x1e')](_0x20f0b6)[_0xcf2e('0x23')](function(_0x5adc62){_0x20f038[_0xcf2e('0x1e')]=_0x5adc62;if(_0x47f022[_0xcf2e('0x2d')][_0xcf2e('0x3c')]){_0x14a2c8[_0xcf2e('0x3d')]=[{'all':!![]}];}return db[_0xcf2e('0x27')][_0xcf2e('0x3e')](_0x14a2c8);})[_0xcf2e('0x23')](function(_0x426859){_0x20f038['rows']=_0x426859;return _0x20f038;})[_0xcf2e('0x23')](respondWithFilteredResult(_0x29691c,_0x14a2c8))[_0xcf2e('0x3f')](handleError(_0x29691c,null));};exports[_0xcf2e('0x40')]=function(_0x417837,_0x201e76){var _0x2996a2={'raw':!![],'where':{'id':_0x417837[_0xcf2e('0x41')]['id']}},_0x32e0dd={};_0x32e0dd[_0xcf2e('0x31')]=_[_0xcf2e('0x2c')](db[_0xcf2e('0x27')][_0xcf2e('0x28')]);_0x32e0dd[_0xcf2e('0x2d')]=_['keys'](_0x417837[_0xcf2e('0x2d')]);_0x32e0dd[_0xcf2e('0x2e')]=_['intersection'](_0x32e0dd[_0xcf2e('0x31')],_0x32e0dd['query']);_0x2996a2[_0xcf2e('0x30')]=_[_0xcf2e('0x2f')](_0x32e0dd['model'],qs[_0xcf2e('0x32')](_0x417837[_0xcf2e('0x2d')][_0xcf2e('0x32')]));_0x2996a2[_0xcf2e('0x30')]=_0x2996a2[_0xcf2e('0x30')][_0xcf2e('0x33')]?_0x2996a2[_0xcf2e('0x30')]:_0x32e0dd[_0xcf2e('0x31')];if(_0x417837[_0xcf2e('0x2d')][_0xcf2e('0x3c')]){_0x2996a2['include']=[{'all':!![]}];}_0x2996a2=_[_0xcf2e('0x3a')]({},_0x2996a2,_0x417837[_0xcf2e('0x42')]);return db[_0xcf2e('0x27')][_0xcf2e('0x43')](_0x2996a2)[_0xcf2e('0x23')](handleEntityNotFound(_0x201e76,null))[_0xcf2e('0x23')](respondWithResult(_0x201e76,null))[_0xcf2e('0x3f')](handleError(_0x201e76,null));};exports[_0xcf2e('0x44')]=function(_0x413e4f,_0x2bc475){return db[_0xcf2e('0x27')][_0xcf2e('0x44')](_0x413e4f[_0xcf2e('0x45')],{})[_0xcf2e('0x23')](respondWithResult(_0x2bc475,0xc9))[_0xcf2e('0x3f')](handleError(_0x2bc475,null));};exports[_0xcf2e('0x22')]=function(_0x37a94f,_0x1bae79){if(_0x37a94f[_0xcf2e('0x45')]['id']){delete _0x37a94f[_0xcf2e('0x45')]['id'];}return db[_0xcf2e('0x27')]['find']({'where':{'id':_0x37a94f[_0xcf2e('0x41')]['id']}})['then'](handleEntityNotFound(_0x1bae79,null))[_0xcf2e('0x23')](saveUpdates(_0x37a94f[_0xcf2e('0x45')],null))[_0xcf2e('0x23')](respondWithResult(_0x1bae79,null))['catch'](handleError(_0x1bae79,null));};exports[_0xcf2e('0x46')]=function(_0x2d4f01,_0x2bcc7c){return db[_0xcf2e('0x27')][_0xcf2e('0x43')]({'where':{'id':_0x2d4f01[_0xcf2e('0x41')]['id']}})[_0xcf2e('0x23')](handleEntityNotFound(_0x2bcc7c,null))[_0xcf2e('0x23')](removeEntity(_0x2bcc7c,null))[_0xcf2e('0x3f')](handleError(_0x2bcc7c,null));};exports[_0xcf2e('0x47')]=function(_0x5b9731,_0x59ba90){return db['OpenchannelQueueReport']['describe']()[_0xcf2e('0x23')](respondWithResult(_0x59ba90,null))[_0xcf2e('0x3f')](handleError(_0x59ba90,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4d95633..41e55b2 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2fbaf4,_0xfb01a1){var _0x30caf7=function(_0x60a725){while(--_0x60a725){_0x2fbaf4['push'](_0x2fbaf4['shift']());}};_0x30caf7(++_0xfb01a1);}(_0x7a54,0x106));var _0x47a5=function(_0x1d145e,_0x440646){_0x1d145e=_0x1d145e-0x0;var _0xa6af41=_0x7a54[_0x1d145e];return _0xa6af41;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0xc89191,_0x189c00){var _0x3f5bff=function(_0x1ca6a6){while(--_0x1ca6a6){_0xc89191['push'](_0xc89191['shift']());}};_0x3f5bff(++_0x189c00);}(_0xe14b,0x93));var _0xbe14=function(_0xbcc6ec,_0x353c59){_0xbcc6ec=_0xbcc6ec-0x0;var _0x177f39=_0xe14b[_0xbcc6ec];return _0x177f39;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 39320f4..c95df29 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ccd=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','limit','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug'];(function(_0x5f1614,_0x1b6166){var _0x2a3106=function(_0x19a5e6){while(--_0x19a5e6){_0x5f1614['push'](_0x5f1614['shift']());}};_0x2a3106(++_0x1b6166);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var moment=require(_0xd9cc('0x1'));var BPromise=require(_0xd9cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9cc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9cc('0x4'))(_0xd9cc('0x5'));var config=require(_0xd9cc('0x6'));var jayson=require(_0xd9cc('0x7'));var client=jayson[_0xd9cc('0x8')][_0xd9cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f7b2b,_0x23b70a,_0x9e1e10){return new BPromise(function(_0x1a1bd1,_0x20282c){return client[_0xd9cc('0xa')](_0x1f7b2b,_0x9e1e10)[_0xd9cc('0xb')](function(_0x1737e5){logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,'request\x20sent');logger[_0xd9cc('0xe')](_0xd9cc('0xf'),_0x23b70a,_0xd9cc('0x10'),JSON[_0xd9cc('0x11')](_0x1737e5));if(_0x1737e5[_0xd9cc('0x12')]){if(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x13')]===0x1f4){logger[_0xd9cc('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')]['message']);return _0x20282c(_0x1737e5['error']['message']);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);return _0x1a1bd1(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);}else{logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,_0xd9cc('0x10'));_0x1a1bd1(_0x1737e5['result'][_0xd9cc('0x14')]);}})[_0xd9cc('0x15')](function(_0x513635){logger[_0xd9cc('0x12')](_0xd9cc('0xd'),_0x23b70a,_0x513635);_0x20282c(_0x513635);});});}exports[_0xd9cc('0x16')]=function(_0x2e2baa){var _0x5a4b50=this;return new Promise(function(_0x37b745,_0x32df89){return db['OpenchannelQueueReport'][_0xd9cc('0x17')](_0x2e2baa[_0xd9cc('0x18')],{'raw':_0x2e2baa[_0xd9cc('0x19')]?_0x2e2baa[_0xd9cc('0x19')][_0xd9cc('0x1a')]===undefined?!![]:![]:!![]})[_0xd9cc('0xb')](function(_0x59f00d){logger['info'](_0xd9cc('0x16'),_0x2e2baa);logger[_0xd9cc('0xe')](_0xd9cc('0x16'),_0x2e2baa,JSON[_0xd9cc('0x11')](_0x59f00d));_0x37b745(_0x59f00d);})[_0xd9cc('0x15')](function(_0x426a5c){logger[_0xd9cc('0x12')](_0xd9cc('0x16'),_0x426a5c[_0xd9cc('0x14')],_0x2e2baa);_0x32df89(_0x5a4b50[_0xd9cc('0x12')](0x1f4,_0x426a5c[_0xd9cc('0x14')]));});});};exports[_0xd9cc('0x1b')]=function(_0x45b05a){var _0x35fb49=this;return new Promise(function(_0x503451,_0xc74622){return db[_0xd9cc('0x1c')]['update'](_0x45b05a[_0xd9cc('0x18')],{'raw':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1d')]||null:null,'attributes':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')]['attributes']||null:null,'limit':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1e')]||null:null})[_0xd9cc('0xb')](function(_0xfcd78c){logger[_0xd9cc('0xc')](_0xd9cc('0x1b'),_0x45b05a);logger[_0xd9cc('0xe')]('UpdateOpenchannelQueueReport',_0x45b05a,JSON[_0xd9cc('0x11')](_0xfcd78c));_0x503451(_0xfcd78c);})[_0xd9cc('0x15')](function(_0x42d185){logger[_0xd9cc('0x12')](_0xd9cc('0x1b'),_0x42d185[_0xd9cc('0x14')],_0x45b05a);_0xc74622(_0x35fb49['error'](0x1f4,_0x42d185[_0xd9cc('0x14')]));});});}; \ No newline at end of file +var _0x7fea=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','then','debug','stringify','update','body','where','attributes','limit','UpdateOpenchannelQueueReport','util'];(function(_0x29f6e6,_0x5e1b32){var _0x1a1e72=function(_0x4ee062){while(--_0x4ee062){_0x29f6e6['push'](_0x29f6e6['shift']());}};_0x1a1e72(++_0x5e1b32);}(_0x7fea,0x149));var _0xa7fe=function(_0x117cfa,_0x2ca9cb){_0x117cfa=_0x117cfa-0x0;var _0x4d014b=_0x7fea[_0x117cfa];return _0x4d014b;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa7fe('0x1'));var fs=require('fs');var Redis=require(_0xa7fe('0x2'));var db=require(_0xa7fe('0x3'))['db'];var utils=require(_0xa7fe('0x4'));var logger=require(_0xa7fe('0x5'))(_0xa7fe('0x6'));var config=require('../../config/environment');var jayson=require(_0xa7fe('0x7'));var client=jayson[_0xa7fe('0x8')][_0xa7fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1132f1,_0x45f967,_0x3597b0){return new BPromise(function(_0x4668f0,_0x3d9135){return client['request'](_0x1132f1,_0x3597b0)['then'](function(_0x1db10e){logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,_0xa7fe('0xc'));logger['debug'](_0xa7fe('0xd'),_0x45f967,_0xa7fe('0xc'),JSON['stringify'](_0x1db10e));if(_0x1db10e[_0xa7fe('0xe')]){if(_0x1db10e['error'][_0xa7fe('0xf')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x45f967,_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);return _0x3d9135(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}logger[_0xa7fe('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x45f967,_0x1db10e['error'][_0xa7fe('0x10')]);return _0x4668f0(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}else{logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,'request\x20sent');_0x4668f0(_0x1db10e[_0xa7fe('0x11')][_0xa7fe('0x10')]);}})[_0xa7fe('0x12')](function(_0x253293){logger[_0xa7fe('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x45f967,_0x253293);_0x3d9135(_0x253293);});});}exports[_0xa7fe('0x13')]=function(_0x1e4966){var _0x2bf8db=this;return new Promise(function(_0x2ef53c,_0x179b9e){return db[_0xa7fe('0x14')][_0xa7fe('0x15')](_0x1e4966['body'],{'raw':_0x1e4966['options']?_0x1e4966[_0xa7fe('0x16')][_0xa7fe('0x17')]===undefined?!![]:![]:!![]})[_0xa7fe('0x18')](function(_0x529990){logger[_0xa7fe('0xa')](_0xa7fe('0x13'),_0x1e4966);logger[_0xa7fe('0x19')]('CreateOpenchannelQueueReport',_0x1e4966,JSON[_0xa7fe('0x1a')](_0x529990));_0x2ef53c(_0x529990);})[_0xa7fe('0x12')](function(_0x1619c1){logger[_0xa7fe('0xe')](_0xa7fe('0x13'),_0x1619c1[_0xa7fe('0x10')],_0x1e4966);_0x179b9e(_0x2bf8db[_0xa7fe('0xe')](0x1f4,_0x1619c1[_0xa7fe('0x10')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3415b8){var _0x4fb801=this;return new Promise(function(_0x4ce2e7,_0x37c8fa){return db[_0xa7fe('0x14')][_0xa7fe('0x1b')](_0x3415b8[_0xa7fe('0x1c')],{'raw':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8['options'][_0xa7fe('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8[_0xa7fe('0x16')][_0xa7fe('0x1d')]||null:null,'attributes':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8[_0xa7fe('0x16')][_0xa7fe('0x1e')]||null:null,'limit':_0x3415b8[_0xa7fe('0x16')]?_0x3415b8[_0xa7fe('0x16')][_0xa7fe('0x1f')]||null:null})[_0xa7fe('0x18')](function(_0x19dd83){logger[_0xa7fe('0xa')](_0xa7fe('0x20'),_0x3415b8);logger[_0xa7fe('0x19')](_0xa7fe('0x20'),_0x3415b8,JSON[_0xa7fe('0x1a')](_0x19dd83));_0x4ce2e7(_0x19dd83);})[_0xa7fe('0x12')](function(_0x1c9e5a){logger[_0xa7fe('0xe')]('UpdateOpenchannelQueueReport',_0x1c9e5a[_0xa7fe('0x10')],_0x3415b8);_0x37c8fa(_0x4fb801[_0xa7fe('0xe')](0x1f4,_0x1c9e5a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a975e21..0a5b7b7 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c9b=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2b6b89,_0x172ec0){var _0x5aa6af=function(_0x19cd5e){while(--_0x19cd5e){_0x2b6b89['push'](_0x2b6b89['shift']());}};_0x5aa6af(++_0x172ec0);}(_0x9c9b,0x89));var _0xb9c9=function(_0x2efd57,_0xce2e98){_0x2efd57=_0x2efd57-0x0;var _0x3a4871=_0x9c9b[_0x2efd57];return _0x3a4871;};'use strict';var multer=require(_0xb9c9('0x0'));var util=require('util');var path=require(_0xb9c9('0x1'));var timeout=require(_0xb9c9('0x2'));var express=require(_0xb9c9('0x3'));var router=express[_0xb9c9('0x4')]();var fs_extra=require(_0xb9c9('0x5'));var auth=require(_0xb9c9('0x6'));var interaction=require(_0xb9c9('0x7'));var config=require(_0xb9c9('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0xb9c9('0x9')]('/',auth[_0xb9c9('0xa')](),controller[_0xb9c9('0xb')]);router[_0xb9c9('0x9')](_0xb9c9('0xc'),auth[_0xb9c9('0xa')](),controller[_0xb9c9('0xd')]);router[_0xb9c9('0x9')](_0xb9c9('0xe'),auth[_0xb9c9('0xa')](),controller['show']);router[_0xb9c9('0xf')]('/',auth[_0xb9c9('0xa')](),controller[_0xb9c9('0x10')]);router[_0xb9c9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb9c9('0x12')]);router[_0xb9c9('0x13')](_0xb9c9('0xe'),auth['isAuthenticated'](),controller[_0xb9c9('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9c99=['get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','./openchannelTransferReport.controller'];(function(_0x29d621,_0x5a003f){var _0x3c6864=function(_0x7d1a15){while(--_0x7d1a15){_0x29d621['push'](_0x29d621['shift']());}};_0x3c6864(++_0x5a003f);}(_0x9c99,0x91));var _0x99c9=function(_0x210b93,_0x133e6d){_0x210b93=_0x210b93-0x0;var _0x2b020f=_0x9c99[_0x210b93];return _0x2b020f;};'use strict';var multer=require(_0x99c9('0x0'));var util=require('util');var path=require(_0x99c9('0x1'));var timeout=require(_0x99c9('0x2'));var express=require(_0x99c9('0x3'));var router=express[_0x99c9('0x4')]();var fs_extra=require(_0x99c9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x99c9('0x6'));router[_0x99c9('0x7')]('/',auth[_0x99c9('0x8')](),controller[_0x99c9('0x9')]);router['get'](_0x99c9('0xa'),auth[_0x99c9('0x8')](),controller['describe']);router['get']('/:id',auth[_0x99c9('0x8')](),controller[_0x99c9('0xb')]);router[_0x99c9('0xc')]('/',auth[_0x99c9('0x8')](),controller[_0x99c9('0xd')]);router[_0x99c9('0xe')](_0x99c9('0xf'),auth[_0x99c9('0x8')](),controller['update']);router[_0x99c9('0x10')](_0x99c9('0xf'),auth[_0x99c9('0x8')](),controller[_0x99c9('0x11')]);module[_0x99c9('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index aca308c..d67e807 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0x9bde,0xe1));var _0xe9bd=function(_0x31fc80,_0x2dd4df){_0x31fc80=_0x31fc80-0x0;var _0x3e8496=_0x9bde[_0x31fc80];return _0x3e8496;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xd9f47,_0x20ccd4){var _0x377f4f=function(_0x13ab38){while(--_0x13ab38){_0xd9f47['push'](_0xd9f47['shift']());}};_0x377f4f(++_0x20ccd4);}(_0xaa88,0x137));var _0x8aa8=function(_0x316904,_0x1e8b77){_0x316904=_0x316904-0x0;var _0xfa9a21=_0xaa88[_0x316904];return _0xfa9a21;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 88a6972..60d9d8f 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa566=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','reject','update','then','destroy','error','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0xd46615,_0x568626){var _0xad0d2d=function(_0x29430e){while(--_0x29430e){_0xd46615['push'](_0xd46615['shift']());}};_0xad0d2d(++_0x568626);}(_0xa566,0x1c1));var _0x6a56=function(_0x1807c3,_0x2debea){_0x1807c3=_0x1807c3-0x0;var _0x9cec6b=_0xa566[_0x1807c3];return _0x9cec6b;};'use strict';var emlformat=require(_0x6a56('0x0'));var rimraf=require(_0x6a56('0x1'));var zipdir=require(_0x6a56('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a56('0x3'));var moment=require(_0x6a56('0x4'));var BPromise=require(_0x6a56('0x5'));var Mustache=require(_0x6a56('0x6'));var util=require('util');var path=require(_0x6a56('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a56('0x8'));var squel=require('squel');var crypto=require(_0x6a56('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6a56('0xa'));var toCsv=require(_0x6a56('0xb'));var querystring=require('querystring');var Papa=require(_0x6a56('0xc'));var Redis=require(_0x6a56('0xd'));var authService=require(_0x6a56('0xe'));var qs=require(_0x6a56('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a56('0x10'));var logger=require(_0x6a56('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x6a56('0x12'));var licenseUtil=require(_0x6a56('0x13'));var db=require(_0x6a56('0x14'))['db'];function respondWithStatusCode(_0x26f443,_0x3e9389){_0x3e9389=_0x3e9389||0xcc;return function(_0x10f894){if(_0x10f894){return _0x26f443[_0x6a56('0x15')](_0x3e9389);}return _0x26f443['status'](_0x3e9389)[_0x6a56('0x16')]();};}function respondWithResult(_0x14237e,_0x46fbaa){_0x46fbaa=_0x46fbaa||0xc8;return function(_0x10fd64){if(_0x10fd64){return _0x14237e[_0x6a56('0x17')](_0x46fbaa)['json'](_0x10fd64);}};}function respondWithFilteredResult(_0x232176,_0xc0e603){return function(_0x28bb4e){if(_0x28bb4e){var _0xc5f78d=typeof _0xc0e603[_0x6a56('0x18')]==='undefined'&&typeof _0xc0e603['limit']===_0x6a56('0x19');var _0x2288b1=_0x28bb4e['count'];var _0x162c52=_0xc5f78d?0x0:_0xc0e603[_0x6a56('0x18')];var _0x4c2f9c=_0xc5f78d?_0x28bb4e[_0x6a56('0x1a')]:_0xc0e603[_0x6a56('0x18')]+_0xc0e603['limit'];var _0x26b33e;if(_0x4c2f9c>=_0x2288b1){_0x4c2f9c=_0x2288b1;_0x26b33e=0xc8;}else{_0x26b33e=0xce;}_0x232176['status'](_0x26b33e);return _0x232176[_0x6a56('0x1b')]('Content-Range',_0x162c52+'-'+_0x4c2f9c+'/'+_0x2288b1)[_0x6a56('0x1c')](_0x28bb4e);}return null;};}function patchUpdates(_0x2239ff){return function(_0x11e479){try{jsonpatch[_0x6a56('0x1d')](_0x11e479,_0x2239ff,!![]);}catch(_0x32118b){return BPromise[_0x6a56('0x1e')](_0x32118b);}return _0x11e479['save']();};}function saveUpdates(_0x2e217a,_0x148548){return function(_0x4845aa){if(_0x4845aa){return _0x4845aa[_0x6a56('0x1f')](_0x2e217a)[_0x6a56('0x20')](function(_0x3cf1b3){return _0x3cf1b3;});}return null;};}function removeEntity(_0x5a0986,_0x2a6ece){return function(_0x3e0aab){if(_0x3e0aab){return _0x3e0aab[_0x6a56('0x21')]()[_0x6a56('0x20')](function(){_0x5a0986[_0x6a56('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d23a,_0x5ce125){return function(_0x302316){if(!_0x302316){_0x51d23a[_0x6a56('0x15')](0x194);}return _0x302316;};}function handleError(_0x2bd80f,_0x55e714){_0x55e714=_0x55e714||0x1f4;return function(_0x1df843){logger[_0x6a56('0x22')](_0x1df843['stack']);if(_0x1df843[_0x6a56('0x23')]){delete _0x1df843[_0x6a56('0x23')];}_0x2bd80f[_0x6a56('0x17')](_0x55e714)['send'](_0x1df843);};}exports[_0x6a56('0x24')]=function(_0x27bcd0,_0x151537){var _0xe26d09={},_0x10b1cb={},_0x51534d={'count':0x0,'rows':[]};var _0x3f0fe7=_[_0x6a56('0x25')](db[_0x6a56('0x26')][_0x6a56('0x27')],function(_0x576778){return{'name':_0x576778[_0x6a56('0x28')],'type':_0x576778[_0x6a56('0x29')][_0x6a56('0x2a')]};});_0x10b1cb['model']=_[_0x6a56('0x25')](_0x3f0fe7,'name');_0x10b1cb[_0x6a56('0x2b')]=_[_0x6a56('0x2c')](_0x27bcd0[_0x6a56('0x2b')]);_0x10b1cb[_0x6a56('0x2d')]=_[_0x6a56('0x2e')](_0x10b1cb[_0x6a56('0x2f')],_0x10b1cb[_0x6a56('0x2b')]);_0xe26d09[_0x6a56('0x30')]=_[_0x6a56('0x2e')](_0x10b1cb[_0x6a56('0x2f')],qs[_0x6a56('0x31')](_0x27bcd0['query'][_0x6a56('0x31')]));_0xe26d09[_0x6a56('0x30')]=_0xe26d09[_0x6a56('0x30')][_0x6a56('0x32')]?_0xe26d09['attributes']:_0x10b1cb[_0x6a56('0x2f')];if(!_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x33')](_0x6a56('0x34'))){_0xe26d09['limit']=qs[_0x6a56('0x35')](_0x27bcd0[_0x6a56('0x2b')]['limit']);_0xe26d09[_0x6a56('0x18')]=qs['offset'](_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x18')]);}_0xe26d09[_0x6a56('0x36')]=qs[_0x6a56('0x37')](_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x37')]);_0xe26d09[_0x6a56('0x38')]=qs['filters'](_[_0x6a56('0x39')](_0x27bcd0[_0x6a56('0x2b')],_0x10b1cb[_0x6a56('0x2d')]),_0x3f0fe7);if(_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3a')]){_0xe26d09[_0x6a56('0x38')]=_[_0x6a56('0x3b')](_0xe26d09[_0x6a56('0x38')],{'$or':_[_0x6a56('0x25')](_0x3f0fe7,function(_0x4b1f65){if(_0x4b1f65[_0x6a56('0x29')]!==_0x6a56('0x3c')){var _0x10aca9={};_0x10aca9[_0x4b1f65[_0x6a56('0x23')]]={'$like':'%'+_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3a')]+'%'};return _0x10aca9;}})});}_0xe26d09=_[_0x6a56('0x3b')]({},_0xe26d09,_0x27bcd0[_0x6a56('0x3d')]);var _0x4a75c2={'where':_0xe26d09[_0x6a56('0x38')]};return db[_0x6a56('0x26')][_0x6a56('0x1a')](_0x4a75c2)[_0x6a56('0x20')](function(_0x2af96d){_0x51534d['count']=_0x2af96d;if(_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3e')]){_0xe26d09[_0x6a56('0x3f')]=[{'all':!![]}];}return db[_0x6a56('0x26')][_0x6a56('0x40')](_0xe26d09);})['then'](function(_0x2e13b1){_0x51534d['rows']=_0x2e13b1;return _0x51534d;})[_0x6a56('0x20')](respondWithFilteredResult(_0x151537,_0xe26d09))[_0x6a56('0x41')](handleError(_0x151537,null));};exports[_0x6a56('0x42')]=function(_0x4e69fd,_0x10ced2){var _0x4ae655={'raw':!![],'where':{'id':_0x4e69fd[_0x6a56('0x43')]['id']}},_0x5a6999={};_0x5a6999[_0x6a56('0x2f')]=_[_0x6a56('0x2c')](db[_0x6a56('0x26')]['rawAttributes']);_0x5a6999['query']=_[_0x6a56('0x2c')](_0x4e69fd[_0x6a56('0x2b')]);_0x5a6999[_0x6a56('0x2d')]=_[_0x6a56('0x2e')](_0x5a6999[_0x6a56('0x2f')],_0x5a6999[_0x6a56('0x2b')]);_0x4ae655['attributes']=_[_0x6a56('0x2e')](_0x5a6999['model'],qs[_0x6a56('0x31')](_0x4e69fd[_0x6a56('0x2b')][_0x6a56('0x31')]));_0x4ae655[_0x6a56('0x30')]=_0x4ae655[_0x6a56('0x30')][_0x6a56('0x32')]?_0x4ae655[_0x6a56('0x30')]:_0x5a6999[_0x6a56('0x2f')];if(_0x4e69fd[_0x6a56('0x2b')]['includeAll']){_0x4ae655[_0x6a56('0x3f')]=[{'all':!![]}];}_0x4ae655=_['merge']({},_0x4ae655,_0x4e69fd['options']);return db['OpenchannelTransferReport'][_0x6a56('0x44')](_0x4ae655)[_0x6a56('0x20')](handleEntityNotFound(_0x10ced2,null))[_0x6a56('0x20')](respondWithResult(_0x10ced2,null))[_0x6a56('0x41')](handleError(_0x10ced2,null));};exports[_0x6a56('0x45')]=function(_0x5cef6c,_0x794424){return db[_0x6a56('0x26')][_0x6a56('0x45')](_0x5cef6c[_0x6a56('0x46')],{})['then'](respondWithResult(_0x794424,0xc9))[_0x6a56('0x41')](handleError(_0x794424,null));};exports[_0x6a56('0x1f')]=function(_0x659936,_0x371b8e){if(_0x659936['body']['id']){delete _0x659936[_0x6a56('0x46')]['id'];}return db[_0x6a56('0x26')][_0x6a56('0x44')]({'where':{'id':_0x659936['params']['id']}})[_0x6a56('0x20')](handleEntityNotFound(_0x371b8e,null))[_0x6a56('0x20')](saveUpdates(_0x659936[_0x6a56('0x46')],null))[_0x6a56('0x20')](respondWithResult(_0x371b8e,null))['catch'](handleError(_0x371b8e,null));};exports[_0x6a56('0x21')]=function(_0x56406b,_0x2487cb){return db[_0x6a56('0x26')]['find']({'where':{'id':_0x56406b[_0x6a56('0x43')]['id']}})[_0x6a56('0x20')](handleEntityNotFound(_0x2487cb,null))[_0x6a56('0x20')](removeEntity(_0x2487cb,null))[_0x6a56('0x41')](handleError(_0x2487cb,null));};exports[_0x6a56('0x47')]=function(_0x14be34,_0x175383){return db[_0x6a56('0x26')][_0x6a56('0x47')]()['then'](respondWithResult(_0x175383,null))['catch'](handleError(_0x175383,null));}; \ No newline at end of file +var _0x3f6f=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','catch','rawAttributes','length','include','find','create','body','params','describe','eml-format','rimraf','fast-json-patch'];(function(_0x133851,_0x4d6780){var _0x188215=function(_0x1aa541){while(--_0x1aa541){_0x133851['push'](_0x133851['shift']());}};_0x188215(++_0x4d6780);}(_0x3f6f,0x1cb));var _0xf3f6=function(_0x4ef6c4,_0x20c957){_0x4ef6c4=_0x4ef6c4-0x0;var _0x2073ab=_0x3f6f[_0x4ef6c4];return _0x2073ab;};'use strict';var emlformat=require(_0xf3f6('0x0'));var rimraf=require(_0xf3f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3f6('0x2'));var rp=require(_0xf3f6('0x3'));var moment=require(_0xf3f6('0x4'));var BPromise=require(_0xf3f6('0x5'));var Mustache=require(_0xf3f6('0x6'));var util=require(_0xf3f6('0x7'));var path=require(_0xf3f6('0x8'));var sox=require(_0xf3f6('0x9'));var csv=require(_0xf3f6('0xa'));var ejs=require(_0xf3f6('0xb'));var fs=require('fs');var fs_extra=require(_0xf3f6('0xc'));var _=require(_0xf3f6('0xd'));var squel=require(_0xf3f6('0xe'));var crypto=require(_0xf3f6('0xf'));var jsforce=require(_0xf3f6('0x10'));var deskjs=require(_0xf3f6('0x11'));var toCsv=require(_0xf3f6('0xa'));var querystring=require(_0xf3f6('0x12'));var Papa=require(_0xf3f6('0x13'));var Redis=require(_0xf3f6('0x14'));var authService=require(_0xf3f6('0x15'));var qs=require(_0xf3f6('0x16'));var as=require(_0xf3f6('0x17'));var hardwareService=require(_0xf3f6('0x18'));var logger=require(_0xf3f6('0x19'))('api');var utils=require(_0xf3f6('0x1a'));var config=require(_0xf3f6('0x1b'));var licenseUtil=require(_0xf3f6('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b5d1a,_0x453c64){_0x453c64=_0x453c64||0xcc;return function(_0xcdc519){if(_0xcdc519){return _0x2b5d1a[_0xf3f6('0x1d')](_0x453c64);}return _0x2b5d1a['status'](_0x453c64)[_0xf3f6('0x1e')]();};}function respondWithResult(_0x437e0d,_0x7b1b7f){_0x7b1b7f=_0x7b1b7f||0xc8;return function(_0x20db3d){if(_0x20db3d){return _0x437e0d[_0xf3f6('0x1f')](_0x7b1b7f)['json'](_0x20db3d);}};}function respondWithFilteredResult(_0x4e60fa,_0x3b3404){return function(_0xdffa2f){if(_0xdffa2f){var _0x558986=typeof _0x3b3404[_0xf3f6('0x20')]===_0xf3f6('0x21')&&typeof _0x3b3404[_0xf3f6('0x22')]===_0xf3f6('0x21');var _0x267040=_0xdffa2f[_0xf3f6('0x23')];var _0x12bea3=_0x558986?0x0:_0x3b3404[_0xf3f6('0x20')];var _0x37b8f1=_0x558986?_0xdffa2f['count']:_0x3b3404[_0xf3f6('0x20')]+_0x3b3404['limit'];var _0x364f5a;if(_0x37b8f1>=_0x267040){_0x37b8f1=_0x267040;_0x364f5a=0xc8;}else{_0x364f5a=0xce;}_0x4e60fa[_0xf3f6('0x1f')](_0x364f5a);return _0x4e60fa[_0xf3f6('0x24')]('Content-Range',_0x12bea3+'-'+_0x37b8f1+'/'+_0x267040)[_0xf3f6('0x25')](_0xdffa2f);}return null;};}function patchUpdates(_0x258228){return function(_0x44aa6f){try{jsonpatch[_0xf3f6('0x26')](_0x44aa6f,_0x258228,!![]);}catch(_0x3e6a71){return BPromise[_0xf3f6('0x27')](_0x3e6a71);}return _0x44aa6f['save']();};}function saveUpdates(_0x4c313a,_0x491f76){return function(_0x404a6d){if(_0x404a6d){return _0x404a6d[_0xf3f6('0x28')](_0x4c313a)[_0xf3f6('0x29')](function(_0x37f576){return _0x37f576;});}return null;};}function removeEntity(_0x4e54d2,_0x505844){return function(_0x45d76d){if(_0x45d76d){return _0x45d76d[_0xf3f6('0x2a')]()[_0xf3f6('0x29')](function(){_0x4e54d2[_0xf3f6('0x1f')](0xcc)[_0xf3f6('0x1e')]();});}};}function handleEntityNotFound(_0x3f5984,_0x32cbc7){return function(_0x4fe1eb){if(!_0x4fe1eb){_0x3f5984[_0xf3f6('0x1d')](0x194);}return _0x4fe1eb;};}function handleError(_0x3595c7,_0x4c6146){_0x4c6146=_0x4c6146||0x1f4;return function(_0x37c35d){logger[_0xf3f6('0x2b')](_0x37c35d[_0xf3f6('0x2c')]);if(_0x37c35d[_0xf3f6('0x2d')]){delete _0x37c35d[_0xf3f6('0x2d')];}_0x3595c7['status'](_0x4c6146)[_0xf3f6('0x2e')](_0x37c35d);};}exports[_0xf3f6('0x2f')]=function(_0x30accb,_0x966f9b){var _0x3a15d8={},_0x4f671e={},_0x1586e5={'count':0x0,'rows':[]};var _0x3a28de=_[_0xf3f6('0x30')](db[_0xf3f6('0x31')]['rawAttributes'],function(_0x159ea6){return{'name':_0x159ea6[_0xf3f6('0x32')],'type':_0x159ea6['type'][_0xf3f6('0x33')]};});_0x4f671e[_0xf3f6('0x34')]=_[_0xf3f6('0x30')](_0x3a28de,_0xf3f6('0x2d'));_0x4f671e[_0xf3f6('0x35')]=_[_0xf3f6('0x36')](_0x30accb[_0xf3f6('0x35')]);_0x4f671e[_0xf3f6('0x37')]=_[_0xf3f6('0x38')](_0x4f671e[_0xf3f6('0x34')],_0x4f671e[_0xf3f6('0x35')]);_0x3a15d8[_0xf3f6('0x39')]=_[_0xf3f6('0x38')](_0x4f671e[_0xf3f6('0x34')],qs[_0xf3f6('0x3a')](_0x30accb[_0xf3f6('0x35')][_0xf3f6('0x3a')]));_0x3a15d8[_0xf3f6('0x39')]=_0x3a15d8[_0xf3f6('0x39')]['length']?_0x3a15d8[_0xf3f6('0x39')]:_0x4f671e[_0xf3f6('0x34')];if(!_0x30accb[_0xf3f6('0x35')]['hasOwnProperty'](_0xf3f6('0x3b'))){_0x3a15d8[_0xf3f6('0x22')]=qs[_0xf3f6('0x22')](_0x30accb['query'][_0xf3f6('0x22')]);_0x3a15d8[_0xf3f6('0x20')]=qs[_0xf3f6('0x20')](_0x30accb[_0xf3f6('0x35')][_0xf3f6('0x20')]);}_0x3a15d8['order']=qs['sort'](_0x30accb['query']['sort']);_0x3a15d8['where']=qs['filters'](_[_0xf3f6('0x3c')](_0x30accb[_0xf3f6('0x35')],_0x4f671e[_0xf3f6('0x37')]),_0x3a28de);if(_0x30accb[_0xf3f6('0x35')]['filter']){_0x3a15d8[_0xf3f6('0x3d')]=_[_0xf3f6('0x3e')](_0x3a15d8[_0xf3f6('0x3d')],{'$or':_['map'](_0x3a28de,function(_0x547925){if(_0x547925[_0xf3f6('0x3f')]!==_0xf3f6('0x40')){var _0x5b8fb9={};_0x5b8fb9[_0x547925[_0xf3f6('0x2d')]]={'$like':'%'+_0x30accb[_0xf3f6('0x35')][_0xf3f6('0x41')]+'%'};return _0x5b8fb9;}})});}_0x3a15d8=_[_0xf3f6('0x3e')]({},_0x3a15d8,_0x30accb['options']);var _0x33b117={'where':_0x3a15d8['where']};return db[_0xf3f6('0x31')]['count'](_0x33b117)['then'](function(_0x21a6bf){_0x1586e5['count']=_0x21a6bf;if(_0x30accb[_0xf3f6('0x35')][_0xf3f6('0x42')]){_0x3a15d8['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xf3f6('0x43')](_0x3a15d8);})[_0xf3f6('0x29')](function(_0x38a100){_0x1586e5['rows']=_0x38a100;return _0x1586e5;})[_0xf3f6('0x29')](respondWithFilteredResult(_0x966f9b,_0x3a15d8))[_0xf3f6('0x44')](handleError(_0x966f9b,null));};exports['show']=function(_0x150a1b,_0x507d6f){var _0x278252={'raw':!![],'where':{'id':_0x150a1b['params']['id']}},_0x20bca9={};_0x20bca9[_0xf3f6('0x34')]=_[_0xf3f6('0x36')](db[_0xf3f6('0x31')][_0xf3f6('0x45')]);_0x20bca9[_0xf3f6('0x35')]=_[_0xf3f6('0x36')](_0x150a1b[_0xf3f6('0x35')]);_0x20bca9[_0xf3f6('0x37')]=_[_0xf3f6('0x38')](_0x20bca9[_0xf3f6('0x34')],_0x20bca9[_0xf3f6('0x35')]);_0x278252[_0xf3f6('0x39')]=_[_0xf3f6('0x38')](_0x20bca9[_0xf3f6('0x34')],qs[_0xf3f6('0x3a')](_0x150a1b[_0xf3f6('0x35')][_0xf3f6('0x3a')]));_0x278252[_0xf3f6('0x39')]=_0x278252[_0xf3f6('0x39')][_0xf3f6('0x46')]?_0x278252[_0xf3f6('0x39')]:_0x20bca9[_0xf3f6('0x34')];if(_0x150a1b[_0xf3f6('0x35')]['includeAll']){_0x278252[_0xf3f6('0x47')]=[{'all':!![]}];}_0x278252=_[_0xf3f6('0x3e')]({},_0x278252,_0x150a1b['options']);return db[_0xf3f6('0x31')][_0xf3f6('0x48')](_0x278252)[_0xf3f6('0x29')](handleEntityNotFound(_0x507d6f,null))[_0xf3f6('0x29')](respondWithResult(_0x507d6f,null))['catch'](handleError(_0x507d6f,null));};exports['create']=function(_0x490ff3,_0x40eb3b){return db[_0xf3f6('0x31')][_0xf3f6('0x49')](_0x490ff3[_0xf3f6('0x4a')],{})[_0xf3f6('0x29')](respondWithResult(_0x40eb3b,0xc9))['catch'](handleError(_0x40eb3b,null));};exports[_0xf3f6('0x28')]=function(_0x544b29,_0xeadb1a){if(_0x544b29[_0xf3f6('0x4a')]['id']){delete _0x544b29[_0xf3f6('0x4a')]['id'];}return db[_0xf3f6('0x31')][_0xf3f6('0x48')]({'where':{'id':_0x544b29[_0xf3f6('0x4b')]['id']}})[_0xf3f6('0x29')](handleEntityNotFound(_0xeadb1a,null))[_0xf3f6('0x29')](saveUpdates(_0x544b29[_0xf3f6('0x4a')],null))['then'](respondWithResult(_0xeadb1a,null))[_0xf3f6('0x44')](handleError(_0xeadb1a,null));};exports['destroy']=function(_0x5c06ba,_0x5974af){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x5c06ba['params']['id']}})[_0xf3f6('0x29')](handleEntityNotFound(_0x5974af,null))[_0xf3f6('0x29')](removeEntity(_0x5974af,null))['catch'](handleError(_0x5974af,null));};exports[_0xf3f6('0x4c')]=function(_0x2fbc93,_0x533760){return db['OpenchannelTransferReport'][_0xf3f6('0x4c')]()[_0xf3f6('0x29')](respondWithResult(_0x533760,null))['catch'](handleError(_0x533760,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 56ccb31..8ffb299 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.model.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3212=['api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','util','../../config/logger'];(function(_0x1e8ccf,_0x2214bd){var _0x2f9c09=function(_0x24936b){while(--_0x24936b){_0x1e8ccf['push'](_0x1e8ccf['shift']());}};_0x2f9c09(++_0x2214bd);}(_0x3212,0x150));var _0x2321=function(_0x4b2764,_0x14e36a){_0x4b2764=_0x4b2764-0x0;var _0x30bc3d=_0x3212[_0x4b2764];return _0x30bc3d;};'use strict';var _=require('lodash');var util=require(_0x2321('0x0'));var logger=require(_0x2321('0x1'))(_0x2321('0x2'));var moment=require(_0x2321('0x3'));var BPromise=require(_0x2321('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2321('0x5'));var rimraf=require(_0x2321('0x6'));var config=require(_0x2321('0x7'));var attributes=require(_0x2321('0x8'));module[_0x2321('0x9')]=function(_0x494e24,_0x42af17){return _0x494e24[_0x2321('0xa')](_0x2321('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x2321('0xc'),'fields':[_0x2321('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4aa2=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4aa2,0x134));var _0x24aa=function(_0x19aac7,_0x278e23){_0x19aac7=_0x19aac7-0x0;var _0x395ecf=_0x4aa2[_0x19aac7];return _0x395ecf;};'use strict';var _=require(_0x24aa('0x0'));var util=require(_0x24aa('0x1'));var logger=require(_0x24aa('0x2'))(_0x24aa('0x3'));var moment=require(_0x24aa('0x4'));var BPromise=require('bluebird');var rp=require(_0x24aa('0x5'));var fs=require('fs');var path=require(_0x24aa('0x6'));var rimraf=require('rimraf');var config=require(_0x24aa('0x7'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x32552e,_0x4eb932){return _0x32552e['define'](_0x24aa('0x8'),attributes,{'tableName':_0x24aa('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x24aa('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 983c677..cf2b6ab 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd7b=['OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xfd7b[_0x35b18a];return _0x4db1bd;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require(_0xbfd7('0x2'));var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require(_0xbfd7('0x6'));var logger=require(_0xbfd7('0x7'))(_0xbfd7('0x8'));var config=require(_0xbfd7('0x9'));var jayson=require(_0xbfd7('0xa'));var client=jayson[_0xbfd7('0xb')][_0xbfd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f3067,_0x38b1ef,_0x48f2aa){return new BPromise(function(_0x33dab1,_0x5cee3d){return client[_0xbfd7('0xd')](_0x5f3067,_0x48f2aa)[_0xbfd7('0xe')](function(_0x5a3d78){logger[_0xbfd7('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));logger[_0xbfd7('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x38b1ef,'request\x20sent',JSON[_0xbfd7('0x12')](_0x5a3d78));if(_0x5a3d78[_0xbfd7('0x13')]){if(_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x14')]===0x1f4){logger[_0xbfd7('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')]['message']);return _0x5cee3d(_0x5a3d78[_0xbfd7('0x13')]['message']);}logger['error'](_0xbfd7('0x15'),_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x16')]);return _0x33dab1(_0x5a3d78[_0xbfd7('0x13')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));_0x33dab1(_0x5a3d78[_0xbfd7('0x17')][_0xbfd7('0x16')]);}})[_0xbfd7('0x18')](function(_0x30c721){logger[_0xbfd7('0x13')](_0xbfd7('0x15'),_0x38b1ef,_0x30c721);_0x5cee3d(_0x30c721);});});} \ No newline at end of file +var _0x615a=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x105e3e,_0x4cb667){var _0x5b0125=function(_0x877866){while(--_0x877866){_0x105e3e['push'](_0x105e3e['shift']());}};_0x5b0125(++_0x4cb667);}(_0x615a,0x119));var _0xa615=function(_0x16b962,_0x1e8b75){_0x16b962=_0x16b962-0x0;var _0x5b8877=_0x615a[_0x16b962];return _0x5b8877;};'use strict';var _=require(_0xa615('0x0'));var util=require('util');var moment=require(_0xa615('0x1'));var BPromise=require('bluebird');var rs=require(_0xa615('0x2'));var fs=require('fs');var Redis=require(_0xa615('0x3'));var db=require(_0xa615('0x4'))['db'];var utils=require(_0xa615('0x5'));var logger=require('../../config/logger')(_0xa615('0x6'));var config=require(_0xa615('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa615('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44afda,_0x389dd4,_0x2db48d){return new BPromise(function(_0x1e714d,_0x2eae10){return client['request'](_0x44afda,_0x2db48d)[_0xa615('0x9')](function(_0x52470e){logger[_0xa615('0xa')](_0xa615('0xb'),_0x389dd4,'request\x20sent');logger[_0xa615('0xc')](_0xa615('0xd'),_0x389dd4,_0xa615('0xe'),JSON[_0xa615('0xf')](_0x52470e));if(_0x52470e[_0xa615('0x10')]){if(_0x52470e['error']['code']===0x1f4){logger[_0xa615('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x389dd4,_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);return _0x2eae10(_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x389dd4,_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);return _0x1e714d(_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);}else{logger[_0xa615('0xa')](_0xa615('0xb'),_0x389dd4,_0xa615('0xe'));_0x1e714d(_0x52470e[_0xa615('0x12')][_0xa615('0x11')]);}})[_0xa615('0x13')](function(_0xa86873){logger[_0xa615('0x10')](_0xa615('0xb'),_0x389dd4,_0xa86873);_0x2eae10(_0xa86873);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index acdbb41..9fb5315 100644 --- a/server/api/pause/index.js +++ b/server/api/pause/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8c7=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','./pause.controller'];(function(_0x1d397d,_0x35df36){var _0x4dcae8=function(_0x116960){while(--_0x116960){_0x1d397d['push'](_0x1d397d['shift']());}};_0x4dcae8(++_0x35df36);}(_0xa8c7,0x1a3));var _0x7a8c=function(_0x2f6a82,_0x52def9){_0x2f6a82=_0x2f6a82-0x0;var _0x222196=_0xa8c7[_0x2f6a82];return _0x222196;};'use strict';var multer=require('multer');var util=require(_0x7a8c('0x0'));var path=require('path');var timeout=require(_0x7a8c('0x1'));var express=require(_0x7a8c('0x2'));var router=express['Router']();var fs_extra=require(_0x7a8c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7a8c('0x4'));var config=require('../../config/environment');var controller=require(_0x7a8c('0x5'));router[_0x7a8c('0x6')]('/',auth[_0x7a8c('0x7')](),controller[_0x7a8c('0x8')]);router[_0x7a8c('0x6')](_0x7a8c('0x9'),auth[_0x7a8c('0x7')](),controller[_0x7a8c('0xa')]);router['post']('/',auth[_0x7a8c('0x7')](),controller[_0x7a8c('0xb')]);router[_0x7a8c('0xc')](_0x7a8c('0x9'),auth[_0x7a8c('0x7')](),controller[_0x7a8c('0xd')]);router[_0x7a8c('0xe')](_0x7a8c('0x9'),auth['isAuthenticated'](),controller[_0x7a8c('0xf')]);module[_0x7a8c('0x10')]=router; \ No newline at end of file +var _0xa656=['show','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated'];(function(_0x2039fe,_0x58b9c8){var _0x5ae38b=function(_0x15bf76){while(--_0x15bf76){_0x2039fe['push'](_0x2039fe['shift']());}};_0x5ae38b(++_0x58b9c8);}(_0xa656,0x115));var _0x6a65=function(_0x351595,_0x1a335a){_0x351595=_0x351595-0x0;var _0x31ea4c=_0xa656[_0x351595];return _0x31ea4c;};'use strict';var multer=require(_0x6a65('0x0'));var util=require(_0x6a65('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6a65('0x2')]();var fs_extra=require(_0x6a65('0x3'));var auth=require(_0x6a65('0x4'));var interaction=require(_0x6a65('0x5'));var config=require(_0x6a65('0x6'));var controller=require(_0x6a65('0x7'));router[_0x6a65('0x8')]('/',auth['isAuthenticated'](),controller[_0x6a65('0x9')]);router[_0x6a65('0x8')](_0x6a65('0xa'),auth[_0x6a65('0xb')](),controller[_0x6a65('0xc')]);router['post']('/',auth[_0x6a65('0xb')](),controller['create']);router[_0x6a65('0xd')](_0x6a65('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6a65('0xe')](_0x6a65('0xa'),auth[_0x6a65('0xb')](),controller[_0x6a65('0xf')]);module[_0x6a65('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 6755edb..cfb4db1 100644 --- a/server/api/pause/pause.attributes.js +++ b/server/api/pause/pause.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1dc8=['name','sequelize','exports','STRING'];(function(_0x53f184,_0x2576d2){var _0x48ffa2=function(_0x230b84){while(--_0x230b84){_0x53f184['push'](_0x53f184['shift']());}};_0x48ffa2(++_0x2576d2);}(_0x1dc8,0x85));var _0x81dc=function(_0x253793,_0x2da65e){_0x253793=_0x253793-0x0;var _0x3d6b42=_0x1dc8[_0x253793];return _0x3d6b42;};'use strict';var Sequelize=require(_0x81dc('0x0'));module[_0x81dc('0x1')]={'name':{'type':Sequelize[_0x81dc('0x2')],'unique':_0x81dc('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x81dc('0x2')]}}; \ No newline at end of file +var _0xf202=['name','sequelize','exports'];(function(_0x2f8c4e,_0xcaa470){var _0xc64b81=function(_0x39dedd){while(--_0x39dedd){_0x2f8c4e['push'](_0x2f8c4e['shift']());}};_0xc64b81(++_0xcaa470);}(_0xf202,0x15d));var _0x2f20=function(_0x53dee1,_0xf86314){_0x53dee1=_0x53dee1-0x0;var _0xfdb4c6=_0xf202[_0x53dee1];return _0xfdb4c6;};'use strict';var Sequelize=require(_0x2f20('0x0'));module[_0x2f20('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2f20('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 84d4e07..a08962a 100644 --- a/server/api/pause/pause.controller.js +++ b/server/api/pause/pause.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58e7=['findAll','rows','catch','show','params','length','find','create','body','user','userProfileId','update','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','then','destroy','get','Pauses','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','Pause'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x58e7,0x138));var _0x758e=function(_0x55f6df,_0x1f4b1e){_0x55f6df=_0x55f6df-0x0;var _0x34b94e=_0x58e7[_0x55f6df];return _0x34b94e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x758e('0x0'));var jsonpatch=require(_0x758e('0x1'));var rp=require(_0x758e('0x2'));var moment=require(_0x758e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x758e('0x4'));var path=require('path');var sox=require(_0x758e('0x5'));var csv=require(_0x758e('0x6'));var ejs=require(_0x758e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x758e('0x8'));var squel=require('squel');var crypto=require(_0x758e('0x9'));var jsforce=require(_0x758e('0xa'));var deskjs=require(_0x758e('0xb'));var toCsv=require(_0x758e('0x6'));var querystring=require(_0x758e('0xc'));var Papa=require(_0x758e('0xd'));var Redis=require(_0x758e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x758e('0xf'));var as=require(_0x758e('0x10'));var hardwareService=require(_0x758e('0x11'));var logger=require(_0x758e('0x12'))(_0x758e('0x13'));var utils=require('../../config/utils');var config=require(_0x758e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x758e('0x15'))['db'];function respondWithStatusCode(_0x42c7ec,_0x36a448){_0x36a448=_0x36a448||0xcc;return function(_0x1b2839){if(_0x1b2839){return _0x42c7ec[_0x758e('0x16')](_0x36a448);}return _0x42c7ec['status'](_0x36a448)[_0x758e('0x17')]();};}function respondWithResult(_0x41e2c0,_0x4c4c84){_0x4c4c84=_0x4c4c84||0xc8;return function(_0x2da18d){if(_0x2da18d){return _0x41e2c0[_0x758e('0x18')](_0x4c4c84)[_0x758e('0x19')](_0x2da18d);}};}function respondWithFilteredResult(_0x53eb48,_0x58a2e2){return function(_0x439be8){if(_0x439be8){var _0x35899a=typeof _0x58a2e2[_0x758e('0x1a')]==='undefined'&&typeof _0x58a2e2[_0x758e('0x1b')]==='undefined';var _0x1f2ece=_0x439be8[_0x758e('0x1c')];var _0x1bc11a=_0x35899a?0x0:_0x58a2e2[_0x758e('0x1a')];var _0x2a9f38=_0x35899a?_0x439be8['count']:_0x58a2e2[_0x758e('0x1a')]+_0x58a2e2[_0x758e('0x1b')];var _0x154123;if(_0x2a9f38>=_0x1f2ece){_0x2a9f38=_0x1f2ece;_0x154123=0xc8;}else{_0x154123=0xce;}_0x53eb48[_0x758e('0x18')](_0x154123);return _0x53eb48['set'](_0x758e('0x1d'),_0x1bc11a+'-'+_0x2a9f38+'/'+_0x1f2ece)[_0x758e('0x19')](_0x439be8);}return null;};}function patchUpdates(_0x564233){return function(_0x5f0d74){try{jsonpatch[_0x758e('0x1e')](_0x5f0d74,_0x564233,!![]);}catch(_0x5a0337){return BPromise[_0x758e('0x1f')](_0x5a0337);}return _0x5f0d74['save']();};}function saveUpdates(_0xfa8682,_0x52be64){return function(_0x40c3e9){if(_0x40c3e9){return _0x40c3e9['update'](_0xfa8682)[_0x758e('0x20')](function(_0x4a0a17){return _0x4a0a17;});}return null;};}function removeEntity(_0x49d375,_0x5e6200){return function(_0x4ee311){if(_0x4ee311){return _0x4ee311[_0x758e('0x21')]()['then'](function(){var _0x4c6995=_0x4ee311[_0x758e('0x22')]({'plain':!![]});var _0x2c37b=_0x758e('0x23');return db[_0x758e('0x24')][_0x758e('0x21')]({'where':{'type':_0x2c37b,'resourceId':_0x4c6995['id']}})[_0x758e('0x20')](function(){return _0x4ee311;});})[_0x758e('0x20')](function(){_0x49d375[_0x758e('0x18')](0xcc)[_0x758e('0x17')]();});}};}function handleEntityNotFound(_0x544b0f,_0x4114e8){return function(_0x52d6d2){if(!_0x52d6d2){_0x544b0f[_0x758e('0x16')](0x194);}return _0x52d6d2;};}function handleError(_0x109767,_0x3bd409){_0x3bd409=_0x3bd409||0x1f4;return function(_0x29ade8){logger[_0x758e('0x25')](_0x29ade8[_0x758e('0x26')]);if(_0x29ade8['name']){delete _0x29ade8[_0x758e('0x27')];}_0x109767['status'](_0x3bd409)['send'](_0x29ade8);};}exports['index']=function(_0x1f5608,_0x46f63f){var _0x2ce8ea={},_0x38f06c={},_0x175266={'count':0x0,'rows':[]};var _0x5cde3e=_[_0x758e('0x28')](db['Pause'][_0x758e('0x29')],function(_0x5b5db6){return{'name':_0x5b5db6[_0x758e('0x2a')],'type':_0x5b5db6[_0x758e('0x2b')]['key']};});_0x38f06c['model']=_[_0x758e('0x28')](_0x5cde3e,'name');_0x38f06c[_0x758e('0x2c')]=_[_0x758e('0x2d')](_0x1f5608['query']);_0x38f06c['filters']=_[_0x758e('0x2e')](_0x38f06c[_0x758e('0x2f')],_0x38f06c[_0x758e('0x2c')]);_0x2ce8ea[_0x758e('0x30')]=_['intersection'](_0x38f06c[_0x758e('0x2f')],qs['fields'](_0x1f5608[_0x758e('0x2c')][_0x758e('0x31')]));_0x2ce8ea[_0x758e('0x30')]=_0x2ce8ea['attributes']['length']?_0x2ce8ea[_0x758e('0x30')]:_0x38f06c[_0x758e('0x2f')];if(!_0x1f5608[_0x758e('0x2c')][_0x758e('0x32')](_0x758e('0x33'))){_0x2ce8ea[_0x758e('0x1b')]=qs[_0x758e('0x1b')](_0x1f5608[_0x758e('0x2c')][_0x758e('0x1b')]);_0x2ce8ea['offset']=qs[_0x758e('0x1a')](_0x1f5608[_0x758e('0x2c')][_0x758e('0x1a')]);}_0x2ce8ea[_0x758e('0x34')]=qs[_0x758e('0x35')](_0x1f5608[_0x758e('0x2c')][_0x758e('0x35')]);_0x2ce8ea['where']=qs[_0x758e('0x36')](_[_0x758e('0x37')](_0x1f5608[_0x758e('0x2c')],_0x38f06c['filters']),_0x5cde3e);if(_0x1f5608['query']['filter']){_0x2ce8ea[_0x758e('0x38')]=_[_0x758e('0x39')](_0x2ce8ea['where'],{'$or':_['map'](_0x5cde3e,function(_0x4d45aa){if(_0x4d45aa['type']!==_0x758e('0x3a')){var _0x4eaa32={};_0x4eaa32[_0x4d45aa[_0x758e('0x27')]]={'$like':'%'+_0x1f5608['query'][_0x758e('0x3b')]+'%'};return _0x4eaa32;}})});}_0x2ce8ea=_[_0x758e('0x39')]({},_0x2ce8ea,_0x1f5608[_0x758e('0x3c')]);var _0x5eb766={'where':_0x2ce8ea[_0x758e('0x38')]};return db['Pause'][_0x758e('0x1c')](_0x5eb766)[_0x758e('0x20')](function(_0x13f754){_0x175266[_0x758e('0x1c')]=_0x13f754;if(_0x1f5608[_0x758e('0x2c')][_0x758e('0x3d')]){_0x2ce8ea['include']=[{'all':!![]}];}return db[_0x758e('0x3e')][_0x758e('0x3f')](_0x2ce8ea);})[_0x758e('0x20')](function(_0x8d73ae){_0x175266[_0x758e('0x40')]=_0x8d73ae;return _0x175266;})[_0x758e('0x20')](respondWithFilteredResult(_0x46f63f,_0x2ce8ea))[_0x758e('0x41')](handleError(_0x46f63f,null));};exports[_0x758e('0x42')]=function(_0x41b1ae,_0x54b3db){var _0x3e6749={'raw':!![],'where':{'id':_0x41b1ae[_0x758e('0x43')]['id']}},_0x57e97b={};_0x57e97b[_0x758e('0x2f')]=_['keys'](db[_0x758e('0x3e')][_0x758e('0x29')]);_0x57e97b[_0x758e('0x2c')]=_[_0x758e('0x2d')](_0x41b1ae[_0x758e('0x2c')]);_0x57e97b[_0x758e('0x36')]=_[_0x758e('0x2e')](_0x57e97b[_0x758e('0x2f')],_0x57e97b['query']);_0x3e6749[_0x758e('0x30')]=_[_0x758e('0x2e')](_0x57e97b[_0x758e('0x2f')],qs[_0x758e('0x31')](_0x41b1ae[_0x758e('0x2c')][_0x758e('0x31')]));_0x3e6749['attributes']=_0x3e6749[_0x758e('0x30')][_0x758e('0x44')]?_0x3e6749['attributes']:_0x57e97b[_0x758e('0x2f')];if(_0x41b1ae[_0x758e('0x2c')][_0x758e('0x3d')]){_0x3e6749['include']=[{'all':!![]}];}_0x3e6749=_[_0x758e('0x39')]({},_0x3e6749,_0x41b1ae[_0x758e('0x3c')]);return db['Pause'][_0x758e('0x45')](_0x3e6749)[_0x758e('0x20')](handleEntityNotFound(_0x54b3db,null))['then'](respondWithResult(_0x54b3db,null))[_0x758e('0x41')](handleError(_0x54b3db,null));};exports[_0x758e('0x46')]=function(_0x55a4ed,_0x2c7a87){return db[_0x758e('0x3e')][_0x758e('0x46')](_0x55a4ed[_0x758e('0x47')],{})[_0x758e('0x20')](function(_0x6fd2b5){var _0x5a1779=_0x55a4ed[_0x758e('0x48')][_0x758e('0x22')]({'plain':!![]});if(!_0x5a1779)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a1779['role']===_0x758e('0x48')){var _0x50c3a7=_0x6fd2b5['get']({'plain':!![]});var _0x3e6349=_0x758e('0x23');return db['UserProfileSection'][_0x758e('0x45')]({'where':{'name':_0x3e6349,'userProfileId':_0x5a1779[_0x758e('0x49')]},'raw':!![]})[_0x758e('0x20')](function(_0x331122){if(_0x331122&&_0x331122['autoAssociation']===0x0){return db[_0x758e('0x24')][_0x758e('0x46')]({'name':_0x50c3a7['name'],'resourceId':_0x50c3a7['id'],'type':_0x331122[_0x758e('0x27')],'sectionId':_0x331122['id']},{})[_0x758e('0x20')](function(){return _0x6fd2b5;});}else{return _0x6fd2b5;}})[_0x758e('0x41')](function(_0x139d4d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x139d4d);throw _0x139d4d;});}return _0x6fd2b5;})[_0x758e('0x20')](respondWithResult(_0x2c7a87,0xc9))[_0x758e('0x41')](handleError(_0x2c7a87,null));};exports[_0x758e('0x4a')]=function(_0x6e28c9,_0x4bf9d0){if(_0x6e28c9[_0x758e('0x47')]['id']){delete _0x6e28c9['body']['id'];}return db['Pause'][_0x758e('0x45')]({'where':{'id':_0x6e28c9[_0x758e('0x43')]['id']}})[_0x758e('0x20')](handleEntityNotFound(_0x4bf9d0,null))[_0x758e('0x20')](saveUpdates(_0x6e28c9[_0x758e('0x47')],null))[_0x758e('0x20')](respondWithResult(_0x4bf9d0,null))[_0x758e('0x41')](handleError(_0x4bf9d0,null));};exports[_0x758e('0x21')]=function(_0x57953f,_0x1dec00){return db['Pause'][_0x758e('0x45')]({'where':{'id':_0x57953f[_0x758e('0x43')]['id']}})['then'](handleEntityNotFound(_0x1dec00,null))[_0x758e('0x20')](removeEntity(_0x1dec00,null))[_0x758e('0x41')](handleError(_0x1dec00,null));}; \ No newline at end of file +var _0x09ca=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','get','Pauses','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','Pause','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x200152,_0x2c9a47){var _0xdbba14=function(_0x349a75){while(--_0x349a75){_0x200152['push'](_0x200152['shift']());}};_0xdbba14(++_0x2c9a47);}(_0x09ca,0x1e5));var _0xa09c=function(_0x510ee8,_0x519bc6){_0x510ee8=_0x510ee8-0x0;var _0x5280c1=_0x09ca[_0x510ee8];return _0x5280c1;};'use strict';var emlformat=require(_0xa09c('0x0'));var rimraf=require(_0xa09c('0x1'));var zipdir=require(_0xa09c('0x2'));var jsonpatch=require(_0xa09c('0x3'));var rp=require(_0xa09c('0x4'));var moment=require('moment');var BPromise=require(_0xa09c('0x5'));var Mustache=require(_0xa09c('0x6'));var util=require(_0xa09c('0x7'));var path=require(_0xa09c('0x8'));var sox=require(_0xa09c('0x9'));var csv=require(_0xa09c('0xa'));var ejs=require(_0xa09c('0xb'));var fs=require('fs');var fs_extra=require(_0xa09c('0xc'));var _=require(_0xa09c('0xd'));var squel=require(_0xa09c('0xe'));var crypto=require(_0xa09c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa09c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa09c('0x11'));var Papa=require('papaparse');var Redis=require(_0xa09c('0x12'));var authService=require(_0xa09c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa09c('0x14'));var logger=require(_0xa09c('0x15'))(_0xa09c('0x16'));var utils=require(_0xa09c('0x17'));var config=require(_0xa09c('0x18'));var licenseUtil=require(_0xa09c('0x19'));var db=require(_0xa09c('0x1a'))['db'];function respondWithStatusCode(_0x1c3c76,_0x3502f7){_0x3502f7=_0x3502f7||0xcc;return function(_0x19f4af){if(_0x19f4af){return _0x1c3c76[_0xa09c('0x1b')](_0x3502f7);}return _0x1c3c76[_0xa09c('0x1c')](_0x3502f7)[_0xa09c('0x1d')]();};}function respondWithResult(_0x266b82,_0x44d630){_0x44d630=_0x44d630||0xc8;return function(_0x408871){if(_0x408871){return _0x266b82['status'](_0x44d630)[_0xa09c('0x1e')](_0x408871);}};}function respondWithFilteredResult(_0x41b65d,_0x406289){return function(_0x4936e2){if(_0x4936e2){var _0x231060=typeof _0x406289[_0xa09c('0x1f')]==='undefined'&&typeof _0x406289[_0xa09c('0x20')]===_0xa09c('0x21');var _0x51216d=_0x4936e2[_0xa09c('0x22')];var _0x9fec1d=_0x231060?0x0:_0x406289[_0xa09c('0x1f')];var _0x14f5c6=_0x231060?_0x4936e2[_0xa09c('0x22')]:_0x406289['offset']+_0x406289['limit'];var _0x6ae886;if(_0x14f5c6>=_0x51216d){_0x14f5c6=_0x51216d;_0x6ae886=0xc8;}else{_0x6ae886=0xce;}_0x41b65d[_0xa09c('0x1c')](_0x6ae886);return _0x41b65d['set'](_0xa09c('0x23'),_0x9fec1d+'-'+_0x14f5c6+'/'+_0x51216d)[_0xa09c('0x1e')](_0x4936e2);}return null;};}function patchUpdates(_0x5864ea){return function(_0x431ac0){try{jsonpatch[_0xa09c('0x24')](_0x431ac0,_0x5864ea,!![]);}catch(_0xa40c70){return BPromise[_0xa09c('0x25')](_0xa40c70);}return _0x431ac0[_0xa09c('0x26')]();};}function saveUpdates(_0x12bc97,_0x4b3320){return function(_0x4fb286){if(_0x4fb286){return _0x4fb286['update'](_0x12bc97)[_0xa09c('0x27')](function(_0xf0f42f){return _0xf0f42f;});}return null;};}function removeEntity(_0x2d1f7f,_0x585acc){return function(_0x585c03){if(_0x585c03){return _0x585c03[_0xa09c('0x28')]()[_0xa09c('0x27')](function(){var _0x5e436d=_0x585c03[_0xa09c('0x29')]({'plain':!![]});var _0x4d1ff9=_0xa09c('0x2a');return db['UserProfileResource'][_0xa09c('0x28')]({'where':{'type':_0x4d1ff9,'resourceId':_0x5e436d['id']}})[_0xa09c('0x27')](function(){return _0x585c03;});})[_0xa09c('0x27')](function(){_0x2d1f7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc413,_0xf7adef){return function(_0x45dd96){if(!_0x45dd96){_0x2bc413[_0xa09c('0x1b')](0x194);}return _0x45dd96;};}function handleError(_0x334392,_0x1bcfe3){_0x1bcfe3=_0x1bcfe3||0x1f4;return function(_0x3381d2){logger[_0xa09c('0x2b')](_0x3381d2[_0xa09c('0x2c')]);if(_0x3381d2[_0xa09c('0x2d')]){delete _0x3381d2['name'];}_0x334392[_0xa09c('0x1c')](_0x1bcfe3)['send'](_0x3381d2);};}exports[_0xa09c('0x2e')]=function(_0x23a158,_0x2f4ba9){var _0x3abe74={},_0x2a1e81={},_0x339512={'count':0x0,'rows':[]};var _0x38b6e9=_[_0xa09c('0x2f')](db['Pause'][_0xa09c('0x30')],function(_0x5c3195){return{'name':_0x5c3195[_0xa09c('0x31')],'type':_0x5c3195['type']['key']};});_0x2a1e81[_0xa09c('0x32')]=_[_0xa09c('0x2f')](_0x38b6e9,_0xa09c('0x2d'));_0x2a1e81[_0xa09c('0x33')]=_[_0xa09c('0x34')](_0x23a158['query']);_0x2a1e81['filters']=_[_0xa09c('0x35')](_0x2a1e81[_0xa09c('0x32')],_0x2a1e81[_0xa09c('0x33')]);_0x3abe74[_0xa09c('0x36')]=_['intersection'](_0x2a1e81[_0xa09c('0x32')],qs[_0xa09c('0x37')](_0x23a158[_0xa09c('0x33')][_0xa09c('0x37')]));_0x3abe74[_0xa09c('0x36')]=_0x3abe74[_0xa09c('0x36')][_0xa09c('0x38')]?_0x3abe74[_0xa09c('0x36')]:_0x2a1e81[_0xa09c('0x32')];if(!_0x23a158[_0xa09c('0x33')][_0xa09c('0x39')](_0xa09c('0x3a'))){_0x3abe74[_0xa09c('0x20')]=qs[_0xa09c('0x20')](_0x23a158['query'][_0xa09c('0x20')]);_0x3abe74[_0xa09c('0x1f')]=qs[_0xa09c('0x1f')](_0x23a158['query'][_0xa09c('0x1f')]);}_0x3abe74['order']=qs['sort'](_0x23a158[_0xa09c('0x33')][_0xa09c('0x3b')]);_0x3abe74[_0xa09c('0x3c')]=qs[_0xa09c('0x3d')](_[_0xa09c('0x3e')](_0x23a158[_0xa09c('0x33')],_0x2a1e81[_0xa09c('0x3d')]),_0x38b6e9);if(_0x23a158[_0xa09c('0x33')][_0xa09c('0x3f')]){_0x3abe74[_0xa09c('0x3c')]=_[_0xa09c('0x40')](_0x3abe74['where'],{'$or':_[_0xa09c('0x2f')](_0x38b6e9,function(_0x4f7f51){if(_0x4f7f51['type']!==_0xa09c('0x41')){var _0x24285d={};_0x24285d[_0x4f7f51['name']]={'$like':'%'+_0x23a158[_0xa09c('0x33')][_0xa09c('0x3f')]+'%'};return _0x24285d;}})});}_0x3abe74=_[_0xa09c('0x40')]({},_0x3abe74,_0x23a158['options']);var _0x55990c={'where':_0x3abe74['where']};return db['Pause']['count'](_0x55990c)[_0xa09c('0x27')](function(_0x392616){_0x339512[_0xa09c('0x22')]=_0x392616;if(_0x23a158[_0xa09c('0x33')][_0xa09c('0x42')]){_0x3abe74[_0xa09c('0x43')]=[{'all':!![]}];}return db[_0xa09c('0x44')]['findAll'](_0x3abe74);})['then'](function(_0x48fa79){_0x339512[_0xa09c('0x45')]=_0x48fa79;return _0x339512;})[_0xa09c('0x27')](respondWithFilteredResult(_0x2f4ba9,_0x3abe74))[_0xa09c('0x46')](handleError(_0x2f4ba9,null));};exports['show']=function(_0x12e6ea,_0x3e7859){var _0x35c778={'raw':!![],'where':{'id':_0x12e6ea[_0xa09c('0x47')]['id']}},_0xffda4d={};_0xffda4d[_0xa09c('0x32')]=_[_0xa09c('0x34')](db[_0xa09c('0x44')]['rawAttributes']);_0xffda4d['query']=_[_0xa09c('0x34')](_0x12e6ea[_0xa09c('0x33')]);_0xffda4d[_0xa09c('0x3d')]=_[_0xa09c('0x35')](_0xffda4d['model'],_0xffda4d['query']);_0x35c778['attributes']=_[_0xa09c('0x35')](_0xffda4d[_0xa09c('0x32')],qs[_0xa09c('0x37')](_0x12e6ea[_0xa09c('0x33')]['fields']));_0x35c778[_0xa09c('0x36')]=_0x35c778['attributes'][_0xa09c('0x38')]?_0x35c778[_0xa09c('0x36')]:_0xffda4d[_0xa09c('0x32')];if(_0x12e6ea[_0xa09c('0x33')][_0xa09c('0x42')]){_0x35c778[_0xa09c('0x43')]=[{'all':!![]}];}_0x35c778=_['merge']({},_0x35c778,_0x12e6ea[_0xa09c('0x48')]);return db['Pause'][_0xa09c('0x49')](_0x35c778)['then'](handleEntityNotFound(_0x3e7859,null))['then'](respondWithResult(_0x3e7859,null))[_0xa09c('0x46')](handleError(_0x3e7859,null));};exports[_0xa09c('0x4a')]=function(_0x18a026,_0x3ba349){return db[_0xa09c('0x44')][_0xa09c('0x4a')](_0x18a026[_0xa09c('0x4b')],{})['then'](function(_0x339e69){var _0x2a478c=_0x18a026[_0xa09c('0x4c')]['get']({'plain':!![]});if(!_0x2a478c)throw new Error(_0xa09c('0x4d'));if(_0x2a478c[_0xa09c('0x4e')]===_0xa09c('0x4c')){var _0x6620b1=_0x339e69[_0xa09c('0x29')]({'plain':!![]});var _0x2bda1f=_0xa09c('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x2bda1f,'userProfileId':_0x2a478c[_0xa09c('0x4f')]},'raw':!![]})['then'](function(_0x49e230){if(_0x49e230&&_0x49e230[_0xa09c('0x50')]===0x0){return db[_0xa09c('0x51')][_0xa09c('0x4a')]({'name':_0x6620b1[_0xa09c('0x2d')],'resourceId':_0x6620b1['id'],'type':_0x49e230['name'],'sectionId':_0x49e230['id']},{})[_0xa09c('0x27')](function(){return _0x339e69;});}else{return _0x339e69;}})[_0xa09c('0x46')](function(_0x2260ff){logger['error'](_0xa09c('0x52'),_0x2260ff);throw _0x2260ff;});}return _0x339e69;})[_0xa09c('0x27')](respondWithResult(_0x3ba349,0xc9))[_0xa09c('0x46')](handleError(_0x3ba349,null));};exports[_0xa09c('0x53')]=function(_0x2b4c7e,_0x454c25){if(_0x2b4c7e[_0xa09c('0x4b')]['id']){delete _0x2b4c7e[_0xa09c('0x4b')]['id'];}return db[_0xa09c('0x44')][_0xa09c('0x49')]({'where':{'id':_0x2b4c7e[_0xa09c('0x47')]['id']}})[_0xa09c('0x27')](handleEntityNotFound(_0x454c25,null))['then'](saveUpdates(_0x2b4c7e[_0xa09c('0x4b')],null))['then'](respondWithResult(_0x454c25,null))['catch'](handleError(_0x454c25,null));};exports[_0xa09c('0x28')]=function(_0x1114fc,_0x22a3d6){return db['Pause']['find']({'where':{'id':_0x1114fc['params']['id']}})[_0xa09c('0x27')](handleEntityNotFound(_0x22a3d6,null))[_0xa09c('0x27')](removeEntity(_0x22a3d6,null))[_0xa09c('0x46')](handleError(_0x22a3d6,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 267e56a..81b6504 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x2b9e7d,_0x3db522){var _0x2605fe=function(_0x33f246){while(--_0x33f246){_0x2b9e7d['push'](_0x2b9e7d['shift']());}};_0x2605fe(++_0x3db522);}(_0x814b,0x1a2));var _0xb814=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x814b[_0x462999];return _0x4b1366;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x43ca06,_0x1fa6df){var _0x50798f=function(_0xeb818){while(--_0xeb818){_0x43ca06['push'](_0x43ca06['shift']());}};_0x50798f(++_0x1fa6df);}(_0xf494,0x1c6));var _0x4f49=function(_0x1e06f7,_0x516888){_0x1e06f7=_0x1e06f7-0x0;var _0x23010d=_0xf494[_0x1e06f7];return _0x23010d;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 97d9a49..8f79533 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4634c9,_0x13c633){var _0x2dd6ff=function(_0x5d790b){while(--_0x5d790b){_0x4634c9['push'](_0x4634c9['shift']());}};_0x2dd6ff(++_0x13c633);}(_0xb10b,0x12a));var _0xbb10=function(_0x420a7c,_0x3ef0bc){_0x420a7c=_0x420a7c-0x0;var _0x311c52=_0xb10b[_0x420a7c];return _0x311c52;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5f15a9,_0x56c353){var _0x3f3686=function(_0x330dd2){while(--_0x330dd2){_0x5f15a9['push'](_0x5f15a9['shift']());}};_0x3f3686(++_0x56c353);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a0585,_0x12062b){_0x3a0585=_0x3a0585-0x0;var _0xbdc3fc=_0xb10b[_0x3a0585];return _0xbdc3fc;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 068b855..dd4e234 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb332=['server/files/plugins','originalname','replace','format','basename','extname','now','post','single','file','upload','/:id','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','root'];(function(_0x352588,_0x19b360){var _0x2c8775=function(_0xd44f4e){while(--_0xd44f4e){_0x352588['push'](_0x352588['shift']());}};_0x2c8775(++_0x19b360);}(_0xb332,0xd9));var _0x2b33=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0xb332[_0x2b0a86];return _0x955940;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b33('0x5'));var controller=require('./plugin.controller');router[_0x2b33('0x6')]('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0x8')]);router[_0x2b33('0x6')]('/webhook',controller['webhookGet']);router[_0x2b33('0x6')]('/:id',auth[_0x2b33('0x7')](),controller[_0x2b33('0x9')]);router[_0x2b33('0x6')](_0x2b33('0xa'),auth['isAuthenticated'](),controller[_0x2b33('0xb')]);var upload=multer({'storage':multer[_0x2b33('0xc')]({'destination':function(_0x1be19d,_0x1d83a6,_0x1989f3){_0x1989f3(null,path[_0x2b33('0xd')](config[_0x2b33('0xe')],_0x2b33('0xf')));},'filename':function(_0x1e0d36,_0x3969cb,_0xca2248){_0x3969cb['originalname']=_0x3969cb[_0x2b33('0x10')][_0x2b33('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xca2248(null,util[_0x2b33('0x12')]('%s-%s%s',path[_0x2b33('0x13')](_0x3969cb['originalname'],path[_0x2b33('0x14')](_0x3969cb[_0x2b33('0x10')])),Date[_0x2b33('0x15')](),path['extname'](_0x3969cb['originalname'])));}})});router[_0x2b33('0x16')]('/',upload[_0x2b33('0x17')](_0x2b33('0x18')),controller[_0x2b33('0x19')]);router[_0x2b33('0x16')]('/webhook',controller['webhookPost']);router['put'](_0x2b33('0x1a'),auth['isAuthenticated'](),controller['update']);router[_0x2b33('0x1b')](_0x2b33('0x1a'),auth[_0x2b33('0x7')](),controller['delete']);module[_0x2b33('0x1c')]=router; \ No newline at end of file +var _0xac9d=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','post','single','file','upload'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0xac9d,0x14d));var _0xdac9=function(_0x55d893,_0x325ebe){_0x55d893=_0x55d893-0x0;var _0x52d152=_0xac9d[_0x55d893];return _0x52d152;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./plugin.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),controller[_0xdac9('0xd')]);router['get'](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0xf')]);router[_0xdac9('0x9')](_0xdac9('0x10'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x11')]);var upload=multer({'storage':multer[_0xdac9('0x12')]({'destination':function(_0x255627,_0x1b604a,_0xbb5615){_0xbb5615(null,path['join'](config[_0xdac9('0x13')],_0xdac9('0x14')));},'filename':function(_0x5a9bde,_0x3d8e97,_0xeddbc1){_0x3d8e97[_0xdac9('0x15')]=_0x3d8e97['originalname'][_0xdac9('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xeddbc1(null,util[_0xdac9('0x17')](_0xdac9('0x18'),path['basename'](_0x3d8e97['originalname'],path[_0xdac9('0x19')](_0x3d8e97[_0xdac9('0x15')])),Date['now'](),path[_0xdac9('0x19')](_0x3d8e97[_0xdac9('0x15')])));}})});router[_0xdac9('0x1a')]('/',upload[_0xdac9('0x1b')](_0xdac9('0x1c')),controller[_0xdac9('0x1d')]);router[_0xdac9('0x1a')](_0xdac9('0xc'),controller['webhookPost']);router[_0xdac9('0x1e')](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0x1f')]);router[_0xdac9('0x20')](_0xdac9('0xe'),auth[_0xdac9('0xa')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a47e548..ec55145 100644 --- a/server/api/plugin/plugin.attributes.js +++ b/server/api/plugin/plugin.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d79=['never','sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always'];(function(_0xb6475c,_0x176401){var _0x583182=function(_0x348b86){while(--_0x348b86){_0xb6475c['push'](_0xb6475c['shift']());}};_0x583182(++_0x176401);}(_0x2d79,0x1a3));var _0x92d7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2d79[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x92d7('0x0'));module['exports']={'name':{'type':Sequelize[_0x92d7('0x1')]},'type':{'type':Sequelize[_0x92d7('0x2')](_0x92d7('0x3'),_0x92d7('0x4'))},'description':{'type':Sequelize[_0x92d7('0x5')]},'version':{'type':Sequelize[_0x92d7('0x5')]},'path':{'type':Sequelize[_0x92d7('0x1')],'comment':_0x92d7('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x92d7('0x7'),_0x92d7('0x8'),_0x92d7('0x9'),_0x92d7('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x92d7('0x1')]},'adminUrl':{'type':Sequelize[_0x92d7('0x1')]},'agentUrl':{'type':Sequelize[_0x92d7('0x1')]},'scriptName':{'type':Sequelize[_0x92d7('0x1')]},'scriptPath':{'type':Sequelize[_0x92d7('0x1')]}}; \ No newline at end of file +var _0x04e9=['always','sequelize','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly'];(function(_0x3efc2b,_0x30e89e){var _0x143578=function(_0x506c2d){while(--_0x506c2d){_0x3efc2b['push'](_0x3efc2b['shift']());}};_0x143578(++_0x30e89e);}(_0x04e9,0xe7));var _0x904e=function(_0x2cf53d,_0x37dc0d){_0x2cf53d=_0x2cf53d-0x0;var _0x5cd359=_0x04e9[_0x2cf53d];return _0x5cd359;};'use strict';var Sequelize=require(_0x904e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x904e('0x1'),_0x904e('0x2'))},'description':{'type':Sequelize[_0x904e('0x3')]},'version':{'type':Sequelize[_0x904e('0x3')]},'path':{'type':Sequelize[_0x904e('0x4')],'comment':_0x904e('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x904e('0x6')},'sidebar':{'type':Sequelize[_0x904e('0x7')](_0x904e('0x8'),'agentOnly',_0x904e('0x9'),'never'),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x904e('0x4')]},'agentUrl':{'type':Sequelize[_0x904e('0x4')]},'scriptName':{'type':Sequelize[_0x904e('0x4')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 9e91bda..1616e9f 100644 --- a/server/api/plugin/plugin.controller.js +++ b/server/api/plugin/plugin.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa183=['\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','http://localhost:','format','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','Plugin','includeAll','include','findAll','rows','catch','show','keys','filters','find','download','params','join','root','server/files/plugins','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Temporary\x20file\x20removed','upload','extname','file','filename','info','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','scriptName','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port'];(function(_0x2507dd,_0x4f5114){var _0x5991cf=function(_0x4ac9aa){while(--_0x4ac9aa){_0x2507dd['push'](_0x2507dd['shift']());}};_0x5991cf(++_0x4f5114);}(_0xa183,0x162));var _0x3a18=function(_0x4c0625,_0xb2eacf){_0x4c0625=_0x4c0625-0x0;var _0x37e095=_0xa183[_0x4c0625];return _0x37e095;};'use strict';var emlformat=require(_0x3a18('0x0'));var rimraf=require(_0x3a18('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a18('0x2'));var rp=require('request-promise');var moment=require(_0x3a18('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3a18('0x4'));var path=require(_0x3a18('0x5'));var sox=require(_0x3a18('0x6'));var csv=require('to-csv');var ejs=require(_0x3a18('0x7'));var fs=require('fs');var fs_extra=require(_0x3a18('0x8'));var _=require(_0x3a18('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3a18('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3a18('0xb'));var querystring=require(_0x3a18('0xc'));var Papa=require(_0x3a18('0xd'));var extract=require(_0x3a18('0xe'));var rimraf=require(_0x3a18('0x1'));var archiver=require(_0x3a18('0xf'));var Redis=require(_0x3a18('0x10'));var authService=require(_0x3a18('0x11'));var qs=require(_0x3a18('0x12'));var as=require(_0x3a18('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a18('0x14'))(_0x3a18('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3a18('0x16'));var db=require(_0x3a18('0x17'))['db'];config[_0x3a18('0x18')]=_[_0x3a18('0x19')](config[_0x3a18('0x18')],{'host':_0x3a18('0x1a'),'port':0x18eb});var socket=require(_0x3a18('0x1b'))(new Redis(config[_0x3a18('0x18')]));require('./plugin.socket')[_0x3a18('0x1c')](socket);function respondWithStatusCode(_0xe3876a,_0x1e7489){_0x1e7489=_0x1e7489||0xcc;return function(_0x4872ab){if(_0x4872ab){return _0xe3876a[_0x3a18('0x1d')](_0x1e7489);}return _0xe3876a[_0x3a18('0x1e')](_0x1e7489)['end']();};}function respondWithResult(_0x11bb98,_0x253c74){_0x253c74=_0x253c74||0xc8;return function(_0x505676){if(_0x505676){return _0x11bb98['status'](_0x253c74)['json'](_0x505676);}};}function respondWithFilteredResult(_0xe81a72,_0xaf595c){return function(_0x863756){if(_0x863756){var _0x5ab35d=typeof _0xaf595c[_0x3a18('0x1f')]==='undefined'&&typeof _0xaf595c['limit']===_0x3a18('0x20');var _0x4aa194=_0x863756[_0x3a18('0x21')];var _0x427dae=_0x5ab35d?0x0:_0xaf595c[_0x3a18('0x1f')];var _0x9cc50d=_0x5ab35d?_0x863756[_0x3a18('0x21')]:_0xaf595c[_0x3a18('0x1f')]+_0xaf595c['limit'];var _0x29b025;if(_0x9cc50d>=_0x4aa194){_0x9cc50d=_0x4aa194;_0x29b025=0xc8;}else{_0x29b025=0xce;}_0xe81a72['status'](_0x29b025);return _0xe81a72[_0x3a18('0x22')](_0x3a18('0x23'),_0x427dae+'-'+_0x9cc50d+'/'+_0x4aa194)[_0x3a18('0x24')](_0x863756);}return null;};}function patchUpdates(_0x202026){return function(_0x2943a4){try{jsonpatch[_0x3a18('0x25')](_0x2943a4,_0x202026,!![]);}catch(_0x23c8fb){return BPromise[_0x3a18('0x26')](_0x23c8fb);}return _0x2943a4[_0x3a18('0x27')]();};}function saveUpdates(_0x533fcf,_0x556b15){return function(_0x22715a){if(_0x22715a){return _0x22715a['update'](_0x533fcf)[_0x3a18('0x28')](function(_0x5df1ac){return _0x5df1ac;});}return null;};}function removeEntity(_0x40f678,_0x35737c){return function(_0x5133a5){if(_0x5133a5){return _0x5133a5[_0x3a18('0x29')]()[_0x3a18('0x28')](function(){var _0x34cd50=_0x5133a5[_0x3a18('0x2a')]({'plain':!![]});var _0xbb6caa=_0x3a18('0x2b');return db[_0x3a18('0x2c')][_0x3a18('0x29')]({'where':{'type':_0xbb6caa,'resourceId':_0x34cd50['id']}})[_0x3a18('0x28')](function(){return _0x5133a5;});})[_0x3a18('0x28')](function(){_0x40f678['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f54d9,_0x1ef002){return function(_0x5de1f9){if(!_0x5de1f9){_0x4f54d9[_0x3a18('0x1d')](0x194);}return _0x5de1f9;};}function handleError(_0x1ebfa1,_0x50f0fc){_0x50f0fc=_0x50f0fc||0x1f4;return function(_0x2d9cca){logger[_0x3a18('0x2d')](_0x2d9cca[_0x3a18('0x2e')]);if(_0x2d9cca[_0x3a18('0x2f')]){delete _0x2d9cca[_0x3a18('0x2f')];}_0x1ebfa1[_0x3a18('0x1e')](_0x50f0fc)[_0x3a18('0x30')](_0x2d9cca);};}exports['index']=function(_0x131ce8,_0x22464d){var _0x13075c={},_0x31e5a8={},_0x125507={'count':0x0,'rows':[]};var _0x7e9797=_[_0x3a18('0x31')](db['Plugin'][_0x3a18('0x32')],function(_0x512cb7){return{'name':_0x512cb7[_0x3a18('0x33')],'type':_0x512cb7[_0x3a18('0x34')][_0x3a18('0x35')]};});_0x31e5a8[_0x3a18('0x36')]=_['map'](_0x7e9797,'name');_0x31e5a8[_0x3a18('0x37')]=_['keys'](_0x131ce8[_0x3a18('0x37')]);_0x31e5a8['filters']=_[_0x3a18('0x38')](_0x31e5a8['model'],_0x31e5a8[_0x3a18('0x37')]);_0x13075c[_0x3a18('0x39')]=_[_0x3a18('0x38')](_0x31e5a8[_0x3a18('0x36')],qs[_0x3a18('0x3a')](_0x131ce8[_0x3a18('0x37')][_0x3a18('0x3a')]));_0x13075c[_0x3a18('0x39')]=_0x13075c[_0x3a18('0x39')][_0x3a18('0x3b')]?_0x13075c[_0x3a18('0x39')]:_0x31e5a8[_0x3a18('0x36')];if(!_0x131ce8['query'][_0x3a18('0x3c')]('nolimit')){_0x13075c[_0x3a18('0x3d')]=qs[_0x3a18('0x3d')](_0x131ce8[_0x3a18('0x37')]['limit']);_0x13075c['offset']=qs[_0x3a18('0x1f')](_0x131ce8[_0x3a18('0x37')][_0x3a18('0x1f')]);}_0x13075c['order']=qs[_0x3a18('0x3e')](_0x131ce8[_0x3a18('0x37')][_0x3a18('0x3e')]);_0x13075c['where']=qs['filters'](_[_0x3a18('0x3f')](_0x131ce8[_0x3a18('0x37')],_0x31e5a8['filters']),_0x7e9797);if(_0x131ce8['query'][_0x3a18('0x40')]){_0x13075c[_0x3a18('0x41')]=_[_0x3a18('0x42')](_0x13075c[_0x3a18('0x41')],{'$or':_[_0x3a18('0x31')](_0x7e9797,function(_0x562212){if(_0x562212['type']!==_0x3a18('0x43')){var _0x413876={};_0x413876[_0x562212['name']]={'$like':'%'+_0x131ce8[_0x3a18('0x37')][_0x3a18('0x40')]+'%'};return _0x413876;}})});}_0x13075c=_['merge']({},_0x13075c,_0x131ce8[_0x3a18('0x44')]);var _0x3898ae={'where':_0x13075c[_0x3a18('0x41')]};return db[_0x3a18('0x45')]['count'](_0x3898ae)[_0x3a18('0x28')](function(_0xc54653){_0x125507['count']=_0xc54653;if(_0x131ce8[_0x3a18('0x37')][_0x3a18('0x46')]){_0x13075c[_0x3a18('0x47')]=[{'all':!![]}];}return db[_0x3a18('0x45')][_0x3a18('0x48')](_0x13075c);})[_0x3a18('0x28')](function(_0x1d3dc7){_0x125507[_0x3a18('0x49')]=_0x1d3dc7;return _0x125507;})[_0x3a18('0x28')](respondWithFilteredResult(_0x22464d,_0x13075c))[_0x3a18('0x4a')](handleError(_0x22464d,null));};exports[_0x3a18('0x4b')]=function(_0x4f9655,_0x346cd9){var _0x2ec911={'raw':!![],'where':{'id':_0x4f9655['params']['id']}},_0xf5f798={};_0xf5f798['model']=_[_0x3a18('0x4c')](db[_0x3a18('0x45')]['rawAttributes']);_0xf5f798['query']=_['keys'](_0x4f9655[_0x3a18('0x37')]);_0xf5f798[_0x3a18('0x4d')]=_[_0x3a18('0x38')](_0xf5f798[_0x3a18('0x36')],_0xf5f798[_0x3a18('0x37')]);_0x2ec911['attributes']=_[_0x3a18('0x38')](_0xf5f798[_0x3a18('0x36')],qs[_0x3a18('0x3a')](_0x4f9655[_0x3a18('0x37')][_0x3a18('0x3a')]));_0x2ec911[_0x3a18('0x39')]=_0x2ec911[_0x3a18('0x39')]['length']?_0x2ec911['attributes']:_0xf5f798[_0x3a18('0x36')];if(_0x4f9655[_0x3a18('0x37')][_0x3a18('0x46')]){_0x2ec911[_0x3a18('0x47')]=[{'all':!![]}];}_0x2ec911=_[_0x3a18('0x42')]({},_0x2ec911,_0x4f9655[_0x3a18('0x44')]);return db[_0x3a18('0x45')][_0x3a18('0x4e')](_0x2ec911)['then'](handleEntityNotFound(_0x346cd9,null))[_0x3a18('0x28')](respondWithResult(_0x346cd9,null))[_0x3a18('0x4a')](handleError(_0x346cd9,null));};exports[_0x3a18('0x4f')]=function(_0x448e67,_0x5195aa,_0x4cc867){return db[_0x3a18('0x45')][_0x3a18('0x4e')]({'where':{'id':_0x448e67[_0x3a18('0x50')]['id']},'attributes':['name',_0x3a18('0x5')],'raw':!![]})[_0x3a18('0x28')](handleEntityNotFound(_0x5195aa,null))[_0x3a18('0x28')](function(_0x2714fb){if(_0x2714fb){var _0x260394=path[_0x3a18('0x51')](config[_0x3a18('0x52')],_0x3a18('0x53'),util['format']('%s.zip',path[_0x3a18('0x54')](_0x2714fb[_0x3a18('0x5')])));var _0x1e2d1f=fs[_0x3a18('0x55')](_0x260394);var _0x277f9d=archiver('zip',{'zlib':{'level':0x9}});_0x277f9d['on'](_0x3a18('0x56'),function(_0x50600a){if(_0x50600a[_0x3a18('0x57')]===_0x3a18('0x58')){logger['error'](_0x50600a);}else{throw new db[(_0x3a18('0x59'))][(_0x3a18('0x5a'))](_0x3a18('0x5b'));}});_0x277f9d['on'](_0x3a18('0x2d'),function(_0x4ece2a){throw new db[(_0x3a18('0x59'))][(_0x3a18('0x5a'))](_0x3a18('0x5b'));});_0x277f9d[_0x3a18('0x5c')](_0x1e2d1f);_0x277f9d[_0x3a18('0x5d')]('**/*',{'cwd':path[_0x3a18('0x51')](config[_0x3a18('0x52')],_0x3a18('0x53'),path['dirname'](_0x2714fb['path'])),'ignore':[path['join'](path['basename'](_0x2714fb[_0x3a18('0x5')]),_0x3a18('0x5e')),path[_0x3a18('0x51')](path[_0x3a18('0x54')](_0x2714fb[_0x3a18('0x5')]),_0x3a18('0x5f'))],'nodir':!![]})[_0x3a18('0x60')]();_0x1e2d1f['on'](_0x3a18('0x61'),function(){if(!fs['existsSync'](_0x260394)){throw new db['Sequelize'][(_0x3a18('0x5a'))](_0x3a18('0x62'));}return _0x5195aa[_0x3a18('0x4f')](_0x260394,util['format'](_0x3a18('0x63'),path[_0x3a18('0x54')](_0x2714fb[_0x3a18('0x5')])),function(_0x46f2fa){if(_0x46f2fa){throw new db[(_0x3a18('0x59'))]['Error'](_0x3a18('0x64'));}fs[_0x3a18('0x65')](_0x260394);logger['info']('Download\x20completed');logger['info'](_0x3a18('0x66'));});});}return null;})['catch'](handleError(_0x5195aa,null));};exports[_0x3a18('0x67')]=function(_0x3dd8b4,_0x27399c,_0x24c636){var _0x3d9ae=path[_0x3a18('0x54')](_0x3dd8b4['file']['filename'],path[_0x3a18('0x68')](_0x3dd8b4[_0x3a18('0x69')][_0x3a18('0x6a')]));var _0x285a12=path[_0x3a18('0x51')](config[_0x3a18('0x52')],_0x3a18('0x53'),_0x3dd8b4[_0x3a18('0x69')]['filename']);var _0x1564b7=path[_0x3a18('0x51')](config['root'],_0x3a18('0x53'),_0x3d9ae);logger[_0x3a18('0x6b')](_0x3a18('0x6c'),_0x285a12);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x1564b7);try{fs[_0x3a18('0x6d')](_0x285a12,parseInt(_0x3a18('0x6e'),0x8));extract(_0x285a12,{'dir':_0x1564b7},function(_0x42817c){if(_0x42817c){logger[_0x3a18('0x2d')](_0x42817c);handleError(_0x42817c,!![]);};var _0x20c4f2=fs[_0x3a18('0x6f')](_0x1564b7);if(_0x20c4f2[_0x3a18('0x3b')]>0x1){removeReferences(_0x285a12,_0x1564b7);logger[_0x3a18('0x2d')]('Invalid\x20plugin\x20structure');return _0x24c636(new Error(_0x3a18('0x70')));}var _0x331e31=fs['lstatSync'](path[_0x3a18('0x51')](_0x1564b7,_0x20c4f2[0x0]));if(_0x331e31[_0x3a18('0x71')]()){removeReferences(_0x285a12,_0x1564b7);logger['error'](_0x3a18('0x70'));return _0x24c636(new Error('Invalid\x20plugin\x20structure'));}if(_0x331e31[_0x3a18('0x72')]()){var _0x47bf4a=fs[_0x3a18('0x6f')](path[_0x3a18('0x51')](_0x1564b7,_0x20c4f2[0x0]));if(_0x47bf4a[_0x3a18('0x3b')]===0x0){removeReferences(_0x285a12,_0x1564b7);logger[_0x3a18('0x2d')](_0x3a18('0x70'));return _0x24c636(new Error(_0x3a18('0x70')));}var _0x35ffec=_0x47bf4a['some'](function(_0x147d4b){return _0x147d4b===_0x3a18('0x73');});if(!_0x35ffec){return _0x24c636(new Error('Plugin\x20manifest\x20missing'));}var _0x2e225f=fs[_0x3a18('0x74')](path[_0x3a18('0x51')](_0x1564b7,_0x20c4f2[0x0],_0x3a18('0x73')));var _0x2f1231=JSON[_0x3a18('0x75')](_0x2e225f);if('undefined'==typeof _0x2f1231[_0x3a18('0x2f')]){return _0x24c636(new Error(_0x3a18('0x76')));}if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x34')]){return _0x24c636(new Error(_0x3a18('0x77')));}if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x78')]){return _0x24c636(new Error(_0x3a18('0x79')));}if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x7a')]){return _0x24c636(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2f1231[_0x3a18('0x34')]===_0x3a18('0x7b')){if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')]){return _0x24c636(new Error(_0x3a18('0x7d')));}if('undefined'==typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')][_0x3a18('0x7e')]&&_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x7a')]['views'][_0x3a18('0x7f')]){return _0x24c636(new Error(_0x3a18('0x80')));}}else if(_0x2f1231[_0x3a18('0x34')]===_0x3a18('0x81')){if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x7a')]['scriptName']){return _0x24c636(new Error(_0x3a18('0x82')));}if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x83')]){return _0x24c636(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x24c636(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5480d7=_0x2f1231['name'];var _0xa7dcf4=_0x2f1231['description'];var _0x17fbb7=_0x2f1231[_0x3a18('0x34')];var _0x3578ed=_0x2f1231['sidebar']?_0x2f1231[_0x3a18('0x84')]:_0x3a18('0x85');var _0x5e3253=_0x2f1231[_0x3a18('0x86')]?_0x2f1231[_0x3a18('0x86')]:_0x3a18('0x87');var _0x3b691a='';var _0x3406dd='';var _0x1a43da='';var _0x5c689c='';var _0x194baa=_0x2f1231[_0x3a18('0x78')];if(_0x17fbb7==='html'){if(_0x3a18('0x20')!=typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')][_0x3a18('0x7e')]){var _0x6f01f3=_0x2f1231['parameters'][_0x3a18('0x7c')][_0x3a18('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x3a18('0x88')](_0x6f01f3)){_0x3b691a=path[_0x3a18('0x51')]('plugins',_0x3d9ae,_0x20c4f2[0x0],_0x6f01f3);}else{_0x3b691a=_0x6f01f3;}}else{logger[_0x3a18('0x6b')](_0x3a18('0x89'));}if(_0x3a18('0x20')!=typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')][_0x3a18('0x7f')]){var _0x20a35c=_0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')][_0x3a18('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x3a18('0x88')](_0x20a35c)){_0x3406dd=path['join']('plugins',_0x3d9ae,_0x20c4f2[0x0],_0x20a35c);}else{_0x3406dd=_0x20a35c;}}else{logger[_0x3a18('0x6b')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x17fbb7===_0x3a18('0x81')){_0x1a43da=_0x2f1231[_0x3a18('0x7a')][_0x3a18('0x8a')];_0x5c689c=_0x2f1231[_0x3a18('0x7a')]['scriptPath'];if(_0x3a18('0x20')!=typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')]){if('undefined'!=typeof _0x2f1231['parameters'][_0x3a18('0x7c')]['admin']){var _0x6f01f3=_0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3a18('0x88')](_0x6f01f3)){_0x3b691a=path[_0x3a18('0x51')](_0x3a18('0x8b'),_0x3d9ae,_0x20c4f2[0x0],_0x6f01f3);}else{_0x3b691a=_0x6f01f3;}}if(_0x3a18('0x20')!=typeof _0x2f1231['parameters'][_0x3a18('0x7c')][_0x3a18('0x7f')]){var _0x20a35c=_0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')][_0x3a18('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x3a18('0x88')](_0x20a35c)){_0x3406dd=path[_0x3a18('0x51')](_0x3a18('0x8b'),_0x3d9ae,_0x20c4f2[0x0],_0x20a35c);}else{_0x3406dd=_0x20a35c;}}}}var _0x48d72e={'name':_0x5480d7,'description':_0xa7dcf4,'path':path[_0x3a18('0x51')](_0x3d9ae,_0x20c4f2[0x0]),'type':_0x17fbb7,'sidebar':_0x3578ed,'icon':_0x5e3253,'adminUrl':_0x3b691a,'agentUrl':_0x3406dd,'scriptName':_0x1a43da,'scriptPath':_0x5c689c,'version':_0x194baa};removeReferences(_0x285a12,null);return db[_0x3a18('0x45')][_0x3a18('0x8c')](_0x48d72e)[_0x3a18('0x28')](function(_0x3cba5f){var _0xc33d3e={'role':_0x3dd8b4[_0x3a18('0x8d')][_0x3a18('0x8e')],'userProfileId':_0x3dd8b4[_0x3a18('0x8d')][_0x3a18('0x8f')]};if(!_0xc33d3e)throw new Error(_0x3a18('0x90'));if(_0xc33d3e[_0x3a18('0x8e')]===_0x3a18('0x91')){var _0x4fc6c4=_0x3cba5f['get']({'plain':!![]});return db[_0x3a18('0x92')]['find']({'where':{'name':'Plugins','userProfileId':_0xc33d3e[_0x3a18('0x8f')]},'raw':!![]})[_0x3a18('0x28')](function(_0x174869){if(_0x174869&&_0x174869[_0x3a18('0x93')]===0x0){return db[_0x3a18('0x2c')][_0x3a18('0x8c')]({'name':_0x4fc6c4[_0x3a18('0x2f')],'resourceId':_0x4fc6c4['id'],'type':_0x174869['name'],'sectionId':_0x174869['id']},{})[_0x3a18('0x28')](function(){return _0x3cba5f;});}else{return _0x3cba5f;}})[_0x3a18('0x4a')](function(_0x58af61){logger['error'](_0x3a18('0x94'),_0x58af61);throw _0x58af61;});}return _0x3cba5f;})[_0x3a18('0x28')](respondWithResult(_0x27399c,null))[_0x3a18('0x4a')](handleError(_0x27399c,null));}});}catch(_0x31acb6){_0x27399c['status'](0x1f4)['send'](_0x31acb6);}};function removeReferences(_0x54412d,_0x101403){try{if(_0x54412d){fs[_0x3a18('0x65')](_0x54412d);logger['info'](_0x3a18('0x95'));}if(_0x101403){rimraf(_0x101403,function(){});logger[_0x3a18('0x6b')](_0x3a18('0x96'));}}catch(_0x5740c4){logger[_0x3a18('0x2d')](_0x5740c4);}}exports[_0x3a18('0x97')]=function(_0x3e4de9,_0x42efd3,_0x2dd236){return db[_0x3a18('0x45')][_0x3a18('0x4e')]({'where':{'id':_0x3e4de9[_0x3a18('0x50')]['id']}})['then'](handleEntityNotFound(_0x42efd3,null))[_0x3a18('0x28')](saveUpdates(_0x3e4de9[_0x3a18('0x8d')],null))[_0x3a18('0x28')](respondWithResult(_0x42efd3,null))[_0x3a18('0x4a')](handleError(_0x42efd3,null));};exports['delete']=function(_0x23572f,_0x2c0ca7,_0x2d9f62){return db[_0x3a18('0x45')]['find']({'where':{'id':_0x23572f[_0x3a18('0x50')]['id']}})[_0x3a18('0x28')](function(_0x28eacf){if(_0x28eacf){return _0x28eacf[_0x3a18('0x29')]();}})[_0x3a18('0x28')](function(_0x55c32b){rimraf(path[_0x3a18('0x51')](config[_0x3a18('0x52')],_0x3a18('0x53'),path[_0x3a18('0x98')](_0x55c32b['path'])),function(){});return _0x55c32b;})[_0x3a18('0x28')](handleEntityNotFound(_0x2c0ca7,null))[_0x3a18('0x28')](respondWithStatusCode(_0x2c0ca7,null))['catch'](handleError(_0x2c0ca7,null));};exports[_0x3a18('0x99')]=function(_0x4f397f,_0x235893,_0x4a4246){return BPromise['resolve']()[_0x3a18('0x28')](function(){if(!_0x4f397f[_0x3a18('0x37')][_0x3a18('0x5')]){throw new Error(_0x3a18('0x9a'));}if(!_0x4f397f['query'][_0x3a18('0x9b')]){throw new Error(_0x3a18('0x9c'));}var _0x4d51f7=_0x4f397f[_0x3a18('0x37')]['hostname']?_0x4f397f[_0x3a18('0x37')][_0x3a18('0x9d')]+':'+_0x4f397f['query']['port']:'http://localhost:'+_0x4f397f[_0x3a18('0x37')][_0x3a18('0x9b')];var _0xfb8af4=_0x4f397f[_0x3a18('0x37')][_0x3a18('0x24')]?_0x4f397f[_0x3a18('0x37')][_0x3a18('0x24')]:!![];var _0x4331d7=_0x4f397f[_0x3a18('0x37')][_0x3a18('0x9e')]?_0x4f397f[_0x3a18('0x37')][_0x3a18('0x9e')]:null;var _0x183a8b={'method':_0x4f397f[_0x3a18('0x9f')],'uri':util['format'](_0x3a18('0xa0'),_0x4d51f7,_0x4f397f['query']['path']),'json':_0xfb8af4,'resolveWithFullResponse':!![],'encoding':_0x4331d7,'qs':_0x4f397f['query']};if(_0x4f397f[_0x3a18('0xa1')]){_0x183a8b['headers']=_0x4f397f[_0x3a18('0xa1')];if(_0x183a8b['headers'][_0x3a18('0xa2')]){delete _0x183a8b[_0x3a18('0xa1')][_0x3a18('0xa2')];}}if(_0x183a8b[_0x3a18('0xa1')]['content-type']){delete _0x183a8b[_0x3a18('0xa1')][_0x3a18('0xa3')];}return rp(_0x183a8b);})[_0x3a18('0x28')](function(_0x12db57){if(_0x12db57){_0x235893[_0x3a18('0x22')](_0x12db57[_0x3a18('0xa1')]);logger[_0x3a18('0x6b')](_0x12db57['body']);if(_[_0x3a18('0xa4')](_0x4f397f[_0x3a18('0x37')][_0x3a18('0x5')],_0x3a18('0x4f'))&&_0x12db57[_0x3a18('0xa5')]==0x1f4){return _0x235893[_0x3a18('0x1d')](_0x12db57[_0x3a18('0xa5')]);}else{return _0x235893[_0x3a18('0x1e')](_0x12db57[_0x3a18('0xa5')])[_0x3a18('0x30')](_0x12db57[_0x3a18('0x8d')]);}}else{return _0x235893[_0x3a18('0x1d')](0xc8);}})['catch'](handleError(_0x235893,null));};exports[_0x3a18('0xa6')]=function(_0xc67ba8,_0x392327,_0x13a84b){return BPromise[_0x3a18('0xa7')]()[_0x3a18('0x28')](function(){if(!_0xc67ba8['query'][_0x3a18('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xc67ba8[_0x3a18('0x37')]['port']){throw new Error(_0x3a18('0x9c'));}var _0x144adb=_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x9d')]?_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x9d')]+':'+_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x9b')]:_0x3a18('0xa8')+_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x9b')];var _0x5484b0=_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x24')]?_0xc67ba8[_0x3a18('0x37')]['json']:!![];var _0x3c5794=_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x9e')]?_0xc67ba8[_0x3a18('0x37')]['encoding']:null;var _0x460ae6={'method':_0xc67ba8[_0x3a18('0x9f')],'uri':util[_0x3a18('0xa9')](_0x3a18('0xa0'),_0x144adb,_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x5')]),'json':_0x5484b0,'resolveWithFullResponse':!![],'encoding':_0x3c5794,'body':_0xc67ba8['body']};if(_0xc67ba8['headers']){_0x460ae6['headers']=_0xc67ba8[_0x3a18('0xa1')];if(_0x460ae6[_0x3a18('0xa1')]['content-length']){delete _0x460ae6[_0x3a18('0xa1')][_0x3a18('0xa2')];}}if(_0x460ae6[_0x3a18('0xa1')][_0x3a18('0xa3')]){delete _0x460ae6[_0x3a18('0xa1')][_0x3a18('0xa3')];}return rp(_0x460ae6);})['then'](function(_0x2c9ef6){if(_0x2c9ef6){_0x392327[_0x3a18('0x22')](_0x2c9ef6[_0x3a18('0xa1')]);logger[_0x3a18('0x6b')](_0x2c9ef6[_0x3a18('0x8d')]);return _0x392327[_0x3a18('0x1e')](_0x2c9ef6[_0x3a18('0xa5')])[_0x3a18('0x30')](_0x2c9ef6[_0x3a18('0x8d')]);}else{return _0x392327['sendStatus'](0xc8);}})[_0x3a18('0x4a')](handleError(_0x392327,null));}; \ No newline at end of file +var _0x8729=['desk.js','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','name','send','index','map','Plugin','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','join','format','%s.zip','basename','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','root','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x8729,0x9f));var _0x9872=function(_0x3ce002,_0x59b88f){_0x3ce002=_0x3ce002-0x0;var _0x2fe98d=_0x8729[_0x3ce002];return _0x2fe98d;};'use strict';var emlformat=require(_0x9872('0x0'));var rimraf=require(_0x9872('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9872('0x2'));var rp=require(_0x9872('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9872('0x4'));var util=require(_0x9872('0x5'));var path=require(_0x9872('0x6'));var sox=require(_0x9872('0x7'));var csv=require(_0x9872('0x8'));var ejs=require(_0x9872('0x9'));var fs=require('fs');var fs_extra=require(_0x9872('0xa'));var _=require(_0x9872('0xb'));var squel=require(_0x9872('0xc'));var crypto=require(_0x9872('0xd'));var jsforce=require(_0x9872('0xe'));var deskjs=require(_0x9872('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9872('0x10'));var Papa=require(_0x9872('0x11'));var extract=require(_0x9872('0x12'));var rimraf=require(_0x9872('0x1'));var archiver=require(_0x9872('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9872('0x14'));var as=require(_0x9872('0x15'));var hardwareService=require(_0x9872('0x16'));var logger=require(_0x9872('0x17'))(_0x9872('0x18'));var utils=require(_0x9872('0x19'));var config=require(_0x9872('0x1a'));var licenseUtil=require(_0x9872('0x1b'));var db=require(_0x9872('0x1c'))['db'];config[_0x9872('0x1d')]=_[_0x9872('0x1e')](config[_0x9872('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9872('0x1d')]));require(_0x9872('0x1f'))[_0x9872('0x20')](socket);function respondWithStatusCode(_0x236006,_0xfe63f5){_0xfe63f5=_0xfe63f5||0xcc;return function(_0x504fa2){if(_0x504fa2){return _0x236006[_0x9872('0x21')](_0xfe63f5);}return _0x236006[_0x9872('0x22')](_0xfe63f5)[_0x9872('0x23')]();};}function respondWithResult(_0x366b09,_0x41b090){_0x41b090=_0x41b090||0xc8;return function(_0xfbcff9){if(_0xfbcff9){return _0x366b09[_0x9872('0x22')](_0x41b090)[_0x9872('0x24')](_0xfbcff9);}};}function respondWithFilteredResult(_0x33b56e,_0x50fded){return function(_0x5026c3){if(_0x5026c3){var _0x2e4804=typeof _0x50fded[_0x9872('0x25')]===_0x9872('0x26')&&typeof _0x50fded[_0x9872('0x27')]===_0x9872('0x26');var _0x70128d=_0x5026c3['count'];var _0x509abc=_0x2e4804?0x0:_0x50fded[_0x9872('0x25')];var _0x5829c8=_0x2e4804?_0x5026c3[_0x9872('0x28')]:_0x50fded[_0x9872('0x25')]+_0x50fded[_0x9872('0x27')];var _0x2bb673;if(_0x5829c8>=_0x70128d){_0x5829c8=_0x70128d;_0x2bb673=0xc8;}else{_0x2bb673=0xce;}_0x33b56e[_0x9872('0x22')](_0x2bb673);return _0x33b56e['set'](_0x9872('0x29'),_0x509abc+'-'+_0x5829c8+'/'+_0x70128d)[_0x9872('0x24')](_0x5026c3);}return null;};}function patchUpdates(_0x48a232){return function(_0x485871){try{jsonpatch[_0x9872('0x2a')](_0x485871,_0x48a232,!![]);}catch(_0x5249f7){return BPromise[_0x9872('0x2b')](_0x5249f7);}return _0x485871[_0x9872('0x2c')]();};}function saveUpdates(_0x57e2b1,_0x30b44d){return function(_0x26c200){if(_0x26c200){return _0x26c200['update'](_0x57e2b1)[_0x9872('0x2d')](function(_0x4eb748){return _0x4eb748;});}return null;};}function removeEntity(_0x255518,_0x512035){return function(_0x4ccaf9){if(_0x4ccaf9){return _0x4ccaf9[_0x9872('0x2e')]()[_0x9872('0x2d')](function(){var _0x46e6d7=_0x4ccaf9['get']({'plain':!![]});var _0x236d5b='Plugins';return db[_0x9872('0x2f')][_0x9872('0x2e')]({'where':{'type':_0x236d5b,'resourceId':_0x46e6d7['id']}})[_0x9872('0x2d')](function(){return _0x4ccaf9;});})[_0x9872('0x2d')](function(){_0x255518[_0x9872('0x22')](0xcc)[_0x9872('0x23')]();});}};}function handleEntityNotFound(_0x8f7946,_0x477345){return function(_0x5bd61e){if(!_0x5bd61e){_0x8f7946[_0x9872('0x21')](0x194);}return _0x5bd61e;};}function handleError(_0x159126,_0x5543a8){_0x5543a8=_0x5543a8||0x1f4;return function(_0x140385){logger[_0x9872('0x30')](_0x140385['stack']);if(_0x140385[_0x9872('0x31')]){delete _0x140385[_0x9872('0x31')];}_0x159126[_0x9872('0x22')](_0x5543a8)[_0x9872('0x32')](_0x140385);};}exports[_0x9872('0x33')]=function(_0x204d4f,_0x1b51fc){var _0x274d24={},_0x267b4c={},_0x463725={'count':0x0,'rows':[]};var _0x34c14f=_[_0x9872('0x34')](db[_0x9872('0x35')]['rawAttributes'],function(_0x59d7a8){return{'name':_0x59d7a8[_0x9872('0x36')],'type':_0x59d7a8['type'][_0x9872('0x37')]};});_0x267b4c[_0x9872('0x38')]=_['map'](_0x34c14f,_0x9872('0x31'));_0x267b4c[_0x9872('0x39')]=_[_0x9872('0x3a')](_0x204d4f['query']);_0x267b4c[_0x9872('0x3b')]=_[_0x9872('0x3c')](_0x267b4c[_0x9872('0x38')],_0x267b4c[_0x9872('0x39')]);_0x274d24['attributes']=_['intersection'](_0x267b4c[_0x9872('0x38')],qs['fields'](_0x204d4f['query'][_0x9872('0x3d')]));_0x274d24[_0x9872('0x3e')]=_0x274d24[_0x9872('0x3e')][_0x9872('0x3f')]?_0x274d24['attributes']:_0x267b4c[_0x9872('0x38')];if(!_0x204d4f[_0x9872('0x39')][_0x9872('0x40')](_0x9872('0x41'))){_0x274d24[_0x9872('0x27')]=qs['limit'](_0x204d4f[_0x9872('0x39')][_0x9872('0x27')]);_0x274d24[_0x9872('0x25')]=qs[_0x9872('0x25')](_0x204d4f[_0x9872('0x39')]['offset']);}_0x274d24[_0x9872('0x42')]=qs[_0x9872('0x43')](_0x204d4f[_0x9872('0x39')][_0x9872('0x43')]);_0x274d24[_0x9872('0x44')]=qs['filters'](_[_0x9872('0x45')](_0x204d4f[_0x9872('0x39')],_0x267b4c['filters']),_0x34c14f);if(_0x204d4f[_0x9872('0x39')][_0x9872('0x46')]){_0x274d24[_0x9872('0x44')]=_[_0x9872('0x47')](_0x274d24[_0x9872('0x44')],{'$or':_['map'](_0x34c14f,function(_0x26efc3){if(_0x26efc3[_0x9872('0x48')]!=='VIRTUAL'){var _0x3c79e7={};_0x3c79e7[_0x26efc3[_0x9872('0x31')]]={'$like':'%'+_0x204d4f[_0x9872('0x39')][_0x9872('0x46')]+'%'};return _0x3c79e7;}})});}_0x274d24=_[_0x9872('0x47')]({},_0x274d24,_0x204d4f[_0x9872('0x49')]);var _0x18d081={'where':_0x274d24[_0x9872('0x44')]};return db['Plugin'][_0x9872('0x28')](_0x18d081)[_0x9872('0x2d')](function(_0x48026a){_0x463725[_0x9872('0x28')]=_0x48026a;if(_0x204d4f[_0x9872('0x39')][_0x9872('0x4a')]){_0x274d24[_0x9872('0x4b')]=[{'all':!![]}];}return db[_0x9872('0x35')][_0x9872('0x4c')](_0x274d24);})['then'](function(_0x53acf0){_0x463725[_0x9872('0x4d')]=_0x53acf0;return _0x463725;})[_0x9872('0x2d')](respondWithFilteredResult(_0x1b51fc,_0x274d24))['catch'](handleError(_0x1b51fc,null));};exports[_0x9872('0x4e')]=function(_0x33bce9,_0x12f94b){var _0x58ce48={'raw':!![],'where':{'id':_0x33bce9[_0x9872('0x4f')]['id']}},_0x3f63a3={};_0x3f63a3['model']=_['keys'](db[_0x9872('0x35')][_0x9872('0x50')]);_0x3f63a3[_0x9872('0x39')]=_[_0x9872('0x3a')](_0x33bce9['query']);_0x3f63a3[_0x9872('0x3b')]=_[_0x9872('0x3c')](_0x3f63a3[_0x9872('0x38')],_0x3f63a3[_0x9872('0x39')]);_0x58ce48['attributes']=_[_0x9872('0x3c')](_0x3f63a3['model'],qs['fields'](_0x33bce9[_0x9872('0x39')][_0x9872('0x3d')]));_0x58ce48[_0x9872('0x3e')]=_0x58ce48[_0x9872('0x3e')][_0x9872('0x3f')]?_0x58ce48[_0x9872('0x3e')]:_0x3f63a3[_0x9872('0x38')];if(_0x33bce9[_0x9872('0x39')][_0x9872('0x4a')]){_0x58ce48[_0x9872('0x4b')]=[{'all':!![]}];}_0x58ce48=_['merge']({},_0x58ce48,_0x33bce9[_0x9872('0x49')]);return db[_0x9872('0x35')][_0x9872('0x51')](_0x58ce48)[_0x9872('0x2d')](handleEntityNotFound(_0x12f94b,null))['then'](respondWithResult(_0x12f94b,null))[_0x9872('0x52')](handleError(_0x12f94b,null));};exports['download']=function(_0x1885de,_0x5d8ef1,_0x1f4902){return db['Plugin'][_0x9872('0x51')]({'where':{'id':_0x1885de[_0x9872('0x4f')]['id']},'attributes':[_0x9872('0x31'),_0x9872('0x6')],'raw':!![]})[_0x9872('0x2d')](handleEntityNotFound(_0x5d8ef1,null))[_0x9872('0x2d')](function(_0x16aaf9){if(_0x16aaf9){var _0x261cc4=path[_0x9872('0x53')](config['root'],'server/files/plugins',util[_0x9872('0x54')](_0x9872('0x55'),path[_0x9872('0x56')](_0x16aaf9[_0x9872('0x6')])));var _0x36c42f=fs['createWriteStream'](_0x261cc4);var _0x4cce98=archiver(_0x9872('0x57'),{'zlib':{'level':0x9}});_0x4cce98['on'](_0x9872('0x58'),function(_0x2978c1){if(_0x2978c1[_0x9872('0x59')]==='ENOENT'){logger[_0x9872('0x30')](_0x2978c1);}else{throw new db[(_0x9872('0x5a'))][(_0x9872('0x5b'))](_0x9872('0x5c'));}});_0x4cce98['on']('error',function(_0x11dc55){throw new db[(_0x9872('0x5a'))][(_0x9872('0x5b'))](_0x9872('0x5c'));});_0x4cce98['pipe'](_0x36c42f);_0x4cce98['glob'](_0x9872('0x5d'),{'cwd':path[_0x9872('0x53')](config[_0x9872('0x5e')],_0x9872('0x5f'),path[_0x9872('0x60')](_0x16aaf9['path'])),'ignore':[path[_0x9872('0x53')](path['basename'](_0x16aaf9[_0x9872('0x6')]),_0x9872('0x61')),path['join'](path['basename'](_0x16aaf9[_0x9872('0x6')]),_0x9872('0x62'))],'nodir':!![]})[_0x9872('0x63')]();_0x36c42f['on']('close',function(){if(!fs[_0x9872('0x64')](_0x261cc4)){throw new db['Sequelize'][(_0x9872('0x5b'))](_0x9872('0x65'));}return _0x5d8ef1[_0x9872('0x66')](_0x261cc4,util[_0x9872('0x54')](_0x9872('0x55'),path['basename'](_0x16aaf9[_0x9872('0x6')])),function(_0x30b0e9){if(_0x30b0e9){throw new db['Sequelize'][(_0x9872('0x5b'))](_0x9872('0x67'));}fs['unlinkSync'](_0x261cc4);logger[_0x9872('0x68')](_0x9872('0x69'));logger[_0x9872('0x68')](_0x9872('0x6a'));});});}return null;})[_0x9872('0x52')](handleError(_0x5d8ef1,null));};exports[_0x9872('0x6b')]=function(_0x275a34,_0x46fdc2,_0x113d8b){var _0x5769f8=path[_0x9872('0x56')](_0x275a34[_0x9872('0x6c')]['filename'],path[_0x9872('0x6d')](_0x275a34[_0x9872('0x6c')][_0x9872('0x6e')]));var _0x1e237a=path['join'](config[_0x9872('0x5e')],_0x9872('0x5f'),_0x275a34[_0x9872('0x6c')]['filename']);var _0x5e3172=path[_0x9872('0x53')](config[_0x9872('0x5e')],'server/files/plugins',_0x5769f8);logger[_0x9872('0x68')](_0x9872('0x6f'),_0x1e237a);logger[_0x9872('0x68')](_0x9872('0x70'),_0x5e3172);try{fs[_0x9872('0x71')](_0x1e237a,parseInt('0777',0x8));extract(_0x1e237a,{'dir':_0x5e3172},function(_0x572e47){if(_0x572e47){logger[_0x9872('0x30')](_0x572e47);handleError(_0x572e47,!![]);};var _0x58fb3f=fs[_0x9872('0x72')](_0x5e3172);if(_0x58fb3f['length']>0x1){removeReferences(_0x1e237a,_0x5e3172);logger[_0x9872('0x30')](_0x9872('0x73'));return _0x113d8b(new Error('Invalid\x20plugin\x20structure'));}var _0x1a3825=fs[_0x9872('0x74')](path[_0x9872('0x53')](_0x5e3172,_0x58fb3f[0x0]));if(_0x1a3825[_0x9872('0x75')]()){removeReferences(_0x1e237a,_0x5e3172);logger[_0x9872('0x30')]('Invalid\x20plugin\x20structure');return _0x113d8b(new Error(_0x9872('0x73')));}if(_0x1a3825['isDirectory']()){var _0x44d5e9=fs[_0x9872('0x72')](path[_0x9872('0x53')](_0x5e3172,_0x58fb3f[0x0]));if(_0x44d5e9['length']===0x0){removeReferences(_0x1e237a,_0x5e3172);logger[_0x9872('0x30')]('Invalid\x20plugin\x20structure');return _0x113d8b(new Error(_0x9872('0x73')));}var _0x346e82=_0x44d5e9[_0x9872('0x76')](function(_0x42a4be){return _0x42a4be===_0x9872('0x77');});if(!_0x346e82){return _0x113d8b(new Error(_0x9872('0x78')));}var _0x1020c4=fs[_0x9872('0x79')](path[_0x9872('0x53')](_0x5e3172,_0x58fb3f[0x0],_0x9872('0x77')));var _0x33de07=JSON['parse'](_0x1020c4);if(_0x9872('0x26')==typeof _0x33de07[_0x9872('0x31')]){return _0x113d8b(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x9872('0x26')==typeof _0x33de07[_0x9872('0x48')]){return _0x113d8b(new Error(_0x9872('0x7a')));}if('undefined'==typeof _0x33de07[_0x9872('0x7b')]){return _0x113d8b(new Error(_0x9872('0x7c')));}if('undefined'==typeof _0x33de07[_0x9872('0x7d')]){return _0x113d8b(new Error(_0x9872('0x7e')));}if(_0x33de07[_0x9872('0x48')]===_0x9872('0x7f')){if(_0x9872('0x26')==typeof _0x33de07[_0x9872('0x7d')][_0x9872('0x80')]){return _0x113d8b(new Error(_0x9872('0x81')));}if('undefined'==typeof _0x33de07[_0x9872('0x7d')][_0x9872('0x80')][_0x9872('0x82')]&&'undefined'==typeof _0x33de07['parameters'][_0x9872('0x80')][_0x9872('0x83')]){return _0x113d8b(new Error(_0x9872('0x84')));}}else if(_0x33de07[_0x9872('0x48')]===_0x9872('0x85')){if(_0x9872('0x26')==typeof _0x33de07[_0x9872('0x7d')]['scriptName']){return _0x113d8b(new Error(_0x9872('0x86')));}if(_0x9872('0x26')==typeof _0x33de07['parameters'][_0x9872('0x87')]){return _0x113d8b(new Error(_0x9872('0x88')));}}else{return _0x113d8b(new Error(_0x9872('0x89')));}var _0x34c1f1=_0x33de07[_0x9872('0x31')];var _0x3fda92=_0x33de07[_0x9872('0x8a')];var _0x237642=_0x33de07[_0x9872('0x48')];var _0x291e12=_0x33de07[_0x9872('0x8b')]?_0x33de07[_0x9872('0x8b')]:_0x9872('0x8c');var _0x417c7b=_0x33de07[_0x9872('0x8d')]?_0x33de07[_0x9872('0x8d')]:_0x9872('0x8e');var _0xc8d11e='';var _0x5a85b8='';var _0x204ea6='';var _0x1e5d5b='';var _0xe0cd40=_0x33de07[_0x9872('0x7b')];if(_0x237642===_0x9872('0x7f')){if('undefined'!=typeof _0x33de07['parameters'][_0x9872('0x80')][_0x9872('0x82')]){var _0x20f7f3=_0x33de07['parameters'][_0x9872('0x80')][_0x9872('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x9872('0x8f')](_0x20f7f3)){_0xc8d11e=path[_0x9872('0x53')](_0x9872('0x90'),_0x5769f8,_0x58fb3f[0x0],_0x20f7f3);}else{_0xc8d11e=_0x20f7f3;}}else{logger[_0x9872('0x68')](_0x9872('0x91'));}if(_0x9872('0x26')!=typeof _0x33de07['parameters'][_0x9872('0x80')][_0x9872('0x83')]){var _0x3587e8=_0x33de07[_0x9872('0x7d')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9872('0x8f')](_0x3587e8)){_0x5a85b8=path[_0x9872('0x53')](_0x9872('0x90'),_0x5769f8,_0x58fb3f[0x0],_0x3587e8);}else{_0x5a85b8=_0x3587e8;}}else{logger[_0x9872('0x68')](_0x9872('0x92'));}}else if(_0x237642===_0x9872('0x85')){_0x204ea6=_0x33de07['parameters']['scriptName'];_0x1e5d5b=_0x33de07[_0x9872('0x7d')][_0x9872('0x87')];if(_0x9872('0x26')!=typeof _0x33de07['parameters'][_0x9872('0x80')]){if(_0x9872('0x26')!=typeof _0x33de07[_0x9872('0x7d')]['views'][_0x9872('0x82')]){var _0x20f7f3=_0x33de07[_0x9872('0x7d')][_0x9872('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x20f7f3)){_0xc8d11e=path[_0x9872('0x53')](_0x9872('0x90'),_0x5769f8,_0x58fb3f[0x0],_0x20f7f3);}else{_0xc8d11e=_0x20f7f3;}}if(_0x9872('0x26')!=typeof _0x33de07[_0x9872('0x7d')][_0x9872('0x80')][_0x9872('0x83')]){var _0x3587e8=_0x33de07[_0x9872('0x7d')][_0x9872('0x80')][_0x9872('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x9872('0x8f')](_0x3587e8)){_0x5a85b8=path[_0x9872('0x53')](_0x9872('0x90'),_0x5769f8,_0x58fb3f[0x0],_0x3587e8);}else{_0x5a85b8=_0x3587e8;}}}}var _0xd04d6a={'name':_0x34c1f1,'description':_0x3fda92,'path':path[_0x9872('0x53')](_0x5769f8,_0x58fb3f[0x0]),'type':_0x237642,'sidebar':_0x291e12,'icon':_0x417c7b,'adminUrl':_0xc8d11e,'agentUrl':_0x5a85b8,'scriptName':_0x204ea6,'scriptPath':_0x1e5d5b,'version':_0xe0cd40};removeReferences(_0x1e237a,null);return db[_0x9872('0x35')][_0x9872('0x93')](_0xd04d6a)[_0x9872('0x2d')](function(_0x311571){var _0x186a79={'role':_0x275a34[_0x9872('0x94')][_0x9872('0x95')],'userProfileId':_0x275a34['body'][_0x9872('0x96')]};if(!_0x186a79)throw new Error(_0x9872('0x97'));if(_0x186a79[_0x9872('0x95')]===_0x9872('0x98')){var _0x570b82=_0x311571['get']({'plain':!![]});return db['UserProfileSection'][_0x9872('0x51')]({'where':{'name':'Plugins','userProfileId':_0x186a79[_0x9872('0x96')]},'raw':!![]})[_0x9872('0x2d')](function(_0x2b3a88){if(_0x2b3a88&&_0x2b3a88[_0x9872('0x99')]===0x0){return db[_0x9872('0x2f')][_0x9872('0x93')]({'name':_0x570b82[_0x9872('0x31')],'resourceId':_0x570b82['id'],'type':_0x2b3a88[_0x9872('0x31')],'sectionId':_0x2b3a88['id']},{})['then'](function(){return _0x311571;});}else{return _0x311571;}})[_0x9872('0x52')](function(_0xa29ef){logger['error'](_0x9872('0x9a'),_0xa29ef);throw _0xa29ef;});}return _0x311571;})[_0x9872('0x2d')](respondWithResult(_0x46fdc2,null))['catch'](handleError(_0x46fdc2,null));}});}catch(_0x593043){_0x46fdc2[_0x9872('0x22')](0x1f4)['send'](_0x593043);}};function removeReferences(_0x525217,_0x37b517){try{if(_0x525217){fs['unlinkSync'](_0x525217);logger['info'](_0x9872('0x9b'));}if(_0x37b517){rimraf(_0x37b517,function(){});logger[_0x9872('0x68')](_0x9872('0x9c'));}}catch(_0x136e98){logger[_0x9872('0x30')](_0x136e98);}}exports[_0x9872('0x9d')]=function(_0x33b09f,_0x37d186,_0x41b608){return db[_0x9872('0x35')][_0x9872('0x51')]({'where':{'id':_0x33b09f['params']['id']}})['then'](handleEntityNotFound(_0x37d186,null))['then'](saveUpdates(_0x33b09f[_0x9872('0x94')],null))[_0x9872('0x2d')](respondWithResult(_0x37d186,null))[_0x9872('0x52')](handleError(_0x37d186,null));};exports[_0x9872('0x9e')]=function(_0x568154,_0x42ea1b,_0x242bd0){return db[_0x9872('0x35')][_0x9872('0x51')]({'where':{'id':_0x568154[_0x9872('0x4f')]['id']}})[_0x9872('0x2d')](function(_0x588ecf){if(_0x588ecf){return _0x588ecf['destroy']();}})['then'](function(_0x78aa86){rimraf(path['join'](config['root'],'server/files/plugins',path[_0x9872('0x60')](_0x78aa86[_0x9872('0x6')])),function(){});return _0x78aa86;})[_0x9872('0x2d')](handleEntityNotFound(_0x42ea1b,null))[_0x9872('0x2d')](respondWithStatusCode(_0x42ea1b,null))['catch'](handleError(_0x42ea1b,null));};exports[_0x9872('0x9f')]=function(_0x5a2377,_0x2e3969,_0xf9ce8){return BPromise['resolve']()[_0x9872('0x2d')](function(){if(!_0x5a2377['query'][_0x9872('0x6')]){throw new Error(_0x9872('0xa0'));}if(!_0x5a2377['query'][_0x9872('0xa1')]){throw new Error(_0x9872('0xa2'));}var _0x36c7f6=_0x5a2377[_0x9872('0x39')][_0x9872('0xa3')]?_0x5a2377[_0x9872('0x39')][_0x9872('0xa3')]+':'+_0x5a2377['query'][_0x9872('0xa1')]:_0x9872('0xa4')+_0x5a2377[_0x9872('0x39')][_0x9872('0xa1')];var _0x284c12=_0x5a2377[_0x9872('0x39')][_0x9872('0x24')]?_0x5a2377[_0x9872('0x39')][_0x9872('0x24')]:!![];var _0x2bc3af=_0x5a2377[_0x9872('0x39')][_0x9872('0xa5')]?_0x5a2377[_0x9872('0x39')][_0x9872('0xa5')]:null;var _0x9a29ff={'method':_0x5a2377[_0x9872('0xa6')],'uri':util[_0x9872('0x54')]('%s%s',_0x36c7f6,_0x5a2377[_0x9872('0x39')][_0x9872('0x6')]),'json':_0x284c12,'resolveWithFullResponse':!![],'encoding':_0x2bc3af,'qs':_0x5a2377['query']};if(_0x5a2377['headers']){_0x9a29ff[_0x9872('0xa7')]=_0x5a2377[_0x9872('0xa7')];if(_0x9a29ff['headers']['content-length']){delete _0x9a29ff['headers'][_0x9872('0xa8')];}}if(_0x9a29ff[_0x9872('0xa7')][_0x9872('0xa9')]){delete _0x9a29ff[_0x9872('0xa7')]['content-type'];}return rp(_0x9a29ff);})[_0x9872('0x2d')](function(_0x4d8c9a){if(_0x4d8c9a){_0x2e3969[_0x9872('0xaa')](_0x4d8c9a[_0x9872('0xa7')]);logger[_0x9872('0x68')](_0x4d8c9a[_0x9872('0x94')]);if(_[_0x9872('0xab')](_0x5a2377[_0x9872('0x39')]['path'],_0x9872('0x66'))&&_0x4d8c9a['statusCode']==0x1f4){return _0x2e3969['sendStatus'](_0x4d8c9a[_0x9872('0xac')]);}else{return _0x2e3969['status'](_0x4d8c9a['statusCode'])[_0x9872('0x32')](_0x4d8c9a[_0x9872('0x94')]);}}else{return _0x2e3969[_0x9872('0x21')](0xc8);}})[_0x9872('0x52')](handleError(_0x2e3969,null));};exports[_0x9872('0xad')]=function(_0x152200,_0x4c916f,_0x5e9e04){return BPromise['resolve']()['then'](function(){if(!_0x152200[_0x9872('0x39')][_0x9872('0x6')]){throw new Error(_0x9872('0xa0'));}if(!_0x152200[_0x9872('0x39')][_0x9872('0xa1')]){throw new Error(_0x9872('0xa2'));}var _0x581d97=_0x152200[_0x9872('0x39')][_0x9872('0xa3')]?_0x152200[_0x9872('0x39')][_0x9872('0xa3')]+':'+_0x152200[_0x9872('0x39')][_0x9872('0xa1')]:_0x9872('0xa4')+_0x152200[_0x9872('0x39')]['port'];var _0x4e792f=_0x152200['query'][_0x9872('0x24')]?_0x152200[_0x9872('0x39')][_0x9872('0x24')]:!![];var _0x85f48c=_0x152200[_0x9872('0x39')]['encoding']?_0x152200[_0x9872('0x39')]['encoding']:null;var _0x3f0e5e={'method':_0x152200[_0x9872('0xa6')],'uri':util[_0x9872('0x54')]('%s%s',_0x581d97,_0x152200[_0x9872('0x39')][_0x9872('0x6')]),'json':_0x4e792f,'resolveWithFullResponse':!![],'encoding':_0x85f48c,'body':_0x152200[_0x9872('0x94')]};if(_0x152200[_0x9872('0xa7')]){_0x3f0e5e[_0x9872('0xa7')]=_0x152200[_0x9872('0xa7')];if(_0x3f0e5e[_0x9872('0xa7')][_0x9872('0xa8')]){delete _0x3f0e5e[_0x9872('0xa7')][_0x9872('0xa8')];}}if(_0x3f0e5e['headers'][_0x9872('0xa9')]){delete _0x3f0e5e[_0x9872('0xa7')]['content-type'];}return rp(_0x3f0e5e);})['then'](function(_0x2ec4d1){if(_0x2ec4d1){_0x4c916f[_0x9872('0xaa')](_0x2ec4d1[_0x9872('0xa7')]);logger[_0x9872('0x68')](_0x2ec4d1[_0x9872('0x94')]);return _0x4c916f['status'](_0x2ec4d1['statusCode'])[_0x9872('0x32')](_0x2ec4d1['body']);}else{return _0x4c916f[_0x9872('0x21')](0xc8);}})[_0x9872('0x52')](handleError(_0x4c916f,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 074d009..1805f28 100644 --- a/server/api/plugin/plugin.events.js +++ b/server/api/plugin/plugin.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1419=['Plugin','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2f0274,_0x2dd966){var _0x188cca=function(_0x28e7b1){while(--_0x28e7b1){_0x2f0274['push'](_0x2f0274['shift']());}};_0x188cca(++_0x2dd966);}(_0x1419,0x127));var _0x9141=function(_0x482690,_0x245d70){_0x482690=_0x482690-0x0;var _0x2f371e=_0x1419[_0x482690];return _0x2f371e;};'use strict';var EventEmitter=require(_0x9141('0x0'));var Plugin=require(_0x9141('0x1'))['db'][_0x9141('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x9141('0x3')](0x0);var events={'afterCreate':_0x9141('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x749bf2){return function(_0x16694b,_0x4c1d20,_0x544162){PluginEvents[_0x9141('0x5')](_0x749bf2+':'+_0x16694b['id'],_0x16694b);PluginEvents[_0x9141('0x5')](_0x749bf2,_0x16694b);_0x544162(null);};}for(var e in events){if(events[_0x9141('0x6')](e)){var event=events[e];Plugin[_0x9141('0x7')](e,emitEvent(event));}}module[_0x9141('0x8')]=PluginEvents; \ No newline at end of file +var _0xfd6e=['save','update','emit','hasOwnProperty','hook','exports','events','Plugin'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xfd6e,0x16e));var _0xefd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd6e[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xefd6('0x0'));var Plugin=require('../../mysqldb')['db'][_0xefd6('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xefd6('0x2'),'afterUpdate':_0xefd6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4a87f5){return function(_0x5f4c49,_0x27d881,_0x54da40){PluginEvents['emit'](_0x4a87f5+':'+_0x5f4c49['id'],_0x5f4c49);PluginEvents[_0xefd6('0x4')](_0x4a87f5,_0x5f4c49);_0x54da40(null);};}for(var e in events){if(events[_0xefd6('0x5')](e)){var event=events[e];Plugin[_0xefd6('0x6')](e,emitEvent(event));}}module[_0xefd6('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index e65c1f0..0c813c1 100644 --- a/server/api/plugin/plugin.model.js +++ b/server/api/plugin/plugin.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66da=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util'];(function(_0x5490ed,_0x31f9ab){var _0x455c7c=function(_0x5819b2){while(--_0x5819b2){_0x5490ed['push'](_0x5490ed['shift']());}};_0x455c7c(++_0x31f9ab);}(_0x66da,0x12a));var _0xa66d=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x66da[_0x9cfe28];return _0x54a1d0;};'use strict';var _=require(_0xa66d('0x0'));var util=require(_0xa66d('0x1'));var logger=require(_0xa66d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa66d('0x3'));var rp=require(_0xa66d('0x4'));var fs=require('fs');var path=require(_0xa66d('0x5'));var rimraf=require(_0xa66d('0x6'));var config=require(_0xa66d('0x7'));var attributes=require(_0xa66d('0x8'));module['exports']=function(_0x20ccde,_0x33ded1){return _0x20ccde[_0xa66d('0x9')](_0xa66d('0xa'),attributes,{'tableName':_0xa66d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5da4=['bluebird','path','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x1934a9,_0x4c2f22){var _0x1b80a8=function(_0x3fd0e9){while(--_0x3fd0e9){_0x1934a9['push'](_0x1934a9['shift']());}};_0x1b80a8(++_0x4c2f22);}(_0x5da4,0x174));var _0x45da=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5da4[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x45da('0x0'));var util=require(_0x45da('0x1'));var logger=require(_0x45da('0x2'))(_0x45da('0x3'));var moment=require(_0x45da('0x4'));var BPromise=require(_0x45da('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x45da('0x6'));var rimraf=require('rimraf');var config=require(_0x45da('0x7'));var attributes=require(_0x45da('0x8'));module[_0x45da('0x9')]=function(_0x41ecc4,_0x1025e7){return _0x41ecc4[_0x45da('0xa')](_0x45da('0xb'),attributes,{'tableName':_0x45da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index edc6add..08b7c8c 100644 --- a/server/api/plugin/plugin.rpc.js +++ b/server/api/plugin/plugin.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6722=['error','code','Plugin,\x20%s,\x20%s','message','result','catch','Plugin','create','body','raw','CreatePlugin','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./plugin.socket','register','request','then','info','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xda26e1,_0xf2f83a){var _0x442eae=function(_0x1cc252){while(--_0x1cc252){_0xda26e1['push'](_0xda26e1['shift']());}};_0x442eae(++_0xf2f83a);}(_0x6722,0x134));var _0x2672=function(_0xcd9a05,_0x3d7f5e){_0xcd9a05=_0xcd9a05-0x0;var _0x216942=_0x6722[_0xcd9a05];return _0x216942;};'use strict';var _=require(_0x2672('0x0'));var util=require(_0x2672('0x1'));var moment=require(_0x2672('0x2'));var BPromise=require(_0x2672('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2672('0x4'));var db=require(_0x2672('0x5'))['db'];var utils=require(_0x2672('0x6'));var logger=require(_0x2672('0x7'))(_0x2672('0x8'));var config=require('../../config/environment');var jayson=require(_0x2672('0x9'));var client=jayson[_0x2672('0xa')]['http']({'port':0x232a});config[_0x2672('0xb')]=_[_0x2672('0xc')](config[_0x2672('0xb')],{'host':_0x2672('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2672('0xe'))[_0x2672('0xf')](socket);function respondWithRpcPromise(_0x47e26b,_0x966d74,_0x197914){return new BPromise(function(_0x149a66,_0x429764){return client[_0x2672('0x10')](_0x47e26b,_0x197914)[_0x2672('0x11')](function(_0x23d822){logger[_0x2672('0x12')]('Plugin,\x20%s,\x20%s',_0x966d74,'request\x20sent');logger[_0x2672('0x13')](_0x2672('0x14'),_0x966d74,'request\x20sent',JSON[_0x2672('0x15')](_0x23d822));if(_0x23d822[_0x2672('0x16')]){if(_0x23d822[_0x2672('0x16')][_0x2672('0x17')]===0x1f4){logger[_0x2672('0x16')](_0x2672('0x18'),_0x966d74,_0x23d822[_0x2672('0x16')][_0x2672('0x19')]);return _0x429764(_0x23d822['error'][_0x2672('0x19')]);}logger[_0x2672('0x16')](_0x2672('0x18'),_0x966d74,_0x23d822[_0x2672('0x16')]['message']);return _0x149a66(_0x23d822[_0x2672('0x16')][_0x2672('0x19')]);}else{logger[_0x2672('0x12')]('Plugin,\x20%s,\x20%s',_0x966d74,'request\x20sent');_0x149a66(_0x23d822[_0x2672('0x1a')][_0x2672('0x19')]);}})[_0x2672('0x1b')](function(_0x201415){logger[_0x2672('0x16')](_0x2672('0x18'),_0x966d74,_0x201415);_0x429764(_0x201415);});});}exports['CreatePlugin']=function(_0x26ac57){var _0x5a973d=this;return new Promise(function(_0x3ece36,_0x498df6){return db[_0x2672('0x1c')][_0x2672('0x1d')](_0x26ac57[_0x2672('0x1e')],{'raw':_0x26ac57['options']?_0x26ac57['options'][_0x2672('0x1f')]===undefined?!![]:![]:!![]})[_0x2672('0x11')](function(_0x344569){logger[_0x2672('0x12')](_0x2672('0x20'),_0x26ac57);logger[_0x2672('0x13')](_0x2672('0x20'),_0x26ac57,JSON[_0x2672('0x15')](_0x344569));_0x3ece36(_0x344569);})[_0x2672('0x1b')](function(_0x371d6e){logger[_0x2672('0x16')](_0x2672('0x20'),_0x371d6e[_0x2672('0x19')],_0x26ac57);_0x498df6(_0x5a973d[_0x2672('0x16')](0x1f4,_0x371d6e[_0x2672('0x19')]));});});}; \ No newline at end of file +var _0xae2b=['Plugin','create','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','./plugin.socket','register','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreatePlugin'];(function(_0x194500,_0x275ba4){var _0x25c901=function(_0x3757f1){while(--_0x3757f1){_0x194500['push'](_0x194500['shift']());}};_0x25c901(++_0x275ba4);}(_0xae2b,0xb3));var _0xbae2=function(_0x9e08c8,_0x4ebe76){_0x9e08c8=_0x9e08c8-0x0;var _0x5628c3=_0xae2b[_0x9e08c8];return _0x5628c3;};'use strict';var _=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));var moment=require('moment');var BPromise=require(_0xbae2('0x2'));var rs=require(_0xbae2('0x3'));var fs=require('fs');var Redis=require(_0xbae2('0x4'));var db=require(_0xbae2('0x5'))['db'];var utils=require(_0xbae2('0x6'));var logger=require(_0xbae2('0x7'))('rpc');var config=require(_0xbae2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbae2('0x9')][_0xbae2('0xa')]({'port':0x232a});config[_0xbae2('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbae2('0xb')]));require(_0xbae2('0xc'))[_0xbae2('0xd')](socket);function respondWithRpcPromise(_0xf470fd,_0x27ea94,_0x193185){return new BPromise(function(_0x843207,_0x5a6d1f){return client['request'](_0xf470fd,_0x193185)['then'](function(_0x2087ed){logger['info'](_0xbae2('0xe'),_0x27ea94,_0xbae2('0xf'));logger[_0xbae2('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x27ea94,_0xbae2('0xf'),JSON[_0xbae2('0x11')](_0x2087ed));if(_0x2087ed['error']){if(_0x2087ed[_0xbae2('0x12')][_0xbae2('0x13')]===0x1f4){logger[_0xbae2('0x12')](_0xbae2('0xe'),_0x27ea94,_0x2087ed[_0xbae2('0x12')][_0xbae2('0x14')]);return _0x5a6d1f(_0x2087ed[_0xbae2('0x12')]['message']);}logger[_0xbae2('0x12')]('Plugin,\x20%s,\x20%s',_0x27ea94,_0x2087ed[_0xbae2('0x12')][_0xbae2('0x14')]);return _0x843207(_0x2087ed['error'][_0xbae2('0x14')]);}else{logger[_0xbae2('0x15')]('Plugin,\x20%s,\x20%s',_0x27ea94,_0xbae2('0xf'));_0x843207(_0x2087ed[_0xbae2('0x16')][_0xbae2('0x14')]);}})['catch'](function(_0x21c9fa){logger['error']('Plugin,\x20%s,\x20%s',_0x27ea94,_0x21c9fa);_0x5a6d1f(_0x21c9fa);});});}exports[_0xbae2('0x17')]=function(_0x2c40ea){var _0x114fbe=this;return new Promise(function(_0x17433d,_0x53b581){return db[_0xbae2('0x18')][_0xbae2('0x19')](_0x2c40ea['body'],{'raw':_0x2c40ea['options']?_0x2c40ea[_0xbae2('0x1a')][_0xbae2('0x1b')]===undefined?!![]:![]:!![]})[_0xbae2('0x1c')](function(_0x1b9b24){logger[_0xbae2('0x15')]('CreatePlugin',_0x2c40ea);logger['debug'](_0xbae2('0x17'),_0x2c40ea,JSON[_0xbae2('0x11')](_0x1b9b24));_0x17433d(_0x1b9b24);})['catch'](function(_0x2f1da9){logger[_0xbae2('0x12')](_0xbae2('0x17'),_0x2f1da9[_0xbae2('0x14')],_0x2c40ea);_0x53b581(_0x114fbe['error'](0x1f4,_0x2f1da9[_0xbae2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 93fffd1..201cde9 100644 --- a/server/api/plugin/plugin.socket.js +++ b/server/api/plugin/plugin.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1ff=['register','length','plugin:','./plugin.events','save','update','emit','removeListener'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb1ff,0xab));var _0xfb1f=function(_0x4f3e5a,_0x1ee150){_0x4f3e5a=_0x4f3e5a-0x0;var _0x452880=_0xb1ff[_0x4f3e5a];return _0x452880;};'use strict';var PluginEvents=require(_0xfb1f('0x0'));var events=[_0xfb1f('0x1'),'remove',_0xfb1f('0x2')];function createListener(_0x27eb7e,_0x11bbfc){return function(_0x3e08ed){_0x11bbfc[_0xfb1f('0x3')](_0x27eb7e,_0x3e08ed);};}function removeListener(_0x560bb4,_0x3c76f0){return function(){PluginEvents[_0xfb1f('0x4')](_0x560bb4,_0x3c76f0);};}exports[_0xfb1f('0x5')]=function(_0x269de7){for(var _0x329435=0x0,_0x39d9ea=events[_0xfb1f('0x6')];_0x329435<_0x39d9ea;_0x329435++){var _0x1df850=events[_0x329435];var _0x51a60d=createListener(_0xfb1f('0x7')+_0x1df850,_0x269de7);PluginEvents['on'](_0x1df850,_0x51a60d);}}; \ No newline at end of file +var _0x123a=['register','length','plugin:','./plugin.events','update','emit','removeListener'];(function(_0x38cd1a,_0xfd5008){var _0x43b6ce=function(_0xd25289){while(--_0xd25289){_0x38cd1a['push'](_0x38cd1a['shift']());}};_0x43b6ce(++_0xfd5008);}(_0x123a,0x14c));var _0xa123=function(_0x5d0772,_0xca6ec4){_0x5d0772=_0x5d0772-0x0;var _0xde4b2e=_0x123a[_0x5d0772];return _0xde4b2e;};'use strict';var PluginEvents=require(_0xa123('0x0'));var events=['save','remove',_0xa123('0x1')];function createListener(_0x3ab3d9,_0x5b5ae3){return function(_0x1e7a43){_0x5b5ae3[_0xa123('0x2')](_0x3ab3d9,_0x1e7a43);};}function removeListener(_0x5c4438,_0x52351f){return function(){PluginEvents[_0xa123('0x3')](_0x5c4438,_0x52351f);};}exports[_0xa123('0x4')]=function(_0x1dc211){for(var _0x3a6864=0x0,_0x485d0e=events[_0xa123('0x5')];_0x3a6864<_0x485d0e;_0x3a6864++){var _0x3ef21a=events[_0x3a6864];var _0x17b4e3=createListener(_0xa123('0x6')+_0x3ef21a,_0x1dc211);PluginEvents['on'](_0x3ef21a,_0x17b4e3);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a5001fa..b867d7c 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x343b88,_0x47f481){var _0x466e14=function(_0x9cb9d3){while(--_0x9cb9d3){_0x343b88['push'](_0x343b88['shift']());}};_0x466e14(++_0x47f481);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x352108,_0xb5cdc3){var _0x2c901c=function(_0x4e0a61){while(--_0x4e0a61){_0x352108['push'](_0x352108['shift']());}};_0x2c901c(++_0xb5cdc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 32e87ec..184302c 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['dirname','start','dump','restart','stop','hasOwnProperty','params','send','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','name','info','index','then','express','motion2','length','catch','show','describe','create','body','script','../../files/plugins','cwd','chdir'];(function(_0x47aba8,_0x3c58f7){var _0xfae151=function(_0x3485e3){while(--_0x3485e3){_0x47aba8['push'](_0x47aba8['shift']());}};_0xfae151(++_0x3c58f7);}(_0x878f,0x173));var _0xf878=function(_0x3f118e,_0x2bc76a){_0x3f118e=_0x3f118e-0x0;var _0x490cc3=_0x878f[_0x3f118e];return _0x490cc3;};'use strict';var _=require('lodash');var pm2=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var path=require(_0xf878('0x3'));var exec=require(_0xf878('0x4'))[_0xf878('0x5')];var BPromise=require(_0xf878('0x6'));function handleEntityNotFound(_0x45a37b,_0x240b48){return function(_0xcf1927){if(!_0xcf1927){_0x45a37b[_0xf878('0x7')](0x194);;}return _0xcf1927;};}function respondWithResult(_0x4bc9aa,_0x4ac8d8){_0x4ac8d8=_0x4ac8d8||0xc8;return function(_0x3c5f5c){if(_0x3c5f5c){return _0x4bc9aa[_0xf878('0x8')](_0x4ac8d8)['json'](_0x3c5f5c);}return null;};}function handleError(_0x52851e,_0x530767){_0x530767=_0x530767||0x1f4;return function(_0x3329df){logger['error'](_0x3329df['stack']);if(_0x3329df[_0xf878('0x9')]){delete _0x3329df[_0xf878('0x9')];}_0x52851e[_0xf878('0x8')](_0x530767)['send'](_0x3329df);};}function execChildProcess(){return new BPromise(function(_0xb2863e,_0x1399a3){exec('npm\x20install',function(_0xdf76,_0x4f7e7f,_0x31d3d2){logger[_0xf878('0xa')](_0x4f7e7f);logger[_0xf878('0xa')](_0x31d3d2);if(_0xdf76){logger['error'](_0xdf76);return _0x1399a3(_0xdf76);}return _0xb2863e(_0x4f7e7f);});});}exports[_0xf878('0xb')]=function(_0x38eddf,_0x39b1bb){return pm2['list']()[_0xf878('0xc')](function(_0x3902f7){if(_0x3902f7){var _0x119e9e=_['reject'](_0x3902f7,function(_0x568a3a){return _0x568a3a[_0xf878('0x9')]===_0xf878('0xd')||_0x568a3a[_0xf878('0x9')]===_0xf878('0xe');});return{'rows':_0x119e9e,'count':_0x119e9e[_0xf878('0xf')]};}return null;})[_0xf878('0xc')](respondWithResult(_0x39b1bb,null))[_0xf878('0x10')](handleError(_0x39b1bb,null));};exports[_0xf878('0x11')]=function(_0x3c5dee,_0x3a55f3){return pm2[_0xf878('0x12')](_0x3c5dee['params']['id'])[_0xf878('0xc')](respondWithResult(_0x3a55f3,null))[_0xf878('0xc')](handleEntityNotFound(_0x3a55f3,null))[_0xf878('0x10')](handleError(_0x3a55f3,null));};exports[_0xf878('0x13')]=function(_0x3714f6,_0x237d15){if(_0x3714f6[_0xf878('0x14')]['name']&&_0x3714f6[_0xf878('0x14')][_0xf878('0x15')]){var _0x250f85=path['join'](__dirname,_0xf878('0x16'),_0x3714f6[_0xf878('0x14')][_0xf878('0x15')]);var _0x392822=process[_0xf878('0x17')]();process[_0xf878('0x18')](path[_0xf878('0x19')](_0x250f85));return execChildProcess()[_0xf878('0xc')](function(_0x212436){process[_0xf878('0x18')](_0x392822);return pm2[_0xf878('0x1a')]({'name':_0x3714f6['body'][_0xf878('0x9')],'script':_0x250f85});})['then'](function(_0xa3d3d3){pm2[_0xf878('0x1b')]();return _0xa3d3d3[0x0];})[_0xf878('0xc')](respondWithResult(_0x237d15,0xc9))[_0xf878('0x10')](handleError(_0x237d15,null));}else{return _0x237d15[_0xf878('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x242926,_0x3baba4){if(_0x242926[_0xf878('0x14')]['id']){delete _0x242926['body']['id'];}var _0xfa3e11={'online':_0xf878('0x1c'),'stopped':_0xf878('0x1d')};if(_0xfa3e11[_0xf878('0x1e')](_0x242926[_0xf878('0x14')]['status'])){return pm2[_0xfa3e11[_0x242926['body'][_0xf878('0x8')]]](_0x242926[_0xf878('0x1f')]['id'])['then'](respondWithResult(_0x3baba4,0xc8))[_0xf878('0x10')](handleError(_0x3baba4,null));}else{return _0x3baba4['status'](0x1f4)[_0xf878('0x20')]({'message':'Unknown\x20status'});}};exports[_0xf878('0x21')]=function(_0x49e66a,_0x2630fb){if(_0x49e66a['body']['id']){delete _0x49e66a[_0xf878('0x14')]['id'];}if(_0x49e66a[_0xf878('0x1f')]['id']){return pm2[_0xf878('0x22')](_0x49e66a[_0xf878('0x1f')]['id'])[_0xf878('0xc')](function(_0x716782){pm2['dump']();return _0x716782[0x0];})[_0xf878('0xc')](respondWithResult(_0x2630fb,null))[_0xf878('0x10')](handleError(_0x2630fb,null));}else{return _0x2630fb[_0xf878('0x8')](0x1f4)[_0xf878('0x20')]({'message':_0xf878('0x23')});}}; \ No newline at end of file +var _0xb4e6=['express','motion2','length','describe','params','catch','create','body','script','join','cwd','chdir','dirname','dump','update','restart','hasOwnProperty','Unknown\x20status','delete','lodash','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','send','npm\x20install','info','index','then','reject'];(function(_0xa3e7e,_0x4a4d80){var _0x50fbb2=function(_0x3a9cb8){while(--_0x3a9cb8){_0xa3e7e['push'](_0xa3e7e['shift']());}};_0x50fbb2(++_0x4a4d80);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0xb4e6[_0x3a8db5];return _0x2c03cd;};'use strict';var _=require(_0x6b4e('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var path=require(_0x6b4e('0x3'));var exec=require(_0x6b4e('0x4'))[_0x6b4e('0x5')];var BPromise=require(_0x6b4e('0x6'));function handleEntityNotFound(_0x1929b8,_0x52313b){return function(_0x40da90){if(!_0x40da90){_0x1929b8[_0x6b4e('0x7')](0x194);;}return _0x40da90;};}function respondWithResult(_0x1f67a2,_0x49de51){_0x49de51=_0x49de51||0xc8;return function(_0xd3138f){if(_0xd3138f){return _0x1f67a2['status'](_0x49de51)['json'](_0xd3138f);}return null;};}function handleError(_0x2311d9,_0x48c870){_0x48c870=_0x48c870||0x1f4;return function(_0x53a71f){logger[_0x6b4e('0x8')](_0x53a71f[_0x6b4e('0x9')]);if(_0x53a71f[_0x6b4e('0xa')]){delete _0x53a71f[_0x6b4e('0xa')];}_0x2311d9[_0x6b4e('0xb')](_0x48c870)[_0x6b4e('0xc')](_0x53a71f);};}function execChildProcess(){return new BPromise(function(_0x323487,_0x49c734){exec(_0x6b4e('0xd'),function(_0x3bba86,_0x58c67d,_0x2a4d0f){logger[_0x6b4e('0xe')](_0x58c67d);logger[_0x6b4e('0xe')](_0x2a4d0f);if(_0x3bba86){logger[_0x6b4e('0x8')](_0x3bba86);return _0x49c734(_0x3bba86);}return _0x323487(_0x58c67d);});});}exports[_0x6b4e('0xf')]=function(_0xa3d358,_0x1db513){return pm2['list']()[_0x6b4e('0x10')](function(_0x29bdee){if(_0x29bdee){var _0x4788cf=_[_0x6b4e('0x11')](_0x29bdee,function(_0x4b62ad){return _0x4b62ad[_0x6b4e('0xa')]===_0x6b4e('0x12')||_0x4b62ad[_0x6b4e('0xa')]===_0x6b4e('0x13');});return{'rows':_0x4788cf,'count':_0x4788cf[_0x6b4e('0x14')]};}return null;})[_0x6b4e('0x10')](respondWithResult(_0x1db513,null))['catch'](handleError(_0x1db513,null));};exports['show']=function(_0x67496d,_0x1beb73){return pm2[_0x6b4e('0x15')](_0x67496d[_0x6b4e('0x16')]['id'])[_0x6b4e('0x10')](respondWithResult(_0x1beb73,null))[_0x6b4e('0x10')](handleEntityNotFound(_0x1beb73,null))[_0x6b4e('0x17')](handleError(_0x1beb73,null));};exports[_0x6b4e('0x18')]=function(_0x35aee1,_0x20a178){if(_0x35aee1[_0x6b4e('0x19')]['name']&&_0x35aee1[_0x6b4e('0x19')][_0x6b4e('0x1a')]){var _0x31fb9d=path[_0x6b4e('0x1b')](__dirname,'../../files/plugins',_0x35aee1[_0x6b4e('0x19')]['script']);var _0x2503a5=process[_0x6b4e('0x1c')]();process[_0x6b4e('0x1d')](path[_0x6b4e('0x1e')](_0x31fb9d));return execChildProcess()[_0x6b4e('0x10')](function(_0x346566){process[_0x6b4e('0x1d')](_0x2503a5);return pm2['start']({'name':_0x35aee1[_0x6b4e('0x19')]['name'],'script':_0x31fb9d});})[_0x6b4e('0x10')](function(_0x884b7e){pm2[_0x6b4e('0x1f')]();return _0x884b7e[0x0];})[_0x6b4e('0x10')](respondWithResult(_0x20a178,0xc9))['catch'](handleError(_0x20a178,null));}else{return _0x20a178[_0x6b4e('0xb')](0x1f4)[_0x6b4e('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x6b4e('0x20')]=function(_0x381ff0,_0x3513b2){if(_0x381ff0[_0x6b4e('0x19')]['id']){delete _0x381ff0['body']['id'];}var _0x2d42be={'online':_0x6b4e('0x21'),'stopped':'stop'};if(_0x2d42be[_0x6b4e('0x22')](_0x381ff0[_0x6b4e('0x19')][_0x6b4e('0xb')])){return pm2[_0x2d42be[_0x381ff0[_0x6b4e('0x19')]['status']]](_0x381ff0[_0x6b4e('0x16')]['id'])[_0x6b4e('0x10')](respondWithResult(_0x3513b2,0xc8))['catch'](handleError(_0x3513b2,null));}else{return _0x3513b2[_0x6b4e('0xb')](0x1f4)[_0x6b4e('0xc')]({'message':_0x6b4e('0x23')});}};exports['destroy']=function(_0x5c2200,_0x11156e){if(_0x5c2200[_0x6b4e('0x19')]['id']){delete _0x5c2200[_0x6b4e('0x19')]['id'];}if(_0x5c2200['params']['id']){return pm2[_0x6b4e('0x24')](_0x5c2200[_0x6b4e('0x16')]['id'])[_0x6b4e('0x10')](function(_0x5c1444){pm2['dump']();return _0x5c1444[0x0];})[_0x6b4e('0x10')](respondWithResult(_0x11156e,null))['catch'](handleError(_0x11156e,null));}else{return _0x11156e[_0x6b4e('0xb')](0x1f4)[_0x6b4e('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 081c017..e0d813f 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0194=['get','isAuthenticated','getAgents','getQueues','Router','../../components/auth/service','./realtime.controller'];(function(_0x5781b9,_0x33c197){var _0x81dfb5=function(_0x22664f){while(--_0x22664f){_0x5781b9['push'](_0x5781b9['shift']());}};_0x81dfb5(++_0x33c197);}(_0x0194,0x185));var _0x4019=function(_0x39de23,_0x67e006){_0x39de23=_0x39de23-0x0;var _0x2698a7=_0x0194[_0x39de23];return _0x2698a7;};'use strict';var express=require('express');var router=express[_0x4019('0x0')]();var auth=require(_0x4019('0x1'));var controller=require(_0x4019('0x2'));router[_0x4019('0x3')]('/agents',auth[_0x4019('0x4')](),controller[_0x4019('0x5')]);router[_0x4019('0x3')]('/queues',auth[_0x4019('0x4')](),controller[_0x4019('0x6')]);module['exports']=router; \ No newline at end of file +var _0x5428=['isAuthenticated','getAgents','/queues','getQueues','exports','express','../../components/auth/service','./realtime.controller','/agents'];(function(_0x8426a0,_0x183ad8){var _0x4f71e3=function(_0x3df1bb){while(--_0x3df1bb){_0x8426a0['push'](_0x8426a0['shift']());}};_0x4f71e3(++_0x183ad8);}(_0x5428,0x9e));var _0x8542=function(_0x1447e9,_0x56d9a2){_0x1447e9=_0x1447e9-0x0;var _0x499e29=_0x5428[_0x1447e9];return _0x499e29;};'use strict';var express=require(_0x8542('0x0'));var router=express['Router']();var auth=require(_0x8542('0x1'));var controller=require(_0x8542('0x2'));router['get'](_0x8542('0x3'),auth[_0x8542('0x4')](),controller[_0x8542('0x5')]);router['get'](_0x8542('0x6'),auth[_0x8542('0x4')](),controller[_0x8542('0x7')]);module[_0x8542('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 6818354..b9bad89 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e8f=['../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','undefined','limit','offset','count','Content-Range','json','query','globalStatusFilter','pause','*pause','resolve','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','rawAttributes','fieldName','type','key','role','length','push','sequelize','forEach','Pause','where','user','userProfileId','agent','online','extraQueryConditions','assign','getResources','User','globalStatus','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','isValidChannel','startCase','Queue','name','outbound','dialActive','dialMethod','getOptions','Queues','filter','UserProfile','getRealtimeQueues','lodash','util'];(function(_0x4368a8,_0x46772e){var _0x1578fd=function(_0x23a15f){while(--_0x23a15f){_0x4368a8['push'](_0x4368a8['shift']());}};_0x1578fd(++_0x46772e);}(_0x0e8f,0x189));var _0xf0e8=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x0e8f[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xf0e8('0x0'));var util=require(_0xf0e8('0x1'));var rta=require(_0xf0e8('0x2'));var rtq=require(_0xf0e8('0x3'));var qs=require(_0xf0e8('0x4'));var utils=require(_0xf0e8('0x5'));var db=require(_0xf0e8('0x6'))['db'];var APIBadRequestError=require(_0xf0e8('0x7'))['APIBadRequestError'];var APIHandleError=require(_0xf0e8('0x7'))[_0xf0e8('0x8')];function respondWithFilteredResult(_0x1f4735,_0x58a159){return function(_0x469722){if(_0x469722){var _0x209d2d=typeof _0x58a159['offset']===_0xf0e8('0x9')&&typeof _0x58a159[_0xf0e8('0xa')]===_0xf0e8('0x9');var _0x4720ac=_0x469722['count'];var _0x357071=_0x209d2d?0x0:_0x58a159[_0xf0e8('0xb')];var _0x9a340f=_0x209d2d?_0x469722[_0xf0e8('0xc')]:_0x58a159['offset']+_0x58a159[_0xf0e8('0xa')];var _0x549b85;if(_0x9a340f>=_0x4720ac){_0x9a340f=_0x4720ac;_0x549b85=0xc8;}else{_0x549b85=0xce;}_0x1f4735['status'](_0x549b85);return _0x1f4735['set'](_0xf0e8('0xd'),_0x357071+'-'+_0x9a340f+'/'+_0x4720ac)[_0xf0e8('0xe')](_0x469722);}return null;};}exports['getAgents']=function(_0x789722,_0x17fd43){var _0x152374={'count':0x0,'rows':[]};var _0x5b7b60={};var _0x5d1865;var _0x5b1c7c=utils['getChannels']();var _0x1de1bc;var _0x2242d7;var _0x173531=_0x789722[_0xf0e8('0xf')]['globalQueueFilter'];var _0x5311ed=_0x789722['query'][_0xf0e8('0x10')];var _0x5e3bac=_0x789722[_0xf0e8('0xf')]['pauseTypeFilter'];var _0x3600f1=_0x5311ed===_0xf0e8('0x11')||_0x5311ed===_0xf0e8('0x12')?!![]:![];var _0xac1987=[];var _0x42a0e9;var _0x2f3090;Promise[_0xf0e8('0x13')]()[_0xf0e8('0x14')](function(){if(_0x789722[_0xf0e8('0xf')]['channel']){if(!utils['isValidChannel'](_0x789722[_0xf0e8('0xf')][_0xf0e8('0x15')])){throw new APIBadRequestError(util['format'](_0xf0e8('0x16'),_0x789722[_0xf0e8('0xf')]['channel']));}_0x5d1865=_0x789722[_0xf0e8('0xf')][_0xf0e8('0x15')][_0xf0e8('0x17')]();}if(!_0x789722[_0xf0e8('0xf')]['sort']||!_0x789722[_0xf0e8('0xf')][_0xf0e8('0x18')][_0xf0e8('0x19')]('globalStatus')){_0x789722['query']['sort']=rta[_0xf0e8('0x1a')](_0x789722[_0xf0e8('0xf')]['sort']);return;}var _0x409c86=rta[_0xf0e8('0x1b')](_0x789722['query'][_0xf0e8('0x18')]);_0x789722['query'][_0xf0e8('0x18')]=_0x409c86[_0xf0e8('0x1c')][_0xf0e8('0x1d')](',');_0x42a0e9=_0x409c86[_0xf0e8('0x1e')];})[_0xf0e8('0x14')](function(){if(!_0x173531){return[];}return rta[_0xf0e8('0x1f')](_0x173531,_0x5d1865);})[_0xf0e8('0x14')](function(_0xcc6015){_0xac1987=_0xcc6015;return rta[_0xf0e8('0x20')]();})['then'](function(_0x13f72e){_0x2242d7=_0x13f72e[_0xf0e8('0x21')];if((!_0x5311ed||_0x3600f1)&&!_0x42a0e9){return _0xac1987;}if(_0x42a0e9&&!_0x5311ed){return rta[_0xf0e8('0x22')](_0x2242d7,_0xac1987,_0x42a0e9);}else{return rta[_0xf0e8('0x23')](_0x2242d7,_0xac1987,_0x5311ed);}})[_0xf0e8('0x14')](function(_0x3f156b){_0xac1987=_0x3f156b;var _0x34efdd=![];if(_0xac1987['length']===0x0){if(_0x173531||_0x5311ed){_0x34efdd=!![];}if(_0x3600f1){_0x34efdd=![];}}if(_0x34efdd){return _0x152374;}var _0x48bbd2=_[_0xf0e8('0x24')](db['User'][_0xf0e8('0x25')],function(_0x2673f9){return{'name':_0x2673f9[_0xf0e8('0x26')],'type':_0x2673f9[_0xf0e8('0x27')][_0xf0e8('0x28')]};});_0x789722[_0xf0e8('0xf')][_0xf0e8('0x29')]='agent';_0x5b7b60=qs['getOptions'](_0x48bbd2,_0x789722);_0x5b7b60['raw']=!![];var _0x31fe3d=[];if(_0xac1987[_0xf0e8('0x2a')]>0x0){_0x31fe3d[_0xf0e8('0x2b')]({'id':{'$in':_0xac1987}});if(_0x42a0e9&&!_0x5311ed){_0x2f3090=[db[_0xf0e8('0x2c')]['literal']('FIELD(id,'+_0xac1987+')')];_0x5b7b60[_0xf0e8('0x1e')]=_0x2f3090;}}if(_0x3600f1){_0x5b1c7c[_0xf0e8('0x2d')](function(_0x243043){var _0x4529ef=!![];if(_0x5311ed==='*pause'&&_0x5d1865!==_0x243043){_0x4529ef=![];}_0x31fe3d[_0xf0e8('0x2b')]({[_0x243043+_0xf0e8('0x2e')]:_0x4529ef});});if(_0x5e3bac){_0x31fe3d[_0xf0e8('0x2b')]({'pauseType':_0x5e3bac});}}else if(_0x5311ed){_0x5b1c7c[_0xf0e8('0x2d')](function(_0x16f2f5){_0x31fe3d[_0xf0e8('0x2b')]({[_0x16f2f5+_0xf0e8('0x2e')]:![]});});}_0x5b7b60['where']=_['merge'](_0x5b7b60[_0xf0e8('0x2f')],{'$and':_0x31fe3d});if(_0x789722[_0xf0e8('0x30')][_0xf0e8('0x29')]===_0xf0e8('0x30')){var _0x4624fe={'params':{'id':_0x789722[_0xf0e8('0x30')][_0xf0e8('0x31')]},'query':{'section':'Agents','role':_0xf0e8('0x32'),'raw':!![],'ids':_0xac1987,'customSorting':_0x2f3090}};if(_0x789722['query'][_0xf0e8('0x33')]){_0x4624fe[_0xf0e8('0xf')]['online']=!![];}if(_0x3600f1){_0x4624fe[_0xf0e8('0xf')][_0xf0e8('0x34')]=_0x31fe3d;}_0x4624fe[_0xf0e8('0xf')]=Object[_0xf0e8('0x35')](_0x4624fe[_0xf0e8('0xf')],_0x789722[_0xf0e8('0xf')]);return db['UserProfile'][_0xf0e8('0x36')](_0x4624fe);}return db[_0xf0e8('0x37')]['findAndCountAll'](_0x5b7b60);})[_0xf0e8('0x14')](function(_0x2542fd){_0x152374[_0xf0e8('0xc')]=_0x2542fd['count'];_0x1de1bc=_0x2542fd['rows'];return _0x1de1bc['map'](function(_0x36c41d){var _0x54fca7=_['find'](_0x2242d7,['id',_0x36c41d['id']]);if(_0x54fca7){var _0xb02f94=rta['filterAgentAttributes'](_0x54fca7);_['merge'](_0x36c41d,_0xb02f94);}_0x36c41d[_0xf0e8('0x38')]=rta[_0xf0e8('0x39')](_0x36c41d);if(_0x36c41d[_0xf0e8('0x38')][_0xf0e8('0x19')](_0xf0e8('0x11'))){_0x5b1c7c['forEach'](function(_0x4fbf0a){if(_0x36c41d[_0x4fbf0a+'Pause']){if(_0x4fbf0a===_0xf0e8('0x3a')){if(_0x36c41d[_0xf0e8('0x3b')]!==_0xf0e8('0x3c')){_0x36c41d[_0xf0e8('0x3b')]='pause';}}else{_0x36c41d[_0x4fbf0a+_0xf0e8('0x3d')]=_0xf0e8('0x11');}}});}return _0x36c41d;});})[_0xf0e8('0x14')](function(_0x4a674b){if(!_0x42a0e9||_0x2f3090){return _0x4a674b;}return rta[_0xf0e8('0x3e')](_0x4a674b,_0x42a0e9);})['then'](function(_0x332707){var _0xd62914=rta[_0xf0e8('0x3f')]();_0x152374[_0xf0e8('0x21')]=_0x332707['map'](function(_0x4a6f31){return _[_0xf0e8('0x40')](_0x4a6f31,_0xd62914);});return _0x152374;})[_0xf0e8('0x14')](respondWithFilteredResult(_0x17fd43,_0x5b7b60))[_0xf0e8('0x41')](APIHandleError(_0x17fd43));};exports[_0xf0e8('0x42')]=function(_0x435c8f,_0x18212b){var _0x454801={'count':0x0,'rows':[]};var _0x15fc8b={};var _0x11c65a;var _0x770624;var _0x3e4404;Promise[_0xf0e8('0x13')]()[_0xf0e8('0x14')](function(){if(_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x15')]){if(!utils[_0xf0e8('0x43')](_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x15')])){throw new APIBadRequestError(util['format'](_0xf0e8('0x16'),_0x435c8f[_0xf0e8('0xf')]['channel']));}_0x11c65a=_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x15')]['toLowerCase']();}var _0x3f1a97=_[_0xf0e8('0x44')](_0x11c65a)+_0xf0e8('0x45');var _0x5342b5=_[_0xf0e8('0x24')](db[_0x3f1a97][_0xf0e8('0x25')],function(_0x146ae0){return{'name':_0x146ae0[_0xf0e8('0x26')],'type':_0x146ae0['type'][_0xf0e8('0x28')]};});if(!_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x1c')]){var _0x4ab813=['id',_0xf0e8('0x46')];if(_0x11c65a===_0xf0e8('0x3a')){_0x4ab813['push'](_0xf0e8('0x27'));if(_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x27')]===_0xf0e8('0x47')){_0x4ab813[_0xf0e8('0x2b')]([_0xf0e8('0x48'),_0xf0e8('0x49')]);}}_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x1c')]=_0x4ab813[_0xf0e8('0x1d')](',');}_0x15fc8b=qs[_0xf0e8('0x4a')](_0x5342b5,_0x435c8f);if(_0x435c8f[_0xf0e8('0x30')][_0xf0e8('0x29')]===_0xf0e8('0x30')){var _0x49d136={'params':{'id':_0x435c8f[_0xf0e8('0x30')][_0xf0e8('0x31')]},'query':{'section':_0x11c65a===_0xf0e8('0x3a')&&_0x435c8f['query']['type']===_0xf0e8('0x47')?'QueueCampaigns':_['startCase'](_0x11c65a)+_0xf0e8('0x4b'),'type':_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x27')],'nolimit':!![],'sort':'name','filter':_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x4c')]}};_0x49d136['query']=Object[_0xf0e8('0x35')](_0x49d136['query'],_0x435c8f[_0xf0e8('0xf')]);delete _0x49d136[_0xf0e8('0xf')]['id'];return db[_0xf0e8('0x4d')][_0xf0e8('0x36')](_0x49d136);}return db[_0x3f1a97]['findAndCountAll'](_0x15fc8b);})[_0xf0e8('0x14')](function(_0x4dd8fb){_0x454801[_0xf0e8('0xc')]=_0x4dd8fb['count'];_0x770624=_0x4dd8fb[_0xf0e8('0x21')];return rtq[_0xf0e8('0x4e')](_0x435c8f,_0x11c65a);})[_0xf0e8('0x14')](function(_0xc9021d){_0x3e4404=_0xc9021d[_0xf0e8('0x21')];return rtq['initializeQueues'](_0x770624,_0x3e4404,_0x11c65a,_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x27')]);})[_0xf0e8('0x14')](function(_0x2b7903){_0x454801[_0xf0e8('0x21')]=_0x2b7903;return _0x454801;})['then'](respondWithFilteredResult(_0x18212b,_0x15fc8b))[_0xf0e8('0x41')](APIHandleError(_0x18212b));}; \ No newline at end of file +var _0x01e6=['status','set','Content-Range','json','getAgents','query','globalQueueFilter','pause','*pause','resolve','then','channel','isValidChannel','format','sort','globalStatus','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','type','role','raw','sequelize','literal','forEach','Pause','push','where','merge','user','userProfileId','Agents','agent','online','assign','UserProfile','getResources','findAndCountAll','find','getAgentStatus','includes','talking','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','catch','getQueues','toLowerCase','startCase','Queue','key','name','voice','dialActive','dialMethod','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count'];(function(_0x4377c5,_0x5b49a4){var _0x16bdcf=function(_0x217eff){while(--_0x217eff){_0x4377c5['push'](_0x4377c5['shift']());}};_0x16bdcf(++_0x5b49a4);}(_0x01e6,0x98));var _0x601e=function(_0x37ab34,_0x59efc6){_0x37ab34=_0x37ab34-0x0;var _0x1f8f3f=_0x01e6[_0x37ab34];return _0x1f8f3f;};'use strict';var _=require(_0x601e('0x0'));var util=require(_0x601e('0x1'));var rta=require(_0x601e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x601e('0x3'));var db=require(_0x601e('0x4'))['db'];var APIBadRequestError=require(_0x601e('0x5'))[_0x601e('0x6')];var APIHandleError=require(_0x601e('0x5'))[_0x601e('0x7')];function respondWithFilteredResult(_0x1b30af,_0x167216){return function(_0x5a397d){if(_0x5a397d){var _0x20fc00=typeof _0x167216[_0x601e('0x8')]===_0x601e('0x9')&&typeof _0x167216[_0x601e('0xa')]===_0x601e('0x9');var _0x331b1d=_0x5a397d[_0x601e('0xb')];var _0x595a63=_0x20fc00?0x0:_0x167216[_0x601e('0x8')];var _0x2e898b=_0x20fc00?_0x5a397d['count']:_0x167216['offset']+_0x167216['limit'];var _0x2b86bb;if(_0x2e898b>=_0x331b1d){_0x2e898b=_0x331b1d;_0x2b86bb=0xc8;}else{_0x2b86bb=0xce;}_0x1b30af[_0x601e('0xc')](_0x2b86bb);return _0x1b30af[_0x601e('0xd')](_0x601e('0xe'),_0x595a63+'-'+_0x2e898b+'/'+_0x331b1d)[_0x601e('0xf')](_0x5a397d);}return null;};}exports[_0x601e('0x10')]=function(_0x279dfc,_0x506fbd){var _0xeb9467={'count':0x0,'rows':[]};var _0x23bea4={};var _0x271c6e;var _0x4894ca=utils['getChannels']();var _0x21003d;var _0x34b6f0;var _0x5bb8ed=_0x279dfc[_0x601e('0x11')][_0x601e('0x12')];var _0xf2a46b=_0x279dfc['query']['globalStatusFilter'];var _0x580643=_0x279dfc[_0x601e('0x11')]['pauseTypeFilter'];var _0x38b01d=_0xf2a46b===_0x601e('0x13')||_0xf2a46b===_0x601e('0x14')?!![]:![];var _0x131c73=[];var _0x276420;var _0x3bb3c0;Promise[_0x601e('0x15')]()[_0x601e('0x16')](function(){if(_0x279dfc['query'][_0x601e('0x17')]){if(!utils[_0x601e('0x18')](_0x279dfc[_0x601e('0x11')]['channel'])){throw new APIBadRequestError(util[_0x601e('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x279dfc[_0x601e('0x11')][_0x601e('0x17')]));}_0x271c6e=_0x279dfc[_0x601e('0x11')][_0x601e('0x17')]['toLowerCase']();}if(!_0x279dfc[_0x601e('0x11')][_0x601e('0x1a')]||!_0x279dfc[_0x601e('0x11')][_0x601e('0x1a')]['includes'](_0x601e('0x1b'))){_0x279dfc[_0x601e('0x11')][_0x601e('0x1a')]=rta['validateSortParameter'](_0x279dfc[_0x601e('0x11')][_0x601e('0x1a')]);return;}var _0x56e2c4=rta[_0x601e('0x1c')](_0x279dfc['query']['sort']);_0x279dfc[_0x601e('0x11')][_0x601e('0x1a')]=_0x56e2c4[_0x601e('0x1d')][_0x601e('0x1e')](',');_0x276420=_0x56e2c4[_0x601e('0x1f')];})[_0x601e('0x16')](function(){if(!_0x5bb8ed){return[];}return rta[_0x601e('0x20')](_0x5bb8ed,_0x271c6e);})['then'](function(_0x34e537){_0x131c73=_0x34e537;return rta['getRealtimeAgents']();})[_0x601e('0x16')](function(_0x5a1f3b){_0x34b6f0=_0x5a1f3b[_0x601e('0x21')];if((!_0xf2a46b||_0x38b01d)&&!_0x276420){return _0x131c73;}if(_0x276420&&!_0xf2a46b){return rta[_0x601e('0x22')](_0x34b6f0,_0x131c73,_0x276420);}else{return rta[_0x601e('0x23')](_0x34b6f0,_0x131c73,_0xf2a46b);}})[_0x601e('0x16')](function(_0xe782e4){_0x131c73=_0xe782e4;var _0x9dd810=![];if(_0x131c73[_0x601e('0x24')]===0x0){if(_0x5bb8ed||_0xf2a46b){_0x9dd810=!![];}if(_0x38b01d){_0x9dd810=![];}}if(_0x9dd810){return _0xeb9467;}var _0x48fd92=_[_0x601e('0x25')](db[_0x601e('0x26')][_0x601e('0x27')],function(_0x2d8f37){return{'name':_0x2d8f37['fieldName'],'type':_0x2d8f37[_0x601e('0x28')]['key']};});_0x279dfc['query'][_0x601e('0x29')]='agent';_0x23bea4=qs['getOptions'](_0x48fd92,_0x279dfc);_0x23bea4[_0x601e('0x2a')]=!![];var _0x21d3dd=[];if(_0x131c73[_0x601e('0x24')]>0x0){_0x21d3dd['push']({'id':{'$in':_0x131c73}});if(_0x276420&&!_0xf2a46b){_0x3bb3c0=[db[_0x601e('0x2b')][_0x601e('0x2c')]('FIELD(id,'+_0x131c73+')')];_0x23bea4[_0x601e('0x1f')]=_0x3bb3c0;}}if(_0x38b01d){_0x4894ca[_0x601e('0x2d')](function(_0xa12b4d){var _0x16d17c=!![];if(_0xf2a46b==='*pause'&&_0x271c6e!==_0xa12b4d){_0x16d17c=![];}_0x21d3dd['push']({[_0xa12b4d+_0x601e('0x2e')]:_0x16d17c});});if(_0x580643){_0x21d3dd['push']({'pauseType':_0x580643});}}else if(_0xf2a46b){_0x4894ca['forEach'](function(_0x51d067){_0x21d3dd[_0x601e('0x2f')]({[_0x51d067+_0x601e('0x2e')]:![]});});}_0x23bea4[_0x601e('0x30')]=_[_0x601e('0x31')](_0x23bea4[_0x601e('0x30')],{'$and':_0x21d3dd});if(_0x279dfc[_0x601e('0x32')][_0x601e('0x29')]===_0x601e('0x32')){var _0x7d2cbb={'params':{'id':_0x279dfc['user'][_0x601e('0x33')]},'query':{'section':_0x601e('0x34'),'role':_0x601e('0x35'),'raw':!![],'ids':_0x131c73,'customSorting':_0x3bb3c0}};if(_0x279dfc[_0x601e('0x11')][_0x601e('0x36')]){_0x7d2cbb[_0x601e('0x11')][_0x601e('0x36')]=!![];}if(_0x38b01d){_0x7d2cbb[_0x601e('0x11')]['extraQueryConditions']=_0x21d3dd;}_0x7d2cbb['query']=Object[_0x601e('0x37')](_0x7d2cbb[_0x601e('0x11')],_0x279dfc[_0x601e('0x11')]);return db[_0x601e('0x38')][_0x601e('0x39')](_0x7d2cbb);}return db[_0x601e('0x26')][_0x601e('0x3a')](_0x23bea4);})[_0x601e('0x16')](function(_0x2fbb43){_0xeb9467[_0x601e('0xb')]=_0x2fbb43[_0x601e('0xb')];_0x21003d=_0x2fbb43[_0x601e('0x21')];return _0x21003d['map'](function(_0x4f477b){var _0x26e47c=_[_0x601e('0x3b')](_0x34b6f0,['id',_0x4f477b['id']]);if(_0x26e47c){var _0xb30a3c=rta['filterAgentAttributes'](_0x26e47c);_['merge'](_0x4f477b,_0xb30a3c);}_0x4f477b[_0x601e('0x1b')]=rta[_0x601e('0x3c')](_0x4f477b);if(_0x4f477b['globalStatus'][_0x601e('0x3d')](_0x601e('0x13'))){_0x4894ca['forEach'](function(_0xc88cd5){if(_0x4f477b[_0xc88cd5+_0x601e('0x2e')]){if(_0xc88cd5==='voice'){if(_0x4f477b['voiceStatus']!==_0x601e('0x3e')){_0x4f477b[_0x601e('0x3f')]=_0x601e('0x13');}}else{_0x4f477b[_0xc88cd5+_0x601e('0x40')]=_0x601e('0x13');}}});}return _0x4f477b;});})[_0x601e('0x16')](function(_0x32dc49){if(!_0x276420||_0x3bb3c0){return _0x32dc49;}return rta[_0x601e('0x41')](_0x32dc49,_0x276420);})['then'](function(_0x2b5c4c){var _0x4257d1=rta[_0x601e('0x42')]();_0xeb9467['rows']=_0x2b5c4c['map'](function(_0xa4aa6d){return _['pick'](_0xa4aa6d,_0x4257d1);});return _0xeb9467;})[_0x601e('0x16')](respondWithFilteredResult(_0x506fbd,_0x23bea4))[_0x601e('0x43')](APIHandleError(_0x506fbd));};exports[_0x601e('0x44')]=function(_0x1f479a,_0x46111a){var _0x3113a5={'count':0x0,'rows':[]};var _0x1eadea={};var _0x49c838;var _0x25ab37;var _0x240fe7;Promise['resolve']()[_0x601e('0x16')](function(){if(_0x1f479a[_0x601e('0x11')][_0x601e('0x17')]){if(!utils['isValidChannel'](_0x1f479a[_0x601e('0x11')][_0x601e('0x17')])){throw new APIBadRequestError(util[_0x601e('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1f479a['query'][_0x601e('0x17')]));}_0x49c838=_0x1f479a['query'][_0x601e('0x17')][_0x601e('0x45')]();}var _0x409b58=_[_0x601e('0x46')](_0x49c838)+_0x601e('0x47');var _0x5bf732=_['map'](db[_0x409b58][_0x601e('0x27')],function(_0x5f4997){return{'name':_0x5f4997['fieldName'],'type':_0x5f4997[_0x601e('0x28')][_0x601e('0x48')]};});if(!_0x1f479a['query'][_0x601e('0x1d')]){var _0x4adcc2=['id',_0x601e('0x49')];if(_0x49c838===_0x601e('0x4a')){_0x4adcc2[_0x601e('0x2f')]('type');if(_0x1f479a[_0x601e('0x11')][_0x601e('0x28')]==='outbound'){_0x4adcc2['push']([_0x601e('0x4b'),_0x601e('0x4c')]);}}_0x1f479a[_0x601e('0x11')][_0x601e('0x1d')]=_0x4adcc2['join'](',');}_0x1eadea=qs['getOptions'](_0x5bf732,_0x1f479a);if(_0x1f479a[_0x601e('0x32')]['role']==='user'){var _0x3bc1b1={'params':{'id':_0x1f479a[_0x601e('0x32')][_0x601e('0x33')]},'query':{'section':_0x49c838===_0x601e('0x4a')&&_0x1f479a[_0x601e('0x11')][_0x601e('0x28')]==='outbound'?_0x601e('0x4d'):_[_0x601e('0x46')](_0x49c838)+_0x601e('0x4e'),'type':_0x1f479a['query']['type'],'nolimit':!![],'sort':_0x601e('0x49'),'filter':_0x1f479a['query'][_0x601e('0x4f')]}};_0x3bc1b1['query']=Object[_0x601e('0x37')](_0x3bc1b1[_0x601e('0x11')],_0x1f479a[_0x601e('0x11')]);delete _0x3bc1b1['query']['id'];return db[_0x601e('0x38')][_0x601e('0x39')](_0x3bc1b1);}return db[_0x409b58][_0x601e('0x3a')](_0x1eadea);})[_0x601e('0x16')](function(_0x620e8e){_0x3113a5[_0x601e('0xb')]=_0x620e8e[_0x601e('0xb')];_0x25ab37=_0x620e8e[_0x601e('0x21')];return rtq[_0x601e('0x50')](_0x1f479a,_0x49c838);})[_0x601e('0x16')](function(_0x44d0ec){_0x240fe7=_0x44d0ec[_0x601e('0x21')];return rtq[_0x601e('0x51')](_0x25ab37,_0x240fe7,_0x49c838,_0x1f479a[_0x601e('0x11')][_0x601e('0x28')]);})[_0x601e('0x16')](function(_0x588986){_0x3113a5[_0x601e('0x21')]=_0x588986;return _0x3113a5;})[_0x601e('0x16')](respondWithFilteredResult(_0x46111a,_0x1eadea))[_0x601e('0x43')](APIHandleError(_0x46111a));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index fb22e64..fa9cda5 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x11e972,_0x2ff647){var _0x595263=function(_0x593919){while(--_0x593919){_0x11e972['push'](_0x11e972['shift']());}};_0x595263(++_0x2ff647);}(_0x70e0,0x17b));var _0x070e=function(_0x3aecbb,_0x134d1d){_0x3aecbb=_0x3aecbb-0x0;var _0x3c5fe1=_0x70e0[_0x3aecbb];return _0x3c5fe1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3eae7f,_0x33064f){var _0x353603=function(_0x127d6b){while(--_0x127d6b){_0x3eae7f['push'](_0x3eae7f['shift']());}};_0x353603(++_0x33064f);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index efbe964..7fc4892 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.attributes.js +++ b/server/api/reportAgentPreview/reportAgentPreview.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacd6=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xacd6,0xef));var _0x6acd=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0xacd6[_0x42ebba];return _0x3fd2af;};'use strict';var Sequelize=require(_0x6acd('0x0'));module[_0x6acd('0x1')]={'state':{'type':Sequelize[_0x6acd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6acd('0x3')]},'scheduledat':{'type':Sequelize[_0x6acd('0x4')]},'uniqueid':{'type':Sequelize[_0x6acd('0x3')]},'starttime':{'type':Sequelize[_0x6acd('0x4')]},'responsetime':{'type':Sequelize[_0x6acd('0x4')]},'ringtime':{'type':Sequelize[_0x6acd('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6acd('0x3')]},'campaigntype':{'type':Sequelize[_0x6acd('0x3')]},'membername':{'type':Sequelize[_0x6acd('0x3')]}}; \ No newline at end of file +var _0xcd05=['STRING','sequelize','DATE'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xcd05,0x163));var _0x5cd0=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0xcd05[_0x4dab14];return _0xf41aa;};'use strict';var Sequelize=require(_0x5cd0('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5cd0('0x1')]},'uniqueid':{'type':Sequelize[_0x5cd0('0x2')]},'starttime':{'type':Sequelize[_0x5cd0('0x1')]},'responsetime':{'type':Sequelize[_0x5cd0('0x1')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5cd0('0x2')]},'campaigntype':{'type':Sequelize[_0x5cd0('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 75ae99b..08ae3ac 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.model.js +++ b/server/api/reportAgentPreview/reportAgentPreview.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbea0=['path','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3303c8,_0x168a17){var _0x41f949=function(_0xb618ec){while(--_0xb618ec){_0x3303c8['push'](_0x3303c8['shift']());}};_0x41f949(++_0x168a17);}(_0xbea0,0x1b5));var _0x0bea=function(_0x488fe8,_0x31b059){_0x488fe8=_0x488fe8-0x0;var _0x3122fe=_0xbea0[_0x488fe8];return _0x3122fe;};'use strict';var _=require(_0x0bea('0x0'));var util=require(_0x0bea('0x1'));var logger=require(_0x0bea('0x2'))(_0x0bea('0x3'));var moment=require(_0x0bea('0x4'));var BPromise=require(_0x0bea('0x5'));var rp=require(_0x0bea('0x6'));var fs=require('fs');var path=require(_0x0bea('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0bea('0x8'));module[_0x0bea('0x9')]=function(_0xbe3eec,_0x235a6b){return _0xbe3eec[_0x0bea('0xa')]('ReportAgentPreview',attributes,{'tableName':_0x0bea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe34a=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x150711,_0x589172){var _0x4f24f5=function(_0x45c8c5){while(--_0x45c8c5){_0x150711['push'](_0x150711['shift']());}};_0x4f24f5(++_0x589172);}(_0xe34a,0x8e));var _0xae34=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0xe34a[_0x5ecadc];return _0x565037;};'use strict';var _=require(_0xae34('0x0'));var util=require(_0xae34('0x1'));var logger=require(_0xae34('0x2'))('api');var moment=require(_0xae34('0x3'));var BPromise=require(_0xae34('0x4'));var rp=require(_0xae34('0x5'));var fs=require('fs');var path=require(_0xae34('0x6'));var rimraf=require('rimraf');var config=require(_0xae34('0x7'));var attributes=require(_0xae34('0x8'));module['exports']=function(_0x23744c,_0x549b76){return _0x23744c[_0xae34('0x9')](_0xae34('0xa'),attributes,{'tableName':_0xae34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index a5ffa81..369d422 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.rpc.js +++ b/server/api/reportAgentPreview/reportAgentPreview.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08f5=['error','code','message','result','catch','ReportAgentPreview','create','options','raw','then','CreateReportAgentPreview','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x08f5,0x119));var _0x508f=function(_0x574162,_0x2425ea){_0x574162=_0x574162-0x0;var _0x39c245=_0x08f5[_0x574162];return _0x39c245;};'use strict';var _=require(_0x508f('0x0'));var util=require(_0x508f('0x1'));var moment=require('moment');var BPromise=require(_0x508f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x508f('0x3'));var db=require(_0x508f('0x4'))['db'];var utils=require(_0x508f('0x5'));var logger=require(_0x508f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x508f('0x7'));var client=jayson[_0x508f('0x8')][_0x508f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6b8efe,_0x33f775,_0x86fb83){return new BPromise(function(_0x3300eb,_0x4aa4ac){return client[_0x508f('0xa')](_0x6b8efe,_0x86fb83)['then'](function(_0x3c9a2f){logger[_0x508f('0xb')](_0x508f('0xc'),_0x33f775,'request\x20sent');logger[_0x508f('0xd')](_0x508f('0xe'),_0x33f775,_0x508f('0xf'),JSON['stringify'](_0x3c9a2f));if(_0x3c9a2f[_0x508f('0x10')]){if(_0x3c9a2f[_0x508f('0x10')][_0x508f('0x11')]===0x1f4){logger[_0x508f('0x10')](_0x508f('0xc'),_0x33f775,_0x3c9a2f[_0x508f('0x10')][_0x508f('0x12')]);return _0x4aa4ac(_0x3c9a2f[_0x508f('0x10')][_0x508f('0x12')]);}logger['error'](_0x508f('0xc'),_0x33f775,_0x3c9a2f[_0x508f('0x10')][_0x508f('0x12')]);return _0x3300eb(_0x3c9a2f[_0x508f('0x10')][_0x508f('0x12')]);}else{logger[_0x508f('0xb')](_0x508f('0xc'),_0x33f775,'request\x20sent');_0x3300eb(_0x3c9a2f[_0x508f('0x13')][_0x508f('0x12')]);}})[_0x508f('0x14')](function(_0x415d4c){logger[_0x508f('0x10')](_0x508f('0xc'),_0x33f775,_0x415d4c);_0x4aa4ac(_0x415d4c);});});}exports['CreateReportAgentPreview']=function(_0x44fbf7){var _0x4b5ea0=this;return new Promise(function(_0x1f676e,_0x4fded2){return db[_0x508f('0x15')][_0x508f('0x16')](_0x44fbf7['body'],{'raw':_0x44fbf7['options']?_0x44fbf7[_0x508f('0x17')][_0x508f('0x18')]===undefined?!![]:![]:!![]})[_0x508f('0x19')](function(_0x25632d){logger[_0x508f('0xb')]('CreateReportAgentPreview',_0x44fbf7);logger[_0x508f('0xd')](_0x508f('0x1a'),_0x44fbf7,JSON['stringify'](_0x25632d));_0x1f676e(_0x25632d);})[_0x508f('0x14')](function(_0x54c4d6){logger[_0x508f('0x10')](_0x508f('0x1a'),_0x54c4d6[_0x508f('0x12')],_0x44fbf7);_0x4fded2(_0x4b5ea0['error'](0x1f4,_0x54c4d6[_0x508f('0x12')]));});});}; \ No newline at end of file +var _0x2ac3=['info','debug','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x589bab,_0x46a0bf){var _0x50c677=function(_0x1a71a7){while(--_0x1a71a7){_0x589bab['push'](_0x589bab['shift']());}};_0x50c677(++_0x46a0bf);}(_0x2ac3,0x198));var _0x32ac=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x2ac3[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x32ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x32ac('0x1'));var rs=require(_0x32ac('0x2'));var fs=require('fs');var Redis=require(_0x32ac('0x3'));var db=require(_0x32ac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x32ac('0x5'))(_0x32ac('0x6'));var config=require(_0x32ac('0x7'));var jayson=require(_0x32ac('0x8'));var client=jayson['client'][_0x32ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c4115,_0x404a2b,_0x4a09c5){return new BPromise(function(_0x34caf4,_0x26c9c9){return client[_0x32ac('0xa')](_0x5c4115,_0x4a09c5)[_0x32ac('0xb')](function(_0x1b5e25){logger[_0x32ac('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x404a2b,'request\x20sent');logger[_0x32ac('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x404a2b,_0x32ac('0xe'),JSON[_0x32ac('0xf')](_0x1b5e25));if(_0x1b5e25[_0x32ac('0x10')]){if(_0x1b5e25[_0x32ac('0x10')][_0x32ac('0x11')]===0x1f4){logger['error'](_0x32ac('0x12'),_0x404a2b,_0x1b5e25[_0x32ac('0x10')][_0x32ac('0x13')]);return _0x26c9c9(_0x1b5e25[_0x32ac('0x10')][_0x32ac('0x13')]);}logger[_0x32ac('0x10')](_0x32ac('0x12'),_0x404a2b,_0x1b5e25['error'][_0x32ac('0x13')]);return _0x34caf4(_0x1b5e25['error']['message']);}else{logger['info'](_0x32ac('0x12'),_0x404a2b,_0x32ac('0xe'));_0x34caf4(_0x1b5e25[_0x32ac('0x14')][_0x32ac('0x13')]);}})[_0x32ac('0x15')](function(_0x4d620e){logger[_0x32ac('0x10')](_0x32ac('0x12'),_0x404a2b,_0x4d620e);_0x26c9c9(_0x4d620e);});});}exports['CreateReportAgentPreview']=function(_0xd64f28){var _0x4724d9=this;return new Promise(function(_0x21a0ef,_0x5700f7){return db[_0x32ac('0x16')][_0x32ac('0x17')](_0xd64f28[_0x32ac('0x18')],{'raw':_0xd64f28[_0x32ac('0x19')]?_0xd64f28[_0x32ac('0x19')][_0x32ac('0x1a')]===undefined?!![]:![]:!![]})[_0x32ac('0xb')](function(_0x510fb4){logger['info']('CreateReportAgentPreview',_0xd64f28);logger[_0x32ac('0xd')](_0x32ac('0x1b'),_0xd64f28,JSON[_0x32ac('0xf')](_0x510fb4));_0x21a0ef(_0x510fb4);})[_0x32ac('0x15')](function(_0x3c0368){logger[_0x32ac('0x10')]('CreateReportAgentPreview',_0x3c0368['message'],_0xd64f28);_0x5700f7(_0x4724d9['error'](0x1f4,_0x3c0368[_0x32ac('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 2646a2f..584cfd1 100644 --- a/server/api/rpc/index.js +++ b/server/api/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb857=['voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated'];(function(_0x144d3c,_0x1c8394){var _0x25af78=function(_0x477fd1){while(--_0x477fd1){_0x144d3c['push'](_0x144d3c['shift']());}};_0x25af78(++_0x1c8394);}(_0xb857,0x19b));var _0x7b85=function(_0x397756,_0x185bbd){_0x397756=_0x397756-0x0;var _0x1537c1=_0xb857[_0x397756];return _0x1537c1;};'use strict';var multer=require(_0x7b85('0x0'));var util=require(_0x7b85('0x1'));var path=require(_0x7b85('0x2'));var express=require('express');var router=express[_0x7b85('0x3')]();var auth=require(_0x7b85('0x4'));var controller=require(_0x7b85('0x5'));router[_0x7b85('0x6')](_0x7b85('0x7'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x9')]);router['get'](_0x7b85('0xa'),auth[_0x7b85('0x8')](),controller['voiceChannelMixMonitor']);router[_0x7b85('0x6')](_0x7b85('0xb'),auth['isAuthenticated'](),controller[_0x7b85('0xc')]);router[_0x7b85('0x6')]('/voice/queues',auth['isAuthenticated'](),controller[_0x7b85('0xd')]);router['get'](_0x7b85('0xe'),auth['isAuthenticated'](),controller[_0x7b85('0xf')]);router[_0x7b85('0x6')](_0x7b85('0x10'),auth['isAuthenticated'](),controller['mailQueues']);router[_0x7b85('0x6')](_0x7b85('0x11'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x12')]);router[_0x7b85('0x6')](_0x7b85('0x13'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x14')]);router[_0x7b85('0x6')](_0x7b85('0x15'),auth['isAuthenticated'](),controller[_0x7b85('0x16')]);router['get'](_0x7b85('0x17'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x18')]);router[_0x7b85('0x6')](_0x7b85('0x19'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x1a')]);router[_0x7b85('0x6')]('/voice/queues/preview/:id',auth[_0x7b85('0x8')](),controller[_0x7b85('0x1b')]);router[_0x7b85('0x6')](_0x7b85('0x1c'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x1d')]);router[_0x7b85('0x6')](_0x7b85('0x1e'),auth['isAuthenticated'](),controller[_0x7b85('0x1f')]);router[_0x7b85('0x6')](_0x7b85('0x20'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x21')]);router[_0x7b85('0x6')](_0x7b85('0x22'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x23')]);router['get'](_0x7b85('0x24'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x25')]);router[_0x7b85('0x26')]('/voice/queues/:id',auth[_0x7b85('0x8')](),controller[_0x7b85('0x27')]);router[_0x7b85('0x6')](_0x7b85('0x28'),auth[_0x7b85('0x8')](),controller['outbound']);router['get']('/outbound/channels',auth[_0x7b85('0x8')](),controller[_0x7b85('0x29')]);router[_0x7b85('0x6')](_0x7b85('0x2a'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x2b')]);router[_0x7b85('0x26')](_0x7b85('0x2c'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x2d')]);router['get'](_0x7b85('0x2e'),auth[_0x7b85('0x8')](),controller['telephones']);router[_0x7b85('0x6')](_0x7b85('0x2f'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x30')]);router[_0x7b85('0x6')]('/campaigns',auth['isAuthenticated'](),controller[_0x7b85('0x31')]);router[_0x7b85('0x6')](_0x7b85('0x32'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x33')]);router[_0x7b85('0x6')](_0x7b85('0x34'),auth[_0x7b85('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x7b85('0x6')](_0x7b85('0x35'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x36')]);router[_0x7b85('0x6')](_0x7b85('0x37'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x38')]);router[_0x7b85('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x7b85('0x8')](),controller[_0x7b85('0x39')]);router[_0x7b85('0x6')]('/sms/queues/waitinginteractions',auth[_0x7b85('0x8')](),controller[_0x7b85('0x3a')]);router[_0x7b85('0x6')](_0x7b85('0x3b'),auth[_0x7b85('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0x7b85('0x6')](_0x7b85('0x3c'),auth['isAuthenticated'](),controller[_0x7b85('0x3d')]);router['post']('/mail/queues/:id/notify',auth[_0x7b85('0x8')](),controller[_0x7b85('0x3e')]('mail'));router[_0x7b85('0x6')](_0x7b85('0x3f'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x40')]);router[_0x7b85('0x41')](_0x7b85('0x42'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x3e')](_0x7b85('0x43')));router[_0x7b85('0x6')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x7b85('0x44')]);router[_0x7b85('0x41')](_0x7b85('0x45'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x3e')](_0x7b85('0x46')));router[_0x7b85('0x6')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x7b85('0x47')]);router[_0x7b85('0x41')](_0x7b85('0x48'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x3e')](_0x7b85('0x49')));router[_0x7b85('0x6')](_0x7b85('0x4a'),auth[_0x7b85('0x8')](),controller['showOpenchannelQueues']);router[_0x7b85('0x41')](_0x7b85('0x4b'),auth['isAuthenticated'](),controller['queueNotify'](_0x7b85('0x4c')));router[_0x7b85('0x41')](_0x7b85('0x4d'),auth[_0x7b85('0x8')](),controller['queueNotify']('whatsapp'));router[_0x7b85('0x6')](_0x7b85('0x4e'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x4f')]);router['get'](_0x7b85('0x50'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x51')]);router[_0x7b85('0x41')](_0x7b85('0x52'),auth['isAuthenticated'](),controller[_0x7b85('0x53')]);module['exports']=router; \ No newline at end of file +var _0xefa1=['/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xefa1,0xc7));var _0x1efa=function(_0x21b30a,_0x5aafbd){_0x21b30a=_0x21b30a-0x0;var _0x2f8816=_0xefa1[_0x21b30a];return _0x2f8816;};'use strict';var multer=require(_0x1efa('0x0'));var util=require(_0x1efa('0x1'));var path=require(_0x1efa('0x2'));var express=require(_0x1efa('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x1efa('0x4')]('/voice/channels',auth[_0x1efa('0x5')](),controller['voiceChannels']);router['get'](_0x1efa('0x6'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router['get'](_0x1efa('0x7'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x8')]);router[_0x1efa('0x4')]('/voice/queues',auth[_0x1efa('0x5')](),controller[_0x1efa('0x9')]);router[_0x1efa('0x4')](_0x1efa('0xa'),auth[_0x1efa('0x5')](),controller[_0x1efa('0xb')]);router[_0x1efa('0x4')](_0x1efa('0xc'),auth[_0x1efa('0x5')](),controller[_0x1efa('0xd')]);router[_0x1efa('0x4')]('/mail/accounts',auth[_0x1efa('0x5')](),controller[_0x1efa('0xe')]);router[_0x1efa('0x4')](_0x1efa('0xf'),auth['isAuthenticated'](),controller[_0x1efa('0x10')]);router[_0x1efa('0x4')](_0x1efa('0x11'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x12')]);router[_0x1efa('0x4')](_0x1efa('0x13'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get']('/fax/queues',auth[_0x1efa('0x5')](),controller[_0x1efa('0x14')]);router[_0x1efa('0x4')](_0x1efa('0x15'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x16')]);router['get'](_0x1efa('0x17'),auth['isAuthenticated'](),controller[_0x1efa('0x18')]);router[_0x1efa('0x4')]('/voice/queues/channels/:uniqueid',auth[_0x1efa('0x5')](),controller[_0x1efa('0x19')]);router[_0x1efa('0x4')](_0x1efa('0x1a'),auth[_0x1efa('0x5')](),controller['voiceQueuesChannelHangup']);router[_0x1efa('0x4')](_0x1efa('0x1b'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x1c')]);router['get'](_0x1efa('0x1d'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x1e')]);router[_0x1efa('0x1f')]('/voice/queues/:id',auth[_0x1efa('0x5')](),controller[_0x1efa('0x20')]);router[_0x1efa('0x4')](_0x1efa('0x21'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x22')]);router[_0x1efa('0x4')](_0x1efa('0x23'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x24')]);router[_0x1efa('0x4')](_0x1efa('0x25'),auth['isAuthenticated'](),controller[_0x1efa('0x26')]);router[_0x1efa('0x1f')](_0x1efa('0x27'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x28')]);router[_0x1efa('0x4')](_0x1efa('0x29'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x2a')]);router[_0x1efa('0x4')](_0x1efa('0x2b'),auth[_0x1efa('0x5')](),controller['trunks']);router['get'](_0x1efa('0x2c'),auth[_0x1efa('0x5')](),controller['campaigns']);router[_0x1efa('0x4')](_0x1efa('0x2d'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x2e')]);router['get'](_0x1efa('0x2f'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x30')]);router[_0x1efa('0x4')](_0x1efa('0x31'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x32')]);router[_0x1efa('0x4')](_0x1efa('0x33'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x34')]);router[_0x1efa('0x4')](_0x1efa('0x35'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x36')]);router[_0x1efa('0x4')]('/sms/queues/waitinginteractions',auth[_0x1efa('0x5')](),controller[_0x1efa('0x37')]);router[_0x1efa('0x4')](_0x1efa('0x38'),auth[_0x1efa('0x5')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x1efa('0x39'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x3a')]);router['post'](_0x1efa('0x3b'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x3c')](_0x1efa('0x3d')));router['get'](_0x1efa('0x3e'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x3f')]);router[_0x1efa('0x40')](_0x1efa('0x41'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x3c')]('chat'));router['get'](_0x1efa('0x42'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x43')]);router[_0x1efa('0x40')]('/fax/queues/:id/notify',auth[_0x1efa('0x5')](),controller[_0x1efa('0x3c')](_0x1efa('0x44')));router[_0x1efa('0x4')](_0x1efa('0x45'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x46')]);router[_0x1efa('0x40')](_0x1efa('0x47'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x3c')](_0x1efa('0x48')));router[_0x1efa('0x4')](_0x1efa('0x49'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x4a')]);router[_0x1efa('0x40')](_0x1efa('0x4b'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x3c')](_0x1efa('0x4c')));router[_0x1efa('0x40')](_0x1efa('0x4d'),auth[_0x1efa('0x5')](),controller['queueNotify'](_0x1efa('0x4e')));router['get'](_0x1efa('0x4f'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x50')]);router[_0x1efa('0x4')](_0x1efa('0x51'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x52')]);router[_0x1efa('0x40')](_0x1efa('0x53'),auth[_0x1efa('0x5')](),controller[_0x1efa('0x54')]);module[_0x1efa('0x55')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 1b23a08..970785f 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x49c33c,_0x5b5c07){var _0x4e1cd6=function(_0x95803c){while(--_0x95803c){_0x49c33c['push'](_0x49c33c['shift']());}};_0x4e1cd6(++_0x5b5c07);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3a69d5c..1406c02 100644 --- a/server/api/schedule/index.js +++ b/server/api/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b0a=['/:id/run','run','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','/:id','isAuthenticated','show'];(function(_0x2a2f0d,_0x56b22a){var _0x36809c=function(_0x21b0b1){while(--_0x21b0b1){_0x2a2f0d['push'](_0x2a2f0d['shift']());}};_0x36809c(++_0x56b22a);}(_0x8b0a,0x14b));var _0xa8b0=function(_0x39183d,_0x51345b){_0x39183d=_0x39183d-0x0;var _0x1d83ab=_0x8b0a[_0x39183d];return _0x1d83ab;};'use strict';var multer=require(_0xa8b0('0x0'));var util=require(_0xa8b0('0x1'));var path=require(_0xa8b0('0x2'));var timeout=require(_0xa8b0('0x3'));var express=require('express');var router=express[_0xa8b0('0x4')]();var fs_extra=require(_0xa8b0('0x5'));var auth=require(_0xa8b0('0x6'));var interaction=require(_0xa8b0('0x7'));var config=require(_0xa8b0('0x8'));var controller=require(_0xa8b0('0x9'));router[_0xa8b0('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa8b0('0xa')](_0xa8b0('0xb'),auth[_0xa8b0('0xc')](),controller[_0xa8b0('0xd')]);router['get'](_0xa8b0('0xe'),auth[_0xa8b0('0xc')](),controller[_0xa8b0('0xf')]);router[_0xa8b0('0x10')]('/',auth['isAuthenticated'](),controller[_0xa8b0('0x11')]);router[_0xa8b0('0x12')]('/:id',auth[_0xa8b0('0xc')](),controller[_0xa8b0('0x13')]);router[_0xa8b0('0x14')]('/:id',auth[_0xa8b0('0xc')](),controller[_0xa8b0('0x15')]);module[_0xa8b0('0x16')]=router; \ No newline at end of file +var _0xd4b1=['fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x261f0a,_0x459261){var _0x39bdd5=function(_0x15d10f){while(--_0x15d10f){_0x261f0a['push'](_0x261f0a['shift']());}};_0x39bdd5(++_0x459261);}(_0xd4b1,0xec));var _0x1d4b=function(_0x4c7323,_0x14b207){_0x4c7323=_0x4c7323-0x0;var _0xb09ac5=_0xd4b1[_0x4c7323];return _0xb09ac5;};'use strict';var multer=require('multer');var util=require(_0x1d4b('0x0'));var path=require('path');var timeout=require(_0x1d4b('0x1'));var express=require(_0x1d4b('0x2'));var router=express[_0x1d4b('0x3')]();var fs_extra=require(_0x1d4b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1d4b('0x5'));var config=require(_0x1d4b('0x6'));var controller=require(_0x1d4b('0x7'));router[_0x1d4b('0x8')]('/',auth[_0x1d4b('0x9')](),controller[_0x1d4b('0xa')]);router[_0x1d4b('0x8')](_0x1d4b('0xb'),auth[_0x1d4b('0x9')](),controller[_0x1d4b('0xc')]);router['get'](_0x1d4b('0xd'),auth['isAuthenticated'](),controller[_0x1d4b('0xe')]);router[_0x1d4b('0xf')]('/',auth[_0x1d4b('0x9')](),controller[_0x1d4b('0x10')]);router['put'](_0x1d4b('0xb'),auth[_0x1d4b('0x9')](),controller[_0x1d4b('0x11')]);router[_0x1d4b('0x12')](_0x1d4b('0xb'),auth[_0x1d4b('0x9')](),controller[_0x1d4b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 2ec6f46..652d27c 100644 --- a/server/api/schedule/schedule.attributes.js +++ b/server/api/schedule/schedule.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e4d=['default','TEXT','sequelize','exports','STRING','DATE','quarters','months','weeks','days','hours','ENUM','pdf','xlsx','custom'];(function(_0x4446b3,_0x170b3a){var _0x429de5=function(_0x1a8a83){while(--_0x1a8a83){_0x4446b3['push'](_0x4446b3['shift']());}};_0x429de5(++_0x170b3a);}(_0x7e4d,0xb6));var _0xd7e4=function(_0x1e8066,_0x2916f5){_0x1e8066=_0x1e8066-0x0;var _0x45760f=_0x7e4d[_0x1e8066];return _0x45760f;};'use strict';var Sequelize=require(_0xd7e4('0x0'));module[_0xd7e4('0x1')]={'name':{'type':Sequelize[_0xd7e4('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd7e4('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xd7e4('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xd7e4('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xd7e4('0x4'),_0xd7e4('0x5'),_0xd7e4('0x6'),_0xd7e4('0x7'),_0xd7e4('0x8'),'minutes'),'allowNull':![],'defaultValue':_0xd7e4('0x7')},'output':{'type':Sequelize[_0xd7e4('0x9')]('csv',_0xd7e4('0xa'),_0xd7e4('0xb')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xd7e4('0xc'),_0xd7e4('0xd')),'allowNull':![],'defaultValue':_0xd7e4('0xc')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xd7e4('0xe')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe068=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER','years','quarters','weeks','hours','minutes','days','ENUM','csv','pdf','custom','default','TEXT'];(function(_0x1fb94f,_0x2812e7){var _0x2a1bd0=function(_0x591ce1){while(--_0x591ce1){_0x1fb94f['push'](_0x1fb94f['shift']());}};_0x2a1bd0(++_0x2812e7);}(_0xe068,0xd9));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8e06('0x0'));module[_0x8e06('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8e06('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8e06('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x8e06('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8e06('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8e06('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x8e06('0x5'),_0x8e06('0x6'),'months',_0x8e06('0x7'),'days',_0x8e06('0x8'),_0x8e06('0x9')),'allowNull':![],'defaultValue':_0x8e06('0xa')},'output':{'type':Sequelize[_0x8e06('0xb')](_0x8e06('0xc'),_0x8e06('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0x8e06('0xc')},'type':{'type':Sequelize[_0x8e06('0xb')](_0x8e06('0xe'),_0x8e06('0xf')),'allowNull':![],'defaultValue':_0x8e06('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x8e06('0x2')]},'cc':{'type':Sequelize[_0x8e06('0x10')]},'bcc':{'type':Sequelize[_0x8e06('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x8e06('0x11')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index ce0c289..cec5e77 100644 --- a/server/api/schedule/schedule.controller.js +++ b/server/api/schedule/schedule.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0be4=['destroy','Scheduler','UserProfileResource','end','name','send','index','map','fieldName','type','model','keys','query','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Schedule','rows','catch','show','params','rawAttributes','filters','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then'];(function(_0xdd3240,_0x24b3ae){var _0x3af090=function(_0x36f941){while(--_0x36f941){_0xdd3240['push'](_0xdd3240['shift']());}};_0x3af090(++_0x24b3ae);}(_0x0be4,0x137));var _0x40be=function(_0x31f1b9,_0x583476){_0x31f1b9=_0x31f1b9-0x0;var _0x14559a=_0x0be4[_0x31f1b9];return _0x14559a;};'use strict';var emlformat=require(_0x40be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x40be('0x1'));var jsonpatch=require(_0x40be('0x2'));var rp=require(_0x40be('0x3'));var moment=require('moment');var BPromise=require(_0x40be('0x4'));var Mustache=require(_0x40be('0x5'));var util=require(_0x40be('0x6'));var path=require(_0x40be('0x7'));var sox=require(_0x40be('0x8'));var csv=require(_0x40be('0x9'));var ejs=require(_0x40be('0xa'));var fs=require('fs');var fs_extra=require(_0x40be('0xb'));var _=require(_0x40be('0xc'));var squel=require(_0x40be('0xd'));var crypto=require(_0x40be('0xe'));var jsforce=require(_0x40be('0xf'));var deskjs=require(_0x40be('0x10'));var toCsv=require(_0x40be('0x9'));var querystring=require(_0x40be('0x11'));var Papa=require(_0x40be('0x12'));var Redis=require(_0x40be('0x13'));var authService=require(_0x40be('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x40be('0x15'));var hardwareService=require(_0x40be('0x16'));var logger=require(_0x40be('0x17'))(_0x40be('0x18'));var utils=require(_0x40be('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x40be('0x1a'));var db=require(_0x40be('0x1b'))['db'];function respondWithStatusCode(_0x1ab50e,_0x521f9e){_0x521f9e=_0x521f9e||0xcc;return function(_0x2a94ca){if(_0x2a94ca){return _0x1ab50e[_0x40be('0x1c')](_0x521f9e);}return _0x1ab50e[_0x40be('0x1d')](_0x521f9e)['end']();};}function respondWithResult(_0x2ec118,_0x161f9d){_0x161f9d=_0x161f9d||0xc8;return function(_0x1132ab){if(_0x1132ab){return _0x2ec118[_0x40be('0x1d')](_0x161f9d)['json'](_0x1132ab);}};}function respondWithFilteredResult(_0x3dc330,_0x2a5531){return function(_0x184a3c){if(_0x184a3c){var _0x1c7d80=typeof _0x2a5531[_0x40be('0x1e')]===_0x40be('0x1f')&&typeof _0x2a5531[_0x40be('0x20')]===_0x40be('0x1f');var _0x3b0f9b=_0x184a3c[_0x40be('0x21')];var _0x4f63a3=_0x1c7d80?0x0:_0x2a5531['offset'];var _0x1a74d8=_0x1c7d80?_0x184a3c[_0x40be('0x21')]:_0x2a5531[_0x40be('0x1e')]+_0x2a5531[_0x40be('0x20')];var _0x39a74c;if(_0x1a74d8>=_0x3b0f9b){_0x1a74d8=_0x3b0f9b;_0x39a74c=0xc8;}else{_0x39a74c=0xce;}_0x3dc330[_0x40be('0x1d')](_0x39a74c);return _0x3dc330[_0x40be('0x22')](_0x40be('0x23'),_0x4f63a3+'-'+_0x1a74d8+'/'+_0x3b0f9b)[_0x40be('0x24')](_0x184a3c);}return null;};}function patchUpdates(_0x4234a7){return function(_0x176e12){try{jsonpatch[_0x40be('0x25')](_0x176e12,_0x4234a7,!![]);}catch(_0x3bbfe1){return BPromise[_0x40be('0x26')](_0x3bbfe1);}return _0x176e12[_0x40be('0x27')]();};}function saveUpdates(_0x39bd80,_0x16dee8){return function(_0x477ff8){if(_0x477ff8){return _0x477ff8['update'](_0x39bd80)[_0x40be('0x28')](function(_0x2bef6d){return _0x2bef6d;});}return null;};}function removeEntity(_0x5682b9,_0x5a1f49){return function(_0x7cea35){if(_0x7cea35){return _0x7cea35[_0x40be('0x29')]()[_0x40be('0x28')](function(){var _0x2da4d1=_0x7cea35['get']({'plain':!![]});var _0x21e250=_0x40be('0x2a');return db[_0x40be('0x2b')][_0x40be('0x29')]({'where':{'type':_0x21e250,'resourceId':_0x2da4d1['id']}})[_0x40be('0x28')](function(){return _0x7cea35;});})[_0x40be('0x28')](function(){_0x5682b9[_0x40be('0x1d')](0xcc)[_0x40be('0x2c')]();});}};}function handleEntityNotFound(_0x3ac3bc,_0x460fbe){return function(_0x4989e9){if(!_0x4989e9){_0x3ac3bc[_0x40be('0x1c')](0x194);}return _0x4989e9;};}function handleError(_0x33567f,_0x52be4e){_0x52be4e=_0x52be4e||0x1f4;return function(_0x234c8a){logger['error'](_0x234c8a['stack']);if(_0x234c8a[_0x40be('0x2d')]){delete _0x234c8a[_0x40be('0x2d')];}_0x33567f[_0x40be('0x1d')](_0x52be4e)[_0x40be('0x2e')](_0x234c8a);};}exports[_0x40be('0x2f')]=function(_0x2e183d,_0x36793d){var _0x15c96c={},_0x35269f={},_0x197f89={'count':0x0,'rows':[]};var _0x469906=_[_0x40be('0x30')](db['Schedule']['rawAttributes'],function(_0x4e75ad){return{'name':_0x4e75ad[_0x40be('0x31')],'type':_0x4e75ad[_0x40be('0x32')]['key']};});_0x35269f[_0x40be('0x33')]=_['map'](_0x469906,_0x40be('0x2d'));_0x35269f['query']=_[_0x40be('0x34')](_0x2e183d[_0x40be('0x35')]);_0x35269f['filters']=_['intersection'](_0x35269f['model'],_0x35269f[_0x40be('0x35')]);_0x15c96c['attributes']=_[_0x40be('0x36')](_0x35269f[_0x40be('0x33')],qs[_0x40be('0x37')](_0x2e183d[_0x40be('0x35')][_0x40be('0x37')]));_0x15c96c[_0x40be('0x38')]=_0x15c96c[_0x40be('0x38')]['length']?_0x15c96c[_0x40be('0x38')]:_0x35269f['model'];if(!_0x2e183d[_0x40be('0x35')]['hasOwnProperty'](_0x40be('0x39'))){_0x15c96c[_0x40be('0x20')]=qs[_0x40be('0x20')](_0x2e183d[_0x40be('0x35')][_0x40be('0x20')]);_0x15c96c['offset']=qs['offset'](_0x2e183d[_0x40be('0x35')][_0x40be('0x1e')]);}_0x15c96c[_0x40be('0x3a')]=qs[_0x40be('0x3b')](_0x2e183d[_0x40be('0x35')][_0x40be('0x3b')]);_0x15c96c[_0x40be('0x3c')]=qs['filters'](_[_0x40be('0x3d')](_0x2e183d['query'],_0x35269f['filters']),_0x469906);if(_0x2e183d[_0x40be('0x35')][_0x40be('0x3e')]){_0x15c96c['where']=_[_0x40be('0x3f')](_0x15c96c[_0x40be('0x3c')],{'$or':_[_0x40be('0x30')](_0x469906,function(_0x30b0e5){if(_0x30b0e5[_0x40be('0x32')]!==_0x40be('0x40')){var _0x2cb39a={};_0x2cb39a[_0x30b0e5[_0x40be('0x2d')]]={'$like':'%'+_0x2e183d['query'][_0x40be('0x3e')]+'%'};return _0x2cb39a;}})});}_0x15c96c=_['merge']({},_0x15c96c,_0x2e183d[_0x40be('0x41')]);var _0x73a16e={'where':_0x15c96c[_0x40be('0x3c')]};return db['Schedule'][_0x40be('0x21')](_0x73a16e)[_0x40be('0x28')](function(_0x1c5afe){_0x197f89[_0x40be('0x21')]=_0x1c5afe;if(_0x2e183d[_0x40be('0x35')][_0x40be('0x42')]){_0x15c96c[_0x40be('0x43')]=[{'all':!![]}];}return db[_0x40be('0x44')]['findAll'](_0x15c96c);})[_0x40be('0x28')](function(_0x344be6){_0x197f89[_0x40be('0x45')]=_0x344be6;return _0x197f89;})['then'](respondWithFilteredResult(_0x36793d,_0x15c96c))[_0x40be('0x46')](handleError(_0x36793d,null));};exports[_0x40be('0x47')]=function(_0x398cd2,_0x56162b){var _0x1a5958={'raw':![],'where':{'id':_0x398cd2[_0x40be('0x48')]['id']}},_0x39bc67={};_0x39bc67[_0x40be('0x33')]=_[_0x40be('0x34')](db['Schedule'][_0x40be('0x49')]);_0x39bc67[_0x40be('0x35')]=_['keys'](_0x398cd2[_0x40be('0x35')]);_0x39bc67[_0x40be('0x4a')]=_[_0x40be('0x36')](_0x39bc67['model'],_0x39bc67[_0x40be('0x35')]);_0x1a5958['attributes']=_[_0x40be('0x36')](_0x39bc67['model'],qs['fields'](_0x398cd2[_0x40be('0x35')][_0x40be('0x37')]));_0x1a5958[_0x40be('0x38')]=_0x1a5958[_0x40be('0x38')][_0x40be('0x4b')]?_0x1a5958[_0x40be('0x38')]:_0x39bc67[_0x40be('0x33')];if(_0x398cd2[_0x40be('0x35')]['includeAll']){_0x1a5958[_0x40be('0x43')]=[{'all':!![]}];}_0x1a5958=_[_0x40be('0x3f')]({},_0x1a5958,_0x398cd2[_0x40be('0x41')]);return db['Schedule']['find'](_0x1a5958)[_0x40be('0x28')](handleEntityNotFound(_0x56162b,null))[_0x40be('0x28')](respondWithResult(_0x56162b,null))[_0x40be('0x46')](handleError(_0x56162b,null));};exports[_0x40be('0x4c')]=function(_0x1d7140,_0x5e14b9){return db['Schedule'][_0x40be('0x4c')](_0x1d7140['body'],{})[_0x40be('0x28')](function(_0x573f5f){var _0x33a2dd=_0x1d7140[_0x40be('0x4d')][_0x40be('0x4e')]({'plain':!![]});if(!_0x33a2dd)throw new Error(_0x40be('0x4f'));if(_0x33a2dd['role']===_0x40be('0x4d')){var _0xd5fca1=_0x573f5f[_0x40be('0x4e')]({'plain':!![]});var _0x4916f3='Scheduler';return db[_0x40be('0x50')][_0x40be('0x51')]({'where':{'name':_0x4916f3,'userProfileId':_0x33a2dd['userProfileId']},'raw':!![]})['then'](function(_0x8fa7fc){if(_0x8fa7fc&&_0x8fa7fc[_0x40be('0x52')]===0x0){return db[_0x40be('0x2b')][_0x40be('0x4c')]({'name':_0xd5fca1['name'],'resourceId':_0xd5fca1['id'],'type':_0x8fa7fc[_0x40be('0x2d')],'sectionId':_0x8fa7fc['id']},{})[_0x40be('0x28')](function(){return _0x573f5f;});}else{return _0x573f5f;}})[_0x40be('0x46')](function(_0x19f6d0){logger[_0x40be('0x53')](_0x40be('0x54'),_0x19f6d0);throw _0x19f6d0;});}return _0x573f5f;})['then'](respondWithResult(_0x5e14b9,0xc9))[_0x40be('0x46')](handleError(_0x5e14b9,null));};exports[_0x40be('0x55')]=function(_0x22d3cd,_0x41fd1f){if(_0x22d3cd[_0x40be('0x56')]['id']){delete _0x22d3cd[_0x40be('0x56')]['id'];}return db['Schedule']['find']({'where':{'id':_0x22d3cd[_0x40be('0x48')]['id']}})['then'](handleEntityNotFound(_0x41fd1f,null))[_0x40be('0x28')](saveUpdates(_0x22d3cd['body'],null))[_0x40be('0x28')](respondWithResult(_0x41fd1f,null))['catch'](handleError(_0x41fd1f,null));};exports['destroy']=function(_0x411a53,_0x5c3719){return db[_0x40be('0x44')][_0x40be('0x51')]({'where':{'id':_0x411a53[_0x40be('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c3719,null))['then'](removeEntity(_0x5c3719,null))[_0x40be('0x46')](handleError(_0x5c3719,null));};exports[_0x40be('0x57')]=function(_0x3dccb6,_0x330f72,_0x32d236){var _0x499319=require('../../config/schedule');return db[_0x40be('0x44')][_0x40be('0x51')]({'where':{'id':_0x3dccb6[_0x40be('0x48')]['id']},'raw':!![]})[_0x40be('0x28')](handleEntityNotFound(_0x330f72,null))['then'](function(){_0x499319[_0x40be('0x57')](_0x3dccb6['params']['id']);})[_0x40be('0x28')](respondWithStatusCode(_0x330f72,null))[_0x40be('0x46')](handleError(_0x330f72,null));}; \ No newline at end of file +var _0xaa10=['fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','Schedule','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','../../config/schedule','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','end','sendStatus','error','stack','name','map','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x298b3,_0x2c7ce8){var _0x2d76dd=function(_0x554cf1){while(--_0x554cf1){_0x298b3['push'](_0x298b3['shift']());}};_0x2d76dd(++_0x2c7ce8);}(_0xaa10,0x70));var _0x0aa1=function(_0x23f9e5,_0x151725){_0x23f9e5=_0x23f9e5-0x0;var _0x566273=_0xaa10[_0x23f9e5];return _0x566273;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0aa1('0x0'));var zipdir=require(_0x0aa1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0aa1('0x2'));var moment=require(_0x0aa1('0x3'));var BPromise=require(_0x0aa1('0x4'));var Mustache=require(_0x0aa1('0x5'));var util=require('util');var path=require(_0x0aa1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0aa1('0x7'));var crypto=require(_0x0aa1('0x8'));var jsforce=require(_0x0aa1('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0aa1('0xa'));var Papa=require(_0x0aa1('0xb'));var Redis=require(_0x0aa1('0xc'));var authService=require(_0x0aa1('0xd'));var qs=require(_0x0aa1('0xe'));var as=require(_0x0aa1('0xf'));var hardwareService=require(_0x0aa1('0x10'));var logger=require(_0x0aa1('0x11'))(_0x0aa1('0x12'));var utils=require(_0x0aa1('0x13'));var config=require(_0x0aa1('0x14'));var licenseUtil=require(_0x0aa1('0x15'));var db=require(_0x0aa1('0x16'))['db'];function respondWithStatusCode(_0x279a86,_0x5c977f){_0x5c977f=_0x5c977f||0xcc;return function(_0x10cc43){if(_0x10cc43){return _0x279a86['sendStatus'](_0x5c977f);}return _0x279a86[_0x0aa1('0x17')](_0x5c977f)['end']();};}function respondWithResult(_0x2fcc9a,_0x3e7927){_0x3e7927=_0x3e7927||0xc8;return function(_0x40f321){if(_0x40f321){return _0x2fcc9a['status'](_0x3e7927)[_0x0aa1('0x18')](_0x40f321);}};}function respondWithFilteredResult(_0x1f6d9d,_0x2d55bd){return function(_0x110aa8){if(_0x110aa8){var _0x99af9f=typeof _0x2d55bd['offset']===_0x0aa1('0x19')&&typeof _0x2d55bd[_0x0aa1('0x1a')]===_0x0aa1('0x19');var _0x59b6f2=_0x110aa8[_0x0aa1('0x1b')];var _0xdd3e38=_0x99af9f?0x0:_0x2d55bd['offset'];var _0x9be291=_0x99af9f?_0x110aa8[_0x0aa1('0x1b')]:_0x2d55bd[_0x0aa1('0x1c')]+_0x2d55bd[_0x0aa1('0x1a')];var _0x92de7b;if(_0x9be291>=_0x59b6f2){_0x9be291=_0x59b6f2;_0x92de7b=0xc8;}else{_0x92de7b=0xce;}_0x1f6d9d[_0x0aa1('0x17')](_0x92de7b);return _0x1f6d9d[_0x0aa1('0x1d')](_0x0aa1('0x1e'),_0xdd3e38+'-'+_0x9be291+'/'+_0x59b6f2)['json'](_0x110aa8);}return null;};}function patchUpdates(_0x330f10){return function(_0x49335d){try{jsonpatch[_0x0aa1('0x1f')](_0x49335d,_0x330f10,!![]);}catch(_0x1b87d2){return BPromise[_0x0aa1('0x20')](_0x1b87d2);}return _0x49335d['save']();};}function saveUpdates(_0x43181c,_0x177339){return function(_0x334ef1){if(_0x334ef1){return _0x334ef1[_0x0aa1('0x21')](_0x43181c)[_0x0aa1('0x22')](function(_0x1506bc){return _0x1506bc;});}return null;};}function removeEntity(_0x567a57,_0x1ea1f3){return function(_0x5abe5a){if(_0x5abe5a){return _0x5abe5a[_0x0aa1('0x23')]()[_0x0aa1('0x22')](function(){var _0x26414a=_0x5abe5a[_0x0aa1('0x24')]({'plain':!![]});var _0x17e93f=_0x0aa1('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x17e93f,'resourceId':_0x26414a['id']}})[_0x0aa1('0x22')](function(){return _0x5abe5a;});})[_0x0aa1('0x22')](function(){_0x567a57[_0x0aa1('0x17')](0xcc)[_0x0aa1('0x26')]();});}};}function handleEntityNotFound(_0x51187e,_0x490a7e){return function(_0x2a55af){if(!_0x2a55af){_0x51187e[_0x0aa1('0x27')](0x194);}return _0x2a55af;};}function handleError(_0x27e6a5,_0x36ff1e){_0x36ff1e=_0x36ff1e||0x1f4;return function(_0x10ac01){logger[_0x0aa1('0x28')](_0x10ac01[_0x0aa1('0x29')]);if(_0x10ac01['name']){delete _0x10ac01[_0x0aa1('0x2a')];}_0x27e6a5[_0x0aa1('0x17')](_0x36ff1e)['send'](_0x10ac01);};}exports['index']=function(_0x353bed,_0x3f1747){var _0x500ac8={},_0x59ae7f={},_0x4fa4a7={'count':0x0,'rows':[]};var _0x1c883e=_[_0x0aa1('0x2b')](db['Schedule']['rawAttributes'],function(_0x8ca1f0){return{'name':_0x8ca1f0[_0x0aa1('0x2c')],'type':_0x8ca1f0[_0x0aa1('0x2d')]['key']};});_0x59ae7f[_0x0aa1('0x2e')]=_[_0x0aa1('0x2b')](_0x1c883e,_0x0aa1('0x2a'));_0x59ae7f[_0x0aa1('0x2f')]=_[_0x0aa1('0x30')](_0x353bed[_0x0aa1('0x2f')]);_0x59ae7f[_0x0aa1('0x31')]=_[_0x0aa1('0x32')](_0x59ae7f[_0x0aa1('0x2e')],_0x59ae7f['query']);_0x500ac8[_0x0aa1('0x33')]=_[_0x0aa1('0x32')](_0x59ae7f['model'],qs['fields'](_0x353bed[_0x0aa1('0x2f')][_0x0aa1('0x34')]));_0x500ac8[_0x0aa1('0x33')]=_0x500ac8[_0x0aa1('0x33')][_0x0aa1('0x35')]?_0x500ac8[_0x0aa1('0x33')]:_0x59ae7f[_0x0aa1('0x2e')];if(!_0x353bed[_0x0aa1('0x2f')][_0x0aa1('0x36')]('nolimit')){_0x500ac8['limit']=qs[_0x0aa1('0x1a')](_0x353bed[_0x0aa1('0x2f')][_0x0aa1('0x1a')]);_0x500ac8[_0x0aa1('0x1c')]=qs[_0x0aa1('0x1c')](_0x353bed['query'][_0x0aa1('0x1c')]);}_0x500ac8[_0x0aa1('0x37')]=qs[_0x0aa1('0x38')](_0x353bed[_0x0aa1('0x2f')][_0x0aa1('0x38')]);_0x500ac8[_0x0aa1('0x39')]=qs[_0x0aa1('0x31')](_[_0x0aa1('0x3a')](_0x353bed[_0x0aa1('0x2f')],_0x59ae7f[_0x0aa1('0x31')]),_0x1c883e);if(_0x353bed[_0x0aa1('0x2f')][_0x0aa1('0x3b')]){_0x500ac8['where']=_['merge'](_0x500ac8[_0x0aa1('0x39')],{'$or':_[_0x0aa1('0x2b')](_0x1c883e,function(_0x4d16b2){if(_0x4d16b2[_0x0aa1('0x2d')]!==_0x0aa1('0x3c')){var _0x30212d={};_0x30212d[_0x4d16b2[_0x0aa1('0x2a')]]={'$like':'%'+_0x353bed['query'][_0x0aa1('0x3b')]+'%'};return _0x30212d;}})});}_0x500ac8=_[_0x0aa1('0x3d')]({},_0x500ac8,_0x353bed[_0x0aa1('0x3e')]);var _0x4fd1b3={'where':_0x500ac8[_0x0aa1('0x39')]};return db[_0x0aa1('0x3f')]['count'](_0x4fd1b3)[_0x0aa1('0x22')](function(_0x59922e){_0x4fa4a7[_0x0aa1('0x1b')]=_0x59922e;if(_0x353bed[_0x0aa1('0x2f')][_0x0aa1('0x40')]){_0x500ac8[_0x0aa1('0x41')]=[{'all':!![]}];}return db[_0x0aa1('0x3f')][_0x0aa1('0x42')](_0x500ac8);})[_0x0aa1('0x22')](function(_0x192aa3){_0x4fa4a7[_0x0aa1('0x43')]=_0x192aa3;return _0x4fa4a7;})[_0x0aa1('0x22')](respondWithFilteredResult(_0x3f1747,_0x500ac8))[_0x0aa1('0x44')](handleError(_0x3f1747,null));};exports[_0x0aa1('0x45')]=function(_0x138b62,_0x575117){var _0xaddca0={'raw':![],'where':{'id':_0x138b62['params']['id']}},_0x10d8ca={};_0x10d8ca[_0x0aa1('0x2e')]=_[_0x0aa1('0x30')](db['Schedule'][_0x0aa1('0x46')]);_0x10d8ca['query']=_[_0x0aa1('0x30')](_0x138b62[_0x0aa1('0x2f')]);_0x10d8ca[_0x0aa1('0x31')]=_[_0x0aa1('0x32')](_0x10d8ca[_0x0aa1('0x2e')],_0x10d8ca[_0x0aa1('0x2f')]);_0xaddca0[_0x0aa1('0x33')]=_[_0x0aa1('0x32')](_0x10d8ca['model'],qs['fields'](_0x138b62['query']['fields']));_0xaddca0[_0x0aa1('0x33')]=_0xaddca0[_0x0aa1('0x33')][_0x0aa1('0x35')]?_0xaddca0[_0x0aa1('0x33')]:_0x10d8ca[_0x0aa1('0x2e')];if(_0x138b62['query'][_0x0aa1('0x40')]){_0xaddca0[_0x0aa1('0x41')]=[{'all':!![]}];}_0xaddca0=_[_0x0aa1('0x3d')]({},_0xaddca0,_0x138b62[_0x0aa1('0x3e')]);return db[_0x0aa1('0x3f')][_0x0aa1('0x47')](_0xaddca0)[_0x0aa1('0x22')](handleEntityNotFound(_0x575117,null))[_0x0aa1('0x22')](respondWithResult(_0x575117,null))[_0x0aa1('0x44')](handleError(_0x575117,null));};exports[_0x0aa1('0x48')]=function(_0x25c5c0,_0x15f8e6){return db['Schedule']['create'](_0x25c5c0['body'],{})['then'](function(_0x50d107){var _0x719df8=_0x25c5c0[_0x0aa1('0x49')][_0x0aa1('0x24')]({'plain':!![]});if(!_0x719df8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x719df8[_0x0aa1('0x4a')]===_0x0aa1('0x49')){var _0x14f862=_0x50d107[_0x0aa1('0x24')]({'plain':!![]});var _0x3498aa='Scheduler';return db['UserProfileSection'][_0x0aa1('0x47')]({'where':{'name':_0x3498aa,'userProfileId':_0x719df8[_0x0aa1('0x4b')]},'raw':!![]})[_0x0aa1('0x22')](function(_0x4e2de3){if(_0x4e2de3&&_0x4e2de3[_0x0aa1('0x4c')]===0x0){return db['UserProfileResource'][_0x0aa1('0x48')]({'name':_0x14f862[_0x0aa1('0x2a')],'resourceId':_0x14f862['id'],'type':_0x4e2de3[_0x0aa1('0x2a')],'sectionId':_0x4e2de3['id']},{})[_0x0aa1('0x22')](function(){return _0x50d107;});}else{return _0x50d107;}})[_0x0aa1('0x44')](function(_0x375114){logger['error'](_0x0aa1('0x4d'),_0x375114);throw _0x375114;});}return _0x50d107;})[_0x0aa1('0x22')](respondWithResult(_0x15f8e6,0xc9))[_0x0aa1('0x44')](handleError(_0x15f8e6,null));};exports[_0x0aa1('0x21')]=function(_0x2d8182,_0x257436){if(_0x2d8182[_0x0aa1('0x4e')]['id']){delete _0x2d8182[_0x0aa1('0x4e')]['id'];}return db[_0x0aa1('0x3f')][_0x0aa1('0x47')]({'where':{'id':_0x2d8182[_0x0aa1('0x4f')]['id']}})[_0x0aa1('0x22')](handleEntityNotFound(_0x257436,null))[_0x0aa1('0x22')](saveUpdates(_0x2d8182[_0x0aa1('0x4e')],null))['then'](respondWithResult(_0x257436,null))[_0x0aa1('0x44')](handleError(_0x257436,null));};exports['destroy']=function(_0x2edbd5,_0x4a5e65){return db[_0x0aa1('0x3f')][_0x0aa1('0x47')]({'where':{'id':_0x2edbd5[_0x0aa1('0x4f')]['id']}})[_0x0aa1('0x22')](handleEntityNotFound(_0x4a5e65,null))[_0x0aa1('0x22')](removeEntity(_0x4a5e65,null))[_0x0aa1('0x44')](handleError(_0x4a5e65,null));};exports[_0x0aa1('0x50')]=function(_0x1aef50,_0x486c59,_0x31a5f8){var _0x4f4869=require(_0x0aa1('0x51'));return db[_0x0aa1('0x3f')][_0x0aa1('0x47')]({'where':{'id':_0x1aef50[_0x0aa1('0x4f')]['id']},'raw':!![]})[_0x0aa1('0x22')](handleEntityNotFound(_0x486c59,null))['then'](function(){_0x4f4869[_0x0aa1('0x50')](_0x1aef50['params']['id']);})[_0x0aa1('0x22')](respondWithStatusCode(_0x486c59,null))[_0x0aa1('0x44')](handleError(_0x486c59,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ced8f5b..15c4a36 100644 --- a/server/api/schedule/schedule.model.js +++ b/server/api/schedule/schedule.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x881b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','lodash','util','../../config/logger'];(function(_0x1d5643,_0x7a02a1){var _0x2cdc60=function(_0x1bcd0b){while(--_0x1bcd0b){_0x1d5643['push'](_0x1d5643['shift']());}};_0x2cdc60(++_0x7a02a1);}(_0x881b,0x1c5));var _0xb881=function(_0x4adacf,_0x5d461c){_0x4adacf=_0x4adacf-0x0;var _0x56d0c0=_0x881b[_0x4adacf];return _0x56d0c0;};'use strict';var _=require(_0xb881('0x0'));var util=require(_0xb881('0x1'));var logger=require(_0xb881('0x2'))('api');var moment=require(_0xb881('0x3'));var BPromise=require(_0xb881('0x4'));var rp=require(_0xb881('0x5'));var fs=require('fs');var path=require(_0xb881('0x6'));var rimraf=require(_0xb881('0x7'));var config=require(_0xb881('0x8'));var attributes=require(_0xb881('0x9'));module['exports']=function(_0x36c839,_0x1416a6){return _0x36c839[_0xb881('0xa')](_0xb881('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86b6=['api','moment','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','util','../../config/logger'];(function(_0x301344,_0x2483fe){var _0x3a900c=function(_0x4eb654){while(--_0x4eb654){_0x301344['push'](_0x301344['shift']());}};_0x3a900c(++_0x2483fe);}(_0x86b6,0x198));var _0x686b=function(_0x3df21d,_0xa44265){_0x3df21d=_0x3df21d-0x0;var _0x37ab8a=_0x86b6[_0x3df21d];return _0x37ab8a;};'use strict';var _=require('lodash');var util=require(_0x686b('0x0'));var logger=require(_0x686b('0x1'))(_0x686b('0x2'));var moment=require(_0x686b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x686b('0x4'));var rimraf=require(_0x686b('0x5'));var config=require(_0x686b('0x6'));var attributes=require(_0x686b('0x7'));module['exports']=function(_0x51984b,_0x2f5f3b){return _0x51984b[_0x686b('0x8')](_0x686b('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index bed23de..083a19d 100644 --- a/server/api/schedule/schedule.rpc.js +++ b/server/api/schedule/schedule.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0624=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x4a8a0f,_0x2a7b15){var _0x6ca8fe=function(_0x40c8c8){while(--_0x40c8c8){_0x4a8a0f['push'](_0x4a8a0f['shift']());}};_0x6ca8fe(++_0x2a7b15);}(_0x0624,0x14e));var _0x4062=function(_0x51d9c7,_0x47e579){_0x51d9c7=_0x51d9c7-0x0;var _0x43a887=_0x0624[_0x51d9c7];return _0x43a887;};'use strict';var _=require('lodash');var util=require(_0x4062('0x0'));var moment=require(_0x4062('0x1'));var BPromise=require('bluebird');var rs=require(_0x4062('0x2'));var fs=require('fs');var Redis=require(_0x4062('0x3'));var db=require(_0x4062('0x4'))['db'];var utils=require(_0x4062('0x5'));var logger=require(_0x4062('0x6'))(_0x4062('0x7'));var config=require(_0x4062('0x8'));var jayson=require(_0x4062('0x9'));var client=jayson[_0x4062('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x88d124,_0x4723f9,_0x6185be){return new BPromise(function(_0x3edbe1,_0x303116){return client['request'](_0x88d124,_0x6185be)['then'](function(_0x1f9687){logger[_0x4062('0xb')](_0x4062('0xc'),_0x4723f9,_0x4062('0xd'));logger[_0x4062('0xe')](_0x4062('0xf'),_0x4723f9,_0x4062('0xd'),JSON['stringify'](_0x1f9687));if(_0x1f9687[_0x4062('0x10')]){if(_0x1f9687['error'][_0x4062('0x11')]===0x1f4){logger[_0x4062('0x10')](_0x4062('0xc'),_0x4723f9,_0x1f9687[_0x4062('0x10')][_0x4062('0x12')]);return _0x303116(_0x1f9687[_0x4062('0x10')]['message']);}logger[_0x4062('0x10')](_0x4062('0xc'),_0x4723f9,_0x1f9687['error'][_0x4062('0x12')]);return _0x3edbe1(_0x1f9687[_0x4062('0x10')][_0x4062('0x12')]);}else{logger[_0x4062('0xb')](_0x4062('0xc'),_0x4723f9,'request\x20sent');_0x3edbe1(_0x1f9687[_0x4062('0x13')][_0x4062('0x12')]);}})[_0x4062('0x14')](function(_0x1df338){logger['error'](_0x4062('0xc'),_0x4723f9,_0x1df338);_0x303116(_0x1df338);});});} \ No newline at end of file +var _0xda36=['info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xda36,0x12a));var _0x6da3=function(_0xb032bf,_0x3c95ea){_0xb032bf=_0xb032bf-0x0;var _0x484dc2=_0xda36[_0xb032bf];return _0x484dc2;};'use strict';var _=require(_0x6da3('0x0'));var util=require(_0x6da3('0x1'));var moment=require(_0x6da3('0x2'));var BPromise=require('bluebird');var rs=require(_0x6da3('0x3'));var fs=require('fs');var Redis=require(_0x6da3('0x4'));var db=require(_0x6da3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6da3('0x6'))(_0x6da3('0x7'));var config=require(_0x6da3('0x8'));var jayson=require(_0x6da3('0x9'));var client=jayson[_0x6da3('0xa')][_0x6da3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x167a23,_0x4747bd,_0x172f04){return new BPromise(function(_0x4d882a,_0x51d61c){return client[_0x6da3('0xc')](_0x167a23,_0x172f04)[_0x6da3('0xd')](function(_0xf550b3){logger[_0x6da3('0xe')](_0x6da3('0xf'),_0x4747bd,_0x6da3('0x10'));logger[_0x6da3('0x11')](_0x6da3('0x12'),_0x4747bd,_0x6da3('0x10'),JSON[_0x6da3('0x13')](_0xf550b3));if(_0xf550b3[_0x6da3('0x14')]){if(_0xf550b3[_0x6da3('0x14')][_0x6da3('0x15')]===0x1f4){logger[_0x6da3('0x14')](_0x6da3('0xf'),_0x4747bd,_0xf550b3[_0x6da3('0x14')]['message']);return _0x51d61c(_0xf550b3['error'][_0x6da3('0x16')]);}logger['error'](_0x6da3('0xf'),_0x4747bd,_0xf550b3[_0x6da3('0x14')][_0x6da3('0x16')]);return _0x4d882a(_0xf550b3['error']['message']);}else{logger['info'](_0x6da3('0xf'),_0x4747bd,_0x6da3('0x10'));_0x4d882a(_0xf550b3[_0x6da3('0x17')]['message']);}})['catch'](function(_0x5be870){logger['error']('Schedule,\x20%s,\x20%s',_0x4747bd,_0x5be870);_0x51d61c(_0x5be870);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f34490b..2ad254f 100644 --- a/server/api/screenRecording/index.js +++ b/server/api/screenRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x206a=['index','/describe','isAuthenticated','/:id','/:id/download','download','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x206a,0x96));var _0xa206=function(_0x49905e,_0x1c9791){_0x49905e=_0x49905e-0x0;var _0x57d5dd=_0x206a[_0x49905e];return _0x57d5dd;};'use strict';var multer=require(_0xa206('0x0'));var util=require(_0xa206('0x1'));var path=require(_0xa206('0x2'));var timeout=require(_0xa206('0x3'));var express=require(_0xa206('0x4'));var router=express[_0xa206('0x5')]();var fs_extra=require(_0xa206('0x6'));var auth=require(_0xa206('0x7'));var interaction=require(_0xa206('0x8'));var config=require(_0xa206('0x9'));var controller=require('./screenRecording.controller');router[_0xa206('0xa')]('/',auth['isAuthenticated'](),controller[_0xa206('0xb')]);router['get'](_0xa206('0xc'),auth[_0xa206('0xd')](),controller['describe']);router['get'](_0xa206('0xe'),auth[_0xa206('0xd')](),controller['show']);router[_0xa206('0xa')](_0xa206('0xf'),auth[_0xa206('0xd')](),controller[_0xa206('0x10')]);router[_0xa206('0x11')]('/',auth[_0xa206('0xd')](),controller[_0xa206('0x12')]);router['put']('/:id',auth[_0xa206('0xd')](),controller[_0xa206('0x13')]);router[_0xa206('0x14')](_0xa206('0xe'),auth['isAuthenticated'](),controller[_0xa206('0x15')]);module[_0xa206('0x16')]=router; \ No newline at end of file +var _0x669b=['isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x4c62db,_0x31f9bf){var _0x48e398=function(_0x3003b8){while(--_0x3003b8){_0x4c62db['push'](_0x4c62db['shift']());}};_0x48e398(++_0x31f9bf);}(_0x669b,0x17e));var _0xb669=function(_0x1563ce,_0x25113c){_0x1563ce=_0x1563ce-0x0;var _0x41cfad=_0x669b[_0x1563ce];return _0x41cfad;};'use strict';var multer=require(_0xb669('0x0'));var util=require('util');var path=require(_0xb669('0x1'));var timeout=require(_0xb669('0x2'));var express=require('express');var router=express[_0xb669('0x3')]();var fs_extra=require(_0xb669('0x4'));var auth=require(_0xb669('0x5'));var interaction=require(_0xb669('0x6'));var config=require(_0xb669('0x7'));var controller=require(_0xb669('0x8'));router['get']('/',auth[_0xb669('0x9')](),controller[_0xb669('0xa')]);router[_0xb669('0xb')](_0xb669('0xc'),auth[_0xb669('0x9')](),controller[_0xb669('0xd')]);router[_0xb669('0xb')](_0xb669('0xe'),auth['isAuthenticated'](),controller[_0xb669('0xf')]);router[_0xb669('0xb')](_0xb669('0x10'),auth[_0xb669('0x9')](),controller[_0xb669('0x11')]);router[_0xb669('0x12')]('/',auth[_0xb669('0x9')](),controller['create']);router[_0xb669('0x13')]('/:id',auth[_0xb669('0x9')](),controller['update']);router[_0xb669('0x14')](_0xb669('0xe'),auth[_0xb669('0x9')](),controller[_0xb669('0x15')]);module[_0xb669('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 43d8a11..fa0ad1e 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x964b=['updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','extname','value','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','getDataValue','format','toString','MM-DD-YYYY\x20HH:mm','createdAt'];(function(_0x217c43,_0x4c6e6d){var _0x4ff329=function(_0x4131e3){while(--_0x4131e3){_0x217c43['push'](_0x217c43['shift']());}};_0x4ff329(++_0x4c6e6d);}(_0x964b,0x112));var _0xb964=function(_0x124106,_0x13a817){_0x124106=_0x124106-0x0;var _0x483eaf=_0x964b[_0x124106];return _0x483eaf;};'use strict';var Sequelize=require(_0xb964('0x0'));var moment=require(_0xb964('0x1'));var path=require('path');var config=require(_0xb964('0x2'));module[_0xb964('0x3')]={'format':{'type':Sequelize[_0xb964('0x4')],'get':function(){return this['getDataValue']('value')?path[_0xb964('0x5')](this['getDataValue'](_0xb964('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xb964('0x7')]},'channel':{'type':Sequelize[_0xb964('0x7')]},'value':{'type':Sequelize[_0xb964('0x7')],'set':function(_0x204c7d){var _0xde47d5=_0x204c7d[_0xb964('0x8')](/\\/g,'/');this['setDataValue']('value',_0xde47d5);}},'rating':{'type':Sequelize[_0xb964('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x55e697){this[_0xb964('0xa')](_0xb964('0xb'),moment()[_0xb964('0xc')](_0x55e697,'ms'));this[_0xb964('0xa')](_0xb964('0xd'),moment());this[_0xb964('0xa')]('duration',_0x55e697);}},'startedAt':{'type':Sequelize[_0xb964('0xe')],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0xb')))[_0xb964('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xb964('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xb964('0xd')))[_0xb964('0x10')](_0xb964('0x12'))[_0xb964('0x11')]();}},'createdAt':{'type':Sequelize[_0xb964('0xe')],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0x13')))['format'](_0xb964('0x12'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0x14')))[_0xb964('0x10')](_0xb964('0x12'))[_0xb964('0x11')]();}}}; \ No newline at end of file +var _0xf970=['DATE','format','MM-DD-YYYY\x20HH:mm','closedAt','toString','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','startedAt','subtract'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0xf970,0x1d9));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x0f97('0x0'));var moment=require('moment');var path=require(_0x0f97('0x1'));var config=require(_0x0f97('0x2'));module[_0x0f97('0x3')]={'format':{'type':Sequelize[_0x0f97('0x4')],'get':function(){return this[_0x0f97('0x5')](_0x0f97('0x6'))?path[_0x0f97('0x7')](this['getDataValue'](_0x0f97('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x0f97('0x8')]},'channel':{'type':Sequelize[_0x0f97('0x8')]},'value':{'type':Sequelize[_0x0f97('0x8')],'set':function(_0x2e3515){var _0x3244a6=_0x2e3515[_0x0f97('0x9')](/\\/g,'/');this[_0x0f97('0xa')](_0x0f97('0x6'),_0x3244a6);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x12397b){this['setDataValue'](_0x0f97('0xb'),moment()[_0x0f97('0xc')](_0x12397b,'ms'));this[_0x0f97('0xa')]('closedAt',moment());this[_0x0f97('0xa')]('duration',_0x12397b);}},'startedAt':{'type':Sequelize[_0x0f97('0xd')],'get':function(){return moment(this[_0x0f97('0x5')](_0x0f97('0xb')))[_0x0f97('0xe')](_0x0f97('0xf'))['toString']();}},'closedAt':{'type':Sequelize[_0x0f97('0xd')],'get':function(){return moment(this[_0x0f97('0x5')](_0x0f97('0x10')))[_0x0f97('0xe')](_0x0f97('0xf'))[_0x0f97('0x11')]();}},'createdAt':{'type':Sequelize[_0x0f97('0xd')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x0f97('0xe')](_0x0f97('0xf'))[_0x0f97('0x11')]();}},'updatedAt':{'type':Sequelize[_0x0f97('0xd')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x0f97('0xe')](_0x0f97('0xf'))[_0x0f97('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index f045895..9ef5e80 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2eb2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf'];(function(_0x2ac0b0,_0x115490){var _0x352688=function(_0xbd450e){while(--_0xbd450e){_0x2ac0b0['push'](_0x2ac0b0['shift']());}};_0x352688(++_0x115490);}(_0x2eb2,0x19f));var _0x22eb=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2eb2[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x2c')](_['map'](_0x1599c7,_0x22eb('0x24')),[_0x22eb('0x2d')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x49dd59[_0x22eb('0x2e')]);_0x44cf91[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x44cf91[_0x22eb('0x32')],_0x44cf91[_0x22eb('0x2e')]);_0x25e5bc[_0x22eb('0x33')]=_['intersection'](_0x44cf91['model'],qs[_0x22eb('0x34')](_0x49dd59['query']['fields']));_0x25e5bc[_0x22eb('0x33')]=_0x25e5bc[_0x22eb('0x33')][_0x22eb('0x35')]?_0x25e5bc[_0x22eb('0x33')]:_0x44cf91[_0x22eb('0x32')];if(!_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x36')](_0x22eb('0x37'))){_0x25e5bc[_0x22eb('0x38')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc['offset']=qs['offset'](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x19')]);}_0x25e5bc['order']=qs[_0x22eb('0x39')](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x39')]);_0x25e5bc[_0x22eb('0x3a')]=qs[_0x22eb('0x30')](_['pick'](_0x49dd59[_0x22eb('0x2e')],_0x44cf91[_0x22eb('0x30')]),_0x1599c7);if(_0x49dd59['query'][_0x22eb('0x3b')]){_0x25e5bc[_0x22eb('0x3a')]=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x3a')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x5382eb){if(_0x5382eb['type']!==_0x22eb('0x3d')){var _0x6cd651={};_0x6cd651[_0x5382eb['name']]={'$like':'%'+_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3b')]+'%'};return _0x6cd651;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59['options']);var _0x1d977c={'where':_0x25e5bc[_0x22eb('0x3a')]};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x1d977c)[_0x22eb('0x20')](function(_0x39778e){_0x7c0119['count']=_0x39778e;if(_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x25e5bc['include']=[{'all':!![]}];}return db[_0x22eb('0x27')][_0x22eb('0x3f')](_0x25e5bc);})[_0x22eb('0x20')](function(_0x30cb10){_0x7c0119[_0x22eb('0x40')]=_0x30cb10;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x41')](handleError(_0x2a950e,null));};exports[_0x22eb('0x42')]=function(_0x1bafa3,_0x82ace8){var _0x3e1826={'raw':![],'where':{'id':_0x1bafa3[_0x22eb('0x43')]['id']}},_0x1cf1e0={};_0x1cf1e0[_0x22eb('0x32')]=_[_0x22eb('0x2f')](db[_0x22eb('0x27')][_0x22eb('0x28')]);_0x1cf1e0[_0x22eb('0x2e')]=_['keys'](_0x1bafa3[_0x22eb('0x2e')]);_0x1cf1e0[_0x22eb('0x30')]=_['intersection'](_0x1cf1e0[_0x22eb('0x32')],_0x1cf1e0[_0x22eb('0x2e')]);_0x3e1826['attributes']=_['intersection'](_0x1cf1e0['model'],qs[_0x22eb('0x34')](_0x1bafa3[_0x22eb('0x2e')]['fields']));_0x3e1826['attributes']=_0x3e1826[_0x22eb('0x33')][_0x22eb('0x35')]?_0x3e1826[_0x22eb('0x33')]:_0x1cf1e0[_0x22eb('0x32')];if(_0x1bafa3[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x3e1826[_0x22eb('0x44')]=[{'all':!![]}];}_0x3e1826=_[_0x22eb('0x3c')]({},_0x3e1826,_0x1bafa3['options']);return db['ScreenRecording'][_0x22eb('0x45')](_0x3e1826)['then'](handleEntityNotFound(_0x82ace8,null))[_0x22eb('0x20')](respondWithResult(_0x82ace8,null))['catch'](handleError(_0x82ace8,null));};exports[_0x22eb('0x46')]=function(_0x5c41c0,_0x4b2f86){return db['ScreenRecording']['create'](_0x5c41c0[_0x22eb('0x47')],{})['then'](respondWithResult(_0x4b2f86,0xc9))[_0x22eb('0x41')](handleError(_0x4b2f86,null));};exports[_0x22eb('0x1f')]=function(_0x490bef,_0x24e6ba){if(_0x490bef['body']['id']){delete _0x490bef[_0x22eb('0x47')]['id'];}delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x48')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x49')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4a')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4b')];return db['ScreenRecording'][_0x22eb('0x45')]({'where':{'id':_0x490bef[_0x22eb('0x43')]['id']}})['then'](handleEntityNotFound(_0x24e6ba,null))[_0x22eb('0x20')](saveUpdates(_0x490bef[_0x22eb('0x47')],null))[_0x22eb('0x20')](respondWithResult(_0x24e6ba,null))[_0x22eb('0x41')](handleError(_0x24e6ba,null));};exports['describe']=function(_0x6c0600,_0x169ae1){return db[_0x22eb('0x27')][_0x22eb('0x4c')]()[_0x22eb('0x20')](respondWithResult(_0x169ae1,null))[_0x22eb('0x41')](handleError(_0x169ae1,null));};exports['download']=function(_0x29d7ca,_0x4e5b9f,_0x3ff406){var _0x5eecef=require(_0x22eb('0x4d'));var _0x254b53=![];var _0x4028ef={};if(_0x29d7ca[_0x22eb('0x2e')][_0x22eb('0x2a')]&&_0x29d7ca['query']['type']===_0x22eb('0x4e')){_0x4028ef[_0x22eb('0x4e')]=_0x29d7ca['params']['id'];}else{_0x4028ef['id']=_0x29d7ca[_0x22eb('0x43')]['id'];}return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':_0x4028ef,'attributes':['id',_0x22eb('0x4b')],'raw':!![]})[_0x22eb('0x20')](handleEntityNotFound(_0x4e5b9f,null))[_0x22eb('0x20')](function(_0x3a8588){if(_0x3a8588){var _0x35c997=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x3a8588['value']);var _0x19cadf=util[_0x22eb('0x2d')](_0x22eb('0x52'),_0x35c997);if(fs[_0x22eb('0x53')](_0x19cadf)){_0x254b53=!![];return _0x5eecef[_0x22eb('0x54')](_0x19cadf,_0x35c997,config[_0x22eb('0x55')][_0x22eb('0x56')])[_0x22eb('0x20')](function(){return _0x3a8588;});}return _0x3a8588;}})[_0x22eb('0x20')](function(_0x9f8465){if(_0x9f8465){var _0x3e9ab5=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x9f8465['value']);if(!fs['existsSync'](_0x3e9ab5)){throw new db[(_0x22eb('0x57'))][(_0x22eb('0x58'))](_0x22eb('0x59'));}if(_0x9f8465[_0x22eb('0x5a')]){return _0x4e5b9f[_0x22eb('0x5b')](_0x3e9ab5,_0x9f8465['filename']+path[_0x22eb('0x5c')](_0x3e9ab5),function(){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}else{return _0x4e5b9f['download'](_0x3e9ab5,function(_0x485408){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}}})[_0x22eb('0x41')](function(_0xb5c8ae){if(_0xb5c8ae[_0x22eb('0x5e')]===_0x22eb('0x59')){_0x4e5b9f[_0x22eb('0x17')](0x194)[_0x22eb('0x25')](_0x22eb('0x5f'));}else{return handleError(_0x4e5b9f,null);}});};exports[_0x22eb('0x21')]=function(_0x19b579,_0x164645){return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':{'id':_0x19b579[_0x22eb('0x43')]['id']}})['then'](function(_0x29dd8b){if(_[_0x22eb('0x60')](_0x29dd8b)){throw new ReferenceError(_0x22eb('0x61'));}return _0x29dd8b;})['then'](function(_0x1787ec){var _0x5ac4c5=path[_0x22eb('0x4f')](config['root'],_0x22eb('0x51'),_0x1787ec[_0x22eb('0x4b')]);logger['info'](_0x22eb('0x62'),_0x5ac4c5);if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs['existsSync'](_0x5ac4c5)){logger[_0x22eb('0x63')](_0x22eb('0x64')+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}_0x5ac4c5=_0x5ac4c5+_0x22eb('0x67');if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs[_0x22eb('0x53')](_0x5ac4c5)){logger['info']('File:\x20\x22'+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}return _0x1787ec;})[_0x22eb('0x20')](function(_0x22b5c6){if(!_0x22b5c6)throw new InternalError();return _0x22b5c6[_0x22eb('0x21')]();})[_0x22eb('0x20')](function(){_0x164645[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();})['catch'](handleError(_0x164645,null));}; \ No newline at end of file +var _0x5636=['rawAttributes','fieldName','type','key','model','differenceBy','map','format','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ScreenRecording','count','includeAll','include','findAll','rows','catch','show','find','create','body','duration','createdAt','closedAt','value','describe','uniqueid','params','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','download','filename','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index'];(function(_0x37b6fd,_0x5eafa8){var _0x3fb552=function(_0x570c6a){while(--_0x570c6a){_0x37b6fd['push'](_0x37b6fd['shift']());}};_0x3fb552(++_0x5eafa8);}(_0x5636,0x102));var _0x6563=function(_0x4003a0,_0x79233c){_0x4003a0=_0x4003a0-0x0;var _0x3aad33=_0x5636[_0x4003a0];return _0x3aad33;};'use strict';var emlformat=require(_0x6563('0x0'));var rimraf=require(_0x6563('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6563('0x2'));var BPromise=require(_0x6563('0x3'));var Mustache=require(_0x6563('0x4'));var util=require('util');var path=require(_0x6563('0x5'));var sox=require(_0x6563('0x6'));var csv=require(_0x6563('0x7'));var ejs=require(_0x6563('0x8'));var fs=require('fs');var fs_extra=require(_0x6563('0x9'));var _=require(_0x6563('0xa'));var squel=require(_0x6563('0xb'));var crypto=require(_0x6563('0xc'));var jsforce=require(_0x6563('0xd'));var deskjs=require(_0x6563('0xe'));var toCsv=require(_0x6563('0x7'));var querystring=require(_0x6563('0xf'));var Papa=require(_0x6563('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6563('0x11'));var as=require(_0x6563('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6563('0x13'));var config=require(_0x6563('0x14'));var licenseUtil=require(_0x6563('0x15'));var db=require(_0x6563('0x16'))['db'];function respondWithStatusCode(_0x33816e,_0x2ed676){_0x2ed676=_0x2ed676||0xcc;return function(_0x31d3fa){if(_0x31d3fa){return _0x33816e[_0x6563('0x17')](_0x2ed676);}return _0x33816e[_0x6563('0x18')](_0x2ed676)['end']();};}function respondWithResult(_0xa0a0b6,_0x5e9329){_0x5e9329=_0x5e9329||0xc8;return function(_0x37131e){if(_0x37131e){return _0xa0a0b6[_0x6563('0x18')](_0x5e9329)[_0x6563('0x19')](_0x37131e);}};}function respondWithFilteredResult(_0x10d08c,_0x5af5d0){return function(_0x26f26e){if(_0x26f26e){var _0x11baa2=typeof _0x5af5d0[_0x6563('0x1a')]===_0x6563('0x1b')&&typeof _0x5af5d0['limit']===_0x6563('0x1b');var _0x589632=_0x26f26e['count'];var _0x47972a=_0x11baa2?0x0:_0x5af5d0[_0x6563('0x1a')];var _0x4f5609=_0x11baa2?_0x26f26e['count']:_0x5af5d0[_0x6563('0x1a')]+_0x5af5d0[_0x6563('0x1c')];var _0x17a29f;if(_0x4f5609>=_0x589632){_0x4f5609=_0x589632;_0x17a29f=0xc8;}else{_0x17a29f=0xce;}_0x10d08c[_0x6563('0x18')](_0x17a29f);return _0x10d08c[_0x6563('0x1d')](_0x6563('0x1e'),_0x47972a+'-'+_0x4f5609+'/'+_0x589632)[_0x6563('0x19')](_0x26f26e);}return null;};}function patchUpdates(_0x93a45){return function(_0x2a70f0){try{jsonpatch['apply'](_0x2a70f0,_0x93a45,!![]);}catch(_0x2f2905){return BPromise[_0x6563('0x1f')](_0x2f2905);}return _0x2a70f0[_0x6563('0x20')]();};}function saveUpdates(_0x5a335c,_0x293db2){return function(_0x5c37bb){if(_0x5c37bb){return _0x5c37bb[_0x6563('0x21')](_0x5a335c)[_0x6563('0x22')](function(_0x5610b0){return _0x5610b0;});}return null;};}function removeEntity(_0x5773e2,_0x3ab7f6){return function(_0x492f45){if(_0x492f45){return _0x492f45[_0x6563('0x23')]()[_0x6563('0x22')](function(){_0x5773e2[_0x6563('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd860d5,_0x51ff06){return function(_0x7ea857){if(!_0x7ea857){_0xd860d5[_0x6563('0x17')](0x194);}return _0x7ea857;};}function handleError(_0x5e5aeb,_0x365b16){_0x365b16=_0x365b16||0x1f4;return function(_0x28252d){logger['error'](_0x28252d[_0x6563('0x24')]);if(_0x28252d['name']){delete _0x28252d[_0x6563('0x25')];}_0x5e5aeb['status'](_0x365b16)['send'](_0x28252d);};}exports[_0x6563('0x26')]=function(_0x118d31,_0x17326c){var _0x2a1550={},_0x3eb23b={},_0x4b4d3b={'count':0x0,'rows':[]};var _0x3c8bd1=_['map'](db['ScreenRecording'][_0x6563('0x27')],function(_0x35af37){return{'name':_0x35af37[_0x6563('0x28')],'type':_0x35af37[_0x6563('0x29')][_0x6563('0x2a')]};});_0x3eb23b[_0x6563('0x2b')]=_[_0x6563('0x2c')](_[_0x6563('0x2d')](_0x3c8bd1,_0x6563('0x25')),[_0x6563('0x2e')]);_0x3eb23b['query']=_[_0x6563('0x2f')](_0x118d31[_0x6563('0x30')]);_0x3eb23b[_0x6563('0x31')]=_[_0x6563('0x32')](_0x3eb23b[_0x6563('0x2b')],_0x3eb23b[_0x6563('0x30')]);_0x2a1550[_0x6563('0x33')]=_['intersection'](_0x3eb23b[_0x6563('0x2b')],qs[_0x6563('0x34')](_0x118d31[_0x6563('0x30')][_0x6563('0x34')]));_0x2a1550[_0x6563('0x33')]=_0x2a1550[_0x6563('0x33')]['length']?_0x2a1550[_0x6563('0x33')]:_0x3eb23b[_0x6563('0x2b')];if(!_0x118d31[_0x6563('0x30')][_0x6563('0x35')](_0x6563('0x36'))){_0x2a1550[_0x6563('0x1c')]=qs[_0x6563('0x1c')](_0x118d31['query'][_0x6563('0x1c')]);_0x2a1550[_0x6563('0x1a')]=qs['offset'](_0x118d31[_0x6563('0x30')][_0x6563('0x1a')]);}_0x2a1550['order']=qs['sort'](_0x118d31[_0x6563('0x30')][_0x6563('0x37')]);_0x2a1550[_0x6563('0x38')]=qs[_0x6563('0x31')](_['pick'](_0x118d31[_0x6563('0x30')],_0x3eb23b[_0x6563('0x31')]),_0x3c8bd1);if(_0x118d31['query'][_0x6563('0x39')]){_0x2a1550[_0x6563('0x38')]=_[_0x6563('0x3a')](_0x2a1550[_0x6563('0x38')],{'$or':_[_0x6563('0x2d')](_0x3c8bd1,function(_0x1f6341){if(_0x1f6341[_0x6563('0x29')]!==_0x6563('0x3b')){var _0x2e4177={};_0x2e4177[_0x1f6341['name']]={'$like':'%'+_0x118d31[_0x6563('0x30')][_0x6563('0x39')]+'%'};return _0x2e4177;}})});}_0x2a1550=_[_0x6563('0x3a')]({},_0x2a1550,_0x118d31[_0x6563('0x3c')]);var _0x5ebe88={'where':_0x2a1550['where']};return db[_0x6563('0x3d')][_0x6563('0x3e')](_0x5ebe88)[_0x6563('0x22')](function(_0x5db29d){_0x4b4d3b[_0x6563('0x3e')]=_0x5db29d;if(_0x118d31['query'][_0x6563('0x3f')]){_0x2a1550[_0x6563('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0x6563('0x41')](_0x2a1550);})[_0x6563('0x22')](function(_0xea186){_0x4b4d3b[_0x6563('0x42')]=_0xea186;return _0x4b4d3b;})[_0x6563('0x22')](respondWithFilteredResult(_0x17326c,_0x2a1550))[_0x6563('0x43')](handleError(_0x17326c,null));};exports[_0x6563('0x44')]=function(_0x32932f,_0xd30789){var _0xfc7eb1={'raw':![],'where':{'id':_0x32932f['params']['id']}},_0x2acb52={};_0x2acb52['model']=_[_0x6563('0x2f')](db[_0x6563('0x3d')][_0x6563('0x27')]);_0x2acb52[_0x6563('0x30')]=_[_0x6563('0x2f')](_0x32932f[_0x6563('0x30')]);_0x2acb52[_0x6563('0x31')]=_['intersection'](_0x2acb52[_0x6563('0x2b')],_0x2acb52[_0x6563('0x30')]);_0xfc7eb1[_0x6563('0x33')]=_[_0x6563('0x32')](_0x2acb52['model'],qs[_0x6563('0x34')](_0x32932f[_0x6563('0x30')][_0x6563('0x34')]));_0xfc7eb1[_0x6563('0x33')]=_0xfc7eb1[_0x6563('0x33')]['length']?_0xfc7eb1['attributes']:_0x2acb52[_0x6563('0x2b')];if(_0x32932f[_0x6563('0x30')][_0x6563('0x3f')]){_0xfc7eb1['include']=[{'all':!![]}];}_0xfc7eb1=_[_0x6563('0x3a')]({},_0xfc7eb1,_0x32932f[_0x6563('0x3c')]);return db[_0x6563('0x3d')][_0x6563('0x45')](_0xfc7eb1)['then'](handleEntityNotFound(_0xd30789,null))[_0x6563('0x22')](respondWithResult(_0xd30789,null))[_0x6563('0x43')](handleError(_0xd30789,null));};exports[_0x6563('0x46')]=function(_0x55e927,_0x35b0ce){return db['ScreenRecording'][_0x6563('0x46')](_0x55e927['body'],{})['then'](respondWithResult(_0x35b0ce,0xc9))[_0x6563('0x43')](handleError(_0x35b0ce,null));};exports[_0x6563('0x21')]=function(_0x2ebab0,_0xb84325){if(_0x2ebab0[_0x6563('0x47')]['id']){delete _0x2ebab0[_0x6563('0x47')]['id'];}delete _0x2ebab0[_0x6563('0x47')][_0x6563('0x48')];delete _0x2ebab0[_0x6563('0x47')][_0x6563('0x49')];delete _0x2ebab0['body'][_0x6563('0x4a')];delete _0x2ebab0['body'][_0x6563('0x4b')];return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':{'id':_0x2ebab0['params']['id']}})[_0x6563('0x22')](handleEntityNotFound(_0xb84325,null))[_0x6563('0x22')](saveUpdates(_0x2ebab0['body'],null))[_0x6563('0x22')](respondWithResult(_0xb84325,null))[_0x6563('0x43')](handleError(_0xb84325,null));};exports[_0x6563('0x4c')]=function(_0x3883f3,_0xbd920a){return db['ScreenRecording'][_0x6563('0x4c')]()['then'](respondWithResult(_0xbd920a,null))[_0x6563('0x43')](handleError(_0xbd920a,null));};exports['download']=function(_0xd2ed6b,_0x5992c8,_0x55e002){var _0x5c8274=require('../../components/encryptor');var _0x270667=![];var _0x5ade56={};if(_0xd2ed6b[_0x6563('0x30')]['type']&&_0xd2ed6b[_0x6563('0x30')][_0x6563('0x29')]===_0x6563('0x4d')){_0x5ade56[_0x6563('0x4d')]=_0xd2ed6b[_0x6563('0x4e')]['id'];}else{_0x5ade56['id']=_0xd2ed6b[_0x6563('0x4e')]['id'];}return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':_0x5ade56,'attributes':['id',_0x6563('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x5992c8,null))[_0x6563('0x22')](function(_0x28b1c6){if(_0x28b1c6){var _0x97ee3=path[_0x6563('0x4f')](config[_0x6563('0x50')],_0x6563('0x51'),_0x28b1c6[_0x6563('0x4b')]);var _0x32c715=util[_0x6563('0x2e')](_0x6563('0x52'),_0x97ee3);if(fs[_0x6563('0x53')](_0x32c715)){_0x270667=!![];return _0x5c8274['decryptFile'](_0x32c715,_0x97ee3,config[_0x6563('0x54')][_0x6563('0x55')])[_0x6563('0x22')](function(){return _0x28b1c6;});}return _0x28b1c6;}})[_0x6563('0x22')](function(_0x46c26c){if(_0x46c26c){var _0x3c06ac=path[_0x6563('0x4f')](config[_0x6563('0x50')],'server/files/screen_recordings',_0x46c26c[_0x6563('0x4b')]);if(!fs['existsSync'](_0x3c06ac)){throw new db[(_0x6563('0x56'))][(_0x6563('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x46c26c['filename']){return _0x5992c8[_0x6563('0x58')](_0x3c06ac,_0x46c26c[_0x6563('0x59')]+path[_0x6563('0x5a')](_0x3c06ac),function(){if(_0x270667){fs[_0x6563('0x5b')](_0x3c06ac);}});}else{return _0x5992c8['download'](_0x3c06ac,function(_0x2a3df0){if(_0x270667){fs['unlink'](_0x3c06ac);}});}}})[_0x6563('0x43')](function(_0x29aecb){if(_0x29aecb['message']==='ScreenRecording\x20not\x20found'){_0x5992c8[_0x6563('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x5992c8,null);}});};exports[_0x6563('0x23')]=function(_0x49d6a5,_0x356010){return db[_0x6563('0x3d')][_0x6563('0x45')]({'where':{'id':_0x49d6a5[_0x6563('0x4e')]['id']}})['then'](function(_0x83d5c){if(_[_0x6563('0x5c')](_0x83d5c)){throw new ReferenceError(_0x6563('0x5d'));}return _0x83d5c;})[_0x6563('0x22')](function(_0x3ffb7f){var _0x2d4694=path[_0x6563('0x4f')](config[_0x6563('0x50')],'server/files/screen_recordings',_0x3ffb7f['value']);logger[_0x6563('0x5e')](_0x6563('0x5f'),_0x2d4694);if(!_['isNil'](_0x3ffb7f['value'])&&fs['existsSync'](_0x2d4694)){logger[_0x6563('0x5e')](_0x6563('0x60')+_0x2d4694+_0x6563('0x61'));fs[_0x6563('0x62')](_0x2d4694);}_0x2d4694=_0x2d4694+'.cypher';if(!_[_0x6563('0x5c')](_0x3ffb7f[_0x6563('0x4b')])&&fs[_0x6563('0x53')](_0x2d4694)){logger[_0x6563('0x5e')](_0x6563('0x60')+_0x2d4694+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2d4694);}return _0x3ffb7f;})[_0x6563('0x22')](function(_0x1d7b5d){if(!_0x1d7b5d)throw new InternalError();return _0x1d7b5d[_0x6563('0x23')]();})['then'](function(){_0x356010[_0x6563('0x18')](0xcc)['end']();})[_0x6563('0x43')](handleError(_0x356010,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 041794e..7865c4c 100644 --- a/server/api/screenRecording/screenRecording.model.js +++ b/server/api/screenRecording/screenRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2145=['api','moment','bluebird','request-promise','rimraf','./screenRecording.attributes','exports','define','screen_recordings','interactionid','util','../../config/logger'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x2145,0x1d2));var _0x5214=function(_0x30c56e,_0x4a0230){_0x30c56e=_0x30c56e-0x0;var _0x413241=_0x2145[_0x30c56e];return _0x413241;};'use strict';var _=require('lodash');var util=require(_0x5214('0x0'));var logger=require(_0x5214('0x1'))(_0x5214('0x2'));var moment=require(_0x5214('0x3'));var BPromise=require(_0x5214('0x4'));var rp=require(_0x5214('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5214('0x6'));var config=require('../../config/environment');var attributes=require(_0x5214('0x7'));module[_0x5214('0x8')]=function(_0x53bf92,_0x5732f6){return _0x53bf92[_0x5214('0x9')]('ScreenRecording',attributes,{'tableName':_0x5214('0xa'),'paranoid':![],'indexes':[{'name':_0x5214('0xb'),'fields':[_0x5214('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4a6=['screen_recordings','interactionid','lodash','api','moment','bluebird','path','rimraf','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x4da46d,_0x40ce82){var _0x5c3f2e=function(_0x16490f){while(--_0x16490f){_0x4da46d['push'](_0x4da46d['shift']());}};_0x5c3f2e(++_0x40ce82);}(_0xe4a6,0x92));var _0x6e4a=function(_0x4527f1,_0x2d1dec){_0x4527f1=_0x4527f1-0x0;var _0x107e4d=_0xe4a6[_0x4527f1];return _0x107e4d;};'use strict';var _=require(_0x6e4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6e4a('0x1'));var moment=require(_0x6e4a('0x2'));var BPromise=require(_0x6e4a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e4a('0x4'));var rimraf=require(_0x6e4a('0x5'));var config=require('../../config/environment');var attributes=require(_0x6e4a('0x6'));module[_0x6e4a('0x7')]=function(_0x2a91d7,_0x405087){return _0x2a91d7[_0x6e4a('0x8')](_0x6e4a('0x9'),attributes,{'tableName':_0x6e4a('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x6e4a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index e4d8af6..44105d7 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aec=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3eb85a,_0xc9d2f){var _0x31a5ad=function(_0x316e1c){while(--_0x316e1c){_0x3eb85a['push'](_0x3eb85a['shift']());}};_0x31a5ad(++_0xc9d2f);}(_0x6aec,0x118));var _0xc6ae=function(_0x5a4113,_0x176853){_0x5a4113=_0x5a4113-0x0;var _0x2aaaf1=_0x6aec[_0x5a4113];return _0x2aaaf1;};'use strict';var _=require(_0xc6ae('0x0'));var util=require(_0xc6ae('0x1'));var moment=require(_0xc6ae('0x2'));var BPromise=require(_0xc6ae('0x3'));var rs=require(_0xc6ae('0x4'));var fs=require('fs');var Redis=require(_0xc6ae('0x5'));var db=require(_0xc6ae('0x6'))['db'];var utils=require(_0xc6ae('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc6ae('0x8'));var jayson=require(_0xc6ae('0x9'));var client=jayson[_0xc6ae('0xa')][_0xc6ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1244ee,_0x2bcaae,_0x3dcac4){return new BPromise(function(_0x12ea26,_0x38d1d2){return client[_0xc6ae('0xc')](_0x1244ee,_0x3dcac4)[_0xc6ae('0xd')](function(_0x4ead3c){logger[_0xc6ae('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x2bcaae,_0xc6ae('0xf'));logger['debug'](_0xc6ae('0x10'),_0x2bcaae,_0xc6ae('0xf'),JSON[_0xc6ae('0x11')](_0x4ead3c));if(_0x4ead3c[_0xc6ae('0x12')]){if(_0x4ead3c[_0xc6ae('0x12')]['code']===0x1f4){logger[_0xc6ae('0x12')](_0xc6ae('0x13'),_0x2bcaae,_0x4ead3c['error']['message']);return _0x38d1d2(_0x4ead3c[_0xc6ae('0x12')][_0xc6ae('0x14')]);}logger[_0xc6ae('0x12')](_0xc6ae('0x13'),_0x2bcaae,_0x4ead3c[_0xc6ae('0x12')][_0xc6ae('0x14')]);return _0x12ea26(_0x4ead3c[_0xc6ae('0x12')]['message']);}else{logger['info'](_0xc6ae('0x13'),_0x2bcaae,_0xc6ae('0xf'));_0x12ea26(_0x4ead3c[_0xc6ae('0x15')][_0xc6ae('0x14')]);}})['catch'](function(_0x5a4f76){logger[_0xc6ae('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x2bcaae,_0x5a4f76);_0x38d1d2(_0x5a4f76);});});} \ No newline at end of file +var _0x2686=['ScreenRecording,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','error'];(function(_0x405541,_0x2945cc){var _0x194a1e=function(_0x46fffe){while(--_0x46fffe){_0x405541['push'](_0x405541['shift']());}};_0x194a1e(++_0x2945cc);}(_0x2686,0xe0));var _0x6268=function(_0xb39737,_0x526a4c){_0xb39737=_0xb39737-0x0;var _0x5b8c98=_0x2686[_0xb39737];return _0x5b8c98;};'use strict';var _=require(_0x6268('0x0'));var util=require('util');var moment=require(_0x6268('0x1'));var BPromise=require(_0x6268('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6268('0x3'));var db=require(_0x6268('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6268('0x5'))(_0x6268('0x6'));var config=require(_0x6268('0x7'));var jayson=require(_0x6268('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x118201,_0x684972,_0x1c4a81){return new BPromise(function(_0xfd10be,_0x327408){return client['request'](_0x118201,_0x1c4a81)[_0x6268('0x9')](function(_0x1795c3){logger[_0x6268('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x684972,_0x6268('0xb'));logger[_0x6268('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x684972,_0x6268('0xb'),JSON['stringify'](_0x1795c3));if(_0x1795c3[_0x6268('0xd')]){if(_0x1795c3[_0x6268('0xd')]['code']===0x1f4){logger[_0x6268('0xd')](_0x6268('0xe'),_0x684972,_0x1795c3['error'][_0x6268('0xf')]);return _0x327408(_0x1795c3[_0x6268('0xd')][_0x6268('0xf')]);}logger[_0x6268('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x684972,_0x1795c3['error'][_0x6268('0xf')]);return _0xfd10be(_0x1795c3[_0x6268('0xd')][_0x6268('0xf')]);}else{logger[_0x6268('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x684972,_0x6268('0xb'));_0xfd10be(_0x1795c3['result']['message']);}})[_0x6268('0x10')](function(_0x5ee213){logger[_0x6268('0xd')](_0x6268('0xe'),_0x684972,_0x5ee213);_0x327408(_0x5ee213);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index bc53cd2..aa99fbb 100644 --- a/server/api/setting/index.js +++ b/server/api/setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbfa=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/now','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','addLogo','join','root','single','file','preferred','addPreferred','addFavicon','isAuthenticated','exports','multer','util','path'];(function(_0x2d7b9f,_0x96bcf3){var _0x54983f=function(_0x305011){while(--_0x305011){_0x2d7b9f['push'](_0x2d7b9f['shift']());}};_0x54983f(++_0x96bcf3);}(_0xcbfa,0x75));var _0xacbf=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0xcbfa[_0x285c85];return _0x2f81cd;};'use strict';var multer=require(_0xacbf('0x0'));var util=require(_0xacbf('0x1'));var path=require(_0xacbf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xacbf('0x3')]();var fs_extra=require(_0xacbf('0x4'));var auth=require(_0xacbf('0x5'));var interaction=require(_0xacbf('0x6'));var config=require(_0xacbf('0x7'));var controller=require('./setting.controller');router[_0xacbf('0x8')]('/',auth['isAuthenticated'](),controller[_0xacbf('0x9')]);router[_0xacbf('0x8')](_0xacbf('0xa'),controller['getDate']);router['get'](_0xacbf('0xb'),controller[_0xacbf('0xc')]);router[_0xacbf('0x8')](_0xacbf('0xd'),controller['getLogo']);router[_0xacbf('0x8')](_0xacbf('0xe'),controller[_0xacbf('0xf')]);router[_0xacbf('0x8')](_0xacbf('0x10'),controller[_0xacbf('0x11')]);router[_0xacbf('0x8')](_0xacbf('0x12'),controller[_0xacbf('0x13')]);router[_0xacbf('0x8')](_0xacbf('0x14'),controller[_0xacbf('0x15')]);var upload=multer({'storage':multer[_0xacbf('0x16')]({'destination':function(_0x23005e,_0x5e1baa,_0x35e8bb){_0x35e8bb(null,path['join'](config['root'],_0xacbf('0x17')));},'filename':function(_0x467b9f,_0x53a051,_0x551ee0){_0x551ee0(null,util[_0xacbf('0x18')](_0xacbf('0x19'),_0xacbf('0x1a'),path[_0xacbf('0x1b')](_0x53a051[_0xacbf('0x1c')])));}})});router[_0xacbf('0x1d')](_0xacbf('0xd'),upload['single']('file'),controller[_0xacbf('0x1e')]);var upload=multer({'storage':multer[_0xacbf('0x16')]({'destination':function(_0x3ce2d2,_0x402d05,_0x5c4197){_0x5c4197(null,path[_0xacbf('0x1f')](config[_0xacbf('0x20')],_0xacbf('0x17')));},'filename':function(_0x5e7fc2,_0x549d36,_0x4597f){_0x4597f(null,util['format']('%s%s','logologin',path['extname'](_0x549d36[_0xacbf('0x1c')])));}})});router[_0xacbf('0x1d')]('/:id/logo_login',upload[_0xacbf('0x21')](_0xacbf('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xacbf('0x16')]({'destination':function(_0x382915,_0x5ddfc7,_0x138ed9){_0x138ed9(null,path[_0xacbf('0x1f')](config[_0xacbf('0x20')],_0xacbf('0x17')));},'filename':function(_0x620f18,_0x13d3a6,_0x565b81){_0x565b81(null,util['format'](_0xacbf('0x19'),_0xacbf('0x23'),path['extname'](_0x13d3a6['originalname'])));}})});router[_0xacbf('0x1d')](_0xacbf('0x12'),upload[_0xacbf('0x21')](_0xacbf('0x22')),controller[_0xacbf('0x24')]);var upload=multer({'storage':multer[_0xacbf('0x16')]({'destination':function(_0x32717b,_0xc81789,_0x16b8c4){_0x16b8c4(null,path['join'](config[_0xacbf('0x20')],'server/files/images/logos/'));},'filename':function(_0x2d073d,_0xbd9879,_0x3b3167){_0x3b3167(null,util['format'](_0xacbf('0x19'),'favicon',path[_0xacbf('0x1b')](_0xbd9879[_0xacbf('0x1c')])));}})});router[_0xacbf('0x1d')](_0xacbf('0x14'),upload[_0xacbf('0x21')]('file'),controller[_0xacbf('0x25')]);router['put'](_0xacbf('0xb'),auth[_0xacbf('0x26')](),controller['update']);module[_0xacbf('0x27')]=router; \ No newline at end of file +var _0x4fea=['index','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','addLogo','join','logologin','file','addPreferred','favicon','addFavicon','update','multer','util','path','connect-timeout','express','Router','../../config/environment','./setting.controller','get','isAuthenticated'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x4fea,0x1f1));var _0xa4fe=function(_0x1eec2c,_0x4e0338){_0x1eec2c=_0x1eec2c-0x0;var _0x418ed1=_0x4fea[_0x1eec2c];return _0x418ed1;};'use strict';var multer=require(_0xa4fe('0x0'));var util=require(_0xa4fe('0x1'));var path=require(_0xa4fe('0x2'));var timeout=require(_0xa4fe('0x3'));var express=require(_0xa4fe('0x4'));var router=express[_0xa4fe('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa4fe('0x6'));var controller=require(_0xa4fe('0x7'));router[_0xa4fe('0x8')]('/',auth[_0xa4fe('0x9')](),controller[_0xa4fe('0xa')]);router[_0xa4fe('0x8')]('/now',controller['getDate']);router[_0xa4fe('0x8')](_0xa4fe('0xb'),controller[_0xa4fe('0xc')]);router[_0xa4fe('0x8')](_0xa4fe('0xd'),controller[_0xa4fe('0xe')]);router['get'](_0xa4fe('0xf'),controller[_0xa4fe('0x10')]);router[_0xa4fe('0x8')](_0xa4fe('0x11'),controller[_0xa4fe('0x12')]);router['get'](_0xa4fe('0x13'),controller['getPreferred']);router[_0xa4fe('0x8')]('/:id/favicon',controller[_0xa4fe('0x14')]);var upload=multer({'storage':multer[_0xa4fe('0x15')]({'destination':function(_0x4a9e4b,_0x11b9c8,_0x6119c7){_0x6119c7(null,path['join'](config[_0xa4fe('0x16')],_0xa4fe('0x17')));},'filename':function(_0xe2cd7b,_0x3b6d96,_0x4be09c){_0x4be09c(null,util[_0xa4fe('0x18')](_0xa4fe('0x19'),_0xa4fe('0x1a'),path[_0xa4fe('0x1b')](_0x3b6d96[_0xa4fe('0x1c')])));}})});router[_0xa4fe('0x1d')](_0xa4fe('0xd'),upload[_0xa4fe('0x1e')]('file'),controller[_0xa4fe('0x1f')]);var upload=multer({'storage':multer[_0xa4fe('0x15')]({'destination':function(_0x3f9971,_0x5ccc64,_0x41eb6a){_0x41eb6a(null,path[_0xa4fe('0x20')](config[_0xa4fe('0x16')],_0xa4fe('0x17')));},'filename':function(_0x41b55e,_0x5e293c,_0x43067a){_0x43067a(null,util[_0xa4fe('0x18')](_0xa4fe('0x19'),_0xa4fe('0x21'),path[_0xa4fe('0x1b')](_0x5e293c[_0xa4fe('0x1c')])));}})});router['post']('/:id/logo_login',upload[_0xa4fe('0x1e')](_0xa4fe('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xdd9f7c,_0x47573d,_0x1a588a){_0x1a588a(null,path[_0xa4fe('0x20')](config['root'],_0xa4fe('0x17')));},'filename':function(_0x1ad5f9,_0x1ba3c9,_0x48d248){_0x48d248(null,util[_0xa4fe('0x18')]('%s%s','preferred',path[_0xa4fe('0x1b')](_0x1ba3c9['originalname'])));}})});router[_0xa4fe('0x1d')](_0xa4fe('0x13'),upload[_0xa4fe('0x1e')](_0xa4fe('0x22')),controller[_0xa4fe('0x23')]);var upload=multer({'storage':multer[_0xa4fe('0x15')]({'destination':function(_0x59c90c,_0xeab867,_0x2d2496){_0x2d2496(null,path[_0xa4fe('0x20')](config[_0xa4fe('0x16')],_0xa4fe('0x17')));},'filename':function(_0x38d0d1,_0x22744a,_0x2693c9){_0x2693c9(null,util[_0xa4fe('0x18')]('%s%s',_0xa4fe('0x24'),path[_0xa4fe('0x1b')](_0x22744a[_0xa4fe('0x1c')])));}})});router[_0xa4fe('0x1d')]('/:id/favicon',upload[_0xa4fe('0x1e')](_0xa4fe('0x22')),controller[_0xa4fe('0x25')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa4fe('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index cbaa463..3365a2f 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd716=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0xd716,0x112));var _0x6d71=function(_0x16e3dc,_0x35770a){_0x16e3dc=_0x16e3dc-0x0;var _0x2f1001=_0xd716[_0x16e3dc];return _0x2f1001;};'use strict';var Sequelize=require('sequelize');module[_0x6d71('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x6d71('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x6d71('0x2')](0xb),'unique':_0x6d71('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x6d71('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x6d71('0x4')],'defaultValue':_0x6d71('0x5')},'logo':{'type':Sequelize[_0x6d71('0x4')]},'defaultLogo':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6d71('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x6d71('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6d71('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x6d71('0x4')]},'turnpassword':{'type':Sequelize[_0x6d71('0x4')]},'pageTitle':{'type':Sequelize[_0x6d71('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x6d71('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6d71('0x4')],'defaultValue':_0x6d71('0x7')},'enableEmailPreview':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6d71('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x6d71('0x4')]},'defaultFavicon':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x6d71('0x4')]},'sentiment':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6d71('0x4')]},'bucket':{'type':Sequelize[_0x6d71('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x6d71('0x2')](0x2)[_0x6d71('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x6d71('0x2')](0x2)[_0x6d71('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x6d71('0x2')](0x2)[_0x6d71('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x6d71('0x2')](0x2)[_0x6d71('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x4c09=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN'];(function(_0xd71f06,_0x1a56a5){var _0x2529c6=function(_0x3feecf){while(--_0x3feecf){_0xd71f06['push'](_0xd71f06['shift']());}};_0x2529c6(++_0x1a56a5);}(_0x4c09,0x1a7));var _0x94c0=function(_0x354803,_0x3b56d8){_0x354803=_0x354803-0x0;var _0x2e30ba=_0x4c09[_0x354803];return _0x2e30ba;};'use strict';var Sequelize=require(_0x94c0('0x0'));module[_0x94c0('0x1')]={'min_internal':{'type':Sequelize[_0x94c0('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x94c0('0x2')](0xb),'unique':_0x94c0('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x94c0('0x4')},'logo':{'type':Sequelize[_0x94c0('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x94c0('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x94c0('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x94c0('0x5')]},'turnaddr':{'type':Sequelize[_0x94c0('0x5')]},'turnusername':{'type':Sequelize[_0x94c0('0x5')]},'turnpassword':{'type':Sequelize[_0x94c0('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x94c0('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x94c0('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x94c0('0x5')],'defaultValue':_0x94c0('0x8')},'chatTimeout':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x94c0('0x5')]},'defaultPreferred':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x94c0('0x5')]},'defaultFavicon':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x94c0('0x5')]},'sentiment':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x94c0('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x94c0('0x2')](0x2)[_0x94c0('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x94c0('0x2')](0x2)[_0x94c0('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x94c0('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x94c0('0x2')](0x2)[_0x94c0('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x94c0('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x94c0('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index d48638f..efafcb1 100644 --- a/server/api/setting/setting.controller.js +++ b/server/api/setting/setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48c6=['getLicense','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','\x20not\x20found','download','getLogoLogin','favicon','defaultLoginLogo','Sequelize','ValidationError','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','Setting,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x48c6,0x17d));var _0x648c=function(_0x158b28,_0x292083){_0x158b28=_0x158b28-0x0;var _0x4fa88e=_0x48c6[_0x158b28];return _0x4fa88e;};'use strict';var emlformat=require(_0x648c('0x0'));var rimraf=require(_0x648c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x648c('0x2'));var rp=require(_0x648c('0x3'));var moment=require('moment');var BPromise=require(_0x648c('0x4'));var Mustache=require('mustache');var util=require(_0x648c('0x5'));var path=require(_0x648c('0x6'));var sox=require(_0x648c('0x7'));var csv=require(_0x648c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x648c('0x9'));var crypto=require(_0x648c('0xa'));var jsforce=require(_0x648c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x648c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x648c('0xc'));var authService=require(_0x648c('0xd'));var qs=require(_0x648c('0xe'));var as=require(_0x648c('0xf'));var hardwareService=require(_0x648c('0x10'));var logger=require(_0x648c('0x11'))(_0x648c('0x12'));var utils=require('../../config/utils');var config=require(_0x648c('0x13'));var licenseUtil=require(_0x648c('0x14'));var db=require(_0x648c('0x15'))['db'];var jayson=require(_0x648c('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f5cc1,_0x3de2b4,_0x485d5d,_0x2d0862){return new BPromise(function(_0x5105e7,_0x35f10e){var _0xf706ad=_0x2d0862||client;return _0xf706ad[_0x648c('0x17')](_0x2f5cc1,_0x485d5d)['then'](function(_0x1dd08d){logger[_0x648c('0x18')]('Setting,\x20%s,\x20%s',_0x3de2b4,_0x648c('0x19'));logger[_0x648c('0x1a')](_0x648c('0x1b'),_0x3de2b4,'request\x20sent',JSON[_0x648c('0x1c')](_0x1dd08d));if(_0x1dd08d[_0x648c('0x1d')]){if(_0x1dd08d[_0x648c('0x1d')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3de2b4,_0x1dd08d[_0x648c('0x1d')][_0x648c('0x1e')]);return _0x35f10e(_0x1dd08d[_0x648c('0x1d')]['message']);}logger[_0x648c('0x1d')](_0x648c('0x1f'),_0x3de2b4,_0x1dd08d['error']['message']);return _0x5105e7(_0x1dd08d[_0x648c('0x1d')]['message']);}else{logger[_0x648c('0x18')]('Setting,\x20%s,\x20%s',_0x3de2b4,_0x648c('0x19'));_0x5105e7(_0x1dd08d[_0x648c('0x20')][_0x648c('0x1e')]);}})[_0x648c('0x21')](function(_0x261785){logger['error'](_0x648c('0x1f'),_0x3de2b4,_0x261785);_0x35f10e(_0x261785);});});}function respondWithStatusCode(_0x5415f7,_0x5bdfa1){_0x5bdfa1=_0x5bdfa1||0xcc;return function(_0x422b7b){if(_0x422b7b){return _0x5415f7['sendStatus'](_0x5bdfa1);}return _0x5415f7[_0x648c('0x22')](_0x5bdfa1)[_0x648c('0x23')]();};}function respondWithResult(_0x3d9d9f,_0x1a4124){_0x1a4124=_0x1a4124||0xc8;return function(_0x4bfba7){if(_0x4bfba7){return _0x3d9d9f[_0x648c('0x22')](_0x1a4124)[_0x648c('0x24')](_0x4bfba7);}};}function respondWithFilteredResult(_0xd36efd,_0x3ff637){return function(_0x2d9b30){if(_0x2d9b30){var _0x4e5223=typeof _0x3ff637['offset']===_0x648c('0x25')&&typeof _0x3ff637[_0x648c('0x26')]===_0x648c('0x25');var _0x47c2cf=_0x2d9b30[_0x648c('0x27')];var _0x5f7323=_0x4e5223?0x0:_0x3ff637[_0x648c('0x28')];var _0x6f6768=_0x4e5223?_0x2d9b30[_0x648c('0x27')]:_0x3ff637[_0x648c('0x28')]+_0x3ff637['limit'];var _0x15ea60;if(_0x6f6768>=_0x47c2cf){_0x6f6768=_0x47c2cf;_0x15ea60=0xc8;}else{_0x15ea60=0xce;}_0xd36efd[_0x648c('0x22')](_0x15ea60);return _0xd36efd[_0x648c('0x29')]('Content-Range',_0x5f7323+'-'+_0x6f6768+'/'+_0x47c2cf)['json'](_0x2d9b30);}return null;};}function patchUpdates(_0x3d6e7e){return function(_0x52db81){try{jsonpatch[_0x648c('0x2a')](_0x52db81,_0x3d6e7e,!![]);}catch(_0x4eb89c){return BPromise[_0x648c('0x2b')](_0x4eb89c);}return _0x52db81[_0x648c('0x2c')]();};}function saveUpdates(_0x410271,_0x17fda8){return function(_0x2c191b){if(_0x2c191b){return _0x2c191b[_0x648c('0x2d')](_0x410271)[_0x648c('0x2e')](function(_0x193b3b){return _0x193b3b;});}return null;};}function removeEntity(_0x4564f8,_0x567faf){return function(_0x4b0c85){if(_0x4b0c85){return _0x4b0c85['destroy']()[_0x648c('0x2e')](function(){_0x4564f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c2a2,_0x2c9950){return function(_0x4b0a27){if(!_0x4b0a27){_0x50c2a2['sendStatus'](0x194);}return _0x4b0a27;};}function handleError(_0x4505af,_0x15fefb){_0x15fefb=_0x15fefb||0x1f4;return function(_0x138c1f){logger[_0x648c('0x1d')](_0x138c1f['stack']);if(_0x138c1f[_0x648c('0x2f')]){delete _0x138c1f[_0x648c('0x2f')];}_0x4505af[_0x648c('0x22')](_0x15fefb)[_0x648c('0x30')](_0x138c1f);};}exports[_0x648c('0x31')]=function(_0x36b36f,_0xc1c72){var _0x1dbeb1={},_0x379aba={},_0x275503={'count':0x0,'rows':[]};var _0x21ec61=_[_0x648c('0x32')](db[_0x648c('0x33')][_0x648c('0x34')],function(_0x1e277d){return{'name':_0x1e277d[_0x648c('0x35')],'type':_0x1e277d['type'][_0x648c('0x36')]};});_0x379aba[_0x648c('0x37')]=_[_0x648c('0x32')](_0x21ec61,'name');_0x379aba[_0x648c('0x38')]=_[_0x648c('0x39')](_0x36b36f[_0x648c('0x38')]);_0x379aba['filters']=_[_0x648c('0x3a')](_0x379aba[_0x648c('0x37')],_0x379aba[_0x648c('0x38')]);_0x1dbeb1[_0x648c('0x3b')]=_[_0x648c('0x3a')](_0x379aba[_0x648c('0x37')],qs[_0x648c('0x3c')](_0x36b36f[_0x648c('0x38')]['fields']));_0x1dbeb1['attributes']=_0x1dbeb1[_0x648c('0x3b')][_0x648c('0x3d')]?_0x1dbeb1[_0x648c('0x3b')]:_0x379aba[_0x648c('0x37')];if(!_0x36b36f[_0x648c('0x38')][_0x648c('0x3e')](_0x648c('0x3f'))){_0x1dbeb1[_0x648c('0x26')]=qs[_0x648c('0x26')](_0x36b36f[_0x648c('0x38')][_0x648c('0x26')]);_0x1dbeb1[_0x648c('0x28')]=qs[_0x648c('0x28')](_0x36b36f[_0x648c('0x38')][_0x648c('0x28')]);}_0x1dbeb1[_0x648c('0x40')]=qs[_0x648c('0x41')](_0x36b36f['query'][_0x648c('0x41')]);_0x1dbeb1['where']=qs['filters'](_['pick'](_0x36b36f[_0x648c('0x38')],_0x379aba[_0x648c('0x42')]),_0x21ec61);if(_0x36b36f[_0x648c('0x38')][_0x648c('0x43')]){_0x1dbeb1[_0x648c('0x44')]=_[_0x648c('0x45')](_0x1dbeb1[_0x648c('0x44')],{'$or':_[_0x648c('0x32')](_0x21ec61,function(_0x486727){if(_0x486727[_0x648c('0x46')]!==_0x648c('0x47')){var _0x76b669={};_0x76b669[_0x486727[_0x648c('0x2f')]]={'$like':'%'+_0x36b36f[_0x648c('0x38')]['filter']+'%'};return _0x76b669;}})});}_0x1dbeb1=_['merge']({},_0x1dbeb1,_0x36b36f[_0x648c('0x48')]);var _0x4d2e2a={'where':_0x1dbeb1[_0x648c('0x44')]};return db['Setting']['count'](_0x4d2e2a)[_0x648c('0x2e')](function(_0x211d31){_0x275503[_0x648c('0x27')]=_0x211d31;if(_0x36b36f[_0x648c('0x38')][_0x648c('0x49')]){_0x1dbeb1[_0x648c('0x4a')]=[{'all':!![]}];}return db[_0x648c('0x33')][_0x648c('0x4b')](_0x1dbeb1);})[_0x648c('0x2e')](function(_0xa3ef71){_0x275503['rows']=_0xa3ef71;return _0x275503;})[_0x648c('0x2e')](respondWithFilteredResult(_0xc1c72,_0x1dbeb1))['catch'](handleError(_0xc1c72,null));};exports[_0x648c('0x4c')]=function(_0x35436a,_0x14e3bc){var _0x10b0c5={'raw':![],'where':{'id':_0x35436a[_0x648c('0x4d')]['id']}},_0x533b1f={};_0x533b1f['model']=_[_0x648c('0x39')](db[_0x648c('0x33')]['rawAttributes']);_0x533b1f[_0x648c('0x38')]=_[_0x648c('0x39')](_0x35436a[_0x648c('0x38')]);_0x533b1f['filters']=_[_0x648c('0x3a')](_0x533b1f[_0x648c('0x37')],_0x533b1f[_0x648c('0x38')]);_0x10b0c5[_0x648c('0x3b')]=_[_0x648c('0x3a')](_0x533b1f['model'],qs['fields'](_0x35436a[_0x648c('0x38')][_0x648c('0x3c')]));_0x10b0c5[_0x648c('0x3b')]=_0x10b0c5['attributes']['length']?_0x10b0c5[_0x648c('0x3b')]:_0x533b1f[_0x648c('0x37')];if(_0x35436a[_0x648c('0x38')][_0x648c('0x49')]){_0x10b0c5[_0x648c('0x4a')]=[{'all':!![]}];}_0x10b0c5=_[_0x648c('0x45')]({},_0x10b0c5,_0x35436a[_0x648c('0x48')]);return db[_0x648c('0x33')][_0x648c('0x4e')](_0x10b0c5)[_0x648c('0x2e')](handleEntityNotFound(_0x14e3bc,null))['then'](respondWithResult(_0x14e3bc,null))[_0x648c('0x21')](handleError(_0x14e3bc,null));};exports[_0x648c('0x2d')]=function(_0x4d7cdc,_0x5d87ad){if(_0x4d7cdc[_0x648c('0x4f')]['id']){delete _0x4d7cdc[_0x648c('0x4f')]['id'];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x4d7cdc[_0x648c('0x4d')]['id']}})[_0x648c('0x2e')](handleEntityNotFound(_0x5d87ad,null))[_0x648c('0x2e')](saveUpdates(_0x4d7cdc[_0x648c('0x4f')],null))[_0x648c('0x2e')](respondWithResult(_0x5d87ad,null))[_0x648c('0x21')](handleError(_0x5d87ad,null));};exports[_0x648c('0x50')]=function(_0x237279,_0x193df4,_0x590a8d){if(_0x237279[_0x648c('0x51')]&&_0x237279[_0x648c('0x51')][_0x648c('0x52')]){_0x237279[_0x648c('0x4f')][_0x648c('0x53')]=_0x237279[_0x648c('0x51')][_0x648c('0x52')];}return db[_0x648c('0x33')]['find']({'where':{'id':_0x237279[_0x648c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x193df4,null))['then'](saveUpdates(_0x237279['body'],null))[_0x648c('0x2e')](respondWithResult(_0x193df4,null))['catch'](handleError(_0x193df4,null));};exports['addLogoLogin']=function(_0x2e7b12,_0x46896f,_0x4adacc){if(_0x2e7b12['file']&&_0x2e7b12[_0x648c('0x51')][_0x648c('0x52')]){_0x2e7b12['body'][_0x648c('0x54')]=_0x2e7b12[_0x648c('0x51')][_0x648c('0x52')];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x2e7b12[_0x648c('0x4d')]['id']}})[_0x648c('0x2e')](handleEntityNotFound(_0x46896f,null))[_0x648c('0x2e')](saveUpdates(_0x2e7b12['body'],null))[_0x648c('0x2e')](respondWithResult(_0x46896f,null))[_0x648c('0x21')](handleError(_0x46896f,null));};var utilLicense=require(_0x648c('0x14'));exports[_0x648c('0x55')]=function(_0x1f34a6,_0x5e1690,_0x315513){var _0x4544f0=_0x648c('0x56');var _0x5ecd3f={'custom':![]};return utilLicense[_0x648c('0x57')]()['then'](function(_0x48ce18){if(_0x48ce18){_0x5ecd3f=_0x48ce18;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x1f34a6['params']['id']},'attributes':[_0x648c('0x53'),_0x648c('0x54'),_0x648c('0x58'),'favicon',_0x648c('0x59'),'defaultLoginLogo',_0x648c('0x5a'),_0x648c('0x5b')],'raw':!![]});})[_0x648c('0x2e')](handleEntityNotFound(_0x5e1690,null))[_0x648c('0x2e')](function(_0x55e55f){if(_0x55e55f){var _0x130b4b=_0x55e55f[_0x648c('0x53')]&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_[_0x648c('0x5f')](_0x55e55f[_0x648c('0x53')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_[_0x648c('0x5f')](_0x55e55f[_0x648c('0x53')])):path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_[_0x648c('0x5f')](_0x648c('0x60')));var _0x35516e=_0x648c('0x61')+_[_0x648c('0x62')](_0x648c('0x53'));if(_0x55e55f[_0x35516e]||!_0x5ecd3f[_0x648c('0x63')]){_0x130b4b=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_['toLower'](_0x648c('0x60')));}if(!fs['existsSync'](_0x130b4b)){throw new db['Sequelize']['ValidationError'](_[_0x648c('0x62')](_0x648c('0x53'))+_0x648c('0x64'));}return _0x5e1690[_0x648c('0x65')](_0x130b4b);}})[_0x648c('0x21')](handleError(_0x5e1690,null));};var utilLicense=require(_0x648c('0x14'));exports[_0x648c('0x66')]=function(_0x46b4ac,_0x2ffa36,_0x41a167){var _0x4e9e42='server/files/images/logos';var _0x3f0ab2={'custom':![]};return utilLicense[_0x648c('0x57')]()[_0x648c('0x2e')](function(_0x4b7f22){if(_0x4b7f22){_0x3f0ab2=_0x4b7f22;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x46b4ac[_0x648c('0x4d')]['id']},'attributes':['logo',_0x648c('0x54'),_0x648c('0x58'),_0x648c('0x67'),_0x648c('0x59'),_0x648c('0x68'),_0x648c('0x5a'),_0x648c('0x5b')],'raw':!![]});})[_0x648c('0x2e')](handleEntityNotFound(_0x2ffa36,null))['then'](function(_0x3deb7a){if(_0x3deb7a){var _0x12e9d9=_0x3deb7a[_0x648c('0x54')]&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')](_0x3deb7a[_0x648c('0x54')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')](_0x3deb7a[_0x648c('0x54')])):path['join'](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')]('default_loginLogo.svg'));var _0x21f88f=_0x648c('0x61')+_['upperFirst'](_0x648c('0x54'));if(_0x3deb7a[_0x21f88f]||!_0x3f0ab2[_0x648c('0x63')]){_0x12e9d9=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x12e9d9)){throw new db[(_0x648c('0x69'))][(_0x648c('0x6a'))](_[_0x648c('0x62')](_0x648c('0x54'))+_0x648c('0x64'));}return _0x2ffa36[_0x648c('0x65')](_0x12e9d9);}})[_0x648c('0x21')](handleError(_0x2ffa36,null));};exports['gdpr']=function(_0x202101,_0x37f250){return db[_0x648c('0x33')]['find']({'where':{'id':_0x202101[_0x648c('0x4d')]['id']},'attributes':[_0x648c('0x6b')]})[_0x648c('0x2e')](respondWithResult(_0x37f250,null))['catch'](handleError(_0x37f250,null));};exports[_0x648c('0x6c')]=function(_0x1ff72e,_0x28976c,_0x48063c){if(_0x1ff72e[_0x648c('0x51')]&&_0x1ff72e['file'][_0x648c('0x52')]){_0x1ff72e[_0x648c('0x4f')][_0x648c('0x58')]=_0x1ff72e['file'][_0x648c('0x52')];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x1ff72e[_0x648c('0x4d')]['id']}})[_0x648c('0x2e')](handleEntityNotFound(_0x28976c,null))[_0x648c('0x2e')](saveUpdates(_0x1ff72e[_0x648c('0x4f')],null))['then'](respondWithResult(_0x28976c,null))[_0x648c('0x21')](handleError(_0x28976c,null));};var utilLicense=require(_0x648c('0x14'));exports[_0x648c('0x6d')]=function(_0x5582ff,_0xbbd7a5,_0x2af2ed){var _0x552390=_0x648c('0x56');var _0x4e19eb={'custom':![]};return utilLicense['getLicense']()[_0x648c('0x2e')](function(_0x46743a){if(_0x46743a){_0x4e19eb=_0x46743a;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x5582ff['params']['id']},'attributes':['logo',_0x648c('0x54'),_0x648c('0x58'),_0x648c('0x67'),_0x648c('0x59'),'defaultLoginLogo',_0x648c('0x5a'),_0x648c('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0xbbd7a5,null))[_0x648c('0x2e')](function(_0x45451e){if(_0x45451e){var _0x323729=_0x45451e['preferred']&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x552390,_[_0x648c('0x5f')](_0x45451e[_0x648c('0x58')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x552390,_[_0x648c('0x5f')](_0x45451e[_0x648c('0x58')])):path['join'](config[_0x648c('0x5e')],_0x552390,_[_0x648c('0x5f')](_0x648c('0x6e')));var _0x4fa36d=_0x648c('0x61')+_['upperFirst']('preferred');if(_0x45451e[_0x4fa36d]||!_0x4e19eb[_0x648c('0x63')]||!_0x4e19eb['preferred']){_0x323729=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x552390,_['toLower'](_0x648c('0x6e')));}if(!fs[_0x648c('0x5c')](_0x323729)){throw new db[(_0x648c('0x69'))]['ValidationError'](_[_0x648c('0x62')]('preferred')+_0x648c('0x64'));}return _0xbbd7a5[_0x648c('0x65')](_0x323729);}})[_0x648c('0x21')](handleError(_0xbbd7a5,null));};exports[_0x648c('0x6f')]=function(_0x4a734b,_0x43271d,_0x100fe7){if(_0x4a734b[_0x648c('0x51')]&&_0x4a734b[_0x648c('0x51')]['filename']){_0x4a734b[_0x648c('0x4f')]['favicon']=_0x4a734b['file'][_0x648c('0x52')];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x4a734b[_0x648c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43271d,null))['then'](saveUpdates(_0x4a734b[_0x648c('0x4f')],null))['then'](respondWithResult(_0x43271d,null))[_0x648c('0x21')](handleError(_0x43271d,null));};var utilLicense=require(_0x648c('0x14'));exports['getFavicon']=function(_0x507797,_0x265576,_0x12783d){var _0x5c012a=_0x648c('0x56');var _0x255756={'custom':![]};return utilLicense[_0x648c('0x57')]()[_0x648c('0x2e')](function(_0xf16e17){if(_0xf16e17){_0x255756=_0xf16e17;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x507797['params']['id']},'attributes':['logo','loginLogo',_0x648c('0x58'),_0x648c('0x67'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x648c('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x265576,null))[_0x648c('0x2e')](function(_0x45832f){if(_0x45832f){var _0x41f5ff=_0x45832f['favicon']&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config['root'],_0x5c012a,_[_0x648c('0x5f')](_0x45832f[_0x648c('0x67')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x5c012a,_[_0x648c('0x5f')](_0x45832f[_0x648c('0x67')])):path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x5c012a,_[_0x648c('0x5f')](_0x648c('0x70')));var _0x499a06=_0x648c('0x61')+_['upperFirst'](_0x648c('0x67'));if(_0x45832f[_0x499a06]||!_0x255756[_0x648c('0x63')]){_0x41f5ff=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x5c012a,_[_0x648c('0x5f')](_0x648c('0x70')));}if(!fs['existsSync'](_0x41f5ff)){throw new db[(_0x648c('0x69'))][(_0x648c('0x6a'))](_['upperFirst'](_0x648c('0x67'))+_0x648c('0x64'));}return _0x265576[_0x648c('0x65')](_0x41f5ff);}})[_0x648c('0x21')](handleError(_0x265576,null));};exports[_0x648c('0x71')]=function(_0x1201a5,_0x5151a1){var _0x202acd={'offset':moment()[_0x648c('0x72')]()};_0x202acd['now']=moment()[_0x648c('0x72')](_0x202acd[_0x648c('0x28')])[_0x648c('0x73')](_0x648c('0x74'));return _0x5151a1[_0x648c('0x22')](0xc8)['send'](_0x202acd);}; \ No newline at end of file +var _0x3036=['count','reject','update','destroy','end','stack','name','index','Setting','rawAttributes','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','keys','find','body','addLogo','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','getLogoLogin','default_loginLogo.svg','ValidationError','securePassword','addPreferred','getPreferred','default_preferred.png','download','defaultLoginLogo','default_favicon.ico','getDate','utcOffset','now','format','send','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3036,0x1a9));var _0x6303=function(_0x51a013,_0x241f6c){_0x51a013=_0x51a013-0x0;var _0x1fd84e=_0x3036[_0x51a013];return _0x1fd84e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6303('0x0'));var jsonpatch=require(_0x6303('0x1'));var rp=require(_0x6303('0x2'));var moment=require('moment');var BPromise=require(_0x6303('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6303('0x4'));var csv=require('to-csv');var ejs=require(_0x6303('0x5'));var fs=require('fs');var fs_extra=require(_0x6303('0x6'));var _=require(_0x6303('0x7'));var squel=require('squel');var crypto=require(_0x6303('0x8'));var jsforce=require(_0x6303('0x9'));var deskjs=require(_0x6303('0xa'));var toCsv=require(_0x6303('0xb'));var querystring=require(_0x6303('0xc'));var Papa=require(_0x6303('0xd'));var Redis=require(_0x6303('0xe'));var authService=require(_0x6303('0xf'));var qs=require(_0x6303('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6303('0x11'));var logger=require(_0x6303('0x12'))(_0x6303('0x13'));var utils=require(_0x6303('0x14'));var config=require(_0x6303('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6303('0x16'))['db'];var jayson=require(_0x6303('0x17'));var client=jayson[_0x6303('0x18')][_0x6303('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x284a8b,_0x48462d,_0x5ef678,_0x5d75c1){return new BPromise(function(_0x2726ef,_0x3f8f56){var _0x251995=_0x5d75c1||client;return _0x251995[_0x6303('0x1a')](_0x284a8b,_0x5ef678)[_0x6303('0x1b')](function(_0x43526d){logger[_0x6303('0x1c')](_0x6303('0x1d'),_0x48462d,_0x6303('0x1e'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x48462d,_0x6303('0x1e'),JSON[_0x6303('0x1f')](_0x43526d));if(_0x43526d[_0x6303('0x20')]){if(_0x43526d[_0x6303('0x20')][_0x6303('0x21')]===0x1f4){logger['error'](_0x6303('0x1d'),_0x48462d,_0x43526d[_0x6303('0x20')][_0x6303('0x22')]);return _0x3f8f56(_0x43526d[_0x6303('0x20')][_0x6303('0x22')]);}logger[_0x6303('0x20')](_0x6303('0x1d'),_0x48462d,_0x43526d[_0x6303('0x20')][_0x6303('0x22')]);return _0x2726ef(_0x43526d[_0x6303('0x20')][_0x6303('0x22')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x48462d,_0x6303('0x1e'));_0x2726ef(_0x43526d[_0x6303('0x23')][_0x6303('0x22')]);}})[_0x6303('0x24')](function(_0x52235a){logger[_0x6303('0x20')](_0x6303('0x1d'),_0x48462d,_0x52235a);_0x3f8f56(_0x52235a);});});}function respondWithStatusCode(_0x2872e8,_0x18b80a){_0x18b80a=_0x18b80a||0xcc;return function(_0x1336de){if(_0x1336de){return _0x2872e8[_0x6303('0x25')](_0x18b80a);}return _0x2872e8[_0x6303('0x26')](_0x18b80a)['end']();};}function respondWithResult(_0x5cb1b5,_0x135434){_0x135434=_0x135434||0xc8;return function(_0x3fed67){if(_0x3fed67){return _0x5cb1b5['status'](_0x135434)[_0x6303('0x27')](_0x3fed67);}};}function respondWithFilteredResult(_0x38605f,_0x294049){return function(_0x53adbd){if(_0x53adbd){var _0x1e7d33=typeof _0x294049[_0x6303('0x28')]===_0x6303('0x29')&&typeof _0x294049[_0x6303('0x2a')]===_0x6303('0x29');var _0x24b2fc=_0x53adbd[_0x6303('0x2b')];var _0x3bcf79=_0x1e7d33?0x0:_0x294049[_0x6303('0x28')];var _0x29cd61=_0x1e7d33?_0x53adbd[_0x6303('0x2b')]:_0x294049['offset']+_0x294049[_0x6303('0x2a')];var _0x4d1e98;if(_0x29cd61>=_0x24b2fc){_0x29cd61=_0x24b2fc;_0x4d1e98=0xc8;}else{_0x4d1e98=0xce;}_0x38605f[_0x6303('0x26')](_0x4d1e98);return _0x38605f['set']('Content-Range',_0x3bcf79+'-'+_0x29cd61+'/'+_0x24b2fc)[_0x6303('0x27')](_0x53adbd);}return null;};}function patchUpdates(_0x45b623){return function(_0x24f68a){try{jsonpatch['apply'](_0x24f68a,_0x45b623,!![]);}catch(_0x5e8200){return BPromise[_0x6303('0x2c')](_0x5e8200);}return _0x24f68a['save']();};}function saveUpdates(_0x4a9d34,_0x57f803){return function(_0x37ff87){if(_0x37ff87){return _0x37ff87[_0x6303('0x2d')](_0x4a9d34)[_0x6303('0x1b')](function(_0x16df21){return _0x16df21;});}return null;};}function removeEntity(_0x52dfc7,_0x3d00da){return function(_0x32ac2e){if(_0x32ac2e){return _0x32ac2e[_0x6303('0x2e')]()['then'](function(){_0x52dfc7['status'](0xcc)[_0x6303('0x2f')]();});}};}function handleEntityNotFound(_0x561766,_0x1afd81){return function(_0x11b368){if(!_0x11b368){_0x561766[_0x6303('0x25')](0x194);}return _0x11b368;};}function handleError(_0x2db401,_0x470f56){_0x470f56=_0x470f56||0x1f4;return function(_0x57dc5d){logger[_0x6303('0x20')](_0x57dc5d[_0x6303('0x30')]);if(_0x57dc5d[_0x6303('0x31')]){delete _0x57dc5d[_0x6303('0x31')];}_0x2db401[_0x6303('0x26')](_0x470f56)['send'](_0x57dc5d);};}exports[_0x6303('0x32')]=function(_0x3df648,_0x3407f8){var _0x127fd5={},_0x2a4e20={},_0x540eb5={'count':0x0,'rows':[]};var _0x11f497=_['map'](db[_0x6303('0x33')][_0x6303('0x34')],function(_0x38f5f3){return{'name':_0x38f5f3['fieldName'],'type':_0x38f5f3['type'][_0x6303('0x35')]};});_0x2a4e20['model']=_[_0x6303('0x36')](_0x11f497,_0x6303('0x31'));_0x2a4e20[_0x6303('0x37')]=_['keys'](_0x3df648['query']);_0x2a4e20[_0x6303('0x38')]=_[_0x6303('0x39')](_0x2a4e20[_0x6303('0x3a')],_0x2a4e20[_0x6303('0x37')]);_0x127fd5[_0x6303('0x3b')]=_[_0x6303('0x39')](_0x2a4e20['model'],qs[_0x6303('0x3c')](_0x3df648['query'][_0x6303('0x3c')]));_0x127fd5['attributes']=_0x127fd5[_0x6303('0x3b')][_0x6303('0x3d')]?_0x127fd5[_0x6303('0x3b')]:_0x2a4e20[_0x6303('0x3a')];if(!_0x3df648['query'][_0x6303('0x3e')]('nolimit')){_0x127fd5[_0x6303('0x2a')]=qs[_0x6303('0x2a')](_0x3df648['query'][_0x6303('0x2a')]);_0x127fd5[_0x6303('0x28')]=qs['offset'](_0x3df648[_0x6303('0x37')]['offset']);}_0x127fd5[_0x6303('0x3f')]=qs['sort'](_0x3df648['query']['sort']);_0x127fd5[_0x6303('0x40')]=qs[_0x6303('0x38')](_['pick'](_0x3df648['query'],_0x2a4e20[_0x6303('0x38')]),_0x11f497);if(_0x3df648[_0x6303('0x37')]['filter']){_0x127fd5[_0x6303('0x40')]=_[_0x6303('0x41')](_0x127fd5[_0x6303('0x40')],{'$or':_[_0x6303('0x36')](_0x11f497,function(_0x5e2d51){if(_0x5e2d51[_0x6303('0x42')]!==_0x6303('0x43')){var _0x85ff3c={};_0x85ff3c[_0x5e2d51['name']]={'$like':'%'+_0x3df648[_0x6303('0x37')][_0x6303('0x44')]+'%'};return _0x85ff3c;}})});}_0x127fd5=_[_0x6303('0x41')]({},_0x127fd5,_0x3df648[_0x6303('0x45')]);var _0x692daa={'where':_0x127fd5[_0x6303('0x40')]};return db['Setting']['count'](_0x692daa)[_0x6303('0x1b')](function(_0x3e8366){_0x540eb5['count']=_0x3e8366;if(_0x3df648[_0x6303('0x37')][_0x6303('0x46')]){_0x127fd5[_0x6303('0x47')]=[{'all':!![]}];}return db[_0x6303('0x33')]['findAll'](_0x127fd5);})[_0x6303('0x1b')](function(_0x154df3){_0x540eb5[_0x6303('0x48')]=_0x154df3;return _0x540eb5;})[_0x6303('0x1b')](respondWithFilteredResult(_0x3407f8,_0x127fd5))['catch'](handleError(_0x3407f8,null));};exports[_0x6303('0x49')]=function(_0x29c701,_0x51a7ac){var _0x31f0e7={'raw':![],'where':{'id':_0x29c701[_0x6303('0x4a')]['id']}},_0x174121={};_0x174121[_0x6303('0x3a')]=_[_0x6303('0x4b')](db[_0x6303('0x33')][_0x6303('0x34')]);_0x174121[_0x6303('0x37')]=_[_0x6303('0x4b')](_0x29c701[_0x6303('0x37')]);_0x174121[_0x6303('0x38')]=_[_0x6303('0x39')](_0x174121[_0x6303('0x3a')],_0x174121['query']);_0x31f0e7[_0x6303('0x3b')]=_['intersection'](_0x174121[_0x6303('0x3a')],qs[_0x6303('0x3c')](_0x29c701['query']['fields']));_0x31f0e7[_0x6303('0x3b')]=_0x31f0e7[_0x6303('0x3b')][_0x6303('0x3d')]?_0x31f0e7[_0x6303('0x3b')]:_0x174121[_0x6303('0x3a')];if(_0x29c701[_0x6303('0x37')][_0x6303('0x46')]){_0x31f0e7[_0x6303('0x47')]=[{'all':!![]}];}_0x31f0e7=_[_0x6303('0x41')]({},_0x31f0e7,_0x29c701[_0x6303('0x45')]);return db[_0x6303('0x33')][_0x6303('0x4c')](_0x31f0e7)[_0x6303('0x1b')](handleEntityNotFound(_0x51a7ac,null))['then'](respondWithResult(_0x51a7ac,null))[_0x6303('0x24')](handleError(_0x51a7ac,null));};exports['update']=function(_0x5d3e0f,_0x59e6ea){if(_0x5d3e0f[_0x6303('0x4d')]['id']){delete _0x5d3e0f['body']['id'];}return db['Setting']['find']({'where':{'id':_0x5d3e0f[_0x6303('0x4a')]['id']}})[_0x6303('0x1b')](handleEntityNotFound(_0x59e6ea,null))['then'](saveUpdates(_0x5d3e0f[_0x6303('0x4d')],null))['then'](respondWithResult(_0x59e6ea,null))['catch'](handleError(_0x59e6ea,null));};exports[_0x6303('0x4e')]=function(_0x1cd73d,_0x180188,_0x15ae67){if(_0x1cd73d[_0x6303('0x4f')]&&_0x1cd73d[_0x6303('0x4f')][_0x6303('0x50')]){_0x1cd73d[_0x6303('0x4d')][_0x6303('0x51')]=_0x1cd73d[_0x6303('0x4f')]['filename'];}return db[_0x6303('0x33')]['find']({'where':{'id':_0x1cd73d[_0x6303('0x4a')]['id']}})[_0x6303('0x1b')](handleEntityNotFound(_0x180188,null))[_0x6303('0x1b')](saveUpdates(_0x1cd73d[_0x6303('0x4d')],null))[_0x6303('0x1b')](respondWithResult(_0x180188,null))['catch'](handleError(_0x180188,null));};exports['addLogoLogin']=function(_0x3de3a4,_0x502eb0,_0x36dc30){if(_0x3de3a4['file']&&_0x3de3a4[_0x6303('0x4f')]['filename']){_0x3de3a4['body'][_0x6303('0x52')]=_0x3de3a4[_0x6303('0x4f')]['filename'];}return db[_0x6303('0x33')][_0x6303('0x4c')]({'where':{'id':_0x3de3a4[_0x6303('0x4a')]['id']}})[_0x6303('0x1b')](handleEntityNotFound(_0x502eb0,null))['then'](saveUpdates(_0x3de3a4[_0x6303('0x4d')],null))[_0x6303('0x1b')](respondWithResult(_0x502eb0,null))[_0x6303('0x24')](handleError(_0x502eb0,null));};var utilLicense=require(_0x6303('0x53'));exports[_0x6303('0x54')]=function(_0x4d3d24,_0x5d8bea,_0x3f9fb4){var _0x42d5d5=_0x6303('0x55');var _0x576e13={'custom':![]};return utilLicense[_0x6303('0x56')]()[_0x6303('0x1b')](function(_0x35c787){if(_0x35c787){_0x576e13=_0x35c787;}return db[_0x6303('0x33')][_0x6303('0x4c')]({'where':{'id':_0x4d3d24[_0x6303('0x4a')]['id']},'attributes':[_0x6303('0x51'),'loginLogo',_0x6303('0x57'),_0x6303('0x58'),_0x6303('0x59'),'defaultLoginLogo',_0x6303('0x5a'),_0x6303('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d8bea,null))[_0x6303('0x1b')](function(_0x2335ef){if(_0x2335ef){var _0x5c8adf=_0x2335ef[_0x6303('0x51')]&&fs[_0x6303('0x5c')](path[_0x6303('0x5d')](config[_0x6303('0x5e')],_0x42d5d5,_[_0x6303('0x5f')](_0x2335ef[_0x6303('0x51')])))?path[_0x6303('0x5d')](config[_0x6303('0x5e')],_0x42d5d5,_['toLower'](_0x2335ef[_0x6303('0x51')])):path[_0x6303('0x5d')](config[_0x6303('0x5e')],_0x42d5d5,_[_0x6303('0x5f')](_0x6303('0x60')));var _0xe708ef=_0x6303('0x61')+_[_0x6303('0x62')](_0x6303('0x51'));if(_0x2335ef[_0xe708ef]||!_0x576e13[_0x6303('0x63')]){_0x5c8adf=path[_0x6303('0x5d')](config['root'],_0x42d5d5,_['toLower'](_0x6303('0x60')));}if(!fs[_0x6303('0x5c')](_0x5c8adf)){throw new db[(_0x6303('0x64'))]['ValidationError'](_['upperFirst'](_0x6303('0x51'))+_0x6303('0x65'));}return _0x5d8bea['download'](_0x5c8adf);}})[_0x6303('0x24')](handleError(_0x5d8bea,null));};var utilLicense=require('../../config/license/util');exports[_0x6303('0x66')]=function(_0x2641eb,_0x4f0277,_0x4876a2){var _0x289885='server/files/images/logos';var _0x3cdfce={'custom':![]};return utilLicense[_0x6303('0x56')]()[_0x6303('0x1b')](function(_0x12c84c){if(_0x12c84c){_0x3cdfce=_0x12c84c;}return db['Setting']['find']({'where':{'id':_0x2641eb[_0x6303('0x4a')]['id']},'attributes':[_0x6303('0x51'),_0x6303('0x52'),_0x6303('0x57'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred',_0x6303('0x5b')],'raw':!![]});})[_0x6303('0x1b')](handleEntityNotFound(_0x4f0277,null))['then'](function(_0x34b8cd){if(_0x34b8cd){var _0x4e3d25=_0x34b8cd[_0x6303('0x52')]&&fs[_0x6303('0x5c')](path[_0x6303('0x5d')](config['root'],_0x289885,_['toLower'](_0x34b8cd[_0x6303('0x52')])))?path[_0x6303('0x5d')](config['root'],_0x289885,_[_0x6303('0x5f')](_0x34b8cd[_0x6303('0x52')])):path[_0x6303('0x5d')](config[_0x6303('0x5e')],_0x289885,_[_0x6303('0x5f')]('default_loginLogo.svg'));var _0x50b695=_0x6303('0x61')+_[_0x6303('0x62')]('loginLogo');if(_0x34b8cd[_0x50b695]||!_0x3cdfce['custom']){_0x4e3d25=path['join'](config[_0x6303('0x5e')],_0x289885,_['toLower'](_0x6303('0x67')));}if(!fs[_0x6303('0x5c')](_0x4e3d25)){throw new db[(_0x6303('0x64'))][(_0x6303('0x68'))](_[_0x6303('0x62')]('loginLogo')+_0x6303('0x65'));}return _0x4f0277['download'](_0x4e3d25);}})[_0x6303('0x24')](handleError(_0x4f0277,null));};exports['gdpr']=function(_0x17ac20,_0x10692a){return db[_0x6303('0x33')]['find']({'where':{'id':_0x17ac20[_0x6303('0x4a')]['id']},'attributes':[_0x6303('0x69')]})[_0x6303('0x1b')](respondWithResult(_0x10692a,null))[_0x6303('0x24')](handleError(_0x10692a,null));};exports[_0x6303('0x6a')]=function(_0x16729e,_0x292026,_0x55e808){if(_0x16729e[_0x6303('0x4f')]&&_0x16729e[_0x6303('0x4f')][_0x6303('0x50')]){_0x16729e[_0x6303('0x4d')][_0x6303('0x57')]=_0x16729e[_0x6303('0x4f')][_0x6303('0x50')];}return db['Setting'][_0x6303('0x4c')]({'where':{'id':_0x16729e['params']['id']}})['then'](handleEntityNotFound(_0x292026,null))[_0x6303('0x1b')](saveUpdates(_0x16729e[_0x6303('0x4d')],null))['then'](respondWithResult(_0x292026,null))['catch'](handleError(_0x292026,null));};var utilLicense=require('../../config/license/util');exports[_0x6303('0x6b')]=function(_0xeb08a,_0x3908b2,_0x2784fb){var _0x1ca960=_0x6303('0x55');var _0xc321db={'custom':![]};return utilLicense[_0x6303('0x56')]()['then'](function(_0x44a4d4){if(_0x44a4d4){_0xc321db=_0x44a4d4;}return db[_0x6303('0x33')]['find']({'where':{'id':_0xeb08a[_0x6303('0x4a')]['id']},'attributes':[_0x6303('0x51'),_0x6303('0x52'),'preferred',_0x6303('0x58'),'defaultLogo','defaultLoginLogo',_0x6303('0x5a'),_0x6303('0x5b')],'raw':!![]});})[_0x6303('0x1b')](handleEntityNotFound(_0x3908b2,null))['then'](function(_0xe2c579){if(_0xe2c579){var _0x4973df=_0xe2c579[_0x6303('0x57')]&&fs[_0x6303('0x5c')](path[_0x6303('0x5d')](config[_0x6303('0x5e')],_0x1ca960,_[_0x6303('0x5f')](_0xe2c579['preferred'])))?path['join'](config[_0x6303('0x5e')],_0x1ca960,_[_0x6303('0x5f')](_0xe2c579[_0x6303('0x57')])):path['join'](config[_0x6303('0x5e')],_0x1ca960,_['toLower']('default_preferred.png'));var _0x5437a4=_0x6303('0x61')+_['upperFirst']('preferred');if(_0xe2c579[_0x5437a4]||!_0xc321db['custom']||!_0xc321db[_0x6303('0x57')]){_0x4973df=path[_0x6303('0x5d')](config[_0x6303('0x5e')],_0x1ca960,_[_0x6303('0x5f')](_0x6303('0x6c')));}if(!fs[_0x6303('0x5c')](_0x4973df)){throw new db[(_0x6303('0x64'))][(_0x6303('0x68'))](_[_0x6303('0x62')](_0x6303('0x57'))+_0x6303('0x65'));}return _0x3908b2[_0x6303('0x6d')](_0x4973df);}})[_0x6303('0x24')](handleError(_0x3908b2,null));};exports['addFavicon']=function(_0x302c2f,_0x624f1e,_0x5d0417){if(_0x302c2f[_0x6303('0x4f')]&&_0x302c2f[_0x6303('0x4f')]['filename']){_0x302c2f['body'][_0x6303('0x58')]=_0x302c2f[_0x6303('0x4f')][_0x6303('0x50')];}return db['Setting'][_0x6303('0x4c')]({'where':{'id':_0x302c2f[_0x6303('0x4a')]['id']}})['then'](handleEntityNotFound(_0x624f1e,null))['then'](saveUpdates(_0x302c2f['body'],null))[_0x6303('0x1b')](respondWithResult(_0x624f1e,null))['catch'](handleError(_0x624f1e,null));};var utilLicense=require(_0x6303('0x53'));exports['getFavicon']=function(_0x22e82b,_0x138107,_0x525f66){var _0x4e8ddc=_0x6303('0x55');var _0x11170b={'custom':![]};return utilLicense[_0x6303('0x56')]()['then'](function(_0xc46c7e){if(_0xc46c7e){_0x11170b=_0xc46c7e;}return db[_0x6303('0x33')][_0x6303('0x4c')]({'where':{'id':_0x22e82b[_0x6303('0x4a')]['id']},'attributes':[_0x6303('0x51'),_0x6303('0x52'),_0x6303('0x57'),_0x6303('0x58'),_0x6303('0x59'),_0x6303('0x6e'),'defaultPreferred',_0x6303('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x138107,null))[_0x6303('0x1b')](function(_0x205261){if(_0x205261){var _0x1179f9=_0x205261[_0x6303('0x58')]&&fs[_0x6303('0x5c')](path[_0x6303('0x5d')](config[_0x6303('0x5e')],_0x4e8ddc,_[_0x6303('0x5f')](_0x205261[_0x6303('0x58')])))?path[_0x6303('0x5d')](config[_0x6303('0x5e')],_0x4e8ddc,_[_0x6303('0x5f')](_0x205261[_0x6303('0x58')])):path[_0x6303('0x5d')](config['root'],_0x4e8ddc,_['toLower']('default_favicon.ico'));var _0x27c09f=_0x6303('0x61')+_['upperFirst'](_0x6303('0x58'));if(_0x205261[_0x27c09f]||!_0x11170b[_0x6303('0x63')]){_0x1179f9=path[_0x6303('0x5d')](config[_0x6303('0x5e')],_0x4e8ddc,_[_0x6303('0x5f')](_0x6303('0x6f')));}if(!fs[_0x6303('0x5c')](_0x1179f9)){throw new db[(_0x6303('0x64'))][(_0x6303('0x68'))](_[_0x6303('0x62')](_0x6303('0x58'))+_0x6303('0x65'));}return _0x138107[_0x6303('0x6d')](_0x1179f9);}})[_0x6303('0x24')](handleError(_0x138107,null));};exports[_0x6303('0x70')]=function(_0x162178,_0x1a76b7){var _0x59157c={'offset':moment()[_0x6303('0x71')]()};_0x59157c[_0x6303('0x72')]=moment()[_0x6303('0x71')](_0x59157c[_0x6303('0x28')])[_0x6303('0x73')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x1a76b7[_0x6303('0x26')](0xc8)[_0x6303('0x74')](_0x59157c);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 17a5c34..f66dc85 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x1979f4,_0x3f339f){var _0xb67f6e=function(_0x4dc64c){while(--_0x4dc64c){_0x1979f4['push'](_0x1979f4['shift']());}};_0xb67f6e(++_0x3f339f);}(_0xe14b,0x93));var _0xbe14=function(_0x572525,_0x3f9f0b){_0x572525=_0x572525-0x0;var _0x2dd09d=_0xe14b[_0x572525];return _0x2dd09d;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0x3e74,0x175));var _0x43e7=function(_0x1171e9,_0x2e1bb8){_0x1171e9=_0x1171e9-0x0;var _0x5c9373=_0x3e74[_0x1171e9];return _0x5c9373;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 7763149..2bcbc5a 100644 --- a/server/api/setting/setting.rpc.js +++ b/server/api/setting/setting.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa7d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','Setting,\x20%s,\x20%s','result','ShowSetting','Setting','options','raw','attributes','include','model','map','catch','lodash','util','moment','bluebird'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xaa7d,0x1ec));var _0xdaa7=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xaa7d[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xdaa7('0x0'));var util=require(_0xdaa7('0x1'));var moment=require(_0xdaa7('0x2'));var BPromise=require(_0xdaa7('0x3'));var rs=require(_0xdaa7('0x4'));var fs=require('fs');var Redis=require(_0xdaa7('0x5'));var db=require(_0xdaa7('0x6'))['db'];var utils=require(_0xdaa7('0x7'));var logger=require(_0xdaa7('0x8'))(_0xdaa7('0x9'));var config=require(_0xdaa7('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdaa7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2112fa,_0x143f60,_0xe099c0){return new BPromise(function(_0x39c2db,_0x4366b8){return client['request'](_0x2112fa,_0xe099c0)[_0xdaa7('0xc')](function(_0x443b6d){logger[_0xdaa7('0xd')]('Setting,\x20%s,\x20%s',_0x143f60,_0xdaa7('0xe'));logger[_0xdaa7('0xf')](_0xdaa7('0x10'),_0x143f60,'request\x20sent',JSON['stringify'](_0x443b6d));if(_0x443b6d[_0xdaa7('0x11')]){if(_0x443b6d[_0xdaa7('0x11')][_0xdaa7('0x12')]===0x1f4){logger[_0xdaa7('0x11')]('Setting,\x20%s,\x20%s',_0x143f60,_0x443b6d[_0xdaa7('0x11')]['message']);return _0x4366b8(_0x443b6d[_0xdaa7('0x11')][_0xdaa7('0x13')]);}logger[_0xdaa7('0x11')](_0xdaa7('0x14'),_0x143f60,_0x443b6d[_0xdaa7('0x11')]['message']);return _0x39c2db(_0x443b6d[_0xdaa7('0x11')][_0xdaa7('0x13')]);}else{logger[_0xdaa7('0xd')](_0xdaa7('0x14'),_0x143f60,_0xdaa7('0xe'));_0x39c2db(_0x443b6d[_0xdaa7('0x15')]['message']);}})['catch'](function(_0x2bdb86){logger[_0xdaa7('0x11')](_0xdaa7('0x14'),_0x143f60,_0x2bdb86);_0x4366b8(_0x2bdb86);});});}exports[_0xdaa7('0x16')]=function(_0x11822e){var _0x26981d=this;return new Promise(function(_0xb98c91,_0x20d737){return db[_0xdaa7('0x17')]['find']({'raw':_0x11822e[_0xdaa7('0x18')]?_0x11822e[_0xdaa7('0x18')][_0xdaa7('0x19')]===undefined?!![]:![]:!![],'where':_0x11822e[_0xdaa7('0x18')]?_0x11822e[_0xdaa7('0x18')]['where']||null:null,'attributes':_0x11822e[_0xdaa7('0x18')]?_0x11822e[_0xdaa7('0x18')][_0xdaa7('0x1a')]||null:null,'include':_0x11822e[_0xdaa7('0x18')]?_0x11822e[_0xdaa7('0x18')][_0xdaa7('0x1b')]?_['map'](_0x11822e['options']['include'],function(_0x1c60eb){return{'model':db[_0x1c60eb[_0xdaa7('0x1c')]],'as':_0x1c60eb['as'],'attributes':_0x1c60eb[_0xdaa7('0x1a')],'include':_0x1c60eb[_0xdaa7('0x1b')]?_[_0xdaa7('0x1d')](_0x1c60eb['include'],function(_0x517c22){return{'model':db[_0x517c22[_0xdaa7('0x1c')]],'as':_0x517c22['as'],'attributes':_0x517c22[_0xdaa7('0x1a')],'include':_0x517c22['include']?_[_0xdaa7('0x1d')](_0x517c22[_0xdaa7('0x1b')],function(_0x24538c){return{'model':db[_0x24538c[_0xdaa7('0x1c')]],'as':_0x24538c['as'],'attributes':_0x24538c['attributes']};}):[]};}):[]};}):[]:[]})[_0xdaa7('0xc')](function(_0x10eb69){logger[_0xdaa7('0xd')](_0xdaa7('0x16'),_0x11822e);logger[_0xdaa7('0xf')](_0xdaa7('0x16'),_0x11822e,JSON['stringify'](_0x10eb69));_0xb98c91(_0x10eb69);})[_0xdaa7('0x1e')](function(_0x35640a){logger[_0xdaa7('0x11')](_0xdaa7('0x16'),_0x35640a[_0xdaa7('0x13')],_0x11822e);_0x20d737(_0x26981d['error'](0x1f4,_0x35640a[_0xdaa7('0x13')]));});});}; \ No newline at end of file +var _0xfd62=['moment','randomstring','ioredis','rpc','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','Setting','raw','options','where','attributes','include','map','model','debug','lodash'];(function(_0x5ea6c2,_0x137660){var _0x30a7b1=function(_0x67e739){while(--_0x67e739){_0x5ea6c2['push'](_0x5ea6c2['shift']());}};_0x30a7b1(++_0x137660);}(_0xfd62,0x16b));var _0x2fd6=function(_0x3ac882,_0x563ff0){_0x3ac882=_0x3ac882-0x0;var _0x4d6353=_0xfd62[_0x3ac882];return _0x4d6353;};'use strict';var _=require(_0x2fd6('0x0'));var util=require('util');var moment=require(_0x2fd6('0x1'));var BPromise=require('bluebird');var rs=require(_0x2fd6('0x2'));var fs=require('fs');var Redis=require(_0x2fd6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2fd6('0x4'));var config=require('../../config/environment');var jayson=require(_0x2fd6('0x5'));var client=jayson[_0x2fd6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4601ad,_0x281b68,_0x256c8b){return new BPromise(function(_0x3cc4fd,_0x565791){return client[_0x2fd6('0x7')](_0x4601ad,_0x256c8b)[_0x2fd6('0x8')](function(_0x5a9df5){logger[_0x2fd6('0x9')](_0x2fd6('0xa'),_0x281b68,_0x2fd6('0xb'));logger['debug'](_0x2fd6('0xc'),_0x281b68,_0x2fd6('0xb'),JSON[_0x2fd6('0xd')](_0x5a9df5));if(_0x5a9df5['error']){if(_0x5a9df5[_0x2fd6('0xe')][_0x2fd6('0xf')]===0x1f4){logger[_0x2fd6('0xe')](_0x2fd6('0xa'),_0x281b68,_0x5a9df5['error'][_0x2fd6('0x10')]);return _0x565791(_0x5a9df5[_0x2fd6('0xe')][_0x2fd6('0x10')]);}logger[_0x2fd6('0xe')]('Setting,\x20%s,\x20%s',_0x281b68,_0x5a9df5[_0x2fd6('0xe')][_0x2fd6('0x10')]);return _0x3cc4fd(_0x5a9df5[_0x2fd6('0xe')][_0x2fd6('0x10')]);}else{logger[_0x2fd6('0x9')]('Setting,\x20%s,\x20%s',_0x281b68,_0x2fd6('0xb'));_0x3cc4fd(_0x5a9df5['result']['message']);}})[_0x2fd6('0x11')](function(_0xc23abe){logger[_0x2fd6('0xe')](_0x2fd6('0xa'),_0x281b68,_0xc23abe);_0x565791(_0xc23abe);});});}exports[_0x2fd6('0x12')]=function(_0x3a6ed4){var _0x1be3fe=this;return new Promise(function(_0x3a4afa,_0xa37d14){return db[_0x2fd6('0x13')]['find']({'raw':_0x3a6ed4['options']?_0x3a6ed4['options'][_0x2fd6('0x14')]===undefined?!![]:![]:!![],'where':_0x3a6ed4[_0x2fd6('0x15')]?_0x3a6ed4[_0x2fd6('0x15')][_0x2fd6('0x16')]||null:null,'attributes':_0x3a6ed4['options']?_0x3a6ed4[_0x2fd6('0x15')][_0x2fd6('0x17')]||null:null,'include':_0x3a6ed4['options']?_0x3a6ed4['options'][_0x2fd6('0x18')]?_[_0x2fd6('0x19')](_0x3a6ed4[_0x2fd6('0x15')][_0x2fd6('0x18')],function(_0x46b3fc){return{'model':db[_0x46b3fc[_0x2fd6('0x1a')]],'as':_0x46b3fc['as'],'attributes':_0x46b3fc[_0x2fd6('0x17')],'include':_0x46b3fc[_0x2fd6('0x18')]?_[_0x2fd6('0x19')](_0x46b3fc[_0x2fd6('0x18')],function(_0x5dad2d){return{'model':db[_0x5dad2d[_0x2fd6('0x1a')]],'as':_0x5dad2d['as'],'attributes':_0x5dad2d['attributes'],'include':_0x5dad2d[_0x2fd6('0x18')]?_[_0x2fd6('0x19')](_0x5dad2d[_0x2fd6('0x18')],function(_0x4269ce){return{'model':db[_0x4269ce[_0x2fd6('0x1a')]],'as':_0x4269ce['as'],'attributes':_0x4269ce[_0x2fd6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2fd6('0x8')](function(_0x113c0a){logger[_0x2fd6('0x9')](_0x2fd6('0x12'),_0x3a6ed4);logger[_0x2fd6('0x1b')](_0x2fd6('0x12'),_0x3a6ed4,JSON[_0x2fd6('0xd')](_0x113c0a));_0x3a4afa(_0x113c0a);})[_0x2fd6('0x11')](function(_0x24889b){logger[_0x2fd6('0xe')](_0x2fd6('0x12'),_0x24889b[_0x2fd6('0x10')],_0x3a6ed4);_0xa37d14(_0x1be3fe[_0x2fd6('0xe')](0x1f4,_0x24889b[_0x2fd6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 04c7454..834860e 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x4bc6de,_0x36765a){var _0x22507f=function(_0x442b43){while(--_0x442b43){_0x4bc6de['push'](_0x4bc6de['shift']());}};_0x22507f(++_0x36765a);}(_0x7a54,0x106));var _0x47a5=function(_0x3421a1,_0x5800d8){_0x3421a1=_0x3421a1-0x0;var _0x4c04c1=_0x7a54[_0x3421a1];return _0x4c04c1;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x1572d8,_0x39e328){var _0x182d7f=function(_0x28c424){while(--_0x28c424){_0x1572d8['push'](_0x1572d8['shift']());}};_0x182d7f(++_0x39e328);}(_0x7a54,0x106));var _0x47a5=function(_0xa2a662,_0x229986){_0xa2a662=_0xa2a662-0x0;var _0xd35ad5=_0x7a54[_0xa2a662];return _0xd35ad5;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e674a92..49e214c 100644 --- a/server/api/smsAccount/smsAccount.attributes.js +++ b/server/api/smsAccount/smsAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93ba=['plivo','bandwidth','csc','infobip','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','twilio','connectel','clicksend'];(function(_0x2af117,_0x5763b7){var _0x28c6a7=function(_0x55051f){while(--_0x55051f){_0x2af117['push'](_0x2af117['shift']());}};_0x28c6a7(++_0x5763b7);}(_0x93ba,0x100));var _0xa93b=function(_0x19fba4,_0x34a771){_0x19fba4=_0x19fba4-0x0;var _0x37ed3b=_0x93ba[_0x19fba4];return _0x37ed3b;};'use strict';var Sequelize=require(_0xa93b('0x0'));var rs=require(_0xa93b('0x1'));module['exports']={'name':{'type':Sequelize[_0xa93b('0x2')],'unique':_0xa93b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa93b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xa93b('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa93b('0x4')]();}},'phone':{'type':Sequelize[_0xa93b('0x2')]},'type':{'type':Sequelize['ENUM'](_0xa93b('0x5'),'skebby',_0xa93b('0x6'),_0xa93b('0x7'),_0xa93b('0x8'),'clickatell',_0xa93b('0x9'),_0xa93b('0xa'),_0xa93b('0xb'),_0xa93b('0xc'))},'accountSid':{'type':Sequelize[_0xa93b('0x2')]},'authId':{'type':Sequelize[_0xa93b('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xa93b('0xd')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa93b('0x2')]},'apiKey':{'type':Sequelize[_0xa93b('0x2')]},'applicationId':{'type':Sequelize[_0xa93b('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xa93b('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa93b('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa93b('0xe')],'defaultValue':function(){return _0xa93b('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa93b('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa93b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa93b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa93b('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa93b('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa93b('0x11')],'comment':_0xa93b('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xa93b('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x358a4b){if(!_0x358a4b)this[_0xa93b('0x13')](_0xa93b('0x14'),null);this[_0xa93b('0x13')](_0xa93b('0x15'),_0x358a4b);}}}; \ No newline at end of file +var _0x27ed=['skebby','clicksend','plivo','clickatell','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x27ed,0x7b));var _0xd27e=function(_0x5b9cc5,_0x18e69b){_0x5b9cc5=_0x5b9cc5-0x0;var _0x2d679f=_0x27ed[_0x5b9cc5];return _0x2d679f;};'use strict';var Sequelize=require(_0xd27e('0x0'));var rs=require(_0xd27e('0x1'));module['exports']={'name':{'type':Sequelize[_0xd27e('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xd27e('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xd27e('0x2')],'defaultValue':function(){return rs[_0xd27e('0x3')]();}},'phone':{'type':Sequelize[_0xd27e('0x2')]},'type':{'type':Sequelize[_0xd27e('0x4')]('twilio',_0xd27e('0x5'),'connectel',_0xd27e('0x6'),_0xd27e('0x7'),_0xd27e('0x8'),'bandwidth','csc',_0xd27e('0x9'),_0xd27e('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xd27e('0x2')]},'authToken':{'type':Sequelize[_0xd27e('0x2')]},'smsMethod':{'type':Sequelize[_0xd27e('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd27e('0x2')]},'password':{'type':Sequelize[_0xd27e('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xd27e('0x2')]},'accountId':{'type':Sequelize[_0xd27e('0x2')]},'senderString':{'type':Sequelize[_0xd27e('0x2')]},'deliveryReport':{'type':Sequelize[_0xd27e('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xd27e('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd27e('0xc');}},'notificationSound':{'type':Sequelize[_0xd27e('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd27e('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd27e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd27e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd27e('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd27e('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd27e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd27e('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd27e('0xd')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd27e('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4e6f3b){if(!_0x4e6f3b)this['setDataValue'](_0xd27e('0xe'),null);this['setDataValue'](_0xd27e('0xf'),_0x4e6f3b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 31c0d9a..24b4535 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec7f=['updatedAt','CompanyId','ListId','mobile','twilio','From','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','plivo','Text','messageId','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','interaction','autoclose','push','close','unmanaged','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','SmsQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','destroy','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','to\x20is\x20mandatory','List','out','spread','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','bandwidth','redif','DELIVERED','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','redis','localhost','socket.io-emitter','register','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','info','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','get','end','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','count','include','rows','show','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','Disposition','order','sort','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','findAll','removeAnswers','ids','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt'];(function(_0x1ffc83,_0x4b9278){var _0x372ccc=function(_0x34016b){while(--_0x34016b){_0x1ffc83['push'](_0x1ffc83['shift']());}};_0x372ccc(++_0x4b9278);}(_0xec7f,0x157));var _0xfec7=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xec7f[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfec7('0x0'));var zipdir=require(_0xfec7('0x1'));var jsonpatch=require(_0xfec7('0x2'));var rp=require('request-promise');var moment=require(_0xfec7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfec7('0x4'));var util=require('util');var path=require(_0xfec7('0x5'));var sox=require(_0xfec7('0x6'));var csv=require('to-csv');var ejs=require(_0xfec7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfec7('0x8'));var squel=require(_0xfec7('0x9'));var crypto=require(_0xfec7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfec7('0xb'));var toCsv=require(_0xfec7('0xc'));var querystring=require(_0xfec7('0xd'));var Papa=require(_0xfec7('0xe'));var Redis=require('ioredis');var authService=require(_0xfec7('0xf'));var qs=require(_0xfec7('0x10'));var as=require(_0xfec7('0x11'));var hardwareService=require(_0xfec7('0x12'));var logger=require(_0xfec7('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfec7('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xfec7('0x15')],{'host':_0xfec7('0x16'),'port':0x18eb});var socket=require(_0xfec7('0x17'))(new Redis(config[_0xfec7('0x15')]));require('./smsAccount.socket')[_0xfec7('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfec7('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x4cf33b,_0x2833d9,_0x43519f,_0x25964e){return new BPromise(function(_0x3db2cb,_0x247c3e){var _0x395739=_0x25964e||client;return _0x395739[_0xfec7('0x1a')](_0x4cf33b,_0x43519f)[_0xfec7('0x1b')](function(_0x24e398){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2833d9,_0xfec7('0x1c'));logger[_0xfec7('0x1d')](_0xfec7('0x1e'),_0x2833d9,_0xfec7('0x1c'),JSON['stringify'](_0x24e398));if(_0x24e398['error']){if(_0x24e398[_0xfec7('0x1f')][_0xfec7('0x20')]===0x1f4){logger[_0xfec7('0x1f')](_0xfec7('0x21'),_0x2833d9,_0x24e398['error'][_0xfec7('0x22')]);return _0x247c3e(_0x24e398[_0xfec7('0x1f')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x2833d9,_0x24e398[_0xfec7('0x1f')]['message']);return _0x3db2cb(_0x24e398[_0xfec7('0x1f')][_0xfec7('0x22')]);}else{logger[_0xfec7('0x23')](_0xfec7('0x21'),_0x2833d9,_0xfec7('0x1c'));_0x3db2cb(_0x24e398['result'][_0xfec7('0x22')]);}})['catch'](function(_0x4d5e3d){logger[_0xfec7('0x1f')](_0xfec7('0x21'),_0x2833d9,_0x4d5e3d);_0x247c3e(_0x4d5e3d);});});}function respondWithStatusCode(_0x508e4e,_0x3c5e35){_0x3c5e35=_0x3c5e35||0xcc;return function(_0x99d4dd){if(_0x99d4dd){return _0x508e4e[_0xfec7('0x24')](_0x3c5e35);}return _0x508e4e[_0xfec7('0x25')](_0x3c5e35)['end']();};}function respondWithResult(_0x18ee85,_0x31981b){_0x31981b=_0x31981b||0xc8;return function(_0xded539){if(_0xded539){return _0x18ee85[_0xfec7('0x25')](_0x31981b)[_0xfec7('0x26')](_0xded539);}};}function respondWithFilteredResult(_0x16bc98,_0x491eac){return function(_0x3ac24a){if(_0x3ac24a){var _0x2876c8=typeof _0x491eac[_0xfec7('0x27')]==='undefined'&&typeof _0x491eac[_0xfec7('0x28')]===_0xfec7('0x29');var _0xfcb20d=_0x3ac24a['count'];var _0x179d9a=_0x2876c8?0x0:_0x491eac[_0xfec7('0x27')];var _0x1ead66=_0x2876c8?_0x3ac24a['count']:_0x491eac[_0xfec7('0x27')]+_0x491eac[_0xfec7('0x28')];var _0x2bf5a1;if(_0x1ead66>=_0xfcb20d){_0x1ead66=_0xfcb20d;_0x2bf5a1=0xc8;}else{_0x2bf5a1=0xce;}_0x16bc98['status'](_0x2bf5a1);return _0x16bc98[_0xfec7('0x2a')](_0xfec7('0x2b'),_0x179d9a+'-'+_0x1ead66+'/'+_0xfcb20d)[_0xfec7('0x26')](_0x3ac24a);}return null;};}function patchUpdates(_0x40b0ea){return function(_0x532156){try{jsonpatch[_0xfec7('0x2c')](_0x532156,_0x40b0ea,!![]);}catch(_0x55edc0){return BPromise[_0xfec7('0x2d')](_0x55edc0);}return _0x532156[_0xfec7('0x2e')]();};}function saveUpdates(_0x35a6f5,_0x599012){return function(_0x34d221){if(_0x34d221){return _0x34d221[_0xfec7('0x2f')](_0x35a6f5)[_0xfec7('0x1b')](function(_0x45a287){return _0x45a287;});}return null;};}function removeEntity(_0x58805f,_0x3f27aa){return function(_0x597fb5){if(_0x597fb5){return _0x597fb5['destroy']()[_0xfec7('0x1b')](function(){var _0x5d8591=_0x597fb5[_0xfec7('0x30')]({'plain':!![]});var _0x315a4b='SmsAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x315a4b,'resourceId':_0x5d8591['id']}})[_0xfec7('0x1b')](function(){return _0x597fb5;});})[_0xfec7('0x1b')](function(){_0x58805f[_0xfec7('0x25')](0xcc)[_0xfec7('0x31')]();});}};}function handleEntityNotFound(_0x3f11fb,_0x3db979){return function(_0xc3a3f5){if(!_0xc3a3f5){_0x3f11fb['sendStatus'](0x194);}return _0xc3a3f5;};}function handleError(_0x656d91,_0x49289f){_0x49289f=_0x49289f||0x1f4;return function(_0x5b99b9){logger['error'](_0x5b99b9[_0xfec7('0x32')]);if(_0x5b99b9[_0xfec7('0x33')]){delete _0x5b99b9[_0xfec7('0x33')];}_0x656d91[_0xfec7('0x25')](_0x49289f)[_0xfec7('0x34')](_0x5b99b9);};}exports[_0xfec7('0x35')]=function(_0x4d112b,_0x3bf967){var _0x35a3ec={'include':[{'model':db[_0xfec7('0x36')],'as':_0xfec7('0x37')}]},_0x3bc303={},_0x26aca9={'count':0x0,'rows':[]};var _0x279f25=_['map'](db[_0xfec7('0x38')][_0xfec7('0x39')],function(_0x2b5265){return{'name':_0x2b5265[_0xfec7('0x3a')],'type':_0x2b5265[_0xfec7('0x3b')]['key']};});_0x3bc303[_0xfec7('0x3c')]=_[_0xfec7('0x3d')](_0x279f25,_0xfec7('0x33'));_0x3bc303[_0xfec7('0x3e')]=_[_0xfec7('0x3f')](_0x4d112b['query']);_0x3bc303[_0xfec7('0x40')]=_[_0xfec7('0x41')](_0x3bc303[_0xfec7('0x3c')],_0x3bc303[_0xfec7('0x3e')]);_0x35a3ec[_0xfec7('0x42')]=_[_0xfec7('0x41')](_0x3bc303['model'],qs[_0xfec7('0x43')](_0x4d112b['query'][_0xfec7('0x43')]));_0x35a3ec[_0xfec7('0x42')]=_0x35a3ec['attributes'][_0xfec7('0x44')]?_0x35a3ec[_0xfec7('0x42')]:_0x3bc303[_0xfec7('0x3c')];if(!_0x4d112b['query'][_0xfec7('0x45')](_0xfec7('0x46'))){_0x35a3ec[_0xfec7('0x28')]=qs[_0xfec7('0x28')](_0x4d112b[_0xfec7('0x3e')][_0xfec7('0x28')]);_0x35a3ec['offset']=qs['offset'](_0x4d112b[_0xfec7('0x3e')][_0xfec7('0x27')]);}_0x35a3ec['order']=qs['sort'](_0x4d112b[_0xfec7('0x3e')]['sort']);_0x35a3ec[_0xfec7('0x47')]=qs[_0xfec7('0x40')](_[_0xfec7('0x48')](_0x4d112b[_0xfec7('0x3e')],_0x3bc303[_0xfec7('0x40')]),_0x279f25);if(_0x4d112b[_0xfec7('0x3e')][_0xfec7('0x49')]){_0x35a3ec['where']=_['merge'](_0x35a3ec['where'],{'$or':_[_0xfec7('0x3d')](_0x279f25,function(_0x4fd474){if(_0x4fd474['type']!=='VIRTUAL'){var _0x5d73a8={};_0x5d73a8[_0x4fd474[_0xfec7('0x33')]]={'$like':'%'+_0x4d112b[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x5d73a8;}})});}_0x35a3ec=_[_0xfec7('0x4a')]({},_0x35a3ec,_0x4d112b[_0xfec7('0x4b')]);var _0x2a912f={'where':_0x35a3ec['where']};return db[_0xfec7('0x38')][_0xfec7('0x4c')](_0x2a912f)[_0xfec7('0x1b')](function(_0x2e7a2c){_0x26aca9[_0xfec7('0x4c')]=_0x2e7a2c;if(_0x4d112b['query']['includeAll']){_0x35a3ec[_0xfec7('0x4d')]=[{'all':!![]}];}return db[_0xfec7('0x38')]['findAll'](_0x35a3ec);})[_0xfec7('0x1b')](function(_0x47843d){_0x26aca9[_0xfec7('0x4e')]=_0x47843d;return _0x26aca9;})['then'](respondWithFilteredResult(_0x3bf967,_0x35a3ec))['catch'](handleError(_0x3bf967,null));};exports[_0xfec7('0x4f')]=function(_0x470ed7,_0x3b46cf){var _0x10b50d={'raw':![],'where':{'id':_0x470ed7[_0xfec7('0x50')]['id']},'include':[{'model':db[_0xfec7('0x36')],'as':_0xfec7('0x37')}]},_0x139692={};_0x139692[_0xfec7('0x3c')]=_[_0xfec7('0x3f')](db[_0xfec7('0x38')][_0xfec7('0x39')]);_0x139692[_0xfec7('0x3e')]=_[_0xfec7('0x3f')](_0x470ed7['query']);_0x139692['filters']=_[_0xfec7('0x41')](_0x139692[_0xfec7('0x3c')],_0x139692['query']);_0x10b50d[_0xfec7('0x42')]=_['intersection'](_0x139692[_0xfec7('0x3c')],qs[_0xfec7('0x43')](_0x470ed7[_0xfec7('0x3e')][_0xfec7('0x43')]));_0x10b50d[_0xfec7('0x42')]=_0x10b50d[_0xfec7('0x42')][_0xfec7('0x44')]?_0x10b50d[_0xfec7('0x42')]:_0x139692['model'];if(_0x470ed7[_0xfec7('0x3e')][_0xfec7('0x51')]){_0x10b50d[_0xfec7('0x4d')]=[{'all':!![]}];}_0x10b50d=_['merge']({},_0x10b50d,_0x470ed7[_0xfec7('0x4b')]);return db[_0xfec7('0x38')][_0xfec7('0x52')](_0x10b50d)[_0xfec7('0x1b')](handleEntityNotFound(_0x3b46cf,null))['then'](respondWithResult(_0x3b46cf,null))[_0xfec7('0x53')](handleError(_0x3b46cf,null));};exports[_0xfec7('0x54')]=function(_0x1a6f7f,_0x41b14e){return db[_0xfec7('0x38')][_0xfec7('0x54')](_0x1a6f7f[_0xfec7('0x55')],{})[_0xfec7('0x1b')](function(_0x63869d){var _0x5cca85=_0x1a6f7f['user'][_0xfec7('0x30')]({'plain':!![]});if(!_0x5cca85)throw new Error(_0xfec7('0x56'));if(_0x5cca85['role']===_0xfec7('0x57')){var _0x158127=_0x63869d[_0xfec7('0x30')]({'plain':!![]});var _0x1f29ea=_0xfec7('0x58');return db[_0xfec7('0x59')][_0xfec7('0x52')]({'where':{'name':_0x1f29ea,'userProfileId':_0x5cca85[_0xfec7('0x5a')]},'raw':!![]})[_0xfec7('0x1b')](function(_0x1baf2e){if(_0x1baf2e&&_0x1baf2e[_0xfec7('0x5b')]===0x0){return db[_0xfec7('0x5c')]['create']({'name':_0x158127[_0xfec7('0x33')],'resourceId':_0x158127['id'],'type':_0x1baf2e[_0xfec7('0x33')],'sectionId':_0x1baf2e['id']},{})[_0xfec7('0x1b')](function(){return _0x63869d;});}else{return _0x63869d;}})['catch'](function(_0x2c8f8c){logger[_0xfec7('0x1f')](_0xfec7('0x5d'),_0x2c8f8c);throw _0x2c8f8c;});}return _0x63869d;})[_0xfec7('0x1b')](respondWithResult(_0x41b14e,0xc9))[_0xfec7('0x53')](handleError(_0x41b14e,null));};exports[_0xfec7('0x2f')]=function(_0x26602e,_0x323697){if(_0x26602e['body']['id']){delete _0x26602e[_0xfec7('0x55')]['id'];}return db[_0xfec7('0x38')][_0xfec7('0x52')]({'where':{'id':_0x26602e[_0xfec7('0x50')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xfec7('0x1b')](handleEntityNotFound(_0x323697,null))[_0xfec7('0x1b')](saveUpdates(_0x26602e[_0xfec7('0x55')],null))[_0xfec7('0x1b')](respondWithResult(_0x323697,null))[_0xfec7('0x53')](handleError(_0x323697,null));};exports['destroy']=function(_0x223633,_0x1c2b89){return db['SmsAccount'][_0xfec7('0x52')]({'where':{'id':_0x223633[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x1c2b89,null))[_0xfec7('0x1b')](removeEntity(_0x1c2b89,null))[_0xfec7('0x53')](handleError(_0x1c2b89,null));};exports[_0xfec7('0x5e')]=function(_0x4ad5be,_0x1245ff){return db[_0xfec7('0x38')]['describe']()[_0xfec7('0x1b')](respondWithResult(_0x1245ff,null))['catch'](handleError(_0x1245ff,null));};exports[_0xfec7('0x5f')]=function(_0x35daa9,_0x3f1b00,_0x48abd2){if(_0x35daa9['body']['id']){delete _0x35daa9[_0xfec7('0x55')]['id'];}return db[_0xfec7('0x38')][_0xfec7('0x52')]({'where':{'id':_0x35daa9['params']['id']}})['then'](handleEntityNotFound(_0x3f1b00,null))[_0xfec7('0x1b')](function(_0x323df8){if(_0x323df8){_0x35daa9['body'][_0xfec7('0x60')]=_0x323df8['id'];return db['Disposition']['create'](_0x35daa9[_0xfec7('0x55')]);}})['then'](respondWithResult(_0x3f1b00,null))[_0xfec7('0x53')](handleError(_0x3f1b00,null));};exports[_0xfec7('0x61')]=function(_0x51ac9d,_0x2802ee,_0x7a7846){var _0x52fdb7={'raw':![],'where':{}};var _0x2e0c9c={};var _0x4aad70={'count':0x0,'rows':[]};return db[_0xfec7('0x38')]['findOne']({'where':{'id':_0x51ac9d[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x2802ee,null))[_0xfec7('0x1b')](function(_0x15fa87){if(_0x15fa87){_0x2e0c9c[_0xfec7('0x3c')]=_[_0xfec7('0x3f')](db[_0xfec7('0x62')][_0xfec7('0x39')]);_0x2e0c9c['query']=_['keys'](_0x51ac9d['query']);_0x2e0c9c[_0xfec7('0x40')]=_[_0xfec7('0x41')](_0x2e0c9c[_0xfec7('0x3c')],_0x2e0c9c[_0xfec7('0x3e')]);_0x52fdb7['attributes']=_['intersection'](_0x2e0c9c[_0xfec7('0x3c')],qs[_0xfec7('0x43')](_0x51ac9d[_0xfec7('0x3e')]['fields']));_0x52fdb7[_0xfec7('0x42')]=_0x52fdb7['attributes'][_0xfec7('0x44')]?_0x52fdb7[_0xfec7('0x42')]:_0x2e0c9c[_0xfec7('0x3c')];if(!_0x51ac9d[_0xfec7('0x3e')][_0xfec7('0x45')]('nolimit')){_0x52fdb7[_0xfec7('0x28')]=qs[_0xfec7('0x28')](_0x51ac9d[_0xfec7('0x3e')]['limit']);_0x52fdb7[_0xfec7('0x27')]=qs[_0xfec7('0x27')](_0x51ac9d[_0xfec7('0x3e')][_0xfec7('0x27')]);}_0x52fdb7[_0xfec7('0x63')]=qs[_0xfec7('0x64')](_0x51ac9d['query'][_0xfec7('0x64')]);_0x52fdb7['where']=qs[_0xfec7('0x40')](_[_0xfec7('0x48')](_0x51ac9d[_0xfec7('0x3e')],_0x2e0c9c[_0xfec7('0x40')]));_0x52fdb7[_0xfec7('0x47')][_0xfec7('0x60')]=_0x15fa87['id'];if(_0x51ac9d['query'][_0xfec7('0x49')]){_0x52fdb7['where']=_[_0xfec7('0x4a')](_0x52fdb7[_0xfec7('0x47')],{'$or':_[_0xfec7('0x3d')](_0x52fdb7['attributes'],function(_0x3d2e9f){var _0x7d8d0f={};_0x7d8d0f[_0x3d2e9f]={'$like':'%'+_0x51ac9d[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x7d8d0f;})});}_0x52fdb7=_[_0xfec7('0x4a')]({},_0x52fdb7,_0x51ac9d[_0xfec7('0x4b')]);return db[_0xfec7('0x62')][_0xfec7('0x4c')]({'where':_0x52fdb7['where']})['then'](function(_0x1b670a){_0x4aad70['count']=_0x1b670a;if(_0x51ac9d[_0xfec7('0x3e')]['includeAll']){_0x52fdb7[_0xfec7('0x4d')]=[{'all':!![]}];}return db[_0xfec7('0x62')]['findAll'](_0x52fdb7);})['then'](function(_0x12e7a1){_0x4aad70[_0xfec7('0x4e')]=_0x12e7a1;return _0x4aad70;});}})['then'](respondWithFilteredResult(_0x2802ee,_0x52fdb7))[_0xfec7('0x53')](handleError(_0x2802ee,null));};exports[_0xfec7('0x65')]=function(_0x4a1679,_0x2b6360,_0x29531d){return db['SmsAccount']['find']({'where':{'id':_0x4a1679[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x2b6360,null))[_0xfec7('0x1b')](function(_0x4d98ca){if(_0x4d98ca){return _0x4d98ca['removeDispositions'](_0x4a1679[_0xfec7('0x3e')]['ids']);}})[_0xfec7('0x1b')](respondWithStatusCode(_0x2b6360,null))[_0xfec7('0x53')](handleError(_0x2b6360,null));};exports[_0xfec7('0x66')]=function(_0x245063,_0x581204,_0x43bc9c){if(_0x245063[_0xfec7('0x55')]['id']){delete _0x245063['body']['id'];}return db['SmsAccount'][_0xfec7('0x52')]({'where':{'id':_0x245063[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x581204,null))['then'](function(_0x3f4731){if(_0x3f4731){_0x245063['body'][_0xfec7('0x60')]=_0x3f4731['id'];return db['CannedAnswer'][_0xfec7('0x54')](_0x245063[_0xfec7('0x55')]);}})[_0xfec7('0x1b')](respondWithResult(_0x581204,null))[_0xfec7('0x53')](handleError(_0x581204,null));};exports[_0xfec7('0x67')]=function(_0x1b6288,_0x55e1f7,_0x37127f){var _0x39c767={'raw':![],'where':{}};var _0x203f5b={};var _0x42da41={'count':0x0,'rows':[]};return db[_0xfec7('0x38')][_0xfec7('0x68')]({'where':{'id':_0x1b6288[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x55e1f7,null))['then'](function(_0x3e8010){if(_0x3e8010){_0x203f5b[_0xfec7('0x3c')]=_[_0xfec7('0x3f')](db[_0xfec7('0x69')][_0xfec7('0x39')]);_0x203f5b[_0xfec7('0x3e')]=_[_0xfec7('0x3f')](_0x1b6288[_0xfec7('0x3e')]);_0x203f5b[_0xfec7('0x40')]=_['intersection'](_0x203f5b[_0xfec7('0x3c')],_0x203f5b[_0xfec7('0x3e')]);_0x39c767[_0xfec7('0x42')]=_[_0xfec7('0x41')](_0x203f5b['model'],qs[_0xfec7('0x43')](_0x1b6288['query'][_0xfec7('0x43')]));_0x39c767['attributes']=_0x39c767[_0xfec7('0x42')][_0xfec7('0x44')]?_0x39c767[_0xfec7('0x42')]:_0x203f5b[_0xfec7('0x3c')];if(!_0x1b6288['query'][_0xfec7('0x45')]('nolimit')){_0x39c767[_0xfec7('0x28')]=qs[_0xfec7('0x28')](_0x1b6288[_0xfec7('0x3e')][_0xfec7('0x28')]);_0x39c767[_0xfec7('0x27')]=qs['offset'](_0x1b6288[_0xfec7('0x3e')][_0xfec7('0x27')]);}_0x39c767[_0xfec7('0x63')]=qs['sort'](_0x1b6288[_0xfec7('0x3e')][_0xfec7('0x64')]);_0x39c767[_0xfec7('0x47')]=qs[_0xfec7('0x40')](_[_0xfec7('0x48')](_0x1b6288[_0xfec7('0x3e')],_0x203f5b['filters']));_0x39c767[_0xfec7('0x47')][_0xfec7('0x60')]=_0x3e8010['id'];if(_0x1b6288[_0xfec7('0x3e')][_0xfec7('0x49')]){_0x39c767['where']=_['merge'](_0x39c767['where'],{'$or':_[_0xfec7('0x3d')](_0x39c767[_0xfec7('0x42')],function(_0x1ade4c){var _0x195ab9={};_0x195ab9[_0x1ade4c]={'$like':'%'+_0x1b6288[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x195ab9;})});}_0x39c767=_[_0xfec7('0x4a')]({},_0x39c767,_0x1b6288[_0xfec7('0x4b')]);return db[_0xfec7('0x69')][_0xfec7('0x4c')]({'where':_0x39c767[_0xfec7('0x47')]})[_0xfec7('0x1b')](function(_0x23abfc){_0x42da41[_0xfec7('0x4c')]=_0x23abfc;if(_0x1b6288['query']['includeAll']){_0x39c767[_0xfec7('0x4d')]=[{'all':!![]}];}return db[_0xfec7('0x69')][_0xfec7('0x6a')](_0x39c767);})[_0xfec7('0x1b')](function(_0x2d3133){_0x42da41['rows']=_0x2d3133;return _0x42da41;});}})['then'](respondWithFilteredResult(_0x55e1f7,_0x39c767))[_0xfec7('0x53')](handleError(_0x55e1f7,null));};exports[_0xfec7('0x6b')]=function(_0x524f90,_0x3080dc,_0x1477ec){return db[_0xfec7('0x38')][_0xfec7('0x52')]({'where':{'id':_0x524f90[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x3080dc,null))['then'](function(_0x437af0){if(_0x437af0){return _0x437af0[_0xfec7('0x6b')](_0x524f90['query'][_0xfec7('0x6c')]);}})[_0xfec7('0x1b')](respondWithStatusCode(_0x3080dc,null))['catch'](handleError(_0x3080dc,null));};exports['notify']=function(_0x35a8d3,_0x31fe07,_0x51e6d9){var _0x2b0fd8={'channel':_0xfec7('0x6d')};var _0x26d88c=[];var _0x23709d=[];var _0x66b8e0={};return db['SmsAccount'][_0xfec7('0x52')]({'where':{'id':_0x35a8d3[_0xfec7('0x50')]['id']},'include':[{'model':db[_0xfec7('0x6e')],'as':_0xfec7('0x6f')}]})[_0xfec7('0x1b')](handleEntityNotFound(_0x31fe07,null))[_0xfec7('0x1b')](function(_0x47b68e){_0x2b0fd8[_0xfec7('0x70')]=_0x47b68e;_0x2b0fd8[_0xfec7('0x71')]=_[_0xfec7('0x72')](_0x47b68e[_0xfec7('0x6f')],[_0xfec7('0x73')],[_0xfec7('0x74')]);if(_0x2b0fd8[_0xfec7('0x70')][_0xfec7('0x6f')]){delete _0x2b0fd8[_0xfec7('0x70')][_0xfec7('0x6f')];}return db[_0xfec7('0x75')][_0xfec7('0x5e')]();})[_0xfec7('0x1b')](function(_0x50baeb){if(!_0x50baeb){throw new db[(_0xfec7('0x76'))][(_0xfec7('0x77'))](_0xfec7('0x78'));}_0x26d88c=_[_0xfec7('0x79')](_[_0xfec7('0x3f')](_0x50baeb),[_0xfec7('0x7a'),'updatedAt']);_0x23709d=_[_0xfec7('0x79')](_[_0xfec7('0x3f')](_0x50baeb),[_0xfec7('0x7a'),_0xfec7('0x7b'),_0xfec7('0x7c'),_0xfec7('0x7d')]);_0x2b0fd8['body']={'mapKey':_0xfec7('0x7e')};if(_0x2b0fd8[_0xfec7('0x70')][_0xfec7('0x3b')]){switch(_0x2b0fd8[_0xfec7('0x70')]['type']){case _0xfec7('0x7f'):_0x2b0fd8[_0xfec7('0x55')]['from']=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x80')];_0x2b0fd8['body'][_0xfec7('0x55')]=_0x35a8d3['body']['Body'];_0x2b0fd8[_0xfec7('0x55')]['messageId']=_0x35a8d3['body'][_0xfec7('0x81')];break;case _0xfec7('0x82'):_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')]='+'+_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x84')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3['body'][_0xfec7('0x85')];break;case _0xfec7('0x86'):_0x2b0fd8['body'][_0xfec7('0x83')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x83')];_0x2b0fd8[_0xfec7('0x55')]['body']=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x22')];break;case _0xfec7('0x87'):_0x2b0fd8['body'][_0xfec7('0x83')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x83')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3['body'][_0xfec7('0x55')];_0x2b0fd8['body']['messageId']=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x88')];break;case _0xfec7('0x89'):_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')]=_0x35a8d3['body'][_0xfec7('0x80')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3['body'][_0xfec7('0x8a')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x8b')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x8c')];break;case _0xfec7('0x8d'):_0x2b0fd8['body'][_0xfec7('0x83')]='+'+_0x35a8d3['body']['results'][0x0][_0xfec7('0x83')];_0x2b0fd8[_0xfec7('0x55')]['body']=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x8e')][0x0]['text'];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x8b')]=_0x35a8d3['body'][_0xfec7('0x8e')][0x0][_0xfec7('0x8b')];break;case _0xfec7('0x8f'):_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')]=_0x35a8d3['body'][_0xfec7('0x90')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3['body']['segmentedMessage']['message'];break;case _0xfec7('0x91'):_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')]=_0x35a8d3['body'][_0xfec7('0x92')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x85')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x8b')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x93')];break;case'bandwidth':_0x2b0fd8['body'][_0xfec7('0x8b')]=_0x35a8d3['body'][0x0][_0xfec7('0x22')]['id'];_0x2b0fd8[_0xfec7('0x55')]['from']=_0x35a8d3[_0xfec7('0x55')][0x0]['message'][_0xfec7('0x83')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3[_0xfec7('0x55')][0x0][_0xfec7('0x22')][_0xfec7('0x85')];break;case _0xfec7('0x94'):_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x83')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3[_0xfec7('0x55')]['message'];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x8b')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x95')];break;}}if(_0x2b0fd8[_0xfec7('0x55')]['id']){delete _0x2b0fd8[_0xfec7('0x55')]['id'];}if(_[_0xfec7('0x96')](_0x2b0fd8['body'][_0xfec7('0x83')])){throw new db[(_0xfec7('0x76'))][(_0xfec7('0x77'))](_0xfec7('0x97'));}if(_[_0xfec7('0x96')](_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')])||_0x2b0fd8[_0xfec7('0x55')]['body']===''){throw new db[(_0xfec7('0x76'))]['ValidationError'](_0xfec7('0x98'));}if(_[_0xfec7('0x96')](_0x2b0fd8[_0xfec7('0x55')]['mapKey'])){throw new db[(_0xfec7('0x76'))][(_0xfec7('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x23709d);}if(!_[_0xfec7('0x99')](_0x23709d,_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x9a')])){throw new db['Sequelize'][(_0xfec7('0x77'))](_0xfec7('0x9b')+_0x23709d);}_0x66b8e0[_0x2b0fd8['body'][_0xfec7('0x9a')]]=_0x2b0fd8['body'][_0xfec7('0x83')];return db[_0xfec7('0x9c')][_0xfec7('0x52')]({'where':{'id':_0x2b0fd8[_0xfec7('0x70')]['ListId']},'include':[{'model':db[_0xfec7('0x75')],'as':_0xfec7('0x9d'),'where':_0x66b8e0,'limit':0x1,'order':[[_0xfec7('0x7b'),_0xfec7('0x9e')]]}]});})[_0xfec7('0x1b')](handleEntityNotFound(_0x31fe07,null))[_0xfec7('0x1b')](function(_0xf6a162){if(_0xf6a162){_0x2b0fd8[_0xfec7('0x9f')]=_[_0xfec7('0xa0')](_0xf6a162,['Contacts']);if(_0xf6a162[_0xfec7('0x9d')]['length']){return _0xf6a162['Contacts'][0x0];}var _0x4786ab=_[_0xfec7('0xa1')](_0x2b0fd8[_0xfec7('0x55')],{'firstName':_0x2b0fd8['body'][_0xfec7('0x83')],'ListId':_0xf6a162['id']});_0x4786ab[_0x2b0fd8['body']['mapKey']]=_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')];return db[_0xfec7('0x75')][_0xfec7('0x54')](_0x4786ab,{'fields':_0x26d88c,'raw':!![]});}})[_0xfec7('0x1b')](handleEntityNotFound(_0x31fe07,null))[_0xfec7('0x1b')](function(_0x49d55d){if(_0x49d55d){_0x2b0fd8[_0xfec7('0xa2')]=_0x49d55d;var _0xe937aa={'ContactId':_0x49d55d['id'],'phone':_0x2b0fd8['body'][_0xfec7('0x83')],'SmsAccountId':_0x35a8d3[_0xfec7('0x50')]['id']};var _0x2aae01={'ContactId':_0x49d55d['id'],'SmsAccountId':_0x35a8d3[_0xfec7('0x50')]['id'],'closed':![]};return db[_0xfec7('0xa3')][_0xfec7('0x52')]({'where':_0x2aae01})[_0xfec7('0x1b')](function(_0x494937){if(_0x494937){return[_0x494937,![]];}return db[_0xfec7('0xa3')][_0xfec7('0x54')](_0xe937aa)[_0xfec7('0x1b')](function(_0x5b0fb8){return[_0x5b0fb8,!![]];});});}})['spread'](function(_0x34554b,_0x419f13){_0x2b0fd8[_0xfec7('0xa4')]=_0x34554b[_0xfec7('0x30')]({'plain':!![]});_0x2b0fd8['interaction']['created']=![];if(_0x419f13){if(_0x2b0fd8[_0xfec7('0x70')][_0xfec7('0xa5')]){_0x2b0fd8['applications'][_0xfec7('0xa6')]({'id':0x0,'priority':_0x2b0fd8[_0xfec7('0x71')][_0xfec7('0x44')]+0x1,'app':_0xfec7('0xa7'),'appdata':_0xfec7('0xa8'),'interval':'*,*,*,*'});}_0x2b0fd8[_0xfec7('0xa4')][_0xfec7('0xa9')]=!![];}return db[_0xfec7('0xaa')][_0xfec7('0x54')]({'phone':_0x2b0fd8[_0xfec7('0x55')]['from'],'messageId':_0x2b0fd8['body']['messageId'],'body':_0x2b0fd8['body'][_0xfec7('0x55')],'SmsAccountId':_0x35a8d3[_0xfec7('0x50')]['id'],'SmsInteractionId':_0x34554b['id'],'direction':'in','ContactId':_0x34554b[_0xfec7('0xab')],'AttachmentId':_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0xac')]});})[_0xfec7('0x1b')](function(_0x3e1d9d){_0x2b0fd8[_0xfec7('0x22')]=_0x3e1d9d;if(!_0x2b0fd8[_0xfec7('0xa4')][_0xfec7('0xad')])return;return db[_0xfec7('0xae')][_0xfec7('0x52')]({'attributes':['id',_0xfec7('0x33')],'where':{'id':_0x2b0fd8[_0xfec7('0xa4')]['UserId']}});})[_0xfec7('0x1b')](function(_0x55bbe0){if(_0x55bbe0){_0x2b0fd8[_0xfec7('0x71')][_0xfec7('0xaf')]({'id':0x0,'priority':0x0,'app':_0xfec7('0xb0'),'appdata':_0x55bbe0['name']+','+(_0x2b0fd8['account'][_0xfec7('0xb1')]||0xa),'interval':_0xfec7('0xb2')});}if(!_0x2b0fd8[_0xfec7('0xa4')]['queueId'])return;return db[_0xfec7('0xb3')][_0xfec7('0x52')]({'attributes':['id',_0xfec7('0x33')],'where':{'id':_0x2b0fd8[_0xfec7('0xa4')][_0xfec7('0xb4')]}});})[_0xfec7('0x1b')](function(_0x5399e1){if(_0x5399e1){_0x2b0fd8['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xfec7('0xb5'),'appdata':_0x5399e1['name']+','+(_0x2b0fd8[_0xfec7('0x70')][_0xfec7('0xb6')]||0x12c),'interval':_0xfec7('0xb2')});}return respondWithRpcPromise(_0xfec7('0xb7'),_0xfec7('0xb8'),_0x2b0fd8);})['then'](function(_0x1ac0a3){if(_0x1ac0a3){var _0x2eff1d=0xc8;var _0x4cc4e1=_0xfec7('0xb9');logger[_0xfec7('0x23')](_0xfec7('0x1e'),_0x4cc4e1,_0x2eff1d,_0xfec7('0xba'));logger[_0xfec7('0x1d')](_0xfec7('0xbb'),_0x4cc4e1,_0x2eff1d,_0xfec7('0xba'),JSON[_0xfec7('0xbc')](_0x1ac0a3));if(_0x2b0fd8[_0xfec7('0x70')][_0xfec7('0x3b')]===_0xfec7('0x7f')){return _0x31fe07[_0xfec7('0x25')](_0x2eff1d)['set'](_0xfec7('0xbd'),'text/xml')[_0xfec7('0x34')](_0xfec7('0xbe'));}else{return _0x31fe07[_0xfec7('0x25')](_0x2eff1d)['json'](_0x1ac0a3);}}})[_0xfec7('0x53')](handleError(_0x31fe07,null));};exports[_0xfec7('0xbf')]=function(_0xdc57eb,_0x53ab53){var _0x2370a1=_0xdc57eb[_0xfec7('0x50')]['id'];var _0x24ec80=_0xdc57eb['body'];var _0x54e84e=0xc8;var _0xf15e00=null;return db[_0xfec7('0xc0')]['transaction']({'isolationLevel':db[_0xfec7('0xc0')][_0xfec7('0xc1')][_0xfec7('0xc2')][_0xfec7('0xc3')]},function(_0x5565b6){return db['SmsAccount']['findOne']({'where':{'id':_0x2370a1},'transaction':_0x5565b6})[_0xfec7('0x1b')](function(_0x20e933){if(_0x20e933){return db[_0xfec7('0x6e')][_0xfec7('0xc4')]({'where':{'SmsAccountId':_0x2370a1},'transaction':_0x5565b6})[_0xfec7('0x1b')](function(){var _0x14db55=_[_0xfec7('0x3d')](_0x24ec80,function(_0x21bb9a){_0x21bb9a[_0xfec7('0x60')]=_0x2370a1;return _0x21bb9a;});return db[_0xfec7('0x6e')][_0xfec7('0xc5')](_0x14db55,{'transaction':_0x5565b6});});}else{_0x54e84e=0x194;_0xf15e00=[];}});})[_0xfec7('0x1b')](function(){if(_0x54e84e!==0x194){return db[_0xfec7('0x6e')][_0xfec7('0xc6')]({'where':{'SmsAccountId':_0x2370a1},'order':'priority'})[_0xfec7('0x1b')](function(_0x53f09b){_0xf15e00=_0x53f09b;});}})[_0xfec7('0x53')](function(_0x326c5e){_0x54e84e=0x1f4;logger[_0xfec7('0x1f')](_0x326c5e['stack']);if(_0x326c5e[_0xfec7('0x33')]){delete _0x326c5e['name'];}_0xf15e00=_0x326c5e;})['finally'](function(){if(_0xf15e00===null){_0x53ab53[_0xfec7('0x24')](_0x54e84e);}else{if(_0x54e84e===0x1f4){_0x53ab53[_0xfec7('0x25')](_0x54e84e)[_0xfec7('0x34')](_0xf15e00);}else{_0x53ab53[_0xfec7('0x25')](_0x54e84e)[_0xfec7('0x26')](_0xf15e00);}}});};exports[_0xfec7('0xc7')]=function(_0x524463,_0x33e222,_0x498c23){var _0x521768={};var _0x327783={};var _0x7562a9;var _0x49e453;return db['SmsAccount'][_0xfec7('0x68')]({'where':{'id':_0x524463['params']['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x33e222,null))[_0xfec7('0x1b')](function(_0x2cc1d9){if(_0x2cc1d9){_0x7562a9=_0x2cc1d9;_0x327783[_0xfec7('0x3c')]=_[_0xfec7('0x3f')](db[_0xfec7('0x6e')][_0xfec7('0x39')]);_0x327783[_0xfec7('0x3e')]=_['keys'](_0x524463[_0xfec7('0x3e')]);_0x327783[_0xfec7('0x40')]=_[_0xfec7('0x41')](_0x327783[_0xfec7('0x3c')],_0x327783[_0xfec7('0x3e')]);_0x521768[_0xfec7('0x42')]=_[_0xfec7('0x41')](_0x327783['model'],qs[_0xfec7('0x43')](_0x524463[_0xfec7('0x3e')][_0xfec7('0x43')]));_0x521768[_0xfec7('0x42')]=_0x521768['attributes'][_0xfec7('0x44')]?_0x521768[_0xfec7('0x42')]:_0x327783[_0xfec7('0x3c')];_0x521768[_0xfec7('0x63')]=qs['sort'](_0x524463[_0xfec7('0x3e')][_0xfec7('0x64')]);_0x521768[_0xfec7('0x47')]=qs[_0xfec7('0x40')](_[_0xfec7('0x48')](_0x524463['query'],_0x327783[_0xfec7('0x40')]));if(_0x524463[_0xfec7('0x3e')]['filter']){_0x521768[_0xfec7('0x47')]=_[_0xfec7('0x4a')](_0x521768[_0xfec7('0x47')],{'$or':_[_0xfec7('0x3d')](_0x521768[_0xfec7('0x42')],function(_0x3c1d8c){var _0x12793a={};_0x12793a[_0x3c1d8c]={'$like':'%'+_0x524463[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x12793a;})});}_0x521768=_[_0xfec7('0x4a')]({},_0x521768,_0x524463[_0xfec7('0x4b')]);return _0x7562a9['getApplications'](_0x521768);}})[_0xfec7('0x1b')](function(_0x47b8c5){if(_0x47b8c5){_0x49e453=_0x47b8c5['length'];if(!_0x524463['query']['hasOwnProperty'](_0xfec7('0x46'))){_0x521768['limit']=qs[_0xfec7('0x28')](_0x524463[_0xfec7('0x3e')][_0xfec7('0x28')]);_0x521768['offset']=qs['offset'](_0x524463[_0xfec7('0x3e')][_0xfec7('0x27')]);}return _0x7562a9['getApplications'](_0x521768);}})['then'](function(_0x17fdc3){if(_0x17fdc3){return _0x17fdc3?{'count':_0x49e453,'rows':_0x17fdc3}:null;}})[_0xfec7('0x1b')](respondWithResult(_0x33e222,null))['catch'](handleError(_0x33e222,null));};exports[_0xfec7('0xc8')]=function(_0x345ea2,_0x22c85a,_0x28a710){var _0x4f6b16={'raw':![],'where':{}};var _0x20565e={};var _0x3cb6f4={'count':0x0,'rows':[]};return db['SmsAccount'][_0xfec7('0x68')]({'where':{'id':_0x345ea2['params']['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x22c85a,null))[_0xfec7('0x1b')](function(_0x326d5c){if(_0x326d5c){_0x20565e[_0xfec7('0x3c')]=_[_0xfec7('0x3f')](db['SmsInteraction'][_0xfec7('0x39')]);_0x20565e['query']=_[_0xfec7('0x3f')](_0x345ea2[_0xfec7('0x3e')]);_0x20565e[_0xfec7('0x40')]=_[_0xfec7('0x41')](_0x20565e[_0xfec7('0x3c')],_0x20565e[_0xfec7('0x3e')]);_0x4f6b16[_0xfec7('0x42')]=_[_0xfec7('0x41')](_0x20565e[_0xfec7('0x3c')],qs[_0xfec7('0x43')](_0x345ea2['query'][_0xfec7('0x43')]));_0x4f6b16['attributes']=_0x4f6b16[_0xfec7('0x42')][_0xfec7('0x44')]?_0x4f6b16[_0xfec7('0x42')]:_0x20565e[_0xfec7('0x3c')];if(!_0x345ea2[_0xfec7('0x3e')][_0xfec7('0x45')](_0xfec7('0x46'))){_0x4f6b16[_0xfec7('0x28')]=qs[_0xfec7('0x28')](_0x345ea2[_0xfec7('0x3e')]['limit']);_0x4f6b16[_0xfec7('0x27')]=qs['offset'](_0x345ea2['query']['offset']);}_0x4f6b16['order']=qs[_0xfec7('0x64')](_0x345ea2[_0xfec7('0x3e')][_0xfec7('0x64')]);_0x4f6b16[_0xfec7('0x47')]=qs[_0xfec7('0x40')](_['pick'](_0x345ea2[_0xfec7('0x3e')],_0x20565e[_0xfec7('0x40')]));_0x4f6b16['where']['SmsAccountId']=_0x326d5c['id'];if(_0x345ea2[_0xfec7('0x3e')][_0xfec7('0x49')]){_0x4f6b16['where']=_[_0xfec7('0x4a')](_0x4f6b16['where'],{'$or':_[_0xfec7('0x3d')](_0x4f6b16[_0xfec7('0x42')],function(_0x140e0f){var _0x355bf5={};_0x355bf5[_0x140e0f]={'$like':'%'+_0x345ea2[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x355bf5;})});}_0x4f6b16=_['merge']({},_0x4f6b16,_0x345ea2['options']);return db['SmsInteraction'][_0xfec7('0x4c')]({'where':_0x4f6b16['where']})['then'](function(_0x3ef2a5){_0x3cb6f4[_0xfec7('0x4c')]=_0x3ef2a5;if(_0x345ea2['query'][_0xfec7('0x51')]){_0x4f6b16[_0xfec7('0x4d')]=[{'model':db[_0xfec7('0x75')],'as':_0xfec7('0xc9'),'required':![]},{'model':db['User'],'as':_0xfec7('0xca'),'attributes':[_0xfec7('0x33'),'fullname',_0xfec7('0xcb')],'required':![]},{'model':db[_0xfec7('0xcc')],'as':_0xfec7('0xcd'),'attributes':['id',_0xfec7('0x33'),_0xfec7('0xce')],'where':_0x345ea2['query']['tag']?{'id':_0x345ea2[_0xfec7('0x3e')]['tag']}:undefined,'required':_0x345ea2[_0xfec7('0x3e')]['tag']?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x4f6b16);})[_0xfec7('0x1b')](function(_0x372fa5){_0x3cb6f4[_0xfec7('0x4e')]=_0x372fa5;return _0x3cb6f4;});}})[_0xfec7('0x1b')](respondWithFilteredResult(_0x22c85a,_0x4f6b16))[_0xfec7('0x53')](handleError(_0x22c85a,null));};exports[_0xfec7('0x34')]=function(_0xcdd26,_0x100a36,_0x59b1af){var _0x4d2492,_0x34f739,_0x40e24c;if(_[_0xfec7('0x96')](_0xcdd26[_0xfec7('0x55')][_0xfec7('0x55')])||_0xcdd26[_0xfec7('0x55')][_0xfec7('0x55')]===''){throw new db[(_0xfec7('0x76'))][(_0xfec7('0x77'))](_0xfec7('0x98'));}if(_[_0xfec7('0x96')](_0xcdd26[_0xfec7('0x55')]['to'])){throw new db[(_0xfec7('0x76'))]['ValidationError'](_0xfec7('0xcf'));}_0x4d2492=_0xcdd26['body']['to'];return db[_0xfec7('0x38')]['find']({'where':{'id':_0xcdd26[_0xfec7('0x50')]['id']},'include':[{'model':db[_0xfec7('0x9c')],'as':_0xfec7('0xd0'),'include':[{'model':db[_0xfec7('0x75')],'as':'Contacts','where':{'mobile':_0x4d2492},'limit':0x1,'order':[[_0xfec7('0x7b'),'DESC']]}]}]})[_0xfec7('0x1b')](handleEntityNotFound(_0x100a36,null))[_0xfec7('0x1b')](function(_0x4bbeaf){if(_0x4bbeaf&&_0x4bbeaf['List']){_0x34f739=_0x4bbeaf['get']({'plain':!![]});if(_0x34f739[_0xfec7('0xd0')]&&_0x34f739['List'][_0xfec7('0x9d')][_0xfec7('0x44')]){return _0x34f739['List']['Contacts'][0x0];}return db[_0xfec7('0x75')][_0xfec7('0x54')](_[_0xfec7('0xa1')](_0xcdd26['body'],{'firstName':_0x4d2492,'mobile':_0x4d2492,'phone':_0x4d2492,'ListId':_0x34f739[_0xfec7('0x7d')]}));}})[_0xfec7('0x1b')](handleEntityNotFound(_0x100a36,null))['then'](function(_0x27bbb9){if(_0x27bbb9){_0x40e24c=_0x27bbb9;return db[_0xfec7('0xa3')][_0xfec7('0x52')]({'where':{'ContactId':_0x40e24c['id'],'closed':![],'SmsAccountId':_0x34f739['id']}})[_0xfec7('0x1b')](function(_0xfe61e1){if(_0xfe61e1){return[_0xfe61e1,![]];}return db['SmsInteraction']['create']({'UserId':_0xcdd26[_0xfec7('0x57')]['id'],'ContactId':_0x40e24c['id'],'SmsAccountId':_0x34f739['id'],'phone':_0x4d2492,'firstMsgDirection':_0xfec7('0xd1'),'Messages':[_['merge'](_0xcdd26[_0xfec7('0x55')],{'read':![],'body':_0xcdd26[_0xfec7('0x55')][_0xfec7('0x55')],'phone':_0x4d2492,'SmsAccountId':_0x34f739['id'],'UserId':_0xcdd26[_0xfec7('0x57')]['id'],'ContactId':_0x40e24c['id']})]},{'include':[{'model':db[_0xfec7('0xaa')],'as':'Messages'}]})[_0xfec7('0x1b')](function(_0x4c0ea0){return[_0x4c0ea0,!![]];});});}})[_0xfec7('0xd2')](function(_0xcf1ed9,_0x4ebe47){if(_0x4ebe47){return _0xcf1ed9;}return db['SmsMessage'][_0xfec7('0x54')](_[_0xfec7('0x4a')](_0xcdd26[_0xfec7('0x55')],{'read':![],'body':_0xcdd26[_0xfec7('0x55')][_0xfec7('0x55')],'phone':_0x4d2492,'SmsAccountId':_0x34f739['id'],'SmsInteractionId':_0xcf1ed9['id'],'UserId':_0xcdd26[_0xfec7('0x57')]['id'],'ContactId':_0x40e24c['id']}))['then'](function(_0x194e08){_0xcf1ed9['dataValues'][_0xfec7('0xd3')]=[];_0xcf1ed9[_0xfec7('0xd4')]['Messages'][_0xfec7('0xa6')](_0x194e08[_0xfec7('0xd4')]);return _0xcf1ed9;});})[_0xfec7('0x1b')](respondWithResult(_0x100a36,null))['catch'](handleError(_0x100a36,null));};exports['status']=function(_0x3c71a2,_0x1edec2,_0x543f97){if(_0x3c71a2[_0xfec7('0x55')]['id']){delete _0x3c71a2[_0xfec7('0x55')]['id'];}var _0x1730f5,_0x72f22,_0x411691;return db['SmsAccount']['find']({'where':{'id':_0x3c71a2['params']['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x1edec2,null))[_0xfec7('0x1b')](function(_0x5dc6bd){if(_0x5dc6bd){_0x411691=_0x5dc6bd;logger[_0xfec7('0x1d')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xfec7('0xd5'),_0x5dc6bd[_0xfec7('0x3b')],util[_0xfec7('0xd6')](_0x3c71a2['body'],{'showHidden':![],'depth':null}));switch(_0x5dc6bd[_0xfec7('0x3b')]){case'skebby':if(_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xd7')]&&_0x3c71a2[_0xfec7('0x55')][_0xfec7('0x25')]){_0x72f22=_0x3c71a2[_0xfec7('0x55')][_0xfec7('0x25')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xd7')]}});}break;case _0xfec7('0x86'):if(_0x3c71a2[_0xfec7('0x55')]['requestid']&&_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xd8')]){_0x72f22=_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xd8')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xd9')]}});}break;case _0xfec7('0x87'):if(_0x3c71a2['body']['message_id']&&_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xda')]){_0x72f22=_0x3c71a2[_0xfec7('0x55')]['status_code'];return db[_0xfec7('0xaa')]['find']({'where':{'messageId':_0x3c71a2['body'][_0xfec7('0x88')]}});}break;case _0xfec7('0x8d'):var _0x2bb8e1=_0x3c71a2['body'][_0xfec7('0x8e')][0x0];if(_0x2bb8e1[_0xfec7('0x8b')]&&_0x2bb8e1[_0xfec7('0x25')][_0xfec7('0xdb')]==='DELIVERED'){_0x72f22=_0x2bb8e1['status'][_0xfec7('0xdb')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x2bb8e1['messageId']}});}break;case _0xfec7('0x91'):if(_0x3c71a2[_0xfec7('0x55')][_0xfec7('0x8b')]&&_0x3c71a2[_0xfec7('0x55')]['status']){_0x72f22=_0x3c71a2[_0xfec7('0x55')][_0xfec7('0x25')];return db['SmsMessage'][_0xfec7('0x52')]({'where':{'messageId':_0x3c71a2['body'][_0xfec7('0x8b')]}});}break;case _0xfec7('0xdc'):if(_0x3c71a2['body'][0x0]['message']['id']){_0x72f22=_0x3c71a2[_0xfec7('0x55')][0x0][_0xfec7('0x3b')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x3c71a2[_0xfec7('0x55')][0x0][_0xfec7('0x22')]['id']}});}break;case _0xfec7('0x94'):if(_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xdd')]&&_0x3c71a2['body'][_0xfec7('0x25')]){_0x72f22=_0x3c71a2[_0xfec7('0x55')][_0xfec7('0x25')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x3c71a2['body'][_0xfec7('0xdd')]}});}break;}}})['then'](handleEntityNotFound(_0x1edec2,null))[_0xfec7('0x1b')](function(_0x2b5476){if(_0x2b5476){_0x1730f5=_0x2b5476;switch(_0x411691[_0xfec7('0x3b')]){case'skebby':if(_0x72f22===_0xfec7('0xde')){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfec7('0x25'),_0xfec7('0x82'),util[_0xfec7('0xd6')](_0x3c71a2[_0xfec7('0x55')],{'showHidden':![],'depth':null}));}break;case _0xfec7('0x86'):if(_0x72f22==='1'){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),_0xfec7('0x25'),_0xfec7('0x82'),util[_0xfec7('0xd6')](_0x3c71a2[_0xfec7('0x55')],{'showHidden':![],'depth':null}));}break;case _0xfec7('0x87'):if(!_0x3c71a2[_0xfec7('0x55')]['error_code']&&_0x72f22>=0xc8&&_0x72f22<=0xce){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),_0xfec7('0x25'),_0xfec7('0x87'),util[_0xfec7('0xd6')](_0x3c71a2['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x55e5f3=_0x3c71a2['body'][_0xfec7('0x8e')][0x0];if(_0x55e5f3[_0xfec7('0x25')][_0xfec7('0xdb')]===_0xfec7('0xde')){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),'status',_0xfec7('0x8d'),util[_0xfec7('0xd6')](_0x3c71a2['body'],{'showHidden':![],'depth':null}));}break;case _0xfec7('0x91'):if(_0x72f22==_0xfec7('0xdf')||_0x72f22=='RECEIVED_BY_RECIPIENT'){return _0x1730f5['update']({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),'status',_0xfec7('0x91'),util['inspect'](_0x3c71a2[_0xfec7('0x55')],{'showHidden':![],'depth':null}));}break;case _0xfec7('0xdc'):if(_0x72f22==_0xfec7('0xe0')){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),'status','bandwidth',util[_0xfec7('0xd6')](_0x3c71a2[_0xfec7('0x55')],{'showHidden':![],'depth':null}));}break;case _0xfec7('0x94'):if(_0x72f22===_0xfec7('0xe1')||_0x72f22==='ACCEPTD'){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),'status',_0xfec7('0x94'),util[_0xfec7('0xd6')](_0x3c71a2[_0xfec7('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x1730f5;}})['then'](respondWithResult(_0x1edec2,null))[_0xfec7('0x53')](handleError(_0x1edec2,null));};exports['statusGet']=function(_0x53cc0f,_0x2944d9,_0x415d70){var _0x4c8041,_0x259137,_0x255c6a;return db[_0xfec7('0x38')][_0xfec7('0x52')]({'where':{'id':_0x53cc0f[_0xfec7('0x50')]['id']}})['then'](handleEntityNotFound(_0x2944d9,null))['then'](function(_0x19b268){if(_0x19b268){_0x255c6a=_0x19b268;logger[_0xfec7('0x1d')](_0xfec7('0x1e'),'status',_0xfec7('0xd5'),_0x19b268[_0xfec7('0x3b')],util[_0xfec7('0xd6')](_0x53cc0f[_0xfec7('0x3e')],{'showHidden':![],'depth':null}));switch(_0x19b268[_0xfec7('0x3b')]){case _0xfec7('0x8f'):if(_0x53cc0f[_0xfec7('0x3e')][_0xfec7('0xe2')]&&_0x53cc0f[_0xfec7('0x3e')][_0xfec7('0xe3')]){_0x259137=_0x53cc0f[_0xfec7('0x3e')][_0xfec7('0xe3')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x53cc0f['query'][_0xfec7('0xe2')]}});}break;}}})['then'](handleEntityNotFound(_0x2944d9,null))[_0xfec7('0x1b')](function(_0x3a6ccf){if(_0x3a6ccf){_0x4c8041=_0x3a6ccf;switch(_0x255c6a[_0xfec7('0x3b')]){case _0xfec7('0x8f'):if(_0x259137==='2'||_0x259137==='6'){return _0x4c8041['update']({'read':!![]});}else{logger[_0xfec7('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfec7('0x25'),_0xfec7('0x8f'),util[_0xfec7('0xd6')](_0x53cc0f[_0xfec7('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x4c8041;}})[_0xfec7('0x1b')](respondWithResult(_0x2944d9,null))[_0xfec7('0x53')](handleError(_0x2944d9,null));};exports[_0xfec7('0xe4')]=function(_0x4e37cd,_0x792b59,_0xd4410e){return db[_0xfec7('0x38')]['find']({'where':{'id':_0x4e37cd['params']['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x792b59,null))['then'](function(_0x5cc07d){if(_0x5cc07d){return _0x5cc07d[_0xfec7('0xe4')](_0x4e37cd[_0xfec7('0x55')][_0xfec7('0x6c')],_[_0xfec7('0xa0')](_0x4e37cd[_0xfec7('0x55')],['ids','id'])||{})[_0xfec7('0xd2')](function(_0xb74a26){for(var _0x4b9537=0x0;_0x4b9537<_0x4e37cd[_0xfec7('0x55')][_0xfec7('0x6c')][_0xfec7('0x44')];_0x4b9537+=0x1){socket[_0xfec7('0xe5')](_0xfec7('0xe6'),{'UserId':Number(_0x4e37cd[_0xfec7('0x55')]['ids'][_0x4b9537]),'SmsAccountId':Number(_0x4e37cd['params']['id'])});}return _0xb74a26;});}})['then'](respondWithResult(_0x792b59,null))['catch'](handleError(_0x792b59,null));};exports[_0xfec7('0xe7')]=function(_0x2c877b,_0x43e130,_0x466875){return db[_0xfec7('0x38')][_0xfec7('0x52')]({'where':{'id':_0x2c877b[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x43e130,null))['then'](function(_0x4542ae){if(_0x4542ae){return _0x4542ae[_0xfec7('0xe7')](_0x2c877b[_0xfec7('0x3e')][_0xfec7('0x6c')])['then'](function(){if(_['isArray'](_0x2c877b[_0xfec7('0x3e')][_0xfec7('0x6c')])){for(var _0x53a149=0x0;_0x53a149<_0x2c877b[_0xfec7('0x3e')][_0xfec7('0x6c')][_0xfec7('0x44')];_0x53a149+=0x1){socket[_0xfec7('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x2c877b['query']['ids'][_0x53a149]),'SmsAccountId':Number(_0x2c877b[_0xfec7('0x50')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x2c877b[_0xfec7('0x3e')]['ids']),'SmsAccountId':Number(_0x2c877b['params']['id'])});}});}})[_0xfec7('0x1b')](respondWithStatusCode(_0x43e130,null))[_0xfec7('0x53')](handleError(_0x43e130,null));};exports['getAgents']=function(_0x366e63,_0xc63b32,_0x251533){var _0x29cb71={};var _0x307a98={};var _0x2d92b6;var _0x359ad2;return db[_0xfec7('0x38')][_0xfec7('0x68')]({'where':{'id':_0x366e63[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0xc63b32,null))[_0xfec7('0x1b')](function(_0x5c97e3){if(_0x5c97e3){_0x2d92b6=_0x5c97e3;_0x307a98['model']=_[_0xfec7('0x3f')](db[_0xfec7('0xae')][_0xfec7('0x39')]);_0x307a98[_0xfec7('0x3e')]=_['keys'](_0x366e63[_0xfec7('0x3e')]);_0x307a98[_0xfec7('0x40')]=_[_0xfec7('0x41')](_0x307a98[_0xfec7('0x3c')],_0x307a98[_0xfec7('0x3e')]);_0x29cb71[_0xfec7('0x42')]=_[_0xfec7('0x41')](_0x307a98[_0xfec7('0x3c')],qs[_0xfec7('0x43')](_0x366e63[_0xfec7('0x3e')][_0xfec7('0x43')]));_0x29cb71[_0xfec7('0x42')]=_0x29cb71[_0xfec7('0x42')][_0xfec7('0x44')]?_0x29cb71[_0xfec7('0x42')]:_0x307a98[_0xfec7('0x3c')];_0x29cb71[_0xfec7('0x63')]=qs[_0xfec7('0x64')](_0x366e63['query'][_0xfec7('0x64')]);_0x29cb71['where']=qs['filters'](_[_0xfec7('0x48')](_0x366e63['query'],_0x307a98[_0xfec7('0x40')]));if(_0x366e63[_0xfec7('0x3e')][_0xfec7('0x49')]){_0x29cb71['where']=_[_0xfec7('0x4a')](_0x29cb71[_0xfec7('0x47')],{'$or':_['map'](_0x29cb71[_0xfec7('0x42')],function(_0x3831ff){var _0x1ba1be={};_0x1ba1be[_0x3831ff]={'$like':'%'+_0x366e63[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x1ba1be;})});}_0x29cb71=_[_0xfec7('0x4a')]({},_0x29cb71,_0x366e63['options']);return _0x2d92b6[_0xfec7('0xe8')](_0x29cb71);}})[_0xfec7('0x1b')](function(_0x442dec){if(_0x442dec){_0x359ad2=_0x442dec['length'];if(!_0x366e63[_0xfec7('0x3e')][_0xfec7('0x45')](_0xfec7('0x46'))){_0x29cb71[_0xfec7('0x28')]=qs[_0xfec7('0x28')](_0x366e63['query'][_0xfec7('0x28')]);_0x29cb71[_0xfec7('0x27')]=qs[_0xfec7('0x27')](_0x366e63[_0xfec7('0x3e')]['offset']);}return _0x2d92b6['getAgents'](_0x29cb71);}})[_0xfec7('0x1b')](function(_0x157b22){if(_0x157b22){return _0x157b22?{'count':_0x359ad2,'rows':_0x157b22}:null;}})[_0xfec7('0x1b')](respondWithResult(_0xc63b32,null))[_0xfec7('0x53')](handleError(_0xc63b32,null));}; \ No newline at end of file +var _0xaa74=['from','sender','text','clicksend','Text','MessageUUID','infobip','results','csc','originatingAddress','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','omit','CmContact','contact','SmsInteraction','spread','interaction','autoclose','push','applications','close','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','DESC','defaults','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','statusInt','requestid','message_id','status_code','groupName','DELIVERED','clickatell','redif','error_code','DELIVERED_TO_GATEWAY','DELIVRD','statusGet','message-id','state','addAgents','ids','emit','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy','then','get','SmsAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','pick','SmsAccountId','include','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','messageId','skebby'];(function(_0x354399,_0xaf53c0){var _0x19e1a2=function(_0x280616){while(--_0x280616){_0x354399['push'](_0x354399['shift']());}};_0x19e1a2(++_0xaf53c0);}(_0xaa74,0x14e));var _0x4aa7=function(_0x55c1be,_0x5b4b3e){_0x55c1be=_0x55c1be-0x0;var _0x1f1114=_0xaa74[_0x55c1be];return _0x1f1114;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4aa7('0x0'));var zipdir=require(_0x4aa7('0x1'));var jsonpatch=require(_0x4aa7('0x2'));var rp=require(_0x4aa7('0x3'));var moment=require(_0x4aa7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4aa7('0x5'));var util=require(_0x4aa7('0x6'));var path=require(_0x4aa7('0x7'));var sox=require('sox');var csv=require(_0x4aa7('0x8'));var ejs=require(_0x4aa7('0x9'));var fs=require('fs');var fs_extra=require(_0x4aa7('0xa'));var _=require(_0x4aa7('0xb'));var squel=require(_0x4aa7('0xc'));var crypto=require(_0x4aa7('0xd'));var jsforce=require(_0x4aa7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4aa7('0x8'));var querystring=require(_0x4aa7('0xf'));var Papa=require(_0x4aa7('0x10'));var Redis=require(_0x4aa7('0x11'));var authService=require(_0x4aa7('0x12'));var qs=require(_0x4aa7('0x13'));var as=require(_0x4aa7('0x14'));var hardwareService=require(_0x4aa7('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4aa7('0x16'));var config=require(_0x4aa7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4aa7('0x18'))['db'];config[_0x4aa7('0x19')]=_['defaults'](config[_0x4aa7('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4aa7('0x1a'))(new Redis(config['redis']));require(_0x4aa7('0x1b'))[_0x4aa7('0x1c')](socket);var jayson=require(_0x4aa7('0x1d'));var client=jayson[_0x4aa7('0x1e')][_0x4aa7('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x22ba1f,_0x167596,_0x27504,_0x459b9e){return new BPromise(function(_0x112497,_0x3b67ec){var _0x23bea5=_0x459b9e||client;return _0x23bea5[_0x4aa7('0x20')](_0x22ba1f,_0x27504)['then'](function(_0x8d20f1){logger['info'](_0x4aa7('0x21'),_0x167596,_0x4aa7('0x22'));logger[_0x4aa7('0x23')](_0x4aa7('0x24'),_0x167596,_0x4aa7('0x22'),JSON[_0x4aa7('0x25')](_0x8d20f1));if(_0x8d20f1['error']){if(_0x8d20f1['error'][_0x4aa7('0x26')]===0x1f4){logger[_0x4aa7('0x27')](_0x4aa7('0x21'),_0x167596,_0x8d20f1[_0x4aa7('0x27')][_0x4aa7('0x28')]);return _0x3b67ec(_0x8d20f1['error'][_0x4aa7('0x28')]);}logger[_0x4aa7('0x27')](_0x4aa7('0x21'),_0x167596,_0x8d20f1[_0x4aa7('0x27')][_0x4aa7('0x28')]);return _0x112497(_0x8d20f1[_0x4aa7('0x27')]['message']);}else{logger[_0x4aa7('0x29')](_0x4aa7('0x21'),_0x167596,_0x4aa7('0x22'));_0x112497(_0x8d20f1[_0x4aa7('0x2a')][_0x4aa7('0x28')]);}})[_0x4aa7('0x2b')](function(_0x54108d){logger['error'](_0x4aa7('0x21'),_0x167596,_0x54108d);_0x3b67ec(_0x54108d);});});}function respondWithStatusCode(_0x4e7396,_0x349503){_0x349503=_0x349503||0xcc;return function(_0xf48061){if(_0xf48061){return _0x4e7396[_0x4aa7('0x2c')](_0x349503);}return _0x4e7396[_0x4aa7('0x2d')](_0x349503)['end']();};}function respondWithResult(_0x2b6301,_0x65c797){_0x65c797=_0x65c797||0xc8;return function(_0x46bd76){if(_0x46bd76){return _0x2b6301[_0x4aa7('0x2d')](_0x65c797)[_0x4aa7('0x2e')](_0x46bd76);}};}function respondWithFilteredResult(_0x5c8f2e,_0x572d23){return function(_0x5bd383){if(_0x5bd383){var _0x2c59f9=typeof _0x572d23['offset']===_0x4aa7('0x2f')&&typeof _0x572d23[_0x4aa7('0x30')]===_0x4aa7('0x2f');var _0x4ceb0f=_0x5bd383['count'];var _0x447d51=_0x2c59f9?0x0:_0x572d23[_0x4aa7('0x31')];var _0x553ac8=_0x2c59f9?_0x5bd383[_0x4aa7('0x32')]:_0x572d23[_0x4aa7('0x31')]+_0x572d23[_0x4aa7('0x30')];var _0x4f741f;if(_0x553ac8>=_0x4ceb0f){_0x553ac8=_0x4ceb0f;_0x4f741f=0xc8;}else{_0x4f741f=0xce;}_0x5c8f2e['status'](_0x4f741f);return _0x5c8f2e[_0x4aa7('0x33')](_0x4aa7('0x34'),_0x447d51+'-'+_0x553ac8+'/'+_0x4ceb0f)[_0x4aa7('0x2e')](_0x5bd383);}return null;};}function patchUpdates(_0x4f94c5){return function(_0x3842e9){try{jsonpatch[_0x4aa7('0x35')](_0x3842e9,_0x4f94c5,!![]);}catch(_0x6cb7c4){return BPromise[_0x4aa7('0x36')](_0x6cb7c4);}return _0x3842e9['save']();};}function saveUpdates(_0x4ce899,_0x328bbe){return function(_0x4cd1a8){if(_0x4cd1a8){return _0x4cd1a8[_0x4aa7('0x37')](_0x4ce899)['then'](function(_0x1dd62e){return _0x1dd62e;});}return null;};}function removeEntity(_0x260888,_0x1fd49f){return function(_0x2976aa){if(_0x2976aa){return _0x2976aa[_0x4aa7('0x38')]()[_0x4aa7('0x39')](function(){var _0xd8e0dd=_0x2976aa[_0x4aa7('0x3a')]({'plain':!![]});var _0x5c8573=_0x4aa7('0x3b');return db[_0x4aa7('0x3c')]['destroy']({'where':{'type':_0x5c8573,'resourceId':_0xd8e0dd['id']}})['then'](function(){return _0x2976aa;});})[_0x4aa7('0x39')](function(){_0x260888['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x529818,_0xafd049){return function(_0x50583c){if(!_0x50583c){_0x529818['sendStatus'](0x194);}return _0x50583c;};}function handleError(_0x5674c7,_0xbe47c5){_0xbe47c5=_0xbe47c5||0x1f4;return function(_0x34386f){logger[_0x4aa7('0x27')](_0x34386f['stack']);if(_0x34386f[_0x4aa7('0x3d')]){delete _0x34386f[_0x4aa7('0x3d')];}_0x5674c7[_0x4aa7('0x2d')](_0xbe47c5)[_0x4aa7('0x3e')](_0x34386f);};}exports[_0x4aa7('0x3f')]=function(_0x3b710d,_0x44f7cf){var _0x391ff8={'include':[{'model':db[_0x4aa7('0x40')],'as':_0x4aa7('0x41')}]},_0x37ab05={},_0x18320e={'count':0x0,'rows':[]};var _0x548403=_[_0x4aa7('0x42')](db[_0x4aa7('0x43')][_0x4aa7('0x44')],function(_0x3e10fa){return{'name':_0x3e10fa[_0x4aa7('0x45')],'type':_0x3e10fa[_0x4aa7('0x46')]['key']};});_0x37ab05[_0x4aa7('0x47')]=_[_0x4aa7('0x42')](_0x548403,_0x4aa7('0x3d'));_0x37ab05[_0x4aa7('0x48')]=_[_0x4aa7('0x49')](_0x3b710d[_0x4aa7('0x48')]);_0x37ab05[_0x4aa7('0x4a')]=_[_0x4aa7('0x4b')](_0x37ab05[_0x4aa7('0x47')],_0x37ab05['query']);_0x391ff8[_0x4aa7('0x4c')]=_['intersection'](_0x37ab05['model'],qs[_0x4aa7('0x4d')](_0x3b710d['query'][_0x4aa7('0x4d')]));_0x391ff8[_0x4aa7('0x4c')]=_0x391ff8['attributes'][_0x4aa7('0x4e')]?_0x391ff8[_0x4aa7('0x4c')]:_0x37ab05[_0x4aa7('0x47')];if(!_0x3b710d[_0x4aa7('0x48')][_0x4aa7('0x4f')](_0x4aa7('0x50'))){_0x391ff8['limit']=qs[_0x4aa7('0x30')](_0x3b710d['query']['limit']);_0x391ff8[_0x4aa7('0x31')]=qs[_0x4aa7('0x31')](_0x3b710d[_0x4aa7('0x48')][_0x4aa7('0x31')]);}_0x391ff8[_0x4aa7('0x51')]=qs[_0x4aa7('0x52')](_0x3b710d['query'][_0x4aa7('0x52')]);_0x391ff8[_0x4aa7('0x53')]=qs[_0x4aa7('0x4a')](_['pick'](_0x3b710d[_0x4aa7('0x48')],_0x37ab05['filters']),_0x548403);if(_0x3b710d[_0x4aa7('0x48')][_0x4aa7('0x54')]){_0x391ff8[_0x4aa7('0x53')]=_[_0x4aa7('0x55')](_0x391ff8['where'],{'$or':_[_0x4aa7('0x42')](_0x548403,function(_0x31ff4e){if(_0x31ff4e[_0x4aa7('0x46')]!==_0x4aa7('0x56')){var _0x4a51f5={};_0x4a51f5[_0x31ff4e[_0x4aa7('0x3d')]]={'$like':'%'+_0x3b710d[_0x4aa7('0x48')][_0x4aa7('0x54')]+'%'};return _0x4a51f5;}})});}_0x391ff8=_[_0x4aa7('0x55')]({},_0x391ff8,_0x3b710d[_0x4aa7('0x57')]);var _0x127653={'where':_0x391ff8[_0x4aa7('0x53')]};return db[_0x4aa7('0x43')][_0x4aa7('0x32')](_0x127653)[_0x4aa7('0x39')](function(_0x4837e1){_0x18320e['count']=_0x4837e1;if(_0x3b710d[_0x4aa7('0x48')][_0x4aa7('0x58')]){_0x391ff8['include']=[{'all':!![]}];}return db[_0x4aa7('0x43')]['findAll'](_0x391ff8);})[_0x4aa7('0x39')](function(_0x4ba56b){_0x18320e[_0x4aa7('0x59')]=_0x4ba56b;return _0x18320e;})[_0x4aa7('0x39')](respondWithFilteredResult(_0x44f7cf,_0x391ff8))[_0x4aa7('0x2b')](handleError(_0x44f7cf,null));};exports['show']=function(_0x2803b6,_0x1e4f96){var _0x10dd49={'raw':![],'where':{'id':_0x2803b6['params']['id']},'include':[{'model':db[_0x4aa7('0x40')],'as':_0x4aa7('0x41')}]},_0x17707c={};_0x17707c[_0x4aa7('0x47')]=_[_0x4aa7('0x49')](db['SmsAccount'][_0x4aa7('0x44')]);_0x17707c[_0x4aa7('0x48')]=_[_0x4aa7('0x49')](_0x2803b6[_0x4aa7('0x48')]);_0x17707c[_0x4aa7('0x4a')]=_['intersection'](_0x17707c[_0x4aa7('0x47')],_0x17707c[_0x4aa7('0x48')]);_0x10dd49[_0x4aa7('0x4c')]=_[_0x4aa7('0x4b')](_0x17707c[_0x4aa7('0x47')],qs[_0x4aa7('0x4d')](_0x2803b6[_0x4aa7('0x48')]['fields']));_0x10dd49[_0x4aa7('0x4c')]=_0x10dd49[_0x4aa7('0x4c')][_0x4aa7('0x4e')]?_0x10dd49[_0x4aa7('0x4c')]:_0x17707c[_0x4aa7('0x47')];if(_0x2803b6[_0x4aa7('0x48')][_0x4aa7('0x58')]){_0x10dd49['include']=[{'all':!![]}];}_0x10dd49=_[_0x4aa7('0x55')]({},_0x10dd49,_0x2803b6['options']);return db['SmsAccount'][_0x4aa7('0x5a')](_0x10dd49)['then'](handleEntityNotFound(_0x1e4f96,null))[_0x4aa7('0x39')](respondWithResult(_0x1e4f96,null))[_0x4aa7('0x2b')](handleError(_0x1e4f96,null));};exports[_0x4aa7('0x5b')]=function(_0x57b58d,_0x5f5283){return db[_0x4aa7('0x43')][_0x4aa7('0x5b')](_0x57b58d[_0x4aa7('0x5c')],{})[_0x4aa7('0x39')](function(_0x1e8a84){var _0x64620b=_0x57b58d[_0x4aa7('0x5d')][_0x4aa7('0x3a')]({'plain':!![]});if(!_0x64620b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x64620b['role']==='user'){var _0x1bff90=_0x1e8a84[_0x4aa7('0x3a')]({'plain':!![]});var _0x3ff749=_0x4aa7('0x3b');return db[_0x4aa7('0x5e')][_0x4aa7('0x5a')]({'where':{'name':_0x3ff749,'userProfileId':_0x64620b[_0x4aa7('0x5f')]},'raw':!![]})['then'](function(_0x43abbf){if(_0x43abbf&&_0x43abbf[_0x4aa7('0x60')]===0x0){return db[_0x4aa7('0x3c')][_0x4aa7('0x5b')]({'name':_0x1bff90['name'],'resourceId':_0x1bff90['id'],'type':_0x43abbf['name'],'sectionId':_0x43abbf['id']},{})['then'](function(){return _0x1e8a84;});}else{return _0x1e8a84;}})['catch'](function(_0x468c04){logger[_0x4aa7('0x27')](_0x4aa7('0x61'),_0x468c04);throw _0x468c04;});}return _0x1e8a84;})[_0x4aa7('0x39')](respondWithResult(_0x5f5283,0xc9))[_0x4aa7('0x2b')](handleError(_0x5f5283,null));};exports[_0x4aa7('0x37')]=function(_0x10eb1e,_0x2f62f9){if(_0x10eb1e[_0x4aa7('0x5c')]['id']){delete _0x10eb1e[_0x4aa7('0x5c')]['id'];}return db[_0x4aa7('0x43')]['find']({'where':{'id':_0x10eb1e['params']['id']},'include':[{'model':db[_0x4aa7('0x40')],'as':_0x4aa7('0x41')}]})['then'](handleEntityNotFound(_0x2f62f9,null))[_0x4aa7('0x39')](saveUpdates(_0x10eb1e[_0x4aa7('0x5c')],null))[_0x4aa7('0x39')](respondWithResult(_0x2f62f9,null))[_0x4aa7('0x2b')](handleError(_0x2f62f9,null));};exports[_0x4aa7('0x38')]=function(_0x4f2f08,_0x8bec2d){return db[_0x4aa7('0x43')]['find']({'where':{'id':_0x4f2f08[_0x4aa7('0x62')]['id']}})[_0x4aa7('0x39')](handleEntityNotFound(_0x8bec2d,null))['then'](removeEntity(_0x8bec2d,null))['catch'](handleError(_0x8bec2d,null));};exports[_0x4aa7('0x63')]=function(_0x178171,_0x24daeb){return db['SmsAccount'][_0x4aa7('0x63')]()[_0x4aa7('0x39')](respondWithResult(_0x24daeb,null))[_0x4aa7('0x2b')](handleError(_0x24daeb,null));};exports[_0x4aa7('0x64')]=function(_0xd81602,_0x4df9bc,_0x371c64){if(_0xd81602[_0x4aa7('0x5c')]['id']){delete _0xd81602['body']['id'];}return db[_0x4aa7('0x43')][_0x4aa7('0x5a')]({'where':{'id':_0xd81602[_0x4aa7('0x62')]['id']}})['then'](handleEntityNotFound(_0x4df9bc,null))[_0x4aa7('0x39')](function(_0x1554d1){if(_0x1554d1){_0xd81602[_0x4aa7('0x5c')]['SmsAccountId']=_0x1554d1['id'];return db[_0x4aa7('0x65')][_0x4aa7('0x5b')](_0xd81602[_0x4aa7('0x5c')]);}})[_0x4aa7('0x39')](respondWithResult(_0x4df9bc,null))[_0x4aa7('0x2b')](handleError(_0x4df9bc,null));};exports[_0x4aa7('0x66')]=function(_0x4725e9,_0x612d68,_0x15f5e2){var _0x21e065={'raw':![],'where':{}};var _0x4eb135={};var _0x2abc30={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4aa7('0x67')]({'where':{'id':_0x4725e9[_0x4aa7('0x62')]['id']}})['then'](handleEntityNotFound(_0x612d68,null))[_0x4aa7('0x39')](function(_0x24181f){if(_0x24181f){_0x4eb135[_0x4aa7('0x47')]=_[_0x4aa7('0x49')](db['Disposition']['rawAttributes']);_0x4eb135[_0x4aa7('0x48')]=_[_0x4aa7('0x49')](_0x4725e9[_0x4aa7('0x48')]);_0x4eb135[_0x4aa7('0x4a')]=_[_0x4aa7('0x4b')](_0x4eb135[_0x4aa7('0x47')],_0x4eb135[_0x4aa7('0x48')]);_0x21e065[_0x4aa7('0x4c')]=_[_0x4aa7('0x4b')](_0x4eb135[_0x4aa7('0x47')],qs[_0x4aa7('0x4d')](_0x4725e9[_0x4aa7('0x48')][_0x4aa7('0x4d')]));_0x21e065[_0x4aa7('0x4c')]=_0x21e065[_0x4aa7('0x4c')][_0x4aa7('0x4e')]?_0x21e065[_0x4aa7('0x4c')]:_0x4eb135[_0x4aa7('0x47')];if(!_0x4725e9[_0x4aa7('0x48')][_0x4aa7('0x4f')]('nolimit')){_0x21e065[_0x4aa7('0x30')]=qs['limit'](_0x4725e9['query']['limit']);_0x21e065[_0x4aa7('0x31')]=qs[_0x4aa7('0x31')](_0x4725e9['query']['offset']);}_0x21e065[_0x4aa7('0x51')]=qs['sort'](_0x4725e9[_0x4aa7('0x48')][_0x4aa7('0x52')]);_0x21e065[_0x4aa7('0x53')]=qs[_0x4aa7('0x4a')](_[_0x4aa7('0x68')](_0x4725e9[_0x4aa7('0x48')],_0x4eb135[_0x4aa7('0x4a')]));_0x21e065[_0x4aa7('0x53')][_0x4aa7('0x69')]=_0x24181f['id'];if(_0x4725e9['query']['filter']){_0x21e065[_0x4aa7('0x53')]=_[_0x4aa7('0x55')](_0x21e065[_0x4aa7('0x53')],{'$or':_[_0x4aa7('0x42')](_0x21e065['attributes'],function(_0x5cb1ae){var _0x181fa0={};_0x181fa0[_0x5cb1ae]={'$like':'%'+_0x4725e9['query'][_0x4aa7('0x54')]+'%'};return _0x181fa0;})});}_0x21e065=_[_0x4aa7('0x55')]({},_0x21e065,_0x4725e9[_0x4aa7('0x57')]);return db['Disposition'][_0x4aa7('0x32')]({'where':_0x21e065[_0x4aa7('0x53')]})[_0x4aa7('0x39')](function(_0x5285c3){_0x2abc30[_0x4aa7('0x32')]=_0x5285c3;if(_0x4725e9['query'][_0x4aa7('0x58')]){_0x21e065[_0x4aa7('0x6a')]=[{'all':!![]}];}return db[_0x4aa7('0x65')][_0x4aa7('0x6b')](_0x21e065);})[_0x4aa7('0x39')](function(_0xba3f05){_0x2abc30[_0x4aa7('0x59')]=_0xba3f05;return _0x2abc30;});}})[_0x4aa7('0x39')](respondWithFilteredResult(_0x612d68,_0x21e065))[_0x4aa7('0x2b')](handleError(_0x612d68,null));};exports['removeDispositions']=function(_0x1989e9,_0x5b5479,_0x18e1c3){return db[_0x4aa7('0x43')]['find']({'where':{'id':_0x1989e9['params']['id']}})['then'](handleEntityNotFound(_0x5b5479,null))[_0x4aa7('0x39')](function(_0x4b9b93){if(_0x4b9b93){return _0x4b9b93[_0x4aa7('0x6c')](_0x1989e9[_0x4aa7('0x48')]['ids']);}})[_0x4aa7('0x39')](respondWithStatusCode(_0x5b5479,null))[_0x4aa7('0x2b')](handleError(_0x5b5479,null));};exports[_0x4aa7('0x6d')]=function(_0x56abaa,_0x345083,_0x15a9c9){if(_0x56abaa[_0x4aa7('0x5c')]['id']){delete _0x56abaa[_0x4aa7('0x5c')]['id'];}return db[_0x4aa7('0x43')][_0x4aa7('0x5a')]({'where':{'id':_0x56abaa[_0x4aa7('0x62')]['id']}})['then'](handleEntityNotFound(_0x345083,null))['then'](function(_0x4576f1){if(_0x4576f1){_0x56abaa[_0x4aa7('0x5c')][_0x4aa7('0x69')]=_0x4576f1['id'];return db[_0x4aa7('0x6e')]['create'](_0x56abaa[_0x4aa7('0x5c')]);}})[_0x4aa7('0x39')](respondWithResult(_0x345083,null))[_0x4aa7('0x2b')](handleError(_0x345083,null));};exports[_0x4aa7('0x6f')]=function(_0x1c38b1,_0x17c912,_0x22e30f){var _0x1db4c2={'raw':![],'where':{}};var _0xe3109f={};var _0x51eb5c={'count':0x0,'rows':[]};return db[_0x4aa7('0x43')][_0x4aa7('0x67')]({'where':{'id':_0x1c38b1[_0x4aa7('0x62')]['id']}})[_0x4aa7('0x39')](handleEntityNotFound(_0x17c912,null))[_0x4aa7('0x39')](function(_0x390040){if(_0x390040){_0xe3109f[_0x4aa7('0x47')]=_[_0x4aa7('0x49')](db[_0x4aa7('0x6e')][_0x4aa7('0x44')]);_0xe3109f[_0x4aa7('0x48')]=_[_0x4aa7('0x49')](_0x1c38b1[_0x4aa7('0x48')]);_0xe3109f[_0x4aa7('0x4a')]=_[_0x4aa7('0x4b')](_0xe3109f[_0x4aa7('0x47')],_0xe3109f[_0x4aa7('0x48')]);_0x1db4c2[_0x4aa7('0x4c')]=_[_0x4aa7('0x4b')](_0xe3109f[_0x4aa7('0x47')],qs[_0x4aa7('0x4d')](_0x1c38b1['query']['fields']));_0x1db4c2[_0x4aa7('0x4c')]=_0x1db4c2['attributes'][_0x4aa7('0x4e')]?_0x1db4c2[_0x4aa7('0x4c')]:_0xe3109f[_0x4aa7('0x47')];if(!_0x1c38b1[_0x4aa7('0x48')][_0x4aa7('0x4f')](_0x4aa7('0x50'))){_0x1db4c2[_0x4aa7('0x30')]=qs[_0x4aa7('0x30')](_0x1c38b1[_0x4aa7('0x48')][_0x4aa7('0x30')]);_0x1db4c2[_0x4aa7('0x31')]=qs[_0x4aa7('0x31')](_0x1c38b1[_0x4aa7('0x48')][_0x4aa7('0x31')]);}_0x1db4c2[_0x4aa7('0x51')]=qs[_0x4aa7('0x52')](_0x1c38b1['query'][_0x4aa7('0x52')]);_0x1db4c2['where']=qs[_0x4aa7('0x4a')](_[_0x4aa7('0x68')](_0x1c38b1[_0x4aa7('0x48')],_0xe3109f[_0x4aa7('0x4a')]));_0x1db4c2[_0x4aa7('0x53')][_0x4aa7('0x69')]=_0x390040['id'];if(_0x1c38b1[_0x4aa7('0x48')][_0x4aa7('0x54')]){_0x1db4c2[_0x4aa7('0x53')]=_[_0x4aa7('0x55')](_0x1db4c2[_0x4aa7('0x53')],{'$or':_['map'](_0x1db4c2[_0x4aa7('0x4c')],function(_0x377aaf){var _0x5cca55={};_0x5cca55[_0x377aaf]={'$like':'%'+_0x1c38b1[_0x4aa7('0x48')][_0x4aa7('0x54')]+'%'};return _0x5cca55;})});}_0x1db4c2=_[_0x4aa7('0x55')]({},_0x1db4c2,_0x1c38b1[_0x4aa7('0x57')]);return db[_0x4aa7('0x6e')][_0x4aa7('0x32')]({'where':_0x1db4c2[_0x4aa7('0x53')]})[_0x4aa7('0x39')](function(_0x461b7d){_0x51eb5c[_0x4aa7('0x32')]=_0x461b7d;if(_0x1c38b1[_0x4aa7('0x48')]['includeAll']){_0x1db4c2[_0x4aa7('0x6a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4aa7('0x6b')](_0x1db4c2);})['then'](function(_0x5115ce){_0x51eb5c['rows']=_0x5115ce;return _0x51eb5c;});}})[_0x4aa7('0x39')](respondWithFilteredResult(_0x17c912,_0x1db4c2))['catch'](handleError(_0x17c912,null));};exports[_0x4aa7('0x70')]=function(_0x4a77d0,_0x4e08af,_0x14bb82){return db[_0x4aa7('0x43')][_0x4aa7('0x5a')]({'where':{'id':_0x4a77d0[_0x4aa7('0x62')]['id']}})[_0x4aa7('0x39')](handleEntityNotFound(_0x4e08af,null))[_0x4aa7('0x39')](function(_0x5c3cd3){if(_0x5c3cd3){return _0x5c3cd3[_0x4aa7('0x70')](_0x4a77d0[_0x4aa7('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x4e08af,null))['catch'](handleError(_0x4e08af,null));};exports[_0x4aa7('0x71')]=function(_0x3c2655,_0x435ad9,_0x1ad4d5){var _0x60063c={'channel':'sms'};var _0x260d14=[];var _0x33a221=[];var _0x39d3d1={};return db[_0x4aa7('0x43')][_0x4aa7('0x5a')]({'where':{'id':_0x3c2655[_0x4aa7('0x62')]['id']},'include':[{'model':db[_0x4aa7('0x72')],'as':_0x4aa7('0x73')}]})[_0x4aa7('0x39')](handleEntityNotFound(_0x435ad9,null))[_0x4aa7('0x39')](function(_0x28f355){_0x60063c[_0x4aa7('0x74')]=_0x28f355;_0x60063c['applications']=_['orderBy'](_0x28f355[_0x4aa7('0x73')],[_0x4aa7('0x75')],[_0x4aa7('0x76')]);if(_0x60063c['account'][_0x4aa7('0x73')]){delete _0x60063c['account'][_0x4aa7('0x73')];}return db['CmContact'][_0x4aa7('0x63')]();})[_0x4aa7('0x39')](function(_0x11947d){if(!_0x11947d){throw new db[(_0x4aa7('0x77'))][(_0x4aa7('0x78'))](_0x4aa7('0x79'));}_0x260d14=_['difference'](_[_0x4aa7('0x49')](_0x11947d),[_0x4aa7('0x7a'),_0x4aa7('0x7b')]);_0x33a221=_[_0x4aa7('0x7c')](_['keys'](_0x11947d),[_0x4aa7('0x7a'),_0x4aa7('0x7b'),_0x4aa7('0x7d'),'ListId']);_0x60063c[_0x4aa7('0x5c')]={'mapKey':_0x4aa7('0x7e')};if(_0x60063c[_0x4aa7('0x74')]['type']){switch(_0x60063c[_0x4aa7('0x74')][_0x4aa7('0x46')]){case _0x4aa7('0x7f'):_0x60063c[_0x4aa7('0x5c')]['from']=_0x3c2655['body']['From'];_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x5c')]=_0x3c2655[_0x4aa7('0x5c')]['Body'];_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x80')]=_0x3c2655['body']['MessageSid'];break;case _0x4aa7('0x81'):_0x60063c['body'][_0x4aa7('0x82')]='+'+_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x83')];_0x60063c['body'][_0x4aa7('0x5c')]=_0x3c2655['body'][_0x4aa7('0x84')];break;case'connectel':_0x60063c['body'][_0x4aa7('0x82')]=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x82')];_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x5c')]=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x28')];break;case _0x4aa7('0x85'):_0x60063c[_0x4aa7('0x5c')]['from']=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x82')];_0x60063c[_0x4aa7('0x5c')]['body']=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x5c')];_0x60063c['body'][_0x4aa7('0x80')]=_0x3c2655[_0x4aa7('0x5c')]['message_id'];break;case'plivo':_0x60063c[_0x4aa7('0x5c')]['from']=_0x3c2655[_0x4aa7('0x5c')]['From'];_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x5c')]=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x86')];_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x80')]=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x87')];break;case _0x4aa7('0x88'):_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x82')]='+'+_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x89')][0x0][_0x4aa7('0x82')];_0x60063c['body'][_0x4aa7('0x5c')]=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x89')][0x0][_0x4aa7('0x84')];_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x80')]=_0x3c2655[_0x4aa7('0x5c')]['results'][0x0][_0x4aa7('0x80')];break;case _0x4aa7('0x8a'):_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x82')]=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x8b')];_0x60063c['body'][_0x4aa7('0x5c')]=_0x3c2655[_0x4aa7('0x5c')]['segmentedMessage'][_0x4aa7('0x28')];break;case'clickatell':_0x60063c['body'][_0x4aa7('0x82')]=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x8c')];_0x60063c['body'][_0x4aa7('0x5c')]=_0x3c2655[_0x4aa7('0x5c')]['text'];_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x80')]=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x8d')];break;case _0x4aa7('0x8e'):_0x60063c['body'][_0x4aa7('0x80')]=_0x3c2655[_0x4aa7('0x5c')][0x0][_0x4aa7('0x28')]['id'];_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x82')]=_0x3c2655[_0x4aa7('0x5c')][0x0]['message'][_0x4aa7('0x82')];_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x5c')]=_0x3c2655[_0x4aa7('0x5c')][0x0][_0x4aa7('0x28')][_0x4aa7('0x84')];break;case _0x4aa7('0x8f'):_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x82')]=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x82')];_0x60063c[_0x4aa7('0x5c')]['body']=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x28')];_0x60063c['body']['messageId']=_0x3c2655[_0x4aa7('0x5c')][_0x4aa7('0x90')];break;}}if(_0x60063c[_0x4aa7('0x5c')]['id']){delete _0x60063c[_0x4aa7('0x5c')]['id'];}if(_[_0x4aa7('0x91')](_0x60063c[_0x4aa7('0x5c')]['from'])){throw new db['Sequelize'][(_0x4aa7('0x78'))](_0x4aa7('0x92'));}if(_['isNil'](_0x60063c[_0x4aa7('0x5c')]['body'])||_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x5c')]===''){throw new db[(_0x4aa7('0x77'))][(_0x4aa7('0x78'))](_0x4aa7('0x93'));}if(_[_0x4aa7('0x91')](_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x94')])){throw new db[(_0x4aa7('0x77'))][(_0x4aa7('0x78'))](_0x4aa7('0x95')+_0x33a221);}if(!_['includes'](_0x33a221,_0x60063c['body'][_0x4aa7('0x94')])){throw new db[(_0x4aa7('0x77'))][(_0x4aa7('0x78'))](_0x4aa7('0x96')+_0x33a221);}_0x39d3d1[_0x60063c['body'][_0x4aa7('0x94')]]=_0x60063c['body']['from'];return db[_0x4aa7('0x97')][_0x4aa7('0x5a')]({'where':{'id':_0x60063c[_0x4aa7('0x74')][_0x4aa7('0x98')]},'include':[{'model':db['CmContact'],'as':_0x4aa7('0x99'),'where':_0x39d3d1,'limit':0x1,'order':[[_0x4aa7('0x7b'),'DESC']]}]});})[_0x4aa7('0x39')](handleEntityNotFound(_0x435ad9,null))[_0x4aa7('0x39')](function(_0x3d1497){if(_0x3d1497){_0x60063c[_0x4aa7('0x9a')]=_[_0x4aa7('0x9b')](_0x3d1497,[_0x4aa7('0x99')]);if(_0x3d1497[_0x4aa7('0x99')]['length']){return _0x3d1497['Contacts'][0x0];}var _0x304f5c=_['defaults'](_0x60063c[_0x4aa7('0x5c')],{'firstName':_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x82')],'ListId':_0x3d1497['id']});_0x304f5c[_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x94')]]=_0x60063c['body'][_0x4aa7('0x82')];return db[_0x4aa7('0x9c')]['create'](_0x304f5c,{'fields':_0x260d14,'raw':!![]});}})[_0x4aa7('0x39')](handleEntityNotFound(_0x435ad9,null))[_0x4aa7('0x39')](function(_0x4d312e){if(_0x4d312e){_0x60063c[_0x4aa7('0x9d')]=_0x4d312e;var _0x24174b={'ContactId':_0x4d312e['id'],'phone':_0x60063c['body'][_0x4aa7('0x82')],'SmsAccountId':_0x3c2655['params']['id']};var _0x3e7d21={'ContactId':_0x4d312e['id'],'SmsAccountId':_0x3c2655[_0x4aa7('0x62')]['id'],'closed':![]};return db[_0x4aa7('0x9e')][_0x4aa7('0x5a')]({'where':_0x3e7d21})[_0x4aa7('0x39')](function(_0x2eccb7){if(_0x2eccb7){return[_0x2eccb7,![]];}return db['SmsInteraction'][_0x4aa7('0x5b')](_0x24174b)['then'](function(_0x283bd3){return[_0x283bd3,!![]];});});}})[_0x4aa7('0x9f')](function(_0x19e5a5,_0x2c6d90){_0x60063c[_0x4aa7('0xa0')]=_0x19e5a5[_0x4aa7('0x3a')]({'plain':!![]});_0x60063c[_0x4aa7('0xa0')]['created']=![];if(_0x2c6d90){if(_0x60063c[_0x4aa7('0x74')][_0x4aa7('0xa1')]){_0x60063c['applications'][_0x4aa7('0xa2')]({'id':0x0,'priority':_0x60063c[_0x4aa7('0xa3')][_0x4aa7('0x4e')]+0x1,'app':_0x4aa7('0xa4'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x60063c['interaction']['created']=!![];}return db['SmsMessage'][_0x4aa7('0x5b')]({'phone':_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x82')],'messageId':_0x60063c[_0x4aa7('0x5c')][_0x4aa7('0x80')],'body':_0x60063c['body']['body'],'SmsAccountId':_0x3c2655[_0x4aa7('0x62')]['id'],'SmsInteractionId':_0x19e5a5['id'],'direction':'in','ContactId':_0x19e5a5[_0x4aa7('0xa5')],'AttachmentId':_0x60063c['body'][_0x4aa7('0xa6')]});})[_0x4aa7('0x39')](function(_0xd1651c){_0x60063c[_0x4aa7('0x28')]=_0xd1651c;if(!_0x60063c[_0x4aa7('0xa0')][_0x4aa7('0xa7')])return;return db[_0x4aa7('0xa8')][_0x4aa7('0x5a')]({'attributes':['id','name'],'where':{'id':_0x60063c[_0x4aa7('0xa0')][_0x4aa7('0xa7')]}});})['then'](function(_0x54ff55){if(_0x54ff55){_0x60063c[_0x4aa7('0xa3')][_0x4aa7('0xa9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x54ff55['name']+','+(_0x60063c[_0x4aa7('0x74')][_0x4aa7('0xaa')]||0xa),'interval':_0x4aa7('0xab')});}if(!_0x60063c['interaction'][_0x4aa7('0xac')])return;return db[_0x4aa7('0xad')][_0x4aa7('0x5a')]({'attributes':['id',_0x4aa7('0x3d')],'where':{'id':_0x60063c[_0x4aa7('0xa0')][_0x4aa7('0xac')]}});})[_0x4aa7('0x39')](function(_0xc005cd){if(_0xc005cd){_0x60063c[_0x4aa7('0xa3')][_0x4aa7('0xa9')]({'id':0x0,'priority':0x1,'app':_0x4aa7('0xae'),'appdata':_0xc005cd['name']+','+(_0x60063c[_0x4aa7('0x74')][_0x4aa7('0xaf')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4aa7('0xb0'),_0x4aa7('0xb1'),_0x60063c);})[_0x4aa7('0x39')](function(_0x12cf6c){if(_0x12cf6c){var _0x52faeb=0xc8;var _0x4b2688='receiveMessage';logger['info'](_0x4aa7('0x24'),_0x4b2688,_0x52faeb,_0x4aa7('0xb2'));logger[_0x4aa7('0x23')](_0x4aa7('0xb3'),_0x4b2688,_0x52faeb,_0x4aa7('0xb2'),JSON[_0x4aa7('0x25')](_0x12cf6c));if(_0x60063c['account'][_0x4aa7('0x46')]===_0x4aa7('0x7f')){return _0x435ad9[_0x4aa7('0x2d')](_0x52faeb)['set']('Content-Type',_0x4aa7('0xb4'))['send']('\x0a');}else{return _0x435ad9[_0x4aa7('0x2d')](_0x52faeb)[_0x4aa7('0x2e')](_0x12cf6c);}}})[_0x4aa7('0x2b')](handleError(_0x435ad9,null));};exports[_0x4aa7('0xb5')]=function(_0xf0fced,_0x377230){var _0x2924be=_0xf0fced['params']['id'];var _0x196ed7=_0xf0fced[_0x4aa7('0x5c')];var _0xa3028f=0xc8;var _0x1ea3fa=null;return db[_0x4aa7('0xb6')][_0x4aa7('0xb7')]({'isolationLevel':db[_0x4aa7('0xb6')][_0x4aa7('0xb8')][_0x4aa7('0xb9')][_0x4aa7('0xba')]},function(_0x4578ec){return db['SmsAccount'][_0x4aa7('0x67')]({'where':{'id':_0x2924be},'transaction':_0x4578ec})[_0x4aa7('0x39')](function(_0x49beda){if(_0x49beda){return db[_0x4aa7('0x72')]['destroy']({'where':{'SmsAccountId':_0x2924be},'transaction':_0x4578ec})[_0x4aa7('0x39')](function(){var _0x4ca240=_[_0x4aa7('0x42')](_0x196ed7,function(_0x262a3c){_0x262a3c['SmsAccountId']=_0x2924be;return _0x262a3c;});return db['SmsApplication'][_0x4aa7('0xbb')](_0x4ca240,{'transaction':_0x4578ec});});}else{_0xa3028f=0x194;_0x1ea3fa=[];}});})[_0x4aa7('0x39')](function(){if(_0xa3028f!==0x194){return db[_0x4aa7('0x72')][_0x4aa7('0xbc')]({'where':{'SmsAccountId':_0x2924be},'order':'priority'})[_0x4aa7('0x39')](function(_0x406ec0){_0x1ea3fa=_0x406ec0;});}})[_0x4aa7('0x2b')](function(_0x4a04bb){_0xa3028f=0x1f4;logger[_0x4aa7('0x27')](_0x4a04bb[_0x4aa7('0xbd')]);if(_0x4a04bb[_0x4aa7('0x3d')]){delete _0x4a04bb['name'];}_0x1ea3fa=_0x4a04bb;})[_0x4aa7('0xbe')](function(){if(_0x1ea3fa===null){_0x377230['sendStatus'](_0xa3028f);}else{if(_0xa3028f===0x1f4){_0x377230[_0x4aa7('0x2d')](_0xa3028f)['send'](_0x1ea3fa);}else{_0x377230[_0x4aa7('0x2d')](_0xa3028f)[_0x4aa7('0x2e')](_0x1ea3fa);}}});};exports[_0x4aa7('0xbf')]=function(_0x1aa856,_0x209546,_0x2bfb76){var _0x186c7b={};var _0x4762a3={};var _0x92ac19;var _0x8494ca;return db[_0x4aa7('0x43')][_0x4aa7('0x67')]({'where':{'id':_0x1aa856[_0x4aa7('0x62')]['id']}})[_0x4aa7('0x39')](handleEntityNotFound(_0x209546,null))[_0x4aa7('0x39')](function(_0x20d163){if(_0x20d163){_0x92ac19=_0x20d163;_0x4762a3[_0x4aa7('0x47')]=_[_0x4aa7('0x49')](db['SmsApplication'][_0x4aa7('0x44')]);_0x4762a3['query']=_[_0x4aa7('0x49')](_0x1aa856['query']);_0x4762a3[_0x4aa7('0x4a')]=_['intersection'](_0x4762a3['model'],_0x4762a3[_0x4aa7('0x48')]);_0x186c7b[_0x4aa7('0x4c')]=_['intersection'](_0x4762a3[_0x4aa7('0x47')],qs[_0x4aa7('0x4d')](_0x1aa856[_0x4aa7('0x48')][_0x4aa7('0x4d')]));_0x186c7b['attributes']=_0x186c7b[_0x4aa7('0x4c')][_0x4aa7('0x4e')]?_0x186c7b['attributes']:_0x4762a3['model'];_0x186c7b[_0x4aa7('0x51')]=qs[_0x4aa7('0x52')](_0x1aa856[_0x4aa7('0x48')][_0x4aa7('0x52')]);_0x186c7b['where']=qs[_0x4aa7('0x4a')](_[_0x4aa7('0x68')](_0x1aa856['query'],_0x4762a3[_0x4aa7('0x4a')]));if(_0x1aa856[_0x4aa7('0x48')][_0x4aa7('0x54')]){_0x186c7b[_0x4aa7('0x53')]=_['merge'](_0x186c7b[_0x4aa7('0x53')],{'$or':_['map'](_0x186c7b[_0x4aa7('0x4c')],function(_0xaa6793){var _0x217fed={};_0x217fed[_0xaa6793]={'$like':'%'+_0x1aa856[_0x4aa7('0x48')][_0x4aa7('0x54')]+'%'};return _0x217fed;})});}_0x186c7b=_[_0x4aa7('0x55')]({},_0x186c7b,_0x1aa856[_0x4aa7('0x57')]);return _0x92ac19[_0x4aa7('0xbf')](_0x186c7b);}})[_0x4aa7('0x39')](function(_0x18ca42){if(_0x18ca42){_0x8494ca=_0x18ca42[_0x4aa7('0x4e')];if(!_0x1aa856['query'][_0x4aa7('0x4f')](_0x4aa7('0x50'))){_0x186c7b['limit']=qs[_0x4aa7('0x30')](_0x1aa856[_0x4aa7('0x48')][_0x4aa7('0x30')]);_0x186c7b[_0x4aa7('0x31')]=qs['offset'](_0x1aa856[_0x4aa7('0x48')][_0x4aa7('0x31')]);}return _0x92ac19['getApplications'](_0x186c7b);}})['then'](function(_0x2a72d5){if(_0x2a72d5){return _0x2a72d5?{'count':_0x8494ca,'rows':_0x2a72d5}:null;}})['then'](respondWithResult(_0x209546,null))[_0x4aa7('0x2b')](handleError(_0x209546,null));};exports[_0x4aa7('0xc0')]=function(_0x323ef0,_0x15f0b8,_0x42b048){var _0x269b3b={'raw':![],'where':{}};var _0x51b278={};var _0x14bfd8={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x323ef0['params']['id']}})[_0x4aa7('0x39')](handleEntityNotFound(_0x15f0b8,null))[_0x4aa7('0x39')](function(_0x4d4034){if(_0x4d4034){_0x51b278[_0x4aa7('0x47')]=_[_0x4aa7('0x49')](db[_0x4aa7('0x9e')][_0x4aa7('0x44')]);_0x51b278[_0x4aa7('0x48')]=_[_0x4aa7('0x49')](_0x323ef0[_0x4aa7('0x48')]);_0x51b278['filters']=_[_0x4aa7('0x4b')](_0x51b278[_0x4aa7('0x47')],_0x51b278[_0x4aa7('0x48')]);_0x269b3b[_0x4aa7('0x4c')]=_['intersection'](_0x51b278[_0x4aa7('0x47')],qs['fields'](_0x323ef0['query'][_0x4aa7('0x4d')]));_0x269b3b[_0x4aa7('0x4c')]=_0x269b3b[_0x4aa7('0x4c')]['length']?_0x269b3b['attributes']:_0x51b278['model'];if(!_0x323ef0[_0x4aa7('0x48')][_0x4aa7('0x4f')](_0x4aa7('0x50'))){_0x269b3b['limit']=qs[_0x4aa7('0x30')](_0x323ef0[_0x4aa7('0x48')][_0x4aa7('0x30')]);_0x269b3b['offset']=qs[_0x4aa7('0x31')](_0x323ef0[_0x4aa7('0x48')][_0x4aa7('0x31')]);}_0x269b3b[_0x4aa7('0x51')]=qs[_0x4aa7('0x52')](_0x323ef0[_0x4aa7('0x48')][_0x4aa7('0x52')]);_0x269b3b[_0x4aa7('0x53')]=qs['filters'](_[_0x4aa7('0x68')](_0x323ef0['query'],_0x51b278[_0x4aa7('0x4a')]));_0x269b3b[_0x4aa7('0x53')][_0x4aa7('0x69')]=_0x4d4034['id'];if(_0x323ef0[_0x4aa7('0x48')][_0x4aa7('0x54')]){_0x269b3b['where']=_[_0x4aa7('0x55')](_0x269b3b[_0x4aa7('0x53')],{'$or':_['map'](_0x269b3b[_0x4aa7('0x4c')],function(_0x2a96fa){var _0x2d26b9={};_0x2d26b9[_0x2a96fa]={'$like':'%'+_0x323ef0['query'][_0x4aa7('0x54')]+'%'};return _0x2d26b9;})});}_0x269b3b=_[_0x4aa7('0x55')]({},_0x269b3b,_0x323ef0[_0x4aa7('0x57')]);return db[_0x4aa7('0x9e')][_0x4aa7('0x32')]({'where':_0x269b3b[_0x4aa7('0x53')]})[_0x4aa7('0x39')](function(_0x26d064){_0x14bfd8[_0x4aa7('0x32')]=_0x26d064;if(_0x323ef0[_0x4aa7('0x48')]['includeAll']){_0x269b3b['include']=[{'model':db[_0x4aa7('0x9c')],'as':_0x4aa7('0xc1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x4aa7('0x3d'),_0x4aa7('0xc2'),_0x4aa7('0xc3')],'required':![]},{'model':db[_0x4aa7('0xc4')],'as':_0x4aa7('0xc5'),'attributes':['id',_0x4aa7('0x3d'),_0x4aa7('0xc6')],'where':_0x323ef0[_0x4aa7('0x48')][_0x4aa7('0xc7')]?{'id':_0x323ef0['query'][_0x4aa7('0xc7')]}:undefined,'required':_0x323ef0['query'][_0x4aa7('0xc7')]?!![]:![]}];}return db[_0x4aa7('0x9e')][_0x4aa7('0x6b')](_0x269b3b);})[_0x4aa7('0x39')](function(_0x302e0c){_0x14bfd8[_0x4aa7('0x59')]=_0x302e0c;return _0x14bfd8;});}})['then'](respondWithFilteredResult(_0x15f0b8,_0x269b3b))['catch'](handleError(_0x15f0b8,null));};exports[_0x4aa7('0x3e')]=function(_0x372dcc,_0x5c6459,_0x5cdc7d){var _0xded153,_0x51867a,_0x6c1af2;if(_[_0x4aa7('0x91')](_0x372dcc[_0x4aa7('0x5c')][_0x4aa7('0x5c')])||_0x372dcc[_0x4aa7('0x5c')][_0x4aa7('0x5c')]===''){throw new db[(_0x4aa7('0x77'))][(_0x4aa7('0x78'))](_0x4aa7('0x93'));}if(_['isNil'](_0x372dcc[_0x4aa7('0x5c')]['to'])){throw new db['Sequelize'][(_0x4aa7('0x78'))](_0x4aa7('0xc8'));}_0xded153=_0x372dcc['body']['to'];return db[_0x4aa7('0x43')][_0x4aa7('0x5a')]({'where':{'id':_0x372dcc[_0x4aa7('0x62')]['id']},'include':[{'model':db[_0x4aa7('0x97')],'as':_0x4aa7('0xc9'),'include':[{'model':db[_0x4aa7('0x9c')],'as':_0x4aa7('0x99'),'where':{'mobile':_0xded153},'limit':0x1,'order':[['updatedAt',_0x4aa7('0xca')]]}]}]})['then'](handleEntityNotFound(_0x5c6459,null))[_0x4aa7('0x39')](function(_0x302970){if(_0x302970&&_0x302970['List']){_0x51867a=_0x302970[_0x4aa7('0x3a')]({'plain':!![]});if(_0x51867a[_0x4aa7('0xc9')]&&_0x51867a['List']['Contacts'][_0x4aa7('0x4e')]){return _0x51867a['List'][_0x4aa7('0x99')][0x0];}return db[_0x4aa7('0x9c')]['create'](_[_0x4aa7('0xcb')](_0x372dcc[_0x4aa7('0x5c')],{'firstName':_0xded153,'mobile':_0xded153,'phone':_0xded153,'ListId':_0x51867a[_0x4aa7('0x98')]}));}})['then'](handleEntityNotFound(_0x5c6459,null))['then'](function(_0x44339c){if(_0x44339c){_0x6c1af2=_0x44339c;return db['SmsInteraction'][_0x4aa7('0x5a')]({'where':{'ContactId':_0x6c1af2['id'],'closed':![],'SmsAccountId':_0x51867a['id']}})[_0x4aa7('0x39')](function(_0x104b13){if(_0x104b13){return[_0x104b13,![]];}return db[_0x4aa7('0x9e')][_0x4aa7('0x5b')]({'UserId':_0x372dcc[_0x4aa7('0x5d')]['id'],'ContactId':_0x6c1af2['id'],'SmsAccountId':_0x51867a['id'],'phone':_0xded153,'firstMsgDirection':_0x4aa7('0xcc'),'Messages':[_[_0x4aa7('0x55')](_0x372dcc['body'],{'read':![],'body':_0x372dcc[_0x4aa7('0x5c')][_0x4aa7('0x5c')],'phone':_0xded153,'SmsAccountId':_0x51867a['id'],'UserId':_0x372dcc[_0x4aa7('0x5d')]['id'],'ContactId':_0x6c1af2['id']})]},{'include':[{'model':db[_0x4aa7('0xcd')],'as':_0x4aa7('0xce')}]})[_0x4aa7('0x39')](function(_0x539b94){return[_0x539b94,!![]];});});}})[_0x4aa7('0x9f')](function(_0x1e4129,_0x333d78){if(_0x333d78){return _0x1e4129;}return db[_0x4aa7('0xcd')][_0x4aa7('0x5b')](_[_0x4aa7('0x55')](_0x372dcc[_0x4aa7('0x5c')],{'read':![],'body':_0x372dcc[_0x4aa7('0x5c')][_0x4aa7('0x5c')],'phone':_0xded153,'SmsAccountId':_0x51867a['id'],'SmsInteractionId':_0x1e4129['id'],'UserId':_0x372dcc[_0x4aa7('0x5d')]['id'],'ContactId':_0x6c1af2['id']}))[_0x4aa7('0x39')](function(_0x523d3b){_0x1e4129[_0x4aa7('0xcf')]['Messages']=[];_0x1e4129[_0x4aa7('0xcf')]['Messages']['push'](_0x523d3b[_0x4aa7('0xcf')]);return _0x1e4129;});})[_0x4aa7('0x39')](respondWithResult(_0x5c6459,null))[_0x4aa7('0x2b')](handleError(_0x5c6459,null));};exports['status']=function(_0x3bcba8,_0x4f2146,_0x32dda3){if(_0x3bcba8[_0x4aa7('0x5c')]['id']){delete _0x3bcba8[_0x4aa7('0x5c')]['id'];}var _0x29396e,_0x3562e0,_0x523f15;return db[_0x4aa7('0x43')][_0x4aa7('0x5a')]({'where':{'id':_0x3bcba8[_0x4aa7('0x62')]['id']}})[_0x4aa7('0x39')](handleEntityNotFound(_0x4f2146,null))[_0x4aa7('0x39')](function(_0x71f0d){if(_0x71f0d){_0x523f15=_0x71f0d;logger[_0x4aa7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4aa7('0x2d'),_0x4aa7('0xd0'),_0x71f0d['type'],util[_0x4aa7('0xd1')](_0x3bcba8['body'],{'showHidden':![],'depth':null}));switch(_0x71f0d[_0x4aa7('0x46')]){case _0x4aa7('0x81'):if(_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0xd2')]&&_0x3bcba8[_0x4aa7('0x5c')]['status']){_0x3562e0=_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0x2d')];return db['SmsMessage'][_0x4aa7('0x5a')]({'where':{'messageId':_0x3bcba8[_0x4aa7('0x5c')]['skebby_dispatch_id']}});}break;case _0x4aa7('0xd3'):if(_0x3bcba8[_0x4aa7('0x5c')]['requestid']&&_0x3bcba8[_0x4aa7('0x5c')]['statusInt']){_0x3562e0=_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0xd4')];return db['SmsMessage'][_0x4aa7('0x5a')]({'where':{'messageId':_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0xd5')]}});}break;case _0x4aa7('0x85'):if(_0x3bcba8['body'][_0x4aa7('0xd6')]&&_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0xd7')]){_0x3562e0=_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0xd7')];return db[_0x4aa7('0xcd')][_0x4aa7('0x5a')]({'where':{'messageId':_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0xd6')]}});}break;case _0x4aa7('0x88'):var _0x17876e=_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0x89')][0x0];if(_0x17876e[_0x4aa7('0x80')]&&_0x17876e[_0x4aa7('0x2d')][_0x4aa7('0xd8')]===_0x4aa7('0xd9')){_0x3562e0=_0x17876e['status'][_0x4aa7('0xd8')];return db[_0x4aa7('0xcd')][_0x4aa7('0x5a')]({'where':{'messageId':_0x17876e[_0x4aa7('0x80')]}});}break;case _0x4aa7('0xda'):if(_0x3bcba8['body'][_0x4aa7('0x80')]&&_0x3bcba8[_0x4aa7('0x5c')]['status']){_0x3562e0=_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0x2d')];return db[_0x4aa7('0xcd')]['find']({'where':{'messageId':_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0x80')]}});}break;case _0x4aa7('0x8e'):if(_0x3bcba8[_0x4aa7('0x5c')][0x0][_0x4aa7('0x28')]['id']){_0x3562e0=_0x3bcba8[_0x4aa7('0x5c')][0x0][_0x4aa7('0x46')];return db[_0x4aa7('0xcd')]['find']({'where':{'messageId':_0x3bcba8[_0x4aa7('0x5c')][0x0][_0x4aa7('0x28')]['id']}});}break;case _0x4aa7('0x8f'):if(_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0xdb')]&&_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0x2d')]){_0x3562e0=_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0x2d')];return db[_0x4aa7('0xcd')][_0x4aa7('0x5a')]({'where':{'messageId':_0x3bcba8[_0x4aa7('0x5c')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x4f2146,null))[_0x4aa7('0x39')](function(_0x57451c){if(_0x57451c){_0x29396e=_0x57451c;switch(_0x523f15['type']){case _0x4aa7('0x81'):if(_0x3562e0===_0x4aa7('0xd9')){return _0x29396e['update']({'read':!![]});}else{logger[_0x4aa7('0x27')](_0x4aa7('0x24'),_0x4aa7('0x2d'),'skebby',util[_0x4aa7('0xd1')](_0x3bcba8[_0x4aa7('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4aa7('0xd3'):if(_0x3562e0==='1'){return _0x29396e[_0x4aa7('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4aa7('0x2d'),_0x4aa7('0x81'),util[_0x4aa7('0xd1')](_0x3bcba8[_0x4aa7('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4aa7('0x85'):if(!_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0xdc')]&&_0x3562e0>=0xc8&&_0x3562e0<=0xce){return _0x29396e[_0x4aa7('0x37')]({'read':!![]});}else{logger[_0x4aa7('0x27')](_0x4aa7('0x24'),'status',_0x4aa7('0x85'),util[_0x4aa7('0xd1')](_0x3bcba8[_0x4aa7('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4aa7('0x88'):var _0x559bd7=_0x3bcba8[_0x4aa7('0x5c')][_0x4aa7('0x89')][0x0];if(_0x559bd7[_0x4aa7('0x2d')][_0x4aa7('0xd8')]===_0x4aa7('0xd9')){return _0x29396e['update']({'read':!![]});}else{logger[_0x4aa7('0x27')](_0x4aa7('0x24'),'status',_0x4aa7('0x88'),util['inspect'](_0x3bcba8[_0x4aa7('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4aa7('0xda'):if(_0x3562e0==_0x4aa7('0xdd')||_0x3562e0=='RECEIVED_BY_RECIPIENT'){return _0x29396e[_0x4aa7('0x37')]({'read':!![]});}else{logger[_0x4aa7('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4aa7('0x2d'),_0x4aa7('0xda'),util[_0x4aa7('0xd1')](_0x3bcba8[_0x4aa7('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4aa7('0x8e'):if(_0x3562e0=='message-delivered'){return _0x29396e['update']({'read':!![]});}else{logger[_0x4aa7('0x27')](_0x4aa7('0x24'),_0x4aa7('0x2d'),_0x4aa7('0x8e'),util['inspect'](_0x3bcba8[_0x4aa7('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4aa7('0x8f'):if(_0x3562e0===_0x4aa7('0xde')||_0x3562e0==='ACCEPTD'){return _0x29396e[_0x4aa7('0x37')]({'read':!![]});}else{logger[_0x4aa7('0x27')](_0x4aa7('0x24'),_0x4aa7('0x2d'),'intelepeer',util[_0x4aa7('0xd1')](_0x3bcba8[_0x4aa7('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x29396e;}})[_0x4aa7('0x39')](respondWithResult(_0x4f2146,null))['catch'](handleError(_0x4f2146,null));};exports[_0x4aa7('0xdf')]=function(_0x1e0a2f,_0x3bb4bf,_0x23409f){var _0x1b3ba5,_0x2e8e22,_0x508750;return db[_0x4aa7('0x43')][_0x4aa7('0x5a')]({'where':{'id':_0x1e0a2f[_0x4aa7('0x62')]['id']}})[_0x4aa7('0x39')](handleEntityNotFound(_0x3bb4bf,null))[_0x4aa7('0x39')](function(_0x535c67){if(_0x535c67){_0x508750=_0x535c67;logger[_0x4aa7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4aa7('0x2d'),_0x4aa7('0xd0'),_0x535c67[_0x4aa7('0x46')],util[_0x4aa7('0xd1')](_0x1e0a2f[_0x4aa7('0x48')],{'showHidden':![],'depth':null}));switch(_0x535c67[_0x4aa7('0x46')]){case _0x4aa7('0x8a'):if(_0x1e0a2f[_0x4aa7('0x48')][_0x4aa7('0xe0')]&&_0x1e0a2f[_0x4aa7('0x48')]['state']){_0x2e8e22=_0x1e0a2f[_0x4aa7('0x48')][_0x4aa7('0xe1')];return db['SmsMessage'][_0x4aa7('0x5a')]({'where':{'messageId':_0x1e0a2f['query'][_0x4aa7('0xe0')]}});}break;}}})[_0x4aa7('0x39')](handleEntityNotFound(_0x3bb4bf,null))[_0x4aa7('0x39')](function(_0x3b24fe){if(_0x3b24fe){_0x1b3ba5=_0x3b24fe;switch(_0x508750[_0x4aa7('0x46')]){case _0x4aa7('0x8a'):if(_0x2e8e22==='2'||_0x2e8e22==='6'){return _0x1b3ba5[_0x4aa7('0x37')]({'read':!![]});}else{logger[_0x4aa7('0x27')](_0x4aa7('0x24'),_0x4aa7('0x2d'),_0x4aa7('0x8a'),util['inspect'](_0x1e0a2f['query'],{'showHidden':![],'depth':null}));};break;}return _0x1b3ba5;}})[_0x4aa7('0x39')](respondWithResult(_0x3bb4bf,null))[_0x4aa7('0x2b')](handleError(_0x3bb4bf,null));};exports['addAgents']=function(_0x257b1b,_0x2ba888,_0x3a1be4){return db['SmsAccount'][_0x4aa7('0x5a')]({'where':{'id':_0x257b1b[_0x4aa7('0x62')]['id']}})[_0x4aa7('0x39')](handleEntityNotFound(_0x2ba888,null))['then'](function(_0x304454){if(_0x304454){return _0x304454[_0x4aa7('0xe2')](_0x257b1b[_0x4aa7('0x5c')][_0x4aa7('0xe3')],_[_0x4aa7('0x9b')](_0x257b1b[_0x4aa7('0x5c')],[_0x4aa7('0xe3'),'id'])||{})['spread'](function(_0x5d58ac){for(var _0x4d9f89=0x0;_0x4d9f89<_0x257b1b[_0x4aa7('0x5c')][_0x4aa7('0xe3')]['length'];_0x4d9f89+=0x1){socket[_0x4aa7('0xe4')]('userSmsAccount:save',{'UserId':Number(_0x257b1b['body'][_0x4aa7('0xe3')][_0x4d9f89]),'SmsAccountId':Number(_0x257b1b[_0x4aa7('0x62')]['id'])});}return _0x5d58ac;});}})[_0x4aa7('0x39')](respondWithResult(_0x2ba888,null))['catch'](handleError(_0x2ba888,null));};exports['removeAgents']=function(_0x44db7e,_0x2ed7da,_0x4a26e3){return db['SmsAccount'][_0x4aa7('0x5a')]({'where':{'id':_0x44db7e[_0x4aa7('0x62')]['id']}})[_0x4aa7('0x39')](handleEntityNotFound(_0x2ed7da,null))['then'](function(_0x66c8ab){if(_0x66c8ab){return _0x66c8ab['removeAgents'](_0x44db7e['query'][_0x4aa7('0xe3')])[_0x4aa7('0x39')](function(){if(_[_0x4aa7('0xe5')](_0x44db7e[_0x4aa7('0x48')][_0x4aa7('0xe3')])){for(var _0x2b65b5=0x0;_0x2b65b5<_0x44db7e[_0x4aa7('0x48')][_0x4aa7('0xe3')][_0x4aa7('0x4e')];_0x2b65b5+=0x1){socket[_0x4aa7('0xe4')](_0x4aa7('0xe6'),{'UserId':Number(_0x44db7e[_0x4aa7('0x48')][_0x4aa7('0xe3')][_0x2b65b5]),'SmsAccountId':Number(_0x44db7e[_0x4aa7('0x62')]['id'])});}}else{socket[_0x4aa7('0xe4')](_0x4aa7('0xe6'),{'UserId':Number(_0x44db7e['query'][_0x4aa7('0xe3')]),'SmsAccountId':Number(_0x44db7e[_0x4aa7('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x2ed7da,null))[_0x4aa7('0x2b')](handleError(_0x2ed7da,null));};exports[_0x4aa7('0xe7')]=function(_0x3f938a,_0x46f652,_0xcdeb2b){var _0x5f4284={};var _0x5451e4={};var _0x4145aa;var _0x228995;return db[_0x4aa7('0x43')][_0x4aa7('0x67')]({'where':{'id':_0x3f938a[_0x4aa7('0x62')]['id']}})[_0x4aa7('0x39')](handleEntityNotFound(_0x46f652,null))[_0x4aa7('0x39')](function(_0x63c1b7){if(_0x63c1b7){_0x4145aa=_0x63c1b7;_0x5451e4[_0x4aa7('0x47')]=_[_0x4aa7('0x49')](db[_0x4aa7('0xa8')][_0x4aa7('0x44')]);_0x5451e4[_0x4aa7('0x48')]=_[_0x4aa7('0x49')](_0x3f938a[_0x4aa7('0x48')]);_0x5451e4[_0x4aa7('0x4a')]=_[_0x4aa7('0x4b')](_0x5451e4[_0x4aa7('0x47')],_0x5451e4['query']);_0x5f4284['attributes']=_[_0x4aa7('0x4b')](_0x5451e4[_0x4aa7('0x47')],qs['fields'](_0x3f938a[_0x4aa7('0x48')][_0x4aa7('0x4d')]));_0x5f4284[_0x4aa7('0x4c')]=_0x5f4284['attributes']['length']?_0x5f4284['attributes']:_0x5451e4['model'];_0x5f4284[_0x4aa7('0x51')]=qs[_0x4aa7('0x52')](_0x3f938a[_0x4aa7('0x48')]['sort']);_0x5f4284['where']=qs[_0x4aa7('0x4a')](_['pick'](_0x3f938a['query'],_0x5451e4[_0x4aa7('0x4a')]));if(_0x3f938a[_0x4aa7('0x48')][_0x4aa7('0x54')]){_0x5f4284[_0x4aa7('0x53')]=_[_0x4aa7('0x55')](_0x5f4284['where'],{'$or':_[_0x4aa7('0x42')](_0x5f4284[_0x4aa7('0x4c')],function(_0x2f8509){var _0x2f78a={};_0x2f78a[_0x2f8509]={'$like':'%'+_0x3f938a[_0x4aa7('0x48')][_0x4aa7('0x54')]+'%'};return _0x2f78a;})});}_0x5f4284=_[_0x4aa7('0x55')]({},_0x5f4284,_0x3f938a[_0x4aa7('0x57')]);return _0x4145aa[_0x4aa7('0xe7')](_0x5f4284);}})[_0x4aa7('0x39')](function(_0x5eebe3){if(_0x5eebe3){_0x228995=_0x5eebe3[_0x4aa7('0x4e')];if(!_0x3f938a[_0x4aa7('0x48')][_0x4aa7('0x4f')](_0x4aa7('0x50'))){_0x5f4284[_0x4aa7('0x30')]=qs['limit'](_0x3f938a[_0x4aa7('0x48')][_0x4aa7('0x30')]);_0x5f4284[_0x4aa7('0x31')]=qs[_0x4aa7('0x31')](_0x3f938a[_0x4aa7('0x48')][_0x4aa7('0x31')]);}return _0x4145aa['getAgents'](_0x5f4284);}})[_0x4aa7('0x39')](function(_0x166dff){if(_0x166dff){return _0x166dff?{'count':_0x228995,'rows':_0x166dff}:null;}})['then'](respondWithResult(_0x46f652,null))[_0x4aa7('0x2b')](handleError(_0x46f652,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 95e9402..c4856da 100644 --- a/server/api/smsAccount/smsAccount.events.js +++ b/server/api/smsAccount/smsAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e2a=['setMaxListeners','update','remove','emit','hook','events','../../mysqldb','SmsAccount'];(function(_0x1c0fc3,_0x3537bb){var _0x338237=function(_0x4ebb72){while(--_0x4ebb72){_0x1c0fc3['push'](_0x1c0fc3['shift']());}};_0x338237(++_0x3537bb);}(_0x6e2a,0x185));var _0xa6e2=function(_0x51a1bf,_0x148868){_0x51a1bf=_0x51a1bf-0x0;var _0x279ab7=_0x6e2a[_0x51a1bf];return _0x279ab7;};'use strict';var EventEmitter=require(_0xa6e2('0x0'));var SmsAccount=require(_0xa6e2('0x1'))['db'][_0xa6e2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa6e2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6e2('0x4'),'afterDestroy':_0xa6e2('0x5')};function emitEvent(_0x4ad871){return function(_0xd6f29b,_0xf138a5,_0x1deb2d){SmsAccountEvents[_0xa6e2('0x6')](_0x4ad871+':'+_0xd6f29b['id'],_0xd6f29b);SmsAccountEvents[_0xa6e2('0x6')](_0x4ad871,_0xd6f29b);_0x1deb2d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xa6e2('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x7c43=['emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','save','update','remove'];(function(_0x1997f1,_0x2dd70c){var _0x62465d=function(_0x3de1b2){while(--_0x3de1b2){_0x1997f1['push'](_0x1997f1['shift']());}};_0x62465d(++_0x2dd70c);}(_0x7c43,0x100));var _0x37c4=function(_0x15f4af,_0x2ee361){_0x15f4af=_0x15f4af-0x0;var _0x5290f1=_0x7c43[_0x15f4af];return _0x5290f1;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x37c4('0x0'))['db'][_0x37c4('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x37c4('0x2'),'afterUpdate':_0x37c4('0x3'),'afterDestroy':_0x37c4('0x4')};function emitEvent(_0xfef842){return function(_0x21889b,_0x2e813d,_0x1a4feb){SmsAccountEvents['emit'](_0xfef842+':'+_0x21889b['id'],_0x21889b);SmsAccountEvents[_0x37c4('0x5')](_0xfef842,_0x21889b);_0x1a4feb(null);};}for(var e in events){if(events[_0x37c4('0x6')](e)){var event=events[e];SmsAccount[_0x37c4('0x7')](e,emitEvent(event));}}module[_0x37c4('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index c87f9ac..58779b9 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc834=['define','SmsAccount','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0xb1c60b,_0x385134){var _0x4c391d=function(_0x34a8f3){while(--_0x34a8f3){_0xb1c60b['push'](_0xb1c60b['shift']());}};_0x4c391d(++_0x385134);}(_0xc834,0x7a));var _0x4c83=function(_0x2fe771,_0x1df697){_0x2fe771=_0x2fe771-0x0;var _0x572bbe=_0xc834[_0x2fe771];return _0x572bbe;};'use strict';var _=require(_0x4c83('0x0'));var util=require(_0x4c83('0x1'));var logger=require(_0x4c83('0x2'))(_0x4c83('0x3'));var moment=require(_0x4c83('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c83('0x5'));var rimraf=require(_0x4c83('0x6'));var config=require(_0x4c83('0x7'));var attributes=require(_0x4c83('0x8'));module[_0x4c83('0x9')]=function(_0x3c0e2b,_0x7e2c14){return _0x3c0e2b[_0x4c83('0xa')](_0x4c83('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2dc=['moment','bluebird','request-promise','rimraf','exports','sms_accounts','lodash','api'];(function(_0x3d66f9,_0xabc1f0){var _0x473d50=function(_0xa2db03){while(--_0xa2db03){_0x3d66f9['push'](_0x3d66f9['shift']());}};_0x473d50(++_0xabc1f0);}(_0xe2dc,0xde));var _0xce2d=function(_0x20a493,_0x27c01){_0x20a493=_0x20a493-0x0;var _0x1ff689=_0xe2dc[_0x20a493];return _0x1ff689;};'use strict';var _=require(_0xce2d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xce2d('0x1'));var moment=require(_0xce2d('0x2'));var BPromise=require(_0xce2d('0x3'));var rp=require(_0xce2d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce2d('0x5'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xce2d('0x6')]=function(_0x394865,_0x4b014a){return _0x394865['define']('SmsAccount',attributes,{'tableName':_0xce2d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index f05dab3..c6c4205 100644 --- a/server/api/smsAccount/smsAccount.rpc.js +++ b/server/api/smsAccount/smsAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41b=['options','raw','attributes','include','model','map','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','ShowSmsAccount','SmsAccount','find'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa41b,0x12e));var _0xba41=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0xa41b[_0x3dc68d];return _0xdf7f94;};'use strict';var _=require(_0xba41('0x0'));var util=require(_0xba41('0x1'));var moment=require(_0xba41('0x2'));var BPromise=require(_0xba41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba41('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xba41('0x5'));var logger=require('../../config/logger')(_0xba41('0x6'));var config=require(_0xba41('0x7'));var jayson=require(_0xba41('0x8'));var client=jayson[_0xba41('0x9')][_0xba41('0xa')]({'port':0x232a});config[_0xba41('0xb')]=_[_0xba41('0xc')](config['redis'],{'host':_0xba41('0xd'),'port':0x18eb});var socket=require(_0xba41('0xe'))(new Redis(config[_0xba41('0xb')]));require(_0xba41('0xf'))['register'](socket);function respondWithRpcPromise(_0x54a6ac,_0x2ed7e9,_0x25b548){return new BPromise(function(_0x1cd77c,_0x469913){return client[_0xba41('0x10')](_0x54a6ac,_0x25b548)[_0xba41('0x11')](function(_0x357957){logger[_0xba41('0x12')](_0xba41('0x13'),_0x2ed7e9,_0xba41('0x14'));logger[_0xba41('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2ed7e9,_0xba41('0x14'),JSON[_0xba41('0x16')](_0x357957));if(_0x357957['error']){if(_0x357957['error'][_0xba41('0x17')]===0x1f4){logger[_0xba41('0x18')](_0xba41('0x13'),_0x2ed7e9,_0x357957['error'][_0xba41('0x19')]);return _0x469913(_0x357957['error'][_0xba41('0x19')]);}logger[_0xba41('0x18')]('SmsAccount,\x20%s,\x20%s',_0x2ed7e9,_0x357957[_0xba41('0x18')][_0xba41('0x19')]);return _0x1cd77c(_0x357957[_0xba41('0x18')][_0xba41('0x19')]);}else{logger[_0xba41('0x12')](_0xba41('0x13'),_0x2ed7e9,_0xba41('0x14'));_0x1cd77c(_0x357957[_0xba41('0x1a')][_0xba41('0x19')]);}})[_0xba41('0x1b')](function(_0x1b97d1){logger[_0xba41('0x18')]('SmsAccount,\x20%s,\x20%s',_0x2ed7e9,_0x1b97d1);_0x469913(_0x1b97d1);});});}exports[_0xba41('0x1c')]=function(_0x1a9a8f){var _0x1a57b7=this;return new Promise(function(_0x36dc53,_0x2438e9){return db[_0xba41('0x1d')][_0xba41('0x1e')]({'raw':_0x1a9a8f[_0xba41('0x1f')]?_0x1a9a8f['options'][_0xba41('0x20')]===undefined?!![]:![]:!![],'where':_0x1a9a8f['options']?_0x1a9a8f['options']['where']||null:null,'attributes':_0x1a9a8f['options']?_0x1a9a8f[_0xba41('0x1f')][_0xba41('0x21')]||null:null,'include':_0x1a9a8f[_0xba41('0x1f')]?_0x1a9a8f[_0xba41('0x1f')][_0xba41('0x22')]?_['map'](_0x1a9a8f[_0xba41('0x1f')][_0xba41('0x22')],function(_0x4e7455){return{'model':db[_0x4e7455[_0xba41('0x23')]],'as':_0x4e7455['as'],'attributes':_0x4e7455[_0xba41('0x21')],'include':_0x4e7455[_0xba41('0x22')]?_[_0xba41('0x24')](_0x4e7455['include'],function(_0x1a0444){return{'model':db[_0x1a0444[_0xba41('0x23')]],'as':_0x1a0444['as'],'attributes':_0x1a0444[_0xba41('0x21')],'include':_0x1a0444[_0xba41('0x22')]?_[_0xba41('0x24')](_0x1a0444[_0xba41('0x22')],function(_0x511587){return{'model':db[_0x511587[_0xba41('0x23')]],'as':_0x511587['as'],'attributes':_0x511587['attributes']};}):[]};}):[]};}):[]:[]})[_0xba41('0x11')](function(_0x45a185){logger[_0xba41('0x12')](_0xba41('0x1c'),_0x1a9a8f);logger[_0xba41('0x15')](_0xba41('0x1c'),_0x1a9a8f,JSON['stringify'](_0x45a185));_0x36dc53(_0x45a185);})[_0xba41('0x1b')](function(_0x47a2f0){logger[_0xba41('0x18')](_0xba41('0x1c'),_0x47a2f0['message'],_0x1a9a8f);_0x2438e9(_0x1a57b7[_0xba41('0x18')](0x1f4,_0x47a2f0[_0xba41('0x19')]));});});}; \ No newline at end of file +var _0xf15e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./smsAccount.socket','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','SmsAccount','options','raw','attributes','include','model','map','ShowSmsAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xd5da7c,_0x3a331e){var _0x5553e9=function(_0x4705e5){while(--_0x4705e5){_0xd5da7c['push'](_0xd5da7c['shift']());}};_0x5553e9(++_0x3a331e);}(_0xf15e,0xa8));var _0xef15=function(_0x526045,_0x4fea0f){_0x526045=_0x526045-0x0;var _0x50549a=_0xf15e[_0x526045];return _0x50549a;};'use strict';var _=require(_0xef15('0x0'));var util=require(_0xef15('0x1'));var moment=require('moment');var BPromise=require(_0xef15('0x2'));var rs=require(_0xef15('0x3'));var fs=require('fs');var Redis=require(_0xef15('0x4'));var db=require(_0xef15('0x5'))['db'];var utils=require(_0xef15('0x6'));var logger=require(_0xef15('0x7'))(_0xef15('0x8'));var config=require(_0xef15('0x9'));var jayson=require(_0xef15('0xa'));var client=jayson[_0xef15('0xb')]['http']({'port':0x232a});config[_0xef15('0xc')]=_['defaults'](config['redis'],{'host':_0xef15('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef15('0xc')]));require(_0xef15('0xe'))['register'](socket);function respondWithRpcPromise(_0x424f4d,_0x3c25ce,_0x1af73e){return new BPromise(function(_0x5b382e,_0x5c7661){return client['request'](_0x424f4d,_0x1af73e)[_0xef15('0xf')](function(_0x9a74c5){logger[_0xef15('0x10')]('SmsAccount,\x20%s,\x20%s',_0x3c25ce,'request\x20sent');logger[_0xef15('0x11')](_0xef15('0x12'),_0x3c25ce,_0xef15('0x13'),JSON[_0xef15('0x14')](_0x9a74c5));if(_0x9a74c5['error']){if(_0x9a74c5[_0xef15('0x15')][_0xef15('0x16')]===0x1f4){logger['error'](_0xef15('0x17'),_0x3c25ce,_0x9a74c5[_0xef15('0x15')][_0xef15('0x18')]);return _0x5c7661(_0x9a74c5[_0xef15('0x15')][_0xef15('0x18')]);}logger['error'](_0xef15('0x17'),_0x3c25ce,_0x9a74c5[_0xef15('0x15')][_0xef15('0x18')]);return _0x5b382e(_0x9a74c5[_0xef15('0x15')][_0xef15('0x18')]);}else{logger[_0xef15('0x10')]('SmsAccount,\x20%s,\x20%s',_0x3c25ce,_0xef15('0x13'));_0x5b382e(_0x9a74c5[_0xef15('0x19')][_0xef15('0x18')]);}})[_0xef15('0x1a')](function(_0x4a383b){logger['error'](_0xef15('0x17'),_0x3c25ce,_0x4a383b);_0x5c7661(_0x4a383b);});});}exports['ShowSmsAccount']=function(_0x3f0c46){var _0x2316d2=this;return new Promise(function(_0x59512a,_0x2eb849){return db[_0xef15('0x1b')]['find']({'raw':_0x3f0c46[_0xef15('0x1c')]?_0x3f0c46[_0xef15('0x1c')][_0xef15('0x1d')]===undefined?!![]:![]:!![],'where':_0x3f0c46[_0xef15('0x1c')]?_0x3f0c46[_0xef15('0x1c')]['where']||null:null,'attributes':_0x3f0c46['options']?_0x3f0c46['options'][_0xef15('0x1e')]||null:null,'include':_0x3f0c46['options']?_0x3f0c46[_0xef15('0x1c')][_0xef15('0x1f')]?_['map'](_0x3f0c46[_0xef15('0x1c')]['include'],function(_0x267735){return{'model':db[_0x267735[_0xef15('0x20')]],'as':_0x267735['as'],'attributes':_0x267735['attributes'],'include':_0x267735[_0xef15('0x1f')]?_[_0xef15('0x21')](_0x267735[_0xef15('0x1f')],function(_0x3f98cb){return{'model':db[_0x3f98cb[_0xef15('0x20')]],'as':_0x3f98cb['as'],'attributes':_0x3f98cb['attributes'],'include':_0x3f98cb[_0xef15('0x1f')]?_['map'](_0x3f98cb[_0xef15('0x1f')],function(_0x48b2e4){return{'model':db[_0x48b2e4[_0xef15('0x20')]],'as':_0x48b2e4['as'],'attributes':_0x48b2e4[_0xef15('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xef15('0xf')](function(_0xe9b1fa){logger[_0xef15('0x10')]('ShowSmsAccount',_0x3f0c46);logger[_0xef15('0x11')](_0xef15('0x22'),_0x3f0c46,JSON['stringify'](_0xe9b1fa));_0x59512a(_0xe9b1fa);})[_0xef15('0x1a')](function(_0x2ef75b){logger[_0xef15('0x15')](_0xef15('0x22'),_0x2ef75b[_0xef15('0x18')],_0x3f0c46);_0x2eb849(_0x2316d2['error'](0x1f4,_0x2ef75b[_0xef15('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index e68da6d..b1684bc 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 7353115..728a513 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x3cca7a,_0x109a23){var _0x34e717=function(_0x19a41f){while(--_0x19a41f){_0x3cca7a['push'](_0x3cca7a['shift']());}};_0x34e717(++_0x109a23);}(_0x3e74,0x175));var _0x43e7=function(_0x4eb6a2,_0x1a610c){_0x4eb6a2=_0x4eb6a2-0x0;var _0x3bdd59=_0x3e74[_0x4eb6a2];return _0x3bdd59;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x399b91,_0x4c3278){var _0x4a39b2=function(_0x12dcdc){while(--_0x12dcdc){_0x399b91['push'](_0x399b91['shift']());}};_0x4a39b2(++_0x4c3278);}(_0x3e74,0x175));var _0x43e7=function(_0x1fe5bf,_0x5c7924){_0x1fe5bf=_0x1fe5bf-0x0;var _0x371898=_0x3e74[_0x1fe5bf];return _0x371898;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6696f15..90fafeb 100644 --- a/server/api/smsApplication/smsApplication.attributes.js +++ b/server/api/smsApplication/smsApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd574=['sequelize','INTEGER','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd574,0xa8));var _0x4d57=function(_0x5dbd4b,_0x363948){_0x5dbd4b=_0x5dbd4b-0x0;var _0x22d54a=_0xd574[_0x5dbd4b];return _0x22d54a;};'use strict';var Sequelize=require(_0x4d57('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4d57('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4d57('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4d57('0x3')]()},'description':{'type':Sequelize[_0x4d57('0x2')]},'interval':{'type':Sequelize[_0x4d57('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4d00=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3e8bf8,_0x4e76d6){var _0x3391ce=function(_0x4f32d6){while(--_0x4f32d6){_0x3e8bf8['push'](_0x3e8bf8['shift']());}};_0x3391ce(++_0x4e76d6);}(_0x4d00,0x7c));var _0x04d0=function(_0x5856af,_0xb50ddf){_0x5856af=_0x5856af-0x0;var _0x56d311=_0x4d00[_0x5856af];return _0x56d311;};'use strict';var Sequelize=require(_0x04d0('0x0'));module[_0x04d0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x04d0('0x2')],'allowNull':![],'defaultValue':_0x04d0('0x3')},'appdata':{'type':Sequelize[_0x04d0('0x4')]()},'description':{'type':Sequelize[_0x04d0('0x2')]},'interval':{'type':Sequelize[_0x04d0('0x2')],'defaultValue':_0x04d0('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 1bc16f0..3b406ac 100644 --- a/server/api/smsApplication/smsApplication.controller.js +++ b/server/api/smsApplication/smsApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc090=['includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params'];(function(_0x362519,_0x5d067b){var _0x134ba4=function(_0xc12a5e){while(--_0xc12a5e){_0x362519['push'](_0x362519['shift']());}};_0x134ba4(++_0x5d067b);}(_0xc090,0x1de));var _0x0c09=function(_0x1b299e,_0x20a0d5){_0x1b299e=_0x1b299e-0x0;var _0x456c63=_0xc090[_0x1b299e];return _0x456c63;};'use strict';var emlformat=require(_0x0c09('0x0'));var rimraf=require(_0x0c09('0x1'));var zipdir=require(_0x0c09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c09('0x3'));var moment=require(_0x0c09('0x4'));var BPromise=require(_0x0c09('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0c09('0x6'));var sox=require('sox');var csv=require(_0x0c09('0x7'));var ejs=require(_0x0c09('0x8'));var fs=require('fs');var fs_extra=require(_0x0c09('0x9'));var _=require(_0x0c09('0xa'));var squel=require(_0x0c09('0xb'));var crypto=require(_0x0c09('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0c09('0xd'));var toCsv=require(_0x0c09('0x7'));var querystring=require('querystring');var Papa=require(_0x0c09('0xe'));var Redis=require(_0x0c09('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0c09('0x10'));var as=require(_0x0c09('0x11'));var hardwareService=require(_0x0c09('0x12'));var logger=require(_0x0c09('0x13'))(_0x0c09('0x14'));var utils=require(_0x0c09('0x15'));var config=require(_0x0c09('0x16'));var licenseUtil=require(_0x0c09('0x17'));var db=require(_0x0c09('0x18'))['db'];function respondWithStatusCode(_0x3b4e0c,_0x299ca9){_0x299ca9=_0x299ca9||0xcc;return function(_0x25c3db){if(_0x25c3db){return _0x3b4e0c[_0x0c09('0x19')](_0x299ca9);}return _0x3b4e0c[_0x0c09('0x1a')](_0x299ca9)[_0x0c09('0x1b')]();};}function respondWithResult(_0x1cb3f8,_0x2e172f){_0x2e172f=_0x2e172f||0xc8;return function(_0x3810a5){if(_0x3810a5){return _0x1cb3f8[_0x0c09('0x1a')](_0x2e172f)[_0x0c09('0x1c')](_0x3810a5);}};}function respondWithFilteredResult(_0x1975f9,_0x295014){return function(_0x4f72a4){if(_0x4f72a4){var _0x46d428=typeof _0x295014[_0x0c09('0x1d')]===_0x0c09('0x1e')&&typeof _0x295014[_0x0c09('0x1f')]==='undefined';var _0x167176=_0x4f72a4[_0x0c09('0x20')];var _0x205d4d=_0x46d428?0x0:_0x295014[_0x0c09('0x1d')];var _0xe4b4de=_0x46d428?_0x4f72a4[_0x0c09('0x20')]:_0x295014[_0x0c09('0x1d')]+_0x295014[_0x0c09('0x1f')];var _0x2790e4;if(_0xe4b4de>=_0x167176){_0xe4b4de=_0x167176;_0x2790e4=0xc8;}else{_0x2790e4=0xce;}_0x1975f9[_0x0c09('0x1a')](_0x2790e4);return _0x1975f9[_0x0c09('0x21')]('Content-Range',_0x205d4d+'-'+_0xe4b4de+'/'+_0x167176)[_0x0c09('0x1c')](_0x4f72a4);}return null;};}function patchUpdates(_0x2f89ca){return function(_0x515129){try{jsonpatch[_0x0c09('0x22')](_0x515129,_0x2f89ca,!![]);}catch(_0x22a32d){return BPromise[_0x0c09('0x23')](_0x22a32d);}return _0x515129[_0x0c09('0x24')]();};}function saveUpdates(_0x780fe0,_0x3b6372){return function(_0x362ec3){if(_0x362ec3){return _0x362ec3[_0x0c09('0x25')](_0x780fe0)[_0x0c09('0x26')](function(_0x161d2e){return _0x161d2e;});}return null;};}function removeEntity(_0x1c1174,_0x610e29){return function(_0x1c7ebb){if(_0x1c7ebb){return _0x1c7ebb[_0x0c09('0x27')]()['then'](function(){_0x1c1174[_0x0c09('0x1a')](0xcc)[_0x0c09('0x1b')]();});}};}function handleEntityNotFound(_0x1b2d6a,_0x42c7d3){return function(_0x576a61){if(!_0x576a61){_0x1b2d6a[_0x0c09('0x19')](0x194);}return _0x576a61;};}function handleError(_0x1a81be,_0x48232){_0x48232=_0x48232||0x1f4;return function(_0x41e4f4){logger[_0x0c09('0x28')](_0x41e4f4[_0x0c09('0x29')]);if(_0x41e4f4['name']){delete _0x41e4f4[_0x0c09('0x2a')];}_0x1a81be['status'](_0x48232)[_0x0c09('0x2b')](_0x41e4f4);};}exports[_0x0c09('0x2c')]=function(_0x18a517,_0x12a101){var _0x387875={},_0x417dc2={},_0x4656bf={'count':0x0,'rows':[]};var _0x5c9909=_[_0x0c09('0x2d')](db[_0x0c09('0x2e')][_0x0c09('0x2f')],function(_0x390199){return{'name':_0x390199[_0x0c09('0x30')],'type':_0x390199[_0x0c09('0x31')][_0x0c09('0x32')]};});_0x417dc2['model']=_[_0x0c09('0x2d')](_0x5c9909,'name');_0x417dc2[_0x0c09('0x33')]=_[_0x0c09('0x34')](_0x18a517[_0x0c09('0x33')]);_0x417dc2[_0x0c09('0x35')]=_['intersection'](_0x417dc2['model'],_0x417dc2[_0x0c09('0x33')]);_0x387875[_0x0c09('0x36')]=_[_0x0c09('0x37')](_0x417dc2[_0x0c09('0x38')],qs[_0x0c09('0x39')](_0x18a517[_0x0c09('0x33')]['fields']));_0x387875[_0x0c09('0x36')]=_0x387875['attributes'][_0x0c09('0x3a')]?_0x387875[_0x0c09('0x36')]:_0x417dc2[_0x0c09('0x38')];if(!_0x18a517[_0x0c09('0x33')][_0x0c09('0x3b')](_0x0c09('0x3c'))){_0x387875[_0x0c09('0x1f')]=qs[_0x0c09('0x1f')](_0x18a517[_0x0c09('0x33')][_0x0c09('0x1f')]);_0x387875[_0x0c09('0x1d')]=qs['offset'](_0x18a517[_0x0c09('0x33')][_0x0c09('0x1d')]);}_0x387875[_0x0c09('0x3d')]=qs[_0x0c09('0x3e')](_0x18a517['query'][_0x0c09('0x3e')]);_0x387875[_0x0c09('0x3f')]=qs['filters'](_[_0x0c09('0x40')](_0x18a517[_0x0c09('0x33')],_0x417dc2[_0x0c09('0x35')]),_0x5c9909);if(_0x18a517[_0x0c09('0x33')][_0x0c09('0x41')]){_0x387875[_0x0c09('0x3f')]=_['merge'](_0x387875[_0x0c09('0x3f')],{'$or':_['map'](_0x5c9909,function(_0xb835e5){if(_0xb835e5[_0x0c09('0x31')]!==_0x0c09('0x42')){var _0x5d0817={};_0x5d0817[_0xb835e5['name']]={'$like':'%'+_0x18a517['query'][_0x0c09('0x41')]+'%'};return _0x5d0817;}})});}_0x387875=_[_0x0c09('0x43')]({},_0x387875,_0x18a517[_0x0c09('0x44')]);var _0x14e81c={'where':_0x387875[_0x0c09('0x3f')]};return db[_0x0c09('0x2e')][_0x0c09('0x20')](_0x14e81c)[_0x0c09('0x26')](function(_0x222f88){_0x4656bf[_0x0c09('0x20')]=_0x222f88;if(_0x18a517['query']['includeAll']){_0x387875[_0x0c09('0x45')]=[{'all':!![]}];}return db[_0x0c09('0x2e')][_0x0c09('0x46')](_0x387875);})[_0x0c09('0x26')](function(_0x5423b0){_0x4656bf[_0x0c09('0x47')]=_0x5423b0;return _0x4656bf;})[_0x0c09('0x26')](respondWithFilteredResult(_0x12a101,_0x387875))[_0x0c09('0x48')](handleError(_0x12a101,null));};exports[_0x0c09('0x49')]=function(_0x3708e6,_0x3768a8){var _0x5e2503={'raw':!![],'where':{'id':_0x3708e6[_0x0c09('0x4a')]['id']}},_0x4c0b22={};_0x4c0b22[_0x0c09('0x38')]=_[_0x0c09('0x34')](db[_0x0c09('0x2e')][_0x0c09('0x2f')]);_0x4c0b22['query']=_[_0x0c09('0x34')](_0x3708e6[_0x0c09('0x33')]);_0x4c0b22['filters']=_[_0x0c09('0x37')](_0x4c0b22['model'],_0x4c0b22[_0x0c09('0x33')]);_0x5e2503[_0x0c09('0x36')]=_[_0x0c09('0x37')](_0x4c0b22[_0x0c09('0x38')],qs['fields'](_0x3708e6['query']['fields']));_0x5e2503[_0x0c09('0x36')]=_0x5e2503[_0x0c09('0x36')][_0x0c09('0x3a')]?_0x5e2503[_0x0c09('0x36')]:_0x4c0b22[_0x0c09('0x38')];if(_0x3708e6[_0x0c09('0x33')][_0x0c09('0x4b')]){_0x5e2503['include']=[{'all':!![]}];}_0x5e2503=_[_0x0c09('0x43')]({},_0x5e2503,_0x3708e6[_0x0c09('0x44')]);return db[_0x0c09('0x2e')][_0x0c09('0x4c')](_0x5e2503)[_0x0c09('0x26')](handleEntityNotFound(_0x3768a8,null))[_0x0c09('0x26')](respondWithResult(_0x3768a8,null))[_0x0c09('0x48')](handleError(_0x3768a8,null));};exports['create']=function(_0x5245e5,_0x174739){return db['SmsApplication'][_0x0c09('0x4d')](_0x5245e5[_0x0c09('0x4e')],{})[_0x0c09('0x26')](respondWithResult(_0x174739,0xc9))[_0x0c09('0x48')](handleError(_0x174739,null));};exports[_0x0c09('0x25')]=function(_0x958eb,_0x497049){if(_0x958eb[_0x0c09('0x4e')]['id']){delete _0x958eb[_0x0c09('0x4e')]['id'];}return db[_0x0c09('0x2e')][_0x0c09('0x4c')]({'where':{'id':_0x958eb['params']['id']}})['then'](handleEntityNotFound(_0x497049,null))[_0x0c09('0x26')](saveUpdates(_0x958eb['body'],null))['then'](respondWithResult(_0x497049,null))['catch'](handleError(_0x497049,null));};exports[_0x0c09('0x27')]=function(_0x4f8a75,_0x507ee5){return db[_0x0c09('0x2e')][_0x0c09('0x4c')]({'where':{'id':_0x4f8a75[_0x0c09('0x4a')]['id']}})[_0x0c09('0x26')](handleEntityNotFound(_0x507ee5,null))[_0x0c09('0x26')](removeEntity(_0x507ee5,null))[_0x0c09('0x48')](handleError(_0x507ee5,null));}; \ No newline at end of file +var _0xc7f6=['index','map','SmsApplication','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','undefined','limit','offset','set','apply','reject','save','update','then','destroy','error','name','send'];(function(_0x2f68e3,_0x50eb28){var _0x1d525c=function(_0x460ca0){while(--_0x460ca0){_0x2f68e3['push'](_0x2f68e3['shift']());}};_0x1d525c(++_0x50eb28);}(_0xc7f6,0x136));var _0x6c7f=function(_0x2d932c,_0x22541f){_0x2d932c=_0x2d932c-0x0;var _0x57fa94=_0xc7f6[_0x2d932c];return _0x57fa94;};'use strict';var emlformat=require(_0x6c7f('0x0'));var rimraf=require(_0x6c7f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c7f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6c7f('0x3'));var Mustache=require(_0x6c7f('0x4'));var util=require(_0x6c7f('0x5'));var path=require(_0x6c7f('0x6'));var sox=require(_0x6c7f('0x7'));var csv=require(_0x6c7f('0x8'));var ejs=require(_0x6c7f('0x9'));var fs=require('fs');var fs_extra=require(_0x6c7f('0xa'));var _=require(_0x6c7f('0xb'));var squel=require(_0x6c7f('0xc'));var crypto=require(_0x6c7f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6c7f('0xe'));var toCsv=require(_0x6c7f('0x8'));var querystring=require(_0x6c7f('0xf'));var Papa=require(_0x6c7f('0x10'));var Redis=require('ioredis');var authService=require(_0x6c7f('0x11'));var qs=require(_0x6c7f('0x12'));var as=require(_0x6c7f('0x13'));var hardwareService=require(_0x6c7f('0x14'));var logger=require(_0x6c7f('0x15'))('api');var utils=require(_0x6c7f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6c7f('0x17'))['db'];function respondWithStatusCode(_0x35134f,_0x3a63ec){_0x3a63ec=_0x3a63ec||0xcc;return function(_0x4e565b){if(_0x4e565b){return _0x35134f['sendStatus'](_0x3a63ec);}return _0x35134f[_0x6c7f('0x18')](_0x3a63ec)[_0x6c7f('0x19')]();};}function respondWithResult(_0x50b7a0,_0x1a691f){_0x1a691f=_0x1a691f||0xc8;return function(_0xdb7d8e){if(_0xdb7d8e){return _0x50b7a0['status'](_0x1a691f)[_0x6c7f('0x1a')](_0xdb7d8e);}};}function respondWithFilteredResult(_0x14dff9,_0x3a2d07){return function(_0x38ebaf){if(_0x38ebaf){var _0x5122fb=typeof _0x3a2d07['offset']===_0x6c7f('0x1b')&&typeof _0x3a2d07[_0x6c7f('0x1c')]===_0x6c7f('0x1b');var _0x319092=_0x38ebaf['count'];var _0x25d1bf=_0x5122fb?0x0:_0x3a2d07['offset'];var _0x1e9b24=_0x5122fb?_0x38ebaf['count']:_0x3a2d07[_0x6c7f('0x1d')]+_0x3a2d07[_0x6c7f('0x1c')];var _0x56cee8;if(_0x1e9b24>=_0x319092){_0x1e9b24=_0x319092;_0x56cee8=0xc8;}else{_0x56cee8=0xce;}_0x14dff9['status'](_0x56cee8);return _0x14dff9[_0x6c7f('0x1e')]('Content-Range',_0x25d1bf+'-'+_0x1e9b24+'/'+_0x319092)[_0x6c7f('0x1a')](_0x38ebaf);}return null;};}function patchUpdates(_0x28dbdd){return function(_0x3df87f){try{jsonpatch[_0x6c7f('0x1f')](_0x3df87f,_0x28dbdd,!![]);}catch(_0x24c084){return BPromise[_0x6c7f('0x20')](_0x24c084);}return _0x3df87f[_0x6c7f('0x21')]();};}function saveUpdates(_0x36b7e2,_0x197f48){return function(_0xc79951){if(_0xc79951){return _0xc79951[_0x6c7f('0x22')](_0x36b7e2)[_0x6c7f('0x23')](function(_0x367d48){return _0x367d48;});}return null;};}function removeEntity(_0x413e7d,_0x2c00ee){return function(_0x447351){if(_0x447351){return _0x447351[_0x6c7f('0x24')]()['then'](function(){_0x413e7d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6dab74,_0x2c90bb){return function(_0x22b294){if(!_0x22b294){_0x6dab74['sendStatus'](0x194);}return _0x22b294;};}function handleError(_0x366f9b,_0x1c3497){_0x1c3497=_0x1c3497||0x1f4;return function(_0x2e7ed4){logger[_0x6c7f('0x25')](_0x2e7ed4['stack']);if(_0x2e7ed4[_0x6c7f('0x26')]){delete _0x2e7ed4['name'];}_0x366f9b[_0x6c7f('0x18')](_0x1c3497)[_0x6c7f('0x27')](_0x2e7ed4);};}exports[_0x6c7f('0x28')]=function(_0xa1f5a2,_0x2f4676){var _0x18ff5e={},_0xc251f9={},_0x4e6fe7={'count':0x0,'rows':[]};var _0x1ee24b=_[_0x6c7f('0x29')](db[_0x6c7f('0x2a')][_0x6c7f('0x2b')],function(_0x3be860){return{'name':_0x3be860['fieldName'],'type':_0x3be860[_0x6c7f('0x2c')][_0x6c7f('0x2d')]};});_0xc251f9['model']=_['map'](_0x1ee24b,'name');_0xc251f9['query']=_[_0x6c7f('0x2e')](_0xa1f5a2[_0x6c7f('0x2f')]);_0xc251f9[_0x6c7f('0x30')]=_[_0x6c7f('0x31')](_0xc251f9['model'],_0xc251f9[_0x6c7f('0x2f')]);_0x18ff5e[_0x6c7f('0x32')]=_[_0x6c7f('0x31')](_0xc251f9[_0x6c7f('0x33')],qs[_0x6c7f('0x34')](_0xa1f5a2[_0x6c7f('0x2f')][_0x6c7f('0x34')]));_0x18ff5e[_0x6c7f('0x32')]=_0x18ff5e[_0x6c7f('0x32')][_0x6c7f('0x35')]?_0x18ff5e[_0x6c7f('0x32')]:_0xc251f9[_0x6c7f('0x33')];if(!_0xa1f5a2[_0x6c7f('0x2f')]['hasOwnProperty'](_0x6c7f('0x36'))){_0x18ff5e[_0x6c7f('0x1c')]=qs['limit'](_0xa1f5a2[_0x6c7f('0x2f')][_0x6c7f('0x1c')]);_0x18ff5e[_0x6c7f('0x1d')]=qs[_0x6c7f('0x1d')](_0xa1f5a2[_0x6c7f('0x2f')][_0x6c7f('0x1d')]);}_0x18ff5e['order']=qs['sort'](_0xa1f5a2[_0x6c7f('0x2f')]['sort']);_0x18ff5e[_0x6c7f('0x37')]=qs[_0x6c7f('0x30')](_['pick'](_0xa1f5a2[_0x6c7f('0x2f')],_0xc251f9[_0x6c7f('0x30')]),_0x1ee24b);if(_0xa1f5a2[_0x6c7f('0x2f')][_0x6c7f('0x38')]){_0x18ff5e[_0x6c7f('0x37')]=_[_0x6c7f('0x39')](_0x18ff5e[_0x6c7f('0x37')],{'$or':_['map'](_0x1ee24b,function(_0xd44838){if(_0xd44838['type']!==_0x6c7f('0x3a')){var _0x417c72={};_0x417c72[_0xd44838[_0x6c7f('0x26')]]={'$like':'%'+_0xa1f5a2[_0x6c7f('0x2f')][_0x6c7f('0x38')]+'%'};return _0x417c72;}})});}_0x18ff5e=_[_0x6c7f('0x39')]({},_0x18ff5e,_0xa1f5a2[_0x6c7f('0x3b')]);var _0x35b48f={'where':_0x18ff5e['where']};return db[_0x6c7f('0x2a')][_0x6c7f('0x3c')](_0x35b48f)['then'](function(_0xd88e17){_0x4e6fe7[_0x6c7f('0x3c')]=_0xd88e17;if(_0xa1f5a2[_0x6c7f('0x2f')]['includeAll']){_0x18ff5e[_0x6c7f('0x3d')]=[{'all':!![]}];}return db[_0x6c7f('0x2a')][_0x6c7f('0x3e')](_0x18ff5e);})[_0x6c7f('0x23')](function(_0x370ac5){_0x4e6fe7[_0x6c7f('0x3f')]=_0x370ac5;return _0x4e6fe7;})[_0x6c7f('0x23')](respondWithFilteredResult(_0x2f4676,_0x18ff5e))[_0x6c7f('0x40')](handleError(_0x2f4676,null));};exports['show']=function(_0x40968b,_0x32b412){var _0x54f0c4={'raw':!![],'where':{'id':_0x40968b[_0x6c7f('0x41')]['id']}},_0x12b39f={};_0x12b39f['model']=_[_0x6c7f('0x2e')](db[_0x6c7f('0x2a')]['rawAttributes']);_0x12b39f[_0x6c7f('0x2f')]=_[_0x6c7f('0x2e')](_0x40968b[_0x6c7f('0x2f')]);_0x12b39f[_0x6c7f('0x30')]=_[_0x6c7f('0x31')](_0x12b39f[_0x6c7f('0x33')],_0x12b39f[_0x6c7f('0x2f')]);_0x54f0c4['attributes']=_[_0x6c7f('0x31')](_0x12b39f[_0x6c7f('0x33')],qs[_0x6c7f('0x34')](_0x40968b[_0x6c7f('0x2f')][_0x6c7f('0x34')]));_0x54f0c4[_0x6c7f('0x32')]=_0x54f0c4[_0x6c7f('0x32')][_0x6c7f('0x35')]?_0x54f0c4[_0x6c7f('0x32')]:_0x12b39f['model'];if(_0x40968b[_0x6c7f('0x2f')][_0x6c7f('0x42')]){_0x54f0c4['include']=[{'all':!![]}];}_0x54f0c4=_[_0x6c7f('0x39')]({},_0x54f0c4,_0x40968b['options']);return db[_0x6c7f('0x2a')][_0x6c7f('0x43')](_0x54f0c4)[_0x6c7f('0x23')](handleEntityNotFound(_0x32b412,null))['then'](respondWithResult(_0x32b412,null))['catch'](handleError(_0x32b412,null));};exports[_0x6c7f('0x44')]=function(_0x4ca447,_0x56ecf6){return db['SmsApplication'][_0x6c7f('0x44')](_0x4ca447[_0x6c7f('0x45')],{})[_0x6c7f('0x23')](respondWithResult(_0x56ecf6,0xc9))['catch'](handleError(_0x56ecf6,null));};exports[_0x6c7f('0x22')]=function(_0x32da08,_0xccc439){if(_0x32da08[_0x6c7f('0x45')]['id']){delete _0x32da08[_0x6c7f('0x45')]['id'];}return db[_0x6c7f('0x2a')][_0x6c7f('0x43')]({'where':{'id':_0x32da08[_0x6c7f('0x41')]['id']}})[_0x6c7f('0x23')](handleEntityNotFound(_0xccc439,null))['then'](saveUpdates(_0x32da08[_0x6c7f('0x45')],null))[_0x6c7f('0x23')](respondWithResult(_0xccc439,null))['catch'](handleError(_0xccc439,null));};exports['destroy']=function(_0x233960,_0xa12662){return db['SmsApplication'][_0x6c7f('0x43')]({'where':{'id':_0x233960[_0x6c7f('0x41')]['id']}})['then'](handleEntityNotFound(_0xa12662,null))[_0x6c7f('0x23')](removeEntity(_0xa12662,null))[_0x6c7f('0x40')](handleError(_0xa12662,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 94fe994..9b1cf59 100644 --- a/server/api/smsApplication/smsApplication.model.js +++ b/server/api/smsApplication/smsApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9c8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd9c8[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var logger=require('../../config/logger')(_0x8d9c('0x2'));var moment=require(_0x8d9c('0x3'));var BPromise=require(_0x8d9c('0x4'));var rp=require(_0x8d9c('0x5'));var fs=require('fs');var path=require(_0x8d9c('0x6'));var rimraf=require(_0x8d9c('0x7'));var config=require(_0x8d9c('0x8'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x53567f,_0x2c083c){return _0x53567f[_0x8d9c('0x9')](_0x8d9c('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8d9c('0xb'),'collate':_0x8d9c('0xc')});}; \ No newline at end of file +var _0x3077=['moment','request-promise','./smsApplication.attributes','exports','define','sms_applications','lodash','util'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x3077,0xe6));var _0x7307=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x3077[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x7307('0x0'));var util=require(_0x7307('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7307('0x2'));var BPromise=require('bluebird');var rp=require(_0x7307('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7307('0x4'));module[_0x7307('0x5')]=function(_0x3c60f8,_0x1287e7){return _0x3c60f8[_0x7307('0x6')]('SmsApplication',attributes,{'tableName':_0x7307('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8865b5e..1f8dc03 100644 --- a/server/api/smsApplication/smsApplication.rpc.js +++ b/server/api/smsApplication/smsApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9563=['message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9563,0x1e7));var _0x3956=function(_0xdbb433,_0x1293d7){_0xdbb433=_0xdbb433-0x0;var _0x941fb6=_0x9563[_0xdbb433];return _0x941fb6;};'use strict';var _=require(_0x3956('0x0'));var util=require(_0x3956('0x1'));var moment=require('moment');var BPromise=require(_0x3956('0x2'));var rs=require(_0x3956('0x3'));var fs=require('fs');var Redis=require(_0x3956('0x4'));var db=require(_0x3956('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3956('0x6'));var config=require('../../config/environment');var jayson=require(_0x3956('0x7'));var client=jayson[_0x3956('0x8')][_0x3956('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xba3e4b,_0x47bdbc,_0x234e06){return new BPromise(function(_0xf1e100,_0x2863cd){return client[_0x3956('0xa')](_0xba3e4b,_0x234e06)[_0x3956('0xb')](function(_0x4dd27f){logger['info'](_0x3956('0xc'),_0x47bdbc,_0x3956('0xd'));logger[_0x3956('0xe')](_0x3956('0xf'),_0x47bdbc,'request\x20sent',JSON[_0x3956('0x10')](_0x4dd27f));if(_0x4dd27f[_0x3956('0x11')]){if(_0x4dd27f[_0x3956('0x11')][_0x3956('0x12')]===0x1f4){logger[_0x3956('0x11')](_0x3956('0xc'),_0x47bdbc,_0x4dd27f[_0x3956('0x11')][_0x3956('0x13')]);return _0x2863cd(_0x4dd27f[_0x3956('0x11')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x47bdbc,_0x4dd27f[_0x3956('0x11')][_0x3956('0x13')]);return _0xf1e100(_0x4dd27f['error'][_0x3956('0x13')]);}else{logger[_0x3956('0x14')](_0x3956('0xc'),_0x47bdbc,_0x3956('0xd'));_0xf1e100(_0x4dd27f[_0x3956('0x15')][_0x3956('0x13')]);}})[_0x3956('0x16')](function(_0x458b4a){logger[_0x3956('0x11')](_0x3956('0xc'),_0x47bdbc,_0x458b4a);_0x2863cd(_0x458b4a);});});} \ No newline at end of file +var _0x49f8=['message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5ddc7d,_0x3ecbfb){var _0x50ce0e=function(_0x49ad52){while(--_0x49ad52){_0x5ddc7d['push'](_0x5ddc7d['shift']());}};_0x50ce0e(++_0x3ecbfb);}(_0x49f8,0xff));var _0x849f=function(_0x207061,_0xe38cda){_0x207061=_0x207061-0x0;var _0x4a2833=_0x49f8[_0x207061];return _0x4a2833;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('SmsApplication,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index bf37bfc..138b00a 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4024=['addTags','put','smsinteraction:update','update','delete','destroy','removeTags','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x4024,0x89));var _0x4402=function(_0x190e48,_0x2110c2){_0x190e48=_0x190e48-0x0;var _0x58e588=_0x4024[_0x190e48];return _0x58e588;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/describe',auth[_0x4402('0x7')](),controller['describe']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4402('0x9')]('/:id/messages',auth[_0x4402('0x7')](),controller['getMessages']);router[_0x4402('0x9')]('/:id/download',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xc')]);router[_0x4402('0xd')]('/:id/messages',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xd')](_0x4402('0xf'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x12')),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x15')),controller[_0x4402('0x16')]);router[_0x4402('0x17')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')]('sms','smsinteraction:destroy'),controller[_0x4402('0x18')]);router[_0x4402('0x17')]('/:id/tags',auth[_0x4402('0x7')](),controller[_0x4402('0x19')]);module['exports']=router; \ No newline at end of file +var _0x9ffd=['sms','smsinteraction:addtags','put','smsinteraction:update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x35825e,_0x657421){var _0x4f4d90=function(_0x160265){while(--_0x160265){_0x35825e['push'](_0x35825e['shift']());}};_0x4f4d90(++_0x657421);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x262dff,_0x1a216c){_0x262dff=_0x262dff-0x0;var _0x1aec82=_0x9ffd[_0x262dff];return _0x1aec82;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0x12')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router['post']('/:id/messages',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x14')]);router[_0xd9ff('0x12')](_0xd9ff('0x15'),auth[_0xd9ff('0x9')](),interaction['tracked'](_0xd9ff('0x16'),_0xd9ff('0x17')),controller['addTags']);router[_0xd9ff('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked']('sms',_0xd9ff('0x19')),controller['update']);router[_0xd9ff('0x1a')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),interaction[_0xd9ff('0x1b')](_0xd9ff('0x16'),_0xd9ff('0x1c')),controller[_0xd9ff('0x1d')]);router[_0xd9ff('0x1a')](_0xd9ff('0x15'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x1e')]);module[_0xd9ff('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 6d57ecd..eb5e34b 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0972=['out','INTEGER','moment','BOOLEAN','STRING','DATE','ENUM'];(function(_0x11f1b6,_0xe0b177){var _0x44071b=function(_0x5c5624){while(--_0x5c5624){_0x11f1b6['push'](_0x11f1b6['shift']());}};_0x44071b(++_0xe0b177);}(_0x0972,0x64));var _0x2097=function(_0x5a3ecd,_0x3983dd){_0x5a3ecd=_0x5a3ecd-0x0;var _0xe7de76=_0x0972[_0x5a3ecd];return _0xe7de76;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2097('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2097('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2097('0x2')]},'secondDisposition':{'type':Sequelize[_0x2097('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2097('0x2')]},'phone':{'type':Sequelize[_0x2097('0x2')]},'read1stAt':{'type':Sequelize[_0x2097('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2097('0x4')]('in',_0x2097('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2097('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2097('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2097('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2097('0x6')]}}; \ No newline at end of file +var _0x3f72=['DATE','out','BOOLEAN','INTEGER','sequelize','moment','exports','STRING','ENUM'];(function(_0x30f5e7,_0x4af375){var _0x59f279=function(_0x264d7e){while(--_0x264d7e){_0x30f5e7['push'](_0x30f5e7['shift']());}};_0x59f279(++_0x4af375);}(_0x3f72,0xaf));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x23f7('0x0'));var moment=require(_0x23f7('0x1'));module[_0x23f7('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x23f7('0x3')]},'secondDisposition':{'type':Sequelize[_0x23f7('0x3')]},'thirdDisposition':{'type':Sequelize[_0x23f7('0x3')]},'note':{'type':Sequelize[_0x23f7('0x3')]},'phone':{'type':Sequelize[_0x23f7('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x23f7('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x23f7('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x23f7('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x23f7('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x23f7('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 4c61aa2..663ecf7 100644 --- a/server/api/smsInteraction/smsInteraction.controller.js +++ b/server/api/smsInteraction/smsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0886=['../../components/export/pdf','../../config/logger','api','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','update','destroy','then','error','stack','name','send','map','SmsInteraction','rawAttributes','fieldName','type','key','findAll','sms','query','catch','model','keys','filters','intersection','fields','attributes','includeAll','include','merge','find','create','body','params','describe','addMessage','SmsMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Messages','secret','read','SmsAccount','Account','Owner','Sms','N.A.','createdAt','format','closed','out','direction','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/parsers/qs'];(function(_0x17791a,_0x5598fa){var _0x11a666=function(_0x218b34){while(--_0x218b34){_0x17791a['push'](_0x17791a['shift']());}};_0x11a666(++_0x5598fa);}(_0x0886,0x1bf));var _0x6088=function(_0x43a196,_0x433c1f){_0x43a196=_0x43a196-0x0;var _0x55eb1a=_0x0886[_0x43a196];return _0x55eb1a;};'use strict';var rimraf=require(_0x6088('0x0'));var zipdir=require(_0x6088('0x1'));var moment=require(_0x6088('0x2'));var BPromise=require(_0x6088('0x3'));var util=require(_0x6088('0x4'));var path=require(_0x6088('0x5'));var ejs=require(_0x6088('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x6088('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x6088('0x8'));var pdf=require(_0x6088('0x9'));var logger=require(_0x6088('0xa'))(_0x6088('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x6088('0xc')]=_[_0x6088('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6088('0xe'))(new Redis(config[_0x6088('0xc')]));require(_0x6088('0xf'))[_0x6088('0x10')](socket);function respondWithStatusCode(_0x329435,_0x11daca){_0x11daca=_0x11daca||0xcc;return function(_0x45da28){if(_0x45da28){return _0x329435[_0x6088('0x11')](_0x11daca);}return _0x329435[_0x6088('0x12')](_0x11daca)[_0x6088('0x13')]();};}function respondWithResult(_0x3d7829,_0x245d2c){_0x245d2c=_0x245d2c||0xc8;return function(_0x195b2f){if(_0x195b2f){return _0x3d7829[_0x6088('0x12')](_0x245d2c)['json'](_0x195b2f);}};}function respondWithFilteredResult(_0x553188,_0x43deac){return function(_0x3088aa){if(_0x3088aa){var _0x1a78c8=typeof _0x43deac[_0x6088('0x14')]===_0x6088('0x15')&&typeof _0x43deac[_0x6088('0x16')]===_0x6088('0x15');var _0x4439ca=_0x3088aa[_0x6088('0x17')];var _0x7485b7=_0x1a78c8?0x0:_0x43deac['offset'];var _0x4be23a=_0x1a78c8?_0x3088aa['count']:_0x43deac[_0x6088('0x14')]+_0x43deac[_0x6088('0x16')];var _0x163b01;if(_0x4be23a>=_0x4439ca){_0x4be23a=_0x4439ca;_0x163b01=0xc8;}else{_0x163b01=0xce;}_0x553188[_0x6088('0x12')](_0x163b01);return _0x553188[_0x6088('0x18')]('Content-Range',_0x7485b7+'-'+_0x4be23a+'/'+_0x4439ca)['json'](_0x3088aa);}return null;};}function saveUpdates(_0xb34540){return function(_0x357845){if(_0x357845){return _0x357845[_0x6088('0x19')](_0xb34540)['then'](function(_0x5a1781){return _0x5a1781;});}return null;};}function removeEntity(_0x1ad3a7){return function(_0x4b51e1){if(_0x4b51e1){return _0x4b51e1[_0x6088('0x1a')]()[_0x6088('0x1b')](function(){_0x1ad3a7[_0x6088('0x12')](0xcc)[_0x6088('0x13')]();});}};}function handleEntityNotFound(_0x5ae492){return function(_0x23fe16){if(!_0x23fe16){_0x5ae492[_0x6088('0x11')](0x194);}return _0x23fe16;};}function handleError(_0x427094,_0x5e4f6e){_0x5e4f6e=_0x5e4f6e||0x1f4;return function(_0x26ccb7){logger[_0x6088('0x1c')](_0x26ccb7[_0x6088('0x1d')]);if(_0x26ccb7[_0x6088('0x1e')]){delete _0x26ccb7[_0x6088('0x1e')];}_0x427094[_0x6088('0x12')](_0x5e4f6e)[_0x6088('0x1f')](_0x26ccb7);};}exports['index']=function(_0x6a868a,_0x313c34){var _0x2af282={};var _0x49ada0=_[_0x6088('0x20')](db[_0x6088('0x21')][_0x6088('0x22')],function(_0x27f693){return{'name':_0x27f693[_0x6088('0x23')],'type':_0x27f693[_0x6088('0x24')][_0x6088('0x25')]};});_0x2af282=qs['getOptions'](_0x49ada0,_0x6a868a);return interaction[_0x6088('0x26')](_0x6088('0x27'),_0x6a868a[_0x6088('0x28')],_0x6a868a['user'],_0x2af282,_0x49ada0)[_0x6088('0x1b')](respondWithFilteredResult(_0x313c34,_0x2af282))[_0x6088('0x29')](handleError(_0x313c34,null));};exports['show']=function(_0x4d9420,_0x4ea998){var _0x572c21={'raw':![],'where':{'id':_0x4d9420['params']['id']}},_0x48fba8={};_0x48fba8[_0x6088('0x2a')]=_[_0x6088('0x2b')](db['SmsInteraction'][_0x6088('0x22')]);_0x48fba8[_0x6088('0x28')]=_[_0x6088('0x2b')](_0x4d9420[_0x6088('0x28')]);_0x48fba8[_0x6088('0x2c')]=_[_0x6088('0x2d')](_0x48fba8[_0x6088('0x2a')],_0x48fba8[_0x6088('0x28')]);_0x572c21['attributes']=_[_0x6088('0x2d')](_0x48fba8[_0x6088('0x2a')],qs[_0x6088('0x2e')](_0x4d9420[_0x6088('0x28')][_0x6088('0x2e')]));_0x572c21['attributes']=_0x572c21[_0x6088('0x2f')]['length']?_0x572c21[_0x6088('0x2f')]:_0x48fba8[_0x6088('0x2a')];if(_0x4d9420[_0x6088('0x28')][_0x6088('0x30')]){_0x572c21[_0x6088('0x31')]=[{'all':!![]}];}_0x572c21=_[_0x6088('0x32')]({},_0x572c21,_0x4d9420['options']);return db['SmsInteraction'][_0x6088('0x33')](_0x572c21)[_0x6088('0x1b')](handleEntityNotFound(_0x4ea998,null))[_0x6088('0x1b')](respondWithResult(_0x4ea998,null))[_0x6088('0x29')](handleError(_0x4ea998,null));};exports[_0x6088('0x34')]=function(_0x3a0fe9,_0x15496b){return db[_0x6088('0x21')][_0x6088('0x34')](_0x3a0fe9[_0x6088('0x35')],{})[_0x6088('0x1b')](respondWithResult(_0x15496b,0xc9))['catch'](handleError(_0x15496b,null));};exports[_0x6088('0x19')]=function(_0x3a5c04,_0x5811e3){if(_0x3a5c04['body']['id']){delete _0x3a5c04[_0x6088('0x35')]['id'];}return db[_0x6088('0x21')][_0x6088('0x33')]({'where':{'id':_0x3a5c04[_0x6088('0x36')]['id']}})['then'](handleEntityNotFound(_0x5811e3,null))[_0x6088('0x1b')](saveUpdates(_0x3a5c04[_0x6088('0x35')],null))[_0x6088('0x1b')](respondWithResult(_0x5811e3,null))[_0x6088('0x29')](handleError(_0x5811e3,null));};exports[_0x6088('0x1a')]=function(_0x3a063f,_0x51eddb){return db[_0x6088('0x21')]['find']({'where':{'id':_0x3a063f[_0x6088('0x36')]['id']}})[_0x6088('0x1b')](handleEntityNotFound(_0x51eddb,null))[_0x6088('0x1b')](removeEntity(_0x51eddb,null))[_0x6088('0x29')](handleError(_0x51eddb,null));};exports[_0x6088('0x37')]=function(_0xedde4,_0x2a0547){return db[_0x6088('0x21')][_0x6088('0x37')]()['then'](respondWithResult(_0x2a0547,null))[_0x6088('0x29')](handleError(_0x2a0547,null));};exports[_0x6088('0x38')]=function(_0x53122e,_0x53703f){return db[_0x6088('0x39')][_0x6088('0x33')]({'where':{'id':_0x53122e[_0x6088('0x36')]['id']}})['then'](handleEntityNotFound(_0x53703f,null))[_0x6088('0x1b')](function(_0x1951a6){if(_0x1951a6){return _0x1951a6[_0x6088('0x38')](_0x53122e[_0x6088('0x35')][_0x6088('0x3a')],_['omit'](_0x53122e['body'],['ids','id'])||{});}})[_0x6088('0x1b')](respondWithResult(_0x53703f,null))[_0x6088('0x29')](handleError(_0x53703f,null));};exports[_0x6088('0x3b')]=function(_0x4713e4,_0x357aa8){var _0x4eaba2={'raw':![],'where':{}};var _0x22ae2d={};var _0x2aece5={'count':0x0,'rows':[]};return db[_0x6088('0x21')][_0x6088('0x3c')]({'where':{'id':_0x4713e4['params']['id']}})[_0x6088('0x1b')](handleEntityNotFound(_0x357aa8,null))['then'](function(_0x4c5424){if(_0x4c5424){_0x22ae2d[_0x6088('0x2a')]=_['keys'](db[_0x6088('0x39')][_0x6088('0x22')]);_0x22ae2d['query']=_[_0x6088('0x2b')](_0x4713e4['query']);_0x22ae2d[_0x6088('0x2c')]=_[_0x6088('0x2d')](_0x22ae2d[_0x6088('0x2a')],_0x22ae2d[_0x6088('0x28')]);_0x4eaba2['attributes']=_[_0x6088('0x2d')](_0x22ae2d[_0x6088('0x2a')],qs[_0x6088('0x2e')](_0x4713e4[_0x6088('0x28')][_0x6088('0x2e')]));_0x4eaba2[_0x6088('0x2f')]=_0x4eaba2['attributes'][_0x6088('0x3d')]?_0x4eaba2[_0x6088('0x2f')]:_0x22ae2d[_0x6088('0x2a')];if(!_0x4713e4[_0x6088('0x28')][_0x6088('0x3e')](_0x6088('0x3f'))){_0x4eaba2[_0x6088('0x16')]=qs['limit'](_0x4713e4[_0x6088('0x28')][_0x6088('0x16')]);_0x4eaba2['offset']=qs[_0x6088('0x14')](_0x4713e4[_0x6088('0x28')][_0x6088('0x14')]);}_0x4eaba2[_0x6088('0x40')]=qs['sort'](_0x4713e4[_0x6088('0x28')][_0x6088('0x41')]);_0x4eaba2[_0x6088('0x42')]=qs[_0x6088('0x2c')](_['pick'](_0x4713e4[_0x6088('0x28')],_0x22ae2d['filters']));_0x4eaba2[_0x6088('0x42')][_0x6088('0x43')]=_0x4c5424['id'];if(_0x4713e4[_0x6088('0x28')][_0x6088('0x44')]){_0x4eaba2[_0x6088('0x42')]=_[_0x6088('0x32')](_0x4eaba2[_0x6088('0x42')],{'$or':_[_0x6088('0x20')](_0x4eaba2[_0x6088('0x2f')],function(_0x4aa695){var _0x334e65={};_0x334e65[_0x4aa695]={'$like':'%'+_0x4713e4[_0x6088('0x28')][_0x6088('0x44')]+'%'};return _0x334e65;})});}if(_0x4713e4[_0x6088('0x28')][_0x6088('0x45')]){var _0x3d8626=_0x4713e4[_0x6088('0x28')]['$gte'][_0x6088('0x46')](',');var _0x39eef1={};_0x39eef1[_0x3d8626[0x0]]={'$gte':moment(_0x3d8626[0x1])['format'](_0x6088('0x47'))};_0x4eaba2[_0x6088('0x42')]=_[_0x6088('0x32')](_0x4eaba2[_0x6088('0x42')],_0x39eef1);}_0x4eaba2=_[_0x6088('0x32')]({},_0x4eaba2,_0x4713e4[_0x6088('0x48')]);return db['SmsMessage'][_0x6088('0x17')]({'where':_0x4eaba2[_0x6088('0x42')]})[_0x6088('0x1b')](function(_0x540e17){_0x2aece5[_0x6088('0x17')]=_0x540e17;if(_0x4713e4[_0x6088('0x28')][_0x6088('0x30')]){_0x4eaba2[_0x6088('0x31')]=[{'all':!![]}];}return db[_0x6088('0x39')][_0x6088('0x26')](_0x4eaba2);})['then'](function(_0x285524){_0x2aece5['rows']=_0x285524;return _0x2aece5;});}})[_0x6088('0x1b')](respondWithFilteredResult(_0x357aa8,_0x4eaba2))[_0x6088('0x29')](handleError(_0x357aa8,null));};exports[_0x6088('0x49')]=function(_0x137465,_0x4b0850){return db['SmsInteraction'][_0x6088('0x33')]({'where':{'id':_0x137465[_0x6088('0x36')]['id']}})['then'](handleEntityNotFound(_0x4b0850,null))['then'](function(_0x454120){if(_0x454120){return _0x454120[_0x6088('0x4a')](_0x137465[_0x6088('0x35')][_0x6088('0x3a')],_['omit'](_0x137465['body'],[_0x6088('0x3a'),'id'])||{})[_0x6088('0x4b')](function(){return db[_0x6088('0x4c')][_0x6088('0x26')]({'attributes':['id',_0x6088('0x1e'),_0x6088('0x4d')],'where':{'id':_0x137465[_0x6088('0x35')]['ids']}});})['then'](function(_0x2eb88c){socket[_0x6088('0x4e')]('smsInteractionTags:save',{'id':Number(_0x137465[_0x6088('0x36')]['id']),'tags':_0x2eb88c||[]});return{'id':Number(_0x137465[_0x6088('0x36')]['id']),'tags':_0x2eb88c||[]};});}})[_0x6088('0x1b')](respondWithResult(_0x4b0850,null))[_0x6088('0x29')](handleError(_0x4b0850,null));};exports[_0x6088('0x4f')]=function(_0x5412be,_0x1fea25){return db['SmsInteraction'][_0x6088('0x33')]({'where':{'id':_0x5412be[_0x6088('0x36')]['id']}})['then'](handleEntityNotFound(_0x1fea25,null))['then'](function(_0x3aefe6){if(_0x3aefe6){return _0x3aefe6[_0x6088('0x4f')](_0x5412be[_0x6088('0x28')]['ids']);}})['then'](respondWithStatusCode(_0x1fea25,null))[_0x6088('0x29')](handleError(_0x1fea25,null));};exports[_0x6088('0x50')]=function(_0x40653d,_0x500711){var _0x44b3d0=moment()[_0x6088('0x51')]()[_0x6088('0x52')]();var _0x14547e=path[_0x6088('0x53')](config[_0x6088('0x54')],_0x6088('0x55'),_0x6088('0x56'),'tmp');var _0xa020ff=path[_0x6088('0x53')](_0x14547e,_0x44b3d0);var _0x240b35=util['format'](_0x6088('0x57'),_0x40653d[_0x6088('0x36')]['id'],_0x44b3d0);var _0x276d8d=path[_0x6088('0x53')](_0x14547e,_0x240b35);var _0x3a534a=[];_0x3a534a['push']({'model':db[_0x6088('0x58')],'as':_0x6088('0x58'),'attributes':['id',_0x6088('0x59')],'raw':!![]});_0x3a534a[_0x6088('0x5a')]({'model':db[_0x6088('0x5b')],'as':_0x6088('0x5c'),'attributes':['id',_0x6088('0x5d'),_0x6088('0x5e')],'raw':!![]});var _0x53002c=[{'model':db[_0x6088('0x39')],'as':_0x6088('0x5f'),'attributes':['id',_0x6088('0x35'),'createdAt','direction',_0x6088('0x60'),_0x6088('0x61')],'include':_0x3a534a}];_0x53002c[_0x6088('0x5a')]({'model':db[_0x6088('0x62')],'as':_0x6088('0x63'),'attributes':['id',_0x6088('0x1e')]});_0x53002c[_0x6088('0x5a')]({'model':db['User'],'as':_0x6088('0x64'),'attributes':['id',_0x6088('0x59')]});return db['SmsInteraction']['find']({'where':{'id':_0x40653d[_0x6088('0x36')]['id']},'include':_0x53002c})[_0x6088('0x1b')](handleEntityNotFound(_0x500711,null))[_0x6088('0x1b')](function(_0x16f5a9){if(_0x16f5a9){var _0x5b1c23=_0x16f5a9['get']({'plain':!![]});fs['mkdirSync'](_0xa020ff);var _0x48ea4a={'channel':_0x6088('0x65'),'account':_0x5b1c23[_0x6088('0x63')]['name'],'agent':_0x5b1c23[_0x6088('0x64')]?_0x5b1c23['Owner'][_0x6088('0x59')]:_0x6088('0x66'),'createdAt':moment(_0x5b1c23[_0x6088('0x67')])[_0x6088('0x68')](_0x6088('0x47'))['toString'](),'closedAt':_0x5b1c23[_0x6088('0x69')]?moment(_0x5b1c23['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6088('0x52')]():'','disposition':_0x5b1c23['disposition'],'messages':_(_0x5b1c23[_0x6088('0x5f')])[_0x6088('0x44')]({'secret':![]})['map'](function(_0x32edf6){return{'date':moment(_0x32edf6[_0x6088('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6088('0x52')](),'sender':_0x32edf6['direction']===_0x6088('0x6a')?_0x32edf6[_0x6088('0x58')]?_0x32edf6[_0x6088('0x58')][_0x6088('0x59')]:'System':_0x32edf6[_0x6088('0x5c')][_0x6088('0x5d')]+(_0x32edf6['Contact'][_0x6088('0x5e')]?'\x20'+_0x32edf6[_0x6088('0x5c')][_0x6088('0x5e')]:''),'body':_0x32edf6[_0x6088('0x35')],'direction':_0x32edf6[_0x6088('0x6b')]===_0x6088('0x6a')?'A':'C','secret':_0x32edf6[_0x6088('0x60')],'read':_0x32edf6[_0x6088('0x61')]};})['value']()};return ejs[_0x6088('0x6c')](path['join'](config[_0x6088('0x54')],_0x6088('0x55'),_0x6088('0x6d'),_0x6088('0x6e')),{'interaction':_0x48ea4a})[_0x6088('0x1b')](function(_0x56723e){var _0x45eb3c=path['join'](_0xa020ff,'transcript-'+_0x5b1c23['id']+'-'+_0x44b3d0+'.pdf');var _0x27d098={'path':_0x45eb3c,'channel':_0x6088('0x65'),'interactionId':_0x5b1c23['id']};return pdf[_0x6088('0x6f')](_0x56723e,_0x27d098);})['then'](function(){return new BPromise(function(_0xe2e38f,_0x1d9599){zipdir(_0xa020ff,{'saveTo':_0x276d8d},function(_0x371994,_0x3ab106){if(_0x371994)return _0x1d9599(_0x371994);return _0xe2e38f(_0x3ab106);});})[_0x6088('0x1b')](function(){return new BPromise(function(_0x2e8b14,_0x1d661c){rimraf(_0xa020ff,function(_0x18d180){if(_0x18d180)_0x1d661c(_0x18d180);return _0x2e8b14();});});})['then'](function(){return _0x500711[_0x6088('0x50')](_0x276d8d,_0x240b35,function(_0x67585a){if(_0x67585a){console[_0x6088('0x70')](_0x6088('0x71'),_0x67585a);}else{fs['unlinkSync'](_0x276d8d);}});});});}else{return _0x500711['sendStatus'](0xc8);}})['catch'](handleError(_0x500711,null));}; \ No newline at end of file +var _0xd3ea=['Contact','firstName','lastName','Messages','direction','secret','read','SmsAccount','Owner','get','Sms','Account','createdAt','closed','closedAt','toString','map','System','out','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','error','name','send','index','SmsInteraction','type','key','getOptions','findAll','sms','query','user','model','keys','rawAttributes','filters','intersection','attributes','includeAll','include','merge','options','find','catch','create','body','update','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','fields','hasOwnProperty','nolimit','order','where','SmsInteractionId','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','push','User','fullname','CmContact'];(function(_0x158965,_0x117f97){var _0x3a3e9d=function(_0x1ee22b){while(--_0x1ee22b){_0x158965['push'](_0x158965['shift']());}};_0x3a3e9d(++_0x117f97);}(_0xd3ea,0x91));var _0xad3e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd3ea[_0x6c993a];return _0x27f547;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xad3e('0x0'));var moment=require(_0xad3e('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xad3e('0x2'));var ejs=require(_0xad3e('0x3'));var fs=require('fs');var _=require(_0xad3e('0x4'));var Redis=require(_0xad3e('0x5'));var interaction=require(_0xad3e('0x6'));var qs=require(_0xad3e('0x7'));var pdf=require(_0xad3e('0x8'));var logger=require(_0xad3e('0x9'))(_0xad3e('0xa'));var config=require('../../config/environment');var db=require(_0xad3e('0xb'))['db'];config[_0xad3e('0xc')]=_[_0xad3e('0xd')](config[_0xad3e('0xc')],{'host':_0xad3e('0xe'),'port':0x18eb});var socket=require(_0xad3e('0xf'))(new Redis(config[_0xad3e('0xc')]));require(_0xad3e('0x10'))[_0xad3e('0x11')](socket);function respondWithStatusCode(_0x15fbb7,_0x10666f){_0x10666f=_0x10666f||0xcc;return function(_0x5bceef){if(_0x5bceef){return _0x15fbb7[_0xad3e('0x12')](_0x10666f);}return _0x15fbb7[_0xad3e('0x13')](_0x10666f)['end']();};}function respondWithResult(_0x5e7570,_0x564118){_0x564118=_0x564118||0xc8;return function(_0x2262ec){if(_0x2262ec){return _0x5e7570[_0xad3e('0x13')](_0x564118)[_0xad3e('0x14')](_0x2262ec);}};}function respondWithFilteredResult(_0x26ffdf,_0x265339){return function(_0x7a83d0){if(_0x7a83d0){var _0x4408d0=typeof _0x265339['offset']===_0xad3e('0x15')&&typeof _0x265339[_0xad3e('0x16')]===_0xad3e('0x15');var _0x2ff98e=_0x7a83d0[_0xad3e('0x17')];var _0x3bf160=_0x4408d0?0x0:_0x265339[_0xad3e('0x18')];var _0x1382c2=_0x4408d0?_0x7a83d0[_0xad3e('0x17')]:_0x265339[_0xad3e('0x18')]+_0x265339[_0xad3e('0x16')];var _0x3e8560;if(_0x1382c2>=_0x2ff98e){_0x1382c2=_0x2ff98e;_0x3e8560=0xc8;}else{_0x3e8560=0xce;}_0x26ffdf[_0xad3e('0x13')](_0x3e8560);return _0x26ffdf[_0xad3e('0x19')](_0xad3e('0x1a'),_0x3bf160+'-'+_0x1382c2+'/'+_0x2ff98e)[_0xad3e('0x14')](_0x7a83d0);}return null;};}function saveUpdates(_0x4961aa){return function(_0xcbf938){if(_0xcbf938){return _0xcbf938['update'](_0x4961aa)[_0xad3e('0x1b')](function(_0x306e87){return _0x306e87;});}return null;};}function removeEntity(_0x3ea8ea){return function(_0x212519){if(_0x212519){return _0x212519[_0xad3e('0x1c')]()['then'](function(){_0x3ea8ea[_0xad3e('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x588b8c){return function(_0x5b7fd4){if(!_0x5b7fd4){_0x588b8c[_0xad3e('0x12')](0x194);}return _0x5b7fd4;};}function handleError(_0x322473,_0x1aa4b2){_0x1aa4b2=_0x1aa4b2||0x1f4;return function(_0x503d8d){logger[_0xad3e('0x1d')](_0x503d8d['stack']);if(_0x503d8d[_0xad3e('0x1e')]){delete _0x503d8d[_0xad3e('0x1e')];}_0x322473['status'](_0x1aa4b2)[_0xad3e('0x1f')](_0x503d8d);};}exports[_0xad3e('0x20')]=function(_0x11c076,_0x537479){var _0x125d06={};var _0x406ad9=_['map'](db[_0xad3e('0x21')]['rawAttributes'],function(_0x5092d7){return{'name':_0x5092d7['fieldName'],'type':_0x5092d7[_0xad3e('0x22')][_0xad3e('0x23')]};});_0x125d06=qs[_0xad3e('0x24')](_0x406ad9,_0x11c076);return interaction[_0xad3e('0x25')](_0xad3e('0x26'),_0x11c076[_0xad3e('0x27')],_0x11c076[_0xad3e('0x28')],_0x125d06,_0x406ad9)[_0xad3e('0x1b')](respondWithFilteredResult(_0x537479,_0x125d06))['catch'](handleError(_0x537479,null));};exports['show']=function(_0x136b41,_0x146223){var _0x5d5f64={'raw':![],'where':{'id':_0x136b41['params']['id']}},_0x362d96={};_0x362d96[_0xad3e('0x29')]=_[_0xad3e('0x2a')](db['SmsInteraction'][_0xad3e('0x2b')]);_0x362d96[_0xad3e('0x27')]=_[_0xad3e('0x2a')](_0x136b41[_0xad3e('0x27')]);_0x362d96[_0xad3e('0x2c')]=_[_0xad3e('0x2d')](_0x362d96['model'],_0x362d96['query']);_0x5d5f64[_0xad3e('0x2e')]=_[_0xad3e('0x2d')](_0x362d96[_0xad3e('0x29')],qs['fields'](_0x136b41[_0xad3e('0x27')]['fields']));_0x5d5f64[_0xad3e('0x2e')]=_0x5d5f64[_0xad3e('0x2e')]['length']?_0x5d5f64['attributes']:_0x362d96[_0xad3e('0x29')];if(_0x136b41[_0xad3e('0x27')][_0xad3e('0x2f')]){_0x5d5f64[_0xad3e('0x30')]=[{'all':!![]}];}_0x5d5f64=_[_0xad3e('0x31')]({},_0x5d5f64,_0x136b41[_0xad3e('0x32')]);return db[_0xad3e('0x21')][_0xad3e('0x33')](_0x5d5f64)[_0xad3e('0x1b')](handleEntityNotFound(_0x146223,null))['then'](respondWithResult(_0x146223,null))[_0xad3e('0x34')](handleError(_0x146223,null));};exports[_0xad3e('0x35')]=function(_0x4a7c50,_0x49ebc9){return db[_0xad3e('0x21')][_0xad3e('0x35')](_0x4a7c50[_0xad3e('0x36')],{})[_0xad3e('0x1b')](respondWithResult(_0x49ebc9,0xc9))[_0xad3e('0x34')](handleError(_0x49ebc9,null));};exports[_0xad3e('0x37')]=function(_0x1ea0c6,_0x39d582){if(_0x1ea0c6['body']['id']){delete _0x1ea0c6[_0xad3e('0x36')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x1ea0c6[_0xad3e('0x38')]['id']}})[_0xad3e('0x1b')](handleEntityNotFound(_0x39d582,null))[_0xad3e('0x1b')](saveUpdates(_0x1ea0c6[_0xad3e('0x36')],null))[_0xad3e('0x1b')](respondWithResult(_0x39d582,null))['catch'](handleError(_0x39d582,null));};exports[_0xad3e('0x1c')]=function(_0x2f105f,_0x5ee6e0){return db[_0xad3e('0x21')][_0xad3e('0x33')]({'where':{'id':_0x2f105f[_0xad3e('0x38')]['id']}})[_0xad3e('0x1b')](handleEntityNotFound(_0x5ee6e0,null))[_0xad3e('0x1b')](removeEntity(_0x5ee6e0,null))[_0xad3e('0x34')](handleError(_0x5ee6e0,null));};exports[_0xad3e('0x39')]=function(_0x4abf94,_0x28c5a1){return db[_0xad3e('0x21')][_0xad3e('0x39')]()[_0xad3e('0x1b')](respondWithResult(_0x28c5a1,null))[_0xad3e('0x34')](handleError(_0x28c5a1,null));};exports[_0xad3e('0x3a')]=function(_0x32b570,_0xc09eff){return db[_0xad3e('0x3b')]['find']({'where':{'id':_0x32b570[_0xad3e('0x38')]['id']}})[_0xad3e('0x1b')](handleEntityNotFound(_0xc09eff,null))[_0xad3e('0x1b')](function(_0x42598c){if(_0x42598c){return _0x42598c[_0xad3e('0x3a')](_0x32b570[_0xad3e('0x36')][_0xad3e('0x3c')],_[_0xad3e('0x3d')](_0x32b570[_0xad3e('0x36')],[_0xad3e('0x3c'),'id'])||{});}})[_0xad3e('0x1b')](respondWithResult(_0xc09eff,null))[_0xad3e('0x34')](handleError(_0xc09eff,null));};exports[_0xad3e('0x3e')]=function(_0x3e7738,_0x1a1b7a){var _0x2d576e={'raw':![],'where':{}};var _0xfb0eb5={};var _0x31ea32={'count':0x0,'rows':[]};return db[_0xad3e('0x21')][_0xad3e('0x3f')]({'where':{'id':_0x3e7738[_0xad3e('0x38')]['id']}})['then'](handleEntityNotFound(_0x1a1b7a,null))[_0xad3e('0x1b')](function(_0x2e4b43){if(_0x2e4b43){_0xfb0eb5[_0xad3e('0x29')]=_[_0xad3e('0x2a')](db[_0xad3e('0x3b')][_0xad3e('0x2b')]);_0xfb0eb5['query']=_['keys'](_0x3e7738[_0xad3e('0x27')]);_0xfb0eb5['filters']=_[_0xad3e('0x2d')](_0xfb0eb5[_0xad3e('0x29')],_0xfb0eb5[_0xad3e('0x27')]);_0x2d576e[_0xad3e('0x2e')]=_[_0xad3e('0x2d')](_0xfb0eb5[_0xad3e('0x29')],qs[_0xad3e('0x40')](_0x3e7738['query'][_0xad3e('0x40')]));_0x2d576e['attributes']=_0x2d576e[_0xad3e('0x2e')]['length']?_0x2d576e['attributes']:_0xfb0eb5[_0xad3e('0x29')];if(!_0x3e7738['query'][_0xad3e('0x41')](_0xad3e('0x42'))){_0x2d576e[_0xad3e('0x16')]=qs['limit'](_0x3e7738['query']['limit']);_0x2d576e['offset']=qs[_0xad3e('0x18')](_0x3e7738['query']['offset']);}_0x2d576e[_0xad3e('0x43')]=qs['sort'](_0x3e7738[_0xad3e('0x27')]['sort']);_0x2d576e['where']=qs['filters'](_['pick'](_0x3e7738[_0xad3e('0x27')],_0xfb0eb5[_0xad3e('0x2c')]));_0x2d576e[_0xad3e('0x44')][_0xad3e('0x45')]=_0x2e4b43['id'];if(_0x3e7738[_0xad3e('0x27')]['filter']){_0x2d576e[_0xad3e('0x44')]=_[_0xad3e('0x31')](_0x2d576e[_0xad3e('0x44')],{'$or':_['map'](_0x2d576e[_0xad3e('0x2e')],function(_0x3a816e){var _0x1c88e1={};_0x1c88e1[_0x3a816e]={'$like':'%'+_0x3e7738[_0xad3e('0x27')][_0xad3e('0x46')]+'%'};return _0x1c88e1;})});}if(_0x3e7738[_0xad3e('0x27')]['$gte']){var _0x277fd6=_0x3e7738['query']['$gte'][_0xad3e('0x47')](',');var _0x3cb3f7={};_0x3cb3f7[_0x277fd6[0x0]]={'$gte':moment(_0x277fd6[0x1])[_0xad3e('0x48')](_0xad3e('0x49'))};_0x2d576e[_0xad3e('0x44')]=_[_0xad3e('0x31')](_0x2d576e[_0xad3e('0x44')],_0x3cb3f7);}_0x2d576e=_['merge']({},_0x2d576e,_0x3e7738[_0xad3e('0x32')]);return db['SmsMessage'][_0xad3e('0x17')]({'where':_0x2d576e['where']})['then'](function(_0x4965ee){_0x31ea32['count']=_0x4965ee;if(_0x3e7738[_0xad3e('0x27')][_0xad3e('0x2f')]){_0x2d576e['include']=[{'all':!![]}];}return db[_0xad3e('0x3b')]['findAll'](_0x2d576e);})[_0xad3e('0x1b')](function(_0x16132d){_0x31ea32[_0xad3e('0x4a')]=_0x16132d;return _0x31ea32;});}})[_0xad3e('0x1b')](respondWithFilteredResult(_0x1a1b7a,_0x2d576e))[_0xad3e('0x34')](handleError(_0x1a1b7a,null));};exports[_0xad3e('0x4b')]=function(_0x27d4ec,_0xf96faa){return db[_0xad3e('0x21')][_0xad3e('0x33')]({'where':{'id':_0x27d4ec[_0xad3e('0x38')]['id']}})[_0xad3e('0x1b')](handleEntityNotFound(_0xf96faa,null))['then'](function(_0x5e83c5){if(_0x5e83c5){return _0x5e83c5[_0xad3e('0x4c')](_0x27d4ec[_0xad3e('0x36')][_0xad3e('0x3c')],_[_0xad3e('0x3d')](_0x27d4ec[_0xad3e('0x36')],[_0xad3e('0x3c'),'id'])||{})[_0xad3e('0x4d')](function(){return db[_0xad3e('0x4e')][_0xad3e('0x25')]({'attributes':['id',_0xad3e('0x1e'),'color'],'where':{'id':_0x27d4ec[_0xad3e('0x36')][_0xad3e('0x3c')]}});})[_0xad3e('0x1b')](function(_0x4b2920){socket[_0xad3e('0x4f')](_0xad3e('0x50'),{'id':Number(_0x27d4ec[_0xad3e('0x38')]['id']),'tags':_0x4b2920||[]});return{'id':Number(_0x27d4ec[_0xad3e('0x38')]['id']),'tags':_0x4b2920||[]};});}})[_0xad3e('0x1b')](respondWithResult(_0xf96faa,null))[_0xad3e('0x34')](handleError(_0xf96faa,null));};exports[_0xad3e('0x51')]=function(_0x23e1bb,_0x446cb3){return db[_0xad3e('0x21')][_0xad3e('0x33')]({'where':{'id':_0x23e1bb[_0xad3e('0x38')]['id']}})[_0xad3e('0x1b')](handleEntityNotFound(_0x446cb3,null))['then'](function(_0x1952ad){if(_0x1952ad){return _0x1952ad[_0xad3e('0x51')](_0x23e1bb['query']['ids']);}})[_0xad3e('0x1b')](respondWithStatusCode(_0x446cb3,null))[_0xad3e('0x34')](handleError(_0x446cb3,null));};exports[_0xad3e('0x52')]=function(_0x283cae,_0x40d546){var _0x4b105a=moment()[_0xad3e('0x53')]()['toString']();var _0x4b9aa4=path['join'](config[_0xad3e('0x54')],_0xad3e('0x55'),_0xad3e('0x56'),_0xad3e('0x57'));var _0x2eadfa=path[_0xad3e('0x58')](_0x4b9aa4,_0x4b105a);var _0x5b451a=util[_0xad3e('0x48')]('transcript-%d-%s.zip',_0x283cae[_0xad3e('0x38')]['id'],_0x4b105a);var _0x367509=path['join'](_0x4b9aa4,_0x5b451a);var _0x54bed5=[];_0x54bed5[_0xad3e('0x59')]({'model':db[_0xad3e('0x5a')],'as':'User','attributes':['id',_0xad3e('0x5b')],'raw':!![]});_0x54bed5['push']({'model':db[_0xad3e('0x5c')],'as':_0xad3e('0x5d'),'attributes':['id',_0xad3e('0x5e'),_0xad3e('0x5f')],'raw':!![]});var _0xb1900=[{'model':db[_0xad3e('0x3b')],'as':_0xad3e('0x60'),'attributes':['id',_0xad3e('0x36'),'createdAt',_0xad3e('0x61'),_0xad3e('0x62'),_0xad3e('0x63')],'include':_0x54bed5}];_0xb1900[_0xad3e('0x59')]({'model':db[_0xad3e('0x64')],'as':'Account','attributes':['id','name']});_0xb1900['push']({'model':db[_0xad3e('0x5a')],'as':_0xad3e('0x65'),'attributes':['id',_0xad3e('0x5b')]});return db[_0xad3e('0x21')][_0xad3e('0x33')]({'where':{'id':_0x283cae[_0xad3e('0x38')]['id']},'include':_0xb1900})[_0xad3e('0x1b')](handleEntityNotFound(_0x40d546,null))[_0xad3e('0x1b')](function(_0x5ee880){if(_0x5ee880){var _0x24dc6a=_0x5ee880[_0xad3e('0x66')]({'plain':!![]});fs['mkdirSync'](_0x2eadfa);var _0x153ccb={'channel':_0xad3e('0x67'),'account':_0x24dc6a[_0xad3e('0x68')]['name'],'agent':_0x24dc6a[_0xad3e('0x65')]?_0x24dc6a[_0xad3e('0x65')]['fullname']:'N.A.','createdAt':moment(_0x24dc6a[_0xad3e('0x69')])[_0xad3e('0x48')](_0xad3e('0x49'))['toString'](),'closedAt':_0x24dc6a[_0xad3e('0x6a')]?moment(_0x24dc6a[_0xad3e('0x6b')])[_0xad3e('0x48')](_0xad3e('0x49'))[_0xad3e('0x6c')]():'','disposition':_0x24dc6a['disposition'],'messages':_(_0x24dc6a[_0xad3e('0x60')])[_0xad3e('0x46')]({'secret':![]})[_0xad3e('0x6d')](function(_0x1d0be4){return{'date':moment(_0x1d0be4[_0xad3e('0x69')])['format'](_0xad3e('0x49'))[_0xad3e('0x6c')](),'sender':_0x1d0be4['direction']==='out'?_0x1d0be4['User']?_0x1d0be4['User'][_0xad3e('0x5b')]:_0xad3e('0x6e'):_0x1d0be4['Contact'][_0xad3e('0x5e')]+(_0x1d0be4[_0xad3e('0x5d')]['lastName']?'\x20'+_0x1d0be4[_0xad3e('0x5d')][_0xad3e('0x5f')]:''),'body':_0x1d0be4[_0xad3e('0x36')],'direction':_0x1d0be4[_0xad3e('0x61')]===_0xad3e('0x6f')?'A':'C','secret':_0x1d0be4[_0xad3e('0x62')],'read':_0x1d0be4[_0xad3e('0x63')]};})[_0xad3e('0x70')]()};return ejs['renderFile'](path['join'](config[_0xad3e('0x54')],_0xad3e('0x55'),_0xad3e('0x71'),_0xad3e('0x72')),{'interaction':_0x153ccb})['then'](function(_0x191c7d){var _0x208fb1=path['join'](_0x2eadfa,_0xad3e('0x73')+_0x24dc6a['id']+'-'+_0x4b105a+_0xad3e('0x74'));var _0x2ef285={'path':_0x208fb1,'channel':_0xad3e('0x67'),'interactionId':_0x24dc6a['id']};return pdf[_0xad3e('0x75')](_0x191c7d,_0x2ef285);})[_0xad3e('0x1b')](function(){return new BPromise(function(_0x542546,_0x3f8e54){zipdir(_0x2eadfa,{'saveTo':_0x367509},function(_0x18e6d5,_0x2e8e6c){if(_0x18e6d5)return _0x3f8e54(_0x18e6d5);return _0x542546(_0x2e8e6c);});})['then'](function(){return new BPromise(function(_0x5554f5,_0x505a38){rimraf(_0x2eadfa,function(_0x23b188){if(_0x23b188)_0x505a38(_0x23b188);return _0x5554f5();});});})[_0xad3e('0x1b')](function(){return _0x40d546[_0xad3e('0x52')](_0x367509,_0x5b451a,function(_0x152d6c){if(_0x152d6c){console[_0xad3e('0x76')]('err',_0x152d6c);}else{fs['unlinkSync'](_0x367509);}});});});}else{return _0x40d546[_0xad3e('0x12')](0xc8);}})['catch'](handleError(_0x40d546,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 3cf43be..d6b2642 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02ce=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x22209f,_0x13bf3d){var _0x57a462=function(_0x5bb2a4){while(--_0x5bb2a4){_0x22209f['push'](_0x22209f['shift']());}};_0x57a462(++_0x13bf3d);}(_0x02ce,0x1ac));var _0xe02c=function(_0x234b6b,_0x280a78){_0x234b6b=_0x234b6b-0x0;var _0x33d38a=_0x02ce[_0x234b6b];return _0x33d38a;};'use strict';var EventEmitter=require(_0xe02c('0x0'));var SmsInteraction=require(_0xe02c('0x1'))['db'][_0xe02c('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xe02c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe02c('0x4'),'afterUpdate':_0xe02c('0x5'),'afterDestroy':_0xe02c('0x6')};function emitEvent(_0xf4b764){return function(_0x41b41c,_0x229653,_0x3f7436){_0x41b41c[_0xe02c('0x7')]({'attributes':['id'],'raw':!![]})[_0xe02c('0x8')](function(_0x4fecb3){_0x41b41c['setDataValue'](_0xe02c('0x9'),_0x4fecb3[_0xe02c('0xa')](function(_0x469932){return{'id':_0x469932['id']};}));return SmsMessage[_0xe02c('0xb')]({'where':{'SmsInteractionId':_0x41b41c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe02c('0x8')](function(_0x18a398){_0x41b41c[_0xe02c('0xc')](_0xe02c('0xd'),_0x18a398[_0xe02c('0xe')]);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764+':'+_0x41b41c['id'],_0x41b41c);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764,_0x41b41c);_0x3f7436(null);})[_0xe02c('0x10')](_0x3f7436(null));};}for(var e in events){if(events[_0xe02c('0x11')](e)){var event=events[e];SmsInteraction[_0xe02c('0x12')](e,emitEvent(event));}}module[_0xe02c('0x13')]=SmsInteractionEvents; \ No newline at end of file +var _0x5c3c=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0x54991e,_0x231c1a){var _0x2c7540=function(_0x5cf6a5){while(--_0x5cf6a5){_0x54991e['push'](_0x54991e['shift']());}};_0x2c7540(++_0x231c1a);}(_0x5c3c,0x132));var _0xc5c3=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x5c3c[_0x487b0c];return _0x1adbdc;};'use strict';var EventEmitter=require(_0xc5c3('0x0'));var SmsInteraction=require(_0xc5c3('0x1'))['db'][_0xc5c3('0x2')];var SmsMessage=require(_0xc5c3('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5c3('0x3')](0x0);var events={'afterCreate':_0xc5c3('0x4'),'afterUpdate':_0xc5c3('0x5'),'afterDestroy':_0xc5c3('0x6')};function emitEvent(_0x2535e0){return function(_0x36525d,_0xe85098,_0x23a6b5){_0x36525d[_0xc5c3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b8404){_0x36525d['setDataValue'](_0xc5c3('0x8'),_0x4b8404[_0xc5c3('0x9')](function(_0x593b35){return{'id':_0x593b35['id']};}));return SmsMessage[_0xc5c3('0xa')]({'where':{'SmsInteractionId':_0x36525d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5c3('0xb')](function(_0x52f3eb){_0x36525d[_0xc5c3('0xc')](_0xc5c3('0xd'),_0x52f3eb['length']);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0+':'+_0x36525d['id'],_0x36525d);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0,_0x36525d);_0x23a6b5(null);})[_0xc5c3('0xf')](_0x23a6b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc5c3('0x10')](e,emitEvent(event));}}module[_0xc5c3('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index e0c368d..bd04c81 100644 --- a/server/api/smsInteraction/smsInteraction.model.js +++ b/server/api/smsInteraction/smsInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x585a=['path','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4bfab7,_0x1f92fc){var _0x232fd7=function(_0x2fb73c){while(--_0x2fb73c){_0x4bfab7['push'](_0x4bfab7['shift']());}};_0x232fd7(++_0x1f92fc);}(_0x585a,0xaa));var _0xa585=function(_0x4b0008,_0x41218b){_0x4b0008=_0x4b0008-0x0;var _0x401c96=_0x585a[_0x4b0008];return _0x401c96;};'use strict';var _=require(_0xa585('0x0'));var util=require(_0xa585('0x1'));var logger=require('../../config/logger')(_0xa585('0x2'));var moment=require(_0xa585('0x3'));var BPromise=require(_0xa585('0x4'));var rp=require(_0xa585('0x5'));var fs=require('fs');var path=require(_0xa585('0x6'));var rimraf=require('rimraf');var config=require(_0xa585('0x7'));var attributes=require(_0xa585('0x8'));module[_0xa585('0x9')]=function(_0x57d102,_0x598b0b){return _0x57d102['define'](_0xa585('0xa'),attributes,{'tableName':_0xa585('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d748f,_0x2f1bbf,_0x3b1bbc){if(_0x2d748f[_0xa585('0xc')](_0xa585('0xd'))){_0x2d748f[_0xa585('0xe')]=moment()['format'](_0xa585('0xf'));}_0x3b1bbc(null,_0x2d748f);}}});}; \ No newline at end of file +var _0xa25f=['sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path','rimraf','exports','define','SmsInteraction'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0xa25f,0x186));var _0xfa25=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa25f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfa25('0x0'));var util=require(_0xfa25('0x1'));var logger=require('../../config/logger')(_0xfa25('0x2'));var moment=require(_0xfa25('0x3'));var BPromise=require(_0xfa25('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa25('0x5'));var rimraf=require(_0xfa25('0x6'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xfa25('0x7')]=function(_0x38c229,_0x347e1a){return _0x38c229[_0xfa25('0x8')](_0xfa25('0x9'),attributes,{'tableName':_0xfa25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9a1cf4,_0x284c26,_0x5e562a){if(_0x9a1cf4[_0xfa25('0xb')](_0xfa25('0xc'))){_0x9a1cf4[_0xfa25('0xd')]=moment()[_0xfa25('0xe')](_0xfa25('0xf'));}_0x5e562a(null,_0x9a1cf4);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 7007227..15f6122 100644 --- a/server/api/smsInteraction/smsInteraction.rpc.js +++ b/server/api/smsInteraction/smsInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x258b=['catch','AddTagsToSmsInteraction','SmsInteraction','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateSmsInteraction','update','body','options','raw','attributes'];(function(_0x57379d,_0xcceb5f){var _0x285c1c=function(_0x450f37){while(--_0x450f37){_0x57379d['push'](_0x57379d['shift']());}};_0x285c1c(++_0xcceb5f);}(_0x258b,0x1f3));var _0xb258=function(_0x13db3b,_0x1b212c){_0x13db3b=_0x13db3b-0x0;var _0xaf724e=_0x258b[_0x13db3b];return _0xaf724e;};'use strict';var _=require(_0xb258('0x0'));var util=require(_0xb258('0x1'));var moment=require(_0xb258('0x2'));var BPromise=require('bluebird');var rs=require(_0xb258('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb258('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb258('0x5'))(_0xb258('0x6'));var config=require(_0xb258('0x7'));var jayson=require(_0xb258('0x8'));var client=jayson[_0xb258('0x9')]['http']({'port':0x232a});config[_0xb258('0xa')]=_[_0xb258('0xb')](config[_0xb258('0xa')],{'host':_0xb258('0xc'),'port':0x18eb});var socket=require(_0xb258('0xd'))(new Redis(config[_0xb258('0xa')]));require(_0xb258('0xe'))[_0xb258('0xf')](socket);function respondWithRpcPromise(_0x18e46d,_0x4960e5,_0x37d768){return new BPromise(function(_0x84532f,_0x298c09){return client[_0xb258('0x10')](_0x18e46d,_0x37d768)[_0xb258('0x11')](function(_0x1f0624){logger[_0xb258('0x12')](_0xb258('0x13'),_0x4960e5,_0xb258('0x14'));logger[_0xb258('0x15')](_0xb258('0x16'),_0x4960e5,_0xb258('0x14'),JSON[_0xb258('0x17')](_0x1f0624));if(_0x1f0624['error']){if(_0x1f0624[_0xb258('0x18')][_0xb258('0x19')]===0x1f4){logger[_0xb258('0x18')](_0xb258('0x13'),_0x4960e5,_0x1f0624[_0xb258('0x18')]['message']);return _0x298c09(_0x1f0624[_0xb258('0x18')][_0xb258('0x1a')]);}logger[_0xb258('0x18')](_0xb258('0x13'),_0x4960e5,_0x1f0624[_0xb258('0x18')][_0xb258('0x1a')]);return _0x84532f(_0x1f0624[_0xb258('0x18')][_0xb258('0x1a')]);}else{logger[_0xb258('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x4960e5,_0xb258('0x14'));_0x84532f(_0x1f0624[_0xb258('0x1b')][_0xb258('0x1a')]);}})['catch'](function(_0x16f81b){logger[_0xb258('0x18')](_0xb258('0x13'),_0x4960e5,_0x16f81b);_0x298c09(_0x16f81b);});});}exports[_0xb258('0x1c')]=function(_0x368d56){var _0x122621=this;return new Promise(function(_0xb91381,_0x13f08e){return db['SmsInteraction'][_0xb258('0x1d')](_0x368d56[_0xb258('0x1e')],{'raw':_0x368d56[_0xb258('0x1f')]?_0x368d56[_0xb258('0x1f')][_0xb258('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x368d56['options']?_0x368d56[_0xb258('0x1f')]['where']||null:null,'attributes':_0x368d56[_0xb258('0x1f')]?_0x368d56[_0xb258('0x1f')][_0xb258('0x21')]||null:null,'limit':_0x368d56['options']?_0x368d56[_0xb258('0x1f')]['limit']||null:null})['then'](function(_0x4c97d5){logger[_0xb258('0x12')](_0xb258('0x1c'),_0x368d56);logger['debug'](_0xb258('0x1c'),_0x368d56,JSON['stringify'](_0x4c97d5));_0xb91381(_0x4c97d5);})[_0xb258('0x22')](function(_0x78c094){logger['error']('UpdateSmsInteraction',_0x78c094[_0xb258('0x1a')],_0x368d56);_0x13f08e(_0x122621[_0xb258('0x18')](0x1f4,_0x78c094['message']));});});};exports[_0xb258('0x23')]=function(_0x534e02){return new Promise(function(_0x3938a7,_0x2fd30a){return db[_0xb258('0x24')]['find']({'where':_0x534e02[_0xb258('0x1f')]?_0x534e02[_0xb258('0x1f')]['where']||null:null})[_0xb258('0x11')](function(_0x33fca8){if(_0x33fca8){return _0x33fca8[_0xb258('0x25')](_0x534e02[_0xb258('0x1e')][_0xb258('0x26')],_[_0xb258('0x27')](_0x534e02[_0xb258('0x1e')],[_0xb258('0x26'),'id'])||{});}})['spread'](function(_0x3b2e3f){logger['info'](_0xb258('0x28'),_0x534e02);logger[_0xb258('0x15')](_0xb258('0x28'),_0x534e02,JSON[_0xb258('0x17')](_0x3b2e3f));_0x3938a7(_0x3b2e3f);})[_0xb258('0x22')](function(_0x249954){logger[_0xb258('0x18')](_0xb258('0x28'),_0x249954[_0xb258('0x1a')],_0x534e02);_0x2fd30a(_this[_0xb258('0x18')](0x1f4,_0x249954[_0xb258('0x1a')]));});});}; \ No newline at end of file +var _0x2977=['message','request\x20sent','result','catch','UpdateSmsInteraction','SmsInteraction','body','raw','where','options','attributes','limit','AddTagsToSmsInteraction','addTags','ids','omit','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','then','info','stringify','error','code','SmsInteraction,\x20%s,\x20%s'];(function(_0x5deb35,_0x2c8188){var _0x1ecefc=function(_0x58333e){while(--_0x58333e){_0x5deb35['push'](_0x5deb35['shift']());}};_0x1ecefc(++_0x2c8188);}(_0x2977,0x1ac));var _0x7297=function(_0x3b2345,_0x2e9d7b){_0x3b2345=_0x3b2345-0x0;var _0x13970e=_0x2977[_0x3b2345];return _0x13970e;};'use strict';var _=require(_0x7297('0x0'));var util=require(_0x7297('0x1'));var moment=require(_0x7297('0x2'));var BPromise=require(_0x7297('0x3'));var rs=require(_0x7297('0x4'));var fs=require('fs');var Redis=require(_0x7297('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7297('0x6'));var logger=require(_0x7297('0x7'))(_0x7297('0x8'));var config=require(_0x7297('0x9'));var jayson=require(_0x7297('0xa'));var client=jayson[_0x7297('0xb')]['http']({'port':0x232a});config[_0x7297('0xc')]=_[_0x7297('0xd')](config[_0x7297('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7297('0xe'))(new Redis(config[_0x7297('0xc')]));require(_0x7297('0xf'))[_0x7297('0x10')](socket);function respondWithRpcPromise(_0x8421f1,_0x1724b8,_0x55ea67){return new BPromise(function(_0x5be4bf,_0x27dc40){return client['request'](_0x8421f1,_0x55ea67)[_0x7297('0x11')](function(_0x5d2ad4){logger[_0x7297('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x1724b8,'request\x20sent');logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x1724b8,'request\x20sent',JSON[_0x7297('0x13')](_0x5d2ad4));if(_0x5d2ad4[_0x7297('0x14')]){if(_0x5d2ad4[_0x7297('0x14')][_0x7297('0x15')]===0x1f4){logger[_0x7297('0x14')](_0x7297('0x16'),_0x1724b8,_0x5d2ad4[_0x7297('0x14')][_0x7297('0x17')]);return _0x27dc40(_0x5d2ad4[_0x7297('0x14')][_0x7297('0x17')]);}logger[_0x7297('0x14')](_0x7297('0x16'),_0x1724b8,_0x5d2ad4[_0x7297('0x14')]['message']);return _0x5be4bf(_0x5d2ad4[_0x7297('0x14')]['message']);}else{logger[_0x7297('0x12')](_0x7297('0x16'),_0x1724b8,_0x7297('0x18'));_0x5be4bf(_0x5d2ad4[_0x7297('0x19')][_0x7297('0x17')]);}})[_0x7297('0x1a')](function(_0x12088b){logger[_0x7297('0x14')](_0x7297('0x16'),_0x1724b8,_0x12088b);_0x27dc40(_0x12088b);});});}exports[_0x7297('0x1b')]=function(_0x51f08b){var _0x2a12fd=this;return new Promise(function(_0x533c27,_0x27a8ac){return db[_0x7297('0x1c')]['update'](_0x51f08b[_0x7297('0x1d')],{'raw':_0x51f08b['options']?_0x51f08b['options'][_0x7297('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51f08b['options']?_0x51f08b['options'][_0x7297('0x1f')]||null:null,'attributes':_0x51f08b[_0x7297('0x20')]?_0x51f08b[_0x7297('0x20')][_0x7297('0x21')]||null:null,'limit':_0x51f08b[_0x7297('0x20')]?_0x51f08b[_0x7297('0x20')][_0x7297('0x22')]||null:null})[_0x7297('0x11')](function(_0xd898bf){logger['info'](_0x7297('0x1b'),_0x51f08b);logger['debug'](_0x7297('0x1b'),_0x51f08b,JSON[_0x7297('0x13')](_0xd898bf));_0x533c27(_0xd898bf);})[_0x7297('0x1a')](function(_0x176925){logger[_0x7297('0x14')]('UpdateSmsInteraction',_0x176925[_0x7297('0x17')],_0x51f08b);_0x27a8ac(_0x2a12fd['error'](0x1f4,_0x176925['message']));});});};exports[_0x7297('0x23')]=function(_0x4beb7c){return new Promise(function(_0x5cb66a,_0x5bb9d4){return db[_0x7297('0x1c')]['find']({'where':_0x4beb7c[_0x7297('0x20')]?_0x4beb7c[_0x7297('0x20')][_0x7297('0x1f')]||null:null})[_0x7297('0x11')](function(_0x1e1b42){if(_0x1e1b42){return _0x1e1b42[_0x7297('0x24')](_0x4beb7c['body'][_0x7297('0x25')],_[_0x7297('0x26')](_0x4beb7c[_0x7297('0x1d')],[_0x7297('0x25'),'id'])||{});}})['spread'](function(_0x4ed323){logger['info'](_0x7297('0x27'),_0x4beb7c);logger[_0x7297('0x28')](_0x7297('0x27'),_0x4beb7c,JSON['stringify'](_0x4ed323));_0x5cb66a(_0x4ed323);})[_0x7297('0x1a')](function(_0x526b26){logger['error'](_0x7297('0x27'),_0x526b26[_0x7297('0x17')],_0x4beb7c);_0x5bb9d4(_this['error'](0x1f4,_0x526b26[_0x7297('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 1e13e39..70d49b1 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1690=['smsInteraction:','./smsInteraction.events','remove','update','removeListener','register'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x1690,0x193));var _0x0169=function(_0x4bfda9,_0x446ba2){_0x4bfda9=_0x4bfda9-0x0;var _0x213edc=_0x1690[_0x4bfda9];return _0x213edc;};'use strict';var SmsInteractionEvents=require(_0x0169('0x0'));var events=['save',_0x0169('0x1'),_0x0169('0x2')];function createListener(_0x59a89f,_0x5ac648){return function(_0x476869){_0x5ac648['emit'](_0x59a89f,_0x476869);};}function removeListener(_0x2aff92,_0x31d415){return function(){SmsInteractionEvents[_0x0169('0x3')](_0x2aff92,_0x31d415);};}exports[_0x0169('0x4')]=function(_0x33ef23){for(var _0x5be0c2=0x0,_0x47e799=events['length'];_0x5be0c2<_0x47e799;_0x5be0c2++){var _0x2ed3c3=events[_0x5be0c2];var _0x2a0918=createListener(_0x0169('0x5')+_0x2ed3c3,_0x33ef23);SmsInteractionEvents['on'](_0x2ed3c3,_0x2a0918);}}; \ No newline at end of file +var _0x221f=['update','emit','removeListener','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x393316,_0x2755eb){var _0x1facbd=function(_0x1e27ac){while(--_0x1e27ac){_0x393316['push'](_0x393316['shift']());}};_0x1facbd(++_0x2755eb);}(_0x221f,0x1da));var _0xf221=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x221f[_0x254b22];return _0x1279db;};'use strict';var SmsInteractionEvents=require(_0xf221('0x0'));var events=[_0xf221('0x1'),'remove',_0xf221('0x2')];function createListener(_0x3854fe,_0x199606){return function(_0x3cf1b2){_0x199606[_0xf221('0x3')](_0x3854fe,_0x3cf1b2);};}function removeListener(_0x45fb9c,_0xf31c8a){return function(){SmsInteractionEvents[_0xf221('0x4')](_0x45fb9c,_0xf31c8a);};}exports['register']=function(_0xab116f){for(var _0x261679=0x0,_0x2a1663=events[_0xf221('0x5')];_0x261679<_0x2a1663;_0x261679++){var _0x57bf28=events[_0x261679];var _0x4c207e=createListener(_0xf221('0x6')+_0x57bf28,_0xab116f);SmsInteractionEvents['on'](_0x57bf28,_0x4c207e);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 2653d77..0068876 100644 --- a/server/api/smsMessage/index.js +++ b/server/api/smsMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc5e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','post','tracked','sms','create','/:id/status','update','put','/:id/accept','accept','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x207e23,_0x17740f){var _0x58aa8a=function(_0x397193){while(--_0x397193){_0x207e23['push'](_0x207e23['shift']());}};_0x58aa8a(++_0x17740f);}(_0xbc5e,0x7d));var _0xebc5=function(_0x3b65c1,_0x280d3a){_0x3b65c1=_0x3b65c1-0x0;var _0xaddd51=_0xbc5e[_0x3b65c1];return _0xaddd51;};'use strict';var multer=require(_0xebc5('0x0'));var util=require(_0xebc5('0x1'));var path=require(_0xebc5('0x2'));var timeout=require(_0xebc5('0x3'));var express=require(_0xebc5('0x4'));var router=express[_0xebc5('0x5')]();var fs_extra=require(_0xebc5('0x6'));var auth=require(_0xebc5('0x7'));var interaction=require(_0xebc5('0x8'));var config=require('../../config/environment');var controller=require(_0xebc5('0x9'));router[_0xebc5('0xa')]('/',auth[_0xebc5('0xb')](),controller[_0xebc5('0xc')]);router[_0xebc5('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xebc5('0xd')]);router[_0xebc5('0xa')](_0xebc5('0xe'),auth[_0xebc5('0xb')](),controller['show']);router[_0xebc5('0xf')]('/',auth['isAuthenticated'](),interaction[_0xebc5('0x10')](_0xebc5('0x11'),'smsmessage:create'),controller[_0xebc5('0x12')]);router[_0xebc5('0xf')](_0xebc5('0x13'),controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xebc5('0x14')]);router[_0xebc5('0x15')](_0xebc5('0x16'),auth[_0xebc5('0xb')](),controller[_0xebc5('0x17')]);router[_0xebc5('0x15')]('/:id/reject',auth[_0xebc5('0xb')](),controller['reject']);router[_0xebc5('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xebc5('0x19')]);module['exports']=router; \ No newline at end of file +var _0xafb1=['tracked','sms','smsmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','connect-timeout','Router','../../config/environment','./smsMessage.controller','index','get','/describe','isAuthenticated','/:id','show','post'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0xafb1,0x19c));var _0x1afb=function(_0x56aa66,_0x1ddf52){_0x56aa66=_0x56aa66-0x0;var _0xeba9ff=_0xafb1[_0x56aa66];return _0xeba9ff;};'use strict';var multer=require(_0x1afb('0x0'));var util=require(_0x1afb('0x1'));var path=require('path');var timeout=require(_0x1afb('0x2'));var express=require('express');var router=express[_0x1afb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1afb('0x4'));var controller=require(_0x1afb('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x1afb('0x6')]);router[_0x1afb('0x7')](_0x1afb('0x8'),auth[_0x1afb('0x9')](),controller['describe']);router[_0x1afb('0x7')](_0x1afb('0xa'),auth['isAuthenticated'](),controller[_0x1afb('0xb')]);router[_0x1afb('0xc')]('/',auth[_0x1afb('0x9')](),interaction[_0x1afb('0xd')](_0x1afb('0xe'),_0x1afb('0xf')),controller[_0x1afb('0x10')]);router['post'](_0x1afb('0x11'),controller['status']);router[_0x1afb('0x12')](_0x1afb('0xa'),auth['isAuthenticated'](),controller[_0x1afb('0x13')]);router[_0x1afb('0x12')](_0x1afb('0x14'),auth[_0x1afb('0x9')](),controller[_0x1afb('0x15')]);router[_0x1afb('0x12')](_0x1afb('0x16'),auth['isAuthenticated'](),controller[_0x1afb('0x17')]);router[_0x1afb('0x18')](_0x1afb('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d8db8c4..db93b8e 100644 --- a/server/api/smsMessage/smsMessage.attributes.js +++ b/server/api/smsMessage/smsMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c77=['DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x14495c,_0x3f8b3a){var _0x31beb9=function(_0x37f725){while(--_0x37f725){_0x14495c['push'](_0x14495c['shift']());}};_0x31beb9(++_0x3f8b3a);}(_0x8c77,0x1d6));var _0x78c7=function(_0x3639c5,_0x204b0d){_0x3639c5=_0x3639c5-0x0;var _0x5f06ca=_0x8c77[_0x3639c5];return _0x5f06ca;};'use strict';var Sequelize=require(_0x78c7('0x0'));module[_0x78c7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x78c7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x78c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x78c7('0x4')]('in',_0x78c7('0x5')),'defaultValue':_0x78c7('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x78c7('0x6')](0xbe)},'phone':{'type':Sequelize[_0x78c7('0x6')]},'readAt':{'type':Sequelize[_0x78c7('0x7')]},'secret':{'type':Sequelize[_0x78c7('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x78c7('0x8')]}}; \ No newline at end of file +var _0xc387=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x46bc65,_0x4278c6){var _0xf97e91=function(_0x145e57){while(--_0x145e57){_0x46bc65['push'](_0x46bc65['shift']());}};_0xf97e91(++_0x4278c6);}(_0xc387,0x168));var _0x7c38=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc387[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7c38('0x0'));module[_0x7c38('0x1')]={'body':{'type':Sequelize[_0x7c38('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7c38('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7c38('0x4')]('in',_0x7c38('0x5')),'defaultValue':_0x7c38('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x7c38('0x6')]},'secret':{'type':Sequelize[_0x7c38('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7c38('0x7')]},'providerResponse':{'type':Sequelize[_0x7c38('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index f369fee..3b2a711 100644 --- a/server/api/smsMessage/smsMessage.controller.js +++ b/server/api/smsMessage/smsMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a2d=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','destroy','stack','name','fieldName','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','SmsMessage','count','includeAll','include','findAll','rows','show','rawAttributes','filters','options','find','create','body','update','params','describe','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x46f9cd,_0x4337c4){var _0x30a5f9=function(_0x580dbf){while(--_0x580dbf){_0x46f9cd['push'](_0x46f9cd['shift']());}};_0x30a5f9(++_0x4337c4);}(_0x9a2d,0x123));var _0xd9a2=function(_0x5926d9,_0x1e007e){_0x5926d9=_0x5926d9-0x0;var _0xc64b9f=_0x9a2d[_0x5926d9];return _0xc64b9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd9a2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9a2('0x1'));var moment=require(_0xd9a2('0x2'));var BPromise=require(_0xd9a2('0x3'));var Mustache=require(_0xd9a2('0x4'));var util=require(_0xd9a2('0x5'));var path=require(_0xd9a2('0x6'));var sox=require(_0xd9a2('0x7'));var csv=require(_0xd9a2('0x8'));var ejs=require(_0xd9a2('0x9'));var fs=require('fs');var fs_extra=require(_0xd9a2('0xa'));var _=require(_0xd9a2('0xb'));var squel=require(_0xd9a2('0xc'));var crypto=require(_0xd9a2('0xd'));var jsforce=require(_0xd9a2('0xe'));var deskjs=require(_0xd9a2('0xf'));var toCsv=require(_0xd9a2('0x8'));var querystring=require(_0xd9a2('0x10'));var Papa=require(_0xd9a2('0x11'));var Redis=require(_0xd9a2('0x12'));var authService=require(_0xd9a2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9a2('0x14'));var logger=require('../../config/logger')(_0xd9a2('0x15'));var utils=require('../../config/utils');var config=require(_0xd9a2('0x16'));var licenseUtil=require(_0xd9a2('0x17'));var db=require(_0xd9a2('0x18'))['db'];config[_0xd9a2('0x19')]=_['defaults'](config[_0xd9a2('0x19')],{'host':_0xd9a2('0x1a'),'port':0x18eb});var socket=require(_0xd9a2('0x1b'))(new Redis(config['redis']));require(_0xd9a2('0x1c'))['register'](socket);var jayson=require(_0xd9a2('0x1d'));var client=jayson['client'][_0xd9a2('0x1e')]({'port':0x232c});var client9002=jayson[_0xd9a2('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xee6ea8,_0x1447e6,_0x4a8d26,_0x36764b){return new BPromise(function(_0x53f6fb,_0x34ee99){var _0x5185d0=_0x36764b||client;return _0x5185d0[_0xd9a2('0x20')](_0xee6ea8,_0x4a8d26)[_0xd9a2('0x21')](function(_0x53dace){logger[_0xd9a2('0x22')](_0xd9a2('0x23'),_0x1447e6,_0xd9a2('0x24'));logger[_0xd9a2('0x25')](_0xd9a2('0x26'),_0x1447e6,_0xd9a2('0x24'),JSON[_0xd9a2('0x27')](_0x53dace));if(_0x53dace['error']){if(_0x53dace['error'][_0xd9a2('0x28')]===0x1f4){logger[_0xd9a2('0x29')]('SmsMessage,\x20%s,\x20%s',_0x1447e6,_0x53dace[_0xd9a2('0x29')][_0xd9a2('0x2a')]);return _0x34ee99(_0x53dace['error'][_0xd9a2('0x2a')]);}logger[_0xd9a2('0x29')](_0xd9a2('0x23'),_0x1447e6,_0x53dace[_0xd9a2('0x29')][_0xd9a2('0x2a')]);return _0x53f6fb(_0x53dace[_0xd9a2('0x29')][_0xd9a2('0x2a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1447e6,_0xd9a2('0x24'));_0x53f6fb(_0x53dace[_0xd9a2('0x2b')][_0xd9a2('0x2a')]);}})[_0xd9a2('0x2c')](function(_0x492320){logger[_0xd9a2('0x29')]('SmsMessage,\x20%s,\x20%s',_0x1447e6,_0x492320);_0x34ee99(_0x492320);});});}function respondWithStatusCode(_0x3ee7fe,_0x2093ea){_0x2093ea=_0x2093ea||0xcc;return function(_0x5ea1fc){if(_0x5ea1fc){return _0x3ee7fe[_0xd9a2('0x2d')](_0x2093ea);}return _0x3ee7fe[_0xd9a2('0x2e')](_0x2093ea)[_0xd9a2('0x2f')]();};}function respondWithResult(_0x4c89d8,_0x308dde){_0x308dde=_0x308dde||0xc8;return function(_0x392d24){if(_0x392d24){return _0x4c89d8[_0xd9a2('0x2e')](_0x308dde)[_0xd9a2('0x30')](_0x392d24);}};}function respondWithFilteredResult(_0x53723f,_0x1c8557){return function(_0x5a6f29){if(_0x5a6f29){var _0xc422b0=typeof _0x1c8557['offset']===_0xd9a2('0x31')&&typeof _0x1c8557[_0xd9a2('0x32')]===_0xd9a2('0x31');var _0x1c07b9=_0x5a6f29['count'];var _0x41aca0=_0xc422b0?0x0:_0x1c8557[_0xd9a2('0x33')];var _0x3e6e47=_0xc422b0?_0x5a6f29['count']:_0x1c8557[_0xd9a2('0x33')]+_0x1c8557['limit'];var _0x592ff3;if(_0x3e6e47>=_0x1c07b9){_0x3e6e47=_0x1c07b9;_0x592ff3=0xc8;}else{_0x592ff3=0xce;}_0x53723f['status'](_0x592ff3);return _0x53723f['set'](_0xd9a2('0x34'),_0x41aca0+'-'+_0x3e6e47+'/'+_0x1c07b9)['json'](_0x5a6f29);}return null;};}function patchUpdates(_0x55973c){return function(_0x2885ad){try{jsonpatch[_0xd9a2('0x35')](_0x2885ad,_0x55973c,!![]);}catch(_0xeddcd){return BPromise[_0xd9a2('0x36')](_0xeddcd);}return _0x2885ad['save']();};}function saveUpdates(_0x53bbfc,_0x47ecf2){return function(_0x3ee4c3){if(_0x3ee4c3){return _0x3ee4c3['update'](_0x53bbfc)[_0xd9a2('0x21')](function(_0x475236){return _0x475236;});}return null;};}function removeEntity(_0x33ed44,_0x28de27){return function(_0x322303){if(_0x322303){return _0x322303[_0xd9a2('0x37')]()['then'](function(){_0x33ed44[_0xd9a2('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2e455,_0x5bbeef){return function(_0x2db13d){if(!_0x2db13d){_0xd2e455[_0xd9a2('0x2d')](0x194);}return _0x2db13d;};}function handleError(_0x3c7bb1,_0x41e47f){_0x41e47f=_0x41e47f||0x1f4;return function(_0x535c8f){logger[_0xd9a2('0x29')](_0x535c8f[_0xd9a2('0x38')]);if(_0x535c8f[_0xd9a2('0x39')]){delete _0x535c8f[_0xd9a2('0x39')];}_0x3c7bb1[_0xd9a2('0x2e')](_0x41e47f)['send'](_0x535c8f);};}exports['index']=function(_0xff9e89,_0x147ad8){var _0x3c6a68={},_0x291766={},_0x110064={'count':0x0,'rows':[]};var _0x3228df=_['map'](db['SmsMessage']['rawAttributes'],function(_0x3dae16){return{'name':_0x3dae16[_0xd9a2('0x3a')],'type':_0x3dae16['type'][_0xd9a2('0x3b')]};});_0x291766[_0xd9a2('0x3c')]=_[_0xd9a2('0x3d')](_0x3228df,'name');_0x291766[_0xd9a2('0x3e')]=_['keys'](_0xff9e89[_0xd9a2('0x3e')]);_0x291766['filters']=_['intersection'](_0x291766[_0xd9a2('0x3c')],_0x291766[_0xd9a2('0x3e')]);_0x3c6a68[_0xd9a2('0x3f')]=_[_0xd9a2('0x40')](_0x291766[_0xd9a2('0x3c')],qs[_0xd9a2('0x41')](_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x41')]));_0x3c6a68[_0xd9a2('0x3f')]=_0x3c6a68[_0xd9a2('0x3f')][_0xd9a2('0x42')]?_0x3c6a68['attributes']:_0x291766[_0xd9a2('0x3c')];if(!_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x43')](_0xd9a2('0x44'))){_0x3c6a68['limit']=qs[_0xd9a2('0x32')](_0xff9e89[_0xd9a2('0x3e')]['limit']);_0x3c6a68['offset']=qs[_0xd9a2('0x33')](_0xff9e89['query']['offset']);}_0x3c6a68[_0xd9a2('0x45')]=qs[_0xd9a2('0x46')](_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x46')]);_0x3c6a68[_0xd9a2('0x47')]=qs['filters'](_['pick'](_0xff9e89[_0xd9a2('0x3e')],_0x291766['filters']),_0x3228df);if(_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x48')]){_0x3c6a68[_0xd9a2('0x47')]=_[_0xd9a2('0x49')](_0x3c6a68[_0xd9a2('0x47')],{'$or':_[_0xd9a2('0x3d')](_0x3228df,function(_0x2e0dce){if(_0x2e0dce[_0xd9a2('0x4a')]!==_0xd9a2('0x4b')){var _0x3ddadf={};_0x3ddadf[_0x2e0dce[_0xd9a2('0x39')]]={'$like':'%'+_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x48')]+'%'};return _0x3ddadf;}})});}_0x3c6a68=_[_0xd9a2('0x49')]({},_0x3c6a68,_0xff9e89['options']);var _0x2a098f={'where':_0x3c6a68[_0xd9a2('0x47')]};return db[_0xd9a2('0x4c')][_0xd9a2('0x4d')](_0x2a098f)[_0xd9a2('0x21')](function(_0x4d76fc){_0x110064['count']=_0x4d76fc;if(_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x4e')]){_0x3c6a68[_0xd9a2('0x4f')]=[{'all':!![]}];}return db[_0xd9a2('0x4c')][_0xd9a2('0x50')](_0x3c6a68);})[_0xd9a2('0x21')](function(_0xe7d5c0){_0x110064[_0xd9a2('0x51')]=_0xe7d5c0;return _0x110064;})[_0xd9a2('0x21')](respondWithFilteredResult(_0x147ad8,_0x3c6a68))[_0xd9a2('0x2c')](handleError(_0x147ad8,null));};exports[_0xd9a2('0x52')]=function(_0x156608,_0xd184db){var _0xc43dea={'raw':!![],'where':{'id':_0x156608['params']['id']}},_0x43c91b={};_0x43c91b[_0xd9a2('0x3c')]=_['keys'](db[_0xd9a2('0x4c')][_0xd9a2('0x53')]);_0x43c91b[_0xd9a2('0x3e')]=_['keys'](_0x156608[_0xd9a2('0x3e')]);_0x43c91b[_0xd9a2('0x54')]=_[_0xd9a2('0x40')](_0x43c91b[_0xd9a2('0x3c')],_0x43c91b[_0xd9a2('0x3e')]);_0xc43dea[_0xd9a2('0x3f')]=_[_0xd9a2('0x40')](_0x43c91b[_0xd9a2('0x3c')],qs[_0xd9a2('0x41')](_0x156608[_0xd9a2('0x3e')][_0xd9a2('0x41')]));_0xc43dea[_0xd9a2('0x3f')]=_0xc43dea[_0xd9a2('0x3f')]['length']?_0xc43dea[_0xd9a2('0x3f')]:_0x43c91b[_0xd9a2('0x3c')];if(_0x156608['query'][_0xd9a2('0x4e')]){_0xc43dea[_0xd9a2('0x4f')]=[{'all':!![]}];}_0xc43dea=_[_0xd9a2('0x49')]({},_0xc43dea,_0x156608[_0xd9a2('0x55')]);return db[_0xd9a2('0x4c')][_0xd9a2('0x56')](_0xc43dea)[_0xd9a2('0x21')](handleEntityNotFound(_0xd184db,null))[_0xd9a2('0x21')](respondWithResult(_0xd184db,null))[_0xd9a2('0x2c')](handleError(_0xd184db,null));};exports[_0xd9a2('0x57')]=function(_0x5dda06,_0x555e8f){return db['SmsMessage'][_0xd9a2('0x57')](_0x5dda06[_0xd9a2('0x58')],{})[_0xd9a2('0x21')](respondWithResult(_0x555e8f,0xc9))['catch'](handleError(_0x555e8f,null));};exports[_0xd9a2('0x59')]=function(_0x500c40,_0x4305da){if(_0x500c40[_0xd9a2('0x58')]['id']){delete _0x500c40[_0xd9a2('0x58')]['id'];}return db[_0xd9a2('0x4c')][_0xd9a2('0x56')]({'where':{'id':_0x500c40[_0xd9a2('0x5a')]['id']}})[_0xd9a2('0x21')](handleEntityNotFound(_0x4305da,null))['then'](saveUpdates(_0x500c40[_0xd9a2('0x58')],null))[_0xd9a2('0x21')](respondWithResult(_0x4305da,null))[_0xd9a2('0x2c')](handleError(_0x4305da,null));};exports[_0xd9a2('0x37')]=function(_0x3a882a,_0x16350d){return db[_0xd9a2('0x4c')]['find']({'where':{'id':_0x3a882a[_0xd9a2('0x5a')]['id']}})[_0xd9a2('0x21')](handleEntityNotFound(_0x16350d,null))[_0xd9a2('0x21')](removeEntity(_0x16350d,null))['catch'](handleError(_0x16350d,null));};exports[_0xd9a2('0x5b')]=function(_0x1a42db,_0xe094dc){return db['SmsMessage'][_0xd9a2('0x5b')]()[_0xd9a2('0x21')](respondWithResult(_0xe094dc,null))['catch'](handleError(_0xe094dc,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xd9a2('0x5c')]=function(_0x96a587,_0xb549a9,_0x2c482a){var _0x416c03={'agent':{},'channel':_0xd9a2('0x5d')};if(_0x96a587[_0xd9a2('0x58')]['id']){delete _0x96a587[_0xd9a2('0x58')]['id'];}_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x5e')]=!![];_0x96a587['body'][_0xd9a2('0x5f')]=moment()[_0xd9a2('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x96a587['body']['UserId']=_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')]||_0x96a587[_0xd9a2('0x62')]['id'];_0x416c03[_0xd9a2('0x63')]['id']=_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')];return db[_0xd9a2('0x4c')]['find']({'where':{'id':_0x96a587[_0xd9a2('0x5a')]['id'],'UserId':null}})[_0xd9a2('0x21')](handleEntityNotFound(_0xb549a9,null))[_0xd9a2('0x21')](saveUpdates(_0x96a587[_0xd9a2('0x58')],null))[_0xd9a2('0x21')](function(_0x10b10f){if(_0x10b10f){_0x416c03['message']=_0x10b10f[_0xd9a2('0x64')]({'plain':!![]});return db[_0xd9a2('0x65')][_0xd9a2('0x56')]({'where':{'id':_0x10b10f[_0xd9a2('0x66')]}});}return null;})[_0xd9a2('0x21')](handleEntityNotFound(_0xb549a9,null))[_0xd9a2('0x21')](function(_0x4883f0){if(_0x4883f0){return _0x4883f0[_0xd9a2('0x59')]({'UserId':_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')],'read1stAt':_[_0xd9a2('0x67')](_0x4883f0[_0xd9a2('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x65bfe1){if(_0x65bfe1){_0x416c03[_0xd9a2('0x69')]=_0x65bfe1[_0xd9a2('0x64')]({'plain':!![]});interaction_log[_0xd9a2('0x22')](_0xd9a2('0x6a'),_0x96a587['user']['id'],_0x96a587[_0xd9a2('0x62')]['name'],_0x96a587['user'][_0xd9a2('0x6b')],_0x416c03[_0xd9a2('0x69')]['id'],_0x96a587[_0xd9a2('0x58')]?JSON[_0xd9a2('0x27')](_0x96a587[_0xd9a2('0x58')]):'null');return respondWithRpcPromise(_0xd9a2('0x6c'),_0xd9a2('0x6d'),_0x416c03);}return null;})[_0xd9a2('0x21')](function(_0x359ffb){var _0x17a77f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x359ffb[_0xd9a2('0x2a')][_0xd9a2('0x6e')];return db[_0xd9a2('0x6f')][_0xd9a2('0x3e')](_0x17a77f,{'type':db[_0xd9a2('0x70')][_0xd9a2('0x71')][_0xd9a2('0x72')],'raw':!![]})[_0xd9a2('0x21')](function(_0x140484){return _0x140484;});})['then'](function(_0x5dabb5){if(_0x5dabb5){_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x73')]=_0x5dabb5[0x0];if(!_0x96a587['body'][_0xd9a2('0x61')])return;return db[_0xd9a2('0x74')]['find']({'where':{'id':_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')],'role':'agent'},'attributes':['id',_0xd9a2('0x39'),_0xd9a2('0x75'),_0xd9a2('0x76'),_0xd9a2('0x77')],'raw':!![]});}return null;})[_0xd9a2('0x21')](function(_0x406964){if(!_0x406964)return null;_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x63')]=_0x406964;return _0x416c03;})[_0xd9a2('0x21')](function(_0x50020d){if(_0x50020d){if(_0x96a587[_0xd9a2('0x58')]['manual']){_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x78')]=util[_0xd9a2('0x60')](_0xd9a2('0x79'),_0x96a587[_0xd9a2('0x62')][_0xd9a2('0x39')]);_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x7a')]=_0x416c03['channel'];_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x7b')]=_0x416c03[_0xd9a2('0x7a')];_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x7c')]=_0xd9a2('0x5c');return respondWithRpcPromise(_0xd9a2('0x7d'),'EventManager',{'event':'acceptmessage','message':_0x416c03[_0xd9a2('0x2a')]},client9002)[_0xd9a2('0x21')](function(){return _0x416c03;});}return _0x416c03;}return null;})[_0xd9a2('0x21')](respondWithResult(_0xb549a9,null))['catch'](handleError(_0xb549a9,null));};var interaction_log=require('../../config/logger')(_0xd9a2('0x7e'));exports[_0xd9a2('0x36')]=function(_0x5df83c,_0x4c1cf3,_0x37e307){var _0x3ae1bc={'agent':{},'channel':_0xd9a2('0x5d')};if(_0x5df83c[_0xd9a2('0x58')]['id']){delete _0x5df83c[_0xd9a2('0x58')]['id'];}_0x5df83c['body'][_0xd9a2('0x61')]=_0x5df83c['body']['UserId']||_0x5df83c[_0xd9a2('0x62')]['id'];_0x3ae1bc[_0xd9a2('0x63')]['id']=_0x5df83c[_0xd9a2('0x58')]['UserId'];return db[_0xd9a2('0x4c')][_0xd9a2('0x56')]({'where':{'id':_0x5df83c['params']['id'],'UserId':null}})[_0xd9a2('0x21')](handleEntityNotFound(_0x4c1cf3,null))[_0xd9a2('0x21')](function(_0x24eb4b){if(_0x24eb4b){_0x3ae1bc[_0xd9a2('0x2a')]=_0x24eb4b[_0xd9a2('0x64')]({'plain':!![]});return db[_0xd9a2('0x65')][_0xd9a2('0x56')]({'where':{'id':_0x24eb4b['SmsInteractionId']}});}return null;})[_0xd9a2('0x21')](handleEntityNotFound(_0x4c1cf3,null))[_0xd9a2('0x21')](function(_0x5b3735){if(_0x5b3735){_0x3ae1bc[_0xd9a2('0x69')]=_0x5b3735['get']({'plain':!![]});interaction_log[_0xd9a2('0x22')](_0xd9a2('0x7f'),_0x5df83c[_0xd9a2('0x62')]['id'],_0x5df83c[_0xd9a2('0x62')][_0xd9a2('0x39')],_0x5df83c[_0xd9a2('0x62')][_0xd9a2('0x6b')],_0x3ae1bc[_0xd9a2('0x69')]['id'],_0x5df83c[_0xd9a2('0x58')]?JSON['stringify'](_0x5df83c[_0xd9a2('0x58')]):_0xd9a2('0x80'));return respondWithRpcPromise(_0xd9a2('0x81'),'rejectMessage',_0x3ae1bc);}return null;})[_0xd9a2('0x21')](function(_0x4fb154){var _0x2c9b15=_0xd9a2('0x82')+_0x4fb154[_0xd9a2('0x2a')][_0xd9a2('0x6e')];return db[_0xd9a2('0x6f')][_0xd9a2('0x3e')](_0x2c9b15,{'type':db[_0xd9a2('0x70')][_0xd9a2('0x71')]['SELECT'],'raw':!![]})[_0xd9a2('0x21')](function(_0x1fd236){return _0x1fd236;});})[_0xd9a2('0x21')](function(_0x5ade4d){if(_0x5ade4d){_0x3ae1bc[_0xd9a2('0x2a')][_0xd9a2('0x73')]=_0x5ade4d[0x0];if(!_0x5df83c[_0xd9a2('0x58')][_0xd9a2('0x61')])return;return db[_0xd9a2('0x74')][_0xd9a2('0x56')]({'where':{'id':_0x5df83c[_0xd9a2('0x58')][_0xd9a2('0x61')],'role':_0xd9a2('0x63')},'attributes':['id',_0xd9a2('0x39'),'fullname',_0xd9a2('0x76'),'internal'],'raw':!![]});}return null;})[_0xd9a2('0x21')](function(_0x5e9bdd){if(!_0x5e9bdd)return null;_0x3ae1bc['message'][_0xd9a2('0x63')]=_0x5e9bdd;return _0x3ae1bc;})[_0xd9a2('0x21')](function(_0x339d19){if(_0x339d19){_0x339d19[_0xd9a2('0x2a')]['interface']=util[_0xd9a2('0x60')](_0xd9a2('0x79'),_0x5df83c[_0xd9a2('0x62')][_0xd9a2('0x39')]);_0x339d19[_0xd9a2('0x2a')][_0xd9a2('0x7a')]=_0x3ae1bc['channel'];_0x339d19[_0xd9a2('0x2a')][_0xd9a2('0x7b')]=_0x3ae1bc[_0xd9a2('0x7a')];_0x339d19[_0xd9a2('0x2a')][_0xd9a2('0x7c')]=_0xd9a2('0x36');respondWithRpcPromise(_0xd9a2('0x7d'),_0xd9a2('0x7d'),{'event':_0xd9a2('0x83'),'message':_0x339d19[_0xd9a2('0x2a')]},client9002);return _0x3ae1bc;}return null;})['then'](respondWithResult(_0x4c1cf3,null))[_0xd9a2('0x2c')](handleError(_0x4c1cf3,null));};exports['status']=function(_0x4b8b48,_0x1213f1,_0x1dba0c){if(_0x4b8b48[_0xd9a2('0x58')]['id']){delete _0x4b8b48[_0xd9a2('0x58')]['id'];}var _0x35e050;return db[_0xd9a2('0x4c')][_0xd9a2('0x56')]({'where':{'id':_0x4b8b48['params']['id']}})['then'](handleEntityNotFound(_0x1213f1,null))[_0xd9a2('0x21')](function(_0x6e0fc7){if(_0x6e0fc7){_0x35e050=_0x6e0fc7;return db['SmsAccount'][_0xd9a2('0x56')]({'where':{'id':_0x6e0fc7['SmsAccountId']}});}})[_0xd9a2('0x21')](handleEntityNotFound(_0x1213f1,null))[_0xd9a2('0x21')](function(_0x1dd219){if(_0x1dd219){logger[_0xd9a2('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd9a2('0x2e'),_0xd9a2('0x84'),_0x1dd219[_0xd9a2('0x4a')],util[_0xd9a2('0x85')](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));switch(_0x1dd219[_0xd9a2('0x4a')]){case _0xd9a2('0x86'):if(_0x4b8b48[_0xd9a2('0x58')][_0xd9a2('0x87')]&&_0x4b8b48[_0xd9a2('0x58')]['MessageSid']===_0x35e050[_0xd9a2('0x88')]){return _0x35e050[_0xd9a2('0x59')]({'read':!![]});}else{logger[_0xd9a2('0x29')](_0xd9a2('0x89'),_0xd9a2('0x2e'),'twilio',util['inspect'](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4b8b48[_0xd9a2('0x58')]['MessageUUID']&&_0x4b8b48[_0xd9a2('0x58')][_0xd9a2('0x8a')]===_0x35e050[_0xd9a2('0x88')]&&_[_0xd9a2('0x8b')]([_0xd9a2('0x8c'),_0xd9a2('0x8d')],_0x4b8b48[_0xd9a2('0x58')][_0xd9a2('0x8e')])>=0x0){return _0x35e050['update']({'read':!![]});}else{logger[_0xd9a2('0x29')](_0xd9a2('0x89'),_0xd9a2('0x2e'),_0xd9a2('0x8f'),util[_0xd9a2('0x85')](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));}break;case _0xd9a2('0x90'):var _0x460b62=_0x4b8b48['body'][_0xd9a2('0x91')][0x0];if(_0x460b62[_0xd9a2('0x2e')][_0xd9a2('0x92')]===_0xd9a2('0x93')){return _0x35e050['update']({'read':!![]});}else{logger[_0xd9a2('0x29')](_0xd9a2('0x89'),_0xd9a2('0x2e'),_0xd9a2('0x90'),util[_0xd9a2('0x85')](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x35e050;}})[_0xd9a2('0x21')](respondWithResult(_0x1213f1,null))[_0xd9a2('0x2c')](handleError(_0x1213f1,null));}; \ No newline at end of file +var _0x852c=['set','json','apply','reject','save','update','destroy','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','describe','accept','read','readAt','UserId','get','SmsInteractionId','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','SmsInteraction','RejectMessage','rejectMessage','QueryTypes','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','results','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x5db4a8,_0x49c56c){var _0x472ccc=function(_0x523493){while(--_0x523493){_0x5db4a8['push'](_0x5db4a8['shift']());}};_0x472ccc(++_0x49c56c);}(_0x852c,0x179));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc852('0x0'));var rimraf=require(_0xc852('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc852('0x2'));var rp=require(_0xc852('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc852('0x4'));var util=require(_0xc852('0x5'));var path=require(_0xc852('0x6'));var sox=require(_0xc852('0x7'));var csv=require(_0xc852('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc852('0x9'));var squel=require(_0xc852('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc852('0xb'));var toCsv=require(_0xc852('0x8'));var querystring=require(_0xc852('0xc'));var Papa=require(_0xc852('0xd'));var Redis=require(_0xc852('0xe'));var authService=require(_0xc852('0xf'));var qs=require(_0xc852('0x10'));var as=require(_0xc852('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc852('0x12'))('api');var utils=require(_0xc852('0x13'));var config=require(_0xc852('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc852('0x15'))['db'];config['redis']=_[_0xc852('0x16')](config[_0xc852('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc852('0x18'))(new Redis(config['redis']));require(_0xc852('0x19'))[_0xc852('0x1a')](socket);var jayson=require(_0xc852('0x1b'));var client=jayson[_0xc852('0x1c')][_0xc852('0x1d')]({'port':0x232c});var client9002=jayson[_0xc852('0x1c')][_0xc852('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4c6429,_0x4f3095,_0x112291,_0x1c9072){return new BPromise(function(_0x4c38d7,_0x4d0e96){var _0x23968d=_0x1c9072||client;return _0x23968d['request'](_0x4c6429,_0x112291)[_0xc852('0x1e')](function(_0x4e8c45){logger[_0xc852('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x4f3095,_0xc852('0x20'));logger[_0xc852('0x21')](_0xc852('0x22'),_0x4f3095,_0xc852('0x20'),JSON[_0xc852('0x23')](_0x4e8c45));if(_0x4e8c45[_0xc852('0x24')]){if(_0x4e8c45[_0xc852('0x24')][_0xc852('0x25')]===0x1f4){logger['error'](_0xc852('0x26'),_0x4f3095,_0x4e8c45[_0xc852('0x24')]['message']);return _0x4d0e96(_0x4e8c45[_0xc852('0x24')][_0xc852('0x27')]);}logger[_0xc852('0x24')](_0xc852('0x26'),_0x4f3095,_0x4e8c45[_0xc852('0x24')]['message']);return _0x4c38d7(_0x4e8c45[_0xc852('0x24')]['message']);}else{logger[_0xc852('0x1f')](_0xc852('0x26'),_0x4f3095,_0xc852('0x20'));_0x4c38d7(_0x4e8c45[_0xc852('0x28')][_0xc852('0x27')]);}})[_0xc852('0x29')](function(_0xcc516a){logger['error'](_0xc852('0x26'),_0x4f3095,_0xcc516a);_0x4d0e96(_0xcc516a);});});}function respondWithStatusCode(_0x74d88a,_0x354d67){_0x354d67=_0x354d67||0xcc;return function(_0x1a1327){if(_0x1a1327){return _0x74d88a[_0xc852('0x2a')](_0x354d67);}return _0x74d88a[_0xc852('0x2b')](_0x354d67)[_0xc852('0x2c')]();};}function respondWithResult(_0x5bac8c,_0xda00c5){_0xda00c5=_0xda00c5||0xc8;return function(_0x1c52dc){if(_0x1c52dc){return _0x5bac8c[_0xc852('0x2b')](_0xda00c5)['json'](_0x1c52dc);}};}function respondWithFilteredResult(_0x1266e0,_0x49f65){return function(_0x118df9){if(_0x118df9){var _0x18c72f=typeof _0x49f65[_0xc852('0x2d')]===_0xc852('0x2e')&&typeof _0x49f65['limit']===_0xc852('0x2e');var _0x2d6aa7=_0x118df9[_0xc852('0x2f')];var _0x53d5a1=_0x18c72f?0x0:_0x49f65[_0xc852('0x2d')];var _0x1895e0=_0x18c72f?_0x118df9['count']:_0x49f65[_0xc852('0x2d')]+_0x49f65[_0xc852('0x30')];var _0x428702;if(_0x1895e0>=_0x2d6aa7){_0x1895e0=_0x2d6aa7;_0x428702=0xc8;}else{_0x428702=0xce;}_0x1266e0[_0xc852('0x2b')](_0x428702);return _0x1266e0[_0xc852('0x31')]('Content-Range',_0x53d5a1+'-'+_0x1895e0+'/'+_0x2d6aa7)[_0xc852('0x32')](_0x118df9);}return null;};}function patchUpdates(_0x20da7f){return function(_0x47e04d){try{jsonpatch[_0xc852('0x33')](_0x47e04d,_0x20da7f,!![]);}catch(_0xbba04e){return BPromise[_0xc852('0x34')](_0xbba04e);}return _0x47e04d[_0xc852('0x35')]();};}function saveUpdates(_0x5c0a99,_0x4c6c06){return function(_0x1a86b8){if(_0x1a86b8){return _0x1a86b8[_0xc852('0x36')](_0x5c0a99)['then'](function(_0x6ef3f2){return _0x6ef3f2;});}return null;};}function removeEntity(_0x48704d,_0x5f1754){return function(_0xc16ad5){if(_0xc16ad5){return _0xc16ad5[_0xc852('0x37')]()[_0xc852('0x1e')](function(){_0x48704d['status'](0xcc)[_0xc852('0x2c')]();});}};}function handleEntityNotFound(_0x555cd1,_0x5547bf){return function(_0x23440a){if(!_0x23440a){_0x555cd1[_0xc852('0x2a')](0x194);}return _0x23440a;};}function handleError(_0x3acdbe,_0x4d606e){_0x4d606e=_0x4d606e||0x1f4;return function(_0x2d6b0c){logger[_0xc852('0x24')](_0x2d6b0c['stack']);if(_0x2d6b0c[_0xc852('0x38')]){delete _0x2d6b0c[_0xc852('0x38')];}_0x3acdbe[_0xc852('0x2b')](_0x4d606e)['send'](_0x2d6b0c);};}exports[_0xc852('0x39')]=function(_0x1b610d,_0x1001db){var _0x2cb3e0={},_0x2ed2cc={},_0x93ec8e={'count':0x0,'rows':[]};var _0x1f9c48=_[_0xc852('0x3a')](db[_0xc852('0x3b')][_0xc852('0x3c')],function(_0x17c543){return{'name':_0x17c543[_0xc852('0x3d')],'type':_0x17c543[_0xc852('0x3e')][_0xc852('0x3f')]};});_0x2ed2cc[_0xc852('0x40')]=_[_0xc852('0x3a')](_0x1f9c48,_0xc852('0x38'));_0x2ed2cc['query']=_[_0xc852('0x41')](_0x1b610d['query']);_0x2ed2cc[_0xc852('0x42')]=_[_0xc852('0x43')](_0x2ed2cc[_0xc852('0x40')],_0x2ed2cc[_0xc852('0x44')]);_0x2cb3e0[_0xc852('0x45')]=_['intersection'](_0x2ed2cc[_0xc852('0x40')],qs[_0xc852('0x46')](_0x1b610d['query'][_0xc852('0x46')]));_0x2cb3e0[_0xc852('0x45')]=_0x2cb3e0[_0xc852('0x45')][_0xc852('0x47')]?_0x2cb3e0['attributes']:_0x2ed2cc[_0xc852('0x40')];if(!_0x1b610d[_0xc852('0x44')][_0xc852('0x48')](_0xc852('0x49'))){_0x2cb3e0['limit']=qs[_0xc852('0x30')](_0x1b610d[_0xc852('0x44')][_0xc852('0x30')]);_0x2cb3e0[_0xc852('0x2d')]=qs[_0xc852('0x2d')](_0x1b610d[_0xc852('0x44')][_0xc852('0x2d')]);}_0x2cb3e0['order']=qs['sort'](_0x1b610d['query'][_0xc852('0x4a')]);_0x2cb3e0[_0xc852('0x4b')]=qs[_0xc852('0x42')](_[_0xc852('0x4c')](_0x1b610d[_0xc852('0x44')],_0x2ed2cc[_0xc852('0x42')]),_0x1f9c48);if(_0x1b610d[_0xc852('0x44')][_0xc852('0x4d')]){_0x2cb3e0[_0xc852('0x4b')]=_[_0xc852('0x4e')](_0x2cb3e0[_0xc852('0x4b')],{'$or':_['map'](_0x1f9c48,function(_0x428286){if(_0x428286[_0xc852('0x3e')]!==_0xc852('0x4f')){var _0x11fc77={};_0x11fc77[_0x428286[_0xc852('0x38')]]={'$like':'%'+_0x1b610d[_0xc852('0x44')][_0xc852('0x4d')]+'%'};return _0x11fc77;}})});}_0x2cb3e0=_[_0xc852('0x4e')]({},_0x2cb3e0,_0x1b610d[_0xc852('0x50')]);var _0x351f4f={'where':_0x2cb3e0[_0xc852('0x4b')]};return db[_0xc852('0x3b')][_0xc852('0x2f')](_0x351f4f)[_0xc852('0x1e')](function(_0x5b9164){_0x93ec8e[_0xc852('0x2f')]=_0x5b9164;if(_0x1b610d[_0xc852('0x44')][_0xc852('0x51')]){_0x2cb3e0[_0xc852('0x52')]=[{'all':!![]}];}return db[_0xc852('0x3b')]['findAll'](_0x2cb3e0);})[_0xc852('0x1e')](function(_0x96abea){_0x93ec8e[_0xc852('0x53')]=_0x96abea;return _0x93ec8e;})[_0xc852('0x1e')](respondWithFilteredResult(_0x1001db,_0x2cb3e0))[_0xc852('0x29')](handleError(_0x1001db,null));};exports[_0xc852('0x54')]=function(_0x2cbc92,_0x181752){var _0x4331e7={'raw':!![],'where':{'id':_0x2cbc92[_0xc852('0x55')]['id']}},_0xcbb110={};_0xcbb110['model']=_[_0xc852('0x41')](db[_0xc852('0x3b')]['rawAttributes']);_0xcbb110[_0xc852('0x44')]=_[_0xc852('0x41')](_0x2cbc92['query']);_0xcbb110[_0xc852('0x42')]=_[_0xc852('0x43')](_0xcbb110['model'],_0xcbb110[_0xc852('0x44')]);_0x4331e7[_0xc852('0x45')]=_['intersection'](_0xcbb110[_0xc852('0x40')],qs[_0xc852('0x46')](_0x2cbc92['query'][_0xc852('0x46')]));_0x4331e7[_0xc852('0x45')]=_0x4331e7[_0xc852('0x45')][_0xc852('0x47')]?_0x4331e7[_0xc852('0x45')]:_0xcbb110[_0xc852('0x40')];if(_0x2cbc92[_0xc852('0x44')]['includeAll']){_0x4331e7[_0xc852('0x52')]=[{'all':!![]}];}_0x4331e7=_[_0xc852('0x4e')]({},_0x4331e7,_0x2cbc92[_0xc852('0x50')]);return db[_0xc852('0x3b')][_0xc852('0x56')](_0x4331e7)[_0xc852('0x1e')](handleEntityNotFound(_0x181752,null))[_0xc852('0x1e')](respondWithResult(_0x181752,null))[_0xc852('0x29')](handleError(_0x181752,null));};exports[_0xc852('0x57')]=function(_0x1d5fd1,_0x40c171){return db[_0xc852('0x3b')][_0xc852('0x57')](_0x1d5fd1[_0xc852('0x58')],{})['then'](respondWithResult(_0x40c171,0xc9))[_0xc852('0x29')](handleError(_0x40c171,null));};exports['update']=function(_0x427f1b,_0x45af4c){if(_0x427f1b[_0xc852('0x58')]['id']){delete _0x427f1b[_0xc852('0x58')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x427f1b['params']['id']}})[_0xc852('0x1e')](handleEntityNotFound(_0x45af4c,null))[_0xc852('0x1e')](saveUpdates(_0x427f1b['body'],null))[_0xc852('0x1e')](respondWithResult(_0x45af4c,null))['catch'](handleError(_0x45af4c,null));};exports[_0xc852('0x37')]=function(_0x558b73,_0x2dcd68){return db[_0xc852('0x3b')]['find']({'where':{'id':_0x558b73[_0xc852('0x55')]['id']}})[_0xc852('0x1e')](handleEntityNotFound(_0x2dcd68,null))[_0xc852('0x1e')](removeEntity(_0x2dcd68,null))[_0xc852('0x29')](handleError(_0x2dcd68,null));};exports['describe']=function(_0x5ae986,_0x32f5ec){return db[_0xc852('0x3b')][_0xc852('0x59')]()['then'](respondWithResult(_0x32f5ec,null))[_0xc852('0x29')](handleError(_0x32f5ec,null));};var interaction_log=require(_0xc852('0x12'))('sms-interactions');exports[_0xc852('0x5a')]=function(_0x2738c1,_0x489e33,_0xde481d){var _0x4897eb={'agent':{},'channel':'sms'};if(_0x2738c1[_0xc852('0x58')]['id']){delete _0x2738c1[_0xc852('0x58')]['id'];}_0x2738c1[_0xc852('0x58')][_0xc852('0x5b')]=!![];_0x2738c1[_0xc852('0x58')][_0xc852('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')]=_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')]||_0x2738c1['user']['id'];_0x4897eb['agent']['id']=_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')];return db[_0xc852('0x3b')]['find']({'where':{'id':_0x2738c1[_0xc852('0x55')]['id'],'UserId':null}})[_0xc852('0x1e')](handleEntityNotFound(_0x489e33,null))['then'](saveUpdates(_0x2738c1['body'],null))[_0xc852('0x1e')](function(_0x4fcfea){if(_0x4fcfea){_0x4897eb[_0xc852('0x27')]=_0x4fcfea[_0xc852('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0xc852('0x56')]({'where':{'id':_0x4fcfea[_0xc852('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x489e33,null))[_0xc852('0x1e')](function(_0x31ef41){if(_0x31ef41){return _0x31ef41[_0xc852('0x36')]({'UserId':_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')],'read1stAt':_['isNil'](_0x31ef41[_0xc852('0x60')])?moment()[_0xc852('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc852('0x1e')](function(_0x119cb5){if(_0x119cb5){_0x4897eb[_0xc852('0x62')]=_0x119cb5['get']({'plain':!![]});interaction_log[_0xc852('0x1f')](_0xc852('0x63'),_0x2738c1[_0xc852('0x64')]['id'],_0x2738c1['user'][_0xc852('0x38')],_0x2738c1['user'][_0xc852('0x65')],_0x4897eb[_0xc852('0x62')]['id'],_0x2738c1[_0xc852('0x58')]?JSON['stringify'](_0x2738c1[_0xc852('0x58')]):_0xc852('0x66'));return respondWithRpcPromise(_0xc852('0x67'),'acceptMessage',_0x4897eb);}return null;})['then'](function(_0x4fa9b6){var _0xc106a5=_0xc852('0x68')+_0x4fa9b6['message'][_0xc852('0x69')];return db[_0xc852('0x6a')][_0xc852('0x44')](_0xc106a5,{'type':db[_0xc852('0x6b')]['QueryTypes'][_0xc852('0x6c')],'raw':!![]})[_0xc852('0x1e')](function(_0x5cfff0){return _0x5cfff0;});})[_0xc852('0x1e')](function(_0x1cc613){if(_0x1cc613){_0x4897eb[_0xc852('0x27')][_0xc852('0x6d')]=_0x1cc613[0x0];if(!_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')])return;return db[_0xc852('0x6e')]['find']({'where':{'id':_0x2738c1[_0xc852('0x58')]['UserId'],'role':_0xc852('0x6f')},'attributes':['id',_0xc852('0x38'),_0xc852('0x70'),_0xc852('0x71'),_0xc852('0x72')],'raw':!![]});}return null;})[_0xc852('0x1e')](function(_0x1811ea){if(!_0x1811ea)return null;_0x4897eb[_0xc852('0x27')][_0xc852('0x6f')]=_0x1811ea;return _0x4897eb;})[_0xc852('0x1e')](function(_0x6cbcbd){if(_0x6cbcbd){if(_0x2738c1['body']['manual']){_0x4897eb[_0xc852('0x27')][_0xc852('0x73')]=util[_0xc852('0x61')](_0xc852('0x74'),_0x2738c1[_0xc852('0x64')][_0xc852('0x38')]);_0x4897eb[_0xc852('0x27')]['channel']=_0x4897eb[_0xc852('0x75')];_0x4897eb['message'][_0xc852('0x76')]=_0x4897eb['channel'];_0x4897eb['message'][_0xc852('0x77')]=_0xc852('0x5a');return respondWithRpcPromise(_0xc852('0x78'),_0xc852('0x78'),{'event':'acceptmessage','message':_0x4897eb[_0xc852('0x27')]},client9002)[_0xc852('0x1e')](function(){return _0x4897eb;});}return _0x4897eb;}return null;})[_0xc852('0x1e')](respondWithResult(_0x489e33,null))['catch'](handleError(_0x489e33,null));};var interaction_log=require('../../config/logger')(_0xc852('0x79'));exports[_0xc852('0x34')]=function(_0x312b8a,_0x6eefe0,_0x16cbed){var _0x21ac24={'agent':{},'channel':'sms'};if(_0x312b8a[_0xc852('0x58')]['id']){delete _0x312b8a['body']['id'];}_0x312b8a[_0xc852('0x58')]['UserId']=_0x312b8a['body']['UserId']||_0x312b8a[_0xc852('0x64')]['id'];_0x21ac24[_0xc852('0x6f')]['id']=_0x312b8a[_0xc852('0x58')][_0xc852('0x5d')];return db[_0xc852('0x3b')][_0xc852('0x56')]({'where':{'id':_0x312b8a['params']['id'],'UserId':null}})[_0xc852('0x1e')](handleEntityNotFound(_0x6eefe0,null))[_0xc852('0x1e')](function(_0xcdb4d1){if(_0xcdb4d1){_0x21ac24[_0xc852('0x27')]=_0xcdb4d1[_0xc852('0x5e')]({'plain':!![]});return db[_0xc852('0x7a')][_0xc852('0x56')]({'where':{'id':_0xcdb4d1['SmsInteractionId']}});}return null;})[_0xc852('0x1e')](handleEntityNotFound(_0x6eefe0,null))['then'](function(_0x3cdf8f){if(_0x3cdf8f){_0x21ac24[_0xc852('0x62')]=_0x3cdf8f['get']({'plain':!![]});interaction_log[_0xc852('0x1f')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x312b8a[_0xc852('0x64')]['id'],_0x312b8a[_0xc852('0x64')][_0xc852('0x38')],_0x312b8a[_0xc852('0x64')][_0xc852('0x65')],_0x21ac24['interaction']['id'],_0x312b8a[_0xc852('0x58')]?JSON[_0xc852('0x23')](_0x312b8a[_0xc852('0x58')]):'null');return respondWithRpcPromise(_0xc852('0x7b'),_0xc852('0x7c'),_0x21ac24);}return null;})['then'](function(_0xd5dac2){var _0x373b14=_0xc852('0x68')+_0xd5dac2[_0xc852('0x27')]['ContactId'];return db['sequelize'][_0xc852('0x44')](_0x373b14,{'type':db[_0xc852('0x6b')][_0xc852('0x7d')][_0xc852('0x6c')],'raw':!![]})[_0xc852('0x1e')](function(_0x18ea1a){return _0x18ea1a;});})[_0xc852('0x1e')](function(_0x5f061c){if(_0x5f061c){_0x21ac24[_0xc852('0x27')][_0xc852('0x6d')]=_0x5f061c[0x0];if(!_0x312b8a[_0xc852('0x58')][_0xc852('0x5d')])return;return db[_0xc852('0x6e')][_0xc852('0x56')]({'where':{'id':_0x312b8a[_0xc852('0x58')][_0xc852('0x5d')],'role':_0xc852('0x6f')},'attributes':['id','name',_0xc852('0x70'),_0xc852('0x71'),_0xc852('0x72')],'raw':!![]});}return null;})['then'](function(_0x5cfbde){if(!_0x5cfbde)return null;_0x21ac24[_0xc852('0x27')][_0xc852('0x6f')]=_0x5cfbde;return _0x21ac24;})[_0xc852('0x1e')](function(_0x13d36c){if(_0x13d36c){_0x13d36c['message'][_0xc852('0x73')]=util[_0xc852('0x61')](_0xc852('0x74'),_0x312b8a[_0xc852('0x64')][_0xc852('0x38')]);_0x13d36c[_0xc852('0x27')]['channel']=_0x21ac24[_0xc852('0x75')];_0x13d36c['message']['motionChannel']=_0x21ac24[_0xc852('0x75')];_0x13d36c[_0xc852('0x27')][_0xc852('0x77')]=_0xc852('0x34');respondWithRpcPromise(_0xc852('0x78'),_0xc852('0x78'),{'event':_0xc852('0x7e'),'message':_0x13d36c[_0xc852('0x27')]},client9002);return _0x21ac24;}return null;})['then'](respondWithResult(_0x6eefe0,null))[_0xc852('0x29')](handleError(_0x6eefe0,null));};exports[_0xc852('0x2b')]=function(_0x50b582,_0x2ea5f8,_0x41bb7d){if(_0x50b582['body']['id']){delete _0x50b582[_0xc852('0x58')]['id'];}var _0x581397;return db[_0xc852('0x3b')][_0xc852('0x56')]({'where':{'id':_0x50b582[_0xc852('0x55')]['id']}})[_0xc852('0x1e')](handleEntityNotFound(_0x2ea5f8,null))['then'](function(_0x33f7cd){if(_0x33f7cd){_0x581397=_0x33f7cd;return db[_0xc852('0x7f')]['find']({'where':{'id':_0x33f7cd['SmsAccountId']}});}})[_0xc852('0x1e')](handleEntityNotFound(_0x2ea5f8,null))[_0xc852('0x1e')](function(_0x16b9cf){if(_0x16b9cf){logger[_0xc852('0x21')](_0xc852('0x22'),_0xc852('0x2b'),_0xc852('0x80'),_0x16b9cf[_0xc852('0x3e')],util[_0xc852('0x81')](_0x50b582['body'],{'showHidden':![],'depth':null}));switch(_0x16b9cf[_0xc852('0x3e')]){case _0xc852('0x82'):if(_0x50b582[_0xc852('0x58')][_0xc852('0x83')]&&_0x50b582[_0xc852('0x58')][_0xc852('0x83')]===_0x581397['messageId']){return _0x581397[_0xc852('0x36')]({'read':!![]});}else{logger[_0xc852('0x24')](_0xc852('0x84'),_0xc852('0x2b'),'twilio',util[_0xc852('0x81')](_0x50b582[_0xc852('0x58')],{'showHidden':![],'depth':null}));}break;case _0xc852('0x85'):if(_0x50b582[_0xc852('0x58')][_0xc852('0x86')]&&_0x50b582[_0xc852('0x58')][_0xc852('0x86')]===_0x581397[_0xc852('0x87')]&&_[_0xc852('0x88')]([_0xc852('0x89'),_0xc852('0x8a')],_0x50b582['body'][_0xc852('0x8b')])>=0x0){return _0x581397['update']({'read':!![]});}else{logger[_0xc852('0x24')](_0xc852('0x84'),_0xc852('0x2b'),'plivio',util[_0xc852('0x81')](_0x50b582[_0xc852('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4c4ae5=_0x50b582[_0xc852('0x58')][_0xc852('0x8c')][0x0];if(_0x4c4ae5['status']['groupName']===_0xc852('0x8d')){return _0x581397[_0xc852('0x36')]({'read':!![]});}else{logger[_0xc852('0x24')](_0xc852('0x84'),'status','infobip',util[_0xc852('0x81')](_0x50b582[_0xc852('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x581397;}})[_0xc852('0x1e')](respondWithResult(_0x2ea5f8,null))[_0xc852('0x29')](handleError(_0x2ea5f8,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7bbd242..5679ed8 100644 --- a/server/api/smsMessage/smsMessage.events.js +++ b/server/api/smsMessage/smsMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c8b=['setMaxListeners','update','remove','emit','exports','SmsMessage'];(function(_0x543346,_0x2871d9){var _0x53389a=function(_0x2fdc13){while(--_0x2fdc13){_0x543346['push'](_0x543346['shift']());}};_0x53389a(++_0x2871d9);}(_0x4c8b,0xe3));var _0xb4c8=function(_0x4452f1,_0x5ad396){_0x4452f1=_0x4452f1-0x0;var _0x6cedd0=_0x4c8b[_0x4452f1];return _0x6cedd0;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0xb4c8('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb4c8('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb4c8('0x2'),'afterDestroy':_0xb4c8('0x3')};function emitEvent(_0x5c4bd8){return function(_0x3e32f8,_0x2c23f6,_0x4da923){SmsMessageEvents[_0xb4c8('0x4')](_0x5c4bd8+':'+_0x3e32f8['id'],_0x3e32f8);SmsMessageEvents[_0xb4c8('0x4')](_0x5c4bd8,_0x3e32f8);_0x4da923(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xb4c8('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0xc3f6=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x45f0e2,_0x12026e){var _0x5c2103=function(_0x2eb050){while(--_0x2eb050){_0x45f0e2['push'](_0x45f0e2['shift']());}};_0x5c2103(++_0x12026e);}(_0xc3f6,0x99));var _0x6c3f=function(_0x4e5658,_0x425f21){_0x4e5658=_0x4e5658-0x0;var _0x2d6e90=_0xc3f6[_0x4e5658];return _0x2d6e90;};'use strict';var EventEmitter=require(_0x6c3f('0x0'));var SmsMessage=require(_0x6c3f('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6c3f('0x2')](0x0);var events={'afterCreate':_0x6c3f('0x3'),'afterUpdate':_0x6c3f('0x4'),'afterDestroy':_0x6c3f('0x5')};function emitEvent(_0xf62d3a){return function(_0x21fbfd,_0x524d10,_0x19a744){SmsMessageEvents['emit'](_0xf62d3a+':'+_0x21fbfd['id'],_0x21fbfd);SmsMessageEvents[_0x6c3f('0x6')](_0xf62d3a,_0x21fbfd);_0x19a744(null);};}for(var e in events){if(events[_0x6c3f('0x7')](e)){var event=events[e];SmsMessage[_0x6c3f('0x8')](e,emitEvent(event));}}module[_0x6c3f('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 87e37a5..fe2c443 100644 --- a/server/api/smsMessage/smsMessage.model.js +++ b/server/api/smsMessage/smsMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05b8=['base64','http_code','data','head','messages','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','text','keys','sort','apiKey','createHash','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','SmsAccount','find','type','twilio','accountSid','authToken','phone','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','clicksend','password','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x05b8,0x190));var _0x805b=function(_0x499ab9,_0x7c1cdd){_0x499ab9=_0x499ab9-0x0;var _0x2ce335=_0x05b8[_0x499ab9];return _0x2ce335;};'use strict';var _=require(_0x805b('0x0'));var util=require(_0x805b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x805b('0x2'));var BPromise=require(_0x805b('0x3'));var rp=require(_0x805b('0x4'));var fs=require('fs');var path=require(_0x805b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x805b('0x6')]=function(_0x176628,_0x498f53){return _0x176628['define'](_0x805b('0x7'),attributes,{'tableName':_0x805b('0x8'),'paranoid':![],'indexes':[{'name':_0x805b('0x9'),'fields':['messageId']},{'name':_0x805b('0xa'),'fields':[_0x805b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x486564,_0x5a01de,_0x526440){var _0x1254c2=_0x176628[_0x805b('0xc')];var _0x17ca49=_0x486564[_0x805b('0xd')]({'plain':!![]});if(_0x17ca49[_0x805b('0xe')][_0x805b('0xf')]()==='in'||_0x17ca49[_0x805b('0xe')][_0x805b('0xf')]()===_0x805b('0x10')&&!_0x17ca49[_0x805b('0x11')]&&!_[_0x805b('0x12')](_0x17ca49[_0x805b('0x13')])&&!_[_0x805b('0x12')](_0x17ca49[_0x805b('0x14')])){_0x1254c2[_0x805b('0x15')][_0x805b('0x16')]({'where':{'id':_0x17ca49[_0x805b('0x14')]}})[_0x805b('0x17')](function(_0x5b4b31){if(_0x5b4b31){_0x5b4b31[_0x805b('0x18')]({'lastMsgAt':_0x17ca49[_0x805b('0x19')],'lastMsgDirection':_0x17ca49[_0x805b('0xe')][_0x805b('0xf')]()});}})[_0x805b('0x1a')](function(_0x4c9662){console['error'](_0x4c9662);});}if(_0x17ca49[_0x805b('0xe')]===_0x805b('0x10')&&!_0x17ca49[_0x805b('0x11')]){var _0x30cc1e;_0x1254c2[_0x805b('0x1b')][_0x805b('0x1c')]({'where':{'id':_0x17ca49['SmsAccountId']},'raw':!![]})[_0x805b('0x17')](function(_0x4110a5){_0x30cc1e=_0x4110a5;if(_0x30cc1e&&_0x30cc1e[_0x805b('0x1d')]){switch(_0x30cc1e['type']){case _0x805b('0x1e'):var _0x132f96=require(_0x805b('0x1e'));if(_0x30cc1e[_0x805b('0x1f')]&&_0x30cc1e[_0x805b('0x20')]&&_0x30cc1e[_0x805b('0x21')]){var _0x4def66=new _0x132f96(_0x30cc1e[_0x805b('0x1f')],_0x30cc1e[_0x805b('0x20')]);_0x4def66['messages']['create']({'body':_0x17ca49[_0x805b('0xb')],'to':_0x17ca49[_0x805b('0x21')],'from':_0x30cc1e[_0x805b('0x21')],'statusCallback':_0x30cc1e['remote']+_0x805b('0x22')+_0x17ca49['id']+_0x805b('0x23')+_0x30cc1e[_0x805b('0x24')]})[_0x805b('0x17')](function(_0x405789){if(_0x405789['sid']){return _0x486564[_0x805b('0x18')]({'messageId':_0x405789[_0x805b('0x25')]});}})['catch'](function(_0x4578c5){logger[_0x805b('0x26')](_0x805b('0x27'),'afterCreate',_0x805b('0x1e'),util[_0x805b('0x28')](_0x4578c5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x1e'),_0x805b('0x2a'));}break;case _0x805b('0x2b'):var _0x482a98=_0x805b('0x2c');if(_0x30cc1e['username']&&_0x30cc1e['password']){var _0x369626={'recipient':[_0x17ca49[_0x805b('0x21')]],'message':_0x17ca49[_0x805b('0xb')],'message_type':_0x30cc1e[_0x805b('0x2d')]};if(_0x30cc1e[_0x805b('0x2d')]&&_0x30cc1e[_0x805b('0x2d')]!=='SI'){_0x369626[_0x805b('0x2e')]=_0x30cc1e[_0x805b('0x21')];}var _0x579aa8={'url':_0x482a98+_0x805b('0x2f')+_0x30cc1e[_0x805b('0x30')]+_0x805b('0x31')+_0x30cc1e['password'],'method':_0x805b('0x32')};rp(_0x579aa8)[_0x805b('0x17')](function(_0x32a671){var _0x473cec=_0x32a671[_0x805b('0x33')](';');var _0x2983a6={'user_key':_0x473cec[0x0],'session_key':_0x473cec[0x1]};_0x579aa8={'url':_0x482a98+_0x805b('0x34'),'method':_0x805b('0x35'),'headers':{'user_key':_0x2983a6[_0x805b('0x36')],'Session_key':_0x2983a6['session_key']},'json':!![],'body':_0x369626};return rp(_0x579aa8);})[_0x805b('0x17')](function(_0x285156){if(_0x285156[_0x805b('0x37')]>=0x1){var _0x5c7df1={'messageId':_0x285156['internal_order_id']};if(_0x30cc1e[_0x805b('0x2d')]!=='GP'||!_0x30cc1e[_0x805b('0x38')]){_0x5c7df1[_0x805b('0x39')]=!![];}return _0x486564[_0x805b('0x18')](_0x5c7df1);}else{return logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x2b'),util[_0x805b('0x28')](_0x285156,{'showHidden':![],'depth':null}));}})['catch'](function(_0x12a129){return logger['error'](_0x805b('0x27'),_0x805b('0x29'),'skebby',util[_0x805b('0x28')](_0x12a129,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x2b'),_0x805b('0x3a'));}break;case _0x805b('0x3b'):if(_0x30cc1e[_0x805b('0x20')]){var _0x3daa40={'recipient':_0x17ca49[_0x805b('0x21')],'message':_0x17ca49[_0x805b('0xb')],'sender':_0x30cc1e['senderString']||_0x30cc1e[_0x805b('0x21')],'authorization':_0x30cc1e[_0x805b('0x20')]};var _0x5a01de={'method':_0x805b('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x3daa40,'json':!![]};rp(_0x5a01de)[_0x805b('0x17')](function(_0x3404ff){var _0x241b3c={'messageId':_0x3404ff['requestid']};if(!_0x30cc1e[_0x805b('0x38')]){_0x241b3c[_0x805b('0x39')]=!![];}return _0x486564[_0x805b('0x18')](_0x241b3c);})[_0x805b('0x1a')](function(_0x5b58a9){logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x3b'),util['inspect'](_0x5b58a9,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x805b('0x3c'):if(_0x30cc1e[_0x805b('0x30')]&&_0x30cc1e[_0x805b('0x3d')]){var _0x3daa40={'messages':[{'source':'xCALLY\x20Motion','to':_0x17ca49[_0x805b('0x21')],'body':_0x17ca49[_0x805b('0xb')],'from':_0x30cc1e[_0x805b('0x3e')]||_0x30cc1e['phone']}]};var _0x56bb3e=util[_0x805b('0x3f')](_0x805b('0x40'),_0x30cc1e[_0x805b('0x30')],_0x30cc1e[_0x805b('0x3d')]);var _0x5a01de={'method':'POST','uri':_0x805b('0x41'),'body':_0x3daa40,'headers':{'Authorization':util[_0x805b('0x3f')](_0x805b('0x42'),new Buffer(_0x56bb3e)[_0x805b('0x43')](_0x805b('0x44')))},'json':!![]};rp(_0x5a01de)[_0x805b('0x17')](function(_0x2554ea){if(_0x2554ea[_0x805b('0x45')]>=0xc8&&_0x2554ea[_0x805b('0x45')]<=0xce){if(_0x2554ea[_0x805b('0x46')]&&_0x2554ea['data']['queued_count']>0x0){var _0x1d10ef=_[_0x805b('0x47')](_0x2554ea[_0x805b('0x46')][_0x805b('0x48')]);var _0x1d18a0={'messageId':_0x1d10ef['message_id']};if(!_0x30cc1e[_0x805b('0x38')]){_0x1d18a0[_0x805b('0x39')]=!![];}return _0x486564['update'](_0x1d18a0);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x49'),util[_0x805b('0x28')](_0x2554ea,{'showHidden':![],'depth':null}));}}else{logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x805b('0x49'),util[_0x805b('0x28')](_0x2554ea,{'showHidden':![],'depth':null}));}})[_0x805b('0x1a')](function(_0x16dd6c){logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),'clickSend',util[_0x805b('0x28')](_0x16dd6c,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x805b('0x4a'):if(_0x30cc1e[_0x805b('0x4b')]&&_0x30cc1e[_0x805b('0x20')]){var _0x3daa40={'dst':_0x17ca49['phone'],'text':_0x17ca49['body'],'src':_0x30cc1e[_0x805b('0x3e')]||_0x30cc1e[_0x805b('0x21')],'url':_0x30cc1e[_0x805b('0x4c')]+_0x805b('0x22')+_0x17ca49['id']+'/status?token='+_0x30cc1e[_0x805b('0x24')]};var _0x56bb3e=util[_0x805b('0x3f')](_0x805b('0x40'),_0x30cc1e['authId'],_0x30cc1e[_0x805b('0x20')]);var _0x5a01de={'method':_0x805b('0x35'),'uri':util[_0x805b('0x3f')](_0x805b('0x4d'),_0x30cc1e[_0x805b('0x4b')]),'body':_0x3daa40,'headers':{'Authorization':util[_0x805b('0x3f')]('Basic\x20%s',new Buffer(_0x56bb3e)[_0x805b('0x43')](_0x805b('0x44')))},'json':!![]};rp(_0x5a01de)[_0x805b('0x17')](function(_0x26577){var _0x134711={'messageId':_0x26577[_0x805b('0x4e')][0x0]};return _0x486564[_0x805b('0x18')](_0x134711);})[_0x805b('0x1a')](function(_0x4fed80){logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x4a'),util[_0x805b('0x28')](_0x4fed80,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),'plivo',_0x805b('0x4f'));}break;case _0x805b('0x50'):if(_0x30cc1e[_0x805b('0x30')]&&_0x30cc1e[_0x805b('0x3d')]){if(_0x30cc1e[_0x805b('0x51')]){var _0x112566={'method':_0x805b('0x35'),'uri':_0x30cc1e[_0x805b('0x51')]+_0x805b('0x52'),'body':{'username':_0x30cc1e[_0x805b('0x30')],'password':_0x30cc1e[_0x805b('0x3d')]},'json':!![]};return rp(_0x112566)[_0x805b('0x17')](function(_0x4a4683){var _0x282145={'method':'POST','uri':_0x30cc1e['baseUrl']+_0x805b('0x53'),'body':{'messages':[{'from':_0x30cc1e[_0x805b('0x21')],'destinations':[{'to':_0x17ca49[_0x805b('0x21')]}],'text':_0x17ca49[_0x805b('0xb')],'notifyUrl':_0x30cc1e[_0x805b('0x4c')]+_0x805b('0x22')+_0x17ca49['id']+_0x805b('0x23')+_0x30cc1e[_0x805b('0x24')],'notifyContentType':_0x805b('0x54'),'callbackData':_0x30cc1e['phone']+';'+_0x17ca49[_0x805b('0xb')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x4a4683[_0x805b('0x24')]},'json':!![]};return rp(_0x282145)['then'](function(_0x2675b5){if(_0x2675b5[_0x805b('0x48')]){var _0x13dd9e={'messageId':_0x2675b5[_0x805b('0x48')][0x0]['messageId']};if(!_0x30cc1e[_0x805b('0x38')]){_0x13dd9e['read']=!![];}return _0x486564[_0x805b('0x18')](_0x13dd9e);}else{return logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x50'),util[_0x805b('0x28')](_0x2675b5,{'showHidden':![],'depth':null}));}});})[_0x805b('0x1a')](function(_0x337198){return logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x50'),util['inspect'](_0x337198,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x50'),_0x805b('0x55'));}}else{logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x50'),_0x805b('0x3a'));}break;case _0x805b('0x56'):var _0x34ee16=require(_0x805b('0x57'));if(_0x30cc1e['apiKey']){var _0x426e1b={};_0x426e1b[_0x805b('0x58')]=_0x30cc1e[_0x805b('0x30')];_0x426e1b['phone']=_0x17ca49[_0x805b('0x21')];_0x426e1b[_0x805b('0x2e')]=_0x30cc1e[_0x805b('0x21')];_0x426e1b[_0x805b('0x59')]=_0x17ca49['body'];_0x426e1b['timestamp']=+new Date();var _0xfd3e4f='';var _0x4896e0='';var _0x5b2af1=Object[_0x805b('0x5a')](_0x426e1b);_0x5b2af1[_0x805b('0x5b')]();for(var _0x3ea14e=0x0;_0x3ea14e<_0x5b2af1['length'];_0x3ea14e++){if(_0xfd3e4f!=''){_0xfd3e4f+='&';}_0xfd3e4f+=_0x5b2af1[_0x3ea14e]+'='+encodeURIComponent(_0x426e1b[_0x5b2af1[_0x3ea14e]]);_0x4896e0+=_0x426e1b[_0x5b2af1[_0x3ea14e]];}_0x4896e0+=_0x30cc1e[_0x805b('0x5c')];_0x4896e0=_0x34ee16[_0x805b('0x5d')]('md5')[_0x805b('0x18')](_0x4896e0)[_0x805b('0x5e')](_0x805b('0x5f'));if(_0xfd3e4f!==''){_0xfd3e4f+='&';}_0xfd3e4f+=_0x805b('0x60')+_0x4896e0;var _0x579aa8={'method':_0x805b('0x32'),'uri':_0x30cc1e[_0x805b('0x51')]+'/external/get/send.php?'+_0xfd3e4f,'json':!![]};return rp(_0x579aa8)[_0x805b('0x17')](function(_0x4f514d){var _0x5dd370=Object[_0x805b('0x5a')](_0x4f514d);if(_0x4f514d[_0x5dd370[0x0]][_0x805b('0x26')]&&parseInt(_0x4f514d[_0x5dd370[0x0]][_0x805b('0x26')])===0x0){var _0x36191d={'messageId':_0x4f514d[_0x5dd370[0x0]][_0x805b('0x61')]};if(!_0x30cc1e[_0x805b('0x38')]){_0x36191d['read']=!![];}return _0x486564[_0x805b('0x18')](_0x36191d);}else{return logger['error'](_0x805b('0x27'),'afterCreate',_0x805b('0x56'),util[_0x805b('0x28')](_0x4f514d[_0x805b('0x26')],{'showHidden':![],'depth':null}));}})[_0x805b('0x1a')](function(_0x52df7b){return logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x56'),util[_0x805b('0x28')](_0x52df7b,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),'csc',_0x805b('0x62'));}break;case _0x805b('0x63'):if(_0x30cc1e['apiKey']){var _0x2548bb={'method':'POST','uri':_0x805b('0x64'),'headers':{'Authorization':_0x30cc1e[_0x805b('0x5c')]},'body':{'content':_0x17ca49['body'],'to':[_0x17ca49[_0x805b('0x21')]],'from':_0x30cc1e['phone'],'binary':![],'clientMessageId':_0x805b('0x65'),'charset':_0x805b('0x66')},'json':!![]};rp(_0x2548bb)[_0x805b('0x17')](function(_0x2bb665){if(!_0x2bb665[_0x805b('0x26')]){var _0x269262={'messageId':_0x2bb665[_0x805b('0x48')][0x0][_0x805b('0x67')]};if(!_0x30cc1e[_0x805b('0x38')]){_0x269262['read']=!![];}return _0x486564[_0x805b('0x18')](_0x269262);}else{return logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x63'),util[_0x805b('0x28')](_0x2bb665[_0x805b('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x8d544d){return logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x805b('0x63'),util[_0x805b('0x28')](_0x8d544d,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x30cc1e['username']&&_0x30cc1e[_0x805b('0x3d')]){var _0x56bb3e=util[_0x805b('0x3f')](_0x805b('0x40'),_0x30cc1e[_0x805b('0x30')],_0x30cc1e[_0x805b('0x3d')]);var _0x5a01de={'method':_0x805b('0x35'),'uri':_0x805b('0x68')+_0x30cc1e[_0x805b('0x69')]+_0x805b('0x6a'),'body':{'to':[_0x17ca49[_0x805b('0x21')]],'text':_0x17ca49['body'],'from':_0x30cc1e[_0x805b('0x21')],'applicationId':_0x30cc1e[_0x805b('0x6b')]},'headers':{'Authorization':util[_0x805b('0x3f')]('Basic\x20%s',new Buffer(_0x56bb3e)[_0x805b('0x43')](_0x805b('0x44')))},'json':!![]};rp(_0x5a01de)['then'](function(_0x171f91){if(_0x171f91['id']){var _0x3b1fc0={'messageId':_0x171f91['id']};return _0x486564[_0x805b('0x18')](_0x3b1fc0);}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x6c'),util[_0x805b('0x28')](_0x171f91,{'showHidden':![],'depth':null}));}})[_0x805b('0x1a')](function(_0x1ef59a){logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x6c'),util['inspect'](_0x1ef59a,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x6c'),_0x805b('0x3a'));}break;case _0x805b('0x6d'):if(_0x30cc1e[_0x805b('0x5c')]){var _0x2c2102={};var _0x579aa8={'method':_0x805b('0x35'),'uri':_0x805b('0x6e'),'headers':{'Authorization':_0x805b('0x6f')+_0x30cc1e[_0x805b('0x5c')],'Content-Type':_0x805b('0x54')},'body':{'from':_0x30cc1e[_0x805b('0x21')],'to':_0x17ca49[_0x805b('0x21')],'text':_0x17ca49['body']},'json':!![]};return rp(_0x579aa8)[_0x805b('0x17')](function(_0x2b05c2){if(_0x2b05c2['code']==0xca){_0x2c2102[_0x805b('0x70')]=_0x2b05c2;var _0x14004d={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x805b('0x6f')+_0x30cc1e[_0x805b('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x2c2102[_0x805b('0x70')]['refid']},'json':!![]};return rp(_0x14004d)[_0x805b('0x17')](function(_0x30b1c6){_0x2c2102['status']=_0x30b1c6;var _0x517c61={'messageId':_0x2c2102[_0x805b('0x70')]['refid'],'read':!![]};return _0x486564[_0x805b('0x18')](_0x517c61);});}else{return logger['error'](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x6d'),util['inspect'](_0x2b05c2,{'showHidden':![],'depth':null}));}})[_0x805b('0x1a')](function(_0x2c4544){return logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x6d'),util[_0x805b('0x28')](_0x2c4544,{'showHidden':![],'depth':null}));});}else{return logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x6d'),_0x805b('0x71'));}break;}}})[_0x805b('0x72')](function(){_0x526440();});}else{_0x526440();}}},'charset':_0x805b('0x73'),'collate':_0x805b('0x74')});}; \ No newline at end of file +var _0x4633=['https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','update','createdAt','catch','find','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','user_key','then','total_sent','internal_order_id','deliveryReport','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','length','createHash','md5','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x4633,0x189));var _0x3463=function(_0x31eca7,_0x5d8a6b){_0x31eca7=_0x31eca7-0x0;var _0x7c2dca=_0x4633[_0x31eca7];return _0x7c2dca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3463('0x0'))(_0x3463('0x1'));var moment=require('moment');var BPromise=require(_0x3463('0x2'));var rp=require(_0x3463('0x3'));var fs=require('fs');var path=require(_0x3463('0x4'));var rimraf=require(_0x3463('0x5'));var config=require(_0x3463('0x6'));var attributes=require(_0x3463('0x7'));module['exports']=function(_0x4a2931,_0x43fb0f){return _0x4a2931['define'](_0x3463('0x8'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x3463('0x9'),'fields':[_0x3463('0x9')]},{'name':_0x3463('0xa'),'fields':[_0x3463('0xb')],'type':_0x3463('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x37f95c,_0x5c0791,_0x4b6843){var _0x13e22f=_0x4a2931[_0x3463('0xd')];var _0x559154=_0x37f95c[_0x3463('0xe')]({'plain':!![]});if(_0x559154[_0x3463('0xf')]['toLowerCase']()==='in'||_0x559154[_0x3463('0xf')][_0x3463('0x10')]()===_0x3463('0x11')&&!_0x559154[_0x3463('0x12')]&&!_[_0x3463('0x13')](_0x559154[_0x3463('0x14')])&&!_[_0x3463('0x13')](_0x559154[_0x3463('0x15')])){_0x13e22f[_0x3463('0x16')]['findOne']({'where':{'id':_0x559154[_0x3463('0x15')]}})['then'](function(_0x12778c){if(_0x12778c){_0x12778c[_0x3463('0x17')]({'lastMsgAt':_0x559154[_0x3463('0x18')],'lastMsgDirection':_0x559154[_0x3463('0xf')][_0x3463('0x10')]()});}})[_0x3463('0x19')](function(_0x1e5e80){console['error'](_0x1e5e80);});}if(_0x559154[_0x3463('0xf')]==='out'&&!_0x559154[_0x3463('0x12')]){var _0x2df80e;_0x13e22f['SmsAccount'][_0x3463('0x1a')]({'where':{'id':_0x559154['SmsAccountId']},'raw':!![]})['then'](function(_0x3e3c36){_0x2df80e=_0x3e3c36;if(_0x2df80e&&_0x2df80e['type']){switch(_0x2df80e[_0x3463('0x1b')]){case'twilio':var _0x15b73e=require(_0x3463('0x1c'));if(_0x2df80e[_0x3463('0x1d')]&&_0x2df80e[_0x3463('0x1e')]&&_0x2df80e[_0x3463('0x1f')]){var _0x29a205=new _0x15b73e(_0x2df80e['accountSid'],_0x2df80e[_0x3463('0x1e')]);_0x29a205[_0x3463('0x20')]['create']({'body':_0x559154[_0x3463('0xb')],'to':_0x559154[_0x3463('0x1f')],'from':_0x2df80e['phone'],'statusCallback':_0x2df80e[_0x3463('0x21')]+_0x3463('0x22')+_0x559154['id']+_0x3463('0x23')+_0x2df80e[_0x3463('0x24')]})['then'](function(_0x3d6dc6){if(_0x3d6dc6['sid']){return _0x37f95c['update']({'messageId':_0x3d6dc6['sid']});}})[_0x3463('0x19')](function(_0x5d3cd4){logger['error'](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x1c'),util[_0x3463('0x27')](_0x5d3cd4,{'showHidden':![],'depth':null}));});}else{logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3463('0x29'):var _0x5cd2ff=_0x3463('0x2a');if(_0x2df80e[_0x3463('0x2b')]&&_0x2df80e[_0x3463('0x2c')]){var _0x3d7424={'recipient':[_0x559154['phone']],'message':_0x559154[_0x3463('0xb')],'message_type':_0x2df80e[_0x3463('0x2d')]};if(_0x2df80e[_0x3463('0x2d')]&&_0x2df80e[_0x3463('0x2d')]!=='SI'){_0x3d7424[_0x3463('0x2e')]=_0x2df80e[_0x3463('0x1f')];}var _0x2cddc2={'url':_0x5cd2ff+_0x3463('0x2f')+_0x2df80e[_0x3463('0x2b')]+_0x3463('0x30')+_0x2df80e[_0x3463('0x2c')],'method':_0x3463('0x31')};rp(_0x2cddc2)['then'](function(_0x4db9a7){var _0x38974f=_0x4db9a7[_0x3463('0x32')](';');var _0x26f04b={'user_key':_0x38974f[0x0],'session_key':_0x38974f[0x1]};_0x2cddc2={'url':_0x5cd2ff+_0x3463('0x33'),'method':'POST','headers':{'user_key':_0x26f04b[_0x3463('0x34')],'Session_key':_0x26f04b['session_key']},'json':!![],'body':_0x3d7424};return rp(_0x2cddc2);})[_0x3463('0x35')](function(_0x1dac55){if(_0x1dac55[_0x3463('0x36')]>=0x1){var _0xee9917={'messageId':_0x1dac55[_0x3463('0x37')]};if(_0x2df80e[_0x3463('0x2d')]!=='GP'||!_0x2df80e[_0x3463('0x38')]){_0xee9917['read']=!![];}return _0x37f95c[_0x3463('0x17')](_0xee9917);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3463('0x26'),_0x3463('0x29'),util['inspect'](_0x1dac55,{'showHidden':![],'depth':null}));}})[_0x3463('0x19')](function(_0x4c2fc5){return logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x29'),util['inspect'](_0x4c2fc5,{'showHidden':![],'depth':null}));});}else{logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x29'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3463('0x39'):if(_0x2df80e[_0x3463('0x1e')]){var _0x405312={'recipient':_0x559154[_0x3463('0x1f')],'message':_0x559154[_0x3463('0xb')],'sender':_0x2df80e[_0x3463('0x3a')]||_0x2df80e[_0x3463('0x1f')],'authorization':_0x2df80e[_0x3463('0x1e')]};var _0x5c0791={'method':_0x3463('0x3b'),'uri':_0x3463('0x3c'),'body':_0x405312,'json':!![]};rp(_0x5c0791)['then'](function(_0x50f8da){var _0x17724a={'messageId':_0x50f8da[_0x3463('0x3d')]};if(!_0x2df80e['deliveryReport']){_0x17724a[_0x3463('0x3e')]=!![];}return _0x37f95c[_0x3463('0x17')](_0x17724a);})[_0x3463('0x19')](function(_0x368056){logger[_0x3463('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3463('0x39'),util[_0x3463('0x27')](_0x368056,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3463('0x26'),_0x3463('0x39'),_0x3463('0x3f'));}break;case _0x3463('0x40'):if(_0x2df80e['username']&&_0x2df80e[_0x3463('0x2c')]){var _0x405312={'messages':[{'source':_0x3463('0x41'),'to':_0x559154[_0x3463('0x1f')],'body':_0x559154['body'],'from':_0x2df80e[_0x3463('0x3a')]||_0x2df80e[_0x3463('0x1f')]}]};var _0x20ee4f=util[_0x3463('0x42')](_0x3463('0x43'),_0x2df80e[_0x3463('0x2b')],_0x2df80e[_0x3463('0x2c')]);var _0x5c0791={'method':_0x3463('0x3b'),'uri':_0x3463('0x44'),'body':_0x405312,'headers':{'Authorization':util[_0x3463('0x42')](_0x3463('0x45'),new Buffer(_0x20ee4f)[_0x3463('0x46')](_0x3463('0x47')))},'json':!![]};rp(_0x5c0791)[_0x3463('0x35')](function(_0x135671){if(_0x135671[_0x3463('0x48')]>=0xc8&&_0x135671[_0x3463('0x48')]<=0xce){if(_0x135671['data']&&_0x135671[_0x3463('0x49')][_0x3463('0x4a')]>0x0){var _0x58366c=_[_0x3463('0x4b')](_0x135671[_0x3463('0x49')]['messages']);var _0x32e072={'messageId':_0x58366c[_0x3463('0x4c')]};if(!_0x2df80e[_0x3463('0x38')]){_0x32e072[_0x3463('0x3e')]=!![];}return _0x37f95c[_0x3463('0x17')](_0x32e072);}else{logger[_0x3463('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3463('0x26'),_0x3463('0x4d'),util[_0x3463('0x27')](_0x135671,{'showHidden':![],'depth':null}));}}else{logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x4d'),util[_0x3463('0x27')](_0x135671,{'showHidden':![],'depth':null}));}})[_0x3463('0x19')](function(_0x5bc7aa){logger[_0x3463('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3463('0x26'),_0x3463('0x4d'),util['inspect'](_0x5bc7aa,{'showHidden':![],'depth':null}));});}else{logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x4d'),_0x3463('0x4e'));}break;case _0x3463('0x4f'):if(_0x2df80e[_0x3463('0x50')]&&_0x2df80e[_0x3463('0x1e')]){var _0x405312={'dst':_0x559154[_0x3463('0x1f')],'text':_0x559154[_0x3463('0xb')],'src':_0x2df80e[_0x3463('0x3a')]||_0x2df80e[_0x3463('0x1f')],'url':_0x2df80e[_0x3463('0x21')]+_0x3463('0x22')+_0x559154['id']+_0x3463('0x23')+_0x2df80e[_0x3463('0x24')]};var _0x20ee4f=util[_0x3463('0x42')](_0x3463('0x43'),_0x2df80e[_0x3463('0x50')],_0x2df80e[_0x3463('0x1e')]);var _0x5c0791={'method':'POST','uri':util[_0x3463('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2df80e[_0x3463('0x50')]),'body':_0x405312,'headers':{'Authorization':util['format'](_0x3463('0x45'),new Buffer(_0x20ee4f)[_0x3463('0x46')](_0x3463('0x47')))},'json':!![]};rp(_0x5c0791)[_0x3463('0x35')](function(_0x355e88){var _0x5962a4={'messageId':_0x355e88[_0x3463('0x51')][0x0]};return _0x37f95c[_0x3463('0x17')](_0x5962a4);})[_0x3463('0x19')](function(_0x21da9a){logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),'plivo',util[_0x3463('0x27')](_0x21da9a,{'showHidden':![],'depth':null}));});}else{logger[_0x3463('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3463('0x26'),_0x3463('0x4f'),_0x3463('0x52'));}break;case _0x3463('0x53'):if(_0x2df80e[_0x3463('0x2b')]&&_0x2df80e[_0x3463('0x2c')]){if(_0x2df80e[_0x3463('0x54')]){var _0x4db210={'method':_0x3463('0x3b'),'uri':_0x2df80e[_0x3463('0x54')]+_0x3463('0x55'),'body':{'username':_0x2df80e[_0x3463('0x2b')],'password':_0x2df80e['password']},'json':!![]};return rp(_0x4db210)[_0x3463('0x35')](function(_0x225603){var _0x1a3ff3={'method':_0x3463('0x3b'),'uri':_0x2df80e[_0x3463('0x54')]+_0x3463('0x56'),'body':{'messages':[{'from':_0x2df80e['phone'],'destinations':[{'to':_0x559154[_0x3463('0x1f')]}],'text':_0x559154[_0x3463('0xb')],'notifyUrl':_0x2df80e[_0x3463('0x21')]+'/api/sms/messages/'+_0x559154['id']+_0x3463('0x23')+_0x2df80e[_0x3463('0x24')],'notifyContentType':_0x3463('0x57'),'callbackData':_0x2df80e['phone']+';'+_0x559154[_0x3463('0xb')]}]},'headers':{'Authorization':_0x3463('0x58')+_0x225603['token']},'json':!![]};return rp(_0x1a3ff3)[_0x3463('0x35')](function(_0x6f1ef8){if(_0x6f1ef8['messages']){var _0x4709d8={'messageId':_0x6f1ef8[_0x3463('0x20')][0x0][_0x3463('0x9')]};if(!_0x2df80e[_0x3463('0x38')]){_0x4709d8[_0x3463('0x3e')]=!![];}return _0x37f95c[_0x3463('0x17')](_0x4709d8);}else{return logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x53'),util[_0x3463('0x27')](_0x6f1ef8,{'showHidden':![],'depth':null}));}});})[_0x3463('0x19')](function(_0x1bed53){return logger[_0x3463('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3463('0x26'),_0x3463('0x53'),util[_0x3463('0x27')](_0x1bed53,{'showHidden':![],'depth':null}));});}else{logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),'infobip',_0x3463('0x59'));}}else{logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),'infobip',_0x3463('0x4e'));}break;case _0x3463('0x5a'):var _0x3ec7d8=require(_0x3463('0x5b'));if(_0x2df80e[_0x3463('0x5c')]){var _0x40060c={};_0x40060c[_0x3463('0x5d')]=_0x2df80e[_0x3463('0x2b')];_0x40060c[_0x3463('0x1f')]=_0x559154[_0x3463('0x1f')];_0x40060c[_0x3463('0x2e')]=_0x2df80e[_0x3463('0x1f')];_0x40060c[_0x3463('0x5e')]=_0x559154['body'];_0x40060c[_0x3463('0x5f')]=+new Date();var _0x2da672='';var _0x15a526='';var _0x5bfebb=Object['keys'](_0x40060c);_0x5bfebb[_0x3463('0x60')]();for(var _0x52a37f=0x0;_0x52a37f<_0x5bfebb[_0x3463('0x61')];_0x52a37f++){if(_0x2da672!=''){_0x2da672+='&';}_0x2da672+=_0x5bfebb[_0x52a37f]+'='+encodeURIComponent(_0x40060c[_0x5bfebb[_0x52a37f]]);_0x15a526+=_0x40060c[_0x5bfebb[_0x52a37f]];}_0x15a526+=_0x2df80e[_0x3463('0x5c')];_0x15a526=_0x3ec7d8[_0x3463('0x62')](_0x3463('0x63'))['update'](_0x15a526)['digest'](_0x3463('0x64'));if(_0x2da672!==''){_0x2da672+='&';}_0x2da672+=_0x3463('0x65')+_0x15a526;var _0x2cddc2={'method':_0x3463('0x31'),'uri':_0x2df80e['baseUrl']+_0x3463('0x66')+_0x2da672,'json':!![]};return rp(_0x2cddc2)['then'](function(_0x48b325){var _0x3f5d3b=Object[_0x3463('0x67')](_0x48b325);if(_0x48b325[_0x3f5d3b[0x0]]['error']&&parseInt(_0x48b325[_0x3f5d3b[0x0]][_0x3463('0x28')])===0x0){var _0x52a5a4={'messageId':_0x48b325[_0x3f5d3b[0x0]][_0x3463('0x68')]};if(!_0x2df80e['deliveryReport']){_0x52a5a4['read']=!![];}return _0x37f95c[_0x3463('0x17')](_0x52a5a4);}else{return logger[_0x3463('0x28')](_0x3463('0x25'),'afterCreate',_0x3463('0x5a'),util[_0x3463('0x27')](_0x48b325[_0x3463('0x28')],{'showHidden':![],'depth':null}));}})[_0x3463('0x19')](function(_0x3bf966){return logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x5a'),util[_0x3463('0x27')](_0x3bf966,{'showHidden':![],'depth':null}));});}else{logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x5a'),_0x3463('0x69'));}break;case _0x3463('0x6a'):if(_0x2df80e[_0x3463('0x5c')]){var _0x43a2ab={'method':_0x3463('0x3b'),'uri':_0x3463('0x6b'),'headers':{'Authorization':_0x2df80e[_0x3463('0x5c')]},'body':{'content':_0x559154[_0x3463('0xb')],'to':[_0x559154[_0x3463('0x1f')]],'from':_0x2df80e[_0x3463('0x1f')],'binary':![],'clientMessageId':'uuid','charset':_0x3463('0x6c')},'json':!![]};rp(_0x43a2ab)['then'](function(_0x45df28){if(!_0x45df28[_0x3463('0x28')]){var _0x4b383c={'messageId':_0x45df28['messages'][0x0][_0x3463('0x6d')]};if(!_0x2df80e[_0x3463('0x38')]){_0x4b383c['read']=!![];}return _0x37f95c[_0x3463('0x17')](_0x4b383c);}else{return logger[_0x3463('0x28')](_0x3463('0x25'),'afterCreate',_0x3463('0x6a'),util[_0x3463('0x27')](_0x45df28['error'],{'showHidden':![],'depth':null}));}})[_0x3463('0x19')](function(_0x2ae44b){return logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),'clickatell',util[_0x3463('0x27')](_0x2ae44b,{'showHidden':![],'depth':null}));});}else{logger[_0x3463('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3463('0x26'),'clickatell',_0x3463('0x69'));}break;case _0x3463('0x6e'):if(_0x2df80e[_0x3463('0x2b')]&&_0x2df80e[_0x3463('0x2c')]){var _0x20ee4f=util['format']('%s:%s',_0x2df80e[_0x3463('0x2b')],_0x2df80e[_0x3463('0x2c')]);var _0x5c0791={'method':_0x3463('0x3b'),'uri':_0x3463('0x6f')+_0x2df80e[_0x3463('0x70')]+_0x3463('0x71'),'body':{'to':[_0x559154['phone']],'text':_0x559154[_0x3463('0xb')],'from':_0x2df80e[_0x3463('0x1f')],'applicationId':_0x2df80e[_0x3463('0x72')]},'headers':{'Authorization':util['format'](_0x3463('0x45'),new Buffer(_0x20ee4f)[_0x3463('0x46')]('base64'))},'json':!![]};rp(_0x5c0791)[_0x3463('0x35')](function(_0x42c4df){if(_0x42c4df['id']){var _0x1afd0c={'messageId':_0x42c4df['id']};return _0x37f95c['update'](_0x1afd0c);}else{logger[_0x3463('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3463('0x6e'),util[_0x3463('0x27')](_0x42c4df,{'showHidden':![],'depth':null}));}})['catch'](function(_0x511c1b){logger['error'](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x6e'),util[_0x3463('0x27')](_0x511c1b,{'showHidden':![],'depth':null}));});}else{logger[_0x3463('0x28')](_0x3463('0x25'),_0x3463('0x26'),_0x3463('0x6e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3463('0x73'):if(_0x2df80e[_0x3463('0x5c')]){var _0x451de0={};var _0x2cddc2={'method':_0x3463('0x3b'),'uri':_0x3463('0x74'),'headers':{'Authorization':'Bearer\x20'+_0x2df80e[_0x3463('0x5c')],'Content-Type':_0x3463('0x57')},'body':{'from':_0x2df80e['phone'],'to':_0x559154['phone'],'text':_0x559154['body']},'json':!![]};return rp(_0x2cddc2)[_0x3463('0x35')](function(_0x3be164){if(_0x3be164[_0x3463('0x75')]==0xca){_0x451de0[_0x3463('0x76')]=_0x3be164;var _0xfd8f3d={'method':_0x3463('0x3b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x3463('0x77')+_0x2df80e['apiKey'],'Content-Type':_0x3463('0x57')},'body':{'refid':_0x451de0[_0x3463('0x76')][_0x3463('0x78')]},'json':!![]};return rp(_0xfd8f3d)['then'](function(_0x14302c){_0x451de0[_0x3463('0x79')]=_0x14302c;var _0x40b939={'messageId':_0x451de0[_0x3463('0x76')][_0x3463('0x78')],'read':!![]};return _0x37f95c[_0x3463('0x17')](_0x40b939);});}else{return logger[_0x3463('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3463('0x73'),util[_0x3463('0x27')](_0x3be164,{'showHidden':![],'depth':null}));}})['catch'](function(_0x8af194){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3463('0x26'),'intelepeer',util[_0x3463('0x27')](_0x8af194,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x3463('0x25'),'afterCreate','intelepeer',_0x3463('0x7a'));}break;}}})['finally'](function(){_0x4b6843();});}else{_0x4b6843();}}},'charset':_0x3463('0x7b'),'collate':_0x3463('0x7c')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c0f7a0a..8be2664 100644 --- a/server/api/smsMessage/smsMessage.rpc.js +++ b/server/api/smsMessage/smsMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38f0=['socket.io-emitter','./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x38f0,0x114));var _0x038f=function(_0x3293c1,_0x1add7d){_0x3293c1=_0x3293c1-0x0;var _0x3fc954=_0x38f0[_0x3293c1];return _0x3fc954;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x038f('0x0'));var BPromise=require(_0x038f('0x1'));var rs=require(_0x038f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x038f('0x3'));var logger=require(_0x038f('0x4'))(_0x038f('0x5'));var config=require(_0x038f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x038f('0x7')][_0x038f('0x8')]({'port':0x232a});config['redis']=_[_0x038f('0x9')](config[_0x038f('0xa')],{'host':_0x038f('0xb'),'port':0x18eb});var socket=require(_0x038f('0xc'))(new Redis(config[_0x038f('0xa')]));require(_0x038f('0xd'))['register'](socket);function respondWithRpcPromise(_0x58a417,_0x4db23c,_0x2394b7){return new BPromise(function(_0x7ff248,_0x30d650){return client[_0x038f('0xe')](_0x58a417,_0x2394b7)['then'](function(_0x5c1d0c){logger[_0x038f('0xf')](_0x038f('0x10'),_0x4db23c,_0x038f('0x11'));logger[_0x038f('0x12')](_0x038f('0x13'),_0x4db23c,_0x038f('0x11'),JSON[_0x038f('0x14')](_0x5c1d0c));if(_0x5c1d0c['error']){if(_0x5c1d0c[_0x038f('0x15')][_0x038f('0x16')]===0x1f4){logger['error'](_0x038f('0x10'),_0x4db23c,_0x5c1d0c[_0x038f('0x15')][_0x038f('0x17')]);return _0x30d650(_0x5c1d0c[_0x038f('0x15')][_0x038f('0x17')]);}logger[_0x038f('0x15')]('SmsMessage,\x20%s,\x20%s',_0x4db23c,_0x5c1d0c[_0x038f('0x15')][_0x038f('0x17')]);return _0x7ff248(_0x5c1d0c[_0x038f('0x15')][_0x038f('0x17')]);}else{logger[_0x038f('0xf')](_0x038f('0x10'),_0x4db23c,'request\x20sent');_0x7ff248(_0x5c1d0c[_0x038f('0x18')][_0x038f('0x17')]);}})[_0x038f('0x19')](function(_0x26a8be){logger[_0x038f('0x15')]('SmsMessage,\x20%s,\x20%s',_0x4db23c,_0x26a8be);_0x30d650(_0x26a8be);});});}exports[_0x038f('0x1a')]=function(_0x53480f){var _0x513f2a=this;return new Promise(function(_0x32199c,_0x8c9cef){return db[_0x038f('0x1b')][_0x038f('0x1c')](_0x53480f[_0x038f('0x1d')],{'raw':_0x53480f[_0x038f('0x1e')]?_0x53480f[_0x038f('0x1e')][_0x038f('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1552b1){logger[_0x038f('0xf')](_0x038f('0x1a'),_0x53480f);logger[_0x038f('0x12')](_0x038f('0x1a'),_0x53480f,JSON['stringify'](_0x1552b1));_0x32199c(_0x1552b1);})[_0x038f('0x19')](function(_0x41b3d3){logger['error'](_0x038f('0x1a'),_0x41b3d3[_0x038f('0x17')],_0x53480f);_0x8c9cef(_0x513f2a[_0x038f('0x15')](0x1f4,_0x41b3d3[_0x038f('0x17')]));});});}; \ No newline at end of file +var _0x36a9=['info','catch','SmsMessage','body','options','raw','then','CreateSmsMessage','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','./smsMessage.socket','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x2df9af,_0xef6beb){var _0x19bc2c=function(_0x24989e){while(--_0x24989e){_0x2df9af['push'](_0x2df9af['shift']());}};_0x19bc2c(++_0xef6beb);}(_0x36a9,0x1ee));var _0x936a=function(_0x58fd80,_0x41c3e3){_0x58fd80=_0x58fd80-0x0;var _0x158e6e=_0x36a9[_0x58fd80];return _0x158e6e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x936a('0x0'));var BPromise=require(_0x936a('0x1'));var rs=require(_0x936a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x936a('0x3'))['db'];var utils=require(_0x936a('0x4'));var logger=require(_0x936a('0x5'))(_0x936a('0x6'));var config=require('../../config/environment');var jayson=require(_0x936a('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x936a('0x8')]=_['defaults'](config[_0x936a('0x8')],{'host':_0x936a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x936a('0x8')]));require(_0x936a('0xa'))[_0x936a('0xb')](socket);function respondWithRpcPromise(_0x4915b3,_0x46664e,_0x4bd5a5){return new BPromise(function(_0x36c0f9,_0x2f7c55){return client[_0x936a('0xc')](_0x4915b3,_0x4bd5a5)['then'](function(_0x394681){logger['info'](_0x936a('0xd'),_0x46664e,_0x936a('0xe'));logger[_0x936a('0xf')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x46664e,_0x936a('0xe'),JSON[_0x936a('0x10')](_0x394681));if(_0x394681['error']){if(_0x394681[_0x936a('0x11')]['code']===0x1f4){logger[_0x936a('0x11')](_0x936a('0xd'),_0x46664e,_0x394681[_0x936a('0x11')]['message']);return _0x2f7c55(_0x394681[_0x936a('0x11')]['message']);}logger['error'](_0x936a('0xd'),_0x46664e,_0x394681[_0x936a('0x11')]['message']);return _0x36c0f9(_0x394681[_0x936a('0x11')][_0x936a('0x12')]);}else{logger[_0x936a('0x13')](_0x936a('0xd'),_0x46664e,'request\x20sent');_0x36c0f9(_0x394681['result'][_0x936a('0x12')]);}})[_0x936a('0x14')](function(_0x55865d){logger[_0x936a('0x11')](_0x936a('0xd'),_0x46664e,_0x55865d);_0x2f7c55(_0x55865d);});});}exports['CreateSmsMessage']=function(_0x17237f){var _0x53761a=this;return new Promise(function(_0x53d16d,_0x3e5045){return db[_0x936a('0x15')]['create'](_0x17237f[_0x936a('0x16')],{'raw':_0x17237f['options']?_0x17237f[_0x936a('0x17')][_0x936a('0x18')]===undefined?!![]:![]:!![]})[_0x936a('0x19')](function(_0x56c7be){logger[_0x936a('0x13')](_0x936a('0x1a'),_0x17237f);logger[_0x936a('0xf')](_0x936a('0x1a'),_0x17237f,JSON[_0x936a('0x10')](_0x56c7be));_0x53d16d(_0x56c7be);})[_0x936a('0x14')](function(_0x27cd99){logger[_0x936a('0x11')](_0x936a('0x1a'),_0x27cd99[_0x936a('0x12')],_0x17237f);_0x3e5045(_0x53761a['error'](0x1f4,_0x27cd99[_0x936a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index bc024dd..9d88b74 100644 --- a/server/api/smsMessage/smsMessage.socket.js +++ b/server/api/smsMessage/smsMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4aa5=['length','smsMessage:','./smsMessage.events','save','remove','emit','removeListener','register'];(function(_0x16566d,_0x532597){var _0x1e235b=function(_0x5cc12f){while(--_0x5cc12f){_0x16566d['push'](_0x16566d['shift']());}};_0x1e235b(++_0x532597);}(_0x4aa5,0x1da));var _0x54aa=function(_0x32d54b,_0x3fd338){_0x32d54b=_0x32d54b-0x0;var _0x3d8958=_0x4aa5[_0x32d54b];return _0x3d8958;};'use strict';var SmsMessageEvents=require(_0x54aa('0x0'));var events=[_0x54aa('0x1'),_0x54aa('0x2'),'update'];function createListener(_0xd27791,_0x5e0bcf){return function(_0x21e386){_0x5e0bcf[_0x54aa('0x3')](_0xd27791,_0x21e386);};}function removeListener(_0x32a87e,_0x1d1204){return function(){SmsMessageEvents[_0x54aa('0x4')](_0x32a87e,_0x1d1204);};}exports[_0x54aa('0x5')]=function(_0x1380f7){for(var _0x46162c=0x0,_0xa1234f=events[_0x54aa('0x6')];_0x46162c<_0xa1234f;_0x46162c++){var _0x40245d=events[_0x46162c];var _0x622f4f=createListener(_0x54aa('0x7')+_0x40245d,_0x1380f7);SmsMessageEvents['on'](_0x40245d,_0x622f4f);}}; \ No newline at end of file +var _0xf6be=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x5cf3a3,_0x29327c){var _0x349b78=function(_0x465240){while(--_0x465240){_0x5cf3a3['push'](_0x5cf3a3['shift']());}};_0x349b78(++_0x29327c);}(_0xf6be,0xbd));var _0xef6b=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0xf6be[_0x5d6e30];return _0x3d3f3b;};'use strict';var SmsMessageEvents=require(_0xef6b('0x0'));var events=['save',_0xef6b('0x1'),_0xef6b('0x2')];function createListener(_0x3dcabc,_0x2bddd9){return function(_0x2d1b65){_0x2bddd9[_0xef6b('0x3')](_0x3dcabc,_0x2d1b65);};}function removeListener(_0x1a8e9d,_0x74fa95){return function(){SmsMessageEvents[_0xef6b('0x4')](_0x1a8e9d,_0x74fa95);};}exports[_0xef6b('0x5')]=function(_0x4332f2){for(var _0x15dd2b=0x0,_0x403ced=events[_0xef6b('0x6')];_0x15dd2b<_0x403ced;_0x15dd2b++){var _0x32cf89=events[_0x15dd2b];var _0x22477d=createListener(_0xef6b('0x7')+_0x32cf89,_0x4332f2);SmsMessageEvents['on'](_0x32cf89,_0x22477d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8dd319d..c347a41 100644 --- a/server/api/smsQueue/index.js +++ b/server/api/smsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef1f=['addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./smsQueue.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x1d889e,_0x3cf023){var _0x37c76b=function(_0x316a3b){while(--_0x316a3b){_0x1d889e['push'](_0x1d889e['shift']());}};_0x37c76b(++_0x3cf023);}(_0xef1f,0xcb));var _0xfef1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xef1f[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xfef1('0x0'));var util=require(_0xfef1('0x1'));var path=require(_0xfef1('0x2'));var timeout=require(_0xfef1('0x3'));var express=require(_0xfef1('0x4'));var router=express['Router']();var fs_extra=require(_0xfef1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfef1('0x6'));var config=require('../../config/environment');var controller=require(_0xfef1('0x7'));router[_0xfef1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfef1('0x8')](_0xfef1('0x9'),auth['isAuthenticated'](),controller[_0xfef1('0xa')]);router['get'](_0xfef1('0xb'),auth[_0xfef1('0xc')](),controller[_0xfef1('0xd')]);router[_0xfef1('0x8')](_0xfef1('0xe'),auth[_0xfef1('0xc')](),controller[_0xfef1('0xf')]);router['get'](_0xfef1('0x10'),auth[_0xfef1('0xc')](),controller['getTeams']);router[_0xfef1('0x8')](_0xfef1('0x11'),auth[_0xfef1('0xc')](),controller[_0xfef1('0x12')]);router[_0xfef1('0x13')]('/',auth[_0xfef1('0xc')](),controller[_0xfef1('0x14')]);router[_0xfef1('0x13')](_0xfef1('0x10'),auth['isAuthenticated'](),controller[_0xfef1('0x15')]);router['post'](_0xfef1('0x11'),auth[_0xfef1('0xc')](),controller[_0xfef1('0x16')]);router[_0xfef1('0x17')]('/:id',auth[_0xfef1('0xc')](),controller[_0xfef1('0x18')]);router[_0xfef1('0x19')](_0xfef1('0xb'),auth['isAuthenticated'](),controller[_0xfef1('0x1a')]);router['delete'](_0xfef1('0x10'),auth[_0xfef1('0xc')](),controller[_0xfef1('0x1b')]);router[_0xfef1('0x19')](_0xfef1('0x11'),auth[_0xfef1('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe647=['removeTeams','removeAgents','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','get','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','put','/:id','delete','destroy'];(function(_0x5dd0fa,_0x1fe623){var _0x29ddea=function(_0x57d591){while(--_0x57d591){_0x5dd0fa['push'](_0x5dd0fa['shift']());}};_0x29ddea(++_0x1fe623);}(_0xe647,0x161));var _0x7e64=function(_0x1f5677,_0xb89dd3){_0x1f5677=_0x1f5677-0x0;var _0x2c0e60=_0xe647[_0x1f5677];return _0x2c0e60;};'use strict';var multer=require(_0x7e64('0x0'));var util=require('util');var path=require(_0x7e64('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7e64('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7e64('0x3'));var interaction=require(_0x7e64('0x4'));var config=require(_0x7e64('0x5'));var controller=require(_0x7e64('0x6'));router['get']('/',auth[_0x7e64('0x7')](),controller['index']);router[_0x7e64('0x8')](_0x7e64('0x9'),auth[_0x7e64('0x7')](),controller['describe']);router[_0x7e64('0x8')]('/:id',auth[_0x7e64('0x7')](),controller[_0x7e64('0xa')]);router[_0x7e64('0x8')](_0x7e64('0xb'),auth[_0x7e64('0x7')](),controller[_0x7e64('0xc')]);router[_0x7e64('0x8')](_0x7e64('0xd'),auth[_0x7e64('0x7')](),controller['getTeams']);router[_0x7e64('0x8')](_0x7e64('0xe'),auth['isAuthenticated'](),controller[_0x7e64('0xf')]);router['post']('/',auth[_0x7e64('0x7')](),controller[_0x7e64('0x10')]);router[_0x7e64('0x11')](_0x7e64('0xd'),auth['isAuthenticated'](),controller['addTeams']);router[_0x7e64('0x11')](_0x7e64('0xe'),auth[_0x7e64('0x7')](),controller['addAgents']);router[_0x7e64('0x12')](_0x7e64('0x13'),auth[_0x7e64('0x7')](),controller['update']);router[_0x7e64('0x14')](_0x7e64('0x13'),auth[_0x7e64('0x7')](),controller[_0x7e64('0x15')]);router[_0x7e64('0x14')](_0x7e64('0xd'),auth[_0x7e64('0x7')](),controller[_0x7e64('0x16')]);router[_0x7e64('0x14')](_0x7e64('0xe'),auth['isAuthenticated'](),controller[_0x7e64('0x17')]);module[_0x7e64('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 18250c5..86775a7 100644 --- a/server/api/smsQueue/smsQueue.attributes.js +++ b/server/api/smsQueue/smsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb48b=['sequelize','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x56cb2d,_0x3a642c){var _0x1ecf61=function(_0xc6da4e){while(--_0xc6da4e){_0x56cb2d['push'](_0x56cb2d['shift']());}};_0x1ecf61(++_0x3a642c);}(_0xb48b,0x9a));var _0xbb48=function(_0x279f18,_0x1bd627){_0x279f18=_0x279f18-0x0;var _0x51a5ad=_0xb48b[_0x279f18];return _0x51a5ad;};'use strict';var Sequelize=require(_0xbb48('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb48('0x1')],'unique':_0xbb48('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb48('0x1')]},'timeout':{'type':Sequelize[_0xbb48('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb48('0x4')]('rrmemory',_0xbb48('0x5'),_0xbb48('0x6'))}}; \ No newline at end of file +var _0xefab=['INTEGER','ENUM','rrmemory','beepall','sequelize','STRING','name'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0xefab,0x9e));var _0xbefa=function(_0x122633,_0x22057b){_0x122633=_0x122633-0x0;var _0x2d02e5=_0xefab[_0x122633];return _0x2d02e5;};'use strict';var Sequelize=require(_0xbefa('0x0'));module['exports']={'name':{'type':Sequelize[_0xbefa('0x1')],'unique':_0xbefa('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbefa('0x1')]},'timeout':{'type':Sequelize[_0xbefa('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbefa('0x4')](_0xbefa('0x5'),_0xbefa('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 165b944..391ae82 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x0b0e[_0x571c1d];return _0x33c609;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x48de4d,_0x5c4494){var _0xbb9b04=function(_0x374aaa){while(--_0x374aaa){_0x48de4d['push'](_0x48de4d['shift']());}};_0xbb9b04(++_0x5c4494);}(_0xdb28,0x106));var _0x8db2=function(_0x564b2a,_0x59967a){_0x564b2a=_0x564b2a-0x0;var _0x526c7b=_0xdb28[_0x564b2a];return _0x526c7b;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index df0c06c..bef477e 100644 --- a/server/api/smsQueue/smsQueue.events.js +++ b/server/api/smsQueue/smsQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb430=['hasOwnProperty','exports','events','setMaxListeners','save','update','emit'];(function(_0x13c0bf,_0x4dee02){var _0x3ea5da=function(_0x56b1cd){while(--_0x56b1cd){_0x13c0bf['push'](_0x13c0bf['shift']());}};_0x3ea5da(++_0x4dee02);}(_0xb430,0x10c));var _0x0b43=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xb430[_0x291f8b];return _0x275171;};'use strict';var EventEmitter=require(_0x0b43('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x0b43('0x1')](0x0);var events={'afterCreate':_0x0b43('0x2'),'afterUpdate':_0x0b43('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2a0f5f){return function(_0x521d6d,_0x1e94d1,_0x39e487){SmsQueueEvents['emit'](_0x2a0f5f+':'+_0x521d6d['id'],_0x521d6d);SmsQueueEvents[_0x0b43('0x4')](_0x2a0f5f,_0x521d6d);_0x39e487(null);};}for(var e in events){if(events[_0x0b43('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x0b43('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x5f0d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f0d,0x1dd));var _0xd5f0=function(_0x14bfd6,_0x4da565){_0x14bfd6=_0x14bfd6-0x0;var _0x41e9f1=_0x5f0d[_0x14bfd6];return _0x41e9f1;};'use strict';var EventEmitter=require(_0xd5f0('0x0'));var SmsQueue=require(_0xd5f0('0x1'))['db'][_0xd5f0('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd5f0('0x3')](0x0);var events={'afterCreate':_0xd5f0('0x4'),'afterUpdate':_0xd5f0('0x5'),'afterDestroy':_0xd5f0('0x6')};function emitEvent(_0x5e3e2b){return function(_0x359961,_0x2a5f5d,_0x1049af){SmsQueueEvents[_0xd5f0('0x7')](_0x5e3e2b+':'+_0x359961['id'],_0x359961);SmsQueueEvents['emit'](_0x5e3e2b,_0x359961);_0x1049af(null);};}for(var e in events){if(events[_0xd5f0('0x8')](e)){var event=events[e];SmsQueue[_0xd5f0('0x9')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8308b62..1e46e2b 100644 --- a/server/api/smsQueue/smsQueue.model.js +++ b/server/api/smsQueue/smsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5093=['define','sms_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueue.attributes'];(function(_0x144c0c,_0x113cfe){var _0x436221=function(_0x231dd7){while(--_0x231dd7){_0x144c0c['push'](_0x144c0c['shift']());}};_0x436221(++_0x113cfe);}(_0x5093,0x174));var _0x3509=function(_0x5ce34a,_0x57887e){_0x5ce34a=_0x5ce34a-0x0;var _0x309350=_0x5093[_0x5ce34a];return _0x309350;};'use strict';var _=require(_0x3509('0x0'));var util=require(_0x3509('0x1'));var logger=require(_0x3509('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3509('0x3'));var rp=require(_0x3509('0x4'));var fs=require('fs');var path=require(_0x3509('0x5'));var rimraf=require(_0x3509('0x6'));var config=require('../../config/environment');var attributes=require(_0x3509('0x7'));module['exports']=function(_0x1e6dcf,_0x185c87){return _0x1e6dcf[_0x3509('0x8')]('SmsQueue',attributes,{'tableName':_0x3509('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2433=['exports','define','SmsQueue','util','request-promise','rimraf'];(function(_0x2517ff,_0x2c4951){var _0x10ae7=function(_0x2d8055){while(--_0x2d8055){_0x2517ff['push'](_0x2517ff['shift']());}};_0x10ae7(++_0x2c4951);}(_0x2433,0x111));var _0x3243=function(_0x42746b,_0x1fe242){_0x42746b=_0x42746b-0x0;var _0x545552=_0x2433[_0x42746b];return _0x545552;};'use strict';var _=require('lodash');var util=require(_0x3243('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3243('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3243('0x2'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x3243('0x3')]=function(_0x3fb7e0,_0x51dce3){return _0x3fb7e0[_0x3243('0x4')](_0x3243('0x5'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index f75d562..efb44bc 100644 --- a/server/api/smsQueue/smsQueue.rpc.js +++ b/server/api/smsQueue/smsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x59a1=['../../config/environment','jayson/promise','client','http','redis','localhost','./smsQueue.socket','register','info','request\x20sent','debug','error','code','message','SmsQueue,\x20%s,\x20%s','result','catch','SmsQueue','options','raw','where','attributes','limit','include','map','model','then','GetSmsQueue','stringify','ShowSmsQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2d72ab,_0x5a97f5){var _0x256423=function(_0x94ed46){while(--_0x94ed46){_0x2d72ab['push'](_0x2d72ab['shift']());}};_0x256423(++_0x5a97f5);}(_0x59a1,0xb7));var _0x159a=function(_0x52d6ef,_0x35b8d2){_0x52d6ef=_0x52d6ef-0x0;var _0x427017=_0x59a1[_0x52d6ef];return _0x427017;};'use strict';var _=require(_0x159a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x159a('0x1'));var rs=require(_0x159a('0x2'));var fs=require('fs');var Redis=require(_0x159a('0x3'));var db=require(_0x159a('0x4'))['db'];var utils=require(_0x159a('0x5'));var logger=require('../../config/logger')(_0x159a('0x6'));var config=require(_0x159a('0x7'));var jayson=require(_0x159a('0x8'));var client=jayson[_0x159a('0x9')][_0x159a('0xa')]({'port':0x232a});config[_0x159a('0xb')]=_['defaults'](config[_0x159a('0xb')],{'host':_0x159a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x159a('0xb')]));require(_0x159a('0xd'))[_0x159a('0xe')](socket);function respondWithRpcPromise(_0x17b6f1,_0x5e217f,_0x4127fc){return new BPromise(function(_0x56bc49,_0x14c6c1){return client['request'](_0x17b6f1,_0x4127fc)['then'](function(_0x982631){logger[_0x159a('0xf')]('SmsQueue,\x20%s,\x20%s',_0x5e217f,_0x159a('0x10'));logger[_0x159a('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5e217f,_0x159a('0x10'),JSON['stringify'](_0x982631));if(_0x982631[_0x159a('0x12')]){if(_0x982631[_0x159a('0x12')][_0x159a('0x13')]===0x1f4){logger[_0x159a('0x12')]('SmsQueue,\x20%s,\x20%s',_0x5e217f,_0x982631[_0x159a('0x12')][_0x159a('0x14')]);return _0x14c6c1(_0x982631[_0x159a('0x12')][_0x159a('0x14')]);}logger[_0x159a('0x12')](_0x159a('0x15'),_0x5e217f,_0x982631[_0x159a('0x12')][_0x159a('0x14')]);return _0x56bc49(_0x982631[_0x159a('0x12')][_0x159a('0x14')]);}else{logger[_0x159a('0xf')](_0x159a('0x15'),_0x5e217f,_0x159a('0x10'));_0x56bc49(_0x982631[_0x159a('0x16')][_0x159a('0x14')]);}})[_0x159a('0x17')](function(_0x206fae){logger[_0x159a('0x12')](_0x159a('0x15'),_0x5e217f,_0x206fae);_0x14c6c1(_0x206fae);});});}exports['GetSmsQueue']=function(_0x342049){var _0x1cc66f=this;return new Promise(function(_0x4a0aa3,_0x407504){return db[_0x159a('0x18')]['findAll']({'raw':_0x342049[_0x159a('0x19')]?_0x342049['options'][_0x159a('0x1a')]===undefined?!![]:![]:!![],'where':_0x342049[_0x159a('0x19')]?_0x342049[_0x159a('0x19')][_0x159a('0x1b')]||null:null,'attributes':_0x342049[_0x159a('0x19')]?_0x342049[_0x159a('0x19')][_0x159a('0x1c')]||null:null,'limit':_0x342049[_0x159a('0x19')]?_0x342049[_0x159a('0x19')][_0x159a('0x1d')]||null:null,'include':_0x342049['options']?_0x342049[_0x159a('0x19')][_0x159a('0x1e')]?_[_0x159a('0x1f')](_0x342049[_0x159a('0x19')][_0x159a('0x1e')],function(_0x12b9f8){return{'model':db[_0x12b9f8[_0x159a('0x20')]],'as':_0x12b9f8['as'],'attributes':_0x12b9f8[_0x159a('0x1c')],'include':_0x12b9f8[_0x159a('0x1e')]?_[_0x159a('0x1f')](_0x12b9f8[_0x159a('0x1e')],function(_0x15d900){return{'model':db[_0x15d900[_0x159a('0x20')]],'as':_0x15d900['as'],'attributes':_0x15d900[_0x159a('0x1c')],'include':_0x15d900[_0x159a('0x1e')]?_[_0x159a('0x1f')](_0x15d900[_0x159a('0x1e')],function(_0x122bea){return{'model':db[_0x122bea[_0x159a('0x20')]],'as':_0x122bea['as'],'attributes':_0x122bea[_0x159a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x159a('0x21')](function(_0x2e113b){logger['info'](_0x159a('0x22'),_0x342049);logger[_0x159a('0x11')](_0x159a('0x22'),_0x342049,JSON[_0x159a('0x23')](_0x2e113b));_0x4a0aa3(_0x2e113b);})[_0x159a('0x17')](function(_0xa11899){logger[_0x159a('0x12')](_0x159a('0x22'),_0xa11899[_0x159a('0x14')],_0x342049);_0x407504(_0x1cc66f['error'](0x1f4,_0xa11899[_0x159a('0x14')]));});});};exports[_0x159a('0x24')]=function(_0x2abc1d){var _0x4fbdde=this;return new Promise(function(_0x46fe90,_0x25691d){return db[_0x159a('0x18')][_0x159a('0x25')]({'raw':_0x2abc1d[_0x159a('0x19')]?_0x2abc1d[_0x159a('0x19')][_0x159a('0x1a')]===undefined?!![]:![]:!![],'where':_0x2abc1d[_0x159a('0x19')]?_0x2abc1d['options'][_0x159a('0x1b')]||null:null,'attributes':_0x2abc1d[_0x159a('0x19')]?_0x2abc1d[_0x159a('0x19')][_0x159a('0x1c')]||null:null,'include':_0x2abc1d[_0x159a('0x19')]?_0x2abc1d[_0x159a('0x19')]['include']?_['map'](_0x2abc1d[_0x159a('0x19')]['include'],function(_0x204ede){return{'model':db[_0x204ede[_0x159a('0x20')]],'as':_0x204ede['as'],'attributes':_0x204ede['attributes'],'include':_0x204ede[_0x159a('0x1e')]?_[_0x159a('0x1f')](_0x204ede[_0x159a('0x1e')],function(_0x3845c9){return{'model':db[_0x3845c9[_0x159a('0x20')]],'as':_0x3845c9['as'],'attributes':_0x3845c9['attributes'],'include':_0x3845c9['include']?_[_0x159a('0x1f')](_0x3845c9[_0x159a('0x1e')],function(_0x42436b){return{'model':db[_0x42436b[_0x159a('0x20')]],'as':_0x42436b['as'],'attributes':_0x42436b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd213c0){logger[_0x159a('0xf')](_0x159a('0x24'),_0x2abc1d);logger[_0x159a('0x11')](_0x159a('0x24'),_0x2abc1d,JSON[_0x159a('0x23')](_0xd213c0));_0x46fe90(_0xd213c0);})['catch'](function(_0x1e67e9){logger[_0x159a('0x12')](_0x159a('0x24'),_0x1e67e9[_0x159a('0x14')],_0x2abc1d);_0x25691d(_0x4fbdde[_0x159a('0x12')](0x1f4,_0x1e67e9[_0x159a('0x14')]));});});}; \ No newline at end of file +var _0x7552=['findAll','options','raw','where','attributes','limit','include','map','model','GetSmsQueue','stringify','ShowSmsQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x3c9b1d,_0x38899e){var _0x52c99d=function(_0x452e48){while(--_0x452e48){_0x3c9b1d['push'](_0x3c9b1d['shift']());}};_0x52c99d(++_0x38899e);}(_0x7552,0x16b));var _0x2755=function(_0x4bb82f,_0x54c16f){_0x4bb82f=_0x4bb82f-0x0;var _0x531444=_0x7552[_0x4bb82f];return _0x531444;};'use strict';var _=require(_0x2755('0x0'));var util=require(_0x2755('0x1'));var moment=require(_0x2755('0x2'));var BPromise=require(_0x2755('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2755('0x4'));var db=require(_0x2755('0x5'))['db'];var utils=require(_0x2755('0x6'));var logger=require(_0x2755('0x7'))(_0x2755('0x8'));var config=require(_0x2755('0x9'));var jayson=require(_0x2755('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x2755('0xb')]=_[_0x2755('0xc')](config['redis'],{'host':_0x2755('0xd'),'port':0x18eb});var socket=require(_0x2755('0xe'))(new Redis(config[_0x2755('0xb')]));require(_0x2755('0xf'))[_0x2755('0x10')](socket);function respondWithRpcPromise(_0x354dce,_0x458500,_0x179a39){return new BPromise(function(_0x5bcf72,_0xbe652b){return client['request'](_0x354dce,_0x179a39)[_0x2755('0x11')](function(_0x1a552b){logger[_0x2755('0x12')](_0x2755('0x13'),_0x458500,_0x2755('0x14'));logger[_0x2755('0x15')](_0x2755('0x16'),_0x458500,'request\x20sent',JSON['stringify'](_0x1a552b));if(_0x1a552b[_0x2755('0x17')]){if(_0x1a552b[_0x2755('0x17')]['code']===0x1f4){logger[_0x2755('0x17')](_0x2755('0x13'),_0x458500,_0x1a552b['error'][_0x2755('0x18')]);return _0xbe652b(_0x1a552b[_0x2755('0x17')][_0x2755('0x18')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x458500,_0x1a552b[_0x2755('0x17')]['message']);return _0x5bcf72(_0x1a552b[_0x2755('0x17')][_0x2755('0x18')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x458500,_0x2755('0x14'));_0x5bcf72(_0x1a552b[_0x2755('0x19')][_0x2755('0x18')]);}})[_0x2755('0x1a')](function(_0x4d1377){logger[_0x2755('0x17')]('SmsQueue,\x20%s,\x20%s',_0x458500,_0x4d1377);_0xbe652b(_0x4d1377);});});}exports['GetSmsQueue']=function(_0x552fbc){var _0x48294e=this;return new Promise(function(_0x3349ac,_0x460e8c){return db['SmsQueue'][_0x2755('0x1b')]({'raw':_0x552fbc['options']?_0x552fbc[_0x2755('0x1c')][_0x2755('0x1d')]===undefined?!![]:![]:!![],'where':_0x552fbc[_0x2755('0x1c')]?_0x552fbc[_0x2755('0x1c')][_0x2755('0x1e')]||null:null,'attributes':_0x552fbc[_0x2755('0x1c')]?_0x552fbc[_0x2755('0x1c')][_0x2755('0x1f')]||null:null,'limit':_0x552fbc[_0x2755('0x1c')]?_0x552fbc['options'][_0x2755('0x20')]||null:null,'include':_0x552fbc['options']?_0x552fbc[_0x2755('0x1c')][_0x2755('0x21')]?_[_0x2755('0x22')](_0x552fbc[_0x2755('0x1c')]['include'],function(_0x1d29b5){return{'model':db[_0x1d29b5[_0x2755('0x23')]],'as':_0x1d29b5['as'],'attributes':_0x1d29b5[_0x2755('0x1f')],'include':_0x1d29b5[_0x2755('0x21')]?_[_0x2755('0x22')](_0x1d29b5['include'],function(_0x3f2730){return{'model':db[_0x3f2730[_0x2755('0x23')]],'as':_0x3f2730['as'],'attributes':_0x3f2730['attributes'],'include':_0x3f2730[_0x2755('0x21')]?_[_0x2755('0x22')](_0x3f2730[_0x2755('0x21')],function(_0x2fd260){return{'model':db[_0x2fd260['model']],'as':_0x2fd260['as'],'attributes':_0x2fd260[_0x2755('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2755('0x11')](function(_0x56650f){logger['info'](_0x2755('0x24'),_0x552fbc);logger['debug'](_0x2755('0x24'),_0x552fbc,JSON[_0x2755('0x25')](_0x56650f));_0x3349ac(_0x56650f);})[_0x2755('0x1a')](function(_0x609fa1){logger[_0x2755('0x17')](_0x2755('0x24'),_0x609fa1['message'],_0x552fbc);_0x460e8c(_0x48294e['error'](0x1f4,_0x609fa1[_0x2755('0x18')]));});});};exports[_0x2755('0x26')]=function(_0x1065eb){var _0x105ff9=this;return new Promise(function(_0x7c685e,_0x42b82e){return db['SmsQueue']['find']({'raw':_0x1065eb['options']?_0x1065eb[_0x2755('0x1c')][_0x2755('0x1d')]===undefined?!![]:![]:!![],'where':_0x1065eb[_0x2755('0x1c')]?_0x1065eb[_0x2755('0x1c')][_0x2755('0x1e')]||null:null,'attributes':_0x1065eb['options']?_0x1065eb[_0x2755('0x1c')]['attributes']||null:null,'include':_0x1065eb[_0x2755('0x1c')]?_0x1065eb[_0x2755('0x1c')]['include']?_[_0x2755('0x22')](_0x1065eb[_0x2755('0x1c')][_0x2755('0x21')],function(_0xaf2a65){return{'model':db[_0xaf2a65[_0x2755('0x23')]],'as':_0xaf2a65['as'],'attributes':_0xaf2a65[_0x2755('0x1f')],'include':_0xaf2a65['include']?_['map'](_0xaf2a65[_0x2755('0x21')],function(_0x5ef190){return{'model':db[_0x5ef190['model']],'as':_0x5ef190['as'],'attributes':_0x5ef190[_0x2755('0x1f')],'include':_0x5ef190[_0x2755('0x21')]?_[_0x2755('0x22')](_0x5ef190[_0x2755('0x21')],function(_0x56260a){return{'model':db[_0x56260a['model']],'as':_0x56260a['as'],'attributes':_0x56260a[_0x2755('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2755('0x11')](function(_0x163d58){logger[_0x2755('0x12')](_0x2755('0x26'),_0x1065eb);logger['debug']('ShowSmsQueue',_0x1065eb,JSON[_0x2755('0x25')](_0x163d58));_0x7c685e(_0x163d58);})[_0x2755('0x1a')](function(_0x2ddecd){logger[_0x2755('0x17')](_0x2755('0x26'),_0x2ddecd[_0x2755('0x18')],_0x1065eb);_0x42b82e(_0x105ff9[_0x2755('0x17')](0x1f4,_0x2ddecd[_0x2755('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 13610fa..12c860e 100644 --- a/server/api/smsQueue/smsQueue.socket.js +++ b/server/api/smsQueue/smsQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ab4=['remove','update','emit','removeListener','length','save'];(function(_0x5bb0f5,_0x502471){var _0x2f66e2=function(_0x574fdf){while(--_0x574fdf){_0x5bb0f5['push'](_0x5bb0f5['shift']());}};_0x2f66e2(++_0x502471);}(_0x5ab4,0x191));var _0x45ab=function(_0x484809,_0x4312b9){_0x484809=_0x484809-0x0;var _0x449dd8=_0x5ab4[_0x484809];return _0x449dd8;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x45ab('0x0'),_0x45ab('0x1'),_0x45ab('0x2')];function createListener(_0x1e95eb,_0x1e77d4){return function(_0x3f7b80){_0x1e77d4[_0x45ab('0x3')](_0x1e95eb,_0x3f7b80);};}function removeListener(_0x1d47ad,_0x58e7a9){return function(){SmsQueueEvents[_0x45ab('0x4')](_0x1d47ad,_0x58e7a9);};}exports['register']=function(_0x3d508c){for(var _0x1ad7d1=0x0,_0xb7c885=events[_0x45ab('0x5')];_0x1ad7d1<_0xb7c885;_0x1ad7d1++){var _0x2b83a8=events[_0x1ad7d1];var _0xc5068c=createListener('smsQueue:'+_0x2b83a8,_0x3d508c);SmsQueueEvents['on'](_0x2b83a8,_0xc5068c);}}; \ No newline at end of file +var _0x7c0c=['removeListener','./smsQueue.events','save','remove','update','emit'];(function(_0x414b48,_0x4293a7){var _0x45ab9c=function(_0x2c13fc){while(--_0x2c13fc){_0x414b48['push'](_0x414b48['shift']());}};_0x45ab9c(++_0x4293a7);}(_0x7c0c,0x6d));var _0xc7c0=function(_0x65397d,_0xf997ae){_0x65397d=_0x65397d-0x0;var _0x357509=_0x7c0c[_0x65397d];return _0x357509;};'use strict';var SmsQueueEvents=require(_0xc7c0('0x0'));var events=[_0xc7c0('0x1'),_0xc7c0('0x2'),_0xc7c0('0x3')];function createListener(_0x223580,_0x4f7eef){return function(_0x28d789){_0x4f7eef[_0xc7c0('0x4')](_0x223580,_0x28d789);};}function removeListener(_0x36710d,_0x3b0ecf){return function(){SmsQueueEvents[_0xc7c0('0x5')](_0x36710d,_0x3b0ecf);};}exports['register']=function(_0xa016ae){for(var _0x108553=0x0,_0x5dc219=events['length'];_0x108553<_0x5dc219;_0x108553++){var _0x213383=events[_0x108553];var _0x30f8a6=createListener('smsQueue:'+_0x213383,_0xa016ae);SmsQueueEvents['on'](_0x213383,_0x30f8a6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 48fd808..ebe61cd 100644 --- a/server/api/smsQueueReport/index.js +++ b/server/api/smsQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4556=['/describe','describe','/:id','show','post','update','delete','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index'];(function(_0x2f1b14,_0x1c9087){var _0x3dd6ca=function(_0x6f960e){while(--_0x6f960e){_0x2f1b14['push'](_0x2f1b14['shift']());}};_0x3dd6ca(++_0x1c9087);}(_0x4556,0x8f));var _0x6455=function(_0x27b56d,_0x3fa1f2){_0x27b56d=_0x27b56d-0x0;var _0x37eafa=_0x4556[_0x27b56d];return _0x37eafa;};'use strict';var multer=require(_0x6455('0x0'));var util=require('util');var path=require(_0x6455('0x1'));var timeout=require(_0x6455('0x2'));var express=require(_0x6455('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6455('0x4'));var config=require(_0x6455('0x5'));var controller=require(_0x6455('0x6'));router[_0x6455('0x7')]('/',auth[_0x6455('0x8')](),controller[_0x6455('0x9')]);router[_0x6455('0x7')](_0x6455('0xa'),auth[_0x6455('0x8')](),controller[_0x6455('0xb')]);router[_0x6455('0x7')](_0x6455('0xc'),auth['isAuthenticated'](),controller[_0x6455('0xd')]);router[_0x6455('0xe')]('/',auth[_0x6455('0x8')](),controller['create']);router['put'](_0x6455('0xc'),auth[_0x6455('0x8')](),controller[_0x6455('0xf')]);router[_0x6455('0x10')](_0x6455('0xc'),auth[_0x6455('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x36e8=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create'];(function(_0x5ae8ac,_0xa9e5c3){var _0x2a0853=function(_0x209644){while(--_0x209644){_0x5ae8ac['push'](_0x5ae8ac['shift']());}};_0x2a0853(++_0xa9e5c3);}(_0x36e8,0x16a));var _0x836e=function(_0x19d7a6,_0x42a09d){_0x19d7a6=_0x19d7a6-0x0;var _0x3a10b7=_0x36e8[_0x19d7a6];return _0x3a10b7;};'use strict';var multer=require('multer');var util=require(_0x836e('0x0'));var path=require(_0x836e('0x1'));var timeout=require(_0x836e('0x2'));var express=require(_0x836e('0x3'));var router=express[_0x836e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x836e('0x5'));var interaction=require(_0x836e('0x6'));var config=require('../../config/environment');var controller=require(_0x836e('0x7'));router['get']('/',auth[_0x836e('0x8')](),controller[_0x836e('0x9')]);router[_0x836e('0xa')](_0x836e('0xb'),auth[_0x836e('0x8')](),controller[_0x836e('0xc')]);router['get'](_0x836e('0xd'),auth[_0x836e('0x8')](),controller['show']);router[_0x836e('0xe')]('/',auth[_0x836e('0x8')](),controller[_0x836e('0xf')]);router[_0x836e('0x10')](_0x836e('0xd'),auth[_0x836e('0x8')](),controller[_0x836e('0x11')]);router[_0x836e('0x12')](_0x836e('0xd'),auth[_0x836e('0x8')](),controller[_0x836e('0x13')]);module[_0x836e('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 74dcf02..665daaa 100644 --- a/server/api/smsQueueReport/smsQueueReport.attributes.js +++ b/server/api/smsQueueReport/smsQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d32=['STRING','moment','DATE'];(function(_0x1dff47,_0x3005a6){var _0xaa69ba=function(_0x333738){while(--_0x333738){_0x1dff47['push'](_0x1dff47['shift']());}};_0xaa69ba(++_0x3005a6);}(_0x3d32,0x13c));var _0x23d3=function(_0x2efc46,_0x4997fb){_0x2efc46=_0x2efc46-0x0;var _0x30f56e=_0x3d32[_0x2efc46];return _0x30f56e;};'use strict';var moment=require(_0x23d3('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x23d3('0x1')]},'acceptAt':{'type':Sequelize[_0x23d3('0x1')]},'exitAt':{'type':Sequelize[_0x23d3('0x1')]},'reason':{'type':Sequelize[_0x23d3('0x2')]}}; \ No newline at end of file +var _0x9622=['DATE','moment','sequelize','exports','STRING'];(function(_0x3755e7,_0x4613f2){var _0x779862=function(_0x1b48a3){while(--_0x1b48a3){_0x3755e7['push'](_0x3755e7['shift']());}};_0x779862(++_0x4613f2);}(_0x9622,0x8d));var _0x2962=function(_0x2bb612,_0xaedf28){_0x2bb612=_0x2bb612-0x0;var _0x4ef64c=_0x9622[_0x2bb612];return _0x4ef64c;};'use strict';var moment=require(_0x2962('0x0'));var Sequelize=require(_0x2962('0x1'));module[_0x2962('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2962('0x3')]},'joinAt':{'type':Sequelize[_0x2962('0x4')]},'leaveAt':{'type':Sequelize[_0x2962('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a718091..c3f87c0 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe62f=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','SmsQueueReport','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','length','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x270883,_0x49e29f){var _0x476b65=function(_0x1dc96f){while(--_0x1dc96f){_0x270883['push'](_0x270883['shift']());}};_0x476b65(++_0x49e29f);}(_0xe62f,0xe4));var _0xfe62=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0xe62f[_0x1acc2d];return _0xabfa6d;};'use strict';var emlformat=require(_0xfe62('0x0'));var rimraf=require(_0xfe62('0x1'));var zipdir=require(_0xfe62('0x2'));var jsonpatch=require(_0xfe62('0x3'));var rp=require(_0xfe62('0x4'));var moment=require(_0xfe62('0x5'));var BPromise=require(_0xfe62('0x6'));var Mustache=require(_0xfe62('0x7'));var util=require(_0xfe62('0x8'));var path=require('path');var sox=require(_0xfe62('0x9'));var csv=require('to-csv');var ejs=require(_0xfe62('0xa'));var fs=require('fs');var fs_extra=require(_0xfe62('0xb'));var _=require(_0xfe62('0xc'));var squel=require(_0xfe62('0xd'));var crypto=require(_0xfe62('0xe'));var jsforce=require(_0xfe62('0xf'));var deskjs=require(_0xfe62('0x10'));var toCsv=require(_0xfe62('0x11'));var querystring=require(_0xfe62('0x12'));var Papa=require(_0xfe62('0x13'));var Redis=require(_0xfe62('0x14'));var authService=require(_0xfe62('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xfe62('0x16'));var hardwareService=require(_0xfe62('0x17'));var logger=require(_0xfe62('0x18'))(_0xfe62('0x19'));var utils=require('../../config/utils');var config=require(_0xfe62('0x1a'));var licenseUtil=require(_0xfe62('0x1b'));var db=require(_0xfe62('0x1c'))['db'];function respondWithStatusCode(_0x5746ab,_0x532748){_0x532748=_0x532748||0xcc;return function(_0x5a62c0){if(_0x5a62c0){return _0x5746ab[_0xfe62('0x1d')](_0x532748);}return _0x5746ab['status'](_0x532748)[_0xfe62('0x1e')]();};}function respondWithResult(_0x2f8000,_0x3ee3e8){_0x3ee3e8=_0x3ee3e8||0xc8;return function(_0xb6dee3){if(_0xb6dee3){return _0x2f8000['status'](_0x3ee3e8)[_0xfe62('0x1f')](_0xb6dee3);}};}function respondWithFilteredResult(_0x1032ed,_0x430a4c){return function(_0x5919bd){if(_0x5919bd){var _0x498dc5=typeof _0x430a4c['offset']==='undefined'&&typeof _0x430a4c[_0xfe62('0x20')]===_0xfe62('0x21');var _0x588b1f=_0x5919bd[_0xfe62('0x22')];var _0x1d9353=_0x498dc5?0x0:_0x430a4c[_0xfe62('0x23')];var _0x465eea=_0x498dc5?_0x5919bd['count']:_0x430a4c[_0xfe62('0x23')]+_0x430a4c['limit'];var _0x2f761e;if(_0x465eea>=_0x588b1f){_0x465eea=_0x588b1f;_0x2f761e=0xc8;}else{_0x2f761e=0xce;}_0x1032ed[_0xfe62('0x24')](_0x2f761e);return _0x1032ed[_0xfe62('0x25')](_0xfe62('0x26'),_0x1d9353+'-'+_0x465eea+'/'+_0x588b1f)['json'](_0x5919bd);}return null;};}function patchUpdates(_0x2129ec){return function(_0x576908){try{jsonpatch[_0xfe62('0x27')](_0x576908,_0x2129ec,!![]);}catch(_0x4b13d1){return BPromise[_0xfe62('0x28')](_0x4b13d1);}return _0x576908[_0xfe62('0x29')]();};}function saveUpdates(_0x223c6c,_0x2ad82f){return function(_0xc1ccb1){if(_0xc1ccb1){return _0xc1ccb1[_0xfe62('0x2a')](_0x223c6c)['then'](function(_0x200e94){return _0x200e94;});}return null;};}function removeEntity(_0x355d5a,_0x4eecc0){return function(_0x11b37d){if(_0x11b37d){return _0x11b37d['destroy']()[_0xfe62('0x2b')](function(){_0x355d5a[_0xfe62('0x24')](0xcc)[_0xfe62('0x1e')]();});}};}function handleEntityNotFound(_0xc11b39,_0x4d366b){return function(_0x566b28){if(!_0x566b28){_0xc11b39[_0xfe62('0x1d')](0x194);}return _0x566b28;};}function handleError(_0x5a5b9c,_0x19e734){_0x19e734=_0x19e734||0x1f4;return function(_0x5bbf06){logger[_0xfe62('0x2c')](_0x5bbf06[_0xfe62('0x2d')]);if(_0x5bbf06[_0xfe62('0x2e')]){delete _0x5bbf06['name'];}_0x5a5b9c['status'](_0x19e734)['send'](_0x5bbf06);};}exports[_0xfe62('0x2f')]=function(_0x354fea,_0x345fdc){var _0x2e538f={},_0x585d2d={},_0x4854a5={'count':0x0,'rows':[]};var _0x321334=_['map'](db[_0xfe62('0x30')][_0xfe62('0x31')],function(_0x559905){return{'name':_0x559905['fieldName'],'type':_0x559905['type'][_0xfe62('0x32')]};});_0x585d2d['model']=_[_0xfe62('0x33')](_0x321334,'name');_0x585d2d[_0xfe62('0x34')]=_[_0xfe62('0x35')](_0x354fea[_0xfe62('0x34')]);_0x585d2d[_0xfe62('0x36')]=_[_0xfe62('0x37')](_0x585d2d[_0xfe62('0x38')],_0x585d2d[_0xfe62('0x34')]);_0x2e538f[_0xfe62('0x39')]=_[_0xfe62('0x37')](_0x585d2d[_0xfe62('0x38')],qs[_0xfe62('0x3a')](_0x354fea[_0xfe62('0x34')][_0xfe62('0x3a')]));_0x2e538f[_0xfe62('0x39')]=_0x2e538f[_0xfe62('0x39')]['length']?_0x2e538f[_0xfe62('0x39')]:_0x585d2d[_0xfe62('0x38')];if(!_0x354fea['query']['hasOwnProperty'](_0xfe62('0x3b'))){_0x2e538f[_0xfe62('0x20')]=qs[_0xfe62('0x20')](_0x354fea[_0xfe62('0x34')][_0xfe62('0x20')]);_0x2e538f[_0xfe62('0x23')]=qs[_0xfe62('0x23')](_0x354fea[_0xfe62('0x34')][_0xfe62('0x23')]);}_0x2e538f[_0xfe62('0x3c')]=qs['sort'](_0x354fea[_0xfe62('0x34')][_0xfe62('0x3d')]);_0x2e538f[_0xfe62('0x3e')]=qs[_0xfe62('0x36')](_[_0xfe62('0x3f')](_0x354fea[_0xfe62('0x34')],_0x585d2d[_0xfe62('0x36')]),_0x321334);if(_0x354fea['query'][_0xfe62('0x40')]){_0x2e538f['where']=_['merge'](_0x2e538f[_0xfe62('0x3e')],{'$or':_[_0xfe62('0x33')](_0x321334,function(_0x582597){if(_0x582597['type']!==_0xfe62('0x41')){var _0x4ddcce={};_0x4ddcce[_0x582597[_0xfe62('0x2e')]]={'$like':'%'+_0x354fea['query'][_0xfe62('0x40')]+'%'};return _0x4ddcce;}})});}_0x2e538f=_[_0xfe62('0x42')]({},_0x2e538f,_0x354fea[_0xfe62('0x43')]);var _0x11ce7c={'where':_0x2e538f[_0xfe62('0x3e')]};return db['SmsQueueReport'][_0xfe62('0x22')](_0x11ce7c)[_0xfe62('0x2b')](function(_0x81d574){_0x4854a5['count']=_0x81d574;if(_0x354fea[_0xfe62('0x34')][_0xfe62('0x44')]){_0x2e538f['include']=[{'all':!![]}];}return db[_0xfe62('0x30')][_0xfe62('0x45')](_0x2e538f);})[_0xfe62('0x2b')](function(_0x341173){_0x4854a5[_0xfe62('0x46')]=_0x341173;return _0x4854a5;})['then'](respondWithFilteredResult(_0x345fdc,_0x2e538f))[_0xfe62('0x47')](handleError(_0x345fdc,null));};exports['show']=function(_0xb77297,_0xca3358){var _0x1f41e0={'raw':!![],'where':{'id':_0xb77297['params']['id']}},_0x44f0e9={};_0x44f0e9[_0xfe62('0x38')]=_[_0xfe62('0x35')](db['SmsQueueReport'][_0xfe62('0x31')]);_0x44f0e9['query']=_[_0xfe62('0x35')](_0xb77297[_0xfe62('0x34')]);_0x44f0e9[_0xfe62('0x36')]=_[_0xfe62('0x37')](_0x44f0e9[_0xfe62('0x38')],_0x44f0e9[_0xfe62('0x34')]);_0x1f41e0[_0xfe62('0x39')]=_['intersection'](_0x44f0e9[_0xfe62('0x38')],qs['fields'](_0xb77297[_0xfe62('0x34')]['fields']));_0x1f41e0[_0xfe62('0x39')]=_0x1f41e0[_0xfe62('0x39')][_0xfe62('0x48')]?_0x1f41e0[_0xfe62('0x39')]:_0x44f0e9[_0xfe62('0x38')];if(_0xb77297[_0xfe62('0x34')][_0xfe62('0x44')]){_0x1f41e0[_0xfe62('0x49')]=[{'all':!![]}];}_0x1f41e0=_[_0xfe62('0x42')]({},_0x1f41e0,_0xb77297[_0xfe62('0x43')]);return db[_0xfe62('0x30')][_0xfe62('0x4a')](_0x1f41e0)[_0xfe62('0x2b')](handleEntityNotFound(_0xca3358,null))[_0xfe62('0x2b')](respondWithResult(_0xca3358,null))[_0xfe62('0x47')](handleError(_0xca3358,null));};exports[_0xfe62('0x4b')]=function(_0x4190b4,_0x14ccb5){return db[_0xfe62('0x30')][_0xfe62('0x4b')](_0x4190b4[_0xfe62('0x4c')],{})[_0xfe62('0x2b')](respondWithResult(_0x14ccb5,0xc9))[_0xfe62('0x47')](handleError(_0x14ccb5,null));};exports[_0xfe62('0x2a')]=function(_0x4ba22f,_0x5bb63d){if(_0x4ba22f[_0xfe62('0x4c')]['id']){delete _0x4ba22f[_0xfe62('0x4c')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x4ba22f[_0xfe62('0x4d')]['id']}})[_0xfe62('0x2b')](handleEntityNotFound(_0x5bb63d,null))[_0xfe62('0x2b')](saveUpdates(_0x4ba22f[_0xfe62('0x4c')],null))['then'](respondWithResult(_0x5bb63d,null))[_0xfe62('0x47')](handleError(_0x5bb63d,null));};exports['destroy']=function(_0x449f7c,_0x4c2628){return db[_0xfe62('0x30')][_0xfe62('0x4a')]({'where':{'id':_0x449f7c[_0xfe62('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4c2628,null))[_0xfe62('0x2b')](removeEntity(_0x4c2628,null))[_0xfe62('0x47')](handleError(_0x4c2628,null));};exports[_0xfe62('0x4e')]=function(_0x2e01df,_0x581052){return db[_0xfe62('0x30')]['describe']()['then'](respondWithResult(_0x581052,null))[_0xfe62('0x47')](handleError(_0x581052,null));}; \ No newline at end of file +var _0xb069=['hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','then','includeAll','include','rows','show','params','keys','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x5dc4b7,_0x63ec04){var _0x111198=function(_0xe03877){while(--_0xe03877){_0x5dc4b7['push'](_0x5dc4b7['shift']());}};_0x111198(++_0x63ec04);}(_0xb069,0x1dd));var _0x9b06=function(_0x4fa018,_0x20c04a){_0x4fa018=_0x4fa018-0x0;var _0x4344f8=_0xb069[_0x4fa018];return _0x4344f8;};'use strict';var emlformat=require(_0x9b06('0x0'));var rimraf=require(_0x9b06('0x1'));var zipdir=require(_0x9b06('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b06('0x3'));var moment=require(_0x9b06('0x4'));var BPromise=require(_0x9b06('0x5'));var Mustache=require('mustache');var util=require(_0x9b06('0x6'));var path=require(_0x9b06('0x7'));var sox=require(_0x9b06('0x8'));var csv=require(_0x9b06('0x9'));var ejs=require(_0x9b06('0xa'));var fs=require('fs');var fs_extra=require(_0x9b06('0xb'));var _=require(_0x9b06('0xc'));var squel=require(_0x9b06('0xd'));var crypto=require(_0x9b06('0xe'));var jsforce=require(_0x9b06('0xf'));var deskjs=require(_0x9b06('0x10'));var toCsv=require(_0x9b06('0x9'));var querystring=require(_0x9b06('0x11'));var Papa=require(_0x9b06('0x12'));var Redis=require(_0x9b06('0x13'));var authService=require(_0x9b06('0x14'));var qs=require(_0x9b06('0x15'));var as=require(_0x9b06('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9b06('0x17'));var utils=require(_0x9b06('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9b06('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd31261,_0x20d1a1){_0x20d1a1=_0x20d1a1||0xcc;return function(_0x38d847){if(_0x38d847){return _0xd31261[_0x9b06('0x1a')](_0x20d1a1);}return _0xd31261['status'](_0x20d1a1)[_0x9b06('0x1b')]();};}function respondWithResult(_0x61f6f9,_0x48719a){_0x48719a=_0x48719a||0xc8;return function(_0x5aa269){if(_0x5aa269){return _0x61f6f9[_0x9b06('0x1c')](_0x48719a)[_0x9b06('0x1d')](_0x5aa269);}};}function respondWithFilteredResult(_0x1ff2a3,_0x89d7b1){return function(_0xdb4b51){if(_0xdb4b51){var _0x504546=typeof _0x89d7b1[_0x9b06('0x1e')]===_0x9b06('0x1f')&&typeof _0x89d7b1[_0x9b06('0x20')]==='undefined';var _0x4cfc82=_0xdb4b51[_0x9b06('0x21')];var _0x59de1a=_0x504546?0x0:_0x89d7b1[_0x9b06('0x1e')];var _0x593c12=_0x504546?_0xdb4b51['count']:_0x89d7b1['offset']+_0x89d7b1[_0x9b06('0x20')];var _0x213b8c;if(_0x593c12>=_0x4cfc82){_0x593c12=_0x4cfc82;_0x213b8c=0xc8;}else{_0x213b8c=0xce;}_0x1ff2a3['status'](_0x213b8c);return _0x1ff2a3['set'](_0x9b06('0x22'),_0x59de1a+'-'+_0x593c12+'/'+_0x4cfc82)[_0x9b06('0x1d')](_0xdb4b51);}return null;};}function patchUpdates(_0x4bf9c9){return function(_0x2ca9be){try{jsonpatch[_0x9b06('0x23')](_0x2ca9be,_0x4bf9c9,!![]);}catch(_0x230819){return BPromise[_0x9b06('0x24')](_0x230819);}return _0x2ca9be['save']();};}function saveUpdates(_0x4a6a5d,_0x5a460c){return function(_0x597abe){if(_0x597abe){return _0x597abe[_0x9b06('0x25')](_0x4a6a5d)['then'](function(_0x267ee1){return _0x267ee1;});}return null;};}function removeEntity(_0x4dcd2d,_0x2f0636){return function(_0x8232eb){if(_0x8232eb){return _0x8232eb['destroy']()['then'](function(){_0x4dcd2d[_0x9b06('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x191bb,_0x3d8961){return function(_0xa40531){if(!_0xa40531){_0x191bb[_0x9b06('0x1a')](0x194);}return _0xa40531;};}function handleError(_0x4469ab,_0x1e4f00){_0x1e4f00=_0x1e4f00||0x1f4;return function(_0x21249c){logger[_0x9b06('0x26')](_0x21249c[_0x9b06('0x27')]);if(_0x21249c[_0x9b06('0x28')]){delete _0x21249c[_0x9b06('0x28')];}_0x4469ab[_0x9b06('0x1c')](_0x1e4f00)['send'](_0x21249c);};}exports[_0x9b06('0x29')]=function(_0xd2df5c,_0x3c9ee4){var _0x56bae8={},_0x37bcc2={},_0x406735={'count':0x0,'rows':[]};var _0x23392f=_[_0x9b06('0x2a')](db[_0x9b06('0x2b')][_0x9b06('0x2c')],function(_0x655688){return{'name':_0x655688[_0x9b06('0x2d')],'type':_0x655688[_0x9b06('0x2e')][_0x9b06('0x2f')]};});_0x37bcc2[_0x9b06('0x30')]=_['map'](_0x23392f,_0x9b06('0x28'));_0x37bcc2[_0x9b06('0x31')]=_['keys'](_0xd2df5c[_0x9b06('0x31')]);_0x37bcc2[_0x9b06('0x32')]=_[_0x9b06('0x33')](_0x37bcc2[_0x9b06('0x30')],_0x37bcc2[_0x9b06('0x31')]);_0x56bae8[_0x9b06('0x34')]=_[_0x9b06('0x33')](_0x37bcc2[_0x9b06('0x30')],qs[_0x9b06('0x35')](_0xd2df5c[_0x9b06('0x31')][_0x9b06('0x35')]));_0x56bae8[_0x9b06('0x34')]=_0x56bae8[_0x9b06('0x34')][_0x9b06('0x36')]?_0x56bae8['attributes']:_0x37bcc2['model'];if(!_0xd2df5c[_0x9b06('0x31')][_0x9b06('0x37')](_0x9b06('0x38'))){_0x56bae8[_0x9b06('0x20')]=qs[_0x9b06('0x20')](_0xd2df5c['query'][_0x9b06('0x20')]);_0x56bae8[_0x9b06('0x1e')]=qs['offset'](_0xd2df5c[_0x9b06('0x31')][_0x9b06('0x1e')]);}_0x56bae8['order']=qs[_0x9b06('0x39')](_0xd2df5c['query'][_0x9b06('0x39')]);_0x56bae8[_0x9b06('0x3a')]=qs[_0x9b06('0x32')](_[_0x9b06('0x3b')](_0xd2df5c[_0x9b06('0x31')],_0x37bcc2[_0x9b06('0x32')]),_0x23392f);if(_0xd2df5c[_0x9b06('0x31')]['filter']){_0x56bae8[_0x9b06('0x3a')]=_[_0x9b06('0x3c')](_0x56bae8[_0x9b06('0x3a')],{'$or':_[_0x9b06('0x2a')](_0x23392f,function(_0x2123c4){if(_0x2123c4[_0x9b06('0x2e')]!==_0x9b06('0x3d')){var _0x478cbc={};_0x478cbc[_0x2123c4[_0x9b06('0x28')]]={'$like':'%'+_0xd2df5c[_0x9b06('0x31')][_0x9b06('0x3e')]+'%'};return _0x478cbc;}})});}_0x56bae8=_[_0x9b06('0x3c')]({},_0x56bae8,_0xd2df5c['options']);var _0x1d7b6a={'where':_0x56bae8[_0x9b06('0x3a')]};return db[_0x9b06('0x2b')][_0x9b06('0x21')](_0x1d7b6a)[_0x9b06('0x3f')](function(_0x516762){_0x406735[_0x9b06('0x21')]=_0x516762;if(_0xd2df5c[_0x9b06('0x31')][_0x9b06('0x40')]){_0x56bae8[_0x9b06('0x41')]=[{'all':!![]}];}return db[_0x9b06('0x2b')]['findAll'](_0x56bae8);})[_0x9b06('0x3f')](function(_0x1d58cc){_0x406735[_0x9b06('0x42')]=_0x1d58cc;return _0x406735;})[_0x9b06('0x3f')](respondWithFilteredResult(_0x3c9ee4,_0x56bae8))['catch'](handleError(_0x3c9ee4,null));};exports[_0x9b06('0x43')]=function(_0x25fc0e,_0x4b17c4){var _0x59bc1a={'raw':!![],'where':{'id':_0x25fc0e[_0x9b06('0x44')]['id']}},_0x5a81d6={};_0x5a81d6['model']=_[_0x9b06('0x45')](db['SmsQueueReport']['rawAttributes']);_0x5a81d6['query']=_[_0x9b06('0x45')](_0x25fc0e[_0x9b06('0x31')]);_0x5a81d6['filters']=_[_0x9b06('0x33')](_0x5a81d6[_0x9b06('0x30')],_0x5a81d6[_0x9b06('0x31')]);_0x59bc1a['attributes']=_['intersection'](_0x5a81d6[_0x9b06('0x30')],qs[_0x9b06('0x35')](_0x25fc0e[_0x9b06('0x31')][_0x9b06('0x35')]));_0x59bc1a[_0x9b06('0x34')]=_0x59bc1a['attributes'][_0x9b06('0x36')]?_0x59bc1a[_0x9b06('0x34')]:_0x5a81d6[_0x9b06('0x30')];if(_0x25fc0e[_0x9b06('0x31')][_0x9b06('0x40')]){_0x59bc1a[_0x9b06('0x41')]=[{'all':!![]}];}_0x59bc1a=_[_0x9b06('0x3c')]({},_0x59bc1a,_0x25fc0e['options']);return db[_0x9b06('0x2b')]['find'](_0x59bc1a)[_0x9b06('0x3f')](handleEntityNotFound(_0x4b17c4,null))[_0x9b06('0x3f')](respondWithResult(_0x4b17c4,null))[_0x9b06('0x46')](handleError(_0x4b17c4,null));};exports['create']=function(_0x4a227c,_0x5bec00){return db[_0x9b06('0x2b')][_0x9b06('0x47')](_0x4a227c['body'],{})[_0x9b06('0x3f')](respondWithResult(_0x5bec00,0xc9))[_0x9b06('0x46')](handleError(_0x5bec00,null));};exports[_0x9b06('0x25')]=function(_0x5ec738,_0x812461){if(_0x5ec738[_0x9b06('0x48')]['id']){delete _0x5ec738['body']['id'];}return db[_0x9b06('0x2b')][_0x9b06('0x49')]({'where':{'id':_0x5ec738[_0x9b06('0x44')]['id']}})['then'](handleEntityNotFound(_0x812461,null))[_0x9b06('0x3f')](saveUpdates(_0x5ec738[_0x9b06('0x48')],null))[_0x9b06('0x3f')](respondWithResult(_0x812461,null))[_0x9b06('0x46')](handleError(_0x812461,null));};exports[_0x9b06('0x4a')]=function(_0x47ea38,_0x4b42f7){return db['SmsQueueReport'][_0x9b06('0x49')]({'where':{'id':_0x47ea38['params']['id']}})['then'](handleEntityNotFound(_0x4b42f7,null))[_0x9b06('0x3f')](removeEntity(_0x4b42f7,null))[_0x9b06('0x46')](handleError(_0x4b42f7,null));};exports[_0x9b06('0x4b')]=function(_0x5f5b5e,_0x3a0601){return db[_0x9b06('0x2b')][_0x9b06('0x4b')]()[_0x9b06('0x3f')](respondWithResult(_0x3a0601,null))['catch'](handleError(_0x3a0601,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 83b03f3..9eb73be 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x55b3ae,_0x45017c){var _0xe5088d=function(_0x5bbf33){while(--_0x5bbf33){_0x55b3ae['push'](_0x55b3ae['shift']());}};_0xe5088d(++_0x45017c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb7e7[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x105d2e,_0xefc0f9){var _0x44969d=function(_0x2fca67){while(--_0x2fca67){_0x105d2e['push'](_0x105d2e['shift']());}};_0x44969d(++_0xefc0f9);}(_0xe706,0xa3));var _0x6e70=function(_0x5ddec9,_0x209a36){_0x5ddec9=_0x5ddec9-0x0;var _0x5abb94=_0xe706[_0x5ddec9];return _0x5abb94;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 584b181..7311a20 100644 --- a/server/api/smsQueueReport/smsQueueReport.rpc.js +++ b/server/api/smsQueueReport/smsQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd623=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','catch','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd623,0x171));var _0x3d62=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd623[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x3d62('0x0'));var util=require(_0x3d62('0x1'));var moment=require(_0x3d62('0x2'));var BPromise=require(_0x3d62('0x3'));var rs=require(_0x3d62('0x4'));var fs=require('fs');var Redis=require(_0x3d62('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d62('0x6'));var logger=require(_0x3d62('0x7'))('rpc');var config=require(_0x3d62('0x8'));var jayson=require(_0x3d62('0x9'));var client=jayson[_0x3d62('0xa')][_0x3d62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23c24f,_0x18e57b,_0x37a675){return new BPromise(function(_0x4c2f8d,_0x322bfa){return client['request'](_0x23c24f,_0x37a675)['then'](function(_0x6cda40){logger[_0x3d62('0xc')](_0x3d62('0xd'),_0x18e57b,_0x3d62('0xe'));logger[_0x3d62('0xf')](_0x3d62('0x10'),_0x18e57b,_0x3d62('0xe'),JSON[_0x3d62('0x11')](_0x6cda40));if(_0x6cda40[_0x3d62('0x12')]){if(_0x6cda40['error'][_0x3d62('0x13')]===0x1f4){logger['error'](_0x3d62('0xd'),_0x18e57b,_0x6cda40[_0x3d62('0x12')][_0x3d62('0x14')]);return _0x322bfa(_0x6cda40[_0x3d62('0x12')][_0x3d62('0x14')]);}logger[_0x3d62('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x18e57b,_0x6cda40['error'][_0x3d62('0x14')]);return _0x4c2f8d(_0x6cda40[_0x3d62('0x12')][_0x3d62('0x14')]);}else{logger[_0x3d62('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x18e57b,_0x3d62('0xe'));_0x4c2f8d(_0x6cda40[_0x3d62('0x15')][_0x3d62('0x14')]);}})['catch'](function(_0x5af4b5){logger[_0x3d62('0x12')](_0x3d62('0xd'),_0x18e57b,_0x5af4b5);_0x322bfa(_0x5af4b5);});});}exports[_0x3d62('0x16')]=function(_0x2695a0){var _0x96306f=this;return new Promise(function(_0x2d3bf,_0x660b7a){return db[_0x3d62('0x17')]['create'](_0x2695a0[_0x3d62('0x18')],{'raw':_0x2695a0[_0x3d62('0x19')]?_0x2695a0[_0x3d62('0x19')][_0x3d62('0x1a')]===undefined?!![]:![]:!![]})[_0x3d62('0x1b')](function(_0x3044ea){logger[_0x3d62('0xc')](_0x3d62('0x16'),_0x2695a0);logger[_0x3d62('0xf')]('CreateSmsQueueReport',_0x2695a0,JSON['stringify'](_0x3044ea));_0x2d3bf(_0x3044ea);})[_0x3d62('0x1c')](function(_0x559fc6){logger[_0x3d62('0x12')](_0x3d62('0x16'),_0x559fc6[_0x3d62('0x14')],_0x2695a0);_0x660b7a(_0x96306f[_0x3d62('0x12')](0x1f4,_0x559fc6[_0x3d62('0x14')]));});});};exports[_0x3d62('0x1d')]=function(_0xf20c4f){var _0x5815ae=this;return new Promise(function(_0x2d58a6,_0x367944){return db[_0x3d62('0x17')][_0x3d62('0x1e')](_0xf20c4f[_0x3d62('0x18')],{'raw':_0xf20c4f[_0x3d62('0x19')]?_0xf20c4f[_0x3d62('0x19')][_0x3d62('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf20c4f[_0x3d62('0x19')]?_0xf20c4f[_0x3d62('0x19')][_0x3d62('0x1f')]||null:null,'attributes':_0xf20c4f['options']?_0xf20c4f[_0x3d62('0x19')][_0x3d62('0x20')]||null:null,'limit':_0xf20c4f[_0x3d62('0x19')]?_0xf20c4f[_0x3d62('0x19')][_0x3d62('0x21')]||null:null})['then'](function(_0x1b174d){logger[_0x3d62('0xc')](_0x3d62('0x1d'),_0xf20c4f);logger['debug']('UpdateSmsQueueReport',_0xf20c4f,JSON[_0x3d62('0x11')](_0x1b174d));_0x2d58a6(_0x1b174d);})[_0x3d62('0x1c')](function(_0x2fb6a3){logger[_0x3d62('0x12')]('UpdateSmsQueueReport',_0x2fb6a3[_0x3d62('0x14')],_0xf20c4f);_0x367944(_0x5815ae['error'](0x1f4,_0x2fb6a3[_0x3d62('0x14')]));});});}; \ No newline at end of file +var _0x1491=['ioredis','../../config/utils','rpc','jayson/promise','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateSmsQueueReport','options','raw','catch','UpdateSmsQueueReport','SmsQueueReport','update','body','where','attributes','lodash','moment','bluebird'];(function(_0x5ee8a6,_0x1260a4){var _0xa485d6=function(_0x1912b5){while(--_0x1912b5){_0x5ee8a6['push'](_0x5ee8a6['shift']());}};_0xa485d6(++_0x1260a4);}(_0x1491,0xc8));var _0x1149=function(_0x3ed6c8,_0x1114d9){_0x3ed6c8=_0x3ed6c8-0x0;var _0x11eaf5=_0x1491[_0x3ed6c8];return _0x11eaf5;};'use strict';var _=require(_0x1149('0x0'));var util=require('util');var moment=require(_0x1149('0x1'));var BPromise=require(_0x1149('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1149('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1149('0x4'));var logger=require('../../config/logger')(_0x1149('0x5'));var config=require('../../config/environment');var jayson=require(_0x1149('0x6'));var client=jayson['client'][_0x1149('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fb2ec,_0x33f486,_0x381f55){return new BPromise(function(_0x36f750,_0x2da747){return client['request'](_0x4fb2ec,_0x381f55)[_0x1149('0x8')](function(_0x46dd33){logger[_0x1149('0x9')](_0x1149('0xa'),_0x33f486,_0x1149('0xb'));logger[_0x1149('0xc')](_0x1149('0xd'),_0x33f486,_0x1149('0xb'),JSON[_0x1149('0xe')](_0x46dd33));if(_0x46dd33['error']){if(_0x46dd33['error'][_0x1149('0xf')]===0x1f4){logger['error'](_0x1149('0xa'),_0x33f486,_0x46dd33[_0x1149('0x10')][_0x1149('0x11')]);return _0x2da747(_0x46dd33[_0x1149('0x10')][_0x1149('0x11')]);}logger[_0x1149('0x10')](_0x1149('0xa'),_0x33f486,_0x46dd33[_0x1149('0x10')][_0x1149('0x11')]);return _0x36f750(_0x46dd33[_0x1149('0x10')][_0x1149('0x11')]);}else{logger['info'](_0x1149('0xa'),_0x33f486,_0x1149('0xb'));_0x36f750(_0x46dd33[_0x1149('0x12')][_0x1149('0x11')]);}})['catch'](function(_0x4c816f){logger[_0x1149('0x10')](_0x1149('0xa'),_0x33f486,_0x4c816f);_0x2da747(_0x4c816f);});});}exports[_0x1149('0x13')]=function(_0x87d596){var _0x326724=this;return new Promise(function(_0x76e7ff,_0x5310fa){return db['SmsQueueReport']['create'](_0x87d596['body'],{'raw':_0x87d596[_0x1149('0x14')]?_0x87d596['options'][_0x1149('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0xf06d60){logger[_0x1149('0x9')](_0x1149('0x13'),_0x87d596);logger[_0x1149('0xc')](_0x1149('0x13'),_0x87d596,JSON[_0x1149('0xe')](_0xf06d60));_0x76e7ff(_0xf06d60);})[_0x1149('0x16')](function(_0x26f06b){logger['error'](_0x1149('0x13'),_0x26f06b[_0x1149('0x11')],_0x87d596);_0x5310fa(_0x326724[_0x1149('0x10')](0x1f4,_0x26f06b['message']));});});};exports[_0x1149('0x17')]=function(_0x3a5b3c){var _0x242b6e=this;return new Promise(function(_0x238cc1,_0x4194f1){return db[_0x1149('0x18')][_0x1149('0x19')](_0x3a5b3c[_0x1149('0x1a')],{'raw':_0x3a5b3c['options']?_0x3a5b3c[_0x1149('0x14')][_0x1149('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5b3c['options']?_0x3a5b3c[_0x1149('0x14')][_0x1149('0x1b')]||null:null,'attributes':_0x3a5b3c[_0x1149('0x14')]?_0x3a5b3c[_0x1149('0x14')][_0x1149('0x1c')]||null:null,'limit':_0x3a5b3c[_0x1149('0x14')]?_0x3a5b3c[_0x1149('0x14')]['limit']||null:null})['then'](function(_0x242cff){logger[_0x1149('0x9')](_0x1149('0x17'),_0x3a5b3c);logger[_0x1149('0xc')](_0x1149('0x17'),_0x3a5b3c,JSON['stringify'](_0x242cff));_0x238cc1(_0x242cff);})[_0x1149('0x16')](function(_0x9b9363){logger[_0x1149('0x10')](_0x1149('0x17'),_0x9b9363['message'],_0x3a5b3c);_0x4194f1(_0x242b6e['error'](0x1f4,_0x9b9363[_0x1149('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 5cf25b2..3324dc7 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc97=['get','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x217480,_0x368df7){_0x217480=_0x217480-0x0;var _0x4301e5=_0xdc97[_0x217480];return _0x4301e5;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['post']('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0xe')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf2ca=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','delete'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x494965,_0x48ace5){_0x494965=_0x494965-0x0;var _0x3e682e=_0xf2ca[_0x494965];return _0x3e682e;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./smsTransferReport.controller');router[_0xaf2c('0x9')]('/',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0x9')]('/describe',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xc')]);router['get'](_0xaf2c('0xd'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['post']('/',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xf')]);router[_0xaf2c('0x10')](_0xaf2c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaf2c('0x11')](_0xaf2c('0xd'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x12')]);module[_0xaf2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index afe8cfd..8c8ce6f 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0xb42ec7,_0x4a0132){var _0x5824d5=function(_0x3dfd6f){while(--_0x3dfd6f){_0xb42ec7['push'](_0xb42ec7['shift']());}};_0x5824d5(++_0x4a0132);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x481b2f,_0x5331bb){var _0x2a97fd=function(_0x4adcef){while(--_0x4adcef){_0x481b2f['push'](_0x481b2f['shift']());}};_0x2a97fd(++_0x5331bb);}(_0xedd9,0xfc));var _0x9edd=function(_0x161b9a,_0x56cfab){_0x161b9a=_0x161b9a-0x0;var _0x1be4ab=_0xedd9[_0x161b9a];return _0x1be4ab;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index d72ded5..bf85307 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdda2=['ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','SmsTransferReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2084b1,_0x3ac9f3){var _0x2ae65a=function(_0x4f4ab3){while(--_0x4f4ab3){_0x2084b1['push'](_0x2084b1['shift']());}};_0x2ae65a(++_0x3ac9f3);}(_0xdda2,0xdc));var _0x2dda=function(_0x33bb5a,_0x5668aa){_0x33bb5a=_0x33bb5a-0x0;var _0x2cbcd7=_0xdda2[_0x33bb5a];return _0x2cbcd7;};'use strict';var emlformat=require(_0x2dda('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dda('0x1'));var jsonpatch=require(_0x2dda('0x2'));var rp=require(_0x2dda('0x3'));var moment=require(_0x2dda('0x4'));var BPromise=require(_0x2dda('0x5'));var Mustache=require(_0x2dda('0x6'));var util=require(_0x2dda('0x7'));var path=require(_0x2dda('0x8'));var sox=require(_0x2dda('0x9'));var csv=require(_0x2dda('0xa'));var ejs=require(_0x2dda('0xb'));var fs=require('fs');var fs_extra=require(_0x2dda('0xc'));var _=require(_0x2dda('0xd'));var squel=require(_0x2dda('0xe'));var crypto=require('crypto');var jsforce=require(_0x2dda('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2dda('0xa'));var querystring=require('querystring');var Papa=require(_0x2dda('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2dda('0x11'));var as=require(_0x2dda('0x12'));var hardwareService=require(_0x2dda('0x13'));var logger=require('../../config/logger')(_0x2dda('0x14'));var utils=require(_0x2dda('0x15'));var config=require(_0x2dda('0x16'));var licenseUtil=require(_0x2dda('0x17'));var db=require(_0x2dda('0x18'))['db'];function respondWithStatusCode(_0x24df91,_0x3b0809){_0x3b0809=_0x3b0809||0xcc;return function(_0x531bf){if(_0x531bf){return _0x24df91[_0x2dda('0x19')](_0x3b0809);}return _0x24df91['status'](_0x3b0809)[_0x2dda('0x1a')]();};}function respondWithResult(_0x99078b,_0x46fb5f){_0x46fb5f=_0x46fb5f||0xc8;return function(_0x1dbfaa){if(_0x1dbfaa){return _0x99078b[_0x2dda('0x1b')](_0x46fb5f)[_0x2dda('0x1c')](_0x1dbfaa);}};}function respondWithFilteredResult(_0x4eaafd,_0x3701d3){return function(_0x1790ec){if(_0x1790ec){var _0x2e23ce=typeof _0x3701d3[_0x2dda('0x1d')]===_0x2dda('0x1e')&&typeof _0x3701d3[_0x2dda('0x1f')]===_0x2dda('0x1e');var _0x20dd35=_0x1790ec[_0x2dda('0x20')];var _0x327546=_0x2e23ce?0x0:_0x3701d3[_0x2dda('0x1d')];var _0x5bc9f5=_0x2e23ce?_0x1790ec[_0x2dda('0x20')]:_0x3701d3['offset']+_0x3701d3['limit'];var _0x4ef4da;if(_0x5bc9f5>=_0x20dd35){_0x5bc9f5=_0x20dd35;_0x4ef4da=0xc8;}else{_0x4ef4da=0xce;}_0x4eaafd['status'](_0x4ef4da);return _0x4eaafd[_0x2dda('0x21')](_0x2dda('0x22'),_0x327546+'-'+_0x5bc9f5+'/'+_0x20dd35)['json'](_0x1790ec);}return null;};}function patchUpdates(_0x8b68aa){return function(_0x8ba14e){try{jsonpatch[_0x2dda('0x23')](_0x8ba14e,_0x8b68aa,!![]);}catch(_0x233678){return BPromise['reject'](_0x233678);}return _0x8ba14e[_0x2dda('0x24')]();};}function saveUpdates(_0x2e509b,_0x5d3aa2){return function(_0x43590f){if(_0x43590f){return _0x43590f[_0x2dda('0x25')](_0x2e509b)[_0x2dda('0x26')](function(_0x358c2a){return _0x358c2a;});}return null;};}function removeEntity(_0x48a975,_0x3872f3){return function(_0x96b58d){if(_0x96b58d){return _0x96b58d[_0x2dda('0x27')]()['then'](function(){_0x48a975[_0x2dda('0x1b')](0xcc)[_0x2dda('0x1a')]();});}};}function handleEntityNotFound(_0x5a1266,_0x149009){return function(_0x45b8cf){if(!_0x45b8cf){_0x5a1266[_0x2dda('0x19')](0x194);}return _0x45b8cf;};}function handleError(_0x2e90fc,_0x26bec2){_0x26bec2=_0x26bec2||0x1f4;return function(_0x4d4360){logger[_0x2dda('0x28')](_0x4d4360[_0x2dda('0x29')]);if(_0x4d4360[_0x2dda('0x2a')]){delete _0x4d4360[_0x2dda('0x2a')];}_0x2e90fc[_0x2dda('0x1b')](_0x26bec2)[_0x2dda('0x2b')](_0x4d4360);};}exports['index']=function(_0x226398,_0x3e9f59){var _0xd1a94a={},_0xf5c886={},_0x590e8e={'count':0x0,'rows':[]};var _0x11abd9=_[_0x2dda('0x2c')](db[_0x2dda('0x2d')]['rawAttributes'],function(_0x1610d6){return{'name':_0x1610d6[_0x2dda('0x2e')],'type':_0x1610d6[_0x2dda('0x2f')][_0x2dda('0x30')]};});_0xf5c886['model']=_['map'](_0x11abd9,_0x2dda('0x2a'));_0xf5c886[_0x2dda('0x31')]=_[_0x2dda('0x32')](_0x226398['query']);_0xf5c886[_0x2dda('0x33')]=_[_0x2dda('0x34')](_0xf5c886[_0x2dda('0x35')],_0xf5c886[_0x2dda('0x31')]);_0xd1a94a['attributes']=_[_0x2dda('0x34')](_0xf5c886[_0x2dda('0x35')],qs['fields'](_0x226398[_0x2dda('0x31')][_0x2dda('0x36')]));_0xd1a94a[_0x2dda('0x37')]=_0xd1a94a[_0x2dda('0x37')][_0x2dda('0x38')]?_0xd1a94a[_0x2dda('0x37')]:_0xf5c886[_0x2dda('0x35')];if(!_0x226398['query'][_0x2dda('0x39')](_0x2dda('0x3a'))){_0xd1a94a['limit']=qs[_0x2dda('0x1f')](_0x226398['query'][_0x2dda('0x1f')]);_0xd1a94a[_0x2dda('0x1d')]=qs[_0x2dda('0x1d')](_0x226398[_0x2dda('0x31')]['offset']);}_0xd1a94a[_0x2dda('0x3b')]=qs[_0x2dda('0x3c')](_0x226398['query'][_0x2dda('0x3c')]);_0xd1a94a['where']=qs['filters'](_[_0x2dda('0x3d')](_0x226398[_0x2dda('0x31')],_0xf5c886['filters']),_0x11abd9);if(_0x226398[_0x2dda('0x31')][_0x2dda('0x3e')]){_0xd1a94a[_0x2dda('0x3f')]=_[_0x2dda('0x40')](_0xd1a94a[_0x2dda('0x3f')],{'$or':_[_0x2dda('0x2c')](_0x11abd9,function(_0x421ebe){if(_0x421ebe[_0x2dda('0x2f')]!==_0x2dda('0x41')){var _0x4cc7ef={};_0x4cc7ef[_0x421ebe[_0x2dda('0x2a')]]={'$like':'%'+_0x226398[_0x2dda('0x31')][_0x2dda('0x3e')]+'%'};return _0x4cc7ef;}})});}_0xd1a94a=_[_0x2dda('0x40')]({},_0xd1a94a,_0x226398[_0x2dda('0x42')]);var _0x581a32={'where':_0xd1a94a[_0x2dda('0x3f')]};return db[_0x2dda('0x2d')][_0x2dda('0x20')](_0x581a32)['then'](function(_0x17e43e){_0x590e8e[_0x2dda('0x20')]=_0x17e43e;if(_0x226398[_0x2dda('0x31')][_0x2dda('0x43')]){_0xd1a94a[_0x2dda('0x44')]=[{'all':!![]}];}return db[_0x2dda('0x2d')][_0x2dda('0x45')](_0xd1a94a);})[_0x2dda('0x26')](function(_0x4d917e){_0x590e8e[_0x2dda('0x46')]=_0x4d917e;return _0x590e8e;})[_0x2dda('0x26')](respondWithFilteredResult(_0x3e9f59,_0xd1a94a))[_0x2dda('0x47')](handleError(_0x3e9f59,null));};exports[_0x2dda('0x48')]=function(_0x30dde6,_0x4c797b){var _0x3d96dd={'raw':!![],'where':{'id':_0x30dde6[_0x2dda('0x49')]['id']}},_0x516477={};_0x516477[_0x2dda('0x35')]=_[_0x2dda('0x32')](db['SmsTransferReport']['rawAttributes']);_0x516477['query']=_[_0x2dda('0x32')](_0x30dde6[_0x2dda('0x31')]);_0x516477[_0x2dda('0x33')]=_['intersection'](_0x516477[_0x2dda('0x35')],_0x516477[_0x2dda('0x31')]);_0x3d96dd['attributes']=_[_0x2dda('0x34')](_0x516477[_0x2dda('0x35')],qs[_0x2dda('0x36')](_0x30dde6['query']['fields']));_0x3d96dd[_0x2dda('0x37')]=_0x3d96dd[_0x2dda('0x37')][_0x2dda('0x38')]?_0x3d96dd[_0x2dda('0x37')]:_0x516477['model'];if(_0x30dde6[_0x2dda('0x31')][_0x2dda('0x43')]){_0x3d96dd[_0x2dda('0x44')]=[{'all':!![]}];}_0x3d96dd=_['merge']({},_0x3d96dd,_0x30dde6[_0x2dda('0x42')]);return db[_0x2dda('0x2d')][_0x2dda('0x4a')](_0x3d96dd)[_0x2dda('0x26')](handleEntityNotFound(_0x4c797b,null))[_0x2dda('0x26')](respondWithResult(_0x4c797b,null))[_0x2dda('0x47')](handleError(_0x4c797b,null));};exports['create']=function(_0x4c66c9,_0x4fb11e){return db[_0x2dda('0x2d')]['create'](_0x4c66c9[_0x2dda('0x4b')],{})[_0x2dda('0x26')](respondWithResult(_0x4fb11e,0xc9))[_0x2dda('0x47')](handleError(_0x4fb11e,null));};exports[_0x2dda('0x25')]=function(_0x2ae44f,_0x4c659a){if(_0x2ae44f['body']['id']){delete _0x2ae44f[_0x2dda('0x4b')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x2ae44f[_0x2dda('0x49')]['id']}})[_0x2dda('0x26')](handleEntityNotFound(_0x4c659a,null))[_0x2dda('0x26')](saveUpdates(_0x2ae44f[_0x2dda('0x4b')],null))[_0x2dda('0x26')](respondWithResult(_0x4c659a,null))[_0x2dda('0x47')](handleError(_0x4c659a,null));};exports[_0x2dda('0x27')]=function(_0x112248,_0x487e07){return db[_0x2dda('0x2d')][_0x2dda('0x4a')]({'where':{'id':_0x112248[_0x2dda('0x49')]['id']}})['then'](handleEntityNotFound(_0x487e07,null))[_0x2dda('0x26')](removeEntity(_0x487e07,null))[_0x2dda('0x47')](handleError(_0x487e07,null));};exports['describe']=function(_0x5b950d,_0x26ae5a){return db[_0x2dda('0x2d')][_0x2dda('0x4c')]()['then'](respondWithResult(_0x26ae5a,null))[_0x2dda('0x47')](handleError(_0x26ae5a,null));}; \ No newline at end of file +var _0x3250=['set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','filter','where','merge','options','include','findAll','rows','catch','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3250,0xbe));var _0x0325=function(_0x3d987b,_0x2a9a4f){_0x3d987b=_0x3d987b-0x0;var _0x588447=_0x3250[_0x3d987b];return _0x588447;};'use strict';var emlformat=require(_0x0325('0x0'));var rimraf=require(_0x0325('0x1'));var zipdir=require(_0x0325('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0325('0x3'));var moment=require(_0x0325('0x4'));var BPromise=require(_0x0325('0x5'));var Mustache=require(_0x0325('0x6'));var util=require('util');var path=require(_0x0325('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0325('0x8'));var fs=require('fs');var fs_extra=require(_0x0325('0x9'));var _=require(_0x0325('0xa'));var squel=require(_0x0325('0xb'));var crypto=require(_0x0325('0xc'));var jsforce=require(_0x0325('0xd'));var deskjs=require(_0x0325('0xe'));var toCsv=require(_0x0325('0xf'));var querystring=require(_0x0325('0x10'));var Papa=require(_0x0325('0x11'));var Redis=require(_0x0325('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0325('0x13'));var as=require(_0x0325('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0325('0x15'))(_0x0325('0x16'));var utils=require(_0x0325('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0325('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x218f43,_0x52c777){_0x52c777=_0x52c777||0xcc;return function(_0x367dd9){if(_0x367dd9){return _0x218f43[_0x0325('0x19')](_0x52c777);}return _0x218f43[_0x0325('0x1a')](_0x52c777)['end']();};}function respondWithResult(_0x51db5e,_0x2f1b84){_0x2f1b84=_0x2f1b84||0xc8;return function(_0x49aad0){if(_0x49aad0){return _0x51db5e[_0x0325('0x1a')](_0x2f1b84)[_0x0325('0x1b')](_0x49aad0);}};}function respondWithFilteredResult(_0x3ba830,_0xf2858b){return function(_0x316c97){if(_0x316c97){var _0x889ec6=typeof _0xf2858b[_0x0325('0x1c')]===_0x0325('0x1d')&&typeof _0xf2858b[_0x0325('0x1e')]===_0x0325('0x1d');var _0x35ff7c=_0x316c97['count'];var _0x453079=_0x889ec6?0x0:_0xf2858b[_0x0325('0x1c')];var _0x1fdcf4=_0x889ec6?_0x316c97[_0x0325('0x1f')]:_0xf2858b[_0x0325('0x1c')]+_0xf2858b[_0x0325('0x1e')];var _0x202fbe;if(_0x1fdcf4>=_0x35ff7c){_0x1fdcf4=_0x35ff7c;_0x202fbe=0xc8;}else{_0x202fbe=0xce;}_0x3ba830['status'](_0x202fbe);return _0x3ba830[_0x0325('0x20')](_0x0325('0x21'),_0x453079+'-'+_0x1fdcf4+'/'+_0x35ff7c)[_0x0325('0x1b')](_0x316c97);}return null;};}function patchUpdates(_0x359e6e){return function(_0x30cfc6){try{jsonpatch[_0x0325('0x22')](_0x30cfc6,_0x359e6e,!![]);}catch(_0x2ee39b){return BPromise['reject'](_0x2ee39b);}return _0x30cfc6[_0x0325('0x23')]();};}function saveUpdates(_0x4b14ed,_0x4975e7){return function(_0x439bc9){if(_0x439bc9){return _0x439bc9[_0x0325('0x24')](_0x4b14ed)[_0x0325('0x25')](function(_0x3778b4){return _0x3778b4;});}return null;};}function removeEntity(_0x3cd7ac,_0x56681a){return function(_0x5ce98b){if(_0x5ce98b){return _0x5ce98b[_0x0325('0x26')]()['then'](function(){_0x3cd7ac[_0x0325('0x1a')](0xcc)[_0x0325('0x27')]();});}};}function handleEntityNotFound(_0x430564,_0x2e1bcf){return function(_0xfd9ec){if(!_0xfd9ec){_0x430564['sendStatus'](0x194);}return _0xfd9ec;};}function handleError(_0x22c0a9,_0x48e0c0){_0x48e0c0=_0x48e0c0||0x1f4;return function(_0x551c40){logger['error'](_0x551c40[_0x0325('0x28')]);if(_0x551c40[_0x0325('0x29')]){delete _0x551c40[_0x0325('0x29')];}_0x22c0a9['status'](_0x48e0c0)[_0x0325('0x2a')](_0x551c40);};}exports[_0x0325('0x2b')]=function(_0x1ade68,_0x244f39){var _0x12c8cc={},_0x1c5f06={},_0x8bd7b5={'count':0x0,'rows':[]};var _0x2ab863=_[_0x0325('0x2c')](db[_0x0325('0x2d')][_0x0325('0x2e')],function(_0x2bc71d){return{'name':_0x2bc71d[_0x0325('0x2f')],'type':_0x2bc71d[_0x0325('0x30')][_0x0325('0x31')]};});_0x1c5f06[_0x0325('0x32')]=_[_0x0325('0x2c')](_0x2ab863,_0x0325('0x29'));_0x1c5f06[_0x0325('0x33')]=_[_0x0325('0x34')](_0x1ade68[_0x0325('0x33')]);_0x1c5f06[_0x0325('0x35')]=_[_0x0325('0x36')](_0x1c5f06['model'],_0x1c5f06[_0x0325('0x33')]);_0x12c8cc['attributes']=_['intersection'](_0x1c5f06[_0x0325('0x32')],qs[_0x0325('0x37')](_0x1ade68[_0x0325('0x33')][_0x0325('0x37')]));_0x12c8cc[_0x0325('0x38')]=_0x12c8cc[_0x0325('0x38')][_0x0325('0x39')]?_0x12c8cc[_0x0325('0x38')]:_0x1c5f06[_0x0325('0x32')];if(!_0x1ade68['query'][_0x0325('0x3a')]('nolimit')){_0x12c8cc[_0x0325('0x1e')]=qs[_0x0325('0x1e')](_0x1ade68[_0x0325('0x33')][_0x0325('0x1e')]);_0x12c8cc[_0x0325('0x1c')]=qs['offset'](_0x1ade68[_0x0325('0x33')][_0x0325('0x1c')]);}_0x12c8cc[_0x0325('0x3b')]=qs['sort'](_0x1ade68['query']['sort']);_0x12c8cc['where']=qs['filters'](_['pick'](_0x1ade68[_0x0325('0x33')],_0x1c5f06[_0x0325('0x35')]),_0x2ab863);if(_0x1ade68[_0x0325('0x33')][_0x0325('0x3c')]){_0x12c8cc[_0x0325('0x3d')]=_['merge'](_0x12c8cc[_0x0325('0x3d')],{'$or':_['map'](_0x2ab863,function(_0xbdf5f1){if(_0xbdf5f1[_0x0325('0x30')]!=='VIRTUAL'){var _0x48cab1={};_0x48cab1[_0xbdf5f1[_0x0325('0x29')]]={'$like':'%'+_0x1ade68[_0x0325('0x33')][_0x0325('0x3c')]+'%'};return _0x48cab1;}})});}_0x12c8cc=_[_0x0325('0x3e')]({},_0x12c8cc,_0x1ade68[_0x0325('0x3f')]);var _0x486c80={'where':_0x12c8cc[_0x0325('0x3d')]};return db['SmsTransferReport'][_0x0325('0x1f')](_0x486c80)[_0x0325('0x25')](function(_0x13dfbd){_0x8bd7b5[_0x0325('0x1f')]=_0x13dfbd;if(_0x1ade68[_0x0325('0x33')]['includeAll']){_0x12c8cc[_0x0325('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x0325('0x41')](_0x12c8cc);})[_0x0325('0x25')](function(_0x356154){_0x8bd7b5[_0x0325('0x42')]=_0x356154;return _0x8bd7b5;})['then'](respondWithFilteredResult(_0x244f39,_0x12c8cc))[_0x0325('0x43')](handleError(_0x244f39,null));};exports['show']=function(_0x52e807,_0x1c089e){var _0x555da6={'raw':!![],'where':{'id':_0x52e807[_0x0325('0x44')]['id']}},_0x288d4f={};_0x288d4f['model']=_[_0x0325('0x34')](db[_0x0325('0x2d')][_0x0325('0x2e')]);_0x288d4f[_0x0325('0x33')]=_[_0x0325('0x34')](_0x52e807[_0x0325('0x33')]);_0x288d4f[_0x0325('0x35')]=_[_0x0325('0x36')](_0x288d4f[_0x0325('0x32')],_0x288d4f[_0x0325('0x33')]);_0x555da6[_0x0325('0x38')]=_[_0x0325('0x36')](_0x288d4f[_0x0325('0x32')],qs[_0x0325('0x37')](_0x52e807[_0x0325('0x33')][_0x0325('0x37')]));_0x555da6[_0x0325('0x38')]=_0x555da6[_0x0325('0x38')][_0x0325('0x39')]?_0x555da6[_0x0325('0x38')]:_0x288d4f['model'];if(_0x52e807[_0x0325('0x33')][_0x0325('0x45')]){_0x555da6[_0x0325('0x40')]=[{'all':!![]}];}_0x555da6=_['merge']({},_0x555da6,_0x52e807[_0x0325('0x3f')]);return db[_0x0325('0x2d')]['find'](_0x555da6)[_0x0325('0x25')](handleEntityNotFound(_0x1c089e,null))[_0x0325('0x25')](respondWithResult(_0x1c089e,null))[_0x0325('0x43')](handleError(_0x1c089e,null));};exports[_0x0325('0x46')]=function(_0x146d22,_0x191143){return db[_0x0325('0x2d')][_0x0325('0x46')](_0x146d22[_0x0325('0x47')],{})['then'](respondWithResult(_0x191143,0xc9))[_0x0325('0x43')](handleError(_0x191143,null));};exports[_0x0325('0x24')]=function(_0x5e3f99,_0x285bbb){if(_0x5e3f99[_0x0325('0x47')]['id']){delete _0x5e3f99[_0x0325('0x47')]['id'];}return db[_0x0325('0x2d')][_0x0325('0x48')]({'where':{'id':_0x5e3f99['params']['id']}})['then'](handleEntityNotFound(_0x285bbb,null))[_0x0325('0x25')](saveUpdates(_0x5e3f99[_0x0325('0x47')],null))[_0x0325('0x25')](respondWithResult(_0x285bbb,null))['catch'](handleError(_0x285bbb,null));};exports[_0x0325('0x26')]=function(_0x52b0ce,_0x54af8b){return db[_0x0325('0x2d')][_0x0325('0x48')]({'where':{'id':_0x52b0ce[_0x0325('0x44')]['id']}})[_0x0325('0x25')](handleEntityNotFound(_0x54af8b,null))[_0x0325('0x25')](removeEntity(_0x54af8b,null))[_0x0325('0x43')](handleError(_0x54af8b,null));};exports[_0x0325('0x49')]=function(_0x2b69c7,_0x94e871){return db[_0x0325('0x2d')][_0x0325('0x49')]()[_0x0325('0x25')](respondWithResult(_0x94e871,null))[_0x0325('0x43')](handleError(_0x94e871,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index db504c3..63f5d14 100644 --- a/server/api/smsTransferReport/smsTransferReport.model.js +++ b/server/api/smsTransferReport/smsTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc52f=['util','bluebird','request-promise','path','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x49ccf0,_0x2e9d53){var _0x23ed5c=function(_0x376de5){while(--_0x376de5){_0x49ccf0['push'](_0x49ccf0['shift']());}};_0x23ed5c(++_0x2e9d53);}(_0xc52f,0x1e3));var _0xfc52=function(_0x395e4f,_0x196c84){_0x395e4f=_0x395e4f-0x0;var _0x15a669=_0xc52f[_0x395e4f];return _0x15a669;};'use strict';var _=require(_0xfc52('0x0'));var util=require(_0xfc52('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfc52('0x2'));var rp=require(_0xfc52('0x3'));var fs=require('fs');var path=require(_0xfc52('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfc52('0x5'));module[_0xfc52('0x6')]=function(_0x29636f,_0x5cb478){return _0x29636f[_0xfc52('0x7')](_0xfc52('0x8'),attributes,{'tableName':_0xfc52('0x9'),'paranoid':![],'indexes':[{'name':_0xfc52('0xa'),'fields':[_0xfc52('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa48b=['../../config/logger','bluebird','rimraf','../../config/environment','./smsTransferReport.attributes','report_sms_transfer','uniqueid','lodash','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa48b,0xc4));var _0xba48=function(_0x52e422,_0x2b4a02){_0x52e422=_0x52e422-0x0;var _0xec4089=_0xa48b[_0x52e422];return _0xec4089;};'use strict';var _=require(_0xba48('0x0'));var util=require(_0xba48('0x1'));var logger=require(_0xba48('0x2'))('api');var moment=require('moment');var BPromise=require(_0xba48('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xba48('0x4'));var config=require(_0xba48('0x5'));var attributes=require(_0xba48('0x6'));module['exports']=function(_0x10c8c0,_0x297568){return _0x10c8c0['define']('SmsTransferReport',attributes,{'tableName':_0xba48('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xba48('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index fe0c472..f71d18a 100644 --- a/server/api/smsTransferReport/smsTransferReport.rpc.js +++ b/server/api/smsTransferReport/smsTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03db=['client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x551d20,_0x2f9c1c){var _0x296e3d=function(_0x14cd4b){while(--_0x14cd4b){_0x551d20['push'](_0x551d20['shift']());}};_0x296e3d(++_0x2f9c1c);}(_0x03db,0x156));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb03d('0x0'));var util=require(_0xb03d('0x1'));var moment=require(_0xb03d('0x2'));var BPromise=require(_0xb03d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb03d('0x4'));var db=require(_0xb03d('0x5'))['db'];var utils=require(_0xb03d('0x6'));var logger=require(_0xb03d('0x7'))(_0xb03d('0x8'));var config=require('../../config/environment');var jayson=require(_0xb03d('0x9'));var client=jayson[_0xb03d('0xa')][_0xb03d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57a19b,_0xedddf,_0x5f1238){return new BPromise(function(_0x181291,_0x24ff92){return client[_0xb03d('0xc')](_0x57a19b,_0x5f1238)[_0xb03d('0xd')](function(_0x2748f7){logger[_0xb03d('0xe')](_0xb03d('0xf'),_0xedddf,'request\x20sent');logger[_0xb03d('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xedddf,'request\x20sent',JSON[_0xb03d('0x11')](_0x2748f7));if(_0x2748f7[_0xb03d('0x12')]){if(_0x2748f7['error']['code']===0x1f4){logger[_0xb03d('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0xedddf,_0x2748f7['error'][_0xb03d('0x13')]);return _0x24ff92(_0x2748f7['error'][_0xb03d('0x13')]);}logger[_0xb03d('0x12')](_0xb03d('0xf'),_0xedddf,_0x2748f7[_0xb03d('0x12')][_0xb03d('0x13')]);return _0x181291(_0x2748f7[_0xb03d('0x12')][_0xb03d('0x13')]);}else{logger['info'](_0xb03d('0xf'),_0xedddf,_0xb03d('0x14'));_0x181291(_0x2748f7[_0xb03d('0x15')]['message']);}})['catch'](function(_0x21fd7a){logger[_0xb03d('0x12')](_0xb03d('0xf'),_0xedddf,_0x21fd7a);_0x24ff92(_0x21fd7a);});});} \ No newline at end of file +var _0x61df=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x9db4,_0x82af81){var _0x26feae=function(_0x49eec2){while(--_0x49eec2){_0x9db4['push'](_0x9db4['shift']());}};_0x26feae(++_0x82af81);}(_0x61df,0xbd));var _0xf61d=function(_0x14c193,_0x35dced){_0x14c193=_0x14c193-0x0;var _0x45ea21=_0x61df[_0x14c193];return _0x45ea21;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf61d('0x0'));var rs=require(_0xf61d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf61d('0x2'))['db'];var utils=require(_0xf61d('0x3'));var logger=require('../../config/logger')(_0xf61d('0x4'));var config=require(_0xf61d('0x5'));var jayson=require(_0xf61d('0x6'));var client=jayson[_0xf61d('0x7')][_0xf61d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ac0ec,_0x5f0981,_0x42b382){return new BPromise(function(_0x49523e,_0x32ad93){return client[_0xf61d('0x9')](_0x3ac0ec,_0x42b382)[_0xf61d('0xa')](function(_0x1a5f29){logger[_0xf61d('0xb')](_0xf61d('0xc'),_0x5f0981,_0xf61d('0xd'));logger[_0xf61d('0xe')](_0xf61d('0xf'),_0x5f0981,_0xf61d('0xd'),JSON[_0xf61d('0x10')](_0x1a5f29));if(_0x1a5f29[_0xf61d('0x11')]){if(_0x1a5f29['error'][_0xf61d('0x12')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x5f0981,_0x1a5f29[_0xf61d('0x11')]['message']);return _0x32ad93(_0x1a5f29['error']['message']);}logger[_0xf61d('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x5f0981,_0x1a5f29['error'][_0xf61d('0x13')]);return _0x49523e(_0x1a5f29[_0xf61d('0x11')][_0xf61d('0x13')]);}else{logger[_0xf61d('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x5f0981,_0xf61d('0xd'));_0x49523e(_0x1a5f29[_0xf61d('0x14')][_0xf61d('0x13')]);}})[_0xf61d('0x15')](function(_0x51405a){logger['error'](_0xf61d('0xc'),_0x5f0981,_0x51405a);_0x32ad93(_0x51405a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9c2b380..a48191e 100644 --- a/server/api/sound/index.js +++ b/server/api/sound/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5fd=['originalname','extname','post','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','root','replace','format','%s-%s%s','basename'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf5fd,0xae));var _0xdf5f=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xf5fd[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0xdf5f('0x0'));var util=require(_0xdf5f('0x1'));var path=require(_0xdf5f('0x2'));var timeout=require(_0xdf5f('0x3'));var express=require(_0xdf5f('0x4'));var router=express[_0xdf5f('0x5')]();var fs_extra=require(_0xdf5f('0x6'));var auth=require(_0xdf5f('0x7'));var interaction=require(_0xdf5f('0x8'));var config=require(_0xdf5f('0x9'));var controller=require(_0xdf5f('0xa'));router[_0xdf5f('0xb')]('/',auth[_0xdf5f('0xc')](),controller[_0xdf5f('0xd')]);router[_0xdf5f('0xb')](_0xdf5f('0xe'),auth['isAuthenticated'](),controller[_0xdf5f('0xf')]);router['get'](_0xdf5f('0x10'),auth['isAuthenticated'](),controller[_0xdf5f('0x11')]);var upload=multer({'storage':multer[_0xdf5f('0x12')]({'destination':function(_0x520d84,_0x26dcc2,_0x38011b){_0x38011b(null,path['join'](config[_0xdf5f('0x13')],'server/files/sounds/original/'));},'filename':function(_0x53ab5b,_0x565d4c,_0x2ebad7){_0x565d4c['originalname']=_0x565d4c['originalname'][_0xdf5f('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ebad7(null,util[_0xdf5f('0x15')](_0xdf5f('0x16'),path[_0xdf5f('0x17')](_0x565d4c[_0xdf5f('0x18')],path[_0xdf5f('0x19')](_0x565d4c[_0xdf5f('0x18')])),Date['now'](),path[_0xdf5f('0x19')](_0x565d4c[_0xdf5f('0x18')])));}})});router[_0xdf5f('0x1a')]('/',upload['single'](_0xdf5f('0x1b')),controller[_0xdf5f('0x1c')]);router[_0xdf5f('0x1d')](_0xdf5f('0xe'),auth[_0xdf5f('0xc')](),controller[_0xdf5f('0x1e')]);router[_0xdf5f('0x1f')](_0xdf5f('0xe'),auth[_0xdf5f('0xc')](),controller[_0xdf5f('0x1f')]);module[_0xdf5f('0x20')]=router; \ No newline at end of file +var _0x02e9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','download','diskStorage','root','originalname','replace','format','%s-%s%s','extname','single','update','delete','exports','multer'];(function(_0x486e6f,_0x395450){var _0x104212=function(_0x368754){while(--_0x368754){_0x486e6f['push'](_0x486e6f['shift']());}};_0x104212(++_0x395450);}(_0x02e9,0x16b));var _0x902e=function(_0x509469,_0x45e997){_0x509469=_0x509469-0x0;var _0x317ba4=_0x02e9[_0x509469];return _0x317ba4;};'use strict';var multer=require(_0x902e('0x0'));var util=require(_0x902e('0x1'));var path=require(_0x902e('0x2'));var timeout=require(_0x902e('0x3'));var express=require(_0x902e('0x4'));var router=express[_0x902e('0x5')]();var fs_extra=require(_0x902e('0x6'));var auth=require(_0x902e('0x7'));var interaction=require(_0x902e('0x8'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x902e('0x9')]('/',auth[_0x902e('0xa')](),controller[_0x902e('0xb')]);router['get'](_0x902e('0xc'),auth['isAuthenticated'](),controller[_0x902e('0xd')]);router['get']('/:id/download',auth[_0x902e('0xa')](),controller[_0x902e('0xe')]);var upload=multer({'storage':multer[_0x902e('0xf')]({'destination':function(_0x5ada20,_0x492069,_0x31de8d){_0x31de8d(null,path['join'](config[_0x902e('0x10')],'server/files/sounds/original/'));},'filename':function(_0x4e4372,_0x1eed15,_0x57cf95){_0x1eed15[_0x902e('0x11')]=_0x1eed15['originalname'][_0x902e('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57cf95(null,util[_0x902e('0x13')](_0x902e('0x14'),path['basename'](_0x1eed15[_0x902e('0x11')],path[_0x902e('0x15')](_0x1eed15[_0x902e('0x11')])),Date['now'](),path[_0x902e('0x15')](_0x1eed15[_0x902e('0x11')])));}})});router['post']('/',upload[_0x902e('0x16')]('file'),controller['create']);router['put'](_0x902e('0xc'),auth[_0x902e('0xa')](),controller[_0x902e('0x17')]);router[_0x902e('0x18')](_0x902e('0xc'),auth[_0x902e('0xa')](),controller[_0x902e('0x18')]);module[_0x902e('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index d07754d..0afa7a6 100644 --- a/server/api/sound/sound.attributes.js +++ b/server/api/sound/sound.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a30=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x9a30,0xf8));var _0x09a3=function(_0x1b2a03,_0x133acf){_0x1b2a03=_0x1b2a03-0x0;var _0x21f98a=_0x9a30[_0x1b2a03];return _0x21f98a;};'use strict';var Sequelize=require(_0x09a3('0x0'));module[_0x09a3('0x1')]={'name':{'type':Sequelize[_0x09a3('0x2')],'unique':_0x09a3('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x09a3('0x2')]},'display_name':{'type':Sequelize[_0x09a3('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x09a3('0x2')]},'original_duration':{'type':Sequelize[_0x09a3('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x09a3('0x5')]},'original_sampleRate':{'type':Sequelize[_0x09a3('0x6')]},'converted_format':{'type':Sequelize[_0x09a3('0x2')]},'converted_duration':{'type':Sequelize[_0x09a3('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x09a3('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x09a3('0x6')]}}; \ No newline at end of file +var _0x0285=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x18dc18,_0x4d7733){var _0x3b1307=function(_0x3f0b69){while(--_0x3f0b69){_0x18dc18['push'](_0x18dc18['shift']());}};_0x3b1307(++_0x4d7733);}(_0x0285,0x14c));var _0x5028=function(_0x186ac3,_0x445715){_0x186ac3=_0x186ac3-0x0;var _0x23c7ad=_0x0285[_0x186ac3];return _0x23c7ad;};'use strict';var Sequelize=require(_0x5028('0x0'));module[_0x5028('0x1')]={'name':{'type':Sequelize[_0x5028('0x2')],'unique':_0x5028('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x5028('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x5028('0x2')]},'original_duration':{'type':Sequelize[_0x5028('0x4')]},'original_sampleCount':{'type':Sequelize[_0x5028('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x5028('0x5')]},'original_sampleRate':{'type':Sequelize[_0x5028('0x6')]},'converted_format':{'type':Sequelize[_0x5028('0x2')]},'converted_duration':{'type':Sequelize[_0x5028('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x5028('0x5')]},'converted_channelCount':{'type':Sequelize[_0x5028('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x5028('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index e1919db..ec037f9 100644 --- a/server/api/sound/sound.controller.js +++ b/server/api/sound/sound.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bcd=['start','params','delete','server/files/sounds/original','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','update','get','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','keys','find','save_name','existsSync','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','format','%s.%s','create','basename','file','extname','filename','originalname','wav','join','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Sounds','autoAssociation'];(function(_0x2558ee,_0x2a2574){var _0x431306=function(_0x32cb67){while(--_0x32cb67){_0x2558ee['push'](_0x2558ee['shift']());}};_0x431306(++_0x2a2574);}(_0x6bcd,0x7d));var _0xd6bc=function(_0x51958d,_0xf61731){_0x51958d=_0x51958d-0x0;var _0x4313fe=_0x6bcd[_0x51958d];return _0x4313fe;};'use strict';var emlformat=require(_0xd6bc('0x0'));var rimraf=require(_0xd6bc('0x1'));var zipdir=require(_0xd6bc('0x2'));var jsonpatch=require(_0xd6bc('0x3'));var rp=require('request-promise');var moment=require(_0xd6bc('0x4'));var BPromise=require(_0xd6bc('0x5'));var Mustache=require('mustache');var util=require(_0xd6bc('0x6'));var path=require('path');var sox=require(_0xd6bc('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6bc('0x8'));var _=require(_0xd6bc('0x9'));var squel=require('squel');var crypto=require(_0xd6bc('0xa'));var jsforce=require(_0xd6bc('0xb'));var deskjs=require(_0xd6bc('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6bc('0xd'));var Redis=require(_0xd6bc('0xe'));var authService=require(_0xd6bc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd6bc('0x10'));var hardwareService=require(_0xd6bc('0x11'));var logger=require(_0xd6bc('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd6bc('0x13'));var licenseUtil=require(_0xd6bc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14fa16,_0x30dd80){_0x30dd80=_0x30dd80||0xcc;return function(_0x578664){if(_0x578664){return _0x14fa16['sendStatus'](_0x30dd80);}return _0x14fa16['status'](_0x30dd80)[_0xd6bc('0x15')]();};}function respondWithResult(_0x1f6746,_0xc2449c){_0xc2449c=_0xc2449c||0xc8;return function(_0x35f5eb){if(_0x35f5eb){return _0x1f6746['status'](_0xc2449c)[_0xd6bc('0x16')](_0x35f5eb);}};}function respondWithFilteredResult(_0xd9f9cb,_0x506940){return function(_0x3d5a14){if(_0x3d5a14){var _0x2a7608=typeof _0x506940[_0xd6bc('0x17')]==='undefined'&&typeof _0x506940[_0xd6bc('0x18')]===_0xd6bc('0x19');var _0x4d846f=_0x3d5a14[_0xd6bc('0x1a')];var _0xfab39f=_0x2a7608?0x0:_0x506940[_0xd6bc('0x17')];var _0x4f8b9a=_0x2a7608?_0x3d5a14[_0xd6bc('0x1a')]:_0x506940[_0xd6bc('0x17')]+_0x506940['limit'];var _0x2efc41;if(_0x4f8b9a>=_0x4d846f){_0x4f8b9a=_0x4d846f;_0x2efc41=0xc8;}else{_0x2efc41=0xce;}_0xd9f9cb[_0xd6bc('0x1b')](_0x2efc41);return _0xd9f9cb[_0xd6bc('0x1c')](_0xd6bc('0x1d'),_0xfab39f+'-'+_0x4f8b9a+'/'+_0x4d846f)['json'](_0x3d5a14);}return null;};}function patchUpdates(_0x13c2e8){return function(_0x442bb8){try{jsonpatch[_0xd6bc('0x1e')](_0x442bb8,_0x13c2e8,!![]);}catch(_0x10b797){return BPromise[_0xd6bc('0x1f')](_0x10b797);}return _0x442bb8['save']();};}function saveUpdates(_0xc3bce4,_0x182cfc){return function(_0x1fb211){if(_0x1fb211){return _0x1fb211[_0xd6bc('0x20')](_0xc3bce4)['then'](function(_0x4d1ae0){return _0x4d1ae0;});}return null;};}function removeEntity(_0x50cd84,_0x1bd94d){return function(_0x1b5487){if(_0x1b5487){return _0x1b5487['destroy']()['then'](function(){var _0x14a1b7=_0x1b5487[_0xd6bc('0x21')]({'plain':!![]});var _0xe103fe='Sounds';return db[_0xd6bc('0x22')][_0xd6bc('0x23')]({'where':{'type':_0xe103fe,'resourceId':_0x14a1b7['id']}})[_0xd6bc('0x24')](function(){return _0x1b5487;});})[_0xd6bc('0x24')](function(){_0x50cd84[_0xd6bc('0x1b')](0xcc)[_0xd6bc('0x15')]();});}};}function handleEntityNotFound(_0x4c6093,_0x135c47){return function(_0x232deb){if(!_0x232deb){_0x4c6093[_0xd6bc('0x25')](0x194);}return _0x232deb;};}function handleError(_0x6e6708,_0x31ff0f){_0x31ff0f=_0x31ff0f||0x1f4;return function(_0x4fbb99){logger[_0xd6bc('0x26')](_0x4fbb99[_0xd6bc('0x27')]);if(_0x4fbb99['name']){delete _0x4fbb99[_0xd6bc('0x28')];}_0x6e6708[_0xd6bc('0x1b')](_0x31ff0f)[_0xd6bc('0x29')](_0x4fbb99);};}exports[_0xd6bc('0x2a')]=function(_0x49e5d1,_0x30ec35){var _0x53ecc4={},_0x4abbc4={},_0xe4926d={'count':0x0,'rows':[]};var _0x29e5c4=_[_0xd6bc('0x2b')](db[_0xd6bc('0x2c')][_0xd6bc('0x2d')],function(_0x3dd4e8){return{'name':_0x3dd4e8[_0xd6bc('0x2e')],'type':_0x3dd4e8['type'][_0xd6bc('0x2f')]};});_0x4abbc4[_0xd6bc('0x30')]=_['map'](_0x29e5c4,_0xd6bc('0x28'));_0x4abbc4[_0xd6bc('0x31')]=_['keys'](_0x49e5d1[_0xd6bc('0x31')]);_0x4abbc4[_0xd6bc('0x32')]=_['intersection'](_0x4abbc4[_0xd6bc('0x30')],_0x4abbc4['query']);_0x53ecc4['attributes']=_[_0xd6bc('0x33')](_0x4abbc4[_0xd6bc('0x30')],qs[_0xd6bc('0x34')](_0x49e5d1[_0xd6bc('0x31')][_0xd6bc('0x34')]));_0x53ecc4[_0xd6bc('0x35')]=_0x53ecc4[_0xd6bc('0x35')][_0xd6bc('0x36')]?_0x53ecc4[_0xd6bc('0x35')]:_0x4abbc4['model'];if(!_0x49e5d1[_0xd6bc('0x31')][_0xd6bc('0x37')](_0xd6bc('0x38'))){_0x53ecc4[_0xd6bc('0x18')]=qs[_0xd6bc('0x18')](_0x49e5d1[_0xd6bc('0x31')][_0xd6bc('0x18')]);_0x53ecc4['offset']=qs[_0xd6bc('0x17')](_0x49e5d1['query'][_0xd6bc('0x17')]);}_0x53ecc4[_0xd6bc('0x39')]=qs[_0xd6bc('0x3a')](_0x49e5d1['query'][_0xd6bc('0x3a')]);_0x53ecc4[_0xd6bc('0x3b')]=qs[_0xd6bc('0x32')](_[_0xd6bc('0x3c')](_0x49e5d1['query'],_0x4abbc4[_0xd6bc('0x32')]),_0x29e5c4);if(_0x49e5d1[_0xd6bc('0x31')][_0xd6bc('0x3d')]){_0x53ecc4[_0xd6bc('0x3b')]=_['merge'](_0x53ecc4[_0xd6bc('0x3b')],{'$or':_['map'](_0x29e5c4,function(_0x39e3c6){if(_0x39e3c6['type']!=='VIRTUAL'){var _0x46381a={};_0x46381a[_0x39e3c6['name']]={'$like':'%'+_0x49e5d1[_0xd6bc('0x31')][_0xd6bc('0x3d')]+'%'};return _0x46381a;}})});}_0x53ecc4=_[_0xd6bc('0x3e')]({},_0x53ecc4,_0x49e5d1[_0xd6bc('0x3f')]);var _0xd23b82={'where':_0x53ecc4[_0xd6bc('0x3b')]};return db[_0xd6bc('0x2c')]['count'](_0xd23b82)[_0xd6bc('0x24')](function(_0x32fe7c){_0xe4926d['count']=_0x32fe7c;if(_0x49e5d1['query'][_0xd6bc('0x40')]){_0x53ecc4[_0xd6bc('0x41')]=[{'all':!![]}];}return db[_0xd6bc('0x2c')]['findAll'](_0x53ecc4);})[_0xd6bc('0x24')](function(_0x12aa6a){_0xe4926d[_0xd6bc('0x42')]=_0x12aa6a;return _0xe4926d;})[_0xd6bc('0x24')](respondWithFilteredResult(_0x30ec35,_0x53ecc4))[_0xd6bc('0x43')](handleError(_0x30ec35,null));};exports[_0xd6bc('0x44')]=function(_0x24a10c,_0x26a5fb){var _0x101f24={'raw':!![],'where':{'id':_0x24a10c['params']['id']}},_0x54e1c9={};_0x54e1c9['model']=_[_0xd6bc('0x45')](db[_0xd6bc('0x2c')][_0xd6bc('0x2d')]);_0x54e1c9[_0xd6bc('0x31')]=_[_0xd6bc('0x45')](_0x24a10c[_0xd6bc('0x31')]);_0x54e1c9[_0xd6bc('0x32')]=_[_0xd6bc('0x33')](_0x54e1c9[_0xd6bc('0x30')],_0x54e1c9['query']);_0x101f24[_0xd6bc('0x35')]=_[_0xd6bc('0x33')](_0x54e1c9['model'],qs[_0xd6bc('0x34')](_0x24a10c['query'][_0xd6bc('0x34')]));_0x101f24[_0xd6bc('0x35')]=_0x101f24[_0xd6bc('0x35')][_0xd6bc('0x36')]?_0x101f24[_0xd6bc('0x35')]:_0x54e1c9['model'];if(_0x24a10c[_0xd6bc('0x31')][_0xd6bc('0x40')]){_0x101f24['include']=[{'all':!![]}];}_0x101f24=_[_0xd6bc('0x3e')]({},_0x101f24,_0x24a10c['options']);return db[_0xd6bc('0x2c')]['find'](_0x101f24)[_0xd6bc('0x24')](handleEntityNotFound(_0x26a5fb,null))[_0xd6bc('0x24')](respondWithResult(_0x26a5fb,null))['catch'](handleError(_0x26a5fb,null));};exports['download']=function(_0x3d2989,_0x392404,_0x43587c){return db[_0xd6bc('0x2c')][_0xd6bc('0x46')]({'where':{'id':_0x3d2989['params']['id']},'attributes':[_0xd6bc('0x28'),_0xd6bc('0x47'),'converted_format'],'raw':!![]})[_0xd6bc('0x24')](handleEntityNotFound(_0x392404,null))[_0xd6bc('0x24')](function(_0x4fcbab){if(_0x4fcbab){if(!fs[_0xd6bc('0x48')](path['join'](config[_0xd6bc('0x49')],_0xd6bc('0x4a'),_0x4fcbab[_0xd6bc('0x47')]+'.'+_0x4fcbab[_0xd6bc('0x4b')]))){throw new db[(_0xd6bc('0x4c'))][(_0xd6bc('0x4d'))]('Sound\x20not\x20found');}return _0x392404['download'](path['join'](config['root'],_0xd6bc('0x4a'),util[_0xd6bc('0x4e')]('%s.%s',_0x4fcbab[_0xd6bc('0x47')],_0x4fcbab[_0xd6bc('0x4b')])),util['format'](_0xd6bc('0x4f'),_0x4fcbab[_0xd6bc('0x28')],_0x4fcbab[_0xd6bc('0x4b')]));}return null;})[_0xd6bc('0x43')](handleError(_0x392404,null));};exports[_0xd6bc('0x50')]=function(_0x2ed683,_0x3e0da2,_0x12ab09){var _0x5d3ac4={'name':path[_0xd6bc('0x51')](_0x2ed683[_0xd6bc('0x52')]['originalname'],path[_0xd6bc('0x53')](_0x2ed683[_0xd6bc('0x52')]['originalname'])),'save_name':path[_0xd6bc('0x51')](_0x2ed683[_0xd6bc('0x52')]['filename'],path['extname'](_0x2ed683[_0xd6bc('0x52')][_0xd6bc('0x54')])),'original_format':path[_0xd6bc('0x53')](_0x2ed683[_0xd6bc('0x52')][_0xd6bc('0x55')])['substring'](0x1),'converted_format':_0xd6bc('0x56')};var _0x28ddab=path['join'](config[_0xd6bc('0x49')],'server/files/sounds/original',_0x2ed683['file'][_0xd6bc('0x54')]);var _0x1d74d8=path[_0xd6bc('0x57')](config[_0xd6bc('0x49')],_0xd6bc('0x4a'),util[_0xd6bc('0x4e')](_0xd6bc('0x4f'),path[_0xd6bc('0x51')](_0x2ed683['file']['filename'],path[_0xd6bc('0x53')](_0x2ed683[_0xd6bc('0x52')][_0xd6bc('0x54')])),_0x5d3ac4[_0xd6bc('0x4b')]));logger['info'](_0xd6bc('0x58'),_0x28ddab);logger['info'](_0xd6bc('0x59'),_0x1d74d8);try{fs[_0xd6bc('0x5a')](_0x28ddab,parseInt(_0xd6bc('0x5b'),0x8));var _0x265d54=sox[_0xd6bc('0x5c')](_0x28ddab,_0x1d74d8,{'sampleRate':0x1f40,'format':_0xd6bc('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x265d54['on'](_0xd6bc('0x26'),function(_0x435e21){fs[_0xd6bc('0x5d')](_0x28ddab);_0x3e0da2[_0xd6bc('0x1b')](0x1f4)[_0xd6bc('0x29')](_0x435e21);});_0x265d54['on'](_0xd6bc('0x5e'),function(_0x33651f){_0x5d3ac4[_0xd6bc('0x5f')]=isNaN(_0x33651f[_0xd6bc('0x60')])?null:_0x33651f[_0xd6bc('0x60')]*0x3e8;_0x5d3ac4[_0xd6bc('0x61')]=isNaN(_0x33651f[_0xd6bc('0x62')])?null:_0x33651f[_0xd6bc('0x62')];_0x5d3ac4[_0xd6bc('0x63')]=isNaN(_0x33651f[_0xd6bc('0x64')])?null:_0x33651f[_0xd6bc('0x64')];_0x5d3ac4[_0xd6bc('0x65')]=isNaN(_0x33651f[_0xd6bc('0x66')])?null:_0x33651f[_0xd6bc('0x66')];_0x5d3ac4[_0xd6bc('0x67')]=isNaN(_0x33651f[_0xd6bc('0x68')])?null:_0x33651f[_0xd6bc('0x68')];});_0x265d54['on'](_0xd6bc('0x69'),function(_0x24d8f5){_0x5d3ac4[_0xd6bc('0x6a')]=isNaN(_0x24d8f5[_0xd6bc('0x60')])?null:_0x24d8f5[_0xd6bc('0x60')]*0x3e8;_0x5d3ac4[_0xd6bc('0x6b')]=isNaN(_0x24d8f5[_0xd6bc('0x62')])?null:_0x24d8f5[_0xd6bc('0x62')];_0x5d3ac4[_0xd6bc('0x6c')]=isNaN(_0x24d8f5[_0xd6bc('0x64')])?null:_0x24d8f5[_0xd6bc('0x64')];_0x5d3ac4[_0xd6bc('0x6d')]=isNaN(_0x24d8f5[_0xd6bc('0x66')])?null:_0x24d8f5[_0xd6bc('0x66')];_0x5d3ac4['converted_sampleRate']=isNaN(_0x24d8f5['sampleRate'])?null:_0x24d8f5[_0xd6bc('0x68')];});_0x265d54['on'](_0xd6bc('0x15'),function(){fs[_0xd6bc('0x5a')](_0x1d74d8,parseInt(_0xd6bc('0x5b'),0x8));return db['Sound'][_0xd6bc('0x50')](_0x5d3ac4)['then'](function(_0xa4c468){var _0x4a8c23={'role':_0x2ed683['body'][_0xd6bc('0x6e')],'userProfileId':_0x2ed683[_0xd6bc('0x6f')][_0xd6bc('0x70')]};if(!_0x4a8c23)throw new Error(_0xd6bc('0x71'));if(_0x4a8c23[_0xd6bc('0x6e')]==='user'){var _0x53b490=_0xa4c468[_0xd6bc('0x21')]({'plain':!![]});return db[_0xd6bc('0x72')][_0xd6bc('0x46')]({'where':{'name':_0xd6bc('0x73'),'userProfileId':_0x4a8c23[_0xd6bc('0x70')]},'raw':!![]})[_0xd6bc('0x24')](function(_0x5d71f7){if(_0x5d71f7&&_0x5d71f7[_0xd6bc('0x74')]===0x0){return db['UserProfileResource']['create']({'name':_0x53b490[_0xd6bc('0x28')],'resourceId':_0x53b490['id'],'type':_0x5d71f7[_0xd6bc('0x28')],'sectionId':_0x5d71f7['id']},{})[_0xd6bc('0x24')](function(){return _0xa4c468;});}else{return _0xa4c468;}})[_0xd6bc('0x43')](function(_0x1b7fee){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b7fee);throw _0x1b7fee;});}return _0xa4c468;})[_0xd6bc('0x24')](respondWithResult(_0x3e0da2,null))[_0xd6bc('0x43')](handleError(_0x3e0da2,null));});_0x265d54[_0xd6bc('0x75')]();}catch(_0x14ed57){_0x3e0da2[_0xd6bc('0x1b')](0x1f4)[_0xd6bc('0x29')](_0x14ed57);}};exports[_0xd6bc('0x20')]=function(_0x36bb41,_0xfa7928,_0x5cf8dd){return db[_0xd6bc('0x2c')][_0xd6bc('0x46')]({'where':{'id':_0x36bb41[_0xd6bc('0x76')]['id']}})['then'](handleEntityNotFound(_0xfa7928,null))[_0xd6bc('0x24')](saveUpdates(_['pick'](_0x36bb41['body'],['name','description']),null))[_0xd6bc('0x24')](respondWithResult(_0xfa7928,null))['catch'](handleError(_0xfa7928,null));};exports[_0xd6bc('0x77')]=function(_0x27c1ad,_0x58b741,_0x44afd9){return db['Sound'][_0xd6bc('0x46')]({'where':{'id':_0x27c1ad['params']['id']}})['then'](function(_0x443bf4){if(_0x443bf4){return _0x443bf4['destroy']();}})['then'](function(_0x1fa8c7){var _0x3ad0a4=path['join'](config[_0xd6bc('0x49')],_0xd6bc('0x78'),util[_0xd6bc('0x4e')](_0xd6bc('0x4f'),_0x1fa8c7[_0xd6bc('0x47')],_0x1fa8c7['original_format']));var _0x4ad2a9=path[_0xd6bc('0x57')](config[_0xd6bc('0x49')],'server/files/sounds/converted',util[_0xd6bc('0x4e')]('%s.%s',_0x1fa8c7[_0xd6bc('0x47')],_0x1fa8c7[_0xd6bc('0x4b')]));fs[_0xd6bc('0x5d')](_0x3ad0a4);fs[_0xd6bc('0x5d')](_0x4ad2a9);return _0x1fa8c7;})['then'](function(_0x327886){if(_0x327886){return _0x58b741['status'](0xcc)[_0xd6bc('0x15')]();}})['then'](handleEntityNotFound(_0x58b741,null))[_0xd6bc('0x43')](handleError(_0x58b741,null));}; \ No newline at end of file +var _0x3b42=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','Sound','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','%s.%s','format','create','basename','originalname','extname','file','filename','substring','wav','join','info','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5e848d,_0x1dbd20){var _0x3785e5=function(_0xc82b39){while(--_0xc82b39){_0x5e848d['push'](_0x5e848d['shift']());}};_0x3785e5(++_0x1dbd20);}(_0x3b42,0x75));var _0x23b4=function(_0x1fa96c,_0x22f425){_0x1fa96c=_0x1fa96c-0x0;var _0x141440=_0x3b42[_0x1fa96c];return _0x141440;};'use strict';var emlformat=require(_0x23b4('0x0'));var rimraf=require(_0x23b4('0x1'));var zipdir=require(_0x23b4('0x2'));var jsonpatch=require(_0x23b4('0x3'));var rp=require(_0x23b4('0x4'));var moment=require(_0x23b4('0x5'));var BPromise=require(_0x23b4('0x6'));var Mustache=require(_0x23b4('0x7'));var util=require(_0x23b4('0x8'));var path=require(_0x23b4('0x9'));var sox=require(_0x23b4('0xa'));var csv=require(_0x23b4('0xb'));var ejs=require(_0x23b4('0xc'));var fs=require('fs');var fs_extra=require(_0x23b4('0xd'));var _=require(_0x23b4('0xe'));var squel=require(_0x23b4('0xf'));var crypto=require('crypto');var jsforce=require(_0x23b4('0x10'));var deskjs=require(_0x23b4('0x11'));var toCsv=require(_0x23b4('0xb'));var querystring=require(_0x23b4('0x12'));var Papa=require(_0x23b4('0x13'));var Redis=require('ioredis');var authService=require(_0x23b4('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x23b4('0x15'));var hardwareService=require(_0x23b4('0x16'));var logger=require(_0x23b4('0x17'))(_0x23b4('0x18'));var utils=require(_0x23b4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x23b4('0x1a'));var db=require(_0x23b4('0x1b'))['db'];function respondWithStatusCode(_0x3f1b2d,_0x491851){_0x491851=_0x491851||0xcc;return function(_0x13049e){if(_0x13049e){return _0x3f1b2d[_0x23b4('0x1c')](_0x491851);}return _0x3f1b2d['status'](_0x491851)[_0x23b4('0x1d')]();};}function respondWithResult(_0x22ac4e,_0x216251){_0x216251=_0x216251||0xc8;return function(_0x2c09d0){if(_0x2c09d0){return _0x22ac4e['status'](_0x216251)[_0x23b4('0x1e')](_0x2c09d0);}};}function respondWithFilteredResult(_0x43d0cb,_0x2110e4){return function(_0x22ab87){if(_0x22ab87){var _0x2204b0=typeof _0x2110e4['offset']===_0x23b4('0x1f')&&typeof _0x2110e4[_0x23b4('0x20')]===_0x23b4('0x1f');var _0x169be3=_0x22ab87[_0x23b4('0x21')];var _0x347798=_0x2204b0?0x0:_0x2110e4[_0x23b4('0x22')];var _0x55c781=_0x2204b0?_0x22ab87[_0x23b4('0x21')]:_0x2110e4[_0x23b4('0x22')]+_0x2110e4[_0x23b4('0x20')];var _0x2e887b;if(_0x55c781>=_0x169be3){_0x55c781=_0x169be3;_0x2e887b=0xc8;}else{_0x2e887b=0xce;}_0x43d0cb[_0x23b4('0x23')](_0x2e887b);return _0x43d0cb[_0x23b4('0x24')](_0x23b4('0x25'),_0x347798+'-'+_0x55c781+'/'+_0x169be3)['json'](_0x22ab87);}return null;};}function patchUpdates(_0x197716){return function(_0x1ca87b){try{jsonpatch[_0x23b4('0x26')](_0x1ca87b,_0x197716,!![]);}catch(_0x5f27b3){return BPromise[_0x23b4('0x27')](_0x5f27b3);}return _0x1ca87b['save']();};}function saveUpdates(_0x118342,_0x266355){return function(_0x585605){if(_0x585605){return _0x585605[_0x23b4('0x28')](_0x118342)[_0x23b4('0x29')](function(_0x5a7696){return _0x5a7696;});}return null;};}function removeEntity(_0x35dd0f,_0x263605){return function(_0x24dbac){if(_0x24dbac){return _0x24dbac[_0x23b4('0x2a')]()[_0x23b4('0x29')](function(){var _0x123af9=_0x24dbac[_0x23b4('0x2b')]({'plain':!![]});var _0x5e6efb=_0x23b4('0x2c');return db[_0x23b4('0x2d')][_0x23b4('0x2a')]({'where':{'type':_0x5e6efb,'resourceId':_0x123af9['id']}})[_0x23b4('0x29')](function(){return _0x24dbac;});})[_0x23b4('0x29')](function(){_0x35dd0f[_0x23b4('0x23')](0xcc)[_0x23b4('0x1d')]();});}};}function handleEntityNotFound(_0x5c3dce,_0x2ff984){return function(_0x46fdfa){if(!_0x46fdfa){_0x5c3dce[_0x23b4('0x1c')](0x194);}return _0x46fdfa;};}function handleError(_0x3bf718,_0x17c67b){_0x17c67b=_0x17c67b||0x1f4;return function(_0x414838){logger[_0x23b4('0x2e')](_0x414838[_0x23b4('0x2f')]);if(_0x414838[_0x23b4('0x30')]){delete _0x414838[_0x23b4('0x30')];}_0x3bf718[_0x23b4('0x23')](_0x17c67b)[_0x23b4('0x31')](_0x414838);};}exports['index']=function(_0x18e0e1,_0x14411f){var _0x477413={},_0x21cba2={},_0x5dbe33={'count':0x0,'rows':[]};var _0x16e398=_['map'](db[_0x23b4('0x32')][_0x23b4('0x33')],function(_0x5f35e5){return{'name':_0x5f35e5[_0x23b4('0x34')],'type':_0x5f35e5[_0x23b4('0x35')]['key']};});_0x21cba2[_0x23b4('0x36')]=_['map'](_0x16e398,_0x23b4('0x30'));_0x21cba2[_0x23b4('0x37')]=_[_0x23b4('0x38')](_0x18e0e1['query']);_0x21cba2[_0x23b4('0x39')]=_['intersection'](_0x21cba2[_0x23b4('0x36')],_0x21cba2['query']);_0x477413['attributes']=_[_0x23b4('0x3a')](_0x21cba2[_0x23b4('0x36')],qs[_0x23b4('0x3b')](_0x18e0e1['query']['fields']));_0x477413['attributes']=_0x477413[_0x23b4('0x3c')][_0x23b4('0x3d')]?_0x477413[_0x23b4('0x3c')]:_0x21cba2[_0x23b4('0x36')];if(!_0x18e0e1[_0x23b4('0x37')][_0x23b4('0x3e')](_0x23b4('0x3f'))){_0x477413['limit']=qs['limit'](_0x18e0e1[_0x23b4('0x37')]['limit']);_0x477413['offset']=qs['offset'](_0x18e0e1['query'][_0x23b4('0x22')]);}_0x477413[_0x23b4('0x40')]=qs[_0x23b4('0x41')](_0x18e0e1['query']['sort']);_0x477413[_0x23b4('0x42')]=qs[_0x23b4('0x39')](_[_0x23b4('0x43')](_0x18e0e1['query'],_0x21cba2[_0x23b4('0x39')]),_0x16e398);if(_0x18e0e1[_0x23b4('0x37')]['filter']){_0x477413[_0x23b4('0x42')]=_[_0x23b4('0x44')](_0x477413[_0x23b4('0x42')],{'$or':_[_0x23b4('0x45')](_0x16e398,function(_0x1eda31){if(_0x1eda31[_0x23b4('0x35')]!==_0x23b4('0x46')){var _0x2e336a={};_0x2e336a[_0x1eda31[_0x23b4('0x30')]]={'$like':'%'+_0x18e0e1[_0x23b4('0x37')][_0x23b4('0x47')]+'%'};return _0x2e336a;}})});}_0x477413=_[_0x23b4('0x44')]({},_0x477413,_0x18e0e1[_0x23b4('0x48')]);var _0x4f80e1={'where':_0x477413['where']};return db[_0x23b4('0x32')][_0x23b4('0x21')](_0x4f80e1)[_0x23b4('0x29')](function(_0x31deab){_0x5dbe33[_0x23b4('0x21')]=_0x31deab;if(_0x18e0e1[_0x23b4('0x37')]['includeAll']){_0x477413[_0x23b4('0x49')]=[{'all':!![]}];}return db[_0x23b4('0x32')][_0x23b4('0x4a')](_0x477413);})[_0x23b4('0x29')](function(_0xc5f886){_0x5dbe33[_0x23b4('0x4b')]=_0xc5f886;return _0x5dbe33;})[_0x23b4('0x29')](respondWithFilteredResult(_0x14411f,_0x477413))[_0x23b4('0x4c')](handleError(_0x14411f,null));};exports[_0x23b4('0x4d')]=function(_0x534521,_0x5a63d7){var _0x224da7={'raw':!![],'where':{'id':_0x534521[_0x23b4('0x4e')]['id']}},_0x38cf41={};_0x38cf41[_0x23b4('0x36')]=_[_0x23b4('0x38')](db[_0x23b4('0x32')]['rawAttributes']);_0x38cf41['query']=_[_0x23b4('0x38')](_0x534521['query']);_0x38cf41[_0x23b4('0x39')]=_['intersection'](_0x38cf41[_0x23b4('0x36')],_0x38cf41[_0x23b4('0x37')]);_0x224da7[_0x23b4('0x3c')]=_[_0x23b4('0x3a')](_0x38cf41[_0x23b4('0x36')],qs[_0x23b4('0x3b')](_0x534521[_0x23b4('0x37')][_0x23b4('0x3b')]));_0x224da7['attributes']=_0x224da7[_0x23b4('0x3c')][_0x23b4('0x3d')]?_0x224da7[_0x23b4('0x3c')]:_0x38cf41[_0x23b4('0x36')];if(_0x534521[_0x23b4('0x37')]['includeAll']){_0x224da7[_0x23b4('0x49')]=[{'all':!![]}];}_0x224da7=_[_0x23b4('0x44')]({},_0x224da7,_0x534521[_0x23b4('0x48')]);return db[_0x23b4('0x32')][_0x23b4('0x4f')](_0x224da7)[_0x23b4('0x29')](handleEntityNotFound(_0x5a63d7,null))['then'](respondWithResult(_0x5a63d7,null))[_0x23b4('0x4c')](handleError(_0x5a63d7,null));};exports['download']=function(_0x5e588d,_0x5b98b8,_0x190948){return db[_0x23b4('0x32')][_0x23b4('0x4f')]({'where':{'id':_0x5e588d[_0x23b4('0x4e')]['id']},'attributes':[_0x23b4('0x30'),_0x23b4('0x50'),_0x23b4('0x51')],'raw':!![]})[_0x23b4('0x29')](handleEntityNotFound(_0x5b98b8,null))['then'](function(_0x584c9a){if(_0x584c9a){if(!fs[_0x23b4('0x52')](path['join'](config[_0x23b4('0x53')],_0x23b4('0x54'),_0x584c9a[_0x23b4('0x50')]+'.'+_0x584c9a[_0x23b4('0x51')]))){throw new db[(_0x23b4('0x55'))][(_0x23b4('0x56'))](_0x23b4('0x57'));}return _0x5b98b8[_0x23b4('0x58')](path['join'](config[_0x23b4('0x53')],_0x23b4('0x54'),util['format'](_0x23b4('0x59'),_0x584c9a['save_name'],_0x584c9a[_0x23b4('0x51')])),util[_0x23b4('0x5a')](_0x23b4('0x59'),_0x584c9a[_0x23b4('0x30')],_0x584c9a['converted_format']));}return null;})['catch'](handleError(_0x5b98b8,null));};exports[_0x23b4('0x5b')]=function(_0x45ff44,_0x3045e3,_0x3c84e1){var _0x33fcb5={'name':path[_0x23b4('0x5c')](_0x45ff44['file'][_0x23b4('0x5d')],path[_0x23b4('0x5e')](_0x45ff44['file'][_0x23b4('0x5d')])),'save_name':path[_0x23b4('0x5c')](_0x45ff44[_0x23b4('0x5f')][_0x23b4('0x60')],path[_0x23b4('0x5e')](_0x45ff44['file'][_0x23b4('0x60')])),'original_format':path[_0x23b4('0x5e')](_0x45ff44[_0x23b4('0x5f')][_0x23b4('0x5d')])[_0x23b4('0x61')](0x1),'converted_format':_0x23b4('0x62')};var _0x408d50=path['join'](config[_0x23b4('0x53')],'server/files/sounds/original',_0x45ff44['file']['filename']);var _0x42c3ff=path[_0x23b4('0x63')](config[_0x23b4('0x53')],'server/files/sounds/converted',util[_0x23b4('0x5a')]('%s.%s',path[_0x23b4('0x5c')](_0x45ff44['file'][_0x23b4('0x60')],path['extname'](_0x45ff44[_0x23b4('0x5f')]['filename'])),_0x33fcb5[_0x23b4('0x51')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x408d50);logger[_0x23b4('0x64')]('Sound\x20upload\x20destination:\x20%s',_0x42c3ff);try{fs[_0x23b4('0x65')](_0x408d50,parseInt(_0x23b4('0x66'),0x8));var _0x32185b=sox[_0x23b4('0x67')](_0x408d50,_0x42c3ff,{'sampleRate':0x1f40,'format':_0x23b4('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x32185b['on'](_0x23b4('0x2e'),function(_0x1af181){fs[_0x23b4('0x68')](_0x408d50);_0x3045e3[_0x23b4('0x23')](0x1f4)['send'](_0x1af181);});_0x32185b['on']('src',function(_0x3fd5e4){_0x33fcb5[_0x23b4('0x69')]=isNaN(_0x3fd5e4[_0x23b4('0x6a')])?null:_0x3fd5e4[_0x23b4('0x6a')]*0x3e8;_0x33fcb5[_0x23b4('0x6b')]=isNaN(_0x3fd5e4[_0x23b4('0x6c')])?null:_0x3fd5e4[_0x23b4('0x6c')];_0x33fcb5[_0x23b4('0x6d')]=isNaN(_0x3fd5e4[_0x23b4('0x6e')])?null:_0x3fd5e4[_0x23b4('0x6e')];_0x33fcb5[_0x23b4('0x6f')]=isNaN(_0x3fd5e4[_0x23b4('0x70')])?null:_0x3fd5e4[_0x23b4('0x70')];_0x33fcb5[_0x23b4('0x71')]=isNaN(_0x3fd5e4['sampleRate'])?null:_0x3fd5e4[_0x23b4('0x72')];});_0x32185b['on'](_0x23b4('0x73'),function(_0x5bb0ca){_0x33fcb5[_0x23b4('0x74')]=isNaN(_0x5bb0ca[_0x23b4('0x6a')])?null:_0x5bb0ca['duration']*0x3e8;_0x33fcb5[_0x23b4('0x75')]=isNaN(_0x5bb0ca['sampleCount'])?null:_0x5bb0ca[_0x23b4('0x6c')];_0x33fcb5[_0x23b4('0x76')]=isNaN(_0x5bb0ca[_0x23b4('0x6e')])?null:_0x5bb0ca[_0x23b4('0x6e')];_0x33fcb5[_0x23b4('0x77')]=isNaN(_0x5bb0ca[_0x23b4('0x70')])?null:_0x5bb0ca[_0x23b4('0x70')];_0x33fcb5[_0x23b4('0x78')]=isNaN(_0x5bb0ca[_0x23b4('0x72')])?null:_0x5bb0ca[_0x23b4('0x72')];});_0x32185b['on']('end',function(){fs[_0x23b4('0x65')](_0x42c3ff,parseInt('0777',0x8));return db[_0x23b4('0x32')][_0x23b4('0x5b')](_0x33fcb5)['then'](function(_0x442bbc){var _0x567125={'role':_0x45ff44[_0x23b4('0x79')][_0x23b4('0x7a')],'userProfileId':_0x45ff44[_0x23b4('0x79')][_0x23b4('0x7b')]};if(!_0x567125)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x567125[_0x23b4('0x7a')]===_0x23b4('0x7c')){var _0x44d87f=_0x442bbc['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Sounds','userProfileId':_0x567125[_0x23b4('0x7b')]},'raw':!![]})['then'](function(_0x584b7e){if(_0x584b7e&&_0x584b7e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x44d87f[_0x23b4('0x30')],'resourceId':_0x44d87f['id'],'type':_0x584b7e[_0x23b4('0x30')],'sectionId':_0x584b7e['id']},{})[_0x23b4('0x29')](function(){return _0x442bbc;});}else{return _0x442bbc;}})['catch'](function(_0x2ce1a5){logger[_0x23b4('0x2e')](_0x23b4('0x7d'),_0x2ce1a5);throw _0x2ce1a5;});}return _0x442bbc;})[_0x23b4('0x29')](respondWithResult(_0x3045e3,null))[_0x23b4('0x4c')](handleError(_0x3045e3,null));});_0x32185b[_0x23b4('0x7e')]();}catch(_0x4dee8b){_0x3045e3[_0x23b4('0x23')](0x1f4)[_0x23b4('0x31')](_0x4dee8b);}};exports[_0x23b4('0x28')]=function(_0x33ff41,_0x49177d,_0x4f0fa9){return db['Sound']['find']({'where':{'id':_0x33ff41[_0x23b4('0x4e')]['id']}})[_0x23b4('0x29')](handleEntityNotFound(_0x49177d,null))[_0x23b4('0x29')](saveUpdates(_[_0x23b4('0x43')](_0x33ff41['body'],[_0x23b4('0x30'),'description']),null))[_0x23b4('0x29')](respondWithResult(_0x49177d,null))['catch'](handleError(_0x49177d,null));};exports[_0x23b4('0x7f')]=function(_0x2bdb00,_0x4f7876,_0xe0653a){return db['Sound']['find']({'where':{'id':_0x2bdb00[_0x23b4('0x4e')]['id']}})[_0x23b4('0x29')](function(_0xa9973a){if(_0xa9973a){return _0xa9973a[_0x23b4('0x2a')]();}})['then'](function(_0x4b05a5){var _0x42baed=path[_0x23b4('0x63')](config[_0x23b4('0x53')],'server/files/sounds/original',util[_0x23b4('0x5a')]('%s.%s',_0x4b05a5[_0x23b4('0x50')],_0x4b05a5[_0x23b4('0x80')]));var _0x57a1dc=path[_0x23b4('0x63')](config[_0x23b4('0x53')],_0x23b4('0x54'),util['format'](_0x23b4('0x59'),_0x4b05a5[_0x23b4('0x50')],_0x4b05a5[_0x23b4('0x51')]));fs[_0x23b4('0x68')](_0x42baed);fs[_0x23b4('0x68')](_0x57a1dc);return _0x4b05a5;})[_0x23b4('0x29')](function(_0x55f428){if(_0x55f428){return _0x4f7876['status'](0xcc)[_0x23b4('0x1d')]();}})['then'](handleEntityNotFound(_0x4f7876,null))['catch'](handleError(_0x4f7876,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 4b96c05..8acede0 100644 --- a/server/api/sound/sound.model.js +++ b/server/api/sound/sound.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf324=['api','moment','bluebird','path','rimraf','../../config/environment','define','Sound','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf324,0x15c));var _0x4f32=function(_0x29ca93,_0x182f70){_0x29ca93=_0x29ca93-0x0;var _0x58c0a0=_0xf324[_0x29ca93];return _0x58c0a0;};'use strict';var _=require('lodash');var util=require(_0x4f32('0x0'));var logger=require(_0x4f32('0x1'))(_0x4f32('0x2'));var moment=require(_0x4f32('0x3'));var BPromise=require(_0x4f32('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f32('0x5'));var rimraf=require(_0x4f32('0x6'));var config=require(_0x4f32('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x51458d,_0x3d4703){return _0x51458d[_0x4f32('0x8')](_0x4f32('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa55a=['moment','bluebird','request-promise','path','../../config/environment','./sound.attributes','exports','tools_sounds','util','../../config/logger','api'];(function(_0x3f159a,_0x438191){var _0x57530c=function(_0x104738){while(--_0x104738){_0x3f159a['push'](_0x3f159a['shift']());}};_0x57530c(++_0x438191);}(_0xa55a,0xa2));var _0xaa55=function(_0x1fc079,_0x4af514){_0x1fc079=_0x1fc079-0x0;var _0x234276=_0xa55a[_0x1fc079];return _0x234276;};'use strict';var _=require('lodash');var util=require(_0xaa55('0x0'));var logger=require(_0xaa55('0x1'))(_0xaa55('0x2'));var moment=require(_0xaa55('0x3'));var BPromise=require(_0xaa55('0x4'));var rp=require(_0xaa55('0x5'));var fs=require('fs');var path=require(_0xaa55('0x6'));var rimraf=require('rimraf');var config=require(_0xaa55('0x7'));var attributes=require(_0xaa55('0x8'));module[_0xaa55('0x9')]=function(_0x59438c,_0x3550da){return _0x59438c['define']('Sound',attributes,{'tableName':_0xaa55('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 8e12736..e94bd16 100644 --- a/server/api/sound/sound.rpc.js +++ b/server/api/sound/sound.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb660=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','message','catch','Sound,\x20%s,\x20%s','ShowSound','find','options','raw','where','attributes','include','map','model','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5d7294,_0x1bf034){var _0x2e5ecd=function(_0x3b4135){while(--_0x3b4135){_0x5d7294['push'](_0x5d7294['shift']());}};_0x2e5ecd(++_0x1bf034);}(_0xb660,0x101));var _0x0b66=function(_0x25300c,_0x8d65be){_0x25300c=_0x25300c-0x0;var _0x2dd3e4=_0xb660[_0x25300c];return _0x2dd3e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b66('0x0'));var BPromise=require('bluebird');var rs=require(_0x0b66('0x1'));var fs=require('fs');var Redis=require(_0x0b66('0x2'));var db=require(_0x0b66('0x3'))['db'];var utils=require(_0x0b66('0x4'));var logger=require(_0x0b66('0x5'))('rpc');var config=require(_0x0b66('0x6'));var jayson=require(_0x0b66('0x7'));var client=jayson[_0x0b66('0x8')][_0x0b66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5314f9,_0x145a05,_0x2cf57d){return new BPromise(function(_0x1d20a9,_0x45155f){return client[_0x0b66('0xa')](_0x5314f9,_0x2cf57d)[_0x0b66('0xb')](function(_0x43ccc5){logger[_0x0b66('0xc')]('Sound,\x20%s,\x20%s',_0x145a05,'request\x20sent');logger[_0x0b66('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x145a05,_0x0b66('0xe'),JSON['stringify'](_0x43ccc5));if(_0x43ccc5[_0x0b66('0xf')]){if(_0x43ccc5[_0x0b66('0xf')][_0x0b66('0x10')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x145a05,_0x43ccc5[_0x0b66('0xf')]['message']);return _0x45155f(_0x43ccc5['error'][_0x0b66('0x11')]);}logger[_0x0b66('0xf')]('Sound,\x20%s,\x20%s',_0x145a05,_0x43ccc5[_0x0b66('0xf')][_0x0b66('0x11')]);return _0x1d20a9(_0x43ccc5[_0x0b66('0xf')]['message']);}else{logger[_0x0b66('0xc')]('Sound,\x20%s,\x20%s',_0x145a05,_0x0b66('0xe'));_0x1d20a9(_0x43ccc5['result'][_0x0b66('0x11')]);}})[_0x0b66('0x12')](function(_0xd5e187){logger[_0x0b66('0xf')](_0x0b66('0x13'),_0x145a05,_0xd5e187);_0x45155f(_0xd5e187);});});}exports[_0x0b66('0x14')]=function(_0x289e4c){var _0x427732=this;return new Promise(function(_0x3f9e68,_0x27045a){return db['Sound'][_0x0b66('0x15')]({'raw':_0x289e4c[_0x0b66('0x16')]?_0x289e4c[_0x0b66('0x16')][_0x0b66('0x17')]===undefined?!![]:![]:!![],'where':_0x289e4c[_0x0b66('0x16')]?_0x289e4c[_0x0b66('0x16')][_0x0b66('0x18')]||null:null,'attributes':_0x289e4c[_0x0b66('0x16')]?_0x289e4c['options'][_0x0b66('0x19')]||null:null,'include':_0x289e4c[_0x0b66('0x16')]?_0x289e4c[_0x0b66('0x16')][_0x0b66('0x1a')]?_[_0x0b66('0x1b')](_0x289e4c[_0x0b66('0x16')][_0x0b66('0x1a')],function(_0x2f2398){return{'model':db[_0x2f2398[_0x0b66('0x1c')]],'as':_0x2f2398['as'],'attributes':_0x2f2398[_0x0b66('0x19')],'include':_0x2f2398[_0x0b66('0x1a')]?_[_0x0b66('0x1b')](_0x2f2398[_0x0b66('0x1a')],function(_0x3cdbb3){return{'model':db[_0x3cdbb3['model']],'as':_0x3cdbb3['as'],'attributes':_0x3cdbb3[_0x0b66('0x19')],'include':_0x3cdbb3[_0x0b66('0x1a')]?_[_0x0b66('0x1b')](_0x3cdbb3[_0x0b66('0x1a')],function(_0x52979c){return{'model':db[_0x52979c['model']],'as':_0x52979c['as'],'attributes':_0x52979c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b66('0xb')](function(_0x222927){logger[_0x0b66('0xc')](_0x0b66('0x14'),_0x289e4c);logger[_0x0b66('0xd')](_0x0b66('0x14'),_0x289e4c,JSON['stringify'](_0x222927));_0x3f9e68(_0x222927);})[_0x0b66('0x12')](function(_0x59a2ed){logger['error'](_0x0b66('0x14'),_0x59a2ed[_0x0b66('0x11')],_0x289e4c);_0x27045a(_0x427732[_0x0b66('0xf')](0x1f4,_0x59a2ed[_0x0b66('0x11')]));});});}; \ No newline at end of file +var _0x6518=['message','error','result','ShowSound','find','options','raw','attributes','map','include','model','stringify','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','code'];(function(_0x42e39d,_0x661e6e){var _0x413003=function(_0x5ef5b0){while(--_0x5ef5b0){_0x42e39d['push'](_0x42e39d['shift']());}};_0x413003(++_0x661e6e);}(_0x6518,0x15d));var _0x8651=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x6518[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8651('0x0'));var util=require(_0x8651('0x1'));var moment=require(_0x8651('0x2'));var BPromise=require(_0x8651('0x3'));var rs=require(_0x8651('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8651('0x5'));var logger=require(_0x8651('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8651('0x7')][_0x8651('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2aaddd,_0x4ef137,_0x21a652){return new BPromise(function(_0x18e338,_0x30f06c){return client[_0x8651('0x9')](_0x2aaddd,_0x21a652)['then'](function(_0x170ad3){logger[_0x8651('0xa')](_0x8651('0xb'),_0x4ef137,_0x8651('0xc'));logger[_0x8651('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x4ef137,_0x8651('0xc'),JSON['stringify'](_0x170ad3));if(_0x170ad3['error']){if(_0x170ad3['error'][_0x8651('0xe')]===0x1f4){logger['error'](_0x8651('0xb'),_0x4ef137,_0x170ad3['error'][_0x8651('0xf')]);return _0x30f06c(_0x170ad3[_0x8651('0x10')][_0x8651('0xf')]);}logger[_0x8651('0x10')](_0x8651('0xb'),_0x4ef137,_0x170ad3[_0x8651('0x10')][_0x8651('0xf')]);return _0x18e338(_0x170ad3[_0x8651('0x10')][_0x8651('0xf')]);}else{logger[_0x8651('0xa')](_0x8651('0xb'),_0x4ef137,_0x8651('0xc'));_0x18e338(_0x170ad3[_0x8651('0x11')][_0x8651('0xf')]);}})['catch'](function(_0x9aaf16){logger[_0x8651('0x10')](_0x8651('0xb'),_0x4ef137,_0x9aaf16);_0x30f06c(_0x9aaf16);});});}exports[_0x8651('0x12')]=function(_0x23fd58){var _0x5da4ab=this;return new Promise(function(_0x391235,_0x3160a4){return db['Sound'][_0x8651('0x13')]({'raw':_0x23fd58[_0x8651('0x14')]?_0x23fd58[_0x8651('0x14')][_0x8651('0x15')]===undefined?!![]:![]:!![],'where':_0x23fd58[_0x8651('0x14')]?_0x23fd58[_0x8651('0x14')]['where']||null:null,'attributes':_0x23fd58[_0x8651('0x14')]?_0x23fd58[_0x8651('0x14')][_0x8651('0x16')]||null:null,'include':_0x23fd58[_0x8651('0x14')]?_0x23fd58['options']['include']?_[_0x8651('0x17')](_0x23fd58['options'][_0x8651('0x18')],function(_0x4b217a){return{'model':db[_0x4b217a[_0x8651('0x19')]],'as':_0x4b217a['as'],'attributes':_0x4b217a[_0x8651('0x16')],'include':_0x4b217a[_0x8651('0x18')]?_[_0x8651('0x17')](_0x4b217a[_0x8651('0x18')],function(_0x126709){return{'model':db[_0x126709[_0x8651('0x19')]],'as':_0x126709['as'],'attributes':_0x126709[_0x8651('0x16')],'include':_0x126709[_0x8651('0x18')]?_[_0x8651('0x17')](_0x126709[_0x8651('0x18')],function(_0x58146d){return{'model':db[_0x58146d[_0x8651('0x19')]],'as':_0x58146d['as'],'attributes':_0x58146d[_0x8651('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a9845){logger[_0x8651('0xa')](_0x8651('0x12'),_0x23fd58);logger[_0x8651('0xd')](_0x8651('0x12'),_0x23fd58,JSON[_0x8651('0x1a')](_0x4a9845));_0x391235(_0x4a9845);})[_0x8651('0x1b')](function(_0x431dc6){logger[_0x8651('0x10')](_0x8651('0x12'),_0x431dc6[_0x8651('0xf')],_0x23fd58);_0x3160a4(_0x5da4ab[_0x8651('0x10')](0x1f4,_0x431dc6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7c87583..29e1b68 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x2437d1,_0x3cc15c){var _0x2133fd=function(_0x360849){while(--_0x360849){_0x2437d1['push'](_0x2437d1['shift']());}};_0x2133fd(++_0x3cc15c);}(_0x757a,0xde));var _0xa757=function(_0x2be80a,_0x48bcd5){_0x2be80a=_0x2be80a-0x0;var _0x598b18=_0x757a[_0x2be80a];return _0x598b18;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x4fa6d9,_0x4dd35d){var _0xd352a8=function(_0x57de7e){while(--_0x57de7e){_0x4fa6d9['push'](_0x4fa6d9['shift']());}};_0xd352a8(++_0x4dd35d);}(_0x757a,0xde));var _0xa757=function(_0x21437e,_0x2aba17){_0x21437e=_0x21437e-0x0;var _0x1ce77b=_0x757a[_0x21437e];return _0x1ce77b;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9ec0f40..0b8b40f 100644 --- a/server/api/squareMessage/squareMessage.attributes.js +++ b/server/api/squareMessage/squareMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5440=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x5440,0xe0));var _0x0544=function(_0xfe01e8,_0x1592d8){_0xfe01e8=_0xfe01e8-0x0;var _0x3b302d=_0x5440[_0xfe01e8];return _0x3b302d;};'use strict';var Sequelize=require(_0x0544('0x0'));module[_0x0544('0x1')]={'uniqueid':{'type':Sequelize[_0x0544('0x2')]},'body':{'type':Sequelize[_0x0544('0x3')](_0x0544('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x0544('0x5')]('in',_0x0544('0x6')),'defaultValue':_0x0544('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x0544('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1998=['out','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1998,0x1c2));var _0x8199=function(_0x17a9b5,_0x5bf022){_0x17a9b5=_0x17a9b5-0x0;var _0x5b575c=_0x1998[_0x17a9b5];return _0x5b575c;};'use strict';var Sequelize=require(_0x8199('0x0'));module[_0x8199('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x8199('0x2')](_0x8199('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x8199('0x4')]('in',_0x8199('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x8199('0x6')]},'providerResponse':{'type':Sequelize[_0x8199('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 3228e98..ac1d562 100644 --- a/server/api/squareMessage/squareMessage.controller.js +++ b/server/api/squareMessage/squareMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11e7=['bluebird','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','save','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','include','SquareMessage','findAll','rows','params','fields','includeAll','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x11e7,0x1d8));var _0x711e=function(_0x33d898,_0x42e297){_0x33d898=_0x33d898-0x0;var _0x4913cf=_0x11e7[_0x33d898];return _0x4913cf;};'use strict';var emlformat=require(_0x711e('0x0'));var rimraf=require(_0x711e('0x1'));var zipdir=require(_0x711e('0x2'));var jsonpatch=require(_0x711e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x711e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x711e('0x5'));var sox=require(_0x711e('0x6'));var csv=require('to-csv');var ejs=require(_0x711e('0x7'));var fs=require('fs');var fs_extra=require(_0x711e('0x8'));var _=require(_0x711e('0x9'));var squel=require(_0x711e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x711e('0xb'));var toCsv=require(_0x711e('0xc'));var querystring=require(_0x711e('0xd'));var Papa=require(_0x711e('0xe'));var Redis=require(_0x711e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x711e('0x10'));var as=require(_0x711e('0x11'));var hardwareService=require(_0x711e('0x12'));var logger=require(_0x711e('0x13'))(_0x711e('0x14'));var utils=require('../../config/utils');var config=require(_0x711e('0x15'));var licenseUtil=require(_0x711e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259f09,_0x559e54){_0x559e54=_0x559e54||0xcc;return function(_0x599bec){if(_0x599bec){return _0x259f09[_0x711e('0x17')](_0x559e54);}return _0x259f09['status'](_0x559e54)[_0x711e('0x18')]();};}function respondWithResult(_0x6841ed,_0x5b5b94){_0x5b5b94=_0x5b5b94||0xc8;return function(_0xe5257c){if(_0xe5257c){return _0x6841ed[_0x711e('0x19')](_0x5b5b94)[_0x711e('0x1a')](_0xe5257c);}};}function respondWithFilteredResult(_0x8505f2,_0x6dc60){return function(_0x3d29c3){if(_0x3d29c3){var _0x31c2d3=typeof _0x6dc60[_0x711e('0x1b')]==='undefined'&&typeof _0x6dc60[_0x711e('0x1c')]===_0x711e('0x1d');var _0x54d053=_0x3d29c3[_0x711e('0x1e')];var _0x9e3ae6=_0x31c2d3?0x0:_0x6dc60['offset'];var _0x16d493=_0x31c2d3?_0x3d29c3['count']:_0x6dc60[_0x711e('0x1b')]+_0x6dc60['limit'];var _0x5db4d4;if(_0x16d493>=_0x54d053){_0x16d493=_0x54d053;_0x5db4d4=0xc8;}else{_0x5db4d4=0xce;}_0x8505f2[_0x711e('0x19')](_0x5db4d4);return _0x8505f2['set']('Content-Range',_0x9e3ae6+'-'+_0x16d493+'/'+_0x54d053)[_0x711e('0x1a')](_0x3d29c3);}return null;};}function patchUpdates(_0x343c0e){return function(_0x32f5c8){try{jsonpatch['apply'](_0x32f5c8,_0x343c0e,!![]);}catch(_0x176f0b){return BPromise['reject'](_0x176f0b);}return _0x32f5c8[_0x711e('0x1f')]();};}function saveUpdates(_0x37ab45,_0x53e820){return function(_0xd5ad20){if(_0xd5ad20){return _0xd5ad20['update'](_0x37ab45)[_0x711e('0x20')](function(_0x13e91d){return _0x13e91d;});}return null;};}function removeEntity(_0x2b22a2,_0x4f7e62){return function(_0xdc39a8){if(_0xdc39a8){return _0xdc39a8[_0x711e('0x21')]()['then'](function(){_0x2b22a2[_0x711e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41bd9f,_0x3e2133){return function(_0x22dd27){if(!_0x22dd27){_0x41bd9f['sendStatus'](0x194);}return _0x22dd27;};}function handleError(_0x45a3a3,_0x46cfbe){_0x46cfbe=_0x46cfbe||0x1f4;return function(_0x108a98){logger[_0x711e('0x22')](_0x108a98['stack']);if(_0x108a98['name']){delete _0x108a98[_0x711e('0x23')];}_0x45a3a3[_0x711e('0x19')](_0x46cfbe)['send'](_0x108a98);};}exports[_0x711e('0x24')]=function(_0xfe12d1,_0x116e6e){var _0x8a2bea={},_0x500993={},_0x3baeb6={'count':0x0,'rows':[]};var _0x3808aa=_[_0x711e('0x25')](db['SquareMessage'][_0x711e('0x26')],function(_0x43ea51){return{'name':_0x43ea51[_0x711e('0x27')],'type':_0x43ea51[_0x711e('0x28')][_0x711e('0x29')]};});_0x500993[_0x711e('0x2a')]=_['map'](_0x3808aa,_0x711e('0x23'));_0x500993[_0x711e('0x2b')]=_[_0x711e('0x2c')](_0xfe12d1['query']);_0x500993[_0x711e('0x2d')]=_['intersection'](_0x500993['model'],_0x500993[_0x711e('0x2b')]);_0x8a2bea[_0x711e('0x2e')]=_[_0x711e('0x2f')](_0x500993['model'],qs['fields'](_0xfe12d1['query']['fields']));_0x8a2bea[_0x711e('0x2e')]=_0x8a2bea[_0x711e('0x2e')][_0x711e('0x30')]?_0x8a2bea['attributes']:_0x500993[_0x711e('0x2a')];if(!_0xfe12d1['query'][_0x711e('0x31')]('nolimit')){_0x8a2bea[_0x711e('0x1c')]=qs[_0x711e('0x1c')](_0xfe12d1[_0x711e('0x2b')]['limit']);_0x8a2bea[_0x711e('0x1b')]=qs['offset'](_0xfe12d1[_0x711e('0x2b')][_0x711e('0x1b')]);}_0x8a2bea['order']=qs[_0x711e('0x32')](_0xfe12d1['query']['sort']);_0x8a2bea[_0x711e('0x33')]=qs['filters'](_['pick'](_0xfe12d1['query'],_0x500993[_0x711e('0x2d')]),_0x3808aa);if(_0xfe12d1[_0x711e('0x2b')][_0x711e('0x34')]){_0x8a2bea[_0x711e('0x33')]=_[_0x711e('0x35')](_0x8a2bea['where'],{'$or':_[_0x711e('0x25')](_0x3808aa,function(_0x17bf6d){if(_0x17bf6d[_0x711e('0x28')]!==_0x711e('0x36')){var _0xcdd1eb={};_0xcdd1eb[_0x17bf6d['name']]={'$like':'%'+_0xfe12d1[_0x711e('0x2b')][_0x711e('0x34')]+'%'};return _0xcdd1eb;}})});}_0x8a2bea=_[_0x711e('0x35')]({},_0x8a2bea,_0xfe12d1['options']);var _0x3a167d={'where':_0x8a2bea['where']};return db['SquareMessage']['count'](_0x3a167d)[_0x711e('0x20')](function(_0x5705d6){_0x3baeb6[_0x711e('0x1e')]=_0x5705d6;if(_0xfe12d1[_0x711e('0x2b')]['includeAll']){_0x8a2bea[_0x711e('0x37')]=[{'all':!![]}];}return db[_0x711e('0x38')][_0x711e('0x39')](_0x8a2bea);})[_0x711e('0x20')](function(_0x1ad7e5){_0x3baeb6[_0x711e('0x3a')]=_0x1ad7e5;return _0x3baeb6;})['then'](respondWithFilteredResult(_0x116e6e,_0x8a2bea))['catch'](handleError(_0x116e6e,null));};exports['show']=function(_0x5c9bfe,_0x22dcda){var _0x12496e={'raw':!![],'where':{'id':_0x5c9bfe[_0x711e('0x3b')]['id']}},_0x16f936={};_0x16f936[_0x711e('0x2a')]=_[_0x711e('0x2c')](db[_0x711e('0x38')][_0x711e('0x26')]);_0x16f936[_0x711e('0x2b')]=_['keys'](_0x5c9bfe['query']);_0x16f936[_0x711e('0x2d')]=_['intersection'](_0x16f936['model'],_0x16f936[_0x711e('0x2b')]);_0x12496e[_0x711e('0x2e')]=_[_0x711e('0x2f')](_0x16f936[_0x711e('0x2a')],qs[_0x711e('0x3c')](_0x5c9bfe[_0x711e('0x2b')][_0x711e('0x3c')]));_0x12496e[_0x711e('0x2e')]=_0x12496e[_0x711e('0x2e')][_0x711e('0x30')]?_0x12496e[_0x711e('0x2e')]:_0x16f936[_0x711e('0x2a')];if(_0x5c9bfe[_0x711e('0x2b')][_0x711e('0x3d')]){_0x12496e['include']=[{'all':!![]}];}_0x12496e=_[_0x711e('0x35')]({},_0x12496e,_0x5c9bfe[_0x711e('0x3e')]);return db[_0x711e('0x38')][_0x711e('0x3f')](_0x12496e)[_0x711e('0x20')](handleEntityNotFound(_0x22dcda,null))['then'](respondWithResult(_0x22dcda,null))[_0x711e('0x40')](handleError(_0x22dcda,null));};exports[_0x711e('0x41')]=function(_0x4bf1d2,_0xdaa91){return db[_0x711e('0x38')][_0x711e('0x41')](_0x4bf1d2[_0x711e('0x42')],{})['then'](respondWithResult(_0xdaa91,0xc9))['catch'](handleError(_0xdaa91,null));};exports[_0x711e('0x43')]=function(_0x3cf3e5,_0x561925){if(_0x3cf3e5[_0x711e('0x42')]['id']){delete _0x3cf3e5[_0x711e('0x42')]['id'];}return db[_0x711e('0x38')][_0x711e('0x3f')]({'where':{'id':_0x3cf3e5[_0x711e('0x3b')]['id']}})['then'](handleEntityNotFound(_0x561925,null))[_0x711e('0x20')](saveUpdates(_0x3cf3e5[_0x711e('0x42')],null))[_0x711e('0x20')](respondWithResult(_0x561925,null))['catch'](handleError(_0x561925,null));};exports['destroy']=function(_0xac7905,_0x4e9d90){return db['SquareMessage'][_0x711e('0x3f')]({'where':{'id':_0xac7905[_0x711e('0x3b')]['id']}})[_0x711e('0x20')](handleEntityNotFound(_0x4e9d90,null))[_0x711e('0x20')](removeEntity(_0x4e9d90,null))[_0x711e('0x40')](handleError(_0x4e9d90,null));}; \ No newline at end of file +var _0x5454=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','rows','catch','create','body','find','params','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x5454,0x15b));var _0x4545=function(_0x4e497f,_0x2c65d4){_0x4e497f=_0x4e497f-0x0;var _0xa69189=_0x5454[_0x4e497f];return _0xa69189;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4545('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4545('0x1'));var util=require(_0x4545('0x2'));var path=require(_0x4545('0x3'));var sox=require(_0x4545('0x4'));var csv=require('to-csv');var ejs=require(_0x4545('0x5'));var fs=require('fs');var fs_extra=require(_0x4545('0x6'));var _=require(_0x4545('0x7'));var squel=require(_0x4545('0x8'));var crypto=require(_0x4545('0x9'));var jsforce=require(_0x4545('0xa'));var deskjs=require(_0x4545('0xb'));var toCsv=require(_0x4545('0xc'));var querystring=require(_0x4545('0xd'));var Papa=require(_0x4545('0xe'));var Redis=require(_0x4545('0xf'));var authService=require(_0x4545('0x10'));var qs=require(_0x4545('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4545('0x12'));var logger=require(_0x4545('0x13'))(_0x4545('0x14'));var utils=require(_0x4545('0x15'));var config=require(_0x4545('0x16'));var licenseUtil=require(_0x4545('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3844a3,_0x20a4d8){_0x20a4d8=_0x20a4d8||0xcc;return function(_0x353e42){if(_0x353e42){return _0x3844a3[_0x4545('0x18')](_0x20a4d8);}return _0x3844a3[_0x4545('0x19')](_0x20a4d8)[_0x4545('0x1a')]();};}function respondWithResult(_0x3e7088,_0x347072){_0x347072=_0x347072||0xc8;return function(_0x36bb8e){if(_0x36bb8e){return _0x3e7088[_0x4545('0x19')](_0x347072)[_0x4545('0x1b')](_0x36bb8e);}};}function respondWithFilteredResult(_0x4b5700,_0xb10472){return function(_0x3577f5){if(_0x3577f5){var _0x2416b0=typeof _0xb10472[_0x4545('0x1c')]==='undefined'&&typeof _0xb10472['limit']===_0x4545('0x1d');var _0x29effa=_0x3577f5[_0x4545('0x1e')];var _0x2e13e0=_0x2416b0?0x0:_0xb10472[_0x4545('0x1c')];var _0x33393b=_0x2416b0?_0x3577f5[_0x4545('0x1e')]:_0xb10472[_0x4545('0x1c')]+_0xb10472['limit'];var _0x52a21c;if(_0x33393b>=_0x29effa){_0x33393b=_0x29effa;_0x52a21c=0xc8;}else{_0x52a21c=0xce;}_0x4b5700[_0x4545('0x19')](_0x52a21c);return _0x4b5700['set'](_0x4545('0x1f'),_0x2e13e0+'-'+_0x33393b+'/'+_0x29effa)[_0x4545('0x1b')](_0x3577f5);}return null;};}function patchUpdates(_0x67e408){return function(_0x6b3bc){try{jsonpatch[_0x4545('0x20')](_0x6b3bc,_0x67e408,!![]);}catch(_0x2a39cf){return BPromise[_0x4545('0x21')](_0x2a39cf);}return _0x6b3bc[_0x4545('0x22')]();};}function saveUpdates(_0x550dfb,_0x580b57){return function(_0x431b5d){if(_0x431b5d){return _0x431b5d['update'](_0x550dfb)[_0x4545('0x23')](function(_0x4f8a76){return _0x4f8a76;});}return null;};}function removeEntity(_0x293c18,_0x4c47c0){return function(_0x519489){if(_0x519489){return _0x519489[_0x4545('0x24')]()[_0x4545('0x23')](function(){_0x293c18[_0x4545('0x19')](0xcc)[_0x4545('0x1a')]();});}};}function handleEntityNotFound(_0x344633,_0x39eaa1){return function(_0x43033c){if(!_0x43033c){_0x344633[_0x4545('0x18')](0x194);}return _0x43033c;};}function handleError(_0xac3456,_0x2a6842){_0x2a6842=_0x2a6842||0x1f4;return function(_0x3e5807){logger[_0x4545('0x25')](_0x3e5807[_0x4545('0x26')]);if(_0x3e5807[_0x4545('0x27')]){delete _0x3e5807[_0x4545('0x27')];}_0xac3456[_0x4545('0x19')](_0x2a6842)['send'](_0x3e5807);};}exports[_0x4545('0x28')]=function(_0x2c256b,_0x853476){var _0x394a8e={},_0xb9c5ee={},_0x531250={'count':0x0,'rows':[]};var _0x157fe5=_[_0x4545('0x29')](db[_0x4545('0x2a')][_0x4545('0x2b')],function(_0x1da2a9){return{'name':_0x1da2a9[_0x4545('0x2c')],'type':_0x1da2a9['type'][_0x4545('0x2d')]};});_0xb9c5ee[_0x4545('0x2e')]=_[_0x4545('0x29')](_0x157fe5,_0x4545('0x27'));_0xb9c5ee[_0x4545('0x2f')]=_[_0x4545('0x30')](_0x2c256b[_0x4545('0x2f')]);_0xb9c5ee[_0x4545('0x31')]=_[_0x4545('0x32')](_0xb9c5ee[_0x4545('0x2e')],_0xb9c5ee[_0x4545('0x2f')]);_0x394a8e['attributes']=_[_0x4545('0x32')](_0xb9c5ee['model'],qs[_0x4545('0x33')](_0x2c256b[_0x4545('0x2f')]['fields']));_0x394a8e[_0x4545('0x34')]=_0x394a8e[_0x4545('0x34')][_0x4545('0x35')]?_0x394a8e[_0x4545('0x34')]:_0xb9c5ee[_0x4545('0x2e')];if(!_0x2c256b[_0x4545('0x2f')][_0x4545('0x36')]('nolimit')){_0x394a8e[_0x4545('0x37')]=qs[_0x4545('0x37')](_0x2c256b[_0x4545('0x2f')][_0x4545('0x37')]);_0x394a8e[_0x4545('0x1c')]=qs[_0x4545('0x1c')](_0x2c256b['query'][_0x4545('0x1c')]);}_0x394a8e[_0x4545('0x38')]=qs[_0x4545('0x39')](_0x2c256b[_0x4545('0x2f')][_0x4545('0x39')]);_0x394a8e[_0x4545('0x3a')]=qs[_0x4545('0x31')](_[_0x4545('0x3b')](_0x2c256b[_0x4545('0x2f')],_0xb9c5ee['filters']),_0x157fe5);if(_0x2c256b['query']['filter']){_0x394a8e[_0x4545('0x3a')]=_['merge'](_0x394a8e[_0x4545('0x3a')],{'$or':_[_0x4545('0x29')](_0x157fe5,function(_0x1d19f6){if(_0x1d19f6[_0x4545('0x3c')]!=='VIRTUAL'){var _0x5e54b7={};_0x5e54b7[_0x1d19f6[_0x4545('0x27')]]={'$like':'%'+_0x2c256b['query'][_0x4545('0x3d')]+'%'};return _0x5e54b7;}})});}_0x394a8e=_[_0x4545('0x3e')]({},_0x394a8e,_0x2c256b[_0x4545('0x3f')]);var _0x211092={'where':_0x394a8e[_0x4545('0x3a')]};return db['SquareMessage']['count'](_0x211092)[_0x4545('0x23')](function(_0x43c4ce){_0x531250[_0x4545('0x1e')]=_0x43c4ce;if(_0x2c256b['query'][_0x4545('0x40')]){_0x394a8e[_0x4545('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0x4545('0x42')](_0x394a8e);})['then'](function(_0x239246){_0x531250[_0x4545('0x43')]=_0x239246;return _0x531250;})[_0x4545('0x23')](respondWithFilteredResult(_0x853476,_0x394a8e))[_0x4545('0x44')](handleError(_0x853476,null));};exports['show']=function(_0x1ca5d3,_0x632ec1){var _0x3d308e={'raw':!![],'where':{'id':_0x1ca5d3['params']['id']}},_0x299869={};_0x299869['model']=_[_0x4545('0x30')](db['SquareMessage'][_0x4545('0x2b')]);_0x299869[_0x4545('0x2f')]=_[_0x4545('0x30')](_0x1ca5d3[_0x4545('0x2f')]);_0x299869[_0x4545('0x31')]=_[_0x4545('0x32')](_0x299869[_0x4545('0x2e')],_0x299869[_0x4545('0x2f')]);_0x3d308e['attributes']=_[_0x4545('0x32')](_0x299869[_0x4545('0x2e')],qs[_0x4545('0x33')](_0x1ca5d3['query'][_0x4545('0x33')]));_0x3d308e[_0x4545('0x34')]=_0x3d308e[_0x4545('0x34')][_0x4545('0x35')]?_0x3d308e[_0x4545('0x34')]:_0x299869[_0x4545('0x2e')];if(_0x1ca5d3[_0x4545('0x2f')][_0x4545('0x40')]){_0x3d308e['include']=[{'all':!![]}];}_0x3d308e=_[_0x4545('0x3e')]({},_0x3d308e,_0x1ca5d3['options']);return db[_0x4545('0x2a')]['find'](_0x3d308e)[_0x4545('0x23')](handleEntityNotFound(_0x632ec1,null))[_0x4545('0x23')](respondWithResult(_0x632ec1,null))[_0x4545('0x44')](handleError(_0x632ec1,null));};exports['create']=function(_0x20f054,_0x2ece03){return db[_0x4545('0x2a')][_0x4545('0x45')](_0x20f054[_0x4545('0x46')],{})[_0x4545('0x23')](respondWithResult(_0x2ece03,0xc9))['catch'](handleError(_0x2ece03,null));};exports['update']=function(_0x499246,_0x563835){if(_0x499246[_0x4545('0x46')]['id']){delete _0x499246[_0x4545('0x46')]['id'];}return db[_0x4545('0x2a')][_0x4545('0x47')]({'where':{'id':_0x499246[_0x4545('0x48')]['id']}})[_0x4545('0x23')](handleEntityNotFound(_0x563835,null))[_0x4545('0x23')](saveUpdates(_0x499246['body'],null))['then'](respondWithResult(_0x563835,null))[_0x4545('0x44')](handleError(_0x563835,null));};exports[_0x4545('0x24')]=function(_0x33a6d2,_0x2946b5){return db[_0x4545('0x2a')][_0x4545('0x47')]({'where':{'id':_0x33a6d2['params']['id']}})[_0x4545('0x23')](handleEntityNotFound(_0x2946b5,null))[_0x4545('0x23')](removeEntity(_0x2946b5,null))['catch'](handleError(_0x2946b5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 7170f39..a736312 100644 --- a/server/api/squareMessage/squareMessage.model.js +++ b/server/api/squareMessage/squareMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98d9=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','SquareMessage','square_messages','lodash'];(function(_0x7efb7,_0x5ee7c1){var _0x5a7999=function(_0x50f90a){while(--_0x50f90a){_0x7efb7['push'](_0x7efb7['shift']());}};_0x5a7999(++_0x5ee7c1);}(_0x98d9,0x12b));var _0x998d=function(_0x1fcaca,_0x23288d){_0x1fcaca=_0x1fcaca-0x0;var _0x17d29c=_0x98d9[_0x1fcaca];return _0x17d29c;};'use strict';var _=require(_0x998d('0x0'));var util=require(_0x998d('0x1'));var logger=require(_0x998d('0x2'))(_0x998d('0x3'));var moment=require(_0x998d('0x4'));var BPromise=require(_0x998d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x998d('0x6'));var rimraf=require(_0x998d('0x7'));var config=require(_0x998d('0x8'));var attributes=require(_0x998d('0x9'));module['exports']=function(_0x302edc,_0x1fa331){return _0x302edc['define'](_0x998d('0xa'),attributes,{'tableName':_0x998d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d1b=['SquareMessage','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./squareMessage.attributes','exports'];(function(_0x2da8d3,_0x3c8942){var _0x1cd226=function(_0x14a545){while(--_0x14a545){_0x2da8d3['push'](_0x2da8d3['shift']());}};_0x1cd226(++_0x3c8942);}(_0x0d1b,0x1cd));var _0xb0d1=function(_0x5c331f,_0xb99c06){_0x5c331f=_0x5c331f-0x0;var _0x3d50c6=_0x0d1b[_0x5c331f];return _0x3d50c6;};'use strict';var _=require(_0xb0d1('0x0'));var util=require(_0xb0d1('0x1'));var logger=require(_0xb0d1('0x2'))(_0xb0d1('0x3'));var moment=require(_0xb0d1('0x4'));var BPromise=require('bluebird');var rp=require(_0xb0d1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0d1('0x6'));var config=require('../../config/environment');var attributes=require(_0xb0d1('0x7'));module[_0xb0d1('0x8')]=function(_0x259ef0,_0x59eedd){return _0x259ef0['define'](_0xb0d1('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index c8c683d..1aaa640 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3029=['SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5b870a,_0x5cd285){var _0x37ebf1=function(_0x76b2c4){while(--_0x76b2c4){_0x5b870a['push'](_0x5b870a['shift']());}};_0x37ebf1(++_0x5cd285);}(_0x3029,0x1e0));var _0x9302=function(_0x4ed37d,_0x1a84c9){_0x4ed37d=_0x4ed37d-0x0;var _0x4fb2c5=_0x3029[_0x4ed37d];return _0x4fb2c5;};'use strict';var _=require(_0x9302('0x0'));var util=require(_0x9302('0x1'));var moment=require('moment');var BPromise=require(_0x9302('0x2'));var rs=require(_0x9302('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9302('0x4'));var logger=require(_0x9302('0x5'))(_0x9302('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9302('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e2588,_0x26a96b,_0x80cf90){return new BPromise(function(_0x3e50b2,_0x39e29c){return client[_0x9302('0x8')](_0x2e2588,_0x80cf90)[_0x9302('0x9')](function(_0x3348fe){logger[_0x9302('0xa')](_0x9302('0xb'),_0x26a96b,_0x9302('0xc'));logger[_0x9302('0xd')](_0x9302('0xe'),_0x26a96b,'request\x20sent',JSON[_0x9302('0xf')](_0x3348fe));if(_0x3348fe[_0x9302('0x10')]){if(_0x3348fe[_0x9302('0x10')][_0x9302('0x11')]===0x1f4){logger['error'](_0x9302('0xb'),_0x26a96b,_0x3348fe['error'][_0x9302('0x12')]);return _0x39e29c(_0x3348fe[_0x9302('0x10')][_0x9302('0x12')]);}logger[_0x9302('0x10')](_0x9302('0xb'),_0x26a96b,_0x3348fe['error'][_0x9302('0x12')]);return _0x3e50b2(_0x3348fe['error']['message']);}else{logger[_0x9302('0xa')]('SquareMessage,\x20%s,\x20%s',_0x26a96b,_0x9302('0xc'));_0x3e50b2(_0x3348fe['result'][_0x9302('0x12')]);}})[_0x9302('0x13')](function(_0x5a65ca){logger['error'](_0x9302('0xb'),_0x26a96b,_0x5a65ca);_0x39e29c(_0x5a65ca);});});}exports[_0x9302('0x14')]=function(_0x1b5744){var _0x357802=this;return new Promise(function(_0x584357,_0x31e617){return db[_0x9302('0x15')][_0x9302('0x16')](_0x1b5744[_0x9302('0x17')],{'raw':_0x1b5744[_0x9302('0x18')]?_0x1b5744[_0x9302('0x18')][_0x9302('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4de7){logger[_0x9302('0xa')]('CreateSquareMessage',_0x1b5744);logger['debug'](_0x9302('0x14'),_0x1b5744,JSON[_0x9302('0xf')](_0x2d4de7));_0x584357(_0x2d4de7);})['catch'](function(_0x46f0f8){logger[_0x9302('0x10')](_0x9302('0x14'),_0x46f0f8['message'],_0x1b5744);_0x31e617(_0x357802[_0x9302('0x10')](0x1f4,_0x46f0f8[_0x9302('0x12')]));});});}; \ No newline at end of file +var _0x6774=['stringify','error','SquareMessage,\x20%s,\x20%s','message','result','CreateSquareMessage','create','body','options','raw','then','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x6774,0xa2));var _0x4677=function(_0x38c37d,_0x1184ce){_0x38c37d=_0x38c37d-0x0;var _0x2780ed=_0x6774[_0x38c37d];return _0x2780ed;};'use strict';var _=require(_0x4677('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4677('0x1'));var rs=require(_0x4677('0x2'));var fs=require('fs');var Redis=require(_0x4677('0x3'));var db=require(_0x4677('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4677('0x5'))('rpc');var config=require(_0x4677('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4677('0x7')][_0x4677('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdd64ba,_0x51c1aa,_0x4f1bc8){return new BPromise(function(_0x4ab789,_0x41937c){return client['request'](_0xdd64ba,_0x4f1bc8)['then'](function(_0xb2413f){logger[_0x4677('0x9')]('SquareMessage,\x20%s,\x20%s',_0x51c1aa,_0x4677('0xa'));logger[_0x4677('0xb')](_0x4677('0xc'),_0x51c1aa,_0x4677('0xa'),JSON[_0x4677('0xd')](_0xb2413f));if(_0xb2413f[_0x4677('0xe')]){if(_0xb2413f['error']['code']===0x1f4){logger[_0x4677('0xe')](_0x4677('0xf'),_0x51c1aa,_0xb2413f['error'][_0x4677('0x10')]);return _0x41937c(_0xb2413f['error'][_0x4677('0x10')]);}logger[_0x4677('0xe')](_0x4677('0xf'),_0x51c1aa,_0xb2413f['error'][_0x4677('0x10')]);return _0x4ab789(_0xb2413f[_0x4677('0xe')][_0x4677('0x10')]);}else{logger[_0x4677('0x9')]('SquareMessage,\x20%s,\x20%s',_0x51c1aa,_0x4677('0xa'));_0x4ab789(_0xb2413f[_0x4677('0x11')][_0x4677('0x10')]);}})['catch'](function(_0x2f933b){logger[_0x4677('0xe')](_0x4677('0xf'),_0x51c1aa,_0x2f933b);_0x41937c(_0x2f933b);});});}exports[_0x4677('0x12')]=function(_0x10ff5d){var _0x12daca=this;return new Promise(function(_0x4615ae,_0x17ff3f){return db['SquareMessage'][_0x4677('0x13')](_0x10ff5d[_0x4677('0x14')],{'raw':_0x10ff5d[_0x4677('0x15')]?_0x10ff5d[_0x4677('0x15')][_0x4677('0x16')]===undefined?!![]:![]:!![]})[_0x4677('0x17')](function(_0x36b7e1){logger[_0x4677('0x9')](_0x4677('0x12'),_0x10ff5d);logger[_0x4677('0xb')](_0x4677('0x12'),_0x10ff5d,JSON[_0x4677('0xd')](_0x36b7e1));_0x4615ae(_0x36b7e1);})[_0x4677('0x18')](function(_0x5e9191){logger[_0x4677('0xe')]('CreateSquareMessage',_0x5e9191[_0x4677('0x10')],_0x10ff5d);_0x17ff3f(_0x12daca[_0x4677('0xe')](0x1f4,_0x5e9191[_0x4677('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 04db606..3f57203 100644 --- a/server/api/squareOdbc/index.js +++ b/server/api/squareOdbc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8c9=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/test','test','post','create','put','update','destroy'];(function(_0x397ee7,_0x586e59){var _0x41f6d0=function(_0x561945){while(--_0x561945){_0x397ee7['push'](_0x397ee7['shift']());}};_0x41f6d0(++_0x586e59);}(_0xd8c9,0x119));var _0x9d8c=function(_0x1d7be2,_0x377136){_0x1d7be2=_0x1d7be2-0x0;var _0xba17ee=_0xd8c9[_0x1d7be2];return _0xba17ee;};'use strict';var multer=require(_0x9d8c('0x0'));var util=require(_0x9d8c('0x1'));var path=require(_0x9d8c('0x2'));var timeout=require(_0x9d8c('0x3'));var express=require(_0x9d8c('0x4'));var router=express[_0x9d8c('0x5')]();var fs_extra=require(_0x9d8c('0x6'));var auth=require(_0x9d8c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x9d8c('0x8')]('/',auth[_0x9d8c('0x9')](),controller[_0x9d8c('0xa')]);router[_0x9d8c('0x8')](_0x9d8c('0xb'),auth[_0x9d8c('0x9')](),controller['show']);router[_0x9d8c('0x8')](_0x9d8c('0xc'),auth[_0x9d8c('0x9')](),timeout('15s'),controller[_0x9d8c('0xd')]);router[_0x9d8c('0xe')]('/',auth[_0x9d8c('0x9')](),controller[_0x9d8c('0xf')]);router[_0x9d8c('0x10')](_0x9d8c('0xb'),auth[_0x9d8c('0x9')](),controller[_0x9d8c('0x11')]);router['delete'](_0x9d8c('0xb'),auth[_0x9d8c('0x9')](),controller[_0x9d8c('0x12')]);module[_0x9d8c('0x13')]=router; \ No newline at end of file +var _0xe593=['destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','/:id/test','15s','test','post','create','put','update'];(function(_0x2f82ec,_0x1d1c3b){var _0x2733bf=function(_0x3f36eb){while(--_0x3f36eb){_0x2f82ec['push'](_0x2f82ec['shift']());}};_0x2733bf(++_0x1d1c3b);}(_0xe593,0x9a));var _0x3e59=function(_0x3a8474,_0x11b3e2){_0x3a8474=_0x3a8474-0x0;var _0x5a6501=_0xe593[_0x3a8474];return _0x5a6501;};'use strict';var multer=require('multer');var util=require(_0x3e59('0x0'));var path=require(_0x3e59('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3e59('0x2')]();var fs_extra=require(_0x3e59('0x3'));var auth=require(_0x3e59('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3e59('0x5'));var controller=require(_0x3e59('0x6'));router[_0x3e59('0x7')]('/',auth[_0x3e59('0x8')](),controller['index']);router[_0x3e59('0x7')](_0x3e59('0x9'),auth[_0x3e59('0x8')](),controller['show']);router[_0x3e59('0x7')](_0x3e59('0xa'),auth[_0x3e59('0x8')](),timeout(_0x3e59('0xb')),controller[_0x3e59('0xc')]);router[_0x3e59('0xd')]('/',auth[_0x3e59('0x8')](),controller[_0x3e59('0xe')]);router[_0x3e59('0xf')](_0x3e59('0x9'),auth[_0x3e59('0x8')](),controller[_0x3e59('0x10')]);router['delete'](_0x3e59('0x9'),auth['isAuthenticated'](),controller[_0x3e59('0x11')]);module[_0x3e59('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 041db41..437b69a 100644 --- a/server/api/squareOdbc/squareOdbc.attributes.js +++ b/server/api/squareOdbc/squareOdbc.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3f9=['name','sequelize','STRING'];(function(_0x21653f,_0x41dcba){var _0xbddc35=function(_0x4fa458){while(--_0x4fa458){_0x21653f['push'](_0x21653f['shift']());}};_0xbddc35(++_0x41dcba);}(_0xf3f9,0xb5));var _0x9f3f=function(_0x11a572,_0x38670d){_0x11a572=_0x11a572-0x0;var _0x289db4=_0xf3f9[_0x11a572];return _0x289db4;};'use strict';var Sequelize=require(_0x9f3f('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f3f('0x1')],'unique':_0x9f3f('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x9f3f('0x1')]},'description':{'type':Sequelize[_0x9f3f('0x1')]}}; \ No newline at end of file +var _0x8500=['exports','STRING','name','sequelize'];(function(_0x154608,_0x2568f7){var _0x114683=function(_0x599dd){while(--_0x599dd){_0x154608['push'](_0x154608['shift']());}};_0x114683(++_0x2568f7);}(_0x8500,0x13f));var _0x0850=function(_0xc3bee3,_0x3ca68f){_0xc3bee3=_0xc3bee3-0x0;var _0x47cb50=_0x8500[_0xc3bee3];return _0x47cb50;};'use strict';var Sequelize=require(_0x0850('0x0'));module[_0x0850('0x1')]={'name':{'type':Sequelize[_0x0850('0x2')],'unique':_0x0850('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0850('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 33596d4..fab233d 100644 --- a/server/api/squareOdbc/squareOdbc.controller.js +++ b/server/api/squareOdbc/squareOdbc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11de=['UserProfileResource','end','error','stack','name','send','index','map','SquareOdbc','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','save','update','then','destroy','get','ODBC'];(function(_0x206f81,_0x162277){var _0x2cf08f=function(_0x131532){while(--_0x131532){_0x206f81['push'](_0x206f81['shift']());}};_0x2cf08f(++_0x162277);}(_0x11de,0x184));var _0xe11d=function(_0x33944c,_0x2fd7f3){_0x33944c=_0x33944c-0x0;var _0x3a8a1e=_0x11de[_0x33944c];return _0x3a8a1e;};'use strict';var emlformat=require(_0xe11d('0x0'));var rimraf=require(_0xe11d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe11d('0x2'));var BPromise=require(_0xe11d('0x3'));var Mustache=require(_0xe11d('0x4'));var util=require(_0xe11d('0x5'));var path=require(_0xe11d('0x6'));var sox=require(_0xe11d('0x7'));var csv=require(_0xe11d('0x8'));var ejs=require(_0xe11d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe11d('0xa'));var jsforce=require(_0xe11d('0xb'));var deskjs=require(_0xe11d('0xc'));var toCsv=require(_0xe11d('0x8'));var querystring=require(_0xe11d('0xd'));var Papa=require('papaparse');var Redis=require(_0xe11d('0xe'));var authService=require(_0xe11d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe11d('0x10'));var hardwareService=require(_0xe11d('0x11'));var logger=require(_0xe11d('0x12'))(_0xe11d('0x13'));var utils=require(_0xe11d('0x14'));var config=require(_0xe11d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe11d('0x16'))['db'];function respondWithStatusCode(_0x443043,_0x5e7bab){_0x5e7bab=_0x5e7bab||0xcc;return function(_0x1a1096){if(_0x1a1096){return _0x443043[_0xe11d('0x17')](_0x5e7bab);}return _0x443043[_0xe11d('0x18')](_0x5e7bab)['end']();};}function respondWithResult(_0x5b162d,_0xcaa7ee){_0xcaa7ee=_0xcaa7ee||0xc8;return function(_0x768319){if(_0x768319){return _0x5b162d['status'](_0xcaa7ee)[_0xe11d('0x19')](_0x768319);}};}function respondWithFilteredResult(_0x5bb337,_0x268d87){return function(_0x5f1912){if(_0x5f1912){var _0x421402=typeof _0x268d87[_0xe11d('0x1a')]==='undefined'&&typeof _0x268d87[_0xe11d('0x1b')]==='undefined';var _0x57ebcd=_0x5f1912[_0xe11d('0x1c')];var _0x9b7b9b=_0x421402?0x0:_0x268d87[_0xe11d('0x1a')];var _0x4129ae=_0x421402?_0x5f1912[_0xe11d('0x1c')]:_0x268d87['offset']+_0x268d87[_0xe11d('0x1b')];var _0x14aa7c;if(_0x4129ae>=_0x57ebcd){_0x4129ae=_0x57ebcd;_0x14aa7c=0xc8;}else{_0x14aa7c=0xce;}_0x5bb337[_0xe11d('0x18')](_0x14aa7c);return _0x5bb337[_0xe11d('0x1d')](_0xe11d('0x1e'),_0x9b7b9b+'-'+_0x4129ae+'/'+_0x57ebcd)[_0xe11d('0x19')](_0x5f1912);}return null;};}function patchUpdates(_0xa690b2){return function(_0x127b40){try{jsonpatch['apply'](_0x127b40,_0xa690b2,!![]);}catch(_0x50ef55){return BPromise['reject'](_0x50ef55);}return _0x127b40[_0xe11d('0x1f')]();};}function saveUpdates(_0x284b95,_0x236ce8){return function(_0xadee7a){if(_0xadee7a){return _0xadee7a[_0xe11d('0x20')](_0x284b95)[_0xe11d('0x21')](function(_0x329dd7){return _0x329dd7;});}return null;};}function removeEntity(_0x4c66f8,_0x3e05f7){return function(_0x15f85f){if(_0x15f85f){return _0x15f85f[_0xe11d('0x22')]()[_0xe11d('0x21')](function(){var _0x37767b=_0x15f85f[_0xe11d('0x23')]({'plain':!![]});var _0x216786=_0xe11d('0x24');return db[_0xe11d('0x25')][_0xe11d('0x22')]({'where':{'type':_0x216786,'resourceId':_0x37767b['id']}})[_0xe11d('0x21')](function(){return _0x15f85f;});})[_0xe11d('0x21')](function(){_0x4c66f8[_0xe11d('0x18')](0xcc)[_0xe11d('0x26')]();});}};}function handleEntityNotFound(_0x186df2,_0x5eed39){return function(_0x2b9a65){if(!_0x2b9a65){_0x186df2['sendStatus'](0x194);}return _0x2b9a65;};}function handleError(_0x1f4512,_0x3b8b35){_0x3b8b35=_0x3b8b35||0x1f4;return function(_0x56fa50){logger[_0xe11d('0x27')](_0x56fa50[_0xe11d('0x28')]);if(_0x56fa50[_0xe11d('0x29')]){delete _0x56fa50['name'];}_0x1f4512[_0xe11d('0x18')](_0x3b8b35)[_0xe11d('0x2a')](_0x56fa50);};}exports[_0xe11d('0x2b')]=function(_0x20274e,_0x7f2f34){var _0x4074f0={},_0x3d8c68={},_0x34068b={'count':0x0,'rows':[]};var _0x3a5594=_[_0xe11d('0x2c')](db[_0xe11d('0x2d')][_0xe11d('0x2e')],function(_0x4e4204){return{'name':_0x4e4204['fieldName'],'type':_0x4e4204['type'][_0xe11d('0x2f')]};});_0x3d8c68[_0xe11d('0x30')]=_[_0xe11d('0x2c')](_0x3a5594,_0xe11d('0x29'));_0x3d8c68[_0xe11d('0x31')]=_['keys'](_0x20274e[_0xe11d('0x31')]);_0x3d8c68['filters']=_[_0xe11d('0x32')](_0x3d8c68['model'],_0x3d8c68['query']);_0x4074f0['attributes']=_['intersection'](_0x3d8c68['model'],qs['fields'](_0x20274e[_0xe11d('0x31')][_0xe11d('0x33')]));_0x4074f0['attributes']=_0x4074f0[_0xe11d('0x34')][_0xe11d('0x35')]?_0x4074f0[_0xe11d('0x34')]:_0x3d8c68[_0xe11d('0x30')];if(!_0x20274e[_0xe11d('0x31')][_0xe11d('0x36')](_0xe11d('0x37'))){_0x4074f0['limit']=qs[_0xe11d('0x1b')](_0x20274e[_0xe11d('0x31')][_0xe11d('0x1b')]);_0x4074f0[_0xe11d('0x1a')]=qs['offset'](_0x20274e[_0xe11d('0x31')]['offset']);}_0x4074f0[_0xe11d('0x38')]=qs['sort'](_0x20274e[_0xe11d('0x31')][_0xe11d('0x39')]);_0x4074f0[_0xe11d('0x3a')]=qs['filters'](_[_0xe11d('0x3b')](_0x20274e[_0xe11d('0x31')],_0x3d8c68[_0xe11d('0x3c')]),_0x3a5594);if(_0x20274e[_0xe11d('0x31')]['filter']){_0x4074f0[_0xe11d('0x3a')]=_[_0xe11d('0x3d')](_0x4074f0[_0xe11d('0x3a')],{'$or':_[_0xe11d('0x2c')](_0x3a5594,function(_0x130c78){if(_0x130c78['type']!==_0xe11d('0x3e')){var _0x3d5fc0={};_0x3d5fc0[_0x130c78[_0xe11d('0x29')]]={'$like':'%'+_0x20274e['query']['filter']+'%'};return _0x3d5fc0;}})});}_0x4074f0=_[_0xe11d('0x3d')]({},_0x4074f0,_0x20274e[_0xe11d('0x3f')]);var _0x23d9a0={'where':_0x4074f0[_0xe11d('0x3a')]};return db[_0xe11d('0x2d')][_0xe11d('0x1c')](_0x23d9a0)[_0xe11d('0x21')](function(_0x36c8ef){_0x34068b[_0xe11d('0x1c')]=_0x36c8ef;if(_0x20274e['query'][_0xe11d('0x40')]){_0x4074f0['include']=[{'all':!![]}];}return db[_0xe11d('0x2d')][_0xe11d('0x41')](_0x4074f0);})[_0xe11d('0x21')](function(_0x1c0b8e){_0x34068b[_0xe11d('0x42')]=_0x1c0b8e;return _0x34068b;})[_0xe11d('0x21')](respondWithFilteredResult(_0x7f2f34,_0x4074f0))[_0xe11d('0x43')](handleError(_0x7f2f34,null));};exports[_0xe11d('0x44')]=function(_0x51ccdf,_0x399890){var _0x590f13={'raw':!![],'where':{'id':_0x51ccdf['params']['id']}},_0x2a8af6={};_0x2a8af6[_0xe11d('0x30')]=_[_0xe11d('0x45')](db[_0xe11d('0x2d')]['rawAttributes']);_0x2a8af6[_0xe11d('0x31')]=_[_0xe11d('0x45')](_0x51ccdf[_0xe11d('0x31')]);_0x2a8af6['filters']=_[_0xe11d('0x32')](_0x2a8af6[_0xe11d('0x30')],_0x2a8af6['query']);_0x590f13['attributes']=_[_0xe11d('0x32')](_0x2a8af6[_0xe11d('0x30')],qs['fields'](_0x51ccdf[_0xe11d('0x31')]['fields']));_0x590f13[_0xe11d('0x34')]=_0x590f13[_0xe11d('0x34')][_0xe11d('0x35')]?_0x590f13['attributes']:_0x2a8af6[_0xe11d('0x30')];if(_0x51ccdf[_0xe11d('0x31')][_0xe11d('0x40')]){_0x590f13[_0xe11d('0x46')]=[{'all':!![]}];}_0x590f13=_[_0xe11d('0x3d')]({},_0x590f13,_0x51ccdf[_0xe11d('0x3f')]);return db['SquareOdbc'][_0xe11d('0x47')](_0x590f13)[_0xe11d('0x21')](handleEntityNotFound(_0x399890,null))[_0xe11d('0x21')](respondWithResult(_0x399890,null))[_0xe11d('0x43')](handleError(_0x399890,null));};exports[_0xe11d('0x48')]=function(_0x349985,_0x1b04f0){return db[_0xe11d('0x2d')][_0xe11d('0x48')](_0x349985[_0xe11d('0x49')],{})[_0xe11d('0x21')](function(_0x3d606d){var _0x5ecf11=_0x349985[_0xe11d('0x4a')]['get']({'plain':!![]});if(!_0x5ecf11)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ecf11[_0xe11d('0x4b')]===_0xe11d('0x4a')){var _0x41f5d8=_0x3d606d[_0xe11d('0x23')]({'plain':!![]});var _0x34079a='ODBC';return db[_0xe11d('0x4c')]['find']({'where':{'name':_0x34079a,'userProfileId':_0x5ecf11[_0xe11d('0x4d')]},'raw':!![]})[_0xe11d('0x21')](function(_0x1a8ce6){if(_0x1a8ce6&&_0x1a8ce6[_0xe11d('0x4e')]===0x0){return db['UserProfileResource'][_0xe11d('0x48')]({'name':_0x41f5d8[_0xe11d('0x29')],'resourceId':_0x41f5d8['id'],'type':_0x1a8ce6[_0xe11d('0x29')],'sectionId':_0x1a8ce6['id']},{})['then'](function(){return _0x3d606d;});}else{return _0x3d606d;}})[_0xe11d('0x43')](function(_0x35a69d){logger[_0xe11d('0x27')](_0xe11d('0x4f'),_0x35a69d);throw _0x35a69d;});}return _0x3d606d;})[_0xe11d('0x21')](respondWithResult(_0x1b04f0,0xc9))[_0xe11d('0x43')](handleError(_0x1b04f0,null));};exports['update']=function(_0x2cbe6a,_0x4e8f44){if(_0x2cbe6a[_0xe11d('0x49')]['id']){delete _0x2cbe6a[_0xe11d('0x49')]['id'];}return db[_0xe11d('0x2d')][_0xe11d('0x47')]({'where':{'id':_0x2cbe6a[_0xe11d('0x50')]['id']}})[_0xe11d('0x21')](handleEntityNotFound(_0x4e8f44,null))[_0xe11d('0x21')](saveUpdates(_0x2cbe6a['body'],null))['then'](respondWithResult(_0x4e8f44,null))[_0xe11d('0x43')](handleError(_0x4e8f44,null));};exports['destroy']=function(_0x459ba1,_0x270478){return db['SquareOdbc'][_0xe11d('0x47')]({'where':{'id':_0x459ba1[_0xe11d('0x50')]['id']}})['then'](handleEntityNotFound(_0x270478,null))['then'](removeEntity(_0x270478,null))[_0xe11d('0x43')](handleError(_0x270478,null));};exports[_0xe11d('0x51')]=function(_0x3a435a,_0x32d0a8,_0x3d4b29){var _0x5c11c3;return db[_0xe11d('0x2d')][_0xe11d('0x47')]({'where':{'id':_0x3a435a[_0xe11d('0x50')]['id']},'attributes':['id',_0xe11d('0x52')]})['then'](handleEntityNotFound(_0x32d0a8,null))['then'](function(_0x11d0f9){if(_0x11d0f9){var _0x5f1bcb=require(_0xe11d('0x53'))();_0x5f1bcb[_0xe11d('0x54')](_0x11d0f9['dsn']);_0x5f1bcb['closeSync']();return _0x11d0f9;}})['then'](respondWithResult(_0x32d0a8,null))[_0xe11d('0x43')](handleError(_0x32d0a8,null));}; \ No newline at end of file +var _0xc901=['pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','ODBC','UserProfileResource','end','error','stack','name','status','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc901,0x11a));var _0x1c90=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc901[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c90('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1c90('0x1'));var moment=require(_0x1c90('0x2'));var BPromise=require(_0x1c90('0x3'));var Mustache=require(_0x1c90('0x4'));var util=require('util');var path=require(_0x1c90('0x5'));var sox=require(_0x1c90('0x6'));var csv=require('to-csv');var ejs=require(_0x1c90('0x7'));var fs=require('fs');var fs_extra=require(_0x1c90('0x8'));var _=require(_0x1c90('0x9'));var squel=require('squel');var crypto=require(_0x1c90('0xa'));var jsforce=require(_0x1c90('0xb'));var deskjs=require(_0x1c90('0xc'));var toCsv=require(_0x1c90('0xd'));var querystring=require(_0x1c90('0xe'));var Papa=require(_0x1c90('0xf'));var Redis=require(_0x1c90('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1c90('0x11'));var as=require(_0x1c90('0x12'));var hardwareService=require(_0x1c90('0x13'));var logger=require('../../config/logger')(_0x1c90('0x14'));var utils=require(_0x1c90('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1c90('0x16'));var db=require(_0x1c90('0x17'))['db'];function respondWithStatusCode(_0xf96471,_0xbff506){_0xbff506=_0xbff506||0xcc;return function(_0x3b31e3){if(_0x3b31e3){return _0xf96471[_0x1c90('0x18')](_0xbff506);}return _0xf96471['status'](_0xbff506)['end']();};}function respondWithResult(_0x5e63c4,_0x55c389){_0x55c389=_0x55c389||0xc8;return function(_0xe3e21d){if(_0xe3e21d){return _0x5e63c4['status'](_0x55c389)[_0x1c90('0x19')](_0xe3e21d);}};}function respondWithFilteredResult(_0x49e410,_0x577383){return function(_0x1a26ed){if(_0x1a26ed){var _0x432b28=typeof _0x577383[_0x1c90('0x1a')]===_0x1c90('0x1b')&&typeof _0x577383[_0x1c90('0x1c')]===_0x1c90('0x1b');var _0x3bd104=_0x1a26ed[_0x1c90('0x1d')];var _0xc73c82=_0x432b28?0x0:_0x577383[_0x1c90('0x1a')];var _0x2396e1=_0x432b28?_0x1a26ed[_0x1c90('0x1d')]:_0x577383[_0x1c90('0x1a')]+_0x577383[_0x1c90('0x1c')];var _0x31f4a4;if(_0x2396e1>=_0x3bd104){_0x2396e1=_0x3bd104;_0x31f4a4=0xc8;}else{_0x31f4a4=0xce;}_0x49e410['status'](_0x31f4a4);return _0x49e410[_0x1c90('0x1e')]('Content-Range',_0xc73c82+'-'+_0x2396e1+'/'+_0x3bd104)[_0x1c90('0x19')](_0x1a26ed);}return null;};}function patchUpdates(_0x4c8940){return function(_0x57c3b4){try{jsonpatch[_0x1c90('0x1f')](_0x57c3b4,_0x4c8940,!![]);}catch(_0x3269d7){return BPromise[_0x1c90('0x20')](_0x3269d7);}return _0x57c3b4[_0x1c90('0x21')]();};}function saveUpdates(_0x39e17a,_0x2803df){return function(_0xd1cf82){if(_0xd1cf82){return _0xd1cf82['update'](_0x39e17a)[_0x1c90('0x22')](function(_0x1270ed){return _0x1270ed;});}return null;};}function removeEntity(_0x248284,_0x36a862){return function(_0x18277b){if(_0x18277b){return _0x18277b[_0x1c90('0x23')]()[_0x1c90('0x22')](function(){var _0x15b185=_0x18277b['get']({'plain':!![]});var _0x211150=_0x1c90('0x24');return db[_0x1c90('0x25')][_0x1c90('0x23')]({'where':{'type':_0x211150,'resourceId':_0x15b185['id']}})['then'](function(){return _0x18277b;});})[_0x1c90('0x22')](function(){_0x248284['status'](0xcc)[_0x1c90('0x26')]();});}};}function handleEntityNotFound(_0x1c408f,_0x4c80e4){return function(_0x2acfe8){if(!_0x2acfe8){_0x1c408f['sendStatus'](0x194);}return _0x2acfe8;};}function handleError(_0x7be941,_0x59adb0){_0x59adb0=_0x59adb0||0x1f4;return function(_0x93220d){logger[_0x1c90('0x27')](_0x93220d[_0x1c90('0x28')]);if(_0x93220d[_0x1c90('0x29')]){delete _0x93220d[_0x1c90('0x29')];}_0x7be941[_0x1c90('0x2a')](_0x59adb0)[_0x1c90('0x2b')](_0x93220d);};}exports['index']=function(_0x1327a4,_0x23a114){var _0x275784={},_0x5f29ea={},_0x262f9b={'count':0x0,'rows':[]};var _0x15c8b0=_[_0x1c90('0x2c')](db[_0x1c90('0x2d')][_0x1c90('0x2e')],function(_0xa8a130){return{'name':_0xa8a130[_0x1c90('0x2f')],'type':_0xa8a130[_0x1c90('0x30')][_0x1c90('0x31')]};});_0x5f29ea[_0x1c90('0x32')]=_[_0x1c90('0x2c')](_0x15c8b0,_0x1c90('0x29'));_0x5f29ea[_0x1c90('0x33')]=_[_0x1c90('0x34')](_0x1327a4[_0x1c90('0x33')]);_0x5f29ea[_0x1c90('0x35')]=_[_0x1c90('0x36')](_0x5f29ea[_0x1c90('0x32')],_0x5f29ea['query']);_0x275784['attributes']=_[_0x1c90('0x36')](_0x5f29ea[_0x1c90('0x32')],qs[_0x1c90('0x37')](_0x1327a4[_0x1c90('0x33')][_0x1c90('0x37')]));_0x275784[_0x1c90('0x38')]=_0x275784[_0x1c90('0x38')]['length']?_0x275784[_0x1c90('0x38')]:_0x5f29ea[_0x1c90('0x32')];if(!_0x1327a4[_0x1c90('0x33')][_0x1c90('0x39')](_0x1c90('0x3a'))){_0x275784[_0x1c90('0x1c')]=qs[_0x1c90('0x1c')](_0x1327a4['query'][_0x1c90('0x1c')]);_0x275784[_0x1c90('0x1a')]=qs[_0x1c90('0x1a')](_0x1327a4[_0x1c90('0x33')]['offset']);}_0x275784[_0x1c90('0x3b')]=qs[_0x1c90('0x3c')](_0x1327a4[_0x1c90('0x33')][_0x1c90('0x3c')]);_0x275784[_0x1c90('0x3d')]=qs[_0x1c90('0x35')](_[_0x1c90('0x3e')](_0x1327a4['query'],_0x5f29ea['filters']),_0x15c8b0);if(_0x1327a4[_0x1c90('0x33')][_0x1c90('0x3f')]){_0x275784['where']=_['merge'](_0x275784[_0x1c90('0x3d')],{'$or':_[_0x1c90('0x2c')](_0x15c8b0,function(_0x137248){if(_0x137248[_0x1c90('0x30')]!==_0x1c90('0x40')){var _0xd7322a={};_0xd7322a[_0x137248[_0x1c90('0x29')]]={'$like':'%'+_0x1327a4['query'][_0x1c90('0x3f')]+'%'};return _0xd7322a;}})});}_0x275784=_['merge']({},_0x275784,_0x1327a4[_0x1c90('0x41')]);var _0x249d78={'where':_0x275784[_0x1c90('0x3d')]};return db[_0x1c90('0x2d')][_0x1c90('0x1d')](_0x249d78)['then'](function(_0x2ba161){_0x262f9b[_0x1c90('0x1d')]=_0x2ba161;if(_0x1327a4[_0x1c90('0x33')][_0x1c90('0x42')]){_0x275784[_0x1c90('0x43')]=[{'all':!![]}];}return db[_0x1c90('0x2d')][_0x1c90('0x44')](_0x275784);})[_0x1c90('0x22')](function(_0x25f8d8){_0x262f9b[_0x1c90('0x45')]=_0x25f8d8;return _0x262f9b;})[_0x1c90('0x22')](respondWithFilteredResult(_0x23a114,_0x275784))[_0x1c90('0x46')](handleError(_0x23a114,null));};exports[_0x1c90('0x47')]=function(_0x489633,_0x2e4ee1){var _0x5eddb2={'raw':!![],'where':{'id':_0x489633[_0x1c90('0x48')]['id']}},_0xd70faf={};_0xd70faf[_0x1c90('0x32')]=_[_0x1c90('0x34')](db[_0x1c90('0x2d')][_0x1c90('0x2e')]);_0xd70faf[_0x1c90('0x33')]=_['keys'](_0x489633[_0x1c90('0x33')]);_0xd70faf[_0x1c90('0x35')]=_[_0x1c90('0x36')](_0xd70faf['model'],_0xd70faf[_0x1c90('0x33')]);_0x5eddb2[_0x1c90('0x38')]=_[_0x1c90('0x36')](_0xd70faf[_0x1c90('0x32')],qs[_0x1c90('0x37')](_0x489633['query'][_0x1c90('0x37')]));_0x5eddb2['attributes']=_0x5eddb2[_0x1c90('0x38')][_0x1c90('0x49')]?_0x5eddb2[_0x1c90('0x38')]:_0xd70faf[_0x1c90('0x32')];if(_0x489633[_0x1c90('0x33')][_0x1c90('0x42')]){_0x5eddb2[_0x1c90('0x43')]=[{'all':!![]}];}_0x5eddb2=_['merge']({},_0x5eddb2,_0x489633[_0x1c90('0x41')]);return db[_0x1c90('0x2d')][_0x1c90('0x4a')](_0x5eddb2)[_0x1c90('0x22')](handleEntityNotFound(_0x2e4ee1,null))['then'](respondWithResult(_0x2e4ee1,null))[_0x1c90('0x46')](handleError(_0x2e4ee1,null));};exports[_0x1c90('0x4b')]=function(_0x2f5452,_0x2bf736){return db[_0x1c90('0x2d')][_0x1c90('0x4b')](_0x2f5452[_0x1c90('0x4c')],{})['then'](function(_0x309b8c){var _0x29095a=_0x2f5452[_0x1c90('0x4d')][_0x1c90('0x4e')]({'plain':!![]});if(!_0x29095a)throw new Error(_0x1c90('0x4f'));if(_0x29095a[_0x1c90('0x50')]===_0x1c90('0x4d')){var _0x1b8b41=_0x309b8c[_0x1c90('0x4e')]({'plain':!![]});var _0x5c564f='ODBC';return db[_0x1c90('0x51')][_0x1c90('0x4a')]({'where':{'name':_0x5c564f,'userProfileId':_0x29095a['userProfileId']},'raw':!![]})[_0x1c90('0x22')](function(_0x40fc57){if(_0x40fc57&&_0x40fc57['autoAssociation']===0x0){return db['UserProfileResource'][_0x1c90('0x4b')]({'name':_0x1b8b41[_0x1c90('0x29')],'resourceId':_0x1b8b41['id'],'type':_0x40fc57[_0x1c90('0x29')],'sectionId':_0x40fc57['id']},{})['then'](function(){return _0x309b8c;});}else{return _0x309b8c;}})[_0x1c90('0x46')](function(_0x29ab65){logger[_0x1c90('0x27')](_0x1c90('0x52'),_0x29ab65);throw _0x29ab65;});}return _0x309b8c;})[_0x1c90('0x22')](respondWithResult(_0x2bf736,0xc9))[_0x1c90('0x46')](handleError(_0x2bf736,null));};exports[_0x1c90('0x53')]=function(_0x2f69bf,_0x40f8db){if(_0x2f69bf[_0x1c90('0x4c')]['id']){delete _0x2f69bf[_0x1c90('0x4c')]['id'];}return db[_0x1c90('0x2d')]['find']({'where':{'id':_0x2f69bf[_0x1c90('0x48')]['id']}})[_0x1c90('0x22')](handleEntityNotFound(_0x40f8db,null))[_0x1c90('0x22')](saveUpdates(_0x2f69bf[_0x1c90('0x4c')],null))[_0x1c90('0x22')](respondWithResult(_0x40f8db,null))[_0x1c90('0x46')](handleError(_0x40f8db,null));};exports[_0x1c90('0x23')]=function(_0x318ac2,_0x4bd50e){return db['SquareOdbc']['find']({'where':{'id':_0x318ac2[_0x1c90('0x48')]['id']}})[_0x1c90('0x22')](handleEntityNotFound(_0x4bd50e,null))[_0x1c90('0x22')](removeEntity(_0x4bd50e,null))['catch'](handleError(_0x4bd50e,null));};exports[_0x1c90('0x54')]=function(_0x286d63,_0x2eb69,_0x5c51d2){var _0x199e47;return db[_0x1c90('0x2d')][_0x1c90('0x4a')]({'where':{'id':_0x286d63['params']['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x2eb69,null))[_0x1c90('0x22')](function(_0x27e04b){if(_0x27e04b){var _0x4e94aa=require('odbc')();_0x4e94aa['openSync'](_0x27e04b[_0x1c90('0x55')]);_0x4e94aa['closeSync']();return _0x27e04b;}})['then'](respondWithResult(_0x2eb69,null))[_0x1c90('0x46')](handleError(_0x2eb69,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 39b6a9e..bff153e 100644 --- a/server/api/squareOdbc/squareOdbc.model.js +++ b/server/api/squareOdbc/squareOdbc.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ee2=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x5ee2,0x180));var _0x25ee=function(_0x2fc051,_0x5cca4c){_0x2fc051=_0x2fc051-0x0;var _0x1af0fd=_0x5ee2[_0x2fc051];return _0x1af0fd;};'use strict';var _=require(_0x25ee('0x0'));var util=require('util');var logger=require(_0x25ee('0x1'))(_0x25ee('0x2'));var moment=require('moment');var BPromise=require(_0x25ee('0x3'));var rp=require(_0x25ee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25ee('0x5'));var config=require(_0x25ee('0x6'));var attributes=require(_0x25ee('0x7'));module['exports']=function(_0x299b0a,_0x73c23a){return _0x299b0a[_0x25ee('0x8')](_0x25ee('0x9'),attributes,{'tableName':_0x25ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26b2=['SquareOdbc','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x20dda3,_0xfcb775){var _0x547b71=function(_0x478410){while(--_0x478410){_0x20dda3['push'](_0x20dda3['shift']());}};_0x547b71(++_0xfcb775);}(_0x26b2,0x155));var _0x226b=function(_0x51d0ff,_0xb421e8){_0x51d0ff=_0x51d0ff-0x0;var _0x5298fb=_0x26b2[_0x51d0ff];return _0x5298fb;};'use strict';var _=require(_0x226b('0x0'));var util=require(_0x226b('0x1'));var logger=require(_0x226b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x226b('0x3'));var fs=require('fs');var path=require(_0x226b('0x4'));var rimraf=require(_0x226b('0x5'));var config=require(_0x226b('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x226b('0x7')]=function(_0x19d5ef,_0x3558f3){return _0x19d5ef[_0x226b('0x8')](_0x226b('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index d393b72..e751b8c 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf54f=['jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','debug','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf54f,0x108));var _0xff54=function(_0x2e9e6c,_0x5f12d4){_0x2e9e6c=_0x2e9e6c-0x0;var _0x560cd0=_0xf54f[_0x2e9e6c];return _0x560cd0;};'use strict';var _=require(_0xff54('0x0'));var util=require('util');var moment=require(_0xff54('0x1'));var BPromise=require('bluebird');var rs=require(_0xff54('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff54('0x3'))['db'];var utils=require(_0xff54('0x4'));var logger=require(_0xff54('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xff54('0x6'));var client=jayson[_0xff54('0x7')][_0xff54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x200613,_0x4b794a,_0x980d8b){return new BPromise(function(_0x582c58,_0x3277ba){return client[_0xff54('0x9')](_0x200613,_0x980d8b)[_0xff54('0xa')](function(_0x338474){logger[_0xff54('0xb')](_0xff54('0xc'),_0x4b794a,'request\x20sent');logger['debug'](_0xff54('0xd'),_0x4b794a,'request\x20sent',JSON['stringify'](_0x338474));if(_0x338474[_0xff54('0xe')]){if(_0x338474[_0xff54('0xe')][_0xff54('0xf')]===0x1f4){logger[_0xff54('0xe')](_0xff54('0xc'),_0x4b794a,_0x338474[_0xff54('0xe')]['message']);return _0x3277ba(_0x338474[_0xff54('0xe')][_0xff54('0x10')]);}logger[_0xff54('0xe')](_0xff54('0xc'),_0x4b794a,_0x338474[_0xff54('0xe')]['message']);return _0x582c58(_0x338474[_0xff54('0xe')][_0xff54('0x10')]);}else{logger['info'](_0xff54('0xc'),_0x4b794a,_0xff54('0x11'));_0x582c58(_0x338474['result'][_0xff54('0x10')]);}})[_0xff54('0x12')](function(_0x1eefa8){logger[_0xff54('0xe')](_0xff54('0xc'),_0x4b794a,_0x1eefa8);_0x3277ba(_0x1eefa8);});});}exports[_0xff54('0x13')]=function(_0xddd6ac){var _0x1ed096=this;return new Promise(function(_0x30fcb4,_0x151dba){return db[_0xff54('0x14')]['find']({'raw':_0xddd6ac[_0xff54('0x15')]?_0xddd6ac['options'][_0xff54('0x16')]===undefined?!![]:![]:!![],'where':_0xddd6ac['options']?_0xddd6ac['options'][_0xff54('0x17')]||null:null,'attributes':_0xddd6ac[_0xff54('0x15')]?_0xddd6ac[_0xff54('0x15')][_0xff54('0x18')]||null:null,'include':_0xddd6ac[_0xff54('0x15')]?_0xddd6ac[_0xff54('0x15')][_0xff54('0x19')]?_[_0xff54('0x1a')](_0xddd6ac[_0xff54('0x15')][_0xff54('0x19')],function(_0x4d1daf){return{'model':db[_0x4d1daf['model']],'as':_0x4d1daf['as'],'attributes':_0x4d1daf[_0xff54('0x18')],'include':_0x4d1daf[_0xff54('0x19')]?_[_0xff54('0x1a')](_0x4d1daf[_0xff54('0x19')],function(_0xbdacc0){return{'model':db[_0xbdacc0[_0xff54('0x1b')]],'as':_0xbdacc0['as'],'attributes':_0xbdacc0['attributes'],'include':_0xbdacc0[_0xff54('0x19')]?_['map'](_0xbdacc0[_0xff54('0x19')],function(_0x5d13c1){return{'model':db[_0x5d13c1[_0xff54('0x1b')]],'as':_0x5d13c1['as'],'attributes':_0x5d13c1[_0xff54('0x18')]};}):[]};}):[]};}):[]:[]})[_0xff54('0xa')](function(_0x1f8ba0){logger[_0xff54('0xb')](_0xff54('0x13'),_0xddd6ac);logger[_0xff54('0x1c')](_0xff54('0x13'),_0xddd6ac,JSON[_0xff54('0x1d')](_0x1f8ba0));_0x30fcb4(_0x1f8ba0);})['catch'](function(_0x423c41){logger[_0xff54('0xe')](_0xff54('0x13'),_0x423c41[_0xff54('0x10')],_0xddd6ac);_0x151dba(_0x1ed096['error'](0x1f4,_0x423c41[_0xff54('0x10')]));});});}; \ No newline at end of file +var _0xed23=['jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareOdbc','find','options','raw','where','map','model','attributes','include','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x4f8606,_0x250ccc){var _0x45c6f4=function(_0x3981b5){while(--_0x3981b5){_0x4f8606['push'](_0x4f8606['shift']());}};_0x45c6f4(++_0x250ccc);}(_0xed23,0x1c9));var _0x3ed2=function(_0x19ef6a,_0x29b819){_0x19ef6a=_0x19ef6a-0x0;var _0x38b2a6=_0xed23[_0x19ef6a];return _0x38b2a6;};'use strict';var _=require(_0x3ed2('0x0'));var util=require(_0x3ed2('0x1'));var moment=require('moment');var BPromise=require(_0x3ed2('0x2'));var rs=require(_0x3ed2('0x3'));var fs=require('fs');var Redis=require(_0x3ed2('0x4'));var db=require(_0x3ed2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3ed2('0x6'));var config=require(_0x3ed2('0x7'));var jayson=require(_0x3ed2('0x8'));var client=jayson[_0x3ed2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc9801b,_0x4691ec,_0x5d3134){return new BPromise(function(_0x2de212,_0x32e299){return client[_0x3ed2('0xa')](_0xc9801b,_0x5d3134)[_0x3ed2('0xb')](function(_0x393f04){logger[_0x3ed2('0xc')](_0x3ed2('0xd'),_0x4691ec,_0x3ed2('0xe'));logger[_0x3ed2('0xf')](_0x3ed2('0x10'),_0x4691ec,'request\x20sent',JSON[_0x3ed2('0x11')](_0x393f04));if(_0x393f04[_0x3ed2('0x12')]){if(_0x393f04['error']['code']===0x1f4){logger[_0x3ed2('0x12')](_0x3ed2('0xd'),_0x4691ec,_0x393f04[_0x3ed2('0x12')]['message']);return _0x32e299(_0x393f04[_0x3ed2('0x12')][_0x3ed2('0x13')]);}logger[_0x3ed2('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x4691ec,_0x393f04[_0x3ed2('0x12')][_0x3ed2('0x13')]);return _0x2de212(_0x393f04[_0x3ed2('0x12')][_0x3ed2('0x13')]);}else{logger[_0x3ed2('0xc')](_0x3ed2('0xd'),_0x4691ec,_0x3ed2('0xe'));_0x2de212(_0x393f04[_0x3ed2('0x14')][_0x3ed2('0x13')]);}})['catch'](function(_0x7732e8){logger[_0x3ed2('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x4691ec,_0x7732e8);_0x32e299(_0x7732e8);});});}exports[_0x3ed2('0x15')]=function(_0x19def7){var _0xf7cc7b=this;return new Promise(function(_0x2e44a9,_0x1460da){return db['SquareOdbc'][_0x3ed2('0x16')]({'raw':_0x19def7[_0x3ed2('0x17')]?_0x19def7[_0x3ed2('0x17')][_0x3ed2('0x18')]===undefined?!![]:![]:!![],'where':_0x19def7[_0x3ed2('0x17')]?_0x19def7[_0x3ed2('0x17')][_0x3ed2('0x19')]||null:null,'attributes':_0x19def7['options']?_0x19def7['options']['attributes']||null:null,'include':_0x19def7[_0x3ed2('0x17')]?_0x19def7[_0x3ed2('0x17')]['include']?_[_0x3ed2('0x1a')](_0x19def7[_0x3ed2('0x17')]['include'],function(_0x35799c){return{'model':db[_0x35799c[_0x3ed2('0x1b')]],'as':_0x35799c['as'],'attributes':_0x35799c[_0x3ed2('0x1c')],'include':_0x35799c[_0x3ed2('0x1d')]?_['map'](_0x35799c[_0x3ed2('0x1d')],function(_0x331a25){return{'model':db[_0x331a25['model']],'as':_0x331a25['as'],'attributes':_0x331a25['attributes'],'include':_0x331a25[_0x3ed2('0x1d')]?_[_0x3ed2('0x1a')](_0x331a25['include'],function(_0x35b0f1){return{'model':db[_0x35b0f1[_0x3ed2('0x1b')]],'as':_0x35b0f1['as'],'attributes':_0x35b0f1[_0x3ed2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23e94b){logger[_0x3ed2('0xc')](_0x3ed2('0x15'),_0x19def7);logger[_0x3ed2('0xf')]('ShowSquareOdbc',_0x19def7,JSON[_0x3ed2('0x11')](_0x23e94b));_0x2e44a9(_0x23e94b);})[_0x3ed2('0x1e')](function(_0x5a9d8b){logger[_0x3ed2('0x12')](_0x3ed2('0x15'),_0x5a9d8b[_0x3ed2('0x13')],_0x19def7);_0x1460da(_0xf7cc7b[_0x3ed2('0x12')](0x1f4,_0x5a9d8b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 22adf0f..e0bfbbb 100644 --- a/server/api/squareProject/index.js +++ b/server/api/squareProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe37c=['isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1cb96f,_0x1f21ec){var _0x418399=function(_0x35979d){while(--_0x35979d){_0x1cb96f['push'](_0x1cb96f['shift']());}};_0x418399(++_0x1f21ec);}(_0xe37c,0x88));var _0xce37=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0xe37c[_0x7791d5];return _0x5ce288;};'use strict';var multer=require(_0xce37('0x0'));var util=require(_0xce37('0x1'));var path=require(_0xce37('0x2'));var timeout=require(_0xce37('0x3'));var express=require(_0xce37('0x4'));var router=express[_0xce37('0x5')]();var fs_extra=require(_0xce37('0x6'));var auth=require(_0xce37('0x7'));var interaction=require(_0xce37('0x8'));var config=require(_0xce37('0x9'));var controller=require('./squareProject.controller');router[_0xce37('0xa')]('/',auth[_0xce37('0xb')](),controller['index']);router[_0xce37('0xa')]('/:id',auth[_0xce37('0xb')](),controller[_0xce37('0xc')]);router[_0xce37('0xd')]('/',auth[_0xce37('0xb')](),controller[_0xce37('0xe')]);router[_0xce37('0xf')](_0xce37('0x10'),auth['isAuthenticated'](),controller[_0xce37('0x11')]);router[_0xce37('0x12')](_0xce37('0x10'),auth[_0xce37('0xb')](),controller[_0xce37('0x13')]);module[_0xce37('0x14')]=router; \ No newline at end of file +var _0x6e19=['delete','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show','post','create','put','update'];(function(_0x5b4965,_0x507e09){var _0x104f35=function(_0x5e3768){while(--_0x5e3768){_0x5b4965['push'](_0x5b4965['shift']());}};_0x104f35(++_0x507e09);}(_0x6e19,0x82));var _0x96e1=function(_0x4cd144,_0x585da7){_0x4cd144=_0x4cd144-0x0;var _0x46efe9=_0x6e19[_0x4cd144];return _0x46efe9;};'use strict';var multer=require('multer');var util=require(_0x96e1('0x0'));var path=require(_0x96e1('0x1'));var timeout=require(_0x96e1('0x2'));var express=require('express');var router=express[_0x96e1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x96e1('0x4'));var interaction=require(_0x96e1('0x5'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router['get']('/',auth[_0x96e1('0x6')](),controller[_0x96e1('0x7')]);router[_0x96e1('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x96e1('0x9')]);router[_0x96e1('0xa')]('/',auth['isAuthenticated'](),controller[_0x96e1('0xb')]);router[_0x96e1('0xc')]('/:id',auth[_0x96e1('0x6')](),controller[_0x96e1('0xd')]);router[_0x96e1('0xe')](_0x96e1('0xf'),auth[_0x96e1('0x6')](),controller[_0x96e1('0x10')]);module[_0x96e1('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 7b1d9d7..d9b21bd 100644 --- a/server/api/squareProject/squareProject.attributes.js +++ b/server/api/squareProject/squareProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8786=['STRING','TEXT','BLOB','getDataValue','preproduction','utf8','production','toString','DATE','sequelize','exports'];(function(_0x10a71a,_0x578551){var _0x5e00c6=function(_0x1a3ada){while(--_0x1a3ada){_0x10a71a['push'](_0x10a71a['shift']());}};_0x5e00c6(++_0x578551);}(_0x8786,0x153));var _0x6878=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8786[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x6878('0x0'));module[_0x6878('0x1')]={'name':{'type':Sequelize[_0x6878('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6878('0x2')]},'notes':{'type':Sequelize[_0x6878('0x3')]},'preproduction':{'type':Sequelize[_0x6878('0x4')]('long'),'get':function(){if(this[_0x6878('0x5')](_0x6878('0x6'))){return this[_0x6878('0x5')](_0x6878('0x6'))['toString'](_0x6878('0x7'));}}},'production':{'type':Sequelize[_0x6878('0x4')]('long'),'get':function(){if(this[_0x6878('0x5')]('production')){return this[_0x6878('0x5')](_0x6878('0x8'))[_0x6878('0x9')](_0x6878('0x7'));}}},'savedAt':{'type':Sequelize[_0x6878('0xa')]},'publishedAt':{'type':Sequelize[_0x6878('0xa')]}}; \ No newline at end of file +var _0x81a4=['exports','STRING','name','BLOB','getDataValue','preproduction','utf8','long','production','DATE','sequelize'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0x81a4,0x128));var _0x481a=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0x81a4[_0xb5fc3e];return _0x2efc3c;};'use strict';var Sequelize=require(_0x481a('0x0'));module[_0x481a('0x1')]={'name':{'type':Sequelize[_0x481a('0x2')],'unique':_0x481a('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x481a('0x4')]('long'),'get':function(){if(this[_0x481a('0x5')](_0x481a('0x6'))){return this[_0x481a('0x5')](_0x481a('0x6'))['toString'](_0x481a('0x7'));}}},'production':{'type':Sequelize[_0x481a('0x4')](_0x481a('0x8')),'get':function(){if(this[_0x481a('0x5')](_0x481a('0x9'))){return this['getDataValue'](_0x481a('0x9'))['toString'](_0x481a('0x7'));}}},'savedAt':{'type':Sequelize[_0x481a('0xa')]},'publishedAt':{'type':Sequelize[_0x481a('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 6bc46aa..72ec43b 100644 --- a/server/api/squareProject/squareProject.controller.js +++ b/server/api/squareProject/squareProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65cf=['filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','find','autoAssociation','UserProfileResource','publish','agi','production','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','localhost','./squareProject.socket','register','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','stringify','end','error','name','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys'];(function(_0x38f3c0,_0x4d234a){var _0x2f086f=function(_0x2e9ea0){while(--_0x2e9ea0){_0x38f3c0['push'](_0x38f3c0['shift']());}};_0x2f086f(++_0x4d234a);}(_0x65cf,0x1a6));var _0xf65c=function(_0x87bfd1,_0x14ce47){_0x87bfd1=_0x87bfd1-0x0;var _0x26aa16=_0x65cf[_0x87bfd1];return _0x26aa16;};'use strict';var _=require(_0xf65c('0x0'));var Redis=require(_0xf65c('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf65c('0x2'));var config=require(_0xf65c('0x3'));var db=require(_0xf65c('0x4'))['db'];config[_0xf65c('0x5')]=_['defaults'](config[_0xf65c('0x5')],{'host':_0xf65c('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf65c('0x5')]));require(_0xf65c('0x7'))[_0xf65c('0x8')](socket);function respondWithResult(_0x44979b,_0x39245c){_0x39245c=_0x39245c||0xc8;return function(_0xd93006){if(_0xd93006){return _0x44979b[_0xf65c('0x9')](_0x39245c)['json'](_0xd93006);}};}function respondWithFilteredResult(_0x17c002,_0x407b0f){return function(_0x35d923){if(_0x35d923){var _0x3d531e=typeof _0x407b0f['offset']===_0xf65c('0xa')&&typeof _0x407b0f[_0xf65c('0xb')]===_0xf65c('0xa');var _0x475f91=_0x35d923[_0xf65c('0xc')];var _0xb70a1a=_0x3d531e?0x0:_0x407b0f[_0xf65c('0xd')];var _0x163ceb=_0x3d531e?_0x35d923[_0xf65c('0xc')]:_0x407b0f[_0xf65c('0xd')]+_0x407b0f[_0xf65c('0xb')];var _0x2d5535;if(_0x163ceb>=_0x475f91){_0x163ceb=_0x475f91;_0x2d5535=0xc8;}else{_0x2d5535=0xce;}_0x17c002[_0xf65c('0x9')](_0x2d5535);return _0x17c002[_0xf65c('0xe')](_0xf65c('0xf'),_0xb70a1a+'-'+_0x163ceb+'/'+_0x475f91)[_0xf65c('0x10')](_0x35d923);}return null;};}function saveUpdates(_0x28c814){return function(_0x1987db){if(_0x1987db){return _0x1987db[_0xf65c('0x11')](_0x28c814)[_0xf65c('0x12')](function(_0x3c311f){return _0x3c311f;});}return null;};}function removeEntity(_0x31041e){return function(_0x4a978a){if(_0x4a978a){return _0x4a978a[_0xf65c('0x13')]()[_0xf65c('0x12')](function(){var _0x492015=_0x4a978a['get']({'plain':!![]});var _0x3fc515='SquareProjects';return db['UserProfileResource']['destroy']({'where':{'type':_0x3fc515,'resourceId':_0x492015['id']}})[_0xf65c('0x12')](function(){return _0x4a978a;});})[_0xf65c('0x12')](function(){var _0x2794f7=new Redis(config['redis']);_0x2794f7['publish']('agi',JSON[_0xf65c('0x14')]({'id':_0x4a978a['id'],'deleted':!![]}));})[_0xf65c('0x12')](function(){_0x31041e['status'](0xcc)[_0xf65c('0x15')]();});}};}function handleEntityNotFound(_0x258444){return function(_0x48e78a){if(!_0x48e78a){_0x258444['sendStatus'](0x194);}return _0x48e78a;};}function handleError(_0x530966,_0x4a42a1){_0x4a42a1=_0x4a42a1||0x1f4;return function(_0x2ec1ee){logger[_0xf65c('0x16')](_0x2ec1ee['stack']);if(_0x2ec1ee[_0xf65c('0x17')]){delete _0x2ec1ee[_0xf65c('0x17')];}_0x530966['status'](_0x4a42a1)['send'](_0x2ec1ee);};}exports[_0xf65c('0x18')]=function(_0x307abc,_0x156ee9){var _0x3d7892={},_0x17c11d={},_0x2178e9={'count':0x0,'rows':[]};var _0x57eadd=_[_0xf65c('0x19')](db[_0xf65c('0x1a')][_0xf65c('0x1b')],function(_0x598077){return{'name':_0x598077[_0xf65c('0x1c')],'type':_0x598077[_0xf65c('0x1d')]['key']};});_0x17c11d[_0xf65c('0x1e')]=_[_0xf65c('0x19')](_0x57eadd,'name');_0x17c11d[_0xf65c('0x1f')]=_[_0xf65c('0x20')](_0x307abc['query']);_0x17c11d[_0xf65c('0x21')]=_[_0xf65c('0x22')](_0x17c11d[_0xf65c('0x1e')],_0x17c11d[_0xf65c('0x1f')]);_0x3d7892[_0xf65c('0x23')]=_['intersection'](_0x17c11d['model'],qs[_0xf65c('0x24')](_0x307abc[_0xf65c('0x1f')][_0xf65c('0x24')]));_0x3d7892[_0xf65c('0x23')]=_0x3d7892[_0xf65c('0x23')][_0xf65c('0x25')]?_0x3d7892[_0xf65c('0x23')]:_0x17c11d[_0xf65c('0x1e')];if(!_0x307abc[_0xf65c('0x1f')]['hasOwnProperty']('nolimit')){_0x3d7892['limit']=qs[_0xf65c('0xb')](_0x307abc[_0xf65c('0x1f')][_0xf65c('0xb')]);_0x3d7892[_0xf65c('0xd')]=qs['offset'](_0x307abc[_0xf65c('0x1f')][_0xf65c('0xd')]);}_0x3d7892[_0xf65c('0x26')]=qs[_0xf65c('0x27')](_0x307abc['query'][_0xf65c('0x27')]);_0x3d7892[_0xf65c('0x28')]=qs[_0xf65c('0x21')](_[_0xf65c('0x29')](_0x307abc['query'],_0x17c11d[_0xf65c('0x21')]),_0x57eadd);if(_0x307abc[_0xf65c('0x1f')][_0xf65c('0x2a')]){_0x3d7892[_0xf65c('0x28')]=_[_0xf65c('0x2b')](_0x3d7892[_0xf65c('0x28')],{'$or':_[_0xf65c('0x19')](_0x57eadd,function(_0x2f0bdd){if(_0x2f0bdd['type']!==_0xf65c('0x2c')){var _0x3f7b0c={};_0x3f7b0c[_0x2f0bdd['name']]={'$like':'%'+_0x307abc['query'][_0xf65c('0x2a')]+'%'};return _0x3f7b0c;}})});}_0x3d7892=_[_0xf65c('0x2b')]({},_0x3d7892,_0x307abc[_0xf65c('0x2d')]);var _0x4389c6={'where':_0x3d7892[_0xf65c('0x28')]};return db[_0xf65c('0x1a')][_0xf65c('0xc')](_0x4389c6)[_0xf65c('0x12')](function(_0x736198){_0x2178e9[_0xf65c('0xc')]=_0x736198;if(_0x307abc[_0xf65c('0x1f')][_0xf65c('0x2e')]){_0x3d7892['include']=[{'all':!![]}];}return db[_0xf65c('0x1a')][_0xf65c('0x2f')](_0x3d7892);})[_0xf65c('0x12')](function(_0x58aac9){_0x2178e9[_0xf65c('0x30')]=_0x58aac9;return _0x2178e9;})[_0xf65c('0x12')](respondWithFilteredResult(_0x156ee9,_0x3d7892))[_0xf65c('0x31')](handleError(_0x156ee9,null));};exports['show']=function(_0x18f659,_0x2af4cc){var _0x224f64={'raw':![],'where':{'id':_0x18f659[_0xf65c('0x32')]['id']}},_0x3a77a6={};_0x3a77a6[_0xf65c('0x1e')]=_[_0xf65c('0x20')](db[_0xf65c('0x1a')][_0xf65c('0x1b')]);_0x3a77a6[_0xf65c('0x1f')]=_[_0xf65c('0x20')](_0x18f659['query']);_0x3a77a6['filters']=_[_0xf65c('0x22')](_0x3a77a6[_0xf65c('0x1e')],_0x3a77a6[_0xf65c('0x1f')]);_0x224f64[_0xf65c('0x23')]=_[_0xf65c('0x22')](_0x3a77a6[_0xf65c('0x1e')],qs['fields'](_0x18f659[_0xf65c('0x1f')][_0xf65c('0x24')]));_0x224f64[_0xf65c('0x23')]=_0x224f64['attributes'][_0xf65c('0x25')]?_0x224f64[_0xf65c('0x23')]:_0x3a77a6[_0xf65c('0x1e')];if(_0x18f659[_0xf65c('0x1f')][_0xf65c('0x2e')]){_0x224f64[_0xf65c('0x33')]=[{'all':!![]}];}_0x224f64=_['merge']({},_0x224f64,_0x18f659[_0xf65c('0x2d')]);return db[_0xf65c('0x1a')]['find'](_0x224f64)[_0xf65c('0x12')](handleEntityNotFound(_0x2af4cc,null))['then'](respondWithResult(_0x2af4cc,null))[_0xf65c('0x31')](handleError(_0x2af4cc,null));};exports[_0xf65c('0x34')]=function(_0x358c2f,_0xa27579){return db[_0xf65c('0x1a')][_0xf65c('0x34')](_0x358c2f[_0xf65c('0x35')],{})[_0xf65c('0x12')](function(_0x4b9d88){var _0x44b86c=_0x358c2f[_0xf65c('0x36')][_0xf65c('0x37')]({'plain':!![]});if(!_0x44b86c)throw new Error(_0xf65c('0x38'));if(_0x44b86c[_0xf65c('0x39')]===_0xf65c('0x36')){var _0x23a4b7=_0x4b9d88[_0xf65c('0x37')]({'plain':!![]});var _0x4c126c=_0xf65c('0x3a');return db['UserProfileSection'][_0xf65c('0x3b')]({'where':{'name':_0x4c126c,'userProfileId':_0x44b86c['userProfileId']},'raw':!![]})[_0xf65c('0x12')](function(_0x2aa405){if(_0x2aa405&&_0x2aa405[_0xf65c('0x3c')]===0x0){return db[_0xf65c('0x3d')]['create']({'name':_0x23a4b7['name'],'resourceId':_0x23a4b7['id'],'type':_0x2aa405['name'],'sectionId':_0x2aa405['id']},{})[_0xf65c('0x12')](function(){return _0x4b9d88;});}else{return _0x4b9d88;}})[_0xf65c('0x31')](function(_0x244eab){logger[_0xf65c('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x244eab);throw _0x244eab;});}return _0x4b9d88;})['then'](respondWithResult(_0xa27579,0xc9))['catch'](handleError(_0xa27579,null));};exports[_0xf65c('0x11')]=function(_0x5d4477,_0x40a204){if(_0x5d4477['body']['id']){delete _0x5d4477['body']['id'];}return db[_0xf65c('0x1a')][_0xf65c('0x3b')]({'where':{'id':_0x5d4477['params']['id']}})['then'](handleEntityNotFound(_0x40a204,null))[_0xf65c('0x12')](saveUpdates(_0x5d4477['body'],null))[_0xf65c('0x12')](function(_0x2b8073){if(!_0x2b8073)return;var _0x41d614=_0x2b8073['get']({'plain':!![]});return _0x41d614;})[_0xf65c('0x12')](function(_0x291e44){var _0x4993ae=new Redis(config[_0xf65c('0x5')]);_0x4993ae[_0xf65c('0x3e')](_0xf65c('0x3f'),JSON['stringify'](_[_0xf65c('0x29')](_0x291e44,['id',_0xf65c('0x17'),_0xf65c('0x40')])));return _0x291e44;})['then'](respondWithResult(_0x40a204,null))[_0xf65c('0x31')](handleError(_0x40a204,null));};exports[_0xf65c('0x13')]=function(_0xced29c,_0x2f79b5){return db[_0xf65c('0x1a')]['find']({'where':{'id':_0xced29c[_0xf65c('0x32')]['id']}})[_0xf65c('0x12')](handleEntityNotFound(_0x2f79b5,null))[_0xf65c('0x12')](removeEntity(_0x2f79b5,null))[_0xf65c('0x31')](handleError(_0x2f79b5,null));}; \ No newline at end of file +var _0xa58e=['production','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','then','destroy','get','SquareProjects','publish','agi','stringify','stack','name','index','map','fieldName','type','key','query','model','attributes','intersection','fields','hasOwnProperty','order','filters','pick','filter','where','VIRTUAL','options','includeAll','SquareProject','findAll','rows','catch','show','params','keys','rawAttributes','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x268302,_0x1e181e){var _0x368175=function(_0x4e97a1){while(--_0x4e97a1){_0x268302['push'](_0x268302['shift']());}};_0x368175(++_0x1e181e);}(_0xa58e,0xcd));var _0xea58=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xa58e[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xea58('0x0'));var logger=require(_0xea58('0x1'))(_0xea58('0x2'));var config=require(_0xea58('0x3'));var db=require(_0xea58('0x4'))['db'];config[_0xea58('0x5')]=_[_0xea58('0x6')](config[_0xea58('0x5')],{'host':_0xea58('0x7'),'port':0x18eb});var socket=require(_0xea58('0x8'))(new Redis(config[_0xea58('0x5')]));require(_0xea58('0x9'))[_0xea58('0xa')](socket);function respondWithResult(_0x3e08af,_0x7239cf){_0x7239cf=_0x7239cf||0xc8;return function(_0x5843a1){if(_0x5843a1){return _0x3e08af[_0xea58('0xb')](_0x7239cf)[_0xea58('0xc')](_0x5843a1);}};}function respondWithFilteredResult(_0x474dba,_0xe3048e){return function(_0x58bea9){if(_0x58bea9){var _0x1a323f=typeof _0xe3048e[_0xea58('0xd')]===_0xea58('0xe')&&typeof _0xe3048e[_0xea58('0xf')]===_0xea58('0xe');var _0x42f5c0=_0x58bea9[_0xea58('0x10')];var _0x33e204=_0x1a323f?0x0:_0xe3048e[_0xea58('0xd')];var _0x5ded77=_0x1a323f?_0x58bea9[_0xea58('0x10')]:_0xe3048e[_0xea58('0xd')]+_0xe3048e[_0xea58('0xf')];var _0x465dfc;if(_0x5ded77>=_0x42f5c0){_0x5ded77=_0x42f5c0;_0x465dfc=0xc8;}else{_0x465dfc=0xce;}_0x474dba[_0xea58('0xb')](_0x465dfc);return _0x474dba['set']('Content-Range',_0x33e204+'-'+_0x5ded77+'/'+_0x42f5c0)[_0xea58('0xc')](_0x58bea9);}return null;};}function saveUpdates(_0xfd28c0){return function(_0x36b01c){if(_0x36b01c){return _0x36b01c['update'](_0xfd28c0)[_0xea58('0x11')](function(_0x2b47e5){return _0x2b47e5;});}return null;};}function removeEntity(_0x1da5bd){return function(_0x290675){if(_0x290675){return _0x290675[_0xea58('0x12')]()[_0xea58('0x11')](function(){var _0x289df6=_0x290675[_0xea58('0x13')]({'plain':!![]});var _0x49527b=_0xea58('0x14');return db['UserProfileResource'][_0xea58('0x12')]({'where':{'type':_0x49527b,'resourceId':_0x289df6['id']}})[_0xea58('0x11')](function(){return _0x290675;});})[_0xea58('0x11')](function(){var _0x3dfbf9=new Redis(config['redis']);_0x3dfbf9[_0xea58('0x15')](_0xea58('0x16'),JSON[_0xea58('0x17')]({'id':_0x290675['id'],'deleted':!![]}));})[_0xea58('0x11')](function(){_0x1da5bd[_0xea58('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x222db7){return function(_0x203e87){if(!_0x203e87){_0x222db7['sendStatus'](0x194);}return _0x203e87;};}function handleError(_0x405357,_0x29ac40){_0x29ac40=_0x29ac40||0x1f4;return function(_0x439215){logger['error'](_0x439215[_0xea58('0x18')]);if(_0x439215[_0xea58('0x19')]){delete _0x439215[_0xea58('0x19')];}_0x405357['status'](_0x29ac40)['send'](_0x439215);};}exports[_0xea58('0x1a')]=function(_0x31d65b,_0x2728e0){var _0x3b0e8e={},_0x3b9549={},_0x4fe4f2={'count':0x0,'rows':[]};var _0x251bd3=_[_0xea58('0x1b')](db['SquareProject']['rawAttributes'],function(_0x3c3bdd){return{'name':_0x3c3bdd[_0xea58('0x1c')],'type':_0x3c3bdd[_0xea58('0x1d')][_0xea58('0x1e')]};});_0x3b9549['model']=_[_0xea58('0x1b')](_0x251bd3,_0xea58('0x19'));_0x3b9549[_0xea58('0x1f')]=_['keys'](_0x31d65b[_0xea58('0x1f')]);_0x3b9549['filters']=_['intersection'](_0x3b9549[_0xea58('0x20')],_0x3b9549[_0xea58('0x1f')]);_0x3b0e8e[_0xea58('0x21')]=_[_0xea58('0x22')](_0x3b9549[_0xea58('0x20')],qs[_0xea58('0x23')](_0x31d65b['query'][_0xea58('0x23')]));_0x3b0e8e[_0xea58('0x21')]=_0x3b0e8e[_0xea58('0x21')]['length']?_0x3b0e8e[_0xea58('0x21')]:_0x3b9549[_0xea58('0x20')];if(!_0x31d65b[_0xea58('0x1f')][_0xea58('0x24')]('nolimit')){_0x3b0e8e['limit']=qs[_0xea58('0xf')](_0x31d65b['query'][_0xea58('0xf')]);_0x3b0e8e[_0xea58('0xd')]=qs['offset'](_0x31d65b[_0xea58('0x1f')]['offset']);}_0x3b0e8e[_0xea58('0x25')]=qs['sort'](_0x31d65b[_0xea58('0x1f')]['sort']);_0x3b0e8e['where']=qs[_0xea58('0x26')](_[_0xea58('0x27')](_0x31d65b[_0xea58('0x1f')],_0x3b9549[_0xea58('0x26')]),_0x251bd3);if(_0x31d65b[_0xea58('0x1f')][_0xea58('0x28')]){_0x3b0e8e[_0xea58('0x29')]=_['merge'](_0x3b0e8e[_0xea58('0x29')],{'$or':_['map'](_0x251bd3,function(_0x541ad8){if(_0x541ad8['type']!==_0xea58('0x2a')){var _0x26e146={};_0x26e146[_0x541ad8['name']]={'$like':'%'+_0x31d65b[_0xea58('0x1f')][_0xea58('0x28')]+'%'};return _0x26e146;}})});}_0x3b0e8e=_['merge']({},_0x3b0e8e,_0x31d65b[_0xea58('0x2b')]);var _0x5d49a5={'where':_0x3b0e8e[_0xea58('0x29')]};return db['SquareProject'][_0xea58('0x10')](_0x5d49a5)[_0xea58('0x11')](function(_0x1942fe){_0x4fe4f2[_0xea58('0x10')]=_0x1942fe;if(_0x31d65b[_0xea58('0x1f')][_0xea58('0x2c')]){_0x3b0e8e['include']=[{'all':!![]}];}return db[_0xea58('0x2d')][_0xea58('0x2e')](_0x3b0e8e);})[_0xea58('0x11')](function(_0x535593){_0x4fe4f2[_0xea58('0x2f')]=_0x535593;return _0x4fe4f2;})[_0xea58('0x11')](respondWithFilteredResult(_0x2728e0,_0x3b0e8e))[_0xea58('0x30')](handleError(_0x2728e0,null));};exports[_0xea58('0x31')]=function(_0x37d3a4,_0x28c365){var _0xbcf26b={'raw':![],'where':{'id':_0x37d3a4[_0xea58('0x32')]['id']}},_0x30463c={};_0x30463c['model']=_[_0xea58('0x33')](db[_0xea58('0x2d')][_0xea58('0x34')]);_0x30463c[_0xea58('0x1f')]=_['keys'](_0x37d3a4[_0xea58('0x1f')]);_0x30463c[_0xea58('0x26')]=_[_0xea58('0x22')](_0x30463c[_0xea58('0x20')],_0x30463c[_0xea58('0x1f')]);_0xbcf26b[_0xea58('0x21')]=_[_0xea58('0x22')](_0x30463c[_0xea58('0x20')],qs[_0xea58('0x23')](_0x37d3a4[_0xea58('0x1f')][_0xea58('0x23')]));_0xbcf26b[_0xea58('0x21')]=_0xbcf26b[_0xea58('0x21')][_0xea58('0x35')]?_0xbcf26b['attributes']:_0x30463c[_0xea58('0x20')];if(_0x37d3a4['query'][_0xea58('0x2c')]){_0xbcf26b[_0xea58('0x36')]=[{'all':!![]}];}_0xbcf26b=_['merge']({},_0xbcf26b,_0x37d3a4[_0xea58('0x2b')]);return db[_0xea58('0x2d')][_0xea58('0x37')](_0xbcf26b)[_0xea58('0x11')](handleEntityNotFound(_0x28c365,null))[_0xea58('0x11')](respondWithResult(_0x28c365,null))[_0xea58('0x30')](handleError(_0x28c365,null));};exports['create']=function(_0x3ea19e,_0x3fda6e){return db[_0xea58('0x2d')][_0xea58('0x38')](_0x3ea19e[_0xea58('0x39')],{})['then'](function(_0x4cc1ef){var _0x597c42=_0x3ea19e['user'][_0xea58('0x13')]({'plain':!![]});if(!_0x597c42)throw new Error(_0xea58('0x3a'));if(_0x597c42[_0xea58('0x3b')]===_0xea58('0x3c')){var _0x4ba7ca=_0x4cc1ef['get']({'plain':!![]});var _0x1aefb3=_0xea58('0x14');return db['UserProfileSection'][_0xea58('0x37')]({'where':{'name':_0x1aefb3,'userProfileId':_0x597c42[_0xea58('0x3d')]},'raw':!![]})['then'](function(_0x41e85b){if(_0x41e85b&&_0x41e85b[_0xea58('0x3e')]===0x0){return db[_0xea58('0x3f')][_0xea58('0x38')]({'name':_0x4ba7ca[_0xea58('0x19')],'resourceId':_0x4ba7ca['id'],'type':_0x41e85b[_0xea58('0x19')],'sectionId':_0x41e85b['id']},{})[_0xea58('0x11')](function(){return _0x4cc1ef;});}else{return _0x4cc1ef;}})[_0xea58('0x30')](function(_0x12c842){logger[_0xea58('0x40')](_0xea58('0x41'),_0x12c842);throw _0x12c842;});}return _0x4cc1ef;})[_0xea58('0x11')](respondWithResult(_0x3fda6e,0xc9))[_0xea58('0x30')](handleError(_0x3fda6e,null));};exports[_0xea58('0x42')]=function(_0x44468d,_0x447b0e){if(_0x44468d[_0xea58('0x39')]['id']){delete _0x44468d[_0xea58('0x39')]['id'];}return db[_0xea58('0x2d')]['find']({'where':{'id':_0x44468d[_0xea58('0x32')]['id']}})[_0xea58('0x11')](handleEntityNotFound(_0x447b0e,null))['then'](saveUpdates(_0x44468d[_0xea58('0x39')],null))['then'](function(_0x1abe93){if(!_0x1abe93)return;var _0x4db0cf=_0x1abe93[_0xea58('0x13')]({'plain':!![]});return _0x4db0cf;})[_0xea58('0x11')](function(_0x5dd565){var _0x569615=new Redis(config[_0xea58('0x5')]);_0x569615['publish']('agi',JSON['stringify'](_[_0xea58('0x27')](_0x5dd565,['id',_0xea58('0x19'),_0xea58('0x43')])));return _0x5dd565;})['then'](respondWithResult(_0x447b0e,null))[_0xea58('0x30')](handleError(_0x447b0e,null));};exports[_0xea58('0x12')]=function(_0x11a0e9,_0x454d42){return db['SquareProject'][_0xea58('0x37')]({'where':{'id':_0x11a0e9['params']['id']}})[_0xea58('0x11')](handleEntityNotFound(_0x454d42,null))[_0xea58('0x11')](removeEntity(_0x454d42,null))[_0xea58('0x30')](handleError(_0x454d42,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index f345b42..544eb51 100644 --- a/server/api/squareProject/squareProject.events.js +++ b/server/api/squareProject/squareProject.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3171=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','remove'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x3171,0x7c));var _0x1317=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x3171[_0x1ccbcc];return _0x1e873f;};'use strict';var EventEmitter=require(_0x1317('0x0'));var SquareProject=require(_0x1317('0x1'))['db'][_0x1317('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1317('0x3')](0x0);var events={'afterCreate':_0x1317('0x4'),'afterUpdate':'update','afterDestroy':_0x1317('0x5')};function emitEvent(_0x2bb9a4){return function(_0x1b68ae,_0x11e932,_0x2f7d9d){SquareProjectEvents[_0x1317('0x6')](_0x2bb9a4+':'+_0x1b68ae['id'],_0x1b68ae);SquareProjectEvents[_0x1317('0x6')](_0x2bb9a4,_0x1b68ae);_0x2f7d9d(null);};}for(var e in events){if(events[_0x1317('0x7')](e)){var event=events[e];SquareProject[_0x1317('0x8')](e,emitEvent(event));}}module[_0x1317('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x20a1=['SquareProject','update','remove','emit','exports','events','../../mysqldb'];(function(_0x54a138,_0x22b82d){var _0x9c361a=function(_0x193bea){while(--_0x193bea){_0x54a138['push'](_0x54a138['shift']());}};_0x9c361a(++_0x22b82d);}(_0x20a1,0x91));var _0x120a=function(_0x5c0b29,_0x141464){_0x5c0b29=_0x5c0b29-0x0;var _0x171f16=_0x20a1[_0x5c0b29];return _0x171f16;};'use strict';var EventEmitter=require(_0x120a('0x0'));var SquareProject=require(_0x120a('0x1'))['db'][_0x120a('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x120a('0x3'),'afterDestroy':_0x120a('0x4')};function emitEvent(_0x926aa8){return function(_0x3dd005,_0x294a0b,_0x6b3564){SquareProjectEvents[_0x120a('0x5')](_0x926aa8+':'+_0x3dd005['id'],_0x3dd005);SquareProjectEvents[_0x120a('0x5')](_0x926aa8,_0x3dd005);_0x6b3564(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x120a('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 4d9e3c4..2baee64 100644 --- a/server/api/squareProject/squareProject.model.js +++ b/server/api/squareProject/squareProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f38=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x2f38,0x1b0));var _0x82f3=function(_0x34ca54,_0x251d16){_0x34ca54=_0x34ca54-0x0;var _0x153a5e=_0x2f38[_0x34ca54];return _0x153a5e;};'use strict';var _=require(_0x82f3('0x0'));var util=require(_0x82f3('0x1'));var logger=require(_0x82f3('0x2'))(_0x82f3('0x3'));var moment=require('moment');var BPromise=require(_0x82f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82f3('0x5'));var rimraf=require(_0x82f3('0x6'));var config=require(_0x82f3('0x7'));var attributes=require(_0x82f3('0x8'));module['exports']=function(_0x4bac95,_0x22e982){return _0x4bac95[_0x82f3('0x9')]('SquareProject',attributes,{'tableName':_0x82f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe4f58d,_0x56e7ca,_0x336a6e){if(_0xe4f58d[_0x82f3('0xb')](_0x82f3('0xc'))){_0xe4f58d[_0x82f3('0xd')]=moment()[_0x82f3('0xe')](_0x82f3('0xf'));}if(_0xe4f58d[_0x82f3('0xb')](_0x82f3('0x10'))){_0xe4f58d[_0x82f3('0x11')]=moment()[_0x82f3('0xe')](_0x82f3('0xf'));}_0x336a6e(null,_0xe4f58d);}}});}; \ No newline at end of file +var _0xf023=['moment','bluebird','request-promise','path','rimraf','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf023,0xb9));var _0x3f02=function(_0x15ff22,_0x335a4d){_0x15ff22=_0x15ff22-0x0;var _0x521190=_0xf023[_0x15ff22];return _0x521190;};'use strict';var _=require(_0x3f02('0x0'));var util=require('util');var logger=require(_0x3f02('0x1'))('api');var moment=require(_0x3f02('0x2'));var BPromise=require(_0x3f02('0x3'));var rp=require(_0x3f02('0x4'));var fs=require('fs');var path=require(_0x3f02('0x5'));var rimraf=require(_0x3f02('0x6'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0x3f02('0x7')]=function(_0x36f3fb,_0x31fe3d){return _0x36f3fb[_0x3f02('0x8')](_0x3f02('0x9'),attributes,{'tableName':_0x3f02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x498de2,_0x1b736e,_0x3cc034){if(_0x498de2[_0x3f02('0xb')](_0x3f02('0xc'))){_0x498de2[_0x3f02('0xd')]=moment()[_0x3f02('0xe')](_0x3f02('0xf'));}if(_0x498de2[_0x3f02('0xb')]('production')){_0x498de2[_0x3f02('0x10')]=moment()['format'](_0x3f02('0xf'));}_0x3cc034(null,_0x498de2);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 81027c2..d9e16bf 100644 --- a/server/api/squareProject/squareProject.rpc.js +++ b/server/api/squareProject/squareProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8240=['../../config/logger','rpc','defaults','localhost','socket.io-emitter','redis','register','SquareProject','findAll','options','raw','where','attributes','limit','include','model','map','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','then','../../mysqldb'];(function(_0x36a39c,_0x5c9dea){var _0x7ff16=function(_0x3d3b7d){while(--_0x3d3b7d){_0x36a39c['push'](_0x36a39c['shift']());}};_0x7ff16(++_0x5c9dea);}(_0x8240,0x11d));var _0x0824=function(_0x2de0ab,_0x353746){_0x2de0ab=_0x2de0ab-0x0;var _0x7f8af9=_0x8240[_0x2de0ab];return _0x7f8af9;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x0824('0x0'))['db'];var logger=require(_0x0824('0x1'))(_0x0824('0x2'));var config=require('../../config/environment');config['redis']=_[_0x0824('0x3')](config['redis'],{'host':_0x0824('0x4'),'port':0x18eb});var socket=require(_0x0824('0x5'))(new Redis(config[_0x0824('0x6')]));require('./squareProject.socket')[_0x0824('0x7')](socket);exports['GetSquareProjects']=function(_0x5c9fcd){var _0x47318e=this;return new Promise(function(_0x12f29e,_0x2defa5){return db[_0x0824('0x8')][_0x0824('0x9')]({'raw':_0x5c9fcd[_0x0824('0xa')]?_0x5c9fcd[_0x0824('0xa')][_0x0824('0xb')]===undefined?!![]:![]:!![],'where':_0x5c9fcd['options']?_0x5c9fcd['options'][_0x0824('0xc')]||null:null,'attributes':_0x5c9fcd['options']?_0x5c9fcd[_0x0824('0xa')][_0x0824('0xd')]||null:null,'limit':_0x5c9fcd[_0x0824('0xa')]?_0x5c9fcd[_0x0824('0xa')][_0x0824('0xe')]||null:null,'include':_0x5c9fcd['options']?_0x5c9fcd[_0x0824('0xa')]['include']?_['map'](_0x5c9fcd[_0x0824('0xa')][_0x0824('0xf')],function(_0x25619c){return{'model':db[_0x25619c[_0x0824('0x10')]],'as':_0x25619c['as'],'attributes':_0x25619c[_0x0824('0xd')],'include':_0x25619c[_0x0824('0xf')]?_[_0x0824('0x11')](_0x25619c['include'],function(_0x3c95ac){return{'model':db[_0x3c95ac['model']],'as':_0x3c95ac['as'],'attributes':_0x3c95ac[_0x0824('0xd')],'include':_0x3c95ac[_0x0824('0xf')]?_[_0x0824('0x11')](_0x3c95ac['include'],function(_0x4f860a){return{'model':db[_0x4f860a[_0x0824('0x10')]],'as':_0x4f860a['as'],'attributes':_0x4f860a[_0x0824('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ff95b){logger['info'](_0x0824('0x12'),_0x5c9fcd);logger[_0x0824('0x13')]('GetSquareProjects',_0x5c9fcd,JSON[_0x0824('0x14')](_0x4ff95b));_0x12f29e(_0x4ff95b);})[_0x0824('0x15')](function(_0x3a403f){logger[_0x0824('0x16')](_0x0824('0x12'),_0x3a403f[_0x0824('0x17')],_0x5c9fcd);_0x2defa5(_0x47318e['error'](0x1f4,_0x3a403f[_0x0824('0x17')]));});});};exports[_0x0824('0x18')]=function(_0x3de2f1){var _0x1140e5=this;return new Promise(function(_0x19e350,_0xc991f1){return db[_0x0824('0x8')]['find']({'raw':_0x3de2f1[_0x0824('0xa')]?_0x3de2f1['options'][_0x0824('0xb')]===undefined?!![]:![]:!![],'where':_0x3de2f1[_0x0824('0xa')]?_0x3de2f1[_0x0824('0xa')][_0x0824('0xc')]||null:null,'attributes':_0x3de2f1[_0x0824('0xa')]?_0x3de2f1[_0x0824('0xa')][_0x0824('0xd')]||null:null,'include':_0x3de2f1['options']?_0x3de2f1[_0x0824('0xa')]['include']?_[_0x0824('0x11')](_0x3de2f1['options'][_0x0824('0xf')],function(_0x5998b1){return{'model':db[_0x5998b1['model']],'as':_0x5998b1['as'],'attributes':_0x5998b1[_0x0824('0xd')],'include':_0x5998b1['include']?_['map'](_0x5998b1['include'],function(_0x2bdc37){return{'model':db[_0x2bdc37[_0x0824('0x10')]],'as':_0x2bdc37['as'],'attributes':_0x2bdc37['attributes'],'include':_0x2bdc37['include']?_[_0x0824('0x11')](_0x2bdc37[_0x0824('0xf')],function(_0x406a71){return{'model':db[_0x406a71[_0x0824('0x10')]],'as':_0x406a71['as'],'attributes':_0x406a71[_0x0824('0xd')]};}):[]};}):[]};}):[]:[]})[_0x0824('0x19')](function(_0x474341){logger['info'](_0x0824('0x18'),_0x3de2f1);logger[_0x0824('0x13')](_0x0824('0x18'),_0x3de2f1,JSON[_0x0824('0x14')](_0x474341));_0x19e350(_0x474341);})[_0x0824('0x15')](function(_0x400e3a){logger[_0x0824('0x16')]('ShowSquareProject',_0x400e3a[_0x0824('0x17')],_0x3de2f1);_0xc991f1(_0x1140e5[_0x0824('0x16')](0x1f4,_0x400e3a[_0x0824('0x17')]));});});}; \ No newline at end of file +var _0xded1=['then','lodash','ioredis','../../mysqldb','rpc','../../config/environment','redis','defaults','localhost','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','limit','include','model','map','info','debug','stringify','catch','error','message','ShowSquareProject','find','raw'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xded1,0x75));var _0x1ded=function(_0x20def7,_0x2caec4){_0x20def7=_0x20def7-0x0;var _0xdc6a3e=_0xded1[_0x20def7];return _0xdc6a3e;};'use strict';var _=require(_0x1ded('0x0'));var Redis=require(_0x1ded('0x1'));var db=require(_0x1ded('0x2'))['db'];var logger=require('../../config/logger')(_0x1ded('0x3'));var config=require(_0x1ded('0x4'));config[_0x1ded('0x5')]=_[_0x1ded('0x6')](config['redis'],{'host':_0x1ded('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')[_0x1ded('0x8')](socket);exports[_0x1ded('0x9')]=function(_0x475498){var _0x497b16=this;return new Promise(function(_0x560c36,_0x3a3ea8){return db[_0x1ded('0xa')][_0x1ded('0xb')]({'raw':_0x475498[_0x1ded('0xc')]?_0x475498['options']['raw']===undefined?!![]:![]:!![],'where':_0x475498['options']?_0x475498['options'][_0x1ded('0xd')]||null:null,'attributes':_0x475498[_0x1ded('0xc')]?_0x475498[_0x1ded('0xc')][_0x1ded('0xe')]||null:null,'limit':_0x475498['options']?_0x475498[_0x1ded('0xc')][_0x1ded('0xf')]||null:null,'include':_0x475498['options']?_0x475498[_0x1ded('0xc')][_0x1ded('0x10')]?_['map'](_0x475498[_0x1ded('0xc')]['include'],function(_0xda1b65){return{'model':db[_0xda1b65[_0x1ded('0x11')]],'as':_0xda1b65['as'],'attributes':_0xda1b65['attributes'],'include':_0xda1b65['include']?_[_0x1ded('0x12')](_0xda1b65[_0x1ded('0x10')],function(_0x1aac5a){return{'model':db[_0x1aac5a[_0x1ded('0x11')]],'as':_0x1aac5a['as'],'attributes':_0x1aac5a['attributes'],'include':_0x1aac5a[_0x1ded('0x10')]?_[_0x1ded('0x12')](_0x1aac5a[_0x1ded('0x10')],function(_0x3b1558){return{'model':db[_0x3b1558[_0x1ded('0x11')]],'as':_0x3b1558['as'],'attributes':_0x3b1558[_0x1ded('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x371699){logger[_0x1ded('0x13')](_0x1ded('0x9'),_0x475498);logger[_0x1ded('0x14')](_0x1ded('0x9'),_0x475498,JSON[_0x1ded('0x15')](_0x371699));_0x560c36(_0x371699);})[_0x1ded('0x16')](function(_0x3acb65){logger['error'](_0x1ded('0x9'),_0x3acb65['message'],_0x475498);_0x3a3ea8(_0x497b16[_0x1ded('0x17')](0x1f4,_0x3acb65[_0x1ded('0x18')]));});});};exports[_0x1ded('0x19')]=function(_0x5e1a42){var _0xba6b25=this;return new Promise(function(_0x2d13fa,_0x4cf505){return db['SquareProject'][_0x1ded('0x1a')]({'raw':_0x5e1a42[_0x1ded('0xc')]?_0x5e1a42[_0x1ded('0xc')][_0x1ded('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e1a42[_0x1ded('0xc')]?_0x5e1a42[_0x1ded('0xc')]['where']||null:null,'attributes':_0x5e1a42[_0x1ded('0xc')]?_0x5e1a42[_0x1ded('0xc')]['attributes']||null:null,'include':_0x5e1a42[_0x1ded('0xc')]?_0x5e1a42[_0x1ded('0xc')][_0x1ded('0x10')]?_[_0x1ded('0x12')](_0x5e1a42['options'][_0x1ded('0x10')],function(_0x439ec7){return{'model':db[_0x439ec7['model']],'as':_0x439ec7['as'],'attributes':_0x439ec7[_0x1ded('0xe')],'include':_0x439ec7[_0x1ded('0x10')]?_['map'](_0x439ec7[_0x1ded('0x10')],function(_0x15ab26){return{'model':db[_0x15ab26['model']],'as':_0x15ab26['as'],'attributes':_0x15ab26[_0x1ded('0xe')],'include':_0x15ab26[_0x1ded('0x10')]?_[_0x1ded('0x12')](_0x15ab26[_0x1ded('0x10')],function(_0x205e73){return{'model':db[_0x205e73[_0x1ded('0x11')]],'as':_0x205e73['as'],'attributes':_0x205e73['attributes']};}):[]};}):[]};}):[]:[]})[_0x1ded('0x1c')](function(_0x37387c){logger[_0x1ded('0x13')](_0x1ded('0x19'),_0x5e1a42);logger[_0x1ded('0x14')](_0x1ded('0x19'),_0x5e1a42,JSON[_0x1ded('0x15')](_0x37387c));_0x2d13fa(_0x37387c);})['catch'](function(_0x16c61a){logger[_0x1ded('0x17')](_0x1ded('0x19'),_0x16c61a[_0x1ded('0x18')],_0x5e1a42);_0x4cf505(_0xba6b25['error'](0x1f4,_0x16c61a[_0x1ded('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 4e02a3e..d43433b 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d01=['./squareProject.events','save','length','squareProject:'];(function(_0x453cc2,_0x1be9fc){var _0x4a499b=function(_0x22929f){while(--_0x22929f){_0x453cc2['push'](_0x453cc2['shift']());}};_0x4a499b(++_0x1be9fc);}(_0x9d01,0x19c));var _0x19d0=function(_0x11cc3c,_0x3d7dcf){_0x11cc3c=_0x11cc3c-0x0;var _0x4b3627=_0x9d01[_0x11cc3c];return _0x4b3627;};'use strict';var SquareProjectEvents=require(_0x19d0('0x0'));var events=[_0x19d0('0x1'),'remove','update'];function createListener(_0x19da90,_0x3409cc){return function(_0x44730b){_0x3409cc['emit'](_0x19da90,_0x44730b);};}function removeListener(_0x2590c2,_0x4bb126){return function(){SquareProjectEvents['removeListener'](_0x2590c2,_0x4bb126);};}exports['register']=function(_0x21f35b){for(var _0x5ae4f9=0x0,_0x1dfa88=events[_0x19d0('0x2')];_0x5ae4f9<_0x1dfa88;_0x5ae4f9++){var _0x59e199=events[_0x5ae4f9];var _0x9d993f=createListener(_0x19d0('0x3')+_0x59e199,_0x21f35b);SquareProjectEvents['on'](_0x59e199,_0x9d993f);}}; \ No newline at end of file +var _0x5d1b=['removeListener','length','squareProject:','./squareProject.events','save','update','emit'];(function(_0x337d86,_0x12d2d4){var _0x22fd02=function(_0x1834a9){while(--_0x1834a9){_0x337d86['push'](_0x337d86['shift']());}};_0x22fd02(++_0x12d2d4);}(_0x5d1b,0x6c));var _0xb5d1=function(_0x185e6d,_0x4cce46){_0x185e6d=_0x185e6d-0x0;var _0x32f988=_0x5d1b[_0x185e6d];return _0x32f988;};'use strict';var SquareProjectEvents=require(_0xb5d1('0x0'));var events=[_0xb5d1('0x1'),'remove',_0xb5d1('0x2')];function createListener(_0x14cea7,_0x50ef4a){return function(_0xf48b46){_0x50ef4a[_0xb5d1('0x3')](_0x14cea7,_0xf48b46);};}function removeListener(_0x4225cf,_0x1fba59){return function(){SquareProjectEvents[_0xb5d1('0x4')](_0x4225cf,_0x1fba59);};}exports['register']=function(_0x4b5664){for(var _0x5a1aa6=0x0,_0x45f4b5=events[_0xb5d1('0x5')];_0x5a1aa6<_0x45f4b5;_0x5a1aa6++){var _0x6f05f3=events[_0x5a1aa6];var _0x18738d=createListener(_0xb5d1('0x6')+_0x6f05f3,_0x4b5664);SquareProjectEvents['on'](_0x6f05f3,_0x18738d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 06a0bcb..0cd424c 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x52937e,_0x51b2c4){var _0x196172=function(_0x4616ce){while(--_0x4616ce){_0x52937e['push'](_0x52937e['shift']());}};_0x196172(++_0x51b2c4);}(_0x326f,0xd1));var _0xf326=function(_0x58d33e,_0x20eaa9){_0x58d33e=_0x58d33e-0x0;var _0x5569e4=_0x326f[_0x58d33e];return _0x5569e4;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x500730,_0x5d7f22){var _0x4fc42c=function(_0x1fd847){while(--_0x1fd847){_0x500730['push'](_0x500730['shift']());}};_0x4fc42c(++_0x5d7f22);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 5d891fe..42b8805 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81bd=['STRING','VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports'];(function(_0x2414cc,_0x5bd321){var _0x292184=function(_0x5c0361){while(--_0x5c0361){_0x2414cc['push'](_0x2414cc['shift']());}};_0x292184(++_0x5bd321);}(_0x81bd,0x7c));var _0xd81b=function(_0x3e2789,_0x6d23c6){_0x3e2789=_0x3e2789-0x0;var _0x4371ba=_0x81bd[_0x3e2789];return _0x4371ba;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'uniqueid':{'type':Sequelize[_0xd81b('0x2')]},'callerid':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize[_0xd81b('0x2')]},'context':{'type':Sequelize[_0xd81b('0x2')]},'extension':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd81b('0x2')]},'dnid':{'type':Sequelize[_0xd81b('0x2')]},'projectName':{'type':Sequelize[_0xd81b('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xd81b('0x2')]},'savePath':{'type':Sequelize[_0xd81b('0x2')]},'format':{'type':Sequelize[_0xd81b('0x3')],'get':function(){var _0x562084='';var _0x5e14e8=this[_0xd81b('0x4')]('savePath');if(_0x5e14e8){_0x562084=_0x5e14e8[_0xd81b('0x5')](_0x5e14e8[_0xd81b('0x6')]('.'));}return _0x562084;}}}; \ No newline at end of file +var _0xac31=['STRING','VIRTUAL','savePath','lastIndexOf','sequelize','exports'];(function(_0x1440d9,_0x4a2c7e){var _0x4a0cfb=function(_0x9dc96c){while(--_0x9dc96c){_0x1440d9['push'](_0x1440d9['shift']());}};_0x4a0cfb(++_0x4a2c7e);}(_0xac31,0xca));var _0x1ac3=function(_0x134920,_0x447c4c){_0x134920=_0x134920-0x0;var _0x18baae=_0xac31[_0x134920];return _0x18baae;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x1ac3('0x2')]},'callerid':{'type':Sequelize[_0x1ac3('0x2')]},'calleridname':{'type':Sequelize[_0x1ac3('0x2')]},'context':{'type':Sequelize[_0x1ac3('0x2')]},'extension':{'type':Sequelize[_0x1ac3('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1ac3('0x2')]},'dnid':{'type':Sequelize[_0x1ac3('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x1ac3('0x2')]},'savePath':{'type':Sequelize[_0x1ac3('0x2')]},'format':{'type':Sequelize[_0x1ac3('0x3')],'get':function(){var _0x1be223='';var _0x157604=this['getDataValue'](_0x1ac3('0x4'));if(_0x157604){_0x1be223=_0x157604['substring'](_0x157604[_0x1ac3('0x5')]('.'));}return _0x1be223;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a9e74a7..a91c952 100644 --- a/server/api/squareRecording/squareRecording.controller.js +++ b/server/api/squareRecording/squareRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8617=['filename','unlink','message','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','recording','ValidationError','SquareRecording\x20not\x20found'];(function(_0x468c37,_0x543eec){var _0x2fc8c0=function(_0x28d933){while(--_0x28d933){_0x468c37['push'](_0x468c37['shift']());}};_0x2fc8c0(++_0x543eec);}(_0x8617,0x191));var _0x7861=function(_0x54af33,_0x459b0f){_0x54af33=_0x54af33-0x0;var _0x51943c=_0x8617[_0x54af33];return _0x51943c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7861('0x0'));var zipdir=require(_0x7861('0x1'));var jsonpatch=require(_0x7861('0x2'));var rp=require(_0x7861('0x3'));var moment=require(_0x7861('0x4'));var BPromise=require(_0x7861('0x5'));var Mustache=require(_0x7861('0x6'));var util=require(_0x7861('0x7'));var path=require(_0x7861('0x8'));var sox=require(_0x7861('0x9'));var csv=require(_0x7861('0xa'));var ejs=require(_0x7861('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7861('0xc'));var squel=require(_0x7861('0xd'));var crypto=require(_0x7861('0xe'));var jsforce=require(_0x7861('0xf'));var deskjs=require(_0x7861('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7861('0x11'));var Papa=require(_0x7861('0x12'));var Redis=require(_0x7861('0x13'));var authService=require(_0x7861('0x14'));var qs=require(_0x7861('0x15'));var as=require(_0x7861('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7861('0x17'))(_0x7861('0x18'));var utils=require(_0x7861('0x19'));var config=require(_0x7861('0x1a'));var licenseUtil=require(_0x7861('0x1b'));var db=require(_0x7861('0x1c'))['db'];function respondWithStatusCode(_0x2c534d,_0x4aa9eb){_0x4aa9eb=_0x4aa9eb||0xcc;return function(_0xbe090f){if(_0xbe090f){return _0x2c534d['sendStatus'](_0x4aa9eb);}return _0x2c534d[_0x7861('0x1d')](_0x4aa9eb)[_0x7861('0x1e')]();};}function respondWithResult(_0x1687cd,_0x1fdafd){_0x1fdafd=_0x1fdafd||0xc8;return function(_0x4bb684){if(_0x4bb684){return _0x1687cd[_0x7861('0x1d')](_0x1fdafd)[_0x7861('0x1f')](_0x4bb684);}};}function respondWithFilteredResult(_0x4bab09,_0x4a8e6c){return function(_0x23a07e){if(_0x23a07e){var _0x9815bc=typeof _0x4a8e6c[_0x7861('0x20')]===_0x7861('0x21')&&typeof _0x4a8e6c['limit']==='undefined';var _0x3fe90c=_0x23a07e[_0x7861('0x22')];var _0x902820=_0x9815bc?0x0:_0x4a8e6c['offset'];var _0x5073e2=_0x9815bc?_0x23a07e['count']:_0x4a8e6c[_0x7861('0x20')]+_0x4a8e6c[_0x7861('0x23')];var _0x34a435;if(_0x5073e2>=_0x3fe90c){_0x5073e2=_0x3fe90c;_0x34a435=0xc8;}else{_0x34a435=0xce;}_0x4bab09[_0x7861('0x1d')](_0x34a435);return _0x4bab09[_0x7861('0x24')]('Content-Range',_0x902820+'-'+_0x5073e2+'/'+_0x3fe90c)[_0x7861('0x1f')](_0x23a07e);}return null;};}function patchUpdates(_0xfb08b9){return function(_0x5574db){try{jsonpatch[_0x7861('0x25')](_0x5574db,_0xfb08b9,!![]);}catch(_0x52b07a){return BPromise[_0x7861('0x26')](_0x52b07a);}return _0x5574db[_0x7861('0x27')]();};}function saveUpdates(_0x390773,_0x3917a9){return function(_0x19e470){if(_0x19e470){return _0x19e470[_0x7861('0x28')](_0x390773)[_0x7861('0x29')](function(_0x1b75f3){return _0x1b75f3;});}return null;};}function removeEntity(_0x3e7eeb,_0x3a6eb4){return function(_0x2c7498){if(_0x2c7498){return _0x2c7498[_0x7861('0x2a')]()[_0x7861('0x29')](function(){_0x3e7eeb[_0x7861('0x1d')](0xcc)[_0x7861('0x1e')]();});}};}function handleEntityNotFound(_0x1b2ee6,_0x16f443){return function(_0x290583){if(!_0x290583){_0x1b2ee6['sendStatus'](0x194);}return _0x290583;};}function handleError(_0x3f7ffa,_0x347210){_0x347210=_0x347210||0x1f4;return function(_0x5e9cc8){logger[_0x7861('0x2b')](_0x5e9cc8[_0x7861('0x2c')]);if(_0x5e9cc8[_0x7861('0x2d')]){delete _0x5e9cc8['name'];}_0x3f7ffa[_0x7861('0x1d')](_0x347210)[_0x7861('0x2e')](_0x5e9cc8);};}exports[_0x7861('0x2f')]=function(_0x4f0b3b,_0x49037c){var _0x3ed081={},_0x443152={},_0x388c0b={'count':0x0,'rows':[]};var _0x4b0eb9=_[_0x7861('0x30')](db[_0x7861('0x31')][_0x7861('0x32')],function(_0x26a45b){return{'name':_0x26a45b[_0x7861('0x33')],'type':_0x26a45b[_0x7861('0x34')][_0x7861('0x35')]};});_0x443152[_0x7861('0x36')]=_['map'](_0x4b0eb9,'name');_0x443152[_0x7861('0x37')]=_[_0x7861('0x38')](_0x4f0b3b[_0x7861('0x37')]);_0x443152[_0x7861('0x39')]=_['intersection'](_0x443152[_0x7861('0x36')],_0x443152['query']);_0x3ed081[_0x7861('0x3a')]=_[_0x7861('0x3b')](_0x443152[_0x7861('0x36')],qs['fields'](_0x4f0b3b[_0x7861('0x37')][_0x7861('0x3c')]));_0x3ed081[_0x7861('0x3a')]=_0x3ed081[_0x7861('0x3a')][_0x7861('0x3d')]?_0x3ed081['attributes']:_0x443152['model'];if(!_0x4f0b3b[_0x7861('0x37')][_0x7861('0x3e')](_0x7861('0x3f'))){_0x3ed081['limit']=qs['limit'](_0x4f0b3b[_0x7861('0x37')][_0x7861('0x23')]);_0x3ed081[_0x7861('0x20')]=qs[_0x7861('0x20')](_0x4f0b3b[_0x7861('0x37')][_0x7861('0x20')]);}_0x3ed081[_0x7861('0x40')]=qs[_0x7861('0x41')](_0x4f0b3b[_0x7861('0x37')][_0x7861('0x41')]);_0x3ed081['where']=qs['filters'](_['pick'](_0x4f0b3b[_0x7861('0x37')],_0x443152[_0x7861('0x39')]),_0x4b0eb9);if(_0x4f0b3b[_0x7861('0x37')][_0x7861('0x42')]){_0x3ed081['where']=_[_0x7861('0x43')](_0x3ed081[_0x7861('0x44')],{'$or':_['map'](_0x4b0eb9,function(_0x5e9cf2){if(_0x5e9cf2['type']!==_0x7861('0x45')){var _0x4b8cd9={};_0x4b8cd9[_0x5e9cf2[_0x7861('0x2d')]]={'$like':'%'+_0x4f0b3b[_0x7861('0x37')][_0x7861('0x42')]+'%'};return _0x4b8cd9;}})});}_0x3ed081=_[_0x7861('0x43')]({},_0x3ed081,_0x4f0b3b[_0x7861('0x46')]);var _0x2f353b={'where':_0x3ed081[_0x7861('0x44')]};return db[_0x7861('0x31')][_0x7861('0x22')](_0x2f353b)[_0x7861('0x29')](function(_0x5b0711){_0x388c0b[_0x7861('0x22')]=_0x5b0711;if(_0x4f0b3b[_0x7861('0x37')][_0x7861('0x47')]){_0x3ed081['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x3ed081);})[_0x7861('0x29')](function(_0x4bcdf){_0x388c0b['rows']=_0x4bcdf;return _0x388c0b;})[_0x7861('0x29')](respondWithFilteredResult(_0x49037c,_0x3ed081))[_0x7861('0x48')](handleError(_0x49037c,null));};exports[_0x7861('0x49')]=function(_0x27c4d4,_0x562dbb){var _0x517ef3={'raw':!![],'where':{'id':_0x27c4d4[_0x7861('0x4a')]['id']}},_0x5cc643={};_0x5cc643['model']=_[_0x7861('0x38')](db[_0x7861('0x31')][_0x7861('0x32')]);_0x5cc643[_0x7861('0x37')]=_[_0x7861('0x38')](_0x27c4d4['query']);_0x5cc643[_0x7861('0x39')]=_[_0x7861('0x3b')](_0x5cc643['model'],_0x5cc643[_0x7861('0x37')]);_0x517ef3['attributes']=_['intersection'](_0x5cc643[_0x7861('0x36')],qs[_0x7861('0x3c')](_0x27c4d4[_0x7861('0x37')][_0x7861('0x3c')]));_0x517ef3[_0x7861('0x3a')]=_0x517ef3[_0x7861('0x3a')]['length']?_0x517ef3[_0x7861('0x3a')]:_0x5cc643['model'];if(_0x27c4d4[_0x7861('0x37')][_0x7861('0x47')]){_0x517ef3[_0x7861('0x4b')]=[{'all':!![]}];}_0x517ef3=_[_0x7861('0x43')]({},_0x517ef3,_0x27c4d4['options']);return db[_0x7861('0x31')][_0x7861('0x4c')](_0x517ef3)[_0x7861('0x29')](handleEntityNotFound(_0x562dbb,null))[_0x7861('0x29')](respondWithResult(_0x562dbb,null))[_0x7861('0x48')](handleError(_0x562dbb,null));};exports['create']=function(_0x2f6c1d,_0x1d45b8){return db[_0x7861('0x31')][_0x7861('0x4d')](_0x2f6c1d[_0x7861('0x4e')],{})['then'](respondWithResult(_0x1d45b8,0xc9))[_0x7861('0x48')](handleError(_0x1d45b8,null));};exports[_0x7861('0x28')]=function(_0xe9fc4b,_0x4f0535){if(_0xe9fc4b[_0x7861('0x4e')]['id']){delete _0xe9fc4b['body']['id'];}return db['SquareRecording'][_0x7861('0x4c')]({'where':{'id':_0xe9fc4b[_0x7861('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f0535,null))[_0x7861('0x29')](saveUpdates(_0xe9fc4b[_0x7861('0x4e')],null))[_0x7861('0x29')](respondWithResult(_0x4f0535,null))[_0x7861('0x48')](handleError(_0x4f0535,null));};exports[_0x7861('0x4f')]=function(_0x86daeb,_0x408959,_0x13f9a9){var _0x58056a=require('../../components/encryptor');var _0x44ecc1=![];var _0x6c56db={};if(_0x86daeb[_0x7861('0x37')][_0x7861('0x34')]&&_0x86daeb[_0x7861('0x37')][_0x7861('0x34')]===_0x7861('0x50')){_0x6c56db[_0x7861('0x50')]=_0x86daeb[_0x7861('0x4a')]['id'];}else{_0x6c56db['id']=_0x86daeb[_0x7861('0x4a')]['id'];}return db[_0x7861('0x31')]['find']({'where':_0x6c56db,'attributes':['id',_0x7861('0x51'),'filename'],'raw':!![]})[_0x7861('0x29')](handleEntityNotFound(_0x408959,null))['then'](function(_0x40c19e){if(_0x40c19e){var _0x5c92e0=_0x40c19e[_0x7861('0x51')];var _0x53b9c1=util[_0x7861('0x52')](_0x7861('0x53'),_0x5c92e0);if(fs[_0x7861('0x54')](_0x53b9c1)){_0x44ecc1=!![];return _0x58056a[_0x7861('0x55')](_0x53b9c1,_0x5c92e0,config['secrets'][_0x7861('0x56')])['then'](function(){return _0x40c19e;});}return _0x40c19e;}})[_0x7861('0x29')](function(_0x11b5d4){if(_0x11b5d4){var _0x35123d=_0x11b5d4[_0x7861('0x51')];if(!fs[_0x7861('0x54')](_0x35123d)){throw new db['Sequelize'][(_0x7861('0x57'))](_0x7861('0x58'));}if(_0x11b5d4[_0x7861('0x59')]){return _0x408959[_0x7861('0x4f')](_0x35123d,_0x11b5d4['filename']+path['extname'](_0x35123d),function(){if(_0x44ecc1){fs['unlink'](_0x35123d);}});}else{return _0x408959[_0x7861('0x4f')](_0x35123d,function(_0x1f047b){if(_0x44ecc1){fs[_0x7861('0x5a')](_0x35123d);}});}}})[_0x7861('0x48')](function(_0x151d29){if(_0x151d29[_0x7861('0x5b')]===_0x7861('0x58')){_0x408959[_0x7861('0x1d')](0x194)['send']('Not\x20found');}else{return handleError(_0x408959,null);}});};exports[_0x7861('0x2a')]=function(_0x558627,_0x28464d){return db[_0x7861('0x31')][_0x7861('0x4c')]({'where':{'id':_0x558627[_0x7861('0x4a')]['id']}})[_0x7861('0x29')](function(_0x43a249){if(_['isNil'](_0x43a249)){throw new ReferenceError('Entity\x20not\x20found');}return _0x43a249;})[_0x7861('0x29')](function(_0x5b3704){var _0x348095=_0x5b3704['savePath'];logger[_0x7861('0x5c')](_0x7861('0x5d'),_0x348095);if(!_[_0x7861('0x5e')](_0x5b3704[_0x7861('0x51')])&&fs[_0x7861('0x54')](_0x348095)){logger[_0x7861('0x5c')]('File:\x20\x22'+_0x348095+_0x7861('0x5f'));fs[_0x7861('0x60')](_0x348095);}_0x348095=_0x348095+_0x7861('0x61');if(!_['isNil'](_0x5b3704[_0x7861('0x51')])&&fs[_0x7861('0x54')](_0x348095)){logger['info']('File:\x20\x22'+_0x348095+_0x7861('0x5f'));fs[_0x7861('0x60')](_0x348095);}return _0x5b3704;})[_0x7861('0x29')](function(_0x5cb90b){if(!_0x5cb90b)throw new InternalError();return _0x5cb90b[_0x7861('0x2a')]();})[_0x7861('0x29')](function(){_0x28464d[_0x7861('0x1d')](0xcc)[_0x7861('0x1e')]();})[_0x7861('0x48')](handleError(_0x28464d,null));}; \ No newline at end of file +var _0xd50c=['then','destroy','stack','name','send','index','SquareRecording','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','download','../../components/encryptor','uniqueid','filename','savePath','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0xd50c,0x1b2));var _0xcd50=function(_0x122588,_0x5e6fa4){_0x122588=_0x122588-0x0;var _0x1d6ad9=_0xd50c[_0x122588];return _0x1d6ad9;};'use strict';var emlformat=require(_0xcd50('0x0'));var rimraf=require(_0xcd50('0x1'));var zipdir=require(_0xcd50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd50('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcd50('0x4'));var csv=require(_0xcd50('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd50('0x6'));var _=require(_0xcd50('0x7'));var squel=require(_0xcd50('0x8'));var crypto=require(_0xcd50('0x9'));var jsforce=require(_0xcd50('0xa'));var deskjs=require(_0xcd50('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcd50('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd50('0xd'));var hardwareService=require(_0xcd50('0xe'));var logger=require('../../config/logger')(_0xcd50('0xf'));var utils=require(_0xcd50('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd50('0x11'))['db'];function respondWithStatusCode(_0x4342d3,_0x3068de){_0x3068de=_0x3068de||0xcc;return function(_0xc8ab9c){if(_0xc8ab9c){return _0x4342d3[_0xcd50('0x12')](_0x3068de);}return _0x4342d3[_0xcd50('0x13')](_0x3068de)[_0xcd50('0x14')]();};}function respondWithResult(_0x2d9c02,_0x1dc281){_0x1dc281=_0x1dc281||0xc8;return function(_0x24352a){if(_0x24352a){return _0x2d9c02[_0xcd50('0x13')](_0x1dc281)[_0xcd50('0x15')](_0x24352a);}};}function respondWithFilteredResult(_0x2ea417,_0x4c08d4){return function(_0x128213){if(_0x128213){var _0x24ab2c=typeof _0x4c08d4[_0xcd50('0x16')]===_0xcd50('0x17')&&typeof _0x4c08d4['limit']==='undefined';var _0x491da0=_0x128213[_0xcd50('0x18')];var _0x1cb31e=_0x24ab2c?0x0:_0x4c08d4[_0xcd50('0x16')];var _0x56cc15=_0x24ab2c?_0x128213[_0xcd50('0x18')]:_0x4c08d4['offset']+_0x4c08d4['limit'];var _0x89a784;if(_0x56cc15>=_0x491da0){_0x56cc15=_0x491da0;_0x89a784=0xc8;}else{_0x89a784=0xce;}_0x2ea417[_0xcd50('0x13')](_0x89a784);return _0x2ea417[_0xcd50('0x19')](_0xcd50('0x1a'),_0x1cb31e+'-'+_0x56cc15+'/'+_0x491da0)[_0xcd50('0x15')](_0x128213);}return null;};}function patchUpdates(_0x432bfe){return function(_0x38f648){try{jsonpatch[_0xcd50('0x1b')](_0x38f648,_0x432bfe,!![]);}catch(_0x376824){return BPromise[_0xcd50('0x1c')](_0x376824);}return _0x38f648[_0xcd50('0x1d')]();};}function saveUpdates(_0x1b581f,_0x101b23){return function(_0x5c5d7c){if(_0x5c5d7c){return _0x5c5d7c[_0xcd50('0x1e')](_0x1b581f)[_0xcd50('0x1f')](function(_0x51ec71){return _0x51ec71;});}return null;};}function removeEntity(_0x3117d6,_0x1c060a){return function(_0x57994e){if(_0x57994e){return _0x57994e[_0xcd50('0x20')]()[_0xcd50('0x1f')](function(){_0x3117d6[_0xcd50('0x13')](0xcc)[_0xcd50('0x14')]();});}};}function handleEntityNotFound(_0x54ea22,_0x21b7d4){return function(_0x36ea8f){if(!_0x36ea8f){_0x54ea22[_0xcd50('0x12')](0x194);}return _0x36ea8f;};}function handleError(_0x525f75,_0xfc03bb){_0xfc03bb=_0xfc03bb||0x1f4;return function(_0x12255a){logger['error'](_0x12255a[_0xcd50('0x21')]);if(_0x12255a[_0xcd50('0x22')]){delete _0x12255a[_0xcd50('0x22')];}_0x525f75[_0xcd50('0x13')](_0xfc03bb)[_0xcd50('0x23')](_0x12255a);};}exports[_0xcd50('0x24')]=function(_0x5b4c1a,_0x183d44){var _0x5f31dd={},_0x1b7049={},_0x4c9845={'count':0x0,'rows':[]};var _0x30ab63=_['map'](db[_0xcd50('0x25')]['rawAttributes'],function(_0x5b14d2){return{'name':_0x5b14d2[_0xcd50('0x26')],'type':_0x5b14d2['type']['key']};});_0x1b7049[_0xcd50('0x27')]=_[_0xcd50('0x28')](_0x30ab63,_0xcd50('0x22'));_0x1b7049[_0xcd50('0x29')]=_[_0xcd50('0x2a')](_0x5b4c1a[_0xcd50('0x29')]);_0x1b7049[_0xcd50('0x2b')]=_[_0xcd50('0x2c')](_0x1b7049[_0xcd50('0x27')],_0x1b7049['query']);_0x5f31dd['attributes']=_[_0xcd50('0x2c')](_0x1b7049[_0xcd50('0x27')],qs[_0xcd50('0x2d')](_0x5b4c1a[_0xcd50('0x29')][_0xcd50('0x2d')]));_0x5f31dd[_0xcd50('0x2e')]=_0x5f31dd[_0xcd50('0x2e')][_0xcd50('0x2f')]?_0x5f31dd[_0xcd50('0x2e')]:_0x1b7049[_0xcd50('0x27')];if(!_0x5b4c1a['query']['hasOwnProperty']('nolimit')){_0x5f31dd[_0xcd50('0x30')]=qs[_0xcd50('0x30')](_0x5b4c1a['query'][_0xcd50('0x30')]);_0x5f31dd['offset']=qs[_0xcd50('0x16')](_0x5b4c1a[_0xcd50('0x29')][_0xcd50('0x16')]);}_0x5f31dd[_0xcd50('0x31')]=qs[_0xcd50('0x32')](_0x5b4c1a[_0xcd50('0x29')][_0xcd50('0x32')]);_0x5f31dd[_0xcd50('0x33')]=qs['filters'](_[_0xcd50('0x34')](_0x5b4c1a[_0xcd50('0x29')],_0x1b7049[_0xcd50('0x2b')]),_0x30ab63);if(_0x5b4c1a['query'][_0xcd50('0x35')]){_0x5f31dd['where']=_[_0xcd50('0x36')](_0x5f31dd['where'],{'$or':_[_0xcd50('0x28')](_0x30ab63,function(_0x4be52c){if(_0x4be52c[_0xcd50('0x37')]!==_0xcd50('0x38')){var _0x1b19ad={};_0x1b19ad[_0x4be52c[_0xcd50('0x22')]]={'$like':'%'+_0x5b4c1a['query'][_0xcd50('0x35')]+'%'};return _0x1b19ad;}})});}_0x5f31dd=_['merge']({},_0x5f31dd,_0x5b4c1a['options']);var _0x52e3b6={'where':_0x5f31dd[_0xcd50('0x33')]};return db[_0xcd50('0x25')][_0xcd50('0x18')](_0x52e3b6)[_0xcd50('0x1f')](function(_0x2edde7){_0x4c9845[_0xcd50('0x18')]=_0x2edde7;if(_0x5b4c1a[_0xcd50('0x29')]['includeAll']){_0x5f31dd[_0xcd50('0x39')]=[{'all':!![]}];}return db[_0xcd50('0x25')]['findAll'](_0x5f31dd);})[_0xcd50('0x1f')](function(_0x38ba15){_0x4c9845[_0xcd50('0x3a')]=_0x38ba15;return _0x4c9845;})['then'](respondWithFilteredResult(_0x183d44,_0x5f31dd))[_0xcd50('0x3b')](handleError(_0x183d44,null));};exports[_0xcd50('0x3c')]=function(_0x153ff7,_0x5e9026){var _0xfe4229={'raw':!![],'where':{'id':_0x153ff7[_0xcd50('0x3d')]['id']}},_0x509c0f={};_0x509c0f['model']=_['keys'](db[_0xcd50('0x25')][_0xcd50('0x3e')]);_0x509c0f[_0xcd50('0x29')]=_[_0xcd50('0x2a')](_0x153ff7[_0xcd50('0x29')]);_0x509c0f['filters']=_[_0xcd50('0x2c')](_0x509c0f[_0xcd50('0x27')],_0x509c0f[_0xcd50('0x29')]);_0xfe4229[_0xcd50('0x2e')]=_[_0xcd50('0x2c')](_0x509c0f[_0xcd50('0x27')],qs[_0xcd50('0x2d')](_0x153ff7[_0xcd50('0x29')][_0xcd50('0x2d')]));_0xfe4229[_0xcd50('0x2e')]=_0xfe4229[_0xcd50('0x2e')][_0xcd50('0x2f')]?_0xfe4229['attributes']:_0x509c0f[_0xcd50('0x27')];if(_0x153ff7[_0xcd50('0x29')][_0xcd50('0x3f')]){_0xfe4229[_0xcd50('0x39')]=[{'all':!![]}];}_0xfe4229=_[_0xcd50('0x36')]({},_0xfe4229,_0x153ff7[_0xcd50('0x40')]);return db[_0xcd50('0x25')][_0xcd50('0x41')](_0xfe4229)[_0xcd50('0x1f')](handleEntityNotFound(_0x5e9026,null))[_0xcd50('0x1f')](respondWithResult(_0x5e9026,null))['catch'](handleError(_0x5e9026,null));};exports[_0xcd50('0x42')]=function(_0xec70f8,_0x38b0a0){return db[_0xcd50('0x25')][_0xcd50('0x42')](_0xec70f8[_0xcd50('0x43')],{})['then'](respondWithResult(_0x38b0a0,0xc9))['catch'](handleError(_0x38b0a0,null));};exports[_0xcd50('0x1e')]=function(_0x12604a,_0x4757c9){if(_0x12604a['body']['id']){delete _0x12604a['body']['id'];}return db['SquareRecording'][_0xcd50('0x41')]({'where':{'id':_0x12604a['params']['id']}})[_0xcd50('0x1f')](handleEntityNotFound(_0x4757c9,null))['then'](saveUpdates(_0x12604a[_0xcd50('0x43')],null))[_0xcd50('0x1f')](respondWithResult(_0x4757c9,null))['catch'](handleError(_0x4757c9,null));};exports[_0xcd50('0x44')]=function(_0xb5effd,_0x4d1b02,_0x5a146f){var _0x2bfbf9=require(_0xcd50('0x45'));var _0x8a936a=![];var _0x261dc6={};if(_0xb5effd[_0xcd50('0x29')][_0xcd50('0x37')]&&_0xb5effd[_0xcd50('0x29')][_0xcd50('0x37')]===_0xcd50('0x46')){_0x261dc6[_0xcd50('0x46')]=_0xb5effd[_0xcd50('0x3d')]['id'];}else{_0x261dc6['id']=_0xb5effd['params']['id'];}return db[_0xcd50('0x25')]['find']({'where':_0x261dc6,'attributes':['id','savePath',_0xcd50('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x4d1b02,null))['then'](function(_0x3938cc){if(_0x3938cc){var _0x5ce320=_0x3938cc[_0xcd50('0x48')];var _0x4df815=util[_0xcd50('0x49')]('%s.cypher',_0x5ce320);if(fs[_0xcd50('0x4a')](_0x4df815)){_0x8a936a=!![];return _0x2bfbf9[_0xcd50('0x4b')](_0x4df815,_0x5ce320,config[_0xcd50('0x4c')][_0xcd50('0x4d')])['then'](function(){return _0x3938cc;});}return _0x3938cc;}})[_0xcd50('0x1f')](function(_0x1d90d4){if(_0x1d90d4){var _0x14fd6c=_0x1d90d4[_0xcd50('0x48')];if(!fs[_0xcd50('0x4a')](_0x14fd6c)){throw new db[(_0xcd50('0x4e'))][(_0xcd50('0x4f'))](_0xcd50('0x50'));}if(_0x1d90d4[_0xcd50('0x47')]){return _0x4d1b02[_0xcd50('0x44')](_0x14fd6c,_0x1d90d4[_0xcd50('0x47')]+path[_0xcd50('0x51')](_0x14fd6c),function(){if(_0x8a936a){fs[_0xcd50('0x52')](_0x14fd6c);}});}else{return _0x4d1b02['download'](_0x14fd6c,function(_0x47352e){if(_0x8a936a){fs['unlink'](_0x14fd6c);}});}}})[_0xcd50('0x3b')](function(_0x396ad1){if(_0x396ad1[_0xcd50('0x53')]==='SquareRecording\x20not\x20found'){_0x4d1b02['status'](0x194)[_0xcd50('0x23')](_0xcd50('0x54'));}else{return handleError(_0x4d1b02,null);}});};exports[_0xcd50('0x20')]=function(_0xb21699,_0x303996){return db[_0xcd50('0x25')][_0xcd50('0x41')]({'where':{'id':_0xb21699[_0xcd50('0x3d')]['id']}})[_0xcd50('0x1f')](function(_0x524d59){if(_[_0xcd50('0x55')](_0x524d59)){throw new ReferenceError(_0xcd50('0x56'));}return _0x524d59;})[_0xcd50('0x1f')](function(_0x3c60a9){var _0x432856=_0x3c60a9[_0xcd50('0x48')];logger[_0xcd50('0x57')](_0xcd50('0x58'),_0x432856);if(!_['isNil'](_0x3c60a9[_0xcd50('0x48')])&&fs['existsSync'](_0x432856)){logger[_0xcd50('0x57')]('File:\x20\x22'+_0x432856+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcd50('0x59')](_0x432856);}_0x432856=_0x432856+_0xcd50('0x5a');if(!_[_0xcd50('0x55')](_0x3c60a9[_0xcd50('0x48')])&&fs['existsSync'](_0x432856)){logger[_0xcd50('0x57')](_0xcd50('0x5b')+_0x432856+_0xcd50('0x5c'));fs[_0xcd50('0x59')](_0x432856);}return _0x3c60a9;})[_0xcd50('0x1f')](function(_0x2adf06){if(!_0x2adf06)throw new InternalError();return _0x2adf06[_0xcd50('0x20')]();})[_0xcd50('0x1f')](function(){_0x303996[_0xcd50('0x13')](0xcc)[_0xcd50('0x14')]();})[_0xcd50('0x3b')](handleError(_0x303996,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8fa9ca1..542f68f 100644 --- a/server/api/squareRecording/squareRecording.model.js +++ b/server/api/squareRecording/squareRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['bluebird','path','../../config/environment','./squareRecording.attributes','define','SquareRecording','lodash','util','../../config/logger','api','moment'];(function(_0x4cabaf,_0x24b4c7){var _0x516afc=function(_0xff644f){while(--_0xff644f){_0x4cabaf['push'](_0x4cabaf['shift']());}};_0x516afc(++_0x24b4c7);}(_0x53ec,0x192));var _0xc53e=function(_0x30e4c0,_0x58fed1){_0x30e4c0=_0x30e4c0-0x0;var _0x30b6d0=_0x53ec[_0x30e4c0];return _0x30b6d0;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1893=['rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2bd609,_0x44c802){var _0x25ea48=function(_0x2b1f95){while(--_0x2b1f95){_0x2bd609['push'](_0x2bd609['shift']());}};_0x25ea48(++_0x44c802);}(_0x1893,0xa2));var _0x3189=function(_0xfa34aa,_0x1aa9b2){_0xfa34aa=_0xfa34aa-0x0;var _0x469987=_0x1893[_0xfa34aa];return _0x469987;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));module[_0x3189('0x8')]=function(_0x2333e6,_0x4080a9){return _0x2333e6[_0x3189('0x9')](_0x3189('0xa'),attributes,{'tableName':_0x3189('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index df6b87a..18dbbfc 100644 --- a/server/api/squareRecording/squareRecording.rpc.js +++ b/server/api/squareRecording/squareRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf85b=['code','SquareRecording,\x20%s,\x20%s','message','info','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3ae6de,_0x4cb081){var _0x572942=function(_0x5281d7){while(--_0x5281d7){_0x3ae6de['push'](_0x3ae6de['shift']());}};_0x572942(++_0x4cb081);}(_0xf85b,0xac));var _0xbf85=function(_0x3fe870,_0x5b006c){_0x3fe870=_0x3fe870-0x0;var _0x2077f7=_0xf85b[_0x3fe870];return _0x2077f7;};'use strict';var _=require(_0xbf85('0x0'));var util=require(_0xbf85('0x1'));var moment=require(_0xbf85('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf85('0x3'));var db=require(_0xbf85('0x4'))['db'];var utils=require(_0xbf85('0x5'));var logger=require(_0xbf85('0x6'))(_0xbf85('0x7'));var config=require(_0xbf85('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a078,_0x581fd0,_0x398b39){return new BPromise(function(_0x37faa7,_0x1c08d5){return client[_0xbf85('0xa')](_0x32a078,_0x398b39)[_0xbf85('0xb')](function(_0x526bb9){logger['info']('SquareRecording,\x20%s,\x20%s',_0x581fd0,_0xbf85('0xc'));logger[_0xbf85('0xd')](_0xbf85('0xe'),_0x581fd0,_0xbf85('0xc'),JSON[_0xbf85('0xf')](_0x526bb9));if(_0x526bb9[_0xbf85('0x10')]){if(_0x526bb9['error'][_0xbf85('0x11')]===0x1f4){logger[_0xbf85('0x10')](_0xbf85('0x12'),_0x581fd0,_0x526bb9[_0xbf85('0x10')][_0xbf85('0x13')]);return _0x1c08d5(_0x526bb9['error'][_0xbf85('0x13')]);}logger[_0xbf85('0x10')](_0xbf85('0x12'),_0x581fd0,_0x526bb9[_0xbf85('0x10')]['message']);return _0x37faa7(_0x526bb9[_0xbf85('0x10')][_0xbf85('0x13')]);}else{logger[_0xbf85('0x14')](_0xbf85('0x12'),_0x581fd0,_0xbf85('0xc'));_0x37faa7(_0x526bb9['result']['message']);}})[_0xbf85('0x15')](function(_0x293fe4){logger[_0xbf85('0x10')](_0xbf85('0x12'),_0x581fd0,_0x293fe4);_0x1c08d5(_0x293fe4);});});}exports[_0xbf85('0x16')]=function(_0x5bb32e){var _0x4c8de1=this;return new Promise(function(_0x49492a,_0xce18f3){return db[_0xbf85('0x17')]['create'](_0x5bb32e[_0xbf85('0x18')],{'raw':_0x5bb32e[_0xbf85('0x19')]?_0x5bb32e[_0xbf85('0x19')][_0xbf85('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x42a4b8){logger['info'](_0xbf85('0x16'),_0x5bb32e);logger[_0xbf85('0xd')]('CreateSquareRecording',_0x5bb32e,JSON[_0xbf85('0xf')](_0x42a4b8));_0x49492a(_0x42a4b8);})[_0xbf85('0x15')](function(_0x54412a){logger['error'](_0xbf85('0x16'),_0x54412a['message'],_0x5bb32e);_0xce18f3(_0x4c8de1[_0xbf85('0x10')](0x1f4,_0x54412a[_0xbf85('0x13')]));});});}; \ No newline at end of file +var _0x2587=['rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SquareRecording','body','options','raw','CreateSquareRecording','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a04de,_0x2e342c){var _0xbbe018=function(_0x39639c){while(--_0x39639c){_0x4a04de['push'](_0x4a04de['shift']());}};_0xbbe018(++_0x2e342c);}(_0x2587,0x69));var _0x7258=function(_0x5b685e,_0x3e69ad){_0x5b685e=_0x5b685e-0x0;var _0x9a0173=_0x2587[_0x5b685e];return _0x9a0173;};'use strict';var _=require(_0x7258('0x0'));var util=require('util');var moment=require(_0x7258('0x1'));var BPromise=require(_0x7258('0x2'));var rs=require(_0x7258('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7258('0x4'))['db'];var utils=require(_0x7258('0x5'));var logger=require(_0x7258('0x6'))(_0x7258('0x7'));var config=require(_0x7258('0x8'));var jayson=require(_0x7258('0x9'));var client=jayson[_0x7258('0xa')][_0x7258('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x288a5f,_0x558927,_0x336975){return new BPromise(function(_0x3e7ca0,_0x2ce4c4){return client['request'](_0x288a5f,_0x336975)[_0x7258('0xc')](function(_0x33c8e4){logger[_0x7258('0xd')](_0x7258('0xe'),_0x558927,'request\x20sent');logger[_0x7258('0xf')](_0x7258('0x10'),_0x558927,_0x7258('0x11'),JSON[_0x7258('0x12')](_0x33c8e4));if(_0x33c8e4['error']){if(_0x33c8e4[_0x7258('0x13')][_0x7258('0x14')]===0x1f4){logger['error'](_0x7258('0xe'),_0x558927,_0x33c8e4['error']['message']);return _0x2ce4c4(_0x33c8e4[_0x7258('0x13')][_0x7258('0x15')]);}logger[_0x7258('0x13')](_0x7258('0xe'),_0x558927,_0x33c8e4[_0x7258('0x13')][_0x7258('0x15')]);return _0x3e7ca0(_0x33c8e4[_0x7258('0x13')][_0x7258('0x15')]);}else{logger[_0x7258('0xd')](_0x7258('0xe'),_0x558927,'request\x20sent');_0x3e7ca0(_0x33c8e4['result']['message']);}})[_0x7258('0x16')](function(_0x5b433c){logger[_0x7258('0x13')](_0x7258('0xe'),_0x558927,_0x5b433c);_0x2ce4c4(_0x5b433c);});});}exports['CreateSquareRecording']=function(_0x357ca8){var _0x4e7888=this;return new Promise(function(_0x2671cd,_0x5abdaa){return db[_0x7258('0x17')]['create'](_0x357ca8[_0x7258('0x18')],{'raw':_0x357ca8['options']?_0x357ca8[_0x7258('0x19')][_0x7258('0x1a')]===undefined?!![]:![]:!![]})[_0x7258('0xc')](function(_0xb69c5){logger[_0x7258('0xd')](_0x7258('0x1b'),_0x357ca8);logger[_0x7258('0xf')]('CreateSquareRecording',_0x357ca8,JSON[_0x7258('0x12')](_0xb69c5));_0x2671cd(_0xb69c5);})[_0x7258('0x16')](function(_0x1ef4ae){logger[_0x7258('0x13')](_0x7258('0x1b'),_0x1ef4ae[_0x7258('0x15')],_0x357ca8);_0x5abdaa(_0x4e7888[_0x7258('0x13')](0x1f4,_0x1ef4ae[_0x7258('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 72c7f36..33a3161 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x2ec4d8,_0x3d9e0f){var _0x375fa9=function(_0x28330b){while(--_0x28330b){_0x2ec4d8['push'](_0x2ec4d8['shift']());}};_0x375fa9(++_0x3d9e0f);}(_0xe706,0xa3));var _0x6e70=function(_0x4dbc5d,_0x2d0a51){_0x4dbc5d=_0x4dbc5d-0x0;var _0x45b461=_0xe706[_0x4dbc5d];return _0x45b461;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index e61662f..0736aba 100644 --- a/server/api/squareReport/squareReport.attributes.js +++ b/server/api/squareReport/squareReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3970=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x5420c4,_0x506787){var _0x19d5cd=function(_0x3b7fa2){while(--_0x3b7fa2){_0x5420c4['push'](_0x5420c4['shift']());}};_0x19d5cd(++_0x506787);}(_0x3970,0x1d4));var _0x0397=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0x3970[_0x33080e];return _0x407395;};'use strict';var Sequelize=require(_0x0397('0x0'));module[_0x0397('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x0397('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0397('0x2')]},'language':{'type':Sequelize[_0x0397('0x2')]},'type':{'type':Sequelize[_0x0397('0x2')]},'uniqueid':{'type':Sequelize[_0x0397('0x2')]},'version':{'type':Sequelize[_0x0397('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0397('0x2')]},'callingpres':{'type':Sequelize[_0x0397('0x2')]},'callingani2':{'type':Sequelize[_0x0397('0x2')]},'callington':{'type':Sequelize[_0x0397('0x2')]},'callingtns':{'type':Sequelize[_0x0397('0x2')]},'dnid':{'type':Sequelize[_0x0397('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x0397('0x2')]},'priority':{'type':Sequelize[_0x0397('0x2')]},'enhanced':{'type':Sequelize[_0x0397('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x0397('0x2')]},'project_name':{'type':Sequelize[_0x0397('0x2')]},'joinAt':{'type':Sequelize[_0x0397('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x0397('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3199=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x25afde,_0x253b4a){var _0xaceeaf=function(_0x441351){while(--_0x441351){_0x25afde['push'](_0x25afde['shift']());}};_0xaceeaf(++_0x253b4a);}(_0x3199,0x1f1));var _0x9319=function(_0x53332a,_0x5e9a43){_0x53332a=_0x53332a-0x0;var _0x4e930e=_0x3199[_0x53332a];return _0x4e930e;};'use strict';var Sequelize=require(_0x9319('0x0'));module['exports']={'network':{'type':Sequelize[_0x9319('0x1')]},'network_script':{'type':Sequelize[_0x9319('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9319('0x1')]},'language':{'type':Sequelize[_0x9319('0x1')]},'type':{'type':Sequelize[_0x9319('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x9319('0x1')]},'callerid':{'type':Sequelize[_0x9319('0x1')]},'calleridname':{'type':Sequelize[_0x9319('0x1')]},'callingpres':{'type':Sequelize[_0x9319('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x9319('0x1')]},'callingtns':{'type':Sequelize[_0x9319('0x1')]},'dnid':{'type':Sequelize[_0x9319('0x1')]},'rdnis':{'type':Sequelize[_0x9319('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9319('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x9319('0x1')]},'accountcode':{'type':Sequelize[_0x9319('0x1')]},'threadid':{'type':Sequelize[_0x9319('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9319('0x2')]},'bot':{'type':Sequelize[_0x9319('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index f4011c4..ce83965 100644 --- a/server/api/squareReport/squareReport.controller.js +++ b/server/api/squareReport/squareReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6aa=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','SquareReport','fieldName','type','model','keys','query','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xa6aa,0x195));var _0xaa6a=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0xa6aa[_0x2134b7];return _0x6c5914;};'use strict';var emlformat=require(_0xaa6a('0x0'));var rimraf=require(_0xaa6a('0x1'));var zipdir=require(_0xaa6a('0x2'));var jsonpatch=require(_0xaa6a('0x3'));var rp=require(_0xaa6a('0x4'));var moment=require(_0xaa6a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa6a('0x6'));var path=require(_0xaa6a('0x7'));var sox=require('sox');var csv=require(_0xaa6a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa6a('0x9'));var _=require(_0xaa6a('0xa'));var squel=require(_0xaa6a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa6a('0xc'));var Papa=require(_0xaa6a('0xd'));var Redis=require(_0xaa6a('0xe'));var authService=require(_0xaa6a('0xf'));var qs=require(_0xaa6a('0x10'));var as=require(_0xaa6a('0x11'));var hardwareService=require(_0xaa6a('0x12'));var logger=require('../../config/logger')(_0xaa6a('0x13'));var utils=require(_0xaa6a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x746622,_0x1ea46c){_0x1ea46c=_0x1ea46c||0xcc;return function(_0x224e93){if(_0x224e93){return _0x746622[_0xaa6a('0x15')](_0x1ea46c);}return _0x746622[_0xaa6a('0x16')](_0x1ea46c)[_0xaa6a('0x17')]();};}function respondWithResult(_0x895af,_0x501b68){_0x501b68=_0x501b68||0xc8;return function(_0x14b8be){if(_0x14b8be){return _0x895af[_0xaa6a('0x16')](_0x501b68)[_0xaa6a('0x18')](_0x14b8be);}};}function respondWithFilteredResult(_0x4f8a6e,_0x5bcc1a){return function(_0x11f9b8){if(_0x11f9b8){var _0x466022=typeof _0x5bcc1a[_0xaa6a('0x19')]===_0xaa6a('0x1a')&&typeof _0x5bcc1a[_0xaa6a('0x1b')]===_0xaa6a('0x1a');var _0x3060bb=_0x11f9b8[_0xaa6a('0x1c')];var _0x3031b2=_0x466022?0x0:_0x5bcc1a[_0xaa6a('0x19')];var _0x2f020b=_0x466022?_0x11f9b8[_0xaa6a('0x1c')]:_0x5bcc1a[_0xaa6a('0x19')]+_0x5bcc1a[_0xaa6a('0x1b')];var _0x40988f;if(_0x2f020b>=_0x3060bb){_0x2f020b=_0x3060bb;_0x40988f=0xc8;}else{_0x40988f=0xce;}_0x4f8a6e[_0xaa6a('0x16')](_0x40988f);return _0x4f8a6e[_0xaa6a('0x1d')]('Content-Range',_0x3031b2+'-'+_0x2f020b+'/'+_0x3060bb)[_0xaa6a('0x18')](_0x11f9b8);}return null;};}function patchUpdates(_0x3dc6b2){return function(_0x25c10c){try{jsonpatch[_0xaa6a('0x1e')](_0x25c10c,_0x3dc6b2,!![]);}catch(_0x4fa361){return BPromise[_0xaa6a('0x1f')](_0x4fa361);}return _0x25c10c['save']();};}function saveUpdates(_0x225a5c,_0x49e947){return function(_0x3b8d72){if(_0x3b8d72){return _0x3b8d72[_0xaa6a('0x20')](_0x225a5c)[_0xaa6a('0x21')](function(_0x5a5072){return _0x5a5072;});}return null;};}function removeEntity(_0x34c4ac,_0x377a1d){return function(_0x42b8d3){if(_0x42b8d3){return _0x42b8d3[_0xaa6a('0x22')]()['then'](function(){_0x34c4ac[_0xaa6a('0x16')](0xcc)[_0xaa6a('0x17')]();});}};}function handleEntityNotFound(_0x2ee9a1,_0x11b347){return function(_0x4b6b07){if(!_0x4b6b07){_0x2ee9a1['sendStatus'](0x194);}return _0x4b6b07;};}function handleError(_0x5a9e8b,_0xceb371){_0xceb371=_0xceb371||0x1f4;return function(_0x4db5c6){logger[_0xaa6a('0x23')](_0x4db5c6[_0xaa6a('0x24')]);if(_0x4db5c6[_0xaa6a('0x25')]){delete _0x4db5c6[_0xaa6a('0x25')];}_0x5a9e8b[_0xaa6a('0x16')](_0xceb371)['send'](_0x4db5c6);};}exports[_0xaa6a('0x26')]=function(_0x7b2296,_0x3831c9){var _0x3c3888={},_0x388074={},_0x11147f={'count':0x0,'rows':[]};var _0x1de4ab=_[_0xaa6a('0x27')](db[_0xaa6a('0x28')]['rawAttributes'],function(_0x52fec5){return{'name':_0x52fec5[_0xaa6a('0x29')],'type':_0x52fec5[_0xaa6a('0x2a')]['key']};});_0x388074[_0xaa6a('0x2b')]=_[_0xaa6a('0x27')](_0x1de4ab,'name');_0x388074['query']=_[_0xaa6a('0x2c')](_0x7b2296[_0xaa6a('0x2d')]);_0x388074[_0xaa6a('0x2e')]=_['intersection'](_0x388074['model'],_0x388074[_0xaa6a('0x2d')]);_0x3c3888['attributes']=_['intersection'](_0x388074[_0xaa6a('0x2b')],qs[_0xaa6a('0x2f')](_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x2f')]));_0x3c3888[_0xaa6a('0x30')]=_0x3c3888[_0xaa6a('0x30')][_0xaa6a('0x31')]?_0x3c3888['attributes']:_0x388074[_0xaa6a('0x2b')];if(!_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x32')]('nolimit')){_0x3c3888['limit']=qs[_0xaa6a('0x1b')](_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x1b')]);_0x3c3888[_0xaa6a('0x19')]=qs['offset'](_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x19')]);}_0x3c3888[_0xaa6a('0x33')]=qs[_0xaa6a('0x34')](_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x34')]);_0x3c3888[_0xaa6a('0x35')]=qs[_0xaa6a('0x2e')](_[_0xaa6a('0x36')](_0x7b2296[_0xaa6a('0x2d')],_0x388074['filters']),_0x1de4ab);if(_0x7b2296['query'][_0xaa6a('0x37')]){_0x3c3888[_0xaa6a('0x35')]=_[_0xaa6a('0x38')](_0x3c3888[_0xaa6a('0x35')],{'$or':_[_0xaa6a('0x27')](_0x1de4ab,function(_0x48e85e){if(_0x48e85e[_0xaa6a('0x2a')]!==_0xaa6a('0x39')){var _0x2eb547={};_0x2eb547[_0x48e85e[_0xaa6a('0x25')]]={'$like':'%'+_0x7b2296['query'][_0xaa6a('0x37')]+'%'};return _0x2eb547;}})});}_0x3c3888=_[_0xaa6a('0x38')]({},_0x3c3888,_0x7b2296[_0xaa6a('0x3a')]);var _0x3fdc46={'where':_0x3c3888[_0xaa6a('0x35')]};return db[_0xaa6a('0x28')][_0xaa6a('0x1c')](_0x3fdc46)[_0xaa6a('0x21')](function(_0x12f0c6){_0x11147f[_0xaa6a('0x1c')]=_0x12f0c6;if(_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x3b')]){_0x3c3888[_0xaa6a('0x3c')]=[{'all':!![]}];}return db[_0xaa6a('0x28')][_0xaa6a('0x3d')](_0x3c3888);})['then'](function(_0x18aec4){_0x11147f[_0xaa6a('0x3e')]=_0x18aec4;return _0x11147f;})[_0xaa6a('0x21')](respondWithFilteredResult(_0x3831c9,_0x3c3888))[_0xaa6a('0x3f')](handleError(_0x3831c9,null));};exports['show']=function(_0x303a49,_0x3b7ed6){var _0x5d1fff={'raw':!![],'where':{'id':_0x303a49[_0xaa6a('0x40')]['id']}},_0x33dbad={};_0x33dbad[_0xaa6a('0x2b')]=_['keys'](db[_0xaa6a('0x28')][_0xaa6a('0x41')]);_0x33dbad[_0xaa6a('0x2d')]=_['keys'](_0x303a49['query']);_0x33dbad['filters']=_['intersection'](_0x33dbad[_0xaa6a('0x2b')],_0x33dbad['query']);_0x5d1fff['attributes']=_[_0xaa6a('0x42')](_0x33dbad[_0xaa6a('0x2b')],qs[_0xaa6a('0x2f')](_0x303a49[_0xaa6a('0x2d')][_0xaa6a('0x2f')]));_0x5d1fff[_0xaa6a('0x30')]=_0x5d1fff[_0xaa6a('0x30')][_0xaa6a('0x31')]?_0x5d1fff[_0xaa6a('0x30')]:_0x33dbad[_0xaa6a('0x2b')];if(_0x303a49[_0xaa6a('0x2d')][_0xaa6a('0x3b')]){_0x5d1fff[_0xaa6a('0x3c')]=[{'all':!![]}];}_0x5d1fff=_['merge']({},_0x5d1fff,_0x303a49['options']);return db[_0xaa6a('0x28')][_0xaa6a('0x43')](_0x5d1fff)['then'](handleEntityNotFound(_0x3b7ed6,null))[_0xaa6a('0x21')](respondWithResult(_0x3b7ed6,null))['catch'](handleError(_0x3b7ed6,null));};exports[_0xaa6a('0x44')]=function(_0x32b5a2,_0x101bc7){return db[_0xaa6a('0x28')]['create'](_0x32b5a2['body'],{})[_0xaa6a('0x21')](respondWithResult(_0x101bc7,0xc9))[_0xaa6a('0x3f')](handleError(_0x101bc7,null));};exports['update']=function(_0x50d235,_0x32aa62){if(_0x50d235[_0xaa6a('0x45')]['id']){delete _0x50d235[_0xaa6a('0x45')]['id'];}return db[_0xaa6a('0x28')]['find']({'where':{'id':_0x50d235[_0xaa6a('0x40')]['id']}})[_0xaa6a('0x21')](handleEntityNotFound(_0x32aa62,null))[_0xaa6a('0x21')](saveUpdates(_0x50d235[_0xaa6a('0x45')],null))[_0xaa6a('0x21')](respondWithResult(_0x32aa62,null))[_0xaa6a('0x3f')](handleError(_0x32aa62,null));};exports[_0xaa6a('0x22')]=function(_0x5ba429,_0x2484d6){return db[_0xaa6a('0x28')]['find']({'where':{'id':_0x5ba429[_0xaa6a('0x40')]['id']}})[_0xaa6a('0x21')](handleEntityNotFound(_0x2484d6,null))['then'](removeEntity(_0x2484d6,null))[_0xaa6a('0x3f')](handleError(_0x2484d6,null));};exports['describe']=function(_0x4a4a7f,_0x4f585b){return db['SquareReport'][_0xaa6a('0x46')]()[_0xaa6a('0x21')](respondWithResult(_0x4f585b,null))[_0xaa6a('0x3f')](handleError(_0x4f585b,null));}; \ No newline at end of file +var _0x6646=['../../mysqldb','sendStatus','end','limit','undefined','count','offset','status','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','catch','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x5ef630,_0x56b2cc){var _0x46403a=function(_0x168b62){while(--_0x168b62){_0x5ef630['push'](_0x5ef630['shift']());}};_0x46403a(++_0x56b2cc);}(_0x6646,0xd6));var _0x6664=function(_0x258c13,_0x2680e8){_0x258c13=_0x258c13-0x0;var _0x106325=_0x6646[_0x258c13];return _0x106325;};'use strict';var emlformat=require(_0x6664('0x0'));var rimraf=require(_0x6664('0x1'));var zipdir=require(_0x6664('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6664('0x3'));var BPromise=require(_0x6664('0x4'));var Mustache=require(_0x6664('0x5'));var util=require(_0x6664('0x6'));var path=require(_0x6664('0x7'));var sox=require('sox');var csv=require(_0x6664('0x8'));var ejs=require(_0x6664('0x9'));var fs=require('fs');var fs_extra=require(_0x6664('0xa'));var _=require(_0x6664('0xb'));var squel=require(_0x6664('0xc'));var crypto=require(_0x6664('0xd'));var jsforce=require(_0x6664('0xe'));var deskjs=require(_0x6664('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6664('0x10'));var qs=require(_0x6664('0x11'));var as=require(_0x6664('0x12'));var hardwareService=require(_0x6664('0x13'));var logger=require(_0x6664('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6664('0x15'));var licenseUtil=require(_0x6664('0x16'));var db=require(_0x6664('0x17'))['db'];function respondWithStatusCode(_0x435319,_0x11441f){_0x11441f=_0x11441f||0xcc;return function(_0x59a2ce){if(_0x59a2ce){return _0x435319[_0x6664('0x18')](_0x11441f);}return _0x435319['status'](_0x11441f)[_0x6664('0x19')]();};}function respondWithResult(_0x146861,_0x169ea5){_0x169ea5=_0x169ea5||0xc8;return function(_0x3e12e9){if(_0x3e12e9){return _0x146861['status'](_0x169ea5)['json'](_0x3e12e9);}};}function respondWithFilteredResult(_0x47542b,_0x36c7ac){return function(_0x5eb98a){if(_0x5eb98a){var _0x388ee0=typeof _0x36c7ac['offset']==='undefined'&&typeof _0x36c7ac[_0x6664('0x1a')]===_0x6664('0x1b');var _0x2e9a69=_0x5eb98a[_0x6664('0x1c')];var _0x8e5254=_0x388ee0?0x0:_0x36c7ac[_0x6664('0x1d')];var _0x3daab2=_0x388ee0?_0x5eb98a[_0x6664('0x1c')]:_0x36c7ac[_0x6664('0x1d')]+_0x36c7ac[_0x6664('0x1a')];var _0x32708a;if(_0x3daab2>=_0x2e9a69){_0x3daab2=_0x2e9a69;_0x32708a=0xc8;}else{_0x32708a=0xce;}_0x47542b[_0x6664('0x1e')](_0x32708a);return _0x47542b[_0x6664('0x1f')](_0x6664('0x20'),_0x8e5254+'-'+_0x3daab2+'/'+_0x2e9a69)[_0x6664('0x21')](_0x5eb98a);}return null;};}function patchUpdates(_0x3fddf0){return function(_0x3805be){try{jsonpatch[_0x6664('0x22')](_0x3805be,_0x3fddf0,!![]);}catch(_0x3f280f){return BPromise['reject'](_0x3f280f);}return _0x3805be[_0x6664('0x23')]();};}function saveUpdates(_0x7f1ef3,_0x1d0275){return function(_0x1bb737){if(_0x1bb737){return _0x1bb737[_0x6664('0x24')](_0x7f1ef3)['then'](function(_0x11599c){return _0x11599c;});}return null;};}function removeEntity(_0x308c0c,_0x205131){return function(_0x182203){if(_0x182203){return _0x182203[_0x6664('0x25')]()[_0x6664('0x26')](function(){_0x308c0c['status'](0xcc)[_0x6664('0x19')]();});}};}function handleEntityNotFound(_0x3b9a44,_0x30a7c8){return function(_0x1b5167){if(!_0x1b5167){_0x3b9a44[_0x6664('0x18')](0x194);}return _0x1b5167;};}function handleError(_0x5db7ec,_0x831e01){_0x831e01=_0x831e01||0x1f4;return function(_0x485844){logger[_0x6664('0x27')](_0x485844[_0x6664('0x28')]);if(_0x485844[_0x6664('0x29')]){delete _0x485844[_0x6664('0x29')];}_0x5db7ec[_0x6664('0x1e')](_0x831e01)[_0x6664('0x2a')](_0x485844);};}exports[_0x6664('0x2b')]=function(_0x5422ac,_0x41f3a8){var _0x61ba29={},_0x526a78={},_0x13e00f={'count':0x0,'rows':[]};var _0x24124e=_[_0x6664('0x2c')](db[_0x6664('0x2d')][_0x6664('0x2e')],function(_0x114fb8){return{'name':_0x114fb8[_0x6664('0x2f')],'type':_0x114fb8[_0x6664('0x30')][_0x6664('0x31')]};});_0x526a78[_0x6664('0x32')]=_[_0x6664('0x2c')](_0x24124e,_0x6664('0x29'));_0x526a78[_0x6664('0x33')]=_[_0x6664('0x34')](_0x5422ac[_0x6664('0x33')]);_0x526a78[_0x6664('0x35')]=_[_0x6664('0x36')](_0x526a78['model'],_0x526a78[_0x6664('0x33')]);_0x61ba29[_0x6664('0x37')]=_['intersection'](_0x526a78[_0x6664('0x32')],qs[_0x6664('0x38')](_0x5422ac[_0x6664('0x33')][_0x6664('0x38')]));_0x61ba29[_0x6664('0x37')]=_0x61ba29[_0x6664('0x37')][_0x6664('0x39')]?_0x61ba29[_0x6664('0x37')]:_0x526a78[_0x6664('0x32')];if(!_0x5422ac[_0x6664('0x33')][_0x6664('0x3a')](_0x6664('0x3b'))){_0x61ba29[_0x6664('0x1a')]=qs[_0x6664('0x1a')](_0x5422ac['query'][_0x6664('0x1a')]);_0x61ba29[_0x6664('0x1d')]=qs['offset'](_0x5422ac[_0x6664('0x33')][_0x6664('0x1d')]);}_0x61ba29[_0x6664('0x3c')]=qs[_0x6664('0x3d')](_0x5422ac[_0x6664('0x33')][_0x6664('0x3d')]);_0x61ba29[_0x6664('0x3e')]=qs['filters'](_[_0x6664('0x3f')](_0x5422ac[_0x6664('0x33')],_0x526a78[_0x6664('0x35')]),_0x24124e);if(_0x5422ac[_0x6664('0x33')][_0x6664('0x40')]){_0x61ba29[_0x6664('0x3e')]=_[_0x6664('0x41')](_0x61ba29[_0x6664('0x3e')],{'$or':_[_0x6664('0x2c')](_0x24124e,function(_0x26eff6){if(_0x26eff6[_0x6664('0x30')]!==_0x6664('0x42')){var _0x18030d={};_0x18030d[_0x26eff6[_0x6664('0x29')]]={'$like':'%'+_0x5422ac[_0x6664('0x33')][_0x6664('0x40')]+'%'};return _0x18030d;}})});}_0x61ba29=_[_0x6664('0x41')]({},_0x61ba29,_0x5422ac[_0x6664('0x43')]);var _0x2c2023={'where':_0x61ba29['where']};return db[_0x6664('0x2d')][_0x6664('0x1c')](_0x2c2023)[_0x6664('0x26')](function(_0x425c14){_0x13e00f[_0x6664('0x1c')]=_0x425c14;if(_0x5422ac['query']['includeAll']){_0x61ba29[_0x6664('0x44')]=[{'all':!![]}];}return db[_0x6664('0x2d')][_0x6664('0x45')](_0x61ba29);})[_0x6664('0x26')](function(_0x2892e4){_0x13e00f[_0x6664('0x46')]=_0x2892e4;return _0x13e00f;})['then'](respondWithFilteredResult(_0x41f3a8,_0x61ba29))['catch'](handleError(_0x41f3a8,null));};exports[_0x6664('0x47')]=function(_0x166ab8,_0x3ecb58){var _0x482924={'raw':!![],'where':{'id':_0x166ab8[_0x6664('0x48')]['id']}},_0x1af450={};_0x1af450[_0x6664('0x32')]=_[_0x6664('0x34')](db['SquareReport'][_0x6664('0x2e')]);_0x1af450[_0x6664('0x33')]=_[_0x6664('0x34')](_0x166ab8[_0x6664('0x33')]);_0x1af450[_0x6664('0x35')]=_[_0x6664('0x36')](_0x1af450[_0x6664('0x32')],_0x1af450[_0x6664('0x33')]);_0x482924[_0x6664('0x37')]=_[_0x6664('0x36')](_0x1af450[_0x6664('0x32')],qs[_0x6664('0x38')](_0x166ab8[_0x6664('0x33')]['fields']));_0x482924[_0x6664('0x37')]=_0x482924[_0x6664('0x37')]['length']?_0x482924[_0x6664('0x37')]:_0x1af450[_0x6664('0x32')];if(_0x166ab8[_0x6664('0x33')][_0x6664('0x49')]){_0x482924[_0x6664('0x44')]=[{'all':!![]}];}_0x482924=_[_0x6664('0x41')]({},_0x482924,_0x166ab8[_0x6664('0x43')]);return db[_0x6664('0x2d')][_0x6664('0x4a')](_0x482924)[_0x6664('0x26')](handleEntityNotFound(_0x3ecb58,null))[_0x6664('0x26')](respondWithResult(_0x3ecb58,null))['catch'](handleError(_0x3ecb58,null));};exports[_0x6664('0x4b')]=function(_0x3cce9d,_0x36798b){return db['SquareReport'][_0x6664('0x4b')](_0x3cce9d[_0x6664('0x4c')],{})[_0x6664('0x26')](respondWithResult(_0x36798b,0xc9))['catch'](handleError(_0x36798b,null));};exports[_0x6664('0x24')]=function(_0x2af14b,_0x5299d5){if(_0x2af14b[_0x6664('0x4c')]['id']){delete _0x2af14b['body']['id'];}return db[_0x6664('0x2d')][_0x6664('0x4a')]({'where':{'id':_0x2af14b[_0x6664('0x48')]['id']}})['then'](handleEntityNotFound(_0x5299d5,null))[_0x6664('0x26')](saveUpdates(_0x2af14b['body'],null))[_0x6664('0x26')](respondWithResult(_0x5299d5,null))[_0x6664('0x4d')](handleError(_0x5299d5,null));};exports['destroy']=function(_0x4f470c,_0x5d6be5){return db[_0x6664('0x2d')][_0x6664('0x4a')]({'where':{'id':_0x4f470c[_0x6664('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d6be5,null))[_0x6664('0x26')](removeEntity(_0x5d6be5,null))[_0x6664('0x4d')](handleError(_0x5d6be5,null));};exports[_0x6664('0x4e')]=function(_0x5c230c,_0x47d8ff){return db[_0x6664('0x2d')]['describe']()[_0x6664('0x26')](respondWithResult(_0x47d8ff,null))[_0x6664('0x4d')](handleError(_0x47d8ff,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 57a5750..1ae1801 100644 --- a/server/api/squareReport/squareReport.model.js +++ b/server/api/squareReport/squareReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1df=['../../config/environment','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x53a7c0,_0xc62e44){var _0x42a478=function(_0x477dec){while(--_0x477dec){_0x53a7c0['push'](_0x53a7c0['shift']());}};_0x42a478(++_0xc62e44);}(_0xf1df,0x88));var _0xff1d=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xf1df[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xff1d('0x0'));var util=require(_0xff1d('0x1'));var logger=require(_0xff1d('0x2'))(_0xff1d('0x3'));var moment=require(_0xff1d('0x4'));var BPromise=require(_0xff1d('0x5'));var rp=require(_0xff1d('0x6'));var fs=require('fs');var path=require(_0xff1d('0x7'));var rimraf=require('rimraf');var config=require(_0xff1d('0x8'));var attributes=require('./squareReport.attributes');module[_0xff1d('0x9')]=function(_0xade73a,_0x124e3e){return _0xade73a[_0xff1d('0xa')](_0xff1d('0xb'),attributes,{'tableName':_0xff1d('0xc'),'paranoid':![],'indexes':[{'name':_0xff1d('0xd'),'fields':['uniqueid',_0xff1d('0xe')]},{'name':_0xff1d('0xf'),'fields':[_0xff1d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc38=['rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x129a05,_0x1a3093){var _0x326eae=function(_0x29ad27){while(--_0x29ad27){_0x129a05['push'](_0x129a05['shift']());}};_0x326eae(++_0x1a3093);}(_0xfc38,0xa3));var _0x8fc3=function(_0x23f3a2,_0x329e9e){_0x23f3a2=_0x23f3a2-0x0;var _0x455aa9=_0xfc38[_0x23f3a2];return _0x455aa9;};'use strict';var _=require(_0x8fc3('0x0'));var util=require(_0x8fc3('0x1'));var logger=require(_0x8fc3('0x2'))(_0x8fc3('0x3'));var moment=require(_0x8fc3('0x4'));var BPromise=require(_0x8fc3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fc3('0x6'));var rimraf=require(_0x8fc3('0x7'));var config=require('../../config/environment');var attributes=require(_0x8fc3('0x8'));module[_0x8fc3('0x9')]=function(_0x3c5e7f,_0x33aa3c){return _0x3c5e7f[_0x8fc3('0xa')](_0x8fc3('0xb'),attributes,{'tableName':_0x8fc3('0xc'),'paranoid':![],'indexes':[{'name':_0x8fc3('0xd'),'fields':[_0x8fc3('0xe'),_0x8fc3('0xf')]},{'name':_0x8fc3('0x10'),'fields':[_0x8fc3('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4adca65..a7109d3 100644 --- a/server/api/squareReport/squareReport.rpc.js +++ b/server/api/squareReport/squareReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x625f=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x595995,_0x4def88){var _0x1bf997=function(_0x2406f0){while(--_0x2406f0){_0x595995['push'](_0x595995['shift']());}};_0x1bf997(++_0x4def88);}(_0x625f,0x1e1));var _0xf625=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x625f[_0x29632e];return _0x426e04;};'use strict';var _=require('lodash');var util=require(_0xf625('0x0'));var moment=require('moment');var BPromise=require(_0xf625('0x1'));var rs=require(_0xf625('0x2'));var fs=require('fs');var Redis=require(_0xf625('0x3'));var db=require(_0xf625('0x4'))['db'];var utils=require(_0xf625('0x5'));var logger=require('../../config/logger')(_0xf625('0x6'));var config=require('../../config/environment');var jayson=require(_0xf625('0x7'));var client=jayson['client'][_0xf625('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3436de,_0x3af250,_0x45fcb1){return new BPromise(function(_0x3623f3,_0x591963){return client[_0xf625('0x9')](_0x3436de,_0x45fcb1)[_0xf625('0xa')](function(_0x420ecc){logger[_0xf625('0xb')](_0xf625('0xc'),_0x3af250,_0xf625('0xd'));logger[_0xf625('0xe')](_0xf625('0xf'),_0x3af250,_0xf625('0xd'),JSON[_0xf625('0x10')](_0x420ecc));if(_0x420ecc['error']){if(_0x420ecc[_0xf625('0x11')]['code']===0x1f4){logger[_0xf625('0x11')]('SquareReport,\x20%s,\x20%s',_0x3af250,_0x420ecc[_0xf625('0x11')][_0xf625('0x12')]);return _0x591963(_0x420ecc[_0xf625('0x11')][_0xf625('0x12')]);}logger[_0xf625('0x11')](_0xf625('0xc'),_0x3af250,_0x420ecc[_0xf625('0x11')][_0xf625('0x12')]);return _0x3623f3(_0x420ecc[_0xf625('0x11')][_0xf625('0x12')]);}else{logger[_0xf625('0xb')](_0xf625('0xc'),_0x3af250,'request\x20sent');_0x3623f3(_0x420ecc[_0xf625('0x13')][_0xf625('0x12')]);}})[_0xf625('0x14')](function(_0x1ad37b){logger['error'](_0xf625('0xc'),_0x3af250,_0x1ad37b);_0x591963(_0x1ad37b);});});}exports[_0xf625('0x15')]=function(_0x34d17f){var _0x44e7da=this;return new Promise(function(_0x2b746b,_0x4cd183){return db['SquareReport'][_0xf625('0x16')](_0x34d17f[_0xf625('0x17')],{'raw':_0x34d17f[_0xf625('0x18')]?_0x34d17f[_0xf625('0x18')][_0xf625('0x19')]===undefined?!![]:![]:!![]})[_0xf625('0xa')](function(_0x42cfbb){logger['info'](_0xf625('0x15'),_0x34d17f);logger[_0xf625('0xe')](_0xf625('0x15'),_0x34d17f,JSON['stringify'](_0x42cfbb));_0x2b746b(_0x42cfbb);})[_0xf625('0x14')](function(_0x3f959f){logger[_0xf625('0x11')](_0xf625('0x15'),_0x3f959f[_0xf625('0x12')],_0x34d17f);_0x4cd183(_0x44e7da[_0xf625('0x11')](0x1f4,_0x3f959f[_0xf625('0x12')]));});});};exports[_0xf625('0x1a')]=function(_0x4b3684){var _0x1d5be6=this;return new Promise(function(_0x103192,_0x3e6eea){return db[_0xf625('0x1b')]['update'](_0x4b3684[_0xf625('0x17')],{'raw':_0x4b3684[_0xf625('0x18')]?_0x4b3684[_0xf625('0x18')][_0xf625('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3684[_0xf625('0x18')]?_0x4b3684['options'][_0xf625('0x1c')]||null:null,'attributes':_0x4b3684[_0xf625('0x18')]?_0x4b3684[_0xf625('0x18')][_0xf625('0x1d')]||null:null,'limit':_0x4b3684[_0xf625('0x18')]?_0x4b3684[_0xf625('0x18')][_0xf625('0x1e')]||null:null})[_0xf625('0xa')](function(_0x12b588){logger[_0xf625('0xb')](_0xf625('0x1a'),_0x4b3684);logger[_0xf625('0xe')](_0xf625('0x1a'),_0x4b3684,JSON[_0xf625('0x10')](_0x12b588));_0x103192(_0x12b588);})[_0xf625('0x14')](function(_0x425fb3){logger[_0xf625('0x11')](_0xf625('0x1a'),_0x425fb3[_0xf625('0x12')],_0x4b3684);_0x3e6eea(_0x1d5be6['error'](0x1f4,_0x425fb3[_0xf625('0x12')]));});});}; \ No newline at end of file +var _0xfd6e=['debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','info','UpdateSquareReport','attributes','limit','catch','lodash','moment','randomstring','ioredis','rpc','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1b4912,_0x3e8bb9){var _0x48cac5=function(_0x55798b){while(--_0x55798b){_0x1b4912['push'](_0x1b4912['shift']());}};_0x48cac5(++_0x3e8bb9);}(_0xfd6e,0x16e));var _0xefd6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xfd6e[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xefd6('0x0'));var util=require('util');var moment=require(_0xefd6('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd6('0x2'));var fs=require('fs');var Redis=require(_0xefd6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xefd6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xefd6('0x5')][_0xefd6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x26e108,_0xe477f9,_0x340765){return new BPromise(function(_0x5da399,_0x59c636){return client[_0xefd6('0x7')](_0x26e108,_0x340765)[_0xefd6('0x8')](function(_0x3c941a){logger['info'](_0xefd6('0x9'),_0xe477f9,_0xefd6('0xa'));logger[_0xefd6('0xb')](_0xefd6('0xc'),_0xe477f9,'request\x20sent',JSON[_0xefd6('0xd')](_0x3c941a));if(_0x3c941a[_0xefd6('0xe')]){if(_0x3c941a[_0xefd6('0xe')][_0xefd6('0xf')]===0x1f4){logger[_0xefd6('0xe')](_0xefd6('0x9'),_0xe477f9,_0x3c941a[_0xefd6('0xe')][_0xefd6('0x10')]);return _0x59c636(_0x3c941a['error'][_0xefd6('0x10')]);}logger[_0xefd6('0xe')](_0xefd6('0x9'),_0xe477f9,_0x3c941a[_0xefd6('0xe')][_0xefd6('0x10')]);return _0x5da399(_0x3c941a['error'][_0xefd6('0x10')]);}else{logger['info'](_0xefd6('0x9'),_0xe477f9,'request\x20sent');_0x5da399(_0x3c941a[_0xefd6('0x11')][_0xefd6('0x10')]);}})['catch'](function(_0x17bf20){logger[_0xefd6('0xe')](_0xefd6('0x9'),_0xe477f9,_0x17bf20);_0x59c636(_0x17bf20);});});}exports[_0xefd6('0x12')]=function(_0xd59458){var _0x306ad1=this;return new Promise(function(_0x469c17,_0x137e6d){return db[_0xefd6('0x13')][_0xefd6('0x14')](_0xd59458[_0xefd6('0x15')],{'raw':_0xd59458['options']?_0xd59458[_0xefd6('0x16')][_0xefd6('0x17')]===undefined?!![]:![]:!![]})[_0xefd6('0x8')](function(_0x3a26c5){logger[_0xefd6('0x18')](_0xefd6('0x12'),_0xd59458);logger['debug'](_0xefd6('0x12'),_0xd59458,JSON[_0xefd6('0xd')](_0x3a26c5));_0x469c17(_0x3a26c5);})['catch'](function(_0x2b0442){logger[_0xefd6('0xe')](_0xefd6('0x12'),_0x2b0442['message'],_0xd59458);_0x137e6d(_0x306ad1['error'](0x1f4,_0x2b0442[_0xefd6('0x10')]));});});};exports[_0xefd6('0x19')]=function(_0xe763eb){var _0x587f2a=this;return new Promise(function(_0x6e7929,_0x351a6d){return db[_0xefd6('0x13')]['update'](_0xe763eb[_0xefd6('0x15')],{'raw':_0xe763eb[_0xefd6('0x16')]?_0xe763eb['options'][_0xefd6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe763eb[_0xefd6('0x16')]?_0xe763eb[_0xefd6('0x16')]['where']||null:null,'attributes':_0xe763eb[_0xefd6('0x16')]?_0xe763eb[_0xefd6('0x16')][_0xefd6('0x1a')]||null:null,'limit':_0xe763eb[_0xefd6('0x16')]?_0xe763eb[_0xefd6('0x16')][_0xefd6('0x1b')]||null:null})[_0xefd6('0x8')](function(_0x1783d7){logger['info'](_0xefd6('0x19'),_0xe763eb);logger[_0xefd6('0xb')](_0xefd6('0x19'),_0xe763eb,JSON[_0xefd6('0xd')](_0x1783d7));_0x6e7929(_0x1783d7);})[_0xefd6('0x1c')](function(_0x5aed31){logger[_0xefd6('0xe')](_0xefd6('0x19'),_0x5aed31[_0xefd6('0x10')],_0xe763eb);_0x351a6d(_0x587f2a[_0xefd6('0xe')](0x1f4,_0x5aed31[_0xefd6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index e9dbab4..c73ee1d 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdf4=['delete','destroy','exports','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','/describe','isAuthenticated','describe','get','/:id','create','put','update'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xcdf4,0x153));var _0x4cdf=function(_0x2fc75b,_0xc58375){_0x2fc75b=_0x2fc75b-0x0;var _0x45319a=_0xcdf4[_0x2fc75b];return _0x45319a;};'use strict';var multer=require('multer');var util=require(_0x4cdf('0x0'));var path=require('path');var timeout=require(_0x4cdf('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4cdf('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x4cdf('0x3'));var config=require(_0x4cdf('0x4'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4cdf('0x5'),auth[_0x4cdf('0x6')](),controller[_0x4cdf('0x7')]);router[_0x4cdf('0x8')](_0x4cdf('0x9'),auth[_0x4cdf('0x6')](),controller['show']);router['post']('/',auth[_0x4cdf('0x6')](),controller[_0x4cdf('0xa')]);router[_0x4cdf('0xb')](_0x4cdf('0x9'),auth[_0x4cdf('0x6')](),controller[_0x4cdf('0xc')]);router[_0x4cdf('0xd')]('/:id',auth[_0x4cdf('0x6')](),controller[_0x4cdf('0xe')]);module[_0x4cdf('0xf')]=router; \ No newline at end of file +var _0x4f08=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x4f08,0x14a));var _0x84f0=function(_0x3ee1e8,_0x328a22){_0x3ee1e8=_0x3ee1e8-0x0;var _0x8048d4=_0x4f08[_0x3ee1e8];return _0x8048d4;};'use strict';var multer=require(_0x84f0('0x0'));var util=require('util');var path=require(_0x84f0('0x1'));var timeout=require('connect-timeout');var express=require(_0x84f0('0x2'));var router=express[_0x84f0('0x3')]();var fs_extra=require(_0x84f0('0x4'));var auth=require(_0x84f0('0x5'));var interaction=require(_0x84f0('0x6'));var config=require('../../config/environment');var controller=require(_0x84f0('0x7'));router[_0x84f0('0x8')]('/',auth[_0x84f0('0x9')](),controller['index']);router[_0x84f0('0x8')](_0x84f0('0xa'),auth['isAuthenticated'](),controller[_0x84f0('0xb')]);router[_0x84f0('0x8')](_0x84f0('0xc'),auth[_0x84f0('0x9')](),controller[_0x84f0('0xd')]);router[_0x84f0('0xe')]('/',auth[_0x84f0('0x9')](),controller[_0x84f0('0xf')]);router[_0x84f0('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x84f0('0x11')]);router[_0x84f0('0x12')]('/:id',auth[_0x84f0('0x9')](),controller[_0x84f0('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 21853e8..ca24766 100644 --- a/server/api/squareReportDetail/squareReportDetail.attributes.js +++ b/server/api/squareReportDetail/squareReportDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x649b=['TEXT','exports','STRING'];(function(_0x1f16a5,_0x4cf74c){var _0x4a1e18=function(_0x25a61f){while(--_0x25a61f){_0x1f16a5['push'](_0x1f16a5['shift']());}};_0x4a1e18(++_0x4cf74c);}(_0x649b,0x15d));var _0xb649=function(_0x233126,_0x62a15){_0x233126=_0x233126-0x0;var _0x16da1a=_0x649b[_0x233126];return _0x16da1a;};'use strict';var Sequelize=require('sequelize');module[_0xb649('0x0')]={'uniqueid':{'type':Sequelize[_0xb649('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xb649('0x1')]},'data':{'type':Sequelize[_0xb649('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb649('0x1')]}}; \ No newline at end of file +var _0xf51a=['sequelize','exports','STRING'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0xf51a,0x144));var _0xaf51=function(_0x5ec099,_0x5ed784){_0x5ec099=_0x5ec099-0x0;var _0x5034f4=_0xf51a[_0x5ec099];return _0x5034f4;};'use strict';var Sequelize=require(_0xaf51('0x0'));module[_0xaf51('0x1')]={'uniqueid':{'type':Sequelize[_0xaf51('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xaf51('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xaf51('0x2')]},'callerid':{'type':Sequelize[_0xaf51('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index cc5e723..9e9b806 100644 --- a/server/api/squareReportDetail/squareReportDetail.controller.js +++ b/server/api/squareReportDetail/squareReportDetail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb01f=['pick','filter','where','merge','VIRTUAL','options','SquareDetailsReport','include','catch','show','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x3c2889,_0x1f4fe2){var _0x24ebe0=function(_0x50b0f8){while(--_0x50b0f8){_0x3c2889['push'](_0x3c2889['shift']());}};_0x24ebe0(++_0x1f4fe2);}(_0xb01f,0xa5));var _0xfb01=function(_0x5ac5ee,_0x23bd4f){_0x5ac5ee=_0x5ac5ee-0x0;var _0x140189=_0xb01f[_0x5ac5ee];return _0x140189;};'use strict';var emlformat=require(_0xfb01('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb01('0x1'));var jsonpatch=require(_0xfb01('0x2'));var rp=require(_0xfb01('0x3'));var moment=require(_0xfb01('0x4'));var BPromise=require(_0xfb01('0x5'));var Mustache=require('mustache');var util=require(_0xfb01('0x6'));var path=require(_0xfb01('0x7'));var sox=require(_0xfb01('0x8'));var csv=require('to-csv');var ejs=require(_0xfb01('0x9'));var fs=require('fs');var fs_extra=require(_0xfb01('0xa'));var _=require(_0xfb01('0xb'));var squel=require(_0xfb01('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb01('0xd'));var deskjs=require(_0xfb01('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfb01('0xf'));var Papa=require(_0xfb01('0x10'));var Redis=require('ioredis');var authService=require(_0xfb01('0x11'));var qs=require(_0xfb01('0x12'));var as=require(_0xfb01('0x13'));var hardwareService=require(_0xfb01('0x14'));var logger=require(_0xfb01('0x15'))(_0xfb01('0x16'));var utils=require('../../config/utils');var config=require(_0xfb01('0x17'));var licenseUtil=require(_0xfb01('0x18'));var db=require(_0xfb01('0x19'))['db'];function respondWithStatusCode(_0x247d1f,_0x3efb02){_0x3efb02=_0x3efb02||0xcc;return function(_0x1a2d2b){if(_0x1a2d2b){return _0x247d1f[_0xfb01('0x1a')](_0x3efb02);}return _0x247d1f[_0xfb01('0x1b')](_0x3efb02)[_0xfb01('0x1c')]();};}function respondWithResult(_0x562dac,_0x57fc75){_0x57fc75=_0x57fc75||0xc8;return function(_0x45a2b8){if(_0x45a2b8){return _0x562dac[_0xfb01('0x1b')](_0x57fc75)[_0xfb01('0x1d')](_0x45a2b8);}};}function respondWithFilteredResult(_0x51f7ee,_0xa443ff){return function(_0x2a2478){if(_0x2a2478){var _0x226337=typeof _0xa443ff[_0xfb01('0x1e')]===_0xfb01('0x1f')&&typeof _0xa443ff[_0xfb01('0x20')]==='undefined';var _0x1cef13=_0x2a2478['count'];var _0xcaeaa4=_0x226337?0x0:_0xa443ff[_0xfb01('0x1e')];var _0x56fe8f=_0x226337?_0x2a2478[_0xfb01('0x21')]:_0xa443ff[_0xfb01('0x1e')]+_0xa443ff[_0xfb01('0x20')];var _0x16a628;if(_0x56fe8f>=_0x1cef13){_0x56fe8f=_0x1cef13;_0x16a628=0xc8;}else{_0x16a628=0xce;}_0x51f7ee['status'](_0x16a628);return _0x51f7ee['set'](_0xfb01('0x22'),_0xcaeaa4+'-'+_0x56fe8f+'/'+_0x1cef13)['json'](_0x2a2478);}return null;};}function patchUpdates(_0x2f58e1){return function(_0x8a281){try{jsonpatch[_0xfb01('0x23')](_0x8a281,_0x2f58e1,!![]);}catch(_0x5b60f9){return BPromise[_0xfb01('0x24')](_0x5b60f9);}return _0x8a281['save']();};}function saveUpdates(_0x536d3,_0x585fea){return function(_0x1f206d){if(_0x1f206d){return _0x1f206d[_0xfb01('0x25')](_0x536d3)[_0xfb01('0x26')](function(_0x4646eb){return _0x4646eb;});}return null;};}function removeEntity(_0x557a3,_0x534fc8){return function(_0x14303d){if(_0x14303d){return _0x14303d[_0xfb01('0x27')]()[_0xfb01('0x26')](function(){_0x557a3[_0xfb01('0x1b')](0xcc)[_0xfb01('0x1c')]();});}};}function handleEntityNotFound(_0x3dc2b0,_0x3dfd26){return function(_0x2ee654){if(!_0x2ee654){_0x3dc2b0[_0xfb01('0x1a')](0x194);}return _0x2ee654;};}function handleError(_0x57a6db,_0x4999a9){_0x4999a9=_0x4999a9||0x1f4;return function(_0x49b950){logger[_0xfb01('0x28')](_0x49b950[_0xfb01('0x29')]);if(_0x49b950[_0xfb01('0x2a')]){delete _0x49b950[_0xfb01('0x2a')];}_0x57a6db[_0xfb01('0x1b')](_0x4999a9)[_0xfb01('0x2b')](_0x49b950);};}exports[_0xfb01('0x2c')]=function(_0x400da4,_0x34ee1c){var _0x591e0c={},_0x49dbf2={},_0x187968={'count':0x0,'rows':[]};var _0x5a7536=_[_0xfb01('0x2d')](db['SquareDetailsReport'][_0xfb01('0x2e')],function(_0x17ec9f){return{'name':_0x17ec9f['fieldName'],'type':_0x17ec9f[_0xfb01('0x2f')][_0xfb01('0x30')]};});_0x49dbf2[_0xfb01('0x31')]=_[_0xfb01('0x2d')](_0x5a7536,'name');_0x49dbf2[_0xfb01('0x32')]=_[_0xfb01('0x33')](_0x400da4[_0xfb01('0x32')]);_0x49dbf2[_0xfb01('0x34')]=_[_0xfb01('0x35')](_0x49dbf2[_0xfb01('0x31')],_0x49dbf2[_0xfb01('0x32')]);_0x591e0c[_0xfb01('0x36')]=_['intersection'](_0x49dbf2[_0xfb01('0x31')],qs[_0xfb01('0x37')](_0x400da4[_0xfb01('0x32')]['fields']));_0x591e0c[_0xfb01('0x36')]=_0x591e0c[_0xfb01('0x36')]['length']?_0x591e0c['attributes']:_0x49dbf2['model'];if(!_0x400da4[_0xfb01('0x32')][_0xfb01('0x38')](_0xfb01('0x39'))){_0x591e0c[_0xfb01('0x20')]=qs['limit'](_0x400da4[_0xfb01('0x32')]['limit']);_0x591e0c[_0xfb01('0x1e')]=qs[_0xfb01('0x1e')](_0x400da4[_0xfb01('0x32')]['offset']);}_0x591e0c[_0xfb01('0x3a')]=qs[_0xfb01('0x3b')](_0x400da4[_0xfb01('0x32')]['sort']);_0x591e0c['where']=qs['filters'](_[_0xfb01('0x3c')](_0x400da4[_0xfb01('0x32')],_0x49dbf2[_0xfb01('0x34')]),_0x5a7536);if(_0x400da4[_0xfb01('0x32')][_0xfb01('0x3d')]){_0x591e0c[_0xfb01('0x3e')]=_[_0xfb01('0x3f')](_0x591e0c[_0xfb01('0x3e')],{'$or':_[_0xfb01('0x2d')](_0x5a7536,function(_0x58623e){if(_0x58623e['type']!==_0xfb01('0x40')){var _0x4b5399={};_0x4b5399[_0x58623e[_0xfb01('0x2a')]]={'$like':'%'+_0x400da4[_0xfb01('0x32')]['filter']+'%'};return _0x4b5399;}})});}_0x591e0c=_[_0xfb01('0x3f')]({},_0x591e0c,_0x400da4[_0xfb01('0x41')]);var _0x45a947={'where':_0x591e0c[_0xfb01('0x3e')]};return db[_0xfb01('0x42')]['count'](_0x45a947)[_0xfb01('0x26')](function(_0x228275){_0x187968[_0xfb01('0x21')]=_0x228275;if(_0x400da4['query']['includeAll']){_0x591e0c[_0xfb01('0x43')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x591e0c);})['then'](function(_0x462bd2){_0x187968['rows']=_0x462bd2;return _0x187968;})[_0xfb01('0x26')](respondWithFilteredResult(_0x34ee1c,_0x591e0c))[_0xfb01('0x44')](handleError(_0x34ee1c,null));};exports[_0xfb01('0x45')]=function(_0x1866eb,_0x1b279f){var _0x1b9f12={'raw':!![],'where':{'id':_0x1866eb['params']['id']}},_0x2c5523={};_0x2c5523[_0xfb01('0x31')]=_['keys'](db[_0xfb01('0x42')]['rawAttributes']);_0x2c5523[_0xfb01('0x32')]=_[_0xfb01('0x33')](_0x1866eb[_0xfb01('0x32')]);_0x2c5523[_0xfb01('0x34')]=_['intersection'](_0x2c5523[_0xfb01('0x31')],_0x2c5523[_0xfb01('0x32')]);_0x1b9f12[_0xfb01('0x36')]=_[_0xfb01('0x35')](_0x2c5523[_0xfb01('0x31')],qs['fields'](_0x1866eb[_0xfb01('0x32')][_0xfb01('0x37')]));_0x1b9f12[_0xfb01('0x36')]=_0x1b9f12[_0xfb01('0x36')][_0xfb01('0x46')]?_0x1b9f12[_0xfb01('0x36')]:_0x2c5523[_0xfb01('0x31')];if(_0x1866eb[_0xfb01('0x32')]['includeAll']){_0x1b9f12[_0xfb01('0x43')]=[{'all':!![]}];}_0x1b9f12=_[_0xfb01('0x3f')]({},_0x1b9f12,_0x1866eb[_0xfb01('0x41')]);return db[_0xfb01('0x42')][_0xfb01('0x47')](_0x1b9f12)[_0xfb01('0x26')](handleEntityNotFound(_0x1b279f,null))[_0xfb01('0x26')](respondWithResult(_0x1b279f,null))[_0xfb01('0x44')](handleError(_0x1b279f,null));};exports[_0xfb01('0x48')]=function(_0x676cd7,_0xe85a95){return db[_0xfb01('0x42')][_0xfb01('0x48')](_0x676cd7['body'],{})['then'](respondWithResult(_0xe85a95,0xc9))[_0xfb01('0x44')](handleError(_0xe85a95,null));};exports[_0xfb01('0x25')]=function(_0x240527,_0x33d403){if(_0x240527[_0xfb01('0x49')]['id']){delete _0x240527[_0xfb01('0x49')]['id'];}return db[_0xfb01('0x42')][_0xfb01('0x47')]({'where':{'id':_0x240527[_0xfb01('0x4a')]['id']}})[_0xfb01('0x26')](handleEntityNotFound(_0x33d403,null))[_0xfb01('0x26')](saveUpdates(_0x240527[_0xfb01('0x49')],null))['then'](respondWithResult(_0x33d403,null))[_0xfb01('0x44')](handleError(_0x33d403,null));};exports[_0xfb01('0x27')]=function(_0x304d76,_0x48693a){return db[_0xfb01('0x42')]['find']({'where':{'id':_0x304d76['params']['id']}})[_0xfb01('0x26')](handleEntityNotFound(_0x48693a,null))['then'](removeEntity(_0x48693a,null))[_0xfb01('0x44')](handleError(_0x48693a,null));};exports['describe']=function(_0x48f29f,_0x3ab78d){return db[_0xfb01('0x42')]['describe']()['then'](respondWithResult(_0x3ab78d,null))[_0xfb01('0x44')](handleError(_0x3ab78d,null));}; \ No newline at end of file +var _0x06d6=['end','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','merge','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0x06d6,0x10a));var _0x606d=function(_0x34b1fa,_0x5e0184){_0x34b1fa=_0x34b1fa-0x0;var _0x18f15e=_0x06d6[_0x34b1fa];return _0x18f15e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x606d('0x0'));var zipdir=require(_0x606d('0x1'));var jsonpatch=require(_0x606d('0x2'));var rp=require('request-promise');var moment=require(_0x606d('0x3'));var BPromise=require(_0x606d('0x4'));var Mustache=require(_0x606d('0x5'));var util=require(_0x606d('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x606d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x606d('0x8'));var squel=require('squel');var crypto=require(_0x606d('0x9'));var jsforce=require(_0x606d('0xa'));var deskjs=require(_0x606d('0xb'));var toCsv=require(_0x606d('0xc'));var querystring=require('querystring');var Papa=require(_0x606d('0xd'));var Redis=require(_0x606d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x606d('0xf'));var as=require(_0x606d('0x10'));var hardwareService=require(_0x606d('0x11'));var logger=require(_0x606d('0x12'))(_0x606d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x606d('0x14'));var db=require(_0x606d('0x15'))['db'];function respondWithStatusCode(_0x574f01,_0x4eaff9){_0x4eaff9=_0x4eaff9||0xcc;return function(_0x56289b){if(_0x56289b){return _0x574f01[_0x606d('0x16')](_0x4eaff9);}return _0x574f01[_0x606d('0x17')](_0x4eaff9)['end']();};}function respondWithResult(_0x2f6da5,_0xac1f62){_0xac1f62=_0xac1f62||0xc8;return function(_0x12fa84){if(_0x12fa84){return _0x2f6da5[_0x606d('0x17')](_0xac1f62)['json'](_0x12fa84);}};}function respondWithFilteredResult(_0x1e98ae,_0x4b9e68){return function(_0x1e343b){if(_0x1e343b){var _0x3bebb2=typeof _0x4b9e68[_0x606d('0x18')]===_0x606d('0x19')&&typeof _0x4b9e68[_0x606d('0x1a')]==='undefined';var _0x2f02cd=_0x1e343b[_0x606d('0x1b')];var _0x1be3dc=_0x3bebb2?0x0:_0x4b9e68['offset'];var _0x43c7c9=_0x3bebb2?_0x1e343b[_0x606d('0x1b')]:_0x4b9e68[_0x606d('0x18')]+_0x4b9e68[_0x606d('0x1a')];var _0x8bf1c2;if(_0x43c7c9>=_0x2f02cd){_0x43c7c9=_0x2f02cd;_0x8bf1c2=0xc8;}else{_0x8bf1c2=0xce;}_0x1e98ae[_0x606d('0x17')](_0x8bf1c2);return _0x1e98ae[_0x606d('0x1c')](_0x606d('0x1d'),_0x1be3dc+'-'+_0x43c7c9+'/'+_0x2f02cd)['json'](_0x1e343b);}return null;};}function patchUpdates(_0x28ecb1){return function(_0x2fe333){try{jsonpatch[_0x606d('0x1e')](_0x2fe333,_0x28ecb1,!![]);}catch(_0x1970c0){return BPromise['reject'](_0x1970c0);}return _0x2fe333[_0x606d('0x1f')]();};}function saveUpdates(_0x404608,_0x3c4068){return function(_0x46dc49){if(_0x46dc49){return _0x46dc49['update'](_0x404608)[_0x606d('0x20')](function(_0x1d7771){return _0x1d7771;});}return null;};}function removeEntity(_0x39886a,_0x1175ef){return function(_0x3fcc09){if(_0x3fcc09){return _0x3fcc09[_0x606d('0x21')]()['then'](function(){_0x39886a['status'](0xcc)[_0x606d('0x22')]();});}};}function handleEntityNotFound(_0x13bd7f,_0x2e0d6e){return function(_0x3b1529){if(!_0x3b1529){_0x13bd7f[_0x606d('0x16')](0x194);}return _0x3b1529;};}function handleError(_0xc05baf,_0x5813a4){_0x5813a4=_0x5813a4||0x1f4;return function(_0x3bbbe0){logger[_0x606d('0x23')](_0x3bbbe0[_0x606d('0x24')]);if(_0x3bbbe0[_0x606d('0x25')]){delete _0x3bbbe0[_0x606d('0x25')];}_0xc05baf[_0x606d('0x17')](_0x5813a4)[_0x606d('0x26')](_0x3bbbe0);};}exports[_0x606d('0x27')]=function(_0x3c1f48,_0x3fc2f2){var _0x5dad23={},_0x4c97ca={},_0x17a058={'count':0x0,'rows':[]};var _0x179ace=_[_0x606d('0x28')](db[_0x606d('0x29')][_0x606d('0x2a')],function(_0x54c68b){return{'name':_0x54c68b[_0x606d('0x2b')],'type':_0x54c68b['type'][_0x606d('0x2c')]};});_0x4c97ca[_0x606d('0x2d')]=_[_0x606d('0x28')](_0x179ace,_0x606d('0x25'));_0x4c97ca[_0x606d('0x2e')]=_[_0x606d('0x2f')](_0x3c1f48[_0x606d('0x2e')]);_0x4c97ca[_0x606d('0x30')]=_['intersection'](_0x4c97ca[_0x606d('0x2d')],_0x4c97ca[_0x606d('0x2e')]);_0x5dad23[_0x606d('0x31')]=_['intersection'](_0x4c97ca[_0x606d('0x2d')],qs[_0x606d('0x32')](_0x3c1f48[_0x606d('0x2e')][_0x606d('0x32')]));_0x5dad23[_0x606d('0x31')]=_0x5dad23[_0x606d('0x31')]['length']?_0x5dad23['attributes']:_0x4c97ca[_0x606d('0x2d')];if(!_0x3c1f48[_0x606d('0x2e')]['hasOwnProperty'](_0x606d('0x33'))){_0x5dad23['limit']=qs[_0x606d('0x1a')](_0x3c1f48[_0x606d('0x2e')][_0x606d('0x1a')]);_0x5dad23[_0x606d('0x18')]=qs['offset'](_0x3c1f48[_0x606d('0x2e')][_0x606d('0x18')]);}_0x5dad23[_0x606d('0x34')]=qs['sort'](_0x3c1f48['query'][_0x606d('0x35')]);_0x5dad23[_0x606d('0x36')]=qs['filters'](_[_0x606d('0x37')](_0x3c1f48[_0x606d('0x2e')],_0x4c97ca['filters']),_0x179ace);if(_0x3c1f48[_0x606d('0x2e')][_0x606d('0x38')]){_0x5dad23['where']=_['merge'](_0x5dad23[_0x606d('0x36')],{'$or':_['map'](_0x179ace,function(_0x4a3348){if(_0x4a3348[_0x606d('0x39')]!==_0x606d('0x3a')){var _0x4979f1={};_0x4979f1[_0x4a3348[_0x606d('0x25')]]={'$like':'%'+_0x3c1f48[_0x606d('0x2e')]['filter']+'%'};return _0x4979f1;}})});}_0x5dad23=_['merge']({},_0x5dad23,_0x3c1f48[_0x606d('0x3b')]);var _0x436921={'where':_0x5dad23['where']};return db['SquareDetailsReport'][_0x606d('0x1b')](_0x436921)[_0x606d('0x20')](function(_0x527b3d){_0x17a058['count']=_0x527b3d;if(_0x3c1f48[_0x606d('0x2e')][_0x606d('0x3c')]){_0x5dad23[_0x606d('0x3d')]=[{'all':!![]}];}return db[_0x606d('0x29')][_0x606d('0x3e')](_0x5dad23);})['then'](function(_0x5ccf0c){_0x17a058[_0x606d('0x3f')]=_0x5ccf0c;return _0x17a058;})[_0x606d('0x20')](respondWithFilteredResult(_0x3fc2f2,_0x5dad23))[_0x606d('0x40')](handleError(_0x3fc2f2,null));};exports[_0x606d('0x41')]=function(_0x5049b6,_0x2403ac){var _0x45027f={'raw':!![],'where':{'id':_0x5049b6[_0x606d('0x42')]['id']}},_0x5d42a6={};_0x5d42a6['model']=_[_0x606d('0x2f')](db[_0x606d('0x29')][_0x606d('0x2a')]);_0x5d42a6[_0x606d('0x2e')]=_[_0x606d('0x2f')](_0x5049b6[_0x606d('0x2e')]);_0x5d42a6[_0x606d('0x30')]=_[_0x606d('0x43')](_0x5d42a6[_0x606d('0x2d')],_0x5d42a6[_0x606d('0x2e')]);_0x45027f[_0x606d('0x31')]=_['intersection'](_0x5d42a6[_0x606d('0x2d')],qs[_0x606d('0x32')](_0x5049b6['query'][_0x606d('0x32')]));_0x45027f[_0x606d('0x31')]=_0x45027f[_0x606d('0x31')][_0x606d('0x44')]?_0x45027f['attributes']:_0x5d42a6[_0x606d('0x2d')];if(_0x5049b6[_0x606d('0x2e')][_0x606d('0x3c')]){_0x45027f['include']=[{'all':!![]}];}_0x45027f=_[_0x606d('0x45')]({},_0x45027f,_0x5049b6[_0x606d('0x3b')]);return db[_0x606d('0x29')][_0x606d('0x46')](_0x45027f)[_0x606d('0x20')](handleEntityNotFound(_0x2403ac,null))[_0x606d('0x20')](respondWithResult(_0x2403ac,null))[_0x606d('0x40')](handleError(_0x2403ac,null));};exports['create']=function(_0xbe0d33,_0x45ed84){return db[_0x606d('0x29')][_0x606d('0x47')](_0xbe0d33[_0x606d('0x48')],{})['then'](respondWithResult(_0x45ed84,0xc9))['catch'](handleError(_0x45ed84,null));};exports[_0x606d('0x49')]=function(_0xd63422,_0x335606){if(_0xd63422[_0x606d('0x48')]['id']){delete _0xd63422[_0x606d('0x48')]['id'];}return db['SquareDetailsReport'][_0x606d('0x46')]({'where':{'id':_0xd63422[_0x606d('0x42')]['id']}})[_0x606d('0x20')](handleEntityNotFound(_0x335606,null))['then'](saveUpdates(_0xd63422[_0x606d('0x48')],null))['then'](respondWithResult(_0x335606,null))['catch'](handleError(_0x335606,null));};exports[_0x606d('0x21')]=function(_0x5e8cad,_0x366189){return db[_0x606d('0x29')][_0x606d('0x46')]({'where':{'id':_0x5e8cad[_0x606d('0x42')]['id']}})[_0x606d('0x20')](handleEntityNotFound(_0x366189,null))['then'](removeEntity(_0x366189,null))['catch'](handleError(_0x366189,null));};exports['describe']=function(_0x3695e1,_0x581bfa){return db[_0x606d('0x29')][_0x606d('0x4a')]()['then'](respondWithResult(_0x581bfa,null))[_0x606d('0x40')](handleError(_0x581bfa,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index e2f6519..b924b88 100644 --- a/server/api/squareReportDetail/squareReportDetail.model.js +++ b/server/api/squareReportDetail/squareReportDetail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf551=['../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x5650cb,_0x5b9132){var _0x13bc22=function(_0x2454e0){while(--_0x2454e0){_0x5650cb['push'](_0x5650cb['shift']());}};_0x13bc22(++_0x5b9132);}(_0xf551,0x1e6));var _0x1f55=function(_0x459546,_0x482824){_0x459546=_0x459546-0x0;var _0x493bb0=_0xf551[_0x459546];return _0x493bb0;};'use strict';var _=require(_0x1f55('0x0'));var util=require(_0x1f55('0x1'));var logger=require(_0x1f55('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1f55('0x3'));var rp=require(_0x1f55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f55('0x5'));var config=require(_0x1f55('0x6'));var attributes=require(_0x1f55('0x7'));module[_0x1f55('0x8')]=function(_0x3d9768,_0x5cfb9d){return _0x3d9768[_0x1f55('0x9')](_0x1f55('0xa'),attributes,{'tableName':_0x1f55('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0be=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46e89e,_0x54f5a3){var _0x21af73=function(_0x50e1a1){while(--_0x50e1a1){_0x46e89e['push'](_0x46e89e['shift']());}};_0x21af73(++_0x54f5a3);}(_0xc0be,0x113));var _0xec0b=function(_0x1a2c5b,_0x16cee9){_0x1a2c5b=_0x1a2c5b-0x0;var _0x1efca7=_0xc0be[_0x1a2c5b];return _0x1efca7;};'use strict';var _=require(_0xec0b('0x0'));var util=require(_0xec0b('0x1'));var logger=require(_0xec0b('0x2'))(_0xec0b('0x3'));var moment=require(_0xec0b('0x4'));var BPromise=require(_0xec0b('0x5'));var rp=require(_0xec0b('0x6'));var fs=require('fs');var path=require(_0xec0b('0x7'));var rimraf=require(_0xec0b('0x8'));var config=require(_0xec0b('0x9'));var attributes=require(_0xec0b('0xa'));module[_0xec0b('0xb')]=function(_0x2cdfe7,_0x2dcc56){return _0x2cdfe7[_0xec0b('0xc')](_0xec0b('0xd'),attributes,{'tableName':_0xec0b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index c373008..aefbada 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw'];(function(_0x2fd770,_0x2bccac){var _0x184848=function(_0xbe5951){while(--_0xbe5951){_0x2fd770['push'](_0x2fd770['shift']());}};_0x184848(++_0x2bccac);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c568e,_0xc5e4b0){_0x5c568e=_0x5c568e-0x0;var _0x5aff74=_0xb10b[_0x5c568e];return _0x5aff74;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateSquareDetailsReport',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xa5fa=['../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x565d34,_0x4176da){var _0x3751e7=function(_0x42428b){while(--_0x42428b){_0x565d34['push'](_0x565d34['shift']());}};_0x3751e7(++_0x4176da);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x3af56a,_0x3e185f){_0x3af56a=_0x3af56a-0x0;var _0x440680=_0xa5fa[_0x3af56a];return _0x440680;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')](_0x3d874f[_0xaa5f('0x19')],{'raw':_0x3d874f[_0xaa5f('0x1a')]?_0x3d874f[_0xaa5f('0x1a')][_0xaa5f('0x1b')]===undefined?!![]:![]:!![]})[_0xaa5f('0x1c')](function(_0x194691){logger[_0xaa5f('0xc')](_0xaa5f('0x16'),_0x3d874f);logger[_0xaa5f('0xd')](_0xaa5f('0x16'),_0x3d874f,JSON[_0xaa5f('0xe')](_0x194691));_0x1019e8(_0x194691);})['catch'](function(_0x1e917d){logger['error'](_0xaa5f('0x16'),_0x1e917d[_0xaa5f('0x12')],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x1e917d[_0xaa5f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 426a696..c5e8aec 100644 --- a/server/api/system/index.js +++ b/server/api/system/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5518=['/process/:pid/kill','exports','../../components/auth/service','./system.controller','isAuthenticated','index','get'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x5518,0xb1));var _0x8551=function(_0xd7e1ac,_0x5d253b){_0xd7e1ac=_0xd7e1ac-0x0;var _0x270568=_0x5518[_0xd7e1ac];return _0x270568;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x8551('0x0'));var controller=require(_0x8551('0x1'));router['get']('/',auth[_0x8551('0x2')](),controller[_0x8551('0x3')]);router[_0x8551('0x4')](_0x8551('0x5'),auth[_0x8551('0x2')](),controller['killProcess']);module[_0x8551('0x6')]=router; \ No newline at end of file +var _0x1549=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports'];(function(_0x55447e,_0x5a209b){var _0x5bd6fd=function(_0x2b25e5){while(--_0x2b25e5){_0x55447e['push'](_0x55447e['shift']());}};_0x5bd6fd(++_0x5a209b);}(_0x1549,0x6c));var _0x9154=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x1549[_0x257642];return _0x3d813b;};'use strict';var express=require(_0x9154('0x0'));var router=express[_0x9154('0x1')]();var auth=require(_0x9154('0x2'));var controller=require(_0x9154('0x3'));router[_0x9154('0x4')]('/',auth[_0x9154('0x5')](),controller[_0x9154('0x6')]);router[_0x9154('0x4')](_0x9154('0x7'),auth[_0x9154('0x5')](),controller['killProcess']);module[_0x9154('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 084e9c6..e4f6f17 100644 --- a/server/api/system/system.controller.js +++ b/server/api/system/system.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06d5=['api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x06d5,0x134));var _0x506d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x06d5[_0x17d9e3];return _0x14192d;};'use strict';var info=require(_0x506d('0x0'));var exec=require(_0x506d('0x1'))[_0x506d('0x2')];var logger=require(_0x506d('0x3'))(_0x506d('0x4'));var util=require(_0x506d('0x5'));var BPromise=require('bluebird');var _=require(_0x506d('0x6'));function handleError(_0x1ca3ed,_0x4a6da1,_0x1d57c2){_0x4a6da1=_0x4a6da1||0x1f4;return function(_0x5a07e2){logger[_0x506d('0x7')](_0x506d('0x8'),_0x1d57c2,_0x4a6da1,util[_0x506d('0x9')](_0x5a07e2,{'showHidden':![],'depth':null}));delete _0x5a07e2[_0x506d('0xa')];_0x1ca3ed[_0x506d('0xb')](_0x4a6da1)[_0x506d('0xc')](_0x5a07e2);};}exports[_0x506d('0xd')]=function(_0x3b38ad,_0x16dda5){return info['getAllData']()[_0x506d('0xe')](function(_0x42c892){return _0x16dda5[_0x506d('0xb')](0xc8)['json'](_0x42c892);})[_0x506d('0xf')](function(_0x4e6338){return _0x16dda5[_0x506d('0xb')](0x1f4)['json'](_0x4e6338);});};exports[_0x506d('0x10')]=function(_0x8fcfe0,_0xa113cc){var _0x4ccf9e=['components/import/cm'];return new BPromise(function(_0x42df73,_0x3432eb){return exec(util[_0x506d('0x11')](_0x506d('0x12'),_0x8fcfe0[_0x506d('0x13')][_0x506d('0x14')]),function(_0x5d959f,_0x2716ea,_0x1728a8){if(_0x5d959f){return _0x3432eb(_0x5d959f);}return _0x42df73(_0x2716ea);});})[_0x506d('0xe')](function(_0xe0e297){var _0xcdf0b7=![];var _0x3a499e=_0xe0e297['split'](/\n/);for(var _0x122c91=0x0,_0x12ebbd=_0x4ccf9e['length'];_0x122c91<_0x12ebbd,_0xcdf0b7===![];_0x122c91+=0x1){if(_0xe0e297['indexOf'](_0x4ccf9e[_0x122c91])>=0x0){_0xcdf0b7=!![];}}if(!_0xcdf0b7){throw new Error(util['format'](_0x506d('0x15'),_0x8fcfe0[_0x506d('0x13')][_0x506d('0x14')]));}process[_0x506d('0x16')](_0x8fcfe0[_0x506d('0x13')][_0x506d('0x14')],'SIGINT');return _0xa113cc[_0x506d('0xb')](0xc8)['json']({'message':util['format'](_0x506d('0x17'),_0x8fcfe0[_0x506d('0x13')]['pid'])});})['catch'](handleError(_0xa113cc,null,_0x506d('0x10')));}; \ No newline at end of file +var _0xe103=['length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split'];(function(_0x3d4e74,_0x21b4e5){var _0x57613d=function(_0x2fa3b3){while(--_0x2fa3b3){_0x3d4e74['push'](_0x3d4e74['shift']());}};_0x57613d(++_0x21b4e5);}(_0xe103,0x1f3));var _0x3e10=function(_0x278763,_0x2d06b2){_0x278763=_0x278763-0x0;var _0x4d6a31=_0xe103[_0x278763];return _0x4d6a31;};'use strict';var info=require(_0x3e10('0x0'));var exec=require(_0x3e10('0x1'))[_0x3e10('0x2')];var logger=require(_0x3e10('0x3'))('api');var util=require('util');var BPromise=require(_0x3e10('0x4'));var _=require(_0x3e10('0x5'));function handleError(_0x4a45f7,_0x3f8b8f,_0x321ffd){_0x3f8b8f=_0x3f8b8f||0x1f4;return function(_0x534c74){logger[_0x3e10('0x6')](_0x3e10('0x7'),_0x321ffd,_0x3f8b8f,util[_0x3e10('0x8')](_0x534c74,{'showHidden':![],'depth':null}));delete _0x534c74[_0x3e10('0x9')];_0x4a45f7[_0x3e10('0xa')](_0x3f8b8f)[_0x3e10('0xb')](_0x534c74);};}exports[_0x3e10('0xc')]=function(_0xce0393,_0x57c807){return info[_0x3e10('0xd')]()['then'](function(_0x149f6e){return _0x57c807['status'](0xc8)[_0x3e10('0xe')](_0x149f6e);})['catch'](function(_0x50b18f){return _0x57c807['status'](0x1f4)[_0x3e10('0xe')](_0x50b18f);});};exports[_0x3e10('0xf')]=function(_0x556c2f,_0x512b78){var _0x2bd002=[_0x3e10('0x10')];return new BPromise(function(_0x53168c,_0x4f9f73){return exec(util[_0x3e10('0x11')](_0x3e10('0x12'),_0x556c2f[_0x3e10('0x13')][_0x3e10('0x14')]),function(_0x76cc6f,_0x4311a9,_0x5b4ed8){if(_0x76cc6f){return _0x4f9f73(_0x76cc6f);}return _0x53168c(_0x4311a9);});})[_0x3e10('0x15')](function(_0x332793){var _0x1cad2d=![];var _0x5154a1=_0x332793[_0x3e10('0x16')](/\n/);for(var _0x24fc38=0x0,_0x1f7266=_0x2bd002[_0x3e10('0x17')];_0x24fc38<_0x1f7266,_0x1cad2d===![];_0x24fc38+=0x1){if(_0x332793[_0x3e10('0x18')](_0x2bd002[_0x24fc38])>=0x0){_0x1cad2d=!![];}}if(!_0x1cad2d){throw new Error(util[_0x3e10('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x556c2f['params']['pid']));}process[_0x3e10('0x19')](_0x556c2f[_0x3e10('0x13')][_0x3e10('0x14')],_0x3e10('0x1a'));return _0x512b78[_0x3e10('0xa')](0xc8)[_0x3e10('0xe')]({'message':util[_0x3e10('0x11')](_0x3e10('0x1b'),_0x556c2f[_0x3e10('0x13')][_0x3e10('0x14')])});})[_0x3e10('0x1c')](handleError(_0x512b78,null,_0x3e10('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 99cb6b0..c6ee076 100644 --- a/server/api/tag/index.js +++ b/server/api/tag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d5c=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0x6d5c,0x179));var _0xc6d5=function(_0x46cd27,_0x290a56){_0x46cd27=_0x46cd27-0x0;var _0x2d030d=_0x6d5c[_0x46cd27];return _0x2d030d;};'use strict';var multer=require(_0xc6d5('0x0'));var util=require(_0xc6d5('0x1'));var path=require(_0xc6d5('0x2'));var timeout=require(_0xc6d5('0x3'));var express=require('express');var router=express[_0xc6d5('0x4')]();var fs_extra=require(_0xc6d5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc6d5('0x6'));var config=require(_0xc6d5('0x7'));var controller=require(_0xc6d5('0x8'));router[_0xc6d5('0x9')]('/',auth['isAuthenticated'](),controller[_0xc6d5('0xa')]);router[_0xc6d5('0x9')](_0xc6d5('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc6d5('0xc')]('/',auth[_0xc6d5('0xd')](),controller[_0xc6d5('0xe')]);router[_0xc6d5('0xf')](_0xc6d5('0xb'),auth[_0xc6d5('0xd')](),controller[_0xc6d5('0x10')]);router[_0xc6d5('0x11')]('/:id',auth[_0xc6d5('0xd')](),controller[_0xc6d5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5dc7=['isAuthenticated','get','/:id','show','post','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./tag.controller'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x5dc7,0x148));var _0x75dc=function(_0x4a1861,_0x21ac91){_0x4a1861=_0x4a1861-0x0;var _0x4a4af8=_0x5dc7[_0x4a1861];return _0x4a4af8;};'use strict';var multer=require(_0x75dc('0x0'));var util=require(_0x75dc('0x1'));var path=require('path');var timeout=require(_0x75dc('0x2'));var express=require(_0x75dc('0x3'));var router=express[_0x75dc('0x4')]();var fs_extra=require(_0x75dc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x75dc('0x6'));var controller=require(_0x75dc('0x7'));router['get']('/',auth[_0x75dc('0x8')](),controller['index']);router[_0x75dc('0x9')](_0x75dc('0xa'),auth[_0x75dc('0x8')](),controller[_0x75dc('0xb')]);router[_0x75dc('0xc')]('/',auth[_0x75dc('0x8')](),controller['create']);router['put'](_0x75dc('0xa'),auth[_0x75dc('0x8')](),controller['update']);router[_0x75dc('0xd')]('/:id',auth[_0x75dc('0x8')](),controller[_0x75dc('0xe')]);module[_0x75dc('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index bcfa241..22eeb60 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['name','exports','STRING'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8603,0x190));var _0x3860=function(_0x1af5d2,_0xa9d37c){_0x1af5d2=_0x1af5d2-0x0;var _0x173993=_0x8603[_0x1af5d2];return _0x173993;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x3860('0x1')]}}; \ No newline at end of file +var _0x51c5=['STRING','name','#0091EA','sequelize','exports'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x51c5,0x8f));var _0x551c=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x51c5[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x551c('0x0'));module[_0x551c('0x1')]={'name':{'type':Sequelize[_0x551c('0x2')],'unique':_0x551c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x551c('0x2')],'defaultValue':_0x551c('0x4')},'description':{'type':Sequelize[_0x551c('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 1d749c2..256badb 100644 --- a/server/api/tag/tag.controller.js +++ b/server/api/tag/tag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee24=['VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','create','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','Tag','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xee24,0x1a6));var _0x4ee2=function(_0x2b4629,_0x2cfe26){_0x2b4629=_0x2b4629-0x0;var _0x1d8fa9=_0xee24[_0x2b4629];return _0x1d8fa9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ee2('0x0'));var zipdir=require(_0x4ee2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ee2('0x2'));var moment=require(_0x4ee2('0x3'));var BPromise=require(_0x4ee2('0x4'));var Mustache=require(_0x4ee2('0x5'));var util=require('util');var path=require(_0x4ee2('0x6'));var sox=require(_0x4ee2('0x7'));var csv=require(_0x4ee2('0x8'));var ejs=require(_0x4ee2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee2('0xa'));var squel=require(_0x4ee2('0xb'));var crypto=require(_0x4ee2('0xc'));var jsforce=require(_0x4ee2('0xd'));var deskjs=require(_0x4ee2('0xe'));var toCsv=require(_0x4ee2('0x8'));var querystring=require(_0x4ee2('0xf'));var Papa=require(_0x4ee2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4ee2('0x11'));var as=require(_0x4ee2('0x12'));var hardwareService=require(_0x4ee2('0x13'));var logger=require(_0x4ee2('0x14'))(_0x4ee2('0x15'));var utils=require('../../config/utils');var config=require(_0x4ee2('0x16'));var licenseUtil=require(_0x4ee2('0x17'));var db=require(_0x4ee2('0x18'))['db'];function respondWithStatusCode(_0x322780,_0x51f09d){_0x51f09d=_0x51f09d||0xcc;return function(_0x1f7125){if(_0x1f7125){return _0x322780[_0x4ee2('0x19')](_0x51f09d);}return _0x322780[_0x4ee2('0x1a')](_0x51f09d)[_0x4ee2('0x1b')]();};}function respondWithResult(_0x4f41cb,_0x481181){_0x481181=_0x481181||0xc8;return function(_0x2357c5){if(_0x2357c5){return _0x4f41cb[_0x4ee2('0x1a')](_0x481181)['json'](_0x2357c5);}};}function respondWithFilteredResult(_0x34dacb,_0x231d5){return function(_0x3c4279){if(_0x3c4279){var _0x1b95c5=typeof _0x231d5[_0x4ee2('0x1c')]===_0x4ee2('0x1d')&&typeof _0x231d5['limit']===_0x4ee2('0x1d');var _0xde92d=_0x3c4279[_0x4ee2('0x1e')];var _0x4aba2b=_0x1b95c5?0x0:_0x231d5[_0x4ee2('0x1c')];var _0xb8e027=_0x1b95c5?_0x3c4279[_0x4ee2('0x1e')]:_0x231d5[_0x4ee2('0x1c')]+_0x231d5[_0x4ee2('0x1f')];var _0x341ca3;if(_0xb8e027>=_0xde92d){_0xb8e027=_0xde92d;_0x341ca3=0xc8;}else{_0x341ca3=0xce;}_0x34dacb[_0x4ee2('0x1a')](_0x341ca3);return _0x34dacb[_0x4ee2('0x20')]('Content-Range',_0x4aba2b+'-'+_0xb8e027+'/'+_0xde92d)['json'](_0x3c4279);}return null;};}function patchUpdates(_0x33e66e){return function(_0x4901ff){try{jsonpatch[_0x4ee2('0x21')](_0x4901ff,_0x33e66e,!![]);}catch(_0x1d29bf){return BPromise[_0x4ee2('0x22')](_0x1d29bf);}return _0x4901ff[_0x4ee2('0x23')]();};}function saveUpdates(_0x4507d6,_0x53f246){return function(_0x1d5037){if(_0x1d5037){return _0x1d5037['update'](_0x4507d6)[_0x4ee2('0x24')](function(_0x3e6344){return _0x3e6344;});}return null;};}function removeEntity(_0x2560fe,_0x1f4f90){return function(_0x1ca982){if(_0x1ca982){return _0x1ca982[_0x4ee2('0x25')]()[_0x4ee2('0x24')](function(){var _0x581c75=_0x1ca982[_0x4ee2('0x26')]({'plain':!![]});var _0x5127b8='Tags';return db[_0x4ee2('0x27')][_0x4ee2('0x25')]({'where':{'type':_0x5127b8,'resourceId':_0x581c75['id']}})[_0x4ee2('0x24')](function(){return _0x1ca982;});})[_0x4ee2('0x24')](function(){_0x2560fe[_0x4ee2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50005e,_0x404fba){return function(_0x2a078f){if(!_0x2a078f){_0x50005e['sendStatus'](0x194);}return _0x2a078f;};}function handleError(_0x2fe02a,_0x5a052b){_0x5a052b=_0x5a052b||0x1f4;return function(_0x49b1be){logger['error'](_0x49b1be[_0x4ee2('0x28')]);if(_0x49b1be[_0x4ee2('0x29')]){delete _0x49b1be['name'];}_0x2fe02a[_0x4ee2('0x1a')](_0x5a052b)[_0x4ee2('0x2a')](_0x49b1be);};}exports['index']=function(_0xc7df80,_0x4bf072){var _0x239ab7={},_0x3a0881={},_0x1fea65={'count':0x0,'rows':[]};var _0x4da154=_['map'](db[_0x4ee2('0x2b')][_0x4ee2('0x2c')],function(_0x3ab2a1){return{'name':_0x3ab2a1['fieldName'],'type':_0x3ab2a1[_0x4ee2('0x2d')][_0x4ee2('0x2e')]};});_0x3a0881[_0x4ee2('0x2f')]=_[_0x4ee2('0x30')](_0x4da154,_0x4ee2('0x29'));_0x3a0881[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0xc7df80[_0x4ee2('0x31')]);_0x3a0881[_0x4ee2('0x33')]=_[_0x4ee2('0x34')](_0x3a0881[_0x4ee2('0x2f')],_0x3a0881[_0x4ee2('0x31')]);_0x239ab7['attributes']=_[_0x4ee2('0x34')](_0x3a0881[_0x4ee2('0x2f')],qs['fields'](_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x35')]));_0x239ab7[_0x4ee2('0x36')]=_0x239ab7[_0x4ee2('0x36')][_0x4ee2('0x37')]?_0x239ab7[_0x4ee2('0x36')]:_0x3a0881[_0x4ee2('0x2f')];if(!_0xc7df80['query'][_0x4ee2('0x38')](_0x4ee2('0x39'))){_0x239ab7[_0x4ee2('0x1f')]=qs['limit'](_0xc7df80[_0x4ee2('0x31')]['limit']);_0x239ab7[_0x4ee2('0x1c')]=qs[_0x4ee2('0x1c')](_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x1c')]);}_0x239ab7[_0x4ee2('0x3a')]=qs[_0x4ee2('0x3b')](_0xc7df80['query']['sort']);_0x239ab7[_0x4ee2('0x3c')]=qs[_0x4ee2('0x33')](_[_0x4ee2('0x3d')](_0xc7df80[_0x4ee2('0x31')],_0x3a0881[_0x4ee2('0x33')]),_0x4da154);if(_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x3e')]){_0x239ab7[_0x4ee2('0x3c')]=_[_0x4ee2('0x3f')](_0x239ab7[_0x4ee2('0x3c')],{'$or':_['map'](_0x4da154,function(_0x492595){if(_0x492595[_0x4ee2('0x2d')]!==_0x4ee2('0x40')){var _0x1255ff={};_0x1255ff[_0x492595['name']]={'$like':'%'+_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x3e')]+'%'};return _0x1255ff;}})});}_0x239ab7=_[_0x4ee2('0x3f')]({},_0x239ab7,_0xc7df80[_0x4ee2('0x41')]);var _0x31901e={'where':_0x239ab7[_0x4ee2('0x3c')]};return db[_0x4ee2('0x2b')][_0x4ee2('0x1e')](_0x31901e)[_0x4ee2('0x24')](function(_0x2b099b){_0x1fea65['count']=_0x2b099b;if(_0xc7df80['query'][_0x4ee2('0x42')]){_0x239ab7[_0x4ee2('0x43')]=[{'all':!![]}];}return db[_0x4ee2('0x2b')]['findAll'](_0x239ab7);})[_0x4ee2('0x24')](function(_0x56fd09){_0x1fea65[_0x4ee2('0x44')]=_0x56fd09;return _0x1fea65;})['then'](respondWithFilteredResult(_0x4bf072,_0x239ab7))[_0x4ee2('0x45')](handleError(_0x4bf072,null));};exports[_0x4ee2('0x46')]=function(_0x41607a,_0x5bc5f3){var _0x58a5de={'raw':!![],'where':{'id':_0x41607a[_0x4ee2('0x47')]['id']}},_0x4e7a92={};_0x4e7a92[_0x4ee2('0x2f')]=_[_0x4ee2('0x32')](db[_0x4ee2('0x2b')]['rawAttributes']);_0x4e7a92[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0x41607a['query']);_0x4e7a92[_0x4ee2('0x33')]=_['intersection'](_0x4e7a92['model'],_0x4e7a92[_0x4ee2('0x31')]);_0x58a5de['attributes']=_[_0x4ee2('0x34')](_0x4e7a92['model'],qs[_0x4ee2('0x35')](_0x41607a[_0x4ee2('0x31')][_0x4ee2('0x35')]));_0x58a5de['attributes']=_0x58a5de[_0x4ee2('0x36')][_0x4ee2('0x37')]?_0x58a5de[_0x4ee2('0x36')]:_0x4e7a92[_0x4ee2('0x2f')];if(_0x41607a[_0x4ee2('0x31')]['includeAll']){_0x58a5de[_0x4ee2('0x43')]=[{'all':!![]}];}_0x58a5de=_[_0x4ee2('0x3f')]({},_0x58a5de,_0x41607a['options']);return db['Tag'][_0x4ee2('0x48')](_0x58a5de)['then'](handleEntityNotFound(_0x5bc5f3,null))[_0x4ee2('0x24')](respondWithResult(_0x5bc5f3,null))[_0x4ee2('0x45')](handleError(_0x5bc5f3,null));};exports['create']=function(_0x43ca98,_0x2bf21a){return db[_0x4ee2('0x2b')]['create'](_0x43ca98[_0x4ee2('0x49')],{})[_0x4ee2('0x24')](function(_0x4f3fa6){var _0x5204b0=_0x43ca98['user']['get']({'plain':!![]});if(!_0x5204b0)throw new Error(_0x4ee2('0x4a'));if(_0x5204b0[_0x4ee2('0x4b')]==='user'){var _0x1379c0=_0x4f3fa6[_0x4ee2('0x26')]({'plain':!![]});var _0x391424=_0x4ee2('0x4c');return db[_0x4ee2('0x4d')][_0x4ee2('0x48')]({'where':{'name':_0x391424,'userProfileId':_0x5204b0[_0x4ee2('0x4e')]},'raw':!![]})['then'](function(_0x4498af){if(_0x4498af&&_0x4498af['autoAssociation']===0x0){return db[_0x4ee2('0x27')][_0x4ee2('0x4f')]({'name':_0x1379c0[_0x4ee2('0x29')],'resourceId':_0x1379c0['id'],'type':_0x4498af['name'],'sectionId':_0x4498af['id']},{})[_0x4ee2('0x24')](function(){return _0x4f3fa6;});}else{return _0x4f3fa6;}})[_0x4ee2('0x45')](function(_0x304d64){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x304d64);throw _0x304d64;});}return _0x4f3fa6;})[_0x4ee2('0x24')](respondWithResult(_0x2bf21a,0xc9))[_0x4ee2('0x45')](handleError(_0x2bf21a,null));};exports[_0x4ee2('0x50')]=function(_0x3df5b3,_0x5ee68c){if(_0x3df5b3[_0x4ee2('0x49')]['id']){delete _0x3df5b3[_0x4ee2('0x49')]['id'];}return db[_0x4ee2('0x2b')][_0x4ee2('0x48')]({'where':{'id':_0x3df5b3[_0x4ee2('0x47')]['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x5ee68c,null))[_0x4ee2('0x24')](saveUpdates(_0x3df5b3[_0x4ee2('0x49')],null))[_0x4ee2('0x24')](respondWithResult(_0x5ee68c,null))[_0x4ee2('0x45')](handleError(_0x5ee68c,null));};exports[_0x4ee2('0x25')]=function(_0x1a1021,_0x58dac3){return db['Tag'][_0x4ee2('0x48')]({'where':{'id':_0x1a1021[_0x4ee2('0x47')]['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x58dac3,null))['then'](removeEntity(_0x58dac3,null))['catch'](handleError(_0x58dac3,null));}; \ No newline at end of file +var _0x80d9=['offset','count','set','Content-Range','apply','save','then','Tags','UserProfileResource','destroy','error','stack','name','index','map','Tag','fieldName','type','query','intersection','model','fields','attributes','length','nolimit','filters','pick','filter','where','merge','options','include','findAll','rows','catch','show','keys','rawAttributes','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','update','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit'];(function(_0x31a28f,_0x2eab48){var _0x3e9d8c=function(_0x10219d){while(--_0x10219d){_0x31a28f['push'](_0x31a28f['shift']());}};_0x3e9d8c(++_0x2eab48);}(_0x80d9,0x15c));var _0x980d=function(_0x5bc20e,_0x4351e){_0x5bc20e=_0x5bc20e-0x0;var _0x4c71d8=_0x80d9[_0x5bc20e];return _0x4c71d8;};'use strict';var emlformat=require(_0x980d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x980d('0x1'));var jsonpatch=require(_0x980d('0x2'));var rp=require(_0x980d('0x3'));var moment=require('moment');var BPromise=require(_0x980d('0x4'));var Mustache=require(_0x980d('0x5'));var util=require(_0x980d('0x6'));var path=require(_0x980d('0x7'));var sox=require(_0x980d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x980d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x980d('0xa'));var jsforce=require(_0x980d('0xb'));var deskjs=require(_0x980d('0xc'));var toCsv=require(_0x980d('0xd'));var querystring=require(_0x980d('0xe'));var Papa=require(_0x980d('0xf'));var Redis=require(_0x980d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x980d('0x11'));var logger=require(_0x980d('0x12'))('api');var utils=require(_0x980d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x980d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc0168a,_0x19cb9b){_0x19cb9b=_0x19cb9b||0xcc;return function(_0x171a61){if(_0x171a61){return _0xc0168a[_0x980d('0x15')](_0x19cb9b);}return _0xc0168a[_0x980d('0x16')](_0x19cb9b)[_0x980d('0x17')]();};}function respondWithResult(_0x109ddf,_0x3a317b){_0x3a317b=_0x3a317b||0xc8;return function(_0x5f524e){if(_0x5f524e){return _0x109ddf[_0x980d('0x16')](_0x3a317b)[_0x980d('0x18')](_0x5f524e);}};}function respondWithFilteredResult(_0x3fc5f7,_0x3846bd){return function(_0x2f229b){if(_0x2f229b){var _0x169648=typeof _0x3846bd['offset']===_0x980d('0x19')&&typeof _0x3846bd[_0x980d('0x1a')]==='undefined';var _0x1633cf=_0x2f229b['count'];var _0x23f64c=_0x169648?0x0:_0x3846bd[_0x980d('0x1b')];var _0x39192b=_0x169648?_0x2f229b[_0x980d('0x1c')]:_0x3846bd[_0x980d('0x1b')]+_0x3846bd[_0x980d('0x1a')];var _0x3ef68b;if(_0x39192b>=_0x1633cf){_0x39192b=_0x1633cf;_0x3ef68b=0xc8;}else{_0x3ef68b=0xce;}_0x3fc5f7[_0x980d('0x16')](_0x3ef68b);return _0x3fc5f7[_0x980d('0x1d')](_0x980d('0x1e'),_0x23f64c+'-'+_0x39192b+'/'+_0x1633cf)[_0x980d('0x18')](_0x2f229b);}return null;};}function patchUpdates(_0x550741){return function(_0x58dddf){try{jsonpatch[_0x980d('0x1f')](_0x58dddf,_0x550741,!![]);}catch(_0x551339){return BPromise['reject'](_0x551339);}return _0x58dddf[_0x980d('0x20')]();};}function saveUpdates(_0x1d6286,_0x45d698){return function(_0xbb89e3){if(_0xbb89e3){return _0xbb89e3['update'](_0x1d6286)['then'](function(_0x11cb45){return _0x11cb45;});}return null;};}function removeEntity(_0x4fca61,_0x4de252){return function(_0x20cea1){if(_0x20cea1){return _0x20cea1['destroy']()[_0x980d('0x21')](function(){var _0x4798d7=_0x20cea1['get']({'plain':!![]});var _0x4ecf91=_0x980d('0x22');return db[_0x980d('0x23')][_0x980d('0x24')]({'where':{'type':_0x4ecf91,'resourceId':_0x4798d7['id']}})[_0x980d('0x21')](function(){return _0x20cea1;});})['then'](function(){_0x4fca61['status'](0xcc)[_0x980d('0x17')]();});}};}function handleEntityNotFound(_0x1d5dad,_0x97ca70){return function(_0x1da8ea){if(!_0x1da8ea){_0x1d5dad[_0x980d('0x15')](0x194);}return _0x1da8ea;};}function handleError(_0x47b11d,_0x4a51f9){_0x4a51f9=_0x4a51f9||0x1f4;return function(_0x2830e5){logger[_0x980d('0x25')](_0x2830e5[_0x980d('0x26')]);if(_0x2830e5[_0x980d('0x27')]){delete _0x2830e5[_0x980d('0x27')];}_0x47b11d[_0x980d('0x16')](_0x4a51f9)['send'](_0x2830e5);};}exports[_0x980d('0x28')]=function(_0x471f52,_0xaa9cd6){var _0xd397e3={},_0x3981d8={},_0x38470b={'count':0x0,'rows':[]};var _0x868f1f=_[_0x980d('0x29')](db[_0x980d('0x2a')]['rawAttributes'],function(_0x3671b8){return{'name':_0x3671b8[_0x980d('0x2b')],'type':_0x3671b8[_0x980d('0x2c')]['key']};});_0x3981d8['model']=_[_0x980d('0x29')](_0x868f1f,'name');_0x3981d8[_0x980d('0x2d')]=_['keys'](_0x471f52['query']);_0x3981d8['filters']=_['intersection'](_0x3981d8['model'],_0x3981d8['query']);_0xd397e3['attributes']=_[_0x980d('0x2e')](_0x3981d8[_0x980d('0x2f')],qs[_0x980d('0x30')](_0x471f52['query'][_0x980d('0x30')]));_0xd397e3[_0x980d('0x31')]=_0xd397e3[_0x980d('0x31')][_0x980d('0x32')]?_0xd397e3[_0x980d('0x31')]:_0x3981d8[_0x980d('0x2f')];if(!_0x471f52[_0x980d('0x2d')]['hasOwnProperty'](_0x980d('0x33'))){_0xd397e3[_0x980d('0x1a')]=qs['limit'](_0x471f52[_0x980d('0x2d')]['limit']);_0xd397e3[_0x980d('0x1b')]=qs[_0x980d('0x1b')](_0x471f52[_0x980d('0x2d')]['offset']);}_0xd397e3['order']=qs['sort'](_0x471f52[_0x980d('0x2d')]['sort']);_0xd397e3['where']=qs[_0x980d('0x34')](_[_0x980d('0x35')](_0x471f52[_0x980d('0x2d')],_0x3981d8['filters']),_0x868f1f);if(_0x471f52[_0x980d('0x2d')][_0x980d('0x36')]){_0xd397e3[_0x980d('0x37')]=_[_0x980d('0x38')](_0xd397e3[_0x980d('0x37')],{'$or':_['map'](_0x868f1f,function(_0x5a8515){if(_0x5a8515[_0x980d('0x2c')]!=='VIRTUAL'){var _0x5b49e2={};_0x5b49e2[_0x5a8515['name']]={'$like':'%'+_0x471f52['query'][_0x980d('0x36')]+'%'};return _0x5b49e2;}})});}_0xd397e3=_[_0x980d('0x38')]({},_0xd397e3,_0x471f52[_0x980d('0x39')]);var _0x47a4ac={'where':_0xd397e3[_0x980d('0x37')]};return db[_0x980d('0x2a')][_0x980d('0x1c')](_0x47a4ac)[_0x980d('0x21')](function(_0x20a388){_0x38470b[_0x980d('0x1c')]=_0x20a388;if(_0x471f52[_0x980d('0x2d')]['includeAll']){_0xd397e3[_0x980d('0x3a')]=[{'all':!![]}];}return db[_0x980d('0x2a')][_0x980d('0x3b')](_0xd397e3);})['then'](function(_0x2a40fd){_0x38470b[_0x980d('0x3c')]=_0x2a40fd;return _0x38470b;})[_0x980d('0x21')](respondWithFilteredResult(_0xaa9cd6,_0xd397e3))[_0x980d('0x3d')](handleError(_0xaa9cd6,null));};exports[_0x980d('0x3e')]=function(_0x45831c,_0x1ad432){var _0x4d0220={'raw':!![],'where':{'id':_0x45831c['params']['id']}},_0x473c94={};_0x473c94[_0x980d('0x2f')]=_[_0x980d('0x3f')](db[_0x980d('0x2a')][_0x980d('0x40')]);_0x473c94[_0x980d('0x2d')]=_[_0x980d('0x3f')](_0x45831c[_0x980d('0x2d')]);_0x473c94[_0x980d('0x34')]=_['intersection'](_0x473c94['model'],_0x473c94[_0x980d('0x2d')]);_0x4d0220[_0x980d('0x31')]=_[_0x980d('0x2e')](_0x473c94[_0x980d('0x2f')],qs[_0x980d('0x30')](_0x45831c['query'][_0x980d('0x30')]));_0x4d0220[_0x980d('0x31')]=_0x4d0220['attributes'][_0x980d('0x32')]?_0x4d0220[_0x980d('0x31')]:_0x473c94[_0x980d('0x2f')];if(_0x45831c[_0x980d('0x2d')][_0x980d('0x41')]){_0x4d0220[_0x980d('0x3a')]=[{'all':!![]}];}_0x4d0220=_[_0x980d('0x38')]({},_0x4d0220,_0x45831c[_0x980d('0x39')]);return db[_0x980d('0x2a')]['find'](_0x4d0220)[_0x980d('0x21')](handleEntityNotFound(_0x1ad432,null))[_0x980d('0x21')](respondWithResult(_0x1ad432,null))[_0x980d('0x3d')](handleError(_0x1ad432,null));};exports[_0x980d('0x42')]=function(_0x2e18c6,_0x7d0acf){return db[_0x980d('0x2a')]['create'](_0x2e18c6[_0x980d('0x43')],{})['then'](function(_0x33c914){var _0x6e16c1=_0x2e18c6[_0x980d('0x44')][_0x980d('0x45')]({'plain':!![]});if(!_0x6e16c1)throw new Error(_0x980d('0x46'));if(_0x6e16c1['role']===_0x980d('0x44')){var _0x448b3c=_0x33c914[_0x980d('0x45')]({'plain':!![]});var _0x12c1ea=_0x980d('0x22');return db[_0x980d('0x47')][_0x980d('0x48')]({'where':{'name':_0x12c1ea,'userProfileId':_0x6e16c1['userProfileId']},'raw':!![]})['then'](function(_0x508663){if(_0x508663&&_0x508663['autoAssociation']===0x0){return db[_0x980d('0x23')][_0x980d('0x42')]({'name':_0x448b3c[_0x980d('0x27')],'resourceId':_0x448b3c['id'],'type':_0x508663[_0x980d('0x27')],'sectionId':_0x508663['id']},{})[_0x980d('0x21')](function(){return _0x33c914;});}else{return _0x33c914;}})[_0x980d('0x3d')](function(_0x5cd6a0){logger[_0x980d('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cd6a0);throw _0x5cd6a0;});}return _0x33c914;})[_0x980d('0x21')](respondWithResult(_0x7d0acf,0xc9))[_0x980d('0x3d')](handleError(_0x7d0acf,null));};exports[_0x980d('0x49')]=function(_0x4656f4,_0x522b28){if(_0x4656f4['body']['id']){delete _0x4656f4[_0x980d('0x43')]['id'];}return db[_0x980d('0x2a')][_0x980d('0x48')]({'where':{'id':_0x4656f4['params']['id']}})['then'](handleEntityNotFound(_0x522b28,null))[_0x980d('0x21')](saveUpdates(_0x4656f4['body'],null))[_0x980d('0x21')](respondWithResult(_0x522b28,null))[_0x980d('0x3d')](handleError(_0x522b28,null));};exports[_0x980d('0x24')]=function(_0x15427b,_0x20459e){return db[_0x980d('0x2a')][_0x980d('0x48')]({'where':{'id':_0x15427b[_0x980d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x20459e,null))['then'](removeEntity(_0x20459e,null))[_0x980d('0x3d')](handleError(_0x20459e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7097748..7a2e9b2 100644 --- a/server/api/tag/tag.model.js +++ b/server/api/tag/tag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c07=['../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4a8356,_0x3007c3){var _0x46ac5d=function(_0x4e334c){while(--_0x4e334c){_0x4a8356['push'](_0x4a8356['shift']());}};_0x46ac5d(++_0x3007c3);}(_0x9c07,0x163));var _0x79c0=function(_0x34202f,_0x903ec){_0x34202f=_0x34202f-0x0;var _0xd09a92=_0x9c07[_0x34202f];return _0xd09a92;};'use strict';var _=require(_0x79c0('0x0'));var util=require(_0x79c0('0x1'));var logger=require(_0x79c0('0x2'))(_0x79c0('0x3'));var moment=require(_0x79c0('0x4'));var BPromise=require(_0x79c0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79c0('0x6'));var rimraf=require(_0x79c0('0x7'));var config=require(_0x79c0('0x8'));var attributes=require('./tag.attributes');module[_0x79c0('0x9')]=function(_0x1daa09,_0x50728e){return _0x1daa09[_0x79c0('0xa')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3e0=['request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','util','../../config/logger','api','moment'];(function(_0x3a8bf8,_0x428e96){var _0x560481=function(_0xb2fd5a){while(--_0xb2fd5a){_0x3a8bf8['push'](_0x3a8bf8['shift']());}};_0x560481(++_0x428e96);}(_0xe3e0,0x188));var _0x0e3e=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0xe3e0[_0x541260];return _0x1dd2b5;};'use strict';var _=require('lodash');var util=require(_0x0e3e('0x0'));var logger=require(_0x0e3e('0x1'))(_0x0e3e('0x2'));var moment=require(_0x0e3e('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e3e('0x4'));var fs=require('fs');var path=require(_0x0e3e('0x5'));var rimraf=require(_0x0e3e('0x6'));var config=require(_0x0e3e('0x7'));var attributes=require(_0x0e3e('0x8'));module[_0x0e3e('0x9')]=function(_0x58bcb1,_0xd13c74){return _0x58bcb1[_0x0e3e('0xa')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index a78d746..a1ace6a 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd0f=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Tag,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x73b415,_0x1c22f6){_0x73b415=_0x73b415-0x0;var _0x2f6072=_0xfd0f[_0x73b415];return _0x2f6072;};'use strict';var _=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var moment=require('moment');var BPromise=require(_0xffd0('0x2'));var rs=require(_0xffd0('0x3'));var fs=require('fs');var Redis=require(_0xffd0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xffd0('0x5'));var logger=require('../../config/logger')(_0xffd0('0x6'));var config=require(_0xffd0('0x7'));var jayson=require(_0xffd0('0x8'));var client=jayson[_0xffd0('0x9')][_0xffd0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b64a5,_0x2aaee6,_0x3fcf31){return new BPromise(function(_0x55488d,_0x4e2d54){return client[_0xffd0('0xb')](_0x1b64a5,_0x3fcf31)[_0xffd0('0xc')](function(_0x1b3842){logger[_0xffd0('0xd')]('Tag,\x20%s,\x20%s',_0x2aaee6,'request\x20sent');logger[_0xffd0('0xe')](_0xffd0('0xf'),_0x2aaee6,_0xffd0('0x10'),JSON['stringify'](_0x1b3842));if(_0x1b3842['error']){if(_0x1b3842[_0xffd0('0x11')][_0xffd0('0x12')]===0x1f4){logger['error'](_0xffd0('0x13'),_0x2aaee6,_0x1b3842[_0xffd0('0x11')][_0xffd0('0x14')]);return _0x4e2d54(_0x1b3842['error'][_0xffd0('0x14')]);}logger[_0xffd0('0x11')]('Tag,\x20%s,\x20%s',_0x2aaee6,_0x1b3842[_0xffd0('0x11')]['message']);return _0x55488d(_0x1b3842['error'][_0xffd0('0x14')]);}else{logger['info'](_0xffd0('0x13'),_0x2aaee6,_0xffd0('0x10'));_0x55488d(_0x1b3842[_0xffd0('0x15')][_0xffd0('0x14')]);}})[_0xffd0('0x16')](function(_0x5582df){logger['error'](_0xffd0('0x13'),_0x2aaee6,_0x5582df);_0x4e2d54(_0x5582df);});});} \ No newline at end of file +var _0x7341=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x2c1463,_0x36d98e){var _0x44b7e2=function(_0x2f2a69){while(--_0x2f2a69){_0x2c1463['push'](_0x2c1463['shift']());}};_0x44b7e2(++_0x36d98e);}(_0x7341,0xe4));var _0x1734=function(_0x21abad,_0x491a65){_0x21abad=_0x21abad-0x0;var _0x58aa5a=_0x7341[_0x21abad];return _0x58aa5a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1734('0x0'));var BPromise=require('bluebird');var rs=require(_0x1734('0x1'));var fs=require('fs');var Redis=require(_0x1734('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1734('0x3'));var logger=require(_0x1734('0x4'))(_0x1734('0x5'));var config=require(_0x1734('0x6'));var jayson=require(_0x1734('0x7'));var client=jayson[_0x1734('0x8')][_0x1734('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c7349,_0x1ca30b,_0x2c223d){return new BPromise(function(_0x45c529,_0x5b8977){return client[_0x1734('0xa')](_0x4c7349,_0x2c223d)['then'](function(_0x56f0d5){logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));logger[_0x1734('0xe')](_0x1734('0xf'),_0x1ca30b,_0x1734('0xd'),JSON[_0x1734('0x10')](_0x56f0d5));if(_0x56f0d5[_0x1734('0x11')]){if(_0x56f0d5[_0x1734('0x11')][_0x1734('0x12')]===0x1f4){logger['error'](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x5b8977(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}logger[_0x1734('0x11')](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x45c529(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}else{logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));_0x45c529(_0x56f0d5[_0x1734('0x14')][_0x1734('0x13')]);}})[_0x1734('0x15')](function(_0x1ea188){logger[_0x1734('0x11')]('Tag,\x20%s,\x20%s',_0x1ca30b,_0x1ea188);_0x5b8977(_0x1ea188);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index cedec36..fc56631 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index f332ffa..6b5d5dd 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x33a35d,_0x5cf6f1){var _0x1b6157=function(_0x5a8b49){while(--_0x5a8b49){_0x33a35d['push'](_0x33a35d['shift']());}};_0x1b6157(++_0x5cf6f1);}(_0x757a,0xde));var _0xa757=function(_0x2d0857,_0xf3190){_0x2d0857=_0x2d0857-0x0;var _0xa7b8a9=_0x757a[_0x2d0857];return _0xa7b8a9;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x1e4b78,_0x105a91){var _0x5cbf43=function(_0x4446b7){while(--_0x4446b7){_0x1e4b78['push'](_0x1e4b78['shift']());}};_0x5cbf43(++_0x105a91);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index cfec675..1f195f6 100644 --- a/server/api/team/team.controller.js +++ b/server/api/team/team.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x835a=['ValidationError','add','toLowerCase','ids','removeQueues','remove','isArray','Chat','Mail','Sms','Fax','Whatsapp','Voice','through','penalty','User','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','addAgents','spread','removeAgents','Openchannel','emit','TeamVoicePrefix','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Team','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','end','getQueues','channel','isValidChannel','Unknown\x20channel','capitalize','Queue','Queues','addQueues','findOne'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x835a,0xc9));var _0xa835=function(_0x1c40f0,_0x281c8a){_0x1c40f0=_0x1c40f0-0x0;var _0x5970a4=_0x835a[_0x1c40f0];return _0x5970a4;};'use strict';var emlformat=require(_0xa835('0x0'));var rimraf=require(_0xa835('0x1'));var zipdir=require(_0xa835('0x2'));var jsonpatch=require(_0xa835('0x3'));var rp=require(_0xa835('0x4'));var moment=require(_0xa835('0x5'));var BPromise=require(_0xa835('0x6'));var Mustache=require(_0xa835('0x7'));var util=require('util');var path=require(_0xa835('0x8'));var sox=require(_0xa835('0x9'));var csv=require(_0xa835('0xa'));var ejs=require(_0xa835('0xb'));var fs=require('fs');var fs_extra=require(_0xa835('0xc'));var _=require(_0xa835('0xd'));var squel=require(_0xa835('0xe'));var crypto=require(_0xa835('0xf'));var jsforce=require(_0xa835('0x10'));var deskjs=require(_0xa835('0x11'));var toCsv=require(_0xa835('0xa'));var querystring=require(_0xa835('0x12'));var Papa=require('papaparse');var Redis=require(_0xa835('0x13'));var authService=require(_0xa835('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa835('0x15'));var logger=require(_0xa835('0x16'))(_0xa835('0x17'));var utils=require(_0xa835('0x18'));var config=require(_0xa835('0x19'));var licenseUtil=require(_0xa835('0x1a'));var db=require(_0xa835('0x1b'))['db'];config[_0xa835('0x1c')]=_[_0xa835('0x1d')](config[_0xa835('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xa835('0x1e'))(new Redis(config[_0xa835('0x1c')]));require(_0xa835('0x1f'))[_0xa835('0x20')](socket);function respondWithStatusCode(_0x45fe18,_0xdd7412){_0xdd7412=_0xdd7412||0xcc;return function(_0x4605b3){if(_0x4605b3){return _0x45fe18['sendStatus'](_0xdd7412);}return _0x45fe18[_0xa835('0x21')](_0xdd7412)['end']();};}function respondWithResult(_0x547264,_0x109933){_0x109933=_0x109933||0xc8;return function(_0x549f0f){if(_0x549f0f){return _0x547264[_0xa835('0x21')](_0x109933)[_0xa835('0x22')](_0x549f0f);}};}function respondWithFilteredResult(_0x20a95b,_0x17a050){return function(_0x4d54a4){if(_0x4d54a4){var _0x641164=typeof _0x17a050[_0xa835('0x23')]===_0xa835('0x24')&&typeof _0x17a050[_0xa835('0x25')]==='undefined';var _0x234c14=_0x4d54a4['count'];var _0x20c629=_0x641164?0x0:_0x17a050[_0xa835('0x23')];var _0x4485cd=_0x641164?_0x4d54a4[_0xa835('0x26')]:_0x17a050[_0xa835('0x23')]+_0x17a050[_0xa835('0x25')];var _0x4fd2e7;if(_0x4485cd>=_0x234c14){_0x4485cd=_0x234c14;_0x4fd2e7=0xc8;}else{_0x4fd2e7=0xce;}_0x20a95b[_0xa835('0x21')](_0x4fd2e7);return _0x20a95b[_0xa835('0x27')](_0xa835('0x28'),_0x20c629+'-'+_0x4485cd+'/'+_0x234c14)[_0xa835('0x22')](_0x4d54a4);}return null;};}function patchUpdates(_0x457971){return function(_0x206fe1){try{jsonpatch[_0xa835('0x29')](_0x206fe1,_0x457971,!![]);}catch(_0x437bb5){return BPromise[_0xa835('0x2a')](_0x437bb5);}return _0x206fe1[_0xa835('0x2b')]();};}function saveUpdates(_0x410abb,_0x4b828e){return function(_0x33573a){if(_0x33573a){return _0x33573a[_0xa835('0x2c')](_0x410abb)[_0xa835('0x2d')](function(_0x1a3d06){return _0x1a3d06;});}return null;};}function handleEntityNotFound(_0x33636e,_0x1b5fb9){return function(_0x3f543a){if(!_0x3f543a){_0x33636e[_0xa835('0x2e')](0x194);}return _0x3f543a;};}function handleError(_0x11935b,_0x21e545){_0x21e545=_0x21e545||0x1f4;return function(_0xf1969b){logger['error'](_0xf1969b[_0xa835('0x2f')]);if(_0xf1969b['name']){delete _0xf1969b[_0xa835('0x30')];}_0x11935b[_0xa835('0x21')](_0x21e545)[_0xa835('0x31')](_0xf1969b);};}exports[_0xa835('0x32')]=function(_0x5deadb,_0x3416c6){var _0x132ca2={},_0x5edae6={},_0x1b1e73={'count':0x0,'rows':[]};var _0x1d0f75=_[_0xa835('0x33')](db[_0xa835('0x34')][_0xa835('0x35')],function(_0x11dc3a){return{'name':_0x11dc3a[_0xa835('0x36')],'type':_0x11dc3a[_0xa835('0x37')]['key']};});_0x5edae6[_0xa835('0x38')]=_[_0xa835('0x33')](_0x1d0f75,_0xa835('0x30'));_0x5edae6[_0xa835('0x39')]=_[_0xa835('0x3a')](_0x5deadb[_0xa835('0x39')]);_0x5edae6['filters']=_[_0xa835('0x3b')](_0x5edae6[_0xa835('0x38')],_0x5edae6['query']);_0x132ca2[_0xa835('0x3c')]=_[_0xa835('0x3b')](_0x5edae6[_0xa835('0x38')],qs['fields'](_0x5deadb[_0xa835('0x39')][_0xa835('0x3d')]));_0x132ca2[_0xa835('0x3c')]=_0x132ca2['attributes']['length']?_0x132ca2[_0xa835('0x3c')]:_0x5edae6[_0xa835('0x38')];if(!_0x5deadb['query'][_0xa835('0x3e')](_0xa835('0x3f'))){_0x132ca2[_0xa835('0x25')]=qs[_0xa835('0x25')](_0x5deadb[_0xa835('0x39')][_0xa835('0x25')]);_0x132ca2[_0xa835('0x23')]=qs[_0xa835('0x23')](_0x5deadb[_0xa835('0x39')][_0xa835('0x23')]);}_0x132ca2[_0xa835('0x40')]=qs[_0xa835('0x41')](_0x5deadb[_0xa835('0x39')]['sort']);_0x132ca2['where']=qs[_0xa835('0x42')](_[_0xa835('0x43')](_0x5deadb['query'],_0x5edae6[_0xa835('0x42')]),_0x1d0f75);if(_0x5deadb['query'][_0xa835('0x44')]){_0x132ca2[_0xa835('0x45')]=_[_0xa835('0x46')](_0x132ca2['where'],{'$or':_[_0xa835('0x33')](_0x1d0f75,function(_0x871a2e){if(_0x871a2e[_0xa835('0x37')]!==_0xa835('0x47')){var _0x42efd0={};_0x42efd0[_0x871a2e[_0xa835('0x30')]]={'$like':'%'+_0x5deadb[_0xa835('0x39')][_0xa835('0x44')]+'%'};return _0x42efd0;}})});}_0x132ca2=_[_0xa835('0x46')]({},_0x132ca2,_0x5deadb[_0xa835('0x48')]);var _0x8e59d3={'where':_0x132ca2[_0xa835('0x45')]};return db[_0xa835('0x34')][_0xa835('0x26')](_0x8e59d3)[_0xa835('0x2d')](function(_0x3df089){_0x1b1e73['count']=_0x3df089;if(_0x5deadb[_0xa835('0x39')][_0xa835('0x49')]){_0x132ca2[_0xa835('0x4a')]=[{'all':!![]}];}return db[_0xa835('0x34')][_0xa835('0x4b')](_0x132ca2);})[_0xa835('0x2d')](function(_0x36338d){_0x1b1e73[_0xa835('0x4c')]=_0x36338d;return _0x1b1e73;})[_0xa835('0x2d')](respondWithFilteredResult(_0x3416c6,_0x132ca2))[_0xa835('0x4d')](handleError(_0x3416c6,null));};exports[_0xa835('0x4e')]=function(_0x29128e,_0x1ffec0){var _0x55230e={'raw':![],'where':{'id':_0x29128e[_0xa835('0x4f')]['id']}},_0xe7f4fc={};_0xe7f4fc[_0xa835('0x38')]=_[_0xa835('0x3a')](db[_0xa835('0x34')]['rawAttributes']);_0xe7f4fc[_0xa835('0x39')]=_[_0xa835('0x3a')](_0x29128e[_0xa835('0x39')]);_0xe7f4fc[_0xa835('0x42')]=_[_0xa835('0x3b')](_0xe7f4fc[_0xa835('0x38')],_0xe7f4fc[_0xa835('0x39')]);_0x55230e[_0xa835('0x3c')]=_[_0xa835('0x3b')](_0xe7f4fc[_0xa835('0x38')],qs['fields'](_0x29128e[_0xa835('0x39')][_0xa835('0x3d')]));_0x55230e[_0xa835('0x3c')]=_0x55230e[_0xa835('0x3c')][_0xa835('0x50')]?_0x55230e['attributes']:_0xe7f4fc['model'];if(_0x29128e['query'][_0xa835('0x49')]){_0x55230e['include']=[{'all':!![]}];}_0x55230e=_[_0xa835('0x46')]({},_0x55230e,_0x29128e['options']);return db[_0xa835('0x34')][_0xa835('0x51')](_0x55230e)[_0xa835('0x2d')](handleEntityNotFound(_0x1ffec0,null))['then'](respondWithResult(_0x1ffec0,null))[_0xa835('0x4d')](handleError(_0x1ffec0,null));};exports['create']=function(_0x593a41,_0x450be1){return db[_0xa835('0x34')][_0xa835('0x52')](_0x593a41[_0xa835('0x53')],{})[_0xa835('0x2d')](function(_0x35af93){var _0x155b9e=_0x593a41[_0xa835('0x54')][_0xa835('0x55')]({'plain':!![]});if(!_0x155b9e)throw new Error(_0xa835('0x56'));if(_0x155b9e[_0xa835('0x57')]===_0xa835('0x54')){var _0x2ea1a0=_0x35af93[_0xa835('0x55')]({'plain':!![]});var _0x4c8717=_0xa835('0x58');return db[_0xa835('0x59')][_0xa835('0x51')]({'where':{'name':_0x4c8717,'userProfileId':_0x155b9e[_0xa835('0x5a')]},'raw':!![]})['then'](function(_0x504ece){if(_0x504ece&&_0x504ece[_0xa835('0x5b')]===0x0){return db[_0xa835('0x5c')]['create']({'name':_0x2ea1a0[_0xa835('0x30')],'resourceId':_0x2ea1a0['id'],'type':_0x504ece[_0xa835('0x30')],'sectionId':_0x504ece['id']},{})[_0xa835('0x2d')](function(){return _0x35af93;});}else{return _0x35af93;}})['catch'](function(_0x3c2e2e){logger[_0xa835('0x5d')](_0xa835('0x5e'),_0x3c2e2e);throw _0x3c2e2e;});}return _0x35af93;})[_0xa835('0x2d')](respondWithResult(_0x450be1,0xc9))[_0xa835('0x4d')](handleError(_0x450be1,null));};exports['update']=function(_0x558eb4,_0x2396e6){if(_0x558eb4[_0xa835('0x53')]['id']){delete _0x558eb4[_0xa835('0x53')]['id'];}return db['Team'][_0xa835('0x51')]({'where':{'id':_0x558eb4[_0xa835('0x4f')]['id']}})[_0xa835('0x2d')](handleEntityNotFound(_0x2396e6,null))[_0xa835('0x2d')](saveUpdates(_0x558eb4[_0xa835('0x53')],null))[_0xa835('0x2d')](respondWithResult(_0x2396e6,null))['catch'](handleError(_0x2396e6,null));};exports[_0xa835('0x5f')]=function(_0x434994,_0xb931f4){var _0x312c2c=_0x434994['params']['id'];var _0x474d13=[];return db[_0xa835('0x60')][_0xa835('0x61')](function(_0x32dbb3){var _0x552c37=_0xa835('0x62')+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x552c37,{'type':db[_0xa835('0x63')][_0xa835('0x64')][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3})[_0xa835('0x2d')](function(_0x38655f){_0x474d13=_[_0xa835('0x33')](_0x38655f,function(_0x3dc68b){return Number(_0x3dc68b[_0xa835('0x66')]);});})[_0xa835('0x2d')](function(){var _0x49d4a5='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x49d4a5,{'type':db['Sequelize'][_0xa835('0x64')]['SELECT'],'raw':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0xcdc686){var _0x2c20c4=_[_0xa835('0x33')](_0xcdc686,function(_0x256f7e){return Number(_0x256f7e[_0xa835('0x67')]);});return db[_0xa835('0x68')][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'VoiceQueueId':{'$in':_0x2c20c4}},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){var _0x69ca47=_0xa835('0x69')+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x69ca47,{'type':db['Sequelize']['QueryTypes'][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0x3c8252){var _0x3fded5=_[_0xa835('0x33')](_0x3c8252,function(_0xcf25e9){return Number(_0xcf25e9['MailQueueId']);});return db['UserMailQueue'][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'MailQueueId':{'$in':_0x3fded5}},'transaction':_0x32dbb3});})['then'](function(){var _0x2638f6='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x2638f6,{'type':db[_0xa835('0x63')]['QueryTypes'][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3});})['then'](function(_0x5aba89){var _0x1c12f2=_['map'](_0x5aba89,function(_0x34ff42){return Number(_0x34ff42[_0xa835('0x6a')]);});return db[_0xa835('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x474d13},'SmsQueueId':{'$in':_0x1c12f2}},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){var _0x2407be=_0xa835('0x6c')+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x2407be,{'type':db[_0xa835('0x63')][_0xa835('0x64')][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0x4cde9f){var _0x3d6e36=_['map'](_0x4cde9f,function(_0x4261be){return Number(_0x4261be[_0xa835('0x6d')]);});return db[_0xa835('0x6e')][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'ChatQueueId':{'$in':_0x3d6e36}},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){var _0x5b6d5b=_0xa835('0x6f')+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x5b6d5b,{'type':db['Sequelize'][_0xa835('0x64')]['SELECT'],'raw':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0x2eb2fa){var _0x4f683b=_[_0xa835('0x33')](_0x2eb2fa,function(_0x5eccab){return Number(_0x5eccab[_0xa835('0x70')]);});return db[_0xa835('0x71')]['destroy']({'where':{'UserId':{'$in':_0x474d13},'FaxQueueId':{'$in':_0x4f683b}},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){var _0x4b5ada=_0xa835('0x72')+_0x312c2c;return db['sequelize']['query'](_0x4b5ada,{'type':db[_0xa835('0x63')][_0xa835('0x64')][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3});})['then'](function(_0xabdd5a){var _0x28a1c6=_['map'](_0xabdd5a,function(_0x39c958){return Number(_0x39c958['OpenchannelQueueId']);});return db[_0xa835('0x73')][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'OpenchannelQueueId':{'$in':_0x28a1c6}},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){var _0x4d903a=_0xa835('0x74')+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x4d903a,{'type':db[_0xa835('0x63')]['QueryTypes'][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0x322f5f){var _0x2112fc=_[_0xa835('0x33')](_0x322f5f,function(_0x3389ec){return Number(_0x3389ec[_0xa835('0x75')]);});return db[_0xa835('0x76')][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'WhatsappQueueId':{'$in':_0x2112fc}},'transaction':_0x32dbb3});})['then'](function(){return db['TeamVoicePrefix'][_0xa835('0x51')]({'where':{'TeamId':_0x312c2c}});})['then'](function(_0x202597){if(_0x202597===null){return;}return db[_0xa835('0x77')][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'VoicePrefixId':_0x202597[_0xa835('0x78')]},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){return db[_0xa835('0x34')][_0xa835('0x5f')]({'where':{'id':_0x312c2c},'cascade':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0x5c4dfc){if(_0x5c4dfc===0x0){_0xb931f4[_0xa835('0x2e')](0x194);}else{return db[_0xa835('0x5c')][_0xa835('0x5f')]({'where':{'type':_0xa835('0x58'),'resourceId':_0x312c2c},'cascade':!![],'transaction':_0x32dbb3})[_0xa835('0x2d')](function(){_0xb931f4[_0xa835('0x21')](0xcc)[_0xa835('0x79')]();});}})[_0xa835('0x4d')](function(_0x2fbe3d){_0xb931f4[_0xa835('0x21')](0x1f4)[_0xa835('0x31')](_0x2fbe3d);});});};exports[_0xa835('0x7a')]=function(_0x26308a,_0x498859,_0x4189df){return db[_0xa835('0x34')]['findOne']({'where':{'id':_0x26308a[_0xa835('0x4f')]['id']}})[_0xa835('0x2d')](handleEntityNotFound(_0x498859,null))[_0xa835('0x2d')](function(_0x5e786a){if(!_0x26308a[_0xa835('0x39')][_0xa835('0x7b')]||!utils[_0xa835('0x7c')](_0x26308a[_0xa835('0x39')][_0xa835('0x7b')])){throw new db[(_0xa835('0x63'))]['ValidationError'](_0xa835('0x7d'));}var _0x45c40d={};var _0x33f911={};_0x33f911[_0xa835('0x38')]=_[_0xa835('0x3a')](db[_[_0xa835('0x7e')](_0x26308a[_0xa835('0x39')]['channel']['toLowerCase']())+_0xa835('0x7f')][_0xa835('0x35')]);_0x33f911['query']=_[_0xa835('0x3a')](_0x26308a[_0xa835('0x39')]);_0x33f911[_0xa835('0x42')]=_[_0xa835('0x3b')](_0x33f911['model'],_0x33f911[_0xa835('0x39')]);_0x45c40d['attributes']=_[_0xa835('0x3b')](_0x33f911[_0xa835('0x38')],qs[_0xa835('0x3d')](_0x26308a[_0xa835('0x39')][_0xa835('0x3d')]));_0x45c40d[_0xa835('0x3c')]=_0x45c40d[_0xa835('0x3c')][_0xa835('0x50')]?_0x45c40d[_0xa835('0x3c')]:_0x33f911[_0xa835('0x38')];_0x45c40d[_0xa835('0x25')]=qs[_0xa835('0x25')](_0x26308a[_0xa835('0x39')][_0xa835('0x25')]);_0x45c40d['offset']=qs['offset'](_0x26308a[_0xa835('0x39')][_0xa835('0x23')]);_0x45c40d[_0xa835('0x40')]=qs[_0xa835('0x41')](_0x26308a['query'][_0xa835('0x41')]);_0x45c40d[_0xa835('0x45')]=qs[_0xa835('0x42')](_[_0xa835('0x43')](_0x26308a[_0xa835('0x39')],_0x33f911[_0xa835('0x42')]));_0x45c40d=_[_0xa835('0x46')]({},_0x45c40d,_0x26308a[_0xa835('0x48')]);return _0x5e786a[_0xa835('0x55')+_[_0xa835('0x7e')](_0x26308a[_0xa835('0x39')]['channel']['toLowerCase']())+_0xa835('0x80')](_0x45c40d);})[_0xa835('0x2d')](respondWithResult(_0x498859,null))[_0xa835('0x4d')](handleError(_0x498859,null));};exports[_0xa835('0x81')]=function(_0x3de9cb,_0x21b087,_0x404f3e){return db['Team'][_0xa835('0x82')]({'where':{'id':_0x3de9cb['params']['id']}})[_0xa835('0x2d')](function(_0x15b50d){if(_0x15b50d){if(!_0x3de9cb[_0xa835('0x53')][_0xa835('0x7b')]||!utils[_0xa835('0x7c')](_0x3de9cb[_0xa835('0x53')]['channel'])){throw new db[(_0xa835('0x63'))][(_0xa835('0x83'))](_0xa835('0x7d'));}return _0x15b50d[_0xa835('0x84')+_[_0xa835('0x7e')](_0x3de9cb['body'][_0xa835('0x7b')][_0xa835('0x85')]())+_0xa835('0x80')](_0x3de9cb['body'][_0xa835('0x86')]);}return null;})[_0xa835('0x2d')](handleEntityNotFound(_0x21b087,null))[_0xa835('0x2d')](respondWithStatusCode(_0x21b087,null))[_0xa835('0x4d')](handleError(_0x21b087,null));};exports[_0xa835('0x87')]=function(_0x334170,_0x3db63a,_0x4a9498){return db[_0xa835('0x34')][_0xa835('0x82')]({'where':{'id':_0x334170[_0xa835('0x4f')]['id']}})[_0xa835('0x2d')](function(_0x7d8e53){if(_0x7d8e53){if(!_0x334170[_0xa835('0x39')]['channel']||!utils[_0xa835('0x7c')](_0x334170[_0xa835('0x39')]['channel'])){throw new db[(_0xa835('0x63'))][(_0xa835('0x83'))](_0xa835('0x7d'));}return _0x7d8e53[_0xa835('0x88')+_[_0xa835('0x7e')](_0x334170[_0xa835('0x39')]['channel'][_0xa835('0x85')]())+_0xa835('0x80')](_0x334170[_0xa835('0x39')][_0xa835('0x86')]);}return null;})[_0xa835('0x2d')](handleEntityNotFound(_0x3db63a,null))[_0xa835('0x2d')](respondWithStatusCode(_0x3db63a,null))[_0xa835('0x4d')](handleError(_0x3db63a,null));};exports['addAgents']=function(_0x2c6bb0,_0xa24e32){var _0x7e6bdd=_[_0xa835('0x89')](_0x2c6bb0['body'][_0xa835('0x86')])?_0x2c6bb0[_0xa835('0x53')][_0xa835('0x86')]:[_0x2c6bb0[_0xa835('0x53')][_0xa835('0x86')]];var _0x20c1f2=_0x2c6bb0[_0xa835('0x4f')]['id'];return db[_0xa835('0x34')][_0xa835('0x51')]({'where':{'id':_0x20c1f2}})[_0xa835('0x2d')](handleEntityNotFound(_0xa24e32,null))[_0xa835('0x2d')](function(_0xa73c6a){if(_0xa73c6a){var _0x31325a=['Voice',_0xa835('0x8a'),_0xa835('0x8b'),_0xa835('0x8c'),_0xa835('0x8d'),'Openchannel',_0xa835('0x8e')];return db[_0xa835('0x60')][_0xa835('0x61')](function(_0x201764){var _0x52f432=_[_0xa835('0x33')](_0x31325a,function(_0x2d43ba){var _0x28fc52={'attributes':['id',_0xa835('0x30')]};if(_0x2d43ba===_0xa835('0x8f')){_0x28fc52[_0xa835('0x90')]={'attributes':[_0xa835('0x91')]};}return _0xa73c6a[_0xa835('0x55')+_0x2d43ba+'Queues'](_0x28fc52)[_0xa835('0x2d')](function(_0x37e4ab){var _0x5e6d75=_[_0xa835('0x33')](_0x37e4ab,function(_0x606b42){var _0x2adb96=_[_0xa835('0x33')](_0x7e6bdd,function(_0x3fedb9){var _0x13a08f={'where':{'UserId':_0x3fedb9,[_0x2d43ba+'QueueId']:_0x606b42['id']},'transaction':_0x201764};if(_0x2d43ba===_0xa835('0x8f')){_0x13a08f[_0xa835('0x1d')]={'penalty':_0x606b42['TeamVoiceQueue'][_0xa835('0x91')]};}return db[_0xa835('0x92')+_0x2d43ba+_0xa835('0x7f')]['findOrCreate'](_0x13a08f)[_0xa835('0x2d')](function(){socket['emit'](_0xa835('0x54')+_0x2d43ba+_0xa835('0x93'),{'UserId':_0x3fedb9,[_0x2d43ba+_0xa835('0x94')]:_0x606b42['id']});if(_0x2d43ba!==_0xa835('0x8f')){return;}return db['User']['findAll']({'where':{'id':_0x7e6bdd,'online':0x1},'attributes':['id',_0xa835('0x30'),_0xa835('0x95'),_0xa835('0x96'),_0xa835('0x97')],'raw':!![]})[_0xa835('0x2d')](function(_0x284e54){var _0x20020f=_[_0xa835('0x33')](_0x284e54,function(_0x2991f3){return db[_0xa835('0x98')][_0xa835('0x99')]({'membername':_0x2991f3[_0xa835('0x30')],'UserId':_0x2991f3['id'],'queue_name':_0x606b42[_0xa835('0x30')],'VoiceQueueId':_0x606b42['id'],'interface':_[_0xa835('0x9a')](_0x2991f3[_0xa835('0x97')])?util[_0xa835('0x9b')](_0xa835('0x9c'),_0x2991f3[_0xa835('0x30')]):_0x2991f3[_0xa835('0x97')],'paused':_0x2991f3[_0xa835('0x96')]||![],'penalty':_0x606b42[_0xa835('0x9d')][_0xa835('0x91')]},{'transaction':_0x201764});});return Promise[_0xa835('0x9e')](_0x20020f);});});});return Promise[_0xa835('0x9e')](_0x2adb96);});return Promise[_0xa835('0x9e')](_0x5e6d75);})['then'](function(){return db['TeamVoicePrefix'][_0xa835('0x82')]({'where':{'teamId':_0x20c1f2}})[_0xa835('0x2d')](function(_0x567ea9){if(_0x567ea9){var _0x5d3151=_[_0xa835('0x33')](_0x7e6bdd,function(_0x3038ae){db['UserVoicePrefix'][_0xa835('0x99')]({'UserId':_0x3038ae,'VoicePrefixId':_0x567ea9['VoicePrefixId']});});return Promise[_0xa835('0x9e')](_0x5d3151);}});});});return Promise[_0xa835('0x9e')](_0x52f432)[_0xa835('0x2d')](function(){return _0xa73c6a[_0xa835('0x9f')](_0x7e6bdd,{'transaction':_0x201764})[_0xa835('0xa0')](function(_0x3d9d87){return _0x3d9d87;});});});}})[_0xa835('0x2d')](respondWithResult(_0xa24e32,null))[_0xa835('0x4d')](handleError(_0xa24e32,null));};exports[_0xa835('0xa1')]=function(_0x515bc4,_0x514c85){var _0x42de7e=_['isArray'](_0x515bc4[_0xa835('0x39')][_0xa835('0x86')])?_0x515bc4[_0xa835('0x39')][_0xa835('0x86')]:[_0x515bc4['query'][_0xa835('0x86')]];var _0x4e309e=_0x515bc4['params']['id'];return db[_0xa835('0x34')]['find']({'where':{'id':_0x4e309e}})[_0xa835('0x2d')](handleEntityNotFound(_0x514c85,null))[_0xa835('0x2d')](function(_0x460681){if(_0x460681){var _0x437303=['Voice',_0xa835('0x8a'),_0xa835('0x8b'),_0xa835('0x8c'),'Fax',_0xa835('0xa2'),'Whatsapp'];return db[_0xa835('0x60')]['transaction'](function(_0x4dceca){var _0x5bcab8=_[_0xa835('0x33')](_0x437303,function(_0x17f7aa){var _0x3bf078={'attributes':['id',_0xa835('0x30')]};return _0x460681['get'+_0x17f7aa+_0xa835('0x80')](_0x3bf078)[_0xa835('0x2d')](function(_0x3d34a1){var _0x535fda=_[_0xa835('0x33')](_0x3d34a1,function(_0x217a2c){return _0x217a2c[_0xa835('0xa1')](_0x42de7e,{'transaction':_0x4dceca})[_0xa835('0x2d')](function(){var _0x363aef=_[_0xa835('0x33')](_0x42de7e,function(_0x341531){socket[_0xa835('0xa3')](_0xa835('0x54')+_0x17f7aa+'Queue:remove',{'UserId':Number(_0x341531),[_0x17f7aa+_0xa835('0x94')]:_0x217a2c['id']});if(_0x17f7aa!==_0xa835('0x8f')){return;}return db[_0xa835('0x98')][_0xa835('0x5f')]({'where':{'VoiceQueueId':_0x217a2c['id'],'UserId':_0x341531},'transaction':_0x4dceca});});return Promise[_0xa835('0x9e')](_0x363aef);});});return Promise[_0xa835('0x9e')](_0x535fda);});});return Promise[_0xa835('0x9e')](_0x5bcab8)[_0xa835('0x2d')](function(){return _0x460681['removeAgents'](_0x42de7e,{'transaction':_0x4dceca});})[_0xa835('0x2d')](function(){return db[_0xa835('0xa4')]['findOne']({'where':{'teamId':_0x4e309e}})[_0xa835('0x2d')](function(_0x5a1265){if(_0x5a1265){var _0x7313de=_[_0xa835('0x33')](_0x42de7e,function(_0xc716d7){db[_0xa835('0x77')][_0xa835('0x5f')]({'where':{'UserId':_0xc716d7,'VoicePrefixId':_0x5a1265['VoicePrefixId']}});});return Promise[_0xa835('0x9e')](_0x7313de);}});});});}})['then'](respondWithStatusCode(_0x514c85,null))[_0xa835('0x4d')](handleError(_0x514c85,null));};exports['getAgents']=function(_0x4f00fa,_0x3ec31a,_0x4c4f6c){var _0x46bc8c={};var _0x311315={};var _0x368e29;var _0x3b794e;return db[_0xa835('0x34')][_0xa835('0x82')]({'where':{'id':_0x4f00fa[_0xa835('0x4f')]['id']}})[_0xa835('0x2d')](handleEntityNotFound(_0x3ec31a,null))[_0xa835('0x2d')](function(_0x499c4f){if(_0x499c4f){_0x368e29=_0x499c4f;_0x311315[_0xa835('0x38')]=_[_0xa835('0x3a')](db[_0xa835('0x92')][_0xa835('0x35')]);_0x311315[_0xa835('0x39')]=_[_0xa835('0x3a')](_0x4f00fa[_0xa835('0x39')]);_0x311315[_0xa835('0x42')]=_[_0xa835('0x3b')](_0x311315[_0xa835('0x38')],_0x311315[_0xa835('0x39')]);_0x46bc8c[_0xa835('0x3c')]=_[_0xa835('0x3b')](_0x311315['model'],qs['fields'](_0x4f00fa['query']['fields']));_0x46bc8c[_0xa835('0x3c')]=_0x46bc8c[_0xa835('0x3c')]['length']?_0x46bc8c['attributes']:_0x311315[_0xa835('0x38')];_0x46bc8c['order']=qs[_0xa835('0x41')](_0x4f00fa[_0xa835('0x39')]['sort']);_0x46bc8c[_0xa835('0x45')]=qs[_0xa835('0x42')](_[_0xa835('0x43')](_0x4f00fa[_0xa835('0x39')],_0x311315[_0xa835('0x42')]));if(_0x4f00fa[_0xa835('0x39')][_0xa835('0x44')]){_0x46bc8c[_0xa835('0x45')]=_['merge'](_0x46bc8c['where'],{'$or':_[_0xa835('0x33')](_0x46bc8c[_0xa835('0x3c')],function(_0x5a4485){var _0x2b78ce={};_0x2b78ce[_0x5a4485]={'$like':'%'+_0x4f00fa[_0xa835('0x39')][_0xa835('0x44')]+'%'};return _0x2b78ce;})});}_0x46bc8c=_[_0xa835('0x46')]({},_0x46bc8c,_0x4f00fa['options']);return _0x368e29[_0xa835('0xa5')](_0x46bc8c);}})[_0xa835('0x2d')](function(_0x41a98d){if(_0x41a98d){_0x3b794e=_0x41a98d[_0xa835('0x50')];if(!_0x4f00fa[_0xa835('0x39')][_0xa835('0x3e')](_0xa835('0x3f'))){_0x46bc8c['limit']=qs['limit'](_0x4f00fa[_0xa835('0x39')][_0xa835('0x25')]);_0x46bc8c[_0xa835('0x23')]=qs[_0xa835('0x23')](_0x4f00fa[_0xa835('0x39')][_0xa835('0x23')]);}return _0x368e29[_0xa835('0xa5')](_0x46bc8c);}})[_0xa835('0x2d')](function(_0x237159){if(_0x237159){return _0x237159?{'count':_0x3b794e,'rows':_0x237159}:null;}})[_0xa835('0x2d')](respondWithResult(_0x3ec31a,null))[_0xa835('0x4d')](handleError(_0x3ec31a,null));}; \ No newline at end of file +var _0x042d=['rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','json','limit','undefined','offset','count','Content-Range','apply','reject','update','then','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','transaction','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','end','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','Queue','capitalize','toLowerCase','Queues','addQueues','findOne','add','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','QueueId','TeamVoiceQueue','emit','User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','penalty','all','TeamVoicePrefix','spread','removeAgents','Queue:remove','getAgents','hasOwnProperty'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x042d,0x9f));var _0xd042=function(_0x5341ff,_0x1de6df){_0x5341ff=_0x5341ff-0x0;var _0x53be58=_0x042d[_0x5341ff];return _0x53be58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd042('0x0'));var zipdir=require(_0xd042('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd042('0x2'));var moment=require(_0xd042('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd042('0x4'));var util=require(_0xd042('0x5'));var path=require(_0xd042('0x6'));var sox=require(_0xd042('0x7'));var csv=require(_0xd042('0x8'));var ejs=require(_0xd042('0x9'));var fs=require('fs');var fs_extra=require(_0xd042('0xa'));var _=require('lodash');var squel=require(_0xd042('0xb'));var crypto=require(_0xd042('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd042('0xd'));var toCsv=require(_0xd042('0x8'));var querystring=require(_0xd042('0xe'));var Papa=require(_0xd042('0xf'));var Redis=require(_0xd042('0x10'));var authService=require(_0xd042('0x11'));var qs=require(_0xd042('0x12'));var as=require(_0xd042('0x13'));var hardwareService=require(_0xd042('0x14'));var logger=require(_0xd042('0x15'))(_0xd042('0x16'));var utils=require(_0xd042('0x17'));var config=require(_0xd042('0x18'));var licenseUtil=require(_0xd042('0x19'));var db=require(_0xd042('0x1a'))['db'];config['redis']=_[_0xd042('0x1b')](config[_0xd042('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xd042('0x1d'))(new Redis(config[_0xd042('0x1c')]));require('./team.socket')[_0xd042('0x1e')](socket);function respondWithStatusCode(_0x4e3d48,_0x2655f2){_0x2655f2=_0x2655f2||0xcc;return function(_0x33da05){if(_0x33da05){return _0x4e3d48[_0xd042('0x1f')](_0x2655f2);}return _0x4e3d48[_0xd042('0x20')](_0x2655f2)['end']();};}function respondWithResult(_0x23978,_0x3f870a){_0x3f870a=_0x3f870a||0xc8;return function(_0x532181){if(_0x532181){return _0x23978[_0xd042('0x20')](_0x3f870a)[_0xd042('0x21')](_0x532181);}};}function respondWithFilteredResult(_0xf164dc,_0x48517e){return function(_0x4de700){if(_0x4de700){var _0x5bc922=typeof _0x48517e['offset']==='undefined'&&typeof _0x48517e[_0xd042('0x22')]===_0xd042('0x23');var _0x43b2a5=_0x4de700['count'];var _0x33fa79=_0x5bc922?0x0:_0x48517e[_0xd042('0x24')];var _0x2ac3ea=_0x5bc922?_0x4de700[_0xd042('0x25')]:_0x48517e[_0xd042('0x24')]+_0x48517e[_0xd042('0x22')];var _0x35234d;if(_0x2ac3ea>=_0x43b2a5){_0x2ac3ea=_0x43b2a5;_0x35234d=0xc8;}else{_0x35234d=0xce;}_0xf164dc[_0xd042('0x20')](_0x35234d);return _0xf164dc['set'](_0xd042('0x26'),_0x33fa79+'-'+_0x2ac3ea+'/'+_0x43b2a5)[_0xd042('0x21')](_0x4de700);}return null;};}function patchUpdates(_0x2349ea){return function(_0x172f8c){try{jsonpatch[_0xd042('0x27')](_0x172f8c,_0x2349ea,!![]);}catch(_0xc91418){return BPromise[_0xd042('0x28')](_0xc91418);}return _0x172f8c['save']();};}function saveUpdates(_0x55c0a8,_0x235da4){return function(_0x53351b){if(_0x53351b){return _0x53351b[_0xd042('0x29')](_0x55c0a8)[_0xd042('0x2a')](function(_0x2607f3){return _0x2607f3;});}return null;};}function handleEntityNotFound(_0x31be0b,_0x50634c){return function(_0x4d87f7){if(!_0x4d87f7){_0x31be0b[_0xd042('0x1f')](0x194);}return _0x4d87f7;};}function handleError(_0x524239,_0x1c1342){_0x1c1342=_0x1c1342||0x1f4;return function(_0x20fa33){logger['error'](_0x20fa33[_0xd042('0x2b')]);if(_0x20fa33[_0xd042('0x2c')]){delete _0x20fa33[_0xd042('0x2c')];}_0x524239['status'](_0x1c1342)[_0xd042('0x2d')](_0x20fa33);};}exports[_0xd042('0x2e')]=function(_0x72406f,_0x3bb29c){var _0x2aeb6d={},_0x423cc0={},_0x50036d={'count':0x0,'rows':[]};var _0x517bae=_[_0xd042('0x2f')](db[_0xd042('0x30')][_0xd042('0x31')],function(_0x3f0fe7){return{'name':_0x3f0fe7[_0xd042('0x32')],'type':_0x3f0fe7[_0xd042('0x33')][_0xd042('0x34')]};});_0x423cc0[_0xd042('0x35')]=_[_0xd042('0x2f')](_0x517bae,_0xd042('0x2c'));_0x423cc0['query']=_[_0xd042('0x36')](_0x72406f[_0xd042('0x37')]);_0x423cc0[_0xd042('0x38')]=_[_0xd042('0x39')](_0x423cc0[_0xd042('0x35')],_0x423cc0[_0xd042('0x37')]);_0x2aeb6d[_0xd042('0x3a')]=_[_0xd042('0x39')](_0x423cc0[_0xd042('0x35')],qs[_0xd042('0x3b')](_0x72406f[_0xd042('0x37')][_0xd042('0x3b')]));_0x2aeb6d['attributes']=_0x2aeb6d[_0xd042('0x3a')]['length']?_0x2aeb6d['attributes']:_0x423cc0['model'];if(!_0x72406f['query']['hasOwnProperty'](_0xd042('0x3c'))){_0x2aeb6d[_0xd042('0x22')]=qs[_0xd042('0x22')](_0x72406f[_0xd042('0x37')][_0xd042('0x22')]);_0x2aeb6d[_0xd042('0x24')]=qs['offset'](_0x72406f['query'][_0xd042('0x24')]);}_0x2aeb6d[_0xd042('0x3d')]=qs[_0xd042('0x3e')](_0x72406f[_0xd042('0x37')][_0xd042('0x3e')]);_0x2aeb6d[_0xd042('0x3f')]=qs[_0xd042('0x38')](_[_0xd042('0x40')](_0x72406f['query'],_0x423cc0[_0xd042('0x38')]),_0x517bae);if(_0x72406f[_0xd042('0x37')][_0xd042('0x41')]){_0x2aeb6d[_0xd042('0x3f')]=_[_0xd042('0x42')](_0x2aeb6d[_0xd042('0x3f')],{'$or':_['map'](_0x517bae,function(_0x3abf93){if(_0x3abf93[_0xd042('0x33')]!=='VIRTUAL'){var _0x2483b4={};_0x2483b4[_0x3abf93[_0xd042('0x2c')]]={'$like':'%'+_0x72406f['query'][_0xd042('0x41')]+'%'};return _0x2483b4;}})});}_0x2aeb6d=_['merge']({},_0x2aeb6d,_0x72406f[_0xd042('0x43')]);var _0x1f727e={'where':_0x2aeb6d['where']};return db['Team'][_0xd042('0x25')](_0x1f727e)[_0xd042('0x2a')](function(_0x29d762){_0x50036d['count']=_0x29d762;if(_0x72406f[_0xd042('0x37')]['includeAll']){_0x2aeb6d[_0xd042('0x44')]=[{'all':!![]}];}return db[_0xd042('0x30')][_0xd042('0x45')](_0x2aeb6d);})[_0xd042('0x2a')](function(_0x3e1c6b){_0x50036d[_0xd042('0x46')]=_0x3e1c6b;return _0x50036d;})[_0xd042('0x2a')](respondWithFilteredResult(_0x3bb29c,_0x2aeb6d))[_0xd042('0x47')](handleError(_0x3bb29c,null));};exports[_0xd042('0x48')]=function(_0x161940,_0x5d1014){var _0x2cc5e3={'raw':![],'where':{'id':_0x161940[_0xd042('0x49')]['id']}},_0x1f4a41={};_0x1f4a41[_0xd042('0x35')]=_['keys'](db[_0xd042('0x30')][_0xd042('0x31')]);_0x1f4a41[_0xd042('0x37')]=_[_0xd042('0x36')](_0x161940[_0xd042('0x37')]);_0x1f4a41['filters']=_[_0xd042('0x39')](_0x1f4a41[_0xd042('0x35')],_0x1f4a41['query']);_0x2cc5e3[_0xd042('0x3a')]=_[_0xd042('0x39')](_0x1f4a41['model'],qs['fields'](_0x161940['query'][_0xd042('0x3b')]));_0x2cc5e3[_0xd042('0x3a')]=_0x2cc5e3['attributes'][_0xd042('0x4a')]?_0x2cc5e3[_0xd042('0x3a')]:_0x1f4a41['model'];if(_0x161940[_0xd042('0x37')][_0xd042('0x4b')]){_0x2cc5e3['include']=[{'all':!![]}];}_0x2cc5e3=_[_0xd042('0x42')]({},_0x2cc5e3,_0x161940[_0xd042('0x43')]);return db[_0xd042('0x30')][_0xd042('0x4c')](_0x2cc5e3)[_0xd042('0x2a')](handleEntityNotFound(_0x5d1014,null))[_0xd042('0x2a')](respondWithResult(_0x5d1014,null))['catch'](handleError(_0x5d1014,null));};exports[_0xd042('0x4d')]=function(_0xa02965,_0x45d727){return db['Team'][_0xd042('0x4d')](_0xa02965['body'],{})[_0xd042('0x2a')](function(_0x7f5561){var _0x56683e=_0xa02965[_0xd042('0x4e')][_0xd042('0x4f')]({'plain':!![]});if(!_0x56683e)throw new Error(_0xd042('0x50'));if(_0x56683e[_0xd042('0x51')]===_0xd042('0x4e')){var _0x355b58=_0x7f5561[_0xd042('0x4f')]({'plain':!![]});var _0x5c55fb=_0xd042('0x52');return db[_0xd042('0x53')][_0xd042('0x4c')]({'where':{'name':_0x5c55fb,'userProfileId':_0x56683e[_0xd042('0x54')]},'raw':!![]})[_0xd042('0x2a')](function(_0x498449){if(_0x498449&&_0x498449[_0xd042('0x55')]===0x0){return db[_0xd042('0x56')][_0xd042('0x4d')]({'name':_0x355b58[_0xd042('0x2c')],'resourceId':_0x355b58['id'],'type':_0x498449[_0xd042('0x2c')],'sectionId':_0x498449['id']},{})['then'](function(){return _0x7f5561;});}else{return _0x7f5561;}})[_0xd042('0x47')](function(_0x431ee6){logger[_0xd042('0x57')](_0xd042('0x58'),_0x431ee6);throw _0x431ee6;});}return _0x7f5561;})[_0xd042('0x2a')](respondWithResult(_0x45d727,0xc9))[_0xd042('0x47')](handleError(_0x45d727,null));};exports[_0xd042('0x29')]=function(_0x20124e,_0x4ab464){if(_0x20124e[_0xd042('0x59')]['id']){delete _0x20124e[_0xd042('0x59')]['id'];}return db[_0xd042('0x30')][_0xd042('0x4c')]({'where':{'id':_0x20124e[_0xd042('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ab464,null))[_0xd042('0x2a')](saveUpdates(_0x20124e[_0xd042('0x59')],null))['then'](respondWithResult(_0x4ab464,null))[_0xd042('0x47')](handleError(_0x4ab464,null));};exports[_0xd042('0x5a')]=function(_0x19b82e,_0x3da748){var _0x263149=_0x19b82e[_0xd042('0x49')]['id'];var _0x38bd34=[];return db['sequelize'][_0xd042('0x5b')](function(_0x46aa1c){var _0x3a6183='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x263149;return db['sequelize'][_0xd042('0x37')](_0x3a6183,{'type':db[_0xd042('0x5c')][_0xd042('0x5d')]['SELECT'],'raw':!![],'transaction':_0x46aa1c})[_0xd042('0x2a')](function(_0x10c079){_0x38bd34=_[_0xd042('0x2f')](_0x10c079,function(_0x1cd785){return Number(_0x1cd785[_0xd042('0x5e')]);});})['then'](function(){var _0x339027=_0xd042('0x5f')+_0x263149;return db[_0xd042('0x60')][_0xd042('0x37')](_0x339027,{'type':db['Sequelize'][_0xd042('0x5d')][_0xd042('0x61')],'raw':!![],'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(_0x194e93){var _0x96702c=_[_0xd042('0x2f')](_0x194e93,function(_0x186c13){return Number(_0x186c13[_0xd042('0x62')]);});return db[_0xd042('0x63')]['destroy']({'where':{'UserId':{'$in':_0x38bd34},'VoiceQueueId':{'$in':_0x96702c}},'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(){var _0x45538e=_0xd042('0x64')+_0x263149;return db['sequelize'][_0xd042('0x37')](_0x45538e,{'type':db['Sequelize']['QueryTypes'][_0xd042('0x61')],'raw':!![],'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(_0x32ab03){var _0x527943=_[_0xd042('0x2f')](_0x32ab03,function(_0x1ffc3e){return Number(_0x1ffc3e[_0xd042('0x65')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x38bd34},'MailQueueId':{'$in':_0x527943}},'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(){var _0x3137a0=_0xd042('0x66')+_0x263149;return db[_0xd042('0x60')][_0xd042('0x37')](_0x3137a0,{'type':db[_0xd042('0x5c')][_0xd042('0x5d')][_0xd042('0x61')],'raw':!![],'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(_0x3bd9cc){var _0x487065=_[_0xd042('0x2f')](_0x3bd9cc,function(_0x2a816b){return Number(_0x2a816b[_0xd042('0x67')]);});return db[_0xd042('0x68')][_0xd042('0x5a')]({'where':{'UserId':{'$in':_0x38bd34},'SmsQueueId':{'$in':_0x487065}},'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(){var _0x43a697=_0xd042('0x69')+_0x263149;return db[_0xd042('0x60')][_0xd042('0x37')](_0x43a697,{'type':db[_0xd042('0x5c')][_0xd042('0x5d')][_0xd042('0x61')],'raw':!![],'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(_0x291821){var _0x46bbba=_[_0xd042('0x2f')](_0x291821,function(_0xb22f4c){return Number(_0xb22f4c[_0xd042('0x6a')]);});return db[_0xd042('0x6b')][_0xd042('0x5a')]({'where':{'UserId':{'$in':_0x38bd34},'ChatQueueId':{'$in':_0x46bbba}},'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(){var _0xf49807=_0xd042('0x6c')+_0x263149;return db[_0xd042('0x60')][_0xd042('0x37')](_0xf49807,{'type':db['Sequelize'][_0xd042('0x5d')][_0xd042('0x61')],'raw':!![],'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(_0x5dfb06){var _0x2a1aba=_['map'](_0x5dfb06,function(_0x19b0b5){return Number(_0x19b0b5[_0xd042('0x6d')]);});return db[_0xd042('0x6e')][_0xd042('0x5a')]({'where':{'UserId':{'$in':_0x38bd34},'FaxQueueId':{'$in':_0x2a1aba}},'transaction':_0x46aa1c});})['then'](function(){var _0x3c5765=_0xd042('0x6f')+_0x263149;return db[_0xd042('0x60')][_0xd042('0x37')](_0x3c5765,{'type':db[_0xd042('0x5c')][_0xd042('0x5d')][_0xd042('0x61')],'raw':!![],'transaction':_0x46aa1c});})['then'](function(_0x25dc03){var _0x5554b7=_['map'](_0x25dc03,function(_0x397c59){return Number(_0x397c59[_0xd042('0x70')]);});return db[_0xd042('0x71')][_0xd042('0x5a')]({'where':{'UserId':{'$in':_0x38bd34},'OpenchannelQueueId':{'$in':_0x5554b7}},'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(){var _0x2bda4a=_0xd042('0x72')+_0x263149;return db[_0xd042('0x60')][_0xd042('0x37')](_0x2bda4a,{'type':db[_0xd042('0x5c')][_0xd042('0x5d')][_0xd042('0x61')],'raw':!![],'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(_0x728399){var _0x2b9cc5=_['map'](_0x728399,function(_0x2f0531){return Number(_0x2f0531['WhatsappQueueId']);});return db[_0xd042('0x73')][_0xd042('0x5a')]({'where':{'UserId':{'$in':_0x38bd34},'WhatsappQueueId':{'$in':_0x2b9cc5}},'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(){return db['TeamVoicePrefix'][_0xd042('0x4c')]({'where':{'TeamId':_0x263149}});})['then'](function(_0x5a0024){if(_0x5a0024===null){return;}return db[_0xd042('0x74')][_0xd042('0x5a')]({'where':{'UserId':{'$in':_0x38bd34},'VoicePrefixId':_0x5a0024[_0xd042('0x75')]},'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(){return db[_0xd042('0x30')][_0xd042('0x5a')]({'where':{'id':_0x263149},'cascade':!![],'transaction':_0x46aa1c});})[_0xd042('0x2a')](function(_0x131be4){if(_0x131be4===0x0){_0x3da748[_0xd042('0x1f')](0x194);}else{return db[_0xd042('0x56')][_0xd042('0x5a')]({'where':{'type':_0xd042('0x52'),'resourceId':_0x263149},'cascade':!![],'transaction':_0x46aa1c})[_0xd042('0x2a')](function(){_0x3da748[_0xd042('0x20')](0xcc)[_0xd042('0x76')]();});}})[_0xd042('0x47')](function(_0x24783e){_0x3da748[_0xd042('0x20')](0x1f4)[_0xd042('0x2d')](_0x24783e);});});};exports[_0xd042('0x77')]=function(_0x4a4b39,_0xc6a1d,_0x290440){return db[_0xd042('0x30')]['findOne']({'where':{'id':_0x4a4b39[_0xd042('0x49')]['id']}})[_0xd042('0x2a')](handleEntityNotFound(_0xc6a1d,null))[_0xd042('0x2a')](function(_0x4c7a07){if(!_0x4a4b39['query'][_0xd042('0x78')]||!utils[_0xd042('0x79')](_0x4a4b39[_0xd042('0x37')][_0xd042('0x78')])){throw new db[(_0xd042('0x5c'))][(_0xd042('0x7a'))](_0xd042('0x7b'));}var _0x3ec112={};var _0x4b76e6={};_0x4b76e6[_0xd042('0x35')]=_[_0xd042('0x36')](db[_['capitalize'](_0x4a4b39[_0xd042('0x37')][_0xd042('0x78')]['toLowerCase']())+_0xd042('0x7c')][_0xd042('0x31')]);_0x4b76e6['query']=_[_0xd042('0x36')](_0x4a4b39[_0xd042('0x37')]);_0x4b76e6[_0xd042('0x38')]=_[_0xd042('0x39')](_0x4b76e6[_0xd042('0x35')],_0x4b76e6['query']);_0x3ec112[_0xd042('0x3a')]=_['intersection'](_0x4b76e6[_0xd042('0x35')],qs['fields'](_0x4a4b39['query'][_0xd042('0x3b')]));_0x3ec112[_0xd042('0x3a')]=_0x3ec112[_0xd042('0x3a')][_0xd042('0x4a')]?_0x3ec112[_0xd042('0x3a')]:_0x4b76e6[_0xd042('0x35')];_0x3ec112['limit']=qs['limit'](_0x4a4b39['query'][_0xd042('0x22')]);_0x3ec112[_0xd042('0x24')]=qs[_0xd042('0x24')](_0x4a4b39[_0xd042('0x37')][_0xd042('0x24')]);_0x3ec112['order']=qs[_0xd042('0x3e')](_0x4a4b39[_0xd042('0x37')][_0xd042('0x3e')]);_0x3ec112[_0xd042('0x3f')]=qs[_0xd042('0x38')](_[_0xd042('0x40')](_0x4a4b39[_0xd042('0x37')],_0x4b76e6[_0xd042('0x38')]));_0x3ec112=_[_0xd042('0x42')]({},_0x3ec112,_0x4a4b39[_0xd042('0x43')]);return _0x4c7a07[_0xd042('0x4f')+_[_0xd042('0x7d')](_0x4a4b39[_0xd042('0x37')][_0xd042('0x78')][_0xd042('0x7e')]())+_0xd042('0x7f')](_0x3ec112);})[_0xd042('0x2a')](respondWithResult(_0xc6a1d,null))['catch'](handleError(_0xc6a1d,null));};exports[_0xd042('0x80')]=function(_0x1092f8,_0x349cc7,_0x261563){return db[_0xd042('0x30')][_0xd042('0x81')]({'where':{'id':_0x1092f8['params']['id']}})[_0xd042('0x2a')](function(_0x260b54){if(_0x260b54){if(!_0x1092f8[_0xd042('0x59')][_0xd042('0x78')]||!utils[_0xd042('0x79')](_0x1092f8['body'][_0xd042('0x78')])){throw new db['Sequelize'][(_0xd042('0x7a'))]('Unknown\x20channel');}return _0x260b54[_0xd042('0x82')+_[_0xd042('0x7d')](_0x1092f8[_0xd042('0x59')][_0xd042('0x78')]['toLowerCase']())+_0xd042('0x7f')](_0x1092f8[_0xd042('0x59')][_0xd042('0x83')]);}return null;})[_0xd042('0x2a')](handleEntityNotFound(_0x349cc7,null))[_0xd042('0x2a')](respondWithStatusCode(_0x349cc7,null))[_0xd042('0x47')](handleError(_0x349cc7,null));};exports['removeQueues']=function(_0x294e74,_0x1691bd,_0x579afb){return db[_0xd042('0x30')]['findOne']({'where':{'id':_0x294e74[_0xd042('0x49')]['id']}})[_0xd042('0x2a')](function(_0x12b765){if(_0x12b765){if(!_0x294e74[_0xd042('0x37')][_0xd042('0x78')]||!utils[_0xd042('0x79')](_0x294e74['query']['channel'])){throw new db['Sequelize']['ValidationError'](_0xd042('0x7b'));}return _0x12b765['remove'+_[_0xd042('0x7d')](_0x294e74[_0xd042('0x37')][_0xd042('0x78')][_0xd042('0x7e')]())+_0xd042('0x7f')](_0x294e74[_0xd042('0x37')][_0xd042('0x83')]);}return null;})['then'](handleEntityNotFound(_0x1691bd,null))[_0xd042('0x2a')](respondWithStatusCode(_0x1691bd,null))[_0xd042('0x47')](handleError(_0x1691bd,null));};exports[_0xd042('0x84')]=function(_0x55e068,_0x31aa46){var _0x149e8a=_[_0xd042('0x85')](_0x55e068[_0xd042('0x59')][_0xd042('0x83')])?_0x55e068[_0xd042('0x59')][_0xd042('0x83')]:[_0x55e068[_0xd042('0x59')]['ids']];var _0x1248a2=_0x55e068[_0xd042('0x49')]['id'];return db[_0xd042('0x30')][_0xd042('0x4c')]({'where':{'id':_0x1248a2}})['then'](handleEntityNotFound(_0x31aa46,null))[_0xd042('0x2a')](function(_0x3a32e8){if(_0x3a32e8){var _0x466f97=[_0xd042('0x86'),_0xd042('0x87'),_0xd042('0x88'),_0xd042('0x89'),_0xd042('0x8a'),'Openchannel',_0xd042('0x8b')];return db['sequelize'][_0xd042('0x5b')](function(_0x14b084){var _0x23d1fe=_['map'](_0x466f97,function(_0x9c2f9e){var _0x442a80={'attributes':['id',_0xd042('0x2c')]};if(_0x9c2f9e==='Voice'){_0x442a80[_0xd042('0x8c')]={'attributes':['penalty']};}return _0x3a32e8[_0xd042('0x4f')+_0x9c2f9e+_0xd042('0x7f')](_0x442a80)['then'](function(_0xdc8821){var _0x20f0ee=_['map'](_0xdc8821,function(_0x3a8b8c){var _0x123988=_[_0xd042('0x2f')](_0x149e8a,function(_0x26cbda){var _0x33522e={'where':{'UserId':_0x26cbda,[_0x9c2f9e+_0xd042('0x8d')]:_0x3a8b8c['id']},'transaction':_0x14b084};if(_0x9c2f9e==='Voice'){_0x33522e['defaults']={'penalty':_0x3a8b8c[_0xd042('0x8e')]['penalty']};}return db['User'+_0x9c2f9e+_0xd042('0x7c')]['findOrCreate'](_0x33522e)[_0xd042('0x2a')](function(){socket[_0xd042('0x8f')](_0xd042('0x4e')+_0x9c2f9e+'Queue:save',{'UserId':_0x26cbda,[_0x9c2f9e+_0xd042('0x8d')]:_0x3a8b8c['id']});if(_0x9c2f9e!==_0xd042('0x86')){return;}return db[_0xd042('0x90')][_0xd042('0x45')]({'where':{'id':_0x149e8a,'online':0x1},'attributes':['id',_0xd042('0x2c'),'online',_0xd042('0x91'),_0xd042('0x92')],'raw':!![]})[_0xd042('0x2a')](function(_0x2e4c77){var _0x118eaa=_[_0xd042('0x2f')](_0x2e4c77,function(_0x5a0348){return db[_0xd042('0x93')][_0xd042('0x94')]({'membername':_0x5a0348['name'],'UserId':_0x5a0348['id'],'queue_name':_0x3a8b8c[_0xd042('0x2c')],'VoiceQueueId':_0x3a8b8c['id'],'interface':_[_0xd042('0x95')](_0x5a0348[_0xd042('0x92')])?util[_0xd042('0x96')]('SIP/%s',_0x5a0348[_0xd042('0x2c')]):_0x5a0348[_0xd042('0x92')],'paused':_0x5a0348[_0xd042('0x91')]||![],'penalty':_0x3a8b8c['TeamVoiceQueue'][_0xd042('0x97')]},{'transaction':_0x14b084});});return Promise[_0xd042('0x98')](_0x118eaa);});});});return Promise[_0xd042('0x98')](_0x123988);});return Promise[_0xd042('0x98')](_0x20f0ee);})[_0xd042('0x2a')](function(){return db[_0xd042('0x99')][_0xd042('0x81')]({'where':{'teamId':_0x1248a2}})[_0xd042('0x2a')](function(_0x22ca26){if(_0x22ca26){var _0x2b3fb8=_[_0xd042('0x2f')](_0x149e8a,function(_0x27a7bc){db[_0xd042('0x74')][_0xd042('0x94')]({'UserId':_0x27a7bc,'VoicePrefixId':_0x22ca26[_0xd042('0x75')]});});return Promise[_0xd042('0x98')](_0x2b3fb8);}});});});return Promise['all'](_0x23d1fe)['then'](function(){return _0x3a32e8[_0xd042('0x84')](_0x149e8a,{'transaction':_0x14b084})[_0xd042('0x9a')](function(_0xbf6d6){return _0xbf6d6;});});});}})[_0xd042('0x2a')](respondWithResult(_0x31aa46,null))[_0xd042('0x47')](handleError(_0x31aa46,null));};exports[_0xd042('0x9b')]=function(_0x277bf7,_0x5192c8){var _0x7b11c2=_[_0xd042('0x85')](_0x277bf7[_0xd042('0x37')][_0xd042('0x83')])?_0x277bf7['query']['ids']:[_0x277bf7[_0xd042('0x37')][_0xd042('0x83')]];var _0x132e8d=_0x277bf7['params']['id'];return db[_0xd042('0x30')]['find']({'where':{'id':_0x132e8d}})['then'](handleEntityNotFound(_0x5192c8,null))[_0xd042('0x2a')](function(_0x4aeafd){if(_0x4aeafd){var _0x1a0d75=[_0xd042('0x86'),_0xd042('0x87'),_0xd042('0x88'),'Sms',_0xd042('0x8a'),'Openchannel','Whatsapp'];return db[_0xd042('0x60')][_0xd042('0x5b')](function(_0x2361d2){var _0x186797=_[_0xd042('0x2f')](_0x1a0d75,function(_0x570677){var _0x1c5497={'attributes':['id',_0xd042('0x2c')]};return _0x4aeafd['get'+_0x570677+_0xd042('0x7f')](_0x1c5497)[_0xd042('0x2a')](function(_0x29aaa0){var _0x2232ef=_[_0xd042('0x2f')](_0x29aaa0,function(_0x3c7b34){return _0x3c7b34['removeAgents'](_0x7b11c2,{'transaction':_0x2361d2})[_0xd042('0x2a')](function(){var _0x5c020e=_[_0xd042('0x2f')](_0x7b11c2,function(_0x96da50){socket[_0xd042('0x8f')]('user'+_0x570677+_0xd042('0x9c'),{'UserId':Number(_0x96da50),[_0x570677+_0xd042('0x8d')]:_0x3c7b34['id']});if(_0x570677!==_0xd042('0x86')){return;}return db[_0xd042('0x93')][_0xd042('0x5a')]({'where':{'VoiceQueueId':_0x3c7b34['id'],'UserId':_0x96da50},'transaction':_0x2361d2});});return Promise['all'](_0x5c020e);});});return Promise[_0xd042('0x98')](_0x2232ef);});});return Promise['all'](_0x186797)[_0xd042('0x2a')](function(){return _0x4aeafd[_0xd042('0x9b')](_0x7b11c2,{'transaction':_0x2361d2});})[_0xd042('0x2a')](function(){return db['TeamVoicePrefix'][_0xd042('0x81')]({'where':{'teamId':_0x132e8d}})[_0xd042('0x2a')](function(_0x3ef778){if(_0x3ef778){var _0x3952d5=_[_0xd042('0x2f')](_0x7b11c2,function(_0x14f143){db[_0xd042('0x74')]['destroy']({'where':{'UserId':_0x14f143,'VoicePrefixId':_0x3ef778[_0xd042('0x75')]}});});return Promise['all'](_0x3952d5);}});});});}})['then'](respondWithStatusCode(_0x5192c8,null))[_0xd042('0x47')](handleError(_0x5192c8,null));};exports['getAgents']=function(_0x2e1847,_0x43136a,_0x2e1714){var _0x5cd4c0={};var _0x34ee5a={};var _0x550a6f;var _0x46ed41;return db[_0xd042('0x30')][_0xd042('0x81')]({'where':{'id':_0x2e1847['params']['id']}})[_0xd042('0x2a')](handleEntityNotFound(_0x43136a,null))[_0xd042('0x2a')](function(_0x1345d3){if(_0x1345d3){_0x550a6f=_0x1345d3;_0x34ee5a['model']=_[_0xd042('0x36')](db[_0xd042('0x90')]['rawAttributes']);_0x34ee5a[_0xd042('0x37')]=_[_0xd042('0x36')](_0x2e1847['query']);_0x34ee5a[_0xd042('0x38')]=_[_0xd042('0x39')](_0x34ee5a['model'],_0x34ee5a['query']);_0x5cd4c0[_0xd042('0x3a')]=_['intersection'](_0x34ee5a[_0xd042('0x35')],qs[_0xd042('0x3b')](_0x2e1847[_0xd042('0x37')][_0xd042('0x3b')]));_0x5cd4c0[_0xd042('0x3a')]=_0x5cd4c0[_0xd042('0x3a')][_0xd042('0x4a')]?_0x5cd4c0[_0xd042('0x3a')]:_0x34ee5a[_0xd042('0x35')];_0x5cd4c0[_0xd042('0x3d')]=qs[_0xd042('0x3e')](_0x2e1847[_0xd042('0x37')]['sort']);_0x5cd4c0[_0xd042('0x3f')]=qs[_0xd042('0x38')](_[_0xd042('0x40')](_0x2e1847[_0xd042('0x37')],_0x34ee5a[_0xd042('0x38')]));if(_0x2e1847[_0xd042('0x37')]['filter']){_0x5cd4c0[_0xd042('0x3f')]=_[_0xd042('0x42')](_0x5cd4c0[_0xd042('0x3f')],{'$or':_[_0xd042('0x2f')](_0x5cd4c0[_0xd042('0x3a')],function(_0x4d597b){var _0x290510={};_0x290510[_0x4d597b]={'$like':'%'+_0x2e1847['query'][_0xd042('0x41')]+'%'};return _0x290510;})});}_0x5cd4c0=_['merge']({},_0x5cd4c0,_0x2e1847['options']);return _0x550a6f[_0xd042('0x9d')](_0x5cd4c0);}})['then'](function(_0x34dd7a){if(_0x34dd7a){_0x46ed41=_0x34dd7a[_0xd042('0x4a')];if(!_0x2e1847[_0xd042('0x37')][_0xd042('0x9e')](_0xd042('0x3c'))){_0x5cd4c0[_0xd042('0x22')]=qs[_0xd042('0x22')](_0x2e1847[_0xd042('0x37')][_0xd042('0x22')]);_0x5cd4c0['offset']=qs[_0xd042('0x24')](_0x2e1847[_0xd042('0x37')]['offset']);}return _0x550a6f['getAgents'](_0x5cd4c0);}})[_0xd042('0x2a')](function(_0x5cc202){if(_0x5cc202){return _0x5cc202?{'count':_0x46ed41,'rows':_0x5cc202}:null;}})[_0xd042('0x2a')](respondWithResult(_0x43136a,null))[_0xd042('0x47')](handleError(_0x43136a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 0eadde9..3216319 100644 --- a/server/api/team/team.events.js +++ b/server/api/team/team.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82ca=['hook','exports','events','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82ca,0x18a));var _0xa82c=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x82ca[_0x43776a];return _0x18eb8f;};'use strict';var EventEmitter=require(_0xa82c('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xa82c('0x1')](0x0);var events={'afterCreate':_0xa82c('0x2'),'afterUpdate':'update','afterDestroy':_0xa82c('0x3')};function emitEvent(_0x3398a0){return function(_0x37aa32,_0x5c24b0,_0x234b8){TeamEvents[_0xa82c('0x4')](_0x3398a0+':'+_0x37aa32['id'],_0x37aa32);TeamEvents[_0xa82c('0x4')](_0x3398a0,_0x37aa32);_0x234b8(null);};}for(var e in events){if(events[_0xa82c('0x5')](e)){var event=events[e];Team[_0xa82c('0x6')](e,emitEvent(event));}}module[_0xa82c('0x7')]=TeamEvents; \ No newline at end of file +var _0x89e5=['exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4be24e,_0x1e9e6f){var _0x4d06ee=function(_0x18e3d2){while(--_0x18e3d2){_0x4be24e['push'](_0x4be24e['shift']());}};_0x4d06ee(++_0x1e9e6f);}(_0x89e5,0xd3));var _0x589e=function(_0x23d0bc,_0xcf5bdb){_0x23d0bc=_0x23d0bc-0x0;var _0x68bada=_0x89e5[_0x23d0bc];return _0x68bada;};'use strict';var EventEmitter=require(_0x589e('0x0'));var Team=require(_0x589e('0x1'))['db'][_0x589e('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x589e('0x3')](0x0);var events={'afterCreate':_0x589e('0x4'),'afterUpdate':_0x589e('0x5'),'afterDestroy':_0x589e('0x6')};function emitEvent(_0x123c62){return function(_0x35b76e,_0x2394e3,_0x36165e){TeamEvents[_0x589e('0x7')](_0x123c62+':'+_0x35b76e['id'],_0x35b76e);TeamEvents[_0x589e('0x7')](_0x123c62,_0x35b76e);_0x36165e(null);};}for(var e in events){if(events[_0x589e('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x589e('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 1a02a0d..9439be4 100644 --- a/server/api/team/team.model.js +++ b/server/api/team/team.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01e9=['define','Team','Chat','Fax','Mail','Openchannel','Sms','Whatsapp','all','Queues','then','map','setDataValue','channel','catch','exports'];(function(_0x2e1777,_0x1f056a){var _0x35628f=function(_0x50499e){while(--_0x50499e){_0x2e1777['push'](_0x2e1777['shift']());}};_0x35628f(++_0x1f056a);}(_0x01e9,0x129));var _0x901e=function(_0x796ad,_0x14500b){_0x796ad=_0x796ad-0x0;var _0x2c0004=_0x01e9[_0x796ad];return _0x2c0004;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x523f21,_0x3fc9ab){var _0x3f8042='get'+_0x3fc9ab+_0x901e('0x0');return _0x523f21[_0x3f8042]()[_0x901e('0x1')](function(_0x3ae125){return _[_0x901e('0x2')](_0x3ae125,function(_0x572227){_0x572227[_0x901e('0x3')](_0x901e('0x4'),_0x3fc9ab);return _0x572227;});})[_0x901e('0x5')](function(_0xeed784){throw _0xeed784;});}module[_0x901e('0x6')]=function(_0x3e235b){return _0x3e235b[_0x901e('0x7')](_0x901e('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x27fb83=this;var _0x544962=[_0x901e('0x9'),_0x901e('0xa'),_0x901e('0xb'),_0x901e('0xc'),_0x901e('0xd'),'Voice',_0x901e('0xe')];return Promise['resolve']()[_0x901e('0x1')](function(){var _0x2711f7=_[_0x901e('0x2')](_0x544962,function(_0x2e4beb){return getQueuesByChannel(_0x27fb83,_0x2e4beb);});return Promise[_0x901e('0xf')](_0x2711f7);})[_0x901e('0x5')](function(_0x2e54f2){throw _0x2e54f2;});}}});}; \ No newline at end of file +var _0x6982=['exports','define','Team','Chat','Fax','Openchannel','Sms','Voice','Whatsapp','resolve','catch','lodash','./team.attributes','then','map','setDataValue','channel'];(function(_0x114de8,_0x506566){var _0x376f01=function(_0x2bdbd2){while(--_0x2bdbd2){_0x114de8['push'](_0x114de8['shift']());}};_0x376f01(++_0x506566);}(_0x6982,0xe8));var _0x2698=function(_0x66dcdf,_0x27612d){_0x66dcdf=_0x66dcdf-0x0;var _0x1292d2=_0x6982[_0x66dcdf];return _0x1292d2;};'use strict';var _=require(_0x2698('0x0'));var attributes=require(_0x2698('0x1'));function getQueuesByChannel(_0x512c0a,_0x195acf){var _0x3e92d0='get'+_0x195acf+'Queues';return _0x512c0a[_0x3e92d0]()[_0x2698('0x2')](function(_0xd2be5){return _[_0x2698('0x3')](_0xd2be5,function(_0x436d5e){_0x436d5e[_0x2698('0x4')](_0x2698('0x5'),_0x195acf);return _0x436d5e;});})['catch'](function(_0x2cb585){throw _0x2cb585;});}module[_0x2698('0x6')]=function(_0x1842d8){return _0x1842d8[_0x2698('0x7')](_0x2698('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x357100=this;var _0x232ba4=[_0x2698('0x9'),_0x2698('0xa'),'Mail',_0x2698('0xb'),_0x2698('0xc'),_0x2698('0xd'),_0x2698('0xe')];return Promise[_0x2698('0xf')]()['then'](function(){var _0x2cdcd5=_[_0x2698('0x3')](_0x232ba4,function(_0x146bbb){return getQueuesByChannel(_0x357100,_0x146bbb);});return Promise['all'](_0x2cdcd5);})[_0x2698('0x10')](function(_0x11c72e){throw _0x11c72e;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 84271e2..bab66c1 100644 --- a/server/api/team/team.rpc.js +++ b/server/api/team/team.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdc4=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x277849,_0x36d9b7){var _0x315fb6=function(_0x290a88){while(--_0x290a88){_0x277849['push'](_0x277849['shift']());}};_0x315fb6(++_0x36d9b7);}(_0xfdc4,0x81));var _0x4fdc=function(_0x146182,_0x3d9f69){_0x146182=_0x146182-0x0;var _0x5d2636=_0xfdc4[_0x146182];return _0x5d2636;};'use strict';var _=require(_0x4fdc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4fdc('0x1'));var rs=require(_0x4fdc('0x2'));var fs=require('fs');var Redis=require(_0x4fdc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4fdc('0x4'));var logger=require(_0x4fdc('0x5'))(_0x4fdc('0x6'));var config=require(_0x4fdc('0x7'));var jayson=require(_0x4fdc('0x8'));var client=jayson[_0x4fdc('0x9')][_0x4fdc('0xa')]({'port':0x232a});config[_0x4fdc('0xb')]=_['defaults'](config[_0x4fdc('0xb')],{'host':_0x4fdc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fdc('0xb')]));require(_0x4fdc('0xd'))[_0x4fdc('0xe')](socket);function respondWithRpcPromise(_0x3154c7,_0x562acb,_0x55f349){return new BPromise(function(_0x2fd1d9,_0x3c04bd){return client[_0x4fdc('0xf')](_0x3154c7,_0x55f349)[_0x4fdc('0x10')](function(_0x180536){logger[_0x4fdc('0x11')](_0x4fdc('0x12'),_0x562acb,_0x4fdc('0x13'));logger[_0x4fdc('0x14')](_0x4fdc('0x15'),_0x562acb,_0x4fdc('0x13'),JSON['stringify'](_0x180536));if(_0x180536[_0x4fdc('0x16')]){if(_0x180536[_0x4fdc('0x16')][_0x4fdc('0x17')]===0x1f4){logger[_0x4fdc('0x16')](_0x4fdc('0x12'),_0x562acb,_0x180536['error'][_0x4fdc('0x18')]);return _0x3c04bd(_0x180536['error'][_0x4fdc('0x18')]);}logger[_0x4fdc('0x16')](_0x4fdc('0x12'),_0x562acb,_0x180536[_0x4fdc('0x16')][_0x4fdc('0x18')]);return _0x2fd1d9(_0x180536['error'][_0x4fdc('0x18')]);}else{logger['info'](_0x4fdc('0x12'),_0x562acb,_0x4fdc('0x13'));_0x2fd1d9(_0x180536[_0x4fdc('0x19')][_0x4fdc('0x18')]);}})[_0x4fdc('0x1a')](function(_0x3969df){logger[_0x4fdc('0x16')](_0x4fdc('0x12'),_0x562acb,_0x3969df);_0x3c04bd(_0x3969df);});});} \ No newline at end of file +var _0xa09e=['stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0xa09e,0x8c));var _0xea09=function(_0x54d164,_0x3be5ba){_0x54d164=_0x54d164-0x0;var _0xf58243=_0xa09e[_0x54d164];return _0xf58243;};'use strict';var _=require(_0xea09('0x0'));var util=require(_0xea09('0x1'));var moment=require(_0xea09('0x2'));var BPromise=require('bluebird');var rs=require(_0xea09('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea09('0x4'))['db'];var utils=require(_0xea09('0x5'));var logger=require('../../config/logger')(_0xea09('0x6'));var config=require(_0xea09('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xea09('0x8')][_0xea09('0x9')]({'port':0x232a});config['redis']=_[_0xea09('0xa')](config[_0xea09('0xb')],{'host':_0xea09('0xc'),'port':0x18eb});var socket=require(_0xea09('0xd'))(new Redis(config[_0xea09('0xb')]));require('./team.socket')[_0xea09('0xe')](socket);function respondWithRpcPromise(_0x394d61,_0x185b3d,_0x23cedd){return new BPromise(function(_0x1c188f,_0x522437){return client[_0xea09('0xf')](_0x394d61,_0x23cedd)[_0xea09('0x10')](function(_0x3a9504){logger[_0xea09('0x11')](_0xea09('0x12'),_0x185b3d,_0xea09('0x13'));logger[_0xea09('0x14')](_0xea09('0x15'),_0x185b3d,_0xea09('0x13'),JSON[_0xea09('0x16')](_0x3a9504));if(_0x3a9504[_0xea09('0x17')]){if(_0x3a9504[_0xea09('0x17')][_0xea09('0x18')]===0x1f4){logger[_0xea09('0x17')](_0xea09('0x12'),_0x185b3d,_0x3a9504['error'][_0xea09('0x19')]);return _0x522437(_0x3a9504['error'][_0xea09('0x19')]);}logger[_0xea09('0x17')](_0xea09('0x12'),_0x185b3d,_0x3a9504['error'][_0xea09('0x19')]);return _0x1c188f(_0x3a9504[_0xea09('0x17')]['message']);}else{logger[_0xea09('0x11')](_0xea09('0x12'),_0x185b3d,_0xea09('0x13'));_0x1c188f(_0x3a9504['result'][_0xea09('0x19')]);}})[_0xea09('0x1a')](function(_0xfbafcb){logger[_0xea09('0x17')]('Team,\x20%s,\x20%s',_0x185b3d,_0xfbafcb);_0x522437(_0xfbafcb);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f889706..1710416 100644 --- a/server/api/team/team.socket.js +++ b/server/api/team/team.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa866=['remove','update','emit','removeListener','register','length','team:','./team.events','save'];(function(_0x24802c,_0x12c479){var _0x41c440=function(_0x4bc95d){while(--_0x4bc95d){_0x24802c['push'](_0x24802c['shift']());}};_0x41c440(++_0x12c479);}(_0xa866,0x6a));var _0x6a86=function(_0xe64805,_0x1a4a2e){_0xe64805=_0xe64805-0x0;var _0x350c5e=_0xa866[_0xe64805];return _0x350c5e;};'use strict';var TeamEvents=require(_0x6a86('0x0'));var events=[_0x6a86('0x1'),_0x6a86('0x2'),_0x6a86('0x3')];function createListener(_0x43d158,_0x58d5c6){return function(_0x15236c){_0x58d5c6[_0x6a86('0x4')](_0x43d158,_0x15236c);};}function removeListener(_0x3d1631,_0x4a6d5a){return function(){TeamEvents[_0x6a86('0x5')](_0x3d1631,_0x4a6d5a);};}exports[_0x6a86('0x6')]=function(_0xac49a){for(var _0x5e7673=0x0,_0x183997=events[_0x6a86('0x7')];_0x5e7673<_0x183997;_0x5e7673++){var _0x3ed589=events[_0x5e7673];var _0x1330e1=createListener(_0x6a86('0x8')+_0x3ed589,_0xac49a);TeamEvents['on'](_0x3ed589,_0x1330e1);}}; \ No newline at end of file +var _0x2182=['./team.events','save','remove','update','emit','removeListener','register','length','team:'];(function(_0x191848,_0x50371a){var _0x72567a=function(_0x21e7f5){while(--_0x21e7f5){_0x191848['push'](_0x191848['shift']());}};_0x72567a(++_0x50371a);}(_0x2182,0xea));var _0x2218=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2182[_0x167cc1];return _0x10bc4b;};'use strict';var TeamEvents=require(_0x2218('0x0'));var events=[_0x2218('0x1'),_0x2218('0x2'),_0x2218('0x3')];function createListener(_0x564b8e,_0x41395e){return function(_0x591036){_0x41395e[_0x2218('0x4')](_0x564b8e,_0x591036);};}function removeListener(_0x2ebe23,_0x3348af){return function(){TeamEvents[_0x2218('0x5')](_0x2ebe23,_0x3348af);};}exports[_0x2218('0x6')]=function(_0x1e2df1){for(var _0x199cb3=0x0,_0x22eab9=events[_0x2218('0x7')];_0x199cb3<_0x22eab9;_0x199cb3++){var _0x29e762=events[_0x199cb3];var _0x4b3bd1=createListener(_0x2218('0x8')+_0x29e762,_0x1e2df1);TeamEvents['on'](_0x29e762,_0x4b3bd1);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index ea41eb6..8e49776 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96cc=['sequelize','INTEGER'];(function(_0x117576,_0x1ced1a){var _0x4533f5=function(_0x19bc33){while(--_0x19bc33){_0x117576['push'](_0x117576['shift']());}};_0x4533f5(++_0x1ced1a);}(_0x96cc,0x16c));var _0xc96c=function(_0x5a1e67,_0x3b9c7a){_0x5a1e67=_0x5a1e67-0x0;var _0x28603f=_0x96cc[_0x5a1e67];return _0x28603f;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xc96c('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9bb4=['sequelize','exports','INTEGER'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x9bb4,0xd5));var _0x49bb=function(_0x230183,_0x6e04d1){_0x230183=_0x230183-0x0;var _0x1a442c=_0x9bb4[_0x230183];return _0x1a442c;};'use strict';var Sequelize=require(_0x49bb('0x0'));module[_0x49bb('0x1')]={'TeamId':{'type':Sequelize[_0x49bb('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x49bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index d56694e..86e3701 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3d4=['api','bluebird','request-promise','rimraf','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','util','../../config/logger'];(function(_0x1744a3,_0x3a9d5a){var _0x486e65=function(_0x5914fd){while(--_0x5914fd){_0x1744a3['push'](_0x1744a3['shift']());}};_0x486e65(++_0x3a9d5a);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x335f37,_0x37302b){_0x335f37=_0x335f37-0x0;var _0x1768f4=_0xe3d4[_0x335f37];return _0x1768f4;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var logger=require(_0x4e3d('0x1'))(_0x4e3d('0x2'));var moment=require('moment');var BPromise=require(_0x4e3d('0x3'));var rp=require(_0x4e3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e3d('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e3d('0x6'));module[_0x4e3d('0x7')]=function(_0x4fd5ff,_0x3eaf60){return _0x4fd5ff[_0x4e3d('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x4e3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0936=['request-promise','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x9e05d1,_0x3cef4a){var _0x4f7e97=function(_0x402f40){while(--_0x402f40){_0x9e05d1['push'](_0x9e05d1['shift']());}};_0x4f7e97(++_0x3cef4a);}(_0x0936,0xde));var _0x6093=function(_0x3178d5,_0x318400){_0x3178d5=_0x3178d5-0x0;var _0x3a71e6=_0x0936[_0x3178d5];return _0x3a71e6;};'use strict';var _=require(_0x6093('0x0'));var util=require(_0x6093('0x1'));var logger=require(_0x6093('0x2'))(_0x6093('0x3'));var moment=require(_0x6093('0x4'));var BPromise=require(_0x6093('0x5'));var rp=require(_0x6093('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6093('0x7'));var attributes=require(_0x6093('0x8'));module[_0x6093('0x9')]=function(_0x30c8e4,_0x3bd339){return _0x30c8e4[_0x6093('0xa')](_0x6093('0xb'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index b962f2a..1327c3c 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x58f8d6,_0x3de6e9){var _0x249399=function(_0x5a2d88){while(--_0x5a2d88){_0x58f8d6['push'](_0x58f8d6['shift']());}};_0x249399(++_0x3de6e9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x43568e,_0x5edbe9){var _0x55e938=function(_0x538e51){while(--_0x538e51){_0x43568e['push'](_0x43568e['shift']());}};_0x55e938(++_0x5edbe9);}(_0x70e0,0x17b));var _0x070e=function(_0x4044e0,_0x50eaff){_0x4044e0=_0x4044e0-0x0;var _0x42f3f1=_0x70e0[_0x4044e0];return _0x42f3f1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 28585f5..4e434b6 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['INTEGER'];(function(_0x72e9d8,_0x6684ee){var _0x5e3873=function(_0x51ec5a){while(--_0x51ec5a){_0x72e9d8['push'](_0x72e9d8['shift']());}};_0x5e3873(++_0x6684ee);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3b9bb7,_0x4e24df){_0x3b9bb7=_0x3b9bb7-0x0;var _0x4c0b9e=_0x7fbe[_0x3b9bb7];return _0x4c0b9e;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xe7fb('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd3dc=['sequelize','exports','INTEGER'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xd3dc,0x1d7));var _0xcd3d=function(_0x43e50c,_0x4b06ad){_0x43e50c=_0x43e50c-0x0;var _0x2d6cd7=_0xd3dc[_0x43e50c];return _0x2d6cd7;};'use strict';var Sequelize=require(_0xcd3d('0x0'));module[_0xcd3d('0x1')]={'penalty':{'type':Sequelize[_0xcd3d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index f231294..297a26b 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ade=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','moment','request-promise','path','./teamVoiceQueue.attributes','exports'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9ade,0x107));var _0xe9ad=function(_0x4c217f,_0x82a1ae){_0x4c217f=_0x4c217f-0x0;var _0x4033b2=_0x9ade[_0x4c217f];return _0x4033b2;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe9ad('0x2'));var BPromise=require('bluebird');var rp=require(_0xe9ad('0x3'));var fs=require('fs');var path=require(_0xe9ad('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe9ad('0x5'));module[_0xe9ad('0x6')]=function(_0xdd1549,_0x3e4092){return _0xdd1549[_0xe9ad('0x7')](_0xe9ad('0x8'),attributes,{'tableName':_0xe9ad('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a28=['TeamVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x1b391f,_0x3f13d0){var _0x4fd1bc=function(_0x85483e){while(--_0x85483e){_0x1b391f['push'](_0x1b391f['shift']());}};_0x4fd1bc(++_0x3f13d0);}(_0x8a28,0xfd));var _0x88a2=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x8a28[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var moment=require(_0x88a2('0x4'));var BPromise=require(_0x88a2('0x5'));var rp=require(_0x88a2('0x6'));var fs=require('fs');var path=require(_0x88a2('0x7'));var rimraf=require('rimraf');var config=require(_0x88a2('0x8'));var attributes=require(_0x88a2('0x9'));module[_0x88a2('0xa')]=function(_0x438e32,_0x29ce92){return _0x438e32['define'](_0x88a2('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index b45302f..4fc87b6 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0be1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x36aeb1,_0x312c10){var _0x1a1bea=function(_0x3fb92f){while(--_0x3fb92f){_0x36aeb1['push'](_0x36aeb1['shift']());}};_0x1a1bea(++_0x312c10);}(_0x0be1,0x1b0));var _0x10be=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x0be1[_0x38b14f];return _0x22a324;};'use strict';var _=require(_0x10be('0x0'));var util=require(_0x10be('0x1'));var moment=require(_0x10be('0x2'));var BPromise=require(_0x10be('0x3'));var rs=require(_0x10be('0x4'));var fs=require('fs');var Redis=require(_0x10be('0x5'));var db=require(_0x10be('0x6'))['db'];var utils=require(_0x10be('0x7'));var logger=require(_0x10be('0x8'))(_0x10be('0x9'));var config=require(_0x10be('0xa'));var jayson=require(_0x10be('0xb'));var client=jayson[_0x10be('0xc')][_0x10be('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x359366,_0xb93875,_0x8bd130){return new BPromise(function(_0x75dfd4,_0x20357f){return client['request'](_0x359366,_0x8bd130)[_0x10be('0xe')](function(_0x32a646){logger['info'](_0x10be('0xf'),_0xb93875,_0x10be('0x10'));logger[_0x10be('0x11')](_0x10be('0x12'),_0xb93875,_0x10be('0x10'),JSON[_0x10be('0x13')](_0x32a646));if(_0x32a646['error']){if(_0x32a646[_0x10be('0x14')][_0x10be('0x15')]===0x1f4){logger[_0x10be('0x14')](_0x10be('0xf'),_0xb93875,_0x32a646[_0x10be('0x14')][_0x10be('0x16')]);return _0x20357f(_0x32a646[_0x10be('0x14')][_0x10be('0x16')]);}logger[_0x10be('0x14')](_0x10be('0xf'),_0xb93875,_0x32a646['error'][_0x10be('0x16')]);return _0x75dfd4(_0x32a646[_0x10be('0x14')][_0x10be('0x16')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0xb93875,_0x10be('0x10'));_0x75dfd4(_0x32a646['result'][_0x10be('0x16')]);}})[_0x10be('0x17')](function(_0x545f76){logger[_0x10be('0x14')](_0x10be('0xf'),_0xb93875,_0x545f76);_0x20357f(_0x545f76);});});} \ No newline at end of file +var _0xad86=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xad86,0x194));var _0x6ad8=function(_0x32376c,_0x13dd59){_0x32376c=_0x32376c-0x0;var _0x3cbc1e=_0xad86[_0x32376c];return _0x3cbc1e;};'use strict';var _=require(_0x6ad8('0x0'));var util=require(_0x6ad8('0x1'));var moment=require(_0x6ad8('0x2'));var BPromise=require(_0x6ad8('0x3'));var rs=require(_0x6ad8('0x4'));var fs=require('fs');var Redis=require(_0x6ad8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ad8('0x6'))(_0x6ad8('0x7'));var config=require(_0x6ad8('0x8'));var jayson=require(_0x6ad8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ecf3f,_0x44b48e,_0x44f61a){return new BPromise(function(_0x1f0fd3,_0x5cce0d){return client['request'](_0x1ecf3f,_0x44f61a)[_0x6ad8('0xa')](function(_0x164208){logger[_0x6ad8('0xb')](_0x6ad8('0xc'),_0x44b48e,_0x6ad8('0xd'));logger[_0x6ad8('0xe')](_0x6ad8('0xf'),_0x44b48e,_0x6ad8('0xd'),JSON[_0x6ad8('0x10')](_0x164208));if(_0x164208['error']){if(_0x164208['error']['code']===0x1f4){logger[_0x6ad8('0x11')](_0x6ad8('0xc'),_0x44b48e,_0x164208['error'][_0x6ad8('0x12')]);return _0x5cce0d(_0x164208['error'][_0x6ad8('0x12')]);}logger[_0x6ad8('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x44b48e,_0x164208[_0x6ad8('0x11')]['message']);return _0x1f0fd3(_0x164208[_0x6ad8('0x11')][_0x6ad8('0x12')]);}else{logger[_0x6ad8('0xb')](_0x6ad8('0xc'),_0x44b48e,'request\x20sent');_0x1f0fd3(_0x164208[_0x6ad8('0x13')][_0x6ad8('0x12')]);}})[_0x6ad8('0x14')](function(_0x300b8d){logger['error'](_0x6ad8('0xc'),_0x44b48e,_0x300b8d);_0x5cce0d(_0x300b8d);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 67ffc99..9b4fc16 100644 --- a/server/api/template/index.js +++ b/server/api/template/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0954=['put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','show','post'];(function(_0x27b509,_0x463d6d){var _0x263cd9=function(_0x25c79c){while(--_0x25c79c){_0x27b509['push'](_0x27b509['shift']());}};_0x263cd9(++_0x463d6d);}(_0x0954,0x135));var _0x4095=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x0954[_0x11e30d];return _0x2d4e29;};'use strict';var multer=require(_0x4095('0x0'));var util=require('util');var path=require(_0x4095('0x1'));var timeout=require(_0x4095('0x2'));var express=require('express');var router=express[_0x4095('0x3')]();var fs_extra=require(_0x4095('0x4'));var auth=require(_0x4095('0x5'));var interaction=require(_0x4095('0x6'));var config=require(_0x4095('0x7'));var controller=require(_0x4095('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4095('0x9')](_0x4095('0xa'),auth[_0x4095('0xb')](),controller[_0x4095('0xc')]);router[_0x4095('0xd')]('/',auth[_0x4095('0xb')](),controller['create']);router[_0x4095('0xe')](_0x4095('0xa'),auth[_0x4095('0xb')](),controller['update']);router[_0x4095('0xf')](_0x4095('0xa'),auth[_0x4095('0xb')](),controller['destroy']);module[_0x4095('0x10')]=router; \ No newline at end of file +var _0x18c9=['./template.controller','isAuthenticated','index','get','/:id','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5b7c1a,_0x22f75b){var _0x149653=function(_0x5edffd){while(--_0x5edffd){_0x5b7c1a['push'](_0x5b7c1a['shift']());}};_0x149653(++_0x22f75b);}(_0x18c9,0x13c));var _0x918c=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x18c9[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x918c('0x0'));var util=require(_0x918c('0x1'));var path=require(_0x918c('0x2'));var timeout=require(_0x918c('0x3'));var express=require(_0x918c('0x4'));var router=express[_0x918c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x918c('0x6'));var interaction=require(_0x918c('0x7'));var config=require('../../config/environment');var controller=require(_0x918c('0x8'));router['get']('/',auth[_0x918c('0x9')](),controller[_0x918c('0xa')]);router[_0x918c('0xb')](_0x918c('0xc'),auth[_0x918c('0x9')](),controller['show']);router[_0x918c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x918c('0xe')](_0x918c('0xc'),auth[_0x918c('0x9')](),controller[_0x918c('0xf')]);router[_0x918c('0x10')](_0x918c('0xc'),auth[_0x918c('0x9')](),controller[_0x918c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index ca33621..80430a3 100644 --- a/server/api/template/template.attributes.js +++ b/server/api/template/template.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b39=['sequelize','STRING','TEXT'];(function(_0x553e80,_0x4b0792){var _0x5a206c=function(_0x303fef){while(--_0x303fef){_0x553e80['push'](_0x553e80['shift']());}};_0x5a206c(++_0x4b0792);}(_0x1b39,0x129));var _0x91b3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b39[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x91b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x91b3('0x1')]},'description':{'type':Sequelize[_0x91b3('0x1')]},'html':{'type':Sequelize[_0x91b3('0x2')]}}; \ No newline at end of file +var _0xe026=['sequelize','STRING','TEXT'];(function(_0x2bb501,_0x355781){var _0xdaaeaa=function(_0x40e79e){while(--_0x40e79e){_0x2bb501['push'](_0x2bb501['shift']());}};_0xdaaeaa(++_0x355781);}(_0xe026,0x18f));var _0x6e02=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xe026[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0x6e02('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e02('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x6e02('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 2e42571..c95efdc 100644 --- a/server/api/template/template.controller.js +++ b/server/api/template/template.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc899=['merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','UserProfileResource','error','stack','name','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where'];(function(_0x4ca288,_0x254dd8){var _0x2362c1=function(_0x5504d8){while(--_0x5504d8){_0x4ca288['push'](_0x4ca288['shift']());}};_0x2362c1(++_0x254dd8);}(_0xc899,0x1ef));var _0x9c89=function(_0x2fe9f7,_0x4af956){_0x2fe9f7=_0x2fe9f7-0x0;var _0x51f274=_0xc899[_0x2fe9f7];return _0x51f274;};'use strict';var emlformat=require(_0x9c89('0x0'));var rimraf=require(_0x9c89('0x1'));var zipdir=require(_0x9c89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c89('0x3'));var moment=require(_0x9c89('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c89('0x5'));var util=require(_0x9c89('0x6'));var path=require(_0x9c89('0x7'));var sox=require(_0x9c89('0x8'));var csv=require(_0x9c89('0x9'));var ejs=require(_0x9c89('0xa'));var fs=require('fs');var fs_extra=require(_0x9c89('0xb'));var _=require(_0x9c89('0xc'));var squel=require(_0x9c89('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9c89('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9c89('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9c89('0x10'));var qs=require(_0x9c89('0x11'));var as=require(_0x9c89('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c89('0x13'));var utils=require('../../config/utils');var config=require(_0x9c89('0x14'));var licenseUtil=require(_0x9c89('0x15'));var db=require(_0x9c89('0x16'))['db'];function respondWithStatusCode(_0x53796f,_0x7a49c6){_0x7a49c6=_0x7a49c6||0xcc;return function(_0x2f8d62){if(_0x2f8d62){return _0x53796f[_0x9c89('0x17')](_0x7a49c6);}return _0x53796f[_0x9c89('0x18')](_0x7a49c6)[_0x9c89('0x19')]();};}function respondWithResult(_0x417840,_0x19828f){_0x19828f=_0x19828f||0xc8;return function(_0x2d578a){if(_0x2d578a){return _0x417840[_0x9c89('0x18')](_0x19828f)[_0x9c89('0x1a')](_0x2d578a);}};}function respondWithFilteredResult(_0x467326,_0x1f2d0c){return function(_0x99c2e6){if(_0x99c2e6){var _0x2fc800=typeof _0x1f2d0c[_0x9c89('0x1b')]===_0x9c89('0x1c')&&typeof _0x1f2d0c[_0x9c89('0x1d')]===_0x9c89('0x1c');var _0x1977b6=_0x99c2e6[_0x9c89('0x1e')];var _0x4b6056=_0x2fc800?0x0:_0x1f2d0c[_0x9c89('0x1b')];var _0x297138=_0x2fc800?_0x99c2e6[_0x9c89('0x1e')]:_0x1f2d0c['offset']+_0x1f2d0c['limit'];var _0x3a23b6;if(_0x297138>=_0x1977b6){_0x297138=_0x1977b6;_0x3a23b6=0xc8;}else{_0x3a23b6=0xce;}_0x467326[_0x9c89('0x18')](_0x3a23b6);return _0x467326[_0x9c89('0x1f')](_0x9c89('0x20'),_0x4b6056+'-'+_0x297138+'/'+_0x1977b6)['json'](_0x99c2e6);}return null;};}function patchUpdates(_0x34a56b){return function(_0x15d3c7){try{jsonpatch[_0x9c89('0x21')](_0x15d3c7,_0x34a56b,!![]);}catch(_0x301eb7){return BPromise['reject'](_0x301eb7);}return _0x15d3c7['save']();};}function saveUpdates(_0x4b8756,_0x38f1d8){return function(_0x429eeb){if(_0x429eeb){return _0x429eeb['update'](_0x4b8756)[_0x9c89('0x22')](function(_0x49e9d3){return _0x49e9d3;});}return null;};}function removeEntity(_0x3eb31d,_0x5bb452){return function(_0x44b960){if(_0x44b960){return _0x44b960[_0x9c89('0x23')]()['then'](function(){var _0x16f5c6=_0x44b960[_0x9c89('0x24')]({'plain':!![]});var _0x3c730d='Templates';return db[_0x9c89('0x25')][_0x9c89('0x23')]({'where':{'type':_0x3c730d,'resourceId':_0x16f5c6['id']}})[_0x9c89('0x22')](function(){return _0x44b960;});})[_0x9c89('0x22')](function(){_0x3eb31d[_0x9c89('0x18')](0xcc)[_0x9c89('0x19')]();});}};}function handleEntityNotFound(_0x4f655a,_0x3c46b8){return function(_0x177662){if(!_0x177662){_0x4f655a['sendStatus'](0x194);}return _0x177662;};}function handleError(_0x184aa3,_0x4aff6f){_0x4aff6f=_0x4aff6f||0x1f4;return function(_0x5bca83){logger[_0x9c89('0x26')](_0x5bca83[_0x9c89('0x27')]);if(_0x5bca83[_0x9c89('0x28')]){delete _0x5bca83['name'];}_0x184aa3['status'](_0x4aff6f)['send'](_0x5bca83);};}exports['index']=function(_0x5c65f7,_0x529977){var _0xe21047={},_0x216f4f={},_0x3fd54a={'count':0x0,'rows':[]};var _0x507c03=_[_0x9c89('0x29')](db[_0x9c89('0x2a')][_0x9c89('0x2b')],function(_0x4fb3cb){return{'name':_0x4fb3cb[_0x9c89('0x2c')],'type':_0x4fb3cb[_0x9c89('0x2d')][_0x9c89('0x2e')]};});_0x216f4f[_0x9c89('0x2f')]=_[_0x9c89('0x29')](_0x507c03,'name');_0x216f4f[_0x9c89('0x30')]=_[_0x9c89('0x31')](_0x5c65f7[_0x9c89('0x30')]);_0x216f4f[_0x9c89('0x32')]=_['intersection'](_0x216f4f[_0x9c89('0x2f')],_0x216f4f[_0x9c89('0x30')]);_0xe21047['attributes']=_[_0x9c89('0x33')](_0x216f4f[_0x9c89('0x2f')],qs[_0x9c89('0x34')](_0x5c65f7[_0x9c89('0x30')]['fields']));_0xe21047[_0x9c89('0x35')]=_0xe21047['attributes'][_0x9c89('0x36')]?_0xe21047[_0x9c89('0x35')]:_0x216f4f['model'];if(!_0x5c65f7[_0x9c89('0x30')][_0x9c89('0x37')]('nolimit')){_0xe21047[_0x9c89('0x1d')]=qs[_0x9c89('0x1d')](_0x5c65f7[_0x9c89('0x30')][_0x9c89('0x1d')]);_0xe21047[_0x9c89('0x1b')]=qs['offset'](_0x5c65f7[_0x9c89('0x30')][_0x9c89('0x1b')]);}_0xe21047['order']=qs[_0x9c89('0x38')](_0x5c65f7[_0x9c89('0x30')]['sort']);_0xe21047[_0x9c89('0x39')]=qs[_0x9c89('0x32')](_['pick'](_0x5c65f7[_0x9c89('0x30')],_0x216f4f[_0x9c89('0x32')]),_0x507c03);if(_0x5c65f7[_0x9c89('0x30')]['filter']){_0xe21047[_0x9c89('0x39')]=_[_0x9c89('0x3a')](_0xe21047[_0x9c89('0x39')],{'$or':_[_0x9c89('0x29')](_0x507c03,function(_0x479af3){if(_0x479af3[_0x9c89('0x2d')]!==_0x9c89('0x3b')){var _0x1a2bd3={};_0x1a2bd3[_0x479af3['name']]={'$like':'%'+_0x5c65f7['query'][_0x9c89('0x3c')]+'%'};return _0x1a2bd3;}})});}_0xe21047=_['merge']({},_0xe21047,_0x5c65f7[_0x9c89('0x3d')]);var _0x1a7885={'where':_0xe21047[_0x9c89('0x39')]};return db['Template']['count'](_0x1a7885)[_0x9c89('0x22')](function(_0x2497b6){_0x3fd54a[_0x9c89('0x1e')]=_0x2497b6;if(_0x5c65f7[_0x9c89('0x30')][_0x9c89('0x3e')]){_0xe21047['include']=[{'all':!![]}];}return db['Template'][_0x9c89('0x3f')](_0xe21047);})[_0x9c89('0x22')](function(_0xe365dc){_0x3fd54a[_0x9c89('0x40')]=_0xe365dc;return _0x3fd54a;})['then'](respondWithFilteredResult(_0x529977,_0xe21047))[_0x9c89('0x41')](handleError(_0x529977,null));};exports[_0x9c89('0x42')]=function(_0xbabf21,_0x585f88){var _0x2216f4={'raw':!![],'where':{'id':_0xbabf21['params']['id']}},_0x35367a={};_0x35367a[_0x9c89('0x2f')]=_[_0x9c89('0x31')](db[_0x9c89('0x2a')][_0x9c89('0x2b')]);_0x35367a[_0x9c89('0x30')]=_[_0x9c89('0x31')](_0xbabf21[_0x9c89('0x30')]);_0x35367a[_0x9c89('0x32')]=_[_0x9c89('0x33')](_0x35367a[_0x9c89('0x2f')],_0x35367a['query']);_0x2216f4[_0x9c89('0x35')]=_[_0x9c89('0x33')](_0x35367a[_0x9c89('0x2f')],qs[_0x9c89('0x34')](_0xbabf21['query'][_0x9c89('0x34')]));_0x2216f4[_0x9c89('0x35')]=_0x2216f4[_0x9c89('0x35')][_0x9c89('0x36')]?_0x2216f4[_0x9c89('0x35')]:_0x35367a[_0x9c89('0x2f')];if(_0xbabf21[_0x9c89('0x30')][_0x9c89('0x3e')]){_0x2216f4['include']=[{'all':!![]}];}_0x2216f4=_[_0x9c89('0x3a')]({},_0x2216f4,_0xbabf21[_0x9c89('0x3d')]);return db['Template']['find'](_0x2216f4)[_0x9c89('0x22')](handleEntityNotFound(_0x585f88,null))[_0x9c89('0x22')](respondWithResult(_0x585f88,null))[_0x9c89('0x41')](handleError(_0x585f88,null));};exports[_0x9c89('0x43')]=function(_0x3b6ed4,_0x1dbe39){return db['Template']['create'](_0x3b6ed4[_0x9c89('0x44')],{})[_0x9c89('0x22')](function(_0x52691b){var _0x118951=_0x3b6ed4[_0x9c89('0x45')][_0x9c89('0x24')]({'plain':!![]});if(!_0x118951)throw new Error(_0x9c89('0x46'));if(_0x118951[_0x9c89('0x47')]===_0x9c89('0x45')){var _0x248ed2=_0x52691b['get']({'plain':!![]});var _0x3a1893='Templates';return db[_0x9c89('0x48')]['find']({'where':{'name':_0x3a1893,'userProfileId':_0x118951[_0x9c89('0x49')]},'raw':!![]})[_0x9c89('0x22')](function(_0x5ac7bc){if(_0x5ac7bc&&_0x5ac7bc[_0x9c89('0x4a')]===0x0){return db[_0x9c89('0x25')][_0x9c89('0x43')]({'name':_0x248ed2[_0x9c89('0x28')],'resourceId':_0x248ed2['id'],'type':_0x5ac7bc['name'],'sectionId':_0x5ac7bc['id']},{})['then'](function(){return _0x52691b;});}else{return _0x52691b;}})[_0x9c89('0x41')](function(_0x58eb10){logger[_0x9c89('0x26')](_0x9c89('0x4b'),_0x58eb10);throw _0x58eb10;});}return _0x52691b;})['then'](respondWithResult(_0x1dbe39,0xc9))[_0x9c89('0x41')](handleError(_0x1dbe39,null));};exports[_0x9c89('0x4c')]=function(_0x38fc9c,_0x341c8a){if(_0x38fc9c[_0x9c89('0x44')]['id']){delete _0x38fc9c[_0x9c89('0x44')]['id'];}return db[_0x9c89('0x2a')][_0x9c89('0x4d')]({'where':{'id':_0x38fc9c[_0x9c89('0x4e')]['id']}})['then'](handleEntityNotFound(_0x341c8a,null))[_0x9c89('0x22')](saveUpdates(_0x38fc9c['body'],null))[_0x9c89('0x22')](respondWithResult(_0x341c8a,null))[_0x9c89('0x41')](handleError(_0x341c8a,null));};exports[_0x9c89('0x23')]=function(_0x3cbd99,_0x3f6561){return db[_0x9c89('0x2a')][_0x9c89('0x4d')]({'where':{'id':_0x3cbd99[_0x9c89('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f6561,null))[_0x9c89('0x22')](removeEntity(_0x3f6561,null))['catch'](handleError(_0x3f6561,null));}; \ No newline at end of file +var _0x58dc=['pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','undefined','limit','offset','count','status','set','Content-Range','reject','save','update','Templates','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','Template','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2785ae,_0x5d8f5c){var _0x1a3073=function(_0x4e25ae){while(--_0x4e25ae){_0x2785ae['push'](_0x2785ae['shift']());}};_0x1a3073(++_0x5d8f5c);}(_0x58dc,0x1b5));var _0xc58d=function(_0x24babb,_0x1ff4a3){_0x24babb=_0x24babb-0x0;var _0x1ae5c4=_0x58dc[_0x24babb];return _0x1ae5c4;};'use strict';var emlformat=require(_0xc58d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc58d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc58d('0x2'));var Mustache=require(_0xc58d('0x3'));var util=require(_0xc58d('0x4'));var path=require(_0xc58d('0x5'));var sox=require(_0xc58d('0x6'));var csv=require(_0xc58d('0x7'));var ejs=require(_0xc58d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc58d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc58d('0xa'));var toCsv=require(_0xc58d('0x7'));var querystring=require(_0xc58d('0xb'));var Papa=require('papaparse');var Redis=require(_0xc58d('0xc'));var authService=require(_0xc58d('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc58d('0xe'));var logger=require(_0xc58d('0xf'))(_0xc58d('0x10'));var utils=require(_0xc58d('0x11'));var config=require(_0xc58d('0x12'));var licenseUtil=require(_0xc58d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x243bc5,_0x19b9a2){_0x19b9a2=_0x19b9a2||0xcc;return function(_0x5a274e){if(_0x5a274e){return _0x243bc5['sendStatus'](_0x19b9a2);}return _0x243bc5['status'](_0x19b9a2)[_0xc58d('0x14')]();};}function respondWithResult(_0x386d53,_0x509c14){_0x509c14=_0x509c14||0xc8;return function(_0x5a9c63){if(_0x5a9c63){return _0x386d53['status'](_0x509c14)[_0xc58d('0x15')](_0x5a9c63);}};}function respondWithFilteredResult(_0x1ec13c,_0x349649){return function(_0xe7009a){if(_0xe7009a){var _0x2cfe92=typeof _0x349649['offset']===_0xc58d('0x16')&&typeof _0x349649[_0xc58d('0x17')]===_0xc58d('0x16');var _0x438a61=_0xe7009a['count'];var _0x21200a=_0x2cfe92?0x0:_0x349649[_0xc58d('0x18')];var _0x33be6f=_0x2cfe92?_0xe7009a[_0xc58d('0x19')]:_0x349649[_0xc58d('0x18')]+_0x349649['limit'];var _0x47c444;if(_0x33be6f>=_0x438a61){_0x33be6f=_0x438a61;_0x47c444=0xc8;}else{_0x47c444=0xce;}_0x1ec13c[_0xc58d('0x1a')](_0x47c444);return _0x1ec13c[_0xc58d('0x1b')](_0xc58d('0x1c'),_0x21200a+'-'+_0x33be6f+'/'+_0x438a61)['json'](_0xe7009a);}return null;};}function patchUpdates(_0x723b64){return function(_0x2ccd6e){try{jsonpatch['apply'](_0x2ccd6e,_0x723b64,!![]);}catch(_0x22e54f){return BPromise[_0xc58d('0x1d')](_0x22e54f);}return _0x2ccd6e[_0xc58d('0x1e')]();};}function saveUpdates(_0x3d0d28,_0x29c6bc){return function(_0x2900dd){if(_0x2900dd){return _0x2900dd[_0xc58d('0x1f')](_0x3d0d28)['then'](function(_0x541261){return _0x541261;});}return null;};}function removeEntity(_0x1261a4,_0x27b614){return function(_0x40d1b3){if(_0x40d1b3){return _0x40d1b3['destroy']()['then'](function(){var _0xf40e8f=_0x40d1b3['get']({'plain':!![]});var _0x629e6d=_0xc58d('0x20');return db[_0xc58d('0x21')][_0xc58d('0x22')]({'where':{'type':_0x629e6d,'resourceId':_0xf40e8f['id']}})[_0xc58d('0x23')](function(){return _0x40d1b3;});})[_0xc58d('0x23')](function(){_0x1261a4[_0xc58d('0x1a')](0xcc)[_0xc58d('0x14')]();});}};}function handleEntityNotFound(_0x565982,_0x429743){return function(_0xf10d02){if(!_0xf10d02){_0x565982[_0xc58d('0x24')](0x194);}return _0xf10d02;};}function handleError(_0x27dc9e,_0x21ba08){_0x21ba08=_0x21ba08||0x1f4;return function(_0x28ffd0){logger[_0xc58d('0x25')](_0x28ffd0[_0xc58d('0x26')]);if(_0x28ffd0[_0xc58d('0x27')]){delete _0x28ffd0[_0xc58d('0x27')];}_0x27dc9e[_0xc58d('0x1a')](_0x21ba08)[_0xc58d('0x28')](_0x28ffd0);};}exports[_0xc58d('0x29')]=function(_0x3661c1,_0x1e68a7){var _0x41ac25={},_0x11b094={},_0x3fc7ae={'count':0x0,'rows':[]};var _0x2b4f43=_['map'](db[_0xc58d('0x2a')][_0xc58d('0x2b')],function(_0x3bb25a){return{'name':_0x3bb25a[_0xc58d('0x2c')],'type':_0x3bb25a[_0xc58d('0x2d')][_0xc58d('0x2e')]};});_0x11b094[_0xc58d('0x2f')]=_[_0xc58d('0x30')](_0x2b4f43,_0xc58d('0x27'));_0x11b094[_0xc58d('0x31')]=_[_0xc58d('0x32')](_0x3661c1[_0xc58d('0x31')]);_0x11b094[_0xc58d('0x33')]=_[_0xc58d('0x34')](_0x11b094[_0xc58d('0x2f')],_0x11b094['query']);_0x41ac25[_0xc58d('0x35')]=_[_0xc58d('0x34')](_0x11b094[_0xc58d('0x2f')],qs['fields'](_0x3661c1[_0xc58d('0x31')][_0xc58d('0x36')]));_0x41ac25['attributes']=_0x41ac25['attributes'][_0xc58d('0x37')]?_0x41ac25[_0xc58d('0x35')]:_0x11b094[_0xc58d('0x2f')];if(!_0x3661c1[_0xc58d('0x31')][_0xc58d('0x38')](_0xc58d('0x39'))){_0x41ac25[_0xc58d('0x17')]=qs['limit'](_0x3661c1[_0xc58d('0x31')]['limit']);_0x41ac25[_0xc58d('0x18')]=qs[_0xc58d('0x18')](_0x3661c1[_0xc58d('0x31')][_0xc58d('0x18')]);}_0x41ac25[_0xc58d('0x3a')]=qs['sort'](_0x3661c1[_0xc58d('0x31')][_0xc58d('0x3b')]);_0x41ac25[_0xc58d('0x3c')]=qs[_0xc58d('0x33')](_[_0xc58d('0x3d')](_0x3661c1[_0xc58d('0x31')],_0x11b094['filters']),_0x2b4f43);if(_0x3661c1[_0xc58d('0x31')][_0xc58d('0x3e')]){_0x41ac25[_0xc58d('0x3c')]=_[_0xc58d('0x3f')](_0x41ac25['where'],{'$or':_[_0xc58d('0x30')](_0x2b4f43,function(_0x4697db){if(_0x4697db[_0xc58d('0x2d')]!=='VIRTUAL'){var _0x52f064={};_0x52f064[_0x4697db['name']]={'$like':'%'+_0x3661c1['query'][_0xc58d('0x3e')]+'%'};return _0x52f064;}})});}_0x41ac25=_[_0xc58d('0x3f')]({},_0x41ac25,_0x3661c1[_0xc58d('0x40')]);var _0x471854={'where':_0x41ac25['where']};return db[_0xc58d('0x2a')][_0xc58d('0x19')](_0x471854)['then'](function(_0x26ca4a){_0x3fc7ae[_0xc58d('0x19')]=_0x26ca4a;if(_0x3661c1[_0xc58d('0x31')][_0xc58d('0x41')]){_0x41ac25[_0xc58d('0x42')]=[{'all':!![]}];}return db['Template'][_0xc58d('0x43')](_0x41ac25);})[_0xc58d('0x23')](function(_0x1c3e44){_0x3fc7ae[_0xc58d('0x44')]=_0x1c3e44;return _0x3fc7ae;})['then'](respondWithFilteredResult(_0x1e68a7,_0x41ac25))['catch'](handleError(_0x1e68a7,null));};exports[_0xc58d('0x45')]=function(_0x51e531,_0x1b93a8){var _0x2103f0={'raw':!![],'where':{'id':_0x51e531[_0xc58d('0x46')]['id']}},_0x35944={};_0x35944[_0xc58d('0x2f')]=_[_0xc58d('0x32')](db[_0xc58d('0x2a')][_0xc58d('0x2b')]);_0x35944[_0xc58d('0x31')]=_[_0xc58d('0x32')](_0x51e531['query']);_0x35944[_0xc58d('0x33')]=_[_0xc58d('0x34')](_0x35944['model'],_0x35944[_0xc58d('0x31')]);_0x2103f0[_0xc58d('0x35')]=_['intersection'](_0x35944[_0xc58d('0x2f')],qs[_0xc58d('0x36')](_0x51e531[_0xc58d('0x31')][_0xc58d('0x36')]));_0x2103f0[_0xc58d('0x35')]=_0x2103f0[_0xc58d('0x35')][_0xc58d('0x37')]?_0x2103f0[_0xc58d('0x35')]:_0x35944[_0xc58d('0x2f')];if(_0x51e531[_0xc58d('0x31')][_0xc58d('0x41')]){_0x2103f0[_0xc58d('0x42')]=[{'all':!![]}];}_0x2103f0=_[_0xc58d('0x3f')]({},_0x2103f0,_0x51e531['options']);return db[_0xc58d('0x2a')][_0xc58d('0x47')](_0x2103f0)[_0xc58d('0x23')](handleEntityNotFound(_0x1b93a8,null))['then'](respondWithResult(_0x1b93a8,null))['catch'](handleError(_0x1b93a8,null));};exports[_0xc58d('0x48')]=function(_0x1c5c03,_0x5de064){return db['Template']['create'](_0x1c5c03[_0xc58d('0x49')],{})[_0xc58d('0x23')](function(_0x1b4a45){var _0xb599d7=_0x1c5c03[_0xc58d('0x4a')][_0xc58d('0x4b')]({'plain':!![]});if(!_0xb599d7)throw new Error(_0xc58d('0x4c'));if(_0xb599d7[_0xc58d('0x4d')]===_0xc58d('0x4a')){var _0x25c596=_0x1b4a45[_0xc58d('0x4b')]({'plain':!![]});var _0x149b16=_0xc58d('0x20');return db[_0xc58d('0x4e')]['find']({'where':{'name':_0x149b16,'userProfileId':_0xb599d7[_0xc58d('0x4f')]},'raw':!![]})[_0xc58d('0x23')](function(_0xa55fa8){if(_0xa55fa8&&_0xa55fa8[_0xc58d('0x50')]===0x0){return db[_0xc58d('0x21')]['create']({'name':_0x25c596['name'],'resourceId':_0x25c596['id'],'type':_0xa55fa8[_0xc58d('0x27')],'sectionId':_0xa55fa8['id']},{})['then'](function(){return _0x1b4a45;});}else{return _0x1b4a45;}})['catch'](function(_0x6c6db3){logger['error'](_0xc58d('0x51'),_0x6c6db3);throw _0x6c6db3;});}return _0x1b4a45;})[_0xc58d('0x23')](respondWithResult(_0x5de064,0xc9))[_0xc58d('0x52')](handleError(_0x5de064,null));};exports[_0xc58d('0x1f')]=function(_0x1aadd9,_0x179413){if(_0x1aadd9[_0xc58d('0x49')]['id']){delete _0x1aadd9['body']['id'];}return db[_0xc58d('0x2a')][_0xc58d('0x47')]({'where':{'id':_0x1aadd9['params']['id']}})[_0xc58d('0x23')](handleEntityNotFound(_0x179413,null))[_0xc58d('0x23')](saveUpdates(_0x1aadd9[_0xc58d('0x49')],null))[_0xc58d('0x23')](respondWithResult(_0x179413,null))[_0xc58d('0x52')](handleError(_0x179413,null));};exports[_0xc58d('0x22')]=function(_0xe0a205,_0x2bd2d1){return db['Template'][_0xc58d('0x47')]({'where':{'id':_0xe0a205['params']['id']}})[_0xc58d('0x23')](handleEntityNotFound(_0x2bd2d1,null))[_0xc58d('0x23')](removeEntity(_0x2bd2d1,null))[_0xc58d('0x52')](handleError(_0x2bd2d1,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 89d2b78..8022938 100644 --- a/server/api/template/template.model.js +++ b/server/api/template/template.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20f9=['moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger','api'];(function(_0x4aa662,_0x1cc90c){var _0x336478=function(_0x18b6ef){while(--_0x18b6ef){_0x4aa662['push'](_0x4aa662['shift']());}};_0x336478(++_0x1cc90c);}(_0x20f9,0x7e));var _0x920f=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x20f9[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x920f('0x0'));var util=require(_0x920f('0x1'));var logger=require(_0x920f('0x2'))(_0x920f('0x3'));var moment=require(_0x920f('0x4'));var BPromise=require('bluebird');var rp=require(_0x920f('0x5'));var fs=require('fs');var path=require(_0x920f('0x6'));var rimraf=require(_0x920f('0x7'));var config=require(_0x920f('0x8'));var attributes=require(_0x920f('0x9'));module[_0x920f('0xa')]=function(_0x507965,_0x4cda21){return _0x507965[_0x920f('0xb')]('Template',attributes,{'tableName':_0x920f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb687=['path','./template.attributes','Template','tools_templates','util','moment','bluebird','request-promise'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0xb687,0x1c4));var _0x7b68=function(_0x181208,_0x50da12){_0x181208=_0x181208-0x0;var _0x3db3eb=_0xb687[_0x181208];return _0x3db3eb;};'use strict';var _=require('lodash');var util=require(_0x7b68('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7b68('0x1'));var BPromise=require(_0x7b68('0x2'));var rp=require(_0x7b68('0x3'));var fs=require('fs');var path=require(_0x7b68('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7b68('0x5'));module['exports']=function(_0x28dbaa,_0x2829e4){return _0x28dbaa['define'](_0x7b68('0x6'),attributes,{'tableName':_0x7b68('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index c13dfa5..679fb5e 100644 --- a/server/api/template/template.rpc.js +++ b/server/api/template/template.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3ee=['request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client','http'];(function(_0x1c3c9c,_0xd0946a){var _0x1a89a1=function(_0x231eea){while(--_0x231eea){_0x1c3c9c['push'](_0x1c3c9c['shift']());}};_0x1a89a1(++_0xd0946a);}(_0xb3ee,0x6c));var _0xeb3e=function(_0x5ef18f,_0x15af7f){_0x5ef18f=_0x5ef18f-0x0;var _0x19192f=_0xb3ee[_0x5ef18f];return _0x19192f;};'use strict';var _=require('lodash');var util=require(_0xeb3e('0x0'));var moment=require(_0xeb3e('0x1'));var BPromise=require('bluebird');var rs=require(_0xeb3e('0x2'));var fs=require('fs');var Redis=require(_0xeb3e('0x3'));var db=require(_0xeb3e('0x4'))['db'];var utils=require(_0xeb3e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeb3e('0x6')][_0xeb3e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x261b0e,_0x5713e8,_0x33fed2){return new BPromise(function(_0x1e2cb4,_0x5ead5a){return client[_0xeb3e('0x8')](_0x261b0e,_0x33fed2)[_0xeb3e('0x9')](function(_0x252914){logger[_0xeb3e('0xa')](_0xeb3e('0xb'),_0x5713e8,'request\x20sent');logger[_0xeb3e('0xc')](_0xeb3e('0xd'),_0x5713e8,'request\x20sent',JSON[_0xeb3e('0xe')](_0x252914));if(_0x252914[_0xeb3e('0xf')]){if(_0x252914[_0xeb3e('0xf')]['code']===0x1f4){logger[_0xeb3e('0xf')](_0xeb3e('0xb'),_0x5713e8,_0x252914['error'][_0xeb3e('0x10')]);return _0x5ead5a(_0x252914[_0xeb3e('0xf')][_0xeb3e('0x10')]);}logger['error'](_0xeb3e('0xb'),_0x5713e8,_0x252914['error'][_0xeb3e('0x10')]);return _0x1e2cb4(_0x252914[_0xeb3e('0xf')]['message']);}else{logger[_0xeb3e('0xa')](_0xeb3e('0xb'),_0x5713e8,_0xeb3e('0x11'));_0x1e2cb4(_0x252914[_0xeb3e('0x12')]['message']);}})[_0xeb3e('0x13')](function(_0x3fd9a5){logger[_0xeb3e('0xf')]('Template,\x20%s,\x20%s',_0x5713e8,_0x3fd9a5);_0x5ead5a(_0x3fd9a5);});});}exports[_0xeb3e('0x14')]=function(_0x35b61c){var _0x18ab29=this;return new Promise(function(_0x5d8faf,_0x1e296f){return db[_0xeb3e('0x15')][_0xeb3e('0x16')]({'raw':_0x35b61c['options']?_0x35b61c[_0xeb3e('0x17')][_0xeb3e('0x18')]===undefined?!![]:![]:!![],'where':_0x35b61c[_0xeb3e('0x17')]?_0x35b61c[_0xeb3e('0x17')][_0xeb3e('0x19')]||null:null,'attributes':_0x35b61c[_0xeb3e('0x17')]?_0x35b61c[_0xeb3e('0x17')][_0xeb3e('0x1a')]||null:null,'limit':_0x35b61c[_0xeb3e('0x17')]?_0x35b61c[_0xeb3e('0x17')]['limit']||null:null,'include':_0x35b61c[_0xeb3e('0x17')]?_0x35b61c[_0xeb3e('0x17')][_0xeb3e('0x1b')]?_['map'](_0x35b61c[_0xeb3e('0x17')][_0xeb3e('0x1b')],function(_0x4f5480){return{'model':db[_0x4f5480['model']],'as':_0x4f5480['as'],'attributes':_0x4f5480[_0xeb3e('0x1a')],'include':_0x4f5480['include']?_[_0xeb3e('0x1c')](_0x4f5480[_0xeb3e('0x1b')],function(_0x25606d){return{'model':db[_0x25606d['model']],'as':_0x25606d['as'],'attributes':_0x25606d[_0xeb3e('0x1a')],'include':_0x25606d[_0xeb3e('0x1b')]?_[_0xeb3e('0x1c')](_0x25606d[_0xeb3e('0x1b')],function(_0x6da3af){return{'model':db[_0x6da3af['model']],'as':_0x6da3af['as'],'attributes':_0x6da3af[_0xeb3e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xeb3e('0x9')](function(_0x4aa088){logger[_0xeb3e('0xa')](_0xeb3e('0x14'),_0x35b61c);logger['debug'](_0xeb3e('0x14'),_0x35b61c,JSON[_0xeb3e('0xe')](_0x4aa088));_0x5d8faf(_0x4aa088);})[_0xeb3e('0x13')](function(_0x1f3624){logger[_0xeb3e('0xf')](_0xeb3e('0x14'),_0x1f3624[_0xeb3e('0x10')],_0x35b61c);_0x1e296f(_0x18ab29[_0xeb3e('0xf')](0x1f4,_0x1f3624[_0xeb3e('0x10')]));});});}; \ No newline at end of file +var _0xb4a0=['http','request','then','info','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','request\x20sent','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','debug','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x19d043,_0x2dbb80){var _0x25c755=function(_0x22d61b){while(--_0x22d61b){_0x19d043['push'](_0x19d043['shift']());}};_0x25c755(++_0x2dbb80);}(_0xb4a0,0x128));var _0x0b4a=function(_0x3c62a7,_0x103a78){_0x3c62a7=_0x3c62a7-0x0;var _0x403ed0=_0xb4a0[_0x3c62a7];return _0x403ed0;};'use strict';var _=require('lodash');var util=require(_0x0b4a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b4a('0x1'));var fs=require('fs');var Redis=require(_0x0b4a('0x2'));var db=require(_0x0b4a('0x3'))['db'];var utils=require(_0x0b4a('0x4'));var logger=require(_0x0b4a('0x5'))(_0x0b4a('0x6'));var config=require(_0x0b4a('0x7'));var jayson=require(_0x0b4a('0x8'));var client=jayson[_0x0b4a('0x9')][_0x0b4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f3279,_0x5a3190,_0x1b9990){return new BPromise(function(_0x19aeea,_0x2b481d){return client[_0x0b4a('0xb')](_0x4f3279,_0x1b9990)[_0x0b4a('0xc')](function(_0x2b3557){logger[_0x0b4a('0xd')]('Template,\x20%s,\x20%s',_0x5a3190,'request\x20sent');logger['debug'](_0x0b4a('0xe'),_0x5a3190,'request\x20sent',JSON[_0x0b4a('0xf')](_0x2b3557));if(_0x2b3557[_0x0b4a('0x10')]){if(_0x2b3557[_0x0b4a('0x10')][_0x0b4a('0x11')]===0x1f4){logger[_0x0b4a('0x10')](_0x0b4a('0x12'),_0x5a3190,_0x2b3557[_0x0b4a('0x10')]['message']);return _0x2b481d(_0x2b3557['error'][_0x0b4a('0x13')]);}logger[_0x0b4a('0x10')]('Template,\x20%s,\x20%s',_0x5a3190,_0x2b3557[_0x0b4a('0x10')][_0x0b4a('0x13')]);return _0x19aeea(_0x2b3557[_0x0b4a('0x10')][_0x0b4a('0x13')]);}else{logger['info'](_0x0b4a('0x12'),_0x5a3190,_0x0b4a('0x14'));_0x19aeea(_0x2b3557['result']['message']);}})[_0x0b4a('0x15')](function(_0x4624a3){logger['error']('Template,\x20%s,\x20%s',_0x5a3190,_0x4624a3);_0x2b481d(_0x4624a3);});});}exports[_0x0b4a('0x16')]=function(_0xc84ada){var _0x20a360=this;return new Promise(function(_0x574f19,_0x34766d){return db[_0x0b4a('0x17')][_0x0b4a('0x18')]({'raw':_0xc84ada[_0x0b4a('0x19')]?_0xc84ada[_0x0b4a('0x19')][_0x0b4a('0x1a')]===undefined?!![]:![]:!![],'where':_0xc84ada[_0x0b4a('0x19')]?_0xc84ada[_0x0b4a('0x19')][_0x0b4a('0x1b')]||null:null,'attributes':_0xc84ada[_0x0b4a('0x19')]?_0xc84ada[_0x0b4a('0x19')][_0x0b4a('0x1c')]||null:null,'limit':_0xc84ada['options']?_0xc84ada[_0x0b4a('0x19')][_0x0b4a('0x1d')]||null:null,'include':_0xc84ada[_0x0b4a('0x19')]?_0xc84ada[_0x0b4a('0x19')]['include']?_['map'](_0xc84ada['options'][_0x0b4a('0x1e')],function(_0x591a88){return{'model':db[_0x591a88[_0x0b4a('0x1f')]],'as':_0x591a88['as'],'attributes':_0x591a88[_0x0b4a('0x1c')],'include':_0x591a88[_0x0b4a('0x1e')]?_['map'](_0x591a88[_0x0b4a('0x1e')],function(_0x2d0fc8){return{'model':db[_0x2d0fc8[_0x0b4a('0x1f')]],'as':_0x2d0fc8['as'],'attributes':_0x2d0fc8[_0x0b4a('0x1c')],'include':_0x2d0fc8[_0x0b4a('0x1e')]?_[_0x0b4a('0x20')](_0x2d0fc8[_0x0b4a('0x1e')],function(_0x46c891){return{'model':db[_0x46c891['model']],'as':_0x46c891['as'],'attributes':_0x46c891[_0x0b4a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0b4a('0xc')](function(_0x1e4f29){logger[_0x0b4a('0xd')](_0x0b4a('0x16'),_0xc84ada);logger[_0x0b4a('0x21')](_0x0b4a('0x16'),_0xc84ada,JSON['stringify'](_0x1e4f29));_0x574f19(_0x1e4f29);})[_0x0b4a('0x15')](function(_0x5747e7){logger[_0x0b4a('0x10')]('GetTemplate',_0x5747e7[_0x0b4a('0x13')],_0xc84ada);_0x34766d(_0x20a360[_0x0b4a('0x10')](0x1f4,_0x5747e7['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index a293aef..e42f68e 100644 --- a/server/api/trigger/index.js +++ b/server/api/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19a3=['addAction','put','/:id','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x19a3,0x1d9));var _0x319a=function(_0x18ed60,_0x3e3d4c){_0x18ed60=_0x18ed60-0x0;var _0x4cabfd=_0x19a3[_0x18ed60];return _0x4cabfd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x319a('0x0'));var timeout=require(_0x319a('0x1'));var express=require(_0x319a('0x2'));var router=express[_0x319a('0x3')]();var fs_extra=require(_0x319a('0x4'));var auth=require(_0x319a('0x5'));var interaction=require(_0x319a('0x6'));var config=require(_0x319a('0x7'));var controller=require(_0x319a('0x8'));router[_0x319a('0x9')]('/',auth[_0x319a('0xa')](),controller['index']);router[_0x319a('0x9')]('/:id',auth[_0x319a('0xa')](),controller[_0x319a('0xb')]);router[_0x319a('0x9')](_0x319a('0xc'),auth[_0x319a('0xa')](),controller[_0x319a('0xd')]);router[_0x319a('0x9')](_0x319a('0xe'),auth[_0x319a('0xa')](),controller[_0x319a('0xf')]);router[_0x319a('0x9')](_0x319a('0x10'),auth[_0x319a('0xa')](),controller['getActions']);router[_0x319a('0x11')]('/',auth[_0x319a('0xa')](),controller[_0x319a('0x12')]);router[_0x319a('0x11')](_0x319a('0xc'),auth[_0x319a('0xa')](),controller[_0x319a('0x13')]);router[_0x319a('0x11')](_0x319a('0xe'),auth[_0x319a('0xa')](),controller[_0x319a('0x14')]);router[_0x319a('0x11')]('/:id/actions',auth['isAuthenticated'](),controller[_0x319a('0x15')]);router[_0x319a('0x16')](_0x319a('0x17'),auth['isAuthenticated'](),controller['update']);router[_0x319a('0x18')](_0x319a('0x17'),auth[_0x319a('0xa')](),controller[_0x319a('0x19')]);module['exports']=router; \ No newline at end of file +var _0xb2c8=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAction','update','delete','destroy','exports','multer'];(function(_0x1e2638,_0x15b733){var _0x4fe16=function(_0x19ad77){while(--_0x19ad77){_0x1e2638['push'](_0x1e2638['shift']());}};_0x4fe16(++_0x15b733);}(_0xb2c8,0x197));var _0x8b2c=function(_0x206c1e,_0x416fe7){_0x206c1e=_0x206c1e-0x0;var _0x480a04=_0xb2c8[_0x206c1e];return _0x480a04;};'use strict';var multer=require(_0x8b2c('0x0'));var util=require(_0x8b2c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8b2c('0x2'));var router=express[_0x8b2c('0x3')]();var fs_extra=require(_0x8b2c('0x4'));var auth=require(_0x8b2c('0x5'));var interaction=require(_0x8b2c('0x6'));var config=require('../../config/environment');var controller=require(_0x8b2c('0x7'));router[_0x8b2c('0x8')]('/',auth[_0x8b2c('0x9')](),controller['index']);router[_0x8b2c('0x8')](_0x8b2c('0xa'),auth[_0x8b2c('0x9')](),controller['show']);router[_0x8b2c('0x8')](_0x8b2c('0xb'),auth['isAuthenticated'](),controller[_0x8b2c('0xc')]);router['get'](_0x8b2c('0xd'),auth[_0x8b2c('0x9')](),controller[_0x8b2c('0xe')]);router['get'](_0x8b2c('0xf'),auth[_0x8b2c('0x9')](),controller[_0x8b2c('0x10')]);router[_0x8b2c('0x11')]('/',auth[_0x8b2c('0x9')](),controller['create']);router[_0x8b2c('0x11')](_0x8b2c('0xb'),auth[_0x8b2c('0x9')](),controller[_0x8b2c('0x12')]);router[_0x8b2c('0x11')](_0x8b2c('0xd'),auth[_0x8b2c('0x9')](),controller['addAnyCondition']);router['post']('/:id/actions',auth[_0x8b2c('0x9')](),controller[_0x8b2c('0x13')]);router['put'](_0x8b2c('0xa'),auth[_0x8b2c('0x9')](),controller[_0x8b2c('0x14')]);router[_0x8b2c('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8b2c('0x16')]);module[_0x8b2c('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 3d2183b..bc099e8 100644 --- a/server/api/trigger/trigger.attributes.js +++ b/server/api/trigger/trigger.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f5d=['exports','STRING','BOOLEAN','sequelize'];(function(_0x50aa9d,_0x26b4a4){var _0x294187=function(_0x686ceb){while(--_0x686ceb){_0x50aa9d['push'](_0x50aa9d['shift']());}};_0x294187(++_0x26b4a4);}(_0x7f5d,0x183));var _0xd7f5=function(_0x2f3ab1,_0x102415){_0x2f3ab1=_0x2f3ab1-0x0;var _0x67c4c9=_0x7f5d[_0x2f3ab1];return _0x67c4c9;};'use strict';var Sequelize=require(_0xd7f5('0x0'));module[_0xd7f5('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd7f5('0x2')]},'status':{'type':Sequelize[_0xd7f5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2a65=['exports','STRING','BOOLEAN','sequelize'];(function(_0x630086,_0x12ca6d){var _0x1fdfce=function(_0x142244){while(--_0x142244){_0x630086['push'](_0x630086['shift']());}};_0x1fdfce(++_0x12ca6d);}(_0x2a65,0xdb));var _0x52a6=function(_0x54bf67,_0x5381e5){_0x54bf67=_0x54bf67-0x0;var _0x5f18a9=_0x2a65[_0x54bf67];return _0x5f18a9;};'use strict';var Sequelize=require(_0x52a6('0x0'));module[_0x52a6('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x52a6('0x2')]},'description':{'type':Sequelize[_0x52a6('0x2')]},'status':{'type':Sequelize[_0x52a6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 20f711d..e20a37a 100644 --- a/server/api/trigger/trigger.controller.js +++ b/server/api/trigger/trigger.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fb7=['ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Triggers','UserProfileResource','error','name','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x4fb7,0x107));var _0x74fb=function(_0xeac141,_0x161353){_0xeac141=_0xeac141-0x0;var _0x4e8f20=_0x4fb7[_0xeac141];return _0x4e8f20;};'use strict';var emlformat=require(_0x74fb('0x0'));var rimraf=require(_0x74fb('0x1'));var zipdir=require(_0x74fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74fb('0x3'));var moment=require(_0x74fb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x74fb('0x5'));var util=require(_0x74fb('0x6'));var path=require(_0x74fb('0x7'));var sox=require(_0x74fb('0x8'));var csv=require(_0x74fb('0x9'));var ejs=require(_0x74fb('0xa'));var fs=require('fs');var fs_extra=require(_0x74fb('0xb'));var _=require(_0x74fb('0xc'));var squel=require('squel');var crypto=require(_0x74fb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x74fb('0xe'));var toCsv=require(_0x74fb('0x9'));var querystring=require('querystring');var Papa=require(_0x74fb('0xf'));var Redis=require(_0x74fb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x74fb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x74fb('0x12'));var utils=require(_0x74fb('0x13'));var config=require(_0x74fb('0x14'));var licenseUtil=require(_0x74fb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37b8d3,_0x4bb21f){_0x4bb21f=_0x4bb21f||0xcc;return function(_0x2d498e){if(_0x2d498e){return _0x37b8d3['sendStatus'](_0x4bb21f);}return _0x37b8d3['status'](_0x4bb21f)[_0x74fb('0x16')]();};}function respondWithResult(_0x80f915,_0x3b93bf){_0x3b93bf=_0x3b93bf||0xc8;return function(_0x2664e4){if(_0x2664e4){return _0x80f915[_0x74fb('0x17')](_0x3b93bf)[_0x74fb('0x18')](_0x2664e4);}};}function respondWithFilteredResult(_0x50fd34,_0x4f0815){return function(_0x43f357){if(_0x43f357){var _0x39944c=typeof _0x4f0815[_0x74fb('0x19')]===_0x74fb('0x1a')&&typeof _0x4f0815[_0x74fb('0x1b')]===_0x74fb('0x1a');var _0x4e3987=_0x43f357[_0x74fb('0x1c')];var _0x33a80b=_0x39944c?0x0:_0x4f0815['offset'];var _0x3db75d=_0x39944c?_0x43f357[_0x74fb('0x1c')]:_0x4f0815[_0x74fb('0x19')]+_0x4f0815[_0x74fb('0x1b')];var _0x5eaf10;if(_0x3db75d>=_0x4e3987){_0x3db75d=_0x4e3987;_0x5eaf10=0xc8;}else{_0x5eaf10=0xce;}_0x50fd34[_0x74fb('0x17')](_0x5eaf10);return _0x50fd34[_0x74fb('0x1d')]('Content-Range',_0x33a80b+'-'+_0x3db75d+'/'+_0x4e3987)[_0x74fb('0x18')](_0x43f357);}return null;};}function patchUpdates(_0x1b8dd8){return function(_0x4a6067){try{jsonpatch[_0x74fb('0x1e')](_0x4a6067,_0x1b8dd8,!![]);}catch(_0x2da02b){return BPromise[_0x74fb('0x1f')](_0x2da02b);}return _0x4a6067[_0x74fb('0x20')]();};}function saveUpdates(_0x8397b2,_0x32c825){return function(_0x5ee96b){if(_0x5ee96b){return _0x5ee96b[_0x74fb('0x21')](_0x8397b2)['then'](function(_0x2c7da4){return _0x2c7da4;});}return null;};}function removeEntity(_0x4a2e2d,_0x4085db){return function(_0x1d2e2c){if(_0x1d2e2c){return _0x1d2e2c[_0x74fb('0x22')]()[_0x74fb('0x23')](function(){var _0x121304=_0x1d2e2c[_0x74fb('0x24')]({'plain':!![]});var _0x5c39d2=_0x74fb('0x25');return db[_0x74fb('0x26')][_0x74fb('0x22')]({'where':{'type':_0x5c39d2,'resourceId':_0x121304['id']}})[_0x74fb('0x23')](function(){return _0x1d2e2c;});})[_0x74fb('0x23')](function(){_0x4a2e2d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44eb68,_0x509823){return function(_0xaf9474){if(!_0xaf9474){_0x44eb68['sendStatus'](0x194);}return _0xaf9474;};}function handleError(_0x11012f,_0x58c3c4){_0x58c3c4=_0x58c3c4||0x1f4;return function(_0x306a83){logger[_0x74fb('0x27')](_0x306a83['stack']);if(_0x306a83[_0x74fb('0x28')]){delete _0x306a83[_0x74fb('0x28')];}_0x11012f['status'](_0x58c3c4)['send'](_0x306a83);};}exports[_0x74fb('0x29')]=function(_0x10dc6a,_0x313003){var _0x3b3261={},_0x596baa={},_0x18628b={'count':0x0,'rows':[]};var _0x4990ee=_[_0x74fb('0x2a')](db[_0x74fb('0x2b')][_0x74fb('0x2c')],function(_0x898160){return{'name':_0x898160[_0x74fb('0x2d')],'type':_0x898160[_0x74fb('0x2e')][_0x74fb('0x2f')]};});_0x596baa[_0x74fb('0x30')]=_['map'](_0x4990ee,_0x74fb('0x28'));_0x596baa['query']=_[_0x74fb('0x31')](_0x10dc6a['query']);_0x596baa[_0x74fb('0x32')]=_['intersection'](_0x596baa[_0x74fb('0x30')],_0x596baa[_0x74fb('0x33')]);_0x3b3261['attributes']=_[_0x74fb('0x34')](_0x596baa[_0x74fb('0x30')],qs[_0x74fb('0x35')](_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x35')]));_0x3b3261[_0x74fb('0x36')]=_0x3b3261[_0x74fb('0x36')][_0x74fb('0x37')]?_0x3b3261[_0x74fb('0x36')]:_0x596baa[_0x74fb('0x30')];if(!_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x38')](_0x74fb('0x39'))){_0x3b3261[_0x74fb('0x1b')]=qs[_0x74fb('0x1b')](_0x10dc6a['query']['limit']);_0x3b3261[_0x74fb('0x19')]=qs[_0x74fb('0x19')](_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x19')]);}_0x3b3261['order']=qs[_0x74fb('0x3a')](_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x3a')]);_0x3b3261[_0x74fb('0x3b')]=qs['filters'](_[_0x74fb('0x3c')](_0x10dc6a[_0x74fb('0x33')],_0x596baa['filters']),_0x4990ee);if(_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x3d')]){_0x3b3261[_0x74fb('0x3b')]=_[_0x74fb('0x3e')](_0x3b3261[_0x74fb('0x3b')],{'$or':_[_0x74fb('0x2a')](_0x4990ee,function(_0x50f1d1){if(_0x50f1d1[_0x74fb('0x2e')]!==_0x74fb('0x3f')){var _0x37345e={};_0x37345e[_0x50f1d1['name']]={'$like':'%'+_0x10dc6a['query'][_0x74fb('0x3d')]+'%'};return _0x37345e;}})});}_0x3b3261=_[_0x74fb('0x3e')]({},_0x3b3261,_0x10dc6a[_0x74fb('0x40')]);var _0x37c9e0={'where':_0x3b3261['where']};return db['Trigger']['count'](_0x37c9e0)[_0x74fb('0x23')](function(_0xe0fbac){_0x18628b['count']=_0xe0fbac;if(_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x41')]){_0x3b3261['include']=[{'all':!![]}];}return db[_0x74fb('0x2b')][_0x74fb('0x42')](_0x3b3261);})['then'](function(_0xbfa0fc){_0x18628b[_0x74fb('0x43')]=_0xbfa0fc;return _0x18628b;})['then'](respondWithFilteredResult(_0x313003,_0x3b3261))[_0x74fb('0x44')](handleError(_0x313003,null));};exports[_0x74fb('0x45')]=function(_0xa1d1a6,_0x8fcf2b){var _0x58bcf7={'raw':![],'where':{'id':_0xa1d1a6[_0x74fb('0x46')]['id']}},_0x53aa94={};_0x53aa94[_0x74fb('0x30')]=_[_0x74fb('0x31')](db[_0x74fb('0x2b')][_0x74fb('0x2c')]);_0x53aa94[_0x74fb('0x33')]=_[_0x74fb('0x31')](_0xa1d1a6[_0x74fb('0x33')]);_0x53aa94[_0x74fb('0x32')]=_['intersection'](_0x53aa94[_0x74fb('0x30')],_0x53aa94[_0x74fb('0x33')]);_0x58bcf7[_0x74fb('0x36')]=_['intersection'](_0x53aa94[_0x74fb('0x30')],qs['fields'](_0xa1d1a6['query']['fields']));_0x58bcf7[_0x74fb('0x36')]=_0x58bcf7[_0x74fb('0x36')][_0x74fb('0x37')]?_0x58bcf7[_0x74fb('0x36')]:_0x53aa94[_0x74fb('0x30')];if(_0xa1d1a6[_0x74fb('0x33')][_0x74fb('0x41')]){_0x58bcf7[_0x74fb('0x47')]=[{'all':!![]}];}_0x58bcf7=_['merge']({},_0x58bcf7,_0xa1d1a6['options']);return db[_0x74fb('0x2b')][_0x74fb('0x48')](_0x58bcf7)[_0x74fb('0x23')](handleEntityNotFound(_0x8fcf2b,null))['then'](respondWithResult(_0x8fcf2b,null))['catch'](handleError(_0x8fcf2b,null));};exports[_0x74fb('0x49')]=function(_0x5d2082,_0x35b54a){return db[_0x74fb('0x2b')][_0x74fb('0x49')](_0x5d2082[_0x74fb('0x4a')],{})[_0x74fb('0x23')](function(_0x40d4fb){var _0x184d44=_0x5d2082[_0x74fb('0x4b')][_0x74fb('0x24')]({'plain':!![]});if(!_0x184d44)throw new Error(_0x74fb('0x4c'));if(_0x184d44[_0x74fb('0x4d')]===_0x74fb('0x4b')){var _0x5830f7=_0x40d4fb[_0x74fb('0x24')]({'plain':!![]});var _0x5bb05a=_0x74fb('0x25');return db[_0x74fb('0x4e')][_0x74fb('0x48')]({'where':{'name':_0x5bb05a,'userProfileId':_0x184d44[_0x74fb('0x4f')]},'raw':!![]})[_0x74fb('0x23')](function(_0x44bdb3){if(_0x44bdb3&&_0x44bdb3[_0x74fb('0x50')]===0x0){return db['UserProfileResource'][_0x74fb('0x49')]({'name':_0x5830f7[_0x74fb('0x28')],'resourceId':_0x5830f7['id'],'type':_0x44bdb3[_0x74fb('0x28')],'sectionId':_0x44bdb3['id']},{})['then'](function(){return _0x40d4fb;});}else{return _0x40d4fb;}})['catch'](function(_0x1d4440){logger[_0x74fb('0x27')](_0x74fb('0x51'),_0x1d4440);throw _0x1d4440;});}return _0x40d4fb;})['then'](respondWithResult(_0x35b54a,0xc9))[_0x74fb('0x44')](handleError(_0x35b54a,null));};exports[_0x74fb('0x21')]=function(_0x4bb79c,_0x2a5fa4){if(_0x4bb79c[_0x74fb('0x4a')]['id']){delete _0x4bb79c[_0x74fb('0x4a')]['id'];}return db['Trigger'][_0x74fb('0x48')]({'where':{'id':_0x4bb79c[_0x74fb('0x46')]['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x2a5fa4,null))[_0x74fb('0x23')](saveUpdates(_0x4bb79c[_0x74fb('0x4a')],null))[_0x74fb('0x23')](respondWithResult(_0x2a5fa4,null))[_0x74fb('0x44')](handleError(_0x2a5fa4,null));};exports['destroy']=function(_0x269c1f,_0x132d8a){return db[_0x74fb('0x2b')][_0x74fb('0x48')]({'where':{'id':_0x269c1f[_0x74fb('0x46')]['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x132d8a,null))[_0x74fb('0x23')](removeEntity(_0x132d8a,null))[_0x74fb('0x44')](handleError(_0x132d8a,null));};exports[_0x74fb('0x52')]=function(_0xff1de8,_0x9b25f7,_0x463c3c){if(_0xff1de8[_0x74fb('0x4a')]['id']){delete _0xff1de8[_0x74fb('0x4a')]['id'];}return db[_0x74fb('0x2b')][_0x74fb('0x48')]({'where':{'id':_0xff1de8[_0x74fb('0x46')]['id']}})['then'](handleEntityNotFound(_0x9b25f7,null))[_0x74fb('0x23')](function(_0xcdc397){if(_0xcdc397){_0xff1de8[_0x74fb('0x4a')][_0x74fb('0x53')]=_0xcdc397['id'];return db[_0x74fb('0x54')][_0x74fb('0x49')](_0xff1de8[_0x74fb('0x4a')]);}})[_0x74fb('0x23')](respondWithResult(_0x9b25f7,null))[_0x74fb('0x44')](handleError(_0x9b25f7,null));};exports['addAnyCondition']=function(_0x2e902b,_0x3a61d4,_0x4073fe){if(_0x2e902b[_0x74fb('0x4a')]['id']){delete _0x2e902b[_0x74fb('0x4a')]['id'];}return db[_0x74fb('0x2b')][_0x74fb('0x48')]({'where':{'id':_0x2e902b[_0x74fb('0x46')]['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x3a61d4,null))[_0x74fb('0x23')](function(_0x1c599c){if(_0x1c599c){_0x2e902b[_0x74fb('0x4a')][_0x74fb('0x55')]=_0x1c599c['id'];return db[_0x74fb('0x54')][_0x74fb('0x49')](_0x2e902b[_0x74fb('0x4a')]);}})['then'](respondWithResult(_0x3a61d4,null))['catch'](handleError(_0x3a61d4,null));};exports[_0x74fb('0x56')]=function(_0x1d759a,_0x30cb4a,_0x2c88da){var _0x7935d7={};var _0x64ffd2={};var _0x4d6a7c;var _0xde6f94;return db[_0x74fb('0x2b')][_0x74fb('0x57')]({'where':{'id':_0x1d759a[_0x74fb('0x46')]['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x30cb4a,null))[_0x74fb('0x23')](function(_0xc81f69){if(_0xc81f69){_0x4d6a7c=_0xc81f69;_0x64ffd2[_0x74fb('0x30')]=_[_0x74fb('0x31')](db['Condition'][_0x74fb('0x2c')]);_0x64ffd2[_0x74fb('0x33')]=_[_0x74fb('0x31')](_0x1d759a[_0x74fb('0x33')]);_0x64ffd2[_0x74fb('0x32')]=_[_0x74fb('0x34')](_0x64ffd2['model'],_0x64ffd2[_0x74fb('0x33')]);_0x7935d7[_0x74fb('0x36')]=_[_0x74fb('0x34')](_0x64ffd2[_0x74fb('0x30')],qs[_0x74fb('0x35')](_0x1d759a[_0x74fb('0x33')]['fields']));_0x7935d7[_0x74fb('0x36')]=_0x7935d7[_0x74fb('0x36')]['length']?_0x7935d7[_0x74fb('0x36')]:_0x64ffd2['model'];_0x7935d7[_0x74fb('0x58')]=qs[_0x74fb('0x3a')](_0x1d759a[_0x74fb('0x33')][_0x74fb('0x3a')]);_0x7935d7[_0x74fb('0x3b')]=qs['filters'](_[_0x74fb('0x3c')](_0x1d759a[_0x74fb('0x33')],_0x64ffd2[_0x74fb('0x32')]));if(_0x1d759a['query'][_0x74fb('0x3d')]){_0x7935d7[_0x74fb('0x3b')]=_[_0x74fb('0x3e')](_0x7935d7['where'],{'$or':_['map'](_0x7935d7[_0x74fb('0x36')],function(_0x4bedd0){var _0x1259f6={};_0x1259f6[_0x4bedd0]={'$like':'%'+_0x1d759a[_0x74fb('0x33')][_0x74fb('0x3d')]+'%'};return _0x1259f6;})});}_0x7935d7=_[_0x74fb('0x3e')]({},_0x7935d7,_0x1d759a[_0x74fb('0x40')]);return _0x4d6a7c[_0x74fb('0x56')](_0x7935d7);}})[_0x74fb('0x23')](function(_0x401a63){if(_0x401a63){_0xde6f94=_0x401a63[_0x74fb('0x37')];if(!_0x1d759a[_0x74fb('0x33')]['hasOwnProperty'](_0x74fb('0x39'))){_0x7935d7[_0x74fb('0x1b')]=qs['limit'](_0x1d759a[_0x74fb('0x33')][_0x74fb('0x1b')]);_0x7935d7[_0x74fb('0x19')]=qs[_0x74fb('0x19')](_0x1d759a[_0x74fb('0x33')][_0x74fb('0x19')]);}return _0x4d6a7c['getAllConditions'](_0x7935d7);}})[_0x74fb('0x23')](function(_0x1f4444){if(_0x1f4444){return _0x1f4444?{'count':_0xde6f94,'rows':_0x1f4444}:null;}})[_0x74fb('0x23')](respondWithResult(_0x30cb4a,null))[_0x74fb('0x44')](handleError(_0x30cb4a,null));};exports['getAnyConditions']=function(_0x3e934b,_0x21e1bf,_0x28cc36){var _0xc52946={};var _0x16a242={};var _0x365e7e;var _0x5eba21;return db[_0x74fb('0x2b')][_0x74fb('0x57')]({'where':{'id':_0x3e934b['params']['id']}})['then'](handleEntityNotFound(_0x21e1bf,null))[_0x74fb('0x23')](function(_0x3032d2){if(_0x3032d2){_0x365e7e=_0x3032d2;_0x16a242[_0x74fb('0x30')]=_['keys'](db['Condition'][_0x74fb('0x2c')]);_0x16a242['query']=_[_0x74fb('0x31')](_0x3e934b[_0x74fb('0x33')]);_0x16a242[_0x74fb('0x32')]=_[_0x74fb('0x34')](_0x16a242[_0x74fb('0x30')],_0x16a242[_0x74fb('0x33')]);_0xc52946[_0x74fb('0x36')]=_['intersection'](_0x16a242[_0x74fb('0x30')],qs['fields'](_0x3e934b[_0x74fb('0x33')][_0x74fb('0x35')]));_0xc52946['attributes']=_0xc52946[_0x74fb('0x36')][_0x74fb('0x37')]?_0xc52946[_0x74fb('0x36')]:_0x16a242[_0x74fb('0x30')];_0xc52946[_0x74fb('0x58')]=qs[_0x74fb('0x3a')](_0x3e934b[_0x74fb('0x33')][_0x74fb('0x3a')]);_0xc52946[_0x74fb('0x3b')]=qs['filters'](_['pick'](_0x3e934b[_0x74fb('0x33')],_0x16a242[_0x74fb('0x32')]));if(_0x3e934b[_0x74fb('0x33')]['filter']){_0xc52946[_0x74fb('0x3b')]=_[_0x74fb('0x3e')](_0xc52946[_0x74fb('0x3b')],{'$or':_[_0x74fb('0x2a')](_0xc52946[_0x74fb('0x36')],function(_0x44debd){var _0x3a3a34={};_0x3a3a34[_0x44debd]={'$like':'%'+_0x3e934b['query'][_0x74fb('0x3d')]+'%'};return _0x3a3a34;})});}_0xc52946=_[_0x74fb('0x3e')]({},_0xc52946,_0x3e934b[_0x74fb('0x40')]);return _0x365e7e[_0x74fb('0x59')](_0xc52946);}})[_0x74fb('0x23')](function(_0x1a3655){if(_0x1a3655){_0x5eba21=_0x1a3655['length'];if(!_0x3e934b[_0x74fb('0x33')][_0x74fb('0x38')]('nolimit')){_0xc52946[_0x74fb('0x1b')]=qs[_0x74fb('0x1b')](_0x3e934b[_0x74fb('0x33')][_0x74fb('0x1b')]);_0xc52946[_0x74fb('0x19')]=qs[_0x74fb('0x19')](_0x3e934b[_0x74fb('0x33')]['offset']);}return _0x365e7e[_0x74fb('0x59')](_0xc52946);}})[_0x74fb('0x23')](function(_0x412cf0){if(_0x412cf0){return _0x412cf0?{'count':_0x5eba21,'rows':_0x412cf0}:null;}})[_0x74fb('0x23')](respondWithResult(_0x21e1bf,null))[_0x74fb('0x44')](handleError(_0x21e1bf,null));};exports[_0x74fb('0x5a')]=function(_0x2bd98e,_0x5e7eb1,_0x5e3e73){if(_0x2bd98e[_0x74fb('0x4a')]['id']){delete _0x2bd98e[_0x74fb('0x4a')]['id'];}return db[_0x74fb('0x2b')]['find']({'where':{'id':_0x2bd98e[_0x74fb('0x46')]['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x5e7eb1,null))['then'](function(_0x15d393){if(_0x15d393){_0x2bd98e[_0x74fb('0x4a')]['TriggerId']=_0x15d393['id'];return db[_0x74fb('0x5b')][_0x74fb('0x49')](_0x2bd98e['body']);}})[_0x74fb('0x23')](respondWithResult(_0x5e7eb1,null))[_0x74fb('0x44')](handleError(_0x5e7eb1,null));};exports[_0x74fb('0x5c')]=function(_0x4e6b77,_0x226c86,_0x3f0371){var _0x3bf22f={};var _0x153185={};var _0x1a8fbd;var _0x6f4a2d;return db[_0x74fb('0x2b')]['findOne']({'where':{'id':_0x4e6b77['params']['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x226c86,null))[_0x74fb('0x23')](function(_0x51e3a7){if(_0x51e3a7){_0x1a8fbd=_0x51e3a7;_0x153185[_0x74fb('0x30')]=_[_0x74fb('0x31')](db[_0x74fb('0x5b')]['rawAttributes']);_0x153185['query']=_[_0x74fb('0x31')](_0x4e6b77[_0x74fb('0x33')]);_0x153185[_0x74fb('0x32')]=_[_0x74fb('0x34')](_0x153185[_0x74fb('0x30')],_0x153185['query']);_0x3bf22f[_0x74fb('0x36')]=_[_0x74fb('0x34')](_0x153185[_0x74fb('0x30')],qs[_0x74fb('0x35')](_0x4e6b77[_0x74fb('0x33')][_0x74fb('0x35')]));_0x3bf22f[_0x74fb('0x36')]=_0x3bf22f['attributes'][_0x74fb('0x37')]?_0x3bf22f[_0x74fb('0x36')]:_0x153185[_0x74fb('0x30')];_0x3bf22f[_0x74fb('0x58')]=qs['sort'](_0x4e6b77[_0x74fb('0x33')][_0x74fb('0x3a')]);_0x3bf22f[_0x74fb('0x3b')]=qs[_0x74fb('0x32')](_[_0x74fb('0x3c')](_0x4e6b77[_0x74fb('0x33')],_0x153185[_0x74fb('0x32')]));if(_0x4e6b77['query'][_0x74fb('0x3d')]){_0x3bf22f[_0x74fb('0x3b')]=_[_0x74fb('0x3e')](_0x3bf22f[_0x74fb('0x3b')],{'$or':_[_0x74fb('0x2a')](_0x3bf22f[_0x74fb('0x36')],function(_0x4ae0a6){var _0x49d4fa={};_0x49d4fa[_0x4ae0a6]={'$like':'%'+_0x4e6b77[_0x74fb('0x33')]['filter']+'%'};return _0x49d4fa;})});}_0x3bf22f=_[_0x74fb('0x3e')]({},_0x3bf22f,_0x4e6b77[_0x74fb('0x40')]);return _0x1a8fbd[_0x74fb('0x5c')](_0x3bf22f);}})[_0x74fb('0x23')](function(_0x4fd702){if(_0x4fd702){_0x6f4a2d=_0x4fd702[_0x74fb('0x37')];if(!_0x4e6b77[_0x74fb('0x33')][_0x74fb('0x38')]('nolimit')){_0x3bf22f['limit']=qs[_0x74fb('0x1b')](_0x4e6b77[_0x74fb('0x33')]['limit']);_0x3bf22f[_0x74fb('0x19')]=qs[_0x74fb('0x19')](_0x4e6b77[_0x74fb('0x33')][_0x74fb('0x19')]);}return _0x1a8fbd['getActions'](_0x3bf22f);}})[_0x74fb('0x23')](function(_0x593b8f){if(_0x593b8f){return _0x593b8f?{'count':_0x6f4a2d,'rows':_0x593b8f}:null;}})['then'](respondWithResult(_0x226c86,null))['catch'](handleError(_0x226c86,null));}; \ No newline at end of file +var _0x9bd2=['options','includeAll','Trigger','findAll','rows','catch','show','params','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','getAnyConditions','findOne','order','pick','addAction','getActions','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','Triggers','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL'];(function(_0xe9f24d,_0x1b0ec9){var _0x5f1178=function(_0x4dee44){while(--_0x4dee44){_0xe9f24d['push'](_0xe9f24d['shift']());}};_0x5f1178(++_0x1b0ec9);}(_0x9bd2,0xde));var _0x29bd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9bd2[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x29bd('0x0'));var jsonpatch=require(_0x29bd('0x1'));var rp=require(_0x29bd('0x2'));var moment=require('moment');var BPromise=require(_0x29bd('0x3'));var Mustache=require(_0x29bd('0x4'));var util=require(_0x29bd('0x5'));var path=require(_0x29bd('0x6'));var sox=require(_0x29bd('0x7'));var csv=require(_0x29bd('0x8'));var ejs=require(_0x29bd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29bd('0xa'));var squel=require(_0x29bd('0xb'));var crypto=require(_0x29bd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x29bd('0xd'));var toCsv=require(_0x29bd('0x8'));var querystring=require(_0x29bd('0xe'));var Papa=require(_0x29bd('0xf'));var Redis=require(_0x29bd('0x10'));var authService=require(_0x29bd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x29bd('0x12'));var hardwareService=require(_0x29bd('0x13'));var logger=require(_0x29bd('0x14'))(_0x29bd('0x15'));var utils=require(_0x29bd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x29bd('0x17'));var db=require(_0x29bd('0x18'))['db'];function respondWithStatusCode(_0x45acac,_0x34940e){_0x34940e=_0x34940e||0xcc;return function(_0x59a4b1){if(_0x59a4b1){return _0x45acac[_0x29bd('0x19')](_0x34940e);}return _0x45acac[_0x29bd('0x1a')](_0x34940e)[_0x29bd('0x1b')]();};}function respondWithResult(_0x86aa00,_0x4ac6ec){_0x4ac6ec=_0x4ac6ec||0xc8;return function(_0x2b9ea0){if(_0x2b9ea0){return _0x86aa00[_0x29bd('0x1a')](_0x4ac6ec)[_0x29bd('0x1c')](_0x2b9ea0);}};}function respondWithFilteredResult(_0x276a0a,_0x3fb757){return function(_0x5b95ad){if(_0x5b95ad){var _0x3e22f1=typeof _0x3fb757[_0x29bd('0x1d')]===_0x29bd('0x1e')&&typeof _0x3fb757[_0x29bd('0x1f')]===_0x29bd('0x1e');var _0x568965=_0x5b95ad[_0x29bd('0x20')];var _0x49ea54=_0x3e22f1?0x0:_0x3fb757[_0x29bd('0x1d')];var _0x4c4bb1=_0x3e22f1?_0x5b95ad[_0x29bd('0x20')]:_0x3fb757['offset']+_0x3fb757[_0x29bd('0x1f')];var _0x43ed8a;if(_0x4c4bb1>=_0x568965){_0x4c4bb1=_0x568965;_0x43ed8a=0xc8;}else{_0x43ed8a=0xce;}_0x276a0a[_0x29bd('0x1a')](_0x43ed8a);return _0x276a0a[_0x29bd('0x21')](_0x29bd('0x22'),_0x49ea54+'-'+_0x4c4bb1+'/'+_0x568965)[_0x29bd('0x1c')](_0x5b95ad);}return null;};}function patchUpdates(_0x366982){return function(_0x57c546){try{jsonpatch['apply'](_0x57c546,_0x366982,!![]);}catch(_0x171adb){return BPromise[_0x29bd('0x23')](_0x171adb);}return _0x57c546['save']();};}function saveUpdates(_0x231654,_0x32e5ed){return function(_0x312652){if(_0x312652){return _0x312652['update'](_0x231654)[_0x29bd('0x24')](function(_0x4847ce){return _0x4847ce;});}return null;};}function removeEntity(_0x586919,_0x465e91){return function(_0x16e6ad){if(_0x16e6ad){return _0x16e6ad[_0x29bd('0x25')]()['then'](function(){var _0x720685=_0x16e6ad['get']({'plain':!![]});var _0xb5d2fb=_0x29bd('0x26');return db[_0x29bd('0x27')][_0x29bd('0x25')]({'where':{'type':_0xb5d2fb,'resourceId':_0x720685['id']}})['then'](function(){return _0x16e6ad;});})[_0x29bd('0x24')](function(){_0x586919[_0x29bd('0x1a')](0xcc)[_0x29bd('0x1b')]();});}};}function handleEntityNotFound(_0x38cecd,_0x9336eb){return function(_0x45c7d8){if(!_0x45c7d8){_0x38cecd[_0x29bd('0x19')](0x194);}return _0x45c7d8;};}function handleError(_0x1f58af,_0x66285c){_0x66285c=_0x66285c||0x1f4;return function(_0x5d0dee){logger['error'](_0x5d0dee[_0x29bd('0x28')]);if(_0x5d0dee[_0x29bd('0x29')]){delete _0x5d0dee[_0x29bd('0x29')];}_0x1f58af[_0x29bd('0x1a')](_0x66285c)[_0x29bd('0x2a')](_0x5d0dee);};}exports['index']=function(_0x2cb9bb,_0x3fb5b0){var _0x1f3ea1={},_0x41c86d={},_0x1a0a38={'count':0x0,'rows':[]};var _0x484194=_[_0x29bd('0x2b')](db['Trigger'][_0x29bd('0x2c')],function(_0x22b739){return{'name':_0x22b739[_0x29bd('0x2d')],'type':_0x22b739[_0x29bd('0x2e')][_0x29bd('0x2f')]};});_0x41c86d[_0x29bd('0x30')]=_[_0x29bd('0x2b')](_0x484194,_0x29bd('0x29'));_0x41c86d[_0x29bd('0x31')]=_[_0x29bd('0x32')](_0x2cb9bb[_0x29bd('0x31')]);_0x41c86d['filters']=_[_0x29bd('0x33')](_0x41c86d['model'],_0x41c86d[_0x29bd('0x31')]);_0x1f3ea1[_0x29bd('0x34')]=_[_0x29bd('0x33')](_0x41c86d[_0x29bd('0x30')],qs[_0x29bd('0x35')](_0x2cb9bb[_0x29bd('0x31')][_0x29bd('0x35')]));_0x1f3ea1[_0x29bd('0x34')]=_0x1f3ea1['attributes'][_0x29bd('0x36')]?_0x1f3ea1[_0x29bd('0x34')]:_0x41c86d[_0x29bd('0x30')];if(!_0x2cb9bb[_0x29bd('0x31')][_0x29bd('0x37')](_0x29bd('0x38'))){_0x1f3ea1['limit']=qs['limit'](_0x2cb9bb[_0x29bd('0x31')]['limit']);_0x1f3ea1[_0x29bd('0x1d')]=qs[_0x29bd('0x1d')](_0x2cb9bb[_0x29bd('0x31')][_0x29bd('0x1d')]);}_0x1f3ea1['order']=qs[_0x29bd('0x39')](_0x2cb9bb[_0x29bd('0x31')][_0x29bd('0x39')]);_0x1f3ea1[_0x29bd('0x3a')]=qs[_0x29bd('0x3b')](_['pick'](_0x2cb9bb[_0x29bd('0x31')],_0x41c86d['filters']),_0x484194);if(_0x2cb9bb['query'][_0x29bd('0x3c')]){_0x1f3ea1['where']=_[_0x29bd('0x3d')](_0x1f3ea1[_0x29bd('0x3a')],{'$or':_['map'](_0x484194,function(_0xc23e67){if(_0xc23e67[_0x29bd('0x2e')]!==_0x29bd('0x3e')){var _0x330a1a={};_0x330a1a[_0xc23e67[_0x29bd('0x29')]]={'$like':'%'+_0x2cb9bb[_0x29bd('0x31')][_0x29bd('0x3c')]+'%'};return _0x330a1a;}})});}_0x1f3ea1=_[_0x29bd('0x3d')]({},_0x1f3ea1,_0x2cb9bb[_0x29bd('0x3f')]);var _0x1bb4ff={'where':_0x1f3ea1[_0x29bd('0x3a')]};return db['Trigger'][_0x29bd('0x20')](_0x1bb4ff)['then'](function(_0x6390c8){_0x1a0a38['count']=_0x6390c8;if(_0x2cb9bb[_0x29bd('0x31')][_0x29bd('0x40')]){_0x1f3ea1['include']=[{'all':!![]}];}return db[_0x29bd('0x41')][_0x29bd('0x42')](_0x1f3ea1);})[_0x29bd('0x24')](function(_0x5d9a1c){_0x1a0a38[_0x29bd('0x43')]=_0x5d9a1c;return _0x1a0a38;})[_0x29bd('0x24')](respondWithFilteredResult(_0x3fb5b0,_0x1f3ea1))[_0x29bd('0x44')](handleError(_0x3fb5b0,null));};exports[_0x29bd('0x45')]=function(_0x100a98,_0x5bab4a){var _0x1d051b={'raw':![],'where':{'id':_0x100a98[_0x29bd('0x46')]['id']}},_0x4420d7={};_0x4420d7['model']=_['keys'](db[_0x29bd('0x41')]['rawAttributes']);_0x4420d7['query']=_[_0x29bd('0x32')](_0x100a98[_0x29bd('0x31')]);_0x4420d7['filters']=_['intersection'](_0x4420d7[_0x29bd('0x30')],_0x4420d7[_0x29bd('0x31')]);_0x1d051b[_0x29bd('0x34')]=_[_0x29bd('0x33')](_0x4420d7['model'],qs[_0x29bd('0x35')](_0x100a98[_0x29bd('0x31')][_0x29bd('0x35')]));_0x1d051b[_0x29bd('0x34')]=_0x1d051b[_0x29bd('0x34')][_0x29bd('0x36')]?_0x1d051b['attributes']:_0x4420d7[_0x29bd('0x30')];if(_0x100a98[_0x29bd('0x31')][_0x29bd('0x40')]){_0x1d051b['include']=[{'all':!![]}];}_0x1d051b=_[_0x29bd('0x3d')]({},_0x1d051b,_0x100a98[_0x29bd('0x3f')]);return db[_0x29bd('0x41')][_0x29bd('0x47')](_0x1d051b)[_0x29bd('0x24')](handleEntityNotFound(_0x5bab4a,null))[_0x29bd('0x24')](respondWithResult(_0x5bab4a,null))['catch'](handleError(_0x5bab4a,null));};exports['create']=function(_0xf04a1c,_0x4d0088){return db[_0x29bd('0x41')]['create'](_0xf04a1c[_0x29bd('0x48')],{})[_0x29bd('0x24')](function(_0x336181){var _0x43da13=_0xf04a1c[_0x29bd('0x49')][_0x29bd('0x4a')]({'plain':!![]});if(!_0x43da13)throw new Error(_0x29bd('0x4b'));if(_0x43da13[_0x29bd('0x4c')]==='user'){var _0x4a06de=_0x336181['get']({'plain':!![]});var _0x3e538c=_0x29bd('0x26');return db[_0x29bd('0x4d')][_0x29bd('0x47')]({'where':{'name':_0x3e538c,'userProfileId':_0x43da13[_0x29bd('0x4e')]},'raw':!![]})['then'](function(_0xff45f0){if(_0xff45f0&&_0xff45f0[_0x29bd('0x4f')]===0x0){return db['UserProfileResource'][_0x29bd('0x50')]({'name':_0x4a06de[_0x29bd('0x29')],'resourceId':_0x4a06de['id'],'type':_0xff45f0['name'],'sectionId':_0xff45f0['id']},{})[_0x29bd('0x24')](function(){return _0x336181;});}else{return _0x336181;}})['catch'](function(_0x40a354){logger[_0x29bd('0x51')](_0x29bd('0x52'),_0x40a354);throw _0x40a354;});}return _0x336181;})['then'](respondWithResult(_0x4d0088,0xc9))[_0x29bd('0x44')](handleError(_0x4d0088,null));};exports[_0x29bd('0x53')]=function(_0x2049d1,_0x58d9ed){if(_0x2049d1[_0x29bd('0x48')]['id']){delete _0x2049d1[_0x29bd('0x48')]['id'];}return db[_0x29bd('0x41')][_0x29bd('0x47')]({'where':{'id':_0x2049d1['params']['id']}})[_0x29bd('0x24')](handleEntityNotFound(_0x58d9ed,null))[_0x29bd('0x24')](saveUpdates(_0x2049d1[_0x29bd('0x48')],null))['then'](respondWithResult(_0x58d9ed,null))[_0x29bd('0x44')](handleError(_0x58d9ed,null));};exports[_0x29bd('0x25')]=function(_0x1d3206,_0x1e26c7){return db[_0x29bd('0x41')]['find']({'where':{'id':_0x1d3206['params']['id']}})['then'](handleEntityNotFound(_0x1e26c7,null))[_0x29bd('0x24')](removeEntity(_0x1e26c7,null))[_0x29bd('0x44')](handleError(_0x1e26c7,null));};exports[_0x29bd('0x54')]=function(_0x24a8de,_0x565fb3,_0x357aba){if(_0x24a8de[_0x29bd('0x48')]['id']){delete _0x24a8de[_0x29bd('0x48')]['id'];}return db['Trigger']['find']({'where':{'id':_0x24a8de[_0x29bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x565fb3,null))[_0x29bd('0x24')](function(_0x33c320){if(_0x33c320){_0x24a8de[_0x29bd('0x48')][_0x29bd('0x55')]=_0x33c320['id'];return db[_0x29bd('0x56')]['create'](_0x24a8de['body']);}})[_0x29bd('0x24')](respondWithResult(_0x565fb3,null))[_0x29bd('0x44')](handleError(_0x565fb3,null));};exports[_0x29bd('0x57')]=function(_0xafd2c5,_0x3a5eb4,_0x3545e7){if(_0xafd2c5[_0x29bd('0x48')]['id']){delete _0xafd2c5['body']['id'];}return db[_0x29bd('0x41')][_0x29bd('0x47')]({'where':{'id':_0xafd2c5['params']['id']}})[_0x29bd('0x24')](handleEntityNotFound(_0x3a5eb4,null))['then'](function(_0x29a917){if(_0x29a917){_0xafd2c5[_0x29bd('0x48')]['TriggerAnyId']=_0x29a917['id'];return db[_0x29bd('0x56')]['create'](_0xafd2c5['body']);}})[_0x29bd('0x24')](respondWithResult(_0x3a5eb4,null))['catch'](handleError(_0x3a5eb4,null));};exports[_0x29bd('0x58')]=function(_0x438eda,_0x12691c,_0x27a976){var _0x9d168={};var _0x3bdef8={};var _0x72a9fb;var _0xec7cbe;return db[_0x29bd('0x41')]['findOne']({'where':{'id':_0x438eda['params']['id']}})[_0x29bd('0x24')](handleEntityNotFound(_0x12691c,null))[_0x29bd('0x24')](function(_0x21e617){if(_0x21e617){_0x72a9fb=_0x21e617;_0x3bdef8[_0x29bd('0x30')]=_[_0x29bd('0x32')](db['Condition'][_0x29bd('0x2c')]);_0x3bdef8['query']=_[_0x29bd('0x32')](_0x438eda[_0x29bd('0x31')]);_0x3bdef8[_0x29bd('0x3b')]=_['intersection'](_0x3bdef8[_0x29bd('0x30')],_0x3bdef8[_0x29bd('0x31')]);_0x9d168[_0x29bd('0x34')]=_[_0x29bd('0x33')](_0x3bdef8[_0x29bd('0x30')],qs[_0x29bd('0x35')](_0x438eda['query'][_0x29bd('0x35')]));_0x9d168[_0x29bd('0x34')]=_0x9d168[_0x29bd('0x34')][_0x29bd('0x36')]?_0x9d168['attributes']:_0x3bdef8[_0x29bd('0x30')];_0x9d168['order']=qs['sort'](_0x438eda[_0x29bd('0x31')][_0x29bd('0x39')]);_0x9d168[_0x29bd('0x3a')]=qs[_0x29bd('0x3b')](_['pick'](_0x438eda[_0x29bd('0x31')],_0x3bdef8['filters']));if(_0x438eda['query']['filter']){_0x9d168[_0x29bd('0x3a')]=_[_0x29bd('0x3d')](_0x9d168[_0x29bd('0x3a')],{'$or':_[_0x29bd('0x2b')](_0x9d168[_0x29bd('0x34')],function(_0x1dfa2b){var _0x49cf1e={};_0x49cf1e[_0x1dfa2b]={'$like':'%'+_0x438eda['query'][_0x29bd('0x3c')]+'%'};return _0x49cf1e;})});}_0x9d168=_[_0x29bd('0x3d')]({},_0x9d168,_0x438eda[_0x29bd('0x3f')]);return _0x72a9fb[_0x29bd('0x58')](_0x9d168);}})[_0x29bd('0x24')](function(_0xa96b1c){if(_0xa96b1c){_0xec7cbe=_0xa96b1c['length'];if(!_0x438eda[_0x29bd('0x31')]['hasOwnProperty'](_0x29bd('0x38'))){_0x9d168[_0x29bd('0x1f')]=qs['limit'](_0x438eda[_0x29bd('0x31')][_0x29bd('0x1f')]);_0x9d168[_0x29bd('0x1d')]=qs['offset'](_0x438eda['query'][_0x29bd('0x1d')]);}return _0x72a9fb[_0x29bd('0x58')](_0x9d168);}})['then'](function(_0x2f4929){if(_0x2f4929){return _0x2f4929?{'count':_0xec7cbe,'rows':_0x2f4929}:null;}})[_0x29bd('0x24')](respondWithResult(_0x12691c,null))[_0x29bd('0x44')](handleError(_0x12691c,null));};exports[_0x29bd('0x59')]=function(_0xdf3b89,_0x188765,_0x106a1d){var _0x18b3bd={};var _0xd41914={};var _0x13eb98;var _0x222ac0;return db[_0x29bd('0x41')][_0x29bd('0x5a')]({'where':{'id':_0xdf3b89[_0x29bd('0x46')]['id']}})[_0x29bd('0x24')](handleEntityNotFound(_0x188765,null))[_0x29bd('0x24')](function(_0x44a18f){if(_0x44a18f){_0x13eb98=_0x44a18f;_0xd41914['model']=_[_0x29bd('0x32')](db[_0x29bd('0x56')][_0x29bd('0x2c')]);_0xd41914[_0x29bd('0x31')]=_['keys'](_0xdf3b89[_0x29bd('0x31')]);_0xd41914[_0x29bd('0x3b')]=_[_0x29bd('0x33')](_0xd41914[_0x29bd('0x30')],_0xd41914[_0x29bd('0x31')]);_0x18b3bd[_0x29bd('0x34')]=_['intersection'](_0xd41914[_0x29bd('0x30')],qs['fields'](_0xdf3b89[_0x29bd('0x31')][_0x29bd('0x35')]));_0x18b3bd[_0x29bd('0x34')]=_0x18b3bd[_0x29bd('0x34')][_0x29bd('0x36')]?_0x18b3bd[_0x29bd('0x34')]:_0xd41914[_0x29bd('0x30')];_0x18b3bd[_0x29bd('0x5b')]=qs[_0x29bd('0x39')](_0xdf3b89[_0x29bd('0x31')][_0x29bd('0x39')]);_0x18b3bd[_0x29bd('0x3a')]=qs[_0x29bd('0x3b')](_[_0x29bd('0x5c')](_0xdf3b89[_0x29bd('0x31')],_0xd41914[_0x29bd('0x3b')]));if(_0xdf3b89[_0x29bd('0x31')]['filter']){_0x18b3bd[_0x29bd('0x3a')]=_[_0x29bd('0x3d')](_0x18b3bd[_0x29bd('0x3a')],{'$or':_[_0x29bd('0x2b')](_0x18b3bd[_0x29bd('0x34')],function(_0x2a52a9){var _0x35c723={};_0x35c723[_0x2a52a9]={'$like':'%'+_0xdf3b89[_0x29bd('0x31')][_0x29bd('0x3c')]+'%'};return _0x35c723;})});}_0x18b3bd=_['merge']({},_0x18b3bd,_0xdf3b89['options']);return _0x13eb98[_0x29bd('0x59')](_0x18b3bd);}})[_0x29bd('0x24')](function(_0x322aee){if(_0x322aee){_0x222ac0=_0x322aee['length'];if(!_0xdf3b89['query'][_0x29bd('0x37')](_0x29bd('0x38'))){_0x18b3bd[_0x29bd('0x1f')]=qs[_0x29bd('0x1f')](_0xdf3b89[_0x29bd('0x31')][_0x29bd('0x1f')]);_0x18b3bd[_0x29bd('0x1d')]=qs[_0x29bd('0x1d')](_0xdf3b89[_0x29bd('0x31')][_0x29bd('0x1d')]);}return _0x13eb98[_0x29bd('0x59')](_0x18b3bd);}})['then'](function(_0x4a805a){if(_0x4a805a){return _0x4a805a?{'count':_0x222ac0,'rows':_0x4a805a}:null;}})[_0x29bd('0x24')](respondWithResult(_0x188765,null))[_0x29bd('0x44')](handleError(_0x188765,null));};exports[_0x29bd('0x5d')]=function(_0x32114a,_0x19ebeb,_0x2d0663){if(_0x32114a['body']['id']){delete _0x32114a[_0x29bd('0x48')]['id'];}return db['Trigger'][_0x29bd('0x47')]({'where':{'id':_0x32114a[_0x29bd('0x46')]['id']}})[_0x29bd('0x24')](handleEntityNotFound(_0x19ebeb,null))[_0x29bd('0x24')](function(_0x1164f2){if(_0x1164f2){_0x32114a['body']['TriggerId']=_0x1164f2['id'];return db['Action']['create'](_0x32114a[_0x29bd('0x48')]);}})['then'](respondWithResult(_0x19ebeb,null))[_0x29bd('0x44')](handleError(_0x19ebeb,null));};exports[_0x29bd('0x5e')]=function(_0x338844,_0x29a694,_0x1568c0){var _0x237a23={};var _0x3c148d={};var _0x174c9a;var _0x554247;return db[_0x29bd('0x41')][_0x29bd('0x5a')]({'where':{'id':_0x338844['params']['id']}})[_0x29bd('0x24')](handleEntityNotFound(_0x29a694,null))[_0x29bd('0x24')](function(_0x32d479){if(_0x32d479){_0x174c9a=_0x32d479;_0x3c148d['model']=_[_0x29bd('0x32')](db['Action']['rawAttributes']);_0x3c148d['query']=_[_0x29bd('0x32')](_0x338844[_0x29bd('0x31')]);_0x3c148d[_0x29bd('0x3b')]=_['intersection'](_0x3c148d['model'],_0x3c148d['query']);_0x237a23['attributes']=_[_0x29bd('0x33')](_0x3c148d[_0x29bd('0x30')],qs[_0x29bd('0x35')](_0x338844[_0x29bd('0x31')]['fields']));_0x237a23['attributes']=_0x237a23['attributes'][_0x29bd('0x36')]?_0x237a23['attributes']:_0x3c148d[_0x29bd('0x30')];_0x237a23[_0x29bd('0x5b')]=qs['sort'](_0x338844['query'][_0x29bd('0x39')]);_0x237a23[_0x29bd('0x3a')]=qs[_0x29bd('0x3b')](_[_0x29bd('0x5c')](_0x338844[_0x29bd('0x31')],_0x3c148d[_0x29bd('0x3b')]));if(_0x338844[_0x29bd('0x31')][_0x29bd('0x3c')]){_0x237a23['where']=_[_0x29bd('0x3d')](_0x237a23[_0x29bd('0x3a')],{'$or':_[_0x29bd('0x2b')](_0x237a23[_0x29bd('0x34')],function(_0xd77c85){var _0x5e2466={};_0x5e2466[_0xd77c85]={'$like':'%'+_0x338844[_0x29bd('0x31')][_0x29bd('0x3c')]+'%'};return _0x5e2466;})});}_0x237a23=_[_0x29bd('0x3d')]({},_0x237a23,_0x338844[_0x29bd('0x3f')]);return _0x174c9a[_0x29bd('0x5e')](_0x237a23);}})[_0x29bd('0x24')](function(_0xafc8cd){if(_0xafc8cd){_0x554247=_0xafc8cd['length'];if(!_0x338844['query'][_0x29bd('0x37')]('nolimit')){_0x237a23['limit']=qs[_0x29bd('0x1f')](_0x338844[_0x29bd('0x31')][_0x29bd('0x1f')]);_0x237a23[_0x29bd('0x1d')]=qs[_0x29bd('0x1d')](_0x338844['query'][_0x29bd('0x1d')]);}return _0x174c9a[_0x29bd('0x5e')](_0x237a23);}})[_0x29bd('0x24')](function(_0x4144f7){if(_0x4144f7){return _0x4144f7?{'count':_0x554247,'rows':_0x4144f7}:null;}})[_0x29bd('0x24')](respondWithResult(_0x29a694,null))[_0x29bd('0x44')](handleError(_0x29a694,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0e2fec9..5cc229e 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b04=['./trigger.attributes','exports','define','tools_triggers','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x136e5c,_0x409583){var _0x22e069=function(_0x4fae98){while(--_0x4fae98){_0x136e5c['push'](_0x136e5c['shift']());}};_0x22e069(++_0x409583);}(_0x8b04,0x130));var _0x48b0=function(_0x559da0,_0x371559){_0x559da0=_0x559da0-0x0;var _0x284239=_0x8b04[_0x559da0];return _0x284239;};'use strict';var _=require(_0x48b0('0x0'));var util=require(_0x48b0('0x1'));var logger=require('../../config/logger')(_0x48b0('0x2'));var moment=require('moment');var BPromise=require(_0x48b0('0x3'));var rp=require(_0x48b0('0x4'));var fs=require('fs');var path=require(_0x48b0('0x5'));var rimraf=require(_0x48b0('0x6'));var config=require(_0x48b0('0x7'));var attributes=require(_0x48b0('0x8'));module[_0x48b0('0x9')]=function(_0x43e21c,_0x357849){return _0x43e21c[_0x48b0('0xa')]('Trigger',attributes,{'tableName':_0x48b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47c7=['api','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','../../config/logger'];(function(_0x53f8d1,_0x1bf393){var _0x3d7111=function(_0x196828){while(--_0x196828){_0x53f8d1['push'](_0x53f8d1['shift']());}};_0x3d7111(++_0x1bf393);}(_0x47c7,0x1ab));var _0x747c=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0x47c7[_0x3ba924];return _0x4cc1df;};'use strict';var _=require(_0x747c('0x0'));var util=require('util');var logger=require(_0x747c('0x1'))(_0x747c('0x2'));var moment=require('moment');var BPromise=require(_0x747c('0x3'));var rp=require(_0x747c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x747c('0x5'));var config=require(_0x747c('0x6'));var attributes=require(_0x747c('0x7'));module[_0x747c('0x8')]=function(_0x5e991e,_0xa1148a){return _0x5e991e['define'](_0x747c('0x9'),attributes,{'tableName':_0x747c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index c34c814..361722c 100644 --- a/server/api/trigger/trigger.rpc.js +++ b/server/api/trigger/trigger.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7eb=['http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x307c47,_0x3922a4){var _0xe799dd=function(_0x53f6c4){while(--_0x53f6c4){_0x307c47['push'](_0x307c47['shift']());}};_0xe799dd(++_0x3922a4);}(_0xf7eb,0x1b1));var _0xbf7e=function(_0x5d995b,_0x232fb9){_0x5d995b=_0x5d995b-0x0;var _0x58e1f7=_0xf7eb[_0x5d995b];return _0x58e1f7;};'use strict';var _=require(_0xbf7e('0x0'));var util=require('util');var moment=require(_0xbf7e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf7e('0x2'))['db'];var utils=require(_0xbf7e('0x3'));var logger=require(_0xbf7e('0x4'))(_0xbf7e('0x5'));var config=require(_0xbf7e('0x6'));var jayson=require(_0xbf7e('0x7'));var client=jayson[_0xbf7e('0x8')][_0xbf7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f19c,_0x23444a,_0x23ed4c){return new BPromise(function(_0x130c58,_0x386c1c){return client[_0xbf7e('0xa')](_0x45f19c,_0x23ed4c)[_0xbf7e('0xb')](function(_0x530a68){logger[_0xbf7e('0xc')](_0xbf7e('0xd'),_0x23444a,_0xbf7e('0xe'));logger[_0xbf7e('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x23444a,_0xbf7e('0xe'),JSON[_0xbf7e('0x10')](_0x530a68));if(_0x530a68[_0xbf7e('0x11')]){if(_0x530a68[_0xbf7e('0x11')][_0xbf7e('0x12')]===0x1f4){logger['error'](_0xbf7e('0xd'),_0x23444a,_0x530a68['error']['message']);return _0x386c1c(_0x530a68[_0xbf7e('0x11')][_0xbf7e('0x13')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x23444a,_0x530a68['error'][_0xbf7e('0x13')]);return _0x130c58(_0x530a68[_0xbf7e('0x11')][_0xbf7e('0x13')]);}else{logger[_0xbf7e('0xc')](_0xbf7e('0xd'),_0x23444a,_0xbf7e('0xe'));_0x130c58(_0x530a68[_0xbf7e('0x14')][_0xbf7e('0x13')]);}})[_0xbf7e('0x15')](function(_0x363b01){logger[_0xbf7e('0x11')](_0xbf7e('0xd'),_0x23444a,_0x363b01);_0x386c1c(_0x363b01);});});}exports[_0xbf7e('0x16')]=function(_0xdfd49b){var _0x5dfae9=this;return new Promise(function(_0x407f3b,_0x2f3310){return db[_0xbf7e('0x17')]['findAll']({'raw':_0xdfd49b[_0xbf7e('0x18')]?_0xdfd49b[_0xbf7e('0x18')][_0xbf7e('0x19')]===undefined?!![]:![]:!![],'where':_0xdfd49b['options']?_0xdfd49b[_0xbf7e('0x18')][_0xbf7e('0x1a')]||null:null,'attributes':_0xdfd49b[_0xbf7e('0x18')]?_0xdfd49b[_0xbf7e('0x18')][_0xbf7e('0x1b')]||null:null,'limit':_0xdfd49b[_0xbf7e('0x18')]?_0xdfd49b[_0xbf7e('0x18')][_0xbf7e('0x1c')]||null:null,'include':_0xdfd49b[_0xbf7e('0x18')]?_0xdfd49b['options'][_0xbf7e('0x1d')]?_[_0xbf7e('0x1e')](_0xdfd49b[_0xbf7e('0x18')][_0xbf7e('0x1d')],function(_0x52c75a){return{'model':db[_0x52c75a['model']],'as':_0x52c75a['as'],'attributes':_0x52c75a['attributes'],'include':_0x52c75a[_0xbf7e('0x1d')]?_[_0xbf7e('0x1e')](_0x52c75a[_0xbf7e('0x1d')],function(_0x1b7da1){return{'model':db[_0x1b7da1[_0xbf7e('0x1f')]],'as':_0x1b7da1['as'],'attributes':_0x1b7da1['attributes'],'include':_0x1b7da1[_0xbf7e('0x1d')]?_[_0xbf7e('0x1e')](_0x1b7da1[_0xbf7e('0x1d')],function(_0x1c9d2f){return{'model':db[_0x1c9d2f[_0xbf7e('0x1f')]],'as':_0x1c9d2f['as'],'attributes':_0x1c9d2f[_0xbf7e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbf7e('0xb')](function(_0xb692f6){logger[_0xbf7e('0xc')](_0xbf7e('0x16'),_0xdfd49b);logger[_0xbf7e('0xf')]('GetTrigger',_0xdfd49b,JSON[_0xbf7e('0x10')](_0xb692f6));_0x407f3b(_0xb692f6);})[_0xbf7e('0x15')](function(_0x5c235f){logger[_0xbf7e('0x11')](_0xbf7e('0x16'),_0x5c235f[_0xbf7e('0x13')],_0xdfd49b);_0x2f3310(_0x5dfae9[_0xbf7e('0x11')](0x1f4,_0x5c235f[_0xbf7e('0x13')]));});});};exports[_0xbf7e('0x20')]=function(_0x4a986e){var _0x2b6520=this;return new Promise(function(_0x11755d,_0x5d3995){return db[_0xbf7e('0x17')][_0xbf7e('0x21')]({'raw':_0x4a986e[_0xbf7e('0x18')]?_0x4a986e[_0xbf7e('0x18')][_0xbf7e('0x19')]===undefined?!![]:![]:!![],'where':_0x4a986e[_0xbf7e('0x18')]?_0x4a986e[_0xbf7e('0x18')][_0xbf7e('0x1a')]||null:null,'attributes':_0x4a986e[_0xbf7e('0x18')]?_0x4a986e[_0xbf7e('0x18')][_0xbf7e('0x1b')]||null:null,'include':_0x4a986e[_0xbf7e('0x18')]?_0x4a986e[_0xbf7e('0x18')][_0xbf7e('0x1d')]?_[_0xbf7e('0x1e')](_0x4a986e['options']['include'],function(_0x285686){return{'model':db[_0x285686[_0xbf7e('0x1f')]],'as':_0x285686['as'],'attributes':_0x285686[_0xbf7e('0x1b')],'include':_0x285686['include']?_[_0xbf7e('0x1e')](_0x285686[_0xbf7e('0x1d')],function(_0x38df1b){return{'model':db[_0x38df1b[_0xbf7e('0x1f')]],'as':_0x38df1b['as'],'attributes':_0x38df1b[_0xbf7e('0x1b')],'include':_0x38df1b[_0xbf7e('0x1d')]?_['map'](_0x38df1b[_0xbf7e('0x1d')],function(_0x387d5b){return{'model':db[_0x387d5b[_0xbf7e('0x1f')]],'as':_0x387d5b['as'],'attributes':_0x387d5b[_0xbf7e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbf7e('0xb')](function(_0x573618){logger[_0xbf7e('0xc')](_0xbf7e('0x20'),_0x4a986e);logger[_0xbf7e('0xf')](_0xbf7e('0x20'),_0x4a986e,JSON['stringify'](_0x573618));_0x11755d(_0x573618);})['catch'](function(_0x1d0fcb){logger[_0xbf7e('0x11')](_0xbf7e('0x20'),_0x1d0fcb['message'],_0x4a986e);_0x5d3995(_0x2b6520[_0xbf7e('0x11')](0x1f4,_0x1d0fcb['message']));});});}; \ No newline at end of file +var _0x4260=['limit','include','map','model','GetTrigger','debug','find','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trigger','findAll','options','raw','where','attributes'];(function(_0x579c34,_0x4d0e71){var _0x1d5059=function(_0xe7badc){while(--_0xe7badc){_0x579c34['push'](_0x579c34['shift']());}};_0x1d5059(++_0x4d0e71);}(_0x4260,0x98));var _0x0426=function(_0x52e482,_0x55f548){_0x52e482=_0x52e482-0x0;var _0x117c9f=_0x4260[_0x52e482];return _0x117c9f;};'use strict';var _=require(_0x0426('0x0'));var util=require(_0x0426('0x1'));var moment=require(_0x0426('0x2'));var BPromise=require(_0x0426('0x3'));var rs=require(_0x0426('0x4'));var fs=require('fs');var Redis=require(_0x0426('0x5'));var db=require(_0x0426('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0426('0x7'))(_0x0426('0x8'));var config=require('../../config/environment');var jayson=require(_0x0426('0x9'));var client=jayson[_0x0426('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x324d20,_0x5a3145,_0x355b22){return new BPromise(function(_0x1b2aa9,_0xf81585){return client[_0x0426('0xb')](_0x324d20,_0x355b22)[_0x0426('0xc')](function(_0x139cd9){logger[_0x0426('0xd')](_0x0426('0xe'),_0x5a3145,_0x0426('0xf'));logger['debug'](_0x0426('0x10'),_0x5a3145,'request\x20sent',JSON[_0x0426('0x11')](_0x139cd9));if(_0x139cd9[_0x0426('0x12')]){if(_0x139cd9['error']['code']===0x1f4){logger[_0x0426('0x12')](_0x0426('0xe'),_0x5a3145,_0x139cd9[_0x0426('0x12')][_0x0426('0x13')]);return _0xf81585(_0x139cd9[_0x0426('0x12')][_0x0426('0x13')]);}logger[_0x0426('0x12')]('Trigger,\x20%s,\x20%s',_0x5a3145,_0x139cd9[_0x0426('0x12')][_0x0426('0x13')]);return _0x1b2aa9(_0x139cd9['error']['message']);}else{logger[_0x0426('0xd')]('Trigger,\x20%s,\x20%s',_0x5a3145,_0x0426('0xf'));_0x1b2aa9(_0x139cd9[_0x0426('0x14')][_0x0426('0x13')]);}})[_0x0426('0x15')](function(_0x2fe236){logger['error'](_0x0426('0xe'),_0x5a3145,_0x2fe236);_0xf81585(_0x2fe236);});});}exports['GetTrigger']=function(_0x2cb6fd){var _0x801e2c=this;return new Promise(function(_0x10c61a,_0x3d44a5){return db[_0x0426('0x16')][_0x0426('0x17')]({'raw':_0x2cb6fd['options']?_0x2cb6fd[_0x0426('0x18')][_0x0426('0x19')]===undefined?!![]:![]:!![],'where':_0x2cb6fd['options']?_0x2cb6fd['options'][_0x0426('0x1a')]||null:null,'attributes':_0x2cb6fd[_0x0426('0x18')]?_0x2cb6fd[_0x0426('0x18')][_0x0426('0x1b')]||null:null,'limit':_0x2cb6fd[_0x0426('0x18')]?_0x2cb6fd[_0x0426('0x18')][_0x0426('0x1c')]||null:null,'include':_0x2cb6fd[_0x0426('0x18')]?_0x2cb6fd[_0x0426('0x18')][_0x0426('0x1d')]?_[_0x0426('0x1e')](_0x2cb6fd[_0x0426('0x18')][_0x0426('0x1d')],function(_0x2865f2){return{'model':db[_0x2865f2[_0x0426('0x1f')]],'as':_0x2865f2['as'],'attributes':_0x2865f2[_0x0426('0x1b')],'include':_0x2865f2[_0x0426('0x1d')]?_['map'](_0x2865f2[_0x0426('0x1d')],function(_0x3d337e){return{'model':db[_0x3d337e[_0x0426('0x1f')]],'as':_0x3d337e['as'],'attributes':_0x3d337e[_0x0426('0x1b')],'include':_0x3d337e[_0x0426('0x1d')]?_['map'](_0x3d337e[_0x0426('0x1d')],function(_0x526251){return{'model':db[_0x526251[_0x0426('0x1f')]],'as':_0x526251['as'],'attributes':_0x526251[_0x0426('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0426('0xc')](function(_0x5e4bcc){logger[_0x0426('0xd')](_0x0426('0x20'),_0x2cb6fd);logger[_0x0426('0x21')](_0x0426('0x20'),_0x2cb6fd,JSON[_0x0426('0x11')](_0x5e4bcc));_0x10c61a(_0x5e4bcc);})[_0x0426('0x15')](function(_0x4030d8){logger[_0x0426('0x12')](_0x0426('0x20'),_0x4030d8[_0x0426('0x13')],_0x2cb6fd);_0x3d44a5(_0x801e2c[_0x0426('0x12')](0x1f4,_0x4030d8[_0x0426('0x13')]));});});};exports['ShowTrigger']=function(_0x520db1){var _0x5bec28=this;return new Promise(function(_0x2df7b9,_0x32c105){return db[_0x0426('0x16')][_0x0426('0x22')]({'raw':_0x520db1[_0x0426('0x18')]?_0x520db1[_0x0426('0x18')][_0x0426('0x19')]===undefined?!![]:![]:!![],'where':_0x520db1[_0x0426('0x18')]?_0x520db1[_0x0426('0x18')][_0x0426('0x1a')]||null:null,'attributes':_0x520db1[_0x0426('0x18')]?_0x520db1[_0x0426('0x18')][_0x0426('0x1b')]||null:null,'include':_0x520db1['options']?_0x520db1[_0x0426('0x18')][_0x0426('0x1d')]?_['map'](_0x520db1[_0x0426('0x18')][_0x0426('0x1d')],function(_0x4ef941){return{'model':db[_0x4ef941['model']],'as':_0x4ef941['as'],'attributes':_0x4ef941[_0x0426('0x1b')],'include':_0x4ef941[_0x0426('0x1d')]?_[_0x0426('0x1e')](_0x4ef941['include'],function(_0x2624cd){return{'model':db[_0x2624cd[_0x0426('0x1f')]],'as':_0x2624cd['as'],'attributes':_0x2624cd[_0x0426('0x1b')],'include':_0x2624cd[_0x0426('0x1d')]?_[_0x0426('0x1e')](_0x2624cd[_0x0426('0x1d')],function(_0x1ed3af){return{'model':db[_0x1ed3af[_0x0426('0x1f')]],'as':_0x1ed3af['as'],'attributes':_0x1ed3af[_0x0426('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12e5e7){logger[_0x0426('0xd')](_0x0426('0x23'),_0x520db1);logger[_0x0426('0x21')]('ShowTrigger',_0x520db1,JSON[_0x0426('0x11')](_0x12e5e7));_0x2df7b9(_0x12e5e7);})[_0x0426('0x15')](function(_0x545a17){logger[_0x0426('0x12')](_0x0426('0x23'),_0x545a17['message'],_0x520db1);_0x32c105(_0x5bec28[_0x0426('0x12')](0x1f4,_0x545a17[_0x0426('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5235de4..f9e150d 100644 --- a/server/api/trunk/index.js +++ b/server/api/trunk/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a86=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','create','put','update','destroy','exports','util','connect-timeout'];(function(_0xef442b,_0x2ce34a){var _0x37429e=function(_0x56ee46){while(--_0x56ee46){_0xef442b['push'](_0xef442b['shift']());}};_0x37429e(++_0x2ce34a);}(_0x4a86,0x167));var _0x64a8=function(_0x3b658d,_0x33fd28){_0x3b658d=_0x3b658d-0x0;var _0x6dd480=_0x4a86[_0x3b658d];return _0x6dd480;};'use strict';var multer=require('multer');var util=require(_0x64a8('0x0'));var path=require('path');var timeout=require(_0x64a8('0x1'));var express=require(_0x64a8('0x2'));var router=express[_0x64a8('0x3')]();var fs_extra=require(_0x64a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x64a8('0x5'));var config=require(_0x64a8('0x6'));var controller=require(_0x64a8('0x7'));router[_0x64a8('0x8')]('/',auth[_0x64a8('0x9')](),controller['index']);router[_0x64a8('0x8')](_0x64a8('0xa'),auth['isAuthenticated'](),controller[_0x64a8('0xb')]);router[_0x64a8('0xc')](_0x64a8('0xd'),auth[_0x64a8('0x9')](),controller['clone']);router[_0x64a8('0xc')]('/',auth[_0x64a8('0x9')](),controller[_0x64a8('0xe')]);router[_0x64a8('0xf')]('/:id',auth[_0x64a8('0x9')](),controller[_0x64a8('0x10')]);router['delete'](_0x64a8('0xa'),auth['isAuthenticated'](),controller[_0x64a8('0x11')]);module[_0x64a8('0x12')]=router; \ No newline at end of file +var _0xb338=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone','clone','create','/:id','delete','destroy','multer','util'];(function(_0x5c846e,_0x4063c1){var _0x375c0b=function(_0x14210e){while(--_0x14210e){_0x5c846e['push'](_0x5c846e['shift']());}};_0x375c0b(++_0x4063c1);}(_0xb338,0x102));var _0x8b33=function(_0xaaa123,_0x4c23e3){_0xaaa123=_0xaaa123-0x0;var _0x44d6d7=_0xb338[_0xaaa123];return _0x44d6d7;};'use strict';var multer=require(_0x8b33('0x0'));var util=require(_0x8b33('0x1'));var path=require(_0x8b33('0x2'));var timeout=require(_0x8b33('0x3'));var express=require('express');var router=express[_0x8b33('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b33('0x5'));var interaction=require(_0x8b33('0x6'));var config=require(_0x8b33('0x7'));var controller=require(_0x8b33('0x8'));router[_0x8b33('0x9')]('/',auth[_0x8b33('0xa')](),controller[_0x8b33('0xb')]);router[_0x8b33('0x9')]('/:id',auth[_0x8b33('0xa')](),controller[_0x8b33('0xc')]);router[_0x8b33('0xd')](_0x8b33('0xe'),auth[_0x8b33('0xa')](),controller[_0x8b33('0xf')]);router[_0x8b33('0xd')]('/',auth['isAuthenticated'](),controller[_0x8b33('0x10')]);router['put'](_0x8b33('0x11'),auth[_0x8b33('0xa')](),controller['update']);router[_0x8b33('0x12')](_0x8b33('0x11'),auth['isAuthenticated'](),controller[_0x8b33('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 17145c9..beb56b6 100644 --- a/server/api/trunk/trunk.attributes.js +++ b/server/api/trunk/trunk.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x401c=['insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','uac','uas','pai','fingerprint','certificate','passive','actpass','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite'];(function(_0x55f647,_0x463a1c){var _0x1ad8c6=function(_0x5dfcaf){while(--_0x5dfcaf){_0x55f647['push'](_0x55f647['shift']());}};_0x1ad8c6(++_0x463a1c);}(_0x401c,0xdd));var _0xc401=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0x401c[_0x29d6e6];return _0xc75ff0;};'use strict';var Sequelize=require(_0xc401('0x0'));module[_0xc401('0x1')]={'name':{'type':Sequelize[_0xc401('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x4'),_0xc401('0x5'),'peer'),'allowNull':![],'defaultValue':_0xc401('0x4')},'context':{'type':Sequelize[_0xc401('0x2')],'allowNull':![],'defaultValue':_0xc401('0x6')},'callingpres':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x7'),_0xc401('0x8'),_0xc401('0x9'),'ALLOWED',_0xc401('0xa'),_0xc401('0xb'),_0xc401('0xc'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xc401('0x2')]},'remotesecret':{'type':Sequelize[_0xc401('0x2')]},'transport':{'type':Sequelize[_0xc401('0x2')],'defaultValue':_0xc401('0xd'),'set':function(_0x126b46){this[_0xc401('0xe')](_0xc401('0xf'),_0x126b46?_0x126b46[_0xc401('0x10')](','):null);},'get':function(){return this[_0xc401('0x11')](_0xc401('0xf'))?this[_0xc401('0x11')](_0xc401('0xf'))[_0xc401('0x12')](','):null;},'comment':_0xc401('0x13')},'dtmfmode':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x14'),_0xc401('0x15'),_0xc401('0x16'),_0xc401('0x17'),_0xc401('0x18')),'defaultValue':_0xc401('0x14')},'directmedia':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no','nonat',_0xc401('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc401('0x2')]},'directmediadeny':{'type':Sequelize[_0xc401('0x2')]},'nat':{'type':Sequelize[_0xc401('0x2')],'defaultValue':_0xc401('0x1b'),'set':function(_0x5614db){this[_0xc401('0xe')](_0xc401('0x1c'),_0x5614db?_0x5614db[_0xc401('0x10')](','):null);},'get':function(){return this[_0xc401('0x11')](_0xc401('0x1c'))?this[_0xc401('0x11')]('nat')[_0xc401('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc401('0x2')]},'namedcallgroup':{'type':Sequelize[_0xc401('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc401('0x2')]},'language':{'type':Sequelize[_0xc401('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc401('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc401('0x2')],'defaultValue':_0xc401('0x1d')},'allow':{'type':Sequelize[_0xc401('0x2')],'allowNull':![],'defaultValue':_0xc401('0x1e'),'set':function(_0x1f8113){this[_0xc401('0xe')](_0xc401('0x1f'),_0x1f8113?_0x1f8113[_0xc401('0x10')](';'):_0xc401('0x1e'));},'get':function(){return this[_0xc401('0x11')](_0xc401('0x1f'))?this[_0xc401('0x11')](_0xc401('0x1f'))['split'](';'):null;},'comment':_0xc401('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no')},'insecure':{'type':Sequelize[_0xc401('0x2')],'defaultValue':_0xc401('0x21'),'set':function(_0x20ab62){this[_0xc401('0xe')]('insecure',_0x20ab62?_0x20ab62[_0xc401('0x10')](','):null);},'get':function(){return this[_0xc401('0x11')]('insecure')?this[_0xc401('0x11')](_0xc401('0x22'))[_0xc401('0x12')](','):null;},'comment':_0xc401('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no',_0xc401('0x24'))},'promiscredir':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xc401('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0xc401('0x25')](0xb)},'setvar':{'type':Sequelize[_0xc401('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xc401('0x26')},'amaflags':{'type':Sequelize[_0xc401('0x2')]},'callcounter':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no'),'defaultValue':_0xc401('0x19')},'busylevel':{'type':Sequelize[_0xc401('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xc401('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xc401('0x2')]},'template':{'type':Sequelize[_0xc401('0x2')]},'videosupport':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no',_0xc401('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no')},'mailbox':{'type':Sequelize[_0xc401('0x2')]},'session_timers':{'type':Sequelize[_0xc401('0x3')]('accept',_0xc401('0x28'),'originate')},'session_expires':{'type':Sequelize[_0xc401('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xc401('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xc401('0x29'),_0xc401('0x2a')),'defaultValue':_0xc401('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xc401('0x2')]},'regexten':{'type':Sequelize[_0xc401('0x2')]},'fromdomain':{'type':Sequelize[_0xc401('0x2')]},'fromuser':{'type':Sequelize[_0xc401('0x2')]},'port':{'type':Sequelize[_0xc401('0x25')](0x5)},'qualify':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xc401('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc401('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc401('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no',_0xc401('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xc401('0x2')]},'timert1':{'type':Sequelize[_0xc401('0x25')](0xb)},'timerb':{'type':Sequelize[_0xc401('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc401('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xc401('0x2')]},'contactdeny':{'type':Sequelize[_0xc401('0x2')]},'contactacl':{'type':Sequelize[_0xc401('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xc401('0x2')]},'use_q850_reason':{'type':Sequelize[_0xc401('0x2')]},'maxforwards':{'type':Sequelize[_0xc401('0x25')](0xb)},'encryption':{'type':Sequelize[_0xc401('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no')},'force_avp':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no')},'icesupport':{'type':Sequelize[_0xc401('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no',_0xc401('0x2c'),_0xc401('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xc401('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xc401('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xc401('0x2')]},'dtlscapath':{'type':Sequelize[_0xc401('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xc401('0x2e'),_0xc401('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc401('0x2')]},'usereqphone':{'type':Sequelize[_0xc401('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xc401('0x2')]},'call_limit':{'type':Sequelize[_0xc401('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0xc401('0x2')]},'mohinterpret':{'type':Sequelize[_0xc401('0x2')]},'mohsuggest':{'type':Sequelize[_0xc401('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc401('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no',_0xc401('0x30'),_0xc401('0x1a'),_0xc401('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xc401('0x2')]},'active':{'type':Sequelize[_0xc401('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc401('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xfaea=['join','split','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xfaea,0x1c8));var _0xafae=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0xfaea[_0x43026b];return _0x4a96cd;};'use strict';var Sequelize=require(_0xafae('0x0'));module[_0xafae('0x1')]={'name':{'type':Sequelize[_0xafae('0x2')],'allowNull':![],'unique':_0xafae('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xafae('0x4'),_0xafae('0x5'),_0xafae('0x6')),'allowNull':![],'defaultValue':_0xafae('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xafae('0x7')},'callingpres':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x9'),_0xafae('0xa'),_0xafae('0xb'),_0xafae('0xc'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xafae('0xd'),_0xafae('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xafae('0x2')]},'secret':{'type':Sequelize[_0xafae('0x2')]},'md5secret':{'type':Sequelize[_0xafae('0x2')]},'remotesecret':{'type':Sequelize[_0xafae('0x2')]},'transport':{'type':Sequelize[_0xafae('0x2')],'defaultValue':_0xafae('0xf'),'set':function(_0x5e48fc){this[_0xafae('0x10')]('transport',_0x5e48fc?_0x5e48fc['join'](','):null);},'get':function(){return this[_0xafae('0x11')]('transport')?this[_0xafae('0x11')](_0xafae('0x12'))['split'](','):null;},'comment':_0xafae('0x13')},'dtmfmode':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x14'),_0xafae('0x15'),_0xafae('0x16'),_0xafae('0x17'),_0xafae('0x18')),'defaultValue':_0xafae('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0xafae('0x19'),'no','nonat',_0xafae('0x1a'),_0xafae('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xafae('0x8')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xafae('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xafae('0x2')],'defaultValue':_0xafae('0x1c'),'set':function(_0x3fe8a9){this['setDataValue'](_0xafae('0x1d'),_0x3fe8a9?_0x3fe8a9[_0xafae('0x1e')](','):null);},'get':function(){return this[_0xafae('0x11')](_0xafae('0x1d'))?this[_0xafae('0x11')](_0xafae('0x1d'))[_0xafae('0x1f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xafae('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xafae('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xafae('0x2')]},'language':{'type':Sequelize[_0xafae('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xafae('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xafae('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xafae('0x2')],'allowNull':![],'defaultValue':_0xafae('0x20'),'set':function(_0x31c8e3){this[_0xafae('0x10')]('allow',_0x31c8e3?_0x31c8e3[_0xafae('0x1e')](';'):_0xafae('0x20'));},'get':function(){return this[_0xafae('0x11')](_0xafae('0x21'))?this[_0xafae('0x11')]('allow')[_0xafae('0x1f')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xafae('0x22'),'set':function(_0x333d79){this[_0xafae('0x10')](_0xafae('0x23'),_0x333d79?_0x333d79[_0xafae('0x1e')](','):null);},'get':function(){return this[_0xafae('0x11')](_0xafae('0x23'))?this[_0xafae('0x11')](_0xafae('0x23'))[_0xafae('0x1f')](','):null;},'comment':_0xafae('0x24')},'trustrpid':{'type':Sequelize[_0xafae('0x8')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xafae('0x19'),'no','never')},'promiscredir':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no')},'accountcode':{'type':Sequelize[_0xafae('0x25')](0xb)},'setvar':{'type':Sequelize[_0xafae('0x2')]},'callerid':{'type':Sequelize[_0xafae('0x2')],'defaultValue':_0xafae('0x26')},'amaflags':{'type':Sequelize[_0xafae('0x2')]},'callcounter':{'type':Sequelize[_0xafae('0x8')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xafae('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xafae('0x8')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xafae('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xafae('0x2')]},'template':{'type':Sequelize[_0xafae('0x2')]},'videosupport':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no',_0xafae('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xafae('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xafae('0x19'),'no')},'mailbox':{'type':Sequelize[_0xafae('0x2')]},'session_timers':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x28'),_0xafae('0x29'),_0xafae('0x2a'))},'session_expires':{'type':Sequelize[_0xafae('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xafae('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x2b'),_0xafae('0x2c')),'defaultValue':_0xafae('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0xafae('0x2')]},'regexten':{'type':Sequelize[_0xafae('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xafae('0x2')]},'port':{'type':Sequelize[_0xafae('0x25')](0x5)},'qualify':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xafae('0x2')]},'defaultuser':{'type':Sequelize[_0xafae('0x2')]},'rtptimeout':{'type':Sequelize[_0xafae('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xafae('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xafae('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xafae('0x19'),'no',_0xafae('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xafae('0x2')]},'callbackextension':{'type':Sequelize[_0xafae('0x2')]},'timert1':{'type':Sequelize[_0xafae('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xafae('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xafae('0x2')]},'contactdeny':{'type':Sequelize[_0xafae('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xafae('0x2')]},'maxforwards':{'type':Sequelize[_0xafae('0x25')](0xb)},'encryption':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no',_0xafae('0x2e'),_0xafae('0x2f'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xafae('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xafae('0x2')]},'dtlscafile':{'type':Sequelize[_0xafae('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x30'),_0xafae('0x31'),_0xafae('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xafae('0x2')]},'usereqphone':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xafae('0x2')]},'recordofffeature':{'type':Sequelize[_0xafae('0x2')]},'call_limit':{'type':Sequelize[_0xafae('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xafae('0x8')](_0xafae('0x19'),'no')},'vmexten':{'type':Sequelize[_0xafae('0x2')]},'mohinterpret':{'type':Sequelize[_0xafae('0x2')]},'mohsuggest':{'type':Sequelize[_0xafae('0x2')]},'parkinglot':{'type':Sequelize[_0xafae('0x2')]},'description':{'type':Sequelize[_0xafae('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xafae('0x33')},'canreinvite':{'type':Sequelize[_0xafae('0x8')]('yes','no','nonat','update',_0xafae('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xafae('0x2')]},'otherFields':{'type':Sequelize[_0xafae('0x2')]},'active':{'type':Sequelize[_0xafae('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xafae('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index c2c4ffc..87e0a01 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x445daf,_0x5603d9){var _0x4f3106=function(_0x3a505f){while(--_0x3a505f){_0x445daf['push'](_0x445daf['shift']());}};_0x4f3106(++_0x5603d9);}(_0x98a8,0x12c));var _0x898a=function(_0x32ba70,_0x2a4598){_0x32ba70=_0x32ba70-0x0;var _0x3cdd89=_0x98a8[_0x32ba70];return _0x3cdd89;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file +var _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x81bd,0x7c));var _0xd81b=function(_0x324189,_0x202ac1){_0x324189=_0x324189-0x0;var _0x495eee=_0x81bd[_0x324189];return _0x495eee;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b970dd1..af84417 100644 --- a/server/api/trunk/trunk.model.js +++ b/server/api/trunk/trunk.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc37d=['bluebird','request-promise','rimraf','./trunk.attributes','exports','Trunk','tools_trunks','util','../../config/logger','api','moment'];(function(_0x78fd79,_0x58888a){var _0x9aae9a=function(_0x291920){while(--_0x291920){_0x78fd79['push'](_0x78fd79['shift']());}};_0x9aae9a(++_0x58888a);}(_0xc37d,0x1a9));var _0xdc37=function(_0x2c6104,_0x40a18a){_0x2c6104=_0x2c6104-0x0;var _0x37f38f=_0xc37d[_0x2c6104];return _0x37f38f;};'use strict';var _=require('lodash');var util=require(_0xdc37('0x0'));var logger=require(_0xdc37('0x1'))(_0xdc37('0x2'));var moment=require(_0xdc37('0x3'));var BPromise=require(_0xdc37('0x4'));var rp=require(_0xdc37('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc37('0x6'));var config=require('../../config/environment');var attributes=require(_0xdc37('0x7'));module[_0xdc37('0x8')]=function(_0x4a4de5,_0x417bee){return _0x4a4de5['define'](_0xdc37('0x9'),attributes,{'tableName':_0xdc37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf16=['./trunk.attributes','exports','Trunk','tools_trunks','lodash','api','bluebird','path','rimraf'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0xdf16,0xca));var _0x6df1=function(_0x96a519,_0x1de251){_0x96a519=_0x96a519-0x0;var _0xf31872=_0xdf16[_0x96a519];return _0xf31872;};'use strict';var _=require(_0x6df1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6df1('0x1'));var moment=require('moment');var BPromise=require(_0x6df1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6df1('0x3'));var rimraf=require(_0x6df1('0x4'));var config=require('../../config/environment');var attributes=require(_0x6df1('0x5'));module[_0x6df1('0x6')]=function(_0x1adf9a,_0x3f3b49){return _0x1adf9a['define'](_0x6df1('0x7'),attributes,{'tableName':_0x6df1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index f1e5dd5..bbbb64f 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa93d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','model','map','debug','stringify','ShowTrunk','lodash','moment','bluebird','randomstring'];(function(_0x2619a1,_0x1f8f66){var _0x517c07=function(_0x17567f){while(--_0x17567f){_0x2619a1['push'](_0x2619a1['shift']());}};_0x517c07(++_0x1f8f66);}(_0xa93d,0xa6));var _0xda93=function(_0xdead06,_0x3fcddb){_0xdead06=_0xdead06-0x0;var _0x338677=_0xa93d[_0xdead06];return _0x338677;};'use strict';var _=require(_0xda93('0x0'));var util=require('util');var moment=require(_0xda93('0x1'));var BPromise=require(_0xda93('0x2'));var rs=require(_0xda93('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda93('0x4'))['db'];var utils=require(_0xda93('0x5'));var logger=require(_0xda93('0x6'))(_0xda93('0x7'));var config=require(_0xda93('0x8'));var jayson=require(_0xda93('0x9'));var client=jayson['client'][_0xda93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5608a1,_0x2da0d9,_0x3c1504){return new BPromise(function(_0x57b194,_0x1e42d6){return client[_0xda93('0xb')](_0x5608a1,_0x3c1504)[_0xda93('0xc')](function(_0x1a2204){logger[_0xda93('0xd')](_0xda93('0xe'),_0x2da0d9,_0xda93('0xf'));logger['debug'](_0xda93('0x10'),_0x2da0d9,'request\x20sent',JSON['stringify'](_0x1a2204));if(_0x1a2204[_0xda93('0x11')]){if(_0x1a2204[_0xda93('0x11')][_0xda93('0x12')]===0x1f4){logger[_0xda93('0x11')](_0xda93('0xe'),_0x2da0d9,_0x1a2204['error']['message']);return _0x1e42d6(_0x1a2204['error']['message']);}logger[_0xda93('0x11')](_0xda93('0xe'),_0x2da0d9,_0x1a2204[_0xda93('0x11')][_0xda93('0x13')]);return _0x57b194(_0x1a2204[_0xda93('0x11')][_0xda93('0x13')]);}else{logger[_0xda93('0xd')](_0xda93('0xe'),_0x2da0d9,_0xda93('0xf'));_0x57b194(_0x1a2204['result']['message']);}})[_0xda93('0x14')](function(_0x37743b){logger[_0xda93('0x11')](_0xda93('0xe'),_0x2da0d9,_0x37743b);_0x1e42d6(_0x37743b);});});}exports[_0xda93('0x15')]=function(_0x43a60f){var _0x411d17=this;return new Promise(function(_0x152463,_0x50c69e){return db[_0xda93('0x16')][_0xda93('0x17')]({'raw':_0x43a60f['options']?_0x43a60f[_0xda93('0x18')][_0xda93('0x19')]===undefined?!![]:![]:!![],'where':_0x43a60f['options']?_0x43a60f[_0xda93('0x18')][_0xda93('0x1a')]||null:null,'attributes':_0x43a60f[_0xda93('0x18')]?_0x43a60f['options'][_0xda93('0x1b')]||null:null,'limit':_0x43a60f[_0xda93('0x18')]?_0x43a60f[_0xda93('0x18')]['limit']||null:null,'include':_0x43a60f[_0xda93('0x18')]?_0x43a60f[_0xda93('0x18')][_0xda93('0x1c')]?_['map'](_0x43a60f[_0xda93('0x18')][_0xda93('0x1c')],function(_0x5dcaf2){return{'model':db[_0x5dcaf2[_0xda93('0x1d')]],'as':_0x5dcaf2['as'],'attributes':_0x5dcaf2[_0xda93('0x1b')],'include':_0x5dcaf2[_0xda93('0x1c')]?_[_0xda93('0x1e')](_0x5dcaf2[_0xda93('0x1c')],function(_0x3742f1){return{'model':db[_0x3742f1['model']],'as':_0x3742f1['as'],'attributes':_0x3742f1[_0xda93('0x1b')],'include':_0x3742f1[_0xda93('0x1c')]?_['map'](_0x3742f1[_0xda93('0x1c')],function(_0x13e2f5){return{'model':db[_0x13e2f5['model']],'as':_0x13e2f5['as'],'attributes':_0x13e2f5[_0xda93('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xda93('0xc')](function(_0x8565a0){logger[_0xda93('0xd')](_0xda93('0x15'),_0x43a60f);logger[_0xda93('0x1f')](_0xda93('0x15'),_0x43a60f,JSON[_0xda93('0x20')](_0x8565a0));_0x152463(_0x8565a0);})[_0xda93('0x14')](function(_0x389ddc){logger[_0xda93('0x11')](_0xda93('0x15'),_0x389ddc['message'],_0x43a60f);_0x50c69e(_0x411d17[_0xda93('0x11')](0x1f4,_0x389ddc[_0xda93('0x13')]));});});};exports[_0xda93('0x21')]=function(_0x2063b7){var _0x57a924=this;return new Promise(function(_0x3d69cd,_0x3758a5){return db[_0xda93('0x16')]['find']({'raw':_0x2063b7[_0xda93('0x18')]?_0x2063b7[_0xda93('0x18')][_0xda93('0x19')]===undefined?!![]:![]:!![],'where':_0x2063b7[_0xda93('0x18')]?_0x2063b7['options']['where']||null:null,'attributes':_0x2063b7['options']?_0x2063b7[_0xda93('0x18')][_0xda93('0x1b')]||null:null,'include':_0x2063b7[_0xda93('0x18')]?_0x2063b7[_0xda93('0x18')][_0xda93('0x1c')]?_[_0xda93('0x1e')](_0x2063b7[_0xda93('0x18')]['include'],function(_0x13d943){return{'model':db[_0x13d943[_0xda93('0x1d')]],'as':_0x13d943['as'],'attributes':_0x13d943[_0xda93('0x1b')],'include':_0x13d943[_0xda93('0x1c')]?_['map'](_0x13d943[_0xda93('0x1c')],function(_0x16c140){return{'model':db[_0x16c140[_0xda93('0x1d')]],'as':_0x16c140['as'],'attributes':_0x16c140[_0xda93('0x1b')],'include':_0x16c140[_0xda93('0x1c')]?_['map'](_0x16c140[_0xda93('0x1c')],function(_0x242d1f){return{'model':db[_0x242d1f['model']],'as':_0x242d1f['as'],'attributes':_0x242d1f[_0xda93('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xda93('0xc')](function(_0x2888ab){logger[_0xda93('0xd')](_0xda93('0x21'),_0x2063b7);logger[_0xda93('0x1f')](_0xda93('0x21'),_0x2063b7,JSON[_0xda93('0x20')](_0x2888ab));_0x3d69cd(_0x2888ab);})[_0xda93('0x14')](function(_0x3b2e5d){logger[_0xda93('0x11')]('ShowTrunk',_0x3b2e5d[_0xda93('0x13')],_0x2063b7);_0x3758a5(_0x57a924['error'](0x1f4,_0x3b2e5d[_0xda93('0x13')]));});});}; \ No newline at end of file +var _0x2881=['message','result','catch','GetTrunk','findAll','options','where','attributes','limit','map','model','include','ShowTrunk','Trunk','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2881,0x1f1));var _0x1288=function(_0x3d4c88,_0x2a2db9){_0x3d4c88=_0x3d4c88-0x0;var _0x4ebb53=_0x2881[_0x3d4c88];return _0x4ebb53;};'use strict';var _=require(_0x1288('0x0'));var util=require(_0x1288('0x1'));var moment=require(_0x1288('0x2'));var BPromise=require(_0x1288('0x3'));var rs=require(_0x1288('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1288('0x5'))['db'];var utils=require(_0x1288('0x6'));var logger=require(_0x1288('0x7'))('rpc');var config=require(_0x1288('0x8'));var jayson=require(_0x1288('0x9'));var client=jayson[_0x1288('0xa')][_0x1288('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc6f487,_0x1c69b1,_0x594161){return new BPromise(function(_0x54c145,_0x466733){return client[_0x1288('0xc')](_0xc6f487,_0x594161)[_0x1288('0xd')](function(_0x587f5){logger[_0x1288('0xe')]('Trunk,\x20%s,\x20%s',_0x1c69b1,_0x1288('0xf'));logger[_0x1288('0x10')](_0x1288('0x11'),_0x1c69b1,_0x1288('0xf'),JSON[_0x1288('0x12')](_0x587f5));if(_0x587f5['error']){if(_0x587f5[_0x1288('0x13')]['code']===0x1f4){logger['error'](_0x1288('0x14'),_0x1c69b1,_0x587f5[_0x1288('0x13')]['message']);return _0x466733(_0x587f5[_0x1288('0x13')][_0x1288('0x15')]);}logger['error'](_0x1288('0x14'),_0x1c69b1,_0x587f5['error'][_0x1288('0x15')]);return _0x54c145(_0x587f5['error'][_0x1288('0x15')]);}else{logger['info'](_0x1288('0x14'),_0x1c69b1,_0x1288('0xf'));_0x54c145(_0x587f5[_0x1288('0x16')][_0x1288('0x15')]);}})[_0x1288('0x17')](function(_0x2bb8e1){logger['error'](_0x1288('0x14'),_0x1c69b1,_0x2bb8e1);_0x466733(_0x2bb8e1);});});}exports[_0x1288('0x18')]=function(_0x3f6220){var _0x47a65b=this;return new Promise(function(_0x3652ba,_0x3fb63c){return db['Trunk'][_0x1288('0x19')]({'raw':_0x3f6220['options']?_0x3f6220[_0x1288('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3f6220['options']?_0x3f6220[_0x1288('0x1a')][_0x1288('0x1b')]||null:null,'attributes':_0x3f6220[_0x1288('0x1a')]?_0x3f6220['options'][_0x1288('0x1c')]||null:null,'limit':_0x3f6220['options']?_0x3f6220[_0x1288('0x1a')][_0x1288('0x1d')]||null:null,'include':_0x3f6220[_0x1288('0x1a')]?_0x3f6220[_0x1288('0x1a')]['include']?_[_0x1288('0x1e')](_0x3f6220[_0x1288('0x1a')]['include'],function(_0x258377){return{'model':db[_0x258377[_0x1288('0x1f')]],'as':_0x258377['as'],'attributes':_0x258377[_0x1288('0x1c')],'include':_0x258377[_0x1288('0x20')]?_['map'](_0x258377[_0x1288('0x20')],function(_0x33eb3e){return{'model':db[_0x33eb3e[_0x1288('0x1f')]],'as':_0x33eb3e['as'],'attributes':_0x33eb3e['attributes'],'include':_0x33eb3e[_0x1288('0x20')]?_[_0x1288('0x1e')](_0x33eb3e[_0x1288('0x20')],function(_0x313c2c){return{'model':db[_0x313c2c[_0x1288('0x1f')]],'as':_0x313c2c['as'],'attributes':_0x313c2c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3de88b){logger[_0x1288('0xe')]('GetTrunk',_0x3f6220);logger['debug']('GetTrunk',_0x3f6220,JSON['stringify'](_0x3de88b));_0x3652ba(_0x3de88b);})['catch'](function(_0x16d801){logger[_0x1288('0x13')](_0x1288('0x18'),_0x16d801['message'],_0x3f6220);_0x3fb63c(_0x47a65b[_0x1288('0x13')](0x1f4,_0x16d801[_0x1288('0x15')]));});});};exports[_0x1288('0x21')]=function(_0x34536e){var _0x552463=this;return new Promise(function(_0x23d001,_0x28916f){return db[_0x1288('0x22')][_0x1288('0x23')]({'raw':_0x34536e['options']?_0x34536e['options'][_0x1288('0x24')]===undefined?!![]:![]:!![],'where':_0x34536e[_0x1288('0x1a')]?_0x34536e[_0x1288('0x1a')][_0x1288('0x1b')]||null:null,'attributes':_0x34536e[_0x1288('0x1a')]?_0x34536e['options'][_0x1288('0x1c')]||null:null,'include':_0x34536e[_0x1288('0x1a')]?_0x34536e['options'][_0x1288('0x20')]?_[_0x1288('0x1e')](_0x34536e['options'][_0x1288('0x20')],function(_0x3946ba){return{'model':db[_0x3946ba[_0x1288('0x1f')]],'as':_0x3946ba['as'],'attributes':_0x3946ba['attributes'],'include':_0x3946ba[_0x1288('0x20')]?_['map'](_0x3946ba[_0x1288('0x20')],function(_0x2b0ae3){return{'model':db[_0x2b0ae3[_0x1288('0x1f')]],'as':_0x2b0ae3['as'],'attributes':_0x2b0ae3[_0x1288('0x1c')],'include':_0x2b0ae3['include']?_['map'](_0x2b0ae3[_0x1288('0x20')],function(_0xf17761){return{'model':db[_0xf17761[_0x1288('0x1f')]],'as':_0xf17761['as'],'attributes':_0xf17761[_0x1288('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1288('0xd')](function(_0x2911c9){logger[_0x1288('0xe')](_0x1288('0x21'),_0x34536e);logger['debug'](_0x1288('0x21'),_0x34536e,JSON['stringify'](_0x2911c9));_0x23d001(_0x2911c9);})[_0x1288('0x17')](function(_0x2ca68b){logger['error']('ShowTrunk',_0x2ca68b[_0x1288('0x15')],_0x34536e);_0x28916f(_0x552463[_0x1288('0x13')](0x1f4,_0x2ca68b[_0x1288('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 061c1df..aa9ea7a 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc70f=['put','/:id','isAuthenticated','exports','express','Router','./user-setting.controller'];(function(_0x4f0c60,_0x4f5d3a){var _0x48c3fd=function(_0x224fa1){while(--_0x224fa1){_0x4f0c60['push'](_0x4f0c60['shift']());}};_0x48c3fd(++_0x4f5d3a);}(_0xc70f,0x185));var _0xfc70=function(_0x43c815,_0x5c85dc){_0x43c815=_0x43c815-0x0;var _0x1998d2=_0xc70f[_0x43c815];return _0x1998d2;};'use strict';var express=require(_0xfc70('0x0'));var router=express[_0xfc70('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xfc70('0x2'));router[_0xfc70('0x3')](_0xfc70('0x4'),auth[_0xfc70('0x5')](),controller['update']);module[_0xfc70('0x6')]=router; \ No newline at end of file +var _0xce70=['put','isAuthenticated','update','exports','express','../../components/auth/service','./user-setting.controller'];(function(_0x4fa4fd,_0x4c656b){var _0x3c50d0=function(_0x223600){while(--_0x223600){_0x4fa4fd['push'](_0x4fa4fd['shift']());}};_0x3c50d0(++_0x4c656b);}(_0xce70,0x90));var _0x0ce7=function(_0x1578d5,_0x3fd4d5){_0x1578d5=_0x1578d5-0x0;var _0x10dffe=_0xce70[_0x1578d5];return _0x10dffe;};'use strict';var express=require(_0x0ce7('0x0'));var router=express['Router']();var auth=require(_0x0ce7('0x1'));var controller=require(_0x0ce7('0x2'));router[_0x0ce7('0x3')]('/:id',auth[_0x0ce7('0x4')](),controller[_0x0ce7('0x5')]);module[_0x0ce7('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index d804fe5..77ccfbf 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa205=['debug','exports','ENUM','error','BOOLEAN','TEXT','DATE','warning','info'];(function(_0x22b490,_0x3a50d0){var _0x2700c9=function(_0x2a45d2){while(--_0x2a45d2){_0x22b490['push'](_0x22b490['shift']());}};_0x2700c9(++_0x3a50d0);}(_0xa205,0xfa));var _0x5a20=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0xa205[_0x3e961c];return _0x474f9c;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x5a20('0x0'),_0x5a20('0x1'),_0x5a20('0x2')];module[_0x5a20('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5a20('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5a20('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5a20('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x5a20('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5a20('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0xdaaa=['INTEGER','UserId','sequelize','error','warning','info','debug','exports','ENUM','BOOLEAN','TEXT'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0xdaaa,0x70));var _0xadaa=function(_0x47e6b5,_0x320bdf){_0x47e6b5=_0x47e6b5-0x0;var _0xf5ae40=_0xdaaa[_0x47e6b5];return _0xf5ae40;};'use strict';var Sequelize=require(_0xadaa('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xadaa('0x1'),_0xadaa('0x2'),_0xadaa('0x3'),_0xadaa('0x4')];module[_0xadaa('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xadaa('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xadaa('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xadaa('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xadaa('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xadaa('0x9')],'unique':_0xadaa('0xa')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 2c519a0..9d8227f 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x032e=['admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','lodash','../../config/logger','api','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role'];(function(_0x416d69,_0x3d0fbe){var _0x8a73cb=function(_0x169804){while(--_0x169804){_0x416d69['push'](_0x416d69['shift']());}};_0x8a73cb(++_0x3d0fbe);}(_0x032e,0x124));var _0xe032=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x032e[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xe032('0x0'));var Redis=require('ioredis');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xe032('0x3'))(new Redis(config[_0xe032('0x4')]));require(_0xe032('0x5'))[_0xe032('0x6')](socket);config[_0xe032('0x4')]=_[_0xe032('0x7')](config[_0xe032('0x4')],{'host':_0xe032('0x8'),'port':0x18eb});function respondWithResult(_0x37432f,_0x1576c8){_0x1576c8=_0x1576c8||0xc8;return function(_0x3289b0){if(_0x3289b0){return _0x37432f[_0xe032('0x9')](_0x1576c8)[_0xe032('0xa')](_0x3289b0);}};}function saveUpdates(_0x3b0ef8){return function(_0x3d62fa){if(_0x3d62fa){return _0x3d62fa[_0xe032('0xb')](_0x3b0ef8)[_0xe032('0xc')](function(_0x167bd9){return _0x167bd9;});}return null;};}function handleEntityNotFound(_0x4aec53){return function(_0x1382e1){if(!_0x1382e1){_0x4aec53[_0xe032('0xd')](0x194);}return _0x1382e1;};}function handleError(_0x13c126,_0x42e2ba){_0x42e2ba=_0x42e2ba||0x1f4;return function(_0x244f93){logger[_0xe032('0xe')](_0x244f93[_0xe032('0xf')]);if(_0x244f93['name']){delete _0x244f93[_0xe032('0x10')];}_0x13c126[_0xe032('0x9')](_0x42e2ba)[_0xe032('0x11')](_0x244f93);};}exports[_0xe032('0xb')]=function(_0x4aee44,_0x311592){if(_0x4aee44[_0xe032('0x12')][_0xe032('0x13')]!==_0xe032('0x14'))throw new Error(_0xe032('0x15'));if(isNaN(Number(_0x4aee44[_0xe032('0x16')]['id'])))throw new Error(_0xe032('0x17'));return db['UserSetting'][_0xe032('0x18')]({'where':{'id':_0x4aee44[_0xe032('0x16')]['id']}})[_0xe032('0xc')](handleEntityNotFound(_0x311592,null))[_0xe032('0xc')](saveUpdates(_0x4aee44[_0xe032('0x19')],null))[_0xe032('0xc')](respondWithResult(_0x311592,null))['catch'](handleError(_0x311592,null));}; \ No newline at end of file +var _0xc718=['then','sendStatus','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','../../config/logger','api','../../mysqldb','socket.io-emitter','register','localhost','status','json','update'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xc718,0xb6));var _0x8c71=function(_0x355983,_0x1379fe){_0x355983=_0x355983-0x0;var _0xdea4c7=_0xc718[_0x355983];return _0xdea4c7;};'use strict';var _=require(_0x8c71('0x0'));var Redis=require('ioredis');var logger=require(_0x8c71('0x1'))(_0x8c71('0x2'));var config=require('../../config/environment');var db=require(_0x8c71('0x3'))['db'];var socket=require(_0x8c71('0x4'))(new Redis(config['redis']));require('./user-setting.socket')[_0x8c71('0x5')](socket);config['redis']=_['defaults'](config['redis'],{'host':_0x8c71('0x6'),'port':0x18eb});function respondWithResult(_0x4cfd67,_0xf122c7){_0xf122c7=_0xf122c7||0xc8;return function(_0x10c4a){if(_0x10c4a){return _0x4cfd67[_0x8c71('0x7')](_0xf122c7)[_0x8c71('0x8')](_0x10c4a);}};}function saveUpdates(_0x45e21c){return function(_0x5272f4){if(_0x5272f4){return _0x5272f4[_0x8c71('0x9')](_0x45e21c)[_0x8c71('0xa')](function(_0x3fbad9){return _0x3fbad9;});}return null;};}function handleEntityNotFound(_0x1f6c98){return function(_0x1cc440){if(!_0x1cc440){_0x1f6c98[_0x8c71('0xb')](0x194);}return _0x1cc440;};}function handleError(_0x3c21ca,_0x6d309e){_0x6d309e=_0x6d309e||0x1f4;return function(_0x33f7e7){logger['error'](_0x33f7e7[_0x8c71('0xc')]);if(_0x33f7e7[_0x8c71('0xd')]){delete _0x33f7e7[_0x8c71('0xd')];}_0x3c21ca[_0x8c71('0x7')](_0x6d309e)[_0x8c71('0xe')](_0x33f7e7);};}exports[_0x8c71('0x9')]=function(_0xa05caf,_0x2b26f1){if(_0xa05caf[_0x8c71('0xf')][_0x8c71('0x10')]!==_0x8c71('0x11'))throw new Error(_0x8c71('0x12'));if(isNaN(Number(_0xa05caf[_0x8c71('0x13')]['id'])))throw new Error(_0x8c71('0x14'));return db[_0x8c71('0x15')][_0x8c71('0x16')]({'where':{'id':_0xa05caf[_0x8c71('0x13')]['id']}})[_0x8c71('0xa')](handleEntityNotFound(_0x2b26f1,null))['then'](saveUpdates(_0xa05caf[_0x8c71('0x17')],null))[_0x8c71('0xa')](respondWithResult(_0x2b26f1,null))['catch'](handleError(_0x2b26f1,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 6201635..564b058 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3840=['../../mysqldb','UserSetting','save','update','remove','emit','hook','exports','events'];(function(_0x12b955,_0x2df692){var _0x9b217d=function(_0x52a764){while(--_0x52a764){_0x12b955['push'](_0x12b955['shift']());}};_0x9b217d(++_0x2df692);}(_0x3840,0x104));var _0x0384=function(_0x19657f,_0x4b124d){_0x19657f=_0x19657f-0x0;var _0x129bba=_0x3840[_0x19657f];return _0x129bba;};'use strict';var EventEmitter=require(_0x0384('0x0'));var UserSetting=require(_0x0384('0x1'))['db'][_0x0384('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0384('0x3'),'afterUpdate':_0x0384('0x4'),'afterDestroy':_0x0384('0x5')};function emitEvent(_0x341377){return function(_0x3e369e,_0x47c181,_0x4670cd){UserSettingEvents[_0x0384('0x6')](_0x341377+':'+_0x3e369e['id'],_0x3e369e);UserSettingEvents[_0x0384('0x6')](_0x341377,_0x3e369e);_0x4670cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x0384('0x7')](e,emitEvent(event));}}module[_0x0384('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x6a88=['events','UserSetting','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x36eb8,_0x191e35){var _0x4d79e5=function(_0x5b037b){while(--_0x5b037b){_0x36eb8['push'](_0x36eb8['shift']());}};_0x4d79e5(++_0x191e35);}(_0x6a88,0x80));var _0x86a8=function(_0x19aa84,_0x549537){_0x19aa84=_0x19aa84-0x0;var _0x536146=_0x6a88[_0x19aa84];return _0x536146;};'use strict';var EventEmitter=require(_0x86a8('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x86a8('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x86a8('0x2')](0x0);var events={'afterCreate':_0x86a8('0x3'),'afterUpdate':'update','afterDestroy':_0x86a8('0x4')};function emitEvent(_0x2e7bee){return function(_0x367347,_0x3c47fd,_0x4a95c9){UserSettingEvents[_0x86a8('0x5')](_0x2e7bee+':'+_0x367347['id'],_0x367347);UserSettingEvents[_0x86a8('0x5')](_0x2e7bee,_0x367347);_0x4a95c9(null);};}for(var e in events){if(events[_0x86a8('0x6')](e)){var event=events[e];UserSetting[_0x86a8('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 504655b..7da057d 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0565=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x44d344,_0x36f469){var _0x431075=function(_0x22ed7a){while(--_0x22ed7a){_0x44d344['push'](_0x44d344['shift']());}};_0x431075(++_0x36f469);}(_0x0565,0xf2));var _0x5056=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0565[_0x47aa64];return _0x549c7a;};'use strict';var attributes=require(_0x5056('0x0'));module[_0x5056('0x1')]=function(_0x2790a7){return _0x2790a7[_0x5056('0x2')](_0x5056('0x3'),attributes,{'tableName':_0x5056('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd4624d){if(!_0xd4624d[_0x5056('0x5')])_0xd4624d[_0x5056('0x6')]=null;else if(_0xd4624d[_0x5056('0x6')]===null)_0xd4624d['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x153f=['exports','define','UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x153f,0x15b));var _0xf153=function(_0x4597c3,_0x55f176){_0x4597c3=_0x4597c3-0x0;var _0x4cc619=_0x153f[_0x4597c3];return _0x4cc619;};'use strict';var attributes=require(_0xf153('0x0'));module[_0xf153('0x1')]=function(_0xde7eae){return _0xde7eae[_0xf153('0x2')](_0xf153('0x3'),attributes,{'tableName':_0xf153('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b85fc){if(!_0x3b85fc['clientSideLoggingEnabled'])_0x3b85fc[_0xf153('0x5')]=null;else if(_0x3b85fc['clientSideLoggingEnabledSince']===null)_0x3b85fc[_0xf153('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 1d1e313..6a82e01 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f31=['user-setting:update','emit','user-setting:update:user-','UserId','register','length','user-setting:','save','remove','update'];(function(_0x1d7a9,_0x16b2b7){var _0xc73c49=function(_0x3ed158){while(--_0x3ed158){_0x1d7a9['push'](_0x1d7a9['shift']());}};_0xc73c49(++_0x16b2b7);}(_0x7f31,0x13d));var _0x17f3=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x7f31[_0x59ae8f];return _0x3900b5;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x17f3('0x0'),_0x17f3('0x1'),_0x17f3('0x2')];function createListener(_0xf0f7c2,_0x1d590e){return function(_0x155acc){_0x1d590e['emit'](_0xf0f7c2,_0x155acc);if(_0xf0f7c2===_0x17f3('0x3')){_0x1d590e[_0x17f3('0x4')](_0x17f3('0x5')+_0x155acc[_0x17f3('0x6')],_0x155acc);}};}exports[_0x17f3('0x7')]=function(_0x417611){for(var _0x3d9165=0x0,_0x4ec639=events[_0x17f3('0x8')];_0x3d9165<_0x4ec639;_0x3d9165++){var _0x2c15dd=events[_0x3d9165];var _0x50b54e=createListener(_0x17f3('0x9')+_0x2c15dd,_0x417611);UserSettingEvents['on'](_0x2c15dd,_0x50b54e);}}; \ No newline at end of file +var _0x98d6=['save','remove','update','emit','user-setting:update:user-','length','user-setting:','./user-setting.events'];(function(_0x593ce4,_0x44a5a2){var _0x111454=function(_0x2b4a2a){while(--_0x2b4a2a){_0x593ce4['push'](_0x593ce4['shift']());}};_0x111454(++_0x44a5a2);}(_0x98d6,0x147));var _0x698d=function(_0x212ce0,_0xf73fc3){_0x212ce0=_0x212ce0-0x0;var _0x32b93f=_0x98d6[_0x212ce0];return _0x32b93f;};'use strict';var UserSettingEvents=require(_0x698d('0x0'));var events=[_0x698d('0x1'),_0x698d('0x2'),_0x698d('0x3')];function createListener(_0x40f21b,_0x43646c){return function(_0x16805f){_0x43646c[_0x698d('0x4')](_0x40f21b,_0x16805f);if(_0x40f21b==='user-setting:update'){_0x43646c[_0x698d('0x4')](_0x698d('0x5')+_0x16805f['UserId'],_0x16805f);}};}exports['register']=function(_0x500ae7){for(var _0x422f33=0x0,_0x4af52f=events[_0x698d('0x6')];_0x422f33<_0x4af52f;_0x422f33++){var _0x143ac9=events[_0x422f33];var _0x264964=createListener(_0x698d('0x7')+_0x143ac9,_0x500ae7);UserSettingEvents['on'](_0x143ac9,_0x264964);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2e2ae78..fa3d4c8 100644 --- a/server/api/user/index.js +++ b/server/api/user/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4b9=['messengerSoundNotification','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','diskStorage','join','server/files/images/','originalname','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addWhatsappAccounts','createApiKey','update','put','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey'];(function(_0x433195,_0x58b789){var _0x30a4c4=function(_0x5f6f90){while(--_0x5f6f90){_0x433195['push'](_0x433195['shift']());}};_0x30a4c4(++_0x58b789);}(_0xf4b9,0x6d));var _0x9f4b=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf4b9[_0x101e7b];return _0x4995c0;};'use strict';var multer=require(_0x9f4b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9f4b('0x1'));var express=require(_0x9f4b('0x2'));var router=express[_0x9f4b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9f4b('0x4'));var config=require(_0x9f4b('0x5'));var controller=require(_0x9f4b('0x6'));router[_0x9f4b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9f4b('0x7')](_0x9f4b('0x8'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0xa')]);router[_0x9f4b('0x7')]('/whoami',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0xb')]);router[_0x9f4b('0x7')]('/presence',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0xc')]);router[_0x9f4b('0x7')](_0x9f4b('0xd'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0xe')]);router['get'](_0x9f4b('0xf'),controller[_0x9f4b('0x10')]);router[_0x9f4b('0x7')](_0x9f4b('0x11'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x12')]);router['get'](_0x9f4b('0x13'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x14')]);router[_0x9f4b('0x7')](_0x9f4b('0x15'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x16')]);router[_0x9f4b('0x7')](_0x9f4b('0x17'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x18')]);router[_0x9f4b('0x7')](_0x9f4b('0x19'),auth['isAuthenticated'](),controller[_0x9f4b('0x1a')]);router['get']('/:id/recordings',auth[_0x9f4b('0x9')](),controller['getRecordings']);router[_0x9f4b('0x7')]('/:id/screen_recordings',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x1b')]);router[_0x9f4b('0x7')](_0x9f4b('0x1c'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x1d')]);router['get']('/:id/openchannel/interactions',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x1e')]);router[_0x9f4b('0x7')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x9f4b('0x1f')]);router[_0x9f4b('0x7')](_0x9f4b('0x20'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x21')]);router[_0x9f4b('0x7')](_0x9f4b('0x22'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x9f4b('0x7')](_0x9f4b('0x23'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x24')]);router[_0x9f4b('0x7')](_0x9f4b('0x25'),auth['isAuthenticated'](),controller['getTeams']);router[_0x9f4b('0x7')](_0x9f4b('0x26'),auth[_0x9f4b('0x9')](),controller['getLists']);router[_0x9f4b('0x7')](_0x9f4b('0x27'),auth['isAuthenticated'](),controller[_0x9f4b('0x28')]);router[_0x9f4b('0x7')](_0x9f4b('0x29'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x2a')]);router[_0x9f4b('0x7')](_0x9f4b('0x2b'),auth['isAuthenticated'](),controller[_0x9f4b('0x2c')]);router[_0x9f4b('0x7')](_0x9f4b('0x2d'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x2e')]);router[_0x9f4b('0x7')]('/:id/openchannel_accounts',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x2f')]);router[_0x9f4b('0x7')](_0x9f4b('0x30'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x31')]);router[_0x9f4b('0x7')]('/:id/chat_websites',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x32')]);router['get'](_0x9f4b('0x33'),auth[_0x9f4b('0x9')](),controller['getWhatsappAccounts']);router['get'](_0x9f4b('0x34'),auth['isAuthenticated'](),controller[_0x9f4b('0x35')]);router['get'](_0x9f4b('0x36'),auth['isAuthenticated'](),controller[_0x9f4b('0x37')]);router['post'](_0x9f4b('0x13'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x38')]);router[_0x9f4b('0x39')]('/',auth['isAuthenticated'](),controller[_0x9f4b('0x3a')]);router['post'](_0x9f4b('0x3b'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x3c')]);router['post']('/:id/queues',auth[_0x9f4b('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9f4b('0x3d')]({'destination':function(_0x19aaef,_0x2ab4f6,_0x41e376){_0x41e376(null,path[_0x9f4b('0x3e')](config['root'],_0x9f4b('0x3f')));},'filename':function(_0xfa8132,_0x366806,_0x956833){_0x956833(null,util['format']('%s-%s',Date['now'](),_0x366806[_0x9f4b('0x40')]));}})});router[_0x9f4b('0x39')]('/:id/avatar',upload['single']('file'),controller[_0x9f4b('0x41')]);router[_0x9f4b('0x39')](_0x9f4b('0x42'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x43')]);router[_0x9f4b('0x39')](_0x9f4b('0x44'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x45')]);router[_0x9f4b('0x39')]('/:id/pause',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x46')]);router['post'](_0x9f4b('0x47'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x48')]);router[_0x9f4b('0x39')](_0x9f4b('0x25'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x49')]);router[_0x9f4b('0x39')](_0x9f4b('0x4a'),auth[_0x9f4b('0x9')](),controller['addChatInteractions']);router[_0x9f4b('0x39')](_0x9f4b('0x4b'),auth[_0x9f4b('0x9')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x9f4b('0x9')](),controller['addFaxInteractions']);router[_0x9f4b('0x39')](_0x9f4b('0x4c'),auth['isAuthenticated'](),controller['addSmsInteractions']);router['post'](_0x9f4b('0x4d'),auth[_0x9f4b('0x9')](),controller['addOpenchannelInteractions']);router[_0x9f4b('0x39')](_0x9f4b('0x4e'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x4f')]);router[_0x9f4b('0x39')](_0x9f4b('0x2b'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x50')]);router['post']('/:id/mail_accounts',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x51')]);router[_0x9f4b('0x39')]('/:id/openchannel_accounts',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x52')]);router[_0x9f4b('0x39')](_0x9f4b('0x30'),auth[_0x9f4b('0x9')](),controller['addSmsAccounts']);router[_0x9f4b('0x39')](_0x9f4b('0x53'),auth[_0x9f4b('0x9')](),controller['addChatWebsites']);router[_0x9f4b('0x39')](_0x9f4b('0x33'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x54')]);router[_0x9f4b('0x39')](_0x9f4b('0x36'),auth['isAuthenticated'](),controller[_0x9f4b('0x55')]);router['put'](_0x9f4b('0xd'),auth['isAuthenticated'](),controller[_0x9f4b('0x56')]);router[_0x9f4b('0x57')](_0x9f4b('0x58'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x59')]);router[_0x9f4b('0x5a')](_0x9f4b('0x15'),auth[_0x9f4b('0x9')](),controller['removeQueues']);router[_0x9f4b('0x5a')](_0x9f4b('0x25'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x5b')]);router[_0x9f4b('0x5a')](_0x9f4b('0xd'),auth['isAuthenticated'](),controller[_0x9f4b('0x5c')]);router[_0x9f4b('0x5a')](_0x9f4b('0x4a'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x5d')]);router[_0x9f4b('0x5a')](_0x9f4b('0x4b'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x5e')]);router[_0x9f4b('0x5a')]('/:id/fax_interactions',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x5f')]);router[_0x9f4b('0x5a')](_0x9f4b('0x4c'),auth['isAuthenticated'](),controller[_0x9f4b('0x60')]);router['delete'](_0x9f4b('0x4d'),auth[_0x9f4b('0x9')](),controller['removeOpenchannelInteractions']);router[_0x9f4b('0x5a')](_0x9f4b('0x4e'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x61')]);router[_0x9f4b('0x5a')](_0x9f4b('0x2b'),auth[_0x9f4b('0x9')](),controller['removeFaxAccounts']);router[_0x9f4b('0x5a')](_0x9f4b('0x2d'),auth['isAuthenticated'](),controller[_0x9f4b('0x62')]);router[_0x9f4b('0x5a')](_0x9f4b('0x63'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x64')]);router[_0x9f4b('0x5a')](_0x9f4b('0x30'),auth['isAuthenticated'](),controller[_0x9f4b('0x65')]);router[_0x9f4b('0x5a')](_0x9f4b('0x53'),auth['isAuthenticated'](),controller[_0x9f4b('0x66')]);router[_0x9f4b('0x5a')]('/:id/whatsapp_accounts',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x67')]);router[_0x9f4b('0x5a')](_0x9f4b('0x36'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x68')]);router['post']('/:id/messengerSoundNotification',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x69')]);module[_0x9f4b('0x6a')]=router; \ No newline at end of file +var _0xd2d2=['/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addWhatsappAccounts','/:id/api_key','/:id','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/whoami','whoami','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','create','/create_many','bulkCreate','addQueues','join','server/files/images/','format','now','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions'];(function(_0x2f10e3,_0x5018fe){var _0x37264=function(_0x6e2ce1){while(--_0x6e2ce1){_0x2f10e3['push'](_0x2f10e3['shift']());}};_0x37264(++_0x5018fe);}(_0xd2d2,0x101));var _0x2d2d=function(_0x1a7553,_0x533217){_0x1a7553=_0x1a7553-0x0;var _0xfe9834=_0xd2d2[_0x1a7553];return _0xfe9834;};'use strict';var multer=require('multer');var util=require(_0x2d2d('0x0'));var path=require(_0x2d2d('0x1'));var timeout=require('connect-timeout');var express=require(_0x2d2d('0x2'));var router=express[_0x2d2d('0x3')]();var fs_extra=require(_0x2d2d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2d2d('0x5'));var config=require(_0x2d2d('0x6'));var controller=require('./user.controller');router[_0x2d2d('0x7')]('/',auth['isAuthenticated'](),controller[_0x2d2d('0x8')]);router[_0x2d2d('0x7')]('/describe',auth[_0x2d2d('0x9')](),controller['describe']);router[_0x2d2d('0x7')](_0x2d2d('0xa'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0xb')]);router['get']('/presence',auth['isAuthenticated'](),controller['getPresence']);router[_0x2d2d('0x7')]('/:id',auth[_0x2d2d('0x9')](),controller['show']);router[_0x2d2d('0x7')](_0x2d2d('0xc'),controller[_0x2d2d('0xd')]);router['get']('/:id/open_tabs',auth[_0x2d2d('0x9')](),controller[_0x2d2d('0xe')]);router[_0x2d2d('0x7')](_0x2d2d('0xf'),auth['isAuthenticated'](),controller[_0x2d2d('0x10')]);router['get'](_0x2d2d('0x11'),auth['isAuthenticated'](),controller[_0x2d2d('0x12')]);router[_0x2d2d('0x7')](_0x2d2d('0x13'),auth[_0x2d2d('0x9')](),controller['getVoiceQueuesRt']);router[_0x2d2d('0x7')](_0x2d2d('0x14'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x15')]);router[_0x2d2d('0x7')](_0x2d2d('0x16'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x17')]);router[_0x2d2d('0x7')](_0x2d2d('0x18'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x2d2d('0x7')](_0x2d2d('0x19'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x2d2d('0x7')](_0x2d2d('0x1a'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x1b')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x2d2d('0x1c')]);router['get'](_0x2d2d('0x1d'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x1e')]);router[_0x2d2d('0x7')](_0x2d2d('0x1f'),auth[_0x2d2d('0x9')](),controller['getFaxInteractions']);router[_0x2d2d('0x7')](_0x2d2d('0x20'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x21')]);router[_0x2d2d('0x7')](_0x2d2d('0x22'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x23')]);router['get'](_0x2d2d('0x24'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x25')]);router[_0x2d2d('0x7')](_0x2d2d('0x26'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x27')]);router['get'](_0x2d2d('0x28'),auth['isAuthenticated'](),controller[_0x2d2d('0x29')]);router['get'](_0x2d2d('0x2a'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x2b')]);router[_0x2d2d('0x7')]('/:id/mail_accounts',auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x2c')]);router['get'](_0x2d2d('0x2d'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x2e')]);router[_0x2d2d('0x7')](_0x2d2d('0x2f'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x30')]);router[_0x2d2d('0x7')](_0x2d2d('0x31'),auth[_0x2d2d('0x9')](),controller['getChatWebsites']);router[_0x2d2d('0x7')](_0x2d2d('0x32'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x33')]);router[_0x2d2d('0x7')](_0x2d2d('0x34'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x35')]);router[_0x2d2d('0x7')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x2d2d('0x36')]);router[_0x2d2d('0x37')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x2d2d('0x37')]('/',auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x38')]);router[_0x2d2d('0x37')](_0x2d2d('0x39'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x3a')]);router['post'](_0x2d2d('0x11'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x3b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ca1f5,_0x2acf93,_0x1bdd9f){_0x1bdd9f(null,path[_0x2d2d('0x3c')](config['root'],_0x2d2d('0x3d')));},'filename':function(_0x154a8d,_0x2368ae,_0x969768){_0x969768(null,util[_0x2d2d('0x3e')]('%s-%s',Date[_0x2d2d('0x3f')](),_0x2368ae[_0x2d2d('0x40')]));}})});router[_0x2d2d('0x37')]('/:id/avatar',upload[_0x2d2d('0x41')]('file'),controller[_0x2d2d('0x42')]);router[_0x2d2d('0x37')](_0x2d2d('0x43'),auth['isAuthenticated'](),controller[_0x2d2d('0x44')]);router[_0x2d2d('0x37')](_0x2d2d('0x45'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x46')]);router[_0x2d2d('0x37')](_0x2d2d('0x47'),auth[_0x2d2d('0x9')](),controller['pause']);router[_0x2d2d('0x37')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x2d2d('0x48')]);router['post'](_0x2d2d('0x22'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x49')]);router[_0x2d2d('0x37')](_0x2d2d('0x4a'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x4b')]);router[_0x2d2d('0x37')](_0x2d2d('0x4c'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x4d')]);router[_0x2d2d('0x37')](_0x2d2d('0x4e'),auth['isAuthenticated'](),controller[_0x2d2d('0x4f')]);router[_0x2d2d('0x37')](_0x2d2d('0x50'),auth['isAuthenticated'](),controller[_0x2d2d('0x51')]);router[_0x2d2d('0x37')]('/:id/openchannel_interactions',auth[_0x2d2d('0x9')](),controller['addOpenchannelInteractions']);router['post']('/:id/whatsapp_interactions',auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x52')]);router['post'](_0x2d2d('0x2a'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x53')]);router[_0x2d2d('0x37')](_0x2d2d('0x54'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x55')]);router[_0x2d2d('0x37')](_0x2d2d('0x2d'),auth[_0x2d2d('0x9')](),controller['addOpenchannelAccounts']);router['post'](_0x2d2d('0x2f'),auth[_0x2d2d('0x9')](),controller['addSmsAccounts']);router[_0x2d2d('0x37')]('/:id/chat_websites',auth[_0x2d2d('0x9')](),controller['addChatWebsites']);router[_0x2d2d('0x37')](_0x2d2d('0x32'),auth['isAuthenticated'](),controller[_0x2d2d('0x56')]);router[_0x2d2d('0x37')](_0x2d2d('0x57'),auth[_0x2d2d('0x9')](),controller['createApiKey']);router['put'](_0x2d2d('0x58'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x59')]);router[_0x2d2d('0x5a')](_0x2d2d('0x5b'),auth['isAuthenticated'](),controller[_0x2d2d('0x5c')]);router[_0x2d2d('0x5d')](_0x2d2d('0x11'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x5e')]);router[_0x2d2d('0x5d')](_0x2d2d('0x22'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x5f')]);router[_0x2d2d('0x5d')]('/:id',auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x60')]);router[_0x2d2d('0x5d')](_0x2d2d('0x4a'),auth['isAuthenticated'](),controller[_0x2d2d('0x61')]);router[_0x2d2d('0x5d')](_0x2d2d('0x4c'),auth['isAuthenticated'](),controller[_0x2d2d('0x62')]);router[_0x2d2d('0x5d')](_0x2d2d('0x4e'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x63')]);router['delete'](_0x2d2d('0x50'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x64')]);router['delete'](_0x2d2d('0x65'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x66')]);router[_0x2d2d('0x5d')](_0x2d2d('0x67'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x2d2d('0x5d')](_0x2d2d('0x2a'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x68')]);router['delete'](_0x2d2d('0x54'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x69')]);router[_0x2d2d('0x5d')]('/:id/openchannel_accounts',auth[_0x2d2d('0x9')](),controller['removeOpenchannelAccounts']);router[_0x2d2d('0x5d')](_0x2d2d('0x2f'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x6a')]);router[_0x2d2d('0x5d')]('/:id/chat_websites',auth[_0x2d2d('0x9')](),controller['removeChatWebsites']);router[_0x2d2d('0x5d')](_0x2d2d('0x32'),auth[_0x2d2d('0x9')](),controller['removeWhatsappAccounts']);router['delete'](_0x2d2d('0x57'),auth['isAuthenticated'](),controller[_0x2d2d('0x6b')]);router[_0x2d2d('0x37')](_0x2d2d('0x6c'),auth[_0x2d2d('0x9')](),controller[_0x2d2d('0x6d')]);module[_0x2d2d('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 4c16123..41f1ed7 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7535=['blockedAt','loginAttempts','UNSIGNED','moment','util','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','getDataValue','internal','email','ENUM','admin','user','INTEGER','\x22%s\x22\x20<%s>','DATE','BOOLEAN','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','get','isArray','wss','udp','avpf','force_avp','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','icesupport','dtlsverify','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked'];(function(_0x13affe,_0x1ceaf7){var _0x3a05a4=function(_0x126814){while(--_0x126814){_0x13affe['push'](_0x13affe['shift']());}};_0x3a05a4(++_0x1ceaf7);}(_0x7535,0x10b));var _0x5753=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7535[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5753('0x0'));var util=require(_0x5753('0x1'));var _=require('lodash');module[_0x5753('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5753('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5b3320){this[_0x5753('0x4')](_0x5753('0x3'),_0x5b3320);this[_0x5753('0x4')]('defaultuser',_0x5b3320);},'comment':_0x5753('0x5')},'fullname':{'type':Sequelize[_0x5753('0x6')],'allowNull':![],'set':function(_0x5788c0){this[_0x5753('0x4')](_0x5753('0x7'),_0x5788c0);this['setDataValue'](_0x5753('0x8'),util[_0x5753('0x9')]('\x22%s\x22\x20<%s>',_0x5788c0,this[_0x5753('0xa')](_0x5753('0xb'))));}},'alias':{'type':Sequelize[_0x5753('0x6')]},'email':{'type':Sequelize[_0x5753('0x6')],'allowNull':![],'unique':_0x5753('0xc'),'validate':{'isEmail':!![]},'set':function(_0x17d30f){if(_0x17d30f){this[_0x5753('0x4')](_0x5753('0xc'),_0x17d30f['toLowerCase']());}}},'role':{'type':Sequelize[_0x5753('0xd')](_0x5753('0xe'),_0x5753('0xf'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x5753('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':![],'unique':_0x5753('0xb'),'set':function(_0x25a98e){this[_0x5753('0x4')]('internal',_0x25a98e);this['setDataValue']('accountcode',_0x25a98e);this['setDataValue'](_0x5753('0x8'),util[_0x5753('0x9')](_0x5753('0x11'),this['getDataValue'](_0x5753('0x7')),_0x25a98e));}},'salt':{'type':Sequelize[_0x5753('0x6')]},'phone':{'type':Sequelize[_0x5753('0x6')]},'mobile':{'type':Sequelize[_0x5753('0x6')]},'address':{'type':Sequelize[_0x5753('0x6')]},'zipcode':{'type':Sequelize[_0x5753('0x6')]},'userpic':{'type':Sequelize[_0x5753('0x6')]},'city':{'type':Sequelize[_0x5753('0x6')]},'country':{'type':Sequelize[_0x5753('0x6')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x5753('0x12')]},'voicePause':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5753('0x6')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5753('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5753('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![],'defaultValue':_0x5753('0x14')},'ipaddr':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'port':{'type':Sequelize[_0x5753('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x5753('0x15'),'user',_0x5753('0x16')),'allowNull':!![],'defaultValue':_0x5753('0x15')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5753('0x17')},'callingpres':{'type':Sequelize['ENUM'](_0x5753('0x18'),_0x5753('0x19'),_0x5753('0x1a'),'ALLOWED','PROHIB_NOT_SCREENED',_0x5753('0x1b'),_0x5753('0x1c'),_0x5753('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![],'defaultValue':'udp','set':function(_0x198394){this[_0x5753('0x4')](_0x5753('0x1e'),_0x198394?_0x198394[_0x5753('0x1f')](','):null);},'get':function(){return this[_0x5753('0xa')](_0x5753('0x1e'))?this[_0x5753('0xa')](_0x5753('0x1e'))[_0x5753('0x20')](','):null;},'comment':_0x5753('0x21')},'dtmfmode':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x22'),'info','shortinfo',_0x5753('0x23'),_0x5753('0x24')),'allowNull':!![],'defaultValue':_0x5753('0x22')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x5753('0x25'),_0x5753('0x26'),_0x5753('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5753('0x29'),'set':function(_0x52dcc6){this['setDataValue'](_0x5753('0x2a'),_0x52dcc6?_0x52dcc6[_0x5753('0x1f')](','):null);},'get':function(){return this[_0x5753('0xa')](_0x5753('0x2a'))?this[_0x5753('0xa')]('nat')[_0x5753('0x20')](','):null;},'comment':_0x5753('0x2b')},'callgroup':{'type':Sequelize[_0x5753('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x5753('0x6')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5753('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5753('0x2c')},'allow':{'type':Sequelize[_0x5753('0x6')],'allowNull':![],'defaultValue':_0x5753('0x2d'),'set':function(_0x185e7e){this['setDataValue'](_0x5753('0x2e'),_0x185e7e?_0x185e7e[_0x5753('0x1f')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x5753('0xa')](_0x5753('0x2e'))?this['getDataValue'](_0x5753('0x2e'))[_0x5753('0x20')](';'):null;},'comment':_0x5753('0x2f')},'autoframing':{'type':Sequelize[_0x5753('0xd')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x367f7d){this[_0x5753('0x4')](_0x5753('0x30'),_0x367f7d?_0x367f7d[_0x5753('0x1f')](','):null);},'get':function(){return this[_0x5753('0xa')](_0x5753('0x30'))?this['getDataValue'](_0x5753('0x30'))[_0x5753('0x20')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no',_0x5753('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':_0x5753('0x28')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x5753('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x5753('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no',_0x5753('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x5753('0x33'),_0x5753('0x34'),_0x5753('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x36'),'uas'),'allowNull':!![],'defaultValue':_0x5753('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':_0x5753('0x28')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x5753('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x5753('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5753('0xd')]('yes','no',_0x5753('0x38'),_0x5753('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5753('0xd')]('active',_0x5753('0x3a'),_0x5753('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no',_0x5753('0x25'),_0x5753('0x26'),_0x5753('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5753('0x6')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x5753('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5753('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x37043f){this[_0x5753('0x4')]('showWebBar',_0x37043f);var _0x5c1902=this[_0x5753('0x3e')]({'plain':!![]});switch(_0x37043f){case 0x0:case 0x1:var _0x59f5ef=_0x5c1902[_0x5753('0x1e')]?_[_0x5753('0x3f')](_0x5c1902[_0x5753('0x1e')])?_0x5c1902[_0x5753('0x1e')]['join']():_0x5c1902[_0x5753('0x1e')]:'udp';if(_0x59f5ef===_0x5753('0x40')){_0x59f5ef=_0x5753('0x41');}this[_0x5753('0x4')](_0x5753('0x1e'),_0x59f5ef);this[_0x5753('0x4')]('encryption','no');this['setDataValue'](_0x5753('0x42'),null);this[_0x5753('0x4')](_0x5753('0x43'),null);this['setDataValue']('icesupport',null);this[_0x5753('0x4')](_0x5753('0x44'),null);this[_0x5753('0x4')]('dtlsverify',null);this['setDataValue'](_0x5753('0x45'),null);this['setDataValue'](_0x5753('0x46'),null);this[_0x5753('0x4')]('dtlsprivatekey',null);this[_0x5753('0x4')](_0x5753('0x47'),'no');break;case 0x2:this['setDataValue']('transport',_0x5753('0x40'));this[_0x5753('0x4')]('encryption',_0x5753('0x28'));this['setDataValue']('avpf',_0x5753('0x28'));this[_0x5753('0x4')](_0x5753('0x43'),_0x5753('0x28'));this['setDataValue'](_0x5753('0x48'),_0x5753('0x28'));this[_0x5753('0x4')](_0x5753('0x44'),_0x5753('0x28'));this[_0x5753('0x4')](_0x5753('0x49'),'no');this[_0x5753('0x4')](_0x5753('0x45'),_0x5753('0x3b'));this[_0x5753('0x4')](_0x5753('0x46'),_0x5c1902[_0x5753('0x46')]||_0x5753('0x4a'));this[_0x5753('0x4')](_0x5753('0x4b'),_0x5c1902[_0x5753('0x4b')]||_0x5753('0x4c'));this['setDataValue']('rtcp_mux',_0x5753('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x5753('0x3d')],'set':function(_0x1a60f4){this['setDataValue'](_0x5753('0x4d'),_0x1a60f4?_0x1a60f4['join'](','):[]);},'get':function(){return this[_0x5753('0xa')]('permissions')?_[_0x5753('0x4e')](this[_0x5753('0xa')](_0x5753('0x4d'))[_0x5753('0x20')](','),function(_0x194a5d){return parseInt(_0x194a5d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x5753('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x5753('0x6')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5753('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5753('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x5753('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x5753('0x4f'))?this['getDataValue'](_0x5753('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x5753('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![],'set':function(_0x5ed30f){if(typeof _0x5ed30f===_0x5753('0x50')){var _0x5d2fc5=_0x5ed30f==='1'?!![]:_0x5ed30f==='0'?![]:_0x5ed30f===_0x5753('0x51')?!![]:_0x5ed30f===_0x5753('0x52')?![]:![];this[_0x5753('0x4')](_0x5753('0x53'),_0x5d2fc5);}else{this[_0x5753('0x4')](_0x5753('0x53'),_0x5ed30f);}}},'blocked':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![],'set':function(_0x158b66){this['setDataValue'](_0x5753('0x54'),_0x158b66);if(_0x158b66===!![]){this[_0x5753('0x4')](_0x5753('0x55'),moment());this['setDataValue'](_0x5753('0x56'),0x0);}else{this['setDataValue'](_0x5753('0x55'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5753('0x10')](0x5)[_0x5753('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]}}; \ No newline at end of file +var _0xb064=['update','TEXT','showWebBar','isArray','wss','encryption','force_avp','icesupport','dtlscertfile','dtlsprivatekey','avpf','dtlsenable','dtlsverify','/etc/pki/tls/certs/motion.crt','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','email','admin','user','agent','telephone','local','INTEGER','internal','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','dynamic','ENUM','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','yes','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','actpass'];(function(_0x2ef822,_0x4ad97a){var _0x36dfa0=function(_0x3f215d){while(--_0x3f215d){_0x2ef822['push'](_0x2ef822['shift']());}};_0x36dfa0(++_0x4ad97a);}(_0xb064,0x1c0));var _0x4b06=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xb064[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0x4b06('0x0'));var moment=require(_0x4b06('0x1'));var util=require(_0x4b06('0x2'));var _=require('lodash');module[_0x4b06('0x3')]={'name':{'type':Sequelize[_0x4b06('0x4')],'allowNull':![],'unique':_0x4b06('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x595d08){this[_0x4b06('0x6')](_0x4b06('0x5'),_0x595d08);this[_0x4b06('0x6')](_0x4b06('0x7'),_0x595d08);},'comment':_0x4b06('0x8')},'fullname':{'type':Sequelize[_0x4b06('0x4')],'allowNull':![],'set':function(_0x7e039d){this[_0x4b06('0x6')](_0x4b06('0x9'),_0x7e039d);this['setDataValue'](_0x4b06('0xa'),util[_0x4b06('0xb')]('\x22%s\x22\x20<%s>',_0x7e039d,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0x4b06('0x4')]},'email':{'type':Sequelize[_0x4b06('0x4')],'allowNull':![],'unique':_0x4b06('0xc'),'validate':{'isEmail':!![]},'set':function(_0x1e9d9c){if(_0x1e9d9c){this['setDataValue']('email',_0x1e9d9c['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x4b06('0xd'),_0x4b06('0xe'),_0x4b06('0xf'),_0x4b06('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x4b06('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x4b06('0x11')},'internal':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x15646d){this[_0x4b06('0x6')](_0x4b06('0x13'),_0x15646d);this[_0x4b06('0x6')](_0x4b06('0x14'),_0x15646d);this[_0x4b06('0x6')](_0x4b06('0xa'),util[_0x4b06('0xb')](_0x4b06('0x15'),this[_0x4b06('0x16')](_0x4b06('0x9')),_0x15646d));}},'salt':{'type':Sequelize[_0x4b06('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x4b06('0x4')]},'address':{'type':Sequelize[_0x4b06('0x4')]},'zipcode':{'type':Sequelize[_0x4b06('0x4')]},'userpic':{'type':Sequelize[_0x4b06('0x4')]},'city':{'type':Sequelize[_0x4b06('0x4')]},'country':{'type':Sequelize[_0x4b06('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x4b06('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x4b06('0x18')]},'chatCapacity':{'type':Sequelize[_0x4b06('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x4b06('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x4b06('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x4b06('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4b06('0x19')},'ipaddr':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x1b'),'user',_0x4b06('0x1c')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x1d'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x4b06('0x1e'),_0x4b06('0x1f'),_0x4b06('0x20'),_0x4b06('0x21'),_0x4b06('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4b06('0x23'),'set':function(_0xb12b9d){this[_0x4b06('0x6')](_0x4b06('0x24'),_0xb12b9d?_0xb12b9d[_0x4b06('0x25')](','):null);},'get':function(){return this[_0x4b06('0x16')]('transport')?this[_0x4b06('0x16')](_0x4b06('0x24'))[_0x4b06('0x26')](','):null;},'comment':_0x4b06('0x27')},'dtmfmode':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x28'),_0x4b06('0x29'),_0x4b06('0x2a'),_0x4b06('0x2b'),_0x4b06('0x2c')),'allowNull':!![],'defaultValue':_0x4b06('0x28')},'directmedia':{'type':Sequelize[_0x4b06('0x1a')]('yes','no',_0x4b06('0x2d'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x257b93){this[_0x4b06('0x6')](_0x4b06('0x2f'),_0x257b93?_0x257b93['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x4b06('0x16')](_0x4b06('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x4b06('0x4')]},'namedcallgroup':{'type':Sequelize[_0x4b06('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4b06('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4b06('0x4')]},'disallow':{'type':Sequelize[_0x4b06('0x4')],'allowNull':![],'defaultValue':_0x4b06('0x30')},'allow':{'type':Sequelize[_0x4b06('0x4')],'allowNull':![],'defaultValue':_0x4b06('0x31'),'set':function(_0x247c0e){this[_0x4b06('0x6')](_0x4b06('0x32'),_0x247c0e?_0x247c0e[_0x4b06('0x25')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x4b06('0x16')](_0x4b06('0x32'))?this['getDataValue'](_0x4b06('0x32'))[_0x4b06('0x26')](';'):null;},'comment':_0x4b06('0x33')},'autoframing':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x2213ac){this[_0x4b06('0x6')](_0x4b06('0x34'),_0x2213ac?_0x2213ac[_0x4b06('0x25')](','):null);},'get':function(){return this[_0x4b06('0x16')]('insecure')?this['getDataValue'](_0x4b06('0x34'))['split'](','):null;},'comment':_0x4b06('0x35')},'trustrpid':{'type':Sequelize[_0x4b06('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4b06('0x1a')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x4b06('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![],'defaultValue':_0x4b06('0x36')},'amaflags':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x4b06('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no',_0x4b06('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x4b06('0x1a')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4b06('0x1a')]('accept',_0x4b06('0x38'),_0x4b06('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x3a'),_0x4b06('0x3b')),'allowNull':!![],'defaultValue':_0x4b06('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x4b06('0x2e')},'keepalive':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x4b06('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x4b06('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x4b06('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x4b06('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x4b06('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4b06('0x1a')]('active','passive',_0x4b06('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x4b06('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x4b06('0x1a')](_0x4b06('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x4b06('0x1a')]('yes','no','nonat',_0x4b06('0x3e'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4b06('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x4b06('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x4b06('0x3f')]},'showWebBar':{'type':Sequelize[_0x4b06('0x12')],'defaultValue':0x0,'set':function(_0xbd5cda){this[_0x4b06('0x6')](_0x4b06('0x40'),_0xbd5cda);var _0x5f3993=this['get']({'plain':!![]});switch(_0xbd5cda){case 0x0:case 0x1:var _0x8784b9=_0x5f3993['transport']?_[_0x4b06('0x41')](_0x5f3993[_0x4b06('0x24')])?_0x5f3993[_0x4b06('0x24')][_0x4b06('0x25')]():_0x5f3993[_0x4b06('0x24')]:_0x4b06('0x23');if(_0x8784b9===_0x4b06('0x42')){_0x8784b9=_0x4b06('0x23');}this[_0x4b06('0x6')](_0x4b06('0x24'),_0x8784b9);this['setDataValue'](_0x4b06('0x43'),'no');this[_0x4b06('0x6')]('avpf',null);this[_0x4b06('0x6')](_0x4b06('0x44'),null);this[_0x4b06('0x6')](_0x4b06('0x45'),null);this[_0x4b06('0x6')]('dtlsenable',null);this[_0x4b06('0x6')]('dtlsverify',null);this[_0x4b06('0x6')]('dtlssetup',null);this['setDataValue'](_0x4b06('0x46'),null);this[_0x4b06('0x6')](_0x4b06('0x47'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x4b06('0x24'),_0x4b06('0x42'));this[_0x4b06('0x6')]('encryption',_0x4b06('0x2e'));this['setDataValue'](_0x4b06('0x48'),_0x4b06('0x2e'));this[_0x4b06('0x6')](_0x4b06('0x44'),'yes');this['setDataValue'](_0x4b06('0x45'),_0x4b06('0x2e'));this[_0x4b06('0x6')](_0x4b06('0x49'),_0x4b06('0x2e'));this[_0x4b06('0x6')](_0x4b06('0x4a'),'no');this[_0x4b06('0x6')]('dtlssetup',_0x4b06('0x3d'));this[_0x4b06('0x6')]('dtlscertfile',_0x5f3993['dtlscertfile']||_0x4b06('0x4b'));this[_0x4b06('0x6')](_0x4b06('0x47'),_0x5f3993[_0x4b06('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue']('rtcp_mux',_0x4b06('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0x4b06('0x3f')],'set':function(_0x77a6c7){this[_0x4b06('0x6')](_0x4b06('0x4c'),_0x77a6c7?_0x77a6c7['join'](','):[]);},'get':function(){return this[_0x4b06('0x16')](_0x4b06('0x4c'))?_[_0x4b06('0x4d')](this[_0x4b06('0x16')]('permissions')[_0x4b06('0x26')](','),function(_0x2d00f7){return parseInt(_0x2d00f7,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x4b06('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x4b06('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x4b06('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x4b06('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4b06('0x1a')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x4b06('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4b06('0x16')](_0x4b06('0x4e'))?this['getDataValue'](_0x4b06('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x4b06('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x4b06('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5284ae){if(typeof _0x5284ae===_0x4b06('0x4f')){var _0x2481f6=_0x5284ae==='1'?!![]:_0x5284ae==='0'?![]:_0x5284ae===_0x4b06('0x50')?!![]:_0x5284ae===_0x4b06('0x51')?![]:![];this[_0x4b06('0x6')]('screenrecording',_0x2481f6);}else{this['setDataValue'](_0x4b06('0x52'),_0x5284ae);}}},'blocked':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![],'set':function(_0x12a87c){this[_0x4b06('0x6')](_0x4b06('0x53'),_0x12a87c);if(_0x12a87c===!![]){this[_0x4b06('0x6')](_0x4b06('0x54'),moment());this[_0x4b06('0x6')]('loginAttempts',0x0);}else{this[_0x4b06('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x4b06('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x4b06('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x4b06('0x12')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x4b06('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x4b06('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x4b06('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 125e4b9..cb6f3e5 100644 --- a/server/api/user/user.controller.js +++ b/server/api/user/user.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0393=['removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','Contact','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','idle','unknown','teams','queues','flatten','toString','lower','asc','desc','substring','uniqBy','getRealtimeAgents','offline','voiceStatus','busy','slice','toUpperCase','QueryTypes','select','ui.','field','ui.createdAt','user_has_','OpenTabs','messengerSoundNotification','enabled','moment','path','lodash','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','./user.socket','defaults','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','update','role','emit','userNotification:recalc:','get','admin','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','find','UserProfileResource','then','stack','name','send','User','rawAttributes','key','salt','resetPasswordToken','resetPasswordExpires','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','includes','attributes','findAll','rows','openTabs','length','push','dataValues','sms','fax','openchannel','whatsapp','all','catch','params','merge','options','chat','mail','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','password','max','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','SELECT','isNil','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','102','113','110','104','106','107','109','100','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','voicePause','UserVoiceQueueRt','removeQueues','remove','isArray','Queue:remove','destroy','addAvatar','userpic','file','filename','getAvatar','root','download','existsSync','join','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','List','Tag','Tags','tag','getQueues','model','keys','intersection','fields','order','sort','filters','pick','Queue','hasOwnProperty','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','PAUSE','LOGININPAUSE','logout','pause','getChannels','type','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','unpause','getTeams','Team','resolve','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','addAgent','Voice','upsert','UserVoicePrefix','VoicePrefixId','getDataValue','removeTeams','transaction','removeAgent','TeamVoicePrefix','getLists','CmList','getAgents','values','CmHopper','addChatInteractions','spread','user_has_chat_interactions:save'];(function(_0x5d311c,_0x416264){var _0x287cdb=function(_0x4d21c0){while(--_0x4d21c0){_0x5d311c['push'](_0x5d311c['shift']());}};_0x287cdb(++_0x416264);}(_0x0393,0x1ec));var _0x3039=function(_0x270988,_0x15e743){_0x270988=_0x270988-0x0;var _0x2672c4=_0x0393[_0x270988];return _0x2672c4;};'use strict';var moment=require(_0x3039('0x0'));var util=require('util');var path=require(_0x3039('0x1'));var fs=require('fs');var _=require(_0x3039('0x2'));var squel=require(_0x3039('0x3'));var Redis=require(_0x3039('0x4'));var authService=require(_0x3039('0x5'));var contacts=require(_0x3039('0x6'));var qs=require('../../components/parsers/qs');var rta=require(_0x3039('0x7'));var logger=require(_0x3039('0x8'))(_0x3039('0x9'));var utils=require(_0x3039('0xa'));var config=require(_0x3039('0xb'));var licenseUtil=require(_0x3039('0xc'));var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0x3039('0xd')];var APIForbiddenError=require('../../errors/api')[_0x3039('0xe')];var APIHandleError=require('../../errors/api')[_0x3039('0xf')];var db=require(_0x3039('0x10'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3039('0x11'))['register'](socket);config['redis']=_[_0x3039('0x12')](config[_0x3039('0x13')],{'host':_0x3039('0x14'),'port':0x18eb});var values;function respondWithStatusCode(_0x13e9bb,_0x168afe){_0x168afe=_0x168afe||0xcc;return function(_0x193877){if(_0x193877){return _0x13e9bb[_0x3039('0x15')](_0x168afe);}return _0x13e9bb[_0x3039('0x16')](_0x168afe)[_0x3039('0x17')]();};}function respondWithResult(_0x1f9976,_0x1c4b58){_0x1c4b58=_0x1c4b58||0xc8;return function(_0x290237){if(_0x290237){return _0x1f9976[_0x3039('0x16')](_0x1c4b58)[_0x3039('0x18')](_0x290237);}};}function respondWithFilteredResult(_0x56fc83,_0x5042a3){return function(_0x571b0f){if(_0x571b0f){var _0xc853b3=typeof _0x5042a3[_0x3039('0x19')]===_0x3039('0x1a')&&typeof _0x5042a3[_0x3039('0x1b')]===_0x3039('0x1a');var _0x575d9d=_0x571b0f['count'];var _0x93cf4f=_0xc853b3?0x0:_0x5042a3['offset'];var _0x23631f=_0xc853b3?_0x571b0f[_0x3039('0x1c')]:_0x5042a3[_0x3039('0x19')]+_0x5042a3[_0x3039('0x1b')];var _0x46ee88;if(_0x23631f>=_0x575d9d){_0x23631f=_0x575d9d;_0x46ee88=0xc8;}else{_0x46ee88=0xce;}_0x56fc83[_0x3039('0x16')](_0x46ee88);return _0x56fc83[_0x3039('0x1d')]('Content-Range',_0x93cf4f+'-'+_0x23631f+'/'+_0x575d9d)['json'](_0x571b0f);}return null;};}function saveUpdates(_0x44a489){return function(_0x477726){if(_0x477726){return _0x477726[_0x3039('0x1e')](_0x44a489)['then'](function(_0x393a4d){if(_0x393a4d[_0x3039('0x1f')]==='agent'){socket[_0x3039('0x20')](_0x3039('0x21')+_0x393a4d['id'],_0x393a4d);}return _0x393a4d;});}return null;};}function removeEntity(_0x3c26d0,_0x192c1a){return function(_0x47cda3){if(_0x47cda3){return _0x47cda3['destroy']({'transaction':_0x192c1a})['then'](function(){var _0x50854d=_0x47cda3[_0x3039('0x22')]({'plain':!![]});if(_0x50854d[_0x3039('0x1f')]===_0x3039('0x23'))return;var _0x17a0f=[{'name':_0x3039('0x24'),'value':_0x3039('0x25'),'ignore':!![]},{'name':_0x3039('0x26'),'value':_0x3039('0x27'),'ignore':![]},{'name':_0x3039('0x28'),'value':_0x3039('0x29'),'ignore':![]}];var _0x28b58f=_(_0x17a0f)[_0x3039('0x2a')](_0x3039('0x2b'))[_0x3039('0x2c')](_0x3039('0x2d'))[_0x3039('0x2d')]();if(_['includes'](_0x28b58f,_0x50854d[_0x3039('0x1f')])){return;}var _0x6508a4=_[_0x3039('0x2e')](_0x17a0f,[_0x3039('0x2d'),_0x50854d['role']])['name'];return db[_0x3039('0x2f')]['destroy']({'where':{'type':_0x6508a4,'resourceId':_0x50854d['id']},'transaction':_0x192c1a})[_0x3039('0x30')](function(){return _0x47cda3;});})[_0x3039('0x30')](function(){_0x3c26d0[_0x3039('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x346a44){return function(_0x5b3963){if(!_0x5b3963){_0x346a44['sendStatus'](0x194);}return _0x5b3963;};}function handleError(_0x201b33,_0x547f1f){_0x547f1f=_0x547f1f||0x1f4;return function(_0x1a8bcb){logger['error'](_0x1a8bcb[_0x3039('0x31')]);if(_0x1a8bcb['name']){delete _0x1a8bcb[_0x3039('0x32')];}_0x201b33[_0x3039('0x16')](_0x547f1f)[_0x3039('0x33')](_0x1a8bcb);};}function getUserAttributes(){return _(db[_0x3039('0x34')][_0x3039('0x35')])[_0x3039('0x2c')](function(_0x3e8b83){return{'name':_0x3e8b83['fieldName'],'type':_0x3e8b83['type'][_0x3039('0x36')]};})[_0x3039('0x2a')](function(_0x2837bf){return!['password',_0x3039('0x37'),'previousPasswords',_0x3039('0x38'),_0x3039('0x39'),'md5secret']['includes'](_0x2837bf['name']);})[_0x3039('0x2d')]();}exports['index']=function(_0x3a855d,_0x3309f8){var _0x5beb63={},_0x4bbc12={'count':0x0,'rows':[]};var _0x4bc5c7=getUserAttributes();_0x5beb63=qs[_0x3039('0x3a')](_0x4bc5c7,_0x3a855d);var _0x1e39b9={'where':_0x5beb63[_0x3039('0x3b')]};return db[_0x3039('0x34')][_0x3039('0x1c')](_0x1e39b9)[_0x3039('0x30')](function(_0x2de6bb){_0x4bbc12[_0x3039('0x1c')]=_0x2de6bb;if(_0x3a855d[_0x3039('0x3c')][_0x3039('0x3d')]){_0x5beb63[_0x3039('0x3e')]=[{'all':!![]}];}if(_0x3a855d[_0x3039('0x3c')][_0x3039('0x3f')]===_0x3039('0x40')){_0x5beb63['include']=[{'model':db[_0x3039('0x41')],'as':_0x3039('0x3f')}];}if(!_[_0x3039('0x42')](_0x5beb63[_0x3039('0x43')],'id')){_0x5beb63[_0x3039('0x43')]['push']('id');}return db[_0x3039('0x34')][_0x3039('0x44')](_0x5beb63);})['then'](function(_0x2a5024){_0x4bbc12[_0x3039('0x45')]=_0x2a5024;if(_0x3a855d[_0x3039('0x3c')][_0x3039('0x46')]===_0x3039('0x40')){var _0x1127cd=[];for(var _0x4666e4=0x0;_0x4666e4<_0x4bbc12[_0x3039('0x45')][_0x3039('0x47')];_0x4666e4++){_0x1127cd[_0x3039('0x48')](get_open_tabs('chat',_0x4bbc12['rows'][_0x4666e4][_0x3039('0x49')]));_0x1127cd['push'](get_open_tabs(_0x3039('0x4a'),_0x4bbc12['rows'][_0x4666e4][_0x3039('0x49')]));_0x1127cd[_0x3039('0x48')](get_open_tabs(_0x3039('0x4b'),_0x4bbc12['rows'][_0x4666e4][_0x3039('0x49')]));_0x1127cd[_0x3039('0x48')](get_open_tabs('mail',_0x4bbc12[_0x3039('0x45')][_0x4666e4][_0x3039('0x49')]));_0x1127cd[_0x3039('0x48')](get_open_tabs(_0x3039('0x4c'),_0x4bbc12[_0x3039('0x45')][_0x4666e4][_0x3039('0x49')]));_0x1127cd[_0x3039('0x48')](get_open_tabs(_0x3039('0x4d'),_0x4bbc12['rows'][_0x4666e4][_0x3039('0x49')]));}return Promise[_0x3039('0x4e')](_0x1127cd)[_0x3039('0x30')](function(){return _0x4bbc12;});}else{return _0x4bbc12;}})[_0x3039('0x30')](respondWithFilteredResult(_0x3309f8,_0x5beb63))[_0x3039('0x4f')](handleError(_0x3309f8,null));};exports['show']=function(_0xdad61d,_0x45b6e8){var _0x49e02c=getUserAttributes();_0xdad61d['query']['id']=_0xdad61d[_0x3039('0x50')]['id'];var _0x28c803=qs[_0x3039('0x3a')](_0x49e02c,_0xdad61d);if(_0xdad61d[_0x3039('0x3c')]['includeAll']){_0x28c803[_0x3039('0x3e')]=[{'all':!![]}];}if(_0xdad61d[_0x3039('0x3c')][_0x3039('0x3f')]===_0x3039('0x40')){_0x28c803[_0x3039('0x3e')]=[{'model':db[_0x3039('0x41')],'as':_0x3039('0x3f')}];}_0x28c803=_[_0x3039('0x51')]({},_0x28c803,_0xdad61d[_0x3039('0x52')]);if(!_['includes'](_0x28c803[_0x3039('0x43')],'id')){_0x28c803[_0x3039('0x43')][_0x3039('0x48')]('id');}return db['User'][_0x3039('0x2e')](_0x28c803)['then'](handleEntityNotFound(_0x45b6e8,null))['then'](function(_0x41e214){var _0x24d399=[];values=_0x41e214;if(_0xdad61d[_0x3039('0x3c')]['openTabs']===_0x3039('0x40')){_0x24d399['push'](get_open_tabs(_0x3039('0x53'),_0x41e214['dataValues']));_0x24d399['push'](get_open_tabs(_0x3039('0x4a'),_0x41e214[_0x3039('0x49')]));_0x24d399[_0x3039('0x48')](get_open_tabs(_0x3039('0x4c'),_0x41e214[_0x3039('0x49')]));_0x24d399['push'](get_open_tabs('whatsapp',_0x41e214['dataValues']));_0x24d399[_0x3039('0x48')](get_open_tabs(_0x3039('0x4b'),_0x41e214[_0x3039('0x49')]));_0x24d399['push'](get_open_tabs(_0x3039('0x54'),_0x41e214[_0x3039('0x49')]));return Promise[_0x3039('0x4e')](_0x24d399);}else{return values;}})[_0x3039('0x30')](function(){return values;})[_0x3039('0x30')](respondWithResult(_0x45b6e8,null))['catch'](handleError(_0x45b6e8,null));};exports[_0x3039('0x1e')]=function(_0x3626fe,_0x40e2c2){if(_0x3626fe[_0x3039('0x55')]['id']){delete _0x3626fe[_0x3039('0x55')]['id'];}delete _0x3626fe[_0x3039('0x55')][_0x3039('0x1f')];return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x3626fe[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x40e2c2,null))[_0x3039('0x30')](saveUpdates(_0x3626fe[_0x3039('0x55')],null))[_0x3039('0x30')](respondWithResult(_0x40e2c2,null))[_0x3039('0x4f')](handleError(_0x40e2c2,null));};exports[_0x3039('0x56')]=function(_0x498f78,_0x259efd){return db['User'][_0x3039('0x56')]()[_0x3039('0x30')](respondWithResult(_0x259efd,null))[_0x3039('0x4f')](handleError(_0x259efd,null));};exports[_0x3039('0x57')]=function(_0xffc738,_0x33aec2){return db['User'][_0x3039('0x2e')]({'where':{'id':_0xffc738[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x33aec2,null))[_0x3039('0x30')](function(_0x5911e5){if(_0x5911e5){return _0x5911e5['addContacts'](_0xffc738['body'][_0x3039('0x58')],_[_0x3039('0x59')](_0xffc738['body'],['ids','id'])||{});}})[_0x3039('0x30')](respondWithResult(_0x33aec2,null))[_0x3039('0x4f')](handleError(_0x33aec2,null));};function validateUser(_0xba3431){return new Promise(function(_0x221405,_0xbcd2a){if(_0xba3431[_0x3039('0x5a')])return _0x221405(_0xba3431);return db[_0x3039('0x5b')][_0x3039('0x5c')](0x1)[_0x3039('0x30')](function(_0x3d069f){if(_0x3d069f[_0x3039('0x5d')])authService['validatePasswordPattern'](_0xba3431[_0x3039('0x5e')]);db[_0x3039('0x34')][_0x3039('0x5f')](_0x3039('0x5a'))['then'](function(_0x5ef2e6){if(_['isNil'](_0x5ef2e6)){_0xba3431[_0x3039('0x5a')]=_0x3d069f[_0x3039('0x60')]||0x1;return;}if(_['isNil'](_0x3d069f[_0x3039('0x60')])||_0x3d069f['min_internal']===_0x5ef2e6){_0xba3431[_0x3039('0x5a')]=_0x5ef2e6+0x1;return;}if(_0x3d069f[_0x3039('0x60')]>_0x5ef2e6){_0xba3431[_0x3039('0x5a')]=_0x3d069f['min_internal'];return;}return db['sequelize'][_0x3039('0x3c')](_0x3039('0x61'),{'type':db[_0x3039('0x62')]['QueryTypes'][_0x3039('0x63')]})['then'](function(_0x58f218){if(_0x58f218&&_0x58f218[_0x3039('0x47')]){for(var _0x185140=0x0,_0x30bd4e=_0x58f218[_0x3039('0x47')];_0x185140<_0x30bd4e&&_[_0x3039('0x64')](_0xba3431[_0x3039('0x5a')]);_0x185140++){if(_0x3d069f['min_internal']<=_0x58f218[_0x185140][_0x3039('0x65')]){_0xba3431['internal']=_0x58f218[_0x185140]['from'];}else if(_0x3d069f[_0x3039('0x60')]>_0x58f218[_0x185140]['from']&&_0x3d069f['min_internal']<=_0x58f218[_0x185140]['to']){_0xba3431[_0x3039('0x5a')]=_0x3d069f['min_internal'];}}}if(_[_0x3039('0x64')](_0xba3431[_0x3039('0x5a')])){_0xba3431['internal']=_0x5ef2e6+0x1;}return _0x221405(_0xba3431);});});})[_0x3039('0x4f')](function(_0x1ede8a){_0xbcd2a(_0x1ede8a);});});}function updateUser(_0x4b24b1){return new Promise(function(_0x231279,_0x4ad308){try{if(_0x4b24b1[_0x3039('0x66')]){_0x4b24b1[_0x3039('0x67')]=_0x4b24b1['internal'];_0x4b24b1[_0x3039('0x68')]={'mailbox':_0x4b24b1[_0x3039('0x5a')],'password':_0x4b24b1[_0x3039('0x5e')],'fullname':_0x4b24b1[_0x3039('0x69')],'email':_0x4b24b1['email']};}if(_0x4b24b1['role']===_0x3039('0x27')){if(!_0x4b24b1[_0x3039('0x6a')])_0x4b24b1[_0x3039('0x6a')]=[_0x3039('0x6b'),_0x3039('0x6c'),'103',_0x3039('0x6d'),_0x3039('0x6e'),_0x3039('0x6f'),'105',_0x3039('0x70'),_0x3039('0x71'),'108',_0x3039('0x72'),_0x3039('0x73'),'111','114','115'];}_0x231279(_0x4b24b1);}catch(_0x57ba25){_0x4ad308(_0x57ba25);}});}exports[_0x3039('0x74')]=function(_0xd95f90,_0x38cbca){if(_0xd95f90['user'][_0x3039('0x1f')]===_0x3039('0x27'))throw new Error(_0x3039('0x75'));if(_0xd95f90['body'][_0x3039('0x1f')]===_0x3039('0x25')&&_0xd95f90[_0x3039('0x25')]['role']!=='admin'){throw new Error(_0x3039('0x76'));}if(_0xd95f90[_0x3039('0x55')][_0x3039('0x1f')]===_0x3039('0x23')&&_0xd95f90[_0x3039('0x25')][_0x3039('0x1f')]!==_0x3039('0x23')){throw new Error(_0x3039('0x77'));}return licenseUtil[_0x3039('0x78')]([_0xd95f90[_0x3039('0x55')]])['then'](function(){return validateUser(_0xd95f90[_0x3039('0x55')]);})[_0x3039('0x30')](function(_0x30a4f3){return updateUser(_0x30a4f3)['then'](function(_0x2fd66c){if(_0x2fd66c[_0x3039('0x1f')]==='admin'){_0x2fd66c[_0x3039('0x79')]=_0xd95f90['user'][_0x3039('0x79')];delete _0x2fd66c['userProfileId'];}return _0x2fd66c;});})['then'](function(_0x466eff){return db['User']['create'](_0x466eff,{'include':[{'model':db[_0x3039('0x68')],'as':_0x3039('0x68')}]});})[_0x3039('0x30')](function(_0x105e45){if(_0xd95f90[_0x3039('0x55')][_0x3039('0x1f')]==='user')return _0x105e45;if(_0xd95f90[_0x3039('0x25')][_0x3039('0x1f')]!=='user')return _0x105e45;return db[_0x3039('0x7a')]['find']({'where':{'name':_0x105e45['role']===_0x3039('0x27')?_0x3039('0x26'):_0x3039('0x28'),'userProfileId':_0xd95f90[_0x3039('0x25')][_0x3039('0x7b')]},'raw':!![]})[_0x3039('0x30')](function(_0xab6004){if(!_0xab6004||_0xab6004[_0x3039('0x7c')]!=0x0)return _0x105e45;return db[_0x3039('0x2f')][_0x3039('0x74')]({'name':_0x105e45[_0x3039('0x32')],'resourceId':_0x105e45['id'],'type':_0xab6004[_0x3039('0x32')],'sectionId':_0xab6004['id']},{})[_0x3039('0x30')](function(){return _0x105e45;});})[_0x3039('0x4f')](function(_0x5362e5){logger['error'](_0x3039('0x7d'),_0x5362e5);throw _0x5362e5;});})[_0x3039('0x30')](respondWithResult(_0x38cbca,0xc9))[_0x3039('0x4f')](handleError(_0x38cbca,null));};exports[_0x3039('0x7e')]=function(_0x3ae679,_0x190ef0){var _0x3b35d1=_0x3ae679[_0x3039('0x55')];var _0x5f045b=[];if(_0x3ae679[_0x3039('0x25')][_0x3039('0x1f')]===_0x3039('0x27'))throw new Error(_0x3039('0x75'));if(_[_0x3039('0x7f')](_0x3b35d1,[_0x3039('0x1f'),_0x3039('0x25')])&&_0x3ae679[_0x3039('0x25')][_0x3039('0x1f')]!==_0x3039('0x23')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x3039('0x7f')](_0x3b35d1,[_0x3039('0x1f'),'admin'])&&_0x3ae679[_0x3039('0x25')][_0x3039('0x1f')]!==_0x3039('0x23')){throw new Error(_0x3039('0x80'));}return licenseUtil['checkUserLimits'](_0x3b35d1)[_0x3039('0x30')](function(){return validateUser(_0x3b35d1[0x0]);})[_0x3039('0x30')](function(){for(var _0x434ce2=0x1;_0x434ce2<_0x3b35d1['length'];_0x434ce2++){var _0x51aa1b=_0x3b35d1[_0x434ce2-0x1][_0x3039('0x5a')];if(!_0x3b35d1[_0x434ce2][_0x3039('0x5a')])_0x3b35d1[_0x434ce2]['internal']=_0x51aa1b+0x1;_0x5f045b[_0x3039('0x48')](validateUser(_0x3b35d1[_0x434ce2]));}return Promise[_0x3039('0x4e')](_0x5f045b);})[_0x3039('0x30')](function(){_0x5f045b=[];for(var _0x4c5f1f=0x0;_0x4c5f1f<_0x3b35d1['length'];_0x4c5f1f++){_0x5f045b[_0x3039('0x48')](updateUser(_0x3b35d1[_0x4c5f1f]));}return Promise[_0x3039('0x4e')](_0x5f045b);})[_0x3039('0x30')](function(){_0x5f045b=_0x3b35d1[_0x3039('0x2c')](function(_0x1de004){return db[_0x3039('0x34')][_0x3039('0x74')](_0x1de004,{'include':[{'model':db[_0x3039('0x68')],'as':_0x3039('0x68')}]})['then'](function(_0x2f8108){_0x1de004['id']=_0x2f8108['id'];return _0x1de004;});});return Promise[_0x3039('0x4e')](_0x5f045b);})['then'](function(_0x3f15e1){if(_0x3ae679['body'][_0x3039('0x1f')]==='user')return _0x3f15e1;if(_0x3ae679['user'][_0x3039('0x1f')]!==_0x3039('0x25'))return _0x3f15e1;var _0x38dc03=_[_0x3039('0x7f')](_0x3f15e1,function(_0x335e25){return _0x335e25[_0x3039('0x1f')]===_0x3039('0x27')||_0x335e25[_0x3039('0x1f')]===_0x3039('0x29');});if(!_0x38dc03)return _0x3f15e1;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x3039('0x26'),_0x3039('0x28')]},'userProfileId':_0x3ae679[_0x3039('0x25')][_0x3039('0x7b')]},'raw':!![]})[_0x3039('0x30')](function(_0x5cf548){if(_['isEmpty'](_0x5cf548)||!_[_0x3039('0x7f')](_0x5cf548,[_0x3039('0x7c'),0x0]))return _0x3f15e1;_0x5f045b=[];var _0x3f54e5=_(_0x5cf548)['map'](function(_0x2634b6){if(_0x2634b6['autoAssociation']===0x1)return;return _0x2634b6[_0x3039('0x32')]==='Agents'?_0x3039('0x27'):_0x3039('0x29');})[_0x3039('0x81')]()[_0x3039('0x2d')]();for(var _0x4b3082=0x0;_0x4b3082<_0x3f15e1[_0x3039('0x47')];_0x4b3082++){if(!_[_0x3039('0x42')](_0x3f54e5,_0x3f15e1[_0x4b3082][_0x3039('0x1f')]))return;var _0x407db1=_0x3f15e1[_0x4b3082][_0x3039('0x1f')]===_0x3039('0x27')?_0x3039('0x26'):_0x3039('0x28');_0x5f045b[_0x3039('0x48')](db[_0x3039('0x2f')][_0x3039('0x74')]({'name':_0x3f15e1[_0x4b3082][_0x3039('0x32')],'resourceId':_0x3f15e1[_0x4b3082]['id'],'type':_0x407db1,'sectionId':_[_0x3039('0x2e')](_0x5cf548,[_0x3039('0x32'),_0x407db1])['id']},{}));}return Promise[_0x3039('0x4e')](_0x5f045b);});})[_0x3039('0x30')](respondWithResult(_0x190ef0,0xc9))[_0x3039('0x4f')](handleError(_0x190ef0,null));};exports[_0x3039('0x82')]=function(_0x4fd3f1,_0x22c603){if(_0x4fd3f1['body']['id']){delete _0x4fd3f1['body']['id'];}return db['User'][_0x3039('0x2e')]({'where':{'id':_0x4fd3f1[_0x3039('0x50')]['id']}})[_0x3039('0x30')](function(_0x2fb8d0){if(!_0x2fb8d0)return null;if(_0x2fb8d0['id']===_0x4fd3f1[_0x3039('0x25')]['id']){if(!_0x4fd3f1[_0x3039('0x55')]['oldPassword']||!_0x4fd3f1['body'][_0x3039('0x83')]){throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))](_0x3039('0x86'));}if(!_0x2fb8d0[_0x3039('0x87')](_0x4fd3f1[_0x3039('0x55')]['oldPassword'])){throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))](_0x3039('0x88'));}if(_0x4fd3f1[_0x3039('0x55')]['oldPassword']===_0x4fd3f1['body'][_0x3039('0x83')]){throw new db['Sequelize'][(_0x3039('0x85'))](_0x3039('0x89'));}}else if(_0x4fd3f1[_0x3039('0x25')][_0x3039('0x1f')]===_0x3039('0x23')){if(!_0x4fd3f1['body']['newPassword']){throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))](_0x3039('0x8a'));}}else if(_0x4fd3f1[_0x3039('0x25')][_0x3039('0x1f')]===_0x3039('0x25')){if(!_0x4fd3f1['body'][_0x3039('0x83')]){throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))](_0x3039('0x8a'));}if(_0x2fb8d0['role']!=='agent'){throw new db[(_0x3039('0x84'))]['ValidationError'](_0x3039('0x75'));}}else{throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))]('Unauthorized');}return _0x2fb8d0;})[_0x3039('0x30')](handleEntityNotFound(_0x22c603,null))[_0x3039('0x30')](function(_0x52e9aa){return db[_0x3039('0x5b')][_0x3039('0x8b')]({'attributes':['id',_0x3039('0x5d'),'enforcePasswordHistory',_0x3039('0x8c')]})[_0x3039('0x30')](function(_0x4a0c8a){if(_0x4a0c8a[_0x3039('0x5d')])authService['validatePasswordPattern'](_0x4fd3f1[_0x3039('0x55')][_0x3039('0x83')]);if(!_0x4a0c8a['enforcePasswordHistory']||!_0x52e9aa[_0x3039('0x8d')])return _0x52e9aa;authService[_0x3039('0x8e')](_0x4fd3f1['body']['newPassword'],_0x52e9aa['previousPasswords'],_0x4a0c8a[_0x3039('0x8c')]);return _0x52e9aa;})[_0x3039('0x30')](saveUpdates({'password':_0x4fd3f1[_0x3039('0x55')][_0x3039('0x83')],'passwordResetAt':_0x4fd3f1[_0x3039('0x25')]['id']==_0x4fd3f1[_0x3039('0x50')]['id']?moment():null,'previousPasswords':authService[_0x3039('0x8f')](_0x4fd3f1[_0x3039('0x55')]['newPassword'],_0x52e9aa['previousPasswords'])},null));})[_0x3039('0x30')](respondWithResult(_0x22c603,null))[_0x3039('0x4f')](handleError(_0x22c603,null));};exports['addQueues']=function(_0x4f9cb7,_0x3ab77f){var _0x1bb7f2=_0x4f9cb7[_0x3039('0x55')][_0x3039('0x90')];return db[_0x3039('0x34')]['find']({'where':{'id':_0x4f9cb7['params']['id']},'attributes':['id',_0x3039('0x32'),_0x3039('0x1f'),_0x3039('0x91'),_0x3039('0x92'),'voicePause',_0x3039('0x93')]})['then'](handleEntityNotFound(_0x3ab77f,null))['then'](function(_0xe316c6){if(_0xe316c6){if(!utils[_0x3039('0x94')](_0x1bb7f2)){throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))](_0x3039('0x95'));}return _0xe316c6[_0x3039('0x96')+_[_0x3039('0x97')](_0x1bb7f2[_0x3039('0x98')]())+_0x3039('0x99')](_0x4f9cb7[_0x3039('0x55')]['ids'],{'penalty':_0x4f9cb7[_0x3039('0x55')]['penalty']||0x0})['spread'](function(_0x338a8b){for(var _0x37848e=0x0;_0x37848e<_0x4f9cb7['body'][_0x3039('0x58')][_0x3039('0x47')];_0x37848e+=0x1){var _0x359129={'UserId':Number(_0x4f9cb7[_0x3039('0x50')]['id'])};_0x359129[_[_0x3039('0x97')](_0x1bb7f2[_0x3039('0x98')]())+_0x3039('0x9a')]=Number(_0x4f9cb7[_0x3039('0x55')][_0x3039('0x58')][_0x37848e]);socket[_0x3039('0x20')](_0x3039('0x25')+_['capitalize'](_0x1bb7f2[_0x3039('0x98')]())+_0x3039('0x9b'),_0x359129);}return _0x338a8b;})['then'](function(){if(_0x1bb7f2===_0x3039('0x9c')){return db[_0x3039('0x9d')][_0x3039('0x44')]({'where':{'id':_0x4f9cb7[_0x3039('0x55')][_0x3039('0x58')]||[]},'raw':!![],'attributes':['id',_0x3039('0x32')]});}})[_0x3039('0x30')](function(_0x305006){var _0x36577f=_0xe316c6['get']({'plain':!![]});var _0xa060e7=[];if(_0x1bb7f2==='voice'&&_0x36577f[_0x3039('0x1f')]==='agent'&&_0x36577f[_0x3039('0x91')]){for(let _0x313ce5=0x0;_0x313ce5<_0x305006[_0x3039('0x47')];_0x313ce5+=0x1){_0xa060e7[_0x3039('0x48')]({'membername':_0x36577f['name'],'UserId':_0x36577f['id'],'queue_name':_0x305006[_0x313ce5][_0x3039('0x32')],'VoiceQueueId':_0x305006[_0x313ce5]['id'],'interface':_[_0x3039('0x64')](_0x36577f[_0x3039('0x93')])?util[_0x3039('0x9e')](_0x3039('0x9f'),_0x36577f[_0x3039('0x32')]):_0x36577f[_0x3039('0x93')],'paused':_0x36577f[_0x3039('0xa0')]||![],'penalty':_0x4f9cb7[_0x3039('0x55')]['penalty']||0x0});}return Promise['all'](_0xa060e7[_0x3039('0x2c')](function(_0x524ecf){return db[_0x3039('0xa1')]['upsert'](_0x524ecf);}));}return _0xe316c6;});}})[_0x3039('0x30')](respondWithStatusCode(_0x3ab77f,null))[_0x3039('0x4f')](handleError(_0x3ab77f,null));};exports[_0x3039('0xa2')]=function(_0x23c2de,_0x1eb4e4){var _0xc8fa10,_0x3df94d;return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x23c2de['params']['id']},'attributes':['id',_0x3039('0x32'),_0x3039('0x1f')]})[_0x3039('0x30')](handleEntityNotFound(_0x1eb4e4,null))[_0x3039('0x30')](function(_0x27e117){if(_0x27e117){_0xc8fa10=_0x27e117;if(!_0x23c2de[_0x3039('0x3c')]['channel']||!utils[_0x3039('0x94')](_0x23c2de[_0x3039('0x3c')][_0x3039('0x90')])){throw new db['Sequelize'][(_0x3039('0x85'))](_0x3039('0x95'));}return _0x27e117[_0x3039('0xa3')+_[_0x3039('0x97')](_0x23c2de['query'][_0x3039('0x90')][_0x3039('0x98')]())+_0x3039('0x99')](_0x23c2de[_0x3039('0x3c')][_0x3039('0x58')]);}})['then'](function(_0x71b08d){if(_[_0x3039('0xa4')](_0x23c2de['query'][_0x3039('0x58')])){for(var _0x13b65a=0x0;_0x13b65a<_0x23c2de[_0x3039('0x3c')][_0x3039('0x58')][_0x3039('0x47')];_0x13b65a+=0x1){_0x3df94d={'UserId':Number(_0x23c2de[_0x3039('0x50')]['id'])};_0x3df94d[_['capitalize'](_0x23c2de[_0x3039('0x3c')][_0x3039('0x90')][_0x3039('0x98')]())+'QueueId']=Number(_0x23c2de[_0x3039('0x3c')][_0x3039('0x58')][_0x13b65a]);socket[_0x3039('0x20')](_0x3039('0x25')+_[_0x3039('0x97')](_0x23c2de[_0x3039('0x3c')][_0x3039('0x90')][_0x3039('0x98')]())+_0x3039('0xa5'),_0x3df94d);}}else{_0x3df94d={'UserId':Number(_0x23c2de['params']['id'])};_0x3df94d[_['capitalize'](_0x23c2de[_0x3039('0x3c')][_0x3039('0x90')][_0x3039('0x98')]())+_0x3039('0x9a')]=Number(_0x23c2de[_0x3039('0x3c')]['ids']);socket['emit'](_0x3039('0x25')+_[_0x3039('0x97')](_0x23c2de[_0x3039('0x3c')]['channel'][_0x3039('0x98')]())+_0x3039('0xa5'),_0x3df94d);}return _0x71b08d;})[_0x3039('0x30')](function(){if(_0x23c2de[_0x3039('0x3c')][_0x3039('0x90')]===_0x3039('0x9c')){return db[_0x3039('0xa1')][_0x3039('0xa6')]({'where':{'UserId':_0x23c2de[_0x3039('0x50')]['id'],'VoiceQueueId':_0x23c2de[_0x3039('0x3c')]['ids']},'individualHooks':!![]})[_0x3039('0x30')](function(){return _0xc8fa10;});}return _0xc8fa10;})[_0x3039('0x30')](respondWithStatusCode(_0x1eb4e4,null))[_0x3039('0x4f')](handleError(_0x1eb4e4,null));};exports[_0x3039('0xa7')]=function(_0x444547,_0xdac50b){_0x444547['body'][_0x3039('0xa8')]=_0x444547[_0x3039('0xa9')][_0x3039('0xaa')];return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x444547[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0xdac50b,null))[_0x3039('0x30')](saveUpdates(_0x444547[_0x3039('0x55')],null))[_0x3039('0x30')](respondWithResult(_0xdac50b,null))[_0x3039('0x4f')](handleError(_0xdac50b,null));};exports[_0x3039('0xab')]=function(_0x2dc559,_0x1501d6){var _0x5a5709=path['join'](config[_0x3039('0xac')],'server/files/images/logos/default_profile.png');return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x2dc559[_0x3039('0x50')]['id']},'attributes':['id',_0x3039('0xa8')],'raw':!![]})[_0x3039('0x30')](handleEntityNotFound(_0x1501d6,null))[_0x3039('0x30')](function(_0x2c76c8){if(_0x2c76c8){if(_[_0x3039('0x64')](_0x2c76c8[_0x3039('0xa8')])){return _0x1501d6[_0x3039('0xad')](_0x5a5709);}else{if(!fs[_0x3039('0xae')](path[_0x3039('0xaf')](config['root'],_0x3039('0xb0'),_0x2c76c8['userpic']))){return _0x1501d6[_0x3039('0xad')](_0x5a5709);}return _0x1501d6[_0x3039('0xad')](path[_0x3039('0xaf')](config[_0x3039('0xac')],_0x3039('0xb0'),_0x2c76c8[_0x3039('0xa8')]));}}})[_0x3039('0x4f')](handleError(_0x1501d6,null));};exports[_0x3039('0xb1')]=function(_0x1c06c2,_0x51a3be){return db[_0x3039('0x34')]['find']({'where':{'id':_0x1c06c2[_0x3039('0x50')]['id']},'attributes':['id']})[_0x3039('0x30')](handleEntityNotFound(_0x51a3be,null))[_0x3039('0x30')](function(_0x3ce5b1){var _0x1bfc7c=[];values=_0x3ce5b1['dataValues'];_0x1bfc7c[_0x3039('0x48')](get_open_tabs('chat',_0x3ce5b1[_0x3039('0x49')]));_0x1bfc7c[_0x3039('0x48')](get_open_tabs('sms',_0x3ce5b1['dataValues']));_0x1bfc7c[_0x3039('0x48')](get_open_tabs(_0x3039('0x4c'),_0x3ce5b1[_0x3039('0x49')]));_0x1bfc7c[_0x3039('0x48')](get_open_tabs(_0x3039('0x4d'),_0x3ce5b1[_0x3039('0x49')]));_0x1bfc7c[_0x3039('0x48')](get_open_tabs(_0x3039('0x4b'),_0x3ce5b1[_0x3039('0x49')]));_0x1bfc7c[_0x3039('0x48')](get_open_tabs(_0x3039('0x54'),_0x3ce5b1[_0x3039('0x49')]));return Promise['all'](_0x1bfc7c);})[_0x3039('0x30')](function(_0x40a3ec){if(_0x40a3ec){var _0x48554a=_['map'](values[_0x3039('0xb2')],function(_0x180e06){return{'channel':_0x3039('0xb3'),'id':_0x180e06['id'],'createdAt':_0x180e06[_0x3039('0xb4')]};});var _0x3477c9=_[_0x3039('0x2c')](values['FaxOpenTabs'],function(_0x5b3c7f){return{'channel':_0x3039('0xb5'),'id':_0x5b3c7f['id'],'createdAt':_0x5b3c7f['createdAt']};});var _0x2a28e2=_[_0x3039('0x2c')](values[_0x3039('0xb6')],function(_0x4ac7af){return{'channel':'OPENCHANNEL','id':_0x4ac7af['id'],'createdAt':_0x4ac7af[_0x3039('0xb4')]};});var _0xbfa531=_[_0x3039('0x2c')](values[_0x3039('0xb7')],function(_0x27bfdc){return{'channel':_0x3039('0xb8'),'id':_0x27bfdc['id'],'createdAt':_0x27bfdc[_0x3039('0xb4')]};});var _0x5af399=_[_0x3039('0x2c')](values[_0x3039('0xb9')],function(_0x376363){return{'channel':_0x3039('0xba'),'id':_0x376363['id'],'createdAt':_0x376363[_0x3039('0xb4')]};});var _0x55b5da=_[_0x3039('0x2c')](values['WhatsappOpenTabs'],function(_0x2d2719){return{'channel':_0x3039('0xbb'),'id':_0x2d2719['id'],'createdAt':_0x2d2719['createdAt']};});var _0x30cdbb=_[_0x3039('0xbc')](_0x48554a,_0x3477c9,_0x2a28e2,_0xbfa531,_0x5af399,_0x55b5da);var _0x5e34d4={'count':_0x30cdbb[_0x3039('0x47')],'rows':_0x30cdbb};return _0x5e34d4;}else return null;})[_0x3039('0x30')](respondWithResult(_0x51a3be,null))['catch'](handleError(_0x51a3be,null));};exports[_0x3039('0xbd')]=function(_0x580da9,_0x4675fd){var _0x11cfd2={};return db['User'][_0x3039('0x8b')]({'where':{'id':_0x580da9['params']['id']}})[_0x3039('0x30')](function(_0x4bb585){if(!_0x4bb585){throw new APINotFoundError(util[_0x3039('0x9e')](_0x3039('0xbe'),_0x580da9['params']['id']));}return contacts[_0x3039('0x56')]();})['then'](function(_0x10c36d){_0x580da9['query'][_0x3039('0x34')]=_0x580da9[_0x3039('0x50')]['id'];_0x11cfd2=qs['getOptions'](_0x10c36d,_0x580da9);if(_0x580da9[_0x3039('0x3c')]['hasOwnProperty'](_0x3039('0x3d'))){_0x11cfd2[_0x3039('0x3e')]=[{'model':db['CmList'],'as':_0x3039('0xbf'),'required':![]},{'model':db[_0x3039('0xc0')],'as':_0x3039('0xc1'),'attributes':['id','name','color'],'where':_0x580da9[_0x3039('0x3c')][_0x3039('0xc2')]?{'id':_0x580da9[_0x3039('0x3c')][_0x3039('0xc2')]}:undefined,'required':_0x580da9[_0x3039('0x3c')][_0x3039('0xc2')]?!![]:![]}];}return contacts['findAll'](_0x580da9[_0x3039('0x3c')],_0x580da9[_0x3039('0x25')],_0x11cfd2,_0x10c36d);})[_0x3039('0x30')](respondWithFilteredResult(_0x4675fd,_0x11cfd2))[_0x3039('0x4f')](APIHandleError(_0x4675fd));};exports[_0x3039('0xc3')]=function(_0x1308c6,_0x5b8f66){var _0x43b696;var _0x5910a9={};var _0x40d1de;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x1308c6[_0x3039('0x50')]['id']},'attributes':['id',_0x3039('0x32'),'role']})[_0x3039('0x30')](handleEntityNotFound(_0x5b8f66,null))['then'](function(_0xe921ca){if(!utils[_0x3039('0x94')](_0x1308c6[_0x3039('0x3c')][_0x3039('0x90')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}_0x43b696=_0xe921ca;var _0xa0698d={};_0xa0698d[_0x3039('0xc4')]=_[_0x3039('0xc5')](db[_['capitalize'](_0x1308c6[_0x3039('0x3c')][_0x3039('0x90')])+'Queue'][_0x3039('0x35')]);_0xa0698d['query']=_[_0x3039('0xc5')](_0x1308c6[_0x3039('0x3c')]);_0xa0698d['filters']=_[_0x3039('0xc6')](_0xa0698d[_0x3039('0xc4')],_0xa0698d[_0x3039('0x3c')]);_0x5910a9[_0x3039('0x43')]=_[_0x3039('0xc6')](_0xa0698d[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0x1308c6['query'][_0x3039('0xc7')]));_0x5910a9[_0x3039('0x43')]=_0x5910a9[_0x3039('0x43')][_0x3039('0x47')]?_0x5910a9['attributes']:_0xa0698d[_0x3039('0xc4')];_0x5910a9[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x1308c6[_0x3039('0x3c')]['sort']);_0x5910a9[_0x3039('0x3b')]=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x1308c6[_0x3039('0x3c')],_0xa0698d[_0x3039('0xca')]));if(_0x1308c6[_0x3039('0x3c')]['filter']){_0x5910a9[_0x3039('0x3b')]=_['merge'](_0x5910a9[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x5910a9[_0x3039('0x43')],function(_0x910ad7){var _0x6cb2cd={};_0x6cb2cd[_0x910ad7]={'$like':'%'+_0x1308c6[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0x6cb2cd;})});}_0x5910a9=_[_0x3039('0x51')]({},_0x5910a9,_0x1308c6[_0x3039('0x52')]);switch(_0x43b696['role']){case'admin':return db[_['capitalize'](_0x1308c6[_0x3039('0x3c')][_0x3039('0x90')])+_0x3039('0xcc')][_0x3039('0x44')](_0x5910a9);case _0x3039('0x25'):case'agent':return _0x43b696[_0x3039('0x22')+_['capitalize'](_0x1308c6['query'][_0x3039('0x90')])+'Queues'](_0x5910a9);default:throw new db[(_0x3039('0x84'))]['ValidationError']('Unknown\x20role');}})[_0x3039('0x30')](function(_0x28942a){_0x40d1de=_0x28942a[_0x3039('0x47')];if(!_0x1308c6['query'][_0x3039('0xcd')]('nolimit')){_0x5910a9['limit']=qs[_0x3039('0x1b')](_0x1308c6[_0x3039('0x3c')][_0x3039('0x1b')]);_0x5910a9[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x1308c6[_0x3039('0x3c')][_0x3039('0x19')]);}switch(_0x43b696[_0x3039('0x1f')]){case _0x3039('0x23'):return db[_[_0x3039('0x97')](_0x1308c6[_0x3039('0x3c')]['channel'])+'Queue'][_0x3039('0x44')](_0x5910a9);case'user':case'agent':return _0x43b696[_0x3039('0x22')+_[_0x3039('0x97')](_0x1308c6['query'][_0x3039('0x90')])+_0x3039('0x99')](_0x5910a9);}})[_0x3039('0x30')](function(_0x5b9535){return{'count':_0x40d1de,'rows':_0x5b9535};})[_0x3039('0x30')](respondWithResult(_0x5b8f66,null))[_0x3039('0x4f')](handleError(_0x5b8f66,null));};exports['getVoiceQueuesRt']=function(_0x2a155c,_0x426ac3){var _0x3826e1={};var _0x28c139={};var _0x15ce4a;var _0x36929e;return db[_0x3039('0x34')]['findOne']({'where':{'id':_0x2a155c['params']['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x426ac3,null))[_0x3039('0x30')](function(_0x337f8f){if(_0x337f8f){_0x15ce4a=_0x337f8f;_0x28c139[_0x3039('0xc4')]=_[_0x3039('0xc5')](db['UserVoiceQueueRt']['rawAttributes']);_0x28c139[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x2a155c[_0x3039('0x3c')]);_0x28c139[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x28c139[_0x3039('0xc4')],_0x28c139['query']);_0x3826e1[_0x3039('0x43')]=_[_0x3039('0xc6')](_0x28c139[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0x2a155c[_0x3039('0x3c')][_0x3039('0xc7')]));_0x3826e1[_0x3039('0x43')]=_0x3826e1[_0x3039('0x43')][_0x3039('0x47')]?_0x3826e1[_0x3039('0x43')]:_0x28c139[_0x3039('0xc4')];_0x3826e1[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x2a155c[_0x3039('0x3c')][_0x3039('0xc9')]);_0x3826e1[_0x3039('0x3b')]=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x2a155c['query'],_0x28c139[_0x3039('0xca')]));if(_0x2a155c[_0x3039('0x3c')]['filter']){_0x3826e1[_0x3039('0x3b')]=_[_0x3039('0x51')](_0x3826e1[_0x3039('0x3b')],{'$or':_['map'](_0x3826e1[_0x3039('0x43')],function(_0x5dbb10){var _0x2ea0a4={};_0x2ea0a4[_0x5dbb10]={'$like':'%'+_0x2a155c[_0x3039('0x3c')]['filter']+'%'};return _0x2ea0a4;})});}_0x3826e1=_[_0x3039('0x51')]({},_0x3826e1,_0x2a155c[_0x3039('0x52')]);return _0x15ce4a[_0x3039('0xce')](_0x3826e1);}})[_0x3039('0x30')](function(_0xbc3b96){if(_0xbc3b96){_0x36929e=_0xbc3b96[_0x3039('0x47')];if(!_0x2a155c[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x3826e1[_0x3039('0x1b')]=qs['limit'](_0x2a155c[_0x3039('0x3c')][_0x3039('0x1b')]);_0x3826e1[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x2a155c[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x15ce4a[_0x3039('0xce')](_0x3826e1);}})[_0x3039('0x30')](function(_0x529e7d){if(_0x529e7d){return _0x529e7d?{'count':_0x36929e,'rows':_0x529e7d}:null;}})[_0x3039('0x30')](respondWithResult(_0x426ac3,null))['catch'](handleError(_0x426ac3,null));};exports[_0x3039('0xd0')]=function(_0x1c63a1,_0x4efd1f){var _0xc0d5d9={};var _0x4075c2={};var _0x45fcc5;var _0x28206b;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x1c63a1[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x4efd1f,null))[_0x3039('0x30')](function(_0x51cb0f){if(_0x51cb0f){_0x45fcc5=_0x51cb0f;_0x4075c2[_0x3039('0xc4')]=_[_0x3039('0xc5')](db[_0x3039('0xd1')][_0x3039('0x35')]);_0x4075c2[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x1c63a1['query']);_0x4075c2[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x4075c2[_0x3039('0xc4')],_0x4075c2[_0x3039('0x3c')]);_0xc0d5d9['attributes']=_['intersection'](_0x4075c2['model'],qs[_0x3039('0xc7')](_0x1c63a1[_0x3039('0x3c')][_0x3039('0xc7')]));_0xc0d5d9[_0x3039('0x43')]=_0xc0d5d9[_0x3039('0x43')][_0x3039('0x47')]?_0xc0d5d9[_0x3039('0x43')]:_0x4075c2[_0x3039('0xc4')];_0xc0d5d9[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x1c63a1['query'][_0x3039('0xc9')]);_0xc0d5d9[_0x3039('0x3b')]=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x1c63a1[_0x3039('0x3c')],_0x4075c2[_0x3039('0xca')]));if(_0x1c63a1[_0x3039('0x3c')]['filter']){_0xc0d5d9[_0x3039('0x3b')]=_['merge'](_0xc0d5d9['where'],{'$or':_[_0x3039('0x2c')](_0xc0d5d9[_0x3039('0x43')],function(_0x513a87){var _0x2e3648={};_0x2e3648[_0x513a87]={'$like':'%'+_0x1c63a1['query'][_0x3039('0x2a')]+'%'};return _0x2e3648;})});}_0xc0d5d9=_['merge']({},_0xc0d5d9,_0x1c63a1['options']);return _0x45fcc5[_0x3039('0xd0')](_0xc0d5d9);}})[_0x3039('0x30')](function(_0x4b6f17){if(_0x4b6f17){_0x28206b=_0x4b6f17[_0x3039('0x47')];if(!_0x1c63a1[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0xc0d5d9[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x1c63a1[_0x3039('0x3c')][_0x3039('0x1b')]);_0xc0d5d9['offset']=qs[_0x3039('0x19')](_0x1c63a1[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x45fcc5['getGroups'](_0xc0d5d9);}})['then'](function(_0x1c94b1){if(_0x1c94b1){return _0x1c94b1?{'count':_0x28206b,'rows':_0x1c94b1}:null;}})['then'](respondWithResult(_0x4efd1f,null))['catch'](handleError(_0x4efd1f,null));};exports[_0x3039('0xd2')]=function(_0x19c25c,_0x3314cb){var _0x3b2cf0={'raw':!![],'where':{}};var _0x4f60b5={};var _0x453c9c={'count':0x0,'rows':[]};return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x19c25c[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x3314cb,null))[_0x3039('0x30')](function(_0x5d384a){if(_0x5d384a){_0x4f60b5['model']=_['keys'](db[_0x3039('0xd3')][_0x3039('0x35')]);_0x4f60b5[_0x3039('0x3c')]=_['keys'](_0x19c25c[_0x3039('0x3c')]);_0x4f60b5[_0x3039('0xca')]=_['intersection'](_0x4f60b5[_0x3039('0xc4')],_0x4f60b5[_0x3039('0x3c')]);_0x3b2cf0[_0x3039('0x43')]=_['intersection'](_0x4f60b5[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0x19c25c[_0x3039('0x3c')]['fields']));_0x3b2cf0[_0x3039('0x43')]=_0x3b2cf0[_0x3039('0x43')][_0x3039('0x47')]?_0x3b2cf0['attributes']:_0x4f60b5[_0x3039('0xc4')];if(!_0x19c25c[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x3b2cf0['limit']=qs[_0x3039('0x1b')](_0x19c25c[_0x3039('0x3c')][_0x3039('0x1b')]);_0x3b2cf0[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x19c25c[_0x3039('0x3c')][_0x3039('0x19')]);}_0x3b2cf0['order']=qs[_0x3039('0xc9')](_0x19c25c[_0x3039('0x3c')][_0x3039('0xc9')]);_0x3b2cf0[_0x3039('0x3b')]=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x19c25c[_0x3039('0x3c')],_0x4f60b5[_0x3039('0xca')]));_0x3b2cf0[_0x3039('0x3b')][_0x3039('0xd4')]=_0x5d384a['id'];if(_0x19c25c[_0x3039('0x3c')][_0x3039('0x2a')]){_0x3b2cf0['where']=_[_0x3039('0x51')](_0x3b2cf0[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x3b2cf0[_0x3039('0x43')],function(_0x840151){var _0xc6ce2={};_0xc6ce2[_0x840151]={'$like':'%'+_0x19c25c[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0xc6ce2;})});}_0x3b2cf0=_['merge']({},_0x3b2cf0,_0x19c25c[_0x3039('0x52')]);return db[_0x3039('0xd3')][_0x3039('0x1c')]({'where':_0x3b2cf0[_0x3039('0x3b')]})[_0x3039('0x30')](function(_0x78e2f){_0x453c9c['count']=_0x78e2f;if(_0x19c25c[_0x3039('0x3c')][_0x3039('0x3d')]){_0x3b2cf0[_0x3039('0x3e')]=[{'all':!![]}];}return db[_0x3039('0xd3')][_0x3039('0x44')](_0x3b2cf0);})[_0x3039('0x30')](function(_0x1e122e){_0x453c9c['rows']=_0x1e122e;return _0x453c9c;});}})[_0x3039('0x30')](respondWithFilteredResult(_0x3314cb,_0x3b2cf0))[_0x3039('0x4f')](handleError(_0x3314cb,null));};exports[_0x3039('0xd5')]=function(_0x76808c,_0x336d08){var _0x241a10={'raw':!![],'where':{}};var _0x26bdf8={};var _0x6a0622={'count':0x0,'rows':[]};return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x76808c[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x336d08,null))['then'](function(_0x250d60){if(_0x250d60){_0x26bdf8[_0x3039('0xc4')]=_[_0x3039('0xc5')](db['ScreenRecording'][_0x3039('0x35')]);_0x26bdf8['query']=_['keys'](_0x76808c[_0x3039('0x3c')]);_0x26bdf8[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x26bdf8[_0x3039('0xc4')],_0x26bdf8[_0x3039('0x3c')]);_0x241a10[_0x3039('0x43')]=_[_0x3039('0xc6')](_0x26bdf8[_0x3039('0xc4')],qs['fields'](_0x76808c[_0x3039('0x3c')]['fields']));_0x241a10[_0x3039('0x43')]=_0x241a10['attributes']['length']?_0x241a10[_0x3039('0x43')]:_0x26bdf8['model'];if(!_0x76808c[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x241a10[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x76808c[_0x3039('0x3c')][_0x3039('0x1b')]);_0x241a10['offset']=qs['offset'](_0x76808c[_0x3039('0x3c')]['offset']);}_0x241a10[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x76808c['query'][_0x3039('0xc9')]);_0x241a10['where']=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x76808c[_0x3039('0x3c')],_0x26bdf8[_0x3039('0xca')]));_0x241a10[_0x3039('0x3b')]['UserId']=_0x250d60['id'];if(_0x76808c[_0x3039('0x3c')]['filter']){_0x241a10[_0x3039('0x3b')]=_[_0x3039('0x51')](_0x241a10[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x241a10[_0x3039('0x43')],function(_0x6ad512){var _0x56158f={};_0x56158f[_0x6ad512]={'$like':'%'+_0x76808c[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0x56158f;})});}_0x241a10=_['merge']({},_0x241a10,_0x76808c[_0x3039('0x52')]);return db[_0x3039('0xd6')][_0x3039('0x1c')]({'where':_0x241a10[_0x3039('0x3b')]})[_0x3039('0x30')](function(_0x2cc895){_0x6a0622[_0x3039('0x1c')]=_0x2cc895;if(_0x76808c['query']['includeAll']){_0x241a10[_0x3039('0x3e')]=[{'all':!![]}];}return db[_0x3039('0xd6')][_0x3039('0x44')](_0x241a10);})['then'](function(_0x22f7b2){_0x6a0622[_0x3039('0x45')]=_0x22f7b2;return _0x6a0622;});}})[_0x3039('0x30')](respondWithFilteredResult(_0x336d08,_0x241a10))[_0x3039('0x4f')](handleError(_0x336d08,null));};exports[_0x3039('0xd7')]=function(_0x3a3948,_0x2071ff){var _0x3f5519={};var _0x1bcf89={};var _0x1e7b5f;var _0x559043;return db['User'][_0x3039('0x8b')]({'where':{'id':_0x3a3948[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x2071ff,null))[_0x3039('0x30')](function(_0x44d536){if(_0x44d536){_0x1e7b5f=_0x44d536;_0x1bcf89['model']=_['keys'](db[_0x3039('0xd8')][_0x3039('0x35')]);_0x1bcf89[_0x3039('0x3c')]=_['keys'](_0x3a3948[_0x3039('0x3c')]);_0x1bcf89[_0x3039('0xca')]=_['intersection'](_0x1bcf89[_0x3039('0xc4')],_0x1bcf89['query']);_0x3f5519['attributes']=_[_0x3039('0xc6')](_0x1bcf89[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0x3a3948[_0x3039('0x3c')][_0x3039('0xc7')]));_0x3f5519[_0x3039('0x43')]=_0x3f5519[_0x3039('0x43')][_0x3039('0x47')]?_0x3f5519[_0x3039('0x43')]:_0x1bcf89[_0x3039('0xc4')];_0x3f5519['order']=qs[_0x3039('0xc9')](_0x3a3948[_0x3039('0x3c')][_0x3039('0xc9')]);_0x3f5519[_0x3039('0x3b')]=qs['filters'](_[_0x3039('0xcb')](_0x3a3948['query'],_0x1bcf89['filters']));if(_0x3a3948[_0x3039('0x3c')][_0x3039('0x2a')]){_0x3f5519[_0x3039('0x3b')]=_['merge'](_0x3f5519['where'],{'$or':_[_0x3039('0x2c')](_0x3f5519[_0x3039('0x43')],function(_0x16ba3d){var _0x4addd3={};_0x4addd3[_0x16ba3d]={'$like':'%'+_0x3a3948[_0x3039('0x3c')]['filter']+'%'};return _0x4addd3;})});}_0x3f5519=_['merge']({},_0x3f5519,_0x3a3948[_0x3039('0x52')]);return _0x1e7b5f[_0x3039('0xd7')](_0x3f5519);}})[_0x3039('0x30')](function(_0x52072f){if(_0x52072f){_0x559043=_0x52072f[_0x3039('0x47')];if(!_0x3a3948[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x3f5519[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x3a3948['query'][_0x3039('0x1b')]);_0x3f5519[_0x3039('0x19')]=qs['offset'](_0x3a3948[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x1e7b5f['getChatInteractions'](_0x3f5519);}})[_0x3039('0x30')](function(_0x1aa9cc){if(_0x1aa9cc){return _0x1aa9cc?{'count':_0x559043,'rows':_0x1aa9cc}:null;}})[_0x3039('0x30')](respondWithResult(_0x2071ff,null))[_0x3039('0x4f')](handleError(_0x2071ff,null));};exports[_0x3039('0xd9')]=function(_0x1bab5d,_0x2a0a85){var _0x1743b1={};var _0x18bd6={};var _0x2782aa;var _0x3f9663;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x1bab5d[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x2a0a85,null))[_0x3039('0x30')](function(_0x15bfdd){if(_0x15bfdd){_0x2782aa=_0x15bfdd;_0x18bd6['model']=_['keys'](db[_0x3039('0xda')][_0x3039('0x35')]);_0x18bd6[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x1bab5d[_0x3039('0x3c')]);_0x18bd6[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x18bd6['model'],_0x18bd6[_0x3039('0x3c')]);_0x1743b1[_0x3039('0x43')]=_[_0x3039('0xc6')](_0x18bd6['model'],qs[_0x3039('0xc7')](_0x1bab5d['query']['fields']));_0x1743b1[_0x3039('0x43')]=_0x1743b1[_0x3039('0x43')]['length']?_0x1743b1[_0x3039('0x43')]:_0x18bd6[_0x3039('0xc4')];_0x1743b1[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x1bab5d['query'][_0x3039('0xc9')]);_0x1743b1['where']=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x1bab5d['query'],_0x18bd6[_0x3039('0xca')]));if(_0x1bab5d[_0x3039('0x3c')]['filter']){_0x1743b1['where']=_[_0x3039('0x51')](_0x1743b1[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x1743b1[_0x3039('0x43')],function(_0xa2c571){var _0x14a024={};_0x14a024[_0xa2c571]={'$like':'%'+_0x1bab5d[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0x14a024;})});}_0x1743b1=_[_0x3039('0x51')]({},_0x1743b1,_0x1bab5d[_0x3039('0x52')]);return _0x2782aa[_0x3039('0xd9')](_0x1743b1);}})['then'](function(_0x11c4a7){if(_0x11c4a7){_0x3f9663=_0x11c4a7['length'];if(!_0x1bab5d[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x1743b1[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x1bab5d[_0x3039('0x3c')][_0x3039('0x1b')]);_0x1743b1['offset']=qs[_0x3039('0x19')](_0x1bab5d[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x2782aa[_0x3039('0xd9')](_0x1743b1);}})[_0x3039('0x30')](function(_0x469477){if(_0x469477){return _0x469477?{'count':_0x3f9663,'rows':_0x469477}:null;}})['then'](respondWithResult(_0x2a0a85,null))[_0x3039('0x4f')](handleError(_0x2a0a85,null));};exports[_0x3039('0xdb')]=function(_0xd72ab7,_0x293f52){var _0x197aed={'raw':!![],'where':{}};var _0x5e284c={};var _0x27e7b4={'count':0x0,'rows':[]};return db[_0x3039('0x34')]['findOne']({'where':{'id':_0xd72ab7[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x293f52,null))[_0x3039('0x30')](function(_0x4b991a){if(_0x4b991a){_0x5e284c[_0x3039('0xc4')]=_[_0x3039('0xc5')](db[_0x3039('0xdc')][_0x3039('0x35')]);_0x5e284c[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0xd72ab7[_0x3039('0x3c')]);_0x5e284c['filters']=_[_0x3039('0xc6')](_0x5e284c[_0x3039('0xc4')],_0x5e284c[_0x3039('0x3c')]);_0x197aed[_0x3039('0x43')]=_['intersection'](_0x5e284c[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0xd72ab7[_0x3039('0x3c')]['fields']));_0x197aed['attributes']=_0x197aed['attributes'][_0x3039('0x47')]?_0x197aed[_0x3039('0x43')]:_0x5e284c[_0x3039('0xc4')];if(!_0xd72ab7[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x197aed[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0xd72ab7[_0x3039('0x3c')][_0x3039('0x1b')]);_0x197aed[_0x3039('0x19')]=qs['offset'](_0xd72ab7[_0x3039('0x3c')][_0x3039('0x19')]);}_0x197aed['order']=qs[_0x3039('0xc9')](_0xd72ab7['query']['sort']);_0x197aed[_0x3039('0x3b')]=qs[_0x3039('0xca')](_['pick'](_0xd72ab7[_0x3039('0x3c')],_0x5e284c[_0x3039('0xca')]));_0x197aed[_0x3039('0x3b')][_0x3039('0xd4')]=_0x4b991a['id'];if(_0xd72ab7['query'][_0x3039('0x2a')]){_0x197aed['where']=_[_0x3039('0x51')](_0x197aed[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x197aed['attributes'],function(_0x456b43){var _0x5a0426={};_0x5a0426[_0x456b43]={'$like':'%'+_0xd72ab7[_0x3039('0x3c')]['filter']+'%'};return _0x5a0426;})});}_0x197aed=_['merge']({},_0x197aed,_0xd72ab7[_0x3039('0x52')]);return db[_0x3039('0xdc')]['count']({'where':_0x197aed[_0x3039('0x3b')]})[_0x3039('0x30')](function(_0x2e8eab){_0x27e7b4[_0x3039('0x1c')]=_0x2e8eab;if(_0xd72ab7[_0x3039('0x3c')][_0x3039('0x3d')]){_0x197aed[_0x3039('0x3e')]=[{'all':!![]}];}return db[_0x3039('0xdc')][_0x3039('0x44')](_0x197aed);})[_0x3039('0x30')](function(_0x196f7f){_0x27e7b4[_0x3039('0x45')]=_0x196f7f;return _0x27e7b4;});}})['then'](respondWithFilteredResult(_0x293f52,_0x197aed))[_0x3039('0x4f')](handleError(_0x293f52,null));};exports[_0x3039('0xdd')]=function(_0x2bc9d6,_0x31e4f5){var _0x34c92d={};var _0x4aaa8e={};var _0x10563b;var _0x2cff00;return db['User'][_0x3039('0x8b')]({'where':{'id':_0x2bc9d6[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x31e4f5,null))[_0x3039('0x30')](function(_0x514af1){if(_0x514af1){_0x10563b=_0x514af1;_0x4aaa8e[_0x3039('0xc4')]=_[_0x3039('0xc5')](db['SmsInteraction'][_0x3039('0x35')]);_0x4aaa8e[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x2bc9d6[_0x3039('0x3c')]);_0x4aaa8e['filters']=_[_0x3039('0xc6')](_0x4aaa8e['model'],_0x4aaa8e[_0x3039('0x3c')]);_0x34c92d[_0x3039('0x43')]=_['intersection'](_0x4aaa8e[_0x3039('0xc4')],qs['fields'](_0x2bc9d6[_0x3039('0x3c')][_0x3039('0xc7')]));_0x34c92d['attributes']=_0x34c92d[_0x3039('0x43')][_0x3039('0x47')]?_0x34c92d[_0x3039('0x43')]:_0x4aaa8e['model'];_0x34c92d[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x2bc9d6[_0x3039('0x3c')][_0x3039('0xc9')]);_0x34c92d['where']=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x2bc9d6[_0x3039('0x3c')],_0x4aaa8e['filters']));if(_0x2bc9d6['query']['filter']){_0x34c92d[_0x3039('0x3b')]=_['merge'](_0x34c92d['where'],{'$or':_[_0x3039('0x2c')](_0x34c92d[_0x3039('0x43')],function(_0x1c2d2b){var _0xf05bfb={};_0xf05bfb[_0x1c2d2b]={'$like':'%'+_0x2bc9d6[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0xf05bfb;})});}_0x34c92d=_[_0x3039('0x51')]({},_0x34c92d,_0x2bc9d6[_0x3039('0x52')]);return _0x10563b[_0x3039('0xdd')](_0x34c92d);}})[_0x3039('0x30')](function(_0x592947){if(_0x592947){_0x2cff00=_0x592947[_0x3039('0x47')];if(!_0x2bc9d6[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x34c92d[_0x3039('0x1b')]=qs['limit'](_0x2bc9d6['query'][_0x3039('0x1b')]);_0x34c92d[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x2bc9d6[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x10563b['getSmsInteractions'](_0x34c92d);}})['then'](function(_0x3ea931){if(_0x3ea931){return _0x3ea931?{'count':_0x2cff00,'rows':_0x3ea931}:null;}})[_0x3039('0x30')](respondWithResult(_0x31e4f5,null))['catch'](handleError(_0x31e4f5,null));};exports[_0x3039('0xde')]=function(_0x456260,_0x3f8645){var _0x3d9b1d={};var _0x134ece={};var _0x131bed;var _0x38ead9;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x456260[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x3f8645,null))['then'](function(_0x283840){if(_0x283840){_0x131bed=_0x283840;_0x134ece['model']=_[_0x3039('0xc5')](db[_0x3039('0xdf')]['rawAttributes']);_0x134ece[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x456260[_0x3039('0x3c')]);_0x134ece[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x134ece[_0x3039('0xc4')],_0x134ece['query']);_0x3d9b1d['attributes']=_[_0x3039('0xc6')](_0x134ece['model'],qs[_0x3039('0xc7')](_0x456260[_0x3039('0x3c')][_0x3039('0xc7')]));_0x3d9b1d[_0x3039('0x43')]=_0x3d9b1d['attributes'][_0x3039('0x47')]?_0x3d9b1d[_0x3039('0x43')]:_0x134ece[_0x3039('0xc4')];_0x3d9b1d[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x456260[_0x3039('0x3c')]['sort']);_0x3d9b1d[_0x3039('0x3b')]=qs['filters'](_[_0x3039('0xcb')](_0x456260['query'],_0x134ece[_0x3039('0xca')]));if(_0x456260[_0x3039('0x3c')]['filter']){_0x3d9b1d[_0x3039('0x3b')]=_[_0x3039('0x51')](_0x3d9b1d[_0x3039('0x3b')],{'$or':_['map'](_0x3d9b1d[_0x3039('0x43')],function(_0x175884){var _0x2ffc2a={};_0x2ffc2a[_0x175884]={'$like':'%'+_0x456260[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0x2ffc2a;})});}_0x3d9b1d=_[_0x3039('0x51')]({},_0x3d9b1d,_0x456260[_0x3039('0x52')]);return _0x131bed[_0x3039('0xde')](_0x3d9b1d);}})[_0x3039('0x30')](function(_0x30b207){if(_0x30b207){_0x38ead9=_0x30b207[_0x3039('0x47')];if(!_0x456260['query'][_0x3039('0xcd')]('nolimit')){_0x3d9b1d[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x456260[_0x3039('0x3c')][_0x3039('0x1b')]);_0x3d9b1d[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x456260[_0x3039('0x3c')]['offset']);}return _0x131bed[_0x3039('0xde')](_0x3d9b1d);}})[_0x3039('0x30')](function(_0x14dd49){if(_0x14dd49){return _0x14dd49?{'count':_0x38ead9,'rows':_0x14dd49}:null;}})['then'](respondWithResult(_0x3f8645,null))['catch'](handleError(_0x3f8645,null));};exports['getWhatsappInteractions']=function(_0x208dd6,_0x1cac2b){var _0x3a65d2={};var _0x42cea4={};var _0x49afb1;var _0x3b87cb;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x208dd6[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x1cac2b,null))[_0x3039('0x30')](function(_0x35d5f8){if(_0x35d5f8){_0x49afb1=_0x35d5f8;_0x42cea4[_0x3039('0xc4')]=_[_0x3039('0xc5')](db[_0x3039('0xe0')][_0x3039('0x35')]);_0x42cea4[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x208dd6[_0x3039('0x3c')]);_0x42cea4[_0x3039('0xca')]=_['intersection'](_0x42cea4[_0x3039('0xc4')],_0x42cea4[_0x3039('0x3c')]);_0x3a65d2[_0x3039('0x43')]=_[_0x3039('0xc6')](_0x42cea4[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0x208dd6[_0x3039('0x3c')][_0x3039('0xc7')]));_0x3a65d2[_0x3039('0x43')]=_0x3a65d2['attributes'][_0x3039('0x47')]?_0x3a65d2[_0x3039('0x43')]:_0x42cea4[_0x3039('0xc4')];_0x3a65d2[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x208dd6[_0x3039('0x3c')][_0x3039('0xc9')]);_0x3a65d2['where']=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x208dd6[_0x3039('0x3c')],_0x42cea4[_0x3039('0xca')]));if(_0x208dd6['query'][_0x3039('0x2a')]){_0x3a65d2[_0x3039('0x3b')]=_['merge'](_0x3a65d2[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x3a65d2['attributes'],function(_0x3d9260){var _0x357865={};_0x357865[_0x3d9260]={'$like':'%'+_0x208dd6['query']['filter']+'%'};return _0x357865;})});}_0x3a65d2=_[_0x3039('0x51')]({},_0x3a65d2,_0x208dd6['options']);return _0x49afb1['getWhatsappInteractions'](_0x3a65d2);}})[_0x3039('0x30')](function(_0x11b5b2){if(_0x11b5b2){_0x3b87cb=_0x11b5b2[_0x3039('0x47')];if(!_0x208dd6[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x3a65d2['limit']=qs[_0x3039('0x1b')](_0x208dd6[_0x3039('0x3c')][_0x3039('0x1b')]);_0x3a65d2[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x208dd6[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x49afb1['getWhatsappInteractions'](_0x3a65d2);}})['then'](function(_0x2b28e5){if(_0x2b28e5){return _0x2b28e5?{'count':_0x3b87cb,'rows':_0x2b28e5}:null;}})[_0x3039('0x30')](respondWithResult(_0x1cac2b,null))[_0x3039('0x4f')](handleError(_0x1cac2b,null));};exports[_0x3039('0xe1')]=function(_0x226465,_0x3789b9,_0x2d89d9){var _0x3dc0e5;var _0x4413c7;var _0x5b9392;var _0x45e50d=!_[_0x3039('0x64')](_0x226465[_0x3039('0x50')]['id'])?_0x226465['params']['id']:!_['isNil'](_0x226465[_0x3039('0x25')]['id'])?_0x226465[_0x3039('0x25')]['id']:null;return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x45e50d,'role':{'$or':[_0x3039('0x23'),'user',_0x3039('0x27')]}},'attributes':['id','name',_0x3039('0xe2'),'mobile',_0x3039('0x1f'),_0x3039('0x5a'),'loginInPause']})['then'](function(_0x389635){if(_0x389635){if(_0x389635[_0x3039('0x1f')]===_0x3039('0x27')){_0x3dc0e5=_0x389635;if(_0x226465[_0x3039('0x55')][_0x3039('0x93')]){_0x5b9392=util['format'](_0x3039('0xe3'),_0x3dc0e5[_0x226465[_0x3039('0x55')][_0x3039('0x93')]]);}else if(_0x226465[_0x3039('0x55')][_0x3039('0xe4')]){_0x5b9392=util[_0x3039('0x9e')](_0x3039('0x9f'),_0x226465['body']['intrf']);}else{_0x5b9392=util[_0x3039('0x9e')]('SIP/%s',_0x3dc0e5[_0x3039('0x32')]);}socket['to'](util['format'](_0x3039('0xe5'),_0x3dc0e5[_0x3039('0x32')]))[_0x3039('0x20')](_0x3039('0xe6'),{'user':{'id':_0x3dc0e5['id'],'name':_0x3dc0e5[_0x3039('0x32')]},'ip':_0x226465['headers'][_0x3039('0xe7')]||_0x226465[_0x3039('0xe8')]['remoteAddress']||_0x226465[_0x3039('0xe9')][_0x3039('0xea')]||_0x226465[_0x3039('0xe8')][_0x3039('0xe9')][_0x3039('0xea')]});return db[_0x3039('0xa1')][_0x3039('0xa6')]({'where':{'membername':_0x3dc0e5['name']},'individualHooks':!![]});}}else{throw new db[(_0x3039('0x84'))]['ValidationError'](_0x3039('0xeb'));}})[_0x3039('0x30')](function(){if(_0x3dc0e5){return _0x3dc0e5[_0x3039('0xec')]({'raw':!![]});}})[_0x3039('0x30')](function(_0x2a66f0){if(_0x3dc0e5){if(_0x2a66f0){_0x4413c7=_0x2a66f0;if(_0x4413c7[_0x3039('0x47')]){var _0x184609=_0x4413c7[_0x3039('0x2c')](function(_0x64c5e8){var _0x5d2eaa={'membername':_0x3dc0e5['name'],'UserId':_0x3dc0e5['id'],'queue_name':_0x64c5e8[_0x3039('0x32')],'VoiceQueueId':_0x64c5e8['id'],'interface':_0x5b9392,'paused':_0x3dc0e5[_0x3039('0x92')]||![],'penalty':_0x64c5e8[_0x3039('0xed')]||0x0};return db[_0x3039('0xa1')]['upsert'](_0x5d2eaa);});return Promise[_0x3039('0x4e')](_0x184609);}}}})[_0x3039('0x30')](function(){if(_0x3dc0e5){return db[_0x3039('0xee')][_0x3039('0x44')]({'where':{'membername':_0x3dc0e5[_0x3039('0x32')],'exitAt':null}});}})[_0x3039('0x30')](function(_0x93c0c8){if(_0x3dc0e5){var _0x3bc87f=[];_0x93c0c8[_0x3039('0xef')](function(_0x1d36c2){_0x3bc87f['push'](_0x1d36c2[_0x3039('0x1e')]({'exitAt':moment()['format'](_0x3039('0xf0'))}));});return Promise['all'](_0x3bc87f);}})[_0x3039('0x30')](function(){if(_0x3dc0e5){var _0x99a388=[];var _0x3fa3bf=[];var _0x1490d9=utils['getChannels']();var _0x8ef786={'membername':_0x3dc0e5['name'],'interface':_0x5b9392,'enterAt':moment()[_0x3039('0x9e')](_0x3039('0xf0')),'role':_0x3dc0e5[_0x3039('0x1f')],'internal':_0x3dc0e5['internal']};_0x1490d9['forEach'](function(_0x3cccba){_0x99a388[_0x3039('0x48')](_[_0x3039('0x51')]({'channel':_0x3cccba,'type':_0x3039('0xf1'),'data1':_0x226465[_0x3039('0x55')]['device'],'data2':_0x5b9392},_0x8ef786));if(_0x3dc0e5[_0x3039('0x92')]){_0x3fa3bf[_0x3039('0x48')](_[_0x3039('0x51')]({'channel':_0x3cccba,'type':_0x3039('0xf2'),'data1':_0x3039('0xf3')},_0x8ef786));}});return db[_0x3039('0xee')][_0x3039('0x7e')](_0x99a388[_0x3039('0xbc')](_0x3fa3bf),{'individualHooks':!![]});}})[_0x3039('0x30')](function(){if(_0x3dc0e5){return _0x3dc0e5[_0x3039('0x1e')]({'online':!![],'lastLoginAt':moment()[_0x3039('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3dc0e5[_0x3039('0x92')]||![],'mailPause':_0x3dc0e5['loginInPause']||![],'chatPause':_0x3dc0e5[_0x3039('0x92')]||![],'faxPause':_0x3dc0e5[_0x3039('0x92')]||![],'smsPause':_0x3dc0e5[_0x3039('0x92')]||![],'openchannelPause':_0x3dc0e5[_0x3039('0x92')]||![],'whatsappPause':_0x3dc0e5['loginInPause']||![],'pauseType':_0x3dc0e5[_0x3039('0x92')]?_0x3039('0xf3'):null,'interface':_0x5b9392,'lastPauseAt':moment()['format'](_0x3039('0xf0'))});}})[_0x3039('0x30')](function(_0x347475){if(_0x226465['isMiddleware']){return _0x2d89d9();}else{return Promise['resolve'](_0x347475)[_0x3039('0x30')](respondWithResult(_0x3789b9,null));}})['catch'](handleError(_0x3789b9,null));};exports[_0x3039('0xf4')]=function(_0x583a7c,_0x1b0045){var _0x27f159;return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x583a7c['params']['id'],'role':_0x3039('0x27')},'attributes':['id','name','role']})[_0x3039('0x30')](handleEntityNotFound(_0x1b0045,null))[_0x3039('0x30')](function(_0x5ced6b){if(_0x5ced6b){_0x27f159=_0x5ced6b;return db[_0x3039('0xa1')][_0x3039('0xa6')]({'where':{'membername':_0x27f159[_0x3039('0x32')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x3039('0x44')]({'where':{'membername':_0x27f159[_0x3039('0x32')],'exitAt':null}});})[_0x3039('0x30')](function(_0x1129da){var _0x21a8d0=[];_0x1129da[_0x3039('0xef')](function(_0x515693){_0x21a8d0['push'](_0x515693[_0x3039('0x1e')]({'exitAt':moment()[_0x3039('0x9e')](_0x3039('0xf0'))}));});return Promise['all'](_0x21a8d0);})[_0x3039('0x30')](function(){return _0x27f159[_0x3039('0x1e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3039('0x30')](respondWithResult(_0x1b0045,null))[_0x3039('0x4f')](handleError(_0x1b0045,null));};exports[_0x3039('0xf5')]=function(_0x8ca8cb,_0x2c10b7){var _0x998a97;return db[_0x3039('0xa1')][_0x3039('0x1e')]({'paused':0x1},{'where':{'UserId':_0x8ca8cb['params']['id']},'individualHooks':!![]})[_0x3039('0x30')](function(){return db['User'][_0x3039('0x2e')]({'where':{'id':_0x8ca8cb[_0x3039('0x50')]['id'],'role':_0x3039('0x27')},'attributes':['id',_0x3039('0x32'),_0x3039('0x1f'),'internal',_0x3039('0x93'),_0x3039('0x91')]});})['then'](handleEntityNotFound(_0x2c10b7,null))[_0x3039('0x30')](function(_0x2e7842){if(_0x2e7842){_0x998a97=_0x2e7842;return db[_0x3039('0xee')][_0x3039('0x44')]({'where':{'membername':_0x998a97['name'],'type':'PAUSE','exitAt':null}});}})[_0x3039('0x30')](function(_0x542e24){if(_0x542e24[_0x3039('0x47')]){var _0x1ccd17=moment()[_0x3039('0x9e')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x540332=0x0,_0x47dd12=_0x542e24['length'];_0x540332<_0x47dd12;_0x540332++){_0x542e24[_0x540332]['updateAttributes']({'exitAt':_0x1ccd17});}}})[_0x3039('0x30')](function(){var _0x5147d1=[];var _0x4fe789=utils[_0x3039('0xf6')]();_0x4fe789[_0x3039('0xef')](function(_0x32fce7){_0x5147d1[_0x3039('0x48')]({'channel':_0x32fce7,'membername':_0x998a97[_0x3039('0x32')],'interface':_['isNil'](_0x998a97[_0x3039('0x93')])?util[_0x3039('0x9e')]('SIP/%s',_0x998a97[_0x3039('0x32')]):_0x998a97['interface'],'type':'PAUSE','enterAt':moment()[_0x3039('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x8ca8cb[_0x3039('0x55')][_0x3039('0xf7')]||_0x3039('0xf8'),'role':_0x998a97['role'],'internal':_0x998a97[_0x3039('0x5a')]});});return db[_0x3039('0xee')]['bulkCreate'](_0x5147d1,{'individualHooks':!![]});})[_0x3039('0x30')](function(){return _0x998a97['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x8ca8cb[_0x3039('0x55')][_0x3039('0xf7')]||_0x3039('0xf8'),'lastPauseAt':moment()[_0x3039('0x9e')](_0x3039('0xf0'))});})[_0x3039('0x30')](respondWithResult(_0x2c10b7,null))['catch'](handleError(_0x2c10b7,null));};exports['unpause']=function(_0x7d0179,_0x4433f1){if(_0x7d0179[_0x3039('0x55')][_0x3039('0x90')]&&!utils[_0x3039('0x94')](_0x7d0179[_0x3039('0x55')]['channel'])){throw new APIBadRequestError(util[_0x3039('0x9e')](_0x3039('0xf9'),_0x7d0179[_0x3039('0x55')][_0x3039('0x90')]));}return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x7d0179['params']['id']},'attributes':['id',_0x3039('0x32'),'role','internal',_0x3039('0x93'),_0x3039('0x91'),_0x3039('0xa0'),_0x3039('0xfa'),_0x3039('0xfb'),_0x3039('0xfc'),_0x3039('0xfd'),'smsPause',_0x3039('0xfe'),_0x3039('0xff'),_0x3039('0x100')]})[_0x3039('0x30')](function(_0x1a6bbc){if(!_0x1a6bbc){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x7d0179[_0x3039('0x50')]['id']));}return _0x1a6bbc[_0x3039('0x101')](_0x7d0179['body']['channel']);})[_0x3039('0x30')](respondWithResult(_0x4433f1,null))['catch'](APIHandleError(_0x4433f1));};exports[_0x3039('0x102')]=function(_0x599e10,_0x2f046b){var _0x5d6b47={};var _0x3a3565={};var _0x2ea162;var _0xa4867;return db[_0x3039('0x34')]['findOne']({'where':{'id':_0x599e10[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x2f046b,null))[_0x3039('0x30')](function(_0x862545){if(_0x862545){_0x2ea162=_0x862545;_0x3a3565[_0x3039('0xc4')]=_[_0x3039('0xc5')](db[_0x3039('0x103')][_0x3039('0x35')]);_0x3a3565['query']=_[_0x3039('0xc5')](_0x599e10['query']);_0x3a3565[_0x3039('0xca')]=_['intersection'](_0x3a3565[_0x3039('0xc4')],_0x3a3565[_0x3039('0x3c')]);_0x5d6b47['attributes']=_[_0x3039('0xc6')](_0x3a3565['model'],qs[_0x3039('0xc7')](_0x599e10[_0x3039('0x3c')][_0x3039('0xc7')]));_0x5d6b47['attributes']=_0x5d6b47['attributes'][_0x3039('0x47')]?_0x5d6b47[_0x3039('0x43')]:_0x3a3565[_0x3039('0xc4')];_0x5d6b47['order']=qs[_0x3039('0xc9')](_0x599e10[_0x3039('0x3c')]['sort']);_0x5d6b47['where']=qs[_0x3039('0xca')](_['pick'](_0x599e10['query'],_0x3a3565['filters']));if(_0x599e10[_0x3039('0x3c')][_0x3039('0x2a')]){_0x5d6b47['where']=_['merge'](_0x5d6b47['where'],{'$or':_[_0x3039('0x2c')](_0x5d6b47[_0x3039('0x43')],function(_0x236b06){var _0x4c9f40={};_0x4c9f40[_0x236b06]={'$like':'%'+_0x599e10[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0x4c9f40;})});}_0x5d6b47=_[_0x3039('0x51')]({},_0x5d6b47,_0x599e10['options']);return _0x2ea162[_0x3039('0x102')](_0x5d6b47);}})[_0x3039('0x30')](function(_0x2b1961){if(_0x2b1961){_0xa4867=_0x2b1961[_0x3039('0x47')];if(!_0x599e10[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x5d6b47[_0x3039('0x1b')]=qs['limit'](_0x599e10[_0x3039('0x3c')][_0x3039('0x1b')]);_0x5d6b47[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x599e10[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x2ea162[_0x3039('0x102')](_0x5d6b47);}})['then'](function(_0xcf222a){if(_0xcf222a){return _0xcf222a?{'count':_0xa4867,'rows':_0xcf222a}:null;}})['then'](respondWithResult(_0x2f046b,null))[_0x3039('0x4f')](handleError(_0x2f046b,null));};exports['addTeams']=function(_0x2c9d44,_0x57983a){var _0x1a403f=_0x2c9d44[_0x3039('0x50')]['id'];var _0x1ff44f=_0x2c9d44[_0x3039('0x55')]?_0x2c9d44[_0x3039('0x55')][_0x3039('0x58')]:null;var _0x842a12=[];return Promise[_0x3039('0x104')]()['then'](function(){if(!_0x1ff44f)throw new APIBadRequestError(_0x3039('0x105'));})['then'](function(){return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x1a403f}});})[_0x3039('0x30')](function(_0x2c9cc1){if(!_0x2c9cc1)throw new APINotFoundError(util[_0x3039('0x9e')](_0x3039('0xbe'),_0x2c9d44['params']['id']));return db[_0x3039('0x62')]['transaction'](function(_0x1789d1){return _0x2c9cc1['addTeams'](_0x1ff44f,{'transaction':_0x1789d1})[_0x3039('0x30')](function(){return db[_0x3039('0x103')][_0x3039('0x44')]({'where':{'id':{'$in':_0x1ff44f}}});})['then'](function(_0x1fce29){var _0x3fc961=_['map'](_0x1fce29,function(_0x4d0997){return _0x4d0997[_0x3039('0x106')]();});return Promise['all'](_0x3fc961);})['then'](function(_0x550d0b){_0x842a12=_[_0x3039('0x107')](_0x550d0b);var _0x1021b3=_['map'](_0x842a12,function(_0x279010){return _0x279010[_0x3039('0x108')](_0x2c9cc1['id'],{'transaction':_0x1789d1});});return Promise[_0x3039('0x4e')](_0x1021b3);})[_0x3039('0x30')](function(){if(!_0x2c9cc1[_0x3039('0x91')])return;var _0x563f7f=_[_0x3039('0x2a')](_0x842a12,function(_0x77dbf4){return _0x77dbf4['getDataValue'](_0x3039('0x90'))===_0x3039('0x109');});var _0x244146=_[_0x3039('0x2c')](_0x563f7f,function(_0x2fe280){return db[_0x3039('0xa1')][_0x3039('0x10a')]({'membername':_0x2c9cc1['name'],'UserId':_0x2c9cc1['id'],'queue_name':_0x2fe280[_0x3039('0x32')],'VoiceQueueId':_0x2fe280['id'],'interface':_[_0x3039('0x64')](_0x2c9cc1['interface'])?util[_0x3039('0x9e')](_0x3039('0x9f'),_0x2c9cc1[_0x3039('0x32')]):_0x2c9cc1[_0x3039('0x93')],'paused':_0x2c9cc1[_0x3039('0xa0')]||![],'penalty':_0x2c9cc1['penalty']},{'transaction':_0x1789d1});});return Promise[_0x3039('0x4e')](_0x244146);})[_0x3039('0x30')](function(){return db['TeamVoicePrefix'][_0x3039('0x44')]({'where':{'teamId':{'$in':_0x1ff44f}}});})[_0x3039('0x30')](function(_0xec2c77){var _0x168f92=_[_0x3039('0x2c')](_0xec2c77,function(_0x189dac){return db[_0x3039('0x10b')]['create']({'UserId':_0x2c9cc1['id'],'VoicePrefixId':_0x189dac[_0x3039('0x10c')]},{'transaction':_0x1789d1});});return Promise[_0x3039('0x4e')](_0x168f92);});});})[_0x3039('0x30')](function(){for(var _0x536145=0x0;_0x536145<_0x842a12['length'];_0x536145++){var _0x3641e1=_0x842a12[_0x536145][_0x3039('0x10d')](_0x3039('0x90'));var _0x4d04f2=_0x3641e1+_0x3039('0x9a');socket[_0x3039('0x20')](_0x3039('0x25')+_0x3641e1+_0x3039('0x9b'),{'UserId':_0x1a403f,['queueField']:_0x842a12[_0x536145]['id']});}})[_0x3039('0x30')](respondWithStatusCode(_0x57983a,null))['catch'](APIHandleError(_0x57983a));};exports[_0x3039('0x10e')]=function(_0x3f87b7,_0x3e7cf7){var _0x39e739=_0x3f87b7[_0x3039('0x50')]['id'];var _0x28be22=null;if(_0x3f87b7[_0x3039('0x3c')][_0x3039('0x58')]){_0x28be22=_['isArray'](_0x3f87b7[_0x3039('0x3c')][_0x3039('0x58')])?_0x3f87b7['query']['ids']:[_0x3f87b7[_0x3039('0x3c')][_0x3039('0x58')]];}var _0x1cf979=[];return Promise[_0x3039('0x104')]()[_0x3039('0x30')](function(){if(!_0x28be22)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x39e739}});})[_0x3039('0x30')](function(_0x4d269e){if(!_0x4d269e)throw new APINotFoundError(util['format'](_0x3039('0xbe'),_0x3f87b7[_0x3039('0x50')]['id']));return db[_0x3039('0x62')][_0x3039('0x10f')](function(_0x2f8a04){return _0x4d269e[_0x3039('0x10e')](_0x28be22,{'transaction':_0x2f8a04})[_0x3039('0x30')](function(){return db[_0x3039('0x103')]['findAll']({'where':{'id':{'$in':_0x28be22}}});})[_0x3039('0x30')](function(_0x1ed161){var _0x1f2e43=_['map'](_0x1ed161,function(_0x4d2cb7){return _0x4d2cb7[_0x3039('0x106')]();});return Promise[_0x3039('0x4e')](_0x1f2e43);})[_0x3039('0x30')](function(_0x5d8f34){_0x1cf979=_[_0x3039('0x107')](_0x5d8f34);var _0x2178a0=_[_0x3039('0x2c')](_0x1cf979,function(_0x2869b0){return _0x2869b0[_0x3039('0x110')](_0x4d269e['id'],{'transaction':_0x2f8a04});});return Promise[_0x3039('0x4e')](_0x2178a0);})[_0x3039('0x30')](function(){if(!_0x4d269e[_0x3039('0x91')])return;var _0x3ec9f6=_[_0x3039('0x2a')](_0x1cf979,function(_0x5ba26c){return _0x5ba26c[_0x3039('0x10d')](_0x3039('0x90'))==='Voice';});var _0x7a07d6=_[_0x3039('0x2c')](_0x3ec9f6,function(_0x53bf2f){return db[_0x3039('0xa1')][_0x3039('0xa6')]({'where':{'VoiceQueueId':_0x53bf2f['id'],'UserId':_0x4d269e['id']},'transaction':_0x2f8a04});});return Promise[_0x3039('0x4e')](_0x7a07d6);})[_0x3039('0x30')](function(){return db[_0x3039('0x111')]['findAll']({'where':{'teamId':{'$in':_0x28be22}}});})[_0x3039('0x30')](function(_0x184908){var _0x51c4fb=_[_0x3039('0x2c')](_0x184908,function(_0x296985){return db['UserVoicePrefix'][_0x3039('0xa6')]({'where':{'UserId':_0x4d269e['id'],'VoicePrefixId':_0x296985['VoicePrefixId']}},{'transaction':_0x2f8a04});});return Promise[_0x3039('0x4e')](_0x51c4fb);});});})[_0x3039('0x30')](function(){for(var _0x2e2a6a=0x0;_0x2e2a6a<_0x1cf979[_0x3039('0x47')];_0x2e2a6a++){var _0x33349c=_0x1cf979[_0x2e2a6a][_0x3039('0x10d')](_0x3039('0x90'));var _0x459618=_0x33349c+'QueueId';socket[_0x3039('0x20')]('user'+_0x33349c+_0x3039('0xa5'),{'UserId':_0x39e739,['queueField']:_0x1cf979[_0x2e2a6a]['id']});}})[_0x3039('0x30')](respondWithStatusCode(_0x3e7cf7,null))[_0x3039('0x4f')](APIHandleError(_0x3e7cf7));};exports[_0x3039('0x112')]=function(_0x55c2f4,_0x229baf){var _0x1e2db0={};var _0x507c64={};var _0x3b3b55;var _0x48bdde;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x55c2f4[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x229baf,null))[_0x3039('0x30')](function(_0x2ecc90){if(_0x2ecc90){_0x3b3b55=_0x2ecc90;_0x507c64['model']=_[_0x3039('0xc5')](db[_0x3039('0x113')][_0x3039('0x35')]);_0x507c64[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x55c2f4[_0x3039('0x3c')]);_0x507c64[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x507c64['model'],_0x507c64[_0x3039('0x3c')]);_0x1e2db0[_0x3039('0x43')]=_['intersection'](_0x507c64['model'],qs[_0x3039('0xc7')](_0x55c2f4[_0x3039('0x3c')][_0x3039('0xc7')]));_0x1e2db0[_0x3039('0x43')]=_0x1e2db0[_0x3039('0x43')][_0x3039('0x47')]?_0x1e2db0[_0x3039('0x43')]:_0x507c64[_0x3039('0xc4')];_0x1e2db0[_0x3039('0xc8')]=qs['sort'](_0x55c2f4[_0x3039('0x3c')]['sort']);_0x1e2db0[_0x3039('0x3b')]=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x55c2f4[_0x3039('0x3c')],_0x507c64['filters']));if(_0x55c2f4[_0x3039('0x3c')]['filter']){_0x1e2db0['where']=_[_0x3039('0x51')](_0x1e2db0[_0x3039('0x3b')],{'$or':_['map'](_0x1e2db0[_0x3039('0x43')],function(_0x11c3b2){var _0x4cb068={};_0x4cb068[_0x11c3b2]={'$like':'%'+_0x55c2f4[_0x3039('0x3c')]['filter']+'%'};return _0x4cb068;})});}_0x1e2db0=_[_0x3039('0x51')]({},_0x1e2db0,_0x55c2f4[_0x3039('0x52')]);return _0x3b3b55[_0x3039('0x112')](_0x1e2db0);}})[_0x3039('0x30')](function(_0x1a87f3){if(_0x1a87f3){_0x48bdde=_0x1a87f3[_0x3039('0x47')];if(!_0x55c2f4[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x1e2db0[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x55c2f4[_0x3039('0x3c')]['limit']);_0x1e2db0['offset']=qs['offset'](_0x55c2f4[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x3b3b55[_0x3039('0x112')](_0x1e2db0);}})[_0x3039('0x30')](function(_0x3f15ad){if(_0x3f15ad){return _0x3f15ad?{'count':_0x48bdde,'rows':_0x3f15ad}:null;}})[_0x3039('0x30')](respondWithResult(_0x229baf,null))[_0x3039('0x4f')](handleError(_0x229baf,null));};exports[_0x3039('0x114')]=function(_0x29568a,_0x267d07){var _0x1ca46d={};var _0xbaba7c={};var _0x50dd93;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x29568a[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x267d07,null))[_0x3039('0x30')](function(_0x5d8573){if(_0x5d8573){_0x50dd93=_0x5d8573;_0xbaba7c[_0x3039('0xc4')]=_['keys'](db[_0x3039('0x34')][_0x3039('0x35')]);_0xbaba7c[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x29568a[_0x3039('0x3c')]);_0xbaba7c[_0x3039('0xca')]=_[_0x3039('0xc6')](_0xbaba7c[_0x3039('0xc4')],_0xbaba7c[_0x3039('0x3c')]);_0x1ca46d['attributes']=_['intersection'](_0xbaba7c['model'],qs[_0x3039('0xc7')](_0x29568a['query'][_0x3039('0xc7')]));_0x1ca46d[_0x3039('0x43')]=_0x1ca46d[_0x3039('0x43')]['length']?_0x1ca46d[_0x3039('0x43')]:_0xbaba7c[_0x3039('0xc4')];_0x1ca46d[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x29568a[_0x3039('0x3c')]['sort']);_0x1ca46d['where']=qs[_0x3039('0xca')](_['pick'](_0x29568a[_0x3039('0x3c')],_0xbaba7c[_0x3039('0xca')]));if(_0x29568a[_0x3039('0x3c')][_0x3039('0x2a')]){_0x1ca46d[_0x3039('0x3b')]=_[_0x3039('0x51')](_0x1ca46d['where'],{'$or':_[_0x3039('0x2c')](_0x1ca46d[_0x3039('0x43')],function(_0x2a7468){var _0x45094c={};_0x45094c[_0x2a7468]={'$like':'%'+_0x29568a[_0x3039('0x3c')]['filter']+'%'};return _0x45094c;})});}_0x1ca46d[_0x3039('0xc4')]=db[_0x3039('0x34')];_0x1ca46d['as']='Agents';_0x1ca46d=_[_0x3039('0x51')]({},_0x1ca46d,_0x29568a[_0x3039('0x52')]);return _0x50dd93[_0x3039('0xec')]({'include':[_0x1ca46d]});}})[_0x3039('0x30')](function(_0xde2da5){if(_0xde2da5){var _0x1b8a5c={},_0x544b6f=[];for(var _0x3551c2=0x0;_0x3551c2<_0xde2da5[_0x3039('0x47')];_0x3551c2+=0x1){for(var _0x395929=0x0,_0x113bcf;_0x395929<_0xde2da5[_0x3551c2]['Agents'][_0x3039('0x47')];_0x395929+=0x1){_0x113bcf=_0xde2da5[_0x3551c2][_0x3039('0x26')][_0x395929]['get']({'plain':!![]});_0x1b8a5c[_0x113bcf['id']]=_0x113bcf;}}_0x1b8a5c=_[_0x3039('0x115')](_0x1b8a5c);for(var _0x2c7416=qs[_0x3039('0x19')](_0x29568a[_0x3039('0x3c')]['offset']);_0x2c7416<_0x1b8a5c[_0x3039('0x47')]&&_0x544b6f['length']=_0x1a78a4){_0x57aa95=_0x1a78a4;_0x2395c1=0xc8;}else{_0x2395c1=0xce;}_0x25aba5['status'](_0x2395c1);return _0x25aba5['set']('Content-Range',_0x4f9557+'-'+_0x57aa95+'/'+_0x1a78a4)[_0xe3d0('0x18')](_0xd468e6);}return null;};}function saveUpdates(_0xd9b1d0){return function(_0x2e5fd4){if(_0x2e5fd4){return _0x2e5fd4[_0xe3d0('0x1d')](_0xd9b1d0)[_0xe3d0('0x1e')](function(_0x8c5cf3){if(_0x8c5cf3[_0xe3d0('0x1f')]===_0xe3d0('0x20')){socket['emit'](_0xe3d0('0x21')+_0x8c5cf3['id'],_0x8c5cf3);}return _0x8c5cf3;});}return null;};}function removeEntity(_0x5e9e58,_0x25e525){return function(_0x20b258){if(_0x20b258){return _0x20b258[_0xe3d0('0x22')]({'transaction':_0x25e525})[_0xe3d0('0x1e')](function(){var _0x4180f2=_0x20b258[_0xe3d0('0x23')]({'plain':!![]});if(_0x4180f2[_0xe3d0('0x1f')]===_0xe3d0('0x24'))return;var _0x18282b=[{'name':_0xe3d0('0x25'),'value':'user','ignore':!![]},{'name':_0xe3d0('0x26'),'value':_0xe3d0('0x20'),'ignore':![]},{'name':'Telephones','value':_0xe3d0('0x27'),'ignore':![]}];var _0x14b6c1=_(_0x18282b)[_0xe3d0('0x28')](_0xe3d0('0x29'))[_0xe3d0('0x2a')](_0xe3d0('0x2b'))[_0xe3d0('0x2b')]();if(_[_0xe3d0('0x2c')](_0x14b6c1,_0x4180f2[_0xe3d0('0x1f')])){return;}var _0x2b5653=_[_0xe3d0('0x2d')](_0x18282b,[_0xe3d0('0x2b'),_0x4180f2[_0xe3d0('0x1f')]])[_0xe3d0('0x2e')];return db[_0xe3d0('0x2f')][_0xe3d0('0x22')]({'where':{'type':_0x2b5653,'resourceId':_0x4180f2['id']},'transaction':_0x25e525})['then'](function(){return _0x20b258;});})[_0xe3d0('0x1e')](function(){_0x5e9e58['status'](0xcc)[_0xe3d0('0x30')]();});}};}function handleEntityNotFound(_0x1ad952){return function(_0x23a763){if(!_0x23a763){_0x1ad952[_0xe3d0('0x16')](0x194);}return _0x23a763;};}function handleError(_0x51f7a7,_0x392605){_0x392605=_0x392605||0x1f4;return function(_0x50bb4a){logger[_0xe3d0('0x31')](_0x50bb4a[_0xe3d0('0x32')]);if(_0x50bb4a['name']){delete _0x50bb4a['name'];}_0x51f7a7['status'](_0x392605)[_0xe3d0('0x33')](_0x50bb4a);};}function getUserAttributes(){return _(db[_0xe3d0('0x34')][_0xe3d0('0x35')])['map'](function(_0x196bda){return{'name':_0x196bda[_0xe3d0('0x36')],'type':_0x196bda[_0xe3d0('0x37')][_0xe3d0('0x38')]};})[_0xe3d0('0x28')](function(_0x5f07a6){return![_0xe3d0('0x39'),_0xe3d0('0x3a'),_0xe3d0('0x3b'),_0xe3d0('0x3c'),_0xe3d0('0x3d'),_0xe3d0('0x3e')][_0xe3d0('0x2c')](_0x5f07a6['name']);})['value']();}exports[_0xe3d0('0x3f')]=function(_0xf58d87,_0x2cf5d3){var _0x3ea962={},_0x5f57e8={'count':0x0,'rows':[]};var _0x4ad6a=getUserAttributes();_0x3ea962=qs[_0xe3d0('0x40')](_0x4ad6a,_0xf58d87);var _0x592c59={'where':_0x3ea962[_0xe3d0('0x41')]};return db[_0xe3d0('0x34')]['count'](_0x592c59)[_0xe3d0('0x1e')](function(_0x1ec5e7){_0x5f57e8['count']=_0x1ec5e7;if(_0xf58d87[_0xe3d0('0x42')][_0xe3d0('0x43')]){_0x3ea962[_0xe3d0('0x44')]=[{'all':!![]}];}if(_0xf58d87[_0xe3d0('0x42')]['userSetting']==='true'){_0x3ea962[_0xe3d0('0x44')]=[{'model':db[_0xe3d0('0x45')],'as':'userSetting'}];}if(!_[_0xe3d0('0x2c')](_0x3ea962[_0xe3d0('0x46')],'id')){_0x3ea962[_0xe3d0('0x46')][_0xe3d0('0x47')]('id');}return db[_0xe3d0('0x34')][_0xe3d0('0x48')](_0x3ea962);})[_0xe3d0('0x1e')](function(_0x286a42){_0x5f57e8[_0xe3d0('0x49')]=_0x286a42;if(_0xf58d87[_0xe3d0('0x42')]['openTabs']===_0xe3d0('0x4a')){var _0x339aa2=[];for(var _0x1f3cc2=0x0;_0x1f3cc2<_0x5f57e8[_0xe3d0('0x49')][_0xe3d0('0x4b')];_0x1f3cc2++){_0x339aa2[_0xe3d0('0x47')](get_open_tabs('chat',_0x5f57e8['rows'][_0x1f3cc2][_0xe3d0('0x4c')]));_0x339aa2[_0xe3d0('0x47')](get_open_tabs(_0xe3d0('0x4d'),_0x5f57e8[_0xe3d0('0x49')][_0x1f3cc2]['dataValues']));_0x339aa2[_0xe3d0('0x47')](get_open_tabs(_0xe3d0('0x4e'),_0x5f57e8['rows'][_0x1f3cc2]['dataValues']));_0x339aa2[_0xe3d0('0x47')](get_open_tabs(_0xe3d0('0x4f'),_0x5f57e8['rows'][_0x1f3cc2][_0xe3d0('0x4c')]));_0x339aa2[_0xe3d0('0x47')](get_open_tabs('openchannel',_0x5f57e8[_0xe3d0('0x49')][_0x1f3cc2][_0xe3d0('0x4c')]));_0x339aa2[_0xe3d0('0x47')](get_open_tabs(_0xe3d0('0x50'),_0x5f57e8[_0xe3d0('0x49')][_0x1f3cc2][_0xe3d0('0x4c')]));}return Promise[_0xe3d0('0x51')](_0x339aa2)[_0xe3d0('0x1e')](function(){return _0x5f57e8;});}else{return _0x5f57e8;}})['then'](respondWithFilteredResult(_0x2cf5d3,_0x3ea962))[_0xe3d0('0x52')](handleError(_0x2cf5d3,null));};exports[_0xe3d0('0x53')]=function(_0x118ba3,_0x439774){var _0x3dfc0e=getUserAttributes();_0x118ba3[_0xe3d0('0x42')]['id']=_0x118ba3[_0xe3d0('0x54')]['id'];var _0x17927d=qs[_0xe3d0('0x40')](_0x3dfc0e,_0x118ba3);if(_0x118ba3[_0xe3d0('0x42')]['includeAll']){_0x17927d[_0xe3d0('0x44')]=[{'all':!![]}];}if(_0x118ba3[_0xe3d0('0x42')][_0xe3d0('0x55')]===_0xe3d0('0x4a')){_0x17927d['include']=[{'model':db[_0xe3d0('0x45')],'as':_0xe3d0('0x55')}];}_0x17927d=_[_0xe3d0('0x56')]({},_0x17927d,_0x118ba3['options']);if(!_[_0xe3d0('0x2c')](_0x17927d[_0xe3d0('0x46')],'id')){_0x17927d['attributes']['push']('id');}return db[_0xe3d0('0x34')]['find'](_0x17927d)[_0xe3d0('0x1e')](handleEntityNotFound(_0x439774,null))[_0xe3d0('0x1e')](function(_0x5cb49f){var _0x180adf=[];values=_0x5cb49f;if(_0x118ba3['query'][_0xe3d0('0x57')]==='true'){_0x180adf[_0xe3d0('0x47')](get_open_tabs(_0xe3d0('0x58'),_0x5cb49f[_0xe3d0('0x4c')]));_0x180adf['push'](get_open_tabs(_0xe3d0('0x4d'),_0x5cb49f['dataValues']));_0x180adf[_0xe3d0('0x47')](get_open_tabs('openchannel',_0x5cb49f['dataValues']));_0x180adf['push'](get_open_tabs('whatsapp',_0x5cb49f[_0xe3d0('0x4c')]));_0x180adf[_0xe3d0('0x47')](get_open_tabs('fax',_0x5cb49f[_0xe3d0('0x4c')]));_0x180adf[_0xe3d0('0x47')](get_open_tabs(_0xe3d0('0x4f'),_0x5cb49f['dataValues']));return Promise[_0xe3d0('0x51')](_0x180adf);}else{return values;}})[_0xe3d0('0x1e')](function(){return values;})[_0xe3d0('0x1e')](respondWithResult(_0x439774,null))[_0xe3d0('0x52')](handleError(_0x439774,null));};exports[_0xe3d0('0x1d')]=function(_0x556193,_0x4fa181){if(_0x556193['body']['id']){delete _0x556193[_0xe3d0('0x59')]['id'];}delete _0x556193[_0xe3d0('0x59')][_0xe3d0('0x1f')];return db['User'][_0xe3d0('0x2d')]({'where':{'id':_0x556193[_0xe3d0('0x54')]['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x4fa181,null))[_0xe3d0('0x1e')](saveUpdates(_0x556193[_0xe3d0('0x59')],null))[_0xe3d0('0x1e')](respondWithResult(_0x4fa181,null))[_0xe3d0('0x52')](handleError(_0x4fa181,null));};exports['describe']=function(_0x4f0a97,_0x293657){return db[_0xe3d0('0x34')][_0xe3d0('0x5a')]()[_0xe3d0('0x1e')](respondWithResult(_0x293657,null))['catch'](handleError(_0x293657,null));};exports[_0xe3d0('0x5b')]=function(_0x25a738,_0x368864){return db['User'][_0xe3d0('0x2d')]({'where':{'id':_0x25a738['params']['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x368864,null))['then'](function(_0xbeb1f){if(_0xbeb1f){return _0xbeb1f[_0xe3d0('0x5b')](_0x25a738[_0xe3d0('0x59')]['ids'],_[_0xe3d0('0x5c')](_0x25a738[_0xe3d0('0x59')],[_0xe3d0('0x5d'),'id'])||{});}})[_0xe3d0('0x1e')](respondWithResult(_0x368864,null))[_0xe3d0('0x52')](handleError(_0x368864,null));};function validateUser(_0xb37251){return new Promise(function(_0x45d619,_0x3ba28f){if(_0xb37251[_0xe3d0('0x5e')])return _0x45d619(_0xb37251);return db[_0xe3d0('0x5f')]['findById'](0x1)[_0xe3d0('0x1e')](function(_0x2018e0){if(_0x2018e0[_0xe3d0('0x60')])authService[_0xe3d0('0x61')](_0xb37251[_0xe3d0('0x39')]);db[_0xe3d0('0x34')][_0xe3d0('0x62')](_0xe3d0('0x5e'))[_0xe3d0('0x1e')](function(_0x3b1f95){if(_[_0xe3d0('0x63')](_0x3b1f95)){_0xb37251[_0xe3d0('0x5e')]=_0x2018e0[_0xe3d0('0x64')]||0x1;return;}if(_['isNil'](_0x2018e0['min_internal'])||_0x2018e0[_0xe3d0('0x64')]===_0x3b1f95){_0xb37251['internal']=_0x3b1f95+0x1;return;}if(_0x2018e0[_0xe3d0('0x64')]>_0x3b1f95){_0xb37251[_0xe3d0('0x5e')]=_0x2018e0[_0xe3d0('0x64')];return;}return db[_0xe3d0('0x65')][_0xe3d0('0x42')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0xe3d0('0x66')]['SELECT']})['then'](function(_0x385483){if(_0x385483&&_0x385483[_0xe3d0('0x4b')]){for(var _0x12292d=0x0,_0x3b0f9f=_0x385483[_0xe3d0('0x4b')];_0x12292d<_0x3b0f9f&&_[_0xe3d0('0x63')](_0xb37251[_0xe3d0('0x5e')]);_0x12292d++){if(_0x2018e0[_0xe3d0('0x64')]<=_0x385483[_0x12292d][_0xe3d0('0x67')]){_0xb37251[_0xe3d0('0x5e')]=_0x385483[_0x12292d][_0xe3d0('0x67')];}else if(_0x2018e0[_0xe3d0('0x64')]>_0x385483[_0x12292d][_0xe3d0('0x67')]&&_0x2018e0[_0xe3d0('0x64')]<=_0x385483[_0x12292d]['to']){_0xb37251['internal']=_0x2018e0[_0xe3d0('0x64')];}}}if(_[_0xe3d0('0x63')](_0xb37251[_0xe3d0('0x5e')])){_0xb37251['internal']=_0x3b1f95+0x1;}return _0x45d619(_0xb37251);});});})[_0xe3d0('0x52')](function(_0x5ce4c4){_0x3ba28f(_0x5ce4c4);});});}function updateUser(_0x192c9d){return new Promise(function(_0x41e8f3,_0x19cb85){try{if(_0x192c9d['voicemail']){_0x192c9d[_0xe3d0('0x68')]=_0x192c9d[_0xe3d0('0x5e')];_0x192c9d[_0xe3d0('0x69')]={'mailbox':_0x192c9d[_0xe3d0('0x5e')],'password':_0x192c9d['password'],'fullname':_0x192c9d['fullname'],'email':_0x192c9d[_0xe3d0('0x6a')]};}if(_0x192c9d[_0xe3d0('0x1f')]===_0xe3d0('0x20')){if(!_0x192c9d['permissions'])_0x192c9d[_0xe3d0('0x6b')]=[_0xe3d0('0x6c'),_0xe3d0('0x6d'),'103',_0xe3d0('0x6e'),_0xe3d0('0x6f'),_0xe3d0('0x70'),_0xe3d0('0x71'),_0xe3d0('0x72'),'107',_0xe3d0('0x73'),_0xe3d0('0x74'),_0xe3d0('0x75'),_0xe3d0('0x76'),_0xe3d0('0x77'),_0xe3d0('0x78')];}_0x41e8f3(_0x192c9d);}catch(_0xdf0882){_0x19cb85(_0xdf0882);}});}exports[_0xe3d0('0x79')]=function(_0x391b2c,_0xdb5fcd){if(_0x391b2c[_0xe3d0('0x7a')]['role']===_0xe3d0('0x20'))throw new Error('Unauthorized');if(_0x391b2c[_0xe3d0('0x59')][_0xe3d0('0x1f')]===_0xe3d0('0x7a')&&_0x391b2c[_0xe3d0('0x7a')][_0xe3d0('0x1f')]!=='admin'){throw new Error(_0xe3d0('0x7b'));}if(_0x391b2c['body'][_0xe3d0('0x1f')]===_0xe3d0('0x24')&&_0x391b2c['user'][_0xe3d0('0x1f')]!=='admin'){throw new Error(_0xe3d0('0x7c'));}return licenseUtil[_0xe3d0('0x7d')]([_0x391b2c[_0xe3d0('0x59')]])['then'](function(){return validateUser(_0x391b2c[_0xe3d0('0x59')]);})[_0xe3d0('0x1e')](function(_0x3ead4f){return updateUser(_0x3ead4f)[_0xe3d0('0x1e')](function(_0x33660b){if(_0x33660b[_0xe3d0('0x1f')]==='admin'){_0x33660b[_0xe3d0('0x7e')]=_0x391b2c['user'][_0xe3d0('0x7e')];delete _0x33660b['userProfileId'];}return _0x33660b;});})[_0xe3d0('0x1e')](function(_0x51f80b){return db[_0xe3d0('0x34')][_0xe3d0('0x79')](_0x51f80b,{'include':[{'model':db[_0xe3d0('0x69')],'as':_0xe3d0('0x69')}]});})['then'](function(_0x1b8ade){if(_0x391b2c[_0xe3d0('0x59')][_0xe3d0('0x1f')]===_0xe3d0('0x7a'))return _0x1b8ade;if(_0x391b2c['user'][_0xe3d0('0x1f')]!==_0xe3d0('0x7a'))return _0x1b8ade;return db[_0xe3d0('0x7f')]['find']({'where':{'name':_0x1b8ade['role']===_0xe3d0('0x20')?'Agents':'Telephones','userProfileId':_0x391b2c[_0xe3d0('0x7a')]['userProfileId']},'raw':!![]})[_0xe3d0('0x1e')](function(_0x2cc268){if(!_0x2cc268||_0x2cc268[_0xe3d0('0x80')]!=0x0)return _0x1b8ade;return db[_0xe3d0('0x2f')][_0xe3d0('0x79')]({'name':_0x1b8ade[_0xe3d0('0x2e')],'resourceId':_0x1b8ade['id'],'type':_0x2cc268[_0xe3d0('0x2e')],'sectionId':_0x2cc268['id']},{})[_0xe3d0('0x1e')](function(){return _0x1b8ade;});})['catch'](function(_0x1b0e06){logger[_0xe3d0('0x31')](_0xe3d0('0x81'),_0x1b0e06);throw _0x1b0e06;});})['then'](respondWithResult(_0xdb5fcd,0xc9))['catch'](handleError(_0xdb5fcd,null));};exports[_0xe3d0('0x82')]=function(_0x3502aa,_0x945c53){var _0x1a1ec7=_0x3502aa[_0xe3d0('0x59')];var _0x119df6=[];if(_0x3502aa[_0xe3d0('0x7a')]['role']===_0xe3d0('0x20'))throw new Error('Unauthorized');if(_['some'](_0x1a1ec7,[_0xe3d0('0x1f'),_0xe3d0('0x7a')])&&_0x3502aa[_0xe3d0('0x7a')][_0xe3d0('0x1f')]!==_0xe3d0('0x24')){throw new Error(_0xe3d0('0x7b'));}if(_['some'](_0x1a1ec7,['role',_0xe3d0('0x24')])&&_0x3502aa['user']['role']!==_0xe3d0('0x24')){throw new Error(_0xe3d0('0x83'));}return licenseUtil[_0xe3d0('0x7d')](_0x1a1ec7)['then'](function(){return validateUser(_0x1a1ec7[0x0]);})[_0xe3d0('0x1e')](function(){for(var _0xb59f57=0x1;_0xb59f57<_0x1a1ec7[_0xe3d0('0x4b')];_0xb59f57++){var _0x1c7b24=_0x1a1ec7[_0xb59f57-0x1][_0xe3d0('0x5e')];if(!_0x1a1ec7[_0xb59f57][_0xe3d0('0x5e')])_0x1a1ec7[_0xb59f57][_0xe3d0('0x5e')]=_0x1c7b24+0x1;_0x119df6['push'](validateUser(_0x1a1ec7[_0xb59f57]));}return Promise[_0xe3d0('0x51')](_0x119df6);})['then'](function(){_0x119df6=[];for(var _0x2a0824=0x0;_0x2a0824<_0x1a1ec7[_0xe3d0('0x4b')];_0x2a0824++){_0x119df6['push'](updateUser(_0x1a1ec7[_0x2a0824]));}return Promise[_0xe3d0('0x51')](_0x119df6);})[_0xe3d0('0x1e')](function(){_0x119df6=_0x1a1ec7[_0xe3d0('0x2a')](function(_0x4736bb){return db[_0xe3d0('0x34')][_0xe3d0('0x79')](_0x4736bb,{'include':[{'model':db['VoiceMail'],'as':_0xe3d0('0x69')}]})[_0xe3d0('0x1e')](function(_0xd2f8d9){_0x4736bb['id']=_0xd2f8d9['id'];return _0x4736bb;});});return Promise[_0xe3d0('0x51')](_0x119df6);})[_0xe3d0('0x1e')](function(_0x24bf49){if(_0x3502aa[_0xe3d0('0x59')][_0xe3d0('0x1f')]==='user')return _0x24bf49;if(_0x3502aa['user'][_0xe3d0('0x1f')]!==_0xe3d0('0x7a'))return _0x24bf49;var _0x2a1889=_[_0xe3d0('0x84')](_0x24bf49,function(_0x21ba85){return _0x21ba85[_0xe3d0('0x1f')]==='agent'||_0x21ba85[_0xe3d0('0x1f')]===_0xe3d0('0x27');});if(!_0x2a1889)return _0x24bf49;return db[_0xe3d0('0x7f')]['findAll']({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x3502aa[_0xe3d0('0x7a')][_0xe3d0('0x85')]},'raw':!![]})[_0xe3d0('0x1e')](function(_0xd74f7c){if(_[_0xe3d0('0x86')](_0xd74f7c)||!_['some'](_0xd74f7c,[_0xe3d0('0x80'),0x0]))return _0x24bf49;_0x119df6=[];var _0x4fb565=_(_0xd74f7c)[_0xe3d0('0x2a')](function(_0x32d595){if(_0x32d595[_0xe3d0('0x80')]===0x1)return;return _0x32d595[_0xe3d0('0x2e')]==='Agents'?_0xe3d0('0x20'):_0xe3d0('0x27');})['compact']()['value']();for(var _0x13d944=0x0;_0x13d944<_0x24bf49[_0xe3d0('0x4b')];_0x13d944++){if(!_[_0xe3d0('0x2c')](_0x4fb565,_0x24bf49[_0x13d944][_0xe3d0('0x1f')]))return;var _0x59e686=_0x24bf49[_0x13d944]['role']===_0xe3d0('0x20')?_0xe3d0('0x26'):_0xe3d0('0x87');_0x119df6[_0xe3d0('0x47')](db['UserProfileResource'][_0xe3d0('0x79')]({'name':_0x24bf49[_0x13d944][_0xe3d0('0x2e')],'resourceId':_0x24bf49[_0x13d944]['id'],'type':_0x59e686,'sectionId':_[_0xe3d0('0x2d')](_0xd74f7c,[_0xe3d0('0x2e'),_0x59e686])['id']},{}));}return Promise['all'](_0x119df6);});})[_0xe3d0('0x1e')](respondWithResult(_0x945c53,0xc9))[_0xe3d0('0x52')](handleError(_0x945c53,null));};exports[_0xe3d0('0x88')]=function(_0x2c0923,_0x20f2ad){if(_0x2c0923[_0xe3d0('0x59')]['id']){delete _0x2c0923[_0xe3d0('0x59')]['id'];}return db[_0xe3d0('0x34')][_0xe3d0('0x2d')]({'where':{'id':_0x2c0923[_0xe3d0('0x54')]['id']}})[_0xe3d0('0x1e')](function(_0x1a3d89){if(!_0x1a3d89)return null;if(_0x1a3d89['id']===_0x2c0923['user']['id']){if(!_0x2c0923[_0xe3d0('0x59')][_0xe3d0('0x89')]||!_0x2c0923[_0xe3d0('0x59')][_0xe3d0('0x8a')]){throw new db[(_0xe3d0('0x8b'))][(_0xe3d0('0x8c'))](_0xe3d0('0x8d'));}if(!_0x1a3d89[_0xe3d0('0x8e')](_0x2c0923['body']['oldPassword'])){throw new db[(_0xe3d0('0x8b'))][(_0xe3d0('0x8c'))](_0xe3d0('0x8f'));}if(_0x2c0923['body'][_0xe3d0('0x89')]===_0x2c0923[_0xe3d0('0x59')]['newPassword']){throw new db[(_0xe3d0('0x8b'))]['ValidationError'](_0xe3d0('0x90'));}}else if(_0x2c0923[_0xe3d0('0x7a')][_0xe3d0('0x1f')]==='admin'){if(!_0x2c0923[_0xe3d0('0x59')][_0xe3d0('0x8a')]){throw new db[(_0xe3d0('0x8b'))][(_0xe3d0('0x8c'))](_0xe3d0('0x91'));}}else if(_0x2c0923[_0xe3d0('0x7a')][_0xe3d0('0x1f')]===_0xe3d0('0x7a')){if(!_0x2c0923[_0xe3d0('0x59')][_0xe3d0('0x8a')]){throw new db['Sequelize'][(_0xe3d0('0x8c'))](_0xe3d0('0x91'));}if(_0x1a3d89[_0xe3d0('0x1f')]!==_0xe3d0('0x20')){throw new db[(_0xe3d0('0x8b'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0xe3d0('0x8b'))][(_0xe3d0('0x8c'))](_0xe3d0('0x92'));}return _0x1a3d89;})[_0xe3d0('0x1e')](handleEntityNotFound(_0x20f2ad,null))['then'](function(_0x167ebc){return db[_0xe3d0('0x5f')]['findOne']({'attributes':['id',_0xe3d0('0x60'),_0xe3d0('0x93'),_0xe3d0('0x94')]})['then'](function(_0x35d59f){if(_0x35d59f[_0xe3d0('0x60')])authService[_0xe3d0('0x61')](_0x2c0923[_0xe3d0('0x59')]['newPassword']);if(!_0x35d59f['enforcePasswordHistory']||!_0x167ebc['previousPasswords'])return _0x167ebc;authService['validatePasswordHistory'](_0x2c0923['body'][_0xe3d0('0x8a')],_0x167ebc[_0xe3d0('0x3b')],_0x35d59f['passwordHistoryLimit']);return _0x167ebc;})['then'](saveUpdates({'password':_0x2c0923[_0xe3d0('0x59')][_0xe3d0('0x8a')],'passwordResetAt':_0x2c0923[_0xe3d0('0x7a')]['id']==_0x2c0923[_0xe3d0('0x54')]['id']?moment():null,'previousPasswords':authService[_0xe3d0('0x95')](_0x2c0923[_0xe3d0('0x59')][_0xe3d0('0x8a')],_0x167ebc[_0xe3d0('0x3b')])},null));})['then'](respondWithResult(_0x20f2ad,null))[_0xe3d0('0x52')](handleError(_0x20f2ad,null));};exports['addQueues']=function(_0x5582b1,_0x4b214e){var _0x29ee5d=_0x5582b1[_0xe3d0('0x59')][_0xe3d0('0x96')];return db['User'][_0xe3d0('0x2d')]({'where':{'id':_0x5582b1[_0xe3d0('0x54')]['id']},'attributes':['id',_0xe3d0('0x2e'),_0xe3d0('0x1f'),_0xe3d0('0x97'),'loginInPause',_0xe3d0('0x98'),'interface']})[_0xe3d0('0x1e')](handleEntityNotFound(_0x4b214e,null))[_0xe3d0('0x1e')](function(_0x53f704){if(_0x53f704){if(!utils[_0xe3d0('0x99')](_0x29ee5d)){throw new db[(_0xe3d0('0x8b'))]['ValidationError'](_0xe3d0('0x9a'));}return _0x53f704['add'+_[_0xe3d0('0x9b')](_0x29ee5d[_0xe3d0('0x9c')]())+_0xe3d0('0x9d')](_0x5582b1['body'][_0xe3d0('0x5d')],{'penalty':_0x5582b1[_0xe3d0('0x59')]['penalty']||0x0})['spread'](function(_0x4d6499){for(var _0x2a0e06=0x0;_0x2a0e06<_0x5582b1[_0xe3d0('0x59')][_0xe3d0('0x5d')][_0xe3d0('0x4b')];_0x2a0e06+=0x1){var _0x2136e9={'UserId':Number(_0x5582b1[_0xe3d0('0x54')]['id'])};_0x2136e9[_[_0xe3d0('0x9b')](_0x29ee5d[_0xe3d0('0x9c')]())+'QueueId']=Number(_0x5582b1[_0xe3d0('0x59')][_0xe3d0('0x5d')][_0x2a0e06]);socket['emit'](_0xe3d0('0x7a')+_[_0xe3d0('0x9b')](_0x29ee5d[_0xe3d0('0x9c')]())+_0xe3d0('0x9e'),_0x2136e9);}return _0x4d6499;})['then'](function(){if(_0x29ee5d===_0xe3d0('0x9f')){return db[_0xe3d0('0xa0')][_0xe3d0('0x48')]({'where':{'id':_0x5582b1['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0xe3d0('0x1e')](function(_0x4b5b09){var _0xc265fd=_0x53f704[_0xe3d0('0x23')]({'plain':!![]});var _0x3ef58c=[];if(_0x29ee5d==='voice'&&_0xc265fd[_0xe3d0('0x1f')]===_0xe3d0('0x20')&&_0xc265fd[_0xe3d0('0x97')]){for(let _0x56d168=0x0;_0x56d168<_0x4b5b09['length'];_0x56d168+=0x1){_0x3ef58c[_0xe3d0('0x47')]({'membername':_0xc265fd[_0xe3d0('0x2e')],'UserId':_0xc265fd['id'],'queue_name':_0x4b5b09[_0x56d168][_0xe3d0('0x2e')],'VoiceQueueId':_0x4b5b09[_0x56d168]['id'],'interface':_[_0xe3d0('0x63')](_0xc265fd[_0xe3d0('0xa1')])?util[_0xe3d0('0xa2')]('SIP/%s',_0xc265fd[_0xe3d0('0x2e')]):_0xc265fd['interface'],'paused':_0xc265fd[_0xe3d0('0x98')]||![],'penalty':_0x5582b1[_0xe3d0('0x59')][_0xe3d0('0xa3')]||0x0});}return Promise[_0xe3d0('0x51')](_0x3ef58c[_0xe3d0('0x2a')](function(_0x2b2ab8){return db[_0xe3d0('0xa4')][_0xe3d0('0xa5')](_0x2b2ab8);}));}return _0x53f704;});}})[_0xe3d0('0x1e')](respondWithStatusCode(_0x4b214e,null))[_0xe3d0('0x52')](handleError(_0x4b214e,null));};exports[_0xe3d0('0xa6')]=function(_0x54ba03,_0x16a566){var _0x278141,_0x3032bc;return db[_0xe3d0('0x34')][_0xe3d0('0x2d')]({'where':{'id':_0x54ba03['params']['id']},'attributes':['id','name',_0xe3d0('0x1f')]})[_0xe3d0('0x1e')](handleEntityNotFound(_0x16a566,null))['then'](function(_0x52c9c2){if(_0x52c9c2){_0x278141=_0x52c9c2;if(!_0x54ba03[_0xe3d0('0x42')]['channel']||!utils[_0xe3d0('0x99')](_0x54ba03[_0xe3d0('0x42')][_0xe3d0('0x96')])){throw new db[(_0xe3d0('0x8b'))][(_0xe3d0('0x8c'))]('Unknown\x20channel');}return _0x52c9c2[_0xe3d0('0xa7')+_[_0xe3d0('0x9b')](_0x54ba03['query']['channel']['toLowerCase']())+_0xe3d0('0x9d')](_0x54ba03[_0xe3d0('0x42')]['ids']);}})[_0xe3d0('0x1e')](function(_0x1ae12b){if(_[_0xe3d0('0xa8')](_0x54ba03[_0xe3d0('0x42')][_0xe3d0('0x5d')])){for(var _0x4f726c=0x0;_0x4f726c<_0x54ba03[_0xe3d0('0x42')][_0xe3d0('0x5d')][_0xe3d0('0x4b')];_0x4f726c+=0x1){_0x3032bc={'UserId':Number(_0x54ba03['params']['id'])};_0x3032bc[_[_0xe3d0('0x9b')](_0x54ba03[_0xe3d0('0x42')]['channel'][_0xe3d0('0x9c')]())+_0xe3d0('0xa9')]=Number(_0x54ba03[_0xe3d0('0x42')][_0xe3d0('0x5d')][_0x4f726c]);socket[_0xe3d0('0xaa')](_0xe3d0('0x7a')+_[_0xe3d0('0x9b')](_0x54ba03[_0xe3d0('0x42')][_0xe3d0('0x96')]['toLowerCase']())+_0xe3d0('0xab'),_0x3032bc);}}else{_0x3032bc={'UserId':Number(_0x54ba03[_0xe3d0('0x54')]['id'])};_0x3032bc[_[_0xe3d0('0x9b')](_0x54ba03['query'][_0xe3d0('0x96')][_0xe3d0('0x9c')]())+_0xe3d0('0xa9')]=Number(_0x54ba03[_0xe3d0('0x42')][_0xe3d0('0x5d')]);socket[_0xe3d0('0xaa')]('user'+_[_0xe3d0('0x9b')](_0x54ba03[_0xe3d0('0x42')]['channel'][_0xe3d0('0x9c')]())+_0xe3d0('0xab'),_0x3032bc);}return _0x1ae12b;})[_0xe3d0('0x1e')](function(){if(_0x54ba03['query'][_0xe3d0('0x96')]==='voice'){return db[_0xe3d0('0xa4')][_0xe3d0('0x22')]({'where':{'UserId':_0x54ba03[_0xe3d0('0x54')]['id'],'VoiceQueueId':_0x54ba03[_0xe3d0('0x42')]['ids']},'individualHooks':!![]})[_0xe3d0('0x1e')](function(){return _0x278141;});}return _0x278141;})[_0xe3d0('0x1e')](respondWithStatusCode(_0x16a566,null))[_0xe3d0('0x52')](handleError(_0x16a566,null));};exports[_0xe3d0('0xac')]=function(_0x37e9c8,_0x5bbbad){_0x37e9c8[_0xe3d0('0x59')][_0xe3d0('0xad')]=_0x37e9c8[_0xe3d0('0xae')]['filename'];return db['User'][_0xe3d0('0x2d')]({'where':{'id':_0x37e9c8['params']['id']}})['then'](handleEntityNotFound(_0x5bbbad,null))[_0xe3d0('0x1e')](saveUpdates(_0x37e9c8[_0xe3d0('0x59')],null))['then'](respondWithResult(_0x5bbbad,null))[_0xe3d0('0x52')](handleError(_0x5bbbad,null));};exports[_0xe3d0('0xaf')]=function(_0x587af6,_0x1a467e){var _0x1f3deb=path['join'](config['root'],_0xe3d0('0xb0'));return db['User']['find']({'where':{'id':_0x587af6[_0xe3d0('0x54')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x1a467e,null))['then'](function(_0x2fcd55){if(_0x2fcd55){if(_[_0xe3d0('0x63')](_0x2fcd55[_0xe3d0('0xad')])){return _0x1a467e[_0xe3d0('0xb1')](_0x1f3deb);}else{if(!fs[_0xe3d0('0xb2')](path[_0xe3d0('0xb3')](config[_0xe3d0('0xb4')],_0xe3d0('0xb5'),_0x2fcd55['userpic']))){return _0x1a467e[_0xe3d0('0xb1')](_0x1f3deb);}return _0x1a467e[_0xe3d0('0xb1')](path[_0xe3d0('0xb3')](config[_0xe3d0('0xb4')],_0xe3d0('0xb5'),_0x2fcd55[_0xe3d0('0xad')]));}}})[_0xe3d0('0x52')](handleError(_0x1a467e,null));};exports['getOpenTabs']=function(_0x21cab3,_0x54870e){return db[_0xe3d0('0x34')][_0xe3d0('0x2d')]({'where':{'id':_0x21cab3[_0xe3d0('0x54')]['id']},'attributes':['id']})[_0xe3d0('0x1e')](handleEntityNotFound(_0x54870e,null))[_0xe3d0('0x1e')](function(_0x1776a4){var _0x98a693=[];values=_0x1776a4['dataValues'];_0x98a693[_0xe3d0('0x47')](get_open_tabs('chat',_0x1776a4[_0xe3d0('0x4c')]));_0x98a693[_0xe3d0('0x47')](get_open_tabs(_0xe3d0('0x4d'),_0x1776a4[_0xe3d0('0x4c')]));_0x98a693[_0xe3d0('0x47')](get_open_tabs(_0xe3d0('0xb6'),_0x1776a4[_0xe3d0('0x4c')]));_0x98a693[_0xe3d0('0x47')](get_open_tabs(_0xe3d0('0x50'),_0x1776a4[_0xe3d0('0x4c')]));_0x98a693[_0xe3d0('0x47')](get_open_tabs(_0xe3d0('0x4e'),_0x1776a4[_0xe3d0('0x4c')]));_0x98a693['push'](get_open_tabs('mail',_0x1776a4['dataValues']));return Promise['all'](_0x98a693);})[_0xe3d0('0x1e')](function(_0x53e0b1){if(_0x53e0b1){var _0xe81fb4=_[_0xe3d0('0x2a')](values[_0xe3d0('0xb7')],function(_0xfd5bc3){return{'channel':_0xe3d0('0xb8'),'id':_0xfd5bc3['id'],'createdAt':_0xfd5bc3[_0xe3d0('0xb9')]};});var _0xa5b41=_[_0xe3d0('0x2a')](values[_0xe3d0('0xba')],function(_0x304fd6){return{'channel':_0xe3d0('0xbb'),'id':_0x304fd6['id'],'createdAt':_0x304fd6[_0xe3d0('0xb9')]};});var _0x38b0b2=_[_0xe3d0('0x2a')](values[_0xe3d0('0xbc')],function(_0x57e704){return{'channel':_0xe3d0('0xbd'),'id':_0x57e704['id'],'createdAt':_0x57e704[_0xe3d0('0xb9')]};});var _0x272e42=_['map'](values[_0xe3d0('0xbe')],function(_0x55fb19){return{'channel':_0xe3d0('0xbf'),'id':_0x55fb19['id'],'createdAt':_0x55fb19[_0xe3d0('0xb9')]};});var _0x2d741a=_['map'](values[_0xe3d0('0xc0')],function(_0xdee284){return{'channel':'SMS','id':_0xdee284['id'],'createdAt':_0xdee284[_0xe3d0('0xb9')]};});var _0x2eee18=_[_0xe3d0('0x2a')](values['WhatsappOpenTabs'],function(_0x5ee668){return{'channel':_0xe3d0('0xc1'),'id':_0x5ee668['id'],'createdAt':_0x5ee668[_0xe3d0('0xb9')]};});var _0x30f693=_[_0xe3d0('0xc2')](_0xe81fb4,_0xa5b41,_0x38b0b2,_0x272e42,_0x2d741a,_0x2eee18);var _0x13526e={'count':_0x30f693[_0xe3d0('0x4b')],'rows':_0x30f693};return _0x13526e;}else return null;})[_0xe3d0('0x1e')](respondWithResult(_0x54870e,null))[_0xe3d0('0x52')](handleError(_0x54870e,null));};exports['getContacts']=function(_0x4c55fa,_0x10e97a){var _0x2227f2={};return db['User']['findOne']({'where':{'id':_0x4c55fa['params']['id']}})[_0xe3d0('0x1e')](function(_0xa93653){if(!_0xa93653){throw new APINotFoundError(util[_0xe3d0('0xa2')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4c55fa[_0xe3d0('0x54')]['id']));}return contacts[_0xe3d0('0x5a')]();})[_0xe3d0('0x1e')](function(_0x5946c2){_0x4c55fa['query']['User']=_0x4c55fa[_0xe3d0('0x54')]['id'];_0x2227f2=qs['getOptions'](_0x5946c2,_0x4c55fa);if(_0x4c55fa['query'][_0xe3d0('0xc3')](_0xe3d0('0x43'))){_0x2227f2[_0xe3d0('0x44')]=[{'model':db[_0xe3d0('0xc4')],'as':_0xe3d0('0xc5'),'required':![]},{'model':db[_0xe3d0('0xc6')],'as':_0xe3d0('0xc7'),'attributes':['id',_0xe3d0('0x2e'),_0xe3d0('0xc8')],'where':_0x4c55fa[_0xe3d0('0x42')][_0xe3d0('0xc9')]?{'id':_0x4c55fa[_0xe3d0('0x42')][_0xe3d0('0xc9')]}:undefined,'required':_0x4c55fa['query'][_0xe3d0('0xc9')]?!![]:![]}];}return contacts[_0xe3d0('0x48')](_0x4c55fa[_0xe3d0('0x42')],_0x4c55fa[_0xe3d0('0x7a')],_0x2227f2,_0x5946c2);})[_0xe3d0('0x1e')](respondWithFilteredResult(_0x10e97a,_0x2227f2))['catch'](APIHandleError(_0x10e97a));};exports[_0xe3d0('0xca')]=function(_0x5b1ade,_0x354cfb){var _0x3b465;var _0x55cf51={};var _0x47190a;return db['User'][_0xe3d0('0xcb')]({'where':{'id':_0x5b1ade[_0xe3d0('0x54')]['id']},'attributes':['id',_0xe3d0('0x2e'),_0xe3d0('0x1f')]})['then'](handleEntityNotFound(_0x354cfb,null))['then'](function(_0x388857){if(!utils[_0xe3d0('0x99')](_0x5b1ade[_0xe3d0('0x42')][_0xe3d0('0x96')])){throw new db[(_0xe3d0('0x8b'))]['ValidationError'](_0xe3d0('0x9a'));}_0x3b465=_0x388857;var _0x2b7b71={};_0x2b7b71[_0xe3d0('0xcc')]=_['keys'](db[_[_0xe3d0('0x9b')](_0x5b1ade['query']['channel'])+_0xe3d0('0xcd')]['rawAttributes']);_0x2b7b71[_0xe3d0('0x42')]=_[_0xe3d0('0xce')](_0x5b1ade[_0xe3d0('0x42')]);_0x2b7b71[_0xe3d0('0xcf')]=_[_0xe3d0('0xd0')](_0x2b7b71['model'],_0x2b7b71[_0xe3d0('0x42')]);_0x55cf51[_0xe3d0('0x46')]=_['intersection'](_0x2b7b71[_0xe3d0('0xcc')],qs[_0xe3d0('0xd1')](_0x5b1ade[_0xe3d0('0x42')][_0xe3d0('0xd1')]));_0x55cf51[_0xe3d0('0x46')]=_0x55cf51['attributes'][_0xe3d0('0x4b')]?_0x55cf51[_0xe3d0('0x46')]:_0x2b7b71[_0xe3d0('0xcc')];_0x55cf51[_0xe3d0('0xd2')]=qs[_0xe3d0('0xd3')](_0x5b1ade[_0xe3d0('0x42')][_0xe3d0('0xd3')]);_0x55cf51[_0xe3d0('0x41')]=qs[_0xe3d0('0xcf')](_[_0xe3d0('0xd4')](_0x5b1ade['query'],_0x2b7b71[_0xe3d0('0xcf')]));if(_0x5b1ade[_0xe3d0('0x42')][_0xe3d0('0x28')]){_0x55cf51['where']=_[_0xe3d0('0x56')](_0x55cf51[_0xe3d0('0x41')],{'$or':_[_0xe3d0('0x2a')](_0x55cf51['attributes'],function(_0x27825f){var _0xfa7548={};_0xfa7548[_0x27825f]={'$like':'%'+_0x5b1ade[_0xe3d0('0x42')][_0xe3d0('0x28')]+'%'};return _0xfa7548;})});}_0x55cf51=_['merge']({},_0x55cf51,_0x5b1ade['options']);switch(_0x3b465['role']){case'admin':return db[_[_0xe3d0('0x9b')](_0x5b1ade[_0xe3d0('0x42')]['channel'])+'Queue'][_0xe3d0('0x48')](_0x55cf51);case _0xe3d0('0x7a'):case _0xe3d0('0x20'):return _0x3b465[_0xe3d0('0x23')+_[_0xe3d0('0x9b')](_0x5b1ade[_0xe3d0('0x42')][_0xe3d0('0x96')])+_0xe3d0('0x9d')](_0x55cf51);default:throw new db['Sequelize']['ValidationError'](_0xe3d0('0xd5'));}})[_0xe3d0('0x1e')](function(_0x38862a){_0x47190a=_0x38862a[_0xe3d0('0x4b')];if(!_0x5b1ade[_0xe3d0('0x42')][_0xe3d0('0xc3')](_0xe3d0('0xd6'))){_0x55cf51['limit']=qs[_0xe3d0('0x19')](_0x5b1ade[_0xe3d0('0x42')][_0xe3d0('0x19')]);_0x55cf51['offset']=qs[_0xe3d0('0x1c')](_0x5b1ade[_0xe3d0('0x42')][_0xe3d0('0x1c')]);}switch(_0x3b465[_0xe3d0('0x1f')]){case'admin':return db[_['capitalize'](_0x5b1ade[_0xe3d0('0x42')][_0xe3d0('0x96')])+_0xe3d0('0xcd')][_0xe3d0('0x48')](_0x55cf51);case _0xe3d0('0x7a'):case _0xe3d0('0x20'):return _0x3b465[_0xe3d0('0x23')+_['capitalize'](_0x5b1ade['query'][_0xe3d0('0x96')])+_0xe3d0('0x9d')](_0x55cf51);}})[_0xe3d0('0x1e')](function(_0x5af116){return{'count':_0x47190a,'rows':_0x5af116};})['then'](respondWithResult(_0x354cfb,null))[_0xe3d0('0x52')](handleError(_0x354cfb,null));};exports[_0xe3d0('0xd7')]=function(_0x4b383f,_0x397cdc){var _0x2ecd86={};var _0x1d4f5a={};var _0x185318;var _0x4883c5;return db[_0xe3d0('0x34')]['findOne']({'where':{'id':_0x4b383f[_0xe3d0('0x54')]['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x397cdc,null))[_0xe3d0('0x1e')](function(_0x18f64a){if(_0x18f64a){_0x185318=_0x18f64a;_0x1d4f5a[_0xe3d0('0xcc')]=_[_0xe3d0('0xce')](db[_0xe3d0('0xa4')][_0xe3d0('0x35')]);_0x1d4f5a[_0xe3d0('0x42')]=_['keys'](_0x4b383f[_0xe3d0('0x42')]);_0x1d4f5a[_0xe3d0('0xcf')]=_[_0xe3d0('0xd0')](_0x1d4f5a[_0xe3d0('0xcc')],_0x1d4f5a['query']);_0x2ecd86['attributes']=_[_0xe3d0('0xd0')](_0x1d4f5a[_0xe3d0('0xcc')],qs[_0xe3d0('0xd1')](_0x4b383f[_0xe3d0('0x42')][_0xe3d0('0xd1')]));_0x2ecd86[_0xe3d0('0x46')]=_0x2ecd86[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x2ecd86[_0xe3d0('0x46')]:_0x1d4f5a[_0xe3d0('0xcc')];_0x2ecd86[_0xe3d0('0xd2')]=qs['sort'](_0x4b383f[_0xe3d0('0x42')][_0xe3d0('0xd3')]);_0x2ecd86[_0xe3d0('0x41')]=qs[_0xe3d0('0xcf')](_[_0xe3d0('0xd4')](_0x4b383f[_0xe3d0('0x42')],_0x1d4f5a[_0xe3d0('0xcf')]));if(_0x4b383f['query'][_0xe3d0('0x28')]){_0x2ecd86[_0xe3d0('0x41')]=_[_0xe3d0('0x56')](_0x2ecd86['where'],{'$or':_[_0xe3d0('0x2a')](_0x2ecd86['attributes'],function(_0x2a74d9){var _0x15827={};_0x15827[_0x2a74d9]={'$like':'%'+_0x4b383f[_0xe3d0('0x42')]['filter']+'%'};return _0x15827;})});}_0x2ecd86=_[_0xe3d0('0x56')]({},_0x2ecd86,_0x4b383f[_0xe3d0('0xd8')]);return _0x185318[_0xe3d0('0xd7')](_0x2ecd86);}})[_0xe3d0('0x1e')](function(_0x443cc7){if(_0x443cc7){_0x4883c5=_0x443cc7[_0xe3d0('0x4b')];if(!_0x4b383f[_0xe3d0('0x42')][_0xe3d0('0xc3')]('nolimit')){_0x2ecd86[_0xe3d0('0x19')]=qs[_0xe3d0('0x19')](_0x4b383f['query'][_0xe3d0('0x19')]);_0x2ecd86[_0xe3d0('0x1c')]=qs[_0xe3d0('0x1c')](_0x4b383f[_0xe3d0('0x42')][_0xe3d0('0x1c')]);}return _0x185318['getVoiceQueuesRt'](_0x2ecd86);}})[_0xe3d0('0x1e')](function(_0x3d6b3c){if(_0x3d6b3c){return _0x3d6b3c?{'count':_0x4883c5,'rows':_0x3d6b3c}:null;}})['then'](respondWithResult(_0x397cdc,null))[_0xe3d0('0x52')](handleError(_0x397cdc,null));};exports[_0xe3d0('0xd9')]=function(_0xab14dd,_0x1d4ba9){var _0x474a6c={};var _0x20f320={};var _0x40254a;var _0x15b2a1;return db[_0xe3d0('0x34')]['findOne']({'where':{'id':_0xab14dd[_0xe3d0('0x54')]['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x1d4ba9,null))[_0xe3d0('0x1e')](function(_0x4e4270){if(_0x4e4270){_0x40254a=_0x4e4270;_0x20f320[_0xe3d0('0xcc')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x20f320['query']=_[_0xe3d0('0xce')](_0xab14dd['query']);_0x20f320[_0xe3d0('0xcf')]=_[_0xe3d0('0xd0')](_0x20f320['model'],_0x20f320[_0xe3d0('0x42')]);_0x474a6c['attributes']=_[_0xe3d0('0xd0')](_0x20f320[_0xe3d0('0xcc')],qs['fields'](_0xab14dd[_0xe3d0('0x42')][_0xe3d0('0xd1')]));_0x474a6c['attributes']=_0x474a6c[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x474a6c[_0xe3d0('0x46')]:_0x20f320[_0xe3d0('0xcc')];_0x474a6c[_0xe3d0('0xd2')]=qs[_0xe3d0('0xd3')](_0xab14dd[_0xe3d0('0x42')]['sort']);_0x474a6c[_0xe3d0('0x41')]=qs[_0xe3d0('0xcf')](_[_0xe3d0('0xd4')](_0xab14dd['query'],_0x20f320[_0xe3d0('0xcf')]));if(_0xab14dd['query'][_0xe3d0('0x28')]){_0x474a6c[_0xe3d0('0x41')]=_[_0xe3d0('0x56')](_0x474a6c[_0xe3d0('0x41')],{'$or':_[_0xe3d0('0x2a')](_0x474a6c[_0xe3d0('0x46')],function(_0x3774b1){var _0x54e86e={};_0x54e86e[_0x3774b1]={'$like':'%'+_0xab14dd[_0xe3d0('0x42')][_0xe3d0('0x28')]+'%'};return _0x54e86e;})});}_0x474a6c=_[_0xe3d0('0x56')]({},_0x474a6c,_0xab14dd['options']);return _0x40254a[_0xe3d0('0xd9')](_0x474a6c);}})['then'](function(_0xbba6b8){if(_0xbba6b8){_0x15b2a1=_0xbba6b8[_0xe3d0('0x4b')];if(!_0xab14dd['query']['hasOwnProperty']('nolimit')){_0x474a6c[_0xe3d0('0x19')]=qs['limit'](_0xab14dd[_0xe3d0('0x42')][_0xe3d0('0x19')]);_0x474a6c[_0xe3d0('0x1c')]=qs[_0xe3d0('0x1c')](_0xab14dd['query'][_0xe3d0('0x1c')]);}return _0x40254a[_0xe3d0('0xd9')](_0x474a6c);}})[_0xe3d0('0x1e')](function(_0x3cd8a9){if(_0x3cd8a9){return _0x3cd8a9?{'count':_0x15b2a1,'rows':_0x3cd8a9}:null;}})[_0xe3d0('0x1e')](respondWithResult(_0x1d4ba9,null))[_0xe3d0('0x52')](handleError(_0x1d4ba9,null));};exports[_0xe3d0('0xda')]=function(_0x4ef6b2,_0xda19e4){var _0x49b351={'raw':!![],'where':{}};var _0x18b652={};var _0x37f527={'count':0x0,'rows':[]};return db[_0xe3d0('0x34')][_0xe3d0('0xcb')]({'where':{'id':_0x4ef6b2[_0xe3d0('0x54')]['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0xda19e4,null))[_0xe3d0('0x1e')](function(_0x5b30ec){if(_0x5b30ec){_0x18b652['model']=_['keys'](db[_0xe3d0('0xdb')][_0xe3d0('0x35')]);_0x18b652[_0xe3d0('0x42')]=_[_0xe3d0('0xce')](_0x4ef6b2['query']);_0x18b652[_0xe3d0('0xcf')]=_[_0xe3d0('0xd0')](_0x18b652['model'],_0x18b652[_0xe3d0('0x42')]);_0x49b351[_0xe3d0('0x46')]=_[_0xe3d0('0xd0')](_0x18b652[_0xe3d0('0xcc')],qs[_0xe3d0('0xd1')](_0x4ef6b2[_0xe3d0('0x42')][_0xe3d0('0xd1')]));_0x49b351['attributes']=_0x49b351[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x49b351[_0xe3d0('0x46')]:_0x18b652[_0xe3d0('0xcc')];if(!_0x4ef6b2[_0xe3d0('0x42')][_0xe3d0('0xc3')]('nolimit')){_0x49b351['limit']=qs['limit'](_0x4ef6b2['query']['limit']);_0x49b351[_0xe3d0('0x1c')]=qs[_0xe3d0('0x1c')](_0x4ef6b2[_0xe3d0('0x42')]['offset']);}_0x49b351[_0xe3d0('0xd2')]=qs[_0xe3d0('0xd3')](_0x4ef6b2[_0xe3d0('0x42')][_0xe3d0('0xd3')]);_0x49b351[_0xe3d0('0x41')]=qs['filters'](_[_0xe3d0('0xd4')](_0x4ef6b2[_0xe3d0('0x42')],_0x18b652[_0xe3d0('0xcf')]));_0x49b351[_0xe3d0('0x41')][_0xe3d0('0xdc')]=_0x5b30ec['id'];if(_0x4ef6b2[_0xe3d0('0x42')]['filter']){_0x49b351['where']=_['merge'](_0x49b351[_0xe3d0('0x41')],{'$or':_[_0xe3d0('0x2a')](_0x49b351[_0xe3d0('0x46')],function(_0x50293c){var _0x16d3a5={};_0x16d3a5[_0x50293c]={'$like':'%'+_0x4ef6b2[_0xe3d0('0x42')][_0xe3d0('0x28')]+'%'};return _0x16d3a5;})});}_0x49b351=_[_0xe3d0('0x56')]({},_0x49b351,_0x4ef6b2[_0xe3d0('0xd8')]);return db[_0xe3d0('0xdb')][_0xe3d0('0x1b')]({'where':_0x49b351['where']})[_0xe3d0('0x1e')](function(_0x15675d){_0x37f527[_0xe3d0('0x1b')]=_0x15675d;if(_0x4ef6b2[_0xe3d0('0x42')][_0xe3d0('0x43')]){_0x49b351['include']=[{'all':!![]}];}return db[_0xe3d0('0xdb')]['findAll'](_0x49b351);})[_0xe3d0('0x1e')](function(_0x43f51c){_0x37f527[_0xe3d0('0x49')]=_0x43f51c;return _0x37f527;});}})[_0xe3d0('0x1e')](respondWithFilteredResult(_0xda19e4,_0x49b351))[_0xe3d0('0x52')](handleError(_0xda19e4,null));};exports[_0xe3d0('0xdd')]=function(_0x404b94,_0x1e5156){var _0x5f4d3e={'raw':!![],'where':{}};var _0x3c678c={};var _0x40fd74={'count':0x0,'rows':[]};return db['User'][_0xe3d0('0xcb')]({'where':{'id':_0x404b94[_0xe3d0('0x54')]['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x1e5156,null))[_0xe3d0('0x1e')](function(_0x20067f){if(_0x20067f){_0x3c678c['model']=_['keys'](db[_0xe3d0('0xde')]['rawAttributes']);_0x3c678c[_0xe3d0('0x42')]=_[_0xe3d0('0xce')](_0x404b94['query']);_0x3c678c['filters']=_['intersection'](_0x3c678c[_0xe3d0('0xcc')],_0x3c678c[_0xe3d0('0x42')]);_0x5f4d3e[_0xe3d0('0x46')]=_[_0xe3d0('0xd0')](_0x3c678c['model'],qs[_0xe3d0('0xd1')](_0x404b94['query'][_0xe3d0('0xd1')]));_0x5f4d3e['attributes']=_0x5f4d3e[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x5f4d3e[_0xe3d0('0x46')]:_0x3c678c[_0xe3d0('0xcc')];if(!_0x404b94[_0xe3d0('0x42')][_0xe3d0('0xc3')](_0xe3d0('0xd6'))){_0x5f4d3e[_0xe3d0('0x19')]=qs[_0xe3d0('0x19')](_0x404b94['query'][_0xe3d0('0x19')]);_0x5f4d3e['offset']=qs['offset'](_0x404b94['query'][_0xe3d0('0x1c')]);}_0x5f4d3e['order']=qs[_0xe3d0('0xd3')](_0x404b94[_0xe3d0('0x42')][_0xe3d0('0xd3')]);_0x5f4d3e['where']=qs[_0xe3d0('0xcf')](_[_0xe3d0('0xd4')](_0x404b94['query'],_0x3c678c['filters']));_0x5f4d3e[_0xe3d0('0x41')][_0xe3d0('0xdc')]=_0x20067f['id'];if(_0x404b94[_0xe3d0('0x42')][_0xe3d0('0x28')]){_0x5f4d3e['where']=_[_0xe3d0('0x56')](_0x5f4d3e[_0xe3d0('0x41')],{'$or':_['map'](_0x5f4d3e['attributes'],function(_0x3b1433){var _0x341445={};_0x341445[_0x3b1433]={'$like':'%'+_0x404b94[_0xe3d0('0x42')][_0xe3d0('0x28')]+'%'};return _0x341445;})});}_0x5f4d3e=_[_0xe3d0('0x56')]({},_0x5f4d3e,_0x404b94[_0xe3d0('0xd8')]);return db[_0xe3d0('0xde')][_0xe3d0('0x1b')]({'where':_0x5f4d3e[_0xe3d0('0x41')]})[_0xe3d0('0x1e')](function(_0x4c4916){_0x40fd74[_0xe3d0('0x1b')]=_0x4c4916;if(_0x404b94[_0xe3d0('0x42')][_0xe3d0('0x43')]){_0x5f4d3e[_0xe3d0('0x44')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x5f4d3e);})[_0xe3d0('0x1e')](function(_0x7d8f4e){_0x40fd74[_0xe3d0('0x49')]=_0x7d8f4e;return _0x40fd74;});}})[_0xe3d0('0x1e')](respondWithFilteredResult(_0x1e5156,_0x5f4d3e))[_0xe3d0('0x52')](handleError(_0x1e5156,null));};exports[_0xe3d0('0xdf')]=function(_0x3ebb22,_0x4409bf){var _0xe12954={};var _0x715aff={};var _0x3e9c18;var _0x30b83e;return db[_0xe3d0('0x34')][_0xe3d0('0xcb')]({'where':{'id':_0x3ebb22[_0xe3d0('0x54')]['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x4409bf,null))[_0xe3d0('0x1e')](function(_0x29045e){if(_0x29045e){_0x3e9c18=_0x29045e;_0x715aff[_0xe3d0('0xcc')]=_[_0xe3d0('0xce')](db[_0xe3d0('0xe0')][_0xe3d0('0x35')]);_0x715aff[_0xe3d0('0x42')]=_[_0xe3d0('0xce')](_0x3ebb22[_0xe3d0('0x42')]);_0x715aff[_0xe3d0('0xcf')]=_['intersection'](_0x715aff[_0xe3d0('0xcc')],_0x715aff[_0xe3d0('0x42')]);_0xe12954['attributes']=_[_0xe3d0('0xd0')](_0x715aff[_0xe3d0('0xcc')],qs['fields'](_0x3ebb22['query']['fields']));_0xe12954[_0xe3d0('0x46')]=_0xe12954[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0xe12954[_0xe3d0('0x46')]:_0x715aff[_0xe3d0('0xcc')];_0xe12954[_0xe3d0('0xd2')]=qs[_0xe3d0('0xd3')](_0x3ebb22[_0xe3d0('0x42')][_0xe3d0('0xd3')]);_0xe12954[_0xe3d0('0x41')]=qs['filters'](_['pick'](_0x3ebb22[_0xe3d0('0x42')],_0x715aff['filters']));if(_0x3ebb22['query'][_0xe3d0('0x28')]){_0xe12954[_0xe3d0('0x41')]=_[_0xe3d0('0x56')](_0xe12954[_0xe3d0('0x41')],{'$or':_[_0xe3d0('0x2a')](_0xe12954[_0xe3d0('0x46')],function(_0x2e84cd){var _0x262269={};_0x262269[_0x2e84cd]={'$like':'%'+_0x3ebb22['query'][_0xe3d0('0x28')]+'%'};return _0x262269;})});}_0xe12954=_[_0xe3d0('0x56')]({},_0xe12954,_0x3ebb22['options']);return _0x3e9c18[_0xe3d0('0xdf')](_0xe12954);}})[_0xe3d0('0x1e')](function(_0x4e294f){if(_0x4e294f){_0x30b83e=_0x4e294f[_0xe3d0('0x4b')];if(!_0x3ebb22[_0xe3d0('0x42')][_0xe3d0('0xc3')](_0xe3d0('0xd6'))){_0xe12954['limit']=qs[_0xe3d0('0x19')](_0x3ebb22[_0xe3d0('0x42')][_0xe3d0('0x19')]);_0xe12954[_0xe3d0('0x1c')]=qs[_0xe3d0('0x1c')](_0x3ebb22['query']['offset']);}return _0x3e9c18[_0xe3d0('0xdf')](_0xe12954);}})['then'](function(_0x235c82){if(_0x235c82){return _0x235c82?{'count':_0x30b83e,'rows':_0x235c82}:null;}})[_0xe3d0('0x1e')](respondWithResult(_0x4409bf,null))['catch'](handleError(_0x4409bf,null));};exports[_0xe3d0('0xe1')]=function(_0x598130,_0x10e12d){var _0x2d62f6={};var _0x4d2125={};var _0xd62ddc;var _0x4b0b96;return db[_0xe3d0('0x34')]['findOne']({'where':{'id':_0x598130[_0xe3d0('0x54')]['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x10e12d,null))[_0xe3d0('0x1e')](function(_0x2c2e08){if(_0x2c2e08){_0xd62ddc=_0x2c2e08;_0x4d2125[_0xe3d0('0xcc')]=_[_0xe3d0('0xce')](db[_0xe3d0('0xe2')]['rawAttributes']);_0x4d2125[_0xe3d0('0x42')]=_['keys'](_0x598130[_0xe3d0('0x42')]);_0x4d2125['filters']=_['intersection'](_0x4d2125[_0xe3d0('0xcc')],_0x4d2125[_0xe3d0('0x42')]);_0x2d62f6[_0xe3d0('0x46')]=_[_0xe3d0('0xd0')](_0x4d2125[_0xe3d0('0xcc')],qs[_0xe3d0('0xd1')](_0x598130['query']['fields']));_0x2d62f6[_0xe3d0('0x46')]=_0x2d62f6[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x2d62f6[_0xe3d0('0x46')]:_0x4d2125[_0xe3d0('0xcc')];_0x2d62f6['order']=qs['sort'](_0x598130[_0xe3d0('0x42')][_0xe3d0('0xd3')]);_0x2d62f6['where']=qs[_0xe3d0('0xcf')](_[_0xe3d0('0xd4')](_0x598130[_0xe3d0('0x42')],_0x4d2125[_0xe3d0('0xcf')]));if(_0x598130[_0xe3d0('0x42')][_0xe3d0('0x28')]){_0x2d62f6[_0xe3d0('0x41')]=_[_0xe3d0('0x56')](_0x2d62f6['where'],{'$or':_['map'](_0x2d62f6['attributes'],function(_0x557ace){var _0x585cbe={};_0x585cbe[_0x557ace]={'$like':'%'+_0x598130[_0xe3d0('0x42')][_0xe3d0('0x28')]+'%'};return _0x585cbe;})});}_0x2d62f6=_[_0xe3d0('0x56')]({},_0x2d62f6,_0x598130['options']);return _0xd62ddc[_0xe3d0('0xe1')](_0x2d62f6);}})[_0xe3d0('0x1e')](function(_0x25cdba){if(_0x25cdba){_0x4b0b96=_0x25cdba[_0xe3d0('0x4b')];if(!_0x598130['query'][_0xe3d0('0xc3')]('nolimit')){_0x2d62f6[_0xe3d0('0x19')]=qs[_0xe3d0('0x19')](_0x598130[_0xe3d0('0x42')][_0xe3d0('0x19')]);_0x2d62f6[_0xe3d0('0x1c')]=qs['offset'](_0x598130[_0xe3d0('0x42')][_0xe3d0('0x1c')]);}return _0xd62ddc[_0xe3d0('0xe1')](_0x2d62f6);}})[_0xe3d0('0x1e')](function(_0x441931){if(_0x441931){return _0x441931?{'count':_0x4b0b96,'rows':_0x441931}:null;}})[_0xe3d0('0x1e')](respondWithResult(_0x10e12d,null))[_0xe3d0('0x52')](handleError(_0x10e12d,null));};exports[_0xe3d0('0xe3')]=function(_0x1b915e,_0x59ad1f){var _0x35bcc9={'raw':!![],'where':{}};var _0x24173e={};var _0xca3cc4={'count':0x0,'rows':[]};return db[_0xe3d0('0x34')][_0xe3d0('0xcb')]({'where':{'id':_0x1b915e[_0xe3d0('0x54')]['id']}})['then'](handleEntityNotFound(_0x59ad1f,null))['then'](function(_0x4f86de){if(_0x4f86de){_0x24173e[_0xe3d0('0xcc')]=_['keys'](db[_0xe3d0('0xe4')][_0xe3d0('0x35')]);_0x24173e[_0xe3d0('0x42')]=_['keys'](_0x1b915e[_0xe3d0('0x42')]);_0x24173e[_0xe3d0('0xcf')]=_[_0xe3d0('0xd0')](_0x24173e['model'],_0x24173e[_0xe3d0('0x42')]);_0x35bcc9[_0xe3d0('0x46')]=_[_0xe3d0('0xd0')](_0x24173e[_0xe3d0('0xcc')],qs[_0xe3d0('0xd1')](_0x1b915e['query'][_0xe3d0('0xd1')]));_0x35bcc9[_0xe3d0('0x46')]=_0x35bcc9[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x35bcc9[_0xe3d0('0x46')]:_0x24173e[_0xe3d0('0xcc')];if(!_0x1b915e['query'][_0xe3d0('0xc3')](_0xe3d0('0xd6'))){_0x35bcc9['limit']=qs[_0xe3d0('0x19')](_0x1b915e[_0xe3d0('0x42')][_0xe3d0('0x19')]);_0x35bcc9[_0xe3d0('0x1c')]=qs[_0xe3d0('0x1c')](_0x1b915e[_0xe3d0('0x42')][_0xe3d0('0x1c')]);}_0x35bcc9[_0xe3d0('0xd2')]=qs[_0xe3d0('0xd3')](_0x1b915e[_0xe3d0('0x42')][_0xe3d0('0xd3')]);_0x35bcc9[_0xe3d0('0x41')]=qs['filters'](_['pick'](_0x1b915e[_0xe3d0('0x42')],_0x24173e[_0xe3d0('0xcf')]));_0x35bcc9[_0xe3d0('0x41')][_0xe3d0('0xdc')]=_0x4f86de['id'];if(_0x1b915e[_0xe3d0('0x42')][_0xe3d0('0x28')]){_0x35bcc9[_0xe3d0('0x41')]=_[_0xe3d0('0x56')](_0x35bcc9[_0xe3d0('0x41')],{'$or':_[_0xe3d0('0x2a')](_0x35bcc9[_0xe3d0('0x46')],function(_0x19851f){var _0x111b28={};_0x111b28[_0x19851f]={'$like':'%'+_0x1b915e[_0xe3d0('0x42')]['filter']+'%'};return _0x111b28;})});}_0x35bcc9=_[_0xe3d0('0x56')]({},_0x35bcc9,_0x1b915e[_0xe3d0('0xd8')]);return db[_0xe3d0('0xe4')][_0xe3d0('0x1b')]({'where':_0x35bcc9[_0xe3d0('0x41')]})['then'](function(_0x4445c7){_0xca3cc4[_0xe3d0('0x1b')]=_0x4445c7;if(_0x1b915e[_0xe3d0('0x42')][_0xe3d0('0x43')]){_0x35bcc9[_0xe3d0('0x44')]=[{'all':!![]}];}return db[_0xe3d0('0xe4')]['findAll'](_0x35bcc9);})[_0xe3d0('0x1e')](function(_0x9077c2){_0xca3cc4[_0xe3d0('0x49')]=_0x9077c2;return _0xca3cc4;});}})[_0xe3d0('0x1e')](respondWithFilteredResult(_0x59ad1f,_0x35bcc9))[_0xe3d0('0x52')](handleError(_0x59ad1f,null));};exports[_0xe3d0('0xe5')]=function(_0x5ea481,_0x38c1e5){var _0x1d2735={};var _0x134ab8={};var _0x5aefab;var _0x5e28f3;return db[_0xe3d0('0x34')][_0xe3d0('0xcb')]({'where':{'id':_0x5ea481[_0xe3d0('0x54')]['id']}})['then'](handleEntityNotFound(_0x38c1e5,null))[_0xe3d0('0x1e')](function(_0xe7133a){if(_0xe7133a){_0x5aefab=_0xe7133a;_0x134ab8[_0xe3d0('0xcc')]=_['keys'](db['SmsInteraction'][_0xe3d0('0x35')]);_0x134ab8['query']=_[_0xe3d0('0xce')](_0x5ea481[_0xe3d0('0x42')]);_0x134ab8[_0xe3d0('0xcf')]=_[_0xe3d0('0xd0')](_0x134ab8[_0xe3d0('0xcc')],_0x134ab8[_0xe3d0('0x42')]);_0x1d2735[_0xe3d0('0x46')]=_[_0xe3d0('0xd0')](_0x134ab8['model'],qs[_0xe3d0('0xd1')](_0x5ea481[_0xe3d0('0x42')][_0xe3d0('0xd1')]));_0x1d2735[_0xe3d0('0x46')]=_0x1d2735[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x1d2735[_0xe3d0('0x46')]:_0x134ab8['model'];_0x1d2735[_0xe3d0('0xd2')]=qs[_0xe3d0('0xd3')](_0x5ea481[_0xe3d0('0x42')][_0xe3d0('0xd3')]);_0x1d2735[_0xe3d0('0x41')]=qs[_0xe3d0('0xcf')](_['pick'](_0x5ea481[_0xe3d0('0x42')],_0x134ab8[_0xe3d0('0xcf')]));if(_0x5ea481[_0xe3d0('0x42')][_0xe3d0('0x28')]){_0x1d2735[_0xe3d0('0x41')]=_[_0xe3d0('0x56')](_0x1d2735[_0xe3d0('0x41')],{'$or':_[_0xe3d0('0x2a')](_0x1d2735[_0xe3d0('0x46')],function(_0x1c4130){var _0x3a4aa0={};_0x3a4aa0[_0x1c4130]={'$like':'%'+_0x5ea481['query'][_0xe3d0('0x28')]+'%'};return _0x3a4aa0;})});}_0x1d2735=_[_0xe3d0('0x56')]({},_0x1d2735,_0x5ea481[_0xe3d0('0xd8')]);return _0x5aefab[_0xe3d0('0xe5')](_0x1d2735);}})[_0xe3d0('0x1e')](function(_0x6238c0){if(_0x6238c0){_0x5e28f3=_0x6238c0[_0xe3d0('0x4b')];if(!_0x5ea481['query'][_0xe3d0('0xc3')]('nolimit')){_0x1d2735[_0xe3d0('0x19')]=qs[_0xe3d0('0x19')](_0x5ea481[_0xe3d0('0x42')][_0xe3d0('0x19')]);_0x1d2735[_0xe3d0('0x1c')]=qs[_0xe3d0('0x1c')](_0x5ea481[_0xe3d0('0x42')][_0xe3d0('0x1c')]);}return _0x5aefab['getSmsInteractions'](_0x1d2735);}})['then'](function(_0x21d981){if(_0x21d981){return _0x21d981?{'count':_0x5e28f3,'rows':_0x21d981}:null;}})[_0xe3d0('0x1e')](respondWithResult(_0x38c1e5,null))[_0xe3d0('0x52')](handleError(_0x38c1e5,null));};exports[_0xe3d0('0xe6')]=function(_0x214c78,_0x162e3f){var _0x14e2c6={};var _0x172a79={};var _0x3efa80;var _0x5c5305;return db[_0xe3d0('0x34')][_0xe3d0('0xcb')]({'where':{'id':_0x214c78[_0xe3d0('0x54')]['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x162e3f,null))[_0xe3d0('0x1e')](function(_0x52ad5a){if(_0x52ad5a){_0x3efa80=_0x52ad5a;_0x172a79['model']=_[_0xe3d0('0xce')](db[_0xe3d0('0xe7')]['rawAttributes']);_0x172a79[_0xe3d0('0x42')]=_['keys'](_0x214c78[_0xe3d0('0x42')]);_0x172a79[_0xe3d0('0xcf')]=_[_0xe3d0('0xd0')](_0x172a79[_0xe3d0('0xcc')],_0x172a79[_0xe3d0('0x42')]);_0x14e2c6[_0xe3d0('0x46')]=_[_0xe3d0('0xd0')](_0x172a79[_0xe3d0('0xcc')],qs['fields'](_0x214c78[_0xe3d0('0x42')][_0xe3d0('0xd1')]));_0x14e2c6['attributes']=_0x14e2c6[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x14e2c6[_0xe3d0('0x46')]:_0x172a79['model'];_0x14e2c6[_0xe3d0('0xd2')]=qs['sort'](_0x214c78['query'][_0xe3d0('0xd3')]);_0x14e2c6[_0xe3d0('0x41')]=qs[_0xe3d0('0xcf')](_[_0xe3d0('0xd4')](_0x214c78[_0xe3d0('0x42')],_0x172a79[_0xe3d0('0xcf')]));if(_0x214c78[_0xe3d0('0x42')][_0xe3d0('0x28')]){_0x14e2c6[_0xe3d0('0x41')]=_[_0xe3d0('0x56')](_0x14e2c6['where'],{'$or':_['map'](_0x14e2c6['attributes'],function(_0x486ed9){var _0x3c76fb={};_0x3c76fb[_0x486ed9]={'$like':'%'+_0x214c78[_0xe3d0('0x42')][_0xe3d0('0x28')]+'%'};return _0x3c76fb;})});}_0x14e2c6=_[_0xe3d0('0x56')]({},_0x14e2c6,_0x214c78['options']);return _0x3efa80[_0xe3d0('0xe6')](_0x14e2c6);}})[_0xe3d0('0x1e')](function(_0x23285f){if(_0x23285f){_0x5c5305=_0x23285f[_0xe3d0('0x4b')];if(!_0x214c78[_0xe3d0('0x42')]['hasOwnProperty'](_0xe3d0('0xd6'))){_0x14e2c6[_0xe3d0('0x19')]=qs[_0xe3d0('0x19')](_0x214c78[_0xe3d0('0x42')][_0xe3d0('0x19')]);_0x14e2c6['offset']=qs[_0xe3d0('0x1c')](_0x214c78['query'][_0xe3d0('0x1c')]);}return _0x3efa80['getFaxInteractions'](_0x14e2c6);}})[_0xe3d0('0x1e')](function(_0x5d04a5){if(_0x5d04a5){return _0x5d04a5?{'count':_0x5c5305,'rows':_0x5d04a5}:null;}})[_0xe3d0('0x1e')](respondWithResult(_0x162e3f,null))[_0xe3d0('0x52')](handleError(_0x162e3f,null));};exports['getWhatsappInteractions']=function(_0x4e9374,_0x4abf3c){var _0x286e04={};var _0x93ee84={};var _0x240114;var _0x5a5a5e;return db['User']['findOne']({'where':{'id':_0x4e9374['params']['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x4abf3c,null))[_0xe3d0('0x1e')](function(_0x57e032){if(_0x57e032){_0x240114=_0x57e032;_0x93ee84[_0xe3d0('0xcc')]=_[_0xe3d0('0xce')](db[_0xe3d0('0xe8')][_0xe3d0('0x35')]);_0x93ee84[_0xe3d0('0x42')]=_[_0xe3d0('0xce')](_0x4e9374[_0xe3d0('0x42')]);_0x93ee84[_0xe3d0('0xcf')]=_[_0xe3d0('0xd0')](_0x93ee84[_0xe3d0('0xcc')],_0x93ee84['query']);_0x286e04[_0xe3d0('0x46')]=_[_0xe3d0('0xd0')](_0x93ee84[_0xe3d0('0xcc')],qs[_0xe3d0('0xd1')](_0x4e9374[_0xe3d0('0x42')][_0xe3d0('0xd1')]));_0x286e04[_0xe3d0('0x46')]=_0x286e04[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x286e04[_0xe3d0('0x46')]:_0x93ee84[_0xe3d0('0xcc')];_0x286e04[_0xe3d0('0xd2')]=qs[_0xe3d0('0xd3')](_0x4e9374[_0xe3d0('0x42')]['sort']);_0x286e04[_0xe3d0('0x41')]=qs['filters'](_[_0xe3d0('0xd4')](_0x4e9374['query'],_0x93ee84[_0xe3d0('0xcf')]));if(_0x4e9374['query']['filter']){_0x286e04[_0xe3d0('0x41')]=_[_0xe3d0('0x56')](_0x286e04[_0xe3d0('0x41')],{'$or':_[_0xe3d0('0x2a')](_0x286e04['attributes'],function(_0x43038c){var _0x1c89ee={};_0x1c89ee[_0x43038c]={'$like':'%'+_0x4e9374[_0xe3d0('0x42')]['filter']+'%'};return _0x1c89ee;})});}_0x286e04=_[_0xe3d0('0x56')]({},_0x286e04,_0x4e9374['options']);return _0x240114[_0xe3d0('0xe9')](_0x286e04);}})['then'](function(_0xac2ce8){if(_0xac2ce8){_0x5a5a5e=_0xac2ce8[_0xe3d0('0x4b')];if(!_0x4e9374['query'][_0xe3d0('0xc3')](_0xe3d0('0xd6'))){_0x286e04['limit']=qs['limit'](_0x4e9374[_0xe3d0('0x42')]['limit']);_0x286e04[_0xe3d0('0x1c')]=qs['offset'](_0x4e9374[_0xe3d0('0x42')][_0xe3d0('0x1c')]);}return _0x240114[_0xe3d0('0xe9')](_0x286e04);}})[_0xe3d0('0x1e')](function(_0x34606a){if(_0x34606a){return _0x34606a?{'count':_0x5a5a5e,'rows':_0x34606a}:null;}})[_0xe3d0('0x1e')](respondWithResult(_0x4abf3c,null))[_0xe3d0('0x52')](handleError(_0x4abf3c,null));};exports[_0xe3d0('0xea')]=function(_0x2f4b34,_0x7d0c83,_0x363a9c){var _0x14f905;var _0x1f716f;var _0x23c615;var _0x10ae91=!_[_0xe3d0('0x63')](_0x2f4b34[_0xe3d0('0x54')]['id'])?_0x2f4b34[_0xe3d0('0x54')]['id']:!_[_0xe3d0('0x63')](_0x2f4b34['user']['id'])?_0x2f4b34[_0xe3d0('0x7a')]['id']:null;return db[_0xe3d0('0x34')][_0xe3d0('0x2d')]({'where':{'id':_0x10ae91,'role':{'$or':['admin',_0xe3d0('0x7a'),_0xe3d0('0x20')]}},'attributes':['id',_0xe3d0('0x2e'),_0xe3d0('0xeb'),_0xe3d0('0xec'),_0xe3d0('0x1f'),_0xe3d0('0x5e'),'loginInPause']})['then'](function(_0xee202){if(_0xee202){if(_0xee202[_0xe3d0('0x1f')]===_0xe3d0('0x20')){_0x14f905=_0xee202;if(_0x2f4b34['body']['interface']){_0x23c615=util['format'](_0xe3d0('0xed'),_0x14f905[_0x2f4b34[_0xe3d0('0x59')][_0xe3d0('0xa1')]]);}else if(_0x2f4b34[_0xe3d0('0x59')]['intrf']){_0x23c615=util[_0xe3d0('0xa2')](_0xe3d0('0xee'),_0x2f4b34['body'][_0xe3d0('0xef')]);}else{_0x23c615=util[_0xe3d0('0xa2')]('SIP/%s',_0x14f905[_0xe3d0('0x2e')]);}socket['to'](util[_0xe3d0('0xa2')](_0xe3d0('0xf0'),_0x14f905[_0xe3d0('0x2e')]))['emit']('user:forcelogout',{'user':{'id':_0x14f905['id'],'name':_0x14f905['name']},'ip':_0x2f4b34[_0xe3d0('0xf1')][_0xe3d0('0xf2')]||_0x2f4b34[_0xe3d0('0xf3')][_0xe3d0('0xf4')]||_0x2f4b34['socket'][_0xe3d0('0xf4')]||_0x2f4b34['connection'][_0xe3d0('0xf5')]['remoteAddress']});return db['UserVoiceQueueRt'][_0xe3d0('0x22')]({'where':{'membername':_0x14f905[_0xe3d0('0x2e')]},'individualHooks':!![]});}}else{throw new db[(_0xe3d0('0x8b'))][(_0xe3d0('0x8c'))](_0xe3d0('0xf6'));}})[_0xe3d0('0x1e')](function(){if(_0x14f905){return _0x14f905[_0xe3d0('0xf7')]({'raw':!![]});}})[_0xe3d0('0x1e')](function(_0x1d1dd4){if(_0x14f905){if(_0x1d1dd4){_0x1f716f=_0x1d1dd4;if(_0x1f716f[_0xe3d0('0x4b')]){var _0x5def14=_0x1f716f[_0xe3d0('0x2a')](function(_0x49e549){var _0x29ce77={'membername':_0x14f905[_0xe3d0('0x2e')],'UserId':_0x14f905['id'],'queue_name':_0x49e549[_0xe3d0('0x2e')],'VoiceQueueId':_0x49e549['id'],'interface':_0x23c615,'paused':_0x14f905[_0xe3d0('0xf8')]||![],'penalty':_0x49e549['UserVoiceQueue.penalty']||0x0};return db[_0xe3d0('0xa4')][_0xe3d0('0xa5')](_0x29ce77);});return Promise[_0xe3d0('0x51')](_0x5def14);}}}})['then'](function(){if(_0x14f905){return db['MemberReport'][_0xe3d0('0x48')]({'where':{'membername':_0x14f905['name'],'exitAt':null}});}})[_0xe3d0('0x1e')](function(_0x3957e5){if(_0x14f905){var _0x168938=[];_0x3957e5[_0xe3d0('0xf9')](function(_0x19767b){_0x168938[_0xe3d0('0x47')](_0x19767b[_0xe3d0('0x1d')]({'exitAt':moment()[_0xe3d0('0xa2')](_0xe3d0('0xfa'))}));});return Promise[_0xe3d0('0x51')](_0x168938);}})['then'](function(){if(_0x14f905){var _0x3e3bff=[];var _0x330ac8=[];var _0x1b02a6=utils['getChannels']();var _0x184cc6={'membername':_0x14f905[_0xe3d0('0x2e')],'interface':_0x23c615,'enterAt':moment()[_0xe3d0('0xa2')](_0xe3d0('0xfa')),'role':_0x14f905[_0xe3d0('0x1f')],'internal':_0x14f905[_0xe3d0('0x5e')]};_0x1b02a6[_0xe3d0('0xf9')](function(_0x125276){_0x3e3bff[_0xe3d0('0x47')](_[_0xe3d0('0x56')]({'channel':_0x125276,'type':_0xe3d0('0xfb'),'data1':_0x2f4b34['body'][_0xe3d0('0xfc')],'data2':_0x23c615},_0x184cc6));if(_0x14f905[_0xe3d0('0xf8')]){_0x330ac8[_0xe3d0('0x47')](_[_0xe3d0('0x56')]({'channel':_0x125276,'type':_0xe3d0('0xfd'),'data1':_0xe3d0('0xfe')},_0x184cc6));}});return db[_0xe3d0('0xff')][_0xe3d0('0x82')](_0x3e3bff[_0xe3d0('0xc2')](_0x330ac8),{'individualHooks':!![]});}})[_0xe3d0('0x1e')](function(){if(_0x14f905){return _0x14f905[_0xe3d0('0x1d')]({'online':!![],'lastLoginAt':moment()[_0xe3d0('0xa2')](_0xe3d0('0xfa')),'voicePause':_0x14f905[_0xe3d0('0xf8')]||![],'mailPause':_0x14f905['loginInPause']||![],'chatPause':_0x14f905[_0xe3d0('0xf8')]||![],'faxPause':_0x14f905[_0xe3d0('0xf8')]||![],'smsPause':_0x14f905[_0xe3d0('0xf8')]||![],'openchannelPause':_0x14f905[_0xe3d0('0xf8')]||![],'whatsappPause':_0x14f905[_0xe3d0('0xf8')]||![],'pauseType':_0x14f905[_0xe3d0('0xf8')]?'LOGININPAUSE':null,'interface':_0x23c615,'lastPauseAt':moment()[_0xe3d0('0xa2')](_0xe3d0('0xfa'))});}})[_0xe3d0('0x1e')](function(_0x5b1018){if(_0x2f4b34['isMiddleware']){return _0x363a9c();}else{return Promise['resolve'](_0x5b1018)[_0xe3d0('0x1e')](respondWithResult(_0x7d0c83,null));}})['catch'](handleError(_0x7d0c83,null));};exports[_0xe3d0('0x100')]=function(_0x38a7df,_0x586ae6){var _0x54c2c0;return db[_0xe3d0('0x34')][_0xe3d0('0x2d')]({'where':{'id':_0x38a7df['params']['id'],'role':_0xe3d0('0x20')},'attributes':['id',_0xe3d0('0x2e'),_0xe3d0('0x1f')]})['then'](handleEntityNotFound(_0x586ae6,null))[_0xe3d0('0x1e')](function(_0x544d3e){if(_0x544d3e){_0x54c2c0=_0x544d3e;return db[_0xe3d0('0xa4')][_0xe3d0('0x22')]({'where':{'membername':_0x54c2c0[_0xe3d0('0x2e')]},'individualHooks':!![]});}})[_0xe3d0('0x1e')](function(){return db[_0xe3d0('0xff')][_0xe3d0('0x48')]({'where':{'membername':_0x54c2c0['name'],'exitAt':null}});})[_0xe3d0('0x1e')](function(_0x9000bf){var _0xa1a82f=[];_0x9000bf[_0xe3d0('0xf9')](function(_0x1bc0f4){_0xa1a82f['push'](_0x1bc0f4[_0xe3d0('0x1d')]({'exitAt':moment()[_0xe3d0('0xa2')](_0xe3d0('0xfa'))}));});return Promise['all'](_0xa1a82f);})['then'](function(){return _0x54c2c0[_0xe3d0('0x1d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe3d0('0x1e')](respondWithResult(_0x586ae6,null))[_0xe3d0('0x52')](handleError(_0x586ae6,null));};exports['pause']=function(_0x48b60e,_0x26fc80){var _0x4ddcbe;return db[_0xe3d0('0xa4')][_0xe3d0('0x1d')]({'paused':0x1},{'where':{'UserId':_0x48b60e[_0xe3d0('0x54')]['id']},'individualHooks':!![]})[_0xe3d0('0x1e')](function(){return db[_0xe3d0('0x34')][_0xe3d0('0x2d')]({'where':{'id':_0x48b60e[_0xe3d0('0x54')]['id'],'role':_0xe3d0('0x20')},'attributes':['id','name','role',_0xe3d0('0x5e'),_0xe3d0('0xa1'),_0xe3d0('0x97')]});})[_0xe3d0('0x1e')](handleEntityNotFound(_0x26fc80,null))[_0xe3d0('0x1e')](function(_0x1f4d64){if(_0x1f4d64){_0x4ddcbe=_0x1f4d64;return db['MemberReport'][_0xe3d0('0x48')]({'where':{'membername':_0x4ddcbe[_0xe3d0('0x2e')],'type':'PAUSE','exitAt':null}});}})[_0xe3d0('0x1e')](function(_0x5a73d8){if(_0x5a73d8['length']){var _0x4384f3=moment()['format'](_0xe3d0('0xfa'));for(var _0x2e6776=0x0,_0x38acd3=_0x5a73d8[_0xe3d0('0x4b')];_0x2e6776<_0x38acd3;_0x2e6776++){_0x5a73d8[_0x2e6776]['updateAttributes']({'exitAt':_0x4384f3});}}})[_0xe3d0('0x1e')](function(){var _0x1b36b0=[];var _0x1851c7=utils[_0xe3d0('0x101')]();_0x1851c7[_0xe3d0('0xf9')](function(_0x5ad67b){_0x1b36b0[_0xe3d0('0x47')]({'channel':_0x5ad67b,'membername':_0x4ddcbe['name'],'interface':_[_0xe3d0('0x63')](_0x4ddcbe[_0xe3d0('0xa1')])?util[_0xe3d0('0xa2')](_0xe3d0('0xee'),_0x4ddcbe[_0xe3d0('0x2e')]):_0x4ddcbe[_0xe3d0('0xa1')],'type':_0xe3d0('0xfd'),'enterAt':moment()[_0xe3d0('0xa2')](_0xe3d0('0xfa')),'data1':_0x48b60e[_0xe3d0('0x59')][_0xe3d0('0x37')]||_0xe3d0('0x102'),'role':_0x4ddcbe[_0xe3d0('0x1f')],'internal':_0x4ddcbe['internal']});});return db[_0xe3d0('0xff')][_0xe3d0('0x82')](_0x1b36b0,{'individualHooks':!![]});})[_0xe3d0('0x1e')](function(){return _0x4ddcbe[_0xe3d0('0x1d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x48b60e[_0xe3d0('0x59')][_0xe3d0('0x37')]||_0xe3d0('0x102'),'lastPauseAt':moment()[_0xe3d0('0xa2')](_0xe3d0('0xfa'))});})[_0xe3d0('0x1e')](respondWithResult(_0x26fc80,null))[_0xe3d0('0x52')](handleError(_0x26fc80,null));};exports[_0xe3d0('0x103')]=function(_0xf9d6e2,_0x364001){if(_0xf9d6e2[_0xe3d0('0x59')][_0xe3d0('0x96')]&&!utils[_0xe3d0('0x99')](_0xf9d6e2[_0xe3d0('0x59')][_0xe3d0('0x96')])){throw new APIBadRequestError(util[_0xe3d0('0xa2')](_0xe3d0('0x104'),_0xf9d6e2[_0xe3d0('0x59')][_0xe3d0('0x96')]));}return db[_0xe3d0('0x34')]['find']({'where':{'id':_0xf9d6e2[_0xe3d0('0x54')]['id']},'attributes':['id',_0xe3d0('0x2e'),_0xe3d0('0x1f'),_0xe3d0('0x5e'),_0xe3d0('0xa1'),_0xe3d0('0x97'),_0xe3d0('0x98'),_0xe3d0('0x105'),_0xe3d0('0x106'),_0xe3d0('0x107'),_0xe3d0('0x108'),'smsPause','whatsappPause','pauseType',_0xe3d0('0x109')]})[_0xe3d0('0x1e')](function(_0x3ac249){if(!_0x3ac249){throw new APINotFoundError(util[_0xe3d0('0xa2')](_0xe3d0('0x10a'),_0xf9d6e2[_0xe3d0('0x54')]['id']));}return _0x3ac249[_0xe3d0('0x103')](_0xf9d6e2[_0xe3d0('0x59')][_0xe3d0('0x96')]);})[_0xe3d0('0x1e')](respondWithResult(_0x364001,null))[_0xe3d0('0x52')](APIHandleError(_0x364001));};exports[_0xe3d0('0x10b')]=function(_0x61d5e3,_0x1276a5){var _0x18103b={};var _0x3d412b={};var _0x12fcf1;var _0x37774d;return db[_0xe3d0('0x34')]['findOne']({'where':{'id':_0x61d5e3['params']['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x1276a5,null))[_0xe3d0('0x1e')](function(_0x5097a9){if(_0x5097a9){_0x12fcf1=_0x5097a9;_0x3d412b[_0xe3d0('0xcc')]=_[_0xe3d0('0xce')](db[_0xe3d0('0x10c')][_0xe3d0('0x35')]);_0x3d412b[_0xe3d0('0x42')]=_[_0xe3d0('0xce')](_0x61d5e3[_0xe3d0('0x42')]);_0x3d412b[_0xe3d0('0xcf')]=_['intersection'](_0x3d412b[_0xe3d0('0xcc')],_0x3d412b[_0xe3d0('0x42')]);_0x18103b[_0xe3d0('0x46')]=_[_0xe3d0('0xd0')](_0x3d412b[_0xe3d0('0xcc')],qs[_0xe3d0('0xd1')](_0x61d5e3['query'][_0xe3d0('0xd1')]));_0x18103b['attributes']=_0x18103b[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x18103b['attributes']:_0x3d412b[_0xe3d0('0xcc')];_0x18103b[_0xe3d0('0xd2')]=qs['sort'](_0x61d5e3[_0xe3d0('0x42')][_0xe3d0('0xd3')]);_0x18103b[_0xe3d0('0x41')]=qs[_0xe3d0('0xcf')](_[_0xe3d0('0xd4')](_0x61d5e3['query'],_0x3d412b[_0xe3d0('0xcf')]));if(_0x61d5e3[_0xe3d0('0x42')]['filter']){_0x18103b[_0xe3d0('0x41')]=_['merge'](_0x18103b[_0xe3d0('0x41')],{'$or':_[_0xe3d0('0x2a')](_0x18103b[_0xe3d0('0x46')],function(_0x1cdb08){var _0x3f0cb9={};_0x3f0cb9[_0x1cdb08]={'$like':'%'+_0x61d5e3[_0xe3d0('0x42')]['filter']+'%'};return _0x3f0cb9;})});}_0x18103b=_['merge']({},_0x18103b,_0x61d5e3[_0xe3d0('0xd8')]);return _0x12fcf1[_0xe3d0('0x10b')](_0x18103b);}})[_0xe3d0('0x1e')](function(_0x2308a7){if(_0x2308a7){_0x37774d=_0x2308a7[_0xe3d0('0x4b')];if(!_0x61d5e3[_0xe3d0('0x42')][_0xe3d0('0xc3')](_0xe3d0('0xd6'))){_0x18103b[_0xe3d0('0x19')]=qs['limit'](_0x61d5e3['query'][_0xe3d0('0x19')]);_0x18103b['offset']=qs['offset'](_0x61d5e3[_0xe3d0('0x42')]['offset']);}return _0x12fcf1['getTeams'](_0x18103b);}})[_0xe3d0('0x1e')](function(_0x40b077){if(_0x40b077){return _0x40b077?{'count':_0x37774d,'rows':_0x40b077}:null;}})[_0xe3d0('0x1e')](respondWithResult(_0x1276a5,null))[_0xe3d0('0x52')](handleError(_0x1276a5,null));};exports['addTeams']=function(_0x56cb36,_0x4fd67d){var _0x172ee7=_0x56cb36[_0xe3d0('0x54')]['id'];var _0x5cffa0=_0x56cb36['body']?_0x56cb36[_0xe3d0('0x59')][_0xe3d0('0x5d')]:null;var _0xf1c3d2=[];return Promise[_0xe3d0('0x10d')]()['then'](function(){if(!_0x5cffa0)throw new APIBadRequestError(_0xe3d0('0x10e'));})[_0xe3d0('0x1e')](function(){return db[_0xe3d0('0x34')][_0xe3d0('0xcb')]({'where':{'id':_0x172ee7}});})[_0xe3d0('0x1e')](function(_0x530bf5){if(!_0x530bf5)throw new APINotFoundError(util[_0xe3d0('0xa2')](_0xe3d0('0x10a'),_0x56cb36[_0xe3d0('0x54')]['id']));return db['sequelize'][_0xe3d0('0x10f')](function(_0xe21542){return _0x530bf5[_0xe3d0('0x110')](_0x5cffa0,{'transaction':_0xe21542})[_0xe3d0('0x1e')](function(){return db['Team'][_0xe3d0('0x48')]({'where':{'id':{'$in':_0x5cffa0}}});})[_0xe3d0('0x1e')](function(_0x2d616d){var _0xef9d12=_[_0xe3d0('0x2a')](_0x2d616d,function(_0x3f370a){return _0x3f370a[_0xe3d0('0x111')]();});return Promise[_0xe3d0('0x51')](_0xef9d12);})['then'](function(_0x261bd9){_0xf1c3d2=_['flattenDeep'](_0x261bd9);var _0x4b4157=_['map'](_0xf1c3d2,function(_0x306f0a){return _0x306f0a[_0xe3d0('0x112')](_0x530bf5['id'],{'transaction':_0xe21542});});return Promise[_0xe3d0('0x51')](_0x4b4157);})[_0xe3d0('0x1e')](function(){if(!_0x530bf5[_0xe3d0('0x97')])return;var _0x395c15=_[_0xe3d0('0x28')](_0xf1c3d2,function(_0x255b18){return _0x255b18[_0xe3d0('0x113')]('channel')===_0xe3d0('0x114');});var _0x188274=_[_0xe3d0('0x2a')](_0x395c15,function(_0x4268fb){return db['UserVoiceQueueRt'][_0xe3d0('0xa5')]({'membername':_0x530bf5[_0xe3d0('0x2e')],'UserId':_0x530bf5['id'],'queue_name':_0x4268fb[_0xe3d0('0x2e')],'VoiceQueueId':_0x4268fb['id'],'interface':_[_0xe3d0('0x63')](_0x530bf5[_0xe3d0('0xa1')])?util['format'](_0xe3d0('0xee'),_0x530bf5['name']):_0x530bf5[_0xe3d0('0xa1')],'paused':_0x530bf5['voicePause']||![],'penalty':_0x530bf5[_0xe3d0('0xa3')]},{'transaction':_0xe21542});});return Promise[_0xe3d0('0x51')](_0x188274);})[_0xe3d0('0x1e')](function(){return db[_0xe3d0('0x115')][_0xe3d0('0x48')]({'where':{'teamId':{'$in':_0x5cffa0}}});})[_0xe3d0('0x1e')](function(_0x326d36){var _0x1b6ca6=_[_0xe3d0('0x2a')](_0x326d36,function(_0x309200){return db[_0xe3d0('0x116')][_0xe3d0('0x79')]({'UserId':_0x530bf5['id'],'VoicePrefixId':_0x309200['VoicePrefixId']},{'transaction':_0xe21542});});return Promise['all'](_0x1b6ca6);});});})[_0xe3d0('0x1e')](function(){for(var _0x1e6613=0x0;_0x1e6613<_0xf1c3d2[_0xe3d0('0x4b')];_0x1e6613++){var _0x55de3c=_0xf1c3d2[_0x1e6613][_0xe3d0('0x113')]('channel');var _0x31da5c=_0x55de3c+_0xe3d0('0xa9');socket[_0xe3d0('0xaa')]('user'+_0x55de3c+_0xe3d0('0x9e'),{'UserId':_0x172ee7,['queueField']:_0xf1c3d2[_0x1e6613]['id']});}})[_0xe3d0('0x1e')](respondWithStatusCode(_0x4fd67d,null))[_0xe3d0('0x52')](APIHandleError(_0x4fd67d));};exports[_0xe3d0('0x117')]=function(_0x26afe1,_0xc736d0){var _0x2176b4=_0x26afe1[_0xe3d0('0x54')]['id'];var _0x4de346=null;if(_0x26afe1[_0xe3d0('0x42')][_0xe3d0('0x5d')]){_0x4de346=_[_0xe3d0('0xa8')](_0x26afe1[_0xe3d0('0x42')][_0xe3d0('0x5d')])?_0x26afe1[_0xe3d0('0x42')][_0xe3d0('0x5d')]:[_0x26afe1[_0xe3d0('0x42')][_0xe3d0('0x5d')]];}var _0x589f32=[];return Promise[_0xe3d0('0x10d')]()[_0xe3d0('0x1e')](function(){if(!_0x4de346)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0xe3d0('0x34')][_0xe3d0('0xcb')]({'where':{'id':_0x2176b4}});})[_0xe3d0('0x1e')](function(_0x1d69e1){if(!_0x1d69e1)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x26afe1['params']['id']));return db[_0xe3d0('0x65')]['transaction'](function(_0x5a8452){return _0x1d69e1[_0xe3d0('0x117')](_0x4de346,{'transaction':_0x5a8452})['then'](function(){return db[_0xe3d0('0x10c')][_0xe3d0('0x48')]({'where':{'id':{'$in':_0x4de346}}});})[_0xe3d0('0x1e')](function(_0x1177f7){var _0x4f3ab6=_['map'](_0x1177f7,function(_0x244f9b){return _0x244f9b['getAssociatedQueues']();});return Promise[_0xe3d0('0x51')](_0x4f3ab6);})[_0xe3d0('0x1e')](function(_0x3912d1){_0x589f32=_['flattenDeep'](_0x3912d1);var _0x217376=_[_0xe3d0('0x2a')](_0x589f32,function(_0x3b899c){return _0x3b899c['removeAgent'](_0x1d69e1['id'],{'transaction':_0x5a8452});});return Promise[_0xe3d0('0x51')](_0x217376);})[_0xe3d0('0x1e')](function(){if(!_0x1d69e1[_0xe3d0('0x97')])return;var _0x344df6=_[_0xe3d0('0x28')](_0x589f32,function(_0x45f262){return _0x45f262[_0xe3d0('0x113')](_0xe3d0('0x96'))===_0xe3d0('0x114');});var _0x5c69bb=_['map'](_0x344df6,function(_0x133b10){return db[_0xe3d0('0xa4')][_0xe3d0('0x22')]({'where':{'VoiceQueueId':_0x133b10['id'],'UserId':_0x1d69e1['id']},'transaction':_0x5a8452});});return Promise[_0xe3d0('0x51')](_0x5c69bb);})[_0xe3d0('0x1e')](function(){return db[_0xe3d0('0x115')][_0xe3d0('0x48')]({'where':{'teamId':{'$in':_0x4de346}}});})[_0xe3d0('0x1e')](function(_0x428c66){var _0x4d2e89=_['map'](_0x428c66,function(_0x37e503){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x1d69e1['id'],'VoicePrefixId':_0x37e503[_0xe3d0('0x118')]}},{'transaction':_0x5a8452});});return Promise[_0xe3d0('0x51')](_0x4d2e89);});});})[_0xe3d0('0x1e')](function(){for(var _0x4dc3c1=0x0;_0x4dc3c1<_0x589f32[_0xe3d0('0x4b')];_0x4dc3c1++){var _0x5ed286=_0x589f32[_0x4dc3c1]['getDataValue'](_0xe3d0('0x96'));var _0x409f17=_0x5ed286+_0xe3d0('0xa9');socket['emit']('user'+_0x5ed286+_0xe3d0('0xab'),{'UserId':_0x2176b4,['queueField']:_0x589f32[_0x4dc3c1]['id']});}})[_0xe3d0('0x1e')](respondWithStatusCode(_0xc736d0,null))[_0xe3d0('0x52')](APIHandleError(_0xc736d0));};exports[_0xe3d0('0x119')]=function(_0x212d5d,_0x45f2fc){var _0xcb6d2d={};var _0x48842b={};var _0x4eba95;var _0x33ca0e;return db[_0xe3d0('0x34')][_0xe3d0('0xcb')]({'where':{'id':_0x212d5d['params']['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x45f2fc,null))['then'](function(_0x1dcbe9){if(_0x1dcbe9){_0x4eba95=_0x1dcbe9;_0x48842b[_0xe3d0('0xcc')]=_[_0xe3d0('0xce')](db[_0xe3d0('0xc4')][_0xe3d0('0x35')]);_0x48842b[_0xe3d0('0x42')]=_[_0xe3d0('0xce')](_0x212d5d[_0xe3d0('0x42')]);_0x48842b[_0xe3d0('0xcf')]=_['intersection'](_0x48842b[_0xe3d0('0xcc')],_0x48842b[_0xe3d0('0x42')]);_0xcb6d2d[_0xe3d0('0x46')]=_['intersection'](_0x48842b[_0xe3d0('0xcc')],qs[_0xe3d0('0xd1')](_0x212d5d[_0xe3d0('0x42')][_0xe3d0('0xd1')]));_0xcb6d2d['attributes']=_0xcb6d2d[_0xe3d0('0x46')]['length']?_0xcb6d2d[_0xe3d0('0x46')]:_0x48842b[_0xe3d0('0xcc')];_0xcb6d2d[_0xe3d0('0xd2')]=qs[_0xe3d0('0xd3')](_0x212d5d['query'][_0xe3d0('0xd3')]);_0xcb6d2d[_0xe3d0('0x41')]=qs[_0xe3d0('0xcf')](_[_0xe3d0('0xd4')](_0x212d5d[_0xe3d0('0x42')],_0x48842b[_0xe3d0('0xcf')]));if(_0x212d5d[_0xe3d0('0x42')]['filter']){_0xcb6d2d[_0xe3d0('0x41')]=_[_0xe3d0('0x56')](_0xcb6d2d['where'],{'$or':_['map'](_0xcb6d2d['attributes'],function(_0xa3e6ed){var _0x2277aa={};_0x2277aa[_0xa3e6ed]={'$like':'%'+_0x212d5d['query'][_0xe3d0('0x28')]+'%'};return _0x2277aa;})});}_0xcb6d2d=_[_0xe3d0('0x56')]({},_0xcb6d2d,_0x212d5d[_0xe3d0('0xd8')]);return _0x4eba95[_0xe3d0('0x119')](_0xcb6d2d);}})[_0xe3d0('0x1e')](function(_0x451712){if(_0x451712){_0x33ca0e=_0x451712[_0xe3d0('0x4b')];if(!_0x212d5d[_0xe3d0('0x42')][_0xe3d0('0xc3')](_0xe3d0('0xd6'))){_0xcb6d2d[_0xe3d0('0x19')]=qs['limit'](_0x212d5d[_0xe3d0('0x42')][_0xe3d0('0x19')]);_0xcb6d2d[_0xe3d0('0x1c')]=qs['offset'](_0x212d5d['query']['offset']);}return _0x4eba95[_0xe3d0('0x119')](_0xcb6d2d);}})['then'](function(_0xd89125){if(_0xd89125){return _0xd89125?{'count':_0x33ca0e,'rows':_0xd89125}:null;}})[_0xe3d0('0x1e')](respondWithResult(_0x45f2fc,null))[_0xe3d0('0x52')](handleError(_0x45f2fc,null));};exports[_0xe3d0('0x11a')]=function(_0x26de97,_0x657797){var _0x299910={};var _0x461468={};var _0x3a529a;return db[_0xe3d0('0x34')]['findOne']({'where':{'id':_0x26de97[_0xe3d0('0x54')]['id']}})[_0xe3d0('0x1e')](handleEntityNotFound(_0x657797,null))[_0xe3d0('0x1e')](function(_0x2d1d3d){if(_0x2d1d3d){_0x3a529a=_0x2d1d3d;_0x461468[_0xe3d0('0xcc')]=_[_0xe3d0('0xce')](db[_0xe3d0('0x34')][_0xe3d0('0x35')]);_0x461468['query']=_[_0xe3d0('0xce')](_0x26de97['query']);_0x461468[_0xe3d0('0xcf')]=_['intersection'](_0x461468[_0xe3d0('0xcc')],_0x461468[_0xe3d0('0x42')]);_0x299910['attributes']=_[_0xe3d0('0xd0')](_0x461468[_0xe3d0('0xcc')],qs[_0xe3d0('0xd1')](_0x26de97[_0xe3d0('0x42')]['fields']));_0x299910[_0xe3d0('0x46')]=_0x299910[_0xe3d0('0x46')][_0xe3d0('0x4b')]?_0x299910[_0xe3d0('0x46')]:_0x461468[_0xe3d0('0xcc')];_0x299910['order']=qs[_0xe3d0('0xd3')](_0x26de97[_0xe3d0('0x42')]['sort']);_0x299910['where']=qs[_0xe3d0('0xcf')](_[_0xe3d0('0xd4')](_0x26de97[_0xe3d0('0x42')],_0x461468[_0xe3d0('0xcf')]));if(_0x26de97['query'][_0xe3d0('0x28')]){_0x299910[_0xe3d0('0x41')]=_[_0xe3d0('0x56')](_0x299910['where'],{'$or':_[_0xe3d0('0x2a')](_0x299910[_0xe3d0('0x46')],function(_0x5aeaac){var _0x5f539d={};_0x5f539d[_0x5aeaac]={'$like':'%'+_0x26de97['query'][_0xe3d0('0x28')]+'%'};return _0x5f539d;})});}_0x299910[_0xe3d0('0xcc')]=db[_0xe3d0('0x34')];_0x299910['as']=_0xe3d0('0x26');_0x299910=_[_0xe3d0('0x56')]({},_0x299910,_0x26de97[_0xe3d0('0xd8')]);return _0x3a529a['getVoiceQueues']({'include':[_0x299910]});}})[_0xe3d0('0x1e')](function(_0x1cadcd){if(_0x1cadcd){var _0x567690={},_0x2c8ca8=[];for(var _0x597e53=0x0;_0x597e53<_0x1cadcd[_0xe3d0('0x4b')];_0x597e53+=0x1){for(var _0x3f5aaf=0x0,_0x4af3a3;_0x3f5aaf<_0x1cadcd[_0x597e53]['Agents'][_0xe3d0('0x4b')];_0x3f5aaf+=0x1){_0x4af3a3=_0x1cadcd[_0x597e53]['Agents'][_0x3f5aaf][_0xe3d0('0x23')]({'plain':!![]});_0x567690[_0x4af3a3['id']]=_0x4af3a3;}}_0x567690=_[_0xe3d0('0x11b')](_0x567690);for(var _0xcfdd85=qs[_0xe3d0('0x1c')](_0x26de97[_0xe3d0('0x42')][_0xe3d0('0x1c')]);_0xcfdd85<_0x567690['length']&&_0x2c8ca8[_0xe3d0('0x4b')]=_0xc13a35[_0x2d5b('0x55')]){throw new Error(_0x2d5b('0x56'));}})[_0x2d5b('0x1b')](function(){if(_0x548e21){return db[_0x2d5b('0x28')]['destroy']({'where':{'membername':_0x548e21[_0x2d5b('0x24')]},'individualHooks':!![]});}})[_0x2d5b('0x1b')](function(){if(_0x548e21){return _0x548e21[_0x2d5b('0x57')]({'raw':!![]});}})[_0x2d5b('0x1b')](function(_0x272e78){if(_0x548e21){if(_0x272e78){var _0x5196ac=[];_0x471883=_0x272e78;if(_0x471883[_0x2d5b('0x2b')]){for(var _0x500fa3=0x0;_0x500fa3<_0x471883['length'];_0x500fa3++){_0x5196ac[_0x2d5b('0x30')](db['UserVoiceQueueRt'][_0x2d5b('0x58')]({'membername':_0x548e21[_0x2d5b('0x24')],'UserId':_0x548e21['id'],'queue_name':_0x471883[_0x500fa3][_0x2d5b('0x24')],'VoiceQueueId':_0x471883[_0x500fa3]['id'],'interface':_0x428809,'paused':_0x548e21['loginInPause']||![],'penalty':_0x471883[_0x500fa3][_0x2d5b('0x59')]||0x0}));}return BPromise[_0x2d5b('0x4b')](_0x5196ac);}}}})[_0x2d5b('0x1b')](function(){if(_0x548e21){return db[_0x2d5b('0x5a')]['findAll']({'where':{'membername':_0x548e21[_0x2d5b('0x24')],'exitAt':null}});}})[_0x2d5b('0x1b')](function(_0x2417b8){if(_0x548e21){if(_0x2417b8&&_0x2417b8[_0x2d5b('0x2b')]){var _0x957eb8=[];_0x2417b8['forEach'](function(_0x5edf04){_0x957eb8['push'](_0x5edf04['update']({'exitAt':moment()[_0x2d5b('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2d5b('0x4b')](_0x957eb8);}}})['then'](function(){if(_0x548e21){var _0x1904f7=[];var _0x5c659d=[];var _0x3d5053=utils[_0x2d5b('0x5b')]();var _0x34784d={'membername':_0x548e21[_0x2d5b('0x24')],'interface':_0x428809,'enterAt':moment()[_0x2d5b('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x548e21[_0x2d5b('0x25')],'internal':_0x548e21[_0x2d5b('0x26')]};_0x3d5053[_0x2d5b('0x2f')](function(_0x1e4114){_0x1904f7[_0x2d5b('0x30')](_[_0x2d5b('0x5c')]({'channel':_0x1e4114,'type':_0x2d5b('0x5d'),'data1':_0x2d5b('0x5e'),'data2':_0x428809},_0x34784d));if(_0x548e21[_0x2d5b('0x4f')]){_0x5c659d['push'](_[_0x2d5b('0x5c')]({'channel':_0x1e4114,'type':_0x2d5b('0x2a'),'data1':'LOGININPAUSE'},_0x34784d));}});return db['MemberReport']['bulkCreate'](_0x1904f7[_0x2d5b('0x5f')](_0x5c659d),{'individualHooks':!![]});}})[_0x2d5b('0x1b')](function(){if(_0x548e21){return _0x548e21[_0x2d5b('0x29')]({'online':!![],'lastLoginAt':moment()[_0x2d5b('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x548e21[_0x2d5b('0x4f')]||![],'mailPause':_0x548e21['loginInPause']||![],'chatPause':_0x548e21[_0x2d5b('0x4f')]||![],'faxPause':_0x548e21['loginInPause']||![],'smsPause':_0x548e21[_0x2d5b('0x4f')]||![],'openchannelPause':_0x548e21[_0x2d5b('0x4f')]||![],'pauseType':_0x548e21[_0x2d5b('0x4f')]?_0x2d5b('0x60'):null,'lastPauseAt':moment()[_0x2d5b('0x2c')](_0x2d5b('0x2d')),'interface':_0x428809});}})[_0x2d5b('0x1b')](function(_0x340310){_0x2c40cc(_0x340310);})[_0x2d5b('0x47')](function(_0x10efcd){_0x256f36(_0x59a740[_0x2d5b('0x1f')](0x1f4,_0x10efcd[_0x2d5b('0x20')]));});});}; \ No newline at end of file +var _0x839e=['LoginUser','mobile','loginInPause','count','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','UserVoiceQueue.penalty','all','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','raw','attributes','limit','include','map','model','then','info','stringify','error','message','ShowUser','where','debug','find','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','catch','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','findOne','destroy','length','push'];(function(_0x20bf3a,_0x5f05c0){var _0x3c8cbb=function(_0x260acd){while(--_0x260acd){_0x20bf3a['push'](_0x20bf3a['shift']());}};_0x3c8cbb(++_0x5f05c0);}(_0x839e,0x114));var _0xe839=function(_0x48fb10,_0xa50a89){_0x48fb10=_0x48fb10-0x0;var _0x534251=_0x839e[_0x48fb10];return _0x534251;};'use strict';var _=require(_0xe839('0x0'));var util=require(_0xe839('0x1'));var moment=require(_0xe839('0x2'));var BPromise=require(_0xe839('0x3'));var Redis=require('ioredis');var db=require(_0xe839('0x4'))['db'];var utils=require(_0xe839('0x5'));var logger=require(_0xe839('0x6'))(_0xe839('0x7'));var config=require(_0xe839('0x8'));config[_0xe839('0x9')]=_['defaults'](config[_0xe839('0x9')],{'host':_0xe839('0xa'),'port':0x18eb});var socket=require(_0xe839('0xb'))(new Redis(config[_0xe839('0x9')]));require(_0xe839('0xc'))[_0xe839('0xd')](socket);exports[_0xe839('0xe')]=function(_0x50f02e){var _0x44f731=this;return new Promise(function(_0x190a26,_0x421f6b){return db[_0xe839('0xf')][_0xe839('0x10')]({'raw':_0x50f02e[_0xe839('0x11')]?_0x50f02e[_0xe839('0x11')][_0xe839('0x12')]===undefined?!![]:![]:!![],'where':_0x50f02e['options']?_0x50f02e[_0xe839('0x11')]['where']||null:null,'attributes':_0x50f02e[_0xe839('0x11')]?_0x50f02e[_0xe839('0x11')][_0xe839('0x13')]||null:null,'limit':_0x50f02e[_0xe839('0x11')]?_0x50f02e[_0xe839('0x11')][_0xe839('0x14')]||null:null,'include':_0x50f02e[_0xe839('0x11')]?_0x50f02e[_0xe839('0x11')][_0xe839('0x15')]?_[_0xe839('0x16')](_0x50f02e['options'][_0xe839('0x15')],function(_0x1b27a6){return{'model':db[_0x1b27a6[_0xe839('0x17')]],'as':_0x1b27a6['as'],'attributes':_0x1b27a6[_0xe839('0x13')],'include':_0x1b27a6[_0xe839('0x15')]?_[_0xe839('0x16')](_0x1b27a6[_0xe839('0x15')],function(_0x2dff1b){return{'model':db[_0x2dff1b[_0xe839('0x17')]],'as':_0x2dff1b['as'],'attributes':_0x2dff1b[_0xe839('0x13')],'include':_0x2dff1b[_0xe839('0x15')]?_[_0xe839('0x16')](_0x2dff1b[_0xe839('0x15')],function(_0x2ac53b){return{'model':db[_0x2ac53b[_0xe839('0x17')]],'as':_0x2ac53b['as'],'attributes':_0x2ac53b[_0xe839('0x13')]};}):[]};}):[]};}):[]:[]})[_0xe839('0x18')](function(_0x55a120){logger[_0xe839('0x19')](_0xe839('0xe'),_0x50f02e);logger['debug'](_0xe839('0xe'),_0x50f02e,JSON[_0xe839('0x1a')](_0x55a120));_0x190a26(_0x55a120);})['catch'](function(_0x438b27){logger[_0xe839('0x1b')](_0xe839('0xe'),_0x438b27[_0xe839('0x1c')],_0x50f02e);_0x421f6b(_0x44f731[_0xe839('0x1b')](0x1f4,_0x438b27[_0xe839('0x1c')]));});});};exports[_0xe839('0x1d')]=function(_0x2832cf){var _0x39097d=this;return new Promise(function(_0x1ead0f,_0x491c8b){return db[_0xe839('0xf')]['find']({'raw':_0x2832cf['options']?_0x2832cf[_0xe839('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x2832cf[_0xe839('0x11')]?_0x2832cf[_0xe839('0x11')][_0xe839('0x1e')]||null:null,'attributes':_0x2832cf['options']?_0x2832cf['options']['attributes']||null:null,'include':_0x2832cf[_0xe839('0x11')]?_0x2832cf[_0xe839('0x11')]['include']?_['map'](_0x2832cf['options'][_0xe839('0x15')],function(_0x3b00be){return{'model':db[_0x3b00be[_0xe839('0x17')]],'as':_0x3b00be['as'],'attributes':_0x3b00be[_0xe839('0x13')],'include':_0x3b00be[_0xe839('0x15')]?_[_0xe839('0x16')](_0x3b00be[_0xe839('0x15')],function(_0x3e4b4f){return{'model':db[_0x3e4b4f[_0xe839('0x17')]],'as':_0x3e4b4f['as'],'attributes':_0x3e4b4f[_0xe839('0x13')],'include':_0x3e4b4f[_0xe839('0x15')]?_[_0xe839('0x16')](_0x3e4b4f[_0xe839('0x15')],function(_0x58c9c6){return{'model':db[_0x58c9c6[_0xe839('0x17')]],'as':_0x58c9c6['as'],'attributes':_0x58c9c6[_0xe839('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c1cc9){logger[_0xe839('0x19')](_0xe839('0x1d'),_0x2832cf);logger[_0xe839('0x1f')](_0xe839('0x1d'),_0x2832cf,JSON[_0xe839('0x1a')](_0x1c1cc9));_0x1ead0f(_0x1c1cc9);})['catch'](function(_0x1e2fa0){logger[_0xe839('0x1b')](_0xe839('0x1d'),_0x1e2fa0[_0xe839('0x1c')],_0x2832cf);_0x491c8b(_0x39097d['error'](0x1f4,_0x1e2fa0[_0xe839('0x1c')]));});});};exports['PauseUser']=function(_0x13c214){var _0x166027;return db[_0xe839('0xf')][_0xe839('0x20')]({'where':_0x13c214[_0xe839('0x11')][_0xe839('0x1e')]||{},'attributes':['id',_0xe839('0x21'),_0xe839('0x22'),_0xe839('0x23'),_0xe839('0x24')]})[_0xe839('0x18')](function(_0x19b6f1){if(!_0x19b6f1){throw new Error(util[_0xe839('0x25')](_0xe839('0x26'),_0x13c214[_0xe839('0x27')]['id']));}_0x166027=_0x19b6f1;return db[_0xe839('0x28')][_0xe839('0x29')]({'paused':0x1},{'where':{'UserId':_0x166027['id']},'individualHooks':!![]});})[_0xe839('0x18')](function(){return db[_0xe839('0x2a')]['findAll']({'where':{'membername':_0x166027[_0xe839('0x21')],'type':_0xe839('0x2b'),'exitAt':null}});})['then'](function(_0x5c2b3b){if(_0x5c2b3b&&_0x5c2b3b['length']){var _0x8d8f4f=moment()[_0xe839('0x25')](_0xe839('0x2c'));for(var _0x482f22=0x0,_0xab945a=_0x5c2b3b['length'];_0x482f22<_0xab945a;_0x482f22++){_0x5c2b3b[_0x482f22][_0xe839('0x2d')]({'exitAt':_0x8d8f4f});}}})[_0xe839('0x18')](function(){var _0x5b2e45=[];var _0x3d736a=utils[_0xe839('0x2e')]();_0x3d736a[_0xe839('0x2f')](function(_0x4f1c14){_0x5b2e45['push']({'channel':_0x4f1c14,'membername':_0x166027[_0xe839('0x21')],'interface':_[_0xe839('0x30')](_0x166027['interface'])?util[_0xe839('0x25')]('SIP/%s',_0x166027[_0xe839('0x21')]):_0x166027[_0xe839('0x24')],'type':_0xe839('0x2b'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x13c214[_0xe839('0x31')][_0xe839('0x32')]||_0xe839('0x33'),'role':_0x166027[_0xe839('0x22')],'internal':_0x166027[_0xe839('0x23')],'uniqueid':_0x13c214[_0xe839('0x31')][_0xe839('0x34')]||null});});return db[_0xe839('0x2a')][_0xe839('0x35')](_0x5b2e45,{'individualHooks':!![]});})[_0xe839('0x18')](function(){return _0x166027['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x13c214[_0xe839('0x31')][_0xe839('0x32')]||_0xe839('0x33'),'lastPauseAt':moment()[_0xe839('0x25')](_0xe839('0x2c'))});})[_0xe839('0x36')](function(_0x39a535){throw _0x39a535;});};exports['UnpauseUser']=function(_0x60ab04){return Promise[_0xe839('0x37')]()[_0xe839('0x18')](function(){if(_0x60ab04[_0xe839('0x31')][_0xe839('0x38')]&&!utils[_0xe839('0x39')](_0x60ab04['body'][_0xe839('0x38')])){throw new Error(util[_0xe839('0x25')](_0xe839('0x3a'),_0x60ab04[_0xe839('0x31')][_0xe839('0x38')]));}return db[_0xe839('0xf')]['findOne']({'where':_0x60ab04['options']['where']||{},'attributes':['id',_0xe839('0x21'),'role',_0xe839('0x23'),_0xe839('0x24'),_0xe839('0x3b'),_0xe839('0x3c'),_0xe839('0x3d'),_0xe839('0x3e'),_0xe839('0x3f'),_0xe839('0x40'),_0xe839('0x41'),_0xe839('0x42'),'pauseType',_0xe839('0x43')]});})[_0xe839('0x18')](function(_0x5d4693){if(!_0x5d4693){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x60ab04[_0xe839('0x27')]['id']));}return _0x5d4693['unpause'](_0x60ab04[_0xe839('0x31')][_0xe839('0x38')],'system');})[_0xe839('0x36')](function(_0x1cb9ed){throw _0x1cb9ed;});};exports['LogoutUser']=function(_0x4b17a8){var _0x4a4e95=this;return new Promise(function(_0x48a0c4,_0x2cb82a){var _0xe72a45;return db['User'][_0xe839('0x44')]({'where':_0x4b17a8[_0xe839('0x11')][_0xe839('0x1e')]||{},'attributes':['id','name']})['then'](function(_0x16da80){if(_0x16da80){_0xe72a45=_0x16da80;return db['UserVoiceQueueRt'][_0xe839('0x45')]({'where':{'membername':_0xe72a45[_0xe839('0x21')]},'individualHooks':!![]});}})[_0xe839('0x18')](function(){if(_0xe72a45){return db[_0xe839('0x2a')][_0xe839('0x10')]({'where':{'membername':_0xe72a45[_0xe839('0x21')],'exitAt':null}});}})[_0xe839('0x18')](function(_0x228988){if(_0xe72a45){if(_0x228988&&_0x228988[_0xe839('0x46')]){var _0x58aba4=[];_0x228988[_0xe839('0x2f')](function(_0x19c8b8){_0x58aba4[_0xe839('0x47')](_0x19c8b8[_0xe839('0x29')]({'exitAt':moment()[_0xe839('0x25')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x58aba4);}}})[_0xe839('0x18')](function(){if(_0xe72a45){return _0xe72a45[_0xe839('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xe839('0x18')](function(_0x39fb0a){_0x48a0c4(_0x39fb0a);})[_0xe839('0x36')](function(_0x30546d){_0x2cb82a(_0x4a4e95[_0xe839('0x1b')](0x1f4,_0x30546d[_0xe839('0x1c')]));});});};exports[_0xe839('0x48')]=function(_0x21a586){var _0x1c4c51=this;return new Promise(function(_0x1a5846,_0x42687b){var _0x302697;var _0x78321d;var _0x4ce4b2;var _0x2a5f1c;return db[_0xe839('0xf')][_0xe839('0x44')]({'where':_0x21a586[_0xe839('0x11')][_0xe839('0x1e')]||{},'attributes':['id',_0xe839('0x21'),_0xe839('0x22'),_0xe839('0x49'),'phone','internal',_0xe839('0x4a'),'interface']})[_0xe839('0x18')](function(_0x504ac7){if(_0x504ac7){_0x302697=_0x504ac7;_0x2a5f1c=_0x21a586[_0xe839('0x31')][_0xe839('0x24')]?_0x21a586['body'][_0xe839('0x24')]:util[_0xe839('0x25')]('SIP/%s',_0x302697[_0xe839('0x21')]);return db[_0xe839('0xf')][_0xe839('0x4b')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x302697['id']}}});}})[_0xe839('0x18')](function(_0x3b9aa6){if(_0x3b9aa6){_0x4ce4b2=_0x3b9aa6;return require('../../config/license/util')[_0xe839('0x4c')]();}})[_0xe839('0x18')](function(_0x539c86){if(_0x539c86&&_0x539c86['agents']&&_0x4ce4b2>=_0x539c86[_0xe839('0x4d')]){throw new Error(_0xe839('0x4e'));}})[_0xe839('0x18')](function(){if(_0x302697){return db[_0xe839('0x28')][_0xe839('0x45')]({'where':{'membername':_0x302697[_0xe839('0x21')]},'individualHooks':!![]});}})[_0xe839('0x18')](function(){if(_0x302697){return _0x302697[_0xe839('0x4f')]({'raw':!![]});}})[_0xe839('0x18')](function(_0x301471){if(_0x302697){if(_0x301471){var _0x245fb5=[];_0x78321d=_0x301471;if(_0x78321d[_0xe839('0x46')]){for(var _0x4e7790=0x0;_0x4e7790<_0x78321d[_0xe839('0x46')];_0x4e7790++){_0x245fb5['push'](db[_0xe839('0x28')]['upsert']({'membername':_0x302697[_0xe839('0x21')],'UserId':_0x302697['id'],'queue_name':_0x78321d[_0x4e7790][_0xe839('0x21')],'VoiceQueueId':_0x78321d[_0x4e7790]['id'],'interface':_0x2a5f1c,'paused':_0x302697[_0xe839('0x4a')]||![],'penalty':_0x78321d[_0x4e7790][_0xe839('0x50')]||0x0}));}return BPromise['all'](_0x245fb5);}}}})['then'](function(){if(_0x302697){return db[_0xe839('0x2a')]['findAll']({'where':{'membername':_0x302697['name'],'exitAt':null}});}})['then'](function(_0x369288){if(_0x302697){if(_0x369288&&_0x369288[_0xe839('0x46')]){var _0x434967=[];_0x369288[_0xe839('0x2f')](function(_0x2b81a4){_0x434967[_0xe839('0x47')](_0x2b81a4[_0xe839('0x29')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xe839('0x51')](_0x434967);}}})['then'](function(){if(_0x302697){var _0x3c980f=[];var _0x174ea5=[];var _0x1709f0=utils[_0xe839('0x2e')]();var _0x134b62={'membername':_0x302697[_0xe839('0x21')],'interface':_0x2a5f1c,'enterAt':moment()['format'](_0xe839('0x2c')),'role':_0x302697[_0xe839('0x22')],'internal':_0x302697[_0xe839('0x23')]};_0x1709f0['forEach'](function(_0x3da657){_0x3c980f[_0xe839('0x47')](_[_0xe839('0x52')]({'channel':_0x3da657,'type':_0xe839('0x53'),'data1':_0xe839('0x54'),'data2':_0x2a5f1c},_0x134b62));if(_0x302697['loginInPause']){_0x174ea5['push'](_[_0xe839('0x52')]({'channel':_0x3da657,'type':_0xe839('0x2b'),'data1':_0xe839('0x55')},_0x134b62));}});return db['MemberReport'][_0xe839('0x35')](_0x3c980f[_0xe839('0x56')](_0x174ea5),{'individualHooks':!![]});}})[_0xe839('0x18')](function(){if(_0x302697){return _0x302697[_0xe839('0x29')]({'online':!![],'lastLoginAt':moment()[_0xe839('0x25')](_0xe839('0x2c')),'voicePause':_0x302697[_0xe839('0x4a')]||![],'mailPause':_0x302697[_0xe839('0x4a')]||![],'chatPause':_0x302697[_0xe839('0x4a')]||![],'faxPause':_0x302697[_0xe839('0x4a')]||![],'smsPause':_0x302697[_0xe839('0x4a')]||![],'openchannelPause':_0x302697[_0xe839('0x4a')]||![],'pauseType':_0x302697[_0xe839('0x4a')]?_0xe839('0x55'):null,'lastPauseAt':moment()[_0xe839('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2a5f1c});}})['then'](function(_0xc7b598){_0x1a5846(_0xc7b598);})[_0xe839('0x36')](function(_0x355f4e){_0x42687b(_0x1c4c51[_0xe839('0x1b')](0x1f4,_0x355f4e[_0xe839('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d6fc3af..913334c 100644 --- a/server/api/user/user.socket.js +++ b/server/api/user/user.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca01=['remove','emit','removeListener','register','length','user:','./user.events','save'];(function(_0xc27d6,_0x5dd679){var _0x692658=function(_0x56e819){while(--_0x56e819){_0xc27d6['push'](_0xc27d6['shift']());}};_0x692658(++_0x5dd679);}(_0xca01,0x66));var _0x1ca0=function(_0x3a8963,_0x4a27fd){_0x3a8963=_0x3a8963-0x0;var _0x47e069=_0xca01[_0x3a8963];return _0x47e069;};'use strict';var UserEvents=require(_0x1ca0('0x0'));var events=[_0x1ca0('0x1'),_0x1ca0('0x2'),'update'];function createListener(_0x417123,_0x2d8569){return function(_0x14e6ce){_0x2d8569[_0x1ca0('0x3')](_0x417123,_0x14e6ce);};}function removeListener(_0x2c00f9,_0x2cc96e){return function(){UserEvents[_0x1ca0('0x4')](_0x2c00f9,_0x2cc96e);};}exports[_0x1ca0('0x5')]=function(_0x53af99){for(var _0x5a07fa=0x0,_0x76f6e3=events[_0x1ca0('0x6')];_0x5a07fa<_0x76f6e3;_0x5a07fa++){var _0x75a7a7=events[_0x5a07fa];var _0x163626=createListener(_0x1ca0('0x7')+_0x75a7a7,_0x53af99);UserEvents['on'](_0x75a7a7,_0x163626);}}; \ No newline at end of file +var _0x4072=['update','removeListener','./user.events'];(function(_0x53758e,_0x26a255){var _0x38a698=function(_0x2a7f21){while(--_0x2a7f21){_0x53758e['push'](_0x53758e['shift']());}};_0x38a698(++_0x26a255);}(_0x4072,0x1af));var _0x2407=function(_0x540314,_0x30e8a5){_0x540314=_0x540314-0x0;var _0xff9b2a=_0x4072[_0x540314];return _0xff9b2a;};'use strict';var UserEvents=require(_0x2407('0x0'));var events=['save','remove',_0x2407('0x1')];function createListener(_0xdc66d0,_0x2ee864){return function(_0x5d0f0f){_0x2ee864['emit'](_0xdc66d0,_0x5d0f0f);};}function removeListener(_0x2d8cd4,_0x24bfc7){return function(){UserEvents[_0x2407('0x2')](_0x2d8cd4,_0x24bfc7);};}exports['register']=function(_0x5e2ffc){for(var _0x5ba948=0x0,_0x224cc8=events['length'];_0x5ba948<_0x224cc8;_0x5ba948++){var _0x50b9a9=events[_0x5ba948];var _0x108fa2=createListener('user:'+_0x50b9a9,_0x5e2ffc);UserEvents['on'](_0x50b9a9,_0x108fa2);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 4ac5b99..34c4b56 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1c2fd7,_0x595cf1){var _0x369e9d=function(_0x12d274){while(--_0x12d274){_0x1c2fd7['push'](_0x1c2fd7['shift']());}};_0x369e9d(++_0x595cf1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4d9b59,_0x4b102d){var _0x11a418=function(_0x164bb9){while(--_0x164bb9){_0x4d9b59['push'](_0x4d9b59['shift']());}};_0x11a418(++_0x4b102d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index c8cb564..df140f1 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f59=['exports','INTEGER'];(function(_0x21aa0f,_0x1b7cbb){var _0x2a27f0=function(_0x5abaf1){while(--_0x5abaf1){_0x21aa0f['push'](_0x21aa0f['shift']());}};_0x2a27f0(++_0x1b7cbb);}(_0x3f59,0x12a));var _0x93f5=function(_0x1b2f2b,_0x3fd926){_0x1b2f2b=_0x1b2f2b-0x0;var _0x165926=_0x3f59[_0x1b2f2b];return _0x165926;};'use strict';var Sequelize=require('sequelize');module[_0x93f5('0x0')]={'penalty':{'type':Sequelize[_0x93f5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbbfa=['INTEGER','sequelize','exports'];(function(_0x484e3b,_0x5d34ac){var _0x5c017f=function(_0x565413){while(--_0x565413){_0x484e3b['push'](_0x484e3b['shift']());}};_0x5c017f(++_0x5d34ac);}(_0xbbfa,0x175));var _0xabbf=function(_0x4d82e1,_0x5ac72b){_0x4d82e1=_0x4d82e1-0x0;var _0x5f3bd9=_0xbbfa[_0x4d82e1];return _0x5f3bd9;};'use strict';var Sequelize=require(_0xabbf('0x0'));module[_0xabbf('0x1')]={'penalty':{'type':Sequelize[_0xabbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 0391983..d045368 100644 --- a/server/api/userChatQueue/userChatQueue.model.js +++ b/server/api/userChatQueue/userChatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47eb=['api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x10c5b5,_0x20422a){var _0x3a2afd=function(_0x64d174){while(--_0x64d174){_0x10c5b5['push'](_0x10c5b5['shift']());}};_0x3a2afd(++_0x20422a);}(_0x47eb,0x1a1));var _0xb47e=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x47eb[_0x3efe87];return _0x56a4cc;};'use strict';var _=require(_0xb47e('0x0'));var util=require(_0xb47e('0x1'));var logger=require(_0xb47e('0x2'))(_0xb47e('0x3'));var moment=require(_0xb47e('0x4'));var BPromise=require(_0xb47e('0x5'));var rp=require(_0xb47e('0x6'));var fs=require('fs');var path=require(_0xb47e('0x7'));var rimraf=require(_0xb47e('0x8'));var config=require('../../config/environment');var attributes=require(_0xb47e('0x9'));module['exports']=function(_0xdfc1ee,_0x12bcc9){return _0xdfc1ee['define'](_0xb47e('0xa'),attributes,{'tableName':_0xb47e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x641c=['./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x641c,0x93));var _0xc641=function(_0x146f5a,_0xe26f2b){_0x146f5a=_0x146f5a-0x0;var _0x3b425b=_0x641c[_0x146f5a];return _0x3b425b;};'use strict';var _=require(_0xc641('0x0'));var util=require(_0xc641('0x1'));var logger=require(_0xc641('0x2'))(_0xc641('0x3'));var moment=require(_0xc641('0x4'));var BPromise=require(_0xc641('0x5'));var rp=require(_0xc641('0x6'));var fs=require('fs');var path=require(_0xc641('0x7'));var rimraf=require('rimraf');var config=require(_0xc641('0x8'));var attributes=require(_0xc641('0x9'));module['exports']=function(_0x154a1e,_0x5c32b4){return _0x154a1e[_0xc641('0xa')](_0xc641('0xb'),attributes,{'tableName':_0xc641('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 824c279..17ab0d9 100644 --- a/server/api/userChatQueue/userChatQueue.rpc.js +++ b/server/api/userChatQueue/userChatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d4b=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x48871b,_0x546dc8){var _0x19cdfa=function(_0x456466){while(--_0x456466){_0x48871b['push'](_0x48871b['shift']());}};_0x19cdfa(++_0x546dc8);}(_0x6d4b,0x1d2));var _0xb6d4=function(_0x3599c8,_0x58a4b9){_0x3599c8=_0x3599c8-0x0;var _0x58611f=_0x6d4b[_0x3599c8];return _0x58611f;};'use strict';var _=require(_0xb6d4('0x0'));var util=require('util');var moment=require(_0xb6d4('0x1'));var BPromise=require(_0xb6d4('0x2'));var rs=require(_0xb6d4('0x3'));var fs=require('fs');var Redis=require(_0xb6d4('0x4'));var db=require(_0xb6d4('0x5'))['db'];var utils=require(_0xb6d4('0x6'));var logger=require(_0xb6d4('0x7'))(_0xb6d4('0x8'));var config=require(_0xb6d4('0x9'));var jayson=require(_0xb6d4('0xa'));var client=jayson['client'][_0xb6d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56ac46,_0x5231c8,_0x34cf3b){return new BPromise(function(_0x5f0715,_0x294bb0){return client[_0xb6d4('0xc')](_0x56ac46,_0x34cf3b)['then'](function(_0xefae5c){logger[_0xb6d4('0xd')](_0xb6d4('0xe'),_0x5231c8,'request\x20sent');logger['debug'](_0xb6d4('0xf'),_0x5231c8,_0xb6d4('0x10'),JSON[_0xb6d4('0x11')](_0xefae5c));if(_0xefae5c[_0xb6d4('0x12')]){if(_0xefae5c[_0xb6d4('0x12')][_0xb6d4('0x13')]===0x1f4){logger[_0xb6d4('0x12')](_0xb6d4('0xe'),_0x5231c8,_0xefae5c[_0xb6d4('0x12')][_0xb6d4('0x14')]);return _0x294bb0(_0xefae5c[_0xb6d4('0x12')]['message']);}logger[_0xb6d4('0x12')](_0xb6d4('0xe'),_0x5231c8,_0xefae5c[_0xb6d4('0x12')][_0xb6d4('0x14')]);return _0x5f0715(_0xefae5c[_0xb6d4('0x12')]['message']);}else{logger[_0xb6d4('0xd')](_0xb6d4('0xe'),_0x5231c8,_0xb6d4('0x10'));_0x5f0715(_0xefae5c[_0xb6d4('0x15')][_0xb6d4('0x14')]);}})[_0xb6d4('0x16')](function(_0x23e6ba){logger[_0xb6d4('0x12')](_0xb6d4('0xe'),_0x5231c8,_0x23e6ba);_0x294bb0(_0x23e6ba);});});} \ No newline at end of file +var _0x41b8=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x444990,_0x44196a){var _0x4b99de=function(_0x93733b){while(--_0x93733b){_0x444990['push'](_0x444990['shift']());}};_0x4b99de(++_0x44196a);}(_0x41b8,0xd7));var _0x841b=function(_0x280d43,_0x2e7450){_0x280d43=_0x280d43-0x0;var _0x14446d=_0x41b8[_0x280d43];return _0x14446d;};'use strict';var _=require(_0x841b('0x0'));var util=require(_0x841b('0x1'));var moment=require('moment');var BPromise=require(_0x841b('0x2'));var rs=require(_0x841b('0x3'));var fs=require('fs');var Redis=require(_0x841b('0x4'));var db=require(_0x841b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x841b('0x6'))(_0x841b('0x7'));var config=require(_0x841b('0x8'));var jayson=require(_0x841b('0x9'));var client=jayson[_0x841b('0xa')][_0x841b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ddda0,_0x4d5f6b,_0x5677a9){return new BPromise(function(_0x202ac0,_0x6454d6){return client['request'](_0x2ddda0,_0x5677a9)[_0x841b('0xc')](function(_0x2a854d){logger['info'](_0x841b('0xd'),_0x4d5f6b,_0x841b('0xe'));logger['debug'](_0x841b('0xf'),_0x4d5f6b,_0x841b('0xe'),JSON['stringify'](_0x2a854d));if(_0x2a854d[_0x841b('0x10')]){if(_0x2a854d['error'][_0x841b('0x11')]===0x1f4){logger[_0x841b('0x10')](_0x841b('0xd'),_0x4d5f6b,_0x2a854d[_0x841b('0x10')][_0x841b('0x12')]);return _0x6454d6(_0x2a854d[_0x841b('0x10')][_0x841b('0x12')]);}logger[_0x841b('0x10')](_0x841b('0xd'),_0x4d5f6b,_0x2a854d[_0x841b('0x10')]['message']);return _0x202ac0(_0x2a854d[_0x841b('0x10')]['message']);}else{logger['info'](_0x841b('0xd'),_0x4d5f6b,'request\x20sent');_0x202ac0(_0x2a854d['result'][_0x841b('0x12')]);}})[_0x841b('0x13')](function(_0x57755f){logger[_0x841b('0x10')](_0x841b('0xd'),_0x4d5f6b,_0x57755f);_0x6454d6(_0x57755f);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2049f96..32d6f06 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x60dd04,_0x2ef711){var _0x285a78=function(_0x1a8a64){while(--_0x1a8a64){_0x60dd04['push'](_0x60dd04['shift']());}};_0x285a78(++_0x2ef711);}(_0xe706,0xa3));var _0x6e70=function(_0x102287,_0x1c82dc){_0x102287=_0x102287-0x0;var _0x43d29e=_0xe706[_0x102287];return _0x43d29e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1e33fd,_0x12d3a5){var _0x4f4ea7=function(_0x3118e0){while(--_0x3118e0){_0x1e33fd['push'](_0x1e33fd['shift']());}};_0x4f4ea7(++_0x12d3a5);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 3a7ca96..396e49f 100644 --- a/server/api/userFaxQueue/userFaxQueue.attributes.js +++ b/server/api/userFaxQueue/userFaxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc065=['STRING','sequelize','INTEGER'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc065,0xee));var _0x5c06=function(_0x10cae5,_0x3fbcd6){_0x10cae5=_0x10cae5-0x0;var _0x5c0592=_0xc065[_0x10cae5];return _0x5c0592;};'use strict';var Sequelize=require(_0x5c06('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5c06('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5c06('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5c06('0x2')]}}; \ No newline at end of file +var _0xeb7b=['sequelize','exports','STRING'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0xeb7b,0x1b0));var _0xbeb7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeb7b[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xbeb7('0x0'));module[_0xbeb7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbeb7('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 82c126a..153cec6 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2925=['define','UserFaxQueue','user_has_fax_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x3c44d1,_0x46884c){var _0x4b7da9=function(_0x33b6ff){while(--_0x33b6ff){_0x3c44d1['push'](_0x3c44d1['shift']());}};_0x4b7da9(++_0x46884c);}(_0x2925,0x1ca));var _0x5292=function(_0x373087,_0x19ce52){_0x373087=_0x373087-0x0;var _0x57016b=_0x2925[_0x373087];return _0x57016b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5292('0x0'))(_0x5292('0x1'));var moment=require(_0x5292('0x2'));var BPromise=require(_0x5292('0x3'));var rp=require(_0x5292('0x4'));var fs=require('fs');var path=require(_0x5292('0x5'));var rimraf=require(_0x5292('0x6'));var config=require(_0x5292('0x7'));var attributes=require(_0x5292('0x8'));module[_0x5292('0x9')]=function(_0x21a2f4,_0x4b0f81){return _0x21a2f4[_0x5292('0xa')](_0x5292('0xb'),attributes,{'tableName':_0x5292('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5df5=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5df5,0x15b));var _0x55df=function(_0x461dd6,_0x471091){_0x461dd6=_0x461dd6-0x0;var _0x484d5f=_0x5df5[_0x461dd6];return _0x484d5f;};'use strict';var _=require(_0x55df('0x0'));var util=require(_0x55df('0x1'));var logger=require(_0x55df('0x2'))(_0x55df('0x3'));var moment=require(_0x55df('0x4'));var BPromise=require('bluebird');var rp=require(_0x55df('0x5'));var fs=require('fs');var path=require(_0x55df('0x6'));var rimraf=require('rimraf');var config=require(_0x55df('0x7'));var attributes=require(_0x55df('0x8'));module[_0x55df('0x9')]=function(_0x1eae13,_0x480b1c){return _0x1eae13[_0x55df('0xa')](_0x55df('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 95f13c2..17727de 100644 --- a/server/api/userFaxQueue/userFaxQueue.rpc.js +++ b/server/api/userFaxQueue/userFaxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a95=['util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','UserFaxQueue,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x3c2bfe,_0x550be9){var _0x1f7cd2=function(_0x369ada){while(--_0x369ada){_0x3c2bfe['push'](_0x3c2bfe['shift']());}};_0x1f7cd2(++_0x550be9);}(_0x1a95,0xef));var _0x51a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1a95[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x51a9('0x0'));var util=require(_0x51a9('0x1'));var moment=require(_0x51a9('0x2'));var BPromise=require(_0x51a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x51a9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x51a9('0x6'));var jayson=require(_0x51a9('0x7'));var client=jayson[_0x51a9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x75876b,_0x503b6f,_0x18a6b3){return new BPromise(function(_0x7cfa22,_0x16710c){return client['request'](_0x75876b,_0x18a6b3)[_0x51a9('0x9')](function(_0x189814){logger[_0x51a9('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x503b6f,_0x51a9('0xb'));logger[_0x51a9('0xc')](_0x51a9('0xd'),_0x503b6f,'request\x20sent',JSON[_0x51a9('0xe')](_0x189814));if(_0x189814['error']){if(_0x189814['error'][_0x51a9('0xf')]===0x1f4){logger['error'](_0x51a9('0x10'),_0x503b6f,_0x189814[_0x51a9('0x11')]['message']);return _0x16710c(_0x189814[_0x51a9('0x11')][_0x51a9('0x12')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x503b6f,_0x189814[_0x51a9('0x11')][_0x51a9('0x12')]);return _0x7cfa22(_0x189814[_0x51a9('0x11')][_0x51a9('0x12')]);}else{logger[_0x51a9('0xa')](_0x51a9('0x10'),_0x503b6f,_0x51a9('0xb'));_0x7cfa22(_0x189814[_0x51a9('0x13')][_0x51a9('0x12')]);}})['catch'](function(_0x43b544){logger['error'](_0x51a9('0x10'),_0x503b6f,_0x43b544);_0x16710c(_0x43b544);});});} \ No newline at end of file +var _0xf6af=['request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0xf6af,0x1d3));var _0xff6a=function(_0x1cf37a,_0x57e70b){_0x1cf37a=_0x1cf37a-0x0;var _0x578eb8=_0xf6af[_0x1cf37a];return _0x578eb8;};'use strict';var _=require(_0xff6a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xff6a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff6a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xff6a('0x3'));var logger=require(_0xff6a('0x4'))('rpc');var config=require(_0xff6a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xff6a('0x6')][_0xff6a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c2d70,_0x1b7f98,_0x3a1375){return new BPromise(function(_0x508236,_0x896146){return client[_0xff6a('0x8')](_0x1c2d70,_0x3a1375)[_0xff6a('0x9')](function(_0x2677f9){logger['info'](_0xff6a('0xa'),_0x1b7f98,_0xff6a('0xb'));logger[_0xff6a('0xc')](_0xff6a('0xd'),_0x1b7f98,_0xff6a('0xb'),JSON[_0xff6a('0xe')](_0x2677f9));if(_0x2677f9[_0xff6a('0xf')]){if(_0x2677f9[_0xff6a('0xf')][_0xff6a('0x10')]===0x1f4){logger[_0xff6a('0xf')](_0xff6a('0xa'),_0x1b7f98,_0x2677f9['error'][_0xff6a('0x11')]);return _0x896146(_0x2677f9[_0xff6a('0xf')][_0xff6a('0x11')]);}logger[_0xff6a('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x1b7f98,_0x2677f9[_0xff6a('0xf')][_0xff6a('0x11')]);return _0x508236(_0x2677f9[_0xff6a('0xf')][_0xff6a('0x11')]);}else{logger['info'](_0xff6a('0xa'),_0x1b7f98,'request\x20sent');_0x508236(_0x2677f9[_0xff6a('0x12')]['message']);}})['catch'](function(_0x20dfc3){logger[_0xff6a('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x1b7f98,_0x20dfc3);_0x896146(_0x20dfc3);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 33b572f..2c22330 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1bd34a,_0x574c63){var _0x1ed08e=function(_0x4f3977){while(--_0x4f3977){_0x1bd34a['push'](_0x1bd34a['shift']());}};_0x1ed08e(++_0x574c63);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1d9934,_0x15c292){var _0x3f8856=function(_0x2db3ea){while(--_0x2db3ea){_0x1d9934['push'](_0x1d9934['shift']());}};_0x3f8856(++_0x15c292);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ef61df9..9006424 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d7=['INTEGER','sequelize','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xd6d7,0x70));var _0x7d6d=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xd6d7[_0xb6e2ea];return _0x2a57bb;};'use strict';var Sequelize=require(_0x7d6d('0x0'));module[_0x7d6d('0x1')]={'penalty':{'type':Sequelize[_0x7d6d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index f1e3392..ee353b1 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe19d=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userMailQueue.attributes','define','user_has_mail_queues','lodash'];(function(_0x3212d9,_0x1382e8){var _0x1d875d=function(_0x2e30d4){while(--_0x2e30d4){_0x3212d9['push'](_0x3212d9['shift']());}};_0x1d875d(++_0x1382e8);}(_0xe19d,0xa7));var _0xde19=function(_0x302f85,_0x5bcca3){_0x302f85=_0x302f85-0x0;var _0x5ef7cb=_0xe19d[_0x302f85];return _0x5ef7cb;};'use strict';var _=require(_0xde19('0x0'));var util=require(_0xde19('0x1'));var logger=require(_0xde19('0x2'))(_0xde19('0x3'));var moment=require(_0xde19('0x4'));var BPromise=require(_0xde19('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde19('0x6'));var rimraf=require(_0xde19('0x7'));var config=require(_0xde19('0x8'));var attributes=require(_0xde19('0x9'));module['exports']=function(_0x7e6185,_0x20c283){return _0x7e6185[_0xde19('0xa')]('UserMailQueue',attributes,{'tableName':_0xde19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f3d=['lodash','../../config/logger','moment','path','rimraf','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x2c191f,_0x5b7a66){var _0x129027=function(_0x1e2043){while(--_0x1e2043){_0x2c191f['push'](_0x2c191f['shift']());}};_0x129027(++_0x5b7a66);}(_0x3f3d,0x13b));var _0xd3f3=function(_0x397ddb,_0x574faf){_0x397ddb=_0x397ddb-0x0;var _0x4af353=_0x3f3d[_0x397ddb];return _0x4af353;};'use strict';var _=require(_0xd3f3('0x0'));var util=require('util');var logger=require(_0xd3f3('0x1'))('api');var moment=require(_0xd3f3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3f3('0x3'));var rimraf=require(_0xd3f3('0x4'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0xd3f3('0x5')]=function(_0x41babe,_0x24f70c){return _0x41babe[_0xd3f3('0x6')](_0xd3f3('0x7'),attributes,{'tableName':_0xd3f3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 78c805c..8c1dba4 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2d87dc,_0x988802){var _0x31ac48=function(_0x3d5fe1){while(--_0x3d5fe1){_0x2d87dc['push'](_0x2d87dc['shift']());}};_0x31ac48(++_0x988802);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x83c716,_0x25152d){_0x83c716=_0x83c716-0x0;var _0xab9893=_0x7fbe[_0x83c716];return _0xab9893;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x183cc5,_0x2bddb1){var _0x62bfd4=function(_0x25d6b3){while(--_0x25d6b3){_0x183cc5['push'](_0x183cc5['shift']());}};_0x62bfd4(++_0x2bddb1);}(_0x55ca,0x126));var _0xa55c=function(_0x4ed9ef,_0x381176){_0x4ed9ef=_0x4ed9ef-0x0;var _0x2bb85b=_0x55ca[_0x4ed9ef];return _0x2bb85b;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index cb62ebe..9dd78c5 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd003=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0xd003,0xb6));var _0x3d00=function(_0x3c6755,_0x391785){_0x3c6755=_0x3c6755-0x0;var _0x18bc7d=_0xd003[_0x3c6755];return _0x18bc7d;};'use strict';var multer=require(_0x3d00('0x0'));var util=require(_0x3d00('0x1'));var path=require(_0x3d00('0x2'));var timeout=require(_0x3d00('0x3'));var express=require(_0x3d00('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d00('0x5'));var interaction=require(_0x3d00('0x6'));var config=require(_0x3d00('0x7'));var controller=require(_0x3d00('0x8'));router[_0x3d00('0x9')]('/',auth[_0x3d00('0xa')](),controller[_0x3d00('0xb')]);module[_0x3d00('0xc')]=router; \ No newline at end of file +var _0x752f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','path','connect-timeout'];(function(_0x325e1c,_0x52fb08){var _0x149f3f=function(_0x47bf0f){while(--_0x47bf0f){_0x325e1c['push'](_0x325e1c['shift']());}};_0x149f3f(++_0x52fb08);}(_0x752f,0x169));var _0xf752=function(_0x2c3ad5,_0x1336bf){_0x2c3ad5=_0x2c3ad5-0x0;var _0x4c08fd=_0x752f[_0x2c3ad5];return _0x4c08fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf752('0x0'));var timeout=require(_0xf752('0x1'));var express=require(_0xf752('0x2'));var router=express[_0xf752('0x3')]();var fs_extra=require(_0xf752('0x4'));var auth=require(_0xf752('0x5'));var interaction=require(_0xf752('0x6'));var config=require('../../config/environment');var controller=require(_0xf752('0x7'));router[_0xf752('0x8')]('/',auth[_0xf752('0x9')](),controller[_0xf752('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 254c84d..bdc2efa 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5145=['STRING','TEXT','BOOLEAN'];(function(_0x55f6fa,_0x4fe705){var _0x2445aa=function(_0x3cce64){while(--_0x3cce64){_0x55f6fa['push'](_0x55f6fa['shift']());}};_0x2445aa(++_0x4fe705);}(_0x5145,0x19e));var _0x5514=function(_0x2c5036,_0x3b3da9){_0x2c5036=_0x2c5036-0x0;var _0x4f48b3=_0x5145[_0x2c5036];return _0x4f48b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x5514('0x0')]},'recipientsId':{'type':Sequelize[_0x5514('0x1')]},'recipientsDescription':{'type':Sequelize[_0x5514('0x0')]},'beep':{'type':Sequelize[_0x5514('0x2')]}}; \ No newline at end of file +var _0xe2de=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x508891,_0x219223){var _0x2725ab=function(_0x1f2822){while(--_0x1f2822){_0x508891['push'](_0x508891['shift']());}};_0x2725ab(++_0x219223);}(_0xe2de,0x1f0));var _0xee2d=function(_0x22f945,_0x403922){_0x22f945=_0x22f945-0x0;var _0x43e7d4=_0xe2de[_0x22f945];return _0x43e7d4;};'use strict';var Sequelize=require(_0xee2d('0x0'));module[_0xee2d('0x1')]={'body':{'type':Sequelize[_0xee2d('0x2')]},'senderName':{'type':Sequelize[_0xee2d('0x3')]},'recipientsId':{'type':Sequelize[_0xee2d('0x2')]},'recipientsDescription':{'type':Sequelize[_0xee2d('0x3')]},'beep':{'type':Sequelize[_0xee2d('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index e6aaee8..9dbe091 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76ef=['path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','parse','ValidationError','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','includes','model','toLowerCase','senderName','user','fullname','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','render','view','User','union','ids','queue','replace','Queue','push','flatten','rimraf','zip-dir','moment','bluebird','mustache','util'];(function(_0x3f5a57,_0x256158){var _0x39a7cd=function(_0x5eb202){while(--_0x5eb202){_0x3f5a57['push'](_0x3f5a57['shift']());}};_0x39a7cd(++_0x256158);}(_0x76ef,0x120));var _0xf76e=function(_0x4265cd,_0xf65194){_0x4265cd=_0x4265cd-0x0;var _0x3c03ca=_0x76ef[_0x4265cd];return _0x3c03ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf76e('0x0'));var zipdir=require(_0xf76e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf76e('0x2'));var BPromise=require(_0xf76e('0x3'));var Mustache=require(_0xf76e('0x4'));var util=require(_0xf76e('0x5'));var path=require(_0xf76e('0x6'));var sox=require('sox');var csv=require(_0xf76e('0x7'));var ejs=require(_0xf76e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf76e('0x9'));var squel=require(_0xf76e('0xa'));var crypto=require(_0xf76e('0xb'));var jsforce=require(_0xf76e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf76e('0x7'));var querystring=require(_0xf76e('0xd'));var Papa=require(_0xf76e('0xe'));var Redis=require(_0xf76e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf76e('0x10'));var as=require(_0xf76e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf76e('0x12'))(_0xf76e('0x13'));var utils=require(_0xf76e('0x14'));var config=require(_0xf76e('0x15'));var licenseUtil=require(_0xf76e('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf76e('0x17')](config[_0xf76e('0x18')],{'host':_0xf76e('0x19'),'port':0x18eb});var socket=require(_0xf76e('0x1a'))(new Redis(config[_0xf76e('0x18')]));require(_0xf76e('0x1b'))[_0xf76e('0x1c')](socket);function respondWithStatusCode(_0x3285e7,_0x40a79e){_0x40a79e=_0x40a79e||0xcc;return function(_0x1f7008){if(_0x1f7008){return _0x3285e7[_0xf76e('0x1d')](_0x40a79e);}return _0x3285e7[_0xf76e('0x1e')](_0x40a79e)[_0xf76e('0x1f')]();};}function respondWithResult(_0x14ff60,_0x8218e0){_0x8218e0=_0x8218e0||0xc8;return function(_0x5774cb){if(_0x5774cb){return _0x14ff60['status'](_0x8218e0)[_0xf76e('0x20')](_0x5774cb);}};}function respondWithFilteredResult(_0x37285d,_0x53f21f){return function(_0x4bb819){if(_0x4bb819){var _0x5e9c43=typeof _0x53f21f['offset']===_0xf76e('0x21')&&typeof _0x53f21f[_0xf76e('0x22')]===_0xf76e('0x21');var _0x1c543c=_0x4bb819[_0xf76e('0x23')];var _0x205707=_0x5e9c43?0x0:_0x53f21f[_0xf76e('0x24')];var _0x59f605=_0x5e9c43?_0x4bb819['count']:_0x53f21f[_0xf76e('0x24')]+_0x53f21f['limit'];var _0x4ec031;if(_0x59f605>=_0x1c543c){_0x59f605=_0x1c543c;_0x4ec031=0xc8;}else{_0x4ec031=0xce;}_0x37285d[_0xf76e('0x1e')](_0x4ec031);return _0x37285d[_0xf76e('0x25')](_0xf76e('0x26'),_0x205707+'-'+_0x59f605+'/'+_0x1c543c)[_0xf76e('0x20')](_0x4bb819);}return null;};}function patchUpdates(_0x3c1193){return function(_0x3d7cc9){try{jsonpatch[_0xf76e('0x27')](_0x3d7cc9,_0x3c1193,!![]);}catch(_0x257d84){return BPromise[_0xf76e('0x28')](_0x257d84);}return _0x3d7cc9[_0xf76e('0x29')]();};}function saveUpdates(_0x29cb40,_0x51ab45){return function(_0x4a9204){if(_0x4a9204){return _0x4a9204[_0xf76e('0x2a')](_0x29cb40)[_0xf76e('0x2b')](function(_0x5378f6){return _0x5378f6;});}return null;};}function removeEntity(_0x37775b,_0xa2bd3){return function(_0x4afd91){if(_0x4afd91){return _0x4afd91[_0xf76e('0x2c')]()['then'](function(){_0x37775b[_0xf76e('0x1e')](0xcc)[_0xf76e('0x1f')]();});}};}function handleEntityNotFound(_0x4be3d7,_0xd5e48c){return function(_0x46b600){if(!_0x46b600){_0x4be3d7[_0xf76e('0x1d')](0x194);}return _0x46b600;};}function handleError(_0x54e929,_0xd2b2e2){_0xd2b2e2=_0xd2b2e2||0x1f4;return function(_0x143f43){logger[_0xf76e('0x2d')](_0x143f43[_0xf76e('0x2e')]);if(_0x143f43[_0xf76e('0x2f')]){delete _0x143f43[_0xf76e('0x2f')];}_0x54e929[_0xf76e('0x1e')](_0xd2b2e2)[_0xf76e('0x30')](_0x143f43);};}exports[_0xf76e('0x31')]=function(_0x435561,_0x27cba4,_0x54bec5){if(!_0x435561[_0xf76e('0x32')]['hasOwnProperty']('text')&&!_0x435561[_0xf76e('0x32')][_0xf76e('0x33')](_0xf76e('0x34'))){throw new db['Sequelize']['ValidationError'](_0xf76e('0x35'));}else{if(_0x435561[_0xf76e('0x32')]['hasOwnProperty'](_0xf76e('0x34'))&&!_0x435561[_0xf76e('0x32')][_0xf76e('0x33')]('view')){throw new db[(_0xf76e('0x36'))]['ValidationError'](_0xf76e('0x37'));}if(!_0x435561[_0xf76e('0x32')][_0xf76e('0x33')](_0xf76e('0x38'))){throw new db['Sequelize']['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x1b6585=JSON[_0xf76e('0x39')](_0x435561[_0xf76e('0x32')][_0xf76e('0x38')]);}catch(_0x34315f){logger[_0xf76e('0x2d')](_0x34315f);throw new db['Sequelize'][(_0xf76e('0x3a'))](_0xf76e('0x3b'));}var _0x256452=[_0xf76e('0x3c'),_0xf76e('0x3d'),'mailqueue',_0xf76e('0x3e'),'smsqueue',_0xf76e('0x3f'),_0xf76e('0x40'),'team','user'];if(_['some'](_0x1b6585,function(_0x1dcf32){return!_[_0xf76e('0x41')](_0x256452,_0x1dcf32[_0xf76e('0x42')][_0xf76e('0x43')]());})){throw new db[(_0xf76e('0x36'))][(_0xf76e('0x3a'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4bfeb9={};_0x4bfeb9[_0xf76e('0x44')]=_0x435561[_0xf76e('0x32')][_0xf76e('0x33')]('senderName')?_0x435561[_0xf76e('0x32')][_0xf76e('0x44')]:_0x435561[_0xf76e('0x45')][_0xf76e('0x46')];_0x4bfeb9['recipientsDescription']=_['isEmpty'](_0x435561['body'][_0xf76e('0x47')])?null:_0x435561[_0xf76e('0x32')][_0xf76e('0x47')];_0x4bfeb9[_0xf76e('0x48')]=_0x435561[_0xf76e('0x32')]['beep']||![];_0x4bfeb9['SenderId']=_0x435561['user']['id'];return getContent(_0x435561[_0xf76e('0x32')])[_0xf76e('0x2b')](function(_0x523310){_0x4bfeb9[_0xf76e('0x32')]=_0x523310;return getRecipients(_0x1b6585);})[_0xf76e('0x2b')](function(_0x312f1c){_0x4bfeb9[_0xf76e('0x49')]=_[_0xf76e('0x4a')](_0x312f1c)[_0xf76e('0x4b')](',');return db[_0xf76e('0x4c')]['transaction'](function(_0x847ff9){return db[_0xf76e('0x4d')][_0xf76e('0x4e')](_0x4bfeb9,{'raw':!![],'transaction':_0x847ff9})[_0xf76e('0x2b')](function(_0x2c60a7){var _0x247e23={'sender':_0x4bfeb9[_0xf76e('0x44')],'description':_0x4bfeb9['recipientsDescription'],'content':_0x4bfeb9[_0xf76e('0x32')],'beep':_0x4bfeb9[_0xf76e('0x48')]};_0x312f1c[_0xf76e('0x4f')](function(_0x21c112){_0x247e23[_0xf76e('0x50')]=_0x21c112;socket[_0xf76e('0x51')](_0xf76e('0x52'),_0x247e23);});return _0x2c60a7;});});})[_0xf76e('0x2b')](respondWithResult(_0x27cba4,0xc9))[_0xf76e('0x53')](handleError(_0x27cba4,null));};function getContent(_0x5aef1f){return new BPromise(function(_0x218d7c,_0x25c1e6){if(_0x5aef1f[_0xf76e('0x54')]){_0x218d7c(_0x5aef1f[_0xf76e('0x54')]);return;}return db[_0xf76e('0x55')][_0xf76e('0x56')]({'attributes':[_0xf76e('0x57')],'where':{'id':_0x5aef1f[_0xf76e('0x34')]},'raw':!![]})[_0xf76e('0x2b')](function(_0x4bbf14){if(!_0x4bbf14)throw new db[(_0xf76e('0x36'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3529db=Mustache[_0xf76e('0x58')](_0x4bbf14[_0xf76e('0x57')],_0x5aef1f[_0xf76e('0x59')]);_0x218d7c(_0x3529db);})[_0xf76e('0x53')](function(_0x2719c1){_0x25c1e6(_0x2719c1);});});}function getRecipients(_0x56369d){return new BPromise(function(_0x17efad,_0x1de54d){var _0x3ccbcf=[];var _0xed0b6e=[];_0x56369d[_0xf76e('0x4f')](function(_0x36e938){var _0x4641db=_['startCase'](_0x36e938[_0xf76e('0x42')][_0xf76e('0x43')]());if(_0x4641db===_0xf76e('0x5a')){_0x3ccbcf=_[_0xf76e('0x5b')](_0x3ccbcf,_0x36e938[_0xf76e('0x5c')]);}else{if(_[_0xf76e('0x41')](_0x4641db,_0xf76e('0x5d')))_0x4641db=_0x4641db[_0xf76e('0x5e')](_0xf76e('0x5d'),_0xf76e('0x5f'));_0x36e938[_0xf76e('0x5c')][_0xf76e('0x4f')](function(_0x33baa7){_0xed0b6e[_0xf76e('0x60')](getAgents(_0x4641db,_0x33baa7));});}});return BPromise['all'](_0xed0b6e)[_0xf76e('0x2b')](function(_0x5aa3c0){_0x3ccbcf=_[_0xf76e('0x5b')](_0x3ccbcf,_[_0xf76e('0x61')](_0x5aa3c0));_0x17efad(_0x3ccbcf);})['catch'](function(_0x129586){_0x1de54d(_0x129586);});});}function getAgents(_0x60b9e2,_0x5ed472){return new BPromise(function(_0x35bde5,_0x58697d){return db[_0x60b9e2][_0xf76e('0x56')]({'where':{'id':_0x5ed472}})[_0xf76e('0x2b')](function(_0x4804d6){return _0x4804d6['getAgents']({'attributes':['id'],'raw':!![]})[_0xf76e('0x2b')](function(_0x4e86b1){var _0x5190cc=_['map'](_0x4e86b1,'id');_0x35bde5(_0x5190cc);});})[_0xf76e('0x53')](function(_0x3c9da5){_0x58697d(_0x3c9da5);});});} \ No newline at end of file +var _0x35fe=['mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','hasOwnProperty','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','voicequeue','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','isEmpty','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','transaction','UserNotification','create','recipient','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','view','catch','forEach','startCase','User','union','ids','queue','replace','Queue','all','flatten','getAgents','map','rimraf','zip-dir','request-promise','moment'];(function(_0x282a0d,_0x268c5e){var _0xdda2fa=function(_0x40ce13){while(--_0x40ce13){_0x282a0d['push'](_0x282a0d['shift']());}};_0xdda2fa(++_0x268c5e);}(_0x35fe,0x188));var _0xe35f=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x35fe[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe35f('0x0'));var zipdir=require(_0xe35f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe35f('0x2'));var moment=require(_0xe35f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe35f('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe35f('0x5'));var ejs=require(_0xe35f('0x6'));var fs=require('fs');var fs_extra=require(_0xe35f('0x7'));var _=require(_0xe35f('0x8'));var squel=require(_0xe35f('0x9'));var crypto=require(_0xe35f('0xa'));var jsforce=require(_0xe35f('0xb'));var deskjs=require(_0xe35f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe35f('0xd'));var Papa=require(_0xe35f('0xe'));var Redis=require(_0xe35f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe35f('0x10'));var as=require(_0xe35f('0x11'));var hardwareService=require(_0xe35f('0x12'));var logger=require(_0xe35f('0x13'))(_0xe35f('0x14'));var utils=require(_0xe35f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe35f('0x16'));var db=require(_0xe35f('0x17'))['db'];config[_0xe35f('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe35f('0x19'))(new Redis(config['redis']));require(_0xe35f('0x1a'))[_0xe35f('0x1b')](socket);function respondWithStatusCode(_0x781e39,_0x46c017){_0x46c017=_0x46c017||0xcc;return function(_0x224ab3){if(_0x224ab3){return _0x781e39[_0xe35f('0x1c')](_0x46c017);}return _0x781e39[_0xe35f('0x1d')](_0x46c017)['end']();};}function respondWithResult(_0x5f0e5f,_0x2cb8d5){_0x2cb8d5=_0x2cb8d5||0xc8;return function(_0x3e609c){if(_0x3e609c){return _0x5f0e5f[_0xe35f('0x1d')](_0x2cb8d5)[_0xe35f('0x1e')](_0x3e609c);}};}function respondWithFilteredResult(_0x320bc9,_0x79dae1){return function(_0x5c138d){if(_0x5c138d){var _0xd1f1f5=typeof _0x79dae1[_0xe35f('0x1f')]===_0xe35f('0x20')&&typeof _0x79dae1[_0xe35f('0x21')]===_0xe35f('0x20');var _0xac606c=_0x5c138d[_0xe35f('0x22')];var _0x2c8b73=_0xd1f1f5?0x0:_0x79dae1[_0xe35f('0x1f')];var _0x2600f1=_0xd1f1f5?_0x5c138d['count']:_0x79dae1[_0xe35f('0x1f')]+_0x79dae1[_0xe35f('0x21')];var _0x469d20;if(_0x2600f1>=_0xac606c){_0x2600f1=_0xac606c;_0x469d20=0xc8;}else{_0x469d20=0xce;}_0x320bc9[_0xe35f('0x1d')](_0x469d20);return _0x320bc9[_0xe35f('0x23')](_0xe35f('0x24'),_0x2c8b73+'-'+_0x2600f1+'/'+_0xac606c)[_0xe35f('0x1e')](_0x5c138d);}return null;};}function patchUpdates(_0x3e57d4){return function(_0x3a1c5a){try{jsonpatch[_0xe35f('0x25')](_0x3a1c5a,_0x3e57d4,!![]);}catch(_0x558c50){return BPromise[_0xe35f('0x26')](_0x558c50);}return _0x3a1c5a[_0xe35f('0x27')]();};}function saveUpdates(_0x10de4e,_0x32a558){return function(_0x31f499){if(_0x31f499){return _0x31f499[_0xe35f('0x28')](_0x10de4e)[_0xe35f('0x29')](function(_0x422691){return _0x422691;});}return null;};}function removeEntity(_0x2a39af,_0x18540a){return function(_0x575a91){if(_0x575a91){return _0x575a91[_0xe35f('0x2a')]()[_0xe35f('0x29')](function(){_0x2a39af[_0xe35f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15f7ee,_0x55cf97){return function(_0x15a9d1){if(!_0x15a9d1){_0x15f7ee['sendStatus'](0x194);}return _0x15a9d1;};}function handleError(_0x361031,_0x3e47ce){_0x3e47ce=_0x3e47ce||0x1f4;return function(_0x4e1b1d){logger[_0xe35f('0x2b')](_0x4e1b1d[_0xe35f('0x2c')]);if(_0x4e1b1d[_0xe35f('0x2d')]){delete _0x4e1b1d[_0xe35f('0x2d')];}_0x361031[_0xe35f('0x1d')](_0x3e47ce)[_0xe35f('0x2e')](_0x4e1b1d);};}exports[_0xe35f('0x2f')]=function(_0x4a3dc5,_0x115326,_0x59eda2){if(!_0x4a3dc5['body'][_0xe35f('0x30')]('text')&&!_0x4a3dc5[_0xe35f('0x31')][_0xe35f('0x30')](_0xe35f('0x32'))){throw new db['Sequelize'][(_0xe35f('0x33'))](_0xe35f('0x34'));}else{if(_0x4a3dc5[_0xe35f('0x31')]['hasOwnProperty'](_0xe35f('0x32'))&&!_0x4a3dc5[_0xe35f('0x31')]['hasOwnProperty']('view')){throw new db['Sequelize']['ValidationError'](_0xe35f('0x35'));}if(!_0x4a3dc5['body'][_0xe35f('0x30')](_0xe35f('0x36'))){throw new db[(_0xe35f('0x37'))][(_0xe35f('0x33'))](_0xe35f('0x38'));}else{try{var _0x3ddbea=JSON['parse'](_0x4a3dc5[_0xe35f('0x31')]['recipients']);}catch(_0x15adbf){logger['error'](_0x15adbf);throw new db[(_0xe35f('0x37'))][(_0xe35f('0x33'))](_0xe35f('0x39'));}var _0x1dcdcb=[_0xe35f('0x3a'),_0xe35f('0x3b'),'mailqueue','openchannelqueue','smsqueue',_0xe35f('0x3c'),'whatsappqueue','team','user'];if(_[_0xe35f('0x3d')](_0x3ddbea,function(_0x61a408){return!_[_0xe35f('0x3e')](_0x1dcdcb,_0x61a408[_0xe35f('0x3f')][_0xe35f('0x40')]());})){throw new db[(_0xe35f('0x37'))][(_0xe35f('0x33'))](_0xe35f('0x41'));}}}var _0x5d2b9b={};_0x5d2b9b[_0xe35f('0x42')]=_0x4a3dc5[_0xe35f('0x31')][_0xe35f('0x30')](_0xe35f('0x42'))?_0x4a3dc5[_0xe35f('0x31')][_0xe35f('0x42')]:_0x4a3dc5[_0xe35f('0x43')]['fullname'];_0x5d2b9b['recipientsDescription']=_[_0xe35f('0x44')](_0x4a3dc5[_0xe35f('0x31')][_0xe35f('0x45')])?null:_0x4a3dc5[_0xe35f('0x31')][_0xe35f('0x45')];_0x5d2b9b[_0xe35f('0x46')]=_0x4a3dc5[_0xe35f('0x31')][_0xe35f('0x46')]||![];_0x5d2b9b[_0xe35f('0x47')]=_0x4a3dc5[_0xe35f('0x43')]['id'];return getContent(_0x4a3dc5[_0xe35f('0x31')])['then'](function(_0x4150f6){_0x5d2b9b[_0xe35f('0x31')]=_0x4150f6;return getRecipients(_0x3ddbea);})[_0xe35f('0x29')](function(_0x2b5e8c){_0x5d2b9b[_0xe35f('0x48')]=_['sortBy'](_0x2b5e8c)[_0xe35f('0x49')](',');return db[_0xe35f('0x4a')][_0xe35f('0x4b')](function(_0x336771){return db[_0xe35f('0x4c')][_0xe35f('0x4d')](_0x5d2b9b,{'raw':!![],'transaction':_0x336771})[_0xe35f('0x29')](function(_0x20f5d2){var _0x174832={'sender':_0x5d2b9b['senderName'],'description':_0x5d2b9b[_0xe35f('0x45')],'content':_0x5d2b9b[_0xe35f('0x31')],'beep':_0x5d2b9b[_0xe35f('0x46')]};_0x2b5e8c['forEach'](function(_0x3d000c){_0x174832[_0xe35f('0x4e')]=_0x3d000c;socket['emit']('userNotification:send',_0x174832);});return _0x20f5d2;});});})[_0xe35f('0x29')](respondWithResult(_0x115326,0xc9))['catch'](handleError(_0x115326,null));};function getContent(_0x56bce0){return new BPromise(function(_0x16285d,_0x3f6248){if(_0x56bce0[_0xe35f('0x4f')]){_0x16285d(_0x56bce0[_0xe35f('0x4f')]);return;}return db[_0xe35f('0x50')][_0xe35f('0x51')]({'attributes':['html'],'where':{'id':_0x56bce0['TemplateId']},'raw':!![]})[_0xe35f('0x29')](function(_0x1c6b95){if(!_0x1c6b95)throw new db['Sequelize'][(_0xe35f('0x33'))](_0xe35f('0x52'));var _0x278754=Mustache[_0xe35f('0x53')](_0x1c6b95[_0xe35f('0x54')],_0x56bce0[_0xe35f('0x55')]);_0x16285d(_0x278754);})[_0xe35f('0x56')](function(_0x20597d){_0x3f6248(_0x20597d);});});}function getRecipients(_0x282261){return new BPromise(function(_0x1e20f7,_0x40f3d3){var _0x3171a8=[];var _0x5ead2b=[];_0x282261[_0xe35f('0x57')](function(_0x2cb78a){var _0x1923f8=_[_0xe35f('0x58')](_0x2cb78a['model'][_0xe35f('0x40')]());if(_0x1923f8===_0xe35f('0x59')){_0x3171a8=_[_0xe35f('0x5a')](_0x3171a8,_0x2cb78a[_0xe35f('0x5b')]);}else{if(_['includes'](_0x1923f8,_0xe35f('0x5c')))_0x1923f8=_0x1923f8[_0xe35f('0x5d')](_0xe35f('0x5c'),_0xe35f('0x5e'));_0x2cb78a[_0xe35f('0x5b')][_0xe35f('0x57')](function(_0x129c44){_0x5ead2b['push'](getAgents(_0x1923f8,_0x129c44));});}});return BPromise[_0xe35f('0x5f')](_0x5ead2b)[_0xe35f('0x29')](function(_0x126f8e){_0x3171a8=_[_0xe35f('0x5a')](_0x3171a8,_[_0xe35f('0x60')](_0x126f8e));_0x1e20f7(_0x3171a8);})[_0xe35f('0x56')](function(_0x5293b0){_0x40f3d3(_0x5293b0);});});}function getAgents(_0x9d285c,_0x5c3aa4){return new BPromise(function(_0x317350,_0x345d3a){return db[_0x9d285c][_0xe35f('0x51')]({'where':{'id':_0x5c3aa4}})[_0xe35f('0x29')](function(_0x2be4ec){return _0x2be4ec[_0xe35f('0x61')]({'attributes':['id'],'raw':!![]})[_0xe35f('0x29')](function(_0xd21eaa){var _0x34572a=_[_0xe35f('0x62')](_0xd21eaa,'id');_0x317350(_0x34572a);});})[_0xe35f('0x56')](function(_0x521f2f){_0x345d3a(_0x521f2f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 4b47326..5c7ff24 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ccb=['exports','../../mysqldb','UserNotification','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x544d8c,_0x29fc75){var _0xf372a3=function(_0x25015e){while(--_0x25015e){_0x544d8c['push'](_0x544d8c['shift']());}};_0xf372a3(++_0x29fc75);}(_0x8ccb,0x196));var _0xb8cc=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0x8ccb[_0x685346];return _0x52e15b;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xb8cc('0x0'))['db'][_0xb8cc('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8cc('0x2'),'afterUpdate':_0xb8cc('0x3'),'afterDestroy':_0xb8cc('0x4')};function emitEvent(_0x26e9f1){return function(_0x162f73,_0x35d236,_0x2cc68b){UserNotificationEvents[_0xb8cc('0x5')](_0x26e9f1+':'+_0x162f73['id'],_0x162f73);UserNotificationEvents['emit'](_0x26e9f1,_0x162f73);_0x2cc68b(null);};}for(var e in events){if(events[_0xb8cc('0x6')](e)){var event=events[e];UserNotification[_0xb8cc('0x7')](e,emitEvent(event));}}module[_0xb8cc('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xcdca=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification'];(function(_0x2237cd,_0x15bb32){var _0x41c9d7=function(_0x22fdc4){while(--_0x22fdc4){_0x2237cd['push'](_0x2237cd['shift']());}};_0x41c9d7(++_0x15bb32);}(_0xcdca,0x73));var _0xacdc=function(_0x131eff,_0x25b26a){_0x131eff=_0x131eff-0x0;var _0xf89db9=_0xcdca[_0x131eff];return _0xf89db9;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xacdc('0x0'))['db'][_0xacdc('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xacdc('0x2')](0x0);var events={'afterCreate':_0xacdc('0x3'),'afterUpdate':_0xacdc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x236d08){return function(_0x20ea19,_0x370a6d,_0x22039b){UserNotificationEvents[_0xacdc('0x5')](_0x236d08+':'+_0x20ea19['id'],_0x20ea19);UserNotificationEvents['emit'](_0x236d08,_0x20ea19);_0x22039b(null);};}for(var e in events){if(events[_0xacdc('0x6')](e)){var event=events[e];UserNotification[_0xacdc('0x7')](e,emitEvent(event));}}module[_0xacdc('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 5e88586..60a9e29 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0198=['rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','lodash','api','moment','bluebird','request-promise','path'];(function(_0x14f769,_0x7523a1){var _0x4d675f=function(_0x3bed34){while(--_0x3bed34){_0x14f769['push'](_0x14f769['shift']());}};_0x4d675f(++_0x7523a1);}(_0x0198,0x14c));var _0x8019=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x0198[_0x45313f];return _0x402910;};'use strict';var _=require(_0x8019('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8019('0x1'));var moment=require(_0x8019('0x2'));var BPromise=require(_0x8019('0x3'));var rp=require(_0x8019('0x4'));var fs=require('fs');var path=require(_0x8019('0x5'));var rimraf=require(_0x8019('0x6'));var config=require(_0x8019('0x7'));var attributes=require(_0x8019('0x8'));module[_0x8019('0x9')]=function(_0x408817,_0x1de70d){return _0x408817[_0x8019('0xa')](_0x8019('0xb'),attributes,{'tableName':_0x8019('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4d2a=['api','request-promise','path','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x344799,_0x422266){var _0x298d4a=function(_0x10d10f){while(--_0x10d10f){_0x344799['push'](_0x344799['shift']());}};_0x298d4a(++_0x422266);}(_0x4d2a,0x6d));var _0xa4d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d2a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa4d2('0x0'));var util=require(_0xa4d2('0x1'));var logger=require(_0xa4d2('0x2'))(_0xa4d2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa4d2('0x4'));var fs=require('fs');var path=require(_0xa4d2('0x5'));var rimraf=require('rimraf');var config=require(_0xa4d2('0x6'));var attributes=require(_0xa4d2('0x7'));module[_0xa4d2('0x8')]=function(_0x3e06b0,_0x274269){return _0x3e06b0[_0xa4d2('0x9')](_0xa4d2('0xa'),attributes,{'tableName':_0xa4d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa4d2('0xc'),'collate':_0xa4d2('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 32216c0..681b4e7 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4bb=['redis','localhost','socket.io-emitter','./userNotification.socket','register','UserNotification,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xd4bb,0x1a4));var _0xbd4b=function(_0x540d5b,_0x3bfabf){_0x540d5b=_0x540d5b-0x0;var _0x32603c=_0xd4bb[_0x540d5b];return _0x32603c;};'use strict';var _=require(_0xbd4b('0x0'));var util=require(_0xbd4b('0x1'));var moment=require(_0xbd4b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd4b('0x3'));var fs=require('fs');var Redis=require(_0xbd4b('0x4'));var db=require(_0xbd4b('0x5'))['db'];var utils=require(_0xbd4b('0x6'));var logger=require(_0xbd4b('0x7'))(_0xbd4b('0x8'));var config=require(_0xbd4b('0x9'));var jayson=require(_0xbd4b('0xa'));var client=jayson[_0xbd4b('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xbd4b('0xc')],{'host':_0xbd4b('0xd'),'port':0x18eb});var socket=require(_0xbd4b('0xe'))(new Redis(config['redis']));require(_0xbd4b('0xf'))[_0xbd4b('0x10')](socket);function respondWithRpcPromise(_0x412e32,_0x845910,_0x45e549){return new BPromise(function(_0x53ddb9,_0x5d191f){return client['request'](_0x412e32,_0x45e549)['then'](function(_0x9229c5){logger['info'](_0xbd4b('0x11'),_0x845910,_0xbd4b('0x12'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x845910,'request\x20sent',JSON['stringify'](_0x9229c5));if(_0x9229c5['error']){if(_0x9229c5[_0xbd4b('0x13')][_0xbd4b('0x14')]===0x1f4){logger[_0xbd4b('0x13')](_0xbd4b('0x11'),_0x845910,_0x9229c5[_0xbd4b('0x13')][_0xbd4b('0x15')]);return _0x5d191f(_0x9229c5['error'][_0xbd4b('0x15')]);}logger[_0xbd4b('0x13')](_0xbd4b('0x11'),_0x845910,_0x9229c5['error']['message']);return _0x53ddb9(_0x9229c5['error'][_0xbd4b('0x15')]);}else{logger['info'](_0xbd4b('0x11'),_0x845910,_0xbd4b('0x12'));_0x53ddb9(_0x9229c5[_0xbd4b('0x16')]['message']);}})[_0xbd4b('0x17')](function(_0x5c6b11){logger[_0xbd4b('0x13')](_0xbd4b('0x11'),_0x845910,_0x5c6b11);_0x5d191f(_0x5c6b11);});});} \ No newline at end of file +var _0x5483=['http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5483,0x1c7));var _0x3548=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x5483[_0x3a7a9c];return _0x59156e;};'use strict';var _=require(_0x3548('0x0'));var util=require('util');var moment=require(_0x3548('0x1'));var BPromise=require('bluebird');var rs=require(_0x3548('0x2'));var fs=require('fs');var Redis=require(_0x3548('0x3'));var db=require(_0x3548('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3548('0x5'))(_0x3548('0x6'));var config=require(_0x3548('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3548('0x8')][_0x3548('0x9')]({'port':0x232a});config[_0x3548('0xa')]=_[_0x3548('0xb')](config['redis'],{'host':_0x3548('0xc'),'port':0x18eb});var socket=require(_0x3548('0xd'))(new Redis(config['redis']));require(_0x3548('0xe'))[_0x3548('0xf')](socket);function respondWithRpcPromise(_0x49ee95,_0x177258,_0x486f4e){return new BPromise(function(_0x1f9080,_0x102824){return client[_0x3548('0x10')](_0x49ee95,_0x486f4e)[_0x3548('0x11')](function(_0xb93c1b){logger[_0x3548('0x12')](_0x3548('0x13'),_0x177258,'request\x20sent');logger[_0x3548('0x14')](_0x3548('0x15'),_0x177258,_0x3548('0x16'),JSON[_0x3548('0x17')](_0xb93c1b));if(_0xb93c1b[_0x3548('0x18')]){if(_0xb93c1b[_0x3548('0x18')][_0x3548('0x19')]===0x1f4){logger['error'](_0x3548('0x13'),_0x177258,_0xb93c1b[_0x3548('0x18')][_0x3548('0x1a')]);return _0x102824(_0xb93c1b[_0x3548('0x18')][_0x3548('0x1a')]);}logger[_0x3548('0x18')](_0x3548('0x13'),_0x177258,_0xb93c1b[_0x3548('0x18')][_0x3548('0x1a')]);return _0x1f9080(_0xb93c1b[_0x3548('0x18')][_0x3548('0x1a')]);}else{logger[_0x3548('0x12')](_0x3548('0x13'),_0x177258,'request\x20sent');_0x1f9080(_0xb93c1b[_0x3548('0x1b')]['message']);}})[_0x3548('0x1c')](function(_0x2843e0){logger[_0x3548('0x18')]('UserNotification,\x20%s,\x20%s',_0x177258,_0x2843e0);_0x102824(_0x2843e0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index de51962..709dfa7 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9061=['register','length','userNotification:','save','remove','update','emit','removeListener'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x9061,0x103));var _0x1906=function(_0x471782,_0x15bc89){_0x471782=_0x471782-0x0;var _0x85894b=_0x9061[_0x471782];return _0x85894b;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x1906('0x0'),_0x1906('0x1'),_0x1906('0x2')];function createListener(_0x11bbe8,_0x41142a){return function(_0x277611){_0x41142a[_0x1906('0x3')](_0x11bbe8,_0x277611);};}function removeListener(_0x209023,_0x3591f9){return function(){UserNotificationEvents[_0x1906('0x4')](_0x209023,_0x3591f9);};}exports[_0x1906('0x5')]=function(_0x7b9cd3){for(var _0x4d0231=0x0,_0x5cec2f=events[_0x1906('0x6')];_0x4d0231<_0x5cec2f;_0x4d0231++){var _0x4dff42=events[_0x4d0231];var _0x50f09d=createListener(_0x1906('0x7')+_0x4dff42,_0x7b9cd3);UserNotificationEvents['on'](_0x4dff42,_0x50f09d);}}; \ No newline at end of file +var _0x8083=['userNotification:','save','update','register','length'];(function(_0x37026f,_0x2df88f){var _0x40cb74=function(_0x5276ac){while(--_0x5276ac){_0x37026f['push'](_0x37026f['shift']());}};_0x40cb74(++_0x2df88f);}(_0x8083,0x74));var _0x3808=function(_0x5ec453,_0x30b0ba){_0x5ec453=_0x5ec453-0x0;var _0x25548f=_0x8083[_0x5ec453];return _0x25548f;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x3808('0x0'),'remove',_0x3808('0x1')];function createListener(_0x94a0f7,_0x3165e5){return function(_0x179ad3){_0x3165e5['emit'](_0x94a0f7,_0x179ad3);};}function removeListener(_0x64c66d,_0x1d4174){return function(){UserNotificationEvents['removeListener'](_0x64c66d,_0x1d4174);};}exports[_0x3808('0x2')]=function(_0x2e0734){for(var _0xe4f2d0=0x0,_0x43b3ac=events[_0x3808('0x3')];_0xe4f2d0<_0x43b3ac;_0xe4f2d0++){var _0x1e864e=events[_0xe4f2d0];var _0x114ce0=createListener(_0x3808('0x4')+_0x1e864e,_0x2e0734);UserNotificationEvents['on'](_0x1e864e,_0x114ce0);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f45ad5f..64a633b 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cd721,_0x349fb4){var _0x5a1721=function(_0x4e3b6b){while(--_0x4e3b6b){_0x1cd721['push'](_0x1cd721['shift']());}};_0x5a1721(++_0x349fb4);}(_0xe706,0xa3));var _0x6e70=function(_0x4de1c3,_0xbe77b9){_0x4de1c3=_0x4de1c3-0x0;var _0x26acfe=_0xe706[_0x4de1c3];return _0x26acfe;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x18ef8e,_0x1ade92){var _0x25408c=function(_0x326525){while(--_0x326525){_0x18ef8e['push'](_0x18ef8e['shift']());}};_0x25408c(++_0x1ade92);}(_0xedd9,0xfc));var _0x9edd=function(_0x577f3d,_0x43ab79){_0x577f3d=_0x577f3d-0x0;var _0x3b11f6=_0xedd9[_0x577f3d];return _0x3b11f6;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 55fd9f9..de56f9b 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdad9=['INTEGER','exports'];(function(_0xcd4d2c,_0x1a5200){var _0x3480e4=function(_0xbb9af6){while(--_0xbb9af6){_0xcd4d2c['push'](_0xcd4d2c['shift']());}};_0x3480e4(++_0x1a5200);}(_0xdad9,0xad));var _0x9dad=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdad9[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x9dad('0x0')]={'penalty':{'type':Sequelize[_0x9dad('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6cf2=['exports','INTEGER'];(function(_0x3caa36,_0x2a75a4){var _0x57577e=function(_0x233283){while(--_0x233283){_0x3caa36['push'](_0x3caa36['shift']());}};_0x57577e(++_0x2a75a4);}(_0x6cf2,0x7c));var _0x26cf=function(_0x4e3438,_0x1037f5){_0x4e3438=_0x4e3438-0x0;var _0x2bf83c=_0x6cf2[_0x4e3438];return _0x2bf83c;};'use strict';var Sequelize=require('sequelize');module[_0x26cf('0x0')]={'penalty':{'type':Sequelize[_0x26cf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index fdfcbde..e40f6d8 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb65c=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb65c,0x163));var _0xcb65=function(_0x3046da,_0x599123){_0x3046da=_0x3046da-0x0;var _0x467db2=_0xb65c[_0x3046da];return _0x467db2;};'use strict';var _=require(_0xcb65('0x0'));var util=require(_0xcb65('0x1'));var logger=require(_0xcb65('0x2'))(_0xcb65('0x3'));var moment=require(_0xcb65('0x4'));var BPromise=require(_0xcb65('0x5'));var rp=require(_0xcb65('0x6'));var fs=require('fs');var path=require(_0xcb65('0x7'));var rimraf=require(_0xcb65('0x8'));var config=require(_0xcb65('0x9'));var attributes=require(_0xcb65('0xa'));module[_0xcb65('0xb')]=function(_0x1b797d,_0x5eeceb){return _0x1b797d[_0xcb65('0xc')](_0xcb65('0xd'),attributes,{'tableName':_0xcb65('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0073=['moment','bluebird','path','rimraf','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','api'];(function(_0x1b10a6,_0x1efe89){var _0x164860=function(_0x5d332d){while(--_0x5d332d){_0x1b10a6['push'](_0x1b10a6['shift']());}};_0x164860(++_0x1efe89);}(_0x0073,0x16f));var _0x3007=function(_0x4e389b,_0x42320c){_0x4e389b=_0x4e389b-0x0;var _0x43dfcb=_0x0073[_0x4e389b];return _0x43dfcb;};'use strict';var _=require('lodash');var util=require(_0x3007('0x0'));var logger=require('../../config/logger')(_0x3007('0x1'));var moment=require(_0x3007('0x2'));var BPromise=require(_0x3007('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3007('0x4'));var rimraf=require(_0x3007('0x5'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0x3007('0x6')]=function(_0x58653e,_0x49a9fc){return _0x58653e['define'](_0x3007('0x7'),attributes,{'tableName':_0x3007('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 4bd204d..3edd2fd 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa65d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird'];(function(_0xc216fa,_0x1c4a45){var _0x31213e=function(_0x29d648){while(--_0x29d648){_0xc216fa['push'](_0xc216fa['shift']());}};_0x31213e(++_0x1c4a45);}(_0xa65d,0x142));var _0xda65=function(_0x439f12,_0x5ab687){_0x439f12=_0x439f12-0x0;var _0x393579=_0xa65d[_0x439f12];return _0x393579;};'use strict';var _=require('lodash');var util=require(_0xda65('0x0'));var moment=require(_0xda65('0x1'));var BPromise=require(_0xda65('0x2'));var rs=require(_0xda65('0x3'));var fs=require('fs');var Redis=require(_0xda65('0x4'));var db=require(_0xda65('0x5'))['db'];var utils=require(_0xda65('0x6'));var logger=require(_0xda65('0x7'))('rpc');var config=require(_0xda65('0x8'));var jayson=require(_0xda65('0x9'));var client=jayson[_0xda65('0xa')][_0xda65('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x574a8a,_0x474a3b,_0x2bdfb4){return new BPromise(function(_0x5b6d98,_0x15fb50){return client[_0xda65('0xc')](_0x574a8a,_0x2bdfb4)[_0xda65('0xd')](function(_0x5f19eb){logger[_0xda65('0xe')](_0xda65('0xf'),_0x474a3b,'request\x20sent');logger[_0xda65('0x10')](_0xda65('0x11'),_0x474a3b,'request\x20sent',JSON[_0xda65('0x12')](_0x5f19eb));if(_0x5f19eb[_0xda65('0x13')]){if(_0x5f19eb['error'][_0xda65('0x14')]===0x1f4){logger[_0xda65('0x13')](_0xda65('0xf'),_0x474a3b,_0x5f19eb['error']['message']);return _0x15fb50(_0x5f19eb['error']['message']);}logger[_0xda65('0x13')](_0xda65('0xf'),_0x474a3b,_0x5f19eb[_0xda65('0x13')][_0xda65('0x15')]);return _0x5b6d98(_0x5f19eb[_0xda65('0x13')][_0xda65('0x15')]);}else{logger[_0xda65('0xe')](_0xda65('0xf'),_0x474a3b,_0xda65('0x16'));_0x5b6d98(_0x5f19eb[_0xda65('0x17')][_0xda65('0x15')]);}})[_0xda65('0x18')](function(_0x567644){logger['error'](_0xda65('0xf'),_0x474a3b,_0x567644);_0x15fb50(_0x567644);});});} \ No newline at end of file +var _0xd44b=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d970f,_0x1f16a9){var _0xd95c23=function(_0xf46c7f){while(--_0xf46c7f){_0x4d970f['push'](_0x4d970f['shift']());}};_0xd95c23(++_0x1f16a9);}(_0xd44b,0x1a3));var _0xbd44=function(_0x5584c6,_0x219a21){_0x5584c6=_0x5584c6-0x0;var _0x4e998f=_0xd44b[_0x5584c6];return _0x4e998f;};'use strict';var _=require(_0xbd44('0x0'));var util=require('util');var moment=require(_0xbd44('0x1'));var BPromise=require(_0xbd44('0x2'));var rs=require(_0xbd44('0x3'));var fs=require('fs');var Redis=require(_0xbd44('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd44('0x5'));var logger=require('../../config/logger')(_0xbd44('0x6'));var config=require(_0xbd44('0x7'));var jayson=require(_0xbd44('0x8'));var client=jayson[_0xbd44('0x9')][_0xbd44('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c982d,_0x512909,_0x4de614){return new BPromise(function(_0x418c0f,_0x23d7e1){return client['request'](_0x3c982d,_0x4de614)[_0xbd44('0xb')](function(_0x2b89fc){logger[_0xbd44('0xc')](_0xbd44('0xd'),_0x512909,_0xbd44('0xe'));logger[_0xbd44('0xf')](_0xbd44('0x10'),_0x512909,_0xbd44('0xe'),JSON[_0xbd44('0x11')](_0x2b89fc));if(_0x2b89fc[_0xbd44('0x12')]){if(_0x2b89fc[_0xbd44('0x12')][_0xbd44('0x13')]===0x1f4){logger[_0xbd44('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x512909,_0x2b89fc[_0xbd44('0x12')][_0xbd44('0x14')]);return _0x23d7e1(_0x2b89fc['error'][_0xbd44('0x14')]);}logger[_0xbd44('0x12')](_0xbd44('0xd'),_0x512909,_0x2b89fc[_0xbd44('0x12')][_0xbd44('0x14')]);return _0x418c0f(_0x2b89fc['error'][_0xbd44('0x14')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x512909,'request\x20sent');_0x418c0f(_0x2b89fc[_0xbd44('0x15')][_0xbd44('0x14')]);}})[_0xbd44('0x16')](function(_0x2e45aa){logger[_0xbd44('0x12')](_0xbd44('0xd'),_0x512909,_0x2e45aa);_0x23d7e1(_0x2e45aa);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 918811a..8305e27 100644 --- a/server/api/userProfile/index.js +++ b/server/api/userProfile/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb30b=['addSections','addResources','update','delete','destroy','removeSections','removeResources','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','getSections','/:id/resources','post','create','/:id/clone','clone','/:id/sections'];(function(_0x95dd85,_0x4c85d2){var _0x2752fb=function(_0x52e490){while(--_0x52e490){_0x95dd85['push'](_0x95dd85['shift']());}};_0x2752fb(++_0x4c85d2);}(_0xb30b,0x181));var _0xbb30=function(_0x53b304,_0x1efbab){_0x53b304=_0x53b304-0x0;var _0x471654=_0xb30b[_0x53b304];return _0x471654;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbb30('0x0'));var express=require(_0xbb30('0x1'));var router=express[_0xbb30('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbb30('0x3'));var interaction=require(_0xbb30('0x4'));var config=require(_0xbb30('0x5'));var controller=require(_0xbb30('0x6'));router[_0xbb30('0x7')]('/',auth[_0xbb30('0x8')](),controller[_0xbb30('0x9')]);router[_0xbb30('0x7')]('/describe',auth[_0xbb30('0x8')](),controller[_0xbb30('0xa')]);router[_0xbb30('0x7')](_0xbb30('0xb'),auth[_0xbb30('0x8')](),controller[_0xbb30('0xc')]);router[_0xbb30('0x7')]('/:id/sections',auth[_0xbb30('0x8')](),controller[_0xbb30('0xd')]);router[_0xbb30('0x7')](_0xbb30('0xe'),auth[_0xbb30('0x8')](),controller['getResources']);router[_0xbb30('0xf')]('/',auth[_0xbb30('0x8')](),controller[_0xbb30('0x10')]);router['post'](_0xbb30('0x11'),auth['isAuthenticated'](),controller[_0xbb30('0x12')]);router['post'](_0xbb30('0x13'),auth[_0xbb30('0x8')](),controller[_0xbb30('0x14')]);router[_0xbb30('0xf')]('/:id/resources',auth['isAuthenticated'](),controller[_0xbb30('0x15')]);router['put'](_0xbb30('0xb'),auth[_0xbb30('0x8')](),controller[_0xbb30('0x16')]);router[_0xbb30('0x17')](_0xbb30('0xb'),auth[_0xbb30('0x8')](),controller[_0xbb30('0x18')]);router[_0xbb30('0x17')]('/:id/sections',auth[_0xbb30('0x8')](),controller[_0xbb30('0x19')]);router['delete']('/:id/resources',auth[_0xbb30('0x8')](),controller[_0xbb30('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x4ed7=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','show','/:id/sections','/:id/resources','getResources','post','clone','addResources','put','/:id','delete','removeSections','removeResources','exports','util','path','connect-timeout'];(function(_0x11b749,_0xd04934){var _0x1bd1f7=function(_0x301b2e){while(--_0x301b2e){_0x11b749['push'](_0x11b749['shift']());}};_0x1bd1f7(++_0xd04934);}(_0x4ed7,0x69));var _0x74ed=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0x4ed7[_0x277af0];return _0x43bd7c;};'use strict';var multer=require('multer');var util=require(_0x74ed('0x0'));var path=require(_0x74ed('0x1'));var timeout=require(_0x74ed('0x2'));var express=require(_0x74ed('0x3'));var router=express[_0x74ed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x74ed('0x5'));var interaction=require(_0x74ed('0x6'));var config=require(_0x74ed('0x7'));var controller=require(_0x74ed('0x8'));router[_0x74ed('0x9')]('/',auth['isAuthenticated'](),controller[_0x74ed('0xa')]);router['get'](_0x74ed('0xb'),auth[_0x74ed('0xc')](),controller[_0x74ed('0xd')]);router[_0x74ed('0x9')]('/:id',auth[_0x74ed('0xc')](),controller[_0x74ed('0xe')]);router[_0x74ed('0x9')](_0x74ed('0xf'),auth[_0x74ed('0xc')](),controller['getSections']);router[_0x74ed('0x9')](_0x74ed('0x10'),auth['isAuthenticated'](),controller[_0x74ed('0x11')]);router[_0x74ed('0x12')]('/',auth[_0x74ed('0xc')](),controller['create']);router[_0x74ed('0x12')]('/:id/clone',auth[_0x74ed('0xc')](),controller[_0x74ed('0x13')]);router[_0x74ed('0x12')](_0x74ed('0xf'),auth['isAuthenticated'](),controller['addSections']);router[_0x74ed('0x12')](_0x74ed('0x10'),auth[_0x74ed('0xc')](),controller[_0x74ed('0x14')]);router[_0x74ed('0x15')](_0x74ed('0x16'),auth[_0x74ed('0xc')](),controller['update']);router[_0x74ed('0x17')]('/:id',auth[_0x74ed('0xc')](),controller['destroy']);router['delete'](_0x74ed('0xf'),auth[_0x74ed('0xc')](),controller[_0x74ed('0x18')]);router[_0x74ed('0x17')]('/:id/resources',auth[_0x74ed('0xc')](),controller[_0x74ed('0x19')]);module[_0x74ed('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index f23d025..0f35370 100644 --- a/server/api/userProfile/userProfile.attributes.js +++ b/server/api/userProfile/userProfile.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7630=['BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x7630,0xfd));var _0x0763=function(_0x22790f,_0x381a53){_0x22790f=_0x22790f-0x0;var _0x440429=_0x7630[_0x22790f];return _0x440429;};'use strict';var Sequelize=require(_0x0763('0x0'));module[_0x0763('0x1')]={'name':{'type':Sequelize[_0x0763('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4e4597){this[_0x0763('0x3')](_0x0763('0x4'),_0x4e4597?_0x4e4597[_0x0763('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x0763('0x4'))?this[_0x0763('0x6')](_0x0763('0x4'))[_0x0763('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0763('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0763('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0763('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0763('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0763('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0763('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x430c=['getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions','join'];(function(_0x5e40ca,_0x24b1b0){var _0x3da01e=function(_0x714c9f){while(--_0x714c9f){_0x5e40ca['push'](_0x5e40ca['shift']());}};_0x3da01e(++_0x24b1b0);}(_0x430c,0xb7));var _0xc430=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x430c[_0x16e0c8];return _0xe4b5af;};'use strict';var Sequelize=require(_0xc430('0x0'));module['exports']={'name':{'type':Sequelize[_0xc430('0x1')],'allowNull':![],'unique':_0xc430('0x2')},'crudPermissions':{'type':Sequelize[_0xc430('0x1')],'set':function(_0x44b301){this[_0xc430('0x3')](_0xc430('0x4'),_0x44b301?_0x44b301[_0xc430('0x5')](''):[]);},'get':function(){return this[_0xc430('0x6')](_0xc430('0x4'))?this[_0xc430('0x6')]('crudPermissions')[_0xc430('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc430('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc430('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc430('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xc430('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc430('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc430('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xc430('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d0f11d4..f976487 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1111=['send','index','map','UserProfile','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','create','body','get','omit','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','updatedAt','userProfileId','Resources','update','find','describe','addSections','sectionId','push','removeSections','ids','getSections','enabled','includes','subsections','concat','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x5d3639,_0xb59c8){var _0x1aaa93=function(_0x1c0d89){while(--_0x1c0d89){_0x5d3639['push'](_0x5d3639['shift']());}};_0x1aaa93(++_0xb59c8);}(_0x1111,0x195));var _0x1111=function(_0x3ac7e0,_0x46c5fd){_0x3ac7e0=_0x3ac7e0-0x0;var _0x4b5f0b=_0x1111[_0x3ac7e0];return _0x4b5f0b;};'use strict';var emlformat=require(_0x1111('0x0'));var rimraf=require(_0x1111('0x1'));var zipdir=require(_0x1111('0x2'));var jsonpatch=require(_0x1111('0x3'));var rp=require('request-promise');var moment=require(_0x1111('0x4'));var BPromise=require(_0x1111('0x5'));var Mustache=require('mustache');var util=require(_0x1111('0x6'));var path=require('path');var sox=require(_0x1111('0x7'));var csv=require(_0x1111('0x8'));var ejs=require(_0x1111('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1111('0xa'));var squel=require(_0x1111('0xb'));var crypto=require(_0x1111('0xc'));var jsforce=require(_0x1111('0xd'));var deskjs=require(_0x1111('0xe'));var toCsv=require(_0x1111('0x8'));var querystring=require('querystring');var Papa=require(_0x1111('0xf'));var Redis=require(_0x1111('0x10'));var authService=require(_0x1111('0x11'));var qs=require(_0x1111('0x12'));var as=require(_0x1111('0x13'));var hardwareService=require(_0x1111('0x14'));var logger=require(_0x1111('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1111('0x16'));var licenseUtil=require(_0x1111('0x17'));var db=require('../../mysqldb')['db'];config[_0x1111('0x18')]=_[_0x1111('0x19')](config['redis'],{'host':_0x1111('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1111('0x18')]));require(_0x1111('0x1b'))[_0x1111('0x1c')](socket);function respondWithStatusCode(_0x5d212c,_0x50c7f0){_0x50c7f0=_0x50c7f0||0xcc;return function(_0x563e34){if(_0x563e34){return _0x5d212c[_0x1111('0x1d')](_0x50c7f0);}return _0x5d212c[_0x1111('0x1e')](_0x50c7f0)[_0x1111('0x1f')]();};}function respondWithResult(_0x416809,_0x3cb618){_0x3cb618=_0x3cb618||0xc8;return function(_0x5b5d9a){if(_0x5b5d9a){return _0x416809['status'](_0x3cb618)[_0x1111('0x20')](_0x5b5d9a);}};}function respondWithFilteredResult(_0xe7b012,_0x210d23){return function(_0x6f64d0){if(_0x6f64d0){var _0x282e5f=typeof _0x210d23[_0x1111('0x21')]===_0x1111('0x22')&&typeof _0x210d23[_0x1111('0x23')]===_0x1111('0x22');var _0x442408=_0x6f64d0[_0x1111('0x24')];var _0x1218f5=_0x282e5f?0x0:_0x210d23[_0x1111('0x21')];var _0x5303ad=_0x282e5f?_0x6f64d0[_0x1111('0x24')]:_0x210d23[_0x1111('0x21')]+_0x210d23['limit'];var _0x1ae06b;if(_0x5303ad>=_0x442408){_0x5303ad=_0x442408;_0x1ae06b=0xc8;}else{_0x1ae06b=0xce;}_0xe7b012[_0x1111('0x1e')](_0x1ae06b);return _0xe7b012[_0x1111('0x25')](_0x1111('0x26'),_0x1218f5+'-'+_0x5303ad+'/'+_0x442408)[_0x1111('0x20')](_0x6f64d0);}return null;};}function patchUpdates(_0x236e85){return function(_0x1e04a3){try{jsonpatch[_0x1111('0x27')](_0x1e04a3,_0x236e85,!![]);}catch(_0xb58226){return BPromise[_0x1111('0x28')](_0xb58226);}return _0x1e04a3[_0x1111('0x29')]();};}function saveUpdates(_0x31e4b0,_0x2d1184){return function(_0x1eced6){if(_0x1eced6){return _0x1eced6['update'](_0x31e4b0)[_0x1111('0x2a')](function(_0x126310){return _0x126310;});}return null;};}function removeEntity(_0x537bf5,_0x156ea2){return function(_0x32f453){if(_0x32f453){return _0x32f453[_0x1111('0x2b')]()[_0x1111('0x2a')](function(){_0x537bf5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32d284,_0x1ef660){return function(_0x209fe6){if(!_0x209fe6){_0x32d284[_0x1111('0x1d')](0x194);}return _0x209fe6;};}function handleError(_0x323829,_0x3f0630){_0x3f0630=_0x3f0630||0x1f4;return function(_0x210b0b){logger[_0x1111('0x2c')](_0x210b0b[_0x1111('0x2d')]);if(_0x210b0b[_0x1111('0x2e')]){delete _0x210b0b[_0x1111('0x2e')];}_0x323829[_0x1111('0x1e')](_0x3f0630)[_0x1111('0x2f')](_0x210b0b);};}exports[_0x1111('0x30')]=function(_0x869c6a,_0x430182){var _0x3d075a={},_0x1f35cf={},_0x36e5c4={'count':0x0,'rows':[]};var _0x5dc2a7=_[_0x1111('0x31')](db[_0x1111('0x32')][_0x1111('0x33')],function(_0x31bf01){return{'name':_0x31bf01[_0x1111('0x34')],'type':_0x31bf01['type'][_0x1111('0x35')]};});_0x1f35cf['model']=_[_0x1111('0x31')](_0x5dc2a7,_0x1111('0x2e'));_0x1f35cf[_0x1111('0x36')]=_['keys'](_0x869c6a[_0x1111('0x36')]);_0x1f35cf[_0x1111('0x37')]=_[_0x1111('0x38')](_0x1f35cf[_0x1111('0x39')],_0x1f35cf[_0x1111('0x36')]);_0x3d075a[_0x1111('0x3a')]=_[_0x1111('0x38')](_0x1f35cf['model'],qs['fields'](_0x869c6a[_0x1111('0x36')]['fields']));_0x3d075a[_0x1111('0x3a')]=_0x3d075a[_0x1111('0x3a')][_0x1111('0x3b')]?_0x3d075a['attributes']:_0x1f35cf[_0x1111('0x39')];if(!_0x869c6a[_0x1111('0x36')][_0x1111('0x3c')](_0x1111('0x3d'))){_0x3d075a[_0x1111('0x23')]=qs[_0x1111('0x23')](_0x869c6a[_0x1111('0x36')]['limit']);_0x3d075a[_0x1111('0x21')]=qs['offset'](_0x869c6a[_0x1111('0x36')][_0x1111('0x21')]);}_0x3d075a['order']=qs[_0x1111('0x3e')](_0x869c6a[_0x1111('0x36')]['sort']);_0x3d075a['where']=qs['filters'](_[_0x1111('0x3f')](_0x869c6a[_0x1111('0x36')],_0x1f35cf[_0x1111('0x37')]),_0x5dc2a7);if(_0x869c6a['query'][_0x1111('0x40')]){_0x3d075a['where']=_[_0x1111('0x41')](_0x3d075a[_0x1111('0x42')],{'$or':_[_0x1111('0x31')](_0x5dc2a7,function(_0x4ee147){if(_0x4ee147[_0x1111('0x43')]!=='VIRTUAL'){var _0x4480ab={};_0x4480ab[_0x4ee147[_0x1111('0x2e')]]={'$like':'%'+_0x869c6a[_0x1111('0x36')]['filter']+'%'};return _0x4480ab;}})});}_0x3d075a=_[_0x1111('0x41')]({},_0x3d075a,_0x869c6a[_0x1111('0x44')]);var _0x3ef40a={'where':_0x3d075a['where']};return db[_0x1111('0x32')][_0x1111('0x24')](_0x3ef40a)[_0x1111('0x2a')](function(_0x9af7c4){_0x36e5c4['count']=_0x9af7c4;if(_0x869c6a[_0x1111('0x36')][_0x1111('0x45')]){_0x3d075a[_0x1111('0x46')]=[{'all':!![]}];}return db[_0x1111('0x32')][_0x1111('0x47')](_0x3d075a);})['then'](function(_0x338127){_0x36e5c4[_0x1111('0x48')]=_0x338127;return _0x36e5c4;})['then'](respondWithFilteredResult(_0x430182,_0x3d075a))[_0x1111('0x49')](handleError(_0x430182,null));};exports[_0x1111('0x4a')]=function(_0x526491,_0x4d5213){var _0x158b22={'raw':![],'where':{'id':_0x526491[_0x1111('0x4b')]['id']}},_0x599dda={};_0x599dda[_0x1111('0x39')]=_[_0x1111('0x4c')](db[_0x1111('0x32')][_0x1111('0x33')]);_0x599dda['query']=_[_0x1111('0x4c')](_0x526491['query']);_0x599dda['filters']=_[_0x1111('0x38')](_0x599dda[_0x1111('0x39')],_0x599dda['query']);_0x158b22[_0x1111('0x3a')]=_[_0x1111('0x38')](_0x599dda[_0x1111('0x39')],qs[_0x1111('0x4d')](_0x526491[_0x1111('0x36')][_0x1111('0x4d')]));_0x158b22['attributes']=_0x158b22['attributes'][_0x1111('0x3b')]?_0x158b22[_0x1111('0x3a')]:_0x599dda[_0x1111('0x39')];if(_0x526491[_0x1111('0x36')][_0x1111('0x45')]){_0x158b22[_0x1111('0x46')]=[{'all':!![]}];}_0x158b22=_[_0x1111('0x41')]({},_0x158b22,_0x526491['options']);return db['UserProfile']['find'](_0x158b22)[_0x1111('0x2a')](handleEntityNotFound(_0x4d5213,null))['then'](respondWithResult(_0x4d5213,null))['catch'](handleError(_0x4d5213,null));};exports['create']=function(_0x568c2f,_0x2d62cb){return db[_0x1111('0x32')][_0x1111('0x4e')](_0x568c2f[_0x1111('0x4f')],{})['then'](respondWithResult(_0x2d62cb,0xc9))['catch'](handleError(_0x2d62cb,null));};exports['clone']=function(_0x4eac7d,_0x24ce28){var _0x46d3bc={'where':{'id':_0x4eac7d['params']['id']}},_0x47f917={};_0x47f917['model']=_[_0x1111('0x4c')](db['UserProfile'][_0x1111('0x33')]);_0x46d3bc[_0x1111('0x3a')]=_['intersection'](_0x47f917[_0x1111('0x39')],qs[_0x1111('0x4d')](_0x4eac7d[_0x1111('0x36')][_0x1111('0x4d')]));_0x46d3bc[_0x1111('0x3a')]=_0x46d3bc[_0x1111('0x3a')][_0x1111('0x3b')]?_0x46d3bc[_0x1111('0x3a')]:_0x47f917[_0x1111('0x39')];if(_0x4eac7d[_0x1111('0x36')][_0x1111('0x45')]){_0x46d3bc[_0x1111('0x46')]=[{'all':!![]}];}_0x46d3bc=_[_0x1111('0x41')]({},_0x46d3bc,_0x4eac7d[_0x1111('0x44')]);return db[_0x1111('0x32')]['find'](_0x46d3bc)[_0x1111('0x2a')](handleEntityNotFound(_0x24ce28,null))[_0x1111('0x2a')](function(_0x475221){if(_0x475221){var _0x14358b=_0x475221[_0x1111('0x50')]({'plain':!![]});_0x14358b=qs[_0x1111('0x51')](_0x14358b,['id','createdAt','updatedAt',_0x1111('0x52')]);_0x4eac7d[_0x1111('0x4f')]=_[_0x1111('0x51')](_0x4eac7d[_0x1111('0x4f')],['id',_0x1111('0x53'),'updatedAt']);return db[_0x1111('0x54')][_0x1111('0x55')](function(_0x475f67){return db[_0x1111('0x32')][_0x1111('0x4e')](_[_0x1111('0x41')](_0x14358b,_0x4eac7d[_0x1111('0x4f')]),{'include':_0x4eac7d[_0x1111('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x475f67})[_0x1111('0x2a')](function(_0x13e589){var _0x54700d=_0x13e589[_0x1111('0x50')]({'plain':!![]});return db[_0x1111('0x56')][_0x1111('0x47')]({'where':{'userProfileId':_0x4eac7d[_0x1111('0x4b')]['id']},'raw':!![]})[_0x1111('0x2a')](function(_0x123436){if(_0x123436){return BPromise[_0x1111('0x57')](_0x123436,function(_0x3b6290){return new BPromise(function(_0xf70f33,_0x77b3ab){if(_0x3b6290[_0x1111('0x58')]===null||_0x3b6290[_0x1111('0x58')]===0x1)_0xf70f33(null);return db[_0x1111('0x59')][_0x1111('0x47')]({'where':{'sectionId':_0x3b6290['id']},'raw':!![]})[_0x1111('0x2a')](function(_0x1fe4b4){var _0x544993=_[_0x1111('0x31')](_0x1fe4b4,function(_0x1b7b55){return qs[_0x1111('0x51')](_0x1b7b55,['id',_0x1111('0x53'),_0x1111('0x5a'),'sectionId']);});_0xf70f33(_0x544993);})[_0x1111('0x49')](function(_0x5c460b){_0x77b3ab(_0x5c460b);});})[_0x1111('0x2a')](function(_0x2a5f1d){var _0x45ade6=qs[_0x1111('0x51')](_0x3b6290,['id',_0x1111('0x53'),_0x1111('0x5a')]);_0x45ade6[_0x1111('0x5b')]=_0x54700d['id'];if(_0x2a5f1d)_0x45ade6['Resources']=_0x2a5f1d;return _0x45ade6;})[_0x1111('0x2a')](function(_0x4bb9ed){return db[_0x1111('0x56')][_0x1111('0x4e')](_0x4bb9ed,{'include':[{'model':db[_0x1111('0x59')],'as':_0x1111('0x5c')}],'raw':!![],'transaction':_0x475f67});});})[_0x1111('0x2a')](function(){return _0x54700d;});}});});});}})[_0x1111('0x2a')](respondWithResult(_0x24ce28,0xc9))[_0x1111('0x49')](handleError(_0x24ce28,null));};exports[_0x1111('0x5d')]=function(_0x38748a,_0x1cde51){if(_0x38748a[_0x1111('0x4f')]['id']){delete _0x38748a[_0x1111('0x4f')]['id'];}return db['UserProfile'][_0x1111('0x5e')]({'where':{'id':_0x38748a[_0x1111('0x4b')]['id']}})[_0x1111('0x2a')](handleEntityNotFound(_0x1cde51,null))['then'](saveUpdates(_0x38748a[_0x1111('0x4f')],null))[_0x1111('0x2a')](respondWithResult(_0x1cde51,null))[_0x1111('0x49')](handleError(_0x1cde51,null));};exports['destroy']=function(_0x36f2b6,_0x550be3){return db[_0x1111('0x32')][_0x1111('0x5e')]({'where':{'id':_0x36f2b6[_0x1111('0x4b')]['id']}})[_0x1111('0x2a')](handleEntityNotFound(_0x550be3,null))[_0x1111('0x2a')](removeEntity(_0x550be3,null))[_0x1111('0x49')](handleError(_0x550be3,null));};exports['describe']=function(_0x1482bc,_0x254f94){return db['UserProfile'][_0x1111('0x5f')]()[_0x1111('0x2a')](respondWithResult(_0x254f94,null))[_0x1111('0x49')](handleError(_0x254f94,null));};exports[_0x1111('0x60')]=function(_0x26421a,_0x14ea45){var _0x984dd2=_0x26421a['body'];return db['UserProfile']['find']({'where':{'id':_0x26421a[_0x1111('0x4b')]['id']}})[_0x1111('0x2a')](handleEntityNotFound(_0x14ea45,null))[_0x1111('0x2a')](function(_0x5ace8f){if(_0x5ace8f){return db[_0x1111('0x54')][_0x1111('0x55')](function(_0x24d8f4){return db['UserProfileSection'][_0x1111('0x2b')]({'where':{'userProfileId':_0x26421a['params']['id'],'sectionId':_[_0x1111('0x31')](_0x984dd2,function(_0x4fe99d){return _0x4fe99d[_0x1111('0x61')];})},'transaction':_0x24d8f4})[_0x1111('0x2a')](function(){var _0x1f6293=_['map'](_0x984dd2,function(_0x2b7b82){_0x2b7b82['userProfileId']=_0x26421a['params']['id'];return _0x2b7b82;});var _0x815d28=[];return BPromise[_0x1111('0x57')](_0x1f6293,function(_0x4effcd){return db['UserProfileSection'][_0x1111('0x4e')](_0x4effcd,{'include':[{'model':db[_0x1111('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x24d8f4})[_0x1111('0x2a')](function(_0x51b0a4){_0x815d28[_0x1111('0x62')](_0x51b0a4[_0x1111('0x50')]({'plain':!![]}));});})[_0x1111('0x2a')](function(){return _0x815d28;});});});}})[_0x1111('0x2a')](function(_0x1f3833){return _0x1f3833;})['then'](respondWithResult(_0x14ea45,null))[_0x1111('0x49')](handleError(_0x14ea45,null));};exports[_0x1111('0x63')]=function(_0x31425f,_0xda044f){var _0x166094;return db[_0x1111('0x32')]['find']({'where':{'id':_0x31425f[_0x1111('0x4b')]['id']},'attributes':['id',_0x1111('0x2e')]})[_0x1111('0x2a')](handleEntityNotFound(_0xda044f,null))[_0x1111('0x2a')](function(_0x23caf8){if(_0x23caf8){_0x166094=_0x23caf8;return db['UserProfileSection'][_0x1111('0x2b')]({'where':{'userProfileId':_0x31425f[_0x1111('0x4b')]['id'],'sectionId':_0x31425f[_0x1111('0x36')][_0x1111('0x64')]}});}})[_0x1111('0x2a')](function(){return _0x166094;})['then'](respondWithStatusCode(_0xda044f,null))[_0x1111('0x49')](handleError(_0xda044f,null));};exports[_0x1111('0x65')]=function(_0x46265c,_0x55397e){var _0x418cf9=[];var _0x8384=[];return db[_0x1111('0x56')][_0x1111('0x47')]({'where':{'userProfileId':_0x46265c[_0x1111('0x4b')]['id']},'raw':!![]})[_0x1111('0x2a')](function(_0x276c4f){_0x418cf9=_[_0x1111('0x40')](_0x276c4f,function(_0x51da6a){return _0x51da6a[_0x1111('0x66')]===0x1||_[_0x1111('0x67')]([0x3eb,0x709],_0x51da6a[_0x1111('0x61')]);});if(!_['isEmpty'](_0x418cf9)){return _['map'](_0x418cf9,function(_0x54e933){return _0x54e933['sectionId'];});}else{return;}})[_0x1111('0x2a')](function(_0x3a6b1b){if(_0x3a6b1b)_0x8384=_0x3a6b1b;if(_[_0x1111('0x67')](_0x8384,0x64)){var _0x545e81=_['find'](_0x418cf9,{'sectionId':0x64});return hasDefaultDashboard(_0x545e81)['then'](function(_0x247f41){return _[_0x1111('0x31')](_0x418cf9,function(_0x540bd4){if(_0x540bd4[_0x1111('0x61')]===0x64){_0x540bd4['subsections']=_0x247f41;}return _0x540bd4;});});}else{return;}})[_0x1111('0x2a')](function(_0x5d4da3){if(_0x5d4da3)_0x418cf9=_0x5d4da3;if(_[_0x1111('0x67')](_0x8384,0x3eb)){var _0x2a8f0f=_[_0x1111('0x5e')](_0x418cf9,{'sectionId':0x3eb});return getCustomDashboards(_0x2a8f0f)[_0x1111('0x2a')](function(_0x347401){return _[_0x1111('0x31')](_0x418cf9,function(_0x35531d){if(_0x2a8f0f[_0x1111('0x66')]){if(_0x35531d['sectionId']===0x3eb){_0x35531d[_0x1111('0x68')]=_0x347401;}}else{if(_0x35531d[_0x1111('0x61')]===0x64){if(!_0x35531d[_0x1111('0x68')]){_0x35531d['subsections']=[];}_0x35531d[_0x1111('0x68')]=_0x35531d['subsections'][_0x1111('0x69')](_0x347401);}}return _0x35531d;});});}else{return;}})[_0x1111('0x2a')](function(_0x115fd4){if(_0x115fd4)_0x418cf9=_0x115fd4;if(_['includes'](_0x8384,0x709)){var _0x5bf5a6=_[_0x1111('0x5e')](_0x418cf9,{'sectionId':0x709});return getPlugins(_0x5bf5a6)[_0x1111('0x2a')](function(_0x505c1f){if(_0x5bf5a6['enabled']){return _[_0x1111('0x31')](_0x418cf9,function(_0x26d444){if(_0x26d444[_0x1111('0x61')]===0x709){_0x26d444[_0x1111('0x68')]=_0x505c1f;}return _0x26d444;});}else{var _0xa30b60={'sectionId':0x76c,'enabled':0x1,'subsections':_0x505c1f};var _0x1e0ad5=_['map'](_0x418cf9);_0x1e0ad5[_0x1111('0x62')](_0xa30b60);return _0x1e0ad5;}});}else{return;}})[_0x1111('0x2a')](function(_0x15eb6f){if(_0x15eb6f)_0x418cf9=_0x15eb6f;return _['filter'](_0x418cf9,[_0x1111('0x66'),0x1]);})[_0x1111('0x2a')](respondWithResult(_0x55397e,null))[_0x1111('0x49')](handleError(_0x55397e,null));};function hasDefaultDashboard(_0x2aa92a){var _0x555a29=[0x65];return new BPromise(function(_0x394af6,_0x506442){try{if(_0x2aa92a[_0x1111('0x58')]){_0x394af6(_0x555a29);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x2aa92a['id']},'raw':!![]})[_0x1111('0x2a')](function(_0x5f517b){_0x5f517b?_0x394af6(_0x555a29):_0x394af6();});}}catch(_0x3da05e){_0x506442(_0x3da05e);}});}function getCustomDashboards(_0x2fec16){var _0x45a101=[];return new BPromise(function(_0xb75126,_0x1ff84a){try{if(_0x2fec16[_0x1111('0x58')]){return db['Dashboard'][_0x1111('0x47')]({'raw':!![]})[_0x1111('0x2a')](function(_0x11d3ac){_0x11d3ac[_0x1111('0x6a')](function(_0x192030){_0x45a101['push'](_0x192030['id']+0x1869f);});_0xb75126(_0x45a101);});}else{return db[_0x1111('0x59')][_0x1111('0x47')]({'where':{'sectionId':_0x2fec16['id']},'raw':!![]})[_0x1111('0x2a')](function(_0x2be5df){_0x2be5df[_0x1111('0x6a')](function(_0x233110){_0x45a101[_0x1111('0x62')](_0x233110['resourceId']+0x1869f);});_0xb75126(_0x45a101);});}}catch(_0x4e2f0e){_0x1ff84a(_0x4e2f0e);}});}function getPlugins(_0x25459c){var _0x38e21e=[];return new BPromise(function(_0x2c461a,_0x58a068){try{if(_0x25459c[_0x1111('0x58')]){return db['Plugin'][_0x1111('0x47')]({'raw':!![]})[_0x1111('0x2a')](function(_0x3cb0ff){_0x3cb0ff[_0x1111('0x6a')](function(_0x468b44){_0x38e21e[_0x1111('0x62')](_0x468b44['id']+0x15b38);});_0x2c461a(_0x38e21e);});}else{return db[_0x1111('0x59')][_0x1111('0x47')]({'where':{'sectionId':_0x25459c['id']},'raw':!![]})['then'](function(_0x4006b7){_0x4006b7[_0x1111('0x6a')](function(_0x703617){_0x38e21e['push'](_0x703617[_0x1111('0x6b')]+0x15b38);});_0x2c461a(_0x38e21e);});}}catch(_0x2184c9){_0x58a068(_0x2184c9);}});}exports[_0x1111('0x6c')]=function(_0x334050,_0x3bbb89){return db[_0x1111('0x32')][_0x1111('0x5e')]({'where':{'id':_0x334050['params']['id']}})[_0x1111('0x2a')](handleEntityNotFound(_0x3bbb89,null))[_0x1111('0x2a')](function(_0x117469){if(_0x117469){return db['sequelize'][_0x1111('0x55')](function(_0xa75f6e){return db[_0x1111('0x56')][_0x1111('0x47')]({'where':{'userProfileId':_0x334050[_0x1111('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x1111('0x2a')](function(_0x56e557){if(_0x56e557){return db[_0x1111('0x56')][_0x1111('0x2b')]({'where':{'userProfileId':_0x334050['params']['id'],'id':_[_0x1111('0x31')](_0x56e557,function(_0x4e8766){return _0x4e8766['id'];})},'transaction':_0xa75f6e});}})[_0x1111('0x2a')](function(_0x37b644){var _0x8b8631=_[_0x1111('0x31')](_0x334050[_0x1111('0x4f')],function(_0x1c751a){_0x1c751a[_0x1111('0x5b')]=_0x334050[_0x1111('0x4b')]['id'];return _0x1c751a;});return db[_0x1111('0x56')][_0x1111('0x6d')](_0x8b8631,{'raw':!![],'transaction':_0xa75f6e});})['then'](function(_0xa9b647){var _0x1fb5e5=_[_0x1111('0x40')](_[_0x1111('0x31')](_0xa9b647,function(_0x556299){return _0x556299[_0x1111('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x1fb5e5){return db[_0x1111('0x56')]['findAll']({'where':{'userProfileId':_0x334050[_0x1111('0x4b')]['id'],'sectionId':_[_0x1111('0x31')](_0x1fb5e5,function(_0x48ab15){return _0x48ab15['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x310933){var _0x2bf77c=_[_0x1111('0x31')](_0x334050[_0x1111('0x4f')],function(_0x395955){_0x395955[_0x1111('0x5b')]=_0x334050['params']['id'];return _0x395955;});return db[_0x1111('0x59')][_0x1111('0x6d')](_0x2bf77c,{'raw':!![],'transaction':_0xa75f6e});});}})['catch'](handleError(_0x3bbb89,null));});}})['then'](function(_0x440f5d){var _0x55f730=_[_0x1111('0x31')](_0x440f5d,function(_0x526f08){return _0x526f08[_0x1111('0x50')]({'plain':!![]});});})[_0x1111('0x2a')](respondWithResult(_0x3bbb89,null))['catch'](handleError(_0x3bbb89,null));};exports[_0x1111('0x6e')]=function(_0x2d8376,_0x11d7cc,_0x11c621){return db[_0x1111('0x32')][_0x1111('0x5e')]({'where':{'id':_0x2d8376[_0x1111('0x4b')]['id']}})[_0x1111('0x2a')](handleEntityNotFound(_0x11d7cc,null))[_0x1111('0x2a')](function(_0x14ba13){if(_0x14ba13){return _0x14ba13[_0x1111('0x6e')](_0x2d8376[_0x1111('0x36')]['ids']);}})['then'](respondWithStatusCode(_0x11d7cc,null))[_0x1111('0x49')](handleError(_0x11d7cc,null));};exports[_0x1111('0x6f')]=function(_0x2b6619,_0x47301d){var _0x235fcc={};if(!_0x2b6619[_0x1111('0x36')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x2b6619[_0x1111('0x36')][_0x1111('0x3c')]('nolimit')){_0x235fcc[_0x1111('0x23')]=qs['limit'](_0x2b6619[_0x1111('0x36')][_0x1111('0x23')]);_0x235fcc[_0x1111('0x21')]=qs['offset'](_0x2b6619[_0x1111('0x36')][_0x1111('0x21')]);}return db[_0x1111('0x32')][_0x1111('0x5e')]({'where':{'id':_0x2b6619[_0x1111('0x4b')]['id']}})[_0x1111('0x2a')](function(_0xdc0d2){if(!_0xdc0d2)throw new Error(_0x1111('0x70')+_0x2b6619[_0x1111('0x4b')]['id']);return db['UserProfile'][_0x1111('0x6f')](_0x2b6619);})['then'](respondWithFilteredResult(_0x47301d,_0x235fcc))['catch'](handleError(_0x47301d,null));}; \ No newline at end of file +var _0x1ca5=['sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','rows','catch','show','merge','find','create','body','clone','params','omit','updatedAt','crudPermissions','get','UserProfileSection','autoAssociation','UserProfileResource','findAll','createdAt','sectionId','userProfileId','Resources','describe','addSections','push','removeSections','ids','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','resourceId','addResources','sequelize','transaction','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x202c7a,_0x3dca8e){var _0x11d0d7=function(_0x59c4b3){while(--_0x59c4b3){_0x202c7a['push'](_0x202c7a['shift']());}};_0x11d0d7(++_0x3dca8e);}(_0x1ca5,0x11d));var _0x51ca=function(_0x24df67,_0x3a3609){_0x24df67=_0x24df67-0x0;var _0x40ac31=_0x1ca5[_0x24df67];return _0x40ac31;};'use strict';var emlformat=require(_0x51ca('0x0'));var rimraf=require(_0x51ca('0x1'));var zipdir=require(_0x51ca('0x2'));var jsonpatch=require(_0x51ca('0x3'));var rp=require(_0x51ca('0x4'));var moment=require(_0x51ca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x51ca('0x6'));var util=require('util');var path=require(_0x51ca('0x7'));var sox=require(_0x51ca('0x8'));var csv=require(_0x51ca('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51ca('0xa'));var _=require('lodash');var squel=require(_0x51ca('0xb'));var crypto=require(_0x51ca('0xc'));var jsforce=require(_0x51ca('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x51ca('0x9'));var querystring=require(_0x51ca('0xe'));var Papa=require(_0x51ca('0xf'));var Redis=require(_0x51ca('0x10'));var authService=require(_0x51ca('0x11'));var qs=require(_0x51ca('0x12'));var as=require(_0x51ca('0x13'));var hardwareService=require(_0x51ca('0x14'));var logger=require('../../config/logger')(_0x51ca('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51ca('0x16'));var db=require(_0x51ca('0x17'))['db'];config[_0x51ca('0x18')]=_[_0x51ca('0x19')](config['redis'],{'host':_0x51ca('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x51ca('0x1b'))['register'](socket);function respondWithStatusCode(_0x1e355d,_0x2a8237){_0x2a8237=_0x2a8237||0xcc;return function(_0x2c9bfa){if(_0x2c9bfa){return _0x1e355d[_0x51ca('0x1c')](_0x2a8237);}return _0x1e355d[_0x51ca('0x1d')](_0x2a8237)['end']();};}function respondWithResult(_0x155c0e,_0xd1663f){_0xd1663f=_0xd1663f||0xc8;return function(_0x4cdc38){if(_0x4cdc38){return _0x155c0e[_0x51ca('0x1d')](_0xd1663f)[_0x51ca('0x1e')](_0x4cdc38);}};}function respondWithFilteredResult(_0x1ca886,_0x309ca6){return function(_0x82e76){if(_0x82e76){var _0x293a9c=typeof _0x309ca6[_0x51ca('0x1f')]==='undefined'&&typeof _0x309ca6[_0x51ca('0x20')]===_0x51ca('0x21');var _0x375c65=_0x82e76['count'];var _0xefdf7d=_0x293a9c?0x0:_0x309ca6[_0x51ca('0x1f')];var _0x8f465=_0x293a9c?_0x82e76[_0x51ca('0x22')]:_0x309ca6['offset']+_0x309ca6[_0x51ca('0x20')];var _0x56aece;if(_0x8f465>=_0x375c65){_0x8f465=_0x375c65;_0x56aece=0xc8;}else{_0x56aece=0xce;}_0x1ca886['status'](_0x56aece);return _0x1ca886[_0x51ca('0x23')](_0x51ca('0x24'),_0xefdf7d+'-'+_0x8f465+'/'+_0x375c65)['json'](_0x82e76);}return null;};}function patchUpdates(_0x142ead){return function(_0x55e862){try{jsonpatch[_0x51ca('0x25')](_0x55e862,_0x142ead,!![]);}catch(_0x13ba0b){return BPromise[_0x51ca('0x26')](_0x13ba0b);}return _0x55e862[_0x51ca('0x27')]();};}function saveUpdates(_0x1a5c3e,_0x539427){return function(_0x105fb7){if(_0x105fb7){return _0x105fb7[_0x51ca('0x28')](_0x1a5c3e)[_0x51ca('0x29')](function(_0x14d8e4){return _0x14d8e4;});}return null;};}function removeEntity(_0xba7008,_0x660d40){return function(_0x19fcab){if(_0x19fcab){return _0x19fcab[_0x51ca('0x2a')]()[_0x51ca('0x29')](function(){_0xba7008['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cda1d,_0x1987ad){return function(_0x53cec7){if(!_0x53cec7){_0x3cda1d[_0x51ca('0x1c')](0x194);}return _0x53cec7;};}function handleError(_0x3adcb1,_0x5b8d40){_0x5b8d40=_0x5b8d40||0x1f4;return function(_0x459e6b){logger[_0x51ca('0x2b')](_0x459e6b[_0x51ca('0x2c')]);if(_0x459e6b[_0x51ca('0x2d')]){delete _0x459e6b[_0x51ca('0x2d')];}_0x3adcb1[_0x51ca('0x1d')](_0x5b8d40)[_0x51ca('0x2e')](_0x459e6b);};}exports[_0x51ca('0x2f')]=function(_0x519c8d,_0x4f057e){var _0x2d39fe={},_0x35387d={},_0x5b3f50={'count':0x0,'rows':[]};var _0x554129=_[_0x51ca('0x30')](db[_0x51ca('0x31')][_0x51ca('0x32')],function(_0x4cae98){return{'name':_0x4cae98[_0x51ca('0x33')],'type':_0x4cae98[_0x51ca('0x34')][_0x51ca('0x35')]};});_0x35387d[_0x51ca('0x36')]=_[_0x51ca('0x30')](_0x554129,'name');_0x35387d[_0x51ca('0x37')]=_[_0x51ca('0x38')](_0x519c8d[_0x51ca('0x37')]);_0x35387d['filters']=_[_0x51ca('0x39')](_0x35387d[_0x51ca('0x36')],_0x35387d[_0x51ca('0x37')]);_0x2d39fe[_0x51ca('0x3a')]=_[_0x51ca('0x39')](_0x35387d['model'],qs['fields'](_0x519c8d[_0x51ca('0x37')][_0x51ca('0x3b')]));_0x2d39fe[_0x51ca('0x3a')]=_0x2d39fe[_0x51ca('0x3a')][_0x51ca('0x3c')]?_0x2d39fe[_0x51ca('0x3a')]:_0x35387d[_0x51ca('0x36')];if(!_0x519c8d[_0x51ca('0x37')][_0x51ca('0x3d')](_0x51ca('0x3e'))){_0x2d39fe[_0x51ca('0x20')]=qs['limit'](_0x519c8d[_0x51ca('0x37')]['limit']);_0x2d39fe[_0x51ca('0x1f')]=qs['offset'](_0x519c8d['query'][_0x51ca('0x1f')]);}_0x2d39fe['order']=qs[_0x51ca('0x3f')](_0x519c8d[_0x51ca('0x37')][_0x51ca('0x3f')]);_0x2d39fe[_0x51ca('0x40')]=qs['filters'](_[_0x51ca('0x41')](_0x519c8d[_0x51ca('0x37')],_0x35387d[_0x51ca('0x42')]),_0x554129);if(_0x519c8d[_0x51ca('0x37')][_0x51ca('0x43')]){_0x2d39fe[_0x51ca('0x40')]=_['merge'](_0x2d39fe[_0x51ca('0x40')],{'$or':_['map'](_0x554129,function(_0x498e39){if(_0x498e39[_0x51ca('0x34')]!==_0x51ca('0x44')){var _0x25d3a7={};_0x25d3a7[_0x498e39[_0x51ca('0x2d')]]={'$like':'%'+_0x519c8d[_0x51ca('0x37')][_0x51ca('0x43')]+'%'};return _0x25d3a7;}})});}_0x2d39fe=_['merge']({},_0x2d39fe,_0x519c8d[_0x51ca('0x45')]);var _0x3bf244={'where':_0x2d39fe[_0x51ca('0x40')]};return db[_0x51ca('0x31')][_0x51ca('0x22')](_0x3bf244)[_0x51ca('0x29')](function(_0x3305ec){_0x5b3f50['count']=_0x3305ec;if(_0x519c8d[_0x51ca('0x37')][_0x51ca('0x46')]){_0x2d39fe[_0x51ca('0x47')]=[{'all':!![]}];}return db[_0x51ca('0x31')]['findAll'](_0x2d39fe);})[_0x51ca('0x29')](function(_0x419dd2){_0x5b3f50[_0x51ca('0x48')]=_0x419dd2;return _0x5b3f50;})[_0x51ca('0x29')](respondWithFilteredResult(_0x4f057e,_0x2d39fe))[_0x51ca('0x49')](handleError(_0x4f057e,null));};exports[_0x51ca('0x4a')]=function(_0x4ef96c,_0x52999){var _0x5679de={'raw':![],'where':{'id':_0x4ef96c['params']['id']}},_0x43f723={};_0x43f723[_0x51ca('0x36')]=_[_0x51ca('0x38')](db[_0x51ca('0x31')][_0x51ca('0x32')]);_0x43f723['query']=_[_0x51ca('0x38')](_0x4ef96c['query']);_0x43f723[_0x51ca('0x42')]=_[_0x51ca('0x39')](_0x43f723[_0x51ca('0x36')],_0x43f723[_0x51ca('0x37')]);_0x5679de['attributes']=_[_0x51ca('0x39')](_0x43f723['model'],qs[_0x51ca('0x3b')](_0x4ef96c[_0x51ca('0x37')][_0x51ca('0x3b')]));_0x5679de[_0x51ca('0x3a')]=_0x5679de[_0x51ca('0x3a')][_0x51ca('0x3c')]?_0x5679de[_0x51ca('0x3a')]:_0x43f723[_0x51ca('0x36')];if(_0x4ef96c['query'][_0x51ca('0x46')]){_0x5679de[_0x51ca('0x47')]=[{'all':!![]}];}_0x5679de=_[_0x51ca('0x4b')]({},_0x5679de,_0x4ef96c[_0x51ca('0x45')]);return db['UserProfile'][_0x51ca('0x4c')](_0x5679de)['then'](handleEntityNotFound(_0x52999,null))['then'](respondWithResult(_0x52999,null))[_0x51ca('0x49')](handleError(_0x52999,null));};exports[_0x51ca('0x4d')]=function(_0x27fd47,_0x4a855b){return db['UserProfile']['create'](_0x27fd47[_0x51ca('0x4e')],{})[_0x51ca('0x29')](respondWithResult(_0x4a855b,0xc9))[_0x51ca('0x49')](handleError(_0x4a855b,null));};exports[_0x51ca('0x4f')]=function(_0x3685ee,_0x4d0c16){var _0x54dd33={'where':{'id':_0x3685ee[_0x51ca('0x50')]['id']}},_0x131156={};_0x131156[_0x51ca('0x36')]=_[_0x51ca('0x38')](db[_0x51ca('0x31')][_0x51ca('0x32')]);_0x54dd33[_0x51ca('0x3a')]=_[_0x51ca('0x39')](_0x131156[_0x51ca('0x36')],qs[_0x51ca('0x3b')](_0x3685ee['query'][_0x51ca('0x3b')]));_0x54dd33[_0x51ca('0x3a')]=_0x54dd33[_0x51ca('0x3a')][_0x51ca('0x3c')]?_0x54dd33['attributes']:_0x131156[_0x51ca('0x36')];if(_0x3685ee[_0x51ca('0x37')][_0x51ca('0x46')]){_0x54dd33['include']=[{'all':!![]}];}_0x54dd33=_[_0x51ca('0x4b')]({},_0x54dd33,_0x3685ee[_0x51ca('0x45')]);return db['UserProfile'][_0x51ca('0x4c')](_0x54dd33)['then'](handleEntityNotFound(_0x4d0c16,null))[_0x51ca('0x29')](function(_0x55b30e){if(_0x55b30e){var _0x51c4b3=_0x55b30e['get']({'plain':!![]});_0x51c4b3=qs[_0x51ca('0x51')](_0x51c4b3,['id','createdAt',_0x51ca('0x52'),_0x51ca('0x53')]);_0x3685ee[_0x51ca('0x4e')]=_[_0x51ca('0x51')](_0x3685ee[_0x51ca('0x4e')],['id','createdAt','updatedAt']);return db['sequelize']['transaction'](function(_0x8f49f8){return db['UserProfile'][_0x51ca('0x4d')](_[_0x51ca('0x4b')](_0x51c4b3,_0x3685ee[_0x51ca('0x4e')]),{'include':_0x3685ee[_0x51ca('0x37')][_0x51ca('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x8f49f8})[_0x51ca('0x29')](function(_0x2675d9){var _0x455d92=_0x2675d9[_0x51ca('0x54')]({'plain':!![]});return db[_0x51ca('0x55')]['findAll']({'where':{'userProfileId':_0x3685ee[_0x51ca('0x50')]['id']},'raw':!![]})['then'](function(_0x5608b9){if(_0x5608b9){return BPromise['each'](_0x5608b9,function(_0x4fdbee){return new BPromise(function(_0x4843d4,_0x1cd3f3){if(_0x4fdbee[_0x51ca('0x56')]===null||_0x4fdbee['autoAssociation']===0x1)_0x4843d4(null);return db[_0x51ca('0x57')][_0x51ca('0x58')]({'where':{'sectionId':_0x4fdbee['id']},'raw':!![]})[_0x51ca('0x29')](function(_0x4c0d2f){var _0x408047=_[_0x51ca('0x30')](_0x4c0d2f,function(_0x218fc4){return qs[_0x51ca('0x51')](_0x218fc4,['id',_0x51ca('0x59'),_0x51ca('0x52'),_0x51ca('0x5a')]);});_0x4843d4(_0x408047);})[_0x51ca('0x49')](function(_0x3fb3ac){_0x1cd3f3(_0x3fb3ac);});})[_0x51ca('0x29')](function(_0x213ad0){var _0x341d71=qs[_0x51ca('0x51')](_0x4fdbee,['id',_0x51ca('0x59'),'updatedAt']);_0x341d71[_0x51ca('0x5b')]=_0x455d92['id'];if(_0x213ad0)_0x341d71[_0x51ca('0x5c')]=_0x213ad0;return _0x341d71;})['then'](function(_0x2f768b){return db['UserProfileSection'][_0x51ca('0x4d')](_0x2f768b,{'include':[{'model':db[_0x51ca('0x57')],'as':_0x51ca('0x5c')}],'raw':!![],'transaction':_0x8f49f8});});})[_0x51ca('0x29')](function(){return _0x455d92;});}});});});}})['then'](respondWithResult(_0x4d0c16,0xc9))[_0x51ca('0x49')](handleError(_0x4d0c16,null));};exports['update']=function(_0x484609,_0xf820f){if(_0x484609['body']['id']){delete _0x484609[_0x51ca('0x4e')]['id'];}return db[_0x51ca('0x31')][_0x51ca('0x4c')]({'where':{'id':_0x484609['params']['id']}})[_0x51ca('0x29')](handleEntityNotFound(_0xf820f,null))[_0x51ca('0x29')](saveUpdates(_0x484609['body'],null))[_0x51ca('0x29')](respondWithResult(_0xf820f,null))[_0x51ca('0x49')](handleError(_0xf820f,null));};exports[_0x51ca('0x2a')]=function(_0x3c992f,_0x120e71){return db[_0x51ca('0x31')][_0x51ca('0x4c')]({'where':{'id':_0x3c992f['params']['id']}})[_0x51ca('0x29')](handleEntityNotFound(_0x120e71,null))['then'](removeEntity(_0x120e71,null))[_0x51ca('0x49')](handleError(_0x120e71,null));};exports['describe']=function(_0xb4fc6f,_0x6e597c){return db[_0x51ca('0x31')][_0x51ca('0x5d')]()[_0x51ca('0x29')](respondWithResult(_0x6e597c,null))[_0x51ca('0x49')](handleError(_0x6e597c,null));};exports[_0x51ca('0x5e')]=function(_0xa202c9,_0x2b4885){var _0x13c5ab=_0xa202c9[_0x51ca('0x4e')];return db['UserProfile'][_0x51ca('0x4c')]({'where':{'id':_0xa202c9[_0x51ca('0x50')]['id']}})['then'](handleEntityNotFound(_0x2b4885,null))['then'](function(_0x5ceafa){if(_0x5ceafa){return db['sequelize']['transaction'](function(_0x98d28d){return db[_0x51ca('0x55')][_0x51ca('0x2a')]({'where':{'userProfileId':_0xa202c9[_0x51ca('0x50')]['id'],'sectionId':_['map'](_0x13c5ab,function(_0x486e2f){return _0x486e2f['sectionId'];})},'transaction':_0x98d28d})[_0x51ca('0x29')](function(){var _0x489ff3=_[_0x51ca('0x30')](_0x13c5ab,function(_0x2d6ab0){_0x2d6ab0[_0x51ca('0x5b')]=_0xa202c9['params']['id'];return _0x2d6ab0;});var _0x1d5295=[];return BPromise['each'](_0x489ff3,function(_0x2959bb){return db[_0x51ca('0x55')]['create'](_0x2959bb,{'include':[{'model':db[_0x51ca('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x98d28d})[_0x51ca('0x29')](function(_0x5a5b59){_0x1d5295[_0x51ca('0x5f')](_0x5a5b59['get']({'plain':!![]}));});})[_0x51ca('0x29')](function(){return _0x1d5295;});});});}})['then'](function(_0x42b9cd){return _0x42b9cd;})[_0x51ca('0x29')](respondWithResult(_0x2b4885,null))[_0x51ca('0x49')](handleError(_0x2b4885,null));};exports[_0x51ca('0x60')]=function(_0x1331e4,_0x279f99){var _0x228100;return db[_0x51ca('0x31')][_0x51ca('0x4c')]({'where':{'id':_0x1331e4['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x279f99,null))['then'](function(_0x51b3a9){if(_0x51b3a9){_0x228100=_0x51b3a9;return db[_0x51ca('0x55')]['destroy']({'where':{'userProfileId':_0x1331e4[_0x51ca('0x50')]['id'],'sectionId':_0x1331e4[_0x51ca('0x37')][_0x51ca('0x61')]}});}})[_0x51ca('0x29')](function(){return _0x228100;})[_0x51ca('0x29')](respondWithStatusCode(_0x279f99,null))[_0x51ca('0x49')](handleError(_0x279f99,null));};exports['getSections']=function(_0x42157e,_0x245793){var _0x3e7c0c=[];var _0x51e5e6=[];return db[_0x51ca('0x55')][_0x51ca('0x58')]({'where':{'userProfileId':_0x42157e['params']['id']},'raw':!![]})['then'](function(_0x415a6a){_0x3e7c0c=_[_0x51ca('0x43')](_0x415a6a,function(_0x23618f){return _0x23618f[_0x51ca('0x62')]===0x1||_[_0x51ca('0x63')]([0x3eb,0x709],_0x23618f[_0x51ca('0x5a')]);});if(!_[_0x51ca('0x64')](_0x3e7c0c)){return _[_0x51ca('0x30')](_0x3e7c0c,function(_0xa956cc){return _0xa956cc['sectionId'];});}else{return;}})[_0x51ca('0x29')](function(_0x4075da){if(_0x4075da)_0x51e5e6=_0x4075da;if(_[_0x51ca('0x63')](_0x51e5e6,0x64)){var _0x445182=_[_0x51ca('0x4c')](_0x3e7c0c,{'sectionId':0x64});return hasDefaultDashboard(_0x445182)[_0x51ca('0x29')](function(_0x54ba2a){return _['map'](_0x3e7c0c,function(_0xdcf20d){if(_0xdcf20d[_0x51ca('0x5a')]===0x64){_0xdcf20d[_0x51ca('0x65')]=_0x54ba2a;}return _0xdcf20d;});});}else{return;}})[_0x51ca('0x29')](function(_0x5aa40e){if(_0x5aa40e)_0x3e7c0c=_0x5aa40e;if(_[_0x51ca('0x63')](_0x51e5e6,0x3eb)){var _0x43851e=_['find'](_0x3e7c0c,{'sectionId':0x3eb});return getCustomDashboards(_0x43851e)[_0x51ca('0x29')](function(_0x18857b){return _[_0x51ca('0x30')](_0x3e7c0c,function(_0x36b6ff){if(_0x43851e[_0x51ca('0x62')]){if(_0x36b6ff['sectionId']===0x3eb){_0x36b6ff[_0x51ca('0x65')]=_0x18857b;}}else{if(_0x36b6ff[_0x51ca('0x5a')]===0x64){if(!_0x36b6ff['subsections']){_0x36b6ff[_0x51ca('0x65')]=[];}_0x36b6ff['subsections']=_0x36b6ff[_0x51ca('0x65')]['concat'](_0x18857b);}}return _0x36b6ff;});});}else{return;}})[_0x51ca('0x29')](function(_0x37f4d5){if(_0x37f4d5)_0x3e7c0c=_0x37f4d5;if(_[_0x51ca('0x63')](_0x51e5e6,0x709)){var _0x200b46=_[_0x51ca('0x4c')](_0x3e7c0c,{'sectionId':0x709});return getPlugins(_0x200b46)[_0x51ca('0x29')](function(_0x35e095){if(_0x200b46[_0x51ca('0x62')]){return _['map'](_0x3e7c0c,function(_0x53c2db){if(_0x53c2db[_0x51ca('0x5a')]===0x709){_0x53c2db[_0x51ca('0x65')]=_0x35e095;}return _0x53c2db;});}else{var _0x3d82d5={'sectionId':0x76c,'enabled':0x1,'subsections':_0x35e095};var _0x42c3a8=_[_0x51ca('0x30')](_0x3e7c0c);_0x42c3a8['push'](_0x3d82d5);return _0x42c3a8;}});}else{return;}})[_0x51ca('0x29')](function(_0x2dfc93){if(_0x2dfc93)_0x3e7c0c=_0x2dfc93;return _['filter'](_0x3e7c0c,[_0x51ca('0x62'),0x1]);})[_0x51ca('0x29')](respondWithResult(_0x245793,null))[_0x51ca('0x49')](handleError(_0x245793,null));};function hasDefaultDashboard(_0x13b344){var _0x1ca918=[0x65];return new BPromise(function(_0x1f318a,_0x4b8440){try{if(_0x13b344[_0x51ca('0x56')]){_0x1f318a(_0x1ca918);}else{return db[_0x51ca('0x57')][_0x51ca('0x66')]({'where':{'sectionId':_0x13b344['id']},'raw':!![]})[_0x51ca('0x29')](function(_0x553361){_0x553361?_0x1f318a(_0x1ca918):_0x1f318a();});}}catch(_0x4cfbe9){_0x4b8440(_0x4cfbe9);}});}function getCustomDashboards(_0x15a58b){var _0x27f420=[];return new BPromise(function(_0x3630cf,_0x52b12b){try{if(_0x15a58b['autoAssociation']){return db[_0x51ca('0x67')][_0x51ca('0x58')]({'raw':!![]})[_0x51ca('0x29')](function(_0x403db7){_0x403db7[_0x51ca('0x68')](function(_0x6046b6){_0x27f420[_0x51ca('0x5f')](_0x6046b6['id']+0x1869f);});_0x3630cf(_0x27f420);});}else{return db[_0x51ca('0x57')][_0x51ca('0x58')]({'where':{'sectionId':_0x15a58b['id']},'raw':!![]})[_0x51ca('0x29')](function(_0x5b28c9){_0x5b28c9[_0x51ca('0x68')](function(_0x44acbe){_0x27f420[_0x51ca('0x5f')](_0x44acbe['resourceId']+0x1869f);});_0x3630cf(_0x27f420);});}}catch(_0x9b2054){_0x52b12b(_0x9b2054);}});}function getPlugins(_0x1092b0){var _0x3f2e5f=[];return new BPromise(function(_0xf14775,_0x54b32c){try{if(_0x1092b0[_0x51ca('0x56')]){return db[_0x51ca('0x69')][_0x51ca('0x58')]({'raw':!![]})[_0x51ca('0x29')](function(_0x452271){_0x452271[_0x51ca('0x68')](function(_0x490daf){_0x3f2e5f['push'](_0x490daf['id']+0x15b38);});_0xf14775(_0x3f2e5f);});}else{return db[_0x51ca('0x57')][_0x51ca('0x58')]({'where':{'sectionId':_0x1092b0['id']},'raw':!![]})[_0x51ca('0x29')](function(_0x128bf4){_0x128bf4['forEach'](function(_0x41d669){_0x3f2e5f[_0x51ca('0x5f')](_0x41d669[_0x51ca('0x6a')]+0x15b38);});_0xf14775(_0x3f2e5f);});}}catch(_0x41ea53){_0x54b32c(_0x41ea53);}});}exports[_0x51ca('0x6b')]=function(_0x5beecb,_0x37ffe3){return db['UserProfile'][_0x51ca('0x4c')]({'where':{'id':_0x5beecb['params']['id']}})[_0x51ca('0x29')](handleEntityNotFound(_0x37ffe3,null))[_0x51ca('0x29')](function(_0x50d346){if(_0x50d346){return db[_0x51ca('0x6c')][_0x51ca('0x6d')](function(_0x1b4ebb){return db[_0x51ca('0x55')][_0x51ca('0x58')]({'where':{'userProfileId':_0x5beecb['params']['id']},'attributes':['id'],'raw':!![]})[_0x51ca('0x29')](function(_0x1a8037){if(_0x1a8037){return db[_0x51ca('0x55')]['destroy']({'where':{'userProfileId':_0x5beecb[_0x51ca('0x50')]['id'],'id':_['map'](_0x1a8037,function(_0x3f893a){return _0x3f893a['id'];})},'transaction':_0x1b4ebb});}})[_0x51ca('0x29')](function(_0x3f1b82){var _0x3dda59=_[_0x51ca('0x30')](_0x5beecb[_0x51ca('0x4e')],function(_0x486c06){_0x486c06[_0x51ca('0x5b')]=_0x5beecb[_0x51ca('0x50')]['id'];return _0x486c06;});return db['UserProfileSection'][_0x51ca('0x6e')](_0x3dda59,{'raw':!![],'transaction':_0x1b4ebb});})[_0x51ca('0x29')](function(_0x1c0a33){var _0x401e8e=_[_0x51ca('0x43')](_[_0x51ca('0x30')](_0x1c0a33,function(_0x423b30){return _0x423b30[_0x51ca('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x401e8e){return db[_0x51ca('0x55')][_0x51ca('0x58')]({'where':{'userProfileId':_0x5beecb[_0x51ca('0x50')]['id'],'sectionId':_[_0x51ca('0x30')](_0x401e8e,function(_0xe77e2d){return _0xe77e2d[_0x51ca('0x5a')];})},'attributes':['id',_0x51ca('0x5a')],'raw':!![]})[_0x51ca('0x29')](function(_0x4fc660){var _0xed8414=_[_0x51ca('0x30')](_0x5beecb[_0x51ca('0x4e')],function(_0x40c1dc){_0x40c1dc[_0x51ca('0x5b')]=_0x5beecb[_0x51ca('0x50')]['id'];return _0x40c1dc;});return db[_0x51ca('0x57')]['bulkCreate'](_0xed8414,{'raw':!![],'transaction':_0x1b4ebb});});}})[_0x51ca('0x49')](handleError(_0x37ffe3,null));});}})[_0x51ca('0x29')](function(_0x4ed5b4){var _0x2926eb=_[_0x51ca('0x30')](_0x4ed5b4,function(_0x2986ee){return _0x2986ee[_0x51ca('0x54')]({'plain':!![]});});})[_0x51ca('0x29')](respondWithResult(_0x37ffe3,null))[_0x51ca('0x49')](handleError(_0x37ffe3,null));};exports['removeResources']=function(_0x1cdffe,_0x2459d8,_0x4ed700){return db[_0x51ca('0x31')][_0x51ca('0x4c')]({'where':{'id':_0x1cdffe['params']['id']}})[_0x51ca('0x29')](handleEntityNotFound(_0x2459d8,null))['then'](function(_0xf06821){if(_0xf06821){return _0xf06821[_0x51ca('0x6f')](_0x1cdffe[_0x51ca('0x37')][_0x51ca('0x61')]);}})[_0x51ca('0x29')](respondWithStatusCode(_0x2459d8,null))[_0x51ca('0x49')](handleError(_0x2459d8,null));};exports[_0x51ca('0x70')]=function(_0x309fe8,_0x200df8){var _0x3dcde2={};if(!_0x309fe8[_0x51ca('0x37')][_0x51ca('0x71')])throw new Error(_0x51ca('0x72'));if(!_0x309fe8[_0x51ca('0x37')][_0x51ca('0x3d')](_0x51ca('0x3e'))){_0x3dcde2[_0x51ca('0x20')]=qs[_0x51ca('0x20')](_0x309fe8[_0x51ca('0x37')][_0x51ca('0x20')]);_0x3dcde2[_0x51ca('0x1f')]=qs['offset'](_0x309fe8[_0x51ca('0x37')][_0x51ca('0x1f')]);}return db['UserProfile'][_0x51ca('0x4c')]({'where':{'id':_0x309fe8['params']['id']}})['then'](function(_0x5e02b6){if(!_0x5e02b6)throw new Error(_0x51ca('0x73')+_0x309fe8[_0x51ca('0x50')]['id']);return db['UserProfile']['getResources'](_0x309fe8);})[_0x51ca('0x29')](respondWithFilteredResult(_0x200df8,_0x3dcde2))[_0x51ca('0x49')](handleError(_0x200df8,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 69319f7..ee118c4 100644 --- a/server/api/userProfile/userProfile.events.js +++ b/server/api/userProfile/userProfile.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ac2=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','UserProfile'];(function(_0x5e36af,_0x40fbca){var _0x28c09c=function(_0x5a72da){while(--_0x5a72da){_0x5e36af['push'](_0x5e36af['shift']());}};_0x28c09c(++_0x40fbca);}(_0x6ac2,0x184));var _0x26ac=function(_0x36f051,_0x21946b){_0x36f051=_0x36f051-0x0;var _0x479e5b=_0x6ac2[_0x36f051];return _0x479e5b;};'use strict';var EventEmitter=require(_0x26ac('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x26ac('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x26ac('0x2')](0x0);var events={'afterCreate':_0x26ac('0x3'),'afterUpdate':_0x26ac('0x4'),'afterDestroy':_0x26ac('0x5')};function emitEvent(_0x2a650c){return function(_0x595aa9,_0x40d8d0,_0x5b40f6){UserProfileEvents[_0x26ac('0x6')](_0x2a650c+':'+_0x595aa9['id'],_0x595aa9);UserProfileEvents[_0x26ac('0x6')](_0x2a650c,_0x595aa9);_0x5b40f6(null);};}for(var e in events){if(events[_0x26ac('0x7')](e)){var event=events[e];UserProfile[_0x26ac('0x8')](e,emitEvent(event));}}module[_0x26ac('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x4910=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserProfile','save'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x4910,0x1d9));var _0x0491=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4910[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x0491('0x0'));var UserProfile=require(_0x0491('0x1'))['db'][_0x0491('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0491('0x3'),'afterUpdate':_0x0491('0x4'),'afterDestroy':_0x0491('0x5')};function emitEvent(_0x2fc9e8){return function(_0x408677,_0x51f40d,_0x1ecb19){UserProfileEvents[_0x0491('0x6')](_0x2fc9e8+':'+_0x408677['id'],_0x408677);UserProfileEvents[_0x0491('0x6')](_0x2fc9e8,_0x408677);_0x1ecb19(null);};}for(var e in events){if(events[_0x0491('0x7')](e)){var event=events[e];UserProfile[_0x0491('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 5505902..0faa30f 100644 --- a/server/api/userProfile/userProfile.model.js +++ b/server/api/userProfile/userProfile.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2f0=['DefaultReports','custom','CustomReports','ids','customSorting','extraQueryConditions','count','Tags','color','tag','include','openTabs','true','rows','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','models','filter','associatedResources','map','catch','model','then','name','resolve','UserProfileResource','field','type','resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','inboundroutes','internalroutes','VoiceExtension','VoiceMail','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','find','params','all','ignore','push','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','options','includeAll','findAll','reportType'];(function(_0x55ad36,_0xdc8afd){var _0x15c9f8=function(_0x907dfc){while(--_0x907dfc){_0x55ad36['push'](_0x55ad36['shift']());}};_0x15c9f8(++_0xdc8afd);}(_0xd2f0,0xd3));var _0x0d2f=function(_0xde79d1,_0x407441){_0xde79d1=_0xde79d1-0x0;var _0x4f891e=_0xd2f0[_0xde79d1];return _0x4f891e;};'use strict';var _=require(_0x0d2f('0x0'));var attributes=require(_0x0d2f('0x1'));var squel=require('squel');module['exports']=function(_0x5c579e){var _0x5d81b9=_0x5c579e[_0x0d2f('0x2')];function _0x51a518(_0x1bf052,_0x425a0c){return new Promise(function(_0x58d6af,_0x3178e4){if(!_0x425a0c)return _0x58d6af(null);var _0x514c7a=_0x425a0c['filter']?{[_0x425a0c[_0x0d2f('0x3')]['field']]:_0x425a0c['filter']['value']}:undefined;return _0x5d81b9[_0x1bf052]['findAll']({'where':_0x514c7a,'raw':!![]})['then'](function(_0xb913c7){_0x425a0c[_0x0d2f('0x4')]=_[_0x0d2f('0x5')](_0xb913c7,'id');_0x58d6af(_0x425a0c);})[_0x0d2f('0x6')](function(_0x3bd2c5){_0x3178e4(_0x3bd2c5);});});}function _0x2661db(_0x4cd401,_0x1c69b5){return new Promise(function(_0x23c421,_0x1a4c44){var _0x489710=_0x4cd401[_0x0d2f('0x3')]?{[_0x4cd401[_0x0d2f('0x3')]['field']]:_0x4cd401[_0x0d2f('0x3')]['value']}:undefined;return _0x5d81b9[_0x4cd401[_0x0d2f('0x7')]]['findAll']({'where':_0x489710,'raw':!![]})[_0x0d2f('0x8')](function(_0x44feeb){_0x1c69b5[_0x0d2f('0x4')]=_[_0x0d2f('0x5')](_0x44feeb,function(_0x13d1a6){return _0x13d1a6[_0x0d2f('0x9')];});_0x23c421(_0x1c69b5);})['catch'](function(_0x13052a){_0x1a4c44(_0x13052a);});});}function _0x2e9424(_0x3c5825,_0x2ba9b6,_0x233d81){if(!_0x2ba9b6)return Promise[_0x0d2f('0xa')](null);return new Promise(function(_0x442691,_0x1f381d){return _0x5d81b9[_0x0d2f('0xb')]['findAll']({'where':{'sectionId':_0x2ba9b6['id']},'raw':!![]})[_0x0d2f('0x8')](function(_0x1ba352){if(_0x3c5825[_0x0d2f('0xc')]&&_0x3c5825[_0x0d2f('0xc')]!=='id'){_0x2ba9b6[_0x0d2f('0x4')]=_[_0x0d2f('0x5')](_0x1ba352,function(_0x3a6be3){return _0x3a6be3[_0x3c5825['field']];});}else{if(_0x233d81==='AnalyticExtractedReport'){_0x2ba9b6['associatedResources']=_[_0x0d2f('0x5')](_0x1ba352,function(_0xdb41aa){return{'id':_0xdb41aa['resourceId'],'type':_0xdb41aa[_0x0d2f('0xd')]};});}else{_0x2ba9b6[_0x0d2f('0x4')]=_[_0x0d2f('0x5')](_0x1ba352,function(_0x353fe){return _0x353fe[_0x0d2f('0xe')];});}}_0x442691(_0x2ba9b6);})[_0x0d2f('0x6')](function(_0x3fc00d){_0x1f381d(_0x3fc00d);});});}function _0x26c5f8(_0x4892d9,_0x5bc65d){var _0x4e376e={'parentSections':[]};switch(_0x4892d9[_0x0d2f('0xf')]()){case _0x0d2f('0x10'):_0x4e376e[_0x0d2f('0x11')]='SquareProject';break;case _0x0d2f('0x12'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x13');break;case _0x0d2f('0x14'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x15');_0x4e376e[_0x0d2f('0x16')]=[{'name':_0x0d2f('0x17'),'field':_0x0d2f('0x9'),'foreignKey':_0x0d2f('0x18')}];break;case _0x0d2f('0x19'):_0x4e376e['childModel']='JscriptyProject';break;case _0x0d2f('0x1a'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x1b');_0x4e376e[_0x0d2f('0x16')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case'lists':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x1c');break;case _0x0d2f('0x1d'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x1e');break;case _0x0d2f('0x1f'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x20');break;case _0x0d2f('0x21'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x22');break;case _0x0d2f('0x23'):_0x4e376e['childModel']=_0x0d2f('0x24');break;case _0x0d2f('0x25'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x26');break;case'faxaccounts':_0x4e376e[_0x0d2f('0x11')]='FaxAccount';break;case _0x0d2f('0x27'):case _0x0d2f('0x28'):case'outboundroutes':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x29');break;case'contexts':_0x4e376e[_0x0d2f('0x11')]='VoiceContext';break;case'voicemails':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x2a');break;case'voicerecordings':_0x4e376e[_0x0d2f('0x11')]='VoiceRecording';_0x4e376e[_0x0d2f('0x16')]=[{'name':'Agents','field':_0x0d2f('0x9'),'foreignKey':_0x0d2f('0x2b'),'model':_0x0d2f('0x2c'),'filter':{'field':'role','value':[_0x0d2f('0x2d')]}},{'name':_0x0d2f('0x2e'),'field':_0x0d2f('0x9'),'foreignKey':_0x0d2f('0x2b'),'model':_0x0d2f('0x2c'),'filter':{'field':_0x0d2f('0x2f'),'value':[_0x0d2f('0x30')]}},{'name':_0x0d2f('0x31'),'field':_0x0d2f('0x9'),'foreignKey':_0x0d2f('0x32'),'model':_0x0d2f('0x33'),'filter':{'field':_0x0d2f('0xd'),'value':[_0x0d2f('0x34')]}},{'name':_0x0d2f('0x35'),'field':_0x0d2f('0x9'),'foreignKey':_0x0d2f('0x32'),'model':_0x0d2f('0x33'),'filter':{'field':'type','value':['outbound']}}];break;case _0x0d2f('0x36'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x37');break;case'chanspies':_0x4e376e['childModel']='VoiceChanSpy';break;case _0x0d2f('0x38'):_0x4e376e['childModel']=_0x0d2f('0x39');break;case _0x0d2f('0x3a'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x3b');break;case _0x0d2f('0x3c'):_0x4e376e['childModel']=_0x0d2f('0x3d');break;case _0x0d2f('0x3e'):_0x4e376e[_0x0d2f('0x11')]='MailAccount';break;case _0x0d2f('0x3f'):_0x4e376e['childModel']=_0x0d2f('0x40');break;case _0x0d2f('0x41'):_0x4e376e[_0x0d2f('0x11')]='OpenchannelQueue';break;case'openchannelaccounts':_0x4e376e['childModel']='OpenchannelAccount';break;case _0x0d2f('0x42'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x43');break;case _0x0d2f('0x44'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x45');break;case'whatsappqueues':_0x4e376e['childModel']=_0x0d2f('0x46');break;case _0x0d2f('0x47'):_0x4e376e[_0x0d2f('0x11')]='WhatsappAccount';break;case _0x0d2f('0x48'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x49');break;case _0x0d2f('0x4a'):case'queuecampaigns':_0x4e376e['childModel']=_0x0d2f('0x33');if(_0x5bc65d){_0x4e376e[_0x0d2f('0x16')]=[{'name':_0x0d2f('0x31')},{'name':_0x0d2f('0x35')}];}break;case _0x0d2f('0x4b'):case _0x0d2f('0x4c'):case _0x0d2f('0x4d'):_0x4e376e['childModel']=_0x0d2f('0x2c');if(_0x5bc65d){_0x4e376e['parentSections']=[{'name':_0x0d2f('0x4e'),'filter':{'field':'role','value':[_0x0d2f('0x4f'),_0x0d2f('0x50')]},'ignore':!![]},{'name':_0x0d2f('0x51')},{'name':_0x0d2f('0x2e')}];}break;case _0x0d2f('0x52'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x53');break;case _0x0d2f('0x54'):_0x4e376e['childModel']=_0x0d2f('0x55');break;case _0x0d2f('0x56'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x57');break;case'sugarcrmaccounts':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x58');break;case _0x0d2f('0x59'):_0x4e376e['childModel']=_0x0d2f('0x5a');break;case _0x0d2f('0x5b'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x5c');break;case _0x0d2f('0x5d'):_0x4e376e['childModel']=_0x0d2f('0x2c');break;case _0x0d2f('0x5e'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x5f');break;case'dispositions':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x60');break;case _0x0d2f('0x61'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x62');break;case _0x0d2f('0x63'):_0x4e376e['childModel']=_0x0d2f('0x64');break;case _0x0d2f('0x65'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x66');break;case _0x0d2f('0x67'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x68');break;case _0x0d2f('0x69'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x6a');break;case _0x0d2f('0x6b'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x6c');break;case'templates':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x6d');break;case'triggers':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x6e');break;case _0x0d2f('0x6f'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x70');break;case _0x0d2f('0x71'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x72');break;case _0x0d2f('0x73'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x74');break;case _0x0d2f('0x75'):_0x4e376e[_0x0d2f('0x11')]='AnalyticExtractedReport';_0x4e376e[_0x0d2f('0x16')]=[{'name':_0x0d2f('0x76'),'field':'id','foreignKey':'reportId'}];break;case _0x0d2f('0x77'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x78');break;}return _0x4e376e;}function _0x339e3c(_0x55bf6f,_0x21b20c){var _0xa665f6=_0x55bf6f[_0x0d2f('0x79')](0x0)['toUpperCase']()+_0x55bf6f[_0x0d2f('0x7a')](0x1);var _0x945575={'type':_0x5d81b9[_0x0d2f('0x7b')][_0x0d2f('0x7c')][_0x0d2f('0x7d')],'raw':!![]};return new Promise(function(_0x6c44ec,_0x2b57b6){var _0x1b4be7=squel[_0x0d2f('0x7e')]()[_0x0d2f('0xc')](_0x0d2f('0x7f')+_0xa665f6+_0x0d2f('0x80'),'id')[_0x0d2f('0xc')]('ui.createdAt')[_0x0d2f('0x81')](_0x0d2f('0x82')+_0x55bf6f+'_interactions','ui')[_0x0d2f('0x83')](_0x0d2f('0x84'),_0x21b20c['id']);return _0x5d81b9[_0x0d2f('0x85')][_0x0d2f('0x86')](_0x1b4be7[_0x0d2f('0x87')](),_0x945575)[_0x0d2f('0x8')](function(_0x39be35){_0x21b20c[_0xa665f6+_0x0d2f('0x88')]=_0x39be35;_0x6c44ec(_0x39be35);})['catch'](function(_0x140e5b){_0x2b57b6(_0x140e5b);});});}return _0x5c579e['define'](_0x0d2f('0x89'),attributes,{'tableName':_0x0d2f('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x191bca){var _0x307daa=require(_0x0d2f('0x8b'));var _0x4cd878={'raw':_0x191bca['query']['raw'],'where':{}};var _0x283019={};var _0x544ebd={'count':0x0,'rows':[]};var _0x464d66=_0x191bca[_0x0d2f('0x86')][_0x0d2f('0x8c')];var _0xf52f6=_0x191bca[_0x0d2f('0x86')][_0x0d2f('0x8d')]||![];var _0x93346d=_0x26c5f8(_0x464d66,_0xf52f6);if(!_0x93346d[_0x0d2f('0x11')])throw new Error(_0x0d2f('0x8e')+_0x464d66+'\x27');var _0x3ec9b2=[{'name':_0x464d66}];if(!_[_0x0d2f('0x8f')](_0x93346d[_0x0d2f('0x16')]))_0x3ec9b2=_0x93346d[_0x0d2f('0x16')];var _0x565454=[];for(var _0xfbec39=0x0;_0xfbec39<_0x3ec9b2[_0x0d2f('0x90')];_0xfbec39++){_0x565454['push'](_0x5d81b9['UserProfileSection'][_0x0d2f('0x91')]({'where':{'userProfileId':_0x191bca[_0x0d2f('0x92')]['id'],'name':_0x3ec9b2[_0xfbec39]['name']},'raw':!![]}));}return Promise[_0x0d2f('0x93')](_0x565454)[_0x0d2f('0x8')](function(_0xe7fd80){var _0x26acb3=_['filter'](_0xe7fd80,function(_0x2137ab){return _0x2137ab?_0x2137ab:undefined;});var _0x4a92b5=_['filter'](_0x3ec9b2,[_0x0d2f('0x94'),!![]]);var _0x4b4a0d=_['isEmpty'](_0x26acb3)&&_[_0x0d2f('0x8f')](_0x4a92b5)?null:_['union'](_0x4a92b5,_0x26acb3);if(!_0x4b4a0d)return null;var _0x3eb177=[];for(var _0x40d8a9=0x0;_0x40d8a9<_0x4b4a0d[_0x0d2f('0x90')];_0x40d8a9++){var _0x23f04d=_['find'](_0x3ec9b2,function(_0x27339a){return _0x4b4a0d[_0x40d8a9]?_0x27339a['name']===_0x4b4a0d[_0x40d8a9][_0x0d2f('0x9')]:null;});if(_0x23f04d){if(_0x4b4a0d[_0x40d8a9][_0x0d2f('0x94')]){_0x3eb177[_0x0d2f('0x95')](_0x51a518(_0x93346d['childModel'],_0x4b4a0d[_0x40d8a9]));}else{if(!_0x4b4a0d[_0x40d8a9][_0x0d2f('0x96')]){_0x3eb177[_0x0d2f('0x95')](_0x2e9424(_0x23f04d,_0x4b4a0d[_0x40d8a9],_0x93346d[_0x0d2f('0x11')]));}else{if(_0x23f04d[_0x0d2f('0x7')]){_0x3eb177['push'](_0x2661db(_0x23f04d,_0x4b4a0d[_0x40d8a9]));}}}}}return Promise[_0x0d2f('0x93')](_0x3eb177);})[_0x0d2f('0x8')](function(_0x16f3c5){var _0x50d1b8=_0x16f3c5;var _0x298a6b=null;if(_0x50d1b8){_0x298a6b=_0x50d1b8[_0x0d2f('0x90')]===0x1?_0x50d1b8[0x0]:null;}if(!_0x298a6b&&!_0x50d1b8)return _0x544ebd;var _0x112fbc=_0x5d81b9[_0x93346d['childModel']]['rawAttributes'];_0x283019[_0x0d2f('0x7')]=_[_0x0d2f('0x97')](_0x112fbc);_0x283019[_0x0d2f('0x86')]=_['keys'](_0x191bca[_0x0d2f('0x86')]);_0x283019[_0x0d2f('0x98')]=_[_0x0d2f('0x99')](_0x283019['model'],_0x283019[_0x0d2f('0x86')]);_0x4cd878[_0x0d2f('0x9a')]=_[_0x0d2f('0x99')](_0x283019[_0x0d2f('0x7')],_0x307daa['fields'](_0x191bca['query'][_0x0d2f('0x9b')]));_0x4cd878[_0x0d2f('0x9a')]=_0x4cd878[_0x0d2f('0x9a')][_0x0d2f('0x90')]?_0x4cd878[_0x0d2f('0x9a')]:_0x283019[_0x0d2f('0x7')];if(!_0x191bca['query'][_0x0d2f('0x9c')](_0x0d2f('0x9d'))){_0x4cd878['limit']=_0x307daa[_0x0d2f('0x9e')](_0x191bca[_0x0d2f('0x86')]['limit']);_0x4cd878[_0x0d2f('0x9f')]=_0x307daa[_0x0d2f('0x9f')](_0x191bca[_0x0d2f('0x86')][_0x0d2f('0x9f')]);}_0x4cd878[_0x0d2f('0xa0')]=_0x307daa[_0x0d2f('0xa1')](_0x191bca[_0x0d2f('0x86')]['sort']);_0x4cd878[_0x0d2f('0x83')]=_0x307daa['filters'](_[_0x0d2f('0xa2')](_0x191bca[_0x0d2f('0x86')],_0x283019[_0x0d2f('0x98')]));if(_0x191bca[_0x0d2f('0x86')][_0x0d2f('0x3')]){_0x4cd878[_0x0d2f('0x83')]=_[_0x0d2f('0xa3')](_0x4cd878[_0x0d2f('0x83')],{'$or':_[_0x0d2f('0x5')](_0x112fbc,function(_0x579b12){if(_0x579b12[_0x0d2f('0xd')][_0x0d2f('0xa4')]!==_0x0d2f('0xa5')){var _0x4a8818={};_0x4a8818[_0x579b12[_0x0d2f('0xc')]]={'$like':'%'+_0x191bca['query']['filter']+'%'};return _0x4a8818;}})});}var _0x2755aa=[];var _0x4b5933=null;var _0x32d0a7={};if(_0x298a6b){_0x4b5933=_['find'](_0x3ec9b2,[_0x0d2f('0x9'),_0x298a6b[_0x0d2f('0x9')]]);if(_0x4b5933[_0x0d2f('0xc')]){_0x32d0a7={};if(_0x93346d[_0x0d2f('0x11')]===_0x0d2f('0xa6')){_0x32d0a7[_0x4b5933[_0x0d2f('0xa7')]]=_[_0x0d2f('0x5')](_0x298a6b[_0x0d2f('0x4')],'id');}else{_0x32d0a7[_0x4b5933[_0x0d2f('0xa7')]]=_0x298a6b[_0x0d2f('0x4')];}_0x2755aa[_0x0d2f('0x95')](_0x32d0a7);}else{_0x4cd878['where']['id']=_0x298a6b[_0x0d2f('0x4')];}}else{for(var _0x388e52=0x0;_0x388e52<_0x50d1b8[_0x0d2f('0x90')];_0x388e52++){_0x4b5933=_['find'](_0x3ec9b2,[_0x0d2f('0x9'),_0x50d1b8[_0x388e52][_0x0d2f('0x9')]]);if(_0x4b5933['field']){_0x32d0a7={};_0x32d0a7[_0x4b5933[_0x0d2f('0xa7')]]=_0x50d1b8[_0x388e52][_0x0d2f('0x4')];_0x2755aa['push'](_0x32d0a7);}else{if(!_0x4cd878['where']['id'])_0x4cd878[_0x0d2f('0x83')]['id']=[];_0x50d1b8[_0x388e52][_0x0d2f('0x4')][_0x0d2f('0xa8')](function(_0x44b099){_0x4cd878['where']['id'][_0x0d2f('0x95')](_0x44b099);});}}}if(!_[_0x0d2f('0x8f')](_0x2755aa)){_0x4cd878[_0x0d2f('0x83')]=_[_0x0d2f('0xa3')](_0x4cd878[_0x0d2f('0x83')],{'$and':{'$or':_0x2755aa}});}_0x4cd878=_['merge']({},_0x4cd878,_0x191bca[_0x0d2f('0xa9')]);if(_0x298a6b&&!_0x298a6b[_0x0d2f('0x96')]&&_0x93346d[_0x0d2f('0x11')]===_0x0d2f('0xa6')){if(_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xaa')]){_0x4cd878['include']=[{'all':!![]}];}return _0x5d81b9[_0x93346d['childModel']][_0x0d2f('0xab')](_0x4cd878)[_0x0d2f('0x8')](function(_0x6071d6){var _0x2f5a96=[];_0x6071d6[_0x0d2f('0xa8')](function(_0x5b9674){var _0x17e6df;switch(_0x5b9674[_0x0d2f('0xac')]){case'default':_0x17e6df=_[_0x0d2f('0x91')](_0x298a6b[_0x0d2f('0x4')],function(_0x38553d){return _0x38553d['id']===_0x5b9674['reportId']&&_0x38553d[_0x0d2f('0xd')]===_0x0d2f('0xad');});break;case _0x0d2f('0xae'):_0x17e6df=_['find'](_0x298a6b[_0x0d2f('0x4')],function(_0x339c71){return _0x339c71['id']===_0x5b9674['reportId']&&_0x339c71['type']===_0x0d2f('0xaf');});break;}if(_0x17e6df)_0x2f5a96[_0x0d2f('0x95')](_0x5b9674);});_0x544ebd['count']=_0x2f5a96[_0x0d2f('0x90')];_0x544ebd['rows']=_0x2f5a96;return _0x544ebd;});}else{if(!_['isEmpty'](_0x191bca[_0x0d2f('0x86')]['ids'])){_0x4cd878[_0x0d2f('0x83')]['id']=_0x4cd878[_0x0d2f('0x83')]['id']?_[_0x0d2f('0x99')](_0x4cd878[_0x0d2f('0x83')]['id'],_0x191bca[_0x0d2f('0x86')]['ids']):_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb0')];if(_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb1')]){_0x4cd878[_0x0d2f('0xa0')]=_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb1')];}}if(_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb2')]){_0x4cd878[_0x0d2f('0x83')]=_[_0x0d2f('0xa3')](_0x4cd878[_0x0d2f('0x83')],{'$and':_0x191bca['query'][_0x0d2f('0xb2')]});}return _0x5d81b9[_0x93346d[_0x0d2f('0x11')]][_0x0d2f('0xb3')]({'where':_0x4cd878[_0x0d2f('0x83')]})[_0x0d2f('0x8')](function(_0x4b6bdf){_0x544ebd[_0x0d2f('0xb3')]=_0x4b6bdf;if(_0x191bca[_0x0d2f('0x86')]['includeAll']){if(_0x93346d[_0x0d2f('0x11')]===_0x0d2f('0x1b')){_0x4cd878['include']=[{'model':_0x5d81b9[_0x0d2f('0x6c')],'as':_0x0d2f('0xb4'),'attributes':['id',_0x0d2f('0x9'),_0x0d2f('0xb5')],'required':_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb6')]?!![]:![]},{'model':_0x5d81b9[_0x0d2f('0x6c')],'as':'ThroughTags','attributes':['id',_0x0d2f('0x9'),_0x0d2f('0xb5')],'through':_0x191bca[_0x0d2f('0x86')]['tag']?{'attributes':[],'where':{'TagId':_0x191bca['query'][_0x0d2f('0xb6')]||undefined}}:{},'required':_0x191bca['query'][_0x0d2f('0xb6')]?!![]:![]}];}else{_0x4cd878[_0x0d2f('0xb7')]=[{'all':!![]}];}}return _0x5d81b9[_0x93346d[_0x0d2f('0x11')]][_0x0d2f('0xab')](_0x4cd878);})['then'](function(_0x328742){_0x544ebd['rows']=_0x328742;if(_0x464d66==='Agents'&&_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb8')]===_0x0d2f('0xb9')){var _0x969e41=[];for(var _0x4bfd3c=0x0;_0x4bfd3c<_0x544ebd[_0x0d2f('0xba')]['length'];_0x4bfd3c++){_0x969e41[_0x0d2f('0x95')](_0x339e3c('chat',_0x544ebd[_0x0d2f('0xba')][_0x4bfd3c][_0x0d2f('0xbb')]));_0x969e41[_0x0d2f('0x95')](_0x339e3c('sms',_0x544ebd['rows'][_0x4bfd3c][_0x0d2f('0xbb')]));_0x969e41['push'](_0x339e3c(_0x0d2f('0xbc'),_0x544ebd[_0x0d2f('0xba')][_0x4bfd3c]['dataValues']));_0x969e41[_0x0d2f('0x95')](_0x339e3c(_0x0d2f('0xbd'),_0x544ebd[_0x0d2f('0xba')][_0x4bfd3c]['dataValues']));_0x969e41['push'](_0x339e3c(_0x0d2f('0xbe'),_0x544ebd['rows'][_0x4bfd3c][_0x0d2f('0xbb')]));_0x969e41[_0x0d2f('0x95')](_0x339e3c(_0x0d2f('0xbf'),_0x544ebd[_0x0d2f('0xba')][_0x4bfd3c][_0x0d2f('0xbb')]));}return Promise[_0x0d2f('0x93')](_0x969e41)[_0x0d2f('0x8')](function(){return _0x544ebd;});}return _0x544ebd;});}});}}});}; \ No newline at end of file +var _0xf841=['openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','exports','filter','field','value','findAll','associatedResources','map','catch','then','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','agent','Telephones','User','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','type','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','mailaccounts','MailAccount','MailSubstatus','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','telephones','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','pauses','Pause','scheduler','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','charAt','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','ignore','union','find','model','all','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','where','pick','merge','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','DefaultReports','CustomReports','ids','customSorting','order','extraQueryConditions','count','Tags','tag','rows'];(function(_0x185e44,_0x52d7f7){var _0x229c6c=function(_0x1751b0){while(--_0x1751b0){_0x185e44['push'](_0x185e44['shift']());}};_0x229c6c(++_0x52d7f7);}(_0xf841,0x182));var _0x1f84=function(_0x4e1269,_0x197395){_0x4e1269=_0x4e1269-0x0;var _0x293b6a=_0xf841[_0x4e1269];return _0x293b6a;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require('squel');module[_0x1f84('0x0')]=function(_0x603ed){var _0x2de0aa=_0x603ed['models'];function _0x2e2e8e(_0x58e86e,_0x2cd810){return new Promise(function(_0x3f1804,_0x4cd767){if(!_0x2cd810)return _0x3f1804(null);var _0x1b8810=_0x2cd810['filter']?{[_0x2cd810[_0x1f84('0x1')][_0x1f84('0x2')]]:_0x2cd810[_0x1f84('0x1')][_0x1f84('0x3')]}:undefined;return _0x2de0aa[_0x58e86e][_0x1f84('0x4')]({'where':_0x1b8810,'raw':!![]})['then'](function(_0x273c20){_0x2cd810[_0x1f84('0x5')]=_[_0x1f84('0x6')](_0x273c20,'id');_0x3f1804(_0x2cd810);})[_0x1f84('0x7')](function(_0x2ba32e){_0x4cd767(_0x2ba32e);});});}function _0x43b859(_0x22aefc,_0x5a1e8a){return new Promise(function(_0x1edf71,_0x59e51e){var _0x349167=_0x22aefc[_0x1f84('0x1')]?{[_0x22aefc['filter'][_0x1f84('0x2')]]:_0x22aefc[_0x1f84('0x1')][_0x1f84('0x3')]}:undefined;return _0x2de0aa[_0x22aefc['model']][_0x1f84('0x4')]({'where':_0x349167,'raw':!![]})[_0x1f84('0x8')](function(_0x106387){_0x5a1e8a[_0x1f84('0x5')]=_[_0x1f84('0x6')](_0x106387,function(_0x4973eb){return _0x4973eb[_0x1f84('0x9')];});_0x1edf71(_0x5a1e8a);})[_0x1f84('0x7')](function(_0x2e80f6){_0x59e51e(_0x2e80f6);});});}function _0x5d0be8(_0x5b8e51,_0x319ddf,_0x4521c2){if(!_0x319ddf)return Promise[_0x1f84('0xa')](null);return new Promise(function(_0x2cda70,_0x4e4536){return _0x2de0aa[_0x1f84('0xb')][_0x1f84('0x4')]({'where':{'sectionId':_0x319ddf['id']},'raw':!![]})[_0x1f84('0x8')](function(_0x567788){if(_0x5b8e51[_0x1f84('0x2')]&&_0x5b8e51[_0x1f84('0x2')]!=='id'){_0x319ddf[_0x1f84('0x5')]=_[_0x1f84('0x6')](_0x567788,function(_0x5cc9b7){return _0x5cc9b7[_0x5b8e51['field']];});}else{if(_0x4521c2===_0x1f84('0xc')){_0x319ddf[_0x1f84('0x5')]=_[_0x1f84('0x6')](_0x567788,function(_0x4a1490){return{'id':_0x4a1490['resourceId'],'type':_0x4a1490['type']};});}else{_0x319ddf['associatedResources']=_[_0x1f84('0x6')](_0x567788,function(_0x74c766){return _0x74c766[_0x1f84('0xd')];});}}_0x2cda70(_0x319ddf);})[_0x1f84('0x7')](function(_0x5788f2){_0x4e4536(_0x5788f2);});});}function _0x4bf313(_0x22e6bc,_0x23e31f){var _0x55113f={'parentSections':[]};switch(_0x22e6bc[_0x1f84('0xe')]()){case _0x1f84('0xf'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x11');break;case'odbc':_0x55113f[_0x1f84('0x10')]=_0x1f84('0x12');break;case'squarerecordings':_0x55113f[_0x1f84('0x10')]='SquareRecording';_0x55113f[_0x1f84('0x13')]=[{'name':_0x1f84('0x14'),'field':_0x1f84('0x9'),'foreignKey':_0x1f84('0x15')}];break;case'projects':_0x55113f[_0x1f84('0x10')]=_0x1f84('0x16');break;case _0x1f84('0x17'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x18');_0x55113f['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x1f84('0x19')}];break;case'lists':_0x55113f[_0x1f84('0x10')]=_0x1f84('0x1a');break;case _0x1f84('0x1b'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x1c');break;case _0x1f84('0x1d'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x1e');break;case _0x1f84('0x1f'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x20');break;case _0x1f84('0x21'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x22');break;case _0x1f84('0x23'):_0x55113f['childModel']=_0x1f84('0x24');break;case _0x1f84('0x25'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x26');break;case _0x1f84('0x27'):case _0x1f84('0x28'):case _0x1f84('0x29'):_0x55113f['childModel']=_0x1f84('0x2a');break;case _0x1f84('0x2b'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x2c');break;case _0x1f84('0x2d'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x2e');break;case _0x1f84('0x2f'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x30');_0x55113f[_0x1f84('0x13')]=[{'name':_0x1f84('0x31'),'field':_0x1f84('0x9'),'foreignKey':_0x1f84('0x32'),'model':'User','filter':{'field':'role','value':[_0x1f84('0x33')]}},{'name':_0x1f84('0x34'),'field':_0x1f84('0x9'),'foreignKey':_0x1f84('0x32'),'model':_0x1f84('0x35'),'filter':{'field':_0x1f84('0x36'),'value':[_0x1f84('0x37')]}},{'name':_0x1f84('0x38'),'field':_0x1f84('0x9'),'foreignKey':_0x1f84('0x39'),'model':_0x1f84('0x3a'),'filter':{'field':'type','value':[_0x1f84('0x3b')]}},{'name':_0x1f84('0x3c'),'field':_0x1f84('0x9'),'foreignKey':_0x1f84('0x39'),'model':_0x1f84('0x3a'),'filter':{'field':_0x1f84('0x3d'),'value':[_0x1f84('0x3e')]}}];break;case'musiconholds':_0x55113f[_0x1f84('0x10')]=_0x1f84('0x3f');break;case'chanspies':_0x55113f['childModel']=_0x1f84('0x40');break;case _0x1f84('0x41'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x42');break;case _0x1f84('0x43'):_0x55113f['childModel']='Campaign';break;case _0x1f84('0x44'):_0x55113f['childModel']='MailQueue';break;case _0x1f84('0x45'):_0x55113f['childModel']=_0x1f84('0x46');break;case'mailsubstatuses':_0x55113f[_0x1f84('0x10')]=_0x1f84('0x47');break;case'openchannelqueues':_0x55113f[_0x1f84('0x10')]='OpenchannelQueue';break;case _0x1f84('0x48'):_0x55113f['childModel']=_0x1f84('0x49');break;case _0x1f84('0x4a'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x4b');break;case _0x1f84('0x4c'):_0x55113f['childModel']=_0x1f84('0x4d');break;case _0x1f84('0x4e'):_0x55113f['childModel']='WhatsappQueue';break;case _0x1f84('0x4f'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x50');break;case _0x1f84('0x51'):_0x55113f['childModel']=_0x1f84('0x52');break;case'voicequeues':case _0x1f84('0x53'):_0x55113f['childModel']=_0x1f84('0x3a');if(_0x23e31f){_0x55113f[_0x1f84('0x13')]=[{'name':_0x1f84('0x38')},{'name':_0x1f84('0x3c')}];}break;case _0x1f84('0x54'):case'agents':case _0x1f84('0x55'):_0x55113f['childModel']=_0x1f84('0x35');if(_0x23e31f){_0x55113f['parentSections']=[{'name':'Users','filter':{'field':'role','value':[_0x1f84('0x56'),_0x1f84('0x57')]},'ignore':!![]},{'name':_0x1f84('0x31')},{'name':'Telephones'}];}break;case _0x1f84('0x58'):_0x55113f[_0x1f84('0x10')]='ZendeskAccount';break;case _0x1f84('0x59'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x5a');break;case _0x1f84('0x5b'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x5c');break;case'sugarcrmaccounts':_0x55113f[_0x1f84('0x10')]=_0x1f84('0x5d');break;case _0x1f84('0x5e'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x5f');break;case _0x1f84('0x60'):_0x55113f[_0x1f84('0x10')]='ZohoAccount';break;case _0x1f84('0x61'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x35');break;case _0x1f84('0x62'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x63');break;case _0x1f84('0x64'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x65');break;case _0x1f84('0x66'):_0x55113f[_0x1f84('0x10')]='Dashboard';break;case _0x1f84('0x67'):_0x55113f[_0x1f84('0x10')]='Interval';break;case _0x1f84('0x68'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x69');break;case _0x1f84('0x6a'):_0x55113f[_0x1f84('0x10')]='Schedule';break;case'sounds':_0x55113f['childModel']='Sound';break;case _0x1f84('0x6b'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x6c');break;case _0x1f84('0x6d'):_0x55113f['childModel']=_0x1f84('0x6e');break;case _0x1f84('0x6f'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0x70');break;case'trunks':_0x55113f[_0x1f84('0x10')]=_0x1f84('0x71');break;case _0x1f84('0x72'):_0x55113f['childModel']=_0x1f84('0x73');break;case _0x1f84('0x74'):_0x55113f['childModel']='Plugin';break;case _0x1f84('0x75'):_0x55113f[_0x1f84('0x10')]=_0x1f84('0xc');_0x55113f['parentSections']=[{'name':_0x1f84('0x76'),'field':'id','foreignKey':_0x1f84('0x77')}];break;case _0x1f84('0x78'):_0x55113f[_0x1f84('0x10')]='AnalyticMetric';break;}return _0x55113f;}function _0x1a6343(_0x362016,_0x1d7cc7){var _0x35d59f=_0x362016[_0x1f84('0x79')](0x0)['toUpperCase']()+_0x362016['slice'](0x1);var _0xb65b41={'type':_0x2de0aa[_0x1f84('0x7a')][_0x1f84('0x7b')][_0x1f84('0x7c')],'raw':!![]};return new Promise(function(_0x1bf8cc,_0x4814a3){var _0x561064=squel[_0x1f84('0x7d')]()['field'](_0x1f84('0x7e')+_0x35d59f+_0x1f84('0x7f'),'id')[_0x1f84('0x2')]('ui.createdAt')[_0x1f84('0x80')](_0x1f84('0x81')+_0x362016+'_interactions','ui')['where'](_0x1f84('0x82'),_0x1d7cc7['id']);return _0x2de0aa[_0x1f84('0x83')][_0x1f84('0x84')](_0x561064[_0x1f84('0x85')](),_0xb65b41)[_0x1f84('0x8')](function(_0x5a581a){_0x1d7cc7[_0x35d59f+'OpenTabs']=_0x5a581a;_0x1bf8cc(_0x5a581a);})['catch'](function(_0xa6b510){_0x4814a3(_0xa6b510);});});}return _0x603ed[_0x1f84('0x86')](_0x1f84('0x87'),attributes,{'tableName':_0x1f84('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x11e2cb){var _0x4991be=require(_0x1f84('0x89'));var _0x2608e3={'raw':_0x11e2cb[_0x1f84('0x84')]['raw'],'where':{}};var _0xb192c3={};var _0x5a39cb={'count':0x0,'rows':[]};var _0x4408b8=_0x11e2cb['query'][_0x1f84('0x8a')];var _0x48fab9=_0x11e2cb[_0x1f84('0x84')][_0x1f84('0x8b')]||![];var _0x141f4a=_0x4bf313(_0x4408b8,_0x48fab9);if(!_0x141f4a[_0x1f84('0x10')])throw new Error(_0x1f84('0x8c')+_0x4408b8+'\x27');var _0x2374f5=[{'name':_0x4408b8}];if(!_[_0x1f84('0x8d')](_0x141f4a[_0x1f84('0x13')]))_0x2374f5=_0x141f4a['parentSections'];var _0xa39652=[];for(var _0x2301c3=0x0;_0x2301c3<_0x2374f5[_0x1f84('0x8e')];_0x2301c3++){_0xa39652[_0x1f84('0x8f')](_0x2de0aa[_0x1f84('0x90')]['find']({'where':{'userProfileId':_0x11e2cb[_0x1f84('0x91')]['id'],'name':_0x2374f5[_0x2301c3]['name']},'raw':!![]}));}return Promise['all'](_0xa39652)[_0x1f84('0x8')](function(_0x1303f6){var _0x17ed1d=_[_0x1f84('0x1')](_0x1303f6,function(_0x23d02d){return _0x23d02d?_0x23d02d:undefined;});var _0x2a11fb=_[_0x1f84('0x1')](_0x2374f5,[_0x1f84('0x92'),!![]]);var _0x2b0297=_[_0x1f84('0x8d')](_0x17ed1d)&&_['isEmpty'](_0x2a11fb)?null:_[_0x1f84('0x93')](_0x2a11fb,_0x17ed1d);if(!_0x2b0297)return null;var _0x2c683b=[];for(var _0x1bc55a=0x0;_0x1bc55a<_0x2b0297[_0x1f84('0x8e')];_0x1bc55a++){var _0x2e7b61=_[_0x1f84('0x94')](_0x2374f5,function(_0x49fe67){return _0x2b0297[_0x1bc55a]?_0x49fe67[_0x1f84('0x9')]===_0x2b0297[_0x1bc55a]['name']:null;});if(_0x2e7b61){if(_0x2b0297[_0x1bc55a][_0x1f84('0x92')]){_0x2c683b['push'](_0x2e2e8e(_0x141f4a['childModel'],_0x2b0297[_0x1bc55a]));}else{if(!_0x2b0297[_0x1bc55a]['autoAssociation']){_0x2c683b[_0x1f84('0x8f')](_0x5d0be8(_0x2e7b61,_0x2b0297[_0x1bc55a],_0x141f4a[_0x1f84('0x10')]));}else{if(_0x2e7b61[_0x1f84('0x95')]){_0x2c683b[_0x1f84('0x8f')](_0x43b859(_0x2e7b61,_0x2b0297[_0x1bc55a]));}}}}}return Promise[_0x1f84('0x96')](_0x2c683b);})['then'](function(_0x12b1e3){var _0x4a4328=_0x12b1e3;var _0x4689f2=null;if(_0x4a4328){_0x4689f2=_0x4a4328[_0x1f84('0x8e')]===0x1?_0x4a4328[0x0]:null;}if(!_0x4689f2&&!_0x4a4328)return _0x5a39cb;var _0x3d71c5=_0x2de0aa[_0x141f4a['childModel']]['rawAttributes'];_0xb192c3[_0x1f84('0x95')]=_[_0x1f84('0x97')](_0x3d71c5);_0xb192c3[_0x1f84('0x84')]=_['keys'](_0x11e2cb[_0x1f84('0x84')]);_0xb192c3[_0x1f84('0x98')]=_[_0x1f84('0x99')](_0xb192c3[_0x1f84('0x95')],_0xb192c3[_0x1f84('0x84')]);_0x2608e3[_0x1f84('0x9a')]=_['intersection'](_0xb192c3['model'],_0x4991be[_0x1f84('0x9b')](_0x11e2cb[_0x1f84('0x84')]['fields']));_0x2608e3[_0x1f84('0x9a')]=_0x2608e3[_0x1f84('0x9a')][_0x1f84('0x8e')]?_0x2608e3[_0x1f84('0x9a')]:_0xb192c3[_0x1f84('0x95')];if(!_0x11e2cb[_0x1f84('0x84')][_0x1f84('0x9c')](_0x1f84('0x9d'))){_0x2608e3[_0x1f84('0x9e')]=_0x4991be[_0x1f84('0x9e')](_0x11e2cb[_0x1f84('0x84')][_0x1f84('0x9e')]);_0x2608e3[_0x1f84('0x9f')]=_0x4991be[_0x1f84('0x9f')](_0x11e2cb['query'][_0x1f84('0x9f')]);}_0x2608e3['order']=_0x4991be[_0x1f84('0xa0')](_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xa0')]);_0x2608e3[_0x1f84('0xa1')]=_0x4991be[_0x1f84('0x98')](_[_0x1f84('0xa2')](_0x11e2cb[_0x1f84('0x84')],_0xb192c3[_0x1f84('0x98')]));if(_0x11e2cb['query'][_0x1f84('0x1')]){_0x2608e3['where']=_[_0x1f84('0xa3')](_0x2608e3['where'],{'$or':_[_0x1f84('0x6')](_0x3d71c5,function(_0x1a99ff){if(_0x1a99ff[_0x1f84('0x3d')]['key']!=='VIRTUAL'){var _0x5d67d4={};_0x5d67d4[_0x1a99ff[_0x1f84('0x2')]]={'$like':'%'+_0x11e2cb['query'][_0x1f84('0x1')]+'%'};return _0x5d67d4;}})});}var _0x579e2d=[];var _0xfa6184=null;var _0x2339e0={};if(_0x4689f2){_0xfa6184=_[_0x1f84('0x94')](_0x2374f5,[_0x1f84('0x9'),_0x4689f2[_0x1f84('0x9')]]);if(_0xfa6184[_0x1f84('0x2')]){_0x2339e0={};if(_0x141f4a[_0x1f84('0x10')]===_0x1f84('0xc')){_0x2339e0[_0xfa6184[_0x1f84('0xa4')]]=_[_0x1f84('0x6')](_0x4689f2['associatedResources'],'id');}else{_0x2339e0[_0xfa6184[_0x1f84('0xa4')]]=_0x4689f2[_0x1f84('0x5')];}_0x579e2d[_0x1f84('0x8f')](_0x2339e0);}else{_0x2608e3[_0x1f84('0xa1')]['id']=_0x4689f2['associatedResources'];}}else{for(var _0x4630b9=0x0;_0x4630b9<_0x4a4328[_0x1f84('0x8e')];_0x4630b9++){_0xfa6184=_[_0x1f84('0x94')](_0x2374f5,[_0x1f84('0x9'),_0x4a4328[_0x4630b9][_0x1f84('0x9')]]);if(_0xfa6184[_0x1f84('0x2')]){_0x2339e0={};_0x2339e0[_0xfa6184[_0x1f84('0xa4')]]=_0x4a4328[_0x4630b9][_0x1f84('0x5')];_0x579e2d['push'](_0x2339e0);}else{if(!_0x2608e3[_0x1f84('0xa1')]['id'])_0x2608e3[_0x1f84('0xa1')]['id']=[];_0x4a4328[_0x4630b9][_0x1f84('0x5')][_0x1f84('0xa5')](function(_0x35b7a3){_0x2608e3[_0x1f84('0xa1')]['id']['push'](_0x35b7a3);});}}}if(!_[_0x1f84('0x8d')](_0x579e2d)){_0x2608e3[_0x1f84('0xa1')]=_[_0x1f84('0xa3')](_0x2608e3[_0x1f84('0xa1')],{'$and':{'$or':_0x579e2d}});}_0x2608e3=_[_0x1f84('0xa3')]({},_0x2608e3,_0x11e2cb[_0x1f84('0xa6')]);if(_0x4689f2&&!_0x4689f2[_0x1f84('0xa7')]&&_0x141f4a[_0x1f84('0x10')]===_0x1f84('0xc')){if(_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xa8')]){_0x2608e3[_0x1f84('0xa9')]=[{'all':!![]}];}return _0x2de0aa[_0x141f4a[_0x1f84('0x10')]]['findAll'](_0x2608e3)[_0x1f84('0x8')](function(_0x1dd278){var _0x4ee03d=[];_0x1dd278[_0x1f84('0xa5')](function(_0x41901d){var _0x5ca0b9;switch(_0x41901d[_0x1f84('0xaa')]){case'default':_0x5ca0b9=_[_0x1f84('0x94')](_0x4689f2['associatedResources'],function(_0x896686){return _0x896686['id']===_0x41901d[_0x1f84('0x77')]&&_0x896686[_0x1f84('0x3d')]===_0x1f84('0xab');});break;case'custom':_0x5ca0b9=_[_0x1f84('0x94')](_0x4689f2[_0x1f84('0x5')],function(_0x4677fc){return _0x4677fc['id']===_0x41901d[_0x1f84('0x77')]&&_0x4677fc[_0x1f84('0x3d')]===_0x1f84('0xac');});break;}if(_0x5ca0b9)_0x4ee03d[_0x1f84('0x8f')](_0x41901d);});_0x5a39cb['count']=_0x4ee03d[_0x1f84('0x8e')];_0x5a39cb['rows']=_0x4ee03d;return _0x5a39cb;});}else{if(!_['isEmpty'](_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xad')])){_0x2608e3[_0x1f84('0xa1')]['id']=_0x2608e3[_0x1f84('0xa1')]['id']?_[_0x1f84('0x99')](_0x2608e3[_0x1f84('0xa1')]['id'],_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xad')]):_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xad')];if(_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xae')]){_0x2608e3[_0x1f84('0xaf')]=_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xae')];}}if(_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xb0')]){_0x2608e3[_0x1f84('0xa1')]=_['merge'](_0x2608e3[_0x1f84('0xa1')],{'$and':_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xb0')]});}return _0x2de0aa[_0x141f4a[_0x1f84('0x10')]][_0x1f84('0xb1')]({'where':_0x2608e3[_0x1f84('0xa1')]})['then'](function(_0x3e03ad){_0x5a39cb[_0x1f84('0xb1')]=_0x3e03ad;if(_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xa8')]){if(_0x141f4a[_0x1f84('0x10')]===_0x1f84('0x18')){_0x2608e3['include']=[{'model':_0x2de0aa[_0x1f84('0x6c')],'as':_0x1f84('0xb2'),'attributes':['id','name','color'],'required':_0x11e2cb['query']['tag']?!![]:![]},{'model':_0x2de0aa['Tag'],'as':'ThroughTags','attributes':['id',_0x1f84('0x9'),'color'],'through':_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xb3')]?{'attributes':[],'where':{'TagId':_0x11e2cb['query'][_0x1f84('0xb3')]||undefined}}:{},'required':_0x11e2cb[_0x1f84('0x84')][_0x1f84('0xb3')]?!![]:![]}];}else{_0x2608e3[_0x1f84('0xa9')]=[{'all':!![]}];}}return _0x2de0aa[_0x141f4a[_0x1f84('0x10')]][_0x1f84('0x4')](_0x2608e3);})[_0x1f84('0x8')](function(_0x4d7339){_0x5a39cb[_0x1f84('0xb4')]=_0x4d7339;if(_0x4408b8===_0x1f84('0x31')&&_0x11e2cb['query'][_0x1f84('0xb5')]===_0x1f84('0xb6')){var _0x5c8de5=[];for(var _0x3fcfef=0x0;_0x3fcfef<_0x5a39cb[_0x1f84('0xb4')][_0x1f84('0x8e')];_0x3fcfef++){_0x5c8de5[_0x1f84('0x8f')](_0x1a6343('chat',_0x5a39cb['rows'][_0x3fcfef][_0x1f84('0xb7')]));_0x5c8de5[_0x1f84('0x8f')](_0x1a6343(_0x1f84('0xb8'),_0x5a39cb['rows'][_0x3fcfef][_0x1f84('0xb7')]));_0x5c8de5[_0x1f84('0x8f')](_0x1a6343(_0x1f84('0xb9'),_0x5a39cb['rows'][_0x3fcfef][_0x1f84('0xb7')]));_0x5c8de5[_0x1f84('0x8f')](_0x1a6343(_0x1f84('0xba'),_0x5a39cb['rows'][_0x3fcfef][_0x1f84('0xb7')]));_0x5c8de5['push'](_0x1a6343(_0x1f84('0xbb'),_0x5a39cb[_0x1f84('0xb4')][_0x3fcfef]['dataValues']));_0x5c8de5[_0x1f84('0x8f')](_0x1a6343(_0x1f84('0xbc'),_0x5a39cb[_0x1f84('0xb4')][_0x3fcfef][_0x1f84('0xb7')]));}return Promise['all'](_0x5c8de5)[_0x1f84('0x8')](function(){return _0x5a39cb;});}return _0x5a39cb;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 659c425..caa57ad 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcedf=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','http','defaults','socket.io-emitter','redis'];(function(_0x3a9c5c,_0x5e0d92){var _0x20d55e=function(_0x100aad){while(--_0x100aad){_0x3a9c5c['push'](_0x3a9c5c['shift']());}};_0x20d55e(++_0x5e0d92);}(_0xcedf,0x1b6));var _0xfced=function(_0x1bab76,_0x4ce891){_0x1bab76=_0x1bab76-0x0;var _0x3cb893=_0xcedf[_0x1bab76];return _0x3cb893;};'use strict';var _=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var moment=require(_0xfced('0x2'));var BPromise=require(_0xfced('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfced('0x4'));var db=require(_0xfced('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfced('0x6'));var config=require('../../config/environment');var jayson=require(_0xfced('0x7'));var client=jayson['client'][_0xfced('0x8')]({'port':0x232a});config['redis']=_[_0xfced('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfced('0xa'))(new Redis(config[_0xfced('0xb')]));require(_0xfced('0xc'))[_0xfced('0xd')](socket);function respondWithRpcPromise(_0x4cee14,_0x3dacd0,_0x3487bd){return new BPromise(function(_0x35098c,_0x472717){return client[_0xfced('0xe')](_0x4cee14,_0x3487bd)[_0xfced('0xf')](function(_0x30aaba){logger[_0xfced('0x10')](_0xfced('0x11'),_0x3dacd0,'request\x20sent');logger[_0xfced('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x3dacd0,_0xfced('0x13'),JSON[_0xfced('0x14')](_0x30aaba));if(_0x30aaba[_0xfced('0x15')]){if(_0x30aaba[_0xfced('0x15')]['code']===0x1f4){logger[_0xfced('0x15')](_0xfced('0x11'),_0x3dacd0,_0x30aaba[_0xfced('0x15')][_0xfced('0x16')]);return _0x472717(_0x30aaba[_0xfced('0x15')][_0xfced('0x16')]);}logger[_0xfced('0x15')](_0xfced('0x11'),_0x3dacd0,_0x30aaba['error'][_0xfced('0x16')]);return _0x35098c(_0x30aaba['error'][_0xfced('0x16')]);}else{logger[_0xfced('0x10')](_0xfced('0x11'),_0x3dacd0,_0xfced('0x13'));_0x35098c(_0x30aaba[_0xfced('0x17')][_0xfced('0x16')]);}})[_0xfced('0x18')](function(_0x31ea41){logger[_0xfced('0x15')](_0xfced('0x11'),_0x3dacd0,_0x31ea41);_0x472717(_0x31ea41);});});} \ No newline at end of file +var _0x5f6f=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x3108d9,_0xf08d6){_0x3108d9=_0x3108d9-0x0;var _0x1455e6=_0x5f6f[_0x3108d9];return _0x1455e6;};'use strict';var _=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var moment=require(_0xf5f6('0x2'));var BPromise=require(_0xf5f6('0x3'));var rs=require(_0xf5f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5f6('0x5'))['db'];var utils=require(_0xf5f6('0x6'));var logger=require(_0xf5f6('0x7'))('rpc');var config=require(_0xf5f6('0x8'));var jayson=require(_0xf5f6('0x9'));var client=jayson[_0xf5f6('0xa')][_0xf5f6('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf5f6('0xc')],{'host':_0xf5f6('0xd'),'port':0x18eb});var socket=require(_0xf5f6('0xe'))(new Redis(config[_0xf5f6('0xc')]));require(_0xf5f6('0xf'))[_0xf5f6('0x10')](socket);function respondWithRpcPromise(_0x57fc19,_0x5ba0f5,_0x988c4a){return new BPromise(function(_0x369b18,_0x491c14){return client[_0xf5f6('0x11')](_0x57fc19,_0x988c4a)[_0xf5f6('0x12')](function(_0xeb94fb){logger[_0xf5f6('0x13')](_0xf5f6('0x14'),_0x5ba0f5,'request\x20sent');logger[_0xf5f6('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x5ba0f5,_0xf5f6('0x16'),JSON[_0xf5f6('0x17')](_0xeb94fb));if(_0xeb94fb[_0xf5f6('0x18')]){if(_0xeb94fb[_0xf5f6('0x18')]['code']===0x1f4){logger[_0xf5f6('0x18')](_0xf5f6('0x14'),_0x5ba0f5,_0xeb94fb[_0xf5f6('0x18')][_0xf5f6('0x19')]);return _0x491c14(_0xeb94fb['error'][_0xf5f6('0x19')]);}logger[_0xf5f6('0x18')](_0xf5f6('0x14'),_0x5ba0f5,_0xeb94fb[_0xf5f6('0x18')]['message']);return _0x369b18(_0xeb94fb['error'][_0xf5f6('0x19')]);}else{logger['info'](_0xf5f6('0x14'),_0x5ba0f5,'request\x20sent');_0x369b18(_0xeb94fb[_0xf5f6('0x1a')][_0xf5f6('0x19')]);}})[_0xf5f6('0x1b')](function(_0x301e2a){logger[_0xf5f6('0x18')](_0xf5f6('0x14'),_0x5ba0f5,_0x301e2a);_0x491c14(_0x301e2a);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e67e69e..f7199b0 100644 --- a/server/api/userProfile/userProfile.socket.js +++ b/server/api/userProfile/userProfile.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x982a=['userProfile:','./userProfile.events','save','update','emit','removeListener','length'];(function(_0x1c81af,_0x269e00){var _0x5ab42b=function(_0x47fca7){while(--_0x47fca7){_0x1c81af['push'](_0x1c81af['shift']());}};_0x5ab42b(++_0x269e00);}(_0x982a,0x135));var _0xa982=function(_0x562219,_0x19e393){_0x562219=_0x562219-0x0;var _0x2cc355=_0x982a[_0x562219];return _0x2cc355;};'use strict';var UserProfileEvents=require(_0xa982('0x0'));var events=[_0xa982('0x1'),'remove',_0xa982('0x2')];function createListener(_0x35f7b1,_0x22a285){return function(_0xfc6ff4){_0x22a285[_0xa982('0x3')](_0x35f7b1,_0xfc6ff4);};}function removeListener(_0x46eff4,_0x223cc3){return function(){UserProfileEvents[_0xa982('0x4')](_0x46eff4,_0x223cc3);};}exports['register']=function(_0x14d7bf){for(var _0x33bd0b=0x0,_0x48c68a=events[_0xa982('0x5')];_0x33bd0b<_0x48c68a;_0x33bd0b++){var _0x114a45=events[_0x33bd0b];var _0x4f2872=createListener(_0xa982('0x6')+_0x114a45,_0x14d7bf);UserProfileEvents['on'](_0x114a45,_0x4f2872);}}; \ No newline at end of file +var _0xd4b2=['emit','removeListener','length','userProfile:','./userProfile.events','save','remove'];(function(_0x2d2153,_0x4509d6){var _0x20299e=function(_0x5cf09f){while(--_0x5cf09f){_0x2d2153['push'](_0x2d2153['shift']());}};_0x20299e(++_0x4509d6);}(_0xd4b2,0x19a));var _0x2d4b=function(_0x565569,_0x5c0375){_0x565569=_0x565569-0x0;var _0x1ac5da=_0xd4b2[_0x565569];return _0x1ac5da;};'use strict';var UserProfileEvents=require(_0x2d4b('0x0'));var events=[_0x2d4b('0x1'),_0x2d4b('0x2'),'update'];function createListener(_0x1d4bc4,_0x249732){return function(_0xb4430f){_0x249732[_0x2d4b('0x3')](_0x1d4bc4,_0xb4430f);};}function removeListener(_0x450fb3,_0x466c2a){return function(){UserProfileEvents[_0x2d4b('0x4')](_0x450fb3,_0x466c2a);};}exports['register']=function(_0x401bc1){for(var _0x52ad68=0x0,_0x332911=events[_0x2d4b('0x5')];_0x52ad68<_0x332911;_0x52ad68++){var _0x2ff4d5=events[_0x52ad68];var _0x4aafd4=createListener(_0x2d4b('0x6')+_0x2ff4d5,_0x401bc1);UserProfileEvents['on'](_0x2ff4d5,_0x4aafd4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 9b6e192..a843c22 100644 --- a/server/api/userProfileResource/index.js +++ b/server/api/userProfileResource/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc5a=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x45b865,_0xdbd681){var _0x8dba10=function(_0x3be43d){while(--_0x3be43d){_0x45b865['push'](_0x45b865['shift']());}};_0x8dba10(++_0xdbd681);}(_0xbc5a,0x66));var _0xabc5=function(_0x2f30f0,_0x56aa74){_0x2f30f0=_0x2f30f0-0x0;var _0x56a36a=_0xbc5a[_0x2f30f0];return _0x56a36a;};'use strict';var multer=require('multer');var util=require(_0xabc5('0x0'));var path=require(_0xabc5('0x1'));var timeout=require(_0xabc5('0x2'));var express=require(_0xabc5('0x3'));var router=express[_0xabc5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xabc5('0x5'));var interaction=require(_0xabc5('0x6'));var config=require(_0xabc5('0x7'));var controller=require(_0xabc5('0x8'));router[_0xabc5('0x9')]('/',auth[_0xabc5('0xa')](),controller[_0xabc5('0xb')]);router[_0xabc5('0x9')](_0xabc5('0xc'),auth[_0xabc5('0xa')](),controller['describe']);router[_0xabc5('0x9')](_0xabc5('0xd'),auth[_0xabc5('0xa')](),controller[_0xabc5('0xe')]);router['post']('/',auth[_0xabc5('0xa')](),controller[_0xabc5('0xf')]);router[_0xabc5('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xabc5('0xd'),auth[_0xabc5('0xa')](),controller['destroy']);module[_0xabc5('0x11')]=router; \ No newline at end of file +var _0x832c=['/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x40eb76,_0x5b3287){var _0x5964e9=function(_0x323350){while(--_0x323350){_0x40eb76['push'](_0x40eb76['shift']());}};_0x5964e9(++_0x5b3287);}(_0x832c,0x164));var _0xc832=function(_0x407f59,_0x5720d3){_0x407f59=_0x407f59-0x0;var _0x2f839a=_0x832c[_0x407f59];return _0x2f839a;};'use strict';var multer=require(_0xc832('0x0'));var util=require(_0xc832('0x1'));var path=require(_0xc832('0x2'));var timeout=require(_0xc832('0x3'));var express=require(_0xc832('0x4'));var router=express[_0xc832('0x5')]();var fs_extra=require(_0xc832('0x6'));var auth=require(_0xc832('0x7'));var interaction=require(_0xc832('0x8'));var config=require(_0xc832('0x9'));var controller=require('./userProfileResource.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc832('0xa')]);router[_0xc832('0xb')](_0xc832('0xc'),auth[_0xc832('0xd')](),controller['describe']);router['get'](_0xc832('0xe'),auth['isAuthenticated'](),controller[_0xc832('0xf')]);router[_0xc832('0x10')]('/',auth[_0xc832('0xd')](),controller[_0xc832('0x11')]);router[_0xc832('0x12')](_0xc832('0xe'),auth[_0xc832('0xd')](),controller[_0xc832('0x13')]);router[_0xc832('0x14')](_0xc832('0xe'),auth[_0xc832('0xd')](),controller[_0xc832('0x15')]);module[_0xc832('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 86e334c..94bb20b 100644 --- a/server/api/userProfileResource/userProfileResource.attributes.js +++ b/server/api/userProfileResource/userProfileResource.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ca3=['sequelize','exports','STRING','INTEGER'];(function(_0x29da8f,_0x11c0db){var _0x3da1cd=function(_0x4910a0){while(--_0x4910a0){_0x29da8f['push'](_0x29da8f['shift']());}};_0x3da1cd(++_0x11c0db);}(_0x8ca3,0x150));var _0x38ca=function(_0x568f96,_0x32d489){_0x568f96=_0x568f96-0x0;var _0x5a053a=_0x8ca3[_0x568f96];return _0x5a053a;};'use strict';var Sequelize=require(_0x38ca('0x0'));module[_0x38ca('0x1')]={'name':{'type':Sequelize[_0x38ca('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x38ca('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x38ca('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe760=['exports','STRING','INTEGER','sequelize'];(function(_0x292e87,_0x9b2eb5){var _0x5186f6=function(_0x2eb5b6){while(--_0x2eb5b6){_0x292e87['push'](_0x292e87['shift']());}};_0x5186f6(++_0x9b2eb5);}(_0xe760,0x133));var _0x0e76=function(_0x5aa39e,_0x5ca516){_0x5aa39e=_0x5aa39e-0x0;var _0x2319a5=_0xe760[_0x5aa39e];return _0x2319a5;};'use strict';var Sequelize=require(_0x0e76('0x0'));module[_0x0e76('0x1')]={'name':{'type':Sequelize[_0x0e76('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x0e76('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 2f0afc8..e93d660 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','UserProfileResource','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x5e5d41,_0x208901){var _0xbb31ba=function(_0x699284){while(--_0x699284){_0x5e5d41['push'](_0x5e5d41['shift']());}};_0xbb31ba(++_0x208901);}(_0xafc4,0x69));var _0x4afc=function(_0x4d6510,_0x3f71fd){_0x4d6510=_0x4d6510-0x0;var _0xc62d5c=_0xafc4[_0x4d6510];return _0xc62d5c;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['UserProfileResource'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['UserProfileResource']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file +var _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfileResource','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0xbcb6,_0x8e00a9){var _0x58899b=function(_0x35e0c4){while(--_0x35e0c4){_0xbcb6['push'](_0xbcb6['shift']());}};_0x58899b(++_0x8e00a9);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['UserProfileResource']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['UserProfileResource']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 8e0b59c..d3778da 100644 --- a/server/api/userProfileResource/userProfileResource.model.js +++ b/server/api/userProfileResource/userProfileResource.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5651=['moment','bluebird','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5651,0x6d));var _0x1565=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x5651[_0x28578d];return _0x524826;};'use strict';var _=require(_0x1565('0x0'));var util=require('util');var logger=require(_0x1565('0x1'))(_0x1565('0x2'));var moment=require(_0x1565('0x3'));var BPromise=require(_0x1565('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1565('0x5'));var config=require(_0x1565('0x6'));var attributes=require(_0x1565('0x7'));module[_0x1565('0x8')]=function(_0x12a1cc,_0x55458d){return _0x12a1cc[_0x1565('0x9')](_0x1565('0xa'),attributes,{'tableName':_0x1565('0xb'),'paranoid':![],'indexes':[{'name':_0x1565('0xc'),'fields':[_0x1565('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e1b=['compositeIndex','resourceId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x5e1b,0xf2));var _0xb5e1=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5e1b[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xb5e1('0x0'));var util=require(_0xb5e1('0x1'));var logger=require(_0xb5e1('0x2'))(_0xb5e1('0x3'));var moment=require('moment');var BPromise=require(_0xb5e1('0x4'));var rp=require(_0xb5e1('0x5'));var fs=require('fs');var path=require(_0xb5e1('0x6'));var rimraf=require(_0xb5e1('0x7'));var config=require(_0xb5e1('0x8'));var attributes=require(_0xb5e1('0x9'));module[_0xb5e1('0xa')]=function(_0x26a595,_0x5085ef){return _0x26a595[_0xb5e1('0xb')](_0xb5e1('0xc'),attributes,{'tableName':_0xb5e1('0xd'),'paranoid':![],'indexes':[{'name':_0xb5e1('0xe'),'fields':[_0xb5e1('0xf'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index dbd1b24..1281aee 100644 --- a/server/api/userProfileResource/userProfileResource.rpc.js +++ b/server/api/userProfileResource/userProfileResource.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafb3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x55c947,_0x5e20a8){var _0x2556b3=function(_0x239288){while(--_0x239288){_0x55c947['push'](_0x55c947['shift']());}};_0x2556b3(++_0x5e20a8);}(_0xafb3,0xa3));var _0x3afb=function(_0x48c249,_0xedd7){_0x48c249=_0x48c249-0x0;var _0x665d95=_0xafb3[_0x48c249];return _0x665d95;};'use strict';var _=require(_0x3afb('0x0'));var util=require(_0x3afb('0x1'));var moment=require(_0x3afb('0x2'));var BPromise=require('bluebird');var rs=require(_0x3afb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3afb('0x4'))['db'];var utils=require(_0x3afb('0x5'));var logger=require(_0x3afb('0x6'))('rpc');var config=require(_0x3afb('0x7'));var jayson=require(_0x3afb('0x8'));var client=jayson['client'][_0x3afb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15adb2,_0x25d8df,_0x28bcb6){return new BPromise(function(_0x465a01,_0x8960a5){return client[_0x3afb('0xa')](_0x15adb2,_0x28bcb6)['then'](function(_0x4f860a){logger[_0x3afb('0xb')](_0x3afb('0xc'),_0x25d8df,_0x3afb('0xd'));logger[_0x3afb('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x25d8df,_0x3afb('0xd'),JSON[_0x3afb('0xf')](_0x4f860a));if(_0x4f860a['error']){if(_0x4f860a[_0x3afb('0x10')][_0x3afb('0x11')]===0x1f4){logger['error'](_0x3afb('0xc'),_0x25d8df,_0x4f860a['error'][_0x3afb('0x12')]);return _0x8960a5(_0x4f860a[_0x3afb('0x10')]['message']);}logger[_0x3afb('0x10')](_0x3afb('0xc'),_0x25d8df,_0x4f860a[_0x3afb('0x10')][_0x3afb('0x12')]);return _0x465a01(_0x4f860a[_0x3afb('0x10')][_0x3afb('0x12')]);}else{logger[_0x3afb('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x25d8df,_0x3afb('0xd'));_0x465a01(_0x4f860a[_0x3afb('0x13')][_0x3afb('0x12')]);}})[_0x3afb('0x14')](function(_0x5da6d6){logger[_0x3afb('0x10')](_0x3afb('0xc'),_0x25d8df,_0x5da6d6);_0x8960a5(_0x5da6d6);});});} \ No newline at end of file +var _0xdfaa=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','rpc','jayson/promise','client','http','request','then'];(function(_0xb74c89,_0x246040){var _0xe4ccef=function(_0x12b652){while(--_0x12b652){_0xb74c89['push'](_0xb74c89['shift']());}};_0xe4ccef(++_0x246040);}(_0xdfaa,0xa5));var _0xadfa=function(_0x3e1d96,_0x9d06b){_0x3e1d96=_0x3e1d96-0x0;var _0x1f8a43=_0xdfaa[_0x3e1d96];return _0x1f8a43;};'use strict';var _=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var moment=require(_0xadfa('0x2'));var BPromise=require(_0xadfa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadfa('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xadfa('0x5'));var config=require('../../config/environment');var jayson=require(_0xadfa('0x6'));var client=jayson[_0xadfa('0x7')][_0xadfa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x512702,_0x168806,_0x2da7eb){return new BPromise(function(_0x47904b,_0x396c91){return client[_0xadfa('0x9')](_0x512702,_0x2da7eb)[_0xadfa('0xa')](function(_0x3d4b6f){logger[_0xadfa('0xb')](_0xadfa('0xc'),_0x168806,_0xadfa('0xd'));logger[_0xadfa('0xe')](_0xadfa('0xf'),_0x168806,_0xadfa('0xd'),JSON[_0xadfa('0x10')](_0x3d4b6f));if(_0x3d4b6f['error']){if(_0x3d4b6f[_0xadfa('0x11')][_0xadfa('0x12')]===0x1f4){logger[_0xadfa('0x11')](_0xadfa('0xc'),_0x168806,_0x3d4b6f['error']['message']);return _0x396c91(_0x3d4b6f[_0xadfa('0x11')][_0xadfa('0x13')]);}logger[_0xadfa('0x11')](_0xadfa('0xc'),_0x168806,_0x3d4b6f['error'][_0xadfa('0x13')]);return _0x47904b(_0x3d4b6f[_0xadfa('0x11')][_0xadfa('0x13')]);}else{logger[_0xadfa('0xb')](_0xadfa('0xc'),_0x168806,'request\x20sent');_0x47904b(_0x3d4b6f[_0xadfa('0x14')][_0xadfa('0x13')]);}})[_0xadfa('0x15')](function(_0x4188c9){logger[_0xadfa('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x168806,_0x4188c9);_0x396c91(_0x4188c9);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 648fac1..6db1406 100644 --- a/server/api/userProfileSection/index.js +++ b/server/api/userProfileSection/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x109d=['create','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','/:id','show','post'];(function(_0x173d33,_0xb14c60){var _0x4a55dd=function(_0x3e6c03){while(--_0x3e6c03){_0x173d33['push'](_0x173d33['shift']());}};_0x4a55dd(++_0xb14c60);}(_0x109d,0x122));var _0xd109=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x109d[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0xd109('0x0'));var util=require(_0xd109('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd109('0x2')]();var fs_extra=require(_0xd109('0x3'));var auth=require(_0xd109('0x4'));var interaction=require(_0xd109('0x5'));var config=require(_0xd109('0x6'));var controller=require(_0xd109('0x7'));router[_0xd109('0x8')]('/',auth[_0xd109('0x9')](),controller['index']);router['get'](_0xd109('0xa'),auth[_0xd109('0x9')](),controller['describe']);router[_0xd109('0x8')](_0xd109('0xb'),auth['isAuthenticated'](),controller[_0xd109('0xc')]);router[_0xd109('0xd')]('/',auth['isAuthenticated'](),controller[_0xd109('0xe')]);router['put'](_0xd109('0xb'),auth[_0xd109('0x9')](),controller[_0xd109('0xf')]);router[_0xd109('0x10')](_0xd109('0xb'),auth[_0xd109('0x9')](),controller[_0xd109('0x11')]);module[_0xd109('0x12')]=router; \ No newline at end of file +var _0xeeea=['put','/:id','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','show','post'];(function(_0x1a9516,_0x1fe6f7){var _0x18dcc7=function(_0x2bc9db){while(--_0x2bc9db){_0x1a9516['push'](_0x1a9516['shift']());}};_0x18dcc7(++_0x1fe6f7);}(_0xeeea,0x69));var _0xaeee=function(_0x46e69c,_0x510247){_0x46e69c=_0x46e69c-0x0;var _0x243733=_0xeeea[_0x46e69c];return _0x243733;};'use strict';var multer=require(_0xaeee('0x0'));var util=require(_0xaeee('0x1'));var path=require(_0xaeee('0x2'));var timeout=require('connect-timeout');var express=require(_0xaeee('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaeee('0x4'));var interaction=require(_0xaeee('0x5'));var config=require(_0xaeee('0x6'));var controller=require(_0xaeee('0x7'));router[_0xaeee('0x8')]('/',auth['isAuthenticated'](),controller[_0xaeee('0x9')]);router[_0xaeee('0x8')](_0xaeee('0xa'),auth[_0xaeee('0xb')](),controller[_0xaeee('0xc')]);router[_0xaeee('0x8')]('/:id',auth[_0xaeee('0xb')](),controller[_0xaeee('0xd')]);router[_0xaeee('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaeee('0xf')](_0xaeee('0x10'),auth[_0xaeee('0xb')](),controller[_0xaeee('0x11')]);router[_0xaeee('0x12')](_0xaeee('0x10'),auth[_0xaeee('0xb')](),controller['destroy']);module[_0xaeee('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 289f3e5..421dfbb 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97c1=['exports','STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x39eb5f,_0x45eafb){var _0x18cb99=function(_0x5c9399){while(--_0x5c9399){_0x39eb5f['push'](_0x39eb5f['shift']());}};_0x18cb99(++_0x45eafb);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x197c('0x0'));module[_0x197c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x197c('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x197c('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x197c('0x2')],'set':function(_0x26833e){this[_0x197c('0x4')](_0x197c('0x5'),_0x26833e?_0x26833e['join'](''):[]);},'get':function(){return this['getDataValue'](_0x197c('0x5'))?this[_0x197c('0x6')](_0x197c('0x5'))[_0x197c('0x7')](''):[];}}}; \ No newline at end of file +var _0x7d25=['INTEGER','BOOLEAN','getDataValue','crudPermissions','split','exports','STRING'];(function(_0x11de83,_0x49e1c1){var _0x45bdb0=function(_0x51041e){while(--_0x51041e){_0x11de83['push'](_0x11de83['shift']());}};_0x45bdb0(++_0x49e1c1);}(_0x7d25,0x8a));var _0x57d2=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x7d25[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require('sequelize');module[_0x57d2('0x0')]={'name':{'type':Sequelize[_0x57d2('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x57d2('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x57d2('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x57d2('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x57d2('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x57d2('0x1')],'set':function(_0x5c1baa){this['setDataValue']('crudPermissions',_0x5c1baa?_0x5c1baa['join'](''):[]);},'get':function(){return this[_0x57d2('0x4')]('crudPermissions')?this[_0x57d2('0x4')](_0x57d2('0x5'))[_0x57d2('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c8607de..9f126f7 100644 --- a/server/api/userProfileSection/userProfileSection.controller.js +++ b/server/api/userProfileSection/userProfileSection.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd08b=['error','name','send','index','UserProfileSection','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','rows','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','save','update','then','destroy','sendStatus'];(function(_0x58ca82,_0x4f469c){var _0x477987=function(_0x89cf00){while(--_0x89cf00){_0x58ca82['push'](_0x58ca82['shift']());}};_0x477987(++_0x4f469c);}(_0xd08b,0x1e4));var _0xbd08=function(_0x43139e,_0x762629){_0x43139e=_0x43139e-0x0;var _0x2bc838=_0xd08b[_0x43139e];return _0x2bc838;};'use strict';var emlformat=require(_0xbd08('0x0'));var rimraf=require(_0xbd08('0x1'));var zipdir=require(_0xbd08('0x2'));var jsonpatch=require(_0xbd08('0x3'));var rp=require(_0xbd08('0x4'));var moment=require(_0xbd08('0x5'));var BPromise=require(_0xbd08('0x6'));var Mustache=require(_0xbd08('0x7'));var util=require(_0xbd08('0x8'));var path=require(_0xbd08('0x9'));var sox=require(_0xbd08('0xa'));var csv=require(_0xbd08('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd08('0xc'));var _=require(_0xbd08('0xd'));var squel=require(_0xbd08('0xe'));var crypto=require(_0xbd08('0xf'));var jsforce=require(_0xbd08('0x10'));var deskjs=require(_0xbd08('0x11'));var toCsv=require(_0xbd08('0xb'));var querystring=require(_0xbd08('0x12'));var Papa=require(_0xbd08('0x13'));var Redis=require('ioredis');var authService=require(_0xbd08('0x14'));var qs=require(_0xbd08('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd08('0x16'));var logger=require(_0xbd08('0x17'))('api');var utils=require(_0xbd08('0x18'));var config=require(_0xbd08('0x19'));var licenseUtil=require(_0xbd08('0x1a'));var db=require(_0xbd08('0x1b'))['db'];function respondWithStatusCode(_0x56b368,_0x3c0563){_0x3c0563=_0x3c0563||0xcc;return function(_0x304341){if(_0x304341){return _0x56b368['sendStatus'](_0x3c0563);}return _0x56b368['status'](_0x3c0563)[_0xbd08('0x1c')]();};}function respondWithResult(_0x2d820b,_0x56f97b){_0x56f97b=_0x56f97b||0xc8;return function(_0x172e18){if(_0x172e18){return _0x2d820b[_0xbd08('0x1d')](_0x56f97b)[_0xbd08('0x1e')](_0x172e18);}};}function respondWithFilteredResult(_0x12334f,_0x430e4b){return function(_0x478162){if(_0x478162){var _0x46592e=typeof _0x430e4b[_0xbd08('0x1f')]===_0xbd08('0x20')&&typeof _0x430e4b['limit']==='undefined';var _0xc77f1c=_0x478162[_0xbd08('0x21')];var _0x2f0dde=_0x46592e?0x0:_0x430e4b['offset'];var _0x4e80d5=_0x46592e?_0x478162[_0xbd08('0x21')]:_0x430e4b[_0xbd08('0x1f')]+_0x430e4b[_0xbd08('0x22')];var _0x3c2b30;if(_0x4e80d5>=_0xc77f1c){_0x4e80d5=_0xc77f1c;_0x3c2b30=0xc8;}else{_0x3c2b30=0xce;}_0x12334f[_0xbd08('0x1d')](_0x3c2b30);return _0x12334f[_0xbd08('0x23')]('Content-Range',_0x2f0dde+'-'+_0x4e80d5+'/'+_0xc77f1c)[_0xbd08('0x1e')](_0x478162);}return null;};}function patchUpdates(_0x20c687){return function(_0x340ff5){try{jsonpatch['apply'](_0x340ff5,_0x20c687,!![]);}catch(_0x1ca2dd){return BPromise['reject'](_0x1ca2dd);}return _0x340ff5[_0xbd08('0x24')]();};}function saveUpdates(_0xc7ba03,_0x133389){return function(_0x319b81){if(_0x319b81){return _0x319b81[_0xbd08('0x25')](_0xc7ba03)[_0xbd08('0x26')](function(_0x5903db){return _0x5903db;});}return null;};}function removeEntity(_0x1a084b,_0x5db7b6){return function(_0x1d9ee8){if(_0x1d9ee8){return _0x1d9ee8[_0xbd08('0x27')]()[_0xbd08('0x26')](function(){_0x1a084b[_0xbd08('0x1d')](0xcc)[_0xbd08('0x1c')]();});}};}function handleEntityNotFound(_0x3c4e63,_0xa8a771){return function(_0x4810bd){if(!_0x4810bd){_0x3c4e63[_0xbd08('0x28')](0x194);}return _0x4810bd;};}function handleError(_0x5525a2,_0x30df5b){_0x30df5b=_0x30df5b||0x1f4;return function(_0x24a714){logger[_0xbd08('0x29')](_0x24a714['stack']);if(_0x24a714['name']){delete _0x24a714[_0xbd08('0x2a')];}_0x5525a2['status'](_0x30df5b)[_0xbd08('0x2b')](_0x24a714);};}exports[_0xbd08('0x2c')]=function(_0x191445,_0xf4a7b7){var _0x50c3da={},_0x279bce={},_0x2f909b={'count':0x0,'rows':[]};var _0x2640b6=_['map'](db[_0xbd08('0x2d')][_0xbd08('0x2e')],function(_0x3dea2e){return{'name':_0x3dea2e[_0xbd08('0x2f')],'type':_0x3dea2e[_0xbd08('0x30')]['key']};});_0x279bce[_0xbd08('0x31')]=_[_0xbd08('0x32')](_0x2640b6,_0xbd08('0x2a'));_0x279bce['query']=_[_0xbd08('0x33')](_0x191445[_0xbd08('0x34')]);_0x279bce[_0xbd08('0x35')]=_[_0xbd08('0x36')](_0x279bce[_0xbd08('0x31')],_0x279bce[_0xbd08('0x34')]);_0x50c3da[_0xbd08('0x37')]=_[_0xbd08('0x36')](_0x279bce[_0xbd08('0x31')],qs[_0xbd08('0x38')](_0x191445[_0xbd08('0x34')][_0xbd08('0x38')]));_0x50c3da[_0xbd08('0x37')]=_0x50c3da[_0xbd08('0x37')][_0xbd08('0x39')]?_0x50c3da[_0xbd08('0x37')]:_0x279bce[_0xbd08('0x31')];if(!_0x191445['query'][_0xbd08('0x3a')]('nolimit')){_0x50c3da[_0xbd08('0x22')]=qs[_0xbd08('0x22')](_0x191445[_0xbd08('0x34')]['limit']);_0x50c3da[_0xbd08('0x1f')]=qs[_0xbd08('0x1f')](_0x191445[_0xbd08('0x34')]['offset']);}_0x50c3da[_0xbd08('0x3b')]=qs[_0xbd08('0x3c')](_0x191445[_0xbd08('0x34')][_0xbd08('0x3c')]);_0x50c3da[_0xbd08('0x3d')]=qs['filters'](_[_0xbd08('0x3e')](_0x191445[_0xbd08('0x34')],_0x279bce[_0xbd08('0x35')]),_0x2640b6);if(_0x191445[_0xbd08('0x34')][_0xbd08('0x3f')]){_0x50c3da[_0xbd08('0x3d')]=_[_0xbd08('0x40')](_0x50c3da['where'],{'$or':_[_0xbd08('0x32')](_0x2640b6,function(_0x2a09b2){if(_0x2a09b2[_0xbd08('0x30')]!=='VIRTUAL'){var _0xd836d2={};_0xd836d2[_0x2a09b2[_0xbd08('0x2a')]]={'$like':'%'+_0x191445[_0xbd08('0x34')][_0xbd08('0x3f')]+'%'};return _0xd836d2;}})});}_0x50c3da=_[_0xbd08('0x40')]({},_0x50c3da,_0x191445[_0xbd08('0x41')]);var _0x26d7b5={'where':_0x50c3da['where']};return db[_0xbd08('0x2d')]['count'](_0x26d7b5)[_0xbd08('0x26')](function(_0x17456c){_0x2f909b[_0xbd08('0x21')]=_0x17456c;if(_0x191445['query'][_0xbd08('0x42')]){_0x50c3da['include']=[{'all':!![]}];}return db[_0xbd08('0x2d')]['findAll'](_0x50c3da);})[_0xbd08('0x26')](function(_0x1337de){_0x2f909b[_0xbd08('0x43')]=_0x1337de;return _0x2f909b;})[_0xbd08('0x26')](respondWithFilteredResult(_0xf4a7b7,_0x50c3da))['catch'](handleError(_0xf4a7b7,null));};exports['show']=function(_0x412871,_0xc4a908){var _0x462fbe={'raw':![],'where':{'id':_0x412871['params']['id']}},_0x6e9f2c={};_0x6e9f2c[_0xbd08('0x31')]=_['keys'](db['UserProfileSection'][_0xbd08('0x2e')]);_0x6e9f2c['query']=_[_0xbd08('0x33')](_0x412871['query']);_0x6e9f2c[_0xbd08('0x35')]=_[_0xbd08('0x36')](_0x6e9f2c[_0xbd08('0x31')],_0x6e9f2c['query']);_0x462fbe[_0xbd08('0x37')]=_[_0xbd08('0x36')](_0x6e9f2c[_0xbd08('0x31')],qs[_0xbd08('0x38')](_0x412871[_0xbd08('0x34')][_0xbd08('0x38')]));_0x462fbe[_0xbd08('0x37')]=_0x462fbe[_0xbd08('0x37')][_0xbd08('0x39')]?_0x462fbe[_0xbd08('0x37')]:_0x6e9f2c[_0xbd08('0x31')];if(_0x412871['query'][_0xbd08('0x42')]){_0x462fbe[_0xbd08('0x44')]=[{'all':!![]}];}_0x462fbe=_['merge']({},_0x462fbe,_0x412871[_0xbd08('0x41')]);return db[_0xbd08('0x2d')][_0xbd08('0x45')](_0x462fbe)[_0xbd08('0x26')](handleEntityNotFound(_0xc4a908,null))[_0xbd08('0x26')](respondWithResult(_0xc4a908,null))[_0xbd08('0x46')](handleError(_0xc4a908,null));};exports[_0xbd08('0x47')]=function(_0x5ef6cc,_0x49f9c1){return db[_0xbd08('0x2d')][_0xbd08('0x47')](_0x5ef6cc[_0xbd08('0x48')],{})[_0xbd08('0x26')](respondWithResult(_0x49f9c1,0xc9))[_0xbd08('0x46')](handleError(_0x49f9c1,null));};exports[_0xbd08('0x25')]=function(_0x39421c,_0x5900b6){if(_0x39421c['body']['id']){delete _0x39421c['body']['id'];}return db[_0xbd08('0x2d')][_0xbd08('0x45')]({'where':{'id':_0x39421c[_0xbd08('0x49')]['id']}})[_0xbd08('0x26')](handleEntityNotFound(_0x5900b6,null))[_0xbd08('0x26')](saveUpdates(_0x39421c[_0xbd08('0x48')],null))[_0xbd08('0x26')](respondWithResult(_0x5900b6,null))['catch'](handleError(_0x5900b6,null));};exports[_0xbd08('0x27')]=function(_0x1c0942,_0x4a4b5b){return db[_0xbd08('0x2d')][_0xbd08('0x45')]({'where':{'id':_0x1c0942['params']['id']}})[_0xbd08('0x26')](handleEntityNotFound(_0x4a4b5b,null))['then'](removeEntity(_0x4a4b5b,null))['catch'](handleError(_0x4a4b5b,null));};exports[_0xbd08('0x4a')]=function(_0x3409a0,_0x52d248){return db[_0xbd08('0x2d')]['describe']()[_0xbd08('0x26')](respondWithResult(_0x52d248,null))[_0xbd08('0x46')](handleError(_0x52d248,null));}; \ No newline at end of file +var _0xe1fa=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','save','update','destroy','then','error','name','send','UserProfileSection','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x399869,_0x11b444){var _0x4ff731=function(_0x1a0cc2){while(--_0x1a0cc2){_0x399869['push'](_0x399869['shift']());}};_0x4ff731(++_0x11b444);}(_0xe1fa,0x12a));var _0xae1f=function(_0xddf1d8,_0x1f2964){_0xddf1d8=_0xddf1d8-0x0;var _0x500ed9=_0xe1fa[_0xddf1d8];return _0x500ed9;};'use strict';var emlformat=require(_0xae1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae1f('0x1'));var jsonpatch=require(_0xae1f('0x2'));var rp=require(_0xae1f('0x3'));var moment=require(_0xae1f('0x4'));var BPromise=require(_0xae1f('0x5'));var Mustache=require(_0xae1f('0x6'));var util=require(_0xae1f('0x7'));var path=require(_0xae1f('0x8'));var sox=require(_0xae1f('0x9'));var csv=require(_0xae1f('0xa'));var ejs=require(_0xae1f('0xb'));var fs=require('fs');var fs_extra=require(_0xae1f('0xc'));var _=require(_0xae1f('0xd'));var squel=require(_0xae1f('0xe'));var crypto=require(_0xae1f('0xf'));var jsforce=require(_0xae1f('0x10'));var deskjs=require(_0xae1f('0x11'));var toCsv=require(_0xae1f('0xa'));var querystring=require(_0xae1f('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xae1f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae1f('0x14'));var logger=require('../../config/logger')(_0xae1f('0x15'));var utils=require('../../config/utils');var config=require(_0xae1f('0x16'));var licenseUtil=require(_0xae1f('0x17'));var db=require(_0xae1f('0x18'))['db'];function respondWithStatusCode(_0x1cf5c8,_0x33879c){_0x33879c=_0x33879c||0xcc;return function(_0x5bc285){if(_0x5bc285){return _0x1cf5c8[_0xae1f('0x19')](_0x33879c);}return _0x1cf5c8[_0xae1f('0x1a')](_0x33879c)[_0xae1f('0x1b')]();};}function respondWithResult(_0x54126c,_0x19da98){_0x19da98=_0x19da98||0xc8;return function(_0x1bd1eb){if(_0x1bd1eb){return _0x54126c['status'](_0x19da98)['json'](_0x1bd1eb);}};}function respondWithFilteredResult(_0x1f4267,_0x5d4df5){return function(_0x31edd5){if(_0x31edd5){var _0x1f26cb=typeof _0x5d4df5[_0xae1f('0x1c')]===_0xae1f('0x1d')&&typeof _0x5d4df5['limit']==='undefined';var _0x462420=_0x31edd5[_0xae1f('0x1e')];var _0x5c3c70=_0x1f26cb?0x0:_0x5d4df5[_0xae1f('0x1c')];var _0x4e78bd=_0x1f26cb?_0x31edd5[_0xae1f('0x1e')]:_0x5d4df5['offset']+_0x5d4df5['limit'];var _0x4798c5;if(_0x4e78bd>=_0x462420){_0x4e78bd=_0x462420;_0x4798c5=0xc8;}else{_0x4798c5=0xce;}_0x1f4267[_0xae1f('0x1a')](_0x4798c5);return _0x1f4267[_0xae1f('0x1f')]('Content-Range',_0x5c3c70+'-'+_0x4e78bd+'/'+_0x462420)[_0xae1f('0x20')](_0x31edd5);}return null;};}function patchUpdates(_0x1ca0a0){return function(_0x1768fe){try{jsonpatch[_0xae1f('0x21')](_0x1768fe,_0x1ca0a0,!![]);}catch(_0x44958d){return BPromise[_0xae1f('0x22')](_0x44958d);}return _0x1768fe[_0xae1f('0x23')]();};}function saveUpdates(_0x261950,_0x4e7cec){return function(_0x336e6b){if(_0x336e6b){return _0x336e6b[_0xae1f('0x24')](_0x261950)['then'](function(_0x3e15b2){return _0x3e15b2;});}return null;};}function removeEntity(_0x3fa938,_0x5c2a7d){return function(_0x287d8c){if(_0x287d8c){return _0x287d8c[_0xae1f('0x25')]()[_0xae1f('0x26')](function(){_0x3fa938[_0xae1f('0x1a')](0xcc)[_0xae1f('0x1b')]();});}};}function handleEntityNotFound(_0x15cb55,_0x5b8d37){return function(_0x4f4b1a){if(!_0x4f4b1a){_0x15cb55[_0xae1f('0x19')](0x194);}return _0x4f4b1a;};}function handleError(_0x10be29,_0x260c96){_0x260c96=_0x260c96||0x1f4;return function(_0x4ab25c){logger[_0xae1f('0x27')](_0x4ab25c['stack']);if(_0x4ab25c[_0xae1f('0x28')]){delete _0x4ab25c[_0xae1f('0x28')];}_0x10be29['status'](_0x260c96)[_0xae1f('0x29')](_0x4ab25c);};}exports['index']=function(_0x241040,_0x4d36e8){var _0x2a9993={},_0x5007e7={},_0x2c3819={'count':0x0,'rows':[]};var _0x5d38d0=_['map'](db[_0xae1f('0x2a')][_0xae1f('0x2b')],function(_0x4cd81d){return{'name':_0x4cd81d['fieldName'],'type':_0x4cd81d['type'][_0xae1f('0x2c')]};});_0x5007e7[_0xae1f('0x2d')]=_[_0xae1f('0x2e')](_0x5d38d0,_0xae1f('0x28'));_0x5007e7[_0xae1f('0x2f')]=_[_0xae1f('0x30')](_0x241040['query']);_0x5007e7[_0xae1f('0x31')]=_[_0xae1f('0x32')](_0x5007e7['model'],_0x5007e7[_0xae1f('0x2f')]);_0x2a9993[_0xae1f('0x33')]=_[_0xae1f('0x32')](_0x5007e7[_0xae1f('0x2d')],qs[_0xae1f('0x34')](_0x241040[_0xae1f('0x2f')][_0xae1f('0x34')]));_0x2a9993[_0xae1f('0x33')]=_0x2a9993[_0xae1f('0x33')][_0xae1f('0x35')]?_0x2a9993['attributes']:_0x5007e7['model'];if(!_0x241040[_0xae1f('0x2f')][_0xae1f('0x36')](_0xae1f('0x37'))){_0x2a9993[_0xae1f('0x38')]=qs[_0xae1f('0x38')](_0x241040[_0xae1f('0x2f')][_0xae1f('0x38')]);_0x2a9993['offset']=qs['offset'](_0x241040[_0xae1f('0x2f')][_0xae1f('0x1c')]);}_0x2a9993[_0xae1f('0x39')]=qs[_0xae1f('0x3a')](_0x241040['query']['sort']);_0x2a9993[_0xae1f('0x3b')]=qs['filters'](_[_0xae1f('0x3c')](_0x241040[_0xae1f('0x2f')],_0x5007e7[_0xae1f('0x31')]),_0x5d38d0);if(_0x241040[_0xae1f('0x2f')][_0xae1f('0x3d')]){_0x2a9993[_0xae1f('0x3b')]=_[_0xae1f('0x3e')](_0x2a9993['where'],{'$or':_['map'](_0x5d38d0,function(_0x4ed91f){if(_0x4ed91f[_0xae1f('0x3f')]!==_0xae1f('0x40')){var _0x14fbfc={};_0x14fbfc[_0x4ed91f[_0xae1f('0x28')]]={'$like':'%'+_0x241040[_0xae1f('0x2f')][_0xae1f('0x3d')]+'%'};return _0x14fbfc;}})});}_0x2a9993=_[_0xae1f('0x3e')]({},_0x2a9993,_0x241040[_0xae1f('0x41')]);var _0x247b47={'where':_0x2a9993[_0xae1f('0x3b')]};return db[_0xae1f('0x2a')][_0xae1f('0x1e')](_0x247b47)[_0xae1f('0x26')](function(_0x428e0d){_0x2c3819[_0xae1f('0x1e')]=_0x428e0d;if(_0x241040['query'][_0xae1f('0x42')]){_0x2a9993[_0xae1f('0x43')]=[{'all':!![]}];}return db[_0xae1f('0x2a')][_0xae1f('0x44')](_0x2a9993);})[_0xae1f('0x26')](function(_0x153f5c){_0x2c3819[_0xae1f('0x45')]=_0x153f5c;return _0x2c3819;})['then'](respondWithFilteredResult(_0x4d36e8,_0x2a9993))[_0xae1f('0x46')](handleError(_0x4d36e8,null));};exports[_0xae1f('0x47')]=function(_0x34f1a9,_0x559bab){var _0x16d91b={'raw':![],'where':{'id':_0x34f1a9[_0xae1f('0x48')]['id']}},_0x19b242={};_0x19b242[_0xae1f('0x2d')]=_['keys'](db[_0xae1f('0x2a')]['rawAttributes']);_0x19b242[_0xae1f('0x2f')]=_[_0xae1f('0x30')](_0x34f1a9['query']);_0x19b242['filters']=_[_0xae1f('0x32')](_0x19b242[_0xae1f('0x2d')],_0x19b242[_0xae1f('0x2f')]);_0x16d91b['attributes']=_[_0xae1f('0x32')](_0x19b242[_0xae1f('0x2d')],qs['fields'](_0x34f1a9[_0xae1f('0x2f')][_0xae1f('0x34')]));_0x16d91b[_0xae1f('0x33')]=_0x16d91b['attributes'][_0xae1f('0x35')]?_0x16d91b['attributes']:_0x19b242[_0xae1f('0x2d')];if(_0x34f1a9[_0xae1f('0x2f')][_0xae1f('0x42')]){_0x16d91b['include']=[{'all':!![]}];}_0x16d91b=_[_0xae1f('0x3e')]({},_0x16d91b,_0x34f1a9[_0xae1f('0x41')]);return db['UserProfileSection']['find'](_0x16d91b)[_0xae1f('0x26')](handleEntityNotFound(_0x559bab,null))[_0xae1f('0x26')](respondWithResult(_0x559bab,null))[_0xae1f('0x46')](handleError(_0x559bab,null));};exports[_0xae1f('0x49')]=function(_0x44fe74,_0x2ebaf7){return db[_0xae1f('0x2a')][_0xae1f('0x49')](_0x44fe74[_0xae1f('0x4a')],{})[_0xae1f('0x26')](respondWithResult(_0x2ebaf7,0xc9))[_0xae1f('0x46')](handleError(_0x2ebaf7,null));};exports[_0xae1f('0x24')]=function(_0x1fb36f,_0x529000){if(_0x1fb36f[_0xae1f('0x4a')]['id']){delete _0x1fb36f[_0xae1f('0x4a')]['id'];}return db[_0xae1f('0x2a')][_0xae1f('0x4b')]({'where':{'id':_0x1fb36f[_0xae1f('0x48')]['id']}})[_0xae1f('0x26')](handleEntityNotFound(_0x529000,null))[_0xae1f('0x26')](saveUpdates(_0x1fb36f['body'],null))[_0xae1f('0x26')](respondWithResult(_0x529000,null))['catch'](handleError(_0x529000,null));};exports[_0xae1f('0x25')]=function(_0x1bdce6,_0x501fb8){return db[_0xae1f('0x2a')][_0xae1f('0x4b')]({'where':{'id':_0x1bdce6[_0xae1f('0x48')]['id']}})[_0xae1f('0x26')](handleEntityNotFound(_0x501fb8,null))[_0xae1f('0x26')](removeEntity(_0x501fb8,null))['catch'](handleError(_0x501fb8,null));};exports[_0xae1f('0x4c')]=function(_0x2ebf55,_0x58eeba){return db['UserProfileSection'][_0xae1f('0x4c')]()[_0xae1f('0x26')](respondWithResult(_0x58eeba,null))['catch'](handleError(_0x58eeba,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index afd5a17..a0a5632 100644 --- a/server/api/userProfileSection/userProfileSection.model.js +++ b/server/api/userProfileSection/userProfileSection.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d76=['../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x74768a,_0x53f9b){var _0x29929f=function(_0x28dde0){while(--_0x28dde0){_0x74768a['push'](_0x74768a['shift']());}};_0x29929f(++_0x53f9b);}(_0x5d76,0x1f1));var _0x65d7=function(_0x520260,_0x56db83){_0x520260=_0x520260-0x0;var _0xd8cd16=_0x5d76[_0x520260];return _0xd8cd16;};'use strict';var _=require(_0x65d7('0x0'));var util=require(_0x65d7('0x1'));var logger=require('../../config/logger')(_0x65d7('0x2'));var moment=require('moment');var BPromise=require(_0x65d7('0x3'));var rp=require(_0x65d7('0x4'));var fs=require('fs');var path=require(_0x65d7('0x5'));var rimraf=require(_0x65d7('0x6'));var config=require(_0x65d7('0x7'));var attributes=require(_0x65d7('0x8'));module[_0x65d7('0x9')]=function(_0x2b4113,_0x399eeb){return _0x2b4113['define'](_0x65d7('0xa'),attributes,{'tableName':_0x65d7('0xb'),'paranoid':![],'indexes':[{'name':_0x65d7('0xc'),'fields':['sectionId',_0x65d7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4511=['request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api','moment','bluebird'];(function(_0x126e31,_0x54eae6){var _0x3567c8=function(_0x50ab9b){while(--_0x50ab9b){_0x126e31['push'](_0x126e31['shift']());}};_0x3567c8(++_0x54eae6);}(_0x4511,0x18b));var _0x1451=function(_0xc0882b,_0x380c97){_0xc0882b=_0xc0882b-0x0;var _0x4cec6b=_0x4511[_0xc0882b];return _0x4cec6b;};'use strict';var _=require(_0x1451('0x0'));var util=require(_0x1451('0x1'));var logger=require('../../config/logger')(_0x1451('0x2'));var moment=require(_0x1451('0x3'));var BPromise=require(_0x1451('0x4'));var rp=require(_0x1451('0x5'));var fs=require('fs');var path=require(_0x1451('0x6'));var rimraf=require('rimraf');var config=require(_0x1451('0x7'));var attributes=require(_0x1451('0x8'));module[_0x1451('0x9')]=function(_0x5e6549,_0x17003b){return _0x5e6549[_0x1451('0xa')](_0x1451('0xb'),attributes,{'tableName':_0x1451('0xc'),'paranoid':![],'indexes':[{'name':_0x1451('0xd'),'fields':[_0x1451('0xe'),_0x1451('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 55ac997..4deb8e3 100644 --- a/server/api/userProfileSection/userProfileSection.rpc.js +++ b/server/api/userProfileSection/userProfileSection.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e67=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x143e98,_0xcacf43){var _0xaf0498=function(_0x53731b){while(--_0x53731b){_0x143e98['push'](_0x143e98['shift']());}};_0xaf0498(++_0xcacf43);}(_0x3e67,0x88));var _0x73e6=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0x3e67[_0x57966a];return _0x191765;};'use strict';var _=require(_0x73e6('0x0'));var util=require(_0x73e6('0x1'));var moment=require(_0x73e6('0x2'));var BPromise=require(_0x73e6('0x3'));var rs=require(_0x73e6('0x4'));var fs=require('fs');var Redis=require(_0x73e6('0x5'));var db=require(_0x73e6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x73e6('0x7'))(_0x73e6('0x8'));var config=require(_0x73e6('0x9'));var jayson=require(_0x73e6('0xa'));var client=jayson['client'][_0x73e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x359e66,_0x1c6091,_0x34b33f){return new BPromise(function(_0x4ca9a9,_0x17a35a){return client[_0x73e6('0xc')](_0x359e66,_0x34b33f)[_0x73e6('0xd')](function(_0xfcc41){logger[_0x73e6('0xe')](_0x73e6('0xf'),_0x1c6091,_0x73e6('0x10'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1c6091,_0x73e6('0x10'),JSON[_0x73e6('0x11')](_0xfcc41));if(_0xfcc41[_0x73e6('0x12')]){if(_0xfcc41[_0x73e6('0x12')][_0x73e6('0x13')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x1c6091,_0xfcc41[_0x73e6('0x12')][_0x73e6('0x14')]);return _0x17a35a(_0xfcc41[_0x73e6('0x12')][_0x73e6('0x14')]);}logger[_0x73e6('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x1c6091,_0xfcc41[_0x73e6('0x12')]['message']);return _0x4ca9a9(_0xfcc41['error'][_0x73e6('0x14')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x1c6091,'request\x20sent');_0x4ca9a9(_0xfcc41['result']['message']);}})[_0x73e6('0x15')](function(_0x1f52b6){logger[_0x73e6('0x12')](_0x73e6('0xf'),_0x1c6091,_0x1f52b6);_0x17a35a(_0x1f52b6);});});} \ No newline at end of file +var _0xac8d=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ba748,_0x4b8fb9){var _0x5b04e2=function(_0x16bb9e){while(--_0x16bb9e){_0x3ba748['push'](_0x3ba748['shift']());}};_0x5b04e2(++_0x4b8fb9);}(_0xac8d,0x1d8));var _0xdac8=function(_0xdb80fa,_0x505df9){_0xdb80fa=_0xdb80fa-0x0;var _0x4df3e0=_0xac8d[_0xdb80fa];return _0x4df3e0;};'use strict';var _=require(_0xdac8('0x0'));var util=require(_0xdac8('0x1'));var moment=require(_0xdac8('0x2'));var BPromise=require(_0xdac8('0x3'));var rs=require(_0xdac8('0x4'));var fs=require('fs');var Redis=require(_0xdac8('0x5'));var db=require(_0xdac8('0x6'))['db'];var utils=require(_0xdac8('0x7'));var logger=require(_0xdac8('0x8'))('rpc');var config=require(_0xdac8('0x9'));var jayson=require(_0xdac8('0xa'));var client=jayson[_0xdac8('0xb')][_0xdac8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e1cc7,_0x3677da,_0x8f90bd){return new BPromise(function(_0x96c908,_0x116c0a){return client['request'](_0x1e1cc7,_0x8f90bd)[_0xdac8('0xd')](function(_0x55e8ec){logger[_0xdac8('0xe')](_0xdac8('0xf'),_0x3677da,_0xdac8('0x10'));logger[_0xdac8('0x11')](_0xdac8('0x12'),_0x3677da,'request\x20sent',JSON[_0xdac8('0x13')](_0x55e8ec));if(_0x55e8ec['error']){if(_0x55e8ec[_0xdac8('0x14')][_0xdac8('0x15')]===0x1f4){logger[_0xdac8('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x3677da,_0x55e8ec[_0xdac8('0x14')]['message']);return _0x116c0a(_0x55e8ec['error'][_0xdac8('0x16')]);}logger['error'](_0xdac8('0xf'),_0x3677da,_0x55e8ec[_0xdac8('0x14')][_0xdac8('0x16')]);return _0x96c908(_0x55e8ec[_0xdac8('0x14')][_0xdac8('0x16')]);}else{logger['info'](_0xdac8('0xf'),_0x3677da,_0xdac8('0x10'));_0x96c908(_0x55e8ec[_0xdac8('0x17')][_0xdac8('0x16')]);}})['catch'](function(_0x9d075f){logger[_0xdac8('0x14')](_0xdac8('0xf'),_0x3677da,_0x9d075f);_0x116c0a(_0x9d075f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 02a79ef..14178f8 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x486b88,_0x10faca){var _0x20dee9=function(_0x5130a3){while(--_0x5130a3){_0x486b88['push'](_0x486b88['shift']());}};_0x20dee9(++_0x10faca);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5c0c9e,_0x410be6){var _0x176458=function(_0x1ed350){while(--_0x1ed350){_0x5c0c9e['push'](_0x5c0c9e['shift']());}};_0x176458(++_0x410be6);}(_0x70e0,0x17b));var _0x070e=function(_0x3b0718,_0x42da85){_0x3b0718=_0x3b0718-0x0;var _0x5845de=_0x70e0[_0x3b0718];return _0x5845de;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 9006424..d1d844f 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0689=['exports'];(function(_0x4fc1d7,_0x30e28f){var _0x43ec7f=function(_0x6c036a){while(--_0x6c036a){_0x4fc1d7['push'](_0x4fc1d7['shift']());}};_0x43ec7f(++_0x30e28f);}(_0x0689,0x161));var _0x9068=function(_0x3600e2,_0x396426){_0x3600e2=_0x3600e2-0x0;var _0x45ace2=_0x0689[_0x3600e2];return _0x45ace2;};'use strict';var Sequelize=require('sequelize');module[_0x9068('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 95b0e38..64c1841 100644 --- a/server/api/userSmsQueue/userSmsQueue.model.js +++ b/server/api/userSmsQueue/userSmsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0xfc9852,_0x37f8ad){var _0x283262=function(_0xe7489a){while(--_0xe7489a){_0xfc9852['push'](_0xfc9852['shift']());}};_0x283262(++_0x37f8ad);}(_0x4745,0x1e7));var _0x5474=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x4745[_0x521929];return _0x632436;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('UserSmsQueue',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2aa3=['user_has_sms_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x1027c8,_0x54ec2){var _0x266bc2=function(_0x5006f3){while(--_0x5006f3){_0x1027c8['push'](_0x1027c8['shift']());}};_0x266bc2(++_0x54ec2);}(_0x2aa3,0x83));var _0x32aa=function(_0x332670,_0x2d6c46){_0x332670=_0x332670-0x0;var _0x3fdd4f=_0x2aa3[_0x332670];return _0x3fdd4f;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var logger=require(_0x32aa('0x2'))(_0x32aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x32aa('0x4'));var fs=require('fs');var path=require(_0x32aa('0x5'));var rimraf=require(_0x32aa('0x6'));var config=require(_0x32aa('0x7'));var attributes=require(_0x32aa('0x8'));module[_0x32aa('0x9')]=function(_0x53ab98,_0x17346a){return _0x53ab98[_0x32aa('0xa')](_0x32aa('0xb'),attributes,{'tableName':_0x32aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index f88bf8e..f70df6e 100644 --- a/server/api/userSmsQueue/userSmsQueue.rpc.js +++ b/server/api/userSmsQueue/userSmsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef07=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','randomstring','ioredis'];(function(_0x3d43c5,_0x220293){var _0x4bb168=function(_0x5b9cc9){while(--_0x5b9cc9){_0x3d43c5['push'](_0x3d43c5['shift']());}};_0x4bb168(++_0x220293);}(_0xef07,0xa3));var _0x7ef0=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0xef07[_0x39fd11];return _0x302799;};'use strict';var _=require(_0x7ef0('0x0'));var util=require(_0x7ef0('0x1'));var moment=require(_0x7ef0('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ef0('0x3'));var fs=require('fs');var Redis=require(_0x7ef0('0x4'));var db=require(_0x7ef0('0x5'))['db'];var utils=require(_0x7ef0('0x6'));var logger=require(_0x7ef0('0x7'))('rpc');var config=require(_0x7ef0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7ef0('0x9')][_0x7ef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x222814,_0x5af9d8,_0xcd2339){return new BPromise(function(_0x5edb6a,_0x5d9bdd){return client[_0x7ef0('0xb')](_0x222814,_0xcd2339)[_0x7ef0('0xc')](function(_0x48a35c){logger[_0x7ef0('0xd')](_0x7ef0('0xe'),_0x5af9d8,_0x7ef0('0xf'));logger[_0x7ef0('0x10')](_0x7ef0('0x11'),_0x5af9d8,'request\x20sent',JSON['stringify'](_0x48a35c));if(_0x48a35c['error']){if(_0x48a35c[_0x7ef0('0x12')][_0x7ef0('0x13')]===0x1f4){logger[_0x7ef0('0x12')](_0x7ef0('0xe'),_0x5af9d8,_0x48a35c[_0x7ef0('0x12')][_0x7ef0('0x14')]);return _0x5d9bdd(_0x48a35c[_0x7ef0('0x12')][_0x7ef0('0x14')]);}logger[_0x7ef0('0x12')](_0x7ef0('0xe'),_0x5af9d8,_0x48a35c[_0x7ef0('0x12')][_0x7ef0('0x14')]);return _0x5edb6a(_0x48a35c['error'][_0x7ef0('0x14')]);}else{logger['info'](_0x7ef0('0xe'),_0x5af9d8,_0x7ef0('0xf'));_0x5edb6a(_0x48a35c['result'][_0x7ef0('0x14')]);}})['catch'](function(_0xea2b6d){logger[_0x7ef0('0x12')](_0x7ef0('0xe'),_0x5af9d8,_0xea2b6d);_0x5d9bdd(_0xea2b6d);});});} \ No newline at end of file +var _0xeaac=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','catch'];(function(_0x271d99,_0xc36da4){var _0x2fd021=function(_0x129788){while(--_0x129788){_0x271d99['push'](_0x271d99['shift']());}};_0x2fd021(++_0xc36da4);}(_0xeaac,0x1b5));var _0xceaa=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xeaac[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xceaa('0x0'));var util=require(_0xceaa('0x1'));var moment=require(_0xceaa('0x2'));var BPromise=require(_0xceaa('0x3'));var rs=require(_0xceaa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceaa('0x5'))['db'];var utils=require(_0xceaa('0x6'));var logger=require('../../config/logger')(_0xceaa('0x7'));var config=require(_0xceaa('0x8'));var jayson=require(_0xceaa('0x9'));var client=jayson[_0xceaa('0xa')][_0xceaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x359349,_0x343808,_0x3a799b){return new BPromise(function(_0x17e1de,_0x4e78f4){return client[_0xceaa('0xc')](_0x359349,_0x3a799b)['then'](function(_0x800b2a){logger[_0xceaa('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x343808,_0xceaa('0xe'));logger[_0xceaa('0xf')](_0xceaa('0x10'),_0x343808,_0xceaa('0xe'),JSON[_0xceaa('0x11')](_0x800b2a));if(_0x800b2a[_0xceaa('0x12')]){if(_0x800b2a[_0xceaa('0x12')][_0xceaa('0x13')]===0x1f4){logger[_0xceaa('0x12')](_0xceaa('0x14'),_0x343808,_0x800b2a[_0xceaa('0x12')]['message']);return _0x4e78f4(_0x800b2a[_0xceaa('0x12')]['message']);}logger[_0xceaa('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x343808,_0x800b2a[_0xceaa('0x12')]['message']);return _0x17e1de(_0x800b2a['error'][_0xceaa('0x15')]);}else{logger[_0xceaa('0xd')](_0xceaa('0x14'),_0x343808,_0xceaa('0xe'));_0x17e1de(_0x800b2a['result'][_0xceaa('0x15')]);}})[_0xceaa('0x16')](function(_0x2af96f){logger['error'](_0xceaa('0x14'),_0x343808,_0x2af96f);_0x4e78f4(_0x2af96f);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index fb94fea..2290f6f 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8192=['INTEGER','sequelize','exports'];(function(_0x2b4b40,_0x437970){var _0x34a346=function(_0x18a8cd){while(--_0x18a8cd){_0x2b4b40['push'](_0x2b4b40['shift']());}};_0x34a346(++_0x437970);}(_0x8192,0x18d));var _0x2819=function(_0x40c8f6,_0x485bbb){_0x40c8f6=_0x40c8f6-0x0;var _0xb66a88=_0x8192[_0x40c8f6];return _0xb66a88;};'use strict';var Sequelize=require(_0x2819('0x0'));module[_0x2819('0x1')]={'UserId':{'type':Sequelize[_0x2819('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2819('0x2')]}}; \ No newline at end of file +var _0x6029=['INTEGER','sequelize'];(function(_0x5955d4,_0x28cab5){var _0x22ff03=function(_0x363963){while(--_0x363963){_0x5955d4['push'](_0x5955d4['shift']());}};_0x22ff03(++_0x28cab5);}(_0x6029,0x13d));var _0x9602=function(_0x4bc7f9,_0x5caa6b){_0x4bc7f9=_0x4bc7f9-0x0;var _0x4f42ee=_0x6029[_0x4bc7f9];return _0x4f42ee;};'use strict';var Sequelize=require(_0x9602('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x9602('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index aa68cc7..df9af7f 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x55e97b,_0x59bcdd){var _0x443812=function(_0x196fc3){while(--_0x196fc3){_0x55e97b['push'](_0x55e97b['shift']());}};_0x443812(++_0x59bcdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xfc2740,_0x2be393){var _0x44c447=function(_0x5e2b73){while(--_0x5e2b73){_0xfc2740['push'](_0xfc2740['shift']());}};_0x44c447(++_0x2be393);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 5cc7438..094b933 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x348d67,_0x311ff1){var _0xafa1e4=function(_0x5de80a){while(--_0x5de80a){_0x348d67['push'](_0x348d67['shift']());}};_0xafa1e4(++_0x311ff1);}(_0xe706,0xa3));var _0x6e70=function(_0x19cee7,_0x562ecb){_0x19cee7=_0x19cee7-0x0;var _0x45657b=_0xe706[_0x19cee7];return _0x45657b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x15c628,_0x821cc6){var _0x502d2e=function(_0x21325a){while(--_0x21325a){_0x15c628['push'](_0x15c628['shift']());}};_0x502d2e(++_0x821cc6);}(_0xe706,0xa3));var _0x6e70=function(_0x36cd93,_0x593481){_0x36cd93=_0x36cd93-0x0;var _0x10f6cd=_0xe706[_0x36cd93];return _0x10f6cd;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index cd3f763..d0ca7eb 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x942a=['INTEGER','sequelize'];(function(_0x1e289b,_0x5acdf3){var _0x12d470=function(_0x38bb79){while(--_0x38bb79){_0x1e289b['push'](_0x1e289b['shift']());}};_0x12d470(++_0x5acdf3);}(_0x942a,0x175));var _0xa942=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x942a[_0x5a7f64];return _0x3d30f1;};'use strict';var Sequelize=require(_0xa942('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa942('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6e45=['INTEGER','sequelize','exports'];(function(_0x50f17d,_0x260de1){var _0x207fb8=function(_0x50456a){while(--_0x50456a){_0x50f17d['push'](_0x50f17d['shift']());}};_0x207fb8(++_0x260de1);}(_0x6e45,0x7c));var _0x56e4=function(_0xfa9eca,_0x599261){_0xfa9eca=_0xfa9eca-0x0;var _0x4bf5ba=_0x6e45[_0xfa9eca];return _0x4bf5ba;};'use strict';var Sequelize=require(_0x56e4('0x0'));module[_0x56e4('0x1')]={'penalty':{'type':Sequelize[_0x56e4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index ecb6d67..3e96296 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.model.js +++ b/server/api/userVoiceQueue/userVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31c7=['exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','bluebird','rimraf','./userVoiceQueue.attributes'];(function(_0x53e9ed,_0x1282e5){var _0x54990a=function(_0x4a4db4){while(--_0x4a4db4){_0x53e9ed['push'](_0x53e9ed['shift']());}};_0x54990a(++_0x1282e5);}(_0x31c7,0x1e4));var _0x731c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x31c7[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0x731c('0x0'));var logger=require(_0x731c('0x1'))(_0x731c('0x2'));var moment=require('moment');var BPromise=require(_0x731c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x731c('0x4'));var config=require('../../config/environment');var attributes=require(_0x731c('0x5'));module[_0x731c('0x6')]=function(_0x5d1a11,_0x1eb558){return _0x5d1a11[_0x731c('0x7')](_0x731c('0x8'),attributes,{'tableName':_0x731c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb131=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ab25c,_0x55e0a6){var _0x39c117=function(_0x5670c5){while(--_0x5670c5){_0x1ab25c['push'](_0x1ab25c['shift']());}};_0x39c117(++_0x55e0a6);}(_0xb131,0x1da));var _0x1b13=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0xb131[_0xe15270];return _0x1e813b;};'use strict';var _=require(_0x1b13('0x0'));var util=require(_0x1b13('0x1'));var logger=require(_0x1b13('0x2'))(_0x1b13('0x3'));var moment=require(_0x1b13('0x4'));var BPromise=require(_0x1b13('0x5'));var rp=require(_0x1b13('0x6'));var fs=require('fs');var path=require(_0x1b13('0x7'));var rimraf=require(_0x1b13('0x8'));var config=require(_0x1b13('0x9'));var attributes=require(_0x1b13('0xa'));module[_0x1b13('0xb')]=function(_0x1eafae,_0x36d22e){return _0x1eafae[_0x1b13('0xc')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 032d078..14d6814 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.rpc.js +++ b/server/api/userVoiceQueue/userVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2345=['http','request','then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x41426d,_0x10e308){var _0x1a1440=function(_0x127300){while(--_0x127300){_0x41426d['push'](_0x41426d['shift']());}};_0x1a1440(++_0x10e308);}(_0x2345,0xd4));var _0x5234=function(_0x2cc730,_0x3fa148){_0x2cc730=_0x2cc730-0x0;var _0x353684=_0x2345[_0x2cc730];return _0x353684;};'use strict';var _=require(_0x5234('0x0'));var util=require(_0x5234('0x1'));var moment=require(_0x5234('0x2'));var BPromise=require(_0x5234('0x3'));var rs=require(_0x5234('0x4'));var fs=require('fs');var Redis=require(_0x5234('0x5'));var db=require(_0x5234('0x6'))['db'];var utils=require(_0x5234('0x7'));var logger=require(_0x5234('0x8'))(_0x5234('0x9'));var config=require(_0x5234('0xa'));var jayson=require(_0x5234('0xb'));var client=jayson[_0x5234('0xc')][_0x5234('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a31b9,_0x60a575,_0x153ad4){return new BPromise(function(_0x184175,_0x4b7cde){return client[_0x5234('0xe')](_0x1a31b9,_0x153ad4)[_0x5234('0xf')](function(_0x51e9dd){logger[_0x5234('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x60a575,_0x5234('0x11'));logger['debug'](_0x5234('0x12'),_0x60a575,_0x5234('0x11'),JSON[_0x5234('0x13')](_0x51e9dd));if(_0x51e9dd['error']){if(_0x51e9dd[_0x5234('0x14')][_0x5234('0x15')]===0x1f4){logger[_0x5234('0x14')](_0x5234('0x16'),_0x60a575,_0x51e9dd[_0x5234('0x14')][_0x5234('0x17')]);return _0x4b7cde(_0x51e9dd[_0x5234('0x14')][_0x5234('0x17')]);}logger[_0x5234('0x14')](_0x5234('0x16'),_0x60a575,_0x51e9dd[_0x5234('0x14')]['message']);return _0x184175(_0x51e9dd[_0x5234('0x14')][_0x5234('0x17')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x60a575,_0x5234('0x11'));_0x184175(_0x51e9dd['result']['message']);}})[_0x5234('0x18')](function(_0x285521){logger[_0x5234('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x60a575,_0x285521);_0x4b7cde(_0x285521);});});} \ No newline at end of file +var _0x3847=['client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3d0953,_0x282ef1){var _0x2a3dd8=function(_0x32062f){while(--_0x32062f){_0x3d0953['push'](_0x3d0953['shift']());}};_0x2a3dd8(++_0x282ef1);}(_0x3847,0x1d8));var _0x7384=function(_0x22f097,_0x4c3d8f){_0x22f097=_0x22f097-0x0;var _0x24e3c2=_0x3847[_0x22f097];return _0x24e3c2;};'use strict';var _=require('lodash');var util=require(_0x7384('0x0'));var moment=require(_0x7384('0x1'));var BPromise=require(_0x7384('0x2'));var rs=require(_0x7384('0x3'));var fs=require('fs');var Redis=require(_0x7384('0x4'));var db=require(_0x7384('0x5'))['db'];var utils=require(_0x7384('0x6'));var logger=require(_0x7384('0x7'))(_0x7384('0x8'));var config=require(_0x7384('0x9'));var jayson=require(_0x7384('0xa'));var client=jayson[_0x7384('0xb')][_0x7384('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28b3da,_0x2d45c5,_0x492411){return new BPromise(function(_0xe5c10,_0x1d071a){return client[_0x7384('0xd')](_0x28b3da,_0x492411)['then'](function(_0x58d4d9){logger[_0x7384('0xe')](_0x7384('0xf'),_0x2d45c5,_0x7384('0x10'));logger['debug'](_0x7384('0x11'),_0x2d45c5,'request\x20sent',JSON['stringify'](_0x58d4d9));if(_0x58d4d9['error']){if(_0x58d4d9[_0x7384('0x12')][_0x7384('0x13')]===0x1f4){logger[_0x7384('0x12')](_0x7384('0xf'),_0x2d45c5,_0x58d4d9[_0x7384('0x12')][_0x7384('0x14')]);return _0x1d071a(_0x58d4d9[_0x7384('0x12')][_0x7384('0x14')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x2d45c5,_0x58d4d9['error'][_0x7384('0x14')]);return _0xe5c10(_0x58d4d9[_0x7384('0x12')][_0x7384('0x14')]);}else{logger['info'](_0x7384('0xf'),_0x2d45c5,_0x7384('0x10'));_0xe5c10(_0x58d4d9[_0x7384('0x15')][_0x7384('0x14')]);}})[_0x7384('0x16')](function(_0x5e14f2){logger[_0x7384('0x12')](_0x7384('0xf'),_0x2d45c5,_0x5e14f2);_0x1d071a(_0x5e14f2);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 9c26b57..689631d 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x25d68d,_0x69adf9){var _0x3f5c89=function(_0x27791a){while(--_0x27791a){_0x25d68d['push'](_0x25d68d['shift']());}};_0x3f5c89(++_0x69adf9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3ebc2a,_0x2a142f){var _0x60f8a5=function(_0x40a5ae){while(--_0x40a5ae){_0x3ebc2a['push'](_0x3ebc2a['shift']());}};_0x60f8a5(++_0x2a142f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0xcb91[_0x5ebc04];return _0x17845c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 0c886ba..607afe2 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3a8=['Required\x20by\x20Asterisk','STRING','queue_interface','exports','INTEGER'];(function(_0x431c49,_0x2c7d00){var _0x2d3010=function(_0xd6af48){while(--_0xd6af48){_0x431c49['push'](_0x431c49['shift']());}};_0x2d3010(++_0x2c7d00);}(_0xe3a8,0x94));var _0x8e3a=function(_0x5ab626,_0x3737c7){_0x5ab626=_0x5ab626-0x0;var _0x3d2fc5=_0xe3a8[_0x5ab626];return _0x3d2fc5;};'use strict';var Sequelize=require('sequelize');module[_0x8e3a('0x0')]={'uniqueid':{'type':Sequelize[_0x8e3a('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8e3a('0x2')},'membername':{'type':Sequelize[_0x8e3a('0x3')],'allowNull':![],'comment':_0x8e3a('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8e3a('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x8e3a('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8e3a('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8e3a('0x4'),'comment':_0x8e3a('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x8e3a('0x2')},'paused':{'type':Sequelize[_0x8e3a('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x98a1=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x2e9c45,_0x35dc85){var _0x472f09=function(_0x2618e9){while(--_0x2618e9){_0x2e9c45['push'](_0x2e9c45['shift']());}};_0x472f09(++_0x35dc85);}(_0x98a1,0x10d));var _0x198a=function(_0x5ee8e4,_0x5ee5ec){_0x5ee8e4=_0x5ee8e4-0x0;var _0x22056d=_0x98a1[_0x5ee8e4];return _0x22056d;};'use strict';var Sequelize=require(_0x198a('0x0'));module[_0x198a('0x1')]={'uniqueid':{'type':Sequelize[_0x198a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x198a('0x3')},'membername':{'type':Sequelize[_0x198a('0x4')],'allowNull':![],'comment':_0x198a('0x3')},'UserId':{'type':Sequelize[_0x198a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x198a('0x4')],'allowNull':![],'unique':_0x198a('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x198a('0x4')],'allowNull':![],'unique':_0x198a('0x5'),'comment':_0x198a('0x3')},'penalty':{'type':Sequelize[_0x198a('0x2')](0xb),'defaultValue':0x0,'comment':_0x198a('0x3')},'paused':{'type':Sequelize[_0x198a('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e20b985..a7a2569 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e81=['UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x305140,_0x5d473a){var _0x356e64=function(_0xe933de){while(--_0xe933de){_0x305140['push'](_0x305140['shift']());}};_0x356e64(++_0x5d473a);}(_0x3e81,0x1d4));var _0x13e8=function(_0x383597,_0x415582){_0x383597=_0x383597-0x0;var _0x3425aa=_0x3e81[_0x383597];return _0x3425aa;};'use strict';var EventEmitter=require(_0x13e8('0x0'));var UserVoiceQueueRt=require(_0x13e8('0x1'))['db'][_0x13e8('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x13e8('0x3')](0x0);var events={'afterCreate':_0x13e8('0x4'),'afterUpdate':_0x13e8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4765ec){return function(_0x578f92,_0x3cb69d,_0x9cb5ec){UserVoiceQueueRtEvents[_0x13e8('0x6')](_0x4765ec+':'+_0x578f92['id'],_0x578f92);UserVoiceQueueRtEvents[_0x13e8('0x6')](_0x4765ec,_0x578f92);_0x9cb5ec(null);};}for(var e in events){if(events[_0x13e8('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x13e8('0x8')](e,emitEvent(event));}}module[_0x13e8('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x8dfe=['hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove','emit'];(function(_0x524a80,_0xe23eb1){var _0x2a8743=function(_0x3670a8){while(--_0x3670a8){_0x524a80['push'](_0x524a80['shift']());}};_0x2a8743(++_0xe23eb1);}(_0x8dfe,0xf3));var _0xe8df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8dfe[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0xe8df('0x0'));var UserVoiceQueueRt=require(_0xe8df('0x1'))['db'][_0xe8df('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe8df('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe8df('0x4'),'afterDestroy':_0xe8df('0x5')};function emitEvent(_0x22e66a){return function(_0x4669b2,_0x300530,_0x37bd16){UserVoiceQueueRtEvents[_0xe8df('0x6')](_0x22e66a+':'+_0x4669b2['id'],_0x4669b2);UserVoiceQueueRtEvents[_0xe8df('0x6')](_0x22e66a,_0x4669b2);_0x37bd16(null);};}for(var e in events){if(events[_0xe8df('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xe8df('0x8')](e,emitEvent(event));}}module[_0xe8df('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 476c0dd..b9c197c 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ac3=['../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x697190,_0x5db743){var _0x312648=function(_0x581044){while(--_0x581044){_0x697190['push'](_0x697190['shift']());}};_0x312648(++_0x5db743);}(_0x0ac3,0x191));var _0x30ac=function(_0x5abd01,_0xa03557){_0x5abd01=_0x5abd01-0x0;var _0x24e9bb=_0x0ac3[_0x5abd01];return _0x24e9bb;};'use strict';var _=require(_0x30ac('0x0'));var util=require('util');var logger=require(_0x30ac('0x1'))(_0x30ac('0x2'));var moment=require(_0x30ac('0x3'));var BPromise=require('bluebird');var rp=require(_0x30ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30ac('0x5'));var config=require(_0x30ac('0x6'));var attributes=require(_0x30ac('0x7'));module[_0x30ac('0x8')]=function(_0x2a2c94,_0x1f1afb){return _0x2a2c94[_0x30ac('0x9')](_0x30ac('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7935=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt'];(function(_0x2e3cc9,_0xf9865a){var _0x417a37=function(_0x1d3fdf){while(--_0x1d3fdf){_0x2e3cc9['push'](_0x2e3cc9['shift']());}};_0x417a37(++_0xf9865a);}(_0x7935,0x1e5));var _0x5793=function(_0x54313f,_0x2cbd66){_0x54313f=_0x54313f-0x0;var _0x4ae0a6=_0x7935[_0x54313f];return _0x4ae0a6;};'use strict';var _=require(_0x5793('0x0'));var util=require(_0x5793('0x1'));var logger=require(_0x5793('0x2'))(_0x5793('0x3'));var moment=require('moment');var BPromise=require(_0x5793('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5793('0x5'));var rimraf=require('rimraf');var config=require(_0x5793('0x6'));var attributes=require(_0x5793('0x7'));module['exports']=function(_0x5cdd70,_0x952560){return _0x5cdd70[_0x5793('0x8')](_0x5793('0x9'),attributes,{'tableName':_0x5793('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 57bbd3c..030ec77 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a88=['catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x3173df,_0x31bec7){var _0x3911d8=function(_0x5c901f){while(--_0x5c901f){_0x3173df['push'](_0x3173df['shift']());}};_0x3911d8(++_0x31bec7);}(_0x2a88,0x173));var _0x82a8=function(_0x79d71b,_0x34e76b){_0x79d71b=_0x79d71b-0x0;var _0x225cda=_0x2a88[_0x79d71b];return _0x225cda;};'use strict';var _=require(_0x82a8('0x0'));var util=require(_0x82a8('0x1'));var moment=require(_0x82a8('0x2'));var BPromise=require(_0x82a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82a8('0x4'));var db=require(_0x82a8('0x5'))['db'];var utils=require(_0x82a8('0x6'));var logger=require(_0x82a8('0x7'))(_0x82a8('0x8'));var config=require(_0x82a8('0x9'));var jayson=require(_0x82a8('0xa'));var client=jayson[_0x82a8('0xb')]['http']({'port':0x232a});config[_0x82a8('0xc')]=_[_0x82a8('0xd')](config[_0x82a8('0xc')],{'host':_0x82a8('0xe'),'port':0x18eb});var socket=require(_0x82a8('0xf'))(new Redis(config[_0x82a8('0xc')]));require(_0x82a8('0x10'))[_0x82a8('0x11')](socket);function respondWithRpcPromise(_0x2ceb89,_0x4af72f,_0x2d1ff3){return new BPromise(function(_0x51dd77,_0x2e728f){return client[_0x82a8('0x12')](_0x2ceb89,_0x2d1ff3)['then'](function(_0x77c686){logger['info'](_0x82a8('0x13'),_0x4af72f,_0x82a8('0x14'));logger[_0x82a8('0x15')](_0x82a8('0x16'),_0x4af72f,_0x82a8('0x14'),JSON[_0x82a8('0x17')](_0x77c686));if(_0x77c686[_0x82a8('0x18')]){if(_0x77c686[_0x82a8('0x18')][_0x82a8('0x19')]===0x1f4){logger['error'](_0x82a8('0x13'),_0x4af72f,_0x77c686[_0x82a8('0x18')]['message']);return _0x2e728f(_0x77c686[_0x82a8('0x18')][_0x82a8('0x1a')]);}logger[_0x82a8('0x18')](_0x82a8('0x13'),_0x4af72f,_0x77c686[_0x82a8('0x18')][_0x82a8('0x1a')]);return _0x51dd77(_0x77c686[_0x82a8('0x18')][_0x82a8('0x1a')]);}else{logger[_0x82a8('0x1b')](_0x82a8('0x13'),_0x4af72f,_0x82a8('0x14'));_0x51dd77(_0x77c686[_0x82a8('0x1c')]['message']);}})[_0x82a8('0x1d')](function(_0x154de2){logger[_0x82a8('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4af72f,_0x154de2);_0x2e728f(_0x154de2);});});}exports[_0x82a8('0x1e')]=function(_0x1c5b49){var _0x459b5a=this;return new Promise(function(_0x57c569,_0x34d89d){return db[_0x82a8('0x1f')][_0x82a8('0x20')]({'raw':_0x1c5b49[_0x82a8('0x21')]?_0x1c5b49['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c5b49['options']?_0x1c5b49[_0x82a8('0x21')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x82a8('0x22'),db[_0x82a8('0x23')]['fn']('IF',db[_0x82a8('0x23')][_0x82a8('0x24')](_0x82a8('0x25')))),_0x82a8('0x26')]]})[_0x82a8('0x27')](function(_0x3068ce){logger[_0x82a8('0x1b')]('GetVoiceQueueRtPauses',_0x1c5b49);logger[_0x82a8('0x15')](_0x82a8('0x1e'),_0x1c5b49,JSON[_0x82a8('0x17')](_0x3068ce));_0x57c569(_0x3068ce);})[_0x82a8('0x1d')](function(_0x477245){logger['error']('GetVoiceQueueRtPauses',_0x477245[_0x82a8('0x1a')],_0x1c5b49);_0x34d89d(_0x459b5a[_0x82a8('0x18')](0x1f4,_0x477245['message']));});});}; \ No newline at end of file +var _0xd041=['findAll','options','raw','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','GetVoiceQueueRtPauses'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0xd041,0xdc));var _0x1d04=function(_0x12d917,_0x59ddd4){_0x12d917=_0x12d917-0x0;var _0x576d1a=_0xd041[_0x12d917];return _0x576d1a;};'use strict';var _=require('lodash');var util=require(_0x1d04('0x0'));var moment=require(_0x1d04('0x1'));var BPromise=require('bluebird');var rs=require(_0x1d04('0x2'));var fs=require('fs');var Redis=require(_0x1d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d04('0x4'));var logger=require(_0x1d04('0x5'))(_0x1d04('0x6'));var config=require('../../config/environment');var jayson=require(_0x1d04('0x7'));var client=jayson[_0x1d04('0x8')][_0x1d04('0x9')]({'port':0x232a});config[_0x1d04('0xa')]=_[_0x1d04('0xb')](config['redis'],{'host':_0x1d04('0xc'),'port':0x18eb});var socket=require(_0x1d04('0xd'))(new Redis(config[_0x1d04('0xa')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x4df3e2,_0x1b208c,_0x5d10da){return new BPromise(function(_0x5caf49,_0x3c4abc){return client[_0x1d04('0xe')](_0x4df3e2,_0x5d10da)[_0x1d04('0xf')](function(_0x5e689d){logger['info'](_0x1d04('0x10'),_0x1b208c,'request\x20sent');logger[_0x1d04('0x11')](_0x1d04('0x12'),_0x1b208c,'request\x20sent',JSON['stringify'](_0x5e689d));if(_0x5e689d[_0x1d04('0x13')]){if(_0x5e689d[_0x1d04('0x13')]['code']===0x1f4){logger[_0x1d04('0x13')](_0x1d04('0x10'),_0x1b208c,_0x5e689d[_0x1d04('0x13')][_0x1d04('0x14')]);return _0x3c4abc(_0x5e689d[_0x1d04('0x13')][_0x1d04('0x14')]);}logger[_0x1d04('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1b208c,_0x5e689d[_0x1d04('0x13')][_0x1d04('0x14')]);return _0x5caf49(_0x5e689d[_0x1d04('0x13')][_0x1d04('0x14')]);}else{logger[_0x1d04('0x15')](_0x1d04('0x10'),_0x1b208c,_0x1d04('0x16'));_0x5caf49(_0x5e689d[_0x1d04('0x17')]['message']);}})['catch'](function(_0x29c9aa){logger[_0x1d04('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1b208c,_0x29c9aa);_0x3c4abc(_0x29c9aa);});});}exports[_0x1d04('0x18')]=function(_0x5ebed7){var _0x1b4dfe=this;return new Promise(function(_0x357df3,_0x2cf705){return db['UserVoiceQueueRt'][_0x1d04('0x19')]({'raw':_0x5ebed7[_0x1d04('0x1a')]?_0x5ebed7[_0x1d04('0x1a')][_0x1d04('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ebed7[_0x1d04('0x1a')]?_0x5ebed7[_0x1d04('0x1a')][_0x1d04('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x1d04('0x1d'),db[_0x1d04('0x1e')]['fn']('IF',db[_0x1d04('0x1e')]['literal'](_0x1d04('0x1f')))),_0x1d04('0x20')]]})['then'](function(_0x563e3f){logger[_0x1d04('0x15')](_0x1d04('0x18'),_0x5ebed7);logger['debug']('GetVoiceQueueRtPauses',_0x5ebed7,JSON[_0x1d04('0x21')](_0x563e3f));_0x357df3(_0x563e3f);})[_0x1d04('0x22')](function(_0x2a9704){logger['error']('GetVoiceQueueRtPauses',_0x2a9704[_0x1d04('0x14')],_0x5ebed7);_0x2cf705(_0x1b4dfe[_0x1d04('0x13')](0x1f4,_0x2a9704[_0x1d04('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 709bd84..fd01e04 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2d6=['emit','removeListener','userVoiceQueueRt:','save','remove','update'];(function(_0x460387,_0x48ea4a){var _0x2d0d84=function(_0x1edd3f){while(--_0x1edd3f){_0x460387['push'](_0x460387['shift']());}};_0x2d0d84(++_0x48ea4a);}(_0xc2d6,0x171));var _0x6c2d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc2d6[_0x6c993a];return _0x27f547;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x6c2d('0x0'),_0x6c2d('0x1'),_0x6c2d('0x2')];function createListener(_0x36f034,_0x1d92f7){return function(_0x3b94d4){_0x1d92f7[_0x6c2d('0x3')](_0x36f034,_0x3b94d4);};}function removeListener(_0x304229,_0x47057e){return function(){UserVoiceQueueRtEvents[_0x6c2d('0x4')](_0x304229,_0x47057e);};}exports['register']=function(_0x1141f7){for(var _0x3cf33f=0x0,_0x33c7a9=events['length'];_0x3cf33f<_0x33c7a9;_0x3cf33f++){var _0x2595b5=events[_0x3cf33f];var _0x5f5134=createListener(_0x6c2d('0x5')+_0x2595b5,_0x1141f7);UserVoiceQueueRtEvents['on'](_0x2595b5,_0x5f5134);}}; \ No newline at end of file +var _0x96fd=['register','length','userVoiceQueueRt:','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96fd,0x1e9));var _0xd96f=function(_0x2ee9c6,_0x5cd6b7){_0x2ee9c6=_0x2ee9c6-0x0;var _0xef041f=_0x96fd[_0x2ee9c6];return _0xef041f;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xd96f('0x0'),'remove',_0xd96f('0x1')];function createListener(_0x561a45,_0x4b9472){return function(_0x131315){_0x4b9472[_0xd96f('0x2')](_0x561a45,_0x131315);};}function removeListener(_0x44f63c,_0x22b39b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x44f63c,_0x22b39b);};}exports[_0xd96f('0x3')]=function(_0xee38ce){for(var _0x5d65d1=0x0,_0xe6000a=events[_0xd96f('0x4')];_0x5d65d1<_0xe6000a;_0x5d65d1++){var _0x3ae72a=events[_0x5d65d1];var _0xb32b34=createListener(_0xd96f('0x5')+_0x3ae72a,_0xee38ce);UserVoiceQueueRtEvents['on'](_0x3ae72a,_0xb32b34);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 10f638e..a59cff9 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4cd689,_0x12d4ca){var _0x5a9a03=function(_0x48ea01){while(--_0x48ea01){_0x4cd689['push'](_0x4cd689['shift']());}};_0x5a9a03(++_0x12d4ca);}(_0xe706,0xa3));var _0x6e70=function(_0x3a831f,_0x31c8a4){_0x3a831f=_0x3a831f-0x0;var _0x26786c=_0xe706[_0x3a831f];return _0x26786c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x10c634,_0x406922){var _0x57390b=function(_0x2bce24){while(--_0x2bce24){_0x10c634['push'](_0x10c634['shift']());}};_0x57390b(++_0x406922);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index f910644..2457d38 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86c9=['INTEGER'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x86c9,0x100));var _0x986c=function(_0x5831cd,_0x309b94){_0x5831cd=_0x5831cd-0x0;var _0x466ef7=_0x86c9[_0x5831cd];return _0x466ef7;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x986c('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x897b=['sequelize','exports','INTEGER'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x897b,0x90));var _0xb897=function(_0xe59193,_0x46d344){_0xe59193=_0xe59193-0x0;var _0x59e289=_0x897b[_0xe59193];return _0x59e289;};'use strict';var Sequelize=require(_0xb897('0x0'));module[_0xb897('0x1')]={'penalty':{'type':Sequelize[_0xb897('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index c2fb2ae..527b85d 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bfe=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x0bfe,0xe6));var _0xe0bf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0bfe[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe0bf('0x0'));var util=require(_0xe0bf('0x1'));var logger=require(_0xe0bf('0x2'))(_0xe0bf('0x3'));var moment=require(_0xe0bf('0x4'));var BPromise=require(_0xe0bf('0x5'));var rp=require(_0xe0bf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0bf('0x7'));var config=require(_0xe0bf('0x8'));var attributes=require(_0xe0bf('0x9'));module[_0xe0bf('0xa')]=function(_0x2f40d1,_0x29244f){return _0x2f40d1[_0xe0bf('0xb')](_0xe0bf('0xc'),attributes,{'tableName':_0xe0bf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25ed=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','util','api','moment','rimraf'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0x25ed,0xc3));var _0xd25e=function(_0x210ed6,_0x3dffa7){_0x210ed6=_0x210ed6-0x0;var _0x353e65=_0x25ed[_0x210ed6];return _0x353e65;};'use strict';var _=require(_0xd25e('0x0'));var util=require(_0xd25e('0x1'));var logger=require('../../config/logger')(_0xd25e('0x2'));var moment=require(_0xd25e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd25e('0x4'));var config=require(_0xd25e('0x5'));var attributes=require(_0xd25e('0x6'));module[_0xd25e('0x7')]=function(_0x546bf9,_0x5dc37c){return _0x546bf9[_0xd25e('0x8')](_0xd25e('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index fdd9f8e..602b896 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44f6=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch'];(function(_0x23c827,_0x37332a){var _0x3d7f1f=function(_0x3ff0f2){while(--_0x3ff0f2){_0x23c827['push'](_0x23c827['shift']());}};_0x3d7f1f(++_0x37332a);}(_0x44f6,0x13b));var _0x644f=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0x44f6[_0x574ce3];return _0x3447a0;};'use strict';var _=require(_0x644f('0x0'));var util=require('util');var moment=require(_0x644f('0x1'));var BPromise=require(_0x644f('0x2'));var rs=require(_0x644f('0x3'));var fs=require('fs');var Redis=require(_0x644f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x644f('0x5'));var logger=require(_0x644f('0x6'))(_0x644f('0x7'));var config=require(_0x644f('0x8'));var jayson=require(_0x644f('0x9'));var client=jayson[_0x644f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2519ba,_0x3de98b,_0x5588cc){return new BPromise(function(_0x3cddba,_0x1372ac){return client['request'](_0x2519ba,_0x5588cc)[_0x644f('0xb')](function(_0x1faa20){logger[_0x644f('0xc')](_0x644f('0xd'),_0x3de98b,'request\x20sent');logger[_0x644f('0xe')](_0x644f('0xf'),_0x3de98b,'request\x20sent',JSON[_0x644f('0x10')](_0x1faa20));if(_0x1faa20[_0x644f('0x11')]){if(_0x1faa20['error']['code']===0x1f4){logger['error'](_0x644f('0xd'),_0x3de98b,_0x1faa20['error'][_0x644f('0x12')]);return _0x1372ac(_0x1faa20[_0x644f('0x11')][_0x644f('0x12')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x3de98b,_0x1faa20[_0x644f('0x11')]['message']);return _0x3cddba(_0x1faa20[_0x644f('0x11')][_0x644f('0x12')]);}else{logger[_0x644f('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3de98b,_0x644f('0x13'));_0x3cddba(_0x1faa20['result'][_0x644f('0x12')]);}})[_0x644f('0x14')](function(_0x5e6c34){logger[_0x644f('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3de98b,_0x5e6c34);_0x1372ac(_0x5e6c34);});});} \ No newline at end of file +var _0xa618=['http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x281681,_0x30995a){var _0xc5e4c4=function(_0x256f8b){while(--_0x256f8b){_0x281681['push'](_0x281681['shift']());}};_0xc5e4c4(++_0x30995a);}(_0xa618,0x12b));var _0x8a61=function(_0x410e3f,_0x16c26e){_0x410e3f=_0x410e3f-0x0;var _0x131e28=_0xa618[_0x410e3f];return _0x131e28;};'use strict';var _=require(_0x8a61('0x0'));var util=require('util');var moment=require(_0x8a61('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a61('0x2'));var db=require(_0x8a61('0x3'))['db'];var utils=require(_0x8a61('0x4'));var logger=require(_0x8a61('0x5'))(_0x8a61('0x6'));var config=require(_0x8a61('0x7'));var jayson=require(_0x8a61('0x8'));var client=jayson['client'][_0x8a61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42040d,_0x50ad52,_0x3834be){return new BPromise(function(_0x7090aa,_0x15ffaf){return client[_0x8a61('0xa')](_0x42040d,_0x3834be)[_0x8a61('0xb')](function(_0x2fdd6e){logger['info'](_0x8a61('0xc'),_0x50ad52,_0x8a61('0xd'));logger['debug'](_0x8a61('0xe'),_0x50ad52,'request\x20sent',JSON[_0x8a61('0xf')](_0x2fdd6e));if(_0x2fdd6e[_0x8a61('0x10')]){if(_0x2fdd6e[_0x8a61('0x10')][_0x8a61('0x11')]===0x1f4){logger['error'](_0x8a61('0xc'),_0x50ad52,_0x2fdd6e[_0x8a61('0x10')][_0x8a61('0x12')]);return _0x15ffaf(_0x2fdd6e[_0x8a61('0x10')]['message']);}logger[_0x8a61('0x10')](_0x8a61('0xc'),_0x50ad52,_0x2fdd6e[_0x8a61('0x10')]['message']);return _0x7090aa(_0x2fdd6e[_0x8a61('0x10')][_0x8a61('0x12')]);}else{logger[_0x8a61('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x50ad52,_0x8a61('0xd'));_0x7090aa(_0x2fdd6e[_0x8a61('0x14')]['message']);}})[_0x8a61('0x15')](function(_0x1c49d7){logger['error'](_0x8a61('0xc'),_0x50ad52,_0x1c49d7);_0x15ffaf(_0x1c49d7);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index bfc588f..a29a29e 100644 --- a/server/api/variable/index.js +++ b/server/api/variable/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa98d=['put','update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x2d44a6,_0x2f8ce3){var _0x444670=function(_0x2fb63e){while(--_0x2fb63e){_0x2d44a6['push'](_0x2d44a6['shift']());}};_0x444670(++_0x2f8ce3);}(_0xa98d,0xa3));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xda98('0x0'));var util=require('util');var path=require(_0xda98('0x1'));var timeout=require('connect-timeout');var express=require(_0xda98('0x2'));var router=express[_0xda98('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xda98('0x4'));var interaction=require(_0xda98('0x5'));var config=require(_0xda98('0x6'));var controller=require('./variable.controller');router[_0xda98('0x7')]('/',auth[_0xda98('0x8')](),controller[_0xda98('0x9')]);router[_0xda98('0x7')](_0xda98('0xa'),auth[_0xda98('0x8')](),controller['show']);router[_0xda98('0xb')]('/',auth['isAuthenticated'](),controller[_0xda98('0xc')]);router[_0xda98('0xd')]('/:id',auth[_0xda98('0x8')](),controller[_0xda98('0xe')]);router['delete'](_0xda98('0xa'),auth[_0xda98('0x8')](),controller[_0xda98('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe57e=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./variable.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0xe57e,0xf2));var _0xee57=function(_0x3a7e45,_0x1a1a14){_0x3a7e45=_0x3a7e45-0x0;var _0x4782e9=_0xe57e[_0x3a7e45];return _0x4782e9;};'use strict';var multer=require(_0xee57('0x0'));var util=require('util');var path=require(_0xee57('0x1'));var timeout=require(_0xee57('0x2'));var express=require(_0xee57('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xee57('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xee57('0x5'));var controller=require(_0xee57('0x6'));router[_0xee57('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee57('0x7')](_0xee57('0x8'),auth[_0xee57('0x9')](),controller[_0xee57('0xa')]);router[_0xee57('0xb')]('/',auth[_0xee57('0x9')](),controller[_0xee57('0xc')]);router['put']('/:id',auth[_0xee57('0x9')](),controller[_0xee57('0xd')]);router[_0xee57('0xe')](_0xee57('0x8'),auth[_0xee57('0x9')](),controller[_0xee57('0xf')]);module[_0xee57('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 7ccb8a8..299ae8e 100644 --- a/server/api/variable/variable.attributes.js +++ b/server/api/variable/variable.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdf3=['exports','STRING'];(function(_0xb59e7f,_0x1d9a99){var _0x3fea4c=function(_0x3d73e9){while(--_0x3d73e9){_0xb59e7f['push'](_0xb59e7f['shift']());}};_0x3fea4c(++_0x1d9a99);}(_0xbdf3,0x10a));var _0x3bdf=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0xbdf3[_0x5a6de2];return _0x2c0525;};'use strict';var Sequelize=require('sequelize');module[_0x3bdf('0x0')]={'name':{'type':Sequelize[_0x3bdf('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3bdf('0x1')]}}; \ No newline at end of file +var _0x88ea=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x88ea,0x110));var _0xa88e=function(_0x3da6a8,_0x19fb8f){_0x3da6a8=_0x3da6a8-0x0;var _0x487df4=_0x88ea[_0x3da6a8];return _0x487df4;};'use strict';var Sequelize=require('sequelize');module[_0xa88e('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa88e('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f550bef..3394616 100644 --- a/server/api/variable/variable.controller.js +++ b/server/api/variable/variable.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x984b=['fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','get','Variables','UserProfileResource','stack','name','send','index','map','Variable','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x984b,0xb9));var _0xb984=function(_0x1c14f7,_0x5489bb){_0x1c14f7=_0x1c14f7-0x0;var _0x29e505=_0x984b[_0x1c14f7];return _0x29e505;};'use strict';var emlformat=require(_0xb984('0x0'));var rimraf=require(_0xb984('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb984('0x2'));var rp=require('request-promise');var moment=require(_0xb984('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb984('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb984('0x5'));var ejs=require(_0xb984('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb984('0x7'));var squel=require(_0xb984('0x8'));var crypto=require(_0xb984('0x9'));var jsforce=require(_0xb984('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb984('0x5'));var querystring=require('querystring');var Papa=require(_0xb984('0xb'));var Redis=require(_0xb984('0xc'));var authService=require(_0xb984('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb984('0xe'));var hardwareService=require(_0xb984('0xf'));var logger=require(_0xb984('0x10'))(_0xb984('0x11'));var utils=require('../../config/utils');var config=require(_0xb984('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xb984('0x13'))['db'];function respondWithStatusCode(_0x21268e,_0xa3380b){_0xa3380b=_0xa3380b||0xcc;return function(_0x3ae6c3){if(_0x3ae6c3){return _0x21268e[_0xb984('0x14')](_0xa3380b);}return _0x21268e[_0xb984('0x15')](_0xa3380b)[_0xb984('0x16')]();};}function respondWithResult(_0x32f75b,_0x3d19f2){_0x3d19f2=_0x3d19f2||0xc8;return function(_0x41ae6c){if(_0x41ae6c){return _0x32f75b['status'](_0x3d19f2)[_0xb984('0x17')](_0x41ae6c);}};}function respondWithFilteredResult(_0x5d3a01,_0x2797c9){return function(_0x1c5fc4){if(_0x1c5fc4){var _0x1af682=typeof _0x2797c9[_0xb984('0x18')]===_0xb984('0x19')&&typeof _0x2797c9[_0xb984('0x1a')]===_0xb984('0x19');var _0x339806=_0x1c5fc4[_0xb984('0x1b')];var _0x3f958a=_0x1af682?0x0:_0x2797c9[_0xb984('0x18')];var _0x2d1cdc=_0x1af682?_0x1c5fc4['count']:_0x2797c9[_0xb984('0x18')]+_0x2797c9[_0xb984('0x1a')];var _0x4ccd22;if(_0x2d1cdc>=_0x339806){_0x2d1cdc=_0x339806;_0x4ccd22=0xc8;}else{_0x4ccd22=0xce;}_0x5d3a01[_0xb984('0x15')](_0x4ccd22);return _0x5d3a01[_0xb984('0x1c')](_0xb984('0x1d'),_0x3f958a+'-'+_0x2d1cdc+'/'+_0x339806)[_0xb984('0x17')](_0x1c5fc4);}return null;};}function patchUpdates(_0x465099){return function(_0x1339cc){try{jsonpatch['apply'](_0x1339cc,_0x465099,!![]);}catch(_0x5efb46){return BPromise['reject'](_0x5efb46);}return _0x1339cc[_0xb984('0x1e')]();};}function saveUpdates(_0x1d6b80,_0xa744e5){return function(_0x43315f){if(_0x43315f){return _0x43315f[_0xb984('0x1f')](_0x1d6b80)['then'](function(_0x5ed241){return _0x5ed241;});}return null;};}function removeEntity(_0x471a06,_0x322155){return function(_0x333256){if(_0x333256){return _0x333256[_0xb984('0x20')]()[_0xb984('0x21')](function(){var _0x1c9d6c=_0x333256[_0xb984('0x22')]({'plain':!![]});var _0x5c9395=_0xb984('0x23');return db[_0xb984('0x24')][_0xb984('0x20')]({'where':{'type':_0x5c9395,'resourceId':_0x1c9d6c['id']}})[_0xb984('0x21')](function(){return _0x333256;});})[_0xb984('0x21')](function(){_0x471a06[_0xb984('0x15')](0xcc)[_0xb984('0x16')]();});}};}function handleEntityNotFound(_0x1444e3,_0x486b98){return function(_0x451d32){if(!_0x451d32){_0x1444e3[_0xb984('0x14')](0x194);}return _0x451d32;};}function handleError(_0x3a05f8,_0x200da8){_0x200da8=_0x200da8||0x1f4;return function(_0x428d37){logger['error'](_0x428d37[_0xb984('0x25')]);if(_0x428d37[_0xb984('0x26')]){delete _0x428d37[_0xb984('0x26')];}_0x3a05f8[_0xb984('0x15')](_0x200da8)[_0xb984('0x27')](_0x428d37);};}exports[_0xb984('0x28')]=function(_0x5c5638,_0x506109){var _0x1bc8da={},_0x50a14c={},_0x3d36b5={'count':0x0,'rows':[]};var _0x2eab8f=_[_0xb984('0x29')](db[_0xb984('0x2a')]['rawAttributes'],function(_0x5cfd8f){return{'name':_0x5cfd8f[_0xb984('0x2b')],'type':_0x5cfd8f[_0xb984('0x2c')][_0xb984('0x2d')]};});_0x50a14c[_0xb984('0x2e')]=_[_0xb984('0x29')](_0x2eab8f,'name');_0x50a14c[_0xb984('0x2f')]=_[_0xb984('0x30')](_0x5c5638[_0xb984('0x2f')]);_0x50a14c[_0xb984('0x31')]=_[_0xb984('0x32')](_0x50a14c[_0xb984('0x2e')],_0x50a14c[_0xb984('0x2f')]);_0x1bc8da[_0xb984('0x33')]=_[_0xb984('0x32')](_0x50a14c['model'],qs[_0xb984('0x34')](_0x5c5638[_0xb984('0x2f')][_0xb984('0x34')]));_0x1bc8da[_0xb984('0x33')]=_0x1bc8da[_0xb984('0x33')]['length']?_0x1bc8da[_0xb984('0x33')]:_0x50a14c[_0xb984('0x2e')];if(!_0x5c5638['query']['hasOwnProperty'](_0xb984('0x35'))){_0x1bc8da['limit']=qs[_0xb984('0x1a')](_0x5c5638[_0xb984('0x2f')][_0xb984('0x1a')]);_0x1bc8da[_0xb984('0x18')]=qs[_0xb984('0x18')](_0x5c5638[_0xb984('0x2f')][_0xb984('0x18')]);}_0x1bc8da[_0xb984('0x36')]=qs['sort'](_0x5c5638[_0xb984('0x2f')][_0xb984('0x37')]);_0x1bc8da['where']=qs[_0xb984('0x31')](_[_0xb984('0x38')](_0x5c5638[_0xb984('0x2f')],_0x50a14c[_0xb984('0x31')]),_0x2eab8f);if(_0x5c5638[_0xb984('0x2f')][_0xb984('0x39')]){_0x1bc8da[_0xb984('0x3a')]=_['merge'](_0x1bc8da['where'],{'$or':_[_0xb984('0x29')](_0x2eab8f,function(_0x360d80){if(_0x360d80['type']!==_0xb984('0x3b')){var _0x36847e={};_0x36847e[_0x360d80[_0xb984('0x26')]]={'$like':'%'+_0x5c5638[_0xb984('0x2f')]['filter']+'%'};return _0x36847e;}})});}_0x1bc8da=_[_0xb984('0x3c')]({},_0x1bc8da,_0x5c5638[_0xb984('0x3d')]);var _0x37d04d={'where':_0x1bc8da[_0xb984('0x3a')]};return db[_0xb984('0x2a')][_0xb984('0x1b')](_0x37d04d)[_0xb984('0x21')](function(_0x12dbc9){_0x3d36b5['count']=_0x12dbc9;if(_0x5c5638[_0xb984('0x2f')][_0xb984('0x3e')]){_0x1bc8da[_0xb984('0x3f')]=[{'all':!![]}];}return db['Variable'][_0xb984('0x40')](_0x1bc8da);})['then'](function(_0x37e715){_0x3d36b5[_0xb984('0x41')]=_0x37e715;return _0x3d36b5;})[_0xb984('0x21')](respondWithFilteredResult(_0x506109,_0x1bc8da))[_0xb984('0x42')](handleError(_0x506109,null));};exports[_0xb984('0x43')]=function(_0x4df0db,_0x20a9c1){var _0x2c28ce={'raw':!![],'where':{'id':_0x4df0db[_0xb984('0x44')]['id']}},_0x23686c={};_0x23686c[_0xb984('0x2e')]=_[_0xb984('0x30')](db[_0xb984('0x2a')]['rawAttributes']);_0x23686c['query']=_['keys'](_0x4df0db[_0xb984('0x2f')]);_0x23686c[_0xb984('0x31')]=_[_0xb984('0x32')](_0x23686c[_0xb984('0x2e')],_0x23686c['query']);_0x2c28ce[_0xb984('0x33')]=_[_0xb984('0x32')](_0x23686c['model'],qs[_0xb984('0x34')](_0x4df0db[_0xb984('0x2f')][_0xb984('0x34')]));_0x2c28ce[_0xb984('0x33')]=_0x2c28ce[_0xb984('0x33')]['length']?_0x2c28ce[_0xb984('0x33')]:_0x23686c[_0xb984('0x2e')];if(_0x4df0db[_0xb984('0x2f')][_0xb984('0x3e')]){_0x2c28ce[_0xb984('0x3f')]=[{'all':!![]}];}_0x2c28ce=_[_0xb984('0x3c')]({},_0x2c28ce,_0x4df0db[_0xb984('0x3d')]);return db[_0xb984('0x2a')][_0xb984('0x45')](_0x2c28ce)[_0xb984('0x21')](handleEntityNotFound(_0x20a9c1,null))['then'](respondWithResult(_0x20a9c1,null))[_0xb984('0x42')](handleError(_0x20a9c1,null));};exports['create']=function(_0x4ef774,_0x2fe0e6){return db[_0xb984('0x2a')]['create'](_0x4ef774[_0xb984('0x46')],{})[_0xb984('0x21')](function(_0x2c29b1){var _0x10df4=_0x4ef774[_0xb984('0x47')][_0xb984('0x22')]({'plain':!![]});if(!_0x10df4)throw new Error(_0xb984('0x48'));if(_0x10df4[_0xb984('0x49')]==='user'){var _0x17faca=_0x2c29b1['get']({'plain':!![]});var _0x4f1ada='Variables';return db[_0xb984('0x4a')][_0xb984('0x45')]({'where':{'name':_0x4f1ada,'userProfileId':_0x10df4[_0xb984('0x4b')]},'raw':!![]})[_0xb984('0x21')](function(_0x130df8){if(_0x130df8&&_0x130df8[_0xb984('0x4c')]===0x0){return db[_0xb984('0x24')]['create']({'name':_0x17faca[_0xb984('0x26')],'resourceId':_0x17faca['id'],'type':_0x130df8['name'],'sectionId':_0x130df8['id']},{})['then'](function(){return _0x2c29b1;});}else{return _0x2c29b1;}})['catch'](function(_0x47e080){logger[_0xb984('0x4d')](_0xb984('0x4e'),_0x47e080);throw _0x47e080;});}return _0x2c29b1;})[_0xb984('0x21')](respondWithResult(_0x2fe0e6,0xc9))[_0xb984('0x42')](handleError(_0x2fe0e6,null));};exports[_0xb984('0x1f')]=function(_0x4399df,_0x26eb84){if(_0x4399df[_0xb984('0x46')]['id']){delete _0x4399df[_0xb984('0x46')]['id'];}return db[_0xb984('0x2a')][_0xb984('0x45')]({'where':{'id':_0x4399df[_0xb984('0x44')]['id']}})[_0xb984('0x21')](handleEntityNotFound(_0x26eb84,null))[_0xb984('0x21')](saveUpdates(_0x4399df[_0xb984('0x46')],null))[_0xb984('0x21')](respondWithResult(_0x26eb84,null))['catch'](handleError(_0x26eb84,null));};exports[_0xb984('0x20')]=function(_0x499270,_0x82758f){return db[_0xb984('0x2a')][_0xb984('0x45')]({'where':{'id':_0x499270[_0xb984('0x44')]['id']}})[_0xb984('0x21')](handleEntityNotFound(_0x82758f,null))[_0xb984('0x21')](removeEntity(_0x82758f,null))[_0xb984('0x42')](handleError(_0x82758f,null));}; \ No newline at end of file +var _0x1a59=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Variables','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','moment'];(function(_0x3a77d,_0x392a9e){var _0x28bbdb=function(_0x2b6396){while(--_0x2b6396){_0x3a77d['push'](_0x3a77d['shift']());}};_0x28bbdb(++_0x392a9e);}(_0x1a59,0x1de));var _0x91a5=function(_0x44fc3f,_0x4774d1){_0x44fc3f=_0x44fc3f-0x0;var _0x926ba3=_0x1a59[_0x44fc3f];return _0x926ba3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x91a5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x91a5('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x91a5('0x2'));var sox=require(_0x91a5('0x3'));var csv=require(_0x91a5('0x4'));var ejs=require(_0x91a5('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91a5('0x6'));var squel=require(_0x91a5('0x7'));var crypto=require(_0x91a5('0x8'));var jsforce=require(_0x91a5('0x9'));var deskjs=require(_0x91a5('0xa'));var toCsv=require(_0x91a5('0x4'));var querystring=require(_0x91a5('0xb'));var Papa=require('papaparse');var Redis=require(_0x91a5('0xc'));var authService=require(_0x91a5('0xd'));var qs=require(_0x91a5('0xe'));var as=require(_0x91a5('0xf'));var hardwareService=require(_0x91a5('0x10'));var logger=require(_0x91a5('0x11'))(_0x91a5('0x12'));var utils=require(_0x91a5('0x13'));var config=require(_0x91a5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56f0f9,_0x506d0d){_0x506d0d=_0x506d0d||0xcc;return function(_0x11ee4c){if(_0x11ee4c){return _0x56f0f9[_0x91a5('0x15')](_0x506d0d);}return _0x56f0f9[_0x91a5('0x16')](_0x506d0d)[_0x91a5('0x17')]();};}function respondWithResult(_0x4fbb29,_0x455411){_0x455411=_0x455411||0xc8;return function(_0x513809){if(_0x513809){return _0x4fbb29[_0x91a5('0x16')](_0x455411)['json'](_0x513809);}};}function respondWithFilteredResult(_0x49dd34,_0x4c16cc){return function(_0x3e4d3d){if(_0x3e4d3d){var _0x90553a=typeof _0x4c16cc[_0x91a5('0x18')]===_0x91a5('0x19')&&typeof _0x4c16cc[_0x91a5('0x1a')]===_0x91a5('0x19');var _0x251a8d=_0x3e4d3d[_0x91a5('0x1b')];var _0x461d39=_0x90553a?0x0:_0x4c16cc[_0x91a5('0x18')];var _0x31dd21=_0x90553a?_0x3e4d3d[_0x91a5('0x1b')]:_0x4c16cc['offset']+_0x4c16cc[_0x91a5('0x1a')];var _0xc9903d;if(_0x31dd21>=_0x251a8d){_0x31dd21=_0x251a8d;_0xc9903d=0xc8;}else{_0xc9903d=0xce;}_0x49dd34[_0x91a5('0x16')](_0xc9903d);return _0x49dd34['set'](_0x91a5('0x1c'),_0x461d39+'-'+_0x31dd21+'/'+_0x251a8d)[_0x91a5('0x1d')](_0x3e4d3d);}return null;};}function patchUpdates(_0x2281f7){return function(_0x46a63c){try{jsonpatch[_0x91a5('0x1e')](_0x46a63c,_0x2281f7,!![]);}catch(_0x5715e3){return BPromise[_0x91a5('0x1f')](_0x5715e3);}return _0x46a63c[_0x91a5('0x20')]();};}function saveUpdates(_0x1cbce9,_0xdfab21){return function(_0x6ccccb){if(_0x6ccccb){return _0x6ccccb[_0x91a5('0x21')](_0x1cbce9)[_0x91a5('0x22')](function(_0x515913){return _0x515913;});}return null;};}function removeEntity(_0x36af32,_0xe6ecc9){return function(_0x4eef34){if(_0x4eef34){return _0x4eef34[_0x91a5('0x23')]()[_0x91a5('0x22')](function(){var _0x120216=_0x4eef34[_0x91a5('0x24')]({'plain':!![]});var _0x434fec=_0x91a5('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x434fec,'resourceId':_0x120216['id']}})[_0x91a5('0x22')](function(){return _0x4eef34;});})['then'](function(){_0x36af32[_0x91a5('0x16')](0xcc)[_0x91a5('0x17')]();});}};}function handleEntityNotFound(_0x2bb9db,_0x466c92){return function(_0x2b443f){if(!_0x2b443f){_0x2bb9db[_0x91a5('0x15')](0x194);}return _0x2b443f;};}function handleError(_0x53db49,_0x28df84){_0x28df84=_0x28df84||0x1f4;return function(_0xcd4638){logger[_0x91a5('0x26')](_0xcd4638[_0x91a5('0x27')]);if(_0xcd4638['name']){delete _0xcd4638[_0x91a5('0x28')];}_0x53db49['status'](_0x28df84)[_0x91a5('0x29')](_0xcd4638);};}exports[_0x91a5('0x2a')]=function(_0x4ce668,_0x434b47){var _0x142813={},_0x4afee8={},_0x51ce7f={'count':0x0,'rows':[]};var _0x62b62a=_['map'](db[_0x91a5('0x2b')][_0x91a5('0x2c')],function(_0x1ffe22){return{'name':_0x1ffe22[_0x91a5('0x2d')],'type':_0x1ffe22[_0x91a5('0x2e')]['key']};});_0x4afee8[_0x91a5('0x2f')]=_[_0x91a5('0x30')](_0x62b62a,_0x91a5('0x28'));_0x4afee8[_0x91a5('0x31')]=_[_0x91a5('0x32')](_0x4ce668[_0x91a5('0x31')]);_0x4afee8[_0x91a5('0x33')]=_[_0x91a5('0x34')](_0x4afee8[_0x91a5('0x2f')],_0x4afee8[_0x91a5('0x31')]);_0x142813[_0x91a5('0x35')]=_[_0x91a5('0x34')](_0x4afee8[_0x91a5('0x2f')],qs[_0x91a5('0x36')](_0x4ce668[_0x91a5('0x31')][_0x91a5('0x36')]));_0x142813[_0x91a5('0x35')]=_0x142813['attributes'][_0x91a5('0x37')]?_0x142813[_0x91a5('0x35')]:_0x4afee8[_0x91a5('0x2f')];if(!_0x4ce668['query'][_0x91a5('0x38')](_0x91a5('0x39'))){_0x142813[_0x91a5('0x1a')]=qs['limit'](_0x4ce668[_0x91a5('0x31')]['limit']);_0x142813[_0x91a5('0x18')]=qs[_0x91a5('0x18')](_0x4ce668[_0x91a5('0x31')]['offset']);}_0x142813[_0x91a5('0x3a')]=qs[_0x91a5('0x3b')](_0x4ce668['query'][_0x91a5('0x3b')]);_0x142813[_0x91a5('0x3c')]=qs[_0x91a5('0x33')](_[_0x91a5('0x3d')](_0x4ce668[_0x91a5('0x31')],_0x4afee8['filters']),_0x62b62a);if(_0x4ce668['query'][_0x91a5('0x3e')]){_0x142813[_0x91a5('0x3c')]=_[_0x91a5('0x3f')](_0x142813[_0x91a5('0x3c')],{'$or':_[_0x91a5('0x30')](_0x62b62a,function(_0x429d94){if(_0x429d94[_0x91a5('0x2e')]!=='VIRTUAL'){var _0x4a8a9a={};_0x4a8a9a[_0x429d94[_0x91a5('0x28')]]={'$like':'%'+_0x4ce668['query'][_0x91a5('0x3e')]+'%'};return _0x4a8a9a;}})});}_0x142813=_[_0x91a5('0x3f')]({},_0x142813,_0x4ce668[_0x91a5('0x40')]);var _0x243be5={'where':_0x142813[_0x91a5('0x3c')]};return db[_0x91a5('0x2b')][_0x91a5('0x1b')](_0x243be5)['then'](function(_0x5a5b0e){_0x51ce7f['count']=_0x5a5b0e;if(_0x4ce668[_0x91a5('0x31')]['includeAll']){_0x142813[_0x91a5('0x41')]=[{'all':!![]}];}return db['Variable'][_0x91a5('0x42')](_0x142813);})[_0x91a5('0x22')](function(_0x49f651){_0x51ce7f['rows']=_0x49f651;return _0x51ce7f;})[_0x91a5('0x22')](respondWithFilteredResult(_0x434b47,_0x142813))[_0x91a5('0x43')](handleError(_0x434b47,null));};exports[_0x91a5('0x44')]=function(_0x499815,_0x27f48a){var _0x5729c3={'raw':!![],'where':{'id':_0x499815[_0x91a5('0x45')]['id']}},_0x4e672a={};_0x4e672a[_0x91a5('0x2f')]=_['keys'](db[_0x91a5('0x2b')]['rawAttributes']);_0x4e672a[_0x91a5('0x31')]=_[_0x91a5('0x32')](_0x499815[_0x91a5('0x31')]);_0x4e672a[_0x91a5('0x33')]=_['intersection'](_0x4e672a[_0x91a5('0x2f')],_0x4e672a['query']);_0x5729c3[_0x91a5('0x35')]=_[_0x91a5('0x34')](_0x4e672a[_0x91a5('0x2f')],qs[_0x91a5('0x36')](_0x499815[_0x91a5('0x31')][_0x91a5('0x36')]));_0x5729c3['attributes']=_0x5729c3[_0x91a5('0x35')][_0x91a5('0x37')]?_0x5729c3[_0x91a5('0x35')]:_0x4e672a[_0x91a5('0x2f')];if(_0x499815[_0x91a5('0x31')]['includeAll']){_0x5729c3[_0x91a5('0x41')]=[{'all':!![]}];}_0x5729c3=_[_0x91a5('0x3f')]({},_0x5729c3,_0x499815[_0x91a5('0x40')]);return db['Variable']['find'](_0x5729c3)[_0x91a5('0x22')](handleEntityNotFound(_0x27f48a,null))['then'](respondWithResult(_0x27f48a,null))['catch'](handleError(_0x27f48a,null));};exports[_0x91a5('0x46')]=function(_0x32a604,_0x322488){return db[_0x91a5('0x2b')][_0x91a5('0x46')](_0x32a604[_0x91a5('0x47')],{})[_0x91a5('0x22')](function(_0x53e33a){var _0x6177ea=_0x32a604[_0x91a5('0x48')]['get']({'plain':!![]});if(!_0x6177ea)throw new Error(_0x91a5('0x49'));if(_0x6177ea[_0x91a5('0x4a')]==='user'){var _0x8e0f=_0x53e33a[_0x91a5('0x24')]({'plain':!![]});var _0x532dcd=_0x91a5('0x25');return db[_0x91a5('0x4b')]['find']({'where':{'name':_0x532dcd,'userProfileId':_0x6177ea[_0x91a5('0x4c')]},'raw':!![]})[_0x91a5('0x22')](function(_0x1c7ded){if(_0x1c7ded&&_0x1c7ded['autoAssociation']===0x0){return db[_0x91a5('0x4d')]['create']({'name':_0x8e0f[_0x91a5('0x28')],'resourceId':_0x8e0f['id'],'type':_0x1c7ded['name'],'sectionId':_0x1c7ded['id']},{})[_0x91a5('0x22')](function(){return _0x53e33a;});}else{return _0x53e33a;}})[_0x91a5('0x43')](function(_0x3a4fd5){logger[_0x91a5('0x26')](_0x91a5('0x4e'),_0x3a4fd5);throw _0x3a4fd5;});}return _0x53e33a;})[_0x91a5('0x22')](respondWithResult(_0x322488,0xc9))[_0x91a5('0x43')](handleError(_0x322488,null));};exports[_0x91a5('0x21')]=function(_0x54b89c,_0x4c6a07){if(_0x54b89c['body']['id']){delete _0x54b89c[_0x91a5('0x47')]['id'];}return db[_0x91a5('0x2b')][_0x91a5('0x4f')]({'where':{'id':_0x54b89c[_0x91a5('0x45')]['id']}})[_0x91a5('0x22')](handleEntityNotFound(_0x4c6a07,null))[_0x91a5('0x22')](saveUpdates(_0x54b89c[_0x91a5('0x47')],null))['then'](respondWithResult(_0x4c6a07,null))['catch'](handleError(_0x4c6a07,null));};exports[_0x91a5('0x23')]=function(_0x13bc51,_0x4757f5){return db['Variable'][_0x91a5('0x4f')]({'where':{'id':_0x13bc51['params']['id']}})['then'](handleEntityNotFound(_0x4757f5,null))[_0x91a5('0x22')](removeEntity(_0x4757f5,null))['catch'](handleError(_0x4757f5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index bb4e747..40677e3 100644 --- a/server/api/variable/variable.model.js +++ b/server/api/variable/variable.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69a2=['tools_variables','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable'];(function(_0x36f20f,_0x3558ab){var _0x39334c=function(_0x7c80c){while(--_0x7c80c){_0x36f20f['push'](_0x36f20f['shift']());}};_0x39334c(++_0x3558ab);}(_0x69a2,0x1a1));var _0x269a=function(_0x491188,_0x473223){_0x491188=_0x491188-0x0;var _0x30310a=_0x69a2[_0x491188];return _0x30310a;};'use strict';var _=require(_0x269a('0x0'));var util=require('util');var logger=require(_0x269a('0x1'))(_0x269a('0x2'));var moment=require(_0x269a('0x3'));var BPromise=require(_0x269a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x269a('0x5'));var rimraf=require(_0x269a('0x6'));var config=require(_0x269a('0x7'));var attributes=require(_0x269a('0x8'));module[_0x269a('0x9')]=function(_0x20f512,_0x592a71){return _0x20f512[_0x269a('0xa')](_0x269a('0xb'),attributes,{'tableName':_0x269a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bd4=['bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','util','../../config/logger','moment'];(function(_0x31f15b,_0xa486f7){var _0x15e504=function(_0x137b00){while(--_0x137b00){_0x31f15b['push'](_0x31f15b['shift']());}};_0x15e504(++_0xa486f7);}(_0x8bd4,0x142));var _0x48bd=function(_0x7e4858,_0x298cce){_0x7e4858=_0x7e4858-0x0;var _0x52ec9c=_0x8bd4[_0x7e4858];return _0x52ec9c;};'use strict';var _=require('lodash');var util=require(_0x48bd('0x0'));var logger=require(_0x48bd('0x1'))('api');var moment=require(_0x48bd('0x2'));var BPromise=require(_0x48bd('0x3'));var rp=require(_0x48bd('0x4'));var fs=require('fs');var path=require(_0x48bd('0x5'));var rimraf=require(_0x48bd('0x6'));var config=require(_0x48bd('0x7'));var attributes=require(_0x48bd('0x8'));module[_0x48bd('0x9')]=function(_0x5d8efd,_0x93f839){return _0x5d8efd[_0x48bd('0xa')](_0x48bd('0xb'),attributes,{'tableName':_0x48bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 2d2bce8..9cb08ef 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x4d9a48,_0x20bc50){var _0xef464d=function(_0x30e968){while(--_0x30e968){_0x4d9a48['push'](_0x4d9a48['shift']());}};_0xef464d(++_0x20bc50);}(_0x1cb9,0x14e));var _0x91cb=function(_0x266834,_0x3d5f49){_0x266834=_0x266834-0x0;var _0x5834c7=_0x1cb9[_0x266834];return _0x5834c7;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x4e85c4,_0x447081){var _0x48b799=function(_0x13c2ce){while(--_0x13c2ce){_0x4e85c4['push'](_0x4e85c4['shift']());}};_0x48b799(++_0x447081);}(_0x55ca,0x126));var _0xa55c=function(_0x29379a,_0x16b64f){_0x29379a=_0x29379a-0x0;var _0x125b52=_0x55ca[_0x29379a];return _0x125b52;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index eec096d..74390f7 100644 --- a/server/api/version/index.js +++ b/server/api/version/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec19=['/fetch','isAuthenticated','fetch','canUpdate','reset','/pull','pull','restart','exports','express','Router','../../components/auth/service','./version.controller','get','index'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xec19,0x1bc));var _0x9ec1=function(_0x35e931,_0x1b2c90){_0x35e931=_0x35e931-0x0;var _0x4fe0ad=_0xec19[_0x35e931];return _0x4fe0ad;};'use strict';var express=require(_0x9ec1('0x0'));var router=express[_0x9ec1('0x1')]();var auth=require(_0x9ec1('0x2'));var controller=require(_0x9ec1('0x3'));router[_0x9ec1('0x4')]('/',controller[_0x9ec1('0x5')]);router[_0x9ec1('0x4')](_0x9ec1('0x6'),auth[_0x9ec1('0x7')](),auth['canUpdate'](),controller[_0x9ec1('0x8')]);router[_0x9ec1('0x4')]('/reset',auth[_0x9ec1('0x7')](),auth[_0x9ec1('0x9')](),controller[_0x9ec1('0xa')]);router['get'](_0x9ec1('0xb'),auth[_0x9ec1('0x7')](),auth[_0x9ec1('0x9')](),controller[_0x9ec1('0xc')]);router['get']('/restart',auth[_0x9ec1('0x7')](),controller[_0x9ec1('0xd')]);router[_0x9ec1('0x4')]('/migrations',controller['migrations']);module[_0x9ec1('0xe')]=router; \ No newline at end of file +var _0x7f02=['/fetch','isAuthenticated','/reset','canUpdate','/pull','/restart','restart','exports','./version.controller','get','index'];(function(_0x5972de,_0x2b786b){var _0x5d1f41=function(_0x3f2901){while(--_0x3f2901){_0x5972de['push'](_0x5972de['shift']());}};_0x5d1f41(++_0x2b786b);}(_0x7f02,0x152));var _0x27f0=function(_0x52f73a,_0x4418dd){_0x52f73a=_0x52f73a-0x0;var _0x4b5d40=_0x7f02[_0x52f73a];return _0x4b5d40;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x27f0('0x0'));router[_0x27f0('0x1')]('/',controller[_0x27f0('0x2')]);router['get'](_0x27f0('0x3'),auth[_0x27f0('0x4')](),auth['canUpdate'](),controller['fetch']);router[_0x27f0('0x1')](_0x27f0('0x5'),auth['isAuthenticated'](),auth[_0x27f0('0x6')](),controller['reset']);router['get'](_0x27f0('0x7'),auth[_0x27f0('0x4')](),auth[_0x27f0('0x6')](),controller['pull']);router[_0x27f0('0x1')](_0x27f0('0x8'),auth['isAuthenticated'](),controller[_0x27f0('0x9')]);router[_0x27f0('0x1')]('/migrations',controller['migrations']);module[_0x27f0('0xa')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a1a72d8..676451f 100644 --- a/server/api/version/version.controller.js +++ b/server/api/version/version.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b9e=['../../config/logger','simple-git','root','index','exports','query','tags','version','2.0.0','status','json','fetch','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','../../mysqldb','../../config/environment','../../config/pm2'];(function(_0xe2b8fc,_0x3ec76a){var _0x1bfefb=function(_0x11e1ec){while(--_0x11e1ec){_0xe2b8fc['push'](_0xe2b8fc['shift']());}};_0x1bfefb(++_0x3ec76a);}(_0x7b9e,0x10c));var _0xe7b9=function(_0xac9995,_0x28da64){_0xac9995=_0xac9995-0x0;var _0x369a26=_0x7b9e[_0xac9995];return _0x369a26;};'use strict';var Umzug=require(_0xe7b9('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xe7b9('0x1'));var pkginfo=require(_0xe7b9('0x2'))(module,'version');var compareVersions=require(_0xe7b9('0x3'));var exec=require('child_process')['exec'];var db=require(_0xe7b9('0x4'))['db'];var config=require(_0xe7b9('0x5'));var pm2=require(_0xe7b9('0x6'));var logger=require(_0xe7b9('0x7'))('update');var git=require(_0xe7b9('0x8'))(config[_0xe7b9('0x9')]);exports[_0xe7b9('0xa')]=function(_0x4c193d,_0xe48f3f){var _0x51c09d={'current':module[_0xe7b9('0xb')]['version'],'phonebar':0x2};if(_0x4c193d[_0xe7b9('0xc')]&&_0x4c193d[_0xe7b9('0xc')]['latest']){return git['fetch']()[_0xe7b9('0xd')](function(_0x2d8b3e,_0x1b7d65){_0x51c09d['latest']=(_0x2d8b3e?module[_0xe7b9('0xb')][_0xe7b9('0xe')]:_0x1b7d65['latest'])||_0xe7b9('0xf');return _0xe48f3f[_0xe7b9('0x10')](0xc8)[_0xe7b9('0x11')](_0x51c09d);});}else{return _0xe48f3f['status'](0xc8)[_0xe7b9('0x11')](_0x51c09d);}};exports[_0xe7b9('0x12')]=function(_0x2a86ae,_0x456093){return git[_0xe7b9('0x12')](['origin',_0xe7b9('0x13')],function(_0x509121){if(_0x509121){logger[_0xe7b9('0x14')](_0x509121);return _0x456093[_0xe7b9('0x10')](0x1f4)[_0xe7b9('0x11')](_0x509121);}logger['info'](_0xe7b9('0x15'));return _0x456093['status'](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x16')});});};exports[_0xe7b9('0x17')]=function(_0x422602,_0x4d442f){return git[_0xe7b9('0x17')]([_0xe7b9('0x18'),_0xe7b9('0x19')],function(_0x2ba0f7){if(_0x2ba0f7){logger['error'](_0x2ba0f7);return _0x4d442f[_0xe7b9('0x10')](0x1f4)[_0xe7b9('0x11')](_0x2ba0f7);}logger[_0xe7b9('0x1a')](_0xe7b9('0x1b'));return _0x4d442f[_0xe7b9('0x10')](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x1c')});});};exports[_0xe7b9('0x1d')]=function(_0x381285,_0x49ea87){exec(_0xe7b9('0x1e'),function(_0x55d641,_0x4a5bc4,_0x16163b){logger['info'](_0x4a5bc4);logger['info'](_0x16163b);if(_0x55d641){logger[_0xe7b9('0x14')](_0x55d641);return _0x49ea87['status'](0x1f4)[_0xe7b9('0x11')](_0x55d641);}return _0x49ea87[_0xe7b9('0x10')](0xc8)[_0xe7b9('0x11')]({'output':_0x4a5bc4});});};exports[_0xe7b9('0x1f')]=function(_0x5715c0,_0xf6b4aa){return pm2[_0xe7b9('0x1f')](_0xe7b9('0x20'))[_0xe7b9('0x21')](function(_0xccf68d){logger[_0xe7b9('0x1a')](_0xe7b9('0x22'),_0xccf68d);return _0xf6b4aa[_0xe7b9('0x10')](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x23')});})[_0xe7b9('0x24')](function(_0x506917){logger['error'](_0x506917);return _0xf6b4aa[_0xe7b9('0x10')](0x1f4)[_0xe7b9('0x11')](_0x506917);});};exports[_0xe7b9('0x25')]=function(_0x2ebe55,_0x22ecb2){var _0x20464c=fs['readdirSync'](path[_0xe7b9('0x26')](config[_0xe7b9('0x9')],'server',_0xe7b9('0x25')));var _0x3ca1dd=[];for(var _0x1134e8=0x0;_0x1134e8<_0x20464c[_0xe7b9('0x27')];_0x1134e8++){var _0x25b982=_0x20464c[_0x1134e8][_0xe7b9('0x28')](_0xe7b9('0x29'),'');if(compareVersions(module[_0xe7b9('0xb')][_0xe7b9('0xe')],_0x25b982)===-0x1){_0x3ca1dd['push'](_0x25b982);}}if(_0x3ca1dd[_0xe7b9('0x27')]){var _0xeb349f=_0x3ca1dd[_0xe7b9('0x2a')](compareVersions);var _0x5b54ec=new Umzug({'storage':_0xe7b9('0x2b'),'storageOptions':{'model':db[_0xe7b9('0x2c')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xe7b9('0x2b')][_0xe7b9('0x2d')](),db[_0xe7b9('0x2b')][_0xe7b9('0x2e')],function(){throw new Error(_0xe7b9('0x2f'));}],'path':path[_0xe7b9('0x26')](config[_0xe7b9('0x9')],_0xe7b9('0x30'),'migrations'),'pattern':/\.js$/}});_0x5b54ec['up']({'migrations':_[_0xe7b9('0x31')](_0xeb349f,function(_0x34a4e4){return _0x34a4e4+_0xe7b9('0x29');})})[_0xe7b9('0x21')](function(){return _0x22ecb2['status'](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x32')+module[_0xe7b9('0xb')]['version']+_0xe7b9('0x33')+_[_0xe7b9('0x34')](_0xeb349f),'migrations':_[_0xe7b9('0x26')](_0xeb349f)});})[_0xe7b9('0x24')](function(_0x310a56){if(_0x310a56 instanceof db[_0xe7b9('0x2b')][_0xe7b9('0x35')]){return _0x22ecb2[_0xe7b9('0x10')](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x36')});}else{return _0x22ecb2['status'](0x1f4)[_0xe7b9('0x11')](_0x310a56);}});}else{return _0x22ecb2['status'](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x36')});}}; \ No newline at end of file +var _0x1a76=['pull','restart','then','migrations','readdirSync','join','root','server','length','replace','.js','push','sort','Migration','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','exec','../../config/pm2','../../config/logger','update','simple-git','exports','query','tags','latest','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0x1a76,0xac));var _0x61a7=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1a76[_0x6c993a];return _0x27f547;};'use strict';var Umzug=require(_0x61a7('0x0'));var path=require(_0x61a7('0x1'));var fs=require('fs');var _=require(_0x61a7('0x2'));var pkginfo=require('pkginfo')(module,_0x61a7('0x3'));var compareVersions=require(_0x61a7('0x4'));var exec=require('child_process')[_0x61a7('0x5')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x61a7('0x6'));var logger=require(_0x61a7('0x7'))(_0x61a7('0x8'));var git=require(_0x61a7('0x9'))(config['root']);exports['index']=function(_0x240f2e,_0x2512cb){var _0x171c82={'current':module[_0x61a7('0xa')][_0x61a7('0x3')],'phonebar':0x2};if(_0x240f2e['query']&&_0x240f2e[_0x61a7('0xb')]['latest']){return git['fetch']()[_0x61a7('0xc')](function(_0x1abbcf,_0x53b760){_0x171c82[_0x61a7('0xd')]=(_0x1abbcf?module['exports'][_0x61a7('0x3')]:_0x53b760[_0x61a7('0xd')])||_0x61a7('0xe');return _0x2512cb[_0x61a7('0xf')](0xc8)[_0x61a7('0x10')](_0x171c82);});}else{return _0x2512cb[_0x61a7('0xf')](0xc8)[_0x61a7('0x10')](_0x171c82);}};exports['fetch']=function(_0x588692,_0x47468d){return git[_0x61a7('0x11')]([_0x61a7('0x12'),_0x61a7('0x13')],function(_0xfc08ea){if(_0xfc08ea){logger[_0x61a7('0x14')](_0xfc08ea);return _0x47468d['status'](0x1f4)[_0x61a7('0x10')](_0xfc08ea);}logger[_0x61a7('0x15')](_0x61a7('0x16'));return _0x47468d['status'](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x61a7('0x17')]=function(_0x455883,_0xe4cbf){return git['reset']([_0x61a7('0x18'),_0x61a7('0x19')],function(_0x43efff){if(_0x43efff){logger[_0x61a7('0x14')](_0x43efff);return _0xe4cbf[_0x61a7('0xf')](0x1f4)[_0x61a7('0x10')](_0x43efff);}logger[_0x61a7('0x15')](_0x61a7('0x1a'));return _0xe4cbf[_0x61a7('0xf')](0xc8)[_0x61a7('0x10')]({'output':_0x61a7('0x1b')});});};exports[_0x61a7('0x1c')]=function(_0x17d7ea,_0x1846ae){exec('npm\x20install\x20--production',function(_0x5c0530,_0x278566,_0xc3ec94){logger[_0x61a7('0x15')](_0x278566);logger[_0x61a7('0x15')](_0xc3ec94);if(_0x5c0530){logger['error'](_0x5c0530);return _0x1846ae[_0x61a7('0xf')](0x1f4)[_0x61a7('0x10')](_0x5c0530);}return _0x1846ae['status'](0xc8)[_0x61a7('0x10')]({'output':_0x278566});});};exports[_0x61a7('0x1d')]=function(_0xfaded3,_0x5d7446){return pm2[_0x61a7('0x1d')]('motion2')[_0x61a7('0x1e')](function(_0x135715){logger[_0x61a7('0x15')]('pm2\x20restart\x20motion\x20%s',_0x135715);return _0x5d7446[_0x61a7('0xf')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x1da05b){logger['error'](_0x1da05b);return _0x5d7446['status'](0x1f4)[_0x61a7('0x10')](_0x1da05b);});};exports[_0x61a7('0x1f')]=function(_0x5cf7df,_0x39d501){var _0x8806df=fs[_0x61a7('0x20')](path[_0x61a7('0x21')](config[_0x61a7('0x22')],_0x61a7('0x23'),_0x61a7('0x1f')));var _0xbe073f=[];for(var _0x4bd18e=0x0;_0x4bd18e<_0x8806df[_0x61a7('0x24')];_0x4bd18e++){var _0x316898=_0x8806df[_0x4bd18e][_0x61a7('0x25')](_0x61a7('0x26'),'');if(compareVersions(module[_0x61a7('0xa')][_0x61a7('0x3')],_0x316898)===-0x1){_0xbe073f[_0x61a7('0x27')](_0x316898);}}if(_0xbe073f['length']){var _0x383f06=_0xbe073f[_0x61a7('0x28')](compareVersions);var _0x582b5f=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x61a7('0x29')],'modelName':_0x61a7('0x29'),'columnName':_0x61a7('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x61a7('0x2a')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x61a7('0x21')](config[_0x61a7('0x22')],_0x61a7('0x23'),_0x61a7('0x1f')),'pattern':/\.js$/}});_0x582b5f['up']({'migrations':_[_0x61a7('0x2b')](_0x383f06,function(_0x4d71cc){return _0x4d71cc+_0x61a7('0x26');})})['then'](function(){return _0x39d501[_0x61a7('0xf')](0xc8)[_0x61a7('0x10')]({'output':_0x61a7('0x2c')+module['exports']['version']+_0x61a7('0x2d')+_[_0x61a7('0x2e')](_0x383f06),'migrations':_['join'](_0x383f06)});})[_0x61a7('0x2f')](function(_0xd8122c){if(_0xd8122c instanceof db['sequelize'][_0x61a7('0x30')]){return _0x39d501[_0x61a7('0xf')](0xc8)[_0x61a7('0x10')]({'output':_0x61a7('0x31')});}else{return _0x39d501['status'](0x1f4)[_0x61a7('0x10')](_0xd8122c);}});}else{return _0x39d501[_0x61a7('0xf')](0xc8)[_0x61a7('0x10')]({'output':_0x61a7('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index fce0c1b..b2e0a1c 100644 --- a/server/api/voiceAgentReport/index.js +++ b/server/api/voiceAgentReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb191=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','post','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xb191,0x1d8));var _0x1b19=function(_0x3fc761,_0x1f657e){_0x3fc761=_0x3fc761-0x0;var _0x2e4f45=_0xb191[_0x3fc761];return _0x2e4f45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b19('0x0'));var timeout=require(_0x1b19('0x1'));var express=require(_0x1b19('0x2'));var router=express[_0x1b19('0x3')]();var fs_extra=require(_0x1b19('0x4'));var auth=require(_0x1b19('0x5'));var interaction=require(_0x1b19('0x6'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x1b19('0x7')]('/',auth[_0x1b19('0x8')](),controller['index']);router[_0x1b19('0x7')](_0x1b19('0x9'),auth['isAuthenticated'](),controller[_0x1b19('0xa')]);router[_0x1b19('0x7')]('/:id',auth[_0x1b19('0x8')](),controller[_0x1b19('0xb')]);router[_0x1b19('0xc')]('/',auth[_0x1b19('0x8')](),controller['create']);router[_0x1b19('0xd')]('/:id',auth[_0x1b19('0x8')](),controller[_0x1b19('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1b19('0xf')]);module[_0x1b19('0x10')]=router; \ No newline at end of file +var _0xf289=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0xa9f2cc,_0x3cb961){var _0x2753c2=function(_0x40d8d5){while(--_0x40d8d5){_0xa9f2cc['push'](_0xa9f2cc['shift']());}};_0x2753c2(++_0x3cb961);}(_0xf289,0x1bc));var _0x9f28=function(_0x49976b,_0x5e6bde){_0x49976b=_0x49976b-0x0;var _0x6edea0=_0xf289[_0x49976b];return _0x6edea0;};'use strict';var multer=require(_0x9f28('0x0'));var util=require(_0x9f28('0x1'));var path=require('path');var timeout=require(_0x9f28('0x2'));var express=require(_0x9f28('0x3'));var router=express[_0x9f28('0x4')]();var fs_extra=require(_0x9f28('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9f28('0x6'));var controller=require(_0x9f28('0x7'));router[_0x9f28('0x8')]('/',auth[_0x9f28('0x9')](),controller[_0x9f28('0xa')]);router['get'](_0x9f28('0xb'),auth[_0x9f28('0x9')](),controller[_0x9f28('0xc')]);router[_0x9f28('0x8')](_0x9f28('0xd'),auth[_0x9f28('0x9')](),controller['show']);router[_0x9f28('0xe')]('/',auth['isAuthenticated'](),controller[_0x9f28('0xf')]);router[_0x9f28('0x10')](_0x9f28('0xd'),auth[_0x9f28('0x9')](),controller[_0x9f28('0x11')]);router[_0x9f28('0x12')](_0x9f28('0xd'),auth['isAuthenticated'](),controller[_0x9f28('0x13')]);module[_0x9f28('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 0b9424d..a908a3e 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3609=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x212462,_0x2bb92c){var _0x47a35d=function(_0x9513dd){while(--_0x9513dd){_0x212462['push'](_0x212462['shift']());}};_0x47a35d(++_0x2bb92c);}(_0x3609,0x101));var _0x9360=function(_0x48d5ec,_0x30a089){_0x48d5ec=_0x48d5ec-0x0;var _0x3a4414=_0x3609[_0x48d5ec];return _0x3a4414;};'use strict';var Sequelize=require(_0x9360('0x0'));module[_0x9360('0x1')]={'type':{'type':Sequelize[_0x9360('0x2')]},'uniqueid':{'type':Sequelize[_0x9360('0x2')]},'calleridnum':{'type':Sequelize[_0x9360('0x2')]},'calleridname':{'type':Sequelize[_0x9360('0x2')]},'queue':{'type':Sequelize[_0x9360('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9360('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9360('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9360('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x9360('0x4')]},'agentcomplete':{'type':Sequelize[_0x9360('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9360('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9360('0x4')]},'agentacw':{'type':Sequelize[_0x9360('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9360('0x4')]},'reason':{'type':Sequelize[_0x9360('0x2')]},'lastevent':{'type':Sequelize[_0x9360('0x2')]},'channel':{'type':Sequelize[_0x9360('0x2')]},'channelstate':{'type':Sequelize[_0x9360('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9360('0x2')]},'language':{'type':Sequelize[_0x9360('0x2')]},'accountcode':{'type':Sequelize[_0x9360('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9360('0x2')]},'priority':{'type':Sequelize[_0x9360('0x2')]},'destchannel':{'type':Sequelize[_0x9360('0x2')]},'destchannelstate':{'type':Sequelize[_0x9360('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x9360('0x2')]},'destcalleridnum':{'type':Sequelize[_0x9360('0x2')]},'destcalleridname':{'type':Sequelize[_0x9360('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9360('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9360('0x2')]},'destexten':{'type':Sequelize[_0x9360('0x2')]},'destpriority':{'type':Sequelize[_0x9360('0x2')]},'destuniqueid':{'type':Sequelize[_0x9360('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x9360('0x2')]},'transfer':{'type':Sequelize[_0x9360('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9360('0x2')],'comment':_0x9360('0x6')},'transferexten':{'type':Sequelize[_0x9360('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9360('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x390a=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x53efa4,_0x1e673b){var _0x276274=function(_0x5a0479){while(--_0x5a0479){_0x53efa4['push'](_0x53efa4['shift']());}};_0x276274(++_0x1e673b);}(_0x390a,0xc9));var _0xa390=function(_0x194d49,_0x4f93fb){_0x194d49=_0x194d49-0x0;var _0x49b6db=_0x390a[_0x194d49];return _0x49b6db;};'use strict';var Sequelize=require(_0xa390('0x0'));module[_0xa390('0x1')]={'type':{'type':Sequelize[_0xa390('0x2')]},'uniqueid':{'type':Sequelize[_0xa390('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa390('0x2')]},'queue':{'type':Sequelize[_0xa390('0x2')]},'interface':{'type':Sequelize[_0xa390('0x2')]},'membername':{'type':Sequelize[_0xa390('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xa390('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xa390('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xa390('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xa390('0x4')]},'agentcomplete':{'type':Sequelize[_0xa390('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa390('0x4')]},'agentacw':{'type':Sequelize[_0xa390('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa390('0x4')]},'reason':{'type':Sequelize[_0xa390('0x2')]},'lastevent':{'type':Sequelize[_0xa390('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa390('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa390('0x2')]},'connectedlinename':{'type':Sequelize[_0xa390('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa390('0x2')]},'context':{'type':Sequelize[_0xa390('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa390('0x2')]},'destchannel':{'type':Sequelize[_0xa390('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa390('0x2')]},'destcalleridname':{'type':Sequelize[_0xa390('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa390('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xa390('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xa390('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa390('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xa390('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa390('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xa390('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xa390('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index cbc5aef..cdb84c0 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 6dc538d..5c2683c 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.model.js +++ b/server/api/voiceAgentReport/voiceAgentReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99c9=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api'];(function(_0x6adec3,_0x3d264a){var _0xf68ec2=function(_0x54a2c1){while(--_0x54a2c1){_0x6adec3['push'](_0x6adec3['shift']());}};_0xf68ec2(++_0x3d264a);}(_0x99c9,0x13c));var _0x999c=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x99c9[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var logger=require(_0x999c('0x2'))(_0x999c('0x3'));var moment=require(_0x999c('0x4'));var BPromise=require(_0x999c('0x5'));var rp=require(_0x999c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x999c('0x7'));var config=require(_0x999c('0x8'));var attributes=require(_0x999c('0x9'));module[_0x999c('0xa')]=function(_0x2bdd73,_0x14df32){return _0x2bdd73[_0x999c('0xb')](_0x999c('0xc'),attributes,{'tableName':_0x999c('0xd'),'paranoid':![],'indexes':[{'fields':[_0x999c('0xe'),_0x999c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c46=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','api','request-promise'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8c46,0x171));var _0x68c4=function(_0x1b2c11,_0x2eac9f){_0x1b2c11=_0x1b2c11-0x0;var _0x46cca9=_0x8c46[_0x1b2c11];return _0x46cca9;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x68c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68c4('0x2'));var fs=require('fs');var path=require(_0x68c4('0x3'));var rimraf=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var attributes=require(_0x68c4('0x6'));module[_0x68c4('0x7')]=function(_0x40ce21,_0x1516cf){return _0x40ce21[_0x68c4('0x8')](_0x68c4('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x68c4('0xa'),_0x68c4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 3455e4c..ffe2ace 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.rpc.js +++ b/server/api/voiceAgentReport/voiceAgentReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2cc=['error','message','info','result','catch','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x56899b,_0x80fce){var _0x47d591=function(_0x23d7cf){while(--_0x23d7cf){_0x56899b['push'](_0x56899b['shift']());}};_0x47d591(++_0x80fce);}(_0xf2cc,0xb4));var _0xcf2c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf2cc[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xcf2c('0x0'));var util=require(_0xcf2c('0x1'));var moment=require(_0xcf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf2c('0x3'));var fs=require('fs');var Redis=require(_0xcf2c('0x4'));var db=require(_0xcf2c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf2c('0x6'))(_0xcf2c('0x7'));var config=require(_0xcf2c('0x8'));var jayson=require(_0xcf2c('0x9'));var client=jayson[_0xcf2c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57f2a6,_0x481122,_0x47a339){return new BPromise(function(_0x2ce0bf,_0x1f1e01){return client['request'](_0x57f2a6,_0x47a339)[_0xcf2c('0xb')](function(_0x46d6b8){logger['info'](_0xcf2c('0xc'),_0x481122,_0xcf2c('0xd'));logger[_0xcf2c('0xe')](_0xcf2c('0xf'),_0x481122,_0xcf2c('0xd'),JSON[_0xcf2c('0x10')](_0x46d6b8));if(_0x46d6b8['error']){if(_0x46d6b8['error'][_0xcf2c('0x11')]===0x1f4){logger[_0xcf2c('0x12')](_0xcf2c('0xc'),_0x481122,_0x46d6b8[_0xcf2c('0x12')][_0xcf2c('0x13')]);return _0x1f1e01(_0x46d6b8[_0xcf2c('0x12')][_0xcf2c('0x13')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x481122,_0x46d6b8[_0xcf2c('0x12')][_0xcf2c('0x13')]);return _0x2ce0bf(_0x46d6b8[_0xcf2c('0x12')][_0xcf2c('0x13')]);}else{logger[_0xcf2c('0x14')](_0xcf2c('0xc'),_0x481122,_0xcf2c('0xd'));_0x2ce0bf(_0x46d6b8[_0xcf2c('0x15')]['message']);}})[_0xcf2c('0x16')](function(_0x4b932d){logger[_0xcf2c('0x12')](_0xcf2c('0xc'),_0x481122,_0x4b932d);_0x1f1e01(_0x4b932d);});});}exports['CreateVoiceAgentReport']=function(_0x4d6fc3){var _0x3a1150=this;return new Promise(function(_0x50f2a3,_0x3c3e68){return db[_0xcf2c('0x17')][_0xcf2c('0x18')](_0x4d6fc3[_0xcf2c('0x19')],{'raw':_0x4d6fc3[_0xcf2c('0x1a')]?_0x4d6fc3[_0xcf2c('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x56c2d9){logger[_0xcf2c('0x14')](_0xcf2c('0x1b'),_0x4d6fc3);logger[_0xcf2c('0xe')](_0xcf2c('0x1b'),_0x4d6fc3,JSON[_0xcf2c('0x10')](_0x56c2d9));_0x50f2a3(_0x56c2d9);})['catch'](function(_0x4e898f){logger[_0xcf2c('0x12')]('CreateVoiceAgentReport',_0x4e898f[_0xcf2c('0x13')],_0x4d6fc3);_0x3c3e68(_0x3a1150[_0xcf2c('0x12')](0x1f4,_0x4e898f[_0xcf2c('0x13')]));});});};exports[_0xcf2c('0x1c')]=function(_0x285270){var _0x1e6a76=this;return new Promise(function(_0x1da4df,_0x30546){return db[_0xcf2c('0x17')][_0xcf2c('0x1d')](_0x285270['body'],{'raw':_0x285270['options']?_0x285270['options'][_0xcf2c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285270[_0xcf2c('0x1a')]?_0x285270[_0xcf2c('0x1a')][_0xcf2c('0x1f')]||null:null,'attributes':_0x285270[_0xcf2c('0x1a')]?_0x285270[_0xcf2c('0x1a')][_0xcf2c('0x20')]||null:null,'limit':_0x285270[_0xcf2c('0x1a')]?_0x285270[_0xcf2c('0x1a')]['limit']||null:null})[_0xcf2c('0xb')](function(_0x34f583){logger[_0xcf2c('0x14')](_0xcf2c('0x1c'),_0x285270);logger[_0xcf2c('0xe')](_0xcf2c('0x1c'),_0x285270,JSON[_0xcf2c('0x10')](_0x34f583));_0x1da4df(_0x34f583);})[_0xcf2c('0x16')](function(_0x3cbcdd){logger[_0xcf2c('0x12')](_0xcf2c('0x1c'),_0x3cbcdd[_0xcf2c('0x13')],_0x285270);_0x30546(_0x1e6a76['error'](0x1f4,_0x3cbcdd[_0xcf2c('0x13')]));});});}; \ No newline at end of file +var _0xd9ee=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd9ee,0xc9));var _0xed9e=function(_0x17765f,_0x26c400){_0x17765f=_0x17765f-0x0;var _0x106a69=_0xd9ee[_0x17765f];return _0x106a69;};'use strict';var _=require(_0xed9e('0x0'));var util=require(_0xed9e('0x1'));var moment=require(_0xed9e('0x2'));var BPromise=require(_0xed9e('0x3'));var rs=require(_0xed9e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed9e('0x5'))['db'];var utils=require(_0xed9e('0x6'));var logger=require(_0xed9e('0x7'))(_0xed9e('0x8'));var config=require(_0xed9e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x241120,_0x10aea5,_0x10fc2e){return new BPromise(function(_0x3042d6,_0x439d96){return client[_0xed9e('0xb')](_0x241120,_0x10fc2e)[_0xed9e('0xc')](function(_0x1beab3){logger[_0xed9e('0xd')](_0xed9e('0xe'),_0x10aea5,_0xed9e('0xf'));logger[_0xed9e('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x10aea5,_0xed9e('0xf'),JSON[_0xed9e('0x11')](_0x1beab3));if(_0x1beab3[_0xed9e('0x12')]){if(_0x1beab3[_0xed9e('0x12')][_0xed9e('0x13')]===0x1f4){logger[_0xed9e('0x12')](_0xed9e('0xe'),_0x10aea5,_0x1beab3['error']['message']);return _0x439d96(_0x1beab3[_0xed9e('0x12')][_0xed9e('0x14')]);}logger[_0xed9e('0x12')](_0xed9e('0xe'),_0x10aea5,_0x1beab3['error'][_0xed9e('0x14')]);return _0x3042d6(_0x1beab3[_0xed9e('0x12')][_0xed9e('0x14')]);}else{logger['info'](_0xed9e('0xe'),_0x10aea5,_0xed9e('0xf'));_0x3042d6(_0x1beab3[_0xed9e('0x15')][_0xed9e('0x14')]);}})[_0xed9e('0x16')](function(_0x3b8fc2){logger[_0xed9e('0x12')](_0xed9e('0xe'),_0x10aea5,_0x3b8fc2);_0x439d96(_0x3b8fc2);});});}exports[_0xed9e('0x17')]=function(_0x3f69ac){var _0x418081=this;return new Promise(function(_0x1ee08a,_0x1625d5){return db[_0xed9e('0x18')][_0xed9e('0x19')](_0x3f69ac[_0xed9e('0x1a')],{'raw':_0x3f69ac['options']?_0x3f69ac[_0xed9e('0x1b')][_0xed9e('0x1c')]===undefined?!![]:![]:!![]})[_0xed9e('0xc')](function(_0x2a48b8){logger['info'](_0xed9e('0x17'),_0x3f69ac);logger[_0xed9e('0x10')]('CreateVoiceAgentReport',_0x3f69ac,JSON['stringify'](_0x2a48b8));_0x1ee08a(_0x2a48b8);})[_0xed9e('0x16')](function(_0x5134ae){logger[_0xed9e('0x12')](_0xed9e('0x17'),_0x5134ae[_0xed9e('0x14')],_0x3f69ac);_0x1625d5(_0x418081[_0xed9e('0x12')](0x1f4,_0x5134ae[_0xed9e('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x473134){var _0x36d9f9=this;return new Promise(function(_0xcbce06,_0x599443){return db['VoiceAgentReport'][_0xed9e('0x1d')](_0x473134[_0xed9e('0x1a')],{'raw':_0x473134['options']?_0x473134['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x473134[_0xed9e('0x1b')]?_0x473134[_0xed9e('0x1b')][_0xed9e('0x1e')]||null:null,'attributes':_0x473134[_0xed9e('0x1b')]?_0x473134[_0xed9e('0x1b')][_0xed9e('0x1f')]||null:null,'limit':_0x473134['options']?_0x473134[_0xed9e('0x1b')][_0xed9e('0x20')]||null:null})[_0xed9e('0xc')](function(_0x5dd7bb){logger[_0xed9e('0xd')](_0xed9e('0x21'),_0x473134);logger[_0xed9e('0x10')](_0xed9e('0x21'),_0x473134,JSON[_0xed9e('0x11')](_0x5dd7bb));_0xcbce06(_0x5dd7bb);})['catch'](function(_0x2337d6){logger[_0xed9e('0x12')]('UpdateVoiceAgentReport',_0x2337d6[_0xed9e('0x14')],_0x473134);_0x599443(_0x36d9f9[_0xed9e('0x12')](0x1f4,_0x2337d6[_0xed9e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index b7cc87f..816747b 100644 --- a/server/api/voiceCallReport/index.js +++ b/server/api/voiceCallReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf69d=['./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf69d,0xd3));var _0xdf69=function(_0xbd3b11,_0x4fb444){_0xbd3b11=_0xbd3b11-0x0;var _0x56128a=_0xf69d[_0xbd3b11];return _0x56128a;};'use strict';var multer=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var path=require(_0xdf69('0x2'));var timeout=require(_0xdf69('0x3'));var express=require(_0xdf69('0x4'));var router=express['Router']();var fs_extra=require(_0xdf69('0x5'));var auth=require(_0xdf69('0x6'));var interaction=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var controller=require(_0xdf69('0x9'));router[_0xdf69('0xa')]('/',auth[_0xdf69('0xb')](),controller[_0xdf69('0xc')]);router[_0xdf69('0xa')](_0xdf69('0xd'),auth[_0xdf69('0xb')](),controller[_0xdf69('0xe')]);router[_0xdf69('0xa')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x10')]);router[_0xdf69('0x11')]('/',auth['isAuthenticated'](),controller[_0xdf69('0x12')]);router[_0xdf69('0x13')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x14')]);router[_0xdf69('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc3b5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports','path','connect-timeout','express'];(function(_0x364ae3,_0x4c9102){var _0x2c2028=function(_0x57f86b){while(--_0x57f86b){_0x364ae3['push'](_0x364ae3['shift']());}};_0x2c2028(++_0x4c9102);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x7bd3ef,_0x158e45){_0x7bd3ef=_0x7bd3ef-0x0;var _0xcc04f=_0xc3b5[_0x7bd3ef];return _0xcc04f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var fs_extra=require(_0x5c3b('0x4'));var auth=require(_0x5c3b('0x5'));var interaction=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var controller=require('./voiceCallReport.controller');router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0xa'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xb')]);router['get'](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xd')]);router[_0x5c3b('0xe')]('/',auth['isAuthenticated'](),controller[_0x5c3b('0xf')]);router[_0x5c3b('0x10')](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0x11')]);router['delete'](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller['destroy']);module[_0x5c3b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index d44bbd3..7b4ab27 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6edc=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','outbound','inbound-fax','outbound-fax'];(function(_0x2bb896,_0x2d6e41){var _0x320cd6=function(_0x2d328b){while(--_0x2d328b){_0x2bb896['push'](_0x2bb896['shift']());}};_0x320cd6(++_0x2d6e41);}(_0x6edc,0x138));var _0xc6ed=function(_0x4d79d7,_0x2cf4e0){_0x4d79d7=_0x4d79d7-0x0;var _0x4c2f47=_0x6edc[_0x4d79d7];return _0x4c2f47;};'use strict';var Sequelize=require(_0xc6ed('0x0'));module[_0xc6ed('0x1')]={'uniqueid':{'type':Sequelize[_0xc6ed('0x2')]},'type':{'type':Sequelize[_0xc6ed('0x3')]('inbound','internal',_0xc6ed('0x4'),_0xc6ed('0x5'),_0xc6ed('0x6'),_0xc6ed('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc6ed('0x2')]},'source':{'type':Sequelize[_0xc6ed('0x2')]},'destination':{'type':Sequelize[_0xc6ed('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc6ed('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xc6ed('0x2')]},'lastapplication':{'type':Sequelize[_0xc6ed('0x2')]},'lastdata':{'type':Sequelize[_0xc6ed('0x8')]},'starttime':{'type':Sequelize[_0xc6ed('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc6ed('0x9')]},'endtime':{'type':Sequelize[_0xc6ed('0x9')]},'duration':{'type':Sequelize[_0xc6ed('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc6ed('0x2')]},'amaflags':{'type':Sequelize[_0xc6ed('0x2')]},'userfield':{'type':Sequelize[_0xc6ed('0x2')]},'userDisposition':{'type':Sequelize[_0xc6ed('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xc6ed('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc6ed('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xc6ed('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xca91=['STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x176ea8,_0x30b013){var _0x40e5b3=function(_0x50470c){while(--_0x50470c){_0x176ea8['push'](_0x176ea8['shift']());}};_0x40e5b3(++_0x30b013);}(_0xca91,0x1d2));var _0x1ca9=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xca91[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require(_0x1ca9('0x0'));module[_0x1ca9('0x1')]={'uniqueid':{'type':Sequelize[_0x1ca9('0x2')]},'type':{'type':Sequelize[_0x1ca9('0x3')](_0x1ca9('0x4'),_0x1ca9('0x5'),_0x1ca9('0x6'),_0x1ca9('0x7'),_0x1ca9('0x8'),_0x1ca9('0x9'))},'tag':{'type':Sequelize[_0x1ca9('0x2')]},'accountcode':{'type':Sequelize[_0x1ca9('0x2')]},'source':{'type':Sequelize[_0x1ca9('0x2')]},'destination':{'type':Sequelize[_0x1ca9('0x2')]},'destinationcontext':{'type':Sequelize[_0x1ca9('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1ca9('0x2')]},'destinationchannel':{'type':Sequelize[_0x1ca9('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x1ca9('0xa')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x1ca9('0xb')]},'answertime':{'type':Sequelize[_0x1ca9('0xb')]},'endtime':{'type':Sequelize[_0x1ca9('0xb')]},'duration':{'type':Sequelize[_0x1ca9('0xc')]},'billableseconds':{'type':Sequelize[_0x1ca9('0xc')]},'mohtime':{'type':Sequelize[_0x1ca9('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x1ca9('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x1ca9('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x1ca9('0x2')]},'note':{'type':Sequelize[_0x1ca9('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x1ca9('0xc')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 742cb44..1ecb7f2 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x561134,_0x287a49){_0x561134=_0x561134-0x0;var _0x5587f3=_0x5f2f[_0x561134];return _0x5587f3;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x569ad3,_0x53ba0f){var _0x300d43=function(_0x4782f0){while(--_0x4782f0){_0x569ad3['push'](_0x569ad3['shift']());}};_0x300d43(++_0x53ba0f);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fc583,_0x1c9563){_0x4fc583=_0x4fc583-0x0;var _0x3b884d=_0xb10b[_0x4fc583];return _0x3b884d;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 73457e2..880140f 100644 --- a/server/api/voiceCallReport/voiceCallReport.model.js +++ b/server/api/voiceCallReport/voiceCallReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8393=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid'];(function(_0x42e4d7,_0x4bd202){var _0x346cd8=function(_0x36c0f6){while(--_0x36c0f6){_0x42e4d7['push'](_0x42e4d7['shift']());}};_0x346cd8(++_0x4bd202);}(_0x8393,0x1e1));var _0x3839=function(_0x864751,_0x3efea3){_0x864751=_0x864751-0x0;var _0x4d61ab=_0x8393[_0x864751];return _0x4d61ab;};'use strict';var _=require(_0x3839('0x0'));var util=require(_0x3839('0x1'));var logger=require(_0x3839('0x2'))(_0x3839('0x3'));var moment=require('moment');var BPromise=require(_0x3839('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3839('0x5'));var rimraf=require(_0x3839('0x6'));var config=require(_0x3839('0x7'));var attributes=require(_0x3839('0x8'));module[_0x3839('0x9')]=function(_0xbec458,_0x1303d3){return _0xbec458[_0x3839('0xa')]('VoiceCallReport',attributes,{'tableName':_0x3839('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3839('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb76c=['define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports'];(function(_0x1b959e,_0x5b2d5f){var _0xa5ecea=function(_0x447b07){while(--_0x447b07){_0x1b959e['push'](_0x1b959e['shift']());}};_0xa5ecea(++_0x5b2d5f);}(_0xb76c,0x74));var _0xcb76=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xb76c[_0x44a64f];return _0x52024b;};'use strict';var _=require('lodash');var util=require(_0xcb76('0x0'));var logger=require(_0xcb76('0x1'))(_0xcb76('0x2'));var moment=require(_0xcb76('0x3'));var BPromise=require(_0xcb76('0x4'));var rp=require(_0xcb76('0x5'));var fs=require('fs');var path=require(_0xcb76('0x6'));var rimraf=require(_0xcb76('0x7'));var config=require('../../config/environment');var attributes=require(_0xcb76('0x8'));module[_0xcb76('0x9')]=function(_0x3155c8,_0x28e27d){return _0x3155c8[_0xcb76('0xa')](_0xcb76('0xb'),attributes,{'tableName':_0xcb76('0xc'),'paranoid':![],'indexes':[{'fields':[_0xcb76('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 3fa6a04..e2c9756 100644 --- a/server/api/voiceCallReport/voiceCallReport.rpc.js +++ b/server/api/voiceCallReport/voiceCallReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf595=['VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','raw','options','attributes','map','include','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0xd9d0bf,_0x522d1f){var _0x4c809f=function(_0x554610){while(--_0x554610){_0xd9d0bf['push'](_0xd9d0bf['shift']());}};_0x4c809f(++_0x522d1f);}(_0xf595,0x68));var _0x5f59=function(_0x2a93f0,_0x1f8fb7){_0x2a93f0=_0x2a93f0-0x0;var _0x439217=_0xf595[_0x2a93f0];return _0x439217;};'use strict';var _=require(_0x5f59('0x0'));var util=require(_0x5f59('0x1'));var moment=require(_0x5f59('0x2'));var BPromise=require(_0x5f59('0x3'));var rs=require(_0x5f59('0x4'));var fs=require('fs');var Redis=require(_0x5f59('0x5'));var db=require(_0x5f59('0x6'))['db'];var utils=require(_0x5f59('0x7'));var logger=require(_0x5f59('0x8'))(_0x5f59('0x9'));var config=require('../../config/environment');var jayson=require(_0x5f59('0xa'));var client=jayson[_0x5f59('0xb')][_0x5f59('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x423c84,_0x474120,_0x45e46d){return new BPromise(function(_0x32a9ba,_0x2bc644){return client[_0x5f59('0xd')](_0x423c84,_0x45e46d)[_0x5f59('0xe')](function(_0x5bb208){logger[_0x5f59('0xf')](_0x5f59('0x10'),_0x474120,'request\x20sent');logger[_0x5f59('0x11')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x474120,_0x5f59('0x12'),JSON[_0x5f59('0x13')](_0x5bb208));if(_0x5bb208[_0x5f59('0x14')]){if(_0x5bb208[_0x5f59('0x14')][_0x5f59('0x15')]===0x1f4){logger['error'](_0x5f59('0x10'),_0x474120,_0x5bb208[_0x5f59('0x14')]['message']);return _0x2bc644(_0x5bb208[_0x5f59('0x14')][_0x5f59('0x16')]);}logger[_0x5f59('0x14')](_0x5f59('0x10'),_0x474120,_0x5bb208['error']['message']);return _0x32a9ba(_0x5bb208[_0x5f59('0x14')][_0x5f59('0x16')]);}else{logger[_0x5f59('0xf')](_0x5f59('0x10'),_0x474120,_0x5f59('0x12'));_0x32a9ba(_0x5bb208[_0x5f59('0x17')][_0x5f59('0x16')]);}})[_0x5f59('0x18')](function(_0x5a81a8){logger[_0x5f59('0x14')](_0x5f59('0x10'),_0x474120,_0x5a81a8);_0x2bc644(_0x5a81a8);});});}exports[_0x5f59('0x19')]=function(_0x28e290){var _0x83bfd0=this;return new Promise(function(_0x26ea1f,_0x1365e9){return db[_0x5f59('0x1a')][_0x5f59('0x1b')]({'raw':_0x28e290['options']?_0x28e290['options'][_0x5f59('0x1c')]===undefined?!![]:![]:!![],'where':_0x28e290[_0x5f59('0x1d')]?_0x28e290[_0x5f59('0x1d')]['where']||null:null,'attributes':_0x28e290['options']?_0x28e290[_0x5f59('0x1d')][_0x5f59('0x1e')]||null:null,'limit':_0x28e290[_0x5f59('0x1d')]?_0x28e290[_0x5f59('0x1d')]['limit']||null:null,'include':_0x28e290['options']?_0x28e290[_0x5f59('0x1d')]['include']?_[_0x5f59('0x1f')](_0x28e290[_0x5f59('0x1d')][_0x5f59('0x20')],function(_0x2fbe60){return{'model':db[_0x2fbe60[_0x5f59('0x21')]],'as':_0x2fbe60['as'],'attributes':_0x2fbe60[_0x5f59('0x1e')],'include':_0x2fbe60[_0x5f59('0x20')]?_[_0x5f59('0x1f')](_0x2fbe60[_0x5f59('0x20')],function(_0x179c86){return{'model':db[_0x179c86[_0x5f59('0x21')]],'as':_0x179c86['as'],'attributes':_0x179c86[_0x5f59('0x1e')],'include':_0x179c86[_0x5f59('0x20')]?_[_0x5f59('0x1f')](_0x179c86[_0x5f59('0x20')],function(_0x1c4194){return{'model':db[_0x1c4194[_0x5f59('0x21')]],'as':_0x1c4194['as'],'attributes':_0x1c4194[_0x5f59('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa3c622){logger[_0x5f59('0xf')](_0x5f59('0x19'),_0x28e290);logger[_0x5f59('0x11')]('GetVoiceCallReport',_0x28e290,JSON[_0x5f59('0x13')](_0xa3c622));_0x26ea1f(_0xa3c622);})[_0x5f59('0x18')](function(_0x6aa3f8){logger[_0x5f59('0x14')](_0x5f59('0x19'),_0x6aa3f8[_0x5f59('0x16')],_0x28e290);_0x1365e9(_0x83bfd0[_0x5f59('0x14')](0x1f4,_0x6aa3f8[_0x5f59('0x16')]));});});};exports[_0x5f59('0x22')]=function(_0x56326a){var _0x2b36b6=this;return new Promise(function(_0x10c86c,_0x1567f0){return db['VoiceCallReport'][_0x5f59('0x23')](_0x56326a[_0x5f59('0x24')],{'raw':_0x56326a[_0x5f59('0x1d')]?_0x56326a[_0x5f59('0x1d')][_0x5f59('0x1c')]===undefined?!![]:![]:!![]})[_0x5f59('0xe')](function(_0x4e09ff){logger[_0x5f59('0xf')](_0x5f59('0x22'),_0x56326a);logger[_0x5f59('0x11')]('CreateVoiceCallReport',_0x56326a,JSON[_0x5f59('0x13')](_0x4e09ff));_0x10c86c(_0x4e09ff);})[_0x5f59('0x18')](function(_0x59389e){logger[_0x5f59('0x14')]('CreateVoiceCallReport',_0x59389e[_0x5f59('0x16')],_0x56326a);_0x1567f0(_0x2b36b6['error'](0x1f4,_0x59389e[_0x5f59('0x16')]));});});};exports[_0x5f59('0x25')]=function(_0xe83a13){var _0x3f14b3=this;return new Promise(function(_0x2ec0e4,_0x592225){return db['VoiceCallReport'][_0x5f59('0x26')](_0xe83a13[_0x5f59('0x24')],{'raw':_0xe83a13[_0x5f59('0x1d')]?_0xe83a13[_0x5f59('0x1d')][_0x5f59('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe83a13['options']?_0xe83a13[_0x5f59('0x1d')]['where']||null:null,'attributes':_0xe83a13['options']?_0xe83a13['options'][_0x5f59('0x1e')]||null:null,'limit':_0xe83a13[_0x5f59('0x1d')]?_0xe83a13[_0x5f59('0x1d')][_0x5f59('0x27')]||null:null})['then'](function(_0x1e0f47){logger[_0x5f59('0xf')](_0x5f59('0x25'),_0xe83a13);logger['debug']('UpdateVoiceCallReport',_0xe83a13,JSON['stringify'](_0x1e0f47));_0x2ec0e4(_0x1e0f47);})[_0x5f59('0x18')](function(_0x5d6b4e){logger['error'](_0x5f59('0x25'),_0x5d6b4e['message'],_0xe83a13);_0x592225(_0x3f14b3['error'](0x1f4,_0x5d6b4e['message']));});});}; \ No newline at end of file +var _0xdb37=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','raw','options','attributes','include','map','model','VoiceCallReport','create','body','UpdateVoiceCallReport','where','limit','lodash'];(function(_0x27255b,_0x1c5c3b){var _0x58bcce=function(_0x37bc2c){while(--_0x37bc2c){_0x27255b['push'](_0x27255b['shift']());}};_0x58bcce(++_0x1c5c3b);}(_0xdb37,0x117));var _0x7db3=function(_0x2bc3de,_0x585f62){_0x2bc3de=_0x2bc3de-0x0;var _0x7d244f=_0xdb37[_0x2bc3de];return _0x7d244f;};'use strict';var _=require(_0x7db3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7db3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7db3('0x2'));var db=require(_0x7db3('0x3'))['db'];var utils=require(_0x7db3('0x4'));var logger=require(_0x7db3('0x5'))(_0x7db3('0x6'));var config=require('../../config/environment');var jayson=require(_0x7db3('0x7'));var client=jayson[_0x7db3('0x8')][_0x7db3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42e269,_0x5a7f78,_0x5da00a){return new BPromise(function(_0x4d1354,_0x59cab3){return client[_0x7db3('0xa')](_0x42e269,_0x5da00a)[_0x7db3('0xb')](function(_0x5c0b37){logger[_0x7db3('0xc')](_0x7db3('0xd'),_0x5a7f78,_0x7db3('0xe'));logger[_0x7db3('0xf')](_0x7db3('0x10'),_0x5a7f78,_0x7db3('0xe'),JSON[_0x7db3('0x11')](_0x5c0b37));if(_0x5c0b37[_0x7db3('0x12')]){if(_0x5c0b37[_0x7db3('0x12')][_0x7db3('0x13')]===0x1f4){logger['error'](_0x7db3('0xd'),_0x5a7f78,_0x5c0b37[_0x7db3('0x12')][_0x7db3('0x14')]);return _0x59cab3(_0x5c0b37[_0x7db3('0x12')][_0x7db3('0x14')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5a7f78,_0x5c0b37['error'][_0x7db3('0x14')]);return _0x4d1354(_0x5c0b37[_0x7db3('0x12')][_0x7db3('0x14')]);}else{logger['info'](_0x7db3('0xd'),_0x5a7f78,_0x7db3('0xe'));_0x4d1354(_0x5c0b37['result'][_0x7db3('0x14')]);}})[_0x7db3('0x15')](function(_0x4bc2d0){logger['error'](_0x7db3('0xd'),_0x5a7f78,_0x4bc2d0);_0x59cab3(_0x4bc2d0);});});}exports[_0x7db3('0x16')]=function(_0x3552f3){var _0x570084=this;return new Promise(function(_0x1bac5b,_0x34d8ef){return db['VoiceCallReport']['findAll']({'raw':_0x3552f3['options']?_0x3552f3['options'][_0x7db3('0x17')]===undefined?!![]:![]:!![],'where':_0x3552f3[_0x7db3('0x18')]?_0x3552f3[_0x7db3('0x18')]['where']||null:null,'attributes':_0x3552f3[_0x7db3('0x18')]?_0x3552f3[_0x7db3('0x18')][_0x7db3('0x19')]||null:null,'limit':_0x3552f3[_0x7db3('0x18')]?_0x3552f3[_0x7db3('0x18')]['limit']||null:null,'include':_0x3552f3[_0x7db3('0x18')]?_0x3552f3[_0x7db3('0x18')][_0x7db3('0x1a')]?_[_0x7db3('0x1b')](_0x3552f3['options'][_0x7db3('0x1a')],function(_0x28df5f){return{'model':db[_0x28df5f[_0x7db3('0x1c')]],'as':_0x28df5f['as'],'attributes':_0x28df5f[_0x7db3('0x19')],'include':_0x28df5f[_0x7db3('0x1a')]?_[_0x7db3('0x1b')](_0x28df5f[_0x7db3('0x1a')],function(_0x52120d){return{'model':db[_0x52120d[_0x7db3('0x1c')]],'as':_0x52120d['as'],'attributes':_0x52120d[_0x7db3('0x19')],'include':_0x52120d[_0x7db3('0x1a')]?_['map'](_0x52120d['include'],function(_0x1e7576){return{'model':db[_0x1e7576['model']],'as':_0x1e7576['as'],'attributes':_0x1e7576['attributes']};}):[]};}):[]};}):[]:[]})[_0x7db3('0xb')](function(_0x5cc991){logger[_0x7db3('0xc')]('GetVoiceCallReport',_0x3552f3);logger[_0x7db3('0xf')](_0x7db3('0x16'),_0x3552f3,JSON[_0x7db3('0x11')](_0x5cc991));_0x1bac5b(_0x5cc991);})[_0x7db3('0x15')](function(_0x150827){logger[_0x7db3('0x12')](_0x7db3('0x16'),_0x150827[_0x7db3('0x14')],_0x3552f3);_0x34d8ef(_0x570084[_0x7db3('0x12')](0x1f4,_0x150827['message']));});});};exports['CreateVoiceCallReport']=function(_0x43c28d){var _0x5c4241=this;return new Promise(function(_0x4430f4,_0x5ecc77){return db[_0x7db3('0x1d')][_0x7db3('0x1e')](_0x43c28d[_0x7db3('0x1f')],{'raw':_0x43c28d['options']?_0x43c28d[_0x7db3('0x18')][_0x7db3('0x17')]===undefined?!![]:![]:!![]})[_0x7db3('0xb')](function(_0x59f903){logger['info']('CreateVoiceCallReport',_0x43c28d);logger[_0x7db3('0xf')]('CreateVoiceCallReport',_0x43c28d,JSON[_0x7db3('0x11')](_0x59f903));_0x4430f4(_0x59f903);})[_0x7db3('0x15')](function(_0x2c64c4){logger[_0x7db3('0x12')]('CreateVoiceCallReport',_0x2c64c4[_0x7db3('0x14')],_0x43c28d);_0x5ecc77(_0x5c4241['error'](0x1f4,_0x2c64c4[_0x7db3('0x14')]));});});};exports[_0x7db3('0x20')]=function(_0x280bc4){var _0x199a85=this;return new Promise(function(_0x1d5a1a,_0x4483ff){return db[_0x7db3('0x1d')]['update'](_0x280bc4[_0x7db3('0x1f')],{'raw':_0x280bc4[_0x7db3('0x18')]?_0x280bc4[_0x7db3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x280bc4[_0x7db3('0x18')]?_0x280bc4[_0x7db3('0x18')][_0x7db3('0x21')]||null:null,'attributes':_0x280bc4[_0x7db3('0x18')]?_0x280bc4[_0x7db3('0x18')][_0x7db3('0x19')]||null:null,'limit':_0x280bc4['options']?_0x280bc4['options'][_0x7db3('0x22')]||null:null})[_0x7db3('0xb')](function(_0x3943d3){logger[_0x7db3('0xc')](_0x7db3('0x20'),_0x280bc4);logger[_0x7db3('0xf')]('UpdateVoiceCallReport',_0x280bc4,JSON[_0x7db3('0x11')](_0x3943d3));_0x1d5a1a(_0x3943d3);})[_0x7db3('0x15')](function(_0xbbeb41){logger[_0x7db3('0x12')](_0x7db3('0x20'),_0xbbeb41[_0x7db3('0x14')],_0x280bc4);_0x4483ff(_0x199a85[_0x7db3('0x12')](0x1f4,_0xbbeb41['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b616b04..5683742 100644 --- a/server/api/voiceChanSpy/index.js +++ b/server/api/voiceChanSpy/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0179=['./voiceChanSpy.controller','isAuthenticated','get','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0x0179,0x1a9));var _0x9017=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x0179[_0x9fd887];return _0x1a54ab;};'use strict';var multer=require('multer');var util=require(_0x9017('0x0'));var path=require('path');var timeout=require(_0x9017('0x1'));var express=require('express');var router=express[_0x9017('0x2')]();var fs_extra=require(_0x9017('0x3'));var auth=require(_0x9017('0x4'));var interaction=require(_0x9017('0x5'));var config=require(_0x9017('0x6'));var controller=require(_0x9017('0x7'));router['get']('/',auth[_0x9017('0x8')](),controller['index']);router[_0x9017('0x9')](_0x9017('0xa'),auth['isAuthenticated'](),controller[_0x9017('0xb')]);router[_0x9017('0xc')]('/',auth['isAuthenticated'](),controller[_0x9017('0xd')]);router[_0x9017('0xe')](_0x9017('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x9017('0xf')](_0x9017('0xa'),auth[_0x9017('0x8')](),controller[_0x9017('0x10')]);module[_0x9017('0x11')]=router; \ No newline at end of file +var _0x8344=['get','isAuthenticated','index','post','create','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x4b4a7c,_0x3fdf80){var _0x45c504=function(_0x556019){while(--_0x556019){_0x4b4a7c['push'](_0x4b4a7c['shift']());}};_0x45c504(++_0x3fdf80);}(_0x8344,0x1d6));var _0x4834=function(_0x1a2f70,_0x476c9b){_0x1a2f70=_0x1a2f70-0x0;var _0x3c135d=_0x8344[_0x1a2f70];return _0x3c135d;};'use strict';var multer=require(_0x4834('0x0'));var util=require(_0x4834('0x1'));var path=require(_0x4834('0x2'));var timeout=require(_0x4834('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4834('0x4'));var interaction=require(_0x4834('0x5'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x4834('0x6')]('/',auth[_0x4834('0x7')](),controller[_0x4834('0x8')]);router[_0x4834('0x6')]('/:id',auth[_0x4834('0x7')](),controller['show']);router[_0x4834('0x9')]('/',auth[_0x4834('0x7')](),controller[_0x4834('0xa')]);router['put']('/:id',auth[_0x4834('0x7')](),controller[_0x4834('0xb')]);router[_0x4834('0xc')]('/:id',auth[_0x4834('0x7')](),controller['destroy']);module[_0x4834('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 4bc63ea..2c1d4b0 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.attributes.js +++ b/server/api/voiceChanSpy/voiceChanSpy.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4e6=['STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x175628,_0x5cb9f1){var _0x3fa21b=function(_0x3ec34d){while(--_0x3ec34d){_0x175628['push'](_0x175628['shift']());}};_0x3fa21b(++_0x5cb9f1);}(_0xb4e6,0x1b6));var _0x6b4e=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0xb4e6[_0x37cc52];return _0x2b4a90;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module[_0x6b4e('0x1')]={'name':{'type':Sequelize[_0x6b4e('0x2')]},'prefix':{'type':Sequelize[_0x6b4e('0x2')],'unique':_0x6b4e('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x6b4e('0x2')],'set':function(_0x22efec){this[_0x6b4e('0x4')](_0x6b4e('0x5'),_0x22efec?_0x22efec[_0x6b4e('0x6')](''):[]);},'get':function(){return this[_0x6b4e('0x7')](_0x6b4e('0x5'))?this['getDataValue']('options')[_0x6b4e('0x8')](''):[];}},'auth':{'type':Sequelize[_0x6b4e('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x6b4e('0x2')]},'record':{'type':Sequelize[_0x6b4e('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6b4e('0x2')]}}; \ No newline at end of file +var _0x76a6=['STRING','name','setDataValue','options','join','getDataValue','BOOLEAN','exports'];(function(_0xb873ef,_0x584835){var _0x9d9fff=function(_0x29982e){while(--_0x29982e){_0xb873ef['push'](_0xb873ef['shift']());}};_0x9d9fff(++_0x584835);}(_0x76a6,0x7f));var _0x676a=function(_0xe6f4ef,_0x4e34cc){_0xe6f4ef=_0xe6f4ef-0x0;var _0x4f3447=_0x76a6[_0xe6f4ef];return _0x4f3447;};'use strict';var Sequelize=require('sequelize');module[_0x676a('0x0')]={'name':{'type':Sequelize[_0x676a('0x1')]},'prefix':{'type':Sequelize[_0x676a('0x1')],'unique':_0x676a('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x676a('0x1')],'set':function(_0x3c374f){this[_0x676a('0x3')](_0x676a('0x4'),_0x3c374f?_0x3c374f[_0x676a('0x5')](''):[]);},'get':function(){return this[_0x676a('0x6')](_0x676a('0x4'))?this['getDataValue']('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x676a('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x676a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 6e7f488..6d5f789 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.controller.js +++ b/server/api/voiceChanSpy/voiceChanSpy.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1b9=['intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','ChanSpies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','model','query','filters'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa1b9,0x71));var _0x9a1b=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa1b9[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x9a1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a1b('0x1'));var jsonpatch=require(_0x9a1b('0x2'));var rp=require(_0x9a1b('0x3'));var moment=require(_0x9a1b('0x4'));var BPromise=require(_0x9a1b('0x5'));var Mustache=require(_0x9a1b('0x6'));var util=require(_0x9a1b('0x7'));var path=require('path');var sox=require(_0x9a1b('0x8'));var csv=require(_0x9a1b('0x9'));var ejs=require(_0x9a1b('0xa'));var fs=require('fs');var fs_extra=require(_0x9a1b('0xb'));var _=require('lodash');var squel=require(_0x9a1b('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a1b('0xd'));var deskjs=require(_0x9a1b('0xe'));var toCsv=require(_0x9a1b('0x9'));var querystring=require(_0x9a1b('0xf'));var Papa=require(_0x9a1b('0x10'));var Redis=require('ioredis');var authService=require(_0x9a1b('0x11'));var qs=require(_0x9a1b('0x12'));var as=require(_0x9a1b('0x13'));var hardwareService=require(_0x9a1b('0x14'));var logger=require(_0x9a1b('0x15'))(_0x9a1b('0x16'));var utils=require(_0x9a1b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a1b('0x18'));var db=require(_0x9a1b('0x19'))['db'];function respondWithStatusCode(_0x27062b,_0x5ee9d3){_0x5ee9d3=_0x5ee9d3||0xcc;return function(_0x1d016d){if(_0x1d016d){return _0x27062b[_0x9a1b('0x1a')](_0x5ee9d3);}return _0x27062b[_0x9a1b('0x1b')](_0x5ee9d3)[_0x9a1b('0x1c')]();};}function respondWithResult(_0x390ad9,_0x157b6f){_0x157b6f=_0x157b6f||0xc8;return function(_0x3fe388){if(_0x3fe388){return _0x390ad9[_0x9a1b('0x1b')](_0x157b6f)[_0x9a1b('0x1d')](_0x3fe388);}};}function respondWithFilteredResult(_0x101622,_0x5c397f){return function(_0x357cd9){if(_0x357cd9){var _0x2440fc=typeof _0x5c397f['offset']===_0x9a1b('0x1e')&&typeof _0x5c397f[_0x9a1b('0x1f')]===_0x9a1b('0x1e');var _0x1a7324=_0x357cd9[_0x9a1b('0x20')];var _0x478626=_0x2440fc?0x0:_0x5c397f[_0x9a1b('0x21')];var _0x599325=_0x2440fc?_0x357cd9[_0x9a1b('0x20')]:_0x5c397f[_0x9a1b('0x21')]+_0x5c397f[_0x9a1b('0x1f')];var _0x1f1dea;if(_0x599325>=_0x1a7324){_0x599325=_0x1a7324;_0x1f1dea=0xc8;}else{_0x1f1dea=0xce;}_0x101622[_0x9a1b('0x1b')](_0x1f1dea);return _0x101622['set'](_0x9a1b('0x22'),_0x478626+'-'+_0x599325+'/'+_0x1a7324)[_0x9a1b('0x1d')](_0x357cd9);}return null;};}function patchUpdates(_0x36c95c){return function(_0x1977a7){try{jsonpatch['apply'](_0x1977a7,_0x36c95c,!![]);}catch(_0x2ccb02){return BPromise[_0x9a1b('0x23')](_0x2ccb02);}return _0x1977a7[_0x9a1b('0x24')]();};}function saveUpdates(_0x13f828,_0x1c9ab3){return function(_0x327cac){if(_0x327cac){return _0x327cac[_0x9a1b('0x25')](_0x13f828)[_0x9a1b('0x26')](function(_0xb6b23a){return _0xb6b23a;});}return null;};}function removeEntity(_0x37971c,_0x5841c1){return function(_0x2439e9){if(_0x2439e9){return _0x2439e9[_0x9a1b('0x27')]()[_0x9a1b('0x26')](function(){var _0x4bb81c=_0x2439e9['get']({'plain':!![]});var _0x3b0ff3='ChanSpies';return db[_0x9a1b('0x28')]['destroy']({'where':{'type':_0x3b0ff3,'resourceId':_0x4bb81c['id']}})['then'](function(){return _0x2439e9;});})['then'](function(){_0x37971c[_0x9a1b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bd6b3,_0x116d3e){return function(_0x4983f6){if(!_0x4983f6){_0x2bd6b3[_0x9a1b('0x1a')](0x194);}return _0x4983f6;};}function handleError(_0x44f930,_0x15812d){_0x15812d=_0x15812d||0x1f4;return function(_0x1c13d6){logger[_0x9a1b('0x29')](_0x1c13d6[_0x9a1b('0x2a')]);if(_0x1c13d6[_0x9a1b('0x2b')]){delete _0x1c13d6['name'];}_0x44f930['status'](_0x15812d)[_0x9a1b('0x2c')](_0x1c13d6);};}exports[_0x9a1b('0x2d')]=function(_0x56e6ed,_0x14ea6b){var _0x43c2e7={},_0x4028f0={},_0x3bc034={'count':0x0,'rows':[]};var _0x311432=_[_0x9a1b('0x2e')](db[_0x9a1b('0x2f')][_0x9a1b('0x30')],function(_0x1e7f23){return{'name':_0x1e7f23['fieldName'],'type':_0x1e7f23[_0x9a1b('0x31')]['key']};});_0x4028f0[_0x9a1b('0x32')]=_[_0x9a1b('0x2e')](_0x311432,_0x9a1b('0x2b'));_0x4028f0[_0x9a1b('0x33')]=_['keys'](_0x56e6ed[_0x9a1b('0x33')]);_0x4028f0[_0x9a1b('0x34')]=_[_0x9a1b('0x35')](_0x4028f0[_0x9a1b('0x32')],_0x4028f0[_0x9a1b('0x33')]);_0x43c2e7[_0x9a1b('0x36')]=_[_0x9a1b('0x35')](_0x4028f0[_0x9a1b('0x32')],qs[_0x9a1b('0x37')](_0x56e6ed['query'][_0x9a1b('0x37')]));_0x43c2e7[_0x9a1b('0x36')]=_0x43c2e7[_0x9a1b('0x36')][_0x9a1b('0x38')]?_0x43c2e7[_0x9a1b('0x36')]:_0x4028f0[_0x9a1b('0x32')];if(!_0x56e6ed[_0x9a1b('0x33')]['hasOwnProperty'](_0x9a1b('0x39'))){_0x43c2e7[_0x9a1b('0x1f')]=qs[_0x9a1b('0x1f')](_0x56e6ed[_0x9a1b('0x33')][_0x9a1b('0x1f')]);_0x43c2e7[_0x9a1b('0x21')]=qs[_0x9a1b('0x21')](_0x56e6ed[_0x9a1b('0x33')][_0x9a1b('0x21')]);}_0x43c2e7['order']=qs[_0x9a1b('0x3a')](_0x56e6ed[_0x9a1b('0x33')]['sort']);_0x43c2e7[_0x9a1b('0x3b')]=qs[_0x9a1b('0x34')](_['pick'](_0x56e6ed['query'],_0x4028f0['filters']),_0x311432);if(_0x56e6ed[_0x9a1b('0x33')][_0x9a1b('0x3c')]){_0x43c2e7[_0x9a1b('0x3b')]=_[_0x9a1b('0x3d')](_0x43c2e7[_0x9a1b('0x3b')],{'$or':_['map'](_0x311432,function(_0x28cac7){if(_0x28cac7[_0x9a1b('0x31')]!==_0x9a1b('0x3e')){var _0x383003={};_0x383003[_0x28cac7[_0x9a1b('0x2b')]]={'$like':'%'+_0x56e6ed[_0x9a1b('0x33')][_0x9a1b('0x3c')]+'%'};return _0x383003;}})});}_0x43c2e7=_['merge']({},_0x43c2e7,_0x56e6ed[_0x9a1b('0x3f')]);var _0x1599df={'where':_0x43c2e7['where']};return db[_0x9a1b('0x2f')][_0x9a1b('0x20')](_0x1599df)[_0x9a1b('0x26')](function(_0x69c499){_0x3bc034['count']=_0x69c499;if(_0x56e6ed[_0x9a1b('0x33')][_0x9a1b('0x40')]){_0x43c2e7[_0x9a1b('0x41')]=[{'all':!![]}];}return db[_0x9a1b('0x2f')][_0x9a1b('0x42')](_0x43c2e7);})[_0x9a1b('0x26')](function(_0x515bb8){_0x3bc034[_0x9a1b('0x43')]=_0x515bb8;return _0x3bc034;})[_0x9a1b('0x26')](respondWithFilteredResult(_0x14ea6b,_0x43c2e7))[_0x9a1b('0x44')](handleError(_0x14ea6b,null));};exports['show']=function(_0x1a7c68,_0x3ffa84){var _0x3c1fc3={'raw':![],'where':{'id':_0x1a7c68[_0x9a1b('0x45')]['id']}},_0xd86ff5={};_0xd86ff5[_0x9a1b('0x32')]=_[_0x9a1b('0x46')](db['VoiceChanSpy'][_0x9a1b('0x30')]);_0xd86ff5[_0x9a1b('0x33')]=_[_0x9a1b('0x46')](_0x1a7c68[_0x9a1b('0x33')]);_0xd86ff5['filters']=_[_0x9a1b('0x35')](_0xd86ff5[_0x9a1b('0x32')],_0xd86ff5[_0x9a1b('0x33')]);_0x3c1fc3[_0x9a1b('0x36')]=_[_0x9a1b('0x35')](_0xd86ff5[_0x9a1b('0x32')],qs[_0x9a1b('0x37')](_0x1a7c68['query']['fields']));_0x3c1fc3[_0x9a1b('0x36')]=_0x3c1fc3[_0x9a1b('0x36')]['length']?_0x3c1fc3[_0x9a1b('0x36')]:_0xd86ff5[_0x9a1b('0x32')];if(_0x1a7c68[_0x9a1b('0x33')]['includeAll']){_0x3c1fc3['include']=[{'all':!![]}];}_0x3c1fc3=_['merge']({},_0x3c1fc3,_0x1a7c68[_0x9a1b('0x3f')]);return db[_0x9a1b('0x2f')]['find'](_0x3c1fc3)[_0x9a1b('0x26')](handleEntityNotFound(_0x3ffa84,null))[_0x9a1b('0x26')](respondWithResult(_0x3ffa84,null))['catch'](handleError(_0x3ffa84,null));};exports['create']=function(_0x23e3b8,_0x2ff4b5){return db['VoiceChanSpy'][_0x9a1b('0x47')](_0x23e3b8[_0x9a1b('0x48')],{})[_0x9a1b('0x26')](function(_0x3eab82){var _0x4b0353=_0x23e3b8['user']['get']({'plain':!![]});if(!_0x4b0353)throw new Error(_0x9a1b('0x49'));if(_0x4b0353[_0x9a1b('0x4a')]===_0x9a1b('0x4b')){var _0x3f9c17=_0x3eab82[_0x9a1b('0x4c')]({'plain':!![]});var _0x36bb41=_0x9a1b('0x4d');return db[_0x9a1b('0x4e')][_0x9a1b('0x4f')]({'where':{'name':_0x36bb41,'userProfileId':_0x4b0353[_0x9a1b('0x50')]},'raw':!![]})[_0x9a1b('0x26')](function(_0xd1f1fc){if(_0xd1f1fc&&_0xd1f1fc[_0x9a1b('0x51')]===0x0){return db[_0x9a1b('0x28')]['create']({'name':_0x3f9c17['name'],'resourceId':_0x3f9c17['id'],'type':_0xd1f1fc[_0x9a1b('0x2b')],'sectionId':_0xd1f1fc['id']},{})[_0x9a1b('0x26')](function(){return _0x3eab82;});}else{return _0x3eab82;}})[_0x9a1b('0x44')](function(_0x2ae8f3){logger[_0x9a1b('0x29')](_0x9a1b('0x52'),_0x2ae8f3);throw _0x2ae8f3;});}return _0x3eab82;})[_0x9a1b('0x26')](respondWithResult(_0x2ff4b5,0xc9))[_0x9a1b('0x44')](handleError(_0x2ff4b5,null));};exports[_0x9a1b('0x25')]=function(_0x5c35b7,_0x11b466){if(_0x5c35b7[_0x9a1b('0x48')]['id']){delete _0x5c35b7[_0x9a1b('0x48')]['id'];}return db[_0x9a1b('0x2f')]['find']({'where':{'id':_0x5c35b7[_0x9a1b('0x45')]['id']}})[_0x9a1b('0x26')](handleEntityNotFound(_0x11b466,null))['then'](saveUpdates(_0x5c35b7[_0x9a1b('0x48')],null))['then'](respondWithResult(_0x11b466,null))['catch'](handleError(_0x11b466,null));};exports[_0x9a1b('0x27')]=function(_0x160f22,_0xa6215){return db['VoiceChanSpy'][_0x9a1b('0x4f')]({'where':{'id':_0x160f22[_0x9a1b('0x45')]['id']}})[_0x9a1b('0x26')](handleEntityNotFound(_0xa6215,null))[_0x9a1b('0x26')](removeEntity(_0xa6215,null))[_0x9a1b('0x44')](handleError(_0xa6215,null));}; \ No newline at end of file +var _0x22a4=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','ChanSpies','UserProfileResource','sendStatus','error','stack','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','name','query','filters'];(function(_0x4490f3,_0x151302){var _0x4a4e46=function(_0x5d5b22){while(--_0x5d5b22){_0x4490f3['push'](_0x4490f3['shift']());}};_0x4a4e46(++_0x151302);}(_0x22a4,0x1cb));var _0x422a=function(_0x529196,_0x521008){_0x529196=_0x529196-0x0;var _0x1b84ae=_0x22a4[_0x529196];return _0x1b84ae;};'use strict';var emlformat=require(_0x422a('0x0'));var rimraf=require(_0x422a('0x1'));var zipdir=require(_0x422a('0x2'));var jsonpatch=require(_0x422a('0x3'));var rp=require(_0x422a('0x4'));var moment=require(_0x422a('0x5'));var BPromise=require(_0x422a('0x6'));var Mustache=require(_0x422a('0x7'));var util=require('util');var path=require(_0x422a('0x8'));var sox=require(_0x422a('0x9'));var csv=require(_0x422a('0xa'));var ejs=require(_0x422a('0xb'));var fs=require('fs');var fs_extra=require(_0x422a('0xc'));var _=require('lodash');var squel=require(_0x422a('0xd'));var crypto=require(_0x422a('0xe'));var jsforce=require(_0x422a('0xf'));var deskjs=require(_0x422a('0x10'));var toCsv=require(_0x422a('0xa'));var querystring=require(_0x422a('0x11'));var Papa=require(_0x422a('0x12'));var Redis=require(_0x422a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x422a('0x14'));var hardwareService=require(_0x422a('0x15'));var logger=require(_0x422a('0x16'))(_0x422a('0x17'));var utils=require(_0x422a('0x18'));var config=require(_0x422a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xebe70d,_0x4dbed1){_0x4dbed1=_0x4dbed1||0xcc;return function(_0x5a0c59){if(_0x5a0c59){return _0xebe70d['sendStatus'](_0x4dbed1);}return _0xebe70d[_0x422a('0x1a')](_0x4dbed1)[_0x422a('0x1b')]();};}function respondWithResult(_0x11af1f,_0x2dc9b2){_0x2dc9b2=_0x2dc9b2||0xc8;return function(_0x147af5){if(_0x147af5){return _0x11af1f[_0x422a('0x1a')](_0x2dc9b2)[_0x422a('0x1c')](_0x147af5);}};}function respondWithFilteredResult(_0x3504bb,_0xf9fcf7){return function(_0x2ba53b){if(_0x2ba53b){var _0x30b6e9=typeof _0xf9fcf7[_0x422a('0x1d')]===_0x422a('0x1e')&&typeof _0xf9fcf7[_0x422a('0x1f')]===_0x422a('0x1e');var _0x2e8163=_0x2ba53b[_0x422a('0x20')];var _0x5e2507=_0x30b6e9?0x0:_0xf9fcf7[_0x422a('0x1d')];var _0x3c5d86=_0x30b6e9?_0x2ba53b['count']:_0xf9fcf7[_0x422a('0x1d')]+_0xf9fcf7['limit'];var _0x552048;if(_0x3c5d86>=_0x2e8163){_0x3c5d86=_0x2e8163;_0x552048=0xc8;}else{_0x552048=0xce;}_0x3504bb[_0x422a('0x1a')](_0x552048);return _0x3504bb[_0x422a('0x21')](_0x422a('0x22'),_0x5e2507+'-'+_0x3c5d86+'/'+_0x2e8163)[_0x422a('0x1c')](_0x2ba53b);}return null;};}function patchUpdates(_0x194c25){return function(_0x5f9720){try{jsonpatch[_0x422a('0x23')](_0x5f9720,_0x194c25,!![]);}catch(_0x26922a){return BPromise['reject'](_0x26922a);}return _0x5f9720[_0x422a('0x24')]();};}function saveUpdates(_0x3284ed,_0x211d93){return function(_0x3d3213){if(_0x3d3213){return _0x3d3213[_0x422a('0x25')](_0x3284ed)['then'](function(_0x837c81){return _0x837c81;});}return null;};}function removeEntity(_0x33bc88,_0x6e209d){return function(_0x5e3138){if(_0x5e3138){return _0x5e3138[_0x422a('0x26')]()[_0x422a('0x27')](function(){var _0x1fd126=_0x5e3138[_0x422a('0x28')]({'plain':!![]});var _0xfc8699=_0x422a('0x29');return db[_0x422a('0x2a')][_0x422a('0x26')]({'where':{'type':_0xfc8699,'resourceId':_0x1fd126['id']}})['then'](function(){return _0x5e3138;});})[_0x422a('0x27')](function(){_0x33bc88[_0x422a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x83cb4d,_0x49d75f){return function(_0x1b88ae){if(!_0x1b88ae){_0x83cb4d[_0x422a('0x2b')](0x194);}return _0x1b88ae;};}function handleError(_0x3c2e5b,_0x24b6ec){_0x24b6ec=_0x24b6ec||0x1f4;return function(_0x4badf8){logger[_0x422a('0x2c')](_0x4badf8[_0x422a('0x2d')]);if(_0x4badf8['name']){delete _0x4badf8['name'];}_0x3c2e5b[_0x422a('0x1a')](_0x24b6ec)[_0x422a('0x2e')](_0x4badf8);};}exports['index']=function(_0x494226,_0x4903d1){var _0x56c732={},_0x48fc3a={},_0x3c6a84={'count':0x0,'rows':[]};var _0x2fd9f8=_[_0x422a('0x2f')](db[_0x422a('0x30')][_0x422a('0x31')],function(_0x5cadc6){return{'name':_0x5cadc6[_0x422a('0x32')],'type':_0x5cadc6[_0x422a('0x33')][_0x422a('0x34')]};});_0x48fc3a[_0x422a('0x35')]=_[_0x422a('0x2f')](_0x2fd9f8,_0x422a('0x36'));_0x48fc3a[_0x422a('0x37')]=_['keys'](_0x494226[_0x422a('0x37')]);_0x48fc3a[_0x422a('0x38')]=_[_0x422a('0x39')](_0x48fc3a[_0x422a('0x35')],_0x48fc3a['query']);_0x56c732[_0x422a('0x3a')]=_['intersection'](_0x48fc3a[_0x422a('0x35')],qs[_0x422a('0x3b')](_0x494226['query'][_0x422a('0x3b')]));_0x56c732[_0x422a('0x3a')]=_0x56c732['attributes'][_0x422a('0x3c')]?_0x56c732[_0x422a('0x3a')]:_0x48fc3a[_0x422a('0x35')];if(!_0x494226[_0x422a('0x37')][_0x422a('0x3d')](_0x422a('0x3e'))){_0x56c732[_0x422a('0x1f')]=qs[_0x422a('0x1f')](_0x494226['query']['limit']);_0x56c732[_0x422a('0x1d')]=qs[_0x422a('0x1d')](_0x494226[_0x422a('0x37')]['offset']);}_0x56c732[_0x422a('0x3f')]=qs[_0x422a('0x40')](_0x494226['query']['sort']);_0x56c732[_0x422a('0x41')]=qs['filters'](_[_0x422a('0x42')](_0x494226[_0x422a('0x37')],_0x48fc3a[_0x422a('0x38')]),_0x2fd9f8);if(_0x494226['query'][_0x422a('0x43')]){_0x56c732[_0x422a('0x41')]=_[_0x422a('0x44')](_0x56c732['where'],{'$or':_['map'](_0x2fd9f8,function(_0x3a9a15){if(_0x3a9a15[_0x422a('0x33')]!==_0x422a('0x45')){var _0x5b3639={};_0x5b3639[_0x3a9a15[_0x422a('0x36')]]={'$like':'%'+_0x494226[_0x422a('0x37')][_0x422a('0x43')]+'%'};return _0x5b3639;}})});}_0x56c732=_[_0x422a('0x44')]({},_0x56c732,_0x494226[_0x422a('0x46')]);var _0x590c9b={'where':_0x56c732[_0x422a('0x41')]};return db[_0x422a('0x30')][_0x422a('0x20')](_0x590c9b)[_0x422a('0x27')](function(_0xfd39fa){_0x3c6a84['count']=_0xfd39fa;if(_0x494226['query'][_0x422a('0x47')]){_0x56c732['include']=[{'all':!![]}];}return db[_0x422a('0x30')][_0x422a('0x48')](_0x56c732);})[_0x422a('0x27')](function(_0x10302c){_0x3c6a84[_0x422a('0x49')]=_0x10302c;return _0x3c6a84;})[_0x422a('0x27')](respondWithFilteredResult(_0x4903d1,_0x56c732))[_0x422a('0x4a')](handleError(_0x4903d1,null));};exports['show']=function(_0x4070eb,_0x40faa7){var _0x2d456a={'raw':![],'where':{'id':_0x4070eb[_0x422a('0x4b')]['id']}},_0x29b102={};_0x29b102[_0x422a('0x35')]=_[_0x422a('0x4c')](db['VoiceChanSpy'][_0x422a('0x31')]);_0x29b102[_0x422a('0x37')]=_['keys'](_0x4070eb[_0x422a('0x37')]);_0x29b102[_0x422a('0x38')]=_[_0x422a('0x39')](_0x29b102[_0x422a('0x35')],_0x29b102[_0x422a('0x37')]);_0x2d456a[_0x422a('0x3a')]=_[_0x422a('0x39')](_0x29b102['model'],qs[_0x422a('0x3b')](_0x4070eb[_0x422a('0x37')][_0x422a('0x3b')]));_0x2d456a[_0x422a('0x3a')]=_0x2d456a[_0x422a('0x3a')][_0x422a('0x3c')]?_0x2d456a[_0x422a('0x3a')]:_0x29b102[_0x422a('0x35')];if(_0x4070eb[_0x422a('0x37')][_0x422a('0x47')]){_0x2d456a['include']=[{'all':!![]}];}_0x2d456a=_['merge']({},_0x2d456a,_0x4070eb[_0x422a('0x46')]);return db[_0x422a('0x30')]['find'](_0x2d456a)[_0x422a('0x27')](handleEntityNotFound(_0x40faa7,null))[_0x422a('0x27')](respondWithResult(_0x40faa7,null))[_0x422a('0x4a')](handleError(_0x40faa7,null));};exports[_0x422a('0x4d')]=function(_0x706497,_0x792783){return db[_0x422a('0x30')][_0x422a('0x4d')](_0x706497[_0x422a('0x4e')],{})[_0x422a('0x27')](function(_0x5c9921){var _0x565c6f=_0x706497[_0x422a('0x4f')][_0x422a('0x28')]({'plain':!![]});if(!_0x565c6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x565c6f[_0x422a('0x50')]===_0x422a('0x4f')){var _0x20b4d3=_0x5c9921[_0x422a('0x28')]({'plain':!![]});var _0x111e64=_0x422a('0x29');return db[_0x422a('0x51')]['find']({'where':{'name':_0x111e64,'userProfileId':_0x565c6f[_0x422a('0x52')]},'raw':!![]})[_0x422a('0x27')](function(_0xf234d){if(_0xf234d&&_0xf234d[_0x422a('0x53')]===0x0){return db[_0x422a('0x2a')][_0x422a('0x4d')]({'name':_0x20b4d3['name'],'resourceId':_0x20b4d3['id'],'type':_0xf234d['name'],'sectionId':_0xf234d['id']},{})[_0x422a('0x27')](function(){return _0x5c9921;});}else{return _0x5c9921;}})[_0x422a('0x4a')](function(_0x1ff3ad){logger[_0x422a('0x2c')](_0x422a('0x54'),_0x1ff3ad);throw _0x1ff3ad;});}return _0x5c9921;})[_0x422a('0x27')](respondWithResult(_0x792783,0xc9))[_0x422a('0x4a')](handleError(_0x792783,null));};exports[_0x422a('0x25')]=function(_0x445f7c,_0x5211ff){if(_0x445f7c['body']['id']){delete _0x445f7c['body']['id'];}return db[_0x422a('0x30')][_0x422a('0x55')]({'where':{'id':_0x445f7c[_0x422a('0x4b')]['id']}})[_0x422a('0x27')](handleEntityNotFound(_0x5211ff,null))['then'](saveUpdates(_0x445f7c[_0x422a('0x4e')],null))[_0x422a('0x27')](respondWithResult(_0x5211ff,null))[_0x422a('0x4a')](handleError(_0x5211ff,null));};exports[_0x422a('0x26')]=function(_0x1bc3c6,_0x1f2834){return db['VoiceChanSpy']['find']({'where':{'id':_0x1bc3c6[_0x422a('0x4b')]['id']}})[_0x422a('0x27')](handleEntityNotFound(_0x1f2834,null))[_0x422a('0x27')](removeEntity(_0x1f2834,null))['catch'](handleError(_0x1f2834,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index ba5a78d..c5afcd5 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.model.js +++ b/server/api/voiceChanSpy/voiceChanSpy.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75f3=['merge','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','name','User','findAll','internal','agent','then','catch','models','VoiceChanSpy','voice_chanspy','bulkCreate','VoiceExtension','util','bluebird','context','format','%s%s','prefix','push'];(function(_0x1914f6,_0x56874c){var _0x5ba267=function(_0x3a0985){while(--_0x3a0985){_0x1914f6['push'](_0x1914f6['shift']());}};_0x5ba267(++_0x56874c);}(_0x75f3,0x17a));var _0x375f=function(_0x1e2c43,_0x1b6ef8){_0x1e2c43=_0x1e2c43-0x0;var _0x1a1467=_0x75f3[_0x1e2c43];return _0x1a1467;};'use strict';var _=require('lodash');var util=require(_0x375f('0x0'));var BPromise=require(_0x375f('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3bcb9c,_0x51fd43,_0x3debfe){var _0x1b1fec=0x1;var _0xe14647=[];var _0x3bd1e7={'context':_0x51fd43[_0x375f('0x2')]||'from-sip','exten':util[_0x375f('0x3')](_0x375f('0x4'),_0x3bcb9c[_0x375f('0x5')],_0x3debfe),'type':'system','isApp':![],'ChanSpyId':_0x3bcb9c['id'],'UserId':_0x51fd43['id']};_0xe14647[_0x375f('0x6')](_[_0x375f('0x7')]({'app':'Set','appdata':util[_0x375f('0x3')](_0x375f('0x8'),'chanspy'),'priority':_0x1b1fec++},_0x3bd1e7));if(_0x3bcb9c[_0x375f('0x9')]){_0xe14647[_0x375f('0x6')](_[_0x375f('0x7')]({'app':_0x375f('0xa'),'appdata':util['format'](_0x375f('0xb'),_0x3bcb9c[_0x375f('0xc')]),'priority':_0x1b1fec++},_0x3bd1e7));}if(_0x3bcb9c[_0x375f('0xd')]){_0xe14647['push'](_[_0x375f('0x7')]({'app':_0x375f('0xe'),'appdata':_0x3bcb9c[_0x375f('0xf')],'priority':_0x1b1fec++},_0x3bd1e7));}_0xe14647['push'](_[_0x375f('0x7')]({'app':_0x375f('0x10'),'appdata':util['format'](_0x375f('0x11'),_0x51fd43['name'],_0x3bcb9c[_0x375f('0x12')]?_0x3bcb9c[_0x375f('0x12')][_0x375f('0x13')](''):''),'priority':_0x1b1fec++},_0x3bd1e7));if(_0x3bcb9c[_0x375f('0x9')]){_0xe14647['push'](_[_0x375f('0x7')]({'app':_0x375f('0x14'),'priority':_0x1b1fec++},_0x3bd1e7));}return _0xe14647;};var getChanSpyApplications=function(_0xfab572,_0x4e5151){var _0x366f25=[];for(var _0x1b61a4=0x0,_0x62def3=0x1;_0x1b61a4<_0x4e5151[_0x375f('0x15')];_0x1b61a4++,_0x62def3=0x1){_0x366f25=_0x366f25[_0x375f('0x16')](getUserApplications(_0xfab572,_0x4e5151[_0x1b61a4],_0x4e5151[_0x1b61a4]['internal']));if(_0x4e5151[_0x1b61a4]['internal']!=_0x4e5151[_0x1b61a4][_0x375f('0x17')]){_0x366f25=_0x366f25['concat'](getUserApplications(_0xfab572,_0x4e5151[_0x1b61a4],_0x4e5151[_0x1b61a4]['name']));}}return _0x366f25;};var getChanSpyPromise=function(_0x1a70df,_0x46b304){return new BPromise(function(_0x59445a,_0x163c28){return _0x1a70df[_0x375f('0x18')][_0x375f('0x19')]({'attributes':['id',_0x375f('0x17'),_0x375f('0x1a')],'where':{'role':_0x375f('0x1b'),'chanspy':!![]},'raw':!![]})[_0x375f('0x1c')](function(_0x51f972){if(_0x51f972){return _0x59445a(getChanSpyApplications(_0x46b304,_0x51f972));}return _0x59445a([]);})[_0x375f('0x1d')](function(_0x132f5f){_0x163c28(_0x132f5f);});});};module['exports']=function(_0x2bea0b,_0x431dc8){var _0x1ecafb=_0x2bea0b[_0x375f('0x1e')];return _0x2bea0b['define'](_0x375f('0x1f'),attributes,{'tableName':_0x375f('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x582fbd,_0xd3f3e5,_0x192461){return getChanSpyPromise(_0x1ecafb,_0x582fbd)[_0x375f('0x1c')](function(_0x9618d8){if(_0x9618d8&&_0x9618d8[_0x375f('0x15')]){return _0x1ecafb['VoiceExtension'][_0x375f('0x21')](_0x9618d8);}})[_0x375f('0x1c')](function(){_0x192461();})[_0x375f('0x1d')](function(_0x23b7fe){_0x192461(_0x23b7fe);});},'afterUpdate':function(_0x392b29,_0xfa66c5,_0x464ec9){return _0x1ecafb[_0x375f('0x22')]['destroy']({'where':{'ChanSpyId':_0x392b29['id']}})[_0x375f('0x1c')](function(){return getChanSpyPromise(_0x1ecafb,_0x392b29);})[_0x375f('0x1c')](function(_0x4d4a71){if(_0x4d4a71&&_0x4d4a71[_0x375f('0x15')]){return _0x1ecafb['VoiceExtension'][_0x375f('0x21')](_0x4d4a71);}})[_0x375f('0x1c')](function(){_0x464ec9();})[_0x375f('0x1d')](function(_0x41197a){_0x464ec9(_0x41197a);});},'afterDestroy':function(_0x725086,_0x2f826b,_0x111d63){return _0x1ecafb[_0x375f('0x22')]['destroy']({'where':{'ChanSpyId':_0x725086['id']}})['then'](function(){_0x111d63();})[_0x375f('0x1d')](function(_0x504e0f){_0x111d63(_0x504e0f);});}}});}; \ No newline at end of file +var _0x12e4=['util','bluebird','context','from-sip','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','name','options','join','internal','concat','User','findAll','agent','then','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','length','catch'];(function(_0xa08526,_0xd2a376){var _0x2684eb=function(_0x2bfe3a){while(--_0x2bfe3a){_0xa08526['push'](_0xa08526['shift']());}};_0x2684eb(++_0xd2a376);}(_0x12e4,0x1d4));var _0x412e=function(_0x57ba3c,_0x49f04c){_0x57ba3c=_0x57ba3c-0x0;var _0x106183=_0x12e4[_0x57ba3c];return _0x106183;};'use strict';var _=require('lodash');var util=require(_0x412e('0x0'));var BPromise=require(_0x412e('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x139a50,_0x4c7d01,_0x2de07f){var _0x5c2977=0x1;var _0x323084=[];var _0x5ecb51={'context':_0x4c7d01[_0x412e('0x2')]||_0x412e('0x3'),'exten':util[_0x412e('0x4')](_0x412e('0x5'),_0x139a50[_0x412e('0x6')],_0x2de07f),'type':'system','isApp':![],'ChanSpyId':_0x139a50['id'],'UserId':_0x4c7d01['id']};_0x323084[_0x412e('0x7')](_[_0x412e('0x8')]({'app':_0x412e('0x9'),'appdata':util[_0x412e('0x4')](_0x412e('0xa'),'chanspy'),'priority':_0x5c2977++},_0x5ecb51));if(_0x139a50[_0x412e('0xb')]){_0x323084['push'](_['merge']({'app':_0x412e('0xc'),'appdata':util[_0x412e('0x4')](_0x412e('0xd'),_0x139a50['recordingFormat']),'priority':_0x5c2977++},_0x5ecb51));}if(_0x139a50[_0x412e('0xe')]){_0x323084[_0x412e('0x7')](_[_0x412e('0x8')]({'app':_0x412e('0xf'),'appdata':_0x139a50[_0x412e('0x10')],'priority':_0x5c2977++},_0x5ecb51));}_0x323084[_0x412e('0x7')](_['merge']({'app':_0x412e('0x11'),'appdata':util[_0x412e('0x4')]('SIP/%s,%s',_0x4c7d01[_0x412e('0x12')],_0x139a50[_0x412e('0x13')]?_0x139a50[_0x412e('0x13')][_0x412e('0x14')](''):''),'priority':_0x5c2977++},_0x5ecb51));if(_0x139a50[_0x412e('0xb')]){_0x323084[_0x412e('0x7')](_[_0x412e('0x8')]({'app':'StopMixMonitor','priority':_0x5c2977++},_0x5ecb51));}return _0x323084;};var getChanSpyApplications=function(_0x1d4fc6,_0x2e0ac2){var _0x30e6da=[];for(var _0x59bfc8=0x0,_0x25618d=0x1;_0x59bfc8<_0x2e0ac2['length'];_0x59bfc8++,_0x25618d=0x1){_0x30e6da=_0x30e6da['concat'](getUserApplications(_0x1d4fc6,_0x2e0ac2[_0x59bfc8],_0x2e0ac2[_0x59bfc8][_0x412e('0x15')]));if(_0x2e0ac2[_0x59bfc8][_0x412e('0x15')]!=_0x2e0ac2[_0x59bfc8][_0x412e('0x12')]){_0x30e6da=_0x30e6da[_0x412e('0x16')](getUserApplications(_0x1d4fc6,_0x2e0ac2[_0x59bfc8],_0x2e0ac2[_0x59bfc8]['name']));}}return _0x30e6da;};var getChanSpyPromise=function(_0x11f9fc,_0x560cb5){return new BPromise(function(_0x2777f6,_0x5415bb){return _0x11f9fc[_0x412e('0x17')][_0x412e('0x18')]({'attributes':['id','name','internal'],'where':{'role':_0x412e('0x19'),'chanspy':!![]},'raw':!![]})[_0x412e('0x1a')](function(_0xd7fb8f){if(_0xd7fb8f){return _0x2777f6(getChanSpyApplications(_0x560cb5,_0xd7fb8f));}return _0x2777f6([]);})['catch'](function(_0x987e32){_0x5415bb(_0x987e32);});});};module[_0x412e('0x1b')]=function(_0x2a4b4e,_0x285a1a){var _0x1ad9b9=_0x2a4b4e['models'];return _0x2a4b4e[_0x412e('0x1c')](_0x412e('0x1d'),attributes,{'tableName':_0x412e('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc00f4d,_0x4d876c,_0x1a6457){return getChanSpyPromise(_0x1ad9b9,_0xc00f4d)[_0x412e('0x1a')](function(_0x3a1a23){if(_0x3a1a23&&_0x3a1a23['length']){return _0x1ad9b9[_0x412e('0x1f')][_0x412e('0x20')](_0x3a1a23);}})['then'](function(){_0x1a6457();})['catch'](function(_0x3b7e94){_0x1a6457(_0x3b7e94);});},'afterUpdate':function(_0x31fb68,_0x43e765,_0x1fd921){return _0x1ad9b9['VoiceExtension'][_0x412e('0x21')]({'where':{'ChanSpyId':_0x31fb68['id']}})[_0x412e('0x1a')](function(){return getChanSpyPromise(_0x1ad9b9,_0x31fb68);})[_0x412e('0x1a')](function(_0x381cb2){if(_0x381cb2&&_0x381cb2[_0x412e('0x22')]){return _0x1ad9b9[_0x412e('0x1f')]['bulkCreate'](_0x381cb2);}})[_0x412e('0x1a')](function(){_0x1fd921();})[_0x412e('0x23')](function(_0x5df581){_0x1fd921(_0x5df581);});},'afterDestroy':function(_0x457a72,_0x34599c,_0x3ba530){return _0x1ad9b9[_0x412e('0x1f')][_0x412e('0x21')]({'where':{'ChanSpyId':_0x457a72['id']}})['then'](function(){_0x3ba530();})[_0x412e('0x23')](function(_0x212dc1){_0x3ba530(_0x212dc1);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index caa8a80..0a765e2 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.rpc.js +++ b/server/api/voiceChanSpy/voiceChanSpy.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19ea=['result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x16fe0d,_0x6e648a){var _0x5230c8=function(_0x43815a){while(--_0x43815a){_0x16fe0d['push'](_0x16fe0d['shift']());}};_0x5230c8(++_0x6e648a);}(_0x19ea,0xfe));var _0xa19e=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x19ea[_0x365be9];return _0x185c12;};'use strict';var _=require(_0xa19e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa19e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19e('0x2'));var db=require(_0xa19e('0x3'))['db'];var utils=require(_0xa19e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa19e('0x5'));var jayson=require(_0xa19e('0x6'));var client=jayson[_0xa19e('0x7')][_0xa19e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1087e7,_0x30fd4a,_0x336e23){return new BPromise(function(_0x1867cb,_0x44e468){return client[_0xa19e('0x9')](_0x1087e7,_0x336e23)[_0xa19e('0xa')](function(_0x59b907){logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));logger[_0xa19e('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x30fd4a,_0xa19e('0xd'),JSON[_0xa19e('0xf')](_0x59b907));if(_0x59b907[_0xa19e('0x10')]){if(_0x59b907['error'][_0xa19e('0x11')]===0x1f4){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x44e468(_0x59b907['error'][_0xa19e('0x12')]);}logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x1867cb(_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);}else{logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));_0x1867cb(_0x59b907[_0xa19e('0x13')]['message']);}})[_0xa19e('0x14')](function(_0x34066a){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x34066a);_0x44e468(_0x34066a);});});} \ No newline at end of file +var _0xf45e=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message'];(function(_0x2593fa,_0x1d220f){var _0x42f7a0=function(_0x27afe4){while(--_0x27afe4){_0x2593fa['push'](_0x2593fa['shift']());}};_0x42f7a0(++_0x1d220f);}(_0xf45e,0x115));var _0xef45=function(_0x205f24,_0x19d9ca){_0x205f24=_0x205f24-0x0;var _0xa40691=_0xf45e[_0x205f24];return _0xa40691;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 60052fa..be74e6d 100644 --- a/server/api/voiceContext/index.js +++ b/server/api/voiceContext/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25a7=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','put','delete','destroy','multer','util'];(function(_0x5106c9,_0xdbb539){var _0x207f72=function(_0x12c8bc){while(--_0x12c8bc){_0x5106c9['push'](_0x5106c9['shift']());}};_0x207f72(++_0xdbb539);}(_0x25a7,0xb9));var _0x725a=function(_0x623ac3,_0xc0d039){_0x623ac3=_0x623ac3-0x0;var _0x2a4b2c=_0x25a7[_0x623ac3];return _0x2a4b2c;};'use strict';var multer=require(_0x725a('0x0'));var util=require(_0x725a('0x1'));var path=require(_0x725a('0x2'));var timeout=require('connect-timeout');var express=require(_0x725a('0x3'));var router=express[_0x725a('0x4')]();var fs_extra=require(_0x725a('0x5'));var auth=require(_0x725a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x725a('0x7'));var controller=require(_0x725a('0x8'));router[_0x725a('0x9')]('/',auth[_0x725a('0xa')](),controller[_0x725a('0xb')]);router['get'](_0x725a('0xc'),auth[_0x725a('0xa')](),controller['show']);router[_0x725a('0xd')]('/',auth[_0x725a('0xa')](),controller['create']);router[_0x725a('0xe')](_0x725a('0xc'),auth[_0x725a('0xa')](),controller['update']);router[_0x725a('0xf')](_0x725a('0xc'),auth['isAuthenticated'](),controller[_0x725a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x12cd=['multer','util','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','post','create','destroy','exports'];(function(_0x1306e8,_0x18dec1){var _0x52a786=function(_0x53d32e){while(--_0x53d32e){_0x1306e8['push'](_0x1306e8['shift']());}};_0x52a786(++_0x18dec1);}(_0x12cd,0xe1));var _0xd12c=function(_0x55e922,_0x33bb4c){_0x55e922=_0x55e922-0x0;var _0x3236f9=_0x12cd[_0x55e922];return _0x3236f9;};'use strict';var multer=require(_0xd12c('0x0'));var util=require(_0xd12c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd12c('0x2'));var router=express[_0xd12c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd12c('0x4'));var config=require(_0xd12c('0x5'));var controller=require(_0xd12c('0x6'));router['get']('/',auth[_0xd12c('0x7')](),controller[_0xd12c('0x8')]);router[_0xd12c('0x9')](_0xd12c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd12c('0xb')]('/',auth['isAuthenticated'](),controller[_0xd12c('0xc')]);router['put']('/:id',auth[_0xd12c('0x7')](),controller['update']);router['delete'](_0xd12c('0xa'),auth[_0xd12c('0x7')](),controller[_0xd12c('0xd')]);module[_0xd12c('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f67a57e..30fe57c 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fde=['name','STRING','BOOLEAN','sequelize','exports'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x2fde,0x8a));var _0xe2fd=function(_0x5842db,_0x21ff7a){_0x5842db=_0x5842db-0x0;var _0x5ccaa5=_0x2fde[_0x5842db];return _0x5ccaa5;};'use strict';var Sequelize=require(_0xe2fd('0x0'));module[_0xe2fd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe2fd('0x2')},'description':{'type':Sequelize[_0xe2fd('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe2fd('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x18f7=['STRING','name','BOOLEAN','sequelize'];(function(_0x2e30cb,_0x59fcdf){var _0x562b43=function(_0x124aa4){while(--_0x124aa4){_0x2e30cb['push'](_0x2e30cb['shift']());}};_0x562b43(++_0x59fcdf);}(_0x18f7,0x173));var _0x718f=function(_0x5230eb,_0x29ec8a){_0x5230eb=_0x5230eb-0x0;var _0x23e301=_0x18f7[_0x5230eb];return _0x23e301;};'use strict';var Sequelize=require(_0x718f('0x0'));module['exports']={'name':{'type':Sequelize[_0x718f('0x1')],'unique':_0x718f('0x2')},'description':{'type':Sequelize[_0x718f('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x718f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index d2cb31c..37ac262 100644 --- a/server/api/voiceContext/voiceContext.controller.js +++ b/server/api/voiceContext/voiceContext.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c11=['squel','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Contexts','UserProfileResource','sendStatus','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','merge','filter','VoiceContext','includeAll','include','rows','catch','show','params','length','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','findAll','writeFileSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash'];(function(_0x2fb0b5,_0x52ee98){var _0x4c7090=function(_0x4f0b3b){while(--_0x4f0b3b){_0x2fb0b5['push'](_0x2fb0b5['shift']());}};_0x4c7090(++_0x52ee98);}(_0x8c11,0xb6));var _0x18c1=function(_0x52b920,_0x1263b9){_0x52b920=_0x52b920-0x0;var _0x399490=_0x8c11[_0x52b920];return _0x399490;};'use strict';var emlformat=require(_0x18c1('0x0'));var rimraf=require(_0x18c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x18c1('0x2'));var rp=require(_0x18c1('0x3'));var moment=require(_0x18c1('0x4'));var BPromise=require(_0x18c1('0x5'));var Mustache=require(_0x18c1('0x6'));var util=require(_0x18c1('0x7'));var path=require('path');var sox=require(_0x18c1('0x8'));var csv=require(_0x18c1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18c1('0xa'));var _=require(_0x18c1('0xb'));var squel=require(_0x18c1('0xc'));var crypto=require(_0x18c1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x18c1('0x9'));var querystring=require(_0x18c1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x18c1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x18c1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18c1('0x11'))('api');var utils=require(_0x18c1('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x18c1('0x13'));var db=require(_0x18c1('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x18c1('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x372f57,_0x4c5607,_0x46039c,_0x4a70c4){return new BPromise(function(_0x132c9,_0x3eda19){var _0x5a68a7=_0x4a70c4||client;return _0x5a68a7[_0x18c1('0x16')](_0x372f57,_0x46039c)['then'](function(_0x512f31){logger[_0x18c1('0x17')](_0x18c1('0x18'),_0x4c5607,_0x18c1('0x19'));logger['debug'](_0x18c1('0x1a'),_0x4c5607,'request\x20sent',JSON[_0x18c1('0x1b')](_0x512f31));if(_0x512f31[_0x18c1('0x1c')]){if(_0x512f31[_0x18c1('0x1c')][_0x18c1('0x1d')]===0x1f4){logger[_0x18c1('0x1c')](_0x18c1('0x18'),_0x4c5607,_0x512f31[_0x18c1('0x1c')][_0x18c1('0x1e')]);return _0x3eda19(_0x512f31[_0x18c1('0x1c')][_0x18c1('0x1e')]);}logger[_0x18c1('0x1c')](_0x18c1('0x18'),_0x4c5607,_0x512f31[_0x18c1('0x1c')][_0x18c1('0x1e')]);return _0x132c9(_0x512f31[_0x18c1('0x1c')][_0x18c1('0x1e')]);}else{logger[_0x18c1('0x17')](_0x18c1('0x18'),_0x4c5607,'request\x20sent');_0x132c9(_0x512f31[_0x18c1('0x1f')]['message']);}})['catch'](function(_0x2162f9){logger[_0x18c1('0x1c')](_0x18c1('0x18'),_0x4c5607,_0x2162f9);_0x3eda19(_0x2162f9);});});}function respondWithStatusCode(_0x796df2,_0x47702b){_0x47702b=_0x47702b||0xcc;return function(_0x33e505){if(_0x33e505){return _0x796df2['sendStatus'](_0x47702b);}return _0x796df2[_0x18c1('0x20')](_0x47702b)[_0x18c1('0x21')]();};}function respondWithResult(_0x2de090,_0x454ef3){_0x454ef3=_0x454ef3||0xc8;return function(_0x48c55b){if(_0x48c55b){return _0x2de090['status'](_0x454ef3)[_0x18c1('0x22')](_0x48c55b);}};}function respondWithFilteredResult(_0x31bff5,_0x571313){return function(_0x445d16){if(_0x445d16){var _0x5bd2e0=typeof _0x571313[_0x18c1('0x23')]===_0x18c1('0x24')&&typeof _0x571313['limit']===_0x18c1('0x24');var _0x3a6d93=_0x445d16['count'];var _0x4fd118=_0x5bd2e0?0x0:_0x571313[_0x18c1('0x23')];var _0x216d5b=_0x5bd2e0?_0x445d16[_0x18c1('0x25')]:_0x571313[_0x18c1('0x23')]+_0x571313[_0x18c1('0x26')];var _0x3784c7;if(_0x216d5b>=_0x3a6d93){_0x216d5b=_0x3a6d93;_0x3784c7=0xc8;}else{_0x3784c7=0xce;}_0x31bff5[_0x18c1('0x20')](_0x3784c7);return _0x31bff5[_0x18c1('0x27')](_0x18c1('0x28'),_0x4fd118+'-'+_0x216d5b+'/'+_0x3a6d93)['json'](_0x445d16);}return null;};}function patchUpdates(_0x2b61f9){return function(_0x131a9b){try{jsonpatch[_0x18c1('0x29')](_0x131a9b,_0x2b61f9,!![]);}catch(_0x142508){return BPromise[_0x18c1('0x2a')](_0x142508);}return _0x131a9b[_0x18c1('0x2b')]();};}function saveUpdates(_0x9098f5,_0x26142d){return function(_0x226f1f){if(_0x226f1f){return _0x226f1f[_0x18c1('0x2c')](_0x9098f5)['then'](function(_0x29d78e){return _0x29d78e;});}return null;};}function removeEntity(_0x34ea0e,_0x4aaba2){return function(_0x2587ae){if(_0x2587ae){return _0x2587ae[_0x18c1('0x2d')]()[_0x18c1('0x2e')](function(){var _0x542ba4=_0x2587ae[_0x18c1('0x2f')]({'plain':!![]});var _0x13824c=_0x18c1('0x30');return db[_0x18c1('0x31')][_0x18c1('0x2d')]({'where':{'type':_0x13824c,'resourceId':_0x542ba4['id']}})[_0x18c1('0x2e')](function(){return _0x2587ae;});})[_0x18c1('0x2e')](function(){_0x34ea0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19459a,_0x54d996){return function(_0x56ad12){if(!_0x56ad12){_0x19459a[_0x18c1('0x32')](0x194);}return _0x56ad12;};}function handleError(_0x729489,_0x558b4d){_0x558b4d=_0x558b4d||0x1f4;return function(_0x5e53dc){logger['error'](_0x5e53dc['stack']);if(_0x5e53dc['name']){delete _0x5e53dc[_0x18c1('0x33')];}_0x729489[_0x18c1('0x20')](_0x558b4d)[_0x18c1('0x34')](_0x5e53dc);};}exports[_0x18c1('0x35')]=function(_0x375a0e,_0x327df0){var _0x5c148e={},_0x4c3cee={},_0x42bdc0={'count':0x0,'rows':[]};var _0x38b539=_[_0x18c1('0x36')](db['VoiceContext'][_0x18c1('0x37')],function(_0x2f58e9){return{'name':_0x2f58e9['fieldName'],'type':_0x2f58e9[_0x18c1('0x38')][_0x18c1('0x39')]};});_0x4c3cee['model']=_[_0x18c1('0x36')](_0x38b539,_0x18c1('0x33'));_0x4c3cee[_0x18c1('0x3a')]=_[_0x18c1('0x3b')](_0x375a0e[_0x18c1('0x3a')]);_0x4c3cee[_0x18c1('0x3c')]=_[_0x18c1('0x3d')](_0x4c3cee[_0x18c1('0x3e')],_0x4c3cee[_0x18c1('0x3a')]);_0x5c148e[_0x18c1('0x3f')]=_[_0x18c1('0x3d')](_0x4c3cee[_0x18c1('0x3e')],qs[_0x18c1('0x40')](_0x375a0e['query'][_0x18c1('0x40')]));_0x5c148e['attributes']=_0x5c148e[_0x18c1('0x3f')]['length']?_0x5c148e[_0x18c1('0x3f')]:_0x4c3cee[_0x18c1('0x3e')];if(!_0x375a0e[_0x18c1('0x3a')]['hasOwnProperty'](_0x18c1('0x41'))){_0x5c148e['limit']=qs[_0x18c1('0x26')](_0x375a0e[_0x18c1('0x3a')][_0x18c1('0x26')]);_0x5c148e[_0x18c1('0x23')]=qs[_0x18c1('0x23')](_0x375a0e[_0x18c1('0x3a')]['offset']);}_0x5c148e['order']=qs[_0x18c1('0x42')](_0x375a0e[_0x18c1('0x3a')][_0x18c1('0x42')]);_0x5c148e[_0x18c1('0x43')]=qs['filters'](_['pick'](_0x375a0e[_0x18c1('0x3a')],_0x4c3cee['filters']),_0x38b539);if(_0x375a0e[_0x18c1('0x3a')]['filter']){_0x5c148e[_0x18c1('0x43')]=_[_0x18c1('0x44')](_0x5c148e[_0x18c1('0x43')],{'$or':_[_0x18c1('0x36')](_0x38b539,function(_0x484391){if(_0x484391[_0x18c1('0x38')]!=='VIRTUAL'){var _0x495507={};_0x495507[_0x484391[_0x18c1('0x33')]]={'$like':'%'+_0x375a0e[_0x18c1('0x3a')][_0x18c1('0x45')]+'%'};return _0x495507;}})});}_0x5c148e=_[_0x18c1('0x44')]({},_0x5c148e,_0x375a0e['options']);var _0x297535={'where':_0x5c148e['where']};return db[_0x18c1('0x46')][_0x18c1('0x25')](_0x297535)[_0x18c1('0x2e')](function(_0x1b449d){_0x42bdc0[_0x18c1('0x25')]=_0x1b449d;if(_0x375a0e[_0x18c1('0x3a')][_0x18c1('0x47')]){_0x5c148e[_0x18c1('0x48')]=[{'all':!![]}];}return db[_0x18c1('0x46')]['findAll'](_0x5c148e);})[_0x18c1('0x2e')](function(_0x4ba77c){_0x42bdc0[_0x18c1('0x49')]=_0x4ba77c;return _0x42bdc0;})[_0x18c1('0x2e')](respondWithFilteredResult(_0x327df0,_0x5c148e))[_0x18c1('0x4a')](handleError(_0x327df0,null));};exports[_0x18c1('0x4b')]=function(_0x4f0b6b,_0x40035c){var _0xa2c59c={'raw':![],'where':{'id':_0x4f0b6b[_0x18c1('0x4c')]['id']}},_0x2fa91f={};_0x2fa91f['model']=_[_0x18c1('0x3b')](db['VoiceContext'][_0x18c1('0x37')]);_0x2fa91f[_0x18c1('0x3a')]=_[_0x18c1('0x3b')](_0x4f0b6b[_0x18c1('0x3a')]);_0x2fa91f['filters']=_[_0x18c1('0x3d')](_0x2fa91f[_0x18c1('0x3e')],_0x2fa91f[_0x18c1('0x3a')]);_0xa2c59c[_0x18c1('0x3f')]=_[_0x18c1('0x3d')](_0x2fa91f[_0x18c1('0x3e')],qs[_0x18c1('0x40')](_0x4f0b6b[_0x18c1('0x3a')][_0x18c1('0x40')]));_0xa2c59c[_0x18c1('0x3f')]=_0xa2c59c[_0x18c1('0x3f')][_0x18c1('0x4d')]?_0xa2c59c[_0x18c1('0x3f')]:_0x2fa91f[_0x18c1('0x3e')];if(_0x4f0b6b[_0x18c1('0x3a')][_0x18c1('0x47')]){_0xa2c59c[_0x18c1('0x48')]=[{'all':!![]}];}_0xa2c59c=_[_0x18c1('0x44')]({},_0xa2c59c,_0x4f0b6b[_0x18c1('0x4e')]);return db[_0x18c1('0x46')][_0x18c1('0x4f')](_0xa2c59c)['then'](handleEntityNotFound(_0x40035c,null))[_0x18c1('0x2e')](respondWithResult(_0x40035c,null))[_0x18c1('0x4a')](handleError(_0x40035c,null));};exports[_0x18c1('0x50')]=function(_0x460f7b,_0x55a5e8,_0x7f9528){var _0x539996;return db[_0x18c1('0x46')]['create'](_0x460f7b[_0x18c1('0x51')],{'raw':!![]})['then'](function(_0x44c438){_0x539996=_0x44c438;return db[_0x18c1('0x46')]['findAll']({'raw':!![]});})['then'](function(_0x5dcec2){var _0xfb3266=fs[_0x18c1('0x52')](path[_0x18c1('0x53')](config[_0x18c1('0x54')],_0x18c1('0x55')),_0x18c1('0x56'));var _0x58f928=ejs[_0x18c1('0x57')](_0xfb3266,{'contexts':_0x5dcec2||[]});fs['writeFileSync'](_0x18c1('0x58'),_0x58f928);})[_0x18c1('0x2e')](function(){return respondWithRpcPromise(_0x18c1('0x59'),'create',{'module':_0x18c1('0x5a')});})['then'](function(){var _0x18b1f7=_0x460f7b[_0x18c1('0x5b')][_0x18c1('0x2f')]({'plain':!![]});if(!_0x18b1f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18b1f7[_0x18c1('0x5c')]===_0x18c1('0x5b')){var _0x4d0562=_0x539996[_0x18c1('0x2f')]({'plain':!![]});return db[_0x18c1('0x5d')]['find']({'where':{'name':_0x18c1('0x30'),'userProfileId':_0x18b1f7[_0x18c1('0x5e')]},'raw':!![]})[_0x18c1('0x2e')](function(_0x454a1d){if(_0x454a1d&&_0x454a1d['autoAssociation']===0x0){return db[_0x18c1('0x31')][_0x18c1('0x50')]({'name':_0x4d0562['name'],'resourceId':_0x4d0562['id'],'type':_0x454a1d[_0x18c1('0x33')],'sectionId':_0x454a1d['id']},{})['then'](function(){return _0x539996;});}else{return _0x539996;}})['catch'](function(_0x3e2108){logger[_0x18c1('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e2108);throw _0x3e2108;});}return _0x539996;})[_0x18c1('0x2e')](respondWithResult(_0x55a5e8,0xc9))['catch'](handleError(_0x55a5e8,null));};exports[_0x18c1('0x2c')]=function(_0x7e8e8a,_0x4a8a6e,_0x411642){var _0x2eaef4;return db[_0x18c1('0x46')][_0x18c1('0x4f')]({'where':{'id':_0x7e8e8a[_0x18c1('0x4c')]['id']}})[_0x18c1('0x2e')](handleEntityNotFound(_0x4a8a6e,null))[_0x18c1('0x2e')](saveUpdates(_0x7e8e8a[_0x18c1('0x51')],null))['then'](function(_0x4ca8f8){if(_0x4ca8f8){_0x2eaef4=_0x4ca8f8;return db[_0x18c1('0x46')][_0x18c1('0x5f')]({'raw':!![]});}})[_0x18c1('0x2e')](function(_0x59dbc8){var _0x2f97d1=fs[_0x18c1('0x52')](path[_0x18c1('0x53')](config['root'],_0x18c1('0x55')),_0x18c1('0x56'));var _0x3f9dcb=ejs[_0x18c1('0x57')](_0x2f97d1,{'contexts':_0x59dbc8||[]});fs[_0x18c1('0x60')](_0x18c1('0x58'),_0x3f9dcb);})[_0x18c1('0x2e')](function(){return respondWithRpcPromise(_0x18c1('0x59'),_0x18c1('0x2c'),{'module':_0x18c1('0x5a')});})['then'](function(){return _0x2eaef4;})['then'](respondWithResult(_0x4a8a6e,null))[_0x18c1('0x4a')](handleError(_0x4a8a6e,null));};exports['destroy']=function(_0x2ac8d4,_0xd70118,_0x3bdfc9){var _0x12ba09;return db['VoiceContext'][_0x18c1('0x4f')]({'where':{'id':_0x2ac8d4['params']['id']}})['then'](handleEntityNotFound(_0xd70118,null))['then'](removeEntity(_0xd70118,null))[_0x18c1('0x2e')](function(){return db[_0x18c1('0x46')]['findAll']({'raw':!![]});})[_0x18c1('0x2e')](function(_0x598d8a){var _0x29815a=fs[_0x18c1('0x52')](path['join'](config[_0x18c1('0x54')],_0x18c1('0x55')),_0x18c1('0x56'));var _0x3c2d1b=ejs[_0x18c1('0x57')](_0x29815a,{'contexts':_0x598d8a});fs[_0x18c1('0x60')](_0x18c1('0x58'),_0x3c2d1b);return respondWithRpcPromise('Reload','destroy',{'module':_0x18c1('0x5a')});})[_0x18c1('0x4a')](handleError(_0xd70118,null));}; \ No newline at end of file +var _0xaecb=['type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','params','keys','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','writeFileSync','Reload','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','Contexts','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0xaecb,0xff));var _0xbaec=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaecb[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xbaec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbaec('0x1'));var jsonpatch=require(_0xbaec('0x2'));var rp=require(_0xbaec('0x3'));var moment=require(_0xbaec('0x4'));var BPromise=require(_0xbaec('0x5'));var Mustache=require(_0xbaec('0x6'));var util=require('util');var path=require(_0xbaec('0x7'));var sox=require(_0xbaec('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbaec('0x9'));var jsforce=require(_0xbaec('0xa'));var deskjs=require(_0xbaec('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbaec('0xc'));var Papa=require(_0xbaec('0xd'));var Redis=require(_0xbaec('0xe'));var authService=require(_0xbaec('0xf'));var qs=require(_0xbaec('0x10'));var as=require(_0xbaec('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbaec('0x12'))(_0xbaec('0x13'));var utils=require(_0xbaec('0x14'));var config=require(_0xbaec('0x15'));var licenseUtil=require(_0xbaec('0x16'));var db=require(_0xbaec('0x17'))['db'];var jayson=require(_0xbaec('0x18'));var client=jayson['client'][_0xbaec('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x218cd2,_0xef7141,_0x3f9e88,_0x5f3309){return new BPromise(function(_0x11a048,_0x5785df){var _0x9f7996=_0x5f3309||client;return _0x9f7996['request'](_0x218cd2,_0x3f9e88)[_0xbaec('0x1a')](function(_0x15a827){logger['info'](_0xbaec('0x1b'),_0xef7141,'request\x20sent');logger[_0xbaec('0x1c')](_0xbaec('0x1d'),_0xef7141,_0xbaec('0x1e'),JSON[_0xbaec('0x1f')](_0x15a827));if(_0x15a827[_0xbaec('0x20')]){if(_0x15a827[_0xbaec('0x20')]['code']===0x1f4){logger[_0xbaec('0x20')](_0xbaec('0x1b'),_0xef7141,_0x15a827['error']['message']);return _0x5785df(_0x15a827[_0xbaec('0x20')][_0xbaec('0x21')]);}logger[_0xbaec('0x20')](_0xbaec('0x1b'),_0xef7141,_0x15a827['error'][_0xbaec('0x21')]);return _0x11a048(_0x15a827['error'][_0xbaec('0x21')]);}else{logger[_0xbaec('0x22')](_0xbaec('0x1b'),_0xef7141,_0xbaec('0x1e'));_0x11a048(_0x15a827[_0xbaec('0x23')][_0xbaec('0x21')]);}})[_0xbaec('0x24')](function(_0x10785c){logger['error'](_0xbaec('0x1b'),_0xef7141,_0x10785c);_0x5785df(_0x10785c);});});}function respondWithStatusCode(_0x33e180,_0xca66a7){_0xca66a7=_0xca66a7||0xcc;return function(_0x846cd9){if(_0x846cd9){return _0x33e180[_0xbaec('0x25')](_0xca66a7);}return _0x33e180[_0xbaec('0x26')](_0xca66a7)[_0xbaec('0x27')]();};}function respondWithResult(_0x325b9a,_0x1454f3){_0x1454f3=_0x1454f3||0xc8;return function(_0x38d671){if(_0x38d671){return _0x325b9a[_0xbaec('0x26')](_0x1454f3)[_0xbaec('0x28')](_0x38d671);}};}function respondWithFilteredResult(_0x3bc5d1,_0x1bad80){return function(_0x184c20){if(_0x184c20){var _0xa7cd75=typeof _0x1bad80['offset']===_0xbaec('0x29')&&typeof _0x1bad80[_0xbaec('0x2a')]===_0xbaec('0x29');var _0x20cfd5=_0x184c20[_0xbaec('0x2b')];var _0x5de019=_0xa7cd75?0x0:_0x1bad80[_0xbaec('0x2c')];var _0x5522f5=_0xa7cd75?_0x184c20[_0xbaec('0x2b')]:_0x1bad80[_0xbaec('0x2c')]+_0x1bad80[_0xbaec('0x2a')];var _0x361068;if(_0x5522f5>=_0x20cfd5){_0x5522f5=_0x20cfd5;_0x361068=0xc8;}else{_0x361068=0xce;}_0x3bc5d1[_0xbaec('0x26')](_0x361068);return _0x3bc5d1[_0xbaec('0x2d')](_0xbaec('0x2e'),_0x5de019+'-'+_0x5522f5+'/'+_0x20cfd5)['json'](_0x184c20);}return null;};}function patchUpdates(_0x585be0){return function(_0x5f3d14){try{jsonpatch[_0xbaec('0x2f')](_0x5f3d14,_0x585be0,!![]);}catch(_0x56ffdd){return BPromise['reject'](_0x56ffdd);}return _0x5f3d14[_0xbaec('0x30')]();};}function saveUpdates(_0x44a6ad,_0x397834){return function(_0x12ba3c){if(_0x12ba3c){return _0x12ba3c[_0xbaec('0x31')](_0x44a6ad)[_0xbaec('0x1a')](function(_0x36e4fd){return _0x36e4fd;});}return null;};}function removeEntity(_0x5dfb9e,_0x5baaff){return function(_0x4a0f1e){if(_0x4a0f1e){return _0x4a0f1e['destroy']()[_0xbaec('0x1a')](function(){var _0x4b7665=_0x4a0f1e['get']({'plain':!![]});var _0x16a371=_0xbaec('0x32');return db[_0xbaec('0x33')][_0xbaec('0x34')]({'where':{'type':_0x16a371,'resourceId':_0x4b7665['id']}})[_0xbaec('0x1a')](function(){return _0x4a0f1e;});})['then'](function(){_0x5dfb9e['status'](0xcc)[_0xbaec('0x27')]();});}};}function handleEntityNotFound(_0x2c0c92,_0x31d456){return function(_0x1eac1d){if(!_0x1eac1d){_0x2c0c92['sendStatus'](0x194);}return _0x1eac1d;};}function handleError(_0x3737fe,_0x432b78){_0x432b78=_0x432b78||0x1f4;return function(_0x40fe09){logger[_0xbaec('0x20')](_0x40fe09[_0xbaec('0x35')]);if(_0x40fe09['name']){delete _0x40fe09[_0xbaec('0x36')];}_0x3737fe['status'](_0x432b78)[_0xbaec('0x37')](_0x40fe09);};}exports[_0xbaec('0x38')]=function(_0x5129d4,_0x49a657){var _0x4d4a71={},_0xd2c3bb={},_0x5bb18c={'count':0x0,'rows':[]};var _0x52e59f=_[_0xbaec('0x39')](db['VoiceContext'][_0xbaec('0x3a')],function(_0x18f874){return{'name':_0x18f874[_0xbaec('0x3b')],'type':_0x18f874[_0xbaec('0x3c')][_0xbaec('0x3d')]};});_0xd2c3bb[_0xbaec('0x3e')]=_[_0xbaec('0x39')](_0x52e59f,_0xbaec('0x36'));_0xd2c3bb[_0xbaec('0x3f')]=_['keys'](_0x5129d4['query']);_0xd2c3bb['filters']=_[_0xbaec('0x40')](_0xd2c3bb[_0xbaec('0x3e')],_0xd2c3bb[_0xbaec('0x3f')]);_0x4d4a71[_0xbaec('0x41')]=_['intersection'](_0xd2c3bb[_0xbaec('0x3e')],qs[_0xbaec('0x42')](_0x5129d4[_0xbaec('0x3f')]['fields']));_0x4d4a71[_0xbaec('0x41')]=_0x4d4a71['attributes'][_0xbaec('0x43')]?_0x4d4a71[_0xbaec('0x41')]:_0xd2c3bb['model'];if(!_0x5129d4[_0xbaec('0x3f')][_0xbaec('0x44')]('nolimit')){_0x4d4a71[_0xbaec('0x2a')]=qs[_0xbaec('0x2a')](_0x5129d4[_0xbaec('0x3f')]['limit']);_0x4d4a71[_0xbaec('0x2c')]=qs[_0xbaec('0x2c')](_0x5129d4[_0xbaec('0x3f')][_0xbaec('0x2c')]);}_0x4d4a71[_0xbaec('0x45')]=qs['sort'](_0x5129d4[_0xbaec('0x3f')][_0xbaec('0x46')]);_0x4d4a71[_0xbaec('0x47')]=qs[_0xbaec('0x48')](_[_0xbaec('0x49')](_0x5129d4[_0xbaec('0x3f')],_0xd2c3bb[_0xbaec('0x48')]),_0x52e59f);if(_0x5129d4['query'][_0xbaec('0x4a')]){_0x4d4a71['where']=_[_0xbaec('0x4b')](_0x4d4a71[_0xbaec('0x47')],{'$or':_['map'](_0x52e59f,function(_0x3b8667){if(_0x3b8667[_0xbaec('0x3c')]!==_0xbaec('0x4c')){var _0x4b6b18={};_0x4b6b18[_0x3b8667[_0xbaec('0x36')]]={'$like':'%'+_0x5129d4[_0xbaec('0x3f')][_0xbaec('0x4a')]+'%'};return _0x4b6b18;}})});}_0x4d4a71=_['merge']({},_0x4d4a71,_0x5129d4[_0xbaec('0x4d')]);var _0x5049d9={'where':_0x4d4a71[_0xbaec('0x47')]};return db[_0xbaec('0x4e')][_0xbaec('0x2b')](_0x5049d9)[_0xbaec('0x1a')](function(_0x5c8989){_0x5bb18c[_0xbaec('0x2b')]=_0x5c8989;if(_0x5129d4[_0xbaec('0x3f')][_0xbaec('0x4f')]){_0x4d4a71[_0xbaec('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0xbaec('0x51')](_0x4d4a71);})[_0xbaec('0x1a')](function(_0x449d15){_0x5bb18c[_0xbaec('0x52')]=_0x449d15;return _0x5bb18c;})[_0xbaec('0x1a')](respondWithFilteredResult(_0x49a657,_0x4d4a71))[_0xbaec('0x24')](handleError(_0x49a657,null));};exports[_0xbaec('0x53')]=function(_0xaf4e35,_0x4d22b7){var _0x5adba9={'raw':![],'where':{'id':_0xaf4e35[_0xbaec('0x54')]['id']}},_0x39c1eb={};_0x39c1eb[_0xbaec('0x3e')]=_[_0xbaec('0x55')](db['VoiceContext'][_0xbaec('0x3a')]);_0x39c1eb[_0xbaec('0x3f')]=_[_0xbaec('0x55')](_0xaf4e35['query']);_0x39c1eb['filters']=_['intersection'](_0x39c1eb['model'],_0x39c1eb[_0xbaec('0x3f')]);_0x5adba9['attributes']=_[_0xbaec('0x40')](_0x39c1eb[_0xbaec('0x3e')],qs['fields'](_0xaf4e35[_0xbaec('0x3f')]['fields']));_0x5adba9[_0xbaec('0x41')]=_0x5adba9[_0xbaec('0x41')]['length']?_0x5adba9['attributes']:_0x39c1eb[_0xbaec('0x3e')];if(_0xaf4e35[_0xbaec('0x3f')]['includeAll']){_0x5adba9[_0xbaec('0x50')]=[{'all':!![]}];}_0x5adba9=_[_0xbaec('0x4b')]({},_0x5adba9,_0xaf4e35['options']);return db[_0xbaec('0x4e')][_0xbaec('0x56')](_0x5adba9)[_0xbaec('0x1a')](handleEntityNotFound(_0x4d22b7,null))[_0xbaec('0x1a')](respondWithResult(_0x4d22b7,null))['catch'](handleError(_0x4d22b7,null));};exports[_0xbaec('0x57')]=function(_0x146a26,_0x44f4cb,_0x344e19){var _0x1210d5;return db[_0xbaec('0x4e')][_0xbaec('0x57')](_0x146a26[_0xbaec('0x58')],{'raw':!![]})['then'](function(_0x1cfbed){_0x1210d5=_0x1cfbed;return db['VoiceContext'][_0xbaec('0x51')]({'raw':!![]});})[_0xbaec('0x1a')](function(_0x1193fd){var _0x17f1f4=fs[_0xbaec('0x59')](path[_0xbaec('0x5a')](config[_0xbaec('0x5b')],_0xbaec('0x5c')),_0xbaec('0x5d'));var _0x61f725=ejs[_0xbaec('0x5e')](_0x17f1f4,{'contexts':_0x1193fd||[]});fs['writeFileSync'](_0xbaec('0x5f'),_0x61f725);})[_0xbaec('0x1a')](function(){return respondWithRpcPromise('Reload',_0xbaec('0x57'),{'module':_0xbaec('0x60')});})['then'](function(){var _0x38a4b8=_0x146a26[_0xbaec('0x61')][_0xbaec('0x62')]({'plain':!![]});if(!_0x38a4b8)throw new Error(_0xbaec('0x63'));if(_0x38a4b8['role']==='user'){var _0x24c344=_0x1210d5[_0xbaec('0x62')]({'plain':!![]});return db[_0xbaec('0x64')][_0xbaec('0x56')]({'where':{'name':_0xbaec('0x32'),'userProfileId':_0x38a4b8['userProfileId']},'raw':!![]})[_0xbaec('0x1a')](function(_0x570a7e){if(_0x570a7e&&_0x570a7e[_0xbaec('0x65')]===0x0){return db[_0xbaec('0x33')][_0xbaec('0x57')]({'name':_0x24c344[_0xbaec('0x36')],'resourceId':_0x24c344['id'],'type':_0x570a7e[_0xbaec('0x36')],'sectionId':_0x570a7e['id']},{})[_0xbaec('0x1a')](function(){return _0x1210d5;});}else{return _0x1210d5;}})['catch'](function(_0x455702){logger['error'](_0xbaec('0x66'),_0x455702);throw _0x455702;});}return _0x1210d5;})[_0xbaec('0x1a')](respondWithResult(_0x44f4cb,0xc9))[_0xbaec('0x24')](handleError(_0x44f4cb,null));};exports[_0xbaec('0x31')]=function(_0x321909,_0x37941e,_0x25ce69){var _0x3fe634;return db[_0xbaec('0x4e')][_0xbaec('0x56')]({'where':{'id':_0x321909['params']['id']}})[_0xbaec('0x1a')](handleEntityNotFound(_0x37941e,null))[_0xbaec('0x1a')](saveUpdates(_0x321909[_0xbaec('0x58')],null))[_0xbaec('0x1a')](function(_0x5a81e7){if(_0x5a81e7){_0x3fe634=_0x5a81e7;return db['VoiceContext'][_0xbaec('0x51')]({'raw':!![]});}})[_0xbaec('0x1a')](function(_0x1f1703){var _0x15922e=fs['readFileSync'](path['join'](config[_0xbaec('0x5b')],_0xbaec('0x5c')),_0xbaec('0x5d'));var _0xd1872d=ejs[_0xbaec('0x5e')](_0x15922e,{'contexts':_0x1f1703||[]});fs[_0xbaec('0x67')](_0xbaec('0x5f'),_0xd1872d);})[_0xbaec('0x1a')](function(){return respondWithRpcPromise(_0xbaec('0x68'),'update',{'module':_0xbaec('0x60')});})[_0xbaec('0x1a')](function(){return _0x3fe634;})[_0xbaec('0x1a')](respondWithResult(_0x37941e,null))[_0xbaec('0x24')](handleError(_0x37941e,null));};exports[_0xbaec('0x34')]=function(_0x2b8a84,_0xf42f5e,_0xf36668){var _0x4a9349;return db[_0xbaec('0x4e')][_0xbaec('0x56')]({'where':{'id':_0x2b8a84[_0xbaec('0x54')]['id']}})[_0xbaec('0x1a')](handleEntityNotFound(_0xf42f5e,null))[_0xbaec('0x1a')](removeEntity(_0xf42f5e,null))[_0xbaec('0x1a')](function(){return db[_0xbaec('0x4e')][_0xbaec('0x51')]({'raw':!![]});})[_0xbaec('0x1a')](function(_0x1bdba1){var _0x916856=fs[_0xbaec('0x59')](path[_0xbaec('0x5a')](config[_0xbaec('0x5b')],_0xbaec('0x5c')),'utf8');var _0x27d9e9=ejs[_0xbaec('0x5e')](_0x916856,{'contexts':_0x1bdba1});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x27d9e9);return respondWithRpcPromise(_0xbaec('0x68'),_0xbaec('0x34'),{'module':_0xbaec('0x60')});})['catch'](handleError(_0xf42f5e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f28ec09..2f3c8b2 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31dc=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','util','../../config/logger'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x31dc,0x1ab));var _0xc31d=function(_0x42120b,_0x2900c5){_0x42120b=_0x42120b-0x0;var _0x3dccf2=_0x31dc[_0x42120b];return _0x3dccf2;};'use strict';var _=require('lodash');var util=require(_0xc31d('0x0'));var logger=require(_0xc31d('0x1'))(_0xc31d('0x2'));var moment=require(_0xc31d('0x3'));var BPromise=require(_0xc31d('0x4'));var rp=require(_0xc31d('0x5'));var fs=require('fs');var path=require(_0xc31d('0x6'));var rimraf=require(_0xc31d('0x7'));var config=require(_0xc31d('0x8'));var attributes=require(_0xc31d('0x9'));module[_0xc31d('0xa')]=function(_0x1f179c,_0x1e15bd){return _0x1f179c[_0xc31d('0xb')](_0xc31d('0xc'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9efd=['../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0x9efd,0xae));var _0xd9ef=function(_0x4b6bd1,_0x24296d){_0x4b6bd1=_0x4b6bd1-0x0;var _0x1913be=_0x9efd[_0x4b6bd1];return _0x1913be;};'use strict';var _=require(_0xd9ef('0x0'));var util=require(_0xd9ef('0x1'));var logger=require(_0xd9ef('0x2'))(_0xd9ef('0x3'));var moment=require('moment');var BPromise=require(_0xd9ef('0x4'));var rp=require(_0xd9ef('0x5'));var fs=require('fs');var path=require(_0xd9ef('0x6'));var rimraf=require(_0xd9ef('0x7'));var config=require(_0xd9ef('0x8'));var attributes=require(_0xd9ef('0x9'));module['exports']=function(_0x5e42a6,_0x57a3eb){return _0x5e42a6[_0xd9ef('0xa')](_0xd9ef('0xb'),attributes,{'tableName':_0xd9ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 31049a2..1ccf1ae 100644 --- a/server/api/voiceContext/voiceContext.rpc.js +++ b/server/api/voiceContext/voiceContext.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ea1=['message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error'];(function(_0x1d157f,_0xfabfa4){var _0x1d16c6=function(_0x5f2126){while(--_0x5f2126){_0x1d157f['push'](_0x1d157f['shift']());}};_0x1d16c6(++_0xfabfa4);}(_0x2ea1,0xca));var _0x12ea=function(_0x32572d,_0x5062c9){_0x32572d=_0x32572d-0x0;var _0x5e9831=_0x2ea1[_0x32572d];return _0x5e9831;};'use strict';var _=require(_0x12ea('0x0'));var util=require(_0x12ea('0x1'));var moment=require(_0x12ea('0x2'));var BPromise=require(_0x12ea('0x3'));var rs=require(_0x12ea('0x4'));var fs=require('fs');var Redis=require(_0x12ea('0x5'));var db=require(_0x12ea('0x6'))['db'];var utils=require(_0x12ea('0x7'));var logger=require('../../config/logger')(_0x12ea('0x8'));var config=require(_0x12ea('0x9'));var jayson=require(_0x12ea('0xa'));var client=jayson['client'][_0x12ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x242d90,_0x46885c,_0x18108b){return new BPromise(function(_0x3d83e1,_0xacc885){return client[_0x12ea('0xc')](_0x242d90,_0x18108b)['then'](function(_0x5984f7){logger[_0x12ea('0xd')]('VoiceContext,\x20%s,\x20%s',_0x46885c,_0x12ea('0xe'));logger[_0x12ea('0xf')](_0x12ea('0x10'),_0x46885c,_0x12ea('0xe'),JSON['stringify'](_0x5984f7));if(_0x5984f7[_0x12ea('0x11')]){if(_0x5984f7[_0x12ea('0x11')]['code']===0x1f4){logger[_0x12ea('0x11')]('VoiceContext,\x20%s,\x20%s',_0x46885c,_0x5984f7['error'][_0x12ea('0x12')]);return _0xacc885(_0x5984f7[_0x12ea('0x11')][_0x12ea('0x12')]);}logger[_0x12ea('0x11')](_0x12ea('0x13'),_0x46885c,_0x5984f7[_0x12ea('0x11')][_0x12ea('0x12')]);return _0x3d83e1(_0x5984f7[_0x12ea('0x11')]['message']);}else{logger[_0x12ea('0xd')](_0x12ea('0x13'),_0x46885c,_0x12ea('0xe'));_0x3d83e1(_0x5984f7[_0x12ea('0x14')]['message']);}})[_0x12ea('0x15')](function(_0x4d8c57){logger[_0x12ea('0x11')](_0x12ea('0x13'),_0x46885c,_0x4d8c57);_0xacc885(_0x4d8c57);});});} \ No newline at end of file +var _0x1c8a=['error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','debug','request\x20sent','code'];(function(_0x1374d7,_0x3f73de){var _0x1e5b49=function(_0x35850d){while(--_0x35850d){_0x1374d7['push'](_0x1374d7['shift']());}};_0x1e5b49(++_0x3f73de);}(_0x1c8a,0x140));var _0xa1c8=function(_0x5e43f4,_0x47ea74){_0x5e43f4=_0x5e43f4-0x0;var _0x3bcd34=_0x1c8a[_0x5e43f4];return _0x3bcd34;};'use strict';var _=require(_0xa1c8('0x0'));var util=require(_0xa1c8('0x1'));var moment=require(_0xa1c8('0x2'));var BPromise=require(_0xa1c8('0x3'));var rs=require(_0xa1c8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1c8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c8('0x6'))(_0xa1c8('0x7'));var config=require(_0xa1c8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa1c8('0x9')][_0xa1c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14d2f0,_0x57d2d4,_0x32993e){return new BPromise(function(_0xf93962,_0x44cf0d){return client['request'](_0x14d2f0,_0x32993e)[_0xa1c8('0xb')](function(_0x23d253){logger[_0xa1c8('0xc')]('VoiceContext,\x20%s,\x20%s',_0x57d2d4,'request\x20sent');logger[_0xa1c8('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x57d2d4,_0xa1c8('0xe'),JSON['stringify'](_0x23d253));if(_0x23d253['error']){if(_0x23d253['error'][_0xa1c8('0xf')]===0x1f4){logger[_0xa1c8('0x10')](_0xa1c8('0x11'),_0x57d2d4,_0x23d253[_0xa1c8('0x10')][_0xa1c8('0x12')]);return _0x44cf0d(_0x23d253[_0xa1c8('0x10')]['message']);}logger[_0xa1c8('0x10')](_0xa1c8('0x11'),_0x57d2d4,_0x23d253[_0xa1c8('0x10')][_0xa1c8('0x12')]);return _0xf93962(_0x23d253[_0xa1c8('0x10')][_0xa1c8('0x12')]);}else{logger['info'](_0xa1c8('0x11'),_0x57d2d4,_0xa1c8('0xe'));_0xf93962(_0x23d253[_0xa1c8('0x13')][_0xa1c8('0x12')]);}})[_0xa1c8('0x14')](function(_0x5ab171){logger[_0xa1c8('0x10')]('VoiceContext,\x20%s,\x20%s',_0x57d2d4,_0x5ab171);_0x44cf0d(_0x5ab171);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index cc30f24..9877645 100644 --- a/server/api/voiceDialReport/index.js +++ b/server/api/voiceDialReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b5b=['../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3b5b,0xc2));var _0xb3b5=function(_0x135704,_0x539aee){_0x135704=_0x135704-0x0;var _0x24e9fd=_0x3b5b[_0x135704];return _0x24e9fd;};'use strict';var multer=require(_0xb3b5('0x0'));var util=require(_0xb3b5('0x1'));var path=require('path');var timeout=require(_0xb3b5('0x2'));var express=require(_0xb3b5('0x3'));var router=express[_0xb3b5('0x4')]();var fs_extra=require(_0xb3b5('0x5'));var auth=require(_0xb3b5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb3b5('0x7'));var controller=require(_0xb3b5('0x8'));router[_0xb3b5('0x9')]('/',auth[_0xb3b5('0xa')](),controller['index']);router['get'](_0xb3b5('0xb'),auth[_0xb3b5('0xa')](),controller[_0xb3b5('0xc')]);router[_0xb3b5('0x9')](_0xb3b5('0xd'),auth['isAuthenticated'](),controller[_0xb3b5('0xe')]);router[_0xb3b5('0xf')]('/',auth['isAuthenticated'](),controller[_0xb3b5('0x10')]);router['put'](_0xb3b5('0xd'),auth[_0xb3b5('0xa')](),controller['update']);router[_0xb3b5('0x11')](_0xb3b5('0xd'),auth[_0xb3b5('0xa')](),controller[_0xb3b5('0x12')]);module[_0xb3b5('0x13')]=router; \ No newline at end of file +var _0xb664=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb664,0x192));var _0x4b66=function(_0x1e5022,_0x2fcb3b){_0x1e5022=_0x1e5022-0x0;var _0x401398=_0xb664[_0x1e5022];return _0x401398;};'use strict';var multer=require(_0x4b66('0x0'));var util=require(_0x4b66('0x1'));var path=require(_0x4b66('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b66('0x3'));var router=express[_0x4b66('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4b66('0x5'));var interaction=require(_0x4b66('0x6'));var config=require('../../config/environment');var controller=require(_0x4b66('0x7'));router['get']('/',auth[_0x4b66('0x8')](),controller[_0x4b66('0x9')]);router[_0x4b66('0xa')](_0x4b66('0xb'),auth[_0x4b66('0x8')](),controller[_0x4b66('0xc')]);router[_0x4b66('0xa')](_0x4b66('0xd'),auth[_0x4b66('0x8')](),controller[_0x4b66('0xe')]);router[_0x4b66('0xf')]('/',auth[_0x4b66('0x8')](),controller[_0x4b66('0x10')]);router[_0x4b66('0x11')](_0x4b66('0xd'),auth[_0x4b66('0x8')](),controller[_0x4b66('0x12')]);router[_0x4b66('0x13')](_0x4b66('0xd'),auth[_0x4b66('0x8')](),controller[_0x4b66('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index bdb1516..ad38902 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x1f217b,_0x3b7c48){var _0x1918b3=function(_0x2e2817){while(--_0x2e2817){_0x1f217b['push'](_0x1f217b['shift']());}};_0x1918b3(++_0x3b7c48);}(_0xa41a,0x6b));var _0xaa41=function(_0x16432c,_0x209963){_0x16432c=_0x16432c-0x0;var _0x36aab0=_0xa41a[_0x16432c];return _0x36aab0;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 4a20365..756309e 100644 --- a/server/api/voiceDialReport/voiceDialReport.controller.js +++ b/server/api/voiceDialReport/voiceDialReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c82=['lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','rows','show','params','catch','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','mustache','to-csv','ejs','fs-extra'];(function(_0xf7cf7a,_0x4809db){var _0x49ddac=function(_0x404bf6){while(--_0x404bf6){_0xf7cf7a['push'](_0xf7cf7a['shift']());}};_0x49ddac(++_0x4809db);}(_0x3c82,0x129));var _0x23c8=function(_0x160803,_0x33353){_0x160803=_0x160803-0x0;var _0x147c1d=_0x3c82[_0x160803];return _0x147c1d;};'use strict';var emlformat=require(_0x23c8('0x0'));var rimraf=require(_0x23c8('0x1'));var zipdir=require(_0x23c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x23c8('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x23c8('0x4'));var ejs=require(_0x23c8('0x5'));var fs=require('fs');var fs_extra=require(_0x23c8('0x6'));var _=require(_0x23c8('0x7'));var squel=require(_0x23c8('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23c8('0x9'));var toCsv=require(_0x23c8('0x4'));var querystring=require(_0x23c8('0xa'));var Papa=require(_0x23c8('0xb'));var Redis=require(_0x23c8('0xc'));var authService=require(_0x23c8('0xd'));var qs=require(_0x23c8('0xe'));var as=require(_0x23c8('0xf'));var hardwareService=require(_0x23c8('0x10'));var logger=require(_0x23c8('0x11'))(_0x23c8('0x12'));var utils=require('../../config/utils');var config=require(_0x23c8('0x13'));var licenseUtil=require(_0x23c8('0x14'));var db=require(_0x23c8('0x15'))['db'];function respondWithStatusCode(_0x1aaf7a,_0x22d035){_0x22d035=_0x22d035||0xcc;return function(_0x3bfea5){if(_0x3bfea5){return _0x1aaf7a[_0x23c8('0x16')](_0x22d035);}return _0x1aaf7a['status'](_0x22d035)[_0x23c8('0x17')]();};}function respondWithResult(_0x93183c,_0xf8b625){_0xf8b625=_0xf8b625||0xc8;return function(_0x477c24){if(_0x477c24){return _0x93183c[_0x23c8('0x18')](_0xf8b625)['json'](_0x477c24);}};}function respondWithFilteredResult(_0x4ca9c5,_0x5196ea){return function(_0x1ab5b4){if(_0x1ab5b4){var _0x2934ed=typeof _0x5196ea[_0x23c8('0x19')]===_0x23c8('0x1a')&&typeof _0x5196ea[_0x23c8('0x1b')]==='undefined';var _0x452b9d=_0x1ab5b4['count'];var _0x44be13=_0x2934ed?0x0:_0x5196ea[_0x23c8('0x19')];var _0x207f14=_0x2934ed?_0x1ab5b4[_0x23c8('0x1c')]:_0x5196ea[_0x23c8('0x19')]+_0x5196ea['limit'];var _0x50618e;if(_0x207f14>=_0x452b9d){_0x207f14=_0x452b9d;_0x50618e=0xc8;}else{_0x50618e=0xce;}_0x4ca9c5[_0x23c8('0x18')](_0x50618e);return _0x4ca9c5[_0x23c8('0x1d')](_0x23c8('0x1e'),_0x44be13+'-'+_0x207f14+'/'+_0x452b9d)[_0x23c8('0x1f')](_0x1ab5b4);}return null;};}function patchUpdates(_0xa8355f){return function(_0x139773){try{jsonpatch[_0x23c8('0x20')](_0x139773,_0xa8355f,!![]);}catch(_0x40644d){return BPromise[_0x23c8('0x21')](_0x40644d);}return _0x139773['save']();};}function saveUpdates(_0x28193f,_0x3ae091){return function(_0x45cf2f){if(_0x45cf2f){return _0x45cf2f[_0x23c8('0x22')](_0x28193f)[_0x23c8('0x23')](function(_0x1f808d){return _0x1f808d;});}return null;};}function removeEntity(_0x9d2570,_0x555011){return function(_0x56582e){if(_0x56582e){return _0x56582e['destroy']()[_0x23c8('0x23')](function(){_0x9d2570[_0x23c8('0x18')](0xcc)[_0x23c8('0x17')]();});}};}function handleEntityNotFound(_0x11b146,_0x460c0e){return function(_0x3dd598){if(!_0x3dd598){_0x11b146[_0x23c8('0x16')](0x194);}return _0x3dd598;};}function handleError(_0xee73ff,_0x1dde85){_0x1dde85=_0x1dde85||0x1f4;return function(_0x51dde8){logger[_0x23c8('0x24')](_0x51dde8[_0x23c8('0x25')]);if(_0x51dde8[_0x23c8('0x26')]){delete _0x51dde8[_0x23c8('0x26')];}_0xee73ff[_0x23c8('0x18')](_0x1dde85)[_0x23c8('0x27')](_0x51dde8);};}exports[_0x23c8('0x28')]=function(_0x18b8ac,_0x12ac4f){var _0x4516e1={},_0x123378={},_0x2f65c4={'count':0x0,'rows':[]};var _0x1b9d6f=_[_0x23c8('0x29')](db['VoiceDialReport'][_0x23c8('0x2a')],function(_0x3c84b7){return{'name':_0x3c84b7[_0x23c8('0x2b')],'type':_0x3c84b7[_0x23c8('0x2c')][_0x23c8('0x2d')]};});_0x123378['model']=_[_0x23c8('0x29')](_0x1b9d6f,_0x23c8('0x26'));_0x123378[_0x23c8('0x2e')]=_[_0x23c8('0x2f')](_0x18b8ac[_0x23c8('0x2e')]);_0x123378[_0x23c8('0x30')]=_[_0x23c8('0x31')](_0x123378[_0x23c8('0x32')],_0x123378['query']);_0x4516e1[_0x23c8('0x33')]=_[_0x23c8('0x31')](_0x123378[_0x23c8('0x32')],qs[_0x23c8('0x34')](_0x18b8ac[_0x23c8('0x2e')][_0x23c8('0x34')]));_0x4516e1[_0x23c8('0x33')]=_0x4516e1[_0x23c8('0x33')][_0x23c8('0x35')]?_0x4516e1[_0x23c8('0x33')]:_0x123378[_0x23c8('0x32')];if(!_0x18b8ac['query']['hasOwnProperty'](_0x23c8('0x36'))){_0x4516e1[_0x23c8('0x1b')]=qs[_0x23c8('0x1b')](_0x18b8ac[_0x23c8('0x2e')]['limit']);_0x4516e1[_0x23c8('0x19')]=qs[_0x23c8('0x19')](_0x18b8ac[_0x23c8('0x2e')][_0x23c8('0x19')]);}_0x4516e1[_0x23c8('0x37')]=qs['sort'](_0x18b8ac[_0x23c8('0x2e')][_0x23c8('0x38')]);_0x4516e1[_0x23c8('0x39')]=qs[_0x23c8('0x30')](_[_0x23c8('0x3a')](_0x18b8ac['query'],_0x123378[_0x23c8('0x30')]),_0x1b9d6f);if(_0x18b8ac['query'][_0x23c8('0x3b')]){_0x4516e1['where']=_[_0x23c8('0x3c')](_0x4516e1[_0x23c8('0x39')],{'$or':_[_0x23c8('0x29')](_0x1b9d6f,function(_0x2ef6e4){if(_0x2ef6e4[_0x23c8('0x2c')]!==_0x23c8('0x3d')){var _0x31331f={};_0x31331f[_0x2ef6e4[_0x23c8('0x26')]]={'$like':'%'+_0x18b8ac['query'][_0x23c8('0x3b')]+'%'};return _0x31331f;}})});}_0x4516e1=_[_0x23c8('0x3c')]({},_0x4516e1,_0x18b8ac[_0x23c8('0x3e')]);var _0x3964cd={'where':_0x4516e1[_0x23c8('0x39')]};return db[_0x23c8('0x3f')][_0x23c8('0x1c')](_0x3964cd)[_0x23c8('0x23')](function(_0x2fb6ed){_0x2f65c4['count']=_0x2fb6ed;if(_0x18b8ac[_0x23c8('0x2e')][_0x23c8('0x40')]){_0x4516e1[_0x23c8('0x41')]=[{'all':!![]}];}return db[_0x23c8('0x3f')][_0x23c8('0x42')](_0x4516e1);})[_0x23c8('0x23')](function(_0x335596){_0x2f65c4[_0x23c8('0x43')]=_0x335596;return _0x2f65c4;})[_0x23c8('0x23')](respondWithFilteredResult(_0x12ac4f,_0x4516e1))['catch'](handleError(_0x12ac4f,null));};exports[_0x23c8('0x44')]=function(_0x2591f0,_0x4a8b3d){var _0x2e6cb8={'raw':!![],'where':{'id':_0x2591f0[_0x23c8('0x45')]['id']}},_0x433208={};_0x433208['model']=_[_0x23c8('0x2f')](db['VoiceDialReport']['rawAttributes']);_0x433208[_0x23c8('0x2e')]=_[_0x23c8('0x2f')](_0x2591f0[_0x23c8('0x2e')]);_0x433208['filters']=_[_0x23c8('0x31')](_0x433208[_0x23c8('0x32')],_0x433208['query']);_0x2e6cb8[_0x23c8('0x33')]=_['intersection'](_0x433208[_0x23c8('0x32')],qs['fields'](_0x2591f0[_0x23c8('0x2e')]['fields']));_0x2e6cb8[_0x23c8('0x33')]=_0x2e6cb8[_0x23c8('0x33')][_0x23c8('0x35')]?_0x2e6cb8[_0x23c8('0x33')]:_0x433208[_0x23c8('0x32')];if(_0x2591f0[_0x23c8('0x2e')]['includeAll']){_0x2e6cb8[_0x23c8('0x41')]=[{'all':!![]}];}_0x2e6cb8=_[_0x23c8('0x3c')]({},_0x2e6cb8,_0x2591f0[_0x23c8('0x3e')]);return db['VoiceDialReport']['find'](_0x2e6cb8)[_0x23c8('0x23')](handleEntityNotFound(_0x4a8b3d,null))['then'](respondWithResult(_0x4a8b3d,null))[_0x23c8('0x46')](handleError(_0x4a8b3d,null));};exports[_0x23c8('0x47')]=function(_0x4807ec,_0xee7213){return db[_0x23c8('0x3f')]['create'](_0x4807ec['body'],{})[_0x23c8('0x23')](respondWithResult(_0xee7213,0xc9))[_0x23c8('0x46')](handleError(_0xee7213,null));};exports['update']=function(_0x239186,_0x1c6822){if(_0x239186[_0x23c8('0x48')]['id']){delete _0x239186['body']['id'];}return db[_0x23c8('0x3f')]['find']({'where':{'id':_0x239186[_0x23c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c6822,null))['then'](saveUpdates(_0x239186[_0x23c8('0x48')],null))['then'](respondWithResult(_0x1c6822,null))[_0x23c8('0x46')](handleError(_0x1c6822,null));};exports[_0x23c8('0x49')]=function(_0x11bb9e,_0xb8dd4b){return db[_0x23c8('0x3f')][_0x23c8('0x4a')]({'where':{'id':_0x11bb9e[_0x23c8('0x45')]['id']}})['then'](handleEntityNotFound(_0xb8dd4b,null))[_0x23c8('0x23')](removeEntity(_0xb8dd4b,null))[_0x23c8('0x46')](handleError(_0xb8dd4b,null));};exports[_0x23c8('0x4b')]=function(_0x59a5a0,_0x4836f0){return db['VoiceDialReport']['describe']()['then'](respondWithResult(_0x4836f0,null))['catch'](handleError(_0x4836f0,null));}; \ No newline at end of file +var _0xd37c=['key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','includeAll','VoiceDialReport','findAll','rows','catch','params','include','find','create','body','update','describe','eml-format','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','index','rawAttributes','fieldName','type'];(function(_0x77f4a4,_0x41ac24){var _0x4b26a4=function(_0x3f43f1){while(--_0x3f43f1){_0x77f4a4['push'](_0x77f4a4['shift']());}};_0x4b26a4(++_0x41ac24);}(_0xd37c,0x69));var _0xcd37=function(_0x32f7b0,_0x218619){_0x32f7b0=_0x32f7b0-0x0;var _0x418666=_0xd37c[_0x32f7b0];return _0x418666;};'use strict';var emlformat=require(_0xcd37('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd37('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcd37('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xcd37('0x3'));var util=require(_0xcd37('0x4'));var path=require('path');var sox=require(_0xcd37('0x5'));var csv=require(_0xcd37('0x6'));var ejs=require(_0xcd37('0x7'));var fs=require('fs');var fs_extra=require(_0xcd37('0x8'));var _=require(_0xcd37('0x9'));var squel=require(_0xcd37('0xa'));var crypto=require(_0xcd37('0xb'));var jsforce=require(_0xcd37('0xc'));var deskjs=require(_0xcd37('0xd'));var toCsv=require(_0xcd37('0x6'));var querystring=require('querystring');var Papa=require(_0xcd37('0xe'));var Redis=require(_0xcd37('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcd37('0x10'));var as=require(_0xcd37('0x11'));var hardwareService=require(_0xcd37('0x12'));var logger=require(_0xcd37('0x13'))(_0xcd37('0x14'));var utils=require(_0xcd37('0x15'));var config=require(_0xcd37('0x16'));var licenseUtil=require(_0xcd37('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18e135,_0x20fc3f){_0x20fc3f=_0x20fc3f||0xcc;return function(_0x3528cc){if(_0x3528cc){return _0x18e135[_0xcd37('0x18')](_0x20fc3f);}return _0x18e135[_0xcd37('0x19')](_0x20fc3f)[_0xcd37('0x1a')]();};}function respondWithResult(_0x4260d5,_0xf0eecb){_0xf0eecb=_0xf0eecb||0xc8;return function(_0x386084){if(_0x386084){return _0x4260d5[_0xcd37('0x19')](_0xf0eecb)[_0xcd37('0x1b')](_0x386084);}};}function respondWithFilteredResult(_0x3052f7,_0x4ac382){return function(_0x4db0e3){if(_0x4db0e3){var _0xc89b3d=typeof _0x4ac382[_0xcd37('0x1c')]===_0xcd37('0x1d')&&typeof _0x4ac382[_0xcd37('0x1e')]===_0xcd37('0x1d');var _0x531a5b=_0x4db0e3[_0xcd37('0x1f')];var _0x1dc534=_0xc89b3d?0x0:_0x4ac382[_0xcd37('0x1c')];var _0x2c2271=_0xc89b3d?_0x4db0e3[_0xcd37('0x1f')]:_0x4ac382['offset']+_0x4ac382['limit'];var _0x3280f6;if(_0x2c2271>=_0x531a5b){_0x2c2271=_0x531a5b;_0x3280f6=0xc8;}else{_0x3280f6=0xce;}_0x3052f7[_0xcd37('0x19')](_0x3280f6);return _0x3052f7[_0xcd37('0x20')](_0xcd37('0x21'),_0x1dc534+'-'+_0x2c2271+'/'+_0x531a5b)['json'](_0x4db0e3);}return null;};}function patchUpdates(_0x2cf7cb){return function(_0x4c2e59){try{jsonpatch[_0xcd37('0x22')](_0x4c2e59,_0x2cf7cb,!![]);}catch(_0xc6743c){return BPromise['reject'](_0xc6743c);}return _0x4c2e59[_0xcd37('0x23')]();};}function saveUpdates(_0xe44c08,_0x32797b){return function(_0x1f72be){if(_0x1f72be){return _0x1f72be['update'](_0xe44c08)[_0xcd37('0x24')](function(_0x88888d){return _0x88888d;});}return null;};}function removeEntity(_0x392bc9,_0x3ba645){return function(_0x137496){if(_0x137496){return _0x137496[_0xcd37('0x25')]()[_0xcd37('0x24')](function(){_0x392bc9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x75926b,_0x5e833b){return function(_0x97f4d6){if(!_0x97f4d6){_0x75926b[_0xcd37('0x18')](0x194);}return _0x97f4d6;};}function handleError(_0x4a2732,_0x1e1a88){_0x1e1a88=_0x1e1a88||0x1f4;return function(_0x20eabe){logger[_0xcd37('0x26')](_0x20eabe['stack']);if(_0x20eabe[_0xcd37('0x27')]){delete _0x20eabe[_0xcd37('0x27')];}_0x4a2732['status'](_0x1e1a88)[_0xcd37('0x28')](_0x20eabe);};}exports[_0xcd37('0x29')]=function(_0x1d875b,_0x4f746f){var _0x1bd0cd={},_0x1e3fac={},_0x46e76a={'count':0x0,'rows':[]};var _0x455794=_['map'](db['VoiceDialReport'][_0xcd37('0x2a')],function(_0xb83f55){return{'name':_0xb83f55[_0xcd37('0x2b')],'type':_0xb83f55[_0xcd37('0x2c')][_0xcd37('0x2d')]};});_0x1e3fac['model']=_[_0xcd37('0x2e')](_0x455794,_0xcd37('0x27'));_0x1e3fac[_0xcd37('0x2f')]=_[_0xcd37('0x30')](_0x1d875b['query']);_0x1e3fac[_0xcd37('0x31')]=_['intersection'](_0x1e3fac[_0xcd37('0x32')],_0x1e3fac[_0xcd37('0x2f')]);_0x1bd0cd[_0xcd37('0x33')]=_[_0xcd37('0x34')](_0x1e3fac['model'],qs[_0xcd37('0x35')](_0x1d875b[_0xcd37('0x2f')][_0xcd37('0x35')]));_0x1bd0cd[_0xcd37('0x33')]=_0x1bd0cd['attributes'][_0xcd37('0x36')]?_0x1bd0cd[_0xcd37('0x33')]:_0x1e3fac['model'];if(!_0x1d875b[_0xcd37('0x2f')][_0xcd37('0x37')]('nolimit')){_0x1bd0cd[_0xcd37('0x1e')]=qs['limit'](_0x1d875b[_0xcd37('0x2f')][_0xcd37('0x1e')]);_0x1bd0cd['offset']=qs[_0xcd37('0x1c')](_0x1d875b[_0xcd37('0x2f')]['offset']);}_0x1bd0cd[_0xcd37('0x38')]=qs['sort'](_0x1d875b[_0xcd37('0x2f')]['sort']);_0x1bd0cd[_0xcd37('0x39')]=qs[_0xcd37('0x31')](_[_0xcd37('0x3a')](_0x1d875b[_0xcd37('0x2f')],_0x1e3fac[_0xcd37('0x31')]),_0x455794);if(_0x1d875b[_0xcd37('0x2f')]['filter']){_0x1bd0cd['where']=_[_0xcd37('0x3b')](_0x1bd0cd['where'],{'$or':_['map'](_0x455794,function(_0x4d70ba){if(_0x4d70ba[_0xcd37('0x2c')]!==_0xcd37('0x3c')){var _0x11b02f={};_0x11b02f[_0x4d70ba[_0xcd37('0x27')]]={'$like':'%'+_0x1d875b[_0xcd37('0x2f')][_0xcd37('0x3d')]+'%'};return _0x11b02f;}})});}_0x1bd0cd=_[_0xcd37('0x3b')]({},_0x1bd0cd,_0x1d875b[_0xcd37('0x3e')]);var _0x4d20d7={'where':_0x1bd0cd[_0xcd37('0x39')]};return db['VoiceDialReport'][_0xcd37('0x1f')](_0x4d20d7)[_0xcd37('0x24')](function(_0x4fa21b){_0x46e76a[_0xcd37('0x1f')]=_0x4fa21b;if(_0x1d875b[_0xcd37('0x2f')][_0xcd37('0x3f')]){_0x1bd0cd['include']=[{'all':!![]}];}return db[_0xcd37('0x40')][_0xcd37('0x41')](_0x1bd0cd);})[_0xcd37('0x24')](function(_0x2fad65){_0x46e76a[_0xcd37('0x42')]=_0x2fad65;return _0x46e76a;})[_0xcd37('0x24')](respondWithFilteredResult(_0x4f746f,_0x1bd0cd))[_0xcd37('0x43')](handleError(_0x4f746f,null));};exports['show']=function(_0x20945a,_0x5f32cb){var _0x200b56={'raw':!![],'where':{'id':_0x20945a[_0xcd37('0x44')]['id']}},_0x4848e8={};_0x4848e8[_0xcd37('0x32')]=_[_0xcd37('0x30')](db[_0xcd37('0x40')][_0xcd37('0x2a')]);_0x4848e8['query']=_[_0xcd37('0x30')](_0x20945a[_0xcd37('0x2f')]);_0x4848e8['filters']=_[_0xcd37('0x34')](_0x4848e8[_0xcd37('0x32')],_0x4848e8[_0xcd37('0x2f')]);_0x200b56[_0xcd37('0x33')]=_['intersection'](_0x4848e8[_0xcd37('0x32')],qs['fields'](_0x20945a[_0xcd37('0x2f')][_0xcd37('0x35')]));_0x200b56[_0xcd37('0x33')]=_0x200b56[_0xcd37('0x33')][_0xcd37('0x36')]?_0x200b56[_0xcd37('0x33')]:_0x4848e8['model'];if(_0x20945a[_0xcd37('0x2f')][_0xcd37('0x3f')]){_0x200b56[_0xcd37('0x45')]=[{'all':!![]}];}_0x200b56=_[_0xcd37('0x3b')]({},_0x200b56,_0x20945a['options']);return db[_0xcd37('0x40')][_0xcd37('0x46')](_0x200b56)['then'](handleEntityNotFound(_0x5f32cb,null))[_0xcd37('0x24')](respondWithResult(_0x5f32cb,null))['catch'](handleError(_0x5f32cb,null));};exports['create']=function(_0x2f48ef,_0x2553ce){return db['VoiceDialReport'][_0xcd37('0x47')](_0x2f48ef[_0xcd37('0x48')],{})[_0xcd37('0x24')](respondWithResult(_0x2553ce,0xc9))[_0xcd37('0x43')](handleError(_0x2553ce,null));};exports[_0xcd37('0x49')]=function(_0x22cda5,_0x1b9718){if(_0x22cda5[_0xcd37('0x48')]['id']){delete _0x22cda5['body']['id'];}return db[_0xcd37('0x40')]['find']({'where':{'id':_0x22cda5[_0xcd37('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b9718,null))[_0xcd37('0x24')](saveUpdates(_0x22cda5[_0xcd37('0x48')],null))['then'](respondWithResult(_0x1b9718,null))['catch'](handleError(_0x1b9718,null));};exports[_0xcd37('0x25')]=function(_0x309b0,_0x448a75){return db['VoiceDialReport'][_0xcd37('0x46')]({'where':{'id':_0x309b0[_0xcd37('0x44')]['id']}})[_0xcd37('0x24')](handleEntityNotFound(_0x448a75,null))[_0xcd37('0x24')](removeEntity(_0x448a75,null))['catch'](handleError(_0x448a75,null));};exports['describe']=function(_0x25baed,_0x3c5cea){return db[_0xcd37('0x40')][_0xcd37('0x4a')]()[_0xcd37('0x24')](respondWithResult(_0x3c5cea,null))[_0xcd37('0x43')](handleError(_0x3c5cea,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index e1c42a6..69dd067 100644 --- a/server/api/voiceDialReport/voiceDialReport.model.js +++ b/server/api/voiceDialReport/voiceDialReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf589=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial'];(function(_0x1b1bd5,_0xf50a3){var _0x12bf17=function(_0x5a1a9f){while(--_0x5a1a9f){_0x1b1bd5['push'](_0x1b1bd5['shift']());}};_0x12bf17(++_0xf50a3);}(_0xf589,0xe1));var _0x9f58=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xf589[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x9f58('0x0'));var util=require(_0x9f58('0x1'));var logger=require('../../config/logger')(_0x9f58('0x2'));var moment=require(_0x9f58('0x3'));var BPromise=require(_0x9f58('0x4'));var rp=require(_0x9f58('0x5'));var fs=require('fs');var path=require(_0x9f58('0x6'));var rimraf=require(_0x9f58('0x7'));var config=require(_0x9f58('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0x9f58('0x9')]=function(_0x4fdb49,_0x76c022){return _0x4fdb49[_0x9f58('0xa')](_0x9f58('0xb'),attributes,{'tableName':_0x9f58('0xc'),'paranoid':![],'indexes':[{'fields':[_0x9f58('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7722=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial'];(function(_0x48fc23,_0x4b282d){var _0x512eaf=function(_0x2fd3fe){while(--_0x2fd3fe){_0x48fc23['push'](_0x48fc23['shift']());}};_0x512eaf(++_0x4b282d);}(_0x7722,0xdd));var _0x2772=function(_0x1e958d,_0x5354b1){_0x1e958d=_0x1e958d-0x0;var _0x3dd918=_0x7722[_0x1e958d];return _0x3dd918;};'use strict';var _=require(_0x2772('0x0'));var util=require(_0x2772('0x1'));var logger=require(_0x2772('0x2'))('api');var moment=require(_0x2772('0x3'));var BPromise=require(_0x2772('0x4'));var rp=require(_0x2772('0x5'));var fs=require('fs');var path=require(_0x2772('0x6'));var rimraf=require(_0x2772('0x7'));var config=require(_0x2772('0x8'));var attributes=require(_0x2772('0x9'));module[_0x2772('0xa')]=function(_0x4012c8,_0x375b5a){return _0x4012c8['define'](_0x2772('0xb'),attributes,{'tableName':_0x2772('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 4afa693..6756e75 100644 --- a/server/api/voiceDialReport/voiceDialReport.rpc.js +++ b/server/api/voiceDialReport/voiceDialReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64ac=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','then','debug','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0xd99ed8,_0x41d1b7){var _0x31a4ee=function(_0x3c9e51){while(--_0x3c9e51){_0xd99ed8['push'](_0xd99ed8['shift']());}};_0x31a4ee(++_0x41d1b7);}(_0x64ac,0xea));var _0xc64a=function(_0x3dd119,_0x4c431a){_0x3dd119=_0x3dd119-0x0;var _0x37a8da=_0x64ac[_0x3dd119];return _0x37a8da;};'use strict';var _=require(_0xc64a('0x0'));var util=require(_0xc64a('0x1'));var moment=require(_0xc64a('0x2'));var BPromise=require(_0xc64a('0x3'));var rs=require(_0xc64a('0x4'));var fs=require('fs');var Redis=require(_0xc64a('0x5'));var db=require(_0xc64a('0x6'))['db'];var utils=require(_0xc64a('0x7'));var logger=require('../../config/logger')(_0xc64a('0x8'));var config=require(_0xc64a('0x9'));var jayson=require(_0xc64a('0xa'));var client=jayson[_0xc64a('0xb')][_0xc64a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ebe30,_0x15e2ba,_0x481fb4){return new BPromise(function(_0x221674,_0x4e3869){return client['request'](_0x3ebe30,_0x481fb4)['then'](function(_0x4abe1f){logger[_0xc64a('0xd')](_0xc64a('0xe'),_0x15e2ba,'request\x20sent');logger['debug'](_0xc64a('0xf'),_0x15e2ba,_0xc64a('0x10'),JSON[_0xc64a('0x11')](_0x4abe1f));if(_0x4abe1f['error']){if(_0x4abe1f[_0xc64a('0x12')][_0xc64a('0x13')]===0x1f4){logger[_0xc64a('0x12')](_0xc64a('0xe'),_0x15e2ba,_0x4abe1f[_0xc64a('0x12')][_0xc64a('0x14')]);return _0x4e3869(_0x4abe1f['error'][_0xc64a('0x14')]);}logger[_0xc64a('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x15e2ba,_0x4abe1f[_0xc64a('0x12')][_0xc64a('0x14')]);return _0x221674(_0x4abe1f[_0xc64a('0x12')][_0xc64a('0x14')]);}else{logger[_0xc64a('0xd')](_0xc64a('0xe'),_0x15e2ba,_0xc64a('0x10'));_0x221674(_0x4abe1f[_0xc64a('0x15')]['message']);}})[_0xc64a('0x16')](function(_0x456b7a){logger[_0xc64a('0x12')](_0xc64a('0xe'),_0x15e2ba,_0x456b7a);_0x4e3869(_0x456b7a);});});}exports[_0xc64a('0x17')]=function(_0x2ead6a){var _0x179b14=this;return new Promise(function(_0x3ebe07,_0x1f2f30){return db[_0xc64a('0x18')]['create'](_0x2ead6a['body'],{'raw':_0x2ead6a['options']?_0x2ead6a[_0xc64a('0x19')][_0xc64a('0x1a')]===undefined?!![]:![]:!![]})[_0xc64a('0x1b')](function(_0x19f6ba){logger[_0xc64a('0xd')]('CreateVoiceDialReport',_0x2ead6a);logger[_0xc64a('0x1c')](_0xc64a('0x17'),_0x2ead6a,JSON[_0xc64a('0x11')](_0x19f6ba));_0x3ebe07(_0x19f6ba);})[_0xc64a('0x16')](function(_0x996286){logger[_0xc64a('0x12')](_0xc64a('0x17'),_0x996286[_0xc64a('0x14')],_0x2ead6a);_0x1f2f30(_0x179b14[_0xc64a('0x12')](0x1f4,_0x996286[_0xc64a('0x14')]));});});};exports[_0xc64a('0x1d')]=function(_0x4b8073){var _0x296199=this;return new Promise(function(_0x45b6e1,_0x52e7a2){return db[_0xc64a('0x18')][_0xc64a('0x1e')](_0x4b8073['body'],{'raw':_0x4b8073[_0xc64a('0x19')]?_0x4b8073['options'][_0xc64a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8073[_0xc64a('0x19')]?_0x4b8073['options'][_0xc64a('0x1f')]||null:null,'attributes':_0x4b8073['options']?_0x4b8073[_0xc64a('0x19')][_0xc64a('0x20')]||null:null,'limit':_0x4b8073[_0xc64a('0x19')]?_0x4b8073[_0xc64a('0x19')][_0xc64a('0x21')]||null:null})[_0xc64a('0x1b')](function(_0xefd99c){logger[_0xc64a('0xd')](_0xc64a('0x1d'),_0x4b8073);logger[_0xc64a('0x1c')](_0xc64a('0x1d'),_0x4b8073,JSON['stringify'](_0xefd99c));_0x45b6e1(_0xefd99c);})[_0xc64a('0x16')](function(_0x6f8528){logger[_0xc64a('0x12')](_0xc64a('0x1d'),_0x6f8528['message'],_0x4b8073);_0x52e7a2(_0x296199[_0xc64a('0x12')](0x1f4,_0x6f8528[_0xc64a('0x14')]));});});}; \ No newline at end of file +var _0xb388=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','VoiceDialReport','body','options','raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','where','attributes','limit','stringify','lodash','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb388,0xdd));var _0x8b38=function(_0x59b229,_0x54d51a){_0x59b229=_0x59b229-0x0;var _0x32b4d2=_0xb388[_0x59b229];return _0x32b4d2;};'use strict';var _=require(_0x8b38('0x0'));var util=require('util');var moment=require(_0x8b38('0x1'));var BPromise=require(_0x8b38('0x2'));var rs=require(_0x8b38('0x3'));var fs=require('fs');var Redis=require(_0x8b38('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8b38('0x5'))(_0x8b38('0x6'));var config=require(_0x8b38('0x7'));var jayson=require(_0x8b38('0x8'));var client=jayson[_0x8b38('0x9')][_0x8b38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4e34,_0x45783a,_0x63d36d){return new BPromise(function(_0xb5603d,_0x12624a){return client[_0x8b38('0xb')](_0x4c4e34,_0x63d36d)['then'](function(_0xf03395){logger[_0x8b38('0xc')](_0x8b38('0xd'),_0x45783a,_0x8b38('0xe'));logger[_0x8b38('0xf')](_0x8b38('0x10'),_0x45783a,_0x8b38('0xe'),JSON['stringify'](_0xf03395));if(_0xf03395[_0x8b38('0x11')]){if(_0xf03395[_0x8b38('0x11')][_0x8b38('0x12')]===0x1f4){logger[_0x8b38('0x11')](_0x8b38('0xd'),_0x45783a,_0xf03395[_0x8b38('0x11')][_0x8b38('0x13')]);return _0x12624a(_0xf03395['error'][_0x8b38('0x13')]);}logger[_0x8b38('0x11')](_0x8b38('0xd'),_0x45783a,_0xf03395[_0x8b38('0x11')][_0x8b38('0x13')]);return _0xb5603d(_0xf03395[_0x8b38('0x11')][_0x8b38('0x13')]);}else{logger[_0x8b38('0xc')](_0x8b38('0xd'),_0x45783a,_0x8b38('0xe'));_0xb5603d(_0xf03395['result']['message']);}})[_0x8b38('0x14')](function(_0x2dc957){logger[_0x8b38('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x45783a,_0x2dc957);_0x12624a(_0x2dc957);});});}exports['CreateVoiceDialReport']=function(_0x3b3a01){var _0x3e49f3=this;return new Promise(function(_0x484149,_0x4f4491){return db[_0x8b38('0x15')]['create'](_0x3b3a01[_0x8b38('0x16')],{'raw':_0x3b3a01[_0x8b38('0x17')]?_0x3b3a01[_0x8b38('0x17')][_0x8b38('0x18')]===undefined?!![]:![]:!![]})[_0x8b38('0x19')](function(_0x4eb0c2){logger[_0x8b38('0xc')]('CreateVoiceDialReport',_0x3b3a01);logger[_0x8b38('0xf')](_0x8b38('0x1a'),_0x3b3a01,JSON['stringify'](_0x4eb0c2));_0x484149(_0x4eb0c2);})[_0x8b38('0x14')](function(_0x5d7371){logger['error']('CreateVoiceDialReport',_0x5d7371[_0x8b38('0x13')],_0x3b3a01);_0x4f4491(_0x3e49f3[_0x8b38('0x11')](0x1f4,_0x5d7371[_0x8b38('0x13')]));});});};exports[_0x8b38('0x1b')]=function(_0x431436){var _0x279898=this;return new Promise(function(_0x29e232,_0x1081a6){return db[_0x8b38('0x15')]['update'](_0x431436[_0x8b38('0x16')],{'raw':_0x431436[_0x8b38('0x17')]?_0x431436['options'][_0x8b38('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x431436['options']?_0x431436[_0x8b38('0x17')][_0x8b38('0x1c')]||null:null,'attributes':_0x431436[_0x8b38('0x17')]?_0x431436[_0x8b38('0x17')][_0x8b38('0x1d')]||null:null,'limit':_0x431436[_0x8b38('0x17')]?_0x431436['options'][_0x8b38('0x1e')]||null:null})[_0x8b38('0x19')](function(_0x546ae8){logger['info'](_0x8b38('0x1b'),_0x431436);logger[_0x8b38('0xf')](_0x8b38('0x1b'),_0x431436,JSON[_0x8b38('0x1f')](_0x546ae8));_0x29e232(_0x546ae8);})[_0x8b38('0x14')](function(_0x2dad2a){logger['error'](_0x8b38('0x1b'),_0x2dad2a[_0x8b38('0x13')],_0x431436);_0x1081a6(_0x279898['error'](0x1f4,_0x2dad2a[_0x8b38('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index bf6e317..cc62551 100644 --- a/server/api/voiceExtension/index.js +++ b/server/api/voiceExtension/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fcf=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','put','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4e6731,_0x483f9e){var _0x342fe=function(_0x31efdf){while(--_0x31efdf){_0x4e6731['push'](_0x4e6731['shift']());}};_0x342fe(++_0x483f9e);}(_0x9fcf,0xfe));var _0xf9fc=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x9fcf[_0x31a371];return _0x2a5bd6;};'use strict';var multer=require('multer');var util=require(_0xf9fc('0x0'));var path=require(_0xf9fc('0x1'));var timeout=require(_0xf9fc('0x2'));var express=require(_0xf9fc('0x3'));var router=express['Router']();var fs_extra=require(_0xf9fc('0x4'));var auth=require(_0xf9fc('0x5'));var interaction=require(_0xf9fc('0x6'));var config=require(_0xf9fc('0x7'));var controller=require(_0xf9fc('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf9fc('0x9')](_0xf9fc('0xa'),auth[_0xf9fc('0xb')](),controller[_0xf9fc('0xc')]);router[_0xf9fc('0xd')]('/',auth[_0xf9fc('0xb')](),controller[_0xf9fc('0xe')]);router[_0xf9fc('0xd')](_0xf9fc('0xf'),auth[_0xf9fc('0xb')](),controller[_0xf9fc('0x10')]);router[_0xf9fc('0x11')](_0xf9fc('0xa'),auth[_0xf9fc('0xb')](),controller['update']);router['delete'](_0xf9fc('0xa'),auth[_0xf9fc('0xb')](),controller[_0xf9fc('0x12')]);module[_0xf9fc('0x13')]=router; \ No newline at end of file +var _0xb2bb=['./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3df2d3,_0x4d1e77){var _0x435e6d=function(_0x429ee6){while(--_0x429ee6){_0x3df2d3['push'](_0x3df2d3['shift']());}};_0x435e6d(++_0x4d1e77);}(_0xb2bb,0x67));var _0xbb2b=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0xb2bb[_0x31991b];return _0x307304;};'use strict';var multer=require('multer');var util=require(_0xbb2b('0x0'));var path=require(_0xbb2b('0x1'));var timeout=require(_0xbb2b('0x2'));var express=require('express');var router=express[_0xbb2b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbb2b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbb2b('0x5'));router[_0xbb2b('0x6')]('/',auth[_0xbb2b('0x7')](),controller[_0xbb2b('0x8')]);router['get'](_0xbb2b('0x9'),auth[_0xbb2b('0x7')](),controller[_0xbb2b('0xa')]);router['post']('/',auth[_0xbb2b('0x7')](),controller['create']);router[_0xbb2b('0xb')](_0xbb2b('0xc'),auth['isAuthenticated'](),controller[_0xbb2b('0xd')]);router[_0xbb2b('0xe')](_0xbb2b('0x9'),auth[_0xbb2b('0x7')](),controller['update']);router[_0xbb2b('0xf')](_0xbb2b('0x9'),auth[_0xbb2b('0x7')](),controller[_0xbb2b('0x10')]);module[_0xbb2b('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 14a9925..4104f09 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5294=['inbound-fax','system','any','BOOLEAN','INTEGER','wav','exten','exports','STRING','compositeIndex','ENUM'];(function(_0x32b190,_0xbdaf4c){var _0x22fdd5=function(_0x455194){while(--_0x455194){_0x32b190['push'](_0x32b190['shift']());}};_0x22fdd5(++_0xbdaf4c);}(_0x5294,0x130));var _0x4529=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5294[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require('sequelize');module[_0x4529('0x0')]={'context':{'type':Sequelize[_0x4529('0x1')],'allowNull':![],'unique':_0x4529('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4529('0x1')],'allowNull':![],'unique':_0x4529('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x4529('0x2')},'tag':{'type':Sequelize[_0x4529('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4529('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4529('0x3')]('inbound','outbound','internal',_0x4529('0x4'),'outbound-fax',_0x4529('0x5'),_0x4529('0x6')),'allowNull':![]},'description':{'type':Sequelize[_0x4529('0x1')]},'interval':{'type':Sequelize[_0x4529('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x4529('0x7')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4529('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4529('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x4529('0x7')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4529('0x8')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x4529('0x9')},'answer':{'type':Sequelize[_0x4529('0x7')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3995ce){return this['getDataValue'](_0x4529('0xa'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xfefa=['sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','outbound-fax','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten'];(function(_0x4a7955,_0x10b2f6){var _0x2371fb=function(_0x31924e){while(--_0x31924e){_0x4a7955['push'](_0x4a7955['shift']());}};_0x2371fb(++_0x10b2f6);}(_0xfefa,0x130));var _0xafef=function(_0x512940,_0x137667){_0x512940=_0x512940-0x0;var _0xfdd8b4=_0xfefa[_0x512940];return _0xfdd8b4;};'use strict';var Sequelize=require(_0xafef('0x0'));module[_0xafef('0x1')]={'context':{'type':Sequelize[_0xafef('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xafef('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xafef('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xafef('0x3')},'tag':{'type':Sequelize[_0xafef('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xafef('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xafef('0x4')](_0xafef('0x5'),_0xafef('0x6'),_0xafef('0x7'),'inbound-fax',_0xafef('0x8'),'system','any'),'allowNull':![]},'description':{'type':Sequelize[_0xafef('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xafef('0x9')},'IntervalId':{'type':Sequelize[_0xafef('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xafef('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xafef('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xafef('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xafef('0xa')]},'recordingFormat':{'type':Sequelize[_0xafef('0x2')],'defaultValue':_0xafef('0xc')},'answer':{'type':Sequelize[_0xafef('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xafef('0xd')],'get':function(_0xad1bd8){return this[_0xafef('0xe')](_0xafef('0xf'));}},'alias':{'type':Sequelize[_0xafef('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index daacaf0..87974a7 100644 --- a/server/api/voiceExtension/voiceExtension.controller.js +++ b/server/api/voiceExtension/voiceExtension.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4588=['UserProfileResource','sendStatus','error','stack','index','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','VoiceExtension','includeAll','include','findAll','catch','show','keys','body','startsWith','exten','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','recordingFormat','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','end','status','json','offset','limit','undefined','count','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name'];(function(_0x306c3a,_0x5797b5){var _0x1ae671=function(_0xc152ae){while(--_0xc152ae){_0x306c3a['push'](_0x306c3a['shift']());}};_0x1ae671(++_0x5797b5);}(_0x4588,0x1bc));var _0x8458=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x4588[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0x8458('0x0'));var Redis=require(_0x8458('0x1'));var qs=require(_0x8458('0x2'));var logger=require('../../config/logger')(_0x8458('0x3'));var config=require(_0x8458('0x4'));var db=require(_0x8458('0x5'))['db'];config['redis']=_[_0x8458('0x6')](config[_0x8458('0x7')],{'host':_0x8458('0x8'),'port':0x18eb});var socket=require(_0x8458('0x9'))(new Redis(config[_0x8458('0x7')]));require('./voiceExtension.socket')[_0x8458('0xa')](socket);function respondWithStatusCode(_0x115ca3,_0x503187){_0x503187=_0x503187||0xcc;return function(_0x446416){if(_0x446416){return _0x115ca3['sendStatus'](_0x503187);}return _0x115ca3['status'](_0x503187)[_0x8458('0xb')]();};}function respondWithResult(_0x1d7e38,_0xccbd63){_0xccbd63=_0xccbd63||0xc8;return function(_0x549bb1){if(_0x549bb1){return _0x1d7e38[_0x8458('0xc')](_0xccbd63)[_0x8458('0xd')](_0x549bb1);}};}function respondWithFilteredResult(_0x3493b2,_0x358b25){return function(_0x83682a){if(_0x83682a){var _0xc775fd=typeof _0x358b25[_0x8458('0xe')]==='undefined'&&typeof _0x358b25[_0x8458('0xf')]===_0x8458('0x10');var _0xc851ae=_0x83682a['count'];var _0xc837af=_0xc775fd?0x0:_0x358b25['offset'];var _0x9fbaa6=_0xc775fd?_0x83682a[_0x8458('0x11')]:_0x358b25['offset']+_0x358b25['limit'];var _0x24e3dc;if(_0x9fbaa6>=_0xc851ae){_0x9fbaa6=_0xc851ae;_0x24e3dc=0xc8;}else{_0x24e3dc=0xce;}_0x3493b2['status'](_0x24e3dc);return _0x3493b2[_0x8458('0x12')]('Content-Range',_0xc837af+'-'+_0x9fbaa6+'/'+_0xc851ae)['json'](_0x83682a);}return null;};}function removeEntity(_0x46dfa7){return function(_0x4dabcc){if(_0x4dabcc){return _0x4dabcc[_0x8458('0x13')]()[_0x8458('0x14')](function(){var _0x1f284d=_0x4dabcc[_0x8458('0x15')]({'plain':!![]});var _0x3518dc=[{'name':_0x8458('0x16'),'value':_0x8458('0x17'),'ignore':![]},{'name':_0x8458('0x18'),'value':_0x8458('0x19'),'ignore':![]},{'name':_0x8458('0x1a'),'value':_0x8458('0x1b'),'ignore':![]}];var _0x242875=_(_0x3518dc)[_0x8458('0x1c')](_0x8458('0x1d'))[_0x8458('0x1e')](_0x8458('0x1f'))[_0x8458('0x1f')]();if(_[_0x8458('0x20')](_0x242875,_0x1f284d[_0x8458('0x21')])){return;}var _0x43bc10=_[_0x8458('0x22')](_0x3518dc,[_0x8458('0x1f'),_0x1f284d[_0x8458('0x21')]])[_0x8458('0x23')];return db[_0x8458('0x24')][_0x8458('0x13')]({'where':{'type':_0x43bc10,'resourceId':_0x1f284d['id']}})[_0x8458('0x14')](function(){return _0x4dabcc;});})[_0x8458('0x14')](function(){_0x46dfa7[_0x8458('0xc')](0xcc)[_0x8458('0xb')]();});}};}function handleEntityNotFound(_0x17b5fe){return function(_0x3a047f){if(!_0x3a047f){_0x17b5fe[_0x8458('0x25')](0x194);}return _0x3a047f;};}function handleError(_0x1c6242,_0x4e7653){_0x4e7653=_0x4e7653||0x1f4;return function(_0x611f73){logger[_0x8458('0x26')](_0x611f73[_0x8458('0x27')]);if(_0x611f73[_0x8458('0x23')]){delete _0x611f73['name'];}_0x1c6242['status'](_0x4e7653)['send'](_0x611f73);};}exports[_0x8458('0x28')]=function(_0x828d1a,_0x528e81){var _0x55be93={},_0x57ed59={},_0x4d1acf={'count':0x0,'rows':[]};var _0xc652d2=_['map'](db['VoiceExtension']['rawAttributes'],function(_0xcf28f){return{'name':_0xcf28f[_0x8458('0x29')],'type':_0xcf28f[_0x8458('0x21')][_0x8458('0x2a')]};});_0x57ed59['model']=_[_0x8458('0x1e')](_0xc652d2,_0x8458('0x23'));_0x57ed59[_0x8458('0x2b')]=_['keys'](_0x828d1a[_0x8458('0x2b')]);_0x57ed59[_0x8458('0x2c')]=_[_0x8458('0x2d')](_0x57ed59[_0x8458('0x2e')],_0x57ed59[_0x8458('0x2b')]);_0x55be93[_0x8458('0x2f')]=_[_0x8458('0x2d')](_0x57ed59[_0x8458('0x2e')],qs['fields'](_0x828d1a[_0x8458('0x2b')][_0x8458('0x30')]));_0x55be93[_0x8458('0x2f')]=_0x55be93['attributes'][_0x8458('0x31')]?_0x55be93[_0x8458('0x2f')]:_0x57ed59[_0x8458('0x2e')];if(!_0x828d1a[_0x8458('0x2b')][_0x8458('0x32')](_0x8458('0x33'))){_0x55be93[_0x8458('0xf')]=qs['limit'](_0x828d1a[_0x8458('0x2b')][_0x8458('0xf')]);_0x55be93[_0x8458('0xe')]=qs[_0x8458('0xe')](_0x828d1a[_0x8458('0x2b')]['offset']);}_0x55be93[_0x8458('0x34')]=qs[_0x8458('0x35')](_0x828d1a[_0x8458('0x2b')][_0x8458('0x35')]);_0x55be93[_0x8458('0x36')]=qs[_0x8458('0x2c')](_[_0x8458('0x37')](_0x828d1a[_0x8458('0x2b')],_0x57ed59['filters']),_0xc652d2);if(_0x828d1a[_0x8458('0x2b')][_0x8458('0x1c')]){_0x55be93[_0x8458('0x36')]=_[_0x8458('0x38')](_0x55be93[_0x8458('0x36')],{'$or':_['map'](_0xc652d2,function(_0x5a8ce4){if(_0x5a8ce4['type']!=='VIRTUAL'){var _0x53a860={};_0x53a860[_0x5a8ce4[_0x8458('0x23')]]={'$like':'%'+_0x828d1a[_0x8458('0x2b')][_0x8458('0x1c')]+'%'};return _0x53a860;}})});}_0x55be93=_[_0x8458('0x38')]({},_0x55be93,_0x828d1a[_0x8458('0x39')]);var _0x4390b7={'where':_0x55be93[_0x8458('0x36')]};return db[_0x8458('0x3a')][_0x8458('0x11')](_0x4390b7)['then'](function(_0x2f48f9){_0x4d1acf[_0x8458('0x11')]=_0x2f48f9;if(_0x828d1a['query'][_0x8458('0x3b')]){_0x55be93[_0x8458('0x3c')]=[{'all':!![]}];}return db[_0x8458('0x3a')][_0x8458('0x3d')](_0x55be93);})['then'](function(_0x2efe9b){_0x4d1acf['rows']=_0x2efe9b;return _0x4d1acf;})['then'](respondWithFilteredResult(_0x528e81,_0x55be93))[_0x8458('0x3e')](handleError(_0x528e81,null));};exports[_0x8458('0x3f')]=function(_0xc673b7,_0x5f2649){var _0x1a096d={'raw':![],'where':{'id':_0xc673b7['params']['id']}},_0x3619ef={};_0x3619ef[_0x8458('0x2e')]=_[_0x8458('0x40')](db[_0x8458('0x3a')]['rawAttributes']);_0x3619ef[_0x8458('0x2b')]=_[_0x8458('0x40')](_0xc673b7[_0x8458('0x2b')]);_0x3619ef['filters']=_[_0x8458('0x2d')](_0x3619ef[_0x8458('0x2e')],_0x3619ef[_0x8458('0x2b')]);_0x1a096d[_0x8458('0x2f')]=_[_0x8458('0x2d')](_0x3619ef[_0x8458('0x2e')],qs['fields'](_0xc673b7[_0x8458('0x2b')][_0x8458('0x30')]));_0x1a096d[_0x8458('0x2f')]=_0x1a096d['attributes'][_0x8458('0x31')]?_0x1a096d[_0x8458('0x2f')]:_0x3619ef['model'];if(_0xc673b7[_0x8458('0x2b')]['includeAll']){_0x1a096d[_0x8458('0x3c')]=[{'all':!![]}];}_0x1a096d=_[_0x8458('0x38')]({},_0x1a096d,_0xc673b7[_0x8458('0x39')]);return db[_0x8458('0x3a')]['find'](_0x1a096d)[_0x8458('0x14')](handleEntityNotFound(_0x5f2649,null))[_0x8458('0x14')](respondWithResult(_0x5f2649,null))[_0x8458('0x3e')](handleError(_0x5f2649,null));};exports['destroy']=function(_0xb616c4,_0x4b4dcd){return db[_0x8458('0x3a')]['find']({'where':{'id':_0xb616c4['params']['id']}})[_0x8458('0x14')](handleEntityNotFound(_0x4b4dcd,null))['then'](removeEntity(_0x4b4dcd,null))[_0x8458('0x3e')](handleError(_0x4b4dcd,null));};exports['create']=function(_0x1a8d9c,_0x354f9b){if(_0x1a8d9c[_0x8458('0x41')]['type']==='outbound'&&!_[_0x8458('0x42')](_0x1a8d9c[_0x8458('0x41')]['exten'],'_')){_0x1a8d9c['body'][_0x8458('0x43')]='_'['concat'](_0x1a8d9c[_0x8458('0x41')][_0x8458('0x43')]);}return db['VoiceExtension'][_0x8458('0x44')](_0x1a8d9c[_0x8458('0x41')],{'raw':![]})['then'](function(_0x3a3562){var _0x4ff6cf=_0x1a8d9c[_0x8458('0x45')][_0x8458('0x15')]({'plain':!![]});if(!_0x4ff6cf)throw new Error(_0x8458('0x46'));if(_0x4ff6cf[_0x8458('0x47')]==='user'){var _0x2b5254=_0x3a3562[_0x8458('0x15')]({'plain':!![]});var _0x5e05ca=[{'name':'InboundRoutes','value':_0x8458('0x17')},{'name':'OutboundRoutes','value':_0x8458('0x19')},{'name':_0x8458('0x1a'),'value':'internal'}];var _0xbd2edb=_[_0x8458('0x22')](_0x5e05ca,[_0x8458('0x1f'),_0x2b5254['type']])[_0x8458('0x23')];return db[_0x8458('0x48')]['find']({'where':{'name':_0xbd2edb,'userProfileId':_0x4ff6cf[_0x8458('0x49')]},'raw':!![]})['then'](function(_0x55f46d){if(_0x55f46d&&_0x55f46d[_0x8458('0x4a')]===0x0){return db[_0x8458('0x24')][_0x8458('0x44')]({'name':_0x2b5254[_0x8458('0x23')],'resourceId':_0x2b5254['id'],'type':_0x55f46d[_0x8458('0x23')],'sectionId':_0x55f46d['id']},{})[_0x8458('0x14')](function(){return _0x3a3562;});}else{return _0x3a3562;}})['catch'](function(_0x211c34){logger[_0x8458('0x26')](_0x8458('0x4b'),_0x211c34);throw _0x211c34;});}return _0x3a3562;})['then'](respondWithResult(_0x354f9b,0xc9))[_0x8458('0x3e')](handleError(_0x354f9b,null));};exports[_0x8458('0x4c')]=function(_0x3e4350,_0x594777){if(_0x3e4350[_0x8458('0x41')]['id']){delete _0x3e4350[_0x8458('0x41')]['id'];}return db['VoiceExtension'][_0x8458('0x22')]({'where':{'id':_0x3e4350[_0x8458('0x4d')]['id']}})[_0x8458('0x14')](handleEntityNotFound(_0x594777,null))['then'](function(_0x40815d){if(_0x40815d){return db[_0x8458('0x3a')]['update'](_[_0x8458('0x37')](_0x3e4350[_0x8458('0x41')],[_0x8458('0x43'),'context','description',_0x8458('0x4e'),'cutdigits',_0x8458('0x4f'),_0x8458('0x50')]),{'where':{'context':_0x40815d[_0x8458('0x51')],'exten':_0x40815d[_0x8458('0x43')]},'individualHooks':!![]})[_0x8458('0x14')](function(_0x49372a){return _0x49372a;});}return null;})[_0x8458('0x14')](respondWithStatusCode(_0x594777,null))[_0x8458('0x3e')](handleError(_0x594777,null));};exports[_0x8458('0x52')]=function(_0x5864b4,_0x112782){var _0x1da20d=_0x5864b4['params']['id'];var _0x39df41=_0x5864b4[_0x8458('0x41')];var _0x5d6247=0xc8;var _0x5f22fe=null;return db[_0x8458('0x53')][_0x8458('0x54')]({'isolationLevel':db[_0x8458('0x53')]['Transaction'][_0x8458('0x55')][_0x8458('0x56')]},function(_0x3d0c4c){return db[_0x8458('0x3a')][_0x8458('0x57')]({'where':{'id':_0x1da20d},'transaction':_0x3d0c4c})[_0x8458('0x14')](function(_0x22565a){if(_0x22565a){return db[_0x8458('0x3a')][_0x8458('0x13')]({'where':{'VoiceExtensionId':_0x1da20d},'transaction':_0x3d0c4c})['then'](function(){var _0x59337e=_['map'](_0x39df41,function(_0x299d95){_0x299d95[_0x8458('0x58')]=_0x1da20d;_0x299d95[_0x8458('0x59')]=!![];return _0x299d95;});return _0x22565a[_0x8458('0x5a')](_0x59337e);})['then'](function(_0x274c81){return db[_0x8458('0x3a')][_0x8458('0x5b')](_0x274c81,{'transaction':_0x3d0c4c});});}else{_0x5d6247=0x194;_0x5f22fe=[];}});})[_0x8458('0x14')](function(){if(_0x5d6247!==0x194){return db[_0x8458('0x3a')][_0x8458('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1da20d},'order':_0x8458('0x5d')})[_0x8458('0x14')](function(_0x206651){_0x5f22fe=_0x206651;});}})[_0x8458('0x3e')](function(_0x31d00e){_0x5d6247=0x1f4;logger['error'](_0x31d00e[_0x8458('0x27')]);if(_0x31d00e[_0x8458('0x23')]){delete _0x31d00e[_0x8458('0x23')];}_0x5f22fe=_0x31d00e;})[_0x8458('0x5e')](function(){if(_0x5f22fe===null){_0x112782['sendStatus'](_0x5d6247);}else{if(_0x5d6247===0x1f4){_0x112782[_0x8458('0xc')](_0x5d6247)[_0x8458('0x5f')](_0x5f22fe);}else{_0x112782['status'](_0x5d6247)[_0x8458('0xd')](_0x5f22fe);}}});}; \ No newline at end of file +var _0x5db1=['exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OutboundRoutes','outbound','autoAssociation','update','pick','description','cutdigits','alias','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','Content-Range','destroy','then','get','InboundRoutes','inbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','VoiceExtension','findAll','rows','catch','params','options','create','body','startsWith'];(function(_0x4734d8,_0x479950){var _0x3b1120=function(_0x4a5d1c){while(--_0x4a5d1c){_0x4734d8['push'](_0x4734d8['shift']());}};_0x3b1120(++_0x479950);}(_0x5db1,0x118));var _0x15db=function(_0x570b50,_0x58a743){_0x570b50=_0x570b50-0x0;var _0x10742d=_0x5db1[_0x570b50];return _0x10742d;};'use strict';var _=require('lodash');var Redis=require(_0x15db('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x15db('0x1'));var config=require(_0x15db('0x2'));var db=require(_0x15db('0x3'))['db'];config[_0x15db('0x4')]=_[_0x15db('0x5')](config[_0x15db('0x4')],{'host':_0x15db('0x6'),'port':0x18eb});var socket=require(_0x15db('0x7'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x14cc8e,_0x30e94c){_0x30e94c=_0x30e94c||0xcc;return function(_0x24eed6){if(_0x24eed6){return _0x14cc8e[_0x15db('0x8')](_0x30e94c);}return _0x14cc8e[_0x15db('0x9')](_0x30e94c)[_0x15db('0xa')]();};}function respondWithResult(_0x595c82,_0x36d1c4){_0x36d1c4=_0x36d1c4||0xc8;return function(_0x4fe9f2){if(_0x4fe9f2){return _0x595c82[_0x15db('0x9')](_0x36d1c4)[_0x15db('0xb')](_0x4fe9f2);}};}function respondWithFilteredResult(_0x266655,_0x1061d9){return function(_0x3cebc5){if(_0x3cebc5){var _0x26684d=typeof _0x1061d9[_0x15db('0xc')]===_0x15db('0xd')&&typeof _0x1061d9['limit']===_0x15db('0xd');var _0x44ad86=_0x3cebc5['count'];var _0x2cbf68=_0x26684d?0x0:_0x1061d9[_0x15db('0xc')];var _0x27d187=_0x26684d?_0x3cebc5['count']:_0x1061d9[_0x15db('0xc')]+_0x1061d9[_0x15db('0xe')];var _0x32efc2;if(_0x27d187>=_0x44ad86){_0x27d187=_0x44ad86;_0x32efc2=0xc8;}else{_0x32efc2=0xce;}_0x266655['status'](_0x32efc2);return _0x266655['set'](_0x15db('0xf'),_0x2cbf68+'-'+_0x27d187+'/'+_0x44ad86)[_0x15db('0xb')](_0x3cebc5);}return null;};}function removeEntity(_0x360d55){return function(_0x28b60c){if(_0x28b60c){return _0x28b60c[_0x15db('0x10')]()[_0x15db('0x11')](function(){var _0x1df16f=_0x28b60c[_0x15db('0x12')]({'plain':!![]});var _0x31c341=[{'name':_0x15db('0x13'),'value':_0x15db('0x14'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x15db('0x15'),'value':_0x15db('0x16'),'ignore':![]}];var _0x2934b4=_(_0x31c341)[_0x15db('0x17')](_0x15db('0x18'))[_0x15db('0x19')](_0x15db('0x1a'))[_0x15db('0x1a')]();if(_[_0x15db('0x1b')](_0x2934b4,_0x1df16f[_0x15db('0x1c')])){return;}var _0x540a86=_[_0x15db('0x1d')](_0x31c341,[_0x15db('0x1a'),_0x1df16f[_0x15db('0x1c')]])[_0x15db('0x1e')];return db[_0x15db('0x1f')][_0x15db('0x10')]({'where':{'type':_0x540a86,'resourceId':_0x1df16f['id']}})['then'](function(){return _0x28b60c;});})['then'](function(){_0x360d55[_0x15db('0x9')](0xcc)[_0x15db('0xa')]();});}};}function handleEntityNotFound(_0x9597ba){return function(_0x102962){if(!_0x102962){_0x9597ba['sendStatus'](0x194);}return _0x102962;};}function handleError(_0x1a2f24,_0xb8576){_0xb8576=_0xb8576||0x1f4;return function(_0x13ee40){logger[_0x15db('0x20')](_0x13ee40[_0x15db('0x21')]);if(_0x13ee40['name']){delete _0x13ee40[_0x15db('0x1e')];}_0x1a2f24['status'](_0xb8576)[_0x15db('0x22')](_0x13ee40);};}exports[_0x15db('0x23')]=function(_0xafeeec,_0x3731c5){var _0x350079={},_0x26d1f5={},_0xccff02={'count':0x0,'rows':[]};var _0x59a0a=_[_0x15db('0x19')](db['VoiceExtension'][_0x15db('0x24')],function(_0x2f908b){return{'name':_0x2f908b[_0x15db('0x25')],'type':_0x2f908b[_0x15db('0x1c')][_0x15db('0x26')]};});_0x26d1f5[_0x15db('0x27')]=_[_0x15db('0x19')](_0x59a0a,_0x15db('0x1e'));_0x26d1f5[_0x15db('0x28')]=_[_0x15db('0x29')](_0xafeeec[_0x15db('0x28')]);_0x26d1f5[_0x15db('0x2a')]=_['intersection'](_0x26d1f5[_0x15db('0x27')],_0x26d1f5[_0x15db('0x28')]);_0x350079[_0x15db('0x2b')]=_[_0x15db('0x2c')](_0x26d1f5['model'],qs[_0x15db('0x2d')](_0xafeeec['query'][_0x15db('0x2d')]));_0x350079[_0x15db('0x2b')]=_0x350079['attributes'][_0x15db('0x2e')]?_0x350079[_0x15db('0x2b')]:_0x26d1f5['model'];if(!_0xafeeec[_0x15db('0x28')]['hasOwnProperty'](_0x15db('0x2f'))){_0x350079[_0x15db('0xe')]=qs[_0x15db('0xe')](_0xafeeec[_0x15db('0x28')][_0x15db('0xe')]);_0x350079[_0x15db('0xc')]=qs[_0x15db('0xc')](_0xafeeec[_0x15db('0x28')][_0x15db('0xc')]);}_0x350079[_0x15db('0x30')]=qs['sort'](_0xafeeec[_0x15db('0x28')][_0x15db('0x31')]);_0x350079[_0x15db('0x32')]=qs['filters'](_['pick'](_0xafeeec[_0x15db('0x28')],_0x26d1f5[_0x15db('0x2a')]),_0x59a0a);if(_0xafeeec[_0x15db('0x28')]['filter']){_0x350079[_0x15db('0x32')]=_['merge'](_0x350079[_0x15db('0x32')],{'$or':_[_0x15db('0x19')](_0x59a0a,function(_0x2dda72){if(_0x2dda72[_0x15db('0x1c')]!==_0x15db('0x33')){var _0x4ed32a={};_0x4ed32a[_0x2dda72['name']]={'$like':'%'+_0xafeeec['query'][_0x15db('0x17')]+'%'};return _0x4ed32a;}})});}_0x350079=_[_0x15db('0x34')]({},_0x350079,_0xafeeec['options']);var _0x27bfb8={'where':_0x350079[_0x15db('0x32')]};return db['VoiceExtension']['count'](_0x27bfb8)[_0x15db('0x11')](function(_0x365d58){_0xccff02['count']=_0x365d58;if(_0xafeeec[_0x15db('0x28')][_0x15db('0x35')]){_0x350079[_0x15db('0x36')]=[{'all':!![]}];}return db[_0x15db('0x37')][_0x15db('0x38')](_0x350079);})[_0x15db('0x11')](function(_0x3a1568){_0xccff02[_0x15db('0x39')]=_0x3a1568;return _0xccff02;})['then'](respondWithFilteredResult(_0x3731c5,_0x350079))[_0x15db('0x3a')](handleError(_0x3731c5,null));};exports['show']=function(_0x20e840,_0x3d89ad){var _0x1934aa={'raw':![],'where':{'id':_0x20e840[_0x15db('0x3b')]['id']}},_0x30541e={};_0x30541e['model']=_[_0x15db('0x29')](db[_0x15db('0x37')][_0x15db('0x24')]);_0x30541e['query']=_[_0x15db('0x29')](_0x20e840[_0x15db('0x28')]);_0x30541e[_0x15db('0x2a')]=_[_0x15db('0x2c')](_0x30541e[_0x15db('0x27')],_0x30541e[_0x15db('0x28')]);_0x1934aa[_0x15db('0x2b')]=_[_0x15db('0x2c')](_0x30541e[_0x15db('0x27')],qs[_0x15db('0x2d')](_0x20e840[_0x15db('0x28')][_0x15db('0x2d')]));_0x1934aa[_0x15db('0x2b')]=_0x1934aa['attributes']['length']?_0x1934aa[_0x15db('0x2b')]:_0x30541e[_0x15db('0x27')];if(_0x20e840[_0x15db('0x28')]['includeAll']){_0x1934aa['include']=[{'all':!![]}];}_0x1934aa=_[_0x15db('0x34')]({},_0x1934aa,_0x20e840[_0x15db('0x3c')]);return db[_0x15db('0x37')][_0x15db('0x1d')](_0x1934aa)[_0x15db('0x11')](handleEntityNotFound(_0x3d89ad,null))[_0x15db('0x11')](respondWithResult(_0x3d89ad,null))[_0x15db('0x3a')](handleError(_0x3d89ad,null));};exports[_0x15db('0x10')]=function(_0x22e9f8,_0x34fd7b){return db[_0x15db('0x37')][_0x15db('0x1d')]({'where':{'id':_0x22e9f8[_0x15db('0x3b')]['id']}})[_0x15db('0x11')](handleEntityNotFound(_0x34fd7b,null))[_0x15db('0x11')](removeEntity(_0x34fd7b,null))[_0x15db('0x3a')](handleError(_0x34fd7b,null));};exports[_0x15db('0x3d')]=function(_0x37d32e,_0x12a5b5){if(_0x37d32e[_0x15db('0x3e')][_0x15db('0x1c')]==='outbound'&&!_[_0x15db('0x3f')](_0x37d32e[_0x15db('0x3e')][_0x15db('0x40')],'_')){_0x37d32e[_0x15db('0x3e')][_0x15db('0x40')]='_'['concat'](_0x37d32e[_0x15db('0x3e')]['exten']);}return db[_0x15db('0x37')][_0x15db('0x3d')](_0x37d32e[_0x15db('0x3e')],{'raw':![]})['then'](function(_0x505fbe){var _0x333dc5=_0x37d32e['user']['get']({'plain':!![]});if(!_0x333dc5)throw new Error(_0x15db('0x41'));if(_0x333dc5[_0x15db('0x42')]===_0x15db('0x43')){var _0x587435=_0x505fbe[_0x15db('0x12')]({'plain':!![]});var _0x34de52=[{'name':_0x15db('0x13'),'value':_0x15db('0x14')},{'name':_0x15db('0x44'),'value':_0x15db('0x45')},{'name':_0x15db('0x15'),'value':_0x15db('0x16')}];var _0x387c72=_[_0x15db('0x1d')](_0x34de52,[_0x15db('0x1a'),_0x587435[_0x15db('0x1c')]])[_0x15db('0x1e')];return db['UserProfileSection'][_0x15db('0x1d')]({'where':{'name':_0x387c72,'userProfileId':_0x333dc5['userProfileId']},'raw':!![]})[_0x15db('0x11')](function(_0x148929){if(_0x148929&&_0x148929[_0x15db('0x46')]===0x0){return db[_0x15db('0x1f')][_0x15db('0x3d')]({'name':_0x587435['name'],'resourceId':_0x587435['id'],'type':_0x148929[_0x15db('0x1e')],'sectionId':_0x148929['id']},{})[_0x15db('0x11')](function(){return _0x505fbe;});}else{return _0x505fbe;}})['catch'](function(_0x463ccb){logger[_0x15db('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x463ccb);throw _0x463ccb;});}return _0x505fbe;})[_0x15db('0x11')](respondWithResult(_0x12a5b5,0xc9))[_0x15db('0x3a')](handleError(_0x12a5b5,null));};exports['update']=function(_0x7845d6,_0xcbb8f2){if(_0x7845d6['body']['id']){delete _0x7845d6[_0x15db('0x3e')]['id'];}return db[_0x15db('0x37')][_0x15db('0x1d')]({'where':{'id':_0x7845d6[_0x15db('0x3b')]['id']}})['then'](handleEntityNotFound(_0xcbb8f2,null))[_0x15db('0x11')](function(_0x56d2b4){if(_0x56d2b4){return db[_0x15db('0x37')][_0x15db('0x47')](_[_0x15db('0x48')](_0x7845d6[_0x15db('0x3e')],[_0x15db('0x40'),'context',_0x15db('0x49'),'recordingFormat',_0x15db('0x4a'),'mandatoryDisposition',_0x15db('0x4b')]),{'where':{'context':_0x56d2b4['context'],'exten':_0x56d2b4[_0x15db('0x40')]},'individualHooks':!![]})[_0x15db('0x11')](function(_0x19bdf6){return _0x19bdf6;});}return null;})[_0x15db('0x11')](respondWithStatusCode(_0xcbb8f2,null))[_0x15db('0x3a')](handleError(_0xcbb8f2,null));};exports[_0x15db('0x4c')]=function(_0x1b3677,_0x5cc824){var _0x330f0c=_0x1b3677[_0x15db('0x3b')]['id'];var _0x4f0a88=_0x1b3677['body'];var _0xb5ab0e=0xc8;var _0x2549f4=null;return db['sequelize'][_0x15db('0x4d')]({'isolationLevel':db[_0x15db('0x4e')][_0x15db('0x4f')][_0x15db('0x50')][_0x15db('0x51')]},function(_0x2a2d1f){return db[_0x15db('0x37')][_0x15db('0x52')]({'where':{'id':_0x330f0c},'transaction':_0x2a2d1f})[_0x15db('0x11')](function(_0x4d02ef){if(_0x4d02ef){return db[_0x15db('0x37')][_0x15db('0x10')]({'where':{'VoiceExtensionId':_0x330f0c},'transaction':_0x2a2d1f})['then'](function(){var _0x7dca64=_['map'](_0x4f0a88,function(_0x2326ec){_0x2326ec['VoiceExtensionId']=_0x330f0c;_0x2326ec['isApp']=!![];return _0x2326ec;});return _0x4d02ef[_0x15db('0x53')](_0x7dca64);})[_0x15db('0x11')](function(_0x4d913a){return db[_0x15db('0x37')]['bulkCreate'](_0x4d913a,{'transaction':_0x2a2d1f});});}else{_0xb5ab0e=0x194;_0x2549f4=[];}});})[_0x15db('0x11')](function(){if(_0xb5ab0e!==0x194){return db['VoiceExtension'][_0x15db('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x330f0c},'order':_0x15db('0x55')})[_0x15db('0x11')](function(_0x44d15a){_0x2549f4=_0x44d15a;});}})[_0x15db('0x3a')](function(_0xb5b29d){_0xb5ab0e=0x1f4;logger[_0x15db('0x20')](_0xb5b29d[_0x15db('0x21')]);if(_0xb5b29d[_0x15db('0x1e')]){delete _0xb5b29d[_0x15db('0x1e')];}_0x2549f4=_0xb5b29d;})['finally'](function(){if(_0x2549f4===null){_0x5cc824[_0x15db('0x8')](_0xb5ab0e);}else{if(_0xb5ab0e===0x1f4){_0x5cc824[_0x15db('0x9')](_0xb5ab0e)[_0x15db('0x22')](_0x2549f4);}else{_0x5cc824['status'](_0xb5ab0e)[_0x15db('0xb')](_0x2549f4);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b38c143..9db181e 100644 --- a/server/api/voiceExtension/voiceExtension.events.js +++ b/server/api/voiceExtension/voiceExtension.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6cc=['hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','save','update','remove','emit'];(function(_0x3d76ac,_0x505692){var _0x5f138b=function(_0x4247f7){while(--_0x4247f7){_0x3d76ac['push'](_0x3d76ac['shift']());}};_0x5f138b(++_0x505692);}(_0xb6cc,0x13e));var _0xcb6c=function(_0x47143f,_0x3942b4){_0x47143f=_0x47143f-0x0;var _0x3cc09f=_0xb6cc[_0x47143f];return _0x3cc09f;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xcb6c('0x0'))['db'][_0xcb6c('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcb6c('0x2'),'afterUpdate':_0xcb6c('0x3'),'afterDestroy':_0xcb6c('0x4')};function emitEvent(_0x55f0b2){return function(_0x4f1b1c,_0xa66e18,_0x1080b3){VoiceExtensionEvents[_0xcb6c('0x5')](_0x55f0b2+':'+_0x4f1b1c['id'],_0x4f1b1c);VoiceExtensionEvents[_0xcb6c('0x5')](_0x55f0b2,_0x4f1b1c);_0x1080b3(null);};}for(var e in events){if(events[_0xcb6c('0x6')](e)){var event=events[e];VoiceExtension[_0xcb6c('0x7')](e,emitEvent(event));}}module[_0xcb6c('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xdf34=['save','remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension','setMaxListeners'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0xdf34,0x1ad));var _0x4df3=function(_0x35ff9e,_0x17bf71){_0x35ff9e=_0x35ff9e-0x0;var _0x3a9e8a=_0xdf34[_0x35ff9e];return _0x3a9e8a;};'use strict';var EventEmitter=require(_0x4df3('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x4df3('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4df3('0x2')](0x0);var events={'afterCreate':_0x4df3('0x3'),'afterUpdate':'update','afterDestroy':_0x4df3('0x4')};function emitEvent(_0xd7b942){return function(_0x44b9ae,_0x57fbd4,_0xaf8288){VoiceExtensionEvents[_0x4df3('0x5')](_0xd7b942+':'+_0x44b9ae['id'],_0x44b9ae);VoiceExtensionEvents[_0x4df3('0x5')](_0xd7b942,_0x44b9ae);_0xaf8288(null);};}for(var e in events){if(events[_0x4df3('0x6')](e)){var event=events[e];VoiceExtension[_0x4df3('0x7')](e,emitEvent(event));}}module[_0x4df3('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 24d5efc..feef5a1 100644 --- a/server/api/voiceExtension/voiceExtension.model.js +++ b/server/api/voiceExtension/voiceExtension.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x320e=['${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','phone','param','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','length','intervals','map','filter','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','get','then','lodash','models','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:'];(function(_0x18031e,_0x5e6c20){var _0x559c7e=function(_0xf636cb){while(--_0xf636cb){_0x18031e['push'](_0x18031e['shift']());}};_0x559c7e(++_0x5e6c20);}(_0x320e,0x8c));var _0xe320=function(_0x30d371,_0x198ed4){_0x30d371=_0x30d371-0x0;var _0x5cc451=_0x320e[_0x30d371];return _0x5cc451;};'use strict';var _=require(_0xe320('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4ff8f5){var _0x429180=_0x4ff8f5[_0xe320('0x1')];function _0x3da6dd(_0x3684d6){var _0x4da752=0x2;var _0x320e09=[{'type':_0x3684d6[_0xe320('0x2')],'app':_0xe320('0x3'),'appdata':_0xe320('0x4')+_0x3684d6[_0xe320('0x2')],'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6['exten'],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']},{'type':_0x3684d6[_0xe320('0x2')],'app':_0x3684d6[_0xe320('0x6')]?_0xe320('0x3'):_0xe320('0x7'),'appdata':_0x3684d6[_0xe320('0x6')]?_0xe320('0x8')+_0x3684d6[_0xe320('0x6')]:_0xe320('0x9'),'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']}];if(_0x3684d6[_0xe320('0x2')]===_0xe320('0xb')){_0x320e09[_0xe320('0xc')]({'type':'inbound','app':_0xe320('0x3'),'appdata':_0xe320('0xd')+_0x3684d6['id'],'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']});}_0x320e09[_0xe320('0xc')]({'type':_0x3684d6[_0xe320('0x2')],'app':_0xe320('0x3'),'appdata':_0xe320('0xe'),'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']},{'type':_0x3684d6[_0xe320('0x2')],'app':_0xe320('0x3'),'appdata':_0xe320('0xf'),'context':_0x3684d6['context'],'exten':_0x3684d6['exten'],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']},{'type':_0x3684d6['type'],'app':_0xe320('0x3'),'appdata':_0xe320('0x10'),'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']});return _0x320e09;}function _0x257467(_0x225428){var _0x2a726b=0x2;var _0xc9cfee=[{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x12'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':'outbound','app':_0x225428[_0xe320('0x6')]?'Set':'NoOp','appdata':_0x225428[_0xe320('0x6')]?'CDR(routeAlias)='+_0x225428[_0xe320('0x6')]:_0xe320('0x9'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x13')+(_0x225428[_0xe320('0x14')]?_0xe320('0x15')+_0x225428[_0xe320('0x14')]+'}':_0xe320('0x16')),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0xd')+_0x225428['id'],'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x17'),'appdata':_0xe320('0x18')+(_0x2a726b+0x2)+_0xe320('0x19')+(_0x2a726b+0x1)+')','context':_0x225428['context'],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0x225428['cutdigits']?_0xe320('0x1a')+_0x225428[_0xe320('0x14')]+'}':_0xe320('0x1b'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':'outbound','app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0xf'),'context':_0x225428['context'],'exten':_0x225428['exten'],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x10'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x1c')+_0x225428['id'],'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']}];if(_0x225428[_0xe320('0x1d')](_0xe320('0x1e'))&&_0x225428[_0xe320('0x1e')]!==_0xe320('0x1f')){_0xc9cfee[_0xe320('0xc')]({'type':'outbound','app':_0xe320('0x3'),'appdata':_0xe320('0x20'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':'outbound','app':_0xe320('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x225428[_0xe320('0x1e')]||_0xe320('0x21'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428['exten'],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']});}return _0xc9cfee;}function _0x2e1bd9(_0x3a39b5,_0x345933){var _0x27bc0a=[{'name':_0xe320('0x22'),'param':0x0},{'name':_0xe320('0x23'),'param':0x1},{'name':_0xe320('0x24'),'param':0x2},{'name':_0xe320('0x25'),'param':0x3}];var _0x316ba5={};var _0x5bc940=_0x345933[_0xe320('0x26')](',');var _0x410160=[];for(var _0x50c564=0x0;_0x50c564<_0x27bc0a['length'];_0x50c564++){switch(_0x27bc0a[_0x50c564]['name']){case _0xe320('0x22'):_0x316ba5[_0xe320('0x22')]=_0x5bc940[_0x27bc0a[_0x50c564]['param']][_0xe320('0x26')]('/')[0x1];_0x316ba5[_0xe320('0x27')]=_0x5bc940[_0x27bc0a[_0x50c564][_0xe320('0x28')]][_0xe320('0x26')]('/')[0x2];_0x316ba5['prefix']=_0x316ba5['phone']?_0x316ba5[_0xe320('0x27')]['split']('$')[0x0]:undefined;_0x316ba5[_0xe320('0x27')]=_0x3a39b5['cutdigits']?(_0x316ba5[_0xe320('0x29')]||'')+'${EXTEN:'+_0x3a39b5[_0xe320('0x14')]+'}':(_0x316ba5[_0xe320('0x29')]||'')+_0xe320('0x16');_0x410160[_0x27bc0a[_0x50c564][_0xe320('0x28')]]=[_0xe320('0x2a'),_0x316ba5[_0xe320('0x22')],_0x316ba5[_0xe320('0x27')]][_0xe320('0x2b')]('/');break;case _0xe320('0x24'):_0x316ba5[_0xe320('0x24')]=_0x5bc940[_0x27bc0a[_0x50c564][_0xe320('0x28')]];if(_0x3a39b5[_0xe320('0x1e')]!==_0xe320('0x1f')){if(_0x316ba5[_0xe320('0x24')]['indexOf'](_0xe320('0x2c'))<0x0){_0x316ba5[_0xe320('0x24')]+=_0xe320('0x2c');}}else{_0x316ba5[_0xe320('0x24')]=_0x316ba5[_0xe320('0x24')][_0xe320('0x2d')](_0xe320('0x2c'),'');}_0x410160[_0x27bc0a[_0x50c564][_0xe320('0x28')]]=_0x316ba5[_0xe320('0x24')];break;default:_0x410160[_0x27bc0a[_0x50c564]['param']]=_0x5bc940[_0x27bc0a[_0x50c564][_0xe320('0x28')]];}}return _0x410160['join'](',');}function _0x2aa61a(_0x46283f,_0x4abaa9,_0x125cf3){return new Promise(function(_0x53d126,_0xf80a57){var _0x24cfbb=[];if(_['isEmpty'](_0x4abaa9))return _0x53d126(_0x24cfbb);_0x429180[_0xe320('0x2e')][_0xe320('0x2f')]({'attributes':['id',_0xe320('0x30'),_0xe320('0x31')],'raw':!![]})['then'](function(_0x4acee9){for(var _0x4ae682=0x0,_0xdf1c06=0x0;_0x4ae682<_0x4abaa9[_0xe320('0x32')];_0x4ae682++,_0xdf1c06=0x0){var _0x1602d3=_0x4abaa9[_0x4ae682];var _0x344874=[];var _0x436a03=[];delete _0x1602d3['id'];if(_0x1602d3[_0xe320('0x30')]!=='*,*,*,*'){_0x1602d3['intervals']=[_0x1602d3[_0xe320('0x30')]];}else{_0x1602d3[_0xe320('0x33')]=_0x1602d3[_0xe320('0x31')]?_[_0xe320('0x34')](_[_0xe320('0x35')](_0x4acee9,{'IntervalId':_0x1602d3[_0xe320('0x31')]}),_0xe320('0x30')):[];}_0x1602d3['context']=_0x46283f[_0xe320('0x5')];_0x1602d3[_0xe320('0xa')]=_0x46283f['exten'];if(_0x1602d3[_0xe320('0x2')])_0x1602d3[_0xe320('0x2')]=_0x1602d3[_0xe320('0x2')][_0xe320('0x36')]();if(_0x46283f['type']===_0xe320('0x11')){if(_0x1602d3[_0xe320('0x1d')](_0xe320('0x37'))&&_0x1602d3[_0xe320('0x37')]&&_0x1602d3[_0xe320('0x37')]!=='--'){_0x344874[_0xe320('0xc')]({'type':_0x1602d3['type']['toLowerCase'](),'app':_0xe320('0x3'),'appdata':_0xe320('0x38')+_0x1602d3[_0xe320('0x37')],'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}_0x344874['push']({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x17'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1602d3[_0xe320('0x39')]?_0xe320('0x3a')+_0x1602d3[_0xe320('0x39')]+')':_0xe320('0x3b')),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')]['length']+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}else{if(_0x1602d3['hasOwnProperty'](_0xe320('0x3c'))){if(['queue',_0xe320('0x3d')][_0xe320('0x3e')](_0x1602d3[_0xe320('0x3f')][_0xe320('0x36')]())&&_0x1602d3[_0xe320('0x40')]!==_0xe320('0x41')){if(_0x1602d3[_0xe320('0x3c')]){_0x344874[_0xe320('0xc')]({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x17'),'appdata':_0xe320('0x42'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3['intervals']['length']+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});_0x344874[_0xe320('0xc')]({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x3'),'appdata':_0xe320('0x43'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f['exten'],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}else{_0x344874[_0xe320('0xc')]({'type':_0x1602d3['type'][_0xe320('0x36')](),'app':_0xe320('0x17'),'appdata':_0xe320('0x44'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});_0x344874[_0xe320('0xc')]({'type':_0x1602d3['type']['toLowerCase'](),'app':_0xe320('0x3'),'appdata':_0xe320('0x45'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3['intervals']['length']+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}}}}for(var _0x3a94ad=0x0;_0x3a94ad<_0x1602d3['intervals'][_0xe320('0x32')];_0x3a94ad++){var _0x456d75=_0x125cf3+_0x1602d3[_0xe320('0x33')][_0xe320('0x32')];var _0x100014=_0x3a94ad===_0x1602d3['intervals'][_0xe320('0x32')]-0x1?_0x125cf3+_0x344874['length']+_0x436a03[_0xe320('0x32')]+0x2:_0x125cf3+_0x3a94ad+0x1;_0x344874[_0xe320('0x46')](_0x3a94ad,0x0,{'type':_0x46283f[_0xe320('0x2')],'app':_0xe320('0x47'),'appdata':_0x1602d3[_0xe320('0x33')][_0x3a94ad]+'?'+_0x46283f[_0xe320('0x5')]+',${EXTEN},'+_0x456d75+':'+_0x46283f[_0xe320('0x5')]+',${EXTEN},'+_0x100014,'exten':_0x46283f[_0xe320('0xa')],'context':_0x46283f[_0xe320('0x5')],'priority':_0x125cf3+_0x3a94ad,'VoiceExtensionId':_0x46283f['id']});}if(_0x1602d3[_0xe320('0x40')]===_0xe320('0x48')){_0x1602d3['appdata']=_0x2e1bd9(_0x46283f,_0x1602d3[_0xe320('0x49')]);}if(_0x1602d3[_0xe320('0x40')]===_0xe320('0x4a')){_0x344874[_0xe320('0xc')]({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x3'),'appdata':_0xe320('0x4b'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}_0x1602d3[_0xe320('0x4c')]=_0x344874['length']?_[_0xe320('0x4d')](_0x344874)[_0xe320('0x4c')]+0x1:_0x125cf3;_0x24cfbb=_[_0xe320('0x4e')](_0x24cfbb,_0x344874,[_0x1602d3],_0x436a03);_0x125cf3=_['last'](_0x24cfbb)[_0xe320('0x4c')]+0x1;}return _0x53d126(_0x24cfbb);})['catch'](function(_0x52249f){_0xf80a57(_0x52249f);});});}return _0x4ff8f5['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x7cd781){var _0x3eafb1=this[_0xe320('0x4f')]({'plain':!![]});var _0x267f7d=_0x3eafb1[_0xe320('0x2')]===_0xe320('0x11')?_0x257467(_0x3eafb1):_0x3da6dd(_0x3eafb1);return _0x2aa61a(_0x3eafb1,_0x7cd781,_['last'](_0x267f7d)[_0xe320('0x4c')]+0x1)[_0xe320('0x50')](function(_0x5b68f0){var _0x31f3dc=_[_0xe320('0x4e')](_0x267f7d,_0x5b68f0);_0x31f3dc[_0xe320('0xc')]({'type':_0x3eafb1['type'],'app':'Hangup','exten':_0x3eafb1[_0xe320('0xa')],'context':_0x3eafb1[_0xe320('0x5')],'priority':_[_0xe320('0x4d')](_0x31f3dc)[_0xe320('0x4c')]+0x1,'VoiceExtensionId':_0x3eafb1['id']});return _0x31f3dc;});}}});}; \ No newline at end of file +var _0xa16a=['tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','queue','playback','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','VoiceExtension','voice_extensions','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','exten','alias','NoOp','CDR(routeAlias)=','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split','length','name','trunk','param','phone','prefix','SIP','join','options','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','intervals','map','filter','IntervalId'];(function(_0x3d8f98,_0x1a359c){var _0x42098d=function(_0x5744de){while(--_0x5744de){_0x3d8f98['push'](_0x3d8f98['shift']());}};_0x42098d(++_0x1a359c);}(_0xa16a,0x1aa));var _0xaa16=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xa16a[_0x59d0cc];return _0x2ae79f;};'use strict';var _=require(_0xaa16('0x0'));var attributes=require(_0xaa16('0x1'));module[_0xaa16('0x2')]=function(_0x1af401){var _0x5b32db=_0x1af401[_0xaa16('0x3')];function _0x481660(_0x55ad01){var _0x2150a4=0x2;var _0x2a94a1=[{'type':_0x55ad01['type'],'app':_0xaa16('0x4'),'appdata':_0xaa16('0x5')+_0x55ad01[_0xaa16('0x6')],'context':_0x55ad01['context'],'exten':_0x55ad01[_0xaa16('0x7')],'priority':_0x2150a4++,'VoiceExtensionId':_0x55ad01['id']},{'type':_0x55ad01[_0xaa16('0x6')],'app':_0x55ad01[_0xaa16('0x8')]?'Set':_0xaa16('0x9'),'appdata':_0x55ad01[_0xaa16('0x8')]?_0xaa16('0xa')+_0x55ad01[_0xaa16('0x8')]:'No\x20alias\x20set','context':_0x55ad01[_0xaa16('0xb')],'exten':_0x55ad01['exten'],'priority':_0x2150a4++,'VoiceExtensionId':_0x55ad01['id']}];if(_0x55ad01['type']===_0xaa16('0xc')){_0x2a94a1[_0xaa16('0xd')]({'type':_0xaa16('0xc'),'app':_0xaa16('0x4'),'appdata':_0xaa16('0xe')+_0x55ad01['id'],'context':_0x55ad01[_0xaa16('0xb')],'exten':_0x55ad01[_0xaa16('0x7')],'priority':_0x2150a4++,'VoiceExtensionId':_0x55ad01['id']});}_0x2a94a1['push']({'type':_0x55ad01[_0xaa16('0x6')],'app':'Set','appdata':_0xaa16('0xf'),'context':_0x55ad01[_0xaa16('0xb')],'exten':_0x55ad01['exten'],'priority':_0x2150a4++,'VoiceExtensionId':_0x55ad01['id']},{'type':_0x55ad01[_0xaa16('0x6')],'app':_0xaa16('0x4'),'appdata':_0xaa16('0x10'),'context':_0x55ad01[_0xaa16('0xb')],'exten':_0x55ad01[_0xaa16('0x7')],'priority':_0x2150a4++,'VoiceExtensionId':_0x55ad01['id']},{'type':_0x55ad01[_0xaa16('0x6')],'app':_0xaa16('0x4'),'appdata':_0xaa16('0x11'),'context':_0x55ad01[_0xaa16('0xb')],'exten':_0x55ad01[_0xaa16('0x7')],'priority':_0x2150a4++,'VoiceExtensionId':_0x55ad01['id']});return _0x2a94a1;}function _0x4a3494(_0x1454e3){var _0x1ac08d=0x2;var _0x16c554=[{'type':'outbound','app':'Set','appdata':_0xaa16('0x12'),'context':_0x1454e3['context'],'exten':_0x1454e3[_0xaa16('0x7')],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']},{'type':_0xaa16('0x13'),'app':_0x1454e3[_0xaa16('0x8')]?_0xaa16('0x4'):_0xaa16('0x9'),'appdata':_0x1454e3['alias']?_0xaa16('0xa')+_0x1454e3[_0xaa16('0x8')]:'No\x20alias\x20set','context':_0x1454e3[_0xaa16('0xb')],'exten':_0x1454e3[_0xaa16('0x7')],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']},{'type':_0xaa16('0x13'),'app':_0xaa16('0x4'),'appdata':_0xaa16('0x14')+(_0x1454e3[_0xaa16('0x15')]?'${EXTEN:'+_0x1454e3[_0xaa16('0x15')]+'}':_0xaa16('0x16')),'context':_0x1454e3[_0xaa16('0xb')],'exten':_0x1454e3['exten'],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']},{'type':_0xaa16('0x13'),'app':_0xaa16('0x4'),'appdata':_0xaa16('0xe')+_0x1454e3['id'],'context':_0x1454e3['context'],'exten':_0x1454e3[_0xaa16('0x7')],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']},{'type':_0xaa16('0x13'),'app':_0xaa16('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1ac08d+0x2)+_0xaa16('0x18')+(_0x1ac08d+0x1)+')','context':_0x1454e3[_0xaa16('0xb')],'exten':_0x1454e3['exten'],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']},{'type':_0xaa16('0x13'),'app':_0xaa16('0x4'),'appdata':_0x1454e3[_0xaa16('0x15')]?'CDR(prefix)=${EXTEN:0:'+_0x1454e3[_0xaa16('0x15')]+'}':_0xaa16('0x19'),'context':_0x1454e3[_0xaa16('0xb')],'exten':_0x1454e3[_0xaa16('0x7')],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']},{'type':'outbound','app':'Set','appdata':_0xaa16('0xf'),'context':_0x1454e3['context'],'exten':_0x1454e3[_0xaa16('0x7')],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']},{'type':_0xaa16('0x13'),'app':_0xaa16('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1454e3[_0xaa16('0xb')],'exten':_0x1454e3[_0xaa16('0x7')],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']},{'type':'outbound','app':_0xaa16('0x4'),'appdata':_0xaa16('0x11'),'context':_0x1454e3[_0xaa16('0xb')],'exten':_0x1454e3['exten'],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']},{'type':_0xaa16('0x13'),'app':_0xaa16('0x4'),'appdata':'outboundrouteid='+_0x1454e3['id'],'context':_0x1454e3[_0xaa16('0xb')],'exten':_0x1454e3['exten'],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']}];if(_0x1454e3[_0xaa16('0x1a')](_0xaa16('0x1b'))&&_0x1454e3[_0xaa16('0x1b')]!==_0xaa16('0x1c')){_0x16c554['push']({'type':_0xaa16('0x13'),'app':_0xaa16('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1454e3[_0xaa16('0xb')],'exten':_0x1454e3[_0xaa16('0x7')],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']},{'type':_0xaa16('0x13'),'app':'Set','appdata':_0xaa16('0x1d')+_0x1454e3[_0xaa16('0x1b')]||_0xaa16('0x1e'),'context':_0x1454e3['context'],'exten':_0x1454e3[_0xaa16('0x7')],'priority':_0x1ac08d++,'VoiceExtensionId':_0x1454e3['id']});}return _0x16c554;}function _0x212733(_0x3d188a,_0x12208c){var _0x3b4170=[{'name':'trunk','param':0x0},{'name':_0xaa16('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0xaa16('0x20'),'param':0x3}];var _0x4d69ff={};var _0x22e2bb=_0x12208c[_0xaa16('0x21')](',');var _0x27a0b3=[];for(var _0x3a1fe6=0x0;_0x3a1fe6<_0x3b4170[_0xaa16('0x22')];_0x3a1fe6++){switch(_0x3b4170[_0x3a1fe6][_0xaa16('0x23')]){case _0xaa16('0x24'):_0x4d69ff[_0xaa16('0x24')]=_0x22e2bb[_0x3b4170[_0x3a1fe6][_0xaa16('0x25')]][_0xaa16('0x21')]('/')[0x1];_0x4d69ff[_0xaa16('0x26')]=_0x22e2bb[_0x3b4170[_0x3a1fe6]['param']][_0xaa16('0x21')]('/')[0x2];_0x4d69ff['prefix']=_0x4d69ff[_0xaa16('0x26')]?_0x4d69ff['phone']['split']('$')[0x0]:undefined;_0x4d69ff[_0xaa16('0x26')]=_0x3d188a[_0xaa16('0x15')]?(_0x4d69ff[_0xaa16('0x27')]||'')+'${EXTEN:'+_0x3d188a[_0xaa16('0x15')]+'}':(_0x4d69ff['prefix']||'')+'${EXTEN}';_0x27a0b3[_0x3b4170[_0x3a1fe6][_0xaa16('0x25')]]=[_0xaa16('0x28'),_0x4d69ff['trunk'],_0x4d69ff[_0xaa16('0x26')]][_0xaa16('0x29')]('/');break;case'options':_0x4d69ff[_0xaa16('0x2a')]=_0x22e2bb[_0x3b4170[_0x3a1fe6][_0xaa16('0x25')]];if(_0x3d188a['recordingFormat']!==_0xaa16('0x1c')){if(_0x4d69ff[_0xaa16('0x2a')]['indexOf'](_0xaa16('0x2b'))<0x0){_0x4d69ff[_0xaa16('0x2a')]+='U(xcally-mixmonitor-context)';}}else{_0x4d69ff[_0xaa16('0x2a')]=_0x4d69ff[_0xaa16('0x2a')][_0xaa16('0x2c')](_0xaa16('0x2b'),'');}_0x27a0b3[_0x3b4170[_0x3a1fe6]['param']]=_0x4d69ff[_0xaa16('0x2a')];break;default:_0x27a0b3[_0x3b4170[_0x3a1fe6]['param']]=_0x22e2bb[_0x3b4170[_0x3a1fe6][_0xaa16('0x25')]];}}return _0x27a0b3[_0xaa16('0x29')](',');}function _0x2e449b(_0x25d08d,_0x4a9a0c,_0x5961ce){return new Promise(function(_0x1c1939,_0x111bb5){var _0x3df572=[];if(_[_0xaa16('0x2d')](_0x4a9a0c))return _0x1c1939(_0x3df572);_0x5b32db[_0xaa16('0x2e')][_0xaa16('0x2f')]({'attributes':['id',_0xaa16('0x30'),'IntervalId'],'raw':!![]})[_0xaa16('0x31')](function(_0x13fff0){for(var _0x410088=0x0,_0x27766e=0x0;_0x410088<_0x4a9a0c['length'];_0x410088++,_0x27766e=0x0){var _0x48de17=_0x4a9a0c[_0x410088];var _0x2c3354=[];var _0x439a77=[];delete _0x48de17['id'];if(_0x48de17['interval']!=='*,*,*,*'){_0x48de17[_0xaa16('0x32')]=[_0x48de17[_0xaa16('0x30')]];}else{_0x48de17['intervals']=_0x48de17['IntervalId']?_[_0xaa16('0x33')](_[_0xaa16('0x34')](_0x13fff0,{'IntervalId':_0x48de17[_0xaa16('0x35')]}),'interval'):[];}_0x48de17[_0xaa16('0xb')]=_0x25d08d['context'];_0x48de17['exten']=_0x25d08d[_0xaa16('0x7')];if(_0x48de17['type'])_0x48de17[_0xaa16('0x6')]=_0x48de17[_0xaa16('0x6')]['toLowerCase']();if(_0x25d08d['type']===_0xaa16('0x13')){if(_0x48de17[_0xaa16('0x1a')]('tag')&&_0x48de17[_0xaa16('0x36')]&&_0x48de17[_0xaa16('0x36')]!=='--'){_0x2c3354[_0xaa16('0xd')]({'type':_0x48de17[_0xaa16('0x6')][_0xaa16('0x37')](),'app':_0xaa16('0x4'),'appdata':_0xaa16('0x38')+_0x48de17[_0xaa16('0x36')],'context':_0x25d08d[_0xaa16('0xb')],'exten':_0x25d08d[_0xaa16('0x7')],'priority':_0x48de17[_0xaa16('0x32')][_0xaa16('0x22')]+_0x5961ce+_0x27766e++,'VoiceExtensionId':_0x25d08d['id']});}_0x2c3354[_0xaa16('0xd')]({'type':_0x48de17[_0xaa16('0x6')][_0xaa16('0x37')](),'app':_0xaa16('0x17'),'appdata':_0xaa16('0x39')+(_0x48de17['callerID']?'Set(CALLERID(all)='+_0x48de17[_0xaa16('0x3a')]+')':_0xaa16('0x3b')),'context':_0x25d08d[_0xaa16('0xb')],'exten':_0x25d08d[_0xaa16('0x7')],'priority':_0x48de17[_0xaa16('0x32')][_0xaa16('0x22')]+_0x5961ce+_0x27766e++,'VoiceExtensionId':_0x25d08d['id']});}else{if(_0x48de17[_0xaa16('0x1a')]('answer')){if([_0xaa16('0x3c'),_0xaa16('0x3d')]['includes'](_0x48de17['app'][_0xaa16('0x37')]())&&_0x48de17['appType']!==_0xaa16('0x3e')){if(_0x48de17[_0xaa16('0x3f')]){_0x2c3354[_0xaa16('0xd')]({'type':_0x48de17[_0xaa16('0x6')][_0xaa16('0x37')](),'app':'ExecIf','appdata':_0xaa16('0x40'),'context':_0x25d08d[_0xaa16('0xb')],'exten':_0x25d08d[_0xaa16('0x7')],'priority':_0x48de17[_0xaa16('0x32')][_0xaa16('0x22')]+_0x5961ce+_0x27766e++,'VoiceExtensionId':_0x25d08d['id']});_0x2c3354[_0xaa16('0xd')]({'type':_0x48de17['type'][_0xaa16('0x37')](),'app':_0xaa16('0x4'),'appdata':_0xaa16('0x41'),'context':_0x25d08d[_0xaa16('0xb')],'exten':_0x25d08d[_0xaa16('0x7')],'priority':_0x48de17[_0xaa16('0x32')]['length']+_0x5961ce+_0x27766e++,'VoiceExtensionId':_0x25d08d['id']});}else{_0x2c3354[_0xaa16('0xd')]({'type':_0x48de17[_0xaa16('0x6')][_0xaa16('0x37')](),'app':_0xaa16('0x17'),'appdata':_0xaa16('0x42'),'context':_0x25d08d[_0xaa16('0xb')],'exten':_0x25d08d[_0xaa16('0x7')],'priority':_0x48de17['intervals'][_0xaa16('0x22')]+_0x5961ce+_0x27766e++,'VoiceExtensionId':_0x25d08d['id']});_0x2c3354[_0xaa16('0xd')]({'type':_0x48de17[_0xaa16('0x6')][_0xaa16('0x37')](),'app':_0xaa16('0x4'),'appdata':_0xaa16('0x43'),'context':_0x25d08d[_0xaa16('0xb')],'exten':_0x25d08d[_0xaa16('0x7')],'priority':_0x48de17['intervals'][_0xaa16('0x22')]+_0x5961ce+_0x27766e++,'VoiceExtensionId':_0x25d08d['id']});}}}}for(var _0x11afdc=0x0;_0x11afdc<_0x48de17['intervals'][_0xaa16('0x22')];_0x11afdc++){var _0xaeb379=_0x5961ce+_0x48de17[_0xaa16('0x32')][_0xaa16('0x22')];var _0x5e2eaf=_0x11afdc===_0x48de17[_0xaa16('0x32')][_0xaa16('0x22')]-0x1?_0x5961ce+_0x2c3354[_0xaa16('0x22')]+_0x439a77['length']+0x2:_0x5961ce+_0x11afdc+0x1;_0x2c3354['splice'](_0x11afdc,0x0,{'type':_0x25d08d['type'],'app':_0xaa16('0x44'),'appdata':_0x48de17['intervals'][_0x11afdc]+'?'+_0x25d08d[_0xaa16('0xb')]+',${EXTEN},'+_0xaeb379+':'+_0x25d08d['context']+',${EXTEN},'+_0x5e2eaf,'exten':_0x25d08d['exten'],'context':_0x25d08d[_0xaa16('0xb')],'priority':_0x5961ce+_0x11afdc,'VoiceExtensionId':_0x25d08d['id']});}if(_0x48de17[_0xaa16('0x45')]===_0xaa16('0x46')){_0x48de17[_0xaa16('0x47')]=_0x212733(_0x25d08d,_0x48de17[_0xaa16('0x47')]);}if(_0x48de17['appType']===_0xaa16('0x48')){_0x2c3354['push']({'type':_0x48de17['type'][_0xaa16('0x37')](),'app':_0xaa16('0x4'),'appdata':_0xaa16('0x49'),'context':_0x25d08d[_0xaa16('0xb')],'exten':_0x25d08d[_0xaa16('0x7')],'priority':_0x48de17['intervals'][_0xaa16('0x22')]+_0x5961ce+_0x27766e++,'VoiceExtensionId':_0x25d08d['id']});}_0x48de17[_0xaa16('0x4a')]=_0x2c3354[_0xaa16('0x22')]?_[_0xaa16('0x4b')](_0x2c3354)[_0xaa16('0x4a')]+0x1:_0x5961ce;_0x3df572=_[_0xaa16('0x4c')](_0x3df572,_0x2c3354,[_0x48de17],_0x439a77);_0x5961ce=_[_0xaa16('0x4b')](_0x3df572)[_0xaa16('0x4a')]+0x1;}return _0x1c1939(_0x3df572);})[_0xaa16('0x4d')](function(_0x546425){_0x111bb5(_0x546425);});});}return _0x1af401['define'](_0xaa16('0x4e'),attributes,{'tableName':_0xaa16('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x29ec2b){var _0x267299=this['get']({'plain':!![]});var _0x2e3142=_0x267299[_0xaa16('0x6')]==='outbound'?_0x4a3494(_0x267299):_0x481660(_0x267299);return _0x2e449b(_0x267299,_0x29ec2b,_[_0xaa16('0x4b')](_0x2e3142)['priority']+0x1)[_0xaa16('0x31')](function(_0x111931){var _0x443225=_[_0xaa16('0x4c')](_0x2e3142,_0x111931);_0x443225['push']({'type':_0x267299['type'],'app':'Hangup','exten':_0x267299[_0xaa16('0x7')],'context':_0x267299[_0xaa16('0xb')],'priority':_[_0xaa16('0x4b')](_0x443225)[_0xaa16('0x4a')]+0x1,'VoiceExtensionId':_0x267299['id']});return _0x443225;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 29b15f0..748d918 100644 --- a/server/api/voiceExtension/voiceExtension.rpc.js +++ b/server/api/voiceExtension/voiceExtension.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0dee=['redis','defaults','socket.io-emitter','./voiceExtension.socket','request','then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','message','VoiceExtension,\x20%s,\x20%s','request\x20sent','result','catch','GetVoiceExtension','findAll','options','where','include','model','map','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x14bca7,_0x1e79f8){var _0x4bfaf5=function(_0x4f1c4f){while(--_0x4f1c4f){_0x14bca7['push'](_0x14bca7['shift']());}};_0x4bfaf5(++_0x1e79f8);}(_0x0dee,0xf7));var _0xe0de=function(_0x229c29,_0x5afad4){_0x229c29=_0x229c29-0x0;var _0x3a93c9=_0x0dee[_0x229c29];return _0x3a93c9;};'use strict';var _=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var moment=require('moment');var BPromise=require(_0xe0de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0de('0x3'));var db=require(_0xe0de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0de('0x5'))(_0xe0de('0x6'));var config=require(_0xe0de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe0de('0x8')]['http']({'port':0x232a});config[_0xe0de('0x9')]=_[_0xe0de('0xa')](config[_0xe0de('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe0de('0xb'))(new Redis(config['redis']));require(_0xe0de('0xc'))['register'](socket);function respondWithRpcPromise(_0x401250,_0x301e88,_0xd2fd6){return new BPromise(function(_0x107be5,_0x53930a){return client[_0xe0de('0xd')](_0x401250,_0xd2fd6)[_0xe0de('0xe')](function(_0x15dfc8){logger[_0xe0de('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x301e88,'request\x20sent');logger[_0xe0de('0x10')](_0xe0de('0x11'),_0x301e88,'request\x20sent',JSON['stringify'](_0x15dfc8));if(_0x15dfc8[_0xe0de('0x12')]){if(_0x15dfc8[_0xe0de('0x12')]['code']===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x301e88,_0x15dfc8['error'][_0xe0de('0x13')]);return _0x53930a(_0x15dfc8[_0xe0de('0x12')][_0xe0de('0x13')]);}logger[_0xe0de('0x12')](_0xe0de('0x14'),_0x301e88,_0x15dfc8[_0xe0de('0x12')][_0xe0de('0x13')]);return _0x107be5(_0x15dfc8[_0xe0de('0x12')][_0xe0de('0x13')]);}else{logger[_0xe0de('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x301e88,_0xe0de('0x15'));_0x107be5(_0x15dfc8[_0xe0de('0x16')][_0xe0de('0x13')]);}})[_0xe0de('0x17')](function(_0x22c5b7){logger[_0xe0de('0x12')](_0xe0de('0x14'),_0x301e88,_0x22c5b7);_0x53930a(_0x22c5b7);});});}exports[_0xe0de('0x18')]=function(_0x2c728e){var _0x194211=this;return new Promise(function(_0x509353,_0x2d7ad8){return db['VoiceExtension'][_0xe0de('0x19')]({'raw':_0x2c728e[_0xe0de('0x1a')]?_0x2c728e[_0xe0de('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2c728e[_0xe0de('0x1a')]?_0x2c728e[_0xe0de('0x1a')][_0xe0de('0x1b')]||null:null,'attributes':_0x2c728e[_0xe0de('0x1a')]?_0x2c728e[_0xe0de('0x1a')]['attributes']||null:null,'limit':_0x2c728e[_0xe0de('0x1a')]?_0x2c728e[_0xe0de('0x1a')]['limit']||null:null,'include':_0x2c728e[_0xe0de('0x1a')]?_0x2c728e[_0xe0de('0x1a')][_0xe0de('0x1c')]?_['map'](_0x2c728e['options']['include'],function(_0x3a41a9){return{'model':db[_0x3a41a9[_0xe0de('0x1d')]],'as':_0x3a41a9['as'],'attributes':_0x3a41a9['attributes'],'include':_0x3a41a9[_0xe0de('0x1c')]?_[_0xe0de('0x1e')](_0x3a41a9[_0xe0de('0x1c')],function(_0xb95460){return{'model':db[_0xb95460['model']],'as':_0xb95460['as'],'attributes':_0xb95460[_0xe0de('0x1f')],'include':_0xb95460[_0xe0de('0x1c')]?_['map'](_0xb95460[_0xe0de('0x1c')],function(_0x32ba02){return{'model':db[_0x32ba02['model']],'as':_0x32ba02['as'],'attributes':_0x32ba02['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fec50){logger[_0xe0de('0xf')]('GetVoiceExtension',_0x2c728e);logger[_0xe0de('0x10')](_0xe0de('0x18'),_0x2c728e,JSON['stringify'](_0x4fec50));_0x509353(_0x4fec50);})[_0xe0de('0x17')](function(_0x497183){logger[_0xe0de('0x12')](_0xe0de('0x18'),_0x497183[_0xe0de('0x13')],_0x2c728e);_0x2d7ad8(_0x194211[_0xe0de('0x12')](0x1f4,_0x497183['message']));});});}; \ No newline at end of file +var _0xc359=['options','raw','where','limit','map','include','attributes','debug','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceExtension','findAll'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xc359,0x1d9));var _0x9c35=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0xc359[_0x2c2980];return _0x2a20a9;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var moment=require('moment');var BPromise=require(_0x9c35('0x1'));var rs=require(_0x9c35('0x2'));var fs=require('fs');var Redis=require(_0x9c35('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c35('0x4'));var logger=require('../../config/logger')(_0x9c35('0x5'));var config=require('../../config/environment');var jayson=require(_0x9c35('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9c35('0x7')],{'host':_0x9c35('0x8'),'port':0x18eb});var socket=require(_0x9c35('0x9'))(new Redis(config[_0x9c35('0x7')]));require(_0x9c35('0xa'))[_0x9c35('0xb')](socket);function respondWithRpcPromise(_0x56d3fb,_0x21df9a,_0x467add){return new BPromise(function(_0x500420,_0x4e3834){return client['request'](_0x56d3fb,_0x467add)[_0x9c35('0xc')](function(_0x4d012f){logger[_0x9c35('0xd')](_0x9c35('0xe'),_0x21df9a,_0x9c35('0xf'));logger['debug'](_0x9c35('0x10'),_0x21df9a,_0x9c35('0xf'),JSON[_0x9c35('0x11')](_0x4d012f));if(_0x4d012f[_0x9c35('0x12')]){if(_0x4d012f[_0x9c35('0x12')]['code']===0x1f4){logger[_0x9c35('0x12')](_0x9c35('0xe'),_0x21df9a,_0x4d012f[_0x9c35('0x12')][_0x9c35('0x13')]);return _0x4e3834(_0x4d012f[_0x9c35('0x12')][_0x9c35('0x13')]);}logger[_0x9c35('0x12')](_0x9c35('0xe'),_0x21df9a,_0x4d012f[_0x9c35('0x12')][_0x9c35('0x13')]);return _0x500420(_0x4d012f[_0x9c35('0x12')][_0x9c35('0x13')]);}else{logger[_0x9c35('0xd')](_0x9c35('0xe'),_0x21df9a,_0x9c35('0xf'));_0x500420(_0x4d012f['result'][_0x9c35('0x13')]);}})[_0x9c35('0x14')](function(_0x26911d){logger[_0x9c35('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x21df9a,_0x26911d);_0x4e3834(_0x26911d);});});}exports[_0x9c35('0x15')]=function(_0x3c3858){var _0x2edb26=this;return new Promise(function(_0x50d7b8,_0x69d118){return db['VoiceExtension'][_0x9c35('0x16')]({'raw':_0x3c3858['options']?_0x3c3858[_0x9c35('0x17')][_0x9c35('0x18')]===undefined?!![]:![]:!![],'where':_0x3c3858[_0x9c35('0x17')]?_0x3c3858[_0x9c35('0x17')][_0x9c35('0x19')]||null:null,'attributes':_0x3c3858[_0x9c35('0x17')]?_0x3c3858[_0x9c35('0x17')]['attributes']||null:null,'limit':_0x3c3858['options']?_0x3c3858[_0x9c35('0x17')][_0x9c35('0x1a')]||null:null,'include':_0x3c3858[_0x9c35('0x17')]?_0x3c3858[_0x9c35('0x17')]['include']?_[_0x9c35('0x1b')](_0x3c3858['options'][_0x9c35('0x1c')],function(_0x4bf0ea){return{'model':db[_0x4bf0ea['model']],'as':_0x4bf0ea['as'],'attributes':_0x4bf0ea[_0x9c35('0x1d')],'include':_0x4bf0ea[_0x9c35('0x1c')]?_[_0x9c35('0x1b')](_0x4bf0ea['include'],function(_0x3bfdfd){return{'model':db[_0x3bfdfd['model']],'as':_0x3bfdfd['as'],'attributes':_0x3bfdfd[_0x9c35('0x1d')],'include':_0x3bfdfd[_0x9c35('0x1c')]?_[_0x9c35('0x1b')](_0x3bfdfd[_0x9c35('0x1c')],function(_0x4525c9){return{'model':db[_0x4525c9['model']],'as':_0x4525c9['as'],'attributes':_0x4525c9[_0x9c35('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9c35('0xc')](function(_0x568925){logger[_0x9c35('0xd')](_0x9c35('0x15'),_0x3c3858);logger[_0x9c35('0x1e')](_0x9c35('0x15'),_0x3c3858,JSON[_0x9c35('0x11')](_0x568925));_0x50d7b8(_0x568925);})['catch'](function(_0x37379c){logger[_0x9c35('0x12')](_0x9c35('0x15'),_0x37379c[_0x9c35('0x13')],_0x3c3858);_0x69d118(_0x2edb26[_0x9c35('0x12')](0x1f4,_0x37379c[_0x9c35('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ad03f7d..6134388 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x5ed800,_0x34e5aa){var _0x17c54f=function(_0xe3e5aa){while(--_0xe3e5aa){_0x5ed800['push'](_0x5ed800['shift']());}};_0x17c54f(++_0x34e5aa);}(_0xabce,0x103));var _0xeabc=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xabce[_0x2d8fc2];return _0x3a9e53;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x5d3901,_0x5364db){var _0x5b7843=function(_0x3a1a44){while(--_0x3a1a44){_0x5d3901['push'](_0x5d3901['shift']());}};_0x5b7843(++_0x5364db);}(_0x5fab,0x177));var _0xb5fa=function(_0x11503f,_0x30de86){_0x11503f=_0x11503f-0x0;var _0x34caab=_0x5fab[_0x11503f];return _0x34caab;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 0edba38..cfcc783 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['show','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x4d22af,_0x2da329){var _0x1aa3f4=function(_0x58538c){while(--_0x58538c){_0x4d22af['push'](_0x4d22af['shift']());}};_0x1aa3f4(++_0x2da329);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x304292,_0xcb4fb6){_0x304292=_0x304292-0x0;var _0x1b5918=_0x3f8a[_0x304292];return _0x1b5918;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xa')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router['post']('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xd'),auth['isAuthenticated'](),controller[_0xa3f8('0x13')]);router[_0xa3f8('0x14')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x15')]);module[_0xa3f8('0x16')]=router; \ No newline at end of file +var _0x7278=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5a6300,_0x290fb0){var _0xa246c4=function(_0x1c8188){while(--_0x1c8188){_0x5a6300['push'](_0x5a6300['shift']());}};_0xa246c4(++_0x290fb0);}(_0x7278,0x161));var _0x8727=function(_0x3b7356,_0xa0b48e){_0x3b7356=_0x3b7356-0x0;var _0x3aab37=_0x7278[_0x3b7356];return _0x3aab37;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var fs_extra=require(_0x8727('0x5'));var auth=require(_0x8727('0x6'));var interaction=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var controller=require(_0x8727('0x9'));router[_0x8727('0xa')]('/',auth[_0x8727('0xb')](),controller['index']);router[_0x8727('0xa')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0xd')]);router[_0x8727('0xa')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x8727('0xe')]('/',auth[_0x8727('0xb')](),controller[_0x8727('0xf')]);router[_0x8727('0x10')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0x11')]);router[_0x8727('0x12')]('/:id',auth[_0x8727('0xb')](),controller[_0x8727('0x13')]);module[_0x8727('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index f1817f4..efaf767 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09a2=['getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','\x20-\x20'];(function(_0x4ea8dd,_0x541ae3){var _0x1cc939=function(_0x133a08){while(--_0x133a08){_0x4ea8dd['push'](_0x4ea8dd['shift']());}};_0x1cc939(++_0x541ae3);}(_0x09a2,0x1d2));var _0x209a=function(_0x1dc9d1,_0x2947a4){_0x1dc9d1=_0x1dc9d1-0x0;var _0x20316e=_0x09a2[_0x1dc9d1];return _0x20316e;};'use strict';var Sequelize=require(_0x209a('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x209a('0x1')]},'context':{'type':Sequelize[_0x209a('0x1')],'defaultValue':_0x209a('0x2'),'unique':_0x209a('0x3')},'mailbox':{'type':Sequelize[_0x209a('0x1')],'defaultValue':'','allowNull':![],'unique':_0x209a('0x3')},'password':{'type':Sequelize[_0x209a('0x1')]},'fullname':{'type':Sequelize[_0x209a('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3b7ca9){this[_0x209a('0x4')](_0x209a('0x5'),typeof _0x3b7ca9==='string'&&_0x3b7ca9[_0x209a('0x6')]()?_0x3b7ca9['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x209a('0x7')},'attach':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':_0x209a('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x209a('0x8')]('yes','no'),'defaultValue':_0x209a('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x209a('0x1')]},'callback':{'type':Sequelize[_0x209a('0x1')]},'review':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x209a('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x209a('0x9'),'no'),'defaultValue':_0x209a('0x9'),'allowNull':![]},'stamp':{'type':_0x209a('0xb')},'emailsubject':{'type':Sequelize[_0x209a('0x1')]},'emailbody':{'type':Sequelize[_0x209a('0x1')]},'maxsecs':{'type':Sequelize[_0x209a('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x209a('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('fullname')+_0x209a('0xd')+this[_0x209a('0xe')](_0x209a('0xf'));}}}; \ No newline at end of file +var _0x10db=['TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes'];(function(_0x377e92,_0x25a786){var _0x42a003=function(_0xda6d15){while(--_0xda6d15){_0x377e92['push'](_0x377e92['shift']());}};_0x42a003(++_0x25a786);}(_0x10db,0x103));var _0xb10d=function(_0x3dfae3,_0x170201){_0x3dfae3=_0x3dfae3-0x0;var _0x41095b=_0x10db[_0x3dfae3];return _0x41095b;};'use strict';var Sequelize=require(_0xb10d('0x0'));module[_0xb10d('0x1')]={'customer_id':{'type':Sequelize[_0xb10d('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0xb10d('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xb10d('0x2')]},'fullname':{'type':Sequelize[_0xb10d('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3e470b){this[_0xb10d('0x4')](_0xb10d('0x5'),typeof _0x3e470b===_0xb10d('0x6')&&_0x3e470b[_0xb10d('0x7')]()?_0x3e470b[_0xb10d('0x7')]():null);}},'pager':{'type':Sequelize[_0xb10d('0x2')]},'tz':{'type':Sequelize[_0xb10d('0x2')],'defaultValue':_0xb10d('0x8')},'attach':{'type':Sequelize[_0xb10d('0x9')](_0xb10d('0xa'),'no'),'defaultValue':_0xb10d('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb10d('0x9')](_0xb10d('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xb10d('0x2')]},'callback':{'type':Sequelize[_0xb10d('0x2')]},'review':{'type':Sequelize['ENUM'](_0xb10d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xb10d('0x9')](_0xb10d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xb10d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb10d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb10d('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb10d('0x9')](_0xb10d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xb10d('0x9')](_0xb10d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb10d('0x9')](_0xb10d('0xa'),'no'),'defaultValue':_0xb10d('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb10d('0x9')](_0xb10d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb10d('0x9')](_0xb10d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xb10d('0xa'),'no'),'defaultValue':_0xb10d('0xa'),'allowNull':![]},'stamp':{'type':_0xb10d('0xc')},'emailsubject':{'type':Sequelize[_0xb10d('0x2')]},'emailbody':{'type':Sequelize[_0xb10d('0x2')]},'maxsecs':{'type':Sequelize[_0xb10d('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xb10d('0xe')],'get':function(){return this[_0xb10d('0xf')](_0xb10d('0x10'))+_0xb10d('0x11')+this[_0xb10d('0xf')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 620f321..e9418f3 100644 --- a/server/api/voiceMail/voiceMail.controller.js +++ b/server/api/voiceMail/voiceMail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97c1=['error','stack','name','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMessages','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','sendStatus'];(function(_0x4f9b05,_0x4e4203){var _0x62a1f7=function(_0x2d1a9a){while(--_0x2d1a9a){_0x4f9b05['push'](_0x4f9b05['shift']());}};_0x62a1f7(++_0x4e4203);}(_0x97c1,0xdf));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){var _0x5f4a02=_0x2a1310[_0x197c('0x26')]({'plain':!![]});var _0x2911dd=_0x197c('0x27');return db['UserProfileResource'][_0x197c('0x25')]({'where':{'type':_0x2911dd,'resourceId':_0x5f4a02['id']}})[_0x197c('0x24')](function(){return _0x2a1310;});})['then'](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x48f759,_0xfbca7a){return function(_0x14b0aa){if(!_0x14b0aa){_0x48f759[_0x197c('0x28')](0x194);}return _0x14b0aa;};}function handleError(_0x16e026,_0x2f031c){_0x2f031c=_0x2f031c||0x1f4;return function(_0x3cdcd8){logger[_0x197c('0x29')](_0x3cdcd8[_0x197c('0x2a')]);if(_0x3cdcd8[_0x197c('0x2b')]){delete _0x3cdcd8['name'];}_0x16e026['status'](_0x2f031c)['send'](_0x3cdcd8);};}exports['index']=function(_0x5f7425,_0x4c9256){var _0x252cde={},_0x35dbf3={},_0x58bc60={'count':0x0,'rows':[]};var _0x422ac6=_['map'](db[_0x197c('0x2c')][_0x197c('0x2d')],function(_0x2ace33){return{'name':_0x2ace33[_0x197c('0x2e')],'type':_0x2ace33[_0x197c('0x2f')][_0x197c('0x30')]};});_0x35dbf3[_0x197c('0x31')]=_[_0x197c('0x32')](_0x422ac6,_0x197c('0x2b'));_0x35dbf3['query']=_['keys'](_0x5f7425[_0x197c('0x33')]);_0x35dbf3[_0x197c('0x34')]=_[_0x197c('0x35')](_0x35dbf3[_0x197c('0x31')],_0x35dbf3[_0x197c('0x33')]);_0x252cde[_0x197c('0x36')]=_[_0x197c('0x35')](_0x35dbf3['model'],qs['fields'](_0x5f7425[_0x197c('0x33')][_0x197c('0x37')]));_0x252cde['attributes']=_0x252cde['attributes'][_0x197c('0x38')]?_0x252cde[_0x197c('0x36')]:_0x35dbf3[_0x197c('0x31')];if(!_0x5f7425[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x252cde[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x5f7425[_0x197c('0x33')]['limit']);_0x252cde[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x5f7425[_0x197c('0x33')][_0x197c('0x19')]);}_0x252cde[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x5f7425['query'][_0x197c('0x3c')]);_0x252cde[_0x197c('0x3d')]=qs[_0x197c('0x34')](_['pick'](_0x5f7425[_0x197c('0x33')],_0x35dbf3[_0x197c('0x34')]),_0x422ac6);if(_0x5f7425[_0x197c('0x33')][_0x197c('0x3e')]){_0x252cde[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x252cde[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x422ac6,function(_0x323a14){if(_0x323a14[_0x197c('0x2f')]!=='VIRTUAL'){var _0x2705f5={};_0x2705f5[_0x323a14[_0x197c('0x2b')]]={'$like':'%'+_0x5f7425['query']['filter']+'%'};return _0x2705f5;}})});}_0x252cde=_[_0x197c('0x3f')]({},_0x252cde,_0x5f7425[_0x197c('0x40')]);var _0x3517a6={'where':_0x252cde[_0x197c('0x3d')]};return db[_0x197c('0x2c')]['count'](_0x3517a6)[_0x197c('0x24')](function(_0x3efae){_0x58bc60[_0x197c('0x1c')]=_0x3efae;if(_0x5f7425[_0x197c('0x33')][_0x197c('0x41')]){_0x252cde['include']=[{'all':!![]}];}return db[_0x197c('0x2c')][_0x197c('0x42')](_0x252cde);})[_0x197c('0x24')](function(_0x197b27){_0x58bc60[_0x197c('0x43')]=_0x197b27;return _0x58bc60;})['then'](respondWithFilteredResult(_0x4c9256,_0x252cde))[_0x197c('0x44')](handleError(_0x4c9256,null));};exports[_0x197c('0x45')]=function(_0x3b7fc1,_0x35f36d){var _0x3e6d6e={'raw':!![],'where':{'id':_0x3b7fc1[_0x197c('0x46')]['id']}},_0x41eb51={};_0x41eb51[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x2c')][_0x197c('0x2d')]);_0x41eb51['query']=_['keys'](_0x3b7fc1['query']);_0x41eb51['filters']=_[_0x197c('0x35')](_0x41eb51[_0x197c('0x31')],_0x41eb51['query']);_0x3e6d6e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x41eb51['model'],qs[_0x197c('0x37')](_0x3b7fc1[_0x197c('0x33')]['fields']));_0x3e6d6e[_0x197c('0x36')]=_0x3e6d6e[_0x197c('0x36')]['length']?_0x3e6d6e[_0x197c('0x36')]:_0x41eb51[_0x197c('0x31')];if(_0x3b7fc1[_0x197c('0x33')]['includeAll']){_0x3e6d6e[_0x197c('0x48')]=[{'all':!![]}];}_0x3e6d6e=_[_0x197c('0x3f')]({},_0x3e6d6e,_0x3b7fc1[_0x197c('0x40')]);return db[_0x197c('0x2c')]['find'](_0x3e6d6e)[_0x197c('0x24')](handleEntityNotFound(_0x35f36d,null))[_0x197c('0x24')](respondWithResult(_0x35f36d,null))[_0x197c('0x44')](handleError(_0x35f36d,null));};exports['create']=function(_0x5994bf,_0x3a5089){return db[_0x197c('0x2c')][_0x197c('0x49')](_0x5994bf[_0x197c('0x4a')],{})[_0x197c('0x24')](function(_0x28fac4){var _0x4c82d5=_0x5994bf[_0x197c('0x4b')]['get']({'plain':!![]});if(!_0x4c82d5)throw new Error(_0x197c('0x4c'));if(_0x4c82d5[_0x197c('0x4d')]===_0x197c('0x4b')){var _0x9e8c6a=_0x28fac4[_0x197c('0x26')]({'plain':!![]});var _0x2ab21f=_0x197c('0x27');return db[_0x197c('0x4e')]['find']({'where':{'name':_0x2ab21f,'userProfileId':_0x4c82d5[_0x197c('0x4f')]},'raw':!![]})[_0x197c('0x24')](function(_0x43e9b7){if(_0x43e9b7&&_0x43e9b7['autoAssociation']===0x0){return db[_0x197c('0x50')]['create']({'name':_0x9e8c6a[_0x197c('0x2b')],'resourceId':_0x9e8c6a['id'],'type':_0x43e9b7[_0x197c('0x2b')],'sectionId':_0x43e9b7['id']},{})[_0x197c('0x24')](function(){return _0x28fac4;});}else{return _0x28fac4;}})[_0x197c('0x44')](function(_0x1d7cdd){logger[_0x197c('0x29')](_0x197c('0x51'),_0x1d7cdd);throw _0x1d7cdd;});}return _0x28fac4;})[_0x197c('0x24')](respondWithResult(_0x3a5089,0xc9))['catch'](handleError(_0x3a5089,null));};exports[_0x197c('0x23')]=function(_0x3a9261,_0x275294){if(_0x3a9261['body']['id']){delete _0x3a9261[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2c')][_0x197c('0x52')]({'where':{'id':_0x3a9261[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x275294,null))['then'](saveUpdates(_0x3a9261['body'],null))[_0x197c('0x24')](respondWithResult(_0x275294,null))[_0x197c('0x44')](handleError(_0x275294,null));};exports[_0x197c('0x25')]=function(_0x42a13f,_0x15e50f){return db['VoiceMail']['find']({'where':{'id':_0x42a13f[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x15e50f,null))['then'](removeEntity(_0x15e50f,null))[_0x197c('0x44')](handleError(_0x15e50f,null));};exports[_0x197c('0x53')]=function(_0x1a607c,_0x40867c,_0xc10419){return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x1a607c[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x40867c,null))['then'](function(_0x480cab){var _0x1b71cf;var _0x5a70dd={},_0xfc9461={};_0xfc9461[_0x197c('0x31')]=_[_0x197c('0x47')](db['VoiceMailMessage'][_0x197c('0x2d')]);_0xfc9461[_0x197c('0x33')]=_['keys'](_0x1a607c[_0x197c('0x33')]);_0xfc9461[_0x197c('0x34')]=_[_0x197c('0x35')](_0xfc9461['model'],_0xfc9461[_0x197c('0x33')]);_0x5a70dd[_0x197c('0x36')]=_['intersection'](_0xfc9461['model'],qs[_0x197c('0x37')](_0x1a607c[_0x197c('0x33')][_0x197c('0x37')]));_0x5a70dd['attributes']=_0x5a70dd[_0x197c('0x36')][_0x197c('0x38')]?_0x5a70dd[_0x197c('0x36')]:_0xfc9461['model'];if(!_0x1a607c[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x5a70dd[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x1a607c[_0x197c('0x33')][_0x197c('0x1b')]);_0x5a70dd[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x1a607c[_0x197c('0x33')]['offset']);}_0x5a70dd[_0x197c('0x3b')]=qs['sort'](_0x1a607c['query']['sort']);_0x5a70dd['where']=qs[_0x197c('0x34')](_[_0x197c('0x54')](_0x1a607c[_0x197c('0x33')],_0xfc9461[_0x197c('0x34')]));if(_0x1a607c['query'][_0x197c('0x3e')]){_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd['where'],{'$or':_[_0x197c('0x32')](_0x5a70dd['attributes'],function(_0x12d31a){var _0x1f6c6f={};_0x1f6c6f[_0x12d31a]={'$like':'%'+_0x1a607c[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x1f6c6f;})});}_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd[_0x197c('0x3d')],{'mailboxuser':_0x480cab[_0x197c('0x55')]});_0x5a70dd=_['merge']({},_0x5a70dd,_0x1a607c[_0x197c('0x40')]);return db[_0x197c('0x56')][_0x197c('0x57')](_0x5a70dd)[_0x197c('0x24')](respondWithFilteredResult(_0x40867c,_0x5a70dd));})[_0x197c('0x44')](handleError(_0x40867c,null));}; \ No newline at end of file +var _0xb9a7=['model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','body','findOne','VoiceMailMessage','rawAttributes','nolimit','findAndCountAll','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type'];(function(_0x496098,_0x61dcdb){var _0x49c4d9=function(_0x421682){while(--_0x421682){_0x496098['push'](_0x496098['shift']());}};_0x49c4d9(++_0x61dcdb);}(_0xb9a7,0x112));var _0x7b9a=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xb9a7[_0x36884e];return _0x1cc367;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){var _0x5b2f52=_0x269c07[_0x7b9a('0x20')]({'plain':!![]});var _0x23219e='Voicemails';return db[_0x7b9a('0x21')]['destroy']({'where':{'type':_0x23219e,'resourceId':_0x5b2f52['id']}})[_0x7b9a('0x1e')](function(){return _0x269c07;});})[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d886,_0x55301c){return function(_0x54df8a){if(!_0x54df8a){_0x24d886[_0x7b9a('0x22')](0x194);}return _0x54df8a;};}function handleError(_0x58fec8,_0x5be740){_0x5be740=_0x5be740||0x1f4;return function(_0x3847b4){logger['error'](_0x3847b4[_0x7b9a('0x23')]);if(_0x3847b4[_0x7b9a('0x24')]){delete _0x3847b4['name'];}_0x58fec8[_0x7b9a('0x14')](_0x5be740)[_0x7b9a('0x25')](_0x3847b4);};}exports[_0x7b9a('0x26')]=function(_0x5b64d7,_0x45ccf5){var _0x2ce78b={},_0x181e9c={},_0x6c8b1f={'count':0x0,'rows':[]};var _0x5028e7=_[_0x7b9a('0x27')](db['VoiceMail']['rawAttributes'],function(_0x2d278e){return{'name':_0x2d278e[_0x7b9a('0x28')],'type':_0x2d278e[_0x7b9a('0x29')]['key']};});_0x181e9c[_0x7b9a('0x2a')]=_[_0x7b9a('0x27')](_0x5028e7,'name');_0x181e9c['query']=_[_0x7b9a('0x2b')](_0x5b64d7[_0x7b9a('0x2c')]);_0x181e9c['filters']=_[_0x7b9a('0x2d')](_0x181e9c[_0x7b9a('0x2a')],_0x181e9c[_0x7b9a('0x2c')]);_0x2ce78b[_0x7b9a('0x2e')]=_[_0x7b9a('0x2d')](_0x181e9c['model'],qs[_0x7b9a('0x2f')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x2ce78b[_0x7b9a('0x2e')]=_0x2ce78b[_0x7b9a('0x2e')][_0x7b9a('0x30')]?_0x2ce78b['attributes']:_0x181e9c['model'];if(!_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x31')]('nolimit')){_0x2ce78b[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x5b64d7[_0x7b9a('0x2c')]['limit']);_0x2ce78b[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x5b64d7['query']['offset']);}_0x2ce78b[_0x7b9a('0x32')]=qs[_0x7b9a('0x33')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x33')]);_0x2ce78b[_0x7b9a('0x34')]=qs[_0x7b9a('0x35')](_[_0x7b9a('0x36')](_0x5b64d7[_0x7b9a('0x2c')],_0x181e9c['filters']),_0x5028e7);if(_0x5b64d7[_0x7b9a('0x2c')]['filter']){_0x2ce78b[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x2ce78b[_0x7b9a('0x34')],{'$or':_[_0x7b9a('0x27')](_0x5028e7,function(_0x3fa4cd){if(_0x3fa4cd[_0x7b9a('0x29')]!=='VIRTUAL'){var _0x34eebe={};_0x34eebe[_0x3fa4cd[_0x7b9a('0x24')]]={'$like':'%'+_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x38')]+'%'};return _0x34eebe;}})});}_0x2ce78b=_['merge']({},_0x2ce78b,_0x5b64d7[_0x7b9a('0x39')]);var _0xf86939={'where':_0x2ce78b[_0x7b9a('0x34')]};return db[_0x7b9a('0x3a')]['count'](_0xf86939)[_0x7b9a('0x1e')](function(_0x53d89a){_0x6c8b1f[_0x7b9a('0x19')]=_0x53d89a;if(_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x3b')]){_0x2ce78b[_0x7b9a('0x3c')]=[{'all':!![]}];}return db[_0x7b9a('0x3a')][_0x7b9a('0x3d')](_0x2ce78b);})['then'](function(_0x33edc6){_0x6c8b1f[_0x7b9a('0x3e')]=_0x33edc6;return _0x6c8b1f;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x45ccf5,_0x2ce78b))['catch'](handleError(_0x45ccf5,null));};exports['show']=function(_0x3724fe,_0x454b35){var _0x995d59={'raw':!![],'where':{'id':_0x3724fe[_0x7b9a('0x3f')]['id']}},_0x5cd3dd={};_0x5cd3dd[_0x7b9a('0x2a')]=_['keys'](db['VoiceMail']['rawAttributes']);_0x5cd3dd[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x3724fe['query']);_0x5cd3dd[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0x5cd3dd[_0x7b9a('0x2a')],_0x5cd3dd['query']);_0x995d59[_0x7b9a('0x2e')]=_['intersection'](_0x5cd3dd[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x3724fe[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x995d59[_0x7b9a('0x2e')]=_0x995d59['attributes'][_0x7b9a('0x30')]?_0x995d59['attributes']:_0x5cd3dd[_0x7b9a('0x2a')];if(_0x3724fe['query']['includeAll']){_0x995d59[_0x7b9a('0x3c')]=[{'all':!![]}];}_0x995d59=_[_0x7b9a('0x37')]({},_0x995d59,_0x3724fe[_0x7b9a('0x39')]);return db[_0x7b9a('0x3a')][_0x7b9a('0x40')](_0x995d59)[_0x7b9a('0x1e')](handleEntityNotFound(_0x454b35,null))[_0x7b9a('0x1e')](respondWithResult(_0x454b35,null))[_0x7b9a('0x41')](handleError(_0x454b35,null));};exports[_0x7b9a('0x42')]=function(_0x5088c7,_0x1d7957){return db[_0x7b9a('0x3a')]['create'](_0x5088c7['body'],{})['then'](function(_0x1b3e65){var _0x30296e=_0x5088c7[_0x7b9a('0x43')][_0x7b9a('0x20')]({'plain':!![]});if(!_0x30296e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30296e[_0x7b9a('0x44')]===_0x7b9a('0x43')){var _0x287dea=_0x1b3e65[_0x7b9a('0x20')]({'plain':!![]});var _0x2d083b='Voicemails';return db[_0x7b9a('0x45')]['find']({'where':{'name':_0x2d083b,'userProfileId':_0x30296e[_0x7b9a('0x46')]},'raw':!![]})[_0x7b9a('0x1e')](function(_0x239146){if(_0x239146&&_0x239146[_0x7b9a('0x47')]===0x0){return db['UserProfileResource'][_0x7b9a('0x42')]({'name':_0x287dea[_0x7b9a('0x24')],'resourceId':_0x287dea['id'],'type':_0x239146[_0x7b9a('0x24')],'sectionId':_0x239146['id']},{})[_0x7b9a('0x1e')](function(){return _0x1b3e65;});}else{return _0x1b3e65;}})[_0x7b9a('0x41')](function(_0x3e2f1b){logger[_0x7b9a('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e2f1b);throw _0x3e2f1b;});}return _0x1b3e65;})['then'](respondWithResult(_0x1d7957,0xc9))['catch'](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1d')]=function(_0x2f8929,_0x5a1b7d){if(_0x2f8929['body']['id']){delete _0x2f8929['body']['id'];}return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x2f8929[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x5a1b7d,null))[_0x7b9a('0x1e')](saveUpdates(_0x2f8929[_0x7b9a('0x49')],null))[_0x7b9a('0x1e')](respondWithResult(_0x5a1b7d,null))[_0x7b9a('0x41')](handleError(_0x5a1b7d,null));};exports[_0x7b9a('0x1f')]=function(_0x5dc17e,_0x1f99f5){return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x5dc17e[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1f99f5,null))[_0x7b9a('0x1e')](removeEntity(_0x1f99f5,null))[_0x7b9a('0x41')](handleError(_0x1f99f5,null));};exports['getMessages']=function(_0x25ec82,_0x491804,_0x3d2df4){return db[_0x7b9a('0x3a')][_0x7b9a('0x4a')]({'where':{'id':_0x25ec82['params']['id']}})['then'](handleEntityNotFound(_0x491804,null))['then'](function(_0x4f6843){var _0x33375c;var _0x8a777f={},_0xb91099={};_0xb91099['model']=_[_0x7b9a('0x2b')](db[_0x7b9a('0x4b')][_0x7b9a('0x4c')]);_0xb91099[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x25ec82['query']);_0xb91099[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0xb91099[_0x7b9a('0x2a')],_0xb91099['query']);_0x8a777f['attributes']=_['intersection'](_0xb91099[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x25ec82[_0x7b9a('0x2c')]['fields']));_0x8a777f[_0x7b9a('0x2e')]=_0x8a777f[_0x7b9a('0x2e')]['length']?_0x8a777f[_0x7b9a('0x2e')]:_0xb91099['model'];if(!_0x25ec82[_0x7b9a('0x2c')]['hasOwnProperty'](_0x7b9a('0x4d'))){_0x8a777f[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x25ec82[_0x7b9a('0x2c')]['limit']);_0x8a777f[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x25ec82[_0x7b9a('0x2c')][_0x7b9a('0x17')]);}_0x8a777f['order']=qs[_0x7b9a('0x33')](_0x25ec82['query'][_0x7b9a('0x33')]);_0x8a777f['where']=qs[_0x7b9a('0x35')](_['pick'](_0x25ec82['query'],_0xb91099['filters']));if(_0x25ec82['query'][_0x7b9a('0x38')]){_0x8a777f[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'$or':_['map'](_0x8a777f[_0x7b9a('0x2e')],function(_0x4b9462){var _0x50b6f1={};_0x50b6f1[_0x4b9462]={'$like':'%'+_0x25ec82[_0x7b9a('0x2c')]['filter']+'%'};return _0x50b6f1;})});}_0x8a777f['where']=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'mailboxuser':_0x4f6843['mailbox']});_0x8a777f=_[_0x7b9a('0x37')]({},_0x8a777f,_0x25ec82['options']);return db[_0x7b9a('0x4b')][_0x7b9a('0x4e')](_0x8a777f)[_0x7b9a('0x1e')](respondWithFilteredResult(_0x491804,_0x8a777f));})['catch'](handleError(_0x491804,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index e0c9aa9..f9795d3 100644 --- a/server/api/voiceMail/voiceMail.model.js +++ b/server/api/voiceMail/voiceMail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ce5=['voice_voicemail','mailbox_context','mailbox','context','lodash','moment','request-promise','../../config/environment','define','VoiceMail'];(function(_0x53e9ed,_0x1282e5){var _0x54990a=function(_0x4a4db4){while(--_0x4a4db4){_0x53e9ed['push'](_0x53e9ed['shift']());}};_0x54990a(++_0x1282e5);}(_0x4ce5,0x112));var _0x54ce=function(_0x210e63,_0x21dc13){_0x210e63=_0x210e63-0x0;var _0x56c250=_0x4ce5[_0x210e63];return _0x56c250;};'use strict';var _=require(_0x54ce('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x54ce('0x1'));var BPromise=require('bluebird');var rp=require(_0x54ce('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x54ce('0x3'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x318152,_0x18457e){return _0x318152[_0x54ce('0x4')](_0x54ce('0x5'),attributes,{'tableName':_0x54ce('0x6'),'paranoid':![],'indexes':[{'name':_0x54ce('0x7'),'fields':[_0x54ce('0x8'),_0x54ce('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc31b=['mailbox_context','mailbox','context','util','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail'];(function(_0x4aa2ec,_0x3d552a){var _0x534708=function(_0x4255da){while(--_0x4255da){_0x4aa2ec['push'](_0x4aa2ec['shift']());}};_0x534708(++_0x3d552a);}(_0xc31b,0x1d7));var _0xbc31=function(_0x6c2295,_0x4cb31e){_0x6c2295=_0x6c2295-0x0;var _0x21554a=_0xc31b[_0x6c2295];return _0x21554a;};'use strict';var _=require('lodash');var util=require(_0xbc31('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc31('0x1'));var rimraf=require(_0xbc31('0x2'));var config=require(_0xbc31('0x3'));var attributes=require(_0xbc31('0x4'));module[_0xbc31('0x5')]=function(_0x263b8e,_0x3e85e2){return _0x263b8e[_0xbc31('0x6')](_0xbc31('0x7'),attributes,{'tableName':_0xbc31('0x8'),'paranoid':![],'indexes':[{'name':_0xbc31('0x9'),'fields':[_0xbc31('0xa'),_0xbc31('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 3656c52..0779899 100644 --- a/server/api/voiceMail/voiceMail.rpc.js +++ b/server/api/voiceMail/voiceMail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bb0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0x8bb0,0xf7));var _0x08bb=function(_0x1f03ef,_0x5bb5bd){_0x1f03ef=_0x1f03ef-0x0;var _0x190609=_0x8bb0[_0x1f03ef];return _0x190609;};'use strict';var _=require(_0x08bb('0x0'));var util=require(_0x08bb('0x1'));var moment=require(_0x08bb('0x2'));var BPromise=require(_0x08bb('0x3'));var rs=require(_0x08bb('0x4'));var fs=require('fs');var Redis=require(_0x08bb('0x5'));var db=require(_0x08bb('0x6'))['db'];var utils=require(_0x08bb('0x7'));var logger=require(_0x08bb('0x8'))(_0x08bb('0x9'));var config=require(_0x08bb('0xa'));var jayson=require(_0x08bb('0xb'));var client=jayson[_0x08bb('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x512c1a,_0x9b0ef0,_0x2a6828){return new BPromise(function(_0x16e19d,_0x1fd8d7){return client['request'](_0x512c1a,_0x2a6828)[_0x08bb('0xd')](function(_0x3f1e77){logger[_0x08bb('0xe')]('VoiceMail,\x20%s,\x20%s',_0x9b0ef0,_0x08bb('0xf'));logger[_0x08bb('0x10')](_0x08bb('0x11'),_0x9b0ef0,_0x08bb('0xf'),JSON[_0x08bb('0x12')](_0x3f1e77));if(_0x3f1e77['error']){if(_0x3f1e77[_0x08bb('0x13')][_0x08bb('0x14')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x9b0ef0,_0x3f1e77[_0x08bb('0x13')][_0x08bb('0x15')]);return _0x1fd8d7(_0x3f1e77['error'][_0x08bb('0x15')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x9b0ef0,_0x3f1e77['error']['message']);return _0x16e19d(_0x3f1e77[_0x08bb('0x13')][_0x08bb('0x15')]);}else{logger['info'](_0x08bb('0x16'),_0x9b0ef0,'request\x20sent');_0x16e19d(_0x3f1e77[_0x08bb('0x17')][_0x08bb('0x15')]);}})[_0x08bb('0x18')](function(_0x31fd47){logger[_0x08bb('0x13')](_0x08bb('0x16'),_0x9b0ef0,_0x31fd47);_0x1fd8d7(_0x31fd47);});});} \ No newline at end of file +var _0x6a2e=['then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x25701b,_0x2a6976){var _0x3a8a2c=function(_0x1a5e78){while(--_0x1a5e78){_0x25701b['push'](_0x25701b['shift']());}};_0x3a8a2c(++_0x2a6976);}(_0x6a2e,0x1bc));var _0xe6a2=function(_0x109dbb,_0xb36e2){_0x109dbb=_0x109dbb-0x0;var _0x45dd51=_0x6a2e[_0x109dbb];return _0x45dd51;};'use strict';var _=require(_0xe6a2('0x0'));var util=require(_0xe6a2('0x1'));var moment=require(_0xe6a2('0x2'));var BPromise=require(_0xe6a2('0x3'));var rs=require(_0xe6a2('0x4'));var fs=require('fs');var Redis=require(_0xe6a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe6a2('0x6'));var logger=require('../../config/logger')(_0xe6a2('0x7'));var config=require(_0xe6a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe6a2('0x9')][_0xe6a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18959c,_0x22311f,_0x123ef1){return new BPromise(function(_0x4730ce,_0x578813){return client[_0xe6a2('0xb')](_0x18959c,_0x123ef1)[_0xe6a2('0xc')](function(_0xa4d0b3){logger[_0xe6a2('0xd')](_0xe6a2('0xe'),_0x22311f,_0xe6a2('0xf'));logger[_0xe6a2('0x10')](_0xe6a2('0x11'),_0x22311f,_0xe6a2('0xf'),JSON[_0xe6a2('0x12')](_0xa4d0b3));if(_0xa4d0b3[_0xe6a2('0x13')]){if(_0xa4d0b3[_0xe6a2('0x13')][_0xe6a2('0x14')]===0x1f4){logger[_0xe6a2('0x13')](_0xe6a2('0xe'),_0x22311f,_0xa4d0b3[_0xe6a2('0x13')][_0xe6a2('0x15')]);return _0x578813(_0xa4d0b3[_0xe6a2('0x13')]['message']);}logger[_0xe6a2('0x13')]('VoiceMail,\x20%s,\x20%s',_0x22311f,_0xa4d0b3[_0xe6a2('0x13')][_0xe6a2('0x15')]);return _0x4730ce(_0xa4d0b3[_0xe6a2('0x13')][_0xe6a2('0x15')]);}else{logger['info'](_0xe6a2('0xe'),_0x22311f,_0xe6a2('0xf'));_0x4730ce(_0xa4d0b3[_0xe6a2('0x16')][_0xe6a2('0x15')]);}})[_0xe6a2('0x17')](function(_0x37d052){logger['error'](_0xe6a2('0xe'),_0x22311f,_0x37d052);_0x578813(_0x37d052);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 645f715..8591304 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e4d=['isAuthenticated','index','show','download','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','../../config/environment','get'];(function(_0x585829,_0x81f0f0){var _0x3c1c02=function(_0x13a675){while(--_0x13a675){_0x585829['push'](_0x585829['shift']());}};_0x3c1c02(++_0x81f0f0);}(_0x1e4d,0x11a));var _0xd1e4=function(_0x41c29d,_0x8ff066){_0x41c29d=_0x41c29d-0x0;var _0x419d7d=_0x1e4d[_0x41c29d];return _0x419d7d;};'use strict';var multer=require(_0xd1e4('0x0'));var util=require(_0xd1e4('0x1'));var path=require(_0xd1e4('0x2'));var timeout=require(_0xd1e4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1e4('0x4'));var controller=require('./voiceMailMessage.controller');router[_0xd1e4('0x5')]('/',auth[_0xd1e4('0x6')](),controller[_0xd1e4('0x7')]);router[_0xd1e4('0x5')]('/:id',auth[_0xd1e4('0x6')](),controller[_0xd1e4('0x8')]);router[_0xd1e4('0x5')]('/:id/download',auth['isAuthenticated'](),controller[_0xd1e4('0x9')]);router[_0xd1e4('0xa')]('/',auth[_0xd1e4('0x6')](),controller['create']);router[_0xd1e4('0xb')](_0xd1e4('0xc'),auth[_0xd1e4('0x6')](),controller[_0xd1e4('0xd')]);router['delete'](_0xd1e4('0xc'),auth[_0xd1e4('0x6')](),controller[_0xd1e4('0xe')]);module[_0xd1e4('0xf')]=router; \ No newline at end of file +var _0xc114=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','/:id','show','get','/:id/download','download','post','create','put','delete','destroy','exports','util'];(function(_0x2bcb84,_0x1eb577){var _0x238617=function(_0x3e8370){while(--_0x3e8370){_0x2bcb84['push'](_0x2bcb84['shift']());}};_0x238617(++_0x1eb577);}(_0xc114,0x12a));var _0x4c11=function(_0x96d5ff,_0x58f4d8){_0x96d5ff=_0x96d5ff-0x0;var _0x118b75=_0xc114[_0x96d5ff];return _0x118b75;};'use strict';var multer=require('multer');var util=require(_0x4c11('0x0'));var path=require(_0x4c11('0x1'));var timeout=require(_0x4c11('0x2'));var express=require(_0x4c11('0x3'));var router=express[_0x4c11('0x4')]();var fs_extra=require(_0x4c11('0x5'));var auth=require(_0x4c11('0x6'));var interaction=require(_0x4c11('0x7'));var config=require(_0x4c11('0x8'));var controller=require(_0x4c11('0x9'));router['get']('/',auth[_0x4c11('0xa')](),controller[_0x4c11('0xb')]);router['get'](_0x4c11('0xc'),auth['isAuthenticated'](),controller[_0x4c11('0xd')]);router[_0x4c11('0xe')](_0x4c11('0xf'),auth['isAuthenticated'](),controller[_0x4c11('0x10')]);router[_0x4c11('0x11')]('/',auth[_0x4c11('0xa')](),controller[_0x4c11('0x12')]);router[_0x4c11('0x13')](_0x4c11('0xc'),auth[_0x4c11('0xa')](),controller['update']);router[_0x4c11('0x14')](_0x4c11('0xc'),auth[_0x4c11('0xa')](),controller[_0x4c11('0x15')]);module[_0x4c11('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f98bac0..473eabc 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.attributes.js +++ b/server/api/voiceMailMessage/voiceMailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40b0=['long','TIMESTAMP','literal','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0x40b0,0x1e9));var _0x040b=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0x40b0[_0x336264];return _0x53cf91;};'use strict';var Sequelize=require(_0x040b('0x0'));module['exports']={'name':{'type':Sequelize[_0x040b('0x1')],'get':function(_0x543717){return this[_0x040b('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x040b('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x040b('0x5')](_0x040b('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'stamp':{'type':_0x040b('0x7'),'defaultValue':Sequelize[_0x040b('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x8581=['long','TIMESTAMP','literal','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x45e2a7,_0x4e8fa4){var _0x1cc813=function(_0x1d3fa4){while(--_0x1d3fa4){_0x45e2a7['push'](_0x45e2a7['shift']());}};_0x1cc813(++_0x4e8fa4);}(_0x8581,0x9b));var _0x1858=function(_0x50798b,_0x22ccf8){_0x50798b=_0x50798b-0x0;var _0x4b1d26=_0x8581[_0x50798b];return _0x4b1d26;};'use strict';var Sequelize=require('sequelize');module[_0x1858('0x0')]={'name':{'type':Sequelize[_0x1858('0x1')],'get':function(_0x3584bc){return this[_0x1858('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x1858('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1858('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x1858('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1858('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1858('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1858('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1858('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x1858('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x1858('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1858('0x4')],'defaultValue':''},'stamp':{'type':_0x1858('0x6'),'defaultValue':Sequelize[_0x1858('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b5b062b..5bf1d2a 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.controller.js +++ b/server/api/voiceMailMessage/voiceMailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fb6=['name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','msg_id','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','json','apply','reject','save','update','then','destroy','error'];(function(_0x1ee5ef,_0x38d42b){var _0x448ab8=function(_0x508932){while(--_0x508932){_0x1ee5ef['push'](_0x1ee5ef['shift']());}};_0x448ab8(++_0x38d42b);}(_0x8fb6,0x127));var _0x68fb=function(_0x512fa9,_0x368a57){_0x512fa9=_0x512fa9-0x0;var _0x506d9f=_0x8fb6[_0x512fa9];return _0x506d9f;};'use strict';var emlformat=require(_0x68fb('0x0'));var rimraf=require(_0x68fb('0x1'));var zipdir=require(_0x68fb('0x2'));var jsonpatch=require(_0x68fb('0x3'));var rp=require(_0x68fb('0x4'));var moment=require(_0x68fb('0x5'));var BPromise=require(_0x68fb('0x6'));var Mustache=require(_0x68fb('0x7'));var util=require(_0x68fb('0x8'));var path=require('path');var sox=require(_0x68fb('0x9'));var csv=require(_0x68fb('0xa'));var ejs=require(_0x68fb('0xb'));var fs=require('fs');var fs_extra=require(_0x68fb('0xc'));var _=require(_0x68fb('0xd'));var squel=require('squel');var crypto=require(_0x68fb('0xe'));var jsforce=require(_0x68fb('0xf'));var deskjs=require(_0x68fb('0x10'));var toCsv=require(_0x68fb('0xa'));var querystring=require('querystring');var Papa=require(_0x68fb('0x11'));var Redis=require(_0x68fb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x68fb('0x13'));var as=require(_0x68fb('0x14'));var hardwareService=require(_0x68fb('0x15'));var logger=require(_0x68fb('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x68fb('0x17'));var db=require(_0x68fb('0x18'))['db'];function respondWithStatusCode(_0x2fe9cb,_0x3adcba){_0x3adcba=_0x3adcba||0xcc;return function(_0x178a65){if(_0x178a65){return _0x2fe9cb[_0x68fb('0x19')](_0x3adcba);}return _0x2fe9cb[_0x68fb('0x1a')](_0x3adcba)[_0x68fb('0x1b')]();};}function respondWithResult(_0x440001,_0x511194){_0x511194=_0x511194||0xc8;return function(_0x33a3cd){if(_0x33a3cd){return _0x440001[_0x68fb('0x1a')](_0x511194)['json'](_0x33a3cd);}};}function respondWithFilteredResult(_0x2e29e2,_0x3fc8a7){return function(_0x517ef3){if(_0x517ef3){var _0x523775=typeof _0x3fc8a7['offset']===_0x68fb('0x1c')&&typeof _0x3fc8a7['limit']===_0x68fb('0x1c');var _0x10d0ec=_0x517ef3['count'];var _0x4aad20=_0x523775?0x0:_0x3fc8a7[_0x68fb('0x1d')];var _0x55e1a6=_0x523775?_0x517ef3[_0x68fb('0x1e')]:_0x3fc8a7[_0x68fb('0x1d')]+_0x3fc8a7[_0x68fb('0x1f')];var _0x24d479;if(_0x55e1a6>=_0x10d0ec){_0x55e1a6=_0x10d0ec;_0x24d479=0xc8;}else{_0x24d479=0xce;}_0x2e29e2[_0x68fb('0x1a')](_0x24d479);return _0x2e29e2[_0x68fb('0x20')]('Content-Range',_0x4aad20+'-'+_0x55e1a6+'/'+_0x10d0ec)[_0x68fb('0x21')](_0x517ef3);}return null;};}function patchUpdates(_0x4333fd){return function(_0x430bcd){try{jsonpatch[_0x68fb('0x22')](_0x430bcd,_0x4333fd,!![]);}catch(_0x1e79da){return BPromise[_0x68fb('0x23')](_0x1e79da);}return _0x430bcd[_0x68fb('0x24')]();};}function saveUpdates(_0x30ff62,_0x5b3c52){return function(_0x3fd30e){if(_0x3fd30e){return _0x3fd30e[_0x68fb('0x25')](_0x30ff62)[_0x68fb('0x26')](function(_0x362fab){return _0x362fab;});}return null;};}function removeEntity(_0x509b97,_0xb78b27){return function(_0x424250){if(_0x424250){return _0x424250[_0x68fb('0x27')]()[_0x68fb('0x26')](function(){_0x509b97[_0x68fb('0x1a')](0xcc)[_0x68fb('0x1b')]();});}};}function handleEntityNotFound(_0x1f1aab,_0x3cd980){return function(_0x4529ac){if(!_0x4529ac){_0x1f1aab['sendStatus'](0x194);}return _0x4529ac;};}function handleError(_0x130efd,_0x2f339d){_0x2f339d=_0x2f339d||0x1f4;return function(_0x251cbe){logger[_0x68fb('0x28')](_0x251cbe['stack']);if(_0x251cbe[_0x68fb('0x29')]){delete _0x251cbe[_0x68fb('0x29')];}_0x130efd[_0x68fb('0x1a')](_0x2f339d)[_0x68fb('0x2a')](_0x251cbe);};}exports['index']=function(_0x4a57a2,_0x2da606){var _0x52cb2a={},_0x531d22={},_0xadad7b={'count':0x0,'rows':[]};var _0x26cf8a=_[_0x68fb('0x2b')](db[_0x68fb('0x2c')][_0x68fb('0x2d')],function(_0x64ca22){return{'name':_0x64ca22[_0x68fb('0x2e')],'type':_0x64ca22[_0x68fb('0x2f')][_0x68fb('0x30')]};});_0x531d22[_0x68fb('0x31')]=_[_0x68fb('0x32')](_[_0x68fb('0x2b')](_0x26cf8a,_0x68fb('0x29')),['name']);_0x531d22[_0x68fb('0x33')]=_['keys'](_0x4a57a2['query']);_0x531d22[_0x68fb('0x34')]=_[_0x68fb('0x35')](_0x531d22['model'],_0x531d22[_0x68fb('0x33')]);_0x52cb2a[_0x68fb('0x36')]=_[_0x68fb('0x35')](_0x531d22['model'],qs[_0x68fb('0x37')](_0x4a57a2['query'][_0x68fb('0x37')]));_0x52cb2a['attributes']=_0x52cb2a[_0x68fb('0x36')][_0x68fb('0x38')]?_0x52cb2a[_0x68fb('0x36')]:_0x531d22[_0x68fb('0x31')];if(!_0x4a57a2[_0x68fb('0x33')]['hasOwnProperty'](_0x68fb('0x39'))){_0x52cb2a[_0x68fb('0x1f')]=qs[_0x68fb('0x1f')](_0x4a57a2[_0x68fb('0x33')][_0x68fb('0x1f')]);_0x52cb2a[_0x68fb('0x1d')]=qs['offset'](_0x4a57a2[_0x68fb('0x33')][_0x68fb('0x1d')]);}_0x52cb2a['order']=qs[_0x68fb('0x3a')](_0x4a57a2[_0x68fb('0x33')][_0x68fb('0x3a')]);_0x52cb2a['where']=qs[_0x68fb('0x34')](_[_0x68fb('0x3b')](_0x4a57a2[_0x68fb('0x33')],_0x531d22[_0x68fb('0x34')]),_0x26cf8a);if(_0x4a57a2[_0x68fb('0x33')][_0x68fb('0x3c')]){_0x52cb2a['where']=_[_0x68fb('0x3d')](_0x52cb2a[_0x68fb('0x3e')],{'$or':_['map'](_0x26cf8a,function(_0x55b9c3){if(_0x55b9c3['type']!==_0x68fb('0x3f')){var _0x336b77={};_0x336b77[_0x55b9c3[_0x68fb('0x29')]]={'$like':'%'+_0x4a57a2[_0x68fb('0x33')]['filter']+'%'};return _0x336b77;}})});}_0x52cb2a=_['merge']({},_0x52cb2a,_0x4a57a2[_0x68fb('0x40')]);var _0x2109b9={'where':_0x52cb2a[_0x68fb('0x3e')]};return db['VoiceMailMessage'][_0x68fb('0x1e')](_0x2109b9)['then'](function(_0x41ed3a){_0xadad7b['count']=_0x41ed3a;if(_0x4a57a2[_0x68fb('0x33')][_0x68fb('0x41')]){_0x52cb2a['include']=[{'all':!![]}];}return db[_0x68fb('0x2c')][_0x68fb('0x42')](_0x52cb2a);})[_0x68fb('0x26')](function(_0x5a421f){_0xadad7b[_0x68fb('0x43')]=_0x5a421f;return _0xadad7b;})['then'](respondWithFilteredResult(_0x2da606,_0x52cb2a))[_0x68fb('0x44')](handleError(_0x2da606,null));};exports[_0x68fb('0x45')]=function(_0x487a17,_0x3c7501){var _0x267356={'raw':!![],'where':{'id':_0x487a17['params']['id']}},_0x2e6e9f={};_0x2e6e9f[_0x68fb('0x31')]=_['keys'](db['VoiceMailMessage'][_0x68fb('0x2d')]);_0x2e6e9f[_0x68fb('0x33')]=_['keys'](_0x487a17[_0x68fb('0x33')]);_0x2e6e9f['filters']=_[_0x68fb('0x35')](_0x2e6e9f[_0x68fb('0x31')],_0x2e6e9f['query']);_0x267356['attributes']=_[_0x68fb('0x35')](_0x2e6e9f[_0x68fb('0x31')],qs[_0x68fb('0x37')](_0x487a17['query'][_0x68fb('0x37')]));_0x267356[_0x68fb('0x36')]=_0x267356['attributes'][_0x68fb('0x38')]?_0x267356[_0x68fb('0x36')]:_0x2e6e9f[_0x68fb('0x31')];if(_0x487a17['query'][_0x68fb('0x41')]){_0x267356[_0x68fb('0x46')]=[{'all':!![]}];}_0x267356=_[_0x68fb('0x3d')]({},_0x267356,_0x487a17['options']);return db[_0x68fb('0x2c')][_0x68fb('0x47')](_0x267356)[_0x68fb('0x26')](handleEntityNotFound(_0x3c7501,null))[_0x68fb('0x26')](respondWithResult(_0x3c7501,null))['catch'](handleError(_0x3c7501,null));};exports[_0x68fb('0x48')]=function(_0x1870c9,_0x2902b6){return db[_0x68fb('0x2c')][_0x68fb('0x48')](_0x1870c9[_0x68fb('0x49')],{})[_0x68fb('0x26')](respondWithResult(_0x2902b6,0xc9))['catch'](handleError(_0x2902b6,null));};exports[_0x68fb('0x25')]=function(_0x82d9ab,_0x1b863b){if(_0x82d9ab[_0x68fb('0x49')]['id']){delete _0x82d9ab[_0x68fb('0x49')]['id'];}return db[_0x68fb('0x2c')][_0x68fb('0x47')]({'where':{'id':_0x82d9ab[_0x68fb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b863b,null))[_0x68fb('0x26')](saveUpdates(_0x82d9ab[_0x68fb('0x49')],null))[_0x68fb('0x26')](respondWithResult(_0x1b863b,null))[_0x68fb('0x44')](handleError(_0x1b863b,null));};exports[_0x68fb('0x27')]=function(_0x4eec45,_0x1b972d){return db[_0x68fb('0x2c')][_0x68fb('0x47')]({'where':{'id':_0x4eec45['params']['id']}})[_0x68fb('0x26')](handleEntityNotFound(_0x1b972d,null))[_0x68fb('0x26')](removeEntity(_0x1b972d,null))[_0x68fb('0x44')](handleError(_0x1b972d,null));};exports[_0x68fb('0x4b')]=function(_0x4395b0,_0x1c2b6c,_0x42ae65){return db[_0x68fb('0x2c')]['find']({'where':{'id':_0x4395b0[_0x68fb('0x4a')]['id']},'attributes':['id',_0x68fb('0x4c'),'msg_id']})[_0x68fb('0x26')](handleEntityNotFound(_0x1c2b6c,null))[_0x68fb('0x26')](function(_0x21ef7b){if(_0x21ef7b){if(!_0x21ef7b[_0x68fb('0x4c')]){throw new db[(_0x68fb('0x4d'))][(_0x68fb('0x4e'))](_0x68fb('0x4f'));}var _0x58dc13={'Content-Type':_0x68fb('0x50'),'Content-Disposition':_0x68fb('0x51')};if(_0x21ef7b['msg_id']){_0x58dc13[_0x68fb('0x52')]='attachment;\x20filename=\x22'+_0x21ef7b[_0x68fb('0x53')]+'.wav\x22';}_0x1c2b6c['set'](_0x58dc13);return _0x1c2b6c[_0x68fb('0x2a')](new Buffer(_0x21ef7b[_0x68fb('0x4c')]));}})[_0x68fb('0x44')](handleError(_0x1c2b6c,null));}; \ No newline at end of file +var _0x8f58=['sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','includeAll','find','catch','create','body','update','params','download','recording','msg_id','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4e4567,_0x598f1a){var _0x44eef6=function(_0x17f0e7){while(--_0x17f0e7){_0x4e4567['push'](_0x4e4567['shift']());}};_0x44eef6(++_0x598f1a);}(_0x8f58,0x16b));var _0x88f5=function(_0x6ce431,_0x51aa93){_0x6ce431=_0x6ce431-0x0;var _0x118b4a=_0x8f58[_0x6ce431];return _0x118b4a;};'use strict';var emlformat=require(_0x88f5('0x0'));var rimraf=require(_0x88f5('0x1'));var zipdir=require(_0x88f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88f5('0x3'));var moment=require(_0x88f5('0x4'));var BPromise=require(_0x88f5('0x5'));var Mustache=require('mustache');var util=require(_0x88f5('0x6'));var path=require(_0x88f5('0x7'));var sox=require('sox');var csv=require(_0x88f5('0x8'));var ejs=require(_0x88f5('0x9'));var fs=require('fs');var fs_extra=require(_0x88f5('0xa'));var _=require(_0x88f5('0xb'));var squel=require('squel');var crypto=require(_0x88f5('0xc'));var jsforce=require(_0x88f5('0xd'));var deskjs=require(_0x88f5('0xe'));var toCsv=require(_0x88f5('0x8'));var querystring=require(_0x88f5('0xf'));var Papa=require(_0x88f5('0x10'));var Redis=require(_0x88f5('0x11'));var authService=require(_0x88f5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88f5('0x13'));var logger=require(_0x88f5('0x14'))(_0x88f5('0x15'));var utils=require(_0x88f5('0x16'));var config=require(_0x88f5('0x17'));var licenseUtil=require(_0x88f5('0x18'));var db=require(_0x88f5('0x19'))['db'];function respondWithStatusCode(_0x2da2b3,_0x3d8b4b){_0x3d8b4b=_0x3d8b4b||0xcc;return function(_0x3ec253){if(_0x3ec253){return _0x2da2b3[_0x88f5('0x1a')](_0x3d8b4b);}return _0x2da2b3[_0x88f5('0x1b')](_0x3d8b4b)[_0x88f5('0x1c')]();};}function respondWithResult(_0x5a16a4,_0xb55d74){_0xb55d74=_0xb55d74||0xc8;return function(_0x5a5739){if(_0x5a5739){return _0x5a16a4[_0x88f5('0x1b')](_0xb55d74)[_0x88f5('0x1d')](_0x5a5739);}};}function respondWithFilteredResult(_0x2e665f,_0x1643e1){return function(_0x23cc03){if(_0x23cc03){var _0x1b05ae=typeof _0x1643e1[_0x88f5('0x1e')]===_0x88f5('0x1f')&&typeof _0x1643e1[_0x88f5('0x20')]===_0x88f5('0x1f');var _0x2db1b3=_0x23cc03[_0x88f5('0x21')];var _0x5534db=_0x1b05ae?0x0:_0x1643e1[_0x88f5('0x1e')];var _0x5cba52=_0x1b05ae?_0x23cc03[_0x88f5('0x21')]:_0x1643e1['offset']+_0x1643e1[_0x88f5('0x20')];var _0x5141b4;if(_0x5cba52>=_0x2db1b3){_0x5cba52=_0x2db1b3;_0x5141b4=0xc8;}else{_0x5141b4=0xce;}_0x2e665f[_0x88f5('0x1b')](_0x5141b4);return _0x2e665f[_0x88f5('0x22')](_0x88f5('0x23'),_0x5534db+'-'+_0x5cba52+'/'+_0x2db1b3)[_0x88f5('0x1d')](_0x23cc03);}return null;};}function patchUpdates(_0x1fe689){return function(_0x154717){try{jsonpatch[_0x88f5('0x24')](_0x154717,_0x1fe689,!![]);}catch(_0x498847){return BPromise[_0x88f5('0x25')](_0x498847);}return _0x154717[_0x88f5('0x26')]();};}function saveUpdates(_0x326f31,_0x187bdf){return function(_0x308d4d){if(_0x308d4d){return _0x308d4d['update'](_0x326f31)['then'](function(_0x2c27bb){return _0x2c27bb;});}return null;};}function removeEntity(_0x543c0c,_0x3d4309){return function(_0xd8f8f0){if(_0xd8f8f0){return _0xd8f8f0[_0x88f5('0x27')]()[_0x88f5('0x28')](function(){_0x543c0c[_0x88f5('0x1b')](0xcc)[_0x88f5('0x1c')]();});}};}function handleEntityNotFound(_0x51858c,_0x53a050){return function(_0x1d4ba7){if(!_0x1d4ba7){_0x51858c[_0x88f5('0x1a')](0x194);}return _0x1d4ba7;};}function handleError(_0x26e31c,_0x291c6d){_0x291c6d=_0x291c6d||0x1f4;return function(_0xc50880){logger[_0x88f5('0x29')](_0xc50880['stack']);if(_0xc50880['name']){delete _0xc50880[_0x88f5('0x2a')];}_0x26e31c[_0x88f5('0x1b')](_0x291c6d)[_0x88f5('0x2b')](_0xc50880);};}exports[_0x88f5('0x2c')]=function(_0x8c396,_0x26706d){var _0x4e2b39={},_0x53f3b2={},_0x2ab15b={'count':0x0,'rows':[]};var _0x544441=_['map'](db[_0x88f5('0x2d')][_0x88f5('0x2e')],function(_0x2cbb44){return{'name':_0x2cbb44[_0x88f5('0x2f')],'type':_0x2cbb44[_0x88f5('0x30')][_0x88f5('0x31')]};});_0x53f3b2[_0x88f5('0x32')]=_[_0x88f5('0x33')](_[_0x88f5('0x34')](_0x544441,_0x88f5('0x2a')),['name']);_0x53f3b2[_0x88f5('0x35')]=_[_0x88f5('0x36')](_0x8c396['query']);_0x53f3b2[_0x88f5('0x37')]=_[_0x88f5('0x38')](_0x53f3b2[_0x88f5('0x32')],_0x53f3b2[_0x88f5('0x35')]);_0x4e2b39[_0x88f5('0x39')]=_['intersection'](_0x53f3b2['model'],qs[_0x88f5('0x3a')](_0x8c396[_0x88f5('0x35')][_0x88f5('0x3a')]));_0x4e2b39[_0x88f5('0x39')]=_0x4e2b39['attributes'][_0x88f5('0x3b')]?_0x4e2b39[_0x88f5('0x39')]:_0x53f3b2['model'];if(!_0x8c396[_0x88f5('0x35')][_0x88f5('0x3c')](_0x88f5('0x3d'))){_0x4e2b39[_0x88f5('0x20')]=qs[_0x88f5('0x20')](_0x8c396[_0x88f5('0x35')][_0x88f5('0x20')]);_0x4e2b39[_0x88f5('0x1e')]=qs[_0x88f5('0x1e')](_0x8c396[_0x88f5('0x35')][_0x88f5('0x1e')]);}_0x4e2b39['order']=qs[_0x88f5('0x3e')](_0x8c396['query']['sort']);_0x4e2b39[_0x88f5('0x3f')]=qs[_0x88f5('0x37')](_['pick'](_0x8c396[_0x88f5('0x35')],_0x53f3b2['filters']),_0x544441);if(_0x8c396[_0x88f5('0x35')][_0x88f5('0x40')]){_0x4e2b39[_0x88f5('0x3f')]=_['merge'](_0x4e2b39[_0x88f5('0x3f')],{'$or':_[_0x88f5('0x34')](_0x544441,function(_0x40ee9b){if(_0x40ee9b['type']!==_0x88f5('0x41')){var _0x20c3fe={};_0x20c3fe[_0x40ee9b[_0x88f5('0x2a')]]={'$like':'%'+_0x8c396['query'][_0x88f5('0x40')]+'%'};return _0x20c3fe;}})});}_0x4e2b39=_[_0x88f5('0x42')]({},_0x4e2b39,_0x8c396[_0x88f5('0x43')]);var _0x36474c={'where':_0x4e2b39[_0x88f5('0x3f')]};return db[_0x88f5('0x2d')][_0x88f5('0x21')](_0x36474c)[_0x88f5('0x28')](function(_0x4f5faf){_0x2ab15b[_0x88f5('0x21')]=_0x4f5faf;if(_0x8c396[_0x88f5('0x35')]['includeAll']){_0x4e2b39[_0x88f5('0x44')]=[{'all':!![]}];}return db[_0x88f5('0x2d')][_0x88f5('0x45')](_0x4e2b39);})[_0x88f5('0x28')](function(_0x528052){_0x2ab15b[_0x88f5('0x46')]=_0x528052;return _0x2ab15b;})[_0x88f5('0x28')](respondWithFilteredResult(_0x26706d,_0x4e2b39))['catch'](handleError(_0x26706d,null));};exports[_0x88f5('0x47')]=function(_0x255efe,_0x338af2){var _0x567209={'raw':!![],'where':{'id':_0x255efe['params']['id']}},_0x4ab162={};_0x4ab162[_0x88f5('0x32')]=_[_0x88f5('0x36')](db[_0x88f5('0x2d')][_0x88f5('0x2e')]);_0x4ab162[_0x88f5('0x35')]=_[_0x88f5('0x36')](_0x255efe[_0x88f5('0x35')]);_0x4ab162[_0x88f5('0x37')]=_['intersection'](_0x4ab162[_0x88f5('0x32')],_0x4ab162[_0x88f5('0x35')]);_0x567209[_0x88f5('0x39')]=_[_0x88f5('0x38')](_0x4ab162[_0x88f5('0x32')],qs[_0x88f5('0x3a')](_0x255efe[_0x88f5('0x35')]['fields']));_0x567209[_0x88f5('0x39')]=_0x567209[_0x88f5('0x39')][_0x88f5('0x3b')]?_0x567209[_0x88f5('0x39')]:_0x4ab162['model'];if(_0x255efe[_0x88f5('0x35')][_0x88f5('0x48')]){_0x567209[_0x88f5('0x44')]=[{'all':!![]}];}_0x567209=_[_0x88f5('0x42')]({},_0x567209,_0x255efe[_0x88f5('0x43')]);return db[_0x88f5('0x2d')][_0x88f5('0x49')](_0x567209)['then'](handleEntityNotFound(_0x338af2,null))[_0x88f5('0x28')](respondWithResult(_0x338af2,null))[_0x88f5('0x4a')](handleError(_0x338af2,null));};exports[_0x88f5('0x4b')]=function(_0x10ae3c,_0x1a9a38){return db[_0x88f5('0x2d')][_0x88f5('0x4b')](_0x10ae3c[_0x88f5('0x4c')],{})[_0x88f5('0x28')](respondWithResult(_0x1a9a38,0xc9))['catch'](handleError(_0x1a9a38,null));};exports[_0x88f5('0x4d')]=function(_0x279161,_0x164a42){if(_0x279161[_0x88f5('0x4c')]['id']){delete _0x279161[_0x88f5('0x4c')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x279161['params']['id']}})[_0x88f5('0x28')](handleEntityNotFound(_0x164a42,null))['then'](saveUpdates(_0x279161[_0x88f5('0x4c')],null))['then'](respondWithResult(_0x164a42,null))[_0x88f5('0x4a')](handleError(_0x164a42,null));};exports[_0x88f5('0x27')]=function(_0x48eed2,_0x4280af){return db[_0x88f5('0x2d')][_0x88f5('0x49')]({'where':{'id':_0x48eed2[_0x88f5('0x4e')]['id']}})[_0x88f5('0x28')](handleEntityNotFound(_0x4280af,null))[_0x88f5('0x28')](removeEntity(_0x4280af,null))['catch'](handleError(_0x4280af,null));};exports[_0x88f5('0x4f')]=function(_0x254414,_0x30f00a,_0x5db741){return db['VoiceMailMessage'][_0x88f5('0x49')]({'where':{'id':_0x254414[_0x88f5('0x4e')]['id']},'attributes':['id',_0x88f5('0x50'),_0x88f5('0x51')]})[_0x88f5('0x28')](handleEntityNotFound(_0x30f00a,null))[_0x88f5('0x28')](function(_0x260184){if(_0x260184){if(!_0x260184[_0x88f5('0x50')]){throw new db['Sequelize']['ValidationError'](_0x88f5('0x52'));}var _0x4be3fd={'Content-Type':_0x88f5('0x53'),'Content-Disposition':'attachment'};if(_0x260184[_0x88f5('0x51')]){_0x4be3fd[_0x88f5('0x54')]='attachment;\x20filename=\x22'+_0x260184['msg_id']+'.wav\x22';}_0x30f00a[_0x88f5('0x22')](_0x4be3fd);return _0x30f00a['send'](new Buffer(_0x260184[_0x88f5('0x50')]));}})[_0x88f5('0x4a')](handleError(_0x30f00a,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c052bd9..e73a2b6 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.model.js +++ b/server/api/voiceMailMessage/voiceMailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefce=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util'];(function(_0xcdfc4f,_0x8a111a){var _0x3f70d1=function(_0xc0f333){while(--_0xc0f333){_0xcdfc4f['push'](_0xcdfc4f['shift']());}};_0x3f70d1(++_0x8a111a);}(_0xefce,0xdb));var _0xeefc=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0xefce[_0x98db33];return _0x5ae63a;};'use strict';var _=require(_0xeefc('0x0'));var util=require(_0xeefc('0x1'));var logger=require(_0xeefc('0x2'))(_0xeefc('0x3'));var moment=require('moment');var BPromise=require(_0xeefc('0x4'));var rp=require(_0xeefc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeefc('0x6'));var config=require(_0xeefc('0x7'));var attributes=require(_0xeefc('0x8'));module[_0xeefc('0x9')]=function(_0xc01cf9,_0x46f732){return _0xc01cf9[_0xeefc('0xa')](_0xeefc('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xeefc('0xc'),'fields':[_0xeefc('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd74d=['path','rimraf','./voiceMailMessage.attributes','exports','define','dir','lodash','../../config/logger','api','moment'];(function(_0x253bba,_0x14f4ee){var _0x1c83ff=function(_0xe88059){while(--_0xe88059){_0x253bba['push'](_0x253bba['shift']());}};_0x1c83ff(++_0x14f4ee);}(_0xd74d,0x150));var _0xdd74=function(_0x34d65b,_0x3f1602){_0x34d65b=_0x34d65b-0x0;var _0x515338=_0xd74d[_0x34d65b];return _0x515338;};'use strict';var _=require(_0xdd74('0x0'));var util=require('util');var logger=require(_0xdd74('0x1'))(_0xdd74('0x2'));var moment=require(_0xdd74('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd74('0x4'));var rimraf=require(_0xdd74('0x5'));var config=require('../../config/environment');var attributes=require(_0xdd74('0x6'));module[_0xdd74('0x7')]=function(_0x5dc401,_0x51ddd0){return _0x5dc401[_0xdd74('0x8')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xdd74('0x9'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 3396ef0..2db3e6d 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbb4=['debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xcbb4,0x10f));var _0x4cbb=function(_0x3e4f74,_0x26ce71){_0x3e4f74=_0x3e4f74-0x0;var _0xd07d99=_0xcbb4[_0x3e4f74];return _0xd07d99;};'use strict';var _=require(_0x4cbb('0x0'));var util=require(_0x4cbb('0x1'));var moment=require(_0x4cbb('0x2'));var BPromise=require(_0x4cbb('0x3'));var rs=require(_0x4cbb('0x4'));var fs=require('fs');var Redis=require(_0x4cbb('0x5'));var db=require(_0x4cbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4cbb('0x7'))(_0x4cbb('0x8'));var config=require('../../config/environment');var jayson=require(_0x4cbb('0x9'));var client=jayson['client'][_0x4cbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x208157,_0x2c98a5,_0x26d497){return new BPromise(function(_0x584e04,_0x3c80d1){return client['request'](_0x208157,_0x26d497)[_0x4cbb('0xb')](function(_0x355f78){logger[_0x4cbb('0xc')](_0x4cbb('0xd'),_0x2c98a5,_0x4cbb('0xe'));logger[_0x4cbb('0xf')](_0x4cbb('0x10'),_0x2c98a5,'request\x20sent',JSON[_0x4cbb('0x11')](_0x355f78));if(_0x355f78[_0x4cbb('0x12')]){if(_0x355f78[_0x4cbb('0x12')][_0x4cbb('0x13')]===0x1f4){logger['error'](_0x4cbb('0xd'),_0x2c98a5,_0x355f78[_0x4cbb('0x12')][_0x4cbb('0x14')]);return _0x3c80d1(_0x355f78[_0x4cbb('0x12')][_0x4cbb('0x14')]);}logger[_0x4cbb('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x2c98a5,_0x355f78[_0x4cbb('0x12')][_0x4cbb('0x14')]);return _0x584e04(_0x355f78[_0x4cbb('0x12')][_0x4cbb('0x14')]);}else{logger['info'](_0x4cbb('0xd'),_0x2c98a5,'request\x20sent');_0x584e04(_0x355f78[_0x4cbb('0x15')][_0x4cbb('0x14')]);}})['catch'](function(_0x1dca78){logger[_0x4cbb('0x12')](_0x4cbb('0xd'),_0x2c98a5,_0x1dca78);_0x3c80d1(_0x1dca78);});});} \ No newline at end of file +var _0xf759=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x451336,_0x5ad7f1){var _0xe0eba4=function(_0x4bf2de){while(--_0x4bf2de){_0x451336['push'](_0x451336['shift']());}};_0xe0eba4(++_0x5ad7f1);}(_0xf759,0x18e));var _0x9f75=function(_0xe7f80d,_0x8223be){_0xe7f80d=_0xe7f80d-0x0;var _0x2e7171=_0xf759[_0xe7f80d];return _0x2e7171;};'use strict';var _=require(_0x9f75('0x0'));var util=require(_0x9f75('0x1'));var moment=require('moment');var BPromise=require(_0x9f75('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f75('0x3'));var db=require(_0x9f75('0x4'))['db'];var utils=require(_0x9f75('0x5'));var logger=require(_0x9f75('0x6'))(_0x9f75('0x7'));var config=require(_0x9f75('0x8'));var jayson=require(_0x9f75('0x9'));var client=jayson[_0x9f75('0xa')][_0x9f75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fb53f,_0x408995,_0x3e85f0){return new BPromise(function(_0x1d6474,_0x3f0d09){return client[_0x9f75('0xc')](_0x3fb53f,_0x3e85f0)[_0x9f75('0xd')](function(_0x26fc0c){logger[_0x9f75('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x408995,_0x9f75('0xf'));logger[_0x9f75('0x10')](_0x9f75('0x11'),_0x408995,_0x9f75('0xf'),JSON[_0x9f75('0x12')](_0x26fc0c));if(_0x26fc0c[_0x9f75('0x13')]){if(_0x26fc0c[_0x9f75('0x13')][_0x9f75('0x14')]===0x1f4){logger[_0x9f75('0x13')](_0x9f75('0x15'),_0x408995,_0x26fc0c[_0x9f75('0x13')][_0x9f75('0x16')]);return _0x3f0d09(_0x26fc0c['error'][_0x9f75('0x16')]);}logger['error'](_0x9f75('0x15'),_0x408995,_0x26fc0c['error'][_0x9f75('0x16')]);return _0x1d6474(_0x26fc0c[_0x9f75('0x13')]['message']);}else{logger['info'](_0x9f75('0x15'),_0x408995,'request\x20sent');_0x1d6474(_0x26fc0c[_0x9f75('0x17')][_0x9f75('0x16')]);}})[_0x9f75('0x18')](function(_0x259e94){logger['error'](_0x9f75('0x15'),_0x408995,_0x259e94);_0x3f0d09(_0x259e94);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 10de29c..098dbd9 100644 --- a/server/api/voiceMusicOnHold/index.js +++ b/server/api/voiceMusicOnHold/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e7a=['./voiceMusicOnHold.controller','get','index','isAuthenticated','/:id/sounds','getSounds','create','post','put','/:id','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x26aa07,_0x55175f){var _0x3683e9=function(_0x484a30){while(--_0x484a30){_0x26aa07['push'](_0x26aa07['shift']());}};_0x3683e9(++_0x55175f);}(_0x0e7a,0x1db));var _0xa0e7=function(_0x24e3f0,_0x291458){_0x24e3f0=_0x24e3f0-0x0;var _0x36b770=_0x0e7a[_0x24e3f0];return _0x36b770;};'use strict';var multer=require('multer');var util=require(_0xa0e7('0x0'));var path=require(_0xa0e7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa0e7('0x2'));var auth=require(_0xa0e7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa0e7('0x4'));var controller=require(_0xa0e7('0x5'));router[_0xa0e7('0x6')]('/',auth['isAuthenticated'](),controller[_0xa0e7('0x7')]);router['get']('/:id',auth[_0xa0e7('0x8')](),controller['show']);router['get'](_0xa0e7('0x9'),auth[_0xa0e7('0x8')](),controller[_0xa0e7('0xa')]);router['post']('/',auth[_0xa0e7('0x8')](),controller[_0xa0e7('0xb')]);router[_0xa0e7('0xc')](_0xa0e7('0x9'),auth['isAuthenticated'](),controller['addSound']);router[_0xa0e7('0xd')](_0xa0e7('0xe'),auth[_0xa0e7('0x8')](),controller['update']);router[_0xa0e7('0xf')](_0xa0e7('0xe'),auth['isAuthenticated'](),controller[_0xa0e7('0x10')]);router[_0xa0e7('0xf')](_0xa0e7('0x11'),auth[_0xa0e7('0x8')](),controller[_0xa0e7('0x12')]);module[_0xa0e7('0x13')]=router; \ No newline at end of file +var _0x8667=['../../config/environment','get','index','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d8946,_0x948d3e){var _0x2c7e41=function(_0x3cac2a){while(--_0x3cac2a){_0x5d8946['push'](_0x5d8946['shift']());}};_0x2c7e41(++_0x948d3e);}(_0x8667,0x13d));var _0x7866=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8667[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x7866('0x0'));var util=require(_0x7866('0x1'));var path=require(_0x7866('0x2'));var timeout=require(_0x7866('0x3'));var express=require('express');var router=express[_0x7866('0x4')]();var fs_extra=require(_0x7866('0x5'));var auth=require(_0x7866('0x6'));var interaction=require(_0x7866('0x7'));var config=require(_0x7866('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0x7866('0x9')]('/',auth['isAuthenticated'](),controller[_0x7866('0xa')]);router[_0x7866('0x9')](_0x7866('0xb'),auth[_0x7866('0xc')](),controller[_0x7866('0xd')]);router['get'](_0x7866('0xe'),auth[_0x7866('0xc')](),controller[_0x7866('0xf')]);router[_0x7866('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7866('0x10')](_0x7866('0xe'),auth[_0x7866('0xc')](),controller[_0x7866('0x11')]);router[_0x7866('0x12')](_0x7866('0xb'),auth['isAuthenticated'](),controller[_0x7866('0x13')]);router[_0x7866('0x14')](_0x7866('0xb'),auth[_0x7866('0xc')](),controller[_0x7866('0x15')]);router[_0x7866('0x14')](_0x7866('0x16'),auth[_0x7866('0xc')](),controller[_0x7866('0x17')]);module[_0x7866('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4a8a218..88ae038 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x050f=['BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3','mp3','TIMESTAMP'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x050f,0xe5));var _0xf050=function(_0x373675,_0x441d59){_0x373675=_0x373675-0x0;var _0x62553e=_0x050f[_0x373675];return _0x62553e;};'use strict';var Sequelize=require(_0xf050('0x0'));module[_0xf050('0x1')]={'name':{'type':Sequelize[_0xf050('0x2')],'allowNull':![],'unique':_0xf050('0x3')},'mode':{'type':Sequelize[_0xf050('0x4')](_0xf050('0x5'),_0xf050('0x6'),_0xf050('0x7'),'quietmp3nb',_0xf050('0x8'),_0xf050('0x9')),'allowNull':!![],'defaultValue':_0xf050('0x6')},'directory':{'type':Sequelize[_0xf050('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xf050('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf050('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xf050('0x2')],'allowNull':!![]},'stamp':{'type':_0xf050('0xa')},'defaultEntry':{'type':Sequelize[_0xf050('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x04b1=['sequelize','exports','STRING','name','ENUM','custom','files','quietmp3nb','alpha','TIMESTAMP','BOOLEAN'];(function(_0x49d06a,_0x572365){var _0x256d2d=function(_0x23db2c){while(--_0x23db2c){_0x49d06a['push'](_0x49d06a['shift']());}};_0x256d2d(++_0x572365);}(_0x04b1,0x181));var _0x104b=function(_0x569caa,_0x5174ce){_0x569caa=_0x569caa-0x0;var _0x44cb5a=_0x04b1[_0x569caa];return _0x44cb5a;};'use strict';var Sequelize=require(_0x104b('0x0'));module[_0x104b('0x1')]={'name':{'type':Sequelize[_0x104b('0x2')],'allowNull':![],'unique':_0x104b('0x3')},'mode':{'type':Sequelize[_0x104b('0x4')](_0x104b('0x5'),_0x104b('0x6'),'mp3nb',_0x104b('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x104b('0x6')},'directory':{'type':Sequelize[_0x104b('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x104b('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x104b('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x104b('0x2')],'allowNull':!![],'defaultValue':_0x104b('0x8')},'format':{'type':Sequelize[_0x104b('0x2')],'allowNull':!![]},'stamp':{'type':_0x104b('0x9')},'defaultEntry':{'type':Sequelize[_0x104b('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 918216c..4e58063 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcb1=['attributes','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','length','include','find','body','create','sequelize','join','root','server/files/moh','files','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','message','addSound','transaction','Sound','findOne','converted_format','createdAt','format','%s.%s','basename','save_name','extname','symlinkSync','Sequelize','removeSound','ValidationError','getSounds','order','pick','nolimit','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','MusicOnHolds','UserProfileResource','then','end','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','query','keys','model','intersection'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbcb1,0xb2));var _0x1bcb=function(_0x174ac2,_0xa91d82){_0x174ac2=_0x174ac2-0x0;var _0x28ca76=_0xbcb1[_0x174ac2];return _0x28ca76;};'use strict';var emlformat=require(_0x1bcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bcb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1bcb('0x2'));var moment=require(_0x1bcb('0x3'));var BPromise=require(_0x1bcb('0x4'));var Mustache=require(_0x1bcb('0x5'));var util=require(_0x1bcb('0x6'));var path=require(_0x1bcb('0x7'));var sox=require(_0x1bcb('0x8'));var csv=require(_0x1bcb('0x9'));var ejs=require(_0x1bcb('0xa'));var fs=require('fs');var fs_extra=require(_0x1bcb('0xb'));var _=require(_0x1bcb('0xc'));var squel=require('squel');var crypto=require(_0x1bcb('0xd'));var jsforce=require(_0x1bcb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1bcb('0x9'));var querystring=require(_0x1bcb('0xf'));var Papa=require(_0x1bcb('0x10'));var Redis=require(_0x1bcb('0x11'));var authService=require(_0x1bcb('0x12'));var qs=require(_0x1bcb('0x13'));var as=require(_0x1bcb('0x14'));var hardwareService=require(_0x1bcb('0x15'));var logger=require(_0x1bcb('0x16'))(_0x1bcb('0x17'));var utils=require(_0x1bcb('0x18'));var config=require(_0x1bcb('0x19'));var licenseUtil=require(_0x1bcb('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27155d,_0x5a02b2){_0x5a02b2=_0x5a02b2||0xcc;return function(_0x18039e){if(_0x18039e){return _0x27155d[_0x1bcb('0x1b')](_0x5a02b2);}return _0x27155d[_0x1bcb('0x1c')](_0x5a02b2)['end']();};}function respondWithResult(_0x1f69f9,_0x3b5cec){_0x3b5cec=_0x3b5cec||0xc8;return function(_0x4e4f6a){if(_0x4e4f6a){return _0x1f69f9[_0x1bcb('0x1c')](_0x3b5cec)['json'](_0x4e4f6a);}};}function respondWithFilteredResult(_0x20883d,_0x355147){return function(_0xdb1b48){if(_0xdb1b48){var _0x43fbb6=typeof _0x355147[_0x1bcb('0x1d')]==='undefined'&&typeof _0x355147[_0x1bcb('0x1e')]==='undefined';var _0xf45fe6=_0xdb1b48[_0x1bcb('0x1f')];var _0x63a291=_0x43fbb6?0x0:_0x355147['offset'];var _0x9de6bf=_0x43fbb6?_0xdb1b48[_0x1bcb('0x1f')]:_0x355147[_0x1bcb('0x1d')]+_0x355147['limit'];var _0x2bac95;if(_0x9de6bf>=_0xf45fe6){_0x9de6bf=_0xf45fe6;_0x2bac95=0xc8;}else{_0x2bac95=0xce;}_0x20883d[_0x1bcb('0x1c')](_0x2bac95);return _0x20883d[_0x1bcb('0x20')](_0x1bcb('0x21'),_0x63a291+'-'+_0x9de6bf+'/'+_0xf45fe6)[_0x1bcb('0x22')](_0xdb1b48);}return null;};}function patchUpdates(_0x388bed){return function(_0x30a12f){try{jsonpatch[_0x1bcb('0x23')](_0x30a12f,_0x388bed,!![]);}catch(_0x7b58fe){return BPromise[_0x1bcb('0x24')](_0x7b58fe);}return _0x30a12f[_0x1bcb('0x25')]();};}function saveUpdates(_0x1d7309,_0xfd5fd1){return function(_0x140818){if(_0x140818){return _0x140818[_0x1bcb('0x26')](_0x1d7309)['then'](function(_0x5bc3ca){return _0x5bc3ca;});}return null;};}function removeEntity(_0x302632,_0x1d23dd){return function(_0x1497b6){if(_0x1497b6){return _0x1497b6[_0x1bcb('0x27')]()['then'](function(){var _0x4c9a55=_0x1497b6['get']({'plain':!![]});var _0x56a255=_0x1bcb('0x28');return db[_0x1bcb('0x29')][_0x1bcb('0x27')]({'where':{'type':_0x56a255,'resourceId':_0x4c9a55['id']}})[_0x1bcb('0x2a')](function(){return _0x1497b6;});})[_0x1bcb('0x2a')](function(){_0x302632[_0x1bcb('0x1c')](0xcc)[_0x1bcb('0x2b')]();});}};}function handleEntityNotFound(_0x51e307,_0x1aca9e){return function(_0x313664){if(!_0x313664){_0x51e307[_0x1bcb('0x1b')](0x194);}return _0x313664;};}function handleError(_0x38e5e2,_0x5e2cf4){_0x5e2cf4=_0x5e2cf4||0x1f4;return function(_0x2800c4){logger['error'](_0x2800c4[_0x1bcb('0x2c')]);if(_0x2800c4[_0x1bcb('0x2d')]){delete _0x2800c4[_0x1bcb('0x2d')];}_0x38e5e2[_0x1bcb('0x1c')](_0x5e2cf4)[_0x1bcb('0x2e')](_0x2800c4);};}exports['index']=function(_0x21db40,_0x567f9f){var _0x15f0c2={},_0x276884={},_0x551240={'count':0x0,'rows':[]};var _0x6a39b2=_[_0x1bcb('0x2f')](db[_0x1bcb('0x30')][_0x1bcb('0x31')],function(_0x56c166){return{'name':_0x56c166[_0x1bcb('0x32')],'type':_0x56c166[_0x1bcb('0x33')]['key']};});_0x276884['model']=_[_0x1bcb('0x2f')](_0x6a39b2,'name');_0x276884[_0x1bcb('0x34')]=_[_0x1bcb('0x35')](_0x21db40[_0x1bcb('0x34')]);_0x276884['filters']=_['intersection'](_0x276884[_0x1bcb('0x36')],_0x276884[_0x1bcb('0x34')]);_0x15f0c2['attributes']=_[_0x1bcb('0x37')](_0x276884[_0x1bcb('0x36')],qs['fields'](_0x21db40[_0x1bcb('0x34')]['fields']));_0x15f0c2[_0x1bcb('0x38')]=_0x15f0c2['attributes']['length']?_0x15f0c2['attributes']:_0x276884[_0x1bcb('0x36')];if(!_0x21db40['query'][_0x1bcb('0x39')]('nolimit')){_0x15f0c2['limit']=qs[_0x1bcb('0x1e')](_0x21db40[_0x1bcb('0x34')][_0x1bcb('0x1e')]);_0x15f0c2[_0x1bcb('0x1d')]=qs[_0x1bcb('0x1d')](_0x21db40['query'][_0x1bcb('0x1d')]);}_0x15f0c2['order']=qs[_0x1bcb('0x3a')](_0x21db40['query'][_0x1bcb('0x3a')]);delete _0x21db40['query'][_0x1bcb('0x3a')];_0x15f0c2[_0x1bcb('0x3b')]=qs[_0x1bcb('0x3c')](_['pick'](_0x21db40[_0x1bcb('0x34')],_0x276884['filters']),_0x6a39b2);if(_0x21db40[_0x1bcb('0x34')][_0x1bcb('0x3d')]){_0x15f0c2[_0x1bcb('0x3b')]=_[_0x1bcb('0x3e')](_0x15f0c2['where'],{'$or':_[_0x1bcb('0x2f')](_0x6a39b2,function(_0x10f039){if(_0x10f039[_0x1bcb('0x33')]!==_0x1bcb('0x3f')){var _0xcb6dac={};_0xcb6dac[_0x10f039[_0x1bcb('0x2d')]]={'$like':'%'+_0x21db40['query'][_0x1bcb('0x3d')]+'%'};return _0xcb6dac;}})});}_0x15f0c2=_[_0x1bcb('0x3e')]({},_0x15f0c2,_0x21db40[_0x1bcb('0x40')]);var _0x3933f2={'where':_0x15f0c2[_0x1bcb('0x3b')]};return db[_0x1bcb('0x30')][_0x1bcb('0x1f')](_0x3933f2)['then'](function(_0x332bf){_0x551240[_0x1bcb('0x1f')]=_0x332bf;if(_0x21db40[_0x1bcb('0x34')][_0x1bcb('0x41')]){_0x15f0c2['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x1bcb('0x42')](_0x15f0c2);})[_0x1bcb('0x2a')](function(_0x1aeb8b){_0x551240[_0x1bcb('0x43')]=_0x1aeb8b;return _0x551240;})[_0x1bcb('0x2a')](respondWithFilteredResult(_0x567f9f,_0x15f0c2))[_0x1bcb('0x44')](handleError(_0x567f9f,null));};exports[_0x1bcb('0x45')]=function(_0x56632a,_0x40b6f8){var _0x262dec={'raw':![],'where':{'id':_0x56632a[_0x1bcb('0x46')]['id']}},_0x32827b={};_0x32827b[_0x1bcb('0x36')]=_[_0x1bcb('0x35')](db['VoiceMusicOnHold'][_0x1bcb('0x31')]);_0x32827b[_0x1bcb('0x34')]=_[_0x1bcb('0x35')](_0x56632a[_0x1bcb('0x34')]);_0x32827b[_0x1bcb('0x3c')]=_[_0x1bcb('0x37')](_0x32827b[_0x1bcb('0x36')],_0x32827b[_0x1bcb('0x34')]);_0x262dec[_0x1bcb('0x38')]=_[_0x1bcb('0x37')](_0x32827b[_0x1bcb('0x36')],qs['fields'](_0x56632a['query'][_0x1bcb('0x47')]));_0x262dec['attributes']=_0x262dec[_0x1bcb('0x38')][_0x1bcb('0x48')]?_0x262dec[_0x1bcb('0x38')]:_0x32827b['model'];if(_0x56632a['query'][_0x1bcb('0x41')]){_0x262dec[_0x1bcb('0x49')]=[{'all':!![]}];}_0x262dec=_[_0x1bcb('0x3e')]({},_0x262dec,_0x56632a[_0x1bcb('0x40')]);return db[_0x1bcb('0x30')][_0x1bcb('0x4a')](_0x262dec)[_0x1bcb('0x2a')](handleEntityNotFound(_0x40b6f8,null))[_0x1bcb('0x2a')](respondWithResult(_0x40b6f8,null))[_0x1bcb('0x44')](handleError(_0x40b6f8,null));};exports['update']=function(_0x325c33,_0x5ddda7){if(_0x325c33['body']['id']){delete _0x325c33[_0x1bcb('0x4b')]['id'];}return db[_0x1bcb('0x30')]['find']({'where':{'id':_0x325c33[_0x1bcb('0x46')]['id']}})[_0x1bcb('0x2a')](handleEntityNotFound(_0x5ddda7,null))[_0x1bcb('0x2a')](saveUpdates(_0x325c33[_0x1bcb('0x4b')],null))[_0x1bcb('0x2a')](respondWithResult(_0x5ddda7,null))['catch'](handleError(_0x5ddda7,null));};exports[_0x1bcb('0x4c')]=function(_0x185bc0,_0x4ce4d9,_0x45c460){return db[_0x1bcb('0x4d')]['transaction'](function(_0x37c859){if(_0x185bc0[_0x1bcb('0x4b')]['mode']==='files'){_0x185bc0['body']['directory']=path[_0x1bcb('0x4e')](config[_0x1bcb('0x4f')],_0x1bcb('0x50'),_0x185bc0[_0x1bcb('0x4b')][_0x1bcb('0x2d')]);}return db['VoiceMusicOnHold'][_0x1bcb('0x4c')](_0x185bc0[_0x1bcb('0x4b')],{'transaction':_0x37c859})[_0x1bcb('0x2a')](function(_0xd51972){if(_0x185bc0[_0x1bcb('0x4b')]['mode']===_0x1bcb('0x51')){fs['mkdirSync'](_0xd51972[_0x1bcb('0x52')],parseInt(_0x1bcb('0x53'),0x8));}var _0x23d468=_0x185bc0[_0x1bcb('0x54')][_0x1bcb('0x55')]({'plain':!![]});if(!_0x23d468)throw new Error(_0x1bcb('0x56'));if(_0x23d468[_0x1bcb('0x57')]===_0x1bcb('0x54')){var _0x532a43=_0xd51972['get']({'plain':!![]});return db[_0x1bcb('0x58')][_0x1bcb('0x4a')]({'where':{'name':_0x1bcb('0x28'),'userProfileId':_0x23d468[_0x1bcb('0x59')]},'raw':!![]})['then'](function(_0x732749){if(_0x732749&&_0x732749[_0x1bcb('0x5a')]===0x0){return db['UserProfileResource'][_0x1bcb('0x4c')]({'name':_0x532a43[_0x1bcb('0x2d')],'resourceId':_0x532a43['id'],'type':_0x732749[_0x1bcb('0x2d')],'sectionId':_0x732749['id']},{})['then'](function(){return _0xd51972;});}else{return _0xd51972;}})[_0x1bcb('0x44')](function(_0x88b4b3){logger[_0x1bcb('0x5b')](_0x1bcb('0x5c'),_0x88b4b3);});}return _0xd51972;});})[_0x1bcb('0x2a')](respondWithResult(_0x4ce4d9,0xc9))[_0x1bcb('0x44')](handleError(_0x4ce4d9,null));};exports[_0x1bcb('0x27')]=function(_0x683380,_0x2ef4f1,_0x4cb86b){var _0xb2cb76;return db[_0x1bcb('0x30')][_0x1bcb('0x4a')]({'where':{'id':_0x683380[_0x1bcb('0x46')]['id']}})[_0x1bcb('0x2a')](function(_0x5d737b){if(_0x5d737b){return db[_0x1bcb('0x4d')]['transaction'](function(_0xf977ac){return _0x5d737b['destroy']({'transaction':_0xf977ac,'raw':!![]})[_0x1bcb('0x2a')](function(_0x105ee7){if(_0x105ee7[_0x1bcb('0x52')]){fs[_0x1bcb('0x5d')](_0x105ee7['directory'])[_0x1bcb('0x5e')](function(_0x303621){fs[_0x1bcb('0x5f')](path[_0x1bcb('0x4e')](_0x105ee7['directory'],_0x303621));});fs[_0x1bcb('0x60')](_0x105ee7[_0x1bcb('0x52')]);}return _0x105ee7;});})[_0x1bcb('0x44')](function(_0x56002a){throw new db['Sequelize']['ValidationError'](_0x56002a[_0x1bcb('0x61')]);});}})[_0x1bcb('0x2a')](handleEntityNotFound(_0x2ef4f1,null))['then'](removeEntity(_0x2ef4f1,null))['catch'](handleError(_0x2ef4f1,null));};exports[_0x1bcb('0x62')]=function(_0x473809,_0xa8d6fe,_0x562e9d){return db['sequelize'][_0x1bcb('0x63')](function(_0x579110){var _0x13e3ba;return db[_0x1bcb('0x30')][_0x1bcb('0x4a')]({'where':{'id':_0x473809[_0x1bcb('0x46')]['id']}})['then'](function(_0x21f181){if(_0x21f181){_0x13e3ba=_0x21f181;return _0x21f181[_0x1bcb('0x62')](_0x473809[_0x1bcb('0x4b')]['id'],{'transaction':_0x579110});}})[_0x1bcb('0x2a')](function(_0x5add3a){if(_0x5add3a){return db[_0x1bcb('0x64')][_0x1bcb('0x65')]({'where':{'id':_0x473809['body']['id']},'attributes':['id','name','save_name',_0x1bcb('0x66'),_0x1bcb('0x67')],'raw':!![]});}})[_0x1bcb('0x2a')](function(_0x3c5cb7){if(_0x3c5cb7){var _0x36cfdf=path[_0x1bcb('0x4e')](config[_0x1bcb('0x4f')],'server/files/sounds/converted',util[_0x1bcb('0x68')](_0x1bcb('0x69'),path[_0x1bcb('0x6a')](_0x3c5cb7[_0x1bcb('0x6b')],path[_0x1bcb('0x6c')](_0x3c5cb7['save_name'])),_0x3c5cb7[_0x1bcb('0x66')]));var _0x430091=path[_0x1bcb('0x4e')](config[_0x1bcb('0x4f')],'server/files/moh',_0x13e3ba[_0x1bcb('0x2d')],util[_0x1bcb('0x68')](_0x1bcb('0x69'),_0x3c5cb7[_0x1bcb('0x2d')],_0x3c5cb7[_0x1bcb('0x66')]));fs[_0x1bcb('0x6d')](_0x36cfdf,_0x430091);return _0x3c5cb7;}})[_0x1bcb('0x44')](function(_0x2e0837){throw new db[(_0x1bcb('0x6e'))]['ValidationError'](_0x2e0837['message']);});})['then'](handleEntityNotFound(_0xa8d6fe,null))[_0x1bcb('0x2a')](respondWithResult(_0xa8d6fe,0xc9))[_0x1bcb('0x44')](handleError(_0xa8d6fe,null));};exports[_0x1bcb('0x6f')]=function(_0x3cd1db,_0x4893b9,_0x128651){return db['sequelize']['transaction'](function(_0x378435){var _0xccf76e;return db[_0x1bcb('0x30')][_0x1bcb('0x65')]({'where':{'id':_0x3cd1db['params']['id']}})[_0x1bcb('0x2a')](handleEntityNotFound(_0x4893b9,null))[_0x1bcb('0x2a')](function(_0x425627){if(_0x425627){_0xccf76e=_0x425627;return _0x425627[_0x1bcb('0x6f')](_0x3cd1db[_0x1bcb('0x46')]['id2']);}})[_0x1bcb('0x2a')](function(_0x544d73){if(_0x544d73){return db[_0x1bcb('0x64')]['findOne']({'where':{'id':_0x3cd1db[_0x1bcb('0x46')]['id2']},'attributes':['id',_0x1bcb('0x2d'),_0x1bcb('0x6b'),_0x1bcb('0x66'),_0x1bcb('0x67')],'raw':!![]});}})[_0x1bcb('0x2a')](function(_0x1cd046){if(_0x1cd046){fs['unlinkSync'](path['join'](_0xccf76e[_0x1bcb('0x52')],util[_0x1bcb('0x68')](_0x1bcb('0x69'),_0x1cd046[_0x1bcb('0x2d')],_0x1cd046[_0x1bcb('0x66')])));return _0x1cd046;}})['catch'](function(_0x27b749){throw new db[(_0x1bcb('0x6e'))][(_0x1bcb('0x70'))](_0x27b749['message']);});})[_0x1bcb('0x2a')](handleEntityNotFound(_0x4893b9,null))[_0x1bcb('0x2a')](respondWithStatusCode(_0x4893b9,0xcc))[_0x1bcb('0x44')](handleError(_0x4893b9,null));};exports[_0x1bcb('0x71')]=function(_0x214f9e,_0x515782,_0x3e9242){var _0xb4dce3={};var _0x2ebe43={};var _0xfb8233;var _0xaa81af;return db[_0x1bcb('0x30')][_0x1bcb('0x65')]({'where':{'id':_0x214f9e['params']['id']}})['then'](handleEntityNotFound(_0x515782,null))['then'](function(_0x10fc41){if(_0x10fc41){_0xfb8233=_0x10fc41;_0x2ebe43[_0x1bcb('0x36')]=_[_0x1bcb('0x35')](db[_0x1bcb('0x64')][_0x1bcb('0x31')]);_0x2ebe43[_0x1bcb('0x34')]=_[_0x1bcb('0x35')](_0x214f9e[_0x1bcb('0x34')]);_0x2ebe43[_0x1bcb('0x3c')]=_[_0x1bcb('0x37')](_0x2ebe43[_0x1bcb('0x36')],_0x2ebe43[_0x1bcb('0x34')]);_0xb4dce3[_0x1bcb('0x38')]=_[_0x1bcb('0x37')](_0x2ebe43[_0x1bcb('0x36')],qs[_0x1bcb('0x47')](_0x214f9e[_0x1bcb('0x34')][_0x1bcb('0x47')]));_0xb4dce3[_0x1bcb('0x38')]=_0xb4dce3[_0x1bcb('0x38')][_0x1bcb('0x48')]?_0xb4dce3[_0x1bcb('0x38')]:_0x2ebe43['model'];_0xb4dce3[_0x1bcb('0x72')]=qs[_0x1bcb('0x3a')](_0x214f9e[_0x1bcb('0x34')][_0x1bcb('0x3a')]);_0xb4dce3[_0x1bcb('0x3b')]=qs[_0x1bcb('0x3c')](_[_0x1bcb('0x73')](_0x214f9e[_0x1bcb('0x34')],_0x2ebe43[_0x1bcb('0x3c')]));if(_0x214f9e[_0x1bcb('0x34')][_0x1bcb('0x3d')]){_0xb4dce3[_0x1bcb('0x3b')]=_['merge'](_0xb4dce3['where'],{'$or':_['map'](_0xb4dce3[_0x1bcb('0x38')],function(_0x157c83){var _0x154897={};_0x154897[_0x157c83]={'$like':'%'+_0x214f9e['query'][_0x1bcb('0x3d')]+'%'};return _0x154897;})});}_0xb4dce3=_[_0x1bcb('0x3e')]({},_0xb4dce3,_0x214f9e[_0x1bcb('0x40')]);return _0xfb8233[_0x1bcb('0x71')](_0xb4dce3);}})[_0x1bcb('0x2a')](function(_0x5a2175){if(_0x5a2175){_0xaa81af=_0x5a2175['length'];if(!_0x214f9e[_0x1bcb('0x34')]['hasOwnProperty'](_0x1bcb('0x74'))){_0xb4dce3['limit']=qs[_0x1bcb('0x1e')](_0x214f9e[_0x1bcb('0x34')][_0x1bcb('0x1e')]);_0xb4dce3[_0x1bcb('0x1d')]=qs[_0x1bcb('0x1d')](_0x214f9e[_0x1bcb('0x34')][_0x1bcb('0x1d')]);}return _0xfb8233[_0x1bcb('0x71')](_0xb4dce3);}})[_0x1bcb('0x2a')](function(_0x304f9b){if(_0x304f9b){return _0x304f9b?{'count':_0xaa81af,'rows':_0x304f9b}:null;}})[_0x1bcb('0x2a')](respondWithResult(_0x515782,null))['catch'](handleError(_0x515782,null));}; \ No newline at end of file +var _0x7f69=['mkdirSync','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','readdirSync','forEach','unlinkSync','Sequelize','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','ValidationError','message','removeSound','sequelize','getSounds','keys','order','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','catch','show','params','fields','find','body','create','mode','files','directory','join','server/files/moh'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7f69,0x1cc));var _0x97f6=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x7f69[_0x10f6e8];return _0x35bb3c;};'use strict';var emlformat=require(_0x97f6('0x0'));var rimraf=require(_0x97f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97f6('0x2'));var rp=require(_0x97f6('0x3'));var moment=require('moment');var BPromise=require(_0x97f6('0x4'));var Mustache=require('mustache');var util=require(_0x97f6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x97f6('0x6'));var ejs=require(_0x97f6('0x7'));var fs=require('fs');var fs_extra=require(_0x97f6('0x8'));var _=require(_0x97f6('0x9'));var squel=require(_0x97f6('0xa'));var crypto=require(_0x97f6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x97f6('0xc'));var toCsv=require(_0x97f6('0x6'));var querystring=require('querystring');var Papa=require(_0x97f6('0xd'));var Redis=require(_0x97f6('0xe'));var authService=require(_0x97f6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x97f6('0x10'));var hardwareService=require(_0x97f6('0x11'));var logger=require(_0x97f6('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x97f6('0x13'));var db=require(_0x97f6('0x14'))['db'];function respondWithStatusCode(_0x2dfd06,_0x4cf582){_0x4cf582=_0x4cf582||0xcc;return function(_0x274e94){if(_0x274e94){return _0x2dfd06[_0x97f6('0x15')](_0x4cf582);}return _0x2dfd06['status'](_0x4cf582)[_0x97f6('0x16')]();};}function respondWithResult(_0x49b3ef,_0xd974f7){_0xd974f7=_0xd974f7||0xc8;return function(_0x34848e){if(_0x34848e){return _0x49b3ef[_0x97f6('0x17')](_0xd974f7)[_0x97f6('0x18')](_0x34848e);}};}function respondWithFilteredResult(_0x43d945,_0x3fd5ab){return function(_0x4072d2){if(_0x4072d2){var _0x43a3d5=typeof _0x3fd5ab[_0x97f6('0x19')]===_0x97f6('0x1a')&&typeof _0x3fd5ab[_0x97f6('0x1b')]==='undefined';var _0x17cb90=_0x4072d2[_0x97f6('0x1c')];var _0x512f04=_0x43a3d5?0x0:_0x3fd5ab['offset'];var _0x76823f=_0x43a3d5?_0x4072d2['count']:_0x3fd5ab[_0x97f6('0x19')]+_0x3fd5ab['limit'];var _0x877fdc;if(_0x76823f>=_0x17cb90){_0x76823f=_0x17cb90;_0x877fdc=0xc8;}else{_0x877fdc=0xce;}_0x43d945[_0x97f6('0x17')](_0x877fdc);return _0x43d945[_0x97f6('0x1d')](_0x97f6('0x1e'),_0x512f04+'-'+_0x76823f+'/'+_0x17cb90)[_0x97f6('0x18')](_0x4072d2);}return null;};}function patchUpdates(_0x74eec4){return function(_0x15d5c5){try{jsonpatch[_0x97f6('0x1f')](_0x15d5c5,_0x74eec4,!![]);}catch(_0x14393b){return BPromise[_0x97f6('0x20')](_0x14393b);}return _0x15d5c5[_0x97f6('0x21')]();};}function saveUpdates(_0x17c3b,_0x443951){return function(_0x51304d){if(_0x51304d){return _0x51304d[_0x97f6('0x22')](_0x17c3b)[_0x97f6('0x23')](function(_0x9e4aff){return _0x9e4aff;});}return null;};}function removeEntity(_0x200788,_0x483d83){return function(_0xe55825){if(_0xe55825){return _0xe55825['destroy']()[_0x97f6('0x23')](function(){var _0x55c896=_0xe55825['get']({'plain':!![]});var _0x4a39fb='MusicOnHolds';return db[_0x97f6('0x24')]['destroy']({'where':{'type':_0x4a39fb,'resourceId':_0x55c896['id']}})['then'](function(){return _0xe55825;});})[_0x97f6('0x23')](function(){_0x200788[_0x97f6('0x17')](0xcc)[_0x97f6('0x16')]();});}};}function handleEntityNotFound(_0x394f1b,_0x56893f){return function(_0x458144){if(!_0x458144){_0x394f1b[_0x97f6('0x15')](0x194);}return _0x458144;};}function handleError(_0x4e7894,_0x3c652f){_0x3c652f=_0x3c652f||0x1f4;return function(_0x5cdf55){logger['error'](_0x5cdf55['stack']);if(_0x5cdf55[_0x97f6('0x25')]){delete _0x5cdf55[_0x97f6('0x25')];}_0x4e7894[_0x97f6('0x17')](_0x3c652f)[_0x97f6('0x26')](_0x5cdf55);};}exports[_0x97f6('0x27')]=function(_0x133085,_0x2e2f3b){var _0x1c2508={},_0x2ac20d={},_0x52f454={'count':0x0,'rows':[]};var _0x51602e=_['map'](db[_0x97f6('0x28')][_0x97f6('0x29')],function(_0x1171ca){return{'name':_0x1171ca[_0x97f6('0x2a')],'type':_0x1171ca[_0x97f6('0x2b')][_0x97f6('0x2c')]};});_0x2ac20d[_0x97f6('0x2d')]=_[_0x97f6('0x2e')](_0x51602e,_0x97f6('0x25'));_0x2ac20d[_0x97f6('0x2f')]=_['keys'](_0x133085[_0x97f6('0x2f')]);_0x2ac20d[_0x97f6('0x30')]=_[_0x97f6('0x31')](_0x2ac20d[_0x97f6('0x2d')],_0x2ac20d[_0x97f6('0x2f')]);_0x1c2508[_0x97f6('0x32')]=_[_0x97f6('0x31')](_0x2ac20d[_0x97f6('0x2d')],qs['fields'](_0x133085[_0x97f6('0x2f')]['fields']));_0x1c2508[_0x97f6('0x32')]=_0x1c2508[_0x97f6('0x32')][_0x97f6('0x33')]?_0x1c2508[_0x97f6('0x32')]:_0x2ac20d[_0x97f6('0x2d')];if(!_0x133085['query'][_0x97f6('0x34')](_0x97f6('0x35'))){_0x1c2508[_0x97f6('0x1b')]=qs[_0x97f6('0x1b')](_0x133085[_0x97f6('0x2f')][_0x97f6('0x1b')]);_0x1c2508[_0x97f6('0x19')]=qs['offset'](_0x133085[_0x97f6('0x2f')]['offset']);}_0x1c2508['order']=qs[_0x97f6('0x36')](_0x133085[_0x97f6('0x2f')][_0x97f6('0x36')]);delete _0x133085[_0x97f6('0x2f')]['sort'];_0x1c2508['where']=qs[_0x97f6('0x30')](_[_0x97f6('0x37')](_0x133085[_0x97f6('0x2f')],_0x2ac20d[_0x97f6('0x30')]),_0x51602e);if(_0x133085[_0x97f6('0x2f')][_0x97f6('0x38')]){_0x1c2508[_0x97f6('0x39')]=_['merge'](_0x1c2508[_0x97f6('0x39')],{'$or':_[_0x97f6('0x2e')](_0x51602e,function(_0x1ecf8d){if(_0x1ecf8d['type']!==_0x97f6('0x3a')){var _0x258d7e={};_0x258d7e[_0x1ecf8d[_0x97f6('0x25')]]={'$like':'%'+_0x133085['query'][_0x97f6('0x38')]+'%'};return _0x258d7e;}})});}_0x1c2508=_[_0x97f6('0x3b')]({},_0x1c2508,_0x133085[_0x97f6('0x3c')]);var _0x29139a={'where':_0x1c2508[_0x97f6('0x39')]};return db['VoiceMusicOnHold'][_0x97f6('0x1c')](_0x29139a)[_0x97f6('0x23')](function(_0x2cb541){_0x52f454[_0x97f6('0x1c')]=_0x2cb541;if(_0x133085[_0x97f6('0x2f')][_0x97f6('0x3d')]){_0x1c2508[_0x97f6('0x3e')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x1c2508);})[_0x97f6('0x23')](function(_0x5b79c0){_0x52f454['rows']=_0x5b79c0;return _0x52f454;})['then'](respondWithFilteredResult(_0x2e2f3b,_0x1c2508))[_0x97f6('0x3f')](handleError(_0x2e2f3b,null));};exports[_0x97f6('0x40')]=function(_0x420fdb,_0x3b5035){var _0xd07172={'raw':![],'where':{'id':_0x420fdb[_0x97f6('0x41')]['id']}},_0x3ba56b={};_0x3ba56b[_0x97f6('0x2d')]=_['keys'](db[_0x97f6('0x28')][_0x97f6('0x29')]);_0x3ba56b[_0x97f6('0x2f')]=_['keys'](_0x420fdb['query']);_0x3ba56b['filters']=_[_0x97f6('0x31')](_0x3ba56b[_0x97f6('0x2d')],_0x3ba56b[_0x97f6('0x2f')]);_0xd07172['attributes']=_['intersection'](_0x3ba56b[_0x97f6('0x2d')],qs[_0x97f6('0x42')](_0x420fdb['query']['fields']));_0xd07172[_0x97f6('0x32')]=_0xd07172[_0x97f6('0x32')][_0x97f6('0x33')]?_0xd07172[_0x97f6('0x32')]:_0x3ba56b[_0x97f6('0x2d')];if(_0x420fdb[_0x97f6('0x2f')]['includeAll']){_0xd07172[_0x97f6('0x3e')]=[{'all':!![]}];}_0xd07172=_[_0x97f6('0x3b')]({},_0xd07172,_0x420fdb[_0x97f6('0x3c')]);return db[_0x97f6('0x28')][_0x97f6('0x43')](_0xd07172)['then'](handleEntityNotFound(_0x3b5035,null))[_0x97f6('0x23')](respondWithResult(_0x3b5035,null))[_0x97f6('0x3f')](handleError(_0x3b5035,null));};exports['update']=function(_0x100072,_0x56b877){if(_0x100072[_0x97f6('0x44')]['id']){delete _0x100072[_0x97f6('0x44')]['id'];}return db[_0x97f6('0x28')]['find']({'where':{'id':_0x100072[_0x97f6('0x41')]['id']}})[_0x97f6('0x23')](handleEntityNotFound(_0x56b877,null))[_0x97f6('0x23')](saveUpdates(_0x100072[_0x97f6('0x44')],null))[_0x97f6('0x23')](respondWithResult(_0x56b877,null))[_0x97f6('0x3f')](handleError(_0x56b877,null));};exports[_0x97f6('0x45')]=function(_0x545634,_0x5c97c5,_0x3e13a1){return db['sequelize']['transaction'](function(_0x406b93){if(_0x545634[_0x97f6('0x44')][_0x97f6('0x46')]===_0x97f6('0x47')){_0x545634[_0x97f6('0x44')][_0x97f6('0x48')]=path[_0x97f6('0x49')](config['root'],_0x97f6('0x4a'),_0x545634[_0x97f6('0x44')][_0x97f6('0x25')]);}return db['VoiceMusicOnHold'][_0x97f6('0x45')](_0x545634['body'],{'transaction':_0x406b93})[_0x97f6('0x23')](function(_0x3deb9c){if(_0x545634['body'][_0x97f6('0x46')]===_0x97f6('0x47')){fs[_0x97f6('0x4b')](_0x3deb9c[_0x97f6('0x48')],parseInt('0777',0x8));}var _0x9af2c1=_0x545634[_0x97f6('0x4c')][_0x97f6('0x4d')]({'plain':!![]});if(!_0x9af2c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9af2c1[_0x97f6('0x4e')]===_0x97f6('0x4c')){var _0x4c4d56=_0x3deb9c[_0x97f6('0x4d')]({'plain':!![]});return db[_0x97f6('0x4f')][_0x97f6('0x43')]({'where':{'name':'MusicOnHolds','userProfileId':_0x9af2c1[_0x97f6('0x50')]},'raw':!![]})[_0x97f6('0x23')](function(_0x4b00d7){if(_0x4b00d7&&_0x4b00d7['autoAssociation']===0x0){return db[_0x97f6('0x24')][_0x97f6('0x45')]({'name':_0x4c4d56['name'],'resourceId':_0x4c4d56['id'],'type':_0x4b00d7[_0x97f6('0x25')],'sectionId':_0x4b00d7['id']},{})['then'](function(){return _0x3deb9c;});}else{return _0x3deb9c;}})[_0x97f6('0x3f')](function(_0x3bd5fe){logger['error'](_0x97f6('0x51'),_0x3bd5fe);});}return _0x3deb9c;});})[_0x97f6('0x23')](respondWithResult(_0x5c97c5,0xc9))[_0x97f6('0x3f')](handleError(_0x5c97c5,null));};exports[_0x97f6('0x52')]=function(_0x5b2715,_0x191314,_0x5d2776){var _0x404050;return db[_0x97f6('0x28')]['find']({'where':{'id':_0x5b2715[_0x97f6('0x41')]['id']}})[_0x97f6('0x23')](function(_0x33c249){if(_0x33c249){return db['sequelize'][_0x97f6('0x53')](function(_0x3e272d){return _0x33c249[_0x97f6('0x52')]({'transaction':_0x3e272d,'raw':!![]})[_0x97f6('0x23')](function(_0xa727ac){if(_0xa727ac['directory']){fs[_0x97f6('0x54')](_0xa727ac[_0x97f6('0x48')])[_0x97f6('0x55')](function(_0x56686c){fs[_0x97f6('0x56')](path[_0x97f6('0x49')](_0xa727ac[_0x97f6('0x48')],_0x56686c));});fs['rmdirSync'](_0xa727ac['directory']);}return _0xa727ac;});})['catch'](function(_0x18cb30){throw new db[(_0x97f6('0x57'))]['ValidationError'](_0x18cb30['message']);});}})['then'](handleEntityNotFound(_0x191314,null))[_0x97f6('0x23')](removeEntity(_0x191314,null))[_0x97f6('0x3f')](handleError(_0x191314,null));};exports[_0x97f6('0x58')]=function(_0x1b7216,_0x2629a0,_0xa10711){return db['sequelize']['transaction'](function(_0x4f99b8){var _0x922766;return db['VoiceMusicOnHold'][_0x97f6('0x43')]({'where':{'id':_0x1b7216[_0x97f6('0x41')]['id']}})[_0x97f6('0x23')](function(_0x396a71){if(_0x396a71){_0x922766=_0x396a71;return _0x396a71[_0x97f6('0x58')](_0x1b7216[_0x97f6('0x44')]['id'],{'transaction':_0x4f99b8});}})[_0x97f6('0x23')](function(_0x4c54c8){if(_0x4c54c8){return db[_0x97f6('0x59')][_0x97f6('0x5a')]({'where':{'id':_0x1b7216['body']['id']},'attributes':['id','name',_0x97f6('0x5b'),_0x97f6('0x5c'),_0x97f6('0x5d')],'raw':!![]});}})[_0x97f6('0x23')](function(_0x5b3052){if(_0x5b3052){var _0x507f96=path[_0x97f6('0x49')](config[_0x97f6('0x5e')],_0x97f6('0x5f'),util[_0x97f6('0x60')](_0x97f6('0x61'),path[_0x97f6('0x62')](_0x5b3052['save_name'],path[_0x97f6('0x63')](_0x5b3052[_0x97f6('0x5b')])),_0x5b3052[_0x97f6('0x5c')]));var _0x259385=path[_0x97f6('0x49')](config[_0x97f6('0x5e')],_0x97f6('0x4a'),_0x922766[_0x97f6('0x25')],util[_0x97f6('0x60')](_0x97f6('0x61'),_0x5b3052[_0x97f6('0x25')],_0x5b3052['converted_format']));fs['symlinkSync'](_0x507f96,_0x259385);return _0x5b3052;}})[_0x97f6('0x3f')](function(_0x22038d){throw new db[(_0x97f6('0x57'))][(_0x97f6('0x64'))](_0x22038d[_0x97f6('0x65')]);});})['then'](handleEntityNotFound(_0x2629a0,null))[_0x97f6('0x23')](respondWithResult(_0x2629a0,0xc9))[_0x97f6('0x3f')](handleError(_0x2629a0,null));};exports[_0x97f6('0x66')]=function(_0x186783,_0x58757a,_0x14ba18){return db[_0x97f6('0x67')][_0x97f6('0x53')](function(_0x2a67c4){var _0x1b373a;return db[_0x97f6('0x28')][_0x97f6('0x5a')]({'where':{'id':_0x186783[_0x97f6('0x41')]['id']}})['then'](handleEntityNotFound(_0x58757a,null))[_0x97f6('0x23')](function(_0x5ef969){if(_0x5ef969){_0x1b373a=_0x5ef969;return _0x5ef969[_0x97f6('0x66')](_0x186783['params']['id2']);}})[_0x97f6('0x23')](function(_0x432c34){if(_0x432c34){return db['Sound']['findOne']({'where':{'id':_0x186783[_0x97f6('0x41')]['id2']},'attributes':['id',_0x97f6('0x25'),'save_name',_0x97f6('0x5c'),'createdAt'],'raw':!![]});}})[_0x97f6('0x23')](function(_0x362d9a){if(_0x362d9a){fs[_0x97f6('0x56')](path[_0x97f6('0x49')](_0x1b373a[_0x97f6('0x48')],util['format'](_0x97f6('0x61'),_0x362d9a[_0x97f6('0x25')],_0x362d9a['converted_format'])));return _0x362d9a;}})[_0x97f6('0x3f')](function(_0x563ddb){throw new db[(_0x97f6('0x57'))][(_0x97f6('0x64'))](_0x563ddb[_0x97f6('0x65')]);});})[_0x97f6('0x23')](handleEntityNotFound(_0x58757a,null))['then'](respondWithStatusCode(_0x58757a,0xcc))['catch'](handleError(_0x58757a,null));};exports[_0x97f6('0x68')]=function(_0x1acd87,_0x58def1,_0xbba50c){var _0x3576bf={};var _0x2356cd={};var _0x23406a;var _0x1b9aca;return db[_0x97f6('0x28')][_0x97f6('0x5a')]({'where':{'id':_0x1acd87[_0x97f6('0x41')]['id']}})[_0x97f6('0x23')](handleEntityNotFound(_0x58def1,null))['then'](function(_0x306fda){if(_0x306fda){_0x23406a=_0x306fda;_0x2356cd[_0x97f6('0x2d')]=_['keys'](db['Sound']['rawAttributes']);_0x2356cd[_0x97f6('0x2f')]=_[_0x97f6('0x69')](_0x1acd87[_0x97f6('0x2f')]);_0x2356cd[_0x97f6('0x30')]=_[_0x97f6('0x31')](_0x2356cd['model'],_0x2356cd[_0x97f6('0x2f')]);_0x3576bf['attributes']=_[_0x97f6('0x31')](_0x2356cd[_0x97f6('0x2d')],qs['fields'](_0x1acd87[_0x97f6('0x2f')][_0x97f6('0x42')]));_0x3576bf[_0x97f6('0x32')]=_0x3576bf[_0x97f6('0x32')][_0x97f6('0x33')]?_0x3576bf['attributes']:_0x2356cd['model'];_0x3576bf[_0x97f6('0x6a')]=qs['sort'](_0x1acd87['query'][_0x97f6('0x36')]);_0x3576bf[_0x97f6('0x39')]=qs[_0x97f6('0x30')](_[_0x97f6('0x37')](_0x1acd87[_0x97f6('0x2f')],_0x2356cd[_0x97f6('0x30')]));if(_0x1acd87[_0x97f6('0x2f')][_0x97f6('0x38')]){_0x3576bf[_0x97f6('0x39')]=_[_0x97f6('0x3b')](_0x3576bf[_0x97f6('0x39')],{'$or':_[_0x97f6('0x2e')](_0x3576bf[_0x97f6('0x32')],function(_0x86c82){var _0x3a07df={};_0x3a07df[_0x86c82]={'$like':'%'+_0x1acd87['query'][_0x97f6('0x38')]+'%'};return _0x3a07df;})});}_0x3576bf=_[_0x97f6('0x3b')]({},_0x3576bf,_0x1acd87[_0x97f6('0x3c')]);return _0x23406a['getSounds'](_0x3576bf);}})[_0x97f6('0x23')](function(_0x520236){if(_0x520236){_0x1b9aca=_0x520236[_0x97f6('0x33')];if(!_0x1acd87[_0x97f6('0x2f')][_0x97f6('0x34')](_0x97f6('0x35'))){_0x3576bf[_0x97f6('0x1b')]=qs['limit'](_0x1acd87[_0x97f6('0x2f')][_0x97f6('0x1b')]);_0x3576bf['offset']=qs[_0x97f6('0x19')](_0x1acd87[_0x97f6('0x2f')][_0x97f6('0x19')]);}return _0x23406a[_0x97f6('0x68')](_0x3576bf);}})[_0x97f6('0x23')](function(_0x228fde){if(_0x228fde){return _0x228fde?{'count':_0x1b9aca,'rows':_0x228fde}:null;}})[_0x97f6('0x23')](respondWithResult(_0x58def1,null))[_0x97f6('0x3f')](handleError(_0x58def1,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 7f1f721..3430e30 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2c0=['../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x12a46b,_0x33f441){var _0x53e16e=function(_0x11df48){while(--_0x11df48){_0x12a46b['push'](_0x12a46b['shift']());}};_0x53e16e(++_0x33f441);}(_0xd2c0,0x176));var _0x0d2c=function(_0x5bdca8,_0x1ec986){_0x5bdca8=_0x5bdca8-0x0;var _0x462691=_0xd2c0[_0x5bdca8];return _0x462691;};'use strict';var _=require(_0x0d2c('0x0'));var util=require(_0x0d2c('0x1'));var logger=require(_0x0d2c('0x2'))('api');var moment=require(_0x0d2c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d2c('0x4'));var rimraf=require(_0x0d2c('0x5'));var config=require(_0x0d2c('0x6'));var attributes=require(_0x0d2c('0x7'));module['exports']=function(_0x5a9f1f,_0x4393b5){return _0x5a9f1f[_0x0d2c('0x8')](_0x0d2c('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd09a=['VoiceMusicOnHold','voice_musiconhold','api','moment','bluebird','request-promise','path','define'];(function(_0x4b5f1f,_0x1fee93){var _0x3bb747=function(_0x235c2b){while(--_0x235c2b){_0x4b5f1f['push'](_0x4b5f1f['shift']());}};_0x3bb747(++_0x1fee93);}(_0xd09a,0x102));var _0xad09=function(_0x51f91a,_0x5ba489){_0x51f91a=_0x51f91a-0x0;var _0x34bda5=_0xd09a[_0x51f91a];return _0x34bda5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xad09('0x0'));var moment=require(_0xad09('0x1'));var BPromise=require(_0xad09('0x2'));var rp=require(_0xad09('0x3'));var fs=require('fs');var path=require(_0xad09('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x987eac,_0x4b894a){return _0x987eac[_0xad09('0x5')](_0xad09('0x6'),attributes,{'tableName':_0xad09('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 5ee9105..8114f4a 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1f1b56,_0xee30aa){var _0x342eef=function(_0x123301){while(--_0x123301){_0x1f1b56['push'](_0x1f1b56['shift']());}};_0x342eef(++_0xee30aa);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x43fc3a,_0x5767b5){var _0x2809a5=function(_0x2d3e32){while(--_0x2d3e32){_0x43fc3a['push'](_0x43fc3a['shift']());}};_0x2809a5(++_0x5767b5);}(_0x34e8,0x12c));var _0x834e=function(_0x2efafa,_0x30aff5){_0x2efafa=_0x2efafa-0x0;var _0x402f6c=_0x34e8[_0x2efafa];return _0x402f6c;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index d35dfc5..94f2a1c 100644 --- a/server/api/voicePrefix/index.js +++ b/server/api/voicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c5a=['create','addAgents','addTeams','put','/:id','update','delete','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','isAuthenticated','show','/:id/users','/:id/teams','getTeams','post'];(function(_0x2858f4,_0x5beb17){var _0x482446=function(_0x48563a){while(--_0x48563a){_0x2858f4['push'](_0x2858f4['shift']());}};_0x482446(++_0x5beb17);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x10ffd5,_0x31e6ae){_0x10ffd5=_0x10ffd5-0x0;var _0x33049b=_0x9c5a[_0x10ffd5];return _0x33049b;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./voicePrefix.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xc')]);router['get'](_0xa9c5('0xd'),auth[_0xa9c5('0xb')](),controller['getAgents']);router['get'](_0xa9c5('0xe'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xf')]);router[_0xa9c5('0x10')]('/',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x11')]);router[_0xa9c5('0x10')](_0xa9c5('0xd'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x12')]);router['post'](_0xa9c5('0xe'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x13')]);router[_0xa9c5('0x14')](_0xa9c5('0x15'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x16')]);router[_0xa9c5('0x17')](_0xa9c5('0x15'),auth[_0xa9c5('0xb')](),controller['destroy']);router[_0xa9c5('0x17')](_0xa9c5('0xd'),auth[_0xa9c5('0xb')](),controller['removeAgents']);router[_0xa9c5('0x17')](_0xa9c5('0xe'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x18')]);module[_0xa9c5('0x19')]=router; \ No newline at end of file +var _0x10ab=['getTeams','post','create','addAgents','addTeams','put','/:id','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','/:id/teams'];(function(_0x4026f9,_0x3bfb79){var _0x2d0972=function(_0x572be5){while(--_0x572be5){_0x4026f9['push'](_0x4026f9['shift']());}};_0x2d0972(++_0x3bfb79);}(_0x10ab,0x178));var _0xb10a=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0x10ab[_0x4695ba];return _0x524b7d;};'use strict';var multer=require(_0xb10a('0x0'));var util=require(_0xb10a('0x1'));var path=require('path');var timeout=require(_0xb10a('0x2'));var express=require('express');var router=express[_0xb10a('0x3')]();var fs_extra=require(_0xb10a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb10a('0x5'));var config=require(_0xb10a('0x6'));var controller=require('./voicePrefix.controller');router[_0xb10a('0x7')]('/',auth[_0xb10a('0x8')](),controller[_0xb10a('0x9')]);router[_0xb10a('0x7')](_0xb10a('0xa'),auth[_0xb10a('0x8')](),controller[_0xb10a('0xb')]);router[_0xb10a('0x7')]('/:id',auth[_0xb10a('0x8')](),controller[_0xb10a('0xc')]);router[_0xb10a('0x7')](_0xb10a('0xd'),auth[_0xb10a('0x8')](),controller[_0xb10a('0xe')]);router[_0xb10a('0x7')](_0xb10a('0xf'),auth[_0xb10a('0x8')](),controller[_0xb10a('0x10')]);router[_0xb10a('0x11')]('/',auth[_0xb10a('0x8')](),controller[_0xb10a('0x12')]);router['post']('/:id/users',auth[_0xb10a('0x8')](),controller[_0xb10a('0x13')]);router[_0xb10a('0x11')](_0xb10a('0xf'),auth[_0xb10a('0x8')](),controller[_0xb10a('0x14')]);router[_0xb10a('0x15')](_0xb10a('0x16'),auth[_0xb10a('0x8')](),controller[_0xb10a('0x17')]);router[_0xb10a('0x18')](_0xb10a('0x16'),auth[_0xb10a('0x8')](),controller[_0xb10a('0x19')]);router['delete'](_0xb10a('0xd'),auth['isAuthenticated'](),controller['removeAgents']);router[_0xb10a('0x18')](_0xb10a('0xf'),auth['isAuthenticated'](),controller[_0xb10a('0x1a')]);module[_0xb10a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ac06ea5..07af80f 100644 --- a/server/api/voicePrefix/voicePrefix.attributes.js +++ b/server/api/voicePrefix/voicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ebc=['INTEGER','sequelize','exports','STRING','name','system-','getDataValue'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0x6ebc,0x78));var _0xc6eb=function(_0xce3a0b,_0x5b271b){_0xce3a0b=_0xce3a0b-0x0;var _0x1ca1b9=_0x6ebc[_0xce3a0b];return _0x1ca1b9;};'use strict';var Sequelize=require(_0xc6eb('0x0'));module[_0xc6eb('0x1')]={'name':{'type':Sequelize[_0xc6eb('0x2')],'allowNull':![],'unique':_0xc6eb('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x14e47e){return _0xc6eb('0x4')+this[_0xc6eb('0x5')](_0xc6eb('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xc6eb('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xc6eb('0x6')]}}; \ No newline at end of file +var _0xc555=['getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x17259f,_0x19d960){var _0x28ae7d=function(_0x4a4c1a){while(--_0x4a4c1a){_0x17259f['push'](_0x17259f['shift']());}};_0x28ae7d(++_0x19d960);}(_0xc555,0x102));var _0x5c55=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xc555[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x5c55('0x0'));module[_0x5c55('0x1')]={'name':{'type':Sequelize[_0x5c55('0x2')],'allowNull':![],'unique':_0x5c55('0x3')},'prefix':{'type':Sequelize[_0x5c55('0x4')],'get':function(_0x267fb7){return _0x5c55('0x5')+this[_0x5c55('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x5c55('0x2')]},'callerIdAll':{'type':Sequelize[_0x5c55('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x5c55('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 20f10ab..eb1878f 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4888=['send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','describe','create','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','SELECT','every','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name'];(function(_0xc9a48e,_0x4d3e72){var _0x419127=function(_0x186d3c){while(--_0x186d3c){_0xc9a48e['push'](_0xc9a48e['shift']());}};_0x419127(++_0x4d3e72);}(_0x4888,0x198));var _0x8488=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4888[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];config[_0x8488('0x17')]=_[_0x8488('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8488('0x19'))(new Redis(config['redis']));require(_0x8488('0x1a'))['register'](socket);function respondWithStatusCode(_0x5161a3,_0x24d0a0){_0x24d0a0=_0x24d0a0||0xcc;return function(_0x3635da){if(_0x3635da){return _0x5161a3[_0x8488('0x1b')](_0x24d0a0);}return _0x5161a3[_0x8488('0x1c')](_0x24d0a0)[_0x8488('0x1d')]();};}function respondWithResult(_0x8d3b3d,_0x165139){_0x165139=_0x165139||0xc8;return function(_0x4e44af){if(_0x4e44af){return _0x8d3b3d[_0x8488('0x1c')](_0x165139)[_0x8488('0x1e')](_0x4e44af);}};}function respondWithFilteredResult(_0x3edfe4,_0x37361d){return function(_0x60ae2f){if(_0x60ae2f){var _0x39775f=typeof _0x37361d[_0x8488('0x1f')]===_0x8488('0x20')&&typeof _0x37361d[_0x8488('0x21')]===_0x8488('0x20');var _0x10bfd6=_0x60ae2f[_0x8488('0x22')];var _0x3dd93e=_0x39775f?0x0:_0x37361d['offset'];var _0x4a1b45=_0x39775f?_0x60ae2f[_0x8488('0x22')]:_0x37361d[_0x8488('0x1f')]+_0x37361d[_0x8488('0x21')];var _0x3c9fc2;if(_0x4a1b45>=_0x10bfd6){_0x4a1b45=_0x10bfd6;_0x3c9fc2=0xc8;}else{_0x3c9fc2=0xce;}_0x3edfe4[_0x8488('0x1c')](_0x3c9fc2);return _0x3edfe4[_0x8488('0x23')](_0x8488('0x24'),_0x3dd93e+'-'+_0x4a1b45+'/'+_0x10bfd6)[_0x8488('0x1e')](_0x60ae2f);}return null;};}function patchUpdates(_0x39dd43){return function(_0x5123d0){try{jsonpatch[_0x8488('0x25')](_0x5123d0,_0x39dd43,!![]);}catch(_0x4e07e1){return BPromise[_0x8488('0x26')](_0x4e07e1);}return _0x5123d0[_0x8488('0x27')]();};}function saveUpdates(_0x290b33,_0x54ecda){return function(_0x577234){if(_0x577234){return _0x577234['update'](_0x290b33)['then'](function(_0x472624){return _0x472624;});}return null;};}function removeEntity(_0x51fe30,_0x58057a){return function(_0x26bdbb){if(_0x26bdbb){return _0x26bdbb[_0x8488('0x28')]()[_0x8488('0x29')](function(){var _0x6ebee0=_0x26bdbb[_0x8488('0x2a')]({'plain':!![]});var _0x503b83=_0x8488('0x2b');return db[_0x8488('0x2c')][_0x8488('0x28')]({'where':{'type':_0x503b83,'resourceId':_0x6ebee0['id']}})[_0x8488('0x29')](function(){return _0x26bdbb;});})[_0x8488('0x29')](function(){_0x51fe30[_0x8488('0x1c')](0xcc)[_0x8488('0x1d')]();});}};}function handleEntityNotFound(_0x296b6c,_0x368f9c){return function(_0x1d9317){if(!_0x1d9317){_0x296b6c[_0x8488('0x1b')](0x194);}return _0x1d9317;};}function handleError(_0x58d0cc,_0x57ce3c){_0x57ce3c=_0x57ce3c||0x1f4;return function(_0x4e3fe2){logger[_0x8488('0x2d')](_0x4e3fe2[_0x8488('0x2e')]);if(_0x4e3fe2[_0x8488('0x2f')]){delete _0x4e3fe2[_0x8488('0x2f')];}_0x58d0cc[_0x8488('0x1c')](_0x57ce3c)[_0x8488('0x30')](_0x4e3fe2);};}exports['index']=function(_0x2292e0,_0x14f378){var _0x208753={},_0x3649f7={},_0x18eb27={'count':0x0,'rows':[]};var _0x501981=_[_0x8488('0x31')](db[_0x8488('0x32')]['rawAttributes'],function(_0x1b0637){return{'name':_0x1b0637[_0x8488('0x33')],'type':_0x1b0637[_0x8488('0x34')][_0x8488('0x35')]};});_0x3649f7[_0x8488('0x36')]=_['map'](_0x501981,_0x8488('0x2f'));_0x3649f7[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2292e0['query']);_0x3649f7[_0x8488('0x39')]=_['intersection'](_0x3649f7[_0x8488('0x36')],_0x3649f7[_0x8488('0x37')]);_0x208753[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x3649f7['model'],qs[_0x8488('0x3c')](_0x2292e0[_0x8488('0x37')][_0x8488('0x3c')]));_0x208753['attributes']=_0x208753[_0x8488('0x3a')][_0x8488('0x3d')]?_0x208753[_0x8488('0x3a')]:_0x3649f7[_0x8488('0x36')];if(!_0x2292e0[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x208753[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2292e0[_0x8488('0x37')][_0x8488('0x21')]);_0x208753['offset']=qs['offset'](_0x2292e0[_0x8488('0x37')][_0x8488('0x1f')]);}_0x208753[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2292e0[_0x8488('0x37')][_0x8488('0x41')]);_0x208753[_0x8488('0x42')]=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x2292e0['query'],_0x3649f7[_0x8488('0x39')]),_0x501981);if(_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]){_0x208753['where']=_[_0x8488('0x45')](_0x208753[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x501981,function(_0x28bc84){if(_0x28bc84[_0x8488('0x34')]!==_0x8488('0x46')){var _0x1aac4b={};_0x1aac4b[_0x28bc84['name']]={'$like':'%'+_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x1aac4b;}})});}_0x208753=_[_0x8488('0x45')]({},_0x208753,_0x2292e0['options']);var _0x3649ae={'where':_0x208753['where']};return db[_0x8488('0x32')][_0x8488('0x22')](_0x3649ae)['then'](function(_0x22a3f3){_0x18eb27[_0x8488('0x22')]=_0x22a3f3;if(_0x2292e0[_0x8488('0x37')][_0x8488('0x47')]){_0x208753[_0x8488('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0x8488('0x49')](_0x208753);})['then'](function(_0x3440ae){_0x18eb27[_0x8488('0x4a')]=_0x3440ae;return _0x18eb27;})[_0x8488('0x29')](respondWithFilteredResult(_0x14f378,_0x208753))[_0x8488('0x4b')](handleError(_0x14f378,null));};exports[_0x8488('0x4c')]=function(_0x3dd1cb,_0x1ae9af){var _0x192617={'raw':![],'where':{'id':_0x3dd1cb[_0x8488('0x4d')]['id']}},_0xfe2e8f={};_0xfe2e8f[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x32')][_0x8488('0x4e')]);_0xfe2e8f[_0x8488('0x37')]=_[_0x8488('0x38')](_0x3dd1cb[_0x8488('0x37')]);_0xfe2e8f['filters']=_[_0x8488('0x3b')](_0xfe2e8f[_0x8488('0x36')],_0xfe2e8f[_0x8488('0x37')]);_0x192617[_0x8488('0x3a')]=_['intersection'](_0xfe2e8f[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x3dd1cb[_0x8488('0x37')][_0x8488('0x3c')]));_0x192617['attributes']=_0x192617[_0x8488('0x3a')][_0x8488('0x3d')]?_0x192617[_0x8488('0x3a')]:_0xfe2e8f[_0x8488('0x36')];if(_0x3dd1cb[_0x8488('0x37')][_0x8488('0x47')]){_0x192617[_0x8488('0x48')]=[{'all':!![]}];}_0x192617=_[_0x8488('0x45')]({},_0x192617,_0x3dd1cb[_0x8488('0x4f')]);return db[_0x8488('0x32')][_0x8488('0x50')](_0x192617)[_0x8488('0x29')](handleEntityNotFound(_0x1ae9af,null))[_0x8488('0x29')](respondWithResult(_0x1ae9af,null))['catch'](handleError(_0x1ae9af,null));};exports['destroy']=function(_0x8267e1,_0x1a66ff){return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x8267e1[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x1a66ff,null))[_0x8488('0x29')](removeEntity(_0x1a66ff,null))[_0x8488('0x4b')](handleError(_0x1a66ff,null));};exports[_0x8488('0x51')]=function(_0x481975,_0x474a0b){return db[_0x8488('0x32')]['describe']()[_0x8488('0x29')](respondWithResult(_0x474a0b,null))[_0x8488('0x4b')](handleError(_0x474a0b,null));};exports[_0x8488('0x52')]=function(_0x1ff9c5,_0x4f80fb){var _0x198328;return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x5c55bf){return db[_0x8488('0x32')][_0x8488('0x52')](_0x1ff9c5[_0x8488('0x55')],{'transaction':_0x5c55bf})[_0x8488('0x29')](function(_0x48caa1){_0x198328=_0x48caa1[_0x8488('0x2a')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x198328[_0x8488('0x56')]},'raw':!![]})['then'](function(_0x3453c7){return createVoicePrefixExtensions(_0x198328,_0x3453c7,_0x5c55bf);});});})[_0x8488('0x29')](function(){var _0x417afa=_0x1ff9c5[_0x8488('0x57')][_0x8488('0x2a')]({'plain':!![]});if(!_0x417afa)throw new Error(_0x8488('0x58'));if(_0x417afa['role']===_0x8488('0x57')){var _0x693741=_0x198328;return db[_0x8488('0x59')][_0x8488('0x50')]({'where':{'name':_0x8488('0x2b'),'userProfileId':_0x417afa['userProfileId']},'raw':!![]})[_0x8488('0x29')](function(_0x5a04d7){if(_0x5a04d7&&_0x5a04d7[_0x8488('0x5a')]===0x0){return db[_0x8488('0x2c')]['create']({'name':_0x693741[_0x8488('0x2f')],'resourceId':_0x693741['id'],'type':_0x5a04d7[_0x8488('0x2f')],'sectionId':_0x5a04d7['id']},{})[_0x8488('0x29')](function(){return _0x198328;});}else{return _0x198328;}})[_0x8488('0x4b')](function(_0x4041e5){logger[_0x8488('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4041e5);throw _0x4041e5;});}return _0x198328;})[_0x8488('0x29')](respondWithResult(_0x4f80fb,null))['catch'](handleError(_0x4f80fb,null));};function Extension(_0x31dcc6,_0x3fa6e2,_0x3c06a4,_0x3fa288){this[_0x8488('0x5b')]=_0x8488('0x5c');this['exten']=_0x31dcc6;this[_0x8488('0x5d')]=_0x3c06a4;this['type']=_0x8488('0x5e');this[_0x8488('0x5f')]=_0x8488('0x60');this[_0x8488('0x61')]=_0x3fa6e2;this[_0x8488('0x62')]=_0x3fa288;}function createVoicePrefixExtensions(_0x24ba2d,_0x4facfb,_0x5755af){return new BPromise(function(_0x5c8310,_0x28ddb0){var _0x1988cf=new Extension(formatPrefixName(_0x24ba2d[_0x8488('0x63')]),0x1,_0x8488('0x64'),_0x8488('0x65'));_0x1988cf[_0x8488('0x66')]=_0x24ba2d['id'];return db[_0x8488('0x67')][_0x8488('0x52')](_0x1988cf,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0xa90a65){var _0x57fdbb=_0xa90a65[_0x8488('0x2a')]({'plain':!![]});var _0x174c57=_[_0x8488('0x31')](addVoicePrefixExtensions(_0x24ba2d,_0x4facfb),function(_0x4ba14e){_0x4ba14e['VoiceExtensionId']=_0x57fdbb['id'];_0x4ba14e[_0x8488('0x66')]=_0x24ba2d['id'];return _0x4ba14e;});return db[_0x8488('0x67')][_0x8488('0x68')](_0x174c57,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0x52bc90){if(!_0x52bc90){return _0x28ddb0('Extensions\x20creation\x20failed');}else{return _0x5c8310(_0x52bc90);}})[_0x8488('0x4b')](function(_0x26e0cc){return _0x28ddb0(_0x26e0cc);});});;});};function addVoicePrefixExtensions(_0x50897,_0x4856fc){var _0x3c3e89=[];var _0x401f4d=formatPrefixName(_0x50897[_0x8488('0x63')]);_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x2,_0x8488('0x6a'),'CDR(prefix)='+_0x50897[_0x8488('0x2f')]));if(_0x50897[_0x8488('0x6b')]){_0x3c3e89['push'](new Extension(_0x401f4d,0x3,_0x8488('0x6a'),_0x8488('0x6c')+_0x50897['callerIdAll']));}else{_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x3,_0x8488('0x64'),_0x8488('0x6d')));}_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x4,_0x8488('0x6e'),_0x4856fc[_0x8488('0x5b')]+','+_0x8488('0x6f')+(0x8+_0x50897['name'][_0x8488('0x3d')])+'}'+','+0x1));return _0x3c3e89;}function formatPrefixName(_0x3b7aa8){var _0x480666='_';for(var _0x49ef10=0x0;_0x49ef10<_0x3b7aa8[_0x8488('0x3d')];_0x49ef10++){if(_0x3b7aa8[_0x8488('0x70')](_0x49ef10)=='-'){_0x480666+=_0x3b7aa8[_0x8488('0x70')](_0x49ef10);}else{_0x480666+='['+_0x3b7aa8['charAt'](_0x49ef10)+']';}}_0x480666+='.';return _0x480666;}exports[_0x8488('0x71')]=function(_0x852e08,_0x56b35a,_0x42b5c5){var _0x59da4a=_0x852e08[_0x8488('0x55')];_0x59da4a[_0x8488('0x63')]=_0x8488('0x72')+_0x59da4a['name']+'-';return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x57955d){return db['VoicePrefix'][_0x8488('0x71')](_0x59da4a,{'where':{'id':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x28')]({'where':{'VoicePrefixId':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x50')]({'where':{'id':_0x59da4a[_0x8488('0x56')]},'raw':!![]})[_0x8488('0x29')](function(_0x1ff111){return createVoicePrefixExtensions(_0x59da4a,_0x1ff111,_0x57955d);});});});})['then'](function(){return db[_0x8488('0x32')]['findById'](_0x59da4a['id']);})[_0x8488('0x29')](respondWithResult(_0x56b35a,null))[_0x8488('0x4b')](handleError(_0x56b35a,null));};exports[_0x8488('0x73')]=function(_0x3349e3,_0x54283a,_0x1b96c5){return db[_0x8488('0x32')]['find']({'where':{'id':_0x3349e3[_0x8488('0x4d')]['id']}})['then'](handleEntityNotFound(_0x54283a,null))[_0x8488('0x29')](function(_0x15b919){if(_0x15b919){return _0x15b919[_0x8488('0x73')](_0x3349e3[_0x8488('0x55')][_0x8488('0x74')],_[_0x8488('0x75')](_0x3349e3[_0x8488('0x55')],[_0x8488('0x74'),'id'])||{})['spread'](function(_0x1ce726){for(var _0x53d87e=0x0;_0x53d87e<_0x3349e3['body'][_0x8488('0x74')][_0x8488('0x3d')];_0x53d87e+=0x1){socket[_0x8488('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x3349e3['body'][_0x8488('0x74')][_0x53d87e]),'VoicePrefixId':Number(_0x3349e3[_0x8488('0x4d')]['id'])});}return _0x1ce726;});}})['then'](respondWithResult(_0x54283a,null))[_0x8488('0x4b')](handleError(_0x54283a,null));};exports[_0x8488('0x77')]=function(_0x924138,_0x173d35,_0x2a3acf){return db[_0x8488('0x32')]['find']({'where':{'id':_0x924138[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x173d35,null))[_0x8488('0x29')](function(_0x4a2fd9){if(_0x4a2fd9){return _0x4a2fd9[_0x8488('0x77')](_0x924138[_0x8488('0x37')][_0x8488('0x74')])['then'](function(){if(_[_0x8488('0x78')](_0x924138[_0x8488('0x37')]['ids'])){for(var _0x48860c=0x0;_0x48860c<_0x924138[_0x8488('0x37')][_0x8488('0x74')]['length'];_0x48860c+=0x1){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':Number(_0x924138['query']['ids'][_0x48860c]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}}else{socket['emit'](_0x8488('0x79'),{'UserId':Number(_0x924138[_0x8488('0x37')][_0x8488('0x74')]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x173d35,null))[_0x8488('0x4b')](handleError(_0x173d35,null));};exports['getAgents']=function(_0x2b2989,_0x4d0d20,_0x2f137a){var _0x1a3a2d={};var _0x267401={};var _0x1e635a;var _0x31ab35;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x2b2989[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x4d0d20,null))[_0x8488('0x29')](function(_0xce1d1a){if(_0xce1d1a){_0x1e635a=_0xce1d1a;_0x267401[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x7b')]['rawAttributes']);_0x267401[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2b2989['query']);_0x267401[_0x8488('0x39')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],_0x267401[_0x8488('0x37')]);_0x1a3a2d[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x2b2989[_0x8488('0x37')][_0x8488('0x3c')]));_0x1a3a2d[_0x8488('0x3a')]=_0x1a3a2d['attributes'][_0x8488('0x3d')]?_0x1a3a2d[_0x8488('0x3a')]:_0x267401['model'];_0x1a3a2d[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2b2989[_0x8488('0x37')][_0x8488('0x41')]);_0x1a3a2d[_0x8488('0x42')]=qs['filters'](_['pick'](_0x2b2989[_0x8488('0x37')],_0x267401[_0x8488('0x39')]));if(_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]){_0x1a3a2d[_0x8488('0x42')]=_[_0x8488('0x45')](_0x1a3a2d[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x1a3a2d[_0x8488('0x3a')],function(_0x167437){var _0x3152d0={};_0x3152d0[_0x167437]={'$like':'%'+_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x3152d0;})});}_0x1a3a2d=_[_0x8488('0x45')]({},_0x1a3a2d,_0x2b2989[_0x8488('0x4f')]);return _0x1e635a['getAgents'](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x5d5234){if(_0x5d5234){_0x31ab35=_0x5d5234['length'];if(!_0x2b2989[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x1a3a2d[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2b2989[_0x8488('0x37')][_0x8488('0x21')]);_0x1a3a2d[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x2b2989[_0x8488('0x37')]['offset']);}return _0x1e635a[_0x8488('0x7c')](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x179637){if(_0x179637){return _0x179637?{'count':_0x31ab35,'rows':_0x179637}:null;}})[_0x8488('0x29')](respondWithResult(_0x4d0d20,null))[_0x8488('0x4b')](handleError(_0x4d0d20,null));};exports[_0x8488('0x7d')]=function(_0x47f7c5,_0x2d7a33,_0x5b0d69){var _0x36f6e4={};var _0x3936b6={};var _0x4be018;var _0x57a4e7;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x47f7c5[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x2d7a33,null))[_0x8488('0x29')](function(_0x5718a7){if(_0x5718a7){_0x4be018=_0x5718a7;_0x3936b6[_0x8488('0x36')]=_[_0x8488('0x38')](db['Team']['rawAttributes']);_0x3936b6[_0x8488('0x37')]=_[_0x8488('0x38')](_0x47f7c5[_0x8488('0x37')]);_0x3936b6['filters']=_['intersection'](_0x3936b6[_0x8488('0x36')],_0x3936b6[_0x8488('0x37')]);_0x36f6e4[_0x8488('0x3a')]=_['intersection'](_0x3936b6[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x3c')]));_0x36f6e4[_0x8488('0x3a')]=_0x36f6e4[_0x8488('0x3a')][_0x8488('0x3d')]?_0x36f6e4[_0x8488('0x3a')]:_0x3936b6[_0x8488('0x36')];_0x36f6e4[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x41')]);_0x36f6e4['where']=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x47f7c5[_0x8488('0x37')],_0x3936b6['filters']));if(_0x47f7c5[_0x8488('0x37')]['filter']){_0x36f6e4[_0x8488('0x42')]=_['merge'](_0x36f6e4['where'],{'$or':_[_0x8488('0x31')](_0x36f6e4['attributes'],function(_0x42f36b){var _0x186e19={};_0x186e19[_0x42f36b]={'$like':'%'+_0x47f7c5[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x186e19;})});}_0x36f6e4=_['merge']({},_0x36f6e4,_0x47f7c5[_0x8488('0x4f')]);return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})[_0x8488('0x29')](function(_0x37ca73){if(_0x37ca73){_0x57a4e7=_0x37ca73['length'];if(!_0x47f7c5[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x36f6e4[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x47f7c5['query']['limit']);_0x36f6e4[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x1f')]);}return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})['then'](function(_0x4806f8){if(_0x4806f8){return _0x4806f8?{'count':_0x57a4e7,'rows':_0x4806f8}:null;}})['then'](respondWithResult(_0x2d7a33,null))[_0x8488('0x4b')](handleError(_0x2d7a33,null));};exports[_0x8488('0x7e')]=function(_0x2bab71,_0x5dacab,_0x30aab3){var _0x6c2e31=_0x2bab71['body'][_0x8488('0x74')];var _0x20cdc8;return db[_0x8488('0x7f')][_0x8488('0x49')]({'where':{'id':_0x6c2e31},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id',_0x8488('0x2f'),_0x8488('0x81'),_0x8488('0x82'),_0x8488('0x83')],'raw':!![]}]})[_0x8488('0x29')](function(_0x13add2){if(_0x13add2){_0x20cdc8=_0x13add2;var _0xa0c692=_['flatMap'](_0x13add2,function(_0x8fc636){var _0x17c6e1=_0x8fc636['get']({'plain':!![]});return _0x17c6e1['Agents'];});return db['VoicePrefix'][_0x8488('0x50')]({'where':{'id':_0x2bab71[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](function(_0x4ba801){return db[_0x8488('0x53')]['transaction'](function(_0x447535){return _0x4ba801[_0x8488('0x7e')](_0x6c2e31,{'transaction':_0x447535})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0x20cdc8,function(_0x1e45ac){return db['TeamVoicePrefix'][_0x8488('0x85')]({'TeamId':_0x1e45ac['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},{'transaction':_0x447535});});})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0xa0c692,function(_0x584f02){return db['UserVoicePrefix'][_0x8488('0x86')]({'where':{'UserId':_0x584f02['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},'transaction':_0x447535});});})[_0x8488('0x29')](function(){_0xa0c692[_0x8488('0x87')](function(_0x2f8191){socket[_0x8488('0x76')](_0x8488('0x88'),{'UserId':_0x2f8191['id'],'VoicePrefixId':_0x4ba801['id']});});});});});}})[_0x8488('0x29')](respondWithStatusCode(_0x5dacab,null))[_0x8488('0x4b')](handleError(_0x5dacab,null));};exports[_0x8488('0x89')]=function(_0x1f5a8b,_0x1e7617,_0x315136){return db[_0x8488('0x7f')]['findAll']({'where':{'id':_0x1f5a8b['query'][_0x8488('0x74')]},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id'],'raw':!![]}]})[_0x8488('0x29')](handleEntityNotFound(_0x1e7617,null))[_0x8488('0x29')](function(_0x22f2de){var _0x280c77=_[_0x8488('0x31')](_0x22f2de,'id');var _0x2a822b=[];var _0x4d611a=[];var _0x46195e=squel[_0x8488('0x8a')]();_0x46195e[_0x8488('0x8b')]('tq.TeamId')[_0x8488('0x8c')](_0x8488('0x8d'),'tq')[_0x8488('0x8e')](_0x8488('0x8f'),'ut',_0x8488('0x90'))[_0x8488('0x42')](_0x8488('0x91'),_0x1f5a8b[_0x8488('0x4d')]['id']);for(var _0x4a7be5=0x0;_0x4a7be5<_0x22f2de['length'];_0x4a7be5+=0x1){let _0x548a7a=_0x22f2de[_0x4a7be5];for(var _0x215d7e=0x0;_0x215d7e<_0x548a7a[_0x8488('0x80')][_0x8488('0x3d')];_0x215d7e+=0x1){let _0x1865f5=_0x548a7a[_0x8488('0x80')][_0x215d7e];var _0x2966ec=_0x46195e['clone']();_0x2966ec[_0x8488('0x42')]('ut.UserId\x20=\x20?',_0x1865f5['id']);_0x4d611a[_0x8488('0x69')](db[_0x8488('0x53')][_0x8488('0x37')](_0x2966ec[_0x8488('0x92')](),{'type':db[_0x8488('0x53')]['QueryTypes'][_0x8488('0x93')]})[_0x8488('0x29')](function(_0x300294){if(_0x300294[_0x8488('0x3d')]===0x1){return _0x1865f5['id'];}else{var _0x14e4a9=_[_0x8488('0x94')](_[_0x8488('0x31')](_0x300294,'TeamId'),function(_0x36600b){return _['includes'](_0x280c77,_0x36600b);});if(_0x14e4a9){return _0x1865f5['id'];}}}));}}return BPromise['all'](_0x4d611a)[_0x8488('0x29')](function(_0x323343){_0x2a822b=_(_0x2a822b)['union'](_0x323343)[_0x8488('0x95')]()[_0x8488('0x96')]();return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x1f5a8b[_0x8488('0x4d')]['id']}})['then'](function(_0x541b76){return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x3e2f85){return _0x541b76[_0x8488('0x89')](_0x1f5a8b[_0x8488('0x37')]['ids'],{'transaction':_0x3e2f85})['then'](function(){if(!_[_0x8488('0x97')](_0x2a822b)){return _0x541b76[_0x8488('0x77')](_0x2a822b,{'transaction':_0x3e2f85});}})[_0x8488('0x29')](function(){_0x2a822b[_0x8488('0x87')](function(_0x258985){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':_0x258985,'VoicePrefixId':_0x541b76['id']});});});});});});})[_0x8488('0x29')](respondWithStatusCode(_0x1e7617,null))[_0x8488('0x4b')](handleError(_0x1e7617,null));}; \ No newline at end of file +var _0x28f2=['filter','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','catch','show','params','keys','merge','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','${EXTEN:','charAt','update','system-','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','getAgents','findOne','User','getTeams','pick','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','field','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','union','removeTeams','userVoicePrefix:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x392aea,_0x47d79a){var _0x237810=function(_0xbe1c0e){while(--_0xbe1c0e){_0x392aea['push'](_0x392aea['shift']());}};_0x237810(++_0x47d79a);}(_0x28f2,0x193));var _0x228f=function(_0x365fd5,_0x1d81c4){_0x365fd5=_0x365fd5-0x0;var _0x4a400e=_0x28f2[_0x365fd5];return _0x4a400e;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];config[_0x228f('0x1a')]=_[_0x228f('0x1b')](config[_0x228f('0x1a')],{'host':_0x228f('0x1c'),'port':0x18eb});var socket=require(_0x228f('0x1d'))(new Redis(config[_0x228f('0x1a')]));require('./voicePrefix.socket')[_0x228f('0x1e')](socket);function respondWithStatusCode(_0xfb6aff,_0x14d6fc){_0x14d6fc=_0x14d6fc||0xcc;return function(_0x31dc9e){if(_0x31dc9e){return _0xfb6aff[_0x228f('0x1f')](_0x14d6fc);}return _0xfb6aff[_0x228f('0x20')](_0x14d6fc)[_0x228f('0x21')]();};}function respondWithResult(_0x5b5abb,_0x5e4d20){_0x5e4d20=_0x5e4d20||0xc8;return function(_0x4cae4a){if(_0x4cae4a){return _0x5b5abb[_0x228f('0x20')](_0x5e4d20)[_0x228f('0x22')](_0x4cae4a);}};}function respondWithFilteredResult(_0x195e65,_0x5bf5a2){return function(_0x2d4819){if(_0x2d4819){var _0x4e1968=typeof _0x5bf5a2[_0x228f('0x23')]==='undefined'&&typeof _0x5bf5a2[_0x228f('0x24')]==='undefined';var _0x5aa203=_0x2d4819[_0x228f('0x25')];var _0x52da36=_0x4e1968?0x0:_0x5bf5a2[_0x228f('0x23')];var _0x139373=_0x4e1968?_0x2d4819[_0x228f('0x25')]:_0x5bf5a2[_0x228f('0x23')]+_0x5bf5a2[_0x228f('0x24')];var _0x313cf2;if(_0x139373>=_0x5aa203){_0x139373=_0x5aa203;_0x313cf2=0xc8;}else{_0x313cf2=0xce;}_0x195e65[_0x228f('0x20')](_0x313cf2);return _0x195e65[_0x228f('0x26')](_0x228f('0x27'),_0x52da36+'-'+_0x139373+'/'+_0x5aa203)['json'](_0x2d4819);}return null;};}function patchUpdates(_0x1e96d4){return function(_0x8f7004){try{jsonpatch[_0x228f('0x28')](_0x8f7004,_0x1e96d4,!![]);}catch(_0x3c00ad){return BPromise[_0x228f('0x29')](_0x3c00ad);}return _0x8f7004[_0x228f('0x2a')]();};}function saveUpdates(_0x33e882,_0x20c111){return function(_0x2dcf68){if(_0x2dcf68){return _0x2dcf68['update'](_0x33e882)[_0x228f('0x2b')](function(_0x306928){return _0x306928;});}return null;};}function removeEntity(_0x2b3553,_0x272c7d){return function(_0x3036d4){if(_0x3036d4){return _0x3036d4['destroy']()[_0x228f('0x2b')](function(){var _0x49efe9=_0x3036d4[_0x228f('0x2c')]({'plain':!![]});var _0x5afa52='VoicePrefixes';return db[_0x228f('0x2d')][_0x228f('0x2e')]({'where':{'type':_0x5afa52,'resourceId':_0x49efe9['id']}})[_0x228f('0x2b')](function(){return _0x3036d4;});})[_0x228f('0x2b')](function(){_0x2b3553[_0x228f('0x20')](0xcc)[_0x228f('0x21')]();});}};}function handleEntityNotFound(_0x2eaf4f,_0x2511e5){return function(_0xe67c83){if(!_0xe67c83){_0x2eaf4f[_0x228f('0x1f')](0x194);}return _0xe67c83;};}function handleError(_0x2ba4f5,_0x136a9e){_0x136a9e=_0x136a9e||0x1f4;return function(_0xc25917){logger[_0x228f('0x2f')](_0xc25917[_0x228f('0x30')]);if(_0xc25917['name']){delete _0xc25917[_0x228f('0x31')];}_0x2ba4f5[_0x228f('0x20')](_0x136a9e)[_0x228f('0x32')](_0xc25917);};}exports['index']=function(_0x32e0ce,_0x41be2d){var _0x5acf64={},_0x38375d={},_0x31abd0={'count':0x0,'rows':[]};var _0x45a67a=_[_0x228f('0x33')](db['VoicePrefix'][_0x228f('0x34')],function(_0x5201ba){return{'name':_0x5201ba[_0x228f('0x35')],'type':_0x5201ba[_0x228f('0x36')][_0x228f('0x37')]};});_0x38375d[_0x228f('0x38')]=_['map'](_0x45a67a,_0x228f('0x31'));_0x38375d[_0x228f('0x39')]=_['keys'](_0x32e0ce['query']);_0x38375d['filters']=_[_0x228f('0x3a')](_0x38375d[_0x228f('0x38')],_0x38375d[_0x228f('0x39')]);_0x5acf64[_0x228f('0x3b')]=_[_0x228f('0x3a')](_0x38375d[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x32e0ce[_0x228f('0x39')][_0x228f('0x3c')]));_0x5acf64['attributes']=_0x5acf64['attributes'][_0x228f('0x3d')]?_0x5acf64[_0x228f('0x3b')]:_0x38375d[_0x228f('0x38')];if(!_0x32e0ce[_0x228f('0x39')][_0x228f('0x3e')](_0x228f('0x3f'))){_0x5acf64[_0x228f('0x24')]=qs[_0x228f('0x24')](_0x32e0ce[_0x228f('0x39')][_0x228f('0x24')]);_0x5acf64['offset']=qs['offset'](_0x32e0ce[_0x228f('0x39')][_0x228f('0x23')]);}_0x5acf64[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x32e0ce['query'][_0x228f('0x41')]);_0x5acf64[_0x228f('0x42')]=qs['filters'](_['pick'](_0x32e0ce[_0x228f('0x39')],_0x38375d[_0x228f('0x43')]),_0x45a67a);if(_0x32e0ce['query'][_0x228f('0x44')]){_0x5acf64[_0x228f('0x42')]=_['merge'](_0x5acf64['where'],{'$or':_[_0x228f('0x33')](_0x45a67a,function(_0x5838e6){if(_0x5838e6[_0x228f('0x36')]!==_0x228f('0x45')){var _0x3da118={};_0x3da118[_0x5838e6[_0x228f('0x31')]]={'$like':'%'+_0x32e0ce[_0x228f('0x39')][_0x228f('0x44')]+'%'};return _0x3da118;}})});}_0x5acf64=_['merge']({},_0x5acf64,_0x32e0ce[_0x228f('0x46')]);var _0x5cdd16={'where':_0x5acf64[_0x228f('0x42')]};return db[_0x228f('0x47')][_0x228f('0x25')](_0x5cdd16)[_0x228f('0x2b')](function(_0x41cba5){_0x31abd0[_0x228f('0x25')]=_0x41cba5;if(_0x32e0ce[_0x228f('0x39')][_0x228f('0x48')]){_0x5acf64[_0x228f('0x49')]=[{'all':!![]}];}return db[_0x228f('0x47')][_0x228f('0x4a')](_0x5acf64);})[_0x228f('0x2b')](function(_0x19839d){_0x31abd0['rows']=_0x19839d;return _0x31abd0;})['then'](respondWithFilteredResult(_0x41be2d,_0x5acf64))[_0x228f('0x4b')](handleError(_0x41be2d,null));};exports[_0x228f('0x4c')]=function(_0x34cd3c,_0xbfa169){var _0x2f2b47={'raw':![],'where':{'id':_0x34cd3c[_0x228f('0x4d')]['id']}},_0x334fb1={};_0x334fb1[_0x228f('0x38')]=_[_0x228f('0x4e')](db[_0x228f('0x47')]['rawAttributes']);_0x334fb1[_0x228f('0x39')]=_[_0x228f('0x4e')](_0x34cd3c['query']);_0x334fb1[_0x228f('0x43')]=_['intersection'](_0x334fb1[_0x228f('0x38')],_0x334fb1['query']);_0x2f2b47[_0x228f('0x3b')]=_['intersection'](_0x334fb1[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x34cd3c[_0x228f('0x39')][_0x228f('0x3c')]));_0x2f2b47[_0x228f('0x3b')]=_0x2f2b47[_0x228f('0x3b')][_0x228f('0x3d')]?_0x2f2b47[_0x228f('0x3b')]:_0x334fb1[_0x228f('0x38')];if(_0x34cd3c[_0x228f('0x39')][_0x228f('0x48')]){_0x2f2b47[_0x228f('0x49')]=[{'all':!![]}];}_0x2f2b47=_[_0x228f('0x4f')]({},_0x2f2b47,_0x34cd3c[_0x228f('0x46')]);return db[_0x228f('0x47')][_0x228f('0x50')](_0x2f2b47)[_0x228f('0x2b')](handleEntityNotFound(_0xbfa169,null))[_0x228f('0x2b')](respondWithResult(_0xbfa169,null))[_0x228f('0x4b')](handleError(_0xbfa169,null));};exports['destroy']=function(_0x47cb21,_0xa538ce){return db[_0x228f('0x47')][_0x228f('0x50')]({'where':{'id':_0x47cb21['params']['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0xa538ce,null))[_0x228f('0x2b')](removeEntity(_0xa538ce,null))[_0x228f('0x4b')](handleError(_0xa538ce,null));};exports['describe']=function(_0x559490,_0x51db80){return db[_0x228f('0x47')][_0x228f('0x51')]()[_0x228f('0x2b')](respondWithResult(_0x51db80,null))[_0x228f('0x4b')](handleError(_0x51db80,null));};exports[_0x228f('0x52')]=function(_0x292c39,_0xafd0e4){var _0x30ff69;return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x43bbd2){return db[_0x228f('0x47')]['create'](_0x292c39[_0x228f('0x55')],{'transaction':_0x43bbd2})[_0x228f('0x2b')](function(_0x472035){_0x30ff69=_0x472035[_0x228f('0x2c')]({'plain':!![]});return db[_0x228f('0x56')][_0x228f('0x50')]({'where':{'id':_0x30ff69[_0x228f('0x57')]},'raw':!![]})[_0x228f('0x2b')](function(_0x4feefb){return createVoicePrefixExtensions(_0x30ff69,_0x4feefb,_0x43bbd2);});});})[_0x228f('0x2b')](function(){var _0x1c6114=_0x292c39[_0x228f('0x58')][_0x228f('0x2c')]({'plain':!![]});if(!_0x1c6114)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c6114[_0x228f('0x59')]===_0x228f('0x58')){var _0x4b516e=_0x30ff69;return db[_0x228f('0x5a')][_0x228f('0x50')]({'where':{'name':_0x228f('0x5b'),'userProfileId':_0x1c6114[_0x228f('0x5c')]},'raw':!![]})[_0x228f('0x2b')](function(_0x9d7417){if(_0x9d7417&&_0x9d7417[_0x228f('0x5d')]===0x0){return db[_0x228f('0x2d')][_0x228f('0x52')]({'name':_0x4b516e[_0x228f('0x31')],'resourceId':_0x4b516e['id'],'type':_0x9d7417['name'],'sectionId':_0x9d7417['id']},{})[_0x228f('0x2b')](function(){return _0x30ff69;});}else{return _0x30ff69;}})['catch'](function(_0x331b33){logger[_0x228f('0x2f')](_0x228f('0x5e'),_0x331b33);throw _0x331b33;});}return _0x30ff69;})[_0x228f('0x2b')](respondWithResult(_0xafd0e4,null))[_0x228f('0x4b')](handleError(_0xafd0e4,null));};function Extension(_0x2860dc,_0x1c8be4,_0xadb0e6,_0x56d70f){this[_0x228f('0x5f')]=_0x228f('0x60');this[_0x228f('0x61')]=_0x2860dc;this['app']=_0xadb0e6;this[_0x228f('0x36')]='system';this[_0x228f('0x62')]=_0x228f('0x63');this['priority']=_0x1c8be4;this[_0x228f('0x64')]=_0x56d70f;}function createVoicePrefixExtensions(_0x26fe6b,_0x16318d,_0xb8200d){return new BPromise(function(_0x3a0454,_0x651060){var _0x11b481=new Extension(formatPrefixName(_0x26fe6b[_0x228f('0x65')]),0x1,_0x228f('0x66'),_0x228f('0x67'));_0x11b481[_0x228f('0x68')]=_0x26fe6b['id'];return db['VoiceExtension'][_0x228f('0x52')](_0x11b481,{'transaction':_0xb8200d})[_0x228f('0x2b')](function(_0x1d4203){var _0x3be1f3=_0x1d4203[_0x228f('0x2c')]({'plain':!![]});var _0x506191=_['map'](addVoicePrefixExtensions(_0x26fe6b,_0x16318d),function(_0x14a732){_0x14a732['VoiceExtensionId']=_0x3be1f3['id'];_0x14a732[_0x228f('0x68')]=_0x26fe6b['id'];return _0x14a732;});return db['VoiceExtension'][_0x228f('0x69')](_0x506191,{'transaction':_0xb8200d})[_0x228f('0x2b')](function(_0x53a6a5){if(!_0x53a6a5){return _0x651060(_0x228f('0x6a'));}else{return _0x3a0454(_0x53a6a5);}})[_0x228f('0x4b')](function(_0x120ae1){return _0x651060(_0x120ae1);});});;});};function addVoicePrefixExtensions(_0x392270,_0x5f0b95){var _0x42dd54=[];var _0x21f860=formatPrefixName(_0x392270[_0x228f('0x65')]);_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x2,_0x228f('0x6c'),_0x228f('0x6d')+_0x392270[_0x228f('0x31')]));if(_0x392270[_0x228f('0x6e')]){_0x42dd54['push'](new Extension(_0x21f860,0x3,_0x228f('0x6c'),_0x228f('0x6f')+_0x392270[_0x228f('0x6e')]));}else{_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x3,_0x228f('0x66'),'No\x20callerid\x20available'));}_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x4,'goto',_0x5f0b95[_0x228f('0x5f')]+','+_0x228f('0x70')+(0x8+_0x392270['name'][_0x228f('0x3d')])+'}'+','+0x1));return _0x42dd54;}function formatPrefixName(_0x11a657){var _0x260e70='_';for(var _0x5eb9ed=0x0;_0x5eb9ed<_0x11a657[_0x228f('0x3d')];_0x5eb9ed++){if(_0x11a657[_0x228f('0x71')](_0x5eb9ed)=='-'){_0x260e70+=_0x11a657[_0x228f('0x71')](_0x5eb9ed);}else{_0x260e70+='['+_0x11a657[_0x228f('0x71')](_0x5eb9ed)+']';}}_0x260e70+='.';return _0x260e70;}exports[_0x228f('0x72')]=function(_0x5990e9,_0x221b3,_0x187f84){var _0x5718e1=_0x5990e9['body'];_0x5718e1[_0x228f('0x65')]=_0x228f('0x73')+_0x5718e1[_0x228f('0x31')]+'-';return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x1162ca){return db[_0x228f('0x47')][_0x228f('0x72')](_0x5718e1,{'where':{'id':_0x5718e1['id']},'transaction':_0x1162ca})['then'](function(){return db[_0x228f('0x56')]['destroy']({'where':{'VoicePrefixId':_0x5718e1['id']},'transaction':_0x1162ca})[_0x228f('0x2b')](function(){return db[_0x228f('0x56')][_0x228f('0x50')]({'where':{'id':_0x5718e1[_0x228f('0x57')]},'raw':!![]})[_0x228f('0x2b')](function(_0x32a32e){return createVoicePrefixExtensions(_0x5718e1,_0x32a32e,_0x1162ca);});});});})[_0x228f('0x2b')](function(){return db['VoicePrefix']['findById'](_0x5718e1['id']);})[_0x228f('0x2b')](respondWithResult(_0x221b3,null))[_0x228f('0x4b')](handleError(_0x221b3,null));};exports[_0x228f('0x74')]=function(_0x16776b,_0x6854c1,_0x29446b){return db['VoicePrefix'][_0x228f('0x50')]({'where':{'id':_0x16776b[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x6854c1,null))[_0x228f('0x2b')](function(_0x3fa413){if(_0x3fa413){return _0x3fa413[_0x228f('0x74')](_0x16776b[_0x228f('0x55')][_0x228f('0x75')],_[_0x228f('0x76')](_0x16776b['body'],[_0x228f('0x75'),'id'])||{})[_0x228f('0x77')](function(_0x47fe2b){for(var _0x1abf6d=0x0;_0x1abf6d<_0x16776b[_0x228f('0x55')]['ids']['length'];_0x1abf6d+=0x1){socket['emit'](_0x228f('0x78'),{'UserId':Number(_0x16776b['body'][_0x228f('0x75')][_0x1abf6d]),'VoicePrefixId':Number(_0x16776b['params']['id'])});}return _0x47fe2b;});}})[_0x228f('0x2b')](respondWithResult(_0x6854c1,null))[_0x228f('0x4b')](handleError(_0x6854c1,null));};exports['removeAgents']=function(_0x27ffdd,_0x16430e,_0x2dadc9){return db[_0x228f('0x47')][_0x228f('0x50')]({'where':{'id':_0x27ffdd['params']['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x16430e,null))[_0x228f('0x2b')](function(_0xa33189){if(_0xa33189){return _0xa33189[_0x228f('0x79')](_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')])[_0x228f('0x2b')](function(){if(_[_0x228f('0x7a')](_0x27ffdd[_0x228f('0x39')]['ids'])){for(var _0x74fe35=0x0;_0x74fe35<_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')]['length'];_0x74fe35+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x27ffdd[_0x228f('0x39')]['ids'][_0x74fe35]),'VoicePrefixId':Number(_0x27ffdd[_0x228f('0x4d')]['id'])});}}else{socket[_0x228f('0x7b')]('userVoicePrefix:remove',{'UserId':Number(_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')]),'VoicePrefixId':Number(_0x27ffdd['params']['id'])});}});}})[_0x228f('0x2b')](respondWithStatusCode(_0x16430e,null))[_0x228f('0x4b')](handleError(_0x16430e,null));};exports[_0x228f('0x7c')]=function(_0x32ea8d,_0x5b29d3,_0x268e71){var _0x3418b2={};var _0x2240de={};var _0x20f029;var _0x37ab8a;return db[_0x228f('0x47')][_0x228f('0x7d')]({'where':{'id':_0x32ea8d[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x5b29d3,null))['then'](function(_0x257aa6){if(_0x257aa6){_0x20f029=_0x257aa6;_0x2240de[_0x228f('0x38')]=_[_0x228f('0x4e')](db[_0x228f('0x7e')][_0x228f('0x34')]);_0x2240de['query']=_['keys'](_0x32ea8d[_0x228f('0x39')]);_0x2240de['filters']=_[_0x228f('0x3a')](_0x2240de['model'],_0x2240de[_0x228f('0x39')]);_0x3418b2['attributes']=_[_0x228f('0x3a')](_0x2240de[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x32ea8d[_0x228f('0x39')][_0x228f('0x3c')]));_0x3418b2[_0x228f('0x3b')]=_0x3418b2[_0x228f('0x3b')][_0x228f('0x3d')]?_0x3418b2[_0x228f('0x3b')]:_0x2240de[_0x228f('0x38')];_0x3418b2[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x32ea8d[_0x228f('0x39')][_0x228f('0x41')]);_0x3418b2[_0x228f('0x42')]=qs[_0x228f('0x43')](_['pick'](_0x32ea8d[_0x228f('0x39')],_0x2240de[_0x228f('0x43')]));if(_0x32ea8d[_0x228f('0x39')]['filter']){_0x3418b2[_0x228f('0x42')]=_['merge'](_0x3418b2['where'],{'$or':_['map'](_0x3418b2[_0x228f('0x3b')],function(_0x50ed6a){var _0x22448b={};_0x22448b[_0x50ed6a]={'$like':'%'+_0x32ea8d[_0x228f('0x39')]['filter']+'%'};return _0x22448b;})});}_0x3418b2=_[_0x228f('0x4f')]({},_0x3418b2,_0x32ea8d[_0x228f('0x46')]);return _0x20f029['getAgents'](_0x3418b2);}})[_0x228f('0x2b')](function(_0x620f5a){if(_0x620f5a){_0x37ab8a=_0x620f5a['length'];if(!_0x32ea8d['query'][_0x228f('0x3e')](_0x228f('0x3f'))){_0x3418b2[_0x228f('0x24')]=qs[_0x228f('0x24')](_0x32ea8d['query'][_0x228f('0x24')]);_0x3418b2[_0x228f('0x23')]=qs['offset'](_0x32ea8d[_0x228f('0x39')][_0x228f('0x23')]);}return _0x20f029[_0x228f('0x7c')](_0x3418b2);}})[_0x228f('0x2b')](function(_0x39aa20){if(_0x39aa20){return _0x39aa20?{'count':_0x37ab8a,'rows':_0x39aa20}:null;}})[_0x228f('0x2b')](respondWithResult(_0x5b29d3,null))[_0x228f('0x4b')](handleError(_0x5b29d3,null));};exports[_0x228f('0x7f')]=function(_0x5a1a8c,_0x5a7f73,_0x597271){var _0x548882={};var _0x47eba6={};var _0x5ac69a;var _0x182858;return db[_0x228f('0x47')][_0x228f('0x7d')]({'where':{'id':_0x5a1a8c[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x5a7f73,null))[_0x228f('0x2b')](function(_0x35aa2c){if(_0x35aa2c){_0x5ac69a=_0x35aa2c;_0x47eba6['model']=_[_0x228f('0x4e')](db['Team']['rawAttributes']);_0x47eba6['query']=_['keys'](_0x5a1a8c[_0x228f('0x39')]);_0x47eba6['filters']=_[_0x228f('0x3a')](_0x47eba6[_0x228f('0x38')],_0x47eba6[_0x228f('0x39')]);_0x548882[_0x228f('0x3b')]=_['intersection'](_0x47eba6[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x5a1a8c[_0x228f('0x39')][_0x228f('0x3c')]));_0x548882[_0x228f('0x3b')]=_0x548882[_0x228f('0x3b')][_0x228f('0x3d')]?_0x548882[_0x228f('0x3b')]:_0x47eba6[_0x228f('0x38')];_0x548882[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x5a1a8c['query']['sort']);_0x548882['where']=qs[_0x228f('0x43')](_[_0x228f('0x80')](_0x5a1a8c[_0x228f('0x39')],_0x47eba6[_0x228f('0x43')]));if(_0x5a1a8c[_0x228f('0x39')][_0x228f('0x44')]){_0x548882[_0x228f('0x42')]=_[_0x228f('0x4f')](_0x548882['where'],{'$or':_[_0x228f('0x33')](_0x548882[_0x228f('0x3b')],function(_0x433c1f){var _0xea049c={};_0xea049c[_0x433c1f]={'$like':'%'+_0x5a1a8c[_0x228f('0x39')][_0x228f('0x44')]+'%'};return _0xea049c;})});}_0x548882=_[_0x228f('0x4f')]({},_0x548882,_0x5a1a8c[_0x228f('0x46')]);return _0x5ac69a[_0x228f('0x7f')](_0x548882);}})['then'](function(_0x2db468){if(_0x2db468){_0x182858=_0x2db468[_0x228f('0x3d')];if(!_0x5a1a8c[_0x228f('0x39')]['hasOwnProperty']('nolimit')){_0x548882[_0x228f('0x24')]=qs['limit'](_0x5a1a8c[_0x228f('0x39')][_0x228f('0x24')]);_0x548882[_0x228f('0x23')]=qs[_0x228f('0x23')](_0x5a1a8c['query'][_0x228f('0x23')]);}return _0x5ac69a[_0x228f('0x7f')](_0x548882);}})[_0x228f('0x2b')](function(_0x237b92){if(_0x237b92){return _0x237b92?{'count':_0x182858,'rows':_0x237b92}:null;}})['then'](respondWithResult(_0x5a7f73,null))['catch'](handleError(_0x5a7f73,null));};exports[_0x228f('0x81')]=function(_0x578762,_0x19e488,_0x48c6ee){var _0x59b34c=_0x578762['body'][_0x228f('0x75')];var _0x4865e5;return db[_0x228f('0x82')][_0x228f('0x4a')]({'where':{'id':_0x59b34c},'attributes':['id'],'include':[{'model':db[_0x228f('0x7e')],'as':_0x228f('0x83'),'attributes':['id',_0x228f('0x31'),_0x228f('0x84'),_0x228f('0x85'),_0x228f('0x86')],'raw':!![]}]})[_0x228f('0x2b')](function(_0x1e8511){if(_0x1e8511){_0x4865e5=_0x1e8511;var _0x35363e=_[_0x228f('0x87')](_0x1e8511,function(_0x2f8379){var _0x38fca3=_0x2f8379[_0x228f('0x2c')]({'plain':!![]});return _0x38fca3[_0x228f('0x83')];});return db[_0x228f('0x47')]['find']({'where':{'id':_0x578762[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](function(_0x553895){return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x3a2c9c){return _0x553895[_0x228f('0x81')](_0x59b34c,{'transaction':_0x3a2c9c})['then'](function(){return BPromise[_0x228f('0x88')](_0x4865e5,function(_0x38da32){return db[_0x228f('0x89')][_0x228f('0x8a')]({'TeamId':_0x38da32['id'],'VoicePrefixId':_0x578762[_0x228f('0x4d')]['id']},{'transaction':_0x3a2c9c});});})['then'](function(){return BPromise['each'](_0x35363e,function(_0x25f726){return db[_0x228f('0x8b')]['findOrCreate']({'where':{'UserId':_0x25f726['id'],'VoicePrefixId':_0x578762[_0x228f('0x4d')]['id']},'transaction':_0x3a2c9c});});})[_0x228f('0x2b')](function(){_0x35363e[_0x228f('0x8c')](function(_0x525439){socket[_0x228f('0x7b')](_0x228f('0x78'),{'UserId':_0x525439['id'],'VoicePrefixId':_0x553895['id']});});});});});}})['then'](respondWithStatusCode(_0x19e488,null))[_0x228f('0x4b')](handleError(_0x19e488,null));};exports['removeTeams']=function(_0x29201c,_0x207d64,_0xff507b){return db[_0x228f('0x82')]['findAll']({'where':{'id':_0x29201c['query'][_0x228f('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x228f('0x83'),'attributes':['id'],'raw':!![]}]})[_0x228f('0x2b')](handleEntityNotFound(_0x207d64,null))[_0x228f('0x2b')](function(_0x16ebcf){var _0x21efb1=_['map'](_0x16ebcf,'id');var _0x3526b0=[];var _0x45da1f=[];var _0x69a9a5=squel['select']();_0x69a9a5[_0x228f('0x8d')]('tq.TeamId')[_0x228f('0x8e')](_0x228f('0x8f'),'tq')['join'](_0x228f('0x90'),'ut',_0x228f('0x91'))[_0x228f('0x42')](_0x228f('0x92'),_0x29201c['params']['id']);for(var _0x2b6a34=0x0;_0x2b6a34<_0x16ebcf[_0x228f('0x3d')];_0x2b6a34+=0x1){let _0x13ba88=_0x16ebcf[_0x2b6a34];for(var _0x106451=0x0;_0x106451<_0x13ba88[_0x228f('0x83')][_0x228f('0x3d')];_0x106451+=0x1){let _0x57b1d6=_0x13ba88[_0x228f('0x83')][_0x106451];var _0x22b0ff=_0x69a9a5[_0x228f('0x93')]();_0x22b0ff[_0x228f('0x42')](_0x228f('0x94'),_0x57b1d6['id']);_0x45da1f[_0x228f('0x6b')](db[_0x228f('0x53')]['query'](_0x22b0ff['toString'](),{'type':db[_0x228f('0x53')][_0x228f('0x95')][_0x228f('0x96')]})['then'](function(_0x348662){if(_0x348662[_0x228f('0x3d')]===0x1){return _0x57b1d6['id'];}else{var _0x3c83e1=_[_0x228f('0x97')](_[_0x228f('0x33')](_0x348662,_0x228f('0x98')),function(_0x437b8b){return _[_0x228f('0x99')](_0x21efb1,_0x437b8b);});if(_0x3c83e1){return _0x57b1d6['id'];}}}));}}return BPromise['all'](_0x45da1f)[_0x228f('0x2b')](function(_0x56d3ee){_0x3526b0=_(_0x3526b0)[_0x228f('0x9a')](_0x56d3ee)['compact']()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x29201c['params']['id']}})[_0x228f('0x2b')](function(_0x24a8ae){return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x298c83){return _0x24a8ae[_0x228f('0x9b')](_0x29201c[_0x228f('0x39')][_0x228f('0x75')],{'transaction':_0x298c83})[_0x228f('0x2b')](function(){if(!_['isEmpty'](_0x3526b0)){return _0x24a8ae[_0x228f('0x79')](_0x3526b0,{'transaction':_0x298c83});}})['then'](function(){_0x3526b0[_0x228f('0x8c')](function(_0x5830f7){socket['emit'](_0x228f('0x9c'),{'UserId':_0x5830f7,'VoicePrefixId':_0x24a8ae['id']});});});});});});})[_0x228f('0x2b')](respondWithStatusCode(_0x207d64,null))[_0x228f('0x4b')](handleError(_0x207d64,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6cba3af..dff27f9 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6687=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6687,0xe8));var _0x7668=function(_0x4eeb6f,_0x1979cd){_0x4eeb6f=_0x4eeb6f-0x0;var _0x384eb9=_0x6687[_0x4eeb6f];return _0x384eb9;};'use strict';var EventEmitter=require(_0x7668('0x0'));var VoicePrefix=require(_0x7668('0x1'))['db'][_0x7668('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7668('0x3')](0x0);var events={'afterCreate':_0x7668('0x4'),'afterUpdate':'update','afterDestroy':_0x7668('0x5')};function emitEvent(_0x3f515c){return function(_0x57c44d,_0x193adf,_0x1ff277){VoicePrefixEvents[_0x7668('0x6')](_0x3f515c+':'+_0x57c44d['id'],_0x57c44d);VoicePrefixEvents['emit'](_0x3f515c,_0x57c44d);_0x1ff277(null);};}for(var e in events){if(events[_0x7668('0x7')](e)){var event=events[e];VoicePrefix[_0x7668('0x8')](e,emitEvent(event));}}module[_0x7668('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0xdebb=['hook','exports','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5360b3,_0x23f19c){var _0xd28f39=function(_0x57d512){while(--_0x57d512){_0x5360b3['push'](_0x5360b3['shift']());}};_0xd28f39(++_0x23f19c);}(_0xdebb,0x1f1));var _0xbdeb=function(_0x5d31d6,_0xce7a0f){_0x5d31d6=_0x5d31d6-0x0;var _0x2f0387=_0xdebb[_0x5d31d6];return _0x2f0387;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xbdeb('0x0'))['db'][_0xbdeb('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xbdeb('0x2')](0x0);var events={'afterCreate':_0xbdeb('0x3'),'afterUpdate':'update','afterDestroy':_0xbdeb('0x4')};function emitEvent(_0x3946ba){return function(_0x4bf84c,_0x7678ed,_0x3918fb){VoicePrefixEvents[_0xbdeb('0x5')](_0x3946ba+':'+_0x4bf84c['id'],_0x4bf84c);VoicePrefixEvents['emit'](_0x3946ba,_0x4bf84c);_0x3918fb(null);};}for(var e in events){if(events[_0xbdeb('0x6')](e)){var event=events[e];VoicePrefix[_0xbdeb('0x7')](e,emitEvent(event));}}module[_0xbdeb('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 5482fdb..b3a48da 100644 --- a/server/api/voicePrefix/voicePrefix.model.js +++ b/server/api/voicePrefix/voicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5064=['../../config/environment','./voicePrefix.attributes','define','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x318c1b,_0x4af3ae){var _0x43bb7d=function(_0x2a17ab){while(--_0x2a17ab){_0x318c1b['push'](_0x318c1b['shift']());}};_0x43bb7d(++_0x4af3ae);}(_0x5064,0xdb));var _0x4506=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5064[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4506('0x0'));var util=require(_0x4506('0x1'));var logger=require(_0x4506('0x2'))('api');var moment=require(_0x4506('0x3'));var BPromise=require(_0x4506('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4506('0x5'));var rimraf=require('rimraf');var config=require(_0x4506('0x6'));var attributes=require(_0x4506('0x7'));module['exports']=function(_0x51e729,_0x2e9e03){return _0x51e729[_0x4506('0x8')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b84=['exports','define','VoicePrefix','voice_prefixes','lodash','util','moment','bluebird','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x937b4c,_0x23bbf7){var _0x43bc05=function(_0x4f83d4){while(--_0x4f83d4){_0x937b4c['push'](_0x937b4c['shift']());}};_0x43bc05(++_0x23bbf7);}(_0x8b84,0x88));var _0x48b8=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8b84[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x48b8('0x0'));var util=require(_0x48b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x48b8('0x2'));var BPromise=require(_0x48b8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x48b8('0x4'));var config=require(_0x48b8('0x5'));var attributes=require(_0x48b8('0x6'));module[_0x48b8('0x7')]=function(_0x19bed0,_0x348bba){return _0x19bed0[_0x48b8('0x8')](_0x48b8('0x9'),attributes,{'tableName':_0x48b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index e397b72..c8c976b 100644 --- a/server/api/voicePrefix/voicePrefix.rpc.js +++ b/server/api/voicePrefix/voicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7880=['defaults','localhost','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7880,0x1f4));var _0x0788=function(_0x4d05f8,_0x3efc70){_0x4d05f8=_0x4d05f8-0x0;var _0x220513=_0x7880[_0x4d05f8];return _0x220513;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});config[_0x0788('0xc')]=_[_0x0788('0xd')](config[_0x0788('0xc')],{'host':_0x0788('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0xc')]));require('./voicePrefix.socket')[_0x0788('0xf')](socket);function respondWithRpcPromise(_0x53b2f2,_0x433c26,_0x3c6d18){return new BPromise(function(_0x1f9ff6,_0xee8670){return client[_0x0788('0x10')](_0x53b2f2,_0x3c6d18)['then'](function(_0x1920b3){logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,_0x0788('0x13'));logger[_0x0788('0x14')](_0x0788('0x15'),_0x433c26,_0x0788('0x13'),JSON['stringify'](_0x1920b3));if(_0x1920b3[_0x0788('0x16')]){if(_0x1920b3[_0x0788('0x16')][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x433c26,_0x1920b3[_0x0788('0x16')]['message']);return _0xee8670(_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);}logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);return _0x1f9ff6(_0x1920b3['error']['message']);}else{logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,'request\x20sent');_0x1f9ff6(_0x1920b3[_0x0788('0x19')][_0x0788('0x18')]);}})[_0x0788('0x1a')](function(_0x52c339){logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x52c339);_0xee8670(_0x52c339);});});} \ No newline at end of file +var _0xef66=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0xef66,0x1db));var _0x6ef6=function(_0x49f0b1,_0x30ef17){_0x49f0b1=_0x49f0b1-0x0;var _0x8206d1=_0xef66[_0x49f0b1];return _0x8206d1;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var rs=require(_0x6ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ef6('0x5'));var logger=require(_0x6ef6('0x6'))(_0x6ef6('0x7'));var config=require(_0x6ef6('0x8'));var jayson=require(_0x6ef6('0x9'));var client=jayson[_0x6ef6('0xa')][_0x6ef6('0xb')]({'port':0x232a});config[_0x6ef6('0xc')]=_[_0x6ef6('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6ef6('0xe'))(new Redis(config[_0x6ef6('0xc')]));require(_0x6ef6('0xf'))[_0x6ef6('0x10')](socket);function respondWithRpcPromise(_0xc0ace,_0x49fed5,_0x1c719e){return new BPromise(function(_0x4bf459,_0x53db5e){return client[_0x6ef6('0x11')](_0xc0ace,_0x1c719e)['then'](function(_0x107bb4){logger[_0x6ef6('0x12')](_0x6ef6('0x13'),_0x49fed5,_0x6ef6('0x14'));logger['debug'](_0x6ef6('0x15'),_0x49fed5,_0x6ef6('0x14'),JSON[_0x6ef6('0x16')](_0x107bb4));if(_0x107bb4[_0x6ef6('0x17')]){if(_0x107bb4['error'][_0x6ef6('0x18')]===0x1f4){logger['error'](_0x6ef6('0x13'),_0x49fed5,_0x107bb4[_0x6ef6('0x17')]['message']);return _0x53db5e(_0x107bb4[_0x6ef6('0x17')][_0x6ef6('0x19')]);}logger[_0x6ef6('0x17')](_0x6ef6('0x13'),_0x49fed5,_0x107bb4[_0x6ef6('0x17')][_0x6ef6('0x19')]);return _0x4bf459(_0x107bb4[_0x6ef6('0x17')][_0x6ef6('0x19')]);}else{logger[_0x6ef6('0x12')](_0x6ef6('0x13'),_0x49fed5,'request\x20sent');_0x4bf459(_0x107bb4[_0x6ef6('0x1a')][_0x6ef6('0x19')]);}})[_0x6ef6('0x1b')](function(_0x37d2ef){logger[_0x6ef6('0x17')](_0x6ef6('0x13'),_0x49fed5,_0x37d2ef);_0x53db5e(_0x37d2ef);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index c309555..c393cbe 100644 --- a/server/api/voicePrefix/voicePrefix.socket.js +++ b/server/api/voicePrefix/voicePrefix.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x928c=['emit','register','voicePrefix:','remove','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x928c,0x17f));var _0xc928=function(_0x1d288f,_0x4ad29f){_0x1d288f=_0x1d288f-0x0;var _0x442f98=_0x928c[_0x1d288f];return _0x442f98;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xc928('0x0'),_0xc928('0x1')];function createListener(_0x597d43,_0x24354b){return function(_0x29bd30){_0x24354b[_0xc928('0x2')](_0x597d43,_0x29bd30);};}function removeListener(_0x3e4e60,_0x1dd54b){return function(){VoicePrefixEvents['removeListener'](_0x3e4e60,_0x1dd54b);};}exports[_0xc928('0x3')]=function(_0x4704bc){for(var _0x8c0fa5=0x0,_0x4ff9e6=events['length'];_0x8c0fa5<_0x4ff9e6;_0x8c0fa5++){var _0x5e433b=events[_0x8c0fa5];var _0x445248=createListener(_0xc928('0x4')+_0x5e433b,_0x4704bc);VoicePrefixEvents['on'](_0x5e433b,_0x445248);}}; \ No newline at end of file +var _0x5106=['removeListener','register','./voicePrefix.events','remove'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5106,0x116));var _0x6510=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5106[_0x321bb2];return _0x9c12ed;};'use strict';var VoicePrefixEvents=require(_0x6510('0x0'));var events=['save',_0x6510('0x1'),'update'];function createListener(_0x183717,_0x4b0419){return function(_0x579fe8){_0x4b0419['emit'](_0x183717,_0x579fe8);};}function removeListener(_0x25620c,_0x4465c2){return function(){VoicePrefixEvents[_0x6510('0x2')](_0x25620c,_0x4465c2);};}exports[_0x6510('0x3')]=function(_0x28cb6e){for(var _0x2f5cb3=0x0,_0x485cfa=events['length'];_0x2f5cb3<_0x485cfa;_0x2f5cb3++){var _0x57164e=events[_0x2f5cb3];var _0x226e1a=createListener('voicePrefix:'+_0x57164e,_0x28cb6e);VoicePrefixEvents['on'](_0x57164e,_0x226e1a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e1b436e..380db5e 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x4ee386,_0x1a9032){var _0x42450c=function(_0x51d08c){while(--_0x51d08c){_0x4ee386['push'](_0x4ee386['shift']());}};_0x42450c(++_0x1a9032);}(_0xb10b,0x12a));var _0xbb10=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xb10b[_0x8af54b];return _0x27d8f0;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x104eff,_0x39461c){var _0x4bdd79=function(_0x1d6fa9){while(--_0x1d6fa9){_0x104eff['push'](_0x104eff['shift']());}};_0x4bdd79(++_0x39461c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index e67e93d..13d2d22 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7cf=['join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','linear','wrandom','rrordered','rrmemory','type','getDataValue','strategy','preview','roundrobin','setDataValue','INTEGER','yes','all','once','periodic_announce'];(function(_0x4d22cb,_0x4bec43){var _0x17d848=function(_0x2d10d7){while(--_0x2d10d7){_0x4d22cb['push'](_0x4d22cb['shift']());}};_0x17d848(++_0x4bec43);}(_0xd7cf,0x132));var _0xfd7c=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xd7cf[_0x4d8dc3];return _0x9b03d9;};'use strict';var Sequelize=require(_0xfd7c('0x0'));module[_0xfd7c('0x1')]={'name':{'type':Sequelize[_0xfd7c('0x2')],'allowNull':![],'unique':_0xfd7c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x5'),_0xfd7c('0x6')),'allowNull':![],'defaultValue':_0xfd7c('0x5')},'musiconhold':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xfd7c('0x7'),_0xfd7c('0x8'),_0xfd7c('0x9'),_0xfd7c('0xa'),'rrmemory',_0xfd7c('0xb'),_0xfd7c('0xc'),_0xfd7c('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x345f82){this['setDataValue']('strategy',_0x345f82?_0x345f82:_0xfd7c('0xe'));},'get':function(){var _0x595bc5=this['getDataValue'](_0xfd7c('0xf'));var _0x5a0868=this[_0xfd7c('0x10')]('dialMethod');var _0x2d7d8e=this[_0xfd7c('0x10')](_0xfd7c('0x11'));if(_0x595bc5===_0xfd7c('0x6')){if(_0x5a0868===_0xfd7c('0x12')){return null;}if(_0x5a0868==='booked'&&!['rrmemory',_0xfd7c('0x13')]['includes'](_0x2d7d8e)){this[_0xfd7c('0x14')](_0xfd7c('0x11'),_0xfd7c('0xe'));}}return _0x2d7d8e;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xfd7c('0x15')](0xb)},'timeout':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xfd7c('0x16'),'no'),'defaultValue':_0xfd7c('0x16')},'autopause':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no',_0xfd7c('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xfd7c('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfd7c('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xfd7c('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':_0xfd7c('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xfd7c('0x16'),'no',_0xfd7c('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xfd7c('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xfd7c('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xfd7c('0x2')]},'queue_youarenext':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xfd7c('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xfd7c('0x2')]},'queue_quantity1':{'type':Sequelize[_0xfd7c('0x2')]},'queue_quantity2':{'type':Sequelize[_0xfd7c('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xfd7c('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x1886dc){this[_0xfd7c('0x14')](_0xfd7c('0x19'),_0x1886dc?_0x1886dc[_0xfd7c('0x1a')](','):[]);},'get':function(){return this[_0xfd7c('0x10')]('periodic_announce')?this[_0xfd7c('0x10')](_0xfd7c('0x19'))[_0xfd7c('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':_0xfd7c('0x16'),'set':function(_0x167db5){this[_0xfd7c('0x14')](_0xfd7c('0x1c'),_0x167db5?_0x167db5[_0xfd7c('0x1a')](','):undefined);},'get':function(){return this[_0xfd7c('0x10')](_0xfd7c('0x1c'))?this[_0xfd7c('0x10')](_0xfd7c('0x1c'))[_0xfd7c('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x394d2b){this[_0xfd7c('0x14')]('leavewhenempty',_0x394d2b?_0x394d2b[_0xfd7c('0x1a')](','):undefined);},'get':function(){return this[_0xfd7c('0x10')](_0xfd7c('0x1d'))?this[_0xfd7c('0x10')](_0xfd7c('0x1d'))[_0xfd7c('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xfd7c('0x2')]},'description':{'type':Sequelize[_0xfd7c('0x2')]},'acw':{'type':Sequelize[_0xfd7c('0x1e')],'defaultValue':0x0,'set':function(_0x906445){this[_0xfd7c('0x14')]('acw',_0x906445);if(_0x906445){if(this[_0xfd7c('0x10')](_0xfd7c('0x1f'))<0x2){this[_0xfd7c('0x14')](_0xfd7c('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xfd7c('0x1e')],'defaultValue':0x0,'comment':_0xfd7c('0x20')},'dialMethod':{'type':Sequelize['ENUM'](_0xfd7c('0x12'),_0xfd7c('0x21'),_0xfd7c('0x22'),_0xfd7c('0x23'),_0xfd7c('0x24')),'defaultValue':_0xfd7c('0x21'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xfd7c('0x15')](0x4)[_0xfd7c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfd7c('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfd7c('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xfd7c('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xfd7c('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x29'),_0xfd7c('0x2a')),'defaultValue':_0xfd7c('0x2a'),'comment':_0xfd7c('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfd7c('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xfd7c('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfd7c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':_0xfd7c('0x2f'),'comment':_0xfd7c('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x31')},'dialQueueProject':{'type':Sequelize[_0xfd7c('0x2')],'comment':_0xfd7c('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x34')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'comment':_0xfd7c('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfd7c('0x37')},'dialTimezone':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xfd7c('0x38')},'dialPrefix':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xfd7c('0x4')]('always',_0xfd7c('0x39'),_0xfd7c('0x3a')),'defaultValue':_0xfd7c('0x3b')},'dialAMDActive':{'type':Sequelize[_0xfd7c('0x1e')],'defaultValue':0x0,'comment':_0xfd7c('0x3c')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xfd7c('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfd7c('0x3d')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xfd7c('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfd7c('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xfd7c('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfd7c('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfd7c('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xfd7c('0x15')](0x9)[_0xfd7c('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfd7c('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfd7c('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfd7c('0x15')](0x9)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfd7c('0x15')](0x9)[_0xfd7c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xfd7c('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xfd7c('0x42')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfd7c('0x43')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xfd7c('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xfd7c('0x2')],'comment':_0xfd7c('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xfd7c('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfd7c('0x45')},'dialCutDigit':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfd7c('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfd7c('0x15')],'allowNull':!![],'comment':_0xfd7c('0x4f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfd7c('0x50'),'set':function(_0x466f4a){if(!_0x466f4a)this['setDataValue'](_0xfd7c('0x51'),null);this[_0xfd7c('0x14')](_0xfd7c('0x52'),_0x466f4a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xfd7c('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xfd7c('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0xf4f7=['type','getDataValue','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','ENUM','inbound','default','leastrecent','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf4f7,0x1e6));var _0x7f4f=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0xf4f7[_0x5c4f6b];return _0x104c4e;};'use strict';var Sequelize=require('sequelize');module[_0x7f4f('0x0')]={'name':{'type':Sequelize[_0x7f4f('0x1')],'allowNull':![],'unique':_0x7f4f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x4'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':_0x7f4f('0x5')},'announce':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x7f4f('0x3')]('rr','ringall',_0x7f4f('0x6'),'fewestcalls',_0x7f4f('0x7'),'rrmemory','linear',_0x7f4f('0x8'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x3a1296){this[_0x7f4f('0x9')](_0x7f4f('0xa'),_0x3a1296?_0x3a1296:_0x7f4f('0xb'));},'get':function(){var _0x97afe=this['getDataValue'](_0x7f4f('0xc'));var _0x201728=this[_0x7f4f('0xd')](_0x7f4f('0xe'));var _0x28f177=this[_0x7f4f('0xd')](_0x7f4f('0xa'));if(_0x97afe==='outbound'){if(_0x201728===_0x7f4f('0xf')){return null;}if(_0x201728===_0x7f4f('0x10')&&!['rrmemory',_0x7f4f('0x11')][_0x7f4f('0x12')](_0x28f177)){this['setDataValue'](_0x7f4f('0xa'),_0x7f4f('0xb'));}}return _0x28f177;}},'servicelevel':{'type':Sequelize[_0x7f4f('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7f4f('0x13')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7f4f('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7f4f('0x1')]},'weight':{'type':Sequelize[_0x7f4f('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7f4f('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x14'),'no',_0x7f4f('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7f4f('0x13')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x7f4f('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x7f4f('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7f4f('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7f4f('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7f4f('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7f4f('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x14'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x7f4f('0x14'),'no',_0x7f4f('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x7f4f('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x7f4f('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x7f4f('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7f4f('0x1')]},'queue_youarenext':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7f4f('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7f4f('0x1')]},'queue_quantity1':{'type':Sequelize[_0x7f4f('0x1')]},'queue_quantity2':{'type':Sequelize[_0x7f4f('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x7f4f('0x1')]},'queue_less_than':{'type':Sequelize[_0x7f4f('0x1')]},'periodic_announce':{'type':Sequelize[_0x7f4f('0x17')],'set':function(_0xf0d67a){this[_0x7f4f('0x9')](_0x7f4f('0x18'),_0xf0d67a?_0xf0d67a[_0x7f4f('0x19')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x7f4f('0xd')]('periodic_announce')[_0x7f4f('0x1a')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0xef3427){this[_0x7f4f('0x9')](_0x7f4f('0x1b'),_0xef3427?_0xef3427['join'](','):undefined);},'get':function(){return this[_0x7f4f('0xd')](_0x7f4f('0x1b'))?this[_0x7f4f('0xd')](_0x7f4f('0x1b'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':'no','set':function(_0x52636a){this['setDataValue'](_0x7f4f('0x1c'),_0x52636a?_0x52636a[_0x7f4f('0x19')](','):undefined);},'get':function(){return this[_0x7f4f('0xd')](_0x7f4f('0x1c'))?this['getDataValue'](_0x7f4f('0x1c'))[_0x7f4f('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7f4f('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x7f4f('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7f4f('0x1')]},'description':{'type':Sequelize[_0x7f4f('0x1')]},'acw':{'type':Sequelize[_0x7f4f('0x1d')],'defaultValue':0x0,'set':function(_0x20f0d4){this['setDataValue'](_0x7f4f('0x1e'),_0x20f0d4);if(_0x20f0d4){if(this[_0x7f4f('0xd')](_0x7f4f('0x1f'))<0x2){this[_0x7f4f('0x9')](_0x7f4f('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7f4f('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x7f4f('0x20')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x7f4f('0x21'),_0x7f4f('0x22'),_0x7f4f('0x23'),'booked'),'defaultValue':_0x7f4f('0x21'),'comment':_0x7f4f('0x24')},'dialLimitChannel':{'type':Sequelize[_0x7f4f('0x13')](0x4)[_0x7f4f('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7f4f('0x26')},'dialLimitQueue':{'type':Sequelize[_0x7f4f('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7f4f('0x27')},'dialPowerLevel':{'type':Sequelize[_0x7f4f('0x28')](0x2)[_0x7f4f('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7f4f('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x7f4f('0x3')]('agentBusyFactor','dropRate'),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7f4f('0x28')](0x2)[_0x7f4f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7f4f('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x7f4f('0x13')](0x3)[_0x7f4f('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7f4f('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7f4f('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x7f4f('0x13')](0x3)[_0x7f4f('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7f4f('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':_0x7f4f('0x2c'),'comment':_0x7f4f('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7f4f('0x2e')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x7f4f('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7f4f('0x13')](0x3)[_0x7f4f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7f4f('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7f4f('0x13')](0x5)[_0x7f4f('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7f4f('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x7f4f('0x13')](0x3)[_0x7f4f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7f4f('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7f4f('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7f4f('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7f4f('0x13')](0x3)[_0x7f4f('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7f4f('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x7f4f('0x13')](0x3)[_0x7f4f('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7f4f('0x34')},'dialTimezone':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':_0x7f4f('0x35')},'dialPrefix':{'type':Sequelize[_0x7f4f('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7f4f('0x3')](_0x7f4f('0x36'),_0x7f4f('0x37'),_0x7f4f('0x38')),'defaultValue':_0x7f4f('0x36')},'dialAMDActive':{'type':Sequelize[_0x7f4f('0x1d')],'defaultValue':0x0,'comment':_0x7f4f('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x7f4f('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7f4f('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x7f4f('0x13')](0x9)[_0x7f4f('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7f4f('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7f4f('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7f4f('0x13')](0x9)[_0x7f4f('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7f4f('0x3d')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7f4f('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7f4f('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7f4f('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7f4f('0x13')](0x9)[_0x7f4f('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7f4f('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7f4f('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7f4f('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7f4f('0x13')](0x9)[_0x7f4f('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7f4f('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x7f4f('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7f4f('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x7f4f('0x1d')],'defaultValue':0x0,'comment':_0x7f4f('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7f4f('0x3')]('DESC',_0x7f4f('0x44')),'defaultValue':_0x7f4f('0x45')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x7f4f('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7f4f('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7f4f('0x13')](0x3)[_0x7f4f('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7f4f('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x7f4f('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7f4f('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7f4f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7f4f('0x13')](0x5)[_0x7f4f('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7f4f('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7f4f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7f4f('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7f4f('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7f4f('0x13')](0x3)[_0x7f4f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7f4f('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7f4f('0x13')](0x5)[_0x7f4f('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7f4f('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x7f4f('0x13')](0x3)[_0x7f4f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7f4f('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7f4f('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7f4f('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7f4f('0x13')](0x3)[_0x7f4f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7f4f('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7f4f('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7f4f('0x13')],'allowNull':!![],'comment':_0x7f4f('0x4f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7f4f('0x50'),'set':function(_0x42d59d){if(!_0x42d59d)this[_0x7f4f('0x9')](_0x7f4f('0x51'),null);this[_0x7f4f('0x9')](_0x7f4f('0x52'),_0x42d59d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x7f4f('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7f4f('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x7f4f('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7f4f('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 31dff86..4885931 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['VoiceQueues','inbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','count','include','query','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','find','create','body','user','get','role','QueueCampaigns','outbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','getHoppers','CmHopper','nolimit','order','sort','pick','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','options','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','isEmpty','removeAgents','addAgents','spread','emit','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ContactId','phone','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','scheduledAt','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','offset','Content-Range','update','then','destroy'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1a71a1,_0x503ae3){_0x1a71a1=_0x1a71a1-0x0;var _0x417fd9=_0x1cb9[_0x1a71a1];return _0x417fd9;};'use strict';var moment=require(_0x91cb('0x0'));var BPromise=require('bluebird');var util=require(_0x91cb('0x1'));var _=require(_0x91cb('0x2'));var squel=require(_0x91cb('0x3'));var Redis=require(_0x91cb('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x91cb('0x5'))(_0x91cb('0x6'));var config=require('../../config/environment');var db=require(_0x91cb('0x7'))['db'];config[_0x91cb('0x8')]=_[_0x91cb('0x9')](config[_0x91cb('0x8')],{'host':_0x91cb('0xa'),'port':0x18eb});var socket=require(_0x91cb('0xb'))(new Redis(config['redis']));require(_0x91cb('0xc'))['register'](socket);function respondWithStatusCode(_0x2fdfce,_0x4cf9ed){_0x4cf9ed=_0x4cf9ed||0xcc;return function(_0xa43e7a){if(_0xa43e7a){return _0x2fdfce[_0x91cb('0xd')](_0x4cf9ed);}return _0x2fdfce[_0x91cb('0xe')](_0x4cf9ed)[_0x91cb('0xf')]();};}function respondWithResult(_0x429928,_0x23ba9a){_0x23ba9a=_0x23ba9a||0xc8;return function(_0x21a0a5){if(_0x21a0a5){return _0x429928[_0x91cb('0xe')](_0x23ba9a)[_0x91cb('0x10')](_0x21a0a5);}};}function respondWithFilteredResult(_0x8c0097,_0x530d92){return function(_0x3c1f56){if(_0x3c1f56){var _0x366f09=typeof _0x530d92['offset']===_0x91cb('0x11')&&typeof _0x530d92[_0x91cb('0x12')]===_0x91cb('0x11');var _0x2c7d40=_0x3c1f56['count'];var _0x4cc6ef=_0x366f09?0x0:_0x530d92[_0x91cb('0x13')];var _0x3d22b7=_0x366f09?_0x3c1f56['count']:_0x530d92['offset']+_0x530d92[_0x91cb('0x12')];var _0xc3629e;if(_0x3d22b7>=_0x2c7d40){_0x3d22b7=_0x2c7d40;_0xc3629e=0xc8;}else{_0xc3629e=0xce;}_0x8c0097[_0x91cb('0xe')](_0xc3629e);return _0x8c0097['set'](_0x91cb('0x14'),_0x4cc6ef+'-'+_0x3d22b7+'/'+_0x2c7d40)[_0x91cb('0x10')](_0x3c1f56);}return null;};}function saveUpdates(_0x4f1554){return function(_0xc594e3){if(_0xc594e3){return _0xc594e3[_0x91cb('0x15')](_0x4f1554)[_0x91cb('0x16')](function(_0xcd1a78){return _0xcd1a78;});}return null;};}function removeEntity(_0x5cc1c3){return function(_0x3fba4f){if(_0x3fba4f){return _0x3fba4f[_0x91cb('0x17')]()['then'](function(){var _0x123847=_0x3fba4f['get']({'plain':!![]});var _0x55042a=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5b385a=_(_0x55042a)[_0x91cb('0x1a')](_0x91cb('0x1b'))[_0x91cb('0x1c')](_0x91cb('0x1d'))['value']();if(_[_0x91cb('0x1e')](_0x5b385a,_0x123847[_0x91cb('0x1f')])){return;}var _0x1fa837=_['find'](_0x55042a,[_0x91cb('0x1d'),_0x123847[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x21')][_0x91cb('0x17')]({'where':{'type':_0x1fa837,'resourceId':_0x123847['id']}})[_0x91cb('0x16')](function(){return _0x3fba4f;});})[_0x91cb('0x16')](function(){_0x5cc1c3[_0x91cb('0xe')](0xcc)[_0x91cb('0xf')]();});}};}function handleEntityNotFound(_0x4c8438){return function(_0x59bf3a){if(!_0x59bf3a){_0x4c8438[_0x91cb('0xd')](0x194);}return _0x59bf3a;};}function handleError(_0x554350,_0x1c67d2){_0x1c67d2=_0x1c67d2||0x1f4;return function(_0x34d372){logger[_0x91cb('0x22')](_0x34d372['stack']);if(_0x34d372[_0x91cb('0x20')]){delete _0x34d372['name'];}_0x554350[_0x91cb('0xe')](_0x1c67d2)[_0x91cb('0x23')](_0x34d372);};}exports[_0x91cb('0x24')]=function(_0x2fb473,_0x468908){var _0x504275={};var _0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x1c')](db[_0x91cb('0x25')][_0x91cb('0x26')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x27')],'type':_0x4944bd[_0x91cb('0x1f')][_0x91cb('0x28')]};});_0x504275=qs[_0x91cb('0x29')](_0x52670a,_0x2fb473);var _0xf296bc={'where':_0x504275[_0x91cb('0x2a')]};return db[_0x91cb('0x25')][_0x91cb('0x2b')](_0xf296bc)[_0x91cb('0x16')](function(_0x5e6ed3){_0x2f04a3[_0x91cb('0x2b')]=_0x5e6ed3;_0x504275[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x2fb473[_0x91cb('0x2d')]);return db[_0x91cb('0x25')]['findAll'](_0x504275);})[_0x91cb('0x16')](function(_0x74b443){_0x2f04a3[_0x91cb('0x2e')]=_0x74b443;return _0x2f04a3;})[_0x91cb('0x16')](respondWithFilteredResult(_0x468908,_0x504275))[_0x91cb('0x2f')](handleError(_0x468908,null));};exports['show']=function(_0x121c37,_0x5927cb){var _0x47fc17={'raw':![],'where':{'id':_0x121c37[_0x91cb('0x30')]['id']}},_0x479968={};_0x479968['model']=_[_0x91cb('0x31')](db['VoiceQueue']['rawAttributes']);_0x479968[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x121c37[_0x91cb('0x2d')]);_0x479968[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x479968['model'],_0x479968[_0x91cb('0x2d')]);_0x47fc17[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x479968[_0x91cb('0x35')],qs['fields'](_0x121c37['query'][_0x91cb('0x36')]));_0x47fc17[_0x91cb('0x34')]=_0x47fc17['attributes'][_0x91cb('0x37')]?_0x47fc17[_0x91cb('0x34')]:_0x479968['model'];if(_0x121c37[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x47fc17['include']=[{'all':!![]}];}_0x47fc17=_[_0x91cb('0x39')]({},_0x47fc17,_0x121c37['options']);return db[_0x91cb('0x25')][_0x91cb('0x3a')](_0x47fc17)[_0x91cb('0x16')](handleEntityNotFound(_0x5927cb,null))[_0x91cb('0x16')](respondWithResult(_0x5927cb,null))[_0x91cb('0x2f')](handleError(_0x5927cb,null));};exports[_0x91cb('0x3b')]=function(_0x5d0e37,_0xa90111){return db[_0x91cb('0x25')]['create'](_0x5d0e37[_0x91cb('0x3c')],{})['then'](function(_0x2c6102){var _0x2eac87=_0x5d0e37[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x2eac87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2eac87[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0x2cf27e=_0x2c6102[_0x91cb('0x3e')]({'plain':!![]});var _0x42a7f3=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19')},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x3cc4c1=_['find'](_0x42a7f3,[_0x91cb('0x1d'),_0x2cf27e['type']])[_0x91cb('0x20')];return db['UserProfileSection'][_0x91cb('0x3a')]({'where':{'name':_0x3cc4c1,'userProfileId':_0x2eac87['userProfileId']},'raw':!![]})[_0x91cb('0x16')](function(_0x477131){if(_0x477131&&_0x477131[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0x2cf27e[_0x91cb('0x20')],'resourceId':_0x2cf27e['id'],'type':_0x477131[_0x91cb('0x20')],'sectionId':_0x477131['id']},{})['then'](function(){return _0x2c6102;});}else{return _0x2c6102;}})[_0x91cb('0x2f')](function(_0x2f1749){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x2f1749);throw _0x2f1749;});}return _0x2c6102;})[_0x91cb('0x16')](respondWithResult(_0xa90111,0xc9))[_0x91cb('0x2f')](handleError(_0xa90111,null));};exports[_0x91cb('0x44')]=function(_0x29d5a1,_0x396b81){var _0x4b26f6={'where':{'id':_0x29d5a1[_0x91cb('0x30')]['id']}},_0x7c22b3={};_0x7c22b3[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x25')][_0x91cb('0x26')]);_0x4b26f6[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x7c22b3['model'],qs[_0x91cb('0x36')](_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4b26f6[_0x91cb('0x34')]=_0x4b26f6['attributes'][_0x91cb('0x37')]?_0x4b26f6[_0x91cb('0x34')]:_0x7c22b3['model'];if(_0x29d5a1[_0x91cb('0x2d')]['includeAll']){_0x4b26f6[_0x91cb('0x2c')]=[{'all':!![]}];}_0x4b26f6=_['merge']({},_0x4b26f6,_0x29d5a1['options']);return db['VoiceQueue'][_0x91cb('0x3a')](_0x4b26f6)[_0x91cb('0x16')](handleEntityNotFound(_0x396b81,null))[_0x91cb('0x16')](function(_0x2f8384){if(_0x2f8384){var _0x333814=_0x2f8384['get']({'plain':!![]});_0x333814=qs['omit'](_0x333814,['id',_0x91cb('0x45'),_0x91cb('0x46')]);_0x29d5a1[_0x91cb('0x3c')]=_[_0x91cb('0x47')](_0x29d5a1['body'],['id','createdAt','updatedAt']);return db[_0x91cb('0x25')]['create'](_[_0x91cb('0x39')](_0x333814,_0x29d5a1['body']),{'include':_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x38')]?[{'all':!![]}]:undefined})[_0x91cb('0x16')](function(_0x649976){var _0x1884bc=_0x29d5a1[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x1884bc)throw new Error(_0x91cb('0x48'));if(_0x1884bc[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0xd8f7c2=_0x649976['get']({'plain':!![]});var _0x1e445a=[{'name':_0x91cb('0x18'),'value':'inbound'},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x4bab7d=_[_0x91cb('0x3a')](_0x1e445a,[_0x91cb('0x1d'),_0xd8f7c2[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x49')][_0x91cb('0x3a')]({'where':{'name':_0x4bab7d,'userProfileId':_0x1884bc[_0x91cb('0x4a')]},'raw':!![]})[_0x91cb('0x16')](function(_0x3320bd){if(_0x3320bd&&_0x3320bd[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0xd8f7c2[_0x91cb('0x20')],'resourceId':_0xd8f7c2['id'],'type':_0x3320bd['name'],'sectionId':_0x3320bd['id']},{})[_0x91cb('0x16')](function(){return _0x649976;});}else{return _0x649976;}})['catch'](function(_0x3dfff9){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x3dfff9);throw _0x3dfff9;});}return _0x649976;});}})['then'](respondWithResult(_0x396b81,0xc9))[_0x91cb('0x2f')](handleError(_0x396b81,null));};exports[_0x91cb('0x15')]=function(_0x48dcf7,_0xef4754){if(_0x48dcf7[_0x91cb('0x3c')]['id']){delete _0x48dcf7[_0x91cb('0x3c')]['id'];}return db[_0x91cb('0x25')]['find']({'where':{'id':_0x48dcf7[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0xef4754,null))[_0x91cb('0x16')](saveUpdates(_0x48dcf7[_0x91cb('0x3c')],null))['then'](respondWithResult(_0xef4754,null))[_0x91cb('0x2f')](handleError(_0xef4754,null));};exports[_0x91cb('0x17')]=function(_0x5c2c01,_0x492b09){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x5c2c01[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x492b09,null))['then'](removeEntity(_0x492b09,null))['catch'](handleError(_0x492b09,null));};exports[_0x91cb('0x4b')]=function(_0x5c468a,_0x1b69ce){var _0x961ebf={'raw':![],'where':{}};var _0x33de58={};var _0x551836={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x5c468a[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1b69ce,null))[_0x91cb('0x16')](function(_0x2c1911){if(_0x2c1911){_0x33de58['model']=_[_0x91cb('0x31')](db[_0x91cb('0x4c')][_0x91cb('0x26')]);_0x33de58[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x5c468a[_0x91cb('0x2d')]);_0x33de58[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x33de58[_0x91cb('0x35')],_0x33de58[_0x91cb('0x2d')]);_0x961ebf[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x33de58['model'],qs[_0x91cb('0x36')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x961ebf[_0x91cb('0x34')]=_0x961ebf[_0x91cb('0x34')][_0x91cb('0x37')]?_0x961ebf[_0x91cb('0x34')]:_0x33de58['model'];if(!_0x5c468a[_0x91cb('0x2d')]['hasOwnProperty'](_0x91cb('0x4d'))){_0x961ebf[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x5c468a[_0x91cb('0x2d')]['limit']);_0x961ebf[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x961ebf[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x5c468a['query'][_0x91cb('0x4f')]);_0x961ebf[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x5c468a[_0x91cb('0x2d')],_0x33de58[_0x91cb('0x32')]));_0x961ebf[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x2c1911['id'];if(_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x961ebf[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x961ebf[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x961ebf[_0x91cb('0x34')],function(_0x2605c3){var _0x1d9ded={};_0x1d9ded[_0x2605c3]={'$like':'%'+_0x5c468a['query'][_0x91cb('0x1a')]+'%'};return _0x1d9ded;})});}_0x961ebf=_[_0x91cb('0x39')]({},_0x961ebf,_0x5c468a['options']);return db[_0x91cb('0x4c')][_0x91cb('0x2b')]({'where':_0x961ebf[_0x91cb('0x2a')]})['then'](function(_0x45e26b){_0x551836[_0x91cb('0x2b')]=_0x45e26b;if(_0x5c468a['query']['includeAll']){_0x961ebf[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopper'][_0x91cb('0x52')](_0x961ebf);})[_0x91cb('0x16')](function(_0x4e11e3){_0x551836[_0x91cb('0x2e')]=_0x4e11e3;return _0x551836;});}})['then'](respondWithFilteredResult(_0x1b69ce,_0x961ebf))[_0x91cb('0x2f')](handleError(_0x1b69ce,null));};exports[_0x91cb('0x53')]=function(_0x4f827e,_0x5d8a7e){var _0x16a21f={'raw':!![],'where':{}};var _0x43be3e={};var _0x37666a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x91cb('0x54')]({'where':{'id':_0x4f827e[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x5d8a7e,null))[_0x91cb('0x16')](function(_0x570f6b){if(_0x570f6b){_0x43be3e[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x55')][_0x91cb('0x26')]);_0x43be3e[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x4f827e['query']);_0x43be3e['filters']=_[_0x91cb('0x33')](_0x43be3e['model'],_0x43be3e[_0x91cb('0x2d')]);_0x16a21f[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x43be3e[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x16a21f['attributes']=_0x16a21f[_0x91cb('0x34')][_0x91cb('0x37')]?_0x16a21f['attributes']:_0x43be3e[_0x91cb('0x35')];if(!_0x4f827e['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x16a21f[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x16a21f[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x16a21f[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x16a21f[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x4f827e[_0x91cb('0x2d')],_0x43be3e['filters']));_0x16a21f[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x570f6b['id'];if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x16a21f[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x16a21f[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x16a21f['attributes'],function(_0xb5c264){var _0xdee7f={};_0xdee7f[_0xb5c264]={'$like':'%'+_0x4f827e['query']['filter']+'%'};return _0xdee7f;})});}_0x16a21f=_[_0x91cb('0x39')]({},_0x16a21f,_0x4f827e['options']);return db['CmHopperHistory'][_0x91cb('0x2b')]({'where':_0x16a21f['where']})[_0x91cb('0x16')](function(_0x498382){_0x37666a[_0x91cb('0x2b')]=_0x498382;if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x16a21f[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x91cb('0x52')](_0x16a21f);})[_0x91cb('0x16')](function(_0x42d07b){_0x37666a[_0x91cb('0x2e')]=_0x42d07b;return _0x37666a;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x5d8a7e,_0x16a21f))[_0x91cb('0x2f')](handleError(_0x5d8a7e,null));};exports[_0x91cb('0x57')]=function(_0x3cf8c5,_0x21dfd3){var _0x24facc={'raw':!![],'where':{}};var _0xafda63={};var _0x32704d={'count':0x0,'rows':[]};return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x3cf8c5[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x21dfd3,null))[_0x91cb('0x16')](function(_0x39fce4){if(_0x39fce4){_0xafda63[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x58')][_0x91cb('0x26')]);_0xafda63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3cf8c5[_0x91cb('0x2d')]);_0xafda63['filters']=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],_0xafda63[_0x91cb('0x2d')]);_0x24facc[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x24facc[_0x91cb('0x34')]=_0x24facc[_0x91cb('0x34')]['length']?_0x24facc[_0x91cb('0x34')]:_0xafda63['model'];if(!_0x3cf8c5['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x24facc[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x24facc[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x24facc['order']=qs[_0x91cb('0x4f')](_0x3cf8c5[_0x91cb('0x2d')]['sort']);_0x24facc[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3cf8c5[_0x91cb('0x2d')],_0xafda63[_0x91cb('0x32')]));_0x24facc[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x39fce4['id'];if(_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x24facc[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x24facc[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x24facc[_0x91cb('0x34')],function(_0x378cd0){var _0x538a8c={};_0x538a8c[_0x378cd0]={'$like':'%'+_0x3cf8c5['query'][_0x91cb('0x1a')]+'%'};return _0x538a8c;})});}_0x24facc=_[_0x91cb('0x39')]({},_0x24facc,_0x3cf8c5[_0x91cb('0x59')]);return db[_0x91cb('0x58')][_0x91cb('0x2b')]({'where':_0x24facc[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x5ac5cc){_0x32704d[_0x91cb('0x2b')]=_0x5ac5cc;if(_0x3cf8c5['query'][_0x91cb('0x38')]){_0x24facc[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x58')][_0x91cb('0x52')](_0x24facc);})[_0x91cb('0x16')](function(_0x4ac4dd){_0x32704d[_0x91cb('0x2e')]=_0x4ac4dd;return _0x32704d;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x21dfd3,_0x24facc))[_0x91cb('0x2f')](handleError(_0x21dfd3,null));};exports[_0x91cb('0x5a')]=function(_0x3a213e,_0x4e4003){var _0x4003c9={'raw':!![],'where':{}};var _0x9cff8f={};var _0x25a779={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a213e['params']['id']}})['then'](handleEntityNotFound(_0x4e4003,null))[_0x91cb('0x16')](function(_0x182aa5){if(_0x182aa5){_0x9cff8f[_0x91cb('0x35')]=_[_0x91cb('0x31')](db['CmHopperBlack'][_0x91cb('0x26')]);_0x9cff8f[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3a213e[_0x91cb('0x2d')]);_0x9cff8f['filters']=_['intersection'](_0x9cff8f[_0x91cb('0x35')],_0x9cff8f[_0x91cb('0x2d')]);_0x4003c9[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9cff8f[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4003c9[_0x91cb('0x34')]=_0x4003c9[_0x91cb('0x34')][_0x91cb('0x37')]?_0x4003c9[_0x91cb('0x34')]:_0x9cff8f[_0x91cb('0x35')];if(!_0x3a213e['query']['hasOwnProperty'](_0x91cb('0x4d'))){_0x4003c9['limit']=qs[_0x91cb('0x12')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x4003c9[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x4003c9[_0x91cb('0x4e')]=qs['sort'](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x4003c9[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x3a213e['query'],_0x9cff8f[_0x91cb('0x32')]));_0x4003c9[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x182aa5['id'];if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x4003c9['where']=_[_0x91cb('0x39')](_0x4003c9[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x4003c9[_0x91cb('0x34')],function(_0x440ef4){var _0x2c2ed8={};_0x2c2ed8[_0x440ef4]={'$like':'%'+_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x2c2ed8;})});}_0x4003c9=_[_0x91cb('0x39')]({},_0x4003c9,_0x3a213e[_0x91cb('0x59')]);return db[_0x91cb('0x5b')][_0x91cb('0x2b')]({'where':_0x4003c9[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x7c84fc){_0x25a779[_0x91cb('0x2b')]=_0x7c84fc;if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x4003c9[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x5b')][_0x91cb('0x52')](_0x4003c9);})[_0x91cb('0x16')](function(_0x275c80){_0x25a779[_0x91cb('0x2e')]=_0x275c80;return _0x25a779;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x4e4003,_0x4003c9))[_0x91cb('0x2f')](handleError(_0x4e4003,null));};exports['getTeams']=function(_0x16cf02,_0x2b8634){var _0x1eb46e={};var _0x261a3a={};var _0x16f334;var _0x5ca377;return db['VoiceQueue']['findOne']({'where':{'id':_0x16cf02['params']['id']}})['then'](handleEntityNotFound(_0x2b8634,null))[_0x91cb('0x16')](function(_0x46a6cc){if(_0x46a6cc){_0x16f334=_0x46a6cc;_0x261a3a[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x5c')][_0x91cb('0x26')]);_0x261a3a[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x16cf02[_0x91cb('0x2d')]);_0x261a3a[_0x91cb('0x32')]=_['intersection'](_0x261a3a[_0x91cb('0x35')],_0x261a3a[_0x91cb('0x2d')]);_0x1eb46e['attributes']=_[_0x91cb('0x33')](_0x261a3a[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x1eb46e[_0x91cb('0x34')]=_0x1eb46e[_0x91cb('0x34')]['length']?_0x1eb46e[_0x91cb('0x34')]:_0x261a3a[_0x91cb('0x35')];_0x1eb46e[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x1eb46e[_0x91cb('0x2a')]=qs['filters'](_[_0x91cb('0x50')](_0x16cf02['query'],_0x261a3a[_0x91cb('0x32')]));if(_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x1eb46e[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x1eb46e[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x1eb46e[_0x91cb('0x34')],function(_0x1c7c10){var _0x570cf0={};_0x570cf0[_0x1c7c10]={'$like':'%'+_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x570cf0;})});}_0x1eb46e=_[_0x91cb('0x39')]({},_0x1eb46e,_0x16cf02[_0x91cb('0x59')]);return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x189a87){if(_0x189a87){_0x5ca377=_0x189a87[_0x91cb('0x37')];if(!_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x1eb46e[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x16cf02['query'][_0x91cb('0x12')]);_0x1eb46e['offset']=qs[_0x91cb('0x13')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x12da14){if(_0x12da14){return _0x12da14?{'count':_0x5ca377,'rows':_0x12da14}:null;}})[_0x91cb('0x16')](respondWithResult(_0x2b8634,null))[_0x91cb('0x2f')](handleError(_0x2b8634,null));};exports['addTeams']=function(_0x3353bf,_0x5b3658){var _0x3c1703=_0x3353bf[_0x91cb('0x3c')][_0x91cb('0x5e')];var _0x598663=_[_0x91cb('0x1c')](_0x3c1703,'id');return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x598663},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]}]})['then'](function(_0x469e62){if(_0x469e62){var _0x1e9441=_[_0x91cb('0x62')](_0x469e62,function(_0x1bb2de){var _0x129ea0=_0x1bb2de[_0x91cb('0x3e')]({'plain':!![]});_0x129ea0[_0x91cb('0x63')][_0x91cb('0x64')](function(_0x50b8d6){_0x50b8d6[_0x91cb('0x65')]=_[_0x91cb('0x3a')](_0x3c1703,{'id':_0x129ea0['id']})[_0x91cb('0x65')];});return _0x129ea0[_0x91cb('0x63')];});return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3353bf['params']['id']}})[_0x91cb('0x16')](function(_0x43b620){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x3b0bd5){return _0x43b620['addTeams'](_0x598663,{'transaction':_0x3b0bd5})[_0x91cb('0x16')](function(){return BPromise['each'](_0x3c1703,function(_0x58608e){return db[_0x91cb('0x68')][_0x91cb('0x69')]({'TeamId':_0x58608e['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id'],'penalty':_0x58608e[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise[_0x91cb('0x6a')](_0x1e9441,function(_0x20ef3d){return db[_0x91cb('0x6b')]['findOrCreate']({'where':{'UserId':_0x20ef3d['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id']},'defaults':{'penalty':_0x20ef3d[_0x91cb('0x65')]},'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise['each'](_['filter'](_0x1e9441,{'online':!![]}),function(_0x530565){return db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x530565[_0x91cb('0x20')],'UserId':_0x530565['id'],'queue_name':_0x43b620['name'],'VoiceQueueId':_0x43b620['id'],'interface':_[_0x91cb('0x6d')](_0x530565[_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x530565['name']):_0x530565[_0x91cb('0x61')],'paused':_0x530565[_0x91cb('0x60')]||![],'penalty':_0x530565[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){_0x1e9441[_0x91cb('0x64')](function(_0x3c788e){socket['emit'](_0x91cb('0x70'),{'UserId':_0x3c788e['id'],'VoiceQueueId':_0x43b620['id']});});});});});}})[_0x91cb('0x16')](respondWithStatusCode(_0x5b3658,null))[_0x91cb('0x2f')](handleError(_0x5b3658,null));};exports[_0x91cb('0x71')]=function(_0x3782cd,_0x4b290e){return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')]},'attributes':['id'],'include':[{'model':db[_0x91cb('0x73')],'as':_0x91cb('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b290e,null))[_0x91cb('0x16')](function(_0x2bafae){var _0x27472a=_['map'](_0x2bafae,'id');var _0x59cb69=[];var _0x5d0f96=[];var _0x174325=squel[_0x91cb('0x74')]();_0x174325[_0x91cb('0x75')](_0x91cb('0x76'))['from'](_0x91cb('0x77'),'tq')[_0x91cb('0x78')](_0x91cb('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91cb('0x2a')]('VoiceQueueId\x20=\x20?',_0x3782cd[_0x91cb('0x30')]['id']);for(var _0x43b2e7=0x0;_0x43b2e7<_0x2bafae['length'];_0x43b2e7+=0x1){let _0x1b47fe=_0x2bafae[_0x43b2e7];for(var _0x1853de=0x0;_0x1853de<_0x1b47fe[_0x91cb('0x63')][_0x91cb('0x37')];_0x1853de+=0x1){let _0x376426=_0x1b47fe['Agents'][_0x1853de];var _0x22a6e6=_0x174325[_0x91cb('0x44')]();_0x22a6e6[_0x91cb('0x2a')](_0x91cb('0x7a'),_0x376426['id']);_0x5d0f96['push'](db[_0x91cb('0x66')]['query'](_0x22a6e6['toString'](),{'type':db['sequelize'][_0x91cb('0x7b')][_0x91cb('0x7c')]})[_0x91cb('0x16')](function(_0x4972c3){if(_0x4972c3[_0x91cb('0x37')]===0x1){return _0x376426['id'];}else{var _0x53dbb2=_[_0x91cb('0x7d')](_[_0x91cb('0x1c')](_0x4972c3,_0x91cb('0x7e')),function(_0x2a2a71){return _[_0x91cb('0x1e')](_0x27472a,_0x2a2a71);});if(_0x53dbb2){return _0x376426['id'];}}}));}}return BPromise[_0x91cb('0x7f')](_0x5d0f96)['then'](function(_0x5bfd2c){_0x59cb69=_(_0x59cb69)[_0x91cb('0x80')](_0x5bfd2c)['compact']()[_0x91cb('0x1d')]();return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x3782cd[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(_0x51d431){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x18ec67){return _0x51d431['removeTeams'](_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')],{'transaction':_0x18ec67})['then'](function(){if(!_[_0x91cb('0x81')](_0x59cb69)){return _0x51d431[_0x91cb('0x82')](_0x59cb69,{'transaction':_0x18ec67})[_0x91cb('0x16')](function(){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0x3782cd[_0x91cb('0x30')]['id'],'UserId':_0x59cb69},'transaction':_0x18ec67});});}})['then'](function(){_0x59cb69[_0x91cb('0x64')](function(_0x5da781){socket['emit']('userVoiceQueue:remove',{'UserId':_0x5da781,'VoiceQueueId':_0x51d431['id']});});});});});});})[_0x91cb('0x16')](respondWithStatusCode(_0x4b290e,null))['catch'](handleError(_0x4b290e,null));};exports['addAgents']=function(_0x3c0211,_0x3710e9){var _0x395e21,_0x52b9af;return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3c0211[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x3710e9,null))[_0x91cb('0x16')](function(_0x3280a5){if(_0x3280a5){_0x52b9af=_0x3280a5;return _0x3280a5[_0x91cb('0x83')](_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x3c0211['body'],[_0x91cb('0x72'),'id'])||{})[_0x91cb('0x84')](function(_0x547b4d){for(var _0x1aef0b=0x0;_0x1aef0b<_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x91cb('0x37')];_0x1aef0b+=0x1){socket[_0x91cb('0x85')]('userVoiceQueue:save',{'UserId':Number(_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x1aef0b]),'VoiceQueueId':Number(_0x3c0211[_0x91cb('0x30')]['id'])});}return _0x547b4d;});}})['then'](function(_0x4ba088){_0x395e21=_0x4ba088||[];if(_0x52b9af){return db[_0x91cb('0x73')][_0x91cb('0x52')]({'where':{'id':_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')]},'attributes':['id',_0x91cb('0x20'),_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]});}})['then'](function(_0x33b7a7){if(!_[_0x91cb('0x81')](_0x33b7a7)){var _0x4ac7b9=[];for(var _0x41c3ff=0x0;_0x41c3ff<_0x33b7a7[_0x91cb('0x37')];_0x41c3ff++){if(_0x33b7a7[_0x41c3ff]['online']){_0x4ac7b9[_0x91cb('0x86')](db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x33b7a7[_0x41c3ff][_0x91cb('0x20')],'UserId':_0x33b7a7[_0x41c3ff]['id'],'queue_name':_0x52b9af[_0x91cb('0x20')],'VoiceQueueId':_0x52b9af['id'],'interface':_['isNil'](_0x33b7a7[_0x41c3ff][_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x33b7a7[_0x41c3ff][_0x91cb('0x20')]):_0x33b7a7[_0x41c3ff]['interface'],'paused':_0x33b7a7[_0x41c3ff][_0x91cb('0x60')]||![],'penalty':_0x3c0211['body'][_0x91cb('0x65')]||0x0}));}}return BPromise[_0x91cb('0x7f')](_0x4ac7b9);}})[_0x91cb('0x16')](function(){return _0x395e21;})[_0x91cb('0x16')](respondWithResult(_0x3710e9,null))[_0x91cb('0x2f')](handleError(_0x3710e9,null));};exports[_0x91cb('0x82')]=function(_0xd572bc,_0x1e7a48){return db[_0x91cb('0x25')]['find']({'where':{'id':_0xd572bc[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1e7a48,null))[_0x91cb('0x16')](function(_0x51ef1c){if(_0x51ef1c){return _0x51ef1c[_0x91cb('0x82')](_0xd572bc['query'][_0x91cb('0x72')])['then'](function(){if(_[_0x91cb('0x87')](_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')])){for(var _0x10fe63=0x0;_0x10fe63<_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x91cb('0x37')];_0x10fe63+=0x1){socket['emit'](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x10fe63]),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}}else{socket[_0x91cb('0x85')](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')]['ids']),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}});}})[_0x91cb('0x16')](function(_0x219b5f){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0xd572bc['params']['id'],'UserId':_0xd572bc['query']['ids']}})[_0x91cb('0x16')](function(){return _0x219b5f;});})[_0x91cb('0x16')](respondWithStatusCode(_0x1e7a48,null))['catch'](handleError(_0x1e7a48,null));};exports['getAgents']=function(_0x471c17,_0x6549a7){var _0x13564d={};var _0x3c1e63={};var _0x1f2d72;var _0x376adc;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x471c17['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x6549a7,null))[_0x91cb('0x16')](function(_0xf15400){if(_0xf15400){_0x1f2d72=_0xf15400;_0x3c1e63['model']=_[_0x91cb('0x31')](db[_0x91cb('0x73')][_0x91cb('0x26')]);_0x3c1e63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x471c17[_0x91cb('0x2d')]);_0x3c1e63[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x3c1e63['model'],_0x3c1e63['query']);_0x13564d[_0x91cb('0x34')]=_['intersection'](_0x3c1e63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x13564d['attributes']=_0x13564d[_0x91cb('0x34')][_0x91cb('0x37')]?_0x13564d[_0x91cb('0x34')]:_0x3c1e63[_0x91cb('0x35')];_0x13564d[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x13564d['where']=qs[_0x91cb('0x32')](_['pick'](_0x471c17[_0x91cb('0x2d')],_0x3c1e63[_0x91cb('0x32')]));if(_0x471c17['query'][_0x91cb('0x1a')]){_0x13564d[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x13564d[_0x91cb('0x2a')],{'$or':_['map'](_0x13564d[_0x91cb('0x34')],function(_0x1bef2b){var _0x5a38f7={};_0x5a38f7[_0x1bef2b]={'$like':'%'+_0x471c17[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x5a38f7;})});}_0x13564d=_[_0x91cb('0x39')]({},_0x13564d,_0x471c17[_0x91cb('0x59')]);return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x2f42ef){if(_0x2f42ef){_0x376adc=_0x2f42ef[_0x91cb('0x37')];if(!_0x471c17[_0x91cb('0x2d')][_0x91cb('0x56')]('nolimit')){_0x13564d[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x13564d[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x31cf76){if(_0x31cf76){return _0x31cf76?{'count':_0x376adc,'rows':_0x31cf76}:null;}})['then'](respondWithResult(_0x6549a7,null))[_0x91cb('0x2f')](handleError(_0x6549a7,null));};exports['getMembers']=function(_0x3a5022,_0x17141e){var _0x3e2c58={};var _0x11c67c={};var _0xf4b4ab;var _0x2fa5e3;return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a5022[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x17141e,null))[_0x91cb('0x16')](function(_0x4483fb){if(_0x4483fb){_0xf4b4ab=_0x4483fb;_0x11c67c['model']=_['keys'](db['UserVoiceQueueRt'][_0x91cb('0x26')]);_0x11c67c[_0x91cb('0x2d')]=_['keys'](_0x3a5022['query']);_0x11c67c['filters']=_[_0x91cb('0x33')](_0x11c67c[_0x91cb('0x35')],_0x11c67c['query']);_0x3e2c58['attributes']=_['intersection'](_0x11c67c[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a5022['query'][_0x91cb('0x36')]));_0x3e2c58[_0x91cb('0x34')]=_0x3e2c58['attributes']['length']?_0x3e2c58[_0x91cb('0x34')]:_0x11c67c[_0x91cb('0x35')];_0x3e2c58[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x3a5022[_0x91cb('0x2d')]['sort']);_0x3e2c58[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3a5022[_0x91cb('0x2d')],_0x11c67c[_0x91cb('0x32')]));if(_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x3e2c58[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x3e2c58[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x3e2c58[_0x91cb('0x34')],function(_0x1ea132){var _0x3b1d97={};_0x3b1d97[_0x1ea132]={'$like':'%'+_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x3b1d97;})});}_0x3e2c58=_[_0x91cb('0x39')]({},_0x3e2c58,_0x3a5022[_0x91cb('0x59')]);return _0xf4b4ab[_0x91cb('0x8a')](_0x3e2c58);}})[_0x91cb('0x16')](function(_0x5cf6df){if(_0x5cf6df){_0x2fa5e3=_0x5cf6df['length'];if(!_0x3a5022['query'][_0x91cb('0x56')]('nolimit')){_0x3e2c58[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x3e2c58[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0xf4b4ab['getMembers'](_0x3e2c58);}})['then'](function(_0x5f2de0){return _0x5f2de0?{'count':_0x2fa5e3,'rows':_0x5f2de0}:null;})[_0x91cb('0x16')](respondWithResult(_0x17141e,null))[_0x91cb('0x2f')](handleError(_0x17141e,null));};exports[_0x91cb('0x8b')]=function(_0x2b4e25,_0x4c044d){var _0x54c194={};var _0x3cfdcb={};var _0x1624b3;var _0x1e2acd;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2b4e25['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x4c044d,null))['then'](function(_0x1e979e){if(_0x1e979e){_0x1624b3=_0x1e979e;_0x3cfdcb[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x3cfdcb[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x2b4e25[_0x91cb('0x2d')]);_0x3cfdcb['filters']=_[_0x91cb('0x33')](_0x3cfdcb[_0x91cb('0x35')],_0x3cfdcb[_0x91cb('0x2d')]);_0x54c194[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x3cfdcb['model'],qs[_0x91cb('0x36')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x54c194['attributes']=_0x54c194['attributes'][_0x91cb('0x37')]?_0x54c194['attributes']:_0x3cfdcb[_0x91cb('0x35')];_0x54c194[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2b4e25[_0x91cb('0x2d')]['sort']);_0x54c194[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x2b4e25[_0x91cb('0x2d')],_0x3cfdcb[_0x91cb('0x32')]));if(_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x54c194[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x54c194['where'],{'$or':_[_0x91cb('0x1c')](_0x54c194['attributes'],function(_0x283743){var _0x44ffde={};_0x44ffde[_0x283743]={'$like':'%'+_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x44ffde;})});}_0x54c194=_['merge']({},_0x54c194,_0x2b4e25[_0x91cb('0x59')]);return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})[_0x91cb('0x16')](function(_0x5e629){if(_0x5e629){_0x1e2acd=_0x5e629[_0x91cb('0x37')];if(!_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x54c194[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x2b4e25['query'][_0x91cb('0x12')]);_0x54c194['offset']=qs[_0x91cb('0x13')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})['then'](function(_0x87f382){if(_0x87f382){return _0x87f382?{'count':_0x1e2acd,'rows':_0x87f382}:null;}})[_0x91cb('0x16')](respondWithResult(_0x4c044d,null))[_0x91cb('0x2f')](handleError(_0x4c044d,null));};exports['addLists']=function(_0x330123,_0x23bc13){var _0x175d85=moment()[_0x91cb('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x97ba8,_0x4bc382;return db[_0x91cb('0x25')]['find']({'where':{'id':_0x330123[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x23bc13,null))[_0x91cb('0x16')](function(_0x399012){if(_0x399012){_0x4bc382=_0x399012;return _0x399012[_0x91cb('0x8d')](_0x330123['body']['ids'],_[_0x91cb('0x47')](_0x330123[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x571a6f){var _0x19596b;_0x97ba8=_0x571a6f||[];var _0x5b4849=[];if(_0x571a6f){for(var _0x39a183=0x0;_0x39a183<_0x571a6f[_0x91cb('0x37')];_0x39a183+=0x1){var _0x693690=_0x571a6f[_0x39a183][_0x91cb('0x3e')]({'plain':!![]});_0x4bc382[_0x91cb('0x8e')]=_0x330123[_0x91cb('0x3c')][_0x91cb('0x8e')]?_0x330123[_0x91cb('0x3c')]['dialCheckDuplicateType']:_0x4bc382['dialCheckDuplicateType'];switch(_0x4bc382['dialCheckDuplicateType']){case'always':_0x19596b=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')](['phone','scheduledAt',_0x91cb('0x93'),'ListId',_0x91cb('0x51'),_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27','scheduledAt')[_0x91cb('0x75')]('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690[_0x91cb('0x95')]['toString'](),'ListId')['field'](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x9d'))[_0x91cb('0x97')](_0x91cb('0x9e'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id']['toString']()))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa0'))['from'](_0x91cb('0x91'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))['toString']();break;case _0x91cb('0xa1'):_0x19596b=squel[_0x91cb('0x8f')]()['into'](_0x91cb('0x91'))['fromQuery']([_0x91cb('0x94'),'scheduledAt',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))[_0x91cb('0x75')]('id',_0x91cb('0x93'))['field'](_0x693690[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0x91cb('0x97')]('cm_hopper')[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))[_0x91cb('0x96')]();break;default:_0x19596b=squel['insert']()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')]([_0x91cb('0x94'),_0x91cb('0xa3'),_0x91cb('0x93'),_0x91cb('0xa2'),'VoiceQueueId',_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()['field'](_0x91cb('0x94'),'phone')['field']('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))['field']('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690['CmListId'][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))['where'](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())['where'](_0x91cb('0x9b')))[_0x91cb('0x96')]();}_0x5b4849['push'](db[_0x91cb('0x66')]['query'](_0x19596b));}return BPromise[_0x91cb('0x7f')](_0x5b4849);}})['then'](function(){var _0x739447=[];var _0x2deed1=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xa4'))['fromQuery']([_0x91cb('0xa5'),_0x91cb('0x94'),'OrderBy','createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa6'))['field'](_0x91cb('0xa7'))[_0x91cb('0x75')](_0x91cb('0xa8'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))['from'](_0x91cb('0xa9'),'ci')[_0x91cb('0x78')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x91cb('0x2a')](_0x91cb('0xaa'),_0x175d85)[_0x91cb('0x2a')](_0x91cb('0xab'),_0x91cb('0xac')))[_0x91cb('0x96')]();_0x739447[_0x91cb('0x86')](db[_0x91cb('0x66')]['query'](_0x2deed1));return BPromise[_0x91cb('0x7f')](_0x739447);})[_0x91cb('0x16')](function(){return _0x97ba8;})[_0x91cb('0x16')](respondWithResult(_0x23bc13,null))[_0x91cb('0x2f')](handleError(_0x23bc13,null));};exports[_0x91cb('0xad')]=function(_0x554923,_0x2fe556){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x554923[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x2fe556,null))[_0x91cb('0x16')](function(_0x43958a){if(_0x43958a){return _0x43958a[_0x91cb('0xad')](_0x554923['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0x409a36){if(_0x409a36){return db[_0x91cb('0x4c')][_0x91cb('0x17')]({'where':{'ListId':_0x554923[_0x91cb('0x2d')][_0x91cb('0x72')],'VoiceQueueId':_0x554923[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(){return _0x409a36;});}})[_0x91cb('0x16')](respondWithStatusCode(_0x2fe556,null))['catch'](handleError(_0x2fe556,null));};exports[_0x91cb('0xae')]=function(_0x2d870d,_0x173761){var _0x2cf0d8={};var _0x9d63ff={};var _0x720de;var _0x80f0ba;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2d870d[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x173761,null))[_0x91cb('0x16')](function(_0x800860){if(_0x800860){_0x720de=_0x800860;_0x9d63ff[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x9d63ff['query']=_['keys'](_0x2d870d[_0x91cb('0x2d')]);_0x9d63ff[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x9d63ff['model'],_0x9d63ff[_0x91cb('0x2d')]);_0x2cf0d8[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9d63ff[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x2cf0d8[_0x91cb('0x34')]=_0x2cf0d8[_0x91cb('0x34')][_0x91cb('0x37')]?_0x2cf0d8[_0x91cb('0x34')]:_0x9d63ff[_0x91cb('0x35')];_0x2cf0d8[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x2cf0d8[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x2d870d['query'],_0x9d63ff[_0x91cb('0x32')]));if(_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x2cf0d8['where']=_['merge'](_0x2cf0d8['where'],{'$or':_[_0x91cb('0x1c')](_0x2cf0d8[_0x91cb('0x34')],function(_0x4370f6){var _0x5bc712={};_0x5bc712[_0x4370f6]={'$like':'%'+_0x2d870d['query'][_0x91cb('0x1a')]+'%'};return _0x5bc712;})});}_0x2cf0d8=_[_0x91cb('0x39')]({},_0x2cf0d8,_0x2d870d[_0x91cb('0x59')]);return _0x720de[_0x91cb('0xae')](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x182f2c){if(_0x182f2c){_0x80f0ba=_0x182f2c[_0x91cb('0x37')];if(!_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x2cf0d8['limit']=qs['limit'](_0x2d870d[_0x91cb('0x2d')]['limit']);_0x2cf0d8[_0x91cb('0x13')]=qs['offset'](_0x2d870d['query'][_0x91cb('0x13')]);}return _0x720de['getBlackLists'](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x2ac9df){if(_0x2ac9df){return _0x2ac9df?{'count':_0x80f0ba,'rows':_0x2ac9df}:null;}})['then'](respondWithResult(_0x173761,null))[_0x91cb('0x2f')](handleError(_0x173761,null));};exports[_0x91cb('0xaf')]=function(_0x331381,_0x52ce8c){var _0x534968;return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x331381['params']['id']}})['then'](handleEntityNotFound(_0x52ce8c,null))['then'](function(_0x397397){if(_0x397397){return _0x397397[_0x91cb('0xaf')](_0x331381[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x331381[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x2a0c3c){var _0x30ef98;_0x534968=_0x2a0c3c||[];var _0x27d0ab=[];if(_0x2a0c3c){for(var _0x547db7=0x0;_0x547db7<_0x2a0c3c['length'];_0x547db7+=0x1){var _0x38d608=_0x2a0c3c[_0x547db7][_0x91cb('0x3e')]({'plain':!![]});_0x30ef98=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xb0'))[_0x91cb('0x92')](['phone',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel['select']()[_0x91cb('0x75')](_0x91cb('0x94'),'phone')[_0x91cb('0x75')]('id','ContactId')[_0x91cb('0x75')](_0x38d608[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))['field'](_0x331381[_0x91cb('0x30')]['id']['toString'](),_0x91cb('0x51'))['field']('NOW()',_0x91cb('0x45'))[_0x91cb('0x75')](_0x91cb('0xb1'),_0x91cb('0x46'))[_0x91cb('0x97')]('cm_contacts')['where'](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x38d608['CmListId'][_0x91cb('0x96')]())[_0x91cb('0x2a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x27d0ab[_0x91cb('0x86')](db['sequelize'][_0x91cb('0x2d')](_0x30ef98));}return BPromise['all'](_0x27d0ab);}})['then'](function(){return _0x534968;})[_0x91cb('0x16')](respondWithResult(_0x52ce8c,null))[_0x91cb('0x2f')](handleError(_0x52ce8c,null));};exports[_0x91cb('0xb2')]=function(_0x4ef95b,_0x2f0269){return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x4ef95b[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x2f0269,null))['then'](function(_0x5e1b97){if(_0x5e1b97){return _0x5e1b97[_0x91cb('0xb2')](_0x4ef95b['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0xcb3114){if(_0xcb3114){return db[_0x91cb('0x5b')][_0x91cb('0x17')]({'where':{'ListId':_0x4ef95b['query'][_0x91cb('0x72')],'VoiceQueueId':_0x4ef95b['params']['id']}})[_0x91cb('0x16')](function(){return _0xcb3114;});}})['then'](respondWithStatusCode(_0x2f0269,null))[_0x91cb('0x2f')](handleError(_0x2f0269,null));}; \ No newline at end of file +var _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x6aa7,0x178));var _0x76aa=function(_0x119fc8,_0xb418f2){_0x119fc8=_0x119fc8-0x0;var _0x53885f=_0x6aa7[_0x119fc8];return _0x53885f;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1763a87..45ad51f 100644 --- a/server/api/voiceQueue/voiceQueue.events.js +++ b/server/api/voiceQueue/voiceQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cf7=['VoiceQueue','setMaxListeners','save','update','remove','hasOwnProperty','events'];(function(_0x294f3d,_0x1b0f82){var _0x2c8f6c=function(_0x2303e6){while(--_0x2303e6){_0x294f3d['push'](_0x294f3d['shift']());}};_0x2c8f6c(++_0x1b0f82);}(_0x0cf7,0x1e2));var _0x70cf=function(_0x40e643,_0x2990a2){_0x40e643=_0x40e643-0x0;var _0x100010=_0x0cf7[_0x40e643];return _0x100010;};'use strict';var EventEmitter=require(_0x70cf('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x70cf('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x70cf('0x2')](0x0);var events={'afterCreate':_0x70cf('0x3'),'afterUpdate':_0x70cf('0x4'),'afterDestroy':_0x70cf('0x5')};function emitEvent(_0x41d409){return function(_0x2e7b33,_0x541cdb,_0x276d0c){VoiceQueueEvents['emit'](_0x41d409+':'+_0x2e7b33['id'],_0x2e7b33);VoiceQueueEvents['emit'](_0x41d409,_0x2e7b33);_0x276d0c(null);};}for(var e in events){if(events[_0x70cf('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xf086=['emit','hook','events','../../mysqldb','VoiceQueue','setMaxListeners','remove'];(function(_0x26ed29,_0x2288f1){var _0x26182c=function(_0x23dc71){while(--_0x23dc71){_0x26ed29['push'](_0x26ed29['shift']());}};_0x26182c(++_0x2288f1);}(_0xf086,0x1ec));var _0x6f08=function(_0x313278,_0x5c968d){_0x313278=_0x313278-0x0;var _0x3f1081=_0xf086[_0x313278];return _0x3f1081;};'use strict';var EventEmitter=require(_0x6f08('0x0'));var VoiceQueue=require(_0x6f08('0x1'))['db'][_0x6f08('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6f08('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6f08('0x4')};function emitEvent(_0x30419c){return function(_0x213ff5,_0x33dd5c,_0x91f2c0){VoiceQueueEvents['emit'](_0x30419c+':'+_0x213ff5['id'],_0x213ff5);VoiceQueueEvents[_0x6f08('0x5')](_0x30419c,_0x213ff5);_0x91f2c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x6f08('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 4d51e49..d12eae6 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x55ca,0x126));var _0xa55c=function(_0x21f88f,_0x48cfba){_0x21f88f=_0x21f88f-0x0;var _0x3b9ff5=_0x55ca[_0x21f88f];return _0x3b9ff5;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x1c5683,_0x4ff312){var _0x1713fa=function(_0x2ee552){while(--_0x2ee552){_0x1c5683['push'](_0x1c5683['shift']());}};_0x1713fa(++_0x4ff312);}(_0x70e0,0x17b));var _0x070e=function(_0x38da66,_0x5e248a){_0x38da66=_0x38da66-0x0;var _0x457514=_0x70e0[_0x38da66];return _0x457514;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 2253a20..0936c28 100644 --- a/server/api/voiceQueue/voiceQueue.rpc.js +++ b/server/api/voiceQueue/voiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c75=['ShowVoiceQueue','find','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','model','map','stringify'];(function(_0x847cfe,_0x372912){var _0x43924a=function(_0x197ea5){while(--_0x197ea5){_0x847cfe['push'](_0x847cfe['shift']());}};_0x43924a(++_0x372912);}(_0x4c75,0x14b));var _0x54c7=function(_0x553502,_0x4d2c0c){_0x553502=_0x553502-0x0;var _0x246c37=_0x4c75[_0x553502];return _0x246c37;};'use strict';var _=require(_0x54c7('0x0'));var util=require(_0x54c7('0x1'));var moment=require(_0x54c7('0x2'));var BPromise=require(_0x54c7('0x3'));var rs=require(_0x54c7('0x4'));var fs=require('fs');var Redis=require(_0x54c7('0x5'));var db=require(_0x54c7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54c7('0x7'));var config=require(_0x54c7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x54c7('0x9')][_0x54c7('0xa')]({'port':0x232a});config[_0x54c7('0xb')]=_[_0x54c7('0xc')](config[_0x54c7('0xb')],{'host':_0x54c7('0xd'),'port':0x18eb});var socket=require(_0x54c7('0xe'))(new Redis(config[_0x54c7('0xb')]));require(_0x54c7('0xf'))[_0x54c7('0x10')](socket);function respondWithRpcPromise(_0x28bb38,_0x239bdf,_0x231cd6){return new BPromise(function(_0x3049f1,_0x471961){return client[_0x54c7('0x11')](_0x28bb38,_0x231cd6)['then'](function(_0x1d8311){logger['info'](_0x54c7('0x12'),_0x239bdf,'request\x20sent');logger[_0x54c7('0x13')](_0x54c7('0x14'),_0x239bdf,_0x54c7('0x15'),JSON['stringify'](_0x1d8311));if(_0x1d8311['error']){if(_0x1d8311[_0x54c7('0x16')][_0x54c7('0x17')]===0x1f4){logger[_0x54c7('0x16')](_0x54c7('0x12'),_0x239bdf,_0x1d8311[_0x54c7('0x16')][_0x54c7('0x18')]);return _0x471961(_0x1d8311[_0x54c7('0x16')][_0x54c7('0x18')]);}logger[_0x54c7('0x16')](_0x54c7('0x12'),_0x239bdf,_0x1d8311[_0x54c7('0x16')][_0x54c7('0x18')]);return _0x3049f1(_0x1d8311[_0x54c7('0x16')][_0x54c7('0x18')]);}else{logger['info'](_0x54c7('0x12'),_0x239bdf,_0x54c7('0x15'));_0x3049f1(_0x1d8311[_0x54c7('0x19')][_0x54c7('0x18')]);}})[_0x54c7('0x1a')](function(_0x54c99f){logger[_0x54c7('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x239bdf,_0x54c99f);_0x471961(_0x54c99f);});});}exports[_0x54c7('0x1b')]=function(_0x96303){var _0x42899e=this;return new Promise(function(_0x596087,_0x29bfe4){return db[_0x54c7('0x1c')][_0x54c7('0x1d')]({'raw':_0x96303['options']?_0x96303[_0x54c7('0x1e')][_0x54c7('0x1f')]===undefined?!![]:![]:!![],'where':_0x96303['options']?_0x96303[_0x54c7('0x1e')][_0x54c7('0x20')]||null:null,'attributes':_0x96303[_0x54c7('0x1e')]?_0x96303[_0x54c7('0x1e')][_0x54c7('0x21')]||null:null,'limit':_0x96303[_0x54c7('0x1e')]?_0x96303[_0x54c7('0x1e')]['limit']||null:null,'include':_0x96303[_0x54c7('0x1e')]?_0x96303[_0x54c7('0x1e')][_0x54c7('0x22')]?_['map'](_0x96303[_0x54c7('0x1e')][_0x54c7('0x22')],function(_0x52e4b4){return{'model':db[_0x52e4b4[_0x54c7('0x23')]],'as':_0x52e4b4['as'],'attributes':_0x52e4b4[_0x54c7('0x21')],'include':_0x52e4b4[_0x54c7('0x22')]?_[_0x54c7('0x24')](_0x52e4b4['include'],function(_0x53b952){return{'model':db[_0x53b952[_0x54c7('0x23')]],'as':_0x53b952['as'],'attributes':_0x53b952[_0x54c7('0x21')],'include':_0x53b952['include']?_[_0x54c7('0x24')](_0x53b952[_0x54c7('0x22')],function(_0x430a10){return{'model':db[_0x430a10['model']],'as':_0x430a10['as'],'attributes':_0x430a10[_0x54c7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xff3885){logger['info']('GetVoiceQueue',_0x96303);logger['debug'](_0x54c7('0x1b'),_0x96303,JSON[_0x54c7('0x25')](_0xff3885));_0x596087(_0xff3885);})[_0x54c7('0x1a')](function(_0x57db46){logger[_0x54c7('0x16')]('GetVoiceQueue',_0x57db46[_0x54c7('0x18')],_0x96303);_0x29bfe4(_0x42899e[_0x54c7('0x16')](0x1f4,_0x57db46['message']));});});};exports[_0x54c7('0x26')]=function(_0x24135){var _0x133212=this;return new Promise(function(_0x1e984d,_0x3ca213){return db[_0x54c7('0x1c')][_0x54c7('0x27')]({'raw':_0x24135[_0x54c7('0x1e')]?_0x24135[_0x54c7('0x1e')][_0x54c7('0x1f')]===undefined?!![]:![]:!![],'where':_0x24135['options']?_0x24135[_0x54c7('0x1e')][_0x54c7('0x20')]||null:null,'attributes':_0x24135[_0x54c7('0x1e')]?_0x24135[_0x54c7('0x1e')][_0x54c7('0x21')]||null:null,'include':_0x24135[_0x54c7('0x1e')]?_0x24135[_0x54c7('0x1e')][_0x54c7('0x22')]?_[_0x54c7('0x24')](_0x24135[_0x54c7('0x1e')][_0x54c7('0x22')],function(_0xe8a222){return{'model':db[_0xe8a222['model']],'as':_0xe8a222['as'],'attributes':_0xe8a222[_0x54c7('0x21')],'include':_0xe8a222['include']?_['map'](_0xe8a222[_0x54c7('0x22')],function(_0x5e5109){return{'model':db[_0x5e5109[_0x54c7('0x23')]],'as':_0x5e5109['as'],'attributes':_0x5e5109['attributes'],'include':_0x5e5109['include']?_[_0x54c7('0x24')](_0x5e5109[_0x54c7('0x22')],function(_0x5bf6d3){return{'model':db[_0x5bf6d3[_0x54c7('0x23')]],'as':_0x5bf6d3['as'],'attributes':_0x5bf6d3[_0x54c7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2985f3){logger[_0x54c7('0x28')](_0x54c7('0x26'),_0x24135);logger['debug'](_0x54c7('0x26'),_0x24135,JSON[_0x54c7('0x25')](_0x2985f3));_0x1e984d(_0x2985f3);})[_0x54c7('0x1a')](function(_0x515e1b){logger[_0x54c7('0x16')]('ShowVoiceQueue',_0x515e1b[_0x54c7('0x18')],_0x24135);_0x3ca213(_0x133212[_0x54c7('0x16')](0x1f4,_0x515e1b[_0x54c7('0x18')]));});});}; \ No newline at end of file +var _0x3875=['client','http','redis','socket.io-emitter','./voiceQueue.socket','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','info','catch','ShowVoiceQueue','find','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5c9865,_0x1a299a){var _0x54c22b=function(_0x538537){while(--_0x538537){_0x5c9865['push'](_0x5c9865['shift']());}};_0x54c22b(++_0x1a299a);}(_0x3875,0x129));var _0x5387=function(_0x11b19b,_0x213234){_0x11b19b=_0x11b19b-0x0;var _0x1daac1=_0x3875[_0x11b19b];return _0x1daac1;};'use strict';var _=require('lodash');var util=require(_0x5387('0x0'));var moment=require(_0x5387('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5387('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5387('0x3'));var logger=require(_0x5387('0x4'))(_0x5387('0x5'));var config=require('../../config/environment');var jayson=require(_0x5387('0x6'));var client=jayson[_0x5387('0x7')][_0x5387('0x8')]({'port':0x232a});config[_0x5387('0x9')]=_['defaults'](config[_0x5387('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5387('0xa'))(new Redis(config[_0x5387('0x9')]));require(_0x5387('0xb'))['register'](socket);function respondWithRpcPromise(_0x168a57,_0xb37bfb,_0x17856b){return new BPromise(function(_0x5986f4,_0xfba94d){return client[_0x5387('0xc')](_0x168a57,_0x17856b)['then'](function(_0x12ef78){logger['info'](_0x5387('0xd'),_0xb37bfb,_0x5387('0xe'));logger[_0x5387('0xf')](_0x5387('0x10'),_0xb37bfb,_0x5387('0xe'),JSON[_0x5387('0x11')](_0x12ef78));if(_0x12ef78['error']){if(_0x12ef78[_0x5387('0x12')][_0x5387('0x13')]===0x1f4){logger[_0x5387('0x12')](_0x5387('0xd'),_0xb37bfb,_0x12ef78[_0x5387('0x12')]['message']);return _0xfba94d(_0x12ef78[_0x5387('0x12')]['message']);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0xb37bfb,_0x12ef78[_0x5387('0x12')][_0x5387('0x14')]);return _0x5986f4(_0x12ef78[_0x5387('0x12')][_0x5387('0x14')]);}else{logger['info'](_0x5387('0xd'),_0xb37bfb,_0x5387('0xe'));_0x5986f4(_0x12ef78[_0x5387('0x15')][_0x5387('0x14')]);}})['catch'](function(_0x5040c8){logger[_0x5387('0x12')]('VoiceQueue,\x20%s,\x20%s',_0xb37bfb,_0x5040c8);_0xfba94d(_0x5040c8);});});}exports[_0x5387('0x16')]=function(_0x475acc){var _0x4024d4=this;return new Promise(function(_0xa1ab79,_0x1d146d){return db[_0x5387('0x17')][_0x5387('0x18')]({'raw':_0x475acc[_0x5387('0x19')]?_0x475acc[_0x5387('0x19')][_0x5387('0x1a')]===undefined?!![]:![]:!![],'where':_0x475acc[_0x5387('0x19')]?_0x475acc['options'][_0x5387('0x1b')]||null:null,'attributes':_0x475acc['options']?_0x475acc[_0x5387('0x19')][_0x5387('0x1c')]||null:null,'limit':_0x475acc[_0x5387('0x19')]?_0x475acc[_0x5387('0x19')][_0x5387('0x1d')]||null:null,'include':_0x475acc[_0x5387('0x19')]?_0x475acc['options'][_0x5387('0x1e')]?_[_0x5387('0x1f')](_0x475acc['options'][_0x5387('0x1e')],function(_0x57c78f){return{'model':db[_0x57c78f[_0x5387('0x20')]],'as':_0x57c78f['as'],'attributes':_0x57c78f[_0x5387('0x1c')],'include':_0x57c78f['include']?_[_0x5387('0x1f')](_0x57c78f[_0x5387('0x1e')],function(_0x311b90){return{'model':db[_0x311b90[_0x5387('0x20')]],'as':_0x311b90['as'],'attributes':_0x311b90[_0x5387('0x1c')],'include':_0x311b90[_0x5387('0x1e')]?_[_0x5387('0x1f')](_0x311b90['include'],function(_0xea4128){return{'model':db[_0xea4128['model']],'as':_0xea4128['as'],'attributes':_0xea4128[_0x5387('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5387('0x21')](function(_0xac2ea3){logger[_0x5387('0x22')](_0x5387('0x16'),_0x475acc);logger[_0x5387('0xf')](_0x5387('0x16'),_0x475acc,JSON[_0x5387('0x11')](_0xac2ea3));_0xa1ab79(_0xac2ea3);})[_0x5387('0x23')](function(_0x580b79){logger[_0x5387('0x12')](_0x5387('0x16'),_0x580b79['message'],_0x475acc);_0x1d146d(_0x4024d4[_0x5387('0x12')](0x1f4,_0x580b79[_0x5387('0x14')]));});});};exports[_0x5387('0x24')]=function(_0x165c9a){var _0xba0ad9=this;return new Promise(function(_0x5307a0,_0x3b6d0f){return db['VoiceQueue'][_0x5387('0x25')]({'raw':_0x165c9a[_0x5387('0x19')]?_0x165c9a['options'][_0x5387('0x1a')]===undefined?!![]:![]:!![],'where':_0x165c9a[_0x5387('0x19')]?_0x165c9a['options']['where']||null:null,'attributes':_0x165c9a['options']?_0x165c9a[_0x5387('0x19')]['attributes']||null:null,'include':_0x165c9a[_0x5387('0x19')]?_0x165c9a['options'][_0x5387('0x1e')]?_[_0x5387('0x1f')](_0x165c9a[_0x5387('0x19')]['include'],function(_0x533f5b){return{'model':db[_0x533f5b[_0x5387('0x20')]],'as':_0x533f5b['as'],'attributes':_0x533f5b['attributes'],'include':_0x533f5b[_0x5387('0x1e')]?_[_0x5387('0x1f')](_0x533f5b[_0x5387('0x1e')],function(_0x43f7ad){return{'model':db[_0x43f7ad[_0x5387('0x20')]],'as':_0x43f7ad['as'],'attributes':_0x43f7ad['attributes'],'include':_0x43f7ad[_0x5387('0x1e')]?_['map'](_0x43f7ad[_0x5387('0x1e')],function(_0xe71b98){return{'model':db[_0xe71b98[_0x5387('0x20')]],'as':_0xe71b98['as'],'attributes':_0xe71b98['attributes']};}):[]};}):[]};}):[]:[]})[_0x5387('0x21')](function(_0x29ba45){logger[_0x5387('0x22')](_0x5387('0x24'),_0x165c9a);logger['debug']('ShowVoiceQueue',_0x165c9a,JSON[_0x5387('0x11')](_0x29ba45));_0x5307a0(_0x29ba45);})[_0x5387('0x23')](function(_0x4161ff){logger[_0x5387('0x12')](_0x5387('0x24'),_0x4161ff[_0x5387('0x14')],_0x165c9a);_0x3b6d0f(_0xba0ad9[_0x5387('0x12')](0x1f4,_0x4161ff[_0x5387('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 9710a0e..ca4500b 100644 --- a/server/api/voiceQueue/voiceQueue.socket.js +++ b/server/api/voiceQueue/voiceQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2ff=['emit','removeListener','length','voiceQueue:','remove'];(function(_0x3e5b7b,_0x1ca279){var _0x441af8=function(_0x3931e7){while(--_0x3931e7){_0x3e5b7b['push'](_0x3e5b7b['shift']());}};_0x441af8(++_0x1ca279);}(_0xd2ff,0xfe));var _0xfd2f=function(_0x15a3ad,_0x178cb4){_0x15a3ad=_0x15a3ad-0x0;var _0x2becb6=_0xd2ff[_0x15a3ad];return _0x2becb6;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0xfd2f('0x0'),'update'];function createListener(_0x53be43,_0x38be21){return function(_0x1c0837){_0x38be21[_0xfd2f('0x1')](_0x53be43,_0x1c0837);};}function removeListener(_0x599860,_0x5a772e){return function(){VoiceQueueEvents[_0xfd2f('0x2')](_0x599860,_0x5a772e);};}exports['register']=function(_0x2f44ad){for(var _0x49b242=0x0,_0x2a127f=events[_0xfd2f('0x3')];_0x49b242<_0x2a127f;_0x49b242++){var _0x565860=events[_0x49b242];var _0x50beba=createListener(_0xfd2f('0x4')+_0x565860,_0x2f44ad);VoiceQueueEvents['on'](_0x565860,_0x50beba);}}; \ No newline at end of file +var _0x3388=['./voiceQueue.events','remove','update','emit','removeListener','length','voiceQueue:'];(function(_0x59b2f4,_0x2a3145){var _0x18a176=function(_0x5d2fba){while(--_0x5d2fba){_0x59b2f4['push'](_0x59b2f4['shift']());}};_0x18a176(++_0x2a3145);}(_0x3388,0x118));var _0x8338=function(_0x5391fb,_0x786bf0){_0x5391fb=_0x5391fb-0x0;var _0x1b3ef3=_0x3388[_0x5391fb];return _0x1b3ef3;};'use strict';var VoiceQueueEvents=require(_0x8338('0x0'));var events=['save',_0x8338('0x1'),_0x8338('0x2')];function createListener(_0x5e671d,_0x60af29){return function(_0xd9701e){_0x60af29[_0x8338('0x3')](_0x5e671d,_0xd9701e);};}function removeListener(_0x30cf9e,_0x116381){return function(){VoiceQueueEvents[_0x8338('0x4')](_0x30cf9e,_0x116381);};}exports['register']=function(_0x486e98){for(var _0x5ad049=0x0,_0x51b92a=events[_0x8338('0x5')];_0x5ad049<_0x51b92a;_0x5ad049++){var _0x5305ee=events[_0x5ad049];var _0x136ac4=createListener(_0x8338('0x6')+_0x5305ee,_0x486e98);VoiceQueueEvents['on'](_0x5305ee,_0x136ac4);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index ef76768..e3221bb 100644 --- a/server/api/voiceQueueReport/index.js +++ b/server/api/voiceQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14e5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','/:id','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x401886,_0x356024){var _0x1713b8=function(_0x5f5769){while(--_0x5f5769){_0x401886['push'](_0x401886['shift']());}};_0x1713b8(++_0x356024);}(_0x14e5,0x15f));var _0x514e=function(_0x26641c,_0x1ba2a5){_0x26641c=_0x26641c-0x0;var _0x42c01a=_0x14e5[_0x26641c];return _0x42c01a;};'use strict';var multer=require(_0x514e('0x0'));var util=require(_0x514e('0x1'));var path=require('path');var timeout=require(_0x514e('0x2'));var express=require(_0x514e('0x3'));var router=express[_0x514e('0x4')]();var fs_extra=require(_0x514e('0x5'));var auth=require(_0x514e('0x6'));var interaction=require(_0x514e('0x7'));var config=require(_0x514e('0x8'));var controller=require(_0x514e('0x9'));router[_0x514e('0xa')]('/',auth[_0x514e('0xb')](),controller[_0x514e('0xc')]);router[_0x514e('0xa')]('/describe',auth[_0x514e('0xb')](),controller[_0x514e('0xd')]);router[_0x514e('0xa')](_0x514e('0xe'),auth[_0x514e('0xb')](),controller['getVoiceQueuesReport']);router[_0x514e('0xa')](_0x514e('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x514e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x514e('0x11')]('/:id',auth[_0x514e('0xb')](),controller[_0x514e('0x12')]);router[_0x514e('0x13')](_0x514e('0xf'),auth[_0x514e('0xb')](),controller[_0x514e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x468d=['get','/describe','describe','getVoiceQueuesReport','/:id','show','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index'];(function(_0x4d8f6f,_0x559720){var _0x441c71=function(_0x543b50){while(--_0x543b50){_0x4d8f6f['push'](_0x4d8f6f['shift']());}};_0x441c71(++_0x559720);}(_0x468d,0x72));var _0xd468=function(_0x18d806,_0x2f386d){_0x18d806=_0x18d806-0x0;var _0x57e3e0=_0x468d[_0x18d806];return _0x57e3e0;};'use strict';var multer=require(_0xd468('0x0'));var util=require('util');var path=require(_0xd468('0x1'));var timeout=require(_0xd468('0x2'));var express=require(_0xd468('0x3'));var router=express[_0xd468('0x4')]();var fs_extra=require(_0xd468('0x5'));var auth=require(_0xd468('0x6'));var interaction=require(_0xd468('0x7'));var config=require(_0xd468('0x8'));var controller=require(_0xd468('0x9'));router['get']('/',auth[_0xd468('0xa')](),controller[_0xd468('0xb')]);router[_0xd468('0xc')](_0xd468('0xd'),auth[_0xd468('0xa')](),controller[_0xd468('0xe')]);router[_0xd468('0xc')]('/index',auth[_0xd468('0xa')](),controller[_0xd468('0xf')]);router[_0xd468('0xc')](_0xd468('0x10'),auth[_0xd468('0xa')](),controller[_0xd468('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd468('0x10'),auth['isAuthenticated'](),controller[_0xd468('0x12')]);router[_0xd468('0x13')](_0xd468('0x10'),auth[_0xd468('0xa')](),controller['destroy']);module[_0xd468('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 367cfe9..e9112a6 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.attributes.js +++ b/server/api/voiceQueueReport/voiceQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3e4=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0xc3e4,0xfa));var _0x4c3e=function(_0x166d1c,_0x4daa0b){_0x166d1c=_0x166d1c-0x0;var _0x1070ff=_0xc3e4[_0x166d1c];return _0x1070ff;};'use strict';var Sequelize=require(_0x4c3e('0x0'));var moment=require(_0x4c3e('0x1'));module[_0x4c3e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4c3e('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4c3e('0x3')]},'queue':{'type':Sequelize[_0x4c3e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x4c3e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x4c3e('0x4')],'set':function(_0x181ca2){var _0x1c4491=moment(_0x181ca2);var _0x2650d7=moment(this[_0x4c3e('0x5')](_0x4c3e('0x6')))[_0x4c3e('0x7')](_0x4c3e('0x8'));var _0x260fd8=_0x1c4491[_0x4c3e('0x9')](_0x2650d7,_0x4c3e('0xa'));this[_0x4c3e('0xb')](_0x4c3e('0xc'),_0x181ca2);this[_0x4c3e('0xb')](_0x4c3e('0xd'),_0x260fd8||null);}},'position':{'type':Sequelize[_0x4c3e('0xe')]},'count':{'type':Sequelize[_0x4c3e('0xe')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x4c3e('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4c3e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x4c3e('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4c3e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x4c3e('0x3')],'comment':_0x4c3e('0x10')},'originalposition':{'type':Sequelize[_0x4c3e('0xe')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4c3e('0x3')]},'accountcode':{'type':Sequelize[_0x4c3e('0x3')]},'context':{'type':Sequelize[_0x4c3e('0x3')]},'exten':{'type':Sequelize[_0x4c3e('0x3')]},'priority':{'type':Sequelize[_0x4c3e('0x3')]},'holdtime':{'type':Sequelize[_0x4c3e('0xe')]},'mohtime':{'type':Sequelize[_0x4c3e('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4c3e('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4c3e('0x3')]},'transfer':{'type':Sequelize[_0x4c3e('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4c3e('0x3')],'comment':_0x4c3e('0x11')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x4c3e('0x3')]},'secondDisposition':{'type':Sequelize[_0x4c3e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x4c3e('0xe')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb81c=['setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','queuecallerleaveAt'];(function(_0x110c54,_0xa3cfcb){var _0x58a348=function(_0x2ddb40){while(--_0x2ddb40){_0x110c54['push'](_0x110c54['shift']());}};_0x58a348(++_0xa3cfcb);}(_0xb81c,0x13d));var _0xcb81=function(_0x557bc9,_0x449237){_0x557bc9=_0x557bc9-0x0;var _0x8c2350=_0xb81c[_0x557bc9];return _0x8c2350;};'use strict';var Sequelize=require(_0xcb81('0x0'));var moment=require('moment');module[_0xcb81('0x1')]={'type':{'type':Sequelize[_0xcb81('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xcb81('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xcb81('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xcb81('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x4d4e7c){var _0x190ebc=moment(_0x4d4e7c);var _0xcef70b=moment(this[_0xcb81('0x4')]('queuecallerjoinAt'))['format'](_0xcb81('0x5'));var _0xdee87b=_0x190ebc['diff'](_0xcef70b,'seconds');this['setDataValue'](_0xcb81('0x6'),_0x4d4e7c);this[_0xcb81('0x7')]('holdtime',_0xdee87b||null);}},'position':{'type':Sequelize[_0xcb81('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xcb81('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xcb81('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xcb81('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xcb81('0x2')],'comment':_0xcb81('0xa')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xcb81('0x2')]},'connectedlinenum':{'type':Sequelize[_0xcb81('0x2')]},'connectedlinename':{'type':Sequelize[_0xcb81('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xcb81('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcb81('0x2')]},'holdtime':{'type':Sequelize[_0xcb81('0x8')]},'mohtime':{'type':Sequelize[_0xcb81('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcb81('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xcb81('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xcb81('0x2')],'comment':_0xcb81('0xb')},'transferexten':{'type':Sequelize[_0xcb81('0x2')]},'transferuniqueid':{'type':Sequelize[_0xcb81('0x2')]},'disposition':{'type':Sequelize[_0xcb81('0x2')]},'secondDisposition':{'type':Sequelize[_0xcb81('0x2')]},'thirdDisposition':{'type':Sequelize[_0xcb81('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xcb81('0x8')],'defaultValue':0x0},'note':{'type':Sequelize[_0xcb81('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 657959f..0d002b9 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2647=['describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','filters','include','find','create','body'];(function(_0x5a3775,_0x2c9777){var _0x39efe4=function(_0x35af52){while(--_0x35af52){_0x5a3775['push'](_0x5a3775['shift']());}};_0x39efe4(++_0x2c9777);}(_0x2647,0xac));var _0x7264=function(_0x4287b0,_0x5e551c){_0x4287b0=_0x4287b0-0x0;var _0x1e6a1e=_0x2647[_0x4287b0];return _0x1e6a1e;};'use strict';var emlformat=require(_0x7264('0x0'));var rimraf=require(_0x7264('0x1'));var zipdir=require(_0x7264('0x2'));var jsonpatch=require(_0x7264('0x3'));var rp=require(_0x7264('0x4'));var moment=require(_0x7264('0x5'));var BPromise=require(_0x7264('0x6'));var Mustache=require('mustache');var util=require(_0x7264('0x7'));var path=require('path');var sox=require(_0x7264('0x8'));var csv=require('to-csv');var ejs=require(_0x7264('0x9'));var fs=require('fs');var fs_extra=require(_0x7264('0xa'));var _=require('lodash');var squel=require(_0x7264('0xb'));var crypto=require('crypto');var jsforce=require(_0x7264('0xc'));var deskjs=require(_0x7264('0xd'));var toCsv=require(_0x7264('0xe'));var querystring=require('querystring');var Papa=require(_0x7264('0xf'));var Redis=require(_0x7264('0x10'));var authService=require(_0x7264('0x11'));var qs=require(_0x7264('0x12'));var as=require(_0x7264('0x13'));var hardwareService=require(_0x7264('0x14'));var logger=require(_0x7264('0x15'))(_0x7264('0x16'));var utils=require(_0x7264('0x17'));var config=require(_0x7264('0x18'));var licenseUtil=require(_0x7264('0x19'));var db=require(_0x7264('0x1a'))['db'];config[_0x7264('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7264('0x1c'))(new Redis(config[_0x7264('0x1b')]));require(_0x7264('0x1d'))['register'](socket);function respondWithStatusCode(_0x6ce5bb,_0x1cf808){_0x1cf808=_0x1cf808||0xcc;return function(_0x38a46f){if(_0x38a46f){return _0x6ce5bb[_0x7264('0x1e')](_0x1cf808);}return _0x6ce5bb[_0x7264('0x1f')](_0x1cf808)['end']();};}function respondWithResult(_0xd32dbf,_0x37508b){_0x37508b=_0x37508b||0xc8;return function(_0x34c773){if(_0x34c773){return _0xd32dbf[_0x7264('0x1f')](_0x37508b)[_0x7264('0x20')](_0x34c773);}};}function respondWithFilteredResult(_0xd69cb7,_0x411d3e){return function(_0x34c8f0){if(_0x34c8f0){var _0x39568a=typeof _0x411d3e['offset']==='undefined'&&typeof _0x411d3e[_0x7264('0x21')]===_0x7264('0x22');var _0x21ca10=_0x34c8f0[_0x7264('0x23')];var _0x161e9a=_0x39568a?0x0:_0x411d3e[_0x7264('0x24')];var _0xb4bc3c=_0x39568a?_0x34c8f0[_0x7264('0x23')]:_0x411d3e[_0x7264('0x24')]+_0x411d3e[_0x7264('0x21')];var _0x2b3774;if(_0xb4bc3c>=_0x21ca10){_0xb4bc3c=_0x21ca10;_0x2b3774=0xc8;}else{_0x2b3774=0xce;}_0xd69cb7[_0x7264('0x1f')](_0x2b3774);return _0xd69cb7[_0x7264('0x25')](_0x7264('0x26'),_0x161e9a+'-'+_0xb4bc3c+'/'+_0x21ca10)[_0x7264('0x20')](_0x34c8f0);}return null;};}function patchUpdates(_0x2dd415){return function(_0x3fa305){try{jsonpatch['apply'](_0x3fa305,_0x2dd415,!![]);}catch(_0x3c27e0){return BPromise[_0x7264('0x27')](_0x3c27e0);}return _0x3fa305[_0x7264('0x28')]();};}function saveUpdates(_0x4b2708,_0x290c00){return function(_0x327785){if(_0x327785){return _0x327785[_0x7264('0x29')](_0x4b2708)[_0x7264('0x2a')](function(_0x2ddce3){return _0x2ddce3;});}return null;};}function removeEntity(_0x50c366,_0x372bf8){return function(_0x1c7725){if(_0x1c7725){return _0x1c7725[_0x7264('0x2b')]()['then'](function(){_0x50c366['status'](0xcc)[_0x7264('0x2c')]();});}};}function handleEntityNotFound(_0x25f8c7,_0x59ef1c){return function(_0x4dd57b){if(!_0x4dd57b){_0x25f8c7[_0x7264('0x1e')](0x194);}return _0x4dd57b;};}function handleError(_0x175219,_0x2ecda4){_0x2ecda4=_0x2ecda4||0x1f4;return function(_0x5c0b49){logger[_0x7264('0x2d')](_0x5c0b49[_0x7264('0x2e')]);if(_0x5c0b49['name']){delete _0x5c0b49['name'];}_0x175219[_0x7264('0x1f')](_0x2ecda4)['send'](_0x5c0b49);};}exports[_0x7264('0x2f')]=function(_0x37b810,_0x420a1f){var _0x138c16={},_0x578830={},_0x5267e7={'count':0x0,'rows':[]};var _0x862240=_[_0x7264('0x30')](db[_0x7264('0x31')][_0x7264('0x32')],function(_0x27fce3){return{'name':_0x27fce3[_0x7264('0x33')],'type':_0x27fce3[_0x7264('0x34')][_0x7264('0x35')]};});_0x578830[_0x7264('0x36')]=_['map'](_0x862240,_0x7264('0x37'));_0x578830[_0x7264('0x38')]=_[_0x7264('0x39')](_0x37b810[_0x7264('0x38')]);_0x578830['filters']=_[_0x7264('0x3a')](_0x578830[_0x7264('0x36')],_0x578830[_0x7264('0x38')]);_0x138c16['attributes']=_[_0x7264('0x3a')](_0x578830[_0x7264('0x36')],qs['fields'](_0x37b810[_0x7264('0x38')][_0x7264('0x3b')]));_0x138c16[_0x7264('0x3c')]=_0x138c16[_0x7264('0x3c')][_0x7264('0x3d')]?_0x138c16[_0x7264('0x3c')]:_0x578830[_0x7264('0x36')];if(!_0x37b810[_0x7264('0x38')][_0x7264('0x3e')](_0x7264('0x3f'))){_0x138c16[_0x7264('0x21')]=qs['limit'](_0x37b810['query'][_0x7264('0x21')]);_0x138c16[_0x7264('0x24')]=qs[_0x7264('0x24')](_0x37b810['query']['offset']);}_0x138c16[_0x7264('0x40')]=qs[_0x7264('0x41')](_0x37b810[_0x7264('0x38')]['sort']);_0x138c16[_0x7264('0x42')]=qs['filters'](_[_0x7264('0x43')](_0x37b810[_0x7264('0x38')],_0x578830['filters']),_0x862240);if(_0x37b810[_0x7264('0x38')][_0x7264('0x44')]){_0x138c16['where']=_['merge'](_0x138c16['where'],{'$or':_[_0x7264('0x30')](_0x862240,function(_0x34a9f4){if(_0x34a9f4[_0x7264('0x34')]!==_0x7264('0x45')){var _0x48c374={};_0x48c374[_0x34a9f4[_0x7264('0x37')]]={'$like':'%'+_0x37b810[_0x7264('0x38')][_0x7264('0x44')]+'%'};return _0x48c374;}})});}_0x138c16=_[_0x7264('0x46')]({},_0x138c16,_0x37b810[_0x7264('0x47')]);var _0x2e0785={'where':_0x138c16['where']};return db[_0x7264('0x31')][_0x7264('0x23')](_0x2e0785)[_0x7264('0x2a')](function(_0x5c9849){_0x5267e7['count']=_0x5c9849;if(_0x37b810[_0x7264('0x38')][_0x7264('0x48')]){_0x138c16['include']=[{'all':!![]}];}return db[_0x7264('0x31')][_0x7264('0x49')](_0x138c16);})[_0x7264('0x2a')](function(_0x48246d){_0x5267e7[_0x7264('0x4a')]=_0x48246d;return _0x5267e7;})[_0x7264('0x2a')](respondWithFilteredResult(_0x420a1f,_0x138c16))[_0x7264('0x4b')](handleError(_0x420a1f,null));};exports[_0x7264('0x4c')]=function(_0xc5bd46,_0xefef7c){var _0x2c3f66={'raw':![],'where':{'id':_0xc5bd46[_0x7264('0x4d')]['id']}},_0x11ecf3={};_0x11ecf3[_0x7264('0x36')]=_['keys'](db['VoiceQueueReport'][_0x7264('0x32')]);_0x11ecf3['query']=_[_0x7264('0x39')](_0xc5bd46['query']);_0x11ecf3[_0x7264('0x4e')]=_['intersection'](_0x11ecf3[_0x7264('0x36')],_0x11ecf3[_0x7264('0x38')]);_0x2c3f66[_0x7264('0x3c')]=_[_0x7264('0x3a')](_0x11ecf3[_0x7264('0x36')],qs[_0x7264('0x3b')](_0xc5bd46[_0x7264('0x38')][_0x7264('0x3b')]));_0x2c3f66['attributes']=_0x2c3f66['attributes'][_0x7264('0x3d')]?_0x2c3f66[_0x7264('0x3c')]:_0x11ecf3[_0x7264('0x36')];if(_0xc5bd46['query'][_0x7264('0x48')]){_0x2c3f66[_0x7264('0x4f')]=[{'all':!![]}];}_0x2c3f66=_[_0x7264('0x46')]({},_0x2c3f66,_0xc5bd46['options']);return db[_0x7264('0x31')][_0x7264('0x50')](_0x2c3f66)['then'](handleEntityNotFound(_0xefef7c,null))[_0x7264('0x2a')](respondWithResult(_0xefef7c,null))['catch'](handleError(_0xefef7c,null));};exports[_0x7264('0x51')]=function(_0xa03de0,_0x415ccd){return db[_0x7264('0x31')][_0x7264('0x51')](_0xa03de0['body'],{})[_0x7264('0x2a')](respondWithResult(_0x415ccd,0xc9))[_0x7264('0x4b')](handleError(_0x415ccd,null));};exports['update']=function(_0x1787e5,_0x12fec4){if(_0x1787e5['body']['id']){delete _0x1787e5[_0x7264('0x52')]['id'];}return db[_0x7264('0x31')]['find']({'where':{'id':_0x1787e5[_0x7264('0x4d')]['id']}})[_0x7264('0x2a')](handleEntityNotFound(_0x12fec4,null))[_0x7264('0x2a')](saveUpdates(_0x1787e5[_0x7264('0x52')],null))[_0x7264('0x2a')](respondWithResult(_0x12fec4,null))['catch'](handleError(_0x12fec4,null));};exports['destroy']=function(_0x44811e,_0x4ea6e4){return db[_0x7264('0x31')][_0x7264('0x50')]({'where':{'id':_0x44811e[_0x7264('0x4d')]['id']}})[_0x7264('0x2a')](handleEntityNotFound(_0x4ea6e4,null))[_0x7264('0x2a')](removeEntity(_0x4ea6e4,null))[_0x7264('0x4b')](handleError(_0x4ea6e4,null));};exports[_0x7264('0x53')]=function(_0x2d1898,_0x14dcd9){return db[_0x7264('0x31')]['describe']()['then'](respondWithResult(_0x14dcd9,null))[_0x7264('0x4b')](handleError(_0x14dcd9,null));};exports[_0x7264('0x54')]=function(_0x31a33a,_0x9a19c2){var _0x261988={},_0x364e88={},_0x2ab357={'count':0x0,'rows':[]};_0x364e88[_0x7264('0x36')]=_['keys'](db[_0x7264('0x31')][_0x7264('0x32')]);_0x364e88[_0x7264('0x38')]=_[_0x7264('0x39')](_0x31a33a[_0x7264('0x38')]);_0x364e88[_0x7264('0x4e')]=_[_0x7264('0x3a')](_0x364e88['model'],_0x364e88[_0x7264('0x38')]);_0x261988[_0x7264('0x3c')]=_[_0x7264('0x3a')](_0x364e88['model'],qs[_0x7264('0x3b')](_0x31a33a[_0x7264('0x38')]['fields']));_0x261988['attributes']=_0x261988[_0x7264('0x3c')][_0x7264('0x3d')]?_0x261988['attributes']:_0x364e88[_0x7264('0x36')];if(!_0x31a33a[_0x7264('0x38')][_0x7264('0x3e')](_0x7264('0x3f'))){_0x261988['limit']=qs[_0x7264('0x21')](_0x31a33a['query'][_0x7264('0x21')]);_0x261988[_0x7264('0x24')]=qs[_0x7264('0x24')](_0x31a33a[_0x7264('0x38')][_0x7264('0x24')]);}_0x261988['order']=qs[_0x7264('0x41')](_0x31a33a[_0x7264('0x38')][_0x7264('0x41')]);_0x261988[_0x7264('0x42')]=qs[_0x7264('0x4e')](_[_0x7264('0x43')](_0x31a33a[_0x7264('0x38')],_0x364e88[_0x7264('0x4e')]));if(_0x31a33a[_0x7264('0x38')][_0x7264('0x44')]){_0x261988['where']=_[_0x7264('0x46')](_0x261988[_0x7264('0x42')],{'$or':_[_0x7264('0x30')](_0x261988['attributes'],function(_0x2b270d){var _0x8c4e84={};_0x8c4e84[_0x2b270d]={'$like':'%'+_0x31a33a['query'][_0x7264('0x44')]+'%'};return _0x8c4e84;})});}_0x261988=_['merge']({},_0x261988,_0x31a33a['options']);var _0x4b781e={'where':_0x261988[_0x7264('0x42')]};return db[_0x7264('0x31')]['count'](_0x4b781e)[_0x7264('0x2a')](function(_0x564797){_0x2ab357[_0x7264('0x23')]=_0x564797;if(_0x31a33a[_0x7264('0x38')][_0x7264('0x48')]){_0x261988[_0x7264('0x4f')]=[{'all':!![]}];}return db[_0x7264('0x31')]['findAll'](_0x261988);})[_0x7264('0x2a')](function(_0x13bbb3){_0x2ab357[_0x7264('0x4a')]=_0x13bbb3;return _0x2ab357;})[_0x7264('0x2a')](respondWithFilteredResult(_0x9a19c2,_0x261988,'getVoiceQueuesReport'))['catch'](handleError(_0x9a19c2,null,_0x7264('0x54')));}; \ No newline at end of file +var _0xe8f7=['apply','reject','save','then','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','destroy','describe','order','rows','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x2a8084,_0x1407b9){var _0xd2dbf4=function(_0x21d988){while(--_0x21d988){_0x2a8084['push'](_0x2a8084['shift']());}};_0xd2dbf4(++_0x1407b9);}(_0xe8f7,0xcd));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e8f('0x0'));var zipdir=require(_0x7e8f('0x1'));var jsonpatch=require(_0x7e8f('0x2'));var rp=require(_0x7e8f('0x3'));var moment=require(_0x7e8f('0x4'));var BPromise=require(_0x7e8f('0x5'));var Mustache=require('mustache');var util=require(_0x7e8f('0x6'));var path=require('path');var sox=require(_0x7e8f('0x7'));var csv=require('to-csv');var ejs=require(_0x7e8f('0x8'));var fs=require('fs');var fs_extra=require(_0x7e8f('0x9'));var _=require('lodash');var squel=require(_0x7e8f('0xa'));var crypto=require(_0x7e8f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7e8f('0xc'));var toCsv=require(_0x7e8f('0xd'));var querystring=require(_0x7e8f('0xe'));var Papa=require(_0x7e8f('0xf'));var Redis=require('ioredis');var authService=require(_0x7e8f('0x10'));var qs=require(_0x7e8f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7e8f('0x12'));var utils=require(_0x7e8f('0x13'));var config=require(_0x7e8f('0x14'));var licenseUtil=require(_0x7e8f('0x15'));var db=require(_0x7e8f('0x16'))['db'];config[_0x7e8f('0x17')]=_[_0x7e8f('0x18')](config['redis'],{'host':_0x7e8f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7e8f('0x1a'))[_0x7e8f('0x1b')](socket);function respondWithStatusCode(_0x3eeff0,_0x983054){_0x983054=_0x983054||0xcc;return function(_0x2db301){if(_0x2db301){return _0x3eeff0[_0x7e8f('0x1c')](_0x983054);}return _0x3eeff0[_0x7e8f('0x1d')](_0x983054)[_0x7e8f('0x1e')]();};}function respondWithResult(_0x7866b3,_0x27122d){_0x27122d=_0x27122d||0xc8;return function(_0x4fbaa8){if(_0x4fbaa8){return _0x7866b3[_0x7e8f('0x1d')](_0x27122d)[_0x7e8f('0x1f')](_0x4fbaa8);}};}function respondWithFilteredResult(_0x2cb787,_0x5bec83){return function(_0x3dcc46){if(_0x3dcc46){var _0x4c6f74=typeof _0x5bec83['offset']===_0x7e8f('0x20')&&typeof _0x5bec83[_0x7e8f('0x21')]==='undefined';var _0x117e8f=_0x3dcc46[_0x7e8f('0x22')];var _0x51c96a=_0x4c6f74?0x0:_0x5bec83[_0x7e8f('0x23')];var _0x3c6961=_0x4c6f74?_0x3dcc46[_0x7e8f('0x22')]:_0x5bec83[_0x7e8f('0x23')]+_0x5bec83[_0x7e8f('0x21')];var _0x1b09da;if(_0x3c6961>=_0x117e8f){_0x3c6961=_0x117e8f;_0x1b09da=0xc8;}else{_0x1b09da=0xce;}_0x2cb787[_0x7e8f('0x1d')](_0x1b09da);return _0x2cb787[_0x7e8f('0x24')](_0x7e8f('0x25'),_0x51c96a+'-'+_0x3c6961+'/'+_0x117e8f)[_0x7e8f('0x1f')](_0x3dcc46);}return null;};}function patchUpdates(_0x2af8d0){return function(_0x168baf){try{jsonpatch[_0x7e8f('0x26')](_0x168baf,_0x2af8d0,!![]);}catch(_0x2d4327){return BPromise[_0x7e8f('0x27')](_0x2d4327);}return _0x168baf[_0x7e8f('0x28')]();};}function saveUpdates(_0x195ec7,_0x329593){return function(_0x58bb14){if(_0x58bb14){return _0x58bb14['update'](_0x195ec7)[_0x7e8f('0x29')](function(_0x3d2ad0){return _0x3d2ad0;});}return null;};}function removeEntity(_0x23df12,_0x5ddd7d){return function(_0xaf9e95){if(_0xaf9e95){return _0xaf9e95['destroy']()[_0x7e8f('0x29')](function(){_0x23df12[_0x7e8f('0x1d')](0xcc)[_0x7e8f('0x1e')]();});}};}function handleEntityNotFound(_0x140403,_0x509f10){return function(_0x5060b7){if(!_0x5060b7){_0x140403[_0x7e8f('0x1c')](0x194);}return _0x5060b7;};}function handleError(_0x1bd919,_0x43d698){_0x43d698=_0x43d698||0x1f4;return function(_0x2e74b7){logger['error'](_0x2e74b7[_0x7e8f('0x2a')]);if(_0x2e74b7[_0x7e8f('0x2b')]){delete _0x2e74b7[_0x7e8f('0x2b')];}_0x1bd919['status'](_0x43d698)[_0x7e8f('0x2c')](_0x2e74b7);};}exports[_0x7e8f('0x2d')]=function(_0x26b9b8,_0x423053){var _0x410f77={},_0x4761d8={},_0x5cf090={'count':0x0,'rows':[]};var _0x5f4018=_[_0x7e8f('0x2e')](db[_0x7e8f('0x2f')][_0x7e8f('0x30')],function(_0x36aae7){return{'name':_0x36aae7[_0x7e8f('0x31')],'type':_0x36aae7[_0x7e8f('0x32')][_0x7e8f('0x33')]};});_0x4761d8['model']=_[_0x7e8f('0x2e')](_0x5f4018,_0x7e8f('0x2b'));_0x4761d8[_0x7e8f('0x34')]=_[_0x7e8f('0x35')](_0x26b9b8[_0x7e8f('0x34')]);_0x4761d8[_0x7e8f('0x36')]=_['intersection'](_0x4761d8[_0x7e8f('0x37')],_0x4761d8['query']);_0x410f77[_0x7e8f('0x38')]=_[_0x7e8f('0x39')](_0x4761d8[_0x7e8f('0x37')],qs[_0x7e8f('0x3a')](_0x26b9b8['query']['fields']));_0x410f77[_0x7e8f('0x38')]=_0x410f77['attributes'][_0x7e8f('0x3b')]?_0x410f77['attributes']:_0x4761d8[_0x7e8f('0x37')];if(!_0x26b9b8[_0x7e8f('0x34')][_0x7e8f('0x3c')](_0x7e8f('0x3d'))){_0x410f77[_0x7e8f('0x21')]=qs[_0x7e8f('0x21')](_0x26b9b8[_0x7e8f('0x34')][_0x7e8f('0x21')]);_0x410f77[_0x7e8f('0x23')]=qs[_0x7e8f('0x23')](_0x26b9b8[_0x7e8f('0x34')]['offset']);}_0x410f77['order']=qs[_0x7e8f('0x3e')](_0x26b9b8[_0x7e8f('0x34')][_0x7e8f('0x3e')]);_0x410f77[_0x7e8f('0x3f')]=qs[_0x7e8f('0x36')](_[_0x7e8f('0x40')](_0x26b9b8[_0x7e8f('0x34')],_0x4761d8[_0x7e8f('0x36')]),_0x5f4018);if(_0x26b9b8[_0x7e8f('0x34')][_0x7e8f('0x41')]){_0x410f77[_0x7e8f('0x3f')]=_[_0x7e8f('0x42')](_0x410f77[_0x7e8f('0x3f')],{'$or':_[_0x7e8f('0x2e')](_0x5f4018,function(_0x29be43){if(_0x29be43[_0x7e8f('0x32')]!==_0x7e8f('0x43')){var _0x45b0d0={};_0x45b0d0[_0x29be43[_0x7e8f('0x2b')]]={'$like':'%'+_0x26b9b8[_0x7e8f('0x34')]['filter']+'%'};return _0x45b0d0;}})});}_0x410f77=_[_0x7e8f('0x42')]({},_0x410f77,_0x26b9b8[_0x7e8f('0x44')]);var _0x527bd3={'where':_0x410f77['where']};return db['VoiceQueueReport'][_0x7e8f('0x22')](_0x527bd3)[_0x7e8f('0x29')](function(_0x8e5045){_0x5cf090[_0x7e8f('0x22')]=_0x8e5045;if(_0x26b9b8[_0x7e8f('0x34')][_0x7e8f('0x45')]){_0x410f77[_0x7e8f('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7e8f('0x47')](_0x410f77);})[_0x7e8f('0x29')](function(_0x537830){_0x5cf090['rows']=_0x537830;return _0x5cf090;})[_0x7e8f('0x29')](respondWithFilteredResult(_0x423053,_0x410f77))[_0x7e8f('0x48')](handleError(_0x423053,null));};exports['show']=function(_0x1ec8be,_0x4fc63e){var _0x4e8827={'raw':![],'where':{'id':_0x1ec8be[_0x7e8f('0x49')]['id']}},_0x15b70f={};_0x15b70f[_0x7e8f('0x37')]=_['keys'](db['VoiceQueueReport'][_0x7e8f('0x30')]);_0x15b70f[_0x7e8f('0x34')]=_['keys'](_0x1ec8be[_0x7e8f('0x34')]);_0x15b70f[_0x7e8f('0x36')]=_[_0x7e8f('0x39')](_0x15b70f[_0x7e8f('0x37')],_0x15b70f[_0x7e8f('0x34')]);_0x4e8827[_0x7e8f('0x38')]=_[_0x7e8f('0x39')](_0x15b70f[_0x7e8f('0x37')],qs[_0x7e8f('0x3a')](_0x1ec8be['query'][_0x7e8f('0x3a')]));_0x4e8827[_0x7e8f('0x38')]=_0x4e8827['attributes']['length']?_0x4e8827[_0x7e8f('0x38')]:_0x15b70f[_0x7e8f('0x37')];if(_0x1ec8be[_0x7e8f('0x34')][_0x7e8f('0x45')]){_0x4e8827[_0x7e8f('0x46')]=[{'all':!![]}];}_0x4e8827=_[_0x7e8f('0x42')]({},_0x4e8827,_0x1ec8be[_0x7e8f('0x44')]);return db[_0x7e8f('0x2f')][_0x7e8f('0x4a')](_0x4e8827)['then'](handleEntityNotFound(_0x4fc63e,null))[_0x7e8f('0x29')](respondWithResult(_0x4fc63e,null))[_0x7e8f('0x48')](handleError(_0x4fc63e,null));};exports[_0x7e8f('0x4b')]=function(_0x39f47c,_0x30a747){return db[_0x7e8f('0x2f')][_0x7e8f('0x4b')](_0x39f47c[_0x7e8f('0x4c')],{})[_0x7e8f('0x29')](respondWithResult(_0x30a747,0xc9))[_0x7e8f('0x48')](handleError(_0x30a747,null));};exports['update']=function(_0x7dfa15,_0x33a98f){if(_0x7dfa15[_0x7e8f('0x4c')]['id']){delete _0x7dfa15[_0x7e8f('0x4c')]['id'];}return db[_0x7e8f('0x2f')][_0x7e8f('0x4a')]({'where':{'id':_0x7dfa15['params']['id']}})[_0x7e8f('0x29')](handleEntityNotFound(_0x33a98f,null))[_0x7e8f('0x29')](saveUpdates(_0x7dfa15['body'],null))[_0x7e8f('0x29')](respondWithResult(_0x33a98f,null))['catch'](handleError(_0x33a98f,null));};exports[_0x7e8f('0x4d')]=function(_0x3e3fc2,_0x47b2b1){return db[_0x7e8f('0x2f')][_0x7e8f('0x4a')]({'where':{'id':_0x3e3fc2[_0x7e8f('0x49')]['id']}})[_0x7e8f('0x29')](handleEntityNotFound(_0x47b2b1,null))[_0x7e8f('0x29')](removeEntity(_0x47b2b1,null))['catch'](handleError(_0x47b2b1,null));};exports[_0x7e8f('0x4e')]=function(_0x7b8601,_0x34da50){return db[_0x7e8f('0x2f')][_0x7e8f('0x4e')]()[_0x7e8f('0x29')](respondWithResult(_0x34da50,null))['catch'](handleError(_0x34da50,null));};exports['getVoiceQueuesReport']=function(_0x40c285,_0x4e6140){var _0x572f30={},_0x441e92={},_0x22e092={'count':0x0,'rows':[]};_0x441e92[_0x7e8f('0x37')]=_[_0x7e8f('0x35')](db[_0x7e8f('0x2f')]['rawAttributes']);_0x441e92[_0x7e8f('0x34')]=_['keys'](_0x40c285[_0x7e8f('0x34')]);_0x441e92[_0x7e8f('0x36')]=_[_0x7e8f('0x39')](_0x441e92['model'],_0x441e92[_0x7e8f('0x34')]);_0x572f30[_0x7e8f('0x38')]=_[_0x7e8f('0x39')](_0x441e92[_0x7e8f('0x37')],qs['fields'](_0x40c285[_0x7e8f('0x34')][_0x7e8f('0x3a')]));_0x572f30[_0x7e8f('0x38')]=_0x572f30[_0x7e8f('0x38')]['length']?_0x572f30[_0x7e8f('0x38')]:_0x441e92['model'];if(!_0x40c285[_0x7e8f('0x34')][_0x7e8f('0x3c')]('nolimit')){_0x572f30[_0x7e8f('0x21')]=qs[_0x7e8f('0x21')](_0x40c285[_0x7e8f('0x34')][_0x7e8f('0x21')]);_0x572f30[_0x7e8f('0x23')]=qs['offset'](_0x40c285[_0x7e8f('0x34')][_0x7e8f('0x23')]);}_0x572f30[_0x7e8f('0x4f')]=qs['sort'](_0x40c285[_0x7e8f('0x34')]['sort']);_0x572f30[_0x7e8f('0x3f')]=qs['filters'](_[_0x7e8f('0x40')](_0x40c285[_0x7e8f('0x34')],_0x441e92['filters']));if(_0x40c285[_0x7e8f('0x34')][_0x7e8f('0x41')]){_0x572f30['where']=_[_0x7e8f('0x42')](_0x572f30[_0x7e8f('0x3f')],{'$or':_[_0x7e8f('0x2e')](_0x572f30[_0x7e8f('0x38')],function(_0x59f270){var _0x1b3d55={};_0x1b3d55[_0x59f270]={'$like':'%'+_0x40c285[_0x7e8f('0x34')][_0x7e8f('0x41')]+'%'};return _0x1b3d55;})});}_0x572f30=_[_0x7e8f('0x42')]({},_0x572f30,_0x40c285[_0x7e8f('0x44')]);var _0x43bb2f={'where':_0x572f30['where']};return db[_0x7e8f('0x2f')][_0x7e8f('0x22')](_0x43bb2f)[_0x7e8f('0x29')](function(_0x530bb7){_0x22e092[_0x7e8f('0x22')]=_0x530bb7;if(_0x40c285[_0x7e8f('0x34')][_0x7e8f('0x45')]){_0x572f30[_0x7e8f('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7e8f('0x47')](_0x572f30);})[_0x7e8f('0x29')](function(_0x368b38){_0x22e092[_0x7e8f('0x50')]=_0x368b38;return _0x22e092;})[_0x7e8f('0x29')](respondWithFilteredResult(_0x4e6140,_0x572f30,'getVoiceQueuesReport'))['catch'](handleError(_0x4e6140,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6300558..d9ba260 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.events.js +++ b/server/api/voiceQueueReport/voiceQueueReport.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a84=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x582cf6,_0xb0834c){var _0x6d541a=function(_0x56ecbe){while(--_0x56ecbe){_0x582cf6['push'](_0x582cf6['shift']());}};_0x6d541a(++_0xb0834c);}(_0x4a84,0xf3));var _0x44a8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4a84[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x44a8('0x0'));var VoiceQueueReport=require(_0x44a8('0x1'))['db'][_0x44a8('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x44a8('0x3')](0x0);var events={'afterCreate':_0x44a8('0x4'),'afterUpdate':'update','afterDestroy':_0x44a8('0x5')};function emitEvent(_0x294048){return function(_0x52ff6a,_0x239f37,_0x101941){VoiceQueueReportEvents[_0x44a8('0x6')](_0x294048+':'+_0x52ff6a['id'],_0x52ff6a);VoiceQueueReportEvents[_0x44a8('0x6')](_0x294048,_0x52ff6a);_0x101941(null);};}for(var e in events){if(events[_0x44a8('0x7')](e)){var event=events[e];VoiceQueueReport[_0x44a8('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x5341=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners'];(function(_0x58256e,_0x48f062){var _0xc9e57b=function(_0x32fb7b){while(--_0x32fb7b){_0x58256e['push'](_0x58256e['shift']());}};_0xc9e57b(++_0x48f062);}(_0x5341,0xb3));var _0x1534=function(_0x5044d9,_0x3f1ee0){_0x5044d9=_0x5044d9-0x0;var _0x42b0be=_0x5341[_0x5044d9];return _0x42b0be;};'use strict';var EventEmitter=require(_0x1534('0x0'));var VoiceQueueReport=require(_0x1534('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1534('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1534('0x3'),'afterDestroy':_0x1534('0x4')};function emitEvent(_0xde0ec3){return function(_0x547934,_0x2b433c,_0x4b9945){VoiceQueueReportEvents['emit'](_0xde0ec3+':'+_0x547934['id'],_0x547934);VoiceQueueReportEvents[_0x1534('0x5')](_0xde0ec3,_0x547934);_0x4b9945(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x1534('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index e99b5ff..947ea5c 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31ca=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','calleridnum','lodash','util','../../config/logger','api'];(function(_0x17e1dc,_0x495627){var _0x17dd25=function(_0x535bac){while(--_0x535bac){_0x17e1dc['push'](_0x17e1dc['shift']());}};_0x17dd25(++_0x495627);}(_0x31ca,0x14e));var _0xa31c=function(_0x56ebf2,_0x4a7b69){_0x56ebf2=_0x56ebf2-0x0;var _0x27f0fb=_0x31ca[_0x56ebf2];return _0x27f0fb;};'use strict';var _=require(_0xa31c('0x0'));var util=require(_0xa31c('0x1'));var logger=require(_0xa31c('0x2'))(_0xa31c('0x3'));var moment=require(_0xa31c('0x4'));var BPromise=require(_0xa31c('0x5'));var rp=require(_0xa31c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa31c('0x7'));var config=require(_0xa31c('0x8'));var attributes=require(_0xa31c('0x9'));module[_0xa31c('0xa')]=function(_0x1593cd,_0x2dfdfb){return _0x1593cd['define'](_0xa31c('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xa31c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21e3=['path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','moment','bluebird'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x21e3,0x1a9));var _0x321e=function(_0x5d6195,_0x557a54){_0x5d6195=_0x5d6195-0x0;var _0x333782=_0x21e3[_0x5d6195];return _0x333782;};'use strict';var _=require('lodash');var util=require(_0x321e('0x0'));var logger=require(_0x321e('0x1'))('api');var moment=require(_0x321e('0x2'));var BPromise=require(_0x321e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x321e('0x4'));var rimraf=require(_0x321e('0x5'));var config=require('../../config/environment');var attributes=require(_0x321e('0x6'));module[_0x321e('0x7')]=function(_0x5f5cc4,_0xa8a465){return _0x5f5cc4[_0x321e('0x8')](_0x321e('0x9'),attributes,{'tableName':_0x321e('0xa'),'paranoid':![],'indexes':[{'fields':[_0x321e('0xb')]},{'fields':[_0x321e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c652879..9202fcc 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.rpc.js +++ b/server/api/voiceQueueReport/voiceQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa509=['message','info','request\x20sent','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','include','model','debug','CreateVoiceQueueReport','body','raw','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x481f9a,_0x4e2cdf){var _0x689304=function(_0x2739f7){while(--_0x2739f7){_0x481f9a['push'](_0x481f9a['shift']());}};_0x689304(++_0x4e2cdf);}(_0xa509,0x15a));var _0x9a50=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa509[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9a50('0x0'));var moment=require(_0x9a50('0x1'));var BPromise=require(_0x9a50('0x2'));var rs=require(_0x9a50('0x3'));var fs=require('fs');var Redis=require(_0x9a50('0x4'));var db=require(_0x9a50('0x5'))['db'];var utils=require(_0x9a50('0x6'));var logger=require('../../config/logger')(_0x9a50('0x7'));var config=require('../../config/environment');var jayson=require(_0x9a50('0x8'));var client=jayson[_0x9a50('0x9')]['http']({'port':0x232a});config[_0x9a50('0xa')]=_[_0x9a50('0xb')](config[_0x9a50('0xa')],{'host':_0x9a50('0xc'),'port':0x18eb});var socket=require(_0x9a50('0xd'))(new Redis(config['redis']));require(_0x9a50('0xe'))[_0x9a50('0xf')](socket);function respondWithRpcPromise(_0x310132,_0x8ba0fe,_0x500e66){return new BPromise(function(_0x5b99ad,_0x278367){return client[_0x9a50('0x10')](_0x310132,_0x500e66)[_0x9a50('0x11')](function(_0x13f8db){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x8ba0fe,'request\x20sent');logger['debug'](_0x9a50('0x12'),_0x8ba0fe,'request\x20sent',JSON[_0x9a50('0x13')](_0x13f8db));if(_0x13f8db['error']){if(_0x13f8db[_0x9a50('0x14')][_0x9a50('0x15')]===0x1f4){logger[_0x9a50('0x14')](_0x9a50('0x16'),_0x8ba0fe,_0x13f8db['error'][_0x9a50('0x17')]);return _0x278367(_0x13f8db[_0x9a50('0x14')][_0x9a50('0x17')]);}logger['error'](_0x9a50('0x16'),_0x8ba0fe,_0x13f8db[_0x9a50('0x14')][_0x9a50('0x17')]);return _0x5b99ad(_0x13f8db[_0x9a50('0x14')][_0x9a50('0x17')]);}else{logger[_0x9a50('0x18')](_0x9a50('0x16'),_0x8ba0fe,_0x9a50('0x19'));_0x5b99ad(_0x13f8db['result']['message']);}})[_0x9a50('0x1a')](function(_0x48ff5e){logger[_0x9a50('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x8ba0fe,_0x48ff5e);_0x278367(_0x48ff5e);});});}exports[_0x9a50('0x1b')]=function(_0x2f0b50){var _0x21495d=this;return new Promise(function(_0x4477c8,_0x109d50){return db[_0x9a50('0x1c')]['findAll']({'raw':_0x2f0b50[_0x9a50('0x1d')]?_0x2f0b50[_0x9a50('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2f0b50['options']?_0x2f0b50['options'][_0x9a50('0x1e')]||null:null,'attributes':_0x2f0b50[_0x9a50('0x1d')]?_0x2f0b50[_0x9a50('0x1d')][_0x9a50('0x1f')]||null:null,'limit':_0x2f0b50[_0x9a50('0x1d')]?_0x2f0b50[_0x9a50('0x1d')][_0x9a50('0x20')]||null:null,'include':_0x2f0b50[_0x9a50('0x1d')]?_0x2f0b50[_0x9a50('0x1d')][_0x9a50('0x21')]?_['map'](_0x2f0b50[_0x9a50('0x1d')][_0x9a50('0x21')],function(_0x3041be){return{'model':db[_0x3041be[_0x9a50('0x22')]],'as':_0x3041be['as'],'attributes':_0x3041be[_0x9a50('0x1f')],'include':_0x3041be[_0x9a50('0x21')]?_['map'](_0x3041be[_0x9a50('0x21')],function(_0x5a60d0){return{'model':db[_0x5a60d0[_0x9a50('0x22')]],'as':_0x5a60d0['as'],'attributes':_0x5a60d0[_0x9a50('0x1f')],'include':_0x5a60d0[_0x9a50('0x21')]?_['map'](_0x5a60d0['include'],function(_0x17be02){return{'model':db[_0x17be02[_0x9a50('0x22')]],'as':_0x17be02['as'],'attributes':_0x17be02[_0x9a50('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d2a16){logger[_0x9a50('0x18')]('GetVoiceQueueReport',_0x2f0b50);logger[_0x9a50('0x23')](_0x9a50('0x1b'),_0x2f0b50,JSON[_0x9a50('0x13')](_0x4d2a16));_0x4477c8(_0x4d2a16);})[_0x9a50('0x1a')](function(_0x3a1cc1){logger['error'](_0x9a50('0x1b'),_0x3a1cc1[_0x9a50('0x17')],_0x2f0b50);_0x109d50(_0x21495d[_0x9a50('0x14')](0x1f4,_0x3a1cc1[_0x9a50('0x17')]));});});};exports[_0x9a50('0x24')]=function(_0x993216){var _0x314556=this;return new Promise(function(_0x5dda52,_0x376e89){return db['VoiceQueueReport']['create'](_0x993216[_0x9a50('0x25')],{'raw':_0x993216[_0x9a50('0x1d')]?_0x993216[_0x9a50('0x1d')][_0x9a50('0x26')]===undefined?!![]:![]:!![]})[_0x9a50('0x11')](function(_0x5a121c){logger[_0x9a50('0x18')](_0x9a50('0x24'),_0x993216);logger[_0x9a50('0x23')](_0x9a50('0x24'),_0x993216,JSON['stringify'](_0x5a121c));_0x5dda52(_0x5a121c);})['catch'](function(_0x4c773a){logger[_0x9a50('0x14')]('CreateVoiceQueueReport',_0x4c773a[_0x9a50('0x17')],_0x993216);_0x376e89(_0x314556[_0x9a50('0x14')](0x1f4,_0x4c773a['message']));});});};exports[_0x9a50('0x27')]=function(_0x2d91c8){var _0x3500e3=this;return new Promise(function(_0x418088,_0x426086){return db['VoiceQueueReport'][_0x9a50('0x28')](_0x2d91c8[_0x9a50('0x25')],{'raw':_0x2d91c8['options']?_0x2d91c8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d91c8[_0x9a50('0x1d')]?_0x2d91c8[_0x9a50('0x1d')][_0x9a50('0x1e')]||null:null,'attributes':_0x2d91c8[_0x9a50('0x1d')]?_0x2d91c8[_0x9a50('0x1d')][_0x9a50('0x1f')]||null:null,'limit':_0x2d91c8['options']?_0x2d91c8[_0x9a50('0x1d')][_0x9a50('0x20')]||null:null})[_0x9a50('0x11')](function(_0x325c5d){logger['info']('UpdateVoiceQueueReport',_0x2d91c8);logger['debug']('UpdateVoiceQueueReport',_0x2d91c8,JSON[_0x9a50('0x13')](_0x325c5d));_0x418088(_0x325c5d);})[_0x9a50('0x1a')](function(_0x487b76){logger[_0x9a50('0x14')](_0x9a50('0x27'),_0x487b76[_0x9a50('0x17')],_0x2d91c8);_0x426086(_0x3500e3['error'](0x1f4,_0x487b76['message']));});});}; \ No newline at end of file +var _0x8fb9=['redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x14f327,_0x80dee2){var _0x21b9e7=function(_0x1c2acf){while(--_0x1c2acf){_0x14f327['push'](_0x14f327['shift']());}};_0x21b9e7(++_0x80dee2);}(_0x8fb9,0x128));var _0x98fb=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x8fb9[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x98fb('0x0'));var util=require(_0x98fb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x98fb('0x2'));var fs=require('fs');var Redis=require(_0x98fb('0x3'));var db=require(_0x98fb('0x4'))['db'];var utils=require(_0x98fb('0x5'));var logger=require('../../config/logger')(_0x98fb('0x6'));var config=require(_0x98fb('0x7'));var jayson=require(_0x98fb('0x8'));var client=jayson[_0x98fb('0x9')][_0x98fb('0xa')]({'port':0x232a});config['redis']=_[_0x98fb('0xb')](config[_0x98fb('0xc')],{'host':_0x98fb('0xd'),'port':0x18eb});var socket=require(_0x98fb('0xe'))(new Redis(config[_0x98fb('0xc')]));require(_0x98fb('0xf'))[_0x98fb('0x10')](socket);function respondWithRpcPromise(_0x5c19d0,_0x54943e,_0x348e44){return new BPromise(function(_0x1dc765,_0x546605){return client[_0x98fb('0x11')](_0x5c19d0,_0x348e44)['then'](function(_0x2a24c6){logger[_0x98fb('0x12')](_0x98fb('0x13'),_0x54943e,_0x98fb('0x14'));logger['debug'](_0x98fb('0x15'),_0x54943e,_0x98fb('0x14'),JSON[_0x98fb('0x16')](_0x2a24c6));if(_0x2a24c6[_0x98fb('0x17')]){if(_0x2a24c6[_0x98fb('0x17')][_0x98fb('0x18')]===0x1f4){logger[_0x98fb('0x17')](_0x98fb('0x13'),_0x54943e,_0x2a24c6[_0x98fb('0x17')][_0x98fb('0x19')]);return _0x546605(_0x2a24c6[_0x98fb('0x17')][_0x98fb('0x19')]);}logger[_0x98fb('0x17')](_0x98fb('0x13'),_0x54943e,_0x2a24c6[_0x98fb('0x17')]['message']);return _0x1dc765(_0x2a24c6['error']['message']);}else{logger[_0x98fb('0x12')](_0x98fb('0x13'),_0x54943e,_0x98fb('0x14'));_0x1dc765(_0x2a24c6['result'][_0x98fb('0x19')]);}})[_0x98fb('0x1a')](function(_0x1ab935){logger[_0x98fb('0x17')](_0x98fb('0x13'),_0x54943e,_0x1ab935);_0x546605(_0x1ab935);});});}exports[_0x98fb('0x1b')]=function(_0xe8e252){var _0x3fda31=this;return new Promise(function(_0x7ced3e,_0x26b2b4){return db[_0x98fb('0x1c')][_0x98fb('0x1d')]({'raw':_0xe8e252[_0x98fb('0x1e')]?_0xe8e252[_0x98fb('0x1e')][_0x98fb('0x1f')]===undefined?!![]:![]:!![],'where':_0xe8e252['options']?_0xe8e252[_0x98fb('0x1e')]['where']||null:null,'attributes':_0xe8e252[_0x98fb('0x1e')]?_0xe8e252[_0x98fb('0x1e')][_0x98fb('0x20')]||null:null,'limit':_0xe8e252[_0x98fb('0x1e')]?_0xe8e252[_0x98fb('0x1e')][_0x98fb('0x21')]||null:null,'include':_0xe8e252[_0x98fb('0x1e')]?_0xe8e252[_0x98fb('0x1e')][_0x98fb('0x22')]?_[_0x98fb('0x23')](_0xe8e252['options'][_0x98fb('0x22')],function(_0x5de9ec){return{'model':db[_0x5de9ec['model']],'as':_0x5de9ec['as'],'attributes':_0x5de9ec[_0x98fb('0x20')],'include':_0x5de9ec[_0x98fb('0x22')]?_[_0x98fb('0x23')](_0x5de9ec[_0x98fb('0x22')],function(_0x44e92d){return{'model':db[_0x44e92d[_0x98fb('0x24')]],'as':_0x44e92d['as'],'attributes':_0x44e92d[_0x98fb('0x20')],'include':_0x44e92d['include']?_['map'](_0x44e92d['include'],function(_0x5f573f){return{'model':db[_0x5f573f['model']],'as':_0x5f573f['as'],'attributes':_0x5f573f[_0x98fb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a72f3){logger[_0x98fb('0x12')](_0x98fb('0x1b'),_0xe8e252);logger[_0x98fb('0x25')]('GetVoiceQueueReport',_0xe8e252,JSON[_0x98fb('0x16')](_0x5a72f3));_0x7ced3e(_0x5a72f3);})[_0x98fb('0x1a')](function(_0x1305c8){logger[_0x98fb('0x17')](_0x98fb('0x1b'),_0x1305c8[_0x98fb('0x19')],_0xe8e252);_0x26b2b4(_0x3fda31[_0x98fb('0x17')](0x1f4,_0x1305c8[_0x98fb('0x19')]));});});};exports[_0x98fb('0x26')]=function(_0x62fcda){var _0x53f3cd=this;return new Promise(function(_0x21ff91,_0x222f0f){return db['VoiceQueueReport'][_0x98fb('0x27')](_0x62fcda['body'],{'raw':_0x62fcda[_0x98fb('0x1e')]?_0x62fcda['options'][_0x98fb('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x34173c){logger[_0x98fb('0x12')](_0x98fb('0x26'),_0x62fcda);logger[_0x98fb('0x25')](_0x98fb('0x26'),_0x62fcda,JSON[_0x98fb('0x16')](_0x34173c));_0x21ff91(_0x34173c);})[_0x98fb('0x1a')](function(_0x39b828){logger[_0x98fb('0x17')](_0x98fb('0x26'),_0x39b828[_0x98fb('0x19')],_0x62fcda);_0x222f0f(_0x53f3cd[_0x98fb('0x17')](0x1f4,_0x39b828['message']));});});};exports[_0x98fb('0x28')]=function(_0x29a465){var _0x5cd6df=this;return new Promise(function(_0x1bc103,_0x11e5bb){return db['VoiceQueueReport'][_0x98fb('0x29')](_0x29a465[_0x98fb('0x2a')],{'raw':_0x29a465[_0x98fb('0x1e')]?_0x29a465[_0x98fb('0x1e')][_0x98fb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29a465[_0x98fb('0x1e')]?_0x29a465['options'][_0x98fb('0x2b')]||null:null,'attributes':_0x29a465['options']?_0x29a465[_0x98fb('0x1e')][_0x98fb('0x20')]||null:null,'limit':_0x29a465[_0x98fb('0x1e')]?_0x29a465['options'][_0x98fb('0x21')]||null:null})['then'](function(_0x9408c1){logger['info']('UpdateVoiceQueueReport',_0x29a465);logger[_0x98fb('0x25')](_0x98fb('0x28'),_0x29a465,JSON[_0x98fb('0x16')](_0x9408c1));_0x1bc103(_0x9408c1);})[_0x98fb('0x1a')](function(_0xeaec9c){logger['error'](_0x98fb('0x28'),_0xeaec9c['message'],_0x29a465);_0x11e5bb(_0x5cd6df[_0x98fb('0x17')](0x1f4,_0xeaec9c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 10e7ad6..1184015 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.socket.js +++ b/server/api/voiceQueueReport/voiceQueueReport.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x059d=['./voiceQueueReport.events','save','remove','update','emit','removeListener','voiceQueueReport:'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x059d,0x1b9));var _0xd059=function(_0x374447,_0x30082f){_0x374447=_0x374447-0x0;var _0x4a91d1=_0x059d[_0x374447];return _0x4a91d1;};'use strict';var VoiceQueueReportEvents=require(_0xd059('0x0'));var events=[_0xd059('0x1'),_0xd059('0x2'),_0xd059('0x3')];function createListener(_0x41a225,_0x1f0a13){return function(_0x51d3e2){_0x1f0a13[_0xd059('0x4')](_0x41a225,_0x51d3e2);};}function removeListener(_0x3d718f,_0x1bc791){return function(){VoiceQueueReportEvents[_0xd059('0x5')](_0x3d718f,_0x1bc791);};}exports['register']=function(_0x2e94fa){for(var _0x4755c4=0x0,_0x71a46a=events['length'];_0x4755c4<_0x71a46a;_0x4755c4++){var _0x45afbe=events[_0x4755c4];var _0x88d4a7=createListener(_0xd059('0x6')+_0x45afbe,_0x2e94fa);VoiceQueueReportEvents['on'](_0x45afbe,_0x88d4a7);}}; \ No newline at end of file +var _0xe28f=['save','emit','register','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x9f9d03,_0x1c5f58){var _0x363f8=function(_0x408ce2){while(--_0x408ce2){_0x9f9d03['push'](_0x9f9d03['shift']());}};_0x363f8(++_0x1c5f58);}(_0xe28f,0x1e9));var _0xfe28=function(_0x37e710,_0x2a3482){_0x37e710=_0x37e710-0x0;var _0x6f54e9=_0xe28f[_0x37e710];return _0x6f54e9;};'use strict';var VoiceQueueReportEvents=require(_0xfe28('0x0'));var events=[_0xfe28('0x1'),'remove','update'];function createListener(_0x41266c,_0x3b0d21){return function(_0x3eb692){_0x3b0d21[_0xfe28('0x2')](_0x41266c,_0x3eb692);};}function removeListener(_0x1e4fc2,_0x239f5f){return function(){VoiceQueueReportEvents['removeListener'](_0x1e4fc2,_0x239f5f);};}exports[_0xfe28('0x3')]=function(_0x17f1c6){for(var _0x56605b=0x0,_0x5a7515=events['length'];_0x56605b<_0x5a7515;_0x56605b++){var _0x5f1a6f=events[_0x56605b];var _0x42bf9c=createListener(_0xfe28('0x4')+_0x5f1a6f,_0x17f1c6);VoiceQueueReportEvents['on'](_0x5f1a6f,_0x42bf9c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index fd2a2a2..ff8d8b5 100644 --- a/server/api/voiceQueuesLog/index.js +++ b/server/api/voiceQueuesLog/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67f0=['create','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post'];(function(_0x49afa0,_0x236ac6){var _0x451731=function(_0x32144a){while(--_0x32144a){_0x49afa0['push'](_0x49afa0['shift']());}};_0x451731(++_0x236ac6);}(_0x67f0,0x106));var _0x067f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x67f0[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x067f('0x0'));var path=require('path');var timeout=require(_0x067f('0x1'));var express=require('express');var router=express[_0x067f('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x067f('0x3'));var config=require(_0x067f('0x4'));var controller=require(_0x067f('0x5'));router[_0x067f('0x6')]('/',auth[_0x067f('0x7')](),controller['index']);router[_0x067f('0x6')](_0x067f('0x8'),auth['isAuthenticated'](),controller[_0x067f('0x9')]);router[_0x067f('0xa')]('/',auth['isAuthenticated'](),controller[_0x067f('0xb')]);router['put'](_0x067f('0x8'),auth[_0x067f('0x7')](),controller['update']);router['delete'](_0x067f('0x8'),auth[_0x067f('0x7')](),controller['destroy']);module[_0x067f('0xc')]=router; \ No newline at end of file +var _0xa902=['/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5496ff,_0x104d17){var _0x36881c=function(_0x395a82){while(--_0x395a82){_0x5496ff['push'](_0x5496ff['shift']());}};_0x36881c(++_0x104d17);}(_0xa902,0x1ee));var _0x2a90=function(_0x548e80,_0x6fb62f){_0x548e80=_0x548e80-0x0;var _0x4fa5c0=_0xa902[_0x548e80];return _0x4fa5c0;};'use strict';var multer=require('multer');var util=require(_0x2a90('0x0'));var path=require(_0x2a90('0x1'));var timeout=require(_0x2a90('0x2'));var express=require('express');var router=express[_0x2a90('0x3')]();var fs_extra=require(_0x2a90('0x4'));var auth=require(_0x2a90('0x5'));var interaction=require(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x2a90('0x8')]('/',auth[_0x2a90('0x9')](),controller['index']);router[_0x2a90('0x8')](_0x2a90('0xa'),auth[_0x2a90('0x9')](),controller[_0x2a90('0xb')]);router[_0x2a90('0xc')]('/',auth[_0x2a90('0x9')](),controller[_0x2a90('0xd')]);router['put'](_0x2a90('0xa'),auth[_0x2a90('0x9')](),controller[_0x2a90('0xe')]);router[_0x2a90('0xf')]('/:id',auth[_0x2a90('0x9')](),controller[_0x2a90('0x10')]);module[_0x2a90('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6c43ff6..73bc281 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ab9=['exports','STRING','DATE','literal','sequelize','moment'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x3ab9,0x112));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x93ab('0x0'));var moment=require(_0x93ab('0x1'));module[_0x93ab('0x2')]={'time':{'type':Sequelize[_0x93ab('0x3')]},'callid':{'type':Sequelize[_0x93ab('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x93ab('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x93ab('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x93ab('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x93ab('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x93ab('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xb2c9=['exports','STRING','literal','moment'];(function(_0x593378,_0x55e11e){var _0x62b06=function(_0x121594){while(--_0x121594){_0x593378['push'](_0x593378['shift']());}};_0x62b06(++_0x55e11e);}(_0xb2c9,0x18f));var _0x9b2c=function(_0xb19de0,_0x28572e){_0xb19de0=_0xb19de0-0x0;var _0x4d39ec=_0xb2c9[_0xb19de0];return _0x4d39ec;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9b2c('0x0'));module[_0x9b2c('0x1')]={'time':{'type':Sequelize[_0x9b2c('0x2')]},'callid':{'type':Sequelize[_0x9b2c('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9b2c('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x9b2c('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9b2c('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x9b2c('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9b2c('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9b2c('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x9b2c('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9b2c('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9b2c('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9b2c('0x3')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4922d48..5a5625f 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9a2=['moment','bluebird','path','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x48a236,_0x4256f1){var _0xa7c2be=function(_0x90f054){while(--_0x90f054){_0x48a236['push'](_0x48a236['shift']());}};_0xa7c2be(++_0x4256f1);}(_0xb9a2,0x1be));var _0x2b9a=function(_0x107568,_0x5bacdd){_0x107568=_0x107568-0x0;var _0x1d84eb=_0xb9a2[_0x107568];return _0x1d84eb;};'use strict';var emlformat=require(_0x2b9a('0x0'));var rimraf=require(_0x2b9a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b9a('0x2'));var rp=require(_0x2b9a('0x3'));var moment=require(_0x2b9a('0x4'));var BPromise=require(_0x2b9a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2b9a('0x6'));var sox=require('sox');var csv=require(_0x2b9a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b9a('0x8'));var _=require(_0x2b9a('0x9'));var squel=require('squel');var crypto=require(_0x2b9a('0xa'));var jsforce=require(_0x2b9a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2b9a('0x7'));var querystring=require('querystring');var Papa=require(_0x2b9a('0xc'));var Redis=require(_0x2b9a('0xd'));var authService=require(_0x2b9a('0xe'));var qs=require(_0x2b9a('0xf'));var as=require(_0x2b9a('0x10'));var hardwareService=require(_0x2b9a('0x11'));var logger=require(_0x2b9a('0x12'))(_0x2b9a('0x13'));var utils=require(_0x2b9a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2b9a('0x15'));var db=require(_0x2b9a('0x16'))['db'];function respondWithStatusCode(_0xaaae3e,_0x273989){_0x273989=_0x273989||0xcc;return function(_0x2422df){if(_0x2422df){return _0xaaae3e[_0x2b9a('0x17')](_0x273989);}return _0xaaae3e[_0x2b9a('0x18')](_0x273989)[_0x2b9a('0x19')]();};}function respondWithResult(_0x4ce004,_0x339be7){_0x339be7=_0x339be7||0xc8;return function(_0x5997b4){if(_0x5997b4){return _0x4ce004[_0x2b9a('0x18')](_0x339be7)[_0x2b9a('0x1a')](_0x5997b4);}};}function respondWithFilteredResult(_0xfaff75,_0x2772ac){return function(_0x59d154){if(_0x59d154){var _0x3c0f60=typeof _0x2772ac[_0x2b9a('0x1b')]===_0x2b9a('0x1c')&&typeof _0x2772ac[_0x2b9a('0x1d')]==='undefined';var _0x45457b=_0x59d154['count'];var _0x11df2e=_0x3c0f60?0x0:_0x2772ac[_0x2b9a('0x1b')];var _0x3650ab=_0x3c0f60?_0x59d154[_0x2b9a('0x1e')]:_0x2772ac[_0x2b9a('0x1b')]+_0x2772ac[_0x2b9a('0x1d')];var _0x1b5202;if(_0x3650ab>=_0x45457b){_0x3650ab=_0x45457b;_0x1b5202=0xc8;}else{_0x1b5202=0xce;}_0xfaff75[_0x2b9a('0x18')](_0x1b5202);return _0xfaff75[_0x2b9a('0x1f')](_0x2b9a('0x20'),_0x11df2e+'-'+_0x3650ab+'/'+_0x45457b)['json'](_0x59d154);}return null;};}function patchUpdates(_0x52f0dc){return function(_0x11c9be){try{jsonpatch['apply'](_0x11c9be,_0x52f0dc,!![]);}catch(_0x436ad2){return BPromise[_0x2b9a('0x21')](_0x436ad2);}return _0x11c9be['save']();};}function saveUpdates(_0x1b1c4e,_0x37d96e){return function(_0x2bef96){if(_0x2bef96){return _0x2bef96[_0x2b9a('0x22')](_0x1b1c4e)['then'](function(_0x45fe44){return _0x45fe44;});}return null;};}function removeEntity(_0x35aee1,_0x1ed502){return function(_0x7b4992){if(_0x7b4992){return _0x7b4992[_0x2b9a('0x23')]()[_0x2b9a('0x24')](function(){_0x35aee1[_0x2b9a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21ea25,_0x38a51f){return function(_0x4eb9dc){if(!_0x4eb9dc){_0x21ea25[_0x2b9a('0x17')](0x194);}return _0x4eb9dc;};}function handleError(_0x215f44,_0x1e1a4a){_0x1e1a4a=_0x1e1a4a||0x1f4;return function(_0x587f1c){logger[_0x2b9a('0x25')](_0x587f1c['stack']);if(_0x587f1c[_0x2b9a('0x26')]){delete _0x587f1c[_0x2b9a('0x26')];}_0x215f44[_0x2b9a('0x18')](_0x1e1a4a)[_0x2b9a('0x27')](_0x587f1c);};}exports[_0x2b9a('0x28')]=function(_0x22e63a,_0x24d4cd){var _0x61efbe={},_0x5590f9={},_0xcf7961={'count':0x0,'rows':[]};var _0x56a454=_[_0x2b9a('0x29')](db[_0x2b9a('0x2a')][_0x2b9a('0x2b')],function(_0x2c2460){return{'name':_0x2c2460[_0x2b9a('0x2c')],'type':_0x2c2460[_0x2b9a('0x2d')][_0x2b9a('0x2e')]};});_0x5590f9[_0x2b9a('0x2f')]=_['map'](_0x56a454,_0x2b9a('0x26'));_0x5590f9['query']=_[_0x2b9a('0x30')](_0x22e63a[_0x2b9a('0x31')]);_0x5590f9['filters']=_[_0x2b9a('0x32')](_0x5590f9[_0x2b9a('0x2f')],_0x5590f9['query']);_0x61efbe['attributes']=_[_0x2b9a('0x32')](_0x5590f9[_0x2b9a('0x2f')],qs[_0x2b9a('0x33')](_0x22e63a['query'][_0x2b9a('0x33')]));_0x61efbe[_0x2b9a('0x34')]=_0x61efbe[_0x2b9a('0x34')][_0x2b9a('0x35')]?_0x61efbe[_0x2b9a('0x34')]:_0x5590f9[_0x2b9a('0x2f')];if(!_0x22e63a[_0x2b9a('0x31')][_0x2b9a('0x36')](_0x2b9a('0x37'))){_0x61efbe[_0x2b9a('0x1d')]=qs['limit'](_0x22e63a[_0x2b9a('0x31')]['limit']);_0x61efbe[_0x2b9a('0x1b')]=qs[_0x2b9a('0x1b')](_0x22e63a['query'][_0x2b9a('0x1b')]);}_0x61efbe[_0x2b9a('0x38')]=qs[_0x2b9a('0x39')](_0x22e63a[_0x2b9a('0x31')][_0x2b9a('0x39')]);_0x61efbe[_0x2b9a('0x3a')]=qs['filters'](_[_0x2b9a('0x3b')](_0x22e63a[_0x2b9a('0x31')],_0x5590f9[_0x2b9a('0x3c')]),_0x56a454);if(_0x22e63a[_0x2b9a('0x31')]['filter']){_0x61efbe[_0x2b9a('0x3a')]=_[_0x2b9a('0x3d')](_0x61efbe[_0x2b9a('0x3a')],{'$or':_['map'](_0x56a454,function(_0x50c194){if(_0x50c194[_0x2b9a('0x2d')]!==_0x2b9a('0x3e')){var _0xa6825={};_0xa6825[_0x50c194[_0x2b9a('0x26')]]={'$like':'%'+_0x22e63a[_0x2b9a('0x31')][_0x2b9a('0x3f')]+'%'};return _0xa6825;}})});}_0x61efbe=_[_0x2b9a('0x3d')]({},_0x61efbe,_0x22e63a[_0x2b9a('0x40')]);var _0x6aa31e={'where':_0x61efbe[_0x2b9a('0x3a')]};return db[_0x2b9a('0x2a')][_0x2b9a('0x1e')](_0x6aa31e)[_0x2b9a('0x24')](function(_0x25b1eb){_0xcf7961[_0x2b9a('0x1e')]=_0x25b1eb;if(_0x22e63a[_0x2b9a('0x31')][_0x2b9a('0x41')]){_0x61efbe[_0x2b9a('0x42')]=[{'all':!![]}];}return db[_0x2b9a('0x2a')][_0x2b9a('0x43')](_0x61efbe);})[_0x2b9a('0x24')](function(_0x1d12b4){_0xcf7961[_0x2b9a('0x44')]=_0x1d12b4;return _0xcf7961;})['then'](respondWithFilteredResult(_0x24d4cd,_0x61efbe))['catch'](handleError(_0x24d4cd,null));};exports[_0x2b9a('0x45')]=function(_0x6914ed,_0x2232ea){var _0x53e7b8={'raw':!![],'where':{'id':_0x6914ed['params']['id']}},_0x1a0352={};_0x1a0352['model']=_[_0x2b9a('0x30')](db[_0x2b9a('0x2a')][_0x2b9a('0x2b')]);_0x1a0352['query']=_[_0x2b9a('0x30')](_0x6914ed[_0x2b9a('0x31')]);_0x1a0352[_0x2b9a('0x3c')]=_[_0x2b9a('0x32')](_0x1a0352[_0x2b9a('0x2f')],_0x1a0352[_0x2b9a('0x31')]);_0x53e7b8[_0x2b9a('0x34')]=_['intersection'](_0x1a0352[_0x2b9a('0x2f')],qs[_0x2b9a('0x33')](_0x6914ed[_0x2b9a('0x31')][_0x2b9a('0x33')]));_0x53e7b8[_0x2b9a('0x34')]=_0x53e7b8['attributes']['length']?_0x53e7b8[_0x2b9a('0x34')]:_0x1a0352[_0x2b9a('0x2f')];if(_0x6914ed['query'][_0x2b9a('0x41')]){_0x53e7b8[_0x2b9a('0x42')]=[{'all':!![]}];}_0x53e7b8=_[_0x2b9a('0x3d')]({},_0x53e7b8,_0x6914ed[_0x2b9a('0x40')]);return db[_0x2b9a('0x2a')][_0x2b9a('0x46')](_0x53e7b8)[_0x2b9a('0x24')](handleEntityNotFound(_0x2232ea,null))[_0x2b9a('0x24')](respondWithResult(_0x2232ea,null))[_0x2b9a('0x47')](handleError(_0x2232ea,null));};exports['create']=function(_0x14fa9d,_0x18658a){return db[_0x2b9a('0x2a')][_0x2b9a('0x48')](_0x14fa9d[_0x2b9a('0x49')],{})[_0x2b9a('0x24')](respondWithResult(_0x18658a,0xc9))[_0x2b9a('0x47')](handleError(_0x18658a,null));};exports[_0x2b9a('0x22')]=function(_0x5c2128,_0xcf9fed){if(_0x5c2128[_0x2b9a('0x49')]['id']){delete _0x5c2128[_0x2b9a('0x49')]['id'];}return db[_0x2b9a('0x2a')]['find']({'where':{'id':_0x5c2128[_0x2b9a('0x4a')]['id']}})[_0x2b9a('0x24')](handleEntityNotFound(_0xcf9fed,null))[_0x2b9a('0x24')](saveUpdates(_0x5c2128[_0x2b9a('0x49')],null))[_0x2b9a('0x24')](respondWithResult(_0xcf9fed,null))[_0x2b9a('0x47')](handleError(_0xcf9fed,null));};exports[_0x2b9a('0x23')]=function(_0x258a23,_0x48ba53){return db[_0x2b9a('0x2a')][_0x2b9a('0x46')]({'where':{'id':_0x258a23[_0x2b9a('0x4a')]['id']}})[_0x2b9a('0x24')](handleEntityNotFound(_0x48ba53,null))[_0x2b9a('0x24')](removeEntity(_0x48ba53,null))[_0x2b9a('0x47')](handleError(_0x48ba53,null));}; \ No newline at end of file +var _0xde6e=['catch','show','params','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','status','end','sendStatus','error','stack','send','index','VoiceQueuesLog','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','length','nolimit','order','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x4f69d8,_0x1edd11){var _0x3bf5ed=function(_0x9f53ac){while(--_0x9f53ac){_0x4f69d8['push'](_0x4f69d8['shift']());}};_0x3bf5ed(++_0x1edd11);}(_0xde6e,0x174));var _0xede6=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0xde6e[_0x4c9f6a];return _0x5df5b9;};'use strict';var emlformat=require(_0xede6('0x0'));var rimraf=require(_0xede6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xede6('0x2'));var rp=require(_0xede6('0x3'));var moment=require(_0xede6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xede6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xede6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xede6('0x7'));var _=require('lodash');var squel=require(_0xede6('0x8'));var crypto=require(_0xede6('0x9'));var jsforce=require(_0xede6('0xa'));var deskjs=require(_0xede6('0xb'));var toCsv=require(_0xede6('0x6'));var querystring=require('querystring');var Papa=require(_0xede6('0xc'));var Redis=require(_0xede6('0xd'));var authService=require(_0xede6('0xe'));var qs=require(_0xede6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xede6('0x10'));var logger=require(_0xede6('0x11'))(_0xede6('0x12'));var utils=require(_0xede6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xede6('0x14'));var db=require(_0xede6('0x15'))['db'];function respondWithStatusCode(_0x1a4180,_0x28d3df){_0x28d3df=_0x28d3df||0xcc;return function(_0x2a8dfa){if(_0x2a8dfa){return _0x1a4180['sendStatus'](_0x28d3df);}return _0x1a4180['status'](_0x28d3df)['end']();};}function respondWithResult(_0xd89306,_0x1fb561){_0x1fb561=_0x1fb561||0xc8;return function(_0x5884a6){if(_0x5884a6){return _0xd89306['status'](_0x1fb561)['json'](_0x5884a6);}};}function respondWithFilteredResult(_0x57d21d,_0x3a61c5){return function(_0x564bd0){if(_0x564bd0){var _0x9db2b3=typeof _0x3a61c5['offset']===_0xede6('0x16')&&typeof _0x3a61c5[_0xede6('0x17')]==='undefined';var _0x8d948c=_0x564bd0[_0xede6('0x18')];var _0x4a364e=_0x9db2b3?0x0:_0x3a61c5[_0xede6('0x19')];var _0xb57a08=_0x9db2b3?_0x564bd0[_0xede6('0x18')]:_0x3a61c5['offset']+_0x3a61c5[_0xede6('0x17')];var _0x17ddb4;if(_0xb57a08>=_0x8d948c){_0xb57a08=_0x8d948c;_0x17ddb4=0xc8;}else{_0x17ddb4=0xce;}_0x57d21d['status'](_0x17ddb4);return _0x57d21d[_0xede6('0x1a')](_0xede6('0x1b'),_0x4a364e+'-'+_0xb57a08+'/'+_0x8d948c)[_0xede6('0x1c')](_0x564bd0);}return null;};}function patchUpdates(_0x5bc997){return function(_0x2296cf){try{jsonpatch['apply'](_0x2296cf,_0x5bc997,!![]);}catch(_0x1cc0c0){return BPromise[_0xede6('0x1d')](_0x1cc0c0);}return _0x2296cf[_0xede6('0x1e')]();};}function saveUpdates(_0x33c8c1,_0x3323dc){return function(_0x28544f){if(_0x28544f){return _0x28544f[_0xede6('0x1f')](_0x33c8c1)[_0xede6('0x20')](function(_0x46869c){return _0x46869c;});}return null;};}function removeEntity(_0x587f5b,_0x2f251a){return function(_0x52372a){if(_0x52372a){return _0x52372a[_0xede6('0x21')]()['then'](function(){_0x587f5b[_0xede6('0x22')](0xcc)[_0xede6('0x23')]();});}};}function handleEntityNotFound(_0xebacd8,_0x37c8b1){return function(_0x5a6e19){if(!_0x5a6e19){_0xebacd8[_0xede6('0x24')](0x194);}return _0x5a6e19;};}function handleError(_0x569fc2,_0x2e1013){_0x2e1013=_0x2e1013||0x1f4;return function(_0x5f5a2d){logger[_0xede6('0x25')](_0x5f5a2d[_0xede6('0x26')]);if(_0x5f5a2d['name']){delete _0x5f5a2d['name'];}_0x569fc2['status'](_0x2e1013)[_0xede6('0x27')](_0x5f5a2d);};}exports[_0xede6('0x28')]=function(_0x341b73,_0xf2640){var _0x2c39b1={},_0x329088={},_0x279d9={'count':0x0,'rows':[]};var _0x565831=_['map'](db[_0xede6('0x29')][_0xede6('0x2a')],function(_0x33c405){return{'name':_0x33c405[_0xede6('0x2b')],'type':_0x33c405['type'][_0xede6('0x2c')]};});_0x329088[_0xede6('0x2d')]=_[_0xede6('0x2e')](_0x565831,_0xede6('0x2f'));_0x329088[_0xede6('0x30')]=_[_0xede6('0x31')](_0x341b73[_0xede6('0x30')]);_0x329088[_0xede6('0x32')]=_[_0xede6('0x33')](_0x329088['model'],_0x329088[_0xede6('0x30')]);_0x2c39b1[_0xede6('0x34')]=_['intersection'](_0x329088[_0xede6('0x2d')],qs['fields'](_0x341b73[_0xede6('0x30')]['fields']));_0x2c39b1['attributes']=_0x2c39b1['attributes'][_0xede6('0x35')]?_0x2c39b1['attributes']:_0x329088[_0xede6('0x2d')];if(!_0x341b73[_0xede6('0x30')]['hasOwnProperty'](_0xede6('0x36'))){_0x2c39b1[_0xede6('0x17')]=qs[_0xede6('0x17')](_0x341b73[_0xede6('0x30')][_0xede6('0x17')]);_0x2c39b1[_0xede6('0x19')]=qs[_0xede6('0x19')](_0x341b73[_0xede6('0x30')][_0xede6('0x19')]);}_0x2c39b1[_0xede6('0x37')]=qs['sort'](_0x341b73['query']['sort']);_0x2c39b1[_0xede6('0x38')]=qs[_0xede6('0x32')](_[_0xede6('0x39')](_0x341b73[_0xede6('0x30')],_0x329088[_0xede6('0x32')]),_0x565831);if(_0x341b73[_0xede6('0x30')]['filter']){_0x2c39b1['where']=_[_0xede6('0x3a')](_0x2c39b1[_0xede6('0x38')],{'$or':_[_0xede6('0x2e')](_0x565831,function(_0x4f0f1f){if(_0x4f0f1f[_0xede6('0x3b')]!==_0xede6('0x3c')){var _0x198b24={};_0x198b24[_0x4f0f1f[_0xede6('0x2f')]]={'$like':'%'+_0x341b73[_0xede6('0x30')]['filter']+'%'};return _0x198b24;}})});}_0x2c39b1=_[_0xede6('0x3a')]({},_0x2c39b1,_0x341b73[_0xede6('0x3d')]);var _0x5f21d3={'where':_0x2c39b1[_0xede6('0x38')]};return db[_0xede6('0x29')][_0xede6('0x18')](_0x5f21d3)[_0xede6('0x20')](function(_0x35f52a){_0x279d9[_0xede6('0x18')]=_0x35f52a;if(_0x341b73[_0xede6('0x30')][_0xede6('0x3e')]){_0x2c39b1[_0xede6('0x3f')]=[{'all':!![]}];}return db[_0xede6('0x29')][_0xede6('0x40')](_0x2c39b1);})[_0xede6('0x20')](function(_0x4191c6){_0x279d9[_0xede6('0x41')]=_0x4191c6;return _0x279d9;})[_0xede6('0x20')](respondWithFilteredResult(_0xf2640,_0x2c39b1))[_0xede6('0x42')](handleError(_0xf2640,null));};exports[_0xede6('0x43')]=function(_0x3ea6e7,_0x56e6b5){var _0x13af61={'raw':!![],'where':{'id':_0x3ea6e7[_0xede6('0x44')]['id']}},_0x1e2516={};_0x1e2516[_0xede6('0x2d')]=_['keys'](db['VoiceQueuesLog'][_0xede6('0x2a')]);_0x1e2516['query']=_[_0xede6('0x31')](_0x3ea6e7[_0xede6('0x30')]);_0x1e2516[_0xede6('0x32')]=_['intersection'](_0x1e2516[_0xede6('0x2d')],_0x1e2516['query']);_0x13af61[_0xede6('0x34')]=_[_0xede6('0x33')](_0x1e2516[_0xede6('0x2d')],qs[_0xede6('0x45')](_0x3ea6e7[_0xede6('0x30')]['fields']));_0x13af61['attributes']=_0x13af61[_0xede6('0x34')][_0xede6('0x35')]?_0x13af61['attributes']:_0x1e2516[_0xede6('0x2d')];if(_0x3ea6e7[_0xede6('0x30')][_0xede6('0x3e')]){_0x13af61[_0xede6('0x3f')]=[{'all':!![]}];}_0x13af61=_['merge']({},_0x13af61,_0x3ea6e7[_0xede6('0x3d')]);return db['VoiceQueuesLog'][_0xede6('0x46')](_0x13af61)['then'](handleEntityNotFound(_0x56e6b5,null))[_0xede6('0x20')](respondWithResult(_0x56e6b5,null))[_0xede6('0x42')](handleError(_0x56e6b5,null));};exports[_0xede6('0x47')]=function(_0x7abaef,_0x31545a){return db[_0xede6('0x29')][_0xede6('0x47')](_0x7abaef['body'],{})[_0xede6('0x20')](respondWithResult(_0x31545a,0xc9))[_0xede6('0x42')](handleError(_0x31545a,null));};exports[_0xede6('0x1f')]=function(_0x21bee0,_0x317a02){if(_0x21bee0[_0xede6('0x48')]['id']){delete _0x21bee0['body']['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x21bee0[_0xede6('0x44')]['id']}})[_0xede6('0x20')](handleEntityNotFound(_0x317a02,null))[_0xede6('0x20')](saveUpdates(_0x21bee0[_0xede6('0x48')],null))[_0xede6('0x20')](respondWithResult(_0x317a02,null))[_0xede6('0x42')](handleError(_0x317a02,null));};exports[_0xede6('0x21')]=function(_0x4a6786,_0xfaae84){return db[_0xede6('0x29')][_0xede6('0x46')]({'where':{'id':_0x4a6786['params']['id']}})[_0xede6('0x20')](handleEntityNotFound(_0xfaae84,null))[_0xede6('0x20')](removeEntity(_0xfaae84,null))['catch'](handleError(_0xfaae84,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index ed84a01..b63de3c 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.model.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7129=['../../config/logger','api','bluebird','request-promise','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0x7129,0x99));var _0x9712=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7129[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x9712('0x0'));var logger=require(_0x9712('0x1'))(_0x9712('0x2'));var moment=require('moment');var BPromise=require(_0x9712('0x3'));var rp=require(_0x9712('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9712('0x5'));var config=require('../../config/environment');var attributes=require(_0x9712('0x6'));module[_0x9712('0x7')]=function(_0x5b94a0,_0x22bd66){return _0x5b94a0[_0x9712('0x8')](_0x9712('0x9'),attributes,{'tableName':_0x9712('0xa'),'paranoid':![],'indexes':[{'name':_0x9712('0xb'),'fields':[_0x9712('0xc'),_0x9712('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xeacb=['VoiceQueuesLog','voice_queues_log','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x193844,_0x175ad2){var _0x888c03=function(_0x247ee9){while(--_0x247ee9){_0x193844['push'](_0x193844['shift']());}};_0x888c03(++_0x175ad2);}(_0xeacb,0x199));var _0xbeac=function(_0x2f8066,_0x1a5e4c){_0x2f8066=_0x2f8066-0x0;var _0x5bf3f2=_0xeacb[_0x2f8066];return _0x5bf3f2;};'use strict';var _=require(_0xbeac('0x0'));var util=require('util');var logger=require(_0xbeac('0x1'))(_0xbeac('0x2'));var moment=require(_0xbeac('0x3'));var BPromise=require(_0xbeac('0x4'));var rp=require(_0xbeac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbeac('0x6'));var config=require(_0xbeac('0x7'));var attributes=require(_0xbeac('0x8'));module[_0xbeac('0x9')]=function(_0x1c082d,_0x1660f5){return _0x1c082d[_0xbeac('0xa')](_0xbeac('0xb'),attributes,{'tableName':_0xbeac('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xbeac('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 487a832..4b17fc7 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd08c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x3f93df,_0x324d5d){var _0x74a3e3=function(_0x7fb785){while(--_0x7fb785){_0x3f93df['push'](_0x3f93df['shift']());}};_0x74a3e3(++_0x324d5d);}(_0xd08c,0x106));var _0xcd08=function(_0x50aa4b,_0x77f234){_0x50aa4b=_0x50aa4b-0x0;var _0x20fbd9=_0xd08c[_0x50aa4b];return _0x20fbd9;};'use strict';var _=require(_0xcd08('0x0'));var util=require(_0xcd08('0x1'));var moment=require(_0xcd08('0x2'));var BPromise=require(_0xcd08('0x3'));var rs=require(_0xcd08('0x4'));var fs=require('fs');var Redis=require(_0xcd08('0x5'));var db=require(_0xcd08('0x6'))['db'];var utils=require(_0xcd08('0x7'));var logger=require(_0xcd08('0x8'))(_0xcd08('0x9'));var config=require('../../config/environment');var jayson=require(_0xcd08('0xa'));var client=jayson[_0xcd08('0xb')][_0xcd08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a2910,_0x3d9189,_0x125995){return new BPromise(function(_0x18b411,_0x4e00fb){return client[_0xcd08('0xd')](_0x3a2910,_0x125995)[_0xcd08('0xe')](function(_0x2fc649){logger[_0xcd08('0xf')](_0xcd08('0x10'),_0x3d9189,_0xcd08('0x11'));logger['debug'](_0xcd08('0x12'),_0x3d9189,'request\x20sent',JSON[_0xcd08('0x13')](_0x2fc649));if(_0x2fc649[_0xcd08('0x14')]){if(_0x2fc649[_0xcd08('0x14')]['code']===0x1f4){logger[_0xcd08('0x14')](_0xcd08('0x10'),_0x3d9189,_0x2fc649[_0xcd08('0x14')][_0xcd08('0x15')]);return _0x4e00fb(_0x2fc649['error'][_0xcd08('0x15')]);}logger[_0xcd08('0x14')](_0xcd08('0x10'),_0x3d9189,_0x2fc649[_0xcd08('0x14')][_0xcd08('0x15')]);return _0x18b411(_0x2fc649[_0xcd08('0x14')][_0xcd08('0x15')]);}else{logger['info'](_0xcd08('0x10'),_0x3d9189,_0xcd08('0x11'));_0x18b411(_0x2fc649[_0xcd08('0x16')]['message']);}})[_0xcd08('0x17')](function(_0x3321be){logger['error'](_0xcd08('0x10'),_0x3d9189,_0x3321be);_0x4e00fb(_0x3321be);});});} \ No newline at end of file +var _0x7117=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7117,0x1ec));var _0x7711=function(_0x3d0391,_0x84402c){_0x3d0391=_0x3d0391-0x0;var _0x2a693f=_0x7117[_0x3d0391];return _0x2a693f;};'use strict';var _=require(_0x7711('0x0'));var util=require(_0x7711('0x1'));var moment=require(_0x7711('0x2'));var BPromise=require(_0x7711('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7711('0x4'));var db=require(_0x7711('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7711('0x6'))('rpc');var config=require(_0x7711('0x7'));var jayson=require(_0x7711('0x8'));var client=jayson[_0x7711('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x492137,_0x56d953,_0x50acc7){return new BPromise(function(_0x390862,_0xb9cae4){return client[_0x7711('0xa')](_0x492137,_0x50acc7)[_0x7711('0xb')](function(_0x4bb5fc){logger[_0x7711('0xc')](_0x7711('0xd'),_0x56d953,_0x7711('0xe'));logger[_0x7711('0xf')](_0x7711('0x10'),_0x56d953,'request\x20sent',JSON[_0x7711('0x11')](_0x4bb5fc));if(_0x4bb5fc[_0x7711('0x12')]){if(_0x4bb5fc['error'][_0x7711('0x13')]===0x1f4){logger[_0x7711('0x12')](_0x7711('0xd'),_0x56d953,_0x4bb5fc[_0x7711('0x12')][_0x7711('0x14')]);return _0xb9cae4(_0x4bb5fc[_0x7711('0x12')]['message']);}logger[_0x7711('0x12')](_0x7711('0xd'),_0x56d953,_0x4bb5fc[_0x7711('0x12')][_0x7711('0x14')]);return _0x390862(_0x4bb5fc['error'][_0x7711('0x14')]);}else{logger[_0x7711('0xc')](_0x7711('0xd'),_0x56d953,_0x7711('0xe'));_0x390862(_0x4bb5fc[_0x7711('0x15')][_0x7711('0x14')]);}})[_0x7711('0x16')](function(_0x1a9d42){logger[_0x7711('0x12')](_0x7711('0xd'),_0x56d953,_0x1a9d42);_0xb9cae4(_0x1a9d42);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index dfbcdc9..e0fb0e8 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f5f=['./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','/:id/transcribe','downloadTranscribe','create','post','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x7f5f,0x1c1));var _0xf7f5=function(_0x581511,_0x5306ec){_0x581511=_0x581511-0x0;var _0x40ae96=_0x7f5f[_0x581511];return _0x40ae96;};'use strict';var multer=require(_0xf7f5('0x0'));var util=require(_0xf7f5('0x1'));var path=require('path');var timeout=require(_0xf7f5('0x2'));var express=require(_0xf7f5('0x3'));var router=express['Router']();var fs_extra=require(_0xf7f5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf7f5('0x5'));var config=require(_0xf7f5('0x6'));var controller=require(_0xf7f5('0x7'));router[_0xf7f5('0x8')]('/',auth[_0xf7f5('0x9')](),controller[_0xf7f5('0xa')]);router['get'](_0xf7f5('0xb'),auth[_0xf7f5('0x9')](),controller[_0xf7f5('0xc')]);router['get'](_0xf7f5('0xd'),auth[_0xf7f5('0x9')](),controller[_0xf7f5('0xe')]);router['get'](_0xf7f5('0xf'),auth[_0xf7f5('0x9')](),controller['download']);router[_0xf7f5('0x8')](_0xf7f5('0x10'),controller['downloads']);router[_0xf7f5('0x8')](_0xf7f5('0x11'),auth['isAuthenticated'](),controller[_0xf7f5('0x12')]);router['post']('/',auth[_0xf7f5('0x9')](),controller[_0xf7f5('0x13')]);router[_0xf7f5('0x14')]('/:id/transcribe',auth[_0xf7f5('0x9')](),controller['runTranscribe']);router[_0xf7f5('0x15')]('/:id',auth[_0xf7f5('0x9')](),controller[_0xf7f5('0x16')]);router['delete'](_0xf7f5('0xd'),auth[_0xf7f5('0x9')](),controller['destroy']);module[_0xf7f5('0x17')]=router; \ No newline at end of file +var _0xcec2=['index','/describe','isAuthenticated','get','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','post','runTranscribe','put','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0xcec2,0x6b));var _0x2cec=function(_0x3a5913,_0x5da4d3){_0x3a5913=_0x3a5913-0x0;var _0xc9a6db=_0xcec2[_0x3a5913];return _0xc9a6db;};'use strict';var multer=require(_0x2cec('0x0'));var util=require(_0x2cec('0x1'));var path=require('path');var timeout=require(_0x2cec('0x2'));var express=require(_0x2cec('0x3'));var router=express['Router']();var fs_extra=require(_0x2cec('0x4'));var auth=require(_0x2cec('0x5'));var interaction=require(_0x2cec('0x6'));var config=require(_0x2cec('0x7'));var controller=require('./voiceRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2cec('0x8')]);router['get'](_0x2cec('0x9'),auth[_0x2cec('0xa')](),controller['describe']);router[_0x2cec('0xb')](_0x2cec('0xc'),auth[_0x2cec('0xa')](),controller[_0x2cec('0xd')]);router['get']('/:id/download',auth[_0x2cec('0xa')](),controller[_0x2cec('0xe')]);router[_0x2cec('0xb')](_0x2cec('0xf'),controller[_0x2cec('0x10')]);router[_0x2cec('0xb')](_0x2cec('0x11'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0x2cec('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2cec('0x12')]('/:id/transcribe',auth[_0x2cec('0xa')](),controller[_0x2cec('0x13')]);router[_0x2cec('0x14')](_0x2cec('0xc'),auth[_0x2cec('0xa')](),controller['update']);router[_0x2cec('0x15')](_0x2cec('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x2cec('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 925a99b..02454d1 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 13cd66c..e7562e3 100644 --- a/server/api/voiceRecording/voiceRecording.controller.js +++ b/server/api/voiceRecording/voiceRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3301=['Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','VoiceRecording','includeAll','include','catch','show','params','keys','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','token','$and','push','ValidationError','isNil','Entity\x20not\x20found','info','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','readFileSync','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','recording','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt'];(function(_0x3be885,_0xc8dbc6){var _0x3b8e1f=function(_0x2a15db){while(--_0x2a15db){_0x3be885['push'](_0x3be885['shift']());}};_0x3b8e1f(++_0xc8dbc6);}(_0x3301,0x129));var _0x1330=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0x3301[_0x37d0bc];return _0x170e60;};'use strict';var emlformat=require(_0x1330('0x0'));var rimraf=require(_0x1330('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1330('0x2'));var rp=require(_0x1330('0x3'));var moment=require(_0x1330('0x4'));var BPromise=require(_0x1330('0x5'));var Mustache=require(_0x1330('0x6'));var util=require('util');var path=require(_0x1330('0x7'));var sox=require('sox');var csv=require(_0x1330('0x8'));var ejs=require(_0x1330('0x9'));var fs=require('fs');var fs_extra=require(_0x1330('0xa'));var _=require(_0x1330('0xb'));var squel=require(_0x1330('0xc'));var crypto=require('crypto');var jsforce=require(_0x1330('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1330('0x8'));var querystring=require(_0x1330('0xe'));var Papa=require(_0x1330('0xf'));var AWS=require(_0x1330('0x10'));var uuidv4=require(_0x1330('0x11'));var Redis=require('ioredis');var authService=require(_0x1330('0x12'));var qs=require(_0x1330('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1330('0x14'))(_0x1330('0x15'));var utils=require('../../config/utils');var config=require(_0x1330('0x16'));var licenseUtil=require(_0x1330('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557b8b,_0xbf4a93){_0xbf4a93=_0xbf4a93||0xcc;return function(_0x5b8412){if(_0x5b8412){return _0x557b8b['sendStatus'](_0xbf4a93);}return _0x557b8b[_0x1330('0x18')](_0xbf4a93)['end']();};}function respondWithResult(_0x1c1bfa,_0x2c0271){_0x2c0271=_0x2c0271||0xc8;return function(_0x1e7f9a){if(_0x1e7f9a){return _0x1c1bfa[_0x1330('0x18')](_0x2c0271)[_0x1330('0x19')](_0x1e7f9a);}};}function respondWithFilteredResult(_0xf147ad,_0x3a1671){return function(_0x265e25){if(_0x265e25){var _0x25eb9b=typeof _0x3a1671['offset']===_0x1330('0x1a')&&typeof _0x3a1671[_0x1330('0x1b')]===_0x1330('0x1a');var _0x56945e=_0x265e25['count'];var _0x5a3017=_0x25eb9b?0x0:_0x3a1671[_0x1330('0x1c')];var _0x277608=_0x25eb9b?_0x265e25[_0x1330('0x1d')]:_0x3a1671['offset']+_0x3a1671['limit'];var _0x4c4ed2;if(_0x277608>=_0x56945e){_0x277608=_0x56945e;_0x4c4ed2=0xc8;}else{_0x4c4ed2=0xce;}_0xf147ad['status'](_0x4c4ed2);return _0xf147ad[_0x1330('0x1e')](_0x1330('0x1f'),_0x5a3017+'-'+_0x277608+'/'+_0x56945e)[_0x1330('0x19')](_0x265e25);}return null;};}function patchUpdates(_0x53877d){return function(_0x245781){try{jsonpatch[_0x1330('0x20')](_0x245781,_0x53877d,!![]);}catch(_0x4301fe){return BPromise[_0x1330('0x21')](_0x4301fe);}return _0x245781[_0x1330('0x22')]();};}function saveUpdates(_0x4d3045,_0x16b361){return function(_0x7f9e56){if(_0x7f9e56){return _0x7f9e56['update'](_0x4d3045)[_0x1330('0x23')](function(_0x1b8858){return _0x1b8858;});}return null;};}function removeEntity(_0x184efc,_0x3eb574){return function(_0xfba6b8){if(_0xfba6b8){return _0xfba6b8[_0x1330('0x24')]()[_0x1330('0x23')](function(){_0x184efc[_0x1330('0x18')](0xcc)[_0x1330('0x25')]();});}};}function handleEntityNotFound(_0x22560c,_0x45b668){return function(_0x1afc10){if(!_0x1afc10){_0x22560c['sendStatus'](0x194);}return _0x1afc10;};}function handleError(_0x5ba892,_0x2774e4){_0x2774e4=_0x2774e4||0x1f4;return function(_0x598552){logger[_0x1330('0x26')](_0x598552[_0x1330('0x27')]);if(_0x598552[_0x1330('0x28')]){delete _0x598552[_0x1330('0x28')];}_0x5ba892['status'](_0x2774e4)['send'](_0x598552);};}exports[_0x1330('0x29')]=function(_0x14181f,_0x415e5f){var _0x20bc74={},_0x47791b={},_0x3b2e6b={'count':0x0,'rows':[]};var _0x3d4b10=_[_0x1330('0x2a')](db['VoiceRecording'][_0x1330('0x2b')],function(_0x4232c1){return{'name':_0x4232c1[_0x1330('0x2c')],'type':_0x4232c1[_0x1330('0x2d')][_0x1330('0x2e')]};});_0x47791b[_0x1330('0x2f')]=_[_0x1330('0x30')](_[_0x1330('0x2a')](_0x3d4b10,_0x1330('0x28')),[_0x1330('0x31')]);_0x47791b[_0x1330('0x32')]=_['keys'](_0x14181f[_0x1330('0x32')]);_0x47791b[_0x1330('0x33')]=_['intersection'](_0x47791b[_0x1330('0x2f')],_0x47791b['query']);_0x20bc74['attributes']=_[_0x1330('0x34')](_0x47791b[_0x1330('0x2f')],qs[_0x1330('0x35')](_0x14181f[_0x1330('0x32')][_0x1330('0x35')]));_0x20bc74['attributes']=_0x20bc74[_0x1330('0x36')][_0x1330('0x37')]?_0x20bc74[_0x1330('0x36')]:_0x47791b[_0x1330('0x2f')];if(!_0x14181f[_0x1330('0x32')][_0x1330('0x38')]('nolimit')){_0x20bc74[_0x1330('0x1b')]=qs[_0x1330('0x1b')](_0x14181f['query'][_0x1330('0x1b')]);_0x20bc74[_0x1330('0x1c')]=qs[_0x1330('0x1c')](_0x14181f['query'][_0x1330('0x1c')]);}_0x20bc74[_0x1330('0x39')]=qs[_0x1330('0x3a')](_0x14181f['query'][_0x1330('0x3a')]);_0x20bc74['where']=qs[_0x1330('0x33')](_[_0x1330('0x3b')](_0x14181f[_0x1330('0x32')],_0x47791b[_0x1330('0x33')]),_0x3d4b10);if(_0x14181f[_0x1330('0x32')][_0x1330('0x3c')]){_0x20bc74[_0x1330('0x3d')]=_['merge'](_0x20bc74[_0x1330('0x3d')],{'$or':_['map'](_0x3d4b10,function(_0x374453){if(_0x374453['type']!==_0x1330('0x3e')){var _0x857f9={};_0x857f9[_0x374453['name']]={'$like':'%'+_0x14181f['query']['filter']+'%'};return _0x857f9;}})});}_0x20bc74=_[_0x1330('0x3f')]({},_0x20bc74,_0x14181f['options']);var _0x138a01={'where':_0x20bc74[_0x1330('0x3d')]};return db[_0x1330('0x40')][_0x1330('0x1d')](_0x138a01)['then'](function(_0x16128f){_0x3b2e6b[_0x1330('0x1d')]=_0x16128f;if(_0x14181f[_0x1330('0x32')][_0x1330('0x41')]){_0x20bc74[_0x1330('0x42')]=[{'all':!![]}];}return db[_0x1330('0x40')]['findAll'](_0x20bc74);})[_0x1330('0x23')](function(_0x883397){_0x3b2e6b['rows']=_0x883397;return _0x3b2e6b;})[_0x1330('0x23')](respondWithFilteredResult(_0x415e5f,_0x20bc74))[_0x1330('0x43')](handleError(_0x415e5f,null));};exports[_0x1330('0x44')]=function(_0x24f37c,_0x313b58){var _0x5168f0={'raw':![],'where':{'id':_0x24f37c[_0x1330('0x45')]['id']}},_0x4f8468={};_0x4f8468['model']=_[_0x1330('0x46')](db[_0x1330('0x40')][_0x1330('0x2b')]);_0x4f8468[_0x1330('0x32')]=_[_0x1330('0x46')](_0x24f37c[_0x1330('0x32')]);_0x4f8468['filters']=_[_0x1330('0x34')](_0x4f8468['model'],_0x4f8468['query']);_0x5168f0[_0x1330('0x36')]=_[_0x1330('0x34')](_0x4f8468[_0x1330('0x2f')],qs[_0x1330('0x35')](_0x24f37c['query'][_0x1330('0x35')]));_0x5168f0[_0x1330('0x36')]=_0x5168f0[_0x1330('0x36')][_0x1330('0x37')]?_0x5168f0[_0x1330('0x36')]:_0x4f8468['model'];if(_0x24f37c[_0x1330('0x32')][_0x1330('0x41')]){_0x5168f0['include']=[{'all':!![]}];}_0x5168f0=_['merge']({},_0x5168f0,_0x24f37c[_0x1330('0x47')]);return db['VoiceRecording'][_0x1330('0x48')](_0x5168f0)[_0x1330('0x23')](handleEntityNotFound(_0x313b58,null))[_0x1330('0x23')](respondWithResult(_0x313b58,null))['catch'](handleError(_0x313b58,null));};exports['create']=function(_0x5ac8e9,_0x2e810f){return db[_0x1330('0x40')][_0x1330('0x49')](_0x5ac8e9[_0x1330('0x4a')],{})['then'](respondWithResult(_0x2e810f,0xc9))['catch'](handleError(_0x2e810f,null));};exports['update']=function(_0x42fd56,_0x12461c){if(_0x42fd56[_0x1330('0x4a')]['id']){delete _0x42fd56[_0x1330('0x4a')]['id'];}return db[_0x1330('0x40')]['find']({'where':{'id':_0x42fd56[_0x1330('0x45')]['id']}})[_0x1330('0x23')](handleEntityNotFound(_0x12461c,null))[_0x1330('0x23')](saveUpdates(_0x42fd56['body'],null))[_0x1330('0x23')](respondWithResult(_0x12461c,null))[_0x1330('0x43')](handleError(_0x12461c,null));};exports[_0x1330('0x4b')]=function(_0x4e640e,_0x235c6f){return db[_0x1330('0x40')][_0x1330('0x4b')]()[_0x1330('0x23')](respondWithResult(_0x235c6f,null))[_0x1330('0x43')](handleError(_0x235c6f,null));};exports[_0x1330('0x4c')]=function(_0x219abd,_0x504095,_0x455a63){var _0x1fc184=require(_0x1330('0x4d'));var _0x3b62b3=![];var _0x17f805={};if(_0x219abd[_0x1330('0x32')][_0x1330('0x2d')]&&_0x219abd[_0x1330('0x32')][_0x1330('0x2d')]===_0x1330('0x4e')){_0x17f805['uniqueid']=_0x219abd[_0x1330('0x45')]['id'];}else{_0x17f805['id']=_0x219abd[_0x1330('0x45')]['id'];}return db[_0x1330('0x40')][_0x1330('0x48')]({'where':_0x17f805,'attributes':['id',_0x1330('0x4f')],'raw':!![]})[_0x1330('0x23')](handleEntityNotFound(_0x504095,null))[_0x1330('0x23')](function(_0x5f0d38){if(_0x5f0d38){var _0x49d2a3=_0x5f0d38['value'];var _0x298ed8=util[_0x1330('0x31')](_0x1330('0x50'),_0x49d2a3);if(fs[_0x1330('0x51')](_0x298ed8)){_0x3b62b3=!![];return _0x1fc184[_0x1330('0x52')](_0x298ed8,_0x49d2a3,config[_0x1330('0x53')]['recording'])[_0x1330('0x23')](function(){return _0x5f0d38;});}return _0x5f0d38;}})[_0x1330('0x23')](function(_0x447737){if(_0x447737){var _0x2abf50=_0x447737[_0x1330('0x4f')];if(!fs['existsSync'](_0x2abf50)){throw new db[(_0x1330('0x54'))]['ValidationError'](_0x1330('0x55'));}if(_0x447737[_0x1330('0x56')]){return _0x504095[_0x1330('0x4c')](_0x2abf50,_0x447737[_0x1330('0x56')]+path[_0x1330('0x57')](_0x2abf50),function(){if(_0x3b62b3){fs[_0x1330('0x58')](_0x2abf50);}});}else{return _0x504095['download'](_0x2abf50,function(_0x45217c){if(_0x3b62b3){fs['unlink'](_0x2abf50);}});}}})[_0x1330('0x43')](function(_0x1c304b){if(_0x1c304b['message']===_0x1330('0x55')){_0x504095['status'](0x194)['send'](_0x1330('0x59'));}else{return handleError(_0x504095,null);}});};exports[_0x1330('0x5a')]=function(_0x37725a,_0x552410,_0x5be132){var _0x506016=require('../../components/encryptor');var _0x31ab9e=![];var _0x597e22={'$and':[db[_0x1330('0x5b')]['where'](db[_0x1330('0x5b')]['fn'](_0x1330('0x5c'),db[_0x1330('0x5b')]['col'](_0x1330('0x4e'))),_0x37725a['query'][_0x1330('0x5d')])]};if(_0x37725a[_0x1330('0x32')]['type']&&_0x37725a[_0x1330('0x32')][_0x1330('0x2d')]===_0x1330('0x4e')){_0x597e22[_0x1330('0x5e')]['push']({'uniqueid':_0x37725a['params']['id']});}else{_0x597e22[_0x1330('0x5e')][_0x1330('0x5f')]({'id':_0x37725a['params']['id']});}return db['VoiceRecording'][_0x1330('0x48')]({'where':_0x597e22,'attributes':['id',_0x1330('0x4f')],'raw':!![]})[_0x1330('0x23')](handleEntityNotFound(_0x552410,null))[_0x1330('0x23')](function(_0x17f412){if(_0x17f412){var _0x1e260d=util[_0x1330('0x31')](_0x1330('0x50'),_0x17f412[_0x1330('0x4f')]);if(fs['existsSync'](_0x1e260d)){_0x31ab9e=!![];return _0x506016[_0x1330('0x52')](_0x1e260d,_0x17f412[_0x1330('0x4f')],config[_0x1330('0x53')]['recording'])[_0x1330('0x23')](function(){return _0x17f412;});}return _0x17f412;}})[_0x1330('0x23')](function(_0x31de5a){if(_0x31de5a){if(!fs[_0x1330('0x51')](_0x31de5a['value'])){throw new db[(_0x1330('0x54'))][(_0x1330('0x60'))](_0x1330('0x55'));}if(_0x31de5a[_0x1330('0x56')]){return _0x552410[_0x1330('0x4c')](_0x31de5a[_0x1330('0x4f')],_0x31de5a['filename']+path[_0x1330('0x57')](_0x31de5a[_0x1330('0x4f')]),function(){if(_0x31ab9e){fs[_0x1330('0x58')](_0x31de5a[_0x1330('0x4f')]);}});}else{return _0x552410[_0x1330('0x4c')](_0x31de5a['value'],function(_0x31bedb){if(_0x31ab9e){fs['unlink'](_0x31de5a[_0x1330('0x4f')]);}});}}})[_0x1330('0x43')](handleError(_0x552410,null));};exports[_0x1330('0x24')]=function(_0x30a0b1,_0x2a645c){return db[_0x1330('0x40')][_0x1330('0x48')]({'where':{'id':_0x30a0b1[_0x1330('0x45')]['id']}})['then'](function(_0x252406){if(_[_0x1330('0x61')](_0x252406)){throw new ReferenceError(_0x1330('0x62'));}return _0x252406;})['then'](function(_0x56f801){var _0xa9e863=_0x56f801[_0x1330('0x4f')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0xa9e863);if(!_['isNil'](_0x56f801['value'])&&fs[_0x1330('0x51')](_0xa9e863)){logger[_0x1330('0x63')]('File:\x20\x22'+_0xa9e863+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1330('0x64')](_0xa9e863);}_0xa9e863=_0xa9e863+'.cypher';if(!_[_0x1330('0x61')](_0x56f801['value'])&&fs[_0x1330('0x51')](_0xa9e863)){logger[_0x1330('0x63')]('File:\x20\x22'+_0xa9e863+_0x1330('0x65'));fs['unlinkSync'](_0xa9e863);}return _0x56f801;})[_0x1330('0x23')](function(_0x575176){if(!_0x575176)throw new InternalError();return _0x575176[_0x1330('0x24')]();})[_0x1330('0x23')](function(){_0x2a645c[_0x1330('0x18')](0xcc)['end']();})[_0x1330('0x43')](handleError(_0x2a645c,null));};function getBucketslist(_0x33b2ae,_0x10598c,_0x4291eb){return new Promise(function(_0x301e5a,_0x1f6241){var _0x3c938b=new AWS['S3']({'accessKeyId':_0x10598c,'secretAccessKey':_0x33b2ae,'region':_0x4291eb});_0x3c938b['listBuckets']({},function(_0x4de87b,_0x27eac0){if(_0x4de87b){return _0x1f6241(_0x4de87b);}else{return _0x301e5a(_0x27eac0);}});});}function createBucket(_0x5c7630,_0x29e008,_0x10880b,_0x9b6bc4){return new Promise(function(_0x3fe7f5,_0x938e04){var _0x24b063=new AWS['S3']({'accessKeyId':_0x29e008,'secretAccessKey':_0x5c7630,'region':_0x10880b});_0x24b063[_0x1330('0x66')]({'Bucket':_0x9b6bc4},function(_0x469fb7,_0x2cf09c){if(_0x469fb7){return _0x938e04(_0x469fb7);}else{return _0x3fe7f5(_0x2cf09c);}});});}function uploadFile(_0x41e1a3,_0x5065cd,_0x500199,_0x191dc6,_0x3f8aa8,_0x23cd0c){return new Promise(function(_0x231bb1,_0x25807f){var _0x4f526e=new AWS['S3']({'accessKeyId':_0x5065cd,'secretAccessKey':_0x41e1a3,'region':_0x500199});_0x4f526e[_0x1330('0x67')]({'Bucket':_0x191dc6,'Key':_0x3f8aa8,'Body':_0x23cd0c},function(_0x263a68,_0x838fd9){if(_0x263a68){return _0x25807f(_0x263a68);}else{return _0x231bb1(_0x838fd9);}});});}function startTranscribe(_0x372495,_0x586cff,_0x34c12d,_0x41f19b,_0x392bc5,_0x2b72fd){return new Promise(function(_0x4a8cfd,_0x25a322){var _0x273d7b=new AWS[(_0x1330('0x68'))]({'accessKeyId':_0x586cff,'secretAccessKey':_0x372495,'region':_0x34c12d});_0x273d7b['startTranscriptionJob']({'TranscriptionJobName':_0x41f19b,'LanguageCode':_0x392bc5,'Media':{'MediaFileUri':_0x2b72fd}},function(_0x31c0ba,_0x89f796){if(_0x31c0ba){return _0x25a322(_0x31c0ba);}else{return _0x4a8cfd(_0x89f796);}});});}function transcribe(_0x15c7e0,_0x519095,_0x26004c,_0x5a114d,_0x21021a,_0x2fa0cc,_0x349879){return new Promise(function(_0x1e9253,_0x46a1bc){var _0x596021={};logger['info'](util[_0x1330('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x15c7e0,_0x21021a));return uploadFile(_0x519095,_0x26004c,_0x5a114d,_0x21021a,path['basename'](_0x2fa0cc),fs[_0x1330('0x69')](_0x2fa0cc))[_0x1330('0x23')](function(_0x5744c1){logger[_0x1330('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x15c7e0,_0x21021a,_0x5744c1[_0x1330('0x6a')]));_0x596021['bucket']=_0x5744c1[_0x1330('0x6b')];_0x596021[_0x1330('0x6c')]=_0x5744c1[_0x1330('0x6a')];logger[_0x1330('0x63')](util['format'](_0x1330('0x6d'),_0x15c7e0));return startTranscribe(_0x519095,_0x26004c,_0x5a114d,uuidv4(),_0x349879,_0x5744c1[_0x1330('0x6a')]);})['then'](function(_0x3ae7a9){logger['info'](util[_0x1330('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x15c7e0,_0x3ae7a9[_0x1330('0x6e')][_0x1330('0x6f')]));_0x596021[_0x1330('0x70')]=_0x3ae7a9[_0x1330('0x6e')][_0x1330('0x6f')];_0x596021[_0x1330('0x71')]=_0x3ae7a9[_0x1330('0x6e')]['TranscriptionJobStatus'];return _0x1e9253(_0x596021);})[_0x1330('0x43')](function(_0x197952){return _0x46a1bc(_0x197952);});});}exports[_0x1330('0x72')]=function(_0x15ab84,_0x4a9338,_0x4bd151){var _0x370232;var _0x37934e;var _0x1e2164;var _0x250bdd=require(_0x1330('0x4d'));return db['VoiceRecording'][_0x1330('0x73')]({'where':{'id':_0x15ab84[_0x1330('0x45')]['id']}})[_0x1330('0x23')](function(_0xd4d041){if(_0xd4d041){var _0x125e4d=util[_0x1330('0x31')](_0x1330('0x50'),_0xd4d041[_0x1330('0x4f')]);if(fs[_0x1330('0x51')](_0x125e4d)){cypher=!![];return _0x250bdd[_0x1330('0x52')](_0x125e4d,_0xd4d041[_0x1330('0x4f')],config[_0x1330('0x53')][_0x1330('0x74')])[_0x1330('0x23')](function(){return _0xd4d041;});}return _0xd4d041;}})[_0x1330('0x23')](function(_0x387a4b){if(!_0x387a4b){throw new db[(_0x1330('0x54'))][(_0x1330('0x60'))](_0x1330('0x75'));}_0x37934e=_0x387a4b;return db[_0x1330('0x76')][_0x1330('0x73')]({'where':{'id':0x1}});})[_0x1330('0x23')](handleEntityNotFound(_0x4a9338,null))[_0x1330('0x23')](function(_0x39afed){if(_0x39afed){_0x370232=_0x39afed;if(!_0x370232[_0x1330('0x77')]||!_0x370232[_0x1330('0x78')]||!_0x370232[_0x1330('0x79')]||!_0x370232['language']||!_0x370232[_0x1330('0x7a')]){throw new db[(_0x1330('0x54'))][(_0x1330('0x60'))](_0x1330('0x7b'));}if(_0x15ab84[_0x1330('0x4a')][_0x1330('0x7c')]&&(!_0x370232[_0x1330('0x7d')]||!_0x370232[_0x1330('0x7e')]||!_0x370232[_0x1330('0x7f')]||!_0x370232[_0x1330('0x80')]||!_0x370232[_0x1330('0x7a')])){throw new db[(_0x1330('0x54'))][(_0x1330('0x60'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x1330('0x81')][_0x1330('0x73')]({'where':{'id':_0x370232[_0x1330('0x78')]}});}})['then'](function(_0x3e5468){if(!_0x3e5468){throw new db['Sequelize'][(_0x1330('0x60'))](_0x1330('0x82'));}if(!_0x3e5468[_0x1330('0x83')]||!_0x3e5468[_0x1330('0x84')]){throw new db[(_0x1330('0x54'))]['ValidationError'](_0x1330('0x85'));}_0x1e2164=_0x3e5468;return getBucketslist(_0x1e2164[_0x1330('0x83')],_0x1e2164[_0x1330('0x84')],_0x370232['transcribeRegion']);})['then'](function(_0x1139d7){if(_0x1139d7&&_0x1139d7[_0x1330('0x86')]){var _0xbf47a8=_[_0x1330('0x48')](_0x1139d7[_0x1330('0x86')],function(_0x5e4140){return _0x5e4140[_0x1330('0x87')]===_0x370232[_0x1330('0x7a')];});if(!_0xbf47a8){logger[_0x1330('0x63')](util[_0x1330('0x31')](_0x1330('0x88'),_0x15ab84[_0x1330('0x45')]['id'],_0x370232[_0x1330('0x7a')]));return createBucket(_0x1e2164['data1'],_0x1e2164[_0x1330('0x84')],_0x370232[_0x1330('0x79')],_0x370232[_0x1330('0x7a')]);}logger[_0x1330('0x63')](util['format'](_0x1330('0x89'),_0x15ab84[_0x1330('0x45')]['id'],_0x370232['bucket']));return;}})['then'](function(_0x4aa846){if(_0x37934e[_0x1330('0x71')]===_0x1330('0x8a')){return transcribe(_0x15ab84[_0x1330('0x45')]['id'],_0x1e2164[_0x1330('0x83')],_0x1e2164[_0x1330('0x84')],_0x370232[_0x1330('0x79')],_0x370232[_0x1330('0x7a')],_0x37934e['value'],_0x370232['language']);}else{logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x15ab84[_0x1330('0x45')]['id']));return{'transcribeStatus':_0x1330('0x8b')};}})[_0x1330('0x23')](function(_0x273aab){if(_0x273aab){_0x273aab['tempSentiment']=_0x15ab84[_0x1330('0x4a')][_0x1330('0x7c')];return _0x37934e[_0x1330('0x8c')](_0x273aab);}})[_0x1330('0x23')](respondWithResult(_0x4a9338,null))[_0x1330('0x43')](handleError(_0x4a9338,null));};function writeFile(_0x642a97,_0x17ce12){return new Promise(function(_0x5f122e,_0x352d79){fs[_0x1330('0x8d')](_0x17ce12,_0x642a97,function(_0x4ecdf0,_0x22bb49){if(_0x4ecdf0){return _0x352d79(_0x4ecdf0);}else{return _0x5f122e(_0x22bb49);}});});}exports[_0x1330('0x8e')]=function(_0x5b801c,_0x4f1cc9,_0x396a80){return db[_0x1330('0x40')][_0x1330('0x73')]({'where':{'id':_0x5b801c[_0x1330('0x45')]['id']}})[_0x1330('0x23')](handleEntityNotFound(_0x4f1cc9))[_0x1330('0x23')](function(_0x52c56d){if(_0x52c56d&&_0x52c56d[_0x1330('0x8f')]){var _0x5e3e5c=_0x52c56d['fileText'];var _0x5d3c10=config[_0x1330('0x90')]+_0x1330('0x91')+_0x52c56d['id']+_0x1330('0x92');if(fs['existsSync'](_0x5d3c10)){return _0x5d3c10;}return writeFile(_0x5e3e5c,_0x5d3c10)[_0x1330('0x23')](function(){return _0x5d3c10;});}else{throw new db['Sequelize'][(_0x1330('0x60'))](_0x1330('0x93'));}})[_0x1330('0x23')](function(_0x17716c){return _0x4f1cc9[_0x1330('0x4c')](_0x17716c);})[_0x1330('0x43')](handleError(_0x4f1cc9));}; \ No newline at end of file +var _0xdc20=['save','update','then','destroy','error','name','send','index','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','col','token','$and','push','secrets','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Setting','findOne','transcribe','transcribeAccountId','language','bucket','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','updateAttributes','downloadTranscribe','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject'];(function(_0x25b3ec,_0x4713f0){var _0x46c434=function(_0x3187ad){while(--_0x3187ad){_0x25b3ec['push'](_0x25b3ec['shift']());}};_0x46c434(++_0x4713f0);}(_0xdc20,0x101));var _0x0dc2=function(_0x2e73cf,_0x40d663){_0x2e73cf=_0x2e73cf-0x0;var _0x8454f6=_0xdc20[_0x2e73cf];return _0x8454f6;};'use strict';var emlformat=require(_0x0dc2('0x0'));var rimraf=require(_0x0dc2('0x1'));var zipdir=require(_0x0dc2('0x2'));var jsonpatch=require(_0x0dc2('0x3'));var rp=require(_0x0dc2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0dc2('0x5'));var sox=require(_0x0dc2('0x6'));var csv=require(_0x0dc2('0x7'));var ejs=require(_0x0dc2('0x8'));var fs=require('fs');var fs_extra=require(_0x0dc2('0x9'));var _=require(_0x0dc2('0xa'));var squel=require(_0x0dc2('0xb'));var crypto=require(_0x0dc2('0xc'));var jsforce=require(_0x0dc2('0xd'));var deskjs=require(_0x0dc2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0dc2('0xf'));var Papa=require(_0x0dc2('0x10'));var AWS=require(_0x0dc2('0x11'));var uuidv4=require(_0x0dc2('0x12'));var Redis=require(_0x0dc2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0dc2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dc2('0x15'));var logger=require(_0x0dc2('0x16'))(_0x0dc2('0x17'));var utils=require(_0x0dc2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0dc2('0x19'))['db'];function respondWithStatusCode(_0x55901f,_0x33e739){_0x33e739=_0x33e739||0xcc;return function(_0x4c459e){if(_0x4c459e){return _0x55901f[_0x0dc2('0x1a')](_0x33e739);}return _0x55901f[_0x0dc2('0x1b')](_0x33e739)[_0x0dc2('0x1c')]();};}function respondWithResult(_0x1d128c,_0x18855f){_0x18855f=_0x18855f||0xc8;return function(_0xafdf48){if(_0xafdf48){return _0x1d128c[_0x0dc2('0x1b')](_0x18855f)[_0x0dc2('0x1d')](_0xafdf48);}};}function respondWithFilteredResult(_0x10b3c9,_0x580d1c){return function(_0x301053){if(_0x301053){var _0x884c0f=typeof _0x580d1c['offset']===_0x0dc2('0x1e')&&typeof _0x580d1c[_0x0dc2('0x1f')]===_0x0dc2('0x1e');var _0x23431e=_0x301053[_0x0dc2('0x20')];var _0x33cc5c=_0x884c0f?0x0:_0x580d1c[_0x0dc2('0x21')];var _0x333010=_0x884c0f?_0x301053[_0x0dc2('0x20')]:_0x580d1c[_0x0dc2('0x21')]+_0x580d1c[_0x0dc2('0x1f')];var _0x367a21;if(_0x333010>=_0x23431e){_0x333010=_0x23431e;_0x367a21=0xc8;}else{_0x367a21=0xce;}_0x10b3c9[_0x0dc2('0x1b')](_0x367a21);return _0x10b3c9['set'](_0x0dc2('0x22'),_0x33cc5c+'-'+_0x333010+'/'+_0x23431e)['json'](_0x301053);}return null;};}function patchUpdates(_0x2ceda6){return function(_0x1fe975){try{jsonpatch[_0x0dc2('0x23')](_0x1fe975,_0x2ceda6,!![]);}catch(_0xf7fb94){return BPromise[_0x0dc2('0x24')](_0xf7fb94);}return _0x1fe975[_0x0dc2('0x25')]();};}function saveUpdates(_0x31a8bb,_0x275083){return function(_0x56b2b3){if(_0x56b2b3){return _0x56b2b3[_0x0dc2('0x26')](_0x31a8bb)[_0x0dc2('0x27')](function(_0x240c2c){return _0x240c2c;});}return null;};}function removeEntity(_0x55d668,_0x1a9edf){return function(_0x39fca8){if(_0x39fca8){return _0x39fca8[_0x0dc2('0x28')]()[_0x0dc2('0x27')](function(){_0x55d668[_0x0dc2('0x1b')](0xcc)[_0x0dc2('0x1c')]();});}};}function handleEntityNotFound(_0x190606,_0x60001d){return function(_0x19d972){if(!_0x19d972){_0x190606['sendStatus'](0x194);}return _0x19d972;};}function handleError(_0x34febe,_0x4d04b5){_0x4d04b5=_0x4d04b5||0x1f4;return function(_0x3cd381){logger[_0x0dc2('0x29')](_0x3cd381['stack']);if(_0x3cd381['name']){delete _0x3cd381[_0x0dc2('0x2a')];}_0x34febe['status'](_0x4d04b5)[_0x0dc2('0x2b')](_0x3cd381);};}exports[_0x0dc2('0x2c')]=function(_0x4c86b4,_0x50b4a3){var _0x820d60={},_0x3c2b94={},_0x288b24={'count':0x0,'rows':[]};var _0x370160=_['map'](db[_0x0dc2('0x2d')]['rawAttributes'],function(_0x3b264e){return{'name':_0x3b264e[_0x0dc2('0x2e')],'type':_0x3b264e[_0x0dc2('0x2f')][_0x0dc2('0x30')]};});_0x3c2b94[_0x0dc2('0x31')]=_[_0x0dc2('0x32')](_['map'](_0x370160,_0x0dc2('0x2a')),[_0x0dc2('0x33')]);_0x3c2b94[_0x0dc2('0x34')]=_['keys'](_0x4c86b4[_0x0dc2('0x34')]);_0x3c2b94[_0x0dc2('0x35')]=_[_0x0dc2('0x36')](_0x3c2b94[_0x0dc2('0x31')],_0x3c2b94['query']);_0x820d60[_0x0dc2('0x37')]=_[_0x0dc2('0x36')](_0x3c2b94[_0x0dc2('0x31')],qs[_0x0dc2('0x38')](_0x4c86b4['query']['fields']));_0x820d60[_0x0dc2('0x37')]=_0x820d60[_0x0dc2('0x37')][_0x0dc2('0x39')]?_0x820d60[_0x0dc2('0x37')]:_0x3c2b94[_0x0dc2('0x31')];if(!_0x4c86b4[_0x0dc2('0x34')]['hasOwnProperty'](_0x0dc2('0x3a'))){_0x820d60['limit']=qs[_0x0dc2('0x1f')](_0x4c86b4[_0x0dc2('0x34')]['limit']);_0x820d60[_0x0dc2('0x21')]=qs[_0x0dc2('0x21')](_0x4c86b4[_0x0dc2('0x34')][_0x0dc2('0x21')]);}_0x820d60[_0x0dc2('0x3b')]=qs['sort'](_0x4c86b4[_0x0dc2('0x34')][_0x0dc2('0x3c')]);_0x820d60[_0x0dc2('0x3d')]=qs[_0x0dc2('0x35')](_['pick'](_0x4c86b4['query'],_0x3c2b94[_0x0dc2('0x35')]),_0x370160);if(_0x4c86b4[_0x0dc2('0x34')][_0x0dc2('0x3e')]){_0x820d60[_0x0dc2('0x3d')]=_[_0x0dc2('0x3f')](_0x820d60['where'],{'$or':_['map'](_0x370160,function(_0x1186a5){if(_0x1186a5['type']!==_0x0dc2('0x40')){var _0x4657b0={};_0x4657b0[_0x1186a5[_0x0dc2('0x2a')]]={'$like':'%'+_0x4c86b4[_0x0dc2('0x34')][_0x0dc2('0x3e')]+'%'};return _0x4657b0;}})});}_0x820d60=_[_0x0dc2('0x3f')]({},_0x820d60,_0x4c86b4[_0x0dc2('0x41')]);var _0x49d0fe={'where':_0x820d60[_0x0dc2('0x3d')]};return db[_0x0dc2('0x2d')][_0x0dc2('0x20')](_0x49d0fe)['then'](function(_0x1d4c56){_0x288b24['count']=_0x1d4c56;if(_0x4c86b4['query']['includeAll']){_0x820d60[_0x0dc2('0x42')]=[{'all':!![]}];}return db[_0x0dc2('0x2d')][_0x0dc2('0x43')](_0x820d60);})[_0x0dc2('0x27')](function(_0x437c77){_0x288b24[_0x0dc2('0x44')]=_0x437c77;return _0x288b24;})['then'](respondWithFilteredResult(_0x50b4a3,_0x820d60))['catch'](handleError(_0x50b4a3,null));};exports['show']=function(_0x48eed9,_0x23775b){var _0x3346e5={'raw':![],'where':{'id':_0x48eed9[_0x0dc2('0x45')]['id']}},_0x4172e6={};_0x4172e6[_0x0dc2('0x31')]=_[_0x0dc2('0x46')](db[_0x0dc2('0x2d')]['rawAttributes']);_0x4172e6[_0x0dc2('0x34')]=_['keys'](_0x48eed9[_0x0dc2('0x34')]);_0x4172e6[_0x0dc2('0x35')]=_[_0x0dc2('0x36')](_0x4172e6[_0x0dc2('0x31')],_0x4172e6[_0x0dc2('0x34')]);_0x3346e5['attributes']=_[_0x0dc2('0x36')](_0x4172e6[_0x0dc2('0x31')],qs['fields'](_0x48eed9[_0x0dc2('0x34')][_0x0dc2('0x38')]));_0x3346e5['attributes']=_0x3346e5[_0x0dc2('0x37')][_0x0dc2('0x39')]?_0x3346e5[_0x0dc2('0x37')]:_0x4172e6[_0x0dc2('0x31')];if(_0x48eed9[_0x0dc2('0x34')][_0x0dc2('0x47')]){_0x3346e5[_0x0dc2('0x42')]=[{'all':!![]}];}_0x3346e5=_['merge']({},_0x3346e5,_0x48eed9[_0x0dc2('0x41')]);return db[_0x0dc2('0x2d')][_0x0dc2('0x48')](_0x3346e5)[_0x0dc2('0x27')](handleEntityNotFound(_0x23775b,null))[_0x0dc2('0x27')](respondWithResult(_0x23775b,null))[_0x0dc2('0x49')](handleError(_0x23775b,null));};exports[_0x0dc2('0x4a')]=function(_0x6d1573,_0x43cbd3){return db[_0x0dc2('0x2d')][_0x0dc2('0x4a')](_0x6d1573['body'],{})['then'](respondWithResult(_0x43cbd3,0xc9))[_0x0dc2('0x49')](handleError(_0x43cbd3,null));};exports['update']=function(_0x3e9a54,_0x493665){if(_0x3e9a54[_0x0dc2('0x4b')]['id']){delete _0x3e9a54[_0x0dc2('0x4b')]['id'];}return db[_0x0dc2('0x2d')]['find']({'where':{'id':_0x3e9a54['params']['id']}})['then'](handleEntityNotFound(_0x493665,null))[_0x0dc2('0x27')](saveUpdates(_0x3e9a54[_0x0dc2('0x4b')],null))[_0x0dc2('0x27')](respondWithResult(_0x493665,null))[_0x0dc2('0x49')](handleError(_0x493665,null));};exports[_0x0dc2('0x4c')]=function(_0x6de86b,_0x2d56f9){return db['VoiceRecording'][_0x0dc2('0x4c')]()['then'](respondWithResult(_0x2d56f9,null))[_0x0dc2('0x49')](handleError(_0x2d56f9,null));};exports[_0x0dc2('0x4d')]=function(_0x286ba1,_0x553858,_0x5579d3){var _0x496887=require(_0x0dc2('0x4e'));var _0x4e8deb=![];var _0x48467b={};if(_0x286ba1[_0x0dc2('0x34')]['type']&&_0x286ba1[_0x0dc2('0x34')][_0x0dc2('0x2f')]===_0x0dc2('0x4f')){_0x48467b[_0x0dc2('0x4f')]=_0x286ba1[_0x0dc2('0x45')]['id'];}else{_0x48467b['id']=_0x286ba1[_0x0dc2('0x45')]['id'];}return db[_0x0dc2('0x2d')][_0x0dc2('0x48')]({'where':_0x48467b,'attributes':['id',_0x0dc2('0x50')],'raw':!![]})[_0x0dc2('0x27')](handleEntityNotFound(_0x553858,null))[_0x0dc2('0x27')](function(_0x2f1f9c){if(_0x2f1f9c){var _0x40a245=_0x2f1f9c[_0x0dc2('0x50')];var _0x1334f4=util[_0x0dc2('0x33')](_0x0dc2('0x51'),_0x40a245);if(fs[_0x0dc2('0x52')](_0x1334f4)){_0x4e8deb=!![];return _0x496887[_0x0dc2('0x53')](_0x1334f4,_0x40a245,config['secrets'][_0x0dc2('0x54')])[_0x0dc2('0x27')](function(){return _0x2f1f9c;});}return _0x2f1f9c;}})[_0x0dc2('0x27')](function(_0x291f7c){if(_0x291f7c){var _0x32c4fb=_0x291f7c[_0x0dc2('0x50')];if(!fs[_0x0dc2('0x52')](_0x32c4fb)){throw new db[(_0x0dc2('0x55'))][(_0x0dc2('0x56'))](_0x0dc2('0x57'));}if(_0x291f7c[_0x0dc2('0x58')]){return _0x553858['download'](_0x32c4fb,_0x291f7c['filename']+path[_0x0dc2('0x59')](_0x32c4fb),function(){if(_0x4e8deb){fs[_0x0dc2('0x5a')](_0x32c4fb);}});}else{return _0x553858[_0x0dc2('0x4d')](_0x32c4fb,function(_0x2a9564){if(_0x4e8deb){fs[_0x0dc2('0x5a')](_0x32c4fb);}});}}})[_0x0dc2('0x49')](function(_0x4fdb52){if(_0x4fdb52[_0x0dc2('0x5b')]===_0x0dc2('0x57')){_0x553858[_0x0dc2('0x1b')](0x194)[_0x0dc2('0x2b')](_0x0dc2('0x5c'));}else{return handleError(_0x553858,null);}});};exports[_0x0dc2('0x5d')]=function(_0x3fe7f7,_0x51fc7f,_0x28d78d){var _0x3b3e84=require(_0x0dc2('0x4e'));var _0xb000b4=![];var _0x58f02e={'$and':[db[_0x0dc2('0x5e')][_0x0dc2('0x3d')](db[_0x0dc2('0x5e')]['fn']('MD5',db[_0x0dc2('0x5e')][_0x0dc2('0x5f')](_0x0dc2('0x4f'))),_0x3fe7f7[_0x0dc2('0x34')][_0x0dc2('0x60')])]};if(_0x3fe7f7['query'][_0x0dc2('0x2f')]&&_0x3fe7f7['query']['type']===_0x0dc2('0x4f')){_0x58f02e[_0x0dc2('0x61')][_0x0dc2('0x62')]({'uniqueid':_0x3fe7f7[_0x0dc2('0x45')]['id']});}else{_0x58f02e['$and'][_0x0dc2('0x62')]({'id':_0x3fe7f7[_0x0dc2('0x45')]['id']});}return db[_0x0dc2('0x2d')][_0x0dc2('0x48')]({'where':_0x58f02e,'attributes':['id',_0x0dc2('0x50')],'raw':!![]})[_0x0dc2('0x27')](handleEntityNotFound(_0x51fc7f,null))[_0x0dc2('0x27')](function(_0x3a46da){if(_0x3a46da){var _0x4c8a39=util[_0x0dc2('0x33')](_0x0dc2('0x51'),_0x3a46da[_0x0dc2('0x50')]);if(fs[_0x0dc2('0x52')](_0x4c8a39)){_0xb000b4=!![];return _0x3b3e84[_0x0dc2('0x53')](_0x4c8a39,_0x3a46da[_0x0dc2('0x50')],config[_0x0dc2('0x63')]['recording'])['then'](function(){return _0x3a46da;});}return _0x3a46da;}})[_0x0dc2('0x27')](function(_0x215663){if(_0x215663){if(!fs['existsSync'](_0x215663[_0x0dc2('0x50')])){throw new db[(_0x0dc2('0x55'))][(_0x0dc2('0x56'))](_0x0dc2('0x57'));}if(_0x215663[_0x0dc2('0x58')]){return _0x51fc7f[_0x0dc2('0x4d')](_0x215663[_0x0dc2('0x50')],_0x215663[_0x0dc2('0x58')]+path[_0x0dc2('0x59')](_0x215663['value']),function(){if(_0xb000b4){fs['unlink'](_0x215663[_0x0dc2('0x50')]);}});}else{return _0x51fc7f[_0x0dc2('0x4d')](_0x215663['value'],function(_0x53f9a8){if(_0xb000b4){fs[_0x0dc2('0x5a')](_0x215663[_0x0dc2('0x50')]);}});}}})[_0x0dc2('0x49')](handleError(_0x51fc7f,null));};exports['destroy']=function(_0x23c496,_0x371615){return db[_0x0dc2('0x2d')][_0x0dc2('0x48')]({'where':{'id':_0x23c496[_0x0dc2('0x45')]['id']}})['then'](function(_0x39af07){if(_[_0x0dc2('0x64')](_0x39af07)){throw new ReferenceError(_0x0dc2('0x65'));}return _0x39af07;})[_0x0dc2('0x27')](function(_0x232518){var _0x17f709=_0x232518['value'];logger[_0x0dc2('0x66')](_0x0dc2('0x67'),_0x17f709);if(!_[_0x0dc2('0x64')](_0x232518[_0x0dc2('0x50')])&&fs[_0x0dc2('0x52')](_0x17f709)){logger['info'](_0x0dc2('0x68')+_0x17f709+_0x0dc2('0x69'));fs[_0x0dc2('0x6a')](_0x17f709);}_0x17f709=_0x17f709+'.cypher';if(!_[_0x0dc2('0x64')](_0x232518[_0x0dc2('0x50')])&&fs[_0x0dc2('0x52')](_0x17f709)){logger[_0x0dc2('0x66')](_0x0dc2('0x68')+_0x17f709+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x17f709);}return _0x232518;})['then'](function(_0x39e761){if(!_0x39e761)throw new InternalError();return _0x39e761[_0x0dc2('0x28')]();})[_0x0dc2('0x27')](function(){_0x371615[_0x0dc2('0x1b')](0xcc)[_0x0dc2('0x1c')]();})[_0x0dc2('0x49')](handleError(_0x371615,null));};function getBucketslist(_0x3433e0,_0x305a05,_0x2e1b52){return new Promise(function(_0x53af4b,_0x391f9d){var _0x4d2e08=new AWS['S3']({'accessKeyId':_0x305a05,'secretAccessKey':_0x3433e0,'region':_0x2e1b52});_0x4d2e08['listBuckets']({},function(_0xbe277,_0xa841f1){if(_0xbe277){return _0x391f9d(_0xbe277);}else{return _0x53af4b(_0xa841f1);}});});}function createBucket(_0xda1cac,_0x508d6b,_0x266e2b,_0x514895){return new Promise(function(_0x3f2c27,_0xb2e458){var _0x22c616=new AWS['S3']({'accessKeyId':_0x508d6b,'secretAccessKey':_0xda1cac,'region':_0x266e2b});_0x22c616[_0x0dc2('0x6b')]({'Bucket':_0x514895},function(_0x764af4,_0xe52284){if(_0x764af4){return _0xb2e458(_0x764af4);}else{return _0x3f2c27(_0xe52284);}});});}function uploadFile(_0x3c534e,_0x30ace7,_0x2b94ba,_0xcd5992,_0x31dca5,_0xbaf07){return new Promise(function(_0x234fe6,_0x1a5bf6){var _0x2e9a8f=new AWS['S3']({'accessKeyId':_0x30ace7,'secretAccessKey':_0x3c534e,'region':_0x2b94ba});_0x2e9a8f['upload']({'Bucket':_0xcd5992,'Key':_0x31dca5,'Body':_0xbaf07},function(_0x549827,_0x169a5e){if(_0x549827){return _0x1a5bf6(_0x549827);}else{return _0x234fe6(_0x169a5e);}});});}function startTranscribe(_0x5d93c7,_0x2ff642,_0xfe942c,_0x899157,_0x4f8123,_0x5534cf){return new Promise(function(_0x110507,_0x1320ea){var _0x151740=new AWS[(_0x0dc2('0x6c'))]({'accessKeyId':_0x2ff642,'secretAccessKey':_0x5d93c7,'region':_0xfe942c});_0x151740[_0x0dc2('0x6d')]({'TranscriptionJobName':_0x899157,'LanguageCode':_0x4f8123,'Media':{'MediaFileUri':_0x5534cf}},function(_0x14e49f,_0x60a096){if(_0x14e49f){return _0x1320ea(_0x14e49f);}else{return _0x110507(_0x60a096);}});});}function transcribe(_0x1d38dd,_0x38b93f,_0x7973b1,_0x5f47e2,_0x5c089c,_0x16d1b1,_0x396b4d){return new Promise(function(_0xd824f9,_0x38d08a){var _0x1ab7bc={};logger[_0x0dc2('0x66')](util[_0x0dc2('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1d38dd,_0x5c089c));return uploadFile(_0x38b93f,_0x7973b1,_0x5f47e2,_0x5c089c,path[_0x0dc2('0x6e')](_0x16d1b1),fs['readFileSync'](_0x16d1b1))[_0x0dc2('0x27')](function(_0x4f385b){logger['info'](util[_0x0dc2('0x33')](_0x0dc2('0x6f'),_0x1d38dd,_0x5c089c,_0x4f385b[_0x0dc2('0x70')]));_0x1ab7bc['bucket']=_0x4f385b['Bucket'];_0x1ab7bc[_0x0dc2('0x71')]=_0x4f385b[_0x0dc2('0x70')];logger[_0x0dc2('0x66')](util[_0x0dc2('0x33')](_0x0dc2('0x72'),_0x1d38dd));return startTranscribe(_0x38b93f,_0x7973b1,_0x5f47e2,uuidv4(),_0x396b4d,_0x4f385b[_0x0dc2('0x70')]);})[_0x0dc2('0x27')](function(_0x52bb12){logger['info'](util['format'](_0x0dc2('0x73'),_0x1d38dd,_0x52bb12[_0x0dc2('0x74')][_0x0dc2('0x75')]));_0x1ab7bc[_0x0dc2('0x76')]=_0x52bb12[_0x0dc2('0x74')]['TranscriptionJobName'];_0x1ab7bc[_0x0dc2('0x77')]=_0x52bb12[_0x0dc2('0x74')][_0x0dc2('0x78')];return _0xd824f9(_0x1ab7bc);})['catch'](function(_0x180b60){return _0x38d08a(_0x180b60);});});}exports[_0x0dc2('0x79')]=function(_0x2e37b8,_0x3cb897,_0x593bc2){var _0x3494b0;var _0x4ec034;var _0xaec564;var _0x5aafa8=require(_0x0dc2('0x4e'));return db[_0x0dc2('0x2d')]['findOne']({'where':{'id':_0x2e37b8[_0x0dc2('0x45')]['id']}})[_0x0dc2('0x27')](function(_0x2fd320){if(_0x2fd320){var _0x2df160=util['format'](_0x0dc2('0x51'),_0x2fd320[_0x0dc2('0x50')]);if(fs[_0x0dc2('0x52')](_0x2df160)){cypher=!![];return _0x5aafa8[_0x0dc2('0x53')](_0x2df160,_0x2fd320[_0x0dc2('0x50')],config['secrets']['recording'])[_0x0dc2('0x27')](function(){return _0x2fd320;});}return _0x2fd320;}})[_0x0dc2('0x27')](function(_0x326dc7){if(!_0x326dc7){throw new db[(_0x0dc2('0x55'))][(_0x0dc2('0x56'))]('Voice\x20Recording\x20not\x20found');}_0x4ec034=_0x326dc7;return db[_0x0dc2('0x7a')][_0x0dc2('0x7b')]({'where':{'id':0x1}});})[_0x0dc2('0x27')](handleEntityNotFound(_0x3cb897,null))[_0x0dc2('0x27')](function(_0x46be4c){if(_0x46be4c){_0x3494b0=_0x46be4c;if(!_0x3494b0[_0x0dc2('0x7c')]||!_0x3494b0[_0x0dc2('0x7d')]||!_0x3494b0['transcribeRegion']||!_0x3494b0[_0x0dc2('0x7e')]||!_0x3494b0[_0x0dc2('0x7f')]){throw new db[(_0x0dc2('0x55'))][(_0x0dc2('0x56'))]('Transcribe\x20not\x20configured');}if(_0x2e37b8[_0x0dc2('0x4b')]['runSentiment']&&(!_0x3494b0[_0x0dc2('0x80')]||!_0x3494b0[_0x0dc2('0x81')]||!_0x3494b0[_0x0dc2('0x82')]||!_0x3494b0['language']||!_0x3494b0[_0x0dc2('0x7f')])){throw new db['Sequelize'][(_0x0dc2('0x56'))](_0x0dc2('0x83'));}return db[_0x0dc2('0x84')][_0x0dc2('0x7b')]({'where':{'id':_0x3494b0[_0x0dc2('0x7d')]}});}})['then'](function(_0xa90832){if(!_0xa90832){throw new db[(_0x0dc2('0x55'))][(_0x0dc2('0x56'))](_0x0dc2('0x85'));}if(!_0xa90832[_0x0dc2('0x86')]||!_0xa90832[_0x0dc2('0x87')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xaec564=_0xa90832;return getBucketslist(_0xaec564[_0x0dc2('0x86')],_0xaec564['data2'],_0x3494b0[_0x0dc2('0x88')]);})[_0x0dc2('0x27')](function(_0x421e40){if(_0x421e40&&_0x421e40[_0x0dc2('0x89')]){var _0xaef46b=_['find'](_0x421e40['Buckets'],function(_0x40778c){return _0x40778c['Name']===_0x3494b0[_0x0dc2('0x7f')];});if(!_0xaef46b){logger[_0x0dc2('0x66')](util['format'](_0x0dc2('0x8a'),_0x2e37b8[_0x0dc2('0x45')]['id'],_0x3494b0['bucket']));return createBucket(_0xaec564[_0x0dc2('0x86')],_0xaec564['data2'],_0x3494b0[_0x0dc2('0x88')],_0x3494b0[_0x0dc2('0x7f')]);}logger['info'](util[_0x0dc2('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2e37b8['params']['id'],_0x3494b0[_0x0dc2('0x7f')]));return;}})['then'](function(_0x15c8c4){if(_0x4ec034[_0x0dc2('0x77')]===_0x0dc2('0x8b')){return transcribe(_0x2e37b8[_0x0dc2('0x45')]['id'],_0xaec564[_0x0dc2('0x86')],_0xaec564[_0x0dc2('0x87')],_0x3494b0['transcribeRegion'],_0x3494b0[_0x0dc2('0x7f')],_0x4ec034[_0x0dc2('0x50')],_0x3494b0[_0x0dc2('0x7e')]);}else{logger['info'](util[_0x0dc2('0x33')](_0x0dc2('0x8c'),_0x2e37b8[_0x0dc2('0x45')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x0dc2('0x27')](function(_0x2aad0a){if(_0x2aad0a){_0x2aad0a[_0x0dc2('0x8d')]=_0x2e37b8[_0x0dc2('0x4b')][_0x0dc2('0x8e')];return _0x4ec034[_0x0dc2('0x8f')](_0x2aad0a);}})['then'](respondWithResult(_0x3cb897,null))[_0x0dc2('0x49')](handleError(_0x3cb897,null));};function writeFile(_0x24553c,_0x1a485e){return new Promise(function(_0x5b403e,_0xc336fb){fs['writeFile'](_0x1a485e,_0x24553c,function(_0x2489a,_0x3f6556){if(_0x2489a){return _0xc336fb(_0x2489a);}else{return _0x5b403e(_0x3f6556);}});});}exports[_0x0dc2('0x90')]=function(_0x3cc039,_0x542d51,_0x354d0e){return db[_0x0dc2('0x2d')][_0x0dc2('0x7b')]({'where':{'id':_0x3cc039[_0x0dc2('0x45')]['id']}})[_0x0dc2('0x27')](handleEntityNotFound(_0x542d51))['then'](function(_0xeda24b){if(_0xeda24b&&_0xeda24b['fileText']){var _0x21d608=_0xeda24b['fileText'];var _0xbe7f59=config['root']+_0x0dc2('0x91')+_0xeda24b['id']+_0x0dc2('0x92');if(fs[_0x0dc2('0x52')](_0xbe7f59)){return _0xbe7f59;}return writeFile(_0x21d608,_0xbe7f59)[_0x0dc2('0x27')](function(){return _0xbe7f59;});}else{throw new db[(_0x0dc2('0x55'))][(_0x0dc2('0x56'))]('Transcript\x20not\x20available');}})['then'](function(_0x1153a3){return _0x542d51[_0x0dc2('0x4d')](_0x1153a3);})['catch'](handleError(_0x542d51));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index a00747f..5760696 100644 --- a/server/api/voiceRecording/voiceRecording.model.js +++ b/server/api/voiceRecording/voiceRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e5c=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x42057f,_0x150e8b){var _0x295184=function(_0x29de9f){while(--_0x29de9f){_0x42057f['push'](_0x42057f['shift']());}};_0x295184(++_0x150e8b);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x46eeea,_0x30d3a7){_0x46eeea=_0x46eeea-0x0;var _0x227574=_0x3e5c[_0x46eeea];return _0x227574;};'use strict';var attributes=require(_0xc3e5('0x0'));module[_0xc3e5('0x1')]=function(_0x160b5a,_0x28330c){return _0x160b5a['define'](_0xc3e5('0x2'),attributes,{'tableName':_0xc3e5('0x3'),'paranoid':![],'indexes':[{'name':_0xc3e5('0x4'),'fields':[_0xc3e5('0x4')]},{'name':_0xc3e5('0x5'),'fields':[_0xc3e5('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','transcribeStatus'];(function(_0x285339,_0x328c11){var _0x5a4811=function(_0x1bf480){while(--_0x1bf480){_0x285339['push'](_0x285339['shift']());}};_0x5a4811(++_0x328c11);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xb4e6[_0x3f0b30];return _0x2748a5;};'use strict';var attributes=require(_0x6b4e('0x0'));module[_0x6b4e('0x1')]=function(_0x3c385b,_0x9babca){return _0x3c385b[_0x6b4e('0x2')](_0x6b4e('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x6b4e('0x4'),'fields':['uniqueid']},{'name':_0x6b4e('0x5'),'fields':[_0x6b4e('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 989a1ba..b0f0108 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbbc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','UpdateVoiceRecording','update','body','options','raw','where','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','secrets','CreateVoiceRecording\x20file\x20encrypted','stringify'];(function(_0x3c8253,_0x4b59db){var _0x3e96cb=function(_0x33b2ca){while(--_0x33b2ca){_0x3c8253['push'](_0x3c8253['shift']());}};_0x3e96cb(++_0x4b59db);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x419700,_0x7d992c){_0x419700=_0x419700-0x0;var _0x917339=_0xbbbc[_0x419700];return _0x917339;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['VoiceRecording'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x1a')]||null:null,'attributes':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')]['attributes']||null:null,'limit':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x1b')]||null:null})[_0xcbbb('0xd')](function(_0x258d1f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')](_0xcbbb('0x15'),_0x3436af,JSON['stringify'](_0x258d1f));_0x5052df(_0x258d1f);})[_0xcbbb('0x14')](function(_0x4490c1){logger['error'](_0xcbbb('0x15'),_0x4490c1['message'],_0x3436af);_0x57c5e9(_0x3572bb['error'](0x1f4,_0x4490c1[_0xcbbb('0x12')]));});});};exports[_0xcbbb('0x1c')]=function(_0x548440){var _0x59c422=this;return new Promise(function(_0x5499a1,_0x4439ea){var _0x55e1d8=require('../../components/encryptor');var _0x21e3b1;return db[_0xcbbb('0x1d')][_0xcbbb('0x1e')]({'attributes':['id',_0xcbbb('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xcbbb('0xd')](function(_0x39ba8b){_0x21e3b1=_0x39ba8b;return db[_0xcbbb('0x20')][_0xcbbb('0x21')](_0x548440[_0xcbbb('0x17')]);})[_0xcbbb('0xd')](function(_0x1c2ac9){if(_0x21e3b1[_0xcbbb('0x1f')]&&fs[_0xcbbb('0x22')](_0x1c2ac9[_0xcbbb('0x23')])){var _0x2a9639=util[_0xcbbb('0x24')](_0xcbbb('0x25'),_0x1c2ac9[_0xcbbb('0x23')]);return _0x55e1d8['encryptFile'](_0x1c2ac9[_0xcbbb('0x23')],_0x2a9639,config[_0xcbbb('0x26')]['recording'])[_0xcbbb('0xd')](function(){fs['unlink'](_0x1c2ac9[_0xcbbb('0x23')]);logger[_0xcbbb('0xe')](_0xcbbb('0x27'));return _0x1c2ac9;});}return _0x1c2ac9;})['then'](function(_0x38ee99){logger[_0xcbbb('0xe')](_0xcbbb('0x1c'),_0x548440);logger[_0xcbbb('0xf')](_0xcbbb('0x1c'),_0x548440,JSON[_0xcbbb('0x28')](_0x38ee99));_0x5499a1(_0x38ee99);})[_0xcbbb('0x14')](function(_0x1ac1a2){logger[_0xcbbb('0x11')](_0xcbbb('0x1c'),_0x1ac1a2['message'],_0x548440);_0x4439ea(_0x59c422['error'](0x1f4,_0x1ac1a2['message']));});});}; \ No newline at end of file +var _0x323f=['UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','limit','catch','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x5023e4,_0x279e17){var _0x390bb1=function(_0x54c4ba){while(--_0x54c4ba){_0x5023e4['push'](_0x5023e4['shift']());}};_0x390bb1(++_0x279e17);}(_0x323f,0x1ee));var _0xf323=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x323f[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb9a667,_0x444cba,_0x1af70d){return new BPromise(function(_0x2c8271,_0x8abeac){return client[_0xf323('0xb')](_0xb9a667,_0x1af70d)[_0xf323('0xc')](function(_0x2b24a2){logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));logger[_0xf323('0x10')](_0xf323('0x11'),_0x444cba,_0xf323('0xf'),JSON[_0xf323('0x12')](_0x2b24a2));if(_0x2b24a2[_0xf323('0x13')]){if(_0x2b24a2[_0xf323('0x13')]['code']===0x1f4){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')]['message']);return _0x8abeac(_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);}logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);return _0x2c8271(_0x2b24a2['error']['message']);}else{logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));_0x2c8271(_0x2b24a2[_0xf323('0x15')][_0xf323('0x14')]);}})['catch'](function(_0xd6c25){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0xd6c25);_0x8abeac(_0xd6c25);});});}exports[_0xf323('0x16')]=function(_0x49b115){var _0x2db977=this;return new Promise(function(_0x272aec,_0x1a459d){return db[_0xf323('0x17')]['update'](_0x49b115[_0xf323('0x18')],{'raw':_0x49b115[_0xf323('0x19')]?_0x49b115['options'][_0xf323('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49b115[_0xf323('0x19')]?_0x49b115[_0xf323('0x19')][_0xf323('0x1b')]||null:null,'attributes':_0x49b115['options']?_0x49b115[_0xf323('0x19')][_0xf323('0x1c')]||null:null,'limit':_0x49b115[_0xf323('0x19')]?_0x49b115['options'][_0xf323('0x1d')]||null:null})[_0xf323('0xc')](function(_0x3e1c49){logger[_0xf323('0xd')](_0xf323('0x16'),_0x49b115);logger[_0xf323('0x10')](_0xf323('0x16'),_0x49b115,JSON[_0xf323('0x12')](_0x3e1c49));_0x272aec(_0x3e1c49);})[_0xf323('0x1e')](function(_0x47fb15){logger[_0xf323('0x13')](_0xf323('0x16'),_0x47fb15[_0xf323('0x14')],_0x49b115);_0x1a459d(_0x2db977[_0xf323('0x13')](0x1f4,_0x47fb15[_0xf323('0x14')]));});});};exports[_0xf323('0x1f')]=function(_0x4d737d){var _0x30ed93=this;return new Promise(function(_0x56ce33,_0x1570d4){var _0x3902eb=require('../../components/encryptor');var _0x46663b;return db[_0xf323('0x20')][_0xf323('0x21')]({'attributes':['id',_0xf323('0x22')],'where':{'id':0x1},'raw':!![]})[_0xf323('0xc')](function(_0x5b8b60){_0x46663b=_0x5b8b60;return db[_0xf323('0x17')][_0xf323('0x23')](_0x4d737d[_0xf323('0x18')]);})[_0xf323('0xc')](function(_0x4260f3){if(_0x46663b[_0xf323('0x22')]&&fs[_0xf323('0x24')](_0x4260f3[_0xf323('0x25')])){var _0x139adc=util['format'](_0xf323('0x26'),_0x4260f3[_0xf323('0x25')]);return _0x3902eb[_0xf323('0x27')](_0x4260f3[_0xf323('0x25')],_0x139adc,config[_0xf323('0x28')]['recording'])[_0xf323('0xc')](function(){fs[_0xf323('0x29')](_0x4260f3[_0xf323('0x25')]);logger[_0xf323('0xd')](_0xf323('0x2a'));return _0x4260f3;});}return _0x4260f3;})['then'](function(_0x33487c){logger[_0xf323('0xd')](_0xf323('0x1f'),_0x4d737d);logger[_0xf323('0x10')]('CreateVoiceRecording',_0x4d737d,JSON[_0xf323('0x12')](_0x33487c));_0x56ce33(_0x33487c);})['catch'](function(_0x372c47){logger[_0xf323('0x13')]('CreateVoiceRecording',_0x372c47[_0xf323('0x14')],_0x4d737d);_0x1570d4(_0x30ed93['error'](0x1f4,_0x372c47[_0xf323('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c9627f0..a38f6d0 100644 --- a/server/api/voiceTransferReport/index.js +++ b/server/api/voiceTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3264=['put','delete','/:id','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','post','create'];(function(_0x5cac53,_0x47927c){var _0x38a57f=function(_0x108ce8){while(--_0x108ce8){_0x5cac53['push'](_0x5cac53['shift']());}};_0x38a57f(++_0x47927c);}(_0x3264,0xf3));var _0x4326=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x3264[_0xd09668];return _0x68726;};'use strict';var multer=require('multer');var util=require(_0x4326('0x0'));var path=require(_0x4326('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4326('0x2'));var auth=require(_0x4326('0x3'));var interaction=require(_0x4326('0x4'));var config=require(_0x4326('0x5'));var controller=require('./voiceTransferReport.controller');router[_0x4326('0x6')]('/',auth[_0x4326('0x7')](),controller['index']);router[_0x4326('0x6')](_0x4326('0x8'),auth[_0x4326('0x7')](),controller[_0x4326('0x9')]);router[_0x4326('0x6')]('/:id',auth[_0x4326('0x7')](),controller['show']);router[_0x4326('0xa')]('/',auth[_0x4326('0x7')](),controller[_0x4326('0xb')]);router[_0x4326('0xc')]('/:id',auth[_0x4326('0x7')](),controller['update']);router[_0x4326('0xd')](_0x4326('0xe'),auth[_0x4326('0x7')](),controller[_0x4326('0xf')]);module[_0x4326('0x10')]=router; \ No newline at end of file +var _0xfa8b=['post','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x314bc6,_0x1e99bd){var _0x1449de=function(_0x5a4872){while(--_0x5a4872){_0x314bc6['push'](_0x314bc6['shift']());}};_0x1449de(++_0x1e99bd);}(_0xfa8b,0x1b4));var _0xbfa8=function(_0x602d3f,_0x31c1bd){_0x602d3f=_0x602d3f-0x0;var _0x35be06=_0xfa8b[_0x602d3f];return _0x35be06;};'use strict';var multer=require(_0xbfa8('0x0'));var util=require('util');var path=require(_0xbfa8('0x1'));var timeout=require(_0xbfa8('0x2'));var express=require(_0xbfa8('0x3'));var router=express['Router']();var fs_extra=require(_0xbfa8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbfa8('0x5'));var controller=require(_0xbfa8('0x6'));router[_0xbfa8('0x7')]('/',auth[_0xbfa8('0x8')](),controller[_0xbfa8('0x9')]);router['get'](_0xbfa8('0xa'),auth[_0xbfa8('0x8')](),controller[_0xbfa8('0xb')]);router[_0xbfa8('0x7')]('/:id',auth[_0xbfa8('0x8')](),controller['show']);router[_0xbfa8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbfa8('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbfa8('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xbfa8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 073bef4..b9e8780 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.attributes.js +++ b/server/api/voiceTransferReport/voiceTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86c8=['exports','ENUM','blind','attended','STRING','sequelize','moment'];(function(_0x3e5e48,_0x4afbbe){var _0x30388c=function(_0x44aa54){while(--_0x44aa54){_0x3e5e48['push'](_0x3e5e48['shift']());}};_0x30388c(++_0x4afbbe);}(_0x86c8,0x83));var _0x886c=function(_0x5a9980,_0x4c54a7){_0x5a9980=_0x5a9980-0x0;var _0x200d99=_0x86c8[_0x5a9980];return _0x200d99;};'use strict';var Sequelize=require(_0x886c('0x0'));var moment=require(_0x886c('0x1'));module[_0x886c('0x2')]={'type':{'type':Sequelize[_0x886c('0x3')](_0x886c('0x4'),_0x886c('0x5'))},'result':{'type':Sequelize[_0x886c('0x6')]},'transfererchannel':{'type':Sequelize[_0x886c('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x886c('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x886c('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x886c('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x886c('0x6')]},'transfererexten':{'type':Sequelize[_0x886c('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x886c('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x886c('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x886c('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x886c('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x886c('0x6')]},'transfereecontext':{'type':Sequelize[_0x886c('0x6')]},'transfereeexten':{'type':Sequelize[_0x886c('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x886c('0x3')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd70f=['ENUM','blind','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x2493ec,_0x107ddc){var _0x456a1e=function(_0x3d7dc9){while(--_0x3d7dc9){_0x2493ec['push'](_0x2493ec['shift']());}};_0x456a1e(++_0x107ddc);}(_0xd70f,0x6d));var _0xfd70=function(_0x16a1a3,_0x105876){_0x16a1a3=_0x16a1a3-0x0;var _0x2e43f7=_0xd70f[_0x16a1a3];return _0x2e43f7;};'use strict';var Sequelize=require(_0xfd70('0x0'));var moment=require(_0xfd70('0x1'));module[_0xfd70('0x2')]={'type':{'type':Sequelize[_0xfd70('0x3')](_0xfd70('0x4'),_0xfd70('0x5'))},'result':{'type':Sequelize[_0xfd70('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xfd70('0x6')]},'transferercalleridname':{'type':Sequelize[_0xfd70('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xfd70('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xfd70('0x6')]},'transferercontext':{'type':Sequelize[_0xfd70('0x6')]},'transfererexten':{'type':Sequelize[_0xfd70('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xfd70('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xfd70('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xfd70('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xfd70('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xfd70('0x6')]},'transfereecontext':{'type':Sequelize[_0xfd70('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xfd70('0x6')]},'isexternal':{'type':Sequelize[_0xfd70('0x3')](_0xfd70('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xfd70('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index c42b1b1..876e6e9 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.controller.js +++ b/server/api/voiceTransferReport/voiceTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0dcf=['then','error','stack','name','index','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','options','includeAll','include','VoiceTransferReport','findAll','rows','catch','show','params','merge','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0dcf,0xb6));var _0xf0dc=function(_0x583bec,_0x24e052){_0x583bec=_0x583bec-0x0;var _0x5854a2=_0x0dcf[_0x583bec];return _0x5854a2;};'use strict';var emlformat=require(_0xf0dc('0x0'));var rimraf=require(_0xf0dc('0x1'));var zipdir=require(_0xf0dc('0x2'));var jsonpatch=require(_0xf0dc('0x3'));var rp=require(_0xf0dc('0x4'));var moment=require(_0xf0dc('0x5'));var BPromise=require(_0xf0dc('0x6'));var Mustache=require(_0xf0dc('0x7'));var util=require('util');var path=require(_0xf0dc('0x8'));var sox=require(_0xf0dc('0x9'));var csv=require(_0xf0dc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf0dc('0xb'));var jsforce=require(_0xf0dc('0xc'));var deskjs=require(_0xf0dc('0xd'));var toCsv=require(_0xf0dc('0xa'));var querystring=require(_0xf0dc('0xe'));var Papa=require(_0xf0dc('0xf'));var Redis=require(_0xf0dc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf0dc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0dc('0x12'))(_0xf0dc('0x13'));var utils=require(_0xf0dc('0x14'));var config=require(_0xf0dc('0x15'));var licenseUtil=require(_0xf0dc('0x16'));var db=require(_0xf0dc('0x17'))['db'];function respondWithStatusCode(_0x25b3d2,_0x25fd64){_0x25fd64=_0x25fd64||0xcc;return function(_0x15c75d){if(_0x15c75d){return _0x25b3d2['sendStatus'](_0x25fd64);}return _0x25b3d2[_0xf0dc('0x18')](_0x25fd64)[_0xf0dc('0x19')]();};}function respondWithResult(_0x4d719b,_0x3b9bc7){_0x3b9bc7=_0x3b9bc7||0xc8;return function(_0x44e636){if(_0x44e636){return _0x4d719b[_0xf0dc('0x18')](_0x3b9bc7)[_0xf0dc('0x1a')](_0x44e636);}};}function respondWithFilteredResult(_0x4e7db0,_0x2754f8){return function(_0x385f79){if(_0x385f79){var _0x48b93b=typeof _0x2754f8[_0xf0dc('0x1b')]===_0xf0dc('0x1c')&&typeof _0x2754f8[_0xf0dc('0x1d')]===_0xf0dc('0x1c');var _0x4606d9=_0x385f79[_0xf0dc('0x1e')];var _0x2188a3=_0x48b93b?0x0:_0x2754f8[_0xf0dc('0x1b')];var _0x4e6716=_0x48b93b?_0x385f79[_0xf0dc('0x1e')]:_0x2754f8[_0xf0dc('0x1b')]+_0x2754f8['limit'];var _0x26b6e6;if(_0x4e6716>=_0x4606d9){_0x4e6716=_0x4606d9;_0x26b6e6=0xc8;}else{_0x26b6e6=0xce;}_0x4e7db0[_0xf0dc('0x18')](_0x26b6e6);return _0x4e7db0[_0xf0dc('0x1f')](_0xf0dc('0x20'),_0x2188a3+'-'+_0x4e6716+'/'+_0x4606d9)[_0xf0dc('0x1a')](_0x385f79);}return null;};}function patchUpdates(_0x17bc51){return function(_0x324e43){try{jsonpatch[_0xf0dc('0x21')](_0x324e43,_0x17bc51,!![]);}catch(_0x13fda8){return BPromise[_0xf0dc('0x22')](_0x13fda8);}return _0x324e43[_0xf0dc('0x23')]();};}function saveUpdates(_0x2a99f6,_0x1f3118){return function(_0x5e4f4f){if(_0x5e4f4f){return _0x5e4f4f[_0xf0dc('0x24')](_0x2a99f6)['then'](function(_0x356de3){return _0x356de3;});}return null;};}function removeEntity(_0x31147d,_0x1d6180){return function(_0xa0fda9){if(_0xa0fda9){return _0xa0fda9['destroy']()[_0xf0dc('0x25')](function(){_0x31147d[_0xf0dc('0x18')](0xcc)[_0xf0dc('0x19')]();});}};}function handleEntityNotFound(_0x487635,_0x1ce617){return function(_0x54351a){if(!_0x54351a){_0x487635['sendStatus'](0x194);}return _0x54351a;};}function handleError(_0x1ab096,_0x3658e6){_0x3658e6=_0x3658e6||0x1f4;return function(_0x5c3a7d){logger[_0xf0dc('0x26')](_0x5c3a7d[_0xf0dc('0x27')]);if(_0x5c3a7d[_0xf0dc('0x28')]){delete _0x5c3a7d[_0xf0dc('0x28')];}_0x1ab096['status'](_0x3658e6)['send'](_0x5c3a7d);};}exports[_0xf0dc('0x29')]=function(_0x9f859f,_0x37f3dd){var _0x4496fb={},_0x3d436f={},_0x2f7951={'count':0x0,'rows':[]};var _0x88c8b0=_['map'](db['VoiceTransferReport'][_0xf0dc('0x2a')],function(_0x38bf42){return{'name':_0x38bf42['fieldName'],'type':_0x38bf42[_0xf0dc('0x2b')][_0xf0dc('0x2c')]};});_0x3d436f[_0xf0dc('0x2d')]=_['map'](_0x88c8b0,'name');_0x3d436f[_0xf0dc('0x2e')]=_[_0xf0dc('0x2f')](_0x9f859f[_0xf0dc('0x2e')]);_0x3d436f['filters']=_[_0xf0dc('0x30')](_0x3d436f['model'],_0x3d436f[_0xf0dc('0x2e')]);_0x4496fb[_0xf0dc('0x31')]=_[_0xf0dc('0x30')](_0x3d436f['model'],qs[_0xf0dc('0x32')](_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x32')]));_0x4496fb[_0xf0dc('0x31')]=_0x4496fb[_0xf0dc('0x31')][_0xf0dc('0x33')]?_0x4496fb[_0xf0dc('0x31')]:_0x3d436f[_0xf0dc('0x2d')];if(!_0x9f859f['query']['hasOwnProperty'](_0xf0dc('0x34'))){_0x4496fb[_0xf0dc('0x1d')]=qs['limit'](_0x9f859f[_0xf0dc('0x2e')]['limit']);_0x4496fb[_0xf0dc('0x1b')]=qs[_0xf0dc('0x1b')](_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x1b')]);}_0x4496fb['order']=qs[_0xf0dc('0x35')](_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x35')]);_0x4496fb[_0xf0dc('0x36')]=qs['filters'](_[_0xf0dc('0x37')](_0x9f859f[_0xf0dc('0x2e')],_0x3d436f[_0xf0dc('0x38')]),_0x88c8b0);if(_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x39')]){_0x4496fb['where']=_['merge'](_0x4496fb[_0xf0dc('0x36')],{'$or':_['map'](_0x88c8b0,function(_0xb1ee75){if(_0xb1ee75[_0xf0dc('0x2b')]!=='VIRTUAL'){var _0x320f37={};_0x320f37[_0xb1ee75[_0xf0dc('0x28')]]={'$like':'%'+_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x39')]+'%'};return _0x320f37;}})});}_0x4496fb=_['merge']({},_0x4496fb,_0x9f859f[_0xf0dc('0x3a')]);var _0xcb68a1={'where':_0x4496fb['where']};return db['VoiceTransferReport'][_0xf0dc('0x1e')](_0xcb68a1)['then'](function(_0x2b448c){_0x2f7951['count']=_0x2b448c;if(_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x3b')]){_0x4496fb[_0xf0dc('0x3c')]=[{'all':!![]}];}return db[_0xf0dc('0x3d')][_0xf0dc('0x3e')](_0x4496fb);})[_0xf0dc('0x25')](function(_0x5aaa99){_0x2f7951[_0xf0dc('0x3f')]=_0x5aaa99;return _0x2f7951;})[_0xf0dc('0x25')](respondWithFilteredResult(_0x37f3dd,_0x4496fb))[_0xf0dc('0x40')](handleError(_0x37f3dd,null));};exports[_0xf0dc('0x41')]=function(_0x3a06cf,_0x7949f6){var _0x1edcfd={'raw':!![],'where':{'id':_0x3a06cf[_0xf0dc('0x42')]['id']}},_0x40e43e={};_0x40e43e[_0xf0dc('0x2d')]=_[_0xf0dc('0x2f')](db[_0xf0dc('0x3d')][_0xf0dc('0x2a')]);_0x40e43e[_0xf0dc('0x2e')]=_[_0xf0dc('0x2f')](_0x3a06cf[_0xf0dc('0x2e')]);_0x40e43e[_0xf0dc('0x38')]=_[_0xf0dc('0x30')](_0x40e43e[_0xf0dc('0x2d')],_0x40e43e[_0xf0dc('0x2e')]);_0x1edcfd['attributes']=_[_0xf0dc('0x30')](_0x40e43e[_0xf0dc('0x2d')],qs[_0xf0dc('0x32')](_0x3a06cf[_0xf0dc('0x2e')]['fields']));_0x1edcfd[_0xf0dc('0x31')]=_0x1edcfd[_0xf0dc('0x31')][_0xf0dc('0x33')]?_0x1edcfd[_0xf0dc('0x31')]:_0x40e43e[_0xf0dc('0x2d')];if(_0x3a06cf[_0xf0dc('0x2e')][_0xf0dc('0x3b')]){_0x1edcfd[_0xf0dc('0x3c')]=[{'all':!![]}];}_0x1edcfd=_[_0xf0dc('0x43')]({},_0x1edcfd,_0x3a06cf[_0xf0dc('0x3a')]);return db[_0xf0dc('0x3d')][_0xf0dc('0x44')](_0x1edcfd)[_0xf0dc('0x25')](handleEntityNotFound(_0x7949f6,null))[_0xf0dc('0x25')](respondWithResult(_0x7949f6,null))[_0xf0dc('0x40')](handleError(_0x7949f6,null));};exports[_0xf0dc('0x45')]=function(_0x29da7a,_0x4a3f23){return db['VoiceTransferReport']['create'](_0x29da7a[_0xf0dc('0x46')],{})[_0xf0dc('0x25')](respondWithResult(_0x4a3f23,0xc9))[_0xf0dc('0x40')](handleError(_0x4a3f23,null));};exports['update']=function(_0x538a4f,_0x12a2be){if(_0x538a4f[_0xf0dc('0x46')]['id']){delete _0x538a4f[_0xf0dc('0x46')]['id'];}return db[_0xf0dc('0x3d')]['find']({'where':{'id':_0x538a4f[_0xf0dc('0x42')]['id']}})['then'](handleEntityNotFound(_0x12a2be,null))[_0xf0dc('0x25')](saveUpdates(_0x538a4f[_0xf0dc('0x46')],null))['then'](respondWithResult(_0x12a2be,null))[_0xf0dc('0x40')](handleError(_0x12a2be,null));};exports[_0xf0dc('0x47')]=function(_0x527241,_0x520602){return db[_0xf0dc('0x3d')][_0xf0dc('0x44')]({'where':{'id':_0x527241[_0xf0dc('0x42')]['id']}})[_0xf0dc('0x25')](handleEntityNotFound(_0x520602,null))[_0xf0dc('0x25')](removeEntity(_0x520602,null))[_0xf0dc('0x40')](handleError(_0x520602,null));};exports[_0xf0dc('0x48')]=function(_0x1f803b,_0x3194ac){return db[_0xf0dc('0x3d')][_0xf0dc('0x48')]()[_0xf0dc('0x25')](respondWithResult(_0x3194ac,null))[_0xf0dc('0x40')](handleError(_0x3194ac,null));}; \ No newline at end of file +var _0xad57=['order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','params','keys','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','json','apply','save','update','then','sendStatus','stack','name','index','VoiceTransferReport','rawAttributes','model','map','query','attributes','intersection','fields','hasOwnProperty'];(function(_0x5dcca6,_0x1672e8){var _0x178cae=function(_0x3f2ef0){while(--_0x3f2ef0){_0x5dcca6['push'](_0x5dcca6['shift']());}};_0x178cae(++_0x1672e8);}(_0xad57,0x1f0));var _0x7ad5=function(_0x477fe7,_0x2fbde3){_0x477fe7=_0x477fe7-0x0;var _0x5f2e04=_0xad57[_0x477fe7];return _0x5f2e04;};'use strict';var emlformat=require(_0x7ad5('0x0'));var rimraf=require(_0x7ad5('0x1'));var zipdir=require(_0x7ad5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ad5('0x3'));var BPromise=require(_0x7ad5('0x4'));var Mustache=require(_0x7ad5('0x5'));var util=require('util');var path=require(_0x7ad5('0x6'));var sox=require(_0x7ad5('0x7'));var csv=require(_0x7ad5('0x8'));var ejs=require(_0x7ad5('0x9'));var fs=require('fs');var fs_extra=require(_0x7ad5('0xa'));var _=require(_0x7ad5('0xb'));var squel=require(_0x7ad5('0xc'));var crypto=require(_0x7ad5('0xd'));var jsforce=require(_0x7ad5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7ad5('0x8'));var querystring=require(_0x7ad5('0xf'));var Papa=require(_0x7ad5('0x10'));var Redis=require(_0x7ad5('0x11'));var authService=require(_0x7ad5('0x12'));var qs=require(_0x7ad5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7ad5('0x14'));var utils=require(_0x7ad5('0x15'));var config=require(_0x7ad5('0x16'));var licenseUtil=require(_0x7ad5('0x17'));var db=require(_0x7ad5('0x18'))['db'];function respondWithStatusCode(_0x23f191,_0x58316d){_0x58316d=_0x58316d||0xcc;return function(_0x1c2471){if(_0x1c2471){return _0x23f191['sendStatus'](_0x58316d);}return _0x23f191[_0x7ad5('0x19')](_0x58316d)['end']();};}function respondWithResult(_0x3e4c43,_0x4900f){_0x4900f=_0x4900f||0xc8;return function(_0x117e1a){if(_0x117e1a){return _0x3e4c43['status'](_0x4900f)['json'](_0x117e1a);}};}function respondWithFilteredResult(_0x17f70d,_0x471000){return function(_0x5d53d3){if(_0x5d53d3){var _0x9fe79c=typeof _0x471000['offset']==='undefined'&&typeof _0x471000[_0x7ad5('0x1a')]===_0x7ad5('0x1b');var _0x321a4c=_0x5d53d3[_0x7ad5('0x1c')];var _0x236e95=_0x9fe79c?0x0:_0x471000[_0x7ad5('0x1d')];var _0x5c6d8f=_0x9fe79c?_0x5d53d3[_0x7ad5('0x1c')]:_0x471000['offset']+_0x471000['limit'];var _0x512e0e;if(_0x5c6d8f>=_0x321a4c){_0x5c6d8f=_0x321a4c;_0x512e0e=0xc8;}else{_0x512e0e=0xce;}_0x17f70d[_0x7ad5('0x19')](_0x512e0e);return _0x17f70d['set']('Content-Range',_0x236e95+'-'+_0x5c6d8f+'/'+_0x321a4c)[_0x7ad5('0x1e')](_0x5d53d3);}return null;};}function patchUpdates(_0x432336){return function(_0x4044f9){try{jsonpatch[_0x7ad5('0x1f')](_0x4044f9,_0x432336,!![]);}catch(_0x9bd122){return BPromise['reject'](_0x9bd122);}return _0x4044f9[_0x7ad5('0x20')]();};}function saveUpdates(_0x2f0a52,_0x75c98d){return function(_0x141d8e){if(_0x141d8e){return _0x141d8e[_0x7ad5('0x21')](_0x2f0a52)['then'](function(_0x2cae3c){return _0x2cae3c;});}return null;};}function removeEntity(_0x39d701,_0x25506c){return function(_0x33dd00){if(_0x33dd00){return _0x33dd00['destroy']()[_0x7ad5('0x22')](function(){_0x39d701[_0x7ad5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c29b0,_0x442836){return function(_0x46f996){if(!_0x46f996){_0x4c29b0[_0x7ad5('0x23')](0x194);}return _0x46f996;};}function handleError(_0x5b7bfe,_0x445a65){_0x445a65=_0x445a65||0x1f4;return function(_0x324e53){logger['error'](_0x324e53[_0x7ad5('0x24')]);if(_0x324e53[_0x7ad5('0x25')]){delete _0x324e53['name'];}_0x5b7bfe[_0x7ad5('0x19')](_0x445a65)['send'](_0x324e53);};}exports[_0x7ad5('0x26')]=function(_0x321095,_0x1eb048){var _0x273c40={},_0x5436e9={},_0xc2a9be={'count':0x0,'rows':[]};var _0x4e400b=_['map'](db[_0x7ad5('0x27')][_0x7ad5('0x28')],function(_0x46eb21){return{'name':_0x46eb21['fieldName'],'type':_0x46eb21['type']['key']};});_0x5436e9[_0x7ad5('0x29')]=_[_0x7ad5('0x2a')](_0x4e400b,_0x7ad5('0x25'));_0x5436e9[_0x7ad5('0x2b')]=_['keys'](_0x321095['query']);_0x5436e9['filters']=_['intersection'](_0x5436e9[_0x7ad5('0x29')],_0x5436e9[_0x7ad5('0x2b')]);_0x273c40[_0x7ad5('0x2c')]=_[_0x7ad5('0x2d')](_0x5436e9['model'],qs[_0x7ad5('0x2e')](_0x321095[_0x7ad5('0x2b')][_0x7ad5('0x2e')]));_0x273c40[_0x7ad5('0x2c')]=_0x273c40[_0x7ad5('0x2c')]['length']?_0x273c40[_0x7ad5('0x2c')]:_0x5436e9[_0x7ad5('0x29')];if(!_0x321095[_0x7ad5('0x2b')][_0x7ad5('0x2f')]('nolimit')){_0x273c40[_0x7ad5('0x1a')]=qs['limit'](_0x321095[_0x7ad5('0x2b')][_0x7ad5('0x1a')]);_0x273c40['offset']=qs[_0x7ad5('0x1d')](_0x321095[_0x7ad5('0x2b')][_0x7ad5('0x1d')]);}_0x273c40[_0x7ad5('0x30')]=qs[_0x7ad5('0x31')](_0x321095[_0x7ad5('0x2b')][_0x7ad5('0x31')]);_0x273c40[_0x7ad5('0x32')]=qs['filters'](_[_0x7ad5('0x33')](_0x321095[_0x7ad5('0x2b')],_0x5436e9[_0x7ad5('0x34')]),_0x4e400b);if(_0x321095[_0x7ad5('0x2b')][_0x7ad5('0x35')]){_0x273c40[_0x7ad5('0x32')]=_[_0x7ad5('0x36')](_0x273c40[_0x7ad5('0x32')],{'$or':_[_0x7ad5('0x2a')](_0x4e400b,function(_0x133107){if(_0x133107['type']!==_0x7ad5('0x37')){var _0x1ba227={};_0x1ba227[_0x133107[_0x7ad5('0x25')]]={'$like':'%'+_0x321095[_0x7ad5('0x2b')][_0x7ad5('0x35')]+'%'};return _0x1ba227;}})});}_0x273c40=_[_0x7ad5('0x36')]({},_0x273c40,_0x321095[_0x7ad5('0x38')]);var _0x469a4c={'where':_0x273c40['where']};return db[_0x7ad5('0x27')]['count'](_0x469a4c)[_0x7ad5('0x22')](function(_0x10aeb7){_0xc2a9be[_0x7ad5('0x1c')]=_0x10aeb7;if(_0x321095['query'][_0x7ad5('0x39')]){_0x273c40[_0x7ad5('0x3a')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x273c40);})[_0x7ad5('0x22')](function(_0x1b72e8){_0xc2a9be['rows']=_0x1b72e8;return _0xc2a9be;})[_0x7ad5('0x22')](respondWithFilteredResult(_0x1eb048,_0x273c40))[_0x7ad5('0x3b')](handleError(_0x1eb048,null));};exports['show']=function(_0x50f31b,_0x3066a5){var _0x361b24={'raw':!![],'where':{'id':_0x50f31b[_0x7ad5('0x3c')]['id']}},_0x5d645b={};_0x5d645b[_0x7ad5('0x29')]=_[_0x7ad5('0x3d')](db[_0x7ad5('0x27')][_0x7ad5('0x28')]);_0x5d645b[_0x7ad5('0x2b')]=_[_0x7ad5('0x3d')](_0x50f31b[_0x7ad5('0x2b')]);_0x5d645b[_0x7ad5('0x34')]=_[_0x7ad5('0x2d')](_0x5d645b[_0x7ad5('0x29')],_0x5d645b[_0x7ad5('0x2b')]);_0x361b24[_0x7ad5('0x2c')]=_[_0x7ad5('0x2d')](_0x5d645b[_0x7ad5('0x29')],qs['fields'](_0x50f31b['query'][_0x7ad5('0x2e')]));_0x361b24[_0x7ad5('0x2c')]=_0x361b24[_0x7ad5('0x2c')][_0x7ad5('0x3e')]?_0x361b24[_0x7ad5('0x2c')]:_0x5d645b[_0x7ad5('0x29')];if(_0x50f31b[_0x7ad5('0x2b')][_0x7ad5('0x39')]){_0x361b24['include']=[{'all':!![]}];}_0x361b24=_[_0x7ad5('0x36')]({},_0x361b24,_0x50f31b[_0x7ad5('0x38')]);return db[_0x7ad5('0x27')][_0x7ad5('0x3f')](_0x361b24)[_0x7ad5('0x22')](handleEntityNotFound(_0x3066a5,null))[_0x7ad5('0x22')](respondWithResult(_0x3066a5,null))[_0x7ad5('0x3b')](handleError(_0x3066a5,null));};exports[_0x7ad5('0x40')]=function(_0x3f4e26,_0x3fd1cf){return db[_0x7ad5('0x27')][_0x7ad5('0x40')](_0x3f4e26[_0x7ad5('0x41')],{})[_0x7ad5('0x22')](respondWithResult(_0x3fd1cf,0xc9))[_0x7ad5('0x3b')](handleError(_0x3fd1cf,null));};exports[_0x7ad5('0x21')]=function(_0x2c4c4f,_0x1d4b57){if(_0x2c4c4f['body']['id']){delete _0x2c4c4f[_0x7ad5('0x41')]['id'];}return db[_0x7ad5('0x27')]['find']({'where':{'id':_0x2c4c4f['params']['id']}})[_0x7ad5('0x22')](handleEntityNotFound(_0x1d4b57,null))[_0x7ad5('0x22')](saveUpdates(_0x2c4c4f[_0x7ad5('0x41')],null))[_0x7ad5('0x22')](respondWithResult(_0x1d4b57,null))[_0x7ad5('0x3b')](handleError(_0x1d4b57,null));};exports[_0x7ad5('0x42')]=function(_0x271f51,_0x1d551d){return db[_0x7ad5('0x27')]['find']({'where':{'id':_0x271f51[_0x7ad5('0x3c')]['id']}})[_0x7ad5('0x22')](handleEntityNotFound(_0x1d551d,null))['then'](removeEntity(_0x1d551d,null))['catch'](handleError(_0x1d551d,null));};exports[_0x7ad5('0x43')]=function(_0x2d39e0,_0x41a8fb){return db[_0x7ad5('0x27')][_0x7ad5('0x43')]()[_0x7ad5('0x22')](respondWithResult(_0x41a8fb,null))[_0x7ad5('0x3b')](handleError(_0x41a8fb,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6ddcc61..9ddef70 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.model.js +++ b/server/api/voiceTransferReport/voiceTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ce5=['../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x5ce5,0x150));var _0x55ce=function(_0x323ce4,_0x13a508){_0x323ce4=_0x323ce4-0x0;var _0x10832f=_0x5ce5[_0x323ce4];return _0x10832f;};'use strict';var _=require(_0x55ce('0x0'));var util=require(_0x55ce('0x1'));var logger=require(_0x55ce('0x2'))(_0x55ce('0x3'));var moment=require(_0x55ce('0x4'));var BPromise=require(_0x55ce('0x5'));var rp=require(_0x55ce('0x6'));var fs=require('fs');var path=require(_0x55ce('0x7'));var rimraf=require(_0x55ce('0x8'));var config=require(_0x55ce('0x9'));var attributes=require(_0x55ce('0xa'));module[_0x55ce('0xb')]=function(_0xa0c9b5,_0x5dedb1){return _0xa0c9b5[_0x55ce('0xc')](_0x55ce('0xd'),attributes,{'tableName':_0x55ce('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x020c=['VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0x020c,0x120));var _0xc020=function(_0x3d7d54,_0xa79219){_0x3d7d54=_0x3d7d54-0x0;var _0x3482de=_0x020c[_0x3d7d54];return _0x3482de;};'use strict';var _=require(_0xc020('0x0'));var util=require('util');var logger=require(_0xc020('0x1'))(_0xc020('0x2'));var moment=require(_0xc020('0x3'));var BPromise=require(_0xc020('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc020('0x5'));var rimraf=require(_0xc020('0x6'));var config=require(_0xc020('0x7'));var attributes=require(_0xc020('0x8'));module[_0xc020('0x9')]=function(_0x38c78d,_0xd561be){return _0x38c78d[_0xc020('0xa')](_0xc020('0xb'),attributes,{'tableName':_0xc020('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index d1e04ee..09545be 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.rpc.js +++ b/server/api/voiceTransferReport/voiceTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9de4=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x24dcc0,_0x13c1c6){var _0x525f29=function(_0x27b476){while(--_0x27b476){_0x24dcc0['push'](_0x24dcc0['shift']());}};_0x525f29(++_0x13c1c6);}(_0x9de4,0x1b6));var _0x49de=function(_0x38bcae,_0x3f0e15){_0x38bcae=_0x38bcae-0x0;var _0xacbb3e=_0x9de4[_0x38bcae];return _0xacbb3e;};'use strict';var _=require(_0x49de('0x0'));var util=require('util');var moment=require(_0x49de('0x1'));var BPromise=require('bluebird');var rs=require(_0x49de('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x49de('0x3'));var logger=require(_0x49de('0x4'))(_0x49de('0x5'));var config=require('../../config/environment');var jayson=require(_0x49de('0x6'));var client=jayson[_0x49de('0x7')][_0x49de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c30dd,_0x4dbc1d,_0x273b5d){return new BPromise(function(_0x4a60f9,_0x3ace5e){return client[_0x49de('0x9')](_0x2c30dd,_0x273b5d)[_0x49de('0xa')](function(_0x5b37df){logger[_0x49de('0xb')](_0x49de('0xc'),_0x4dbc1d,'request\x20sent');logger[_0x49de('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4dbc1d,_0x49de('0xe'),JSON[_0x49de('0xf')](_0x5b37df));if(_0x5b37df[_0x49de('0x10')]){if(_0x5b37df[_0x49de('0x10')]['code']===0x1f4){logger['error'](_0x49de('0xc'),_0x4dbc1d,_0x5b37df['error'][_0x49de('0x11')]);return _0x3ace5e(_0x5b37df[_0x49de('0x10')][_0x49de('0x11')]);}logger[_0x49de('0x10')](_0x49de('0xc'),_0x4dbc1d,_0x5b37df[_0x49de('0x10')][_0x49de('0x11')]);return _0x4a60f9(_0x5b37df[_0x49de('0x10')][_0x49de('0x11')]);}else{logger['info'](_0x49de('0xc'),_0x4dbc1d,'request\x20sent');_0x4a60f9(_0x5b37df[_0x49de('0x12')][_0x49de('0x11')]);}})[_0x49de('0x13')](function(_0x3a3b63){logger[_0x49de('0x10')](_0x49de('0xc'),_0x4dbc1d,_0x3a3b63);_0x3ace5e(_0x3a3b63);});});}exports[_0x49de('0x14')]=function(_0x52f1cf){var _0x1eb938=this;return new Promise(function(_0x75884d,_0x540d29){return db[_0x49de('0x15')]['create'](_0x52f1cf['body'],{'raw':_0x52f1cf[_0x49de('0x16')]?_0x52f1cf[_0x49de('0x16')][_0x49de('0x17')]===undefined?!![]:![]:!![]})[_0x49de('0xa')](function(_0x248cb2){logger[_0x49de('0xb')](_0x49de('0x14'),_0x52f1cf);logger['debug']('CreateVoiceTransferReport',_0x52f1cf,JSON['stringify'](_0x248cb2));_0x75884d(_0x248cb2);})[_0x49de('0x13')](function(_0x385b4d){logger[_0x49de('0x10')](_0x49de('0x14'),_0x385b4d[_0x49de('0x11')],_0x52f1cf);_0x540d29(_0x1eb938[_0x49de('0x10')](0x1f4,_0x385b4d[_0x49de('0x11')]));});});}; \ No newline at end of file +var _0x487e=['../../mysqldb','../../config/utils','rpc','client','http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','util','bluebird','randomstring'];(function(_0x4cc078,_0x3531b4){var _0x323bbc=function(_0x3c418e){while(--_0x3c418e){_0x4cc078['push'](_0x4cc078['shift']());}};_0x323bbc(++_0x3531b4);}(_0x487e,0x105));var _0xe487=function(_0x36b776,_0x311483){_0x36b776=_0x36b776-0x0;var _0x1141d1=_0x487e[_0x36b776];return _0x1141d1;};'use strict';var _=require('lodash');var util=require(_0xe487('0x0'));var moment=require('moment');var BPromise=require(_0xe487('0x1'));var rs=require(_0xe487('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe487('0x3'))['db'];var utils=require(_0xe487('0x4'));var logger=require('../../config/logger')(_0xe487('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe487('0x6')][_0xe487('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x304b86,_0x1d10cd,_0x39fe20){return new BPromise(function(_0x6ac441,_0x953b4a){return client[_0xe487('0x8')](_0x304b86,_0x39fe20)[_0xe487('0x9')](function(_0x1d2918){logger[_0xe487('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x1d10cd,_0xe487('0xb'));logger[_0xe487('0xc')](_0xe487('0xd'),_0x1d10cd,_0xe487('0xb'),JSON['stringify'](_0x1d2918));if(_0x1d2918[_0xe487('0xe')]){if(_0x1d2918[_0xe487('0xe')][_0xe487('0xf')]===0x1f4){logger[_0xe487('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x1d10cd,_0x1d2918[_0xe487('0xe')][_0xe487('0x10')]);return _0x953b4a(_0x1d2918['error'][_0xe487('0x10')]);}logger[_0xe487('0xe')](_0xe487('0x11'),_0x1d10cd,_0x1d2918[_0xe487('0xe')][_0xe487('0x10')]);return _0x6ac441(_0x1d2918['error'][_0xe487('0x10')]);}else{logger[_0xe487('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x1d10cd,'request\x20sent');_0x6ac441(_0x1d2918[_0xe487('0x12')]['message']);}})[_0xe487('0x13')](function(_0x3779e9){logger[_0xe487('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x1d10cd,_0x3779e9);_0x953b4a(_0x3779e9);});});}exports[_0xe487('0x14')]=function(_0x4920f4){var _0x3019d2=this;return new Promise(function(_0x35311b,_0x44ee77){return db[_0xe487('0x15')]['create'](_0x4920f4[_0xe487('0x16')],{'raw':_0x4920f4[_0xe487('0x17')]?_0x4920f4[_0xe487('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xe487('0x9')](function(_0x28e4e7){logger[_0xe487('0xa')](_0xe487('0x14'),_0x4920f4);logger[_0xe487('0xc')](_0xe487('0x14'),_0x4920f4,JSON['stringify'](_0x28e4e7));_0x35311b(_0x28e4e7);})[_0xe487('0x13')](function(_0x44af6e){logger[_0xe487('0xe')]('CreateVoiceTransferReport',_0x44af6e[_0xe487('0x10')],_0x4920f4);_0x44ee77(_0x3019d2['error'](0x1f4,_0x44af6e[_0xe487('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 94e51c7..5454e1e 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0xe5b3e1,_0x57a645){var _0x121dad=function(_0x3aa300){while(--_0x3aa300){_0xe5b3e1['push'](_0xe5b3e1['shift']());}};_0x121dad(++_0x57a645);}(_0x34e8,0x12c));var _0x834e=function(_0x352a6b,_0x2b2d0c){_0x352a6b=_0x352a6b-0x0;var _0x477e87=_0x34e8[_0x352a6b];return _0x477e87;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file +var _0x0bb5=['unhold','/calls','calls','/transfer','exports','express','Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','/unhold'];(function(_0x377a30,_0x4f5f00){var _0x24e452=function(_0x2dd6ab){while(--_0x2dd6ab){_0x377a30['push'](_0x377a30['shift']());}};_0x24e452(++_0x4f5f00);}(_0x0bb5,0x148));var _0x50bb=function(_0x35327d,_0x34107e){_0x35327d=_0x35327d-0x0;var _0x405fd5=_0x0bb5[_0x35327d];return _0x405fd5;};'use strict';var express=require(_0x50bb('0x0'));var router=express[_0x50bb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0x50bb('0x2')](_0x50bb('0x3'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0x6')]);router[_0x50bb('0x2')](_0x50bb('0x7'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller['hangup']);router[_0x50bb('0x2')](_0x50bb('0x8'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['answer']);router['post'](_0x50bb('0x9'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xa')]);router['post'](_0x50bb('0xb'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xc')]);router[_0x50bb('0x2')](_0x50bb('0xd'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller[_0x50bb('0xe')]);router['post'](_0x50bb('0xf'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['transfer']);module[_0x50bb('0x10')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index f9bd3e1..af50fd1 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7341=['answer\x20fired:','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','calls','calls\x20fired:','all','rows','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','status','name','NotFound','request','then','code','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer'];(function(_0x293136,_0x21d7b7){var _0x4b3280=function(_0x2ce198){while(--_0x2ce198){_0x293136['push'](_0x293136['shift']());}};_0x4b3280(++_0x21d7b7);}(_0x7341,0xe4));var _0x1734=function(_0x464d1f,_0x3f8b32){_0x464d1f=_0x464d1f-0x0;var _0x19a2c9=_0x7341[_0x464d1f];return _0x19a2c9;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x1734('0x0'))['db'];var config=require('../../config/environment');var util=require(_0x1734('0x1'));var BPromise=require(_0x1734('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1734('0x3')][_0x1734('0x4')]({'port':0x232a});var logger=require(_0x1734('0x5'))(_0x1734('0x6'));var Redis=require(_0x1734('0x7'));config[_0x1734('0x8')]=_[_0x1734('0x9')](config['redis'],{'host':_0x1734('0xa'),'port':0x18eb});var io=require(_0x1734('0xb'))(new Redis(config[_0x1734('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x1734('0xd')]},'callerId':{'type':_0x1734('0xe')},'callbackUrl':{'type':_0x1734('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x10')]},'transferNumber':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});function emit(_0x3989a6,_0x24bbf3,_0x2b375d){logger[_0x1734('0x12')](_0x3989a6,_0x24bbf3,JSON[_0x1734('0x13')](_0x2b375d));io['to'](_0x3989a6)['emit'](_0x24bbf3,_0x2b375d);}function handleError(_0x5ab895){return function(_0x1fa9c0){console[_0x1734('0x14')]('handleError:',_0x1fa9c0,_0x1fa9c0 instanceof RangeError);logger[_0x1734('0x15')](_0x1fa9c0['stack']);if(_0x1fa9c0 instanceof RangeError){if(_0x1fa9c0['name']){delete _0x1fa9c0['name'];}_0x5ab895[_0x1734('0x16')](0x194)['send'](_0x1fa9c0);}else{if(_0x1fa9c0[_0x1734('0x17')]){delete _0x1fa9c0[_0x1734('0x17')];}_0x5ab895['status'](0x1f4)['send'](_0x1fa9c0);}};}function checkError(){return function(_0x4bd526){if(!_0x4bd526){throw new RangeError(_0x1734('0x18'));}return _0x4bd526;};}function respondWithRpcPromise(_0x53f13d,_0x183f7a){return new BPromise(function(_0x5ad801,_0x215ae4){var _0x42485f=amiClient;return _0x42485f[_0x1734('0x19')](_0x53f13d,_0x183f7a)[_0x1734('0x1a')](function(_0x29bb2c){if(_0x29bb2c[_0x1734('0x15')]){if(_0x29bb2c[_0x1734('0x15')][_0x1734('0x1b')]===0x1f4){return _0x215ae4(_0x29bb2c[_0x1734('0x15')]['message']);}return _0x5ad801(_0x29bb2c[_0x1734('0x15')]['message']);}else{_0x5ad801(_0x29bb2c['result']);}})[_0x1734('0x1c')](function(_0x46b2fa){_0x215ae4(_0x46b2fa);});});}function getAgent(_0x309d3f){return db[_0x1734('0x1d')][_0x1734('0x1e')]({'where':{'id':_0x309d3f,'role':_0x1734('0x1f')}})[_0x1734('0x1a')](checkError());}function getAgentCheckSession(_0x27d6e5,_0x4a670a){return new BPromise(function(_0x381960,_0x52eaf5){var _0x17e068=respondWithRpcPromise(_0x1734('0x20'));var _0xfca2ad=getAgent(_0x27d6e5);Promise['all']([_0x17e068,_0xfca2ad])[_0x1734('0x1a')](function(_0x3f9abe){var _0xf2d136=_0x3f9abe[0x0];var _0x50efce=_0x3f9abe[0x1];var _0x2b1352=_[_0x1734('0x21')](_0xf2d136['rows'],function(_0x1bd659){return _0x1bd659[_0x1734('0x22')]==_0x50efce['id']&&_0x1bd659[_0x1734('0x23')]==_0x4a670a;});if(_0x2b1352[_0x1734('0x24')]==0x1){_0x381960(_0x50efce);}else{_0x52eaf5(new RangeError('sessionId\x20'+_0x4a670a+_0x1734('0x25')));}});});}exports[_0x1734('0x26')]=function(_0x546a94,_0x4dd04a){logger[_0x1734('0x12')](_0x1734('0x27'),_0x546a94[_0x1734('0x28')]);var _0x3903a7=originateValidation[_0x1734('0x29')](_0x546a94[_0x1734('0x28')]);if(_0x3903a7[_0x1734('0x24')]>0x0){return _0x4dd04a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x3903a7);}var _0x2921c8=_0x546a94[_0x1734('0x28')][_0x1734('0x2b')];var _0x18a0c7=_0x546a94[_0x1734('0x28')][_0x1734('0x2c')];var _0x29ccc3=_0x546a94[_0x1734('0x28')]['callerId'];var _0x1e7134=_0x546a94['body'][_0x1734('0x2d')];return getAgent(_0x2921c8)[_0x1734('0x1a')](function(_0x1f8446){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x1f8446[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x1f8446['name']),_0x1734('0x31'),{'callNumber':_0x18a0c7,'callerId':_0x29ccc3,'callbackUrl':_0x1e7134});return _0x4dd04a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x32')});})[_0x1734('0x1c')](handleError(_0x4dd04a));};exports[_0x1734('0x33')]=function(_0x26072f,_0x4db10d){logger[_0x1734('0x12')](_0x1734('0x34'),_0x26072f[_0x1734('0x28')]);var _0x3a9bcd=hangupValidation[_0x1734('0x29')](_0x26072f[_0x1734('0x28')]);if(_0x3a9bcd[_0x1734('0x24')]>0x0){return _0x4db10d[_0x1734('0x16')](0x190)['json'](_0x3a9bcd);}var _0x1f5cc6=_0x26072f['body'][_0x1734('0x2b')];var _0x2d9873=_0x26072f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1f5cc6)[_0x1734('0x1a')](function(_0x169db8){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x169db8[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x169db8['name']),_0x1734('0x35'),{'sessionId':_0x2d9873});return _0x4db10d[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x36')});})['catch'](handleError(_0x4db10d));};exports[_0x1734('0x37')]=function(_0x562be1,_0x539270){logger[_0x1734('0x12')](_0x1734('0x38'),_0x562be1[_0x1734('0x28')]);var _0x71f9c1=answerValidation['validate'](_0x562be1[_0x1734('0x28')]);if(_0x71f9c1[_0x1734('0x24')]>0x0){return _0x539270['status'](0x190)[_0x1734('0x2a')](_0x71f9c1);}var _0x1b104a=_0x562be1['body'][_0x1734('0x2b')];var _0x4bfc67=_0x562be1[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1b104a)[_0x1734('0x1a')](function(_0x400a1f){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x400a1f[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x400a1f[_0x1734('0x17')]),'webbar:answer',{'sessionId':_0x4bfc67});return _0x539270[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x39')});})[_0x1734('0x1c')](handleError(_0x539270));};exports['hold']=function(_0x6f821f,_0x70fd09){logger[_0x1734('0x12')]('hold\x20fired:',_0x6f821f[_0x1734('0x28')]);var _0x245420=holdValidation[_0x1734('0x29')](_0x6f821f[_0x1734('0x28')]);if(_0x245420[_0x1734('0x24')]>0x0){return _0x70fd09[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x245420);}var _0x8bfed7=_0x6f821f[_0x1734('0x28')][_0x1734('0x2b')];var _0x1ef5d6=_0x6f821f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x8bfed7)[_0x1734('0x1a')](function(_0x470110){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x470110[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x470110['name']),_0x1734('0x3a'),{'sessionId':_0x1ef5d6});return _0x70fd09[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x3b')});})['catch'](handleError(_0x70fd09));};exports['unhold']=function(_0x294097,_0xe86f1f){logger['info'](_0x1734('0x3c'),_0x294097[_0x1734('0x28')]);var _0x2a71cf=unholdValidation[_0x1734('0x29')](_0x294097[_0x1734('0x28')]);if(_0x2a71cf[_0x1734('0x24')]>0x0){return _0xe86f1f[_0x1734('0x16')](0x190)['json'](_0x2a71cf);}var _0x141f68=_0x294097[_0x1734('0x28')][_0x1734('0x2b')];var _0x47cd87=_0x294097[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x141f68)[_0x1734('0x1a')](function(_0x441c62){logger['info'](_0x1734('0x2e'),_0x441c62[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x441c62[_0x1734('0x17')]),'webbar:unhold',{'sessionId':_0x47cd87});return _0xe86f1f[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x1734('0x1c')](handleError(_0xe86f1f));};exports[_0x1734('0x3d')]=function(_0x4ae49c,_0x4ff6a9){logger[_0x1734('0x12')](_0x1734('0x3e'),_0x4ff6a9['body']);var _0x515e39=callsValidation['validate'](_0x4ae49c[_0x1734('0x28')]);if(_0x515e39[_0x1734('0x24')]>0x0){return _0x4ff6a9[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x515e39);}var _0x54ef53=_0x4ae49c['body'][_0x1734('0x2b')];var _0x7872f5=respondWithRpcPromise('VoiceChannels');var _0x349b6a=getAgent(_0x54ef53);return Promise[_0x1734('0x3f')]([_0x7872f5,_0x349b6a])[_0x1734('0x1a')](function(_0x553daf){var _0xfcc609=_0x553daf[0x0];var _0x371a48=_0x553daf[0x1];var _0x28c467=_[_0x1734('0x21')](_0xfcc609[_0x1734('0x40')],function(_0x41469e){return _0x41469e[_0x1734('0x22')]==_0x371a48['id'];});return _0x4ff6a9[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'count':_0x28c467['length'],'rows':_0x28c467});})[_0x1734('0x1c')](handleError(_0x4ff6a9));};exports[_0x1734('0x41')]=function(_0x16bea9,_0x3a4d5b){logger[_0x1734('0x12')](_0x1734('0x42'),_0x16bea9[_0x1734('0x28')]);var _0x30848e=conferenceValidation[_0x1734('0x29')](_0x16bea9[_0x1734('0x28')]);if(_0x30848e[_0x1734('0x24')]>0x0){return _0x3a4d5b['status'](0x190)[_0x1734('0x2a')](_0x30848e);}var _0x25f2fd=_0x16bea9[_0x1734('0x28')][_0x1734('0x2b')];return getAgent(_0x25f2fd)[_0x1734('0x1a')](function(_0xa43585){logger[_0x1734('0x12')]('entityFound:',_0xa43585[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0xa43585[_0x1734('0x17')]),_0x1734('0x43'));return _0x3a4d5b[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x1734('0x1c')](handleError(_0x3a4d5b));};exports['transfer']=function(_0x41fdf2,_0xc91e7a){logger[_0x1734('0x12')](_0x1734('0x44'),_0x41fdf2['body']);var _0x586418=transferValidation['validate'](_0x41fdf2[_0x1734('0x28')]);if(_0x586418[_0x1734('0x24')]>0x0){return _0xc91e7a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x586418);}var _0x387aac=_0x41fdf2[_0x1734('0x28')][_0x1734('0x2b')];var _0x2d3a75=_0x41fdf2['body'][_0x1734('0x23')];var _0x4fd501=_0x41fdf2['body'][_0x1734('0x45')];return getAgent(_0x387aac)[_0x1734('0x1a')](function(_0x31ec5b){logger['info'](_0x1734('0x2e'),_0x31ec5b[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x31ec5b[_0x1734('0x17')]),_0x1734('0x46'),{'sessionId':_0x2d3a75,'transferNumber':_0x4fd501});return _0xc91e7a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc91e7a));}; \ No newline at end of file +var _0xf3cd=['webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','VoiceChannels','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','all','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','json'];(function(_0x3e79fb,_0x50655c){var _0x9e738c=function(_0x1da1cb){while(--_0x1da1cb){_0x3e79fb['push'](_0x3e79fb['shift']());}};_0x9e738c(++_0x50655c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x42e8f3,_0x5c8dba){_0x42e8f3=_0x42e8f3-0x0;var _0x47feab=_0xf3cd[_0x42e8f3];return _0x47feab;};'use strict';var path=require(_0xdf3c('0x0'));var fs=require('fs');var _=require(_0xdf3c('0x1'));var db=require(_0xdf3c('0x2'))['db'];var config=require(_0xdf3c('0x3'));var util=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xdf3c('0x6')][_0xdf3c('0x7')]({'port':0x232a});var logger=require(_0xdf3c('0x8'))('webbarapi');var Redis=require(_0xdf3c('0x9'));config[_0xdf3c('0xa')]=_[_0xdf3c('0xb')](config[_0xdf3c('0xa')],{'host':_0xdf3c('0xc'),'port':0x18eb});var io=require(_0xdf3c('0xd'))(new Redis(config['redis']));var Schema=require(_0xdf3c('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xdf3c('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x13')]},'transferNumber':{'type':_0xdf3c('0xf'),'required':[!![],_0xdf3c('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xdf3c('0x12')]},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xdf3c('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':_0xdf3c('0x11'),'required':[!![],_0xdf3c('0x12')]}});function emit(_0x1a7a5a,_0x305ea5,_0x92008b){logger[_0xdf3c('0x15')](_0x1a7a5a,_0x305ea5,JSON[_0xdf3c('0x16')](_0x92008b));io['to'](_0x1a7a5a)['emit'](_0x305ea5,_0x92008b);}function handleError(_0x13b0e6){return function(_0x465e7d){console[_0xdf3c('0x17')](_0xdf3c('0x18'),_0x465e7d,_0x465e7d instanceof RangeError);logger[_0xdf3c('0x19')](_0x465e7d[_0xdf3c('0x1a')]);if(_0x465e7d instanceof RangeError){if(_0x465e7d[_0xdf3c('0x1b')]){delete _0x465e7d[_0xdf3c('0x1b')];}_0x13b0e6[_0xdf3c('0x1c')](0x194)[_0xdf3c('0x1d')](_0x465e7d);}else{if(_0x465e7d[_0xdf3c('0x1b')]){delete _0x465e7d[_0xdf3c('0x1b')];}_0x13b0e6[_0xdf3c('0x1c')](0x1f4)['send'](_0x465e7d);}};}function checkError(){return function(_0x4d620f){if(!_0x4d620f){throw new RangeError(_0xdf3c('0x1e'));}return _0x4d620f;};}function respondWithRpcPromise(_0x583ce4,_0x15776c){return new BPromise(function(_0x40e7ec,_0x36552e){var _0x38b319=amiClient;return _0x38b319[_0xdf3c('0x1f')](_0x583ce4,_0x15776c)[_0xdf3c('0x20')](function(_0x50d8ca){if(_0x50d8ca[_0xdf3c('0x19')]){if(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x21')]===0x1f4){return _0x36552e(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x22')]);}return _0x40e7ec(_0x50d8ca[_0xdf3c('0x19')][_0xdf3c('0x22')]);}else{_0x40e7ec(_0x50d8ca[_0xdf3c('0x23')]);}})[_0xdf3c('0x24')](function(_0x1adee4){_0x36552e(_0x1adee4);});});}function getAgent(_0x4c076c){return db[_0xdf3c('0x25')][_0xdf3c('0x26')]({'where':{'id':_0x4c076c,'role':'agent'}})[_0xdf3c('0x20')](checkError());}function getAgentCheckSession(_0x59659e,_0x4eaced){return new BPromise(function(_0x508be9,_0x14aac9){var _0x186bba=respondWithRpcPromise('VoiceChannels');var _0x5c3b5a=getAgent(_0x59659e);Promise[_0xdf3c('0x27')]([_0x186bba,_0x5c3b5a])[_0xdf3c('0x20')](function(_0xd3cfcb){var _0x1ccdd4=_0xd3cfcb[0x0];var _0x5c98a2=_0xd3cfcb[0x1];var _0x43ce06=_[_0xdf3c('0x28')](_0x1ccdd4['rows'],function(_0x51e0a4){return _0x51e0a4[_0xdf3c('0x29')]==_0x5c98a2['id']&&_0x51e0a4[_0xdf3c('0x2a')]==_0x4eaced;});if(_0x43ce06[_0xdf3c('0x2b')]==0x1){_0x508be9(_0x5c98a2);}else{_0x14aac9(new RangeError('sessionId\x20'+_0x4eaced+_0xdf3c('0x2c')));}});});}exports[_0xdf3c('0x2d')]=function(_0x21e7b8,_0x10099e){logger['info'](_0xdf3c('0x2e'),_0x21e7b8[_0xdf3c('0x2f')]);var _0x522e5f=originateValidation[_0xdf3c('0xe')](_0x21e7b8[_0xdf3c('0x2f')]);if(_0x522e5f[_0xdf3c('0x2b')]>0x0){return _0x10099e[_0xdf3c('0x1c')](0x190)['json'](_0x522e5f);}var _0x33632f=_0x21e7b8[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x3b9ce8=_0x21e7b8['body'][_0xdf3c('0x31')];var _0x3e7a4b=_0x21e7b8['body']['callerId'];var _0x12cc19=_0x21e7b8['body'][_0xdf3c('0x32')];return getAgent(_0x33632f)['then'](function(_0x57faba){logger['info'](_0xdf3c('0x33'),_0x57faba[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x57faba['name']),'webbar:originate',{'callNumber':_0x3b9ce8,'callerId':_0x3e7a4b,'callbackUrl':_0x12cc19});return _0x10099e[_0xdf3c('0x1c')](0xc8)['json']({'error':![],'message':_0xdf3c('0x36')});})[_0xdf3c('0x24')](handleError(_0x10099e));};exports[_0xdf3c('0x37')]=function(_0xcdd731,_0x1004e9){logger[_0xdf3c('0x15')](_0xdf3c('0x38'),_0xcdd731[_0xdf3c('0x2f')]);var _0x398c76=hangupValidation['validate'](_0xcdd731[_0xdf3c('0x2f')]);if(_0x398c76['length']>0x0){return _0x1004e9['status'](0x190)[_0xdf3c('0x39')](_0x398c76);}var _0x47f760=_0xcdd731[_0xdf3c('0x2f')]['userId'];var _0x2a94c3=_0xcdd731[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x47f760)[_0xdf3c('0x20')](function(_0x3098cb){logger[_0xdf3c('0x15')](_0xdf3c('0x33'),_0x3098cb[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x3098cb[_0xdf3c('0x1b')]),_0xdf3c('0x3a'),{'sessionId':_0x2a94c3});return _0x1004e9['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x3b')});})['catch'](handleError(_0x1004e9));};exports[_0xdf3c('0x3c')]=function(_0x14d8e1,_0x46194d){logger[_0xdf3c('0x15')]('answer\x20fired:',_0x14d8e1['body']);var _0x335c1b=answerValidation[_0xdf3c('0xe')](_0x14d8e1[_0xdf3c('0x2f')]);if(_0x335c1b['length']>0x0){return _0x46194d[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x335c1b);}var _0x6fc3b6=_0x14d8e1[_0xdf3c('0x2f')]['userId'];var _0x127685=_0x14d8e1[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x6fc3b6)[_0xdf3c('0x20')](function(_0x2f52c5){logger['info'](_0xdf3c('0x33'),_0x2f52c5[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x2f52c5[_0xdf3c('0x1b')]),_0xdf3c('0x3d'),{'sessionId':_0x127685});return _0x46194d['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x3e')});})[_0xdf3c('0x24')](handleError(_0x46194d));};exports['hold']=function(_0x5c9885,_0x269723){logger[_0xdf3c('0x15')](_0xdf3c('0x3f'),_0x5c9885[_0xdf3c('0x2f')]);var _0xaae4bc=holdValidation[_0xdf3c('0xe')](_0x5c9885[_0xdf3c('0x2f')]);if(_0xaae4bc[_0xdf3c('0x2b')]>0x0){return _0x269723[_0xdf3c('0x1c')](0x190)['json'](_0xaae4bc);}var _0x129c2a=_0x5c9885[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0xe760dd=_0x5c9885[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x129c2a)[_0xdf3c('0x20')](function(_0x553f70){logger[_0xdf3c('0x15')]('entityFound:',_0x553f70[_0xdf3c('0x1b')]);emit(util['format'](_0xdf3c('0x35'),_0x553f70[_0xdf3c('0x1b')]),_0xdf3c('0x40'),{'sessionId':_0xe760dd});return _0x269723[_0xdf3c('0x1c')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x269723));};exports[_0xdf3c('0x41')]=function(_0x5f5726,_0x31c600){logger[_0xdf3c('0x15')](_0xdf3c('0x42'),_0x5f5726[_0xdf3c('0x2f')]);var _0x3b17d9=unholdValidation['validate'](_0x5f5726['body']);if(_0x3b17d9[_0xdf3c('0x2b')]>0x0){return _0x31c600[_0xdf3c('0x1c')](0x190)['json'](_0x3b17d9);}var _0x3b215d=_0x5f5726[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x3fda0a=_0x5f5726[_0xdf3c('0x2f')][_0xdf3c('0x2a')];return getAgent(_0x3b215d)[_0xdf3c('0x20')](function(_0x492396){logger['info'](_0xdf3c('0x33'),_0x492396[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x492396[_0xdf3c('0x1b')]),_0xdf3c('0x43'),{'sessionId':_0x3fda0a});return _0x31c600[_0xdf3c('0x1c')](0xc8)[_0xdf3c('0x39')]({'error':![],'message':_0xdf3c('0x44')});})[_0xdf3c('0x24')](handleError(_0x31c600));};exports[_0xdf3c('0x45')]=function(_0x4cb28f,_0x1eebcf){logger['info']('calls\x20fired:',_0x1eebcf['body']);var _0x58fcbf=callsValidation['validate'](_0x4cb28f[_0xdf3c('0x2f')]);if(_0x58fcbf[_0xdf3c('0x2b')]>0x0){return _0x1eebcf['status'](0x190)[_0xdf3c('0x39')](_0x58fcbf);}var _0x32427e=_0x4cb28f['body'][_0xdf3c('0x30')];var _0x28f935=respondWithRpcPromise(_0xdf3c('0x46'));var _0x1389e0=getAgent(_0x32427e);return Promise[_0xdf3c('0x27')]([_0x28f935,_0x1389e0])[_0xdf3c('0x20')](function(_0xb54629){var _0xdc859=_0xb54629[0x0];var _0x42efa2=_0xb54629[0x1];var _0xa05518=_[_0xdf3c('0x28')](_0xdc859['rows'],function(_0x1ed898){return _0x1ed898[_0xdf3c('0x29')]==_0x42efa2['id'];});return _0x1eebcf[_0xdf3c('0x1c')](0xc8)['json']({'count':_0xa05518[_0xdf3c('0x2b')],'rows':_0xa05518});})[_0xdf3c('0x24')](handleError(_0x1eebcf));};exports[_0xdf3c('0x47')]=function(_0x552264,_0x1effdb){logger[_0xdf3c('0x15')]('conference\x20fired:',_0x552264[_0xdf3c('0x2f')]);var _0x4f8fd6=conferenceValidation[_0xdf3c('0xe')](_0x552264[_0xdf3c('0x2f')]);if(_0x4f8fd6[_0xdf3c('0x2b')]>0x0){return _0x1effdb[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x4f8fd6);}var _0x30e6e1=_0x552264[_0xdf3c('0x2f')][_0xdf3c('0x30')];return getAgent(_0x30e6e1)[_0xdf3c('0x20')](function(_0x330730){logger[_0xdf3c('0x15')](_0xdf3c('0x33'),_0x330730[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x330730[_0xdf3c('0x1b')]),_0xdf3c('0x48'));return _0x1effdb['status'](0xc8)['json']({'error':![],'message':_0xdf3c('0x49')});})[_0xdf3c('0x24')](handleError(_0x1effdb));};exports[_0xdf3c('0x4a')]=function(_0x596282,_0x164e0a){logger['info']('transfer\x20fired:',_0x596282[_0xdf3c('0x2f')]);var _0x399db6=transferValidation[_0xdf3c('0xe')](_0x596282[_0xdf3c('0x2f')]);if(_0x399db6[_0xdf3c('0x2b')]>0x0){return _0x164e0a[_0xdf3c('0x1c')](0x190)[_0xdf3c('0x39')](_0x399db6);}var _0x3ec03a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x30')];var _0x1cce9a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x2a')];var _0x4be79a=_0x596282[_0xdf3c('0x2f')][_0xdf3c('0x4b')];return getAgent(_0x3ec03a)[_0xdf3c('0x20')](function(_0x16d6ea){logger[_0xdf3c('0x15')]('entityFound:',_0x16d6ea[_0xdf3c('0x1b')]);emit(util[_0xdf3c('0x34')](_0xdf3c('0x35'),_0x16d6ea[_0xdf3c('0x1b')]),_0xdf3c('0x4c'),{'sessionId':_0x1cce9a,'transferNumber':_0x4be79a});return _0x164e0a[_0xdf3c('0x1c')](0xc8)[_0xdf3c('0x39')]({'error':![],'message':_0xdf3c('0x4d')});})[_0xdf3c('0x24')](handleError(_0x164e0a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 9b02add..1eff334 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6654=['/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','create','post','addDisposition','/:id/users','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xda65fa,_0x175bdc){var _0x479dd1=function(_0x2a9c8b){while(--_0x2a9c8b){_0xda65fa['push'](_0xda65fa['shift']());}};_0x479dd1(++_0x175bdc);}(_0x6654,0xca));var _0x4665=function(_0x3e0736,_0x7967bb){_0x3e0736=_0x3e0736-0x0;var _0x5310b9=_0x6654[_0x3e0736];return _0x5310b9;};'use strict';var multer=require(_0x4665('0x0'));var util=require('util');var path=require(_0x4665('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4665('0x2')]();var fs_extra=require(_0x4665('0x3'));var auth=require(_0x4665('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4665('0x5'));var controller=require(_0x4665('0x6'));router[_0x4665('0x7')]('/',auth[_0x4665('0x8')](),controller[_0x4665('0x9')]);router[_0x4665('0x7')](_0x4665('0xa'),auth['isAuthenticated'](),controller[_0x4665('0xb')]);router['get'](_0x4665('0xc'),auth[_0x4665('0x8')](),controller[_0x4665('0xd')]);router[_0x4665('0x7')](_0x4665('0xe'),auth[_0x4665('0x8')](),controller['getDispositions']);router[_0x4665('0x7')](_0x4665('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4665('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x4665('0x10')]);router[_0x4665('0x7')](_0x4665('0x11'),auth[_0x4665('0x8')](),controller[_0x4665('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4665('0x13')]);router[_0x4665('0x14')](_0x4665('0xe'),auth[_0x4665('0x8')](),controller[_0x4665('0x15')]);router[_0x4665('0x14')](_0x4665('0xf'),auth[_0x4665('0x8')](),controller['addAnswer']);router['post'](_0x4665('0x16'),auth[_0x4665('0x8')](),controller['addAgents']);router['post'](_0x4665('0x11'),auth[_0x4665('0x8')](),controller[_0x4665('0x17')]);router[_0x4665('0x14')](_0x4665('0x18'),controller[_0x4665('0x19')]);router[_0x4665('0x14')](_0x4665('0x1a'),auth['isAuthenticated'](),controller[_0x4665('0x1b')]);router[_0x4665('0x1c')](_0x4665('0xc'),auth[_0x4665('0x8')](),controller[_0x4665('0x1d')]);router[_0x4665('0x1e')](_0x4665('0xc'),auth[_0x4665('0x8')](),controller[_0x4665('0x1f')]);router[_0x4665('0x1e')](_0x4665('0xe'),auth[_0x4665('0x8')](),controller[_0x4665('0x20')]);router[_0x4665('0x1e')](_0x4665('0xf'),auth['isAuthenticated'](),controller[_0x4665('0x21')]);router[_0x4665('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0x4665('0x22')]);module[_0x4665('0x23')]=router; \ No newline at end of file +var _0xe551=['isAuthenticated','index','get','describe','/:id','show','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addApplications','notify','/:id/send','put','destroy','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller'];(function(_0x1f26fe,_0x303301){var _0x3e2990=function(_0x4ba3ac){while(--_0x4ba3ac){_0x1f26fe['push'](_0x1f26fe['shift']());}};_0x3e2990(++_0x303301);}(_0xe551,0x83));var _0x1e55=function(_0x65379b,_0x4db89f){_0x65379b=_0x65379b-0x0;var _0x2b5b20=_0xe551[_0x65379b];return _0x2b5b20;};'use strict';var multer=require('multer');var util=require(_0x1e55('0x0'));var path=require(_0x1e55('0x1'));var timeout=require(_0x1e55('0x2'));var express=require(_0x1e55('0x3'));var router=express['Router']();var fs_extra=require(_0x1e55('0x4'));var auth=require(_0x1e55('0x5'));var interaction=require(_0x1e55('0x6'));var config=require(_0x1e55('0x7'));var controller=require(_0x1e55('0x8'));router['get']('/',auth[_0x1e55('0x9')](),controller[_0x1e55('0xa')]);router[_0x1e55('0xb')]('/describe',auth[_0x1e55('0x9')](),controller[_0x1e55('0xc')]);router['get'](_0x1e55('0xd'),auth['isAuthenticated'](),controller[_0x1e55('0xe')]);router[_0x1e55('0xb')]('/:id/dispositions',auth[_0x1e55('0x9')](),controller['getDispositions']);router['get'](_0x1e55('0xf'),auth[_0x1e55('0x9')](),controller[_0x1e55('0x10')]);router[_0x1e55('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0x1e55('0x11')]);router[_0x1e55('0xb')](_0x1e55('0x12'),auth['isAuthenticated'](),controller[_0x1e55('0x13')]);router[_0x1e55('0x14')]('/',auth[_0x1e55('0x9')](),controller[_0x1e55('0x15')]);router[_0x1e55('0x14')]('/:id/dispositions',auth[_0x1e55('0x9')](),controller[_0x1e55('0x16')]);router[_0x1e55('0x14')](_0x1e55('0xf'),auth['isAuthenticated'](),controller[_0x1e55('0x17')]);router[_0x1e55('0x14')](_0x1e55('0x18'),auth[_0x1e55('0x9')](),controller['addAgents']);router['post'](_0x1e55('0x12'),auth['isAuthenticated'](),controller[_0x1e55('0x19')]);router[_0x1e55('0x14')]('/:id/notify',controller[_0x1e55('0x1a')]);router[_0x1e55('0x14')](_0x1e55('0x1b'),auth['isAuthenticated'](),controller['send']);router[_0x1e55('0x1c')](_0x1e55('0xd'),auth[_0x1e55('0x9')](),controller['update']);router['delete'](_0x1e55('0xd'),auth['isAuthenticated'](),controller[_0x1e55('0x1d')]);router[_0x1e55('0x1e')](_0x1e55('0x1f'),auth['isAuthenticated'](),controller[_0x1e55('0x20')]);router[_0x1e55('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1e55('0x21')]);router[_0x1e55('0x1e')](_0x1e55('0x18'),auth['isAuthenticated'](),controller[_0x1e55('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 3a9ba28..954bc87 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e2e=['ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate'];(function(_0x18f693,_0x130321){var _0x34f115=function(_0x188170){while(--_0x188170){_0x18f693['push'](_0x18f693['shift']());}};_0x34f115(++_0x130321);}(_0x4e2e,0x193));var _0xe4e2=function(_0x12bf16,_0x33f0c1){_0x12bf16=_0x12bf16-0x0;var _0x2f6628=_0x4e2e[_0x12bf16];return _0x2f6628;};'use strict';var Sequelize=require(_0xe4e2('0x0'));var rs=require(_0xe4e2('0x1'));module[_0xe4e2('0x2')]={'name':{'type':Sequelize[_0xe4e2('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xe4e2('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xe4e2('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe4e2('0x3')],'defaultValue':function(){return rs[_0xe4e2('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe4e2('0x5')](_0xe4e2('0x6'),_0xe4e2('0x7'))},'accountSid':{'type':Sequelize[_0xe4e2('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe4e2('0x8')],'defaultValue':function(){return _0xe4e2('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe4e2('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe4e2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe4e2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe4e2('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe4e2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe4e2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe4e2('0xb')],'comment':_0xe4e2('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xe4e2('0xa')],'defaultValue':![],'comment':_0xe4e2('0xd'),'set':function(_0x1c05de){if(!_0x1c05de){this[_0xe4e2('0xe')](_0xe4e2('0xf'),null);}this[_0xe4e2('0xe')](_0xe4e2('0x10'),_0x1c05de);}},'description':{'type':Sequelize[_0xe4e2('0x3')]}}; \ No newline at end of file +var _0x4817=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','name','STRING','generate','ENUM','twilio','TEXT','BOOLEAN'];(function(_0x820bf2,_0x5c6e3a){var _0x2962c1=function(_0x1938fb){while(--_0x1938fb){_0x820bf2['push'](_0x820bf2['shift']());}};_0x2962c1(++_0x5c6e3a);}(_0x4817,0x11e));var _0x7481=function(_0x375a1f,_0x2e8795){_0x375a1f=_0x375a1f-0x0;var _0xd3f0c9=_0x4817[_0x375a1f];return _0xd3f0c9;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x7481('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7481('0x1'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x7481('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x7481('0x2')],'defaultValue':function(){return rs[_0x7481('0x3')]();}},'phone':{'type':Sequelize[_0x7481('0x2')]},'type':{'type':Sequelize[_0x7481('0x4')](_0x7481('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0x7481('0x2')]},'baseUrl':{'type':Sequelize[_0x7481('0x2')]},'authToken':{'type':Sequelize[_0x7481('0x2')]},'notificationTemplate':{'type':Sequelize[_0x7481('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7481('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7481('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7481('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7481('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7481('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7481('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7481('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7481('0x8')],'comment':_0x7481('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7481('0x7')],'defaultValue':![],'comment':_0x7481('0xa'),'set':function(_0x5cb6c9){if(!_0x5cb6c9){this[_0x7481('0xb')](_0x7481('0xc'),null);}this[_0x7481('0xb')](_0x7481('0xd'),_0x5cb6c9);}},'description':{'type':Sequelize[_0x7481('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index ae36462..705652a 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56bd=['isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','WhatsappInteraction','created','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','interaction','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','out','dataValues','Messages','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','keys','options','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','WhatsappAccounts','UserProfileSection','userProfileId','body','addDisposition','WhatsappAccountId','Disposition','findOne','include','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x56bd,0xe9));var _0xd56b=function(_0x3da10e,_0x3527d4){_0x3da10e=_0x3da10e-0x0;var _0x3b5ad7=_0x56bd[_0x3da10e];return _0x3b5ad7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd56b('0x0'));var zipdir=require(_0xd56b('0x1'));var jsonpatch=require(_0xd56b('0x2'));var rp=require('request-promise');var moment=require(_0xd56b('0x3'));var BPromise=require(_0xd56b('0x4'));var Mustache=require(_0xd56b('0x5'));var util=require(_0xd56b('0x6'));var path=require('path');var sox=require(_0xd56b('0x7'));var csv=require(_0xd56b('0x8'));var ejs=require(_0xd56b('0x9'));var fs=require('fs');var fs_extra=require(_0xd56b('0xa'));var _=require(_0xd56b('0xb'));var squel=require(_0xd56b('0xc'));var crypto=require(_0xd56b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd56b('0xe'));var toCsv=require(_0xd56b('0x8'));var querystring=require(_0xd56b('0xf'));var Papa=require(_0xd56b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd56b('0x11'));var as=require(_0xd56b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd56b('0x13'))(_0xd56b('0x14'));var utils=require(_0xd56b('0x15'));var config=require(_0xd56b('0x16'));var licenseUtil=require(_0xd56b('0x17'));var db=require(_0xd56b('0x18'))['db'];config[_0xd56b('0x19')]=_[_0xd56b('0x1a')](config[_0xd56b('0x19')],{'host':_0xd56b('0x1b'),'port':0x18eb});var socket=require(_0xd56b('0x1c'))(new Redis(config[_0xd56b('0x19')]));require(_0xd56b('0x1d'))[_0xd56b('0x1e')](socket);var jayson=require(_0xd56b('0x1f'));var client=jayson['client'][_0xd56b('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x5a2886,_0x174413,_0x27aeee,_0x3f8775){return new BPromise(function(_0x1dbdc6,_0x209442){var _0x472e7e=_0x3f8775||client;return _0x472e7e[_0xd56b('0x21')](_0x5a2886,_0x27aeee)[_0xd56b('0x22')](function(_0x3f1f40){logger[_0xd56b('0x23')](_0xd56b('0x24'),_0x174413,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x174413,_0xd56b('0x25'),JSON[_0xd56b('0x26')](_0x3f1f40));if(_0x3f1f40[_0xd56b('0x27')]){if(_0x3f1f40[_0xd56b('0x27')][_0xd56b('0x28')]===0x1f4){logger[_0xd56b('0x27')](_0xd56b('0x24'),_0x174413,_0x3f1f40['error'][_0xd56b('0x29')]);return _0x209442(_0x3f1f40[_0xd56b('0x27')][_0xd56b('0x29')]);}logger[_0xd56b('0x27')](_0xd56b('0x24'),_0x174413,_0x3f1f40[_0xd56b('0x27')]['message']);return _0x1dbdc6(_0x3f1f40['error'][_0xd56b('0x29')]);}else{logger[_0xd56b('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x174413,_0xd56b('0x25'));_0x1dbdc6(_0x3f1f40['result'][_0xd56b('0x29')]);}})['catch'](function(_0xc9027d){logger[_0xd56b('0x27')](_0xd56b('0x24'),_0x174413,_0xc9027d);_0x209442(_0xc9027d);});});}function respondWithStatusCode(_0x5ab429,_0x42e907){_0x42e907=_0x42e907||0xcc;return function(_0x1a2f0c){if(_0x1a2f0c){return _0x5ab429[_0xd56b('0x2a')](_0x42e907);}return _0x5ab429[_0xd56b('0x2b')](_0x42e907)[_0xd56b('0x2c')]();};}function respondWithResult(_0x446c8a,_0x3c9730){_0x3c9730=_0x3c9730||0xc8;return function(_0x5c0f33){if(_0x5c0f33){return _0x446c8a['status'](_0x3c9730)[_0xd56b('0x2d')](_0x5c0f33);}};}function respondWithFilteredResult(_0x4393a9,_0x241e95){return function(_0x171ca5){if(_0x171ca5){var _0x45a45d=typeof _0x241e95[_0xd56b('0x2e')]===_0xd56b('0x2f')&&typeof _0x241e95[_0xd56b('0x30')]===_0xd56b('0x2f');var _0x65fb97=_0x171ca5[_0xd56b('0x31')];var _0x8737b4=_0x45a45d?0x0:_0x241e95['offset'];var _0x59674a=_0x45a45d?_0x171ca5[_0xd56b('0x31')]:_0x241e95['offset']+_0x241e95['limit'];var _0x3d18b6;if(_0x59674a>=_0x65fb97){_0x59674a=_0x65fb97;_0x3d18b6=0xc8;}else{_0x3d18b6=0xce;}_0x4393a9[_0xd56b('0x2b')](_0x3d18b6);return _0x4393a9[_0xd56b('0x32')](_0xd56b('0x33'),_0x8737b4+'-'+_0x59674a+'/'+_0x65fb97)[_0xd56b('0x2d')](_0x171ca5);}return null;};}function patchUpdates(_0x3d9d62){return function(_0x13900e){try{jsonpatch[_0xd56b('0x34')](_0x13900e,_0x3d9d62,!![]);}catch(_0x53f4d3){return BPromise[_0xd56b('0x35')](_0x53f4d3);}return _0x13900e['save']();};}function saveUpdates(_0x1b30aa,_0x333102){return function(_0x38c3a4){if(_0x38c3a4){return _0x38c3a4[_0xd56b('0x36')](_0x1b30aa)[_0xd56b('0x22')](function(_0x4d8815){return _0x4d8815;});}return null;};}function removeEntity(_0xa84b74,_0x311182){return function(_0x59cd61){if(_0x59cd61){return _0x59cd61[_0xd56b('0x37')]()[_0xd56b('0x22')](function(){var _0x56be53=_0x59cd61['get']({'plain':!![]});var _0x308ff5='WhatsappAccounts';return db[_0xd56b('0x38')][_0xd56b('0x37')]({'where':{'type':_0x308ff5,'resourceId':_0x56be53['id']}})[_0xd56b('0x22')](function(){return _0x59cd61;});})[_0xd56b('0x22')](function(){_0xa84b74[_0xd56b('0x2b')](0xcc)[_0xd56b('0x2c')]();});}};}function handleEntityNotFound(_0x4b6c00,_0xfc0c9d){return function(_0x3a142f){if(!_0x3a142f){_0x4b6c00['sendStatus'](0x194);}return _0x3a142f;};}function handleError(_0x150d00,_0x8d3d6b){_0x8d3d6b=_0x8d3d6b||0x1f4;return function(_0x2106e6){logger[_0xd56b('0x27')](_0x2106e6[_0xd56b('0x39')]);if(_0x2106e6[_0xd56b('0x3a')]){delete _0x2106e6[_0xd56b('0x3a')];}_0x150d00['status'](_0x8d3d6b)[_0xd56b('0x3b')](_0x2106e6);};}exports[_0xd56b('0x3c')]=function(_0x332e38,_0x45a9ae){var _0x5d0102={'include':[{'model':db[_0xd56b('0x3d')],'as':_0xd56b('0x3e')}]},_0x179bb8={},_0x10f4dc={'count':0x0,'rows':[]};var _0x626006=_[_0xd56b('0x3f')](db[_0xd56b('0x40')][_0xd56b('0x41')],function(_0x436c9e){return{'name':_0x436c9e[_0xd56b('0x42')],'type':_0x436c9e[_0xd56b('0x43')][_0xd56b('0x44')]};});_0x179bb8[_0xd56b('0x45')]=_[_0xd56b('0x3f')](_0x626006,_0xd56b('0x3a'));_0x179bb8[_0xd56b('0x46')]=_['keys'](_0x332e38['query']);_0x179bb8[_0xd56b('0x47')]=_[_0xd56b('0x48')](_0x179bb8[_0xd56b('0x45')],_0x179bb8['query']);_0x5d0102[_0xd56b('0x49')]=_['intersection'](_0x179bb8[_0xd56b('0x45')],qs[_0xd56b('0x4a')](_0x332e38[_0xd56b('0x46')][_0xd56b('0x4a')]));_0x5d0102[_0xd56b('0x49')]=_0x5d0102['attributes'][_0xd56b('0x4b')]?_0x5d0102['attributes']:_0x179bb8[_0xd56b('0x45')];if(!_0x332e38[_0xd56b('0x46')][_0xd56b('0x4c')](_0xd56b('0x4d'))){_0x5d0102[_0xd56b('0x30')]=qs['limit'](_0x332e38[_0xd56b('0x46')][_0xd56b('0x30')]);_0x5d0102['offset']=qs[_0xd56b('0x2e')](_0x332e38[_0xd56b('0x46')]['offset']);}_0x5d0102[_0xd56b('0x4e')]=qs[_0xd56b('0x4f')](_0x332e38[_0xd56b('0x46')][_0xd56b('0x4f')]);_0x5d0102[_0xd56b('0x50')]=qs[_0xd56b('0x47')](_[_0xd56b('0x51')](_0x332e38[_0xd56b('0x46')],_0x179bb8[_0xd56b('0x47')]),_0x626006);if(_0x332e38['query'][_0xd56b('0x52')]){_0x5d0102[_0xd56b('0x50')]=_[_0xd56b('0x53')](_0x5d0102['where'],{'$or':_[_0xd56b('0x3f')](_0x626006,function(_0x5a3f62){if(_0x5a3f62['type']!==_0xd56b('0x54')){var _0x1f1cfd={};_0x1f1cfd[_0x5a3f62[_0xd56b('0x3a')]]={'$like':'%'+_0x332e38[_0xd56b('0x46')][_0xd56b('0x52')]+'%'};return _0x1f1cfd;}})});}_0x5d0102=_[_0xd56b('0x53')]({},_0x5d0102,_0x332e38['options']);var _0x3e587a={'where':_0x5d0102[_0xd56b('0x50')]};return db[_0xd56b('0x40')]['count'](_0x3e587a)[_0xd56b('0x22')](function(_0xdd906b){_0x10f4dc[_0xd56b('0x31')]=_0xdd906b;if(_0x332e38[_0xd56b('0x46')][_0xd56b('0x55')]){_0x5d0102['include']=[{'all':!![]}];}return db[_0xd56b('0x40')][_0xd56b('0x56')](_0x5d0102);})[_0xd56b('0x22')](function(_0x26ab10){_0x10f4dc[_0xd56b('0x57')]=_0x26ab10;return _0x10f4dc;})[_0xd56b('0x22')](respondWithFilteredResult(_0x45a9ae,_0x5d0102))['catch'](handleError(_0x45a9ae,null));};exports[_0xd56b('0x58')]=function(_0x3dd378,_0x2e7b29){var _0x4b31e6={'raw':![],'where':{'id':_0x3dd378[_0xd56b('0x59')]['id']},'include':[{'model':db[_0xd56b('0x3d')],'as':_0xd56b('0x3e')}]},_0x34dc97={};_0x34dc97[_0xd56b('0x45')]=_[_0xd56b('0x5a')](db[_0xd56b('0x40')][_0xd56b('0x41')]);_0x34dc97[_0xd56b('0x46')]=_['keys'](_0x3dd378[_0xd56b('0x46')]);_0x34dc97[_0xd56b('0x47')]=_['intersection'](_0x34dc97[_0xd56b('0x45')],_0x34dc97[_0xd56b('0x46')]);_0x4b31e6['attributes']=_[_0xd56b('0x48')](_0x34dc97['model'],qs[_0xd56b('0x4a')](_0x3dd378[_0xd56b('0x46')]['fields']));_0x4b31e6[_0xd56b('0x49')]=_0x4b31e6['attributes'][_0xd56b('0x4b')]?_0x4b31e6['attributes']:_0x34dc97['model'];if(_0x3dd378[_0xd56b('0x46')][_0xd56b('0x55')]){_0x4b31e6['include']=[{'all':!![]}];}_0x4b31e6=_[_0xd56b('0x53')]({},_0x4b31e6,_0x3dd378[_0xd56b('0x5b')]);return db['WhatsappAccount'][_0xd56b('0x5c')](_0x4b31e6)[_0xd56b('0x22')](handleEntityNotFound(_0x2e7b29,null))['then'](respondWithResult(_0x2e7b29,null))[_0xd56b('0x5d')](handleError(_0x2e7b29,null));};exports[_0xd56b('0x5e')]=function(_0x44a165,_0x162a58){return db['WhatsappAccount'][_0xd56b('0x5e')](_0x44a165['body'],{})[_0xd56b('0x22')](function(_0xcee0b9){var _0x484a5b=_0x44a165['user'][_0xd56b('0x5f')]({'plain':!![]});if(!_0x484a5b)throw new Error(_0xd56b('0x60'));if(_0x484a5b['role']===_0xd56b('0x61')){var _0x1e5250=_0xcee0b9['get']({'plain':!![]});var _0x3e6341=_0xd56b('0x62');return db[_0xd56b('0x63')][_0xd56b('0x5c')]({'where':{'name':_0x3e6341,'userProfileId':_0x484a5b[_0xd56b('0x64')]},'raw':!![]})[_0xd56b('0x22')](function(_0x5db063){if(_0x5db063&&_0x5db063['autoAssociation']===0x0){return db[_0xd56b('0x38')][_0xd56b('0x5e')]({'name':_0x1e5250[_0xd56b('0x3a')],'resourceId':_0x1e5250['id'],'type':_0x5db063[_0xd56b('0x3a')],'sectionId':_0x5db063['id']},{})[_0xd56b('0x22')](function(){return _0xcee0b9;});}else{return _0xcee0b9;}})[_0xd56b('0x5d')](function(_0x35df51){logger[_0xd56b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35df51);throw _0x35df51;});}return _0xcee0b9;})[_0xd56b('0x22')](respondWithResult(_0x162a58,0xc9))[_0xd56b('0x5d')](handleError(_0x162a58,null));};exports['update']=function(_0x2c1b7b,_0x3f993f){if(_0x2c1b7b[_0xd56b('0x65')]['id']){delete _0x2c1b7b[_0xd56b('0x65')]['id'];}return db[_0xd56b('0x40')]['find']({'where':{'id':_0x2c1b7b[_0xd56b('0x59')]['id']},'include':[{'model':db[_0xd56b('0x3d')],'as':_0xd56b('0x3e')}]})['then'](handleEntityNotFound(_0x3f993f,null))['then'](saveUpdates(_0x2c1b7b[_0xd56b('0x65')],null))['then'](respondWithResult(_0x3f993f,null))[_0xd56b('0x5d')](handleError(_0x3f993f,null));};exports[_0xd56b('0x37')]=function(_0x5c0b21,_0x2474e7){return db['WhatsappAccount']['find']({'where':{'id':_0x5c0b21[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x2474e7,null))[_0xd56b('0x22')](removeEntity(_0x2474e7,null))[_0xd56b('0x5d')](handleError(_0x2474e7,null));};exports['describe']=function(_0x10090b,_0x247a68){return db[_0xd56b('0x40')]['describe']()[_0xd56b('0x22')](respondWithResult(_0x247a68,null))[_0xd56b('0x5d')](handleError(_0x247a68,null));};exports[_0xd56b('0x66')]=function(_0xbb4694,_0x586a80,_0x2ee422){if(_0xbb4694['body']['id']){delete _0xbb4694[_0xd56b('0x65')]['id'];}return db[_0xd56b('0x40')][_0xd56b('0x5c')]({'where':{'id':_0xbb4694['params']['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x586a80,null))[_0xd56b('0x22')](function(_0x47b4d7){if(_0x47b4d7){_0xbb4694['body'][_0xd56b('0x67')]=_0x47b4d7['id'];return db[_0xd56b('0x68')][_0xd56b('0x5e')](_0xbb4694[_0xd56b('0x65')]);}})[_0xd56b('0x22')](respondWithResult(_0x586a80,null))['catch'](handleError(_0x586a80,null));};exports['getDispositions']=function(_0x28bbd0,_0xebcc21,_0x42b032){var _0x36d1b8={'raw':![],'where':{}};var _0x5e6edc={};var _0x5954b1={'count':0x0,'rows':[]};return db[_0xd56b('0x40')][_0xd56b('0x69')]({'where':{'id':_0x28bbd0[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0xebcc21,null))[_0xd56b('0x22')](function(_0x47a6ee){if(_0x47a6ee){_0x5e6edc[_0xd56b('0x45')]=_[_0xd56b('0x5a')](db[_0xd56b('0x68')]['rawAttributes']);_0x5e6edc[_0xd56b('0x46')]=_['keys'](_0x28bbd0['query']);_0x5e6edc[_0xd56b('0x47')]=_[_0xd56b('0x48')](_0x5e6edc[_0xd56b('0x45')],_0x5e6edc[_0xd56b('0x46')]);_0x36d1b8[_0xd56b('0x49')]=_[_0xd56b('0x48')](_0x5e6edc['model'],qs[_0xd56b('0x4a')](_0x28bbd0['query'][_0xd56b('0x4a')]));_0x36d1b8['attributes']=_0x36d1b8['attributes'][_0xd56b('0x4b')]?_0x36d1b8[_0xd56b('0x49')]:_0x5e6edc[_0xd56b('0x45')];if(!_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x4c')]('nolimit')){_0x36d1b8[_0xd56b('0x30')]=qs[_0xd56b('0x30')](_0x28bbd0[_0xd56b('0x46')]['limit']);_0x36d1b8[_0xd56b('0x2e')]=qs['offset'](_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x2e')]);}_0x36d1b8[_0xd56b('0x4e')]=qs[_0xd56b('0x4f')](_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x4f')]);_0x36d1b8['where']=qs[_0xd56b('0x47')](_[_0xd56b('0x51')](_0x28bbd0['query'],_0x5e6edc[_0xd56b('0x47')]));_0x36d1b8[_0xd56b('0x50')][_0xd56b('0x67')]=_0x47a6ee['id'];if(_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x52')]){_0x36d1b8[_0xd56b('0x50')]=_['merge'](_0x36d1b8['where'],{'$or':_[_0xd56b('0x3f')](_0x36d1b8[_0xd56b('0x49')],function(_0x3a10f7){var _0x3e9b66={};_0x3e9b66[_0x3a10f7]={'$like':'%'+_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x52')]+'%'};return _0x3e9b66;})});}_0x36d1b8=_['merge']({},_0x36d1b8,_0x28bbd0['options']);return db[_0xd56b('0x68')]['count']({'where':_0x36d1b8['where']})[_0xd56b('0x22')](function(_0x3b9c38){_0x5954b1['count']=_0x3b9c38;if(_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x55')]){_0x36d1b8[_0xd56b('0x6a')]=[{'all':!![]}];}return db[_0xd56b('0x68')]['findAll'](_0x36d1b8);})[_0xd56b('0x22')](function(_0x406898){_0x5954b1[_0xd56b('0x57')]=_0x406898;return _0x5954b1;});}})[_0xd56b('0x22')](respondWithFilteredResult(_0xebcc21,_0x36d1b8))[_0xd56b('0x5d')](handleError(_0xebcc21,null));};exports[_0xd56b('0x6b')]=function(_0x1e8e05,_0x2b7080,_0x99f53b){return db[_0xd56b('0x40')][_0xd56b('0x5c')]({'where':{'id':_0x1e8e05[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x2b7080,null))['then'](function(_0x13662e){if(_0x13662e){return _0x13662e[_0xd56b('0x6b')](_0x1e8e05[_0xd56b('0x46')][_0xd56b('0x6c')]);}})[_0xd56b('0x22')](respondWithStatusCode(_0x2b7080,null))[_0xd56b('0x5d')](handleError(_0x2b7080,null));};exports['addAnswer']=function(_0x13cec3,_0x10bc95,_0x3c945c){if(_0x13cec3[_0xd56b('0x65')]['id']){delete _0x13cec3[_0xd56b('0x65')]['id'];}return db['WhatsappAccount'][_0xd56b('0x5c')]({'where':{'id':_0x13cec3[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x10bc95,null))['then'](function(_0x95bc15){if(_0x95bc15){_0x13cec3['body'][_0xd56b('0x67')]=_0x95bc15['id'];return db[_0xd56b('0x6d')][_0xd56b('0x5e')](_0x13cec3['body']);}})[_0xd56b('0x22')](respondWithResult(_0x10bc95,null))['catch'](handleError(_0x10bc95,null));};exports[_0xd56b('0x6e')]=function(_0x1ca320,_0x5ea669,_0x2f5415){var _0x416eed={'raw':![],'where':{}};var _0x540e64={};var _0x1af619={'count':0x0,'rows':[]};return db[_0xd56b('0x40')][_0xd56b('0x69')]({'where':{'id':_0x1ca320[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x5ea669,null))['then'](function(_0x11ac1a){if(_0x11ac1a){_0x540e64['model']=_[_0xd56b('0x5a')](db[_0xd56b('0x6d')][_0xd56b('0x41')]);_0x540e64['query']=_[_0xd56b('0x5a')](_0x1ca320[_0xd56b('0x46')]);_0x540e64[_0xd56b('0x47')]=_[_0xd56b('0x48')](_0x540e64['model'],_0x540e64[_0xd56b('0x46')]);_0x416eed[_0xd56b('0x49')]=_[_0xd56b('0x48')](_0x540e64[_0xd56b('0x45')],qs[_0xd56b('0x4a')](_0x1ca320['query'][_0xd56b('0x4a')]));_0x416eed[_0xd56b('0x49')]=_0x416eed['attributes'][_0xd56b('0x4b')]?_0x416eed[_0xd56b('0x49')]:_0x540e64['model'];if(!_0x1ca320['query'][_0xd56b('0x4c')](_0xd56b('0x4d'))){_0x416eed[_0xd56b('0x30')]=qs[_0xd56b('0x30')](_0x1ca320[_0xd56b('0x46')][_0xd56b('0x30')]);_0x416eed[_0xd56b('0x2e')]=qs[_0xd56b('0x2e')](_0x1ca320[_0xd56b('0x46')]['offset']);}_0x416eed['order']=qs[_0xd56b('0x4f')](_0x1ca320[_0xd56b('0x46')]['sort']);_0x416eed[_0xd56b('0x50')]=qs[_0xd56b('0x47')](_[_0xd56b('0x51')](_0x1ca320[_0xd56b('0x46')],_0x540e64[_0xd56b('0x47')]));_0x416eed[_0xd56b('0x50')][_0xd56b('0x67')]=_0x11ac1a['id'];if(_0x1ca320['query'][_0xd56b('0x52')]){_0x416eed[_0xd56b('0x50')]=_[_0xd56b('0x53')](_0x416eed[_0xd56b('0x50')],{'$or':_[_0xd56b('0x3f')](_0x416eed[_0xd56b('0x49')],function(_0x5c7e0d){var _0x2b5711={};_0x2b5711[_0x5c7e0d]={'$like':'%'+_0x1ca320[_0xd56b('0x46')][_0xd56b('0x52')]+'%'};return _0x2b5711;})});}_0x416eed=_[_0xd56b('0x53')]({},_0x416eed,_0x1ca320[_0xd56b('0x5b')]);return db[_0xd56b('0x6d')][_0xd56b('0x31')]({'where':_0x416eed['where']})[_0xd56b('0x22')](function(_0x366576){_0x1af619[_0xd56b('0x31')]=_0x366576;if(_0x1ca320[_0xd56b('0x46')]['includeAll']){_0x416eed[_0xd56b('0x6a')]=[{'all':!![]}];}return db[_0xd56b('0x6d')]['findAll'](_0x416eed);})[_0xd56b('0x22')](function(_0x5a1cd1){_0x1af619[_0xd56b('0x57')]=_0x5a1cd1;return _0x1af619;});}})[_0xd56b('0x22')](respondWithFilteredResult(_0x5ea669,_0x416eed))[_0xd56b('0x5d')](handleError(_0x5ea669,null));};exports[_0xd56b('0x6f')]=function(_0x541b25,_0xd770f2,_0x1384be){return db[_0xd56b('0x40')][_0xd56b('0x5c')]({'where':{'id':_0x541b25[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0xd770f2,null))[_0xd56b('0x22')](function(_0x36cffb){if(_0x36cffb){return _0x36cffb['removeAnswers'](_0x541b25[_0xd56b('0x46')]['ids']);}})[_0xd56b('0x22')](respondWithStatusCode(_0xd770f2,null))[_0xd56b('0x5d')](handleError(_0xd770f2,null));};exports[_0xd56b('0x70')]=function(_0x5cc7e9,_0x4b5ca0,_0x5c30de){return db['WhatsappAccount'][_0xd56b('0x5c')]({'where':{'id':_0x5cc7e9[_0xd56b('0x59')]['id']}})['then'](handleEntityNotFound(_0x4b5ca0,null))[_0xd56b('0x22')](function(_0xf332d){if(_0xf332d){return _0xf332d['addAgents'](_0x5cc7e9[_0xd56b('0x65')][_0xd56b('0x6c')],_[_0xd56b('0x71')](_0x5cc7e9[_0xd56b('0x65')],['ids','id'])||{})[_0xd56b('0x72')](function(_0xa5b5f7){for(var _0x43e7bf=0x0;_0x43e7bf<_0x5cc7e9[_0xd56b('0x65')]['ids'][_0xd56b('0x4b')];_0x43e7bf+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x5cc7e9['body'][_0xd56b('0x6c')][_0x43e7bf]),'WhatsappAccountId':Number(_0x5cc7e9[_0xd56b('0x59')]['id'])});}return _0xa5b5f7;});}})[_0xd56b('0x22')](respondWithResult(_0x4b5ca0,null))[_0xd56b('0x5d')](handleError(_0x4b5ca0,null));};exports[_0xd56b('0x73')]=function(_0x2aee69,_0x27872f,_0x3fc0f9){return db[_0xd56b('0x40')][_0xd56b('0x5c')]({'where':{'id':_0x2aee69[_0xd56b('0x59')]['id']}})['then'](handleEntityNotFound(_0x27872f,null))[_0xd56b('0x22')](function(_0x40eaa5){if(_0x40eaa5){return _0x40eaa5[_0xd56b('0x73')](_0x2aee69['query'][_0xd56b('0x6c')])[_0xd56b('0x22')](function(){if(_[_0xd56b('0x74')](_0x2aee69['query'][_0xd56b('0x6c')])){for(var _0x4814b9=0x0;_0x4814b9<_0x2aee69[_0xd56b('0x46')][_0xd56b('0x6c')]['length'];_0x4814b9+=0x1){socket['emit'](_0xd56b('0x75'),{'UserId':Number(_0x2aee69[_0xd56b('0x46')]['ids'][_0x4814b9]),'WhatsappAccountId':Number(_0x2aee69['params']['id'])});}}else{socket[_0xd56b('0x76')](_0xd56b('0x75'),{'UserId':Number(_0x2aee69[_0xd56b('0x46')]['ids']),'WhatsappAccountId':Number(_0x2aee69[_0xd56b('0x59')]['id'])});}});}})[_0xd56b('0x22')](respondWithStatusCode(_0x27872f,null))[_0xd56b('0x5d')](handleError(_0x27872f,null));};exports[_0xd56b('0x77')]=function(_0x5b426e,_0x2f1f7b,_0x2ccdd5){var _0xad270d={};var _0x2820d7={};var _0x3a1447;var _0x13a5f9;return db[_0xd56b('0x40')][_0xd56b('0x69')]({'where':{'id':_0x5b426e['params']['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x2f1f7b,null))[_0xd56b('0x22')](function(_0x1fdb97){if(_0x1fdb97){_0x3a1447=_0x1fdb97;_0x2820d7[_0xd56b('0x45')]=_[_0xd56b('0x5a')](db['User'][_0xd56b('0x41')]);_0x2820d7[_0xd56b('0x46')]=_[_0xd56b('0x5a')](_0x5b426e[_0xd56b('0x46')]);_0x2820d7[_0xd56b('0x47')]=_[_0xd56b('0x48')](_0x2820d7[_0xd56b('0x45')],_0x2820d7['query']);_0xad270d[_0xd56b('0x49')]=_[_0xd56b('0x48')](_0x2820d7[_0xd56b('0x45')],qs[_0xd56b('0x4a')](_0x5b426e[_0xd56b('0x46')][_0xd56b('0x4a')]));_0xad270d[_0xd56b('0x49')]=_0xad270d['attributes']['length']?_0xad270d[_0xd56b('0x49')]:_0x2820d7[_0xd56b('0x45')];_0xad270d[_0xd56b('0x4e')]=qs['sort'](_0x5b426e[_0xd56b('0x46')][_0xd56b('0x4f')]);_0xad270d['where']=qs[_0xd56b('0x47')](_[_0xd56b('0x51')](_0x5b426e['query'],_0x2820d7[_0xd56b('0x47')]));if(_0x5b426e['query'][_0xd56b('0x52')]){_0xad270d[_0xd56b('0x50')]=_[_0xd56b('0x53')](_0xad270d[_0xd56b('0x50')],{'$or':_[_0xd56b('0x3f')](_0xad270d[_0xd56b('0x49')],function(_0x459288){var _0x238247={};_0x238247[_0x459288]={'$like':'%'+_0x5b426e[_0xd56b('0x46')]['filter']+'%'};return _0x238247;})});}_0xad270d=_[_0xd56b('0x53')]({},_0xad270d,_0x5b426e[_0xd56b('0x5b')]);return _0x3a1447[_0xd56b('0x77')](_0xad270d);}})['then'](function(_0x5ec2b3){if(_0x5ec2b3){_0x13a5f9=_0x5ec2b3[_0xd56b('0x4b')];if(!_0x5b426e['query'][_0xd56b('0x4c')]('nolimit')){_0xad270d[_0xd56b('0x30')]=qs[_0xd56b('0x30')](_0x5b426e[_0xd56b('0x46')][_0xd56b('0x30')]);_0xad270d[_0xd56b('0x2e')]=qs[_0xd56b('0x2e')](_0x5b426e[_0xd56b('0x46')][_0xd56b('0x2e')]);}return _0x3a1447[_0xd56b('0x77')](_0xad270d);}})['then'](function(_0x137316){if(_0x137316){return _0x137316?{'count':_0x13a5f9,'rows':_0x137316}:null;}})[_0xd56b('0x22')](respondWithResult(_0x2f1f7b,null))[_0xd56b('0x5d')](handleError(_0x2f1f7b,null));};exports[_0xd56b('0x78')]=function(_0xe2266f,_0x1e32a4){var _0x801287=_0xe2266f[_0xd56b('0x59')]['id'];var _0x57728d=_0xe2266f[_0xd56b('0x65')];var _0x1daa7a=0xc8;var _0x203ad6=null;return db[_0xd56b('0x79')][_0xd56b('0x7a')]({'isolationLevel':db[_0xd56b('0x79')][_0xd56b('0x7b')][_0xd56b('0x7c')][_0xd56b('0x7d')]},function(_0xe1d2dc){return db[_0xd56b('0x40')][_0xd56b('0x69')]({'where':{'id':_0x801287},'transaction':_0xe1d2dc})[_0xd56b('0x22')](function(_0x1649ea){if(_0x1649ea){return db[_0xd56b('0x7e')]['destroy']({'where':{'WhatsappAccountId':_0x801287},'transaction':_0xe1d2dc})[_0xd56b('0x22')](function(){var _0x1e3f9a=_[_0xd56b('0x3f')](_0x57728d,function(_0x3747a4){_0x3747a4[_0xd56b('0x67')]=_0x801287;return _0x3747a4;});return db[_0xd56b('0x7e')]['bulkCreate'](_0x1e3f9a,{'transaction':_0xe1d2dc});});}else{_0x1daa7a=0x194;_0x203ad6=[];}});})[_0xd56b('0x22')](function(){if(_0x1daa7a!==0x194){return db[_0xd56b('0x7e')][_0xd56b('0x7f')]({'where':{'WhatsappAccountId':_0x801287},'order':_0xd56b('0x80')})[_0xd56b('0x22')](function(_0x1f0d6f){_0x203ad6=_0x1f0d6f;});}})[_0xd56b('0x5d')](function(_0x194da9){_0x1daa7a=0x1f4;logger[_0xd56b('0x27')](_0x194da9[_0xd56b('0x39')]);if(_0x194da9[_0xd56b('0x3a')]){delete _0x194da9[_0xd56b('0x3a')];}_0x203ad6=_0x194da9;})['finally'](function(){if(_0x203ad6===null){_0x1e32a4[_0xd56b('0x2a')](_0x1daa7a);}else{if(_0x1daa7a===0x1f4){_0x1e32a4[_0xd56b('0x2b')](_0x1daa7a)[_0xd56b('0x3b')](_0x203ad6);}else{_0x1e32a4[_0xd56b('0x2b')](_0x1daa7a)[_0xd56b('0x2d')](_0x203ad6);}}});};exports[_0xd56b('0x81')]=function(_0x8a3cf2,_0xe0deb3,_0xfb5837){var _0x35560e={};var _0xd5bb3c={};var _0x554a25;var _0xe8e658;return db[_0xd56b('0x40')]['findOne']({'where':{'id':_0x8a3cf2[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0xe0deb3,null))[_0xd56b('0x22')](function(_0x4866ad){if(_0x4866ad){_0x554a25=_0x4866ad;_0xd5bb3c[_0xd56b('0x45')]=_[_0xd56b('0x5a')](db['WhatsappApplication'][_0xd56b('0x41')]);_0xd5bb3c[_0xd56b('0x46')]=_[_0xd56b('0x5a')](_0x8a3cf2[_0xd56b('0x46')]);_0xd5bb3c[_0xd56b('0x47')]=_[_0xd56b('0x48')](_0xd5bb3c['model'],_0xd5bb3c[_0xd56b('0x46')]);_0x35560e[_0xd56b('0x49')]=_[_0xd56b('0x48')](_0xd5bb3c[_0xd56b('0x45')],qs[_0xd56b('0x4a')](_0x8a3cf2[_0xd56b('0x46')][_0xd56b('0x4a')]));_0x35560e['attributes']=_0x35560e[_0xd56b('0x49')][_0xd56b('0x4b')]?_0x35560e[_0xd56b('0x49')]:_0xd5bb3c[_0xd56b('0x45')];_0x35560e['order']=qs[_0xd56b('0x4f')](_0x8a3cf2[_0xd56b('0x46')][_0xd56b('0x4f')]);_0x35560e[_0xd56b('0x50')]=qs['filters'](_[_0xd56b('0x51')](_0x8a3cf2[_0xd56b('0x46')],_0xd5bb3c[_0xd56b('0x47')]));if(_0x8a3cf2['query'][_0xd56b('0x52')]){_0x35560e[_0xd56b('0x50')]=_[_0xd56b('0x53')](_0x35560e[_0xd56b('0x50')],{'$or':_[_0xd56b('0x3f')](_0x35560e[_0xd56b('0x49')],function(_0x2d0d30){var _0x3ee637={};_0x3ee637[_0x2d0d30]={'$like':'%'+_0x8a3cf2['query'][_0xd56b('0x52')]+'%'};return _0x3ee637;})});}_0x35560e=_['merge']({},_0x35560e,_0x8a3cf2['options']);return _0x554a25[_0xd56b('0x81')](_0x35560e);}})['then'](function(_0x5a2114){if(_0x5a2114){_0xe8e658=_0x5a2114['length'];if(!_0x8a3cf2[_0xd56b('0x46')]['hasOwnProperty'](_0xd56b('0x4d'))){_0x35560e[_0xd56b('0x30')]=qs[_0xd56b('0x30')](_0x8a3cf2[_0xd56b('0x46')]['limit']);_0x35560e[_0xd56b('0x2e')]=qs[_0xd56b('0x2e')](_0x8a3cf2[_0xd56b('0x46')]['offset']);}return _0x554a25[_0xd56b('0x81')](_0x35560e);}})['then'](function(_0x4c987d){if(_0x4c987d){return _0x4c987d?{'count':_0xe8e658,'rows':_0x4c987d}:null;}})[_0xd56b('0x22')](respondWithResult(_0xe0deb3,null))[_0xd56b('0x5d')](handleError(_0xe0deb3,null));};exports[_0xd56b('0x82')]=function(_0x4af205,_0x7951d,_0x5b2bba){var _0x9e56d1={'channel':'whatsapp'};var _0x45455f=[];var _0x3d8bdc=[];var _0x82ce0={};return db['WhatsappAccount'][_0xd56b('0x5c')]({'where':{'id':_0x4af205[_0xd56b('0x59')]['id']},'include':[{'model':db[_0xd56b('0x7e')],'as':_0xd56b('0x83')}]})[_0xd56b('0x22')](handleEntityNotFound(_0x7951d,null))[_0xd56b('0x22')](function(_0x13a7e1){_0x9e56d1[_0xd56b('0x84')]=_0x13a7e1;if(_0x9e56d1['account']&&_0x9e56d1[_0xd56b('0x84')][_0xd56b('0x43')]===_0xd56b('0x85')&&_0x4af205[_0xd56b('0x65')][_0xd56b('0x86')]){if(_0x4af205[_0xd56b('0x65')][_0xd56b('0x86')][_0xd56b('0x4b')]===0x0)return;if(_0x4af205['body'][_0xd56b('0x86')][0x0][_0xd56b('0x87')]!==_0xd56b('0x88'))return;return db[_0xd56b('0x89')][_0xd56b('0x36')]({'read':!![],'readAt':_0x4af205['body'][_0xd56b('0x86')][0x0][_0xd56b('0x8a')]},{'where':{'messageId':_0x4af205['body'][_0xd56b('0x86')][0x0][_0xd56b('0x8b')]},'individualHooks':!![]})[_0xd56b('0x22')](function(_0x32a5c0){return _0x7951d[_0xd56b('0x2b')](0xc8)[_0xd56b('0x2d')](_0x32a5c0);});}_0x9e56d1[_0xd56b('0x8c')]=_[_0xd56b('0x8d')](_0x13a7e1[_0xd56b('0x83')],[_0xd56b('0x80')],[_0xd56b('0x8e')]);if(_0x9e56d1[_0xd56b('0x84')][_0xd56b('0x83')]){delete _0x9e56d1['account'][_0xd56b('0x83')];}return db['CmContact'][_0xd56b('0x8f')]()[_0xd56b('0x22')](function(_0x96c797){if(!_0x96c797){throw new db[(_0xd56b('0x90'))][(_0xd56b('0x91'))](_0xd56b('0x92'));}_0x45455f=_['difference'](_[_0xd56b('0x5a')](_0x96c797),[_0xd56b('0x93'),_0xd56b('0x94')]);_0x3d8bdc=_[_0xd56b('0x95')](_[_0xd56b('0x5a')](_0x96c797),[_0xd56b('0x93'),_0xd56b('0x94'),_0xd56b('0x96'),_0xd56b('0x97')]);_0x9e56d1['body']={'mapKey':_0xd56b('0x98')};if(_0x9e56d1[_0xd56b('0x84')]&&_0x9e56d1[_0xd56b('0x84')][_0xd56b('0x43')]===_0xd56b('0x99')){_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9a')]=_0x4af205[_0xd56b('0x65')][_0xd56b('0x9b')][_0xd56b('0x9c')](_0xd56b('0x9d'),'');_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x65')]=_0x4af205[_0xd56b('0x65')]['Body'];_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9e')]=_0x4af205['body'][_0xd56b('0x9f')];}if(_0x9e56d1[_0xd56b('0x84')]&&_0x9e56d1[_0xd56b('0x84')][_0xd56b('0x43')]===_0xd56b('0x85')){_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9a')]=_0x4af205[_0xd56b('0x65')][_0xd56b('0xa0')][0x0][_0xd56b('0x9a')];_0x9e56d1['body'][_0xd56b('0x65')]=_0x4af205['body'][_0xd56b('0xa0')][0x0]['message'][_0xd56b('0x65')];_0x9e56d1[_0xd56b('0x65')]['messageId']=_0x4af205['body'][_0xd56b('0xa0')][0x0][_0xd56b('0x8b')];}if(_0x9e56d1['body']['id']){delete _0x9e56d1[_0xd56b('0x65')]['id'];}if(_[_0xd56b('0xa1')](_0x9e56d1[_0xd56b('0x65')]['from'])){throw new db[(_0xd56b('0x90'))][(_0xd56b('0x91'))](_0xd56b('0xa2'));}if(_['isNil'](_0x9e56d1['body'][_0xd56b('0x65')])||_0x9e56d1[_0xd56b('0x65')]['body']===''){throw new db[(_0xd56b('0x90'))]['ValidationError'](_0xd56b('0xa3'));}if(_['isNil'](_0x9e56d1[_0xd56b('0x65')][_0xd56b('0xa4')])){throw new db[(_0xd56b('0x90'))][(_0xd56b('0x91'))](_0xd56b('0xa5')+_0x3d8bdc);}if(!_['includes'](_0x3d8bdc,_0x9e56d1['body']['mapKey'])){throw new db[(_0xd56b('0x90'))][(_0xd56b('0x91'))](_0xd56b('0xa6')+_0x3d8bdc);}_0x82ce0[_0x9e56d1[_0xd56b('0x65')][_0xd56b('0xa4')]]=_0x9e56d1['body'][_0xd56b('0x9a')];return db[_0xd56b('0xa7')]['find']({'where':{'id':_0x9e56d1[_0xd56b('0x84')][_0xd56b('0x97')]},'include':[{'model':db[_0xd56b('0xa8')],'as':_0xd56b('0xa9'),'where':_0x82ce0,'limit':0x1,'order':[[_0xd56b('0x94'),'DESC']]}]});})[_0xd56b('0x22')](handleEntityNotFound(_0x7951d,null))[_0xd56b('0x22')](function(_0x184569){if(_0x184569){_0x9e56d1[_0xd56b('0xaa')]=_[_0xd56b('0x71')](_0x184569,[_0xd56b('0xa9')]);if(_0x184569[_0xd56b('0xa9')][_0xd56b('0x4b')]){return _0x184569['Contacts'][0x0];}var _0x1f22ec=_[_0xd56b('0x1a')](_0x9e56d1[_0xd56b('0x65')],{'firstName':_0x9e56d1['body'][_0xd56b('0x9a')],'ListId':_0x184569['id']});_0x1f22ec[_0x9e56d1[_0xd56b('0x65')][_0xd56b('0xa4')]]=_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9a')];return db[_0xd56b('0xa8')][_0xd56b('0x5e')](_0x1f22ec,{'fields':_0x45455f,'raw':!![]});}})[_0xd56b('0x22')](handleEntityNotFound(_0x7951d,null))['then'](function(_0x3396ae){if(_0x3396ae){_0x9e56d1['contact']=_0x3396ae;var _0x1b2215={'ContactId':_0x3396ae['id'],'phone':_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9a')],'WhatsappAccountId':_0x4af205['params']['id']};var _0x53352c={'ContactId':_0x3396ae['id'],'WhatsappAccountId':_0x4af205[_0xd56b('0x59')]['id'],'closed':![]};return db[_0xd56b('0xab')][_0xd56b('0x5c')]({'where':_0x53352c})[_0xd56b('0x22')](function(_0x4f1502){if(_0x4f1502){return[_0x4f1502,![]];}return db[_0xd56b('0xab')][_0xd56b('0x5e')](_0x1b2215)['then'](function(_0x44e9b5){return[_0x44e9b5,!![]];});});}})['spread'](function(_0xb43fcf,_0x577da5){_0x9e56d1['interaction']=_0xb43fcf['get']({'plain':!![]});_0x9e56d1['interaction'][_0xd56b('0xac')]=![];if(_0x577da5){if(_0x9e56d1[_0xd56b('0x84')]['autoclose']){_0x9e56d1['applications'][_0xd56b('0xad')]({'id':0x0,'priority':_0x9e56d1[_0xd56b('0x8c')]['length']+0x1,'app':'close','appdata':_0xd56b('0xae'),'interval':_0xd56b('0xaf')});}_0x9e56d1['interaction'][_0xd56b('0xac')]=!![];}return db['WhatsappMessage'][_0xd56b('0x5e')]({'phone':_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9a')],'messageId':_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9e')],'body':_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x65')],'WhatsappAccountId':_0x4af205[_0xd56b('0x59')]['id'],'WhatsappInteractionId':_0xb43fcf['id'],'direction':'in','ContactId':_0xb43fcf[_0xd56b('0xb0')],'AttachmentId':_0x9e56d1[_0xd56b('0x65')][_0xd56b('0xb1')]});})[_0xd56b('0x22')](function(_0x40e7ae){_0x9e56d1[_0xd56b('0x29')]=_0x40e7ae;if(!_0x9e56d1['interaction'][_0xd56b('0xb2')])return;return db['User'][_0xd56b('0x5c')]({'attributes':['id',_0xd56b('0x3a')],'where':{'id':_0x9e56d1[_0xd56b('0xb3')][_0xd56b('0xb2')]}});})['then'](function(_0x56d8da){if(_0x56d8da){_0x9e56d1[_0xd56b('0x8c')][_0xd56b('0xb4')]({'id':0x0,'priority':0x0,'app':_0xd56b('0xb5'),'appdata':_0x56d8da['name']+','+(_0x9e56d1[_0xd56b('0x84')][_0xd56b('0xb6')]||0xa),'interval':_0xd56b('0xaf')});}if(!_0x9e56d1[_0xd56b('0xb3')][_0xd56b('0xb7')])return;return db[_0xd56b('0xb8')][_0xd56b('0x5c')]({'attributes':['id',_0xd56b('0x3a')],'where':{'id':_0x9e56d1[_0xd56b('0xb3')][_0xd56b('0xb7')]}});})[_0xd56b('0x22')](function(_0x524360){if(_0x524360){_0x9e56d1[_0xd56b('0x8c')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x524360[_0xd56b('0x3a')]+','+(_0x9e56d1[_0xd56b('0x84')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd56b('0xb9'),'startRouting',_0x9e56d1);})[_0xd56b('0x22')](function(_0x2dd1f9){if(_0x2dd1f9){var _0x382997=0xc8;var _0x103e91=_0xd56b('0xba');logger[_0xd56b('0x23')](_0xd56b('0xbb'),_0x103e91,_0x382997,_0xd56b('0xbc'));logger['debug'](_0xd56b('0xbd'),_0x103e91,_0x382997,'entity\x20found',JSON[_0xd56b('0x26')](_0x2dd1f9));if(_0x9e56d1['account']['type']===_0xd56b('0x99')){return _0x7951d[_0xd56b('0x2b')](_0x382997)[_0xd56b('0x32')](_0xd56b('0xbe'),_0xd56b('0xbf'))[_0xd56b('0x3b')]('\x0a');}else{return _0x7951d['status'](_0x382997)[_0xd56b('0x2d')](_0x2dd1f9);}}});})[_0xd56b('0x5d')](handleError(_0x7951d,null));};exports[_0xd56b('0x3b')]=function(_0x5d7d18,_0x231081,_0x450173){var _0x4551b6,_0x542eb0,_0x2932fc;if(_[_0xd56b('0xa1')](_0x5d7d18[_0xd56b('0x65')][_0xd56b('0x65')])||_0x5d7d18['body'][_0xd56b('0x65')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd56b('0xa1')](_0x5d7d18[_0xd56b('0x65')]['to'])){throw new db[(_0xd56b('0x90'))][(_0xd56b('0x91'))](_0xd56b('0xc0'));}_0x4551b6=_0x5d7d18['body']['to'];return db[_0xd56b('0x40')]['find']({'where':{'id':_0x5d7d18[_0xd56b('0x59')]['id']},'include':[{'model':db[_0xd56b('0xa7')],'as':_0xd56b('0xc1'),'include':[{'model':db['CmContact'],'as':_0xd56b('0xa9'),'where':{'mobile':_0x4551b6},'limit':0x1,'order':[[_0xd56b('0x94'),'DESC']]}]}]})[_0xd56b('0x22')](handleEntityNotFound(_0x231081,null))[_0xd56b('0x22')](function(_0x553ba7){if(_0x553ba7&&_0x553ba7['List']){_0x542eb0=_0x553ba7[_0xd56b('0x5f')]({'plain':!![]});if(_0x542eb0['List']&&_0x542eb0[_0xd56b('0xc1')][_0xd56b('0xa9')][_0xd56b('0x4b')]){return _0x542eb0[_0xd56b('0xc1')][_0xd56b('0xa9')][0x0];}return db[_0xd56b('0xa8')][_0xd56b('0x5e')](_[_0xd56b('0x1a')](_0x5d7d18[_0xd56b('0x65')],{'firstName':_0x4551b6,'mobile':_0x4551b6,'phone':_0x4551b6,'ListId':_0x542eb0[_0xd56b('0x97')]}));}})[_0xd56b('0x22')](handleEntityNotFound(_0x231081,null))['then'](function(_0x241b79){if(_0x241b79){_0x2932fc=_0x241b79;return db[_0xd56b('0xab')][_0xd56b('0x5c')]({'where':{'ContactId':_0x2932fc['id'],'closed':![],'WhatsappAccountId':_0x542eb0['id']}})['then'](function(_0x10e02a){if(_0x10e02a){return[_0x10e02a,![]];}return db[_0xd56b('0xab')][_0xd56b('0x5e')]({'UserId':_0x5d7d18[_0xd56b('0x61')]['id'],'ContactId':_0x2932fc['id'],'WhatsappAccountId':_0x542eb0['id'],'phone':_0x4551b6,'firstMsgDirection':_0xd56b('0xc2'),'Messages':[_[_0xd56b('0x53')](_0x5d7d18['body'],{'read':![],'body':_0x5d7d18['body'][_0xd56b('0x65')],'phone':_0x4551b6,'WhatsappAccountId':_0x542eb0['id'],'UserId':_0x5d7d18[_0xd56b('0x61')]['id'],'ContactId':_0x2932fc['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0xd56b('0x22')](function(_0x40ddf2){return[_0x40ddf2,!![]];});});}})[_0xd56b('0x72')](function(_0x2c87a9,_0x2a953d){if(_0x2a953d){return _0x2c87a9;}return db[_0xd56b('0x89')][_0xd56b('0x5e')](_['merge'](_0x5d7d18['body'],{'read':![],'body':_0x5d7d18[_0xd56b('0x65')][_0xd56b('0x65')],'phone':_0x4551b6,'WhatsappAccountId':_0x542eb0['id'],'WhatsappInteractionId':_0x2c87a9['id'],'UserId':_0x5d7d18['user']['id'],'ContactId':_0x2932fc['id']}))['then'](function(_0x4ca3ae){_0x2c87a9[_0xd56b('0xc3')][_0xd56b('0xc4')]=[];_0x2c87a9[_0xd56b('0xc3')][_0xd56b('0xc4')][_0xd56b('0xad')](_0x4ca3ae[_0xd56b('0xc3')]);return _0x2c87a9;});})[_0xd56b('0x22')](respondWithResult(_0x231081,null))['catch'](handleError(_0x231081,null));}; \ No newline at end of file +var _0x5227=['timestamp','applications','orderBy','Applications','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','replace','whatsapp:','Body','messageId','type','notifications','message_id','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ListId','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','set','Content-Type','text/xml','\x0a','CmList','List','DESC','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','autoAssociation','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','rawAttributes','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','destroy','bulkCreate','findAndCountAll','priority','finally','getApplications','whatsapp','account','sinch','statuses','state','WhatsappMessage'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x5227,0x1d1));var _0x7522=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x5227[_0x22bdd3];return _0x44d9d9;};'use strict';var emlformat=require(_0x7522('0x0'));var rimraf=require(_0x7522('0x1'));var zipdir=require(_0x7522('0x2'));var jsonpatch=require(_0x7522('0x3'));var rp=require(_0x7522('0x4'));var moment=require(_0x7522('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7522('0x6'));var util=require(_0x7522('0x7'));var path=require(_0x7522('0x8'));var sox=require(_0x7522('0x9'));var csv=require('to-csv');var ejs=require(_0x7522('0xa'));var fs=require('fs');var fs_extra=require(_0x7522('0xb'));var _=require(_0x7522('0xc'));var squel=require(_0x7522('0xd'));var crypto=require(_0x7522('0xe'));var jsforce=require(_0x7522('0xf'));var deskjs=require(_0x7522('0x10'));var toCsv=require(_0x7522('0x11'));var querystring=require(_0x7522('0x12'));var Papa=require(_0x7522('0x13'));var Redis=require(_0x7522('0x14'));var authService=require(_0x7522('0x15'));var qs=require(_0x7522('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7522('0x17'));var logger=require(_0x7522('0x18'))(_0x7522('0x19'));var utils=require(_0x7522('0x1a'));var config=require(_0x7522('0x1b'));var licenseUtil=require(_0x7522('0x1c'));var db=require('../../mysqldb')['db'];config[_0x7522('0x1d')]=_[_0x7522('0x1e')](config[_0x7522('0x1d')],{'host':_0x7522('0x1f'),'port':0x18eb});var socket=require(_0x7522('0x20'))(new Redis(config[_0x7522('0x1d')]));require(_0x7522('0x21'))[_0x7522('0x22')](socket);var jayson=require(_0x7522('0x23'));var client=jayson[_0x7522('0x24')]['http']({'port':0x232c});function respondWithRpcPromise(_0x54ce48,_0x30952b,_0x5ec046,_0x1aa84c){return new BPromise(function(_0x2ded0c,_0x125026){var _0x1cd22b=_0x1aa84c||client;return _0x1cd22b[_0x7522('0x25')](_0x54ce48,_0x5ec046)[_0x7522('0x26')](function(_0x4d489b){logger[_0x7522('0x27')](_0x7522('0x28'),_0x30952b,_0x7522('0x29'));logger['debug'](_0x7522('0x2a'),_0x30952b,_0x7522('0x29'),JSON[_0x7522('0x2b')](_0x4d489b));if(_0x4d489b[_0x7522('0x2c')]){if(_0x4d489b[_0x7522('0x2c')][_0x7522('0x2d')]===0x1f4){logger[_0x7522('0x2c')](_0x7522('0x28'),_0x30952b,_0x4d489b[_0x7522('0x2c')][_0x7522('0x2e')]);return _0x125026(_0x4d489b['error'][_0x7522('0x2e')]);}logger[_0x7522('0x2c')](_0x7522('0x28'),_0x30952b,_0x4d489b[_0x7522('0x2c')][_0x7522('0x2e')]);return _0x2ded0c(_0x4d489b['error'][_0x7522('0x2e')]);}else{logger[_0x7522('0x27')](_0x7522('0x28'),_0x30952b,'request\x20sent');_0x2ded0c(_0x4d489b['result']['message']);}})['catch'](function(_0x306b29){logger[_0x7522('0x2c')]('WhatsappAccount,\x20%s,\x20%s',_0x30952b,_0x306b29);_0x125026(_0x306b29);});});}function respondWithStatusCode(_0x4eee84,_0x4e5028){_0x4e5028=_0x4e5028||0xcc;return function(_0x2b583d){if(_0x2b583d){return _0x4eee84[_0x7522('0x2f')](_0x4e5028);}return _0x4eee84[_0x7522('0x30')](_0x4e5028)[_0x7522('0x31')]();};}function respondWithResult(_0x596e12,_0x5cec09){_0x5cec09=_0x5cec09||0xc8;return function(_0xfb1361){if(_0xfb1361){return _0x596e12['status'](_0x5cec09)[_0x7522('0x32')](_0xfb1361);}};}function respondWithFilteredResult(_0x3b10d3,_0x17fd78){return function(_0x427e43){if(_0x427e43){var _0x1896c8=typeof _0x17fd78[_0x7522('0x33')]===_0x7522('0x34')&&typeof _0x17fd78[_0x7522('0x35')]===_0x7522('0x34');var _0x1eec1b=_0x427e43[_0x7522('0x36')];var _0x15844c=_0x1896c8?0x0:_0x17fd78[_0x7522('0x33')];var _0x4c80dd=_0x1896c8?_0x427e43[_0x7522('0x36')]:_0x17fd78[_0x7522('0x33')]+_0x17fd78[_0x7522('0x35')];var _0x9c08f1;if(_0x4c80dd>=_0x1eec1b){_0x4c80dd=_0x1eec1b;_0x9c08f1=0xc8;}else{_0x9c08f1=0xce;}_0x3b10d3[_0x7522('0x30')](_0x9c08f1);return _0x3b10d3['set'](_0x7522('0x37'),_0x15844c+'-'+_0x4c80dd+'/'+_0x1eec1b)[_0x7522('0x32')](_0x427e43);}return null;};}function patchUpdates(_0xa9d8eb){return function(_0x1be2ce){try{jsonpatch['apply'](_0x1be2ce,_0xa9d8eb,!![]);}catch(_0x30c730){return BPromise[_0x7522('0x38')](_0x30c730);}return _0x1be2ce[_0x7522('0x39')]();};}function saveUpdates(_0x27e0ed,_0x43b41e){return function(_0x12e2e1){if(_0x12e2e1){return _0x12e2e1[_0x7522('0x3a')](_0x27e0ed)[_0x7522('0x26')](function(_0x3a4579){return _0x3a4579;});}return null;};}function removeEntity(_0x2001b4,_0x16d452){return function(_0x312ac8){if(_0x312ac8){return _0x312ac8['destroy']()['then'](function(){var _0x314a8b=_0x312ac8['get']({'plain':!![]});var _0x26d153='WhatsappAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x26d153,'resourceId':_0x314a8b['id']}})[_0x7522('0x26')](function(){return _0x312ac8;});})['then'](function(){_0x2001b4[_0x7522('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26ef67,_0x3db4ac){return function(_0x39e0cc){if(!_0x39e0cc){_0x26ef67[_0x7522('0x2f')](0x194);}return _0x39e0cc;};}function handleError(_0x46fab5,_0x2febdd){_0x2febdd=_0x2febdd||0x1f4;return function(_0x35ab91){logger[_0x7522('0x2c')](_0x35ab91[_0x7522('0x3b')]);if(_0x35ab91[_0x7522('0x3c')]){delete _0x35ab91[_0x7522('0x3c')];}_0x46fab5[_0x7522('0x30')](_0x2febdd)[_0x7522('0x3d')](_0x35ab91);};}exports[_0x7522('0x3e')]=function(_0x4fc6a4,_0x3ee68a){var _0x91b71b={'include':[{'model':db[_0x7522('0x3f')],'as':_0x7522('0x40')}]},_0x5d6e6b={},_0x388756={'count':0x0,'rows':[]};var _0x51019d=_[_0x7522('0x41')](db[_0x7522('0x42')]['rawAttributes'],function(_0x38fb47){return{'name':_0x38fb47['fieldName'],'type':_0x38fb47['type'][_0x7522('0x43')]};});_0x5d6e6b[_0x7522('0x44')]=_[_0x7522('0x41')](_0x51019d,_0x7522('0x3c'));_0x5d6e6b['query']=_[_0x7522('0x45')](_0x4fc6a4[_0x7522('0x46')]);_0x5d6e6b['filters']=_[_0x7522('0x47')](_0x5d6e6b[_0x7522('0x44')],_0x5d6e6b[_0x7522('0x46')]);_0x91b71b[_0x7522('0x48')]=_[_0x7522('0x47')](_0x5d6e6b[_0x7522('0x44')],qs[_0x7522('0x49')](_0x4fc6a4[_0x7522('0x46')]['fields']));_0x91b71b[_0x7522('0x48')]=_0x91b71b[_0x7522('0x48')][_0x7522('0x4a')]?_0x91b71b['attributes']:_0x5d6e6b['model'];if(!_0x4fc6a4[_0x7522('0x46')][_0x7522('0x4b')](_0x7522('0x4c'))){_0x91b71b[_0x7522('0x35')]=qs[_0x7522('0x35')](_0x4fc6a4['query'][_0x7522('0x35')]);_0x91b71b[_0x7522('0x33')]=qs[_0x7522('0x33')](_0x4fc6a4['query'][_0x7522('0x33')]);}_0x91b71b['order']=qs[_0x7522('0x4d')](_0x4fc6a4[_0x7522('0x46')][_0x7522('0x4d')]);_0x91b71b['where']=qs['filters'](_[_0x7522('0x4e')](_0x4fc6a4[_0x7522('0x46')],_0x5d6e6b[_0x7522('0x4f')]),_0x51019d);if(_0x4fc6a4[_0x7522('0x46')][_0x7522('0x50')]){_0x91b71b[_0x7522('0x51')]=_[_0x7522('0x52')](_0x91b71b[_0x7522('0x51')],{'$or':_[_0x7522('0x41')](_0x51019d,function(_0x50d51f){if(_0x50d51f['type']!==_0x7522('0x53')){var _0x448432={};_0x448432[_0x50d51f[_0x7522('0x3c')]]={'$like':'%'+_0x4fc6a4[_0x7522('0x46')]['filter']+'%'};return _0x448432;}})});}_0x91b71b=_[_0x7522('0x52')]({},_0x91b71b,_0x4fc6a4['options']);var _0x319c03={'where':_0x91b71b[_0x7522('0x51')]};return db[_0x7522('0x42')][_0x7522('0x36')](_0x319c03)[_0x7522('0x26')](function(_0x14c81c){_0x388756[_0x7522('0x36')]=_0x14c81c;if(_0x4fc6a4[_0x7522('0x46')][_0x7522('0x54')]){_0x91b71b[_0x7522('0x55')]=[{'all':!![]}];}return db[_0x7522('0x42')][_0x7522('0x56')](_0x91b71b);})[_0x7522('0x26')](function(_0x1d3c35){_0x388756[_0x7522('0x57')]=_0x1d3c35;return _0x388756;})['then'](respondWithFilteredResult(_0x3ee68a,_0x91b71b))[_0x7522('0x58')](handleError(_0x3ee68a,null));};exports[_0x7522('0x59')]=function(_0xd57404,_0x39f648){var _0x1c3821={'raw':![],'where':{'id':_0xd57404[_0x7522('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x7522('0x40')}]},_0x4a6e5d={};_0x4a6e5d['model']=_[_0x7522('0x45')](db[_0x7522('0x42')]['rawAttributes']);_0x4a6e5d[_0x7522('0x46')]=_[_0x7522('0x45')](_0xd57404[_0x7522('0x46')]);_0x4a6e5d[_0x7522('0x4f')]=_[_0x7522('0x47')](_0x4a6e5d[_0x7522('0x44')],_0x4a6e5d[_0x7522('0x46')]);_0x1c3821['attributes']=_['intersection'](_0x4a6e5d[_0x7522('0x44')],qs[_0x7522('0x49')](_0xd57404[_0x7522('0x46')][_0x7522('0x49')]));_0x1c3821[_0x7522('0x48')]=_0x1c3821[_0x7522('0x48')][_0x7522('0x4a')]?_0x1c3821[_0x7522('0x48')]:_0x4a6e5d[_0x7522('0x44')];if(_0xd57404['query']['includeAll']){_0x1c3821[_0x7522('0x55')]=[{'all':!![]}];}_0x1c3821=_['merge']({},_0x1c3821,_0xd57404[_0x7522('0x5b')]);return db[_0x7522('0x42')][_0x7522('0x5c')](_0x1c3821)[_0x7522('0x26')](handleEntityNotFound(_0x39f648,null))[_0x7522('0x26')](respondWithResult(_0x39f648,null))[_0x7522('0x58')](handleError(_0x39f648,null));};exports['create']=function(_0x5e7d67,_0x386417){return db[_0x7522('0x42')][_0x7522('0x5d')](_0x5e7d67['body'],{})[_0x7522('0x26')](function(_0x3b48ed){var _0x254ff0=_0x5e7d67[_0x7522('0x5e')][_0x7522('0x5f')]({'plain':!![]});if(!_0x254ff0)throw new Error(_0x7522('0x60'));if(_0x254ff0['role']===_0x7522('0x5e')){var _0xeb84ad=_0x3b48ed[_0x7522('0x5f')]({'plain':!![]});var _0x4f1d00=_0x7522('0x61');return db[_0x7522('0x62')][_0x7522('0x5c')]({'where':{'name':_0x4f1d00,'userProfileId':_0x254ff0['userProfileId']},'raw':!![]})['then'](function(_0x592529){if(_0x592529&&_0x592529[_0x7522('0x63')]===0x0){return db['UserProfileResource'][_0x7522('0x5d')]({'name':_0xeb84ad[_0x7522('0x3c')],'resourceId':_0xeb84ad['id'],'type':_0x592529[_0x7522('0x3c')],'sectionId':_0x592529['id']},{})[_0x7522('0x26')](function(){return _0x3b48ed;});}else{return _0x3b48ed;}})[_0x7522('0x58')](function(_0x5976dc){logger[_0x7522('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5976dc);throw _0x5976dc;});}return _0x3b48ed;})[_0x7522('0x26')](respondWithResult(_0x386417,0xc9))['catch'](handleError(_0x386417,null));};exports[_0x7522('0x3a')]=function(_0x49d93a,_0x3f8ae1){if(_0x49d93a[_0x7522('0x64')]['id']){delete _0x49d93a[_0x7522('0x64')]['id'];}return db[_0x7522('0x42')][_0x7522('0x5c')]({'where':{'id':_0x49d93a[_0x7522('0x5a')]['id']},'include':[{'model':db[_0x7522('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x7522('0x26')](handleEntityNotFound(_0x3f8ae1,null))[_0x7522('0x26')](saveUpdates(_0x49d93a['body'],null))['then'](respondWithResult(_0x3f8ae1,null))[_0x7522('0x58')](handleError(_0x3f8ae1,null));};exports['destroy']=function(_0x35e14d,_0x1b5767){return db[_0x7522('0x42')][_0x7522('0x5c')]({'where':{'id':_0x35e14d[_0x7522('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1b5767,null))[_0x7522('0x26')](removeEntity(_0x1b5767,null))[_0x7522('0x58')](handleError(_0x1b5767,null));};exports['describe']=function(_0x569243,_0x75b75a){return db[_0x7522('0x42')][_0x7522('0x65')]()['then'](respondWithResult(_0x75b75a,null))['catch'](handleError(_0x75b75a,null));};exports['addDisposition']=function(_0x1fb628,_0x526170,_0x18e5b5){if(_0x1fb628[_0x7522('0x64')]['id']){delete _0x1fb628[_0x7522('0x64')]['id'];}return db['WhatsappAccount'][_0x7522('0x5c')]({'where':{'id':_0x1fb628['params']['id']}})[_0x7522('0x26')](handleEntityNotFound(_0x526170,null))[_0x7522('0x26')](function(_0x41c209){if(_0x41c209){_0x1fb628[_0x7522('0x64')][_0x7522('0x66')]=_0x41c209['id'];return db[_0x7522('0x67')][_0x7522('0x5d')](_0x1fb628[_0x7522('0x64')]);}})[_0x7522('0x26')](respondWithResult(_0x526170,null))[_0x7522('0x58')](handleError(_0x526170,null));};exports[_0x7522('0x68')]=function(_0x37aa02,_0x45c601,_0x29b188){var _0x24ff94={'raw':![],'where':{}};var _0x52c779={};var _0x535998={'count':0x0,'rows':[]};return db[_0x7522('0x42')][_0x7522('0x69')]({'where':{'id':_0x37aa02[_0x7522('0x5a')]['id']}})[_0x7522('0x26')](handleEntityNotFound(_0x45c601,null))[_0x7522('0x26')](function(_0x2f06b9){if(_0x2f06b9){_0x52c779[_0x7522('0x44')]=_[_0x7522('0x45')](db['Disposition'][_0x7522('0x6a')]);_0x52c779[_0x7522('0x46')]=_['keys'](_0x37aa02[_0x7522('0x46')]);_0x52c779[_0x7522('0x4f')]=_[_0x7522('0x47')](_0x52c779[_0x7522('0x44')],_0x52c779[_0x7522('0x46')]);_0x24ff94['attributes']=_[_0x7522('0x47')](_0x52c779[_0x7522('0x44')],qs[_0x7522('0x49')](_0x37aa02['query'][_0x7522('0x49')]));_0x24ff94[_0x7522('0x48')]=_0x24ff94[_0x7522('0x48')][_0x7522('0x4a')]?_0x24ff94['attributes']:_0x52c779[_0x7522('0x44')];if(!_0x37aa02[_0x7522('0x46')][_0x7522('0x4b')]('nolimit')){_0x24ff94['limit']=qs[_0x7522('0x35')](_0x37aa02[_0x7522('0x46')][_0x7522('0x35')]);_0x24ff94['offset']=qs[_0x7522('0x33')](_0x37aa02[_0x7522('0x46')][_0x7522('0x33')]);}_0x24ff94[_0x7522('0x6b')]=qs[_0x7522('0x4d')](_0x37aa02[_0x7522('0x46')][_0x7522('0x4d')]);_0x24ff94[_0x7522('0x51')]=qs[_0x7522('0x4f')](_[_0x7522('0x4e')](_0x37aa02[_0x7522('0x46')],_0x52c779[_0x7522('0x4f')]));_0x24ff94['where']['WhatsappAccountId']=_0x2f06b9['id'];if(_0x37aa02['query'][_0x7522('0x50')]){_0x24ff94[_0x7522('0x51')]=_[_0x7522('0x52')](_0x24ff94[_0x7522('0x51')],{'$or':_[_0x7522('0x41')](_0x24ff94['attributes'],function(_0x5ee253){var _0x9e1759={};_0x9e1759[_0x5ee253]={'$like':'%'+_0x37aa02[_0x7522('0x46')]['filter']+'%'};return _0x9e1759;})});}_0x24ff94=_[_0x7522('0x52')]({},_0x24ff94,_0x37aa02[_0x7522('0x5b')]);return db[_0x7522('0x67')][_0x7522('0x36')]({'where':_0x24ff94[_0x7522('0x51')]})[_0x7522('0x26')](function(_0x11f9cd){_0x535998['count']=_0x11f9cd;if(_0x37aa02[_0x7522('0x46')][_0x7522('0x54')]){_0x24ff94[_0x7522('0x55')]=[{'all':!![]}];}return db[_0x7522('0x67')][_0x7522('0x56')](_0x24ff94);})['then'](function(_0x324987){_0x535998['rows']=_0x324987;return _0x535998;});}})[_0x7522('0x26')](respondWithFilteredResult(_0x45c601,_0x24ff94))['catch'](handleError(_0x45c601,null));};exports['removeDispositions']=function(_0x5e442b,_0x40222f,_0x560234){return db[_0x7522('0x42')]['find']({'where':{'id':_0x5e442b[_0x7522('0x5a')]['id']}})[_0x7522('0x26')](handleEntityNotFound(_0x40222f,null))['then'](function(_0x297e33){if(_0x297e33){return _0x297e33[_0x7522('0x6c')](_0x5e442b[_0x7522('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x40222f,null))[_0x7522('0x58')](handleError(_0x40222f,null));};exports[_0x7522('0x6d')]=function(_0x248e22,_0x13a2b7,_0x38801b){if(_0x248e22[_0x7522('0x64')]['id']){delete _0x248e22[_0x7522('0x64')]['id'];}return db['WhatsappAccount'][_0x7522('0x5c')]({'where':{'id':_0x248e22['params']['id']}})[_0x7522('0x26')](handleEntityNotFound(_0x13a2b7,null))[_0x7522('0x26')](function(_0x421b9c){if(_0x421b9c){_0x248e22[_0x7522('0x64')]['WhatsappAccountId']=_0x421b9c['id'];return db[_0x7522('0x6e')][_0x7522('0x5d')](_0x248e22['body']);}})['then'](respondWithResult(_0x13a2b7,null))[_0x7522('0x58')](handleError(_0x13a2b7,null));};exports[_0x7522('0x6f')]=function(_0x42542b,_0x4c56f7,_0x10b1e9){var _0x43f9ff={'raw':![],'where':{}};var _0x3dfc43={};var _0x3d02fa={'count':0x0,'rows':[]};return db[_0x7522('0x42')]['findOne']({'where':{'id':_0x42542b[_0x7522('0x5a')]['id']}})[_0x7522('0x26')](handleEntityNotFound(_0x4c56f7,null))['then'](function(_0x3a0cda){if(_0x3a0cda){_0x3dfc43[_0x7522('0x44')]=_[_0x7522('0x45')](db[_0x7522('0x6e')][_0x7522('0x6a')]);_0x3dfc43['query']=_[_0x7522('0x45')](_0x42542b[_0x7522('0x46')]);_0x3dfc43[_0x7522('0x4f')]=_['intersection'](_0x3dfc43[_0x7522('0x44')],_0x3dfc43[_0x7522('0x46')]);_0x43f9ff[_0x7522('0x48')]=_[_0x7522('0x47')](_0x3dfc43[_0x7522('0x44')],qs[_0x7522('0x49')](_0x42542b[_0x7522('0x46')][_0x7522('0x49')]));_0x43f9ff[_0x7522('0x48')]=_0x43f9ff['attributes'][_0x7522('0x4a')]?_0x43f9ff[_0x7522('0x48')]:_0x3dfc43[_0x7522('0x44')];if(!_0x42542b[_0x7522('0x46')]['hasOwnProperty'](_0x7522('0x4c'))){_0x43f9ff['limit']=qs[_0x7522('0x35')](_0x42542b[_0x7522('0x46')][_0x7522('0x35')]);_0x43f9ff[_0x7522('0x33')]=qs[_0x7522('0x33')](_0x42542b[_0x7522('0x46')][_0x7522('0x33')]);}_0x43f9ff['order']=qs[_0x7522('0x4d')](_0x42542b[_0x7522('0x46')][_0x7522('0x4d')]);_0x43f9ff[_0x7522('0x51')]=qs[_0x7522('0x4f')](_[_0x7522('0x4e')](_0x42542b[_0x7522('0x46')],_0x3dfc43[_0x7522('0x4f')]));_0x43f9ff[_0x7522('0x51')][_0x7522('0x66')]=_0x3a0cda['id'];if(_0x42542b[_0x7522('0x46')][_0x7522('0x50')]){_0x43f9ff['where']=_['merge'](_0x43f9ff[_0x7522('0x51')],{'$or':_['map'](_0x43f9ff[_0x7522('0x48')],function(_0x58f7db){var _0x2f7983={};_0x2f7983[_0x58f7db]={'$like':'%'+_0x42542b[_0x7522('0x46')][_0x7522('0x50')]+'%'};return _0x2f7983;})});}_0x43f9ff=_[_0x7522('0x52')]({},_0x43f9ff,_0x42542b[_0x7522('0x5b')]);return db[_0x7522('0x6e')][_0x7522('0x36')]({'where':_0x43f9ff['where']})['then'](function(_0x69996d){_0x3d02fa[_0x7522('0x36')]=_0x69996d;if(_0x42542b[_0x7522('0x46')][_0x7522('0x54')]){_0x43f9ff['include']=[{'all':!![]}];}return db[_0x7522('0x6e')][_0x7522('0x56')](_0x43f9ff);})['then'](function(_0x3235f0){_0x3d02fa['rows']=_0x3235f0;return _0x3d02fa;});}})[_0x7522('0x26')](respondWithFilteredResult(_0x4c56f7,_0x43f9ff))['catch'](handleError(_0x4c56f7,null));};exports[_0x7522('0x70')]=function(_0x59f618,_0x6d8517,_0x5a1ef5){return db['WhatsappAccount']['find']({'where':{'id':_0x59f618[_0x7522('0x5a')]['id']}})[_0x7522('0x26')](handleEntityNotFound(_0x6d8517,null))[_0x7522('0x26')](function(_0x474805){if(_0x474805){return _0x474805[_0x7522('0x70')](_0x59f618['query'][_0x7522('0x71')]);}})['then'](respondWithStatusCode(_0x6d8517,null))['catch'](handleError(_0x6d8517,null));};exports[_0x7522('0x72')]=function(_0xf03b78,_0x500665,_0x54d5d7){return db['WhatsappAccount']['find']({'where':{'id':_0xf03b78[_0x7522('0x5a')]['id']}})[_0x7522('0x26')](handleEntityNotFound(_0x500665,null))[_0x7522('0x26')](function(_0x49e115){if(_0x49e115){return _0x49e115[_0x7522('0x72')](_0xf03b78[_0x7522('0x64')][_0x7522('0x71')],_[_0x7522('0x73')](_0xf03b78[_0x7522('0x64')],[_0x7522('0x71'),'id'])||{})[_0x7522('0x74')](function(_0xe24c7e){for(var _0x654c63=0x0;_0x654c63<_0xf03b78[_0x7522('0x64')]['ids'][_0x7522('0x4a')];_0x654c63+=0x1){socket[_0x7522('0x75')]('userWhatsappAccount:save',{'UserId':Number(_0xf03b78['body']['ids'][_0x654c63]),'WhatsappAccountId':Number(_0xf03b78[_0x7522('0x5a')]['id'])});}return _0xe24c7e;});}})[_0x7522('0x26')](respondWithResult(_0x500665,null))[_0x7522('0x58')](handleError(_0x500665,null));};exports[_0x7522('0x76')]=function(_0x2fc77e,_0x610610,_0x18e03a){return db['WhatsappAccount'][_0x7522('0x5c')]({'where':{'id':_0x2fc77e[_0x7522('0x5a')]['id']}})[_0x7522('0x26')](handleEntityNotFound(_0x610610,null))[_0x7522('0x26')](function(_0x5427b5){if(_0x5427b5){return _0x5427b5[_0x7522('0x76')](_0x2fc77e['query']['ids'])[_0x7522('0x26')](function(){if(_[_0x7522('0x77')](_0x2fc77e[_0x7522('0x46')]['ids'])){for(var _0x145555=0x0;_0x145555<_0x2fc77e[_0x7522('0x46')]['ids'][_0x7522('0x4a')];_0x145555+=0x1){socket[_0x7522('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x2fc77e[_0x7522('0x46')][_0x7522('0x71')][_0x145555]),'WhatsappAccountId':Number(_0x2fc77e[_0x7522('0x5a')]['id'])});}}else{socket['emit'](_0x7522('0x78'),{'UserId':Number(_0x2fc77e[_0x7522('0x46')]['ids']),'WhatsappAccountId':Number(_0x2fc77e['params']['id'])});}});}})[_0x7522('0x26')](respondWithStatusCode(_0x610610,null))[_0x7522('0x58')](handleError(_0x610610,null));};exports[_0x7522('0x79')]=function(_0x146a25,_0x3d5edb,_0x48b501){var _0x596294={};var _0x32cf23={};var _0x2ab7fd;var _0x255aa0;return db[_0x7522('0x42')][_0x7522('0x69')]({'where':{'id':_0x146a25['params']['id']}})['then'](handleEntityNotFound(_0x3d5edb,null))[_0x7522('0x26')](function(_0x93eb8){if(_0x93eb8){_0x2ab7fd=_0x93eb8;_0x32cf23[_0x7522('0x44')]=_['keys'](db[_0x7522('0x7a')][_0x7522('0x6a')]);_0x32cf23[_0x7522('0x46')]=_['keys'](_0x146a25[_0x7522('0x46')]);_0x32cf23[_0x7522('0x4f')]=_[_0x7522('0x47')](_0x32cf23[_0x7522('0x44')],_0x32cf23[_0x7522('0x46')]);_0x596294[_0x7522('0x48')]=_[_0x7522('0x47')](_0x32cf23[_0x7522('0x44')],qs[_0x7522('0x49')](_0x146a25[_0x7522('0x46')][_0x7522('0x49')]));_0x596294['attributes']=_0x596294['attributes']['length']?_0x596294[_0x7522('0x48')]:_0x32cf23[_0x7522('0x44')];_0x596294[_0x7522('0x6b')]=qs[_0x7522('0x4d')](_0x146a25[_0x7522('0x46')][_0x7522('0x4d')]);_0x596294['where']=qs[_0x7522('0x4f')](_['pick'](_0x146a25[_0x7522('0x46')],_0x32cf23[_0x7522('0x4f')]));if(_0x146a25[_0x7522('0x46')]['filter']){_0x596294['where']=_[_0x7522('0x52')](_0x596294[_0x7522('0x51')],{'$or':_['map'](_0x596294[_0x7522('0x48')],function(_0x348cb1){var _0x331636={};_0x331636[_0x348cb1]={'$like':'%'+_0x146a25[_0x7522('0x46')][_0x7522('0x50')]+'%'};return _0x331636;})});}_0x596294=_['merge']({},_0x596294,_0x146a25[_0x7522('0x5b')]);return _0x2ab7fd[_0x7522('0x79')](_0x596294);}})[_0x7522('0x26')](function(_0xd25509){if(_0xd25509){_0x255aa0=_0xd25509[_0x7522('0x4a')];if(!_0x146a25[_0x7522('0x46')][_0x7522('0x4b')](_0x7522('0x4c'))){_0x596294[_0x7522('0x35')]=qs[_0x7522('0x35')](_0x146a25[_0x7522('0x46')][_0x7522('0x35')]);_0x596294[_0x7522('0x33')]=qs[_0x7522('0x33')](_0x146a25[_0x7522('0x46')][_0x7522('0x33')]);}return _0x2ab7fd['getAgents'](_0x596294);}})['then'](function(_0x7a58c4){if(_0x7a58c4){return _0x7a58c4?{'count':_0x255aa0,'rows':_0x7a58c4}:null;}})[_0x7522('0x26')](respondWithResult(_0x3d5edb,null))['catch'](handleError(_0x3d5edb,null));};exports[_0x7522('0x7b')]=function(_0x5a8ef2,_0x5347b8){var _0x438a73=_0x5a8ef2[_0x7522('0x5a')]['id'];var _0x3efcaa=_0x5a8ef2[_0x7522('0x64')];var _0x1e9230=0xc8;var _0x28822b=null;return db[_0x7522('0x7c')][_0x7522('0x7d')]({'isolationLevel':db[_0x7522('0x7c')]['Transaction'][_0x7522('0x7e')][_0x7522('0x7f')]},function(_0x31313a){return db['WhatsappAccount']['findOne']({'where':{'id':_0x438a73},'transaction':_0x31313a})[_0x7522('0x26')](function(_0x354fa4){if(_0x354fa4){return db[_0x7522('0x80')][_0x7522('0x81')]({'where':{'WhatsappAccountId':_0x438a73},'transaction':_0x31313a})[_0x7522('0x26')](function(){var _0x4116dc=_[_0x7522('0x41')](_0x3efcaa,function(_0x5042e3){_0x5042e3['WhatsappAccountId']=_0x438a73;return _0x5042e3;});return db['WhatsappApplication'][_0x7522('0x82')](_0x4116dc,{'transaction':_0x31313a});});}else{_0x1e9230=0x194;_0x28822b=[];}});})[_0x7522('0x26')](function(){if(_0x1e9230!==0x194){return db[_0x7522('0x80')][_0x7522('0x83')]({'where':{'WhatsappAccountId':_0x438a73},'order':_0x7522('0x84')})[_0x7522('0x26')](function(_0x451fe4){_0x28822b=_0x451fe4;});}})[_0x7522('0x58')](function(_0x1c6082){_0x1e9230=0x1f4;logger[_0x7522('0x2c')](_0x1c6082[_0x7522('0x3b')]);if(_0x1c6082['name']){delete _0x1c6082[_0x7522('0x3c')];}_0x28822b=_0x1c6082;})[_0x7522('0x85')](function(){if(_0x28822b===null){_0x5347b8[_0x7522('0x2f')](_0x1e9230);}else{if(_0x1e9230===0x1f4){_0x5347b8[_0x7522('0x30')](_0x1e9230)[_0x7522('0x3d')](_0x28822b);}else{_0x5347b8['status'](_0x1e9230)[_0x7522('0x32')](_0x28822b);}}});};exports[_0x7522('0x86')]=function(_0x175fff,_0x7fa1c2,_0xf08f8b){var _0x699091={};var _0x4efe0b={};var _0x28e4fc;var _0x2e1a42;return db[_0x7522('0x42')][_0x7522('0x69')]({'where':{'id':_0x175fff[_0x7522('0x5a')]['id']}})[_0x7522('0x26')](handleEntityNotFound(_0x7fa1c2,null))['then'](function(_0x4db32b){if(_0x4db32b){_0x28e4fc=_0x4db32b;_0x4efe0b['model']=_[_0x7522('0x45')](db[_0x7522('0x80')][_0x7522('0x6a')]);_0x4efe0b['query']=_[_0x7522('0x45')](_0x175fff['query']);_0x4efe0b[_0x7522('0x4f')]=_[_0x7522('0x47')](_0x4efe0b[_0x7522('0x44')],_0x4efe0b['query']);_0x699091[_0x7522('0x48')]=_[_0x7522('0x47')](_0x4efe0b[_0x7522('0x44')],qs[_0x7522('0x49')](_0x175fff[_0x7522('0x46')][_0x7522('0x49')]));_0x699091[_0x7522('0x48')]=_0x699091[_0x7522('0x48')][_0x7522('0x4a')]?_0x699091[_0x7522('0x48')]:_0x4efe0b['model'];_0x699091['order']=qs['sort'](_0x175fff[_0x7522('0x46')][_0x7522('0x4d')]);_0x699091[_0x7522('0x51')]=qs[_0x7522('0x4f')](_[_0x7522('0x4e')](_0x175fff[_0x7522('0x46')],_0x4efe0b[_0x7522('0x4f')]));if(_0x175fff['query']['filter']){_0x699091[_0x7522('0x51')]=_[_0x7522('0x52')](_0x699091[_0x7522('0x51')],{'$or':_['map'](_0x699091[_0x7522('0x48')],function(_0x2e7cd7){var _0x368d65={};_0x368d65[_0x2e7cd7]={'$like':'%'+_0x175fff[_0x7522('0x46')]['filter']+'%'};return _0x368d65;})});}_0x699091=_[_0x7522('0x52')]({},_0x699091,_0x175fff[_0x7522('0x5b')]);return _0x28e4fc[_0x7522('0x86')](_0x699091);}})[_0x7522('0x26')](function(_0x59ff81){if(_0x59ff81){_0x2e1a42=_0x59ff81[_0x7522('0x4a')];if(!_0x175fff['query'][_0x7522('0x4b')]('nolimit')){_0x699091[_0x7522('0x35')]=qs[_0x7522('0x35')](_0x175fff['query']['limit']);_0x699091[_0x7522('0x33')]=qs[_0x7522('0x33')](_0x175fff[_0x7522('0x46')][_0x7522('0x33')]);}return _0x28e4fc[_0x7522('0x86')](_0x699091);}})[_0x7522('0x26')](function(_0x47204e){if(_0x47204e){return _0x47204e?{'count':_0x2e1a42,'rows':_0x47204e}:null;}})[_0x7522('0x26')](respondWithResult(_0x7fa1c2,null))['catch'](handleError(_0x7fa1c2,null));};exports['notify']=function(_0x4998c2,_0x2aeef2,_0x15f968){var _0x28ef1a={'channel':_0x7522('0x87')};var _0x1fb59b=[];var _0x2a45ff=[];var _0x259214={};return db[_0x7522('0x42')][_0x7522('0x5c')]({'where':{'id':_0x4998c2[_0x7522('0x5a')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x7522('0x26')](handleEntityNotFound(_0x2aeef2,null))[_0x7522('0x26')](function(_0x3295e4){_0x28ef1a[_0x7522('0x88')]=_0x3295e4;if(_0x28ef1a[_0x7522('0x88')]&&_0x28ef1a[_0x7522('0x88')]['type']===_0x7522('0x89')&&_0x4998c2[_0x7522('0x64')][_0x7522('0x8a')]){if(_0x4998c2['body'][_0x7522('0x8a')][_0x7522('0x4a')]===0x0)return;if(_0x4998c2[_0x7522('0x64')][_0x7522('0x8a')][0x0][_0x7522('0x8b')]!=='read')return;return db[_0x7522('0x8c')][_0x7522('0x3a')]({'read':!![],'readAt':_0x4998c2[_0x7522('0x64')][_0x7522('0x8a')][0x0][_0x7522('0x8d')]},{'where':{'messageId':_0x4998c2[_0x7522('0x64')][_0x7522('0x8a')][0x0]['message_id']},'individualHooks':!![]})[_0x7522('0x26')](function(_0x5cabdd){return _0x2aeef2['status'](0xc8)['json'](_0x5cabdd);});}_0x28ef1a[_0x7522('0x8e')]=_[_0x7522('0x8f')](_0x3295e4[_0x7522('0x90')],[_0x7522('0x84')],[_0x7522('0x91')]);if(_0x28ef1a[_0x7522('0x88')][_0x7522('0x90')]){delete _0x28ef1a[_0x7522('0x88')][_0x7522('0x90')];}return db[_0x7522('0x92')][_0x7522('0x65')]()['then'](function(_0x50e992){if(!_0x50e992){throw new db['Sequelize']['ValidationError'](_0x7522('0x93'));}_0x1fb59b=_[_0x7522('0x94')](_[_0x7522('0x45')](_0x50e992),[_0x7522('0x95'),_0x7522('0x96')]);_0x2a45ff=_['difference'](_[_0x7522('0x45')](_0x50e992),[_0x7522('0x95'),'updatedAt',_0x7522('0x97'),'ListId']);_0x28ef1a['body']={'mapKey':_0x7522('0x98')};if(_0x28ef1a['account']&&_0x28ef1a[_0x7522('0x88')]['type']==='twilio'){_0x28ef1a['body']['from']=_0x4998c2[_0x7522('0x64')]['From'][_0x7522('0x99')](_0x7522('0x9a'),'');_0x28ef1a[_0x7522('0x64')][_0x7522('0x64')]=_0x4998c2[_0x7522('0x64')][_0x7522('0x9b')];_0x28ef1a[_0x7522('0x64')][_0x7522('0x9c')]=_0x4998c2['body']['MessageSid'];}if(_0x28ef1a[_0x7522('0x88')]&&_0x28ef1a[_0x7522('0x88')][_0x7522('0x9d')]===_0x7522('0x89')){_0x28ef1a[_0x7522('0x64')]['from']=_0x4998c2[_0x7522('0x64')][_0x7522('0x9e')][0x0]['from'];_0x28ef1a['body']['body']=_0x4998c2['body']['notifications'][0x0][_0x7522('0x2e')][_0x7522('0x64')];_0x28ef1a['body'][_0x7522('0x9c')]=_0x4998c2[_0x7522('0x64')][_0x7522('0x9e')][0x0][_0x7522('0x9f')];}if(_0x28ef1a[_0x7522('0x64')]['id']){delete _0x28ef1a[_0x7522('0x64')]['id'];}if(_[_0x7522('0xa0')](_0x28ef1a['body'][_0x7522('0xa1')])){throw new db[(_0x7522('0xa2'))][(_0x7522('0xa3'))](_0x7522('0xa4'));}if(_['isNil'](_0x28ef1a[_0x7522('0x64')][_0x7522('0x64')])||_0x28ef1a[_0x7522('0x64')][_0x7522('0x64')]===''){throw new db[(_0x7522('0xa2'))]['ValidationError'](_0x7522('0xa5'));}if(_[_0x7522('0xa0')](_0x28ef1a['body'][_0x7522('0xa6')])){throw new db[(_0x7522('0xa2'))][(_0x7522('0xa3'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a45ff);}if(!_['includes'](_0x2a45ff,_0x28ef1a['body'][_0x7522('0xa6')])){throw new db[(_0x7522('0xa2'))][(_0x7522('0xa3'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a45ff);}_0x259214[_0x28ef1a[_0x7522('0x64')][_0x7522('0xa6')]]=_0x28ef1a[_0x7522('0x64')][_0x7522('0xa1')];return db['CmList'][_0x7522('0x5c')]({'where':{'id':_0x28ef1a[_0x7522('0x88')][_0x7522('0xa7')]},'include':[{'model':db[_0x7522('0x92')],'as':'Contacts','where':_0x259214,'limit':0x1,'order':[[_0x7522('0x96'),'DESC']]}]});})[_0x7522('0x26')](handleEntityNotFound(_0x2aeef2,null))[_0x7522('0x26')](function(_0x3100b8){if(_0x3100b8){_0x28ef1a[_0x7522('0xa8')]=_[_0x7522('0x73')](_0x3100b8,[_0x7522('0xa9')]);if(_0x3100b8[_0x7522('0xa9')][_0x7522('0x4a')]){return _0x3100b8['Contacts'][0x0];}var _0x49b7a1=_['defaults'](_0x28ef1a[_0x7522('0x64')],{'firstName':_0x28ef1a[_0x7522('0x64')][_0x7522('0xa1')],'ListId':_0x3100b8['id']});_0x49b7a1[_0x28ef1a[_0x7522('0x64')][_0x7522('0xa6')]]=_0x28ef1a[_0x7522('0x64')][_0x7522('0xa1')];return db[_0x7522('0x92')][_0x7522('0x5d')](_0x49b7a1,{'fields':_0x1fb59b,'raw':!![]});}})[_0x7522('0x26')](handleEntityNotFound(_0x2aeef2,null))['then'](function(_0x10c850){if(_0x10c850){_0x28ef1a[_0x7522('0xaa')]=_0x10c850;var _0x87d9b2={'ContactId':_0x10c850['id'],'phone':_0x28ef1a[_0x7522('0x64')]['from'],'WhatsappAccountId':_0x4998c2['params']['id']};var _0x93e85e={'ContactId':_0x10c850['id'],'WhatsappAccountId':_0x4998c2[_0x7522('0x5a')]['id'],'closed':![]};return db[_0x7522('0xab')][_0x7522('0x5c')]({'where':_0x93e85e})[_0x7522('0x26')](function(_0x27c190){if(_0x27c190){return[_0x27c190,![]];}return db['WhatsappInteraction'][_0x7522('0x5d')](_0x87d9b2)[_0x7522('0x26')](function(_0x22fd59){return[_0x22fd59,!![]];});});}})[_0x7522('0x74')](function(_0x254355,_0x34affd){_0x28ef1a[_0x7522('0xac')]=_0x254355[_0x7522('0x5f')]({'plain':!![]});_0x28ef1a[_0x7522('0xac')][_0x7522('0xad')]=![];if(_0x34affd){if(_0x28ef1a['account'][_0x7522('0xae')]){_0x28ef1a[_0x7522('0x8e')][_0x7522('0xaf')]({'id':0x0,'priority':_0x28ef1a['applications']['length']+0x1,'app':_0x7522('0xb0'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x28ef1a[_0x7522('0xac')][_0x7522('0xad')]=!![];}return db[_0x7522('0x8c')]['create']({'phone':_0x28ef1a[_0x7522('0x64')][_0x7522('0xa1')],'messageId':_0x28ef1a[_0x7522('0x64')]['messageId'],'body':_0x28ef1a['body'][_0x7522('0x64')],'WhatsappAccountId':_0x4998c2[_0x7522('0x5a')]['id'],'WhatsappInteractionId':_0x254355['id'],'direction':'in','ContactId':_0x254355[_0x7522('0xb1')],'AttachmentId':_0x28ef1a[_0x7522('0x64')][_0x7522('0xb2')]});})[_0x7522('0x26')](function(_0x1f226c){_0x28ef1a['message']=_0x1f226c;if(!_0x28ef1a[_0x7522('0xac')]['UserId'])return;return db[_0x7522('0x7a')][_0x7522('0x5c')]({'attributes':['id',_0x7522('0x3c')],'where':{'id':_0x28ef1a['interaction'][_0x7522('0xb3')]}});})['then'](function(_0x5d8945){if(_0x5d8945){_0x28ef1a['applications'][_0x7522('0xb4')]({'id':0x0,'priority':0x0,'app':_0x7522('0xb5'),'appdata':_0x5d8945[_0x7522('0x3c')]+','+(_0x28ef1a[_0x7522('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0x7522('0xb6')});}if(!_0x28ef1a[_0x7522('0xac')][_0x7522('0xb7')])return;return db[_0x7522('0xb8')][_0x7522('0x5c')]({'attributes':['id',_0x7522('0x3c')],'where':{'id':_0x28ef1a[_0x7522('0xac')]['queueId']}});})['then'](function(_0x3e9163){if(_0x3e9163){_0x28ef1a[_0x7522('0x8e')]['unshift']({'id':0x0,'priority':0x1,'app':_0x7522('0xb9'),'appdata':_0x3e9163[_0x7522('0x3c')]+','+(_0x28ef1a[_0x7522('0x88')][_0x7522('0xba')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7522('0xbb'),_0x7522('0xbc'),_0x28ef1a);})[_0x7522('0x26')](function(_0xea564a){if(_0xea564a){var _0x2e228f=0xc8;var _0x28835e='receiveMessage';logger[_0x7522('0x27')](_0x7522('0x2a'),_0x28835e,_0x2e228f,_0x7522('0xbd'));logger[_0x7522('0xbe')](_0x7522('0xbf'),_0x28835e,_0x2e228f,_0x7522('0xbd'),JSON[_0x7522('0x2b')](_0xea564a));if(_0x28ef1a[_0x7522('0x88')]['type']===_0x7522('0xc0')){return _0x2aeef2['status'](_0x2e228f)[_0x7522('0xc1')](_0x7522('0xc2'),_0x7522('0xc3'))[_0x7522('0x3d')](_0x7522('0xc4'));}else{return _0x2aeef2[_0x7522('0x30')](_0x2e228f)[_0x7522('0x32')](_0xea564a);}}});})[_0x7522('0x58')](handleError(_0x2aeef2,null));};exports[_0x7522('0x3d')]=function(_0x4c6907,_0x46f896,_0x4fa1d4){var _0xe94da6,_0x591391,_0x20779d;if(_[_0x7522('0xa0')](_0x4c6907['body'][_0x7522('0x64')])||_0x4c6907[_0x7522('0x64')][_0x7522('0x64')]===''){throw new db[(_0x7522('0xa2'))][(_0x7522('0xa3'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7522('0xa0')](_0x4c6907[_0x7522('0x64')]['to'])){throw new db[(_0x7522('0xa2'))][(_0x7522('0xa3'))]('to\x20is\x20mandatory');}_0xe94da6=_0x4c6907[_0x7522('0x64')]['to'];return db['WhatsappAccount'][_0x7522('0x5c')]({'where':{'id':_0x4c6907[_0x7522('0x5a')]['id']},'include':[{'model':db[_0x7522('0xc5')],'as':_0x7522('0xc6'),'include':[{'model':db['CmContact'],'as':_0x7522('0xa9'),'where':{'mobile':_0xe94da6},'limit':0x1,'order':[[_0x7522('0x96'),_0x7522('0xc7')]]}]}]})[_0x7522('0x26')](handleEntityNotFound(_0x46f896,null))[_0x7522('0x26')](function(_0x5a606b){if(_0x5a606b&&_0x5a606b[_0x7522('0xc6')]){_0x591391=_0x5a606b[_0x7522('0x5f')]({'plain':!![]});if(_0x591391[_0x7522('0xc6')]&&_0x591391[_0x7522('0xc6')]['Contacts'][_0x7522('0x4a')]){return _0x591391[_0x7522('0xc6')][_0x7522('0xa9')][0x0];}return db[_0x7522('0x92')][_0x7522('0x5d')](_[_0x7522('0x1e')](_0x4c6907['body'],{'firstName':_0xe94da6,'mobile':_0xe94da6,'phone':_0xe94da6,'ListId':_0x591391[_0x7522('0xa7')]}));}})['then'](handleEntityNotFound(_0x46f896,null))[_0x7522('0x26')](function(_0x8de6e5){if(_0x8de6e5){_0x20779d=_0x8de6e5;return db['WhatsappInteraction'][_0x7522('0x5c')]({'where':{'ContactId':_0x20779d['id'],'closed':![],'WhatsappAccountId':_0x591391['id']}})['then'](function(_0x57f9aa){if(_0x57f9aa){return[_0x57f9aa,![]];}return db['WhatsappInteraction'][_0x7522('0x5d')]({'UserId':_0x4c6907[_0x7522('0x5e')]['id'],'ContactId':_0x20779d['id'],'WhatsappAccountId':_0x591391['id'],'phone':_0xe94da6,'firstMsgDirection':'out','Messages':[_[_0x7522('0x52')](_0x4c6907['body'],{'read':![],'body':_0x4c6907[_0x7522('0x64')]['body'],'phone':_0xe94da6,'WhatsappAccountId':_0x591391['id'],'UserId':_0x4c6907['user']['id'],'ContactId':_0x20779d['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x7522('0xc8')}]})[_0x7522('0x26')](function(_0x50879e){return[_0x50879e,!![]];});});}})[_0x7522('0x74')](function(_0x319467,_0x5ce8fe){if(_0x5ce8fe){return _0x319467;}return db['WhatsappMessage'][_0x7522('0x5d')](_[_0x7522('0x52')](_0x4c6907[_0x7522('0x64')],{'read':![],'body':_0x4c6907[_0x7522('0x64')][_0x7522('0x64')],'phone':_0xe94da6,'WhatsappAccountId':_0x591391['id'],'WhatsappInteractionId':_0x319467['id'],'UserId':_0x4c6907['user']['id'],'ContactId':_0x20779d['id']}))['then'](function(_0x431b6a){_0x319467[_0x7522('0xc9')]['Messages']=[];_0x319467[_0x7522('0xc9')][_0x7522('0xc8')][_0x7522('0xaf')](_0x431b6a[_0x7522('0xc9')]);return _0x319467;});})[_0x7522('0x26')](respondWithResult(_0x46f896,null))['catch'](handleError(_0x46f896,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index dd09600..8f84089 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5783=['WhatsappAccount','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x2fceb5,_0x229415){var _0x35edaa=function(_0x8204e7){while(--_0x8204e7){_0x2fceb5['push'](_0x2fceb5['shift']());}};_0x35edaa(++_0x229415);}(_0x5783,0x177));var _0x3578=function(_0x587f89,_0x2272f3){_0x587f89=_0x587f89-0x0;var _0x18c8c7=_0x5783[_0x587f89];return _0x18c8c7;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x3578('0x0'))['db'][_0x3578('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3578('0x2'),'afterUpdate':_0x3578('0x3'),'afterDestroy':_0x3578('0x4')};function emitEvent(_0x4070ab){return function(_0x3ce04d,_0x5ab0fc,_0x3e5ebe){WhatsappAccountEvents[_0x3578('0x5')](_0x4070ab+':'+_0x3ce04d['id'],_0x3ce04d);WhatsappAccountEvents['emit'](_0x4070ab,_0x3ce04d);_0x3e5ebe(null);};}for(var e in events){if(events[_0x3578('0x6')](e)){var event=events[e];WhatsappAccount[_0x3578('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x4a7b=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x302258,_0x253f6e){var _0x14c9ba=function(_0x20f0d6){while(--_0x20f0d6){_0x302258['push'](_0x302258['shift']());}};_0x14c9ba(++_0x253f6e);}(_0x4a7b,0x87));var _0xb4a7=function(_0x2a624d,_0x172bd0){_0x2a624d=_0x2a624d-0x0;var _0x9fc36d=_0x4a7b[_0x2a624d];return _0x9fc36d;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xb4a7('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb4a7('0x1')](0x0);var events={'afterCreate':_0xb4a7('0x2'),'afterUpdate':'update','afterDestroy':_0xb4a7('0x3')};function emitEvent(_0xae5992){return function(_0x1b551c,_0x355bc0,_0x195dc6){WhatsappAccountEvents[_0xb4a7('0x4')](_0xae5992+':'+_0x1b551c['id'],_0x1b551c);WhatsappAccountEvents[_0xb4a7('0x4')](_0xae5992,_0x1b551c);_0x195dc6(null);};}for(var e in events){if(events[_0xb4a7('0x5')](e)){var event=events[e];WhatsappAccount[_0xb4a7('0x6')](e,emitEvent(event));}}module[_0xb4a7('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index dca5d34..eeadd8b 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5fd=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xa5fd,0x1b8));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda5f('0x0'));var util=require(_0xda5f('0x1'));var logger=require(_0xda5f('0x2'))(_0xda5f('0x3'));var moment=require(_0xda5f('0x4'));var BPromise=require('bluebird');var rp=require(_0xda5f('0x5'));var fs=require('fs');var path=require(_0xda5f('0x6'));var rimraf=require(_0xda5f('0x7'));var config=require(_0xda5f('0x8'));var attributes=require(_0xda5f('0x9'));module[_0xda5f('0xa')]=function(_0x3f7423,_0x495eea){return _0x3f7423[_0xda5f('0xb')]('WhatsappAccount',attributes,{'tableName':_0xda5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c5a=['api','moment','bluebird','request-promise','path','rimraf','exports','WhatsappAccount','whatsapp_accounts','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c5a,0x171));var _0xa3c5=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0x3c5a[_0x31df6f];return _0x31e353;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3c5('0x0'))(_0xa3c5('0x1'));var moment=require(_0xa3c5('0x2'));var BPromise=require(_0xa3c5('0x3'));var rp=require(_0xa3c5('0x4'));var fs=require('fs');var path=require(_0xa3c5('0x5'));var rimraf=require(_0xa3c5('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0xa3c5('0x7')]=function(_0x3de83e,_0x4cd577){return _0x3de83e['define'](_0xa3c5('0x8'),attributes,{'tableName':_0xa3c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index d3a3f23..e1ddf7a 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8dc7=['then','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model'];(function(_0x53e198,_0x4e0e84){var _0x3fae6f=function(_0x8e3943){while(--_0x8e3943){_0x53e198['push'](_0x53e198['shift']());}};_0x3fae6f(++_0x4e0e84);}(_0x8dc7,0xf6));var _0x78dc=function(_0x24ed8f,_0x16ead4){_0x24ed8f=_0x24ed8f-0x0;var _0x484567=_0x8dc7[_0x24ed8f];return _0x484567;};'use strict';var _=require('lodash');var util=require(_0x78dc('0x0'));var moment=require(_0x78dc('0x1'));var BPromise=require(_0x78dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x78dc('0x4'));var logger=require(_0x78dc('0x5'))(_0x78dc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x78dc('0x7')][_0x78dc('0x8')]({'port':0x232a});config[_0x78dc('0x9')]=_[_0x78dc('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x78dc('0xb'))(new Redis(config['redis']));require(_0x78dc('0xc'))[_0x78dc('0xd')](socket);function respondWithRpcPromise(_0x60c6d8,_0xf3ebd1,_0x1b1044){return new BPromise(function(_0x53fa5a,_0x4270b4){return client[_0x78dc('0xe')](_0x60c6d8,_0x1b1044)['then'](function(_0x11de0d){logger['info'](_0x78dc('0xf'),_0xf3ebd1,_0x78dc('0x10'));logger[_0x78dc('0x11')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xf3ebd1,_0x78dc('0x10'),JSON[_0x78dc('0x12')](_0x11de0d));if(_0x11de0d[_0x78dc('0x13')]){if(_0x11de0d['error'][_0x78dc('0x14')]===0x1f4){logger['error'](_0x78dc('0xf'),_0xf3ebd1,_0x11de0d[_0x78dc('0x13')]['message']);return _0x4270b4(_0x11de0d[_0x78dc('0x13')][_0x78dc('0x15')]);}logger[_0x78dc('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0xf3ebd1,_0x11de0d[_0x78dc('0x13')]['message']);return _0x53fa5a(_0x11de0d[_0x78dc('0x13')][_0x78dc('0x15')]);}else{logger[_0x78dc('0x16')](_0x78dc('0xf'),_0xf3ebd1,_0x78dc('0x10'));_0x53fa5a(_0x11de0d[_0x78dc('0x17')]['message']);}})[_0x78dc('0x18')](function(_0xf7c8ce){logger[_0x78dc('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0xf3ebd1,_0xf7c8ce);_0x4270b4(_0xf7c8ce);});});}exports[_0x78dc('0x19')]=function(_0x183f16){var _0x5cc468=this;return new Promise(function(_0x6e5f16,_0x10f03b){return db[_0x78dc('0x1a')][_0x78dc('0x1b')]({'raw':_0x183f16[_0x78dc('0x1c')]?_0x183f16[_0x78dc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x183f16[_0x78dc('0x1c')]?_0x183f16['options'][_0x78dc('0x1d')]||null:null,'attributes':_0x183f16[_0x78dc('0x1c')]?_0x183f16[_0x78dc('0x1c')][_0x78dc('0x1e')]||null:null,'include':_0x183f16[_0x78dc('0x1c')]?_0x183f16['options'][_0x78dc('0x1f')]?_[_0x78dc('0x20')](_0x183f16[_0x78dc('0x1c')]['include'],function(_0x466c9f){return{'model':db[_0x466c9f[_0x78dc('0x21')]],'as':_0x466c9f['as'],'attributes':_0x466c9f['attributes'],'include':_0x466c9f[_0x78dc('0x1f')]?_['map'](_0x466c9f['include'],function(_0x315c54){return{'model':db[_0x315c54[_0x78dc('0x21')]],'as':_0x315c54['as'],'attributes':_0x315c54[_0x78dc('0x1e')],'include':_0x315c54['include']?_['map'](_0x315c54[_0x78dc('0x1f')],function(_0x486762){return{'model':db[_0x486762[_0x78dc('0x21')]],'as':_0x486762['as'],'attributes':_0x486762[_0x78dc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x78dc('0x22')](function(_0x12b39d){logger[_0x78dc('0x16')](_0x78dc('0x19'),_0x183f16);logger['debug'](_0x78dc('0x19'),_0x183f16,JSON[_0x78dc('0x12')](_0x12b39d));_0x6e5f16(_0x12b39d);})['catch'](function(_0x46b15a){logger[_0x78dc('0x13')](_0x78dc('0x19'),_0x46b15a[_0x78dc('0x15')],_0x183f16);_0x10f03b(_0x5cc468[_0x78dc('0x13')](0x1f4,_0x46b15a[_0x78dc('0x15')]));});});}; \ No newline at end of file +var _0x57e6=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','map','include','model','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x221681,_0x28c6f7){var _0x1bc1d2=function(_0x5c82c6){while(--_0x5c82c6){_0x221681['push'](_0x221681['shift']());}};_0x1bc1d2(++_0x28c6f7);}(_0x57e6,0x177));var _0x657e=function(_0x6f5598,_0xabeb74){_0x6f5598=_0x6f5598-0x0;var _0x1e1325=_0x57e6[_0x6f5598];return _0x1e1325;};'use strict';var _=require(_0x657e('0x0'));var util=require(_0x657e('0x1'));var moment=require(_0x657e('0x2'));var BPromise=require(_0x657e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x657e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x657e('0x5'));var logger=require(_0x657e('0x6'))(_0x657e('0x7'));var config=require(_0x657e('0x8'));var jayson=require(_0x657e('0x9'));var client=jayson[_0x657e('0xa')][_0x657e('0xb')]({'port':0x232a});config[_0x657e('0xc')]=_[_0x657e('0xd')](config[_0x657e('0xc')],{'host':_0x657e('0xe'),'port':0x18eb});var socket=require(_0x657e('0xf'))(new Redis(config[_0x657e('0xc')]));require(_0x657e('0x10'))['register'](socket);function respondWithRpcPromise(_0x436b25,_0x7bc955,_0x2a4251){return new BPromise(function(_0x4b3c5f,_0x2491b1){return client[_0x657e('0x11')](_0x436b25,_0x2a4251)[_0x657e('0x12')](function(_0x116501){logger[_0x657e('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x7bc955,_0x657e('0x14'));logger[_0x657e('0x15')](_0x657e('0x16'),_0x7bc955,_0x657e('0x14'),JSON[_0x657e('0x17')](_0x116501));if(_0x116501[_0x657e('0x18')]){if(_0x116501[_0x657e('0x18')]['code']===0x1f4){logger['error'](_0x657e('0x19'),_0x7bc955,_0x116501['error']['message']);return _0x2491b1(_0x116501[_0x657e('0x18')]['message']);}logger[_0x657e('0x18')](_0x657e('0x19'),_0x7bc955,_0x116501[_0x657e('0x18')][_0x657e('0x1a')]);return _0x4b3c5f(_0x116501[_0x657e('0x18')][_0x657e('0x1a')]);}else{logger[_0x657e('0x13')](_0x657e('0x19'),_0x7bc955,_0x657e('0x14'));_0x4b3c5f(_0x116501[_0x657e('0x1b')][_0x657e('0x1a')]);}})['catch'](function(_0xd29c2e){logger[_0x657e('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x7bc955,_0xd29c2e);_0x2491b1(_0xd29c2e);});});}exports[_0x657e('0x1c')]=function(_0x936e85){var _0x187bd2=this;return new Promise(function(_0x4ba50f,_0x370848){return db[_0x657e('0x1d')]['find']({'raw':_0x936e85[_0x657e('0x1e')]?_0x936e85['options'][_0x657e('0x1f')]===undefined?!![]:![]:!![],'where':_0x936e85['options']?_0x936e85[_0x657e('0x1e')][_0x657e('0x20')]||null:null,'attributes':_0x936e85[_0x657e('0x1e')]?_0x936e85[_0x657e('0x1e')][_0x657e('0x21')]||null:null,'include':_0x936e85[_0x657e('0x1e')]?_0x936e85[_0x657e('0x1e')]['include']?_[_0x657e('0x22')](_0x936e85[_0x657e('0x1e')]['include'],function(_0x1d11b3){return{'model':db[_0x1d11b3['model']],'as':_0x1d11b3['as'],'attributes':_0x1d11b3[_0x657e('0x21')],'include':_0x1d11b3[_0x657e('0x23')]?_[_0x657e('0x22')](_0x1d11b3[_0x657e('0x23')],function(_0x2ea30a){return{'model':db[_0x2ea30a[_0x657e('0x24')]],'as':_0x2ea30a['as'],'attributes':_0x2ea30a[_0x657e('0x21')],'include':_0x2ea30a[_0x657e('0x23')]?_[_0x657e('0x22')](_0x2ea30a[_0x657e('0x23')],function(_0x229250){return{'model':db[_0x229250[_0x657e('0x24')]],'as':_0x229250['as'],'attributes':_0x229250[_0x657e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x657e('0x12')](function(_0x125a12){logger[_0x657e('0x13')]('ShowWhatsappAccount',_0x936e85);logger[_0x657e('0x15')](_0x657e('0x1c'),_0x936e85,JSON[_0x657e('0x17')](_0x125a12));_0x4ba50f(_0x125a12);})[_0x657e('0x25')](function(_0x72b252){logger[_0x657e('0x18')](_0x657e('0x1c'),_0x72b252['message'],_0x936e85);_0x370848(_0x187bd2[_0x657e('0x18')](0x1f4,_0x72b252[_0x657e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index ed8e200..445dc0f 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2d2=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x178216,_0x20a145){var _0x279c80=function(_0x370f1e){while(--_0x370f1e){_0x178216['push'](_0x178216['shift']());}};_0x279c80(++_0x20a145);}(_0xe2d2,0x65));var _0x2e2d=function(_0x38b55f,_0x321cc8){_0x38b55f=_0x38b55f-0x0;var _0x53306d=_0xe2d2[_0x38b55f];return _0x53306d;};'use strict';var WhatsappAccountEvents=require(_0x2e2d('0x0'));var events=[_0x2e2d('0x1'),_0x2e2d('0x2'),_0x2e2d('0x3')];function createListener(_0x424b7a,_0x3a55e3){return function(_0x4e7e6b){_0x3a55e3[_0x2e2d('0x4')](_0x424b7a,_0x4e7e6b);};}function removeListener(_0x259442,_0x51a4a9){return function(){WhatsappAccountEvents[_0x2e2d('0x5')](_0x259442,_0x51a4a9);};}exports[_0x2e2d('0x6')]=function(_0x3030db){for(var _0x10484c=0x0,_0x531574=events[_0x2e2d('0x7')];_0x10484c<_0x531574;_0x10484c++){var _0x42786d=events[_0x10484c];var _0x11ebcd=createListener(_0x2e2d('0x8')+_0x42786d,_0x3030db);WhatsappAccountEvents['on'](_0x42786d,_0x11ebcd);}}; \ No newline at end of file +var _0xf03f=['whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','length'];(function(_0x5e8fc,_0x1ccc06){var _0x41c58c=function(_0x495f2c){while(--_0x495f2c){_0x5e8fc['push'](_0x5e8fc['shift']());}};_0x41c58c(++_0x1ccc06);}(_0xf03f,0xa1));var _0xff03=function(_0x3806e6,_0x2f55d1){_0x3806e6=_0x3806e6-0x0;var _0x43aea8=_0xf03f[_0x3806e6];return _0x43aea8;};'use strict';var WhatsappAccountEvents=require(_0xff03('0x0'));var events=[_0xff03('0x1'),_0xff03('0x2'),_0xff03('0x3')];function createListener(_0x24d309,_0xf7807f){return function(_0x498fb2){_0xf7807f[_0xff03('0x4')](_0x24d309,_0x498fb2);};}function removeListener(_0x104302,_0x2ca703){return function(){WhatsappAccountEvents[_0xff03('0x5')](_0x104302,_0x2ca703);};}exports['register']=function(_0x4ed949){for(var _0x3c80d1=0x0,_0x2dbb84=events[_0xff03('0x6')];_0x3c80d1<_0x2dbb84;_0x3c80d1++){var _0x3e9f27=events[_0x3c80d1];var _0x62d498=createListener(_0xff03('0x7')+_0x3e9f27,_0x4ed949);WhatsappAccountEvents['on'](_0x3e9f27,_0x62d498);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1ada2c6..c8285ad 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0a6=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x6480bf,_0x42234e){var _0x32021d=function(_0x633e1c){while(--_0x633e1c){_0x6480bf['push'](_0x6480bf['shift']());}};_0x32021d(++_0x42234e);}(_0xa0a6,0xc1));var _0x6a0a=function(_0x232918,_0x83fd62){_0x232918=_0x232918-0x0;var _0x5bdd24=_0xa0a6[_0x232918];return _0x5bdd24;};'use strict';var multer=require(_0x6a0a('0x0'));var util=require('util');var path=require(_0x6a0a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6a0a('0x2')]();var fs_extra=require(_0x6a0a('0x3'));var auth=require(_0x6a0a('0x4'));var interaction=require(_0x6a0a('0x5'));var config=require(_0x6a0a('0x6'));var controller=require(_0x6a0a('0x7'));router[_0x6a0a('0x8')]('/',auth['isAuthenticated'](),controller[_0x6a0a('0x9')]);router[_0x6a0a('0x8')](_0x6a0a('0xa'),auth[_0x6a0a('0xb')](),controller[_0x6a0a('0xc')]);router[_0x6a0a('0xd')]('/',auth['isAuthenticated'](),controller[_0x6a0a('0xe')]);router[_0x6a0a('0xf')](_0x6a0a('0xa'),auth[_0x6a0a('0xb')](),controller['update']);router[_0x6a0a('0x10')](_0x6a0a('0xa'),auth[_0x6a0a('0xb')](),controller['destroy']);module[_0x6a0a('0x11')]=router; \ No newline at end of file +var _0xc1e5=['Router','../../components/interaction/service','./whatsappApplication.controller','get','/:id','isAuthenticated','show','create','put','delete','exports','util','path','connect-timeout','express'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xc1e5,0x1cd));var _0x5c1e=function(_0x5dd5fa,_0x3f5552){_0x5dd5fa=_0x5dd5fa-0x0;var _0x8c54ed=_0xc1e5[_0x5dd5fa];return _0x8c54ed;};'use strict';var multer=require('multer');var util=require(_0x5c1e('0x0'));var path=require(_0x5c1e('0x1'));var timeout=require(_0x5c1e('0x2'));var express=require(_0x5c1e('0x3'));var router=express[_0x5c1e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5c1e('0x5'));var config=require('../../config/environment');var controller=require(_0x5c1e('0x6'));router[_0x5c1e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c1e('0x7')](_0x5c1e('0x8'),auth[_0x5c1e('0x9')](),controller[_0x5c1e('0xa')]);router['post']('/',auth[_0x5c1e('0x9')](),controller[_0x5c1e('0xb')]);router[_0x5c1e('0xc')](_0x5c1e('0x8'),auth[_0x5c1e('0x9')](),controller['update']);router[_0x5c1e('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5c1e('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d4dd7d3..22f9def 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc9f=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x39462a,_0xafa23b){var _0x417529=function(_0x10800e){while(--_0x10800e){_0x39462a['push'](_0x39462a['shift']());}};_0x417529(++_0xafa23b);}(_0xcc9f,0x1c5));var _0xfcc9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcc9f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xfcc9('0x0'));module[_0xfcc9('0x1')]={'priority':{'type':Sequelize[_0xfcc9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfcc9('0x3')],'allowNull':![],'defaultValue':_0xfcc9('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfcc9('0x3')],'defaultValue':_0xfcc9('0x5')}}; \ No newline at end of file +var _0x6426=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0x6426,0xd6));var _0x6642=function(_0x5d7039,_0x56ad14){_0x5d7039=_0x5d7039-0x0;var _0x5193ec=_0x6426[_0x5d7039];return _0x5193ec;};'use strict';var Sequelize=require(_0x6642('0x0'));module[_0x6642('0x1')]={'priority':{'type':Sequelize[_0x6642('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6642('0x3')],'allowNull':![],'defaultValue':_0x6642('0x4')},'appdata':{'type':Sequelize[_0x6642('0x5')]()},'description':{'type':Sequelize[_0x6642('0x3')]},'interval':{'type':Sequelize[_0x6642('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 14e0723..b39337f 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa30a=['catch','includeAll','find','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','save','update','then','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows'];(function(_0x3d9ce8,_0xd8d033){var _0xd1947c=function(_0x777125){while(--_0x777125){_0x3d9ce8['push'](_0x3d9ce8['shift']());}};_0xd1947c(++_0xd8d033);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec992f,_0x3de2d1){_0x3de2d1=_0x3de2d1||0xcc;return function(_0xcd1d3b){if(_0xcd1d3b){return _0xec992f['sendStatus'](_0x3de2d1);}return _0xec992f[_0xaa30('0x19')](_0x3de2d1)[_0xaa30('0x1a')]();};}function respondWithResult(_0x25c02e,_0x14de74){_0x14de74=_0x14de74||0xc8;return function(_0x41f1d9){if(_0x41f1d9){return _0x25c02e[_0xaa30('0x19')](_0x14de74)[_0xaa30('0x1b')](_0x41f1d9);}};}function respondWithFilteredResult(_0x3b8095,_0x2e37af){return function(_0xfae724){if(_0xfae724){var _0x519518=typeof _0x2e37af[_0xaa30('0x1c')]==='undefined'&&typeof _0x2e37af['limit']===_0xaa30('0x1d');var _0x153939=_0xfae724[_0xaa30('0x1e')];var _0x540e36=_0x519518?0x0:_0x2e37af['offset'];var _0x53f9fd=_0x519518?_0xfae724[_0xaa30('0x1e')]:_0x2e37af['offset']+_0x2e37af[_0xaa30('0x1f')];var _0x332a0a;if(_0x53f9fd>=_0x153939){_0x53f9fd=_0x153939;_0x332a0a=0xc8;}else{_0x332a0a=0xce;}_0x3b8095['status'](_0x332a0a);return _0x3b8095['set']('Content-Range',_0x540e36+'-'+_0x53f9fd+'/'+_0x153939)[_0xaa30('0x1b')](_0xfae724);}return null;};}function patchUpdates(_0x3e4f1d){return function(_0x61b85){try{jsonpatch[_0xaa30('0x20')](_0x61b85,_0x3e4f1d,!![]);}catch(_0x43a526){return BPromise['reject'](_0x43a526);}return _0x61b85[_0xaa30('0x21')]();};}function saveUpdates(_0x24bb25,_0x2e16e7){return function(_0x2d9e35){if(_0x2d9e35){return _0x2d9e35[_0xaa30('0x22')](_0x24bb25)['then'](function(_0x325b42){return _0x325b42;});}return null;};}function removeEntity(_0x13128a,_0x2fecdd){return function(_0x326f84){if(_0x326f84){return _0x326f84['destroy']()[_0xaa30('0x23')](function(){_0x13128a[_0xaa30('0x19')](0xcc)[_0xaa30('0x1a')]();});}};}function handleEntityNotFound(_0x12da2f,_0x97b038){return function(_0x2a59ce){if(!_0x2a59ce){_0x12da2f['sendStatus'](0x194);}return _0x2a59ce;};}function handleError(_0x467850,_0x465701){_0x465701=_0x465701||0x1f4;return function(_0x5d4da8){logger[_0xaa30('0x24')](_0x5d4da8['stack']);if(_0x5d4da8[_0xaa30('0x25')]){delete _0x5d4da8[_0xaa30('0x25')];}_0x467850[_0xaa30('0x19')](_0x465701)[_0xaa30('0x26')](_0x5d4da8);};}exports[_0xaa30('0x27')]=function(_0xc10b8f,_0x6ff09a){var _0x39f708={},_0x1f288c={},_0x43fb30={'count':0x0,'rows':[]};var _0x44aa9b=_[_0xaa30('0x28')](db[_0xaa30('0x29')][_0xaa30('0x2a')],function(_0x40e4ee){return{'name':_0x40e4ee[_0xaa30('0x2b')],'type':_0x40e4ee[_0xaa30('0x2c')][_0xaa30('0x2d')]};});_0x1f288c['model']=_[_0xaa30('0x28')](_0x44aa9b,_0xaa30('0x25'));_0x1f288c[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0xc10b8f[_0xaa30('0x2e')]);_0x1f288c[_0xaa30('0x30')]=_['intersection'](_0x1f288c['model'],_0x1f288c['query']);_0x39f708[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x1f288c[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0xc10b8f[_0xaa30('0x2e')]['fields']));_0x39f708['attributes']=_0x39f708[_0xaa30('0x31')][_0xaa30('0x35')]?_0x39f708['attributes']:_0x1f288c[_0xaa30('0x33')];if(!_0xc10b8f['query'][_0xaa30('0x36')]('nolimit')){_0x39f708[_0xaa30('0x1f')]=qs[_0xaa30('0x1f')](_0xc10b8f['query'][_0xaa30('0x1f')]);_0x39f708[_0xaa30('0x1c')]=qs[_0xaa30('0x1c')](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x1c')]);}_0x39f708[_0xaa30('0x37')]=qs['sort'](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x38')]);_0x39f708['where']=qs[_0xaa30('0x30')](_[_0xaa30('0x39')](_0xc10b8f[_0xaa30('0x2e')],_0x1f288c['filters']),_0x44aa9b);if(_0xc10b8f['query'][_0xaa30('0x3a')]){_0x39f708[_0xaa30('0x3b')]=_[_0xaa30('0x3c')](_0x39f708[_0xaa30('0x3b')],{'$or':_[_0xaa30('0x28')](_0x44aa9b,function(_0x291854){if(_0x291854['type']!=='VIRTUAL'){var _0x120c43={};_0x120c43[_0x291854[_0xaa30('0x25')]]={'$like':'%'+_0xc10b8f[_0xaa30('0x2e')]['filter']+'%'};return _0x120c43;}})});}_0x39f708=_[_0xaa30('0x3c')]({},_0x39f708,_0xc10b8f[_0xaa30('0x3d')]);var _0x8fb95e={'where':_0x39f708[_0xaa30('0x3b')]};return db['WhatsappApplication'][_0xaa30('0x1e')](_0x8fb95e)[_0xaa30('0x23')](function(_0x2c5ddb){_0x43fb30[_0xaa30('0x1e')]=_0x2c5ddb;if(_0xc10b8f[_0xaa30('0x2e')]['includeAll']){_0x39f708[_0xaa30('0x3e')]=[{'all':!![]}];}return db[_0xaa30('0x29')][_0xaa30('0x3f')](_0x39f708);})[_0xaa30('0x23')](function(_0x13f08f){_0x43fb30[_0xaa30('0x40')]=_0x13f08f;return _0x43fb30;})[_0xaa30('0x23')](respondWithFilteredResult(_0x6ff09a,_0x39f708))[_0xaa30('0x41')](handleError(_0x6ff09a,null));};exports['show']=function(_0x59ef25,_0x18771d){var _0x4a170a={'raw':!![],'where':{'id':_0x59ef25['params']['id']}},_0x5208f8={};_0x5208f8[_0xaa30('0x33')]=_['keys'](db[_0xaa30('0x29')]['rawAttributes']);_0x5208f8[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0x59ef25[_0xaa30('0x2e')]);_0x5208f8[_0xaa30('0x30')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],_0x5208f8[_0xaa30('0x2e')]);_0x4a170a[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0x59ef25['query'][_0xaa30('0x34')]));_0x4a170a[_0xaa30('0x31')]=_0x4a170a[_0xaa30('0x31')][_0xaa30('0x35')]?_0x4a170a[_0xaa30('0x31')]:_0x5208f8['model'];if(_0x59ef25['query'][_0xaa30('0x42')]){_0x4a170a['include']=[{'all':!![]}];}_0x4a170a=_[_0xaa30('0x3c')]({},_0x4a170a,_0x59ef25[_0xaa30('0x3d')]);return db[_0xaa30('0x29')][_0xaa30('0x43')](_0x4a170a)[_0xaa30('0x23')](handleEntityNotFound(_0x18771d,null))[_0xaa30('0x23')](respondWithResult(_0x18771d,null))[_0xaa30('0x41')](handleError(_0x18771d,null));};exports['create']=function(_0x3cf0bb,_0x6c9da6){return db[_0xaa30('0x29')]['create'](_0x3cf0bb[_0xaa30('0x44')],{})[_0xaa30('0x23')](respondWithResult(_0x6c9da6,0xc9))['catch'](handleError(_0x6c9da6,null));};exports[_0xaa30('0x22')]=function(_0x4a8fcc,_0x25d227){if(_0x4a8fcc['body']['id']){delete _0x4a8fcc['body']['id'];}return db[_0xaa30('0x29')]['find']({'where':{'id':_0x4a8fcc['params']['id']}})[_0xaa30('0x23')](handleEntityNotFound(_0x25d227,null))[_0xaa30('0x23')](saveUpdates(_0x4a8fcc[_0xaa30('0x44')],null))[_0xaa30('0x23')](respondWithResult(_0x25d227,null))[_0xaa30('0x41')](handleError(_0x25d227,null));};exports[_0xaa30('0x45')]=function(_0x5616cd,_0x17d75d){return db[_0xaa30('0x29')][_0xaa30('0x43')]({'where':{'id':_0x5616cd['params']['id']}})['then'](handleEntityNotFound(_0x17d75d,null))['then'](removeEntity(_0x17d75d,null))['catch'](handleError(_0x17d75d,null));}; \ No newline at end of file +var _0x15ef=['bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','save','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','WhatsappApplication','include','findAll','catch','show','params','length','includeAll','options','find','create','body','update','rimraf','zip-dir','request-promise','moment'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x15ef,0x80));var _0xf15e=function(_0x471b26,_0x2058db){_0x471b26=_0x471b26-0x0;var _0x18ad9a=_0x15ef[_0x471b26];return _0x18ad9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf15e('0x0'));var zipdir=require(_0xf15e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf15e('0x2'));var moment=require(_0xf15e('0x3'));var BPromise=require(_0xf15e('0x4'));var Mustache=require(_0xf15e('0x5'));var util=require(_0xf15e('0x6'));var path=require('path');var sox=require(_0xf15e('0x7'));var csv=require(_0xf15e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf15e('0x9'));var squel=require(_0xf15e('0xa'));var crypto=require('crypto');var jsforce=require(_0xf15e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf15e('0x8'));var querystring=require(_0xf15e('0xc'));var Papa=require(_0xf15e('0xd'));var Redis=require(_0xf15e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15e('0xf'));var logger=require(_0xf15e('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf15e('0x11'));var db=require(_0xf15e('0x12'))['db'];function respondWithStatusCode(_0x8551e2,_0x5809f7){_0x5809f7=_0x5809f7||0xcc;return function(_0x442d51){if(_0x442d51){return _0x8551e2[_0xf15e('0x13')](_0x5809f7);}return _0x8551e2[_0xf15e('0x14')](_0x5809f7)['end']();};}function respondWithResult(_0x1ec4ad,_0x1d76e9){_0x1d76e9=_0x1d76e9||0xc8;return function(_0x3e1b34){if(_0x3e1b34){return _0x1ec4ad[_0xf15e('0x14')](_0x1d76e9)[_0xf15e('0x15')](_0x3e1b34);}};}function respondWithFilteredResult(_0x1cbcc3,_0x17c241){return function(_0x2d6bd7){if(_0x2d6bd7){var _0x54b94c=typeof _0x17c241[_0xf15e('0x16')]===_0xf15e('0x17')&&typeof _0x17c241['limit']===_0xf15e('0x17');var _0x4356ca=_0x2d6bd7[_0xf15e('0x18')];var _0x487018=_0x54b94c?0x0:_0x17c241['offset'];var _0x3ad067=_0x54b94c?_0x2d6bd7[_0xf15e('0x18')]:_0x17c241['offset']+_0x17c241[_0xf15e('0x19')];var _0x1f1f33;if(_0x3ad067>=_0x4356ca){_0x3ad067=_0x4356ca;_0x1f1f33=0xc8;}else{_0x1f1f33=0xce;}_0x1cbcc3[_0xf15e('0x14')](_0x1f1f33);return _0x1cbcc3['set']('Content-Range',_0x487018+'-'+_0x3ad067+'/'+_0x4356ca)[_0xf15e('0x15')](_0x2d6bd7);}return null;};}function patchUpdates(_0x3fa737){return function(_0x499658){try{jsonpatch[_0xf15e('0x1a')](_0x499658,_0x3fa737,!![]);}catch(_0x56e8c9){return BPromise['reject'](_0x56e8c9);}return _0x499658[_0xf15e('0x1b')]();};}function saveUpdates(_0x239d41,_0x389489){return function(_0x9ece34){if(_0x9ece34){return _0x9ece34['update'](_0x239d41)[_0xf15e('0x1c')](function(_0xa09c0c){return _0xa09c0c;});}return null;};}function removeEntity(_0x302b70,_0x51c06a){return function(_0x248c4b){if(_0x248c4b){return _0x248c4b[_0xf15e('0x1d')]()['then'](function(){_0x302b70['status'](0xcc)[_0xf15e('0x1e')]();});}};}function handleEntityNotFound(_0xb36af,_0x1fd237){return function(_0x471079){if(!_0x471079){_0xb36af[_0xf15e('0x13')](0x194);}return _0x471079;};}function handleError(_0x58877f,_0x48764e){_0x48764e=_0x48764e||0x1f4;return function(_0x3f9d64){logger[_0xf15e('0x1f')](_0x3f9d64['stack']);if(_0x3f9d64[_0xf15e('0x20')]){delete _0x3f9d64[_0xf15e('0x20')];}_0x58877f[_0xf15e('0x14')](_0x48764e)[_0xf15e('0x21')](_0x3f9d64);};}exports[_0xf15e('0x22')]=function(_0xff4c07,_0x1e6a63){var _0x40321a={},_0x5dd9cf={},_0x3567d5={'count':0x0,'rows':[]};var _0x17f112=_[_0xf15e('0x23')](db['WhatsappApplication'][_0xf15e('0x24')],function(_0x203711){return{'name':_0x203711['fieldName'],'type':_0x203711[_0xf15e('0x25')][_0xf15e('0x26')]};});_0x5dd9cf[_0xf15e('0x27')]=_['map'](_0x17f112,_0xf15e('0x20'));_0x5dd9cf[_0xf15e('0x28')]=_[_0xf15e('0x29')](_0xff4c07[_0xf15e('0x28')]);_0x5dd9cf['filters']=_[_0xf15e('0x2a')](_0x5dd9cf[_0xf15e('0x27')],_0x5dd9cf['query']);_0x40321a[_0xf15e('0x2b')]=_[_0xf15e('0x2a')](_0x5dd9cf[_0xf15e('0x27')],qs['fields'](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x2c')]));_0x40321a['attributes']=_0x40321a[_0xf15e('0x2b')]['length']?_0x40321a[_0xf15e('0x2b')]:_0x5dd9cf[_0xf15e('0x27')];if(!_0xff4c07['query']['hasOwnProperty'](_0xf15e('0x2d'))){_0x40321a[_0xf15e('0x19')]=qs['limit'](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x19')]);_0x40321a[_0xf15e('0x16')]=qs[_0xf15e('0x16')](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x16')]);}_0x40321a['order']=qs[_0xf15e('0x2e')](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x2e')]);_0x40321a[_0xf15e('0x2f')]=qs[_0xf15e('0x30')](_[_0xf15e('0x31')](_0xff4c07[_0xf15e('0x28')],_0x5dd9cf[_0xf15e('0x30')]),_0x17f112);if(_0xff4c07['query'][_0xf15e('0x32')]){_0x40321a['where']=_[_0xf15e('0x33')](_0x40321a[_0xf15e('0x2f')],{'$or':_[_0xf15e('0x23')](_0x17f112,function(_0x40e707){if(_0x40e707[_0xf15e('0x25')]!==_0xf15e('0x34')){var _0x4d411f={};_0x4d411f[_0x40e707[_0xf15e('0x20')]]={'$like':'%'+_0xff4c07[_0xf15e('0x28')][_0xf15e('0x32')]+'%'};return _0x4d411f;}})});}_0x40321a=_[_0xf15e('0x33')]({},_0x40321a,_0xff4c07['options']);var _0x52ebab={'where':_0x40321a[_0xf15e('0x2f')]};return db[_0xf15e('0x35')][_0xf15e('0x18')](_0x52ebab)['then'](function(_0x514c68){_0x3567d5['count']=_0x514c68;if(_0xff4c07['query']['includeAll']){_0x40321a[_0xf15e('0x36')]=[{'all':!![]}];}return db[_0xf15e('0x35')][_0xf15e('0x37')](_0x40321a);})['then'](function(_0x3a56bd){_0x3567d5['rows']=_0x3a56bd;return _0x3567d5;})[_0xf15e('0x1c')](respondWithFilteredResult(_0x1e6a63,_0x40321a))[_0xf15e('0x38')](handleError(_0x1e6a63,null));};exports[_0xf15e('0x39')]=function(_0x180d7a,_0x52bbc4){var _0xf32fc5={'raw':!![],'where':{'id':_0x180d7a[_0xf15e('0x3a')]['id']}},_0x37f0a6={};_0x37f0a6[_0xf15e('0x27')]=_[_0xf15e('0x29')](db['WhatsappApplication'][_0xf15e('0x24')]);_0x37f0a6[_0xf15e('0x28')]=_[_0xf15e('0x29')](_0x180d7a[_0xf15e('0x28')]);_0x37f0a6[_0xf15e('0x30')]=_[_0xf15e('0x2a')](_0x37f0a6[_0xf15e('0x27')],_0x37f0a6['query']);_0xf32fc5[_0xf15e('0x2b')]=_[_0xf15e('0x2a')](_0x37f0a6['model'],qs['fields'](_0x180d7a[_0xf15e('0x28')]['fields']));_0xf32fc5['attributes']=_0xf32fc5[_0xf15e('0x2b')][_0xf15e('0x3b')]?_0xf32fc5['attributes']:_0x37f0a6[_0xf15e('0x27')];if(_0x180d7a[_0xf15e('0x28')][_0xf15e('0x3c')]){_0xf32fc5[_0xf15e('0x36')]=[{'all':!![]}];}_0xf32fc5=_[_0xf15e('0x33')]({},_0xf32fc5,_0x180d7a[_0xf15e('0x3d')]);return db[_0xf15e('0x35')][_0xf15e('0x3e')](_0xf32fc5)[_0xf15e('0x1c')](handleEntityNotFound(_0x52bbc4,null))['then'](respondWithResult(_0x52bbc4,null))[_0xf15e('0x38')](handleError(_0x52bbc4,null));};exports[_0xf15e('0x3f')]=function(_0x3b79a8,_0x5b31c9){return db['WhatsappApplication'][_0xf15e('0x3f')](_0x3b79a8[_0xf15e('0x40')],{})[_0xf15e('0x1c')](respondWithResult(_0x5b31c9,0xc9))[_0xf15e('0x38')](handleError(_0x5b31c9,null));};exports[_0xf15e('0x41')]=function(_0xac7515,_0x3b5c7b){if(_0xac7515[_0xf15e('0x40')]['id']){delete _0xac7515['body']['id'];}return db[_0xf15e('0x35')][_0xf15e('0x3e')]({'where':{'id':_0xac7515['params']['id']}})[_0xf15e('0x1c')](handleEntityNotFound(_0x3b5c7b,null))['then'](saveUpdates(_0xac7515[_0xf15e('0x40')],null))[_0xf15e('0x1c')](respondWithResult(_0x3b5c7b,null))[_0xf15e('0x38')](handleError(_0x3b5c7b,null));};exports['destroy']=function(_0x46e6e9,_0x3e2fd6){return db[_0xf15e('0x35')][_0xf15e('0x3e')]({'where':{'id':_0x46e6e9[_0xf15e('0x3a')]['id']}})[_0xf15e('0x1c')](handleEntityNotFound(_0x3e2fd6,null))[_0xf15e('0x1c')](removeEntity(_0x3e2fd6,null))[_0xf15e('0x38')](handleError(_0x3e2fd6,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 013240c..e1aef9a 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b3=['../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x65ed3c,_0x57ab47){var _0x4e2397=function(_0x15d6a9){while(--_0x15d6a9){_0x65ed3c['push'](_0x65ed3c['shift']());}};_0x4e2397(++_0x57ab47);}(_0xe5b3,0x133));var _0x3e5b=function(_0x58ff4c,_0x320115){_0x58ff4c=_0x58ff4c-0x0;var _0x2a49df=_0xe5b3[_0x58ff4c];return _0x2a49df;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('WhatsappApplication',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e5b('0xd'),'collate':_0x3e5b('0xe')});}; \ No newline at end of file +var _0xc978=['bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x497ab5,_0x40cda9){var _0x3e2164=function(_0x2ab18c){while(--_0x2ab18c){_0x497ab5['push'](_0x497ab5['shift']());}};_0x3e2164(++_0x40cda9);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var logger=require(_0x8c97('0x2'))(_0x8c97('0x3'));var moment=require(_0x8c97('0x4'));var BPromise=require(_0x8c97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c97('0x6'));var rimraf=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var attributes=require(_0x8c97('0x9'));module[_0x8c97('0xa')]=function(_0x2a9434,_0xabd146){return _0x2a9434['define'](_0x8c97('0xb'),attributes,{'tableName':_0x8c97('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8c97('0xd'),'collate':_0x8c97('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 8170441..e84207f 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x53a11c,_0x393441){var _0x2680d5=function(_0xd3d1e2){while(--_0xd3d1e2){_0x53a11c['push'](_0x53a11c['shift']());}};_0x2680d5(++_0x393441);}(_0x99e9,0xb4));var _0x999e=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0x99e9[_0x5e2b34];return _0x4859f9;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','WhatsappApplication,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x526301,_0x19ec94){var _0x168318=function(_0x5bea90){while(--_0x5bea90){_0x526301['push'](_0x526301['shift']());}};_0x168318(++_0x19ec94);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2bc9d58..db0895b 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa630=['/:id/messages','getMessages','/:id/download','download','post','create','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x5aea38,_0x5f22a0){var _0x2cf0fd=function(_0x4ccfca){while(--_0x4ccfca){_0x5aea38['push'](_0x5aea38['shift']());}};_0x2cf0fd(++_0x5f22a0);}(_0xa630,0xbe));var _0x0a63=function(_0x23d06c,_0x33030a){_0x23d06c=_0x23d06c-0x0;var _0x292bf4=_0xa630[_0x23d06c];return _0x292bf4;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0x7')](_0x0a63('0xd'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0x7')](_0x0a63('0xf'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')]('/',auth['isAuthenticated'](),controller[_0x0a63('0x12')]);router[_0x0a63('0x11')](_0x0a63('0xd'),auth[_0x0a63('0x8')](),controller['addMessage']);router[_0x0a63('0x11')]('/:id/tags',auth[_0x0a63('0x8')](),interaction[_0x0a63('0x13')](_0x0a63('0x14'),_0x0a63('0x15')),controller[_0x0a63('0x16')]);router[_0x0a63('0x17')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),interaction['tracked'](_0x0a63('0x14'),'whatsappinteraction:update'),controller[_0x0a63('0x18')]);router[_0x0a63('0x19')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),interaction[_0x0a63('0x13')](_0x0a63('0x14'),_0x0a63('0x1a')),controller[_0x0a63('0x1b')]);router[_0x0a63('0x19')](_0x0a63('0x1c'),auth[_0x0a63('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xa899=['/:id/messages','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','delete','whatsappinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','getMessages','/:id/download','download','post'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa899,0x155));var _0x9a89=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0xa899[_0x1a0daa];return _0x1dbe15;};'use strict';var multer=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var path=require(_0x9a89('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a89('0x3'));var router=express[_0x9a89('0x4')]();var fs_extra=require(_0x9a89('0x5'));var auth=require(_0x9a89('0x6'));var interaction=require(_0x9a89('0x7'));var config=require(_0x9a89('0x8'));var controller=require(_0x9a89('0x9'));router[_0x9a89('0xa')]('/',auth[_0x9a89('0xb')](),controller[_0x9a89('0xc')]);router[_0x9a89('0xa')](_0x9a89('0xd'),auth[_0x9a89('0xb')](),controller['describe']);router['get'](_0x9a89('0xe'),auth[_0x9a89('0xb')](),controller['show']);router[_0x9a89('0xa')]('/:id/messages',auth[_0x9a89('0xb')](),controller[_0x9a89('0xf')]);router[_0x9a89('0xa')](_0x9a89('0x10'),auth[_0x9a89('0xb')](),controller[_0x9a89('0x11')]);router[_0x9a89('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9a89('0x12')](_0x9a89('0x13'),auth[_0x9a89('0xb')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x9a89('0xb')](),interaction[_0x9a89('0x14')]('whatsapp',_0x9a89('0x15')),controller[_0x9a89('0x16')]);router[_0x9a89('0x17')](_0x9a89('0xe'),auth['isAuthenticated'](),interaction[_0x9a89('0x14')](_0x9a89('0x18'),'whatsappinteraction:update'),controller['update']);router[_0x9a89('0x19')]('/:id',auth[_0x9a89('0xb')](),interaction[_0x9a89('0x14')]('whatsapp',_0x9a89('0x1a')),controller['destroy']);router[_0x9a89('0x19')](_0x9a89('0x1b'),auth['isAuthenticated'](),controller[_0x9a89('0x1c')]);module[_0x9a89('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index aa869bc..fd2f5d2 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e82=['STRING','out','ENUM','INTEGER','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x51e449,_0xb03365){var _0x7313ca=function(_0xe4da1e){while(--_0xe4da1e){_0x51e449['push'](_0x51e449['shift']());}};_0x7313ca(++_0xb03365);}(_0x1e82,0x8b));var _0x21e8=function(_0x1a4f37,_0x4e7395){_0x1a4f37=_0x1a4f37-0x0;var _0x41e379=_0x1e82[_0x1a4f37];return _0x41e379;};'use strict';var Sequelize=require(_0x21e8('0x0'));var moment=require(_0x21e8('0x1'));module[_0x21e8('0x2')]={'closed':{'type':Sequelize[_0x21e8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x21e8('0x4')]},'disposition':{'type':Sequelize[_0x21e8('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x21e8('0x5')]},'note':{'type':Sequelize[_0x21e8('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x21e8('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x21e8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x21e8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x21e8('0x7')]('in',_0x21e8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x21e8('0x8')]}}; \ No newline at end of file +var _0x2ffe=['out','INTEGER','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2888a4,_0x1fc157){var _0x7f650c=function(_0x5e1880){while(--_0x5e1880){_0x2888a4['push'](_0x2888a4['shift']());}};_0x7f650c(++_0x1fc157);}(_0x2ffe,0x6a));var _0xe2ff=function(_0x48f71a,_0x35a4d2){_0x48f71a=_0x48f71a-0x0;var _0x2bef5c=_0x2ffe[_0x48f71a];return _0x2bef5c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe2ff('0x0'));module[_0xe2ff('0x1')]={'closed':{'type':Sequelize[_0xe2ff('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe2ff('0x3')]},'disposition':{'type':Sequelize[_0xe2ff('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe2ff('0x4')]},'note':{'type':Sequelize[_0xe2ff('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe2ff('0x5')]('in',_0xe2ff('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe2ff('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe2ff('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe2ff('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe2ff('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 4983d2e..8c3eb1d 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x157f=['order','sort','where','pick','WhatsappInteractionId','filter','$gte','format','includeAll','rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','tmp','files','transcript-%d-%s.zip','User','fullname','push','lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','out','System','Contact','value','renderFile','views','downloadInteraction.ejs','.pdf','Whatsapp','log','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','user','catch','show','params','model','keys','query','filters','attributes','intersection','fields','include','merge','options','create','body','update','find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','length','nolimit'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x157f,0x141));var _0xf157=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x157f[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xf157('0x0'));var zipdir=require(_0xf157('0x1'));var moment=require(_0xf157('0x2'));var BPromise=require(_0xf157('0x3'));var util=require(_0xf157('0x4'));var path=require(_0xf157('0x5'));var ejs=require(_0xf157('0x6'));var fs=require('fs');var _=require(_0xf157('0x7'));var Redis=require(_0xf157('0x8'));var interaction=require(_0xf157('0x9'));var qs=require(_0xf157('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0xf157('0xb'))(_0xf157('0xc'));var config=require('../../config/environment');var db=require(_0xf157('0xd'))['db'];config[_0xf157('0xe')]=_['defaults'](config[_0xf157('0xe')],{'host':_0xf157('0xf'),'port':0x18eb});var socket=require(_0xf157('0x10'))(new Redis(config[_0xf157('0xe')]));require(_0xf157('0x11'))[_0xf157('0x12')](socket);function respondWithStatusCode(_0x5aa59e,_0x46c557){_0x46c557=_0x46c557||0xcc;return function(_0xab3f48){if(_0xab3f48){return _0x5aa59e[_0xf157('0x13')](_0x46c557);}return _0x5aa59e[_0xf157('0x14')](_0x46c557)[_0xf157('0x15')]();};}function respondWithResult(_0x4d19fd,_0x349267){_0x349267=_0x349267||0xc8;return function(_0x2456cb){if(_0x2456cb){return _0x4d19fd['status'](_0x349267)[_0xf157('0x16')](_0x2456cb);}};}function respondWithFilteredResult(_0x5756cb,_0x3ede4b){return function(_0x451274){if(_0x451274){var _0x4322e9=typeof _0x3ede4b[_0xf157('0x17')]===_0xf157('0x18')&&typeof _0x3ede4b[_0xf157('0x19')]===_0xf157('0x18');var _0x53585e=_0x451274[_0xf157('0x1a')];var _0x57e918=_0x4322e9?0x0:_0x3ede4b['offset'];var _0x3b728a=_0x4322e9?_0x451274[_0xf157('0x1a')]:_0x3ede4b[_0xf157('0x17')]+_0x3ede4b[_0xf157('0x19')];var _0x395776;if(_0x3b728a>=_0x53585e){_0x3b728a=_0x53585e;_0x395776=0xc8;}else{_0x395776=0xce;}_0x5756cb['status'](_0x395776);return _0x5756cb[_0xf157('0x1b')](_0xf157('0x1c'),_0x57e918+'-'+_0x3b728a+'/'+_0x53585e)['json'](_0x451274);}return null;};}function saveUpdates(_0x518753){return function(_0x14b73f){if(_0x14b73f){return _0x14b73f['update'](_0x518753)[_0xf157('0x1d')](function(_0x49ec6b){return _0x49ec6b;});}return null;};}function removeEntity(_0xc591da){return function(_0x1ff735){if(_0x1ff735){return _0x1ff735[_0xf157('0x1e')]()['then'](function(){_0xc591da[_0xf157('0x14')](0xcc)[_0xf157('0x15')]();});}};}function handleEntityNotFound(_0x511314){return function(_0x586db4){if(!_0x586db4){_0x511314[_0xf157('0x13')](0x194);}return _0x586db4;};}function handleError(_0x111a46,_0x2033b9){_0x2033b9=_0x2033b9||0x1f4;return function(_0x381505){logger[_0xf157('0x1f')](_0x381505[_0xf157('0x20')]);if(_0x381505[_0xf157('0x21')]){delete _0x381505[_0xf157('0x21')];}_0x111a46[_0xf157('0x14')](_0x2033b9)[_0xf157('0x22')](_0x381505);};}exports['index']=function(_0x54874c,_0x343e6e){var _0x3e3a18={};var _0x481d5f=_[_0xf157('0x23')](db[_0xf157('0x24')][_0xf157('0x25')],function(_0x434b96){return{'name':_0x434b96['fieldName'],'type':_0x434b96[_0xf157('0x26')][_0xf157('0x27')]};});_0x3e3a18=qs[_0xf157('0x28')](_0x481d5f,_0x54874c);return interaction[_0xf157('0x29')]('whatsapp',_0x54874c['query'],_0x54874c[_0xf157('0x2a')],_0x3e3a18,_0x481d5f)[_0xf157('0x1d')](respondWithFilteredResult(_0x343e6e,_0x3e3a18))[_0xf157('0x2b')](handleError(_0x343e6e,null));};exports[_0xf157('0x2c')]=function(_0x2bec90,_0x166183){var _0x3d6ce0={'raw':![],'where':{'id':_0x2bec90[_0xf157('0x2d')]['id']}},_0x31666b={};_0x31666b[_0xf157('0x2e')]=_[_0xf157('0x2f')](db[_0xf157('0x24')][_0xf157('0x25')]);_0x31666b[_0xf157('0x30')]=_[_0xf157('0x2f')](_0x2bec90[_0xf157('0x30')]);_0x31666b[_0xf157('0x31')]=_['intersection'](_0x31666b[_0xf157('0x2e')],_0x31666b['query']);_0x3d6ce0[_0xf157('0x32')]=_[_0xf157('0x33')](_0x31666b['model'],qs[_0xf157('0x34')](_0x2bec90[_0xf157('0x30')][_0xf157('0x34')]));_0x3d6ce0[_0xf157('0x32')]=_0x3d6ce0['attributes']['length']?_0x3d6ce0[_0xf157('0x32')]:_0x31666b[_0xf157('0x2e')];if(_0x2bec90['query']['includeAll']){_0x3d6ce0[_0xf157('0x35')]=[{'all':!![]}];}_0x3d6ce0=_[_0xf157('0x36')]({},_0x3d6ce0,_0x2bec90[_0xf157('0x37')]);return db['WhatsappInteraction']['find'](_0x3d6ce0)[_0xf157('0x1d')](handleEntityNotFound(_0x166183,null))['then'](respondWithResult(_0x166183,null))[_0xf157('0x2b')](handleError(_0x166183,null));};exports[_0xf157('0x38')]=function(_0x780985,_0x4de24e){return db[_0xf157('0x24')][_0xf157('0x38')](_0x780985[_0xf157('0x39')],{})['then'](respondWithResult(_0x4de24e,0xc9))['catch'](handleError(_0x4de24e,null));};exports[_0xf157('0x3a')]=function(_0x335e0b,_0xb7ca95){if(_0x335e0b[_0xf157('0x39')]['id']){delete _0x335e0b[_0xf157('0x39')]['id'];}return db[_0xf157('0x24')][_0xf157('0x3b')]({'where':{'id':_0x335e0b[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0xb7ca95,null))[_0xf157('0x1d')](saveUpdates(_0x335e0b['body'],null))[_0xf157('0x1d')](respondWithResult(_0xb7ca95,null))[_0xf157('0x2b')](handleError(_0xb7ca95,null));};exports['destroy']=function(_0xa02894,_0x3986ac){return db[_0xf157('0x24')][_0xf157('0x3b')]({'where':{'id':_0xa02894[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0x3986ac,null))['then'](removeEntity(_0x3986ac,null))[_0xf157('0x2b')](handleError(_0x3986ac,null));};exports[_0xf157('0x3c')]=function(_0x3a33c2,_0x1113f9){return db[_0xf157('0x24')]['describe']()[_0xf157('0x1d')](respondWithResult(_0x1113f9,null))[_0xf157('0x2b')](handleError(_0x1113f9,null));};exports[_0xf157('0x3d')]=function(_0x473ff7,_0x43a657){return db[_0xf157('0x3e')][_0xf157('0x3b')]({'where':{'id':_0x473ff7[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0x43a657,null))[_0xf157('0x1d')](function(_0x2e6090){if(_0x2e6090){return _0x2e6090['addMessage'](_0x473ff7[_0xf157('0x39')][_0xf157('0x3f')],_[_0xf157('0x40')](_0x473ff7[_0xf157('0x39')],[_0xf157('0x3f'),'id'])||{});}})[_0xf157('0x1d')](respondWithResult(_0x43a657,null))[_0xf157('0x2b')](handleError(_0x43a657,null));};exports[_0xf157('0x41')]=function(_0xee1e1d,_0x40e298){var _0x412543={'raw':![],'where':{}};var _0x541703={};var _0x3b3b58={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xf157('0x42')]({'where':{'id':_0xee1e1d[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0x40e298,null))[_0xf157('0x1d')](function(_0x2d8e06){if(_0x2d8e06){_0x541703[_0xf157('0x2e')]=_[_0xf157('0x2f')](db['WhatsappMessage'][_0xf157('0x25')]);_0x541703[_0xf157('0x30')]=_[_0xf157('0x2f')](_0xee1e1d[_0xf157('0x30')]);_0x541703['filters']=_[_0xf157('0x33')](_0x541703[_0xf157('0x2e')],_0x541703[_0xf157('0x30')]);_0x412543[_0xf157('0x32')]=_[_0xf157('0x33')](_0x541703[_0xf157('0x2e')],qs[_0xf157('0x34')](_0xee1e1d['query'][_0xf157('0x34')]));_0x412543[_0xf157('0x32')]=_0x412543[_0xf157('0x32')][_0xf157('0x43')]?_0x412543['attributes']:_0x541703[_0xf157('0x2e')];if(!_0xee1e1d['query']['hasOwnProperty'](_0xf157('0x44'))){_0x412543[_0xf157('0x19')]=qs[_0xf157('0x19')](_0xee1e1d['query'][_0xf157('0x19')]);_0x412543['offset']=qs[_0xf157('0x17')](_0xee1e1d[_0xf157('0x30')]['offset']);}_0x412543[_0xf157('0x45')]=qs[_0xf157('0x46')](_0xee1e1d[_0xf157('0x30')][_0xf157('0x46')]);_0x412543[_0xf157('0x47')]=qs['filters'](_[_0xf157('0x48')](_0xee1e1d[_0xf157('0x30')],_0x541703[_0xf157('0x31')]));_0x412543[_0xf157('0x47')][_0xf157('0x49')]=_0x2d8e06['id'];if(_0xee1e1d[_0xf157('0x30')]['filter']){_0x412543[_0xf157('0x47')]=_['merge'](_0x412543[_0xf157('0x47')],{'$or':_[_0xf157('0x23')](_0x412543[_0xf157('0x32')],function(_0xcc43b2){var _0x141d68={};_0x141d68[_0xcc43b2]={'$like':'%'+_0xee1e1d[_0xf157('0x30')][_0xf157('0x4a')]+'%'};return _0x141d68;})});}if(_0xee1e1d[_0xf157('0x30')]['$gte']){var _0x4a0333=_0xee1e1d[_0xf157('0x30')][_0xf157('0x4b')]['split'](',');var _0x220242={};_0x220242[_0x4a0333[0x0]]={'$gte':moment(_0x4a0333[0x1])[_0xf157('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x412543[_0xf157('0x47')]=_[_0xf157('0x36')](_0x412543[_0xf157('0x47')],_0x220242);}_0x412543=_[_0xf157('0x36')]({},_0x412543,_0xee1e1d['options']);return db[_0xf157('0x3e')][_0xf157('0x1a')]({'where':_0x412543[_0xf157('0x47')]})[_0xf157('0x1d')](function(_0x1c6b1d){_0x3b3b58['count']=_0x1c6b1d;if(_0xee1e1d[_0xf157('0x30')][_0xf157('0x4d')]){_0x412543[_0xf157('0x35')]=[{'all':!![]}];}return db[_0xf157('0x3e')][_0xf157('0x29')](_0x412543);})[_0xf157('0x1d')](function(_0x1e2d75){_0x3b3b58[_0xf157('0x4e')]=_0x1e2d75;return _0x3b3b58;});}})[_0xf157('0x1d')](respondWithFilteredResult(_0x40e298,_0x412543))[_0xf157('0x2b')](handleError(_0x40e298,null));};exports[_0xf157('0x4f')]=function(_0x3661f9,_0x2910f9){return db['WhatsappInteraction'][_0xf157('0x3b')]({'where':{'id':_0x3661f9[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0x2910f9,null))[_0xf157('0x1d')](function(_0x1d60da){if(_0x1d60da){return _0x1d60da[_0xf157('0x50')](_0x3661f9[_0xf157('0x39')][_0xf157('0x3f')],_[_0xf157('0x40')](_0x3661f9[_0xf157('0x39')],['ids','id'])||{})[_0xf157('0x51')](function(){return db[_0xf157('0x52')][_0xf157('0x29')]({'attributes':['id',_0xf157('0x21'),'color'],'where':{'id':_0x3661f9[_0xf157('0x39')][_0xf157('0x3f')]}});})[_0xf157('0x1d')](function(_0x508ac1){socket[_0xf157('0x53')](_0xf157('0x54'),{'id':Number(_0x3661f9['params']['id']),'tags':_0x508ac1||[]});return{'id':Number(_0x3661f9[_0xf157('0x2d')]['id']),'tags':_0x508ac1||[]};});}})[_0xf157('0x1d')](respondWithResult(_0x2910f9,null))[_0xf157('0x2b')](handleError(_0x2910f9,null));};exports[_0xf157('0x55')]=function(_0x19088,_0x452077){return db[_0xf157('0x24')][_0xf157('0x3b')]({'where':{'id':_0x19088[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0x452077,null))[_0xf157('0x1d')](function(_0x3db148){if(_0x3db148){return _0x3db148[_0xf157('0x55')](_0x19088[_0xf157('0x30')][_0xf157('0x3f')]);}})[_0xf157('0x1d')](respondWithStatusCode(_0x452077,null))['catch'](handleError(_0x452077,null));};exports[_0xf157('0x56')]=function(_0x40a385,_0x17b536){var _0x1edddc=moment()['unix']()[_0xf157('0x57')]();var _0x133895=path[_0xf157('0x58')](config[_0xf157('0x59')],_0xf157('0x5a'),'files',_0xf157('0x5b'));var _0x71b5a8=path[_0xf157('0x58')](config[_0xf157('0x59')],_0xf157('0x5a'),_0xf157('0x5c'),'attachments');var _0x7ff2b6=path[_0xf157('0x58')](_0x133895,_0x1edddc);var _0x3a8772=util['format'](_0xf157('0x5d'),_0x40a385[_0xf157('0x2d')]['id'],_0x1edddc);var _0x86466d=path[_0xf157('0x58')](_0x133895,_0x3a8772);var _0x3daab3=[];_0x3daab3['push']({'model':db[_0xf157('0x5e')],'as':_0xf157('0x5e'),'attributes':['id',_0xf157('0x5f')],'raw':!![]});_0x3daab3[_0xf157('0x60')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xf157('0x61')],'raw':!![]});if(_0x40a385[_0xf157('0x30')][_0xf157('0x62')]){_0x3daab3['push']({'model':db[_0xf157('0x63')],'as':_0xf157('0x63'),'raw':!![]});}var _0x1ba46f=[{'model':db[_0xf157('0x3e')],'as':_0xf157('0x64'),'attributes':['id',_0xf157('0x39'),_0xf157('0x65'),_0xf157('0x66'),_0xf157('0x67'),_0xf157('0x68')],'include':_0x3daab3}];_0x1ba46f[_0xf157('0x60')]({'model':db[_0xf157('0x69')],'as':_0xf157('0x6a'),'attributes':['id',_0xf157('0x21')]});_0x1ba46f[_0xf157('0x60')]({'model':db[_0xf157('0x5e')],'as':_0xf157('0x6b'),'attributes':['id',_0xf157('0x5f')]});return db['WhatsappInteraction'][_0xf157('0x3b')]({'where':{'id':_0x40a385[_0xf157('0x2d')]['id']},'include':_0x1ba46f})[_0xf157('0x1d')](handleEntityNotFound(_0x17b536,null))[_0xf157('0x1d')](function(_0x149bbf){if(_0x149bbf){var _0x43cb4a=_0x149bbf[_0xf157('0x6c')]({'plain':!![]});fs[_0xf157('0x6d')](_0x7ff2b6);var _0x1fb4ee={'channel':'Whatsapp','account':_0x43cb4a['Account'][_0xf157('0x21')],'agent':_0x43cb4a['Owner']?_0x43cb4a[_0xf157('0x6b')][_0xf157('0x5f')]:_0xf157('0x6e'),'createdAt':moment(_0x43cb4a[_0xf157('0x65')])['format'](_0xf157('0x6f'))[_0xf157('0x57')](),'closedAt':_0x43cb4a[_0xf157('0x70')]?moment(_0x43cb4a[_0xf157('0x71')])[_0xf157('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf157('0x57')]():'','disposition':_0x43cb4a[_0xf157('0x72')],'messages':_(_0x43cb4a[_0xf157('0x64')])['filter']({'secret':![]})[_0xf157('0x23')](function(_0x17db12){if(_0x17db12[_0xf157('0x63')]){var _0x40c71a=path[_0xf157('0x58')](_0x71b5a8,_0x17db12['Attachment'][_0xf157('0x73')]);if(fs[_0xf157('0x74')](_0x40c71a)){fs[_0xf157('0x75')](_0x40c71a)[_0xf157('0x76')](fs['createWriteStream'](path[_0xf157('0x58')](_0x7ff2b6,_0x17db12[_0xf157('0x63')]['basename'])));}}return{'date':moment(_0x17db12['createdAt'])[_0xf157('0x4c')](_0xf157('0x6f'))[_0xf157('0x57')](),'sender':_0x17db12[_0xf157('0x66')]===_0xf157('0x77')?_0x17db12[_0xf157('0x5e')]?_0x17db12[_0xf157('0x5e')][_0xf157('0x5f')]:_0xf157('0x78'):_0x17db12[_0xf157('0x79')]['firstName']+(_0x17db12[_0xf157('0x79')][_0xf157('0x61')]?'\x20'+_0x17db12['Contact'][_0xf157('0x61')]:''),'body':_0x17db12[_0xf157('0x63')]?_0x17db12['Attachment']['basename']:_0x17db12[_0xf157('0x39')],'direction':_0x17db12[_0xf157('0x66')]==='out'?'A':'C','secret':_0x17db12['secret'],'read':_0x17db12[_0xf157('0x68')],'attachment':_0x17db12['Attachment']};})[_0xf157('0x7a')]()};return ejs[_0xf157('0x7b')](path[_0xf157('0x58')](config[_0xf157('0x59')],_0xf157('0x5a'),_0xf157('0x7c'),_0xf157('0x7d')),{'interaction':_0x1fb4ee})['then'](function(_0x4689c5){var _0x47a6a4=path[_0xf157('0x58')](_0x7ff2b6,'transcript-'+_0x43cb4a['id']+'-'+_0x1edddc+_0xf157('0x7e'));var _0x16fc80={'path':_0x47a6a4,'channel':_0xf157('0x7f'),'interactionId':_0x43cb4a['id']};return pdf['createPdfFromHTML'](_0x4689c5,_0x16fc80);})[_0xf157('0x1d')](function(){return new BPromise(function(_0x5ab97e,_0xc0c42a){zipdir(_0x7ff2b6,{'saveTo':_0x86466d},function(_0x42b6b1,_0x14ffa8){if(_0x42b6b1)return _0xc0c42a(_0x42b6b1);return _0x5ab97e(_0x14ffa8);});})['then'](function(){return new BPromise(function(_0x44598a,_0x16fd10){rimraf(_0x7ff2b6,function(_0x5e5d5d){if(_0x5e5d5d)_0x16fd10(_0x5e5d5d);return _0x44598a();});});})[_0xf157('0x1d')](function(){return _0x17b536[_0xf157('0x56')](_0x86466d,_0x3a8772,function(_0x59f0ae){if(_0x59f0ae){console[_0xf157('0x80')](_0xf157('0x81'),_0x59f0ae);}else{fs['unlinkSync'](_0x86466d);}});});});}else{return _0x17b536['sendStatus'](0xc8);}})[_0xf157('0x2b')](handleError(_0x17b536,null));}; \ No newline at end of file +var _0x9195=['findAll','color','emit','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','Contact','firstName','Attachment','Messages','createdAt','secret','WhatsappAccount','Account','Owner','get','mkdirSync','fullname','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','direction','out','System','lastName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','update','then','error','stack','name','index','map','WhatsappInteraction','fieldName','type','key','getOptions','whatsapp','query','user','catch','show','params','model','keys','intersection','attributes','fields','length','merge','create','body','find','destroy','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','rawAttributes','filters','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','split','format','options','include','setTags'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9195,0x129));var _0x5919=function(_0x14cfbf,_0x2b661f){_0x14cfbf=_0x14cfbf-0x0;var _0x26b3e6=_0x9195[_0x14cfbf];return _0x26b3e6;};'use strict';var rimraf=require(_0x5919('0x0'));var zipdir=require(_0x5919('0x1'));var moment=require(_0x5919('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x5919('0x3'));var ejs=require(_0x5919('0x4'));var fs=require('fs');var _=require(_0x5919('0x5'));var Redis=require(_0x5919('0x6'));var interaction=require(_0x5919('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x5919('0x8'))(_0x5919('0x9'));var config=require(_0x5919('0xa'));var db=require(_0x5919('0xb'))['db'];config[_0x5919('0xc')]=_[_0x5919('0xd')](config[_0x5919('0xc')],{'host':_0x5919('0xe'),'port':0x18eb});var socket=require(_0x5919('0xf'))(new Redis(config[_0x5919('0xc')]));require(_0x5919('0x10'))[_0x5919('0x11')](socket);function respondWithStatusCode(_0x1896f4,_0xafc5a3){_0xafc5a3=_0xafc5a3||0xcc;return function(_0xcb25a5){if(_0xcb25a5){return _0x1896f4[_0x5919('0x12')](_0xafc5a3);}return _0x1896f4[_0x5919('0x13')](_0xafc5a3)[_0x5919('0x14')]();};}function respondWithResult(_0x454ef8,_0x56e31b){_0x56e31b=_0x56e31b||0xc8;return function(_0x2d00fe){if(_0x2d00fe){return _0x454ef8[_0x5919('0x13')](_0x56e31b)['json'](_0x2d00fe);}};}function respondWithFilteredResult(_0x340102,_0x5c2734){return function(_0x11dc32){if(_0x11dc32){var _0x374a66=typeof _0x5c2734[_0x5919('0x15')]===_0x5919('0x16')&&typeof _0x5c2734[_0x5919('0x17')]===_0x5919('0x16');var _0x18ec88=_0x11dc32[_0x5919('0x18')];var _0x46db02=_0x374a66?0x0:_0x5c2734['offset'];var _0x43f37e=_0x374a66?_0x11dc32['count']:_0x5c2734[_0x5919('0x15')]+_0x5c2734['limit'];var _0x5b5d03;if(_0x43f37e>=_0x18ec88){_0x43f37e=_0x18ec88;_0x5b5d03=0xc8;}else{_0x5b5d03=0xce;}_0x340102[_0x5919('0x13')](_0x5b5d03);return _0x340102['set'](_0x5919('0x19'),_0x46db02+'-'+_0x43f37e+'/'+_0x18ec88)['json'](_0x11dc32);}return null;};}function saveUpdates(_0x3123e3){return function(_0x30df89){if(_0x30df89){return _0x30df89[_0x5919('0x1a')](_0x3123e3)[_0x5919('0x1b')](function(_0x206c33){return _0x206c33;});}return null;};}function removeEntity(_0x185ad1){return function(_0x40fbdd){if(_0x40fbdd){return _0x40fbdd['destroy']()[_0x5919('0x1b')](function(){_0x185ad1[_0x5919('0x13')](0xcc)[_0x5919('0x14')]();});}};}function handleEntityNotFound(_0x1a2e59){return function(_0x1714b7){if(!_0x1714b7){_0x1a2e59[_0x5919('0x12')](0x194);}return _0x1714b7;};}function handleError(_0x42097f,_0x321ee1){_0x321ee1=_0x321ee1||0x1f4;return function(_0x3197ed){logger[_0x5919('0x1c')](_0x3197ed[_0x5919('0x1d')]);if(_0x3197ed[_0x5919('0x1e')]){delete _0x3197ed[_0x5919('0x1e')];}_0x42097f[_0x5919('0x13')](_0x321ee1)['send'](_0x3197ed);};}exports[_0x5919('0x1f')]=function(_0x5efc07,_0x16f741){var _0x23824c={};var _0x5170c0=_[_0x5919('0x20')](db[_0x5919('0x21')]['rawAttributes'],function(_0x217a0f){return{'name':_0x217a0f[_0x5919('0x22')],'type':_0x217a0f[_0x5919('0x23')][_0x5919('0x24')]};});_0x23824c=qs[_0x5919('0x25')](_0x5170c0,_0x5efc07);return interaction['findAll'](_0x5919('0x26'),_0x5efc07[_0x5919('0x27')],_0x5efc07[_0x5919('0x28')],_0x23824c,_0x5170c0)[_0x5919('0x1b')](respondWithFilteredResult(_0x16f741,_0x23824c))[_0x5919('0x29')](handleError(_0x16f741,null));};exports[_0x5919('0x2a')]=function(_0x3d8895,_0x5eb8bf){var _0x41336e={'raw':![],'where':{'id':_0x3d8895[_0x5919('0x2b')]['id']}},_0xd968e6={};_0xd968e6[_0x5919('0x2c')]=_[_0x5919('0x2d')](db[_0x5919('0x21')]['rawAttributes']);_0xd968e6[_0x5919('0x27')]=_[_0x5919('0x2d')](_0x3d8895[_0x5919('0x27')]);_0xd968e6['filters']=_[_0x5919('0x2e')](_0xd968e6[_0x5919('0x2c')],_0xd968e6[_0x5919('0x27')]);_0x41336e[_0x5919('0x2f')]=_[_0x5919('0x2e')](_0xd968e6[_0x5919('0x2c')],qs[_0x5919('0x30')](_0x3d8895[_0x5919('0x27')][_0x5919('0x30')]));_0x41336e[_0x5919('0x2f')]=_0x41336e[_0x5919('0x2f')][_0x5919('0x31')]?_0x41336e['attributes']:_0xd968e6[_0x5919('0x2c')];if(_0x3d8895[_0x5919('0x27')]['includeAll']){_0x41336e['include']=[{'all':!![]}];}_0x41336e=_[_0x5919('0x32')]({},_0x41336e,_0x3d8895['options']);return db[_0x5919('0x21')]['find'](_0x41336e)[_0x5919('0x1b')](handleEntityNotFound(_0x5eb8bf,null))[_0x5919('0x1b')](respondWithResult(_0x5eb8bf,null))[_0x5919('0x29')](handleError(_0x5eb8bf,null));};exports[_0x5919('0x33')]=function(_0x4b5505,_0x638258){return db[_0x5919('0x21')][_0x5919('0x33')](_0x4b5505['body'],{})[_0x5919('0x1b')](respondWithResult(_0x638258,0xc9))[_0x5919('0x29')](handleError(_0x638258,null));};exports[_0x5919('0x1a')]=function(_0x307623,_0x379d25){if(_0x307623[_0x5919('0x34')]['id']){delete _0x307623['body']['id'];}return db['WhatsappInteraction'][_0x5919('0x35')]({'where':{'id':_0x307623[_0x5919('0x2b')]['id']}})[_0x5919('0x1b')](handleEntityNotFound(_0x379d25,null))[_0x5919('0x1b')](saveUpdates(_0x307623[_0x5919('0x34')],null))[_0x5919('0x1b')](respondWithResult(_0x379d25,null))[_0x5919('0x29')](handleError(_0x379d25,null));};exports[_0x5919('0x36')]=function(_0xe66582,_0xc8d095){return db[_0x5919('0x21')][_0x5919('0x35')]({'where':{'id':_0xe66582[_0x5919('0x2b')]['id']}})[_0x5919('0x1b')](handleEntityNotFound(_0xc8d095,null))[_0x5919('0x1b')](removeEntity(_0xc8d095,null))[_0x5919('0x29')](handleError(_0xc8d095,null));};exports['describe']=function(_0x50c5c5,_0x11ad17){return db[_0x5919('0x21')]['describe']()[_0x5919('0x1b')](respondWithResult(_0x11ad17,null))[_0x5919('0x29')](handleError(_0x11ad17,null));};exports['addMessage']=function(_0x21aa72,_0x330f1e){return db[_0x5919('0x37')]['find']({'where':{'id':_0x21aa72[_0x5919('0x2b')]['id']}})[_0x5919('0x1b')](handleEntityNotFound(_0x330f1e,null))[_0x5919('0x1b')](function(_0x3a7698){if(_0x3a7698){return _0x3a7698[_0x5919('0x38')](_0x21aa72[_0x5919('0x34')][_0x5919('0x39')],_[_0x5919('0x3a')](_0x21aa72['body'],[_0x5919('0x39'),'id'])||{});}})[_0x5919('0x1b')](respondWithResult(_0x330f1e,null))[_0x5919('0x29')](handleError(_0x330f1e,null));};exports[_0x5919('0x3b')]=function(_0x2ce090,_0x30be3f){var _0x47c4e5={'raw':![],'where':{}};var _0xaaa549={};var _0x257e89={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x5919('0x3c')]({'where':{'id':_0x2ce090[_0x5919('0x2b')]['id']}})['then'](handleEntityNotFound(_0x30be3f,null))[_0x5919('0x1b')](function(_0x3e3e4a){if(_0x3e3e4a){_0xaaa549[_0x5919('0x2c')]=_['keys'](db[_0x5919('0x37')][_0x5919('0x3d')]);_0xaaa549['query']=_[_0x5919('0x2d')](_0x2ce090[_0x5919('0x27')]);_0xaaa549[_0x5919('0x3e')]=_['intersection'](_0xaaa549['model'],_0xaaa549[_0x5919('0x27')]);_0x47c4e5[_0x5919('0x2f')]=_['intersection'](_0xaaa549[_0x5919('0x2c')],qs[_0x5919('0x30')](_0x2ce090[_0x5919('0x27')][_0x5919('0x30')]));_0x47c4e5[_0x5919('0x2f')]=_0x47c4e5[_0x5919('0x2f')][_0x5919('0x31')]?_0x47c4e5[_0x5919('0x2f')]:_0xaaa549['model'];if(!_0x2ce090[_0x5919('0x27')][_0x5919('0x3f')](_0x5919('0x40'))){_0x47c4e5[_0x5919('0x17')]=qs[_0x5919('0x17')](_0x2ce090['query']['limit']);_0x47c4e5[_0x5919('0x15')]=qs[_0x5919('0x15')](_0x2ce090[_0x5919('0x27')][_0x5919('0x15')]);}_0x47c4e5['order']=qs[_0x5919('0x41')](_0x2ce090[_0x5919('0x27')][_0x5919('0x41')]);_0x47c4e5[_0x5919('0x42')]=qs[_0x5919('0x3e')](_[_0x5919('0x43')](_0x2ce090[_0x5919('0x27')],_0xaaa549[_0x5919('0x3e')]));_0x47c4e5[_0x5919('0x42')][_0x5919('0x44')]=_0x3e3e4a['id'];if(_0x2ce090[_0x5919('0x27')][_0x5919('0x45')]){_0x47c4e5['where']=_[_0x5919('0x32')](_0x47c4e5['where'],{'$or':_['map'](_0x47c4e5['attributes'],function(_0x51e2be){var _0x464b74={};_0x464b74[_0x51e2be]={'$like':'%'+_0x2ce090['query'][_0x5919('0x45')]+'%'};return _0x464b74;})});}if(_0x2ce090[_0x5919('0x27')]['$gte']){var _0x125abc=_0x2ce090['query']['$gte'][_0x5919('0x46')](',');var _0x1d4944={};_0x1d4944[_0x125abc[0x0]]={'$gte':moment(_0x125abc[0x1])[_0x5919('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x47c4e5[_0x5919('0x42')]=_[_0x5919('0x32')](_0x47c4e5[_0x5919('0x42')],_0x1d4944);}_0x47c4e5=_['merge']({},_0x47c4e5,_0x2ce090[_0x5919('0x48')]);return db['WhatsappMessage'][_0x5919('0x18')]({'where':_0x47c4e5[_0x5919('0x42')]})[_0x5919('0x1b')](function(_0x35d02a){_0x257e89[_0x5919('0x18')]=_0x35d02a;if(_0x2ce090['query']['includeAll']){_0x47c4e5[_0x5919('0x49')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x47c4e5);})[_0x5919('0x1b')](function(_0x22b989){_0x257e89['rows']=_0x22b989;return _0x257e89;});}})[_0x5919('0x1b')](respondWithFilteredResult(_0x30be3f,_0x47c4e5))['catch'](handleError(_0x30be3f,null));};exports['addTags']=function(_0x5910fa,_0x159936){return db[_0x5919('0x21')][_0x5919('0x35')]({'where':{'id':_0x5910fa[_0x5919('0x2b')]['id']}})[_0x5919('0x1b')](handleEntityNotFound(_0x159936,null))[_0x5919('0x1b')](function(_0x35b208){if(_0x35b208){return _0x35b208[_0x5919('0x4a')](_0x5910fa[_0x5919('0x34')][_0x5919('0x39')],_[_0x5919('0x3a')](_0x5910fa[_0x5919('0x34')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x5919('0x4b')]({'attributes':['id',_0x5919('0x1e'),_0x5919('0x4c')],'where':{'id':_0x5910fa[_0x5919('0x34')][_0x5919('0x39')]}});})[_0x5919('0x1b')](function(_0x1a8e8f){socket[_0x5919('0x4d')](_0x5919('0x4e'),{'id':Number(_0x5910fa[_0x5919('0x2b')]['id']),'tags':_0x1a8e8f||[]});return{'id':Number(_0x5910fa[_0x5919('0x2b')]['id']),'tags':_0x1a8e8f||[]};});}})[_0x5919('0x1b')](respondWithResult(_0x159936,null))[_0x5919('0x29')](handleError(_0x159936,null));};exports[_0x5919('0x4f')]=function(_0x1c7a04,_0xee041c){return db['WhatsappInteraction'][_0x5919('0x35')]({'where':{'id':_0x1c7a04[_0x5919('0x2b')]['id']}})['then'](handleEntityNotFound(_0xee041c,null))[_0x5919('0x1b')](function(_0x39289d){if(_0x39289d){return _0x39289d[_0x5919('0x4f')](_0x1c7a04[_0x5919('0x27')][_0x5919('0x39')]);}})[_0x5919('0x1b')](respondWithStatusCode(_0xee041c,null))[_0x5919('0x29')](handleError(_0xee041c,null));};exports[_0x5919('0x50')]=function(_0x2e9388,_0x5dfcfb){var _0x30881e=moment()['unix']()[_0x5919('0x51')]();var _0x49d130=path[_0x5919('0x52')](config[_0x5919('0x53')],_0x5919('0x54'),_0x5919('0x55'),_0x5919('0x56'));var _0xb16c45=path[_0x5919('0x52')](config['root'],_0x5919('0x54'),'files',_0x5919('0x57'));var _0x2e389a=path[_0x5919('0x52')](_0x49d130,_0x30881e);var _0x1f982f=util[_0x5919('0x47')](_0x5919('0x58'),_0x2e9388[_0x5919('0x2b')]['id'],_0x30881e);var _0x4c019e=path[_0x5919('0x52')](_0x49d130,_0x1f982f);var _0x3debd7=[];_0x3debd7[_0x5919('0x59')]({'model':db[_0x5919('0x5a')],'as':_0x5919('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x3debd7[_0x5919('0x59')]({'model':db['CmContact'],'as':_0x5919('0x5b'),'attributes':['id',_0x5919('0x5c'),'lastName'],'raw':!![]});if(_0x2e9388['query']['attachments']){_0x3debd7[_0x5919('0x59')]({'model':db['Attachment'],'as':_0x5919('0x5d'),'raw':!![]});}var _0x4ab7e7=[{'model':db['WhatsappMessage'],'as':_0x5919('0x5e'),'attributes':['id',_0x5919('0x34'),_0x5919('0x5f'),'direction',_0x5919('0x60'),'read'],'include':_0x3debd7}];_0x4ab7e7[_0x5919('0x59')]({'model':db[_0x5919('0x61')],'as':_0x5919('0x62'),'attributes':['id',_0x5919('0x1e')]});_0x4ab7e7[_0x5919('0x59')]({'model':db[_0x5919('0x5a')],'as':_0x5919('0x63'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0x2e9388[_0x5919('0x2b')]['id']},'include':_0x4ab7e7})['then'](handleEntityNotFound(_0x5dfcfb,null))[_0x5919('0x1b')](function(_0x23786e){if(_0x23786e){var _0xea3018=_0x23786e[_0x5919('0x64')]({'plain':!![]});fs[_0x5919('0x65')](_0x2e389a);var _0x324825={'channel':'Whatsapp','account':_0xea3018[_0x5919('0x62')]['name'],'agent':_0xea3018[_0x5919('0x63')]?_0xea3018[_0x5919('0x63')][_0x5919('0x66')]:_0x5919('0x67'),'createdAt':moment(_0xea3018['createdAt'])[_0x5919('0x47')](_0x5919('0x68'))['toString'](),'closedAt':_0xea3018['closed']?moment(_0xea3018[_0x5919('0x69')])[_0x5919('0x47')](_0x5919('0x68'))[_0x5919('0x51')]():'','disposition':_0xea3018[_0x5919('0x6a')],'messages':_(_0xea3018['Messages'])['filter']({'secret':![]})['map'](function(_0x63d4ef){if(_0x63d4ef['Attachment']){var _0x1e1627=path[_0x5919('0x52')](_0xb16c45,_0x63d4ef[_0x5919('0x5d')][_0x5919('0x6b')]);if(fs[_0x5919('0x6c')](_0x1e1627)){fs[_0x5919('0x6d')](_0x1e1627)['pipe'](fs[_0x5919('0x6e')](path[_0x5919('0x52')](_0x2e389a,_0x63d4ef[_0x5919('0x5d')][_0x5919('0x6b')])));}}return{'date':moment(_0x63d4ef['createdAt'])[_0x5919('0x47')](_0x5919('0x68'))[_0x5919('0x51')](),'sender':_0x63d4ef[_0x5919('0x6f')]===_0x5919('0x70')?_0x63d4ef[_0x5919('0x5a')]?_0x63d4ef['User'][_0x5919('0x66')]:_0x5919('0x71'):_0x63d4ef[_0x5919('0x5b')][_0x5919('0x5c')]+(_0x63d4ef[_0x5919('0x5b')][_0x5919('0x72')]?'\x20'+_0x63d4ef[_0x5919('0x5b')][_0x5919('0x72')]:''),'body':_0x63d4ef['Attachment']?_0x63d4ef[_0x5919('0x5d')][_0x5919('0x6b')]:_0x63d4ef[_0x5919('0x34')],'direction':_0x63d4ef[_0x5919('0x6f')]===_0x5919('0x70')?'A':'C','secret':_0x63d4ef[_0x5919('0x60')],'read':_0x63d4ef[_0x5919('0x73')],'attachment':_0x63d4ef['Attachment']};})[_0x5919('0x74')]()};return ejs[_0x5919('0x75')](path[_0x5919('0x52')](config[_0x5919('0x53')],_0x5919('0x54'),_0x5919('0x76'),_0x5919('0x77')),{'interaction':_0x324825})['then'](function(_0x5cc37a){var _0x27a051=path[_0x5919('0x52')](_0x2e389a,_0x5919('0x78')+_0xea3018['id']+'-'+_0x30881e+_0x5919('0x79'));var _0x3f979a={'path':_0x27a051,'channel':'Whatsapp','interactionId':_0xea3018['id']};return pdf[_0x5919('0x7a')](_0x5cc37a,_0x3f979a);})[_0x5919('0x1b')](function(){return new BPromise(function(_0x58f62f,_0x50bdac){zipdir(_0x2e389a,{'saveTo':_0x4c019e},function(_0x48622d,_0x47825a){if(_0x48622d)return _0x50bdac(_0x48622d);return _0x58f62f(_0x47825a);});})[_0x5919('0x1b')](function(){return new BPromise(function(_0x54cbc1,_0x437ef2){rimraf(_0x2e389a,function(_0x5e7ed1){if(_0x5e7ed1)_0x437ef2(_0x5e7ed1);return _0x54cbc1();});});})[_0x5919('0x1b')](function(){return _0x5dfcfb[_0x5919('0x50')](_0x4c019e,_0x1f982f,function(_0x1e86e3){if(_0x1e86e3){console['log']('err',_0x1e86e3);}else{fs[_0x5919('0x7b')](_0x4c019e);}});});});}else{return _0x5dfcfb[_0x5919('0x12')](0xc8);}})[_0x5919('0x29')](handleError(_0x5dfcfb,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 70d4d60..19d0087 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb910=['remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update'];(function(_0x20848c,_0x1498fe){var _0x2d83ab=function(_0x54c33b){while(--_0x54c33b){_0x20848c['push'](_0x20848c['shift']());}};_0x2d83ab(++_0x1498fe);}(_0xb910,0x12b));var _0x0b91=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xb910[_0x75f869];return _0x10af8b;};'use strict';var EventEmitter=require(_0x0b91('0x0'));var WhatsappInteraction=require(_0x0b91('0x1'))['db'][_0x0b91('0x2')];var WhatsappMessage=require(_0x0b91('0x1'))['db'][_0x0b91('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x0b91('0x4')](0x0);var events={'afterCreate':_0x0b91('0x5'),'afterUpdate':_0x0b91('0x6'),'afterDestroy':_0x0b91('0x7')};function emitEvent(_0x1bfbc7){return function(_0x432232,_0x28d88b,_0x295749){_0x432232[_0x0b91('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x156fd1){_0x432232[_0x0b91('0x9')](_0x0b91('0xa'),_0x156fd1[_0x0b91('0xb')](function(_0x44c97f){return{'id':_0x44c97f['id']};}));return WhatsappMessage[_0x0b91('0xc')]({'where':{'WhatsappInteractionId':_0x432232['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0b91('0xd')](function(_0x13b9b7){_0x432232[_0x0b91('0x9')]('unreadMessages',_0x13b9b7[_0x0b91('0xe')]);WhatsappInteractionEvents['emit'](_0x1bfbc7+':'+_0x432232['id'],_0x432232);WhatsappInteractionEvents[_0x0b91('0xf')](_0x1bfbc7,_0x432232);_0x295749(null);})['catch'](_0x295749(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x0b91('0x10')](e,emitEvent(event));}}module[_0x0b91('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x0d74=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','remove','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch'];(function(_0x54ebae,_0x3710c1){var _0x100cc3=function(_0x4d0f8a){while(--_0x4d0f8a){_0x54ebae['push'](_0x54ebae['shift']());}};_0x100cc3(++_0x3710c1);}(_0x0d74,0x146));var _0x40d7=function(_0x46fca1,_0xde43fc){_0x46fca1=_0x46fca1-0x0;var _0x5a2b5c=_0x0d74[_0x46fca1];return _0x5a2b5c;};'use strict';var EventEmitter=require(_0x40d7('0x0'));var WhatsappInteraction=require(_0x40d7('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x40d7('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x40d7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x40d7('0x4')};function emitEvent(_0xe5b915){return function(_0x3d8d4d,_0x41b9cb,_0x5edb57){_0x3d8d4d['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x416c83){_0x3d8d4d['setDataValue'](_0x40d7('0x5'),_0x416c83[_0x40d7('0x6')](function(_0x509b66){return{'id':_0x509b66['id']};}));return WhatsappMessage[_0x40d7('0x7')]({'where':{'WhatsappInteractionId':_0x3d8d4d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x40d7('0x8')](function(_0x354f80){_0x3d8d4d[_0x40d7('0x9')](_0x40d7('0xa'),_0x354f80[_0x40d7('0xb')]);WhatsappInteractionEvents['emit'](_0xe5b915+':'+_0x3d8d4d['id'],_0x3d8d4d);WhatsappInteractionEvents[_0x40d7('0xc')](_0xe5b915,_0x3d8d4d);_0x5edb57(null);})[_0x40d7('0xd')](_0x5edb57(null));};}for(var e in events){if(events[_0x40d7('0xe')](e)){var event=events[e];WhatsappInteraction[_0x40d7('0xf')](e,emitEvent(event));}}module[_0x40d7('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index c9a6ce4..bdbbeff 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62f8=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closed'];(function(_0x224dda,_0x16d0f9){var _0x2987ac=function(_0x3b1033){while(--_0x3b1033){_0x224dda['push'](_0x224dda['shift']());}};_0x2987ac(++_0x16d0f9);}(_0x62f8,0xec));var _0x862f=function(_0x3a54ca,_0x5ec382){_0x3a54ca=_0x3a54ca-0x0;var _0x552e9e=_0x62f8[_0x3a54ca];return _0x552e9e;};'use strict';var _=require(_0x862f('0x0'));var util=require(_0x862f('0x1'));var logger=require(_0x862f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x862f('0x3'));var rp=require(_0x862f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x862f('0x5'));var attributes=require(_0x862f('0x6'));module[_0x862f('0x7')]=function(_0x2368e4,_0xd388c5){return _0x2368e4['define'](_0x862f('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50b65d,_0x2bfa87,_0x3d5b2d){if(_0x50b65d[_0x862f('0x9')](_0x862f('0xa'))){_0x50b65d['closedAt']=moment()[_0x862f('0xb')](_0x862f('0xc'));}_0x3d5b2d(null,_0x50b65d);}}});}; \ No newline at end of file +var _0xde82=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xde82,0x176));var _0x2de8=function(_0x3c23ba,_0x14b27e){_0x3c23ba=_0x3c23ba-0x0;var _0x498f6a=_0xde82[_0x3c23ba];return _0x498f6a;};'use strict';var _=require(_0x2de8('0x0'));var util=require(_0x2de8('0x1'));var logger=require(_0x2de8('0x2'))(_0x2de8('0x3'));var moment=require(_0x2de8('0x4'));var BPromise=require('bluebird');var rp=require(_0x2de8('0x5'));var fs=require('fs');var path=require(_0x2de8('0x6'));var rimraf=require('rimraf');var config=require(_0x2de8('0x7'));var attributes=require(_0x2de8('0x8'));module[_0x2de8('0x9')]=function(_0x12f1c8,_0x3f5e28){return _0x12f1c8['define']('WhatsappInteraction',attributes,{'tableName':_0x2de8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c8d6c,_0x4adbb4,_0x381c54){if(_0x3c8d6c['changed'](_0x2de8('0xb'))){_0x3c8d6c[_0x2de8('0xc')]=moment()[_0x2de8('0xd')](_0x2de8('0xe'));}_0x381c54(null,_0x3c8d6c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 239a6ba..5a8c90a 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd802=['rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','catch','then','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4f81a5,_0x10432a){var _0x7be2b7=function(_0x35b8b0){while(--_0x35b8b0){_0x4f81a5['push'](_0x4f81a5['shift']());}};_0x7be2b7(++_0x10432a);}(_0xd802,0x169));var _0x2d80=function(_0x266945,_0x5c5e8c){_0x266945=_0x266945-0x0;var _0x4477d5=_0xd802[_0x266945];return _0x4477d5;};'use strict';var _=require(_0x2d80('0x0'));var util=require(_0x2d80('0x1'));var moment=require(_0x2d80('0x2'));var BPromise=require(_0x2d80('0x3'));var rs=require(_0x2d80('0x4'));var fs=require('fs');var Redis=require(_0x2d80('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d80('0x6'));var logger=require(_0x2d80('0x7'))(_0x2d80('0x8'));var config=require(_0x2d80('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2d80('0xa')]=_[_0x2d80('0xb')](config['redis'],{'host':_0x2d80('0xc'),'port':0x18eb});var socket=require(_0x2d80('0xd'))(new Redis(config['redis']));require(_0x2d80('0xe'))[_0x2d80('0xf')](socket);function respondWithRpcPromise(_0x157bdb,_0x3dc07b,_0x5ea25a){return new BPromise(function(_0x141ce6,_0x59e008){return client[_0x2d80('0x10')](_0x157bdb,_0x5ea25a)['then'](function(_0x45bdd4){logger[_0x2d80('0x11')](_0x2d80('0x12'),_0x3dc07b,_0x2d80('0x13'));logger[_0x2d80('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3dc07b,_0x2d80('0x13'),JSON['stringify'](_0x45bdd4));if(_0x45bdd4['error']){if(_0x45bdd4[_0x2d80('0x15')][_0x2d80('0x16')]===0x1f4){logger[_0x2d80('0x15')](_0x2d80('0x12'),_0x3dc07b,_0x45bdd4['error'][_0x2d80('0x17')]);return _0x59e008(_0x45bdd4[_0x2d80('0x15')][_0x2d80('0x17')]);}logger[_0x2d80('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x3dc07b,_0x45bdd4[_0x2d80('0x15')][_0x2d80('0x17')]);return _0x141ce6(_0x45bdd4['error']['message']);}else{logger[_0x2d80('0x11')](_0x2d80('0x12'),_0x3dc07b,_0x2d80('0x13'));_0x141ce6(_0x45bdd4[_0x2d80('0x18')][_0x2d80('0x17')]);}})['catch'](function(_0x58f351){logger[_0x2d80('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x3dc07b,_0x58f351);_0x59e008(_0x58f351);});});}exports[_0x2d80('0x19')]=function(_0x96d04c){var _0x11e5b4=this;return new Promise(function(_0x181040,_0xb3b00e){return db[_0x2d80('0x1a')][_0x2d80('0x1b')](_0x96d04c[_0x2d80('0x1c')],{'raw':_0x96d04c[_0x2d80('0x1d')]?_0x96d04c[_0x2d80('0x1d')][_0x2d80('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x96d04c[_0x2d80('0x1d')]?_0x96d04c['options'][_0x2d80('0x1f')]||null:null,'attributes':_0x96d04c[_0x2d80('0x1d')]?_0x96d04c[_0x2d80('0x1d')][_0x2d80('0x20')]||null:null,'limit':_0x96d04c['options']?_0x96d04c[_0x2d80('0x1d')]['limit']||null:null})['then'](function(_0x517b4b){logger[_0x2d80('0x11')](_0x2d80('0x19'),_0x96d04c);logger[_0x2d80('0x14')](_0x2d80('0x19'),_0x96d04c,JSON['stringify'](_0x517b4b));_0x181040(_0x517b4b);})[_0x2d80('0x21')](function(_0xd66d04){logger[_0x2d80('0x15')](_0x2d80('0x19'),_0xd66d04[_0x2d80('0x17')],_0x96d04c);_0xb3b00e(_0x11e5b4[_0x2d80('0x15')](0x1f4,_0xd66d04[_0x2d80('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x12dc0f){return new Promise(function(_0x412f41,_0x1022e6){return db[_0x2d80('0x1a')]['find']({'where':_0x12dc0f['options']?_0x12dc0f[_0x2d80('0x1d')][_0x2d80('0x1f')]||null:null})[_0x2d80('0x22')](function(_0x149728){if(_0x149728){return _0x149728[_0x2d80('0x23')](_0x12dc0f[_0x2d80('0x1c')][_0x2d80('0x24')],_[_0x2d80('0x25')](_0x12dc0f[_0x2d80('0x1c')],[_0x2d80('0x24'),'id'])||{});}})[_0x2d80('0x26')](function(_0x5bc566){logger[_0x2d80('0x11')](_0x2d80('0x27'),_0x12dc0f);logger[_0x2d80('0x14')](_0x2d80('0x27'),_0x12dc0f,JSON[_0x2d80('0x28')](_0x5bc566));_0x412f41(_0x5bc566);})[_0x2d80('0x21')](function(_0x5e1910){logger[_0x2d80('0x15')](_0x2d80('0x27'),_0x5e1910['message'],_0x12dc0f);_0x1022e6(_this[_0x2d80('0x15')](0x1f4,_0x5e1910[_0x2d80('0x17')]));});});}; \ No newline at end of file +var _0x888a=['error','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','stringify','catch','AddTagsToWhatsappInteraction','find','addTags','omit','spread','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x49581f,_0x351d77){var _0x526005=function(_0x422686){while(--_0x422686){_0x49581f['push'](_0x49581f['shift']());}};_0x526005(++_0x351d77);}(_0x888a,0x184));var _0xa888=function(_0x1dbecd,_0x20af26){_0x1dbecd=_0x1dbecd-0x0;var _0xae5134=_0x888a[_0x1dbecd];return _0xae5134;};'use strict';var _=require(_0xa888('0x0'));var util=require(_0xa888('0x1'));var moment=require(_0xa888('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa888('0x3'))['db'];var utils=require(_0xa888('0x4'));var logger=require(_0xa888('0x5'))(_0xa888('0x6'));var config=require(_0xa888('0x7'));var jayson=require(_0xa888('0x8'));var client=jayson[_0xa888('0x9')][_0xa888('0xa')]({'port':0x232a});config['redis']=_[_0xa888('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa888('0xc'))(new Redis(config[_0xa888('0xd')]));require(_0xa888('0xe'))[_0xa888('0xf')](socket);function respondWithRpcPromise(_0x470906,_0x62683,_0x1d2d44){return new BPromise(function(_0x46fce6,_0xd7eabe){return client[_0xa888('0x10')](_0x470906,_0x1d2d44)[_0xa888('0x11')](function(_0x4890b8){logger[_0xa888('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x62683,_0xa888('0x13'));logger[_0xa888('0x14')](_0xa888('0x15'),_0x62683,_0xa888('0x13'),JSON['stringify'](_0x4890b8));if(_0x4890b8['error']){if(_0x4890b8['error']['code']===0x1f4){logger[_0xa888('0x16')](_0xa888('0x17'),_0x62683,_0x4890b8['error'][_0xa888('0x18')]);return _0xd7eabe(_0x4890b8['error'][_0xa888('0x18')]);}logger[_0xa888('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x62683,_0x4890b8[_0xa888('0x16')][_0xa888('0x18')]);return _0x46fce6(_0x4890b8[_0xa888('0x16')][_0xa888('0x18')]);}else{logger['info'](_0xa888('0x17'),_0x62683,_0xa888('0x13'));_0x46fce6(_0x4890b8[_0xa888('0x19')][_0xa888('0x18')]);}})['catch'](function(_0x59138a){logger['error'](_0xa888('0x17'),_0x62683,_0x59138a);_0xd7eabe(_0x59138a);});});}exports[_0xa888('0x1a')]=function(_0x37dfbd){var _0x57f3f6=this;return new Promise(function(_0x16506b,_0x306eb5){return db[_0xa888('0x1b')][_0xa888('0x1c')](_0x37dfbd['body'],{'raw':_0x37dfbd[_0xa888('0x1d')]?_0x37dfbd['options'][_0xa888('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37dfbd[_0xa888('0x1d')]?_0x37dfbd[_0xa888('0x1d')][_0xa888('0x1f')]||null:null,'attributes':_0x37dfbd[_0xa888('0x1d')]?_0x37dfbd[_0xa888('0x1d')][_0xa888('0x20')]||null:null,'limit':_0x37dfbd[_0xa888('0x1d')]?_0x37dfbd[_0xa888('0x1d')]['limit']||null:null})['then'](function(_0x4ca5b0){logger[_0xa888('0x12')]('UpdateWhatsappInteraction',_0x37dfbd);logger[_0xa888('0x14')]('UpdateWhatsappInteraction',_0x37dfbd,JSON[_0xa888('0x21')](_0x4ca5b0));_0x16506b(_0x4ca5b0);})[_0xa888('0x22')](function(_0x47112b){logger[_0xa888('0x16')]('UpdateWhatsappInteraction',_0x47112b[_0xa888('0x18')],_0x37dfbd);_0x306eb5(_0x57f3f6['error'](0x1f4,_0x47112b[_0xa888('0x18')]));});});};exports[_0xa888('0x23')]=function(_0x319c4e){return new Promise(function(_0x5dfed5,_0x3a416b){return db['WhatsappInteraction'][_0xa888('0x24')]({'where':_0x319c4e['options']?_0x319c4e['options']['where']||null:null})[_0xa888('0x11')](function(_0x157930){if(_0x157930){return _0x157930[_0xa888('0x25')](_0x319c4e['body']['ids'],_[_0xa888('0x26')](_0x319c4e['body'],['ids','id'])||{});}})[_0xa888('0x27')](function(_0x4308cb){logger['info'](_0xa888('0x28'),_0x319c4e);logger[_0xa888('0x14')](_0xa888('0x28'),_0x319c4e,JSON[_0xa888('0x21')](_0x4308cb));_0x5dfed5(_0x4308cb);})[_0xa888('0x22')](function(_0x363961){logger[_0xa888('0x16')](_0xa888('0x28'),_0x363961[_0xa888('0x18')],_0x319c4e);_0x3a416b(_this[_0xa888('0x16')](0x1f4,_0x363961[_0xa888('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index eb330b0..49974df 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf10=['./whatsappInteraction.events','save','update','register','length','whatsappInteraction:'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xaf10,0xf0));var _0x0af1=function(_0x474afa,_0x3f52a4){_0x474afa=_0x474afa-0x0;var _0x43b336=_0xaf10[_0x474afa];return _0x43b336;};'use strict';var WhatsappInteractionEvents=require(_0x0af1('0x0'));var events=[_0x0af1('0x1'),'remove',_0x0af1('0x2')];function createListener(_0x3788b2,_0x2f1ff2){return function(_0x5ad7ad){_0x2f1ff2['emit'](_0x3788b2,_0x5ad7ad);};}function removeListener(_0x222245,_0x17cc93){return function(){WhatsappInteractionEvents['removeListener'](_0x222245,_0x17cc93);};}exports[_0x0af1('0x3')]=function(_0x5ecff8){for(var _0x5d4795=0x0,_0xe52596=events[_0x0af1('0x4')];_0x5d4795<_0xe52596;_0x5d4795++){var _0x29a964=events[_0x5d4795];var _0xd53610=createListener(_0x0af1('0x5')+_0x29a964,_0x5ecff8);WhatsappInteractionEvents['on'](_0x29a964,_0xd53610);}}; \ No newline at end of file +var _0x0b3e=['emit','register','whatsappInteraction:','save','remove','update'];(function(_0x346825,_0x3a2583){var _0x181f63=function(_0x1aaaa0){while(--_0x1aaaa0){_0x346825['push'](_0x346825['shift']());}};_0x181f63(++_0x3a2583);}(_0x0b3e,0xff));var _0xe0b3=function(_0x4dfd48,_0x547e5e){_0x4dfd48=_0x4dfd48-0x0;var _0x66a426=_0x0b3e[_0x4dfd48];return _0x66a426;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xe0b3('0x0'),_0xe0b3('0x1'),_0xe0b3('0x2')];function createListener(_0x6cd62,_0x2db339){return function(_0x3acd87){_0x2db339[_0xe0b3('0x3')](_0x6cd62,_0x3acd87);};}function removeListener(_0x57fefa,_0x474e93){return function(){WhatsappInteractionEvents['removeListener'](_0x57fefa,_0x474e93);};}exports[_0xe0b3('0x4')]=function(_0x159bce){for(var _0x32a222=0x0,_0x3374df=events['length'];_0x32a222<_0x3374df;_0x32a222++){var _0xb5f5f1=events[_0x32a222];var _0x55205b=createListener(_0xe0b3('0x5')+_0xb5f5f1,_0x159bce);WhatsappInteractionEvents['on'](_0xb5f5f1,_0x55205b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3aed46d..6fbdacd 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29d5=['multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','tracked','whatsapp','whatsappmessage:create','post','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x49f1dc,_0x359c51){var _0x442d8c=function(_0x4fd3bb){while(--_0x4fd3bb){_0x49f1dc['push'](_0x49f1dc['shift']());}};_0x442d8c(++_0x359c51);}(_0x29d5,0xc4));var _0x529d=function(_0x792207,_0x13e198){_0x792207=_0x792207-0x0;var _0x1b99c8=_0x29d5[_0x792207];return _0x1b99c8;};'use strict';var multer=require(_0x529d('0x0'));var util=require(_0x529d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x529d('0x2')]();var fs_extra=require(_0x529d('0x3'));var auth=require(_0x529d('0x4'));var interaction=require(_0x529d('0x5'));var config=require(_0x529d('0x6'));var controller=require(_0x529d('0x7'));router['get']('/',auth[_0x529d('0x8')](),controller[_0x529d('0x9')]);router['get'](_0x529d('0xa'),auth[_0x529d('0x8')](),controller[_0x529d('0xb')]);router[_0x529d('0xc')](_0x529d('0xd'),auth[_0x529d('0x8')](),controller[_0x529d('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x529d('0xf')](_0x529d('0x10'),_0x529d('0x11')),controller['create']);router[_0x529d('0x12')]('/:id/status',controller[_0x529d('0x13')]);router[_0x529d('0x14')](_0x529d('0xd'),auth['isAuthenticated'](),controller[_0x529d('0x15')]);router[_0x529d('0x14')](_0x529d('0x16'),auth['isAuthenticated'](),controller[_0x529d('0x17')]);router[_0x529d('0x14')](_0x529d('0x18'),auth[_0x529d('0x8')](),controller[_0x529d('0x19')]);router[_0x529d('0x1a')](_0x529d('0xd'),auth[_0x529d('0x8')](),controller[_0x529d('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xaacd=['index','/describe','/:id','isAuthenticated','whatsapp','whatsappmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5ad144,_0x31a974){var _0x20b605=function(_0x2a8c24){while(--_0x2a8c24){_0x5ad144['push'](_0x5ad144['shift']());}};_0x20b605(++_0x31a974);}(_0xaacd,0x73));var _0xdaac=function(_0x3cbf4c,_0x3c5832){_0x3cbf4c=_0x3cbf4c-0x0;var _0x5e65b7=_0xaacd[_0x3cbf4c];return _0x5e65b7;};'use strict';var multer=require(_0xdaac('0x0'));var util=require('util');var path=require(_0xdaac('0x1'));var timeout=require(_0xdaac('0x2'));var express=require(_0xdaac('0x3'));var router=express[_0xdaac('0x4')]();var fs_extra=require(_0xdaac('0x5'));var auth=require(_0xdaac('0x6'));var interaction=require(_0xdaac('0x7'));var config=require(_0xdaac('0x8'));var controller=require('./whatsappMessage.controller');router[_0xdaac('0x9')]('/',auth['isAuthenticated'](),controller[_0xdaac('0xa')]);router[_0xdaac('0x9')](_0xdaac('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xdaac('0xc'),auth[_0xdaac('0xd')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xdaac('0xe'),_0xdaac('0xf')),controller['create']);router['post'](_0xdaac('0x10'),controller[_0xdaac('0x11')]);router[_0xdaac('0x12')](_0xdaac('0xc'),auth['isAuthenticated'](),controller[_0xdaac('0x13')]);router[_0xdaac('0x12')](_0xdaac('0x14'),auth[_0xdaac('0xd')](),controller[_0xdaac('0x15')]);router['put'](_0xdaac('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0xdaac('0x17')](_0xdaac('0xc'),auth[_0xdaac('0xd')](),controller[_0xdaac('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 6ddae99..e2f9a2e 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeedb=['medium','BOOLEAN','out','STRING','DATE','TEXT','sequelize','exports'];(function(_0x1b57ab,_0x5b8b1b){var _0x331f67=function(_0x3b8dcc){while(--_0x3b8dcc){_0x1b57ab['push'](_0x1b57ab['shift']());}};_0x331f67(++_0x5b8b1b);}(_0xeedb,0xc6));var _0xbeed=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xeedb[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0xbeed('0x0'));module[_0xbeed('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbeed('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbeed('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbeed('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xbeed('0x5')]},'readAt':{'type':Sequelize[_0xbeed('0x6')]},'secret':{'type':Sequelize[_0xbeed('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbeed('0x5')]},'providerResponse':{'type':Sequelize[_0xbeed('0x7')]}}; \ No newline at end of file +var _0x1fbe=['exports','TEXT','medium','ENUM','out','STRING','BOOLEAN','sequelize'];(function(_0x8c798c,_0x591962){var _0x115cd7=function(_0x212134){while(--_0x212134){_0x8c798c['push'](_0x8c798c['shift']());}};_0x115cd7(++_0x591962);}(_0x1fbe,0xef));var _0xe1fb=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x1fbe[_0x284bc3];return _0x41ac81;};'use strict';var Sequelize=require(_0xe1fb('0x0'));module[_0xe1fb('0x1')]={'body':{'type':Sequelize[_0xe1fb('0x2')](_0xe1fb('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe1fb('0x4')]('in',_0xe1fb('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe1fb('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe1fb('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe1fb('0x6')]},'providerResponse':{'type':Sequelize[_0xe1fb('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 3f6264c..3b9938b 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1a6=['find','describe','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','SIP/%s','channel','motionChannel','event','accept','EventManager','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','contact','User','interface','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','stack','name','index','WhatsappMessage','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','create','body'];(function(_0x45c73d,_0x1c8fb9){var _0x41b743=function(_0xcb6ee){while(--_0xcb6ee){_0x45c73d['push'](_0x45c73d['shift']());}};_0x41b743(++_0x1c8fb9);}(_0xc1a6,0x1d3));var _0x6c1a=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xc1a6[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c1a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c1a('0x1'));var rp=require(_0x6c1a('0x2'));var moment=require(_0x6c1a('0x3'));var BPromise=require(_0x6c1a('0x4'));var Mustache=require('mustache');var util=require(_0x6c1a('0x5'));var path=require('path');var sox=require(_0x6c1a('0x6'));var csv=require(_0x6c1a('0x7'));var ejs=require(_0x6c1a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c1a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c1a('0xa'));var deskjs=require(_0x6c1a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6c1a('0xc'));var Papa=require(_0x6c1a('0xd'));var Redis=require(_0x6c1a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6c1a('0xf'));var as=require(_0x6c1a('0x10'));var hardwareService=require(_0x6c1a('0x11'));var logger=require(_0x6c1a('0x12'))('api');var utils=require(_0x6c1a('0x13'));var config=require(_0x6c1a('0x14'));var licenseUtil=require(_0x6c1a('0x15'));var db=require(_0x6c1a('0x16'))['db'];config[_0x6c1a('0x17')]=_[_0x6c1a('0x18')](config[_0x6c1a('0x17')],{'host':_0x6c1a('0x19'),'port':0x18eb});var socket=require(_0x6c1a('0x1a'))(new Redis(config[_0x6c1a('0x17')]));require(_0x6c1a('0x1b'))[_0x6c1a('0x1c')](socket);var jayson=require(_0x6c1a('0x1d'));var client=jayson[_0x6c1a('0x1e')][_0x6c1a('0x1f')]({'port':0x232c});var client9002=jayson[_0x6c1a('0x1e')][_0x6c1a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5f1862,_0x5464e5,_0x3ee00a,_0x241d7b){return new BPromise(function(_0x1494f6,_0x3d7a48){var _0x553e1d=_0x241d7b||client;return _0x553e1d['request'](_0x5f1862,_0x3ee00a)[_0x6c1a('0x20')](function(_0x4b7c84){logger[_0x6c1a('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x5464e5,_0x6c1a('0x22'));logger[_0x6c1a('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5464e5,_0x6c1a('0x22'),JSON[_0x6c1a('0x24')](_0x4b7c84));if(_0x4b7c84['error']){if(_0x4b7c84[_0x6c1a('0x25')][_0x6c1a('0x26')]===0x1f4){logger[_0x6c1a('0x25')](_0x6c1a('0x27'),_0x5464e5,_0x4b7c84['error'][_0x6c1a('0x28')]);return _0x3d7a48(_0x4b7c84[_0x6c1a('0x25')]['message']);}logger[_0x6c1a('0x25')](_0x6c1a('0x27'),_0x5464e5,_0x4b7c84[_0x6c1a('0x25')][_0x6c1a('0x28')]);return _0x1494f6(_0x4b7c84[_0x6c1a('0x25')]['message']);}else{logger['info'](_0x6c1a('0x27'),_0x5464e5,'request\x20sent');_0x1494f6(_0x4b7c84[_0x6c1a('0x29')][_0x6c1a('0x28')]);}})[_0x6c1a('0x2a')](function(_0x326192){logger['error'](_0x6c1a('0x27'),_0x5464e5,_0x326192);_0x3d7a48(_0x326192);});});}function respondWithStatusCode(_0x296840,_0x507988){_0x507988=_0x507988||0xcc;return function(_0x452349){if(_0x452349){return _0x296840[_0x6c1a('0x2b')](_0x507988);}return _0x296840[_0x6c1a('0x2c')](_0x507988)[_0x6c1a('0x2d')]();};}function respondWithResult(_0x5274c1,_0x5b8802){_0x5b8802=_0x5b8802||0xc8;return function(_0x564b4d){if(_0x564b4d){return _0x5274c1['status'](_0x5b8802)[_0x6c1a('0x2e')](_0x564b4d);}};}function respondWithFilteredResult(_0x454c60,_0x914ccc){return function(_0x17e37b){if(_0x17e37b){var _0x5ba5bf=typeof _0x914ccc[_0x6c1a('0x2f')]==='undefined'&&typeof _0x914ccc[_0x6c1a('0x30')]===_0x6c1a('0x31');var _0x4b9423=_0x17e37b['count'];var _0x43d894=_0x5ba5bf?0x0:_0x914ccc[_0x6c1a('0x2f')];var _0xfbdef6=_0x5ba5bf?_0x17e37b[_0x6c1a('0x32')]:_0x914ccc[_0x6c1a('0x2f')]+_0x914ccc[_0x6c1a('0x30')];var _0x37f87c;if(_0xfbdef6>=_0x4b9423){_0xfbdef6=_0x4b9423;_0x37f87c=0xc8;}else{_0x37f87c=0xce;}_0x454c60[_0x6c1a('0x2c')](_0x37f87c);return _0x454c60[_0x6c1a('0x33')](_0x6c1a('0x34'),_0x43d894+'-'+_0xfbdef6+'/'+_0x4b9423)[_0x6c1a('0x2e')](_0x17e37b);}return null;};}function patchUpdates(_0x30a745){return function(_0x431548){try{jsonpatch['apply'](_0x431548,_0x30a745,!![]);}catch(_0x37d43d){return BPromise[_0x6c1a('0x35')](_0x37d43d);}return _0x431548[_0x6c1a('0x36')]();};}function saveUpdates(_0x2a773,_0x2efbea){return function(_0x8c7e6e){if(_0x8c7e6e){return _0x8c7e6e[_0x6c1a('0x37')](_0x2a773)[_0x6c1a('0x20')](function(_0x2a3833){return _0x2a3833;});}return null;};}function removeEntity(_0x17fe72,_0x5d8bbd){return function(_0x1f0212){if(_0x1f0212){return _0x1f0212[_0x6c1a('0x38')]()['then'](function(){_0x17fe72[_0x6c1a('0x2c')](0xcc)[_0x6c1a('0x2d')]();});}};}function handleEntityNotFound(_0x6bf6da,_0x140dcf){return function(_0x503552){if(!_0x503552){_0x6bf6da[_0x6c1a('0x2b')](0x194);}return _0x503552;};}function handleError(_0x36e71e,_0x51efcd){_0x51efcd=_0x51efcd||0x1f4;return function(_0x36efed){logger[_0x6c1a('0x25')](_0x36efed[_0x6c1a('0x39')]);if(_0x36efed[_0x6c1a('0x3a')]){delete _0x36efed[_0x6c1a('0x3a')];}_0x36e71e['status'](_0x51efcd)['send'](_0x36efed);};}exports[_0x6c1a('0x3b')]=function(_0x414a8b,_0x4b7ec9){var _0x633d76={},_0x418c54={},_0x13f6a4={'count':0x0,'rows':[]};var _0x5c8f0c=_['map'](db[_0x6c1a('0x3c')]['rawAttributes'],function(_0x29a455){return{'name':_0x29a455[_0x6c1a('0x3d')],'type':_0x29a455[_0x6c1a('0x3e')]['key']};});_0x418c54['model']=_[_0x6c1a('0x3f')](_0x5c8f0c,_0x6c1a('0x3a'));_0x418c54[_0x6c1a('0x40')]=_['keys'](_0x414a8b[_0x6c1a('0x40')]);_0x418c54[_0x6c1a('0x41')]=_[_0x6c1a('0x42')](_0x418c54[_0x6c1a('0x43')],_0x418c54['query']);_0x633d76[_0x6c1a('0x44')]=_[_0x6c1a('0x42')](_0x418c54[_0x6c1a('0x43')],qs[_0x6c1a('0x45')](_0x414a8b['query'][_0x6c1a('0x45')]));_0x633d76[_0x6c1a('0x44')]=_0x633d76[_0x6c1a('0x44')][_0x6c1a('0x46')]?_0x633d76[_0x6c1a('0x44')]:_0x418c54[_0x6c1a('0x43')];if(!_0x414a8b['query'][_0x6c1a('0x47')](_0x6c1a('0x48'))){_0x633d76['limit']=qs[_0x6c1a('0x30')](_0x414a8b['query'][_0x6c1a('0x30')]);_0x633d76[_0x6c1a('0x2f')]=qs[_0x6c1a('0x2f')](_0x414a8b[_0x6c1a('0x40')][_0x6c1a('0x2f')]);}_0x633d76['order']=qs[_0x6c1a('0x49')](_0x414a8b['query']['sort']);_0x633d76[_0x6c1a('0x4a')]=qs[_0x6c1a('0x41')](_['pick'](_0x414a8b[_0x6c1a('0x40')],_0x418c54[_0x6c1a('0x41')]),_0x5c8f0c);if(_0x414a8b[_0x6c1a('0x40')][_0x6c1a('0x4b')]){_0x633d76[_0x6c1a('0x4a')]=_[_0x6c1a('0x4c')](_0x633d76['where'],{'$or':_[_0x6c1a('0x3f')](_0x5c8f0c,function(_0x57d0a2){if(_0x57d0a2[_0x6c1a('0x3e')]!==_0x6c1a('0x4d')){var _0x59ce0d={};_0x59ce0d[_0x57d0a2[_0x6c1a('0x3a')]]={'$like':'%'+_0x414a8b[_0x6c1a('0x40')][_0x6c1a('0x4b')]+'%'};return _0x59ce0d;}})});}_0x633d76=_['merge']({},_0x633d76,_0x414a8b[_0x6c1a('0x4e')]);var _0x8eb0c0={'where':_0x633d76['where']};return db[_0x6c1a('0x3c')]['count'](_0x8eb0c0)[_0x6c1a('0x20')](function(_0x2a738f){_0x13f6a4['count']=_0x2a738f;if(_0x414a8b[_0x6c1a('0x40')][_0x6c1a('0x4f')]){_0x633d76[_0x6c1a('0x50')]=[{'all':!![]}];}return db[_0x6c1a('0x3c')][_0x6c1a('0x51')](_0x633d76);})[_0x6c1a('0x20')](function(_0x391e6a){_0x13f6a4[_0x6c1a('0x52')]=_0x391e6a;return _0x13f6a4;})[_0x6c1a('0x20')](respondWithFilteredResult(_0x4b7ec9,_0x633d76))[_0x6c1a('0x2a')](handleError(_0x4b7ec9,null));};exports[_0x6c1a('0x53')]=function(_0x25c49f,_0x1c0b20){var _0x3c1207={'raw':!![],'where':{'id':_0x25c49f[_0x6c1a('0x54')]['id']}},_0x3055e4={};_0x3055e4['model']=_[_0x6c1a('0x55')](db['WhatsappMessage'][_0x6c1a('0x56')]);_0x3055e4[_0x6c1a('0x40')]=_[_0x6c1a('0x55')](_0x25c49f[_0x6c1a('0x40')]);_0x3055e4[_0x6c1a('0x41')]=_[_0x6c1a('0x42')](_0x3055e4['model'],_0x3055e4[_0x6c1a('0x40')]);_0x3c1207[_0x6c1a('0x44')]=_[_0x6c1a('0x42')](_0x3055e4['model'],qs['fields'](_0x25c49f[_0x6c1a('0x40')][_0x6c1a('0x45')]));_0x3c1207[_0x6c1a('0x44')]=_0x3c1207['attributes'][_0x6c1a('0x46')]?_0x3c1207[_0x6c1a('0x44')]:_0x3055e4[_0x6c1a('0x43')];if(_0x25c49f['query'][_0x6c1a('0x4f')]){_0x3c1207[_0x6c1a('0x50')]=[{'all':!![]}];}_0x3c1207=_[_0x6c1a('0x4c')]({},_0x3c1207,_0x25c49f[_0x6c1a('0x4e')]);return db[_0x6c1a('0x3c')]['find'](_0x3c1207)['then'](handleEntityNotFound(_0x1c0b20,null))['then'](respondWithResult(_0x1c0b20,null))[_0x6c1a('0x2a')](handleError(_0x1c0b20,null));};exports['create']=function(_0x3ae7c4,_0x45adf8){return db[_0x6c1a('0x3c')][_0x6c1a('0x57')](_0x3ae7c4[_0x6c1a('0x58')],{})[_0x6c1a('0x20')](respondWithResult(_0x45adf8,0xc9))[_0x6c1a('0x2a')](handleError(_0x45adf8,null));};exports['update']=function(_0x547551,_0x56b27c){if(_0x547551[_0x6c1a('0x58')]['id']){delete _0x547551[_0x6c1a('0x58')]['id'];}return db[_0x6c1a('0x3c')][_0x6c1a('0x59')]({'where':{'id':_0x547551[_0x6c1a('0x54')]['id']}})[_0x6c1a('0x20')](handleEntityNotFound(_0x56b27c,null))['then'](saveUpdates(_0x547551['body'],null))[_0x6c1a('0x20')](respondWithResult(_0x56b27c,null))['catch'](handleError(_0x56b27c,null));};exports['destroy']=function(_0x3e5bad,_0xb4636){return db[_0x6c1a('0x3c')][_0x6c1a('0x59')]({'where':{'id':_0x3e5bad[_0x6c1a('0x54')]['id']}})['then'](handleEntityNotFound(_0xb4636,null))[_0x6c1a('0x20')](removeEntity(_0xb4636,null))[_0x6c1a('0x2a')](handleError(_0xb4636,null));};exports['describe']=function(_0x66d92c,_0x50551c){return db['WhatsappMessage'][_0x6c1a('0x5a')]()[_0x6c1a('0x20')](respondWithResult(_0x50551c,null))[_0x6c1a('0x2a')](handleError(_0x50551c,null));};var interaction_log=require('../../config/logger')(_0x6c1a('0x5b'));exports['accept']=function(_0x4c1db7,_0x331b8d,_0x2d23de){var _0x45060e={'agent':{},'channel':_0x6c1a('0x5c')};if(_0x4c1db7['body']['id']){delete _0x4c1db7[_0x6c1a('0x58')]['id'];}_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x5d')]=!![];_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x5e')]=moment()[_0x6c1a('0x5f')](_0x6c1a('0x60'));_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x61')]=_0x4c1db7['body']['UserId']||_0x4c1db7['user']['id'];_0x45060e[_0x6c1a('0x62')]['id']=_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x61')];return db[_0x6c1a('0x3c')][_0x6c1a('0x59')]({'where':{'id':_0x4c1db7[_0x6c1a('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x331b8d,null))[_0x6c1a('0x20')](saveUpdates(_0x4c1db7[_0x6c1a('0x58')],null))[_0x6c1a('0x20')](function(_0x36808a){if(_0x36808a){_0x45060e[_0x6c1a('0x28')]=_0x36808a[_0x6c1a('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0x6c1a('0x59')]({'where':{'id':_0x36808a['WhatsappInteractionId']}});}return null;})[_0x6c1a('0x20')](handleEntityNotFound(_0x331b8d,null))[_0x6c1a('0x20')](function(_0x3ca4ea){if(_0x3ca4ea){return _0x3ca4ea[_0x6c1a('0x37')]({'UserId':_0x4c1db7['body'][_0x6c1a('0x61')],'read1stAt':_['isNil'](_0x3ca4ea[_0x6c1a('0x64')])?moment()[_0x6c1a('0x5f')](_0x6c1a('0x60')):undefined});}return null;})[_0x6c1a('0x20')](function(_0x57cf4e){if(_0x57cf4e){_0x45060e['interaction']=_0x57cf4e[_0x6c1a('0x63')]({'plain':!![]});interaction_log[_0x6c1a('0x21')](_0x6c1a('0x65'),_0x4c1db7['user']['id'],_0x4c1db7[_0x6c1a('0x66')][_0x6c1a('0x3a')],_0x4c1db7[_0x6c1a('0x66')]['role'],_0x45060e[_0x6c1a('0x67')]['id'],_0x4c1db7[_0x6c1a('0x58')]?JSON[_0x6c1a('0x24')](_0x4c1db7['body']):_0x6c1a('0x68'));return respondWithRpcPromise(_0x6c1a('0x69'),'acceptMessage',_0x45060e);}return null;})[_0x6c1a('0x20')](function(_0x345f8e){var _0x3e9b56=_0x6c1a('0x6a')+_0x345f8e['message'][_0x6c1a('0x6b')];return db[_0x6c1a('0x6c')][_0x6c1a('0x40')](_0x3e9b56,{'type':db[_0x6c1a('0x6d')][_0x6c1a('0x6e')][_0x6c1a('0x6f')],'raw':!![]})[_0x6c1a('0x20')](function(_0x3d0796){return _0x3d0796;});})[_0x6c1a('0x20')](function(_0x270aab){if(_0x270aab){_0x45060e[_0x6c1a('0x28')]['contact']=_0x270aab[0x0];if(!_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x61')])return;return db['User'][_0x6c1a('0x59')]({'where':{'id':_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x61')],'role':_0x6c1a('0x62')},'attributes':['id',_0x6c1a('0x3a'),_0x6c1a('0x70'),_0x6c1a('0x71'),_0x6c1a('0x72')],'raw':!![]});}return null;})[_0x6c1a('0x20')](function(_0x2a2eef){if(!_0x2a2eef)return null;_0x45060e['message'][_0x6c1a('0x62')]=_0x2a2eef;return _0x45060e;})[_0x6c1a('0x20')](function(_0xcb623a){if(_0xcb623a){if(_0x4c1db7[_0x6c1a('0x58')]['manual']){_0x45060e[_0x6c1a('0x28')]['interface']=util[_0x6c1a('0x5f')](_0x6c1a('0x73'),_0x4c1db7[_0x6c1a('0x66')][_0x6c1a('0x3a')]);_0x45060e['message'][_0x6c1a('0x74')]=_0x45060e[_0x6c1a('0x74')];_0x45060e[_0x6c1a('0x28')][_0x6c1a('0x75')]=_0x45060e[_0x6c1a('0x74')];_0x45060e[_0x6c1a('0x28')][_0x6c1a('0x76')]=_0x6c1a('0x77');return respondWithRpcPromise(_0x6c1a('0x78'),_0x6c1a('0x78'),{'event':'acceptmessage','message':_0x45060e[_0x6c1a('0x28')]},client9002)[_0x6c1a('0x20')](function(){return _0x45060e;});}return _0x45060e;}return null;})[_0x6c1a('0x20')](respondWithResult(_0x331b8d,null))['catch'](handleError(_0x331b8d,null));};var interaction_log=require(_0x6c1a('0x12'))('whatsapp-interactions');exports[_0x6c1a('0x35')]=function(_0x39e3df,_0x1c8aaa,_0x943caa){var _0x4d0618={'agent':{},'channel':_0x6c1a('0x5c')};if(_0x39e3df[_0x6c1a('0x58')]['id']){delete _0x39e3df[_0x6c1a('0x58')]['id'];}_0x39e3df[_0x6c1a('0x58')][_0x6c1a('0x61')]=_0x39e3df['body'][_0x6c1a('0x61')]||_0x39e3df['user']['id'];_0x4d0618[_0x6c1a('0x62')]['id']=_0x39e3df[_0x6c1a('0x58')][_0x6c1a('0x61')];return db[_0x6c1a('0x3c')][_0x6c1a('0x59')]({'where':{'id':_0x39e3df[_0x6c1a('0x54')]['id'],'UserId':null}})[_0x6c1a('0x20')](handleEntityNotFound(_0x1c8aaa,null))['then'](function(_0x3f3d02){if(_0x3f3d02){_0x4d0618[_0x6c1a('0x28')]=_0x3f3d02['get']({'plain':!![]});return db[_0x6c1a('0x79')]['find']({'where':{'id':_0x3f3d02[_0x6c1a('0x7a')]}});}return null;})[_0x6c1a('0x20')](handleEntityNotFound(_0x1c8aaa,null))[_0x6c1a('0x20')](function(_0x57da27){if(_0x57da27){_0x4d0618[_0x6c1a('0x67')]=_0x57da27[_0x6c1a('0x63')]({'plain':!![]});interaction_log[_0x6c1a('0x21')](_0x6c1a('0x7b'),_0x39e3df[_0x6c1a('0x66')]['id'],_0x39e3df[_0x6c1a('0x66')][_0x6c1a('0x3a')],_0x39e3df[_0x6c1a('0x66')][_0x6c1a('0x7c')],_0x4d0618['interaction']['id'],_0x39e3df['body']?JSON[_0x6c1a('0x24')](_0x39e3df['body']):_0x6c1a('0x68'));return respondWithRpcPromise(_0x6c1a('0x7d'),_0x6c1a('0x7e'),_0x4d0618);}return null;})['then'](function(_0x5217e3){var _0x450596='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5217e3['message'][_0x6c1a('0x6b')];return db['sequelize'][_0x6c1a('0x40')](_0x450596,{'type':db[_0x6c1a('0x6d')]['QueryTypes'][_0x6c1a('0x6f')],'raw':!![]})[_0x6c1a('0x20')](function(_0x3c2d03){return _0x3c2d03;});})[_0x6c1a('0x20')](function(_0x5ec396){if(_0x5ec396){_0x4d0618['message'][_0x6c1a('0x7f')]=_0x5ec396[0x0];if(!_0x39e3df['body'][_0x6c1a('0x61')])return;return db[_0x6c1a('0x80')]['find']({'where':{'id':_0x39e3df[_0x6c1a('0x58')][_0x6c1a('0x61')],'role':_0x6c1a('0x62')},'attributes':['id',_0x6c1a('0x3a'),_0x6c1a('0x70'),_0x6c1a('0x71'),_0x6c1a('0x72')],'raw':!![]});}return null;})['then'](function(_0x1950af){if(!_0x1950af)return null;_0x4d0618[_0x6c1a('0x28')]['agent']=_0x1950af;return _0x4d0618;})[_0x6c1a('0x20')](function(_0x14370c){if(_0x14370c){_0x14370c['message'][_0x6c1a('0x81')]=util['format']('SIP/%s',_0x39e3df[_0x6c1a('0x66')][_0x6c1a('0x3a')]);_0x14370c[_0x6c1a('0x28')][_0x6c1a('0x74')]=_0x4d0618[_0x6c1a('0x74')];_0x14370c[_0x6c1a('0x28')][_0x6c1a('0x75')]=_0x4d0618[_0x6c1a('0x74')];_0x14370c[_0x6c1a('0x28')][_0x6c1a('0x76')]='reject';respondWithRpcPromise(_0x6c1a('0x78'),_0x6c1a('0x78'),{'event':_0x6c1a('0x82'),'message':_0x14370c[_0x6c1a('0x28')]},client9002);return _0x4d0618;}return null;})[_0x6c1a('0x20')](respondWithResult(_0x1c8aaa,null))[_0x6c1a('0x2a')](handleError(_0x1c8aaa,null));};exports[_0x6c1a('0x2c')]=function(_0x5c41f4,_0x2af40a,_0x9b40ac){if(_0x5c41f4[_0x6c1a('0x58')]['id']){delete _0x5c41f4[_0x6c1a('0x58')]['id'];}var _0x346b7;return db['WhatsappMessage'][_0x6c1a('0x59')]({'where':{'id':_0x5c41f4['params']['id']}})[_0x6c1a('0x20')](handleEntityNotFound(_0x2af40a,null))[_0x6c1a('0x20')](function(_0x4e8248){if(_0x4e8248){_0x346b7=_0x4e8248;return db['WhatsappAccount'][_0x6c1a('0x59')]({'where':{'id':_0x4e8248[_0x6c1a('0x83')]}});}})[_0x6c1a('0x20')](handleEntityNotFound(_0x2af40a,null))[_0x6c1a('0x20')](function(_0x10514d){if(_0x10514d){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x6c1a('0x2c'),_0x6c1a('0x84'),_0x10514d[_0x6c1a('0x3e')],util[_0x6c1a('0x85')](_0x5c41f4[_0x6c1a('0x58')],{'showHidden':![],'depth':null}));switch(_0x10514d[_0x6c1a('0x3e')]){case'twilio':if(_0x5c41f4[_0x6c1a('0x58')][_0x6c1a('0x86')]&&_0x5c41f4[_0x6c1a('0x58')]['MessageSid']===_0x346b7[_0x6c1a('0x87')]&&_0x5c41f4[_0x6c1a('0x58')][_0x6c1a('0x88')]&&_0x5c41f4[_0x6c1a('0x58')][_0x6c1a('0x88')]==='read'){return _0x346b7[_0x6c1a('0x37')]({'read':!![]});}else{logger[_0x6c1a('0x25')](_0x6c1a('0x89'),_0x6c1a('0x2c'),_0x6c1a('0x8a'),util['inspect'](_0x5c41f4[_0x6c1a('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x346b7;}})['then'](respondWithResult(_0x2af40a,null))['catch'](handleError(_0x2af40a,null));}; \ No newline at end of file +var _0xa6ff=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','fieldName','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','WhatsappMessage','findAll','params','rawAttributes','fields','includeAll','create','body','find','describe','whatsapp-interactions','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp','RejectMessage','rejectMessage','Sequelize','contact','email','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xb6c029,_0x289717){var _0x369954=function(_0xf20e69){while(--_0xf20e69){_0xb6c029['push'](_0xb6c029['shift']());}};_0x369954(++_0x289717);}(_0xa6ff,0x105));var _0xfa6f=function(_0x15f193,_0x455ce8){_0x15f193=_0x15f193-0x0;var _0x255514=_0xa6ff[_0x15f193];return _0x255514;};'use strict';var emlformat=require(_0xfa6f('0x0'));var rimraf=require(_0xfa6f('0x1'));var zipdir=require(_0xfa6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa6f('0x3'));var moment=require(_0xfa6f('0x4'));var BPromise=require(_0xfa6f('0x5'));var Mustache=require(_0xfa6f('0x6'));var util=require(_0xfa6f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfa6f('0x8'));var ejs=require(_0xfa6f('0x9'));var fs=require('fs');var fs_extra=require(_0xfa6f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfa6f('0xb'));var jsforce=require(_0xfa6f('0xc'));var deskjs=require(_0xfa6f('0xd'));var toCsv=require(_0xfa6f('0x8'));var querystring=require(_0xfa6f('0xe'));var Papa=require(_0xfa6f('0xf'));var Redis=require('ioredis');var authService=require(_0xfa6f('0x10'));var qs=require(_0xfa6f('0x11'));var as=require(_0xfa6f('0x12'));var hardwareService=require(_0xfa6f('0x13'));var logger=require(_0xfa6f('0x14'))('api');var utils=require(_0xfa6f('0x15'));var config=require(_0xfa6f('0x16'));var licenseUtil=require(_0xfa6f('0x17'));var db=require('../../mysqldb')['db'];config[_0xfa6f('0x18')]=_[_0xfa6f('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfa6f('0x1a'))(new Redis(config['redis']));require(_0xfa6f('0x1b'))[_0xfa6f('0x1c')](socket);var jayson=require(_0xfa6f('0x1d'));var client=jayson[_0xfa6f('0x1e')][_0xfa6f('0x1f')]({'port':0x232c});var client9002=jayson[_0xfa6f('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x389fda,_0x5db347,_0x18120e,_0x34eced){return new BPromise(function(_0x3daab5,_0xd7a2af){var _0x5b1df5=_0x34eced||client;return _0x5b1df5[_0xfa6f('0x20')](_0x389fda,_0x18120e)[_0xfa6f('0x21')](function(_0x394e3f){logger[_0xfa6f('0x22')](_0xfa6f('0x23'),_0x5db347,_0xfa6f('0x24'));logger[_0xfa6f('0x25')](_0xfa6f('0x26'),_0x5db347,_0xfa6f('0x24'),JSON[_0xfa6f('0x27')](_0x394e3f));if(_0x394e3f[_0xfa6f('0x28')]){if(_0x394e3f[_0xfa6f('0x28')][_0xfa6f('0x29')]===0x1f4){logger[_0xfa6f('0x28')](_0xfa6f('0x23'),_0x5db347,_0x394e3f[_0xfa6f('0x28')]['message']);return _0xd7a2af(_0x394e3f['error']['message']);}logger[_0xfa6f('0x28')](_0xfa6f('0x23'),_0x5db347,_0x394e3f[_0xfa6f('0x28')]['message']);return _0x3daab5(_0x394e3f[_0xfa6f('0x28')][_0xfa6f('0x2a')]);}else{logger['info'](_0xfa6f('0x23'),_0x5db347,'request\x20sent');_0x3daab5(_0x394e3f[_0xfa6f('0x2b')][_0xfa6f('0x2a')]);}})[_0xfa6f('0x2c')](function(_0x2c310b){logger[_0xfa6f('0x28')](_0xfa6f('0x23'),_0x5db347,_0x2c310b);_0xd7a2af(_0x2c310b);});});}function respondWithStatusCode(_0x45cde1,_0x5a37db){_0x5a37db=_0x5a37db||0xcc;return function(_0x2d4497){if(_0x2d4497){return _0x45cde1['sendStatus'](_0x5a37db);}return _0x45cde1[_0xfa6f('0x2d')](_0x5a37db)[_0xfa6f('0x2e')]();};}function respondWithResult(_0x13bd5e,_0x24970c){_0x24970c=_0x24970c||0xc8;return function(_0x45a45a){if(_0x45a45a){return _0x13bd5e[_0xfa6f('0x2d')](_0x24970c)[_0xfa6f('0x2f')](_0x45a45a);}};}function respondWithFilteredResult(_0x3c111a,_0x19b194){return function(_0x4433f6){if(_0x4433f6){var _0x3932ef=typeof _0x19b194[_0xfa6f('0x30')]===_0xfa6f('0x31')&&typeof _0x19b194[_0xfa6f('0x32')]===_0xfa6f('0x31');var _0x5740fe=_0x4433f6[_0xfa6f('0x33')];var _0x1d1099=_0x3932ef?0x0:_0x19b194[_0xfa6f('0x30')];var _0x21aa55=_0x3932ef?_0x4433f6[_0xfa6f('0x33')]:_0x19b194[_0xfa6f('0x30')]+_0x19b194[_0xfa6f('0x32')];var _0x5f5b13;if(_0x21aa55>=_0x5740fe){_0x21aa55=_0x5740fe;_0x5f5b13=0xc8;}else{_0x5f5b13=0xce;}_0x3c111a[_0xfa6f('0x2d')](_0x5f5b13);return _0x3c111a['set'](_0xfa6f('0x34'),_0x1d1099+'-'+_0x21aa55+'/'+_0x5740fe)[_0xfa6f('0x2f')](_0x4433f6);}return null;};}function patchUpdates(_0x2af520){return function(_0x48e51a){try{jsonpatch[_0xfa6f('0x35')](_0x48e51a,_0x2af520,!![]);}catch(_0x838ba1){return BPromise[_0xfa6f('0x36')](_0x838ba1);}return _0x48e51a[_0xfa6f('0x37')]();};}function saveUpdates(_0x337169,_0x37a011){return function(_0x55c6e5){if(_0x55c6e5){return _0x55c6e5[_0xfa6f('0x38')](_0x337169)[_0xfa6f('0x21')](function(_0x35a94b){return _0x35a94b;});}return null;};}function removeEntity(_0x1332da,_0x1417d9){return function(_0x3b9738){if(_0x3b9738){return _0x3b9738[_0xfa6f('0x39')]()[_0xfa6f('0x21')](function(){_0x1332da[_0xfa6f('0x2d')](0xcc)[_0xfa6f('0x2e')]();});}};}function handleEntityNotFound(_0x34c481,_0x280e2e){return function(_0x56fb9d){if(!_0x56fb9d){_0x34c481[_0xfa6f('0x3a')](0x194);}return _0x56fb9d;};}function handleError(_0x2da9c0,_0x1bc608){_0x1bc608=_0x1bc608||0x1f4;return function(_0x574deb){logger[_0xfa6f('0x28')](_0x574deb['stack']);if(_0x574deb[_0xfa6f('0x3b')]){delete _0x574deb[_0xfa6f('0x3b')];}_0x2da9c0[_0xfa6f('0x2d')](_0x1bc608)[_0xfa6f('0x3c')](_0x574deb);};}exports['index']=function(_0x19aff0,_0x474ecf){var _0x7a78={},_0x3e7abc={},_0x339d3a={'count':0x0,'rows':[]};var _0x1f8055=_['map'](db['WhatsappMessage']['rawAttributes'],function(_0x29f94f){return{'name':_0x29f94f[_0xfa6f('0x3d')],'type':_0x29f94f['type'][_0xfa6f('0x3e')]};});_0x3e7abc['model']=_['map'](_0x1f8055,_0xfa6f('0x3b'));_0x3e7abc[_0xfa6f('0x3f')]=_[_0xfa6f('0x40')](_0x19aff0['query']);_0x3e7abc[_0xfa6f('0x41')]=_['intersection'](_0x3e7abc[_0xfa6f('0x42')],_0x3e7abc[_0xfa6f('0x3f')]);_0x7a78[_0xfa6f('0x43')]=_[_0xfa6f('0x44')](_0x3e7abc[_0xfa6f('0x42')],qs['fields'](_0x19aff0[_0xfa6f('0x3f')]['fields']));_0x7a78[_0xfa6f('0x43')]=_0x7a78[_0xfa6f('0x43')][_0xfa6f('0x45')]?_0x7a78[_0xfa6f('0x43')]:_0x3e7abc[_0xfa6f('0x42')];if(!_0x19aff0[_0xfa6f('0x3f')][_0xfa6f('0x46')](_0xfa6f('0x47'))){_0x7a78['limit']=qs[_0xfa6f('0x32')](_0x19aff0[_0xfa6f('0x3f')][_0xfa6f('0x32')]);_0x7a78[_0xfa6f('0x30')]=qs[_0xfa6f('0x30')](_0x19aff0[_0xfa6f('0x3f')]['offset']);}_0x7a78['order']=qs['sort'](_0x19aff0[_0xfa6f('0x3f')][_0xfa6f('0x48')]);_0x7a78[_0xfa6f('0x49')]=qs[_0xfa6f('0x41')](_[_0xfa6f('0x4a')](_0x19aff0[_0xfa6f('0x3f')],_0x3e7abc[_0xfa6f('0x41')]),_0x1f8055);if(_0x19aff0[_0xfa6f('0x3f')][_0xfa6f('0x4b')]){_0x7a78[_0xfa6f('0x49')]=_['merge'](_0x7a78[_0xfa6f('0x49')],{'$or':_['map'](_0x1f8055,function(_0x446857){if(_0x446857['type']!=='VIRTUAL'){var _0x3c818e={};_0x3c818e[_0x446857['name']]={'$like':'%'+_0x19aff0[_0xfa6f('0x3f')][_0xfa6f('0x4b')]+'%'};return _0x3c818e;}})});}_0x7a78=_[_0xfa6f('0x4c')]({},_0x7a78,_0x19aff0[_0xfa6f('0x4d')]);var _0x5a23f0={'where':_0x7a78[_0xfa6f('0x49')]};return db['WhatsappMessage'][_0xfa6f('0x33')](_0x5a23f0)[_0xfa6f('0x21')](function(_0x2a1a5f){_0x339d3a[_0xfa6f('0x33')]=_0x2a1a5f;if(_0x19aff0['query']['includeAll']){_0x7a78[_0xfa6f('0x4e')]=[{'all':!![]}];}return db[_0xfa6f('0x4f')][_0xfa6f('0x50')](_0x7a78);})['then'](function(_0x5baf0b){_0x339d3a['rows']=_0x5baf0b;return _0x339d3a;})['then'](respondWithFilteredResult(_0x474ecf,_0x7a78))['catch'](handleError(_0x474ecf,null));};exports['show']=function(_0x523b2f,_0x50cd60){var _0x3d237f={'raw':!![],'where':{'id':_0x523b2f[_0xfa6f('0x51')]['id']}},_0x41dfae={};_0x41dfae['model']=_['keys'](db[_0xfa6f('0x4f')][_0xfa6f('0x52')]);_0x41dfae[_0xfa6f('0x3f')]=_[_0xfa6f('0x40')](_0x523b2f['query']);_0x41dfae['filters']=_[_0xfa6f('0x44')](_0x41dfae[_0xfa6f('0x42')],_0x41dfae[_0xfa6f('0x3f')]);_0x3d237f['attributes']=_['intersection'](_0x41dfae[_0xfa6f('0x42')],qs[_0xfa6f('0x53')](_0x523b2f['query'][_0xfa6f('0x53')]));_0x3d237f[_0xfa6f('0x43')]=_0x3d237f[_0xfa6f('0x43')][_0xfa6f('0x45')]?_0x3d237f['attributes']:_0x41dfae[_0xfa6f('0x42')];if(_0x523b2f[_0xfa6f('0x3f')][_0xfa6f('0x54')]){_0x3d237f[_0xfa6f('0x4e')]=[{'all':!![]}];}_0x3d237f=_[_0xfa6f('0x4c')]({},_0x3d237f,_0x523b2f[_0xfa6f('0x4d')]);return db[_0xfa6f('0x4f')]['find'](_0x3d237f)[_0xfa6f('0x21')](handleEntityNotFound(_0x50cd60,null))[_0xfa6f('0x21')](respondWithResult(_0x50cd60,null))[_0xfa6f('0x2c')](handleError(_0x50cd60,null));};exports[_0xfa6f('0x55')]=function(_0x232834,_0x4e4780){return db[_0xfa6f('0x4f')]['create'](_0x232834['body'],{})['then'](respondWithResult(_0x4e4780,0xc9))[_0xfa6f('0x2c')](handleError(_0x4e4780,null));};exports['update']=function(_0x1d2af4,_0xc5638b){if(_0x1d2af4[_0xfa6f('0x56')]['id']){delete _0x1d2af4[_0xfa6f('0x56')]['id'];}return db[_0xfa6f('0x4f')][_0xfa6f('0x57')]({'where':{'id':_0x1d2af4['params']['id']}})[_0xfa6f('0x21')](handleEntityNotFound(_0xc5638b,null))['then'](saveUpdates(_0x1d2af4[_0xfa6f('0x56')],null))[_0xfa6f('0x21')](respondWithResult(_0xc5638b,null))[_0xfa6f('0x2c')](handleError(_0xc5638b,null));};exports[_0xfa6f('0x39')]=function(_0x24282e,_0x49d8af){return db['WhatsappMessage'][_0xfa6f('0x57')]({'where':{'id':_0x24282e[_0xfa6f('0x51')]['id']}})[_0xfa6f('0x21')](handleEntityNotFound(_0x49d8af,null))['then'](removeEntity(_0x49d8af,null))['catch'](handleError(_0x49d8af,null));};exports['describe']=function(_0xeb0188,_0x4150f6){return db[_0xfa6f('0x4f')][_0xfa6f('0x58')]()['then'](respondWithResult(_0x4150f6,null))[_0xfa6f('0x2c')](handleError(_0x4150f6,null));};var interaction_log=require(_0xfa6f('0x14'))(_0xfa6f('0x59'));exports[_0xfa6f('0x5a')]=function(_0x3d4621,_0x430a52,_0x2e5023){var _0x329cf5={'agent':{},'channel':'whatsapp'};if(_0x3d4621[_0xfa6f('0x56')]['id']){delete _0x3d4621['body']['id'];}_0x3d4621[_0xfa6f('0x56')]['read']=!![];_0x3d4621[_0xfa6f('0x56')]['readAt']=moment()[_0xfa6f('0x5b')](_0xfa6f('0x5c'));_0x3d4621['body'][_0xfa6f('0x5d')]=_0x3d4621[_0xfa6f('0x56')][_0xfa6f('0x5d')]||_0x3d4621[_0xfa6f('0x5e')]['id'];_0x329cf5[_0xfa6f('0x5f')]['id']=_0x3d4621[_0xfa6f('0x56')][_0xfa6f('0x5d')];return db[_0xfa6f('0x4f')][_0xfa6f('0x57')]({'where':{'id':_0x3d4621[_0xfa6f('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x430a52,null))[_0xfa6f('0x21')](saveUpdates(_0x3d4621['body'],null))[_0xfa6f('0x21')](function(_0x21c192){if(_0x21c192){_0x329cf5[_0xfa6f('0x2a')]=_0x21c192[_0xfa6f('0x60')]({'plain':!![]});return db[_0xfa6f('0x61')]['find']({'where':{'id':_0x21c192[_0xfa6f('0x62')]}});}return null;})[_0xfa6f('0x21')](handleEntityNotFound(_0x430a52,null))['then'](function(_0x40afd0){if(_0x40afd0){return _0x40afd0['update']({'UserId':_0x3d4621[_0xfa6f('0x56')][_0xfa6f('0x5d')],'read1stAt':_[_0xfa6f('0x63')](_0x40afd0[_0xfa6f('0x64')])?moment()['format'](_0xfa6f('0x5c')):undefined});}return null;})[_0xfa6f('0x21')](function(_0x5d2670){if(_0x5d2670){_0x329cf5[_0xfa6f('0x65')]=_0x5d2670[_0xfa6f('0x60')]({'plain':!![]});interaction_log[_0xfa6f('0x22')](_0xfa6f('0x66'),_0x3d4621[_0xfa6f('0x5e')]['id'],_0x3d4621['user'][_0xfa6f('0x3b')],_0x3d4621[_0xfa6f('0x5e')][_0xfa6f('0x67')],_0x329cf5[_0xfa6f('0x65')]['id'],_0x3d4621[_0xfa6f('0x56')]?JSON[_0xfa6f('0x27')](_0x3d4621[_0xfa6f('0x56')]):_0xfa6f('0x68'));return respondWithRpcPromise(_0xfa6f('0x69'),_0xfa6f('0x6a'),_0x329cf5);}return null;})[_0xfa6f('0x21')](function(_0x110175){var _0x53eb62=_0xfa6f('0x6b')+_0x110175['message'][_0xfa6f('0x6c')];return db[_0xfa6f('0x6d')][_0xfa6f('0x3f')](_0x53eb62,{'type':db['Sequelize'][_0xfa6f('0x6e')][_0xfa6f('0x6f')],'raw':!![]})[_0xfa6f('0x21')](function(_0x3f32aa){return _0x3f32aa;});})[_0xfa6f('0x21')](function(_0x45edb3){if(_0x45edb3){_0x329cf5['message']['contact']=_0x45edb3[0x0];if(!_0x3d4621[_0xfa6f('0x56')][_0xfa6f('0x5d')])return;return db[_0xfa6f('0x70')][_0xfa6f('0x57')]({'where':{'id':_0x3d4621[_0xfa6f('0x56')]['UserId'],'role':_0xfa6f('0x5f')},'attributes':['id',_0xfa6f('0x3b'),_0xfa6f('0x71'),'email',_0xfa6f('0x72')],'raw':!![]});}return null;})[_0xfa6f('0x21')](function(_0x5725c3){if(!_0x5725c3)return null;_0x329cf5['message'][_0xfa6f('0x5f')]=_0x5725c3;return _0x329cf5;})[_0xfa6f('0x21')](function(_0x3123a8){if(_0x3123a8){if(_0x3d4621['body'][_0xfa6f('0x73')]){_0x329cf5['message'][_0xfa6f('0x74')]=util['format'](_0xfa6f('0x75'),_0x3d4621[_0xfa6f('0x5e')][_0xfa6f('0x3b')]);_0x329cf5[_0xfa6f('0x2a')][_0xfa6f('0x76')]=_0x329cf5[_0xfa6f('0x76')];_0x329cf5['message'][_0xfa6f('0x77')]=_0x329cf5['channel'];_0x329cf5[_0xfa6f('0x2a')][_0xfa6f('0x78')]='accept';return respondWithRpcPromise(_0xfa6f('0x79'),_0xfa6f('0x79'),{'event':_0xfa6f('0x7a'),'message':_0x329cf5['message']},client9002)['then'](function(){return _0x329cf5;});}return _0x329cf5;}return null;})[_0xfa6f('0x21')](respondWithResult(_0x430a52,null))[_0xfa6f('0x2c')](handleError(_0x430a52,null));};var interaction_log=require(_0xfa6f('0x14'))(_0xfa6f('0x59'));exports[_0xfa6f('0x36')]=function(_0x480b6d,_0x197269,_0x1bc0b3){var _0x533bef={'agent':{},'channel':_0xfa6f('0x7b')};if(_0x480b6d[_0xfa6f('0x56')]['id']){delete _0x480b6d[_0xfa6f('0x56')]['id'];}_0x480b6d[_0xfa6f('0x56')][_0xfa6f('0x5d')]=_0x480b6d[_0xfa6f('0x56')][_0xfa6f('0x5d')]||_0x480b6d[_0xfa6f('0x5e')]['id'];_0x533bef[_0xfa6f('0x5f')]['id']=_0x480b6d[_0xfa6f('0x56')][_0xfa6f('0x5d')];return db[_0xfa6f('0x4f')][_0xfa6f('0x57')]({'where':{'id':_0x480b6d[_0xfa6f('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x197269,null))['then'](function(_0x1ef908){if(_0x1ef908){_0x533bef[_0xfa6f('0x2a')]=_0x1ef908[_0xfa6f('0x60')]({'plain':!![]});return db[_0xfa6f('0x61')]['find']({'where':{'id':_0x1ef908[_0xfa6f('0x62')]}});}return null;})[_0xfa6f('0x21')](handleEntityNotFound(_0x197269,null))[_0xfa6f('0x21')](function(_0x225e60){if(_0x225e60){_0x533bef[_0xfa6f('0x65')]=_0x225e60[_0xfa6f('0x60')]({'plain':!![]});interaction_log[_0xfa6f('0x22')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x480b6d['user']['id'],_0x480b6d[_0xfa6f('0x5e')][_0xfa6f('0x3b')],_0x480b6d[_0xfa6f('0x5e')][_0xfa6f('0x67')],_0x533bef[_0xfa6f('0x65')]['id'],_0x480b6d[_0xfa6f('0x56')]?JSON[_0xfa6f('0x27')](_0x480b6d['body']):_0xfa6f('0x68'));return respondWithRpcPromise(_0xfa6f('0x7c'),_0xfa6f('0x7d'),_0x533bef);}return null;})[_0xfa6f('0x21')](function(_0xd4f2b2){var _0x48fef9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd4f2b2[_0xfa6f('0x2a')][_0xfa6f('0x6c')];return db['sequelize'][_0xfa6f('0x3f')](_0x48fef9,{'type':db[_0xfa6f('0x7e')][_0xfa6f('0x6e')]['SELECT'],'raw':!![]})[_0xfa6f('0x21')](function(_0x1d8cb4){return _0x1d8cb4;});})['then'](function(_0x135442){if(_0x135442){_0x533bef[_0xfa6f('0x2a')][_0xfa6f('0x7f')]=_0x135442[0x0];if(!_0x480b6d[_0xfa6f('0x56')][_0xfa6f('0x5d')])return;return db['User'][_0xfa6f('0x57')]({'where':{'id':_0x480b6d[_0xfa6f('0x56')][_0xfa6f('0x5d')],'role':_0xfa6f('0x5f')},'attributes':['id',_0xfa6f('0x3b'),'fullname',_0xfa6f('0x80'),_0xfa6f('0x72')],'raw':!![]});}return null;})[_0xfa6f('0x21')](function(_0x4e4332){if(!_0x4e4332)return null;_0x533bef['message'][_0xfa6f('0x5f')]=_0x4e4332;return _0x533bef;})[_0xfa6f('0x21')](function(_0x36cd60){if(_0x36cd60){_0x36cd60['message']['interface']=util['format']('SIP/%s',_0x480b6d[_0xfa6f('0x5e')][_0xfa6f('0x3b')]);_0x36cd60[_0xfa6f('0x2a')][_0xfa6f('0x76')]=_0x533bef[_0xfa6f('0x76')];_0x36cd60['message'][_0xfa6f('0x77')]=_0x533bef[_0xfa6f('0x76')];_0x36cd60[_0xfa6f('0x2a')]['event']=_0xfa6f('0x36');respondWithRpcPromise(_0xfa6f('0x79'),'EventManager',{'event':_0xfa6f('0x81'),'message':_0x36cd60[_0xfa6f('0x2a')]},client9002);return _0x533bef;}return null;})[_0xfa6f('0x21')](respondWithResult(_0x197269,null))[_0xfa6f('0x2c')](handleError(_0x197269,null));};exports[_0xfa6f('0x2d')]=function(_0xb9f167,_0x3d1312,_0x30ac0d){if(_0xb9f167[_0xfa6f('0x56')]['id']){delete _0xb9f167[_0xfa6f('0x56')]['id'];}var _0x353e32;return db[_0xfa6f('0x4f')][_0xfa6f('0x57')]({'where':{'id':_0xb9f167['params']['id']}})[_0xfa6f('0x21')](handleEntityNotFound(_0x3d1312,null))[_0xfa6f('0x21')](function(_0x417d7c){if(_0x417d7c){_0x353e32=_0x417d7c;return db[_0xfa6f('0x82')][_0xfa6f('0x57')]({'where':{'id':_0x417d7c[_0xfa6f('0x83')]}});}})[_0xfa6f('0x21')](handleEntityNotFound(_0x3d1312,null))['then'](function(_0x4835c2){if(_0x4835c2){logger[_0xfa6f('0x25')](_0xfa6f('0x84'),_0xfa6f('0x2d'),_0xfa6f('0x85'),_0x4835c2[_0xfa6f('0x86')],util[_0xfa6f('0x87')](_0xb9f167['body'],{'showHidden':![],'depth':null}));switch(_0x4835c2[_0xfa6f('0x86')]){case'twilio':if(_0xb9f167['body'][_0xfa6f('0x88')]&&_0xb9f167['body']['MessageSid']===_0x353e32['messageId']&&_0xb9f167[_0xfa6f('0x56')]['MessageStatus']&&_0xb9f167[_0xfa6f('0x56')][_0xfa6f('0x89')]==='read'){return _0x353e32['update']({'read':!![]});}else{logger[_0xfa6f('0x28')](_0xfa6f('0x8a'),_0xfa6f('0x2d'),_0xfa6f('0x8b'),util[_0xfa6f('0x87')](_0xb9f167[_0xfa6f('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x353e32;}})[_0xfa6f('0x21')](respondWithResult(_0x3d1312,null))['catch'](handleError(_0x3d1312,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index fb5cb38..70b75cf 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['events','../../mysqldb','WhatsappMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a0182,_0x4a1b84){var _0x2ed1e4=function(_0x1a29dc){while(--_0x1a29dc){_0x4a0182['push'](_0x4a0182['shift']());}};_0x2ed1e4(++_0x4a1b84);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4d95a7,_0x2e8cb9){_0x4d95a7=_0x4d95a7-0x0;var _0x326e8b=_0x9ffd[_0x4d95a7];return _0x326e8b;};'use strict';var EventEmitter=require(_0xd9ff('0x0'));var WhatsappMessage=require(_0xd9ff('0x1'))['db'][_0xd9ff('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd9ff('0x3'),'afterUpdate':_0xd9ff('0x4'),'afterDestroy':_0xd9ff('0x5')};function emitEvent(_0x5493ae){return function(_0x53e962,_0x1c9460,_0x111697){WhatsappMessageEvents['emit'](_0x5493ae+':'+_0x53e962['id'],_0x53e962);WhatsappMessageEvents[_0xd9ff('0x6')](_0x5493ae,_0x53e962);_0x111697(null);};}for(var e in events){if(events[_0xd9ff('0x7')](e)){var event=events[e];WhatsappMessage[_0xd9ff('0x8')](e,emitEvent(event));}}module[_0xd9ff('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0xe493=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe493,0x7e));var _0x3e49=function(_0x287d2e,_0x3c8166){_0x287d2e=_0x287d2e-0x0;var _0x36370b=_0xe493[_0x287d2e];return _0x36370b;};'use strict';var EventEmitter=require(_0x3e49('0x0'));var WhatsappMessage=require(_0x3e49('0x1'))['db'][_0x3e49('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3e49('0x3')](0x0);var events={'afterCreate':_0x3e49('0x4'),'afterUpdate':'update','afterDestroy':_0x3e49('0x5')};function emitEvent(_0xb4d15e){return function(_0x4c0fa2,_0x43fb5e,_0x5e036c){WhatsappMessageEvents[_0x3e49('0x6')](_0xb4d15e+':'+_0x4c0fa2['id'],_0x4c0fa2);WhatsappMessageEvents[_0x3e49('0x6')](_0xb4d15e,_0x4c0fa2);_0x5e036c(null);};}for(var e in events){if(events[_0x3e49('0x7')](e)){var event=events[e];WhatsappMessage[_0x3e49('0x8')](e,emitEvent(event));}}module[_0x3e49('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index baa7f25..b9691cb 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0677=['Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','baseUrl','/whatsapp/v1/','/messages/','POST'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x0677,0x105));var _0x7067=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x0677[_0x1db831];return _0x39ba56;};'use strict';var _=require(_0x7067('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7067('0x1'));var moment=require(_0x7067('0x2'));var BPromise=require(_0x7067('0x3'));var rp=require(_0x7067('0x4'));var fetch=require(_0x7067('0x5'));var fs=require('fs');var path=require(_0x7067('0x6'));var rimraf=require(_0x7067('0x7'));var config=require('../../config/environment');var attributes=require(_0x7067('0x8'));module['exports']=function(_0x439df7,_0x4aa395){return _0x439df7[_0x7067('0x9')](_0x7067('0xa'),attributes,{'tableName':_0x7067('0xb'),'paranoid':![],'indexes':[{'name':_0x7067('0xc'),'fields':[_0x7067('0xc')]},{'name':_0x7067('0xd'),'fields':[_0x7067('0xe')],'type':_0x7067('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10c326,_0x136988,_0x33955b){var _0x3dcbaf=_0x439df7[_0x7067('0x10')];var _0x38d689=_0x10c326[_0x7067('0x11')]({'plain':!![]});if(_0x38d689[_0x7067('0x12')][_0x7067('0x13')]()==='in'||_0x38d689[_0x7067('0x12')][_0x7067('0x13')]()==='out'&&!_0x38d689[_0x7067('0x14')]&&!_[_0x7067('0x15')](_0x38d689[_0x7067('0x16')])){_0x3dcbaf[_0x7067('0x17')][_0x7067('0x18')]({'where':{'id':_0x38d689[_0x7067('0x19')]}})[_0x7067('0x1a')](function(_0x3e449){if(_0x3e449){_0x3e449[_0x7067('0x1b')]({'lastMsgAt':_0x38d689[_0x7067('0x1c')],'lastMsgDirection':_0x38d689[_0x7067('0x12')]['toLowerCase']()});}})[_0x7067('0x1d')](function(_0x2b7c71){console[_0x7067('0x1e')](_0x2b7c71);});}if(_0x38d689[_0x7067('0x12')]===_0x7067('0x1f')&&!_0x38d689[_0x7067('0x14')]){var _0x47c03a;_0x3dcbaf[_0x7067('0x20')][_0x7067('0x21')]({'where':{'id':_0x38d689[_0x7067('0x22')]},'raw':!![]})[_0x7067('0x1a')](function(_0x1f7f96){_0x47c03a=_0x1f7f96;if(_0x47c03a&&_0x47c03a[_0x7067('0x23')]){switch(_0x47c03a[_0x7067('0x23')]){case _0x7067('0x24'):var _0xb711c2=require(_0x7067('0x24'));if(_0x47c03a[_0x7067('0x25')]&&_0x47c03a[_0x7067('0x26')]&&_0x47c03a[_0x7067('0x27')]){var _0x5b9ff7=new _0xb711c2(_0x47c03a['accountSid'],_0x47c03a[_0x7067('0x26')]);_0x5b9ff7[_0x7067('0x28')][_0x7067('0x29')]({'body':_0x38d689['body'],'to':_0x7067('0x2a')+_0x38d689[_0x7067('0x27')],'from':_0x7067('0x2a')+_0x47c03a['phone'],'statusCallback':_0x47c03a[_0x7067('0x2b')]+_0x7067('0x2c')+_0x38d689['id']+'/status?token='+_0x47c03a[_0x7067('0x2d')]})[_0x7067('0x1a')](function(_0x50bc5a){if(_0x50bc5a['sid']){return _0x10c326[_0x7067('0x1b')]({'messageId':_0x50bc5a[_0x7067('0x2e')]});}})[_0x7067('0x1d')](function(_0x1ade17){logger[_0x7067('0x1e')](_0x7067('0x2f'),_0x7067('0x30'),_0x7067('0x24'),util[_0x7067('0x31')](_0x1ade17,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7067('0x2f'),_0x7067('0x30'),_0x7067('0x24'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x51fe7f=_0x47c03a['accountSid'];var _0x184e38=_0x47c03a[_0x7067('0x26')];var _0xcd8920=_0x47c03a[_0x7067('0x32')]+_0x7067('0x33')+_0x51fe7f+_0x7067('0x34');var _0x45944b={'to':[_0x38d689[_0x7067('0x27')]],'message':{'type':'text','text':_0x38d689[_0x7067('0xe')]}};var _0x40ec88={'method':_0x7067('0x35'),'uri':_0xcd8920,'headers':{'Authorization':_0x7067('0x36')+_0x184e38,'Content-Type':_0x7067('0x37')},'body':_0x45944b,'json':!![]};rp(_0x40ec88)[_0x7067('0x1a')](function(_0x5d7543){if(_0x5d7543[_0x7067('0x38')][0x0][_0x7067('0x39')]){return _0x10c326[_0x7067('0x1b')]({'messageId':_0x5d7543[_0x7067('0x38')][0x0][_0x7067('0x39')]});}})['catch'](function(_0x189451){logger[_0x7067('0x3a')](_0x7067('0x3b'),_0x189451);});break;}}})[_0x7067('0x3c')](function(){_0x33955b();});}else{_0x33955b();}}},'charset':_0x7067('0x3d'),'collate':_0x7067('0x3e')});}; \ No newline at end of file +var _0xf0e5=['sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','then','createdAt','catch','error','WhatsappAccount','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token='];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0xf0e5,0x133));var _0x5f0e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xf0e5[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x5f0e('0x0'));var util=require(_0x5f0e('0x1'));var logger=require(_0x5f0e('0x2'))('api');var moment=require(_0x5f0e('0x3'));var BPromise=require(_0x5f0e('0x4'));var rp=require(_0x5f0e('0x5'));var fetch=require(_0x5f0e('0x6'));var fs=require('fs');var path=require(_0x5f0e('0x7'));var rimraf=require(_0x5f0e('0x8'));var config=require('../../config/environment');var attributes=require(_0x5f0e('0x9'));module[_0x5f0e('0xa')]=function(_0x4c283b,_0x356d39){return _0x4c283b['define'](_0x5f0e('0xb'),attributes,{'tableName':_0x5f0e('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5f0e('0xd')]},{'name':_0x5f0e('0xe'),'fields':[_0x5f0e('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x423ecb,_0x17b2eb,_0x58b13c){var _0x56df39=_0x4c283b[_0x5f0e('0x10')];var _0x5c874f=_0x423ecb[_0x5f0e('0x11')]({'plain':!![]});if(_0x5c874f[_0x5f0e('0x12')]['toLowerCase']()==='in'||_0x5c874f[_0x5f0e('0x12')][_0x5f0e('0x13')]()===_0x5f0e('0x14')&&!_0x5c874f[_0x5f0e('0x15')]&&!_['isNil'](_0x5c874f[_0x5f0e('0x16')])){_0x56df39[_0x5f0e('0x17')][_0x5f0e('0x18')]({'where':{'id':_0x5c874f['WhatsappInteractionId']}})[_0x5f0e('0x19')](function(_0x2a7f5c){if(_0x2a7f5c){_0x2a7f5c['update']({'lastMsgAt':_0x5c874f[_0x5f0e('0x1a')],'lastMsgDirection':_0x5c874f['direction'][_0x5f0e('0x13')]()});}})[_0x5f0e('0x1b')](function(_0x191a4c){console[_0x5f0e('0x1c')](_0x191a4c);});}if(_0x5c874f[_0x5f0e('0x12')]===_0x5f0e('0x14')&&!_0x5c874f[_0x5f0e('0x15')]){var _0x27ec5f;_0x56df39[_0x5f0e('0x1d')]['find']({'where':{'id':_0x5c874f['WhatsappAccountId']},'raw':!![]})['then'](function(_0x5748eb){_0x27ec5f=_0x5748eb;if(_0x27ec5f&&_0x27ec5f[_0x5f0e('0x1e')]){switch(_0x27ec5f[_0x5f0e('0x1e')]){case'twilio':var _0x127774=require(_0x5f0e('0x1f'));if(_0x27ec5f[_0x5f0e('0x20')]&&_0x27ec5f[_0x5f0e('0x21')]&&_0x27ec5f[_0x5f0e('0x22')]){var _0x4f6280=new _0x127774(_0x27ec5f[_0x5f0e('0x20')],_0x27ec5f[_0x5f0e('0x21')]);_0x4f6280[_0x5f0e('0x23')][_0x5f0e('0x24')]({'body':_0x5c874f[_0x5f0e('0xf')],'to':_0x5f0e('0x25')+_0x5c874f[_0x5f0e('0x22')],'from':_0x5f0e('0x25')+_0x27ec5f['phone'],'statusCallback':_0x27ec5f[_0x5f0e('0x26')]+_0x5f0e('0x27')+_0x5c874f['id']+_0x5f0e('0x28')+_0x27ec5f['token']})[_0x5f0e('0x19')](function(_0x22ad27){if(_0x22ad27['sid']){return _0x423ecb['update']({'messageId':_0x22ad27[_0x5f0e('0x29')]});}})[_0x5f0e('0x1b')](function(_0x3c7ca6){logger[_0x5f0e('0x1c')](_0x5f0e('0x2a'),_0x5f0e('0x2b'),'twilio',util[_0x5f0e('0x2c')](_0x3c7ca6,{'showHidden':![],'depth':null}));});}else{logger[_0x5f0e('0x1c')](_0x5f0e('0x2a'),_0x5f0e('0x2b'),_0x5f0e('0x1f'),_0x5f0e('0x2d'));}break;case _0x5f0e('0x2e'):var _0x37c6dd=_0x27ec5f[_0x5f0e('0x20')];var _0x5f18e4=_0x27ec5f['authToken'];var _0x5429f9=_0x27ec5f[_0x5f0e('0x2f')]+_0x5f0e('0x30')+_0x37c6dd+'/messages/';var _0x5d76f3={'to':[_0x5c874f['phone']],'message':{'type':_0x5f0e('0x31'),'text':_0x5c874f[_0x5f0e('0xf')]}};var _0x1a3f1c={'method':_0x5f0e('0x32'),'uri':_0x5429f9,'headers':{'Authorization':_0x5f0e('0x33')+_0x5f18e4,'Content-Type':_0x5f0e('0x34')},'body':_0x5d76f3,'json':!![]};rp(_0x1a3f1c)[_0x5f0e('0x19')](function(_0x542388){if(_0x542388[_0x5f0e('0x35')][0x0]['message_id']){return _0x423ecb['update']({'messageId':_0x542388[_0x5f0e('0x35')][0x0]['message_id']});}})[_0x5f0e('0x1b')](function(_0x57104f){logger[_0x5f0e('0x36')](_0x5f0e('0x37'),_0x57104f);});break;}}})[_0x5f0e('0x38')](function(){_0x58b13c();});}else{_0x58b13c();}}},'charset':_0x5f0e('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a20a5a3..1143a70 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ea3=['jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','WhatsappMessage','body','options','raw','CreateWhatsappMessage','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x156e60,_0x18ef4b){var _0xe8a8e3=function(_0x3960ea){while(--_0x3960ea){_0x156e60['push'](_0x156e60['shift']());}};_0xe8a8e3(++_0x18ef4b);}(_0x3ea3,0x107));var _0x33ea=function(_0x52f495,_0x2adf2e){_0x52f495=_0x52f495-0x0;var _0x2ea3f7=_0x3ea3[_0x52f495];return _0x2ea3f7;};'use strict';var _=require('lodash');var util=require(_0x33ea('0x0'));var moment=require(_0x33ea('0x1'));var BPromise=require(_0x33ea('0x2'));var rs=require(_0x33ea('0x3'));var fs=require('fs');var Redis=require(_0x33ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x33ea('0x5'))('rpc');var config=require(_0x33ea('0x6'));var jayson=require(_0x33ea('0x7'));var client=jayson['client'][_0x33ea('0x8')]({'port':0x232a});config['redis']=_[_0x33ea('0x9')](config[_0x33ea('0xa')],{'host':_0x33ea('0xb'),'port':0x18eb});var socket=require(_0x33ea('0xc'))(new Redis(config[_0x33ea('0xa')]));require(_0x33ea('0xd'))[_0x33ea('0xe')](socket);function respondWithRpcPromise(_0x4d2aaa,_0x25116f,_0x293935){return new BPromise(function(_0x2a332a,_0x5e6595){return client['request'](_0x4d2aaa,_0x293935)[_0x33ea('0xf')](function(_0x193c76){logger['info'](_0x33ea('0x10'),_0x25116f,'request\x20sent');logger[_0x33ea('0x11')](_0x33ea('0x12'),_0x25116f,'request\x20sent',JSON[_0x33ea('0x13')](_0x193c76));if(_0x193c76[_0x33ea('0x14')]){if(_0x193c76[_0x33ea('0x14')][_0x33ea('0x15')]===0x1f4){logger[_0x33ea('0x14')](_0x33ea('0x10'),_0x25116f,_0x193c76[_0x33ea('0x14')][_0x33ea('0x16')]);return _0x5e6595(_0x193c76[_0x33ea('0x14')][_0x33ea('0x16')]);}logger[_0x33ea('0x14')](_0x33ea('0x10'),_0x25116f,_0x193c76[_0x33ea('0x14')][_0x33ea('0x16')]);return _0x2a332a(_0x193c76[_0x33ea('0x14')][_0x33ea('0x16')]);}else{logger[_0x33ea('0x17')](_0x33ea('0x10'),_0x25116f,'request\x20sent');_0x2a332a(_0x193c76['result'][_0x33ea('0x16')]);}})[_0x33ea('0x18')](function(_0x367cf9){logger[_0x33ea('0x14')](_0x33ea('0x10'),_0x25116f,_0x367cf9);_0x5e6595(_0x367cf9);});});}exports['CreateWhatsappMessage']=function(_0x45577d){var _0x211d47=this;return new Promise(function(_0xae23ea,_0x1c447f){return db[_0x33ea('0x19')]['create'](_0x45577d[_0x33ea('0x1a')],{'raw':_0x45577d[_0x33ea('0x1b')]?_0x45577d[_0x33ea('0x1b')][_0x33ea('0x1c')]===undefined?!![]:![]:!![]})[_0x33ea('0xf')](function(_0x203567){logger['info'](_0x33ea('0x1d'),_0x45577d);logger[_0x33ea('0x11')](_0x33ea('0x1d'),_0x45577d,JSON[_0x33ea('0x13')](_0x203567));_0xae23ea(_0x203567);})[_0x33ea('0x18')](function(_0x19b16b){logger['error'](_0x33ea('0x1d'),_0x19b16b['message'],_0x45577d);_0x1c447f(_0x211d47['error'](0x1f4,_0x19b16b[_0x33ea('0x16')]));});});}; \ No newline at end of file +var _0x46ac=['request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info'];(function(_0x2f02fe,_0x5e4a1){var _0x20514d=function(_0x55fbd5){while(--_0x55fbd5){_0x2f02fe['push'](_0x2f02fe['shift']());}};_0x20514d(++_0x5e4a1);}(_0x46ac,0xee));var _0xc46a=function(_0x5ade28,_0x73495f){_0x5ade28=_0x5ade28-0x0;var _0x3177be=_0x46ac[_0x5ade28];return _0x3177be;};'use strict';var _=require(_0xc46a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc46a('0x1'));var rs=require(_0xc46a('0x2'));var fs=require('fs');var Redis=require(_0xc46a('0x3'));var db=require(_0xc46a('0x4'))['db'];var utils=require(_0xc46a('0x5'));var logger=require(_0xc46a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc46a('0x7'));var client=jayson['client'][_0xc46a('0x8')]({'port':0x232a});config[_0xc46a('0x9')]=_[_0xc46a('0xa')](config[_0xc46a('0x9')],{'host':_0xc46a('0xb'),'port':0x18eb});var socket=require(_0xc46a('0xc'))(new Redis(config['redis']));require(_0xc46a('0xd'))[_0xc46a('0xe')](socket);function respondWithRpcPromise(_0x5ed37d,_0x25456e,_0x559bea){return new BPromise(function(_0x16df27,_0x1449c4){return client[_0xc46a('0xf')](_0x5ed37d,_0x559bea)[_0xc46a('0x10')](function(_0x185654){logger[_0xc46a('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x25456e,_0xc46a('0x12'));logger[_0xc46a('0x13')](_0xc46a('0x14'),_0x25456e,_0xc46a('0x12'),JSON[_0xc46a('0x15')](_0x185654));if(_0x185654[_0xc46a('0x16')]){if(_0x185654['error'][_0xc46a('0x17')]===0x1f4){logger[_0xc46a('0x16')](_0xc46a('0x18'),_0x25456e,_0x185654['error'][_0xc46a('0x19')]);return _0x1449c4(_0x185654[_0xc46a('0x16')][_0xc46a('0x19')]);}logger[_0xc46a('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x25456e,_0x185654[_0xc46a('0x16')][_0xc46a('0x19')]);return _0x16df27(_0x185654[_0xc46a('0x16')]['message']);}else{logger['info'](_0xc46a('0x18'),_0x25456e,_0xc46a('0x12'));_0x16df27(_0x185654[_0xc46a('0x1a')][_0xc46a('0x19')]);}})[_0xc46a('0x1b')](function(_0x3dc552){logger['error'](_0xc46a('0x18'),_0x25456e,_0x3dc552);_0x1449c4(_0x3dc552);});});}exports[_0xc46a('0x1c')]=function(_0x45f2b1){var _0x48526a=this;return new Promise(function(_0x709d34,_0x2ddf33){return db[_0xc46a('0x1d')][_0xc46a('0x1e')](_0x45f2b1['body'],{'raw':_0x45f2b1[_0xc46a('0x1f')]?_0x45f2b1['options']['raw']===undefined?!![]:![]:!![]})[_0xc46a('0x10')](function(_0x1187ee){logger[_0xc46a('0x11')](_0xc46a('0x1c'),_0x45f2b1);logger[_0xc46a('0x13')](_0xc46a('0x1c'),_0x45f2b1,JSON[_0xc46a('0x15')](_0x1187ee));_0x709d34(_0x1187ee);})[_0xc46a('0x1b')](function(_0x1a1cba){logger[_0xc46a('0x16')](_0xc46a('0x1c'),_0x1a1cba[_0xc46a('0x19')],_0x45f2b1);_0x2ddf33(_0x48526a['error'](0x1f4,_0x1a1cba[_0xc46a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b19ef76..0218854 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf164=['./whatsappMessage.events','save','remove','emit','removeListener','register','whatsappMessage:'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf164,0x1d5));var _0x4f16=function(_0x221246,_0x168ceb){_0x221246=_0x221246-0x0;var _0x13e1ea=_0xf164[_0x221246];return _0x13e1ea;};'use strict';var WhatsappMessageEvents=require(_0x4f16('0x0'));var events=[_0x4f16('0x1'),_0x4f16('0x2'),'update'];function createListener(_0x40cfad,_0x2d86ea){return function(_0x28c5d6){_0x2d86ea[_0x4f16('0x3')](_0x40cfad,_0x28c5d6);};}function removeListener(_0x26b65f,_0x537ae1){return function(){WhatsappMessageEvents[_0x4f16('0x4')](_0x26b65f,_0x537ae1);};}exports[_0x4f16('0x5')]=function(_0x545a47){for(var _0xe30825=0x0,_0xa8bfc3=events['length'];_0xe30825<_0xa8bfc3;_0xe30825++){var _0x3c0d21=events[_0xe30825];var _0x13edeb=createListener(_0x4f16('0x6')+_0x3c0d21,_0x545a47);WhatsappMessageEvents['on'](_0x3c0d21,_0x13edeb);}}; \ No newline at end of file +var _0x2bcf=['register','length','whatsappMessage:','./whatsappMessage.events','remove','emit','removeListener'];(function(_0x7dc938,_0x1f0abb){var _0x3109cd=function(_0x45b802){while(--_0x45b802){_0x7dc938['push'](_0x7dc938['shift']());}};_0x3109cd(++_0x1f0abb);}(_0x2bcf,0x13e));var _0xf2bc=function(_0x718f63,_0x13544f){_0x718f63=_0x718f63-0x0;var _0x3693f5=_0x2bcf[_0x718f63];return _0x3693f5;};'use strict';var WhatsappMessageEvents=require(_0xf2bc('0x0'));var events=['save',_0xf2bc('0x1'),'update'];function createListener(_0x28054c,_0x12e217){return function(_0x12e084){_0x12e217[_0xf2bc('0x2')](_0x28054c,_0x12e084);};}function removeListener(_0x94b45e,_0x468cef){return function(){WhatsappMessageEvents[_0xf2bc('0x3')](_0x94b45e,_0x468cef);};}exports[_0xf2bc('0x4')]=function(_0x3c56ee){for(var _0x5041c7=0x0,_0x21b004=events[_0xf2bc('0x5')];_0x5041c7<_0x21b004;_0x5041c7++){var _0xe3e399=events[_0x5041c7];var _0x52a256=createListener(_0xf2bc('0x6')+_0xe3e399,_0x3c56ee);WhatsappMessageEvents['on'](_0xe3e399,_0x52a256);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 0b81915..c94616f 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x514f=['../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','Router'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x514f,0x1e2));var _0xf514=function(_0xde62d8,_0x56459e){_0xde62d8=_0xde62d8-0x0;var _0x143c89=_0x514f[_0xde62d8];return _0x143c89;};'use strict';var multer=require(_0xf514('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf514('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf514('0x2'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xf514('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf514('0x3')](_0xf514('0x4'),auth[_0xf514('0x5')](),controller[_0xf514('0x6')]);router[_0xf514('0x3')](_0xf514('0x7'),auth[_0xf514('0x5')](),controller[_0xf514('0x8')]);router[_0xf514('0x3')](_0xf514('0x9'),auth[_0xf514('0x5')](),controller[_0xf514('0xa')]);router[_0xf514('0x3')](_0xf514('0xb'),auth[_0xf514('0x5')](),controller['getTeams']);router[_0xf514('0x3')](_0xf514('0xc'),auth[_0xf514('0x5')](),controller[_0xf514('0xd')]);router[_0xf514('0xe')]('/',auth[_0xf514('0x5')](),controller['create']);router[_0xf514('0xe')](_0xf514('0xb'),auth[_0xf514('0x5')](),controller['addTeams']);router[_0xf514('0xe')]('/:id/users',auth['isAuthenticated'](),controller[_0xf514('0xf')]);router[_0xf514('0x10')]('/:id',auth[_0xf514('0x5')](),controller['update']);router['delete'](_0xf514('0x7'),auth[_0xf514('0x5')](),controller[_0xf514('0x11')]);router[_0xf514('0x12')]('/:id/teams',auth[_0xf514('0x5')](),controller[_0xf514('0x13')]);router[_0xf514('0x12')](_0xf514('0xc'),auth[_0xf514('0x5')](),controller[_0xf514('0x14')]);module[_0xf514('0x15')]=router; \ No newline at end of file +var _0xd08b=['/:id/members','getMembers','/:id/teams','post','create','addAgents','put','/:id','delete','removeTeams','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xd08b,0xf5));var _0xbd08=function(_0xe7d561,_0x146cef){_0xe7d561=_0xe7d561-0x0;var _0x4c27f0=_0xd08b[_0xe7d561];return _0x4c27f0;};'use strict';var multer=require('multer');var util=require(_0xbd08('0x0'));var path=require(_0xbd08('0x1'));var timeout=require(_0xbd08('0x2'));var express=require(_0xbd08('0x3'));var router=express[_0xbd08('0x4')]();var fs_extra=require(_0xbd08('0x5'));var auth=require(_0xbd08('0x6'));var interaction=require(_0xbd08('0x7'));var config=require(_0xbd08('0x8'));var controller=require(_0xbd08('0x9'));router[_0xbd08('0xa')]('/',auth[_0xbd08('0xb')](),controller[_0xbd08('0xc')]);router['get'](_0xbd08('0xd'),auth[_0xbd08('0xb')](),controller[_0xbd08('0xe')]);router[_0xbd08('0xa')]('/:id',auth[_0xbd08('0xb')](),controller[_0xbd08('0xf')]);router['get'](_0xbd08('0x10'),auth['isAuthenticated'](),controller[_0xbd08('0x11')]);router[_0xbd08('0xa')](_0xbd08('0x12'),auth[_0xbd08('0xb')](),controller['getTeams']);router[_0xbd08('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xbd08('0x13')]('/',auth[_0xbd08('0xb')](),controller[_0xbd08('0x14')]);router[_0xbd08('0x13')](_0xbd08('0x12'),auth[_0xbd08('0xb')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xbd08('0x15')]);router[_0xbd08('0x16')](_0xbd08('0x17'),auth[_0xbd08('0xb')](),controller['update']);router[_0xbd08('0x18')]('/:id',auth[_0xbd08('0xb')](),controller['destroy']);router[_0xbd08('0x18')]('/:id/teams',auth[_0xbd08('0xb')](),controller[_0xbd08('0x19')]);router[_0xbd08('0x18')](_0xbd08('0x1a'),auth[_0xbd08('0xb')](),controller[_0xbd08('0x1b')]);module[_0xbd08('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 2e38c76..3ad023f 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe13a=['name','INTEGER','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x5c1829,_0x5e5b18){var _0x45dd65=function(_0x2c08bf){while(--_0x2c08bf){_0x5c1829['push'](_0x5c1829['shift']());}};_0x45dd65(++_0x5e5b18);}(_0xe13a,0x178));var _0xae13=function(_0x369744,_0x24b792){_0x369744=_0x369744-0x0;var _0x4d26c8=_0xe13a[_0x369744];return _0x4d26c8;};'use strict';var Sequelize=require('sequelize');module[_0xae13('0x0')]={'name':{'type':Sequelize[_0xae13('0x1')],'unique':_0xae13('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xae13('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xae13('0x4'),_0xae13('0x5'),_0xae13('0x6'))},'description':{'type':Sequelize[_0xae13('0x1')]}}; \ No newline at end of file +var _0xde56=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x3813ad,_0x2eff01){var _0x16ed55=function(_0x406204){while(--_0x406204){_0x3813ad['push'](_0x3813ad['shift']());}};_0x16ed55(++_0x2eff01);}(_0xde56,0x144));var _0x6de5=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0xde56[_0x59eefb];return _0x1a49e8;};'use strict';var Sequelize=require(_0x6de5('0x0'));module['exports']={'name':{'type':Sequelize[_0x6de5('0x1')],'unique':_0x6de5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6de5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6de5('0x4')](_0x6de5('0x5'),_0x6de5('0x6'),_0x6de5('0x7'))},'description':{'type':Sequelize[_0x6de5('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 7abbbd7..14bff82 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32c1=['format','SIP','whatsappPause','getTeams','Team','where','addTeams','ids','User','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','includes','all','compact','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','order','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','then','destroy','get','UserProfileResource','error','stack','index','map','fieldName','key','getOptions','WhatsappQueue','include','findAll','rows','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','catch','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','sort','pick','WhatsappQueueId','filter','merge','findAndCountAll','UserId','agent','updatedAt','createdAt'];(function(_0x5b60c5,_0x391a87){var _0x4e4537=function(_0x3591a6){while(--_0x3591a6){_0x5b60c5['push'](_0x5b60c5['shift']());}};_0x4e4537(++_0x391a87);}(_0x32c1,0xa7));var _0x132c=function(_0x3c39a6,_0x3101f8){_0x3c39a6=_0x3c39a6-0x0;var _0x4792a4=_0x32c1[_0x3c39a6];return _0x4792a4;};'use strict';var BPromise=require(_0x132c('0x0'));var util=require(_0x132c('0x1'));var _=require('lodash');var squel=require(_0x132c('0x2'));var Redis=require(_0x132c('0x3'));var qs=require(_0x132c('0x4'));var logger=require(_0x132c('0x5'))(_0x132c('0x6'));var config=require(_0x132c('0x7'));var db=require(_0x132c('0x8'))['db'];config[_0x132c('0x9')]=_[_0x132c('0xa')](config[_0x132c('0x9')],{'host':_0x132c('0xb'),'port':0x18eb});var socket=require(_0x132c('0xc'))(new Redis(config['redis']));require(_0x132c('0xd'))['register'](socket);function respondWithStatusCode(_0x39b232,_0xd45c74){_0xd45c74=_0xd45c74||0xcc;return function(_0x382d76){if(_0x382d76){return _0x39b232[_0x132c('0xe')](_0xd45c74);}return _0x39b232[_0x132c('0xf')](_0xd45c74)[_0x132c('0x10')]();};}function respondWithResult(_0x5c6777,_0x1e76b6){_0x1e76b6=_0x1e76b6||0xc8;return function(_0x6f78eb){if(_0x6f78eb){return _0x5c6777[_0x132c('0xf')](_0x1e76b6)['json'](_0x6f78eb);}};}function respondWithFilteredResult(_0x5b12a4,_0x5964b9){return function(_0x4f70f7){if(_0x4f70f7){var _0xea448a=typeof _0x5964b9['offset']===_0x132c('0x11')&&typeof _0x5964b9[_0x132c('0x12')]===_0x132c('0x11');var _0x19a235=_0x4f70f7[_0x132c('0x13')];var _0x31d1c4=_0xea448a?0x0:_0x5964b9['offset'];var _0x3a4702=_0xea448a?_0x4f70f7[_0x132c('0x13')]:_0x5964b9[_0x132c('0x14')]+_0x5964b9['limit'];var _0x56ddcf;if(_0x3a4702>=_0x19a235){_0x3a4702=_0x19a235;_0x56ddcf=0xc8;}else{_0x56ddcf=0xce;}_0x5b12a4[_0x132c('0xf')](_0x56ddcf);return _0x5b12a4[_0x132c('0x15')](_0x132c('0x16'),_0x31d1c4+'-'+_0x3a4702+'/'+_0x19a235)['json'](_0x4f70f7);}return null;};}function saveUpdates(_0x144dfe){return function(_0x4a76ed){if(_0x4a76ed){return _0x4a76ed['update'](_0x144dfe)[_0x132c('0x17')](function(_0x5b0459){return _0x5b0459;});}return null;};}function removeEntity(_0x37a27b){return function(_0x29129d){if(_0x29129d){return _0x29129d[_0x132c('0x18')]()[_0x132c('0x17')](function(){var _0x570f32=_0x29129d[_0x132c('0x19')]({'plain':!![]});var _0x223d31='WhatsappQueues';return db[_0x132c('0x1a')][_0x132c('0x18')]({'where':{'type':_0x223d31,'resourceId':_0x570f32['id']}})['then'](function(){return _0x29129d;});})['then'](function(){_0x37a27b[_0x132c('0xf')](0xcc)[_0x132c('0x10')]();});}};}function handleEntityNotFound(_0x1e7bfa){return function(_0xdd8e60){if(!_0xdd8e60){_0x1e7bfa['sendStatus'](0x194);}return _0xdd8e60;};}function handleError(_0x5c4c79,_0x279e2a){_0x279e2a=_0x279e2a||0x1f4;return function(_0x54e3eb){logger[_0x132c('0x1b')](_0x54e3eb[_0x132c('0x1c')]);if(_0x54e3eb['name']){delete _0x54e3eb['name'];}_0x5c4c79[_0x132c('0xf')](_0x279e2a)['send'](_0x54e3eb);};}exports[_0x132c('0x1d')]=function(_0x50077f,_0x27a906){var _0x508a06={};var _0xe70454={'count':0x0,'rows':[]};var _0x4f746f=_[_0x132c('0x1e')](db['WhatsappQueue']['rawAttributes'],function(_0x513ee0){return{'name':_0x513ee0[_0x132c('0x1f')],'type':_0x513ee0['type'][_0x132c('0x20')]};});_0x508a06=qs[_0x132c('0x21')](_0x4f746f,_0x50077f);var _0x1a12f1={'where':_0x508a06['where']};return db[_0x132c('0x22')][_0x132c('0x13')](_0x1a12f1)[_0x132c('0x17')](function(_0x3d4751){_0xe70454[_0x132c('0x13')]=_0x3d4751;_0x508a06['include']=qs[_0x132c('0x23')](_0x50077f['query']);return db['WhatsappQueue'][_0x132c('0x24')](_0x508a06);})['then'](function(_0x19d1e7){_0xe70454[_0x132c('0x25')]=_0x19d1e7;return _0xe70454;})['then'](respondWithFilteredResult(_0x27a906,_0x508a06))['catch'](handleError(_0x27a906,null));};exports[_0x132c('0x26')]=function(_0x55e0cb,_0x4d693f){var _0x10f252={'raw':!![],'where':{'id':_0x55e0cb[_0x132c('0x27')]['id']}},_0x54acf1={};_0x54acf1[_0x132c('0x28')]=_[_0x132c('0x29')](db[_0x132c('0x22')][_0x132c('0x2a')]);_0x54acf1['query']=_[_0x132c('0x29')](_0x55e0cb[_0x132c('0x2b')]);_0x54acf1[_0x132c('0x2c')]=_[_0x132c('0x2d')](_0x54acf1[_0x132c('0x28')],_0x54acf1[_0x132c('0x2b')]);_0x10f252[_0x132c('0x2e')]=_[_0x132c('0x2d')](_0x54acf1[_0x132c('0x28')],qs['fields'](_0x55e0cb[_0x132c('0x2b')][_0x132c('0x2f')]));_0x10f252[_0x132c('0x2e')]=_0x10f252[_0x132c('0x2e')][_0x132c('0x30')]?_0x10f252[_0x132c('0x2e')]:_0x54acf1[_0x132c('0x28')];if(_0x55e0cb[_0x132c('0x2b')]['includeAll']){_0x10f252[_0x132c('0x23')]=[{'all':!![]}];}_0x10f252=_['merge']({},_0x10f252,_0x55e0cb[_0x132c('0x31')]);return db[_0x132c('0x22')][_0x132c('0x32')](_0x10f252)[_0x132c('0x17')](handleEntityNotFound(_0x4d693f,null))[_0x132c('0x17')](respondWithResult(_0x4d693f,null))['catch'](handleError(_0x4d693f,null));};exports[_0x132c('0x33')]=function(_0x2f3c79,_0x67aa7b){return db[_0x132c('0x22')][_0x132c('0x33')](_0x2f3c79[_0x132c('0x34')],{})[_0x132c('0x17')](function(_0x5d9f87){var _0x343b13=_0x2f3c79[_0x132c('0x35')][_0x132c('0x19')]({'plain':!![]});if(!_0x343b13)throw new Error(_0x132c('0x36'));if(_0x343b13[_0x132c('0x37')]===_0x132c('0x35')){var _0x549497=_0x5d9f87[_0x132c('0x19')]({'plain':!![]});var _0x42a34f=_0x132c('0x38');return db[_0x132c('0x39')][_0x132c('0x32')]({'where':{'name':_0x42a34f,'userProfileId':_0x343b13['userProfileId']},'raw':!![]})[_0x132c('0x17')](function(_0x161a16){if(_0x161a16&&_0x161a16[_0x132c('0x3a')]===0x0){return db[_0x132c('0x1a')]['create']({'name':_0x549497[_0x132c('0x3b')],'resourceId':_0x549497['id'],'type':_0x161a16['name'],'sectionId':_0x161a16['id']},{})[_0x132c('0x17')](function(){return _0x5d9f87;});}else{return _0x5d9f87;}})['catch'](function(_0x42f9e8){logger[_0x132c('0x1b')](_0x132c('0x3c'),_0x42f9e8);throw _0x42f9e8;});}return _0x5d9f87;})[_0x132c('0x17')](respondWithResult(_0x67aa7b,0xc9))['catch'](handleError(_0x67aa7b,null));};exports[_0x132c('0x3d')]=function(_0x3d816d,_0x30d37c){if(_0x3d816d[_0x132c('0x34')]['id']){delete _0x3d816d['body']['id'];}return db[_0x132c('0x22')][_0x132c('0x32')]({'where':{'id':_0x3d816d[_0x132c('0x27')]['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x30d37c,null))['then'](saveUpdates(_0x3d816d[_0x132c('0x34')],null))['then'](respondWithResult(_0x30d37c,null))[_0x132c('0x3e')](handleError(_0x30d37c,null));};exports[_0x132c('0x18')]=function(_0x5a5eef,_0x2a445c){return db['WhatsappQueue']['find']({'where':{'id':_0x5a5eef[_0x132c('0x27')]['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x2a445c,null))[_0x132c('0x17')](removeEntity(_0x2a445c,null))[_0x132c('0x3e')](handleError(_0x2a445c,null));};exports[_0x132c('0x3f')]=function(_0x559306,_0x183573){return db[_0x132c('0x22')]['describe']()[_0x132c('0x17')](respondWithResult(_0x183573,null))['catch'](handleError(_0x183573,null));};exports[_0x132c('0x40')]=function(_0xee6d48,_0x29c6c8){var _0x490d04={'raw':!![],'where':{}},_0x5307a4={},_0x99403e;return db[_0x132c('0x22')][_0x132c('0x41')]({'where':{'id':_0xee6d48[_0x132c('0x27')]['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x29c6c8,null))[_0x132c('0x17')](function(_0x1a2c9c){if(_0x1a2c9c){_0x99403e=_0x1a2c9c['get']({'plain':!![]});_0x5307a4['model']=_[_0x132c('0x29')](db[_0x132c('0x42')][_0x132c('0x2a')]);_0x5307a4['query']=_['keys'](_0xee6d48['query']);_0x5307a4[_0x132c('0x2c')]=_['intersection'](_0x5307a4[_0x132c('0x28')],_0x5307a4[_0x132c('0x2b')]);_0x490d04[_0x132c('0x2e')]=_[_0x132c('0x2d')](_0x5307a4[_0x132c('0x28')],qs['fields'](_0xee6d48[_0x132c('0x2b')]['fields']));_0x490d04[_0x132c('0x2e')]=_0x490d04[_0x132c('0x2e')][_0x132c('0x30')]?_0x490d04['attributes']:_0x5307a4['model'];if(!_0xee6d48[_0x132c('0x2b')][_0x132c('0x43')](_0x132c('0x44'))){_0x490d04[_0x132c('0x12')]=qs[_0x132c('0x12')](_0xee6d48[_0x132c('0x2b')][_0x132c('0x12')]);_0x490d04['offset']=qs[_0x132c('0x14')](_0xee6d48['query'][_0x132c('0x14')]);}_0x490d04['order']=qs['sort'](_0xee6d48[_0x132c('0x2b')][_0x132c('0x45')]);_0x490d04['where']=qs[_0x132c('0x2c')](_[_0x132c('0x46')](_0xee6d48[_0x132c('0x2b')],_0x5307a4[_0x132c('0x2c')]));_0x490d04['where'][_0x132c('0x47')]=_0x1a2c9c['id'];if(_0xee6d48['query'][_0x132c('0x48')]){_0x490d04['where']=_[_0x132c('0x49')](_0x490d04['where'],{'$or':_['map'](_0x490d04['attributes'],function(_0x1736fa){var _0xc89782={};_0xc89782[_0x1736fa]={'$like':'%'+_0xee6d48[_0x132c('0x2b')][_0x132c('0x48')]+'%'};return _0xc89782;})});}_0x490d04=_['merge']({},_0x490d04,_0xee6d48[_0x132c('0x31')]);return db['UserWhatsappQueue'][_0x132c('0x24')](_0x490d04);}})[_0x132c('0x17')](function(_0x180211){if(_0x180211){return db['User'][_0x132c('0x4a')]({'where':{'id':_['map'](_0x180211,_0x132c('0x4b')),'role':_0x132c('0x4c')},'attributes':['id',_0x132c('0x3b'),'whatsappPause',_0x132c('0x4d'),_0x132c('0x4e')]});}})[_0x132c('0x17')](function(_0x585f43){if(_0x585f43){return{'count':_0x585f43[_0x132c('0x13')],'rows':_[_0x132c('0x1e')](_0x585f43[_0x132c('0x25')],function(_0x4f7b7a){return{'membername':_0x4f7b7a[_0x132c('0x3b')],'UserId':_0x4f7b7a['id'],'queue_name':_0x99403e[_0x132c('0x3b')],'WhatsappQueueId':_0x99403e['id'],'interface':util[_0x132c('0x4f')]('%s/%s',_0x132c('0x50'),_0x4f7b7a[_0x132c('0x3b')]),'penalty':0x0,'paused':_0x4f7b7a[_0x132c('0x51')],'createdAt':_0x4f7b7a['createdAt'],'updatedAt':_0x4f7b7a[_0x132c('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x132c('0x17')](respondWithFilteredResult(_0x29c6c8,_0x490d04))[_0x132c('0x3e')](handleError(_0x29c6c8,null));};exports[_0x132c('0x52')]=function(_0x1d0547,_0x1a4a9e){var _0x357039={};var _0x1b1ffd={};var _0x2a5b0b;var _0x3cc83a;return db[_0x132c('0x22')][_0x132c('0x41')]({'where':{'id':_0x1d0547['params']['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x1a4a9e,null))[_0x132c('0x17')](function(_0x56c5fa){if(_0x56c5fa){_0x2a5b0b=_0x56c5fa;_0x1b1ffd[_0x132c('0x28')]=_[_0x132c('0x29')](db[_0x132c('0x53')]['rawAttributes']);_0x1b1ffd[_0x132c('0x2b')]=_['keys'](_0x1d0547[_0x132c('0x2b')]);_0x1b1ffd[_0x132c('0x2c')]=_[_0x132c('0x2d')](_0x1b1ffd[_0x132c('0x28')],_0x1b1ffd[_0x132c('0x2b')]);_0x357039[_0x132c('0x2e')]=_[_0x132c('0x2d')](_0x1b1ffd[_0x132c('0x28')],qs[_0x132c('0x2f')](_0x1d0547['query'][_0x132c('0x2f')]));_0x357039[_0x132c('0x2e')]=_0x357039[_0x132c('0x2e')][_0x132c('0x30')]?_0x357039[_0x132c('0x2e')]:_0x1b1ffd[_0x132c('0x28')];_0x357039['order']=qs[_0x132c('0x45')](_0x1d0547['query'][_0x132c('0x45')]);_0x357039[_0x132c('0x54')]=qs[_0x132c('0x2c')](_[_0x132c('0x46')](_0x1d0547[_0x132c('0x2b')],_0x1b1ffd[_0x132c('0x2c')]));if(_0x1d0547[_0x132c('0x2b')]['filter']){_0x357039['where']=_[_0x132c('0x49')](_0x357039['where'],{'$or':_[_0x132c('0x1e')](_0x357039[_0x132c('0x2e')],function(_0x5904d4){var _0x5cbbfb={};_0x5cbbfb[_0x5904d4]={'$like':'%'+_0x1d0547['query']['filter']+'%'};return _0x5cbbfb;})});}_0x357039=_['merge']({},_0x357039,_0x1d0547[_0x132c('0x31')]);return _0x2a5b0b[_0x132c('0x52')](_0x357039);}})['then'](function(_0x14233a){if(_0x14233a){_0x3cc83a=_0x14233a[_0x132c('0x30')];if(!_0x1d0547[_0x132c('0x2b')][_0x132c('0x43')]('nolimit')){_0x357039[_0x132c('0x12')]=qs[_0x132c('0x12')](_0x1d0547[_0x132c('0x2b')][_0x132c('0x12')]);_0x357039[_0x132c('0x14')]=qs['offset'](_0x1d0547[_0x132c('0x2b')]['offset']);}return _0x2a5b0b['getTeams'](_0x357039);}})[_0x132c('0x17')](function(_0x4dc4d1){if(_0x4dc4d1){return _0x4dc4d1?{'count':_0x3cc83a,'rows':_0x4dc4d1}:null;}})[_0x132c('0x17')](respondWithResult(_0x1a4a9e,null))[_0x132c('0x3e')](handleError(_0x1a4a9e,null));};exports[_0x132c('0x55')]=function(_0x8faea7,_0x40206e){var _0x26ab76=_0x8faea7[_0x132c('0x34')][_0x132c('0x56')];return db[_0x132c('0x53')]['findAll']({'where':{'id':_0x26ab76},'attributes':['id'],'include':[{'model':db[_0x132c('0x57')],'as':_0x132c('0x58'),'attributes':['id',_0x132c('0x3b'),_0x132c('0x59'),_0x132c('0x5a'),'interface'],'raw':!![]}]})['then'](function(_0x9c52cf){if(_0x9c52cf){var _0x2b327e=_[_0x132c('0x5b')](_0x9c52cf,function(_0x5119bf){var _0x460209=_0x5119bf[_0x132c('0x19')]({'plain':!![]});return _0x460209[_0x132c('0x58')];});return db['WhatsappQueue'][_0x132c('0x32')]({'where':{'id':_0x8faea7[_0x132c('0x27')]['id']}})['then'](function(_0x314555){return db['sequelize'][_0x132c('0x5c')](function(_0x410c87){return _0x314555[_0x132c('0x55')](_0x26ab76,{'transaction':_0x410c87})[_0x132c('0x17')](function(){return BPromise[_0x132c('0x5d')](_0x2b327e,function(_0x3695a5){return db[_0x132c('0x42')][_0x132c('0x5e')]({'where':{'UserId':_0x3695a5['id'],'WhatsappQueueId':_0x8faea7[_0x132c('0x27')]['id']},'transaction':_0x410c87});});})[_0x132c('0x17')](function(){_0x2b327e[_0x132c('0x5f')](function(_0x2ca185){socket[_0x132c('0x60')](_0x132c('0x61'),{'UserId':_0x2ca185['id'],'WhatsappQueueId':_0x314555['id']});});});});});}})[_0x132c('0x17')](respondWithStatusCode(_0x40206e,null))[_0x132c('0x3e')](handleError(_0x40206e,null));};exports[_0x132c('0x62')]=function(_0x86b5fe,_0x12e46e){return db[_0x132c('0x53')][_0x132c('0x24')]({'where':{'id':_0x86b5fe['query'][_0x132c('0x56')]},'attributes':['id'],'include':[{'model':db[_0x132c('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x132c('0x17')](handleEntityNotFound(_0x12e46e,null))[_0x132c('0x17')](function(_0x14edd2){var _0x570ffe=_[_0x132c('0x1e')](_0x14edd2,'id');var _0x46c29b=[];var _0x2ec9f1=[];var _0x346449=squel[_0x132c('0x63')]();_0x346449[_0x132c('0x64')](_0x132c('0x65'))[_0x132c('0x66')]('team_has_whatsapp_queues','tq')['join'](_0x132c('0x67'),'ut',_0x132c('0x68'))[_0x132c('0x54')](_0x132c('0x69'),_0x86b5fe[_0x132c('0x27')]['id']);for(var _0x1cf70a=0x0;_0x1cf70a<_0x14edd2['length'];_0x1cf70a+=0x1){let _0x3526ba=_0x14edd2[_0x1cf70a];for(var _0x57d403=0x0;_0x57d403<_0x3526ba[_0x132c('0x58')][_0x132c('0x30')];_0x57d403+=0x1){let _0x17ad11=_0x3526ba[_0x132c('0x58')][_0x57d403];var _0x304fa3=_0x346449['clone']();_0x304fa3[_0x132c('0x54')](_0x132c('0x6a'),_0x17ad11['id']);_0x2ec9f1[_0x132c('0x6b')](db['sequelize'][_0x132c('0x2b')](_0x304fa3[_0x132c('0x6c')](),{'type':db[_0x132c('0x6d')]['QueryTypes'][_0x132c('0x6e')]})[_0x132c('0x17')](function(_0x3f8604){if(_0x3f8604[_0x132c('0x30')]===0x1){return _0x17ad11['id'];}else{var _0x17e87f=_[_0x132c('0x6f')](_[_0x132c('0x1e')](_0x3f8604,'TeamId'),function(_0x3e5a1d){return _[_0x132c('0x70')](_0x570ffe,_0x3e5a1d);});if(_0x17e87f){return _0x17ad11['id'];}}}));}}return BPromise[_0x132c('0x71')](_0x2ec9f1)[_0x132c('0x17')](function(_0x4c7f29){_0x46c29b=_(_0x46c29b)['union'](_0x4c7f29)[_0x132c('0x72')]()['value']();return db[_0x132c('0x22')][_0x132c('0x32')]({'where':{'id':_0x86b5fe[_0x132c('0x27')]['id']}})[_0x132c('0x17')](function(_0xd26834){return db['sequelize']['transaction'](function(_0xf56c1e){return _0xd26834['removeTeams'](_0x86b5fe['query'][_0x132c('0x56')],{'transaction':_0xf56c1e})[_0x132c('0x17')](function(){if(!_['isEmpty'](_0x46c29b)){return _0xd26834['removeAgents'](_0x46c29b,{'transaction':_0xf56c1e});}})[_0x132c('0x17')](function(){_0x46c29b[_0x132c('0x5f')](function(_0x474ac5){socket[_0x132c('0x60')](_0x132c('0x73'),{'UserId':_0x474ac5,'WhatsappQueueId':_0xd26834['id']});});});});});});})[_0x132c('0x17')](respondWithStatusCode(_0x12e46e,null))['catch'](handleError(_0x12e46e,null));};exports[_0x132c('0x74')]=function(_0x58d827,_0x1f4f2f){return db[_0x132c('0x22')][_0x132c('0x32')]({'where':{'id':_0x58d827['params']['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x1f4f2f,null))[_0x132c('0x17')](function(_0x54c826){if(_0x54c826){return _0x54c826['addAgents'](_0x58d827['body'][_0x132c('0x56')],_[_0x132c('0x75')](_0x58d827['body'],[_0x132c('0x56'),'id'])||{})[_0x132c('0x76')](function(_0x2dde2a){for(var _0x150401=0x0;_0x150401<_0x58d827[_0x132c('0x34')][_0x132c('0x56')][_0x132c('0x30')];_0x150401+=0x1){socket['emit'](_0x132c('0x61'),{'UserId':Number(_0x58d827[_0x132c('0x34')][_0x132c('0x56')][_0x150401]),'WhatsappQueueId':Number(_0x58d827[_0x132c('0x27')]['id'])});}return _0x2dde2a;});}})[_0x132c('0x17')](respondWithResult(_0x1f4f2f,null))['catch'](handleError(_0x1f4f2f,null));};exports[_0x132c('0x77')]=function(_0x19b5b9,_0x537726){return db[_0x132c('0x22')][_0x132c('0x32')]({'where':{'id':_0x19b5b9[_0x132c('0x27')]['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x537726,null))[_0x132c('0x17')](function(_0x53fa95){if(_0x53fa95){return _0x53fa95[_0x132c('0x77')](_0x19b5b9[_0x132c('0x2b')][_0x132c('0x56')])[_0x132c('0x17')](function(){if(_[_0x132c('0x78')](_0x19b5b9[_0x132c('0x2b')]['ids'])){for(var _0x3ae20d=0x0;_0x3ae20d<_0x19b5b9[_0x132c('0x2b')][_0x132c('0x56')]['length'];_0x3ae20d+=0x1){socket[_0x132c('0x60')](_0x132c('0x73'),{'UserId':Number(_0x19b5b9[_0x132c('0x2b')][_0x132c('0x56')][_0x3ae20d]),'WhatsappQueueId':Number(_0x19b5b9[_0x132c('0x27')]['id'])});}}else{socket[_0x132c('0x60')](_0x132c('0x73'),{'UserId':Number(_0x19b5b9[_0x132c('0x2b')][_0x132c('0x56')]),'WhatsappQueueId':Number(_0x19b5b9[_0x132c('0x27')]['id'])});}});}})[_0x132c('0x17')](respondWithStatusCode(_0x537726,null))['catch'](handleError(_0x537726,null));};exports[_0x132c('0x79')]=function(_0xd243b7,_0x48a2db){var _0xbb043={};var _0x3dfe2f={};var _0x9e5221;var _0xba9c86;return db['WhatsappQueue']['findOne']({'where':{'id':_0xd243b7[_0x132c('0x27')]['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x48a2db,null))[_0x132c('0x17')](function(_0x5ddc5c){if(_0x5ddc5c){_0x9e5221=_0x5ddc5c;_0x3dfe2f[_0x132c('0x28')]=_['keys'](db['User'][_0x132c('0x2a')]);_0x3dfe2f[_0x132c('0x2b')]=_[_0x132c('0x29')](_0xd243b7[_0x132c('0x2b')]);_0x3dfe2f[_0x132c('0x2c')]=_['intersection'](_0x3dfe2f['model'],_0x3dfe2f['query']);_0xbb043[_0x132c('0x2e')]=_[_0x132c('0x2d')](_0x3dfe2f[_0x132c('0x28')],qs['fields'](_0xd243b7[_0x132c('0x2b')][_0x132c('0x2f')]));_0xbb043[_0x132c('0x2e')]=_0xbb043[_0x132c('0x2e')]['length']?_0xbb043[_0x132c('0x2e')]:_0x3dfe2f['model'];_0xbb043[_0x132c('0x7a')]=qs[_0x132c('0x45')](_0xd243b7['query'][_0x132c('0x45')]);_0xbb043[_0x132c('0x54')]=qs[_0x132c('0x2c')](_['pick'](_0xd243b7[_0x132c('0x2b')],_0x3dfe2f[_0x132c('0x2c')]));if(_0xd243b7[_0x132c('0x2b')][_0x132c('0x48')]){_0xbb043[_0x132c('0x54')]=_[_0x132c('0x49')](_0xbb043['where'],{'$or':_[_0x132c('0x1e')](_0xbb043[_0x132c('0x2e')],function(_0x174c99){var _0x3dfc7e={};_0x3dfc7e[_0x174c99]={'$like':'%'+_0xd243b7['query']['filter']+'%'};return _0x3dfc7e;})});}_0xbb043=_['merge']({},_0xbb043,_0xd243b7[_0x132c('0x31')]);return _0x9e5221[_0x132c('0x79')](_0xbb043);}})[_0x132c('0x17')](function(_0x2fa834){if(_0x2fa834){_0xba9c86=_0x2fa834[_0x132c('0x30')];if(!_0xd243b7['query']['hasOwnProperty'](_0x132c('0x44'))){_0xbb043[_0x132c('0x12')]=qs[_0x132c('0x12')](_0xd243b7['query']['limit']);_0xbb043[_0x132c('0x14')]=qs[_0x132c('0x14')](_0xd243b7[_0x132c('0x2b')][_0x132c('0x14')]);}return _0x9e5221[_0x132c('0x79')](_0xbb043);}})[_0x132c('0x17')](function(_0x59d3cc){if(_0x59d3cc){return _0x59d3cc?{'count':_0xba9c86,'rows':_0x59d3cc}:null;}})[_0x132c('0x17')](respondWithResult(_0x48a2db,null))['catch'](handleError(_0x48a2db,null));}; \ No newline at end of file +var _0xf8d2=['Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','includes','all','compact','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','offset','count','set','Content-Range','json','update','then','destroy','get','WhatsappQueues','error','stack','name','send','rawAttributes','fieldName','type','key','getOptions','include','query','WhatsappQueue','findAll','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','includeAll','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','length','hasOwnProperty','nolimit','limit','sort','where','pick','WhatsappQueueId','filter','User','findAndCountAll','map','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','order','getTeams','ids'];(function(_0x2d6660,_0x32e8e9){var _0x378484=function(_0x4d10df){while(--_0x4d10df){_0x2d6660['push'](_0x2d6660['shift']());}};_0x378484(++_0x32e8e9);}(_0xf8d2,0x114));var _0x2f8d=function(_0x255bd2,_0x1c20bc){_0x255bd2=_0x255bd2-0x0;var _0x5061f6=_0xf8d2[_0x255bd2];return _0x5061f6;};'use strict';var BPromise=require(_0x2f8d('0x0'));var util=require(_0x2f8d('0x1'));var _=require(_0x2f8d('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x2f8d('0x3'));var logger=require(_0x2f8d('0x4'))('api');var config=require(_0x2f8d('0x5'));var db=require('../../mysqldb')['db'];config[_0x2f8d('0x6')]=_[_0x2f8d('0x7')](config['redis'],{'host':_0x2f8d('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2f8d('0x9'))[_0x2f8d('0xa')](socket);function respondWithStatusCode(_0x500418,_0x50ff9e){_0x50ff9e=_0x50ff9e||0xcc;return function(_0x2e8628){if(_0x2e8628){return _0x500418[_0x2f8d('0xb')](_0x50ff9e);}return _0x500418[_0x2f8d('0xc')](_0x50ff9e)[_0x2f8d('0xd')]();};}function respondWithResult(_0x1fbcd9,_0x360374){_0x360374=_0x360374||0xc8;return function(_0x236c99){if(_0x236c99){return _0x1fbcd9['status'](_0x360374)['json'](_0x236c99);}};}function respondWithFilteredResult(_0x3ad18e,_0x20f2aa){return function(_0x137186){if(_0x137186){var _0x3c1aa6=typeof _0x20f2aa[_0x2f8d('0xe')]==='undefined'&&typeof _0x20f2aa['limit']==='undefined';var _0x3253d3=_0x137186[_0x2f8d('0xf')];var _0x2df749=_0x3c1aa6?0x0:_0x20f2aa[_0x2f8d('0xe')];var _0x4aa931=_0x3c1aa6?_0x137186[_0x2f8d('0xf')]:_0x20f2aa[_0x2f8d('0xe')]+_0x20f2aa['limit'];var _0x5adcf4;if(_0x4aa931>=_0x3253d3){_0x4aa931=_0x3253d3;_0x5adcf4=0xc8;}else{_0x5adcf4=0xce;}_0x3ad18e['status'](_0x5adcf4);return _0x3ad18e[_0x2f8d('0x10')](_0x2f8d('0x11'),_0x2df749+'-'+_0x4aa931+'/'+_0x3253d3)[_0x2f8d('0x12')](_0x137186);}return null;};}function saveUpdates(_0x216104){return function(_0x3d1430){if(_0x3d1430){return _0x3d1430[_0x2f8d('0x13')](_0x216104)[_0x2f8d('0x14')](function(_0xacdd91){return _0xacdd91;});}return null;};}function removeEntity(_0x12b1a8){return function(_0x1799c6){if(_0x1799c6){return _0x1799c6[_0x2f8d('0x15')]()[_0x2f8d('0x14')](function(){var _0x22d133=_0x1799c6[_0x2f8d('0x16')]({'plain':!![]});var _0x453022=_0x2f8d('0x17');return db['UserProfileResource'][_0x2f8d('0x15')]({'where':{'type':_0x453022,'resourceId':_0x22d133['id']}})[_0x2f8d('0x14')](function(){return _0x1799c6;});})[_0x2f8d('0x14')](function(){_0x12b1a8[_0x2f8d('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e8d4c){return function(_0x3986cf){if(!_0x3986cf){_0x1e8d4c[_0x2f8d('0xb')](0x194);}return _0x3986cf;};}function handleError(_0x2e2124,_0x39c96b){_0x39c96b=_0x39c96b||0x1f4;return function(_0x4676d8){logger[_0x2f8d('0x18')](_0x4676d8[_0x2f8d('0x19')]);if(_0x4676d8[_0x2f8d('0x1a')]){delete _0x4676d8[_0x2f8d('0x1a')];}_0x2e2124[_0x2f8d('0xc')](_0x39c96b)[_0x2f8d('0x1b')](_0x4676d8);};}exports['index']=function(_0xd3d3ad,_0xd8b6a7){var _0x539459={};var _0x5b38bf={'count':0x0,'rows':[]};var _0xfc1dad=_['map'](db['WhatsappQueue'][_0x2f8d('0x1c')],function(_0x475cad){return{'name':_0x475cad[_0x2f8d('0x1d')],'type':_0x475cad[_0x2f8d('0x1e')][_0x2f8d('0x1f')]};});_0x539459=qs[_0x2f8d('0x20')](_0xfc1dad,_0xd3d3ad);var _0x1b69b9={'where':_0x539459['where']};return db['WhatsappQueue'][_0x2f8d('0xf')](_0x1b69b9)[_0x2f8d('0x14')](function(_0x4f61f7){_0x5b38bf[_0x2f8d('0xf')]=_0x4f61f7;_0x539459[_0x2f8d('0x21')]=qs[_0x2f8d('0x21')](_0xd3d3ad[_0x2f8d('0x22')]);return db[_0x2f8d('0x23')][_0x2f8d('0x24')](_0x539459);})['then'](function(_0x1d4559){_0x5b38bf[_0x2f8d('0x25')]=_0x1d4559;return _0x5b38bf;})[_0x2f8d('0x14')](respondWithFilteredResult(_0xd8b6a7,_0x539459))[_0x2f8d('0x26')](handleError(_0xd8b6a7,null));};exports[_0x2f8d('0x27')]=function(_0x123552,_0x4c5496){var _0x4b52e6={'raw':!![],'where':{'id':_0x123552[_0x2f8d('0x28')]['id']}},_0x40001c={};_0x40001c[_0x2f8d('0x29')]=_[_0x2f8d('0x2a')](db[_0x2f8d('0x23')][_0x2f8d('0x1c')]);_0x40001c[_0x2f8d('0x22')]=_[_0x2f8d('0x2a')](_0x123552[_0x2f8d('0x22')]);_0x40001c[_0x2f8d('0x2b')]=_[_0x2f8d('0x2c')](_0x40001c[_0x2f8d('0x29')],_0x40001c[_0x2f8d('0x22')]);_0x4b52e6['attributes']=_[_0x2f8d('0x2c')](_0x40001c[_0x2f8d('0x29')],qs[_0x2f8d('0x2d')](_0x123552[_0x2f8d('0x22')][_0x2f8d('0x2d')]));_0x4b52e6[_0x2f8d('0x2e')]=_0x4b52e6[_0x2f8d('0x2e')]['length']?_0x4b52e6[_0x2f8d('0x2e')]:_0x40001c[_0x2f8d('0x29')];if(_0x123552[_0x2f8d('0x22')][_0x2f8d('0x2f')]){_0x4b52e6['include']=[{'all':!![]}];}_0x4b52e6=_[_0x2f8d('0x30')]({},_0x4b52e6,_0x123552[_0x2f8d('0x31')]);return db['WhatsappQueue']['find'](_0x4b52e6)[_0x2f8d('0x14')](handleEntityNotFound(_0x4c5496,null))['then'](respondWithResult(_0x4c5496,null))[_0x2f8d('0x26')](handleError(_0x4c5496,null));};exports[_0x2f8d('0x32')]=function(_0x3ef585,_0x593102){return db['WhatsappQueue'][_0x2f8d('0x32')](_0x3ef585[_0x2f8d('0x33')],{})[_0x2f8d('0x14')](function(_0x5a55af){var _0x4d6dd1=_0x3ef585['user'][_0x2f8d('0x16')]({'plain':!![]});if(!_0x4d6dd1)throw new Error(_0x2f8d('0x34'));if(_0x4d6dd1['role']===_0x2f8d('0x35')){var _0x5fbf1e=_0x5a55af[_0x2f8d('0x16')]({'plain':!![]});var _0x3cd15b='WhatsappQueues';return db[_0x2f8d('0x36')][_0x2f8d('0x37')]({'where':{'name':_0x3cd15b,'userProfileId':_0x4d6dd1[_0x2f8d('0x38')]},'raw':!![]})['then'](function(_0x366c57){if(_0x366c57&&_0x366c57[_0x2f8d('0x39')]===0x0){return db[_0x2f8d('0x3a')]['create']({'name':_0x5fbf1e[_0x2f8d('0x1a')],'resourceId':_0x5fbf1e['id'],'type':_0x366c57[_0x2f8d('0x1a')],'sectionId':_0x366c57['id']},{})[_0x2f8d('0x14')](function(){return _0x5a55af;});}else{return _0x5a55af;}})[_0x2f8d('0x26')](function(_0x5d10f1){logger[_0x2f8d('0x18')](_0x2f8d('0x3b'),_0x5d10f1);throw _0x5d10f1;});}return _0x5a55af;})[_0x2f8d('0x14')](respondWithResult(_0x593102,0xc9))[_0x2f8d('0x26')](handleError(_0x593102,null));};exports['update']=function(_0x1880f9,_0x194c15){if(_0x1880f9[_0x2f8d('0x33')]['id']){delete _0x1880f9[_0x2f8d('0x33')]['id'];}return db[_0x2f8d('0x23')][_0x2f8d('0x37')]({'where':{'id':_0x1880f9['params']['id']}})[_0x2f8d('0x14')](handleEntityNotFound(_0x194c15,null))['then'](saveUpdates(_0x1880f9[_0x2f8d('0x33')],null))['then'](respondWithResult(_0x194c15,null))['catch'](handleError(_0x194c15,null));};exports[_0x2f8d('0x15')]=function(_0x3fa83f,_0xe7ed45){return db[_0x2f8d('0x23')]['find']({'where':{'id':_0x3fa83f[_0x2f8d('0x28')]['id']}})[_0x2f8d('0x14')](handleEntityNotFound(_0xe7ed45,null))[_0x2f8d('0x14')](removeEntity(_0xe7ed45,null))['catch'](handleError(_0xe7ed45,null));};exports['describe']=function(_0x4ede14,_0x39f0c4){return db[_0x2f8d('0x23')][_0x2f8d('0x3c')]()[_0x2f8d('0x14')](respondWithResult(_0x39f0c4,null))['catch'](handleError(_0x39f0c4,null));};exports[_0x2f8d('0x3d')]=function(_0x52b912,_0x145add){var _0x2ed06f={'raw':!![],'where':{}},_0x47298f={},_0x41f19e;return db[_0x2f8d('0x23')]['findOne']({'where':{'id':_0x52b912['params']['id']}})[_0x2f8d('0x14')](handleEntityNotFound(_0x145add,null))[_0x2f8d('0x14')](function(_0x2372e3){if(_0x2372e3){_0x41f19e=_0x2372e3[_0x2f8d('0x16')]({'plain':!![]});_0x47298f['model']=_['keys'](db['UserWhatsappQueue'][_0x2f8d('0x1c')]);_0x47298f[_0x2f8d('0x22')]=_[_0x2f8d('0x2a')](_0x52b912['query']);_0x47298f[_0x2f8d('0x2b')]=_[_0x2f8d('0x2c')](_0x47298f[_0x2f8d('0x29')],_0x47298f['query']);_0x2ed06f[_0x2f8d('0x2e')]=_['intersection'](_0x47298f[_0x2f8d('0x29')],qs[_0x2f8d('0x2d')](_0x52b912[_0x2f8d('0x22')][_0x2f8d('0x2d')]));_0x2ed06f[_0x2f8d('0x2e')]=_0x2ed06f['attributes'][_0x2f8d('0x3e')]?_0x2ed06f[_0x2f8d('0x2e')]:_0x47298f[_0x2f8d('0x29')];if(!_0x52b912[_0x2f8d('0x22')][_0x2f8d('0x3f')](_0x2f8d('0x40'))){_0x2ed06f[_0x2f8d('0x41')]=qs['limit'](_0x52b912[_0x2f8d('0x22')][_0x2f8d('0x41')]);_0x2ed06f[_0x2f8d('0xe')]=qs[_0x2f8d('0xe')](_0x52b912[_0x2f8d('0x22')][_0x2f8d('0xe')]);}_0x2ed06f['order']=qs[_0x2f8d('0x42')](_0x52b912[_0x2f8d('0x22')]['sort']);_0x2ed06f[_0x2f8d('0x43')]=qs['filters'](_[_0x2f8d('0x44')](_0x52b912['query'],_0x47298f[_0x2f8d('0x2b')]));_0x2ed06f['where'][_0x2f8d('0x45')]=_0x2372e3['id'];if(_0x52b912[_0x2f8d('0x22')][_0x2f8d('0x46')]){_0x2ed06f[_0x2f8d('0x43')]=_[_0x2f8d('0x30')](_0x2ed06f['where'],{'$or':_['map'](_0x2ed06f[_0x2f8d('0x2e')],function(_0x5477c1){var _0x225157={};_0x225157[_0x5477c1]={'$like':'%'+_0x52b912['query'][_0x2f8d('0x46')]+'%'};return _0x225157;})});}_0x2ed06f=_['merge']({},_0x2ed06f,_0x52b912[_0x2f8d('0x31')]);return db['UserWhatsappQueue'][_0x2f8d('0x24')](_0x2ed06f);}})[_0x2f8d('0x14')](function(_0x5e7d4b){if(_0x5e7d4b){return db[_0x2f8d('0x47')][_0x2f8d('0x48')]({'where':{'id':_[_0x2f8d('0x49')](_0x5e7d4b,_0x2f8d('0x4a')),'role':_0x2f8d('0x4b')},'attributes':['id',_0x2f8d('0x1a'),_0x2f8d('0x4c'),_0x2f8d('0x4d'),_0x2f8d('0x4e')]});}})[_0x2f8d('0x14')](function(_0x270b75){if(_0x270b75){return{'count':_0x270b75['count'],'rows':_['map'](_0x270b75[_0x2f8d('0x25')],function(_0x2ead06){return{'membername':_0x2ead06[_0x2f8d('0x1a')],'UserId':_0x2ead06['id'],'queue_name':_0x41f19e[_0x2f8d('0x1a')],'WhatsappQueueId':_0x41f19e['id'],'interface':util[_0x2f8d('0x4f')](_0x2f8d('0x50'),_0x2f8d('0x51'),_0x2ead06[_0x2f8d('0x1a')]),'penalty':0x0,'paused':_0x2ead06[_0x2f8d('0x4c')],'createdAt':_0x2ead06[_0x2f8d('0x4e')],'updatedAt':_0x2ead06['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2f8d('0x14')](respondWithFilteredResult(_0x145add,_0x2ed06f))['catch'](handleError(_0x145add,null));};exports['getTeams']=function(_0x19aec5,_0x3919bb){var _0x3aa832={};var _0x161602={};var _0x2955c9;var _0x2ed880;return db[_0x2f8d('0x23')][_0x2f8d('0x52')]({'where':{'id':_0x19aec5[_0x2f8d('0x28')]['id']}})[_0x2f8d('0x14')](handleEntityNotFound(_0x3919bb,null))['then'](function(_0x1a9992){if(_0x1a9992){_0x2955c9=_0x1a9992;_0x161602[_0x2f8d('0x29')]=_[_0x2f8d('0x2a')](db[_0x2f8d('0x53')]['rawAttributes']);_0x161602[_0x2f8d('0x22')]=_[_0x2f8d('0x2a')](_0x19aec5[_0x2f8d('0x22')]);_0x161602['filters']=_[_0x2f8d('0x2c')](_0x161602[_0x2f8d('0x29')],_0x161602[_0x2f8d('0x22')]);_0x3aa832['attributes']=_[_0x2f8d('0x2c')](_0x161602['model'],qs[_0x2f8d('0x2d')](_0x19aec5[_0x2f8d('0x22')][_0x2f8d('0x2d')]));_0x3aa832[_0x2f8d('0x2e')]=_0x3aa832['attributes'][_0x2f8d('0x3e')]?_0x3aa832[_0x2f8d('0x2e')]:_0x161602[_0x2f8d('0x29')];_0x3aa832[_0x2f8d('0x54')]=qs[_0x2f8d('0x42')](_0x19aec5[_0x2f8d('0x22')][_0x2f8d('0x42')]);_0x3aa832[_0x2f8d('0x43')]=qs[_0x2f8d('0x2b')](_[_0x2f8d('0x44')](_0x19aec5[_0x2f8d('0x22')],_0x161602['filters']));if(_0x19aec5[_0x2f8d('0x22')]['filter']){_0x3aa832['where']=_[_0x2f8d('0x30')](_0x3aa832[_0x2f8d('0x43')],{'$or':_['map'](_0x3aa832['attributes'],function(_0x203117){var _0x4c623d={};_0x4c623d[_0x203117]={'$like':'%'+_0x19aec5['query'][_0x2f8d('0x46')]+'%'};return _0x4c623d;})});}_0x3aa832=_[_0x2f8d('0x30')]({},_0x3aa832,_0x19aec5[_0x2f8d('0x31')]);return _0x2955c9['getTeams'](_0x3aa832);}})[_0x2f8d('0x14')](function(_0x46b8e5){if(_0x46b8e5){_0x2ed880=_0x46b8e5['length'];if(!_0x19aec5['query']['hasOwnProperty'](_0x2f8d('0x40'))){_0x3aa832[_0x2f8d('0x41')]=qs[_0x2f8d('0x41')](_0x19aec5[_0x2f8d('0x22')][_0x2f8d('0x41')]);_0x3aa832[_0x2f8d('0xe')]=qs[_0x2f8d('0xe')](_0x19aec5[_0x2f8d('0x22')]['offset']);}return _0x2955c9[_0x2f8d('0x55')](_0x3aa832);}})[_0x2f8d('0x14')](function(_0x458183){if(_0x458183){return _0x458183?{'count':_0x2ed880,'rows':_0x458183}:null;}})[_0x2f8d('0x14')](respondWithResult(_0x3919bb,null))[_0x2f8d('0x26')](handleError(_0x3919bb,null));};exports['addTeams']=function(_0x505b28,_0x2ae8de){var _0x489c5e=_0x505b28[_0x2f8d('0x33')][_0x2f8d('0x56')];return db['Team'][_0x2f8d('0x24')]({'where':{'id':_0x489c5e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2f8d('0x57'),'attributes':['id','name',_0x2f8d('0x58'),_0x2f8d('0x59'),_0x2f8d('0x5a')],'raw':!![]}]})[_0x2f8d('0x14')](function(_0x5659c6){if(_0x5659c6){var _0x333349=_[_0x2f8d('0x5b')](_0x5659c6,function(_0x3c6a35){var _0x52c680=_0x3c6a35['get']({'plain':!![]});return _0x52c680[_0x2f8d('0x57')];});return db['WhatsappQueue'][_0x2f8d('0x37')]({'where':{'id':_0x505b28['params']['id']}})[_0x2f8d('0x14')](function(_0x51d2ad){return db[_0x2f8d('0x5c')][_0x2f8d('0x5d')](function(_0x5b80c9){return _0x51d2ad[_0x2f8d('0x5e')](_0x489c5e,{'transaction':_0x5b80c9})['then'](function(){return BPromise[_0x2f8d('0x5f')](_0x333349,function(_0x330d06){return db['UserWhatsappQueue'][_0x2f8d('0x60')]({'where':{'UserId':_0x330d06['id'],'WhatsappQueueId':_0x505b28[_0x2f8d('0x28')]['id']},'transaction':_0x5b80c9});});})[_0x2f8d('0x14')](function(){_0x333349['forEach'](function(_0x417583){socket[_0x2f8d('0x61')](_0x2f8d('0x62'),{'UserId':_0x417583['id'],'WhatsappQueueId':_0x51d2ad['id']});});});});});}})[_0x2f8d('0x14')](respondWithStatusCode(_0x2ae8de,null))['catch'](handleError(_0x2ae8de,null));};exports[_0x2f8d('0x63')]=function(_0x46d89b,_0x109492){return db[_0x2f8d('0x53')][_0x2f8d('0x24')]({'where':{'id':_0x46d89b[_0x2f8d('0x22')][_0x2f8d('0x56')]},'attributes':['id'],'include':[{'model':db[_0x2f8d('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x109492,null))['then'](function(_0x3e6b05){var _0x4254d7=_[_0x2f8d('0x49')](_0x3e6b05,'id');var _0x2f001a=[];var _0x22330d=[];var _0x26731f=squel['select']();_0x26731f[_0x2f8d('0x64')](_0x2f8d('0x65'))[_0x2f8d('0x66')](_0x2f8d('0x67'),'tq')[_0x2f8d('0x68')](_0x2f8d('0x69'),'ut',_0x2f8d('0x6a'))[_0x2f8d('0x43')]('WhatsappQueueId\x20=\x20?',_0x46d89b[_0x2f8d('0x28')]['id']);for(var _0x116c93=0x0;_0x116c93<_0x3e6b05['length'];_0x116c93+=0x1){let _0x5a300e=_0x3e6b05[_0x116c93];for(var _0x2093b9=0x0;_0x2093b9<_0x5a300e[_0x2f8d('0x57')][_0x2f8d('0x3e')];_0x2093b9+=0x1){let _0x55e4c9=_0x5a300e[_0x2f8d('0x57')][_0x2093b9];var _0x11cf99=_0x26731f['clone']();_0x11cf99[_0x2f8d('0x43')](_0x2f8d('0x6b'),_0x55e4c9['id']);_0x22330d['push'](db['sequelize'][_0x2f8d('0x22')](_0x11cf99[_0x2f8d('0x6c')](),{'type':db[_0x2f8d('0x5c')]['QueryTypes'][_0x2f8d('0x6d')]})[_0x2f8d('0x14')](function(_0x52cc15){if(_0x52cc15['length']===0x1){return _0x55e4c9['id'];}else{var _0x2d5d6d=_['every'](_[_0x2f8d('0x49')](_0x52cc15,'TeamId'),function(_0x998ba4){return _[_0x2f8d('0x6e')](_0x4254d7,_0x998ba4);});if(_0x2d5d6d){return _0x55e4c9['id'];}}}));}}return BPromise[_0x2f8d('0x6f')](_0x22330d)[_0x2f8d('0x14')](function(_0x4e7c86){_0x2f001a=_(_0x2f001a)['union'](_0x4e7c86)[_0x2f8d('0x70')]()['value']();return db[_0x2f8d('0x23')][_0x2f8d('0x37')]({'where':{'id':_0x46d89b[_0x2f8d('0x28')]['id']}})['then'](function(_0x1f9ea3){return db[_0x2f8d('0x5c')][_0x2f8d('0x5d')](function(_0x3809e6){return _0x1f9ea3[_0x2f8d('0x63')](_0x46d89b[_0x2f8d('0x22')][_0x2f8d('0x56')],{'transaction':_0x3809e6})[_0x2f8d('0x14')](function(){if(!_['isEmpty'](_0x2f001a)){return _0x1f9ea3[_0x2f8d('0x71')](_0x2f001a,{'transaction':_0x3809e6});}})['then'](function(){_0x2f001a[_0x2f8d('0x72')](function(_0x496e7d){socket[_0x2f8d('0x61')](_0x2f8d('0x73'),{'UserId':_0x496e7d,'WhatsappQueueId':_0x1f9ea3['id']});});});});});});})[_0x2f8d('0x14')](respondWithStatusCode(_0x109492,null))[_0x2f8d('0x26')](handleError(_0x109492,null));};exports[_0x2f8d('0x74')]=function(_0x3a6ada,_0x2e903c){return db[_0x2f8d('0x23')][_0x2f8d('0x37')]({'where':{'id':_0x3a6ada[_0x2f8d('0x28')]['id']}})[_0x2f8d('0x14')](handleEntityNotFound(_0x2e903c,null))[_0x2f8d('0x14')](function(_0x4592ea){if(_0x4592ea){return _0x4592ea['addAgents'](_0x3a6ada[_0x2f8d('0x33')][_0x2f8d('0x56')],_[_0x2f8d('0x75')](_0x3a6ada[_0x2f8d('0x33')],[_0x2f8d('0x56'),'id'])||{})[_0x2f8d('0x76')](function(_0x19975a){for(var _0x447658=0x0;_0x447658<_0x3a6ada[_0x2f8d('0x33')][_0x2f8d('0x56')][_0x2f8d('0x3e')];_0x447658+=0x1){socket[_0x2f8d('0x61')](_0x2f8d('0x62'),{'UserId':Number(_0x3a6ada[_0x2f8d('0x33')][_0x2f8d('0x56')][_0x447658]),'WhatsappQueueId':Number(_0x3a6ada[_0x2f8d('0x28')]['id'])});}return _0x19975a;});}})[_0x2f8d('0x14')](respondWithResult(_0x2e903c,null))[_0x2f8d('0x26')](handleError(_0x2e903c,null));};exports[_0x2f8d('0x71')]=function(_0x3665ce,_0xbda595){return db['WhatsappQueue'][_0x2f8d('0x37')]({'where':{'id':_0x3665ce['params']['id']}})['then'](handleEntityNotFound(_0xbda595,null))[_0x2f8d('0x14')](function(_0x3d4e59){if(_0x3d4e59){return _0x3d4e59[_0x2f8d('0x71')](_0x3665ce['query']['ids'])['then'](function(){if(_[_0x2f8d('0x77')](_0x3665ce[_0x2f8d('0x22')][_0x2f8d('0x56')])){for(var _0x45d723=0x0;_0x45d723<_0x3665ce[_0x2f8d('0x22')]['ids']['length'];_0x45d723+=0x1){socket[_0x2f8d('0x61')](_0x2f8d('0x73'),{'UserId':Number(_0x3665ce[_0x2f8d('0x22')][_0x2f8d('0x56')][_0x45d723]),'WhatsappQueueId':Number(_0x3665ce[_0x2f8d('0x28')]['id'])});}}else{socket[_0x2f8d('0x61')](_0x2f8d('0x73'),{'UserId':Number(_0x3665ce[_0x2f8d('0x22')][_0x2f8d('0x56')]),'WhatsappQueueId':Number(_0x3665ce['params']['id'])});}});}})[_0x2f8d('0x14')](respondWithStatusCode(_0xbda595,null))['catch'](handleError(_0xbda595,null));};exports[_0x2f8d('0x78')]=function(_0x37c4e1,_0x3c4e95){var _0x38b3e8={};var _0x5ba8b2={};var _0xd07ede;var _0x466c0;return db[_0x2f8d('0x23')][_0x2f8d('0x52')]({'where':{'id':_0x37c4e1[_0x2f8d('0x28')]['id']}})[_0x2f8d('0x14')](handleEntityNotFound(_0x3c4e95,null))[_0x2f8d('0x14')](function(_0x5c981f){if(_0x5c981f){_0xd07ede=_0x5c981f;_0x5ba8b2['model']=_['keys'](db['User'][_0x2f8d('0x1c')]);_0x5ba8b2['query']=_[_0x2f8d('0x2a')](_0x37c4e1[_0x2f8d('0x22')]);_0x5ba8b2['filters']=_[_0x2f8d('0x2c')](_0x5ba8b2[_0x2f8d('0x29')],_0x5ba8b2[_0x2f8d('0x22')]);_0x38b3e8[_0x2f8d('0x2e')]=_[_0x2f8d('0x2c')](_0x5ba8b2[_0x2f8d('0x29')],qs['fields'](_0x37c4e1[_0x2f8d('0x22')][_0x2f8d('0x2d')]));_0x38b3e8[_0x2f8d('0x2e')]=_0x38b3e8[_0x2f8d('0x2e')]['length']?_0x38b3e8[_0x2f8d('0x2e')]:_0x5ba8b2[_0x2f8d('0x29')];_0x38b3e8[_0x2f8d('0x54')]=qs[_0x2f8d('0x42')](_0x37c4e1[_0x2f8d('0x22')][_0x2f8d('0x42')]);_0x38b3e8[_0x2f8d('0x43')]=qs['filters'](_[_0x2f8d('0x44')](_0x37c4e1['query'],_0x5ba8b2[_0x2f8d('0x2b')]));if(_0x37c4e1[_0x2f8d('0x22')]['filter']){_0x38b3e8[_0x2f8d('0x43')]=_[_0x2f8d('0x30')](_0x38b3e8[_0x2f8d('0x43')],{'$or':_['map'](_0x38b3e8[_0x2f8d('0x2e')],function(_0x44a437){var _0x6d3708={};_0x6d3708[_0x44a437]={'$like':'%'+_0x37c4e1[_0x2f8d('0x22')][_0x2f8d('0x46')]+'%'};return _0x6d3708;})});}_0x38b3e8=_['merge']({},_0x38b3e8,_0x37c4e1[_0x2f8d('0x31')]);return _0xd07ede[_0x2f8d('0x78')](_0x38b3e8);}})[_0x2f8d('0x14')](function(_0x2c2c8a){if(_0x2c2c8a){_0x466c0=_0x2c2c8a[_0x2f8d('0x3e')];if(!_0x37c4e1['query'][_0x2f8d('0x3f')](_0x2f8d('0x40'))){_0x38b3e8[_0x2f8d('0x41')]=qs[_0x2f8d('0x41')](_0x37c4e1[_0x2f8d('0x22')][_0x2f8d('0x41')]);_0x38b3e8[_0x2f8d('0xe')]=qs[_0x2f8d('0xe')](_0x37c4e1['query'][_0x2f8d('0xe')]);}return _0xd07ede[_0x2f8d('0x78')](_0x38b3e8);}})['then'](function(_0xb1d0c6){if(_0xb1d0c6){return _0xb1d0c6?{'count':_0x466c0,'rows':_0xb1d0c6}:null;}})[_0x2f8d('0x14')](respondWithResult(_0x3c4e95,null))[_0x2f8d('0x26')](handleError(_0x3c4e95,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index ce62251..5a443e3 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0729=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','remove','emit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0729,0x1a3));var _0x9072=function(_0x381e3b,_0x2313d4){_0x381e3b=_0x381e3b-0x0;var _0x18ea8c=_0x0729[_0x381e3b];return _0x18ea8c;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x9072('0x0'))['db'][_0x9072('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9072('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9072('0x3')};function emitEvent(_0x3404cd){return function(_0xff1c8d,_0x16d2a2,_0x2438db){WhatsappQueueEvents[_0x9072('0x4')](_0x3404cd+':'+_0xff1c8d['id'],_0xff1c8d);WhatsappQueueEvents[_0x9072('0x4')](_0x3404cd,_0xff1c8d);_0x2438db(null);};}for(var e in events){if(events[_0x9072('0x5')](e)){var event=events[e];WhatsappQueue[_0x9072('0x6')](e,emitEvent(event));}}module[_0x9072('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa4c9=['exports','events','../../mysqldb','WhatsappQueue','save','update','emit','hasOwnProperty','hook'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0xa4c9,0x17b));var _0x9a4c=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xa4c9[_0x100682];return _0xcb6e87;};'use strict';var EventEmitter=require(_0x9a4c('0x0'));var WhatsappQueue=require(_0x9a4c('0x1'))['db'][_0x9a4c('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a4c('0x3'),'afterUpdate':_0x9a4c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x23357c){return function(_0x4b822a,_0x264cde,_0x2df685){WhatsappQueueEvents[_0x9a4c('0x5')](_0x23357c+':'+_0x4b822a['id'],_0x4b822a);WhatsappQueueEvents[_0x9a4c('0x5')](_0x23357c,_0x4b822a);_0x2df685(null);};}for(var e in events){if(events[_0x9a4c('0x6')](e)){var event=events[e];WhatsappQueue[_0x9a4c('0x7')](e,emitEvent(event));}}module[_0x9a4c('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 4765d57..0b1da49 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f56=['./whatsappQueue.attributes','exports','define','whatsapp_queues','util','moment','bluebird','request-promise','path'];(function(_0x94ba2,_0x2b3641){var _0x45e8e6=function(_0x3a0c39){while(--_0x3a0c39){_0x94ba2['push'](_0x94ba2['shift']());}};_0x45e8e6(++_0x2b3641);}(_0x1f56,0x82));var _0x61f5=function(_0x36a260,_0x24d4ff){_0x36a260=_0x36a260-0x0;var _0x2dfb87=_0x1f56[_0x36a260];return _0x2dfb87;};'use strict';var _=require('lodash');var util=require(_0x61f5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x61f5('0x1'));var BPromise=require(_0x61f5('0x2'));var rp=require(_0x61f5('0x3'));var fs=require('fs');var path=require(_0x61f5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x61f5('0x5'));module[_0x61f5('0x6')]=function(_0x23df51,_0x3437ee){return _0x23df51[_0x61f5('0x7')]('WhatsappQueue',attributes,{'tableName':_0x61f5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9603=['lodash','util','../../config/logger','moment','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0xddc86d,_0x514baf){var _0x911dc0=function(_0x58d0de){while(--_0x58d0de){_0xddc86d['push'](_0xddc86d['shift']());}};_0x911dc0(++_0x514baf);}(_0x9603,0x1ae));var _0x3960=function(_0x55c43c,_0x1b8fac){_0x55c43c=_0x55c43c-0x0;var _0xcc6ad1=_0x9603[_0x55c43c];return _0xcc6ad1;};'use strict';var _=require(_0x3960('0x0'));var util=require(_0x3960('0x1'));var logger=require(_0x3960('0x2'))('api');var moment=require(_0x3960('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3960('0x4'));var config=require(_0x3960('0x5'));var attributes=require('./whatsappQueue.attributes');module[_0x3960('0x6')]=function(_0x437b91,_0x14c987){return _0x437b91[_0x3960('0x7')](_0x3960('0x8'),attributes,{'tableName':_0x3960('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index d8d8a84..0c173e8 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac88=['localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetWhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xac88,0x74));var _0x8ac8=function(_0x12a3ec,_0x562c6d){_0x12a3ec=_0x12a3ec-0x0;var _0xa9c4ee=_0xac88[_0x12a3ec];return _0xa9c4ee;};'use strict';var _=require(_0x8ac8('0x0'));var util=require(_0x8ac8('0x1'));var moment=require(_0x8ac8('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ac8('0x3'));var fs=require('fs');var Redis=require(_0x8ac8('0x4'));var db=require(_0x8ac8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ac8('0x6'))(_0x8ac8('0x7'));var config=require('../../config/environment');var jayson=require(_0x8ac8('0x8'));var client=jayson[_0x8ac8('0x9')][_0x8ac8('0xa')]({'port':0x232a});config['redis']=_[_0x8ac8('0xb')](config[_0x8ac8('0xc')],{'host':_0x8ac8('0xd'),'port':0x18eb});var socket=require(_0x8ac8('0xe'))(new Redis(config['redis']));require(_0x8ac8('0xf'))[_0x8ac8('0x10')](socket);function respondWithRpcPromise(_0x1bb62c,_0x7fa559,_0x302598){return new BPromise(function(_0x3e6c7a,_0x15df2d){return client[_0x8ac8('0x11')](_0x1bb62c,_0x302598)[_0x8ac8('0x12')](function(_0x18fa1d){logger[_0x8ac8('0x13')](_0x8ac8('0x14'),_0x7fa559,'request\x20sent');logger[_0x8ac8('0x15')](_0x8ac8('0x16'),_0x7fa559,'request\x20sent',JSON[_0x8ac8('0x17')](_0x18fa1d));if(_0x18fa1d[_0x8ac8('0x18')]){if(_0x18fa1d[_0x8ac8('0x18')][_0x8ac8('0x19')]===0x1f4){logger[_0x8ac8('0x18')](_0x8ac8('0x14'),_0x7fa559,_0x18fa1d[_0x8ac8('0x18')][_0x8ac8('0x1a')]);return _0x15df2d(_0x18fa1d[_0x8ac8('0x18')]['message']);}logger[_0x8ac8('0x18')](_0x8ac8('0x14'),_0x7fa559,_0x18fa1d[_0x8ac8('0x18')][_0x8ac8('0x1a')]);return _0x3e6c7a(_0x18fa1d[_0x8ac8('0x18')][_0x8ac8('0x1a')]);}else{logger[_0x8ac8('0x13')](_0x8ac8('0x14'),_0x7fa559,_0x8ac8('0x1b'));_0x3e6c7a(_0x18fa1d[_0x8ac8('0x1c')][_0x8ac8('0x1a')]);}})[_0x8ac8('0x1d')](function(_0x1598a9){logger[_0x8ac8('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x7fa559,_0x1598a9);_0x15df2d(_0x1598a9);});});}exports[_0x8ac8('0x1e')]=function(_0x5a23d3){var _0x1398d5=this;return new Promise(function(_0x299ad7,_0x419050){return db['WhatsappQueue'][_0x8ac8('0x1f')]({'raw':_0x5a23d3[_0x8ac8('0x20')]?_0x5a23d3[_0x8ac8('0x20')][_0x8ac8('0x21')]===undefined?!![]:![]:!![],'where':_0x5a23d3[_0x8ac8('0x20')]?_0x5a23d3[_0x8ac8('0x20')][_0x8ac8('0x22')]||null:null,'attributes':_0x5a23d3[_0x8ac8('0x20')]?_0x5a23d3[_0x8ac8('0x20')]['attributes']||null:null,'limit':_0x5a23d3[_0x8ac8('0x20')]?_0x5a23d3[_0x8ac8('0x20')][_0x8ac8('0x23')]||null:null,'include':_0x5a23d3[_0x8ac8('0x20')]?_0x5a23d3['options'][_0x8ac8('0x24')]?_[_0x8ac8('0x25')](_0x5a23d3[_0x8ac8('0x20')][_0x8ac8('0x24')],function(_0x274b98){return{'model':db[_0x274b98[_0x8ac8('0x26')]],'as':_0x274b98['as'],'attributes':_0x274b98['attributes'],'include':_0x274b98[_0x8ac8('0x24')]?_['map'](_0x274b98[_0x8ac8('0x24')],function(_0x33aec3){return{'model':db[_0x33aec3[_0x8ac8('0x26')]],'as':_0x33aec3['as'],'attributes':_0x33aec3[_0x8ac8('0x27')],'include':_0x33aec3[_0x8ac8('0x24')]?_[_0x8ac8('0x25')](_0x33aec3[_0x8ac8('0x24')],function(_0x15d995){return{'model':db[_0x15d995[_0x8ac8('0x26')]],'as':_0x15d995['as'],'attributes':_0x15d995['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ac8('0x12')](function(_0x304602){logger[_0x8ac8('0x13')](_0x8ac8('0x1e'),_0x5a23d3);logger[_0x8ac8('0x15')](_0x8ac8('0x1e'),_0x5a23d3,JSON[_0x8ac8('0x17')](_0x304602));_0x299ad7(_0x304602);})[_0x8ac8('0x1d')](function(_0x43934f){logger[_0x8ac8('0x18')](_0x8ac8('0x1e'),_0x43934f[_0x8ac8('0x1a')],_0x5a23d3);_0x419050(_0x1398d5[_0x8ac8('0x18')](0x1f4,_0x43934f[_0x8ac8('0x1a')]));});});};exports[_0x8ac8('0x28')]=function(_0xd916ff){var _0x183da8=this;return new Promise(function(_0x590756,_0x5bda84){return db[_0x8ac8('0x29')][_0x8ac8('0x2a')]({'raw':_0xd916ff[_0x8ac8('0x20')]?_0xd916ff[_0x8ac8('0x20')][_0x8ac8('0x21')]===undefined?!![]:![]:!![],'where':_0xd916ff['options']?_0xd916ff[_0x8ac8('0x20')]['where']||null:null,'attributes':_0xd916ff['options']?_0xd916ff[_0x8ac8('0x20')]['attributes']||null:null,'include':_0xd916ff['options']?_0xd916ff['options'][_0x8ac8('0x24')]?_[_0x8ac8('0x25')](_0xd916ff['options'][_0x8ac8('0x24')],function(_0x19c48e){return{'model':db[_0x19c48e[_0x8ac8('0x26')]],'as':_0x19c48e['as'],'attributes':_0x19c48e['attributes'],'include':_0x19c48e['include']?_['map'](_0x19c48e['include'],function(_0x36b75b){return{'model':db[_0x36b75b[_0x8ac8('0x26')]],'as':_0x36b75b['as'],'attributes':_0x36b75b[_0x8ac8('0x27')],'include':_0x36b75b[_0x8ac8('0x24')]?_[_0x8ac8('0x25')](_0x36b75b[_0x8ac8('0x24')],function(_0x20512b){return{'model':db[_0x20512b['model']],'as':_0x20512b['as'],'attributes':_0x20512b[_0x8ac8('0x27')]};}):[]};}):[]};}):[]:[]})[_0x8ac8('0x12')](function(_0x19883f){logger[_0x8ac8('0x13')](_0x8ac8('0x28'),_0xd916ff);logger[_0x8ac8('0x15')](_0x8ac8('0x28'),_0xd916ff,JSON['stringify'](_0x19883f));_0x590756(_0x19883f);})[_0x8ac8('0x1d')](function(_0x5e8db6){logger['error']('ShowWhatsappQueue',_0x5e8db6[_0x8ac8('0x1a')],_0xd916ff);_0x5bda84(_0x183da8[_0x8ac8('0x18')](0x1f4,_0x5e8db6['message']));});});}; \ No newline at end of file +var _0x2a6d=['GetWhatsappQueue','ShowWhatsappQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','catch','WhatsappQueue','findAll','options','raw','where','attributes','include','model','map'];(function(_0x2ef7d5,_0x26a839){var _0x425acf=function(_0x91777){while(--_0x91777){_0x2ef7d5['push'](_0x2ef7d5['shift']());}};_0x425acf(++_0x26a839);}(_0x2a6d,0xed));var _0xd2a6=function(_0x527cb7,_0x321a3d){_0x527cb7=_0x527cb7-0x0;var _0x2fac8e=_0x2a6d[_0x527cb7];return _0x2fac8e;};'use strict';var _=require('lodash');var util=require(_0xd2a6('0x0'));var moment=require(_0xd2a6('0x1'));var BPromise=require(_0xd2a6('0x2'));var rs=require(_0xd2a6('0x3'));var fs=require('fs');var Redis=require(_0xd2a6('0x4'));var db=require(_0xd2a6('0x5'))['db'];var utils=require(_0xd2a6('0x6'));var logger=require('../../config/logger')(_0xd2a6('0x7'));var config=require(_0xd2a6('0x8'));var jayson=require(_0xd2a6('0x9'));var client=jayson[_0xd2a6('0xa')][_0xd2a6('0xb')]({'port':0x232a});config[_0xd2a6('0xc')]=_[_0xd2a6('0xd')](config[_0xd2a6('0xc')],{'host':_0xd2a6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2a6('0xc')]));require(_0xd2a6('0xf'))[_0xd2a6('0x10')](socket);function respondWithRpcPromise(_0x18dbae,_0x58c8af,_0x48c741){return new BPromise(function(_0xa7e4f4,_0x279e1f){return client['request'](_0x18dbae,_0x48c741)[_0xd2a6('0x11')](function(_0x37ed3c){logger[_0xd2a6('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x58c8af,_0xd2a6('0x13'));logger[_0xd2a6('0x14')](_0xd2a6('0x15'),_0x58c8af,_0xd2a6('0x13'),JSON[_0xd2a6('0x16')](_0x37ed3c));if(_0x37ed3c[_0xd2a6('0x17')]){if(_0x37ed3c[_0xd2a6('0x17')]['code']===0x1f4){logger[_0xd2a6('0x17')](_0xd2a6('0x18'),_0x58c8af,_0x37ed3c[_0xd2a6('0x17')]['message']);return _0x279e1f(_0x37ed3c['error'][_0xd2a6('0x19')]);}logger[_0xd2a6('0x17')](_0xd2a6('0x18'),_0x58c8af,_0x37ed3c[_0xd2a6('0x17')][_0xd2a6('0x19')]);return _0xa7e4f4(_0x37ed3c['error'][_0xd2a6('0x19')]);}else{logger[_0xd2a6('0x12')](_0xd2a6('0x18'),_0x58c8af,'request\x20sent');_0xa7e4f4(_0x37ed3c['result'][_0xd2a6('0x19')]);}})[_0xd2a6('0x1a')](function(_0x44ce81){logger[_0xd2a6('0x17')](_0xd2a6('0x18'),_0x58c8af,_0x44ce81);_0x279e1f(_0x44ce81);});});}exports['GetWhatsappQueue']=function(_0x52c7a1){var _0x24303b=this;return new Promise(function(_0x36e8a3,_0x10cdc5){return db[_0xd2a6('0x1b')][_0xd2a6('0x1c')]({'raw':_0x52c7a1[_0xd2a6('0x1d')]?_0x52c7a1[_0xd2a6('0x1d')][_0xd2a6('0x1e')]===undefined?!![]:![]:!![],'where':_0x52c7a1[_0xd2a6('0x1d')]?_0x52c7a1[_0xd2a6('0x1d')][_0xd2a6('0x1f')]||null:null,'attributes':_0x52c7a1[_0xd2a6('0x1d')]?_0x52c7a1['options'][_0xd2a6('0x20')]||null:null,'limit':_0x52c7a1[_0xd2a6('0x1d')]?_0x52c7a1[_0xd2a6('0x1d')]['limit']||null:null,'include':_0x52c7a1[_0xd2a6('0x1d')]?_0x52c7a1[_0xd2a6('0x1d')][_0xd2a6('0x21')]?_['map'](_0x52c7a1['options'][_0xd2a6('0x21')],function(_0x32a107){return{'model':db[_0x32a107[_0xd2a6('0x22')]],'as':_0x32a107['as'],'attributes':_0x32a107['attributes'],'include':_0x32a107[_0xd2a6('0x21')]?_[_0xd2a6('0x23')](_0x32a107[_0xd2a6('0x21')],function(_0x1077fb){return{'model':db[_0x1077fb[_0xd2a6('0x22')]],'as':_0x1077fb['as'],'attributes':_0x1077fb[_0xd2a6('0x20')],'include':_0x1077fb[_0xd2a6('0x21')]?_[_0xd2a6('0x23')](_0x1077fb['include'],function(_0x3e530c){return{'model':db[_0x3e530c[_0xd2a6('0x22')]],'as':_0x3e530c['as'],'attributes':_0x3e530c[_0xd2a6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd2a6('0x11')](function(_0x393812){logger[_0xd2a6('0x12')](_0xd2a6('0x24'),_0x52c7a1);logger[_0xd2a6('0x14')]('GetWhatsappQueue',_0x52c7a1,JSON[_0xd2a6('0x16')](_0x393812));_0x36e8a3(_0x393812);})[_0xd2a6('0x1a')](function(_0x32dec7){logger[_0xd2a6('0x17')](_0xd2a6('0x24'),_0x32dec7[_0xd2a6('0x19')],_0x52c7a1);_0x10cdc5(_0x24303b[_0xd2a6('0x17')](0x1f4,_0x32dec7[_0xd2a6('0x19')]));});});};exports[_0xd2a6('0x25')]=function(_0x2a9e63){var _0x3e3403=this;return new Promise(function(_0x36d22a,_0x3ed8b4){return db['WhatsappQueue'][_0xd2a6('0x26')]({'raw':_0x2a9e63[_0xd2a6('0x1d')]?_0x2a9e63[_0xd2a6('0x1d')][_0xd2a6('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a9e63['options']?_0x2a9e63[_0xd2a6('0x1d')]['where']||null:null,'attributes':_0x2a9e63['options']?_0x2a9e63['options'][_0xd2a6('0x20')]||null:null,'include':_0x2a9e63[_0xd2a6('0x1d')]?_0x2a9e63[_0xd2a6('0x1d')][_0xd2a6('0x21')]?_[_0xd2a6('0x23')](_0x2a9e63['options']['include'],function(_0x138e91){return{'model':db[_0x138e91[_0xd2a6('0x22')]],'as':_0x138e91['as'],'attributes':_0x138e91[_0xd2a6('0x20')],'include':_0x138e91[_0xd2a6('0x21')]?_[_0xd2a6('0x23')](_0x138e91[_0xd2a6('0x21')],function(_0x6a3e45){return{'model':db[_0x6a3e45[_0xd2a6('0x22')]],'as':_0x6a3e45['as'],'attributes':_0x6a3e45[_0xd2a6('0x20')],'include':_0x6a3e45[_0xd2a6('0x21')]?_[_0xd2a6('0x23')](_0x6a3e45[_0xd2a6('0x21')],function(_0x57aa35){return{'model':db[_0x57aa35[_0xd2a6('0x22')]],'as':_0x57aa35['as'],'attributes':_0x57aa35[_0xd2a6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd2a6('0x11')](function(_0x35562e){logger[_0xd2a6('0x12')](_0xd2a6('0x25'),_0x2a9e63);logger[_0xd2a6('0x14')](_0xd2a6('0x25'),_0x2a9e63,JSON['stringify'](_0x35562e));_0x36d22a(_0x35562e);})[_0xd2a6('0x1a')](function(_0x5197a3){logger[_0xd2a6('0x17')](_0xd2a6('0x25'),_0x5197a3[_0xd2a6('0x19')],_0x2a9e63);_0x3ed8b4(_0x3e3403[_0xd2a6('0x17')](0x1f4,_0x5197a3[_0xd2a6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index f0cd74b..ab1f441 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17a8=['length','whatsappQueue:','remove','register'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0x17a8,0x1ae));var _0x817a=function(_0x415ff8,_0x176fb5){_0x415ff8=_0x415ff8-0x0;var _0x1f347a=_0x17a8[_0x415ff8];return _0x1f347a;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x817a('0x0'),'update'];function createListener(_0x9fceff,_0x26137e){return function(_0x560b39){_0x26137e['emit'](_0x9fceff,_0x560b39);};}function removeListener(_0x30ba80,_0x56c11e){return function(){WhatsappQueueEvents['removeListener'](_0x30ba80,_0x56c11e);};}exports[_0x817a('0x1')]=function(_0x5caae5){for(var _0x425417=0x0,_0x266927=events[_0x817a('0x2')];_0x425417<_0x266927;_0x425417++){var _0x30f8dc=events[_0x425417];var _0x551e85=createListener(_0x817a('0x3')+_0x30f8dc,_0x5caae5);WhatsappQueueEvents['on'](_0x30f8dc,_0x551e85);}}; \ No newline at end of file +var _0xc214=['emit','removeListener','register','length','./whatsappQueue.events','save','remove','update'];(function(_0x204f4e,_0x37dfd9){var _0xefeb78=function(_0x1c5fa8){while(--_0x1c5fa8){_0x204f4e['push'](_0x204f4e['shift']());}};_0xefeb78(++_0x37dfd9);}(_0xc214,0x9c));var _0x4c21=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xc214[_0x45bf86];return _0x1f02b7;};'use strict';var WhatsappQueueEvents=require(_0x4c21('0x0'));var events=[_0x4c21('0x1'),_0x4c21('0x2'),_0x4c21('0x3')];function createListener(_0x37658c,_0x3a06e1){return function(_0x1efe06){_0x3a06e1[_0x4c21('0x4')](_0x37658c,_0x1efe06);};}function removeListener(_0x161469,_0x3ba0a3){return function(){WhatsappQueueEvents[_0x4c21('0x5')](_0x161469,_0x3ba0a3);};}exports[_0x4c21('0x6')]=function(_0x4fc700){for(var _0x727e0b=0x0,_0x1c478c=events[_0x4c21('0x7')];_0x727e0b<_0x1c478c;_0x727e0b++){var _0x48ce81=events[_0x727e0b];var _0xe7359e=createListener('whatsappQueue:'+_0x48ce81,_0x4fc700);WhatsappQueueEvents['on'](_0x48ce81,_0xe7359e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index b43bcfc..cde6891 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb93=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','post','create','put','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xeb93,0xfd));var _0x3eb9=function(_0x129fa8,_0x3dba2a){_0x129fa8=_0x129fa8-0x0;var _0x546bab=_0xeb93[_0x129fa8];return _0x546bab;};'use strict';var multer=require(_0x3eb9('0x0'));var util=require(_0x3eb9('0x1'));var path=require('path');var timeout=require(_0x3eb9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3eb9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3eb9('0x4'));var config=require(_0x3eb9('0x5'));var controller=require('./whatsappQueueReport.controller');router[_0x3eb9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x3eb9('0x7')](),controller[_0x3eb9('0x8')]);router['get']('/:id',auth[_0x3eb9('0x7')](),controller[_0x3eb9('0x9')]);router[_0x3eb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x3eb9('0xb')]);router[_0x3eb9('0xc')](_0x3eb9('0xd'),auth[_0x3eb9('0x7')](),controller['update']);router['delete'](_0x3eb9('0xd'),auth['isAuthenticated'](),controller[_0x3eb9('0xe')]);module[_0x3eb9('0xf')]=router; \ No newline at end of file +var _0xe7bd=['../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0xfc7e8f,_0x56be0d){var _0x2db532=function(_0x3dd0c5){while(--_0x3dd0c5){_0xfc7e8f['push'](_0xfc7e8f['shift']());}};_0x2db532(++_0x56be0d);}(_0xe7bd,0xec));var _0xde7b=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0xe7bd[_0x34aec4];return _0x51e1a7;};'use strict';var multer=require(_0xde7b('0x0'));var util=require(_0xde7b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde7b('0x2'));var router=express[_0xde7b('0x3')]();var fs_extra=require(_0xde7b('0x4'));var auth=require(_0xde7b('0x5'));var interaction=require(_0xde7b('0x6'));var config=require(_0xde7b('0x7'));var controller=require(_0xde7b('0x8'));router[_0xde7b('0x9')]('/',auth[_0xde7b('0xa')](),controller[_0xde7b('0xb')]);router['get'](_0xde7b('0xc'),auth['isAuthenticated'](),controller[_0xde7b('0xd')]);router[_0xde7b('0x9')]('/:id',auth[_0xde7b('0xa')](),controller[_0xde7b('0xe')]);router[_0xde7b('0xf')]('/',auth[_0xde7b('0xa')](),controller[_0xde7b('0x10')]);router['put'](_0xde7b('0x11'),auth[_0xde7b('0xa')](),controller[_0xde7b('0x12')]);router[_0xde7b('0x13')](_0xde7b('0x11'),auth[_0xde7b('0xa')](),controller[_0xde7b('0x14')]);module[_0xde7b('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0dd671f..a669319 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5669f6,_0x2b4029){var _0x1cf487=function(_0x187a79){while(--_0x187a79){_0x5669f6['push'](_0x5669f6['shift']());}};_0x1cf487(++_0x2b4029);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4d3710,_0x3b57af){var _0x532c71=function(_0x3668c0){while(--_0x3668c0){_0x4d3710['push'](_0x4d3710['shift']());}};_0x532c71(++_0x3b57af);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 622e1a3..444d182 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe511=['destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','then','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','WhatsappQueueReport','findAll','catch','show','params','rawAttributes','find','create','body'];(function(_0xf3f40f,_0x5d529d){var _0x572507=function(_0x2352ac){while(--_0x2352ac){_0xf3f40f['push'](_0xf3f40f['shift']());}};_0x572507(++_0x5d529d);}(_0xe511,0x16f));var _0x1e51=function(_0x223649,_0x2de456){_0x223649=_0x223649-0x0;var _0x1f863a=_0xe511[_0x223649];return _0x1f863a;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x2e42b1,_0x1386db){return function(_0x505d79){if(!_0x505d79){_0x2e42b1['sendStatus'](0x194);}return _0x505d79;};}function handleError(_0x486ad6,_0x1eb83f){_0x1eb83f=_0x1eb83f||0x1f4;return function(_0x2a1561){logger[_0x1e51('0x24')](_0x2a1561['stack']);if(_0x2a1561[_0x1e51('0x25')]){delete _0x2a1561['name'];}_0x486ad6['status'](_0x1eb83f)[_0x1e51('0x26')](_0x2a1561);};}exports['index']=function(_0x170ec6,_0x1eb79f){var _0x56722f={},_0x3e6ef2={},_0x10ee23={'count':0x0,'rows':[]};var _0x71c7af=_[_0x1e51('0x27')](db['WhatsappQueueReport']['rawAttributes'],function(_0x4f67d3){return{'name':_0x4f67d3[_0x1e51('0x28')],'type':_0x4f67d3[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x3e6ef2[_0x1e51('0x2b')]=_[_0x1e51('0x27')](_0x71c7af,_0x1e51('0x25'));_0x3e6ef2[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x170ec6[_0x1e51('0x2c')]);_0x3e6ef2[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x3e6ef2['model'],_0x3e6ef2[_0x1e51('0x2c')]);_0x56722f[_0x1e51('0x30')]=_[_0x1e51('0x2f')](_0x3e6ef2[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x170ec6['query'][_0x1e51('0x31')]));_0x56722f['attributes']=_0x56722f[_0x1e51('0x30')][_0x1e51('0x32')]?_0x56722f[_0x1e51('0x30')]:_0x3e6ef2['model'];if(!_0x170ec6[_0x1e51('0x2c')]['hasOwnProperty'](_0x1e51('0x33'))){_0x56722f['limit']=qs['limit'](_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x1d')]);_0x56722f[_0x1e51('0x1c')]=qs['offset'](_0x170ec6[_0x1e51('0x2c')]['offset']);}_0x56722f[_0x1e51('0x34')]=qs[_0x1e51('0x35')](_0x170ec6['query'][_0x1e51('0x35')]);_0x56722f[_0x1e51('0x36')]=qs[_0x1e51('0x2e')](_[_0x1e51('0x37')](_0x170ec6[_0x1e51('0x2c')],_0x3e6ef2[_0x1e51('0x2e')]),_0x71c7af);if(_0x170ec6['query']['filter']){_0x56722f[_0x1e51('0x36')]=_['merge'](_0x56722f[_0x1e51('0x36')],{'$or':_[_0x1e51('0x27')](_0x71c7af,function(_0x32c41b){if(_0x32c41b[_0x1e51('0x29')]!==_0x1e51('0x38')){var _0x174a24={};_0x174a24[_0x32c41b[_0x1e51('0x25')]]={'$like':'%'+_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x39')]+'%'};return _0x174a24;}})});}_0x56722f=_[_0x1e51('0x3a')]({},_0x56722f,_0x170ec6[_0x1e51('0x3b')]);var _0x5360b3={'where':_0x56722f[_0x1e51('0x36')]};return db['WhatsappQueueReport'][_0x1e51('0x1e')](_0x5360b3)[_0x1e51('0x23')](function(_0x2b287e){_0x10ee23[_0x1e51('0x1e')]=_0x2b287e;if(_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x56722f[_0x1e51('0x3d')]=[{'all':!![]}];}return db[_0x1e51('0x3e')][_0x1e51('0x3f')](_0x56722f);})[_0x1e51('0x23')](function(_0xc40fce){_0x10ee23['rows']=_0xc40fce;return _0x10ee23;})['then'](respondWithFilteredResult(_0x1eb79f,_0x56722f))[_0x1e51('0x40')](handleError(_0x1eb79f,null));};exports[_0x1e51('0x41')]=function(_0x3be495,_0x4650e4){var _0x1ef3d3={'raw':!![],'where':{'id':_0x3be495[_0x1e51('0x42')]['id']}},_0x1a9e0d={};_0x1a9e0d[_0x1e51('0x2b')]=_['keys'](db[_0x1e51('0x3e')][_0x1e51('0x43')]);_0x1a9e0d[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x3be495[_0x1e51('0x2c')]);_0x1a9e0d[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1a9e0d['model'],_0x1a9e0d[_0x1e51('0x2c')]);_0x1ef3d3[_0x1e51('0x30')]=_['intersection'](_0x1a9e0d[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x3be495[_0x1e51('0x2c')]['fields']));_0x1ef3d3[_0x1e51('0x30')]=_0x1ef3d3[_0x1e51('0x30')][_0x1e51('0x32')]?_0x1ef3d3[_0x1e51('0x30')]:_0x1a9e0d[_0x1e51('0x2b')];if(_0x3be495[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x1ef3d3[_0x1e51('0x3d')]=[{'all':!![]}];}_0x1ef3d3=_[_0x1e51('0x3a')]({},_0x1ef3d3,_0x3be495['options']);return db[_0x1e51('0x3e')][_0x1e51('0x44')](_0x1ef3d3)['then'](handleEntityNotFound(_0x4650e4,null))[_0x1e51('0x23')](respondWithResult(_0x4650e4,null))[_0x1e51('0x40')](handleError(_0x4650e4,null));};exports[_0x1e51('0x45')]=function(_0x4f6405,_0x44468a){return db[_0x1e51('0x3e')][_0x1e51('0x45')](_0x4f6405['body'],{})[_0x1e51('0x23')](respondWithResult(_0x44468a,0xc9))['catch'](handleError(_0x44468a,null));};exports['update']=function(_0x54688b,_0x169e6c){if(_0x54688b[_0x1e51('0x46')]['id']){delete _0x54688b['body']['id'];}return db['WhatsappQueueReport'][_0x1e51('0x44')]({'where':{'id':_0x54688b[_0x1e51('0x42')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x169e6c,null))[_0x1e51('0x23')](saveUpdates(_0x54688b[_0x1e51('0x46')],null))[_0x1e51('0x23')](respondWithResult(_0x169e6c,null))['catch'](handleError(_0x169e6c,null));};exports[_0x1e51('0x47')]=function(_0x48a2d0,_0xf6bd35){return db[_0x1e51('0x3e')]['find']({'where':{'id':_0x48a2d0['params']['id']}})['then'](handleEntityNotFound(_0xf6bd35,null))[_0x1e51('0x23')](removeEntity(_0xf6bd35,null))[_0x1e51('0x40')](handleError(_0xf6bd35,null));};exports[_0x1e51('0x48')]=function(_0x4cdfe3,_0x2fdee1){return db[_0x1e51('0x3e')][_0x1e51('0x48')]()[_0x1e51('0x23')](respondWithResult(_0x2fdee1,null))[_0x1e51('0x40')](handleError(_0x2fdee1,null));}; \ No newline at end of file +var _0x02ce=['then','destroy','error','name','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update'];(function(_0x2d758c,_0x4e96a1){var _0x16e3fe=function(_0x3a8ace){while(--_0x3a8ace){_0x2d758c['push'](_0x2d758c['shift']());}};_0x16e3fe(++_0x4e96a1);}(_0x02ce,0x1ac));var _0xe02c=function(_0xb735d1,_0x45d992){_0xb735d1=_0xb735d1-0x0;var _0x5d3fc3=_0x02ce[_0xb735d1];return _0x5d3fc3;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefd882,_0x4411d8){return function(_0x3592ca){if(!_0x3592ca){_0xefd882[_0xe02c('0x1c')](0x194);}return _0x3592ca;};}function handleError(_0x16dfa3,_0x303d24){_0x303d24=_0x303d24||0x1f4;return function(_0x43dc78){logger[_0xe02c('0x2a')](_0x43dc78['stack']);if(_0x43dc78[_0xe02c('0x2b')]){delete _0x43dc78[_0xe02c('0x2b')];}_0x16dfa3[_0xe02c('0x22')](_0x303d24)['send'](_0x43dc78);};}exports[_0xe02c('0x2c')]=function(_0x2d1d98,_0x445421){var _0x287f7e={},_0x1e7eab={},_0x35a309={'count':0x0,'rows':[]};var _0x22a285=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x17d5b3){return{'name':_0x17d5b3['fieldName'],'type':_0x17d5b3[_0xe02c('0x30')][_0xe02c('0x31')]};});_0x1e7eab[_0xe02c('0x32')]=_[_0xe02c('0x2d')](_0x22a285,_0xe02c('0x2b'));_0x1e7eab[_0xe02c('0x33')]=_['keys'](_0x2d1d98[_0xe02c('0x33')]);_0x1e7eab[_0xe02c('0x34')]=_['intersection'](_0x1e7eab[_0xe02c('0x32')],_0x1e7eab[_0xe02c('0x33')]);_0x287f7e[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x1e7eab[_0xe02c('0x32')],qs['fields'](_0x2d1d98['query'][_0xe02c('0x37')]));_0x287f7e[_0xe02c('0x35')]=_0x287f7e['attributes'][_0xe02c('0x38')]?_0x287f7e['attributes']:_0x1e7eab[_0xe02c('0x32')];if(!_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x287f7e[_0xe02c('0x21')]=qs['limit'](_0x2d1d98[_0xe02c('0x33')]['limit']);_0x287f7e[_0xe02c('0x1e')]=qs[_0xe02c('0x1e')](_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x1e')]);}_0x287f7e[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x2d1d98['query'][_0xe02c('0x3c')]);_0x287f7e[_0xe02c('0x3d')]=qs['filters'](_[_0xe02c('0x3e')](_0x2d1d98[_0xe02c('0x33')],_0x1e7eab['filters']),_0x22a285);if(_0x2d1d98[_0xe02c('0x33')]['filter']){_0x287f7e[_0xe02c('0x3d')]=_[_0xe02c('0x3f')](_0x287f7e['where'],{'$or':_[_0xe02c('0x2d')](_0x22a285,function(_0x1eeddb){if(_0x1eeddb[_0xe02c('0x30')]!==_0xe02c('0x40')){var _0x3c4a65={};_0x3c4a65[_0x1eeddb[_0xe02c('0x2b')]]={'$like':'%'+_0x2d1d98['query'][_0xe02c('0x41')]+'%'};return _0x3c4a65;}})});}_0x287f7e=_['merge']({},_0x287f7e,_0x2d1d98['options']);var _0x3db057={'where':_0x287f7e[_0xe02c('0x3d')]};return db[_0xe02c('0x2e')][_0xe02c('0x20')](_0x3db057)['then'](function(_0x37e4fe){_0x35a309[_0xe02c('0x20')]=_0x37e4fe;if(_0x2d1d98[_0xe02c('0x33')]['includeAll']){_0x287f7e['include']=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x42')](_0x287f7e);})[_0xe02c('0x28')](function(_0x2313d2){_0x35a309[_0xe02c('0x43')]=_0x2313d2;return _0x35a309;})[_0xe02c('0x28')](respondWithFilteredResult(_0x445421,_0x287f7e))[_0xe02c('0x44')](handleError(_0x445421,null));};exports[_0xe02c('0x45')]=function(_0x21d66e,_0x53d123){var _0xc7e935={'raw':!![],'where':{'id':_0x21d66e['params']['id']}},_0x5ef4a1={};_0x5ef4a1[_0xe02c('0x32')]=_[_0xe02c('0x46')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x5ef4a1[_0xe02c('0x33')]=_[_0xe02c('0x46')](_0x21d66e[_0xe02c('0x33')]);_0x5ef4a1[_0xe02c('0x34')]=_['intersection'](_0x5ef4a1['model'],_0x5ef4a1[_0xe02c('0x33')]);_0xc7e935[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x5ef4a1['model'],qs[_0xe02c('0x37')](_0x21d66e[_0xe02c('0x33')][_0xe02c('0x37')]));_0xc7e935[_0xe02c('0x35')]=_0xc7e935[_0xe02c('0x35')][_0xe02c('0x38')]?_0xc7e935[_0xe02c('0x35')]:_0x5ef4a1[_0xe02c('0x32')];if(_0x21d66e[_0xe02c('0x33')][_0xe02c('0x47')]){_0xc7e935['include']=[{'all':!![]}];}_0xc7e935=_[_0xe02c('0x3f')]({},_0xc7e935,_0x21d66e[_0xe02c('0x48')]);return db[_0xe02c('0x2e')][_0xe02c('0x49')](_0xc7e935)[_0xe02c('0x28')](handleEntityNotFound(_0x53d123,null))[_0xe02c('0x28')](respondWithResult(_0x53d123,null))[_0xe02c('0x44')](handleError(_0x53d123,null));};exports[_0xe02c('0x4a')]=function(_0x30dc90,_0x1176c9){return db[_0xe02c('0x2e')][_0xe02c('0x4a')](_0x30dc90[_0xe02c('0x4b')],{})['then'](respondWithResult(_0x1176c9,0xc9))[_0xe02c('0x44')](handleError(_0x1176c9,null));};exports['update']=function(_0x15b05c,_0x324911){if(_0x15b05c[_0xe02c('0x4b')]['id']){delete _0x15b05c[_0xe02c('0x4b')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x49')]({'where':{'id':_0x15b05c[_0xe02c('0x4c')]['id']}})[_0xe02c('0x28')](handleEntityNotFound(_0x324911,null))[_0xe02c('0x28')](saveUpdates(_0x15b05c[_0xe02c('0x4b')],null))['then'](respondWithResult(_0x324911,null))[_0xe02c('0x44')](handleError(_0x324911,null));};exports[_0xe02c('0x29')]=function(_0xeb4214,_0x536cf7){return db[_0xe02c('0x2e')]['find']({'where':{'id':_0xeb4214[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x536cf7,null))['then'](removeEntity(_0x536cf7,null))['catch'](handleError(_0x536cf7,null));};exports['describe']=function(_0x51d540,_0x5740df){return db[_0xe02c('0x2e')][_0xe02c('0x4d')]()[_0xe02c('0x28')](respondWithResult(_0x5740df,null))[_0xe02c('0x44')](handleError(_0x5740df,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0f92f7e..46b8535 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f1c=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','api','moment','path','rimraf','../../config/environment'];(function(_0x4f7112,_0x4cb6bf){var _0x51d64c=function(_0x12c987){while(--_0x12c987){_0x4f7112['push'](_0x4f7112['shift']());}};_0x51d64c(++_0x4cb6bf);}(_0x0f1c,0x126));var _0xc0f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc0f1('0x0'));var logger=require('../../config/logger')(_0xc0f1('0x1'));var moment=require(_0xc0f1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0f1('0x3'));var rimraf=require(_0xc0f1('0x4'));var config=require(_0xc0f1('0x5'));var attributes=require(_0xc0f1('0x6'));module[_0xc0f1('0x7')]=function(_0x228d01,_0x46cc27){return _0x228d01[_0xc0f1('0x8')](_0xc0f1('0x9'),attributes,{'tableName':_0xc0f1('0xa'),'paranoid':![],'indexes':[{'name':_0xc0f1('0xb'),'fields':[_0xc0f1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c8e=['bluebird','request-promise','path','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','api','moment'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x0c8e,0x1c4));var _0xe0c8=function(_0xea8783,_0x189de9){_0xea8783=_0xea8783-0x0;var _0x43e2be=_0x0c8e[_0xea8783];return _0x43e2be;};'use strict';var _=require(_0xe0c8('0x0'));var util=require(_0xe0c8('0x1'));var logger=require('../../config/logger')(_0xe0c8('0x2'));var moment=require(_0xe0c8('0x3'));var BPromise=require(_0xe0c8('0x4'));var rp=require(_0xe0c8('0x5'));var fs=require('fs');var path=require(_0xe0c8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe0c8('0x7'));module[_0xe0c8('0x8')]=function(_0x22083f,_0xb45d1c){return _0x22083f[_0xe0c8('0x9')](_0xe0c8('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xe0c8('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index adbc5ec..80a9814 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe532=['CreateWhatsappQueueReport','debug','stringify','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','WhatsappQueueReport','create','body','options'];(function(_0x5ef783,_0x2acf4f){var _0x4ab7ec=function(_0x2faf95){while(--_0x2faf95){_0x5ef783['push'](_0x5ef783['shift']());}};_0x4ab7ec(++_0x2acf4f);}(_0xe532,0x1ce));var _0x2e53=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xe532[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x2e53('0x0'));var util=require(_0x2e53('0x1'));var moment=require(_0x2e53('0x2'));var BPromise=require(_0x2e53('0x3'));var rs=require(_0x2e53('0x4'));var fs=require('fs');var Redis=require(_0x2e53('0x5'));var db=require(_0x2e53('0x6'))['db'];var utils=require(_0x2e53('0x7'));var logger=require(_0x2e53('0x8'))(_0x2e53('0x9'));var config=require(_0x2e53('0xa'));var jayson=require(_0x2e53('0xb'));var client=jayson[_0x2e53('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f1cc9,_0x4cbdfe,_0x4d67af){return new BPromise(function(_0x3a662a,_0x4ddae9){return client[_0x2e53('0xd')](_0x3f1cc9,_0x4d67af)[_0x2e53('0xe')](function(_0x3bec6a){logger[_0x2e53('0xf')](_0x2e53('0x10'),_0x4cbdfe,_0x2e53('0x11'));logger['debug'](_0x2e53('0x12'),_0x4cbdfe,_0x2e53('0x11'),JSON['stringify'](_0x3bec6a));if(_0x3bec6a['error']){if(_0x3bec6a['error'][_0x2e53('0x13')]===0x1f4){logger[_0x2e53('0x14')](_0x2e53('0x10'),_0x4cbdfe,_0x3bec6a[_0x2e53('0x14')][_0x2e53('0x15')]);return _0x4ddae9(_0x3bec6a[_0x2e53('0x14')][_0x2e53('0x15')]);}logger[_0x2e53('0x14')](_0x2e53('0x10'),_0x4cbdfe,_0x3bec6a[_0x2e53('0x14')][_0x2e53('0x15')]);return _0x3a662a(_0x3bec6a['error'][_0x2e53('0x15')]);}else{logger['info'](_0x2e53('0x10'),_0x4cbdfe,_0x2e53('0x11'));_0x3a662a(_0x3bec6a[_0x2e53('0x16')]['message']);}})[_0x2e53('0x17')](function(_0x4f94a7){logger[_0x2e53('0x14')](_0x2e53('0x10'),_0x4cbdfe,_0x4f94a7);_0x4ddae9(_0x4f94a7);});});}exports['CreateWhatsappQueueReport']=function(_0x58247c){var _0x45aa0c=this;return new Promise(function(_0x228f34,_0x537e8e){return db[_0x2e53('0x18')][_0x2e53('0x19')](_0x58247c[_0x2e53('0x1a')],{'raw':_0x58247c[_0x2e53('0x1b')]?_0x58247c['options']['raw']===undefined?!![]:![]:!![]})[_0x2e53('0xe')](function(_0x316966){logger[_0x2e53('0xf')](_0x2e53('0x1c'),_0x58247c);logger[_0x2e53('0x1d')](_0x2e53('0x1c'),_0x58247c,JSON[_0x2e53('0x1e')](_0x316966));_0x228f34(_0x316966);})['catch'](function(_0xde73d9){logger['error']('CreateWhatsappQueueReport',_0xde73d9['message'],_0x58247c);_0x537e8e(_0x45aa0c[_0x2e53('0x14')](0x1f4,_0xde73d9[_0x2e53('0x15')]));});});};exports[_0x2e53('0x1f')]=function(_0x33c282){var _0x190e94=this;return new Promise(function(_0x53d2b0,_0x4279d9){return db[_0x2e53('0x18')]['update'](_0x33c282[_0x2e53('0x1a')],{'raw':_0x33c282[_0x2e53('0x1b')]?_0x33c282[_0x2e53('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33c282['options']?_0x33c282[_0x2e53('0x1b')][_0x2e53('0x20')]||null:null,'attributes':_0x33c282[_0x2e53('0x1b')]?_0x33c282[_0x2e53('0x1b')][_0x2e53('0x21')]||null:null,'limit':_0x33c282[_0x2e53('0x1b')]?_0x33c282[_0x2e53('0x1b')][_0x2e53('0x22')]||null:null})[_0x2e53('0xe')](function(_0xa12545){logger['info'](_0x2e53('0x1f'),_0x33c282);logger[_0x2e53('0x1d')](_0x2e53('0x1f'),_0x33c282,JSON[_0x2e53('0x1e')](_0xa12545));_0x53d2b0(_0xa12545);})[_0x2e53('0x17')](function(_0x5abdc7){logger['error'](_0x2e53('0x1f'),_0x5abdc7[_0x2e53('0x15')],_0x33c282);_0x4279d9(_0x190e94[_0x2e53('0x14')](0x1f4,_0x5abdc7[_0x2e53('0x15')]));});});}; \ No newline at end of file +var _0x10b2=['../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport','attributes','lodash','util','randomstring','../../config/logger','rpc'];(function(_0x36c777,_0x2616f2){var _0x8c2dc5=function(_0x1539a0){while(--_0x1539a0){_0x36c777['push'](_0x36c777['shift']());}};_0x8c2dc5(++_0x2616f2);}(_0x10b2,0x13f));var _0x210b=function(_0x2f85a8,_0x20e6f9){_0x2f85a8=_0x2f85a8-0x0;var _0x26b98d=_0x10b2[_0x2f85a8];return _0x26b98d;};'use strict';var _=require(_0x210b('0x0'));var util=require(_0x210b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x210b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x210b('0x3'))(_0x210b('0x4'));var config=require(_0x210b('0x5'));var jayson=require(_0x210b('0x6'));var client=jayson['client'][_0x210b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a89a9,_0x100241,_0x4292bf){return new BPromise(function(_0xba986b,_0x455d18){return client[_0x210b('0x8')](_0x5a89a9,_0x4292bf)[_0x210b('0x9')](function(_0x3ac7e8){logger[_0x210b('0xa')](_0x210b('0xb'),_0x100241,_0x210b('0xc'));logger[_0x210b('0xd')](_0x210b('0xe'),_0x100241,_0x210b('0xc'),JSON[_0x210b('0xf')](_0x3ac7e8));if(_0x3ac7e8['error']){if(_0x3ac7e8[_0x210b('0x10')][_0x210b('0x11')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x100241,_0x3ac7e8[_0x210b('0x10')][_0x210b('0x12')]);return _0x455d18(_0x3ac7e8[_0x210b('0x10')][_0x210b('0x12')]);}logger[_0x210b('0x10')](_0x210b('0xb'),_0x100241,_0x3ac7e8['error'][_0x210b('0x12')]);return _0xba986b(_0x3ac7e8[_0x210b('0x10')]['message']);}else{logger[_0x210b('0xa')](_0x210b('0xb'),_0x100241,_0x210b('0xc'));_0xba986b(_0x3ac7e8[_0x210b('0x13')]['message']);}})['catch'](function(_0x5adf1a){logger[_0x210b('0x10')](_0x210b('0xb'),_0x100241,_0x5adf1a);_0x455d18(_0x5adf1a);});});}exports[_0x210b('0x14')]=function(_0x1ab474){var _0xacd061=this;return new Promise(function(_0x25b41d,_0x2e571a){return db[_0x210b('0x15')][_0x210b('0x16')](_0x1ab474[_0x210b('0x17')],{'raw':_0x1ab474[_0x210b('0x18')]?_0x1ab474[_0x210b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x210b('0x9')](function(_0x3bcfde){logger[_0x210b('0xa')]('CreateWhatsappQueueReport',_0x1ab474);logger['debug'](_0x210b('0x14'),_0x1ab474,JSON[_0x210b('0xf')](_0x3bcfde));_0x25b41d(_0x3bcfde);})['catch'](function(_0x1e1e77){logger[_0x210b('0x10')](_0x210b('0x14'),_0x1e1e77[_0x210b('0x12')],_0x1ab474);_0x2e571a(_0xacd061[_0x210b('0x10')](0x1f4,_0x1e1e77[_0x210b('0x12')]));});});};exports[_0x210b('0x19')]=function(_0x1e6676){var _0x549e23=this;return new Promise(function(_0x524200,_0x43bdf9){return db[_0x210b('0x15')]['update'](_0x1e6676['body'],{'raw':_0x1e6676['options']?_0x1e6676[_0x210b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e6676[_0x210b('0x18')]?_0x1e6676[_0x210b('0x18')]['where']||null:null,'attributes':_0x1e6676[_0x210b('0x18')]?_0x1e6676[_0x210b('0x18')][_0x210b('0x1a')]||null:null,'limit':_0x1e6676[_0x210b('0x18')]?_0x1e6676[_0x210b('0x18')]['limit']||null:null})['then'](function(_0x42d85e){logger['info']('UpdateWhatsappQueueReport',_0x1e6676);logger[_0x210b('0xd')](_0x210b('0x19'),_0x1e6676,JSON[_0x210b('0xf')](_0x42d85e));_0x524200(_0x42d85e);})['catch'](function(_0x4ba778){logger[_0x210b('0x10')](_0x210b('0x19'),_0x4ba778[_0x210b('0x12')],_0x1e6676);_0x43bdf9(_0x549e23[_0x210b('0x10')](0x1f4,_0x4ba778['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 89b2b60..376ef10 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ab2=['update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x8ab2,0x1cc));var _0x28ab=function(_0x2462a8,_0x2baf04){_0x2462a8=_0x2462a8-0x0;var _0x25aaee=_0x8ab2[_0x2462a8];return _0x25aaee;};'use strict';var multer=require('multer');var util=require(_0x28ab('0x0'));var path=require(_0x28ab('0x1'));var timeout=require('connect-timeout');var express=require(_0x28ab('0x2'));var router=express['Router']();var fs_extra=require(_0x28ab('0x3'));var auth=require(_0x28ab('0x4'));var interaction=require(_0x28ab('0x5'));var config=require(_0x28ab('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x28ab('0x7')]('/',auth[_0x28ab('0x8')](),controller['index']);router[_0x28ab('0x7')](_0x28ab('0x9'),auth[_0x28ab('0x8')](),controller['describe']);router['get'](_0x28ab('0xa'),auth[_0x28ab('0x8')](),controller[_0x28ab('0xb')]);router[_0x28ab('0xc')]('/',auth['isAuthenticated'](),controller[_0x28ab('0xd')]);router[_0x28ab('0xe')](_0x28ab('0xa'),auth[_0x28ab('0x8')](),controller[_0x28ab('0xf')]);router[_0x28ab('0x10')](_0x28ab('0xa'),auth['isAuthenticated'](),controller[_0x28ab('0x11')]);module[_0x28ab('0x12')]=router; \ No newline at end of file +var _0xe176=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index','/describe','describe','show','isAuthenticated','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x340da7,_0x13d6fc){var _0x43b466=function(_0x59e11e){while(--_0x59e11e){_0x340da7['push'](_0x340da7['shift']());}};_0x43b466(++_0x13d6fc);}(_0xe176,0x1c4));var _0x6e17=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xe176[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0x6e17('0x0'));var util=require(_0x6e17('0x1'));var path=require(_0x6e17('0x2'));var timeout=require(_0x6e17('0x3'));var express=require('express');var router=express[_0x6e17('0x4')]();var fs_extra=require(_0x6e17('0x5'));var auth=require(_0x6e17('0x6'));var interaction=require(_0x6e17('0x7'));var config=require('../../config/environment');var controller=require(_0x6e17('0x8'));router[_0x6e17('0x9')]('/',auth['isAuthenticated'](),controller[_0x6e17('0xa')]);router[_0x6e17('0x9')](_0x6e17('0xb'),auth['isAuthenticated'](),controller[_0x6e17('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6e17('0xd')]);router['post']('/',auth[_0x6e17('0xe')](),controller['create']);router['put'](_0x6e17('0xf'),auth['isAuthenticated'](),controller[_0x6e17('0x10')]);router['delete'](_0x6e17('0xf'),auth[_0x6e17('0xe')](),controller[_0x6e17('0x11')]);module[_0x6e17('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 99df854..8f74552 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97b2=['STRING','ENUM','account','agent','DATE','sequelize','exports'];(function(_0x2db253,_0x21659d){var _0x4f4ea2=function(_0x4c1883){while(--_0x4c1883){_0x2db253['push'](_0x2db253['shift']());}};_0x4f4ea2(++_0x21659d);}(_0x97b2,0x1b7));var _0x297b=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x97b2[_0x400322];return _0xfdd597;};'use strict';var Sequelize=require(_0x297b('0x0'));module[_0x297b('0x1')]={'uniqueid':{'type':Sequelize[_0x297b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x297b('0x3')](_0x297b('0x4'),_0x297b('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x297b('0x6')]}}; \ No newline at end of file +var _0x8814=['sequelize','ENUM','agent','queue','DATE'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8814,0x1b8));var _0x4881=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x8814[_0x318840];return _0x223da4;};'use strict';var Sequelize=require(_0x4881('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4881('0x1')]('account',_0x4881('0x2'),_0x4881('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4881('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a12cc60..c175abc 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdec=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x62b49b,_0x2550cd){var _0x299d2a=function(_0x2d4af9){while(--_0x2d4af9){_0x62b49b['push'](_0x62b49b['shift']());}};_0x299d2a(++_0x2550cd);}(_0xcdec,0x173));var _0xccde=function(_0x56ff88,_0x259321){_0x56ff88=_0x56ff88-0x0;var _0x5e2666=_0xcdec[_0x56ff88];return _0x5e2666;};'use strict';var emlformat=require(_0xccde('0x0'));var rimraf=require(_0xccde('0x1'));var zipdir=require(_0xccde('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccde('0x3'));var moment=require('moment');var BPromise=require(_0xccde('0x4'));var Mustache=require(_0xccde('0x5'));var util=require(_0xccde('0x6'));var path=require('path');var sox=require(_0xccde('0x7'));var csv=require(_0xccde('0x8'));var ejs=require(_0xccde('0x9'));var fs=require('fs');var fs_extra=require(_0xccde('0xa'));var _=require(_0xccde('0xb'));var squel=require(_0xccde('0xc'));var crypto=require(_0xccde('0xd'));var jsforce=require(_0xccde('0xe'));var deskjs=require(_0xccde('0xf'));var toCsv=require('to-csv');var querystring=require(_0xccde('0x10'));var Papa=require('papaparse');var Redis=require(_0xccde('0x11'));var authService=require(_0xccde('0x12'));var qs=require(_0xccde('0x13'));var as=require(_0xccde('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xccde('0x15'));var utils=require('../../config/utils');var config=require(_0xccde('0x16'));var licenseUtil=require(_0xccde('0x17'));var db=require(_0xccde('0x18'))['db'];function respondWithStatusCode(_0x1d9959,_0x1bb262){_0x1bb262=_0x1bb262||0xcc;return function(_0x3c6e62){if(_0x3c6e62){return _0x1d9959[_0xccde('0x19')](_0x1bb262);}return _0x1d9959[_0xccde('0x1a')](_0x1bb262)['end']();};}function respondWithResult(_0x25e505,_0x207dd7){_0x207dd7=_0x207dd7||0xc8;return function(_0x3cd741){if(_0x3cd741){return _0x25e505[_0xccde('0x1a')](_0x207dd7)[_0xccde('0x1b')](_0x3cd741);}};}function respondWithFilteredResult(_0x444019,_0x355516){return function(_0x448d11){if(_0x448d11){var _0x300f72=typeof _0x355516[_0xccde('0x1c')]===_0xccde('0x1d')&&typeof _0x355516[_0xccde('0x1e')]===_0xccde('0x1d');var _0x2a5e56=_0x448d11[_0xccde('0x1f')];var _0x4b4891=_0x300f72?0x0:_0x355516[_0xccde('0x1c')];var _0x1ea28d=_0x300f72?_0x448d11[_0xccde('0x1f')]:_0x355516[_0xccde('0x1c')]+_0x355516[_0xccde('0x1e')];var _0x93282e;if(_0x1ea28d>=_0x2a5e56){_0x1ea28d=_0x2a5e56;_0x93282e=0xc8;}else{_0x93282e=0xce;}_0x444019[_0xccde('0x1a')](_0x93282e);return _0x444019[_0xccde('0x20')](_0xccde('0x21'),_0x4b4891+'-'+_0x1ea28d+'/'+_0x2a5e56)[_0xccde('0x1b')](_0x448d11);}return null;};}function patchUpdates(_0x24c1ed){return function(_0x233b49){try{jsonpatch[_0xccde('0x22')](_0x233b49,_0x24c1ed,!![]);}catch(_0x461be9){return BPromise[_0xccde('0x23')](_0x461be9);}return _0x233b49[_0xccde('0x24')]();};}function saveUpdates(_0x19fc9a,_0x5629e0){return function(_0x47003f){if(_0x47003f){return _0x47003f[_0xccde('0x25')](_0x19fc9a)[_0xccde('0x26')](function(_0x1dd4a9){return _0x1dd4a9;});}return null;};}function removeEntity(_0x3e2f7a,_0x1dcc19){return function(_0x236c96){if(_0x236c96){return _0x236c96[_0xccde('0x27')]()['then'](function(){_0x3e2f7a[_0xccde('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a91d,_0xe279){return function(_0x1a1da4){if(!_0x1a1da4){_0x55a91d[_0xccde('0x19')](0x194);}return _0x1a1da4;};}function handleError(_0x3b2cff,_0x57839d){_0x57839d=_0x57839d||0x1f4;return function(_0x8a3573){logger[_0xccde('0x28')](_0x8a3573[_0xccde('0x29')]);if(_0x8a3573[_0xccde('0x2a')]){delete _0x8a3573['name'];}_0x3b2cff[_0xccde('0x1a')](_0x57839d)[_0xccde('0x2b')](_0x8a3573);};}exports[_0xccde('0x2c')]=function(_0x1c2ab4,_0x1b05fd){var _0x23a22e={},_0x6443bf={},_0xd6a0ba={'count':0x0,'rows':[]};var _0x5db999=_[_0xccde('0x2d')](db[_0xccde('0x2e')][_0xccde('0x2f')],function(_0x431d4f){return{'name':_0x431d4f[_0xccde('0x30')],'type':_0x431d4f['type']['key']};});_0x6443bf[_0xccde('0x31')]=_[_0xccde('0x2d')](_0x5db999,_0xccde('0x2a'));_0x6443bf[_0xccde('0x32')]=_[_0xccde('0x33')](_0x1c2ab4[_0xccde('0x32')]);_0x6443bf['filters']=_[_0xccde('0x34')](_0x6443bf[_0xccde('0x31')],_0x6443bf['query']);_0x23a22e[_0xccde('0x35')]=_['intersection'](_0x6443bf[_0xccde('0x31')],qs[_0xccde('0x36')](_0x1c2ab4[_0xccde('0x32')][_0xccde('0x36')]));_0x23a22e[_0xccde('0x35')]=_0x23a22e[_0xccde('0x35')]['length']?_0x23a22e[_0xccde('0x35')]:_0x6443bf[_0xccde('0x31')];if(!_0x1c2ab4[_0xccde('0x32')][_0xccde('0x37')](_0xccde('0x38'))){_0x23a22e[_0xccde('0x1e')]=qs[_0xccde('0x1e')](_0x1c2ab4[_0xccde('0x32')][_0xccde('0x1e')]);_0x23a22e[_0xccde('0x1c')]=qs[_0xccde('0x1c')](_0x1c2ab4['query'][_0xccde('0x1c')]);}_0x23a22e[_0xccde('0x39')]=qs['sort'](_0x1c2ab4[_0xccde('0x32')][_0xccde('0x3a')]);_0x23a22e[_0xccde('0x3b')]=qs[_0xccde('0x3c')](_[_0xccde('0x3d')](_0x1c2ab4['query'],_0x6443bf[_0xccde('0x3c')]),_0x5db999);if(_0x1c2ab4['query']['filter']){_0x23a22e[_0xccde('0x3b')]=_['merge'](_0x23a22e[_0xccde('0x3b')],{'$or':_['map'](_0x5db999,function(_0xb73057){if(_0xb73057[_0xccde('0x3e')]!==_0xccde('0x3f')){var _0x2f12b8={};_0x2f12b8[_0xb73057['name']]={'$like':'%'+_0x1c2ab4[_0xccde('0x32')]['filter']+'%'};return _0x2f12b8;}})});}_0x23a22e=_['merge']({},_0x23a22e,_0x1c2ab4['options']);var _0x3100ff={'where':_0x23a22e[_0xccde('0x3b')]};return db[_0xccde('0x2e')][_0xccde('0x1f')](_0x3100ff)['then'](function(_0x1a29cb){_0xd6a0ba[_0xccde('0x1f')]=_0x1a29cb;if(_0x1c2ab4[_0xccde('0x32')][_0xccde('0x40')]){_0x23a22e[_0xccde('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xccde('0x42')](_0x23a22e);})[_0xccde('0x26')](function(_0x36a514){_0xd6a0ba[_0xccde('0x43')]=_0x36a514;return _0xd6a0ba;})[_0xccde('0x26')](respondWithFilteredResult(_0x1b05fd,_0x23a22e))[_0xccde('0x44')](handleError(_0x1b05fd,null));};exports[_0xccde('0x45')]=function(_0x4c9391,_0x172d4b){var _0x521914={'raw':!![],'where':{'id':_0x4c9391[_0xccde('0x46')]['id']}},_0x532c96={};_0x532c96[_0xccde('0x31')]=_['keys'](db[_0xccde('0x2e')][_0xccde('0x2f')]);_0x532c96[_0xccde('0x32')]=_[_0xccde('0x33')](_0x4c9391[_0xccde('0x32')]);_0x532c96[_0xccde('0x3c')]=_[_0xccde('0x34')](_0x532c96['model'],_0x532c96[_0xccde('0x32')]);_0x521914['attributes']=_['intersection'](_0x532c96['model'],qs[_0xccde('0x36')](_0x4c9391[_0xccde('0x32')][_0xccde('0x36')]));_0x521914[_0xccde('0x35')]=_0x521914[_0xccde('0x35')][_0xccde('0x47')]?_0x521914[_0xccde('0x35')]:_0x532c96[_0xccde('0x31')];if(_0x4c9391[_0xccde('0x32')][_0xccde('0x40')]){_0x521914[_0xccde('0x41')]=[{'all':!![]}];}_0x521914=_[_0xccde('0x48')]({},_0x521914,_0x4c9391[_0xccde('0x49')]);return db[_0xccde('0x2e')][_0xccde('0x4a')](_0x521914)['then'](handleEntityNotFound(_0x172d4b,null))[_0xccde('0x26')](respondWithResult(_0x172d4b,null))[_0xccde('0x44')](handleError(_0x172d4b,null));};exports['create']=function(_0x1f6c42,_0x4265dc){return db[_0xccde('0x2e')][_0xccde('0x4b')](_0x1f6c42[_0xccde('0x4c')],{})['then'](respondWithResult(_0x4265dc,0xc9))[_0xccde('0x44')](handleError(_0x4265dc,null));};exports[_0xccde('0x25')]=function(_0x92bb28,_0x3c5602){if(_0x92bb28[_0xccde('0x4c')]['id']){delete _0x92bb28[_0xccde('0x4c')]['id'];}return db[_0xccde('0x2e')]['find']({'where':{'id':_0x92bb28[_0xccde('0x46')]['id']}})[_0xccde('0x26')](handleEntityNotFound(_0x3c5602,null))[_0xccde('0x26')](saveUpdates(_0x92bb28[_0xccde('0x4c')],null))[_0xccde('0x26')](respondWithResult(_0x3c5602,null))[_0xccde('0x44')](handleError(_0x3c5602,null));};exports[_0xccde('0x27')]=function(_0x3bc757,_0x1d5daf){return db['WhatsappTransferReport'][_0xccde('0x4a')]({'where':{'id':_0x3bc757[_0xccde('0x46')]['id']}})[_0xccde('0x26')](handleEntityNotFound(_0x1d5daf,null))[_0xccde('0x26')](removeEntity(_0x1d5daf,null))[_0xccde('0x44')](handleError(_0x1d5daf,null));};exports['describe']=function(_0x5b8dd7,_0xc38015){return db[_0xccde('0x2e')][_0xccde('0x4d')]()[_0xccde('0x26')](respondWithResult(_0xc38015,null))[_0xccde('0x44')](handleError(_0xc38015,null));}; \ No newline at end of file +var _0x9c0b=['then','sendStatus','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','key','keys','filters','intersection','model','fields','attributes','query','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update'];(function(_0x4d3735,_0x12aa11){var _0x5c733e=function(_0x5ec986){while(--_0x5ec986){_0x4d3735['push'](_0x4d3735['shift']());}};_0x5c733e(++_0x12aa11);}(_0x9c0b,0xb2));var _0xb9c0=function(_0x23b2a6,_0x306cec){_0x23b2a6=_0x23b2a6-0x0;var _0x5704cb=_0x9c0b[_0x23b2a6];return _0x5704cb;};'use strict';var emlformat=require(_0xb9c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9c0('0x1'));var jsonpatch=require(_0xb9c0('0x2'));var rp=require('request-promise');var moment=require(_0xb9c0('0x3'));var BPromise=require(_0xb9c0('0x4'));var Mustache=require(_0xb9c0('0x5'));var util=require(_0xb9c0('0x6'));var path=require(_0xb9c0('0x7'));var sox=require(_0xb9c0('0x8'));var csv=require(_0xb9c0('0x9'));var ejs=require(_0xb9c0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb9c0('0xb'));var crypto=require('crypto');var jsforce=require(_0xb9c0('0xc'));var deskjs=require(_0xb9c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb9c0('0xe'));var Papa=require('papaparse');var Redis=require(_0xb9c0('0xf'));var authService=require(_0xb9c0('0x10'));var qs=require(_0xb9c0('0x11'));var as=require(_0xb9c0('0x12'));var hardwareService=require(_0xb9c0('0x13'));var logger=require(_0xb9c0('0x14'))('api');var utils=require(_0xb9c0('0x15'));var config=require(_0xb9c0('0x16'));var licenseUtil=require(_0xb9c0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd7a016,_0xf6b4df){_0xf6b4df=_0xf6b4df||0xcc;return function(_0x15a6e4){if(_0x15a6e4){return _0xd7a016['sendStatus'](_0xf6b4df);}return _0xd7a016[_0xb9c0('0x18')](_0xf6b4df)[_0xb9c0('0x19')]();};}function respondWithResult(_0x337f68,_0x13c2cd){_0x13c2cd=_0x13c2cd||0xc8;return function(_0x496f09){if(_0x496f09){return _0x337f68[_0xb9c0('0x18')](_0x13c2cd)['json'](_0x496f09);}};}function respondWithFilteredResult(_0x707074,_0x24e0e3){return function(_0x14d62e){if(_0x14d62e){var _0x27c287=typeof _0x24e0e3[_0xb9c0('0x1a')]===_0xb9c0('0x1b')&&typeof _0x24e0e3[_0xb9c0('0x1c')]===_0xb9c0('0x1b');var _0x4e3c24=_0x14d62e['count'];var _0x2b56ea=_0x27c287?0x0:_0x24e0e3[_0xb9c0('0x1a')];var _0xe43164=_0x27c287?_0x14d62e[_0xb9c0('0x1d')]:_0x24e0e3[_0xb9c0('0x1a')]+_0x24e0e3[_0xb9c0('0x1c')];var _0x131b1e;if(_0xe43164>=_0x4e3c24){_0xe43164=_0x4e3c24;_0x131b1e=0xc8;}else{_0x131b1e=0xce;}_0x707074[_0xb9c0('0x18')](_0x131b1e);return _0x707074[_0xb9c0('0x1e')](_0xb9c0('0x1f'),_0x2b56ea+'-'+_0xe43164+'/'+_0x4e3c24)['json'](_0x14d62e);}return null;};}function patchUpdates(_0x2d8a24){return function(_0x57b73f){try{jsonpatch[_0xb9c0('0x20')](_0x57b73f,_0x2d8a24,!![]);}catch(_0x5e627a){return BPromise[_0xb9c0('0x21')](_0x5e627a);}return _0x57b73f['save']();};}function saveUpdates(_0x4f876a,_0x226628){return function(_0x546bb1){if(_0x546bb1){return _0x546bb1[_0xb9c0('0x22')](_0x4f876a)[_0xb9c0('0x23')](function(_0x2d0570){return _0x2d0570;});}return null;};}function removeEntity(_0x194616,_0x50291e){return function(_0x41772a){if(_0x41772a){return _0x41772a['destroy']()[_0xb9c0('0x23')](function(){_0x194616[_0xb9c0('0x18')](0xcc)[_0xb9c0('0x19')]();});}};}function handleEntityNotFound(_0xff7f4c,_0x30fdfe){return function(_0x3810ce){if(!_0x3810ce){_0xff7f4c[_0xb9c0('0x24')](0x194);}return _0x3810ce;};}function handleError(_0x19b267,_0x41f0fe){_0x41f0fe=_0x41f0fe||0x1f4;return function(_0x18bfb7){logger['error'](_0x18bfb7['stack']);if(_0x18bfb7[_0xb9c0('0x25')]){delete _0x18bfb7[_0xb9c0('0x25')];}_0x19b267[_0xb9c0('0x18')](_0x41f0fe)[_0xb9c0('0x26')](_0x18bfb7);};}exports['index']=function(_0x48fc52,_0x2be3b3){var _0x1c724a={},_0x143673={},_0x549e4b={'count':0x0,'rows':[]};var _0x5c8798=_[_0xb9c0('0x27')](db[_0xb9c0('0x28')][_0xb9c0('0x29')],function(_0x5084d7){return{'name':_0x5084d7[_0xb9c0('0x2a')],'type':_0x5084d7['type'][_0xb9c0('0x2b')]};});_0x143673['model']=_['map'](_0x5c8798,_0xb9c0('0x25'));_0x143673['query']=_[_0xb9c0('0x2c')](_0x48fc52['query']);_0x143673[_0xb9c0('0x2d')]=_[_0xb9c0('0x2e')](_0x143673['model'],_0x143673['query']);_0x1c724a['attributes']=_['intersection'](_0x143673[_0xb9c0('0x2f')],qs['fields'](_0x48fc52['query'][_0xb9c0('0x30')]));_0x1c724a['attributes']=_0x1c724a[_0xb9c0('0x31')]['length']?_0x1c724a[_0xb9c0('0x31')]:_0x143673[_0xb9c0('0x2f')];if(!_0x48fc52[_0xb9c0('0x32')]['hasOwnProperty'](_0xb9c0('0x33'))){_0x1c724a['limit']=qs[_0xb9c0('0x1c')](_0x48fc52[_0xb9c0('0x32')]['limit']);_0x1c724a[_0xb9c0('0x1a')]=qs['offset'](_0x48fc52['query'][_0xb9c0('0x1a')]);}_0x1c724a['order']=qs['sort'](_0x48fc52[_0xb9c0('0x32')][_0xb9c0('0x34')]);_0x1c724a[_0xb9c0('0x35')]=qs[_0xb9c0('0x2d')](_[_0xb9c0('0x36')](_0x48fc52[_0xb9c0('0x32')],_0x143673[_0xb9c0('0x2d')]),_0x5c8798);if(_0x48fc52[_0xb9c0('0x32')][_0xb9c0('0x37')]){_0x1c724a[_0xb9c0('0x35')]=_[_0xb9c0('0x38')](_0x1c724a['where'],{'$or':_['map'](_0x5c8798,function(_0xd0a91){if(_0xd0a91[_0xb9c0('0x39')]!=='VIRTUAL'){var _0x4378ac={};_0x4378ac[_0xd0a91[_0xb9c0('0x25')]]={'$like':'%'+_0x48fc52[_0xb9c0('0x32')][_0xb9c0('0x37')]+'%'};return _0x4378ac;}})});}_0x1c724a=_['merge']({},_0x1c724a,_0x48fc52[_0xb9c0('0x3a')]);var _0x20033d={'where':_0x1c724a['where']};return db[_0xb9c0('0x28')][_0xb9c0('0x1d')](_0x20033d)[_0xb9c0('0x23')](function(_0x33a438){_0x549e4b[_0xb9c0('0x1d')]=_0x33a438;if(_0x48fc52[_0xb9c0('0x32')][_0xb9c0('0x3b')]){_0x1c724a[_0xb9c0('0x3c')]=[{'all':!![]}];}return db[_0xb9c0('0x28')][_0xb9c0('0x3d')](_0x1c724a);})['then'](function(_0x4e47c3){_0x549e4b[_0xb9c0('0x3e')]=_0x4e47c3;return _0x549e4b;})[_0xb9c0('0x23')](respondWithFilteredResult(_0x2be3b3,_0x1c724a))['catch'](handleError(_0x2be3b3,null));};exports[_0xb9c0('0x3f')]=function(_0x48c9b3,_0x5a04ee){var _0x2ba790={'raw':!![],'where':{'id':_0x48c9b3[_0xb9c0('0x40')]['id']}},_0x26b807={};_0x26b807['model']=_[_0xb9c0('0x2c')](db[_0xb9c0('0x28')]['rawAttributes']);_0x26b807[_0xb9c0('0x32')]=_[_0xb9c0('0x2c')](_0x48c9b3[_0xb9c0('0x32')]);_0x26b807[_0xb9c0('0x2d')]=_[_0xb9c0('0x2e')](_0x26b807[_0xb9c0('0x2f')],_0x26b807[_0xb9c0('0x32')]);_0x2ba790[_0xb9c0('0x31')]=_[_0xb9c0('0x2e')](_0x26b807[_0xb9c0('0x2f')],qs['fields'](_0x48c9b3['query'][_0xb9c0('0x30')]));_0x2ba790[_0xb9c0('0x31')]=_0x2ba790[_0xb9c0('0x31')]['length']?_0x2ba790['attributes']:_0x26b807[_0xb9c0('0x2f')];if(_0x48c9b3[_0xb9c0('0x32')]['includeAll']){_0x2ba790[_0xb9c0('0x3c')]=[{'all':!![]}];}_0x2ba790=_[_0xb9c0('0x38')]({},_0x2ba790,_0x48c9b3[_0xb9c0('0x3a')]);return db['WhatsappTransferReport'][_0xb9c0('0x41')](_0x2ba790)[_0xb9c0('0x23')](handleEntityNotFound(_0x5a04ee,null))[_0xb9c0('0x23')](respondWithResult(_0x5a04ee,null))[_0xb9c0('0x42')](handleError(_0x5a04ee,null));};exports[_0xb9c0('0x43')]=function(_0x3ca4c7,_0x4c0cc1){return db[_0xb9c0('0x28')][_0xb9c0('0x43')](_0x3ca4c7[_0xb9c0('0x44')],{})[_0xb9c0('0x23')](respondWithResult(_0x4c0cc1,0xc9))[_0xb9c0('0x42')](handleError(_0x4c0cc1,null));};exports[_0xb9c0('0x22')]=function(_0x5b017,_0x19fa0b){if(_0x5b017['body']['id']){delete _0x5b017['body']['id'];}return db[_0xb9c0('0x28')][_0xb9c0('0x41')]({'where':{'id':_0x5b017[_0xb9c0('0x40')]['id']}})[_0xb9c0('0x23')](handleEntityNotFound(_0x19fa0b,null))[_0xb9c0('0x23')](saveUpdates(_0x5b017[_0xb9c0('0x44')],null))[_0xb9c0('0x23')](respondWithResult(_0x19fa0b,null))['catch'](handleError(_0x19fa0b,null));};exports[_0xb9c0('0x45')]=function(_0x2d70b1,_0x19c650){return db[_0xb9c0('0x28')][_0xb9c0('0x41')]({'where':{'id':_0x2d70b1['params']['id']}})[_0xb9c0('0x23')](handleEntityNotFound(_0x19c650,null))[_0xb9c0('0x23')](removeEntity(_0x19c650,null))['catch'](handleError(_0x19c650,null));};exports[_0xb9c0('0x46')]=function(_0x23acd1,_0x14f139){return db[_0xb9c0('0x28')][_0xb9c0('0x46')]()[_0xb9c0('0x23')](respondWithResult(_0x14f139,null))['catch'](handleError(_0x14f139,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 47dc668..8dc491a 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfad3=['../../config/environment','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x1818b3,_0x36cdc4){var _0x5d3707=function(_0x18bf02){while(--_0x18bf02){_0x1818b3['push'](_0x1818b3['shift']());}};_0x5d3707(++_0x36cdc4);}(_0xfad3,0x1d0));var _0x3fad=function(_0x152499,_0x4eefc4){_0x152499=_0x152499-0x0;var _0x2804f2=_0xfad3[_0x152499];return _0x2804f2;};'use strict';var _=require(_0x3fad('0x0'));var util=require('util');var logger=require(_0x3fad('0x1'))(_0x3fad('0x2'));var moment=require(_0x3fad('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fad('0x4'));var rimraf=require(_0x3fad('0x5'));var config=require(_0x3fad('0x6'));var attributes=require(_0x3fad('0x7'));module['exports']=function(_0x1eabd2,_0x640347){return _0x1eabd2['define'](_0x3fad('0x8'),attributes,{'tableName':_0x3fad('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9c1=['exports','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x5e8f4e,_0x52c7c5){var _0x3f7f3c=function(_0x306b27){while(--_0x306b27){_0x5e8f4e['push'](_0x5e8f4e['shift']());}};_0x3f7f3c(++_0x52c7c5);}(_0xd9c1,0x9d));var _0x1d9c=function(_0x587984,_0x1e0af4){_0x587984=_0x587984-0x0;var _0x2172fc=_0xd9c1[_0x587984];return _0x2172fc;};'use strict';var _=require('lodash');var util=require(_0x1d9c('0x0'));var logger=require(_0x1d9c('0x1'))(_0x1d9c('0x2'));var moment=require('moment');var BPromise=require(_0x1d9c('0x3'));var rp=require(_0x1d9c('0x4'));var fs=require('fs');var path=require(_0x1d9c('0x5'));var rimraf=require('rimraf');var config=require(_0x1d9c('0x6'));var attributes=require(_0x1d9c('0x7'));module[_0x1d9c('0x8')]=function(_0xcbd14f,_0x487e41){return _0xcbd14f['define']('WhatsappTransferReport',attributes,{'tableName':_0x1d9c('0x9'),'paranoid':![],'indexes':[{'name':_0x1d9c('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index f22c96a..19ef862 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb7a=['moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x5b92f7,_0x4b95a5){var _0x571fee=function(_0x2c3d80){while(--_0x2c3d80){_0x5b92f7['push'](_0x5b92f7['shift']());}};_0x571fee(++_0x4b95a5);}(_0xfb7a,0xae));var _0xafb7=function(_0x5bb1e9,_0x15f025){_0x5bb1e9=_0x5bb1e9-0x0;var _0x262c24=_0xfb7a[_0x5bb1e9];return _0x262c24;};'use strict';var _=require(_0xafb7('0x0'));var util=require(_0xafb7('0x1'));var moment=require(_0xafb7('0x2'));var BPromise=require(_0xafb7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafb7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xafb7('0x5'));var logger=require('../../config/logger')(_0xafb7('0x6'));var config=require(_0xafb7('0x7'));var jayson=require(_0xafb7('0x8'));var client=jayson[_0xafb7('0x9')][_0xafb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37bfbf,_0x564ae9,_0x224600){return new BPromise(function(_0x3b0782,_0x3363a2){return client['request'](_0x37bfbf,_0x224600)[_0xafb7('0xb')](function(_0x254de9){logger['info'](_0xafb7('0xc'),_0x564ae9,_0xafb7('0xd'));logger[_0xafb7('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x564ae9,_0xafb7('0xd'),JSON[_0xafb7('0xf')](_0x254de9));if(_0x254de9['error']){if(_0x254de9[_0xafb7('0x10')][_0xafb7('0x11')]===0x1f4){logger[_0xafb7('0x10')](_0xafb7('0xc'),_0x564ae9,_0x254de9['error']['message']);return _0x3363a2(_0x254de9[_0xafb7('0x10')]['message']);}logger[_0xafb7('0x10')](_0xafb7('0xc'),_0x564ae9,_0x254de9[_0xafb7('0x10')][_0xafb7('0x12')]);return _0x3b0782(_0x254de9[_0xafb7('0x10')][_0xafb7('0x12')]);}else{logger[_0xafb7('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x564ae9,_0xafb7('0xd'));_0x3b0782(_0x254de9[_0xafb7('0x14')][_0xafb7('0x12')]);}})[_0xafb7('0x15')](function(_0x6d7847){logger[_0xafb7('0x10')](_0xafb7('0xc'),_0x564ae9,_0x6d7847);_0x3363a2(_0x6d7847);});});} \ No newline at end of file +var _0xd2e9=['code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x576be4,_0x7d3752){var _0x11d7ab=function(_0x5deb75){while(--_0x5deb75){_0x576be4['push'](_0x576be4['shift']());}};_0x11d7ab(++_0x7d3752);}(_0xd2e9,0xb7));var _0x9d2e=function(_0x323ff1,_0x20406a){_0x323ff1=_0x323ff1-0x0;var _0x3791da=_0xd2e9[_0x323ff1];return _0x3791da;};'use strict';var _=require(_0x9d2e('0x0'));var util=require('util');var moment=require(_0x9d2e('0x1'));var BPromise=require('bluebird');var rs=require(_0x9d2e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d2e('0x3'))['db'];var utils=require(_0x9d2e('0x4'));var logger=require(_0x9d2e('0x5'))(_0x9d2e('0x6'));var config=require('../../config/environment');var jayson=require(_0x9d2e('0x7'));var client=jayson['client'][_0x9d2e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b9b84,_0x436e6d,_0x219c65){return new BPromise(function(_0x2ce559,_0x4de872){return client['request'](_0x4b9b84,_0x219c65)[_0x9d2e('0x9')](function(_0x3f703c){logger[_0x9d2e('0xa')](_0x9d2e('0xb'),_0x436e6d,'request\x20sent');logger[_0x9d2e('0xc')](_0x9d2e('0xd'),_0x436e6d,_0x9d2e('0xe'),JSON[_0x9d2e('0xf')](_0x3f703c));if(_0x3f703c[_0x9d2e('0x10')]){if(_0x3f703c['error'][_0x9d2e('0x11')]===0x1f4){logger['error'](_0x9d2e('0xb'),_0x436e6d,_0x3f703c['error']['message']);return _0x4de872(_0x3f703c[_0x9d2e('0x10')][_0x9d2e('0x12')]);}logger['error'](_0x9d2e('0xb'),_0x436e6d,_0x3f703c[_0x9d2e('0x10')][_0x9d2e('0x12')]);return _0x2ce559(_0x3f703c[_0x9d2e('0x10')][_0x9d2e('0x12')]);}else{logger[_0x9d2e('0xa')](_0x9d2e('0xb'),_0x436e6d,_0x9d2e('0xe'));_0x2ce559(_0x3f703c['result'][_0x9d2e('0x12')]);}})[_0x9d2e('0x13')](function(_0x1faf84){logger[_0x9d2e('0x10')](_0x9d2e('0xb'),_0x436e6d,_0x1faf84);_0x4de872(_0x1faf84);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index f015d04..6aee7d8 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4553=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','seedDB','then','default','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','join','Offline\x20apps:','status','None','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error'];(function(_0x20e6ab,_0x143770){var _0x488887=function(_0x4e32be){while(--_0x4e32be){_0x20e6ab['push'](_0x20e6ab['shift']());}};_0x488887(++_0x143770);}(_0x4553,0x1be));var _0x3455=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4553[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var db=require(_0x3455('0x0'))['db'];var seedDb=require(_0x3455('0x1'));var checkLicense=require(_0x3455('0x2'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x3455('0x3'))(_0x3455('0x4'));var pm2=require(_0x3455('0x5'));var pm2Config=require(_0x3455('0x6'));var schedule=require(_0x3455('0x7'));var chat=require(_0x3455('0x8'));var whatsapp=require(_0x3455('0x9'));var transcribe=require(_0x3455('0xa'));var provider=require(_0x3455('0xb'));function main(){return db['sequelize'][_0x3455('0xc')]()['then'](function(){if(config[_0x3455('0xd')]){return seedDb['default']();}})[_0x3455('0xe')](function(){return checkLicense[_0x3455('0xf')]();})[_0x3455('0xe')](function(){return rpc['listen']();})['then'](function(_0x2a0338){logger[_0x3455('0x10')](_0x2a0338);return chat[_0x3455('0x11')]();})[_0x3455('0xe')](function(){return whatsapp[_0x3455('0x11')]();})[_0x3455('0xe')](function(){return schedule[_0x3455('0x11')]();})[_0x3455('0xe')](function(){return transcribe[_0x3455('0x11')]();})[_0x3455('0xe')](function(){return provider[_0x3455('0x11')]();})[_0x3455('0xe')](function(_0x14b8f6){logger[_0x3455('0x10')](_0x14b8f6);return pm2[_0x3455('0x11')](pm2Config);})[_0x3455('0xe')](function(_0x3856f7){var _0x5168a3=_0x3856f7[_0x3455('0x12')](function(_0x31f2ac){return typeof _0x31f2ac[_0x3455('0x13')]===_0x3455('0x14')&&_0x31f2ac[_0x3455('0x13')]>=0x0;});if(_0x5168a3[_0x3455('0x15')]>0x0){throw new Error(_0x5168a3['length']+_0x3455('0x16')+_[_0x3455('0x17')](_0x5168a3,function(_0x147e95){return'\x22'+_0x147e95[_0x3455('0x18')][_0x3455('0x19')]+'\x22';}));}logger[_0x3455('0x10')]('Online\x20apps:',_[_0x3455('0x17')](_['filter'](_0x3856f7,{'status':_0x3455('0x1a')}),_0x3455('0x19'))[_0x3455('0x1b')]());logger[_0x3455('0x10')](_0x3455('0x1c'),_[_0x3455('0x17')](_[_0x3455('0x12')](_0x3856f7,function(_0x34d2ee){return _0x34d2ee[_0x3455('0x1d')]!=='online';}),_0x3455('0x19'))[_0x3455('0x1b')]()||_0x3455('0x1e'));console['log'](_0x3455('0x1f'));})[_0x3455('0x20')](function(_0x5a4535){console['log'](_0x3455('0x21'),_0x5a4535);logger[_0x3455('0x22')](_0x3455('0x23'),_0x5a4535);process[_0x3455('0x24')](0x1);});}main(); \ No newline at end of file +var _0x91c6=['Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','start','info','filter','exitCode','number','length','map','pm2_env','name','status','online','join','None','App\x20Ready!'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x91c6,0xf9));var _0x691c=function(_0x1126ec,_0x3a2940){_0x1126ec=_0x1126ec-0x0;var _0x148a03=_0x91c6[_0x1126ec];return _0x148a03;};'use strict';var _=require(_0x691c('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x691c('0x1'));var rpc=require(_0x691c('0x2'));var config=require(_0x691c('0x3'));var logger=require(_0x691c('0x4'))(_0x691c('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x691c('0x6'));var schedule=require(_0x691c('0x7'));var chat=require(_0x691c('0x8'));var whatsapp=require(_0x691c('0x9'));var transcribe=require(_0x691c('0xa'));var provider=require(_0x691c('0xb'));function main(){return db['sequelize'][_0x691c('0xc')]()[_0x691c('0xd')](function(){if(config[_0x691c('0xe')]){return seedDb[_0x691c('0xf')]();}})['then'](function(){return checkLicense[_0x691c('0xf')]();})[_0x691c('0xd')](function(){return rpc[_0x691c('0x10')]();})['then'](function(_0x4bf36c){logger['info'](_0x4bf36c);return chat[_0x691c('0x11')]();})[_0x691c('0xd')](function(){return whatsapp[_0x691c('0x11')]();})[_0x691c('0xd')](function(){return schedule['start']();})['then'](function(){return transcribe[_0x691c('0x11')]();})[_0x691c('0xd')](function(){return provider[_0x691c('0x11')]();})[_0x691c('0xd')](function(_0x2baaa5){logger[_0x691c('0x12')](_0x2baaa5);return pm2[_0x691c('0x11')](pm2Config);})[_0x691c('0xd')](function(_0x5416e4){var _0x232b6a=_0x5416e4[_0x691c('0x13')](function(_0x257d9c){return typeof _0x257d9c[_0x691c('0x14')]===_0x691c('0x15')&&_0x257d9c[_0x691c('0x14')]>=0x0;});if(_0x232b6a[_0x691c('0x16')]>0x0){throw new Error(_0x232b6a[_0x691c('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x691c('0x17')](_0x232b6a,function(_0x1b4cf0){return'\x22'+_0x1b4cf0[_0x691c('0x18')][_0x691c('0x19')]+'\x22';}));}logger[_0x691c('0x12')]('Online\x20apps:',_[_0x691c('0x17')](_[_0x691c('0x13')](_0x5416e4,{'status':'online'}),'name')['join']());logger[_0x691c('0x12')]('Offline\x20apps:',_[_0x691c('0x17')](_['filter'](_0x5416e4,function(_0x49d816){return _0x49d816[_0x691c('0x1a')]!==_0x691c('0x1b');}),_0x691c('0x19'))[_0x691c('0x1c')]()||_0x691c('0x1d'));console['log'](_0x691c('0x1e'));})['catch'](function(_0x1f3844){console['log'](_0x691c('0x1f'),_0x1f3844);logger[_0x691c('0x20')](_0x691c('0x21'),_0x1f3844);process[_0x691c('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 80cb584..7ab5a2e 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ede=['now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','session','role','internal','email','userpic','permissions','chatPause','mailPause','openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','settingsEnabled','downloadVoiceRecordings','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','then','closed','query','status','unmanaged','json','Unmanaged.','headers','authorization','startsWith','find','name','authenticate','catch','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','encryptString','join','promisify','sign','secret','secrets','payload','verify','randomBytes','floor'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0ede,0x103));var _0xe0ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ede[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0xe0ed('0x0'))['db'];var config=require(_0xe0ed('0x1'));var hardwareConf=require(_0xe0ed('0x2'));var licenseUtil=require(_0xe0ed('0x3'));var encryptor=require(_0xe0ed('0x4'));var _=require('lodash');var jwt=require(_0xe0ed('0x5'));var expressJwt=require(_0xe0ed('0x6'));var compose=require(_0xe0ed('0x7'));var basicAuth=require(_0xe0ed('0x8'));var crypto=require('crypto');var BPromise=require(_0xe0ed('0x9'));var util=require(_0xe0ed('0xa'));var moment=require(_0xe0ed('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0xe0ed('0xc')]});var userAttributes=['id',_0xe0ed('0xd'),'fullname','name',_0xe0ed('0xe'),_0xe0ed('0xf'),_0xe0ed('0x10'),_0xe0ed('0x11'),'md5secret','voicePause',_0xe0ed('0x12'),_0xe0ed('0x13'),'faxPause','smsPause',_0xe0ed('0x14'),'pauseType','showWebBar',_0xe0ed('0x15'),_0xe0ed('0x16'),_0xe0ed('0x17'),_0xe0ed('0x18'),'passwordResetAt',_0xe0ed('0x19'),_0xe0ed('0x1a'),_0xe0ed('0x1b'),_0xe0ed('0x1c'),_0xe0ed('0x1d'),_0xe0ed('0x1e'),_0xe0ed('0x1f'),_0xe0ed('0x20'),_0xe0ed('0x21'),_0xe0ed('0x22'),'phoneBarRemoteControlPort',_0xe0ed('0x23'),_0xe0ed('0x24'),'userProfileId','privacyEnabled',_0xe0ed('0x25'),'wssPort',_0xe0ed('0x26'),'downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls',_0xe0ed('0x27'),_0xe0ed('0x28'),_0xe0ed('0x29'),_0xe0ed('0x2a'),_0xe0ed('0x2b'),_0xe0ed('0x2c'),'smsAutoanswerDelay',_0xe0ed('0x2d'),'openchannelAutoanswerDelay',_0xe0ed('0x2e'),'faxAutoanswerDelay',_0xe0ed('0x2f'),_0xe0ed('0x30'),_0xe0ed('0x31')];exports[_0xe0ed('0x32')]=function(){return this[_0xe0ed('0x33')](!![])[_0xe0ed('0x34')](function(_0xf1629c,_0x96e787,_0x1cce65){if(_0xf1629c[_0xe0ed('0x35')]){_0x1cce65();}else{return db['ChatInteraction'][_0xe0ed('0x36')]({'where':{'id':_0xf1629c['params']['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xe0ed('0x37')](function(_0x52e4ac){if(_0x52e4ac&&_0x52e4ac[_0xe0ed('0x38')]&&!_0xf1629c[_0xe0ed('0x39')]['forceDownload']){return _0x96e787[_0xe0ed('0x3a')](_0x52e4ac['disposition']===_0xe0ed('0x3b')?0x195:0x193)[_0xe0ed('0x3c')]({'message':_0x52e4ac['disposition']==='unmanaged'?_0xe0ed('0x3d'):'Forbidden.'});}else{_0x1cce65();}})['catch'](function(_0x24f9a0){_0x1cce65(_0x24f9a0);});}});};exports[_0xe0ed('0x33')]=function isAuthenticated(_0x18fa02){return compose()['use'](function(_0x358b93,_0x5ed481,_0x8798f6){var _0x10c51b;if(_0x358b93[_0xe0ed('0x3e')][_0xe0ed('0x3f')]){if(_[_0xe0ed('0x40')](_0x358b93[_0xe0ed('0x3e')]['authorization'],'Basic')){var _0x48da14=basicAuth(_0x358b93);db['User'][_0xe0ed('0x41')]({'where':{'name':_0x48da14[_0xe0ed('0x42')]}})[_0xe0ed('0x37')](function(_0x188807){if(!_0x188807||!_0x188807[_0xe0ed('0x43')](_0x48da14['pass'])){return _0x5ed481[_0xe0ed('0x3a')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x358b93[_0xe0ed('0x35')]={'id':_0x188807['id']};_0x8798f6();})[_0xe0ed('0x44')](function(_0x1cba03){_0x8798f6(_0x1cba03);});}else if(_[_0xe0ed('0x40')](_0x358b93[_0xe0ed('0x3e')][_0xe0ed('0x3f')],_0xe0ed('0x45'))){validateJwt(_0x358b93,_0x5ed481,_0x8798f6);}else{if(_0x18fa02){_0x8798f6();}else{return _0x5ed481['status'](0x193)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x46')});}}}else if(_0x358b93[_0xe0ed('0x39')][_0xe0ed('0x47')]){try{var _0x556291={'audience':hardwareConf[_0xe0ed('0x48')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x358b93[_0xe0ed('0x39')][_0xe0ed('0x47')],_0x556291)['then'](function(_0x39ab7d){return db[_0xe0ed('0x49')]['find']({'where':{'id':_0x39ab7d[_0xe0ed('0x4a')]}})[_0xe0ed('0x37')](function(_0xf404b7){_0x10c51b=_0xf404b7;return db[_0xe0ed('0x4b')][_0xe0ed('0x36')]({'where':{'id':0x1},'attributes':[_0xe0ed('0x4c'),_0xe0ed('0x4d')],'raw':!![]});})[_0xe0ed('0x37')](function(_0x216a30){if(!_0x10c51b||!_['isEqual'](_0x10c51b[_0xe0ed('0x4e')],_0x39ab7d['nonce'])){return _0x5ed481[_0xe0ed('0x3a')](0x191)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x4f')});}if(_0x10c51b[_0xe0ed('0x50')]){return _0x5ed481[_0xe0ed('0x3a')](0x191)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x51')});}if(_0x10c51b['blocked']){if(_0x216a30['blockDuration']>0x0){if(moment(_0x10c51b[_0xe0ed('0x52')])[_0xe0ed('0x53')](_0x216a30['blockDuration'],_0xe0ed('0x54'))>moment()){return _0x5ed481[_0xe0ed('0x3a')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5ed481[_0xe0ed('0x3a')](0x191)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x51')});}}_0x358b93['user']={'id':_0x10c51b['id']};_0x8798f6();});})[_0xe0ed('0x44')](function(){return _0x5ed481[_0xe0ed('0x3a')](0x191)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x51')});});}catch(_0x391b01){_0x8798f6(_0x391b01);}}else if(_0x18fa02){_0x8798f6();}else{return _0x5ed481['status'](0x193)[_0xe0ed('0x3c')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x48bfca,_0xe37602,_0x3121c2){if(_0x48bfca[_0xe0ed('0x35')]){db['User'][_0xe0ed('0x41')]({'where':{'id':_0x48bfca[_0xe0ed('0x35')]['id']},'attributes':userAttributes})[_0xe0ed('0x37')](function(_0x1f6832){if(!_0x1f6832){return _0xe37602[_0xe0ed('0x3a')](0x194)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x55')});}_0x48bfca[_0xe0ed('0x35')]=_0x1f6832;_0x3121c2();})[_0xe0ed('0x44')](function(_0x1e18fa){_0x3121c2(_0x1e18fa);});}else if(_0x18fa02){_0x3121c2();}else{return _0xe37602[_0xe0ed('0x3a')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xe0ed('0x56')]=function canUpdate(){return compose()['use'](function(_0x2a4bca,_0x5b2771,_0x2b8eec){return licenseUtil[_0xe0ed('0x57')]()[_0xe0ed('0x37')](function(_0x508907){if(_0x508907[_0xe0ed('0x58')]){_0x2b8eec();}else{return _0x5b2771[_0xe0ed('0x3a')](0x193)[_0xe0ed('0x3c')]({'message':'Forbidden'});}})[_0xe0ed('0x44')](function(_0x483619){_0x2b8eec(_0x483619);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xe0ed('0x34')](function(_0x29e36e,_0x348a84,_0x19d781){return licenseUtil[_0xe0ed('0x57')]()[_0xe0ed('0x37')](function(_0x26d66a){if(_0x26d66a['webrtc']){_0x19d781();}else{return _0x348a84['status'](0x193)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x59')});}})[_0xe0ed('0x44')](function(_0x51169c){_0x19d781(_0x51169c);});});};exports[_0xe0ed('0x5a')]=function(_0x5743cd,_0x45c009,_0x3f0677){_0x5743cd[_0xe0ed('0x5a')]=!![];return _0x3f0677();};exports['signToken']=function signToken(_0x5bd24e){return signJwt(_0x5bd24e);};exports[_0xe0ed('0x5b')]=function(_0x1831fd,_0x5b69ef){if(!_0x1831fd[_0xe0ed('0x35')]){return _0x5b69ef['status'](0x194)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x5c')});}var _0x396d5a={'payload':{'id':_0x1831fd['user']['id'],'role':_0x1831fd[_0xe0ed('0x35')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x396d5a)[_0xe0ed('0x37')](function(_0x360510){_0x5b69ef[_0xe0ed('0x5d')](_0xe0ed('0x5e'),_0x360510);_0x5b69ef[_0xe0ed('0x5f')](_0xe0ed('0x60'));})['catch'](function(_0xff4bf6){return _0x5b69ef[_0xe0ed('0x3a')](0x1f4)[_0xe0ed('0x61')](_0xff4bf6);});};exports[_0xe0ed('0x62')]=function(_0x551aa6){if(_[_0xe0ed('0x63')](_0x551aa6[_0xe0ed('0x4e')])||_['isNil'](_0x551aa6[_0xe0ed('0x64')])){return null;}else{return createJwt(_0x551aa6);}};exports[_0xe0ed('0x65')]=function(_0x473c5d){_0x473c5d['apiKeyNonce']=generateNonce();_0x473c5d[_0xe0ed('0x64')]=generateIssuedAt();return createJwt(_0x473c5d);};exports['regenerateApiKey']=function(_0x58140f,_0x3df87d){var _0x22b505=_0x58140f['query'][_0xe0ed('0x47')];if(_0x22b505){var _0x3c44b9={'nonce':_0x3df87d[_0xe0ed('0x4e')],'iat':_0x3df87d[_0xe0ed('0x64')],'audience':hardwareConf[_0xe0ed('0x48')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x22b505,_0x3c44b9)[_0xe0ed('0x37')](function(){return generateApiKey(_0x3df87d);});}else{throw{'message':_0xe0ed('0x66')};}};exports[_0xe0ed('0x67')]=function(_0x46c17e){var _0x3670c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3670c9[_0xe0ed('0x68')](_0x46c17e))throw new db[(_0xe0ed('0x69'))][(_0xe0ed('0x6a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xe0ed('0x6b')]=function(_0x101ba6,_0x241218,_0xbbe3a){var _0x123bf0=encryptor['decryptString'](_0x241218)[_0xe0ed('0x6c')](',');for(var _0x8b0c16=0x0;_0x8b0c16<_0xbbe3a;_0x8b0c16++){if(!_0x123bf0[_0x8b0c16])break;if(_0x101ba6[_0xe0ed('0x6d')]()===_0x123bf0[_0x8b0c16][_0xe0ed('0x6d')]()){var _0x82df84=util[_0xe0ed('0x6e')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xbbe3a);if(_0xbbe3a===0x1){_0x82df84=_0xe0ed('0x6f');}throw new db[(_0xe0ed('0x69'))][(_0xe0ed('0x6a'))](_0x82df84);}}return;};exports[_0xe0ed('0x70')]=function(_0x3be7a4,_0x203882){var _0x593502=_0x203882?encryptor[_0xe0ed('0x71')](_0x203882)[_0xe0ed('0x6c')](','):[];if(_0x593502[_0xe0ed('0x72')]===0x5){_0x593502['splice'](-0x1,0x1);}_0x593502['unshift'](_0x3be7a4);return encryptor[_0xe0ed('0x73')](_0x593502[_0xe0ed('0x74')](','));};function signJwt(_0x217cb8){var _0x26989b=BPromise[_0xe0ed('0x75')](jwt[_0xe0ed('0x76')],{'context':jwt});var _0x34422f=_0x217cb8[_0xe0ed('0x77')]||config[_0xe0ed('0x78')][_0xe0ed('0xc')];return new BPromise(function(_0x10b978,_0x2be48e){_0x26989b(_0x217cb8[_0xe0ed('0x79')],_0x34422f,_0x217cb8['options'])[_0xe0ed('0x37')](function(_0x108d8b){_0x10b978(_0x108d8b);})[_0xe0ed('0x44')](function(_0x4f1460){_0x2be48e(_0x4f1460);});});}function verifyJwt(_0x437304,_0x35a95c,_0x214025){var _0x1017a5=BPromise[_0xe0ed('0x75')](jwt[_0xe0ed('0x7a')],{'context':jwt});var _0x32e19b=_0x214025||config[_0xe0ed('0x78')][_0xe0ed('0xc')];return new BPromise(function(_0x385de1,_0x29035f){_0x1017a5(_0x437304,_0x32e19b,_0x35a95c)[_0xe0ed('0x37')](function(_0x2bed8d){_0x385de1(_0x2bed8d);})[_0xe0ed('0x44')](function(_0x587487){_0x29035f(_0x587487);});});}function generateNonce(){return crypto[_0xe0ed('0x7b')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0xe0ed('0x7c')](Date[_0xe0ed('0x7d')]()/0x3e8)[_0xe0ed('0x7e')]();}function createJwt(_0x463630){var _0x13bc1c={'payload':{'iat':_0x463630[_0xe0ed('0x64')],'nonce':_0x463630[_0xe0ed('0x4e')]},'options':{'algorithm':_0xe0ed('0x7f'),'subject':_0x463630['id'][_0xe0ed('0x7e')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x13bc1c)['then'](function(_0x1e458d){return{'iat':_0x463630['apiKeyIat'],'nonce':_0x463630[_0xe0ed('0x4e')],'token':_0x1e458d};});} \ No newline at end of file +var _0x1038=['smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','query','forceDownload','status','unmanaged','json','Forbidden.','catch','headers','authorization','startsWith','find','name','Wrong\x20credentials.','apikey','getUuid','then','User','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','blocked','blockDuration','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','join','promisify','secret','secrets','payload','verify','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','crypto','bluebird','util','moment','session','role','fullname','internal','userpic','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x1038,0xe9));var _0x8103=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0x1038[_0x4695ba];return _0x524b7d;};'use strict';var db=require(_0x8103('0x0'))['db'];var config=require(_0x8103('0x1'));var hardwareConf=require(_0x8103('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x8103('0x3'));var jwt=require(_0x8103('0x4'));var expressJwt=require(_0x8103('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x8103('0x6'));var BPromise=require(_0x8103('0x7'));var util=require(_0x8103('0x8'));var moment=require(_0x8103('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x8103('0xa')]});var userAttributes=['id',_0x8103('0xb'),_0x8103('0xc'),'name',_0x8103('0xd'),'email',_0x8103('0xe'),'permissions','md5secret','voicePause',_0x8103('0xf'),_0x8103('0x10'),_0x8103('0x11'),_0x8103('0x12'),_0x8103('0x13'),_0x8103('0x14'),_0x8103('0x15'),_0x8103('0x16'),_0x8103('0x17'),_0x8103('0x18'),_0x8103('0x19'),_0x8103('0x1a'),_0x8103('0x1b'),_0x8103('0x1c'),'phoneBarAutoAnswerDelay',_0x8103('0x1d'),'phoneBarEnableRecording',_0x8103('0x1e'),_0x8103('0x1f'),_0x8103('0x20'),'phoneBarPrefixRequired',_0x8103('0x21'),_0x8103('0x22'),_0x8103('0x23'),_0x8103('0x24'),'userProfileId',_0x8103('0x25'),_0x8103('0x26'),_0x8103('0x27'),_0x8103('0x28'),'downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls',_0x8103('0x29'),_0x8103('0x2a'),_0x8103('0x2b'),_0x8103('0x2c'),'emailAutoanswerDelay',_0x8103('0x2d'),_0x8103('0x2e'),_0x8103('0x2f'),_0x8103('0x30'),_0x8103('0x31'),_0x8103('0x32'),_0x8103('0x33'),_0x8103('0x34'),_0x8103('0x35')];exports[_0x8103('0x36')]=function(){return this[_0x8103('0x37')](!![])[_0x8103('0x38')](function(_0x1e6e50,_0x2145f3,_0x31d13e){if(_0x1e6e50[_0x8103('0x39')]){_0x31d13e();}else{return db[_0x8103('0x3a')][_0x8103('0x3b')]({'where':{'id':_0x1e6e50[_0x8103('0x3c')]['id']},'attributes':['id',_0x8103('0x3d'),_0x8103('0x3e')],'raw':!![]})['then'](function(_0x268d21){if(_0x268d21&&_0x268d21[_0x8103('0x3d')]&&!_0x1e6e50[_0x8103('0x3f')][_0x8103('0x40')]){return _0x2145f3[_0x8103('0x41')](_0x268d21[_0x8103('0x3e')]===_0x8103('0x42')?0x195:0x193)[_0x8103('0x43')]({'message':_0x268d21[_0x8103('0x3e')]===_0x8103('0x42')?'Unmanaged.':_0x8103('0x44')});}else{_0x31d13e();}})[_0x8103('0x45')](function(_0x5822f8){_0x31d13e(_0x5822f8);});}});};exports[_0x8103('0x37')]=function isAuthenticated(_0xc2abf3){return compose()['use'](function(_0x3f2314,_0x19cfbf,_0x56e217){var _0x299e01;if(_0x3f2314[_0x8103('0x46')][_0x8103('0x47')]){if(_[_0x8103('0x48')](_0x3f2314[_0x8103('0x46')]['authorization'],'Basic')){var _0x3e160f=basicAuth(_0x3f2314);db['User'][_0x8103('0x49')]({'where':{'name':_0x3e160f[_0x8103('0x4a')]}})['then'](function(_0x1d2999){if(!_0x1d2999||!_0x1d2999['authenticate'](_0x3e160f['pass'])){return _0x19cfbf[_0x8103('0x41')](0x191)[_0x8103('0x43')]({'message':_0x8103('0x4b')});}_0x3f2314[_0x8103('0x39')]={'id':_0x1d2999['id']};_0x56e217();})[_0x8103('0x45')](function(_0x3201d0){_0x56e217(_0x3201d0);});}else if(_[_0x8103('0x48')](_0x3f2314['headers'][_0x8103('0x47')],'Bearer')){validateJwt(_0x3f2314,_0x19cfbf,_0x56e217);}else{if(_0xc2abf3){_0x56e217();}else{return _0x19cfbf[_0x8103('0x41')](0x193)[_0x8103('0x43')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3f2314[_0x8103('0x3f')][_0x8103('0x4c')]){try{var _0x578796={'audience':hardwareConf[_0x8103('0x4d')](),'issuer':hardwareConf[_0x8103('0x4d')]()};verifyJwt(_0x3f2314['query'][_0x8103('0x4c')],_0x578796)[_0x8103('0x4e')](function(_0xeeadad){return db[_0x8103('0x4f')]['find']({'where':{'id':_0xeeadad[_0x8103('0x50')]}})['then'](function(_0x139c2a){_0x299e01=_0x139c2a;return db[_0x8103('0x51')][_0x8103('0x3b')]({'where':{'id':0x1},'attributes':[_0x8103('0x52'),'blockDuration'],'raw':!![]});})['then'](function(_0x17f4d9){if(!_0x299e01||!_[_0x8103('0x53')](_0x299e01[_0x8103('0x54')],_0xeeadad[_0x8103('0x55')])){return _0x19cfbf['status'](0x191)[_0x8103('0x43')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x299e01[_0x8103('0x56')]){return _0x19cfbf['status'](0x191)[_0x8103('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x299e01[_0x8103('0x57')]){if(_0x17f4d9[_0x8103('0x58')]>0x0){if(moment(_0x299e01[_0x8103('0x59')])[_0x8103('0x5a')](_0x17f4d9[_0x8103('0x58')],_0x8103('0x5b'))>moment()){return _0x19cfbf['status'](0x191)['json']({'message':_0x8103('0x5c')});}}else{return _0x19cfbf['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x3f2314[_0x8103('0x39')]={'id':_0x299e01['id']};_0x56e217();});})[_0x8103('0x45')](function(){return _0x19cfbf[_0x8103('0x41')](0x191)['json']({'message':_0x8103('0x5c')});});}catch(_0x5ac9f7){_0x56e217(_0x5ac9f7);}}else if(_0xc2abf3){_0x56e217();}else{return _0x19cfbf[_0x8103('0x41')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x8103('0x38')](function(_0x5a5bcf,_0x114f00,_0x5bf29a){if(_0x5a5bcf[_0x8103('0x39')]){db[_0x8103('0x4f')][_0x8103('0x49')]({'where':{'id':_0x5a5bcf[_0x8103('0x39')]['id']},'attributes':userAttributes})[_0x8103('0x4e')](function(_0x4f0865){if(!_0x4f0865){return _0x114f00[_0x8103('0x41')](0x194)[_0x8103('0x43')]({'message':_0x8103('0x5d')});}_0x5a5bcf[_0x8103('0x39')]=_0x4f0865;_0x5bf29a();})[_0x8103('0x45')](function(_0x2a40df){_0x5bf29a(_0x2a40df);});}else if(_0xc2abf3){_0x5bf29a();}else{return _0x114f00[_0x8103('0x41')](0x194)[_0x8103('0x43')]({'message':_0x8103('0x5e')});}});};exports[_0x8103('0x5f')]=function canUpdate(){return compose()['use'](function(_0x1138b7,_0x4ba69e,_0x24b89a){return licenseUtil['getLicense']()[_0x8103('0x4e')](function(_0x5c033b){if(_0x5c033b[_0x8103('0x60')]){_0x24b89a();}else{return _0x4ba69e[_0x8103('0x41')](0x193)[_0x8103('0x43')]({'message':_0x8103('0x61')});}})[_0x8103('0x45')](function(_0x2b72ad){_0x24b89a(_0x2b72ad);});});};exports[_0x8103('0x62')]=function isWebrtcLicence(){return compose()[_0x8103('0x38')](function(_0x8a66c7,_0x16c521,_0x2c6062){return licenseUtil['getLicense']()['then'](function(_0x2e150a){if(_0x2e150a['webrtc']){_0x2c6062();}else{return _0x16c521[_0x8103('0x41')](0x193)['json']({'message':_0x8103('0x61')});}})[_0x8103('0x45')](function(_0x49aeb3){_0x2c6062(_0x49aeb3);});});};exports[_0x8103('0x63')]=function(_0x3d1d4f,_0x19e6ad,_0x1a6ca8){_0x3d1d4f[_0x8103('0x63')]=!![];return _0x1a6ca8();};exports['signToken']=function signToken(_0x287485){return signJwt(_0x287485);};exports[_0x8103('0x64')]=function(_0x1b8820,_0x51eae3){if(!_0x1b8820['user']){return _0x51eae3[_0x8103('0x41')](0x194)[_0x8103('0x43')]({'message':_0x8103('0x65')});}var _0x159310={'payload':{'id':_0x1b8820[_0x8103('0x39')]['id'],'role':_0x1b8820[_0x8103('0x39')][_0x8103('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x159310)[_0x8103('0x4e')](function(_0x9cdfb1){_0x51eae3[_0x8103('0x66')](_0x8103('0x67'),_0x9cdfb1);_0x51eae3[_0x8103('0x68')](_0x8103('0x69'));})[_0x8103('0x45')](function(_0x396b6d){return _0x51eae3[_0x8103('0x41')](0x1f4)[_0x8103('0x6a')](_0x396b6d);});};exports[_0x8103('0x6b')]=function(_0x508c9f){if(_[_0x8103('0x6c')](_0x508c9f[_0x8103('0x54')])||_['isNil'](_0x508c9f[_0x8103('0x6d')])){return null;}else{return createJwt(_0x508c9f);}};exports[_0x8103('0x6e')]=function(_0x496992){_0x496992[_0x8103('0x54')]=generateNonce();_0x496992[_0x8103('0x6d')]=generateIssuedAt();return createJwt(_0x496992);};exports[_0x8103('0x6f')]=function(_0x55d114,_0x125725){var _0x452e4d=_0x55d114[_0x8103('0x3f')][_0x8103('0x4c')];if(_0x452e4d){var _0x1c00cc={'nonce':_0x125725['apiKeyNonce'],'iat':_0x125725[_0x8103('0x6d')],'audience':hardwareConf[_0x8103('0x4d')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x452e4d,_0x1c00cc)[_0x8103('0x4e')](function(){return generateApiKey(_0x125725);});}else{throw{'message':_0x8103('0x70')};}};exports[_0x8103('0x71')]=function(_0x2c6736){var _0x467706=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x467706[_0x8103('0x72')](_0x2c6736))throw new db['Sequelize'][(_0x8103('0x73'))](_0x8103('0x74'));return;};exports[_0x8103('0x75')]=function(_0x10171d,_0x5addf9,_0x230454){var _0x2280b5=encryptor[_0x8103('0x76')](_0x5addf9)[_0x8103('0x77')](',');for(var _0x28cc97=0x0;_0x28cc97<_0x230454;_0x28cc97++){if(!_0x2280b5[_0x28cc97])break;if(_0x10171d[_0x8103('0x78')]()===_0x2280b5[_0x28cc97]['toLowerCase']()){var _0x21bc12=util['format'](_0x8103('0x79'),_0x230454);if(_0x230454===0x1){_0x21bc12=_0x8103('0x7a');}throw new db[(_0x8103('0x7b'))]['ValidationError'](_0x21bc12);}}return;};exports[_0x8103('0x7c')]=function(_0x7906eb,_0x5770ad){var _0x476b61=_0x5770ad?encryptor['decryptString'](_0x5770ad)[_0x8103('0x77')](','):[];if(_0x476b61[_0x8103('0x7d')]===0x5){_0x476b61[_0x8103('0x7e')](-0x1,0x1);}_0x476b61[_0x8103('0x7f')](_0x7906eb);return encryptor['encryptString'](_0x476b61[_0x8103('0x80')](','));};function signJwt(_0x5b8934){var _0x35c8e6=BPromise[_0x8103('0x81')](jwt['sign'],{'context':jwt});var _0x5eff52=_0x5b8934[_0x8103('0x82')]||config[_0x8103('0x83')]['session'];return new BPromise(function(_0x44c6cc,_0x5c3dab){_0x35c8e6(_0x5b8934[_0x8103('0x84')],_0x5eff52,_0x5b8934['options'])[_0x8103('0x4e')](function(_0x315e70){_0x44c6cc(_0x315e70);})[_0x8103('0x45')](function(_0x2df617){_0x5c3dab(_0x2df617);});});}function verifyJwt(_0x3677db,_0x36d36b,_0x544815){var _0x2a27e3=BPromise[_0x8103('0x81')](jwt[_0x8103('0x85')],{'context':jwt});var _0x3d7a1c=_0x544815||config[_0x8103('0x83')]['session'];return new BPromise(function(_0x2e0829,_0x546105){_0x2a27e3(_0x3677db,_0x3d7a1c,_0x36d36b)[_0x8103('0x4e')](function(_0x4ea2b2){_0x2e0829(_0x4ea2b2);})[_0x8103('0x45')](function(_0xbd3d54){_0x546105(_0xbd3d54);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x8103('0x86')](_0x8103('0x87'));}function generateIssuedAt(){return Math[_0x8103('0x88')](Date[_0x8103('0x89')]()/0x3e8)['toString']();}function createJwt(_0x51904b){var _0x2f0470={'payload':{'iat':_0x51904b['apiKeyIat'],'nonce':_0x51904b['apiKeyNonce']},'options':{'algorithm':_0x8103('0x8a'),'subject':_0x51904b['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x8103('0x4d')]()}};return signJwt(_0x2f0470)[_0x8103('0x4e')](function(_0x4a69d3){return{'iat':_0x51904b[_0x8103('0x6d')],'nonce':_0x51904b['apiKeyNonce'],'token':_0x4a69d3};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 0c0a644..edd84b5 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f2d=['User','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','keys','startsWith','cf_','map','findOne','all','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','default','fields','where','filter','user','clause','skip','ids','tag','countFilteredContacts','count'];(function(_0x193ae5,_0x566d2b){var _0x1a134c=function(_0x414b1c){while(--_0x414b1c){_0x193ae5['push'](_0x193ae5['shift']());}};_0x1a134c(++_0x566d2b);}(_0x0f2d,0x149));var _0xd0f2=function(_0x4def5b,_0x108fea){_0x4def5b=_0x4def5b-0x0;var _0x899c0e=_0x0f2d[_0x4def5b];return _0x899c0e;};'use strict';var _=require(_0xd0f2('0x0'));var sqlUtils=require(_0xd0f2('0x1'));var db=require(_0xd0f2('0x2'))['db'];exports[_0xd0f2('0x3')]=function(_0x412069,_0x2e5fd8,_0x54ff57,_0xb2dd12){var _0x3bfc4a={'count':0x0,'rows':[]};var _0x412e2f=sqlUtils['skipContactsQuery'](_0x2e5fd8,_0x412069);if(_0x412e2f){return Promise[_0xd0f2('0x4')](_0x3bfc4a);}var _0x374829=sqlUtils[_0xd0f2('0x5')]();var _0x4ee4e6={};var _0x2650d5=![];var _0x195637=![];return Promise[_0xd0f2('0x4')]()['then'](function(){if(_0x412069[_0xd0f2('0x6')]){return sqlUtils[_0xd0f2('0x7')](_0x412069[_0xd0f2('0x6')],_0xb2dd12);}else{return sqlUtils[_0xd0f2('0x8')](_0x412069,_0xb2dd12);}})[_0xd0f2('0x9')](function(_0x1b64bb){_0x374829['where'](_0x1b64bb[_0xd0f2('0xa')]);_0x374829['where'](_0x1b64bb[_0xd0f2('0xb')]);_0x374829[_0xd0f2('0xc')](_0x1b64bb[_0xd0f2('0xd')]);_0x374829[_0xd0f2('0xc')](_0x1b64bb[_0xd0f2('0xe')][_0xd0f2('0xf')]);_0x4ee4e6=_0x1b64bb['tags'];_0x195637=_0x1b64bb[_0xd0f2('0xe')][_0xd0f2('0x10')];return sqlUtils['checkListsRestrictions'](_0x2e5fd8,_0x412069,_0x195637);})[_0xd0f2('0x9')](function(_0x3b9b2c){_0x374829[_0xd0f2('0xc')](_0x3b9b2c);var _0x30987d=_0x412069[_0xd0f2('0x6')]?_0x4ee4e6[_0xd0f2('0x11')]:_0x412069[_0xd0f2('0x12')];_0x2650d5=_0x30987d?!![]:![];return sqlUtils[_0xd0f2('0x13')](_0x374829,_0x30987d);})[_0xd0f2('0x9')](function(_0x4ed407){_0x3bfc4a[_0xd0f2('0x14')]=_0x4ed407;if(_0x3bfc4a[_0xd0f2('0x14')]===0x0){return;}if(_0x412069[_0xd0f2('0x15')]){_0x195637=!![];}return sqlUtils[_0xd0f2('0x16')](_0x374829,_0x412069[_0xd0f2('0xb')],_0x54ff57,_0x2650d5,_0x4ee4e6[_0xd0f2('0xf')],_0x195637);})[_0xd0f2('0x9')](function(_0x19e987){if(!_0x19e987){return[];}return sqlUtils[_0xd0f2('0x17')](_0x19e987,_0x412069,_0x54ff57);})[_0xd0f2('0x9')](function(_0x1bb418){_0x3bfc4a[_0xd0f2('0x18')]=_0x1bb418;return _0x3bfc4a;})[_0xd0f2('0x19')](function(_0x378d7f){throw _0x378d7f;});};exports['describe']=function(){var _0x5e07cd={};var _0x273983=[];return db[_0xd0f2('0x1a')]['describe']()[_0xd0f2('0x9')](function(_0x3e3e39){_0x5e07cd=_0x3e3e39;var _0x245516=Object[_0xd0f2('0x1b')](_0x5e07cd)[_0xd0f2('0xd')](function(_0x2cf1e0){return _[_0xd0f2('0x1c')](_0x2cf1e0,_0xd0f2('0x1d'))?_0x2cf1e0:undefined;});var _0x2d6e7c=_0x245516[_0xd0f2('0x1e')](function(_0x129f39){return db['CmCustomField'][_0xd0f2('0x1f')]({'where':{'id':_0x129f39['slice'](0x3)},'raw':!![]});});return Promise[_0xd0f2('0x20')](_0x2d6e7c);})[_0xd0f2('0x9')](function(_0x1e4d3b){for(var _0x5a8db6=0x0;_0x5a8db6<_0x1e4d3b['length'];_0x5a8db6++){if(_0x1e4d3b[_0x5a8db6]){var _0x22c9d1=_0xd0f2('0x1d')+_0x1e4d3b[_0x5a8db6]['id'];_0x5e07cd[_0x22c9d1][_0xd0f2('0x21')]=_0x1e4d3b[_0x5a8db6][_0xd0f2('0x22')];}}_0x273983=_[_0xd0f2('0x1e')](Object[_0xd0f2('0x1b')](_0x5e07cd),function(_0x596781){return{'name':_0x596781,'type':_0x5e07cd[_0x596781][_0xd0f2('0x22')]};});return _0x273983;})[_0xd0f2('0x19')](function(_0x181394){throw _0x181394;});}; \ No newline at end of file +var _0x21fb=['where','default','filter','user','tags','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','clause','getFilteredContacts','rows','catch','CmContact','describe','keys','cf_','CmCustomField','slice','all','type','map','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters'];(function(_0x586929,_0x20be9a){var _0xfb5e94=function(_0x2817be){while(--_0x2817be){_0x586929['push'](_0x586929['shift']());}};_0xfb5e94(++_0x20be9a);}(_0x21fb,0xa9));var _0xb21f=function(_0x38832c,_0x1daf0b){_0x38832c=_0x38832c-0x0;var _0x43a35f=_0x21fb[_0x38832c];return _0x43a35f;};'use strict';var _=require(_0xb21f('0x0'));var sqlUtils=require(_0xb21f('0x1'));var db=require(_0xb21f('0x2'))['db'];exports[_0xb21f('0x3')]=function(_0x27909e,_0x54e69c,_0xbad57f,_0x18bcc9){var _0x4694b6={'count':0x0,'rows':[]};var _0x479f3a=sqlUtils[_0xb21f('0x4')](_0x54e69c,_0x27909e);if(_0x479f3a){return Promise[_0xb21f('0x5')](_0x4694b6);}var _0x456f17=sqlUtils[_0xb21f('0x6')]();var _0x2fa660={};var _0x5da8eb=![];var _0xa96458=![];return Promise[_0xb21f('0x5')]()[_0xb21f('0x7')](function(){if(_0x27909e[_0xb21f('0x8')]){return sqlUtils[_0xb21f('0x9')](_0x27909e['search'],_0x18bcc9);}else{return sqlUtils[_0xb21f('0xa')](_0x27909e,_0x18bcc9);}})[_0xb21f('0x7')](function(_0x5b4334){_0x456f17[_0xb21f('0xb')](_0x5b4334[_0xb21f('0xc')]);_0x456f17[_0xb21f('0xb')](_0x5b4334['fields']);_0x456f17[_0xb21f('0xb')](_0x5b4334[_0xb21f('0xd')]);_0x456f17['where'](_0x5b4334[_0xb21f('0xe')]['clause']);_0x2fa660=_0x5b4334[_0xb21f('0xf')];_0xa96458=_0x5b4334[_0xb21f('0xe')][_0xb21f('0x10')];return sqlUtils[_0xb21f('0x11')](_0x54e69c,_0x27909e,_0xa96458);})[_0xb21f('0x7')](function(_0x262da7){_0x456f17[_0xb21f('0xb')](_0x262da7);var _0x5304e9=_0x27909e[_0xb21f('0x8')]?_0x2fa660[_0xb21f('0x12')]:_0x27909e['tag'];_0x5da8eb=_0x5304e9?!![]:![];return sqlUtils[_0xb21f('0x13')](_0x456f17,_0x5304e9);})[_0xb21f('0x7')](function(_0x3a22f8){_0x4694b6[_0xb21f('0x14')]=_0x3a22f8;if(_0x4694b6[_0xb21f('0x14')]===0x0){return;}if(_0x27909e[_0xb21f('0x15')]){_0xa96458=!![];}return sqlUtils[_0xb21f('0x16')](_0x456f17,_0x27909e['fields'],_0xbad57f,_0x5da8eb,_0x2fa660[_0xb21f('0x17')],_0xa96458);})[_0xb21f('0x7')](function(_0x4a50df){if(!_0x4a50df){return[];}return sqlUtils[_0xb21f('0x18')](_0x4a50df,_0x27909e,_0xbad57f);})[_0xb21f('0x7')](function(_0x24a632){_0x4694b6[_0xb21f('0x19')]=_0x24a632;return _0x4694b6;})[_0xb21f('0x1a')](function(_0xed356c){throw _0xed356c;});};exports['describe']=function(){var _0x2c2e52={};var _0x21d236=[];return db[_0xb21f('0x1b')][_0xb21f('0x1c')]()[_0xb21f('0x7')](function(_0x2fd797){_0x2c2e52=_0x2fd797;var _0x2dacfa=Object[_0xb21f('0x1d')](_0x2c2e52)[_0xb21f('0xd')](function(_0x3630a0){return _['startsWith'](_0x3630a0,_0xb21f('0x1e'))?_0x3630a0:undefined;});var _0x2d199a=_0x2dacfa['map'](function(_0x2cfe84){return db[_0xb21f('0x1f')]['findOne']({'where':{'id':_0x2cfe84[_0xb21f('0x20')](0x3)},'raw':!![]});});return Promise[_0xb21f('0x21')](_0x2d199a);})['then'](function(_0x46239e){for(var _0x2730f2=0x0;_0x2730f2<_0x46239e['length'];_0x2730f2++){if(_0x46239e[_0x2730f2]){var _0x3e4d34=_0xb21f('0x1e')+_0x46239e[_0x2730f2]['id'];_0x2c2e52[_0x3e4d34]['fieldType']=_0x46239e[_0x2730f2][_0xb21f('0x22')];}}_0x21d236=_[_0xb21f('0x23')](Object[_0xb21f('0x1d')](_0x2c2e52),function(_0x41c3cc){return{'name':_0x41c3cc,'type':_0x2c2e52[_0x41c3cc][_0xb21f('0x22')]};});return _0x21d236;})['catch'](function(_0x59c430){throw _0x59c430;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index e85a499..61e69c9 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96b8=['castTo','buildExpression','type','default','text','start','value','Tag','map','clause','and','tags','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','User','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','DESC','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','Tags','clone','COUNT(*)','where','t.id\x20IN\x20?','toString','lodash','squel','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','TagIds','includes','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','length','conditions','find','name','datetime'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x96b8,0x17e));var _0x896b=function(_0x185fae,_0x32ba5a){_0x185fae=_0x185fae-0x0;var _0x1e0c34=_0x96b8[_0x185fae];return _0x1e0c34;};'use strict';var _=require(_0x896b('0x0'));var squel=require(_0x896b('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0x896b('0x2'))['db'];function skipContactsQuery(_0x26ed57,_0x57e2e6){var _0x36ef20=![];if(_0x26ed57[_0x896b('0x3')]===_0x896b('0x4')&&!_0x57e2e6[_0x896b('0x5')]&&!_0x57e2e6[_0x896b('0x6')]&&_0x57e2e6[_0x896b('0x7')]!==_0x896b('0x8')){_0x36ef20=!![];}return _0x36ef20;}function getContactsSubquery(){return squel[_0x896b('0x9')]()[_0x896b('0xa')](_0x896b('0xb'),'c')['where'](_0x896b('0xc'));}function applyJoinClauses(_0x2c67f5,_0x493261){var _0x5c6ddf=_0x493261?'c':_0x896b('0xd');_0x2c67f5[_0x896b('0xe')](_0x896b('0xf'),'uc',_0x896b('0x10')+_0x5c6ddf+_0x896b('0x11'))['left_join'](_0x896b('0x12'),'ct',_0x896b('0x13')+_0x5c6ddf+_0x896b('0x11'))[_0x896b('0xe')](_0x896b('0x14'),'t',_0x896b('0x15'));return _0x2c67f5;}function addFieldsToQuery(_0x139b30,_0x527f4c,_0x420df1,_0x25d54a,_0x47d943){var _0x578427=_0x47d943?'c':_0x896b('0xd');if(!_0x527f4c){_0x527f4c=['id',_0x896b('0x16'),_0x896b('0x17'),_0x896b('0x18'),_0x896b('0x19'),_0x896b('0x1a'),_0x896b('0x1b'),_0x896b('0x6'),_0x896b('0x1c'),_0x896b('0x1d'),_0x896b('0x1e'),'deletedAt',_0x896b('0x1f')];}else if(!_0x527f4c[_0x896b('0x20')]('id')){_0x527f4c[_0x896b('0x21')]('id');}var _0x514a25=_0x420df1&&_0x47d943||!_0x420df1&&!_0x47d943;if(_0x25d54a){_0x514a25=_0x25d54a&&_0x47d943||!_0x25d54a&&!_0x47d943;}_0x527f4c['forEach'](function(_0x376234){if(_0x376234==='TagIds'){if(_0x514a25){_0x139b30[_0x896b('0x22')](_0x896b('0x23'),_0x376234);}else if(_0x420df1||_0x25d54a){_0x139b30[_0x896b('0x22')](_0x578427+'.'+_0x376234);}}else{_0x139b30['field'](_0x578427+'.'+_0x376234);}});return _0x139b30;}function getSqlClauses(){var _0x16e345={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0x896b('0x24')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x16e345;}function parseTagParameter(_0x313c71){var _0x527500=squel['expr']();if(_0x313c71){var _0x50a714=utils[_0x896b('0x25')](_0x313c71);_0x50a714[_0x896b('0x26')](function(_0x4c585d){_0x527500['or'](_0x896b('0x27'),'%,'+_0x4c585d+',%');});}return _0x527500;}function parseSearchFilter(_0x58c23b){var _0x2b027a=squel[_0x896b('0x24')]();if(_0x58c23b){var _0x6ad908=_0x58c23b[_0x896b('0x28')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x6ad908['split']('\x20')['length']>0x1){_0x2b027a['or'](_0x896b('0x29'),qs[_0x896b('0x2a')](_0x6ad908,!![]),null);}else{if(qs[_0x896b('0x2b')](_0x6ad908)){_0x2b027a['or'](_0x896b('0x2c'),_0x6ad908+'%');_0x2b027a['or'](_0x896b('0x2d'),_0x6ad908+'%');_0x2b027a['or'](_0x896b('0x2e'),_0x6ad908+'%');_0x2b027a['or'](_0x896b('0x2f'),_0x6ad908+'%');}else if(qs[_0x896b('0x30')](_0x6ad908)){_0x2b027a['or']('c.email\x20LIKE\x20?',_0x6ad908+'%');}else{_0x2b027a['or'](_0x896b('0x31'),'%'+_0x6ad908+'%');_0x2b027a['or'](_0x896b('0x32'),'%'+_0x6ad908+'%');_0x2b027a['or']('c.email\x20LIKE\x20?','%'+_0x6ad908+'%');}}}return _0x2b027a;}function parseAdvancedSearchFilter(_0x22470a,_0x568847){var _0x3cb70d=getSqlClauses();var _0x54cfd4=as[_0x896b('0x33')](_0x22470a);var _0xbfc1ea=_0x54cfd4[_0x896b('0x34')];for(var _0x14e893=0x0;_0x14e893<_0x54cfd4['conditions'][_0x896b('0x35')];_0x14e893++){var _0x17d546=_0x54cfd4[_0x896b('0x36')][_0x14e893];var _0x187d9c='c';var _0xeb3c19=_[_0x896b('0x37')](_0x568847,[_0x896b('0x38'),_0x17d546[_0x896b('0x22')]]);if(_0xeb3c19){if(_0x17d546['field']==='dateOfBirth'||_0xeb3c19['fieldType']===_0x896b('0x39')){_0x17d546[_0x896b('0x3a')]='DATE';}var _0x48ef11=as[_0x896b('0x3b')](_0x187d9c,_0xeb3c19[_0x896b('0x3c')],_0x17d546);_0x3cb70d[_0x896b('0x3d')][_0xbfc1ea](_0x48ef11[_0x896b('0x3e')],_0x48ef11['value'][_0x896b('0x3f')],_0x48ef11[_0x896b('0x40')]['end']);}else{if(_0x17d546[_0x896b('0x22')]===_0x896b('0x41')){var _0xfafc53=_0x17d546[_0x896b('0x40')]['split'](',')[_0x896b('0x42')](function(_0xfe2c53){return Number(_0xfe2c53);});var _0x23478a=parseTagParameter(_0xfafc53);_0x3cb70d['tags'][_0x896b('0x43')][_0x896b('0x44')](_0x23478a);_0x3cb70d[_0x896b('0x45')]['ids']=_0xfafc53;}else if(_0x17d546[_0x896b('0x22')]==='User'){_0x3cb70d[_0x896b('0x46')]['clause']['and'](_0x896b('0x47'),_0x17d546['value']);_0x3cb70d[_0x896b('0x46')][_0x896b('0x48')]=!![];}}}return _0x3cb70d;}function parseModelFields(_0x20ed9d,_0xd9adab){var _0x15393d=squel['expr']();var _0xc93f2c=_(_0x20ed9d)[_0x896b('0x49')]()['map'](function(_0x1a201a){return _[_0x896b('0x4a')](_0xd9adab,[_0x896b('0x38'),_0x1a201a])?_0x1a201a:undefined;})['compact']()[_0x896b('0x40')]();if(_0x20ed9d[_0x896b('0x4b')]){_0xc93f2c[_0x896b('0x21')](_0x896b('0x4b'));}if(_0x20ed9d[_0x896b('0x4c')]){_0xc93f2c[_0x896b('0x21')](_0x896b('0x4c'));}if(_0xc93f2c[_0x896b('0x35')]>0x0){_0xc93f2c['forEach'](function(_0x32041d){if(_0x32041d===_0x896b('0x6')){_0x15393d[_0x896b('0x44')](_0x896b('0x4d'),[]['concat'](_0x20ed9d[_0x32041d]));}else if(_0x32041d==='Contact'){var _0x51c124='%'+_0x20ed9d[_0x32041d]+'%';_0x15393d[_0x896b('0x44')](_0x896b('0x4e'),_0x51c124);}else if(_0x32041d===_0x896b('0x4c')){_0x15393d[_0x896b('0x44')]('uc.UserId\x20=\x20?',_0x20ed9d[_0x32041d]);}else{_0x15393d[_0x896b('0x44')]('c.'+_0x32041d+_0x896b('0x4f'),_0x20ed9d[_0x32041d]);}});}return _0x15393d;}function parseQueryParameters(_0xc7c284,_0x4b2202){var _0x265a7f=getSqlClauses();return Promise[_0x896b('0x50')]()[_0x896b('0x51')](function(){return parseModelFields(_0xc7c284,_0x4b2202);})[_0x896b('0x51')](function(_0x5818ab){_0x265a7f[_0x896b('0x52')][_0x896b('0x44')](_0x5818ab);return parseTagParameter(_0xc7c284[_0x896b('0x53')]);})[_0x896b('0x51')](function(_0x60ae2e){_0x265a7f[_0x896b('0x45')]['clause'][_0x896b('0x44')](_0x60ae2e);return parseSearchFilter(_0xc7c284[_0x896b('0x54')]);})[_0x896b('0x51')](function(_0x55c302){_0x265a7f['filter']=_0x55c302;return _0x265a7f;});}function checkListsRestrictions(_0x121108,_0x32f7f4,_0x3139d1){var _0x246d35=squel[_0x896b('0x24')]();return Promise[_0x896b('0x50')]()[_0x896b('0x51')](function(){if(_0x32f7f4[_0x896b('0x5')]&&_0x121108[_0x896b('0x3')]===_0x896b('0x4')&&!_0x3139d1){return _0x121108[_0x896b('0x55')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4b102c){if(_0x4b102c){if(_0x4b102c[_0x896b('0x35')]===0x0){_0x246d35[_0x896b('0x44')](_0x896b('0x56'));}else{_0x246d35[_0x896b('0x44')](_0x896b('0x4d'),_[_0x896b('0x42')](_0x4b102c,'id'));}}})[_0x896b('0x51')](function(){return _0x246d35;});}function buildContactsQuery(_0x931546,_0x11e346,_0x48978c,_0x5ea751,_0x84a255,_0x4dda22){if(_0x11e346){_0x11e346=_0x48978c[_0x896b('0x57')];}_0x931546=addFieldsToQuery(_0x931546,_0x11e346,_0x5ea751,_0x4dda22,!![]);var _0xc1797d=squel[_0x896b('0x9')]();_0xc1797d=addFieldsToQuery(_0xc1797d,_0x11e346,_0x5ea751,_0x4dda22,![]);if(_0x5ea751||_0x4dda22){_0x931546=applyJoinClauses(_0x931546,!![]);_0x931546[_0x896b('0x58')]('c.id');if(_0x48978c['limit']){_0xc1797d[_0x896b('0x59')](_0x48978c['limit']);}if(_0x48978c[_0x896b('0x5a')]){_0xc1797d['offset'](_0x48978c['offset']);}}else{_0xc1797d=applyJoinClauses(_0xc1797d,![]);_0xc1797d[_0x896b('0x58')](_0x896b('0x5b'));if(_0x48978c[_0x896b('0x59')]){_0x931546[_0x896b('0x59')](_0x48978c[_0x896b('0x59')]);}if(_0x48978c[_0x896b('0x5a')]){_0x931546[_0x896b('0x5a')](_0x48978c[_0x896b('0x5a')]);}}_0xc1797d[_0x896b('0x5c')](_0x84a255);if(_0x48978c['order']){_0x48978c[_0x896b('0x5d')][_0x896b('0x26')](function(_0x1513b6){_0x931546['order']('c.'+_0x1513b6[0x0],_0x1513b6[0x1]===_0x896b('0x5e')?![]:!![]);_0xc1797d['order']('subqry.'+_0x1513b6[0x0],_0x1513b6[0x1]===_0x896b('0x5e')?![]:!![]);});}_0xc1797d[_0x896b('0xa')](_0x931546,'subqry');return _0xc1797d;}function getFilteredContacts(_0x3590d2){var _0x16671f=[];return db[_0x896b('0x41')][_0x896b('0x5f')]({'attributes':['id',_0x896b('0x38'),_0x896b('0x60')],'raw':!![]})[_0x896b('0x51')](function(_0x34f5fa){_0x16671f=_[_0x896b('0x61')](_0x34f5fa,'id');var _0x5d4177={'type':db[_0x896b('0x62')][_0x896b('0x63')][_0x896b('0x64')],'model':db[_0x896b('0x65')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x896b('0x66')][_0x896b('0x67')](_0x3590d2['toString'](),_0x5d4177);})[_0x896b('0x51')](function(_0x5aec38){_0x5aec38[_0x896b('0x26')](function(_0xf84b8b){if(_0xf84b8b['TagIds']){_0xf84b8b[_0x896b('0x68')]=[];_0xf84b8b['TagIds']['split'](',')[_0x896b('0x26')](function(_0x36f9ea){_0xf84b8b[_0x896b('0x68')][_0x896b('0x21')](_0x16671f[_0x36f9ea]);});}delete _0xf84b8b['TagIds'];});return _0x5aec38;});}function countFilteredContacts(_0x52fce3,_0x37212b){var _0x5d26a4=_0x52fce3[_0x896b('0x69')]();_0x5d26a4[_0x896b('0x22')](_0x896b('0x6a'));_0x5d26a4=applyJoinClauses(_0x5d26a4,!![]);_0x52fce3[_0x896b('0x58')]('c.id');var _0x421589=utils[_0x896b('0x25')](_0x37212b);if(!_['isEmpty'](_0x421589)){_0x5d26a4[_0x896b('0x6b')](_0x896b('0x6c'),_0x421589);}var _0x100478={'type':db['Sequelize'][_0x896b('0x63')][_0x896b('0x64')],'raw':!![]};return db[_0x896b('0x66')][_0x896b('0x67')](_0x5d26a4[_0x896b('0x6d')](),_0x100478)['then'](function(_0x597591){return _0x597591[0x0][_0x896b('0x6a')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xb766=['cm_contacts','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','lastName','phone','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','tags','User','user','clause','and','uc.UserId\x20=\x20?','map','some','compact','Contact','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','tag','filter','search','role','getLists','attributes','select','group','limit','offset','subqry.id','order','DESC','Tag','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','c.id','isEmpty','t.id\x20IN\x20?','query','exports','squel','../parsers/qs','../interaction/utils','../../mysqldb','agent','ListId','true','from'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xb766,0xb8));var _0x6b76=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xb766[_0xd02bb];return _0x1cdf23;};'use strict';var _=require('lodash');var squel=require(_0x6b76('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0x6b76('0x1'));var utils=require(_0x6b76('0x2'));var db=require(_0x6b76('0x3'))['db'];function skipContactsQuery(_0x412977,_0x1e42f7){var _0x4d164e=![];if(_0x412977['role']===_0x6b76('0x4')&&!_0x1e42f7['search']&&!_0x1e42f7[_0x6b76('0x5')]&&_0x1e42f7['autocomplete']!==_0x6b76('0x6')){_0x4d164e=!![];}return _0x4d164e;}function getContactsSubquery(){return squel['select']()[_0x6b76('0x7')](_0x6b76('0x8'),'c')[_0x6b76('0x9')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x37c1e2,_0x211505){var _0x3c3747=_0x211505?'c':_0x6b76('0xa');_0x37c1e2[_0x6b76('0xb')](_0x6b76('0xc'),'uc',_0x6b76('0xd')+_0x3c3747+_0x6b76('0xe'))[_0x6b76('0xb')](_0x6b76('0xf'),'ct',_0x6b76('0x10')+_0x3c3747+'.id')[_0x6b76('0xb')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x37c1e2;}function addFieldsToQuery(_0x53fb15,_0x18879c,_0x1355ba,_0x33564c,_0x491553){var _0x6f7287=_0x491553?'c':_0x6b76('0xa');if(!_0x18879c){_0x18879c=['id','firstName',_0x6b76('0x11'),_0x6b76('0x12'),'mobile',_0x6b76('0x13'),_0x6b76('0x14'),_0x6b76('0x5'),_0x6b76('0x15'),_0x6b76('0x16'),_0x6b76('0x17'),_0x6b76('0x18'),_0x6b76('0x19')];}else if(!_0x18879c[_0x6b76('0x1a')]('id')){_0x18879c[_0x6b76('0x1b')]('id');}var _0x3c5875=_0x1355ba&&_0x491553||!_0x1355ba&&!_0x491553;if(_0x33564c){_0x3c5875=_0x33564c&&_0x491553||!_0x33564c&&!_0x491553;}_0x18879c['forEach'](function(_0xbe4d3c){if(_0xbe4d3c===_0x6b76('0x19')){if(_0x3c5875){_0x53fb15[_0x6b76('0x1c')](_0x6b76('0x1d'),_0xbe4d3c);}else if(_0x1355ba||_0x33564c){_0x53fb15[_0x6b76('0x1c')](_0x6f7287+'.'+_0xbe4d3c);}}else{_0x53fb15[_0x6b76('0x1c')](_0x6f7287+'.'+_0xbe4d3c);}});return _0x53fb15;}function getSqlClauses(){var _0x2faaa9={'default':squel['expr'](),'fields':squel[_0x6b76('0x1e')](),'filter':squel[_0x6b76('0x1e')](),'tags':{'clause':squel[_0x6b76('0x1e')](),'ids':null},'user':{'clause':squel[_0x6b76('0x1e')](),'skip':![]}};return _0x2faaa9;}function parseTagParameter(_0x28c896){var _0x3c7adf=squel[_0x6b76('0x1e')]();if(_0x28c896){var _0x1e2a7f=utils['getSelectedTags'](_0x28c896);_0x1e2a7f[_0x6b76('0x1f')](function(_0x4afdb7){_0x3c7adf['or'](_0x6b76('0x20'),'%,'+_0x4afdb7+',%');});}return _0x3c7adf;}function parseSearchFilter(_0x49d355){var _0x143cbf=squel['expr']();if(_0x49d355){var _0x2735f1=_0x49d355[_0x6b76('0x21')]('\x5c','\x5c\x5c')[_0x6b76('0x21')](/'/g,'\x27\x27');if(_0x2735f1[_0x6b76('0x22')]('\x20')[_0x6b76('0x23')]>0x1){_0x143cbf['or'](_0x6b76('0x24'),qs['getFullTextValue'](_0x2735f1,!![]),null);}else{if(qs['isNumeric'](_0x2735f1)){_0x143cbf['or'](_0x6b76('0x25'),_0x2735f1+'%');_0x143cbf['or'](_0x6b76('0x26'),_0x2735f1+'%');_0x143cbf['or'](_0x6b76('0x27'),_0x2735f1+'%');_0x143cbf['or']('c.fax\x20LIKE\x20?',_0x2735f1+'%');}else if(qs['isEmail'](_0x2735f1)){_0x143cbf['or']('c.email\x20LIKE\x20?',_0x2735f1+'%');}else{_0x143cbf['or']('c.firstName\x20LIKE\x20?','%'+_0x2735f1+'%');_0x143cbf['or'](_0x6b76('0x28'),'%'+_0x2735f1+'%');_0x143cbf['or']('c.email\x20LIKE\x20?','%'+_0x2735f1+'%');}}}return _0x143cbf;}function parseAdvancedSearchFilter(_0x3eab89,_0x1b4d4c){var _0x2bc2b7=getSqlClauses();var _0x43aeb0=as[_0x6b76('0x29')](_0x3eab89);var _0x290993=_0x43aeb0['sqlOperator'];for(var _0x53368c=0x0;_0x53368c<_0x43aeb0['conditions'][_0x6b76('0x23')];_0x53368c++){var _0x1f0b00=_0x43aeb0[_0x6b76('0x2a')][_0x53368c];var _0x2bec15='c';var _0x1f731b=_['find'](_0x1b4d4c,[_0x6b76('0x2b'),_0x1f0b00['field']]);if(_0x1f731b){if(_0x1f0b00[_0x6b76('0x1c')]===_0x6b76('0x2c')||_0x1f731b[_0x6b76('0x2d')]===_0x6b76('0x2e')){_0x1f0b00[_0x6b76('0x2f')]=_0x6b76('0x30');}var _0xb4ca6=as[_0x6b76('0x31')](_0x2bec15,_0x1f731b[_0x6b76('0x32')],_0x1f0b00);_0x2bc2b7[_0x6b76('0x33')][_0x290993](_0xb4ca6[_0x6b76('0x34')],_0xb4ca6[_0x6b76('0x35')]['start'],_0xb4ca6['value']['end']);}else{if(_0x1f0b00['field']==='Tag'){var _0x59934c=_0x1f0b00[_0x6b76('0x35')][_0x6b76('0x22')](',')['map'](function(_0x15b6f1){return Number(_0x15b6f1);});var _0x3d614c=parseTagParameter(_0x59934c);_0x2bc2b7[_0x6b76('0x36')]['clause']['and'](_0x3d614c);_0x2bc2b7[_0x6b76('0x36')]['ids']=_0x59934c;}else if(_0x1f0b00[_0x6b76('0x1c')]===_0x6b76('0x37')){_0x2bc2b7[_0x6b76('0x38')][_0x6b76('0x39')][_0x6b76('0x3a')](_0x6b76('0x3b'),_0x1f0b00[_0x6b76('0x35')]);_0x2bc2b7[_0x6b76('0x38')]['skip']=!![];}}}return _0x2bc2b7;}function parseModelFields(_0x18a9ba,_0x4064ca){var _0xa2ceac=squel[_0x6b76('0x1e')]();var _0x3577c5=_(_0x18a9ba)['keys']()[_0x6b76('0x3c')](function(_0x540993){return _[_0x6b76('0x3d')](_0x4064ca,['name',_0x540993])?_0x540993:undefined;})[_0x6b76('0x3e')]()['value']();if(_0x18a9ba[_0x6b76('0x3f')]){_0x3577c5['push'](_0x6b76('0x3f'));}if(_0x18a9ba['User']){_0x3577c5['push'](_0x6b76('0x37'));}if(_0x3577c5[_0x6b76('0x23')]>0x0){_0x3577c5[_0x6b76('0x1f')](function(_0x35ce8a){if(_0x35ce8a===_0x6b76('0x5')){_0xa2ceac[_0x6b76('0x3a')](_0x6b76('0x40'),[][_0x6b76('0x41')](_0x18a9ba[_0x35ce8a]));}else if(_0x35ce8a===_0x6b76('0x3f')){var _0x43ef6c='%'+_0x18a9ba[_0x35ce8a]+'%';_0xa2ceac[_0x6b76('0x3a')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x43ef6c);}else if(_0x35ce8a==='User'){_0xa2ceac[_0x6b76('0x3a')](_0x6b76('0x3b'),_0x18a9ba[_0x35ce8a]);}else{_0xa2ceac[_0x6b76('0x3a')]('c.'+_0x35ce8a+_0x6b76('0x42'),_0x18a9ba[_0x35ce8a]);}});}return _0xa2ceac;}function parseQueryParameters(_0x3fda22,_0x11cae4){var _0x583148=getSqlClauses();return Promise[_0x6b76('0x43')]()[_0x6b76('0x44')](function(){return parseModelFields(_0x3fda22,_0x11cae4);})[_0x6b76('0x44')](function(_0x582080){_0x583148['fields'][_0x6b76('0x3a')](_0x582080);return parseTagParameter(_0x3fda22[_0x6b76('0x45')]);})['then'](function(_0x2e940c){_0x583148[_0x6b76('0x36')][_0x6b76('0x39')]['and'](_0x2e940c);return parseSearchFilter(_0x3fda22[_0x6b76('0x46')]);})[_0x6b76('0x44')](function(_0x58e74a){_0x583148['filter']=_0x58e74a;return _0x583148;});}function checkListsRestrictions(_0xbec187,_0x30e2cd,_0x5502d1){var _0x48a351=squel[_0x6b76('0x1e')]();return Promise[_0x6b76('0x43')]()[_0x6b76('0x44')](function(){if(_0x30e2cd[_0x6b76('0x47')]&&_0xbec187[_0x6b76('0x48')]===_0x6b76('0x4')&&!_0x5502d1){return _0xbec187[_0x6b76('0x49')]({'attributes':['id'],'raw':!![]});}})[_0x6b76('0x44')](function(_0x293050){if(_0x293050){if(_0x293050[_0x6b76('0x23')]===0x0){_0x48a351[_0x6b76('0x3a')]('c.ListId\x20IS\x20NULL');}else{_0x48a351[_0x6b76('0x3a')](_0x6b76('0x40'),_['map'](_0x293050,'id'));}}})[_0x6b76('0x44')](function(){return _0x48a351;});}function buildContactsQuery(_0x2c4342,_0x5f3d3e,_0x591123,_0x315ee9,_0x466c27,_0x4bcce8){if(_0x5f3d3e){_0x5f3d3e=_0x591123[_0x6b76('0x4a')];}_0x2c4342=addFieldsToQuery(_0x2c4342,_0x5f3d3e,_0x315ee9,_0x4bcce8,!![]);var _0x40a3a0=squel[_0x6b76('0x4b')]();_0x40a3a0=addFieldsToQuery(_0x40a3a0,_0x5f3d3e,_0x315ee9,_0x4bcce8,![]);if(_0x315ee9||_0x4bcce8){_0x2c4342=applyJoinClauses(_0x2c4342,!![]);_0x2c4342[_0x6b76('0x4c')]('c.id');if(_0x591123[_0x6b76('0x4d')]){_0x40a3a0[_0x6b76('0x4d')](_0x591123[_0x6b76('0x4d')]);}if(_0x591123['offset']){_0x40a3a0['offset'](_0x591123[_0x6b76('0x4e')]);}}else{_0x40a3a0=applyJoinClauses(_0x40a3a0,![]);_0x40a3a0['group'](_0x6b76('0x4f'));if(_0x591123['limit']){_0x2c4342[_0x6b76('0x4d')](_0x591123['limit']);}if(_0x591123['offset']){_0x2c4342[_0x6b76('0x4e')](_0x591123[_0x6b76('0x4e')]);}}_0x40a3a0['having'](_0x466c27);if(_0x591123['order']){_0x591123[_0x6b76('0x50')][_0x6b76('0x1f')](function(_0xe1b519){_0x2c4342[_0x6b76('0x50')]('c.'+_0xe1b519[0x0],_0xe1b519[0x1]===_0x6b76('0x51')?![]:!![]);_0x40a3a0[_0x6b76('0x50')]('subqry.'+_0xe1b519[0x0],_0xe1b519[0x1]===_0x6b76('0x51')?![]:!![]);});}_0x40a3a0[_0x6b76('0x7')](_0x2c4342,_0x6b76('0xa'));return _0x40a3a0;}function getFilteredContacts(_0x2416fb){var _0x20a450=[];return db[_0x6b76('0x52')][_0x6b76('0x53')]({'attributes':['id','name','color'],'raw':!![]})[_0x6b76('0x44')](function(_0x583748){_0x20a450=_[_0x6b76('0x54')](_0x583748,'id');var _0x3ce38c={'type':db[_0x6b76('0x55')][_0x6b76('0x56')][_0x6b76('0x57')],'model':db[_0x6b76('0x58')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x6b76('0x59')]['query'](_0x2416fb[_0x6b76('0x5a')](),_0x3ce38c);})['then'](function(_0x436f97){_0x436f97[_0x6b76('0x1f')](function(_0xe10a65){if(_0xe10a65['TagIds']){_0xe10a65['Tags']=[];_0xe10a65[_0x6b76('0x19')][_0x6b76('0x22')](',')[_0x6b76('0x1f')](function(_0x3e5c35){_0xe10a65['Tags'][_0x6b76('0x1b')](_0x20a450[_0x3e5c35]);});}delete _0xe10a65[_0x6b76('0x19')];});return _0x436f97;});}function countFilteredContacts(_0x54ad66,_0x45659f){var _0xa28ed9=_0x54ad66['clone']();_0xa28ed9[_0x6b76('0x1c')]('COUNT(*)');_0xa28ed9=applyJoinClauses(_0xa28ed9,!![]);_0x54ad66['group'](_0x6b76('0x5b'));var _0x584ffe=utils['getSelectedTags'](_0x45659f);if(!_[_0x6b76('0x5c')](_0x584ffe)){_0xa28ed9[_0x6b76('0x9')](_0x6b76('0x5d'),_0x584ffe);}var _0x4bc7ee={'type':db[_0x6b76('0x55')][_0x6b76('0x56')][_0x6b76('0x57')],'raw':!![]};return db[_0x6b76('0x59')][_0x6b76('0x5e')](_0xa28ed9[_0x6b76('0x5a')](),_0x4bc7ee)[_0x6b76('0x44')](function(_0x48b935){return _0x48b935[0x0]['COUNT(*)'];});}module[_0x6b76('0x5f')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 8fb40fc..38d5b07 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33c8=['createWriteStream','createCipher','data','write','end','final','binary','close','unlink','createDecipher','update','secret','utf8','base64','decryptString','crypto','lodash','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x33c8,0x18f));var _0x833c=function(_0xf68caf,_0x3de0d5){_0xf68caf=_0xf68caf-0x0;var _0x1f48af=_0x33c8[_0xf68caf];return _0x1f48af;};'use strict';var crypto=require(_0x833c('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x833c('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x833c('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x833c('0x3')][_0x833c('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x833c('0x5')};if(config[_0x833c('0x6')]&&config[_0x833c('0x6')][_0x833c('0x7')]){var isSupported=isAlgorithmSupported(config[_0x833c('0x6')][_0x833c('0x7')]);if(isSupported){fileOptions[_0x833c('0x7')]=config['encrypt'][_0x833c('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x833c('0x8')](',\x20');logger[_0x833c('0x9')](config[_0x833c('0x6')]['algorithm'],_0x833c('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x4cd54f){return AES_SUPPORTED_RX['test'](_0x4cd54f);}function getSupportedCiphers(){return crypto[_0x833c('0xb')]()[_0x833c('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x552ddd){return getSupportedCiphers()[_0x833c('0xd')](_0x552ddd)>-0x1;}function combineOptions(_0xa51d52){var _0xa7d73b={};for(var _0x1d3025 in fileOptions){if(fileOptions[_0x833c('0xe')](_0x1d3025)){_0xa7d73b[_0x1d3025]=fileOptions[_0x1d3025];}}if(_0xa51d52){for(var _0x5e265a in _0xa51d52){if(_0xa51d52[_0x833c('0xe')](_0x5e265a)){_0xa7d73b[_0x5e265a]=_0xa51d52[_0x5e265a];}}}return _0xa7d73b;}exports[_0x833c('0xf')]=function(_0x441bd5,_0x2577aa,_0x318c77,_0x5253a6){return new BPromise(function(_0x10f09a,_0x13506e){_0x5253a6=combineOptions(_0x5253a6);var _0x2ae6db=new Buffer(_0x318c77);var _0x39b255=fs[_0x833c('0x10')](_0x441bd5);var _0x2bed60=fs[_0x833c('0x11')](_0x2577aa);var _0x3d6ff6=crypto[_0x833c('0x12')](_0x5253a6[_0x833c('0x7')],_0x2ae6db);_0x39b255['on'](_0x833c('0x13'),function(_0x3c21e1){var _0x5063f8=new Buffer(_0x3d6ff6['update'](_0x3c21e1),'binary');_0x2bed60[_0x833c('0x14')](_0x5063f8);});_0x39b255['on'](_0x833c('0x15'),function(){try{var _0x18736b=new Buffer(_0x3d6ff6[_0x833c('0x16')](_0x833c('0x17')),_0x833c('0x17'));_0x2bed60['write'](_0x18736b);_0x2bed60['end']();_0x2bed60['on'](_0x833c('0x18'),function(){return _0x10f09a(_0x2577aa);});}catch(_0x55993b){fs[_0x833c('0x19')](_0x2577aa);return _0x13506e(_0x55993b);}});});};exports['decryptFile']=function(_0x4fc7db,_0x26f8f7,_0x44b452,_0x31be72){return new BPromise(function(_0x1f8a33,_0x13ea5a){_0x31be72=combineOptions(_0x31be72);var _0x34e393=new Buffer(_0x44b452);var _0x10f205=fs[_0x833c('0x10')](_0x4fc7db);var _0x4070ab=fs[_0x833c('0x11')](_0x26f8f7);var _0x4c4c65=crypto[_0x833c('0x1a')](_0x31be72[_0x833c('0x7')],_0x34e393);_0x10f205['on'](_0x833c('0x13'),function(_0x5c5136){var _0x233614=new Buffer(_0x4c4c65[_0x833c('0x1b')](_0x5c5136),'binary');_0x4070ab[_0x833c('0x14')](_0x233614);});_0x10f205['on'](_0x833c('0x15'),function(){try{var _0x1cd85f=new Buffer(_0x4c4c65[_0x833c('0x16')](_0x833c('0x17')),'binary');_0x4070ab[_0x833c('0x14')](_0x1cd85f);_0x4070ab[_0x833c('0x15')]();_0x4070ab['on']('close',function(){return _0x1f8a33(_0x26f8f7);});}catch(_0x3ab125){fs[_0x833c('0x19')](_0x26f8f7);return _0x13ea5a(_0x3ab125);}});});};exports['encryptString']=function(_0x318c5e,_0xfcb346,_0x5e682b){var _0x347ebb=_0x5e682b||stringOptions[_0x833c('0x7')];var _0x419339=_0xfcb346||stringOptions[_0x833c('0x1c')];var _0x297bba=crypto[_0x833c('0x12')](_0x347ebb,_0x419339);var _0x2757c4=_0x297bba[_0x833c('0x1b')](_0x318c5e,_0x833c('0x1d'),_0x833c('0x1e'));_0x2757c4+=_0x297bba['final']('base64');return _0x2757c4;};exports[_0x833c('0x1f')]=function(_0x1903f0,_0x58ac9f,_0x2cd4b7){var _0x44a8fb=_0x2cd4b7||stringOptions[_0x833c('0x7')];var _0x12be36=_0x58ac9f||stringOptions[_0x833c('0x1c')];var _0x3d9365=crypto['createDecipher'](_0x44a8fb,_0x12be36);var _0x5d915e=_0x3d9365[_0x833c('0x1b')](_0x1903f0,_0x833c('0x1e'),'utf8');_0x5d915e+=_0x3d9365[_0x833c('0x16')](_0x833c('0x1d'));return _0x5d915e;}; \ No newline at end of file +var _0x2aa5=['data','write','end','binary','unlink','decryptFile','createDecipher','update','final','encryptString','secret','utf8','base64','decryptString','crypto','../../config/environment','../../config/logger','app','session','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','createWriteStream','createCipher'];(function(_0x3b9421,_0x44fb55){var _0xc5bb2e=function(_0xe4ebeb){while(--_0xe4ebeb){_0x3b9421['push'](_0x3b9421['shift']());}};_0xc5bb2e(++_0x44fb55);}(_0x2aa5,0xfe));var _0x52aa=function(_0x381c17,_0x2dcce6){_0x381c17=_0x381c17-0x0;var _0x2d108d=_0x2aa5[_0x381c17];return _0x2d108d;};'use strict';var crypto=require(_0x52aa('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x52aa('0x1'));var logger=require(_0x52aa('0x2'))(_0x52aa('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x52aa('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x52aa('0x5')};if(config[_0x52aa('0x6')]&&config[_0x52aa('0x6')][_0x52aa('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x52aa('0x7')]);if(isSupported){fileOptions[_0x52aa('0x7')]=config[_0x52aa('0x6')][_0x52aa('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x52aa('0x8')](config[_0x52aa('0x6')]['algorithm'],_0x52aa('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x184d53){return AES_SUPPORTED_RX[_0x52aa('0xa')](_0x184d53);}function getSupportedCiphers(){return crypto[_0x52aa('0xb')]()[_0x52aa('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x7855d8){return getSupportedCiphers()['indexOf'](_0x7855d8)>-0x1;}function combineOptions(_0x15cb84){var _0x4c2b78={};for(var _0x4558f5 in fileOptions){if(fileOptions['hasOwnProperty'](_0x4558f5)){_0x4c2b78[_0x4558f5]=fileOptions[_0x4558f5];}}if(_0x15cb84){for(var _0x2dc1b1 in _0x15cb84){if(_0x15cb84[_0x52aa('0xd')](_0x2dc1b1)){_0x4c2b78[_0x2dc1b1]=_0x15cb84[_0x2dc1b1];}}}return _0x4c2b78;}exports['encryptFile']=function(_0x1cbc6b,_0x351158,_0xfd5e35,_0x2ac2f9){return new BPromise(function(_0xbf7f64,_0x279055){_0x2ac2f9=combineOptions(_0x2ac2f9);var _0x156de9=new Buffer(_0xfd5e35);var _0x5d9125=fs['createReadStream'](_0x1cbc6b);var _0x25cefa=fs[_0x52aa('0xe')](_0x351158);var _0x2d1a4e=crypto[_0x52aa('0xf')](_0x2ac2f9[_0x52aa('0x7')],_0x156de9);_0x5d9125['on'](_0x52aa('0x10'),function(_0x3b6e57){var _0x2157a4=new Buffer(_0x2d1a4e['update'](_0x3b6e57),'binary');_0x25cefa[_0x52aa('0x11')](_0x2157a4);});_0x5d9125['on'](_0x52aa('0x12'),function(){try{var _0x3cc425=new Buffer(_0x2d1a4e['final'](_0x52aa('0x13')),_0x52aa('0x13'));_0x25cefa[_0x52aa('0x11')](_0x3cc425);_0x25cefa[_0x52aa('0x12')]();_0x25cefa['on']('close',function(){return _0xbf7f64(_0x351158);});}catch(_0x87a72){fs[_0x52aa('0x14')](_0x351158);return _0x279055(_0x87a72);}});});};exports[_0x52aa('0x15')]=function(_0x52150c,_0x4626b4,_0x131574,_0xd5b42a){return new BPromise(function(_0x2ffe8d,_0x43d660){_0xd5b42a=combineOptions(_0xd5b42a);var _0xb3c81d=new Buffer(_0x131574);var _0x3816d2=fs['createReadStream'](_0x52150c);var _0x38e6dd=fs[_0x52aa('0xe')](_0x4626b4);var _0x36dcb2=crypto[_0x52aa('0x16')](_0xd5b42a[_0x52aa('0x7')],_0xb3c81d);_0x3816d2['on'](_0x52aa('0x10'),function(_0x2a91a7){var _0x2db94d=new Buffer(_0x36dcb2[_0x52aa('0x17')](_0x2a91a7),'binary');_0x38e6dd[_0x52aa('0x11')](_0x2db94d);});_0x3816d2['on'](_0x52aa('0x12'),function(){try{var _0x32ac4d=new Buffer(_0x36dcb2[_0x52aa('0x18')](_0x52aa('0x13')),'binary');_0x38e6dd[_0x52aa('0x11')](_0x32ac4d);_0x38e6dd[_0x52aa('0x12')]();_0x38e6dd['on']('close',function(){return _0x2ffe8d(_0x4626b4);});}catch(_0x54c4b5){fs[_0x52aa('0x14')](_0x4626b4);return _0x43d660(_0x54c4b5);}});});};exports[_0x52aa('0x19')]=function(_0x32c46f,_0x1f5d0e,_0x33e144){var _0x47465d=_0x33e144||stringOptions[_0x52aa('0x7')];var _0x18a22d=_0x1f5d0e||stringOptions[_0x52aa('0x1a')];var _0x493ac7=crypto[_0x52aa('0xf')](_0x47465d,_0x18a22d);var _0x86a83c=_0x493ac7[_0x52aa('0x17')](_0x32c46f,_0x52aa('0x1b'),_0x52aa('0x1c'));_0x86a83c+=_0x493ac7[_0x52aa('0x18')](_0x52aa('0x1c'));return _0x86a83c;};exports[_0x52aa('0x1d')]=function(_0x3933f8,_0x4521b9,_0x547060){var _0x376792=_0x547060||stringOptions[_0x52aa('0x7')];var _0x2d0662=_0x4521b9||stringOptions[_0x52aa('0x1a')];var _0x19900b=crypto[_0x52aa('0x16')](_0x376792,_0x2d0662);var _0x4d1f97=_0x19900b[_0x52aa('0x17')](_0x3933f8,_0x52aa('0x1c'),_0x52aa('0x1b'));_0x4d1f97+=_0x19900b[_0x52aa('0x18')]('utf8');return _0x4d1f97;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d0d8c47..c40c479 100644 --- a/server/components/export/csv.js +++ b/server/components/export/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27eb=['%s%d.%s','%s.%s','csv','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT','num','Empty','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','length'];(function(_0x157f56,_0x2f6e64){var _0x4bd40f=function(_0x3e0083){while(--_0x3e0083){_0x157f56['push'](_0x157f56['shift']());}};_0x4bd40f(++_0x2f6e64);}(_0x27eb,0xd3));var _0xb27e=function(_0x234606,_0x38306d){_0x234606=_0x234606-0x0;var _0x565687=_0x27eb[_0x234606];return _0x565687;};'use strict';var util=require('util');var path=require(_0xb27e('0x0'));var _=require(_0xb27e('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xb27e('0x2'));var zipdir=require(_0xb27e('0x3'));var rimraf=require(_0xb27e('0x4'));var db=require(_0xb27e('0x5'))['db'];var dbH=require('../../mysqldb')[_0xb27e('0x6')];var logger=require(_0xb27e('0x7'))(_0xb27e('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xb27e('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x55be3a,_0x15385f){var _0x14189b={'status':_0x55be3a};var _0x90ad1e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15385f){_0x14189b[_0xb27e('0xa')]=_0x15385f;}return db[_0xb27e('0xb')][_0xb27e('0xc')](_0x14189b,_0x90ad1e);}function main(){var _0x367c5e=0x1388;var _0xb5b38f;logger[_0xb27e('0xd')](util[_0xb27e('0xe')](_0xb27e('0xf'),EXTRACTED_REPORT_ID,_0xb27e('0x10')));return db[_0xb27e('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb27e('0x12'),_0xb27e('0x13')]})[_0xb27e('0x14')](function(_0x1ae1f8){if(_0x1ae1f8){_0xb5b38f=_0x1ae1f8;_0x367c5e=_0xb5b38f[_0xb27e('0x13')]||0x1388;}})['then'](function(){return dbH[_0xb27e('0x15')][_0xb27e('0x16')](util[_0xb27e('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb27e('0x15')]['QueryTypes'][_0xb27e('0x17')]});})[_0xb27e('0x14')](function(_0x31be9b){if(!_0x31be9b[0x0][_0xb27e('0x18')]){return analyticExtractedReport(_0xb27e('0x19'));}var _0x1cd269=[];var _0x223bf1=0x0;if(_0xb5b38f['split']){if(_0x31be9b&&_0x31be9b['length']){var _0x5420ac=_[_0xb27e('0x1a')](_0x31be9b[0x0]['num']/_0x367c5e);var _0x226772=Number[_0xb27e('0x1b')](_0x31be9b[0x0][_0xb27e('0x18')]/_0x367c5e)?_0x31be9b[0x0]['num']%_0x367c5e:0x0;_0x5420ac['forEach'](function(_0x26a8a1){if(_0x26a8a1>0x0){_0x223bf1+=_0x367c5e;}_0x1cd269['push'](dbH[_0xb27e('0x15')][_0xb27e('0x16')](util[_0xb27e('0xe')](_0xb27e('0x1c'),QUERY,_0x367c5e,_0x223bf1),{'type':dbH[_0xb27e('0x15')][_0xb27e('0x1d')][_0xb27e('0x17')]}));});if(_0x226772>0x0){_0x223bf1+=_0x367c5e;_0x1cd269[_0xb27e('0x1e')](dbH[_0xb27e('0x15')][_0xb27e('0x16')](util[_0xb27e('0xe')](_0xb27e('0x1c'),QUERY,_0x226772,_0x223bf1),{'type':dbH[_0xb27e('0x15')][_0xb27e('0x1d')]['SELECT']}));}}}else{_0x1cd269[_0xb27e('0x1e')](dbH['sequelize'][_0xb27e('0x16')](QUERY,{'type':dbH[_0xb27e('0x15')]['QueryTypes']['SELECT']}));}var _0x5fb28e=path[_0xb27e('0x1f')](PATH);var _0xf103e3=path[_0xb27e('0x20')](PATH,_0xb27e('0x21'));var _0x4d1bc9=_0xb5b38f[_0xb27e('0x12')]&&_0x1cd269['length']>0x1;var _0xa9e7b9=[];if(!fs[_0xb27e('0x22')](path[_0xb27e('0x23')](_0x5fb28e,_0xf103e3))&&_0x4d1bc9){fs[_0xb27e('0x24')](path[_0xb27e('0x23')](_0x5fb28e,_0xf103e3));}return BPromise[_0xb27e('0x25')](_0x1cd269,function(_0x53ad10){_0xa9e7b9[_0xb27e('0x1e')](_0x53ad10);})[_0xb27e('0x14')](function(){for(var _0x470cb2=0x0;_0x470cb2<_0xa9e7b9[_0xb27e('0x26')];_0x470cb2+=0x1){var _0x52a47e;var _0x471939=_0xa9e7b9[_0x470cb2];if(_0x4d1bc9){_0x52a47e=path[_0xb27e('0x23')](_0x5fb28e,_0xf103e3,util[_0xb27e('0xe')](_0xb27e('0x27'),_0xf103e3,_0x470cb2,'csv'));}else{_0x52a47e=path[_0xb27e('0x23')](_0x5fb28e,util[_0xb27e('0xe')](_0xb27e('0x28'),_0xf103e3,_0xb27e('0x29')));}fs['writeFileSync'](_0x52a47e,csv(_0x471939));}})[_0xb27e('0x14')](function(){if(_0x4d1bc9){return new Promise(function(_0x53908d){zipdir(path[_0xb27e('0x23')](_0x5fb28e,_0xf103e3),{'saveTo':path[_0xb27e('0x23')](_0x5fb28e,util[_0xb27e('0xe')](_0xb27e('0x28'),_0xf103e3,_0xb27e('0x2a')))},function(_0x5c900f,_0x439ed9){rimraf(path[_0xb27e('0x23')](_0x5fb28e,_0xf103e3),function(){});_0x53908d(_0xb27e('0x2b'));});});}})[_0xb27e('0x14')](function(){logger[_0xb27e('0xd')](util[_0xb27e('0xe')](_0xb27e('0x2c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x4d1bc9?util[_0xb27e('0xe')](_0xb27e('0x28'),_0xf103e3,_0x4d1bc9?_0xb27e('0x2a'):'csv'):null);});})[_0xb27e('0x2d')](function(_0x20b1bf){logger[_0xb27e('0xd')](util[_0xb27e('0xe')](_0xb27e('0x2e'),EXTRACTED_REPORT_ID,_0xb27e('0x10')),util[_0xb27e('0x2f')](_0x20b1bf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb27e('0x30')](function(){process[_0xb27e('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7672=['finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','Completed','zip','inspect','Failed'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x7672,0xbe));var _0x2767=function(_0x194f87,_0x1b5a7a){_0x194f87=_0x194f87-0x0;var _0x4d9788=_0x7672[_0x194f87];return _0x4d9788;};'use strict';var util=require(_0x2767('0x0'));var path=require(_0x2767('0x1'));var _=require(_0x2767('0x2'));var csv=require(_0x2767('0x3'));var fs=require('fs');var BPromise=require(_0x2767('0x4'));var zipdir=require(_0x2767('0x5'));var rimraf=require('rimraf');var db=require(_0x2767('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x2767('0x7'))(_0x2767('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2767('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x148f13,_0x5a82a9){var _0x4b916b={'status':_0x148f13};var _0x56d76a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5a82a9){_0x4b916b[_0x2767('0xa')]=_0x5a82a9;}return db[_0x2767('0xb')][_0x2767('0xc')](_0x4b916b,_0x56d76a);}function main(){var _0x14d077=0x1388;var _0x1ab6e5;logger[_0x2767('0xd')](util['format'](_0x2767('0xe'),EXTRACTED_REPORT_ID,_0x2767('0xf')));return db[_0x2767('0x10')][_0x2767('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2767('0x12'),_0x2767('0x13')]})[_0x2767('0x14')](function(_0x1323d1){if(_0x1323d1){_0x1ab6e5=_0x1323d1;_0x14d077=_0x1ab6e5[_0x2767('0x13')]||0x1388;}})['then'](function(){return dbH[_0x2767('0x15')][_0x2767('0x16')](util[_0x2767('0x17')](_0x2767('0x18'),QUERY),{'type':dbH[_0x2767('0x15')][_0x2767('0x19')][_0x2767('0x1a')]});})[_0x2767('0x14')](function(_0x3df65c){if(!_0x3df65c[0x0]['num']){return analyticExtractedReport(_0x2767('0x1b'));}var _0x122503=[];var _0x153782=0x0;if(_0x1ab6e5[_0x2767('0x12')]){if(_0x3df65c&&_0x3df65c[_0x2767('0x1c')]){var _0x12ae22=_['range'](_0x3df65c[0x0]['num']/_0x14d077);var _0x100f8d=Number['isInteger'](_0x3df65c[0x0][_0x2767('0x1d')]/_0x14d077)?_0x3df65c[0x0]['num']%_0x14d077:0x0;_0x12ae22['forEach'](function(_0x35e647){if(_0x35e647>0x0){_0x153782+=_0x14d077;}_0x122503[_0x2767('0x1e')](dbH[_0x2767('0x15')][_0x2767('0x16')](util[_0x2767('0x17')](_0x2767('0x1f'),QUERY,_0x14d077,_0x153782),{'type':dbH['sequelize'][_0x2767('0x19')][_0x2767('0x1a')]}));});if(_0x100f8d>0x0){_0x153782+=_0x14d077;_0x122503['push'](dbH[_0x2767('0x15')][_0x2767('0x16')](util[_0x2767('0x17')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x100f8d,_0x153782),{'type':dbH[_0x2767('0x15')][_0x2767('0x19')][_0x2767('0x1a')]}));}}}else{_0x122503[_0x2767('0x1e')](dbH[_0x2767('0x15')][_0x2767('0x16')](QUERY,{'type':dbH[_0x2767('0x15')]['QueryTypes']['SELECT']}));}var _0x2ddda3=path['dirname'](PATH);var _0x1fc89c=path[_0x2767('0x20')](PATH,_0x2767('0x21'));var _0xf7d8e7=_0x1ab6e5['split']&&_0x122503[_0x2767('0x1c')]>0x1;var _0x4bd9f6=[];if(!fs['existsSync'](path[_0x2767('0x22')](_0x2ddda3,_0x1fc89c))&&_0xf7d8e7){fs[_0x2767('0x23')](path[_0x2767('0x22')](_0x2ddda3,_0x1fc89c));}return BPromise[_0x2767('0x24')](_0x122503,function(_0x1e9190){_0x4bd9f6[_0x2767('0x1e')](_0x1e9190);})['then'](function(){for(var _0x499148=0x0;_0x499148<_0x4bd9f6[_0x2767('0x1c')];_0x499148+=0x1){var _0x8559f1;var _0x4bc59f=_0x4bd9f6[_0x499148];if(_0xf7d8e7){_0x8559f1=path[_0x2767('0x22')](_0x2ddda3,_0x1fc89c,util[_0x2767('0x17')](_0x2767('0x25'),_0x1fc89c,_0x499148,_0x2767('0x26')));}else{_0x8559f1=path[_0x2767('0x22')](_0x2ddda3,util['format'](_0x2767('0x27'),_0x1fc89c,'csv'));}fs[_0x2767('0x28')](_0x8559f1,csv(_0x4bc59f));}})[_0x2767('0x14')](function(){if(_0xf7d8e7){return new Promise(function(_0x1135f2){zipdir(path[_0x2767('0x22')](_0x2ddda3,_0x1fc89c),{'saveTo':path[_0x2767('0x22')](_0x2ddda3,util[_0x2767('0x17')](_0x2767('0x27'),_0x1fc89c,'zip'))},function(_0x363e90,_0x208d6d){rimraf(path[_0x2767('0x22')](_0x2ddda3,_0x1fc89c),function(){});_0x1135f2('zip\x20finished');});});}})[_0x2767('0x14')](function(){logger[_0x2767('0xd')](util[_0x2767('0x17')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2767('0xf')));return analyticExtractedReport(_0x2767('0x29'),_0xf7d8e7?util['format'](_0x2767('0x27'),_0x1fc89c,_0xf7d8e7?_0x2767('0x2a'):'csv'):null);});})['catch'](function(_0x345438){logger[_0x2767('0xd')](util[_0x2767('0x17')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2767('0xf')),util[_0x2767('0x2b')](_0x345438,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2767('0x2c'));})[_0x2767('0x2d')](function(){process[_0x2767('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 00beb3b..71bec40 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1305=['createPdfFromHTML','catch','util','path','moment','pdfmake/src/printer','zip-dir','jsdom','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','Empty','Setting','split','then','splitSizePdf','range','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','dirname','basename','.pdf','existsSync','join','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end'];(function(_0x1145c8,_0x4fed40){var _0x3aabd5=function(_0x56c985){while(--_0x56c985){_0x1145c8['push'](_0x1145c8['shift']());}};_0x3aabd5(++_0x4fed40);}(_0x1305,0x176));var _0x5130=function(_0x258d72,_0x7b072a){_0x258d72=_0x258d72-0x0;var _0x4389b2=_0x1305[_0x258d72];return _0x4389b2;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x5130('0x0'));var path=require(_0x5130('0x1'));var moment=require(_0x5130('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x5130('0x3'));var zipdir=require(_0x5130('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x5130('0x5'))['JSDOM'];var window=new JSDOM('')[_0x5130('0x6')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0x5130('0x7'))[_0x5130('0x8')];var logger=require(_0x5130('0x9'))(_0x5130('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x5130('0xb')][0x2]);var QUERY=process[_0x5130('0xb')][0x3];var PATH=process[_0x5130('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x5130('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x19e512,_0x3a6bf9){var _0x168c69={'status':_0x19e512};var _0x1b6d55={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a6bf9){_0x168c69[_0x5130('0xd')]=_0x3a6bf9;}return db['AnalyticExtractedReport'][_0x5130('0xe')](_0x168c69,_0x1b6d55);}function getHeaders(_0x9adc15){return _[_0x5130('0xf')](_0x9adc15,function(_0x33e3e8){return{'text':_0x33e3e8,'style':_0x5130('0x10')};});}function getRows(_0x528535,_0x1ae87a){return _['map'](_0x1ae87a,function(_0x12781b){return _(_0x12781b)[_0x5130('0x11')](_0x528535)[_0x5130('0xf')](function(_0x42cdd2){return _0x42cdd2?_[_0x5130('0x12')](_0x42cdd2):'';})[_0x5130('0x13')]();});}function createTable(_0x3c47e,_0x26d7bb){var _0x4e6efd={'widths':_[_0x5130('0x14')](Array(_0x3c47e[_0x5130('0x15')]),0x91),'heights':function(_0x1f2f42){return _0x1f2f42===0x0?_0x5130('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x38655b=getHeaders(_0x3c47e);_0x4e6efd['body']['push'](_0x38655b);var _0xf22027=getRows(_0x3c47e,_0x26d7bb);_0x4e6efd['body']=_0x4e6efd[_0x5130('0x17')][_0x5130('0x18')](_0xf22027);return _0x4e6efd;}function createTables(_0xed380d){var _0x2a90b5=[];var _0x43c7d9=_[_0x5130('0x19')](Object[_0x5130('0x1a')](_0xed380d[0x0]),0x5);_0x43c7d9[_0x5130('0x1b')](function(_0x151557){_0x2a90b5[_0x5130('0x1c')](createTable(_0x151557,_0xed380d));});return _0x2a90b5;}function getPDFDocDefinition(_0x59aa67){var _0x30d8ff=util[_0x5130('0x1d')](_0x5130('0x1e'),NAME,EXTRACTED_REPORT[_0x5130('0x1f')],moment(EXTRACTED_REPORT[_0x5130('0x20')])[_0x5130('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x5130('0x21')])[_0x5130('0x1d')](FORMAT));var _0x16e638=[];for(var _0xf5c98b=0x0;_0xf5c98b<_0x59aa67[_0x5130('0x15')];_0xf5c98b++){var _0x571ee6=[];if(_0xf5c98b===0x0){_0x571ee6[_0x5130('0x1c')]({'text':_0x30d8ff,'style':_0x5130('0x22')});}var _0x31b05d={'table':_0x59aa67[_0xf5c98b]};if(_0xf5c98b>0x0){_0x31b05d[_0x5130('0x23')]='before';_0x31b05d[_0x5130('0x24')]=[0x0,0x46,0x0,0x0];}_0x571ee6['push'](_0x31b05d);_0x16e638['push'](_0x571ee6);}return{'pageSize':'A4','pageOrientation':_0x5130('0x25'),'content':_0x16e638,'footer':function(_0xfc855e,_0x40cc32){return{'text':_0xfc855e['toString']()+_0x5130('0x26')+_0x40cc32,'style':_0x5130('0x27')};},'defaultStyle':{'font':_0x5130('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x5130('0x29')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4f520a){var _0x139e16=0x1388;var _0x2fe059;if(!_0x4f520a[0x0]['num']){return analyticExtractedReport(_0x5130('0x2a'));}return db[_0x5130('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5130('0x2c'),'splitSizePdf']})[_0x5130('0x2d')](function(_0x233fa8){if(_0x233fa8){_0x2fe059=_0x233fa8;_0x139e16=_0x2fe059[_0x5130('0x2e')]||0x3e8;}})[_0x5130('0x2d')](function(){var _0x2985f9=[];var _0x438d1b=0x0;if(_0x2fe059[_0x5130('0x2c')]){if(_0x4f520a&&_0x4f520a[_0x5130('0x15')]){var _0x44801e=_[_0x5130('0x2f')](_0x4f520a[0x0][_0x5130('0x30')]/_0x139e16);var _0x17d1da=Number['isInteger'](_0x4f520a[0x0][_0x5130('0x30')]/_0x139e16)?_0x4f520a[0x0][_0x5130('0x30')]%_0x139e16:0x0;_0x44801e[_0x5130('0x1b')](function(_0x53c028){if(_0x53c028>0x0){_0x438d1b+=_0x139e16;}_0x2985f9['push'](dbH['sequelize'][_0x5130('0x31')](util[_0x5130('0x1d')](_0x5130('0x32'),QUERY,_0x139e16,_0x438d1b),{'type':dbH['sequelize'][_0x5130('0x33')][_0x5130('0x34')]}));});if(_0x17d1da>0x0){_0x438d1b+=_0x139e16;_0x2985f9[_0x5130('0x1c')](dbH[_0x5130('0x35')]['query'](util['format'](_0x5130('0x32'),QUERY,_0x17d1da,_0x438d1b),{'type':dbH[_0x5130('0x35')][_0x5130('0x33')][_0x5130('0x34')]}));}}}else{_0x2985f9[_0x5130('0x1c')](dbH[_0x5130('0x35')][_0x5130('0x31')](QUERY,{'type':dbH[_0x5130('0x35')][_0x5130('0x33')]['SELECT']}));}var _0x3af74c=path[_0x5130('0x36')](PATH);var _0x23d23c=path[_0x5130('0x37')](PATH,_0x5130('0x38'));var _0x13cfcf=_0x2fe059[_0x5130('0x2c')]&&_0x2985f9[_0x5130('0x15')]>0x1;var _0x218623=[];if(!fs[_0x5130('0x39')](path['join'](_0x3af74c,_0x23d23c))&&_0x13cfcf){fs['mkdirSync'](path[_0x5130('0x3a')](_0x3af74c,_0x23d23c));}return BPromise['each'](_0x2985f9,function(_0x13cc8a){_0x218623[_0x5130('0x1c')](_0x13cc8a);})[_0x5130('0x2d')](function(){var _0x38adcb=[];for(var _0x5992b3=0x0;_0x5992b3<_0x218623[_0x5130('0x15')];_0x5992b3+=0x1){var _0x4fddde=_0x218623[_0x5992b3];var _0x2f9244=createTables(_[_0x5130('0x3b')](_0x4fddde));var _0x35c678;var _0x586bcc=getPDFDocDefinition(_0x2f9244);var _0x2b724a=getPDFPrinter();var _0x2d1578=_0x2b724a[_0x5130('0x3c')](_0x586bcc);if(_0x13cfcf){_0x35c678=path[_0x5130('0x3a')](_0x3af74c,_0x23d23c,util['format'](_0x5130('0x3d'),_0x23d23c,_0x5992b3,_0x5130('0x3e')));}else{_0x35c678=path[_0x5130('0x3a')](_0x3af74c,util[_0x5130('0x1d')](_0x5130('0x3f'),_0x23d23c,_0x5130('0x3e')));}_0x38adcb[_0x5130('0x1c')](writePDFDocument(_0x2d1578,_0x35c678));}return Promise[_0x5130('0x40')](_0x38adcb);})[_0x5130('0x2d')](function(){if(_0x13cfcf){return new Promise(function(_0x571df4){zipdir(path[_0x5130('0x3a')](_0x3af74c,_0x23d23c),{'saveTo':path['join'](_0x3af74c,util[_0x5130('0x1d')](_0x5130('0x3f'),_0x23d23c,_0x5130('0x41')))},function(){rimraf(path[_0x5130('0x3a')](_0x3af74c,_0x23d23c),function(){});_0x571df4(_0x5130('0x42'));});});}})['then'](function(){if(!_0x13cfcf)return;rimraf(path[_0x5130('0x3a')](_0x3af74c,_0x23d23c),function(){});})[_0x5130('0x2d')](function(){logger['info'](util[_0x5130('0x1d')](_0x5130('0x43'),EXTRACTED_REPORT_ID,_0x5130('0x44')));return analyticExtractedReport(_0x5130('0x45'),_0x13cfcf?util[_0x5130('0x1d')](_0x5130('0x3f'),_0x23d23c,_0x13cfcf?_0x5130('0x41'):_0x5130('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x5130('0x1d')](_0x5130('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x5130('0x47')][_0x5130('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x5130('0x2d')](function(_0x38adb3){EXTRACTED_REPORT=_0x38adb3;return dbH['sequelize'][_0x5130('0x31')](util[_0x5130('0x1d')](_0x5130('0x49'),QUERY),{'type':dbH[_0x5130('0x35')][_0x5130('0x33')]['SELECT']});})['then'](extractReport)['catch'](function(_0xcdb430){logger[_0x5130('0x4a')](util[_0x5130('0x1d')](_0x5130('0x4b'),EXTRACTED_REPORT_ID,'PDF'),util[_0x5130('0x4c')](_0xcdb430,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x5130('0x4d')](function(){process[_0x5130('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x883a17=new PdfPrinter({'Arial':{'normal':__dirname+_0x5130('0x4f'),'bold':__dirname+_0x5130('0x50'),'italics':__dirname+_0x5130('0x51'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x883a17;}function getPDFDocDefinitionFromHTML(_0x19e94f,_0x300346){var _0xebb67e=util[_0x5130('0x1d')](_0x5130('0x52'),_0x300346['channel'],_0x300346['interactionId']);var _0xb93a27=moment()[_0x5130('0x1d')](_0x5130('0x53'))[_0x5130('0x12')]();var _0x23e949=htmlToPdfmake(_0x19e94f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x23e949],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x5130('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x5130('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x5130('0x54')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x5130('0x22')}];},'footer':function(_0x10212a,_0x19552a){return[{'text':util[_0x5130('0x1d')](_0x5130('0x55'),_0xebb67e,_0x10212a,_0x19552a,_0xb93a27),'style':_0x5130('0x27')}];}};}function writePDFDocument(_0x384362,_0x517ab7){return new Promise(function(_0x212848,_0x2ba61d){var _0x99b367=_0x384362[_0x5130('0x56')](fs[_0x5130('0x57')](_0x517ab7));_0x99b367['on']('finish',function(){_0x212848(_0x5130('0x58'));});_0x99b367['on'](_0x5130('0x59'),function(_0x3b6172){_0x2ba61d(_0x3b6172);});_0x384362[_0x5130('0x5a')]();});}exports[_0x5130('0x5b')]=function(_0x38f8ff,_0x922e79){var _0x49bc48=getPDFPrinter();var _0x41e44d=getPDFDocDefinitionFromHTML(_0x38f8ff,_0x922e79);var _0x265cc1=_0x49bc48[_0x5130('0x3c')](_0x41e44d);return writePDFDocument(_0x265cc1,_0x922e79['path'])[_0x5130('0x5c')](function(_0x3337d7){throw _0x3337d7;});}; \ No newline at end of file +var _0x62da=['startDate','header','pageBreak','before','margin','push','landscape','\x20/\x20','footer','Arial','black','num','Empty','Setting','find','split','splitSizePdf','then','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','toString','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','fill','length','auto','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name'];(function(_0x394536,_0x452fc2){var _0x41f38e=function(_0x30523b){while(--_0x30523b){_0x394536['push'](_0x394536['shift']());}};_0x41f38e(++_0x452fc2);}(_0x62da,0x1ab));var _0xa62d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62da[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa62d('0x0'));var fs=require('fs');var util=require(_0xa62d('0x1'));var path=require(_0xa62d('0x2'));var moment=require(_0xa62d('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xa62d('0x4'));var zipdir=require(_0xa62d('0x5'));var rimraf=require(_0xa62d('0x6'));var JSDOM=require(_0xa62d('0x7'))[_0xa62d('0x8')];var window=new JSDOM('')[_0xa62d('0x9')];var BPromise=require('bluebird');var db=require(_0xa62d('0xa'))['db'];var dbH=require(_0xa62d('0xa'))[_0xa62d('0xb')];var logger=require(_0xa62d('0xc'))(_0xa62d('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xa62d('0xe')][0x2]);var QUERY=process[_0xa62d('0xe')][0x3];var PATH=process[_0xa62d('0xe')][0x4];var NAME=process[_0xa62d('0xe')][0x5];var FORMAT=_0xa62d('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3c4b9c,_0x5456ef){var _0x447bfe={'status':_0x3c4b9c};var _0x1061e9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5456ef){_0x447bfe[_0xa62d('0x10')]=_0x5456ef;}return db[_0xa62d('0x11')][_0xa62d('0x12')](_0x447bfe,_0x1061e9);}function getHeaders(_0x2de7d1){return _[_0xa62d('0x13')](_0x2de7d1,function(_0x376633){return{'text':_0x376633,'style':_0xa62d('0x14')};});}function getRows(_0x46c384,_0x2e919d){return _['map'](_0x2e919d,function(_0x4e4afc){return _(_0x4e4afc)[_0xa62d('0x15')](_0x46c384)[_0xa62d('0x13')](function(_0x251522){return _0x251522?_['toString'](_0x251522):'';})['value']();});}function createTable(_0x474451,_0x3aa430){var _0x350582={'widths':_[_0xa62d('0x16')](Array(_0x474451[_0xa62d('0x17')]),0x91),'heights':function(_0x587b73){return _0x587b73===0x0?_0xa62d('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x68056f=getHeaders(_0x474451);_0x350582['body']['push'](_0x68056f);var _0xc747e=getRows(_0x474451,_0x3aa430);_0x350582[_0xa62d('0x19')]=_0x350582['body'][_0xa62d('0x1a')](_0xc747e);return _0x350582;}function createTables(_0x3671ef){var _0x148d07=[];var _0x1d24a5=_[_0xa62d('0x1b')](Object[_0xa62d('0x1c')](_0x3671ef[0x0]),0x5);_0x1d24a5[_0xa62d('0x1d')](function(_0x37a284){_0x148d07['push'](createTable(_0x37a284,_0x3671ef));});return _0x148d07;}function getPDFDocDefinition(_0x357fef){var _0x530eb9=util[_0xa62d('0x1e')](_0xa62d('0x1f'),NAME,EXTRACTED_REPORT[_0xa62d('0x20')],moment(EXTRACTED_REPORT[_0xa62d('0x21')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x173b99=[];for(var _0x5ac5c1=0x0;_0x5ac5c1<_0x357fef['length'];_0x5ac5c1++){var _0xd24ad9=[];if(_0x5ac5c1===0x0){_0xd24ad9['push']({'text':_0x530eb9,'style':_0xa62d('0x22')});}var _0x33c9ff={'table':_0x357fef[_0x5ac5c1]};if(_0x5ac5c1>0x0){_0x33c9ff[_0xa62d('0x23')]=_0xa62d('0x24');_0x33c9ff[_0xa62d('0x25')]=[0x0,0x46,0x0,0x0];}_0xd24ad9[_0xa62d('0x26')](_0x33c9ff);_0x173b99[_0xa62d('0x26')](_0xd24ad9);}return{'pageSize':'A4','pageOrientation':_0xa62d('0x27'),'content':_0x173b99,'footer':function(_0x27a217,_0x23f39b){return{'text':_0x27a217['toString']()+_0xa62d('0x28')+_0x23f39b,'style':_0xa62d('0x29')};},'defaultStyle':{'font':_0xa62d('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa62d('0x2b')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x216d73){var _0x205dec=0x1388;var _0x20aeb0;if(!_0x216d73[0x0][_0xa62d('0x2c')]){return analyticExtractedReport(_0xa62d('0x2d'));}return db[_0xa62d('0x2e')][_0xa62d('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa62d('0x30'),_0xa62d('0x31')]})[_0xa62d('0x32')](function(_0x282985){if(_0x282985){_0x20aeb0=_0x282985;_0x205dec=_0x20aeb0[_0xa62d('0x31')]||0x3e8;}})[_0xa62d('0x32')](function(){var _0x2bd229=[];var _0x4829a5=0x0;if(_0x20aeb0[_0xa62d('0x30')]){if(_0x216d73&&_0x216d73[_0xa62d('0x17')]){var _0x3c7d85=_[_0xa62d('0x33')](_0x216d73[0x0]['num']/_0x205dec);var _0x2cd2d7=Number['isInteger'](_0x216d73[0x0][_0xa62d('0x2c')]/_0x205dec)?_0x216d73[0x0][_0xa62d('0x2c')]%_0x205dec:0x0;_0x3c7d85[_0xa62d('0x1d')](function(_0x33c96c){if(_0x33c96c>0x0){_0x4829a5+=_0x205dec;}_0x2bd229['push'](dbH[_0xa62d('0x34')][_0xa62d('0x35')](util['format'](_0xa62d('0x36'),QUERY,_0x205dec,_0x4829a5),{'type':dbH['sequelize'][_0xa62d('0x37')]['SELECT']}));});if(_0x2cd2d7>0x0){_0x4829a5+=_0x205dec;_0x2bd229['push'](dbH['sequelize'][_0xa62d('0x35')](util[_0xa62d('0x1e')](_0xa62d('0x36'),QUERY,_0x2cd2d7,_0x4829a5),{'type':dbH['sequelize']['QueryTypes'][_0xa62d('0x38')]}));}}}else{_0x2bd229[_0xa62d('0x26')](dbH[_0xa62d('0x34')][_0xa62d('0x35')](QUERY,{'type':dbH[_0xa62d('0x34')][_0xa62d('0x37')]['SELECT']}));}var _0x5e2c8b=path[_0xa62d('0x39')](PATH);var _0x4ebe5b=path[_0xa62d('0x3a')](PATH,'.pdf');var _0x311062=_0x20aeb0[_0xa62d('0x30')]&&_0x2bd229[_0xa62d('0x17')]>0x1;var _0x336896=[];if(!fs[_0xa62d('0x3b')](path['join'](_0x5e2c8b,_0x4ebe5b))&&_0x311062){fs['mkdirSync'](path[_0xa62d('0x3c')](_0x5e2c8b,_0x4ebe5b));}return BPromise[_0xa62d('0x3d')](_0x2bd229,function(_0x3d203d){_0x336896[_0xa62d('0x26')](_0x3d203d);})[_0xa62d('0x32')](function(){var _0x469599=[];for(var _0x1379f1=0x0;_0x1379f1<_0x336896[_0xa62d('0x17')];_0x1379f1+=0x1){var _0x4346bf=_0x336896[_0x1379f1];var _0x58f95e=createTables(_[_0xa62d('0x3e')](_0x4346bf));var _0x4c0f0b;var _0x34a4a9=getPDFDocDefinition(_0x58f95e);var _0x25514f=getPDFPrinter();var _0x588d47=_0x25514f[_0xa62d('0x3f')](_0x34a4a9);if(_0x311062){_0x4c0f0b=path[_0xa62d('0x3c')](_0x5e2c8b,_0x4ebe5b,util['format'](_0xa62d('0x40'),_0x4ebe5b,_0x1379f1,_0xa62d('0x41')));}else{_0x4c0f0b=path['join'](_0x5e2c8b,util['format'](_0xa62d('0x42'),_0x4ebe5b,'pdf'));}_0x469599['push'](writePDFDocument(_0x588d47,_0x4c0f0b));}return Promise['all'](_0x469599);})['then'](function(){if(_0x311062){return new Promise(function(_0x38edf1){zipdir(path[_0xa62d('0x3c')](_0x5e2c8b,_0x4ebe5b),{'saveTo':path['join'](_0x5e2c8b,util[_0xa62d('0x1e')](_0xa62d('0x42'),_0x4ebe5b,'zip'))},function(){rimraf(path['join'](_0x5e2c8b,_0x4ebe5b),function(){});_0x38edf1(_0xa62d('0x43'));});});}})['then'](function(){if(!_0x311062)return;rimraf(path['join'](_0x5e2c8b,_0x4ebe5b),function(){});})[_0xa62d('0x32')](function(){logger['info'](util[_0xa62d('0x1e')](_0xa62d('0x44'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x311062?util[_0xa62d('0x1e')](_0xa62d('0x42'),_0x4ebe5b,_0x311062?_0xa62d('0x45'):_0xa62d('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa62d('0x46')](util[_0xa62d('0x1e')](_0xa62d('0x47'),EXTRACTED_REPORT_ID,_0xa62d('0x48')));return db[_0xa62d('0x11')][_0xa62d('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa62d('0x32')](function(_0x3edf80){EXTRACTED_REPORT=_0x3edf80;return dbH[_0xa62d('0x34')][_0xa62d('0x35')](util[_0xa62d('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xa62d('0x34')][_0xa62d('0x37')][_0xa62d('0x38')]});})[_0xa62d('0x32')](extractReport)[_0xa62d('0x4a')](function(_0x24b343){logger[_0xa62d('0x46')](util[_0xa62d('0x1e')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa62d('0x48')),util['inspect'](_0x24b343,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa62d('0x4b')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x136cad=new PdfPrinter({'Arial':{'normal':__dirname+_0xa62d('0x4c'),'bold':__dirname+_0xa62d('0x4d'),'italics':__dirname+_0xa62d('0x4e'),'bolditalics':__dirname+_0xa62d('0x4f')}});return _0x136cad;}function getPDFDocDefinitionFromHTML(_0x2662c3,_0x3d49ee){var _0x19b256=util['format'](_0xa62d('0x50'),_0x3d49ee[_0xa62d('0x51')],_0x3d49ee[_0xa62d('0x52')]);var _0x392a9a=moment()[_0xa62d('0x1e')]('YYYY-MM-DD')[_0xa62d('0x53')]();var _0x1bc935=htmlToPdfmake(_0x2662c3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1bc935],'defaultStyle':{'font':_0xa62d('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa62d('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa62d('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa62d('0x54')}},'header':function(){return[{'text':_0xa62d('0x55'),'style':'header'}];},'footer':function(_0x130a23,_0x3e4b7d){return[{'text':util['format'](_0xa62d('0x56'),_0x19b256,_0x130a23,_0x3e4b7d,_0x392a9a),'style':_0xa62d('0x29')}];}};}function writePDFDocument(_0x5abc16,_0x3bfc15){return new Promise(function(_0x1848a3,_0x1b262c){var _0x34d7c1=_0x5abc16['pipe'](fs[_0xa62d('0x57')](_0x3bfc15));_0x34d7c1['on']('finish',function(){_0x1848a3(_0xa62d('0x58'));});_0x34d7c1['on'](_0xa62d('0x59'),function(_0x523081){_0x1b262c(_0x523081);});_0x5abc16[_0xa62d('0x5a')]();});}exports[_0xa62d('0x5b')]=function(_0x53e70d,_0x1fcb4f){var _0x10d462=getPDFPrinter();var _0x2fa26c=getPDFDocDefinitionFromHTML(_0x53e70d,_0x1fcb4f);var _0x5bab54=_0x10d462['createPdfKitDocument'](_0x2fa26c);return writePDFDocument(_0x5bab54,_0x1fcb4f[_0xa62d('0x2')])[_0xa62d('0x4a')](function(_0x12c916){throw _0x12c916;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 6802c9d..e80dc8a 100644 --- a/server/components/export/xlsx.js +++ b/server/components/export/xlsx.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2791=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','length','range','isInteger','forEach','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','xlsx','%s.%s','zip','zip\x20finished','XLSX','Completed'];(function(_0x261f3d,_0x175680){var _0x574b9a=function(_0x74376d){while(--_0x74376d){_0x261f3d['push'](_0x261f3d['shift']());}};_0x574b9a(++_0x175680);}(_0x2791,0x100));var _0x1279=function(_0x47f588,_0x2372b5){_0x47f588=_0x47f588-0x0;var _0x4f93a9=_0x2791[_0x47f588];return _0x4f93a9;};'use strict';var util=require(_0x1279('0x0'));var path=require(_0x1279('0x1'));var _=require(_0x1279('0x2'));var fs=require('fs');var json2xls=require(_0x1279('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x1279('0x4'));var rimraf=require(_0x1279('0x5'));var db=require(_0x1279('0x6'))['db'];var dbH=require(_0x1279('0x6'))[_0x1279('0x7')];var logger=require(_0x1279('0x8'))(_0x1279('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1279('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x880f5d,_0x2be205){var _0x1e1e64={'status':_0x880f5d};var _0x1f9ebe={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2be205){_0x1e1e64[_0x1279('0xb')]=_0x2be205;}return db[_0x1279('0xc')][_0x1279('0xd')](_0x1e1e64,_0x1f9ebe);}function main(){var _0x2d4e2e=0x1388;var _0xffc4be;logger[_0x1279('0xe')](util[_0x1279('0xf')](_0x1279('0x10'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x1279('0x11')][_0x1279('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1279('0x13'),_0x1279('0x14')]})[_0x1279('0x15')](function(_0x25291b){if(_0x25291b){_0xffc4be=_0x25291b;_0x2d4e2e=_0xffc4be[_0x1279('0x14')]||0x1388;}})[_0x1279('0x15')](function(){return dbH[_0x1279('0x16')][_0x1279('0x17')](util['format'](_0x1279('0x18'),QUERY),{'type':dbH[_0x1279('0x16')][_0x1279('0x19')]['SELECT']});})[_0x1279('0x15')](function(_0x31125e){if(!_0x31125e[0x0][_0x1279('0x1a')]){return analyticExtractedReport('Empty');}var _0xeebf04=[];var _0x53eaef=0x0;if(_0xffc4be[_0x1279('0x13')]){if(_0x31125e&&_0x31125e[_0x1279('0x1b')]){var _0x1f6fb8=_[_0x1279('0x1c')](_0x31125e[0x0][_0x1279('0x1a')]/_0x2d4e2e);var _0x28234a=Number[_0x1279('0x1d')](_0x31125e[0x0]['num']/_0x2d4e2e)?_0x31125e[0x0][_0x1279('0x1a')]%_0x2d4e2e:0x0;_0x1f6fb8[_0x1279('0x1e')](function(_0x41f6a5){if(_0x41f6a5>0x0){_0x53eaef+=_0x2d4e2e;}_0xeebf04['push'](dbH[_0x1279('0x16')]['query'](util[_0x1279('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2d4e2e,_0x53eaef),{'type':dbH[_0x1279('0x16')][_0x1279('0x19')][_0x1279('0x1f')]}));});if(_0x28234a>0x0){_0x53eaef+=_0x2d4e2e;_0xeebf04['push'](dbH[_0x1279('0x16')][_0x1279('0x17')](util[_0x1279('0xf')](_0x1279('0x20'),QUERY,_0x28234a,_0x53eaef),{'type':dbH['sequelize'][_0x1279('0x19')][_0x1279('0x1f')]}));}}}else{_0xeebf04[_0x1279('0x21')](dbH['sequelize'][_0x1279('0x17')](QUERY,{'type':dbH[_0x1279('0x16')]['QueryTypes'][_0x1279('0x1f')]}));}var _0x8b2bf0=path[_0x1279('0x22')](PATH);var _0x45750c=path[_0x1279('0x23')](PATH,_0x1279('0x24'));var _0x49602b=_0xffc4be[_0x1279('0x13')]&&_0xeebf04[_0x1279('0x1b')]>0x1;var _0x52e179=[];if(!fs['existsSync'](path['join'](_0x8b2bf0,_0x45750c))&&_0x49602b){fs['mkdirSync'](path['join'](_0x8b2bf0,_0x45750c));}return BPromise['each'](_0xeebf04,function(_0x546bb2){_0x52e179[_0x1279('0x21')](_0x546bb2);})[_0x1279('0x15')](function(){for(var _0x34b161=0x0;_0x34b161<_0x52e179[_0x1279('0x1b')];_0x34b161+=0x1){var _0x5c0485;var _0x336c06=_0x52e179[_0x34b161];if(_0x49602b){_0x5c0485=path[_0x1279('0x25')](_0x8b2bf0,_0x45750c,util['format']('%s%d.%s',_0x45750c,_0x34b161,_0x1279('0x26')));}else{_0x5c0485=path[_0x1279('0x25')](_0x8b2bf0,util[_0x1279('0xf')](_0x1279('0x27'),_0x45750c,_0x1279('0x26')));}fs['writeFileSync'](_0x5c0485,json2xls(_0x336c06),'binary');}})[_0x1279('0x15')](function(){if(_0x49602b){return new Promise(function(_0x3bff02){zipdir(path[_0x1279('0x25')](_0x8b2bf0,_0x45750c),{'saveTo':path[_0x1279('0x25')](_0x8b2bf0,util[_0x1279('0xf')]('%s.%s',_0x45750c,_0x1279('0x28')))},function(_0x538575,_0x35cf44){rimraf(path[_0x1279('0x25')](_0x8b2bf0,_0x45750c),function(){});_0x3bff02(_0x1279('0x29'));});});}})['then'](function(){logger[_0x1279('0xe')](util[_0x1279('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1279('0x2a')));return analyticExtractedReport(_0x1279('0x2b'),_0x49602b?util['format'](_0x1279('0x27'),_0x45750c,_0x49602b?_0x1279('0x28'):'xlsx'):null);});})[_0x1279('0x2c')](function(_0x3847a3){logger[_0x1279('0xe')](util[_0x1279('0xf')](_0x1279('0x2d'),EXTRACTED_REPORT_ID,_0x1279('0x2a')),util[_0x1279('0x2e')](_0x3847a3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1279('0x2f'));})[_0x1279('0x30')](function(){process[_0x1279('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8a17=['zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','.xlsx','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Failed','finally','exit','util','json2xls','bluebird'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0x8a17,0x135));var _0x78a1=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x8a17[_0x393d69];return _0x3cee37;};'use strict';var util=require(_0x78a1('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0x78a1('0x1'));var BPromise=require(_0x78a1('0x2'));var zipdir=require(_0x78a1('0x3'));var rimraf=require(_0x78a1('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x78a1('0x5'))[_0x78a1('0x6')];var logger=require(_0x78a1('0x7'))(_0x78a1('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x78a1('0x9')][0x2]);var QUERY=process[_0x78a1('0x9')][0x3];var PATH=process[_0x78a1('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x33da2b,_0x5ad6e2){var _0x2fde61={'status':_0x33da2b};var _0x11fb7f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ad6e2){_0x2fde61[_0x78a1('0xa')]=_0x5ad6e2;}return db[_0x78a1('0xb')]['update'](_0x2fde61,_0x11fb7f);}function main(){var _0x141fb9=0x1388;var _0x27c9aa;logger[_0x78a1('0xc')](util[_0x78a1('0xd')](_0x78a1('0xe'),EXTRACTED_REPORT_ID,_0x78a1('0xf')));return db[_0x78a1('0x10')][_0x78a1('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x78a1('0x12')]})[_0x78a1('0x13')](function(_0x484fad){if(_0x484fad){_0x27c9aa=_0x484fad;_0x141fb9=_0x27c9aa[_0x78a1('0x12')]||0x1388;}})['then'](function(){return dbH[_0x78a1('0x14')][_0x78a1('0x15')](util['format'](_0x78a1('0x16'),QUERY),{'type':dbH[_0x78a1('0x14')][_0x78a1('0x17')][_0x78a1('0x18')]});})[_0x78a1('0x13')](function(_0x8bb937){if(!_0x8bb937[0x0][_0x78a1('0x19')]){return analyticExtractedReport(_0x78a1('0x1a'));}var _0x23fd49=[];var _0x36a3c4=0x0;if(_0x27c9aa[_0x78a1('0x1b')]){if(_0x8bb937&&_0x8bb937[_0x78a1('0x1c')]){var _0x340f37=_[_0x78a1('0x1d')](_0x8bb937[0x0]['num']/_0x141fb9);var _0x2a1b3b=Number[_0x78a1('0x1e')](_0x8bb937[0x0][_0x78a1('0x19')]/_0x141fb9)?_0x8bb937[0x0][_0x78a1('0x19')]%_0x141fb9:0x0;_0x340f37[_0x78a1('0x1f')](function(_0x2ad9f3){if(_0x2ad9f3>0x0){_0x36a3c4+=_0x141fb9;}_0x23fd49['push'](dbH['sequelize'][_0x78a1('0x15')](util[_0x78a1('0xd')](_0x78a1('0x20'),QUERY,_0x141fb9,_0x36a3c4),{'type':dbH['sequelize'][_0x78a1('0x17')]['SELECT']}));});if(_0x2a1b3b>0x0){_0x36a3c4+=_0x141fb9;_0x23fd49[_0x78a1('0x21')](dbH['sequelize'][_0x78a1('0x15')](util['format'](_0x78a1('0x20'),QUERY,_0x2a1b3b,_0x36a3c4),{'type':dbH['sequelize'][_0x78a1('0x17')][_0x78a1('0x18')]}));}}}else{_0x23fd49[_0x78a1('0x21')](dbH[_0x78a1('0x14')][_0x78a1('0x15')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x21c890=path['dirname'](PATH);var _0x53d02a=path[_0x78a1('0x22')](PATH,_0x78a1('0x23'));var _0x37aec5=_0x27c9aa[_0x78a1('0x1b')]&&_0x23fd49['length']>0x1;var _0x42fd0f=[];if(!fs['existsSync'](path[_0x78a1('0x24')](_0x21c890,_0x53d02a))&&_0x37aec5){fs[_0x78a1('0x25')](path[_0x78a1('0x24')](_0x21c890,_0x53d02a));}return BPromise[_0x78a1('0x26')](_0x23fd49,function(_0x4125a4){_0x42fd0f['push'](_0x4125a4);})['then'](function(){for(var _0x44ac64=0x0;_0x44ac64<_0x42fd0f[_0x78a1('0x1c')];_0x44ac64+=0x1){var _0x392c6d;var _0x2b0915=_0x42fd0f[_0x44ac64];if(_0x37aec5){_0x392c6d=path[_0x78a1('0x24')](_0x21c890,_0x53d02a,util['format'](_0x78a1('0x27'),_0x53d02a,_0x44ac64,_0x78a1('0x28')));}else{_0x392c6d=path[_0x78a1('0x24')](_0x21c890,util[_0x78a1('0xd')](_0x78a1('0x29'),_0x53d02a,'xlsx'));}fs[_0x78a1('0x2a')](_0x392c6d,json2xls(_0x2b0915),_0x78a1('0x2b'));}})[_0x78a1('0x13')](function(){if(_0x37aec5){return new Promise(function(_0x59dbdf){zipdir(path[_0x78a1('0x24')](_0x21c890,_0x53d02a),{'saveTo':path['join'](_0x21c890,util[_0x78a1('0xd')]('%s.%s',_0x53d02a,'zip'))},function(_0x28ce6c,_0x4e1d1b){rimraf(path[_0x78a1('0x24')](_0x21c890,_0x53d02a),function(){});_0x59dbdf(_0x78a1('0x2c'));});});}})[_0x78a1('0x13')](function(){logger[_0x78a1('0xc')](util[_0x78a1('0xd')](_0x78a1('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x78a1('0x2e'),_0x37aec5?util[_0x78a1('0xd')](_0x78a1('0x29'),_0x53d02a,_0x37aec5?_0x78a1('0x2f'):'xlsx'):null);});})[_0x78a1('0x30')](function(_0x91dab3){logger[_0x78a1('0xc')](util[_0x78a1('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x78a1('0xf')),util['inspect'](_0x91dab3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x78a1('0x31'));})[_0x78a1('0x32')](function(){process[_0x78a1('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d98eefe..dd992ff 100644 --- a/server/components/extensions/rewrite.js +++ b/server/components/extensions/rewrite.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76e1=['destroy','bulkCreate','sortBy','error','rewrite','Interval','findAll','then','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','CDR(type)=%s','context','inbound','type','CDR(routeid)=','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','intervals','tag','outbound','callerID','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','models'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x76e1,0x1a3));var _0x176e=function(_0x4436fe,_0x46fff7){_0x4436fe=_0x4436fe-0x0;var _0xe2a681=_0x76e1[_0x4436fe];return _0xe2a681;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x3b24a1,_0x22da90){var _0xbd4692=this;return _0x3b24a1['models'][_0x176e('0x0')][_0x176e('0x1')]({'raw':!![]})[_0x176e('0x2')](function(_0x439692){_0xbd4692['intervals']=_0x439692;return _0x3b24a1['models'][_0x176e('0x3')]['findAll']({'where':{'IntervalId':_0x22da90['IntervalId']},'raw':!![]});})['then'](function(_0x17e1e4){return _0x3b24a1['models'][_0x176e('0x3')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x176e('0x4')](_0x17e1e4,_0x176e('0x5')))}},'order':[{'raw':_0x176e('0x6')}],'raw':!![]});})['then'](function(_0x4ee426){var _0x5394b7=_['filter'](_0x4ee426,{'priority':'1'});var _0x3fcafe=_[_0x176e('0x7')](_0x4ee426,{'isApp':0x1});var _0xc5cdae=_['groupBy'](_0x3fcafe,_0x176e('0x5'));var _0x2f0223=[_0x176e('0x8'),_0x176e('0x9')];var _0x416773=[];var _0x1baaff=[];for(var _0x1a7e7b in _0xc5cdae){if(_0xc5cdae[_0x176e('0xa')](_0x1a7e7b)){_0xbd4692[_0x176e('0xb')]=0x2;_0xbd4692[_0x176e('0xc')]=[];_0xbd4692[_0x176e('0xd')]=_[_0x176e('0xe')](_0x5394b7,{'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')]});_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0]['type'],'app':_0x176e('0x10'),'appdata':util[_0x176e('0x11')](_0x176e('0x12'),_0xc5cdae[_0x1a7e7b][0x0]['type']),'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0]['exten'],'priority':_0xbd4692['priority']++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});if(_0xc5cdae[_0x1a7e7b][0x0]['type']===_0x176e('0x14')){_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':_0x176e('0x10'),'appdata':_0x176e('0x16')+_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')],'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692['priority']++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});}else if(_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')]==='outbound'){if(_0xbd4692[_0x176e('0xd')]){_0xbd4692['extensions'][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':'Set','appdata':_0x176e('0x18')+(_0xbd4692['extension'][_0x176e('0x19')]?_0x176e('0x1a')+_0xbd4692['extension'][_0x176e('0x19')]+'}':_0x176e('0x1b')),'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});}_0xbd4692[_0x176e('0xc')]['push']({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':'Set','appdata':_0x176e('0x16')+_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')],'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692['priority']++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});var _0x546f7a=_0xbd4692[_0x176e('0xb')]++;_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':_0x176e('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x546f7a+0x2)+_0x176e('0x1d')+(_0x546f7a+0x1)+')','context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0x546f7a,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});if(_0xbd4692[_0x176e('0xd')]){_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0]['type'],'app':_0x176e('0x10'),'appdata':_0xbd4692['extension'][_0x176e('0x19')]?_0x176e('0x1e')+_0xbd4692[_0x176e('0xd')][_0x176e('0x19')]+'}':_0x176e('0x1f'),'context':_0xc5cdae[_0x1a7e7b][0x0]['context'],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});}_0xbd4692['extensions'][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':'Set','appdata':'outboundrouteid='+_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')],'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});if(_0xbd4692[_0x176e('0xd')]&&_0xbd4692['extension'][_0x176e('0xa')](_0x176e('0x20'))&&_0xbd4692[_0x176e('0xd')][_0x176e('0x20')]!==_0x176e('0x21')){_0xbd4692[_0x176e('0xc')]['push']({'type':_0xc5cdae[_0x1a7e7b][0x0]['type'],'app':_0x176e('0x10'),'appdata':_0x176e('0x22'),'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692['priority']++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0]['type'],'app':_0x176e('0x10'),'appdata':_0x176e('0x23')+_0xbd4692[_0x176e('0xd')][_0x176e('0x20')]||'wav','context':_0xc5cdae[_0x1a7e7b][0x0]['context'],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});}}_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':'Set','appdata':_0x176e('0x24'),'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0]['exten'],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});_0xbd4692[_0x176e('0xc')]['push']({'type':_0xc5cdae[_0x1a7e7b][0x0]['type'],'app':_0x176e('0x10'),'appdata':_0x176e('0x25'),'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});_0xbd4692[_0x176e('0xc')]['push']({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':_0x176e('0x10'),'appdata':'MONITOR_OPTIONS=ab','context':_0xc5cdae[_0x1a7e7b][0x0]['context'],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});for(var _0x3fd539=0x0,_0x60bcc1=0x0;_0x3fd539<_0xc5cdae[_0x1a7e7b][_0x176e('0x26')];_0x3fd539+=0x1,_0x60bcc1=0x0){var _0x49560c=_0xc5cdae[_0x1a7e7b][_0x3fd539];if(_0x49560c['type']){_0x49560c[_0x176e('0x15')]=_0x49560c[_0x176e('0x15')][_0x176e('0x27')]();}var _0x525816=[];var _0x4ea49c=[];delete _0x49560c['id'];delete _0x49560c[_0x176e('0x28')];delete _0x49560c[_0x176e('0x29')];var _0x18605f=_0x49560c[_0x176e('0x2a')]!==_0x176e('0x2b')?[_0x49560c['interval']]:_0x49560c[_0x176e('0x2c')]?_[_0x176e('0x4')](_[_0x176e('0x7')](_0xbd4692[_0x176e('0x2d')],{'IntervalId':_0x49560c['IntervalId']}),_0x176e('0x2a')):[];if(_0x49560c[_0x176e('0xa')](_0x176e('0x2e'))){if(_0x49560c[_0x176e('0x2e')]&&_0x49560c['tag']!=='--'){_0x525816[_0x176e('0xf')]({'type':_0x49560c[_0x176e('0x15')],'app':_0x176e('0x10'),'appdata':'CDR(tag)='+_0x49560c[_0x176e('0x2e')],'context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692[_0x176e('0xb')]+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});}}if(_0x49560c[_0x176e('0x15')]===_0x176e('0x2f')&&_0x49560c[_0x176e('0xa')](_0x176e('0x30'))){if(_0x49560c[_0x176e('0x30')]){_0x525816['push']({'type':_0x49560c[_0x176e('0x15')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x49560c['callerID']+')','context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692[_0x176e('0xb')]+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});}else{_0x525816[_0x176e('0xf')]({'type':_0x49560c[_0x176e('0x15')],'app':_0x176e('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f['length']+_0xbd4692[_0x176e('0xb')]+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});}}if(_0x49560c[_0x176e('0xa')](_0x176e('0x31'))){if(_0x2f0223['indexOf'](_0x49560c[_0x176e('0x32')]['toLowerCase']())>=0x0&&_0x49560c[_0x176e('0x33')]!==_0x176e('0x34')){if(_0x49560c[_0x176e('0x31')]){_0x525816['push']({'type':_0x49560c[_0x176e('0x15')],'app':'ExecIf','appdata':_0x176e('0x35'),'context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692[_0x176e('0xb')]+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});_0x525816[_0x176e('0xf')]({'type':_0x49560c['type'],'app':_0x176e('0x10'),'appdata':_0x176e('0x36'),'context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692[_0x176e('0xb')]+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});}else{_0x525816[_0x176e('0xf')]({'type':_0x49560c[_0x176e('0x15')],'app':_0x176e('0x1c'),'appdata':_0x176e('0x37'),'context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692['priority']+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});_0x525816[_0x176e('0xf')]({'type':_0x49560c[_0x176e('0x15')],'app':_0x176e('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x49560c['context'],'exten':_0x49560c['exten'],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692['priority']+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});}}}for(var _0x2ba158=0x0;_0x2ba158<_0x18605f['length'];_0x2ba158+=0x1){var _0x4a9c6f=_0xbd4692['priority']+_0x18605f['length'];var _0xcd9b50=_0x2ba158===_0x18605f[_0x176e('0x26')]-0x1?_0xbd4692['priority']+_0x525816[_0x176e('0x26')]+_0x4ea49c[_0x176e('0x26')]+0x2:_0xbd4692[_0x176e('0xb')]+_0x2ba158+0x1;_0x525816[_0x176e('0x38')](_0x2ba158,0x0,{'type':_0x49560c[_0x176e('0x15')],'app':_0x176e('0x39'),'appdata':_0x18605f[_0x2ba158]+'?'+_0x49560c[_0x176e('0x13')]+',${EXTEN},'+_0x4a9c6f+':'+_0x49560c[_0x176e('0x13')]+_0x176e('0x3a')+_0xcd9b50,'exten':_0x49560c[_0x176e('0x5')],'context':_0x49560c[_0x176e('0x13')],'priority':_0xbd4692['priority']+_0x2ba158,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});}_0x49560c[_0x176e('0xb')]=_0x525816[_0x176e('0x26')]?_[_0x176e('0x3b')](_0x525816)[_0x176e('0xb')]+0x1:_0xbd4692[_0x176e('0xb')];_0xbd4692['priority']=(_0x4ea49c['length']?_[_0x176e('0x3b')](_0x4ea49c)[_0x176e('0xb')]:_0x49560c[_0x176e('0xb')])+0x1;_0xbd4692[_0x176e('0xc')]=_[_0x176e('0x3c')](_0xbd4692['extensions'],_0x525816,[_0x49560c],_0x4ea49c);}_0xbd4692[_0x176e('0xc')]['push']({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':_0x176e('0x3d'),'exten':_0xc5cdae[_0x1a7e7b][0x0]['exten'],'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'priority':_0xbd4692['priority'],'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});_0x416773[_0x176e('0xf')](_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]);_0x1baaff=_['concat'](_0x1baaff,_0xbd4692[_0x176e('0xc')]);}}return _0x3b24a1[_0x176e('0x3e')](function(_0x4943ae){return _0x3b24a1[_0x176e('0x3f')][_0x176e('0x3')][_0x176e('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x416773}},'transaction':_0x4943ae})[_0x176e('0x2')](function(_0x8807b5){return _0x3b24a1[_0x176e('0x3f')][_0x176e('0x3')][_0x176e('0x41')](_[_0x176e('0x42')](_0x1baaff,'priority'),{'transaction':_0x4943ae});});});})['catch'](function(_0x9b23f3){console[_0x176e('0x43')](_0x9b23f3);});}exports[_0x176e('0x44')]=rewrite; \ No newline at end of file +var _0x9124=['context','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','catch','error','lodash','util','findAll','intervals','models','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','inbound','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}'];(function(_0xae0c01,_0x449c99){var _0x913e86=function(_0x421e87){while(--_0x421e87){_0xae0c01['push'](_0xae0c01['shift']());}};_0x913e86(++_0x449c99);}(_0x9124,0x147));var _0x4912=function(_0x671374,_0x5bd0a3){_0x671374=_0x671374-0x0;var _0x59f903=_0x9124[_0x671374];return _0x59f903;};'use strict';var _=require(_0x4912('0x0'));var util=require(_0x4912('0x1'));function rewrite(_0x3c9136,_0x7c8c45){var _0x417c8e=this;return _0x3c9136['models']['Interval'][_0x4912('0x2')]({'raw':!![]})['then'](function(_0x1fdd21){_0x417c8e[_0x4912('0x3')]=_0x1fdd21;return _0x3c9136[_0x4912('0x4')][_0x4912('0x5')][_0x4912('0x2')]({'where':{'IntervalId':_0x7c8c45[_0x4912('0x6')]},'raw':!![]});})[_0x4912('0x7')](function(_0x799b0f){return _0x3c9136[_0x4912('0x4')][_0x4912('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x4912('0x8')](_[_0x4912('0x9')](_0x799b0f,_0x4912('0xa')))}},'order':[{'raw':_0x4912('0xb')}],'raw':!![]});})['then'](function(_0x4d0741){var _0x86f32c=_[_0x4912('0xc')](_0x4d0741,{'priority':'1'});var _0x2df344=_['filter'](_0x4d0741,{'isApp':0x1});var _0x33ea26=_[_0x4912('0xd')](_0x2df344,_0x4912('0xa'));var _0xa11a1b=[_0x4912('0xe'),_0x4912('0xf')];var _0x4591c1=[];var _0x143c00=[];for(var _0x4818cf in _0x33ea26){if(_0x33ea26['hasOwnProperty'](_0x4818cf)){_0x417c8e[_0x4912('0x10')]=0x2;_0x417c8e[_0x4912('0x11')]=[];_0x417c8e[_0x4912('0x12')]=_[_0x4912('0x13')](_0x86f32c,{'exten':_0x33ea26[_0x4818cf][0x0][_0x4912('0xa')]});_0x417c8e['extensions'][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')],'app':_0x4912('0x16'),'appdata':util[_0x4912('0x17')](_0x4912('0x18'),_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')]),'context':_0x33ea26[_0x4818cf][0x0]['context'],'exten':_0x33ea26[_0x4818cf][0x0][_0x4912('0xa')],'priority':_0x417c8e[_0x4912('0x10')]++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0]['VoiceExtensionId']});if(_0x33ea26[_0x4818cf][0x0]['type']===_0x4912('0x19')){_0x417c8e[_0x4912('0x11')][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0]['type'],'app':'Set','appdata':_0x4912('0x1a')+_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')],'context':_0x33ea26[_0x4818cf][0x0]['context'],'exten':_0x33ea26[_0x4818cf][0x0][_0x4912('0xa')],'priority':_0x417c8e[_0x4912('0x10')]++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')]});}else if(_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')]===_0x4912('0x1c')){if(_0x417c8e['extension']){_0x417c8e[_0x4912('0x11')][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')],'app':_0x4912('0x16'),'appdata':_0x4912('0x1d')+(_0x417c8e['extension']['cutdigits']?_0x4912('0x1e')+_0x417c8e[_0x4912('0x12')][_0x4912('0x1f')]+'}':_0x4912('0x20')),'context':_0x33ea26[_0x4818cf][0x0][_0x4912('0x21')],'exten':_0x33ea26[_0x4818cf][0x0][_0x4912('0xa')],'priority':_0x417c8e['priority']++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')]});}_0x417c8e[_0x4912('0x11')][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')],'app':'Set','appdata':_0x4912('0x1a')+_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')],'context':_0x33ea26[_0x4818cf][0x0][_0x4912('0x21')],'exten':_0x33ea26[_0x4818cf][0x0]['exten'],'priority':_0x417c8e[_0x4912('0x10')]++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0]['VoiceExtensionId']});var _0x754ca5=_0x417c8e[_0x4912('0x10')]++;_0x417c8e[_0x4912('0x11')][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')],'app':_0x4912('0x22'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x754ca5+0x2)+'):Goto('+(_0x754ca5+0x1)+')','context':_0x33ea26[_0x4818cf][0x0]['context'],'exten':_0x33ea26[_0x4818cf][0x0]['exten'],'priority':_0x754ca5,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')]});if(_0x417c8e[_0x4912('0x12')]){_0x417c8e[_0x4912('0x11')]['push']({'type':_0x33ea26[_0x4818cf][0x0]['type'],'app':_0x4912('0x16'),'appdata':_0x417c8e[_0x4912('0x12')][_0x4912('0x1f')]?_0x4912('0x23')+_0x417c8e[_0x4912('0x12')][_0x4912('0x1f')]+'}':_0x4912('0x24'),'context':_0x33ea26[_0x4818cf][0x0]['context'],'exten':_0x33ea26[_0x4818cf][0x0][_0x4912('0xa')],'priority':_0x417c8e[_0x4912('0x10')]++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')]});}_0x417c8e[_0x4912('0x11')][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0]['type'],'app':_0x4912('0x16'),'appdata':_0x4912('0x25')+_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')],'context':_0x33ea26[_0x4818cf][0x0]['context'],'exten':_0x33ea26[_0x4818cf][0x0][_0x4912('0xa')],'priority':_0x417c8e['priority']++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0]['VoiceExtensionId']});if(_0x417c8e[_0x4912('0x12')]&&_0x417c8e['extension'][_0x4912('0x26')](_0x4912('0x27'))&&_0x417c8e['extension'][_0x4912('0x27')]!=='none'){_0x417c8e[_0x4912('0x11')][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')],'app':'Set','appdata':_0x4912('0x28'),'context':_0x33ea26[_0x4818cf][0x0][_0x4912('0x21')],'exten':_0x33ea26[_0x4818cf][0x0]['exten'],'priority':_0x417c8e['priority']++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')]});_0x417c8e[_0x4912('0x11')][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')],'app':_0x4912('0x16'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x417c8e[_0x4912('0x12')][_0x4912('0x27')]||'wav','context':_0x33ea26[_0x4818cf][0x0]['context'],'exten':_0x33ea26[_0x4818cf][0x0][_0x4912('0xa')],'priority':_0x417c8e[_0x4912('0x10')]++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0]['VoiceExtensionId']});}}_0x417c8e[_0x4912('0x11')][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')],'app':_0x4912('0x16'),'appdata':_0x4912('0x29'),'context':_0x33ea26[_0x4818cf][0x0][_0x4912('0x21')],'exten':_0x33ea26[_0x4818cf][0x0]['exten'],'priority':_0x417c8e['priority']++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')]});_0x417c8e[_0x4912('0x11')][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0]['type'],'app':_0x4912('0x16'),'appdata':_0x4912('0x2a'),'context':_0x33ea26[_0x4818cf][0x0][_0x4912('0x21')],'exten':_0x33ea26[_0x4818cf][0x0]['exten'],'priority':_0x417c8e[_0x4912('0x10')]++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')]});_0x417c8e[_0x4912('0x11')][_0x4912('0x14')]({'type':_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')],'app':'Set','appdata':_0x4912('0x2b'),'context':_0x33ea26[_0x4818cf][0x0][_0x4912('0x21')],'exten':_0x33ea26[_0x4818cf][0x0][_0x4912('0xa')],'priority':_0x417c8e[_0x4912('0x10')]++,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')]});for(var _0x22986f=0x0,_0x166027=0x0;_0x22986f<_0x33ea26[_0x4818cf][_0x4912('0x2c')];_0x22986f+=0x1,_0x166027=0x0){var _0x51caf7=_0x33ea26[_0x4818cf][_0x22986f];if(_0x51caf7[_0x4912('0x15')]){_0x51caf7[_0x4912('0x15')]=_0x51caf7[_0x4912('0x15')][_0x4912('0x2d')]();}var _0x48c91c=[];var _0x333b30=[];delete _0x51caf7['id'];delete _0x51caf7[_0x4912('0x2e')];delete _0x51caf7[_0x4912('0x2f')];var _0xe5ea82=_0x51caf7[_0x4912('0x30')]!==_0x4912('0x31')?[_0x51caf7[_0x4912('0x30')]]:_0x51caf7[_0x4912('0x6')]?_[_0x4912('0x9')](_[_0x4912('0xc')](_0x417c8e['intervals'],{'IntervalId':_0x51caf7[_0x4912('0x6')]}),'interval'):[];if(_0x51caf7[_0x4912('0x26')](_0x4912('0x32'))){if(_0x51caf7['tag']&&_0x51caf7['tag']!=='--'){_0x48c91c[_0x4912('0x14')]({'type':_0x51caf7[_0x4912('0x15')],'app':_0x4912('0x16'),'appdata':_0x4912('0x33')+_0x51caf7[_0x4912('0x32')],'context':_0x51caf7['context'],'exten':_0x51caf7['exten'],'priority':_0xe5ea82[_0x4912('0x2c')]+_0x417c8e['priority']+_0x166027++,'VoiceExtensionId':_0x51caf7[_0x4912('0x1b')]});}}if(_0x51caf7[_0x4912('0x15')]===_0x4912('0x1c')&&_0x51caf7[_0x4912('0x26')](_0x4912('0x34'))){if(_0x51caf7[_0x4912('0x34')]){_0x48c91c[_0x4912('0x14')]({'type':_0x51caf7[_0x4912('0x15')],'app':_0x4912('0x22'),'appdata':_0x4912('0x35')+_0x51caf7[_0x4912('0x34')]+')','context':_0x51caf7[_0x4912('0x21')],'exten':_0x51caf7[_0x4912('0xa')],'priority':_0xe5ea82['length']+_0x417c8e[_0x4912('0x10')]+_0x166027++,'VoiceExtensionId':_0x51caf7[_0x4912('0x1b')]});}else{_0x48c91c[_0x4912('0x14')]({'type':_0x51caf7[_0x4912('0x15')],'app':_0x4912('0x22'),'appdata':_0x4912('0x36'),'context':_0x51caf7[_0x4912('0x21')],'exten':_0x51caf7[_0x4912('0xa')],'priority':_0xe5ea82[_0x4912('0x2c')]+_0x417c8e[_0x4912('0x10')]+_0x166027++,'VoiceExtensionId':_0x51caf7[_0x4912('0x1b')]});}}if(_0x51caf7[_0x4912('0x26')](_0x4912('0x37'))){if(_0xa11a1b[_0x4912('0x38')](_0x51caf7[_0x4912('0x39')][_0x4912('0x2d')]())>=0x0&&_0x51caf7[_0x4912('0x3a')]!==_0x4912('0x3b')){if(_0x51caf7['answer']){_0x48c91c[_0x4912('0x14')]({'type':_0x51caf7['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x51caf7[_0x4912('0x21')],'exten':_0x51caf7[_0x4912('0xa')],'priority':_0xe5ea82[_0x4912('0x2c')]+_0x417c8e[_0x4912('0x10')]+_0x166027++,'VoiceExtensionId':_0x51caf7[_0x4912('0x1b')]});_0x48c91c[_0x4912('0x14')]({'type':_0x51caf7[_0x4912('0x15')],'app':'Set','appdata':_0x4912('0x3c'),'context':_0x51caf7[_0x4912('0x21')],'exten':_0x51caf7[_0x4912('0xa')],'priority':_0xe5ea82['length']+_0x417c8e[_0x4912('0x10')]+_0x166027++,'VoiceExtensionId':_0x51caf7[_0x4912('0x1b')]});}else{_0x48c91c[_0x4912('0x14')]({'type':_0x51caf7[_0x4912('0x15')],'app':'ExecIf','appdata':_0x4912('0x3d'),'context':_0x51caf7[_0x4912('0x21')],'exten':_0x51caf7['exten'],'priority':_0xe5ea82[_0x4912('0x2c')]+_0x417c8e[_0x4912('0x10')]+_0x166027++,'VoiceExtensionId':_0x51caf7[_0x4912('0x1b')]});_0x48c91c[_0x4912('0x14')]({'type':_0x51caf7[_0x4912('0x15')],'app':'Set','appdata':_0x4912('0x3e'),'context':_0x51caf7['context'],'exten':_0x51caf7[_0x4912('0xa')],'priority':_0xe5ea82[_0x4912('0x2c')]+_0x417c8e['priority']+_0x166027++,'VoiceExtensionId':_0x51caf7[_0x4912('0x1b')]});}}}for(var _0x3b0dfd=0x0;_0x3b0dfd<_0xe5ea82['length'];_0x3b0dfd+=0x1){var _0x3f8f57=_0x417c8e[_0x4912('0x10')]+_0xe5ea82[_0x4912('0x2c')];var _0x524a3d=_0x3b0dfd===_0xe5ea82['length']-0x1?_0x417c8e[_0x4912('0x10')]+_0x48c91c[_0x4912('0x2c')]+_0x333b30[_0x4912('0x2c')]+0x2:_0x417c8e[_0x4912('0x10')]+_0x3b0dfd+0x1;_0x48c91c[_0x4912('0x3f')](_0x3b0dfd,0x0,{'type':_0x51caf7['type'],'app':'GotoIfTime','appdata':_0xe5ea82[_0x3b0dfd]+'?'+_0x51caf7['context']+',${EXTEN},'+_0x3f8f57+':'+_0x51caf7[_0x4912('0x21')]+_0x4912('0x40')+_0x524a3d,'exten':_0x51caf7[_0x4912('0xa')],'context':_0x51caf7[_0x4912('0x21')],'priority':_0x417c8e[_0x4912('0x10')]+_0x3b0dfd,'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')]});}_0x51caf7[_0x4912('0x10')]=_0x48c91c[_0x4912('0x2c')]?_[_0x4912('0x41')](_0x48c91c)[_0x4912('0x10')]+0x1:_0x417c8e[_0x4912('0x10')];_0x417c8e[_0x4912('0x10')]=(_0x333b30[_0x4912('0x2c')]?_[_0x4912('0x41')](_0x333b30)[_0x4912('0x10')]:_0x51caf7[_0x4912('0x10')])+0x1;_0x417c8e['extensions']=_[_0x4912('0x42')](_0x417c8e[_0x4912('0x11')],_0x48c91c,[_0x51caf7],_0x333b30);}_0x417c8e[_0x4912('0x11')]['push']({'type':_0x33ea26[_0x4818cf][0x0][_0x4912('0x15')],'app':'Hangup','exten':_0x33ea26[_0x4818cf][0x0][_0x4912('0xa')],'context':_0x33ea26[_0x4818cf][0x0]['context'],'priority':_0x417c8e['priority'],'VoiceExtensionId':_0x33ea26[_0x4818cf][0x0]['VoiceExtensionId']});_0x4591c1[_0x4912('0x14')](_0x33ea26[_0x4818cf][0x0][_0x4912('0x1b')]);_0x143c00=_[_0x4912('0x42')](_0x143c00,_0x417c8e[_0x4912('0x11')]);}}return _0x3c9136[_0x4912('0x43')](function(_0x523805){return _0x3c9136['models']['VoiceExtension'][_0x4912('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x4591c1}},'transaction':_0x523805})[_0x4912('0x7')](function(_0x15f61a){return _0x3c9136['models']['VoiceExtension'][_0x4912('0x45')](_['sortBy'](_0x143c00,_0x4912('0x10')),{'transaction':_0x523805});});});})[_0x4912('0x46')](function(_0x278bca){console[_0x4912('0x47')](_0x278bca);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7ccc7b3..9deee0d 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5de0=['inspect','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','field','phone','ContactId','toString','NOW()','updatedAt','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','Campaign','CampaignId','all','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','../../../mysqldb','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','map','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','then','push','Error\x20while\x20creating\x20contact:\x20','message','cmContact'];(function(_0x243e4c,_0x5614b7){var _0xf2e845=function(_0x1f7dc4){while(--_0x1f7dc4){_0x243e4c['push'](_0x243e4c['shift']());}};_0xf2e845(++_0x5614b7);}(_0x5de0,0x179));var _0x05de=function(_0x3b8476,_0x1a795d){_0x3b8476=_0x3b8476-0x0;var _0x430984=_0x5de0[_0x3b8476];return _0x430984;};'use strict';var BPromise=require(_0x05de('0x0'));var util=require(_0x05de('0x1'));var _=require(_0x05de('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x05de('0x3'));var Redis=require('ioredis');var db=require(_0x05de('0x4'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('api');config[_0x05de('0x5')]=_[_0x05de('0x6')](config[_0x05de('0x5')],{'host':_0x05de('0x7'),'port':0x18eb});var socket=require(_0x05de('0x8'))(new Redis(config['redis']));require(_0x05de('0x9'))['register'](socket);try{if(!process[_0x05de('0xa')][0x2]||process[_0x05de('0xa')][0x2]===_0x05de('0xb')||process[_0x05de('0xa')][0x2]===_0x05de('0xc')){throw new Error(_0x05de('0xd'));}var FILEPATH=process[_0x05de('0xa')][0x2];if(!process[_0x05de('0xa')][0x3]||process[_0x05de('0xa')][0x3]===_0x05de('0xb')||process[_0x05de('0xa')][0x3]===_0x05de('0xc')||!process[_0x05de('0xa')][0x4]||process['argv'][0x4]===_0x05de('0xb')||process[_0x05de('0xa')][0x4]===_0x05de('0xc')){throw new Error(_0x05de('0xe'));}var FIELDS=_[_0x05de('0xf')](process['argv'][0x3][_0x05de('0x10')](','),process['argv'][0x4][_0x05de('0x10')](','));if(!process['argv'][0x5]||process[_0x05de('0xa')][0x5]==='undefined'||process[_0x05de('0xa')][0x5]===_0x05de('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x05de('0xa')][0x6]!==_0x05de('0xb')&&process[_0x05de('0xa')][0x6]!==_0x05de('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x05de('0xa')][0x7]&&process['argv'][0x7]!=='undefined'&&process['argv'][0x7]!==_0x05de('0xc')?process[_0x05de('0xa')][0x7]:null;if(!process[_0x05de('0xa')][0x8]||process[_0x05de('0xa')][0x8]===_0x05de('0xb')||process[_0x05de('0xa')][0x8]===_0x05de('0xc')){throw new Error(_0x05de('0x11'));}var SOCKET_TIMESTAMP=process[_0x05de('0xa')][0x8];}catch(_0x36f924){logger[_0x05de('0x12')](_0x36f924);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x5f231e,_0x27f7cd,_0x415e67,_0x16a82a){var _0x579224={'message':_0x27f7cd};_0x579224[_0x5f231e]=!![];if(_0x415e67){_0x579224[_0x05de('0x13')]=_0x415e67;}if(_0x16a82a){_0x579224[_0x05de('0x14')]=_0x16a82a;}return _0x579224;}function isEmail(_0x1a0374){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x05de('0x15')](_0x1a0374);}function checkRow(_0x499440,_0x2c2d74,_0x3c9562){return new BPromise(function(_0xbc8259,_0x57319c){if(_[_0x05de('0x16')](_0x499440)){return _0x57319c(handleCheckRowError(_0x05de('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3c9562));}if(_0x499440[_0x05de('0x17')]&&_0x499440[_0x05de('0x17')][_0x05de('0x18')]){var _0x53d55e=_[_0x05de('0x19')](_0x499440[_0x05de('0x17')],'message')['join'](';');return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x53d55e,null,_0x3c9562));}var _0x43813e={};for(var _0x2b3515 in FIELDS){if(FIELDS[_0x05de('0x1a')](_0x2b3515)&&FIELDS[_0x2b3515]){_0x43813e[_0x2b3515]=_0x499440[_0x05de('0x1b')][0x0][FIELDS[_0x2b3515]]||_0x499440['data'][0x0]['\ufeff'+FIELDS[_0x2b3515]];}}if(!_0x43813e['firstName']){return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x05de('0x1c'),null,_0x3c9562));}if(!_0x43813e['phone']){return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x05de('0x1d'),null,_0x3c9562));}if(_0x43813e[_0x05de('0x1e')]){var _0x5a5143=moment(_0x43813e[_0x05de('0x1e')],_0x05de('0x1f'));if(!_0x5a5143[_0x05de('0x20')]()){return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x05de('0x21'),null,_0x3c9562));}}if(_0x43813e[_0x05de('0x22')]){if(!isEmail(_0x43813e[_0x05de('0x22')])){return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x05de('0x23'),null,_0x3c9562));}}_0x43813e[_0x05de('0x24')]=LISTID;_0x43813e[_0x05de('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x05de('0x18')]&&_0x2c2d74){var _0x13b3d8={};for(var _0x4f57ce=0x0,_0xa75d2a=DUPLICATES['length'];_0x4f57ce<_0xa75d2a;_0x4f57ce+=0x1){_0x13b3d8[DUPLICATES[_0x4f57ce]]=_0x43813e[DUPLICATES[_0x4f57ce]];}var _0x19b09c=_[_0x05de('0x26')](_0x2c2d74,_0x13b3d8);if(_0x19b09c){return _0x57319c(handleCheckRowError(_0x05de('0x27'),_0x05de('0x28'),_0x19b09c,_0x3c9562));}}return db[_0x05de('0x29')]['create'](_0x43813e,{'raw':!![],'hooks':![],'fields':_['keys'](_0x43813e)})[_0x05de('0x2a')](function(_0x5f2406){if(DUPLICATES&&DUPLICATES[_0x05de('0x18')]&&_0x2c2d74){_0x2c2d74[_0x05de('0x2b')](_['pick'](_0x43813e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5f2406['id'];return _0xbc8259();})['catch'](function(_0x3726ba){return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x05de('0x2c')+(_0x3726ba[_0x05de('0x2d')]||JSON['stringify'](_0x3726ba)),null,_0x3c9562));});});}function checkHopper(){function _0x4c2c80(){return function(_0x177591){logger[_0x05de('0x12')](_0x05de('0x2e'),'checkHopper',util[_0x05de('0x2f')](_0x177591,{'showHidden':![],'depth':null}));};}var _0x4b1b0d=function(_0xad3ed4,_0x41cd35){var _0x2e0832=squel[_0x05de('0x30')]()[_0x05de('0x31')](_0x05de('0x32'))[_0x05de('0x33')](['phone',_0x05de('0x34'),'ContactId',_0x05de('0x24'),_0x41cd35,_0x05de('0x35'),'updatedAt'],squel['select']()[_0x05de('0x36')]('phone',_0x05de('0x37'))[_0x05de('0x36')]('NOW()','scheduledAt')[_0x05de('0x36')]('id',_0x05de('0x38'))[_0x05de('0x36')](LISTID[_0x05de('0x39')](),_0x05de('0x24'))['field'](_0xad3ed4['id'][_0x05de('0x39')](),_0x41cd35)[_0x05de('0x36')](_0x05de('0x3a'),_0x05de('0x35'))[_0x05de('0x36')]('NOW()',_0x05de('0x3b'))[_0x05de('0x3c')]('cm_contacts')['where'](_0x05de('0x3d'))['where'](_0x05de('0x3e'),LISTID[_0x05de('0x39')]())[_0x05de('0x3f')](_0x05de('0x40'))[_0x05de('0x3f')](_0x05de('0x41'),squel[_0x05de('0x42')]()['field'](_0x05de('0x37'))[_0x05de('0x3c')](_0x05de('0x32'))[_0x05de('0x3f')](_0x41cd35+_0x05de('0x43'),_0xad3ed4['id'][_0x05de('0x39')]())))['toString']();return _0x2e0832;};var _0x105ea9=function(_0x499a51,_0x4156e0){var _0x34a70f=squel['insert']()['into'](_0x05de('0x32'))[_0x05de('0x33')]([_0x05de('0x37'),_0x05de('0x34'),_0x05de('0x38'),_0x05de('0x24'),_0x4156e0,_0x05de('0x35'),'updatedAt'],squel[_0x05de('0x42')]()[_0x05de('0x36')]('phone',_0x05de('0x37'))['field']('NOW()',_0x05de('0x34'))[_0x05de('0x36')]('id',_0x05de('0x38'))[_0x05de('0x36')](LISTID[_0x05de('0x39')](),_0x05de('0x24'))[_0x05de('0x36')](_0x499a51['id']['toString'](),_0x4156e0)[_0x05de('0x36')]('NOW()',_0x05de('0x35'))[_0x05de('0x36')](_0x05de('0x3a'),_0x05de('0x3b'))[_0x05de('0x3c')](_0x05de('0x44'))[_0x05de('0x3f')](_0x05de('0x3d'))['where'](_0x05de('0x3e'),LISTID[_0x05de('0x39')]())[_0x05de('0x3f')](_0x05de('0x45'),squel[_0x05de('0x46')](hopperContacts))['where'](_0x05de('0x40'))[_0x05de('0x3f')](_0x05de('0x41'),squel['select']()[_0x05de('0x36')]('calleridnum')[_0x05de('0x3c')]('cm_hopper_final')[_0x05de('0x3f')](_0x4156e0+_0x05de('0x43'),_0x499a51['id'][_0x05de('0x39')]()))['where'](_0x05de('0x41'),squel[_0x05de('0x42')]()[_0x05de('0x36')](_0x05de('0x37'))['from'](_0x05de('0x32'))[_0x05de('0x3f')](_0x4156e0+'\x20=\x20?',_0x499a51['id']['toString']())))[_0x05de('0x39')]();return _0x34a70f;};function _0x2ef936(_0x34bb54,_0x724285){var _0x33f491=squel[_0x05de('0x30')]()[_0x05de('0x31')](_0x05de('0x32'))[_0x05de('0x33')]([_0x05de('0x37'),'scheduledAt',_0x05de('0x38'),_0x05de('0x24'),_0x724285,_0x05de('0x35'),'updatedAt'],squel[_0x05de('0x42')]()[_0x05de('0x36')](_0x05de('0x37'),_0x05de('0x37'))[_0x05de('0x36')](_0x05de('0x3a'),_0x05de('0x34'))[_0x05de('0x36')]('id',_0x05de('0x38'))[_0x05de('0x36')](LISTID['toString'](),_0x05de('0x24'))['field'](_0x34bb54['id'][_0x05de('0x39')](),_0x724285)[_0x05de('0x36')](_0x05de('0x3a'),_0x05de('0x35'))[_0x05de('0x36')](_0x05de('0x3a'),_0x05de('0x3b'))['from'](_0x05de('0x44'))[_0x05de('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0x05de('0x3e'),LISTID[_0x05de('0x39')]())[_0x05de('0x3f')](_0x05de('0x45'),squel[_0x05de('0x46')](hopperContacts))[_0x05de('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x05de('0x39')]();return _0x33f491;}function _0x2ca806(_0x176c6b,_0xf1186e){var _0xee439=squel['insert']()['into'](_0x05de('0x47'))['fromQuery']([_0x05de('0x37'),_0x05de('0x38'),'ListId',_0xf1186e,_0x05de('0x35'),'updatedAt'],squel[_0x05de('0x42')]()[_0x05de('0x36')](_0x05de('0x37'),'phone')[_0x05de('0x36')]('id',_0x05de('0x38'))['field'](LISTID['toString'](),_0x05de('0x24'))['field'](_0x176c6b['id'][_0x05de('0x39')](),_0xf1186e)['field'](_0x05de('0x3a'),_0x05de('0x35'))['field'](_0x05de('0x3a'),_0x05de('0x3b'))[_0x05de('0x3c')](_0x05de('0x44'))[_0x05de('0x3f')](_0x05de('0x3d'))[_0x05de('0x3f')](_0x05de('0x3e'),LISTID[_0x05de('0x39')]())['where']('id\x20IN\x20?',squel[_0x05de('0x46')](hopperContacts))['where'](_0x05de('0x40')))[_0x05de('0x39')]();return _0xee439;}return db[_0x05de('0x48')][_0x05de('0x49')]({'where':{'type':_0x05de('0x4a')},'attributes':['id',_0x05de('0x4b')],'include':[{'model':db[_0x05de('0x4c')],'as':_0x05de('0x4d'),'where':{'id':LISTID}}]})['then'](function(_0x320b11){var _0x22568e=[];if(_0x320b11){var _0x4fb34d;for(var _0x481690=0x0,_0x456d05;_0x481690<_0x320b11[_0x05de('0x18')];_0x481690+=0x1){_0x456d05=_0x320b11[_0x481690][_0x05de('0x4e')]({'plain':!![]});switch(_0x456d05[_0x05de('0x4b')]){case _0x05de('0x4f'):_0x22568e[_0x05de('0x2b')](db[_0x05de('0x50')][_0x05de('0x51')](_0x105ea9(_0x456d05,_0x05de('0x52')))['then'](function(){})[_0x05de('0x53')](_0x4c2c80()));break;case _0x05de('0x54'):_0x22568e[_0x05de('0x2b')](db['sequelize'][_0x05de('0x51')](_0x4b1b0d(_0x456d05,'VoiceQueueId'))[_0x05de('0x2a')](function(){})[_0x05de('0x53')](_0x4c2c80()));break;default:_0x22568e[_0x05de('0x2b')](db[_0x05de('0x50')]['query'](_0x2ef936(_0x456d05,'VoiceQueueId'))['then'](function(){})[_0x05de('0x53')](_0x4c2c80()));}}}return _0x22568e;})['all']()['then'](function(){return db[_0x05de('0x48')][_0x05de('0x49')]({'where':{'type':_0x05de('0x4a')},'attributes':['id'],'include':[{'model':db[_0x05de('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x8f829b){var _0x1fce51=[];if(_0x8f829b){var _0x13fcfe;for(var _0x50a76a=0x0,_0x4d606e;_0x50a76a<_0x8f829b[_0x05de('0x18')];_0x50a76a+=0x1){_0x4d606e=_0x8f829b[_0x50a76a][_0x05de('0x4e')]({'plain':!![]});_0x1fce51[_0x05de('0x2b')](db[_0x05de('0x50')]['query'](_0x2ca806(_0x4d606e,'VoiceQueueId'))[_0x05de('0x2a')](function(){})['catch'](_0x4c2c80()));}}return _0x1fce51;})['all']();})[_0x05de('0x2a')](function(){return db[_0x05de('0x55')][_0x05de('0x49')]({'attributes':['id',_0x05de('0x4b')],'include':[{'model':db[_0x05de('0x4c')],'as':_0x05de('0x4d'),'where':{'id':LISTID}}]})[_0x05de('0x2a')](function(_0x2bff46){var _0x484ada=[];if(_0x2bff46){for(var _0xaf26fc=0x0,_0x14e92c;_0xaf26fc<_0x2bff46[_0x05de('0x18')];_0xaf26fc+=0x1){_0x14e92c=_0x2bff46[_0xaf26fc]['get']({'plain':!![]});switch(_0x14e92c[_0x05de('0x4b')]){case _0x05de('0x4f'):_0x484ada[_0x05de('0x2b')](db[_0x05de('0x50')]['query'](_0x105ea9(_0x14e92c,_0x05de('0x56')))[_0x05de('0x2a')](function(){})[_0x05de('0x53')](_0x4c2c80()));break;case _0x05de('0x54'):_0x484ada[_0x05de('0x2b')](db[_0x05de('0x50')]['query'](_0x4b1b0d(_0x14e92c,_0x05de('0x56')))['then'](function(){})[_0x05de('0x53')](_0x4c2c80()));break;default:_0x484ada[_0x05de('0x2b')](db[_0x05de('0x50')][_0x05de('0x51')](_0x2ef936(_0x14e92c,'CampaignId'))[_0x05de('0x2a')](function(){})[_0x05de('0x53')](_0x4c2c80()));}}}return _0x484ada;})[_0x05de('0x57')]();})[_0x05de('0x2a')](function(){return db['Campaign'][_0x05de('0x49')]({'attributes':['id'],'include':[{'model':db[_0x05de('0x4c')],'as':_0x05de('0x58'),'where':{'id':LISTID}}]})[_0x05de('0x2a')](function(_0x451f24){var _0x5c6c85=[];if(_0x451f24){for(var _0x4e5362=0x0,_0x170a6e;_0x4e5362<_0x451f24['length'];_0x4e5362+=0x1){_0x170a6e=_0x451f24[_0x4e5362][_0x05de('0x4e')]({'plain':!![]});_0x5c6c85[_0x05de('0x2b')](db[_0x05de('0x50')][_0x05de('0x51')](_0x2ca806(_0x170a6e,_0x05de('0x56')))['then'](function(){})[_0x05de('0x53')](_0x4c2c80()));}}return _0x5c6c85;})[_0x05de('0x57')]();})[_0x05de('0x53')](function(_0x57148c){logger[_0x05de('0x12')](_0x05de('0x59'),_0x05de('0x5a'),_0x57148c[_0x05de('0x2d')]);});}var processPromises=function(_0x449379){return BPromise[_0x05de('0x57')](promises)[_0x05de('0x2a')](function(_0x207452){})[_0x05de('0x53')](function(_0x3a9287){logger[_0x05de('0x12')](_0x05de('0x5b'),JSON[_0x05de('0x5c')](_0x3a9287));})['finally'](function(){socket[_0x05de('0x5d')](_0x05de('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x449379){return _0x449379[_0x05de('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x05de('0x2a')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x05de('0x5d')](_0x05de('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x409e67){logger['error'](_0x05de('0x60'),JSON[_0x05de('0x5c')](_0x409e67));}finally{process[_0x05de('0x61')](0x0);}});};process['on'](_0x05de('0x62'),function(){logger[_0x05de('0x63')](_0x05de('0x64'));endCsv();});function main(){return BPromise[_0x05de('0x65')]()[_0x05de('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x05de('0x10')](',');return db[_0x05de('0x29')][_0x05de('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x05de('0x2a')](function(_0x2c08e6){var _0x304602=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x05de('0x66')](_0x304602,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c6434,_0x455300){total+=0x1;var _0x1f4708=total;promises[_0x05de('0x2b')](checkRow(_0x5c6434,_0x2c08e6,_0x1f4708)[_0x05de('0x2a')](function(){success+=0x1;})[_0x05de('0x53')](function(_0x2ee52a){if(_0x2ee52a[_0x05de('0x12')]){errors+=0x1;delete _0x2ee52a['error'];}else if(_0x2ee52a[_0x05de('0x27')]){duplicates+=0x1;delete _0x2ee52a[_0x05de('0x27')];}rows[_0x05de('0x2b')](_0x2ee52a);}));if(total%0xc8===0x0){_0x455300[_0x05de('0x67')]();return processPromises(_0x455300);}},'complete':function(){return processPromises()[_0x05de('0x2a')](function(){logger[_0x05de('0x63')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x4bb6cd,_0x5a1698){logger['info'](_0x05de('0x68'),JSON[_0x05de('0x5c')](_0x4bb6cd));endCsv();}});})['catch'](function(_0x5dbf23){logger[_0x05de('0x12')](_0x05de('0x69'),JSON[_0x05de('0x5c')](_0x5dbf23));});}main(); \ No newline at end of file +var _0x5d5a=['str','cm_hopper_black','deletedAt\x20IS\x20NULL','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','get','Campaign','CampaignId','BlackLists','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','info','CSV\x20parsed\x20correctly!','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','into','cm_hopper','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','where','ListId\x20=\x20?','from','\x20=\x20?','insert','fromQuery','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum'];(function(_0x3b0b34,_0xe6a14f){var _0x5f5496=function(_0x24fda6){while(--_0x24fda6){_0x3b0b34['push'](_0x3b0b34['shift']());}};_0x5f5496(++_0xe6a14f);}(_0x5d5a,0x1ce));var _0xa5d5=function(_0x5d06fd,_0x12cd6f){_0x5d06fd=_0x5d06fd-0x0;var _0x1b4374=_0x5d5a[_0x5d06fd];return _0x1b4374;};'use strict';var BPromise=require(_0xa5d5('0x0'));var util=require(_0xa5d5('0x1'));var _=require(_0xa5d5('0x2'));var fs=require('fs');var squel=require(_0xa5d5('0x3'));var Papa=require(_0xa5d5('0x4'));var Redis=require('ioredis');var db=require(_0xa5d5('0x5'))['db'];var config=require(_0xa5d5('0x6'));var logger=require('../../../config/logger')(_0xa5d5('0x7'));config[_0xa5d5('0x8')]=_['defaults'](config[_0xa5d5('0x8')],{'host':_0xa5d5('0x9'),'port':0x18eb});var socket=require(_0xa5d5('0xa'))(new Redis(config[_0xa5d5('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0xa5d5('0xb')](socket);try{if(!process[_0xa5d5('0xc')][0x2]||process['argv'][0x2]===_0xa5d5('0xd')||process[_0xa5d5('0xc')][0x2]===_0xa5d5('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0xa5d5('0xc')][0x3]||process[_0xa5d5('0xc')][0x3]===_0xa5d5('0xd')||process[_0xa5d5('0xc')][0x3]===_0xa5d5('0xe')||!process[_0xa5d5('0xc')][0x4]||process['argv'][0x4]===_0xa5d5('0xd')||process[_0xa5d5('0xc')][0x4]===_0xa5d5('0xe')){throw new Error(_0xa5d5('0xf'));}var FIELDS=_[_0xa5d5('0x10')](process[_0xa5d5('0xc')][0x3][_0xa5d5('0x11')](','),process['argv'][0x4][_0xa5d5('0x11')](','));if(!process[_0xa5d5('0xc')][0x5]||process['argv'][0x5]===_0xa5d5('0xd')||process[_0xa5d5('0xc')][0x5]===_0xa5d5('0xe')){throw new Error(_0xa5d5('0x12'));}var LISTID=process[_0xa5d5('0xc')][0x5];var COMPANYID=process[_0xa5d5('0xc')][0x6]&&process[_0xa5d5('0xc')][0x6]!==_0xa5d5('0xd')&&process[_0xa5d5('0xc')][0x6]!==_0xa5d5('0xe')?process['argv'][0x6]:null;var DUPLICATES=process[_0xa5d5('0xc')][0x7]&&process[_0xa5d5('0xc')][0x7]!==_0xa5d5('0xd')&&process[_0xa5d5('0xc')][0x7]!==_0xa5d5('0xe')?process['argv'][0x7]:null;if(!process[_0xa5d5('0xc')][0x8]||process[_0xa5d5('0xc')][0x8]===_0xa5d5('0xd')||process[_0xa5d5('0xc')][0x8]==='null'){throw new Error(_0xa5d5('0x13'));}var SOCKET_TIMESTAMP=process[_0xa5d5('0xc')][0x8];}catch(_0x4b2d1d){logger[_0xa5d5('0x14')](_0x4b2d1d);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x5ada3a,_0x3fc198,_0x1d3a78,_0x175269){var _0xfbf886={'message':_0x3fc198};_0xfbf886[_0x5ada3a]=!![];if(_0x1d3a78){_0xfbf886[_0xa5d5('0x15')]=_0x1d3a78;}if(_0x175269){_0xfbf886[_0xa5d5('0x16')]=_0x175269;}return _0xfbf886;}function isEmail(_0x318601){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x318601);}function checkRow(_0x138067,_0x2774e8,_0x1ee54e){return new BPromise(function(_0x232f86,_0x1166b4){if(_[_0xa5d5('0x17')](_0x138067)){return _0x1166b4(handleCheckRowError(_0xa5d5('0x14'),_0xa5d5('0x18'),null,_0x1ee54e));}if(_0x138067[_0xa5d5('0x19')]&&_0x138067[_0xa5d5('0x19')][_0xa5d5('0x1a')]){var _0x50059f=_[_0xa5d5('0x1b')](_0x138067[_0xa5d5('0x19')],_0xa5d5('0x1c'))[_0xa5d5('0x1d')](';');return _0x1166b4(handleCheckRowError(_0xa5d5('0x14'),_0x50059f,null,_0x1ee54e));}var _0x834cb8={};for(var _0x4769ce in FIELDS){if(FIELDS['hasOwnProperty'](_0x4769ce)&&FIELDS[_0x4769ce]){_0x834cb8[_0x4769ce]=_0x138067['data'][0x0][FIELDS[_0x4769ce]]||_0x138067[_0xa5d5('0x1e')][0x0]['\ufeff'+FIELDS[_0x4769ce]];}}if(!_0x834cb8[_0xa5d5('0x1f')]){return _0x1166b4(handleCheckRowError('error',_0xa5d5('0x20'),null,_0x1ee54e));}if(!_0x834cb8['phone']){return _0x1166b4(handleCheckRowError(_0xa5d5('0x14'),_0xa5d5('0x21'),null,_0x1ee54e));}if(_0x834cb8[_0xa5d5('0x22')]){var _0xe4628f=moment(_0x834cb8[_0xa5d5('0x22')],_0xa5d5('0x23'));if(!_0xe4628f[_0xa5d5('0x24')]()){return _0x1166b4(handleCheckRowError(_0xa5d5('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x1ee54e));}}if(_0x834cb8[_0xa5d5('0x25')]){if(!isEmail(_0x834cb8[_0xa5d5('0x25')])){return _0x1166b4(handleCheckRowError(_0xa5d5('0x14'),_0xa5d5('0x26'),null,_0x1ee54e));}}_0x834cb8['ListId']=LISTID;_0x834cb8[_0xa5d5('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa5d5('0x1a')]&&_0x2774e8){var _0x359a41={};for(var _0x51ab12=0x0,_0x2c06e1=DUPLICATES[_0xa5d5('0x1a')];_0x51ab12<_0x2c06e1;_0x51ab12+=0x1){_0x359a41[DUPLICATES[_0x51ab12]]=_0x834cb8[DUPLICATES[_0x51ab12]];}var _0xe2db45=_[_0xa5d5('0x28')](_0x2774e8,_0x359a41);if(_0xe2db45){return _0x1166b4(handleCheckRowError(_0xa5d5('0x29'),_0xa5d5('0x2a'),_0xe2db45,_0x1ee54e));}}return db['CmContact']['create'](_0x834cb8,{'raw':!![],'hooks':![],'fields':_[_0xa5d5('0x2b')](_0x834cb8)})[_0xa5d5('0x2c')](function(_0x45fc98){if(DUPLICATES&&DUPLICATES[_0xa5d5('0x1a')]&&_0x2774e8){_0x2774e8[_0xa5d5('0x2d')](_['pick'](_0x834cb8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x45fc98['id'];return _0x232f86();})[_0xa5d5('0x2e')](function(_0x5abe92){return _0x1166b4(handleCheckRowError(_0xa5d5('0x14'),_0xa5d5('0x2f')+(_0x5abe92[_0xa5d5('0x1c')]||JSON[_0xa5d5('0x30')](_0x5abe92)),null,_0x1ee54e));});});}function checkHopper(){function _0x5d9136(){return function(_0x2e5d51){logger[_0xa5d5('0x14')](_0xa5d5('0x31'),'checkHopper',util['inspect'](_0x2e5d51,{'showHidden':![],'depth':null}));};}var _0x50ad06=function(_0xaceb71,_0x28042f){var _0x2601d3=squel['insert']()[_0xa5d5('0x32')](_0xa5d5('0x33'))['fromQuery']([_0xa5d5('0x34'),_0xa5d5('0x35'),_0xa5d5('0x36'),_0xa5d5('0x37'),_0x28042f,_0xa5d5('0x38'),_0xa5d5('0x39')],squel[_0xa5d5('0x3a')]()[_0xa5d5('0x3b')](_0xa5d5('0x34'),_0xa5d5('0x34'))[_0xa5d5('0x3b')](_0xa5d5('0x3c'),_0xa5d5('0x35'))[_0xa5d5('0x3b')]('id',_0xa5d5('0x36'))[_0xa5d5('0x3b')](LISTID[_0xa5d5('0x3d')](),_0xa5d5('0x37'))[_0xa5d5('0x3b')](_0xaceb71['id'][_0xa5d5('0x3d')](),_0x28042f)[_0xa5d5('0x3b')](_0xa5d5('0x3c'),_0xa5d5('0x38'))[_0xa5d5('0x3b')](_0xa5d5('0x3c'),_0xa5d5('0x39'))['from'](_0xa5d5('0x3e'))[_0xa5d5('0x3f')]('deletedAt\x20IS\x20NULL')[_0xa5d5('0x3f')](_0xa5d5('0x40'),LISTID[_0xa5d5('0x3d')]())['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa5d5('0x3a')]()[_0xa5d5('0x3b')]('phone')[_0xa5d5('0x41')](_0xa5d5('0x33'))[_0xa5d5('0x3f')](_0x28042f+_0xa5d5('0x42'),_0xaceb71['id'][_0xa5d5('0x3d')]())))[_0xa5d5('0x3d')]();return _0x2601d3;};var _0xac9a92=function(_0x373021,_0x4c6e4d){var _0x3599ad=squel[_0xa5d5('0x43')]()[_0xa5d5('0x32')](_0xa5d5('0x33'))[_0xa5d5('0x44')](['phone','scheduledAt',_0xa5d5('0x36'),'ListId',_0x4c6e4d,_0xa5d5('0x38'),_0xa5d5('0x39')],squel['select']()[_0xa5d5('0x3b')]('phone',_0xa5d5('0x34'))['field'](_0xa5d5('0x3c'),_0xa5d5('0x35'))[_0xa5d5('0x3b')]('id','ContactId')['field'](LISTID[_0xa5d5('0x3d')](),_0xa5d5('0x37'))[_0xa5d5('0x3b')](_0x373021['id']['toString'](),_0x4c6e4d)[_0xa5d5('0x3b')](_0xa5d5('0x3c'),_0xa5d5('0x38'))['field']('NOW()',_0xa5d5('0x39'))[_0xa5d5('0x41')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0xa5d5('0x40'),LISTID[_0xa5d5('0x3d')]())[_0xa5d5('0x3f')](_0xa5d5('0x45'),squel['str'](hopperContacts))['where'](_0xa5d5('0x46'))['where'](_0xa5d5('0x47'),squel['select']()['field'](_0xa5d5('0x48'))[_0xa5d5('0x41')]('cm_hopper_final')[_0xa5d5('0x3f')](_0x4c6e4d+_0xa5d5('0x42'),_0x373021['id'][_0xa5d5('0x3d')]()))['where'](_0xa5d5('0x47'),squel[_0xa5d5('0x3a')]()['field'](_0xa5d5('0x34'))[_0xa5d5('0x41')](_0xa5d5('0x33'))[_0xa5d5('0x3f')](_0x4c6e4d+'\x20=\x20?',_0x373021['id'][_0xa5d5('0x3d')]())))[_0xa5d5('0x3d')]();return _0x3599ad;};function _0x25e0ed(_0x18ecce,_0x5d1d5f){var _0x4a6152=squel[_0xa5d5('0x43')]()[_0xa5d5('0x32')](_0xa5d5('0x33'))[_0xa5d5('0x44')]([_0xa5d5('0x34'),'scheduledAt',_0xa5d5('0x36'),'ListId',_0x5d1d5f,_0xa5d5('0x38'),_0xa5d5('0x39')],squel[_0xa5d5('0x3a')]()['field'](_0xa5d5('0x34'),_0xa5d5('0x34'))['field'](_0xa5d5('0x3c'),_0xa5d5('0x35'))[_0xa5d5('0x3b')]('id',_0xa5d5('0x36'))[_0xa5d5('0x3b')](LISTID[_0xa5d5('0x3d')](),_0xa5d5('0x37'))[_0xa5d5('0x3b')](_0x18ecce['id'][_0xa5d5('0x3d')](),_0x5d1d5f)[_0xa5d5('0x3b')]('NOW()',_0xa5d5('0x38'))['field'](_0xa5d5('0x3c'),_0xa5d5('0x39'))[_0xa5d5('0x41')](_0xa5d5('0x3e'))[_0xa5d5('0x3f')]('deletedAt\x20IS\x20NULL')[_0xa5d5('0x3f')](_0xa5d5('0x40'),LISTID[_0xa5d5('0x3d')]())[_0xa5d5('0x3f')](_0xa5d5('0x45'),squel[_0xa5d5('0x49')](hopperContacts))['where'](_0xa5d5('0x46')))['toString']();return _0x4a6152;}function _0x519137(_0x56e140,_0x5aca3d){var _0x3e3823=squel['insert']()[_0xa5d5('0x32')](_0xa5d5('0x4a'))[_0xa5d5('0x44')]([_0xa5d5('0x34'),_0xa5d5('0x36'),_0xa5d5('0x37'),_0x5aca3d,_0xa5d5('0x38'),_0xa5d5('0x39')],squel[_0xa5d5('0x3a')]()[_0xa5d5('0x3b')](_0xa5d5('0x34'),'phone')[_0xa5d5('0x3b')]('id',_0xa5d5('0x36'))[_0xa5d5('0x3b')](LISTID['toString'](),_0xa5d5('0x37'))[_0xa5d5('0x3b')](_0x56e140['id'][_0xa5d5('0x3d')](),_0x5aca3d)['field']('NOW()',_0xa5d5('0x38'))[_0xa5d5('0x3b')](_0xa5d5('0x3c'),'updatedAt')[_0xa5d5('0x41')](_0xa5d5('0x3e'))[_0xa5d5('0x3f')](_0xa5d5('0x4b'))['where'](_0xa5d5('0x40'),LISTID['toString']())['where'](_0xa5d5('0x45'),squel[_0xa5d5('0x49')](hopperContacts))[_0xa5d5('0x3f')](_0xa5d5('0x46')))[_0xa5d5('0x3d')]();return _0x3e3823;}return db[_0xa5d5('0x4c')][_0xa5d5('0x4d')]({'where':{'type':_0xa5d5('0x4e')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xa5d5('0x4f')],'as':_0xa5d5('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x5b9361){var _0x256c3f=[];if(_0x5b9361){var _0x192a95;for(var _0x8c83dc=0x0,_0x3c5c25;_0x8c83dc<_0x5b9361[_0xa5d5('0x1a')];_0x8c83dc+=0x1){_0x3c5c25=_0x5b9361[_0x8c83dc]['get']({'plain':!![]});switch(_0x3c5c25[_0xa5d5('0x51')]){case _0xa5d5('0x52'):_0x256c3f[_0xa5d5('0x2d')](db[_0xa5d5('0x53')][_0xa5d5('0x54')](_0xac9a92(_0x3c5c25,_0xa5d5('0x55')))[_0xa5d5('0x2c')](function(){})[_0xa5d5('0x2e')](_0x5d9136()));break;case _0xa5d5('0x56'):_0x256c3f[_0xa5d5('0x2d')](db['sequelize'][_0xa5d5('0x54')](_0x50ad06(_0x3c5c25,'VoiceQueueId'))[_0xa5d5('0x2c')](function(){})[_0xa5d5('0x2e')](_0x5d9136()));break;default:_0x256c3f[_0xa5d5('0x2d')](db[_0xa5d5('0x53')][_0xa5d5('0x54')](_0x25e0ed(_0x3c5c25,_0xa5d5('0x55')))[_0xa5d5('0x2c')](function(){})[_0xa5d5('0x2e')](_0x5d9136()));}}}return _0x256c3f;})[_0xa5d5('0x57')]()[_0xa5d5('0x2c')](function(){return db[_0xa5d5('0x4c')][_0xa5d5('0x4d')]({'where':{'type':_0xa5d5('0x4e')},'attributes':['id'],'include':[{'model':db[_0xa5d5('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x20af59){var _0x5b7851=[];if(_0x20af59){var _0x56f20c;for(var _0xd5802c=0x0,_0x239c9e;_0xd5802c<_0x20af59[_0xa5d5('0x1a')];_0xd5802c+=0x1){_0x239c9e=_0x20af59[_0xd5802c][_0xa5d5('0x58')]({'plain':!![]});_0x5b7851[_0xa5d5('0x2d')](db['sequelize'][_0xa5d5('0x54')](_0x519137(_0x239c9e,_0xa5d5('0x55')))[_0xa5d5('0x2c')](function(){})[_0xa5d5('0x2e')](_0x5d9136()));}}return _0x5b7851;})[_0xa5d5('0x57')]();})[_0xa5d5('0x2c')](function(){return db[_0xa5d5('0x59')][_0xa5d5('0x4d')]({'attributes':['id',_0xa5d5('0x51')],'include':[{'model':db[_0xa5d5('0x4f')],'as':_0xa5d5('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x51daa3){var _0xf4349a=[];if(_0x51daa3){for(var _0x6da9a0=0x0,_0x15b74a;_0x6da9a0<_0x51daa3[_0xa5d5('0x1a')];_0x6da9a0+=0x1){_0x15b74a=_0x51daa3[_0x6da9a0][_0xa5d5('0x58')]({'plain':!![]});switch(_0x15b74a[_0xa5d5('0x51')]){case _0xa5d5('0x52'):_0xf4349a[_0xa5d5('0x2d')](db[_0xa5d5('0x53')][_0xa5d5('0x54')](_0xac9a92(_0x15b74a,_0xa5d5('0x5a')))['then'](function(){})[_0xa5d5('0x2e')](_0x5d9136()));break;case _0xa5d5('0x56'):_0xf4349a[_0xa5d5('0x2d')](db[_0xa5d5('0x53')][_0xa5d5('0x54')](_0x50ad06(_0x15b74a,_0xa5d5('0x5a')))[_0xa5d5('0x2c')](function(){})['catch'](_0x5d9136()));break;default:_0xf4349a[_0xa5d5('0x2d')](db[_0xa5d5('0x53')][_0xa5d5('0x54')](_0x25e0ed(_0x15b74a,_0xa5d5('0x5a')))['then'](function(){})[_0xa5d5('0x2e')](_0x5d9136()));}}}return _0xf4349a;})['all']();})[_0xa5d5('0x2c')](function(){return db[_0xa5d5('0x59')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xa5d5('0x4f')],'as':_0xa5d5('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x3c1edc){var _0x3bfc7e=[];if(_0x3c1edc){for(var _0x51278d=0x0,_0x1900f1;_0x51278d<_0x3c1edc[_0xa5d5('0x1a')];_0x51278d+=0x1){_0x1900f1=_0x3c1edc[_0x51278d][_0xa5d5('0x58')]({'plain':!![]});_0x3bfc7e[_0xa5d5('0x2d')](db['sequelize'][_0xa5d5('0x54')](_0x519137(_0x1900f1,'CampaignId'))['then'](function(){})[_0xa5d5('0x2e')](_0x5d9136()));}}return _0x3bfc7e;})['all']();})['catch'](function(_0x2d6905){logger[_0xa5d5('0x14')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x2d6905[_0xa5d5('0x1c')]);});}var processPromises=function(_0x3b5bb3){return BPromise[_0xa5d5('0x57')](promises)[_0xa5d5('0x2c')](function(_0x2918b4){})[_0xa5d5('0x2e')](function(_0x2352b6){logger[_0xa5d5('0x14')](_0xa5d5('0x5c'),JSON[_0xa5d5('0x30')](_0x2352b6));})[_0xa5d5('0x5d')](function(){socket[_0xa5d5('0x5e')](_0xa5d5('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3b5bb3){return _0x3b5bb3['resume']();}});};var endCsv=function(){return BPromise[_0xa5d5('0x60')]()[_0xa5d5('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0xa5d5('0x2c')](function(){socket[_0xa5d5('0x5e')](_0xa5d5('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa5d5('0x61')](FILEPATH);}catch(_0x458163){logger[_0xa5d5('0x14')](_0xa5d5('0x62'),JSON[_0xa5d5('0x30')](_0x458163));}finally{process[_0xa5d5('0x63')](0x0);}});};process['on'](_0xa5d5('0x64'),function(){logger['info'](_0xa5d5('0x65'));endCsv();});function main(){return BPromise[_0xa5d5('0x60')]()[_0xa5d5('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa5d5('0x11')](',');return db[_0xa5d5('0x66')][_0xa5d5('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa5d5('0x2c')](function(_0x124b0){var _0x538eca=fs[_0xa5d5('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa5d5('0x68')](_0x538eca,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2397a6,_0x1555d8){total+=0x1;var _0x148d90=total;promises[_0xa5d5('0x2d')](checkRow(_0x2397a6,_0x124b0,_0x148d90)[_0xa5d5('0x2c')](function(){success+=0x1;})[_0xa5d5('0x2e')](function(_0x25480f){if(_0x25480f['error']){errors+=0x1;delete _0x25480f[_0xa5d5('0x14')];}else if(_0x25480f[_0xa5d5('0x29')]){duplicates+=0x1;delete _0x25480f[_0xa5d5('0x29')];}rows[_0xa5d5('0x2d')](_0x25480f);}));if(total%0xc8===0x0){_0x1555d8['pause']();return processPromises(_0x1555d8);}},'complete':function(){return processPromises()[_0xa5d5('0x2c')](function(){logger[_0xa5d5('0x69')](_0xa5d5('0x6a'));endCsv();});},'error':function(_0x26dfcf,_0x49ac51){logger[_0xa5d5('0x69')]('CSV\x20parse\x20error',JSON['stringify'](_0x26dfcf));endCsv();}});})[_0xa5d5('0x2e')](function(_0x26d777){logger[_0xa5d5('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xa5d5('0x30')](_0x26d777));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 956fbfd..df967e8 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb835=['deletedAt\x20IS\x20NULL','id\x20IN\x20?','group','Received\x20SIGINT','error','exit','errors','code','message','sequelize','spread','catch','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','info','main','stringify','send','binding','clone','socket_timestamp','server/files/tmp','.csv','keys','header','name','writeFileSync','createReadStream','data','rows','hasOwnProperty','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','find','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','from','join','.id\x20=\x20','where','\x20=\x20','findAll','then','length','push','all','AdditionalPhones','split','isNil','filter','CmContactHasItem','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','ContactId','createdAt','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.ListId','cm_contacts.createdAt','into','cm_hopper_black','fromQuery','phone','fields','field','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','ListId','UserId','.CmListId\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?'];(function(_0x22770b,_0x41fd48){var _0x4af8d2=function(_0x3b2de9){while(--_0x3b2de9){_0x22770b['push'](_0x22770b['shift']());}};_0x4af8d2(++_0x41fd48);}(_0xb835,0x1d9));var _0x5b83=function(_0x3e480c,_0x26f38c){_0x3e480c=_0x3e480c-0x0;var _0x20b860=_0xb835[_0x3e480c];return _0x20b860;};'use strict';var fs=require('fs');var path=require(_0x5b83('0x0'));var _=require(_0x5b83('0x1'));var Papa=require(_0x5b83('0x2'));var util=require(_0x5b83('0x3'));var BPromise=require(_0x5b83('0x4'));var moment=require(_0x5b83('0x5'));var squel=require(_0x5b83('0x6'));var Redis=require('ioredis');var db=require(_0x5b83('0x7'))['db'];var config=require(_0x5b83('0x8'));var shared=require(_0x5b83('0x9'));var logger=require(_0x5b83('0xa'))('import');config[_0x5b83('0xb')]=_['defaults'](config[_0x5b83('0xb')],{'host':_0x5b83('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5b83('0xd')](_0x5b83('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x53f572){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x5b83('0xf')](_0x53f572);}function selectNotIn(_0x34d3df,_0x51a760,_0x1bc917,_0x16a7f8,_0x315483){return squel[_0x5b83('0x10')]()['field']('phone')[_0x5b83('0x11')](_0x16a7f8)[_0x5b83('0x12')](_0x51a760,null,_0x51a760+_0x5b83('0x13')+_0x16a7f8+'.'+_0x1bc917)[_0x5b83('0x14')](_0x16a7f8+'.'+_0x1bc917+_0x5b83('0x15')+_0x34d3df+'.'+_0x1bc917)['where'](_0x51a760+'.dialCheckDuplicateType\x20IN\x20('+_0x315483['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1bec20,_0x293501){promisesAdditionalPhones=[];return db['CmContact'][_0x5b83('0x16')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5b83('0x17')](function(_0x3a6fe5){if(_0x3a6fe5!==null){var _0x335f08=[];for(var _0xdeb6bf=0x0;_0xdeb6bf<_0x3a6fe5[_0x5b83('0x18')];_0xdeb6bf++){var _0x4e1b03=_0x3a6fe5[_0xdeb6bf];_0x335f08[_0x5b83('0x19')](insertAdditionalPhones(_0x4e1b03));}}Promise[_0x5b83('0x1a')](_0x335f08)[_0x5b83('0x17')](function(){_0x1bec20({'val':0x1});});});});}function insertAdditionalPhones(_0x152514){return new Promise(function(_0x261a89,_0xff14c5){var _0x3219f7=_0x152514[_0x5b83('0x1b')];var _0x102e87=_0x3219f7[_0x5b83('0x1c')](';');var _0xbf0451=[];orderBy=0x0;for(var _0x3338e7=0x0;_0x3338e7<_0x102e87[_0x5b83('0x18')];_0x3338e7++){_0xbf0451[_0x5b83('0x19')](splitAdditionalPhone(_0x152514['id'],_0x102e87[_0x3338e7]));}Promise[_0x5b83('0x1a')](_0xbf0451)[_0x5b83('0x17')](function(){_0x261a89({'val':_0x102e87[_0x5b83('0x18')]});});});}function splitAdditionalPhone(_0x34c546,_0x3d3c24){return new Promise(function(_0x177172,_0x451382){var _0x9c0f6=_0x3d3c24[_0x5b83('0x1c')](':');var _0x5b4fc1=_0x9c0f6[0x0];var _0x5c887a=_0x9c0f6[0x1];if(!_[_0x5b83('0x1d')](_0x5c887a)){var _0x305c7e=_0x5c887a[_0x5b83('0x1c')]('|');var _0x5c32ab=[];for(var _0x296b6e=0x0;_0x296b6e<_0x305c7e['length'];_0x296b6e++){if(_0x305c7e[_0x296b6e]!==''){var _0xb0f4bb=_[_0x5b83('0x1e')](promisesAdditionalPhones,{'contactId':_0x34c546,'phone':_0x305c7e[_0x296b6e]});if(_0xb0f4bb[_0x5b83('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x5b83('0x19')]({'contactId':_0x34c546,'contactTypeId':_0x5b4fc1,'phone':_0x305c7e[_0x296b6e],'orderBy':orderBy});}}}_0x177172({'ok':0x1});}else _0x177172({'res':0x0});});}function createAdditionalPhone(_0x143d5,_0x5d569b,_0x2069c9,_0x5d4413){var _0x37671c='';var _0x59c5b6='';var _0x46d6bc=_0x2069c9['split']('§');_0x37671c=_0x46d6bc[0x0];if(_0x46d6bc[_0x5b83('0x18')]==0x2)_0x59c5b6=_0x46d6bc[0x1];return new Promise(function(_0x3c3b1f,_0x5a30c2){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x143d5,'item':_0x37671c}})[_0x5b83('0x17')](function(_0x4bc911){if(_0x4bc911){return db[_0x5b83('0x1f')]['update']({'ItemTypeId':_0x5d569b,'description':_0x59c5b6,'OrderBy':_0x5d4413},{'where':{'CmContactId':_0x143d5,'item':_0x37671c}})['then'](function(_0x4f40c4){_0x3c3b1f({'res':_0x5b83('0x20')});});}else{return db[_0x5b83('0x1f')][_0x5b83('0x21')]({'CmContactId':_0x143d5,'item':_0x37671c,'description':_0x59c5b6,'ItemTypeId':_0x5d569b,'OrderBy':_0x5d4413,'ItemClass':_0x5b83('0x22')})[_0x5b83('0x17')](function(_0x4f1b6d){_0x3c3b1f({'res':_0x5b83('0x23')});});}});});}function insertCmHopper(_0x188e6f,_0x2e05b1,_0x13b27b,_0x509225,_0x518b68){var _0x27ec22=[_0x5b83('0x24'),'cm_contacts.scheduledat',_0x5b83('0x25'),'cm_contacts.ListId',_0x2e05b1+'.'+_0x509225,'cm_contacts.createdAt',_0x5b83('0x26'),_0x5b83('0x27'),_0x5b83('0x28'),'\x22'+_0x518b68+'\x22'];return squel[_0x5b83('0x29')]()['into'](_0x5b83('0x2a'))['fromQuery'](['phone','scheduledat',_0x5b83('0x2b'),'ListId',_0x509225,_0x5b83('0x2c'),_0x5b83('0x2d'),_0x5b83('0x2e'),'UserId',_0x5b83('0x2f')],squel[_0x5b83('0x10')]()['fields'](_0x27ec22)[_0x5b83('0x11')](_0x2e05b1)[_0x5b83('0x12')](_0x5b83('0x30'),null,_0x5b83('0x31')+_0x2e05b1+_0x5b83('0x32'))[_0x5b83('0x12')](_0x13b27b,null,_0x13b27b+_0x5b83('0x13')+_0x2e05b1+'.'+_0x509225)['where'](_0x2e05b1+'.CmListId\x20=\x20?',_0x188e6f)[_0x5b83('0x14')](_0x5b83('0x33'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2e05b1,_0x13b27b,_0x509225,_0x5b83('0x2a'),[_0x5b83('0x34'),_0x5b83('0x35')]))['where'](_0x5b83('0x36'),selectNotIn(_0x2e05b1,_0x13b27b,_0x509225,'cm_hopper',[_0x5b83('0x34')])))[_0x5b83('0x37')]();}function insertCmHopperBlack(_0x3a68f4,_0xdca7f6,_0x4bf2a2,_0x30a63e){var _0x11edd7=[_0x5b83('0x24'),'cm_contacts.id',_0x5b83('0x38'),_0xdca7f6+'.'+_0x30a63e,_0x5b83('0x39'),_0x5b83('0x26')];return squel[_0x5b83('0x29')]()[_0x5b83('0x3a')](_0x5b83('0x3b'))[_0x5b83('0x3c')]([_0x5b83('0x3d'),_0x5b83('0x2b'),'ListId',_0x30a63e,_0x5b83('0x2c'),_0x5b83('0x2d')],squel['select']()[_0x5b83('0x3e')](_0x11edd7)[_0x5b83('0x11')](_0xdca7f6)[_0x5b83('0x12')]('cm_contacts',null,_0x5b83('0x31')+_0xdca7f6+_0x5b83('0x32'))['join'](_0x4bf2a2,null,_0x4bf2a2+'.id\x20=\x20'+_0xdca7f6+'.'+_0x30a63e)[_0x5b83('0x14')](_0xdca7f6+'.CmListId\x20=\x20?',_0x3a68f4)[_0x5b83('0x14')](_0x5b83('0x33'),NOW)['where'](_0x5b83('0x36'),squel[_0x5b83('0x10')]()[_0x5b83('0x3f')]('phone')[_0x5b83('0x11')](_0x5b83('0x3b'))['where']('ListId\x20=\x20?',_0x3a68f4)[_0x5b83('0x14')](_0x30a63e+_0x5b83('0x15')+_0xdca7f6+'.'+_0x30a63e)))[_0x5b83('0x37')]();}function insertTzCmHopper(_0x71758,_0xc0259,_0x11e69b,_0x14f174,_0x33a136,_0x530785){var _0x151939=[_0x5b83('0x24'),_0x5b83('0x40')+_0x530785+_0x5b83('0x41'),_0x5b83('0x25'),_0x5b83('0x38'),_0xc0259+'.'+_0x14f174,_0x5b83('0x39'),_0x5b83('0x26'),'cm_contacts.priority',_0x5b83('0x28'),'\x22'+_0x33a136+'\x22'];var _0x28d4ae=squel[_0x5b83('0x29')]()[_0x5b83('0x3a')](_0x5b83('0x2a'))[_0x5b83('0x3c')]([_0x5b83('0x3d'),_0x5b83('0x42'),_0x5b83('0x2b'),_0x5b83('0x43'),_0x14f174,_0x5b83('0x2c'),_0x5b83('0x2d'),_0x5b83('0x2e'),_0x5b83('0x44'),_0x5b83('0x2f')],squel['select']()[_0x5b83('0x3e')](_0x151939)[_0x5b83('0x11')](_0xc0259)[_0x5b83('0x12')](_0x5b83('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0xc0259+_0x5b83('0x32'))['join'](_0x11e69b,null,_0x11e69b+_0x5b83('0x13')+_0xc0259+'.'+_0x14f174)[_0x5b83('0x12')](_0x530785,null,_0x530785+'.id\x20=\x20'+_0xc0259+'.'+_0x14f174)[_0x5b83('0x14')](_0xc0259+'.CmListId\x20=\x20?',_0x71758)[_0x5b83('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x5b83('0x36'),selectNotIn(_0xc0259,_0x11e69b,_0x14f174,_0x5b83('0x2a'),[_0x5b83('0x34'),_0x5b83('0x35')]))[_0x5b83('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xc0259,_0x11e69b,_0x14f174,_0x5b83('0x2a'),['\x22always\x22'])))['toString']();return _0x28d4ae;}function insertTzCmHopperBlack(_0x563186,_0x42f40e,_0x114da9,_0x2e5056){var _0x1646b4=[_0x5b83('0x24'),_0x5b83('0x25'),_0x5b83('0x38'),_0x42f40e+'.'+_0x2e5056,_0x5b83('0x39'),'cm_contacts.updatedAt'];return squel['insert']()[_0x5b83('0x3a')](_0x5b83('0x3b'))['fromQuery']([_0x5b83('0x3d'),'ContactId','ListId',_0x2e5056,_0x5b83('0x2c'),'updatedAt'],squel['select']()[_0x5b83('0x3e')](_0x1646b4)[_0x5b83('0x11')](_0x42f40e)[_0x5b83('0x12')](_0x5b83('0x30'),null,_0x5b83('0x31')+_0x42f40e+_0x5b83('0x32'))[_0x5b83('0x12')](_0x114da9,null,_0x114da9+_0x5b83('0x13')+_0x42f40e+'.'+_0x2e5056)[_0x5b83('0x14')](_0x42f40e+_0x5b83('0x45'),_0x563186)[_0x5b83('0x14')](_0x5b83('0x33'),NOW)[_0x5b83('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x5b83('0x10')]()[_0x5b83('0x3f')](_0x5b83('0x3d'))[_0x5b83('0x11')](_0x5b83('0x3b'))[_0x5b83('0x14')](_0x5b83('0x46'),_0x563186)[_0x5b83('0x14')](_0x2e5056+_0x5b83('0x15')+_0x42f40e+'.'+_0x2e5056)))[_0x5b83('0x37')]();}function insertCmHopperAdditionalPhones(_0x309f3c){var _0x2c2e1f=[_0x5b83('0x47'),_0x5b83('0x48'),_0x5b83('0x49'),_0x5b83('0x4a'),_0x5b83('0x4b')];return squel[_0x5b83('0x29')]()['into']('cm_hopper_additional_phones')[_0x5b83('0x3c')]([_0x5b83('0x4c'),_0x5b83('0x3d'),_0x5b83('0x4d'),'createdAt',_0x5b83('0x2d')],squel[_0x5b83('0x10')]()[_0x5b83('0x3e')](_0x2c2e1f)[_0x5b83('0x11')](_0x5b83('0x2a'))[_0x5b83('0x12')](_0x5b83('0x30'),null,_0x5b83('0x4e'))[_0x5b83('0x12')](_0x5b83('0x4f'),null,_0x5b83('0x50'))[_0x5b83('0x14')](_0x5b83('0x51'),_0x309f3c)['where'](_0x5b83('0x33'),NOW))['toString']();}function insertCmContact(_0xf5892d,_0x2d1875,_0x5fd535,_0xe623b1){var _0x16460f=_['concat'](_['keys'](_0xe623b1),[_0x5b83('0x43'),_0x5b83('0x52'),'createdAt',_0x5b83('0x2d'),_0x5b83('0x53')]);return squel['insert']()[_0x5b83('0x3a')](_0x5b83('0x30'))['fromQuery'](_0x16460f,squel['select']()[_0x5b83('0x3e')](_0x16460f)['from'](_0x2d1875)[_0x5b83('0x14')]('('+_0x5fd535[_0x5b83('0x12')](',')+_0x5b83('0x54'),squel[_0x5b83('0x10')]()['fields'](_0x5fd535)[_0x5b83('0x11')]('cm_contacts')['where'](_0x5b83('0x46'),_0xf5892d)[_0x5b83('0x14')](_0x5b83('0x55')))[_0x5b83('0x14')](_0x5b83('0x56'),squel[_0x5b83('0x10')]()['field']('MIN(id)','min_id')[_0x5b83('0x11')](_0x2d1875)[_0x5b83('0x57')](_0x5fd535[_0x5b83('0x12')](','))))[_0x5b83('0x37')]();}function handleStop(){logger['info'](_0x5b83('0x58'));stopped=!![];}function handleUncaughtException(_0x1fe24f){logger[_0x5b83('0x59')](_0x1fe24f['message']);process[_0x5b83('0x5a')](0x1);}function handleError(_0x144a13,_0x46d1a7){stats[_0x5b83('0x5b')][_0x5b83('0x19')]({'name':_0x46d1a7[_0x5b83('0x5c')],'message':_0x46d1a7[_0x5b83('0x5d')],'row':_0x144a13});}function handleQuery(_0x208737){logger['info'](_0x208737);return db[_0x5b83('0x5e')]['query'](_0x208737)[_0x5b83('0x5f')](function(_0xad8b2){results[_0x5b83('0x19')](_0xad8b2);})[_0x5b83('0x60')](function(_0x401df8){logger[_0x5b83('0x59')](_0x401df8[_0x5b83('0x5d')]);});}function updateTzCampaigns(_0x4a7efd){return new Promise(function(_0x576111,_0x46669e){var _0x1cab9c=squel[_0x5b83('0x10')]()[_0x5b83('0x3e')](['campaigns.id','campaigns.dialTimezone'])[_0x5b83('0x11')](_0x5b83('0x61'))[_0x5b83('0x12')](_0x5b83('0x62'),null,_0x5b83('0x63'))[_0x5b83('0x14')](_0x5b83('0x64')+_0x4a7efd);db['sequelize'][_0x5b83('0x65')](_0x1cab9c['toString']())['spread'](function(_0x36efee){var _0x1d2e48=[];for(var _0x1b071f=0x0;_0x1b071f<_0x36efee[_0x5b83('0x18')];_0x1b071f++){_0x1d2e48[_0x5b83('0x19')](getTimezoneData(_0x36efee[_0x1b071f],tmp_campaigns));}BPromise[_0x5b83('0x1a')](_0x1d2e48)[_0x5b83('0x17')](function(){_0x576111({'val':0x1});});})['catch'](function(_0x5293fc){logger[_0x5b83('0x59')](_0x5293fc[_0x5b83('0x5d')]);_0x576111({'val':0x0});});});}function updateTzVoiceQueues(_0x429843){return new Promise(function(_0x56711a,_0x55c5d0){var _0xb06d52=squel[_0x5b83('0x10')]()['fields']([_0x5b83('0x66'),_0x5b83('0x67')])[_0x5b83('0x11')](_0x5b83('0x68'))['join'](_0x5b83('0x69'),null,_0x5b83('0x6a'))['where'](_0x5b83('0x6b')+_0x429843);db['sequelize'][_0x5b83('0x65')](_0xb06d52[_0x5b83('0x37')]())['spread'](function(_0x435f84){var _0x467c31=[];for(var _0x42126a=0x0;_0x42126a<_0x435f84[_0x5b83('0x18')];_0x42126a++){_0x467c31[_0x5b83('0x19')](getTimezoneData(_0x435f84[_0x42126a],tmp_voice_queues));}BPromise[_0x5b83('0x1a')](_0x467c31)[_0x5b83('0x17')](function(){_0x56711a({'val':0x1});});})[_0x5b83('0x60')](function(_0x22cb79){logger[_0x5b83('0x59')](_0x22cb79['message']);_0x56711a({'val':0x0});});});}function getTimezoneData(_0x424085,_0x1c447f){return new Promise(function(_0x2feb85,_0x4b5f43){var _0x1e6f7a=shared[_0x5b83('0x6c')];var _0x1a1fbe=_0x1e6f7a[_0x424085[_0x5b83('0x6d')]];if(_[_0x5b83('0x1d')](_0x1a1fbe)){_0x2feb85({'ret':0x1});}else{var _0xc53dc=_0x1a1fbe[_0x5b83('0x6e')];var _0x13c6f3=squel['insert']()[_0x5b83('0x3a')](_0x1c447f)[_0x5b83('0x6f')]('id',_0x424085['id'])['set'](_0x5b83('0x70'),_0xc53dc)['set'](_0x5b83('0x6d'),_0x424085[_0x5b83('0x6d')])['toString']();return db[_0x5b83('0x5e')][_0x5b83('0x65')](_0x13c6f3)['spread'](function(_0x2ae105){_0x2feb85({'ret':0x1});})[_0x5b83('0x60')](function(_0x4482c0){logger[_0x5b83('0x59')](_0x4482c0[_0x5b83('0x5d')]);_0x4b5f43({'ret':0x1});});}});}function handleTZQuery(_0x3f0cd0){logger[_0x5b83('0x71')](_0x3f0cd0);return db['sequelize'][_0x5b83('0x65')](_0x3f0cd0)[_0x5b83('0x5f')](function(_0x1781cc){})['catch'](function(_0x594c32){logger['error'](_0x594c32[_0x5b83('0x5d')]);});}function main(_0x597d5a,_0x3bcabb,_0x43d803,_0xa8ee8b){logger['info'](_0x5b83('0x72'),_0x597d5a,JSON[_0x5b83('0x73')](_0x3bcabb));process[_0x5b83('0x74')]('start');var _0x5bcbeb=_0x3bcabb[_0x5b83('0x75')];var _0x3cb511=_[_0x5b83('0x76')](_0x5bcbeb);var _0x21a516=_0x3bcabb[_0x5b83('0x77')];var _0x49f2bb=path[_0x5b83('0x12')](config['root'],_0x5b83('0x78'),_0x21a516+_0x5b83('0x79'));hasTZ=_[_0x5b83('0x7a')](_0x5bcbeb)['includes'](_0x5b83('0x6d'));var _0x3dd04b=_[_0x5b83('0x7a')](_0x5bcbeb)[_0x5b83('0x12')]();logger[_0x5b83('0x71')](_0x5b83('0x7b'),_0x3dd04b);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x5b83('0x7c')]})[_0x5b83('0x17')](function(_0x1ca482){for(var _0x18baa4=0x0;_0x18baa4<_0x1ca482['length'];_0x18baa4++){if(_0x1ca482[_0x18baa4][_0x5b83('0x7c')]in _0x5bcbeb){contactItemTypes[_0x5b83('0x19')](_0x1ca482[_0x18baa4]);delete _0x3cb511[_0x1ca482[_0x18baa4][_0x5b83('0x7c')]];hasAdditionalPhones=!![];}for(var _0x4abd0b in _0x5bcbeb){if(_0x1ca482[_0x18baa4]['name']+'_description'===_0x4abd0b){phoneDescriptions[_0x5b83('0x19')]({'itemTypeId':_0x1ca482[_0x18baa4]['id'],'description':_0x4abd0b});delete _0x3cb511[_0x4abd0b];}}}if(hasAdditionalPhones)_0x3cb511[_0x5b83('0x1b')]='';var _0x3ae8a1=_[_0x5b83('0x7a')](_0x3cb511)[_0x5b83('0x12')]();logger[_0x5b83('0x71')](_0x5b83('0x7b'),_0x3ae8a1);fs[_0x5b83('0x7d')](_0x49f2bb,_0x3ae8a1+'\x0a');Papa['parse'](fs[_0x5b83('0x7e')](_0x597d5a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x56fcf1,_0x3be8b2){try{for(var _0x1e96b0=0x0,_0x26f087=[];_0x1e96b0<_0x56fcf1[_0x5b83('0x7f')][_0x5b83('0x18')];_0x1e96b0++){stats[_0x5b83('0x80')]+=0x1;if(_0x56fcf1[_0x5b83('0x5b')][_0x1e96b0]){handleError(_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0],_0x56fcf1['errors'][_0x1e96b0]);}else{var _0x1a7e02=[];var _0x5a9e3b=[];var _0x4fb8ef={};for(var _0x4d1b1e in _0x5bcbeb){let _0x3d666a=contactItemTypes['find'](_0x7d41a7=>_0x7d41a7['name']===_0x4d1b1e);let _0x4a4c43=contactItemTypes['find'](_0x33f7ea=>_0x33f7ea['name']+'_description'===_0x4d1b1e);if(_[_0x5b83('0x1d')](_0x3d666a)&&_[_0x5b83('0x1d')](_0x4a4c43)){if(_0x5bcbeb[_0x5b83('0x81')](_0x4d1b1e)){if(_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0][_0x5bcbeb[_0x4d1b1e]]){var _0x450df2=_['trim'](_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0][_0x5bcbeb[_0x4d1b1e]][_0x5b83('0x82')](/"/g,'\x27'));switch(_0x4d1b1e){case _0x5b83('0x42'):var _0x39c0ad=moment(_0x450df2,_0x5b83('0xe'),!![]);if(_0x39c0ad['isValid']()){_0x26f087['push']('\x22'+_0x450df2+'\x22');}else{_0x1a7e02[_0x5b83('0x19')](_0x5b83('0x83'));}break;case _0x5b83('0x2e'):var _0x5160f1=parseInt(_0x450df2);_0x450df2=_[_0x5b83('0x84')](_0x5160f1)||_0x5160f1<0x0||_0x5160f1>0x4?_0xa8ee8b?0x3:0x2:_0x5160f1;_0x26f087[_0x5b83('0x19')]('\x22'+_0x450df2+'\x22');break;case _0x5b83('0x44'):var _0x51a47e=parseInt(_0x450df2);if(_['isNumber'](_0x51a47e)&&_[_0x5b83('0x85')](_0x43d803,_0x51a47e)){_0x26f087[_0x5b83('0x19')]('\x22'+_0x51a47e+'\x22');}else{_0x1a7e02[_0x5b83('0x19')](_0x5b83('0x86'));}break;case'email':if(isEmail(_0x450df2)){_0x26f087[_0x5b83('0x19')]('\x22'+_0x450df2+'\x22');}else{_0x1a7e02[_0x5b83('0x19')](_0x5b83('0x87'));}break;case _0x5b83('0x88'):var _0x156116=moment(_0x450df2,_0x5b83('0x89'),!![]);if(_0x156116[_0x5b83('0x8a')]()){_0x26f087['push']('\x22'+_0x450df2+'\x22');}else{_0x1a7e02[_0x5b83('0x19')](_0x5b83('0x8b'));}break;case _0x5b83('0x6d'):var _0x5e485b=shared[_0x5b83('0x6c')];var _0x41c9fc=_0x5e485b[_0x450df2];if(!_[_0x5b83('0x1d')](_0x41c9fc)){var _0x3faf90=_0x41c9fc['utcOffset'];_0x26f087[_0x5b83('0x19')]('\x22'+_0x450df2+'\x22');_0x26f087[_0x5b83('0x19')]('\x22'+_0x3faf90+'\x22');}break;default:_0x26f087['push']('\x22'+_0x450df2+'\x22');}}else{switch(_0x4d1b1e){case _0x5b83('0x8c'):case _0x5b83('0x3d'):_0x1a7e02[_0x5b83('0x19')](_0x4d1b1e+_0x5b83('0x8d'));break;default:_0x26f087[_0x5b83('0x19')]('\x22\x22');}}}}else{var _0xdcb855='';if(!_[_0x5b83('0x1d')](_0x3d666a)){if(!_0x4fb8ef[_0x5b83('0x81')](_0x3d666a['id'])){if(!_['isNil'](_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0][_0x5bcbeb[_0x4d1b1e]])){var _0x450df2=_[_0x5b83('0x8e')](_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0][_0x5bcbeb[_0x4d1b1e]]['replace'](/"/g,'\x27'));var _0xa67365=phoneDescriptions[_0x5b83('0x8f')](_0x535bc1=>_0x535bc1[_0x5b83('0x90')]===_0x3d666a['id']);if(!_[_0x5b83('0x1d')](_0xa67365)){var _0x126421=_['trim'](_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0][_0x5bcbeb[_0xa67365[_0x5b83('0x91')]]][_0x5b83('0x82')](/"/g,'\x27'));if(!_[_0x5b83('0x1d')](_0x126421))_0x450df2=_0x450df2+'§'+_0x126421;}if(_0xdcb855=='')_0xdcb855=_0x450df2;else _0xdcb855+='|'+_0x450df2;}_0x5a9e3b['push'](_0x3d666a['id']+':'+_0xdcb855);_0x4fb8ef[_0x3d666a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x26f087['push']('\x22'+_0x5a9e3b['join'](';')+'\x22');}if(_0x1a7e02[_0x5b83('0x18')]){handleError(_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0],{'code':_0x5b83('0x92'),'message':_0x1a7e02[_0x5b83('0x12')]()});}else{fs['appendFileSync'](_0x49f2bb,_0x26f087[_0x5b83('0x12')]()+'\x0a');}_0x26f087=[];}if(!(stats[_0x5b83('0x80')]%0xc8)){socket[_0x5b83('0x93')](_0x5b83('0x94')+_0x21a516,stats);stats[_0x5b83('0x5b')]=[];}}if(stopped){logger[_0x5b83('0x71')](_0x5b83('0x95'));_0x3be8b2[_0x5b83('0x96')]();}}catch(_0x5a149a){handleError(_0x56fcf1['data'][_0x1e96b0],{'code':_0x5b83('0x97'),'message':_0x5a149a[_0x5b83('0x5d')]});logger[_0x5b83('0x59')](_0x5b83('0x98'),_0x5a149a[_0x5b83('0x5d')]);}},'complete':function(){try{var _0x101b70=[];var _0xf9bff1=[];var _0x35e519=_0x5b83('0x30');if(_0x3bcabb[_0x5b83('0x99')]&&_0x3bcabb[_0x5b83('0x99')]['length']){_0x35e519=_0x5b83('0x9a')+_0x21a516;_0x101b70[_0x5b83('0x19')](_0x5b83('0x9b')+_0x35e519+_0x5b83('0x9c'));}tmp_campaigns=_0x5b83('0x9d')+_0x21a516;tmp_voice_queues=_0x5b83('0x9e')+_0x21a516;_0xf9bff1[_0x5b83('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x5b83('0x9f'));_0xf9bff1['push'](_0x5b83('0x9b')+tmp_voice_queues+_0x5b83('0x9f'));BPromise[_0x5b83('0xa0')](_0xf9bff1,handleTZQuery)['then'](function(_0x274b7b){updateTzCampaigns(_0x3bcabb[_0x5b83('0x43')])[_0x5b83('0x17')](function(_0x20e069){updateTzVoiceQueues(_0x3bcabb[_0x5b83('0x43')])[_0x5b83('0x17')](function(_0x526cb2){if(hasTZ)_0x3ae8a1=_0x3ae8a1[_0x5b83('0x82')](_0x5b83('0x6d'),_0x5b83('0xa1'));var _0x22c860=util[_0x5b83('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x49f2bb,_0x35e519,_0x3ae8a1,_0x3bcabb[_0x5b83('0x43')],_0x3bcabb[_0x5b83('0x52')]||null,NOW,NOW);if(_[_0x5b83('0x1d')](_0x5bcbeb[_0x5b83('0x42')])){_0x22c860+=_0x5b83('0xa2');}_0x101b70[_0x5b83('0x19')](_0x22c860);if(_0x3bcabb[_0x5b83('0x99')]&&_0x3bcabb[_0x5b83('0x99')][_0x5b83('0x18')]){_0x101b70[_0x5b83('0x19')](insertCmContact(_0x3bcabb[_0x5b83('0x43')],_0x35e519,_0x3bcabb[_0x5b83('0x99')],_0x5bcbeb));_0x101b70[_0x5b83('0x19')](_0x5b83('0xa3')+_0x35e519+';');}BPromise[_0x5b83('0xa0')](_0x101b70,handleQuery)[_0x5b83('0x17')](function(_0x16c452){BPromise[_0x5b83('0x1a')]([handleAdditionalPhones()])[_0x5b83('0x17')](function(){_0x101b70=[];for(var _0x384e68=0x0;_0x384e68\x20\x20');}var _0x36d5ad=path[_0x5b83('0x12')](config[_0x5b83('0xb0')],_0x5b83('0x78'),process[_0x5b83('0xaf')][0x2]);if(!fs[_0x5b83('0xb1')](_0x36d5ad)){throw new Error(_0x5b83('0xb2'));}var _0x113e44={};try{_0x113e44=JSON[_0x5b83('0xb3')](process[_0x5b83('0xaf')][0x3]);if(!_0x113e44[_0x5b83('0x75')]){throw new Error(_0x5b83('0xb4'));}if(!_0x113e44[_0x5b83('0x75')][_0x5b83('0x3d')]){throw new Error(_0x5b83('0xb5'));}if(!_0x113e44['binding'][_0x5b83('0x8c')]){throw new Error(_0x5b83('0xb6'));}var _0x42504c=0x0;if(_0x113e44['binding'][_0x5b83('0x44')]){_0x42504c=0x1;}if(!_0x113e44[_0x5b83('0x43')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x48eef3){throw new Error(_0x5b83('0xb7'));}var _0x5de667=[];try{_0x5de667=_[_0x5b83('0xb8')](JSON[_0x5b83('0xb3')](process[_0x5b83('0xaf')][0x4]),'id');}catch(_0x1b88c9){logger[_0x5b83('0x71')](_0x5b83('0xb9'));}main(_0x36d5ad,_0x113e44,_0x5de667,_0x42504c);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xc7c5=['AdditionalPhones','split','isNil','filter','CmContactHasItem','findOne','update','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.id','cm_contacts.createdAt','cm_hopper_black','select','cm_contacts','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','error','message','exit','errors','code','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','offset','dialTimezone','main','stringify','send','binding','clone','socket_timestamp','server/files/tmp','.csv','keys','header','ContactItemType','name','_description','writeFileSync','parse','data','rows','find','hasOwnProperty','trim','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','itemTypeId','SystemRow','appendFileSync','Abort\x20parser','abort','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','contact:import:','unlink','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','push','all'];(function(_0x15c94a,_0x3db00b){var _0x17b174=function(_0x4d680d){while(--_0x4d680d){_0x15c94a['push'](_0x15c94a['shift']());}};_0x17b174(++_0x3db00b);}(_0xc7c5,0x95));var _0x5c7c=function(_0x3d2cee,_0x26bf65){_0x3d2cee=_0x3d2cee-0x0;var _0x11018e=_0xc7c5[_0x3d2cee];return _0x11018e;};'use strict';var fs=require('fs');var path=require(_0x5c7c('0x0'));var _=require('lodash');var Papa=require(_0x5c7c('0x1'));var util=require(_0x5c7c('0x2'));var BPromise=require(_0x5c7c('0x3'));var moment=require('moment');var squel=require(_0x5c7c('0x4'));var Redis=require(_0x5c7c('0x5'));var db=require(_0x5c7c('0x6'))['db'];var config=require(_0x5c7c('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0x5c7c('0x8'))(_0x5c7c('0x9'));config[_0x5c7c('0xa')]=_[_0x5c7c('0xb')](config[_0x5c7c('0xa')],{'host':_0x5c7c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c7c('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5c7c('0xd')](_0x5c7c('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5c7c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x1fc97b){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x1fc97b);}function selectNotIn(_0x3de2c2,_0x28f2be,_0x225e8d,_0x345d2f,_0x29397f){return squel['select']()[_0x5c7c('0xf')](_0x5c7c('0x10'))[_0x5c7c('0x11')](_0x345d2f)[_0x5c7c('0x12')](_0x28f2be,null,_0x28f2be+_0x5c7c('0x13')+_0x345d2f+'.'+_0x225e8d)['where'](_0x345d2f+'.'+_0x225e8d+_0x5c7c('0x14')+_0x3de2c2+'.'+_0x225e8d)['where'](_0x28f2be+_0x5c7c('0x15')+_0x29397f[_0x5c7c('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x54e896,_0x8ca61b){promisesAdditionalPhones=[];return db[_0x5c7c('0x16')][_0x5c7c('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5c7c('0x18')](function(_0x55a444){if(_0x55a444!==null){var _0x1028e6=[];for(var _0x461127=0x0;_0x461127<_0x55a444[_0x5c7c('0x19')];_0x461127++){var _0x1ccfd2=_0x55a444[_0x461127];_0x1028e6[_0x5c7c('0x1a')](insertAdditionalPhones(_0x1ccfd2));}}Promise[_0x5c7c('0x1b')](_0x1028e6)['then'](function(){_0x54e896({'val':0x1});});});});}function insertAdditionalPhones(_0x58e2bc){return new Promise(function(_0x3d4906,_0x39fd6a){var _0x3f9878=_0x58e2bc[_0x5c7c('0x1c')];var _0x37e5d3=_0x3f9878[_0x5c7c('0x1d')](';');var _0x46bbf8=[];orderBy=0x0;for(var _0x5b3057=0x0;_0x5b3057<_0x37e5d3[_0x5c7c('0x19')];_0x5b3057++){_0x46bbf8[_0x5c7c('0x1a')](splitAdditionalPhone(_0x58e2bc['id'],_0x37e5d3[_0x5b3057]));}Promise[_0x5c7c('0x1b')](_0x46bbf8)[_0x5c7c('0x18')](function(){_0x3d4906({'val':_0x37e5d3[_0x5c7c('0x19')]});});});}function splitAdditionalPhone(_0x5cdd40,_0x184bdc){return new Promise(function(_0x3de834,_0x34ca3e){var _0x100ebc=_0x184bdc['split'](':');var _0x31df02=_0x100ebc[0x0];var _0x4f317c=_0x100ebc[0x1];if(!_[_0x5c7c('0x1e')](_0x4f317c)){var _0x2fe896=_0x4f317c[_0x5c7c('0x1d')]('|');var _0x3c4474=[];for(var _0x4a121a=0x0;_0x4a121a<_0x2fe896[_0x5c7c('0x19')];_0x4a121a++){if(_0x2fe896[_0x4a121a]!==''){var _0x3b3927=_[_0x5c7c('0x1f')](promisesAdditionalPhones,{'contactId':_0x5cdd40,'phone':_0x2fe896[_0x4a121a]});if(_0x3b3927[_0x5c7c('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x5c7c('0x1a')]({'contactId':_0x5cdd40,'contactTypeId':_0x31df02,'phone':_0x2fe896[_0x4a121a],'orderBy':orderBy});}}}_0x3de834({'ok':0x1});}else _0x3de834({'res':0x0});});}function createAdditionalPhone(_0x5ca83d,_0x39db0f,_0x30bdb6,_0x16ea24){var _0x1174d9='';var _0x21fd3b='';var _0x53a4db=_0x30bdb6[_0x5c7c('0x1d')]('§');_0x1174d9=_0x53a4db[0x0];if(_0x53a4db[_0x5c7c('0x19')]==0x2)_0x21fd3b=_0x53a4db[0x1];return new Promise(function(_0x3237df,_0x3d7077){return db[_0x5c7c('0x20')][_0x5c7c('0x21')]({'where':{'CmContactId':_0x5ca83d,'item':_0x1174d9}})[_0x5c7c('0x18')](function(_0x23f6db){if(_0x23f6db){return db[_0x5c7c('0x20')][_0x5c7c('0x22')]({'ItemTypeId':_0x39db0f,'description':_0x21fd3b,'OrderBy':_0x16ea24},{'where':{'CmContactId':_0x5ca83d,'item':_0x1174d9}})['then'](function(_0x1451a5){_0x3237df({'res':'updated'});});}else{return db[_0x5c7c('0x20')][_0x5c7c('0x23')]({'CmContactId':_0x5ca83d,'item':_0x1174d9,'description':_0x21fd3b,'ItemTypeId':_0x39db0f,'OrderBy':_0x16ea24,'ItemClass':'PHONE'})[_0x5c7c('0x18')](function(_0x4ea07d){_0x3237df({'res':_0x5c7c('0x24')});});}});});}function insertCmHopper(_0x513524,_0x404a2b,_0x4ae6f2,_0x536ecb,_0x11b2ef){var _0x5c182d=[_0x5c7c('0x25'),_0x5c7c('0x26'),'cm_contacts.id',_0x5c7c('0x27'),_0x404a2b+'.'+_0x536ecb,'cm_contacts.createdAt',_0x5c7c('0x28'),_0x5c7c('0x29'),_0x5c7c('0x2a'),'\x22'+_0x11b2ef+'\x22'];return squel[_0x5c7c('0x2b')]()[_0x5c7c('0x2c')](_0x5c7c('0x2d'))[_0x5c7c('0x2e')]([_0x5c7c('0x10'),_0x5c7c('0x2f'),_0x5c7c('0x30'),_0x5c7c('0x31'),_0x536ecb,_0x5c7c('0x32'),_0x5c7c('0x33'),_0x5c7c('0x34'),_0x5c7c('0x35'),_0x5c7c('0x36')],squel['select']()[_0x5c7c('0x37')](_0x5c182d)[_0x5c7c('0x11')](_0x404a2b)[_0x5c7c('0x12')]('cm_contacts',null,_0x5c7c('0x38')+_0x404a2b+_0x5c7c('0x39'))['join'](_0x4ae6f2,null,_0x4ae6f2+_0x5c7c('0x13')+_0x404a2b+'.'+_0x536ecb)[_0x5c7c('0x3a')](_0x404a2b+_0x5c7c('0x3b'),_0x513524)[_0x5c7c('0x3a')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5c7c('0x3a')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x404a2b,_0x4ae6f2,_0x536ecb,'cm_hopper',[_0x5c7c('0x3c'),'\x22onlyIfOpen\x22']))[_0x5c7c('0x3a')](_0x5c7c('0x3d'),selectNotIn(_0x404a2b,_0x4ae6f2,_0x536ecb,_0x5c7c('0x2d'),[_0x5c7c('0x3c')])))['toString']();}function insertCmHopperBlack(_0x3f9be9,_0x131239,_0xd07d13,_0x54267f){var _0x534718=[_0x5c7c('0x25'),_0x5c7c('0x3e'),'cm_contacts.ListId',_0x131239+'.'+_0x54267f,_0x5c7c('0x3f'),'cm_contacts.updatedAt'];return squel[_0x5c7c('0x2b')]()[_0x5c7c('0x2c')](_0x5c7c('0x40'))['fromQuery'](['phone',_0x5c7c('0x30'),_0x5c7c('0x31'),_0x54267f,_0x5c7c('0x32'),_0x5c7c('0x33')],squel[_0x5c7c('0x41')]()[_0x5c7c('0x37')](_0x534718)['from'](_0x131239)['join'](_0x5c7c('0x42'),null,_0x5c7c('0x38')+_0x131239+_0x5c7c('0x39'))['join'](_0xd07d13,null,_0xd07d13+_0x5c7c('0x13')+_0x131239+'.'+_0x54267f)[_0x5c7c('0x3a')](_0x131239+_0x5c7c('0x3b'),_0x3f9be9)[_0x5c7c('0x3a')](_0x5c7c('0x43'),NOW)['where'](_0x5c7c('0x3d'),squel[_0x5c7c('0x41')]()[_0x5c7c('0xf')](_0x5c7c('0x10'))[_0x5c7c('0x11')](_0x5c7c('0x40'))[_0x5c7c('0x3a')](_0x5c7c('0x44'),_0x3f9be9)[_0x5c7c('0x3a')](_0x54267f+'\x20=\x20'+_0x131239+'.'+_0x54267f)))[_0x5c7c('0x45')]();}function insertTzCmHopper(_0x8cedbd,_0x5d25d3,_0x2c4aae,_0x55cbc3,_0x56854c,_0x17cc8d){var _0x3918fa=['cm_contacts.phone',_0x5c7c('0x46')+_0x17cc8d+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0x5c7c('0x27'),_0x5d25d3+'.'+_0x55cbc3,_0x5c7c('0x3f'),_0x5c7c('0x28'),_0x5c7c('0x29'),_0x5c7c('0x2a'),'\x22'+_0x56854c+'\x22'];var _0xe8456a=squel[_0x5c7c('0x2b')]()[_0x5c7c('0x2c')](_0x5c7c('0x2d'))[_0x5c7c('0x2e')]([_0x5c7c('0x10'),_0x5c7c('0x2f'),'ContactId',_0x5c7c('0x31'),_0x55cbc3,_0x5c7c('0x32'),_0x5c7c('0x33'),_0x5c7c('0x34'),_0x5c7c('0x35'),'recallme'],squel[_0x5c7c('0x41')]()['fields'](_0x3918fa)['from'](_0x5d25d3)[_0x5c7c('0x12')](_0x5c7c('0x42'),null,'cm_contacts.ListId\x20=\x20'+_0x5d25d3+_0x5c7c('0x39'))[_0x5c7c('0x12')](_0x2c4aae,null,_0x2c4aae+_0x5c7c('0x13')+_0x5d25d3+'.'+_0x55cbc3)[_0x5c7c('0x12')](_0x17cc8d,null,_0x17cc8d+_0x5c7c('0x13')+_0x5d25d3+'.'+_0x55cbc3)[_0x5c7c('0x3a')](_0x5d25d3+_0x5c7c('0x3b'),_0x8cedbd)['where'](_0x5c7c('0x43'),NOW)[_0x5c7c('0x3a')](_0x5c7c('0x3d'),selectNotIn(_0x5d25d3,_0x2c4aae,_0x55cbc3,_0x5c7c('0x2d'),['\x22always\x22','\x22onlyIfOpen\x22']))['where'](_0x5c7c('0x3d'),selectNotIn(_0x5d25d3,_0x2c4aae,_0x55cbc3,'cm_hopper',[_0x5c7c('0x3c')])))[_0x5c7c('0x45')]();return _0xe8456a;}function insertTzCmHopperBlack(_0x212635,_0x5d39f3,_0x4aeab9,_0x4789b7){var _0x53323f=[_0x5c7c('0x25'),_0x5c7c('0x3e'),_0x5c7c('0x27'),_0x5d39f3+'.'+_0x4789b7,'cm_contacts.createdAt',_0x5c7c('0x28')];return squel[_0x5c7c('0x2b')]()['into']('cm_hopper_black')[_0x5c7c('0x2e')]([_0x5c7c('0x10'),_0x5c7c('0x30'),_0x5c7c('0x31'),_0x4789b7,_0x5c7c('0x32'),'updatedAt'],squel[_0x5c7c('0x41')]()[_0x5c7c('0x37')](_0x53323f)['from'](_0x5d39f3)['join'](_0x5c7c('0x42'),null,_0x5c7c('0x38')+_0x5d39f3+_0x5c7c('0x39'))['join'](_0x4aeab9,null,_0x4aeab9+_0x5c7c('0x13')+_0x5d39f3+'.'+_0x4789b7)[_0x5c7c('0x3a')](_0x5d39f3+_0x5c7c('0x3b'),_0x212635)[_0x5c7c('0x3a')](_0x5c7c('0x43'),NOW)[_0x5c7c('0x3a')](_0x5c7c('0x3d'),squel[_0x5c7c('0x41')]()[_0x5c7c('0xf')]('phone')[_0x5c7c('0x11')]('cm_hopper_black')[_0x5c7c('0x3a')](_0x5c7c('0x44'),_0x212635)[_0x5c7c('0x3a')](_0x4789b7+_0x5c7c('0x14')+_0x5d39f3+'.'+_0x4789b7)))[_0x5c7c('0x45')]();}function insertCmHopperAdditionalPhones(_0x1a6738){var _0x480a1d=['cm_hopper.id',_0x5c7c('0x47'),'cm_contact_has_items.OrderBy',_0x5c7c('0x48'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x5c7c('0x2c')](_0x5c7c('0x49'))['fromQuery'](['CmHopperId',_0x5c7c('0x10'),_0x5c7c('0x4a'),'createdAt','updatedAt'],squel[_0x5c7c('0x41')]()['fields'](_0x480a1d)['from'](_0x5c7c('0x2d'))[_0x5c7c('0x12')](_0x5c7c('0x42'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join']('cm_contact_has_items',null,_0x5c7c('0x4b'))[_0x5c7c('0x3a')](_0x5c7c('0x4c'),_0x1a6738)[_0x5c7c('0x3a')](_0x5c7c('0x43'),NOW))['toString']();}function insertCmContact(_0x4f73c9,_0x117753,_0x227bc7,_0x1b0780){var _0x2c536b=_[_0x5c7c('0x4d')](_['keys'](_0x1b0780),['ListId',_0x5c7c('0x4e'),_0x5c7c('0x32'),_0x5c7c('0x33'),_0x5c7c('0x4f')]);return squel[_0x5c7c('0x2b')]()[_0x5c7c('0x2c')]('cm_contacts')[_0x5c7c('0x2e')](_0x2c536b,squel[_0x5c7c('0x41')]()[_0x5c7c('0x37')](_0x2c536b)[_0x5c7c('0x11')](_0x117753)[_0x5c7c('0x3a')]('('+_0x227bc7[_0x5c7c('0x12')](',')+_0x5c7c('0x50'),squel[_0x5c7c('0x41')]()[_0x5c7c('0x37')](_0x227bc7)[_0x5c7c('0x11')](_0x5c7c('0x42'))['where'](_0x5c7c('0x44'),_0x4f73c9)['where'](_0x5c7c('0x51')))[_0x5c7c('0x3a')](_0x5c7c('0x52'),squel[_0x5c7c('0x41')]()['field']('MIN(id)',_0x5c7c('0x53'))[_0x5c7c('0x11')](_0x117753)[_0x5c7c('0x54')](_0x227bc7[_0x5c7c('0x12')](','))))[_0x5c7c('0x45')]();}function handleStop(){logger[_0x5c7c('0x55')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x30f958){logger[_0x5c7c('0x56')](_0x30f958[_0x5c7c('0x57')]);process[_0x5c7c('0x58')](0x1);}function handleError(_0x56cb06,_0x204878){stats[_0x5c7c('0x59')][_0x5c7c('0x1a')]({'name':_0x204878[_0x5c7c('0x5a')],'message':_0x204878['message'],'row':_0x56cb06});}function handleQuery(_0x5b18aa){logger['info'](_0x5b18aa);return db['sequelize'][_0x5c7c('0x5b')](_0x5b18aa)['spread'](function(_0x5efddf){results[_0x5c7c('0x1a')](_0x5efddf);})[_0x5c7c('0x5c')](function(_0xb798a0){logger['error'](_0xb798a0[_0x5c7c('0x57')]);});}function updateTzCampaigns(_0x2e85bc){return new Promise(function(_0x4fce37,_0x3b2bc2){var _0x2fe11c=squel[_0x5c7c('0x41')]()[_0x5c7c('0x37')]([_0x5c7c('0x5d'),_0x5c7c('0x5e')])['from'](_0x5c7c('0x5f'))['join'](_0x5c7c('0x60'),null,_0x5c7c('0x61'))[_0x5c7c('0x3a')]('campaigns_has_cm_lists.CmListId='+_0x2e85bc);db[_0x5c7c('0x62')][_0x5c7c('0x5b')](_0x2fe11c[_0x5c7c('0x45')]())[_0x5c7c('0x63')](function(_0x122ae3){var _0x402b9f=[];for(var _0x572c14=0x0;_0x572c14<_0x122ae3['length'];_0x572c14++){_0x402b9f['push'](getTimezoneData(_0x122ae3[_0x572c14],tmp_campaigns));}BPromise[_0x5c7c('0x1b')](_0x402b9f)['then'](function(){_0x4fce37({'val':0x1});});})[_0x5c7c('0x5c')](function(_0x28c1ae){logger['error'](_0x28c1ae[_0x5c7c('0x57')]);_0x4fce37({'val':0x0});});});}function updateTzVoiceQueues(_0x18780f){return new Promise(function(_0xf0e1f4,_0x27cb4c){var _0x797e5c=squel[_0x5c7c('0x41')]()[_0x5c7c('0x37')]([_0x5c7c('0x64'),_0x5c7c('0x65')])[_0x5c7c('0x11')](_0x5c7c('0x66'))[_0x5c7c('0x12')](_0x5c7c('0x67'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0x5c7c('0x68')+_0x18780f);db['sequelize'][_0x5c7c('0x5b')](_0x797e5c[_0x5c7c('0x45')]())[_0x5c7c('0x63')](function(_0x2ecf68){var _0x48d42f=[];for(var _0x38a1b3=0x0;_0x38a1b3<_0x2ecf68[_0x5c7c('0x19')];_0x38a1b3++){_0x48d42f['push'](getTimezoneData(_0x2ecf68[_0x38a1b3],tmp_voice_queues));}BPromise[_0x5c7c('0x1b')](_0x48d42f)[_0x5c7c('0x18')](function(){_0xf0e1f4({'val':0x1});});})['catch'](function(_0x1d4e3e){logger[_0x5c7c('0x56')](_0x1d4e3e[_0x5c7c('0x57')]);_0xf0e1f4({'val':0x0});});});}function getTimezoneData(_0x3b0f88,_0x2c5f53){return new Promise(function(_0x2ec8fa,_0x3bc298){var _0x538fc2=shared[_0x5c7c('0x69')];var _0x2ff114=_0x538fc2[_0x3b0f88['dialTimezone']];if(_[_0x5c7c('0x1e')](_0x2ff114)){_0x2ec8fa({'ret':0x1});}else{var _0x9697a6=_0x2ff114[_0x5c7c('0x6a')];var _0x5bd778=squel['insert']()[_0x5c7c('0x2c')](_0x2c5f53)['set']('id',_0x3b0f88['id'])[_0x5c7c('0x6b')](_0x5c7c('0x6c'),_0x9697a6)[_0x5c7c('0x6b')](_0x5c7c('0x6d'),_0x3b0f88[_0x5c7c('0x6d')])['toString']();return db[_0x5c7c('0x62')][_0x5c7c('0x5b')](_0x5bd778)[_0x5c7c('0x63')](function(_0x4c29dd){_0x2ec8fa({'ret':0x1});})[_0x5c7c('0x5c')](function(_0x2d674d){logger[_0x5c7c('0x56')](_0x2d674d['message']);_0x3bc298({'ret':0x1});});}});}function handleTZQuery(_0x60dbd1){logger['info'](_0x60dbd1);return db[_0x5c7c('0x62')]['query'](_0x60dbd1)[_0x5c7c('0x63')](function(_0x234c4d){})[_0x5c7c('0x5c')](function(_0x492a75){logger[_0x5c7c('0x56')](_0x492a75['message']);});}function main(_0x5d9a40,_0x957575,_0x3a02a9,_0x2c53b3){logger[_0x5c7c('0x55')](_0x5c7c('0x6e'),_0x5d9a40,JSON[_0x5c7c('0x6f')](_0x957575));process[_0x5c7c('0x70')]('start');var _0xfcbe60=_0x957575[_0x5c7c('0x71')];var _0x5a2f94=_[_0x5c7c('0x72')](_0xfcbe60);var _0x1aa623=_0x957575[_0x5c7c('0x73')];var _0x3df139=path['join'](config['root'],_0x5c7c('0x74'),_0x1aa623+_0x5c7c('0x75'));hasTZ=_['keys'](_0xfcbe60)['includes']('dialTimezone');var _0x224f91=_[_0x5c7c('0x76')](_0xfcbe60)[_0x5c7c('0x12')]();logger[_0x5c7c('0x55')](_0x5c7c('0x77'),_0x224f91);db[_0x5c7c('0x78')][_0x5c7c('0x17')]({'raw':!![],'attributes':['id',_0x5c7c('0x79')]})[_0x5c7c('0x18')](function(_0x115fd6){for(var _0x6685d1=0x0;_0x6685d1<_0x115fd6[_0x5c7c('0x19')];_0x6685d1++){if(_0x115fd6[_0x6685d1][_0x5c7c('0x79')]in _0xfcbe60){contactItemTypes['push'](_0x115fd6[_0x6685d1]);delete _0x5a2f94[_0x115fd6[_0x6685d1][_0x5c7c('0x79')]];hasAdditionalPhones=!![];}for(var _0xff2ae6 in _0xfcbe60){if(_0x115fd6[_0x6685d1]['name']+_0x5c7c('0x7a')===_0xff2ae6){phoneDescriptions[_0x5c7c('0x1a')]({'itemTypeId':_0x115fd6[_0x6685d1]['id'],'description':_0xff2ae6});delete _0x5a2f94[_0xff2ae6];}}}if(hasAdditionalPhones)_0x5a2f94[_0x5c7c('0x1c')]='';var _0x57f8eb=_[_0x5c7c('0x76')](_0x5a2f94)[_0x5c7c('0x12')]();logger[_0x5c7c('0x55')]('header',_0x57f8eb);fs[_0x5c7c('0x7b')](_0x3df139,_0x57f8eb+'\x0a');Papa[_0x5c7c('0x7c')](fs['createReadStream'](_0x5d9a40),{'header':!![],'skipEmptyLines':!![],'step':function(_0x32cf4f,_0x5274b1){try{for(var _0x171a8d=0x0,_0x1c9d5b=[];_0x171a8d<_0x32cf4f[_0x5c7c('0x7d')][_0x5c7c('0x19')];_0x171a8d++){stats[_0x5c7c('0x7e')]+=0x1;if(_0x32cf4f[_0x5c7c('0x59')][_0x171a8d]){handleError(_0x32cf4f[_0x5c7c('0x7d')][_0x171a8d],_0x32cf4f['errors'][_0x171a8d]);}else{var _0x3f26f8=[];var _0xfe0832=[];var _0x42fad3={};for(var _0x43c523 in _0xfcbe60){let _0x352a7e=contactItemTypes[_0x5c7c('0x7f')](_0x1d442e=>_0x1d442e['name']===_0x43c523);let _0xdb9f69=contactItemTypes[_0x5c7c('0x7f')](_0x327182=>_0x327182[_0x5c7c('0x79')]+_0x5c7c('0x7a')===_0x43c523);if(_[_0x5c7c('0x1e')](_0x352a7e)&&_['isNil'](_0xdb9f69)){if(_0xfcbe60[_0x5c7c('0x80')](_0x43c523)){if(_0x32cf4f[_0x5c7c('0x7d')][_0x171a8d][_0xfcbe60[_0x43c523]]){var _0x119506=_[_0x5c7c('0x81')](_0x32cf4f['data'][_0x171a8d][_0xfcbe60[_0x43c523]]['replace'](/"/g,'\x27'));switch(_0x43c523){case _0x5c7c('0x2f'):var _0x4cb6e8=moment(_0x119506,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4cb6e8[_0x5c7c('0x82')]()){_0x1c9d5b[_0x5c7c('0x1a')]('\x22'+_0x119506+'\x22');}else{_0x3f26f8[_0x5c7c('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x5c7c('0x34'):var _0x1c3823=parseInt(_0x119506);_0x119506=_[_0x5c7c('0x83')](_0x1c3823)||_0x1c3823<0x0||_0x1c3823>0x4?_0x2c53b3?0x3:0x2:_0x1c3823;_0x1c9d5b[_0x5c7c('0x1a')]('\x22'+_0x119506+'\x22');break;case'UserId':var _0x2a848d=parseInt(_0x119506);if(_[_0x5c7c('0x84')](_0x2a848d)&&_[_0x5c7c('0x85')](_0x3a02a9,_0x2a848d)){_0x1c9d5b[_0x5c7c('0x1a')]('\x22'+_0x2a848d+'\x22');}else{_0x3f26f8['push'](_0x5c7c('0x86'));}break;case _0x5c7c('0x87'):if(isEmail(_0x119506)){_0x1c9d5b[_0x5c7c('0x1a')]('\x22'+_0x119506+'\x22');}else{_0x3f26f8[_0x5c7c('0x1a')](_0x5c7c('0x88'));}break;case'dateOfBirth':var _0x30a5c1=moment(_0x119506,'YYYY-MM-DD',!![]);if(_0x30a5c1[_0x5c7c('0x82')]()){_0x1c9d5b[_0x5c7c('0x1a')]('\x22'+_0x119506+'\x22');}else{_0x3f26f8[_0x5c7c('0x1a')](_0x5c7c('0x89'));}break;case'dialTimezone':var _0x5c5866=shared[_0x5c7c('0x69')];var _0x1bf194=_0x5c5866[_0x119506];if(!_['isNil'](_0x1bf194)){var _0x552648=_0x1bf194[_0x5c7c('0x6a')];_0x1c9d5b[_0x5c7c('0x1a')]('\x22'+_0x119506+'\x22');_0x1c9d5b['push']('\x22'+_0x552648+'\x22');}break;default:_0x1c9d5b[_0x5c7c('0x1a')]('\x22'+_0x119506+'\x22');}}else{switch(_0x43c523){case _0x5c7c('0x8a'):case'phone':_0x3f26f8[_0x5c7c('0x1a')](_0x43c523+_0x5c7c('0x8b'));break;default:_0x1c9d5b[_0x5c7c('0x1a')]('\x22\x22');}}}}else{var _0x1cb376='';if(!_[_0x5c7c('0x1e')](_0x352a7e)){if(!_0x42fad3['hasOwnProperty'](_0x352a7e['id'])){if(!_[_0x5c7c('0x1e')](_0x32cf4f[_0x5c7c('0x7d')][_0x171a8d][_0xfcbe60[_0x43c523]])){var _0x119506=_['trim'](_0x32cf4f[_0x5c7c('0x7d')][_0x171a8d][_0xfcbe60[_0x43c523]][_0x5c7c('0x8c')](/"/g,'\x27'));var _0x2aeb57=phoneDescriptions[_0x5c7c('0x7f')](_0x1d4fa0=>_0x1d4fa0[_0x5c7c('0x8d')]===_0x352a7e['id']);if(!_['isNil'](_0x2aeb57)){var _0x59163b=_[_0x5c7c('0x81')](_0x32cf4f[_0x5c7c('0x7d')][_0x171a8d][_0xfcbe60[_0x2aeb57['description']]][_0x5c7c('0x8c')](/"/g,'\x27'));if(!_[_0x5c7c('0x1e')](_0x59163b))_0x119506=_0x119506+'§'+_0x59163b;}if(_0x1cb376=='')_0x1cb376=_0x119506;else _0x1cb376+='|'+_0x119506;}_0xfe0832[_0x5c7c('0x1a')](_0x352a7e['id']+':'+_0x1cb376);_0x42fad3[_0x352a7e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1c9d5b[_0x5c7c('0x1a')]('\x22'+_0xfe0832['join'](';')+'\x22');}if(_0x3f26f8['length']){handleError(_0x32cf4f[_0x5c7c('0x7d')][_0x171a8d],{'code':_0x5c7c('0x8e'),'message':_0x3f26f8[_0x5c7c('0x12')]()});}else{fs[_0x5c7c('0x8f')](_0x3df139,_0x1c9d5b[_0x5c7c('0x12')]()+'\x0a');}_0x1c9d5b=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x1aa623,stats);stats[_0x5c7c('0x59')]=[];}}if(stopped){logger[_0x5c7c('0x55')](_0x5c7c('0x90'));_0x5274b1[_0x5c7c('0x91')]();}}catch(_0x1c9e60){handleError(_0x32cf4f[_0x5c7c('0x7d')][_0x171a8d],{'code':'SystemError','message':_0x1c9e60['message']});logger[_0x5c7c('0x56')](_0x5c7c('0x92'),_0x1c9e60[_0x5c7c('0x57')]);}},'complete':function(){try{var _0x54864f=[];var _0x4bb3a3=[];var _0x5be647=_0x5c7c('0x42');if(_0x957575['duplicates']&&_0x957575[_0x5c7c('0x93')][_0x5c7c('0x19')]){_0x5be647='cm_contacts_'+_0x1aa623;_0x54864f[_0x5c7c('0x1a')](_0x5c7c('0x94')+_0x5be647+_0x5c7c('0x95'));}tmp_campaigns='campaigns_'+_0x1aa623;tmp_voice_queues=_0x5c7c('0x96')+_0x1aa623;_0x4bb3a3[_0x5c7c('0x1a')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x4bb3a3[_0x5c7c('0x1a')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x5c7c('0x97')](_0x4bb3a3,handleTZQuery)[_0x5c7c('0x18')](function(_0x49fe8b){updateTzCampaigns(_0x957575['ListId'])[_0x5c7c('0x18')](function(_0x214469){updateTzVoiceQueues(_0x957575['ListId'])[_0x5c7c('0x18')](function(_0x23d17f){if(hasTZ)_0x57f8eb=_0x57f8eb[_0x5c7c('0x8c')](_0x5c7c('0x6d'),'dialTimezone,utcOffset');var _0xc37074=util['format'](_0x5c7c('0x98'),_0x3df139,_0x5be647,_0x57f8eb,_0x957575['ListId'],_0x957575[_0x5c7c('0x4e')]||null,NOW,NOW);if(_[_0x5c7c('0x1e')](_0xfcbe60[_0x5c7c('0x2f')])){_0xc37074+=_0x5c7c('0x99');}_0x54864f['push'](_0xc37074);if(_0x957575['duplicates']&&_0x957575[_0x5c7c('0x93')][_0x5c7c('0x19')]){_0x54864f[_0x5c7c('0x1a')](insertCmContact(_0x957575['ListId'],_0x5be647,_0x957575[_0x5c7c('0x93')],_0xfcbe60));_0x54864f['push'](_0x5c7c('0x9a')+_0x5be647+';');}BPromise[_0x5c7c('0x97')](_0x54864f,handleQuery)[_0x5c7c('0x18')](function(_0x3e6f93){BPromise[_0x5c7c('0x1b')]([handleAdditionalPhones()])['then'](function(){_0x54864f=[];for(var _0x1b5a5f=0x0;_0x1b5a5f\x20\x20','existsSync','binding','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','uncaughtException','path','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','phone','AdditionalPhones','push','all','then','catch'];(function(_0x17b648,_0x114f76){var _0x47d7cc=function(_0x616a3b){while(--_0x616a3b){_0x17b648['push'](_0x17b648['shift']());}};_0x47d7cc(++_0x114f76);}(_0xc306,0x1a9));var _0x6c30=function(_0x429fec,_0x5c1bf6){_0x429fec=_0x429fec-0x0;var _0x3aeae6=_0xc306[_0x429fec];return _0x3aeae6;};'use strict';var fs=require('fs');var path=require(_0x6c30('0x0'));var _=require('lodash');var Papa=require(_0x6c30('0x1'));var util=require(_0x6c30('0x2'));var BPromise=require(_0x6c30('0x3'));var moment=require(_0x6c30('0x4'));var squel=require(_0x6c30('0x5'));var Redis=require('ioredis');var db=require(_0x6c30('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x6c30('0x7'))(_0x6c30('0x8'));config[_0x6c30('0x9')]=_[_0x6c30('0xa')](config[_0x6c30('0x9')],{'host':_0x6c30('0xb'),'port':0x18eb});var socket=require(_0x6c30('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6c30('0xd')](_0x6c30('0xe'));var tempTableName=_0x6c30('0xf')+moment()['format'](_0x6c30('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4a6fd7){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4a6fd7);}function selectNotIn(_0x459b83,_0x512397,_0x593772,_0x4ef518,_0x2778f3){return squel[_0x6c30('0x11')]()[_0x6c30('0x12')]('phone')[_0x6c30('0x13')](_0x4ef518)['join'](_0x512397,null,_0x512397+_0x6c30('0x14')+_0x4ef518+'.'+_0x593772)['where'](_0x4ef518+'.'+_0x593772+'\x20=\x20'+_0x459b83+'.'+_0x593772)[_0x6c30('0x15')](_0x512397+_0x6c30('0x16')+_0x2778f3['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1e7564,_0x10a584){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6c30('0x17')][_0x6c30('0x18')]('select\x20*\x20from\x20'+tempTableName)[_0x6c30('0x19')](function(_0x258e8d){if(_0x258e8d!==null){var _0x29a5e6=[];for(var _0x46fdfa=0x0;_0x46fdfa<_0x258e8d[_0x6c30('0x1a')];_0x46fdfa++){var _0x1009d0=_0x258e8d[_0x46fdfa];if(!_[_0x6c30('0x1b')](_0x1009d0[_0x6c30('0x1c')])){if(!_[_0x6c30('0x1b')](_0x1009d0[_0x6c30('0x1d')]))_0x29a5e6['push'](insertAdditionalPhones(_0x1009d0));promisesContact[_0x6c30('0x1e')]({'contact':_0x1009d0});}}}Promise[_0x6c30('0x1f')](_0x29a5e6)[_0x6c30('0x20')](function(){_0x1e7564({'val':0x1});});})[_0x6c30('0x21')](function(_0x215331){logger['error'](_0x215331[_0x6c30('0x22')]);});});}function insertAdditionalPhones(_0x46f852){return new Promise(function(_0x141d64,_0x3557f7){var _0x36a009=_0x46f852[_0x6c30('0x1d')];if(_['isNil'](_0x36a009))_0x3557f7({'val':0x0});else{var _0x57685d=_0x36a009[_0x6c30('0x23')](';');var _0x4688fa=[];orderBy=0x0;for(var _0x12cf4c=0x0;_0x12cf4c<_0x57685d[_0x6c30('0x1a')];_0x12cf4c++){_0x4688fa[_0x6c30('0x1e')](splitAdditionalPhone(_0x46f852['id'],_0x57685d[_0x12cf4c]));}Promise[_0x6c30('0x1f')](_0x4688fa)[_0x6c30('0x20')](function(){_0x141d64({'val':_0x57685d[_0x6c30('0x1a')]});});}});}function splitAdditionalPhone(_0x32ff68,_0xa4a3bc){return new Promise(function(_0x440b1f,_0x12db02){var _0x15f643=_0xa4a3bc[_0x6c30('0x23')](':');var _0x5df2a4=_0x15f643[0x0];var _0x42135d=_0x15f643[0x1];if(_0x42135d!==''){var _0x1152f3=_0x42135d['split']('|');var _0x190693=[];for(var _0x6fc3f8=0x0;_0x6fc3f8<_0x1152f3[_0x6c30('0x1a')];_0x6fc3f8++){if(_0x1152f3[_0x6fc3f8]!==''){var _0x478c75=_[_0x6c30('0x24')](promisesAdditionalPhones,{'contactId':_0x32ff68,'phone':_0x1152f3[_0x6fc3f8]});if(_0x478c75[_0x6c30('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x6c30('0x1e')]({'contactId':_0x32ff68,'contactTypeId':_0x5df2a4,'phone':_0x1152f3[_0x6fc3f8],'orderBy':orderBy});}}}_0x440b1f({'ok':0x1});}else _0x440b1f({'res':0x0});});}function createAdditionalPhone(_0x1a22e7,_0x32670f,_0x256159,_0x34c550){var _0x2c8af7='';var _0x58de1c='';var _0x20effb=_0x256159[_0x6c30('0x23')]('§');_0x2c8af7=_0x20effb[0x0];if(_0x20effb[_0x6c30('0x1a')]==0x2)_0x58de1c=_0x20effb[0x1];return new Promise(function(_0x3b6ac7,_0x4ccd1a){return db['CmContactHasItem'][_0x6c30('0x25')]({'where':{'CmContactId':_0x1a22e7,'item':_0x2c8af7}})[_0x6c30('0x20')](function(_0x29bc69){if(_0x29bc69){return db[_0x6c30('0x26')][_0x6c30('0x27')]({'ItemTypeId':_0x32670f,'description':_0x58de1c,'OrderBy':_0x34c550},{'where':{'CmContactId':_0x1a22e7,'item':_0x2c8af7}})[_0x6c30('0x20')](function(_0x2a14f7){_0x3b6ac7({'res':_0x6c30('0x28')});});}else{return db[_0x6c30('0x26')][_0x6c30('0x29')]({'CmContactId':_0x1a22e7,'item':_0x2c8af7,'ItemTypeId':_0x32670f,'description':_0x58de1c,'OrderBy':_0x34c550,'ItemClass':'PHONE'})[_0x6c30('0x20')](function(_0x9aa463){_0x3b6ac7({'res':'inserted'});});}});});}function updateContact(_0x1b8077){return new Promise(function(_0x1e9997,_0x314999){var _0x4cf1c5=_0x1b8077['id'];delete _0x1b8077['id'];return db['CmContact'][_0x6c30('0x27')](_0x1b8077,{'where':{'id':_0x4cf1c5}})['then'](function(_0x5e852c){updatedRows+=0x1;return db['CmHopper'][_0x6c30('0x27')]({'phone':_0x1b8077[_0x6c30('0x1c')]},{'where':{'ContactId':_0x4cf1c5}})[_0x6c30('0x20')](function(_0x2fb9d0){_0x1e9997({'ret':'OK'});});});});}function insertCmHopper(_0x2079af,_0x4f1e14,_0x5eacd3,_0x1e70fb,_0x5ef088){var _0x5b686e=[_0x6c30('0x2a'),_0x6c30('0x2b'),_0x6c30('0x2c'),_0x6c30('0x2d'),_0x4f1e14+'.'+_0x1e70fb,_0x6c30('0x2e'),_0x6c30('0x2f'),_0x6c30('0x30'),_0x6c30('0x31'),'\x22'+_0x5ef088+'\x22'];return squel[_0x6c30('0x32')]()[_0x6c30('0x33')](_0x6c30('0x34'))[_0x6c30('0x35')]([_0x6c30('0x1c'),'scheduledat',_0x6c30('0x36'),_0x6c30('0x37'),_0x1e70fb,_0x6c30('0x38'),_0x6c30('0x39'),_0x6c30('0x3a'),_0x6c30('0x3b'),_0x6c30('0x3c')],squel[_0x6c30('0x11')]()[_0x6c30('0x3d')](_0x5b686e)['from'](_0x4f1e14)[_0x6c30('0x3e')](_0x6c30('0x3f'),null,_0x6c30('0x40')+_0x4f1e14+_0x6c30('0x41'))[_0x6c30('0x3e')](_0x5eacd3,null,_0x5eacd3+'.id\x20=\x20'+_0x4f1e14+'.'+_0x1e70fb)[_0x6c30('0x15')](_0x4f1e14+_0x6c30('0x42'),_0x2079af)[_0x6c30('0x15')](_0x6c30('0x43'),NOW)[_0x6c30('0x15')](_0x6c30('0x44'),selectNotIn(_0x4f1e14,_0x5eacd3,_0x1e70fb,'cm_hopper',[_0x6c30('0x45'),_0x6c30('0x46')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f1e14,_0x5eacd3,_0x1e70fb,_0x6c30('0x34'),[_0x6c30('0x45')])))[_0x6c30('0x47')]();}function insertCmHopperBlack(_0x4811aa,_0x11b39a,_0x1e10d1,_0x4e5edb){var _0x1a86bb=['cm_contacts.phone',_0x6c30('0x2c'),_0x6c30('0x2d'),_0x11b39a+'.'+_0x4e5edb,_0x6c30('0x2e'),'cm_contacts.updatedAt'];return squel[_0x6c30('0x32')]()[_0x6c30('0x33')]('cm_hopper_black')[_0x6c30('0x35')]([_0x6c30('0x1c'),_0x6c30('0x36'),'ListId',_0x4e5edb,_0x6c30('0x38'),'updatedAt'],squel['select']()['fields'](_0x1a86bb)[_0x6c30('0x13')](_0x11b39a)[_0x6c30('0x3e')](_0x6c30('0x3f'),null,_0x6c30('0x40')+_0x11b39a+'.CmListId')[_0x6c30('0x3e')](_0x1e10d1,null,_0x1e10d1+_0x6c30('0x14')+_0x11b39a+'.'+_0x4e5edb)[_0x6c30('0x15')](_0x11b39a+_0x6c30('0x42'),_0x4811aa)['where'](_0x6c30('0x43'),NOW)[_0x6c30('0x15')](_0x6c30('0x44'),squel[_0x6c30('0x11')]()[_0x6c30('0x12')](_0x6c30('0x1c'))['from'](_0x6c30('0x48'))[_0x6c30('0x15')](_0x6c30('0x49'),_0x4811aa)['where'](_0x4e5edb+'\x20=\x20?',_0x11b39a+'.'+_0x4e5edb)))['toString']();}function insertCmHopperAdditionalPhones(_0x1e534e){var _0xb10de4=[_0x6c30('0x4a'),_0x6c30('0x4b'),_0x6c30('0x4c'),'cm_contact_has_items.createdAt',_0x6c30('0x4d')];return squel[_0x6c30('0x32')]()[_0x6c30('0x33')](_0x6c30('0x4e'))[_0x6c30('0x35')]([_0x6c30('0x4f'),_0x6c30('0x1c'),_0x6c30('0x50'),_0x6c30('0x38'),_0x6c30('0x39')],squel[_0x6c30('0x11')]()['fields'](_0xb10de4)[_0x6c30('0x13')](_0x6c30('0x34'))[_0x6c30('0x3e')](_0x6c30('0x3f'),null,_0x6c30('0x51'))[_0x6c30('0x3e')](_0x6c30('0x52'),null,_0x6c30('0x53'))[_0x6c30('0x15')]('cm_hopper.ListId\x20=\x20?',_0x1e534e)[_0x6c30('0x15')](_0x6c30('0x43'),NOW))['toString']();}function insertCmContact(_0x2507f0,_0x4a800c,_0x354435,_0x4a1a29){var _0x447f0e=_[_0x6c30('0x54')](_[_0x6c30('0x55')](_0x4a1a29),[_0x6c30('0x37'),_0x6c30('0x56'),_0x6c30('0x38'),_0x6c30('0x39')]);return squel[_0x6c30('0x32')]()[_0x6c30('0x33')](_0x6c30('0x3f'))[_0x6c30('0x35')](_0x447f0e,squel['select']()['fields'](_0x447f0e)['from'](_0x4a800c)[_0x6c30('0x15')]('('+_0x354435['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x6c30('0x11')]()[_0x6c30('0x3d')](_0x354435)[_0x6c30('0x13')](_0x6c30('0x3f'))[_0x6c30('0x15')]('ListId\x20=\x20?',_0x2507f0))[_0x6c30('0x15')]('id\x20IN\x20?',squel[_0x6c30('0x11')]()[_0x6c30('0x12')](_0x6c30('0x57'),'min_id')[_0x6c30('0x13')](_0x4a800c)[_0x6c30('0x58')](_0x354435[_0x6c30('0x3e')](','))))[_0x6c30('0x47')]();}function handleStop(){logger[_0x6c30('0x59')](_0x6c30('0x5a'));stopped=!![];}function handleUncaughtException(_0xc0271b){logger[_0x6c30('0x5b')](_0xc0271b['message']);process[_0x6c30('0x5c')](0x1);}function handleError(_0x361670,_0x2e242a){stats[_0x6c30('0x5d')][_0x6c30('0x1e')]({'name':_0x2e242a[_0x6c30('0x5e')],'message':_0x2e242a['message'],'row':_0x361670});}function handleQuery(_0x541b38){logger[_0x6c30('0x59')](_0x541b38);return db['sequelize'][_0x6c30('0x18')](_0x541b38)[_0x6c30('0x19')](function(_0xf330fc){results[_0x6c30('0x1e')](_0xf330fc);})[_0x6c30('0x21')](function(_0x323d3b){logger[_0x6c30('0x5b')](_0x323d3b[_0x6c30('0x22')]);});}function main(_0x175886,_0x57405e,_0x525acb,_0x483222){logger[_0x6c30('0x59')]('main',_0x175886,JSON[_0x6c30('0x5f')](_0x57405e));process['send']('start');var _0x3d1bbd=_0x57405e['binding'];var _0x47f26d=_[_0x6c30('0x60')](_0x3d1bbd);var _0x43beba=_0x57405e['socket_timestamp'];var _0x4d381a=path['join'](config[_0x6c30('0x61')],_0x6c30('0x62'),_0x43beba+_0x6c30('0x63'));logger[_0x6c30('0x59')](_0x6c30('0x64'),_0x57405e);db[_0x6c30('0x65')][_0x6c30('0x66')]({'raw':!![],'attributes':['id',_0x6c30('0x67')]})['then'](function(_0x36f1f7){for(var _0xcaf974=0x0;_0xcaf974<_0x36f1f7['length'];_0xcaf974++){if(_0x36f1f7[_0xcaf974][_0x6c30('0x67')]in _0x3d1bbd){contactItemTypes['push'](_0x36f1f7[_0xcaf974]);delete _0x47f26d[_0x36f1f7[_0xcaf974][_0x6c30('0x67')]];hasAdditionalPhones=!![];}for(var _0x2e786e in _0x3d1bbd){if(_0x36f1f7[_0xcaf974][_0x6c30('0x67')]+_0x6c30('0x68')===_0x2e786e){phoneDescriptions[_0x6c30('0x1e')]({'itemTypeId':_0x36f1f7[_0xcaf974]['id'],'description':_0x2e786e});delete _0x47f26d[_0x2e786e];}}}if(hasAdditionalPhones)_0x47f26d[_0x6c30('0x1d')]='';var _0x42726c=_[_0x6c30('0x55')](_0x47f26d)[_0x6c30('0x3e')]();logger[_0x6c30('0x59')](_0x6c30('0x69'),_0x42726c);fs[_0x6c30('0x6a')](_0x4d381a,_0x42726c+'\x0a');Papa['parse'](fs['createReadStream'](_0x175886),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29a52d,_0x5b8129){try{for(var _0x5d4d46=0x0,_0x462b6a=[];_0x5d4d46<_0x29a52d[_0x6c30('0x6b')]['length'];_0x5d4d46++){stats[_0x6c30('0x6c')]+=0x1;if(_0x29a52d[_0x6c30('0x5d')][_0x5d4d46]){handleError(_0x29a52d[_0x6c30('0x6b')][_0x5d4d46],_0x29a52d[_0x6c30('0x5d')][_0x5d4d46]);}else{var _0x4a6129=[];var _0x2a9751=[];var _0x5092f1={};for(var _0x285770 in _0x3d1bbd){let _0x5c50dd=contactItemTypes[_0x6c30('0x6d')](_0x4feadb=>_0x4feadb['name']===_0x285770);let _0x39d0a9=contactItemTypes[_0x6c30('0x6d')](_0x4fc131=>_0x4fc131[_0x6c30('0x67')]+'_description'===_0x285770);if(_[_0x6c30('0x1b')](_0x5c50dd)&&_[_0x6c30('0x1b')](_0x39d0a9)){if(_0x3d1bbd['hasOwnProperty'](_0x285770)){if(_0x29a52d[_0x6c30('0x6b')][_0x5d4d46][_0x3d1bbd[_0x285770]]){var _0x5c293c=_[_0x6c30('0x6e')](_0x29a52d[_0x6c30('0x6b')][_0x5d4d46][_0x3d1bbd[_0x285770]][_0x6c30('0x6f')](/"/g,'\x27'));switch(_0x285770){case'scheduledat':var _0x49909e=moment(_0x5c293c,_0x6c30('0xe'),!![]);if(_0x49909e[_0x6c30('0x70')]()){_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x5c293c+'\x22');}else{_0x4a6129['push'](_0x6c30('0x71'));}break;case _0x6c30('0x3a'):var _0x48e251=parseInt(_0x5c293c);_0x5c293c=_[_0x6c30('0x72')](_0x48e251)||_0x48e251<0x0||_0x48e251>0x4?_0x483222?0x3:0x2:_0x48e251;_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x5c293c+'\x22');break;case _0x6c30('0x3b'):var _0x3eb402=parseInt(_0x5c293c);if(_[_0x6c30('0x73')](_0x3eb402)&&_[_0x6c30('0x74')](_0x525acb,_0x3eb402)){_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x3eb402+'\x22');}else{_0x4a6129[_0x6c30('0x1e')](_0x6c30('0x75'));}break;case _0x6c30('0x76'):if(isEmail(_0x5c293c)){_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x5c293c+'\x22');}else{_0x4a6129[_0x6c30('0x1e')](_0x6c30('0x77'));}break;case _0x6c30('0x78'):var _0x1da82a=moment(_0x5c293c,_0x6c30('0x79'),!![]);if(_0x1da82a[_0x6c30('0x70')]()){_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x5c293c+'\x22');}else{_0x4a6129[_0x6c30('0x1e')](_0x6c30('0x7a'));}break;default:_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x5c293c+'\x22');}}else{switch(_0x285770){case _0x6c30('0x7b'):case _0x6c30('0x1c'):_0x4a6129[_0x6c30('0x1e')](_0x285770+_0x6c30('0x7c'));break;default:_0x462b6a[_0x6c30('0x1e')]('\x22\x22');}}}}else{var _0x186461='';if(!_[_0x6c30('0x1b')](_0x5c50dd)){if(!_0x5092f1[_0x6c30('0x7d')](_0x5c50dd['id'])){for(var _0x402929=0x0;_0x402929<_0x3d1bbd[_0x285770][_0x6c30('0x1a')];_0x402929++){var _0x5c293c=_[_0x6c30('0x6e')](_0x29a52d[_0x6c30('0x6b')][_0x5d4d46][_0x3d1bbd[_0x285770][_0x402929]]['replace'](/"/g,'\x27'));var _0x526dac=phoneDescriptions[_0x6c30('0x6d')](_0x33788d=>_0x33788d[_0x6c30('0x7e')]===_0x5c50dd['id']);if(!_[_0x6c30('0x1b')](_0x526dac)){var _0x441fc3=_[_0x6c30('0x6e')](_0x29a52d[_0x6c30('0x6b')][_0x5d4d46][_0x3d1bbd[_0x526dac[_0x6c30('0x7f')]][0x0]][_0x6c30('0x6f')](/"/g,'\x27'));if(!_[_0x6c30('0x1b')](_0x441fc3))_0x5c293c=_0x5c293c+'§'+_0x441fc3;}if(_0x186461=='')_0x186461=_0x5c293c;else _0x186461+='|'+_0x5c293c;}_0x2a9751['push'](_0x5c50dd['id']+':'+_0x186461);_0x5092f1[_0x5c50dd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x2a9751['join'](';')+'\x22');}if(_0x4a6129[_0x6c30('0x1a')]){handleError(_0x29a52d['data'][_0x5d4d46],{'code':_0x6c30('0x80'),'message':_0x4a6129[_0x6c30('0x3e')]()});}else{fs[_0x6c30('0x81')](_0x4d381a,_0x462b6a[_0x6c30('0x3e')]()+'\x0a');}_0x462b6a=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x43beba,stats);stats[_0x6c30('0x5d')]=[];}}if(stopped){logger[_0x6c30('0x59')](_0x6c30('0x82'));_0x5b8129['abort']();}}catch(_0x1e2f34){handleError(_0x29a52d[_0x6c30('0x6b')][_0x5d4d46],{'code':_0x6c30('0x83'),'message':_0x1e2f34[_0x6c30('0x22')]});logger[_0x6c30('0x5b')](_0x6c30('0x84'),_0x1e2f34[_0x6c30('0x22')]);}},'complete':function(){try{var _0xbbc489=[];var _0x149115=tempTableName;_0xbbc489[_0x6c30('0x1e')]('CREATE\x20TABLE\x20'+_0x149115+_0x6c30('0x85'));logger[_0x6c30('0x59')](_0x6c30('0x86'),contactItemTypes['length']);var _0x3d6a45=util[_0x6c30('0xd')](_0x6c30('0x87'),_0x4d381a,_0x149115,_0x42726c,_0x57405e[_0x6c30('0x37')],_0x57405e[_0x6c30('0x56')]||null,NOW,NOW);if(_[_0x6c30('0x1b')](_0x3d1bbd[_0x6c30('0x88')])){_0x3d6a45+=',\x20scheduledAt\x20=\x20NOW()';}_0xbbc489[_0x6c30('0x1e')](_0x3d6a45);BPromise[_0x6c30('0x89')](_0xbbc489,handleQuery)[_0x6c30('0x20')](function(_0x80f1d8){BPromise[_0x6c30('0x1f')]([handleAdditionalPhones()])['then'](function(){_0xbbc489=[];for(var _0x12e5da=0x0;_0x12e5da\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','\x20=\x20','join','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','error','length','split','filter','CmContactHasItem','findOne','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','scheduledat','ContactId','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.id','ListId','createdAt','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','into','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','fromQuery',')\x20NOT\x20IN\x20?','id\x20IN\x20?','group','info','Received\x20SIGINT','message','exit','catch','main','stringify','start','binding','clone','root','server/files/tmp','body','ContactItemType','findAll','name','_description','header','parse','createReadStream','data','errors','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','contactId','orderBy'];(function(_0x749c41,_0x814a97){var _0x193046=function(_0x5ba05c){while(--_0x5ba05c){_0x749c41['push'](_0x749c41['shift']());}};_0x193046(++_0x814a97);}(_0x4910,0x1d9));var _0x0491=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4910[_0x502c7d];return _0x30b7ed;};'use strict';var fs=require('fs');var path=require(_0x0491('0x0'));var _=require(_0x0491('0x1'));var Papa=require(_0x0491('0x2'));var util=require('util');var BPromise=require(_0x0491('0x3'));var moment=require(_0x0491('0x4'));var squel=require(_0x0491('0x5'));var Redis=require(_0x0491('0x6'));var db=require(_0x0491('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0x0491('0x8'))(_0x0491('0x9'));config[_0x0491('0xa')]=_[_0x0491('0xb')](config[_0x0491('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0491('0xc'))(new Redis(config[_0x0491('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x0491('0xd')](_0x0491('0xe'));var tempTableName=_0x0491('0xf')+moment()['format'](_0x0491('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x51bd65){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0491('0x11')](_0x51bd65);}function selectNotIn(_0x1b57a1,_0x3ff9c6,_0x108308,_0x3b8318,_0x12ab48){return squel[_0x0491('0x12')]()[_0x0491('0x13')](_0x0491('0x14'))[_0x0491('0x15')](_0x3b8318)['join'](_0x3ff9c6,null,_0x3ff9c6+_0x0491('0x16')+_0x3b8318+'.'+_0x108308)['where'](_0x3b8318+'.'+_0x108308+_0x0491('0x17')+_0x1b57a1+'.'+_0x108308)['where'](_0x3ff9c6+'.dialCheckDuplicateType\x20IN\x20('+_0x12ab48[_0x0491('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x7ba36,_0x439f5c){promisesAdditionalPhones=[];promisesContact=[];return db[_0x0491('0x19')][_0x0491('0x1a')](_0x0491('0x1b')+tempTableName)[_0x0491('0x1c')](function(_0xbd94bd){if(_0xbd94bd!==null){var _0xf12423=[];for(var _0x1411a6=0x0;_0x1411a6<_0xbd94bd['length'];_0x1411a6++){var _0x410548=_0xbd94bd[_0x1411a6];if(!_[_0x0491('0x1d')](_0x410548[_0x0491('0x14')])){if(!_[_0x0491('0x1d')](_0x410548[_0x0491('0x1e')]))_0xf12423[_0x0491('0x1f')](insertAdditionalPhones(_0x410548));promisesContact['push']({'contact':_0x410548});}}}Promise[_0x0491('0x20')](_0xf12423)[_0x0491('0x21')](function(){_0x7ba36({'val':0x1});});})['catch'](function(_0x54be7f){logger[_0x0491('0x22')](_0x54be7f['message']);});});}function insertAdditionalPhones(_0x6f8139){return new Promise(function(_0x431782,_0x55dcb3){var _0x6141b9=_0x6f8139[_0x0491('0x1e')];if(_[_0x0491('0x1d')](_0x6141b9))_0x55dcb3({'val':0x0});else{var _0x291d40=_0x6141b9['split'](';');var _0x23146d=[];orderBy=0x0;for(var _0x358117=0x0;_0x358117<_0x291d40[_0x0491('0x23')];_0x358117++){_0x23146d['push'](splitAdditionalPhone(_0x6f8139['id'],_0x291d40[_0x358117]));}Promise[_0x0491('0x20')](_0x23146d)[_0x0491('0x21')](function(){_0x431782({'val':_0x291d40[_0x0491('0x23')]});});}});}function splitAdditionalPhone(_0x1934a0,_0x30ad41){return new Promise(function(_0xdda718,_0x207ff9){var _0x4ab232=_0x30ad41[_0x0491('0x24')](':');var _0x4a39f0=_0x4ab232[0x0];var _0xc0c021=_0x4ab232[0x1];if(_0xc0c021!==''){var _0x93bc14=_0xc0c021[_0x0491('0x24')]('|');var _0x54571a=[];for(var _0x12ebdb=0x0;_0x12ebdb<_0x93bc14[_0x0491('0x23')];_0x12ebdb++){if(_0x93bc14[_0x12ebdb]!==''){var _0x59beec=_[_0x0491('0x25')](promisesAdditionalPhones,{'contactId':_0x1934a0,'phone':_0x93bc14[_0x12ebdb]});if(_0x59beec[_0x0491('0x23')]==0x0){orderBy++;promisesAdditionalPhones[_0x0491('0x1f')]({'contactId':_0x1934a0,'contactTypeId':_0x4a39f0,'phone':_0x93bc14[_0x12ebdb],'orderBy':orderBy});}}}_0xdda718({'ok':0x1});}else _0xdda718({'res':0x0});});}function createAdditionalPhone(_0x2c3f39,_0x3ec059,_0x38b4b8,_0x15b80d){var _0x5c9ee2='';var _0x4fbeb8='';var _0x5daa56=_0x38b4b8['split']('§');_0x5c9ee2=_0x5daa56[0x0];if(_0x5daa56[_0x0491('0x23')]==0x2)_0x4fbeb8=_0x5daa56[0x1];return new Promise(function(_0x53f923,_0x46d432){return db[_0x0491('0x26')][_0x0491('0x27')]({'where':{'CmContactId':_0x2c3f39,'item':_0x5c9ee2}})[_0x0491('0x21')](function(_0x2e3223){if(_0x2e3223){return db[_0x0491('0x26')][_0x0491('0x28')]({'ItemTypeId':_0x3ec059,'description':_0x4fbeb8,'OrderBy':_0x15b80d},{'where':{'CmContactId':_0x2c3f39,'item':_0x5c9ee2}})['then'](function(_0x712f33){_0x53f923({'res':_0x0491('0x29')});});}else{return db[_0x0491('0x26')][_0x0491('0x2a')]({'CmContactId':_0x2c3f39,'item':_0x5c9ee2,'ItemTypeId':_0x3ec059,'description':_0x4fbeb8,'OrderBy':_0x15b80d,'ItemClass':'PHONE'})['then'](function(_0x58a20b){_0x53f923({'res':_0x0491('0x2b')});});}});});}function updateContact(_0x5ebccf){return new Promise(function(_0x2ad8b2,_0x434c1c){var _0x20d728=_0x5ebccf['id'];delete _0x5ebccf['id'];return db[_0x0491('0x2c')][_0x0491('0x28')](_0x5ebccf,{'where':{'id':_0x20d728}})[_0x0491('0x21')](function(_0x17b4ee){updatedRows+=0x1;return db[_0x0491('0x2d')]['update']({'phone':_0x5ebccf[_0x0491('0x14')]},{'where':{'ContactId':_0x20d728}})['then'](function(_0x1f24e9){_0x2ad8b2({'ret':'OK'});});});});}function insertCmHopper(_0x16ef85,_0x4bbffc,_0x20e036,_0x5a946c,_0x1d7460){var _0x2a6425=[_0x0491('0x2e'),_0x0491('0x2f'),'cm_contacts.id','cm_contacts.ListId',_0x4bbffc+'.'+_0x5a946c,_0x0491('0x30'),_0x0491('0x31'),_0x0491('0x32'),'cm_contacts.UserId','\x22'+_0x1d7460+'\x22'];return squel[_0x0491('0x33')]()['into'](_0x0491('0x34'))['fromQuery']([_0x0491('0x14'),_0x0491('0x35'),_0x0491('0x36'),'ListId',_0x5a946c,'createdAt',_0x0491('0x37'),_0x0491('0x38'),_0x0491('0x39'),'recallme'],squel['select']()[_0x0491('0x3a')](_0x2a6425)[_0x0491('0x15')](_0x4bbffc)[_0x0491('0x18')](_0x0491('0x3b'),null,_0x0491('0x3c')+_0x4bbffc+_0x0491('0x3d'))[_0x0491('0x18')](_0x20e036,null,_0x20e036+'.id\x20=\x20'+_0x4bbffc+'.'+_0x5a946c)[_0x0491('0x3e')](_0x4bbffc+_0x0491('0x3f'),_0x16ef85)['where'](_0x0491('0x40'),NOW)[_0x0491('0x3e')](_0x0491('0x41'),selectNotIn(_0x4bbffc,_0x20e036,_0x5a946c,_0x0491('0x34'),[_0x0491('0x42'),'\x22onlyIfOpen\x22']))[_0x0491('0x3e')](_0x0491('0x41'),selectNotIn(_0x4bbffc,_0x20e036,_0x5a946c,_0x0491('0x34'),[_0x0491('0x42')])))[_0x0491('0x43')]();}function insertCmHopperBlack(_0x6ef0a0,_0x49cf9,_0x1b6571,_0x20ead0){var _0x20adae=[_0x0491('0x2e'),_0x0491('0x44'),'cm_contacts.ListId',_0x49cf9+'.'+_0x20ead0,'cm_contacts.createdAt',_0x0491('0x31')];return squel['insert']()['into']('cm_hopper_black')['fromQuery']([_0x0491('0x14'),'ContactId',_0x0491('0x45'),_0x20ead0,_0x0491('0x46'),_0x0491('0x37')],squel['select']()[_0x0491('0x3a')](_0x20adae)['from'](_0x49cf9)[_0x0491('0x18')]('cm_contacts',null,_0x0491('0x3c')+_0x49cf9+_0x0491('0x3d'))[_0x0491('0x18')](_0x1b6571,null,_0x1b6571+_0x0491('0x16')+_0x49cf9+'.'+_0x20ead0)[_0x0491('0x3e')](_0x49cf9+_0x0491('0x3f'),_0x6ef0a0)[_0x0491('0x3e')](_0x0491('0x40'),NOW)[_0x0491('0x3e')](_0x0491('0x41'),squel[_0x0491('0x12')]()[_0x0491('0x13')](_0x0491('0x14'))['from'](_0x0491('0x47'))[_0x0491('0x3e')](_0x0491('0x48'),_0x6ef0a0)[_0x0491('0x3e')](_0x20ead0+_0x0491('0x49'),_0x49cf9+'.'+_0x20ead0)))[_0x0491('0x43')]();}function insertCmHopperAdditionalPhones(_0x48d193){var _0xdc7140=[_0x0491('0x4a'),_0x0491('0x4b'),_0x0491('0x4c'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x0491('0x33')]()[_0x0491('0x4d')](_0x0491('0x4e'))['fromQuery']([_0x0491('0x4f'),'phone',_0x0491('0x50'),'createdAt',_0x0491('0x37')],squel[_0x0491('0x12')]()[_0x0491('0x3a')](_0xdc7140)[_0x0491('0x15')](_0x0491('0x34'))['join'](_0x0491('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x0491('0x51'),null,_0x0491('0x52'))[_0x0491('0x3e')](_0x0491('0x53'),_0x48d193)[_0x0491('0x3e')](_0x0491('0x40'),NOW))[_0x0491('0x43')]();}function insertCmContact(_0x3add97,_0x47fe72,_0xec5404,_0x31791c){var _0x276c4e=_[_0x0491('0x54')](_[_0x0491('0x55')](_0x31791c),['ListId',_0x0491('0x56'),_0x0491('0x46'),_0x0491('0x37')]);return squel[_0x0491('0x33')]()[_0x0491('0x4d')](_0x0491('0x3b'))[_0x0491('0x57')](_0x276c4e,squel[_0x0491('0x12')]()['fields'](_0x276c4e)[_0x0491('0x15')](_0x47fe72)[_0x0491('0x3e')]('('+_0xec5404[_0x0491('0x18')](',')+_0x0491('0x58'),squel[_0x0491('0x12')]()[_0x0491('0x3a')](_0xec5404)[_0x0491('0x15')](_0x0491('0x3b'))[_0x0491('0x3e')]('ListId\x20=\x20?',_0x3add97))[_0x0491('0x3e')](_0x0491('0x59'),squel[_0x0491('0x12')]()[_0x0491('0x13')]('MIN(id)','min_id')['from'](_0x47fe72)[_0x0491('0x5a')](_0xec5404[_0x0491('0x18')](','))))['toString']();}function handleStop(){logger[_0x0491('0x5b')](_0x0491('0x5c'));stopped=!![];}function handleUncaughtException(_0x4bb695){logger[_0x0491('0x22')](_0x4bb695[_0x0491('0x5d')]);process[_0x0491('0x5e')](0x1);}function handleError(_0x12dc2c,_0x1af724){stats['errors'][_0x0491('0x1f')]({'name':_0x1af724['code'],'message':_0x1af724['message'],'row':_0x12dc2c});}function handleQuery(_0x2ca08b){logger[_0x0491('0x5b')](_0x2ca08b);return db[_0x0491('0x19')]['query'](_0x2ca08b)[_0x0491('0x1c')](function(_0x185a20){results['push'](_0x185a20);})[_0x0491('0x5f')](function(_0x4c97b){logger[_0x0491('0x22')](_0x4c97b[_0x0491('0x5d')]);});}function main(_0x27e04c,_0x4c12e0,_0x41da4a,_0x4a93a5){logger['info'](_0x0491('0x60'),_0x27e04c,JSON[_0x0491('0x61')](_0x4c12e0));process['send'](_0x0491('0x62'));var _0x19b2da=_0x4c12e0[_0x0491('0x63')];var _0x3f41b1=_[_0x0491('0x64')](_0x19b2da);var _0x430e37=_0x4c12e0['socket_timestamp'];var _0x2c41ec=path[_0x0491('0x18')](config[_0x0491('0x65')],_0x0491('0x66'),_0x430e37+'.csv');logger[_0x0491('0x5b')](_0x0491('0x67'),_0x4c12e0);db[_0x0491('0x68')][_0x0491('0x69')]({'raw':!![],'attributes':['id','name']})[_0x0491('0x21')](function(_0x442a97){for(var _0x2652d9=0x0;_0x2652d9<_0x442a97[_0x0491('0x23')];_0x2652d9++){if(_0x442a97[_0x2652d9][_0x0491('0x6a')]in _0x19b2da){contactItemTypes['push'](_0x442a97[_0x2652d9]);delete _0x3f41b1[_0x442a97[_0x2652d9]['name']];hasAdditionalPhones=!![];}for(var _0x526798 in _0x19b2da){if(_0x442a97[_0x2652d9][_0x0491('0x6a')]+_0x0491('0x6b')===_0x526798){phoneDescriptions[_0x0491('0x1f')]({'itemTypeId':_0x442a97[_0x2652d9]['id'],'description':_0x526798});delete _0x3f41b1[_0x526798];}}}if(hasAdditionalPhones)_0x3f41b1[_0x0491('0x1e')]='';var _0x4236e5=_[_0x0491('0x55')](_0x3f41b1)[_0x0491('0x18')]();logger['info'](_0x0491('0x6c'),_0x4236e5);fs['writeFileSync'](_0x2c41ec,_0x4236e5+'\x0a');Papa[_0x0491('0x6d')](fs[_0x0491('0x6e')](_0x27e04c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x6f2731,_0xe4af61){try{for(var _0x35d4c0=0x0,_0x537256=[];_0x35d4c0<_0x6f2731[_0x0491('0x6f')][_0x0491('0x23')];_0x35d4c0++){stats['rows']+=0x1;if(_0x6f2731['errors'][_0x35d4c0]){handleError(_0x6f2731[_0x0491('0x6f')][_0x35d4c0],_0x6f2731[_0x0491('0x70')][_0x35d4c0]);}else{var _0x544d84=[];var _0x1cf948=[];var _0x55b92f={};for(var _0x395c23 in _0x19b2da){let _0x275224=contactItemTypes[_0x0491('0x71')](_0xd5aed4=>_0xd5aed4[_0x0491('0x6a')]===_0x395c23);let _0x50067b=contactItemTypes[_0x0491('0x71')](_0xe7f058=>_0xe7f058[_0x0491('0x6a')]+_0x0491('0x6b')===_0x395c23);if(_[_0x0491('0x1d')](_0x275224)&&_[_0x0491('0x1d')](_0x50067b)){if(_0x19b2da[_0x0491('0x72')](_0x395c23)){if(_0x6f2731[_0x0491('0x6f')][_0x35d4c0][_0x19b2da[_0x395c23]]){var _0x5afb42=_[_0x0491('0x73')](_0x6f2731[_0x0491('0x6f')][_0x35d4c0][_0x19b2da[_0x395c23]][_0x0491('0x74')](/"/g,'\x27'));switch(_0x395c23){case'scheduledat':var _0x3e0903=moment(_0x5afb42,_0x0491('0xe'),!![]);if(_0x3e0903[_0x0491('0x75')]()){_0x537256[_0x0491('0x1f')]('\x22'+_0x5afb42+'\x22');}else{_0x544d84[_0x0491('0x1f')](_0x0491('0x76'));}break;case _0x0491('0x38'):var _0x2aa4b3=parseInt(_0x5afb42);_0x5afb42=_[_0x0491('0x77')](_0x2aa4b3)||_0x2aa4b3<0x0||_0x2aa4b3>0x4?_0x4a93a5?0x3:0x2:_0x2aa4b3;_0x537256['push']('\x22'+_0x5afb42+'\x22');break;case _0x0491('0x39'):var _0x24899e=parseInt(_0x5afb42);if(_[_0x0491('0x78')](_0x24899e)&&_[_0x0491('0x79')](_0x41da4a,_0x24899e)){_0x537256[_0x0491('0x1f')]('\x22'+_0x24899e+'\x22');}else{_0x544d84[_0x0491('0x1f')](_0x0491('0x7a'));}break;case'email':if(isEmail(_0x5afb42)){_0x537256[_0x0491('0x1f')]('\x22'+_0x5afb42+'\x22');}else{_0x544d84[_0x0491('0x1f')](_0x0491('0x7b'));}break;case _0x0491('0x7c'):var _0x56d062=moment(_0x5afb42,_0x0491('0x7d'),!![]);if(_0x56d062[_0x0491('0x75')]()){_0x537256[_0x0491('0x1f')]('\x22'+_0x5afb42+'\x22');}else{_0x544d84['push'](_0x0491('0x7e'));}break;default:_0x537256['push']('\x22'+_0x5afb42+'\x22');}}else{switch(_0x395c23){case _0x0491('0x7f'):case _0x0491('0x14'):_0x544d84[_0x0491('0x1f')](_0x395c23+_0x0491('0x80'));break;default:_0x537256[_0x0491('0x1f')]('\x22\x22');}}}}else{var _0x4f8c61='';if(!_['isNil'](_0x275224)){if(!_0x55b92f['hasOwnProperty'](_0x275224['id'])){for(var _0x499671=0x0;_0x499671<_0x19b2da[_0x395c23][_0x0491('0x23')];_0x499671++){var _0x5afb42=_[_0x0491('0x73')](_0x6f2731['data'][_0x35d4c0][_0x19b2da[_0x395c23][_0x499671]][_0x0491('0x74')](/"/g,'\x27'));var _0x562ae9=phoneDescriptions[_0x0491('0x71')](_0x52feb7=>_0x52feb7[_0x0491('0x81')]===_0x275224['id']);if(!_[_0x0491('0x1d')](_0x562ae9)){var _0x21d22b=_[_0x0491('0x73')](_0x6f2731['data'][_0x35d4c0][_0x19b2da[_0x562ae9[_0x0491('0x82')]][0x0]][_0x0491('0x74')](/"/g,'\x27'));if(!_[_0x0491('0x1d')](_0x21d22b))_0x5afb42=_0x5afb42+'§'+_0x21d22b;}if(_0x4f8c61=='')_0x4f8c61=_0x5afb42;else _0x4f8c61+='|'+_0x5afb42;}_0x1cf948['push'](_0x275224['id']+':'+_0x4f8c61);_0x55b92f[_0x275224['id']]=0x1;}}}}if(hasAdditionalPhones){_0x537256[_0x0491('0x1f')]('\x22'+_0x1cf948[_0x0491('0x18')](';')+'\x22');}if(_0x544d84[_0x0491('0x23')]){handleError(_0x6f2731[_0x0491('0x6f')][_0x35d4c0],{'code':_0x0491('0x83'),'message':_0x544d84['join']()});}else{fs[_0x0491('0x84')](_0x2c41ec,_0x537256['join']()+'\x0a');}_0x537256=[];}if(!(stats[_0x0491('0x85')]%0xc8)){socket[_0x0491('0x86')](_0x0491('0x87')+_0x430e37,stats);stats['errors']=[];}}if(stopped){logger[_0x0491('0x5b')](_0x0491('0x88'));_0xe4af61[_0x0491('0x89')]();}}catch(_0x45acfb){handleError(_0x6f2731[_0x0491('0x6f')][_0x35d4c0],{'code':_0x0491('0x8a'),'message':_0x45acfb[_0x0491('0x5d')]});logger[_0x0491('0x22')]('step',_0x45acfb[_0x0491('0x5d')]);}},'complete':function(){try{var _0x393832=[];var _0x53a88b=tempTableName;_0x393832[_0x0491('0x1f')]('CREATE\x20TABLE\x20'+_0x53a88b+'\x20LIKE\x20cm_contacts;');logger['info'](_0x0491('0x8b'),contactItemTypes[_0x0491('0x23')]);var _0x3b07c2=util[_0x0491('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x2c41ec,_0x53a88b,_0x4236e5,_0x4c12e0['ListId'],_0x4c12e0[_0x0491('0x56')]||null,NOW,NOW);if(_[_0x0491('0x1d')](_0x19b2da[_0x0491('0x35')])){_0x3b07c2+=_0x0491('0x8c');}_0x393832[_0x0491('0x1f')](_0x3b07c2);BPromise['each'](_0x393832,handleQuery)[_0x0491('0x21')](function(_0xf52e3b){BPromise[_0x0491('0x20')]([handleAdditionalPhones()])[_0x0491('0x21')](function(){_0x393832=[];for(var _0x52ea4d=0x0;_0x52ea4d\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','clone','COUNT(*)','getSelectedTags','lodash','squel','../parsers/qs','./update-interaction','./utils','getAccountFK','role','search','select','field','name','color','from','tools_tags','_interactions','u.id','ui.','users','length','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','interactions','cm_contacts','left_join','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric'];(function(_0x2ef6b5,_0x4ca68a){var _0x1314e8=function(_0xe013f7){while(--_0xe013f7){_0x2ef6b5['push'](_0x2ef6b5['shift']());}};_0x1314e8(++_0x4ca68a);}(_0x94ad,0x7a));var _0xd94a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x94ad[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd94a('0x0'));var squel=require(_0xd94a('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xd94a('0x2'));var updateInteraction=require(_0xd94a('0x3'))['updateInteraction'];var utils=require(_0xd94a('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x2dcee7,_0x2aac01,_0x5e4cf3){var _0x43fba1=![];var _0x54ca68=utils[_0xd94a('0x5')](_0x2dcee7);if(_0x2aac01[_0xd94a('0x6')]==='agent'&&!_0x5e4cf3[_0xd94a('0x7')]&&!_0x5e4cf3[_0x54ca68]){_0x43fba1=!![];}return _0x43fba1;}function getTagsQuery(){return squel[_0xd94a('0x8')]()[_0xd94a('0x9')]('id')[_0xd94a('0x9')](_0xd94a('0xa'))['field'](_0xd94a('0xb'))[_0xd94a('0xc')](_0xd94a('0xd'));}function getUsersQuery(_0x3c5bd0,_0x1bafc3){var _0x9cbafe=utils['getInteractionFK'](_0x3c5bd0);var _0x26cd63='user_has_'+_0x3c5bd0+_0xd94a('0xe');var _0x58a5c7=squel['select']()['field'](_0xd94a('0xf'))[_0xd94a('0x9')]('u.fullname')[_0xd94a('0x9')](_0xd94a('0x10')+_0x9cbafe)[_0xd94a('0xc')](_0x26cd63,'ui')['left_join'](_0xd94a('0x11'),'u','u.id\x20=\x20ui.UserId');if(_0x1bafc3[_0xd94a('0x12')]>0x0){_0x58a5c7[_0xd94a('0x13')](_0xd94a('0x10')+_0x9cbafe+_0xd94a('0x14'),_[_0xd94a('0x15')](_0x1bafc3,'id'));}return _0x58a5c7;}function getInteractionsQuery(_0xe0aaea){var _0x7cda42=utils[_0xd94a('0x16')](_0xe0aaea);var _0x5c03de=utils[_0xd94a('0x5')](_0xe0aaea);var _0x56af8b=utils[_0xd94a('0x17')](_0xe0aaea);return squel['select']()['from'](_0x7cda42[_0xd94a('0x18')],'i')['left_join'](_0xd94a('0x19'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xd94a('0x11'),'o','o.id\x20=\x20i.UserId')[_0xd94a('0x1a')](_0x7cda42['accounts'],'a','a.id\x20=\x20i.'+_0x5c03de)[_0xd94a('0x1a')](_0x7cda42[_0xd94a('0x1b')],'me','me.'+_0x56af8b+_0xd94a('0x1c'))['left_join'](_0x7cda42[_0xd94a('0x1d')],'it',_0xd94a('0x1e')+_0x56af8b+_0xd94a('0x1c'))[_0xd94a('0x1a')](_0xd94a('0xd'),'t',_0xd94a('0x1f'));}function getSqlClauses(){var _0xa4a68a={'body':squel[_0xd94a('0x20')](),'contact':squel[_0xd94a('0x20')](),'default':squel[_0xd94a('0x20')](),'fields':squel[_0xd94a('0x20')](),'filter':squel[_0xd94a('0x20')](),'read':squel[_0xd94a('0x20')](),'tags':{'clause':squel[_0xd94a('0x20')](),'ids':null},'user':squel[_0xd94a('0x20')]()};return _0xa4a68a;}function parseTagParameter(_0x5007c9){var _0x84245d=squel[_0xd94a('0x20')]();if(_0x5007c9){var _0x3bc2bf=utils['getSelectedTags'](_0x5007c9);_0x3bc2bf['forEach'](function(_0x4ee2f5){_0x84245d['or'](_0xd94a('0x21'),'%,'+_0x4ee2f5+',%');});}return _0x84245d;}function parseReadParameter(_0x4d80ef){var _0x193041='';if(_0x4d80ef){_0x193041='unreadMessages\x20{OPERATOR}\x200';if(_0x4d80ef==='1'){_0x193041=_0x193041[_0xd94a('0x22')](_0xd94a('0x23'),'=');}else{_0x193041=_0x193041[_0xd94a('0x22')](_0xd94a('0x23'),'>');}}return _0x193041;}function parseSearchFilter(_0x3aa675,_0x944b6f){var _0x429b25=squel['expr']();if(_0x944b6f){var _0x1649b6=_0x944b6f[_0xd94a('0x22')]('\x5c','\x5c\x5c')[_0xd94a('0x22')](/'/g,'\x27\x27');if(qs[_0xd94a('0x24')](_0x1649b6)){_0x429b25['or'](_0xd94a('0x25'),_0x1649b6+'%');if([_0xd94a('0x26'),_0xd94a('0x27')][_0xd94a('0x28')](_0x3aa675)){_0x429b25['or'](_0xd94a('0x29'),_0x1649b6+'%');}else if(_0x3aa675===_0xd94a('0x2a')){_0x429b25['or'](_0xd94a('0x2b'),_0x1649b6+'%');}else if(_0x3aa675===_0xd94a('0x2c')){_0x429b25['or'](_0xd94a('0x2d'),_0x1649b6+'%');}}else if(_0x3aa675==='mail'&&qs[_0xd94a('0x2e')](_0x1649b6)){_0x429b25['or'](_0xd94a('0x2f'),_0x1649b6+'%');}else{if(_0x3aa675==='mail'){_0x429b25['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1649b6,!![]))['or'](_0xd94a('0x30'),qs[_0xd94a('0x31')](_0x1649b6));}else if(_0x3aa675!=='fax'){_0x429b25['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd94a('0x31')](_0x1649b6));}_0x429b25['or'](_0xd94a('0x32'),qs[_0xd94a('0x31')](_0x1649b6,!![]),null);}}return _0x429b25;}function parseAdvancedSearchFilter(_0x5464b7,_0x88ccc7){var _0x1c3d66=getSqlClauses();var _0x20d776=as[_0xd94a('0x33')](_0x5464b7);var _0x35d003=_0x20d776[_0xd94a('0x34')];for(var _0x2d1e10=0x0;_0x2d1e10<_0x20d776[_0xd94a('0x35')]['length'];_0x2d1e10++){var _0x427270=_0x20d776[_0xd94a('0x35')][_0x2d1e10];var _0x55f87f='i';var _0x1da716=_[_0xd94a('0x36')](_0x88ccc7,[_0xd94a('0xa'),_0x427270[_0xd94a('0x9')]]);if(_0x1da716){var _0x5a45e8=as[_0xd94a('0x37')](_0x55f87f,_0x1da716[_0xd94a('0x38')],_0x427270);_0x1c3d66[_0xd94a('0x39')][_0x35d003](_0x5a45e8[_0xd94a('0x3a')],_0x5a45e8[_0xd94a('0x3b')]['start'],_0x5a45e8['value'][_0xd94a('0x3c')]);}else{switch(_0x427270[_0xd94a('0x9')]){case _0xd94a('0x3d'):var _0x293b79=parseReadParameter(_0x427270[_0xd94a('0x3b')]);_0x1c3d66[_0xd94a('0x3e')][_0xd94a('0x3f')](_0x293b79);break;case'Contact':if(_0x427270['operator']===_0xd94a('0x40')){if(_0x427270['value'][_0xd94a('0x41')]('\x20')['length']>0x1){_0x1c3d66[_0xd94a('0x42')][_0x35d003]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x427270[_0xd94a('0x3b')],!![]),null);}else{var _0x25bb5d='%'+_0x427270[_0xd94a('0x3b')]+'%';_0x1c3d66[_0xd94a('0x42')][_0x35d003](_0xd94a('0x43'),_0x25bb5d,_0x25bb5d,_0x25bb5d);}}else{_0x1da716=_[_0xd94a('0x36')](_0x88ccc7,[_0xd94a('0xa'),_0xd94a('0x44')]);_0x427270[_0xd94a('0x9')]='ContactId';_0x5a45e8=as[_0xd94a('0x37')](_0x55f87f,_0x1da716[_0xd94a('0x38')],_0x427270);_0x1c3d66['contact'][_0x35d003](_0x5a45e8[_0xd94a('0x3a')],_0x5a45e8['value'][_0xd94a('0x45')],_0x5a45e8['value'][_0xd94a('0x3c')]);}break;case _0xd94a('0x46'):var _0x1fcf14=_0x427270['value'][_0xd94a('0x41')](',')['map'](function(_0x147310){return Number(_0x147310);});var _0x474ce1=parseTagParameter(_0x1fcf14);_0x1c3d66[_0xd94a('0x47')]['clause']['and'](_0x474ce1);_0x1c3d66[_0xd94a('0x47')]['ids']=_0x1fcf14;break;case _0xd94a('0x48'):if(_0x427270[_0xd94a('0x49')]==='$substring'){_0x1c3d66[_0xd94a('0x4a')][_0x35d003]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x427270[_0xd94a('0x3b')]+'%',null);}else{_0x1da716=_[_0xd94a('0x36')](_0x88ccc7,[_0xd94a('0xa'),_0xd94a('0x4b')]);_0x427270[_0xd94a('0x9')]='UserId';_0x5a45e8=as[_0xd94a('0x37')](_0x55f87f,_0x1da716[_0xd94a('0x38')],_0x427270);_0x1c3d66[_0xd94a('0x4a')][_0x35d003](_0x5a45e8[_0xd94a('0x3a')],_0x5a45e8['value']['start'],_0x5a45e8['value'][_0xd94a('0x3c')]);}break;case _0xd94a('0x4c'):case _0xd94a('0x4d'):_0x5a45e8=as[_0xd94a('0x37')]('me',null,_0x427270);_0x1c3d66[_0xd94a('0x4c')][_0x35d003](_0x5a45e8[_0xd94a('0x3a')],_0x5a45e8['value'][_0xd94a('0x45')],_0x5a45e8[_0xd94a('0x3b')][_0xd94a('0x3c')]);break;}}}return _0x1c3d66;}function parseModelFields(_0x22b5af,_0x3f22a5,_0x337f90){var _0x57a18b=utils[_0xd94a('0x5')](_0x22b5af);var _0x4736e6=squel[_0xd94a('0x20')]();var _0x27dae2=_(_0x3f22a5)[_0xd94a('0x4e')]()[_0xd94a('0x15')](function(_0x207222){return _[_0xd94a('0x4f')](_0x337f90,[_0xd94a('0xa'),_0x207222])?_0x207222:undefined;})[_0xd94a('0x50')]()[_0xd94a('0x3b')]();if(_0x27dae2[_0xd94a('0x12')]>0x0){_0x27dae2[_0xd94a('0x51')](function(_0x3de335){if(_0x3de335===_0x57a18b){_0x4736e6['and']('i.'+_0x57a18b+_0xd94a('0x14'),[][_0xd94a('0x52')](_0x3f22a5[_0x3de335]));}else if(_0x3de335===_0xd94a('0x53')){var _0xe27ad5=JSON[_0xd94a('0x54')](_0x3f22a5[_0x3de335])['$gte'];var _0x44aa67=JSON[_0xd94a('0x54')](_0x3f22a5[_0x3de335])[_0xd94a('0x55')];_0x4736e6[_0xd94a('0x3f')](_0xd94a('0x56'),_0xe27ad5,_0x44aa67);}else{if(_0x3f22a5[_0x3de335]===_0xd94a('0x57')){_0x4736e6['and']('i.'+_0x3de335+_0xd94a('0x58'));}else{_0x4736e6[_0xd94a('0x3f')]('i.'+_0x3de335+_0xd94a('0x59'),_0x3f22a5[_0x3de335]);}}});}return _0x4736e6;}function parseQueryParameters(_0x310df7,_0x2b539c,_0x5d489b){var _0x505be4=getSqlClauses();return Promise[_0xd94a('0x5a')]()['then'](function(){return parseModelFields(_0x310df7,_0x2b539c,_0x5d489b);})[_0xd94a('0x5b')](function(_0x38235b){_0x505be4[_0xd94a('0x5c')][_0xd94a('0x3f')](_0x38235b);return parseReadParameter(_0x2b539c['read']);})[_0xd94a('0x5b')](function(_0x336f08){_0x505be4[_0xd94a('0x3e')][_0xd94a('0x3f')](_0x336f08);return parseTagParameter(_0x2b539c[_0xd94a('0x5d')]);})[_0xd94a('0x5b')](function(_0xe13aec){_0x505be4[_0xd94a('0x47')]['clause']['and'](_0xe13aec);return parseSearchFilter(_0x310df7,_0x2b539c[_0xd94a('0x5e')]);})['then'](function(_0x3866e4){_0x505be4[_0xd94a('0x5e')]=_0x3866e4;return _0x505be4;});}function checkAccountsRestrictions(_0x4c3c61,_0xa6dbea,_0x11531f){var _0x46759d=utils[_0xd94a('0x5')](_0x4c3c61);var _0x43f091='get'+_[_0xd94a('0x5f')](_0x4c3c61)+(_0x4c3c61==='chat'?_0xd94a('0x60'):_0xd94a('0x61'));var _0x4fb3ce=squel[_0xd94a('0x20')]();return Promise[_0xd94a('0x5a')]()[_0xd94a('0x5b')](function(){if(_0x11531f[_0xd94a('0x7')]&&_0xa6dbea[_0xd94a('0x6')]===_0xd94a('0x62')){return _0xa6dbea[_0x43f091]({'attributes':['id'],'raw':!![]});}})[_0xd94a('0x5b')](function(_0x595662){if(_0x595662){if(_0x595662[_0xd94a('0x12')]===0x0){_0x4fb3ce[_0xd94a('0x3f')]('i.'+_0x46759d+_0xd94a('0x58'));}else{_0x4fb3ce[_0xd94a('0x3f')]('i.'+_0x46759d+_0xd94a('0x14'),_[_0xd94a('0x15')](_0x595662,'id'));}}else if(!_0x11531f[_0x46759d]){_0x4fb3ce[_0xd94a('0x3f')]('i.'+_0x46759d+_0xd94a('0x63'));}})[_0xd94a('0x5b')](function(){return _0x4fb3ce;});}function getClosedOrderClause(_0x55a712,_0x4f9969){var _0x2af023='';var _0x2722aa=['i.thirdDisposition',_0xd94a('0x64'),_0xd94a('0x65')];if(_0x55a712===_0xd94a('0x66')){_0x2722aa[_0xd94a('0x67')](_0xd94a('0x68'));}if(_0x4f9969[_0xd94a('0x69')]==='0'&&_0x55a712==='mail'){_0x2af023=_0xd94a('0x68');}else{if(_0x4f9969[_0xd94a('0x69')]==='1'){_0x2722aa[_0xd94a('0x6a')]();}_0x2af023=_0xd94a('0x6b')+_0x2722aa[_0xd94a('0x6c')](',\x20')+')';}return _0x2af023;}function getFilteredInteractions(_0x1b0335,_0x6131c,_0x2158ec,_0x46b4e0){var _0x559ff9=utils['getInteractionFK'](_0x1b0335);var _0x2ed3c8=_['capitalize'](_0x1b0335)+_0xd94a('0x6d');var _0x504ec5=[];var _0x349b4c=getTagsQuery();var _0x447f1a={'type':db[_0xd94a('0x6e')][_0xd94a('0x6f')][_0xd94a('0x70')],'raw':!![]};var _0x225c4e=[];var _0x1ad3dc=[];return db[_0xd94a('0x71')][_0xd94a('0x72')](_0x349b4c[_0xd94a('0x73')](),_0x447f1a)[_0xd94a('0x5b')](function(_0x5e7051){_0x504ec5=_['keyBy'](_0x5e7051,'id');_0x447f1a=_[_0xd94a('0x74')](_0x447f1a,{'model':db[_0x2ed3c8],'mapToModel':!![],'nest':!![]});if(_0x2158ec[_0xd94a('0x5c')]){_0x46b4e0['attributes'][_0xd94a('0x51')](function(_0x2ed706){_0x6131c[_0xd94a('0x9')]('i.'+_0x2ed706);});}else{_0x6131c[_0xd94a('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x6131c['field'](_0xd94a('0x75'),_0xd94a('0x76'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x77'),_0xd94a('0x78'));if(_0x1b0335===_0xd94a('0x66')){_0x6131c[_0xd94a('0x9')](_0xd94a('0x79'),_0xd94a('0x7a'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x7b'),_0xd94a('0x7c'));_0x6131c[_0xd94a('0x9')]('i.id');_0x6131c[_0xd94a('0x9')]('i.createdAt');_0x6131c['field']('i.updatedAt');_0x6131c[_0xd94a('0x9')](_0xd94a('0x7d'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x7e'));_0x6131c['field'](_0xd94a('0x7f'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x80'));_0x6131c['field'](_0xd94a('0x81'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x82'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x65'));_0x6131c['field']('i.secondDisposition');_0x6131c[_0xd94a('0x9')](_0xd94a('0x83'));_0x6131c[_0xd94a('0x9')]('i.substatus');_0x6131c[_0xd94a('0x9')](_0xd94a('0x84'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x85'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x86'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x87'));}else if(_0x1b0335==='openchannel'){_0x6131c[_0xd94a('0x9')](_0xd94a('0x88'),_0xd94a('0x7c'));}else{_0x6131c[_0xd94a('0x9')](_0xd94a('0x89'),_0xd94a('0x7c'));}if(_0x1b0335!==_0xd94a('0x66')){_0x6131c[_0xd94a('0x9')](_0xd94a('0x8a'));}_0x6131c[_0xd94a('0x9')](_0xd94a('0x8b'),_0xd94a('0x8c'));_0x6131c[_0xd94a('0x9')]('c.lastName',_0xd94a('0x8d'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x8e'),_0xd94a('0x8f'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x90'),'Contact.phone');_0x6131c[_0xd94a('0x9')](_0xd94a('0x91'),_0xd94a('0x92'));_0x6131c['field']('c.fax','Contact.fax');_0x6131c['field']('o.fullname',_0xd94a('0x93'));_0x6131c[_0xd94a('0x9')]('o.internal',_0xd94a('0x94'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x95'),_0xd94a('0x96'));}if(_0x46b4e0[_0xd94a('0x97')]){_0x6131c[_0xd94a('0x97')](_0x46b4e0[_0xd94a('0x97')]);}if(_0x46b4e0[_0xd94a('0x98')]){_0x6131c['offset'](_0x46b4e0[_0xd94a('0x98')]);}return db[_0xd94a('0x71')][_0xd94a('0x72')](_0x6131c[_0xd94a('0x73')](),_0x447f1a);})[_0xd94a('0x5b')](function(_0x3ea8df){_0x225c4e=_0x3ea8df;var _0xa8a7f6=getUsersQuery(_0x1b0335,_0x225c4e);return db[_0xd94a('0x71')][_0xd94a('0x72')](_0xa8a7f6['toString'](),_0x447f1a);})[_0xd94a('0x5b')](function(_0x20210b){_0x1ad3dc=_[_0xd94a('0x99')](_0x20210b,_0x559ff9);if(_0x1b0335==='mail'){return db[_0xd94a('0x9a')]['findOne']({'attributes':[_0xd94a('0x9b')],'raw':!![]});}})[_0xd94a('0x5b')](function(_0x5cb233){var _0x28833a=_0x5cb233?_0x5cb233[_0xd94a('0x9b')]:undefined;var _0x9316f9=_0x225c4e['map'](function(_0x2edf40){return updateInteraction(_0x2edf40,_0x504ec5,_0x1ad3dc,_0x28833a);});return Promise['all'](_0x9316f9);});}function countFilteredInteractions(_0x39b944,_0x48d51b){var _0x1aa418=_0x39b944[_0xd94a('0x9c')]();_0x1aa418[_0xd94a('0x9')](_0xd94a('0x9d'));_0x1aa418['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd94a('0x3d'));var _0x272d11=utils[_0xd94a('0x9e')](_0x48d51b);if(!_['isEmpty'](_0x272d11)){_0x1aa418[_0xd94a('0x13')]('t.id\x20IN\x20?',_0x272d11);}var _0x212cce={'type':db[_0xd94a('0x6e')][_0xd94a('0x6f')]['SELECT'],'raw':!![]};return db[_0xd94a('0x71')][_0xd94a('0x72')](_0x1aa418[_0xd94a('0x73')](),_0x212cce);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xf8db=['i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','isEmpty','SELECT','exports','lodash','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','tools_tags','user_has_','u.id','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','buildExpression','type','text','start','value','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','tags','clause','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','resolve','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','mail','unshift','i.substatus','closed','shift','join','Sequelize','QueryTypes','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.to'];(function(_0xc8e38b,_0x3cb166){var _0xe41856=function(_0x2a4a3c){while(--_0x2a4a3c){_0xc8e38b['push'](_0xc8e38b['shift']());}};_0xe41856(++_0x3cb166);}(_0xf8db,0xc7));var _0xbf8d=function(_0x1ff804,_0x263135){_0x1ff804=_0x1ff804-0x0;var _0x3454b8=_0xf8db[_0x1ff804];return _0x3454b8;};'use strict';var _=require(_0xbf8d('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0xbf8d('0x1'));var updateInteraction=require(_0xbf8d('0x2'))['updateInteraction'];var utils=require(_0xbf8d('0x3'));var db=require(_0xbf8d('0x4'))['db'];function skipInteractionsQuery(_0x1fa57a,_0x2a2802,_0x4aedf0){var _0x369892=![];var _0x37cec4=utils[_0xbf8d('0x5')](_0x1fa57a);if(_0x2a2802[_0xbf8d('0x6')]===_0xbf8d('0x7')&&!_0x4aedf0[_0xbf8d('0x8')]&&!_0x4aedf0[_0x37cec4]){_0x369892=!![];}return _0x369892;}function getTagsQuery(){return squel[_0xbf8d('0x9')]()[_0xbf8d('0xa')]('id')[_0xbf8d('0xa')](_0xbf8d('0xb'))[_0xbf8d('0xa')](_0xbf8d('0xc'))['from'](_0xbf8d('0xd'));}function getUsersQuery(_0x1424af,_0x15e70b){var _0x48c01c=utils['getInteractionFK'](_0x1424af);var _0x2cece1=_0xbf8d('0xe')+_0x1424af+'_interactions';var _0x1785e0=squel[_0xbf8d('0x9')]()[_0xbf8d('0xa')](_0xbf8d('0xf'))[_0xbf8d('0xa')]('u.fullname')['field'](_0xbf8d('0x10')+_0x48c01c)[_0xbf8d('0x11')](_0x2cece1,'ui')[_0xbf8d('0x12')](_0xbf8d('0x13'),'u',_0xbf8d('0x14'));if(_0x15e70b[_0xbf8d('0x15')]>0x0){_0x1785e0['where']('ui.'+_0x48c01c+_0xbf8d('0x16'),_[_0xbf8d('0x17')](_0x15e70b,'id'));}return _0x1785e0;}function getInteractionsQuery(_0x1d06ec){var _0x981bd7=utils[_0xbf8d('0x18')](_0x1d06ec);var _0x2bf252=utils[_0xbf8d('0x5')](_0x1d06ec);var _0xd8f2ad=utils[_0xbf8d('0x19')](_0x1d06ec);return squel[_0xbf8d('0x9')]()['from'](_0x981bd7[_0xbf8d('0x1a')],'i')[_0xbf8d('0x12')](_0xbf8d('0x1b'),'c',_0xbf8d('0x1c'))[_0xbf8d('0x12')](_0xbf8d('0x13'),'o',_0xbf8d('0x1d'))[_0xbf8d('0x12')](_0x981bd7[_0xbf8d('0x1e')],'a',_0xbf8d('0x1f')+_0x2bf252)[_0xbf8d('0x12')](_0x981bd7[_0xbf8d('0x20')],'me',_0xbf8d('0x21')+_0xd8f2ad+_0xbf8d('0x22'))[_0xbf8d('0x12')](_0x981bd7['interactionsTags'],'it',_0xbf8d('0x23')+_0xd8f2ad+'\x20=\x20i.id')[_0xbf8d('0x12')](_0xbf8d('0xd'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x38d870={'body':squel[_0xbf8d('0x24')](),'contact':squel['expr'](),'default':squel[_0xbf8d('0x24')](),'fields':squel[_0xbf8d('0x24')](),'filter':squel['expr'](),'read':squel[_0xbf8d('0x24')](),'tags':{'clause':squel[_0xbf8d('0x24')](),'ids':null},'user':squel[_0xbf8d('0x24')]()};return _0x38d870;}function parseTagParameter(_0x2d8cc0){var _0x1fd736=squel['expr']();if(_0x2d8cc0){var _0x1dec4b=utils[_0xbf8d('0x25')](_0x2d8cc0);_0x1dec4b[_0xbf8d('0x26')](function(_0x5babfc){_0x1fd736['or'](_0xbf8d('0x27'),'%,'+_0x5babfc+',%');});}return _0x1fd736;}function parseReadParameter(_0x162c7c){var _0x5d5857='';if(_0x162c7c){_0x5d5857='unreadMessages\x20{OPERATOR}\x200';if(_0x162c7c==='1'){_0x5d5857=_0x5d5857[_0xbf8d('0x28')](_0xbf8d('0x29'),'=');}else{_0x5d5857=_0x5d5857[_0xbf8d('0x28')](_0xbf8d('0x29'),'>');}}return _0x5d5857;}function parseSearchFilter(_0x4e78bb,_0x4a2770){var _0x32435=squel[_0xbf8d('0x24')]();if(_0x4a2770){var _0x1bd792=_0x4a2770[_0xbf8d('0x28')]('\x5c','\x5c\x5c')[_0xbf8d('0x28')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1bd792)){_0x32435['or'](_0xbf8d('0x2a'),_0x1bd792+'%');if([_0xbf8d('0x2b'),_0xbf8d('0x2c')]['includes'](_0x4e78bb)){_0x32435['or']('i.phone\x20LIKE\x20?',_0x1bd792+'%');}else if(_0x4e78bb===_0xbf8d('0x2d')){_0x32435['or'](_0xbf8d('0x2e'),_0x1bd792+'%');}else if(_0x4e78bb===_0xbf8d('0x2f')){_0x32435['or'](_0xbf8d('0x30'),_0x1bd792+'%');}}else if(_0x4e78bb==='mail'&&qs[_0xbf8d('0x31')](_0x1bd792)){_0x32435['or'](_0xbf8d('0x32'),_0x1bd792+'%');}else{if(_0x4e78bb==='mail'){_0x32435['or'](_0xbf8d('0x33'),qs[_0xbf8d('0x34')](_0x1bd792,!![]))['or'](_0xbf8d('0x35'),qs['getFullTextValue'](_0x1bd792));}else if(_0x4e78bb!=='fax'){_0x32435['or'](_0xbf8d('0x36'),qs[_0xbf8d('0x34')](_0x1bd792));}_0x32435['or'](_0xbf8d('0x37'),qs[_0xbf8d('0x34')](_0x1bd792,!![]),null);}}return _0x32435;}function parseAdvancedSearchFilter(_0x507a0b,_0x30c3d3){var _0x52a270=getSqlClauses();var _0x9adfbe=as['parseSearch'](_0x507a0b);var _0xa39f47=_0x9adfbe[_0xbf8d('0x38')];for(var _0x44c180=0x0;_0x44c180<_0x9adfbe['conditions']['length'];_0x44c180++){var _0xb447e4=_0x9adfbe[_0xbf8d('0x39')][_0x44c180];var _0x3faae1='i';var _0x24b135=_[_0xbf8d('0x3a')](_0x30c3d3,[_0xbf8d('0xb'),_0xb447e4[_0xbf8d('0xa')]]);if(_0x24b135){var _0x3b4d9c=as[_0xbf8d('0x3b')](_0x3faae1,_0x24b135[_0xbf8d('0x3c')],_0xb447e4);_0x52a270['default'][_0xa39f47](_0x3b4d9c[_0xbf8d('0x3d')],_0x3b4d9c['value'][_0xbf8d('0x3e')],_0x3b4d9c[_0xbf8d('0x3f')][_0xbf8d('0x40')]);}else{switch(_0xb447e4['field']){case _0xbf8d('0x41'):var _0x4e383f=parseReadParameter(_0xb447e4[_0xbf8d('0x3f')]);_0x52a270[_0xbf8d('0x42')][_0xbf8d('0x43')](_0x4e383f);break;case _0xbf8d('0x44'):if(_0xb447e4[_0xbf8d('0x45')]===_0xbf8d('0x46')){if(_0xb447e4[_0xbf8d('0x3f')][_0xbf8d('0x47')]('\x20')[_0xbf8d('0x15')]>0x1){_0x52a270[_0xbf8d('0x48')][_0xa39f47](_0xbf8d('0x37'),qs['getFullTextValue'](_0xb447e4[_0xbf8d('0x3f')],!![]),null);}else{var _0x20049e='%'+_0xb447e4[_0xbf8d('0x3f')]+'%';_0x52a270[_0xbf8d('0x48')][_0xa39f47](_0xbf8d('0x49'),_0x20049e,_0x20049e,_0x20049e);}}else{_0x24b135=_[_0xbf8d('0x3a')](_0x30c3d3,[_0xbf8d('0xb'),_0xbf8d('0x4a')]);_0xb447e4['field']=_0xbf8d('0x4a');_0x3b4d9c=as[_0xbf8d('0x3b')](_0x3faae1,_0x24b135[_0xbf8d('0x3c')],_0xb447e4);_0x52a270[_0xbf8d('0x48')][_0xa39f47](_0x3b4d9c['text'],_0x3b4d9c[_0xbf8d('0x3f')][_0xbf8d('0x3e')],_0x3b4d9c[_0xbf8d('0x3f')]['end']);}break;case _0xbf8d('0x4b'):var _0x1ccab3=_0xb447e4['value'][_0xbf8d('0x47')](',')[_0xbf8d('0x17')](function(_0x1601a6){return Number(_0x1601a6);});var _0x1cb5c8=parseTagParameter(_0x1ccab3);_0x52a270[_0xbf8d('0x4c')][_0xbf8d('0x4d')][_0xbf8d('0x43')](_0x1cb5c8);_0x52a270[_0xbf8d('0x4c')]['ids']=_0x1ccab3;break;case'User':if(_0xb447e4[_0xbf8d('0x45')]===_0xbf8d('0x46')){_0x52a270[_0xbf8d('0x4e')][_0xa39f47](_0xbf8d('0x4f'),'%'+_0xb447e4[_0xbf8d('0x3f')]+'%',null);}else{_0x24b135=_['find'](_0x30c3d3,[_0xbf8d('0xb'),_0xbf8d('0x50')]);_0xb447e4[_0xbf8d('0xa')]=_0xbf8d('0x50');_0x3b4d9c=as[_0xbf8d('0x3b')](_0x3faae1,_0x24b135[_0xbf8d('0x3c')],_0xb447e4);_0x52a270[_0xbf8d('0x4e')][_0xa39f47](_0x3b4d9c[_0xbf8d('0x3d')],_0x3b4d9c[_0xbf8d('0x3f')][_0xbf8d('0x3e')],_0x3b4d9c['value']['end']);}break;case _0xbf8d('0x51'):case _0xbf8d('0x52'):_0x3b4d9c=as[_0xbf8d('0x3b')]('me',null,_0xb447e4);_0x52a270['body'][_0xa39f47](_0x3b4d9c[_0xbf8d('0x3d')],_0x3b4d9c[_0xbf8d('0x3f')][_0xbf8d('0x3e')],_0x3b4d9c[_0xbf8d('0x3f')][_0xbf8d('0x40')]);break;}}}return _0x52a270;}function parseModelFields(_0x1f0aee,_0x561174,_0x3b37fb){var _0x493869=utils['getAccountFK'](_0x1f0aee);var _0x2fbd84=squel['expr']();var _0xae2535=_(_0x561174)[_0xbf8d('0x53')]()[_0xbf8d('0x17')](function(_0x1cd7dd){return _[_0xbf8d('0x54')](_0x3b37fb,[_0xbf8d('0xb'),_0x1cd7dd])?_0x1cd7dd:undefined;})[_0xbf8d('0x55')]()[_0xbf8d('0x3f')]();if(_0xae2535['length']>0x0){_0xae2535[_0xbf8d('0x26')](function(_0x41cb54){if(_0x41cb54===_0x493869){_0x2fbd84['and']('i.'+_0x493869+'\x20IN\x20?',[][_0xbf8d('0x56')](_0x561174[_0x41cb54]));}else if(_0x41cb54==='createdAt'){var _0x4c2da4=JSON[_0xbf8d('0x57')](_0x561174[_0x41cb54])[_0xbf8d('0x58')];var _0x4c44c6=JSON[_0xbf8d('0x57')](_0x561174[_0x41cb54])[_0xbf8d('0x59')];_0x2fbd84[_0xbf8d('0x43')](_0xbf8d('0x5a'),_0x4c2da4,_0x4c44c6);}else{if(_0x561174[_0x41cb54]===_0xbf8d('0x5b')){_0x2fbd84[_0xbf8d('0x43')]('i.'+_0x41cb54+_0xbf8d('0x5c'));}else{_0x2fbd84[_0xbf8d('0x43')]('i.'+_0x41cb54+_0xbf8d('0x5d'),_0x561174[_0x41cb54]);}}});}return _0x2fbd84;}function parseQueryParameters(_0x3af46f,_0x5706ab,_0x3b7383){var _0x2cb552=getSqlClauses();return Promise['resolve']()[_0xbf8d('0x5e')](function(){return parseModelFields(_0x3af46f,_0x5706ab,_0x3b7383);})['then'](function(_0x5c0a21){_0x2cb552[_0xbf8d('0x5f')][_0xbf8d('0x43')](_0x5c0a21);return parseReadParameter(_0x5706ab['read']);})['then'](function(_0x456fb3){_0x2cb552[_0xbf8d('0x42')][_0xbf8d('0x43')](_0x456fb3);return parseTagParameter(_0x5706ab[_0xbf8d('0x60')]);})[_0xbf8d('0x5e')](function(_0x2b4788){_0x2cb552[_0xbf8d('0x4c')][_0xbf8d('0x4d')][_0xbf8d('0x43')](_0x2b4788);return parseSearchFilter(_0x3af46f,_0x5706ab[_0xbf8d('0x61')]);})[_0xbf8d('0x5e')](function(_0x3d0735){_0x2cb552['filter']=_0x3d0735;return _0x2cb552;});}function checkAccountsRestrictions(_0x2ae8d7,_0x23066c,_0x162d3c){var _0x3e0d38=utils[_0xbf8d('0x5')](_0x2ae8d7);var _0x4ac597=_0xbf8d('0x62')+_[_0xbf8d('0x63')](_0x2ae8d7)+(_0x2ae8d7===_0xbf8d('0x64')?_0xbf8d('0x65'):_0xbf8d('0x66'));var _0x170dbb=squel[_0xbf8d('0x24')]();return Promise[_0xbf8d('0x67')]()[_0xbf8d('0x5e')](function(){if(_0x162d3c['search']&&_0x23066c['role']===_0xbf8d('0x7')){return _0x23066c[_0x4ac597]({'attributes':['id'],'raw':!![]});}})[_0xbf8d('0x5e')](function(_0x4fd321){if(_0x4fd321){if(_0x4fd321[_0xbf8d('0x15')]===0x0){_0x170dbb[_0xbf8d('0x43')]('i.'+_0x3e0d38+_0xbf8d('0x5c'));}else{_0x170dbb[_0xbf8d('0x43')]('i.'+_0x3e0d38+_0xbf8d('0x16'),_[_0xbf8d('0x17')](_0x4fd321,'id'));}}else if(!_0x162d3c[_0x3e0d38]){_0x170dbb[_0xbf8d('0x43')]('i.'+_0x3e0d38+_0xbf8d('0x68'));}})[_0xbf8d('0x5e')](function(){return _0x170dbb;});}function getClosedOrderClause(_0x4209a0,_0x11c0f3){var _0x4cb2dd='';var _0x40fa3a=[_0xbf8d('0x69'),'i.secondDisposition',_0xbf8d('0x6a')];if(_0x4209a0===_0xbf8d('0x6b')){_0x40fa3a[_0xbf8d('0x6c')](_0xbf8d('0x6d'));}if(_0x11c0f3['closed']==='0'&&_0x4209a0==='mail'){_0x4cb2dd=_0xbf8d('0x6d');}else{if(_0x11c0f3[_0xbf8d('0x6e')]==='1'){_0x40fa3a[_0xbf8d('0x6f')]();}_0x4cb2dd='CONCAT_WS(\x27\x27,\x20'+_0x40fa3a[_0xbf8d('0x70')](',\x20')+')';}return _0x4cb2dd;}function getFilteredInteractions(_0x445183,_0x3fbcbf,_0x26703f,_0x17bc7f){var _0x5979d0=utils['getInteractionFK'](_0x445183);var _0x209fac=_[_0xbf8d('0x63')](_0x445183)+'Interaction';var _0x43fd7b=[];var _0x4a9938=getTagsQuery();var _0x56f3ea={'type':db[_0xbf8d('0x71')][_0xbf8d('0x72')]['SELECT'],'raw':!![]};var _0x5b8c4e=[];var _0x5205bb=[];return db[_0xbf8d('0x73')][_0xbf8d('0x74')](_0x4a9938[_0xbf8d('0x75')](),_0x56f3ea)[_0xbf8d('0x5e')](function(_0x61f26e){_0x43fd7b=_[_0xbf8d('0x76')](_0x61f26e,'id');_0x56f3ea=_[_0xbf8d('0x77')](_0x56f3ea,{'model':db[_0x209fac],'mapToModel':!![],'nest':!![]});if(_0x26703f[_0xbf8d('0x5f')]){_0x17bc7f[_0xbf8d('0x78')][_0xbf8d('0x26')](function(_0x2f1846){_0x3fbcbf['field']('i.'+_0x2f1846);});}else{_0x3fbcbf['field'](_0xbf8d('0x79'),_0xbf8d('0x41'));_0x3fbcbf['field']('a.key','Account.key');_0x3fbcbf[_0xbf8d('0xa')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x445183===_0xbf8d('0x6b')){_0x3fbcbf[_0xbf8d('0xa')]('a.email',_0xbf8d('0x7a'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x7b'),_0xbf8d('0x7c'));_0x3fbcbf[_0xbf8d('0xa')]('i.id');_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x7d'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x7e'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x7f'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x80'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x81'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x82'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x83'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x84'));_0x3fbcbf[_0xbf8d('0xa')]('i.disposition');_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x85'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x69'));_0x3fbcbf[_0xbf8d('0xa')]('i.substatus');_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x86'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x87'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x88'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x89'));}else if(_0x445183===_0xbf8d('0x2f')){_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x8a'),_0xbf8d('0x7c'));}else{_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x8b'),_0xbf8d('0x7c'));}if(_0x445183!==_0xbf8d('0x6b')){_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x8c'));}_0x3fbcbf['field']('c.firstName',_0xbf8d('0x8d'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x8e'),_0xbf8d('0x8f'));_0x3fbcbf['field'](_0xbf8d('0x90'),_0xbf8d('0x91'));_0x3fbcbf['field'](_0xbf8d('0x92'),_0xbf8d('0x93'));_0x3fbcbf['field'](_0xbf8d('0x94'),'Contact.mobile');_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x95'),'Contact.fax');_0x3fbcbf['field'](_0xbf8d('0x96'),_0xbf8d('0x97'));_0x3fbcbf[_0xbf8d('0xa')](_0xbf8d('0x98'),_0xbf8d('0x99'));_0x3fbcbf['field'](_0xbf8d('0x9a'),_0xbf8d('0x9b'));}if(_0x17bc7f[_0xbf8d('0x9c')]){_0x3fbcbf[_0xbf8d('0x9c')](_0x17bc7f[_0xbf8d('0x9c')]);}if(_0x17bc7f[_0xbf8d('0x9d')]){_0x3fbcbf[_0xbf8d('0x9d')](_0x17bc7f[_0xbf8d('0x9d')]);}return db[_0xbf8d('0x73')][_0xbf8d('0x74')](_0x3fbcbf[_0xbf8d('0x75')](),_0x56f3ea);})['then'](function(_0x3d84c9){_0x5b8c4e=_0x3d84c9;var _0x3a8655=getUsersQuery(_0x445183,_0x5b8c4e);return db[_0xbf8d('0x73')]['query'](_0x3a8655['toString'](),_0x56f3ea);})[_0xbf8d('0x5e')](function(_0x46d04f){_0x5205bb=_[_0xbf8d('0x9e')](_0x46d04f,_0x5979d0);if(_0x445183===_0xbf8d('0x6b')){return db[_0xbf8d('0x9f')][_0xbf8d('0xa0')]({'attributes':[_0xbf8d('0xa1')],'raw':!![]});}})[_0xbf8d('0x5e')](function(_0x3c2f9d){var _0x589baf=_0x3c2f9d?_0x3c2f9d[_0xbf8d('0xa1')]:undefined;var _0x43fc91=_0x5b8c4e[_0xbf8d('0x17')](function(_0x4f30ab){return updateInteraction(_0x4f30ab,_0x43fd7b,_0x5205bb,_0x589baf);});return Promise[_0xbf8d('0xa2')](_0x43fc91);});}function countFilteredInteractions(_0xadccd2,_0x486378){var _0x3f5029=_0xadccd2['clone']();_0x3f5029[_0xbf8d('0xa')](_0xbf8d('0xa3'));_0x3f5029[_0xbf8d('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x1cce46=utils[_0xbf8d('0x25')](_0x486378);if(!_[_0xbf8d('0xa4')](_0x1cce46)){_0x3f5029['where']('t.id\x20IN\x20?',_0x1cce46);}var _0x13c132={'type':db[_0xbf8d('0x71')][_0xbf8d('0x72')][_0xbf8d('0xa5')],'raw':!![]};return db['sequelize']['query'](_0x3f5029[_0xbf8d('0x75')](),_0x13c132);}module[_0xbf8d('0xa6')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 112119c..4279338 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf424=['Users','TagIds','Tags','fullname','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out','-id','plainBody','trimStart','catch','updateInteraction','then'];(function(_0x23e954,_0x17edbf){var _0x2291d3=function(_0x12f9e5){while(--_0x12f9e5){_0x23e954['push'](_0x23e954['shift']());}};_0x2291d3(++_0x17edbf);}(_0xf424,0xcb));var _0x4f42=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xf424[_0x4409e7];return _0x24c751;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2b9de8,_0x19d0a2){return new Promise(function(_0x159f7c,_0xa626a5){try{var _0x130058=[];if(_0x19d0a2[_0x2b9de8]){_0x130058=_0x19d0a2[_0x2b9de8]['map'](function(_0x2561ca){return{'id':_0x2561ca['id'],'fullname':_0x2561ca[_0x4f42('0x0')]};});}return _0x159f7c(_0x130058);}catch(_0x28d6e2){_0xa626a5(_0x28d6e2);}});}function getInteractionTags(_0x37e157,_0x1dd3b7){var _0x188577=[];if(_0x37e157){_0x37e157[_0x4f42('0x1')](',')[_0x4f42('0x2')](function(_0x5bb55f){_0x188577[_0x4f42('0x3')](_0x1dd3b7[_0x5bb55f]);});}return _0x188577;}function updateWaitingCounter(_0x5cb413){if(_0x5cb413[_0x4f42('0x4')]){_0x5cb413[_0x4f42('0x4')]-=0x1;}}function updateInteractionCounters(_0x5966b8){_0x5966b8[_0x4f42('0x4')]=0x0;_0x5966b8[_0x4f42('0x5')]=0x0;_0x5966b8[_0x4f42('0x6')]=0x0;_0x5966b8[_0x4f42('0x7')]=0x0;_0x5966b8[_0x4f42('0x8')]=0x0;_0x5966b8[_0x4f42('0x9')]=0x0;if(_0x5966b8[_0x4f42('0xa')]){if(_0x5966b8[_0x4f42('0xb')]===_0x4f42('0x8')){_0x5966b8[_0x4f42('0x8')]+=0x1;updateWaitingCounter(_0x5966b8);}if(_0x5966b8['UserId']){_0x5966b8[_0x4f42('0x6')]+=0x1;if(_0x5966b8[_0x4f42('0x5')]){_0x5966b8[_0x4f42('0x5')]-=0x1;}}else{if(_0x5966b8[_0x4f42('0xb')]){_0x5966b8[_0x4f42('0x7')]+=0x1;updateWaitingCounter(_0x5966b8);}}}else{if(!_0x5966b8[_0x4f42('0xc')]){_0x5966b8['waiting']+=0x1;}if(_0x5966b8[_0x4f42('0xc')]){_0x5966b8[_0x4f42('0x5')]+=0x1;updateWaitingCounter(_0x5966b8);}}_0x5966b8[_0x4f42('0x9')]+=0x1;return _0x5966b8;}function getLastMessageText(_0x9ad046){return db[_0x4f42('0xd')][_0x4f42('0xe')]({'where':{'$and':[{'MailInteractionId':_0x9ad046['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4f42('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x4f42('0x10'),'raw':!![]})['then'](function(_0x3fb33a){if(_0x3fb33a&&_0x3fb33a[_0x4f42('0x11')]){_0x9ad046['lastMsgText']=_[_0x4f42('0x12')](_0x3fb33a[_0x4f42('0x11')]);}return _0x9ad046;})[_0x4f42('0x13')](function(_0x51a6df){throw _0x51a6df;});}exports[_0x4f42('0x14')]=function(_0x35145d,_0xd4145d,_0x7d7e40,_0x3711f0){return new Promise(function(_0x161292,_0x20f664){return getInteractionUsers(_0x35145d['id'],_0x7d7e40)[_0x4f42('0x15')](function(_0x1976f8){_0x35145d[_0x4f42('0x16')]=_0x1976f8;return getInteractionTags(_0x35145d[_0x4f42('0x17')],_0xd4145d);})[_0x4f42('0x15')](function(_0x9a4b30){_0x35145d[_0x4f42('0x18')]=_0x9a4b30;delete _0x35145d[_0x4f42('0x17')];return updateInteractionCounters(_0x35145d);})['then'](function(_0x4332aa){if(_0x3711f0){return getLastMessageText(_0x4332aa);}else{return _0x4332aa;}})[_0x4f42('0x15')](function(_0x55835e){_0x161292(_0x55835e);})[_0x4f42('0x13')](function(_0x497944){_0x20f664(_0x497944);});});}; \ No newline at end of file +var _0x9d25=['MailMessage','findOne','plainBody','-id','then','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','forEach','waiting','talking','answered','unmanaged','abandoned','closed','disposition','UserId','total'];(function(_0x3c8ed7,_0x5b4105){var _0x54e9a6=function(_0x59ed92){while(--_0x59ed92){_0x3c8ed7['push'](_0x3c8ed7['shift']());}};_0x54e9a6(++_0x5b4105);}(_0x9d25,0x129));var _0x59d2=function(_0x422b2a,_0x34cc84){_0x422b2a=_0x422b2a-0x0;var _0x92552c=_0x9d25[_0x422b2a];return _0x92552c;};'use strict';var _=require(_0x59d2('0x0'));var db=require(_0x59d2('0x1'))['db'];function getInteractionUsers(_0x4f4b74,_0x1113ea){return new Promise(function(_0x4c9027,_0x305086){try{var _0x37209f=[];if(_0x1113ea[_0x4f4b74]){_0x37209f=_0x1113ea[_0x4f4b74][_0x59d2('0x2')](function(_0x1ef64b){return{'id':_0x1ef64b['id'],'fullname':_0x1ef64b[_0x59d2('0x3')]};});}return _0x4c9027(_0x37209f);}catch(_0x551020){_0x305086(_0x551020);}});}function getInteractionTags(_0x5707a4,_0x395c41){var _0x9ca00c=[];if(_0x5707a4){_0x5707a4[_0x59d2('0x4')](',')[_0x59d2('0x5')](function(_0x23b38e){_0x9ca00c['push'](_0x395c41[_0x23b38e]);});}return _0x9ca00c;}function updateWaitingCounter(_0x276eeb){if(_0x276eeb[_0x59d2('0x6')]){_0x276eeb['waiting']-=0x1;}}function updateInteractionCounters(_0x5262a9){_0x5262a9[_0x59d2('0x6')]=0x0;_0x5262a9[_0x59d2('0x7')]=0x0;_0x5262a9[_0x59d2('0x8')]=0x0;_0x5262a9[_0x59d2('0x9')]=0x0;_0x5262a9[_0x59d2('0xa')]=0x0;_0x5262a9['total']=0x0;if(_0x5262a9[_0x59d2('0xb')]){if(_0x5262a9[_0x59d2('0xc')]===_0x59d2('0xa')){_0x5262a9[_0x59d2('0xa')]+=0x1;updateWaitingCounter(_0x5262a9);}if(_0x5262a9[_0x59d2('0xd')]){_0x5262a9['answered']+=0x1;if(_0x5262a9[_0x59d2('0x7')]){_0x5262a9[_0x59d2('0x7')]-=0x1;}}else{if(_0x5262a9[_0x59d2('0xc')]){_0x5262a9[_0x59d2('0x9')]+=0x1;updateWaitingCounter(_0x5262a9);}}}else{if(!_0x5262a9[_0x59d2('0xd')]){_0x5262a9[_0x59d2('0x6')]+=0x1;}if(_0x5262a9[_0x59d2('0xd')]){_0x5262a9[_0x59d2('0x7')]+=0x1;updateWaitingCounter(_0x5262a9);}}_0x5262a9[_0x59d2('0xe')]+=0x1;return _0x5262a9;}function getLastMessageText(_0x22a017){return db[_0x59d2('0xf')][_0x59d2('0x10')]({'where':{'$and':[{'MailInteractionId':_0x22a017['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x59d2('0x11')],'order':_0x59d2('0x12'),'raw':!![]})[_0x59d2('0x13')](function(_0x35529b){if(_0x35529b&&_0x35529b[_0x59d2('0x11')]){_0x22a017['lastMsgText']=_[_0x59d2('0x14')](_0x35529b[_0x59d2('0x11')]);}return _0x22a017;})[_0x59d2('0x15')](function(_0x352d45){throw _0x352d45;});}exports[_0x59d2('0x16')]=function(_0x1ba08c,_0x5f1747,_0xb62ef9,_0x637d3c){return new Promise(function(_0x500a12,_0x3fde9f){return getInteractionUsers(_0x1ba08c['id'],_0xb62ef9)[_0x59d2('0x13')](function(_0x5371d5){_0x1ba08c[_0x59d2('0x17')]=_0x5371d5;return getInteractionTags(_0x1ba08c[_0x59d2('0x18')],_0x5f1747);})[_0x59d2('0x13')](function(_0x57df84){_0x1ba08c[_0x59d2('0x19')]=_0x57df84;delete _0x1ba08c[_0x59d2('0x18')];return updateInteractionCounters(_0x1ba08c);})[_0x59d2('0x13')](function(_0x1f5b6a){if(_0x637d3c){return getLastMessageText(_0x1f5b6a);}else{return _0x1f5b6a;}})[_0x59d2('0x13')](function(_0x16046a){_0x500a12(_0x16046a);})['catch'](function(_0x22e814){_0x3fde9f(_0x22e814);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index eec4206..d59f207 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd832=['info','catch','error','lodash','../../mysqldb','openchannel-interactions','mail-interactions','../../config/logger','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','toUpperCase','name','role','stringify','null','Interaction','then'];(function(_0xd0f54d,_0x570712){var _0x225884=function(_0x369e60){while(--_0x369e60){_0xd0f54d['push'](_0xd0f54d['shift']());}};_0x225884(++_0x570712);}(_0xd832,0x1c3));var _0x2d83=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xd832[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x2d83('0x0'));var db=require(_0x2d83('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x2d83('0x2')),'mail':require('../../config/logger')(_0x2d83('0x3')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x2d83('0x4'))(_0x2d83('0x5')),'chat':require(_0x2d83('0x4'))(_0x2d83('0x6')),'whatsapp':require(_0x2d83('0x4'))(_0x2d83('0x7'))};function getAccountFK(_0x9350f){return _[_0x2d83('0x8')](_0x9350f)+(_0x9350f===_0x2d83('0x9')?'Website':_0x2d83('0xa'))+'Id';}function getInteractionFK(_0x5d6b13){return _[_0x2d83('0x8')](_0x5d6b13)+_0x2d83('0xb');}function getInteractionId(_0x5518d4,_0x341c8f,_0x2a35bf){if(_0x5518d4&&_0x5518d4[_[_0x2d83('0xc')](_0x2a35bf)+'InteractionId']){return _0x5518d4[_[_0x2d83('0xc')](_0x2a35bf)+_0x2d83('0xb')];}else if(_0x5518d4&&_0x5518d4['id']){return _0x5518d4['id'];}else if(_0x341c8f&&_0x341c8f['id']){return _0x341c8f['id'];}else{return _0x2d83('0xd');}}function getInteractionsTables(_0x46684c){return{'accounts':_0x46684c+'_'+(_0x46684c==='chat'?_0x2d83('0xe'):'accounts'),'interactions':_0x46684c+_0x2d83('0xf'),'interactionsTags':_0x46684c+_0x2d83('0x10'),'messages':_0x46684c+_0x2d83('0x11'),'userInteractions':'user_has_'+_0x46684c+_0x2d83('0xf')};}function getSelectedTags(_0xedf4a0){var _0x4d97d8=[];if(_0xedf4a0){_0x4d97d8=Array['isArray'](_0xedf4a0)?_0xedf4a0:[_0xedf4a0];}return _0x4d97d8;}function log(_0x2ae0e7,_0x224065,_0x4418a6,_0x36ab10,_0x5beaf2,_0x1a2e82){loggers[_0x5beaf2['toLowerCase']()][_0x2ae0e7]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a2e82[_0x2d83('0x12')](),_0x224065?_0x224065['id']:null,_0x224065?_0x224065[_0x2d83('0x13')]:null,_0x224065?_0x224065[_0x2d83('0x14')]:null,getInteractionId(_0x4418a6,_0x36ab10,_0x5beaf2),_0x4418a6?JSON[_0x2d83('0x15')](_0x4418a6):_0x2d83('0x16'));}function updateUser(_0x418903,_0x5778aa,_0x4d41c3,_0x431344,_0x13603f){db[_[_0x2d83('0xc')](_0x431344)+_0x2d83('0x17')]['findOne']({'where':{'id':getInteractionId(_0x5778aa,_0x4d41c3,_0x431344)}})[_0x2d83('0x18')](function(_0x308ac9){if(_0x308ac9){return _0x308ac9['update']({'UserId':_0x418903?_0x418903['id']:null});}})[_0x2d83('0x18')](function(_0x53fbe1){if(_0x53fbe1){log(_0x2d83('0x19'),_0x418903,_0x5778aa,_0x4d41c3,_0x431344,_0x13603f);}})[_0x2d83('0x1a')](function(){log(_0x2d83('0x1b'),_0x418903,_0x5778aa,_0x4d41c3,_0x431344,_0x13603f);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xfc87=['then','update','exports','../../mysqldb','../../config/logger','mail-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','unknown','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','Interaction'];(function(_0xab8d43,_0x5ccc6e){var _0x3afdca=function(_0x525570){while(--_0x525570){_0xab8d43['push'](_0xab8d43['shift']());}};_0x3afdca(++_0x5ccc6e);}(_0xfc87,0x12c));var _0x7fc8=function(_0x3c9e34,_0x4c3df6){_0x3c9e34=_0x3c9e34-0x0;var _0x1af3d5=_0xfc87[_0x3c9e34];return _0x1af3d5;};'use strict';var _=require('lodash');var db=require(_0x7fc8('0x0'))['db'];var loggers={'openchannel':require(_0x7fc8('0x1'))('openchannel-interactions'),'mail':require(_0x7fc8('0x1'))(_0x7fc8('0x2')),'fax':require(_0x7fc8('0x1'))('fax-interactions'),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x7fc8('0x1'))(_0x7fc8('0x3')),'whatsapp':require(_0x7fc8('0x1'))(_0x7fc8('0x4'))};function getAccountFK(_0x24fdf7){return _[_0x7fc8('0x5')](_0x24fdf7)+(_0x24fdf7===_0x7fc8('0x6')?_0x7fc8('0x7'):_0x7fc8('0x8'))+'Id';}function getInteractionFK(_0x52c133){return _['capitalize'](_0x52c133)+'InteractionId';}function getInteractionId(_0xd9fdae,_0x1659d7,_0x295556){if(_0xd9fdae&&_0xd9fdae[_['upperFirst'](_0x295556)+_0x7fc8('0x9')]){return _0xd9fdae[_['upperFirst'](_0x295556)+_0x7fc8('0x9')];}else if(_0xd9fdae&&_0xd9fdae['id']){return _0xd9fdae['id'];}else if(_0x1659d7&&_0x1659d7['id']){return _0x1659d7['id'];}else{return _0x7fc8('0xa');}}function getInteractionsTables(_0x3a867b){return{'accounts':_0x3a867b+'_'+(_0x3a867b==='chat'?_0x7fc8('0xb'):_0x7fc8('0xc')),'interactions':_0x3a867b+'_interactions','interactionsTags':_0x3a867b+_0x7fc8('0xd'),'messages':_0x3a867b+_0x7fc8('0xe'),'userInteractions':_0x7fc8('0xf')+_0x3a867b+_0x7fc8('0x10')};}function getSelectedTags(_0x20e7b0){var _0x1b58b8=[];if(_0x20e7b0){_0x1b58b8=Array[_0x7fc8('0x11')](_0x20e7b0)?_0x20e7b0:[_0x20e7b0];}return _0x1b58b8;}function log(_0xd2d192,_0x275619,_0x588800,_0x50ff66,_0x1bee09,_0x5b78a5){loggers[_0x1bee09[_0x7fc8('0x12')]()][_0xd2d192](_0x7fc8('0x13'),_0x5b78a5[_0x7fc8('0x14')](),_0x275619?_0x275619['id']:null,_0x275619?_0x275619[_0x7fc8('0x15')]:null,_0x275619?_0x275619[_0x7fc8('0x16')]:null,getInteractionId(_0x588800,_0x50ff66,_0x1bee09),_0x588800?JSON['stringify'](_0x588800):'null');}function updateUser(_0x4c5e9c,_0x50b32d,_0x263df9,_0x478b77,_0x135a50){db[_['upperFirst'](_0x478b77)+_0x7fc8('0x17')]['findOne']({'where':{'id':getInteractionId(_0x50b32d,_0x263df9,_0x478b77)}})[_0x7fc8('0x18')](function(_0x42acec){if(_0x42acec){return _0x42acec[_0x7fc8('0x19')]({'UserId':_0x4c5e9c?_0x4c5e9c['id']:null});}})['then'](function(_0x512a2d){if(_0x512a2d){log('info',_0x4c5e9c,_0x50b32d,_0x263df9,_0x478b77,_0x135a50);}})['catch'](function(){log('error',_0x4c5e9c,_0x50b32d,_0x263df9,_0x478b77,_0x135a50);});}module[_0x7fc8('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 859c760..4ebe0cb 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e9=['%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License','then','count','status','json','catch','users','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','split','aes-256-ctr','format'];(function(_0x128690,_0x5bd3fa){var _0x16d9b0=function(_0x15b907){while(--_0x15b907){_0x128690['push'](_0x128690['shift']());}};_0x16d9b0(++_0x5bd3fa);}(_0x70e9,0x1d2));var _0x970e=function(_0x35bcb6,_0xceae78){_0x35bcb6=_0x35bcb6-0x0;var _0x5930fe=_0x70e9[_0x35bcb6];return _0x5930fe;};'use strict';var crypto=require(_0x970e('0x0'));var util=require(_0x970e('0x1'));var compose=require(_0x970e('0x2'));var db=require(_0x970e('0x3'))['db'];var config=require(_0x970e('0x4'));function getValueFromLicense(_0x25b671,_0x338447){if(_0x25b671&&_0x338447){if(_0x338447['data1']&&_0x338447['license']){var _0x2cb6d1=_0x338447['data1'];var _0x4feac2=_0x338447[_0x970e('0x5')];var _0x3a2290=_0x2cb6d1['split']('-')[0x4];var _0xbd2ca3=_0x2cb6d1[_0x970e('0x6')]('-')[0x0];var _0x571841=crypto['createDecipher'](_0x970e('0x7'),util[_0x970e('0x8')](_0x970e('0x9'),_0x3a2290,_0x2cb6d1,_0xbd2ca3));var _0x289c56=_0x571841[_0x970e('0xa')](_0x4feac2,_0x970e('0xb'),_0x970e('0xc'));_0x289c56+=_0x571841[_0x970e('0xd')]('utf8');var _0x10f84e=JSON[_0x970e('0xe')](_0x289c56);return _0x10f84e[_0x970e('0xf')](_0x25b671)?_0x10f84e[_0x25b671]:null;}}return null;}function isLimit(_0x9b175,_0x5a7020,_0x195751,_0x35fc33){var _0x201508=_0x5a7020;return compose()['use'](function(_0xc1b72f,_0x1bd913,_0x3bfd6e){return db[_0x970e('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x970e('0x11')](function(_0x18f858){var _0x1cd2fa=getValueFromLicense(_0x9b175,_0x18f858);return _0x1cd2fa?_0x1cd2fa:_0x201508;})['then'](function(_0x27fddb){_0x201508=_0x27fddb;return _0x195751[_0x970e('0x12')](_0x35fc33);})[_0x970e('0x11')](function(_0x1374e1){if(_0x1374e1>=_0x201508){return _0x1bd913[_0x970e('0x13')](0x193)[_0x970e('0x14')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x9b175)});}_0x3bfd6e();})[_0x970e('0x15')](function(_0x19a1aa){_0x3bfd6e(_0x19a1aa);});});}function isUserLimit(){return isLimit(_0x970e('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0x970e('0x17')},{'role':'user'}]}});}exports[_0x970e('0x18')]=isUserLimit; \ No newline at end of file +var _0x8893=['../../config/environment','license','data1','split','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','format','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb'];(function(_0x3476bb,_0x39ec58){var _0x12151b=function(_0x585dcf){while(--_0x585dcf){_0x3476bb['push'](_0x3476bb['shift']());}};_0x12151b(++_0x39ec58);}(_0x8893,0x84));var _0x3889=function(_0x44d7c6,_0x5479a8){_0x44d7c6=_0x44d7c6-0x0;var _0x275541=_0x8893[_0x44d7c6];return _0x275541;};'use strict';var crypto=require('crypto');var util=require(_0x3889('0x0'));var compose=require(_0x3889('0x1'));var db=require(_0x3889('0x2'))['db'];var config=require(_0x3889('0x3'));function getValueFromLicense(_0x26f7af,_0x4d7c1f){if(_0x26f7af&&_0x4d7c1f){if(_0x4d7c1f['data1']&&_0x4d7c1f[_0x3889('0x4')]){var _0x38dfbd=_0x4d7c1f[_0x3889('0x5')];var _0x12d875=_0x4d7c1f['license'];var _0xdba92e=_0x38dfbd[_0x3889('0x6')]('-')[0x4];var _0x56ca4f=_0x38dfbd[_0x3889('0x6')]('-')[0x0];var _0xd41c02=crypto['createDecipher'](_0x3889('0x7'),util['format'](_0x3889('0x8'),_0xdba92e,_0x38dfbd,_0x56ca4f));var _0x5a2bb8=_0xd41c02[_0x3889('0x9')](_0x12d875,_0x3889('0xa'),_0x3889('0xb'));_0x5a2bb8+=_0xd41c02[_0x3889('0xc')](_0x3889('0xb'));var _0x58a975=JSON[_0x3889('0xd')](_0x5a2bb8);return _0x58a975[_0x3889('0xe')](_0x26f7af)?_0x58a975[_0x26f7af]:null;}}return null;}function isLimit(_0x30d16f,_0x26fc73,_0x3bacab,_0x56846f){var _0x313793=_0x26fc73;return compose()[_0x3889('0xf')](function(_0x53f3e8,_0x5145b8,_0x12532c){return db[_0x3889('0x10')][_0x3889('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x3889('0x12')](function(_0x3f798f){var _0x4b3b0f=getValueFromLicense(_0x30d16f,_0x3f798f);return _0x4b3b0f?_0x4b3b0f:_0x313793;})[_0x3889('0x12')](function(_0x4107cd){_0x313793=_0x4107cd;return _0x3bacab[_0x3889('0x13')](_0x56846f);})[_0x3889('0x12')](function(_0x22002f){if(_0x22002f>=_0x313793){return _0x5145b8['status'](0x193)['json']({'message':util[_0x3889('0x14')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x30d16f)});}_0x12532c();})[_0x3889('0x15')](function(_0x5ea7ef){_0x12532c(_0x5ea7ef);});});}function isUserLimit(){return isLimit(_0x3889('0x16'),0x1,db[_0x3889('0x17')],{'where':{'$or':[{'role':_0x3889('0x18')},{'role':_0x3889('0x19')}]}});}exports[_0x3889('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9fc2d01..b71b75a 100644 --- a/server/components/parsers/advancedSearch.js +++ b/server/components/parsers/advancedSearch.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e5a=['DATE','operator','$between','value','includes','$gt','$lte','format','YYYY-MM-DD','field','castTo','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','LIKE\x20?','<=\x20?','$gte','>=\x20?','start','$endsWith','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','replace','[$and]','[$or]','split','length','slice','shift','forEach','filter','indexOf','conditions','buildExpression'];(function(_0x4c83d7,_0x100731){var _0x9d1336=function(_0xb4cf3e){while(--_0xb4cf3e){_0x4c83d7['push'](_0x4c83d7['shift']());}};_0x9d1336(++_0x100731);}(_0x0e5a,0x1ba));var _0xa0e5=function(_0x1cdf7a,_0x509238){_0x1cdf7a=_0x1cdf7a-0x0;var _0xea2d6e=_0x0e5a[_0x1cdf7a];return _0xea2d6e;};'use strict';var _=require(_0xa0e5('0x0'));var moment=require(_0xa0e5('0x1'));exports[_0xa0e5('0x2')]=function(_0x2cf4ef){var _0x2f3f48={'conditions':[]};_0x2f3f48[_0xa0e5('0x3')]=_[_0xa0e5('0x4')](_0x2cf4ef,'[$or]')?'or':'and';var _0x17418b=_0x2cf4ef[_0xa0e5('0x5')](_0xa0e5('0x6'),'')[_0xa0e5('0x5')](_0xa0e5('0x7'),'')[_0xa0e5('0x8')]('||');for(var _0x137b06=0x0;_0x137b06<_0x17418b[_0xa0e5('0x9')];_0x137b06++){var _0x5ee320=_0x17418b[_0x137b06][_0xa0e5('0x8')](':=');var _0x3181bf=_0x5ee320[0x0];var _0x4d920f=_0x5ee320[_0xa0e5('0xa')](0x1);_0x4d920f['forEach'](function(_0x5a058f){var _0x3ccd2a=_0x5a058f[_0xa0e5('0x8')]('[')[_0xa0e5('0xb')]();var _0x567a48=_0x5a058f['match'](/\[(.*?)\]/g);_0x567a48[_0xa0e5('0xc')](function(_0x328c5c){var _0x496e9e=_0x328c5c['split']('[')[_0xa0e5('0xd')](function(_0x383fdd){return _0x383fdd[_0xa0e5('0xe')](']')>-0x1;})['map'](function(_0x52b370){return _0x52b370['split'](']')[0x0];})[0x0];_0x2f3f48[_0xa0e5('0xf')]['push']({'field':_0x3181bf,'operator':_0x3ccd2a,'value':_0x496e9e});});});}return _0x2f3f48;};exports[_0xa0e5('0x10')]=function(_0x2ff64a,_0x261d32,_0x15ddbe){var _0xa6522e={};if(_0x261d32===_0xa0e5('0x11')){if(_0x15ddbe[_0xa0e5('0x12')]==='$eq'){_0x15ddbe[_0xa0e5('0x12')]=_0xa0e5('0x13');_0x15ddbe[_0xa0e5('0x14')]+=','+_0x15ddbe[_0xa0e5('0x14')];}else if(_[_0xa0e5('0x15')]([_0xa0e5('0x16'),_0xa0e5('0x17')],_0x15ddbe['operator'])){_0x15ddbe[_0xa0e5('0x14')]=moment(_0x15ddbe[_0xa0e5('0x14')])['add'](0x1,'days')[_0xa0e5('0x18')](_0xa0e5('0x19'));}}if(_0x15ddbe['castTo']){_0x261d32=_0x15ddbe['castTo'];_0xa6522e['text']='CAST('+_0x2ff64a+'.'+_0x15ddbe[_0xa0e5('0x1a')]+'\x20AS\x20'+_0x15ddbe[_0xa0e5('0x1b')]+')\x20'+parseOperator(_0x15ddbe['operator']);}else{_0xa6522e[_0xa0e5('0x1c')]=_0x2ff64a+'.'+_0x15ddbe[_0xa0e5('0x1a')]+'\x20'+parseOperator(_0x15ddbe['operator']);}if(_[_0xa0e5('0x15')]([_0xa0e5('0x1d'),_0xa0e5('0x1e')],_0x15ddbe['operator']))_0xa6522e['text']='('+_0xa6522e[_0xa0e5('0x1c')]+'\x20OR\x20'+_0x2ff64a+'.'+_0x15ddbe[_0xa0e5('0x1a')]+_0xa0e5('0x1f');_0xa6522e[_0xa0e5('0x14')]=parseValue(_0x261d32,_0x15ddbe[_0xa0e5('0x12')],_0x15ddbe['value']);return _0xa6522e;};function parseOperator(_0x2682cc){var _0x34d5c2;switch(_0x2682cc){case _0xa0e5('0x20'):_0x34d5c2=_0xa0e5('0x21');break;case _0xa0e5('0x1e'):_0x34d5c2=_0xa0e5('0x22');break;case _0xa0e5('0x23'):_0x34d5c2='=\x20?';break;case'$ne':_0x34d5c2=_0xa0e5('0x24');break;case _0xa0e5('0x25'):case _0xa0e5('0x26'):case'$endsWith':_0x34d5c2=_0xa0e5('0x27');break;case'$lt':_0x34d5c2='<\x20?';break;case'$gt':_0x34d5c2='>\x20?';break;case'$lte':_0x34d5c2=_0xa0e5('0x28');break;case _0xa0e5('0x29'):_0x34d5c2=_0xa0e5('0x2a');break;case'$between':_0x34d5c2='BETWEEN\x20?\x20AND\x20?';break;}return _0x34d5c2;}function parseValue(_0x1a8e45,_0x4d77f4,_0x547852){var _0x36c0fc={'start':undefined,'end':undefined};switch(_0x4d77f4){case _0xa0e5('0x20'):case'$notIn':_0x36c0fc[_0xa0e5('0x2b')]=_0x547852[_0xa0e5('0x8')](',');break;case _0xa0e5('0x25'):_0x36c0fc['start']='%'+_0x547852+'%';break;case _0xa0e5('0x26'):_0x36c0fc[_0xa0e5('0x2b')]=_0x547852+'%';break;case _0xa0e5('0x2c'):_0x36c0fc[_0xa0e5('0x2b')]='%'+_0x547852;break;case _0xa0e5('0x13'):var _0x5788e5=_0x547852[_0xa0e5('0x8')](',');var _0x547852=_0x5788e5['shift']();var _0x178e3c=_0x5788e5[_0xa0e5('0x2d')]();if(_0x1a8e45===_0xa0e5('0x11')){_0x547852=moment(_0x547852)[_0xa0e5('0x2e')](0x0,!![])[_0xa0e5('0x18')]();_0x178e3c=moment(_0x178e3c)[_0xa0e5('0x2e')](0x0,!![])[_0xa0e5('0x2f')](0x17,_0xa0e5('0x30'))['add'](0x3b,_0xa0e5('0x31'))[_0xa0e5('0x2f')](0x3b,_0xa0e5('0x32'))[_0xa0e5('0x18')]();}_0x36c0fc={'start':_0x547852,'end':_0x178e3c};break;default:_0x36c0fc['start']=_0x547852;break;}return _0x36c0fc;} \ No newline at end of file +var _0x6d94=['match','filter','indexOf','map','conditions','push','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','\x20AS\x20','field','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','$notIn','=\x20?','$ne','<>\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','$endsWith','pop','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift'];(function(_0x473381,_0x25d98c){var _0x534776=function(_0x20b131){while(--_0x20b131){_0x473381['push'](_0x473381['shift']());}};_0x534776(++_0x25d98c);}(_0x6d94,0x1ea));var _0x46d9=function(_0x4a574e,_0x33348a){_0x4a574e=_0x4a574e-0x0;var _0x5c83ef=_0x6d94[_0x4a574e];return _0x5c83ef;};'use strict';var _=require(_0x46d9('0x0'));var moment=require(_0x46d9('0x1'));exports[_0x46d9('0x2')]=function(_0xb9bb09){var _0x848e7c={'conditions':[]};_0x848e7c[_0x46d9('0x3')]=_[_0x46d9('0x4')](_0xb9bb09,_0x46d9('0x5'))?'or':_0x46d9('0x6');var _0x11b34e=_0xb9bb09[_0x46d9('0x7')](_0x46d9('0x8'),'')['replace']('[$or]','')[_0x46d9('0x9')]('||');for(var _0x41ad5b=0x0;_0x41ad5b<_0x11b34e[_0x46d9('0xa')];_0x41ad5b++){var _0x13b144=_0x11b34e[_0x41ad5b][_0x46d9('0x9')](':=');var _0x49aa9f=_0x13b144[0x0];var _0x1d5e54=_0x13b144[_0x46d9('0xb')](0x1);_0x1d5e54[_0x46d9('0xc')](function(_0x169af3){var _0x3e3c8d=_0x169af3[_0x46d9('0x9')]('[')[_0x46d9('0xd')]();var _0x186b58=_0x169af3[_0x46d9('0xe')](/\[(.*?)\]/g);_0x186b58[_0x46d9('0xc')](function(_0x5014ca){var _0x577911=_0x5014ca[_0x46d9('0x9')]('[')[_0x46d9('0xf')](function(_0x395b8c){return _0x395b8c[_0x46d9('0x10')](']')>-0x1;})[_0x46d9('0x11')](function(_0x46a2fd){return _0x46a2fd['split'](']')[0x0];})[0x0];_0x848e7c[_0x46d9('0x12')][_0x46d9('0x13')]({'field':_0x49aa9f,'operator':_0x3e3c8d,'value':_0x577911});});});}return _0x848e7c;};exports['buildExpression']=function(_0x9b0200,_0x5d923f,_0x451139){var _0x5e0d70={};if(_0x5d923f===_0x46d9('0x14')){if(_0x451139[_0x46d9('0x15')]===_0x46d9('0x16')){_0x451139['operator']=_0x46d9('0x17');_0x451139['value']+=','+_0x451139[_0x46d9('0x18')];}else if(_[_0x46d9('0x19')]([_0x46d9('0x1a'),_0x46d9('0x1b')],_0x451139[_0x46d9('0x15')])){_0x451139[_0x46d9('0x18')]=moment(_0x451139[_0x46d9('0x18')])[_0x46d9('0x1c')](0x1,'days')[_0x46d9('0x1d')](_0x46d9('0x1e'));}}if(_0x451139[_0x46d9('0x1f')]){_0x5d923f=_0x451139[_0x46d9('0x1f')];_0x5e0d70[_0x46d9('0x20')]='CAST('+_0x9b0200+'.'+_0x451139['field']+_0x46d9('0x21')+_0x451139[_0x46d9('0x1f')]+')\x20'+parseOperator(_0x451139[_0x46d9('0x15')]);}else{_0x5e0d70[_0x46d9('0x20')]=_0x9b0200+'.'+_0x451139[_0x46d9('0x22')]+'\x20'+parseOperator(_0x451139[_0x46d9('0x15')]);}if(_['includes'](['$ne','$notIn'],_0x451139[_0x46d9('0x15')]))_0x5e0d70[_0x46d9('0x20')]='('+_0x5e0d70[_0x46d9('0x20')]+_0x46d9('0x23')+_0x9b0200+'.'+_0x451139[_0x46d9('0x22')]+_0x46d9('0x24');_0x5e0d70[_0x46d9('0x18')]=parseValue(_0x5d923f,_0x451139[_0x46d9('0x15')],_0x451139['value']);return _0x5e0d70;};function parseOperator(_0x168688){var _0x37e00f;switch(_0x168688){case'$in':_0x37e00f=_0x46d9('0x25');break;case _0x46d9('0x26'):_0x37e00f='NOT\x20IN\x20?';break;case _0x46d9('0x16'):_0x37e00f=_0x46d9('0x27');break;case _0x46d9('0x28'):_0x37e00f=_0x46d9('0x29');break;case'$substring':case _0x46d9('0x2a'):case'$endsWith':_0x37e00f=_0x46d9('0x2b');break;case _0x46d9('0x2c'):_0x37e00f=_0x46d9('0x2d');break;case _0x46d9('0x1a'):_0x37e00f='>\x20?';break;case _0x46d9('0x1b'):_0x37e00f=_0x46d9('0x2e');break;case'$gte':_0x37e00f=_0x46d9('0x2f');break;case _0x46d9('0x17'):_0x37e00f=_0x46d9('0x30');break;}return _0x37e00f;}function parseValue(_0x53e30d,_0x11a6f2,_0x2160dc){var _0x94024d={'start':undefined,'end':undefined};switch(_0x11a6f2){case'$in':case _0x46d9('0x26'):_0x94024d[_0x46d9('0x31')]=_0x2160dc[_0x46d9('0x9')](',');break;case _0x46d9('0x32'):_0x94024d[_0x46d9('0x31')]='%'+_0x2160dc+'%';break;case _0x46d9('0x2a'):_0x94024d[_0x46d9('0x31')]=_0x2160dc+'%';break;case _0x46d9('0x33'):_0x94024d['start']='%'+_0x2160dc;break;case'$between':var _0x736cbe=_0x2160dc[_0x46d9('0x9')](',');var _0x2160dc=_0x736cbe[_0x46d9('0xd')]();var _0x2a899e=_0x736cbe[_0x46d9('0x34')]();if(_0x53e30d==='DATE'){_0x2160dc=moment(_0x2160dc)[_0x46d9('0x35')](0x0,!![])[_0x46d9('0x1d')]();_0x2a899e=moment(_0x2a899e)['utcOffset'](0x0,!![])[_0x46d9('0x1c')](0x17,'hours')[_0x46d9('0x1c')](0x3b,_0x46d9('0x36'))[_0x46d9('0x1c')](0x3b,_0x46d9('0x37'))[_0x46d9('0x1d')]();}_0x94024d={'start':_0x2160dc,'end':_0x2a899e};break;default:_0x94024d[_0x46d9('0x31')]=_0x2160dc;break;}return _0x94024d;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6c78614..110fb48 100644 --- a/server/components/parsers/qs.js +++ b/server/components/parsers/qs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fed=['priority','cast','col','unsigned','substr','ASC','omit','isEmpty','length','isObject','isString','unset','match','^[+]?[0-9]*$','getFullTextValue','{EXPR}','forEach','replace','join','getOptions','query','$id','intersection','attributes','hasOwnProperty','nolimit','limit','order','pick','filter','object','name','where','merge','lower','options','include','includeAll','push','lodash','sequelize','moment','../../mysqldb','keys','parse','model','alias','raw','fields','split','filters','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','uniqueid','isArray','offset','sort','map'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x5fed,0xed));var _0xd5fe=function(_0xf48d27,_0xc761af){_0xf48d27=_0xf48d27-0x0;var _0x172722=_0x5fed[_0xf48d27];return _0x172722;};'use strict';var _=require(_0xd5fe('0x0'));var sequelize=require(_0xd5fe('0x1'));var moment=require(_0xd5fe('0x2'));var db=require(_0xd5fe('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3063eb){var _0xc88774=['ne'];try{var _0x3d6a82=JSON['parse'](_0x3063eb);var _0x378b3a=Object[_0xd5fe('0x4')](_0x3d6a82)[0x0];return _0xc88774['includes'](_0x378b3a);}catch(_0x22a26e){return![];}}function getOperatorValue(_0x27f054){var _0x1d0496=JSON['parse'](_0x27f054);var _0x5b2567=Object['keys'](_0x1d0496)[0x0];var _0xed85ee=_0x1d0496[_0x5b2567];return{['$'+_0x5b2567]:_0xed85ee};}function parseIncludeModel(_0x314f7a){var _0x5edbed=JSON[_0xd5fe('0x5')](_0x314f7a);return{'model':db[_0x5edbed[_0xd5fe('0x6')]],'as':_0x5edbed[_0xd5fe('0x7')],'attributes':_0x5edbed['fields'],'raw':_0x5edbed[_0xd5fe('0x8')]};}exports[_0xd5fe('0x9')]=function(_0x417cb8){var _0x20a493=null;if(_0x417cb8){_0x20a493=_0x417cb8[_0xd5fe('0xa')](',');}return _0x20a493;};exports[_0xd5fe('0xb')]=function(_0x2d9d14,_0xd326f4){var _0x550750={};if(!_['isEmpty'](_0x2d9d14)){_[_0xd5fe('0xc')](_0x2d9d14,function(_0x25555e,_0x438303){try{if(_0xd326f4){var _0x1b23d6=_[_0xd5fe('0xd')](_0xd326f4,{'name':_0x438303})||{};if(hasSequelizeOperator(_0x25555e)){_0x550750[_0x438303]=getOperatorValue(_0x25555e);}else if(_0x1b23d6[_0xd5fe('0xe')]===_0xd5fe('0xf')&&_[_0xd5fe('0x10')](_0x25555e)){var _0x364278=JSON[_0xd5fe('0x5')](_0x25555e);var _0x2dd1a1={'$gte':moment(moment(_0x364278[_0xd5fe('0x11')])[_0xd5fe('0x12')](_0xd5fe('0x13')))['utc']()['format'](),'$lte':moment(moment(_0x364278['$lte'])[_0xd5fe('0x12')]('YYYY-MM-DD'))[_0xd5fe('0x14')]()[_0xd5fe('0x15')](0x1,'s')['format']()};_0x550750[_0x438303]=_0x2dd1a1;}else if(_0x1b23d6['name']===_0xd5fe('0x16')){_0x550750[_0x438303]=_0x25555e;}else{_0x550750[_0x438303]=_[_0xd5fe('0x17')](_0x25555e)?_0x25555e:JSON[_0xd5fe('0x5')](_0x25555e);}}else{_0x550750[_0x438303]=_['isArray'](_0x25555e)?_0x25555e:JSON['parse'](_0x25555e);}}catch(_0x20f191){_0x550750[_0x438303]=_0x25555e[_0xd5fe('0xa')](',');}});}return _0x550750;};exports['limit']=function(_0x46ac7e){_0x46ac7e=parseInt(_0x46ac7e,0xa);if(!_0x46ac7e||_0x46ac7e<0x0){_0x46ac7e=LIMIT_VALUE;}return _0x46ac7e;};exports[_0xd5fe('0x18')]=function(_0x2109f9){_0x2109f9=parseInt(_0x2109f9,0xa);if(!_0x2109f9||_0x2109f9<0x0){_0x2109f9=0x0;}return _0x2109f9;};exports[_0xd5fe('0x19')]=function(_0x211dfc){var _0x4555b0,_0x176132=null;if(_0x211dfc){_0x4555b0=_0x211dfc[_0xd5fe('0xa')](',');_0x176132=_[_0xd5fe('0x1a')](_0x4555b0,function(_0x4f47bc){if(_0x4f47bc['indexOf']('-')===0x0){return[_0x4f47bc===_0xd5fe('0x1b')?sequelize[_0xd5fe('0x1c')](sequelize[_0xd5fe('0x1d')]('priority'),_0xd5fe('0x1e')):_0x4f47bc[_0xd5fe('0x1f')](0x1),'DESC'];}else{return[_0x4f47bc===_0xd5fe('0x1b')?sequelize[_0xd5fe('0x1c')](sequelize['col'](_0xd5fe('0x1b')),_0xd5fe('0x1e')):_0x4f47bc,_0xd5fe('0x20')];}});}return _0x176132;};exports[_0xd5fe('0x21')]=function(_0x238be2,_0x32f553){if(_[_0xd5fe('0x22')](_0x238be2)){return _0x238be2;}if(_['isArray'](_0x238be2)){for(var _0x5a5f43=0x0;_0x5a5f43<_0x238be2[_0xd5fe('0x23')];_0x5a5f43+=0x1){_0x238be2[_0x5a5f43]=this[_0xd5fe('0x21')](_0x238be2[_0x5a5f43],_0x32f553);}return _0x238be2;}if(!_[_0xd5fe('0x24')](_0x238be2)){return _0x238be2;}if(_[_0xd5fe('0x25')](_0x32f553)){_0x32f553=[_0x32f553];}if(!_[_0xd5fe('0x17')](_0x32f553)){return _0x238be2;}for(var _0x3cc35c=0x0;_0x3cc35c<_0x32f553[_0xd5fe('0x23')];_0x3cc35c+=0x1){_[_0xd5fe('0x26')](_0x238be2,_0x32f553[_0x3cc35c]);}for(var _0x677fcb in _0x238be2){if(_0x238be2['hasOwnProperty'](_0x677fcb)){_0x238be2[_0x677fcb]=this[_0xd5fe('0x21')](_0x238be2[_0x677fcb],_0x32f553);}}return _0x238be2;};exports['isNumeric']=function(_0x34822f){return _0x34822f[_0xd5fe('0x27')](RegExp(_0xd5fe('0x28')))?!![]:![];};exports['isEmail']=function(_0x209d05){return _0x209d05['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xd5fe('0x29')]=function(_0x4dd3e2,_0x2e812f){var _0x2394c8=[];var _0x171e6a=/[ `!@#$%^&*()_\-?~]/;var _0x5a59eb=_0x2e812f?'\x22{EXPR}\x22':_0xd5fe('0x2a');_0x4dd3e2[_0xd5fe('0xa')](/[ ,]+/)[_0xd5fe('0x2b')](function(_0x4d8547){_0x4d8547=_0x4d8547['replace'](/([^:]")"+/g,'$1');_0x4d8547='+'+_0x4d8547+'*';var _0x5ce96a=_0x4d8547[_0xd5fe('0x27')](_0x171e6a);if(_0x5ce96a){_0x4d8547='\x22'+_0x4d8547+'\x22';}_0x2394c8['push'](_0x4d8547);});_0x5a59eb=_0x5a59eb[_0xd5fe('0x2c')](_0xd5fe('0x2a'),_0x2394c8[_0xd5fe('0x2d')]('\x20'));return _0x5a59eb;};exports[_0xd5fe('0x2e')]=function(_0xe86c5a,_0x4e89d9,_0x150d6f){var _0x46b506={},_0x149806={};if(_0x4e89d9[_0xd5fe('0x2f')]['$id']){_0x4e89d9[_0xd5fe('0x2f')]['id']=_0x4e89d9[_0xd5fe('0x2f')]['$id'];delete _0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x30')];}_0x46b506[_0xd5fe('0x6')]=_[_0xd5fe('0x1a')](_0xe86c5a,'name');_0x46b506[_0xd5fe('0x2f')]=_[_0xd5fe('0x4')](_0x4e89d9[_0xd5fe('0x2f')]);_0x46b506['filters']=_[_0xd5fe('0x31')](_0x46b506[_0xd5fe('0x6')],_0x46b506[_0xd5fe('0x2f')]);_0x149806[_0xd5fe('0x32')]=_[_0xd5fe('0x31')](_0x46b506[_0xd5fe('0x6')],this['fields'](_0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x9')]));_0x149806[_0xd5fe('0x32')]=_0x149806[_0xd5fe('0x32')][_0xd5fe('0x23')]?_0x149806[_0xd5fe('0x32')]:_0x46b506[_0xd5fe('0x6')];if(!_0x4e89d9['query'][_0xd5fe('0x33')](_0xd5fe('0x34'))){_0x149806[_0xd5fe('0x35')]=this['limit'](_0x4e89d9[_0xd5fe('0x2f')]['limit']);_0x149806[_0xd5fe('0x18')]=this[_0xd5fe('0x18')](_0x4e89d9['query'][_0xd5fe('0x18')]);}_0x149806[_0xd5fe('0x36')]=this[_0xd5fe('0x19')](_0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x19')]);_0x149806['where']=this[_0xd5fe('0xb')](_[_0xd5fe('0x37')](_0x4e89d9['query'],_0x46b506[_0xd5fe('0xb')]),_0xe86c5a);if(_0x4e89d9['query']['filter']){var _0x1c53a0=_0xe86c5a;var _0x318934=_0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x38')];if(typeof _0x318934===_0xd5fe('0x39')){_0x1c53a0=_['filter'](_0xe86c5a,function(_0x8d9be2){return _['includes'](_0x318934['columns'],_0x8d9be2[_0xd5fe('0x3a')]);});_0x318934=_0x318934['value'];}_0x149806[_0xd5fe('0x3b')]=_[_0xd5fe('0x3c')](_0x149806[_0xd5fe('0x3b')],{'$or':_['map'](_0x1c53a0,function(_0x5427a2){if(_0x5427a2[_0xd5fe('0xe')]!=='VIRTUAL'){if(_0x150d6f){return sequelize[_0xd5fe('0x3b')](sequelize['fn'](_0xd5fe('0x3d'),sequelize[_0xd5fe('0x1d')](_0x5427a2[_0xd5fe('0x3a')])),{'$like':sequelize['fn'](_0xd5fe('0x3d'),'%'+_0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x38')]+'%')});}else{var _0x823dc0={};_0x823dc0[_0x5427a2[_0xd5fe('0x3a')]]={'$like':'%'+_0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x38')]+'%'};return _0x823dc0;}}})});}_0x149806=_['merge']({},_0x149806,_0x4e89d9[_0xd5fe('0x3e')]);return _0x149806;};exports[_0xd5fe('0x3f')]=function(_0x47ae20){var _0x5cf7a5=[];if(_0x47ae20[_0xd5fe('0x40')]){_0x5cf7a5[_0xd5fe('0x41')]({'all':!![]});}else if(_0x47ae20[_0xd5fe('0x3f')]){if(Array[_0xd5fe('0x17')](_0x47ae20[_0xd5fe('0x3f')])){_0x5cf7a5=Object[_0xd5fe('0x4')](_0x47ae20['include'])['map'](function(_0x162f62){return parseIncludeModel(_0x47ae20[_0xd5fe('0x3f')][_0x162f62]);});}else{var _0x58efda=parseIncludeModel(_0x47ae20[_0xd5fe('0x3f')]);_0x5cf7a5['push'](_0x58efda);}}return _0x5cf7a5;}; \ No newline at end of file +var _0x3aca=['lower','options','include','lodash','../../mysqldb','parse','keys','includes','model','alias','raw','fields','split','filters','isEmpty','forOwn','find','DATE','$gte','format','utc','YYYY-MM-DD','subtract','uniqueid','isArray','offset','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','match','{EXPR}','replace','push','join','query','$id','map','name','intersection','length','nolimit','limit','order','sort','where','pick','filter','object','columns','merge','type','VIRTUAL'];(function(_0x542a9b,_0x351513){var _0x4d5032=function(_0x538ed2){while(--_0x538ed2){_0x542a9b['push'](_0x542a9b['shift']());}};_0x4d5032(++_0x351513);}(_0x3aca,0x83));var _0xa3ac=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0x3aca[_0xae1a83];return _0xdb9da8;};'use strict';var _=require(_0xa3ac('0x0'));var sequelize=require('sequelize');var moment=require('moment');var db=require(_0xa3ac('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2e1dde){var _0x3e44a3=['ne'];try{var _0x585e8f=JSON[_0xa3ac('0x2')](_0x2e1dde);var _0x1127ed=Object[_0xa3ac('0x3')](_0x585e8f)[0x0];return _0x3e44a3[_0xa3ac('0x4')](_0x1127ed);}catch(_0x37b922){return![];}}function getOperatorValue(_0x56c21d){var _0x219b27=JSON['parse'](_0x56c21d);var _0x4fd108=Object[_0xa3ac('0x3')](_0x219b27)[0x0];var _0x4da43d=_0x219b27[_0x4fd108];return{['$'+_0x4fd108]:_0x4da43d};}function parseIncludeModel(_0x423126){var _0x20d561=JSON[_0xa3ac('0x2')](_0x423126);return{'model':db[_0x20d561[_0xa3ac('0x5')]],'as':_0x20d561[_0xa3ac('0x6')],'attributes':_0x20d561['fields'],'raw':_0x20d561[_0xa3ac('0x7')]};}exports[_0xa3ac('0x8')]=function(_0x234168){var _0x59ad50=null;if(_0x234168){_0x59ad50=_0x234168[_0xa3ac('0x9')](',');}return _0x59ad50;};exports[_0xa3ac('0xa')]=function(_0x41e8fd,_0x5f15c5){var _0x168b00={};if(!_[_0xa3ac('0xb')](_0x41e8fd)){_[_0xa3ac('0xc')](_0x41e8fd,function(_0x7da3b5,_0x384fd2){try{if(_0x5f15c5){var _0x24602c=_[_0xa3ac('0xd')](_0x5f15c5,{'name':_0x384fd2})||{};if(hasSequelizeOperator(_0x7da3b5)){_0x168b00[_0x384fd2]=getOperatorValue(_0x7da3b5);}else if(_0x24602c['type']===_0xa3ac('0xe')&&_['isPlainObject'](_0x7da3b5)){var _0x48f5fe=JSON['parse'](_0x7da3b5);var _0x183a9e={'$gte':moment(moment(_0x48f5fe[_0xa3ac('0xf')])[_0xa3ac('0x10')]('YYYY-MM-DD'))[_0xa3ac('0x11')]()[_0xa3ac('0x10')](),'$lte':moment(moment(_0x48f5fe['$lte'])[_0xa3ac('0x10')](_0xa3ac('0x12')))[_0xa3ac('0x11')]()[_0xa3ac('0x13')](0x1,'s')[_0xa3ac('0x10')]()};_0x168b00[_0x384fd2]=_0x183a9e;}else if(_0x24602c['name']===_0xa3ac('0x14')){_0x168b00[_0x384fd2]=_0x7da3b5;}else{_0x168b00[_0x384fd2]=_[_0xa3ac('0x15')](_0x7da3b5)?_0x7da3b5:JSON['parse'](_0x7da3b5);}}else{_0x168b00[_0x384fd2]=_['isArray'](_0x7da3b5)?_0x7da3b5:JSON[_0xa3ac('0x2')](_0x7da3b5);}}catch(_0x5bb5e6){_0x168b00[_0x384fd2]=_0x7da3b5['split'](',');}});}return _0x168b00;};exports['limit']=function(_0x37dc11){_0x37dc11=parseInt(_0x37dc11,0xa);if(!_0x37dc11||_0x37dc11<0x0){_0x37dc11=LIMIT_VALUE;}return _0x37dc11;};exports[_0xa3ac('0x16')]=function(_0x153920){_0x153920=parseInt(_0x153920,0xa);if(!_0x153920||_0x153920<0x0){_0x153920=0x0;}return _0x153920;};exports['sort']=function(_0x1810a5){var _0x2d59e7,_0x12ab47=null;if(_0x1810a5){_0x2d59e7=_0x1810a5[_0xa3ac('0x9')](',');_0x12ab47=_['map'](_0x2d59e7,function(_0x532600){if(_0x532600[_0xa3ac('0x17')]('-')===0x0){return[_0x532600===_0xa3ac('0x18')?sequelize[_0xa3ac('0x19')](sequelize[_0xa3ac('0x1a')](_0xa3ac('0x18')),_0xa3ac('0x1b')):_0x532600[_0xa3ac('0x1c')](0x1),_0xa3ac('0x1d')];}else{return[_0x532600===_0xa3ac('0x18')?sequelize[_0xa3ac('0x19')](sequelize['col']('priority'),_0xa3ac('0x1b')):_0x532600,_0xa3ac('0x1e')];}});}return _0x12ab47;};exports[_0xa3ac('0x1f')]=function(_0x2a8dec,_0x2f8a22){if(_[_0xa3ac('0xb')](_0x2a8dec)){return _0x2a8dec;}if(_[_0xa3ac('0x15')](_0x2a8dec)){for(var _0x189801=0x0;_0x189801<_0x2a8dec['length'];_0x189801+=0x1){_0x2a8dec[_0x189801]=this[_0xa3ac('0x1f')](_0x2a8dec[_0x189801],_0x2f8a22);}return _0x2a8dec;}if(!_[_0xa3ac('0x20')](_0x2a8dec)){return _0x2a8dec;}if(_[_0xa3ac('0x21')](_0x2f8a22)){_0x2f8a22=[_0x2f8a22];}if(!_[_0xa3ac('0x15')](_0x2f8a22)){return _0x2a8dec;}for(var _0x312d7f=0x0;_0x312d7f<_0x2f8a22['length'];_0x312d7f+=0x1){_[_0xa3ac('0x22')](_0x2a8dec,_0x2f8a22[_0x312d7f]);}for(var _0x50219d in _0x2a8dec){if(_0x2a8dec[_0xa3ac('0x23')](_0x50219d)){_0x2a8dec[_0x50219d]=this[_0xa3ac('0x1f')](_0x2a8dec[_0x50219d],_0x2f8a22);}}return _0x2a8dec;};exports[_0xa3ac('0x24')]=function(_0x19cb73){return _0x19cb73['match'](RegExp(_0xa3ac('0x25')))?!![]:![];};exports['isEmail']=function(_0x5e7d9b){return _0x5e7d9b[_0xa3ac('0x26')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0xcd2628,_0x2f9dee){var _0x386645=[];var _0x52e130=/[ `!@#$%^&*()_\-?~]/;var _0x58a25c=_0x2f9dee?'\x22{EXPR}\x22':_0xa3ac('0x27');_0xcd2628[_0xa3ac('0x9')](/[ ,]+/)['forEach'](function(_0x2fa23d){_0x2fa23d=_0x2fa23d[_0xa3ac('0x28')](/([^:]")"+/g,'$1');_0x2fa23d='+'+_0x2fa23d+'*';var _0x49cc23=_0x2fa23d[_0xa3ac('0x26')](_0x52e130);if(_0x49cc23){_0x2fa23d='\x22'+_0x2fa23d+'\x22';}_0x386645[_0xa3ac('0x29')](_0x2fa23d);});_0x58a25c=_0x58a25c['replace'](_0xa3ac('0x27'),_0x386645[_0xa3ac('0x2a')]('\x20'));return _0x58a25c;};exports['getOptions']=function(_0x5f38f7,_0x2dc845,_0x1f27d5){var _0x5bef2b={},_0x30cf63={};if(_0x2dc845[_0xa3ac('0x2b')]['$id']){_0x2dc845['query']['id']=_0x2dc845[_0xa3ac('0x2b')]['$id'];delete _0x2dc845[_0xa3ac('0x2b')][_0xa3ac('0x2c')];}_0x5bef2b[_0xa3ac('0x5')]=_[_0xa3ac('0x2d')](_0x5f38f7,_0xa3ac('0x2e'));_0x5bef2b['query']=_[_0xa3ac('0x3')](_0x2dc845[_0xa3ac('0x2b')]);_0x5bef2b[_0xa3ac('0xa')]=_[_0xa3ac('0x2f')](_0x5bef2b['model'],_0x5bef2b[_0xa3ac('0x2b')]);_0x30cf63['attributes']=_[_0xa3ac('0x2f')](_0x5bef2b[_0xa3ac('0x5')],this['fields'](_0x2dc845[_0xa3ac('0x2b')]['fields']));_0x30cf63['attributes']=_0x30cf63['attributes'][_0xa3ac('0x30')]?_0x30cf63['attributes']:_0x5bef2b['model'];if(!_0x2dc845[_0xa3ac('0x2b')]['hasOwnProperty'](_0xa3ac('0x31'))){_0x30cf63[_0xa3ac('0x32')]=this[_0xa3ac('0x32')](_0x2dc845[_0xa3ac('0x2b')][_0xa3ac('0x32')]);_0x30cf63['offset']=this[_0xa3ac('0x16')](_0x2dc845[_0xa3ac('0x2b')]['offset']);}_0x30cf63[_0xa3ac('0x33')]=this[_0xa3ac('0x34')](_0x2dc845[_0xa3ac('0x2b')][_0xa3ac('0x34')]);_0x30cf63[_0xa3ac('0x35')]=this[_0xa3ac('0xa')](_[_0xa3ac('0x36')](_0x2dc845[_0xa3ac('0x2b')],_0x5bef2b[_0xa3ac('0xa')]),_0x5f38f7);if(_0x2dc845[_0xa3ac('0x2b')][_0xa3ac('0x37')]){var _0x49303d=_0x5f38f7;var _0x4b4130=_0x2dc845[_0xa3ac('0x2b')][_0xa3ac('0x37')];if(typeof _0x4b4130===_0xa3ac('0x38')){_0x49303d=_[_0xa3ac('0x37')](_0x5f38f7,function(_0x3301ce){return _[_0xa3ac('0x4')](_0x4b4130[_0xa3ac('0x39')],_0x3301ce[_0xa3ac('0x2e')]);});_0x4b4130=_0x4b4130['value'];}_0x30cf63[_0xa3ac('0x35')]=_[_0xa3ac('0x3a')](_0x30cf63[_0xa3ac('0x35')],{'$or':_['map'](_0x49303d,function(_0x4b7879){if(_0x4b7879[_0xa3ac('0x3b')]!==_0xa3ac('0x3c')){if(_0x1f27d5){return sequelize['where'](sequelize['fn'](_0xa3ac('0x3d'),sequelize[_0xa3ac('0x1a')](_0x4b7879[_0xa3ac('0x2e')])),{'$like':sequelize['fn'](_0xa3ac('0x3d'),'%'+_0x2dc845[_0xa3ac('0x2b')][_0xa3ac('0x37')]+'%')});}else{var _0x449328={};_0x449328[_0x4b7879[_0xa3ac('0x2e')]]={'$like':'%'+_0x2dc845[_0xa3ac('0x2b')][_0xa3ac('0x37')]+'%'};return _0x449328;}}})});}_0x30cf63=_['merge']({},_0x30cf63,_0x2dc845[_0xa3ac('0x3e')]);return _0x30cf63;};exports[_0xa3ac('0x3f')]=function(_0x564545){var _0x106a6d=[];if(_0x564545['includeAll']){_0x106a6d[_0xa3ac('0x29')]({'all':!![]});}else if(_0x564545[_0xa3ac('0x3f')]){if(Array['isArray'](_0x564545[_0xa3ac('0x3f')])){_0x106a6d=Object[_0xa3ac('0x3')](_0x564545['include'])[_0xa3ac('0x2d')](function(_0x3187f2){return parseIncludeModel(_0x564545['include'][_0x3187f2]);});}else{var _0x46e6bd=parseIncludeModel(_0x564545['include']);_0x106a6d[_0xa3ac('0x29')](_0x46e6bd);}}return _0x106a6d;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index d1f6639..472efd4 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sort','toLowerCase','userpic','online','lastPauseAt','address','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','value','filterAgentAttributes','name','role','lastLoginAt','whatsappPause','mailStatus','chatStatusTime','openchannelStatusTime','whatsappStatusTime','chatCapacity','mailCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','getAgentIdsByQueues','filter','getAgentIdsByStatus','includes','User','findAll','fullname','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var db=require(_0x7995('0x2'))['db'];var amiClient=jayson[_0x7995('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x7995('0x3')][_0x7995('0x4')]({'port':0x232c});function isAgentPaused(_0x1902b4,_0x462a03){var _0x576d89=[_0x1902b4[_0x7995('0x5')],_0x1902b4[_0x7995('0x6')],_0x1902b4[_0x7995('0x7')],_0x1902b4[_0x7995('0x8')],_0x1902b4[_0x7995('0x9')],_0x1902b4[_0x7995('0xa')],_0x1902b4['whatsappPause']];if(!_0x462a03)return _[_0x7995('0xb')](_0x576d89);var _0x1cad37=_['filter'](_0x576d89);return _0x1cad37[_0x7995('0xc')]>0x0&&_0x1cad37[_0x7995('0xc')]<_0x576d89[_0x7995('0xc')]?!![]:![];}function isIdle(_0x35b5fe){return _0x35b5fe===_0x7995('0xd')||_0x35b5fe===_0x7995('0xe')||_0x35b5fe===_0x7995('0xf')||_0x35b5fe==='ringing'||_[_0x7995('0x10')](_0x35b5fe);}function isAgentIdle(_0x41c652){if(_0x41c652['voiceStatus']!==_0x7995('0xd')&&_0x41c652[_0x7995('0xa')]){_0x41c652[_0x7995('0x11')]=_0x7995('0x12');return![];}return _[_0x7995('0xb')]([_0x41c652[_0x7995('0x13')],_0x41c652[_0x7995('0x14')],_0x41c652['mailStatus'],_0x41c652['openchannelStatus'],_0x41c652[_0x7995('0x15')],_0x41c652[_0x7995('0x11')],_0x41c652[_0x7995('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x7995('0x17')](_0x7995('0x18'),{})[_0x7995('0x19')](function(_0x2202ce){if(_0x2202ce[_0x7995('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x2eeacc=_0x2202ce['result'];return routingClient[_0x7995('0x17')](_0x7995('0x18'),{})[_0x7995('0x19')](function(_0x291317){if(_0x291317[_0x7995('0x1a')]){throw new Error(_0x7995('0x1b'));}var _0x4faa60=_0x291317['result'];return _[_0x7995('0x1c')]({},_0x2eeacc,_0x4faa60);});})['catch'](function(_0x555f74){throw _0x555f74;});}exports[_0x7995('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3d463e){var _0x4cbe10=_0x7995('0xe');if(isAgentPaused(_0x3d463e))_0x4cbe10='pause';else if(isAgentPaused(_0x3d463e,!![]))_0x4cbe10='*pause';else if(isAgentIdle(_0x3d463e))_0x4cbe10=_0x7995('0xd');else _0x4cbe10=_0x7995('0x1e');return _0x4cbe10;}exports[_0x7995('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x1a8568,_0x460924){var _0x1c278a=_['isArray'](_0x1a8568)?_0x1a8568:[_0x1a8568];var _0x32a09a=_[_0x7995('0x20')](_0x460924)+_0x7995('0x21');var _0x285437=_[_0x7995('0x22')](_0x1c278a,function(_0x13bc35){return db[_0x32a09a][_0x7995('0x23')]({'where':{'id':_0x13bc35}})[_0x7995('0x19')](function(_0x59405a){if(!_0x59405a)return[];return _0x59405a[_0x7995('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x7995('0x25')](_0x285437)[_0x7995('0x19')](function(_0x268ce7){var _0x3a3fcf=_(_0x268ce7)[_0x7995('0x26')]()['map']('id')[_0x7995('0x27')]()['value']();return _0x3a3fcf;});}exports[_0x7995('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x49bc7e,_0xf16cc2,_0x132a42){try{if(_0xf16cc2[_0x7995('0xc')]>0x0){_0x49bc7e=_0x49bc7e['filter'](function(_0x9b2a15){return _0xf16cc2['includes'](_0x9b2a15['id']);});}var _0x456a28=_0x49bc7e[_0x7995('0x29')](function(_0x4253e5){var _0x574574='busy';if(isAgentIdle(_0x4253e5)){_0x574574='idle';}return _0x574574===_0x132a42;});return _[_0x7995('0x22')](_0x456a28,'id');}catch(_0xe6b0b3){throw _0xe6b0b3;}}exports[_0x7995('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2b874d,_0x2e3493,_0x1ca460){return Promise['resolve']()['then'](function(){if(_0x2e3493[_0x7995('0xc')]>0x0){_0x2b874d=_0x2b874d['filter'](function(_0x553671){return _0x2e3493[_0x7995('0x2b')](_0x553671['id']);});}return _0x2b874d;})[_0x7995('0x19')](function(){return db[_0x7995('0x2c')][_0x7995('0x2d')]({'attributes':['id','name',_0x7995('0x2e'),_0x7995('0x5'),'faxPause','mailPause','openchannelPause',_0x7995('0x9'),_0x7995('0xa'),'whatsappPause',_0x7995('0x2f')],'where':{'id':{'$in':_['map'](_0x2b874d,'id')}},'raw':!![]});})[_0x7995('0x19')](function(_0x1cb058){return _0x1cb058[_0x7995('0x22')](function(_0x5014d2){var _0x52d76d=_[_0x7995('0x30')](_0x2b874d,['id',_0x5014d2['id']]);var _0x5e67fe=filterAgentAttributes(_0x52d76d);_['merge'](_0x5014d2,_0x5e67fe);_0x5014d2[_0x7995('0x31')]=getAgentStatus(_0x5014d2);return _0x5014d2;});})[_0x7995('0x19')](function(_0x5212ff){var _0x1baa15=sortAgentsByStatus(_0x5212ff,_0x1ca460);return _[_0x7995('0x22')](_0x1baa15,'id');})[_0x7995('0x32')](function(_0x18667c){throw _0x18667c;});}exports[_0x7995('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x53002a){var _0x2d4285={'fields':[],'order':null};var _0x242713=_0x53002a[_0x7995('0x34')](',');_0x2d4285[_0x7995('0x35')]=_['filter'](_0x242713,function(_0x2be2c0){if(!_0x2be2c0[_0x7995('0x2b')](_0x7995('0x31'))){return!![];}_0x2d4285[_0x7995('0x36')]=_[_0x7995('0x37')](_0x2be2c0,'-')?_0x7995('0x38'):'ASC';return![];});return _0x2d4285;}exports[_0x7995('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x3be298){if(!_0x3be298){_0x3be298=_0x7995('0x3a');}if(_0x3be298[_0x7995('0x2b')](_0x7995('0x2e'))&&!_0x3be298[_0x7995('0x2b')](_0x7995('0x3b'))){var _0x270c0e=_0x3be298[_0x7995('0x3c')](0x0,_0x3be298[_0x7995('0x3d')](_0x7995('0x2e')));_0x3be298+=','+_0x270c0e+_0x7995('0x3b');}return _0x3be298;}exports[_0x7995('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x53cda2,_0x50a98e){var _0x334dff=_0x53cda2[_0x7995('0x3f')](function(_0x58523e,_0x4b0855){if(_0x58523e[_0x7995('0x31')]===_0x4b0855['globalStatus']){if(_0x58523e['globalStatus']===_0x7995('0x12')){if(_0x50a98e===_0x7995('0x38')){return(_0x58523e[_0x7995('0x2f')]||'')<(_0x4b0855['pauseType']||'')||_0x58523e[_0x7995('0x2e')]['toLowerCase']()>_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x58523e['pauseType']||'')<(_0x4b0855[_0x7995('0x2f')]||'')||_0x58523e[_0x7995('0x2e')][_0x7995('0x40')]()>_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x50a98e===_0x7995('0x38')){return _0x58523e[_0x7995('0x2e')][_0x7995('0x40')]()<_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return _0x58523e['fullname'][_0x7995('0x40')]()<_0x4b0855['fullname'][_0x7995('0x40')]()?-0x1:0x1;}}}else{if(_0x50a98e==='DESC'){return _0x58523e[_0x7995('0x31')]<_0x4b0855['globalStatus']?0x1:-0x1;}else{return _0x58523e[_0x7995('0x31')]<_0x4b0855[_0x7995('0x31')]?-0x1:0x1;}}});return _0x334dff;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3e9e62){var _0x336ff2=[_0x7995('0x41'),_0x7995('0x42'),'lastLoginAt',_0x7995('0x43'),_0x7995('0x2f'),_0x7995('0x43'),'internal',_0x7995('0x44'),_0x7995('0x5'),_0x7995('0x8'),_0x7995('0x7'),_0x7995('0x9'),'whatsappPause',_0x7995('0x6'),_0x7995('0xa'),'chatCapacity',_0x7995('0x45'),'mailCapacity',_0x7995('0x46'),_0x7995('0x47'),_0x7995('0x48'),_0x7995('0x49'),_0x7995('0x4a'),_0x7995('0x4b'),_0x7995('0x4c'),'whatsappCurrentCapacity',_0x7995('0x4d'),_0x7995('0x13'),_0x7995('0x4e'),'mailStatus',_0x7995('0x15'),_0x7995('0x16'),_0x7995('0x14'),'voiceStatus','chatStatusTime','openchannelStatusTime',_0x7995('0x4f'),_0x7995('0x50'),'whatsappStatusTime',_0x7995('0x51'),_0x7995('0x52'),_0x7995('0x53'),_0x7995('0x54'),_0x7995('0x55'),'phoneBarEnableScreenRecordingByAgent',_0x7995('0x56'),'routealias'];var _0x14fe7f=[_0x7995('0x5'),_0x7995('0x8'),'mailPause','smsPause','whatsappPause','faxPause',_0x7995('0xa'),_0x7995('0x42')];var _0x1a861c=_(_0x3e9e62)[_0x7995('0x57')](_0x14fe7f)[_0x7995('0x58')](_0x336ff2)[_0x7995('0x59')]();return _0x1a861c;}exports[_0x7995('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7995('0x5b'),_0x7995('0x2e'),_0x7995('0x5c'),_0x7995('0x3b'),_0x7995('0x42'),_0x7995('0x31'),_0x7995('0x41'),_0x7995('0x5d'),_0x7995('0x2f'),_0x7995('0x43'),_0x7995('0x6'),_0x7995('0x5'),'mailPause',_0x7995('0x8'),_0x7995('0x9'),_0x7995('0xa'),_0x7995('0x5e'),'chatStatus','faxStatus',_0x7995('0x5f'),_0x7995('0x4e'),_0x7995('0x15'),_0x7995('0x11'),'whatsappStatus',_0x7995('0x60'),_0x7995('0x51'),_0x7995('0x4f'),_0x7995('0x61'),'smsStatusTime','voiceStatusTime',_0x7995('0x62'),_0x7995('0x63'),_0x7995('0x48'),_0x7995('0x64'),_0x7995('0x45'),_0x7995('0x46'),_0x7995('0x47'),_0x7995('0x49'),_0x7995('0x4d'),'mailCurrentCapacity',_0x7995('0x4a'),_0x7995('0x4c'),_0x7995('0x65'),_0x7995('0x66'),'phoneBarEnableAutomaticScreenRecording','destconnectedlinenum',_0x7995('0x67'),_0x7995('0x53'),'routealias',_0x7995('0x55')];}exports[_0x7995('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xf494=['pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','online','omit','filterAgentAttributes','faxStatusTime','smsStatusTime','phoneBarEnableScreenRecordingByAgent','onhold','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','every','filter','length','idle','unavailable','ringing','voicePause','voiceStatus','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','unknown','pause','*pause','getAgentStatus','isArray','startCase','Queue','map','all','flatten','uniq','value','getAgentIdsByQueues','resolve','includes','User','findAll','name','fullname','whatsappPause'];(function(_0x26f0b2,_0x355024){var _0x502a6e=function(_0x152514){while(--_0x152514){_0x26f0b2['push'](_0x26f0b2['shift']());}};_0x502a6e(++_0x355024);}(_0xf494,0x1c6));var _0x4f49=function(_0x1d50de,_0x1d58c8){_0x1d50de=_0x1d50de-0x0;var _0x3f238c=_0xf494[_0x1d50de];return _0x3f238c;};'use strict';var _=require(_0x4f49('0x0'));var jayson=require(_0x4f49('0x1'));var db=require(_0x4f49('0x2'))['db'];var amiClient=jayson['client'][_0x4f49('0x3')]({'port':0x232a});var routingClient=jayson[_0x4f49('0x4')][_0x4f49('0x3')]({'port':0x232c});function isAgentPaused(_0x25677c,_0x20c0d7){var _0x2a15fb=[_0x25677c[_0x4f49('0x5')],_0x25677c[_0x4f49('0x6')],_0x25677c[_0x4f49('0x7')],_0x25677c[_0x4f49('0x8')],_0x25677c[_0x4f49('0x9')],_0x25677c['voicePause'],_0x25677c['whatsappPause']];if(!_0x20c0d7)return _[_0x4f49('0xa')](_0x2a15fb);var _0x327bd5=_[_0x4f49('0xb')](_0x2a15fb);return _0x327bd5[_0x4f49('0xc')]>0x0&&_0x327bd5[_0x4f49('0xc')]<_0x2a15fb[_0x4f49('0xc')]?!![]:![];}function isIdle(_0x151d8c){return _0x151d8c===_0x4f49('0xd')||_0x151d8c==='unknown'||_0x151d8c===_0x4f49('0xe')||_0x151d8c===_0x4f49('0xf')||_['isNil'](_0x151d8c);}function isAgentIdle(_0x15e7a1){if(_0x15e7a1['voiceStatus']!=='idle'&&_0x15e7a1[_0x4f49('0x10')]){_0x15e7a1[_0x4f49('0x11')]='pause';return![];}return _[_0x4f49('0xa')]([_0x15e7a1[_0x4f49('0x12')],_0x15e7a1[_0x4f49('0x13')],_0x15e7a1[_0x4f49('0x14')],_0x15e7a1[_0x4f49('0x15')],_0x15e7a1[_0x4f49('0x16')],_0x15e7a1[_0x4f49('0x11')],_0x15e7a1['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x4f49('0x17')](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x5878f4){if(_0x5878f4['error']){throw new Error(_0x4f49('0x1a'));}var _0x2ecaaa=_0x5878f4[_0x4f49('0x1b')];return routingClient['request'](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x4e85df){if(_0x4e85df['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x560592=_0x4e85df['result'];return _[_0x4f49('0x1c')]({},_0x2ecaaa,_0x560592);});})[_0x4f49('0x1d')](function(_0x1c2d70){throw _0x1c2d70;});}exports[_0x4f49('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x5793ac){var _0x416893=_0x4f49('0x1f');if(isAgentPaused(_0x5793ac))_0x416893=_0x4f49('0x20');else if(isAgentPaused(_0x5793ac,!![]))_0x416893=_0x4f49('0x21');else if(isAgentIdle(_0x5793ac))_0x416893=_0x4f49('0xd');else _0x416893='busy';return _0x416893;}exports[_0x4f49('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x357446,_0x3ae590){var _0x53b57d=_[_0x4f49('0x23')](_0x357446)?_0x357446:[_0x357446];var _0x1d70a7=_[_0x4f49('0x24')](_0x3ae590)+_0x4f49('0x25');var _0x9d30aa=_[_0x4f49('0x26')](_0x53b57d,function(_0x559d98){return db[_0x1d70a7]['findOne']({'where':{'id':_0x559d98}})[_0x4f49('0x19')](function(_0x429de7){if(!_0x429de7)return[];return _0x429de7['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x4f49('0x27')](_0x9d30aa)[_0x4f49('0x19')](function(_0x35f8e0){var _0x525950=_(_0x35f8e0)[_0x4f49('0x28')]()[_0x4f49('0x26')]('id')[_0x4f49('0x29')]()[_0x4f49('0x2a')]();return _0x525950;});}exports[_0x4f49('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x122404,_0x4915af,_0x50c571){try{if(_0x4915af[_0x4f49('0xc')]>0x0){_0x122404=_0x122404[_0x4f49('0xb')](function(_0x605c91){return _0x4915af['includes'](_0x605c91['id']);});}var _0x3cbfbd=_0x122404[_0x4f49('0xb')](function(_0x43d8e3){var _0x506b20='busy';if(isAgentIdle(_0x43d8e3)){_0x506b20=_0x4f49('0xd');}return _0x506b20===_0x50c571;});return _[_0x4f49('0x26')](_0x3cbfbd,'id');}catch(_0x7a6ea0){throw _0x7a6ea0;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1eaac6,_0x35aa33,_0x173657){return Promise[_0x4f49('0x2c')]()[_0x4f49('0x19')](function(){if(_0x35aa33[_0x4f49('0xc')]>0x0){_0x1eaac6=_0x1eaac6[_0x4f49('0xb')](function(_0x45ae19){return _0x35aa33[_0x4f49('0x2d')](_0x45ae19['id']);});}return _0x1eaac6;})[_0x4f49('0x19')](function(){return db[_0x4f49('0x2e')][_0x4f49('0x2f')]({'attributes':['id',_0x4f49('0x30'),_0x4f49('0x31'),_0x4f49('0x5'),_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9'),'voicePause',_0x4f49('0x32'),_0x4f49('0x33')],'where':{'id':{'$in':_[_0x4f49('0x26')](_0x1eaac6,'id')}},'raw':!![]});})[_0x4f49('0x19')](function(_0x1c3af8){return _0x1c3af8[_0x4f49('0x26')](function(_0x2cbe4e){var _0x3ad6a7=_[_0x4f49('0x34')](_0x1eaac6,['id',_0x2cbe4e['id']]);var _0x338db8=filterAgentAttributes(_0x3ad6a7);_[_0x4f49('0x1c')](_0x2cbe4e,_0x338db8);_0x2cbe4e[_0x4f49('0x35')]=getAgentStatus(_0x2cbe4e);return _0x2cbe4e;});})[_0x4f49('0x19')](function(_0x4d2d57){var _0x371282=sortAgentsByStatus(_0x4d2d57,_0x173657);return _[_0x4f49('0x26')](_0x371282,'id');})[_0x4f49('0x1d')](function(_0x26014f){throw _0x26014f;});}exports[_0x4f49('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3ee818){var _0xe1b662={'fields':[],'order':null};var _0x25fdf8=_0x3ee818[_0x4f49('0x37')](',');_0xe1b662[_0x4f49('0x38')]=_[_0x4f49('0xb')](_0x25fdf8,function(_0x141db){if(!_0x141db[_0x4f49('0x2d')](_0x4f49('0x35'))){return!![];}_0xe1b662['order']=_[_0x4f49('0x39')](_0x141db,'-')?_0x4f49('0x3a'):'ASC';return![];});return _0xe1b662;}exports[_0x4f49('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0xbf05f3){if(!_0xbf05f3){_0xbf05f3='fullname,internal';}if(_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x31'))&&!_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x3c'))){var _0x3bfe7e=_0xbf05f3[_0x4f49('0x3d')](0x0,_0xbf05f3[_0x4f49('0x3e')]('fullname'));_0xbf05f3+=','+_0x3bfe7e+'internal';}return _0xbf05f3;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x15e4b3,_0x15b280){var _0x2e4355=_0x15e4b3[_0x4f49('0x3f')](function(_0x1053b2,_0x1ecf6c){if(_0x1053b2[_0x4f49('0x35')]===_0x1ecf6c[_0x4f49('0x35')]){if(_0x1053b2[_0x4f49('0x35')]==='pause'){if(_0x15b280==='DESC'){return(_0x1053b2[_0x4f49('0x33')]||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')]['toLowerCase']()>_0x1ecf6c[_0x4f49('0x31')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1053b2['pauseType']||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()>_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2['fullname'][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?-0x1:0x1;}}});return _0x2e4355;}exports[_0x4f49('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x356785){var _0x435192=[_0x4f49('0x42'),'online',_0x4f49('0x43'),_0x4f49('0x44'),'pauseType',_0x4f49('0x44'),'internal',_0x4f49('0x45'),_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),'smsPause',_0x4f49('0x32'),_0x4f49('0x6'),_0x4f49('0x10'),_0x4f49('0x46'),_0x4f49('0x47'),_0x4f49('0x48'),_0x4f49('0x49'),_0x4f49('0x4a'),_0x4f49('0x4b'),_0x4f49('0x4c'),_0x4f49('0x4d'),_0x4f49('0x4e'),_0x4f49('0x4f'),_0x4f49('0x50'),_0x4f49('0x51'),_0x4f49('0x12'),'openchannelStatus','mailStatus',_0x4f49('0x16'),_0x4f49('0x52'),_0x4f49('0x13'),_0x4f49('0x11'),_0x4f49('0x53'),_0x4f49('0x54'),_0x4f49('0x55'),'smsStatusTime',_0x4f49('0x56'),'faxStatusTime',_0x4f49('0x57'),_0x4f49('0x58'),_0x4f49('0x59'),_0x4f49('0x5a'),'phoneBarEnableScreenRecordingByAgent',_0x4f49('0x5b'),'routealias'];var _0x52d18c=[_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),_0x4f49('0x9'),'whatsappPause','faxPause',_0x4f49('0x10'),_0x4f49('0x5c')];var _0x5cb187=_(_0x356785)[_0x4f49('0x5d')](_0x52d18c)['pick'](_0x435192)['value']();return _0x5cb187;}exports[_0x4f49('0x5e')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x4f49('0x31'),'role',_0x4f49('0x3c'),_0x4f49('0x5c'),_0x4f49('0x35'),_0x4f49('0x42'),_0x4f49('0x43'),_0x4f49('0x33'),_0x4f49('0x44'),_0x4f49('0x6'),'chatPause',_0x4f49('0x7'),'openchannelPause',_0x4f49('0x9'),_0x4f49('0x10'),_0x4f49('0x32'),_0x4f49('0x12'),_0x4f49('0x13'),_0x4f49('0x14'),'openchannelStatus',_0x4f49('0x16'),_0x4f49('0x11'),'whatsappStatus','chatStatusTime',_0x4f49('0x5f'),_0x4f49('0x55'),_0x4f49('0x54'),_0x4f49('0x60'),_0x4f49('0x57'),'whatsappStatusTime',_0x4f49('0x46'),'faxCapacity',_0x4f49('0x48'),_0x4f49('0x47'),_0x4f49('0x49'),'whatsappCapacity',_0x4f49('0x4c'),_0x4f49('0x51'),_0x4f49('0x4e'),_0x4f49('0x4d'),'smsCurrentCapacity',_0x4f49('0x50'),_0x4f49('0x61'),'phoneBarEnableAutomaticScreenRecording',_0x4f49('0x59'),_0x4f49('0x62'),_0x4f49('0x58'),_0x4f49('0x63'),_0x4f49('0x5a')];}exports[_0x4f49('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 438676a..a936c7e 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x677e=['talking','unavailable','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','get','available','outbound','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','inUse','loggedInDb','ringInUse'];(function(_0x21c112,_0x3c0a3a){var _0xc45f5f=function(_0x16e608){while(--_0x16e608){_0x21c112['push'](_0x21c112['shift']());}};_0xc45f5f(++_0x3c0a3a);}(_0x677e,0x1bf));var _0xe677=function(_0x41b6f5,_0x1ad42f){_0x41b6f5=_0x41b6f5-0x0;var _0x5d6142=_0x677e[_0x41b6f5];return _0x5d6142;};'use strict';var _=require(_0xe677('0x0'));var jayson=require(_0xe677('0x1'));var util=require(_0xe677('0x2'));var amiClient=jayson[_0xe677('0x3')][_0xe677('0x4')]({'port':0x232a});var routingClient=jayson[_0xe677('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xe677('0x5'),_0xe677('0x6'),_0xe677('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xe677('0x8'),_0xe677('0x9'),'invalid',_0xe677('0xa'),'notInUse','onHold','ringing',_0xe677('0xb'),_0xe677('0xc'),_0xe677('0xd'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xe677('0xe'),_0xe677('0xf'),_0xe677('0x10'),_0xe677('0x11'),_0xe677('0x12'),_0xe677('0x13'),'startPredictive',_0xe677('0x14'),'erlangCalls','erlangCallToSecond','erlangAbandonmentRate',_0xe677('0x15'),_0xe677('0x16'),_0xe677('0x17'),'dialPredictiveIntervalMinThreshold',_0xe677('0x18'),_0xe677('0x19'),_0xe677('0x1a'),_0xe677('0x1b'),_0xe677('0x1c'),_0xe677('0x1d'),_0xe677('0x1e')];function getRealtimeQueues(_0x4539b1,_0x3740b1){var _0x4eb065=_0x3740b1===_0xe677('0x1f')?amiClient:routingClient;return _0x4eb065[_0xe677('0x20')](_[_0xe677('0x21')](_0x3740b1)+'Queues',_0x4539b1)[_0xe677('0x22')](function(_0x2f434c){if(_0x2f434c[_0xe677('0x23')])throw new Error(util[_0xe677('0x24')](_0xe677('0x25'),_0x3740b1));return _0x2f434c[_0xe677('0x26')];})[_0xe677('0x27')](function(_0x119a88){throw _0x119a88;});}exports[_0xe677('0x28')]=getRealtimeQueues;function initializeQueues(_0x9a5c27,_0x4424d6,_0x32f38d,_0xabc953){var _0x530d88=DEFAULT_QUEUE_ATTRIBUTES;if(_0x32f38d==='voice'){if(_0xabc953===_0xe677('0x29')){_0x530d88=_0x530d88[_0xe677('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0xabc953==='outbound'){_0x530d88=_0x530d88[_0xe677('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x9a5c27[_0xe677('0x2b')](function(_0x46358b){var _0x4e40b0=_0x46358b[_0xe677('0x2c')]({'plain':!![]});_0x4e40b0[_0xe677('0x6')]=0x0;_0x4e40b0[_0xe677('0xa')]=0x0;_0x4e40b0[_0xe677('0x5')]=0x0;_0x4e40b0[_0xe677('0x2d')]=0x0;_0x4e40b0[_0xe677('0x7')]=0x0;if(_0x32f38d==='voice'){_0x4e40b0[_0xe677('0xc')]=0x0;_0x4e40b0[_0xe677('0x8')]=0x0;if(_0xabc953===_0xe677('0x2e')){_0x4e40b0['pTalking']=0x0;_0x4e40b0[_0xe677('0xe')]=0x0;}}var _0x4280ab=_[_0xe677('0x2f')](_0x4424d6,['id',_0x4e40b0['id']]);if(_0x4280ab){_[_0xe677('0x30')](_0x4e40b0,_[_0xe677('0x31')](_0x4280ab,_0x530d88));}return _0x4e40b0;});}exports[_0xe677('0x32')]=initializeQueues; \ No newline at end of file +var _0xbcfc=['originated','message','statusMessage','dialActive','Trunk','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','available','busy','merge','pick','jayson/promise','util','client','http','loggedIn','paused','inUse','invalid','loggedInDb','ringInUse','talking','unavailable'];(function(_0x473658,_0x4683b1){var _0x16ffcb=function(_0x41744d){while(--_0x41744d){_0x473658['push'](_0x473658['shift']());}};_0x16ffcb(++_0x4683b1);}(_0xbcfc,0x114));var _0xcbcf=function(_0x1a582f,_0x2ab202){_0x1a582f=_0x1a582f-0x0;var _0x55ac11=_0xbcfc[_0x1a582f];return _0x55ac11;};'use strict';var _=require('lodash');var jayson=require(_0xcbcf('0x0'));var util=require(_0xcbcf('0x1'));var amiClient=jayson[_0xcbcf('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0xcbcf('0x2')][_0xcbcf('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xcbcf('0x4'),_0xcbcf('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xcbcf('0x6'),_0xcbcf('0x7'),_0xcbcf('0x8'),'notInUse','onHold','ringing',_0xcbcf('0x9'),_0xcbcf('0xa'),_0xcbcf('0xb'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xcbcf('0xc'),_0xcbcf('0xd'),_0xcbcf('0xe'),_0xcbcf('0xf'),'dialMethod',_0xcbcf('0x10'),'startPredictive',_0xcbcf('0x11'),'erlangCalls',_0xcbcf('0x12'),'erlangAbandonmentRate',_0xcbcf('0x13'),'dialPredictiveInterval',_0xcbcf('0x14'),_0xcbcf('0x15'),'predictiveIntervalAvailable',_0xcbcf('0x16'),_0xcbcf('0x17'),_0xcbcf('0x18'),_0xcbcf('0x19'),_0xcbcf('0x1a'),_0xcbcf('0x1b')];function getRealtimeQueues(_0x59fdc7,_0x22c1cf){var _0x13780b=_0x22c1cf===_0xcbcf('0x1c')?amiClient:routingClient;return _0x13780b[_0xcbcf('0x1d')](_[_0xcbcf('0x1e')](_0x22c1cf)+_0xcbcf('0x1f'),_0x59fdc7)[_0xcbcf('0x20')](function(_0x41fa6f){if(_0x41fa6f[_0xcbcf('0x21')])throw new Error(util[_0xcbcf('0x22')](_0xcbcf('0x23'),_0x22c1cf));return _0x41fa6f[_0xcbcf('0x24')];})[_0xcbcf('0x25')](function(_0x4305ef){throw _0x4305ef;});}exports[_0xcbcf('0x26')]=getRealtimeQueues;function initializeQueues(_0x48298e,_0x8f46eb,_0x376b21,_0x35235d){var _0x1c100a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x376b21===_0xcbcf('0x1c')){if(_0x35235d===_0xcbcf('0x27')){_0x1c100a=_0x1c100a[_0xcbcf('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x35235d===_0xcbcf('0x29')){_0x1c100a=_0x1c100a[_0xcbcf('0x28')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x48298e[_0xcbcf('0x2a')](function(_0x472154){var _0x98c52e=_0x472154[_0xcbcf('0x2b')]({'plain':!![]});_0x98c52e['paused']=0x0;_0x98c52e['loggedInDb']=0x0;_0x98c52e[_0xcbcf('0x4')]=0x0;_0x98c52e[_0xcbcf('0x2c')]=0x0;_0x98c52e['waiting']=0x0;if(_0x376b21===_0xcbcf('0x1c')){_0x98c52e['talking']=0x0;_0x98c52e[_0xcbcf('0x2d')]=0x0;if(_0x35235d===_0xcbcf('0x29')){_0x98c52e['pTalking']=0x0;_0x98c52e[_0xcbcf('0xc')]=0x0;}}var _0x85e11b=_['find'](_0x8f46eb,['id',_0x98c52e['id']]);if(_0x85e11b){_[_0xcbcf('0x2e')](_0x98c52e,_[_0xcbcf('0x2f')](_0x85e11b,_0x1c100a));}return _0x98c52e;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index dcea0ab..64816e1 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x450d4e,_0xcacc3){var _0x300304=function(_0x49ab27){while(--_0x49ab27){_0x450d4e['push'](_0x450d4e['shift']());}};_0x300304(++_0xcacc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 79fdd0d..3584f21 100644 --- a/server/config/license/hardware.js +++ b/server/config/license/hardware.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf563=['hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','md5','update','digest'];(function(_0x175c40,_0x37f161){var _0x3feac9=function(_0x4016da){while(--_0x4016da){_0x175c40['push'](_0x175c40['shift']());}};_0x3feac9(++_0x37f161);}(_0xf563,0x1bb));var _0x3f56=function(_0x2034be,_0x8e1a0c){_0x2034be=_0x2034be-0x0;var _0x21566e=_0xf563[_0x2034be];return _0x21566e;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x3f56('0x0'));var exec=require(_0x3f56('0x1'))[_0x3f56('0x2')];var config=require(_0x3f56('0x3'));function getInterfaces(){var _0x53a734=[];var _0x32fead=os[_0x3f56('0x4')]();var _0x4603be=_['orderBy'](_[_0x3f56('0x5')](_0x32fead));for(var _0x5dc09c=0x0;_0x5dc09c<_0x4603be[_0x3f56('0x6')];_0x5dc09c++){var _0x435c8a=_0x32fead[_0x4603be[_0x5dc09c]][_0x3f56('0x7')](function(_0x35888b){return _0x35888b[_0x3f56('0x8')]===_0x3f56('0x9')&&_0x35888b[_0x3f56('0xa')]===![];});_0x53a734=_0x53a734[_0x3f56('0xb')](_0x435c8a);}return _0x53a734;}function getFirstInterface(){var _0x1d9bc6=_[_0x3f56('0xc')](getInterfaces());return{'macAddress':_0x1d9bc6&&_0x1d9bc6['mac']?_0x1d9bc6['mac']:_0x3f56('0xd'),'ipAddress':_0x1d9bc6&&_0x1d9bc6[_0x3f56('0xe')]?_0x1d9bc6[_0x3f56('0xe')]:_0x3f56('0xf')};}exports[_0x3f56('0x10')]=getFirstInterface;function getCPUhash(){var _0x3b192f=_[_0x3f56('0x11')](os[_0x3f56('0x12')]()[_0x3f56('0x13')](function(_0x500ee1){return _0x500ee1[_0x3f56('0x14')];}))[_0x3f56('0x15')](':');return crypto['createHash'](_0x3f56('0x16'))[_0x3f56('0x17')](_0x3b192f)[_0x3f56('0x18')](_0x3f56('0x19'));}exports[_0x3f56('0x1a')]=function(){var _0x2b72a9=os[_0x3f56('0x1b')]();var _0x2c7516=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x2c7516[_0x3f56('0x1c')](config[_0x3f56('0x1d')])){return config['licenseToken'];}else if(_0x2b72a9===_0x3f56('0x1e')){return exec(_0x3f56('0x1f'),{'encoding':_0x3f56('0x20')})[_0x3f56('0x21')]('\x0d\x0a','');}else{var _0x44e6f1=getFirstInterface();var _0x5b1b8a=getCPUhash();var _0x55da09=_0x5b1b8a+'|'+os[_0x3f56('0x22')]()+'|'+_0x44e6f1[_0x3f56('0x23')]+'|'+_0x44e6f1[_0x3f56('0x24')];var _0x1af2bf=crypto[_0x3f56('0x25')](_0x3f56('0x16'))[_0x3f56('0x17')](_0x55da09)[_0x3f56('0x18')](_0x3f56('0x19'));return _0x1af2bf[_0x3f56('0x26')](0x0,0x8)+'-'+_0x1af2bf[_0x3f56('0x26')](0x8,0xc)+'-'+_0x1af2bf[_0x3f56('0x26')](0xc,0x10)+'-'+_0x1af2bf[_0x3f56('0x26')](0x10,0x14)+'-'+_0x1af2bf[_0x3f56('0x26')](0x14);}}; \ No newline at end of file +var _0xc847=['replace','hostname','macAddress','createHash','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x5f0c76,_0x44b266){var _0x308606=function(_0x14bc96){while(--_0x14bc96){_0x5f0c76['push'](_0x5f0c76['shift']());}};_0x308606(++_0x44b266);}(_0xc847,0x126));var _0x7c84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc847[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7c84('0x0'));var os=require('os');var crypto=require(_0x7c84('0x1'));var machine=require(_0x7c84('0x2'));var exec=require(_0x7c84('0x3'))[_0x7c84('0x4')];var config=require(_0x7c84('0x5'));function getInterfaces(){var _0x5b3225=[];var _0x1b1fb0=os[_0x7c84('0x6')]();var _0x2e5e12=_[_0x7c84('0x7')](_['keys'](_0x1b1fb0));for(var _0x38afa0=0x0;_0x38afa0<_0x2e5e12[_0x7c84('0x8')];_0x38afa0++){var _0x4d6bbd=_0x1b1fb0[_0x2e5e12[_0x38afa0]][_0x7c84('0x9')](function(_0x3e7221){return _0x3e7221[_0x7c84('0xa')]===_0x7c84('0xb')&&_0x3e7221[_0x7c84('0xc')]===![];});_0x5b3225=_0x5b3225[_0x7c84('0xd')](_0x4d6bbd);}return _0x5b3225;}function getFirstInterface(){var _0x10fd4a=_['head'](getInterfaces());return{'macAddress':_0x10fd4a&&_0x10fd4a[_0x7c84('0xe')]?_0x10fd4a[_0x7c84('0xe')]:_0x7c84('0xf'),'ipAddress':_0x10fd4a&&_0x10fd4a[_0x7c84('0x10')]?_0x10fd4a[_0x7c84('0x10')]:_0x7c84('0x11')};}exports[_0x7c84('0x12')]=getFirstInterface;function getCPUhash(){var _0x3beb02=_['orderBy'](os[_0x7c84('0x13')]()['map'](function(_0x2496c0){return _0x2496c0[_0x7c84('0x14')];}))[_0x7c84('0x15')](':');return crypto['createHash']('md5')[_0x7c84('0x16')](_0x3beb02)['digest'](_0x7c84('0x17'));}exports[_0x7c84('0x18')]=function(){var _0x1c4eaf=os[_0x7c84('0x19')]();var _0x50bd0e=/[0-9a-f-]{36}/;if(config[_0x7c84('0x1a')]&&_0x50bd0e[_0x7c84('0x1b')](config[_0x7c84('0x1a')])){return config[_0x7c84('0x1a')];}else if(_0x1c4eaf===_0x7c84('0x1c')){return exec(_0x7c84('0x1d'),{'encoding':'utf8'})[_0x7c84('0x1e')]('\x0d\x0a','');}else{var _0x1ae77b=getFirstInterface();var _0x4499f5=getCPUhash();var _0x459cc2=_0x4499f5+'|'+os[_0x7c84('0x1f')]()+'|'+_0x1ae77b[_0x7c84('0x20')]+'|'+_0x1ae77b['ipAddress'];var _0x5443e4=crypto[_0x7c84('0x21')]('md5')[_0x7c84('0x16')](_0x459cc2)[_0x7c84('0x22')](_0x7c84('0x17'));return _0x5443e4['substring'](0x0,0x8)+'-'+_0x5443e4[_0x7c84('0x23')](0x8,0xc)+'-'+_0x5443e4[_0x7c84('0x23')](0xc,0x10)+'-'+_0x5443e4[_0x7c84('0x23')](0x10,0x14)+'-'+_0x5443e4['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index dd68367..599f1a6 100644 --- a/server/config/license/index.js +++ b/server/config/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4c5=['message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error'];(function(_0x50af9c,_0xf03b1e){var _0x5b5e5a=function(_0x309a92){while(--_0x309a92){_0x50af9c['push'](_0x50af9c['shift']());}};_0x5b5e5a(++_0xf03b1e);}(_0xc4c5,0xaf));var _0x5c4c=function(_0x3a92ec,_0x59e568){_0x3a92ec=_0x3a92ec-0x0;var _0x10bd78=_0xc4c5[_0x3a92ec];return _0x10bd78;};'use strict';var util=require(_0x5c4c('0x0'));var moment=require(_0x5c4c('0x1'));var rp=require(_0x5c4c('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x5c4c('0x3'))(module,_0x5c4c('0x4'));var db=require(_0x5c4c('0x5'))['db'];var encryptor=require(_0x5c4c('0x6'));var hardware=require(_0x5c4c('0x7'));var logger=require(_0x5c4c('0x8'))(_0x5c4c('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x16d02f){return new BPromise(function(_0x5627db,_0x422859){var _0x1eacc7=util[_0x5c4c('0xa')](_0x5c4c('0xb'),HOST,_0x16d02f,module[_0x5c4c('0xc')][_0x5c4c('0x4')]);if(oldToken){_0x1eacc7=util[_0x5c4c('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x16d02f,module[_0x5c4c('0xc')][_0x5c4c('0x4')],oldToken);}var _0x16a3a4={'uri':_0x1eacc7,'method':_0x5c4c('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x16a3a4)[_0x5c4c('0xe')](function(_0x7f87cd){_0x5627db(_0x7f87cd);})[_0x5c4c('0xf')](function(_0x3e8b03){_0x422859(_0x3e8b03);});});}function manageLicense(_0x19e9f0,_0x57c4b0){var _0x4a9f21=_0x57c4b0[_0x5c4c('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x4a9f21[_0x5c4c('0x11')]!==_0x19e9f0&&!_0x4a9f21['data2']){oldToken=_0x4a9f21['data1'];}httpRequest(_0x19e9f0)['then'](function(_0x5a9079){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5a9079[_0x5c4c('0x12')]){isOldTokenSent=![];if(!_0x4a9f21[_0x5c4c('0x9')]&&_0x4a9f21[_0x5c4c('0x9')]!=_0x5a9079[_0x5c4c('0x9')]||_0x4a9f21[_0x5c4c('0x9')]&&_0x4a9f21[_0x5c4c('0x13')]){logger[_0x5c4c('0x14')](_0x5c4c('0x15'));}if(_0x4a9f21[_0x5c4c('0x9')]&&!_0x4a9f21[_0x5c4c('0x13')]&&_0x4a9f21['license']!=_0x5a9079[_0x5c4c('0x9')]){logger[_0x5c4c('0x14')](_0x5c4c('0x16'));}if(_0x4a9f21[_0x5c4c('0x9')]&&!_0x4a9f21['data2']&&_0x4a9f21[_0x5c4c('0x9')]==_0x5a9079['license']){return _0x57c4b0;}return _0x57c4b0['update']({'data1':_0x19e9f0,'data2':null,'license':_0x5a9079['license']});}else{if(_0x5a9079['license']||_0x4a9f21[_0x5c4c('0x9')]){if(!_0x4a9f21[_0x5c4c('0x13')]){if(_0x4a9f21[_0x5c4c('0x11')]==_0x19e9f0){GRAY_PERIOD_REASON='Disabled';logger[_0x5c4c('0x14')](_0x5c4c('0x17'));}else{GRAY_PERIOD_REASON=_0x5c4c('0x18');logger[_0x5c4c('0x14')](_0x5c4c('0x19'),_0x4a9f21[_0x5c4c('0x11')],_0x19e9f0);}logger[_0x5c4c('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x5c4c('0x1a')](),moment()['format'](_0x5c4c('0x1b')));return _0x57c4b0[_0x5c4c('0x1c')]({'data2':encryptor[_0x5c4c('0x1d')](moment()['format'](_0x5c4c('0x1b')))});}else{if(moment()[_0x5c4c('0x1e')](encryptor[_0x5c4c('0x1f')](_0x4a9f21[_0x5c4c('0x13')]),_0x5c4c('0x20'))>DAYS){logger['info'](_0x5c4c('0x21'),moment()[_0x5c4c('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x57c4b0['update']({'data1':_0x19e9f0,'data2':null,'license':null});}}}else{if(_0x4a9f21[_0x5c4c('0x11')]!=_0x19e9f0){logger[_0x5c4c('0x14')](_0x5c4c('0x19'),_0x4a9f21[_0x5c4c('0x11')],_0x19e9f0);return _0x57c4b0[_0x5c4c('0x1c')]({'data1':_0x19e9f0,'data2':null,'license':null});}}}return _0x57c4b0;})[_0x5c4c('0xe')](function(_0x5e7a2c){_0x57c4b0=_0x5e7a2c;})[_0x5c4c('0xf')](function(_0x2016f4){logger[_0x5c4c('0x22')](_0x2016f4[_0x5c4c('0x23')]);})[_0x5c4c('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x5c4c('0x25')](),_0x57c4b0);},TIME);});}function defaultLicense(){var _0x154790=hardware['getUuid']();if(_0x154790){return db[_0x5c4c('0x26')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x154790}})[_0x5c4c('0x27')](function(_0x61c057,_0x57dca3){logger[_0x5c4c('0x14')](_0x5c4c('0x28'),_0x154790);manageLicense(_0x154790,_0x61c057);})[_0x5c4c('0xf')](function(_0x31fc24){logger[_0x5c4c('0x22')](_0x31fc24[_0x5c4c('0x23')]);});}}exports[_0x5c4c('0x29')]=defaultLicense; \ No newline at end of file +var _0x3a43=['toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x561e5c,_0x370b25){var _0x2c652a=function(_0x25cc7e){while(--_0x25cc7e){_0x561e5c['push'](_0x561e5c['shift']());}};_0x2c652a(++_0x370b25);}(_0x3a43,0xae));var _0x33a4=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0x3a43[_0x272638];return _0x19d027;};'use strict';var util=require('util');var moment=require(_0x33a4('0x0'));var rp=require('request-promise');var BPromise=require(_0x33a4('0x1'));var pkginfo=require(_0x33a4('0x2'))(module,_0x33a4('0x3'));var db=require(_0x33a4('0x4'))['db'];var encryptor=require(_0x33a4('0x5'));var hardware=require(_0x33a4('0x6'));var logger=require(_0x33a4('0x7'))(_0x33a4('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x265f76){return new BPromise(function(_0x42fc3d,_0x21e2e5){var _0x13d43f=util[_0x33a4('0x9')](_0x33a4('0xa'),HOST,_0x265f76,module['exports'][_0x33a4('0x3')]);if(oldToken){_0x13d43f=util[_0x33a4('0x9')](_0x33a4('0xb'),HOST,_0x265f76,module[_0x33a4('0xc')]['version'],oldToken);}var _0x474b56={'uri':_0x13d43f,'method':_0x33a4('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x474b56)[_0x33a4('0xe')](function(_0x5bafbb){_0x42fc3d(_0x5bafbb);})[_0x33a4('0xf')](function(_0x287ed0){_0x21e2e5(_0x287ed0);});});}function manageLicense(_0x757e6a,_0x39f0eb){var _0x567324=_0x39f0eb['get']({'plain':!![]});if(!isOldTokenSent&&_0x567324[_0x33a4('0x10')]!==_0x757e6a&&!_0x567324['data2']){oldToken=_0x567324[_0x33a4('0x10')];}httpRequest(_0x757e6a)[_0x33a4('0xe')](function(_0x39b158){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x39b158[_0x33a4('0x11')]){isOldTokenSent=![];if(!_0x567324[_0x33a4('0x8')]&&_0x567324[_0x33a4('0x8')]!=_0x39b158['license']||_0x567324[_0x33a4('0x8')]&&_0x567324[_0x33a4('0x12')]){logger[_0x33a4('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x567324[_0x33a4('0x8')]&&!_0x567324[_0x33a4('0x12')]&&_0x567324[_0x33a4('0x8')]!=_0x39b158[_0x33a4('0x8')]){logger[_0x33a4('0x13')](_0x33a4('0x14'));}if(_0x567324[_0x33a4('0x8')]&&!_0x567324[_0x33a4('0x12')]&&_0x567324[_0x33a4('0x8')]==_0x39b158[_0x33a4('0x8')]){return _0x39f0eb;}return _0x39f0eb['update']({'data1':_0x757e6a,'data2':null,'license':_0x39b158[_0x33a4('0x8')]});}else{if(_0x39b158[_0x33a4('0x8')]||_0x567324[_0x33a4('0x8')]){if(!_0x567324[_0x33a4('0x12')]){if(_0x567324['data1']==_0x757e6a){GRAY_PERIOD_REASON=_0x33a4('0x15');logger['info'](_0x33a4('0x16'));}else{GRAY_PERIOD_REASON=_0x33a4('0x17');logger[_0x33a4('0x13')](_0x33a4('0x18'),_0x567324[_0x33a4('0x10')],_0x757e6a);}logger['info'](_0x33a4('0x19'),GRAY_PERIOD_REASON[_0x33a4('0x1a')](),moment()['format'](_0x33a4('0x1b')));return _0x39f0eb[_0x33a4('0x1c')]({'data2':encryptor[_0x33a4('0x1d')](moment()[_0x33a4('0x9')](_0x33a4('0x1b')))});}else{if(moment()[_0x33a4('0x1e')](encryptor[_0x33a4('0x1f')](_0x567324[_0x33a4('0x12')]),_0x33a4('0x20'))>DAYS){logger[_0x33a4('0x13')](_0x33a4('0x21'),moment()['format'](_0x33a4('0x1b')));isOldTokenSent=![];return _0x39f0eb['update']({'data1':_0x757e6a,'data2':null,'license':null});}}}else{if(_0x567324[_0x33a4('0x10')]!=_0x757e6a){logger['info'](_0x33a4('0x18'),_0x567324[_0x33a4('0x10')],_0x757e6a);return _0x39f0eb[_0x33a4('0x1c')]({'data1':_0x757e6a,'data2':null,'license':null});}}}return _0x39f0eb;})[_0x33a4('0xe')](function(_0x1843ac){_0x39f0eb=_0x1843ac;})[_0x33a4('0xf')](function(_0x1ed03d){logger['error'](_0x1ed03d['message']);})[_0x33a4('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x33a4('0x23')](),_0x39f0eb);},TIME);});}function defaultLicense(){var _0x826e4d=hardware['getUuid']();if(_0x826e4d){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x826e4d}})[_0x33a4('0x24')](function(_0x18d183,_0x4f7cb8){logger[_0x33a4('0x13')](_0x33a4('0x25'),_0x826e4d);manageLicense(_0x826e4d,_0x18d183);})['catch'](function(_0x397f4d){logger[_0x33a4('0x26')](_0x397f4d[_0x33a4('0x27')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a32f269..c3eecfc 100644 --- a/server/config/license/util.js +++ b/server/config/license/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefce=['parse','demo','uuid','gray','deadline','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','then','catch','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s'];(function(_0x403b7c,_0x5d1d4d){var _0x34e519=function(_0x96866b){while(--_0x96866b){_0x403b7c['push'](_0x403b7c['shift']());}};_0x34e519(++_0x5d1d4d);}(_0xefce,0x10d));var _0xeefc=function(_0x348860,_0x4531f6){_0x348860=_0x348860-0x0;var _0x2fc2ad=_0xefce[_0x348860];return _0x2fc2ad;};'use strict';var util=require(_0xeefc('0x0'));var _=require(_0xeefc('0x1'));var moment=require('moment');var BPromise=require(_0xeefc('0x2'));var hardware=require(_0xeefc('0x3'));var encryptor=require(_0xeefc('0x4'));var db=require(_0xeefc('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xeefc('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xeefc('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xeefc('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xeefc('0x8'),'machineUuid':hardware[_0xeefc('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4d761a){return new BPromise(function(_0x524452,_0x4c02bc){return db['License'][_0xeefc('0x9')](_['defaults'](_0x4d761a,{'raw':!![],'where':{'id':0x1}}))[_0xeefc('0xa')](function(_0x5b04f4){return checkLicense(_0x5b04f4,null);})['then'](function(_0x24e78d){_0x524452(_0x24e78d);return;})[_0xeefc('0xb')](function(_0x5f15ad){_0x4c02bc(_0x5f15ad);});});}function checkLicense(_0x381387,_0x4df8fe){if(!_0x381387){demoLicense['uuid']=_0x381387[_0xeefc('0xc')];return demoLicense;}try{var _0x16d6c6=_0x4df8fe||_0x381387['license'];if(_[_0xeefc('0xd')](_0x16d6c6)){throw new Error(_0xeefc('0xe'));}var _0x5a52e6=_0x381387['data1'];var _0x4d98c0=_0x381387['data2'];var _0x14eb56=_0x5a52e6[_0xeefc('0xf')]('-')[0x4];var _0x4f7aff=_0x5a52e6[_0xeefc('0xf')]('-')[0x0];var _0x50f7d2=encryptor[_0xeefc('0x10')](_0x16d6c6,util[_0xeefc('0x11')](_0xeefc('0x12'),_0x14eb56,_0x5a52e6,_0x4f7aff));var _0x19601d=JSON[_0xeefc('0x13')](_0x50f7d2);_0x19601d[_0xeefc('0x14')]=![];_0x19601d[_0xeefc('0x15')]=_0x5a52e6;_0x19601d['machineUuid']=hardware[_0xeefc('0x7')]();if(_0x4d98c0){var _0x56b5b7=encryptor['decryptString'](_0x4d98c0);_0x19601d[_0xeefc('0x16')]=_0x56b5b7;_0x19601d[_0xeefc('0x17')]=moment(_0x56b5b7)['add'](0x7,_0xeefc('0x18'))[_0xeefc('0x11')]();_0x19601d[_0xeefc('0x19')]=_0x19601d[_0xeefc('0x15')]!=_0x19601d[_0xeefc('0x1a')]?_0xeefc('0x1b'):_0xeefc('0x1c');}return _0x19601d;}catch(_0x23d55d){breakingLicense[_0xeefc('0x15')]=_0x381387['data1'];breakingLicense[_0xeefc('0x1d')]=_0x23d55d[_0xeefc('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4ca2ba,_0x3755f4){getLicense()[_0xeefc('0xa')](function(_0x5a1668){return db[_0xeefc('0x1e')][_0xeefc('0x1f')]({'attributes':[_0xeefc('0x20'),[db[_0xeefc('0x21')]['fn'](_0xeefc('0x22'),db['sequelize'][_0xeefc('0x23')](_0xeefc('0x20'))),_0xeefc('0x24')]],'group':'role','where':{'role':{'$or':[_0xeefc('0x25'),_0xeefc('0x26'),_0xeefc('0x27')]}},'raw':!![]})['then'](function(_0x5eb9ec){var _0x2941a8={'user':_0x5a1668[_0xeefc('0x28')]||0x0,'telephone':_0x5a1668[_0xeefc('0x29')]||0x0};_0x5eb9ec[_0xeefc('0x2a')](function(_0x1dbb48){var _0x162b57=_0x1dbb48[_0xeefc('0x20')]===_0xeefc('0x25')?_0xeefc('0x26'):_0x1dbb48['role'];_0x2941a8[_0x162b57]-=_0x1dbb48['count'];if(_0x2941a8[_0x162b57]<0x0)_0x2941a8[_0x162b57]=0x0;});_0x4ca2ba(_0x2941a8);return;});})[_0xeefc('0xb')](function(_0x59fbf8){_0x3755f4(_0x59fbf8);});});}function checkUserLimits(_0x2fa78f){return new BPromise(function(_0xbf8d0e,_0xf70503){getLimits()[_0xeefc('0xa')](function(_0x5d2694){var _0x3c0d9b=_[_0xeefc('0x2b')](_[_0xeefc('0x2c')](_0x2fa78f,_0xeefc('0x20')),[_0xeefc('0x25'),_0xeefc('0x26'),_0xeefc('0x27')]);var _0xf48f26=(_0x3c0d9b['admin']||0x0)+(_0x3c0d9b[_0xeefc('0x26')]||0x0);var _0x591bee=_0x3c0d9b[_0xeefc('0x27')]||0x0;if(_0xf48f26>_0x5d2694[_0xeefc('0x26')])return _0xf70503(_0xeefc('0x2d'));if(_0x591bee>_0x5d2694[_0xeefc('0x27')])return _0xf70503(_0xeefc('0x2e'));return _0xbf8d0e();})[_0xeefc('0xb')](function(_0x4b3a1f){_0xf70503(_0x4b3a1f);});});}module[_0xeefc('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x572a=['message','User','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','gray','add','days','grayReason','machineUuid','changed'];(function(_0x33925b,_0x95cfc6){var _0x375e21=function(_0x57c759){while(--_0x57c759){_0x33925b['push'](_0x33925b['shift']());}};_0x375e21(++_0x95cfc6);}(_0x572a,0x193));var _0xa572=function(_0xa383de,_0x147a59){_0xa383de=_0xa383de-0x0;var _0x508421=_0x572a[_0xa383de];return _0x508421;};'use strict';var util=require(_0xa572('0x0'));var _=require(_0xa572('0x1'));var moment=require('moment');var BPromise=require(_0xa572('0x2'));var hardware=require('./hardware');var encryptor=require(_0xa572('0x3'));var db=require(_0xa572('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa572('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa572('0x6'),'machineUuid':hardware[_0xa572('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xa572('0x8'),'machineUuid':hardware[_0xa572('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x54bf1e){return new BPromise(function(_0x5f08a4,_0x172bf5){return db[_0xa572('0x9')][_0xa572('0xa')](_[_0xa572('0xb')](_0x54bf1e,{'raw':!![],'where':{'id':0x1}}))[_0xa572('0xc')](function(_0x589a01){return checkLicense(_0x589a01,null);})[_0xa572('0xc')](function(_0xa2593c){_0x5f08a4(_0xa2593c);return;})['catch'](function(_0x56c2c8){_0x172bf5(_0x56c2c8);});});}function checkLicense(_0x1553b2,_0x129283){if(!_0x1553b2){demoLicense[_0xa572('0xd')]=_0x1553b2[_0xa572('0xe')];return demoLicense;}try{var _0x180b83=_0x129283||_0x1553b2['license'];if(_[_0xa572('0xf')](_0x180b83)){throw new Error(_0xa572('0x10'));}var _0x4a6c11=_0x1553b2[_0xa572('0xe')];var _0x476032=_0x1553b2[_0xa572('0x11')];var _0xceac4=_0x4a6c11[_0xa572('0x12')]('-')[0x4];var _0x17cf24=_0x4a6c11[_0xa572('0x12')]('-')[0x0];var _0x32fc27=encryptor[_0xa572('0x13')](_0x180b83,util[_0xa572('0x14')]('%s:%s:%s',_0xceac4,_0x4a6c11,_0x17cf24));var _0x50f9b2=JSON[_0xa572('0x15')](_0x32fc27);_0x50f9b2[_0xa572('0x16')]=![];_0x50f9b2[_0xa572('0xd')]=_0x4a6c11;_0x50f9b2['machineUuid']=hardware[_0xa572('0x7')]();if(_0x476032){var _0x3dea88=encryptor[_0xa572('0x13')](_0x476032);_0x50f9b2[_0xa572('0x17')]=_0x3dea88;_0x50f9b2['deadline']=moment(_0x3dea88)[_0xa572('0x18')](0x7,_0xa572('0x19'))[_0xa572('0x14')]();_0x50f9b2[_0xa572('0x1a')]=_0x50f9b2[_0xa572('0xd')]!=_0x50f9b2[_0xa572('0x1b')]?_0xa572('0x1c'):'disabled';}return _0x50f9b2;}catch(_0x7d9814){breakingLicense[_0xa572('0xd')]=_0x1553b2['data1'];breakingLicense[_0xa572('0x1d')]=_0x7d9814[_0xa572('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x12a65,_0x5133b6){getLicense()[_0xa572('0xc')](function(_0x13116c){return db[_0xa572('0x1e')]['findAll']({'attributes':[_0xa572('0x1f'),[db[_0xa572('0x20')]['fn'](_0xa572('0x21'),db['sequelize'][_0xa572('0x22')](_0xa572('0x1f'))),_0xa572('0x23')]],'group':'role','where':{'role':{'$or':[_0xa572('0x24'),_0xa572('0x25'),_0xa572('0x26')]}},'raw':!![]})[_0xa572('0xc')](function(_0x5f4184){var _0x3066d2={'user':_0x13116c[_0xa572('0x27')]||0x0,'telephone':_0x13116c[_0xa572('0x28')]||0x0};_0x5f4184[_0xa572('0x29')](function(_0x113b86){var _0x7f21c4=_0x113b86['role']===_0xa572('0x24')?_0xa572('0x25'):_0x113b86[_0xa572('0x1f')];_0x3066d2[_0x7f21c4]-=_0x113b86[_0xa572('0x23')];if(_0x3066d2[_0x7f21c4]<0x0)_0x3066d2[_0x7f21c4]=0x0;});_0x12a65(_0x3066d2);return;});})[_0xa572('0x2a')](function(_0x3cf390){_0x5133b6(_0x3cf390);});});}function checkUserLimits(_0x3a6ad1){return new BPromise(function(_0x599834,_0x27231e){getLimits()[_0xa572('0xc')](function(_0x1d1185){var _0x399774=_[_0xa572('0x2b')](_[_0xa572('0x2c')](_0x3a6ad1,_0xa572('0x1f')),[_0xa572('0x24'),_0xa572('0x25'),'telephone']);var _0x5082b4=(_0x399774['admin']||0x0)+(_0x399774[_0xa572('0x25')]||0x0);var _0xb26d6f=_0x399774[_0xa572('0x26')]||0x0;if(_0x5082b4>_0x1d1185['user'])return _0x27231e(_0xa572('0x2d'));if(_0xb26d6f>_0x1d1185['telephone'])return _0x27231e(_0xa572('0x2e'));return _0x599834();})[_0xa572('0x2a')](function(_0x100778){_0x27231e(_0x100778);});});}module[_0xa572('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index af97207..d1f8d60 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea28=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x2a7dc6,_0x18a639){var _0x37d9c8=function(_0x4fafd0){while(--_0x4fafd0){_0x2a7dc6['push'](_0x2a7dc6['shift']());}};_0x37d9c8(++_0x18a639);}(_0xea28,0x13a));var _0x8ea2=function(_0xe3ca76,_0x171373){_0xe3ca76=_0xe3ca76-0x0;var _0x19e26f=_0xea28[_0xe3ca76];return _0x19e26f;};'use strict';module[_0x8ea2('0x0')]={'DOMAIN':_0x8ea2('0x1'),'SESSION_SECRET':_0x8ea2('0x2'),'GOOGLE_ID':_0x8ea2('0x3'),'GOOGLE_SECRET':_0x8ea2('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xfcbb=['http://localhost:9000','myappanuglar-secret','exports'];(function(_0x5b89c7,_0x22994c){var _0x332b50=function(_0x2afacc){while(--_0x2afacc){_0x5b89c7['push'](_0x5b89c7['shift']());}};_0x332b50(++_0x22994c);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x2bc527,_0x54af53){_0x2bc527=_0x2bc527-0x0;var _0x53f1ab=_0xfcbb[_0x2bc527];return _0x53f1ab;};'use strict';module[_0xbfcb('0x0')]={'DOMAIN':_0xbfcb('0x1'),'SESSION_SECRET':_0xbfcb('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 10e5ae9..f52c91f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f9c=['../utils/loggers','fileLogger'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x9f9c,0x18c));var _0xc9f9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9f9c[_0x3e5086];return _0xfeb102;};'use strict';var fileLogger=require(_0xc9f9('0x0'))[_0xc9f9('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x3caa=['exports','../utils/loggers','fileLogger'];(function(_0x104563,_0x14e611){var _0x52d11b=function(_0x4023a0){while(--_0x4023a0){_0x104563['push'](_0x104563['shift']());}};_0x52d11b(++_0x14e611);}(_0x3caa,0x11b));var _0xa3ca=function(_0x1a9a57,_0x3ef1d3){_0x1a9a57=_0x1a9a57-0x0;var _0x13c9b0=_0x3caa[_0x1a9a57];return _0x13c9b0;};'use strict';var fileLogger=require(_0xa3ca('0x0'))[_0xa3ca('0x1')];module[_0xa3ca('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 4c76cf2..9b228e7 100644 --- a/server/config/pm2/config.js +++ b/server/config/pm2/config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x514f=['path','../../config/environment','resolve','join','root','legacy-libs','express','ami','../../services/ami/index.js','agi','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x2ea0eb,_0xa8327c){var _0x232df1=function(_0x16167b){while(--_0x16167b){_0x2ea0eb['push'](_0x2ea0eb['shift']());}};_0x232df1(++_0xa8327c);}(_0x514f,0x120));var _0xf514=function(_0x5f418c,_0x470146){_0x5f418c=_0x5f418c-0x0;var _0x3681eb=_0x514f[_0x5f418c];return _0x3681eb;};'use strict';var path=require(_0xf514('0x0'));var cfg=require(_0xf514('0x1'));var env={'NODE_PATH':path[_0xf514('0x2')](path[_0xf514('0x3')](cfg[_0xf514('0x4')],_0xf514('0x5')))};var pm2config={'apps':[{'name':_0xf514('0x6'),'script':path[_0xf514('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xf514('0x7'),'script':path[_0xf514('0x3')](__dirname,_0xf514('0x8')),'env':env},{'name':_0xf514('0x9'),'script':path[_0xf514('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0xf514('0x3')](__dirname,_0xf514('0xa')),'env':env},{'name':_0xf514('0xb'),'script':path[_0xf514('0x3')](__dirname,_0xf514('0xc')),'env':env},{'name':_0xf514('0xd'),'script':path['join'](__dirname,_0xf514('0xe')),'env':env}]};module[_0xf514('0xf')]=pm2config; \ No newline at end of file +var _0xcf7e=['../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','resolve','join','root','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email'];(function(_0x25b9d5,_0x2222da){var _0x7898ad=function(_0x5611c6){while(--_0x5611c6){_0x25b9d5['push'](_0x25b9d5['shift']());}};_0x7898ad(++_0x2222da);}(_0xcf7e,0x18b));var _0xecf7=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xcf7e[_0x1d9aa0];return _0x226868;};'use strict';var path=require(_0xecf7('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xecf7('0x1')](path[_0xecf7('0x2')](cfg[_0xecf7('0x3')],_0xecf7('0x4')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0xecf7('0x5')),'env':env},{'name':_0xecf7('0x6'),'script':path[_0xecf7('0x2')](__dirname,_0xecf7('0x7')),'env':env},{'name':'agi','script':path[_0xecf7('0x2')](__dirname,_0xecf7('0x8')),'env':env},{'name':_0xecf7('0x9'),'script':path['join'](__dirname,_0xecf7('0xa')),'env':env},{'name':_0xecf7('0xb'),'script':path['join'](__dirname,_0xecf7('0xc')),'env':env},{'name':_0xecf7('0xd'),'script':path[_0xecf7('0x2')](__dirname,_0xecf7('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6f93c10..2b2d4e9 100644 --- a/server/config/pm2/index.js +++ b/server/config/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x925b=['connect','connected','start','then','stop','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0x925b,0xec));var _0xb925=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x925b[_0x3e3bee];return _0x3ae14c;};'use strict';var pm2=require(_0xb925('0x0'));var BPromise=require(_0xb925('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x297fab,_0x49567d){return pm2[_0xb925('0x2')](function(_0x3cec33){if(_0x3cec33){return _0x49567d(_0x3cec33);}return _0x297fab(_0xb925('0x3'));});});};exports[_0xb925('0x4')]=function(_0x1d04dc){return connect()[_0xb925('0x5')](function(){return new BPromise(function(_0xb4d163,_0x4d961e){return pm2[_0xb925('0x4')](_0x1d04dc,function(_0x116ee9,_0x5b3eda){if(_0x116ee9){return _0x4d961e(_0x116ee9);}pm2['disconnect']();return _0xb4d163(_0x5b3eda);});});});};exports[_0xb925('0x6')]=function(_0x187f38){return connect()[_0xb925('0x5')](function(){return new BPromise(function(_0x5b3d07,_0x2c03b2){return pm2['stop'](_0x187f38,function(_0x420c93,_0x5be526){if(_0x420c93){return _0x2c03b2(_0x420c93);}pm2[_0xb925('0x7')]();return _0x5b3d07(_0x5be526);});});});};exports[_0xb925('0x8')]=function(_0xa3cee){return connect()[_0xb925('0x5')](function(){return new BPromise(function(_0x263388,_0x3a5e2a){return pm2[_0xb925('0x8')](_0xa3cee,function(_0x57dd53,_0x4d0ea9){if(_0x57dd53){return _0x3a5e2a(_0x57dd53);}pm2[_0xb925('0x7')]();return _0x263388(_0x4d0ea9);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x3cbae9,_0x3fba60){return pm2[_0xb925('0x9')](function(_0x59ff2e,_0x25297d){if(_0x59ff2e){return _0x3fba60(_0x59ff2e);}pm2[_0xb925('0x7')]();return _0x3cbae9(_0x25297d);});});});};exports[_0xb925('0xa')]=function(_0x1c6583){return connect()['then'](function(){return new BPromise(function(_0x63c7c3,_0x3fe487){return pm2['describe'](_0x1c6583,function(_0x5d80b3,_0xc41ae1){if(_0x5d80b3){return _0x3fe487(_0x5d80b3);}pm2[_0xb925('0x7')]();return _0x63c7c3(_0xc41ae1);});});});};exports['delete']=function(_0x16b6dd){return connect()[_0xb925('0x5')](function(){return new BPromise(function(_0x4c5c97,_0x6b62c0){return pm2[_0xb925('0xb')](_0x16b6dd,function(_0x374ef3,_0x4d7077){if(_0x374ef3){return _0x6b62c0(_0x374ef3);}pm2[_0xb925('0x7')]();return _0x4c5c97(_0x4d7077);});});});};exports[_0xb925('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x183a6f,_0x32f938){return pm2[_0xb925('0xc')](function(_0x41c7bf){if(_0x41c7bf){return _0x32f938(_0x41c7bf);}return _0x183a6f(_0xb925('0xd'));});});});}; \ No newline at end of file +var _0xbcc8=['describe','delete','dump','saved','pm2','bluebird','./config','connect','start','disconnect','stop','restart','then','list'];(function(_0x18a6a6,_0x2141ff){var _0x4eaea2=function(_0x215282){while(--_0x215282){_0x18a6a6['push'](_0x18a6a6['shift']());}};_0x4eaea2(++_0x2141ff);}(_0xbcc8,0xd6));var _0x8bcc=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0xbcc8[_0x2e819c];return _0x24e271;};'use strict';var pm2=require(_0x8bcc('0x0'));var BPromise=require(_0x8bcc('0x1'));var config=require(_0x8bcc('0x2'));function connect(){return new BPromise(function(_0x453d85,_0x457c37){return pm2[_0x8bcc('0x3')](function(_0x3e8098){if(_0x3e8098){return _0x457c37(_0x3e8098);}return _0x453d85('connected');});});};exports[_0x8bcc('0x4')]=function(_0x754986){return connect()['then'](function(){return new BPromise(function(_0x1a32de,_0x2b8740){return pm2['start'](_0x754986,function(_0x4816ea,_0x1081ce){if(_0x4816ea){return _0x2b8740(_0x4816ea);}pm2[_0x8bcc('0x5')]();return _0x1a32de(_0x1081ce);});});});};exports[_0x8bcc('0x6')]=function(_0x5e30b9){return connect()['then'](function(){return new BPromise(function(_0x37ad09,_0x285edd){return pm2[_0x8bcc('0x6')](_0x5e30b9,function(_0x901036,_0x2a5ad9){if(_0x901036){return _0x285edd(_0x901036);}pm2[_0x8bcc('0x5')]();return _0x37ad09(_0x2a5ad9);});});});};exports[_0x8bcc('0x7')]=function(_0x5d9a2a){return connect()[_0x8bcc('0x8')](function(){return new BPromise(function(_0x898a35,_0x251375){return pm2[_0x8bcc('0x7')](_0x5d9a2a,function(_0x563a11,_0x5c2c15){if(_0x563a11){return _0x251375(_0x563a11);}pm2[_0x8bcc('0x5')]();return _0x898a35(_0x5c2c15);});});});};exports[_0x8bcc('0x9')]=function(){return connect()[_0x8bcc('0x8')](function(){return new BPromise(function(_0x40137a,_0x2f9068){return pm2[_0x8bcc('0x9')](function(_0x2649df,_0x4b07bf){if(_0x2649df){return _0x2f9068(_0x2649df);}pm2[_0x8bcc('0x5')]();return _0x40137a(_0x4b07bf);});});});};exports[_0x8bcc('0xa')]=function(_0x795f91){return connect()[_0x8bcc('0x8')](function(){return new BPromise(function(_0x1665b2,_0x132bad){return pm2[_0x8bcc('0xa')](_0x795f91,function(_0x12caa6,_0x1b6e9e){if(_0x12caa6){return _0x132bad(_0x12caa6);}pm2['disconnect']();return _0x1665b2(_0x1b6e9e);});});});};exports[_0x8bcc('0xb')]=function(_0xc4c29){return connect()[_0x8bcc('0x8')](function(){return new BPromise(function(_0x4c6192,_0x2c7283){return pm2[_0x8bcc('0xb')](_0xc4c29,function(_0x165586,_0x370154){if(_0x165586){return _0x2c7283(_0x165586);}pm2[_0x8bcc('0x5')]();return _0x4c6192(_0x370154);});});});};exports[_0x8bcc('0xc')]=function(){return connect()[_0x8bcc('0x8')](function(){return new BPromise(function(_0x146ce4,_0x1cdf21){return pm2[_0x8bcc('0xc')](function(_0x29c304){if(_0x29c304){return _0x1cdf21(_0x29c304);}return _0x146ce4(_0x8bcc('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 4447421..8fb708e 100644 --- a/server/config/schedule/chat.js +++ b/server/config/schedule/chat.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf45=['info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','ioredis','../../config/environment','redis','defaults','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','then','length','map'];(function(_0x26f518,_0x5a6c2d){var _0x3666d=function(_0x38ef7f){while(--_0x38ef7f){_0x26f518['push'](_0x26f518['shift']());}};_0x3666d(++_0x5a6c2d);}(_0xdf45,0x79));var _0x5df4=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0xdf45[_0x1b91c7];return _0xbbe014;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x5df4('0x0'));var util=require('util');var config=require(_0x5df4('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0x5df4('0x2')]=_[_0x5df4('0x3')](config[_0x5df4('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5df4('0x2')]));function closeInteractions(){var _0x46c767=0x0;var _0x54df6f=[];return db[_0x5df4('0x4')][_0x5df4('0x5')]({'raw':!![],'attributes':['id',_0x5df4('0x6')],'where':{'id':0x1}})['then'](function(_0x2dd9c8){_0x46c767=_0x2dd9c8['chatTimeout'];if(_0x46c767){return db[_0x5df4('0x7')]['findAll']({'raw':!![],'attributes':['id',_0x5df4('0x8')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5df4('0x9')](_0x2dd9c8['chatTimeout'],_0x5df4('0xa'))}}});}else{return[];}})[_0x5df4('0xb')](function(_0x63fb4d){if(_0x63fb4d&&_0x63fb4d[_0x5df4('0xc')]){_0x54df6f=_[_0x5df4('0xd')](_0x63fb4d||[],'id');logger[_0x5df4('0xe')](_0x5df4('0xf'),_0x54df6f[_0x5df4('0x10')]());return db[_0x5df4('0x7')][_0x5df4('0x11')]({'closeReason':_0x5df4('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x5df4('0x13')](_0x5df4('0x14'))},{'where':{'id':_0x54df6f}});}})['then'](function(){if(_0x54df6f&&_0x54df6f[_0x5df4('0xc')]){logger[_0x5df4('0xe')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x54df6f['join']());for(var _0x42443c=0x0;_0x42443c<_0x54df6f[_0x5df4('0xc')];_0x42443c++){io[_0x5df4('0x15')](_0x5df4('0x16'),{'id':_0x54df6f[_0x42443c],'closed':!![]});}}})['catch'](function(_0x5eac01){logger[_0x5df4('0x17')](_0x5df4('0x18'),_0x5eac01?util[_0x5df4('0x19')](_0x5eac01,{'showHidden':![],'depth':null}):'');});}exports[_0x5df4('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x653c=['localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','lodash','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis'];(function(_0x135bf9,_0x119e39){var _0xac3247=function(_0x1ca227){while(--_0x1ca227){_0x135bf9['push'](_0x135bf9['shift']());}};_0xac3247(++_0x119e39);}(_0x653c,0xac));var _0xc653=function(_0x3edd38,_0x2ef02d){_0x3edd38=_0x3edd38-0x0;var _0x20926b=_0x653c[_0x3edd38];return _0x20926b;};'use strict';var _=require(_0xc653('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xc653('0x1'));var config=require(_0xc653('0x2'));var db=require(_0xc653('0x3'))['db'];var logger=require(_0xc653('0x4'))(_0xc653('0x5'));config['redis']=_[_0xc653('0x6')](config[_0xc653('0x7')],{'host':_0xc653('0x8'),'port':0x18eb});var io=require(_0xc653('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x18add1=0x0;var _0x45b6d5=[];return db[_0xc653('0xa')][_0xc653('0xb')]({'raw':!![],'attributes':['id',_0xc653('0xc')],'where':{'id':0x1}})[_0xc653('0xd')](function(_0x3b9954){_0x18add1=_0x3b9954[_0xc653('0xc')];if(_0x18add1){return db[_0xc653('0xe')][_0xc653('0xf')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3b9954[_0xc653('0xc')],_0xc653('0x10'))}}});}else{return[];}})[_0xc653('0xd')](function(_0x15e9ea){if(_0x15e9ea&&_0x15e9ea['length']){_0x45b6d5=_[_0xc653('0x11')](_0x15e9ea||[],'id');logger[_0xc653('0x12')](_0xc653('0x13'),_0x45b6d5[_0xc653('0x14')]());return db[_0xc653('0xe')][_0xc653('0x15')]({'closeReason':'system','disposition':_0xc653('0x16'),'closed':!![],'closedAt':moment()[_0xc653('0x17')](_0xc653('0x18'))},{'where':{'id':_0x45b6d5}});}})[_0xc653('0xd')](function(){if(_0x45b6d5&&_0x45b6d5[_0xc653('0x19')]){logger[_0xc653('0x12')](_0xc653('0x1a'),_0x45b6d5[_0xc653('0x14')]());for(var _0x2db22d=0x0;_0x2db22d<_0x45b6d5[_0xc653('0x19')];_0x2db22d++){io[_0xc653('0x1b')]('chatInteraction:update',{'id':_0x45b6d5[_0x2db22d],'closed':!![]});}}})[_0xc653('0x1c')](function(_0x4b228b){logger[_0xc653('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x4b228b?util['inspect'](_0x4b228b,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 4be9665..5a36d9a 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd466=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x4ed546,_0x244bd0){var _0x10bfcc=function(_0x2e2caa){while(--_0x2e2caa){_0x4ed546['push'](_0x4ed546['shift']());}};_0x10bfcc(++_0x244bd0);}(_0xd466,0x1a8));var _0x6d46=function(_0x3881a5,_0x1f0d08){_0x3881a5=_0x3881a5-0x0;var _0xea1dff=_0xd466[_0x3881a5];return _0xea1dff;};'use strict';function start(){var _0xd7f3d9=require(_0x6d46('0x0'));return _0xd7f3d9[_0x6d46('0x1')]();}module[_0x6d46('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x9786=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x255c7e,_0x1260e4){var _0xd82dfd=function(_0x3f73df){while(--_0x3f73df){_0x255c7e['push'](_0x255c7e['shift']());}};_0xd82dfd(++_0x1260e4);}(_0x9786,0xc2));var _0x6978=function(_0x122903,_0x18737a){_0x122903=_0x122903-0x0;var _0x224427=_0x9786[_0x122903];return _0x224427;};'use strict';function start(){var _0x32e5a9=require(_0x6978('0x0'));return _0x32e5a9[_0x6978('0x1')]();}module[_0x6978('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index ecb20b8..42f8751 100644 --- a/server/config/schedule/index.js +++ b/server/config/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d0f=['moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','intersection','difference','exists','deleteJob','toRun','length','index','my\x20id','resolve','run\x20job','cron','isBetween','endAt','add','add\x20cron','stop','stop\x20cron','active','update','update\x20cron','run','start','util','path'];(function(_0x13d78f,_0x58e3e7){var _0x31c4fb=function(_0x1356c7){while(--_0x1356c7){_0x13d78f['push'](_0x13d78f['shift']());}};_0x31c4fb(++_0x58e3e7);}(_0x0d0f,0x166));var _0xf0d0=function(_0x51cc75,_0x7f40c3){_0x51cc75=_0x51cc75-0x0;var _0x3c3111=_0x0d0f[_0x51cc75];return _0x3c3111;};'use strict';var fs=require('fs');var util=require(_0xf0d0('0x0'));var path=require(_0xf0d0('0x1'));var _=require('lodash');var moment=require(_0xf0d0('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xf0d0('0x3'));var BPromise=require(_0xf0d0('0x4'));var logger=require(_0xf0d0('0x5'))(_0xf0d0('0x6'));var db=require(_0xf0d0('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xf0d0('0x8'));var client=jayson['client'][_0xf0d0('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4a3213,_0x51c6f9){return function(){logger[_0xf0d0('0xa')](_0xf0d0('0xb'),_0x4a3213[_0xf0d0('0xc')]);var _0x4a09e8=!![];var _0x394ace=_0x4a3213[_0xf0d0('0xd')][_0xf0d0('0xe')]();var _0x45a373={'account':_0x394ace,'message':{'from':util[_0xf0d0('0xf')](_0xf0d0('0x10'),_0x4a3213[_0xf0d0('0xd')][_0xf0d0('0x11')],_0x4a3213[_0xf0d0('0xd')][_0xf0d0('0xc')]||_0x4a3213[_0xf0d0('0xd')][_0xf0d0('0x12')][_0xf0d0('0x13')]),'to':_0x4a3213[_0xf0d0('0xc')],'cc':_0x4a3213['cc'],'bcc':_0x4a3213[_0xf0d0('0x14')],'subject':util[_0xf0d0('0xf')](_0xf0d0('0x15'),_0x51c6f9[_0xf0d0('0x11')],_0x4a3213[_0xf0d0('0x16')],_0x4a3213[_0xf0d0('0x17')])}};var _0xc4ff00=path['join'](__dirname,'../../files/reports');var _0x11f0e2=_0x51c6f9[_0xf0d0('0x18')];var _0xa1d29f=util[_0xf0d0('0xf')](_0xf0d0('0x19'),path[_0xf0d0('0x1a')](_0x51c6f9['savename'],path[_0xf0d0('0x1b')](_0x51c6f9[_0xf0d0('0x18')])),_0xf0d0('0x1c'));var _0x2b6984=path[_0xf0d0('0x1d')](_0xc4ff00,_0x11f0e2);var _0xab6906=path[_0xf0d0('0x1d')](_0xc4ff00,_0xa1d29f);if(fs[_0xf0d0('0x1e')](_0x2b6984)){_0x51c6f9[_0xf0d0('0x1f')]=_0xf0d0('0x20');_0x45a373[_0xf0d0('0x21')][_0xf0d0('0x22')]=[{'filename':_0x11f0e2,'path':_0x2b6984}];_0x45a373[_0xf0d0('0x21')][_0xf0d0('0x23')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xf0d0('0x24')](_0x51c6f9,null,0x2));}else if(fs[_0xf0d0('0x1e')](_0xab6906)){_0x51c6f9[_0xf0d0('0x1f')]='Sent';_0x45a373['message'][_0xf0d0('0x22')]=[{'filename':_0xa1d29f,'path':_0xab6906}];}else{_0x45a373[_0xf0d0('0x21')][_0xf0d0('0x23')]=_0xf0d0('0x25');if(!_0x4a3213[_0xf0d0('0x26')]){_0x4a09e8=![];logger[_0xf0d0('0xa')](_0xf0d0('0x27'));}}if(_0x4a09e8){return client[_0xf0d0('0x28')](_0xf0d0('0x29'),_0x45a373)['then'](function(_0x530cb6){if(_0x530cb6[_0xf0d0('0x2a')]){return logger['error'](_0xf0d0('0x2b'),JSON['stringify'](_0x530cb6));}return logger[_0xf0d0('0xa')](_0xf0d0('0x2c'));})[_0xf0d0('0x2d')](function(_0x31e69a){return logger[_0xf0d0('0x2a')](_0xf0d0('0x2b'),JSON[_0xf0d0('0x24')](_0x31e69a));});}};}function handleError(){return function(_0x36b76d){return logger[_0xf0d0('0x2a')](JSON[_0xf0d0('0x24')](_0x36b76d));};}function handleResult(_0xd9e167){return function(_0x2ff535){logger[_0xf0d0('0xa')](_0xf0d0('0x2e'),JSON['stringify'](_0x2ff535));if(_0xd9e167['MailAccount']&&_0xd9e167[_0xf0d0('0xd')]['Smtp']&&!_[_0xf0d0('0x2f')](_0xd9e167['email'])){setTimeout(handleSendEmail(_0xd9e167,_0x2ff535),0x3c*0x3e8);}};}function handleJob(_0x5a67e2){return function(){try{if(_['isNil'](_0x5a67e2[_0xf0d0('0x16')])){return logger[_0xf0d0('0xa')](_0xf0d0('0x30'));}if(_['isNil'](_0x5a67e2[_0xf0d0('0x17')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x2d1bb6={'startDate':moment()[_0xf0d0('0x31')](_0x5a67e2[_0xf0d0('0x16')],_0x5a67e2[_0xf0d0('0x17')])[_0xf0d0('0xf')](_0xf0d0('0x32')),'endDate':moment()[_0xf0d0('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x5a67e2[_0xf0d0('0x33')],'name':_0x5a67e2['name']};if(!_[_0xf0d0('0x2f')](_0x5a67e2[_0xf0d0('0x34')])){logger[_0xf0d0('0xa')](_0xf0d0('0x35'),_0x5a67e2[_0xf0d0('0x34')]);return analyticDefaultReportController[_0xf0d0('0x36')]({'id':_0x5a67e2[_0xf0d0('0x34')]},_0x2d1bb6)[_0xf0d0('0x37')](handleResult(_0x5a67e2))['catch'](handleError());}if(!_[_0xf0d0('0x2f')](_0x5a67e2['CustomReportId'])){logger[_0xf0d0('0xa')](_0xf0d0('0x38'),_0x5a67e2[_0xf0d0('0x39')]);return analyticCustomReportController[_0xf0d0('0x36')]({'id':_0x5a67e2[_0xf0d0('0x39')]},_0x2d1bb6)[_0xf0d0('0x37')](handleResult(_0x5a67e2))[_0xf0d0('0x2d')](handleError());}}catch(_0x264180){logger['error'](JSON['stringify'](_0x264180));}return logger[_0xf0d0('0xa')](_0xf0d0('0x3a'));};}function getJobs(_0x2e43d6){var _0x484414={};if(_0x2e43d6){_0x484414['id']=_0x2e43d6;}return db[_0xf0d0('0x3b')][_0xf0d0('0x3c')]({'where':_0x484414,'include':[{'model':db[_0xf0d0('0xd')],'attributes':['id','name',_0xf0d0('0xc')],'include':[{'model':db[_0xf0d0('0x3d')],'as':_0xf0d0('0x12'),'include':[{'model':db[_0xf0d0('0x3e')],'as':_0xf0d0('0x3e')}]}]}]})['then'](function(_0x3f8b25){var _0x125125=_[_0xf0d0('0x3f')](manager[_0xf0d0('0x40')]);var _0x3d0cb8=_[_0xf0d0('0x41')](_0x3f8b25,function(_0xaed01d){return _0xaed01d['id'][_0xf0d0('0x42')]();});var _0x2fdc14=_[_0xf0d0('0x43')](_0x3f8b25,function(_0x51b598){return _0x51b598['id'][_0xf0d0('0x42')]();});var _0x318c33=_0x2e43d6?_0x3d0cb8:_['difference'](_0x3d0cb8,_0x125125);var _0x3b7e0c=_[_0xf0d0('0x44')](_0x3d0cb8,_0x125125);var _0x1b1e90=_[_0xf0d0('0x45')](_0x125125,_0x3d0cb8);var _0x4291f3;var _0x2b32a3;for(_0x4291f3=0x0;_0x4291f3<_0x1b1e90['length']&&!_0x2e43d6;_0x4291f3+=0x1){_0x2b32a3=_0x1b1e90[_0x4291f3][_0xf0d0('0x42')]();if(manager[_0xf0d0('0x46')](_0x2b32a3)){manager['stop'](_0x2b32a3);manager[_0xf0d0('0x47')](_0x2b32a3);logger[_0xf0d0('0xa')]('delete\x20cron',_0x2b32a3);}}logger[_0xf0d0('0xa')](_0xf0d0('0x48'),JSON[_0xf0d0('0x24')](_0x318c33));for(_0x4291f3=0x0;_0x4291f3<_0x318c33[_0xf0d0('0x49')];_0x4291f3+=0x1){_0x2b32a3=_0x318c33[_0x4291f3][_0xf0d0('0x42')]();logger[_0xf0d0('0xa')](_0xf0d0('0x4a'),_0x2b32a3);if(_0x2e43d6){logger['info'](_0xf0d0('0x4b'),_0x2e43d6);logger['info'](JSON[_0xf0d0('0x24')](_0x2fdc14[_0x2b32a3]));BPromise[_0xf0d0('0x4c')]()[_0xf0d0('0x37')](handleJob(_0x2fdc14[_0x2b32a3]));logger[_0xf0d0('0xa')](_0xf0d0('0x4d'),_0x2fdc14[_0x2b32a3][_0xf0d0('0x11')],_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')]);}else if(_0x2fdc14[_0x2b32a3]['cron']&&_0x2fdc14[_0x2b32a3]['active']&&moment()[_0xf0d0('0x4f')](_0x2fdc14[_0x2b32a3]['startAt'],_0x2fdc14[_0x2b32a3][_0xf0d0('0x50')])){manager[_0xf0d0('0x51')](_0x2b32a3,_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')],handleJob(_0x2fdc14[_0x2b32a3]));manager['start'](_0x2b32a3);logger['info'](_0xf0d0('0x52'),_0x2fdc14[_0x2b32a3][_0xf0d0('0x11')],_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')]);}else if(manager['exists'](_0x2b32a3)){manager[_0xf0d0('0x53')](_0x2b32a3);manager['deleteJob'](_0x2b32a3);logger[_0xf0d0('0xa')](_0xf0d0('0x54'),_0x2fdc14[_0x2b32a3]['name'],_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')]);}}for(_0x4291f3=0x0,_0x2b32a3;_0x4291f3<_0x3b7e0c['length']&&!_0x2e43d6;_0x4291f3+=0x1){_0x2b32a3=_0x3b7e0c[_0x4291f3][_0xf0d0('0x42')]();if(manager[_0xf0d0('0x46')](_0x2b32a3)){if(_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')]&&_0x2fdc14[_0x2b32a3][_0xf0d0('0x55')]&&moment()[_0xf0d0('0x4f')](_0x2fdc14[_0x2b32a3]['startAt'],_0x2fdc14[_0x2b32a3][_0xf0d0('0x50')])){manager[_0xf0d0('0x56')](_0x2b32a3,_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')],handleJob(_0x2fdc14[_0x2b32a3]));logger[_0xf0d0('0xa')](_0xf0d0('0x57'),_0x2fdc14[_0x2b32a3]['name'],_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')]);}else{manager[_0xf0d0('0x53')](_0x2b32a3);manager[_0xf0d0('0x47')](_0x2b32a3);logger[_0xf0d0('0xa')](_0xf0d0('0x54'),_0x2fdc14[_0x2b32a3][_0xf0d0('0x11')],_0x2fdc14[_0x2b32a3]['cron']);}}}})[_0xf0d0('0x2d')](function(_0x579ac0){logger[_0xf0d0('0x2a')](JSON[_0xf0d0('0x24')](_0x579ac0));});}exports[_0xf0d0('0x58')]=function(_0x14c076){return getJobs(_0x14c076);};exports[_0xf0d0('0x59')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0cc9=['findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','length','exists','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','stop','update\x20cron','stop\x20cron','catch','path','moment','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','../../files/reports','%s.%s','basename','savename','extname','zip','join','existsSync','message','text','stringify','Sent','attachments','sendIfEmpty','then','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0cc9,0x14e));var _0x90cc=function(_0x970068,_0x3e4142){_0x970068=_0x970068-0x0;var _0x51063d=_0x0cc9[_0x970068];return _0x51063d;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x90cc('0x0'));var _=require('lodash');var moment=require(_0x90cc('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../logger')(_0x90cc('0x2'));var db=require(_0x90cc('0x3'))['db'];var analyticCustomReportController=require(_0x90cc('0x4'));var analyticDefaultReportController=require(_0x90cc('0x5'));var client=jayson[_0x90cc('0x6')][_0x90cc('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x179990,_0x2da203){return function(){logger[_0x90cc('0x8')](_0x90cc('0x9'),_0x179990[_0x90cc('0xa')]);var _0x8cf317=!![];var _0x4292c6=_0x179990[_0x90cc('0xb')][_0x90cc('0xc')]();var _0x2690b9={'account':_0x4292c6,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x179990[_0x90cc('0xb')][_0x90cc('0xd')],_0x179990[_0x90cc('0xb')][_0x90cc('0xa')]||_0x179990[_0x90cc('0xb')][_0x90cc('0xe')][_0x90cc('0xf')]),'to':_0x179990[_0x90cc('0xa')],'cc':_0x179990['cc'],'bcc':_0x179990[_0x90cc('0x10')],'subject':util[_0x90cc('0x11')](_0x90cc('0x12'),_0x2da203[_0x90cc('0xd')],_0x179990['subtractNumber'],_0x179990['subtractUnit'])}};var _0xb56485=path['join'](__dirname,_0x90cc('0x13'));var _0x99d507=_0x2da203['savename'];var _0x5ecb58=util[_0x90cc('0x11')](_0x90cc('0x14'),path[_0x90cc('0x15')](_0x2da203[_0x90cc('0x16')],path[_0x90cc('0x17')](_0x2da203[_0x90cc('0x16')])),_0x90cc('0x18'));var _0x23b011=path[_0x90cc('0x19')](_0xb56485,_0x99d507);var _0x397bbc=path['join'](_0xb56485,_0x5ecb58);if(fs[_0x90cc('0x1a')](_0x23b011)){_0x2da203['status']='Sent';_0x2690b9[_0x90cc('0x1b')]['attachments']=[{'filename':_0x99d507,'path':_0x23b011}];_0x2690b9[_0x90cc('0x1b')][_0x90cc('0x1c')]=util[_0x90cc('0x11')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x90cc('0x1d')](_0x2da203,null,0x2));}else if(fs[_0x90cc('0x1a')](_0x397bbc)){_0x2da203['status']=_0x90cc('0x1e');_0x2690b9[_0x90cc('0x1b')][_0x90cc('0x1f')]=[{'filename':_0x5ecb58,'path':_0x397bbc}];}else{_0x2690b9[_0x90cc('0x1b')][_0x90cc('0x1c')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x179990[_0x90cc('0x20')]){_0x8cf317=![];logger[_0x90cc('0x8')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x8cf317){return client['request']('SendMail',_0x2690b9)[_0x90cc('0x21')](function(_0x11b6f5){if(_0x11b6f5[_0x90cc('0x22')]){return logger['error'](_0x90cc('0x23'),JSON['stringify'](_0x11b6f5));}return logger[_0x90cc('0x8')]('email\x20sent');})['catch'](function(_0x438875){return logger[_0x90cc('0x22')](_0x90cc('0x23'),JSON[_0x90cc('0x1d')](_0x438875));});}};}function handleError(){return function(_0x20f6ab){return logger[_0x90cc('0x22')](JSON['stringify'](_0x20f6ab));};}function handleResult(_0x2cf5d4){return function(_0x3f64f0){logger[_0x90cc('0x8')](_0x90cc('0x24'),JSON[_0x90cc('0x1d')](_0x3f64f0));if(_0x2cf5d4['MailAccount']&&_0x2cf5d4[_0x90cc('0xb')][_0x90cc('0xe')]&&!_[_0x90cc('0x25')](_0x2cf5d4[_0x90cc('0xa')])){setTimeout(handleSendEmail(_0x2cf5d4,_0x3f64f0),0x3c*0x3e8);}};}function handleJob(_0x35bac2){return function(){try{if(_[_0x90cc('0x25')](_0x35bac2['subtractNumber'])){return logger[_0x90cc('0x8')](_0x90cc('0x26'));}if(_['isNil'](_0x35bac2[_0x90cc('0x27')])){return logger[_0x90cc('0x8')](_0x90cc('0x28'));}var _0x549db1={'startDate':moment()[_0x90cc('0x29')](_0x35bac2[_0x90cc('0x2a')],_0x35bac2['subtractUnit'])['format'](_0x90cc('0x2b')),'endDate':moment()['format'](_0x90cc('0x2b')),'type':_0x90cc('0x2c'),'output':_0x35bac2['output'],'name':_0x35bac2['name']};if(!_[_0x90cc('0x25')](_0x35bac2[_0x90cc('0x2d')])){logger[_0x90cc('0x8')](_0x90cc('0x2e'),_0x35bac2[_0x90cc('0x2d')]);return analyticDefaultReportController[_0x90cc('0x2f')]({'id':_0x35bac2[_0x90cc('0x2d')]},_0x549db1)[_0x90cc('0x21')](handleResult(_0x35bac2))['catch'](handleError());}if(!_[_0x90cc('0x25')](_0x35bac2[_0x90cc('0x30')])){logger[_0x90cc('0x8')]('exec\x20custom\x20report\x20id:%s',_0x35bac2['CustomReportId']);return analyticCustomReportController[_0x90cc('0x2f')]({'id':_0x35bac2[_0x90cc('0x30')]},_0x549db1)[_0x90cc('0x21')](handleResult(_0x35bac2))['catch'](handleError());}}catch(_0x537daf){logger[_0x90cc('0x22')](JSON[_0x90cc('0x1d')](_0x537daf));}return logger['info'](_0x90cc('0x31'));};}function getJobs(_0x51e2f5){var _0x6c598a={};if(_0x51e2f5){_0x6c598a['id']=_0x51e2f5;}return db[_0x90cc('0x32')][_0x90cc('0x33')]({'where':_0x6c598a,'include':[{'model':db[_0x90cc('0xb')],'attributes':['id',_0x90cc('0xd'),_0x90cc('0xa')],'include':[{'model':db[_0x90cc('0x34')],'as':_0x90cc('0xe'),'include':[{'model':db[_0x90cc('0x35')],'as':_0x90cc('0x35')}]}]}]})[_0x90cc('0x21')](function(_0x9160f6){var _0x4a69f8=_[_0x90cc('0x36')](manager[_0x90cc('0x37')]);var _0x2f87ef=_[_0x90cc('0x38')](_0x9160f6,function(_0x20afce){return _0x20afce['id'][_0x90cc('0x39')]();});var _0x8cad1c=_[_0x90cc('0x3a')](_0x9160f6,function(_0x5644c7){return _0x5644c7['id']['toString']();});var _0x3cb1d8=_0x51e2f5?_0x2f87ef:_['difference'](_0x2f87ef,_0x4a69f8);var _0x5875bf=_['intersection'](_0x2f87ef,_0x4a69f8);var _0x235504=_['difference'](_0x4a69f8,_0x2f87ef);var _0x15ed91;var _0x56e6d8;for(_0x15ed91=0x0;_0x15ed91<_0x235504[_0x90cc('0x3b')]&&!_0x51e2f5;_0x15ed91+=0x1){_0x56e6d8=_0x235504[_0x15ed91][_0x90cc('0x39')]();if(manager[_0x90cc('0x3c')](_0x56e6d8)){manager['stop'](_0x56e6d8);manager[_0x90cc('0x3d')](_0x56e6d8);logger[_0x90cc('0x8')](_0x90cc('0x3e'),_0x56e6d8);}}logger[_0x90cc('0x8')](_0x90cc('0x3f'),JSON[_0x90cc('0x1d')](_0x3cb1d8));for(_0x15ed91=0x0;_0x15ed91<_0x3cb1d8['length'];_0x15ed91+=0x1){_0x56e6d8=_0x3cb1d8[_0x15ed91][_0x90cc('0x39')]();logger[_0x90cc('0x8')]('index',_0x56e6d8);if(_0x51e2f5){logger[_0x90cc('0x8')]('my\x20id',_0x51e2f5);logger[_0x90cc('0x8')](JSON[_0x90cc('0x1d')](_0x8cad1c[_0x56e6d8]));BPromise[_0x90cc('0x40')]()[_0x90cc('0x21')](handleJob(_0x8cad1c[_0x56e6d8]));logger['info'](_0x90cc('0x41'),_0x8cad1c[_0x56e6d8][_0x90cc('0xd')],_0x8cad1c[_0x56e6d8][_0x90cc('0x42')]);}else if(_0x8cad1c[_0x56e6d8]['cron']&&_0x8cad1c[_0x56e6d8][_0x90cc('0x43')]&&moment()[_0x90cc('0x44')](_0x8cad1c[_0x56e6d8][_0x90cc('0x45')],_0x8cad1c[_0x56e6d8][_0x90cc('0x46')])){manager[_0x90cc('0x47')](_0x56e6d8,_0x8cad1c[_0x56e6d8]['cron'],handleJob(_0x8cad1c[_0x56e6d8]));manager[_0x90cc('0x48')](_0x56e6d8);logger[_0x90cc('0x8')]('add\x20cron',_0x8cad1c[_0x56e6d8]['name'],_0x8cad1c[_0x56e6d8][_0x90cc('0x42')]);}else if(manager['exists'](_0x56e6d8)){manager[_0x90cc('0x49')](_0x56e6d8);manager[_0x90cc('0x3d')](_0x56e6d8);logger[_0x90cc('0x8')]('stop\x20cron',_0x8cad1c[_0x56e6d8][_0x90cc('0xd')],_0x8cad1c[_0x56e6d8][_0x90cc('0x42')]);}}for(_0x15ed91=0x0,_0x56e6d8;_0x15ed91<_0x5875bf['length']&&!_0x51e2f5;_0x15ed91+=0x1){_0x56e6d8=_0x5875bf[_0x15ed91][_0x90cc('0x39')]();if(manager[_0x90cc('0x3c')](_0x56e6d8)){if(_0x8cad1c[_0x56e6d8][_0x90cc('0x42')]&&_0x8cad1c[_0x56e6d8][_0x90cc('0x43')]&&moment()[_0x90cc('0x44')](_0x8cad1c[_0x56e6d8][_0x90cc('0x45')],_0x8cad1c[_0x56e6d8][_0x90cc('0x46')])){manager['update'](_0x56e6d8,_0x8cad1c[_0x56e6d8][_0x90cc('0x42')],handleJob(_0x8cad1c[_0x56e6d8]));logger[_0x90cc('0x8')](_0x90cc('0x4a'),_0x8cad1c[_0x56e6d8][_0x90cc('0xd')],_0x8cad1c[_0x56e6d8][_0x90cc('0x42')]);}else{manager[_0x90cc('0x49')](_0x56e6d8);manager[_0x90cc('0x3d')](_0x56e6d8);logger[_0x90cc('0x8')](_0x90cc('0x4b'),_0x8cad1c[_0x56e6d8][_0x90cc('0xd')],_0x8cad1c[_0x56e6d8][_0x90cc('0x42')]);}}}})[_0x90cc('0x4c')](function(_0x1478c5){logger[_0x90cc('0x22')](JSON[_0x90cc('0x1d')](_0x1478c5));});}exports['run']=function(_0x796fa9){return getJobs(_0x796fa9);};exports[_0x90cc('0x48')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index e21cb05..f835dd0 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1120=['getTranscriptionJob','detectSentiment','substring','format','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','bucket','fileText','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','language','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','push','lodash','aws-sdk','request-promise','transcribe','TranscribeService'];(function(_0x57d85d,_0x46e3ac){var _0x39be34=function(_0x2a3d47){while(--_0x2a3d47){_0x57d85d['push'](_0x57d85d['shift']());}};_0x39be34(++_0x46e3ac);}(_0x1120,0x140));var _0x0112=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0x1120[_0x1ca9e9];return _0x309f3c;};var _=require(_0x0112('0x0'));var AWS=require(_0x0112('0x1'));var rp=require(_0x0112('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x0112('0x3'));function getTranscriptionJob(_0x395145,_0x1d9e34,_0xa78633,_0x419307){return new Promise(function(_0x10fdca,_0x408230){var _0x40ad0d=new AWS[(_0x0112('0x4'))]({'accessKeyId':_0x1d9e34,'secretAccessKey':_0x395145,'region':_0xa78633});_0x40ad0d[_0x0112('0x5')]({'TranscriptionJobName':_0x419307},function(_0x2fd18c,_0x1e87af){if(_0x2fd18c){return _0x408230(_0x2fd18c);}else{return _0x10fdca(_0x1e87af);}});});}function sentiment(_0x4bf145,_0x126262,_0x26fd2e,_0x2f9a7d,_0x31d6c5){return new Promise(function(_0x1e74f2,_0x707684){var _0x2c0680=new AWS['Comprehend']({'accessKeyId':_0x126262,'secretAccessKey':_0x4bf145,'region':_0x26fd2e});_0x2c0680[_0x0112('0x6')]({'Text':_0x2f9a7d,'LanguageCode':_0x31d6c5[_0x0112('0x7')](0x0,0x2)},function(_0x5fee9c,_0x762578){if(_0x5fee9c){return _0x707684(_0x5fee9c);}else{return _0x1e74f2(_0x762578);}});});}function checkTranscribeJob(_0x58b431,_0x95d441,_0x394926){var _0xb58a0b;return new BPromise(function(_0x140750,_0x5a47d5){logger['info'](util[_0x0112('0x8')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x58b431['id'],_0x58b431[_0x0112('0x9')]));return getTranscriptionJob(_0x394926['data1'],_0x394926[_0x0112('0xa')],_0x95d441[_0x0112('0xb')],_0x58b431[_0x0112('0x9')])[_0x0112('0xc')](function(_0x54269a){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0xe'),_0x58b431['id'],_0x58b431['transcribeName'],_0x54269a['TranscriptionJob'][_0x0112('0xf')]));if(!_0x58b431['fileText']){switch(_0x54269a[_0x0112('0x10')]['TranscriptionJobStatus']){case _0x0112('0x11'):var _0x2b952d={'transcribeStatus':_0x54269a['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x54269a[_0x0112('0x10')][_0x0112('0x12')]['TranscriptFileUri']};logger[_0x0112('0xd')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x58b431['id']));return rp({'uri':_0x54269a['TranscriptionJob'][_0x0112('0x12')][_0x0112('0x13')],'json':!![]})[_0x0112('0xc')](function(_0x53f19c){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x14'),_0x58b431['id']));if(_0x53f19c&&_0x53f19c[_0x0112('0x15')]&&_0x53f19c['results'][_0x0112('0x16')]&&_0x53f19c[_0x0112('0x15')][_0x0112('0x16')][_0x0112('0x17')]){_0x2b952d['fileText']='';for(var _0x1e0f71=0x0;_0x1e0f71<_0x53f19c['results']['transcripts'][_0x0112('0x17')];_0x1e0f71++){_0x2b952d['fileText']+=_0x53f19c[_0x0112('0x15')]['transcripts'][_0x1e0f71][_0x0112('0x18')]+'';}}return _0x58b431[_0x0112('0x19')](_0x2b952d);})[_0x0112('0xc')](function(){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x1a'),_0x58b431['id']));if(!_0x58b431[_0x0112('0x1b')]){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))](_0x0112('0x1e'));}if(!_0x95d441[_0x0112('0x1f')]||!_0x95d441['sentimentAccountId']||!_0x95d441[_0x0112('0x20')]||!_0x95d441['language']||!_0x95d441[_0x0112('0x21')]){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2b952d[_0x0112('0x22')]){throw new Error('Transcript\x20not\x20available');}if(_0x95d441[_0x0112('0x23')]===_0x394926['id']){return _0x394926;}else{return db[_0x0112('0x24')][_0x0112('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x4aa32b){if(!_0x4aa32b){throw new db[(_0x0112('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4aa32b['data1']||!_0x4aa32b['data2']){throw new db['Sequelize'][(_0x0112('0x1d'))](_0x0112('0x26'));}_0xb58a0b=_0x4aa32b;logger[_0x0112('0xd')](util['format'](_0x0112('0x27'),_0x58b431['id']));return sentiment(_0xb58a0b[_0x0112('0x28')],_0xb58a0b['data2'],_0x95d441[_0x0112('0x20')],_0x2b952d['fileText'],_0x95d441[_0x0112('0x29')]);})['then'](function(_0x17152b){logger[_0x0112('0xd')](util[_0x0112('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x58b431['id']));return _0x58b431['update']({'sentiment':_0x17152b['Sentiment'],'sPositive':_0x17152b['SentimentScore'][_0x0112('0x2a')],'sNegative':_0x17152b[_0x0112('0x2b')][_0x0112('0x2c')],'sMixed':_0x17152b[_0x0112('0x2b')][_0x0112('0x2d')],'sNeutral':_0x17152b[_0x0112('0x2b')][_0x0112('0x2e')]});})[_0x0112('0xc')](function(){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x1a'),_0x58b431['id']));_0x140750();});case _0x0112('0x2f'):return _0x58b431[_0x0112('0x19')]({'transcribeStatus':_0x0112('0x2f'),'failureReason':_0x54269a['TranscriptionJob']['FailureReason']})['then'](function(){logger['info'](util[_0x0112('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x58b431['id']));_0x140750();});default:logger[_0x0112('0xd')](util['format'](_0x0112('0x30'),_0x58b431['id']));break;}}else{return BPromise[_0x0112('0x31')]()[_0x0112('0xc')](function(){if(!_0x58b431[_0x0112('0x1b')]){throw new db['Sequelize'][(_0x0112('0x1d'))](_0x0112('0x1e'));}if(!_0x95d441[_0x0112('0x1f')]||!_0x95d441[_0x0112('0x23')]||!_0x95d441['sentimentRegion']||!_0x95d441['language']||!_0x95d441['bucket']){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))](_0x0112('0x32'));}if(!_0x58b431[_0x0112('0x22')]){throw new Error('Transcript\x20not\x20available');}if(_0x95d441[_0x0112('0x23')]===_0x394926['id']){return _0x394926;}else{return db[_0x0112('0x24')][_0x0112('0x25')]({'where':{'id':_settings[_0x0112('0x23')]}});}})['then'](function(_0x117d4d){if(!_0x117d4d){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x117d4d[_0x0112('0x28')]||!_0x117d4d[_0x0112('0xa')]){throw new db[(_0x0112('0x1c'))]['ValidationError'](_0x0112('0x26'));}_0xb58a0b=_0x117d4d;logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x27'),_0x58b431['id']));return sentiment(_0xb58a0b[_0x0112('0x28')],_0xb58a0b[_0x0112('0xa')],_0x95d441['sentimentRegion'],_0x58b431[_0x0112('0x22')],_0x95d441['language']);})[_0x0112('0xc')](function(_0x8cb36c){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x33'),_0x58b431['id']));return _0x58b431['update']({'sentiment':_0x8cb36c['Sentiment'],'sPositive':_0x8cb36c['SentimentScore']['Positive'],'sNegative':_0x8cb36c[_0x0112('0x2b')][_0x0112('0x2c')],'sMixed':_0x8cb36c['SentimentScore'][_0x0112('0x2d')],'sNeutral':_0x8cb36c[_0x0112('0x2b')][_0x0112('0x2e')],'transcribeStatus':_0x0112('0x11')});})['then'](function(){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x1a'),_0x58b431['id']));_0x140750();});}})[_0x0112('0x34')](function(_0x59f7e3){if(_0x59f7e3){if(!_0x59f7e3['name']||_0x59f7e3[_0x0112('0x35')]!==_0x0112('0x36')){logger[_0x0112('0x37')](util['format'](_0x0112('0x38'),_0x58b431['id']),util[_0x0112('0x39')](_0x59f7e3,{'showHidden':![],'depth':null}));}}_0x140750();});});}function checkTranscribe(){var _0x39a7e6;var _0x3e525c;var _0x4d7d63;return db[_0x0112('0x3a')][_0x0112('0x3b')]({'where':{'transcribeStatus':_0x0112('0x3c')}})['then'](function(_0x13cc93){if(!_0x13cc93||!_0x13cc93[_0x0112('0x17')]){throw new db['Sequelize'][(_0x0112('0x1d'))](_0x0112('0x3d'));}_0x39a7e6=_0x13cc93;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x288ae7){if(!_0x288ae7){throw new db['Sequelize'][(_0x0112('0x1d'))]('Settings\x20not\x20available');}_0x3e525c=_0x288ae7;if(!_0x3e525c['transcribe']||!_0x3e525c['transcribeAccountId']||!_0x3e525c[_0x0112('0xb')]||!_0x3e525c[_0x0112('0x29')]||!_0x3e525c['bucket']){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))](_0x0112('0x3e'));}return db[_0x0112('0x24')][_0x0112('0x25')]({'where':{'id':_0x3e525c['transcribeAccountId']}});})['then'](function(_0x5c0a67){if(!_0x5c0a67){throw new db[(_0x0112('0x1c'))]['ValidationError'](_0x0112('0x3f'));}if(!_0x5c0a67[_0x0112('0x28')]||!_0x5c0a67[_0x0112('0xa')]){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))](_0x0112('0x26'));}_0x4d7d63=_0x5c0a67;var _0x4c730f=[];_0x39a7e6['forEach'](function(_0x1ceaf3){_0x4c730f[_0x0112('0x40')](checkTranscribeJob(_0x1ceaf3,_0x3e525c,_0x4d7d63));});return BPromise['all'](_0x4c730f);})[_0x0112('0x34')](function(_0x286f3a){if(_0x286f3a){if(!_0x286f3a[_0x0112('0x35')]||_0x286f3a['name']!==_0x0112('0x36')){logger[_0x0112('0x37')](util[_0x0112('0x39')](_0x286f3a,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xea5b=['length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','request-promise','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','format','data1','data2','transcribeName','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0x53b133,_0x176261){var _0x5647e0=function(_0x4c62b0){while(--_0x4c62b0){_0x53b133['push'](_0x53b133['shift']());}};_0x5647e0(++_0x176261);}(_0xea5b,0x152));var _0xbea5=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xea5b[_0x42bdad];return _0x122626;};var _=require(_0xbea5('0x0'));var AWS=require(_0xbea5('0x1'));var rp=require(_0xbea5('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0xbea5('0x3'))['db'];var logger=require(_0xbea5('0x4'))(_0xbea5('0x5'));function getTranscriptionJob(_0x1ade68,_0x5233c0,_0x2027df,_0x4e020c){return new Promise(function(_0x2db67a,_0x3d9263){var _0xed9654=new AWS[(_0xbea5('0x6'))]({'accessKeyId':_0x5233c0,'secretAccessKey':_0x1ade68,'region':_0x2027df});_0xed9654[_0xbea5('0x7')]({'TranscriptionJobName':_0x4e020c},function(_0x126aae,_0x36692a){if(_0x126aae){return _0x3d9263(_0x126aae);}else{return _0x2db67a(_0x36692a);}});});}function sentiment(_0x2cb656,_0x41cb99,_0x1020e9,_0xae9042,_0x4741b0){return new Promise(function(_0x58253c,_0x5a9b2a){var _0x201686=new AWS[(_0xbea5('0x8'))]({'accessKeyId':_0x41cb99,'secretAccessKey':_0x2cb656,'region':_0x1020e9});_0x201686[_0xbea5('0x9')]({'Text':_0xae9042,'LanguageCode':_0x4741b0['substring'](0x0,0x2)},function(_0x370b05,_0x17a74c){if(_0x370b05){return _0x5a9b2a(_0x370b05);}else{return _0x58253c(_0x17a74c);}});});}function checkTranscribeJob(_0x4e9fb8,_0x2eb9c0,_0xa02bd){var _0x1026ab;return new BPromise(function(_0x2b7ed6,_0x56d34a){logger['info'](util[_0xbea5('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4e9fb8['id'],_0x4e9fb8['transcribeName']));return getTranscriptionJob(_0xa02bd[_0xbea5('0xb')],_0xa02bd[_0xbea5('0xc')],_0x2eb9c0['transcribeRegion'],_0x4e9fb8[_0xbea5('0xd')])[_0xbea5('0xe')](function(_0x3889fa){logger[_0xbea5('0xf')](util[_0xbea5('0xa')](_0xbea5('0x10'),_0x4e9fb8['id'],_0x4e9fb8['transcribeName'],_0x3889fa[_0xbea5('0x11')][_0xbea5('0x12')]));if(!_0x4e9fb8[_0xbea5('0x13')]){switch(_0x3889fa['TranscriptionJob'][_0xbea5('0x12')]){case _0xbea5('0x14'):var _0x35b709={'transcribeStatus':_0x3889fa[_0xbea5('0x11')][_0xbea5('0x12')],'fileUri':_0x3889fa['TranscriptionJob'][_0xbea5('0x15')][_0xbea5('0x16')]};logger['info'](util[_0xbea5('0xa')](_0xbea5('0x17'),_0x4e9fb8['id']));return rp({'uri':_0x3889fa[_0xbea5('0x11')][_0xbea5('0x15')][_0xbea5('0x16')],'json':!![]})[_0xbea5('0xe')](function(_0x33a68e){logger[_0xbea5('0xf')](util['format'](_0xbea5('0x18'),_0x4e9fb8['id']));if(_0x33a68e&&_0x33a68e[_0xbea5('0x19')]&&_0x33a68e[_0xbea5('0x19')][_0xbea5('0x1a')]&&_0x33a68e[_0xbea5('0x19')][_0xbea5('0x1a')][_0xbea5('0x1b')]){_0x35b709[_0xbea5('0x13')]='';for(var _0x185ed3=0x0;_0x185ed3<_0x33a68e[_0xbea5('0x19')][_0xbea5('0x1a')][_0xbea5('0x1b')];_0x185ed3++){_0x35b709['fileText']+=_0x33a68e['results'][_0xbea5('0x1a')][_0x185ed3][_0xbea5('0x1c')]+'';}}return _0x4e9fb8[_0xbea5('0x1d')](_0x35b709);})[_0xbea5('0xe')](function(){logger[_0xbea5('0xf')](util[_0xbea5('0xa')](_0xbea5('0x1e'),_0x4e9fb8['id']));if(!_0x4e9fb8[_0xbea5('0x1f')]){throw new db[(_0xbea5('0x20'))][(_0xbea5('0x21'))](_0xbea5('0x22'));}if(!_0x2eb9c0[_0xbea5('0x23')]||!_0x2eb9c0['sentimentAccountId']||!_0x2eb9c0[_0xbea5('0x24')]||!_0x2eb9c0[_0xbea5('0x25')]||!_0x2eb9c0[_0xbea5('0x26')]){throw new db[(_0xbea5('0x20'))][(_0xbea5('0x21'))](_0xbea5('0x27'));}if(!_0x35b709[_0xbea5('0x13')]){throw new Error(_0xbea5('0x28'));}if(_0x2eb9c0[_0xbea5('0x29')]===_0xa02bd['id']){return _0xa02bd;}else{return db[_0xbea5('0x2a')][_0xbea5('0x2b')]({'where':{'id':_settings[_0xbea5('0x29')]}});}})[_0xbea5('0xe')](function(_0x8e089f){if(!_0x8e089f){throw new db['Sequelize'][(_0xbea5('0x21'))](_0xbea5('0x2c'));}if(!_0x8e089f['data1']||!_0x8e089f[_0xbea5('0xc')]){throw new db['Sequelize'][(_0xbea5('0x21'))](_0xbea5('0x2d'));}_0x1026ab=_0x8e089f;logger[_0xbea5('0xf')](util[_0xbea5('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4e9fb8['id']));return sentiment(_0x1026ab[_0xbea5('0xb')],_0x1026ab[_0xbea5('0xc')],_0x2eb9c0['sentimentRegion'],_0x35b709[_0xbea5('0x13')],_0x2eb9c0['language']);})[_0xbea5('0xe')](function(_0x3bb499){logger[_0xbea5('0xf')](util[_0xbea5('0xa')](_0xbea5('0x2e'),_0x4e9fb8['id']));return _0x4e9fb8[_0xbea5('0x1d')]({'sentiment':_0x3bb499[_0xbea5('0x2f')],'sPositive':_0x3bb499[_0xbea5('0x30')][_0xbea5('0x31')],'sNegative':_0x3bb499[_0xbea5('0x30')][_0xbea5('0x32')],'sMixed':_0x3bb499[_0xbea5('0x30')][_0xbea5('0x33')],'sNeutral':_0x3bb499[_0xbea5('0x30')][_0xbea5('0x34')]});})[_0xbea5('0xe')](function(){logger[_0xbea5('0xf')](util[_0xbea5('0xa')](_0xbea5('0x1e'),_0x4e9fb8['id']));_0x2b7ed6();});case _0xbea5('0x35'):return _0x4e9fb8['update']({'transcribeStatus':'FAILED','failureReason':_0x3889fa['TranscriptionJob'][_0xbea5('0x36')]})[_0xbea5('0xe')](function(){logger[_0xbea5('0xf')](util[_0xbea5('0xa')](_0xbea5('0x1e'),_0x4e9fb8['id']));_0x2b7ed6();});default:logger[_0xbea5('0xf')](util['format'](_0xbea5('0x37'),_0x4e9fb8['id']));break;}}else{return BPromise['resolve']()[_0xbea5('0xe')](function(){if(!_0x4e9fb8[_0xbea5('0x1f')]){throw new db[(_0xbea5('0x20'))][(_0xbea5('0x21'))](_0xbea5('0x22'));}if(!_0x2eb9c0['sentiment']||!_0x2eb9c0[_0xbea5('0x29')]||!_0x2eb9c0['sentimentRegion']||!_0x2eb9c0[_0xbea5('0x25')]||!_0x2eb9c0['bucket']){throw new db['Sequelize']['ValidationError'](_0xbea5('0x27'));}if(!_0x4e9fb8[_0xbea5('0x13')]){throw new Error(_0xbea5('0x28'));}if(_0x2eb9c0[_0xbea5('0x29')]===_0xa02bd['id']){return _0xa02bd;}else{return db[_0xbea5('0x2a')]['findOne']({'where':{'id':_settings[_0xbea5('0x29')]}});}})[_0xbea5('0xe')](function(_0x51e483){if(!_0x51e483){throw new db[(_0xbea5('0x20'))][(_0xbea5('0x21'))](_0xbea5('0x2c'));}if(!_0x51e483['data1']||!_0x51e483[_0xbea5('0xc')]){throw new db[(_0xbea5('0x20'))][(_0xbea5('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x1026ab=_0x51e483;logger[_0xbea5('0xf')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4e9fb8['id']));return sentiment(_0x1026ab[_0xbea5('0xb')],_0x1026ab[_0xbea5('0xc')],_0x2eb9c0[_0xbea5('0x24')],_0x4e9fb8['fileText'],_0x2eb9c0['language']);})[_0xbea5('0xe')](function(_0x2808ed){logger['info'](util[_0xbea5('0xa')](_0xbea5('0x2e'),_0x4e9fb8['id']));return _0x4e9fb8[_0xbea5('0x1d')]({'sentiment':_0x2808ed['Sentiment'],'sPositive':_0x2808ed[_0xbea5('0x30')][_0xbea5('0x31')],'sNegative':_0x2808ed[_0xbea5('0x30')][_0xbea5('0x32')],'sMixed':_0x2808ed[_0xbea5('0x30')][_0xbea5('0x33')],'sNeutral':_0x2808ed[_0xbea5('0x30')][_0xbea5('0x34')],'transcribeStatus':_0xbea5('0x14')});})[_0xbea5('0xe')](function(){logger[_0xbea5('0xf')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4e9fb8['id']));_0x2b7ed6();});}})[_0xbea5('0x38')](function(_0x44f3b7){if(_0x44f3b7){if(!_0x44f3b7[_0xbea5('0x39')]||_0x44f3b7['name']!==_0xbea5('0x3a')){logger[_0xbea5('0x3b')](util[_0xbea5('0xa')](_0xbea5('0x3c'),_0x4e9fb8['id']),util[_0xbea5('0x3d')](_0x44f3b7,{'showHidden':![],'depth':null}));}}_0x2b7ed6();});});}function checkTranscribe(){var _0x4831d2;var _0x422682;var _0x27002d;return db[_0xbea5('0x3e')]['findAll']({'where':{'transcribeStatus':_0xbea5('0x3f')}})[_0xbea5('0xe')](function(_0x3b230b){if(!_0x3b230b||!_0x3b230b[_0xbea5('0x1b')]){throw new db['Sequelize'][(_0xbea5('0x21'))](_0xbea5('0x40'));}_0x4831d2=_0x3b230b;return db[_0xbea5('0x41')]['findOne']({'where':{'id':0x1}});})[_0xbea5('0xe')](function(_0x446a63){if(!_0x446a63){throw new db[(_0xbea5('0x20'))][(_0xbea5('0x21'))]('Settings\x20not\x20available');}_0x422682=_0x446a63;if(!_0x422682[_0xbea5('0x5')]||!_0x422682[_0xbea5('0x42')]||!_0x422682[_0xbea5('0x43')]||!_0x422682[_0xbea5('0x25')]||!_0x422682['bucket']){throw new db[(_0xbea5('0x20'))][(_0xbea5('0x21'))](_0xbea5('0x44'));}return db[_0xbea5('0x2a')][_0xbea5('0x2b')]({'where':{'id':_0x422682['transcribeAccountId']}});})[_0xbea5('0xe')](function(_0x5ef7a7){if(!_0x5ef7a7){throw new db['Sequelize'][(_0xbea5('0x21'))](_0xbea5('0x2c'));}if(!_0x5ef7a7[_0xbea5('0xb')]||!_0x5ef7a7['data2']){throw new db[(_0xbea5('0x20'))][(_0xbea5('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x27002d=_0x5ef7a7;var _0x227f1c=[];_0x4831d2[_0xbea5('0x45')](function(_0x58eade){_0x227f1c[_0xbea5('0x46')](checkTranscribeJob(_0x58eade,_0x422682,_0x27002d));});return BPromise[_0xbea5('0x47')](_0x227f1c);})[_0xbea5('0x38')](function(_0x832614){if(_0x832614){if(!_0x832614[_0xbea5('0x39')]||_0x832614['name']!==_0xbea5('0x3a')){logger[_0xbea5('0x3b')](util[_0xbea5('0x3d')](_0x832614,{'showHidden':![],'depth':null}));}}});}exports[_0xbea5('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 3c29d8f..9ff7e6f 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe32b=['../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment'];(function(_0x4c6095,_0x2c9c9f){var _0x322848=function(_0x5012e6){while(--_0x5012e6){_0x4c6095['push'](_0x4c6095['shift']());}};_0x322848(++_0x2c9c9f);}(_0xe32b,0x1e9));var _0xbe32=function(_0x340dca,_0x2140bd){_0x340dca=_0x340dca-0x0;var _0x1e5d2f=_0xe32b[_0x340dca];return _0x1e5d2f;};'use strict';var _=require(_0xbe32('0x0'));var moment=require(_0xbe32('0x1'));var Redis=require(_0xbe32('0x2'));var util=require(_0xbe32('0x3'));var config=require(_0xbe32('0x4'));var db=require(_0xbe32('0x5'))['db'];var logger=require(_0xbe32('0x6'))(_0xbe32('0x7'));config[_0xbe32('0x8')]=_[_0xbe32('0x9')](config[_0xbe32('0x8')],{'host':_0xbe32('0xa'),'port':0x18eb});var io=require(_0xbe32('0xb'))(new Redis(config[_0xbe32('0x8')]));function closeInteractions(){var _0xf1bdcb=[];return db[_0xbe32('0xc')][_0xbe32('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})['then'](function(_0x23323c){if(_0x23323c&&_0x23323c['length']){_0xf1bdcb=_[_0xbe32('0xe')](_0x23323c||[],'id');logger[_0xbe32('0xf')](_0xbe32('0x10'),_0xf1bdcb[_0xbe32('0x11')]());return db[_0xbe32('0xc')][_0xbe32('0x12')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xbe32('0x13')](_0xbe32('0x14'))},{'where':{'id':_0xf1bdcb}});}})['then'](function(){if(_0xf1bdcb&&_0xf1bdcb[_0xbe32('0x15')]){logger[_0xbe32('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0xf1bdcb[_0xbe32('0x11')]());for(var _0x52eb7b=0x0;_0x52eb7b<_0xf1bdcb[_0xbe32('0x15')];_0x52eb7b++){io[_0xbe32('0x16')](_0xbe32('0x17'),{'id':_0xf1bdcb[_0x52eb7b],'closed':!![]});}}})[_0xbe32('0x18')](function(_0x5bf06f){logger['error'](_0xbe32('0x19'),_0x5bf06f?util['inspect'](_0x5bf06f,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2824=['subtract','hours','then','length','map','info','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll'];(function(_0x2655e5,_0x3cb9d4){var _0x191462=function(_0x6f1805){while(--_0x6f1805){_0x2655e5['push'](_0x2655e5['shift']());}};_0x191462(++_0x3cb9d4);}(_0x2824,0xbf));var _0x4282=function(_0x11b94a,_0x12a16a){_0x11b94a=_0x11b94a-0x0;var _0x5ca80b=_0x2824[_0x11b94a];return _0x5ca80b;};'use strict';var _=require(_0x4282('0x0'));var moment=require('moment');var Redis=require(_0x4282('0x1'));var util=require(_0x4282('0x2'));var config=require(_0x4282('0x3'));var db=require(_0x4282('0x4'))['db'];var logger=require('../logger')(_0x4282('0x5'));config[_0x4282('0x6')]=_[_0x4282('0x7')](config['redis'],{'host':_0x4282('0x8'),'port':0x18eb});var io=require(_0x4282('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x13b566=[];return db[_0x4282('0xa')][_0x4282('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4282('0xc')](0x18,_0x4282('0xd'))}}})[_0x4282('0xe')](function(_0x40ab68){if(_0x40ab68&&_0x40ab68[_0x4282('0xf')]){_0x13b566=_[_0x4282('0x10')](_0x40ab68||[],'id');logger[_0x4282('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x13b566[_0x4282('0x12')]());return db[_0x4282('0xa')][_0x4282('0x13')]({'closeReason':_0x4282('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4282('0x15')](_0x4282('0x16'))},{'where':{'id':_0x13b566}});}})[_0x4282('0xe')](function(){if(_0x13b566&&_0x13b566[_0x4282('0xf')]){logger[_0x4282('0x11')](_0x4282('0x17'),_0x13b566[_0x4282('0x12')]());for(var _0x99930a=0x0;_0x99930a<_0x13b566['length'];_0x99930a++){io[_0x4282('0x18')]('whatsappInteraction:update',{'id':_0x13b566[_0x99930a],'closed':!![]});}}})['catch'](function(_0x53b159){logger[_0x4282('0x19')](_0x4282('0x1a'),_0x53b159?util[_0x4282('0x1b')](_0x53b159,{'showHidden':![],'depth':null}):'');});}exports[_0x4282('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index c30855e..f25756d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd003=['destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','CmContact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd003,0x108));var _0x3d00=function(_0x5dc8c7,_0x5c0a8f){_0x5dc8c7=_0x5dc8c7-0x0;var _0x1e64ef=_0xd003[_0x5dc8c7];return _0x1e64ef;};'use strict';var util=require(_0x3d00('0x0'));var db=require(_0x3d00('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3d00('0x2')]({'id':i,'firstName':_0x3d00('0x3')+i,'lastName':_0x3d00('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x3d00('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3d00('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x3d00('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x3d00('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x3d00('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x3d00('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3d00('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x3d00('0x6')]()});}db[_0x3d00('0x7')][_0x3d00('0x8')]({'where':{}})[_0x3d00('0x9')](function(){return db[_0x3d00('0x7')][_0x3d00('0xa')](contacts);})[_0x3d00('0x9')](function(){console[_0x3d00('0xb')](_0x3d00('0xc'),_0x3d00('0xd'));return db[_0x3d00('0xe')]['destroy']({'where':{}});})[_0x3d00('0x9')](function(){return db['CmHopper'][_0x3d00('0xa')](hopper);})[_0x3d00('0x9')](function(){console['log'](_0x3d00('0xc'),_0x3d00('0xf'));return db[_0x3d00('0x7')][_0x3d00('0xa')](contacts2);})[_0x3d00('0x9')](function(){console['log'](_0x3d00('0xc'),_0x3d00('0x10'));return db[_0x3d00('0xe')][_0x3d00('0xa')](hopper2);})['then'](function(){console[_0x3d00('0xb')](_0x3d00('0xc'),'hopper2');})['catch'](function(_0x4a71a9){console[_0x3d00('0xb')](_0x4a71a9);}); \ No newline at end of file +var _0x1c33=['Biondo','@xcally.com','now','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','catch','util','../mysqldb','push','Innocenzo'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1c33,0x17c));var _0x31c3=function(_0x3369b2,_0x33da2f){_0x3369b2=_0x3369b2-0x0;var _0x518598=_0x1c33[_0x3369b2];return _0x518598;};'use strict';var util=require(_0x31c3('0x0'));var db=require(_0x31c3('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x31c3('0x2')]({'id':i,'firstName':_0x31c3('0x3')+i,'lastName':_0x31c3('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x31c3('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x31c3('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x31c3('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x31c3('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x31c3('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x31c3('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x31c3('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x31c3('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x31c3('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0x31c3('0x7')]['destroy']({'where':{}})['then'](function(){return db[_0x31c3('0x7')][_0x31c3('0x8')](contacts);})[_0x31c3('0x9')](function(){console[_0x31c3('0xa')](_0x31c3('0xb'),_0x31c3('0xc'));return db[_0x31c3('0xd')]['destroy']({'where':{}});})['then'](function(){return db[_0x31c3('0xd')][_0x31c3('0x8')](hopper);})[_0x31c3('0x9')](function(){console[_0x31c3('0xa')]('finished\x20populating',_0x31c3('0xe'));return db[_0x31c3('0x7')][_0x31c3('0x8')](contacts2);})['then'](function(){console[_0x31c3('0xa')](_0x31c3('0xb'),'contacts2');return db[_0x31c3('0xd')][_0x31c3('0x8')](hopper2);})[_0x31c3('0x9')](function(){console[_0x31c3('0xa')](_0x31c3('0xb'),'hopper2');})[_0x31c3('0xf')](function(_0x3c533f){console[_0x31c3('0xa')](_0x3c533f);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 901c10a..45767ef 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cc4=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','push','%s%s','format','agent','%s%s@xcally.com','udp','wss'];(function(_0xcb56d2,_0x18c194){var _0x57bed4=function(_0x194ed8){while(--_0x194ed8){_0xcb56d2['push'](_0xcb56d2['shift']());}};_0x57bed4(++_0x18c194);}(_0x3cc4,0x75));var _0x43cc=function(_0x407c0c,_0x36f968){_0x407c0c=_0x407c0c-0x0;var _0x5beb35=_0x3cc4[_0x407c0c];return _0x5beb35;};'use strict';var util=require(_0x43cc('0x0'));var db=require(_0x43cc('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x43cc('0x2')]({'name':util['format'](_0x43cc('0x3'),'agent',i),'fullname':util[_0x43cc('0x4')]('%s%s',_0x43cc('0x5'),i),'email':util['format'](_0x43cc('0x6'),_0x43cc('0x5'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x43cc('0x7'),'ws',_0x43cc('0x8')],'disallow':[_0x43cc('0x9')],'allow':[_0x43cc('0xa')],'defaultuser':util[_0x43cc('0x4')](_0x43cc('0x3'),_0x43cc('0x5'),i),'encryption':_0x43cc('0xb'),'avpf':_0x43cc('0xb'),'force_avp':'yes','icesupport':_0x43cc('0xb'),'dtlsenable':_0x43cc('0xb'),'dtlsverify':'no','dtlscertfile':_0x43cc('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x43cc('0xd'),'callerid':util[_0x43cc('0x4')](_0x43cc('0xe'),util[_0x43cc('0x4')](_0x43cc('0x3'),_0x43cc('0x5'),i),0xfa0+i)});}db[_0x43cc('0xf')][_0x43cc('0x10')](users)[_0x43cc('0x11')](function(){console['log'](_0x43cc('0x12'));})[_0x43cc('0x13')](function(_0x5d64c7){console[_0x43cc('0x14')](_0x5d64c7);}); \ No newline at end of file +var _0xf4bb=['then','log','util','push','%s%s','agent','format','%s%s@xcally.com','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x1ea8d6,_0xa196fa){var _0x11c74b=function(_0x2573cb){while(--_0x2573cb){_0x1ea8d6['push'](_0x1ea8d6['shift']());}};_0x11c74b(++_0xa196fa);}(_0xf4bb,0x8a));var _0xbf4b=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xf4bb[_0xbe200f];return _0x192597;};'use strict';var util=require(_0xbf4b('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xbf4b('0x1')]({'name':util['format'](_0xbf4b('0x2'),_0xbf4b('0x3'),i),'fullname':util[_0xbf4b('0x4')]('%s%s','agent',i),'email':util[_0xbf4b('0x4')](_0xbf4b('0x5'),_0xbf4b('0x3'),i),'role':_0xbf4b('0x3'),'password':'password','internal':0xfa0+i,'type':_0xbf4b('0x6'),'transport':[_0xbf4b('0x7'),'ws',_0xbf4b('0x8')],'disallow':[_0xbf4b('0x9')],'allow':['ulaw'],'defaultuser':util[_0xbf4b('0x4')](_0xbf4b('0x2'),_0xbf4b('0x3'),i),'encryption':_0xbf4b('0xa'),'avpf':_0xbf4b('0xa'),'force_avp':_0xbf4b('0xa'),'icesupport':_0xbf4b('0xa'),'dtlsenable':_0xbf4b('0xa'),'dtlsverify':'no','dtlscertfile':_0xbf4b('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xbf4b('0x4')](_0xbf4b('0xc'),util[_0xbf4b('0x4')](_0xbf4b('0x2'),'agent',i),0xfa0+i)});}db[_0xbf4b('0xd')][_0xbf4b('0xe')](users)[_0xbf4b('0xf')](function(){console[_0xbf4b('0x10')]('add\x20user');})['catch'](function(_0x5ee3b8){console[_0xbf4b('0x10')](_0x5ee3b8);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index c92798e..9c1d2d5 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c04=['role','agent','type','UserProfileSection','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','ivr','then','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','WhatsappQueue','Campaign','user','voice:inbound','userProfileId','SmsQueues','SmsQueue','OpenchannelQueue','Trunk','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','./environment','name','Agents','User'];(function(_0x398480,_0x5b5e3a){var _0x965f42=function(_0x3019c7){while(--_0x3019c7){_0x398480['push'](_0x398480['shift']());}};_0x965f42(++_0x5b5e3a);}(_0x3c04,0x192));var _0x43c0=function(_0x412085,_0x435fe6){_0x412085=_0x412085-0x0;var _0x51e670=_0x3c04[_0x412085];return _0x51e670;};'use strict';var _=require('lodash');var util=require(_0x43c0('0x0'));var BPromise=require('bluebird');var db=require(_0x43c0('0x1'))['db'];var config=require(_0x43c0('0x2'));var queryQueues={'attributes':['id',_0x43c0('0x3')],'include':[{'as':_0x43c0('0x4'),'model':db[_0x43c0('0x5')],'attributes':['id',_0x43c0('0x3'),_0x43c0('0x6')],'raw':!![],'where':{'role':_0x43c0('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x43c0('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x43c0('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x43c0('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x43c0('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x100fb8,_0x3efc14,_0x1b54f2){return db[_0x43c0('0x9')]['findOne']({'where':{'name':_0x100fb8,'userProfileId':_0x3efc14},'raw':!![]})['then'](function(_0x2c4153){if(_0x2c4153){if(_0x2c4153['autoAssociation']){switch(_0x100fb8){case _0x43c0('0xa'):case _0x43c0('0xb'):case _0x43c0('0xc'):case'SmsQueues':case _0x43c0('0xd'):case _0x43c0('0xe'):case _0x43c0('0xf'):return db[_0x1b54f2][_0x43c0('0x10')](queryQueues);case _0x43c0('0x11'):return db[_0x1b54f2]['findAll'](queryTelephones);case _0x43c0('0x12'):return db[_0x1b54f2][_0x43c0('0x10')](queryTrunks);case _0x43c0('0x13'):return db[_0x1b54f2][_0x43c0('0x10')](queryCampaigns);}}else{return db[_0x43c0('0x14')]['findAll']({'attributes':[_0x43c0('0x15')],'where':{'sectionId':_0x2c4153['id']},'raw':!![]})['then'](function(_0x1e35d0){if(_0x1e35d0){var _0x47aade={'where':{'id':_[_0x43c0('0x16')](_0x1e35d0,_0x43c0('0x15'))},'raw':!![]};switch(_0x1b54f2){case _0x43c0('0x5'):_0x47aade[_0x43c0('0x17')][_0x43c0('0x6')]='telephone';break;case'Campaign':_0x47aade['where'][_0x43c0('0x8')]=_0x43c0('0x18');break;}return db[_0x1b54f2][_0x43c0('0x10')](_0x47aade);}else{return[];}});}}else{return[];}})[_0x43c0('0x19')](function(_0x333f60){return _0x333f60;});}function joinOrLeaveQueues(_0x31aa65,_0x5c3c68,_0xe1e717,_0x2aed3d){_0x31aa65[_0x5c3c68](util[_0x43c0('0x1a')](_0x43c0('0x1b'),_0xe1e717,_0x2aed3d[_0x43c0('0x3')]));if(_0x2aed3d[_0x43c0('0x4')]){for(var _0x3d5aad=0x0;_0x3d5aad<_0x2aed3d[_0x43c0('0x4')][_0x43c0('0x1c')];_0x3d5aad+=0x1){_0x31aa65[_0x5c3c68](util[_0x43c0('0x1a')](_0x43c0('0x1d'),_0x2aed3d[_0x43c0('0x4')][_0x3d5aad][_0x43c0('0x3')]));}}}function joinOrLeave(_0x115395,_0x4a3723,_0xf3ff3e){var _0x4aab88;if(_0x115395[_0x43c0('0x1e')][_0x43c0('0x1f')]['id']){db[_0x43c0('0x5')][_0x43c0('0x20')]({'attributes':['id','name',_0x43c0('0x6'),'userProfileId'],'where':{'id':_0x115395[_0x43c0('0x1e')][_0x43c0('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x43c0('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x43c0('0x22')],'as':_0x43c0('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x43c0('0x24')],'as':_0x43c0('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x43c0('0x26')],'as':_0x43c0('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x43c0('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x43c0('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x43c0('0x19')](function(_0x34530e){if(_0x34530e){_0x4aab88=_0x34530e;_0x115395[_0x4a3723](util[_0x43c0('0x1a')](_0x43c0('0x1d'),_0x34530e[_0x43c0('0x3')]));var _0x7dfd38=[];switch(_0x34530e['role']){case _0x43c0('0x2a'):_0x115395[_0x4a3723]('voice:inbound');_0x115395[_0x4a3723](_0x43c0('0x2b'));if(queryQueues[_0x43c0('0x2c')](_0x43c0('0x2d'))){delete queryQueues['include'];}_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x2f')]['findAll'](queryQueues));_0x7dfd38['push'](db[_0x43c0('0x30')][_0x43c0('0x10')](queryQueues));_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x31')][_0x43c0('0x10')](queryQueues));_0x7dfd38[_0x43c0('0x2e')](db['SmsQueue'][_0x43c0('0x10')](queryQueues));_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x32')][_0x43c0('0x10')](queryQueues));_0x7dfd38['push'](db['OpenchannelQueue'][_0x43c0('0x10')](queryQueues));_0x7dfd38['push'](db[_0x43c0('0x33')]['findAll'](queryQueues));_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x5')][_0x43c0('0x10')](queryTelephones));_0x7dfd38['push'](db['Trunk'][_0x43c0('0x10')](queryTrunks));_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x34')][_0x43c0('0x10')](queryCampaigns));_0x7dfd38['push'](db[_0x43c0('0x5')][_0x43c0('0x10')](queryAgents));break;case _0x43c0('0x35'):_0x115395[_0x4a3723](_0x43c0('0x36'));_0x115395[_0x4a3723](_0x43c0('0x2b'));_0x7dfd38['push'](getAssociatedResources(_0x43c0('0xa'),_0x34530e[_0x43c0('0x37')],_0x43c0('0x2f')));_0x7dfd38[_0x43c0('0x2e')](getAssociatedResources(_0x43c0('0xb'),_0x34530e[_0x43c0('0x37')],_0x43c0('0x30')));_0x7dfd38['push'](getAssociatedResources(_0x43c0('0xc'),_0x34530e['userProfileId'],_0x43c0('0x31')));_0x7dfd38['push'](getAssociatedResources(_0x43c0('0x38'),_0x34530e['userProfileId'],_0x43c0('0x39')));_0x7dfd38[_0x43c0('0x2e')](getAssociatedResources(_0x43c0('0xd'),_0x34530e[_0x43c0('0x37')],_0x43c0('0x32')));_0x7dfd38[_0x43c0('0x2e')](getAssociatedResources(_0x43c0('0xe'),_0x34530e[_0x43c0('0x37')],_0x43c0('0x3a')));_0x7dfd38[_0x43c0('0x2e')](getAssociatedResources('WhatsappQueues',_0x34530e['userProfileId'],_0x43c0('0x33')));_0x7dfd38['push'](getAssociatedResources('Telephones',_0x34530e[_0x43c0('0x37')],_0x43c0('0x5')));_0x7dfd38['push'](getAssociatedResources(_0x43c0('0x12'),_0x34530e['userProfileId'],_0x43c0('0x3b')));_0x7dfd38[_0x43c0('0x2e')](getAssociatedResources(_0x43c0('0x13'),_0x34530e[_0x43c0('0x37')],_0x43c0('0x34')));_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x5')][_0x43c0('0x10')](queryAgents));break;case _0x43c0('0x7'):_0x115395[_0x4a3723](_0x43c0('0x36'));_0x115395[_0x4a3723](_0x43c0('0x2b'));_0x7dfd38[_0x43c0('0x2e')](_0x34530e[_0x43c0('0x3c')]({'attributes':['id','name']}));_0x7dfd38[_0x43c0('0x2e')](_0x34530e[_0x43c0('0x3d')]({'attributes':['id',_0x43c0('0x3')]}));_0x7dfd38[_0x43c0('0x2e')](_0x34530e['getFaxQueues']({'attributes':['id',_0x43c0('0x3')]}));_0x7dfd38['push'](_0x34530e[_0x43c0('0x3e')]({'attributes':['id','name']}));_0x7dfd38[_0x43c0('0x2e')](_0x34530e[_0x43c0('0x3f')]({'attributes':['id',_0x43c0('0x3')]}));_0x7dfd38['push'](_0x34530e[_0x43c0('0x40')]({'attributes':['id',_0x43c0('0x3')]}));_0x7dfd38[_0x43c0('0x2e')](_0x34530e[_0x43c0('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0x43c0('0x42')](_0x7dfd38);}})[_0x43c0('0x19')](function(_0xea2cc2){if(_0xea2cc2&&_0xea2cc2['length']){for(var _0x195961=0x0;_0x195961<_0xea2cc2[_0x43c0('0x1c')];_0x195961+=0x1){for(var _0x496f84=0x0;_0x496f84<_0xea2cc2[_0x195961][_0x43c0('0x1c')];_0x496f84+=0x1){switch(_0x195961){case 0x0:joinOrLeaveQueues(_0x115395,_0x4a3723,_0x43c0('0x43'),_0xea2cc2[_0x195961][_0x496f84]);break;case 0x1:joinOrLeaveQueues(_0x115395,_0x4a3723,'chat',_0xea2cc2[_0x195961][_0x496f84]);break;case 0x2:joinOrLeaveQueues(_0x115395,_0x4a3723,'fax',_0xea2cc2[_0x195961][_0x496f84]);break;case 0x3:joinOrLeaveQueues(_0x115395,_0x4a3723,'sms',_0xea2cc2[_0x195961][_0x496f84]);break;case 0x4:joinOrLeaveQueues(_0x115395,_0x4a3723,_0x43c0('0x44'),_0xea2cc2[_0x195961][_0x496f84]);break;case 0x5:joinOrLeaveQueues(_0x115395,_0x4a3723,_0x43c0('0x45'),_0xea2cc2[_0x195961][_0x496f84]);break;case 0x6:joinOrLeaveQueues(_0x115395,_0x4a3723,_0x43c0('0x46'),_0xea2cc2[_0x195961][_0x496f84]);break;case 0x7:if(_0x4aab88['role']!==_0x43c0('0x7'))_0x115395[_0x4a3723](util[_0x43c0('0x1a')](_0x43c0('0x47'),_0xea2cc2[_0x195961][_0x496f84][_0x43c0('0x3')]));break;case 0x8:if(_0x4aab88[_0x43c0('0x6')]!==_0x43c0('0x7'))_0x115395[_0x4a3723](util[_0x43c0('0x1a')](_0x43c0('0x48'),_0xea2cc2[_0x195961][_0x496f84][_0x43c0('0x3')]));break;case 0x9:if(_0x4aab88[_0x43c0('0x6')]!==_0x43c0('0x7'))_0x115395[_0x4a3723](util[_0x43c0('0x1a')](_0x43c0('0x49'),_0xea2cc2[_0x195961][_0x496f84][_0x43c0('0x8')],_0xea2cc2[_0x195961][_0x496f84]['name']));break;case 0xa:_0x115395[_0x4a3723](util[_0x43c0('0x1a')](_0x43c0('0x1d'),_0xea2cc2[_0x195961][_0x496f84]['name']));break;}}}}})['then'](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0x54fe69=_[_0x43c0('0x16')](_0x4aab88[_0x43c0('0x21')],'id');return _0x4aab88[_0x43c0('0x4b')](_0x54fe69)['then'](function(){for(var _0x5aa2c3=0x0;_0x5aa2c3<_0x54fe69[_0x43c0('0x1c')];_0x5aa2c3+=0x1){_0xf3ff3e[_0x43c0('0x4c')](_0x43c0('0x4d'),{'ChatInteractionId':Number(_0x54fe69[_0x5aa2c3]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x19')](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0xc2fdfc=_[_0x43c0('0x16')](_0x4aab88['MailInteractions'],'id');return _0x4aab88['removeMailInteractions'](_0xc2fdfc)[_0x43c0('0x19')](function(){for(var _0x516680=0x0;_0x516680<_0xc2fdfc[_0x43c0('0x1c')];_0x516680+=0x1){_0xf3ff3e[_0x43c0('0x4c')](_0x43c0('0x4e'),{'MailInteractionId':Number(_0xc2fdfc[_0x516680]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x19')](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0x4689da=_[_0x43c0('0x16')](_0x4aab88[_0x43c0('0x25')],'id');return _0x4aab88[_0x43c0('0x4f')](_0x4689da)[_0x43c0('0x19')](function(){for(var _0x5954b5=0x0;_0x5954b5<_0x4689da[_0x43c0('0x1c')];_0x5954b5+=0x1){_0xf3ff3e[_0x43c0('0x4c')](_0x43c0('0x50'),{'FaxInteractionId':Number(_0x4689da[_0x5954b5]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x19')](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0x34344d=_[_0x43c0('0x16')](_0x4aab88[_0x43c0('0x27')],'id');return _0x4aab88[_0x43c0('0x51')](_0x34344d)[_0x43c0('0x19')](function(){for(var _0x523c25=0x0;_0x523c25<_0x34344d['length'];_0x523c25+=0x1){_0xf3ff3e[_0x43c0('0x4c')](_0x43c0('0x52'),{'SmsInteractionId':Number(_0x34344d[_0x523c25]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x19')](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0x551ed5=_['map'](_0x4aab88[_0x43c0('0x53')],'id');return _0x4aab88[_0x43c0('0x54')](_0x551ed5)[_0x43c0('0x19')](function(){for(var _0x12f98e=0x0;_0x12f98e<_0x551ed5[_0x43c0('0x1c')];_0x12f98e+=0x1){_0xf3ff3e[_0x43c0('0x4c')](_0x43c0('0x55'),{'OpenchannelInteractionId':Number(_0x551ed5[_0x12f98e]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x19')](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0x54e773=_[_0x43c0('0x16')](_0x4aab88['WhatsappInteractions'],'id');return _0x4aab88[_0x43c0('0x56')](_0x54e773)[_0x43c0('0x19')](function(){for(var _0x43d9c2=0x0;_0x43d9c2<_0x54e773[_0x43c0('0x1c')];_0x43d9c2+=0x1){_0xf3ff3e[_0x43c0('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x54e773[_0x43d9c2]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x57')](function(_0x27b84a){_0x115395[_0x43c0('0x58')](_0x27b84a);});}}function onDisconnect(_0x2b0545,_0x3599de){joinOrLeave(_0x2b0545,'leave',_0x3599de);}function onConnect(_0x3b174a){joinOrLeave(_0x3b174a,_0x43c0('0x59'));}exports[_0x43c0('0x5a')]=function(_0xca6361){_0xca6361['on'](_0x43c0('0x5b'),function(_0x222a93){_0x222a93[_0x43c0('0x5c')](0x0);_0x222a93[_0x43c0('0x5d')]=_0x222a93[_0x43c0('0x5e')][_0x43c0('0x5b')][_0x43c0('0x5f')]+':'+_0x222a93['request'][_0x43c0('0x5b')][_0x43c0('0x60')];_0x222a93['connectedAt']=new Date();_0x222a93['log']=function(_0x480886){console[_0x43c0('0x58')](_0x43c0('0x61')+_0x222a93[_0x43c0('0x62')][_0x43c0('0x3')]+'['+_0x222a93[_0x43c0('0x5d')]+']',_0x480886);};_0x222a93['on'](_0x43c0('0x63'),function(){onDisconnect(_0x222a93,_0xca6361);_0x222a93[_0x43c0('0x58')](_0x43c0('0x64'));});onConnect(_0x222a93);_0x222a93['log'](_0x43c0('0x65'));});}; \ No newline at end of file +var _0x8c8b=['where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','FaxQueue','WhatsappQueues','getChatQueues','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','voice','fax','sms','mail','whatsapp','telephone:%s','campaign:%s:%s','leave','map','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','remoteAddress','remotePort','connectedAt','disconnect','CONNECTED','lodash','../mysqldb','./environment','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','User'];(function(_0xf9631e,_0x245b8d){var _0x4eb467=function(_0x19e3c9){while(--_0x19e3c9){_0xf9631e['push'](_0xf9631e['shift']());}};_0x4eb467(++_0x245b8d);}(_0x8c8b,0x106));var _0xb8c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c8b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb8c8('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0xb8c8('0x1'))['db'];var config=require(_0xb8c8('0x2'));var queryQueues={'attributes':['id',_0xb8c8('0x3')],'include':[{'as':_0xb8c8('0x4'),'model':db['User'],'attributes':['id','name',_0xb8c8('0x5')],'raw':!![],'where':{'role':_0xb8c8('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb8c8('0x3')],'where':{'role':_0xb8c8('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb8c8('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xb8c8('0x3')],'where':{'role':_0xb8c8('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb8c8('0x3'),_0xb8c8('0x8')],'where':{'type':_0xb8c8('0x9')}};function getAssociatedResources(_0x142007,_0x50834e,_0xfa7361){return db[_0xb8c8('0xa')][_0xb8c8('0xb')]({'where':{'name':_0x142007,'userProfileId':_0x50834e},'raw':!![]})[_0xb8c8('0xc')](function(_0x3c74d5){if(_0x3c74d5){if(_0x3c74d5[_0xb8c8('0xd')]){switch(_0x142007){case _0xb8c8('0xe'):case _0xb8c8('0xf'):case _0xb8c8('0x10'):case _0xb8c8('0x11'):case _0xb8c8('0x12'):case _0xb8c8('0x13'):case'WhatsappQueues':return db[_0xfa7361][_0xb8c8('0x14')](queryQueues);case'Telephones':return db[_0xfa7361][_0xb8c8('0x14')](queryTelephones);case _0xb8c8('0x15'):return db[_0xfa7361]['findAll'](queryTrunks);case _0xb8c8('0x16'):return db[_0xfa7361][_0xb8c8('0x14')](queryCampaigns);}}else{return db[_0xb8c8('0x17')]['findAll']({'attributes':[_0xb8c8('0x18')],'where':{'sectionId':_0x3c74d5['id']},'raw':!![]})[_0xb8c8('0xc')](function(_0x1c12c2){if(_0x1c12c2){var _0x1feec2={'where':{'id':_['map'](_0x1c12c2,_0xb8c8('0x18'))},'raw':!![]};switch(_0xfa7361){case _0xb8c8('0x19'):_0x1feec2[_0xb8c8('0x1a')][_0xb8c8('0x5')]='telephone';break;case _0xb8c8('0x1b'):_0x1feec2[_0xb8c8('0x1a')][_0xb8c8('0x8')]=_0xb8c8('0x9');break;}return db[_0xfa7361][_0xb8c8('0x14')](_0x1feec2);}else{return[];}});}}else{return[];}})[_0xb8c8('0xc')](function(_0x3c53bc){return _0x3c53bc;});}function joinOrLeaveQueues(_0x1d6bba,_0x355e6e,_0x2041e5,_0xe406d8){_0x1d6bba[_0x355e6e](util[_0xb8c8('0x1c')](_0xb8c8('0x1d'),_0x2041e5,_0xe406d8[_0xb8c8('0x3')]));if(_0xe406d8[_0xb8c8('0x4')]){for(var _0x4ebb45=0x0;_0x4ebb45<_0xe406d8[_0xb8c8('0x4')][_0xb8c8('0x1e')];_0x4ebb45+=0x1){_0x1d6bba[_0x355e6e](util[_0xb8c8('0x1c')](_0xb8c8('0x1f'),_0xe406d8[_0xb8c8('0x4')][_0x4ebb45]['name']));}}}function joinOrLeave(_0x18add8,_0x49ad09,_0x58d7c0){var _0x2b3629;if(_0x18add8[_0xb8c8('0x20')][_0xb8c8('0x21')]['id']){db[_0xb8c8('0x19')][_0xb8c8('0x22')]({'attributes':['id','name',_0xb8c8('0x5'),_0xb8c8('0x23')],'where':{'id':_0x18add8[_0xb8c8('0x20')][_0xb8c8('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xb8c8('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb8c8('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb8c8('0x26')],'as':_0xb8c8('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xb8c8('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xb8c8('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xb8c8('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xb8c8('0xc')](function(_0x3599f5){if(_0x3599f5){_0x2b3629=_0x3599f5;_0x18add8[_0x49ad09](util['format'](_0xb8c8('0x1f'),_0x3599f5['name']));var _0x3f50c9=[];switch(_0x3599f5[_0xb8c8('0x5')]){case _0xb8c8('0x2b'):_0x18add8[_0x49ad09](_0xb8c8('0x2c'));_0x18add8[_0x49ad09](_0xb8c8('0x2d'));if(queryQueues[_0xb8c8('0x2e')](_0xb8c8('0x2f'))){delete queryQueues[_0xb8c8('0x2f')];}_0x3f50c9[_0xb8c8('0x30')](db['VoiceQueue'][_0xb8c8('0x14')](queryQueues));_0x3f50c9['push'](db[_0xb8c8('0x31')][_0xb8c8('0x14')](queryQueues));_0x3f50c9[_0xb8c8('0x30')](db['FaxQueue'][_0xb8c8('0x14')](queryQueues));_0x3f50c9[_0xb8c8('0x30')](db[_0xb8c8('0x32')][_0xb8c8('0x14')](queryQueues));_0x3f50c9[_0xb8c8('0x30')](db[_0xb8c8('0x33')][_0xb8c8('0x14')](queryQueues));_0x3f50c9[_0xb8c8('0x30')](db[_0xb8c8('0x34')][_0xb8c8('0x14')](queryQueues));_0x3f50c9['push'](db[_0xb8c8('0x35')][_0xb8c8('0x14')](queryQueues));_0x3f50c9[_0xb8c8('0x30')](db[_0xb8c8('0x19')][_0xb8c8('0x14')](queryTelephones));_0x3f50c9[_0xb8c8('0x30')](db[_0xb8c8('0x36')][_0xb8c8('0x14')](queryTrunks));_0x3f50c9['push'](db[_0xb8c8('0x1b')]['findAll'](queryCampaigns));_0x3f50c9[_0xb8c8('0x30')](db[_0xb8c8('0x19')][_0xb8c8('0x14')](queryAgents));break;case _0xb8c8('0x37'):_0x18add8[_0x49ad09](_0xb8c8('0x2c'));_0x18add8[_0x49ad09](_0xb8c8('0x2d'));_0x3f50c9['push'](getAssociatedResources(_0xb8c8('0xe'),_0x3599f5[_0xb8c8('0x23')],_0xb8c8('0x38')));_0x3f50c9[_0xb8c8('0x30')](getAssociatedResources(_0xb8c8('0xf'),_0x3599f5['userProfileId'],'ChatQueue'));_0x3f50c9[_0xb8c8('0x30')](getAssociatedResources(_0xb8c8('0x10'),_0x3599f5[_0xb8c8('0x23')],_0xb8c8('0x39')));_0x3f50c9[_0xb8c8('0x30')](getAssociatedResources(_0xb8c8('0x11'),_0x3599f5[_0xb8c8('0x23')],_0xb8c8('0x32')));_0x3f50c9[_0xb8c8('0x30')](getAssociatedResources('MailQueues',_0x3599f5[_0xb8c8('0x23')],'MailQueue'));_0x3f50c9[_0xb8c8('0x30')](getAssociatedResources(_0xb8c8('0x13'),_0x3599f5[_0xb8c8('0x23')],_0xb8c8('0x34')));_0x3f50c9[_0xb8c8('0x30')](getAssociatedResources(_0xb8c8('0x3a'),_0x3599f5[_0xb8c8('0x23')],_0xb8c8('0x35')));_0x3f50c9[_0xb8c8('0x30')](getAssociatedResources('Telephones',_0x3599f5[_0xb8c8('0x23')],_0xb8c8('0x19')));_0x3f50c9[_0xb8c8('0x30')](getAssociatedResources(_0xb8c8('0x15'),_0x3599f5[_0xb8c8('0x23')],_0xb8c8('0x36')));_0x3f50c9[_0xb8c8('0x30')](getAssociatedResources(_0xb8c8('0x16'),_0x3599f5[_0xb8c8('0x23')],_0xb8c8('0x1b')));_0x3f50c9[_0xb8c8('0x30')](db[_0xb8c8('0x19')][_0xb8c8('0x14')](queryAgents));break;case _0xb8c8('0x6'):_0x18add8[_0x49ad09](_0xb8c8('0x2c'));_0x18add8[_0x49ad09](_0xb8c8('0x2d'));_0x3f50c9[_0xb8c8('0x30')](_0x3599f5['getVoiceQueues']({'attributes':['id','name']}));_0x3f50c9[_0xb8c8('0x30')](_0x3599f5[_0xb8c8('0x3b')]({'attributes':['id',_0xb8c8('0x3')]}));_0x3f50c9[_0xb8c8('0x30')](_0x3599f5[_0xb8c8('0x3c')]({'attributes':['id',_0xb8c8('0x3')]}));_0x3f50c9[_0xb8c8('0x30')](_0x3599f5['getSmsQueues']({'attributes':['id',_0xb8c8('0x3')]}));_0x3f50c9['push'](_0x3599f5['getMailQueues']({'attributes':['id',_0xb8c8('0x3')]}));_0x3f50c9[_0xb8c8('0x30')](_0x3599f5[_0xb8c8('0x3d')]({'attributes':['id',_0xb8c8('0x3')]}));_0x3f50c9['push'](_0x3599f5[_0xb8c8('0x3e')]({'attributes':['id',_0xb8c8('0x3')]}));break;}return BPromise['all'](_0x3f50c9);}})[_0xb8c8('0xc')](function(_0x5bfec7){if(_0x5bfec7&&_0x5bfec7['length']){for(var _0x4c2716=0x0;_0x4c2716<_0x5bfec7[_0xb8c8('0x1e')];_0x4c2716+=0x1){for(var _0x231765=0x0;_0x231765<_0x5bfec7[_0x4c2716]['length'];_0x231765+=0x1){switch(_0x4c2716){case 0x0:joinOrLeaveQueues(_0x18add8,_0x49ad09,_0xb8c8('0x3f'),_0x5bfec7[_0x4c2716][_0x231765]);break;case 0x1:joinOrLeaveQueues(_0x18add8,_0x49ad09,'chat',_0x5bfec7[_0x4c2716][_0x231765]);break;case 0x2:joinOrLeaveQueues(_0x18add8,_0x49ad09,_0xb8c8('0x40'),_0x5bfec7[_0x4c2716][_0x231765]);break;case 0x3:joinOrLeaveQueues(_0x18add8,_0x49ad09,_0xb8c8('0x41'),_0x5bfec7[_0x4c2716][_0x231765]);break;case 0x4:joinOrLeaveQueues(_0x18add8,_0x49ad09,_0xb8c8('0x42'),_0x5bfec7[_0x4c2716][_0x231765]);break;case 0x5:joinOrLeaveQueues(_0x18add8,_0x49ad09,'openchannel',_0x5bfec7[_0x4c2716][_0x231765]);break;case 0x6:joinOrLeaveQueues(_0x18add8,_0x49ad09,_0xb8c8('0x43'),_0x5bfec7[_0x4c2716][_0x231765]);break;case 0x7:if(_0x2b3629[_0xb8c8('0x5')]!=='agent')_0x18add8[_0x49ad09](util[_0xb8c8('0x1c')](_0xb8c8('0x44'),_0x5bfec7[_0x4c2716][_0x231765][_0xb8c8('0x3')]));break;case 0x8:if(_0x2b3629[_0xb8c8('0x5')]!==_0xb8c8('0x6'))_0x18add8[_0x49ad09](util[_0xb8c8('0x1c')]('trunk:%s',_0x5bfec7[_0x4c2716][_0x231765][_0xb8c8('0x3')]));break;case 0x9:if(_0x2b3629['role']!==_0xb8c8('0x6'))_0x18add8[_0x49ad09](util['format'](_0xb8c8('0x45'),_0x5bfec7[_0x4c2716][_0x231765][_0xb8c8('0x8')],_0x5bfec7[_0x4c2716][_0x231765][_0xb8c8('0x3')]));break;case 0xa:_0x18add8[_0x49ad09](util['format']('user:%s',_0x5bfec7[_0x4c2716][_0x231765][_0xb8c8('0x3')]));break;}}}}})['then'](function(){if(_0x49ad09===_0xb8c8('0x46')){var _0x499369=_[_0xb8c8('0x47')](_0x2b3629[_0xb8c8('0x24')],'id');return _0x2b3629['removeChatInteractions'](_0x499369)[_0xb8c8('0xc')](function(){for(var _0x431f38=0x0;_0x431f38<_0x499369[_0xb8c8('0x1e')];_0x431f38+=0x1){_0x58d7c0[_0xb8c8('0x48')](_0xb8c8('0x49'),{'ChatInteractionId':Number(_0x499369[_0x431f38]),'UserId':Number(_0x2b3629['id'])});}});}})[_0xb8c8('0xc')](function(){if(_0x49ad09===_0xb8c8('0x46')){var _0x833429=_['map'](_0x2b3629[_0xb8c8('0x4a')],'id');return _0x2b3629[_0xb8c8('0x4b')](_0x833429)['then'](function(){for(var _0x4b2e2a=0x0;_0x4b2e2a<_0x833429[_0xb8c8('0x1e')];_0x4b2e2a+=0x1){_0x58d7c0[_0xb8c8('0x48')](_0xb8c8('0x4c'),{'MailInteractionId':Number(_0x833429[_0x4b2e2a]),'UserId':Number(_0x2b3629['id'])});}});}})[_0xb8c8('0xc')](function(){if(_0x49ad09===_0xb8c8('0x46')){var _0x4c7e3f=_['map'](_0x2b3629[_0xb8c8('0x27')],'id');return _0x2b3629[_0xb8c8('0x4d')](_0x4c7e3f)[_0xb8c8('0xc')](function(){for(var _0x54c3fe=0x0;_0x54c3fe<_0x4c7e3f[_0xb8c8('0x1e')];_0x54c3fe+=0x1){_0x58d7c0[_0xb8c8('0x48')](_0xb8c8('0x4e'),{'FaxInteractionId':Number(_0x4c7e3f[_0x54c3fe]),'UserId':Number(_0x2b3629['id'])});}});}})[_0xb8c8('0xc')](function(){if(_0x49ad09===_0xb8c8('0x46')){var _0x1f88d2=_[_0xb8c8('0x47')](_0x2b3629[_0xb8c8('0x4f')],'id');return _0x2b3629['removeSmsInteractions'](_0x1f88d2)['then'](function(){for(var _0x41ed5e=0x0;_0x41ed5e<_0x1f88d2[_0xb8c8('0x1e')];_0x41ed5e+=0x1){_0x58d7c0[_0xb8c8('0x48')](_0xb8c8('0x50'),{'SmsInteractionId':Number(_0x1f88d2[_0x41ed5e]),'UserId':Number(_0x2b3629['id'])});}});}})[_0xb8c8('0xc')](function(){if(_0x49ad09===_0xb8c8('0x46')){var _0x35b2f0=_['map'](_0x2b3629[_0xb8c8('0x29')],'id');return _0x2b3629[_0xb8c8('0x51')](_0x35b2f0)[_0xb8c8('0xc')](function(){for(var _0x275d18=0x0;_0x275d18<_0x35b2f0[_0xb8c8('0x1e')];_0x275d18+=0x1){_0x58d7c0[_0xb8c8('0x48')](_0xb8c8('0x52'),{'OpenchannelInteractionId':Number(_0x35b2f0[_0x275d18]),'UserId':Number(_0x2b3629['id'])});}});}})[_0xb8c8('0xc')](function(){if(_0x49ad09===_0xb8c8('0x46')){var _0x24e9db=_[_0xb8c8('0x47')](_0x2b3629['WhatsappInteractions'],'id');return _0x2b3629[_0xb8c8('0x53')](_0x24e9db)[_0xb8c8('0xc')](function(){for(var _0x32ea51=0x0;_0x32ea51<_0x24e9db[_0xb8c8('0x1e')];_0x32ea51+=0x1){_0x58d7c0[_0xb8c8('0x48')](_0xb8c8('0x54'),{'WhatsappInteractionId':Number(_0x24e9db[_0x32ea51]),'UserId':Number(_0x2b3629['id'])});}});}})[_0xb8c8('0x55')](function(_0x14c889){_0x18add8[_0xb8c8('0x56')](_0x14c889);});}}function onDisconnect(_0x48805f,_0x1bc468){joinOrLeave(_0x48805f,_0xb8c8('0x46'),_0x1bc468);}function onConnect(_0x55605a){joinOrLeave(_0x55605a,_0xb8c8('0x57'));}exports['default']=function(_0x3c9bb4){_0x3c9bb4['on'](_0xb8c8('0x58'),function(_0x10d058){_0x10d058[_0xb8c8('0x59')](0x0);_0x10d058[_0xb8c8('0x5a')]=_0x10d058['request']['connection'][_0xb8c8('0x5b')]+':'+_0x10d058['request'][_0xb8c8('0x58')][_0xb8c8('0x5c')];_0x10d058[_0xb8c8('0x5d')]=new Date();_0x10d058[_0xb8c8('0x56')]=function(_0x27c149){console['log']('SocketIO\x20'+_0x10d058['nsp'][_0xb8c8('0x3')]+'['+_0x10d058['address']+']',_0x27c149);};_0x10d058['on'](_0xb8c8('0x5e'),function(){onDisconnect(_0x10d058,_0x3c9bb4);_0x10d058[_0xb8c8('0x56')]('DISCONNECTED');});onConnect(_0x10d058);_0x10d058[_0xb8c8('0x56')](_0xb8c8('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 4a22a11..a2a2575 100644 --- a/server/config/triggers/index.js +++ b/server/config/triggers/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x188b=['closedinteraction','ChatOfflineMessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','newmessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','direction','resolve','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','undefined','interface','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','event','offlineMessage','SIP/%s','AfterCreate','closed','substatus','User','find','fullname','default','length','hasOwnProperty','model','callback','toLowerCase','util','../logger','client','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate'];(function(_0x1fbdd1,_0x17323f){var _0x3319a2=function(_0x1fed46){while(--_0x1fed46){_0x1fbdd1['push'](_0x1fbdd1['shift']());}};_0x3319a2(++_0x17323f);}(_0x188b,0x155));var _0xb188=function(_0x294f29,_0x206152){_0x294f29=_0x294f29-0x0;var _0x4bfb82=_0x188b[_0x294f29];return _0x4bfb82;};'use strict';var util=require(_0xb188('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0xb188('0x1'))('triggers');var client=jayson[_0xb188('0x2')][_0xb188('0x3')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xb188('0x4'),'event':_0xb188('0x5'),'condition':_0xb188('0x6'),'callback':afterCreate},{'channel':_0xb188('0x7'),'model':_0xb188('0x4'),'event':_0xb188('0x8'),'condition':_0xb188('0x9'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0xb188('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb188('0x7'),'model':_0xb188('0xa'),'event':'afterCreate','condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xb188('0xb'),'event':'afterCreate','condition':_0xb188('0x6'),'callback':afterCreate},{'channel':_0xb188('0xc'),'model':'SmsInteraction','event':_0xb188('0x8'),'condition':_0xb188('0x9'),'callback':afterUpdate},{'channel':_0xb188('0xc'),'model':_0xb188('0xd'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb188('0xe'),'model':_0xb188('0xf'),'event':_0xb188('0x5'),'condition':_0xb188('0x6'),'callback':afterCreate},{'channel':_0xb188('0xe'),'model':_0xb188('0xf'),'event':_0xb188('0x8'),'condition':_0xb188('0x9'),'callback':afterUpdate},{'channel':_0xb188('0xe'),'model':_0xb188('0x10'),'event':_0xb188('0x5'),'condition':_0xb188('0x11'),'callback':afterCreateMessage},{'channel':_0xb188('0x12'),'model':_0xb188('0x13'),'event':_0xb188('0x5'),'condition':_0xb188('0x6'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0xb188('0x8'),'condition':_0xb188('0x9'),'callback':afterUpdate},{'channel':_0xb188('0x12'),'model':_0xb188('0x14'),'event':_0xb188('0x5'),'condition':_0xb188('0x11'),'callback':afterCreateMessage},{'channel':_0xb188('0x15'),'model':_0xb188('0x16'),'event':_0xb188('0x5'),'condition':_0xb188('0x6'),'callback':afterCreate},{'channel':_0xb188('0x15'),'model':_0xb188('0x16'),'event':_0xb188('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xb188('0x15'),'model':_0xb188('0x17'),'event':_0xb188('0x5'),'condition':_0xb188('0x11'),'callback':afterCreateMessage},{'channel':_0xb188('0x18'),'model':_0xb188('0x19'),'event':_0xb188('0x5'),'condition':_0xb188('0x6'),'callback':afterCreate},{'channel':_0xb188('0x18'),'model':_0xb188('0x19'),'event':_0xb188('0x8'),'condition':_0xb188('0x9'),'callback':afterUpdate},{'channel':_0xb188('0x18'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0xb188('0x11'),'callback':afterCreateMessage}];function request(_0x2b541f){return client[_0xb188('0x1a')](_0xb188('0x1b'),_0x2b541f)[_0xb188('0x1c')](function(_0x408426){logger[_0xb188('0x1d')](_0xb188('0x1e'),_0xb188('0x1b'),_0x408426);if(_0x408426[_0xb188('0x1f')]){if(_0x408426[_0xb188('0x1f')][_0xb188('0x20')]===0x1f4){logger['error'](_0xb188('0x1e'),'EventManager',_0x408426['error']);}}})[_0xb188('0x21')](function(_0x560b9f){logger[_0xb188('0x1f')](_0xb188('0x1e'),'EventManager',_0x560b9f);});}function afterCreateMessage(_0x40505b){return function(_0x21cdfd){_0x21cdfd=_0x21cdfd[_0xb188('0x22')]({'plain':!![]});_0x21cdfd[_0xb188('0x23')]=_0x40505b;_0x21cdfd[_0xb188('0x24')]=_0x40505b;_0x21cdfd['event']=_0x21cdfd[_0xb188('0x25')];Promise[_0xb188('0x26')]()[_0xb188('0x1c')](function(){if(typeof _0x21cdfd[_0xb188('0x27')]==='undefined')return null;var _0x3027fc=_0xb188('0x28')+_0x21cdfd[_0xb188('0x27')];return db[_0xb188('0x29')][_0xb188('0x2a')](_0x3027fc,{'type':db[_0xb188('0x2b')][_0xb188('0x2c')][_0xb188('0x2d')],'raw':!![]});})[_0xb188('0x1c')](function(_0x584397){if(_0x584397){_0x21cdfd[_0xb188('0x2e')]=_0x584397[0x0];}if(typeof _0x21cdfd[_0xb188('0x2f')]===_0xb188('0x30'))return;return getAgent(_0x21cdfd[_0xb188('0x2f')]);})[_0xb188('0x1c')](function(_0x1ebec7){if(_0x1ebec7){_0x21cdfd[_0xb188('0x31')]=util['format']('SIP/%s',_0x1ebec7[_0xb188('0x32')]);_0x21cdfd[_0xb188('0x33')]=_0x1ebec7;_0x21cdfd[_0xb188('0x23')]=_0x40505b;return request({'event':_0xb188('0x34'),'message':_0x21cdfd});}else{return request({'event':_0xb188('0x35'),'message':_0x21cdfd});}})[_0xb188('0x21')](function(_0x1c05e4){logger[_0xb188('0x1f')](_0xb188('0x1e'),_0xb188('0x36'),_0x1c05e4);});};}function afterCreateOfflineMessage(_0xd0b45d){return function(_0x161ac0){_0x161ac0=_0x161ac0[_0xb188('0x22')]({'plain':!![]});_0x161ac0[_0xb188('0x23')]=_0xd0b45d;_0x161ac0[_0xb188('0x24')]=_0xd0b45d;_0x161ac0[_0xb188('0x37')]=_0xb188('0x38');return request({'event':_0x161ac0['event'],'message':_0x161ac0});};}function afterCreate(_0x565a5f,_0x1ea280){return function(_0x580489){_0x580489=_0x580489[_0xb188('0x22')]({'plain':!![]});_0x580489[_0xb188('0x23')]=_0x565a5f;_0x580489[_0xb188('0x24')]=_0x565a5f;_0x580489[_0xb188('0x37')]='opened';Promise[_0xb188('0x26')]()[_0xb188('0x1c')](function(){var _0x1c8f81=_0xb188('0x28')+_0x580489[_0xb188('0x27')];return db[_0xb188('0x29')][_0xb188('0x2a')](_0x1c8f81,{'type':db[_0xb188('0x2b')]['QueryTypes']['SELECT'],'raw':!![]});})[_0xb188('0x1c')](function(_0x34cba5){if(_0x34cba5){_0x580489[_0xb188('0x2e')]=_0x34cba5[0x0];}if(typeof _0x580489[_0xb188('0x2f')]===_0xb188('0x30'))return;return getAgent(_0x580489[_0xb188('0x2f')]);})[_0xb188('0x1c')](function(_0x35f534){if(_0x35f534){_0x580489['interface']=util['format'](_0xb188('0x39'),_0x35f534['name']);_0x580489[_0xb188('0x33')]=_0x35f534;}return request({'event':_0x1ea280,'message':_0x580489});})['catch'](function(_0x458115){logger['error']('Trigger,\x20%s',_0xb188('0x3a'),_0x458115);});};}function afterUpdate(_0x56f1d1){return function(_0x2cb89d){var _0x15476b=_0x2cb89d['changed'](_0xb188('0x3b'))&&_0x2cb89d[_0xb188('0x3b')];var _0x54a228=_0x2cb89d['changed'](_0xb188('0x3c'));if(_0x15476b||_0x54a228){var _0x4e090b=_0x15476b?'closedinteraction':_0xb188('0x3c');var _0x32980b=_0x2cb89d[_0xb188('0x22')]({'plain':!![]});_0x32980b['channel']=_0x56f1d1;_0x32980b[_0xb188('0x24')]=_0x56f1d1;_0x32980b[_0xb188('0x37')]=_0x15476b?'closed':_0xb188('0x3c');var _0x478812=_0xb188('0x28')+_0x32980b[_0xb188('0x27')];return db['sequelize'][_0xb188('0x2a')](_0x478812,{'type':db['Sequelize'][_0xb188('0x2c')][_0xb188('0x2d')],'raw':!![]})[_0xb188('0x1c')](function(_0xb5bf66){if(_0xb5bf66){_0x32980b[_0xb188('0x2e')]=_0xb5bf66[0x0];}if(typeof _0x32980b['UserId']===_0xb188('0x30'))return;return getAgent(_0x32980b[_0xb188('0x2f')]);})[_0xb188('0x1c')](function(_0x2cfd37){if(_0x2cfd37){_0x32980b[_0xb188('0x31')]=util['format']('SIP/%s',_0x2cfd37[_0xb188('0x32')]);_0x32980b[_0xb188('0x33')]=_0x2cfd37;}return request({'event':_0x4e090b,'message':_0x32980b});})[_0xb188('0x21')](function(_0x8e7de9){logger[_0xb188('0x1f')](_0xb188('0x1e'),'AfterUpdate',_0x8e7de9);});}};}function getAgent(_0x5c7f81){return db[_0xb188('0x3d')][_0xb188('0x3e')]({'where':{'id':_0x5c7f81},'attributes':['id',_0xb188('0x32'),_0xb188('0x3f'),'email','internal'],'raw':!![]})[_0xb188('0x1c')](function(_0x2bb338){return _0x2bb338;});}exports[_0xb188('0x40')]=function(){for(var _0x538877=0x0;_0x538877=_0x5586d5[_0xed24('0x12')]){throw Error(_0xed24('0x13'));}_0x177239(_0x57ce9e);})['catch'](function(_0xbb78a2){_0x57fc98(_0xbb78a2);});});}; \ No newline at end of file +var _0xff69=['lodash','bluebird','mail','chat','sms','getChannels','isValidChannel','toLowerCase','blockedAt','updateAttributes','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch'];(function(_0x2ae2cd,_0xb42c96){var _0xc52725=function(_0x4dda00){while(--_0x4dda00){_0x2ae2cd['push'](_0x2ae2cd['shift']());}};_0xc52725(++_0xb42c96);}(_0xff69,0xb4));var _0x9ff6=function(_0x3beea0,_0x416691){_0x3beea0=_0x3beea0-0x0;var _0x314eb1=_0xff69[_0x3beea0];return _0x314eb1;};'use strict';var _=require(_0x9ff6('0x0'));var BPromise=require(_0x9ff6('0x1'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0x9ff6('0x2'),_0x9ff6('0x3'),'fax',_0x9ff6('0x4'),'whatsapp','openchannel'];exports[_0x9ff6('0x5')]=function(){return channels;};exports[_0x9ff6('0x6')]=function(_0x2a4782){_0x2a4782=_0x2a4782[_0x9ff6('0x7')]();return _['includes'](channels,_0x2a4782);};exports['clearBlockUser']=function(_0x82a84b,_0x6f6641,_0x34719b,_0x1b2cde){var _0xb3fa59={'loginAttempts':_0x6f6641,'blocked':_0x34719b};if(!_['isUndefined'](_0x1b2cde)){_0xb3fa59[_0x9ff6('0x8')]=_0x1b2cde;}return _0x82a84b[_0x9ff6('0x9')](_0xb3fa59);};exports[_0x9ff6('0xa')]=function(_0x249d10){return new BPromise(function(_0x55385e,_0x3cae19){var _0x2d67dc=0x0;if(_0x249d10['role']!==_0x9ff6('0xb')){_0x55385e(_0x249d10);}db[_0x9ff6('0xc')][_0x9ff6('0xd')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x249d10['id']}}})[_0x9ff6('0xe')](function(_0x11321c){_0x2d67dc=_0x11321c;return util[_0x9ff6('0xa')]();})[_0x9ff6('0xe')](function(_0x994d0a){if(_0x994d0a&&_0x994d0a[_0x9ff6('0xf')]&&_0x2d67dc>=_0x994d0a[_0x9ff6('0xf')]){throw Error(_0x9ff6('0x10'));}_0x55385e(_0x249d10);})[_0x9ff6('0x11')](function(_0x2b1057){_0x3cae19(_0x2b1057);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 2ad4f12..9d38b32 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81f5=['exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Bad\x20Request','inherits','Forbidden','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','Resource\x20Conflict','Conflict','error','stack','send'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x81f5,0xde));var _0x581f=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x81f5[_0x4fc9e6];return _0x551d28;};'use strict';var util=require(_0x581f('0x0'));var logger=require(_0x581f('0x1'))(_0x581f('0x2'));var APIError=function(_0x32bc7a,_0xcfcce2){this[_0x581f('0x3')]=_0x32bc7a||_0x581f('0x4');this[_0x581f('0x5')]=_0xcfcce2||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x2068d3){this[_0x581f('0x3')]=_0x2068d3||'Bad\x20Request';this[_0x581f('0x5')]=_0x581f('0x6');util[_0x581f('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x1c2914){this[_0x581f('0x3')]=_0x1c2914||_0x581f('0x8');this[_0x581f('0x5')]=_0x581f('0x8');util[_0x581f('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x10340d){this[_0x581f('0x3')]=_0x10340d||'Entity\x20not\x20found';this[_0x581f('0x5')]='Not\x20Found';util[_0x581f('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3e0de0){this[_0x581f('0x3')]=_0x3e0de0||_0x581f('0x9');this['name']=_0x581f('0xa');this['code']=0x193;this['details']={'type':'OutOfInterval'};util[_0x581f('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1af694){this['message']=_0x1af694||_0x581f('0xb');this[_0x581f('0x5')]=_0x581f('0xc');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x499d89){switch(_0x499d89){case _0x581f('0x6'):return 0x190;case'Forbidden',_0x581f('0xa'):return 0x193;case'Not\x20Found':return 0x194;case _0x581f('0xc'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x4ccf70){if(_0x4ccf70===_0x581f('0xa'))return _0x4ccf70;return null;}function handleError(_0x199928){return function(_0xfa78c0){logger[_0x581f('0xd')](_0xfa78c0[_0x581f('0xe')]);var _0x57ac58=getStatusCode(_0xfa78c0[_0x581f('0x5')]);var _0x217204=getCustomStatusMessage(_0xfa78c0[_0x581f('0x5')]);if(_0xfa78c0[_0x581f('0x5')]){delete _0xfa78c0[_0x581f('0x5')];}if(_0x217204){_0x199928['statusMessage']=_0x217204;}return _0x199928['status'](_0x57ac58)[_0x581f('0xf')](_0xfa78c0);};}module[_0x581f('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xe54a=['OutOfInterval','Resource\x20Conflict','Conflict','Not\x20Found','error','stack','status','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details'];(function(_0x165058,_0x588547){var _0x5d2125=function(_0x410328){while(--_0x410328){_0x165058['push'](_0x165058['shift']());}};_0x5d2125(++_0x588547);}(_0xe54a,0xc0));var _0xae54=function(_0x130658,_0x379a65){_0x130658=_0x130658-0x0;var _0x3a19c8=_0xe54a[_0x130658];return _0x3a19c8;};'use strict';var util=require(_0xae54('0x0'));var logger=require(_0xae54('0x1'))(_0xae54('0x2'));var APIError=function(_0x1456e4,_0x3285b8){this[_0xae54('0x3')]=_0x1456e4||_0xae54('0x4');this[_0xae54('0x5')]=_0x3285b8||_0xae54('0x6');util[_0xae54('0x7')](APIError,Error);};var APIBadRequestError=function(_0x132c9e){this[_0xae54('0x3')]=_0x132c9e||'Bad\x20Request';this[_0xae54('0x5')]=_0xae54('0x8');util[_0xae54('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x28cdc2){this[_0xae54('0x3')]=_0x28cdc2||_0xae54('0x9');this[_0xae54('0x5')]=_0xae54('0x9');util[_0xae54('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x4ff39f){this[_0xae54('0x3')]=_0x4ff39f||_0xae54('0xa');this[_0xae54('0x5')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2a5ffe){this[_0xae54('0x3')]=_0x2a5ffe||_0xae54('0xb');this['name']=_0xae54('0xc');this[_0xae54('0xd')]=0x193;this[_0xae54('0xe')]={'type':_0xae54('0xf')};util[_0xae54('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x3b8aff){this[_0xae54('0x3')]=_0x3b8aff||_0xae54('0x10');this['name']=_0xae54('0x11');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0xe9c5a6){switch(_0xe9c5a6){case'Bad\x20Request':return 0x190;case _0xae54('0x9'),_0xae54('0xc'):return 0x193;case _0xae54('0x12'):return 0x194;case _0xae54('0x11'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x2ce1cd){if(_0x2ce1cd===_0xae54('0xc'))return _0x2ce1cd;return null;}function handleError(_0x3d2a5a){return function(_0x2dad97){logger[_0xae54('0x13')](_0x2dad97[_0xae54('0x14')]);var _0x5ec3fb=getStatusCode(_0x2dad97['name']);var _0x259397=getCustomStatusMessage(_0x2dad97['name']);if(_0x2dad97[_0xae54('0x5')]){delete _0x2dad97[_0xae54('0x5')];}if(_0x259397){_0x3d2a5a['statusMessage']=_0x259397;}return _0x3d2a5a[_0xae54('0x15')](_0x5ec3fb)['send'](_0x2dad97);};}module[_0xae54('0x16')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index aab7c0f..ba353ca 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf042=['404','status','render','json','exports'];(function(_0x325679,_0x2781cd){var _0x3766b5=function(_0x4862c0){while(--_0x4862c0){_0x325679['push'](_0x325679['shift']());}};_0x3766b5(++_0x2781cd);}(_0xf042,0xfe));var _0x2f04=function(_0x2bb900,_0x4692de){_0x2bb900=_0x2bb900-0x0;var _0x45e67d=_0xf042[_0x2bb900];return _0x45e67d;};'use strict';module[_0x2f04('0x0')][0x194]=function pageNotFound(_0x26caf9,_0x2b7457){var _0x4c1001=_0x2f04('0x1');var _0x4a3849=0x194;var _0x34389f={'status':_0x4a3849};_0x2b7457[_0x2f04('0x2')](_0x34389f[_0x2f04('0x2')]);_0x2b7457[_0x2f04('0x3')](_0x4c1001,{},function(_0x14503d,_0x492a1c){if(_0x14503d){return _0x2b7457[_0x2f04('0x2')](_0x34389f[_0x2f04('0x2')])[_0x2f04('0x4')](_0x34389f);}_0x2b7457['send'](_0x492a1c);});}; \ No newline at end of file +var _0xc3af=['json','send','exports','status'];(function(_0xb4ea1b,_0x3341d2){var _0x93c2b1=function(_0x3b5b87){while(--_0x3b5b87){_0xb4ea1b['push'](_0xb4ea1b['shift']());}};_0x93c2b1(++_0x3341d2);}(_0xc3af,0x112));var _0xfc3a=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0xc3af[_0x3d9b04];return _0x557936;};'use strict';module[_0xfc3a('0x0')][0x194]=function pageNotFound(_0x18df52,_0x5eabe6){var _0x432fb2='404';var _0x2bac90=0x194;var _0x598e1e={'status':_0x2bac90};_0x5eabe6['status'](_0x598e1e[_0xfc3a('0x1')]);_0x5eabe6['render'](_0x432fb2,{},function(_0x36d94d,_0x3692e1){if(_0x36d94d){return _0x5eabe6[_0xfc3a('0x1')](_0x598e1e['status'])[_0xfc3a('0x2')](_0x598e1e);}_0x5eabe6[_0xfc3a('0x3')](_0x3692e1);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 9157bad..a0df749 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcdc=['ChatWebsite','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','List','Items','FaxAccountId','Interactions','Exntensions','FaxApplication','FaxQueue','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','ChatOfflineMessage','team_has_chat_queues','ChatInternalMessage','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','CampaignId','OwnerId','Condition','All','OneAny','AutomationAnyId','Action','AutomationId','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','AnalyticCustomReport','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemTypeId','CmHopperId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','TriggerId','Fields','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','FieldId','VariableId','SugarcrmField','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','ServicenowField','FreshsalesField','FromId','ToId','SessionId','ProjectId','team_has_mail_queues','ChatQueues','team_has_whatsapp_queues','TeamVoicePrefix','TrunkBackupId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_interactions','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','database','password','options','username','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxMessage','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','userSetting','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','SmsInteractions','FaxInteraction','MailInteractions','UserNotifications','SenderId','CmHopper','SET\x20NULL','belongsTo','userProfileId','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueue','MailQueues','UserChatQueue','SmsQueues','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','ListId','TemplateId','mandatoryDispositionPause','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailMessage','Interaction'];(function(_0xc358e8,_0x46a6e0){var _0x4b214d=function(_0x27f751){while(--_0x27f751){_0xc358e8['push'](_0xc358e8['shift']());}};_0x4b214d(++_0x46a6e0);}(_0xdcdc,0x8f));var _0xcdcd=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdcdc[_0x502c7d];return _0x30b7ed;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xcdcd('0x0'));var _=require(_0xcdcd('0x1'));var jstz=require(_0xcdcd('0x2'));var timezone=jstz[_0xcdcd('0x3')]();config[_0xcdcd('0x0')]=_[_0xcdcd('0x4')](config[_0xcdcd('0x0')],{'database':_0xcdcd('0x5'),'username':_0xcdcd('0x6'),'password':_0xcdcd('0x7'),'options':{'host':_0xcdcd('0x8'),'port':0xcea,'dialect':_0xcdcd('0x9'),'dialectOptions':{'charset':_0xcdcd('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xcdcd('0xb')}}});config[_0xcdcd('0xc')]=_[_0xcdcd('0x4')](config[_0xcdcd('0xc')],{'database':_0xcdcd('0x5'),'username':_0xcdcd('0x6'),'password':'xC@LL1234','options':{'host':_0xcdcd('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xcdcd('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcdcd('0x0')][_0xcdcd('0xd')],config[_0xcdcd('0x0')]['username'],config[_0xcdcd('0x0')][_0xcdcd('0xe')],config[_0xcdcd('0x0')][_0xcdcd('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcdcd('0xc')][_0xcdcd('0xd')],config['sequelizeHistory'][_0xcdcd('0x10')],config['sequelizeHistory'][_0xcdcd('0xe')],config[_0xcdcd('0xc')]['options'])};db['User']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x12'));db[_0xcdcd('0x13')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x14'));db[_0xcdcd('0x15')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/voiceContext/voiceContext.model');db[_0xcdcd('0x16')]=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db[_0xcdcd('0x17')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xcdcd('0x18')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x19'));db[_0xcdcd('0x1a')]=db['sequelize']['import']('../api/voiceRecording/voiceRecording.model');db[_0xcdcd('0x1b')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/screenRecording/screenRecording.model');db[_0xcdcd('0x1c')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x1d'));db[_0xcdcd('0x1e')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x1f'));db[_0xcdcd('0x20')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x21'));db[_0xcdcd('0x22')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x23'));db[_0xcdcd('0x24')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x25'));db[_0xcdcd('0x26')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x27'));db[_0xcdcd('0x28')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x29'));db[_0xcdcd('0x2a')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x2b'));db[_0xcdcd('0x2c')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x2d'));db[_0xcdcd('0x2e')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x2f'));db['UserVoiceQueue']=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x30'));db['UserChatQueue']=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x31'));db[_0xcdcd('0x32')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x33'));db[_0xcdcd('0x34')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x35'));db[_0xcdcd('0x36')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x37'));db[_0xcdcd('0x38')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x39'));db[_0xcdcd('0x3a')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x3b'));db[_0xcdcd('0x3c')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x3d'));db[_0xcdcd('0x3e')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x3f'));db[_0xcdcd('0x40')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x41'));db['MailQueue']=db[_0xcdcd('0x0')]['import']('../api/mailQueue/mailQueue.model');db[_0xcdcd('0x42')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x43'));db[_0xcdcd('0x44')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x45'));db['MailMessage']=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x46'));db[_0xcdcd('0x47')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x48'));db['MailQueueReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x49'));db[_0xcdcd('0x4a')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/dashboard/dashboard.model');db[_0xcdcd('0x4b')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x4c'));db[_0xcdcd('0x4d')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x4e'));db['FaxApplication']=db['sequelize'][_0xcdcd('0x11')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/faxInteraction/faxInteraction.model');db[_0xcdcd('0x4f')]=db['sequelize'][_0xcdcd('0x11')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/faxQueue/faxQueue.model');db[_0xcdcd('0x50')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x51'));db['SmsAccount']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x52'));db[_0xcdcd('0x53')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x54'));db[_0xcdcd('0x55')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0xcdcd('0x0')]['import']('../api/smsMessage/smsMessage.model');db[_0xcdcd('0x56')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x57'));db[_0xcdcd('0x58')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x59'));db['OpenchannelApplication']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x5a'));db['OpenchannelInteraction']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x5b'));db[_0xcdcd('0x5c')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x5d'));db[_0xcdcd('0x5e')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x5f'));db['ChatWebsite']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x60'));db[_0xcdcd('0x61')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x62'));db[_0xcdcd('0x63')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x64'));db[_0xcdcd('0x65')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xcdcd('0x66')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x67'));db[_0xcdcd('0x68')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x69'));db[_0xcdcd('0x6a')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x6b'));db[_0xcdcd('0x6c')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x6d'));db[_0xcdcd('0x6e')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x6f'));db['CmHopper']=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x70'));db[_0xcdcd('0x71')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x72'));db[_0xcdcd('0x73')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x74'));db[_0xcdcd('0x75')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x76'));db[_0xcdcd('0x77')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x78'));db[_0xcdcd('0x79')]=db['sequelize']['import'](_0xcdcd('0x7a'));db['Action']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/action/action.model');db[_0xcdcd('0x7b')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x7c'));db[_0xcdcd('0x7d')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x7e'));db[_0xcdcd('0x7f')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x80'));db['Condition']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x81'));db[_0xcdcd('0x82')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x83'));db[_0xcdcd('0x84')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x85'));db['Cdr']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x86'));db[_0xcdcd('0x87')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xcdcd('0x88')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x89'));db[_0xcdcd('0x8a')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x8b'));db[_0xcdcd('0x8c')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x8d'));db[_0xcdcd('0x8e')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x8f'));db[_0xcdcd('0x90')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x91'));db[_0xcdcd('0x92')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x93'));db[_0xcdcd('0x94')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x95'));db[_0xcdcd('0x96')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x97'));db[_0xcdcd('0x98')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x99'));db[_0xcdcd('0x9a')]=db[_0xcdcd('0x0')]['import']('../api/integration/integration.model');db[_0xcdcd('0x9b')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x9c'));db['AnalyticCustomReport']=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x9d'));db['AnalyticDefaultReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x9e'));db['AnalyticExtractedReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x9f'));db[_0xcdcd('0xa0')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xa1'));db[_0xcdcd('0xa2')]=db['sequelize']['import'](_0xcdcd('0xa3'));db[_0xcdcd('0xa4')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xa5'));db[_0xcdcd('0xa6')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xa7'));db[_0xcdcd('0xa8')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xa9'));db[_0xcdcd('0xaa')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/intSalesforceField/intSalesforceField.model');db[_0xcdcd('0xab')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xac'));db[_0xcdcd('0xad')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xae'));db['SugarcrmField']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xaf'));db[_0xcdcd('0xb0')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/intDeskAccount/intDeskAccount.model');db[_0xcdcd('0xb1')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xcdcd('0xb2')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xb3'));db[_0xcdcd('0xb4')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xb5'));db['ZohoConfiguration']=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xb6'));db[_0xcdcd('0xb7')]=db[_0xcdcd('0x0')]['import']('../api/intZohoField/intZohoField.model');db[_0xcdcd('0xb8')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xb9'));db[_0xcdcd('0xba')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xbb'));db[_0xcdcd('0xbc')]=db['sequelize'][_0xcdcd('0x11')]('../api/intZendeskField/intZendeskField.model');db[_0xcdcd('0xbd')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xbe'));db[_0xcdcd('0xbf')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xc0'));db[_0xcdcd('0xc1')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xc2'));db['VtigerAccount']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xc3'));db[_0xcdcd('0xc4')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xc5'));db[_0xcdcd('0xc6')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xc7'));db[_0xcdcd('0xc8')]=db['sequelize'][_0xcdcd('0x11')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0xcdcd('0x0')]['import']('../api/intServicenowField/intServicenowField.model');db[_0xcdcd('0xc9')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xca'));db[_0xcdcd('0xcb')]=db['sequelize']['import'](_0xcdcd('0xcc'));db[_0xcdcd('0xcd')]=db['sequelize'][_0xcdcd('0x11')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xcdcd('0xce')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xcf'));db[_0xcdcd('0xd0')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xd1'));db['FreshsalesField']=db[_0xcdcd('0x0')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0xcdcd('0x9a')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xd2'));db[_0xcdcd('0xd3')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/network/network.model');db[_0xcdcd('0xd4')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xd5'));db['ChatInternalMessage']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xcdcd('0xd6')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xcdcd('0xd7')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xd8'));db[_0xcdcd('0xd9')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xcdcd('0xda')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xdb'));db[_0xcdcd('0xdc')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xdd'));db[_0xcdcd('0xde')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/jscriptyProject/jscriptyProject.model');db[_0xcdcd('0xdf')]=db['sequelize'][_0xcdcd('0x11')]('../api/setting/setting.model');db[_0xcdcd('0xe0')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xe1'));db[_0xcdcd('0xe2')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xe3'));db['SquareRecording']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/squareRecording/squareRecording.model');db[_0xcdcd('0xe4')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xe5'));db[_0xcdcd('0xe6')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xe7'));db['License']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xe8'));db[_0xcdcd('0xe9')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/campaign/campaign.model');db['Migration']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xea'));db[_0xcdcd('0xeb')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xec'));db['Plugin']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xed'));db[_0xcdcd('0xee')]=db[_0xcdcd('0x0')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0xcdcd('0xef')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xf0'));db['FaxTransferReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xf1'));db['OpenchannelTransferReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xcdcd('0xf2')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0xcdcd('0xf3')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xf4'));db[_0xcdcd('0xf5')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xf6'));db[_0xcdcd('0xf7')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/userProfile/userProfile.model');db[_0xcdcd('0xf8')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xf9'));db[_0xcdcd('0xfa')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xfb'));db[_0xcdcd('0xfc')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xfd'));db[_0xcdcd('0xfe')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xff'));db['WhatsappApplication']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x100'));db[_0xcdcd('0x101')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x102'));db[_0xcdcd('0x103')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x104'));db['WhatsappQueueReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xcdcd('0x105')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x106'));db[_0xcdcd('0x107')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x108'));db[_0xcdcd('0x109')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x10a'));db[_0xcdcd('0x10b')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x10c'));db['TeamVoicePrefix']=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x10d'));db[_0xcdcd('0x10e')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x10f'));db[_0xcdcd('0x110')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x111'));db[_0xcdcd('0x112')][_0xcdcd('0x113')](db[_0xcdcd('0x1c')],{'as':_0xcdcd('0x1c'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x113')](db[_0xcdcd('0x110')],{'as':_0xcdcd('0x116'),'onDelete':'cascade','foreignKey':'UserId'});db[_0xcdcd('0x112')]['hasMany'](db[_0xcdcd('0x1a')],{'as':_0xcdcd('0x117'),'foreignKey':'UserId'});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x2e')],{'as':_0xcdcd('0x119'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x16')],{'as':_0xcdcd('0x11a'),'onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x112')]['hasMany'](db[_0xcdcd('0x73')],{'as':_0xcdcd('0x11b'),'foreignKey':_0xcdcd('0x115')});db['User'][_0xcdcd('0x118')](db[_0xcdcd('0x75')],{'as':_0xcdcd('0x11c'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')]['hasMany'](db[_0xcdcd('0x77')],{'as':_0xcdcd('0x77'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x11d')],{'as':_0xcdcd('0x11e'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x63')],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x55')],{'as':_0xcdcd('0x11f'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')]['hasMany'](db[_0xcdcd('0x120')],{'as':'FaxInteractions','foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')]['hasMany'](db[_0xcdcd('0x44')],{'as':_0xcdcd('0x121'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x101')],{'as':'WhatsappInteractions','foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0xfc')],{'as':_0xcdcd('0x122'),'foreignKey':_0xcdcd('0x123')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x124')],{'as':'Hoppers','foreignKey':_0xcdcd('0x115'),'onDelete':_0xcdcd('0x125')});db[_0xcdcd('0x112')][_0xcdcd('0x126')](db[_0xcdcd('0xf7')],{'as':_0xcdcd('0xf7'),'foreignKey':_0xcdcd('0x127')});db[_0xcdcd('0x112')]['belongsToMany'](db[_0xcdcd('0x68')],{'as':'Groups','through':_0xcdcd('0x128')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x12a'),'through':_0xcdcd('0x12b')});db[_0xcdcd('0x112')]['belongsToMany'](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x12c'),'through':_0xcdcd('0x12d')});db['User'][_0xcdcd('0x129')](db[_0xcdcd('0xe6')],{'through':_0xcdcd('0x12e')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db['MailInteraction'],{'as':'MailInteractions','through':_0xcdcd('0x12f')});db['User'][_0xcdcd('0x129')](db[_0xcdcd('0x63')],{'as':_0xcdcd('0x130'),'through':'user_has_chat_interactions'});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db['FaxInteraction'],{'as':_0xcdcd('0x131'),'through':_0xcdcd('0x132')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x55')],{'as':_0xcdcd('0x11f'),'through':_0xcdcd('0x133')});db['User']['belongsToMany'](db[_0xcdcd('0x11d')],{'as':_0xcdcd('0x11e'),'through':_0xcdcd('0x134')});db['User']['belongsToMany'](db[_0xcdcd('0x101')],{'as':_0xcdcd('0x135'),'through':'user_has_whatsapp_interactions'});db['User'][_0xcdcd('0x129')](db[_0xcdcd('0x18')],{'as':_0xcdcd('0x136'),'through':_0xcdcd('0x137'),'required':![]});db[_0xcdcd('0x112')]['belongsToMany'](db[_0xcdcd('0xf5')],{'as':_0xcdcd('0x138'),'through':'UserVoicePrefix','required':![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x139')],{'as':_0xcdcd('0x13a'),'through':_0xcdcd('0x32'),'required':![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db['ChatQueue'],{'as':'ChatQueues','through':_0xcdcd('0x13b'),'required':![],'hooks':!![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db['FaxQueue'],{'as':'FaxQueues','through':_0xcdcd('0x34'),'required':![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db['SmsQueue'],{'as':_0xcdcd('0x13c'),'through':_0xcdcd('0x36'),'required':![]});db['User']['belongsToMany'](db[_0xcdcd('0x5e')],{'as':'OpenchannelQueues','through':_0xcdcd('0x38'),'required':![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x107')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0xf3')],{'through':_0xcdcd('0x12d')});db[_0xcdcd('0x112')]['belongsToMany'](db['ChatWebsite'],{'as':_0xcdcd('0x13d'),'through':_0xcdcd('0x13e')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x4d')],{'as':'FaxAccounts','through':_0xcdcd('0x13f')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x40')],{'as':'MailAccounts','through':_0xcdcd('0x140')});db['User'][_0xcdcd('0x129')](db[_0xcdcd('0x58')],{'as':_0xcdcd('0x141'),'through':'user_has_openchannel_accounts'});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x142')],{'as':_0xcdcd('0x143'),'through':_0xcdcd('0x144')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0xfe')],{'as':_0xcdcd('0x145'),'through':_0xcdcd('0x146')});db[_0xcdcd('0x13')]['hasMany'](db['VoiceExtension'],{'as':_0xcdcd('0x147'),'onDelete':'cascade','foreignKey':_0xcdcd('0x148')});db[_0xcdcd('0x15')][_0xcdcd('0x118')](db[_0xcdcd('0x16')],{'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x16')][_0xcdcd('0x118')](db[_0xcdcd('0x16')],{'as':_0xcdcd('0x149'),'onDelete':'cascade'});db[_0xcdcd('0x17')][_0xcdcd('0x129')](db[_0xcdcd('0x8a')],{'as':_0xcdcd('0x14a'),'through':'moh_has_sounds'});db[_0xcdcd('0x18')][_0xcdcd('0x118')](db['UserVoiceQueueRt'],{'as':_0xcdcd('0x14b'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')][_0xcdcd('0x118')](db[_0xcdcd('0x124')],{'as':_0xcdcd('0x14d'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')][_0xcdcd('0x118')](db['CmHopperFinal'],{'as':_0xcdcd('0x11b'),'foreignKey':_0xcdcd('0x14c')});db['VoiceQueue'][_0xcdcd('0x118')](db[_0xcdcd('0x75')],{'as':_0xcdcd('0x14e'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')]['hasMany'](db[_0xcdcd('0x77')],{'as':_0xcdcd('0x77'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')][_0xcdcd('0x118')](db[_0xcdcd('0x71')],{'as':_0xcdcd('0x14f'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')][_0xcdcd('0x118')](db[_0xcdcd('0xd9')],{'as':_0xcdcd('0x150'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')]['belongsTo'](db[_0xcdcd('0x2a')],{'as':_0xcdcd('0x2a'),'foreignKey':_0xcdcd('0x151')});db[_0xcdcd('0x18')][_0xcdcd('0x126')](db['Trunk'],{'as':_0xcdcd('0x152'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0xcdcd('0x126')](db['Interval'],{'as':_0xcdcd('0x82'),'foreignKey':_0xcdcd('0x153')});db['VoiceQueue'][_0xcdcd('0x126')](db[_0xcdcd('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0xcdcd('0x154')});db['VoiceQueue'][_0xcdcd('0x129')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x12c'),'through':_0xcdcd('0x155')});db['VoiceQueue']['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x137')});db[_0xcdcd('0x18')][_0xcdcd('0x129')](db['Team'],{'as':_0xcdcd('0x157'),'through':_0xcdcd('0x10b')});db[_0xcdcd('0x18')][_0xcdcd('0x129')](db[_0xcdcd('0xf3')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xcdcd('0x1a')][_0xcdcd('0x126')](db['User'],{'as':_0xcdcd('0x112'),'foreignKey':_0xcdcd('0x115')});db['ScreenRecording'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':'User','foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x1c')][_0xcdcd('0x118')](db['VoiceMailMessage'],{'as':_0xcdcd('0x158'),'onDelete':_0xcdcd('0x114'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0xcdcd('0x159'),'targetKey':_0xcdcd('0x15a')});db[_0xcdcd('0x20')][_0xcdcd('0x118')](db['VoiceQueueReport'],{'as':_0xcdcd('0x15b'),'foreignKey':_0xcdcd('0x15c'),'constraints':![]});db[_0xcdcd('0x20')][_0xcdcd('0x118')](db[_0xcdcd('0x24')],{'as':_0xcdcd('0x15d'),'foreignKey':_0xcdcd('0x15c'),'constraints':![]});db['VoiceCallReport'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x112'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x20')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x3c')][_0xcdcd('0x126')](db['MailAccount'],{'as':_0xcdcd('0x40'),'foreignKey':_0xcdcd('0x160')});db[_0xcdcd('0x3c')][_0xcdcd('0x126')](db['CloudProvider'],{'as':_0xcdcd('0x109'),'foreignKey':_0xcdcd('0x161'),'onDelete':_0xcdcd('0x162')});db['MailServerOut']['belongsTo'](db[_0xcdcd('0x40')],{'as':_0xcdcd('0x40'),'foreignKey':'MailAccountId'});db[_0xcdcd('0x3e')][_0xcdcd('0x126')](db['CloudProvider'],{'as':_0xcdcd('0x109'),'foreignKey':'CloudProviderId','onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x40')]['hasOne'](db['MailServerIn'],{'as':_0xcdcd('0x163'),'onDelete':'cascade'});db['MailAccount'][_0xcdcd('0x113')](db['MailServerOut'],{'as':_0xcdcd('0x164'),'onDelete':'cascade'});db[_0xcdcd('0x40')][_0xcdcd('0x118')](db['Disposition'],{'as':_0xcdcd('0x165'),'foreignKey':'MailAccountId','onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x40')][_0xcdcd('0x118')](db[_0xcdcd('0x7d')],{'as':_0xcdcd('0x166'),'foreignKey':_0xcdcd('0x160')});db[_0xcdcd('0x40')][_0xcdcd('0x118')](db['MailMessage'],{'as':_0xcdcd('0x158'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xcdcd('0x118')](db[_0xcdcd('0x44')],{'as':'Interactions'});db['MailAccount']['hasMany'](db['MailApplication'],{'as':_0xcdcd('0x149'),'foreignKey':_0xcdcd('0x160'),'onDelete':_0xcdcd('0x114')});db['MailAccount'][_0xcdcd('0x126')](db['CmList'],{'as':'List','foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x40')][_0xcdcd('0x126')](db[_0xcdcd('0x94')],{'as':'Template','foreignKey':_0xcdcd('0x168')});db[_0xcdcd('0x40')][_0xcdcd('0x126')](db[_0xcdcd('0x84')],{'as':_0xcdcd('0x169'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x140')});db['MailQueue'][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':'UserMailQueue'});db[_0xcdcd('0x139')][_0xcdcd('0x129')](db[_0xcdcd('0xe6')],{'through':'team_has_mail_queues','as':'Teams'});db[_0xcdcd('0x44')]['hasMany'](db['MailMessage'],{'as':_0xcdcd('0x158'),'onDelete':'cascade','foreignKey':_0xcdcd('0x16a')});db[_0xcdcd('0x44')][_0xcdcd('0x126')](db[_0xcdcd('0x40')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x160')});db[_0xcdcd('0x44')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db['MailInteraction'][_0xcdcd('0x126')](db['User'],{'as':_0xcdcd('0x16c'),'foreignKey':_0xcdcd('0x115')});db['MailInteraction'][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x16d'),'as':_0xcdcd('0x16e')});db['MailInteraction'][_0xcdcd('0x129')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xcdcd('0x16f')});db['MailInteraction'][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x12f'),'foreignKey':'MailInteractionId'});db[_0xcdcd('0x171')]['hasMany'](db['Attachment'],{'as':'Attachments','onDelete':'cascade'});db[_0xcdcd('0x171')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x112')});db['MailMessage']['belongsTo'](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x15e')});db[_0xcdcd('0x171')][_0xcdcd('0x126')](db[_0xcdcd('0x44')],{'as':_0xcdcd('0x172'),'foreignKey':_0xcdcd('0x16a')});db['MailMessage']['belongsTo'](db[_0xcdcd('0x40')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x160')});db[_0xcdcd('0x171')][_0xcdcd('0x126')](db['ChatWebsite'],{'as':_0xcdcd('0x173'),'foreignKey':_0xcdcd('0x174')});db[_0xcdcd('0x171')]['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0xcdcd('0x175')});db['MailApplication']['belongsTo'](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x47')][_0xcdcd('0x126')](db[_0xcdcd('0x139')],{'onDelete':'restrict'});db[_0xcdcd('0x47')]['belongsTo'](db['MailAccount'],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x47')][_0xcdcd('0x126')](db['Interval'],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x47')]['belongsTo'](db[_0xcdcd('0x8c')],{'onDelete':'restrict','foreignKey':_0xcdcd('0x176')});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0xcdcd('0x177')][_0xcdcd('0x126')](db['CmList'],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db['MailQueueReport'][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':'Contact','foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x177')]['belongsTo'](db[_0xcdcd('0x44')],{});db[_0xcdcd('0x177')][_0xcdcd('0x126')](db['MailMessage'],{});db[_0xcdcd('0x177')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{});db[_0xcdcd('0x177')][_0xcdcd('0x126')](db[_0xcdcd('0x139')],{});db[_0xcdcd('0x4a')][_0xcdcd('0x118')](db['DashboardItem'],{'as':_0xcdcd('0x179'),'onDelete':_0xcdcd('0x114')});db['FaxAccount'][_0xcdcd('0x118')](db['Disposition'],{'as':_0xcdcd('0x165'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0xcdcd('0x4d')][_0xcdcd('0x118')](db[_0xcdcd('0x7d')],{'as':_0xcdcd('0x166'),'foreignKey':_0xcdcd('0x17a')});db[_0xcdcd('0x4d')]['hasMany'](db[_0xcdcd('0x120')],{'as':_0xcdcd('0x17b')});db[_0xcdcd('0x4d')][_0xcdcd('0x118')](db['FaxApplication'],{'as':_0xcdcd('0x149'),'foreignKey':_0xcdcd('0x17a'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x4d')][_0xcdcd('0x118')](db['VoiceExtension'],{'as':_0xcdcd('0x17c'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x4d')][_0xcdcd('0x118')](db[_0xcdcd('0x4f')],{'as':'Messages'});db[_0xcdcd('0x4d')][_0xcdcd('0x126')](db[_0xcdcd('0x2a')],{'as':_0xcdcd('0x2a')});db[_0xcdcd('0x4d')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db['FaxAccount'][_0xcdcd('0x126')](db['Pause'],{'as':_0xcdcd('0x169'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcdcd('0x4d')]['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x13f')});db[_0xcdcd('0x17d')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x17d')][_0xcdcd('0x126')](db[_0xcdcd('0x17e')],{'onDelete':'restrict'});db[_0xcdcd('0x17d')][_0xcdcd('0x126')](db[_0xcdcd('0x4d')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x17d')]['belongsTo'](db[_0xcdcd('0x8c')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x176')});db[_0xcdcd('0x120')]['hasMany'](db[_0xcdcd('0x4f')],{'as':'Messages','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x17f')});db['FaxInteraction'][_0xcdcd('0x126')](db['FaxAccount'],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x17a')});db[_0xcdcd('0x120')][_0xcdcd('0x126')](db['CmContact'],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x120')]['belongsTo'](db[_0xcdcd('0x112')],{'as':'Owner','foreignKey':_0xcdcd('0x115')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xcdcd('0x16e')});db[_0xcdcd('0x120')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x180'),'as':'ThroughTags'});db['FaxInteraction'][_0xcdcd('0x129')](db['User'],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x132'),'foreignKey':_0xcdcd('0x17f')});db[_0xcdcd('0x4f')]['belongsTo'](db[_0xcdcd('0x112')],{'onDelete':'cascade','as':_0xcdcd('0x112')});db[_0xcdcd('0x4f')]['belongsTo'](db[_0xcdcd('0x120')],{'as':_0xcdcd('0x172'),'foreignKey':_0xcdcd('0x17f')});db[_0xcdcd('0x4f')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x15e')});db['FaxMessage']['belongsTo'](db[_0xcdcd('0xeb')],{'as':_0xcdcd('0xeb'),'foreignKey':_0xcdcd('0x181')});db[_0xcdcd('0x4f')][_0xcdcd('0x126')](db['FaxAccount'],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x17a')});db[_0xcdcd('0x17e')][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x34')});db['FaxQueue']['belongsToMany'](db['Team'],{'through':_0xcdcd('0x182'),'as':_0xcdcd('0x157')});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0x4d')],{});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':'ContactId'});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0x120')],{});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0x4f')],{});db[_0xcdcd('0x50')]['belongsTo'](db[_0xcdcd('0x112')],{});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0x17e')],{});db[_0xcdcd('0x142')][_0xcdcd('0x118')](db[_0xcdcd('0x7f')],{'as':_0xcdcd('0x165'),'foreignKey':_0xcdcd('0x183'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x142')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0xcdcd('0x142')][_0xcdcd('0x118')](db[_0xcdcd('0x184')],{'as':_0xcdcd('0x158'),'foreignKey':_0xcdcd('0x183')});db[_0xcdcd('0x142')][_0xcdcd('0x118')](db[_0xcdcd('0x55')],{'as':_0xcdcd('0x17b')});db[_0xcdcd('0x142')]['hasMany'](db['SmsApplication'],{'as':'Applications','foreignKey':_0xcdcd('0x183'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x142')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x142')][_0xcdcd('0x126')](db['Pause'],{'as':_0xcdcd('0x169'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcdcd('0x142')][_0xcdcd('0x129')](db['User'],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x144')});db['SmsApplication'][_0xcdcd('0x126')](db['User'],{'onDelete':'restrict'});db[_0xcdcd('0x53')]['belongsTo'](db['SmsQueue'],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x53')]['belongsTo'](db[_0xcdcd('0x142')],{'onDelete':'restrict'});db[_0xcdcd('0x53')][_0xcdcd('0x126')](db[_0xcdcd('0x82')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x53')][_0xcdcd('0x126')](db['Tag'],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x176')});db['SmsInteraction'][_0xcdcd('0x118')](db[_0xcdcd('0x184')],{'as':_0xcdcd('0x158'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x185')});db['SmsInteraction'][_0xcdcd('0x126')](db[_0xcdcd('0x142')],{'as':'Account','foreignKey':_0xcdcd('0x183')});db[_0xcdcd('0x55')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x55')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x16c'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x55')][_0xcdcd('0x129')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xcdcd('0x16e')});db[_0xcdcd('0x55')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x186'),'as':_0xcdcd('0x16f')});db[_0xcdcd('0x55')][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'through':'user_has_sms_interactions','foreignKey':_0xcdcd('0x185')});db[_0xcdcd('0x184')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x112')});db[_0xcdcd('0x184')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x15e')});db['SmsMessage'][_0xcdcd('0x126')](db['SmsInteraction'],{'onDelete':_0xcdcd('0x114'),'as':'Interaction','foreignKey':_0xcdcd('0x185')});db[_0xcdcd('0x184')][_0xcdcd('0x126')](db[_0xcdcd('0x142')],{'as':'Account','foreignKey':_0xcdcd('0x183')});db[_0xcdcd('0x56')][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x36'),'foreignKey':_0xcdcd('0x187')});db['SmsQueue']['belongsToMany'](db[_0xcdcd('0xe6')],{'through':_0xcdcd('0x188'),'as':_0xcdcd('0x157')});db[_0xcdcd('0x58')][_0xcdcd('0x118')](db[_0xcdcd('0x7f')],{'as':_0xcdcd('0x165'),'foreignKey':_0xcdcd('0x189'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x58')][_0xcdcd('0x118')](db[_0xcdcd('0x7d')],{'as':_0xcdcd('0x166'),'foreignKey':'OpenchannelAccountId'});db[_0xcdcd('0x58')]['hasMany'](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0xcdcd('0x189')});db[_0xcdcd('0x58')]['hasMany'](db[_0xcdcd('0x5c')],{'as':_0xcdcd('0x158'),'foreignKey':_0xcdcd('0x189')});db[_0xcdcd('0x58')][_0xcdcd('0x118')](db[_0xcdcd('0x18a')],{'as':'Applications','foreignKey':_0xcdcd('0x189'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x58')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x58')]['belongsTo'](db[_0xcdcd('0x84')],{'as':_0xcdcd('0x169'),'foreignKey':_0xcdcd('0x154')});db[_0xcdcd('0x58')][_0xcdcd('0x129')](db['User'],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x18b')});db['OpenchannelApplication'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x18a')][_0xcdcd('0x126')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0xcdcd('0x126')](db[_0xcdcd('0x58')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x189')});db[_0xcdcd('0x18a')][_0xcdcd('0x126')](db[_0xcdcd('0x82')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x18a')][_0xcdcd('0x126')](db[_0xcdcd('0x8c')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x176')});db['OpenchannelInteraction'][_0xcdcd('0x118')](db[_0xcdcd('0x5c')],{'as':'Messages','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x18c')});db['OpenchannelInteraction']['belongsTo'](db[_0xcdcd('0x58')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x189')});db[_0xcdcd('0x11d')]['belongsTo'](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x11d')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x16c'),'foreignKey':'UserId'});db[_0xcdcd('0x11d')]['belongsToMany'](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x18d'),'as':_0xcdcd('0x16e')});db[_0xcdcd('0x11d')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':'openchannel_interaction_has_tags','as':_0xcdcd('0x16f')});db[_0xcdcd('0x11d')][_0xcdcd('0x129')](db['User'],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x134'),'foreignKey':_0xcdcd('0x18c')});db[_0xcdcd('0x5c')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x112')});db[_0xcdcd('0x5c')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x15e')});db[_0xcdcd('0x5c')][_0xcdcd('0x126')](db[_0xcdcd('0x11d')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x172'),'foreignKey':_0xcdcd('0x18c')});db[_0xcdcd('0x5c')]['belongsTo'](db[_0xcdcd('0xeb')],{'as':_0xcdcd('0xeb'),'foreignKey':_0xcdcd('0x181')});db['OpenchannelMessage'][_0xcdcd('0x126')](db['OpenchannelAccount'],{'as':_0xcdcd('0x16b'),'foreignKey':'OpenchannelAccountId'});db[_0xcdcd('0x5e')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0xcdcd('0x5e')][_0xcdcd('0x129')](db['Team'],{'through':_0xcdcd('0x18e'),'as':'Teams'});db[_0xcdcd('0x173')][_0xcdcd('0x118')](db[_0xcdcd('0x7f')],{'as':_0xcdcd('0x165'),'foreignKey':_0xcdcd('0x174'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x173')]['hasMany'](db[_0xcdcd('0x7d')],{'as':_0xcdcd('0x166'),'foreignKey':_0xcdcd('0x174')});db[_0xcdcd('0x173')][_0xcdcd('0x118')](db[_0xcdcd('0x6a')],{'as':_0xcdcd('0x18f')});db[_0xcdcd('0x173')]['hasMany'](db['ChatInteraction'],{'as':_0xcdcd('0x17b')});db['ChatWebsite']['hasMany'](db[_0xcdcd('0x61')],{'as':_0xcdcd('0x149'),'foreignKey':_0xcdcd('0x174'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x173')]['hasMany'](db[_0xcdcd('0x65')],{'as':_0xcdcd('0x158')});db[_0xcdcd('0x173')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x173')][_0xcdcd('0x126')](db[_0xcdcd('0x82')],{'as':_0xcdcd('0x82'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x173')][_0xcdcd('0x126')](db[_0xcdcd('0x40')],{'as':_0xcdcd('0x40'),'foreignKey':_0xcdcd('0x160')});db['ChatWebsite'][_0xcdcd('0x126')](db[_0xcdcd('0x84')],{'as':_0xcdcd('0x169'),'foreignKey':_0xcdcd('0x154')});db[_0xcdcd('0x173')]['belongsToMany'](db[_0xcdcd('0x112')],{'as':'Agents','through':_0xcdcd('0x13e')});db[_0xcdcd('0x190')][_0xcdcd('0x126')](db[_0xcdcd('0x58')],{});db[_0xcdcd('0x190')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':'ListId'});db[_0xcdcd('0x190')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x190')][_0xcdcd('0x126')](db[_0xcdcd('0x11d')],{});db[_0xcdcd('0x190')][_0xcdcd('0x126')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xcdcd('0x112')],{});db[_0xcdcd('0x190')]['belongsTo'](db['OpenchannelQueue'],{});db[_0xcdcd('0x61')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x191'),'foreignKey':_0xcdcd('0x115'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x61')][_0xcdcd('0x126')](db[_0xcdcd('0x66')],{'as':_0xcdcd('0x192'),'foreignKey':_0xcdcd('0x193'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x61')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'as':_0xcdcd('0x194'),'foreignKey':'ChatWebsiteId','onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x61')][_0xcdcd('0x126')](db[_0xcdcd('0x8c')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x176')});db['ChatInteraction'][_0xcdcd('0x118')](db[_0xcdcd('0x65')],{'as':_0xcdcd('0x158'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x195')});db[_0xcdcd('0x63')]['belongsTo'](db[_0xcdcd('0x173')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x174')});db[_0xcdcd('0x63')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x63')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':'Owner','foreignKey':'UserId'});db[_0xcdcd('0x63')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0xcdcd('0x63')][_0xcdcd('0x129')](db['Tag'],{'through':_0xcdcd('0x196'),'as':'ThroughTags'});db[_0xcdcd('0x63')]['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x197'),'foreignKey':_0xcdcd('0x195')});db[_0xcdcd('0x65')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':'cascade','as':_0xcdcd('0x112')});db[_0xcdcd('0x65')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x65')]['belongsTo'](db[_0xcdcd('0x63')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x172'),'foreignKey':_0xcdcd('0x195')});db[_0xcdcd('0x65')][_0xcdcd('0x126')](db['Attachment'],{'as':_0xcdcd('0xeb'),'foreignKey':_0xcdcd('0x181')});db[_0xcdcd('0x65')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x174')});db['ChatOfflineMessage'][_0xcdcd('0x118')](db['Attachment'],{'as':_0xcdcd('0x198'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x199')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':'Contact','foreignKey':'ContactId'});db[_0xcdcd('0x199')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'as':'Account','foreignKey':_0xcdcd('0x174')});db[_0xcdcd('0x66')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xcdcd('0x66')][_0xcdcd('0x129')](db['Team'],{'through':_0xcdcd('0x19a'),'as':_0xcdcd('0x157')});db[_0xcdcd('0x68')][_0xcdcd('0x118')](db[_0xcdcd('0x19b')],{'as':_0xcdcd('0x158'),'foreignKey':'ChatGroupId','onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x68')]['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x14b'),'through':_0xcdcd('0x128')});db[_0xcdcd('0x6a')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'as':'Website','foreignKey':_0xcdcd('0x174')});db[_0xcdcd('0x6c')][_0xcdcd('0x118')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x12a'),'foreignKey':_0xcdcd('0x19c')});db[_0xcdcd('0x6e')]['hasMany'](db[_0xcdcd('0x90')],{'as':_0xcdcd('0x19d'),'foreignKey':_0xcdcd('0x19e')});db[_0xcdcd('0x6e')][_0xcdcd('0x118')](db[_0xcdcd('0x124')],{'as':_0xcdcd('0x14d'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xcdcd('0x73')],{'as':'HopperFinals','foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x6e')][_0xcdcd('0x118')](db['CmHopperHistory'],{'as':_0xcdcd('0x14e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x6e')][_0xcdcd('0x118')](db[_0xcdcd('0x77')],{'as':'ReportAgentPreview','foreignKey':_0xcdcd('0x15f')});db['CmContact'][_0xcdcd('0x118')](db[_0xcdcd('0xd9')],{'as':_0xcdcd('0x150'),'foreignKey':_0xcdcd('0x15f')});db['CmContact'][_0xcdcd('0x118')](db[_0xcdcd('0x11d')],{'as':_0xcdcd('0x11e'),'foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x162')});db['CmContact'][_0xcdcd('0x118')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x6e')]['hasMany'](db[_0xcdcd('0x55')],{'as':_0xcdcd('0x11f'),'foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x6e')]['hasMany'](db[_0xcdcd('0x120')],{'as':_0xcdcd('0x131'),'foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x6e')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xcdcd('0x6e')][_0xcdcd('0x126')](db['CmCompany'],{'as':_0xcdcd('0x19f'),'foreignKey':_0xcdcd('0x19c')});db[_0xcdcd('0x6e')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':'ListId','onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x6e')]['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x12b')});db[_0xcdcd('0x6e')][_0xcdcd('0x129')](db['Tag'],{'as':_0xcdcd('0x16e'),'through':'cm_contact_has_tags'});db[_0xcdcd('0x6e')][_0xcdcd('0x129')](db['Tag'],{'through':_0xcdcd('0x1a0'),'as':'ThroughTags'});db['CmHopper'][_0xcdcd('0x118')](db[_0xcdcd('0x92')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db['CmContact'],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':'Agent','foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db[_0xcdcd('0x18')],{'as':_0xcdcd('0x192'),'foreignKey':_0xcdcd('0x14c'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db[_0xcdcd('0xe9')],{'as':'Campaign','foreignKey':_0xcdcd('0x1a1'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':'Owner','foreignKey':_0xcdcd('0x1a2')});db[_0xcdcd('0x71')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':'Contact','foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x71')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':'ListId','onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x71')][_0xcdcd('0x126')](db[_0xcdcd('0x18')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xcdcd('0x114')});db['CmHopperBlack'][_0xcdcd('0x126')](db[_0xcdcd('0xe9')],{'as':_0xcdcd('0xe9'),'foreignKey':_0xcdcd('0x1a1'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x7b')]['hasMany'](db[_0xcdcd('0x1a3')],{'as':{'plural':_0xcdcd('0x1a4'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x7b')]['hasMany'](db[_0xcdcd('0x1a3')],{'as':{'plural':'Any','singular':_0xcdcd('0x1a5')},'foreignKey':_0xcdcd('0x1a6'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xcdcd('0x118')](db[_0xcdcd('0x1a7')],{'as':'Actions','foreignKey':_0xcdcd('0x1a8'),'onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x7f')][_0xcdcd('0x118')](db['Disposition'],{'as':_0xcdcd('0x165'),'foreignKey':'ParentId','onDelete':_0xcdcd('0x114')});db['Interval'][_0xcdcd('0x118')](db[_0xcdcd('0x82')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0xcdcd('0x118')](db[_0xcdcd('0x16')],{'as':_0xcdcd('0x11a'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0xcdcd('0x82')]['hasMany'](db[_0xcdcd('0x47')],{'as':_0xcdcd('0x1a9'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x82')][_0xcdcd('0x118')](db['ChatApplication'],{'as':_0xcdcd('0x1aa'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x82')][_0xcdcd('0x118')](db[_0xcdcd('0x17d')],{'as':_0xcdcd('0x1ab'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x82')][_0xcdcd('0x118')](db[_0xcdcd('0x53')],{'as':_0xcdcd('0x1ac'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x88')]['belongsTo'](db[_0xcdcd('0x40')],{});db[_0xcdcd('0x88')][_0xcdcd('0x126')](db[_0xcdcd('0x1ad')],{'foreignKey':'DefaultReportId'});db[_0xcdcd('0x88')][_0xcdcd('0x126')](db[_0xcdcd('0x1ae')],{'foreignKey':_0xcdcd('0x1af')});db['Sound'][_0xcdcd('0x129')](db[_0xcdcd('0x17')],{'as':_0xcdcd('0x1b0'),'through':_0xcdcd('0x1b1'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x8c')]['belongsToMany'](db['CmContact'],{'through':_0xcdcd('0x1a0')});db[_0xcdcd('0x8c')]['belongsToMany'](db[_0xcdcd('0x63')],{'through':_0xcdcd('0x196')});db[_0xcdcd('0x8c')][_0xcdcd('0x129')](db[_0xcdcd('0x44')],{'through':_0xcdcd('0x16d')});db['Tag'][_0xcdcd('0x129')](db[_0xcdcd('0x55')],{'through':'sms_interaction_has_tags'});db[_0xcdcd('0x8c')][_0xcdcd('0x129')](db[_0xcdcd('0x120')],{'through':_0xcdcd('0x180')});db['Tag'][_0xcdcd('0x129')](db[_0xcdcd('0x11d')],{'through':_0xcdcd('0x18d')});db[_0xcdcd('0x8c')][_0xcdcd('0x129')](db[_0xcdcd('0x101')],{'through':_0xcdcd('0x1b2')});db[_0xcdcd('0x90')][_0xcdcd('0x126')](db[_0xcdcd('0x8e')],{'as':'ItemType','foreignKey':_0xcdcd('0x1b3')});db[_0xcdcd('0x92')][_0xcdcd('0x126')](db['CmHopper'],{'as':'Hopper','foreignKey':_0xcdcd('0x1b4')});db[_0xcdcd('0x90')]['belongsTo'](db['CmContact'],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x19e')});db['Trigger'][_0xcdcd('0x118')](db[_0xcdcd('0x1a3')],{'as':{'plural':_0xcdcd('0x1b5'),'singular':_0xcdcd('0x1b6')},'foreignKey':_0xcdcd('0x1b7'),'onDelete':_0xcdcd('0x114'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xcdcd('0x1a3')],{'as':{'plural':_0xcdcd('0x1b8'),'singular':_0xcdcd('0x1b9')},'foreignKey':'TriggerAnyId','onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x96')][_0xcdcd('0x118')](db[_0xcdcd('0x1a7')],{'as':_0xcdcd('0x1ba'),'foreignKey':_0xcdcd('0x1bb'),'onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x1ae')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xcdcd('0x1bc'),'onDelete':'cascade','foreignKey':_0xcdcd('0x1af'),'hooks':!![]});db[_0xcdcd('0x1ad')][_0xcdcd('0x118')](db[_0xcdcd('0xa2')],{'as':_0xcdcd('0x1bc'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1bd')});db[_0xcdcd('0xa0')][_0xcdcd('0x118')](db[_0xcdcd('0xa2')],{'as':'Fields','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1be')});db[_0xcdcd('0xa2')]['belongsTo'](db[_0xcdcd('0xa0')],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db[_0xcdcd('0xa8')],{'as':_0xcdcd('0x1bf'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xa8')][_0xcdcd('0x118')](db[_0xcdcd('0xaa')],{'as':_0xcdcd('0x1c1'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xa8')]['hasMany'](db[_0xcdcd('0xaa')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xa8')][_0xcdcd('0x118')](db[_0xcdcd('0xaa')],{'as':_0xcdcd('0x1bc'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xcdcd('0xa8')][_0xcdcd('0x126')](db[_0xcdcd('0xa6')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xaa')][_0xcdcd('0x118')](db[_0xcdcd('0xaa')],{'as':_0xcdcd('0x1c5'),'foreignKey':_0xcdcd('0x1c2')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xaa')]['hasMany'](db['SalesforceField'],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db['SalesforceField'][_0xcdcd('0x126')](db['Variable'],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xab')][_0xcdcd('0x118')](db['SugarcrmConfiguration'],{'as':_0xcdcd('0x1bf'),'onDelete':_0xcdcd('0x114'),'foreignKey':'AccountId'});db[_0xcdcd('0xad')][_0xcdcd('0x118')](db['SugarcrmField'],{'as':_0xcdcd('0x1c1'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c2')});db['SugarcrmConfiguration'][_0xcdcd('0x118')](db[_0xcdcd('0x1ca')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xad')]['hasMany'](db[_0xcdcd('0x1ca')],{'as':_0xcdcd('0x1bc'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c8')});db['SugarcrmConfiguration']['belongsTo'](db[_0xcdcd('0xab')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0x1ca')]['hasMany'](db['SugarcrmField'],{'as':_0xcdcd('0x1c5'),'foreignKey':'SubjectId'});db[_0xcdcd('0x1ca')][_0xcdcd('0x118')](db[_0xcdcd('0x1ca')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db['SugarcrmField'][_0xcdcd('0x118')](db[_0xcdcd('0x1ca')],{'as':'Field','foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0x1ca')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xb0')]['hasMany'](db[_0xcdcd('0xb1')],{'as':_0xcdcd('0x1bf'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xb1')][_0xcdcd('0x118')](db['DeskField'],{'as':'Subjects','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xb1')][_0xcdcd('0x118')](db[_0xcdcd('0xb2')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xb1')][_0xcdcd('0x118')](db['DeskField'],{'as':_0xcdcd('0x1bc'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c8')});db['DeskConfiguration'][_0xcdcd('0x126')](db[_0xcdcd('0xb0')],{'as':'Account','foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xb1')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x1cb')});db[_0xcdcd('0xb2')][_0xcdcd('0x118')](db['DeskField'],{'as':'Subject','foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xb2')]['hasMany'](db[_0xcdcd('0xb2')],{'as':_0xcdcd('0x1c6'),'foreignKey':'DescriptionId'});db[_0xcdcd('0xb2')]['hasMany'](db[_0xcdcd('0xb2')],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xb2')][_0xcdcd('0x126')](db['Variable'],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db['ZohoAccount'][_0xcdcd('0x118')](db[_0xcdcd('0x1cc')],{'as':_0xcdcd('0x1bf'),'onDelete':'cascade','foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0x1cc')][_0xcdcd('0x118')](db['ZohoField'],{'as':'Subjects','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c2')});db['ZohoConfiguration'][_0xcdcd('0x118')](db[_0xcdcd('0xb7')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db['ZohoConfiguration'][_0xcdcd('0x118')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xcdcd('0x1c8')});db['ZohoConfiguration']['belongsTo'](db[_0xcdcd('0xb4')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xb7')][_0xcdcd('0x118')](db[_0xcdcd('0xb7')],{'as':_0xcdcd('0x1c5'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xb7')][_0xcdcd('0x118')](db[_0xcdcd('0xb7')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xb7')][_0xcdcd('0x118')](db[_0xcdcd('0xb7')],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xb7')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xb8')][_0xcdcd('0x118')](db[_0xcdcd('0xba')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xba')][_0xcdcd('0x118')](db[_0xcdcd('0xbc')],{'as':'Subjects','foreignKey':_0xcdcd('0x1c2')});db['ZendeskConfiguration']['hasMany'](db[_0xcdcd('0xbc')],{'as':_0xcdcd('0x1c3'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xba')][_0xcdcd('0x118')](db['ZendeskField'],{'as':_0xcdcd('0x1bc'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xba')][_0xcdcd('0x126')](db[_0xcdcd('0xb8')],{'as':'Account','foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xba')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x1cd')});db[_0xcdcd('0xbc')][_0xcdcd('0x118')](db[_0xcdcd('0xbc')],{'as':'Subject','foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xbc')][_0xcdcd('0x118')](db[_0xcdcd('0xbc')],{'as':_0xcdcd('0x1c6'),'foreignKey':'DescriptionId'});db[_0xcdcd('0xbc')]['hasMany'](db['ZendeskField'],{'as':_0xcdcd('0x1c7'),'foreignKey':'FieldId'});db[_0xcdcd('0xbc')]['belongsTo'](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xbd')][_0xcdcd('0x118')](db[_0xcdcd('0xbf')],{'as':_0xcdcd('0x1bf'),'onDelete':'cascade','foreignKey':_0xcdcd('0x1c0')});db['FreshdeskConfiguration']['hasMany'](db[_0xcdcd('0xc1')],{'as':'Subjects','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xbf')][_0xcdcd('0x118')](db[_0xcdcd('0xc1')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xbf')][_0xcdcd('0x118')](db['FreshdeskField'],{'as':_0xcdcd('0x1bc'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xbf')][_0xcdcd('0x126')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xbf')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x1ce')});db['FreshdeskField'][_0xcdcd('0x118')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0xcdcd('0x1c2')});db['FreshdeskField'][_0xcdcd('0x118')](db['FreshdeskField'],{'as':'Description','foreignKey':_0xcdcd('0x1c4')});db['FreshdeskField'][_0xcdcd('0x118')](db[_0xcdcd('0xc1')],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xc1')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0x1cf')][_0xcdcd('0x118')](db[_0xcdcd('0xc4')],{'as':_0xcdcd('0x1bf'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db['VtigerConfiguration'][_0xcdcd('0x118')](db[_0xcdcd('0xc6')],{'as':_0xcdcd('0x1c1'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xc4')][_0xcdcd('0x118')](db[_0xcdcd('0xc6')],{'as':_0xcdcd('0x1c3'),'foreignKey':_0xcdcd('0x1c4')});db['VtigerConfiguration']['hasMany'](db[_0xcdcd('0xc6')],{'as':_0xcdcd('0x1bc'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xc4')][_0xcdcd('0x126')](db[_0xcdcd('0x1cf')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xc6')][_0xcdcd('0x118')](db[_0xcdcd('0xc6')],{'as':_0xcdcd('0x1c5'),'foreignKey':'SubjectId'});db['VtigerField'][_0xcdcd('0x118')](db[_0xcdcd('0xc6')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xc6')][_0xcdcd('0x118')](db['VtigerField'],{'as':'Field','foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xc6')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':'VariableId'});db['ServicenowAccount']['hasMany'](db[_0xcdcd('0x1d0')],{'as':'Configurations','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0x1d0')][_0xcdcd('0x118')](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1c1'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0x1d0')][_0xcdcd('0x118')](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1c3'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0x1d0')][_0xcdcd('0x118')](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1bc'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0x1d0')][_0xcdcd('0x126')](db['ServicenowAccount'],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db['ServicenowField'][_0xcdcd('0x118')](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1c5'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db['ServicenowField'][_0xcdcd('0x118')](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0x1d1')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':'Variable','foreignKey':'VariableId'});db[_0xcdcd('0xc9')][_0xcdcd('0x118')](db[_0xcdcd('0xcb')],{'as':'Configurations','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xc9')][_0xcdcd('0x126')](db['CloudProvider'],{'as':_0xcdcd('0x109'),'foreignKey':_0xcdcd('0x161')});db[_0xcdcd('0xcb')][_0xcdcd('0x118')](db[_0xcdcd('0xcd')],{'as':_0xcdcd('0x1c1'),'onDelete':'cascade','foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xcb')][_0xcdcd('0x118')](db[_0xcdcd('0xcd')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xcb')][_0xcdcd('0x118')](db[_0xcdcd('0xcd')],{'as':_0xcdcd('0x1bc'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xcdcd('0xcb')]['belongsTo'](db[_0xcdcd('0xc9')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xcd')][_0xcdcd('0x118')](db[_0xcdcd('0xcd')],{'as':'Subject','foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xcd')][_0xcdcd('0x118')](db[_0xcdcd('0xcd')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xcd')][_0xcdcd('0x118')](db['Dynamics365Field'],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xcd')]['belongsTo'](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xce')][_0xcdcd('0x118')](db[_0xcdcd('0xd0')],{'as':_0xcdcd('0x1bf'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db['FreshsalesConfiguration'][_0xcdcd('0x118')](db[_0xcdcd('0x1d2')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xcdcd('0xd0')][_0xcdcd('0x118')](db[_0xcdcd('0x1d2')],{'as':_0xcdcd('0x1c3'),'foreignKey':'DescriptionId'});db[_0xcdcd('0xd0')][_0xcdcd('0x118')](db[_0xcdcd('0x1d2')],{'as':_0xcdcd('0x1bc'),'foreignKey':'FieldId'});db[_0xcdcd('0xd0')][_0xcdcd('0x126')](db[_0xcdcd('0xce')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db['FreshsalesField'][_0xcdcd('0x118')](db[_0xcdcd('0x1d2')],{'as':_0xcdcd('0x1c5'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0xcdcd('0x118')](db[_0xcdcd('0x1d2')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0x1d2')]['hasMany'](db[_0xcdcd('0x1d2')],{'as':'Field','foreignKey':'FieldId'});db[_0xcdcd('0x1d2')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xd4')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{});db[_0xcdcd('0xd4')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db['ChatQueueReport'][_0xcdcd('0x126')](db['CmContact'],{'as':'Contact','foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0xd4')][_0xcdcd('0x126')](db[_0xcdcd('0x63')],{});db[_0xcdcd('0xd4')]['belongsTo'](db[_0xcdcd('0x65')],{});db[_0xcdcd('0xd4')]['belongsTo'](db[_0xcdcd('0x112')],{});db[_0xcdcd('0xd4')][_0xcdcd('0x126')](db['ChatQueue'],{});db[_0xcdcd('0x19b')][_0xcdcd('0x126')](db['User'],{'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1d3')});db[_0xcdcd('0x19b')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1d4')});db[_0xcdcd('0xd9')][_0xcdcd('0x118')](db[_0xcdcd('0xd7')],{'foreignKey':_0xcdcd('0x1d5'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0xd9')][_0xcdcd('0x118')](db[_0xcdcd('0xd6')],{'foreignKey':'SessionId','onDelete':'cascade'});db['SmsQueueReport'][_0xcdcd('0x126')](db['SmsAccount'],{});db[_0xcdcd('0xda')][_0xcdcd('0x126')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xcdcd('0xda')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':'Contact','foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0xda')][_0xcdcd('0x126')](db[_0xcdcd('0x55')],{});db[_0xcdcd('0xda')][_0xcdcd('0x126')](db['SmsMessage'],{});db[_0xcdcd('0xda')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{});db[_0xcdcd('0xda')]['belongsTo'](db[_0xcdcd('0x56')],{});db['JscriptyProject'][_0xcdcd('0x118')](db[_0xcdcd('0xd9')],{'foreignKey':_0xcdcd('0x1d6')});db[_0xcdcd('0xde')][_0xcdcd('0x118')](db['JscriptyQuestionReport'],{'foreignKey':_0xcdcd('0x1d6')});db[_0xcdcd('0xde')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xcdcd('0x1d6')});db[_0xcdcd('0xe6')][_0xcdcd('0x129')](db['User'],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x12e')});db[_0xcdcd('0xe6')][_0xcdcd('0x129')](db[_0xcdcd('0x18')],{'through':_0xcdcd('0x10b'),'as':_0xcdcd('0x136')});db['Team'][_0xcdcd('0x129')](db[_0xcdcd('0x139')],{'through':_0xcdcd('0x1d7'),'as':'MailQueues'});db[_0xcdcd('0xe6')]['belongsToMany'](db['ChatQueue'],{'through':_0xcdcd('0x19a'),'as':_0xcdcd('0x1d8')});db[_0xcdcd('0xe6')]['belongsToMany'](db[_0xcdcd('0x17e')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0xcdcd('0xe6')]['belongsToMany'](db[_0xcdcd('0x56')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0xcdcd('0xe6')][_0xcdcd('0x129')](db[_0xcdcd('0x5e')],{'through':_0xcdcd('0x18e'),'as':'OpenchannelQueues'});db[_0xcdcd('0xe6')][_0xcdcd('0x129')](db[_0xcdcd('0x107')],{'through':_0xcdcd('0x1d9'),'as':'WhatsappQueues'});db[_0xcdcd('0xe6')]['belongsToMany'](db[_0xcdcd('0xf5')],{'through':_0xcdcd('0x1da'),'as':_0xcdcd('0x138')});db['Campaign'][_0xcdcd('0x118')](db[_0xcdcd('0x124')],{'as':_0xcdcd('0x14d'),'foreignKey':_0xcdcd('0x1a1')});db['Campaign'][_0xcdcd('0x118')](db['CmHopperFinal'],{'as':_0xcdcd('0x11b'),'foreignKey':_0xcdcd('0x1a1')});db[_0xcdcd('0xe9')]['hasMany'](db[_0xcdcd('0x75')],{'as':_0xcdcd('0x14e'),'foreignKey':'CampaignId'});db[_0xcdcd('0xe9')]['hasMany'](db['CmHopperBlack'],{'as':_0xcdcd('0x14f'),'foreignKey':_0xcdcd('0x1a1')});db[_0xcdcd('0xe9')][_0xcdcd('0x126')](db['Trunk'],{'as':_0xcdcd('0x2a'),'foreignKey':'TrunkId'});db[_0xcdcd('0xe9')][_0xcdcd('0x126')](db[_0xcdcd('0x2a')],{'as':_0xcdcd('0x152'),'foreignKey':_0xcdcd('0x1db')});db[_0xcdcd('0xe9')][_0xcdcd('0x126')](db[_0xcdcd('0x82')],{'as':_0xcdcd('0x82'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0xe9')][_0xcdcd('0x126')](db[_0xcdcd('0xe2')],{'as':_0xcdcd('0xe2'),'foreignKey':'SquareProjectId'});db[_0xcdcd('0xe9')][_0xcdcd('0x129')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x12c'),'through':_0xcdcd('0x1dc')});db[_0xcdcd('0xe9')][_0xcdcd('0x129')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x1dd'),'through':_0xcdcd('0x1de')});db[_0xcdcd('0xeb')]['belongsTo'](db[_0xcdcd('0x199')],{'as':_0xcdcd('0x199'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport']['belongsTo'](db[_0xcdcd('0x171')],{});db[_0xcdcd('0xee')][_0xcdcd('0x126')](db['MailInteraction'],{});db['MailTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x40')],{'foreignKey':_0xcdcd('0x1df'),'as':_0xcdcd('0x1e0')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xcdcd('0x1e1'),'as':_0xcdcd('0x1e2')});db[_0xcdcd('0xee')][_0xcdcd('0x126')](db['User'],{'foreignKey':'ToUserId','as':_0xcdcd('0x1e3')});db['MailTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x139')],{'foreignKey':_0xcdcd('0x1e4'),'as':'ToQueue'});db[_0xcdcd('0xee')][_0xcdcd('0x126')](db['MailAccount'],{'foreignKey':_0xcdcd('0x1e5'),'as':_0xcdcd('0x1e6')});db[_0xcdcd('0xef')][_0xcdcd('0x126')](db[_0xcdcd('0x65')],{});db['ChatTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x63')],{});db[_0xcdcd('0xef')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'foreignKey':_0xcdcd('0x1e7'),'as':'FromAccount'});db[_0xcdcd('0xef')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'foreignKey':_0xcdcd('0x1e1'),'as':_0xcdcd('0x1e2')});db[_0xcdcd('0xef')]['belongsTo'](db['User'],{'foreignKey':_0xcdcd('0x1e8'),'as':'ToAgent'});db['ChatTransferReport'][_0xcdcd('0x126')](db['ChatQueue'],{'foreignKey':_0xcdcd('0x1e9'),'as':_0xcdcd('0x1ea')});db[_0xcdcd('0xef')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'foreignKey':_0xcdcd('0x1eb'),'as':_0xcdcd('0x1e6')});db[_0xcdcd('0x1ec')][_0xcdcd('0x126')](db['FaxMessage'],{});db['FaxTransferReport'][_0xcdcd('0x126')](db['FaxInteraction'],{});db[_0xcdcd('0x1ec')][_0xcdcd('0x126')](db[_0xcdcd('0x4d')],{'foreignKey':_0xcdcd('0x1ed'),'as':_0xcdcd('0x1e0')});db[_0xcdcd('0x1ec')][_0xcdcd('0x126')](db['User'],{'foreignKey':_0xcdcd('0x1e1'),'as':_0xcdcd('0x1e2')});db[_0xcdcd('0x1ec')][_0xcdcd('0x126')](db['User'],{'foreignKey':_0xcdcd('0x1e8'),'as':_0xcdcd('0x1e3')});db[_0xcdcd('0x1ec')]['belongsTo'](db[_0xcdcd('0x17e')],{'foreignKey':_0xcdcd('0x1ee'),'as':_0xcdcd('0x1ea')});db['FaxTransferReport']['belongsTo'](db[_0xcdcd('0x4d')],{'foreignKey':'ToFaxAccountId','as':_0xcdcd('0x1e6')});db[_0xcdcd('0x1ef')][_0xcdcd('0x126')](db[_0xcdcd('0x5c')],{});db[_0xcdcd('0x1ef')][_0xcdcd('0x126')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x58')],{'foreignKey':_0xcdcd('0x1f0'),'as':'FromAccount'});db[_0xcdcd('0x1ef')]['belongsTo'](db['User'],{'foreignKey':_0xcdcd('0x1e1'),'as':_0xcdcd('0x1e2')});db['OpenchannelTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xcdcd('0x1ef')][_0xcdcd('0x126')](db[_0xcdcd('0x5e')],{'foreignKey':_0xcdcd('0x1f1'),'as':'ToQueue'});db[_0xcdcd('0x1ef')][_0xcdcd('0x126')](db[_0xcdcd('0x58')],{'foreignKey':_0xcdcd('0x1f2'),'as':_0xcdcd('0x1e6')});db['SmsTransferReport']['belongsTo'](db[_0xcdcd('0x184')],{});db[_0xcdcd('0xf2')]['belongsTo'](db[_0xcdcd('0x55')],{});db[_0xcdcd('0xf2')][_0xcdcd('0x126')](db['SmsAccount'],{'foreignKey':_0xcdcd('0x1f3'),'as':_0xcdcd('0x1e0')});db[_0xcdcd('0xf2')][_0xcdcd('0x126')](db['User'],{'foreignKey':_0xcdcd('0x1e1'),'as':_0xcdcd('0x1e2')});db[_0xcdcd('0xf2')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'foreignKey':_0xcdcd('0x1e8'),'as':'ToAgent'});db[_0xcdcd('0xf2')][_0xcdcd('0x126')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0xcdcd('0x1ea')});db['SmsTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x142')],{'foreignKey':_0xcdcd('0x1f4'),'as':_0xcdcd('0x1e6')});db['CmList']['hasMany'](db['Disposition'],{'as':_0xcdcd('0x165'),'foreignKey':_0xcdcd('0x167'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0xf3')]['hasMany'](db[_0xcdcd('0x79')],{'as':_0xcdcd('0x1f5'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0xf3')][_0xcdcd('0x118')](db['CmContact'],{'as':'Contacts','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x167')});db['CmList'][_0xcdcd('0x118')](db[_0xcdcd('0x73')],{'as':_0xcdcd('0x11b'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0xf3')]['hasMany'](db['CmHopperHistory'],{'as':_0xcdcd('0x11c'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0xf3')][_0xcdcd('0x118')](db[_0xcdcd('0x77')],{'as':'ReportAgentPreview','foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0xf3')][_0xcdcd('0x129')](db[_0xcdcd('0x18')],{'as':'Queues','through':_0xcdcd('0x155')});db['CmList'][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x12d')});db[_0xcdcd('0xf5')][_0xcdcd('0x118')](db[_0xcdcd('0x16')],{'as':'Extensions','onDelete':_0xcdcd('0x114')});db['VoicePrefix']['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':'UserVoicePrefix'});db[_0xcdcd('0xf5')]['belongsToMany'](db[_0xcdcd('0xe6')],{'through':_0xcdcd('0x1da'),'as':_0xcdcd('0x157')});db[_0xcdcd('0xf7')][_0xcdcd('0x118')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'foreignKey':_0xcdcd('0x127')});db[_0xcdcd('0xf7')]['hasMany'](db[_0xcdcd('0xf8')],{'as':_0xcdcd('0x1f6'),'foreignKey':_0xcdcd('0x127'),'onDelete':_0xcdcd('0x114')});db['UserProfileSection'][_0xcdcd('0x118')](db[_0xcdcd('0xfa')],{'as':_0xcdcd('0x1f7'),'foreignKey':_0xcdcd('0x1f8'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0xfe')][_0xcdcd('0x118')](db[_0xcdcd('0x7f')],{'as':_0xcdcd('0x165'),'foreignKey':_0xcdcd('0x1f9'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0xfe')][_0xcdcd('0x118')](db[_0xcdcd('0x7d')],{'as':_0xcdcd('0x166'),'foreignKey':'WhatsappAccountId'});db[_0xcdcd('0xfe')][_0xcdcd('0x118')](db['WhatsappMessage'],{'as':_0xcdcd('0x158'),'foreignKey':_0xcdcd('0x1f9')});db[_0xcdcd('0xfe')]['hasMany'](db[_0xcdcd('0x101')],{'as':'Interactions'});db[_0xcdcd('0xfe')][_0xcdcd('0x118')](db[_0xcdcd('0x1fa')],{'as':_0xcdcd('0x149'),'foreignKey':_0xcdcd('0x1f9'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0xfe')]['belongsTo'](db['CmList'],{'as':_0xcdcd('0x178'),'foreignKey':'ListId'});db[_0xcdcd('0xfe')][_0xcdcd('0x126')](db['Pause'],{'as':_0xcdcd('0x169'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcdcd('0xfe')][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x1fa')][_0xcdcd('0x126')](db[_0xcdcd('0x107')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x1fa')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{'onDelete':_0xcdcd('0x162')});db['WhatsappApplication']['belongsTo'](db[_0xcdcd('0x82')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x1fa')]['belongsTo'](db['Tag'],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x176')});db[_0xcdcd('0x101')][_0xcdcd('0x118')](db['WhatsappMessage'],{'as':_0xcdcd('0x158'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0xcdcd('0x101')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{'as':_0xcdcd('0x16b'),'foreignKey':'WhatsappAccountId'});db[_0xcdcd('0x101')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x101')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x16c'),'foreignKey':_0xcdcd('0x115')});db['WhatsappInteraction'][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x1b2'),'as':_0xcdcd('0x16e')});db[_0xcdcd('0x101')]['belongsToMany'](db[_0xcdcd('0x8c')],{'through':'whatsapp_interaction_has_tags','as':_0xcdcd('0x16f')});db[_0xcdcd('0x101')][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x1fb'),'foreignKey':_0xcdcd('0x1fc')});db[_0xcdcd('0x103')]['belongsTo'](db[_0xcdcd('0x112')],{'as':'User'});db[_0xcdcd('0x103')]['belongsTo'](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x15e')});db[_0xcdcd('0x103')]['belongsTo'](db[_0xcdcd('0x101')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x172'),'foreignKey':_0xcdcd('0x1fc')});db[_0xcdcd('0x103')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{'as':_0xcdcd('0x16b'),'foreignKey':'WhatsappAccountId'});db[_0xcdcd('0x1fd')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{});db[_0xcdcd('0x1fd')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x1fd')][_0xcdcd('0x126')](db['CmContact'],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x1fd')]['belongsTo'](db[_0xcdcd('0x101')],{});db['WhatsappQueueReport'][_0xcdcd('0x126')](db['WhatsappQueue'],{});db[_0xcdcd('0x1fd')][_0xcdcd('0x126')](db[_0xcdcd('0x103')],{});db[_0xcdcd('0x1fd')]['belongsTo'](db[_0xcdcd('0x112')],{});db[_0xcdcd('0x105')][_0xcdcd('0x126')](db[_0xcdcd('0x103')],{});db[_0xcdcd('0x105')][_0xcdcd('0x126')](db['WhatsappInteraction'],{});db[_0xcdcd('0x105')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{'foreignKey':_0xcdcd('0x1fe'),'as':_0xcdcd('0x1e0')});db[_0xcdcd('0x105')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{'foreignKey':_0xcdcd('0x1ff'),'as':_0xcdcd('0x1e6')});db[_0xcdcd('0x105')][_0xcdcd('0x126')](db['WhatsappQueue'],{'foreignKey':_0xcdcd('0x200'),'as':_0xcdcd('0x1ea')});db[_0xcdcd('0x105')]['belongsTo'](db[_0xcdcd('0x112')],{'foreignKey':'FromUserId','as':'FromAgent'});db['WhatsappTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'foreignKey':_0xcdcd('0x1e8'),'as':_0xcdcd('0x1e3')});db['WhatsappQueue'][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xcdcd('0x107')]['belongsToMany'](db[_0xcdcd('0xe6')],{'through':_0xcdcd('0x1d9'),'as':'Teams'});db[_0xcdcd('0x110')][_0xcdcd('0x126')](db['User'],{'as':_0xcdcd('0x201'),'foreignKey':_0xcdcd('0x115'),'onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x109')][_0xcdcd('0x113')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0xcdcd('0x162')});db['CloudProvider'][_0xcdcd('0x113')](db[_0xcdcd('0x3c')],{'as':_0xcdcd('0x163'),'onDelete':_0xcdcd('0x162')});db['CloudProvider']['hasOne'](db[_0xcdcd('0x3e')],{'as':_0xcdcd('0x164'),'onDelete':_0xcdcd('0x162')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x1337=['../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','Integration','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','CmHopperFinal','HopperHistory','OpenchannelInteraction','SmsInteraction','SmsInteractions','FaxInteraction','MailInteractions','WhatsappInteractions','SenderId','SET\x20NULL','belongsTo','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','CmList','Lists','cm_user_has_lists','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoicePrefixes','MailQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','Trunk','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Dispositions','Answers','Interactions','MailApplication','List','mandatoryDispositionPause','Agents','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachment','Attachments','Interaction','ChatOfflineMessageId','TagId','MailQueueReport','ListId','Dashboard','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatMessage','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','Phones','CmContactId','HopperFinals','JscriptySessions','OpenchannelInteractions','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','CustomReportId','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','FieldId','SalesforceField','Description','Field','SugarcrmField','Descriptions','DescriptionId','SubjectId','Subject','VariableId','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowAccount','ServicenowConfiguration','FreshsalesConfiguration','FreshsalesField','FromId','ToId','SessionId','ProjectId','VoiceQueues','team_has_mail_queues','ChatQueues','WhatsappQueues','SquareProject','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','FromChatWebsiteId','FromAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','ToFaxQueueId','ToAccount','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','CustomFields','userProfileId','UserProfileSections','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','user','Imap','exports','lodash','jstz','determine','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','defaultsDeep','username','password','options','database','sequelizeHistory','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount'];(function(_0x3997f0,_0x1bf516){var _0xff2824=function(_0x1e9ef1){while(--_0x1e9ef1){_0x3997f0['push'](_0x3997f0['shift']());}};_0xff2824(++_0x1bf516);}(_0x1337,0x1a5));var _0x7133=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0x1337[_0x152aa1];return _0x1bc01a;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x7133('0x0'));var jstz=require(_0x7133('0x1'));var timezone=jstz[_0x7133('0x2')]();config[_0x7133('0x3')]=_['defaultsDeep'](config['sequelize'],{'database':_0x7133('0x4'),'username':_0x7133('0x5'),'password':_0x7133('0x6'),'options':{'host':_0x7133('0x7'),'port':0xcea,'dialect':_0x7133('0x8'),'dialectOptions':{'charset':_0x7133('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x7133('0xa'),'collate':_0x7133('0xb')}}});config['sequelizeHistory']=_[_0x7133('0xc')](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':'xC@LL1234','options':{'host':_0x7133('0x7'),'port':0xcea,'dialect':_0x7133('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x7133('0xa'),'collate':_0x7133('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config['sequelize'][_0x7133('0xd')],config[_0x7133('0x3')][_0x7133('0xe')],config[_0x7133('0x3')][_0x7133('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x7133('0x10')],config['sequelizeHistory'][_0x7133('0xd')],config[_0x7133('0x11')][_0x7133('0xe')],config[_0x7133('0x11')][_0x7133('0xf')])};db[_0x7133('0x12')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x14'));db[_0x7133('0x15')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x16'));db[_0x7133('0x17')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x18'));db[_0x7133('0x19')]=db[_0x7133('0x3')]['import'](_0x7133('0x1a'));db[_0x7133('0x1b')]=db[_0x7133('0x3')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db['sequelize'][_0x7133('0x13')](_0x7133('0x1c'));db[_0x7133('0x1d')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x7133('0x1e')]=db[_0x7133('0x3')]['import'](_0x7133('0x1f'));db[_0x7133('0x20')]=db['sequelize'][_0x7133('0x13')](_0x7133('0x21'));db[_0x7133('0x22')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x23'));db['VoiceCallReport']=db[_0x7133('0x3')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x7133('0x24')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0x7133('0x25')]=db['sequelize']['import'](_0x7133('0x26'));db[_0x7133('0x27')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x7133('0x28')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize'][_0x7133('0x13')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x29'));db[_0x7133('0x2a')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x2b'));db[_0x7133('0x2c')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x2d'));db['UserChatQueue']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x2e'));db[_0x7133('0x2f')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x7133('0x30')]=db[_0x7133('0x3')]['import'](_0x7133('0x31'));db[_0x7133('0x32')]=db['sequelize'][_0x7133('0x13')](_0x7133('0x33'));db[_0x7133('0x34')]=db['sequelize']['import'](_0x7133('0x35'));db[_0x7133('0x36')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x7133('0x37')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x38'));db[_0x7133('0x39')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x3a'));db[_0x7133('0x3b')]=db[_0x7133('0x3')]['import'](_0x7133('0x3c'));db[_0x7133('0x3d')]=db[_0x7133('0x3')]['import'](_0x7133('0x3e'));db['MailSubstatus']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x3f'));db[_0x7133('0x40')]=db['sequelize'][_0x7133('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x7133('0x41')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x42'));db['MailApplication']=db['sequelize'][_0x7133('0x13')](_0x7133('0x43'));db['MailQueueReport']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x44'));db['Dashboard']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/dashboard/dashboard.model');db[_0x7133('0x45')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x46'));db[_0x7133('0x47')]=db['sequelize']['import'](_0x7133('0x48'));db[_0x7133('0x49')]=db['sequelize'][_0x7133('0x13')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x7133('0x4a')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x4b'));db[_0x7133('0x4c')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x4d'));db[_0x7133('0x4e')]=db['sequelize'][_0x7133('0x13')](_0x7133('0x4f'));db['SmsAccount']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x50'));db['SmsApplication']=db[_0x7133('0x3')]['import']('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db['sequelize'][_0x7133('0x13')](_0x7133('0x51'));db[_0x7133('0x52')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x53'));db[_0x7133('0x54')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x55'));db[_0x7133('0x56')]=db[_0x7133('0x3')]['import'](_0x7133('0x57'));db['OpenchannelApplication']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x58'));db['OpenchannelInteraction']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x59'));db[_0x7133('0x5a')]=db['sequelize']['import']('../api/openchannelMessage/openchannelMessage.model');db[_0x7133('0x5b')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x5c'));db['ChatWebsite']=db['sequelize'][_0x7133('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x5d'));db[_0x7133('0x5e')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x5f'));db[_0x7133('0x60')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x61'));db['ChatMessage']=db[_0x7133('0x3')]['import'](_0x7133('0x62'));db[_0x7133('0x63')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x64'));db[_0x7133('0x65')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x66'));db[_0x7133('0x67')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x68'));db['ChatProactiveAction']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x7133('0x69')]=db[_0x7133('0x3')]['import'](_0x7133('0x6a'));db['CmContact']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/cmContact/cmContact.model');db[_0x7133('0x6b')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x6c'));db[_0x7133('0x6d')]=db[_0x7133('0x3')]['import'](_0x7133('0x6e'));db['CmHopperFinal']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x6f'));db[_0x7133('0x70')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x71'));db[_0x7133('0x72')]=db[_0x7133('0x3')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x7133('0x73')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x74'));db[_0x7133('0x75')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x76'));db[_0x7133('0x77')]=db['sequelize'][_0x7133('0x13')](_0x7133('0x78'));db[_0x7133('0x79')]=db['sequelize'][_0x7133('0x13')](_0x7133('0x7a'));db[_0x7133('0x7b')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x7c'));db[_0x7133('0x7d')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x7e'));db['Interval']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x7f'));db[_0x7133('0x80')]=db[_0x7133('0x3')]['import'](_0x7133('0x81'));db[_0x7133('0x82')]=db['sequelize'][_0x7133('0x13')]('../api/cdr/cdr.model');db[_0x7133('0x83')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x84'));db[_0x7133('0x85')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x86'));db[_0x7133('0x87')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/sound/sound.model');db['Tag']=db['sequelize'][_0x7133('0x13')](_0x7133('0x88'));db[_0x7133('0x89')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/contactItemType/contactItemType.model');db[_0x7133('0x8a')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x8b'));db['CmHopperAdditionalPhone']=db[_0x7133('0x3')]['import'](_0x7133('0x8c'));db[_0x7133('0x8d')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/template/template.model');db[_0x7133('0x8e')]=db['sequelize'][_0x7133('0x13')](_0x7133('0x8f'));db[_0x7133('0x90')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x91'));db['Integration']=db['sequelize'][_0x7133('0x13')](_0x7133('0x92'));db[_0x7133('0x93')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x94'));db[_0x7133('0x95')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x96'));db['AnalyticDefaultReport']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x7133('0x97')]=db[_0x7133('0x3')]['import'](_0x7133('0x98'));db[_0x7133('0x99')]=db[_0x7133('0x3')]['import']('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x7133('0x9a')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x9b'));db[_0x7133('0x9c')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x9d'));db['SalesforceConfiguration']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x9e'));db[_0x7133('0x9f')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x7133('0xa0')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xa1'));db['SugarcrmField']=db['sequelize'][_0x7133('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x7133('0xa2')]=db[_0x7133('0x3')]['import'](_0x7133('0xa3'));db[_0x7133('0xa4')]=db['sequelize'][_0x7133('0x13')](_0x7133('0xa5'));db[_0x7133('0xa6')]=db['sequelize'][_0x7133('0x13')](_0x7133('0xa7'));db[_0x7133('0xa8')]=db['sequelize'][_0x7133('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x7133('0xa9')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xaa'));db[_0x7133('0xab')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xac'));db[_0x7133('0xad')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xae'));db[_0x7133('0xaf')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xb0'));db[_0x7133('0xb1')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xb2'));db[_0x7133('0xb3')]=db['sequelize'][_0x7133('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x7133('0xb4')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xb5'));db[_0x7133('0xb6')]=db[_0x7133('0x3')]['import'](_0x7133('0xb7'));db['VtigerAccount']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xb8'));db[_0x7133('0xb9')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xba'));db[_0x7133('0xbb')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xbc'));db['ServicenowAccount']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xbd'));db['ServicenowConfiguration']=db['sequelize'][_0x7133('0x13')](_0x7133('0xbe'));db[_0x7133('0xbf')]=db['sequelize'][_0x7133('0x13')](_0x7133('0xc0'));db[_0x7133('0xc1')]=db['sequelize'][_0x7133('0x13')](_0x7133('0xc2'));db[_0x7133('0xc3')]=db['sequelize'][_0x7133('0x13')](_0x7133('0xc4'));db[_0x7133('0xc5')]=db['sequelize'][_0x7133('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x7133('0xc6')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x7133('0xc7')]=db['sequelize'][_0x7133('0x13')](_0x7133('0x92'));db[_0x7133('0xc8')]=db[_0x7133('0x3')]['import'](_0x7133('0xc9'));db[_0x7133('0xca')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x7133('0xcb')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x7133('0xcc')]=db['sequelize'][_0x7133('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x7133('0xcd')]=db['sequelize'][_0x7133('0x13')](_0x7133('0xce'));db[_0x7133('0xcf')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xd0'));db[_0x7133('0xd1')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0x7133('0xd2')]=db['sequelize']['import'](_0x7133('0xd3'));db[_0x7133('0xd4')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xd5'));db[_0x7133('0xd6')]=db['sequelize']['import'](_0x7133('0xd7'));db[_0x7133('0xd8')]=db['sequelize'][_0x7133('0x13')](_0x7133('0xd9'));db['SquareOdbc']=db['sequelize'][_0x7133('0x13')](_0x7133('0xda'));db['SquareProject']=db['sequelize'][_0x7133('0x13')](_0x7133('0xdb'));db[_0x7133('0xdc')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xdd'));db[_0x7133('0xde')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xdf'));db[_0x7133('0xe0')]=db[_0x7133('0x3')]['import']('../api/team/team.model');db[_0x7133('0xe1')]=db['sequelize']['import'](_0x7133('0xe2'));db['Campaign']=db[_0x7133('0x3')]['import'](_0x7133('0xe3'));db[_0x7133('0xe4')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xe5'));db['Attachment']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/attachment/attachment.model');db['Plugin']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/plugin/plugin.model');db[_0x7133('0xe6')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xe7'));db[_0x7133('0xe8')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xe9'));db[_0x7133('0xea')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xeb'));db['OpenchannelTransferReport']=db[_0x7133('0x3')][_0x7133('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x7133('0xec')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xed'));db['CmList']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xee'));db[_0x7133('0xef')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xf0'));db[_0x7133('0xf1')]=db['sequelize'][_0x7133('0x13')](_0x7133('0xf2'));db[_0x7133('0xf3')]=db[_0x7133('0x3')]['import'](_0x7133('0xf4'));db[_0x7133('0xf5')]=db['sequelize'][_0x7133('0x13')](_0x7133('0xf6'));db[_0x7133('0xf7')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xf8'));db[_0x7133('0xf9')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/whatsappAccount/whatsappAccount.model');db[_0x7133('0xfa')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0x7133('0xfb')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0xfc'));db[_0x7133('0xfd')]=db['sequelize'][_0x7133('0x13')](_0x7133('0xfe'));db[_0x7133('0xff')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x100'));db['WhatsappTransferReport']=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x101'));db[_0x7133('0x102')]=db['sequelize'][_0x7133('0x13')](_0x7133('0x103'));db[_0x7133('0x104')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x105'));db[_0x7133('0x106')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x107'));db[_0x7133('0x108')]=db['sequelize']['import'](_0x7133('0x109'));db[_0x7133('0x10a')]=db[_0x7133('0x3')][_0x7133('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x7133('0x10b')]=db[_0x7133('0x3')][_0x7133('0x13')](_0x7133('0x10c'));db[_0x7133('0x12')][_0x7133('0x10d')](db[_0x7133('0x20')],{'as':_0x7133('0x20'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x10f')});db['User']['hasOne'](db['UserSetting'],{'as':_0x7133('0x110'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x10f')});db[_0x7133('0x12')][_0x7133('0x111')](db[_0x7133('0x1d')],{'as':_0x7133('0x112'),'foreignKey':'UserId'});db[_0x7133('0x12')][_0x7133('0x111')](db[_0x7133('0x2a')],{'as':_0x7133('0x113'),'foreignKey':_0x7133('0x10f')});db[_0x7133('0x12')]['hasMany'](db[_0x7133('0x19')],{'as':_0x7133('0x114'),'onDelete':'cascade','hooks':!![]});db['User']['hasMany'](db[_0x7133('0x115')],{'as':'HopperFinals','foreignKey':_0x7133('0x10f')});db[_0x7133('0x12')][_0x7133('0x111')](db[_0x7133('0x70')],{'as':_0x7133('0x116'),'foreignKey':'UserId'});db[_0x7133('0x12')][_0x7133('0x111')](db[_0x7133('0x72')],{'as':_0x7133('0x72'),'foreignKey':'UserId'});db[_0x7133('0x12')][_0x7133('0x111')](db[_0x7133('0x117')],{'as':'OpenchannelInteractions','foreignKey':_0x7133('0x10f')});db['User'][_0x7133('0x111')](db[_0x7133('0x60')],{'as':'ChatInteractions','foreignKey':_0x7133('0x10f')});db['User'][_0x7133('0x111')](db[_0x7133('0x118')],{'as':_0x7133('0x119'),'foreignKey':'UserId'});db['User'][_0x7133('0x111')](db[_0x7133('0x11a')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x7133('0x12')]['hasMany'](db[_0x7133('0x40')],{'as':_0x7133('0x11b'),'foreignKey':_0x7133('0x10f')});db[_0x7133('0x12')][_0x7133('0x111')](db['WhatsappInteraction'],{'as':_0x7133('0x11c'),'foreignKey':'UserId'});db[_0x7133('0x12')][_0x7133('0x111')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0x7133('0x11d')});db['User'][_0x7133('0x111')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x7133('0x10f'),'onDelete':_0x7133('0x11e')});db[_0x7133('0x12')][_0x7133('0x11f')](db['UserProfile'],{'as':_0x7133('0xf1'),'foreignKey':'userProfileId'});db[_0x7133('0x12')][_0x7133('0x120')](db['ChatGroup'],{'as':_0x7133('0x121'),'through':_0x7133('0x122')});db[_0x7133('0x12')]['belongsToMany'](db[_0x7133('0x123')],{'as':_0x7133('0x124'),'through':'cm_user_has_contacts'});db[_0x7133('0x12')]['belongsToMany'](db[_0x7133('0x125')],{'as':_0x7133('0x126'),'through':_0x7133('0x127')});db[_0x7133('0x12')][_0x7133('0x120')](db['Team'],{'through':'user_has_teams'});db[_0x7133('0x12')][_0x7133('0x120')](db[_0x7133('0x40')],{'as':_0x7133('0x11b'),'through':_0x7133('0x128')});db[_0x7133('0x12')]['belongsToMany'](db[_0x7133('0x60')],{'as':_0x7133('0x129'),'through':_0x7133('0x12a')});db[_0x7133('0x12')][_0x7133('0x120')](db[_0x7133('0x11a')],{'as':_0x7133('0x12b'),'through':_0x7133('0x12c')});db['User']['belongsToMany'](db['SmsInteraction'],{'as':_0x7133('0x119'),'through':_0x7133('0x12d')});db[_0x7133('0x12')][_0x7133('0x120')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x7133('0x12e')});db['User']['belongsToMany'](db[_0x7133('0xfb')],{'as':'WhatsappInteractions','through':_0x7133('0x12f')});db[_0x7133('0x12')][_0x7133('0x120')](db[_0x7133('0x130')],{'as':'VoiceQueues','through':_0x7133('0x2c'),'required':![]});db['User'][_0x7133('0x120')](db[_0x7133('0xef')],{'as':_0x7133('0x131'),'through':_0x7133('0x10a'),'required':![]});db['User'][_0x7133('0x120')](db[_0x7133('0x3d')],{'as':_0x7133('0x132'),'through':_0x7133('0x2f'),'required':![]});db[_0x7133('0x12')][_0x7133('0x120')](db[_0x7133('0x65')],{'as':'ChatQueues','through':_0x7133('0x133'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0x7133('0x4c')],{'as':_0x7133('0x134'),'through':'UserFaxQueue','required':![]});db['User'][_0x7133('0x120')](db['SmsQueue'],{'as':_0x7133('0x135'),'through':'UserSmsQueue','required':![]});db['User'][_0x7133('0x120')](db[_0x7133('0x5b')],{'as':_0x7133('0x136'),'through':_0x7133('0x34'),'required':![]});db[_0x7133('0x12')][_0x7133('0x120')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db['User'][_0x7133('0x120')](db[_0x7133('0x125')],{'through':_0x7133('0x127')});db['User'][_0x7133('0x120')](db[_0x7133('0x137')],{'as':_0x7133('0x138'),'through':_0x7133('0x139')});db[_0x7133('0x12')][_0x7133('0x120')](db[_0x7133('0x47')],{'as':'FaxAccounts','through':_0x7133('0x13a')});db['User']['belongsToMany'](db['MailAccount'],{'as':_0x7133('0x13b'),'through':_0x7133('0x13c')});db[_0x7133('0x12')][_0x7133('0x120')](db[_0x7133('0x56')],{'as':_0x7133('0x13d'),'through':_0x7133('0x13e')});db['User'][_0x7133('0x120')](db[_0x7133('0x13f')],{'as':_0x7133('0x140'),'through':_0x7133('0x141')});db[_0x7133('0x12')][_0x7133('0x120')](db[_0x7133('0xf9')],{'as':_0x7133('0x142'),'through':_0x7133('0x143')});db[_0x7133('0x15')][_0x7133('0x111')](db[_0x7133('0x19')],{'as':_0x7133('0x144'),'onDelete':_0x7133('0x10e'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0x7133('0x111')](db[_0x7133('0x19')],{'onDelete':_0x7133('0x10e')});db[_0x7133('0x19')][_0x7133('0x111')](db[_0x7133('0x19')],{'as':_0x7133('0x145'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x1b')][_0x7133('0x120')](db[_0x7133('0x87')],{'as':_0x7133('0x146'),'through':_0x7133('0x147')});db[_0x7133('0x130')][_0x7133('0x111')](db[_0x7133('0x2a')],{'as':_0x7133('0x148'),'foreignKey':_0x7133('0x149')});db[_0x7133('0x130')][_0x7133('0x111')](db['CmHopper'],{'as':_0x7133('0x14a'),'foreignKey':_0x7133('0x149')});db[_0x7133('0x130')][_0x7133('0x111')](db[_0x7133('0x115')],{'as':'HopperFinals','foreignKey':_0x7133('0x149')});db[_0x7133('0x130')]['hasMany'](db[_0x7133('0x70')],{'as':_0x7133('0x14b'),'foreignKey':_0x7133('0x149')});db[_0x7133('0x130')][_0x7133('0x111')](db['ReportAgentPreview'],{'as':_0x7133('0x72'),'foreignKey':_0x7133('0x149')});db[_0x7133('0x130')]['hasMany'](db['CmHopperBlack'],{'as':_0x7133('0x14c'),'foreignKey':_0x7133('0x149')});db[_0x7133('0x130')][_0x7133('0x111')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x7133('0x149')});db[_0x7133('0x130')]['belongsTo'](db['Trunk'],{'as':_0x7133('0x14d'),'foreignKey':'TrunkId'});db[_0x7133('0x130')][_0x7133('0x11f')](db[_0x7133('0x14d')],{'as':'TrunkBackup','foreignKey':_0x7133('0x14e')});db[_0x7133('0x130')][_0x7133('0x11f')](db[_0x7133('0x14f')],{'as':_0x7133('0x14f'),'foreignKey':_0x7133('0x150')});db[_0x7133('0x130')][_0x7133('0x11f')](db[_0x7133('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x7133('0x151')});db['VoiceQueue'][_0x7133('0x120')](db[_0x7133('0x125')],{'as':_0x7133('0x126'),'through':_0x7133('0x152')});db[_0x7133('0x130')][_0x7133('0x120')](db[_0x7133('0x12')],{'as':'Agents','through':_0x7133('0x2c')});db['VoiceQueue'][_0x7133('0x120')](db['Team'],{'as':_0x7133('0x153'),'through':_0x7133('0x106')});db[_0x7133('0x130')][_0x7133('0x120')](db[_0x7133('0x125')],{'as':_0x7133('0x154'),'through':_0x7133('0x155')});db['VoiceRecording'][_0x7133('0x11f')](db['User'],{'as':_0x7133('0x12'),'foreignKey':_0x7133('0x10f')});db[_0x7133('0x1e')][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':_0x7133('0x12'),'foreignKey':_0x7133('0x10f')});db[_0x7133('0x20')][_0x7133('0x111')](db[_0x7133('0x22')],{'as':_0x7133('0x156'),'onDelete':'cascade','foreignKey':_0x7133('0x157'),'sourceKey':_0x7133('0x158')});db[_0x7133('0x22')][_0x7133('0x11f')](db[_0x7133('0x20')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0x7133('0x159')][_0x7133('0x111')](db['VoiceQueueReport'],{'as':_0x7133('0x15a'),'foreignKey':_0x7133('0x15b'),'constraints':![]});db[_0x7133('0x159')]['hasMany'](db[_0x7133('0x25')],{'as':_0x7133('0x15c'),'foreignKey':_0x7133('0x15b'),'constraints':![]});db[_0x7133('0x159')][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':_0x7133('0x12'),'foreignKey':'UserId'});db[_0x7133('0x159')][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':_0x7133('0x15e')});db[_0x7133('0x37')][_0x7133('0x11f')](db['MailAccount'],{'as':_0x7133('0x3b'),'foreignKey':_0x7133('0x15f')});db[_0x7133('0x37')]['belongsTo'](db[_0x7133('0x104')],{'as':_0x7133('0x104'),'foreignKey':_0x7133('0x160'),'onDelete':_0x7133('0x161')});db[_0x7133('0x39')][_0x7133('0x11f')](db[_0x7133('0x3b')],{'as':_0x7133('0x3b'),'foreignKey':_0x7133('0x15f')});db['MailServerOut'][_0x7133('0x11f')](db[_0x7133('0x104')],{'as':'CloudProvider','foreignKey':_0x7133('0x160'),'onDelete':_0x7133('0x161')});db[_0x7133('0x3b')]['hasOne'](db[_0x7133('0x37')],{'as':'Imap','onDelete':_0x7133('0x10e')});db[_0x7133('0x3b')][_0x7133('0x10d')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x7133('0x10e')});db['MailAccount']['hasMany'](db[_0x7133('0x7b')],{'as':_0x7133('0x162'),'foreignKey':'MailAccountId','onDelete':_0x7133('0x10e')});db[_0x7133('0x3b')][_0x7133('0x111')](db[_0x7133('0x79')],{'as':_0x7133('0x163'),'foreignKey':_0x7133('0x15f')});db[_0x7133('0x3b')][_0x7133('0x111')](db[_0x7133('0x41')],{'as':_0x7133('0x156'),'foreignKey':_0x7133('0x15f')});db[_0x7133('0x3b')][_0x7133('0x111')](db[_0x7133('0x40')],{'as':_0x7133('0x164')});db[_0x7133('0x3b')]['hasMany'](db[_0x7133('0x165')],{'as':_0x7133('0x145'),'foreignKey':'MailAccountId','onDelete':_0x7133('0x10e')});db['MailAccount'][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':_0x7133('0x166'),'foreignKey':'ListId'});db['MailAccount']['belongsTo'](db['Template'],{'as':_0x7133('0x8d'),'foreignKey':'TemplateId'});db[_0x7133('0x3b')][_0x7133('0x11f')](db[_0x7133('0x80')],{'as':_0x7133('0x167'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7133('0x3b')][_0x7133('0x120')](db['User'],{'as':_0x7133('0x168'),'through':'user_has_mail_accounts'});db[_0x7133('0x3d')][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x168'),'through':'UserMailQueue'});db[_0x7133('0x3d')][_0x7133('0x120')](db[_0x7133('0xe0')],{'through':'team_has_mail_queues','as':_0x7133('0x153')});db[_0x7133('0x40')]['hasMany'](db[_0x7133('0x41')],{'as':'Messages','onDelete':_0x7133('0x10e'),'foreignKey':'MailInteractionId'});db[_0x7133('0x40')][_0x7133('0x11f')](db[_0x7133('0x3b')],{'as':_0x7133('0x169'),'foreignKey':_0x7133('0x15f')});db[_0x7133('0x40')][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':'ContactId'});db[_0x7133('0x40')][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':_0x7133('0x16a'),'foreignKey':_0x7133('0x10f')});db[_0x7133('0x40')][_0x7133('0x120')](db[_0x7133('0x16b')],{'through':_0x7133('0x16c'),'as':_0x7133('0x16d')});db[_0x7133('0x40')][_0x7133('0x120')](db[_0x7133('0x16b')],{'through':_0x7133('0x16c'),'as':_0x7133('0x16e')});db['MailInteraction'][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x16f'),'through':_0x7133('0x128'),'foreignKey':_0x7133('0x170')});db[_0x7133('0x41')][_0x7133('0x111')](db[_0x7133('0x171')],{'as':_0x7133('0x172'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x41')][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':_0x7133('0x12')});db[_0x7133('0x41')][_0x7133('0x11f')](db[_0x7133('0x123')],{'onDelete':_0x7133('0x10e'),'as':_0x7133('0x15d')});db[_0x7133('0x41')]['belongsTo'](db['MailInteraction'],{'as':_0x7133('0x173'),'foreignKey':'MailInteractionId'});db[_0x7133('0x41')][_0x7133('0x11f')](db['MailAccount'],{'as':'Account','foreignKey':_0x7133('0x15f')});db[_0x7133('0x41')][_0x7133('0x11f')](db[_0x7133('0x137')],{'as':_0x7133('0x137'),'foreignKey':'ChatWebsiteId'});db[_0x7133('0x41')]['belongsTo'](db[_0x7133('0x63')],{'as':_0x7133('0x63'),'foreignKey':_0x7133('0x174')});db[_0x7133('0x165')][_0x7133('0x11f')](db['User'],{'onDelete':_0x7133('0x161')});db[_0x7133('0x165')]['belongsTo'](db[_0x7133('0x3d')],{'onDelete':_0x7133('0x161')});db[_0x7133('0x165')][_0x7133('0x11f')](db['MailAccount'],{'onDelete':_0x7133('0x161')});db[_0x7133('0x165')]['belongsTo'](db[_0x7133('0x14f')],{'onDelete':'restrict','foreignKey':_0x7133('0x150')});db[_0x7133('0x165')][_0x7133('0x11f')](db['Tag'],{'onDelete':_0x7133('0x161'),'foreignKey':_0x7133('0x175')});db[_0x7133('0x176')][_0x7133('0x11f')](db[_0x7133('0x3b')],{});db[_0x7133('0x176')]['belongsTo'](db[_0x7133('0x125')],{'as':_0x7133('0x166'),'foreignKey':_0x7133('0x177')});db[_0x7133('0x176')][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':_0x7133('0x15e')});db[_0x7133('0x176')][_0x7133('0x11f')](db[_0x7133('0x40')],{});db['MailQueueReport'][_0x7133('0x11f')](db[_0x7133('0x41')],{});db['MailQueueReport'][_0x7133('0x11f')](db[_0x7133('0x12')],{});db[_0x7133('0x176')][_0x7133('0x11f')](db[_0x7133('0x3d')],{});db[_0x7133('0x178')]['hasMany'](db[_0x7133('0x45')],{'as':_0x7133('0x179'),'onDelete':_0x7133('0x10e')});db['FaxAccount']['hasMany'](db[_0x7133('0x7b')],{'as':_0x7133('0x162'),'foreignKey':_0x7133('0x17a'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x47')][_0x7133('0x111')](db[_0x7133('0x79')],{'as':_0x7133('0x163'),'foreignKey':_0x7133('0x17a')});db[_0x7133('0x47')][_0x7133('0x111')](db[_0x7133('0x11a')],{'as':'Interactions'});db[_0x7133('0x47')][_0x7133('0x111')](db[_0x7133('0x49')],{'as':_0x7133('0x145'),'foreignKey':_0x7133('0x17a'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x47')][_0x7133('0x111')](db[_0x7133('0x19')],{'as':_0x7133('0x17b'),'onDelete':'cascade'});db[_0x7133('0x47')][_0x7133('0x111')](db[_0x7133('0x4a')],{'as':_0x7133('0x156')});db[_0x7133('0x47')][_0x7133('0x11f')](db['Trunk'],{'as':_0x7133('0x14d')});db['FaxAccount'][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':_0x7133('0x166'),'foreignKey':'ListId'});db[_0x7133('0x47')]['belongsTo'](db[_0x7133('0x80')],{'as':_0x7133('0x167'),'foreignKey':_0x7133('0x151')});db[_0x7133('0x47')][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x168'),'through':_0x7133('0x13a')});db['FaxApplication'][_0x7133('0x11f')](db[_0x7133('0x12')],{'onDelete':_0x7133('0x161')});db[_0x7133('0x49')][_0x7133('0x11f')](db[_0x7133('0x4c')],{'onDelete':_0x7133('0x161')});db[_0x7133('0x49')][_0x7133('0x11f')](db[_0x7133('0x47')],{'onDelete':'restrict'});db[_0x7133('0x49')][_0x7133('0x11f')](db['Tag'],{'onDelete':_0x7133('0x161'),'foreignKey':'TagId'});db[_0x7133('0x11a')][_0x7133('0x111')](db['FaxMessage'],{'as':_0x7133('0x156'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x17c')});db['FaxInteraction']['belongsTo'](db[_0x7133('0x47')],{'as':_0x7133('0x169'),'foreignKey':_0x7133('0x17a')});db[_0x7133('0x11a')][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':'Contact','foreignKey':_0x7133('0x15e')});db[_0x7133('0x11a')][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':_0x7133('0x16a'),'foreignKey':_0x7133('0x10f')});db[_0x7133('0x11a')]['belongsToMany'](db['Tag'],{'through':_0x7133('0x17d'),'as':_0x7133('0x16d')});db[_0x7133('0x11a')][_0x7133('0x120')](db[_0x7133('0x16b')],{'through':'fax_interaction_has_tags','as':_0x7133('0x16e')});db[_0x7133('0x11a')]['belongsToMany'](db[_0x7133('0x12')],{'as':_0x7133('0x16f'),'through':'user_has_fax_interactions','foreignKey':_0x7133('0x17c')});db[_0x7133('0x4a')]['belongsTo'](db['User'],{'onDelete':_0x7133('0x10e'),'as':_0x7133('0x12')});db['FaxMessage'][_0x7133('0x11f')](db[_0x7133('0x11a')],{'as':_0x7133('0x173'),'foreignKey':_0x7133('0x17c')});db[_0x7133('0x4a')]['belongsTo'](db[_0x7133('0x123')],{'onDelete':'cascade','as':'Contact'});db[_0x7133('0x4a')]['belongsTo'](db['Attachment'],{'as':_0x7133('0x171'),'foreignKey':_0x7133('0x17e')});db[_0x7133('0x4a')][_0x7133('0x11f')](db['FaxAccount'],{'as':_0x7133('0x169'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x168'),'through':_0x7133('0x30')});db[_0x7133('0x4c')][_0x7133('0x120')](db[_0x7133('0xe0')],{'through':_0x7133('0x17f'),'as':_0x7133('0x153')});db['FaxQueueReport']['belongsTo'](db[_0x7133('0x47')],{});db[_0x7133('0x4e')][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':_0x7133('0x166'),'foreignKey':_0x7133('0x177')});db[_0x7133('0x4e')][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':'ContactId'});db[_0x7133('0x4e')][_0x7133('0x11f')](db[_0x7133('0x11a')],{});db[_0x7133('0x4e')][_0x7133('0x11f')](db[_0x7133('0x4a')],{});db['FaxQueueReport'][_0x7133('0x11f')](db[_0x7133('0x12')],{});db[_0x7133('0x4e')]['belongsTo'](db[_0x7133('0x4c')],{});db[_0x7133('0x13f')][_0x7133('0x111')](db[_0x7133('0x7b')],{'as':_0x7133('0x162'),'foreignKey':_0x7133('0x180'),'onDelete':'cascade'});db['SmsAccount'][_0x7133('0x111')](db[_0x7133('0x79')],{'as':_0x7133('0x163'),'foreignKey':_0x7133('0x180')});db[_0x7133('0x13f')][_0x7133('0x111')](db[_0x7133('0x52')],{'as':_0x7133('0x156'),'foreignKey':_0x7133('0x180')});db[_0x7133('0x13f')]['hasMany'](db['SmsInteraction'],{'as':_0x7133('0x164')});db[_0x7133('0x13f')][_0x7133('0x111')](db[_0x7133('0x181')],{'as':_0x7133('0x145'),'foreignKey':'SmsAccountId','onDelete':_0x7133('0x10e')});db[_0x7133('0x13f')][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':_0x7133('0x166'),'foreignKey':'ListId'});db['SmsAccount'][_0x7133('0x11f')](db[_0x7133('0x80')],{'as':_0x7133('0x167'),'foreignKey':_0x7133('0x151')});db['SmsAccount'][_0x7133('0x120')](db[_0x7133('0x12')],{'as':'Agents','through':_0x7133('0x141')});db[_0x7133('0x181')][_0x7133('0x11f')](db[_0x7133('0x12')],{'onDelete':'restrict'});db[_0x7133('0x181')][_0x7133('0x11f')](db['SmsQueue'],{'onDelete':_0x7133('0x161')});db[_0x7133('0x181')][_0x7133('0x11f')](db['SmsAccount'],{'onDelete':_0x7133('0x161')});db[_0x7133('0x181')][_0x7133('0x11f')](db[_0x7133('0x14f')],{'onDelete':_0x7133('0x161'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x7133('0x11f')](db['Tag'],{'onDelete':_0x7133('0x161'),'foreignKey':_0x7133('0x175')});db[_0x7133('0x118')]['hasMany'](db[_0x7133('0x52')],{'as':_0x7133('0x156'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x182')});db[_0x7133('0x118')][_0x7133('0x11f')](db['SmsAccount'],{'as':_0x7133('0x169'),'foreignKey':_0x7133('0x180')});db[_0x7133('0x118')][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':_0x7133('0x15e')});db[_0x7133('0x118')][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':_0x7133('0x16a'),'foreignKey':_0x7133('0x10f')});db[_0x7133('0x118')]['belongsToMany'](db[_0x7133('0x16b')],{'through':_0x7133('0x183'),'as':_0x7133('0x16d')});db[_0x7133('0x118')]['belongsToMany'](db[_0x7133('0x16b')],{'through':_0x7133('0x183'),'as':_0x7133('0x16e')});db['SmsInteraction'][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x16f'),'through':_0x7133('0x12d'),'foreignKey':'SmsInteractionId'});db[_0x7133('0x52')][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':'User'});db[_0x7133('0x52')][_0x7133('0x11f')](db['CmContact'],{'onDelete':_0x7133('0x10e'),'as':_0x7133('0x15d')});db[_0x7133('0x52')][_0x7133('0x11f')](db['SmsInteraction'],{'onDelete':_0x7133('0x10e'),'as':_0x7133('0x173'),'foreignKey':_0x7133('0x182')});db[_0x7133('0x52')][_0x7133('0x11f')](db[_0x7133('0x13f')],{'as':_0x7133('0x169'),'foreignKey':_0x7133('0x180')});db['SmsQueue'][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x168'),'through':_0x7133('0x32'),'foreignKey':_0x7133('0x184')});db['SmsQueue'][_0x7133('0x120')](db[_0x7133('0xe0')],{'through':_0x7133('0x185'),'as':_0x7133('0x153')});db['OpenchannelAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7133('0x186'),'onDelete':_0x7133('0x10e')});db['OpenchannelAccount']['hasMany'](db[_0x7133('0x79')],{'as':_0x7133('0x163'),'foreignKey':_0x7133('0x186')});db[_0x7133('0x56')]['hasMany'](db[_0x7133('0x117')],{'as':_0x7133('0x164'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x7133('0x111')](db[_0x7133('0x5a')],{'as':_0x7133('0x156'),'foreignKey':_0x7133('0x186')});db[_0x7133('0x56')][_0x7133('0x111')](db[_0x7133('0x187')],{'as':_0x7133('0x145'),'foreignKey':_0x7133('0x186'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x56')][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':_0x7133('0x166'),'foreignKey':_0x7133('0x177')});db[_0x7133('0x56')][_0x7133('0x11f')](db[_0x7133('0x80')],{'as':_0x7133('0x167'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7133('0x56')][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x168'),'through':_0x7133('0x13e')});db[_0x7133('0x187')][_0x7133('0x11f')](db[_0x7133('0x12')],{'onDelete':'restrict'});db['OpenchannelApplication'][_0x7133('0x11f')](db[_0x7133('0x5b')],{'onDelete':'restrict','foreignKey':_0x7133('0x188')});db[_0x7133('0x187')][_0x7133('0x11f')](db[_0x7133('0x56')],{'onDelete':_0x7133('0x161'),'foreignKey':_0x7133('0x186')});db[_0x7133('0x187')]['belongsTo'](db[_0x7133('0x14f')],{'onDelete':_0x7133('0x161'),'foreignKey':'IntervalId'});db[_0x7133('0x187')][_0x7133('0x11f')](db[_0x7133('0x16b')],{'onDelete':'restrict','foreignKey':_0x7133('0x175')});db['OpenchannelInteraction'][_0x7133('0x111')](db[_0x7133('0x5a')],{'as':_0x7133('0x156'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x189')});db[_0x7133('0x117')][_0x7133('0x11f')](db['OpenchannelAccount'],{'as':_0x7133('0x169'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':_0x7133('0x15e')});db['OpenchannelInteraction'][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':'Owner','foreignKey':_0x7133('0x10f')});db[_0x7133('0x117')][_0x7133('0x120')](db[_0x7133('0x16b')],{'through':_0x7133('0x18a'),'as':_0x7133('0x16d')});db[_0x7133('0x117')]['belongsToMany'](db[_0x7133('0x16b')],{'through':'openchannel_interaction_has_tags','as':_0x7133('0x16e')});db[_0x7133('0x117')][_0x7133('0x120')](db['User'],{'as':'Users','through':_0x7133('0x12e'),'foreignKey':_0x7133('0x189')});db['OpenchannelMessage']['belongsTo'](db[_0x7133('0x12')],{'onDelete':_0x7133('0x10e'),'as':_0x7133('0x12')});db[_0x7133('0x5a')][_0x7133('0x11f')](db[_0x7133('0x123')],{'onDelete':_0x7133('0x10e'),'as':_0x7133('0x15d')});db[_0x7133('0x5a')][_0x7133('0x11f')](db[_0x7133('0x117')],{'onDelete':_0x7133('0x10e'),'as':_0x7133('0x173'),'foreignKey':_0x7133('0x189')});db[_0x7133('0x5a')][_0x7133('0x11f')](db[_0x7133('0x171')],{'as':_0x7133('0x171'),'foreignKey':_0x7133('0x17e')});db[_0x7133('0x5a')][_0x7133('0x11f')](db[_0x7133('0x56')],{'as':_0x7133('0x169'),'foreignKey':_0x7133('0x186')});db['OpenchannelQueue'][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x168'),'through':_0x7133('0x34'),'foreignKey':_0x7133('0x188')});db[_0x7133('0x5b')][_0x7133('0x120')](db[_0x7133('0xe0')],{'through':_0x7133('0x18b'),'as':'Teams'});db[_0x7133('0x137')][_0x7133('0x111')](db[_0x7133('0x7b')],{'as':_0x7133('0x162'),'foreignKey':_0x7133('0x18c'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x137')]['hasMany'](db['CannedAnswer'],{'as':_0x7133('0x163'),'foreignKey':_0x7133('0x18c')});db[_0x7133('0x137')][_0x7133('0x111')](db[_0x7133('0x18d')],{'as':_0x7133('0x18e')});db[_0x7133('0x137')][_0x7133('0x111')](db[_0x7133('0x60')],{'as':'Interactions'});db[_0x7133('0x137')][_0x7133('0x111')](db[_0x7133('0x5e')],{'as':'Applications','foreignKey':_0x7133('0x18c'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x137')][_0x7133('0x111')](db[_0x7133('0x18f')],{'as':_0x7133('0x156')});db[_0x7133('0x137')][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':'List','foreignKey':'ListId'});db[_0x7133('0x137')][_0x7133('0x11f')](db['Interval'],{'as':_0x7133('0x14f'),'foreignKey':'IntervalId'});db[_0x7133('0x137')]['belongsTo'](db[_0x7133('0x3b')],{'as':_0x7133('0x3b'),'foreignKey':_0x7133('0x15f')});db[_0x7133('0x137')][_0x7133('0x11f')](db[_0x7133('0x80')],{'as':_0x7133('0x167'),'foreignKey':_0x7133('0x151')});db[_0x7133('0x137')][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x168'),'through':_0x7133('0x139')});db['OpenchannelQueueReport'][_0x7133('0x11f')](db['OpenchannelAccount'],{});db[_0x7133('0x190')][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':_0x7133('0x166'),'foreignKey':_0x7133('0x177')});db[_0x7133('0x190')][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':'Contact','foreignKey':_0x7133('0x15e')});db['OpenchannelQueueReport'][_0x7133('0x11f')](db[_0x7133('0x117')],{});db[_0x7133('0x190')]['belongsTo'](db[_0x7133('0x5a')],{});db[_0x7133('0x190')][_0x7133('0x11f')](db[_0x7133('0x12')],{});db['OpenchannelQueueReport'][_0x7133('0x11f')](db[_0x7133('0x5b')],{});db[_0x7133('0x5e')]['belongsTo'](db[_0x7133('0x12')],{'as':_0x7133('0x191'),'foreignKey':_0x7133('0x10f'),'onDelete':_0x7133('0x161')});db[_0x7133('0x5e')][_0x7133('0x11f')](db[_0x7133('0x65')],{'as':_0x7133('0x192'),'foreignKey':_0x7133('0x193'),'onDelete':_0x7133('0x161')});db[_0x7133('0x5e')][_0x7133('0x11f')](db[_0x7133('0x137')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x7133('0x161')});db[_0x7133('0x5e')][_0x7133('0x11f')](db[_0x7133('0x16b')],{'onDelete':_0x7133('0x161'),'foreignKey':_0x7133('0x175')});db['ChatInteraction'][_0x7133('0x111')](db['ChatMessage'],{'as':_0x7133('0x156'),'onDelete':'cascade','foreignKey':_0x7133('0x194')});db[_0x7133('0x60')][_0x7133('0x11f')](db[_0x7133('0x137')],{'as':_0x7133('0x169'),'foreignKey':'ChatWebsiteId'});db[_0x7133('0x60')][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':_0x7133('0x15e')});db[_0x7133('0x60')][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':'Owner','foreignKey':_0x7133('0x10f')});db['ChatInteraction'][_0x7133('0x120')](db[_0x7133('0x16b')],{'through':_0x7133('0x195'),'as':'Tags'});db[_0x7133('0x60')][_0x7133('0x120')](db[_0x7133('0x16b')],{'through':_0x7133('0x195'),'as':_0x7133('0x16e')});db[_0x7133('0x60')][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x16f'),'through':_0x7133('0x12a'),'foreignKey':_0x7133('0x194')});db[_0x7133('0x18f')]['belongsTo'](db[_0x7133('0x12')],{'onDelete':_0x7133('0x10e'),'as':_0x7133('0x12')});db[_0x7133('0x18f')][_0x7133('0x11f')](db[_0x7133('0x123')],{'onDelete':'cascade','as':_0x7133('0x15d'),'foreignKey':'ContactId'});db[_0x7133('0x18f')]['belongsTo'](db[_0x7133('0x60')],{'onDelete':_0x7133('0x10e'),'as':_0x7133('0x173'),'foreignKey':_0x7133('0x194')});db[_0x7133('0x18f')]['belongsTo'](db[_0x7133('0x171')],{'as':_0x7133('0x171'),'foreignKey':'AttachmentId'});db[_0x7133('0x18f')][_0x7133('0x11f')](db[_0x7133('0x137')],{'as':'Account','foreignKey':_0x7133('0x18c')});db['ChatOfflineMessage'][_0x7133('0x111')](db[_0x7133('0x171')],{'as':_0x7133('0x172'),'foreignKey':_0x7133('0x174'),'onDelete':_0x7133('0x10e'),'hooks':!![]});db[_0x7133('0x63')][_0x7133('0x11f')](db[_0x7133('0x123')],{'onDelete':'cascade','as':_0x7133('0x15d'),'foreignKey':_0x7133('0x15e')});db[_0x7133('0x63')][_0x7133('0x11f')](db[_0x7133('0x137')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x7133('0x65')][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x168'),'through':_0x7133('0x133'),'hooks':!![]});db[_0x7133('0x65')][_0x7133('0x120')](db[_0x7133('0xe0')],{'through':_0x7133('0x196'),'as':'Teams'});db[_0x7133('0x67')]['hasMany'](db['ChatInternalMessage'],{'as':_0x7133('0x156'),'foreignKey':_0x7133('0x197'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x67')][_0x7133('0x120')](db[_0x7133('0x12')],{'as':'Members','through':_0x7133('0x122')});db[_0x7133('0x18d')][_0x7133('0x11f')](db[_0x7133('0x137')],{'as':_0x7133('0x198'),'foreignKey':'ChatWebsiteId'});db[_0x7133('0x69')][_0x7133('0x111')](db[_0x7133('0x123')],{'as':_0x7133('0x124'),'foreignKey':'CompanyId'});db['CmContact']['hasMany'](db[_0x7133('0x8a')],{'as':_0x7133('0x199'),'foreignKey':_0x7133('0x19a')});db[_0x7133('0x123')][_0x7133('0x111')](db[_0x7133('0x6b')],{'as':_0x7133('0x14a'),'foreignKey':_0x7133('0x15e')});db[_0x7133('0x123')]['hasMany'](db[_0x7133('0x115')],{'as':_0x7133('0x19b'),'foreignKey':_0x7133('0x15e')});db[_0x7133('0x123')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x7133('0x123')]['hasMany'](db[_0x7133('0x72')],{'as':_0x7133('0x72'),'foreignKey':_0x7133('0x15e')});db[_0x7133('0x123')][_0x7133('0x111')](db[_0x7133('0xcf')],{'as':_0x7133('0x19c'),'foreignKey':_0x7133('0x15e')});db['CmContact']['hasMany'](db[_0x7133('0x117')],{'as':_0x7133('0x19d'),'foreignKey':_0x7133('0x15e'),'onDelete':_0x7133('0x161')});db[_0x7133('0x123')][_0x7133('0x111')](db[_0x7133('0x60')],{'as':_0x7133('0x129'),'foreignKey':_0x7133('0x15e'),'onDelete':_0x7133('0x161')});db[_0x7133('0x123')][_0x7133('0x111')](db[_0x7133('0x118')],{'as':_0x7133('0x119'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x7133('0x123')][_0x7133('0x111')](db[_0x7133('0x11a')],{'as':_0x7133('0x12b'),'foreignKey':'ContactId','onDelete':_0x7133('0x161')});db[_0x7133('0x123')][_0x7133('0x111')](db['MailInteraction'],{'as':_0x7133('0x11b'),'foreignKey':_0x7133('0x15e'),'onDelete':'restrict'});db['CmContact'][_0x7133('0x11f')](db[_0x7133('0x69')],{'as':'Company','foreignKey':'CompanyId'});db[_0x7133('0x123')][_0x7133('0x11f')](db['CmList'],{'as':_0x7133('0x166'),'foreignKey':_0x7133('0x177'),'onDelete':'cascade'});db[_0x7133('0x123')]['belongsToMany'](db[_0x7133('0x12')],{'as':_0x7133('0x16f'),'through':_0x7133('0x19e')});db['CmContact'][_0x7133('0x120')](db[_0x7133('0x16b')],{'as':_0x7133('0x16d'),'through':_0x7133('0x19f')});db[_0x7133('0x123')]['belongsToMany'](db[_0x7133('0x16b')],{'through':_0x7133('0x19f'),'as':_0x7133('0x16e')});db[_0x7133('0x6b')]['hasMany'](db[_0x7133('0x1a0')],{'as':_0x7133('0x1a1'),'foreignKey':'CmHopperId'});db[_0x7133('0x6b')][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':_0x7133('0x15e'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x6b')][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':_0x7133('0x166'),'foreignKey':_0x7133('0x177'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x6b')]['belongsTo'](db[_0x7133('0x12')],{'as':'Agent','foreignKey':_0x7133('0x10f')});db[_0x7133('0x6b')]['belongsTo'](db['VoiceQueue'],{'as':_0x7133('0x192'),'foreignKey':_0x7133('0x149'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x6b')][_0x7133('0x11f')](db[_0x7133('0x1a2')],{'as':_0x7133('0x1a2'),'foreignKey':_0x7133('0x1a3'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x6b')][_0x7133('0x11f')](db['User'],{'as':_0x7133('0x16a'),'foreignKey':_0x7133('0x1a4')});db['CmHopperBlack'][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x7133('0x10e')});db['CmHopperBlack'][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':'List','foreignKey':_0x7133('0x177'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x6d')][_0x7133('0x11f')](db['VoiceQueue'],{'as':_0x7133('0x192'),'foreignKey':_0x7133('0x149'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0x7133('0x1a2')],{'as':_0x7133('0x1a2'),'foreignKey':_0x7133('0x1a3'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x77')][_0x7133('0x111')](db['Condition'],{'as':{'plural':_0x7133('0x1a5'),'singular':_0x7133('0x1a6')},'foreignKey':_0x7133('0x1a7'),'onDelete':_0x7133('0x10e'),'hooks':!![]});db['Automation'][_0x7133('0x111')](db[_0x7133('0x7d')],{'as':{'plural':_0x7133('0x1a8'),'singular':_0x7133('0x1a9')},'foreignKey':_0x7133('0x1aa'),'onDelete':_0x7133('0x10e'),'hooks':!![]});db[_0x7133('0x77')][_0x7133('0x111')](db[_0x7133('0x75')],{'as':_0x7133('0x1ab'),'foreignKey':_0x7133('0x1ac'),'onDelete':_0x7133('0x10e'),'hooks':!![]});db[_0x7133('0x7b')][_0x7133('0x111')](db[_0x7133('0x7b')],{'as':_0x7133('0x162'),'foreignKey':_0x7133('0x1ad'),'onDelete':_0x7133('0x10e')});db[_0x7133('0x14f')]['hasMany'](db['Interval'],{'as':'Intervals','foreignKey':_0x7133('0x150'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x7133('0x14f')]['hasMany'](db['VoiceExtension'],{'as':_0x7133('0x114'),'foreignKey':_0x7133('0x150'),'onDelete':'restrict'});db[_0x7133('0x14f')]['hasMany'](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x7133('0x150')});db[_0x7133('0x14f')]['hasMany'](db[_0x7133('0x5e')],{'as':_0x7133('0x1ae'),'foreignKey':'IntervalId'});db['Interval'][_0x7133('0x111')](db[_0x7133('0x49')],{'as':_0x7133('0x1af'),'foreignKey':_0x7133('0x150')});db[_0x7133('0x14f')][_0x7133('0x111')](db[_0x7133('0x181')],{'as':_0x7133('0x1b0'),'foreignKey':'IntervalId'});db['Schedule'][_0x7133('0x11f')](db[_0x7133('0x3b')],{});db[_0x7133('0x85')][_0x7133('0x11f')](db['AnalyticDefaultReport'],{'foreignKey':_0x7133('0x1b1')});db[_0x7133('0x85')][_0x7133('0x11f')](db[_0x7133('0x95')],{'foreignKey':'CustomReportId'});db['Sound'][_0x7133('0x120')](db['VoiceMusicOnHold'],{'as':_0x7133('0x1b2'),'through':_0x7133('0x147'),'onDelete':_0x7133('0x161')});db[_0x7133('0x16b')][_0x7133('0x120')](db[_0x7133('0x123')],{'through':_0x7133('0x19f')});db[_0x7133('0x16b')]['belongsToMany'](db['ChatInteraction'],{'through':_0x7133('0x195')});db[_0x7133('0x16b')][_0x7133('0x120')](db[_0x7133('0x40')],{'through':'mail_interaction_has_tags'});db[_0x7133('0x16b')][_0x7133('0x120')](db['SmsInteraction'],{'through':_0x7133('0x183')});db['Tag'][_0x7133('0x120')](db[_0x7133('0x11a')],{'through':_0x7133('0x17d')});db[_0x7133('0x16b')]['belongsToMany'](db[_0x7133('0x117')],{'through':_0x7133('0x18a')});db[_0x7133('0x16b')][_0x7133('0x120')](db['WhatsappInteraction'],{'through':_0x7133('0x1b3')});db[_0x7133('0x8a')][_0x7133('0x11f')](db[_0x7133('0x89')],{'as':_0x7133('0x1b4'),'foreignKey':_0x7133('0x1b5')});db[_0x7133('0x1a0')][_0x7133('0x11f')](db['CmHopper'],{'as':_0x7133('0x1b6'),'foreignKey':'CmHopperId'});db['CmContactHasItem']['belongsTo'](db[_0x7133('0x123')],{'as':'Contact','foreignKey':_0x7133('0x19a')});db[_0x7133('0x8e')][_0x7133('0x111')](db[_0x7133('0x7d')],{'as':{'plural':_0x7133('0x1b7'),'singular':_0x7133('0x1b8')},'foreignKey':'TriggerAllId','onDelete':_0x7133('0x10e'),'hooks':!![]});db['Trigger'][_0x7133('0x111')](db[_0x7133('0x7d')],{'as':{'plural':_0x7133('0x1b9'),'singular':_0x7133('0x1ba')},'foreignKey':_0x7133('0x1bb'),'onDelete':_0x7133('0x10e'),'hooks':!![]});db[_0x7133('0x8e')][_0x7133('0x111')](db[_0x7133('0x75')],{'as':_0x7133('0x1ab'),'foreignKey':_0x7133('0x1bc'),'onDelete':_0x7133('0x10e'),'hooks':!![]});db[_0x7133('0x95')][_0x7133('0x111')](db[_0x7133('0x1bd')],{'as':_0x7133('0x1be'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1bf'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db['AnalyticFieldReport'],{'as':_0x7133('0x1be'),'onDelete':'cascade','foreignKey':_0x7133('0x1b1')});db[_0x7133('0x99')][_0x7133('0x111')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x7133('0x10e'),'foreignKey':'MetricId'});db[_0x7133('0x1bd')]['belongsTo'](db[_0x7133('0x99')],{'foreignKey':_0x7133('0x1c0')});db[_0x7133('0x9c')][_0x7133('0x111')](db[_0x7133('0x1c1')],{'as':_0x7133('0x1c2'),'onDelete':'cascade','foreignKey':_0x7133('0x1c3')});db[_0x7133('0x1c1')][_0x7133('0x111')](db['SalesforceField'],{'as':_0x7133('0x1c4'),'onDelete':_0x7133('0x10e'),'foreignKey':'SubjectId'});db[_0x7133('0x1c1')][_0x7133('0x111')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x7133('0x10e'),'foreignKey':'DescriptionId'});db[_0x7133('0x1c1')][_0x7133('0x111')](db['SalesforceField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x7133('0x1c5')});db[_0x7133('0x1c1')][_0x7133('0x11f')](db['SalesforceAccount'],{'as':_0x7133('0x169'),'foreignKey':_0x7133('0x1c3')});db['SalesforceField'][_0x7133('0x111')](db[_0x7133('0x1c6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x7133('0x1c6')][_0x7133('0x111')](db[_0x7133('0x1c6')],{'as':_0x7133('0x1c7'),'foreignKey':'DescriptionId'});db[_0x7133('0x1c6')]['hasMany'](db[_0x7133('0x1c6')],{'as':_0x7133('0x1c8'),'foreignKey':_0x7133('0x1c5')});db[_0x7133('0x1c6')][_0x7133('0x11f')](db[_0x7133('0x90')],{'as':_0x7133('0x90'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x7133('0x111')](db['SugarcrmConfiguration'],{'as':_0x7133('0x1c2'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1c3')});db[_0x7133('0xa0')][_0x7133('0x111')](db[_0x7133('0x1c9')],{'as':_0x7133('0x1c4'),'onDelete':_0x7133('0x10e'),'foreignKey':'SubjectId'});db[_0x7133('0xa0')][_0x7133('0x111')](db['SugarcrmField'],{'as':_0x7133('0x1ca'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1cb')});db['SugarcrmConfiguration'][_0x7133('0x111')](db[_0x7133('0x1c9')],{'as':_0x7133('0x1be'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1c5')});db[_0x7133('0xa0')][_0x7133('0x11f')](db[_0x7133('0x9f')],{'as':_0x7133('0x169'),'foreignKey':'AccountId'});db[_0x7133('0x1c9')]['hasMany'](db[_0x7133('0x1c9')],{'as':'Subject','foreignKey':_0x7133('0x1cc')});db[_0x7133('0x1c9')][_0x7133('0x111')](db[_0x7133('0x1c9')],{'as':_0x7133('0x1c7'),'foreignKey':_0x7133('0x1cb')});db[_0x7133('0x1c9')]['hasMany'](db[_0x7133('0x1c9')],{'as':_0x7133('0x1c8'),'foreignKey':_0x7133('0x1c5')});db[_0x7133('0x1c9')][_0x7133('0x11f')](db[_0x7133('0x90')],{'as':_0x7133('0x90'),'foreignKey':'VariableId'});db[_0x7133('0xa2')][_0x7133('0x111')](db['DeskConfiguration'],{'as':_0x7133('0x1c2'),'onDelete':'cascade','foreignKey':_0x7133('0x1c3')});db[_0x7133('0xa4')][_0x7133('0x111')](db[_0x7133('0xa6')],{'as':_0x7133('0x1c4'),'onDelete':'cascade','foreignKey':_0x7133('0x1cc')});db[_0x7133('0xa4')][_0x7133('0x111')](db[_0x7133('0xa6')],{'as':_0x7133('0x1ca'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1cb')});db[_0x7133('0xa4')][_0x7133('0x111')](db[_0x7133('0xa6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x7133('0x1c5')});db[_0x7133('0xa4')][_0x7133('0x11f')](db[_0x7133('0xa2')],{'as':_0x7133('0x169'),'foreignKey':_0x7133('0x1c3')});db[_0x7133('0xa4')][_0x7133('0x120')](db[_0x7133('0x16b')],{'through':'int_desk_configuration_has_tags'});db[_0x7133('0xa6')]['hasMany'](db[_0x7133('0xa6')],{'as':_0x7133('0x1cd'),'foreignKey':_0x7133('0x1cc')});db[_0x7133('0xa6')]['hasMany'](db[_0x7133('0xa6')],{'as':_0x7133('0x1c7'),'foreignKey':_0x7133('0x1cb')});db[_0x7133('0xa6')][_0x7133('0x111')](db[_0x7133('0xa6')],{'as':_0x7133('0x1c8'),'foreignKey':'FieldId'});db[_0x7133('0xa6')][_0x7133('0x11f')](db['Variable'],{'as':'Variable','foreignKey':_0x7133('0x1ce')});db[_0x7133('0xa8')][_0x7133('0x111')](db[_0x7133('0xa9')],{'as':_0x7133('0x1c2'),'onDelete':'cascade','foreignKey':_0x7133('0x1c3')});db[_0x7133('0xa9')][_0x7133('0x111')](db[_0x7133('0xab')],{'as':_0x7133('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x7133('0xa9')]['hasMany'](db[_0x7133('0xab')],{'as':_0x7133('0x1ca'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1cb')});db[_0x7133('0xa9')][_0x7133('0x111')](db[_0x7133('0xab')],{'as':_0x7133('0x1be'),'onDelete':'cascade','foreignKey':_0x7133('0x1c5')});db[_0x7133('0xa9')][_0x7133('0x11f')](db[_0x7133('0xa8')],{'as':'Account','foreignKey':'AccountId'});db[_0x7133('0xab')][_0x7133('0x111')](db['ZohoField'],{'as':_0x7133('0x1cd'),'foreignKey':'SubjectId'});db['ZohoField'][_0x7133('0x111')](db[_0x7133('0xab')],{'as':'Description','foreignKey':_0x7133('0x1cb')});db['ZohoField']['hasMany'](db[_0x7133('0xab')],{'as':_0x7133('0x1c8'),'foreignKey':_0x7133('0x1c5')});db[_0x7133('0xab')][_0x7133('0x11f')](db['Variable'],{'as':'Variable','foreignKey':_0x7133('0x1ce')});db['ZendeskAccount']['hasMany'](db['ZendeskConfiguration'],{'as':_0x7133('0x1c2'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1c3')});db['ZendeskConfiguration']['hasMany'](db[_0x7133('0xb1')],{'as':_0x7133('0x1c4'),'foreignKey':_0x7133('0x1cc')});db[_0x7133('0xaf')][_0x7133('0x111')](db['ZendeskField'],{'as':_0x7133('0x1ca'),'foreignKey':_0x7133('0x1cb')});db[_0x7133('0xaf')][_0x7133('0x111')](db['ZendeskField'],{'as':_0x7133('0x1be'),'foreignKey':_0x7133('0x1c5')});db['ZendeskConfiguration']['belongsTo'](db[_0x7133('0xad')],{'as':'Account','foreignKey':'AccountId'});db[_0x7133('0xaf')][_0x7133('0x120')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x7133('0xb1')][_0x7133('0x111')](db['ZendeskField'],{'as':_0x7133('0x1cd'),'foreignKey':_0x7133('0x1cc')});db[_0x7133('0xb1')]['hasMany'](db[_0x7133('0xb1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x7133('0xb1')][_0x7133('0x111')](db['ZendeskField'],{'as':_0x7133('0x1c8'),'foreignKey':_0x7133('0x1c5')});db[_0x7133('0xb1')][_0x7133('0x11f')](db[_0x7133('0x90')],{'as':_0x7133('0x90'),'foreignKey':_0x7133('0x1ce')});db[_0x7133('0xb3')]['hasMany'](db[_0x7133('0xb4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x7133('0x1c3')});db['FreshdeskConfiguration'][_0x7133('0x111')](db[_0x7133('0xb6')],{'as':'Subjects','onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1cc')});db['FreshdeskConfiguration']['hasMany'](db[_0x7133('0xb6')],{'as':_0x7133('0x1ca'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x7133('0xb4')]['hasMany'](db['FreshdeskField'],{'as':_0x7133('0x1be'),'onDelete':'cascade','foreignKey':_0x7133('0x1c5')});db[_0x7133('0xb4')][_0x7133('0x11f')](db[_0x7133('0xb3')],{'as':'Account','foreignKey':'AccountId'});db[_0x7133('0xb4')]['belongsToMany'](db[_0x7133('0x16b')],{'through':_0x7133('0x1cf')});db['FreshdeskField'][_0x7133('0x111')](db[_0x7133('0xb6')],{'as':'Subject','foreignKey':_0x7133('0x1cc')});db[_0x7133('0xb6')]['hasMany'](db[_0x7133('0xb6')],{'as':_0x7133('0x1c7'),'foreignKey':_0x7133('0x1cb')});db['FreshdeskField']['hasMany'](db[_0x7133('0xb6')],{'as':_0x7133('0x1c8'),'foreignKey':'FieldId'});db[_0x7133('0xb6')][_0x7133('0x11f')](db['Variable'],{'as':_0x7133('0x90'),'foreignKey':_0x7133('0x1ce')});db[_0x7133('0x1d0')][_0x7133('0x111')](db[_0x7133('0xb9')],{'as':_0x7133('0x1c2'),'onDelete':'cascade','foreignKey':_0x7133('0x1c3')});db[_0x7133('0xb9')]['hasMany'](db['VtigerField'],{'as':_0x7133('0x1c4'),'foreignKey':_0x7133('0x1cc')});db[_0x7133('0xb9')][_0x7133('0x111')](db[_0x7133('0xbb')],{'as':_0x7133('0x1ca'),'foreignKey':_0x7133('0x1cb')});db['VtigerConfiguration']['hasMany'](db[_0x7133('0xbb')],{'as':_0x7133('0x1be'),'foreignKey':'FieldId'});db[_0x7133('0xb9')][_0x7133('0x11f')](db[_0x7133('0x1d0')],{'as':_0x7133('0x169'),'foreignKey':_0x7133('0x1c3')});db[_0x7133('0xbb')][_0x7133('0x111')](db[_0x7133('0xbb')],{'as':_0x7133('0x1cd'),'foreignKey':_0x7133('0x1cc')});db[_0x7133('0xbb')][_0x7133('0x111')](db['VtigerField'],{'as':_0x7133('0x1c7'),'foreignKey':_0x7133('0x1cb')});db[_0x7133('0xbb')][_0x7133('0x111')](db[_0x7133('0xbb')],{'as':_0x7133('0x1c8'),'foreignKey':'FieldId'});db[_0x7133('0xbb')]['belongsTo'](db[_0x7133('0x90')],{'as':_0x7133('0x90'),'foreignKey':_0x7133('0x1ce')});db[_0x7133('0x1d1')][_0x7133('0x111')](db[_0x7133('0x1d2')],{'as':_0x7133('0x1c2'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1c3')});db[_0x7133('0x1d2')][_0x7133('0x111')](db[_0x7133('0xbf')],{'as':_0x7133('0x1c4'),'foreignKey':_0x7133('0x1cc')});db[_0x7133('0x1d2')][_0x7133('0x111')](db[_0x7133('0xbf')],{'as':_0x7133('0x1ca'),'foreignKey':_0x7133('0x1cb')});db[_0x7133('0x1d2')][_0x7133('0x111')](db[_0x7133('0xbf')],{'as':_0x7133('0x1be'),'foreignKey':_0x7133('0x1c5')});db[_0x7133('0x1d2')]['belongsTo'](db[_0x7133('0x1d1')],{'as':_0x7133('0x169'),'foreignKey':_0x7133('0x1c3')});db[_0x7133('0xbf')][_0x7133('0x111')](db[_0x7133('0xbf')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x7133('0xbf')][_0x7133('0x111')](db['ServicenowField'],{'as':_0x7133('0x1c7'),'foreignKey':'DescriptionId'});db[_0x7133('0xbf')][_0x7133('0x111')](db[_0x7133('0xbf')],{'as':_0x7133('0x1c8'),'foreignKey':_0x7133('0x1c5')});db[_0x7133('0xbf')][_0x7133('0x11f')](db['Variable'],{'as':_0x7133('0x90'),'foreignKey':_0x7133('0x1ce')});db['Dynamics365Account']['hasMany'](db['Dynamics365Configuration'],{'as':_0x7133('0x1c2'),'onDelete':_0x7133('0x10e'),'foreignKey':'AccountId'});db['Dynamics365Account'][_0x7133('0x11f')](db[_0x7133('0x104')],{'as':_0x7133('0x104'),'foreignKey':_0x7133('0x160')});db[_0x7133('0xc3')]['hasMany'](db['Dynamics365Field'],{'as':_0x7133('0x1c4'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1cc')});db[_0x7133('0xc3')][_0x7133('0x111')](db[_0x7133('0xc5')],{'as':_0x7133('0x1ca'),'onDelete':_0x7133('0x10e'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x7133('0x111')](db[_0x7133('0xc5')],{'as':_0x7133('0x1be'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1c5')});db[_0x7133('0xc3')][_0x7133('0x11f')](db[_0x7133('0xc1')],{'as':'Account','foreignKey':_0x7133('0x1c3')});db[_0x7133('0xc5')][_0x7133('0x111')](db['Dynamics365Field'],{'as':_0x7133('0x1cd'),'foreignKey':_0x7133('0x1cc')});db[_0x7133('0xc5')][_0x7133('0x111')](db[_0x7133('0xc5')],{'as':'Description','foreignKey':_0x7133('0x1cb')});db[_0x7133('0xc5')][_0x7133('0x111')](db['Dynamics365Field'],{'as':_0x7133('0x1c8'),'foreignKey':_0x7133('0x1c5')});db[_0x7133('0xc5')]['belongsTo'](db[_0x7133('0x90')],{'as':_0x7133('0x90'),'foreignKey':_0x7133('0x1ce')});db[_0x7133('0xc6')][_0x7133('0x111')](db[_0x7133('0x1d3')],{'as':_0x7133('0x1c2'),'onDelete':_0x7133('0x10e'),'foreignKey':'AccountId'});db[_0x7133('0x1d3')][_0x7133('0x111')](db['FreshsalesField'],{'as':_0x7133('0x1c4'),'foreignKey':_0x7133('0x1cc')});db[_0x7133('0x1d3')][_0x7133('0x111')](db[_0x7133('0x1d4')],{'as':'Descriptions','foreignKey':_0x7133('0x1cb')});db[_0x7133('0x1d3')][_0x7133('0x111')](db['FreshsalesField'],{'as':_0x7133('0x1be'),'foreignKey':'FieldId'});db[_0x7133('0x1d3')]['belongsTo'](db[_0x7133('0xc6')],{'as':_0x7133('0x169'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x7133('0x111')](db[_0x7133('0x1d4')],{'as':_0x7133('0x1cd'),'foreignKey':_0x7133('0x1cc')});db['FreshsalesField'][_0x7133('0x111')](db[_0x7133('0x1d4')],{'as':_0x7133('0x1c7'),'foreignKey':_0x7133('0x1cb')});db[_0x7133('0x1d4')][_0x7133('0x111')](db[_0x7133('0x1d4')],{'as':_0x7133('0x1c8'),'foreignKey':_0x7133('0x1c5')});db[_0x7133('0x1d4')][_0x7133('0x11f')](db[_0x7133('0x90')],{'as':_0x7133('0x90'),'foreignKey':_0x7133('0x1ce')});db[_0x7133('0xca')][_0x7133('0x11f')](db[_0x7133('0x137')],{});db[_0x7133('0xca')]['belongsTo'](db['CmList'],{'as':_0x7133('0x166'),'foreignKey':_0x7133('0x177')});db['ChatQueueReport']['belongsTo'](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':'ContactId'});db[_0x7133('0xca')][_0x7133('0x11f')](db[_0x7133('0x60')],{});db[_0x7133('0xca')][_0x7133('0x11f')](db[_0x7133('0x18f')],{});db['ChatQueueReport'][_0x7133('0x11f')](db[_0x7133('0x12')],{});db[_0x7133('0xca')]['belongsTo'](db['ChatQueue'],{});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1d5')});db[_0x7133('0xcb')][_0x7133('0x11f')](db[_0x7133('0x12')],{'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1d6')});db[_0x7133('0xcf')][_0x7133('0x111')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x7133('0x10e')});db[_0x7133('0xcf')][_0x7133('0x111')](db[_0x7133('0xcc')],{'foreignKey':_0x7133('0x1d7'),'onDelete':_0x7133('0x10e')});db[_0x7133('0xd1')][_0x7133('0x11f')](db[_0x7133('0x13f')],{});db[_0x7133('0xd1')][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':'List','foreignKey':_0x7133('0x177')});db[_0x7133('0xd1')]['belongsTo'](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':_0x7133('0x15e')});db['SmsQueueReport']['belongsTo'](db[_0x7133('0x118')],{});db[_0x7133('0xd1')][_0x7133('0x11f')](db[_0x7133('0x52')],{});db[_0x7133('0xd1')]['belongsTo'](db[_0x7133('0x12')],{});db[_0x7133('0xd1')][_0x7133('0x11f')](db['SmsQueue'],{});db[_0x7133('0xd6')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x7133('0x111')](db[_0x7133('0xcd')],{'foreignKey':_0x7133('0x1d8')});db[_0x7133('0xd6')][_0x7133('0x111')](db[_0x7133('0xcc')],{'foreignKey':'ProjectId'});db[_0x7133('0xe0')][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x168'),'through':'user_has_teams'});db[_0x7133('0xe0')][_0x7133('0x120')](db[_0x7133('0x130')],{'through':_0x7133('0x106'),'as':_0x7133('0x1d9')});db[_0x7133('0xe0')][_0x7133('0x120')](db[_0x7133('0x3d')],{'through':_0x7133('0x1da'),'as':'MailQueues'});db[_0x7133('0xe0')][_0x7133('0x120')](db[_0x7133('0x65')],{'through':_0x7133('0x196'),'as':_0x7133('0x1db')});db[_0x7133('0xe0')][_0x7133('0x120')](db['FaxQueue'],{'through':_0x7133('0x17f'),'as':_0x7133('0x134')});db[_0x7133('0xe0')][_0x7133('0x120')](db[_0x7133('0x54')],{'through':_0x7133('0x185'),'as':_0x7133('0x135')});db[_0x7133('0xe0')]['belongsToMany'](db[_0x7133('0x5b')],{'through':_0x7133('0x18b'),'as':'OpenchannelQueues'});db[_0x7133('0xe0')][_0x7133('0x120')](db[_0x7133('0x102')],{'through':'team_has_whatsapp_queues','as':_0x7133('0x1dc')});db[_0x7133('0xe0')][_0x7133('0x120')](db[_0x7133('0xef')],{'through':_0x7133('0x108'),'as':_0x7133('0x131')});db['Campaign'][_0x7133('0x111')](db[_0x7133('0x6b')],{'as':'Hoppers','foreignKey':_0x7133('0x1a3')});db['Campaign'][_0x7133('0x111')](db[_0x7133('0x115')],{'as':_0x7133('0x19b'),'foreignKey':_0x7133('0x1a3')});db[_0x7133('0x1a2')]['hasMany'](db[_0x7133('0x70')],{'as':'HopperHistories','foreignKey':_0x7133('0x1a3')});db[_0x7133('0x1a2')][_0x7133('0x111')](db[_0x7133('0x6d')],{'as':_0x7133('0x14c'),'foreignKey':_0x7133('0x1a3')});db[_0x7133('0x1a2')][_0x7133('0x11f')](db[_0x7133('0x14d')],{'as':_0x7133('0x14d'),'foreignKey':'TrunkId'});db['Campaign'][_0x7133('0x11f')](db['Trunk'],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x7133('0x1a2')][_0x7133('0x11f')](db[_0x7133('0x14f')],{'as':_0x7133('0x14f'),'foreignKey':_0x7133('0x150')});db[_0x7133('0x1a2')][_0x7133('0x11f')](db[_0x7133('0x1dd')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x7133('0x1a2')][_0x7133('0x120')](db['CmList'],{'as':'Lists','through':_0x7133('0x1de')});db[_0x7133('0x1a2')][_0x7133('0x120')](db[_0x7133('0x125')],{'as':_0x7133('0x154'),'through':_0x7133('0x1df')});db[_0x7133('0x171')]['belongsTo'](db[_0x7133('0x63')],{'as':_0x7133('0x63'),'foreignKey':_0x7133('0x174')});db[_0x7133('0xe6')]['belongsTo'](db[_0x7133('0x41')],{});db[_0x7133('0xe6')][_0x7133('0x11f')](db[_0x7133('0x40')],{});db[_0x7133('0xe6')]['belongsTo'](db[_0x7133('0x3b')],{'foreignKey':'FromMailAccountId','as':_0x7133('0x1e0')});db[_0x7133('0xe6')][_0x7133('0x11f')](db[_0x7133('0x12')],{'foreignKey':_0x7133('0x1e1'),'as':'FromAgent'});db[_0x7133('0xe6')][_0x7133('0x11f')](db[_0x7133('0x12')],{'foreignKey':_0x7133('0x1e2'),'as':_0x7133('0x1e3')});db[_0x7133('0xe6')][_0x7133('0x11f')](db[_0x7133('0x3d')],{'foreignKey':_0x7133('0x1e4'),'as':'ToQueue'});db['MailTransferReport'][_0x7133('0x11f')](db[_0x7133('0x3b')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db['ChatTransferReport'][_0x7133('0x11f')](db[_0x7133('0x18f')],{});db[_0x7133('0xe8')][_0x7133('0x11f')](db[_0x7133('0x60')],{});db[_0x7133('0xe8')][_0x7133('0x11f')](db[_0x7133('0x137')],{'foreignKey':_0x7133('0x1e5'),'as':_0x7133('0x1e0')});db[_0x7133('0xe8')][_0x7133('0x11f')](db[_0x7133('0x12')],{'foreignKey':_0x7133('0x1e1'),'as':_0x7133('0x1e6')});db[_0x7133('0xe8')][_0x7133('0x11f')](db['User'],{'foreignKey':'ToUserId','as':_0x7133('0x1e3')});db[_0x7133('0xe8')][_0x7133('0x11f')](db[_0x7133('0x65')],{'foreignKey':_0x7133('0x1e7'),'as':_0x7133('0x1e8')});db[_0x7133('0xe8')]['belongsTo'](db[_0x7133('0x137')],{'foreignKey':_0x7133('0x1e9'),'as':'ToAccount'});db[_0x7133('0xea')]['belongsTo'](db[_0x7133('0x4a')],{});db['FaxTransferReport'][_0x7133('0x11f')](db[_0x7133('0x11a')],{});db[_0x7133('0xea')][_0x7133('0x11f')](db[_0x7133('0x47')],{'foreignKey':'FromFaxAccountId','as':_0x7133('0x1e0')});db[_0x7133('0xea')][_0x7133('0x11f')](db[_0x7133('0x12')],{'foreignKey':_0x7133('0x1e1'),'as':_0x7133('0x1e6')});db[_0x7133('0xea')][_0x7133('0x11f')](db['User'],{'foreignKey':_0x7133('0x1e2'),'as':_0x7133('0x1e3')});db[_0x7133('0xea')][_0x7133('0x11f')](db['FaxQueue'],{'foreignKey':_0x7133('0x1ea'),'as':_0x7133('0x1e8')});db[_0x7133('0xea')][_0x7133('0x11f')](db[_0x7133('0x47')],{'foreignKey':'ToFaxAccountId','as':_0x7133('0x1eb')});db[_0x7133('0x1ec')][_0x7133('0x11f')](db[_0x7133('0x5a')],{});db[_0x7133('0x1ec')][_0x7133('0x11f')](db['OpenchannelInteraction'],{});db[_0x7133('0x1ec')]['belongsTo'](db[_0x7133('0x56')],{'foreignKey':_0x7133('0x1ed'),'as':'FromAccount'});db[_0x7133('0x1ec')]['belongsTo'](db[_0x7133('0x12')],{'foreignKey':_0x7133('0x1e1'),'as':_0x7133('0x1e6')});db[_0x7133('0x1ec')]['belongsTo'](db[_0x7133('0x12')],{'foreignKey':'ToUserId','as':_0x7133('0x1e3')});db['OpenchannelTransferReport'][_0x7133('0x11f')](db['OpenchannelQueue'],{'foreignKey':_0x7133('0x1ee'),'as':_0x7133('0x1e8')});db['OpenchannelTransferReport']['belongsTo'](db[_0x7133('0x56')],{'foreignKey':_0x7133('0x1ef'),'as':_0x7133('0x1eb')});db['SmsTransferReport'][_0x7133('0x11f')](db[_0x7133('0x52')],{});db[_0x7133('0xec')]['belongsTo'](db[_0x7133('0x118')],{});db[_0x7133('0xec')]['belongsTo'](db[_0x7133('0x13f')],{'foreignKey':'FromSmsAccountId','as':_0x7133('0x1e0')});db[_0x7133('0xec')][_0x7133('0x11f')](db[_0x7133('0x12')],{'foreignKey':_0x7133('0x1e1'),'as':'FromAgent'});db['SmsTransferReport']['belongsTo'](db[_0x7133('0x12')],{'foreignKey':_0x7133('0x1e2'),'as':'ToAgent'});db[_0x7133('0xec')]['belongsTo'](db[_0x7133('0x54')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0x7133('0xec')][_0x7133('0x11f')](db[_0x7133('0x13f')],{'foreignKey':'ToSmsAccountId','as':_0x7133('0x1eb')});db['CmList']['hasMany'](db[_0x7133('0x7b')],{'as':_0x7133('0x162'),'foreignKey':_0x7133('0x177'),'onDelete':'cascade'});db[_0x7133('0x125')][_0x7133('0x111')](db['CmCustomField'],{'as':_0x7133('0x1f0'),'foreignKey':_0x7133('0x177')});db['CmList'][_0x7133('0x111')](db['CmContact'],{'as':'Contacts','onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x177')});db[_0x7133('0x125')][_0x7133('0x111')](db[_0x7133('0x115')],{'as':_0x7133('0x19b'),'foreignKey':_0x7133('0x177')});db['CmList'][_0x7133('0x111')](db[_0x7133('0x70')],{'as':_0x7133('0x116'),'foreignKey':_0x7133('0x177')});db[_0x7133('0x125')][_0x7133('0x111')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x7133('0x177')});db[_0x7133('0x125')][_0x7133('0x120')](db[_0x7133('0x130')],{'as':'Queues','through':_0x7133('0x152')});db['CmList'][_0x7133('0x120')](db[_0x7133('0x12')],{'as':_0x7133('0x168'),'through':_0x7133('0x127')});db[_0x7133('0xef')][_0x7133('0x111')](db[_0x7133('0x19')],{'as':'Extensions','onDelete':_0x7133('0x10e')});db[_0x7133('0xef')][_0x7133('0x120')](db[_0x7133('0x12')],{'as':'Agents','through':_0x7133('0x10a')});db[_0x7133('0xef')][_0x7133('0x120')](db[_0x7133('0xe0')],{'through':_0x7133('0x108'),'as':_0x7133('0x153')});db[_0x7133('0xf1')][_0x7133('0x111')](db['User'],{'as':_0x7133('0x16f'),'foreignKey':_0x7133('0x1f1')});db[_0x7133('0xf1')][_0x7133('0x111')](db[_0x7133('0xf3')],{'as':_0x7133('0x1f2'),'foreignKey':_0x7133('0x1f1'),'onDelete':_0x7133('0x10e')});db[_0x7133('0xf3')][_0x7133('0x111')](db[_0x7133('0xf5')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x7133('0x10e')});db[_0x7133('0xf9')][_0x7133('0x111')](db[_0x7133('0x7b')],{'as':_0x7133('0x162'),'foreignKey':_0x7133('0x1f3'),'onDelete':_0x7133('0x10e')});db['WhatsappAccount'][_0x7133('0x111')](db[_0x7133('0x79')],{'as':'Answers','foreignKey':_0x7133('0x1f3')});db[_0x7133('0xf9')][_0x7133('0x111')](db[_0x7133('0xfd')],{'as':_0x7133('0x156'),'foreignKey':_0x7133('0x1f3')});db[_0x7133('0xf9')][_0x7133('0x111')](db[_0x7133('0xfb')],{'as':_0x7133('0x164')});db['WhatsappAccount'][_0x7133('0x111')](db[_0x7133('0xfa')],{'as':_0x7133('0x145'),'foreignKey':_0x7133('0x1f3'),'onDelete':_0x7133('0x10e')});db['WhatsappAccount']['belongsTo'](db[_0x7133('0x125')],{'as':'List','foreignKey':_0x7133('0x177')});db[_0x7133('0xf9')][_0x7133('0x11f')](db['Pause'],{'as':_0x7133('0x167'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0x7133('0x120')](db['User'],{'as':'Agents','through':_0x7133('0x143')});db[_0x7133('0xfa')]['belongsTo'](db[_0x7133('0x12')],{'onDelete':_0x7133('0x161')});db[_0x7133('0xfa')][_0x7133('0x11f')](db[_0x7133('0x102')],{'onDelete':_0x7133('0x161')});db[_0x7133('0xfa')][_0x7133('0x11f')](db[_0x7133('0xf9')],{'onDelete':_0x7133('0x161')});db[_0x7133('0xfa')][_0x7133('0x11f')](db[_0x7133('0x14f')],{'onDelete':_0x7133('0x161'),'foreignKey':_0x7133('0x150')});db['WhatsappApplication'][_0x7133('0x11f')](db[_0x7133('0x16b')],{'onDelete':_0x7133('0x161'),'foreignKey':_0x7133('0x175')});db['WhatsappInteraction'][_0x7133('0x111')](db[_0x7133('0xfd')],{'as':_0x7133('0x156'),'onDelete':_0x7133('0x10e'),'foreignKey':_0x7133('0x1f4')});db[_0x7133('0xfb')][_0x7133('0x11f')](db[_0x7133('0xf9')],{'as':_0x7133('0x169'),'foreignKey':_0x7133('0x1f3')});db['WhatsappInteraction']['belongsTo'](db['CmContact'],{'as':_0x7133('0x15d'),'foreignKey':_0x7133('0x15e')});db['WhatsappInteraction']['belongsTo'](db[_0x7133('0x12')],{'as':'Owner','foreignKey':_0x7133('0x10f')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':_0x7133('0x1b3'),'as':_0x7133('0x16d')});db[_0x7133('0xfb')][_0x7133('0x120')](db[_0x7133('0x16b')],{'through':_0x7133('0x1b3'),'as':_0x7133('0x16e')});db[_0x7133('0xfb')]['belongsToMany'](db[_0x7133('0x12')],{'as':'Users','through':_0x7133('0x12f'),'foreignKey':_0x7133('0x1f4')});db[_0x7133('0xfd')][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':_0x7133('0x12')});db[_0x7133('0xfd')][_0x7133('0x11f')](db[_0x7133('0x123')],{'onDelete':'cascade','as':'Contact'});db[_0x7133('0xfd')]['belongsTo'](db[_0x7133('0xfb')],{'onDelete':_0x7133('0x10e'),'as':_0x7133('0x173'),'foreignKey':_0x7133('0x1f4')});db[_0x7133('0xfd')][_0x7133('0x11f')](db[_0x7133('0xf9')],{'as':_0x7133('0x169'),'foreignKey':'WhatsappAccountId'});db[_0x7133('0xff')][_0x7133('0x11f')](db[_0x7133('0xf9')],{});db[_0x7133('0xff')][_0x7133('0x11f')](db[_0x7133('0x125')],{'as':'List','foreignKey':'ListId'});db['WhatsappQueueReport'][_0x7133('0x11f')](db[_0x7133('0x123')],{'as':_0x7133('0x15d'),'foreignKey':_0x7133('0x15e')});db['WhatsappQueueReport']['belongsTo'](db[_0x7133('0xfb')],{});db[_0x7133('0xff')][_0x7133('0x11f')](db['WhatsappQueue'],{});db['WhatsappQueueReport']['belongsTo'](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x7133('0x11f')](db['User'],{});db[_0x7133('0x1f5')][_0x7133('0x11f')](db[_0x7133('0xfd')],{});db[_0x7133('0x1f5')][_0x7133('0x11f')](db[_0x7133('0xfb')],{});db[_0x7133('0x1f5')][_0x7133('0x11f')](db[_0x7133('0xf9')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x7133('0x1f5')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x7133('0x1f6'),'as':_0x7133('0x1eb')});db[_0x7133('0x1f5')][_0x7133('0x11f')](db[_0x7133('0x102')],{'foreignKey':_0x7133('0x1f7'),'as':_0x7133('0x1e8')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x7133('0x1e6')});db[_0x7133('0x1f5')][_0x7133('0x11f')](db['User'],{'foreignKey':_0x7133('0x1e2'),'as':_0x7133('0x1e3')});db[_0x7133('0x102')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x7133('0x36'),'foreignKey':'WhatsappQueueId'});db[_0x7133('0x102')]['belongsToMany'](db[_0x7133('0xe0')],{'through':_0x7133('0x1f8'),'as':_0x7133('0x153')});db[_0x7133('0x10b')][_0x7133('0x11f')](db[_0x7133('0x12')],{'as':_0x7133('0x1f9'),'foreignKey':'UserId','onDelete':_0x7133('0x10e'),'hooks':!![]});db[_0x7133('0x104')][_0x7133('0x10d')](db[_0x7133('0xc1')],{'as':'Dynamics365Account','onDelete':_0x7133('0x161')});db[_0x7133('0x104')][_0x7133('0x10d')](db['MailServerIn'],{'as':_0x7133('0x1fa'),'onDelete':'restrict'});db[_0x7133('0x104')][_0x7133('0x10d')](db[_0x7133('0x39')],{'as':'Smtp','onDelete':'restrict'});module[_0x7133('0x1fb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3427b11..b125a64 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1ae=['./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','/apidoc','/www','root','/demo','/snippet','snippet','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime'];(function(_0x461e08,_0x32ea15){var _0x19a69c=function(_0x571759){while(--_0x571759){_0x461e08['push'](_0x461e08['shift']());}};_0x19a69c(++_0x32ea15);}(_0xb1ae,0x139));var _0xeb1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb1ae[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0xeb1a('0x0'));var express=require('express');var errors=require(_0xeb1a('0x1'));var config=require(_0xeb1a('0x2'));var setupLoggers=require(_0xeb1a('0x3'))['setupLoggers'];var clientSideLogs=require(_0xeb1a('0x4'));exports['default']=function(_0x2ab13f){return setupLoggers(_0x2ab13f)[_0xeb1a('0x5')](function(){_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x7'),require(_0xeb1a('0x8')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x9'),require(_0xeb1a('0xa')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xb'),require('./api/voiceContext'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xc'),require(_0xeb1a('0xd')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xe'),require(_0xeb1a('0xf')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x10'),require(_0xeb1a('0x11')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x12'),require(_0xeb1a('0x13')));_0x2ab13f[_0xeb1a('0x6')]('/api/screen/recordings',require(_0xeb1a('0x14')));_0x2ab13f['use'](_0xeb1a('0x15'),require('./api/voiceMail'));_0x2ab13f[_0xeb1a('0x6')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x16'),require(_0xeb1a('0x17')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x18'),require(_0xeb1a('0x19')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x1a'),require('./api/voiceAgentReport'));_0x2ab13f['use'](_0xeb1a('0x1b'),require(_0xeb1a('0x1c')));_0x2ab13f['use'](_0xeb1a('0x1d'),require(_0xeb1a('0x1e')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x1f'),require(_0xeb1a('0x20')));_0x2ab13f['use'](_0xeb1a('0x21'),require(_0xeb1a('0x22')));_0x2ab13f[_0xeb1a('0x6')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x2ab13f['use'](_0xeb1a('0x23'),require('./api/mailAccount'));_0x2ab13f['use'](_0xeb1a('0x24'),require('./api/mailQueue'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x25'),require(_0xeb1a('0x26')));_0x2ab13f['use']('/api/mail/interactions',require(_0xeb1a('0x27')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x28'),require(_0xeb1a('0x29')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x2a'),require('./api/mailApplication'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x2b'),require(_0xeb1a('0x2c')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x2d'),require(_0xeb1a('0x2e')));_0x2ab13f['use']('/api/dashboards/items',require(_0xeb1a('0x2f')));_0x2ab13f['use']('/api/fax/accounts',require('./api/faxAccount'));_0x2ab13f['use'](_0xeb1a('0x30'),require(_0xeb1a('0x31')));_0x2ab13f['use']('/api/fax/interactions',require(_0xeb1a('0x32')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x33'),require(_0xeb1a('0x34')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x35'),require(_0xeb1a('0x36')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x37'),require(_0xeb1a('0x38')));_0x2ab13f[_0xeb1a('0x6')]('/api/sms/accounts',require(_0xeb1a('0x39')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x3a'),require('./api/smsApplication'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x3b'),require(_0xeb1a('0x3c')));_0x2ab13f[_0xeb1a('0x6')]('/api/sms/messages',require(_0xeb1a('0x3d')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x3e'),require(_0xeb1a('0x3f')));_0x2ab13f['use'](_0xeb1a('0x40'),require(_0xeb1a('0x41')));_0x2ab13f['use'](_0xeb1a('0x42'),require(_0xeb1a('0x43')));_0x2ab13f['use'](_0xeb1a('0x44'),require(_0xeb1a('0x45')));_0x2ab13f[_0xeb1a('0x6')]('/api/openchannel/messages',require(_0xeb1a('0x46')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x47'),require(_0xeb1a('0x48')));_0x2ab13f['use']('/api/chat/websites',require(_0xeb1a('0x49')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x4a'),require(_0xeb1a('0x4b')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x4c'),require('./api/chatApplication'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x4d'),require('./api/chatInteraction'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x4e'),require(_0xeb1a('0x4f')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x50'),require(_0xeb1a('0x51')));_0x2ab13f['use'](_0xeb1a('0x52'),require(_0xeb1a('0x53')));_0x2ab13f['use']('/api/chat/groups',require('./api/chatGroup'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x54'),require(_0xeb1a('0x55')));_0x2ab13f[_0xeb1a('0x6')]('/api/cm/companies',require('./api/cmCompany'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x56'),require('./api/cmContact'));_0x2ab13f['use']('/api/cm/hopper',require('./api/cmHopper'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x57'),require(_0xeb1a('0x58')));_0x2ab13f['use'](_0xeb1a('0x59'),require('./api/cmHopperFinal'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x5a'),require(_0xeb1a('0x5b')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x5c'),require('./api/cmCustomField'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x5d'),require(_0xeb1a('0x5e')));_0x2ab13f['use']('/api/automations',require(_0xeb1a('0x5f')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x60'),require(_0xeb1a('0x61')));_0x2ab13f['use'](_0xeb1a('0x62'),require('./api/disposition'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x63'),require(_0xeb1a('0x64')));_0x2ab13f[_0xeb1a('0x6')]('/api/intervals',require(_0xeb1a('0x65')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x66'),require(_0xeb1a('0x67')));_0x2ab13f['use'](_0xeb1a('0x68'),require(_0xeb1a('0x69')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x6a'),require(_0xeb1a('0x6b')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x6c'),require('./api/schedule'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x6d'),require(_0xeb1a('0x6e')));_0x2ab13f['use'](_0xeb1a('0x6f'),require(_0xeb1a('0x70')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x71'),require(_0xeb1a('0x72')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x73'),require(_0xeb1a('0x74')));_0x2ab13f['use']('/api/cm_hopper_additional_phones',require(_0xeb1a('0x75')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x76'),require('./api/template'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x77'),require('./api/trigger'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x78'),require(_0xeb1a('0x79')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x7a'),require(_0xeb1a('0x7b')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x7c'),require(_0xeb1a('0x7d')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x7e'),require(_0xeb1a('0x7f')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x80'),require(_0xeb1a('0x81')));_0x2ab13f['use']('/api/analytics/extracted_reports',require(_0xeb1a('0x82')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x83'),require(_0xeb1a('0x84')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x85'),require('./api/analyticFieldReport'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x86'),require('./api/analyticTreeReport'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x87'),require('./api/intSalesforceAccount'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x88'),require(_0xeb1a('0x89')));_0x2ab13f[_0xeb1a('0x6')]('/api/integrations/salesforce/fields',require(_0xeb1a('0x8a')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x8b'),require(_0xeb1a('0x8c')));_0x2ab13f['use']('/api/integrations/sugarcrm/configurations',require(_0xeb1a('0x8d')));_0x2ab13f[_0xeb1a('0x6')]('/api/integrations/sugarcrm/fields',require(_0xeb1a('0x8e')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x8f'),require('./api/intDeskAccount'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x90'),require(_0xeb1a('0x91')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x92'),require(_0xeb1a('0x93')));_0x2ab13f['use'](_0xeb1a('0x94'),require(_0xeb1a('0x95')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x96'),require('./api/intZohoConfiguration'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x97'),require('./api/intZohoField'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x98'),require('./api/intZendeskAccount'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x99'),require(_0xeb1a('0x9a')));_0x2ab13f['use'](_0xeb1a('0x9b'),require(_0xeb1a('0x9c')));_0x2ab13f[_0xeb1a('0x6')]('/api/integrations/freshdesk/accounts',require(_0xeb1a('0x9d')));_0x2ab13f['use'](_0xeb1a('0x9e'),require(_0xeb1a('0x9f')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xa0'),require(_0xeb1a('0xa1')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xa2'),require('./api/intVtigerAccount'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xa3'),require(_0xeb1a('0xa4')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xa5'),require(_0xeb1a('0xa6')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xa7'),require(_0xeb1a('0xa8')));_0x2ab13f['use'](_0xeb1a('0xa9'),require(_0xeb1a('0xaa')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xab'),require(_0xeb1a('0xac')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xad'),require(_0xeb1a('0xae')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xaf'),require(_0xeb1a('0xb0')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xb1'),require(_0xeb1a('0xb2')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xb3'),require(_0xeb1a('0xb4')));_0x2ab13f['use'](_0xeb1a('0xb5'),require(_0xeb1a('0xb6')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xb7'),require(_0xeb1a('0xb8')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xb9'),require('./api/network'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xba'),require(_0xeb1a('0xbb')));_0x2ab13f[_0xeb1a('0x6')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xbc'),require(_0xeb1a('0xbd')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xbe'),require('./api/jscriptyQuestionReport'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xbf'),require(_0xeb1a('0xc0')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xc1'),require(_0xeb1a('0xc2')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xc3'),require('./api/squareReport'));_0x2ab13f['use'](_0xeb1a('0xc4'),require('./api/squareReportDetail'));_0x2ab13f[_0xeb1a('0x6')]('/api/jscripty/projects',require(_0xeb1a('0xc5')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xc6'),require(_0xeb1a('0xc7')));_0x2ab13f[_0xeb1a('0x6')]('/api/square/odbc',require('./api/squareOdbc'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xc8'),require(_0xeb1a('0xc9')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xca'),require(_0xeb1a('0xcb')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xcc'),require(_0xeb1a('0xcd')));_0x2ab13f['use'](_0xeb1a('0xce'),require('./api/team'));_0x2ab13f[_0xeb1a('0x6')]('/api/license',require(_0xeb1a('0xcf')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xd0'),require(_0xeb1a('0xd1')));_0x2ab13f['use'](_0xeb1a('0xd2'),require(_0xeb1a('0xd3')));_0x2ab13f['use'](_0xeb1a('0xd4'),require(_0xeb1a('0xd5')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xd6'),require(_0xeb1a('0xd7')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xd8'),require(_0xeb1a('0xd9')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xda'),require(_0xeb1a('0xdb')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xdc'),require(_0xeb1a('0xdd')));_0x2ab13f[_0xeb1a('0x6')]('/api/openchannel/reports/transfer',require(_0xeb1a('0xde')));_0x2ab13f[_0xeb1a('0x6')]('/api/sms/reports/transfer',require(_0xeb1a('0xdf')));_0x2ab13f[_0xeb1a('0x6')]('/api/cm/lists',require(_0xeb1a('0xe0')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xe1'),require(_0xeb1a('0xe2')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xe3'),require(_0xeb1a('0xe4')));_0x2ab13f[_0xeb1a('0x6')]('/api/userProfile/sections',require(_0xeb1a('0xe5')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xe6'),require(_0xeb1a('0xe7')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xe8'),require(_0xeb1a('0xe9')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xea'),require(_0xeb1a('0xeb')));_0x2ab13f['use']('/api/whatsapp/applications',require(_0xeb1a('0xec')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xed'),require('./api/whatsappInteraction'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xee'),require(_0xeb1a('0xef')));_0x2ab13f[_0xeb1a('0x6')]('/api/whatsapp/reports/queue',require(_0xeb1a('0xf0')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xf1'),require(_0xeb1a('0xf2')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xf3'),require(_0xeb1a('0xf4')));_0x2ab13f['use'](_0xeb1a('0xf5'),require('./api/cloudProvider'));_0x2ab13f['use'](_0xeb1a('0xf6'),require(_0xeb1a('0xf7')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xf8'),require('./api/user-setting'));_0x2ab13f['use'](_0xeb1a('0xf9'),require(_0xeb1a('0xfa')));_0x2ab13f['use'](_0xeb1a('0xfb'),require(_0xeb1a('0xfc')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xfd'),require(_0xeb1a('0xfe')));_0x2ab13f[_0xeb1a('0x6')]('/api/jira',require(_0xeb1a('0xff')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x100'),require('./api/rpc'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x101'),require('./api/version'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x102'),require('./api/system'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x103'),require(_0xeb1a('0x104')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x105'),require(_0xeb1a('0x106')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x107'),clientSideLogs);_0x2ab13f['use']('/apidoc',express[_0xeb1a('0x108')](path[_0xeb1a('0x109')](config['root'],_0xeb1a('0x10a'))));_0x2ab13f['use'](_0xeb1a('0x10b'),express[_0xeb1a('0x108')](path[_0xeb1a('0x109')](config[_0xeb1a('0x10c')],_0xeb1a('0x10b'))));_0x2ab13f['use'](_0xeb1a('0x10d'),express[_0xeb1a('0x108')](path[_0xeb1a('0x109')](config[_0xeb1a('0x10c')],_0xeb1a('0x10d'))));_0x2ab13f['use'](_0xeb1a('0x10e'),express[_0xeb1a('0x108')](path['join'](config['root'],_0xeb1a('0x10f'),'3.8.1')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x110'),express[_0xeb1a('0x108')](path['join'](config[_0xeb1a('0x10c')],'/server/files/plugins')));_0x2ab13f[_0xeb1a('0x111')](_0xeb1a('0x112'))['get'](errors[0x194]);_0x2ab13f['route']('/*')[_0xeb1a('0x113')](function(_0x2a0db1,_0x37de4e){_0x37de4e[_0xeb1a('0x114')](path[_0xeb1a('0x115')](_0x2ab13f['get'](_0xeb1a('0x116'))+_0xeb1a('0x117')));});return _0x2ab13f;});}; \ No newline at end of file +var _0x5c6b=['./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/square/messages','./api/team','./api/license','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','/api/system','./api/system','./api/pm2','./api/webbar','/api/logs','root','/apidoc','/www','static','join','/snippet','3.8.1','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/action','/api/automations','/api/canned_answers','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts'];(function(_0x91a92f,_0x41b7c8){var _0x56d7cb=function(_0x450b7b){while(--_0x450b7b){_0x91a92f['push'](_0x91a92f['shift']());}};_0x56d7cb(++_0x41b7c8);}(_0x5c6b,0x72));var _0xb5c6=function(_0x1fe401,_0x9c538e){_0x1fe401=_0x1fe401-0x0;var _0x1e65b1=_0x5c6b[_0x1fe401];return _0x1e65b1;};'use strict';var path=require('path');var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0xb5c6('0x0'))['setupLoggers'];var clientSideLogs=require(_0xb5c6('0x1'));exports[_0xb5c6('0x2')]=function(_0x1d7067){return setupLoggers(_0x1d7067)[_0xb5c6('0x3')](function(){_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x5'),require('./api/user'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x6'),require('./api/voiceChanSpy'));_0x1d7067[_0xb5c6('0x4')]('/api/voice/contexts',require(_0xb5c6('0x7')));_0x1d7067['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x8'),require(_0xb5c6('0x9')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xa'),require(_0xb5c6('0xb')));_0x1d7067['use'](_0xb5c6('0xc'),require(_0xb5c6('0xd')));_0x1d7067['use']('/api/screen/recordings',require(_0xb5c6('0xe')));_0x1d7067[_0xb5c6('0x4')]('/api/voice/mails',require(_0xb5c6('0xf')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x10'),require('./api/voiceMailMessage'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x11'),require(_0xb5c6('0x12')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x13'),require('./api/voiceDialReport'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x14'),require(_0xb5c6('0x15')));_0x1d7067['use'](_0xb5c6('0x16'),require(_0xb5c6('0x17')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x18'),require(_0xb5c6('0x19')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x1a'),require(_0xb5c6('0x1b')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x1c'),require(_0xb5c6('0x1d')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x1e'),require(_0xb5c6('0x1f')));_0x1d7067['use'](_0xb5c6('0x20'),require(_0xb5c6('0x21')));_0x1d7067['use']('/api/mail/queues',require(_0xb5c6('0x22')));_0x1d7067['use']('/api/mail/substatuses',require(_0xb5c6('0x23')));_0x1d7067['use'](_0xb5c6('0x24'),require(_0xb5c6('0x25')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x26'),require(_0xb5c6('0x27')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x28'),require('./api/mailApplication'));_0x1d7067[_0xb5c6('0x4')]('/api/mail/reports/queue',require(_0xb5c6('0x29')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x2a'),require(_0xb5c6('0x2b')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x2c'),require('./api/dashboardItem'));_0x1d7067['use'](_0xb5c6('0x2d'),require(_0xb5c6('0x2e')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x2f'),require('./api/faxApplication'));_0x1d7067[_0xb5c6('0x4')]('/api/fax/interactions',require('./api/faxInteraction'));_0x1d7067['use']('/api/fax/messages',require(_0xb5c6('0x30')));_0x1d7067['use'](_0xb5c6('0x31'),require(_0xb5c6('0x32')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x33'),require(_0xb5c6('0x34')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x35'),require(_0xb5c6('0x36')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x37'),require('./api/smsApplication'));_0x1d7067['use'](_0xb5c6('0x38'),require(_0xb5c6('0x39')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x3a'),require(_0xb5c6('0x3b')));_0x1d7067[_0xb5c6('0x4')]('/api/sms/queues',require(_0xb5c6('0x3c')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x3d'),require(_0xb5c6('0x3e')));_0x1d7067['use']('/api/openchannel/applications',require(_0xb5c6('0x3f')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x40'),require(_0xb5c6('0x41')));_0x1d7067['use'](_0xb5c6('0x42'),require(_0xb5c6('0x43')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x44'),require(_0xb5c6('0x45')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x46'),require('./api/chatWebsite'));_0x1d7067['use'](_0xb5c6('0x47'),require(_0xb5c6('0x48')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x49'),require(_0xb5c6('0x4a')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x4b'),require(_0xb5c6('0x4c')));_0x1d7067[_0xb5c6('0x4')]('/api/chat/messages',require(_0xb5c6('0x4d')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x4e'),require(_0xb5c6('0x4f')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x50'),require('./api/chatQueue'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x51'),require(_0xb5c6('0x52')));_0x1d7067['use'](_0xb5c6('0x53'),require(_0xb5c6('0x54')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x55'),require(_0xb5c6('0x56')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x57'),require('./api/cmContact'));_0x1d7067['use'](_0xb5c6('0x58'),require('./api/cmHopper'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x59'),require(_0xb5c6('0x5a')));_0x1d7067[_0xb5c6('0x4')]('/api/cm/hopper_final',require(_0xb5c6('0x5b')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x5c'),require('./api/cmHopperHistory'));_0x1d7067[_0xb5c6('0x4')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x1d7067[_0xb5c6('0x4')]('/api/actions',require(_0xb5c6('0x5d')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x5e'),require('./api/automation'));_0x1d7067['use'](_0xb5c6('0x5f'),require('./api/cannedAnswer'));_0x1d7067[_0xb5c6('0x4')]('/api/dispositions',require(_0xb5c6('0x60')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x61'),require(_0xb5c6('0x62')));_0x1d7067[_0xb5c6('0x4')]('/api/intervals',require(_0xb5c6('0x63')));_0x1d7067['use'](_0xb5c6('0x64'),require(_0xb5c6('0x65')));_0x1d7067['use']('/api/cdr',require(_0xb5c6('0x66')));_0x1d7067['use'](_0xb5c6('0x67'),require(_0xb5c6('0x68')));_0x1d7067['use']('/api/schedules',require(_0xb5c6('0x69')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x6a'),require(_0xb5c6('0x6b')));_0x1d7067[_0xb5c6('0x4')]('/api/tags',require('./api/tag'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x6c'),require(_0xb5c6('0x6d')));_0x1d7067[_0xb5c6('0x4')]('/api/cm_contact_has_items',require(_0xb5c6('0x6e')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x6f'),require('./api/cmHopperAdditionalPhone'));_0x1d7067['use'](_0xb5c6('0x70'),require(_0xb5c6('0x71')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x72'),require(_0xb5c6('0x73')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x74'),require(_0xb5c6('0x75')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x76'),require(_0xb5c6('0x77')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x78'),require('./api/integrationReport'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x79'),require(_0xb5c6('0x7a')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x7b'),require(_0xb5c6('0x7c')));_0x1d7067['use'](_0xb5c6('0x7d'),require('./api/analyticExtractedReport'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x7e'),require(_0xb5c6('0x7f')));_0x1d7067['use'](_0xb5c6('0x80'),require(_0xb5c6('0x81')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x82'),require('./api/analyticTreeReport'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x83'),require(_0xb5c6('0x84')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x85'),require(_0xb5c6('0x86')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x87'),require(_0xb5c6('0x88')));_0x1d7067[_0xb5c6('0x4')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x89'),require(_0xb5c6('0x8a')));_0x1d7067[_0xb5c6('0x4')]('/api/integrations/sugarcrm/fields',require(_0xb5c6('0x8b')));_0x1d7067['use'](_0xb5c6('0x8c'),require(_0xb5c6('0x8d')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x8e'),require(_0xb5c6('0x8f')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x90'),require(_0xb5c6('0x91')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x92'),require(_0xb5c6('0x93')));_0x1d7067['use']('/api/integrations/zoho/configurations',require(_0xb5c6('0x94')));_0x1d7067['use'](_0xb5c6('0x95'),require(_0xb5c6('0x96')));_0x1d7067['use'](_0xb5c6('0x97'),require('./api/intZendeskAccount'));_0x1d7067['use']('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x1d7067['use'](_0xb5c6('0x98'),require('./api/intZendeskField'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x99'),require(_0xb5c6('0x9a')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x9b'),require(_0xb5c6('0x9c')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x9d'),require(_0xb5c6('0x9e')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0x9f'),require('./api/intVtigerAccount'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xa0'),require('./api/intVtigerConfiguration'));_0x1d7067['use']('/api/integrations/vtiger/fields',require(_0xb5c6('0xa1')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xa2'),require(_0xb5c6('0xa3')));_0x1d7067[_0xb5c6('0x4')]('/api/integrations/servicenow/configurations',require(_0xb5c6('0xa4')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xa5'),require(_0xb5c6('0xa6')));_0x1d7067[_0xb5c6('0x4')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xa7'),require(_0xb5c6('0xa8')));_0x1d7067[_0xb5c6('0x4')]('/api/integrations/dynamics365/fields',require(_0xb5c6('0xa9')));_0x1d7067['use']('/api/integrations/freshsales/accounts',require(_0xb5c6('0xaa')));_0x1d7067['use'](_0xb5c6('0xab'),require('./api/intFreshsalesConfiguration'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xac'),require(_0xb5c6('0xad')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xae'),require(_0xb5c6('0xaf')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xb0'),require('./api/chatQueueReport'));_0x1d7067[_0xb5c6('0x4')]('/api/chat/internal/messages',require(_0xb5c6('0xb1')));_0x1d7067[_0xb5c6('0x4')]('/api/jscripty/answers/reports',require(_0xb5c6('0xb2')));_0x1d7067[_0xb5c6('0x4')]('/api/jscripty/questions/reports',require(_0xb5c6('0xb3')));_0x1d7067['use']('/api/jscripty/sessions/reports',require(_0xb5c6('0xb4')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xb5'),require(_0xb5c6('0xb6')));_0x1d7067[_0xb5c6('0x4')]('/api/square/reports',require(_0xb5c6('0xb7')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xb8'),require(_0xb5c6('0xb9')));_0x1d7067['use'](_0xb5c6('0xba'),require(_0xb5c6('0xbb')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xbc'),require('./api/setting'));_0x1d7067[_0xb5c6('0x4')]('/api/square/odbc',require(_0xb5c6('0xbd')));_0x1d7067['use']('/api/square/projects',require(_0xb5c6('0xbe')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xbf'),require('./api/squareRecording'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xc0'),require('./api/squareMessage'));_0x1d7067[_0xb5c6('0x4')]('/api/teams',require(_0xb5c6('0xc1')));_0x1d7067['use']('/api/license',require(_0xb5c6('0xc2')));_0x1d7067[_0xb5c6('0x4')]('/api/campaigns',require(_0xb5c6('0xc3')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xc4'),require(_0xb5c6('0xc5')));_0x1d7067[_0xb5c6('0x4')]('/api/attachments',require(_0xb5c6('0xc6')));_0x1d7067['use'](_0xb5c6('0xc7'),require(_0xb5c6('0xc8')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xc9'),require(_0xb5c6('0xca')));_0x1d7067[_0xb5c6('0x4')]('/api/chat/reports/transfer',require(_0xb5c6('0xcb')));_0x1d7067['use']('/api/fax/reports/transfer',require(_0xb5c6('0xcc')));_0x1d7067[_0xb5c6('0x4')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xcd'),require(_0xb5c6('0xce')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xcf'),require('./api/cmList'));_0x1d7067[_0xb5c6('0x4')]('/api/voice/prefixes',require(_0xb5c6('0xd0')));_0x1d7067['use'](_0xb5c6('0xd1'),require(_0xb5c6('0xd2')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xd3'),require(_0xb5c6('0xd4')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xd5'),require('./api/userProfileResource'));_0x1d7067[_0xb5c6('0x4')]('/api/userNotifications',require(_0xb5c6('0xd6')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xd7'),require('./api/whatsappAccount'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xd8'),require(_0xb5c6('0xd9')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xda'),require(_0xb5c6('0xdb')));_0x1d7067['use']('/api/whatsapp/messages',require(_0xb5c6('0xdc')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xdd'),require(_0xb5c6('0xde')));_0x1d7067['use']('/api/whatsapp/reports/transfer',require(_0xb5c6('0xdf')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xe0'),require(_0xb5c6('0xe1')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xe2'),require(_0xb5c6('0xe3')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xe4'),require(_0xb5c6('0xe5')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xe6'),require(_0xb5c6('0xe7')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xe8'),require(_0xb5c6('0xe9')));_0x1d7067['use'](_0xb5c6('0xea'),require('./api/authGoogle'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xeb'),require(_0xb5c6('0xec')));_0x1d7067['use'](_0xb5c6('0xed'),require(_0xb5c6('0xee')));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xef'),require('./api/rpc'));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xf0'),require('./api/version'));_0x1d7067['use'](_0xb5c6('0xf1'),require(_0xb5c6('0xf2')));_0x1d7067[_0xb5c6('0x4')]('/api/pm2',require(_0xb5c6('0xf3')));_0x1d7067['use']('/api/webbar',require(_0xb5c6('0xf4')));_0x1d7067['use'](_0xb5c6('0xf5'),clientSideLogs);_0x1d7067[_0xb5c6('0x4')]('/apidoc',express['static'](path['join'](config[_0xb5c6('0xf6')],_0xb5c6('0xf7'))));_0x1d7067[_0xb5c6('0x4')](_0xb5c6('0xf8'),express[_0xb5c6('0xf9')](path[_0xb5c6('0xfa')](config[_0xb5c6('0xf6')],_0xb5c6('0xf8'))));_0x1d7067[_0xb5c6('0x4')]('/demo',express['static'](path[_0xb5c6('0xfa')](config[_0xb5c6('0xf6')],'/demo')));_0x1d7067['use'](_0xb5c6('0xfb'),express[_0xb5c6('0xf9')](path[_0xb5c6('0xfa')](config[_0xb5c6('0xf6')],'snippet',_0xb5c6('0xfc'))));_0x1d7067['use'](_0xb5c6('0xfd'),express[_0xb5c6('0xf9')](path[_0xb5c6('0xfa')](config[_0xb5c6('0xf6')],_0xb5c6('0xfe'))));_0x1d7067[_0xb5c6('0xff')](_0xb5c6('0x100'))[_0xb5c6('0x101')](errors[0x194]);_0x1d7067[_0xb5c6('0xff')]('/*')[_0xb5c6('0x101')](function(_0x20e5b6,_0x48fd50){_0x48fd50[_0xb5c6('0x102')](path[_0xb5c6('0x103')](_0x1d7067['get'](_0xb5c6('0x104'))+'/index.html'));});return _0x1d7067;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 545bc4a..bc7d21c 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2675=['../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x2be833,_0x200402){var _0xfc793a=function(_0x5e06c3){while(--_0x5e06c3){_0x2be833['push'](_0x2be833['shift']());}};_0xfc793a(++_0x200402);}(_0x2675,0x75));var _0x5267=function(_0x282c12,_0x551a59){_0x282c12=_0x282c12-0x0;var _0x3c9fe2=_0x2675[_0x282c12];return _0x3c9fe2;};'use strict';var jayson=require(_0x5267('0x0'));var _=require('lodash');var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x1da342,_0x2ae442){var _0x57c95a={};_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x2')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x3')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x4')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x5')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x6')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x7')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x8')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x9')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0xa')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0xb')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0xc')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0xd')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0xe')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0xf')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x10')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x11')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x12')));_0x57c95a=_['merge'](_0x57c95a,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x13')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x14')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x15')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x16')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x17')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x18')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x19')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/smsInteraction/smsInteraction.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/smsMessage/smsMessage.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1a')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1b')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1c')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x57c95a=_['merge'](_0x57c95a,require('../api/chatInteraction/chatInteraction.rpc'));_0x57c95a=_['merge'](_0x57c95a,require('../api/chatMessage/chatMessage.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1d')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1e')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1f')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x20')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x21')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/interval/interval.rpc'));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x22')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x23')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x24')));_0x57c95a=_['merge'](_0x57c95a,require('../api/template/template.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x25')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/variable/variable.rpc'));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x26')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x27')));_0x57c95a=_['merge'](_0x57c95a,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x28')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x29')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x2a')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x2b')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x2c')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x2d')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x2e')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x2f')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x30')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x31')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x32')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x33')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x34')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x35')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x36')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x37')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x38')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x39')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x3a')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x3b')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x3c')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x3d')));var _0x487dfc=jayson[_0x5267('0x3e')](_0x57c95a)['http']();var _0x3db34d=config['rpc']['port']||config['port']+0x1;var _0x46bfcc=config['rpc']['ip']||_0x5267('0x3f');_0x487dfc['on'](_0x5267('0x40'),function(_0x3d4b19){return _0x2ae442(_0x3d4b19);});_0x487dfc[_0x5267('0x41')](_0x3db34d,_0x46bfcc,function(){console['log'](_0x5267('0x42'),_0x46bfcc,_0x3db34d);require(_0x5267('0x43'))['default']();return _0x1da342('RPC\x20listening\x20on\x20'+_0x46bfcc+':'+_0x3db34d);});});}; \ No newline at end of file +var _0x68b8=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc'];(function(_0x113b0d,_0x47286e){var _0xdc317e=function(_0xc7400f){while(--_0xc7400f){_0x113b0d['push'](_0x113b0d['shift']());}};_0xdc317e(++_0x47286e);}(_0x68b8,0x1d8));var _0x868b=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0x68b8[_0x2136a6];return _0x55b948;};'use strict';var jayson=require(_0x868b('0x0'));var _=require(_0x868b('0x1'));var config=require(_0x868b('0x2'));exports[_0x868b('0x3')]=function(){return new Promise(function(_0x5c0bc1,_0x3d0569){var _0x1807aa={};_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x5')));_0x1807aa=_['merge'](_0x1807aa,require(_0x868b('0x6')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/voiceQueue/voiceQueue.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x7')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x8')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x9')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1807aa=_['merge'](_0x1807aa,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/memberReport/memberReport.rpc'));_0x1807aa=_['merge'](_0x1807aa,require(_0x868b('0xa')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0xb')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0xc')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/mailServerIn/mailServerIn.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0xd')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0xe')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/mailInteraction/mailInteraction.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/mailMessage/mailMessage.rpc'));_0x1807aa=_['merge'](_0x1807aa,require('../api/mailApplication/mailApplication.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0xf')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x10')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x11')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x12')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x13')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x14')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x15')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x16')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x17')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x18')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x19')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x1a')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x1b')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x1c')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x1d')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x1e')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/chatMessage/chatMessage.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x1f')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x20')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/cmHopper/cmHopper.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x21')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x22')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x23')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x24')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x25')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x26')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x27')));_0x1807aa=_['merge'](_0x1807aa,require(_0x868b('0x28')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x29')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x2a')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x2b')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x2c')));_0x1807aa=_['merge'](_0x1807aa,require(_0x868b('0x2d')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x2e')));_0x1807aa=_['merge'](_0x1807aa,require(_0x868b('0x2f')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x30')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x31')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x32')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x33')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x34')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x35')));_0x1807aa=_['merge'](_0x1807aa,require(_0x868b('0x36')));_0x1807aa=_['merge'](_0x1807aa,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x37')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x38')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/squareProject/squareProject.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x39')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/squareMessage/squareMessage.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/campaign/campaign.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x3a')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/plugin/plugin.rpc'));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x3b')));_0x1807aa=_['merge'](_0x1807aa,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x1807aa=_['merge'](_0x1807aa,require(_0x868b('0x3c')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require(_0x868b('0x3d')));_0x1807aa=_[_0x868b('0x4')](_0x1807aa,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x4bbe79=jayson[_0x868b('0x3e')](_0x1807aa)[_0x868b('0x3f')]();var _0x23b7f2=config[_0x868b('0x40')][_0x868b('0x41')]||config[_0x868b('0x41')]+0x1;var _0x542dd9=config['rpc']['ip']||_0x868b('0x42');_0x4bbe79['on'](_0x868b('0x43'),function(_0x17342e){return _0x3d0569(_0x17342e);});_0x4bbe79[_0x868b('0x3')](_0x23b7f2,_0x542dd9,function(){console[_0x868b('0x44')](_0x868b('0x45'),_0x542dd9,_0x23b7f2);require(_0x868b('0x46'))['default']();return _0x5c0bc1('RPC\x20listening\x20on\x20'+_0x542dd9+':'+_0x23b7f2);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b673ae4..886ed7d 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','ready','line','hangup','520-Invalid','search','520\x20End\x20of\x20proper','substring','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','sync','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4f9d52,_0x3938f9){_0x4f9d52=_0x4f9d52-0x0;var _0x61f98=_0xc6ac[_0x4f9d52];return _0x61f98;};'use strict';var util=require(_0xcc6a('0x0'));var _=require(_0xcc6a('0x1'));var EventEmitter=require(_0xcc6a('0x2'))[_0xcc6a('0x3')];var AGIReply=require(_0xcc6a('0x4'));var AGIError=require(_0xcc6a('0x5'));function AGIChannel(_0x17d786){var _0x31bbcd=this,_0x297643=new AGIReply(),_0x22ee99=![],_0x2f26ab={};EventEmitter[_0xcc6a('0x6')](_0x31bbcd);_0x17d786[_0xcc6a('0x7')](_0xcc6a('0x8'));_0x17d786['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x297643[_0xcc6a('0x7')](_0xcc6a('0x8'));_0x297643['on'](_0xcc6a('0x9'),function(_0x560cc4){for(var _0x43e3bf in _0x560cc4){_0x31bbcd[_0x43e3bf]=_0x560cc4[_0x43e3bf];}_0x31bbcd[_0xcc6a('0xa')](_0xcc6a('0xb'));});_0x297643['on'](_0xcc6a('0xc'),function(_0x3eb04a){if(_0x3eb04a['toLowerCase']()==_0xcc6a('0xd')){_0x31bbcd[_0xcc6a('0xa')](_0xcc6a('0xd'));return;}if(_0x3eb04a['substring'](0x0,0xb)==_0xcc6a('0xe')){_0x22ee99=!![];}if(_0x22ee99){_0x2f26ab['rx']+=_0x3eb04a+'\x0a';if(_0x3eb04a[_0xcc6a('0xf')](_0xcc6a('0x10'))!=-0x1){_0x22ee99=![];}}else{_0x2f26ab['rx']=_0x3eb04a;}if(_0x22ee99){return;}if(typeof _0x2f26ab['cb']=='function'){var _0x59ce6d=_0x2f26ab['rx'][_0xcc6a('0x11')](0x0,0x3),_0xf0f6d5=null,_0x211444=null;_0x59ce6d=parseInt(_0x59ce6d);if(isNaN(_0x59ce6d)){_0x2f26ab['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x59ce6d!=0xc8){_0x2f26ab['cb'](null,{'code':_0x59ce6d,'result':-0x1,'extra':'KO'});return;}_0xf0f6d5=_0x2f26ab['rx']['substring'](0x4)[_0xcc6a('0x12')](_0xcc6a('0x13'),'');if(_0xf0f6d5[_0xcc6a('0x14')]('\x20')!=-0x1){_0xf0f6d5=_0xf0f6d5[_0xcc6a('0x15')](0x0,_0xf0f6d5[_0xcc6a('0x14')]('\x20'));}if(_[_0xcc6a('0x16')](_0xf0f6d5,'-1')){_0xf0f6d5=parseInt(_0xf0f6d5);}_0x211444=_0x2f26ab['rx'][_0xcc6a('0x17')]('\x20');if(_0x211444[_0xcc6a('0x18')]==0x3){_0x211444=_0x211444[0x2]['substring'](0x1,_0x211444[0x2]['length']-0x1);}else if(_0x211444['length']>0x3){var _0x395a55=/\((.+)\)/;var _0x44910f=_0x2f26ab['rx'][_0xcc6a('0x19')](_0x395a55);if(_0x44910f){_0x211444=_0x44910f[0x1];}else{_0x211444=null;}}else{_0x211444=null;}_0x2f26ab['cb'](null,{'code':_0x59ce6d,'result':_0xf0f6d5,'extra':_0x211444});}});_0x17d786['on'](_0xcc6a('0x1a'),function(_0x33079c){_0x31bbcd[_0xcc6a('0xa')](_0xcc6a('0x1a'),new AGIError(_0xcc6a('0x1b'),_0x33079c[_0xcc6a('0x1c')]));});_0x17d786['on'](_0xcc6a('0x1d'),function(){_0x31bbcd[_0xcc6a('0xa')]('close',new AGIError(_0xcc6a('0x1e')));});_0x17d786['on'](_0xcc6a('0x1f'),function(){_0x31bbcd[_0xcc6a('0xa')](_0xcc6a('0x1f'),new AGIError(_0xcc6a('0x20')));_0x17d786[_0xcc6a('0x21')]();});_0x17d786[_0xcc6a('0x22')](_0x297643);this[_0xcc6a('0x23')]=function(_0x2254a8,_0x19d32c){var _0x2254a8=_0x2254a8||'',_0x19d32c=typeof _0x19d32c=='function'?_0x19d32c:new Function();_0x2f26ab={'tx':_0x2254a8,'rx':'','cb':_0x19d32c};_0x17d786[_0xcc6a('0x24')](_0x2254a8+'\x0a');},this[_0xcc6a('0x1d')]=function(){_0x17d786[_0xcc6a('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x26')]=function(_0x3a00e5){return this[_0xcc6a('0x23')][_0xcc6a('0x27')](this,_0x3a00e5);};AGIChannel[_0xcc6a('0x25')]['answer']=function(){return this[_0xcc6a('0x26')](_0xcc6a('0x28'));};AGIChannel[_0xcc6a('0x25')]['getData']=function(_0x3afb3a,_0x3dad72,_0x4da301){_0x3afb3a=_0x3afb3a===undefined?_0xcc6a('0x29'):_0x3afb3a;_0x3dad72=_0x3dad72===undefined?'5':_0x3dad72;_0x4da301=_0x4da301===undefined?'1':_0x4da301;return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x2b'),_0x3afb3a,_0x3dad72*0x3e8,_0x4da301));};AGIChannel['prototype'][_0xcc6a('0x2c')]=function(_0x3cf14c){_0x3cf14c=_0x3cf14c||_0xcc6a('0x2d');return this['sendRequest'](util[_0xcc6a('0x2a')]('VERBOSE\x20\x22%s\x22',_0x3cf14c));};AGIChannel['prototype'][_0xcc6a('0x2e')]=function(_0x2e9f41,_0x3aa315){if(_[_0xcc6a('0x2f')](_0x3aa315)){return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')]('EXEC\x20%s\x20%s',_0x2e9f41,_0x3aa315[_0xcc6a('0x30')](',')));}return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x31'),_0x2e9f41,_0x3aa315));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x32')]=function(_0x2030a6){return this[_0xcc6a('0x26')](util['format'](_0xcc6a('0x33'),_0x2030a6));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x34')]=function(_0x1538bc){return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x35'),_0x1538bc));};AGIChannel['prototype'][_0xcc6a('0x36')]=function(_0x5a41b4){return this['sendRequest'](util['format'](_0xcc6a('0x37'),_0x5a41b4));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0xd')]=function(){return this[_0xcc6a('0x26')](_0xcc6a('0x38'));};AGIChannel['prototype']['setVariable']=function(_0x10f47d,_0x11173a){var _0x4598a8=_['isBoolean'](_0x11173a)||_[_0xcc6a('0x39')](_0x11173a)?_0x11173a[_0xcc6a('0x3a')]():_0x11173a;return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x3b'),_0x10f47d,_0x4598a8?_0x4598a8[_0xcc6a('0x3a')]()[_0xcc6a('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x3c')]=function(_0x373d5b,_0x5b11c8){return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x3d'),_0x373d5b,_0x5b11c8));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x3e')]=function(_0x11e5b1,_0x386cbc){return this['sendRequest'](util['format'](_0xcc6a('0x3f'),_0x11e5b1,_0x386cbc));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x40')]=function(_0x1fd8e1,_0x1e628b){return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x41'),_0x1fd8e1,_0x1e628b));};AGIChannel['prototype']['continueAt']=function(_0x470e3b,_0x4a4c4d,_0x578525){_0x4a4c4d=_0x4a4c4d||this['extension'];_0x578525=_0x578525||0x1;this[_0xcc6a('0x32')](_0x470e3b);this[_0xcc6a('0x34')](_0x4a4c4d);this[_0xcc6a('0x36')](_0x578525);return this[_0xcc6a('0x2c')](util[_0xcc6a('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x470e3b,_0x4a4c4d,_0x578525));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x42')]=function(_0x17e5a0){return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x43'),_0x17e5a0));};AGIChannel['prototype'][_0xcc6a('0x44')]=function(_0xa4d48a,_0x103eee,_0x11c137,_0x494904,_0x1fe723,_0x4a9cea){_0x103eee=_0x103eee||_0xcc6a('0x45');_0x11c137=_0x11c137||'';_0x494904=_0x494904===undefined?-0x1:_0x494904==='-1'?-0x1:_0x494904*0x3e8;_0x1fe723=_0x1fe723===undefined?'':'s='+_0x1fe723;_0x4a9cea=_0x4a9cea?_0xcc6a('0x46'):'';return this[_0xcc6a('0x26')](util['format'](_0xcc6a('0x47'),_0xa4d48a,_0x103eee,_0x11c137,_0x494904,_0x4a9cea,_0x1fe723));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x48')]=function(_0x56f3e5,_0x590678){_0x590678=_0x590678||'';return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x49'),_0x56f3e5,_0x590678));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x4a')]=function(_0x5e59af){return this[_0xcc6a('0x2e')](_0xcc6a('0x4b'),_0x5e59af);};AGIChannel['prototype'][_0xcc6a('0x4c')]=function(_0xa45d06){return this[_0xcc6a('0x2e')](_0xcc6a('0x4d'),_0xa45d06);};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x1a')]=function(_0x5c88e5,_0x4e1a0b){this['noop'](util[_0xcc6a('0x2a')](_0xcc6a('0x4e'),_0x5c88e5['id'],_0x5c88e5[_0xcc6a('0x4f')],_0x4e1a0b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xcc6a('0x50')]=AGIChannel; \ No newline at end of file +var _0x3ecb=['error','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','close','inherits','sync','prototype','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','EventEmitter','./reply','./error','call','setTimeout','setEncoding','utf8','headers','emit','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','split','length','match'];(function(_0x4e501e,_0x8c823e){var _0x14fee9=function(_0x1496fa){while(--_0x1496fa){_0x4e501e['push'](_0x4e501e['shift']());}};_0x14fee9(++_0x8c823e);}(_0x3ecb,0x181));var _0xb3ec=function(_0x2df413,_0x5303ae){_0x2df413=_0x2df413-0x0;var _0x1f5133=_0x3ecb[_0x2df413];return _0x1f5133;};'use strict';var util=require(_0xb3ec('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0xb3ec('0x1')];var AGIReply=require(_0xb3ec('0x2'));var AGIError=require(_0xb3ec('0x3'));function AGIChannel(_0x192729){var _0x477cc0=this,_0x516b18=new AGIReply(),_0x566a97=![],_0x17575a={};EventEmitter[_0xb3ec('0x4')](_0x477cc0);_0x192729['setEncoding']('utf8');_0x192729[_0xb3ec('0x5')](0x8*0x3c*0x3c*0x3e8);_0x516b18[_0xb3ec('0x6')](_0xb3ec('0x7'));_0x516b18['on'](_0xb3ec('0x8'),function(_0x33d6ae){for(var _0x308c58 in _0x33d6ae){_0x477cc0[_0x308c58]=_0x33d6ae[_0x308c58];}_0x477cc0[_0xb3ec('0x9')]('ready');});_0x516b18['on']('line',function(_0x283878){if(_0x283878[_0xb3ec('0xa')]()==_0xb3ec('0xb')){_0x477cc0[_0xb3ec('0x9')]('hangup');return;}if(_0x283878[_0xb3ec('0xc')](0x0,0xb)==_0xb3ec('0xd')){_0x566a97=!![];}if(_0x566a97){_0x17575a['rx']+=_0x283878+'\x0a';if(_0x283878[_0xb3ec('0xe')](_0xb3ec('0xf'))!=-0x1){_0x566a97=![];}}else{_0x17575a['rx']=_0x283878;}if(_0x566a97){return;}if(typeof _0x17575a['cb']==_0xb3ec('0x10')){var _0x4f052c=_0x17575a['rx'][_0xb3ec('0xc')](0x0,0x3),_0x5c0482=null,_0x4733bb=null;_0x4f052c=parseInt(_0x4f052c);if(isNaN(_0x4f052c)){_0x17575a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb3ec('0x11')});return;}if(_0x4f052c!=0xc8){_0x17575a['cb'](null,{'code':_0x4f052c,'result':-0x1,'extra':'KO'});return;}_0x5c0482=_0x17575a['rx'][_0xb3ec('0xc')](0x4)[_0xb3ec('0x12')](_0xb3ec('0x13'),'');if(_0x5c0482[_0xb3ec('0x14')]('\x20')!=-0x1){_0x5c0482=_0x5c0482[_0xb3ec('0x15')](0x0,_0x5c0482['indexOf']('\x20'));}if(_['startsWith'](_0x5c0482,'-1')){_0x5c0482=parseInt(_0x5c0482);}_0x4733bb=_0x17575a['rx'][_0xb3ec('0x16')]('\x20');if(_0x4733bb[_0xb3ec('0x17')]==0x3){_0x4733bb=_0x4733bb[0x2][_0xb3ec('0xc')](0x1,_0x4733bb[0x2][_0xb3ec('0x17')]-0x1);}else if(_0x4733bb[_0xb3ec('0x17')]>0x3){var _0x134a2a=/\((.+)\)/;var _0x98f28=_0x17575a['rx'][_0xb3ec('0x18')](_0x134a2a);if(_0x98f28){_0x4733bb=_0x98f28[0x1];}else{_0x4733bb=null;}}else{_0x4733bb=null;}_0x17575a['cb'](null,{'code':_0x4f052c,'result':_0x5c0482,'extra':_0x4733bb});}});_0x192729['on'](_0xb3ec('0x19'),function(_0x3e4b4b){_0x477cc0[_0xb3ec('0x9')](_0xb3ec('0x19'),new AGIError('E_AGI_SOCKET_ERROR',_0x3e4b4b[_0xb3ec('0x1a')]));});_0x192729['on']('close',function(){_0x477cc0[_0xb3ec('0x9')]('close',new AGIError(_0xb3ec('0x1b')));});_0x192729['on']('timeout',function(){_0x477cc0['emit'](_0xb3ec('0x1c'),new AGIError(_0xb3ec('0x1d')));_0x192729[_0xb3ec('0x1e')]();});_0x192729['pipe'](_0x516b18);this[_0xb3ec('0x1f')]=function(_0x3f63d0,_0x29e6dd){var _0x3f63d0=_0x3f63d0||'',_0x29e6dd=typeof _0x29e6dd==_0xb3ec('0x10')?_0x29e6dd:new Function();_0x17575a={'tx':_0x3f63d0,'rx':'','cb':_0x29e6dd};_0x192729['write'](_0x3f63d0+'\x0a');},this[_0xb3ec('0x20')]=function(){_0x192729[_0xb3ec('0x1e')]();};}util[_0xb3ec('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x414cb0){return this[_0xb3ec('0x1f')][_0xb3ec('0x22')](this,_0x414cb0);};AGIChannel[_0xb3ec('0x23')]['answer']=function(){return this[_0xb3ec('0x24')](_0xb3ec('0x25'));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x26')]=function(_0x271f5d,_0xc15d48,_0xb9abb8){_0x271f5d=_0x271f5d===undefined?_0xb3ec('0x27'):_0x271f5d;_0xc15d48=_0xc15d48===undefined?'5':_0xc15d48;_0xb9abb8=_0xb9abb8===undefined?'1':_0xb9abb8;return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x29'),_0x271f5d,_0xc15d48*0x3e8,_0xb9abb8));};AGIChannel[_0xb3ec('0x23')]['noop']=function(_0x559291){_0x559291=_0x559291||_0xb3ec('0x2a');return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x2b'),_0x559291));};AGIChannel['prototype'][_0xb3ec('0x2c')]=function(_0x2c1cd3,_0x480bfd){if(_[_0xb3ec('0x2d')](_0x480bfd)){return this['sendRequest'](util[_0xb3ec('0x28')](_0xb3ec('0x2e'),_0x2c1cd3,_0x480bfd[_0xb3ec('0x2f')](',')));}return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x2e'),_0x2c1cd3,_0x480bfd));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x30')]=function(_0x392a74){return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x31'),_0x392a74));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x32')]=function(_0x8c1fcd){return this['sendRequest'](util['format'](_0xb3ec('0x33'),_0x8c1fcd));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x34')]=function(_0x3822dd){return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x35'),_0x3822dd));};AGIChannel['prototype'][_0xb3ec('0xb')]=function(){return this['sendRequest'](_0xb3ec('0x36'));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x37')]=function(_0x33ba81,_0xf50f67){var _0x361be2=_[_0xb3ec('0x38')](_0xf50f67)||_['isNumber'](_0xf50f67)?_0xf50f67[_0xb3ec('0x39')]():_0xf50f67;return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x3a'),_0x33ba81,_0x361be2?_0x361be2['toString']()[_0xb3ec('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x3b')]=function(_0x7af7cd,_0x5e29c7){return this['sendRequest'](util[_0xb3ec('0x28')](_0xb3ec('0x3c'),_0x7af7cd,_0x5e29c7));};AGIChannel['prototype']['sayDigits']=function(_0x2b6d36,_0x33ec35){return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x3d'),_0x2b6d36,_0x33ec35));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x3e')]=function(_0x5c0049,_0x2f4b29){return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x3f'),_0x5c0049,_0x2f4b29));};AGIChannel['prototype'][_0xb3ec('0x40')]=function(_0x36fafb,_0x13641f,_0x2a1c6c){_0x13641f=_0x13641f||this[_0xb3ec('0x41')];_0x2a1c6c=_0x2a1c6c||0x1;this[_0xb3ec('0x30')](_0x36fafb);this[_0xb3ec('0x32')](_0x13641f);this[_0xb3ec('0x34')](_0x2a1c6c);return this[_0xb3ec('0x42')](util['format'](_0xb3ec('0x43'),_0x36fafb,_0x13641f,_0x2a1c6c));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x44')]=function(_0x17ef2c){return this['sendRequest'](util[_0xb3ec('0x28')](_0xb3ec('0x45'),_0x17ef2c));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x46')]=function(_0x39f034,_0x363969,_0x88df5e,_0x6ec675,_0x5465cb,_0x352944){_0x363969=_0x363969||_0xb3ec('0x47');_0x88df5e=_0x88df5e||'';_0x6ec675=_0x6ec675===undefined?-0x1:_0x6ec675==='-1'?-0x1:_0x6ec675*0x3e8;_0x5465cb=_0x5465cb===undefined?'':'s='+_0x5465cb;_0x352944=_0x352944?'BEEP':'';return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x48'),_0x39f034,_0x363969,_0x88df5e,_0x6ec675,_0x352944,_0x5465cb));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x49')]=function(_0x3adb9f,_0x509085){_0x509085=_0x509085||'';return this[_0xb3ec('0x24')](util[_0xb3ec('0x28')](_0xb3ec('0x4a'),_0x3adb9f,_0x509085));};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x4b')]=function(_0x5c1223){return this['exec'](_0xb3ec('0x4c'),_0x5c1223);};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x4d')]=function(_0x58c1ed){return this[_0xb3ec('0x2c')](_0xb3ec('0x4e'),_0x58c1ed);};AGIChannel[_0xb3ec('0x23')][_0xb3ec('0x19')]=function(_0x551c4d,_0x6fe211){this['noop'](util['format'](_0xb3ec('0x4f'),_0x551c4d['id'],_0x551c4d[_0xb3ec('0x50')],_0x6fe211));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb3ec('0x51')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index c9a8edc..225e907 100644 --- a/server/services/agi/error.js +++ b/server/services/agi/error.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8613=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.'];(function(_0x4b298c,_0x5e4000){var _0x388abf=function(_0x7c024a){while(--_0x7c024a){_0x4b298c['push'](_0x4b298c['shift']());}};_0x388abf(++_0x5e4000);}(_0x8613,0x135));var _0x3861=function(_0x11a566,_0x4b82c5){_0x11a566=_0x11a566-0x0;var _0x2395ac=_0x8613[_0x11a566];return _0x2395ac;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x3861('0x0'),'E_AGI_ARGUMENT_PORT':_0x3861('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x3861('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x3861('0x3'),'E_AGI_SOCKET_ERROR':_0x3861('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x3861('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3861('0x6'),'E_AGI_IVR_ENTRY':_0x3861('0x7')};function AGIError(_0x1e773f){var _0x1e773f=_0x1e773f||null,_0x145317=_0x145317||[],_0x294eab=0x1,_0x5e93f3='';if(!error[_0x1e773f]){_0x1e773f='E_AGI_UNDEFINED';}_0x145317[_0x3861('0x8')](error[_0x1e773f]);while(arguments[_0x294eab]){_0x145317[_0x3861('0x8')](arguments[_0x294eab]);_0x294eab++;}_0x5e93f3=util[_0x3861('0x9')]['apply'](util,_0x145317);this[_0x3861('0xa')]=_0x5e93f3;this[_0x3861('0xb')]=_0x1e773f;}module[_0x3861('0xc')]=AGIError; \ No newline at end of file +var _0x836e=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x836e,0x1b4));var _0xe836=function(_0x57d3d9,_0x2d605b){_0x57d3d9=_0x57d3d9-0x0;var _0x46730c=_0x836e[_0x57d3d9];return _0x46730c;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xe836('0x0'),'E_AGI_ARGUMENT_PORT':_0xe836('0x1'),'E_AGI_SERVER_ERROR':_0xe836('0x2'),'E_AGI_SERVER_CLOSE':_0xe836('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xe836('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xe836('0x5'),'E_AGI_SOCKET_ERROR':_0xe836('0x6'),'E_AGI_SOCKET_CLOSE':_0xe836('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xe836('0x8'),'E_AGI_COMMAND_EMPTY':_0xe836('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2ee951){var _0x2ee951=_0x2ee951||null,_0x3478f2=_0x3478f2||[],_0x445011=0x1,_0x1e4b03='';if(!error[_0x2ee951]){_0x2ee951=_0xe836('0xa');}_0x3478f2[_0xe836('0xb')](error[_0x2ee951]);while(arguments[_0x445011]){_0x3478f2[_0xe836('0xb')](arguments[_0x445011]);_0x445011++;}_0x1e4b03=util[_0xe836('0xc')][_0xe836('0xd')](util,_0x3478f2);this[_0xe836('0xe')]=_0x1e4b03;this[_0xe836('0xf')]=_0x2ee951;}module[_0xe836('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 5fffb38..281ed89 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa182=['ioredis','./error','../../config/environment','defaults','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','EventEmitter'];(function(_0x2beeed,_0x5df914){var _0x446258=function(_0x40fc7c){while(--_0x40fc7c){_0x2beeed['push'](_0x2beeed['shift']());}};_0x446258(++_0x5df914);}(_0xa182,0x1eb));var _0x2a18=function(_0x4afd17,_0x85902e){_0x4afd17=_0x4afd17-0x0;var _0x13b64f=_0xa182[_0x4afd17];return _0x13b64f;};'use strict';var _=require(_0x2a18('0x0'));var EventEmitter=require('events')[_0x2a18('0x1')];var Redis=require(_0x2a18('0x2'));var AGIError=require(_0x2a18('0x3'));var config=require(_0x2a18('0x4'));config['redis']=_[_0x2a18('0x5')](config[_0x2a18('0x6')],{'host':_0x2a18('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2a18('0x6')]);sub[_0x2a18('0x8')](_0x2a18('0x9'),function(_0x3228e2){if(_0x3228e2)return eventEmitter[_0x2a18('0xa')](_0x2a18('0xb'),new AGIError(_0x2a18('0xc'),_0x3228e2));});sub['on'](_0x2a18('0xd'),function(_0x38a3d3,_0x27562a){if(_0x38a3d3!==_0x2a18('0x9'))return;try{var _0x46518d=JSON[_0x2a18('0xe')](_0x27562a);eventEmitter[_0x2a18('0xa')](_0x2a18('0xf'),_0x46518d);}catch(_0x2be4de){eventEmitter[_0x2a18('0xa')](_0x2a18('0xb'),new AGIError(_0x2a18('0xc'),_0x2be4de));}});module[_0x2a18('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x71ec=['EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','parse','projectUpdate','lodash'];(function(_0x1121a2,_0x5d71a){var _0x130271=function(_0x234436){while(--_0x234436){_0x1121a2['push'](_0x1121a2['shift']());}};_0x130271(++_0x5d71a);}(_0x71ec,0x133));var _0xc71e=function(_0x2a8b5c,_0x429c22){_0x2a8b5c=_0x2a8b5c-0x0;var _0x3bbefe=_0x71ec[_0x2a8b5c];return _0x3bbefe;};'use strict';var _=require(_0xc71e('0x0'));var EventEmitter=require('events')[_0xc71e('0x1')];var Redis=require(_0xc71e('0x2'));var AGIError=require(_0xc71e('0x3'));var config=require(_0xc71e('0x4'));config[_0xc71e('0x5')]=_['defaults'](config['redis'],{'host':_0xc71e('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xc71e('0x5')]);sub[_0xc71e('0x7')](_0xc71e('0x8'),function(_0x159329){if(_0x159329)return eventEmitter[_0xc71e('0x9')](_0xc71e('0xa'),new AGIError(_0xc71e('0xb'),_0x159329));});sub['on']('message',function(_0x413e23,_0x5a49e1){if(_0x413e23!==_0xc71e('0x8'))return;try{var _0x59f6cb=JSON[_0xc71e('0xc')](_0x5a49e1);eventEmitter[_0xc71e('0x9')](_0xc71e('0xd'),_0x59f6cb);}catch(_0x1056a0){eventEmitter[_0xc71e('0x9')](_0xc71e('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x1056a0));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index cc8a731..88e67a8 100644 --- a/server/services/agi/graph/index.js +++ b/server/services/agi/graph/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5abf=['traverseBFS','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid'];(function(_0x472204,_0x13d3b5){var _0x50bffc=function(_0x40e82c){while(--_0x40e82c){_0x472204['push'](_0x472204['shift']());}};_0x50bffc(++_0x13d3b5);}(_0x5abf,0x1c5));var _0xf5ab=function(_0x332edd,_0x30528b){_0x332edd=_0x332edd-0x0;var _0x310417=_0x5abf[_0x332edd];return _0x310417;};'use strict';var _=require(_0xf5ab('0x0'));var logger=require(_0xf5ab('0x1'))(_0xf5ab('0x2'));var verticesWithRetry=[_0xf5ab('0x3'),_0xf5ab('0x4'),_0xf5ab('0x5')];var Graph=function(){this[_0xf5ab('0x6')]={};this[_0xf5ab('0x7')]={};this[_0xf5ab('0x8')]=0x0;};Graph[_0xf5ab('0x9')]['addVertex']=function(_0x36be26){this['vertices'][_0x36be26['id']]=_0x36be26;this[_0xf5ab('0x7')][_0x36be26['id']]=[];};Graph[_0xf5ab('0x9')][_0xf5ab('0xa')]=function(_0x29836a,_0x4cbcdf,_0x16d026){this['edges'][_0x29836a][_0xf5ab('0xb')]({'target':_0x4cbcdf,'condition':_0x16d026});this['numberOfEdges']+=0x1;};Graph[_0xf5ab('0x9')]['size']=function(){return _[_0xf5ab('0xc')](this[_0xf5ab('0x6')]);};Graph[_0xf5ab('0x9')][_0xf5ab('0xd')]=function(){return this[_0xf5ab('0x8')];};Graph['prototype'][_0xf5ab('0xe')]=function(_0x3a72a5){return this[_0xf5ab('0x6')][_0x3a72a5];};Graph[_0xf5ab('0x9')]['traverseBFS']=function(_0x18c8a9,_0x5a30d3){if(!this['vertices'][_0x18c8a9]){return logger[_0xf5ab('0xf')](_0xf5ab('0x10'));}var _0x1144b9=_0x5a30d3(this[_0xf5ab('0x6')][_0x18c8a9]);if(!_0x1144b9){return logger[_0xf5ab('0xf')](_0xf5ab('0x11'));}if(this[_0xf5ab('0x7')][_0x18c8a9][_0xf5ab('0x12')]===0x0){return logger[_0xf5ab('0xf')](_0xf5ab('0x13'));}for(var _0x22e70a=0x0,_0x2498c0=[],_0x4ed291=![];_0x22e70a\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','hasOwnProperty','indexOf','substring','debug','variables','close','timeout','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','[LICENSE]','finally','./server','connection','lodash','syncho','util','../../config/logger'];(function(_0x606cdd,_0x2a4b20){var _0x3acd54=function(_0x75af7e){while(--_0x75af7e){_0x606cdd['push'](_0x606cdd['shift']());}};_0x3acd54(++_0x2a4b20);}(_0x45e2,0x18b));var _0x245e=function(_0x3b9f32,_0xedc868){_0x3b9f32=_0x3b9f32-0x0;var _0x4d8bd0=_0x45e2[_0x3b9f32];return _0x4d8bd0;};'use strict';var _=require(_0x245e('0x0'));var syncho=require(_0x245e('0x1'));var util=require(_0x245e('0x2'));var config=require('../../config/environment');var logger=require(_0x245e('0x3'))(_0x245e('0x4'));var utilLicense=require(_0x245e('0x5'));var rpc=require('./rpc');var Project=require(_0x245e('0x6'));var AGIEmitter=require(_0x245e('0x7'))['EventEmitter'];var projects=[];config[_0x245e('0x4')]=_[_0x245e('0x8')](config['agi'],{'ip':_0x245e('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x2c060f){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2c060f);agiHandler(_0x2c060f);}catch(_0x5d2ab3){logger[_0x245e('0xa')](_0x5d2ab3[_0x245e('0xb')]);}});});}function projectUpdateHandler(_0xaf4cc6){try{var _0x7af81e=_[_0x245e('0xc')](projects,['id',_0xaf4cc6['id']]);if(_0x7af81e>-0x1){if(_0xaf4cc6[_0x245e('0xd')]===!![]){projects[_0x245e('0xe')](_0x7af81e,0x1);}else{projects[_0x7af81e]=_0xaf4cc6;}}else{projects[_0x245e('0xf')](_0xaf4cc6);}}catch(_0x5a1163){logger[_0x245e('0xa')](_0x5a1163[_0x245e('0xb')]);}}function listeningHandler(){console[_0x245e('0x10')](_0x245e('0x11'),config[_0x245e('0x4')][_0x245e('0x12')]);logger[_0x245e('0x13')](util[_0x245e('0x14')](_0x245e('0x15'),config[_0x245e('0x4')]['ip'],config['agi']['port']));}function errorHandler(_0x37749a){if(_0x37749a&&_0x37749a[_0x245e('0x16')]&&_0x37749a[_0x245e('0x17')]){logger[_0x245e('0xa')](util['format'](_0x245e('0x18'),_0x37749a[_0x245e('0x16')],_0x37749a[_0x245e('0x17')]));}else{logger['error'](util['format'](_0x245e('0x19'),_0x37749a[_0x245e('0xb')]));}}function closeHandler(){logger['info'](util[_0x245e('0x14')](_0x245e('0x1a'),this[_0x245e('0x1b')],this[_0x245e('0x1c')],this[_0x245e('0x1d')],this[_0x245e('0x1e')],this[_0x245e('0x1f')]));try{createSquareReport(this);}catch(_0x2763b1){logger[_0x245e('0xa')](_0x2763b1[_0x245e('0xb')]);}}function timeoutHandler(){logger[_0x245e('0x13')](util[_0x245e('0x14')](_0x245e('0x20'),this[_0x245e('0x1b')],this[_0x245e('0x1c')],this[_0x245e('0x1d')],this[_0x245e('0x1e')],this['uniqueid']));}function hangupHandler(){logger[_0x245e('0x13')](util['format'](_0x245e('0x21'),this[_0x245e('0x1b')],this[_0x245e('0x1c')],this[_0x245e('0x1d')],this['dnid'],this[_0x245e('0x1f')]));this[_0x245e('0x22')]=!![];}function createSquareReport(_0x228b8b,_0x44ab15){rpc['createSquareReport'](_0x228b8b)['then'](function(_0x4bb2dc){if(_0x44ab15){_0x44ab15(null,_0x4bb2dc);}})['catch'](function(_0x3e18b4){if(_0x44ab15){_0x44ab15(null,_0x3e18b4);}});}function setChannelVariables(_0x2aa043){for(var _0x1b3a73 in _0x2aa043){if(_0x2aa043[_0x245e('0x23')](_0x1b3a73)){if(_0x1b3a73[_0x245e('0x24')]('agi_')===0x0){_0x2aa043[_0x1b3a73[_0x245e('0x25')](0x4)]=_0x2aa043[_0x1b3a73];delete _0x2aa043[_0x1b3a73];}}}}function agiHandler(_0x36af95){logger[_0x245e('0x26')](_0x245e('0x27'),JSON['stringify'](_0x36af95,null,0x2));logger[_0x245e('0x13')](util[_0x245e('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x36af95[_0x245e('0x1b')],_0x36af95[_0x245e('0x1c')],_0x36af95[_0x245e('0x1d')],_0x36af95['dnid'],_0x36af95[_0x245e('0x1f')]));_0x36af95['on'](_0x245e('0xa'),errorHandler);_0x36af95['on'](_0x245e('0x28'),closeHandler);_0x36af95['on'](_0x245e('0x29'),timeoutHandler);_0x36af95['evtHangup']=![];_0x36af95['on']('hangup',hangupHandler);var _0x8bcc36=_[_0x245e('0x2a')](projects,['name',_0x36af95['arg_1']]);if(!_0x8bcc36)return Project[_0x245e('0x2b')](_0x36af95);if(!_0x8bcc36[_0x245e('0x2c')])return Project['handleUnpublished'](_0x36af95);return Project[_0x245e('0x2d')](_0x8bcc36,_0x36af95);}function main(){var _0x6f73dd;return utilLicense[_0x245e('0x2e')]()['then'](function(_0x56203f){if(!_0x56203f)return;if(_0x56203f[_0x245e('0x2f')]){if(_0x56203f[_0x245e('0x30')]&&_0x56203f[_0x245e('0x30')]>0x0){logger[_0x245e('0x13')](util[_0x245e('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x56203f['callysquare']));_0x6f73dd=_0x56203f[_0x245e('0x30')];}else{logger[_0x245e('0x13')](_0x245e('0x31'));}}else{logger[_0x245e('0x13')](_0x245e('0x32'));_0x6f73dd=-0x1;}})[_0x245e('0x33')](function(){return Project[_0x245e('0x34')]();})['then'](function(_0x2c753b){projects=_0x2c753b;return;})['catch'](function(_0x24a17e){logger[_0x245e('0xa')](_0x245e('0x35'),_0x24a17e[_0x245e('0xb')]);})[_0x245e('0x36')](function(){var _0x24dd33=require(_0x245e('0x37'))(config[_0x245e('0x4')]['port'],config[_0x245e('0x4')]['ip'],_0x6f73dd);_0x24dd33['on'](_0x245e('0xa'),errorHandler);_0x24dd33['on']('listening',listeningHandler);_0x24dd33['on'](_0x245e('0x38'),connectionHandler);_0x24dd33['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x9854=['hasOwnProperty','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening','lodash','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./events','EventEmitter','defaults','127.0.0.1','nextTick','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','uniqueid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','then','catch'];(function(_0x20148a,_0x83800c){var _0x4c8ffb=function(_0x5c0a1d){while(--_0x5c0a1d){_0x20148a['push'](_0x20148a['shift']());}};_0x4c8ffb(++_0x83800c);}(_0x9854,0x137));var _0x4985=function(_0x537b0b,_0x1f6127){_0x537b0b=_0x537b0b-0x0;var _0x26be6c=_0x9854[_0x537b0b];return _0x26be6c;};'use strict';var _=require(_0x4985('0x0'));var syncho=require(_0x4985('0x1'));var util=require(_0x4985('0x2'));var config=require(_0x4985('0x3'));var logger=require(_0x4985('0x4'))(_0x4985('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x4985('0x6'));var Project=require('./project');var AGIEmitter=require(_0x4985('0x7'))[_0x4985('0x8')];var projects=[];config['agi']=_[_0x4985('0x9')](config[_0x4985('0x5')],{'ip':_0x4985('0xa'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x158da1){process[_0x4985('0xb')](function(){syncho(function(){try{setChannelVariables(_0x158da1);agiHandler(_0x158da1);}catch(_0x420e03){logger[_0x4985('0xc')](_0x420e03[_0x4985('0xd')]);}});});}function projectUpdateHandler(_0x44a4ca){try{var _0x5cc281=_[_0x4985('0xe')](projects,['id',_0x44a4ca['id']]);if(_0x5cc281>-0x1){if(_0x44a4ca[_0x4985('0xf')]===!![]){projects[_0x4985('0x10')](_0x5cc281,0x1);}else{projects[_0x5cc281]=_0x44a4ca;}}else{projects[_0x4985('0x11')](_0x44a4ca);}}catch(_0x278ae){logger['error'](_0x278ae[_0x4985('0xd')]);}}function listeningHandler(){console[_0x4985('0x12')](_0x4985('0x13'),config['agi'][_0x4985('0x14')]);logger[_0x4985('0x15')](util[_0x4985('0x16')](_0x4985('0x17'),config[_0x4985('0x5')]['ip'],config[_0x4985('0x5')][_0x4985('0x14')]));}function errorHandler(_0x1c42a6){if(_0x1c42a6&&_0x1c42a6[_0x4985('0x18')]&&_0x1c42a6[_0x4985('0x19')]){logger[_0x4985('0xc')](util[_0x4985('0x16')](_0x4985('0x1a'),_0x1c42a6['name'],_0x1c42a6[_0x4985('0x19')]));}else{logger['error'](util[_0x4985('0x16')](_0x4985('0x1b'),_0x1c42a6[_0x4985('0xd')]));}}function closeHandler(){logger[_0x4985('0x15')](util[_0x4985('0x16')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4985('0x1c')],this[_0x4985('0x1d')],this['callerid'],this['dnid'],this[_0x4985('0x1e')]));try{createSquareReport(this);}catch(_0x531582){logger['error'](_0x531582[_0x4985('0xd')]);}}function timeoutHandler(){logger['info'](util[_0x4985('0x16')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4985('0x1c')],this[_0x4985('0x1d')],this['callerid'],this[_0x4985('0x1f')],this[_0x4985('0x1e')]));}function hangupHandler(){logger[_0x4985('0x15')](util[_0x4985('0x16')](_0x4985('0x20'),this[_0x4985('0x1c')],this['calleridname'],this[_0x4985('0x21')],this[_0x4985('0x1f')],this[_0x4985('0x1e')]));this[_0x4985('0x22')]=!![];}function createSquareReport(_0x2f0dfc,_0x6471b0){rpc['createSquareReport'](_0x2f0dfc)[_0x4985('0x23')](function(_0x44acc5){if(_0x6471b0){_0x6471b0(null,_0x44acc5);}})[_0x4985('0x24')](function(_0x3a24ff){if(_0x6471b0){_0x6471b0(null,_0x3a24ff);}});}function setChannelVariables(_0x807459){for(var _0x2e393a in _0x807459){if(_0x807459[_0x4985('0x25')](_0x2e393a)){if(_0x2e393a['indexOf']('agi_')===0x0){_0x807459[_0x2e393a[_0x4985('0x26')](0x4)]=_0x807459[_0x2e393a];delete _0x807459[_0x2e393a];}}}}function agiHandler(_0x878744){logger[_0x4985('0x27')](_0x4985('0x28'),JSON[_0x4985('0x29')](_0x878744,null,0x2));logger['info'](util[_0x4985('0x16')](_0x4985('0x2a'),_0x878744['arg_1'],_0x878744[_0x4985('0x1d')],_0x878744['callerid'],_0x878744[_0x4985('0x1f')],_0x878744[_0x4985('0x1e')]));_0x878744['on'](_0x4985('0xc'),errorHandler);_0x878744['on'](_0x4985('0x2b'),closeHandler);_0x878744['on'](_0x4985('0x2c'),timeoutHandler);_0x878744[_0x4985('0x22')]=![];_0x878744['on']('hangup',hangupHandler);var _0x4d9506=_[_0x4985('0x2d')](projects,['name',_0x878744[_0x4985('0x1c')]]);if(!_0x4d9506)return Project[_0x4985('0x2e')](_0x878744);if(!_0x4d9506[_0x4985('0x2f')])return Project['handleUnpublished'](_0x878744);return Project[_0x4985('0x30')](_0x4d9506,_0x878744);}function main(){var _0x25e910;return utilLicense[_0x4985('0x31')]()[_0x4985('0x23')](function(_0x10aeb2){if(!_0x10aeb2)return;if(_0x10aeb2[_0x4985('0x32')]){if(_0x10aeb2[_0x4985('0x33')]&&_0x10aeb2['callysquare']>0x0){logger[_0x4985('0x15')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x10aeb2[_0x4985('0x33')]));_0x25e910=_0x10aeb2[_0x4985('0x33')];}else{logger[_0x4985('0x15')](_0x4985('0x34'));}}else{logger['info'](_0x4985('0x35'));_0x25e910=-0x1;}})[_0x4985('0x23')](function(){return Project['getAll']();})[_0x4985('0x23')](function(_0x5be4be){projects=_0x5be4be;return;})[_0x4985('0x24')](function(_0x2dddd3){logger[_0x4985('0xc')](_0x4985('0x36'),_0x2dddd3[_0x4985('0xd')]);})[_0x4985('0x37')](function(){var _0xa0e65d=require(_0x4985('0x38'))(config[_0x4985('0x5')][_0x4985('0x14')],config[_0x4985('0x5')]['ip'],_0x25e910);_0xa0e65d['on'](_0x4985('0xc'),errorHandler);_0xa0e65d['on'](_0x4985('0x39'),listeningHandler);_0xa0e65d['on']('connection',connectionHandler);_0xa0e65d['on'](_0x4985('0x2b'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 71b2319..71b52a5 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf3c=['then','error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x6bc04e,_0x51fd73){var _0x576dd3=function(_0x1ef000){while(--_0x1ef000){_0x6bc04e['push'](_0x6bc04e['shift']());}};_0x576dd3(++_0x51fd73);}(_0xbf3c,0xb6));var _0xcbf3=function(_0x1754d9,_0x537663){_0x1754d9=_0x1754d9-0x0;var _0x369f81=_0xbf3c[_0x1754d9];return _0x369f81;};'use strict';var BPromise=require(_0xcbf3('0x0'));var jayson=require(_0xcbf3('0x1'));var client=jayson[_0xcbf3('0x2')][_0xcbf3('0x3')]({'port':0x232b});function request(_0x50f809,_0x484565){return new BPromise(function(_0x3586c2,_0x2ec0cf){return client[_0xcbf3('0x4')](_0x50f809,_0x484565)[_0xcbf3('0x5')](function(_0x12676c){if(_0x12676c[_0xcbf3('0x6')]){return _0x2ec0cf(_0x12676c[_0xcbf3('0x6')]['message']);}else{return _0x3586c2(_0x12676c[_0xcbf3('0x7')]);}})[_0xcbf3('0x8')](function(_0x3bdff6){return _0x2ec0cf(_0x3bdff6);});});}exports[_0xcbf3('0x9')]=function(_0x3b34e8,_0x566402){return request(_0xcbf3('0xa'),{'account':_0x3b34e8,'message':_0x566402});}; \ No newline at end of file +var _0xd54a=['request','error','message','catch','SendMail','bluebird','jayson/promise','http'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd54a,0x1d5));var _0xad54=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xd54a[_0x82129b];return _0x2ae5dc;};'use strict';var BPromise=require(_0xad54('0x0'));var jayson=require(_0xad54('0x1'));var client=jayson['client'][_0xad54('0x2')]({'port':0x232b});function request(_0x9f0d3b,_0x10c3d7){return new BPromise(function(_0xf4f8e1,_0x4fae41){return client[_0xad54('0x3')](_0x9f0d3b,_0x10c3d7)['then'](function(_0x40dd8a){if(_0x40dd8a[_0xad54('0x4')]){return _0x4fae41(_0x40dd8a[_0xad54('0x4')][_0xad54('0x5')]);}else{return _0xf4f8e1(_0x40dd8a['result']);}})[_0xad54('0x6')](function(_0x5f3f25){return _0x4fae41(_0x5f3f25);});});}exports['sendMailMessage']=function(_0x3270b9,_0x38773e){return request(_0xad54('0x7'),{'account':_0x3270b9,'message':_0x38773e});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index bfa19c5..378c046 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9ed=['format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','clear','stringify','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','./rpc','./mailRpc','./graph','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','retry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','info'];(function(_0x20620f,_0x37c815){var _0x593a2f=function(_0x25479a){while(--_0x25479a){_0x20620f['push'](_0x20620f['shift']());}};_0x593a2f(++_0x37c815);}(_0xd9ed,0x153));var _0xdd9e=function(_0x2534b3,_0x43d9f4){_0x2534b3=_0x2534b3-0x0;var _0x307115=_0xd9ed[_0x2534b3];return _0x307115;};'use strict';var _=require('lodash');var moment=require(_0xdd9e('0x0'));var parser=require(_0xdd9e('0x1'));var util=require(_0xdd9e('0x2'));var logger=require(_0xdd9e('0x3'))('agi');var rpc=require(_0xdd9e('0x4'));var mailRpc=require(_0xdd9e('0x5'));var Graph=require(_0xdd9e('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xdd9e('0x7')]()[_0xdd9e('0x8')](function(_0x273711){logger[_0xdd9e('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x273711[_0xdd9e('0xa')]);return[];});}function addVertex(_0x54bf23,_0x30e250,_0x37df77){_0x30e250[_0xdd9e('0xb')]=_0x37df77;if(_0x30e250[_0xdd9e('0xc')](_0xdd9e('0xd'))){_0x30e250['maxRetry']=parseInt(_0x30e250[_0xdd9e('0xd')],0xa);}_0x54bf23[_0xdd9e('0xe')](_[_0xdd9e('0xf')](_0x30e250,'mxCell'));}function initGraph(_0xa05320,_0xa36e1a){var _0xfe3e6f=new Graph();for(var _0x4e4cae in _0xa05320){if(_0xa05320[_0xdd9e('0xc')](_0x4e4cae)){if(_[_0xdd9e('0x10')](_0xa05320[_0x4e4cae])){for(var _0x1ff57d=0x0;_0x1ff57d<_0xa05320[_0x4e4cae]['length'];_0x1ff57d+=0x1){addVertex(_0xfe3e6f,_0xa05320[_0x4e4cae][_0x1ff57d],_0x4e4cae);}}else{addVertex(_0xfe3e6f,_0xa05320[_0x4e4cae],_0x4e4cae);}}}for(var _0x1798fb=0x0;_0x1798fb<_0xa36e1a[_0xdd9e('0x11')];_0x1798fb+=0x1){if(_0xa36e1a[_0x1798fb][_0xdd9e('0x12')]&&_0xa36e1a[_0x1798fb][_0xdd9e('0x13')]){_0xfe3e6f[_0xdd9e('0x14')](_0xa36e1a[_0x1798fb][_0xdd9e('0x12')],_0xa36e1a[_0x1798fb][_0xdd9e('0x13')],_0xa36e1a[_0x1798fb][_0xdd9e('0x15')]);}}return _0xfe3e6f;}function getRoot(_0x2714c3){return parser[_0xdd9e('0x16')](_0x2714c3,{'object':!![]})[_0xdd9e('0x17')][_0xdd9e('0x18')];}function inspect(_0x1a5b78){return util[_0xdd9e('0x19')](_0x1a5b78,{'showHidden':![],'depth':null});}function initialize(_0x242edf,_0x59b862){var _0x2774de=getRoot(_0x242edf[_0xdd9e('0x1a')]);if(!_0x2774de||!_0x2774de[_0xdd9e('0x1b')])return;var _0x32d41d,_0x59a891,_0x2b5806;logger[_0xdd9e('0x1c')](_0xdd9e('0x18'),JSON['stringify'](_0x2774de,null,0x2));_0x59b862[_0xdd9e('0x1d')]=moment()['format'](_0xdd9e('0x1e'));_0x32d41d=initGraph(_[_0xdd9e('0xf')](_0x2774de,_0xdd9e('0x1f')),_0x2774de['mxCell']);_0x59a891=new Vertices(_0x59b862,rpc,mailRpc);logger[_0xdd9e('0x20')](util[_0xdd9e('0x21')](_0xdd9e('0x22'),_0x59b862[_0xdd9e('0x23')],_0x59b862[_0xdd9e('0x24')],_0x59b862[_0xdd9e('0x25')],_0x59b862[_0xdd9e('0x26')],_0x59b862[_0xdd9e('0x27')]));_0x32d41d['traverseBFS'](_0x2774de[_0xdd9e('0x1b')]['id'],function(_0x14319d){try{_0x14319d=_0x59a891[_0xdd9e('0x28')](_0x14319d);logger[_0xdd9e('0x1c')]('vertex',JSON[_0xdd9e('0x29')](_0x14319d,null,0x2));if(_0x14319d[_0xdd9e('0xb')]==='gotoc'){logger[_0xdd9e('0x20')](_0xdd9e('0x2a'));_0x59b862[_0xdd9e('0x2b')]=_0x14319d[_0xdd9e('0x2b')]||_0x59b862[_0xdd9e('0x2b')];_0x59b862[_0xdd9e('0x2c')]=_0x14319d[_0xdd9e('0x2c')];_0x59b862['priority']=_0x14319d[_0xdd9e('0x2d')]?_0x14319d[_0xdd9e('0x2d')]-0x1:0x1;return null;}else if(_0x14319d&&_0x59a891[_0x14319d['agicommand']]){_0x2b5806=_0x59a891[_0x14319d[_0xdd9e('0xb')]](_0x14319d);logger[_0xdd9e('0x20')](_0xdd9e('0x2e'),JSON[_0xdd9e('0x29')](_0x2b5806,null,0x2));if(_0x2b5806&&_0x2b5806[_0xdd9e('0x2f')]===AGI_CODE_SUCCESS&&_0x2b5806[_0xdd9e('0x30')]!==AGI_RESULT_ERROR&&!_0x59b862[_0xdd9e('0x31')]){logger[_0xdd9e('0x1c')](_0xdd9e('0x2e'),inspect(_0x2b5806));return _['isUndefined'](_0x2b5806[_0xdd9e('0x30')])?null:_0x2b5806[_0xdd9e('0x30')]['toString']();}else{logger[_0xdd9e('0x9')]('response',inspect(_0x2b5806));return null;}}else{logger[_0xdd9e('0x9')](_0xdd9e('0x32'));return null;}}catch(_0x3ea0ae){logger['error'](_0x3ea0ae[_0xdd9e('0xa')]);return null;}});if(_0x2774de[_0xdd9e('0x33')]){logger[_0xdd9e('0x20')](util['format'](_0xdd9e('0x34'),_0x59b862[_0xdd9e('0x23')],_0x59b862[_0xdd9e('0x24')],_0x59b862[_0xdd9e('0x25')],_0x59b862[_0xdd9e('0x26')],_0x59b862[_0xdd9e('0x27')]));_0x32d41d[_0xdd9e('0x35')](_0x2774de[_0xdd9e('0x33')]['id'],function(_0x5e85ba){try{_0x5e85ba=_0x59a891[_0xdd9e('0x28')](_0x5e85ba);logger[_0xdd9e('0x1c')](_0xdd9e('0x36'),JSON['stringify'](_0x5e85ba,null,0x2));if(_0x5e85ba&&_0x59a891[_0x5e85ba[_0xdd9e('0xb')]]){_0x2b5806=_0x59a891[_0x5e85ba[_0xdd9e('0xb')]](_0x5e85ba);if(_0x2b5806){logger[_0xdd9e('0x1c')](_0xdd9e('0x2e'),inspect(_0x2b5806));return _['isUndefined'](_0x2b5806[_0xdd9e('0x30')])?null:_0x2b5806[_0xdd9e('0x30')][_0xdd9e('0x37')]();}else{logger[_0xdd9e('0x9')](_0xdd9e('0x2e'),inspect(_0x2b5806));return null;}}else{logger[_0xdd9e('0x9')](_0xdd9e('0x32'));return null;}}catch(_0x4abd97){logger[_0xdd9e('0x9')](_0x4abd97[_0xdd9e('0xa')]);return null;}});}logger[_0xdd9e('0x20')](util[_0xdd9e('0x21')](_0xdd9e('0x38'),_0x59b862[_0xdd9e('0x23')],_0x59b862['calleridname'],_0x59b862[_0xdd9e('0x25')],_0x59b862[_0xdd9e('0x26')],_0x59b862[_0xdd9e('0x27')]));logger['info'](util['format'](_0xdd9e('0x39'),_0x59b862[_0xdd9e('0x2b')],_0x59b862[_0xdd9e('0x2c')],parseInt(_0x59b862[_0xdd9e('0x2d')],0xa)+0x1));_0x59b862[_0xdd9e('0x3a')](_0x59b862[_0xdd9e('0x2b')],_0x59b862[_0xdd9e('0x2c')],parseInt(_0x59b862[_0xdd9e('0x2d')],0xa)+0x1);_0x59b862['close']();}function handleNotFound(_0x4d60e2){logger[_0xdd9e('0x9')](util[_0xdd9e('0x21')]('Project\x20%s\x20not\x20found',_0x4d60e2['arg_1']));_0x4d60e2['continueAt'](_0x4d60e2[_0xdd9e('0x2b')],_0x4d60e2[_0xdd9e('0x2c')],parseInt(_0x4d60e2[_0xdd9e('0x2d')],0xa)+0x1);_0x4d60e2[_0xdd9e('0x3b')]();}function handleUnpublished(_0xba86e5){logger[_0xdd9e('0x9')](util[_0xdd9e('0x21')](_0xdd9e('0x3c'),_0xba86e5['arg_1']));_0xba86e5['continueAt'](_0xba86e5[_0xdd9e('0x2b')],_0xba86e5[_0xdd9e('0x2c')],parseInt(_0xba86e5[_0xdd9e('0x2d')],0xa)+0x1);_0xba86e5[_0xdd9e('0x3b')]();}module[_0xdd9e('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xdad1=['getSquareProjects','catch','error','agicommand','retry','omit','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','traverseBFS','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','clear','stack','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices'];(function(_0x30d2cd,_0x4ec4d3){var _0x30a8fc=function(_0x1d7454){while(--_0x1d7454){_0x30d2cd['push'](_0x30d2cd['shift']());}};_0x30a8fc(++_0x4ec4d3);}(_0xdad1,0xb0));var _0x1dad=function(_0xd442ba,_0x59861e){_0xd442ba=_0xd442ba-0x0;var _0x4b4119=_0xdad1[_0xd442ba];return _0x4b4119;};'use strict';var _=require(_0x1dad('0x0'));var moment=require(_0x1dad('0x1'));var parser=require(_0x1dad('0x2'));var util=require(_0x1dad('0x3'));var logger=require(_0x1dad('0x4'))(_0x1dad('0x5'));var rpc=require(_0x1dad('0x6'));var mailRpc=require(_0x1dad('0x7'));var Graph=require(_0x1dad('0x8'));var Vertices=require(_0x1dad('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x1dad('0xa')]()[_0x1dad('0xb')](function(_0x33c626){logger[_0x1dad('0xc')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x33c626['stack']);return[];});}function addVertex(_0x441a5c,_0x1e93ee,_0x3390a9){_0x1e93ee[_0x1dad('0xd')]=_0x3390a9;if(_0x1e93ee['hasOwnProperty'](_0x1dad('0xe'))){_0x1e93ee['maxRetry']=parseInt(_0x1e93ee['retry'],0xa);}_0x441a5c['addVertex'](_[_0x1dad('0xf')](_0x1e93ee,'mxCell'));}function initGraph(_0x2132ef,_0x18006d){var _0x40d04b=new Graph();for(var _0x481124 in _0x2132ef){if(_0x2132ef[_0x1dad('0x10')](_0x481124)){if(_[_0x1dad('0x11')](_0x2132ef[_0x481124])){for(var _0x2cb1aa=0x0;_0x2cb1aa<_0x2132ef[_0x481124][_0x1dad('0x12')];_0x2cb1aa+=0x1){addVertex(_0x40d04b,_0x2132ef[_0x481124][_0x2cb1aa],_0x481124);}}else{addVertex(_0x40d04b,_0x2132ef[_0x481124],_0x481124);}}}for(var _0x262e62=0x0;_0x262e62<_0x18006d[_0x1dad('0x12')];_0x262e62+=0x1){if(_0x18006d[_0x262e62][_0x1dad('0x13')]&&_0x18006d[_0x262e62][_0x1dad('0x14')]){_0x40d04b[_0x1dad('0x15')](_0x18006d[_0x262e62][_0x1dad('0x13')],_0x18006d[_0x262e62][_0x1dad('0x14')],_0x18006d[_0x262e62][_0x1dad('0x16')]);}}return _0x40d04b;}function getRoot(_0x506155){return parser[_0x1dad('0x17')](_0x506155,{'object':!![]})[_0x1dad('0x18')][_0x1dad('0x19')];}function inspect(_0x55c885){return util[_0x1dad('0x1a')](_0x55c885,{'showHidden':![],'depth':null});}function initialize(_0xfaaf02,_0x4ba653){var _0x2df592=getRoot(_0xfaaf02['production']);if(!_0x2df592||!_0x2df592[_0x1dad('0x1b')])return;var _0x5dbc14,_0x4345fa,_0x4ee41b;logger[_0x1dad('0x1c')](_0x1dad('0x19'),JSON[_0x1dad('0x1d')](_0x2df592,null,0x2));_0x4ba653[_0x1dad('0x1e')]=moment()[_0x1dad('0x1f')](_0x1dad('0x20'));_0x5dbc14=initGraph(_[_0x1dad('0xf')](_0x2df592,'mxCell'),_0x2df592[_0x1dad('0x21')]);_0x4345fa=new Vertices(_0x4ba653,rpc,mailRpc);logger[_0x1dad('0x22')](util[_0x1dad('0x1f')](_0x1dad('0x23'),_0x4ba653[_0x1dad('0x24')],_0x4ba653['calleridname'],_0x4ba653['callerid'],_0x4ba653[_0x1dad('0x25')],_0x4ba653[_0x1dad('0x26')]));_0x5dbc14[_0x1dad('0x27')](_0x2df592[_0x1dad('0x1b')]['id'],function(_0x3981f4){try{_0x3981f4=_0x4345fa['clear'](_0x3981f4);logger[_0x1dad('0x1c')](_0x1dad('0x28'),JSON[_0x1dad('0x1d')](_0x3981f4,null,0x2));if(_0x3981f4[_0x1dad('0xd')]==='gotoc'){logger[_0x1dad('0x22')](_0x1dad('0x29'));_0x4ba653[_0x1dad('0x2a')]=_0x3981f4['context']||_0x4ba653[_0x1dad('0x2a')];_0x4ba653['extension']=_0x3981f4[_0x1dad('0x2b')];_0x4ba653[_0x1dad('0x2c')]=_0x3981f4[_0x1dad('0x2c')]?_0x3981f4[_0x1dad('0x2c')]-0x1:0x1;return null;}else if(_0x3981f4&&_0x4345fa[_0x3981f4[_0x1dad('0xd')]]){_0x4ee41b=_0x4345fa[_0x3981f4['agicommand']](_0x3981f4);logger[_0x1dad('0x22')]('response',JSON[_0x1dad('0x1d')](_0x4ee41b,null,0x2));if(_0x4ee41b&&_0x4ee41b[_0x1dad('0x2d')]===AGI_CODE_SUCCESS&&_0x4ee41b[_0x1dad('0x2e')]!==AGI_RESULT_ERROR&&!_0x4ba653['evtHangup']){logger['debug'](_0x1dad('0x2f'),inspect(_0x4ee41b));return _[_0x1dad('0x30')](_0x4ee41b[_0x1dad('0x2e')])?null:_0x4ee41b[_0x1dad('0x2e')][_0x1dad('0x31')]();}else{logger[_0x1dad('0xc')](_0x1dad('0x2f'),inspect(_0x4ee41b));return null;}}else{logger[_0x1dad('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x13b79f){logger[_0x1dad('0xc')](_0x13b79f['stack']);return null;}});if(_0x2df592[_0x1dad('0x32')]){logger[_0x1dad('0x22')](util[_0x1dad('0x1f')](_0x1dad('0x33'),_0x4ba653[_0x1dad('0x24')],_0x4ba653['calleridname'],_0x4ba653[_0x1dad('0x34')],_0x4ba653[_0x1dad('0x25')],_0x4ba653[_0x1dad('0x26')]));_0x5dbc14['traverseBFS'](_0x2df592['finally']['id'],function(_0x5de2ee){try{_0x5de2ee=_0x4345fa[_0x1dad('0x35')](_0x5de2ee);logger[_0x1dad('0x1c')](_0x1dad('0x28'),JSON[_0x1dad('0x1d')](_0x5de2ee,null,0x2));if(_0x5de2ee&&_0x4345fa[_0x5de2ee[_0x1dad('0xd')]]){_0x4ee41b=_0x4345fa[_0x5de2ee[_0x1dad('0xd')]](_0x5de2ee);if(_0x4ee41b){logger['debug'](_0x1dad('0x2f'),inspect(_0x4ee41b));return _[_0x1dad('0x30')](_0x4ee41b[_0x1dad('0x2e')])?null:_0x4ee41b[_0x1dad('0x2e')]['toString']();}else{logger[_0x1dad('0xc')]('response',inspect(_0x4ee41b));return null;}}else{logger[_0x1dad('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x4a3b09){logger['error'](_0x4a3b09[_0x1dad('0x36')]);return null;}});}logger[_0x1dad('0x22')](util[_0x1dad('0x1f')](_0x1dad('0x37'),_0x4ba653[_0x1dad('0x24')],_0x4ba653[_0x1dad('0x38')],_0x4ba653['callerid'],_0x4ba653[_0x1dad('0x25')],_0x4ba653[_0x1dad('0x26')]));logger['info'](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4ba653['context'],_0x4ba653['extension'],parseInt(_0x4ba653[_0x1dad('0x2c')],0xa)+0x1));_0x4ba653[_0x1dad('0x39')](_0x4ba653[_0x1dad('0x2a')],_0x4ba653[_0x1dad('0x2b')],parseInt(_0x4ba653[_0x1dad('0x2c')],0xa)+0x1);_0x4ba653['close']();}function handleNotFound(_0x5a73e0){logger[_0x1dad('0xc')](util[_0x1dad('0x1f')](_0x1dad('0x3a'),_0x5a73e0[_0x1dad('0x24')]));_0x5a73e0[_0x1dad('0x39')](_0x5a73e0[_0x1dad('0x2a')],_0x5a73e0[_0x1dad('0x2b')],parseInt(_0x5a73e0[_0x1dad('0x2c')],0xa)+0x1);_0x5a73e0[_0x1dad('0x3b')]();}function handleUnpublished(_0x42e3dd){logger['error'](util[_0x1dad('0x1f')](_0x1dad('0x3c'),_0x42e3dd[_0x1dad('0x24')]));_0x42e3dd['continueAt'](_0x42e3dd['context'],_0x42e3dd[_0x1dad('0x2b')],parseInt(_0x42e3dd['priority'],0xa)+0x1);_0x42e3dd[_0x1dad('0x3b')]();}module[_0x1dad('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index ffe6212..dd5cec5 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ab7=['indexOf','substring','length','split','slice','trim','headers','line','exports','util','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a'];(function(_0x4488f1,_0x1830c6){var _0x50ba40=function(_0x30b611){while(--_0x30b611){_0x4488f1['push'](_0x4488f1['shift']());}};_0x50ba40(++_0x1830c6);}(_0x4ab7,0x75));var _0x74ab=function(_0x51df4b,_0x4aa1e4){_0x51df4b=_0x51df4b-0x0;var _0x1e2f75=_0x4ab7[_0x51df4b];return _0x1e2f75;};'use strict';var util=require(_0x74ab('0x0'));var Transform=require('stream')[_0x74ab('0x1')];function AGIReply(_0x27a902){Transform[_0x74ab('0x2')](this,_0x27a902);this[_0x74ab('0x3')]='';this[_0x74ab('0x4')]=![];}util[_0x74ab('0x5')](AGIReply,Transform);AGIReply[_0x74ab('0x6')][_0x74ab('0x7')]=function(_0x237ce0,_0x15404a,_0x32321c){var _0x2acdfe='\x0a',_0x50b206=['\x0a\x0a',_0x74ab('0x8')],_0x1277f1=-0x1,_0x2871b6=-0x1,_0x517405='',_0x27e20b=0x0,_0x3dd194='',_0x429183='';this[_0x74ab('0x3')]+=_0x237ce0['toString']();_0x3dd194=this[_0x74ab('0x3')];if(!this[_0x74ab('0x4')]){_0x27e20b=0x0;while(_0x50b206[_0x27e20b]){while((_0x2871b6=_0x3dd194[_0x74ab('0x9')](_0x50b206[_0x27e20b]))!=-0x1){_0x517405=_0x50b206[_0x27e20b];_0x429183=_0x3dd194['substring'](0x0,_0x2871b6);_0x3dd194=_0x3dd194[_0x74ab('0xa')](_0x2871b6+_0x517405[_0x74ab('0xb')]);var _0x32cfa7=_0x429183[_0x74ab('0xc')](_0x2acdfe),_0x4a545d=0x0,_0x2a49bb={},_0x582829='',_0x28946e='',_0x289655=-0x1;while(_0x32cfa7[_0x4a545d]){_0x289655=_0x32cfa7[_0x4a545d][_0x74ab('0x9')](':');if(_0x289655!=-0x1){_0x582829=_0x32cfa7[_0x4a545d][_0x74ab('0xd')](0x0,_0x289655)[_0x74ab('0xe')]();_0x28946e=_0x32cfa7[_0x4a545d][_0x74ab('0xd')](_0x289655+0x1)[_0x74ab('0xe')]();if(_0x582829[_0x74ab('0xb')]>0x0){_0x2a49bb[_0x582829]=_0x28946e;}}else{}_0x4a545d++;}this['emit'](_0x74ab('0xf'),_0x2a49bb);this['_inBody']=!![];}_0x27e20b++;}this[_0x74ab('0x3')]=_0x3dd194;}else{while((_0x1277f1=_0x3dd194[_0x74ab('0x9')](_0x2acdfe))!=-0x1){_0x429183=_0x3dd194[_0x74ab('0xa')](0x0,_0x1277f1);this['emit'](_0x74ab('0x10'),_0x429183);_0x3dd194=_0x3dd194[_0x74ab('0xa')](_0x1277f1+_0x2acdfe[_0x74ab('0xb')]);}this['_localBuffer']=_0x3dd194;}_0x32321c();};module[_0x74ab('0x11')]=AGIReply; \ No newline at end of file +var _0x4cff=['emit','headers','line','exports','util','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','slice','trim','length'];(function(_0x27611e,_0x3d5ca7){var _0x36fb5b=function(_0x451530){while(--_0x451530){_0x27611e['push'](_0x27611e['shift']());}};_0x36fb5b(++_0x3d5ca7);}(_0x4cff,0xb8));var _0xf4cf=function(_0x2800da,_0x23a811){_0x2800da=_0x2800da-0x0;var _0x3e6020=_0x4cff[_0x2800da];return _0x3e6020;};'use strict';var util=require(_0xf4cf('0x0'));var Transform=require('stream')[_0xf4cf('0x1')];function AGIReply(_0x2d7d60){Transform['call'](this,_0x2d7d60);this[_0xf4cf('0x2')]='';this[_0xf4cf('0x3')]=![];}util[_0xf4cf('0x4')](AGIReply,Transform);AGIReply[_0xf4cf('0x5')][_0xf4cf('0x6')]=function(_0x17a4aa,_0x474633,_0x13ffb4){var _0x3f43ae='\x0a',_0x2e4beb=['\x0a\x0a',_0xf4cf('0x7')],_0x2a2856=-0x1,_0x37a097=-0x1,_0x2bd4e9='',_0x259956=0x0,_0x2a255c='',_0x389590='';this[_0xf4cf('0x2')]+=_0x17a4aa[_0xf4cf('0x8')]();_0x2a255c=this['_localBuffer'];if(!this[_0xf4cf('0x3')]){_0x259956=0x0;while(_0x2e4beb[_0x259956]){while((_0x37a097=_0x2a255c[_0xf4cf('0x9')](_0x2e4beb[_0x259956]))!=-0x1){_0x2bd4e9=_0x2e4beb[_0x259956];_0x389590=_0x2a255c['substring'](0x0,_0x37a097);_0x2a255c=_0x2a255c[_0xf4cf('0xa')](_0x37a097+_0x2bd4e9['length']);var _0x12da27=_0x389590['split'](_0x3f43ae),_0x4dbf1a=0x0,_0x5505ac={},_0x26a6de='',_0x49ffb9='',_0x57c6db=-0x1;while(_0x12da27[_0x4dbf1a]){_0x57c6db=_0x12da27[_0x4dbf1a][_0xf4cf('0x9')](':');if(_0x57c6db!=-0x1){_0x26a6de=_0x12da27[_0x4dbf1a][_0xf4cf('0xb')](0x0,_0x57c6db)['trim']();_0x49ffb9=_0x12da27[_0x4dbf1a][_0xf4cf('0xb')](_0x57c6db+0x1)[_0xf4cf('0xc')]();if(_0x26a6de[_0xf4cf('0xd')]>0x0){_0x5505ac[_0x26a6de]=_0x49ffb9;}}else{}_0x4dbf1a++;}this[_0xf4cf('0xe')](_0xf4cf('0xf'),_0x5505ac);this['_inBody']=!![];}_0x259956++;}this[_0xf4cf('0x2')]=_0x2a255c;}else{while((_0x2a2856=_0x2a255c[_0xf4cf('0x9')](_0x3f43ae))!=-0x1){_0x389590=_0x2a255c['substring'](0x0,_0x2a2856);this[_0xf4cf('0xe')](_0xf4cf('0x10'),_0x389590);_0x2a255c=_0x2a255c[_0xf4cf('0xa')](_0x2a2856+_0x3f43ae[_0xf4cf('0xd')]);}this[_0xf4cf('0x2')]=_0x2a255c;}_0x13ffb4();};module[_0xf4cf('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 4e41316..b6ee600 100644 --- a/server/services/agi/rpc/index.js +++ b/server/services/agi/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde9d=['ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','then','error','message','result','catch','getSquareProjects','name','ShowSquareProject','production','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','getVariableById','ShowSquareOdbc','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById'];(function(_0x2a707e,_0x510b87){var _0x2b3a97=function(_0x3e471b){while(--_0x3e471b){_0x2a707e['push'](_0x2a707e['shift']());}};_0x2b3a97(++_0x510b87);}(_0xde9d,0x156));var _0xdde9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xde9d[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xdde9('0x0'));var moment=require(_0xdde9('0x1'));var jayson=require(_0xdde9('0x2'));var client=jayson[_0xdde9('0x3')][_0xdde9('0x4')]({'port':0x2329});function request(_0x49fbbe,_0x2a7fa7){return new Promise(function(_0x28cc44,_0x1aebe6){return client['request'](_0x49fbbe,_0x2a7fa7)[_0xdde9('0x5')](function(_0x2b705a){if(_0x2b705a[_0xdde9('0x6')]){return _0x1aebe6(_0x2b705a['error'][_0xdde9('0x7')]);}else{return _0x28cc44(_0x2b705a[_0xdde9('0x8')]);}})[_0xdde9('0x9')](function(_0x3be8c1){return _0x1aebe6(_0x3be8c1);});});}exports[_0xdde9('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xdde9('0xb'),'production']}});};exports['getSquareProject']=function(_0x259849){return request(_0xdde9('0xc'),{'options':{'raw':![],'where':{'name':_0x259849},'attributes':[_0xdde9('0xd')]}});};exports['getMailAccountById']=function(_0x15f74d){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x15f74d},'include':[{'model':'MailServerOut','as':_0xdde9('0xe'),'include':[{'model':_0xdde9('0xf'),'as':_0xdde9('0xf')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0xdde9('0x10')]=function(_0x36c9a0){return request('ShowSquareProject',{'options':{'where':{'id':_0x36c9a0},'attributes':['name']}});};exports[_0xdde9('0x11')]=function(_0x1a1f1a){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1a1f1a},'attributes':[_0xdde9('0xb')]}});};exports[_0xdde9('0x12')]=function(_0x456f27){return request('ShowVariable',{'options':{'where':{'id':_0x456f27},'attributes':[_0xdde9('0xb')]}});};exports['getSquareOdbcById']=function(_0x554246){return request(_0xdde9('0x13'),{'options':{'where':{'id':_0x554246},'attributes':['dsn']}});};exports['getUserById']=function(_0x4b690f){return request(_0xdde9('0x14'),{'options':{'where':{'id':_0x4b690f},'attributes':[_0xdde9('0xb')]}});};exports[_0xdde9('0x15')]=function(_0x2e4b89){return request(_0xdde9('0x16'),{'options':{'where':{'phone':_0x2e4b89[_0xdde9('0x17')]},'attributes':['id']}});};exports[_0xdde9('0x18')]=function(_0x145075){return request(_0xdde9('0x19'),{'options':{'where':{'id':_0x145075},'attributes':['name']}});};exports['getSoundById']=function(_0x71a5bf){return request(_0xdde9('0x1a'),{'options':{'where':{'id':_0x71a5bf},'attributes':[_0xdde9('0x1b')]}});};exports[_0xdde9('0x1c')]=function(_0x25f71e){return request(_0xdde9('0x1d'),{'options':{'raw':![],'where':{'id':_0x25f71e},'include':[{'model':_0xdde9('0x1e'),'as':'Intervals'}]}});};exports[_0xdde9('0x1f')]=function(_0xf48a7){return request(_0xdde9('0x20'),{'options':{'where':{'id':_0xf48a7},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x1ac564){return request(_0xdde9('0x21'),{'body':_0x1ac564});};exports[_0xdde9('0x22')]=function(_0x4df03a){return request(_0xdde9('0x23'),{'body':_0x4df03a});};exports[_0xdde9('0x24')]=function(_0x13ca89){return request(_0xdde9('0x25'),{'body':_['merge'](_0x13ca89,{'project_name':_0x13ca89['arg_1'],'prev_project_name':_0x13ca89['arg_2']||'','is_subproject':_0x13ca89[_0xdde9('0x26')]?!![]:![],'leaveAt':moment()['format'](_0xdde9('0x27'))})});};exports[_0xdde9('0x28')]=function(_0x4ea896){return request('CreateSquareRecording',{'body':_0x4ea896});};exports[_0xdde9('0x29')]=function(_0x29322c){return request(_0xdde9('0x2a'),{'body':_0x29322c});};exports['createCmContact']=function(_0x4461db){return request(_0xdde9('0x2b'),{'options':{'raw':![],'where':{'phone':_0x4461db[_0xdde9('0x17')],'ListId':_0x4461db[_0xdde9('0x2c')]}}})[_0xdde9('0x5')](function(_0x2e2fb4){if(_0x2e2fb4){return _0x2e2fb4;}return request(_0xdde9('0x2d'),{'body':_0x4461db});});};exports[_0xdde9('0x2e')]=function(_0x4338a9){return request('ShowPause',{'options':{'where':{'id':_0x4338a9},'attributes':[_0xdde9('0xb')]}});};exports['agentLogin']=function(_0x28723f,_0x251eba){return request(_0xdde9('0x2f'),{'body':{'interface':_0x251eba},'options':{'where':_0x28723f}});};exports['agentPause']=function(_0x47f07a,_0x58bed6,_0xbe4b9c){return request(_0xdde9('0x30'),{'body':{'type':_0x58bed6,'uniqueid':_0xbe4b9c},'options':{'where':_0x47f07a}});};exports[_0xdde9('0x31')]=function(_0x1b252e){return request(_0xdde9('0x32'),{'body':{},'options':{'where':_0x1b252e}});};exports[_0xdde9('0x33')]=function(_0x3e9ae6){return request(_0xdde9('0x34'),{'body':{},'options':{'where':_0x3e9ae6}});}; \ No newline at end of file +var _0x782e=['createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','jayson/promise','client','request','then','error','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','save_name','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x12cd38,_0x5dc026){var _0x35403f=function(_0x5afbd5){while(--_0x5afbd5){_0x12cd38['push'](_0x12cd38['shift']());}};_0x35403f(++_0x5dc026);}(_0x782e,0xb9));var _0xe782=function(_0x2d8a57,_0x3cd6df){_0x2d8a57=_0x2d8a57-0x0;var _0x5883ba=_0x782e[_0x2d8a57];return _0x5883ba;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0xe782('0x0'));var client=jayson[_0xe782('0x1')]['http']({'port':0x2329});function request(_0x18c841,_0xe1b6db){return new Promise(function(_0x59020b,_0x26f960){return client[_0xe782('0x2')](_0x18c841,_0xe1b6db)[_0xe782('0x3')](function(_0x342a79){if(_0x342a79['error']){return _0x26f960(_0x342a79[_0xe782('0x4')]['message']);}else{return _0x59020b(_0x342a79['result']);}})[_0xe782('0x5')](function(_0x4c6dd1){return _0x26f960(_0x4c6dd1);});});}exports[_0xe782('0x6')]=function(){return request(_0xe782('0x7'),{'options':{'raw':![],'attributes':['id',_0xe782('0x8'),_0xe782('0x9')]}});};exports[_0xe782('0xa')]=function(_0x28dd87){return request(_0xe782('0xb'),{'options':{'raw':![],'where':{'name':_0x28dd87},'attributes':[_0xe782('0x9')]}});};exports[_0xe782('0xc')]=function(_0xec300d){return request(_0xe782('0xd'),{'options':{'raw':![],'where':{'id':_0xec300d},'include':[{'model':_0xe782('0xe'),'as':_0xe782('0xf'),'include':[{'model':_0xe782('0x10'),'as':'CloudProvider'}]}],'attributes':['id',_0xe782('0x8'),'email'],'smtp':!![]}});};exports[_0xe782('0x11')]=function(_0x356c18){return request(_0xe782('0xb'),{'options':{'where':{'id':_0x356c18},'attributes':[_0xe782('0x8')]}});};exports[_0xe782('0x12')]=function(_0xd57d73){return request('ShowVoiceQueue',{'options':{'where':{'id':_0xd57d73},'attributes':['name']}});};exports['getVariableById']=function(_0x15d85b){return request(_0xe782('0x13'),{'options':{'where':{'id':_0x15d85b},'attributes':['name']}});};exports[_0xe782('0x14')]=function(_0x35170a){return request(_0xe782('0x15'),{'options':{'where':{'id':_0x35170a},'attributes':[_0xe782('0x16')]}});};exports[_0xe782('0x17')]=function(_0x35fef7){return request(_0xe782('0x18'),{'options':{'where':{'id':_0x35fef7},'attributes':[_0xe782('0x8')]}});};exports[_0xe782('0x19')]=function(_0xeaf07c){return request(_0xe782('0x1a'),{'options':{'where':{'phone':_0xeaf07c[_0xe782('0x1b')]},'attributes':['id']}});};exports['getTrunkById']=function(_0xf1b118){return request(_0xe782('0x1c'),{'options':{'where':{'id':_0xf1b118},'attributes':[_0xe782('0x8')]}});};exports['getSoundById']=function(_0xa469c6){return request('ShowSound',{'options':{'where':{'id':_0xa469c6},'attributes':[_0xe782('0x1d')]}});};exports['getIntervalById']=function(_0x3f8684){return request(_0xe782('0x1e'),{'options':{'raw':![],'where':{'id':_0x3f8684},'include':[{'model':_0xe782('0x1f'),'as':'Intervals'}]}});};exports[_0xe782('0x20')]=function(_0x2f9335){return request(_0xe782('0x21'),{'options':{'where':{'id':_0x2f9335},'attributes':['id',_0xe782('0x8')]}});};exports['createSmsMessage']=function(_0x657761){return request('CreateSmsMessage',{'body':_0x657761});};exports[_0xe782('0x22')]=function(_0x2331c8){return request(_0xe782('0x23'),{'body':_0x2331c8});};exports[_0xe782('0x24')]=function(_0x382c9c){return request(_0xe782('0x25'),{'body':_[_0xe782('0x26')](_0x382c9c,{'project_name':_0x382c9c[_0xe782('0x27')],'prev_project_name':_0x382c9c[_0xe782('0x28')]||'','is_subproject':_0x382c9c[_0xe782('0x28')]?!![]:![],'leaveAt':moment()[_0xe782('0x29')](_0xe782('0x2a'))})});};exports[_0xe782('0x2b')]=function(_0x2502e9){return request('CreateSquareRecording',{'body':_0x2502e9});};exports[_0xe782('0x2c')]=function(_0x359745){return request(_0xe782('0x2d'),{'body':_0x359745});};exports['createCmContact']=function(_0x49073f){return request(_0xe782('0x2e'),{'options':{'raw':![],'where':{'phone':_0x49073f['phone'],'ListId':_0x49073f['ListId']}}})[_0xe782('0x3')](function(_0x3e9125){if(_0x3e9125){return _0x3e9125;}return request('CreateCmContact',{'body':_0x49073f});});};exports[_0xe782('0x2f')]=function(_0x14bf9c){return request(_0xe782('0x30'),{'options':{'where':{'id':_0x14bf9c},'attributes':[_0xe782('0x8')]}});};exports[_0xe782('0x31')]=function(_0x3d9b57,_0xfa2d2f){return request(_0xe782('0x32'),{'body':{'interface':_0xfa2d2f},'options':{'where':_0x3d9b57}});};exports[_0xe782('0x33')]=function(_0x18f608,_0x453614,_0x422b7b){return request(_0xe782('0x34'),{'body':{'type':_0x453614,'uniqueid':_0x422b7b},'options':{'where':_0x18f608}});};exports[_0xe782('0x35')]=function(_0xa21026){return request(_0xe782('0x36'),{'body':{},'options':{'where':_0xa21026}});};exports[_0xe782('0x37')]=function(_0x36bada){return request(_0xe782('0x38'),{'body':{},'options':{'where':_0x36bada}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 7a0f981..6084715 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad5f=['exports','./polly','./lex'];(function(_0xeb901,_0x3e292e){var _0x645bad=function(_0x46961b){while(--_0x46961b){_0xeb901['push'](_0xeb901['shift']());}};_0x645bad(++_0x3e292e);}(_0xad5f,0x1a8));var _0xfad5=function(_0x2851f2,_0x3d6113){_0x2851f2=_0x2851f2-0x0;var _0x4984db=_0xad5f[_0x2851f2];return _0x4984db;};var polly=require(_0xfad5('0x0'));var lex=require(_0xfad5('0x1'));module[_0xfad5('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9303=['./polly'];(function(_0x5bd953,_0x307788){var _0x4ac021=function(_0x31a3ba){while(--_0x31a3ba){_0x5bd953['push'](_0x5bd953['shift']());}};_0x4ac021(++_0x307788);}(_0x9303,0xd7));var _0x3930=function(_0x31f23f,_0x421862){_0x31f23f=_0x31f23f-0x0;var _0x572b25=_0x9303[_0x31f23f];return _0x572b25;};var polly=require(_0x3930('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 4cedfa7..1a8a92f 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['exports'];(function(_0xeceecb,_0x1e6af5){var _0x1a3756=function(_0x11150f){while(--_0x11150f){_0xeceecb['push'](_0xeceecb['shift']());}};_0x1a3756(++_0x1e6af5);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x13ae45,_0xf1e998){_0x13ae45=_0x13ae45-0x0;var _0xc2b7d4=_0x6f0d[_0x13ae45];return _0xc2b7d4;};'use strict';var lex=require('./lib/api');module[_0xd6f0('0x0')]=function(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93){return lex(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b){return lex(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 9b4af97..cfd195c 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x21128a,_0x1a10c7){var _0x829031=function(_0x17f3c9){while(--_0x17f3c9){_0x21128a['push'](_0x21128a['shift']());}};_0x829031(++_0x1a10c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x56efe3,_0x4f0421){var _0x512607=function(_0x58ff56){while(--_0x58ff56){_0x56efe3['push'](_0x56efe3['shift']());}};_0x512607(++_0x4f0421);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 57365ab..48ce7a7 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f43=['./lib/api','exports'];(function(_0x1b5bff,_0x54f978){var _0x48165a=function(_0x1fac98){while(--_0x1fac98){_0x1b5bff['push'](_0x1b5bff['shift']());}};_0x48165a(++_0x54f978);}(_0x5f43,0x116));var _0x35f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f43[_0x3dd15e];return _0x231fd0;};'use strict';var polly=require(_0x35f4('0x0'));module[_0x35f4('0x1')]=function(_0x43abb7,_0x2438bc,_0x410c66,_0x42d9a1,_0x465735,_0x275574,_0x90dcf9){return polly(_0x43abb7,_0x2438bc,_0x410c66,_0x42d9a1,_0x465735,_0x275574,_0x90dcf9);}; \ No newline at end of file +var _0x683f=['./lib/api','exports'];(function(_0x226c44,_0x1949ee){var _0x2617ee=function(_0x2237d0){while(--_0x2237d0){_0x226c44['push'](_0x226c44['shift']());}};_0x2617ee(++_0x1949ee);}(_0x683f,0x11e));var _0xf683=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x683f[_0x387777];return _0x3f84c0;};'use strict';var polly=require(_0xf683('0x0'));module[_0xf683('0x1')]=function(_0x16a6bc,_0x27b8f9,_0x1a2aff,_0xfc8cbb,_0x4bfade,_0x284987,_0x58e288){return polly(_0x16a6bc,_0x27b8f9,_0x1a2aff,_0xfc8cbb,_0x4bfade,_0x284987,_0x58e288);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 48820b0..ed3ad65 100644 --- a/server/services/agi/scripts/aws/polly/lib/api.js +++ b/server/services/agi/scripts/aws/polly/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf77=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x17e4fb,_0xb18021){var _0x18c91f=function(_0x5dc4d0){while(--_0x5dc4d0){_0x17e4fb['push'](_0x17e4fb['shift']());}};_0x18c91f(++_0xb18021);}(_0xcf77,0x1d3));var _0x7cf7=function(_0x2cac79,_0x4933ed){_0x2cac79=_0x2cac79-0x0;var _0x353569=_0xcf77[_0x2cac79];return _0x353569;};'use strict';var fs=require('fs');var path=require(_0x7cf7('0x0'));var BPromise=require(_0x7cf7('0x1'));var rs=require(_0x7cf7('0x2'));var AWS=require(_0x7cf7('0x3'));function pollyResult(_0x376def,_0x4637e7,_0x3d3b3c){return new BPromise(function(_0x28313d,_0x23e156){_0x376def[_0x7cf7('0x4')](_0x4637e7,function(_0x50b123,_0x31071e){if(_0x50b123){_0x23e156(_0x50b123);}else if(_0x31071e){if(_0x31071e[_0x7cf7('0x5')]instanceof Buffer){fs['writeFile'](_0x3d3b3c,_0x31071e[_0x7cf7('0x5')],function(_0xf1fddb){if(_0xf1fddb){_0x23e156(_0xf1fddb);}else{_0x28313d();}});}else{_0x23e156(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x23e156(new Error(_0x7cf7('0x6')));}});});}module[_0x7cf7('0x7')]=function(_0x261476,_0x3faaf0,_0x59f8c9,_0x234e8b,_0x544c7c,_0x18c5f2,_0x159ba0){var _0x207a83=new AWS[(_0x7cf7('0x8'))]({'accessKeyId':_0x261476,'secretAccessKey':_0x3faaf0,'region':_0x59f8c9});var _0x27b3da={'Text':_0x544c7c,'TextType':_0x18c5f2||_0x7cf7('0x9'),'OutputFormat':_0x7cf7('0xa'),'VoiceId':_0x234e8b};return pollyResult(_0x207a83,_0x27b3da,_0x159ba0);}; \ No newline at end of file +var _0x79de=['aws-sdk','synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird'];(function(_0x3f7e42,_0x47fafe){var _0x3bfbe8=function(_0x415f62){while(--_0x415f62){_0x3f7e42['push'](_0x3f7e42['shift']());}};_0x3bfbe8(++_0x47fafe);}(_0x79de,0x195));var _0xe79d=function(_0x4d7cc7,_0x4a20fd){_0x4d7cc7=_0x4d7cc7-0x0;var _0x295e1b=_0x79de[_0x4d7cc7];return _0x295e1b;};'use strict';var fs=require('fs');var path=require(_0xe79d('0x0'));var BPromise=require(_0xe79d('0x1'));var rs=require('randomstring');var AWS=require(_0xe79d('0x2'));function pollyResult(_0x4713d8,_0x36df4b,_0x54ec46){return new BPromise(function(_0x1ce0e8,_0x59bacb){_0x4713d8[_0xe79d('0x3')](_0x36df4b,function(_0x4d5d70,_0x1a059e){if(_0x4d5d70){_0x59bacb(_0x4d5d70);}else if(_0x1a059e){if(_0x1a059e['AudioStream']instanceof Buffer){fs[_0xe79d('0x4')](_0x54ec46,_0x1a059e['AudioStream'],function(_0xb49b62){if(_0xb49b62){_0x59bacb(_0xb49b62);}else{_0x1ce0e8();}});}else{_0x59bacb(new Error(_0xe79d('0x5')));}}else{_0x59bacb(new Error(_0xe79d('0x6')));}});});}module[_0xe79d('0x7')]=function(_0x113dd6,_0x59e13b,_0x447886,_0x37f8ed,_0x28d3c3,_0x539226,_0x2b10d7){var _0x2516b2=new AWS[(_0xe79d('0x8'))]({'accessKeyId':_0x113dd6,'secretAccessKey':_0x59e13b,'region':_0x447886});var _0x443bcb={'Text':_0x28d3c3,'TextType':_0x539226||_0xe79d('0x9'),'OutputFormat':_0xe79d('0xa'),'VoiceId':_0x37f8ed};return pollyResult(_0x2516b2,_0x443bcb,_0x2b10d7);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 7b01041..e3fd31d 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ebe=['exports','./lib/api'];(function(_0x68359d,_0x51477f){var _0x15d875=function(_0x5efef8){while(--_0x5efef8){_0x68359d['push'](_0x68359d['shift']());}};_0x15d875(++_0x51477f);}(_0x1ebe,0x171));var _0xe1eb=function(_0x334d05,_0x20b1ef){_0x334d05=_0x334d05-0x0;var _0x30440f=_0x1ebe[_0x334d05];return _0x30440f;};'use strict';var asr=require(_0xe1eb('0x0'));module[_0xe1eb('0x1')]=function(_0xab2cfd,_0x35f93c,_0x772f38,_0x194a3b){return asr(_0xab2cfd,_0x35f93c,_0x772f38);}; \ No newline at end of file +var _0x500f=['exports','./lib/api'];(function(_0x1522db,_0x7efece){var _0x165585=function(_0x1c8f19){while(--_0x1c8f19){_0x1522db['push'](_0x1522db['shift']());}};_0x165585(++_0x7efece);}(_0x500f,0xdd));var _0xf500=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0x500f[_0x33ebf5];return _0x66957b;};'use strict';var asr=require(_0xf500('0x0'));module[_0xf500('0x1')]=function(_0x28b432,_0x5cfa10,_0x69f67d,_0x2d3dc2){return asr(_0x28b432,_0x5cfa10,_0x69f67d);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 21690e7..01b336d 100644 --- a/server/services/agi/scripts/google/asr/lib/api.js +++ b/server/services/agi/scripts/google/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ea=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','key\x20should\x20be\x20a\x20string','undefined','length'];(function(_0x1eb82d,_0x1e23cb){var _0x2c9502=function(_0x4a3500){while(--_0x4a3500){_0x1eb82d['push'](_0x1eb82d['shift']());}};_0x2c9502(++_0x1e23cb);}(_0x55ea,0xc9));var _0xa55e=function(_0x508028,_0x3a4b4a){_0x508028=_0x508028-0x0;var _0x50a1df=_0x55ea[_0x508028];return _0x50a1df;};'use strict';var url=require(_0xa55e('0x0'));var BPromise=require(_0xa55e('0x1'));var fs=require('fs');var host=_0xa55e('0x2');module['exports']=function(_0x2b5bc7,_0x26b2ef,_0x17dd4d){return new BPromise(function(_0x1325cc,_0x95af3d){var _0x54f178;if(typeof _0x2b5bc7!==_0xa55e('0x3')||_0x2b5bc7['length']===0x0){return _0x95af3d('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x26b2ef!=='string'||_0x26b2ef['length']===0x0){return _0x95af3d(_0xa55e('0x4'));}if(typeof _0x17dd4d!==_0xa55e('0x5')&&(typeof _0x17dd4d!==_0xa55e('0x3')||_0x17dd4d[_0xa55e('0x6')]===0x0)){return _0x95af3d(_0xa55e('0x7'));}try{_0x54f178=fs[_0xa55e('0x8')](_0x2b5bc7)[_0xa55e('0x9')](_0xa55e('0xa'));}catch(_0xe58ede){return _0x95af3d(_0xe58ede);}return _0x1325cc({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x26b2ef,'body':{'config':{'encoding':_0xa55e('0xb'),'sampleRateHertz':_0xa55e('0xc'),'languageCode':_0x17dd4d},'audio':{'content':_0x54f178}},'json':!![]});});}; \ No newline at end of file +var _0x9f62=['string','length','key\x20should\x20be\x20a\x20string','undefined','base64','LINEAR16','8000','bluebird','exports'];(function(_0x591bbe,_0x46ecdf){var _0x1ced83=function(_0xb01928){while(--_0xb01928){_0x591bbe['push'](_0x591bbe['shift']());}};_0x1ced83(++_0x46ecdf);}(_0x9f62,0x154));var _0x29f6=function(_0x322fcf,_0xe8a81b){_0x322fcf=_0x322fcf-0x0;var _0x4a61f8=_0x9f62[_0x322fcf];return _0x4a61f8;};'use strict';var url=require('url');var BPromise=require(_0x29f6('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x29f6('0x1')]=function(_0x254ab3,_0x548050,_0x5618b7){return new BPromise(function(_0x54d164,_0x258ddd){var _0x2f0420;if(typeof _0x254ab3!==_0x29f6('0x2')||_0x254ab3[_0x29f6('0x3')]===0x0){return _0x258ddd('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x548050!==_0x29f6('0x2')||_0x548050[_0x29f6('0x3')]===0x0){return _0x258ddd(_0x29f6('0x4'));}if(typeof _0x5618b7!==_0x29f6('0x5')&&(typeof _0x5618b7!==_0x29f6('0x2')||_0x5618b7['length']===0x0)){return _0x258ddd('lang\x20should\x20be\x20a\x20string');}try{_0x2f0420=fs['readFileSync'](_0x254ab3)['toString'](_0x29f6('0x6'));}catch(_0x44db16){return _0x258ddd(_0x44db16);}return _0x54d164({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x548050,'body':{'config':{'encoding':_0x29f6('0x7'),'sampleRateHertz':_0x29f6('0x8'),'languageCode':_0x5618b7},'audio':{'content':_0x2f0420}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 5e32062..144bae4 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ca6=['./asr','exports'];(function(_0x3f8eda,_0x20fa7d){var _0x37d14f=function(_0x31ab3c){while(--_0x31ab3c){_0x3f8eda['push'](_0x3f8eda['shift']());}};_0x37d14f(++_0x20fa7d);}(_0x4ca6,0x6a));var _0x64ca=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x4ca6[_0x1b6c6d];return _0x290d9d;};var asr=require(_0x64ca('0x0'));module[_0x64ca('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0ded=['exports','./asr'];(function(_0x128408,_0x57097b){var _0x3fea1c=function(_0x188376){while(--_0x188376){_0x128408['push'](_0x128408['shift']());}};_0x3fea1c(++_0x57097b);}(_0x0ded,0x191));var _0xd0de=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0x0ded[_0x15a634];return _0xf4f7a0;};var asr=require(_0xd0de('0x0'));module[_0xd0de('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 99df44e..1e09835 100644 --- a/server/services/agi/scripts/index.js +++ b/server/services/agi/scripts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1dd8=['textRequest','source','resolvedQuery','result','action','speech','score','status','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','path','querystring','request-promise','google-tts-api','parse','util','./sestek','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','POST','tmp','.mp3','from','audioContent','writeFile','resolve','generate','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence'];(function(_0x2731c3,_0x398e1e){var _0x197199=function(_0x11af2e){while(--_0x11af2e){_0x2731c3['push'](_0x2731c3['shift']());}};_0x197199(++_0x398e1e);}(_0x1dd8,0xb8));var _0x81dd=function(_0x36da00,_0x5b533b){_0x36da00=_0x36da00-0x0;var _0x4b72c5=_0x1dd8[_0x36da00];return _0x4b72c5;};'use strict';var apiai=require(_0x81dd('0x0'));var BPromise=require(_0x81dd('0x1'));var dialogflow=require(_0x81dd('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x81dd('0x3'));var md5=require('md5');var path=require(_0x81dd('0x4'));var querystring=require(_0x81dd('0x5'));var rp=require(_0x81dd('0x6'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0x81dd('0x7'));var urlParse=require('url')[_0x81dd('0x8')];var util=require(_0x81dd('0x9'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x81dd('0xa'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x81dd('0xb'));var ISPEECH_API=_0x81dd('0xc');function downloadFile(_0x3319a8,_0x139148){return new BPromise(function(_0x143608,_0x11b35a){var _0xcbb56c=urlParse(_0x3319a8);var _0x424bdd=_0xcbb56c[_0x81dd('0xd')]===_0x81dd('0xe')?https:http;var _0x5eaa68={'host':_0xcbb56c[_0x81dd('0xf')],'path':_0xcbb56c[_0x81dd('0x4')],'headers':{'user-agent':_0x81dd('0x10')}};_0x424bdd[_0x81dd('0x11')](_0x5eaa68,function(_0x201b86){if(_0x201b86[_0x81dd('0x12')]!==0xc8){logger[_0x81dd('0x13')](_0x81dd('0x14')+_0x3319a8+_0x81dd('0x15')+_0x201b86[_0x81dd('0x12')]+'\x20('+_0x201b86[_0x81dd('0x16')]+')');_0x11b35a(new Error(_0x81dd('0x14')+_0x3319a8+_0x81dd('0x15')+_0x201b86[_0x81dd('0x12')]+'\x20('+_0x201b86['statusMessage']+')'));return;}var _0x2e3bdc=fs[_0x81dd('0x17')](_0x139148);_0x2e3bdc['on'](_0x81dd('0x18'),function(){logger[_0x81dd('0x19')](_0x81dd('0x1a'));_0x2e3bdc[_0x81dd('0x1b')](_0x143608);});_0x2e3bdc['on']('error',function(_0x36335d){fs[_0x81dd('0x1c')](_0x139148);logger[_0x81dd('0x13')](_0x81dd('0x1d'),_0x36335d);_0x11b35a(_0x36335d);});_0x201b86[_0x81dd('0x1e')](_0x2e3bdc);})['on'](_0x81dd('0x13'),function(_0xbe2842){logger[_0x81dd('0x13')](_0xbe2842);_0x11b35a(_0xbe2842);})[_0x81dd('0x1f')]();});}function uploadFile(_0x164c2f){return new BPromise(function(_0x3f4431,_0x2d2d69){var _0x4daa72=urlParse(_0x164c2f);var _0x5308d2=_0x4daa72[_0x81dd('0xd')]==='https:'?https:http;var _0x785e71={'host':_0x4daa72[_0x81dd('0xf')],'path':_0x4daa72[_0x81dd('0x4')],'headers':{'user-agent':_0x81dd('0x10')}};_0x5308d2[_0x81dd('0x11')](_0x785e71,function(_0x9e108d){if(_0x9e108d[_0x81dd('0x12')]!==0xc8){_0x2d2d69(new Error('request\x20to\x20'+_0x164c2f+'\x20failed,\x20status\x20code\x20=\x20'+_0x9e108d[_0x81dd('0x12')]+'\x20('+_0x9e108d['statusMessage']+')'));return;}var _0x31c6bd='';_0x9e108d['on']('data',function(_0x9472cb){_0x31c6bd+=_0x9472cb;});_0x9e108d['on'](_0x81dd('0x1f'),function(){_0x3f4431(_0x31c6bd);});})['on'](_0x81dd('0x13'),function(_0x2f91ac){_0x2d2d69(_0x2f91ac);})[_0x81dd('0x1f')]();});}function convertFile(_0x12facf,_0x593f85){return new BPromise(function(_0x3cf3f9,_0x20c22d){var _0x167248=sox[_0x81dd('0x20')](_0x12facf,_0x593f85,{'sampleRate':0x1f40,'format':_0x81dd('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x167248['on'](_0x81dd('0x13'),function(_0x5564e3){logger[_0x81dd('0x13')](_0x81dd('0x22'),_0x5564e3);_0x20c22d(_0x5564e3);});_0x167248['on']('end',function(){logger[_0x81dd('0x19')](_0x81dd('0x23'));_0x3cf3f9();});_0x167248[_0x81dd('0x24')]();});}function base64Decode(_0x17c93a,_0xbd0c3b){var _0x471c2d=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x81dd('0x25'));fs[_0x81dd('0x26')](_0x471c2d,_0x17c93a,_0x81dd('0x27'));return convertFile(_0x471c2d,_0xbd0c3b)[_0x81dd('0x28')](function(){try{fs[_0x81dd('0x1c')](_0x471c2d);fs[_0x81dd('0x29')](_0xbd0c3b,_0x81dd('0x2a'));}catch(_0x3915ea){logger['error'](_0x3915ea);}return _0xbd0c3b[_0x81dd('0x2b')]('.')[0x0];});}function base64Encode(_0x192284){var _0x266b16=fs[_0x81dd('0x2c')](_0x192284);return new Buffer(_0x266b16)[_0x81dd('0x2d')](_0x81dd('0x27'));}exports[_0x81dd('0x2e')]=function(_0x592d40,_0xf6c2a3,_0x526a6f,_0xd1b26,_0x1858f6,_0x17fc03){var _0x7b3cd8,_0x10c2a4;var _0x17c8ff=_0x81dd('0x2f');var _0x536572=_0x81dd('0x30')+_0x592d40;var _0x50c8d3={};if(_0xf6c2a3===_0x81dd('0x31')){_0x50c8d3['input']={'ssml':_0x526a6f};}else{_0x50c8d3[_0x81dd('0x32')]={'text':_0x526a6f};};_0x50c8d3[_0x81dd('0x33')]={'languageCode':_0xd1b26,'ssmlGender':_0x1858f6};_0x50c8d3[_0x81dd('0x34')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5905d9={'url':_0x17c8ff+'text:synthesize'+_0x536572,'method':_0x81dd('0x35'),'json':!![],'body':_0x50c8d3};return rp(_0x5905d9)[_0x81dd('0x28')](function(_0x291d32){return new BPromise(function(_0x5c169d,_0x3538b5){_0x7b3cd8=path['resolve'](__dirname,_0x81dd('0x36'),rs['generate'](0x4)+_0x81dd('0x37'));var _0x5bab36=Buffer[_0x81dd('0x38')](_0x291d32[_0x81dd('0x39')],_0x81dd('0x27'));return fs[_0x81dd('0x3a')](_0x7b3cd8,_0x5bab36,function(_0x59dae4){_0x3538b5(_0x59dae4);},function(_0x23870a){fs[_0x81dd('0x29')](_0x7b3cd8,_0x81dd('0x2a'));_0x5c169d(_0x23870a);});});})[_0x81dd('0x28')](function(_0x13fadf){_0x10c2a4=path[_0x81dd('0x3b')](__dirname,_0x81dd('0x36'),rs[_0x81dd('0x3c')](0x4)+'.wav');return convertFile(_0x7b3cd8,_0x10c2a4);})[_0x81dd('0x28')](function(){try{fs['unlink'](_0x7b3cd8);fs['chmodSync'](_0x10c2a4,_0x81dd('0x2a'));}catch(_0x54e0f1){logger[_0x81dd('0x13')](_0x54e0f1);}logger['info'](_0x81dd('0x3d'),_0x10c2a4[_0x81dd('0x2b')]('.')[0x0]);return _0x10c2a4[_0x81dd('0x2b')]('.')[0x0];});};exports['googleTTS']=function(_0x414ad4,_0x1f59d2){var _0x58866e=_0x81dd('0x3e');var _0x59d36e,_0x46028b;var _0xaa84a5;var _0x45c02b={'encoding':_0x81dd('0x3f'),'method':'POST','timeout':0x2710,'url':_0x58866e,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x81dd('0x40')+encodeURIComponent(JSON[_0x81dd('0x41')]([[[_0x81dd('0x42'),JSON[_0x81dd('0x41')]([_0x414ad4,_0x1f59d2||'en',![],'null']),null,_0x81dd('0x43')]]]))};return rp(_0x45c02b)[_0x81dd('0x28')](function(_0x258937){try{_0xaa84a5=eval(_0x258937[_0x81dd('0x44')](0x5))[0x0][0x2];}catch(_0x4f25f3){throw new Error(_0x81dd('0x45')+_0x258937[_0x81dd('0x46')]);}if(!_0xaa84a5){if(_0x414ad4[_0x81dd('0x47')]>0xc8){throw new Error(_0x81dd('0x48'));}else{throw new Error('lang\x20\x22'+_0x1f59d2+_0x81dd('0x49'));}}try{_0xaa84a5=eval(_0xaa84a5)[0x0];}catch(_0x4085f7){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0xfa9a4c=_0xaa84a5;_0x59d36e=path[_0x81dd('0x3b')](__dirname,_0x81dd('0x36'),rs[_0x81dd('0x3c')](0x4)+_0x81dd('0x37'));fs['writeFileSync'](_0x59d36e,_0xaa84a5,{'encoding':'base64'});_0x46028b=path['resolve'](__dirname,'tmp',rs[_0x81dd('0x3c')](0x4)+'.wav');return convertFile(_0x59d36e,_0x46028b);})[_0x81dd('0x28')](function(){try{fs[_0x81dd('0x1c')](_0x59d36e);fs[_0x81dd('0x29')](_0x46028b,_0x81dd('0x2a'));}catch(_0x50e2f9){logger[_0x81dd('0x13')](_0x50e2f9);}logger[_0x81dd('0x19')](_0x81dd('0x4a'),_0x46028b['split']('.')[0x0]);return _0x46028b['split']('.')[0x0];});};exports[_0x81dd('0x4b')]=function(_0xba911a,_0x5e0ff2,_0x5d12bf){return google[_0x81dd('0x4c')](_0xba911a,_0x5e0ff2,_0x5d12bf)[_0x81dd('0x28')](function(_0x5c70b4){logger['info'](_0x5c70b4[_0x81dd('0x4d')]);return rp(_0x5c70b4);})[_0x81dd('0x28')](function(_0x3ed805){var _0x56ad63='';var _0x4a1808=0x0;try{fs['unlink'](_0xba911a);}catch(_0x284890){logger[_0x81dd('0x13')](_0x284890);}if(_0x3ed805&&_0x3ed805[_0x81dd('0x4e')]){_0x56ad63=_0x3ed805[_0x81dd('0x4e')][_0x81dd('0x4f')](function(_0x4d29a7){return _0x4d29a7&&_0x4d29a7['alternatives'][0x0]&&_0x4d29a7[_0x81dd('0x50')][0x0][_0x81dd('0x51')]?_0x4d29a7[_0x81dd('0x50')][0x0]['transcript']:'';})[_0x81dd('0x52')]('\x0a');_0x4a1808=_0x3ed805[_0x81dd('0x4e')][_0x81dd('0x4f')](function(_0x45a66e){return _0x45a66e&&_0x45a66e['alternatives'][0x0]&&_0x45a66e[_0x81dd('0x50')][0x0]['confidence']?_0x45a66e['alternatives'][0x0][_0x81dd('0x53')]:0x0;})[_0x81dd('0x52')]('\x0a');}logger['info'](_0x81dd('0x54'),_0x56ad63);logger['info'](_0x81dd('0x55'),_0x4a1808);return{'transcript':_0x56ad63,'confidence':_0x4a1808};})['catch'](function(_0x27412b){logger[_0x81dd('0x13')]('[%s]\x20%s:%s',_0x27412b[_0x81dd('0x12')],_0x27412b['name'],_0x27412b['message']);});};exports['googleDialogflow']=function(_0x1bd1d7,_0x277649,_0x5b9802,_0x77d010){var _0x15d798=apiai(_0x277649,{'language':_0x77d010||'en'});return _0x15d798[_0x81dd('0x56')](_0x5b9802,{'sessionId':md5(_0x1bd1d7)})['then'](function(_0x1b32dc){logger[_0x81dd('0x19')](JSON['stringify'](_0x1b32dc));return{'source':_0x1b32dc['result'][_0x81dd('0x57')],'resolvedQuery':_0x1b32dc['result'][_0x81dd('0x58')],'action':_0x1b32dc[_0x81dd('0x59')][_0x81dd('0x5a')],'actionIncomplete':_0x1b32dc[_0x81dd('0x59')]['actionIncomplete'],'speech':_0x1b32dc[_0x81dd('0x59')]['fulfillment'][_0x81dd('0x5b')],'score':_0x1b32dc['result'][_0x81dd('0x5c')],'statusCode':_0x1b32dc[_0x81dd('0x5d')][_0x81dd('0x5e')],'endConversation':_0x1b32dc[_0x81dd('0x59')][_0x81dd('0x5f')][_0x81dd('0x60')]||![],'isFallbackIntent':_0x1b32dc[_0x81dd('0x59')][_0x81dd('0x5f')][_0x81dd('0x61')]};});};exports['googleDialogflowV2']=function(_0x225128,_0x4512dc,_0x1cd8fc,_0x131937,_0x36a26e,_0x538a1e){var _0x127994=_0x131937[_0x81dd('0x62')](/\\n/g,'\x0a');var _0x376791={'credentials':{'private_key':_0x127994,'client_email':_0x1cd8fc}};var _0x4e9665=new dialogflow[(_0x81dd('0x63'))](_0x376791);var _0x18ff0c=_0x4e9665['sessionPath'](_0x4512dc,md5(_0x225128));var _0x35d61d={'session':_0x18ff0c,'queryInput':{'text':{'text':_0x36a26e,'languageCode':_0x538a1e}}};return _0x4e9665[_0x81dd('0x64')](_0x35d61d)[_0x81dd('0x28')](function(_0x2a8ba5){if(_0x2a8ba5&&_0x2a8ba5['length']){logger[_0x81dd('0x19')](_0x81dd('0x65'),JSON[_0x81dd('0x41')](_0x2a8ba5));var _0xa765f2=_0x2a8ba5[0x0];if(_0xa765f2){var _0x2a8765={'action':_0xa765f2['queryResult'][_0x81dd('0x5a')],'allRequiredParamsPresent':_0xa765f2[_0x81dd('0x66')]['allRequiredParamsPresent'],'endConversation':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x67')]&&_0xa765f2[_0x81dd('0x66')][_0x81dd('0x67')][_0x81dd('0x68')]?_0xa765f2['queryResult'][_0x81dd('0x67')][_0x81dd('0x68')][_0x81dd('0x69')]['boolValue']:![],'fulfillmentText':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x6a')],'intentName':_0xa765f2[_0x81dd('0x66')]['intent'][_0x81dd('0x6b')],'intentDisplayName':_0xa765f2[_0x81dd('0x66')]['intent'][_0x81dd('0x6c')],'isFallbackIntent':_0xa765f2[_0x81dd('0x66')]['intent'][_0x81dd('0x6d')],'languageCode':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x6e')],'queryText':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x6f')],'responseId':_0xa765f2[_0x81dd('0x70')],'score':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x71')],'speech':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x6a')],'providerResponse':JSON['stringify'](_0x2a8ba5)};return _0x2a8765;}}});};exports['tildeASR']=function(_0x45c953,_0x32d01c,_0x4ff049,_0x51f53b){return tilde['asr'](_0x45c953,_0x32d01c,_0x4ff049,_0x51f53b)[_0x81dd('0x28')](function(_0x488d9a){try{fs[_0x81dd('0x1c')](_0x45c953);}catch(_0xd41826){logger[_0x81dd('0x13')](_0xd41826);}logger[_0x81dd('0x19')](_0x81dd('0x72'),_0x488d9a['transcript']);logger[_0x81dd('0x19')](_0x81dd('0x73'),_0x488d9a[_0x81dd('0x53')]);return _0x488d9a;});};exports[_0x81dd('0x74')]=function(_0x28b89a,_0x2a7765,_0x2271f1,_0x47d889,_0x5e9acc,_0x764f4e){var _0x5961d3=path['resolve'](__dirname,_0x81dd('0x36'),rs[_0x81dd('0x3c')](0x4)+_0x81dd('0x37'));var _0x2a0447;return aws[_0x81dd('0x75')](_0x28b89a,_0x2a7765,_0x2271f1,_0x47d889,_0x5e9acc,_0x764f4e,_0x5961d3)[_0x81dd('0x28')](function(){_0x2a0447=path['resolve'](__dirname,_0x81dd('0x36'),rs[_0x81dd('0x3c')](0x4)+_0x81dd('0x25'));return convertFile(_0x5961d3,_0x2a0447);})[_0x81dd('0x28')](function(){try{fs['unlink'](_0x5961d3);fs[_0x81dd('0x29')](_0x2a0447,_0x81dd('0x2a'));}catch(_0x479735){logger[_0x81dd('0x13')](_0x479735);}return _0x2a0447[_0x81dd('0x2b')]('.')[0x0];});};exports[_0x81dd('0x76')]=function(_0x2725b0,_0x19f4a7,_0x945cd,_0x486c17,_0x4ac1e8,_0x5d59ca){return aws[_0x81dd('0x77')](_0x2725b0,_0x19f4a7,_0x945cd,_0x486c17,_0x4ac1e8,_0x5d59ca)['then'](function(_0x38e923){logger[_0x81dd('0x19')](JSON[_0x81dd('0x41')](_0x38e923));return _0x38e923;});};exports[_0x81dd('0x78')]=function(_0x4bcb5f,_0x843784,_0x5ae2ab,_0x551f4a){var _0x33e366=util['format'](_0x81dd('0x79'),ISPEECH_API,_0x4bcb5f,encodeURIComponent(_0x843784),_0x5ae2ab,_0x551f4a);var _0x532134=path['resolve'](__dirname,_0x81dd('0x36'),rs['generate'](0x4)+_0x81dd('0x37'));var _0x18287a;return downloadFile(_0x33e366,_0x532134)['then'](function(){_0x18287a=path[_0x81dd('0x3b')](__dirname,_0x81dd('0x36'),rs['generate'](0x4)+_0x81dd('0x25'));return convertFile(_0x532134,_0x18287a);})['then'](function(){try{fs[_0x81dd('0x1c')](_0x532134);fs[_0x81dd('0x29')](_0x18287a,_0x81dd('0x2a'));}catch(_0x5766cd){logger[_0x81dd('0x13')](_0x5766cd);}return _0x18287a[_0x81dd('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x178eb0,_0x54ebd1,_0x1101ed,_0x2dc394){var _0x15bd46=util['format'](_0x81dd('0x7a'),ISPEECH_API,_0x54ebd1,_0x1101ed,base64Encode(_0x178eb0),_0x2dc394?util[_0x81dd('0x7b')](_0x81dd('0x7c'),encodeURIComponent(_0x2dc394)):_0x81dd('0x7d'));return uploadFile(_0x15bd46)[_0x81dd('0x28')](function(_0x491ae1){return querystring[_0x81dd('0x8')](_0x491ae1);});};exports[_0x81dd('0x7e')]=function(_0x50c7cb,_0x29b973){return sestek[_0x81dd('0x7f')](_0x50c7cb,_0x29b973)[_0x81dd('0x28')](function(_0x4b9a63){logger[_0x81dd('0x19')](JSON[_0x81dd('0x41')](_0x4b9a63));var _0x4b9cdc={'speech':_0x4b9a63[_0x81dd('0x80')],'action':_0x4b9a63[_0x81dd('0x81')]?_0x4b9a63[_0x81dd('0x81')]['CustomAction']:undefined,'actiondata':_0x4b9a63[_0x81dd('0x81')]?_0x4b9a63['channelData'][_0x81dd('0x82')]:undefined};if(_0x4b9a63[_0x81dd('0x81')]&&_0x4b9a63[_0x81dd('0x81')][_0x81dd('0x83')]){return base64Decode(_0x4b9a63[_0x81dd('0x81')][_0x81dd('0x83')][_0x81dd('0x84')],path['resolve'](__dirname,_0x81dd('0x36'),rs[_0x81dd('0x3c')](0x4)+_0x81dd('0x25')))[_0x81dd('0x28')](function(_0x4c57e6){_0x4b9cdc[_0x81dd('0x85')]=_0x4c57e6;return _0x4b9cdc;});}return _0x4b9cdc;});};exports[_0x81dd('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0xd69b=['voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','chmodSync','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','slice','lang\x20\x22','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','result','source','resolvedQuery','actionIncomplete','fulfillment','score','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','bluebird','dialogflow','path','querystring','request-promise','randomstring','google-tts-api','parse','util','./aws','./google','./sestek','./tilde','agi','protocol','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','pipe','end','host','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input'];(function(_0x1b814d,_0x4955c6){var _0x33458c=function(_0x1c4104){while(--_0x1c4104){_0x1b814d['push'](_0x1b814d['shift']());}};_0x33458c(++_0x4955c6);}(_0xd69b,0x156));var _0xbd69=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xd69b[_0xc8a931];return _0x28bd27;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xbd69('0x0'));var dialogflow=require(_0xbd69('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require('md5');var path=require(_0xbd69('0x2'));var querystring=require(_0xbd69('0x3'));var rp=require(_0xbd69('0x4'));var rs=require(_0xbd69('0x5'));var sox=require('sox');var tts=require(_0xbd69('0x6'));var urlParse=require('url')[_0xbd69('0x7')];var util=require(_0xbd69('0x8'));var aws=require(_0xbd69('0x9'));var google=require(_0xbd69('0xa'));var sestek=require(_0xbd69('0xb'));var tilde=require(_0xbd69('0xc'));var logger=require('../../../config/logger')(_0xbd69('0xd'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x5c9dc4,_0x21bcb9){return new BPromise(function(_0x414d35,_0x16c0ed){var _0x27e7a5=urlParse(_0x5c9dc4);var _0x593739=_0x27e7a5[_0xbd69('0xe')]==='https:'?https:http;var _0x25860a={'host':_0x27e7a5['host'],'path':_0x27e7a5[_0xbd69('0x2')],'headers':{'user-agent':_0xbd69('0xf')}};_0x593739[_0xbd69('0x10')](_0x25860a,function(_0x3e64a){if(_0x3e64a[_0xbd69('0x11')]!==0xc8){logger[_0xbd69('0x12')](_0xbd69('0x13')+_0x5c9dc4+'\x20failed,\x20status\x20code\x20=\x20'+_0x3e64a[_0xbd69('0x11')]+'\x20('+_0x3e64a[_0xbd69('0x14')]+')');_0x16c0ed(new Error(_0xbd69('0x13')+_0x5c9dc4+'\x20failed,\x20status\x20code\x20=\x20'+_0x3e64a[_0xbd69('0x11')]+'\x20('+_0x3e64a['statusMessage']+')'));return;}var _0x14eaf2=fs[_0xbd69('0x15')](_0x21bcb9);_0x14eaf2['on'](_0xbd69('0x16'),function(){logger[_0xbd69('0x17')](_0xbd69('0x18'));_0x14eaf2['close'](_0x414d35);});_0x14eaf2['on'](_0xbd69('0x12'),function(_0xed410a){fs[_0xbd69('0x19')](_0x21bcb9);logger[_0xbd69('0x12')]('download\x20error',_0xed410a);_0x16c0ed(_0xed410a);});_0x3e64a[_0xbd69('0x1a')](_0x14eaf2);})['on'](_0xbd69('0x12'),function(_0x2c5dfd){logger[_0xbd69('0x12')](_0x2c5dfd);_0x16c0ed(_0x2c5dfd);})[_0xbd69('0x1b')]();});}function uploadFile(_0x53eec4){return new BPromise(function(_0x5724a5,_0x3ea1de){var _0x7038d8=urlParse(_0x53eec4);var _0x313f55=_0x7038d8[_0xbd69('0xe')]==='https:'?https:http;var _0x2d66a7={'host':_0x7038d8[_0xbd69('0x1c')],'path':_0x7038d8['path'],'headers':{'user-agent':_0xbd69('0xf')}};_0x313f55[_0xbd69('0x10')](_0x2d66a7,function(_0x5e53ce){if(_0x5e53ce[_0xbd69('0x11')]!==0xc8){_0x3ea1de(new Error(_0xbd69('0x13')+_0x53eec4+_0xbd69('0x1d')+_0x5e53ce[_0xbd69('0x11')]+'\x20('+_0x5e53ce[_0xbd69('0x14')]+')'));return;}var _0x390d0a='';_0x5e53ce['on'](_0xbd69('0x1e'),function(_0x524bdb){_0x390d0a+=_0x524bdb;});_0x5e53ce['on'](_0xbd69('0x1b'),function(){_0x5724a5(_0x390d0a);});})['on'](_0xbd69('0x12'),function(_0x20761a){_0x3ea1de(_0x20761a);})[_0xbd69('0x1b')]();});}function convertFile(_0x25f550,_0x33624a){return new BPromise(function(_0x2258a3,_0x16e7b2){var _0x5bc6d6=sox[_0xbd69('0x1f')](_0x25f550,_0x33624a,{'sampleRate':0x1f40,'format':_0xbd69('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5bc6d6['on'](_0xbd69('0x12'),function(_0x4178ce){logger['error'](_0xbd69('0x21'),_0x4178ce);_0x16e7b2(_0x4178ce);});_0x5bc6d6['on'](_0xbd69('0x1b'),function(){logger[_0xbd69('0x17')](_0xbd69('0x22'));_0x2258a3();});_0x5bc6d6[_0xbd69('0x23')]();});}function base64Decode(_0x39e6e9,_0x244583){var _0x5f157b=path['resolve'](__dirname,_0xbd69('0x24'),rs[_0xbd69('0x25')](0x4)+_0xbd69('0x26'));fs[_0xbd69('0x27')](_0x5f157b,_0x39e6e9,_0xbd69('0x28'));return convertFile(_0x5f157b,_0x244583)[_0xbd69('0x29')](function(){try{fs[_0xbd69('0x19')](_0x5f157b);fs['chmodSync'](_0x244583,'777');}catch(_0x4fcd89){logger[_0xbd69('0x12')](_0x4fcd89);}return _0x244583[_0xbd69('0x2a')]('.')[0x0];});}function base64Encode(_0x633917){var _0x1267bb=fs['readFileSync'](_0x633917);return new Buffer(_0x1267bb)[_0xbd69('0x2b')](_0xbd69('0x28'));}exports[_0xbd69('0x2c')]=function(_0x5c2353,_0x25049b,_0x1aa10b,_0x579afe,_0x5b3cf7,_0x42189f){var _0x6429a2,_0x5237b7;var _0x1cf783=_0xbd69('0x2d');var _0x1db50a='?key='+_0x5c2353;var _0x4f0ede={};if(_0x25049b===_0xbd69('0x2e')){_0x4f0ede[_0xbd69('0x2f')]={'ssml':_0x1aa10b};}else{_0x4f0ede[_0xbd69('0x2f')]={'text':_0x1aa10b};};_0x4f0ede[_0xbd69('0x30')]={'languageCode':_0x579afe,'ssmlGender':_0x5b3cf7};_0x4f0ede[_0xbd69('0x31')]={'audioEncoding':_0xbd69('0x32'),'sampleRateHertz':0x1f40};var _0x4c3ed6={'url':_0x1cf783+_0xbd69('0x33')+_0x1db50a,'method':_0xbd69('0x34'),'json':!![],'body':_0x4f0ede};return rp(_0x4c3ed6)[_0xbd69('0x29')](function(_0x1fe1e4){return new BPromise(function(_0x4f67db,_0x2a8706){_0x6429a2=path[_0xbd69('0x35')](__dirname,'tmp',rs[_0xbd69('0x25')](0x4)+_0xbd69('0x36'));var _0x8dacaa=Buffer[_0xbd69('0x37')](_0x1fe1e4[_0xbd69('0x38')],_0xbd69('0x28'));return fs['writeFile'](_0x6429a2,_0x8dacaa,function(_0x196991){_0x2a8706(_0x196991);},function(_0x4d3b5a){fs[_0xbd69('0x39')](_0x6429a2,_0xbd69('0x3a'));_0x4f67db(_0x4d3b5a);});});})['then'](function(_0x35a1c9){_0x5237b7=path['resolve'](__dirname,_0xbd69('0x24'),rs[_0xbd69('0x25')](0x4)+_0xbd69('0x26'));return convertFile(_0x6429a2,_0x5237b7);})[_0xbd69('0x29')](function(){try{fs[_0xbd69('0x19')](_0x6429a2);fs[_0xbd69('0x39')](_0x5237b7,_0xbd69('0x3a'));}catch(_0x44a912){logger['error'](_0x44a912);}logger[_0xbd69('0x17')](_0xbd69('0x3b'),_0x5237b7[_0xbd69('0x2a')]('.')[0x0]);return _0x5237b7[_0xbd69('0x2a')]('.')[0x0];});};exports[_0xbd69('0x3c')]=function(_0x249789,_0x9a825){var _0x4a6833=_0xbd69('0x3d');var _0x4e329a,_0x19676a;var _0x515375;var _0x25da11={'encoding':_0xbd69('0x3e'),'method':_0xbd69('0x34'),'timeout':0x2710,'url':_0x4a6833,'headers':{'Content-Type':_0xbd69('0x3f')},'body':_0xbd69('0x40')+encodeURIComponent(JSON['stringify']([[[_0xbd69('0x41'),JSON[_0xbd69('0x42')]([_0x249789,_0x9a825||'en',![],_0xbd69('0x43')]),null,_0xbd69('0x44')]]]))};return rp(_0x25da11)['then'](function(_0x5a9e87){try{_0x515375=eval(_0x5a9e87[_0xbd69('0x45')](0x5))[0x0][0x2];}catch(_0x342c67){throw new Error('parse\x20response\x20failed:\x0a'+_0x5a9e87['data']);}if(!_0x515375){if(_0x249789['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xbd69('0x46')+_0x9a825+'\x22\x20might\x20not\x20exist');}}try{_0x515375=eval(_0x515375)[0x0];}catch(_0x446490){throw new Error(_0xbd69('0x47')+res['data']);}const _0x120fcb=_0x515375;_0x4e329a=path[_0xbd69('0x35')](__dirname,_0xbd69('0x24'),rs['generate'](0x4)+'.mp3');fs['writeFileSync'](_0x4e329a,_0x515375,{'encoding':_0xbd69('0x28')});_0x19676a=path[_0xbd69('0x35')](__dirname,'tmp',rs[_0xbd69('0x25')](0x4)+_0xbd69('0x26'));return convertFile(_0x4e329a,_0x19676a);})[_0xbd69('0x29')](function(){try{fs[_0xbd69('0x19')](_0x4e329a);fs['chmodSync'](_0x19676a,_0xbd69('0x3a'));}catch(_0x5820f1){logger[_0xbd69('0x12')](_0x5820f1);}logger[_0xbd69('0x17')](_0xbd69('0x48'),_0x19676a['split']('.')[0x0]);return _0x19676a[_0xbd69('0x2a')]('.')[0x0];});};exports[_0xbd69('0x49')]=function(_0x12ea00,_0x25b0eb,_0x1daede){return google[_0xbd69('0x4a')](_0x12ea00,_0x25b0eb,_0x1daede)[_0xbd69('0x29')](function(_0x4483ba){logger['info'](_0x4483ba[_0xbd69('0x4b')]);return rp(_0x4483ba);})[_0xbd69('0x29')](function(_0x471bb4){var _0x463092='';var _0xfd5497=0x0;try{fs[_0xbd69('0x19')](_0x12ea00);}catch(_0x4558d1){logger[_0xbd69('0x12')](_0x4558d1);}if(_0x471bb4&&_0x471bb4[_0xbd69('0x4c')]){_0x463092=_0x471bb4['results'][_0xbd69('0x4d')](function(_0x1963c4){return _0x1963c4&&_0x1963c4[_0xbd69('0x4e')][0x0]&&_0x1963c4['alternatives'][0x0][_0xbd69('0x4f')]?_0x1963c4['alternatives'][0x0][_0xbd69('0x4f')]:'';})[_0xbd69('0x50')]('\x0a');_0xfd5497=_0x471bb4['results']['map'](function(_0x1b29a1){return _0x1b29a1&&_0x1b29a1[_0xbd69('0x4e')][0x0]&&_0x1b29a1[_0xbd69('0x4e')][0x0][_0xbd69('0x51')]?_0x1b29a1['alternatives'][0x0]['confidence']:0x0;})[_0xbd69('0x50')]('\x0a');}logger['info'](_0xbd69('0x52'),_0x463092);logger[_0xbd69('0x17')](_0xbd69('0x53'),_0xfd5497);return{'transcript':_0x463092,'confidence':_0xfd5497};})[_0xbd69('0x54')](function(_0x39e1e4){logger['error'](_0xbd69('0x55'),_0x39e1e4[_0xbd69('0x11')],_0x39e1e4['name'],_0x39e1e4[_0xbd69('0x56')]);});};exports['googleDialogflow']=function(_0x278394,_0x522317,_0x2bf579,_0x4a36b2){var _0x43b519=apiai(_0x522317,{'language':_0x4a36b2||'en'});return _0x43b519['textRequest'](_0x2bf579,{'sessionId':md5(_0x278394)})[_0xbd69('0x29')](function(_0x3e5663){logger['info'](JSON['stringify'](_0x3e5663));return{'source':_0x3e5663[_0xbd69('0x57')][_0xbd69('0x58')],'resolvedQuery':_0x3e5663[_0xbd69('0x57')][_0xbd69('0x59')],'action':_0x3e5663[_0xbd69('0x57')]['action'],'actionIncomplete':_0x3e5663[_0xbd69('0x57')][_0xbd69('0x5a')],'speech':_0x3e5663[_0xbd69('0x57')][_0xbd69('0x5b')]['speech'],'score':_0x3e5663['result'][_0xbd69('0x5c')],'statusCode':_0x3e5663['status']['code'],'endConversation':_0x3e5663['result'][_0xbd69('0x5d')][_0xbd69('0x5e')]||![],'isFallbackIntent':_0x3e5663[_0xbd69('0x57')][_0xbd69('0x5d')][_0xbd69('0x5f')]};});};exports[_0xbd69('0x60')]=function(_0x56423a,_0x4598c2,_0x141a64,_0x58196c,_0x21c025,_0x14b4a4){var _0x376415=_0x58196c[_0xbd69('0x61')](/\\n/g,'\x0a');var _0x16629d={'credentials':{'private_key':_0x376415,'client_email':_0x141a64}};var _0x251500=new dialogflow['SessionsClient'](_0x16629d);var _0x11ff4a=_0x251500[_0xbd69('0x62')](_0x4598c2,md5(_0x56423a));var _0x1af632={'session':_0x11ff4a,'queryInput':{'text':{'text':_0x21c025,'languageCode':_0x14b4a4}}};return _0x251500[_0xbd69('0x63')](_0x1af632)['then'](function(_0x177b44){if(_0x177b44&&_0x177b44[_0xbd69('0x64')]){logger['info'](_0xbd69('0x65'),JSON[_0xbd69('0x42')](_0x177b44));var _0x41d9b8=_0x177b44[0x0];if(_0x41d9b8){var _0x4712bf={'action':_0x41d9b8[_0xbd69('0x66')]['action'],'allRequiredParamsPresent':_0x41d9b8[_0xbd69('0x66')][_0xbd69('0x67')],'endConversation':_0x41d9b8[_0xbd69('0x66')][_0xbd69('0x68')]&&_0x41d9b8[_0xbd69('0x66')][_0xbd69('0x68')]['fields']?_0x41d9b8['queryResult'][_0xbd69('0x68')]['fields'][_0xbd69('0x69')][_0xbd69('0x6a')]:![],'fulfillmentText':_0x41d9b8[_0xbd69('0x66')][_0xbd69('0x6b')],'intentName':_0x41d9b8[_0xbd69('0x66')][_0xbd69('0x6c')][_0xbd69('0x6d')],'intentDisplayName':_0x41d9b8['queryResult'][_0xbd69('0x6c')][_0xbd69('0x6e')],'isFallbackIntent':_0x41d9b8['queryResult'][_0xbd69('0x6c')][_0xbd69('0x6f')],'languageCode':_0x41d9b8[_0xbd69('0x66')][_0xbd69('0x70')],'queryText':_0x41d9b8[_0xbd69('0x66')]['queryText'],'responseId':_0x41d9b8[_0xbd69('0x71')],'score':_0x41d9b8[_0xbd69('0x66')]['intentDetectionConfidence'],'speech':_0x41d9b8[_0xbd69('0x66')][_0xbd69('0x6b')],'providerResponse':JSON[_0xbd69('0x42')](_0x177b44)};return _0x4712bf;}}});};exports[_0xbd69('0x72')]=function(_0x17831f,_0x79a107,_0x41e50f,_0x46bf31){return tilde['asr'](_0x17831f,_0x79a107,_0x41e50f,_0x46bf31)[_0xbd69('0x29')](function(_0x1ea920){try{fs[_0xbd69('0x19')](_0x17831f);}catch(_0x328f27){logger['error'](_0x328f27);}logger[_0xbd69('0x17')](_0xbd69('0x73'),_0x1ea920['transcript']);logger[_0xbd69('0x17')](_0xbd69('0x74'),_0x1ea920[_0xbd69('0x51')]);return _0x1ea920;});};exports[_0xbd69('0x75')]=function(_0x1c0efe,_0x2fd76d,_0x45a421,_0x147efc,_0x169a1f,_0x38f40f){var _0x4f6c0b=path[_0xbd69('0x35')](__dirname,_0xbd69('0x24'),rs[_0xbd69('0x25')](0x4)+_0xbd69('0x36'));var _0x1b6025;return aws[_0xbd69('0x76')](_0x1c0efe,_0x2fd76d,_0x45a421,_0x147efc,_0x169a1f,_0x38f40f,_0x4f6c0b)['then'](function(){_0x1b6025=path[_0xbd69('0x35')](__dirname,_0xbd69('0x24'),rs[_0xbd69('0x25')](0x4)+'.wav');return convertFile(_0x4f6c0b,_0x1b6025);})[_0xbd69('0x29')](function(){try{fs[_0xbd69('0x19')](_0x4f6c0b);fs['chmodSync'](_0x1b6025,_0xbd69('0x3a'));}catch(_0x25fc34){logger[_0xbd69('0x12')](_0x25fc34);}return _0x1b6025['split']('.')[0x0];});};exports[_0xbd69('0x77')]=function(_0x46eae8,_0x179095,_0x206da9,_0x5e41fd,_0x2ca95d,_0x243046){return aws['lex'](_0x46eae8,_0x179095,_0x206da9,_0x5e41fd,_0x2ca95d,_0x243046)['then'](function(_0x432f5d){logger[_0xbd69('0x17')](JSON[_0xbd69('0x42')](_0x432f5d));return _0x432f5d;});};exports['ispeechTTS']=function(_0x498482,_0x266f9f,_0x582438,_0x368e0c){var _0x36de18=util[_0xbd69('0x78')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x498482,encodeURIComponent(_0x266f9f),_0x582438,_0x368e0c);var _0x41bec3=path[_0xbd69('0x35')](__dirname,'tmp',rs[_0xbd69('0x25')](0x4)+_0xbd69('0x36'));var _0x3a806e;return downloadFile(_0x36de18,_0x41bec3)[_0xbd69('0x29')](function(){_0x3a806e=path[_0xbd69('0x35')](__dirname,_0xbd69('0x24'),rs['generate'](0x4)+_0xbd69('0x26'));return convertFile(_0x41bec3,_0x3a806e);})[_0xbd69('0x29')](function(){try{fs['unlink'](_0x41bec3);fs[_0xbd69('0x39')](_0x3a806e,_0xbd69('0x3a'));}catch(_0x155d3c){logger[_0xbd69('0x12')](_0x155d3c);}return _0x3a806e[_0xbd69('0x2a')]('.')[0x0];});};exports['ispeechASR']=function(_0x17743e,_0x49ef6b,_0xc4ba70,_0x508bda){var _0x55916c=util[_0xbd69('0x78')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x49ef6b,_0xc4ba70,base64Encode(_0x17743e),_0x508bda?util[_0xbd69('0x78')](_0xbd69('0x79'),encodeURIComponent(_0x508bda)):_0xbd69('0x7a'));return uploadFile(_0x55916c)[_0xbd69('0x29')](function(_0x138305){return querystring[_0xbd69('0x7')](_0x138305);});};exports['sestekNDA']=function(_0x1a3144,_0x269a7b){return sestek[_0xbd69('0x7b')](_0x1a3144,_0x269a7b)[_0xbd69('0x29')](function(_0xb87410){logger['info'](JSON[_0xbd69('0x42')](_0xb87410));var _0x558646={'speech':_0xb87410[_0xbd69('0x7c')],'action':_0xb87410[_0xbd69('0x7d')]?_0xb87410[_0xbd69('0x7d')][_0xbd69('0x7e')]:undefined,'actiondata':_0xb87410[_0xbd69('0x7d')]?_0xb87410[_0xbd69('0x7d')][_0xbd69('0x7f')]:undefined};if(_0xb87410[_0xbd69('0x7d')]&&_0xb87410[_0xbd69('0x7d')]['AudioFromTts']){return base64Decode(_0xb87410[_0xbd69('0x7d')][_0xbd69('0x80')][_0xbd69('0x81')],path[_0xbd69('0x35')](__dirname,_0xbd69('0x24'),rs[_0xbd69('0x25')](0x4)+_0xbd69('0x26')))[_0xbd69('0x29')](function(_0x40877b){_0x558646['audiofile']=_0x40877b;return _0x558646;});}return _0x558646;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index afde558..8f34e03 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6d2=['./nda','exports'];(function(_0x3cfaa3,_0x34f6c9){var _0x55a02c=function(_0x2606fd){while(--_0x2606fd){_0x3cfaa3['push'](_0x3cfaa3['shift']());}};_0x55a02c(++_0x34f6c9);}(_0xa6d2,0x1be));var _0x2a6d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa6d2[_0x502c7d];return _0x30b7ed;};var nda=require(_0x2a6d('0x0'));module[_0x2a6d('0x1')]={'nda':nda}; \ No newline at end of file +var nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index b1b05ee..e9f53b2 100644 --- a/server/services/agi/scripts/sestek/nda/index.js +++ b/server/services/agi/scripts/sestek/nda/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d53=['calleridname','dnid','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','channelData','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','exports','POST','resolve','ndauth_url','password','username','ndassistant_url','ndaactivity_type','message','uniqueid','callerid'];(function(_0x4ab2a8,_0xe36a6e){var _0x1537e2=function(_0x2fc2cb){while(--_0x2fc2cb){_0x4ab2a8['push'](_0x4ab2a8['shift']());}};_0x1537e2(++_0xe36a6e);}(_0x8d53,0x1c2));var _0x38d5=function(_0x56d20e,_0x217c31){_0x56d20e=_0x56d20e-0x0;var _0x18b27a=_0x8d53[_0x56d20e];return _0x18b27a;};'use strict';var rp=require(_0x38d5('0x0'));var url=require(_0x38d5('0x1'));var logger=require('../../../../../config/logger')(_0x38d5('0x2'));module[_0x38d5('0x3')]=function(_0x108137,_0x453bf8){var _0x3a7660={'method':_0x38d5('0x4'),'uri':url[_0x38d5('0x5')](_0x453bf8[_0x38d5('0x6')],'/token'),'form':{'grant_type':_0x38d5('0x7'),'username':_0x453bf8[_0x38d5('0x8')],'password':_0x453bf8[_0x38d5('0x7')]},'json':!![]};return rp(_0x3a7660)['then'](function(_0x5ebf9a){var _0x284f7b={'method':_0x38d5('0x4'),'uri':url[_0x38d5('0x5')](_0x453bf8[_0x38d5('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x453bf8[_0x38d5('0xa')]||_0x38d5('0xb'),'channelId':'Nda','conversation':{'id':_0x108137[_0x38d5('0xc')]},'from':{'id':_0x108137[_0x38d5('0xd')],'name':_0x108137[_0x38d5('0xe')]},'recipient':{'id':_0x108137[_0x38d5('0xf')],'name':_0x108137['extension']},'text':_0x453bf8['text'],'channelData':{}},'headers':{'Authorization':_0x38d5('0x10')+_0x5ebf9a[_0x38d5('0x11')]},'json':!![]};if(_0x453bf8['project']){_0x284f7b[_0x38d5('0x12')]['channelData'][_0x38d5('0x13')]=_0x453bf8[_0x38d5('0x14')];}if(_0x453bf8[_0x38d5('0x15')]=='1'){_0x284f7b[_0x38d5('0x12')][_0x38d5('0x16')][_0x38d5('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x453bf8[_0x38d5('0x18')]){_0x284f7b['body'][_0x38d5('0x16')]['CustomAction']=_0x453bf8[_0x38d5('0x18')];if(_0x453bf8[_0x38d5('0x19')]){_0x284f7b[_0x38d5('0x12')]['channelData'][_0x38d5('0x1a')]=_0x453bf8[_0x38d5('0x19')];}}logger[_0x38d5('0x1b')](JSON[_0x38d5('0x1c')](_0x284f7b));return rp(_0x284f7b);});}; \ No newline at end of file +var _0xc788=['ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','callerid','calleridname','extension','text','access_token','channelData','ProjectName','project'];(function(_0x4fb53d,_0x4786c8){var _0xf894bf=function(_0x93a291){while(--_0x93a291){_0x4fb53d['push'](_0x4fb53d['shift']());}};_0xf894bf(++_0x4786c8);}(_0xc788,0xc4));var _0x8c78=function(_0x39fe3f,_0x38b8eb){_0x39fe3f=_0x39fe3f-0x0;var _0x50d483=_0xc788[_0x39fe3f];return _0x50d483;};'use strict';var rp=require(_0x8c78('0x0'));var url=require(_0x8c78('0x1'));var logger=require(_0x8c78('0x2'))('agi');module['exports']=function(_0x1c7ff3,_0x1af8e2){var _0x23eec0={'method':_0x8c78('0x3'),'uri':url[_0x8c78('0x4')](_0x1af8e2['ndauth_url'],_0x8c78('0x5')),'form':{'grant_type':_0x8c78('0x6'),'username':_0x1af8e2[_0x8c78('0x7')],'password':_0x1af8e2[_0x8c78('0x6')]},'json':!![]};return rp(_0x23eec0)[_0x8c78('0x8')](function(_0x4d54a5){var _0x247188={'method':_0x8c78('0x3'),'uri':url[_0x8c78('0x4')](_0x1af8e2[_0x8c78('0x9')],_0x8c78('0xa')),'body':{'type':_0x1af8e2[_0x8c78('0xb')]||'message','channelId':_0x8c78('0xc'),'conversation':{'id':_0x1c7ff3['uniqueid']},'from':{'id':_0x1c7ff3[_0x8c78('0xd')],'name':_0x1c7ff3[_0x8c78('0xe')]},'recipient':{'id':_0x1c7ff3['dnid'],'name':_0x1c7ff3[_0x8c78('0xf')]},'text':_0x1af8e2[_0x8c78('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x4d54a5[_0x8c78('0x11')]},'json':!![]};if(_0x1af8e2['project']){_0x247188['body'][_0x8c78('0x12')][_0x8c78('0x13')]=_0x1af8e2[_0x8c78('0x14')];}if(_0x1af8e2[_0x8c78('0x15')]=='1'){_0x247188[_0x8c78('0x16')][_0x8c78('0x12')][_0x8c78('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8c78('0x18')};}if(_0x1af8e2[_0x8c78('0x19')]){_0x247188[_0x8c78('0x16')]['channelData'][_0x8c78('0x1a')]=_0x1af8e2[_0x8c78('0x19')];if(_0x1af8e2['custom_action_data']){_0x247188[_0x8c78('0x16')][_0x8c78('0x12')][_0x8c78('0x1b')]=_0x1af8e2[_0x8c78('0x1c')];}}logger[_0x8c78('0x1d')](JSON[_0x8c78('0x1e')](_0x247188));return rp(_0x247188);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 8806c62..2c058d7 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a35=['./lib/api'];(function(_0x41ab06,_0x1e4404){var _0x30c50c=function(_0x551783){while(--_0x551783){_0x41ab06['push'](_0x41ab06['shift']());}};_0x30c50c(++_0x1e4404);}(_0x2a35,0x1bd));var _0x52a3=function(_0x31c37d,_0x31a3c9){_0x31c37d=_0x31c37d-0x0;var _0x17ccc7=_0x2a35[_0x31c37d];return _0x17ccc7;};'use strict';var asr=require(_0x52a3('0x0'));module['exports']=function(_0x592441,_0x2f07d6,_0xc159fa,_0x39a87d){return asr(_0x592441,_0x2f07d6,_0xc159fa,_0x39a87d);}; \ No newline at end of file +var _0x8a9a=['exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8a9a[_0x550d12];return _0x12103d;};'use strict';var asr=require('./lib/api');module[_0xa8a9('0x0')]=function(_0xe8ec68,_0x3bd3c3,_0x1b7425,_0x3e6b18){return asr(_0xe8ec68,_0x3bd3c3,_0x1b7425,_0x3e6b18);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 6bcff84..b4a3374 100644 --- a/server/services/agi/scripts/tilde/asr/lib/api.js +++ b/server/services/agi/scripts/tilde/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe45d=['createReadStream','data','close','EOS','error','terminate','parse','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify'];(function(_0x3e03da,_0x38b42e){var _0x1e04f9=function(_0x443eb5){while(--_0x443eb5){_0x3e03da['push'](_0x3e03da['shift']());}};_0x1e04f9(++_0x38b42e);}(_0xe45d,0x19d));var _0xde45=function(_0x129821,_0xc3a286){_0x129821=_0x129821-0x0;var _0x40c393=_0xe45d[_0x129821];return _0x40c393;};'use strict';var BPromise=require(_0xde45('0x0'));var _=require(_0xde45('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0xde45('0x2'))(_0xde45('0x3'));module[_0xde45('0x4')]=function(_0x4dad72,_0x1d2350,_0x42c637,_0x2e520b){return new BPromise(function(_0x512f06,_0x331151){logger[_0xde45('0x5')](_0xde45('0x6'),_0x2e520b||_0xde45('0x7'));var _0x37a9c4=new WebSocket(_0x2e520b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x403e82='';var _0x6d5979='0';var _0x2b83e2='1';var _0x44c4f9='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x290e86(_0x155e38){var _0x359a67=crypto[_0xde45('0x8')]('sha1');_0x359a67[_0xde45('0x9')](_0x155e38);return _0x359a67[_0xde45('0xa')](_0xde45('0xb'));}function _0x1bba56(){try{logger[_0xde45('0x5')](_0xde45('0xc'));var _0x8f3684=moment()[_0xde45('0xd')]();var _0x188650=_0x290e86(_0x8f3684+_0x1d2350+_0x42c637);_0x37a9c4[_0xde45('0xe')](JSON[_0xde45('0xf')]({'appID':_0x1d2350,'timestamp':_0x8f3684,'appKey':_0x188650}));var _0x4727c9=fs[_0xde45('0x10')](_0x4dad72);_0x4727c9['on'](_0xde45('0x11'),function(_0x32dffe){_0x37a9c4[_0xde45('0xe')](_0x32dffe);});_0x4727c9['on'](_0xde45('0x12'),function(){_0x37a9c4[_0xde45('0xe')](_0xde45('0x13'));});}catch(_0x32a66c){logger[_0xde45('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0xde45('0xf')](_0x32a66c));_0x37a9c4[_0xde45('0x15')]();}}function _0x2fa0e7(_0x2a7de0){try{if(_0x2a7de0){var _0x48da75=JSON[_0xde45('0x16')](_0x2a7de0);switch(_0x48da75['status']){case 0x0:if(_0x48da75['result']){if(_0x48da75['result'][_0xde45('0x17')]){logger['info'](_0xde45('0x18'),JSON[_0xde45('0xf')](_0x48da75[_0xde45('0x19')][_0xde45('0x1a')]));_0x403e82=_0x48da75[_0xde45('0x19')][_0xde45('0x1a')][0x0]['transcript'];_0x6d5979=_0x48da75[_0xde45('0x19')][_0xde45('0x1a')][0x0][_0xde45('0x1b')];_0x2b83e2='0';_0x44c4f9=_0xde45('0x1c');_0x37a9c4[_0xde45('0x15')]();}}break;case 0x1:logger[_0xde45('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2b83e2='1';_0x44c4f9=_0xde45('0x1d');break;case 0x2:logger[_0xde45('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2b83e2='2';_0x44c4f9='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xde45('0x5')](_0xde45('0x1e'));_0x2b83e2='9';_0x44c4f9=_0xde45('0x1e');break;case 0xa:logger[_0xde45('0x5')](_0xde45('0x1f'));_0x2b83e2='10';_0x44c4f9=_0xde45('0x1f');break;case 0xb:logger[_0xde45('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x2b83e2='11';_0x44c4f9=_0xde45('0x20');}}}catch(_0x3d89e7){logger[_0xde45('0x14')](_0xde45('0x21'),JSON[_0xde45('0xf')](_0x3d89e7));_0x37a9c4['terminate']();}}function _0x502d78(){logger['info'](_0xde45('0x22'));_0x512f06({'transcript':_0x403e82,'confidence':_0x6d5979,'status':_0x2b83e2,'status_message':_0x44c4f9});}function _0x4bcd24(_0x1da783){logger[_0xde45('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xde45('0x23')](_0x1da783)){logger[_0xde45('0x14')](_[_0xde45('0x24')](_0x1da783)?JSON[_0xde45('0xf')](_0x1da783):_0x1da783);}}_0x37a9c4['on'](_0xde45('0x25'),_0x1bba56);_0x37a9c4['on'](_0xde45('0x26'),_0x2fa0e7);_0x37a9c4['on'](_0xde45('0x12'),_0x502d78);_0x37a9c4['on'](_0xde45('0x14'),_0x4bcd24);});}; \ No newline at end of file +var _0x0c16=['update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','terminate','parse','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0c16,0x101));var _0x60c1=function(_0x37928a,_0x46c7c7){_0x37928a=_0x37928a-0x0;var _0xbff5a9=_0x0c16[_0x37928a];return _0xbff5a9;};'use strict';var BPromise=require(_0x60c1('0x0'));var _=require(_0x60c1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x60c1('0x2'));var crypto=require('crypto');var logger=require(_0x60c1('0x3'))(_0x60c1('0x4'));module[_0x60c1('0x5')]=function(_0x1d459b,_0x4dd13d,_0x2618b8,_0x367127){return new BPromise(function(_0x56352b,_0x46e4a3){logger['info']('Tilde\x20URI',_0x367127||_0x60c1('0x6'));var _0x2deb12=new WebSocket(_0x367127||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5aabec='';var _0x491b39='0';var _0x5f3f36='1';var _0x4917dd=_0x60c1('0x7');function _0x1a74b7(_0x17eadd){var _0x11f81f=crypto['createHash'](_0x60c1('0x8'));_0x11f81f[_0x60c1('0x9')](_0x17eadd);return _0x11f81f['digest'](_0x60c1('0xa'));}function _0xc37134(){try{logger[_0x60c1('0xb')](_0x60c1('0xc'));var _0x378db1=moment()[_0x60c1('0xd')]();var _0x38997c=_0x1a74b7(_0x378db1+_0x4dd13d+_0x2618b8);_0x2deb12[_0x60c1('0xe')](JSON[_0x60c1('0xf')]({'appID':_0x4dd13d,'timestamp':_0x378db1,'appKey':_0x38997c}));var _0x322f92=fs[_0x60c1('0x10')](_0x1d459b);_0x322f92['on'](_0x60c1('0x11'),function(_0xc83d1){_0x2deb12[_0x60c1('0xe')](_0xc83d1);});_0x322f92['on'](_0x60c1('0x12'),function(){_0x2deb12[_0x60c1('0xe')](_0x60c1('0x13'));});}catch(_0x3a3237){logger[_0x60c1('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x60c1('0xf')](_0x3a3237));_0x2deb12[_0x60c1('0x15')]();}}function _0x5ec07c(_0x1e714a){try{if(_0x1e714a){var _0xfdbd10=JSON[_0x60c1('0x16')](_0x1e714a);switch(_0xfdbd10['status']){case 0x0:if(_0xfdbd10[_0x60c1('0x17')]){if(_0xfdbd10[_0x60c1('0x17')][_0x60c1('0x18')]){logger[_0x60c1('0xb')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0xfdbd10[_0x60c1('0x17')][_0x60c1('0x19')]));_0x5aabec=_0xfdbd10[_0x60c1('0x17')][_0x60c1('0x19')][0x0][_0x60c1('0x1a')];_0x491b39=_0xfdbd10['result'][_0x60c1('0x19')][0x0][_0x60c1('0x1b')];_0x5f3f36='0';_0x4917dd=_0x60c1('0x1c');_0x2deb12['terminate']();}}break;case 0x1:logger[_0x60c1('0xb')](_0x60c1('0x7'));_0x5f3f36='1';_0x4917dd='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x60c1('0xb')](_0x60c1('0x1d'));_0x5f3f36='2';_0x4917dd=_0x60c1('0x1d');break;case 0x9:logger[_0x60c1('0xb')](_0x60c1('0x1e'));_0x5f3f36='9';_0x4917dd=_0x60c1('0x1e');break;case 0xa:logger[_0x60c1('0xb')]('Authentication\x20failed.');_0x5f3f36='10';_0x4917dd=_0x60c1('0x1f');break;case 0xb:logger['info'](_0x60c1('0x20'));_0x5f3f36='11';_0x4917dd=_0x60c1('0x20');}}}catch(_0x40a002){logger[_0x60c1('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x40a002));_0x2deb12['terminate']();}}function _0x51bed2(){logger[_0x60c1('0xb')](_0x60c1('0x21'));_0x56352b({'transcript':_0x5aabec,'confidence':_0x491b39,'status':_0x5f3f36,'status_message':_0x4917dd});}function _0x26922b(_0x194ab9){logger[_0x60c1('0x14')](_0x60c1('0x22'));if(!_[_0x60c1('0x23')](_0x194ab9)){logger[_0x60c1('0x14')](_[_0x60c1('0x24')](_0x194ab9)?JSON[_0x60c1('0xf')](_0x194ab9):_0x194ab9);}}_0x2deb12['on'](_0x60c1('0x25'),_0xc37134);_0x2deb12['on']('message',_0x5ec07c);_0x2deb12['on'](_0x60c1('0x12'),_0x51bed2);_0x2deb12['on']('error',_0x26922b);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 697beb7..ab59c40 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba2d=['./asr'];(function(_0x5df61f,_0x482dc8){var _0x4caed9=function(_0x395e27){while(--_0x395e27){_0x5df61f['push'](_0x5df61f['shift']());}};_0x4caed9(++_0x482dc8);}(_0xba2d,0x11f));var _0xdba2=function(_0x18572f,_0x2a5a3a){_0x18572f=_0x18572f-0x0;var _0x6978fc=_0xba2d[_0x18572f];return _0x6978fc;};var asr=require(_0xdba2('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x95ee=['exports','./asr'];(function(_0x33f13b,_0x2f74b5){var _0x33293c=function(_0x3fe101){while(--_0x3fe101){_0x33f13b['push'](_0x33f13b['shift']());}};_0x33293c(++_0x2f74b5);}(_0x95ee,0x101));var _0xe95e=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x95ee[_0x4c12ec];return _0x3ae42c;};var asr=require(_0xe95e('0x0'));module[_0xe95e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 8efd92b..76ca655 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index f6e42ae..c588bff 100644 --- a/server/services/agi/vertices.js +++ b/server/services/agi/vertices.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x950a=['Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','out','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','response','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','extension','condition','true','false','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','subject','template_id','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20found','sms_text','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','set','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','rawHeaders','rawBody','getsecretdigits','channel','rpc','getVariableById','then','name','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','callerid','createSquareRecording','calleridname','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','number','includes','POST','PUT','toUpperCase','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clear','clone','isString','isPlainObject','isArray','length','recursiveNodeIndex','saveRestApiResult','hasOwnProperty','%s.%s','setVariable','replaceObjectAllVariables','replaceAllVariables','split','replaceAll','getVariable','getAndSetVariable','extra','maxRetry','sync','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x950a,0x111));var _0xa950=function(_0x417600,_0x2439fe){_0x417600=_0x417600-0x0;var _0x1b9bb3=_0x950a[_0x417600];return _0x1b9bb3;};'use strict';var fs=require('fs');var util=require(_0xa950('0x0'));var _=require(_0xa950('0x1'));var sh=require(_0xa950('0x2'));var odbc=require(_0xa950('0x3'))();var rs=require('randomstring');var moment=require(_0xa950('0x4'));var Mustache=require(_0xa950('0x5'));var rp=require(_0xa950('0x6'));var logger=require(_0xa950('0x7'))('agi');var config=require(_0xa950('0x8'));var scripts=require(_0xa950('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xa950('0xa'),_0xa950('0xb')];var verticesWithRetry=['menu','getdigits',_0xa950('0xc')];var AGIVertices=function(_0x12ef5a,_0x7d87b2,_0x2c77da){this[_0xa950('0xd')]=_0x12ef5a;this[_0xa950('0xe')]=_0x7d87b2;this['mailRpc']=_0x2c77da;};AGIVertices['prototype']['getVariable']=function(_0x2bccea,_0x48c1b5){this[_0xa950('0xe')][_0xa950('0xf')](_0x2bccea)[_0xa950('0x10')](function(_0x524c56){_0x48c1b5(null,_0x524c56?_0x524c56[_0xa950('0x11')]:![]);})['catch'](function(_0x10e64a){_0x48c1b5(_0x10e64a);});};AGIVertices[_0xa950('0x12')][_0xa950('0x13')]=function(_0x4c217c,_0xf1582){this[_0xa950('0xe')][_0xa950('0x14')](_0x4c217c)['then'](function(_0x24fb36){_0xf1582(null,_0x24fb36?_0x24fb36[_0xa950('0x11')]:![]);})[_0xa950('0x15')](function(_0x5d5f4c){_0xf1582(_0x5d5f4c);});};AGIVertices[_0xa950('0x12')][_0xa950('0x16')]=function(_0x1598a8,_0x4df9d1){this[_0xa950('0xe')][_0xa950('0x17')](_0x1598a8)[_0xa950('0x10')](function(_0x1021da){_0x4df9d1(null,_0x1021da?_0x1021da[_0xa950('0x11')]:![]);})[_0xa950('0x15')](function(_0x2b0e44){_0x4df9d1(_0x2b0e44);});};AGIVertices[_0xa950('0x12')][_0xa950('0x18')]=function(_0x18266c,_0x28fedf){this[_0xa950('0xe')][_0xa950('0x19')](_0x18266c)['then'](function(_0x3c7f18){_0x28fedf(null,_0x3c7f18?_0x3c7f18[_0xa950('0x1a')]:![]);})['catch'](function(_0x1f9894){_0x28fedf(_0x1f9894);});};AGIVertices[_0xa950('0x12')]['getUser']=function(_0x2e6f72,_0x5ad191){this[_0xa950('0xe')][_0xa950('0x1b')](_0x2e6f72)[_0xa950('0x10')](function(_0x36a16c){_0x5ad191(null,_0x36a16c?_0x36a16c['name']:![]);})[_0xa950('0x15')](function(_0x3f4633){_0x5ad191(_0x3f4633);});};AGIVertices[_0xa950('0x12')][_0xa950('0x1c')]=function(_0x292c73,_0x22e2c1){this[_0xa950('0xe')][_0xa950('0x1d')](_0x292c73)[_0xa950('0x10')](function(_0xc4894b){_0x22e2c1(null,_0xc4894b?_0xc4894b[_0xa950('0x11')]:![]);})[_0xa950('0x15')](function(_0x43f8c8){_0x22e2c1(_0x43f8c8);});};AGIVertices['prototype'][_0xa950('0x1e')]=function(_0x288934,_0x3f37f8){var _0x1aa96a=this;this[_0xa950('0xe')][_0xa950('0x1f')](_0x288934)[_0xa950('0x10')](function(_0x52e133){_0x3f37f8(null,_0x52e133?_0x1aa96a[_0xa950('0x20')](_0x52e133[_0xa950('0x21')]):![]);})['catch'](function(_0x44ee6e){_0x3f37f8(_0x44ee6e);});};AGIVertices[_0xa950('0x12')][_0xa950('0x22')]=function(_0x1875eb,_0x152f53){this[_0xa950('0xe')][_0xa950('0x23')](_0x1875eb)[_0xa950('0x10')](function(_0x203703){_0x152f53(null,_0x203703?_0x203703:![]);})[_0xa950('0x15')](function(_0x4de9f0){_0x152f53(_0x4de9f0);});};AGIVertices[_0xa950('0x12')]['sendMailMessage']=function(_0x565933,_0x26ee82,_0x5db455){this[_0xa950('0x24')][_0xa950('0x25')](_0x565933,_0x26ee82)[_0xa950('0x10')](function(){_0x5db455(null);})[_0xa950('0x15')](function(_0x55f3da){_0x5db455(_0x55f3da);});};AGIVertices[_0xa950('0x12')]['getIntervals']=function(_0x45846c,_0x2306f8){this['rpc']['getIntervalById'](_0x45846c)[_0xa950('0x10')](function(_0x1ccbed){if(_0x1ccbed){if(_0x1ccbed[_0xa950('0x26')]){_0x2306f8(null,[_0x1ccbed[_0xa950('0x27')]]);}else{_0x2306f8(null,_[_0xa950('0x28')](_0x1ccbed[_0xa950('0x29')],'interval'));}}else{_0x2306f8(null,![]);}})['catch'](function(_0x356258){_0x2306f8(_0x356258);});};AGIVertices['prototype'][_0xa950('0x20')]=function(_0x11a061){return util[_0xa950('0x2a')](_0xa950('0x2b'),FILES_PATH,_0x11a061);};AGIVertices[_0xa950('0x12')][_0xa950('0x2c')]=function(_0xd7f55d,_0x3cc798,_0x1ba2fd){odbc[_0xa950('0x2d')](_0xd7f55d,function(_0x55d7d9){if(_0x55d7d9){logger[_0xa950('0x2e')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x55d7d9);_0x1ba2fd(_0x55d7d9);}else{logger[_0xa950('0x2f')](_0xa950('0x30'));odbc['query'](_0x3cc798,function(_0x4c6588,_0x3d49f4){if(_0x4c6588){logger[_0xa950('0x2f')]('Error\x20executing\x20query\x20%s',_0x3cc798);_0x1ba2fd(_0x4c6588);}else{logger[_0xa950('0x2f')](_0xa950('0x31'),_0x3cc798);odbc['close'](function(_0x213a58){if(_0x213a58){logger[_0xa950('0x2e')](_0xa950('0x32'),_0x213a58);}_0x1ba2fd(null,_0x3d49f4);});}});}});};AGIVertices[_0xa950('0x12')][_0xa950('0x33')]=function(_0x35cfcc,_0x4253ce){this[_0xa950('0xe')]['getSmsAccountById'](_0x35cfcc)[_0xa950('0x10')](function(_0x1764b2){_0x4253ce(null,_0x1764b2?_0x1764b2:![]);})['catch'](function(_0x732bc1){_0x4253ce(_0x732bc1);});};AGIVertices[_0xa950('0x12')][_0xa950('0x34')]=function(_0x57205b,_0x25c9f3){this[_0xa950('0xe')][_0xa950('0x34')](_0x57205b)['then'](function(_0x545090){_0x25c9f3(null,_0x545090);})[_0xa950('0x15')](function(_0x75ff6c){_0x25c9f3(_0x75ff6c);});};AGIVertices[_0xa950('0x12')]['createSquareDetailsReport']=function(_0x49a235,_0x51f5a5,_0x41619f){this[_0xa950('0xe')][_0xa950('0x35')]({'uniqueid':this[_0xa950('0xd')][_0xa950('0x36')],'node':_0x49a235['label'],'application':_0x49a235[_0xa950('0x37')],'data':_0x51f5a5||null,'project_name':this[_0xa950('0xd')]['arg_1'],'callerid':this['channel'][_0xa950('0x38')]})[_0xa950('0x10')](function(_0x4f34b2){if(_0x41619f){_0x41619f(null,_0x4f34b2);}})['catch'](function(_0x5040c1){if(_0x41619f){_0x41619f(_0x5040c1);}});};AGIVertices['prototype'][_0xa950('0x39')]=function(_0x3cc04b,_0x5ae175,_0x5672c3,_0x286881){this['rpc'][_0xa950('0x39')]({'uniqueid':this[_0xa950('0xd')][_0xa950('0x36')],'callerid':this[_0xa950('0xd')][_0xa950('0x38')],'calleridname':this[_0xa950('0xd')][_0xa950('0x3a')],'context':this[_0xa950('0xd')]['context'],'extension':this[_0xa950('0xd')]['extension'],'priority':this[_0xa950('0xd')][_0xa950('0x3b')],'accountcode':this[_0xa950('0xd')][_0xa950('0x3c')],'dnid':this[_0xa950('0xd')][_0xa950('0x3d')],'projectName':this[_0xa950('0xd')][_0xa950('0x3e')],'saveName':_0x5ae175,'filename':_0x3cc04b[_0xa950('0x3f')]||_0x5ae175,'savePath':_0x5672c3})['then'](function(_0x3cf01c){_0x286881(null,_0x3cf01c);})[_0xa950('0x15')](function(_0x36ddb8){_0x286881(_0x36ddb8);});};AGIVertices[_0xa950('0x12')][_0xa950('0x40')]=function(_0x5a2b2f,_0x237152,_0xde68b2,_0x3f0bb5,_0x84a54){this[_0xa950('0xe')][_0xa950('0x40')]({'uniqueid':this[_0xa950('0xd')]['uniqueid'],'body':_0x5a2b2f,'direction':_0x237152,'providerName':_0xde68b2,'providerResponse':_0x3f0bb5})[_0xa950('0x10')](function(_0x13a66d){if(_0x84a54){_0x84a54(null,_0x13a66d);}})[_0xa950('0x15')](function(_0x4a163f){if(_0x84a54){_0x84a54(_0x4a163f);}});};AGIVertices['prototype'][_0xa950('0x41')]=function(_0x26216c,_0x38c370){this[_0xa950('0xe')][_0xa950('0x41')]({'firstName':_[_0xa950('0x42')](_0x26216c[_0xa950('0x11')])||_[_0xa950('0x43')](_0x26216c['name'])?_0xa950('0x44')+Math[_0xa950('0x45')]():_0x26216c[_0xa950('0x11')],'lastName':_[_0xa950('0x42')](_0x26216c[_0xa950('0x46')])||_['isNil'](_0x26216c[_0xa950('0x46')])?null:_0x26216c['lastName'],'phone':_0x26216c[_0xa950('0x47')],'ListId':_0x26216c[_0xa950('0x48')],'scheduledat':_0x26216c[_0xa950('0x49')],'callbackUniqueid':this[_0xa950('0xd')][_0xa950('0x36')],'tags':_0xa950('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x26216c['scheduledAt']['toString'](),'priority':_0x26216c[_0xa950('0x4b')]})[_0xa950('0x10')](function(_0x1303a9){_0x38c370(null,_0x1303a9);})[_0xa950('0x15')](function(_0x447459){_0x38c370(_0x447459);});};AGIVertices[_0xa950('0x12')][_0xa950('0x4c')]=function(_0x18700a,_0x5e16e7){this[_0xa950('0xe')]['getPauseById'](_0x18700a)[_0xa950('0x10')](function(_0x4e0fdc){_0x5e16e7(null,_0x4e0fdc?_0x4e0fdc[_0xa950('0x11')]:![]);})['catch'](function(_0x292de6){_0x5e16e7(_0x292de6);});};AGIVertices['prototype'][_0xa950('0x4d')]=function(_0x3e536e,_0x3ead91,_0x3d6e1b){var _0x46cfe4={'role':'agent'};_0x46cfe4[_0x3e536e]=this[_0xa950('0xd')][_0xa950('0x38')];this[_0xa950('0xe')][_0xa950('0x4d')](_0x46cfe4,_0x3ead91,this[_0xa950('0xd')]['uniqueid'])[_0xa950('0x10')](function(_0x117a56){_0x3d6e1b(null,_[_0xa950('0x43')](_0x117a56)?![]:!![]);})[_0xa950('0x15')](function(_0x35e7dc){logger['error'](_0x35e7dc);_0x3d6e1b(null,![]);});};AGIVertices[_0xa950('0x12')]['agentUnpause']=function(_0x5a32c1,_0x2eff92){var _0xcb3b8d={'role':_0xa950('0x4e')};_0xcb3b8d[_0x5a32c1]=this[_0xa950('0xd')]['callerid'];this['rpc'][_0xa950('0x4f')](_0xcb3b8d)[_0xa950('0x10')](function(_0x32ed18){_0x2eff92(null,_['isNil'](_0x32ed18)?![]:!![]);})[_0xa950('0x15')](function(_0x47697b){logger[_0xa950('0x2e')](_0x47697b);_0x2eff92(null,![]);});};AGIVertices[_0xa950('0x12')][_0xa950('0x50')]=function(_0x8972fb,_0x302500){var _0x3d10a8={'role':_0xa950('0x4e')};_0x3d10a8[_0x8972fb]=this['channel'][_0xa950('0x38')];this['rpc'][_0xa950('0x50')](_0x3d10a8)[_0xa950('0x10')](function(_0x285eaa){_0x302500(null,_[_0xa950('0x43')](_0x285eaa)?![]:!![]);})[_0xa950('0x15')](function(_0x2cca83){logger[_0xa950('0x2e')](_0x2cca83);_0x302500(null,![]);});};AGIVertices[_0xa950('0x12')][_0xa950('0x51')]=function(_0x2e6663,_0x120ea9){var _0x15301e={'role':_0xa950('0x4e')};_0x15301e[_0x2e6663]=this['channel']['callerid'];var _0x15e399=_0x2e6663!=_0xa950('0x52')?util[_0xa950('0x2a')](_0xa950('0x53'),_0xa950('0x54'),this[_0xa950('0xd')][_0xa950('0x38')]):undefined;this['rpc'][_0xa950('0x51')](_0x15301e,_0x15e399)[_0xa950('0x10')](function(_0x297be4){_0x120ea9(null,_[_0xa950('0x43')](_0x297be4)?![]:!![]);})[_0xa950('0x15')](function(_0x2cf13f){logger[_0xa950('0x2e')](_0x2cf13f);_0x120ea9(null,![]);});};AGIVertices[_0xa950('0x12')]['shellCommand']=function(_0x386a16,_0x3d4ed6){sh[_0xa950('0x55')](_[_0xa950('0x56')](_0x386a16),function(_0x3a0060,_0x5b79cf){var _0x2b7744=_0x5b79cf[_0xa950('0x57')](/(\r\n|\n|\r)/gm,'');_0x3d4ed6(null,_0x2b7744);});};AGIVertices[_0xa950('0x12')][_0xa950('0x58')]=function(_0x123bf6,_0x579378){scripts[_0xa950('0x58')](_0x123bf6[_0xa950('0x59')],_0x123bf6[_0xa950('0x5a')]||'text',_0x123bf6[_0xa950('0x5b')],_0x123bf6[_0xa950('0x5c')]||_0xa950('0x5d'),_0x123bf6[_0xa950('0x5e')]||'MALE',_0x123bf6[_0xa950('0x5f')]||_0xa950('0x60'))['then'](function(_0xda1471){_0x579378(null,_0xda1471);})[_0xa950('0x15')](function(_0x23a645){_0x579378(_0x23a645);});};AGIVertices[_0xa950('0x12')][_0xa950('0x61')]=function(_0x1215bb,_0x17b60c){scripts[_0xa950('0x61')](_0x1215bb[_0xa950('0x5b')],_0x1215bb[_0xa950('0x62')]||'en',0x1)[_0xa950('0x10')](function(_0x14fb0c){_0x17b60c(null,_0x14fb0c);})[_0xa950('0x15')](function(_0x59ef65){_0x17b60c(_0x59ef65);});};AGIVertices['prototype']['restAPI']=function(_0x5b88c9,_0xd6b04f){var _0x22066c={'uri':_0x5b88c9[_0xa950('0x63')],'method':_0x5b88c9['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5b88c9[_0xa950('0x64')])===_0xa950('0x65')&&parseInt(_0x5b88c9[_0xa950('0x64')])>=0x1?parseInt(_0x5b88c9[_0xa950('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xa950('0x66')]([_0xa950('0x67'),_0xa950('0x68')],_0x22066c['method'][_0xa950('0x69')]())){try{_0x22066c[_0xa950('0x6a')]=_0x5b88c9[_0xa950('0xb')]?JSON[_0xa950('0x6b')](_0x5b88c9[_0xa950('0xb')]):{};}catch(_0x14f3bb){logger[_0xa950('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x14f3bb);}}try{_0x22066c[_0xa950('0x6c')]=_0x5b88c9[_0xa950('0xa')]?JSON['parse'](_0x5b88c9[_0xa950('0xa')]):{};}catch(_0x15f4c3){logger[_0xa950('0x2e')](_0xa950('0x6d'),_0x15f4c3);}if(_0x5b88c9[_0xa950('0x6e')]){try{var _0x2cdfe8=require(_0x5b88c9[_0xa950('0x6e')])['sync'](this,_0x22066c);_0x22066c[_0xa950('0x6f')]=Mustache[_0xa950('0x70')](_0x5b88c9[_0xa950('0x63')],_0x2cdfe8,{},['$$','$$']);if(_0x22066c[_0xa950('0x6c')]){_0x22066c[_0xa950('0x6c')]=JSON[_0xa950('0x6b')](Mustache['render'](JSON[_0xa950('0x71')](_0x22066c[_0xa950('0x6c')]),_0x2cdfe8,{},['$$','$$']));}if(_0x22066c['body']){_0x22066c['body']=JSON['parse'](Mustache['render'](JSON[_0xa950('0x71')](_0x22066c[_0xa950('0x6a')]),_0x2cdfe8,{},['$$','$$']));}}catch(_0x4925f5){logger[_0xa950('0x2e')](_0xa950('0x72'),_0x4925f5);}}rp(_0x22066c)['then'](function(_0x2760ef){var _0x98722={'statusCode':_0x2760ef[_0xa950('0x73')]||0xc8,'statusMessage':_0x2760ef['statusMessage']||'OK','headers':_0x2760ef['headers']||{},'body':_0x2760ef[_0xa950('0x6a')]||{}};_0xd6b04f(null,_0x98722);})[_0xa950('0x15')](function(_0x3210e5){var _0xdddf1f={'statusCode':_0x3210e5[_0xa950('0x73')]||0x1f4,'statusMessage':_0x3210e5[_0xa950('0x74')]||_0xa950('0x75'),'headers':_0x3210e5[_0xa950('0x76')][_0xa950('0x6c')]||{},'body':_0x3210e5[_0xa950('0x76')][_0xa950('0x6a')]||{}};_0xd6b04f(null,_0xdddf1f);});};AGIVertices[_0xa950('0x12')]['googleDialogflow']=function(_0x40133e,_0x56822f){scripts[_0xa950('0x77')](this[_0xa950('0xd')]['uniqueid'],_0x40133e[_0xa950('0x78')],_0x40133e[_0xa950('0x5b')],_0x40133e['dialogflow_language']||'en')[_0xa950('0x10')](function(_0x1924c0){_0x56822f(null,_0x1924c0);})['catch'](function(_0x2b6fb0){_0x56822f(_0x2b6fb0);});};AGIVertices['prototype'][_0xa950('0x79')]=function(_0x459323,_0x5bef31){scripts[_0xa950('0x79')](this[_0xa950('0xd')][_0xa950('0x36')],_0x459323[_0xa950('0x7a')],_0x459323[_0xa950('0x7b')],_0x459323[_0xa950('0x7c')],_0x459323[_0xa950('0x5b')],_0x459323[_0xa950('0x7d')]||'en')['then'](function(_0x462803){_0x5bef31(null,_0x462803);})[_0xa950('0x15')](function(_0x3de108){_0x5bef31(_0x3de108);});};AGIVertices[_0xa950('0x12')][_0xa950('0x7e')]=function(_0x1fb819,_0x52b0ad){scripts[_0xa950('0x7e')](this[_0xa950('0xd')],_0x1fb819)['then'](function(_0x5e0d1f){_0x52b0ad(null,_0x5e0d1f);})[_0xa950('0x15')](function(_0x2bbd70){_0x52b0ad(_0x2bbd70);});};AGIVertices[_0xa950('0x12')][_0xa950('0x7f')]=function(_0x54cb84,_0x5e0732){scripts[_0xa950('0x7f')](_0x54cb84[_0xa950('0x78')],_0x54cb84[_0xa950('0x5b')],_0x54cb84[_0xa950('0x80')]||_0xa950('0x5d'),_0x54cb84[_0xa950('0x81')])[_0xa950('0x10')](function(_0x32cc2c){_0x5e0732(null,_0x32cc2c);})['catch'](function(_0x281eca){_0x5e0732(_0x281eca);});};AGIVertices[_0xa950('0x12')]['ispeechASR']=function(_0x18fe7a,_0x153953,_0x11f20b){scripts[_0xa950('0x82')](_0x153953,_0x18fe7a[_0xa950('0x78')],_0x18fe7a['ispeech_asr_language']||'en-US',this[_0xa950('0x83')](_0x18fe7a[_0xa950('0x84')])?_0x18fe7a['model']:undefined)[_0xa950('0x10')](function(_0x4fe3e3){_0x11f20b(null,_0x4fe3e3);})[_0xa950('0x15')](function(_0x2db6de){_0x11f20b(_0x2db6de);});};AGIVertices[_0xa950('0x12')]['awsPolly']=function(_0x5027e4,_0x13f325){scripts['awsPolly'](_0x5027e4[_0xa950('0x85')],_0x5027e4[_0xa950('0x86')],_0x5027e4[_0xa950('0x87')],_0x5027e4[_0xa950('0x88')]||'Amy',_0x5027e4[_0xa950('0x5b')],_0x5027e4['aws_text_type']||_0xa950('0x5b'))[_0xa950('0x10')](function(_0x4c0b9c){_0x13f325(null,_0x4c0b9c);})[_0xa950('0x15')](function(_0x5c5d80){_0x13f325(_0x5c5d80);});};AGIVertices[_0xa950('0x12')][_0xa950('0x89')]=function(_0x5839f7,_0x3afbfc){scripts[_0xa950('0x89')](this[_0xa950('0xd')][_0xa950('0x36')],_0x5839f7['aws_access_key_id'],_0x5839f7['aws_secret_access_key'],_0x5839f7[_0xa950('0x8a')],_0x5839f7[_0xa950('0x5b')],_0x5839f7[_0xa950('0x8b')])[_0xa950('0x10')](function(_0x26db07){_0x3afbfc(null,_0x26db07);})[_0xa950('0x15')](function(_0xdf4b31){_0x3afbfc(_0xdf4b31);});};AGIVertices[_0xa950('0x12')]['googleASR']=function(_0x487daa,_0x5e70e9,_0x4091f7){scripts[_0xa950('0x8c')](_0x5e70e9,_0x487daa[_0xa950('0x78')],_0x487daa['google_asr_language']||_0xa950('0x5d'))['then'](function(_0x1adfc8){_0x4091f7(null,_0x1adfc8);})[_0xa950('0x15')](function(_0x4b1ad5){_0x4091f7(_0x4b1ad5);});};AGIVertices[_0xa950('0x12')]['tildeASR']=function(_0x168840,_0x2c8e76,_0x3b746e){scripts[_0xa950('0x8d')](_0x2c8e76,_0x168840['appid'],_0x168840[_0xa950('0x8e')],_0x168840[_0xa950('0x6f')])['then'](function(_0x8f32eb){_0x3b746e(null,_0x8f32eb);})[_0xa950('0x15')](function(_0x27a22){_0x3b746e(_0x27a22);});};AGIVertices[_0xa950('0x12')][_0xa950('0x8f')]=function(_0x54166e){var _0x3b5afe=_[_0xa950('0x66')](verticesWithRetry,_0x54166e[_0xa950('0x37')])?_0x54166e:_[_0xa950('0x90')](_0x54166e);for(var _0x52b82d in _0x3b5afe){if(_0x3b5afe['hasOwnProperty'](_0x52b82d)){if(_0x3b5afe[_0x52b82d]&&_[_0xa950('0x91')](_0x3b5afe[_0x52b82d])){if(_['includes'](recursiveMapAttributes,_0x52b82d)){_0x3b5afe[_0x52b82d]=this['replaceObjectAllVariables'](_0x3b5afe[_0x52b82d]);}else{_0x3b5afe[_0x52b82d]=this['replaceAllVariables'](_0x3b5afe[_0x52b82d]);}}}}return _0x3b5afe;};AGIVertices[_0xa950('0x12')]['recursiveNodeIndex']=function(_0x2bf63d){for(var _0x399a54 in _0x2bf63d){if(_0x2bf63d['hasOwnProperty'](_0x399a54)){if(_[_0xa950('0x92')](_0x2bf63d[_0x399a54])){this['recursiveNodeIndex'](_0x2bf63d[_0x399a54]);}else if(_[_0xa950('0x93')](_0x2bf63d[_0x399a54])){for(var _0x2c1701=0x0;_0x2c1701<_0x2bf63d[_0x399a54][_0xa950('0x94')];_0x2c1701++){this[_0xa950('0x95')](_0x2bf63d[_0x399a54][_0x2c1701]);}}else if(_[_0xa950('0x91')](_0x2bf63d[_0x399a54])){_0x2bf63d[_0x399a54]=this['replaceAllVariables'](_0x2bf63d[_0x399a54]);}}}};AGIVertices[_0xa950('0x12')][_0xa950('0x96')]=function(_0x4ead40,_0x5a2f9d){for(var _0xec6116 in _0x4ead40){if(_0x4ead40[_0xa950('0x97')](_0xec6116)){if(_['isPlainObject'](_0x4ead40[_0xec6116])){if(!_['isEmpty'](_0x4ead40[_0xec6116])){this[_0xa950('0x96')](_0x4ead40[_0xec6116],util['format'](_0xa950('0x98'),_0x5a2f9d,_0xec6116));}}else if(_['isArray'](_0x4ead40[_0xec6116])){for(var _0x44ea18=0x0;_0x44ea18<_0x4ead40[_0xec6116][_0xa950('0x94')];_0x44ea18++){this[_0xa950('0x96')](_0x4ead40[_0xec6116][_0x44ea18],util[_0xa950('0x2a')](_0xa950('0x98'),_0x5a2f9d,_0xec6116+'['+_0x44ea18+']'));}}else{if(!_[_0xa950('0x43')](_0x4ead40[_0xec6116])){this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0x98'),_0x5a2f9d,_0xec6116),_0x4ead40[_0xec6116]);}}}}};AGIVertices[_0xa950('0x12')][_0xa950('0x9a')]=function(_0x457e05){try{var _0x424558=JSON[_0xa950('0x6b')](_0x457e05);this['recursiveNodeIndex'](_0x424558);return JSON[_0xa950('0x71')](_0x424558);}catch(_0x4fa226){return this['replaceAllVariables'](_0x457e05);}};AGIVertices[_0xa950('0x12')][_0xa950('0x9b')]=function(_0x16dd29){var _0x57d6c3=_0x16dd29[_0xa950('0x9c')]('{');for(var _0x2804c7=0x1;_0x2804c7<_0x57d6c3['length'];_0x2804c7+=0x1){var _0x1d8746=_0x57d6c3[_0x2804c7]['split']('}');if(_0x1d8746[_0xa950('0x94')]>0x1){_0x16dd29=_0x16dd29[_0xa950('0x9d')]('{'+_0x1d8746[0x0]+'}',this[_0xa950('0xd')][_0xa950('0x9e')](_0x1d8746[0x0])['extra']||_0x1d8746[0x0]);}}if(_0x57d6c3[_0xa950('0x94')]===0x1){return _0x16dd29['toString']();}return this['replaceAllVariables'](_0x16dd29);};AGIVertices[_0xa950('0x12')][_0xa950('0x9f')]=function(_0x4c03ea,_0x54af7a){var _0x545b45=this['channel'][_0xa950('0x9e')](_0x4c03ea);if(_0x545b45['result']===-0x1){return _0x545b45;}logger[_0xa950('0x2f')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x54af7a,_0x545b45[_0xa950('0xa0')]));return this['channel'][_0xa950('0x99')](_0x54af7a,_0x545b45[_0xa950('0xa0')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x83')]=function(_0x5a07bc){return _0x5a07bc&&_0x5a07bc!=='0'&&_0x5a07bc!=='-1'&&_0x5a07bc!=='';};AGIVertices[_0xa950('0x12')][_0xa950('0xa1')]=function(_0x540f41){this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x540f41,'-');_0x540f41[_0xa950('0xa3')]=_0x540f41[_0xa950('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa950('0x12')]['mrcpsynth']=function(_0xde9b99){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xa4'),_0xde9b99[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0xde9b99[_0xa950('0x5b')])){return this[_0xa950('0xd')]['noop'](_0xa950('0xa6'));}var _0x475266='\x22'+_0xde9b99[_0xa950('0x5b')]+'\x22';if(this[_0xa950('0x83')](_0xde9b99[_0xa950('0x76')])){_0x475266+=','+_0xde9b99[_0xa950('0x76')];}var _0x450843=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xa7'),_0x475266);if(_0x450843[_0xa950('0xa8')]===-0x1){return _0x450843;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xaa'),_0x475266));};AGIVertices['prototype'][_0xa950('0xab')]=function(_0x55cee6){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xac'),_0x55cee6['label']));if(!this['isConfigured'](_0x55cee6[_0xa950('0xad')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xae'));}var _0x529118=_0x55cee6[_0xa950('0xad')];if(this['isConfigured'](_0x55cee6['options'])){_0x529118+=','+_0x55cee6[_0xa950('0x76')];}var _0x5e2ae6=this[_0xa950('0xd')]['exec']('MRCPRecog',_0x529118);if(_0x5e2ae6['result']===-0x1){return _0x5e2ae6;}var _0x30a200=this[_0xa950('0x9f')](_0xa950('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x30a200[_0xa950('0xa8')]===-0x1){return _0x30a200;}var _0x524dcf=this[_0xa950('0x9f')](_0xa950('0xb0'),_0xa950('0xb1'));if(_0x524dcf[_0xa950('0xa8')]===-0x1){return _0x524dcf;}var _0x4e77e4=this[_0xa950('0x9f')](_0xa950('0xb2'),_0xa950('0xb3'));if(_0x4e77e4['result']===-0x1){return _0x4e77e4;}return this['channel']['noop'](util[_0xa950('0x2a')](_0xa950('0xb4'),_0x529118));};AGIVertices[_0xa950('0x12')][_0xa950('0xb5')]=function(_0x955cc2){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xb6'),_0x955cc2[_0xa950('0xa5')]));return this[_0xa950('0xd')]['agi']([_0x955cc2[_0xa950('0xb7')],_0x955cc2[_0xa950('0xb8')]]);};AGIVertices[_0xa950('0x12')][_0xa950('0xb9')]=function(_0x458e7b){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xba'),_0x458e7b[_0xa950('0xa5')]));if(this[_0xa950('0x83')](_0x458e7b[_0xa950('0x64')])){logger[_0xa950('0x2f')](util['format'](_0xa950('0xbb'),_0x458e7b['timeout']));var _0x5600d3=this[_0xa950('0xd')][_0xa950('0xbc')](_0x458e7b[_0xa950('0x64')]);if(_0x5600d3['result']===-0x1){return _0x5600d3;}}return this[_0xa950('0xd')][_0xa950('0xb9')]();};AGIVertices[_0xa950('0x12')][_0xa950('0x4a')]=function(_0x5b5eb6){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xbd'),_0x5b5eb6[_0xa950('0xa5')]));if(!this['isConfigured'](_0x5b5eb6['list_id'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x5b5eb6,_0xa950('0xbe'));}_0x5b5eb6[_0xa950('0x49')]=moment();if(this[_0xa950('0x83')](_0x5b5eb6[_0xa950('0xbf')])){_0x5b5eb6[_0xa950('0x49')]=moment()['add'](_0x5b5eb6[_0xa950('0xbf')],_0xa950('0xc0'));}if(!this[_0xa950('0x83')](_0x5b5eb6['callback_priority'])){_0x5b5eb6[_0xa950('0x4b')]=0x2;}this[_0xa950('0x41')]['sync'](this,_0x5b5eb6);return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc1'),_0x5b5eb6[_0xa950('0x47')],_0x5b5eb6[_0xa950('0x48')],_0x5b5eb6[_0xa950('0x49')]));};AGIVertices[_0xa950('0x12')][_0xa950('0xc2')]=function(_0x4232d7){logger[_0xa950('0x2f')](util['format'](_0xa950('0xc3'),_0x4232d7[_0xa950('0xa5')]));var _0x5b2375=this['channel'][_0xa950('0x55')](_0x4232d7['application'],_0x4232d7['options']);if(_0x5b2375[_0xa950('0xa8')]===-0x1){return _0x5b2375;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc4'),_0x4232d7['application'],_0x4232d7[_0xa950('0x76')]));};AGIVertices[_0xa950('0x12')][_0xa950('0xc5')]=function(_0x327581){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xc6'),_0x327581[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x327581[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}var _0x939bba='\x22'+_0x327581['text']+'\x22';if(this[_0xa950('0x83')](_0x327581[_0xa950('0x76')])){_0x939bba+=','+_0x327581[_0xa950('0x76')];}var _0x2f7b03=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xa7'),_0x939bba);if(_0x2f7b03['result']===-0x1){return _0x2f7b03;}return this[_0xa950('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x939bba));};AGIVertices[_0xa950('0x12')][_0xa950('0xc7')]=function(_0x3348b1){logger['info'](util[_0xa950('0x2a')](_0xa950('0xc8'),_0x3348b1['label']));if(!this[_0xa950('0x83')](_0x3348b1[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}var _0x20612c='\x22'+_0x3348b1['text']+'\x22';if(this[_0xa950('0x83')](_0x3348b1[_0xa950('0x76')])){_0x20612c+=','+_0x3348b1[_0xa950('0x76')];}var _0x3bf03b=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xa7'),_0x20612c);if(_0x3bf03b[_0xa950('0xa8')]===-0x1){return _0x3bf03b;}return this['channel'][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xaa'),_0x20612c));};AGIVertices[_0xa950('0x12')]['lumenvoxasr']=function(_0x49e653){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x49e653[_0xa950('0xa5')]));if(!this['isConfigured'](_0x49e653[_0xa950('0xad')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20grammar\x20configured');}var _0x42cbb6=_0x49e653[_0xa950('0xad')];if(this[_0xa950('0x83')](_0x49e653[_0xa950('0x76')])){_0x42cbb6+=','+_0x49e653[_0xa950('0x76')];}var _0x52409a=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xc9'),_0x42cbb6);if(_0x52409a[_0xa950('0xa8')]===-0x1){return _0x52409a;}var _0x276b1c=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xa950('0xca'));if(_0x276b1c[_0xa950('0xa8')]===-0x1){return _0x276b1c;}var _0xaf6083=this['getAndSetVariable'](_0xa950('0xb0'),_0xa950('0xcb'));if(_0xaf6083[_0xa950('0xa8')]===-0x1){return _0xaf6083;}var _0x1af0cb=this[_0xa950('0x9f')](_0xa950('0xb2'),_0xa950('0xcc'));if(_0x1af0cb[_0xa950('0xa8')]===-0x1){return _0x1af0cb;}return this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x42cbb6));};AGIVertices[_0xa950('0x12')][_0xa950('0xcd')]=function(_0x38f32e){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x38f32e[_0xa950('0xa5')]));if(!this['isConfigured'](_0x38f32e[_0xa950('0xad')])){return this['channel'][_0xa950('0xa9')]('no\x20grammar\x20configured');}var _0x5926ae=_0x38f32e[_0xa950('0xad')];if(this[_0xa950('0x83')](_0x38f32e['options'])){_0x5926ae+=','+_0x38f32e[_0xa950('0x76')];}var _0x3b34e6=this['channel'][_0xa950('0x55')](_0xa950('0xc9'),_0x5926ae);if(_0x3b34e6[_0xa950('0xa8')]===-0x1){return _0x3b34e6;}var _0x11a270=this[_0xa950('0x9f')]('RECOG_CONFIDENCE()',_0xa950('0xce'));if(_0x11a270[_0xa950('0xa8')]===-0x1){return _0x11a270;}var _0x3cd57b=this[_0xa950('0x9f')](_0xa950('0xb0'),_0xa950('0xcf'));if(_0x3cd57b[_0xa950('0xa8')]===-0x1){return _0x3cd57b;}var _0x2aab5f=this['getAndSetVariable'](_0xa950('0xb2'),_0xa950('0xd0'));if(_0x2aab5f[_0xa950('0xa8')]===-0x1){return _0x2aab5f;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xb4'),_0x5926ae));};AGIVertices[_0xa950('0x12')][_0xa950('0xd1')]=function(_0x2be65d){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xd2'),_0x2be65d['label']));if(!this[_0xa950('0x83')](_0x2be65d[_0xa950('0xd3')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2be65d,_0xa950('0xd4'));}var _0x1b0269=this[_0xa950('0x18')][_0xa950('0xa2')](this,_0x2be65d[_0xa950('0xd3')]);if(!_0x1b0269){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2be65d,'no\x20odbc\x20database\x20found');}if(!this[_0xa950('0x83')](_0x2be65d['query'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2be65d,'no\x20query\x20configured');}var _0x4edb28=_0x2be65d[_0xa950('0xd5')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xd6'),_0x4edb28));var _0x277cf8=this[_0xa950('0x2c')][_0xa950('0xa2')](this,_0x1b0269,_0x4edb28);this[_0xa950('0x35')]['sync'](this,_0x2be65d,_0x4edb28);if(!this[_0xa950('0x83')](_0x2be65d[_0xa950('0xd7')])){return this['channel'][_0xa950('0xa9')](_0xa950('0xd8'));}var _0x1ad303=this[_0xa950('0x9e')]['sync'](this,_0x2be65d['variable_id']);if(!_0x1ad303){return this[_0xa950('0xd')]['error'](_0x2be65d,_0xa950('0xd9'));}var _0x2a3ba0=this;_0x277cf8[_0xa950('0xda')](function(_0x1e845f,_0xcf25eb){Object['keys'](_0x1e845f)[_0xa950('0xda')](function(_0x22a08f){_0x2a3ba0['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xdb'),_0x1ad303,_0xcf25eb,_0x22a08f),_0x1e845f[_0x22a08f]);});});this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xdc'),_0x1ad303),_0x277cf8[_0xa950('0x94')]);return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xdd'),_0x1ad303));};AGIVertices[_0xa950('0x12')][_0xa950('0xde')]=function(_0x1b35f8){logger[_0xa950('0xdf')](util[_0xa950('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1b35f8[_0xa950('0xa5')]));if(!this['isConfigured'](_0x1b35f8[_0xa950('0xe0')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1b35f8,_0xa950('0xe1'));}var _0x2014ef=this[_0xa950('0xe2')]['sync'](this,_0x1b35f8[_0xa950('0xe0')]);if(!_0x2014ef){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1b35f8,_0xa950('0xe3'));}var _0x556b80=this[_0xa950('0xd')]['exec'](_0xa950('0xe4'),[util[_0xa950('0x2a')](_0xa950('0xe5'),_0x2014ef),_0x1b35f8['timeout'],_0x1b35f8[_0xa950('0xe6')],_0x1b35f8[_0xa950('0x63')]]);if(_0x556b80[_0xa950('0xa8')]===-0x1){return _0x556b80;}return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0xe7'),_0xa950('0xe4')));};AGIVertices[_0xa950('0x12')][_0xa950('0xe8')]=function(_0x91e6cb){logger[_0xa950('0x2f')](util['format'](_0xa950('0xe9'),_0x91e6cb[_0xa950('0xa5')]));if(!this['isConfigured'](_0x91e6cb['key'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xea'));}if(!this['isConfigured'](_0x91e6cb[_0xa950('0x5b')])){return this[_0xa950('0xd')]['noop'](_0xa950('0xa6'));}this['channel'][_0xa950('0xeb')]=!![];this[_0xa950('0x35')](_0x91e6cb);this['createSquareMessage'](_0x91e6cb[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xec'),_0x91e6cb[_0xa950('0x5b')]));var _0x1c6cd9=this[_0xa950('0x77')][_0xa950('0xa2')](this,_0x91e6cb);if(_0x1c6cd9){for(var _0x6a45e8 in _0x1c6cd9){if(_0x1c6cd9['hasOwnProperty'](_0x6a45e8)){this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xed'),_0x6a45e8[_0xa950('0x69')]()),_0x1c6cd9[_0x6a45e8]);}}this[_0xa950('0x40')](_0x1c6cd9[_0xa950('0xee')],'out','dialogflow','');return this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('Dialogflow\x20Result\x20%s',_0x1c6cd9[_0xa950('0xee')]));}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x91e6cb,_0xa950('0xef'));};AGIVertices[_0xa950('0x12')]['dialogflowV2']=function(_0x6b17a8){logger['info'](util['format'](_0xa950('0xf0'),_0x6b17a8[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x6b17a8['dialogflowV2_project_id'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xf1'));}if(!this[_0xa950('0x83')](_0x6b17a8['client_email'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xf2'));}if(!this[_0xa950('0x83')](_0x6b17a8[_0xa950('0x7c')])){return this[_0xa950('0xd')]['noop'](_0xa950('0xf3'));}if(!this[_0xa950('0x83')](_0x6b17a8[_0xa950('0x7d')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20anguage\x20configured');}if(!this[_0xa950('0x83')](_0x6b17a8['text'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xeb')]=!![];this['createSquareDetailsReport'](_0x6b17a8);this['createSquareMessage'](_0x6b17a8[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0xf4'),_0x6b17a8[_0xa950('0x5b')]));var _0x2a219e=this[_0xa950('0x79')][_0xa950('0xa2')](this,_0x6b17a8);if(_0x2a219e){for(var _0x497e47 in _0x2a219e){if(_0x2a219e[_0xa950('0x97')](_0x497e47)){if(_0x497e47!=='providerResponse'){this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xed'),_0x497e47[_0xa950('0x69')]()),_0x2a219e[_0x497e47]);}}}this[_0xa950('0x40')](_0x2a219e[_0xa950('0xee')],_0xa950('0xf5'),'dialogflowV2',_0x2a219e[_0xa950('0xf6')]);return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xf7'),_0x2a219e[_0xa950('0xee')]));}return this['channel']['error'](_0x6b17a8,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xa950('0x12')][_0xa950('0xf8')]=function(_0x2ac74f){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xf9'),_0x2ac74f['label']));if(!this['isConfigured'](_0x2ac74f['ndauth_url'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xfa'));}if(!this[_0xa950('0x83')](_0x2ac74f[_0xa950('0xfb')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20username\x20configured');}if(!this[_0xa950('0x83')](_0x2ac74f[_0xa950('0xfc')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x2ac74f[_0xa950('0xfd')])){return this['channel'][_0xa950('0xa9')](_0xa950('0xa6'));}this['channel'][_0xa950('0xeb')]=!![];this[_0xa950('0x35')](_0x2ac74f);this['createSquareMessage'](_0x2ac74f[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xfe'),_0x2ac74f['text']));var _0x5e8902=this[_0xa950('0x7e')][_0xa950('0xa2')](this,_0x2ac74f);if(_0x5e8902){for(var _0x1aef67 in _0x5e8902){if(_0x5e8902[_0xa950('0x97')](_0x1aef67)){this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')]('SESTEK_NDA_%s',_0x1aef67[_0xa950('0x69')]()),_0x5e8902[_0x1aef67]);}}this[_0xa950('0x40')](_0x5e8902[_0xa950('0xee')],'out','sesteknda','');if(_0x5e8902[_0xa950('0xff')]){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x100'),_0x5e8902['audiofile']));var _0x2a831d=this[_0xa950('0xd')][_0xa950('0x101')](_0x5e8902[_0xa950('0xff')]);try{fs['unlink'](_0x5e8902[_0xa950('0xff')]+_0xa950('0x102'));}catch(_0x55fe1e){logger[_0xa950('0x2e')](_0x55fe1e);}return _0x2a831d;}else{return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x103'),_0x5e8902[_0xa950('0xee')]));}}return this[_0xa950('0xd')]['error'](_0x2ac74f,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xa950('0x12')]['end']=function(_0x39e818){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x104'),_0x39e818[_0xa950('0xa5')]));return this[_0xa950('0xd')]['noop'](_0xa950('0x105'));};AGIVertices[_0xa950('0x12')][_0xa950('0x106')]=function(_0x41b90c){logger['info'](util[_0xa950('0x2a')](_0xa950('0x107'),_0x41b90c['label']));var _0x2718e5='';if(_0x41b90c[_0xa950('0x108')]){if(!this[_0xa950('0x83')](_0x41b90c[_0xa950('0x108')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x41b90c,_0xa950('0x109'));}else{var _0x1ff9e3=parseInt(_0x41b90c['trunk_id'],0xa);if(isNaN(_0x1ff9e3)){_0x2718e5=_0x41b90c[_0xa950('0x108')];}else{_0x2718e5=this[_0xa950('0x1c')][_0xa950('0xa2')](this,_0x41b90c[_0xa950('0x108')]);if(!_0x2718e5){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x41b90c,'no\x20trunk\x20found');}}}}else if(_0x41b90c[_0xa950('0x10a')]){_0x2718e5=_0x41b90c[_0xa950('0x10a')];}else{return this[_0xa950('0xd')]['error'](_0x41b90c,_0xa950('0x109'));}var _0x3a765b=this[_0xa950('0xd')][_0xa950('0x55')]('DIAL',[util[_0xa950('0x2a')]('SIP/%s/%s',_0x2718e5,_0x41b90c[_0xa950('0x47')]),_0x41b90c[_0xa950('0x64')],_0x41b90c[_0xa950('0xe6')],_0x41b90c[_0xa950('0x63')]]);if(_0x3a765b[_0xa950('0xa8')]===-0x1){return _0x3a765b;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('Executed\x20command\x20%s',_0xa950('0xe4')));};AGIVertices[_0xa950('0x12')][_0xa950('0x10b')]=function(_0x4e4edf){logger['info'](util[_0xa950('0x2a')](_0xa950('0x10c'),_0x4e4edf[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0xa9')]('finally');};AGIVertices[_0xa950('0x12')][_0xa950('0x10d')]=function(_0x16f8e8){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x10e'),_0x16f8e8[_0xa950('0xa5')]));if(_0x16f8e8['retry']===0x0){return this[_0xa950('0xa1')](_0x16f8e8);}_0x16f8e8['retry']-=0x1;if(!this['isConfigured'](_0x16f8e8['file_id'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x16f8e8,_0xa950('0x10f'));}var _0x1f149e=this[_0xa950('0x1e')]['sync'](this,_0x16f8e8[_0xa950('0x110')]);if(!_0x1f149e){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x16f8e8,_0xa950('0x111'));}if(!this['isConfigured'](_0x16f8e8['variable_id'])){return this[_0xa950('0xd')]['error'](_0xa950('0xd8'));}var _0x388cb7=this[_0xa950('0xd')]['getData'](_0x1f149e,_0x16f8e8[_0xa950('0x112')],_0x16f8e8[_0xa950('0x113')]);var _0x224209=_0x388cb7['result']?_0x388cb7[_0xa950('0xa8')][_0xa950('0x114')]():'';logger[_0xa950('0x2f')](_0xa950('0x115'),JSON[_0xa950('0x71')](_0x388cb7));if(_0x388cb7['result']===-0x1){this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x16f8e8,_0x224209);return _0x388cb7;}else if(_0x388cb7[_0xa950('0xa0')]===_0xa950('0x64')){_0x388cb7[_0xa950('0xa8')]=_0x224209[_0xa950('0x94')]>=parseInt(_0x16f8e8[_0xa950('0x116')])?'x':'i';}else{_0x388cb7[_0xa950('0xa8')]=_0x224209[_0xa950('0x94')]>=parseInt(_0x16f8e8[_0xa950('0x116')])&&_0x224209[_0xa950('0x94')]<=parseInt(_0x16f8e8[_0xa950('0x113')])?'x':'i';}var _0x227aa4=this['getVariable']['sync'](this,_0x16f8e8[_0xa950('0xd7')]);if(!_0x227aa4){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x16f8e8,_0xa950('0xd9'));}this[_0xa950('0xd')][_0xa950('0x99')](_0x227aa4,_0x224209);if(this[_0xa950('0x83')](_0x16f8e8[_0xa950('0x117')])){var _0x3d4b1d=parseInt(_0x16f8e8[_0xa950('0x117')],0xa);var _0x18013d=rs[_0xa950('0x118')]({'charset':'*','length':_0x3d4b1d});var _0x1b249b=_0x224209[_0xa950('0x94')];if(_0x1b249b>0x0){if(_0x1b249b>_0x3d4b1d){this['createSquareDetailsReport']['sync'](this,_0x16f8e8,_0x16f8e8['hiddendigitspos']===_0xa950('0x119')?_0x18013d+_0x224209['substr'](_0x3d4b1d):_0x224209[_0xa950('0x11a')](0x0,_0x1b249b-_0x3d4b1d)+_0x18013d);}else{this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x16f8e8,rs[_0xa950('0x118')]({'charset':'*','length':_0x1b249b}));}}else{this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x16f8e8,'');}}else{this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x16f8e8,_0x224209);}return _0x388cb7;};AGIVertices[_0xa950('0x12')][_0xa950('0xc')]=function(_0x164826){logger[_0xa950('0x2f')](util['format'](_0xa950('0x11b'),_0x164826[_0xa950('0xa5')]));return this[_0xa950('0x10d')](_0x164826);};AGIVertices[_0xa950('0x12')][_0xa950('0x11c')]=function(_0x4906a9){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x11d'),_0x4906a9['label']));this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x4906a9,_0x4906a9['goalname']);return this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x11e'),_0x4906a9[_0xa950('0x11f')]));};AGIVertices['prototype'][_0xa950('0x120')]=function(_0x2bd873){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x121'),_0x2bd873[_0xa950('0xa5')]));if(!this['isConfigured'](_0x2bd873[_0xa950('0x85')])||!this[_0xa950('0x83')](_0x2bd873[_0xa950('0x86')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x122'));}if(!this[_0xa950('0x83')](_0x2bd873['text'])){return this[_0xa950('0xd')]['noop']('no\x20text\x20configured');}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x123'),_0x2bd873[_0xa950('0x5b')]));var _0x1e48db=this['awsPolly'][_0xa950('0xa2')](this,_0x2bd873);if(_0x1e48db){this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x124'),_0x1e48db));var _0x44b70e=this['channel'][_0xa950('0x101')](_0x1e48db);try{fs[_0xa950('0x125')](_0x1e48db+_0xa950('0x102'));}catch(_0x2356a0){logger[_0xa950('0x2e')](_0x2356a0);}return _0x44b70e;}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2bd873,_0xa950('0x126'));};AGIVertices['prototype']['awslex']=function(_0x19c7a6){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x127'),_0x19c7a6[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x19c7a6[_0xa950('0x85')])||!this[_0xa950('0x83')](_0x19c7a6[_0xa950('0x86')])){return this[_0xa950('0xd')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xa950('0x83')](_0x19c7a6['aws_bot_name'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x128'));}if(!this[_0xa950('0x83')](_0x19c7a6['text'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xeb')]=!![];this[_0xa950('0x35')](_0x19c7a6);this[_0xa950('0x40')](_0x19c7a6[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x19c7a6[_0xa950('0x5b')]));var _0x4e0373=this[_0xa950('0x89')]['sync'](this,_0x19c7a6);if(_0x4e0373){for(var _0x48d853 in _0x4e0373){if(_0x4e0373['hasOwnProperty'](_0x48d853)&&_['isString'](_0x4e0373[_0x48d853])){this[_0xa950('0xd')]['setVariable'](util[_0xa950('0x2a')](_0xa950('0x129'),_0x48d853[_0xa950('0x69')]()),_0x4e0373[_0x48d853]);}}if(_[_0xa950('0x43')](_0x4e0373[_0xa950('0x74')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x12a'));}else{this[_0xa950('0x40')](_0x4e0373[_0xa950('0x74')],_0xa950('0xf5'),_0xa950('0x12b'),'');return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x12c'),_0x4e0373['message']));}}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x19c7a6,_0xa950('0x12d'));};AGIVertices['prototype'][_0xa950('0x12e')]=function(_0x5d3662){logger[_0xa950('0x2f')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5d3662[_0xa950('0xa5')],_0x5d3662[_0xa950('0x64')]));if(!this['isConfigured'](_0x5d3662[_0xa950('0x78')])){return this['channel'][_0xa950('0xa9')]('no\x20key\x20configured');}var _0x48a3c4=_0xa950('0x12f');var _0x151ccb=util[_0xa950('0x2a')](_0xa950('0x130'),FILES_PATH,rs[_0xa950('0x118')](0x4));var _0xc95f7e=util[_0xa950('0x2a')](_0xa950('0x98'),_0x151ccb,_0x48a3c4);var _0x2cf752=!![];if(_0x5d3662[_0xa950('0x131')]==='NOBEEP'){_0x2cf752=![];}var _0x57876f=this[_0xa950('0xd')][_0xa950('0x132')](_0x151ccb,_0x48a3c4,_0x5d3662[_0xa950('0x133')],_0x5d3662[_0xa950('0x64')],undefined,_0x2cf752);if(_0x57876f[_0xa950('0xa8')]!==-0x1){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x134'),_0xc95f7e));var _0x22819d=this[_0xa950('0x8c')][_0xa950('0xa2')](this,_0x5d3662,_0xc95f7e);if(_0x22819d){for(var _0x174082 in _0x22819d){if(_0x22819d[_0xa950('0x97')](_0x174082)){this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')]('GOOGLE_ASR_%s',_0x174082[_0xa950('0x69')]()),_0x22819d[_0x174082]);}}return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x135'),JSON['stringify'](_0x22819d)));}}return _0x57876f;};AGIVertices[_0xa950('0x12')]['tildeasr']=function(_0x4d016c){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x136'),_0x4d016c['label']));if(!this[_0xa950('0x83')](_0x4d016c[_0xa950('0x137')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x138'));}if(!this[_0xa950('0x83')](_0x4d016c[_0xa950('0x8e')])){return this['channel']['noop'](_0xa950('0x139'));}var _0x53347b=_0xa950('0x12f');var _0x157f90=util[_0xa950('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2df3c8=util[_0xa950('0x2a')](_0xa950('0x98'),_0x157f90,_0x53347b);var _0x4322a4=!![];if(_0x4d016c[_0xa950('0x131')]===_0xa950('0x13a')){_0x4322a4=![];}var _0x3ccf59=this['channel'][_0xa950('0x132')](_0x157f90,_0x53347b,_0x4d016c[_0xa950('0x133')],_0x4d016c[_0xa950('0x64')],undefined,_0x4322a4);if(_0x3ccf59['result']!==-0x1){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x13b'),_0x2df3c8));var _0x1f4aa3=this[_0xa950('0x8d')][_0xa950('0xa2')](this,_0x4d016c,_0x2df3c8);if(_0x1f4aa3){for(var _0x36a987 in _0x1f4aa3){if(_0x1f4aa3[_0xa950('0x97')](_0x36a987)){this[_0xa950('0xd')]['setVariable'](util[_0xa950('0x2a')]('TILDE_ASR_%s',_0x36a987[_0xa950('0x69')]()),_0x1f4aa3[_0x36a987]);}}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x13c'),JSON[_0xa950('0x71')](_0x1f4aa3)));}}return _0x3ccf59;};AGIVertices[_0xa950('0x12')][_0xa950('0x13d')]=function(_0x275f28){logger['info'](util[_0xa950('0x2a')](_0xa950('0x13e'),_0x275f28[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x13f')](_0x275f28[_0xa950('0x140')],_0x275f28[_0xa950('0x141')],_0x275f28[_0xa950('0x3b')]);};AGIVertices['prototype']['gotoif']=function(_0x4566d4){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4566d4[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x4566d4[_0xa950('0x142')])){return this[_0xa950('0xd')]['error'](_0x4566d4,'no\x20condition\x20configured');}try{var _0x14ce6b=eval(_0x4566d4['condition'])?_0xa950('0x143'):_0xa950('0x144');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4566d4[_0xa950('0x142')],_0x14ce6b));return{'code':0xc8,'result':_0x14ce6b};}catch(_0x4b7a2c){return{'code':0xc8,'result':_0xa950('0x144')};}};AGIVertices['prototype'][_0xa950('0x145')]=function(_0x18203b){logger[_0xa950('0x2f')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x18203b[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x18203b[_0xa950('0x146')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x18203b,_0xa950('0x147'));}var _0x240f85=this[_0xa950('0x148')][_0xa950('0xa2')](this,_0x18203b[_0xa950('0x146')]);if(!_0x240f85){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x18203b,_0xa950('0x149'));}for(var _0x4feeca=0x0;_0x4feeca<_0x240f85['length'];_0x4feeca+=0x1){var _0x4d2a33=this['channel'][_0xa950('0x9e')](util['format']('IFTIME(%s?true:false)',_0x240f85[_0x4feeca]));if(_0x4d2a33[_0xa950('0xa8')]===-0x1){return _0x4d2a33;}logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14a'),_0x240f85[_0x4feeca],_0x4d2a33['extra']));if(_0x4d2a33['extra']===_0xa950('0x143')){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14a'),_0x240f85[_0x4feeca],'true'));this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x14a'),_0x240f85[_0x4feeca],_0xa950('0x143')));return{'code':0xc8,'result':_0xa950('0x143')};}else{logger[_0xa950('0x2f')](util['format'](_0xa950('0x14a'),_0x240f85[_0x4feeca],_0xa950('0x144')));this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('IFTIME\x20%s\x20%s',_0x240f85[_0x4feeca],_0xa950('0x144')));}}return{'code':0xc8,'result':_0xa950('0x144')};};AGIVertices[_0xa950('0x12')][_0xa950('0x14b')]=function(_0x541098){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14c'),_0x541098[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x14b')]();};AGIVertices[_0xa950('0x12')][_0xa950('0x14d')]=function(_0x335494){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14e'),_0x335494[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x335494['key'])){return this[_0xa950('0xd')]['noop'](_0xa950('0xea'));}var _0xeb6aaf=_0xa950('0x12f');var _0x4ce1a7=util[_0xa950('0x2a')](_0xa950('0x130'),FILES_PATH,rs[_0xa950('0x118')](0x4));var _0x4f1cab=util[_0xa950('0x2a')](_0xa950('0x98'),_0x4ce1a7,_0xeb6aaf);var _0x3da5d5=!![];if(_0x335494[_0xa950('0x131')]==='NOBEEP'){_0x3da5d5=![];}var _0x47c82b=this['channel'][_0xa950('0x132')](_0x4ce1a7,_0xeb6aaf,_0x335494['intKey'],_0x335494[_0xa950('0x64')],undefined,_0x3da5d5);if(_0x47c82b[_0xa950('0xa8')]!==-0x1){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x14f'),_0x4f1cab));var _0x2c5307=this[_0xa950('0x82')][_0xa950('0xa2')](this,_0x335494,_0x4f1cab);if(_0x2c5307){for(var _0x81789a in _0x2c5307){if(_0x2c5307[_0xa950('0x97')](_0x81789a)){this[_0xa950('0xd')][_0xa950('0x99')](util['format'](_0xa950('0x150'),_0x81789a[_0xa950('0x69')]()),_0x2c5307[_0x81789a]);}}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x151'),JSON[_0xa950('0x71')](_0x2c5307)));}}return _0x47c82b;};AGIVertices[_0xa950('0x12')][_0xa950('0x152')]=function(_0x3287c7){logger[_0xa950('0x2f')](util['format'](_0xa950('0x153'),_0x3287c7[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x3287c7[_0xa950('0x78')])){return this['channel'][_0xa950('0xa9')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x3287c7[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x154'),_0x3287c7[_0xa950('0x5b')]));var _0xeec1de=this[_0xa950('0x7f')][_0xa950('0xa2')](this,_0x3287c7);if(_0xeec1de){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x14f'),_0xeec1de));var _0x3d5eaa=this['channel'][_0xa950('0x101')](_0xeec1de,_0x3287c7[_0xa950('0x133')]);try{fs[_0xa950('0x125')](_0xeec1de+_0xa950('0x102'));}catch(_0x1938ee){logger['error'](_0x1938ee);}return _0x3d5eaa;}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x3287c7,_0xa950('0x155'));};AGIVertices['prototype']['login']=function(_0x38785d){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x156'),_0x38785d[_0xa950('0xa5')]));if(!this['isConfigured'](_0x38785d['findBy'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x38785d,_0xa950('0x157'));}logger[_0xa950('0x2f')](util['format'](_0xa950('0x158'),this[_0xa950('0xd')][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));var _0x2a67cd=this['agentLogin'][_0xa950('0xa2')](this,_0x38785d['findBy']);if(_0x2a67cd){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15b')};}else{logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x15c'),this['channel'][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));this[_0xa950('0xd')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15d')};}};AGIVertices[_0xa950('0x12')][_0xa950('0x15e')]=function(_0x4b97bb){logger[_0xa950('0x2f')](util['format'](_0xa950('0x15f'),_0x4b97bb[_0xa950('0xa5')]));if(!this['isConfigured'](_0x4b97bb[_0xa950('0x159')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x4b97bb,_0xa950('0x157'));}logger['info'](util[_0xa950('0x2a')](_0xa950('0x158'),this['channel'][_0xa950('0x38')],_0x4b97bb[_0xa950('0x159')]));var _0x254458=this[_0xa950('0x50')][_0xa950('0xa2')](this,_0x4b97bb[_0xa950('0x159')]);if(_0x254458){logger['info'](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')]['callerid'],_0x4b97bb['findBy']));this['channel']['noop'](util['format'](_0xa950('0x15a'),this[_0xa950('0xd')]['callerid'],_0x4b97bb[_0xa950('0x159')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xa950('0x2a')](_0xa950('0x15c'),this[_0xa950('0xd')][_0xa950('0x38')],_0x4b97bb[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15c'),this['channel'][_0xa950('0x38')],_0x4b97bb[_0xa950('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xa950('0x160')]=function(_0x57f37e){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x161'),_0x57f37e[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x57f37e['operation'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x57f37e,_0xa950('0x162'));}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x163'),_0x57f37e[_0xa950('0x164')]));var _0x4918c9=eval(_0x57f37e['operation']);if(!this[_0xa950('0x83')](_0x57f37e['variable_id'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xd8'));}var _0x122912=this[_0xa950('0x9e')][_0xa950('0xa2')](this,_0x57f37e[_0xa950('0xd7')]);if(!_0x122912){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x57f37e,_0xa950('0xd9'));}if(_[_0xa950('0x93')](_0x4918c9)){var _0x2b8df0=this;_0x4918c9[_0xa950('0xda')](function(_0x1b1586,_0x54cf35){_0x2b8df0[_0xa950('0xd')]['setVariable'](util['format'](_0xa950('0x165'),_0x122912,_0x54cf35),_0x1b1586);});return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x166'),_0x122912));}else{return this[_0xa950('0xd')]['setVariable'](_0x122912,_0x4918c9);}};AGIVertices[_0xa950('0x12')][_0xa950('0x167')]=function(_0x74da7f){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x168'),_0x74da7f['label']));if(_0x74da7f[_0xa950('0xa3')]===0x0){return this[_0xa950('0xa1')](_0x74da7f);}_0x74da7f[_0xa950('0xa3')]-=0x1;if(!this[_0xa950('0x83')](_0x74da7f[_0xa950('0x110')])){return this['channel'][_0xa950('0x2e')](_0x74da7f,'no\x20file\x20audio\x20selected');}var _0x630382=this['getSound'][_0xa950('0xa2')](this,_0x74da7f[_0xa950('0x110')]);if(!_0x630382){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x74da7f,_0xa950('0x111'));}var _0x11f9ce=this[_0xa950('0xd')][_0xa950('0x169')](_0x630382,_0x74da7f[_0xa950('0x112')],_0x74da7f[_0xa950('0x16a')]);var _0x48d6bf=_0x11f9ce[_0xa950('0xa8')];if(_0x11f9ce[_0xa950('0xa8')]===-0x1){this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x74da7f,'-1');return _0x11f9ce;}else if(_0x11f9ce[_0xa950('0xa0')]===_0xa950('0x64')){_0x11f9ce['result']=_0x11f9ce[_0xa950('0xa8')][_0xa950('0x94')]>0x0?_0x11f9ce[_0xa950('0xa8')]:'t';}else if(_[_0xa950('0x42')](_0x11f9ce['result'])){_0x11f9ce['result']='#';_0x48d6bf='#';}if(!this[_0xa950('0x83')](_0x74da7f['variable_id'])){this[_0xa950('0xd')]['noop'](_0xa950('0xd8'));}else{var _0x21b6ad=this['getVariable']['sync'](this,_0x74da7f[_0xa950('0xd7')]);if(!_0x21b6ad){return this[_0xa950('0xd')]['error'](_0x74da7f,_0xa950('0xd9'));}this[_0xa950('0xd')][_0xa950('0x99')](_0x21b6ad,_0x48d6bf);}this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x74da7f,_0x48d6bf);return _0x11f9ce;};AGIVertices[_0xa950('0x12')]['noop']=function(_0x7ac442){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x16b'),_0x7ac442[_0xa950('0xa5')]));return this['channel'][_0xa950('0xa9')](_0x7ac442[_0xa950('0x16c')]||_0x7ac442[_0xa950('0xa5')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x16d')]=function(_0x519d96){logger[_0xa950('0x2f')](util['format'](_0xa950('0x16e'),_0x519d96[_0xa950('0xa5')]));if(!this['isConfigured'](_0x519d96[_0xa950('0x159')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x519d96,_0xa950('0x157'));}logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));var _0x125fb1=this[_0xa950('0x4c')][_0xa950('0xa2')](this,_0x519d96[_0xa950('0x16f')]);var _0x5d1a40=this[_0xa950('0x4d')][_0xa950('0xa2')](this,_0x519d96[_0xa950('0x159')],_0x125fb1);if(_0x5d1a40){logger['info'](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15b')};}else{logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));this['channel'][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this['channel'][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15d')};}};AGIVertices[_0xa950('0x12')][_0xa950('0x170')]=function(_0x46e29f){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x171'),_0x46e29f[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x46e29f[_0xa950('0x110')])){return this['channel'][_0xa950('0x2e')](_0x46e29f,_0xa950('0x10f'));}var _0x52260d=this['getSound'][_0xa950('0xa2')](this,_0x46e29f[_0xa950('0x110')]);if(!_0x52260d){return this[_0xa950('0xd')]['error'](_0x46e29f,_0xa950('0x111'));}var _0x188542=this[_0xa950('0xd')][_0xa950('0x55')]('PLAYBACK',[_0x52260d,_0x46e29f[_0xa950('0xe6')]]);if(_0x188542[_0xa950('0xa8')]===-0x1){return _0x188542;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc4'),'PLAYBACK',_0x52260d));};AGIVertices[_0xa950('0x12')][_0xa950('0x172')]=function(_0x50bbef){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x173'),_0x50bbef['label']));if(!this['isConfigured'](_0x50bbef['queue_id'])){return this[_0xa950('0xd')]['error'](_0x50bbef,'no\x20queue\x20selected');}var _0x56c3d5='';var _0x19b738=parseInt(_0x50bbef['queue_id'],0xa);if(isNaN(_0x19b738)){_0x56c3d5=_0x50bbef[_0xa950('0x174')];}else{_0x56c3d5=this[_0xa950('0x13')]['sync'](this,_0x50bbef[_0xa950('0x174')]);if(!_0x56c3d5){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x50bbef,_0xa950('0x175'));}}var _0x437554='';if(this[_0xa950('0x83')](_0x50bbef[_0xa950('0x110')])){var _0x1705c6=this['getSound'][_0xa950('0xa2')](this,_0x50bbef[_0xa950('0x110')]);if(_0x1705c6){_0x437554=_0x1705c6;}}this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x50bbef,_0x56c3d5);if(_0x50bbef[_0xa950('0xe6')]['indexOf']('x')<0x0){_0x50bbef[_0xa950('0xe6')]+='x';}if(_0x50bbef[_0xa950('0xe6')][_0xa950('0x176')]('X')<0x0){_0x50bbef[_0xa950('0xe6')]+='X';}this[_0xa950('0xd')]['setVariable'](_0xa950('0x177'),_0x56c3d5?_0x56c3d5[_0xa950('0x178')]():'');var _0x40c38f=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0x179'),[_0x56c3d5,_0x50bbef['opts'],_0x50bbef[_0xa950('0x63')],_0x437554,_0x50bbef['timeout'],_0x50bbef[_0xa950('0xb5')],_0x50bbef[_0xa950('0x17a')],_0x50bbef[_0xa950('0x17b')],'',_0x50bbef[_0xa950('0x17c')]]);if(_0x40c38f[_0xa950('0xa8')]===-0x1){return _0x40c38f;}return this['channel'][_0xa950('0xa9')](util['format'](_0xa950('0xc4'),_0xa950('0x179'),_0x56c3d5));};AGIVertices[_0xa950('0x12')][_0xa950('0x17d')]=function(_0x261d33){logger[_0xa950('0x2f')](util['format'](_0xa950('0x17e'),_0x261d33['label']));var _0x2cf67c=_0x261d33[_0xa950('0x17f')]||_0xa950('0x12f');var _0x55f3ad=util['format'](_0xa950('0x180'),this[_0xa950('0xd')][_0xa950('0x36')],rs[_0xa950('0x118')](0x5));var _0x5e8d50=util[_0xa950('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x55f3ad,_0x2cf67c);var _0x28818e=util[_0xa950('0x2a')]('%s/recordings/%s',FILES_PATH,_0x55f3ad);this[_0xa950('0x39')]['sync'](this,_0x261d33,_0x55f3ad,_0x5e8d50);this[_0xa950('0xd')][_0xa950('0x99')]('RECORDING_SAVENAME',_0x55f3ad);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x28818e,_0x2cf67c,_0x261d33['escape_digits'],_0x261d33[_0xa950('0x64')]);return this['channel'][_0xa950('0x132')](_0x28818e,_0x2cf67c,_0x261d33[_0xa950('0x181')],_0x261d33[_0xa950('0x64')],undefined,!![]);};AGIVertices['prototype'][_0xa950('0x182')]=function(_0x528888){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x183'),_0x528888[_0xa950('0xa5')]));if(!this['isConfigured'](_0x528888[_0xa950('0x63')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x184'));}var _0x14865d=this[_0xa950('0x185')][_0xa950('0xa2')](this,_0x528888);logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x186'),util[_0xa950('0x187')](_0x14865d,{'showHidden':![],'depth':null})));if(!this[_0xa950('0x83')](_0x528888[_0xa950('0xd7')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x188'));}var _0x1a2f1e=this[_0xa950('0x9e')][_0xa950('0xa2')](this,_0x528888[_0xa950('0xd7')]);if(!_0x1a2f1e){return this[_0xa950('0xd')]['error'](_0x528888,_0xa950('0xd9'));}this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0x189'),_0x1a2f1e),_0x14865d['statusCode']?_0x14865d['statusCode']:_0xa950('0x18a'));this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0x18b'),_0x1a2f1e),_0x14865d[_0xa950('0x18c')]?_0x14865d[_0xa950('0x18c')]:'OK');if(_0x14865d[_0xa950('0x6a')]){try{this['saveRestApiResult'](_0x14865d[_0xa950('0x6a')],_0x1a2f1e);}catch(_0x334d24){logger[_0xa950('0x2e')](util[_0xa950('0x2a')](_0xa950('0x18d'),_0x1a2f1e));}}return this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('variable\x20%s\x20set',_0x1a2f1e));};AGIVertices['prototype']['saydigits']=function(_0x52f7b0){logger[_0xa950('0x2f')](util['format'](_0xa950('0x18e'),_0x52f7b0[_0xa950('0xa5')]));return this[_0xa950('0xd')]['sayDigits'](_0x52f7b0['digits'][_0xa950('0x57')](/\s+/g,''),_0x52f7b0[_0xa950('0x181')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x18f')]=function(_0x3050c0){logger['info'](util[_0xa950('0x2a')](_0xa950('0x190'),_0x3050c0[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x191')](_0x3050c0[_0xa950('0x65')]['replace'](/\s+/g,''),_0x3050c0[_0xa950('0x181')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x192')]=function(_0x5dc882){logger['info'](util[_0xa950('0x2a')](_0xa950('0x193'),_0x5dc882[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x194')](_0x5dc882['text'],_0x5dc882[_0xa950('0x181')]);};AGIVertices[_0xa950('0x12')]['sendMail']=function(_0x14cefb){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x195'),_0x14cefb['label']));if(!this[_0xa950('0x83')](_0x14cefb[_0xa950('0x196')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x197'));}var _0x3bdc61=this[_0xa950('0x22')]['sync'](this,_0x14cefb['account_id']);if(!_0x3bdc61||!_0x3bdc61[_0xa950('0x198')]){return this[_0xa950('0xd')]['error'](_0x14cefb,'no\x20mail\x20account\x20found');}var _0x24f031={'from':util[_0xa950('0x2a')](_0xa950('0x199'),_0x3bdc61[_0xa950('0x11')],_0x3bdc61[_0xa950('0x19a')]||_0x3bdc61[_0xa950('0x198')][_0xa950('0x19b')]),'to':_0x14cefb['to']||'','cc':_0x14cefb['cc']||'','bcc':_0x14cefb['bcc']||'','subject':_0x14cefb[_0xa950('0x19c')],'html':_0x14cefb[_0xa950('0x5b')],'text':_0x14cefb[_0xa950('0x5b')]};if(this['isConfigured'](_0x14cefb[_0xa950('0x19d')])){}logger[_0xa950('0xdf')](_0xa950('0x19e'),JSON[_0xa950('0x71')](_0x24f031));this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x14cefb,_0x14cefb[_0xa950('0x196')]);this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x3bdc61[_0xa950('0x11')]));this[_0xa950('0x25')][_0xa950('0xa2')](this,_0x3bdc61['smtpOptions'],_0x24f031);return this['channel'][_0xa950('0xa9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa950('0x12')][_0xa950('0x19f')]=function(_0x5a7fa9){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1a0'),_0x5a7fa9['label']));return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1a1'));};AGIVertices[_0xa950('0x12')]['sendSMS']=function(_0x1a1909){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1a2'),_0x1a1909[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x1a1909['sms_account_id'])){return this[_0xa950('0xd')]['noop']('no\x20sms\x20account\x20configured');}var _0x653f3b=this[_0xa950('0x33')][_0xa950('0xa2')](this,_0x1a1909['sms_account_id']);if(!_0x653f3b){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1a1909,_0xa950('0x1a3'));}var _0x494532={'body':_0x1a1909[_0xa950('0x1a4')],'phone':_0x1a1909['to']||'','SmsAccountId':_0x653f3b['id']};logger[_0xa950('0xdf')]('sendSMS\x20message',JSON[_0xa950('0x71')](_0x494532));this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x1a1909,_0x1a1909[_0xa950('0x1a5')]);this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1a6'),_0x653f3b['name']));this[_0xa950('0x34')][_0xa950('0xa2')](this,_0x494532);return this[_0xa950('0xd')][_0xa950('0xa9')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa950('0x12')][_0xa950('0x1a7')]=function(_0x1a72e5){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1a72e5['label']));if(!this[_0xa950('0x83')](_0x1a72e5[_0xa950('0xd7')])){return this[_0xa950('0xd')]['error'](_0x1a72e5,'no\x20variable\x20selected');}var _0x2b52bf=this[_0xa950('0x9e')][_0xa950('0xa2')](this,_0x1a72e5['variable_id']);if(!_0x2b52bf){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1a72e5,_0xa950('0xd9'));}return this['channel']['setVariable'](_0x2b52bf,_0x1a72e5[_0xa950('0x1a8')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x1a9')]=function(_0x4b0b90){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1aa'),_0x4b0b90['label']));this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1ab'));var _0x5161bd=this[_0xa950('0xd')][_0xa950('0x9e')]('XMCS-UNIQUEID');if(!_['isEmpty'](_0x5161bd[_0xa950('0xa0')])){this[_0xa950('0xd')][_0xa950('0x36')]=_0x5161bd[_0xa950('0xa0')];}if(_0x4b0b90[_0xa950('0xb9')]===_0xa950('0x1ac')){this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1ad'));return this['channel'][_0xa950('0xb9')]();}return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1ae'));};AGIVertices[_0xa950('0x12')][_0xa950('0x1af')]=function(_0x2e3868){logger['info'](util['format'](_0xa950('0x1b0'),_0x2e3868[_0xa950('0xa5')]));if(!this['isConfigured'](_0x2e3868[_0xa950('0x1b1')])){return this[_0xa950('0xd')]['error'](_0x2e3868,_0xa950('0x1b2'));}var _0x844d71=this['getSquareProject']['sync'](this,_0x2e3868['project_id']);if(!this[_0xa950('0x83')](_0x844d71)){return this['channel'][_0xa950('0x2e')](_0x2e3868,util['format'](_0xa950('0x1b3'),_0x2e3868[_0xa950('0x1b1')]));}if(_0x844d71===this[_0xa950('0xd')][_0xa950('0x3e')]){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2e3868,_0xa950('0x1b4'));}this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x2e3868,_0x844d71);var _0x412e04=this['channel'][_0xa950('0x55')]('AGI',util[_0xa950('0x2a')](_0xa950('0x1b5'),config[_0xa950('0xb5')][_0xa950('0x1b6')]||'127.0.0.1',_0x844d71,this['channel'][_0xa950('0x3e')]));if(_0x412e04[_0xa950('0xa8')]===-0x1){return _0x412e04;}return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')]('Executed\x20command\x20%s\x20%s',_0xa950('0x1b7'),_0x844d71));};AGIVertices[_0xa950('0x12')][_0xa950('0x1b8')]=function(_0x1f65be){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1b9'),_0x1f65be[_0xa950('0xa5')]));var _0x20f540=this['shellCommand'][_0xa950('0xa2')](this,_0x1f65be['command']);this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x1f65be,_0x1f65be[_0xa950('0xb7')]);if(this[_0xa950('0x83')](_0x1f65be[_0xa950('0xd7')])){var _0x568c83=this['getVariable'][_0xa950('0xa2')](this,_0x1f65be[_0xa950('0xd7')]);if(_0x568c83){this[_0xa950('0xd')][_0xa950('0x99')](_0x568c83,_0x20f540);return this['channel'][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1ba'),_0x1f65be['command'],_0x568c83));}}return this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x1bb'),_0x1f65be[_0xa950('0xb7')]));};AGIVertices[_0xa950('0x12')]['google_cloud_tts']=function(_0x2b0cac){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1bc'),_0x2b0cac[_0xa950('0xa5')]));_0x2b0cac[_0xa950('0x5b')]=_0x2b0cac[_0xa950('0x5b')][_0xa950('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa950('0x83')](_0x2b0cac[_0xa950('0x59')])){return this[_0xa950('0xd')]['noop'](_0xa950('0x1bd'));}if(!this[_0xa950('0x83')](_0x2b0cac['text'])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20text\x20configured');}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1be'),_0x2b0cac[_0xa950('0x5b')]));var _0x2ec3b0=this['googleCloudTTS'][_0xa950('0xa2')](this,_0x2b0cac);if(_0x2ec3b0){this[_0xa950('0xd')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2ec3b0));var _0x34886b=this[_0xa950('0xd')]['streamFile'](_0x2ec3b0);try{fs[_0xa950('0x125')](_0x2ec3b0+_0xa950('0x102'));}catch(_0x42ad6f){logger[_0xa950('0x2e')](_0x42ad6f);}return _0x34886b;}return this['channel']['error'](_0x2b0cac,_0xa950('0x1bf'));};AGIVertices[_0xa950('0x12')][_0xa950('0x1c0')]=function(_0x4dbffd){logger['info'](util[_0xa950('0x2a')](_0xa950('0x1c1'),_0x4dbffd[_0xa950('0xa5')]));_0x4dbffd[_0xa950('0x5b')]=_0x4dbffd[_0xa950('0x5b')][_0xa950('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa950('0x83')](_0x4dbffd[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1c2'),_0x4dbffd['text']));var _0x31a58e=this[_0xa950('0x61')][_0xa950('0xa2')](this,_0x4dbffd);if(_0x31a58e){this['channel'][_0xa950('0xa9')](util['format'](_0xa950('0x1c3'),_0x31a58e));var _0x37505c=this[_0xa950('0xd')][_0xa950('0x101')](_0x31a58e);try{fs[_0xa950('0x125')](_0x31a58e+_0xa950('0x102'));}catch(_0x583e66){logger[_0xa950('0x2e')](_0x583e66);}return _0x37505c;}return this['channel'][_0xa950('0x2e')](_0x4dbffd,_0xa950('0x1c4'));};AGIVertices[_0xa950('0x12')][_0xa950('0x1c5')]=function(_0x1eb94e){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1c6'),_0x1eb94e[_0xa950('0xa5')]));if(!this['isConfigured'](_0x1eb94e['findBy'])){return this['channel'][_0xa950('0x2e')](_0x1eb94e,_0xa950('0x157'));}logger[_0xa950('0x2f')](util['format'](_0xa950('0x158'),this[_0xa950('0xd')]['callerid'],_0x1eb94e[_0xa950('0x159')]));var _0x42b76e=this['agentUnpause'][_0xa950('0xa2')](this,_0x1eb94e[_0xa950('0x159')]);if(_0x42b76e){logger[_0xa950('0x2f')](util['format'](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x1eb94e[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x1eb94e['findBy']));return{'code':0xc8,'result':_0xa950('0x15b')};}else{logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x15c'),this['channel']['callerid'],_0x1eb94e[_0xa950('0x159')]));this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x15c'),this[_0xa950('0xd')][_0xa950('0x38')],_0x1eb94e[_0xa950('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa950('0x12')]['voicemail']=function(_0x18f68a){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1c7'),_0x18f68a[_0xa950('0xa5')]));var _0x551740=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0x1c8'),[_0x18f68a[_0xa950('0x1c9')],_0x18f68a['options']]);if(_0x551740[_0xa950('0xa8')]===-0x1){return _0x551740;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc4'),_0xa950('0x1c8'),_0x18f68a[_0xa950('0x1c9')]));};AGIVertices[_0xa950('0x12')][_0xa950('0x1ca')]=function(_0x3b4065){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1cb'),_0x3b4065[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x3b4065[_0xa950('0xd7')])){return this[_0xa950('0xd')]['error'](_0x3b4065,'no\x20variable\x20selected');}var _0x2746e1=this['getVariable']['sync'](this,_0x3b4065[_0xa950('0xd7')]);if(!_0x2746e1){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x3b4065,_0xa950('0xd9'));}var _0x13ed62=this[_0xa950('0xd')][_0xa950('0x9e')](_0x2746e1);return{'code':0xc8,'result':_0x13ed62[_0xa950('0xa0')]?_0x13ed62[_0xa950('0xa0')]:'-'};};String[_0xa950('0x12')][_0xa950('0x9d')]=function(_0x3d02b8,_0x542c32){return this['split'](_0x3d02b8)[_0xa950('0x1cc')](_0x542c32);};module[_0xa950('0x1cd')]=AGIVertices; \ No newline at end of file +var _0x6c7b=['application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','SIP/%s','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','false','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeechASR','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','Smtp','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','randomstring','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariableById','then','name','prototype','getVoiceQueue','getVoiceQueueById','getSquareProjectById','catch','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundById','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','hasOwnProperty','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block'];(function(_0x1fd3e2,_0x1a6772){var _0x5a9210=function(_0x37e9c3){while(--_0x37e9c3){_0x1fd3e2['push'](_0x1fd3e2['shift']());}};_0x5a9210(++_0x1a6772);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x1dd80b,_0x23ff40){_0x1dd80b=_0x1dd80b-0x0;var _0x3b3457=_0x6c7b[_0x1dd80b];return _0x3b3457;};'use strict';var fs=require('fs');var util=require(_0xb6c7('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0xb6c7('0x1'));var moment=require('moment');var Mustache=require(_0xb6c7('0x2'));var rp=require(_0xb6c7('0x3'));var logger=require(_0xb6c7('0x4'))('agi');var config=require(_0xb6c7('0x5'));var scripts=require(_0xb6c7('0x6'));var FILES_PATH=_0xb6c7('0x7');var recursiveMapAttributes=[_0xb6c7('0x8'),_0xb6c7('0x9')];var verticesWithRetry=['menu',_0xb6c7('0xa'),_0xb6c7('0xb')];var AGIVertices=function(_0xe2ce08,_0x9c88ae,_0x577c54){this[_0xb6c7('0xc')]=_0xe2ce08;this[_0xb6c7('0xd')]=_0x9c88ae;this[_0xb6c7('0xe')]=_0x577c54;};AGIVertices['prototype']['getVariable']=function(_0xf676c,_0x11a1ee){this[_0xb6c7('0xd')][_0xb6c7('0xf')](_0xf676c)[_0xb6c7('0x10')](function(_0x30fc73){_0x11a1ee(null,_0x30fc73?_0x30fc73[_0xb6c7('0x11')]:![]);})['catch'](function(_0x9b32b7){_0x11a1ee(_0x9b32b7);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x13')]=function(_0xd6fb50,_0x4086a1){this[_0xb6c7('0xd')][_0xb6c7('0x14')](_0xd6fb50)['then'](function(_0x3c7ff4){_0x4086a1(null,_0x3c7ff4?_0x3c7ff4['name']:![]);})['catch'](function(_0x5d5428){_0x4086a1(_0x5d5428);});};AGIVertices[_0xb6c7('0x12')]['getSquareProject']=function(_0x45f1a3,_0x1a2bc9){this[_0xb6c7('0xd')][_0xb6c7('0x15')](_0x45f1a3)[_0xb6c7('0x10')](function(_0x200833){_0x1a2bc9(null,_0x200833?_0x200833[_0xb6c7('0x11')]:![]);})[_0xb6c7('0x16')](function(_0x1a591f){_0x1a2bc9(_0x1a591f);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x17')]=function(_0x3f133f,_0x3beafa){this['rpc'][_0xb6c7('0x18')](_0x3f133f)[_0xb6c7('0x10')](function(_0x599b49){_0x3beafa(null,_0x599b49?_0x599b49[_0xb6c7('0x19')]:![]);})['catch'](function(_0x37f7cb){_0x3beafa(_0x37f7cb);});};AGIVertices['prototype'][_0xb6c7('0x1a')]=function(_0x4f2960,_0x24c0b3){this[_0xb6c7('0xd')]['getUserById'](_0x4f2960)[_0xb6c7('0x10')](function(_0x3ff28f){_0x24c0b3(null,_0x3ff28f?_0x3ff28f[_0xb6c7('0x11')]:![]);})[_0xb6c7('0x16')](function(_0xd33675){_0x24c0b3(_0xd33675);});};AGIVertices[_0xb6c7('0x12')]['getTrunk']=function(_0x4109c3,_0x1f4e06){this[_0xb6c7('0xd')][_0xb6c7('0x1b')](_0x4109c3)['then'](function(_0x1eb265){_0x1f4e06(null,_0x1eb265?_0x1eb265[_0xb6c7('0x11')]:![]);})['catch'](function(_0x1eee74){_0x1f4e06(_0x1eee74);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x1c')]=function(_0x32cd6b,_0x4fb79f){var _0x30eeb4=this;this['rpc'][_0xb6c7('0x1d')](_0x32cd6b)[_0xb6c7('0x10')](function(_0x232f7f){_0x4fb79f(null,_0x232f7f?_0x30eeb4['getSoundPath'](_0x232f7f['save_name']):![]);})['catch'](function(_0x438dc3){_0x4fb79f(_0x438dc3);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x1e')]=function(_0x457df0,_0x41e46c){this[_0xb6c7('0xd')][_0xb6c7('0x1f')](_0x457df0)[_0xb6c7('0x10')](function(_0x1f82bd){_0x41e46c(null,_0x1f82bd?_0x1f82bd:![]);})[_0xb6c7('0x16')](function(_0x5dabdd){_0x41e46c(_0x5dabdd);});};AGIVertices[_0xb6c7('0x12')]['sendMailMessage']=function(_0x216ee7,_0x6cd749,_0x4e9e90){this[_0xb6c7('0xe')][_0xb6c7('0x20')](_0x216ee7,_0x6cd749)['then'](function(){_0x4e9e90(null);})['catch'](function(_0x536e4d){_0x4e9e90(_0x536e4d);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x21')]=function(_0x597650,_0x1f8a0c){this[_0xb6c7('0xd')]['getIntervalById'](_0x597650)[_0xb6c7('0x10')](function(_0x40b06d){if(_0x40b06d){if(_0x40b06d[_0xb6c7('0x22')]){_0x1f8a0c(null,[_0x40b06d[_0xb6c7('0x23')]]);}else{_0x1f8a0c(null,_[_0xb6c7('0x24')](_0x40b06d[_0xb6c7('0x25')],'interval'));}}else{_0x1f8a0c(null,![]);}})[_0xb6c7('0x16')](function(_0x1c032a){_0x1f8a0c(_0x1c032a);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x26')]=function(_0x2b0093){return util[_0xb6c7('0x27')](_0xb6c7('0x28'),FILES_PATH,_0x2b0093);};AGIVertices['prototype']['getQueryOdbc']=function(_0x3bae95,_0x2c59e1,_0x33afa6){odbc[_0xb6c7('0x29')](_0x3bae95,function(_0x291460){if(_0x291460){logger[_0xb6c7('0x2a')](_0xb6c7('0x2b'),_0x291460);_0x33afa6(_0x291460);}else{logger[_0xb6c7('0x2c')](_0xb6c7('0x2d'));odbc[_0xb6c7('0x2e')](_0x2c59e1,function(_0x4995e2,_0x63b747){if(_0x4995e2){logger['info']('Error\x20executing\x20query\x20%s',_0x2c59e1);_0x33afa6(_0x4995e2);}else{logger[_0xb6c7('0x2c')]('Query\x20executed\x20correctly\x20%s',_0x2c59e1);odbc[_0xb6c7('0x2f')](function(_0x2479c){if(_0x2479c){logger['error'](_0xb6c7('0x30'),_0x2479c);}_0x33afa6(null,_0x63b747);});}});}});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x31')]=function(_0x84861f,_0x3c3374){this['rpc']['getSmsAccountById'](_0x84861f)[_0xb6c7('0x10')](function(_0xb575){_0x3c3374(null,_0xb575?_0xb575:![]);})[_0xb6c7('0x16')](function(_0x184af6){_0x3c3374(_0x184af6);});};AGIVertices['prototype']['createSmsMessage']=function(_0xb699ce,_0x4019c){this[_0xb6c7('0xd')][_0xb6c7('0x32')](_0xb699ce)[_0xb6c7('0x10')](function(_0x4eb2c7){_0x4019c(null,_0x4eb2c7);})['catch'](function(_0x5c057c){_0x4019c(_0x5c057c);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x33')]=function(_0x4462dc,_0x5050c9,_0x1c2983){this[_0xb6c7('0xd')]['createSquareDetailsReport']({'uniqueid':this[_0xb6c7('0xc')][_0xb6c7('0x34')],'node':_0x4462dc[_0xb6c7('0x35')],'application':_0x4462dc[_0xb6c7('0x36')],'data':_0x5050c9||null,'project_name':this[_0xb6c7('0xc')]['arg_1'],'callerid':this[_0xb6c7('0xc')][_0xb6c7('0x37')]})[_0xb6c7('0x10')](function(_0x5ca74a){if(_0x1c2983){_0x1c2983(null,_0x5ca74a);}})['catch'](function(_0x1565b5){if(_0x1c2983){_0x1c2983(_0x1565b5);}});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x38')]=function(_0x505b60,_0x4f243a,_0x5f047d,_0x14c64f){this[_0xb6c7('0xd')][_0xb6c7('0x38')]({'uniqueid':this[_0xb6c7('0xc')][_0xb6c7('0x34')],'callerid':this[_0xb6c7('0xc')][_0xb6c7('0x37')],'calleridname':this['channel'][_0xb6c7('0x39')],'context':this[_0xb6c7('0xc')][_0xb6c7('0x3a')],'extension':this[_0xb6c7('0xc')][_0xb6c7('0x3b')],'priority':this['channel'][_0xb6c7('0x3c')],'accountcode':this[_0xb6c7('0xc')][_0xb6c7('0x3d')],'dnid':this[_0xb6c7('0xc')][_0xb6c7('0x3e')],'projectName':this[_0xb6c7('0xc')]['arg_1'],'saveName':_0x4f243a,'filename':_0x505b60[_0xb6c7('0x3f')]||_0x4f243a,'savePath':_0x5f047d})[_0xb6c7('0x10')](function(_0x2116cb){_0x14c64f(null,_0x2116cb);})[_0xb6c7('0x16')](function(_0x3153c8){_0x14c64f(_0x3153c8);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x40')]=function(_0x4cc0f6,_0x5218af,_0x4fd77d,_0xbf1903,_0x22e7a1){this[_0xb6c7('0xd')][_0xb6c7('0x40')]({'uniqueid':this[_0xb6c7('0xc')][_0xb6c7('0x34')],'body':_0x4cc0f6,'direction':_0x5218af,'providerName':_0x4fd77d,'providerResponse':_0xbf1903})['then'](function(_0x4f5c99){if(_0x22e7a1){_0x22e7a1(null,_0x4f5c99);}})[_0xb6c7('0x16')](function(_0x517bc1){if(_0x22e7a1){_0x22e7a1(_0x517bc1);}});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x41')]=function(_0x398c59,_0x210d50){this[_0xb6c7('0xd')]['createCmContact']({'firstName':_[_0xb6c7('0x42')](_0x398c59['name'])||_[_0xb6c7('0x43')](_0x398c59[_0xb6c7('0x11')])?_0xb6c7('0x44')+Math[_0xb6c7('0x45')]():_0x398c59[_0xb6c7('0x11')],'lastName':_['isEmpty'](_0x398c59[_0xb6c7('0x46')])||_[_0xb6c7('0x43')](_0x398c59[_0xb6c7('0x46')])?null:_0x398c59[_0xb6c7('0x46')],'phone':_0x398c59[_0xb6c7('0x47')],'ListId':_0x398c59[_0xb6c7('0x48')],'scheduledat':_0x398c59[_0xb6c7('0x49')],'callbackUniqueid':this[_0xb6c7('0xc')]['uniqueid'],'tags':_0xb6c7('0x4a'),'description':_0xb6c7('0x4b')+_0x398c59[_0xb6c7('0x49')][_0xb6c7('0x4c')](),'priority':_0x398c59[_0xb6c7('0x4d')]})[_0xb6c7('0x10')](function(_0x5e7e11){_0x210d50(null,_0x5e7e11);})[_0xb6c7('0x16')](function(_0xb8732e){_0x210d50(_0xb8732e);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x4e')]=function(_0x547d10,_0x36ec5c){this[_0xb6c7('0xd')][_0xb6c7('0x4f')](_0x547d10)[_0xb6c7('0x10')](function(_0x19d284){_0x36ec5c(null,_0x19d284?_0x19d284[_0xb6c7('0x11')]:![]);})[_0xb6c7('0x16')](function(_0x5cb286){_0x36ec5c(_0x5cb286);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x50')]=function(_0x11120b,_0x550376,_0xa5f6da){var _0x1412ef={'role':_0xb6c7('0x51')};_0x1412ef[_0x11120b]=this[_0xb6c7('0xc')][_0xb6c7('0x37')];this['rpc'][_0xb6c7('0x50')](_0x1412ef,_0x550376,this[_0xb6c7('0xc')][_0xb6c7('0x34')])[_0xb6c7('0x10')](function(_0xf50340){_0xa5f6da(null,_[_0xb6c7('0x43')](_0xf50340)?![]:!![]);})['catch'](function(_0x3f9ffd){logger[_0xb6c7('0x2a')](_0x3f9ffd);_0xa5f6da(null,![]);});};AGIVertices['prototype'][_0xb6c7('0x52')]=function(_0x1a41f7,_0x4ff673){var _0x9b79f1={'role':_0xb6c7('0x51')};_0x9b79f1[_0x1a41f7]=this[_0xb6c7('0xc')][_0xb6c7('0x37')];this[_0xb6c7('0xd')][_0xb6c7('0x52')](_0x9b79f1)[_0xb6c7('0x10')](function(_0x554d7d){_0x4ff673(null,_['isNil'](_0x554d7d)?![]:!![]);})[_0xb6c7('0x16')](function(_0x4e365e){logger[_0xb6c7('0x2a')](_0x4e365e);_0x4ff673(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x5d9cb2,_0x296afe){var _0x4df3c9={'role':_0xb6c7('0x51')};_0x4df3c9[_0x5d9cb2]=this['channel'][_0xb6c7('0x37')];this['rpc'][_0xb6c7('0x53')](_0x4df3c9)[_0xb6c7('0x10')](function(_0x57ebda){_0x296afe(null,_['isNil'](_0x57ebda)?![]:!![]);})[_0xb6c7('0x16')](function(_0x3c544b){logger[_0xb6c7('0x2a')](_0x3c544b);_0x296afe(null,![]);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x54')]=function(_0x3f60a5,_0x19229b){var _0x2ffae8={'role':_0xb6c7('0x51')};_0x2ffae8[_0x3f60a5]=this['channel'][_0xb6c7('0x37')];var _0x11913f=_0x3f60a5!='internal'?util[_0xb6c7('0x27')]('%s/%s@from-sip/n','LOCAL',this[_0xb6c7('0xc')][_0xb6c7('0x37')]):undefined;this['rpc'][_0xb6c7('0x54')](_0x2ffae8,_0x11913f)[_0xb6c7('0x10')](function(_0x5685fe){_0x19229b(null,_[_0xb6c7('0x43')](_0x5685fe)?![]:!![]);})[_0xb6c7('0x16')](function(_0x55a63e){logger[_0xb6c7('0x2a')](_0x55a63e);_0x19229b(null,![]);});};AGIVertices[_0xb6c7('0x12')]['shellCommand']=function(_0x39080f,_0x5237a4){sh[_0xb6c7('0x55')](_[_0xb6c7('0x56')](_0x39080f),function(_0x25e21f,_0x464a44){var _0x260e8d=_0x464a44[_0xb6c7('0x57')](/(\r\n|\n|\r)/gm,'');_0x5237a4(null,_0x260e8d);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x58')]=function(_0x3fbe59,_0x18bf30){scripts[_0xb6c7('0x58')](_0x3fbe59[_0xb6c7('0x59')],_0x3fbe59[_0xb6c7('0x5a')]||_0xb6c7('0x5b'),_0x3fbe59[_0xb6c7('0x5b')],_0x3fbe59[_0xb6c7('0x5c')]||_0xb6c7('0x5d'),_0x3fbe59[_0xb6c7('0x5e')]||'MALE',_0x3fbe59['audioEncoding']||_0xb6c7('0x5f'))['then'](function(_0x118cac){_0x18bf30(null,_0x118cac);})[_0xb6c7('0x16')](function(_0x35dd22){_0x18bf30(_0x35dd22);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x60')]=function(_0x5b2259,_0x39c813){scripts[_0xb6c7('0x60')](_0x5b2259[_0xb6c7('0x5b')],_0x5b2259[_0xb6c7('0x61')]||'en',0x1)[_0xb6c7('0x10')](function(_0x1bac6d){_0x39c813(null,_0x1bac6d);})['catch'](function(_0x36b411){_0x39c813(_0x36b411);});};AGIVertices['prototype'][_0xb6c7('0x62')]=function(_0x234ef7,_0x23ce66){var _0xf3ac9b={'uri':_0x234ef7[_0xb6c7('0x63')],'method':_0x234ef7[_0xb6c7('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x234ef7[_0xb6c7('0x65')])===_0xb6c7('0x66')&&parseInt(_0x234ef7[_0xb6c7('0x65')])>=0x1?parseInt(_0x234ef7[_0xb6c7('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xb6c7('0x67')]([_0xb6c7('0x68'),_0xb6c7('0x69')],_0xf3ac9b[_0xb6c7('0x64')][_0xb6c7('0x6a')]())){try{_0xf3ac9b[_0xb6c7('0x6b')]=_0x234ef7[_0xb6c7('0x9')]?JSON[_0xb6c7('0x6c')](_0x234ef7[_0xb6c7('0x9')]):{};}catch(_0x21f73e){logger[_0xb6c7('0x2a')](_0xb6c7('0x6d'),_0x21f73e);}}try{_0xf3ac9b[_0xb6c7('0x6e')]=_0x234ef7[_0xb6c7('0x8')]?JSON[_0xb6c7('0x6c')](_0x234ef7[_0xb6c7('0x8')]):{};}catch(_0x3071e9){logger[_0xb6c7('0x2a')](_0xb6c7('0x6f'),_0x3071e9);}if(_0x234ef7[_0xb6c7('0x70')]){try{var _0x22e97b=require(_0x234ef7[_0xb6c7('0x70')])[_0xb6c7('0x71')](this,_0xf3ac9b);_0xf3ac9b[_0xb6c7('0x72')]=Mustache[_0xb6c7('0x73')](_0x234ef7[_0xb6c7('0x63')],_0x22e97b,{},['$$','$$']);if(_0xf3ac9b[_0xb6c7('0x6e')]){_0xf3ac9b[_0xb6c7('0x6e')]=JSON['parse'](Mustache[_0xb6c7('0x73')](JSON['stringify'](_0xf3ac9b[_0xb6c7('0x6e')]),_0x22e97b,{},['$$','$$']));}if(_0xf3ac9b[_0xb6c7('0x6b')]){_0xf3ac9b['body']=JSON[_0xb6c7('0x6c')](Mustache[_0xb6c7('0x73')](JSON[_0xb6c7('0x74')](_0xf3ac9b[_0xb6c7('0x6b')]),_0x22e97b,{},['$$','$$']));}}catch(_0x5dc818){logger[_0xb6c7('0x2a')](_0xb6c7('0x75'),_0x5dc818);}}rp(_0xf3ac9b)[_0xb6c7('0x10')](function(_0x280c1d){var _0x43685e={'statusCode':_0x280c1d[_0xb6c7('0x76')]||0xc8,'statusMessage':_0x280c1d['statusMessage']||'OK','headers':_0x280c1d[_0xb6c7('0x6e')]||{},'body':_0x280c1d['body']||{}};_0x23ce66(null,_0x43685e);})['catch'](function(_0x4d7b9f){var _0x71a01b={'statusCode':_0x4d7b9f[_0xb6c7('0x76')]||0x1f4,'statusMessage':_0x4d7b9f[_0xb6c7('0x77')]||_0xb6c7('0x78'),'headers':_0x4d7b9f['options']['headers']||{},'body':_0x4d7b9f[_0xb6c7('0x79')]['body']||{}};_0x23ce66(null,_0x71a01b);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x7a')]=function(_0x30a5f3,_0x514a8b){scripts[_0xb6c7('0x7a')](this[_0xb6c7('0xc')][_0xb6c7('0x34')],_0x30a5f3['key'],_0x30a5f3[_0xb6c7('0x5b')],_0x30a5f3['dialogflow_language']||'en')[_0xb6c7('0x10')](function(_0x4b2f58){_0x514a8b(null,_0x4b2f58);})[_0xb6c7('0x16')](function(_0x94f5ac){_0x514a8b(_0x94f5ac);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x32c401,_0x196566){scripts[_0xb6c7('0x7b')](this[_0xb6c7('0xc')][_0xb6c7('0x34')],_0x32c401['dialogflowV2_project_id'],_0x32c401[_0xb6c7('0x7c')],_0x32c401['private_key'],_0x32c401['text'],_0x32c401[_0xb6c7('0x7d')]||'en')[_0xb6c7('0x10')](function(_0x1f05e9){_0x196566(null,_0x1f05e9);})[_0xb6c7('0x16')](function(_0x5bfe73){_0x196566(_0x5bfe73);});};AGIVertices['prototype'][_0xb6c7('0x7e')]=function(_0x3e7b04,_0x267b78){scripts[_0xb6c7('0x7e')](this[_0xb6c7('0xc')],_0x3e7b04)[_0xb6c7('0x10')](function(_0x1afbcd){_0x267b78(null,_0x1afbcd);})['catch'](function(_0x524989){_0x267b78(_0x524989);});};AGIVertices['prototype'][_0xb6c7('0x7f')]=function(_0xf00e44,_0x548f09){scripts[_0xb6c7('0x7f')](_0xf00e44[_0xb6c7('0x80')],_0xf00e44[_0xb6c7('0x5b')],_0xf00e44[_0xb6c7('0x81')]||'en-US',_0xf00e44['speed'])[_0xb6c7('0x10')](function(_0x4e836b){_0x548f09(null,_0x4e836b);})[_0xb6c7('0x16')](function(_0x4c38b9){_0x548f09(_0x4c38b9);});};AGIVertices['prototype']['ispeechASR']=function(_0x308d27,_0x53257e,_0x5545e9){scripts['ispeechASR'](_0x53257e,_0x308d27[_0xb6c7('0x80')],_0x308d27['ispeech_asr_language']||_0xb6c7('0x5d'),this[_0xb6c7('0x82')](_0x308d27[_0xb6c7('0x83')])?_0x308d27[_0xb6c7('0x83')]:undefined)['then'](function(_0x536f16){_0x5545e9(null,_0x536f16);})[_0xb6c7('0x16')](function(_0x31905e){_0x5545e9(_0x31905e);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x84')]=function(_0x5cb043,_0x4278c6){scripts[_0xb6c7('0x84')](_0x5cb043[_0xb6c7('0x85')],_0x5cb043[_0xb6c7('0x86')],_0x5cb043[_0xb6c7('0x87')],_0x5cb043[_0xb6c7('0x88')]||_0xb6c7('0x89'),_0x5cb043['text'],_0x5cb043[_0xb6c7('0x8a')]||_0xb6c7('0x5b'))[_0xb6c7('0x10')](function(_0x4425b3){_0x4278c6(null,_0x4425b3);})['catch'](function(_0x5c1aaf){_0x4278c6(_0x5c1aaf);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x8b')]=function(_0x3f9282,_0x4fec2f){scripts[_0xb6c7('0x8b')](this[_0xb6c7('0xc')]['uniqueid'],_0x3f9282['aws_access_key_id'],_0x3f9282['aws_secret_access_key'],_0x3f9282['aws_lex_region'],_0x3f9282['text'],_0x3f9282['aws_bot_name'])[_0xb6c7('0x10')](function(_0x43a773){_0x4fec2f(null,_0x43a773);})[_0xb6c7('0x16')](function(_0x5cfeea){_0x4fec2f(_0x5cfeea);});};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x8c')]=function(_0x1d0b3a,_0x509fc2,_0x55bcb1){scripts[_0xb6c7('0x8c')](_0x509fc2,_0x1d0b3a['key'],_0x1d0b3a[_0xb6c7('0x8d')]||_0xb6c7('0x5d'))[_0xb6c7('0x10')](function(_0x3abadf){_0x55bcb1(null,_0x3abadf);})['catch'](function(_0x18c76a){_0x55bcb1(_0x18c76a);});};AGIVertices['prototype'][_0xb6c7('0x8e')]=function(_0x50df7c,_0x47ef2a,_0x1bcc9d){scripts[_0xb6c7('0x8e')](_0x47ef2a,_0x50df7c[_0xb6c7('0x8f')],_0x50df7c[_0xb6c7('0x90')],_0x50df7c[_0xb6c7('0x72')])[_0xb6c7('0x10')](function(_0x1c44d3){_0x1bcc9d(null,_0x1c44d3);})['catch'](function(_0x19ead8){_0x1bcc9d(_0x19ead8);});};AGIVertices['prototype']['clear']=function(_0x1c0042){var _0x2fac09=_[_0xb6c7('0x67')](verticesWithRetry,_0x1c0042[_0xb6c7('0x36')])?_0x1c0042:_[_0xb6c7('0x91')](_0x1c0042);for(var _0x4a9803 in _0x2fac09){if(_0x2fac09['hasOwnProperty'](_0x4a9803)){if(_0x2fac09[_0x4a9803]&&_[_0xb6c7('0x92')](_0x2fac09[_0x4a9803])){if(_[_0xb6c7('0x67')](recursiveMapAttributes,_0x4a9803)){_0x2fac09[_0x4a9803]=this[_0xb6c7('0x93')](_0x2fac09[_0x4a9803]);}else{_0x2fac09[_0x4a9803]=this[_0xb6c7('0x94')](_0x2fac09[_0x4a9803]);}}}}return _0x2fac09;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x4761f0){for(var _0x5c7c30 in _0x4761f0){if(_0x4761f0['hasOwnProperty'](_0x5c7c30)){if(_['isPlainObject'](_0x4761f0[_0x5c7c30])){this[_0xb6c7('0x95')](_0x4761f0[_0x5c7c30]);}else if(_[_0xb6c7('0x96')](_0x4761f0[_0x5c7c30])){for(var _0x4401dd=0x0;_0x4401dd<_0x4761f0[_0x5c7c30][_0xb6c7('0x97')];_0x4401dd++){this[_0xb6c7('0x95')](_0x4761f0[_0x5c7c30][_0x4401dd]);}}else if(_[_0xb6c7('0x92')](_0x4761f0[_0x5c7c30])){_0x4761f0[_0x5c7c30]=this['replaceAllVariables'](_0x4761f0[_0x5c7c30]);}}}};AGIVertices[_0xb6c7('0x12')]['saveRestApiResult']=function(_0xfbda77,_0x2c1a24){for(var _0x5a5943 in _0xfbda77){if(_0xfbda77[_0xb6c7('0x98')](_0x5a5943)){if(_[_0xb6c7('0x99')](_0xfbda77[_0x5a5943])){if(!_[_0xb6c7('0x42')](_0xfbda77[_0x5a5943])){this[_0xb6c7('0x9a')](_0xfbda77[_0x5a5943],util[_0xb6c7('0x27')](_0xb6c7('0x9b'),_0x2c1a24,_0x5a5943));}}else if(_[_0xb6c7('0x96')](_0xfbda77[_0x5a5943])){for(var _0x534276=0x0;_0x534276<_0xfbda77[_0x5a5943][_0xb6c7('0x97')];_0x534276++){this['saveRestApiResult'](_0xfbda77[_0x5a5943][_0x534276],util[_0xb6c7('0x27')](_0xb6c7('0x9b'),_0x2c1a24,_0x5a5943+'['+_0x534276+']'));}}else{if(!_[_0xb6c7('0x43')](_0xfbda77[_0x5a5943])){this[_0xb6c7('0xc')][_0xb6c7('0x9c')](util[_0xb6c7('0x27')](_0xb6c7('0x9b'),_0x2c1a24,_0x5a5943),_0xfbda77[_0x5a5943]);}}}}};AGIVertices['prototype'][_0xb6c7('0x93')]=function(_0x1579a4){try{var _0x5f2bd0=JSON[_0xb6c7('0x6c')](_0x1579a4);this[_0xb6c7('0x95')](_0x5f2bd0);return JSON[_0xb6c7('0x74')](_0x5f2bd0);}catch(_0x3489ae){return this['replaceAllVariables'](_0x1579a4);}};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x94')]=function(_0x230ee5){var _0x3a30ce=_0x230ee5[_0xb6c7('0x9d')]('{');for(var _0x2827d6=0x1;_0x2827d6<_0x3a30ce[_0xb6c7('0x97')];_0x2827d6+=0x1){var _0x2c0b97=_0x3a30ce[_0x2827d6]['split']('}');if(_0x2c0b97[_0xb6c7('0x97')]>0x1){_0x230ee5=_0x230ee5[_0xb6c7('0x9e')]('{'+_0x2c0b97[0x0]+'}',this[_0xb6c7('0xc')][_0xb6c7('0x9f')](_0x2c0b97[0x0])[_0xb6c7('0xa0')]||_0x2c0b97[0x0]);}}if(_0x3a30ce['length']===0x1){return _0x230ee5[_0xb6c7('0x4c')]();}return this[_0xb6c7('0x94')](_0x230ee5);};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xa1')]=function(_0xc5bd0c,_0x58197c){var _0x328c95=this[_0xb6c7('0xc')][_0xb6c7('0x9f')](_0xc5bd0c);if(_0x328c95['result']===-0x1){return _0x328c95;}logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0xa2'),_0x58197c,_0x328c95[_0xb6c7('0xa0')]));return this[_0xb6c7('0xc')][_0xb6c7('0x9c')](_0x58197c,_0x328c95[_0xb6c7('0xa0')]);};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x82')]=function(_0x710bd0){return _0x710bd0&&_0x710bd0!=='0'&&_0x710bd0!=='-1'&&_0x710bd0!=='';};AGIVertices['prototype'][_0xb6c7('0xa3')]=function(_0xc1a49c){this['createSquareDetailsReport'][_0xb6c7('0x71')](this,_0xc1a49c,'-');_0xc1a49c[_0xb6c7('0xa4')]=_0xc1a49c[_0xb6c7('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xa5')]=function(_0x3643dc){logger['info'](util[_0xb6c7('0x27')](_0xb6c7('0xa6'),_0x3643dc[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x3643dc[_0xb6c7('0x5b')])){return this[_0xb6c7('0xc')]['noop'](_0xb6c7('0xa7'));}var _0x3651b9='\x22'+_0x3643dc[_0xb6c7('0x5b')]+'\x22';if(this[_0xb6c7('0x82')](_0x3643dc[_0xb6c7('0x79')])){_0x3651b9+=','+_0x3643dc[_0xb6c7('0x79')];}var _0x4c0a9b=this[_0xb6c7('0xc')][_0xb6c7('0x55')](_0xb6c7('0xa8'),_0x3651b9);if(_0x4c0a9b[_0xb6c7('0xa9')]===-0x1){return _0x4c0a9b;}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format'](_0xb6c7('0xab'),_0x3651b9));};AGIVertices['prototype'][_0xb6c7('0xac')]=function(_0x4b3c3a){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0xad'),_0x4b3c3a[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x4b3c3a['grammar'])){return this[_0xb6c7('0xc')]['noop'](_0xb6c7('0xae'));}var _0x525a36=_0x4b3c3a[_0xb6c7('0xaf')];if(this[_0xb6c7('0x82')](_0x4b3c3a['options'])){_0x525a36+=','+_0x4b3c3a[_0xb6c7('0x79')];}var _0x5001de=this[_0xb6c7('0xc')][_0xb6c7('0x55')]('MRCPRecog',_0x525a36);if(_0x5001de[_0xb6c7('0xa9')]===-0x1){return _0x5001de;}var _0x3e9302=this['getAndSetVariable']('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x3e9302['result']===-0x1){return _0x3e9302;}var _0xc5a74a=this[_0xb6c7('0xa1')](_0xb6c7('0xb0'),_0xb6c7('0xb1'));if(_0xc5a74a[_0xb6c7('0xa9')]===-0x1){return _0xc5a74a;}var _0x1dfc2b=this[_0xb6c7('0xa1')](_0xb6c7('0xb2'),_0xb6c7('0xb3'));if(_0x1dfc2b[_0xb6c7('0xa9')]===-0x1){return _0x1dfc2b;}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format'](_0xb6c7('0xb4'),_0x525a36));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xb5')]=function(_0x1dc4d3){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0xb6'),_0x1dc4d3[_0xb6c7('0x35')]));return this[_0xb6c7('0xc')]['agi']([_0x1dc4d3[_0xb6c7('0xb7')],_0x1dc4d3['args']]);};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xb8')]=function(_0x2b3f22){logger[_0xb6c7('0x2c')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x2b3f22[_0xb6c7('0x35')]));if(this[_0xb6c7('0x82')](_0x2b3f22[_0xb6c7('0x65')])){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0xb9'),_0x2b3f22[_0xb6c7('0x65')]));var _0x2d1b27=this['channel']['wait'](_0x2b3f22[_0xb6c7('0x65')]);if(_0x2d1b27[_0xb6c7('0xa9')]===-0x1){return _0x2d1b27;}}return this[_0xb6c7('0xc')]['answer']();};AGIVertices['prototype'][_0xb6c7('0x4a')]=function(_0x4b021d){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0xba'),_0x4b021d[_0xb6c7('0x35')]));if(!this['isConfigured'](_0x4b021d['list_id'])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x4b021d,'no\x20list\x20selected');}_0x4b021d[_0xb6c7('0x49')]=moment();if(this[_0xb6c7('0x82')](_0x4b021d['delay'])){_0x4b021d[_0xb6c7('0x49')]=moment()[_0xb6c7('0xbb')](_0x4b021d[_0xb6c7('0xbc')],'minutes');}if(!this[_0xb6c7('0x82')](_0x4b021d[_0xb6c7('0x4d')])){_0x4b021d[_0xb6c7('0x4d')]=0x2;}this['createCmContact'][_0xb6c7('0x71')](this,_0x4b021d);return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0xbd'),_0x4b021d[_0xb6c7('0x47')],_0x4b021d['list_id'],_0x4b021d['scheduledAt']));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xbe')]=function(_0x1d12d8){logger['info'](util[_0xb6c7('0x27')](_0xb6c7('0xbf'),_0x1d12d8[_0xb6c7('0x35')]));var _0x278c1e=this[_0xb6c7('0xc')]['exec'](_0x1d12d8[_0xb6c7('0xc0')],_0x1d12d8[_0xb6c7('0x79')]);if(_0x278c1e['result']===-0x1){return _0x278c1e;}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0xc1'),_0x1d12d8['application'],_0x1d12d8[_0xb6c7('0x79')]));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xc2')]=function(_0x2490a1){logger[_0xb6c7('0x2c')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2490a1[_0xb6c7('0x35')]));if(!this['isConfigured'](_0x2490a1[_0xb6c7('0x5b')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0xa7'));}var _0x420378='\x22'+_0x2490a1[_0xb6c7('0x5b')]+'\x22';if(this[_0xb6c7('0x82')](_0x2490a1[_0xb6c7('0x79')])){_0x420378+=','+_0x2490a1[_0xb6c7('0x79')];}var _0x166c7e=this[_0xb6c7('0xc')][_0xb6c7('0x55')]('MRCPSynth',_0x420378);if(_0x166c7e['result']===-0x1){return _0x166c7e;}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x420378));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xc3')]=function(_0x1c7638){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0xc4'),_0x1c7638['label']));if(!this[_0xb6c7('0x82')](_0x1c7638[_0xb6c7('0x5b')])){return this[_0xb6c7('0xc')]['noop'](_0xb6c7('0xa7'));}var _0x30a4ae='\x22'+_0x1c7638[_0xb6c7('0x5b')]+'\x22';if(this[_0xb6c7('0x82')](_0x1c7638[_0xb6c7('0x79')])){_0x30a4ae+=','+_0x1c7638[_0xb6c7('0x79')];}var _0x1f2776=this[_0xb6c7('0xc')]['exec'](_0xb6c7('0xa8'),_0x30a4ae);if(_0x1f2776[_0xb6c7('0xa9')]===-0x1){return _0x1f2776;}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format'](_0xb6c7('0xab'),_0x30a4ae));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xc5')]=function(_0x5f0d72){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0xc6'),_0x5f0d72['label']));if(!this[_0xb6c7('0x82')](_0x5f0d72[_0xb6c7('0xaf')])){return this[_0xb6c7('0xc')]['noop'](_0xb6c7('0xae'));}var _0x3e4913=_0x5f0d72[_0xb6c7('0xaf')];if(this['isConfigured'](_0x5f0d72[_0xb6c7('0x79')])){_0x3e4913+=','+_0x5f0d72[_0xb6c7('0x79')];}var _0x115f62=this[_0xb6c7('0xc')]['exec'](_0xb6c7('0xc7'),_0x3e4913);if(_0x115f62[_0xb6c7('0xa9')]===-0x1){return _0x115f62;}var _0x1bb1e5=this['getAndSetVariable'](_0xb6c7('0xc8'),_0xb6c7('0xc9'));if(_0x1bb1e5[_0xb6c7('0xa9')]===-0x1){return _0x1bb1e5;}var _0x19fe4b=this[_0xb6c7('0xa1')](_0xb6c7('0xb0'),_0xb6c7('0xca'));if(_0x19fe4b['result']===-0x1){return _0x19fe4b;}var _0x4724e2=this['getAndSetVariable'](_0xb6c7('0xb2'),_0xb6c7('0xcb'));if(_0x4724e2['result']===-0x1){return _0x4724e2;}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0xb4'),_0x3e4913));};AGIVertices[_0xb6c7('0x12')]['sestekasr']=function(_0x238128){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0xcc'),_0x238128['label']));if(!this[_0xb6c7('0x82')](_0x238128[_0xb6c7('0xaf')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0xae'));}var _0x447985=_0x238128[_0xb6c7('0xaf')];if(this[_0xb6c7('0x82')](_0x238128[_0xb6c7('0x79')])){_0x447985+=','+_0x238128['options'];}var _0x10d3db=this['channel']['exec'](_0xb6c7('0xc7'),_0x447985);if(_0x10d3db[_0xb6c7('0xa9')]===-0x1){return _0x10d3db;}var _0x4530a7=this[_0xb6c7('0xa1')]('RECOG_CONFIDENCE()',_0xb6c7('0xcd'));if(_0x4530a7['result']===-0x1){return _0x4530a7;}var _0x1e6455=this['getAndSetVariable'](_0xb6c7('0xb0'),'SESTEK_ASR_TRANSCRIPT');if(_0x1e6455['result']===-0x1){return _0x1e6455;}var _0xf8bb5c=this[_0xb6c7('0xa1')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0xf8bb5c[_0xb6c7('0xa9')]===-0x1){return _0xf8bb5c;}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0xb4'),_0x447985));};AGIVertices[_0xb6c7('0x12')]['database']=function(_0x391ed7){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0xce'),_0x391ed7[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x391ed7[_0xb6c7('0xcf')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x391ed7,'no\x20database\x20selected');}var _0x1b7e43=this[_0xb6c7('0x17')][_0xb6c7('0x71')](this,_0x391ed7[_0xb6c7('0xcf')]);if(!_0x1b7e43){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x391ed7,_0xb6c7('0xd0'));}if(!this[_0xb6c7('0x82')](_0x391ed7[_0xb6c7('0x2e')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x391ed7,_0xb6c7('0xd1'));}var _0x5b5f45=_0x391ed7['query'][_0xb6c7('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0xd2'),_0x5b5f45));var _0x4bdbbf=this[_0xb6c7('0xd3')][_0xb6c7('0x71')](this,_0x1b7e43,_0x5b5f45);this[_0xb6c7('0x33')][_0xb6c7('0x71')](this,_0x391ed7,_0x5b5f45);if(!this['isConfigured'](_0x391ed7[_0xb6c7('0xd4')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0xd5'));}var _0x59940c=this[_0xb6c7('0x9f')][_0xb6c7('0x71')](this,_0x391ed7[_0xb6c7('0xd4')]);if(!_0x59940c){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x391ed7,_0xb6c7('0xd6'));}var _0x590b00=this;_0x4bdbbf['forEach'](function(_0x45b912,_0xee70bc){Object[_0xb6c7('0xd7')](_0x45b912)[_0xb6c7('0xd8')](function(_0x1e3a39){_0x590b00['channel'][_0xb6c7('0x9c')](util[_0xb6c7('0x27')](_0xb6c7('0xd9'),_0x59940c,_0xee70bc,_0x1e3a39),_0x45b912[_0x1e3a39]);});});this[_0xb6c7('0xc')]['setVariable'](util[_0xb6c7('0x27')]('%s_ROWS_COUNT',_0x59940c),_0x4bdbbf[_0xb6c7('0x97')]);return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format'](_0xb6c7('0xda'),_0x59940c));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xdb')]=function(_0x3f5e9b){logger[_0xb6c7('0xdc')](util['format'](_0xb6c7('0xdd'),_0x3f5e9b['label']));if(!this[_0xb6c7('0x82')](_0x3f5e9b[_0xb6c7('0xde')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x3f5e9b,_0xb6c7('0xdf'));}var _0x13f811=this[_0xb6c7('0x1a')]['sync'](this,_0x3f5e9b['sip_id']);if(!_0x13f811){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x3f5e9b,'no\x20user\x20found');}var _0x48f492=this[_0xb6c7('0xc')]['exec']('DIAL',[util[_0xb6c7('0x27')](_0xb6c7('0xe0'),_0x13f811),_0x3f5e9b[_0xb6c7('0x65')],_0x3f5e9b['opts'],_0x3f5e9b[_0xb6c7('0x63')]]);if(_0x48f492[_0xb6c7('0xa9')]===-0x1){return _0x48f492;}return this['channel'][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0xe1'),'DIAL'));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xe2')]=function(_0x2351a1){logger[_0xb6c7('0x2c')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2351a1[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x2351a1[_0xb6c7('0x80')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0xe3'));}if(!this[_0xb6c7('0x82')](_0x2351a1[_0xb6c7('0x5b')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0xa7'));}this[_0xb6c7('0xc')]['bot']=!![];this[_0xb6c7('0x33')](_0x2351a1);this[_0xb6c7('0x40')](_0x2351a1['text'],'in','','');this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('Trying\x20Dialogflow:\x20%s',_0x2351a1['text']));var _0x585ea9=this[_0xb6c7('0x7a')]['sync'](this,_0x2351a1);if(_0x585ea9){for(var _0x289b86 in _0x585ea9){if(_0x585ea9[_0xb6c7('0x98')](_0x289b86)){this[_0xb6c7('0xc')][_0xb6c7('0x9c')](util[_0xb6c7('0x27')](_0xb6c7('0xe4'),_0x289b86[_0xb6c7('0x6a')]()),_0x585ea9[_0x289b86]);}}this[_0xb6c7('0x40')](_0x585ea9['speech'],'out',_0xb6c7('0xe2'),'');return this['channel'][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0xe5'),_0x585ea9[_0xb6c7('0xe6')]));}return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x2351a1,_0xb6c7('0xe7'));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xe8')]=function(_0xfe7897){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0xe9'),_0xfe7897['label']));if(!this['isConfigured'](_0xfe7897[_0xb6c7('0xea')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0xeb'));}if(!this[_0xb6c7('0x82')](_0xfe7897[_0xb6c7('0x7c')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0xec'));}if(!this['isConfigured'](_0xfe7897[_0xb6c7('0xed')])){return this[_0xb6c7('0xc')]['noop'](_0xb6c7('0xee'));}if(!this[_0xb6c7('0x82')](_0xfe7897[_0xb6c7('0x7d')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0xef'));}if(!this[_0xb6c7('0x82')](_0xfe7897[_0xb6c7('0x5b')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0xa7'));}this[_0xb6c7('0xc')]['bot']=!![];this[_0xb6c7('0x33')](_0xfe7897);this['createSquareMessage'](_0xfe7897['text'],'in','','');this[_0xb6c7('0xc')]['noop'](util[_0xb6c7('0x27')](_0xb6c7('0xf0'),_0xfe7897[_0xb6c7('0x5b')]));var _0xb1e024=this[_0xb6c7('0x7b')][_0xb6c7('0x71')](this,_0xfe7897);if(_0xb1e024){for(var _0x1c9cc5 in _0xb1e024){if(_0xb1e024[_0xb6c7('0x98')](_0x1c9cc5)){if(_0x1c9cc5!==_0xb6c7('0xf1')){this[_0xb6c7('0xc')]['setVariable'](util['format'](_0xb6c7('0xe4'),_0x1c9cc5['toUpperCase']()),_0xb1e024[_0x1c9cc5]);}}}this[_0xb6c7('0x40')](_0xb1e024[_0xb6c7('0xe6')],_0xb6c7('0xf2'),'dialogflowV2',_0xb1e024['providerResponse']);return this['channel'][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0xf3'),_0xb1e024[_0xb6c7('0xe6')]));}return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0xfe7897,_0xb6c7('0xf4'));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xf5')]=function(_0x614c04){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0xf6'),_0x614c04[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x614c04[_0xb6c7('0xf7')])){return this[_0xb6c7('0xc')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0xb6c7('0x82')](_0x614c04[_0xb6c7('0xf8')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0xf9'));}if(!this[_0xb6c7('0x82')](_0x614c04[_0xb6c7('0xfa')])){return this[_0xb6c7('0xc')]['noop'](_0xb6c7('0xfb'));}if(!this[_0xb6c7('0x82')](_0x614c04['ndassistant_url'])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0xa7'));}this['channel'][_0xb6c7('0xfc')]=!![];this[_0xb6c7('0x33')](_0x614c04);this[_0xb6c7('0x40')](_0x614c04['text'],'in','','');this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format'](_0xb6c7('0xfd'),_0x614c04[_0xb6c7('0x5b')]));var _0x370189=this[_0xb6c7('0x7e')][_0xb6c7('0x71')](this,_0x614c04);if(_0x370189){for(var _0x3c6fcf in _0x370189){if(_0x370189[_0xb6c7('0x98')](_0x3c6fcf)){this[_0xb6c7('0xc')][_0xb6c7('0x9c')](util['format'](_0xb6c7('0xfe'),_0x3c6fcf[_0xb6c7('0x6a')]()),_0x370189[_0x3c6fcf]);}}this[_0xb6c7('0x40')](_0x370189['speech'],_0xb6c7('0xf2'),_0xb6c7('0xf5'),'');if(_0x370189['audiofile']){this[_0xb6c7('0xc')]['noop'](util[_0xb6c7('0x27')](_0xb6c7('0xff'),_0x370189[_0xb6c7('0x100')]));var _0x20fe92=this[_0xb6c7('0xc')][_0xb6c7('0x101')](_0x370189[_0xb6c7('0x100')]);try{fs[_0xb6c7('0x102')](_0x370189['audiofile']+_0xb6c7('0x103'));}catch(_0x290070){logger[_0xb6c7('0x2a')](_0x290070);}return _0x20fe92;}else{return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('SestekNDA\x20Result\x20%s',_0x370189[_0xb6c7('0xe6')]));}}return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x614c04,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xb6c7('0x12')]['end']=function(_0x51b1e6){logger['info'](util[_0xb6c7('0x27')](_0xb6c7('0x104'),_0x51b1e6['label']));return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0x105'));};AGIVertices['prototype'][_0xb6c7('0x106')]=function(_0x1d644b){logger['info'](util['format'](_0xb6c7('0x107'),_0x1d644b['label']));var _0x5ce312='';if(_0x1d644b[_0xb6c7('0x108')]){if(!this['isConfigured'](_0x1d644b[_0xb6c7('0x108')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x1d644b,_0xb6c7('0x109'));}else{var _0x26c8e7=parseInt(_0x1d644b['trunk_id'],0xa);if(isNaN(_0x26c8e7)){_0x5ce312=_0x1d644b[_0xb6c7('0x108')];}else{_0x5ce312=this[_0xb6c7('0x10a')][_0xb6c7('0x71')](this,_0x1d644b[_0xb6c7('0x108')]);if(!_0x5ce312){return this[_0xb6c7('0xc')]['error'](_0x1d644b,_0xb6c7('0x10b'));}}}}else if(_0x1d644b[_0xb6c7('0x10c')]){_0x5ce312=_0x1d644b[_0xb6c7('0x10c')];}else{return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x1d644b,_0xb6c7('0x109'));}var _0x3f96a2=this[_0xb6c7('0xc')][_0xb6c7('0x55')]('DIAL',[util[_0xb6c7('0x27')]('SIP/%s/%s',_0x5ce312,_0x1d644b['phone']),_0x1d644b[_0xb6c7('0x65')],_0x1d644b[_0xb6c7('0x10d')],_0x1d644b[_0xb6c7('0x63')]]);if(_0x3f96a2[_0xb6c7('0xa9')]===-0x1){return _0x3f96a2;}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0xe1'),'DIAL'));};AGIVertices[_0xb6c7('0x12')]['finally']=function(_0x21097b){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x10e'),_0x21097b[_0xb6c7('0x35')]));return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x10f'));};AGIVertices['prototype'][_0xb6c7('0xa')]=function(_0xc665ca){logger['info'](util[_0xb6c7('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0xc665ca[_0xb6c7('0x35')]));if(_0xc665ca[_0xb6c7('0xa4')]===0x0){return this[_0xb6c7('0xa3')](_0xc665ca);}_0xc665ca['retry']-=0x1;if(!this[_0xb6c7('0x82')](_0xc665ca[_0xb6c7('0x110')])){return this['channel']['error'](_0xc665ca,'no\x20file\x20audio\x20selected');}var _0x1fda2c=this[_0xb6c7('0x1c')][_0xb6c7('0x71')](this,_0xc665ca['file_id']);if(!_0x1fda2c){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0xc665ca,_0xb6c7('0x111'));}if(!this[_0xb6c7('0x82')](_0xc665ca[_0xb6c7('0xd4')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0xb6c7('0xd5'));}var _0x37fbef=this[_0xb6c7('0xc')]['getData'](_0x1fda2c,_0xc665ca[_0xb6c7('0x112')],_0xc665ca[_0xb6c7('0x113')]);var _0x57793d=_0x37fbef[_0xb6c7('0xa9')]?_0x37fbef[_0xb6c7('0xa9')][_0xb6c7('0x4c')]():'';logger['info'](_0xb6c7('0x114'),JSON[_0xb6c7('0x74')](_0x37fbef));if(_0x37fbef[_0xb6c7('0xa9')]===-0x1){this[_0xb6c7('0x33')][_0xb6c7('0x71')](this,_0xc665ca,_0x57793d);return _0x37fbef;}else if(_0x37fbef[_0xb6c7('0xa0')]===_0xb6c7('0x65')){_0x37fbef[_0xb6c7('0xa9')]=_0x57793d['length']>=parseInt(_0xc665ca[_0xb6c7('0x115')])?'x':'i';}else{_0x37fbef[_0xb6c7('0xa9')]=_0x57793d[_0xb6c7('0x97')]>=parseInt(_0xc665ca[_0xb6c7('0x115')])&&_0x57793d[_0xb6c7('0x97')]<=parseInt(_0xc665ca[_0xb6c7('0x113')])?'x':'i';}var _0x40eb0c=this[_0xb6c7('0x9f')]['sync'](this,_0xc665ca[_0xb6c7('0xd4')]);if(!_0x40eb0c){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0xc665ca,_0xb6c7('0xd6'));}this['channel'][_0xb6c7('0x9c')](_0x40eb0c,_0x57793d);if(this[_0xb6c7('0x82')](_0xc665ca[_0xb6c7('0x116')])){var _0x2d4907=parseInt(_0xc665ca[_0xb6c7('0x116')],0xa);var _0x212dc7=rs[_0xb6c7('0x117')]({'charset':'*','length':_0x2d4907});var _0x15610a=_0x57793d[_0xb6c7('0x97')];if(_0x15610a>0x0){if(_0x15610a>_0x2d4907){this[_0xb6c7('0x33')][_0xb6c7('0x71')](this,_0xc665ca,_0xc665ca[_0xb6c7('0x118')]===_0xb6c7('0x119')?_0x212dc7+_0x57793d['substr'](_0x2d4907):_0x57793d[_0xb6c7('0x11a')](0x0,_0x15610a-_0x2d4907)+_0x212dc7);}else{this['createSquareDetailsReport'][_0xb6c7('0x71')](this,_0xc665ca,rs['generate']({'charset':'*','length':_0x15610a}));}}else{this[_0xb6c7('0x33')][_0xb6c7('0x71')](this,_0xc665ca,'');}}else{this[_0xb6c7('0x33')][_0xb6c7('0x71')](this,_0xc665ca,_0x57793d);}return _0x37fbef;};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0xb')]=function(_0x57f131){logger[_0xb6c7('0x2c')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x57f131[_0xb6c7('0x35')]));return this[_0xb6c7('0xa')](_0x57f131);};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x11b')]=function(_0x41c80b){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x11c'),_0x41c80b['label']));this['createSquareDetailsReport']['sync'](this,_0x41c80b,_0x41c80b[_0xb6c7('0x11d')]);return this['channel'][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x11e'),_0x41c80b[_0xb6c7('0x11d')]));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x11f')]=function(_0x2011ac){logger['info'](util[_0xb6c7('0x27')](_0xb6c7('0x120'),_0x2011ac[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x2011ac[_0xb6c7('0x85')])||!this['isConfigured'](_0x2011ac[_0xb6c7('0x86')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0x121'));}if(!this['isConfigured'](_0x2011ac[_0xb6c7('0x5b')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0xa7'));}this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x122'),_0x2011ac[_0xb6c7('0x5b')]));var _0x26273c=this[_0xb6c7('0x84')][_0xb6c7('0x71')](this,_0x2011ac);if(_0x26273c){this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('aws\x20Polly\x20%s\x20file\x20created',_0x26273c));var _0x34f8a2=this[_0xb6c7('0xc')][_0xb6c7('0x101')](_0x26273c);try{fs[_0xb6c7('0x102')](_0x26273c+_0xb6c7('0x103'));}catch(_0x11cd9b){logger[_0xb6c7('0x2a')](_0x11cd9b);}return _0x34f8a2;}return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x2011ac,_0xb6c7('0x123'));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x124')]=function(_0x2a4e47){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x2a4e47[_0xb6c7('0x35')]));if(!this['isConfigured'](_0x2a4e47[_0xb6c7('0x85')])||!this['isConfigured'](_0x2a4e47['aws_secret_access_key'])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x121'));}if(!this[_0xb6c7('0x82')](_0x2a4e47[_0xb6c7('0x125')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x126'));}if(!this[_0xb6c7('0x82')](_0x2a4e47[_0xb6c7('0x5b')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0xa7'));}this[_0xb6c7('0xc')][_0xb6c7('0xfc')]=!![];this['createSquareDetailsReport'](_0x2a4e47);this[_0xb6c7('0x40')](_0x2a4e47[_0xb6c7('0x5b')],'in','','');this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x127'),_0x2a4e47[_0xb6c7('0x5b')]));var _0x572bd4=this[_0xb6c7('0x8b')][_0xb6c7('0x71')](this,_0x2a4e47);if(_0x572bd4){for(var _0x9a6090 in _0x572bd4){if(_0x572bd4[_0xb6c7('0x98')](_0x9a6090)&&_['isString'](_0x572bd4[_0x9a6090])){this[_0xb6c7('0xc')][_0xb6c7('0x9c')](util[_0xb6c7('0x27')]('AWS_LEX_%s',_0x9a6090[_0xb6c7('0x6a')]()),_0x572bd4[_0x9a6090]);}}if(_['isNil'](_0x572bd4[_0xb6c7('0x77')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x128'));}else{this[_0xb6c7('0x40')](_0x572bd4[_0xb6c7('0x77')],_0xb6c7('0xf2'),_0xb6c7('0x129'),'');return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format'](_0xb6c7('0x12a'),_0x572bd4['message']));}}return this[_0xb6c7('0xc')]['error'](_0x2a4e47,_0xb6c7('0x12b'));};AGIVertices[_0xb6c7('0x12')]['googleasr']=function(_0x46ff1e){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x12c'),_0x46ff1e['label'],_0x46ff1e[_0xb6c7('0x65')]));if(!this[_0xb6c7('0x82')](_0x46ff1e['key'])){return this['channel']['noop'](_0xb6c7('0xe3'));}var _0x34425c='wav';var _0x1502f5=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xb6c7('0x117')](0x4));var _0x5575df=util['format'](_0xb6c7('0x9b'),_0x1502f5,_0x34425c);var _0x37732b=!![];if(_0x46ff1e[_0xb6c7('0x12d')]===_0xb6c7('0x12e')){_0x37732b=![];}var _0x4e7eeb=this['channel'][_0xb6c7('0x12f')](_0x1502f5,_0x34425c,_0x46ff1e[_0xb6c7('0x130')],_0x46ff1e[_0xb6c7('0x65')],undefined,_0x37732b);if(_0x4e7eeb[_0xb6c7('0xa9')]!==-0x1){this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x131'),_0x5575df));var _0x4afacb=this[_0xb6c7('0x8c')]['sync'](this,_0x46ff1e,_0x5575df);if(_0x4afacb){for(var _0x5717d4 in _0x4afacb){if(_0x4afacb[_0xb6c7('0x98')](_0x5717d4)){this[_0xb6c7('0xc')]['setVariable'](util['format'](_0xb6c7('0x132'),_0x5717d4['toUpperCase']()),_0x4afacb[_0x5717d4]);}}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x133'),JSON[_0xb6c7('0x74')](_0x4afacb)));}}return _0x4e7eeb;};AGIVertices[_0xb6c7('0x12')]['tildeasr']=function(_0x2422c5){logger['info'](util[_0xb6c7('0x27')](_0xb6c7('0x134'),_0x2422c5['label']));if(!this['isConfigured'](_0x2422c5[_0xb6c7('0x8f')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0x135'));}if(!this['isConfigured'](_0x2422c5[_0xb6c7('0x90')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0x136'));}var _0x3e7fe7=_0xb6c7('0x137');var _0x367c7f=util[_0xb6c7('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0xb6c7('0x117')](0x4));var _0x22c056=util[_0xb6c7('0x27')](_0xb6c7('0x9b'),_0x367c7f,_0x3e7fe7);var _0x3294fe=!![];if(_0x2422c5[_0xb6c7('0x12d')]===_0xb6c7('0x12e')){_0x3294fe=![];}var _0x5bc8e7=this[_0xb6c7('0xc')][_0xb6c7('0x12f')](_0x367c7f,_0x3e7fe7,_0x2422c5[_0xb6c7('0x130')],_0x2422c5[_0xb6c7('0x65')],undefined,_0x3294fe);if(_0x5bc8e7[_0xb6c7('0xa9')]!==-0x1){this[_0xb6c7('0xc')]['noop'](util[_0xb6c7('0x27')](_0xb6c7('0x138'),_0x22c056));var _0x49fb00=this['tildeASR'][_0xb6c7('0x71')](this,_0x2422c5,_0x22c056);if(_0x49fb00){for(var _0x18f1aa in _0x49fb00){if(_0x49fb00['hasOwnProperty'](_0x18f1aa)){this['channel'][_0xb6c7('0x9c')](util[_0xb6c7('0x27')](_0xb6c7('0x139'),_0x18f1aa[_0xb6c7('0x6a')]()),_0x49fb00[_0x18f1aa]);}}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xb6c7('0x74')](_0x49fb00)));}}return _0x5bc8e7;};AGIVertices[_0xb6c7('0x12')]['gotoc']=function(_0x3b1920){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3b1920['label']));return this[_0xb6c7('0xc')][_0xb6c7('0x13a')](_0x3b1920[_0xb6c7('0x3a')],_0x3b1920[_0xb6c7('0x3b')],_0x3b1920[_0xb6c7('0x3c')]);};AGIVertices['prototype'][_0xb6c7('0x13b')]=function(_0x9c02c7){logger['info'](util[_0xb6c7('0x27')](_0xb6c7('0x13c'),_0x9c02c7[_0xb6c7('0x35')]));if(!this['isConfigured'](_0x9c02c7['condition'])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x9c02c7,_0xb6c7('0x13d'));}try{var _0x13af1d=eval(_0x9c02c7[_0xb6c7('0x13e')])?'true':'false';this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x9c02c7[_0xb6c7('0x13e')],_0x13af1d));return{'code':0xc8,'result':_0x13af1d};}catch(_0x1c8155){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x13f')]=function(_0x337fd8){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x337fd8[_0xb6c7('0x35')]));if(!this['isConfigured'](_0x337fd8[_0xb6c7('0x140')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x337fd8,'no\x20interval\x20configured');}var _0x479b5d=this[_0xb6c7('0x21')][_0xb6c7('0x71')](this,_0x337fd8[_0xb6c7('0x140')]);if(!_0x479b5d){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x337fd8,_0xb6c7('0x141'));}for(var _0x22f81c=0x0;_0x22f81c<_0x479b5d[_0xb6c7('0x97')];_0x22f81c+=0x1){var _0x24dc7c=this[_0xb6c7('0xc')]['getVariable'](util['format'](_0xb6c7('0x142'),_0x479b5d[_0x22f81c]));if(_0x24dc7c[_0xb6c7('0xa9')]===-0x1){return _0x24dc7c;}logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x143'),_0x479b5d[_0x22f81c],_0x24dc7c[_0xb6c7('0xa0')]));if(_0x24dc7c[_0xb6c7('0xa0')]===_0xb6c7('0x144')){logger['info'](util[_0xb6c7('0x27')](_0xb6c7('0x143'),_0x479b5d[_0x22f81c],_0xb6c7('0x144')));this['channel'][_0xb6c7('0xaa')](util['format'](_0xb6c7('0x143'),_0x479b5d[_0x22f81c],_0xb6c7('0x144')));return{'code':0xc8,'result':_0xb6c7('0x144')};}else{logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x143'),_0x479b5d[_0x22f81c],_0xb6c7('0x145')));this['channel'][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('IFTIME\x20%s\x20%s',_0x479b5d[_0x22f81c],_0xb6c7('0x145')));}}return{'code':0xc8,'result':_0xb6c7('0x145')};};AGIVertices['prototype'][_0xb6c7('0x146')]=function(_0x3235ee){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3235ee[_0xb6c7('0x35')]));return this['channel'][_0xb6c7('0x146')]();};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x147')]=function(_0xc5fca5){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x148'),_0xc5fca5[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0xc5fca5['key'])){return this['channel'][_0xb6c7('0xaa')]('no\x20key\x20configured');}var _0x530dd1=_0xb6c7('0x137');var _0x2c901c=util[_0xb6c7('0x27')](_0xb6c7('0x149'),FILES_PATH,rs[_0xb6c7('0x117')](0x4));var _0x46d82b=util['format'](_0xb6c7('0x9b'),_0x2c901c,_0x530dd1);var _0x523483=!![];if(_0xc5fca5['beep']==='NOBEEP'){_0x523483=![];}var _0x215f99=this['channel'][_0xb6c7('0x12f')](_0x2c901c,_0x530dd1,_0xc5fca5[_0xb6c7('0x130')],_0xc5fca5[_0xb6c7('0x65')],undefined,_0x523483);if(_0x215f99[_0xb6c7('0xa9')]!==-0x1){this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('ispeech\x20%s\x20file\x20created',_0x46d82b));var _0x6d1829=this[_0xb6c7('0x14a')][_0xb6c7('0x71')](this,_0xc5fca5,_0x46d82b);if(_0x6d1829){for(var _0x5df8bc in _0x6d1829){if(_0x6d1829[_0xb6c7('0x98')](_0x5df8bc)){this['channel']['setVariable'](util['format'](_0xb6c7('0x14b'),_0x5df8bc['toUpperCase']()),_0x6d1829[_0x5df8bc]);}}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x6d1829)));}}return _0x215f99;};AGIVertices['prototype'][_0xb6c7('0x14c')]=function(_0x332402){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x14d'),_0x332402[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x332402['key'])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')]('no\x20key\x20configured');}if(!this[_0xb6c7('0x82')](_0x332402[_0xb6c7('0x5b')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')]('no\x20text\x20configured');}this[_0xb6c7('0xc')]['noop'](util[_0xb6c7('0x27')](_0xb6c7('0x14e'),_0x332402[_0xb6c7('0x5b')]));var _0x1e35cd=this[_0xb6c7('0x7f')][_0xb6c7('0x71')](this,_0x332402);if(_0x1e35cd){this['channel'][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x14f'),_0x1e35cd));var _0x390387=this['channel'][_0xb6c7('0x101')](_0x1e35cd,_0x332402['intKey']);try{fs[_0xb6c7('0x102')](_0x1e35cd+_0xb6c7('0x103'));}catch(_0x5b6561){logger[_0xb6c7('0x2a')](_0x5b6561);}return _0x390387;}return this['channel'][_0xb6c7('0x2a')](_0x332402,_0xb6c7('0x150'));};AGIVertices['prototype']['login']=function(_0x18eede){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x151'),_0x18eede[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x18eede[_0xb6c7('0x152')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x18eede,_0xb6c7('0x153'));}logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x154'),this[_0xb6c7('0xc')][_0xb6c7('0x37')],_0x18eede[_0xb6c7('0x152')]));var _0x3e5c39=this[_0xb6c7('0x54')][_0xb6c7('0x71')](this,_0x18eede['findBy']);if(_0x3e5c39){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x155'),this[_0xb6c7('0xc')][_0xb6c7('0x37')],_0x18eede['findBy']));this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format'](_0xb6c7('0x155'),this['channel'][_0xb6c7('0x37')],_0x18eede['findBy']));return{'code':0xc8,'result':_0xb6c7('0x156')};}else{logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x157'),this[_0xb6c7('0xc')][_0xb6c7('0x37')],_0x18eede['findBy']));this['channel'][_0xb6c7('0xaa')](util['format'](_0xb6c7('0x157'),this[_0xb6c7('0xc')][_0xb6c7('0x37')],_0x18eede[_0xb6c7('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb6c7('0x12')]['logout']=function(_0x426553){logger['info'](util[_0xb6c7('0x27')](_0xb6c7('0x158'),_0x426553['label']));if(!this[_0xb6c7('0x82')](_0x426553[_0xb6c7('0x152')])){return this[_0xb6c7('0xc')]['error'](_0x426553,_0xb6c7('0x153'));}logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xb6c7('0x37')],_0x426553[_0xb6c7('0x152')]));var _0x46ecc8=this[_0xb6c7('0x53')][_0xb6c7('0x71')](this,_0x426553[_0xb6c7('0x152')]);if(_0x46ecc8){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x155'),this[_0xb6c7('0xc')]['callerid'],_0x426553[_0xb6c7('0x152')]));this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xb6c7('0xc')][_0xb6c7('0x37')],_0x426553['findBy']));return{'code':0xc8,'result':_0xb6c7('0x156')};}else{logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x157'),this[_0xb6c7('0xc')][_0xb6c7('0x37')],_0x426553[_0xb6c7('0x152')]));this[_0xb6c7('0xc')]['noop'](util[_0xb6c7('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb6c7('0xc')]['callerid'],_0x426553[_0xb6c7('0x152')]));return{'code':0xc8,'result':_0xb6c7('0x159')};}};AGIVertices['prototype'][_0xb6c7('0x15a')]=function(_0xa72e73){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x15b'),_0xa72e73[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0xa72e73['operation'])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0xa72e73,_0xb6c7('0x15c'));}this[_0xb6c7('0xc')]['noop'](util[_0xb6c7('0x27')](_0xb6c7('0x15d'),_0xa72e73[_0xb6c7('0x15e')]));var _0x186ca5=eval(_0xa72e73['operation']);if(!this[_0xb6c7('0x82')](_0xa72e73[_0xb6c7('0xd4')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0xd5'));}var _0x3f1b92=this[_0xb6c7('0x9f')][_0xb6c7('0x71')](this,_0xa72e73[_0xb6c7('0xd4')]);if(!_0x3f1b92){return this[_0xb6c7('0xc')]['error'](_0xa72e73,_0xb6c7('0xd6'));}if(_[_0xb6c7('0x96')](_0x186ca5)){var _0x19b611=this;_0x186ca5[_0xb6c7('0xd8')](function(_0x513dab,_0x163da4){_0x19b611[_0xb6c7('0xc')][_0xb6c7('0x9c')](util[_0xb6c7('0x27')]('%s[%s]',_0x3f1b92,_0x163da4),_0x513dab);});return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x15f'),_0x3f1b92));}else{return this['channel'][_0xb6c7('0x9c')](_0x3f1b92,_0x186ca5);}};AGIVertices[_0xb6c7('0x12')]['menu']=function(_0x149ca2){logger['info'](util[_0xb6c7('0x27')](_0xb6c7('0x160'),_0x149ca2[_0xb6c7('0x35')]));if(_0x149ca2[_0xb6c7('0xa4')]===0x0){return this[_0xb6c7('0xa3')](_0x149ca2);}_0x149ca2[_0xb6c7('0xa4')]-=0x1;if(!this[_0xb6c7('0x82')](_0x149ca2[_0xb6c7('0x110')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x149ca2,_0xb6c7('0x161'));}var _0xb5ef7c=this[_0xb6c7('0x1c')][_0xb6c7('0x71')](this,_0x149ca2[_0xb6c7('0x110')]);if(!_0xb5ef7c){return this['channel'][_0xb6c7('0x2a')](_0x149ca2,_0xb6c7('0x111'));}var _0x522e45=this[_0xb6c7('0xc')]['getData'](_0xb5ef7c,_0x149ca2[_0xb6c7('0x112')],_0x149ca2['digit']);var _0x19809e=_0x522e45[_0xb6c7('0xa9')];if(_0x522e45[_0xb6c7('0xa9')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x149ca2,'-1');return _0x522e45;}else if(_0x522e45[_0xb6c7('0xa0')]==='timeout'){_0x522e45[_0xb6c7('0xa9')]=_0x522e45[_0xb6c7('0xa9')][_0xb6c7('0x97')]>0x0?_0x522e45[_0xb6c7('0xa9')]:'t';}else if(_[_0xb6c7('0x42')](_0x522e45[_0xb6c7('0xa9')])){_0x522e45['result']='#';_0x19809e='#';}if(!this[_0xb6c7('0x82')](_0x149ca2[_0xb6c7('0xd4')])){this['channel'][_0xb6c7('0xaa')](_0xb6c7('0xd5'));}else{var _0x4da5be=this[_0xb6c7('0x9f')][_0xb6c7('0x71')](this,_0x149ca2['variable_id']);if(!_0x4da5be){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x149ca2,'no\x20variable\x20found');}this[_0xb6c7('0xc')][_0xb6c7('0x9c')](_0x4da5be,_0x19809e);}this['createSquareDetailsReport']['sync'](this,_0x149ca2,_0x19809e);return _0x522e45;};AGIVertices['prototype'][_0xb6c7('0xaa')]=function(_0x2a57cd){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2a57cd['label']));return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0x2a57cd[_0xb6c7('0x162')]||_0x2a57cd[_0xb6c7('0x35')]);};AGIVertices['prototype'][_0xb6c7('0x163')]=function(_0x525c77){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x164'),_0x525c77['label']));if(!this[_0xb6c7('0x82')](_0x525c77[_0xb6c7('0x152')])){return this[_0xb6c7('0xc')]['error'](_0x525c77,_0xb6c7('0x153'));}logger['info'](util[_0xb6c7('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb6c7('0xc')]['callerid'],_0x525c77[_0xb6c7('0x152')]));var _0x12e8c3=this[_0xb6c7('0x4e')][_0xb6c7('0x71')](this,_0x525c77[_0xb6c7('0x165')]);var _0x3782b3=this[_0xb6c7('0x50')]['sync'](this,_0x525c77[_0xb6c7('0x152')],_0x12e8c3);if(_0x3782b3){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x155'),this[_0xb6c7('0xc')][_0xb6c7('0x37')],_0x525c77[_0xb6c7('0x152')]));this['channel']['noop'](util[_0xb6c7('0x27')](_0xb6c7('0x155'),this[_0xb6c7('0xc')][_0xb6c7('0x37')],_0x525c77[_0xb6c7('0x152')]));return{'code':0xc8,'result':_0xb6c7('0x156')};}else{logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x157'),this['channel'][_0xb6c7('0x37')],_0x525c77[_0xb6c7('0x152')]));this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x155'),this[_0xb6c7('0xc')][_0xb6c7('0x37')],_0x525c77[_0xb6c7('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xb6c7('0x166')]=function(_0x51b5ff){logger['info'](util['format'](_0xb6c7('0x167'),_0x51b5ff[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x51b5ff[_0xb6c7('0x110')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x51b5ff,_0xb6c7('0x161'));}var _0x317dad=this['getSound'][_0xb6c7('0x71')](this,_0x51b5ff['file_id']);if(!_0x317dad){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x51b5ff,_0xb6c7('0x111'));}var _0x481821=this['channel'][_0xb6c7('0x55')](_0xb6c7('0x168'),[_0x317dad,_0x51b5ff[_0xb6c7('0x10d')]]);if(_0x481821[_0xb6c7('0xa9')]===-0x1){return _0x481821;}return this[_0xb6c7('0xc')]['noop'](util[_0xb6c7('0x27')](_0xb6c7('0xc1'),_0xb6c7('0x168'),_0x317dad));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x169')]=function(_0x422645){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x16a'),_0x422645[_0xb6c7('0x35')]));if(!this['isConfigured'](_0x422645[_0xb6c7('0x16b')])){return this['channel'][_0xb6c7('0x2a')](_0x422645,'no\x20queue\x20selected');}var _0x536cb0='';var _0x42429c=parseInt(_0x422645[_0xb6c7('0x16b')],0xa);if(isNaN(_0x42429c)){_0x536cb0=_0x422645[_0xb6c7('0x16b')];}else{_0x536cb0=this[_0xb6c7('0x13')]['sync'](this,_0x422645[_0xb6c7('0x16b')]);if(!_0x536cb0){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x422645,_0xb6c7('0x16c'));}}var _0x2cfb8='';if(this['isConfigured'](_0x422645[_0xb6c7('0x110')])){var _0xfcb43f=this[_0xb6c7('0x1c')][_0xb6c7('0x71')](this,_0x422645[_0xb6c7('0x110')]);if(_0xfcb43f){_0x2cfb8=_0xfcb43f;}}this[_0xb6c7('0x33')][_0xb6c7('0x71')](this,_0x422645,_0x536cb0);if(_0x422645[_0xb6c7('0x10d')][_0xb6c7('0x16d')]('x')<0x0){_0x422645['opts']+='x';}if(_0x422645[_0xb6c7('0x10d')][_0xb6c7('0x16d')]('X')<0x0){_0x422645['opts']+='X';}this[_0xb6c7('0xc')]['setVariable']('XMCS-QUEUE',_0x536cb0?_0x536cb0[_0xb6c7('0x16e')]():'');var _0x3ef776=this[_0xb6c7('0xc')][_0xb6c7('0x55')](_0xb6c7('0x16f'),[_0x536cb0,_0x422645[_0xb6c7('0x10d')],_0x422645[_0xb6c7('0x63')],_0x2cfb8,_0x422645[_0xb6c7('0x65')],_0x422645[_0xb6c7('0xb5')],_0x422645[_0xb6c7('0x170')],_0x422645[_0xb6c7('0x171')],'',_0x422645[_0xb6c7('0x172')]]);if(_0x3ef776[_0xb6c7('0xa9')]===-0x1){return _0x3ef776;}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format'](_0xb6c7('0xc1'),_0xb6c7('0x16f'),_0x536cb0));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x173')]=function(_0x2c2bdb){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x174'),_0x2c2bdb[_0xb6c7('0x35')]));var _0x297f45=_0x2c2bdb[_0xb6c7('0x175')]||_0xb6c7('0x137');var _0x9a33d4=util[_0xb6c7('0x27')](_0xb6c7('0x176'),this[_0xb6c7('0xc')][_0xb6c7('0x34')],rs[_0xb6c7('0x117')](0x5));var _0x5c4e99=util[_0xb6c7('0x27')](_0xb6c7('0x177'),FILES_PATH,_0x9a33d4,_0x297f45);var _0x8a0112=util['format']('%s/recordings/%s',FILES_PATH,_0x9a33d4);this[_0xb6c7('0x38')][_0xb6c7('0x71')](this,_0x2c2bdb,_0x9a33d4,_0x5c4e99);this[_0xb6c7('0xc')][_0xb6c7('0x9c')]('RECORDING_SAVENAME',_0x9a33d4);logger[_0xb6c7('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x8a0112,_0x297f45,_0x2c2bdb[_0xb6c7('0x178')],_0x2c2bdb['timeout']);return this[_0xb6c7('0xc')]['recordFile'](_0x8a0112,_0x297f45,_0x2c2bdb[_0xb6c7('0x178')],_0x2c2bdb[_0xb6c7('0x65')],undefined,!![]);};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x179')]=function(_0x37d29b){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x17a'),_0x37d29b[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x37d29b['url'])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x17b'));}var _0x52bb7a=this['restAPI'][_0xb6c7('0x71')](this,_0x37d29b);logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')]('Response:',util[_0xb6c7('0x17c')](_0x52bb7a,{'showHidden':![],'depth':null})));if(!this[_0xb6c7('0x82')](_0x37d29b[_0xb6c7('0xd4')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x17d'));}var _0x1c4a54=this[_0xb6c7('0x9f')][_0xb6c7('0x71')](this,_0x37d29b['variable_id']);if(!_0x1c4a54){return this['channel'][_0xb6c7('0x2a')](_0x37d29b,_0xb6c7('0xd6'));}this[_0xb6c7('0xc')][_0xb6c7('0x9c')](util[_0xb6c7('0x27')]('%s_STATUS_CODE',_0x1c4a54),_0x52bb7a[_0xb6c7('0x76')]?_0x52bb7a[_0xb6c7('0x76')]:_0xb6c7('0x17e'));this['channel'][_0xb6c7('0x9c')](util[_0xb6c7('0x27')](_0xb6c7('0x17f'),_0x1c4a54),_0x52bb7a[_0xb6c7('0x180')]?_0x52bb7a[_0xb6c7('0x180')]:'OK');if(_0x52bb7a[_0xb6c7('0x6b')]){try{this[_0xb6c7('0x9a')](_0x52bb7a[_0xb6c7('0x6b')],_0x1c4a54);}catch(_0x1e7f31){logger[_0xb6c7('0x2a')](util[_0xb6c7('0x27')](_0xb6c7('0x181'),_0x1c4a54));}}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format'](_0xb6c7('0xda'),_0x1c4a54));};AGIVertices[_0xb6c7('0x12')]['saydigits']=function(_0x2690da){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x182'),_0x2690da[_0xb6c7('0x35')]));return this[_0xb6c7('0xc')][_0xb6c7('0x183')](_0x2690da[_0xb6c7('0x184')][_0xb6c7('0x57')](/\s+/g,''),_0x2690da[_0xb6c7('0x178')]);};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x185')]=function(_0x4ea598){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x186'),_0x4ea598['label']));return this['channel'][_0xb6c7('0x187')](_0x4ea598[_0xb6c7('0x66')]['replace'](/\s+/g,''),_0x4ea598[_0xb6c7('0x178')]);};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x188')]=function(_0x3e0262){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x189'),_0x3e0262[_0xb6c7('0x35')]));return this[_0xb6c7('0xc')][_0xb6c7('0x18a')](_0x3e0262[_0xb6c7('0x5b')],_0x3e0262['escape_digits']);};AGIVertices['prototype']['sendMail']=function(_0x534432){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x534432[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x534432[_0xb6c7('0x18b')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x18c'));}var _0x28fa15=this[_0xb6c7('0x1e')][_0xb6c7('0x71')](this,_0x534432[_0xb6c7('0x18b')]);if(!_0x28fa15||!_0x28fa15['Smtp']){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x534432,_0xb6c7('0x18d'));}var _0x2f447d={'from':util[_0xb6c7('0x27')](_0xb6c7('0x18e'),_0x28fa15[_0xb6c7('0x11')],_0x28fa15['email']||_0x28fa15[_0xb6c7('0x18f')][_0xb6c7('0x190')]),'to':_0x534432['to']||'','cc':_0x534432['cc']||'','bcc':_0x534432[_0xb6c7('0x191')]||'','subject':_0x534432[_0xb6c7('0x192')],'html':_0x534432[_0xb6c7('0x5b')],'text':_0x534432[_0xb6c7('0x5b')]};if(this[_0xb6c7('0x82')](_0x534432[_0xb6c7('0x193')])){}logger[_0xb6c7('0xdc')](_0xb6c7('0x194'),JSON[_0xb6c7('0x74')](_0x2f447d));this[_0xb6c7('0x33')][_0xb6c7('0x71')](this,_0x534432,_0x534432[_0xb6c7('0x18b')]);this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x195'),_0x28fa15[_0xb6c7('0x11')]));this[_0xb6c7('0x20')][_0xb6c7('0x71')](this,_0x28fa15[_0xb6c7('0x196')],_0x2f447d);return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x197'));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x198')]=function(_0x56f55b){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x199'),_0x56f55b['label']));return this[_0xb6c7('0xc')][_0xb6c7('0xaa')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x19a')]=function(_0x191ba5){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x19b'),_0x191ba5['label']));if(!this[_0xb6c7('0x82')](_0x191ba5[_0xb6c7('0x19c')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x19d'));}var _0x3c5669=this[_0xb6c7('0x31')]['sync'](this,_0x191ba5[_0xb6c7('0x19c')]);if(!_0x3c5669){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x191ba5,_0xb6c7('0x19e'));}var _0x495dc7={'body':_0x191ba5[_0xb6c7('0x19f')],'phone':_0x191ba5['to']||'','SmsAccountId':_0x3c5669['id']};logger[_0xb6c7('0xdc')](_0xb6c7('0x1a0'),JSON['stringify'](_0x495dc7));this['createSquareDetailsReport']['sync'](this,_0x191ba5,_0x191ba5[_0xb6c7('0x19c')]);this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util['format'](_0xb6c7('0x1a1'),_0x3c5669[_0xb6c7('0x11')]));this['createSmsMessage']['sync'](this,_0x495dc7);return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x1a2'));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x1a3')]=function(_0x151de2){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x1a4'),_0x151de2[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x151de2[_0xb6c7('0xd4')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x151de2,_0xb6c7('0x1a5'));}var _0x44c4e3=this['getVariable'][_0xb6c7('0x71')](this,_0x151de2['variable_id']);if(!_0x44c4e3){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x151de2,_0xb6c7('0xd6'));}return this[_0xb6c7('0xc')][_0xb6c7('0x9c')](_0x44c4e3,_0x151de2[_0xb6c7('0x1a6')]);};AGIVertices[_0xb6c7('0x12')]['start']=function(_0x2f9cd7){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x1a7'),_0x2f9cd7['label']));this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x1a8'));var _0x109a3f=this[_0xb6c7('0xc')]['getVariable'](_0xb6c7('0x1a9'));if(!_['isEmpty'](_0x109a3f['extra'])){this['channel'][_0xb6c7('0x34')]=_0x109a3f[_0xb6c7('0xa0')];}if(_0x2f9cd7['answer']==='yes'){this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0x1aa'));return this[_0xb6c7('0xc')]['answer']();}return this['channel']['noop']('Skipped\x20Answer');};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x1ab')]=function(_0x3646a2){logger['info'](util[_0xb6c7('0x27')](_0xb6c7('0x1ac'),_0x3646a2[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x3646a2[_0xb6c7('0x1ad')])){return this[_0xb6c7('0xc')]['error'](_0x3646a2,_0xb6c7('0x1ae'));}var _0x4b4fb0=this[_0xb6c7('0x1af')][_0xb6c7('0x71')](this,_0x3646a2[_0xb6c7('0x1ad')]);if(!this[_0xb6c7('0x82')](_0x4b4fb0)){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x3646a2,util[_0xb6c7('0x27')](_0xb6c7('0x1b0'),_0x3646a2[_0xb6c7('0x1ad')]));}if(_0x4b4fb0===this[_0xb6c7('0xc')][_0xb6c7('0x1b1')]){return this['channel']['error'](_0x3646a2,_0xb6c7('0x1b2'));}this['createSquareDetailsReport'][_0xb6c7('0x71')](this,_0x3646a2,_0x4b4fb0);var _0x3e7d5f=this[_0xb6c7('0xc')]['exec'](_0xb6c7('0x1b3'),util['format'](_0xb6c7('0x1b4'),config[_0xb6c7('0xb5')]['host']||_0xb6c7('0x1b5'),_0x4b4fb0,this[_0xb6c7('0xc')]['arg_1']));if(_0x3e7d5f[_0xb6c7('0xa9')]===-0x1){return _0x3e7d5f;}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('Executed\x20command\x20%s\x20%s',_0xb6c7('0x1b3'),_0x4b4fb0));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x1b6')]=function(_0xd5f1cf){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x1b7'),_0xd5f1cf[_0xb6c7('0x35')]));var _0x56970f=this[_0xb6c7('0x1b8')]['sync'](this,_0xd5f1cf[_0xb6c7('0xb7')]);this[_0xb6c7('0x33')]['sync'](this,_0xd5f1cf,_0xd5f1cf['command']);if(this['isConfigured'](_0xd5f1cf[_0xb6c7('0xd4')])){var _0x39f859=this[_0xb6c7('0x9f')][_0xb6c7('0x71')](this,_0xd5f1cf[_0xb6c7('0xd4')]);if(_0x39f859){this[_0xb6c7('0xc')][_0xb6c7('0x9c')](_0x39f859,_0x56970f);return this[_0xb6c7('0xc')]['noop'](util['format'](_0xb6c7('0x1b9'),_0xd5f1cf['command'],_0x39f859));}}return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xd5f1cf[_0xb6c7('0xb7')]));};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x1ba')]=function(_0x56e216){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x1bb'),_0x56e216['label']));_0x56e216[_0xb6c7('0x5b')]=_0x56e216[_0xb6c7('0x5b')][_0xb6c7('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb6c7('0x82')](_0x56e216[_0xb6c7('0x59')])){return this['channel'][_0xb6c7('0xaa')](_0xb6c7('0x1bc'));}if(!this[_0xb6c7('0x82')](_0x56e216[_0xb6c7('0x5b')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel'][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x1bd'),_0x56e216[_0xb6c7('0x5b')]));var _0x16d635=this[_0xb6c7('0x58')][_0xb6c7('0x71')](this,_0x56e216);if(_0x16d635){this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x1be'),_0x16d635));var _0x5dff85=this['channel'][_0xb6c7('0x101')](_0x16d635);try{fs[_0xb6c7('0x102')](_0x16d635+'.wav');}catch(_0x95756a){logger[_0xb6c7('0x2a')](_0x95756a);}return _0x5dff85;}return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x56e216,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xb6c7('0x12')][_0xb6c7('0x1bf')]=function(_0x2dd1ab){logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x1c0'),_0x2dd1ab[_0xb6c7('0x35')]));_0x2dd1ab['text']=_0x2dd1ab['text'][_0xb6c7('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2dd1ab[_0xb6c7('0x5b')])){return this[_0xb6c7('0xc')][_0xb6c7('0xaa')](_0xb6c7('0xa7'));}this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')](_0xb6c7('0x1c1'),_0x2dd1ab[_0xb6c7('0x5b')]));var _0x2fd027=this[_0xb6c7('0x60')][_0xb6c7('0x71')](this,_0x2dd1ab);if(_0x2fd027){this['channel'][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('Google\x20TTS\x20%s\x20file\x20created',_0x2fd027));var _0x3cce0e=this[_0xb6c7('0xc')][_0xb6c7('0x101')](_0x2fd027);try{fs[_0xb6c7('0x102')](_0x2fd027+_0xb6c7('0x103'));}catch(_0x246efe){logger[_0xb6c7('0x2a')](_0x246efe);}return _0x3cce0e;}return this['channel'][_0xb6c7('0x2a')](_0x2dd1ab,_0xb6c7('0x1c2'));};AGIVertices['prototype'][_0xb6c7('0x1c3')]=function(_0x15ce31){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x1c4'),_0x15ce31[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x15ce31[_0xb6c7('0x152')])){return this['channel'][_0xb6c7('0x2a')](_0x15ce31,_0xb6c7('0x153'));}logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x154'),this[_0xb6c7('0xc')]['callerid'],_0x15ce31['findBy']));var _0x4ca004=this[_0xb6c7('0x52')][_0xb6c7('0x71')](this,_0x15ce31[_0xb6c7('0x152')]);if(_0x4ca004){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb6c7('0x37')],_0x15ce31['findBy']));this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb6c7('0xc')][_0xb6c7('0x37')],_0x15ce31[_0xb6c7('0x152')]));return{'code':0xc8,'result':_0xb6c7('0x156')};}else{logger[_0xb6c7('0x2c')](util['format'](_0xb6c7('0x157'),this[_0xb6c7('0xc')]['callerid'],_0x15ce31[_0xb6c7('0x152')]));this[_0xb6c7('0xc')][_0xb6c7('0xaa')](util[_0xb6c7('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb6c7('0xc')]['callerid'],_0x15ce31[_0xb6c7('0x152')]));return{'code':0xc8,'result':_0xb6c7('0x159')};}};AGIVertices['prototype']['voicemail']=function(_0x20231a){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x1c5'),_0x20231a[_0xb6c7('0x35')]));var _0x533fc6=this[_0xb6c7('0xc')][_0xb6c7('0x55')](_0xb6c7('0x1c6'),[_0x20231a[_0xb6c7('0x1c7')],_0x20231a[_0xb6c7('0x79')]]);if(_0x533fc6['result']===-0x1){return _0x533fc6;}return this['channel']['noop'](util[_0xb6c7('0x27')]('Executed\x20command\x20%s\x20%s',_0xb6c7('0x1c6'),_0x20231a[_0xb6c7('0x1c7')]));};AGIVertices['prototype']['vswitch']=function(_0x43cf04){logger[_0xb6c7('0x2c')](util[_0xb6c7('0x27')](_0xb6c7('0x1c8'),_0x43cf04[_0xb6c7('0x35')]));if(!this[_0xb6c7('0x82')](_0x43cf04[_0xb6c7('0xd4')])){return this[_0xb6c7('0xc')][_0xb6c7('0x2a')](_0x43cf04,'no\x20variable\x20selected');}var _0x16ce4b=this[_0xb6c7('0x9f')][_0xb6c7('0x71')](this,_0x43cf04['variable_id']);if(!_0x16ce4b){return this['channel'][_0xb6c7('0x2a')](_0x43cf04,_0xb6c7('0xd6'));}var _0x1be2d2=this['channel'][_0xb6c7('0x9f')](_0x16ce4b);return{'code':0xc8,'result':_0x1be2d2[_0xb6c7('0xa0')]?_0x1be2d2[_0xb6c7('0xa0')]:'-'};};String[_0xb6c7('0x12')]['replaceAll']=function(_0x12d9ac,_0x28c068){return this['split'](_0x12d9ac)[_0xb6c7('0x1c9')](_0x28c068);};module[_0xb6c7('0x1ca')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index bf04208..d4f3649 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3752=['syncAgentConnectPreview','milliseconds','diff','seconds','lastPauseAt','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','interface','queue','ACW','mandatoryDispositionPause','resolve','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','updateAcw','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview'];(function(_0x4c6b10,_0x42e824){var _0x458f1c=function(_0x47a5af){while(--_0x47a5af){_0x4c6b10['push'](_0x4c6b10['shift']());}};_0x458f1c(++_0x42e824);}(_0x3752,0x95));var _0x2375=function(_0x4d4696,_0x1ab3a2){_0x4d4696=_0x4d4696-0x0;var _0x455048=_0x3752[_0x4d4696];return _0x455048;};'use strict';var _=require(_0x2375('0x0'));var moment=require(_0x2375('0x1'));var ami=require(_0x2375('0x2'));var logger=require('../../../config/logger')(_0x2375('0x3'));var RpcUser=require(_0x2375('0x4'));var RpcVoiceAgentReport=require(_0x2375('0x5'));function Acw(_0x1d062c){this[_0x2375('0x6')]=_0x1d062c['voiceQueues'];this[_0x2375('0x7')]=_0x1d062c[_0x2375('0x7')];this[_0x2375('0x8')]=_0x1d062c[_0x2375('0x8')];this[_0x2375('0x9')]={};ami['on'](_0x2375('0xa'),this[_0x2375('0xb')][_0x2375('0xc')](this));ami['on'](_0x2375('0xd'),this[_0x2375('0xe')][_0x2375('0xc')](this));ami['on'](_0x2375('0xf'),this[_0x2375('0x10')][_0x2375('0xc')](this));ami['on'](_0x2375('0x11'),this['syncAgentRingNoAnswer'][_0x2375('0xc')](this));ami['on']('attendedtransfer',this[_0x2375('0x12')][_0x2375('0xc')](this));ami['on'](_0x2375('0x13'),this['syncBlindTransfer'][_0x2375('0xc')](this));ami['on'](_0x2375('0x14'),this[_0x2375('0x15')]['bind'](this));}function getDiff(_0x587f44){var _0x432dba=moment()[_0x2375('0x16')](0x0);var _0x57dd2b=moment(_0x587f44)[_0x2375('0x16')](0x0);return _0x432dba[_0x2375('0x17')](_0x57dd2b,_0x2375('0x18'));}Acw['prototype']['updateAcw']=function(_0x14e90d,_0x594e6e){var _0x4070a5=this;var _0x5b7ccb=getDiff(_0x4070a5[_0x2375('0x8')][_0x14e90d][_0x2375('0x19')]);clearTimeout(_0x4070a5[_0x2375('0x8')][_0x14e90d][_0x2375('0x1a')]);_0x4070a5[_0x2375('0x8')][_0x14e90d]['timer']=![];return RpcVoiceAgentReport[_0x2375('0x1b')]({'acwtime':_0x5b7ccb},_0x4070a5['timers'][_0x14e90d][_0x2375('0x1c')],_0x14e90d)[_0x2375('0x1d')](function(_0x10297e){logger['info'](_0x2375('0x1e'),_0x594e6e,_0x5b7ccb,_0x10297e);})[_0x2375('0x1f')](function(_0xc5b83c){logger[_0x2375('0x20')]('[%s][UPDATE][ERRORS:%s]',_0x594e6e,_0xc5b83c);})[_0x2375('0x21')](function(){delete _0x4070a5[_0x2375('0x8')][_0x14e90d];});};Acw['prototype']['startAcw']=function(_0x39e6f5){try{var _0x523196=this;var _0x26ea78=this[_0x2375('0x9')][_0x39e6f5][_0x2375('0x22')];var _0x510eed=this[_0x2375('0x9')][_0x39e6f5][_0x2375('0x23')];var _0x43a82e=this[_0x2375('0x6')][_0x510eed];var _0x352242=![];var _0x309cd5=_0x2375('0x24');if(_0x43a82e['mandatoryDisposition']&&_0x43a82e[_0x2375('0x25')]['name']){_0x352242=!![];_0x309cd5=_0x43a82e[_0x2375('0x25')]['name'];}if(!_0x523196['agents'][_0x26ea78]){return Promise[_0x2375('0x26')]();}return RpcUser[_0x2375('0x27')](_0x523196['agents'][_0x26ea78]['id'])[_0x2375('0x1d')](function(_0x3570ba){if(!_0x3570ba||_0x3570ba[_0x2375('0x28')]){logger[_0x2375('0x29')](_0x2375('0x2a'),_0x39e6f5,_0x26ea78,_0x510eed);return;}logger[_0x2375('0x29')](_0x2375('0x2b'),_0x39e6f5,_0x26ea78,_0x510eed);var _0x4b5082=_0x523196[_0x2375('0x9')][_0x39e6f5][_0x2375('0x2c')]&&_0x523196[_0x2375('0x9')][_0x39e6f5][_0x2375('0x2d')]?_0x523196['channels'][_0x39e6f5][_0x2375('0x2d')]:_0x39e6f5;return RpcUser[_0x2375('0x2e')](_0x523196[_0x2375('0x7')][_0x26ea78],_0x309cd5,_0x4b5082)['then'](function(_0xfd031f){_0x523196[_0x2375('0x6')][_0x510eed][_0x2375('0x2f')]-=0x1;_0x523196[_0x2375('0x6')][_0x510eed]['paused']+=0x1;return _0xfd031f;});})['then'](function(_0x2ed799){if(_0x352242||!_0x2ed799){return;}_0x523196[_0x2375('0x8')][_0x26ea78]={};logger['info'](_0x2375('0x30'),_0x39e6f5,_0x523196['voiceQueues'][_0x510eed][_0x2375('0x31')],_0x26ea78,_0x510eed);_0x523196[_0x2375('0x8')][_0x26ea78][_0x2375('0x1a')]=setTimeout(_0x523196[_0x2375('0x32')]['bind'](_0x523196,_0x26ea78),_0x523196[_0x2375('0x6')][_0x510eed][_0x2375('0x31')]*0x3e8);_0x523196[_0x2375('0x8')][_0x26ea78]['lastPauseAt']=moment()['format'](_0x2375('0x33'));_0x523196[_0x2375('0x8')][_0x26ea78][_0x2375('0x1c')]=_0x39e6f5;_0x523196[_0x2375('0x8')][_0x26ea78][_0x2375('0x23')]=_0x510eed;_0x523196[_0x2375('0x8')][_0x26ea78]['updateAcw']=_0x523196[_0x2375('0x34')][_0x2375('0xc')](_0x523196,_0x26ea78,_0x39e6f5);})['catch'](function(){logger[_0x2375('0x20')](_0x2375('0x30'),_0x39e6f5,_0x523196['voiceQueues'][_0x510eed][_0x2375('0x31')],_0x26ea78,_0x510eed);})[_0x2375('0x21')](function(){delete _0x523196[_0x2375('0x9')][_0x39e6f5];});}catch(_0x3b1601){logger[_0x2375('0x20')](_0x2375('0x35'),_0x3b1601[_0x2375('0x36')]);}};Acw[_0x2375('0x37')][_0x2375('0x32')]=function(_0x2161b9){try{var _0x34fd32=this;if(_0x34fd32[_0x2375('0x8')][_0x2161b9]){_0x34fd32['timers'][_0x2161b9][_0x2375('0x1a')]=![];var _0x4cd7ab=_0x34fd32[_0x2375('0x8')][_0x2161b9][_0x2375('0x1c')];var _0x22d038=_0x34fd32['timers'][_0x2161b9][_0x2375('0x23')];var _0x31f709=_0x34fd32[_0x2375('0x6')][_0x22d038][_0x2375('0x31')];logger[_0x2375('0x29')](_0x2375('0x38'),_0x4cd7ab,_0x2161b9);RpcUser[_0x2375('0x27')](this['agents'][_0x2161b9]['id'])[_0x2375('0x1d')](function(_0x515837){if(_0x515837[_0x2375('0x39')]===_0x2375('0x24')){return RpcUser[_0x2375('0x3a')](_0x34fd32[_0x2375('0x7')][_0x2161b9]);}});RpcVoiceAgentReport[_0x2375('0x1b')]({'acwtime':_0x31f709,'agentacw':!![]},_0x4cd7ab,_0x2161b9)[_0x2375('0x1d')](function(_0x387a44){logger[_0x2375('0x29')](_0x2375('0x1e'),_0x4cd7ab,_0x31f709,_0x387a44);})[_0x2375('0x1f')](function(_0x1fcf01){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x4cd7ab,_0x1fcf01);});}else{logger[_0x2375('0x20')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x2161b9);if(_0x34fd32[_0x2375('0x8')]){logger[_0x2375('0x29')](_0x2375('0x3b'),JSON[_0x2375('0x3c')](_0x34fd32[_0x2375('0x8')]));}}}catch(_0x3a5a29){logger[_0x2375('0x20')](_0x2375('0x3d'),_0x3a5a29[_0x2375('0x36')]);}};Acw[_0x2375('0x37')][_0x2375('0xb')]=function(_0x3a3d7c){try{if(this[_0x2375('0x6')][_0x3a3d7c[_0x2375('0x23')]]&&(this['voiceQueues'][_0x3a3d7c[_0x2375('0x23')]]['acw']||this[_0x2375('0x6')][_0x3a3d7c['queue']][_0x2375('0x3e')])){if(this['agents'][_0x3a3d7c['interface']]){this['channels'][_0x3a3d7c[_0x2375('0x1c')]]={'queue':_0x3a3d7c[_0x2375('0x23')],'interface':_0x3a3d7c['interface'],'destlinkedid':_0x3a3d7c['destlinkedid']};}}}catch(_0x7f8c8f){logger['error'](_0x2375('0x3f'),_0x7f8c8f[_0x2375('0x36')]);}};Acw[_0x2375('0x37')]['syncAgentConnectPreview']=function(_0x24d642){try{if(this[_0x2375('0x6')][_0x24d642[_0x2375('0x23')]]&&(this['voiceQueues'][_0x24d642[_0x2375('0x23')]]['acw']||this['voiceQueues'][_0x24d642[_0x2375('0x23')]][_0x2375('0x3e')])){if(this['agents'][_0x24d642[_0x2375('0x22')]]){this[_0x2375('0x9')][_0x24d642['uniqueid']]={'queue':_0x24d642['queue'],'interface':_0x24d642[_0x2375('0x22')]};}}}catch(_0x5e25ff){logger[_0x2375('0x20')](_0x2375('0x40'),_0x5e25ff[_0x2375('0x36')]);}};Acw[_0x2375('0x37')][_0x2375('0xe')]=function(_0x4b0169){try{if(this[_0x2375('0x9')][_0x4b0169[_0x2375('0x1c')]]&&_[_0x2375('0x41')](this['channels'][_0x4b0169[_0x2375('0x1c')]]['attended'])){logger[_0x2375('0x29')]('[%s][HANGUP:UNIQUEID]',_0x4b0169[_0x2375('0x1c')]);this[_0x2375('0x42')](_0x4b0169[_0x2375('0x1c')]);}else if(this[_0x2375('0x9')][_0x4b0169[_0x2375('0x43')]]&&_[_0x2375('0x41')](this['channels'][_0x4b0169['linkedid']][_0x2375('0x2c')])){logger[_0x2375('0x29')]('[%s][HANGUP:LINKEDID]',_0x4b0169[_0x2375('0x43')]);this[_0x2375('0x42')](_0x4b0169[_0x2375('0x43')]);}}catch(_0x31bbca){logger[_0x2375('0x20')](_0x2375('0x44'),_0x31bbca['message']);}};Acw[_0x2375('0x37')][_0x2375('0x10')]=function(_0x2e4a56){try{if(this[_0x2375('0x9')][_0x2e4a56[_0x2375('0x1c')]]&&this[_0x2375('0x9')][_0x2e4a56[_0x2375('0x1c')]][_0x2375('0x2c')]){logger[_0x2375('0x29')](_0x2375('0x45'),_0x2e4a56[_0x2375('0x1c')]);this['startAcw'](_0x2e4a56[_0x2375('0x1c')]);}else if(this[_0x2375('0x9')][_0x2e4a56['linkedid']]&&this['channels'][_0x2e4a56[_0x2375('0x43')]][_0x2375('0x2c')]){logger[_0x2375('0x29')](_0x2375('0x46'),_0x2e4a56['linkedid']);this[_0x2375('0x42')](_0x2e4a56['linkedid']);}}catch(_0x366396){logger[_0x2375('0x20')]('[ACW][syncHangup]\x20%s',_0x366396[_0x2375('0x36')]);}};Acw[_0x2375('0x37')][_0x2375('0x12')]=function(_0x45af9e){try{if(!_[_0x2375('0x47')](this['channels'][_0x45af9e[_0x2375('0x48')]])){this[_0x2375('0x42')](_0x45af9e[_0x2375('0x48')]);if(this[_0x2375('0x9')][_0x45af9e[_0x2375('0x49')]]){this[_0x2375('0x9')][_0x45af9e['secondtransfereruniqueid']][_0x2375('0x2c')]=!![];this[_0x2375('0x9')][_0x45af9e[_0x2375('0x4a')]]=this[_0x2375('0x9')][_0x45af9e[_0x2375('0x49')]];delete this['channels'][_0x45af9e[_0x2375('0x49')]];}}else if(!_['isNil'](this[_0x2375('0x9')][_0x45af9e[_0x2375('0x4a')]])){this[_0x2375('0x42')](_0x45af9e[_0x2375('0x4a')]);if(this[_0x2375('0x9')][_0x45af9e['origtransfereruniqueid']]){this['channels'][_0x45af9e[_0x2375('0x4b')]][_0x2375('0x2c')]=!![];this[_0x2375('0x9')][_0x45af9e['transfereeuniqueid']]=this[_0x2375('0x9')][_0x45af9e[_0x2375('0x4b')]];delete this['channels'][_0x45af9e[_0x2375('0x4b')]];}}}catch(_0x4e4f88){logger[_0x2375('0x20')](_0x2375('0x4c'),_0x4e4f88[_0x2375('0x36')]);}};Acw[_0x2375('0x37')]['syncBlindTransfer']=function(_0x1411c0){try{if(this[_0x2375('0x9')][_0x1411c0[_0x2375('0x4d')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x2375('0x3c')](_0x1411c0[_0x2375('0x4d')]));this[_0x2375('0x42')](_0x1411c0[_0x2375('0x4d')]);}else if(this['channels'][_0x1411c0['transfererlinkedid']]){logger['info'](_0x2375('0x4e'),JSON[_0x2375('0x3c')](_0x1411c0[_0x2375('0x4f')]));this[_0x2375('0x42')](_0x1411c0[_0x2375('0x4f')]);}}catch(_0x11c869){logger['error'](_0x2375('0x50'),_0x11c869[_0x2375('0x36')]);}};Acw[_0x2375('0x37')][_0x2375('0x51')]=function(_0x2c592c){try{if(this[_0x2375('0x6')][_0x2c592c[_0x2375('0x23')]]&&this[_0x2375('0x6')][_0x2c592c['queue']][_0x2375('0x52')]==='all'){if(this[_0x2375('0x7')][_0x2c592c['interface']]){logger[_0x2375('0x29')](_0x2375('0x53'),_0x2c592c[_0x2375('0x1c')],_0x2c592c[_0x2375('0x22')],_0x2c592c['queue']);return RpcUser[_0x2375('0x2e')](this[_0x2375('0x7')][_0x2c592c['interface']],'Auto-Pause',_0x2c592c[_0x2375('0x1c')]);}}}catch(_0x562781){logger[_0x2375('0x20')](_0x2375('0x54'),_0x562781[_0x2375('0x36')]);}};module['exports']=Acw; \ No newline at end of file +var _0xe472=['acw','../rpc/user','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','ACW','mandatoryDispositionPause','name','resolve','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','available','acwTimeout','stopAcw','format','queue','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','getAgent','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','mandatoryDisposition','interface','[ACW][syncAgentConnect]\x20%s','uniqueid','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','isUndefined','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','moment','../ami'];(function(_0x997738,_0x4b8298){var _0x227380=function(_0x11ee71){while(--_0x11ee71){_0x997738['push'](_0x997738['shift']());}};_0x227380(++_0x4b8298);}(_0xe472,0x1a1));var _0x2e47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe472[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2e47('0x0'));var moment=require(_0x2e47('0x1'));var ami=require(_0x2e47('0x2'));var logger=require('../../../config/logger')(_0x2e47('0x3'));var RpcUser=require(_0x2e47('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x40abc8){this[_0x2e47('0x5')]=_0x40abc8[_0x2e47('0x5')];this[_0x2e47('0x6')]=_0x40abc8[_0x2e47('0x6')];this['timers']=_0x40abc8[_0x2e47('0x7')];this[_0x2e47('0x8')]={};ami['on']('agentconnect',this[_0x2e47('0x9')][_0x2e47('0xa')](this));ami['on'](_0x2e47('0xb'),this[_0x2e47('0xc')][_0x2e47('0xa')](this));ami['on']('hangup',this[_0x2e47('0xd')][_0x2e47('0xa')](this));ami['on']('agentringnoanswer',this[_0x2e47('0xe')][_0x2e47('0xa')](this));ami['on'](_0x2e47('0xf'),this['syncAttendedTransfer'][_0x2e47('0xa')](this));ami['on'](_0x2e47('0x10'),this[_0x2e47('0x11')]['bind'](this));ami['on'](_0x2e47('0x12'),this[_0x2e47('0x13')]['bind'](this));}function getDiff(_0x8b6c51){var _0x3cc25c=moment()[_0x2e47('0x14')](0x0);var _0xe9124=moment(_0x8b6c51)[_0x2e47('0x14')](0x0);return _0x3cc25c[_0x2e47('0x15')](_0xe9124,_0x2e47('0x16'));}Acw[_0x2e47('0x17')][_0x2e47('0x18')]=function(_0x4356a8,_0x2eca18){var _0x3d6e7c=this;var _0x5cbcf4=getDiff(_0x3d6e7c[_0x2e47('0x7')][_0x4356a8][_0x2e47('0x19')]);clearTimeout(_0x3d6e7c[_0x2e47('0x7')][_0x4356a8][_0x2e47('0x1a')]);_0x3d6e7c[_0x2e47('0x7')][_0x4356a8]['timer']=![];return RpcVoiceAgentReport[_0x2e47('0x1b')]({'acwtime':_0x5cbcf4},_0x3d6e7c[_0x2e47('0x7')][_0x4356a8]['uniqueid'],_0x4356a8)['then'](function(_0xc339bc){logger[_0x2e47('0x1c')](_0x2e47('0x1d'),_0x2eca18,_0x5cbcf4,_0xc339bc);})[_0x2e47('0x1e')](function(_0x376741){logger[_0x2e47('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x2eca18,_0x376741);})[_0x2e47('0x20')](function(){delete _0x3d6e7c[_0x2e47('0x7')][_0x4356a8];});};Acw[_0x2e47('0x17')]['startAcw']=function(_0x20ea5d){try{var _0x3550bc=this;var _0x200ee7=this[_0x2e47('0x8')][_0x20ea5d]['interface'];var _0x58af6f=this[_0x2e47('0x8')][_0x20ea5d]['queue'];var _0xb1e166=this[_0x2e47('0x5')][_0x58af6f];var _0x59a532=![];var _0x175f02=_0x2e47('0x21');if(_0xb1e166['mandatoryDisposition']&&_0xb1e166[_0x2e47('0x22')][_0x2e47('0x23')]){_0x59a532=!![];_0x175f02=_0xb1e166['mandatoryDispositionPause'][_0x2e47('0x23')];}if(!_0x3550bc[_0x2e47('0x6')][_0x200ee7]){return Promise[_0x2e47('0x24')]();}return RpcUser['getAgent'](_0x3550bc[_0x2e47('0x6')][_0x200ee7]['id'])['then'](function(_0x385f42){if(!_0x385f42||_0x385f42[_0x2e47('0x25')]){logger[_0x2e47('0x1c')](_0x2e47('0x26'),_0x20ea5d,_0x200ee7,_0x58af6f);return;}logger[_0x2e47('0x1c')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x20ea5d,_0x200ee7,_0x58af6f);var _0x3fa0da=_0x3550bc[_0x2e47('0x8')][_0x20ea5d][_0x2e47('0x27')]&&_0x3550bc[_0x2e47('0x8')][_0x20ea5d][_0x2e47('0x28')]?_0x3550bc[_0x2e47('0x8')][_0x20ea5d][_0x2e47('0x28')]:_0x20ea5d;return RpcUser[_0x2e47('0x29')](_0x3550bc['agents'][_0x200ee7],_0x175f02,_0x3fa0da)[_0x2e47('0x2a')](function(_0x116c9f){_0x3550bc[_0x2e47('0x5')][_0x58af6f][_0x2e47('0x2b')]-=0x1;_0x3550bc[_0x2e47('0x5')][_0x58af6f]['paused']+=0x1;return _0x116c9f;});})[_0x2e47('0x2a')](function(_0x4ccd07){if(_0x59a532||!_0x4ccd07){return;}_0x3550bc[_0x2e47('0x7')][_0x200ee7]={};logger[_0x2e47('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x20ea5d,_0x3550bc[_0x2e47('0x5')][_0x58af6f][_0x2e47('0x2c')],_0x200ee7,_0x58af6f);_0x3550bc[_0x2e47('0x7')][_0x200ee7][_0x2e47('0x1a')]=setTimeout(_0x3550bc[_0x2e47('0x2d')][_0x2e47('0xa')](_0x3550bc,_0x200ee7),_0x3550bc[_0x2e47('0x5')][_0x58af6f]['acwTimeout']*0x3e8);_0x3550bc[_0x2e47('0x7')][_0x200ee7][_0x2e47('0x19')]=moment()[_0x2e47('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3550bc['timers'][_0x200ee7]['uniqueid']=_0x20ea5d;_0x3550bc[_0x2e47('0x7')][_0x200ee7][_0x2e47('0x2f')]=_0x58af6f;_0x3550bc[_0x2e47('0x7')][_0x200ee7][_0x2e47('0x18')]=_0x3550bc['updateAcw'][_0x2e47('0xa')](_0x3550bc,_0x200ee7,_0x20ea5d);})[_0x2e47('0x1e')](function(){logger['error'](_0x2e47('0x30'),_0x20ea5d,_0x3550bc['voiceQueues'][_0x58af6f][_0x2e47('0x2c')],_0x200ee7,_0x58af6f);})[_0x2e47('0x20')](function(){delete _0x3550bc[_0x2e47('0x8')][_0x20ea5d];});}catch(_0x17ab07){logger[_0x2e47('0x1f')](_0x2e47('0x31'),_0x17ab07[_0x2e47('0x32')]);}};Acw[_0x2e47('0x17')]['stopAcw']=function(_0x3b34da){try{var _0x147046=this;if(_0x147046[_0x2e47('0x7')][_0x3b34da]){_0x147046[_0x2e47('0x7')][_0x3b34da][_0x2e47('0x1a')]=![];var _0x75707c=_0x147046[_0x2e47('0x7')][_0x3b34da]['uniqueid'];var _0x38e8a0=_0x147046['timers'][_0x3b34da][_0x2e47('0x2f')];var _0x70b6a9=_0x147046[_0x2e47('0x5')][_0x38e8a0]['acwTimeout'];logger[_0x2e47('0x1c')]('[%s][TIMER][STOP][AGENT:%s]',_0x75707c,_0x3b34da);RpcUser[_0x2e47('0x33')](this[_0x2e47('0x6')][_0x3b34da]['id'])[_0x2e47('0x2a')](function(_0x4ebc2f){if(_0x4ebc2f['pauseType']===_0x2e47('0x21')){return RpcUser[_0x2e47('0x34')](_0x147046[_0x2e47('0x6')][_0x3b34da]);}});RpcVoiceAgentReport[_0x2e47('0x1b')]({'acwtime':_0x70b6a9,'agentacw':!![]},_0x75707c,_0x3b34da)[_0x2e47('0x2a')](function(_0x2def9a){logger[_0x2e47('0x1c')](_0x2e47('0x1d'),_0x75707c,_0x70b6a9,_0x2def9a);})[_0x2e47('0x1e')](function(_0x41114d){logger['error'](_0x2e47('0x35'),_0x75707c,_0x41114d);});}else{logger['error'](_0x2e47('0x36'),_0x3b34da);if(_0x147046[_0x2e47('0x7')]){logger[_0x2e47('0x1c')](_0x2e47('0x37'),JSON['stringify'](_0x147046['timers']));}}}catch(_0x15521e){logger['error'](_0x2e47('0x38'),_0x15521e[_0x2e47('0x32')]);}};Acw['prototype'][_0x2e47('0x9')]=function(_0xb6181b){try{if(this[_0x2e47('0x5')][_0xb6181b[_0x2e47('0x2f')]]&&(this[_0x2e47('0x5')][_0xb6181b[_0x2e47('0x2f')]][_0x2e47('0x3')]||this[_0x2e47('0x5')][_0xb6181b[_0x2e47('0x2f')]][_0x2e47('0x39')])){if(this[_0x2e47('0x6')][_0xb6181b['interface']]){this[_0x2e47('0x8')][_0xb6181b['uniqueid']]={'queue':_0xb6181b[_0x2e47('0x2f')],'interface':_0xb6181b[_0x2e47('0x3a')],'destlinkedid':_0xb6181b[_0x2e47('0x28')]};}}}catch(_0x5b2823){logger[_0x2e47('0x1f')](_0x2e47('0x3b'),_0x5b2823[_0x2e47('0x32')]);}};Acw[_0x2e47('0x17')][_0x2e47('0x13')]=function(_0x2a4154){try{if(this[_0x2e47('0x5')][_0x2a4154[_0x2e47('0x2f')]]&&(this[_0x2e47('0x5')][_0x2a4154[_0x2e47('0x2f')]][_0x2e47('0x3')]||this[_0x2e47('0x5')][_0x2a4154[_0x2e47('0x2f')]][_0x2e47('0x39')])){if(this['agents'][_0x2a4154[_0x2e47('0x3a')]]){this[_0x2e47('0x8')][_0x2a4154[_0x2e47('0x3c')]]={'queue':_0x2a4154[_0x2e47('0x2f')],'interface':_0x2a4154['interface']};}}}catch(_0x27be2b){logger['error'](_0x2e47('0x3d'),_0x27be2b['message']);}};Acw['prototype'][_0x2e47('0xc')]=function(_0x484184){try{if(this[_0x2e47('0x8')][_0x484184[_0x2e47('0x3c')]]&&_['isUndefined'](this[_0x2e47('0x8')][_0x484184[_0x2e47('0x3c')]][_0x2e47('0x27')])){logger['info'](_0x2e47('0x3e'),_0x484184[_0x2e47('0x3c')]);this[_0x2e47('0x3f')](_0x484184[_0x2e47('0x3c')]);}else if(this[_0x2e47('0x8')][_0x484184[_0x2e47('0x40')]]&&_[_0x2e47('0x41')](this['channels'][_0x484184[_0x2e47('0x40')]][_0x2e47('0x27')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x484184[_0x2e47('0x40')]);this['startAcw'](_0x484184[_0x2e47('0x40')]);}}catch(_0x1f2b68){logger['error'](_0x2e47('0x42'),_0x1f2b68[_0x2e47('0x32')]);}};Acw[_0x2e47('0x17')][_0x2e47('0xd')]=function(_0x5d9f24){try{if(this['channels'][_0x5d9f24['uniqueid']]&&this[_0x2e47('0x8')][_0x5d9f24[_0x2e47('0x3c')]][_0x2e47('0x27')]){logger[_0x2e47('0x1c')](_0x2e47('0x43'),_0x5d9f24[_0x2e47('0x3c')]);this[_0x2e47('0x3f')](_0x5d9f24['uniqueid']);}else if(this[_0x2e47('0x8')][_0x5d9f24[_0x2e47('0x40')]]&&this['channels'][_0x5d9f24[_0x2e47('0x40')]]['attended']){logger[_0x2e47('0x1c')](_0x2e47('0x44'),_0x5d9f24[_0x2e47('0x40')]);this[_0x2e47('0x3f')](_0x5d9f24[_0x2e47('0x40')]);}}catch(_0x387b96){logger[_0x2e47('0x1f')]('[ACW][syncHangup]\x20%s',_0x387b96[_0x2e47('0x32')]);}};Acw[_0x2e47('0x17')][_0x2e47('0x45')]=function(_0x2b0347){try{if(!_[_0x2e47('0x46')](this[_0x2e47('0x8')][_0x2b0347[_0x2e47('0x47')]])){this['startAcw'](_0x2b0347[_0x2e47('0x47')]);if(this[_0x2e47('0x8')][_0x2b0347[_0x2e47('0x48')]]){this[_0x2e47('0x8')][_0x2b0347['secondtransfereruniqueid']][_0x2e47('0x27')]=!![];this[_0x2e47('0x8')][_0x2b0347[_0x2e47('0x49')]]=this[_0x2e47('0x8')][_0x2b0347[_0x2e47('0x48')]];delete this['channels'][_0x2b0347[_0x2e47('0x48')]];}}else if(!_[_0x2e47('0x46')](this[_0x2e47('0x8')][_0x2b0347[_0x2e47('0x49')]])){this[_0x2e47('0x3f')](_0x2b0347[_0x2e47('0x49')]);if(this['channels'][_0x2b0347[_0x2e47('0x4a')]]){this[_0x2e47('0x8')][_0x2b0347[_0x2e47('0x4a')]][_0x2e47('0x27')]=!![];this['channels'][_0x2b0347[_0x2e47('0x47')]]=this[_0x2e47('0x8')][_0x2b0347['origtransfereruniqueid']];delete this[_0x2e47('0x8')][_0x2b0347[_0x2e47('0x4a')]];}}}catch(_0xadc0bf){logger[_0x2e47('0x1f')](_0x2e47('0x4b'),_0xadc0bf['message']);}};Acw['prototype'][_0x2e47('0x11')]=function(_0x2a2e29){try{if(this[_0x2e47('0x8')][_0x2a2e29[_0x2e47('0x4c')]]){logger[_0x2e47('0x1c')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x2a2e29[_0x2e47('0x4c')]));this[_0x2e47('0x3f')](_0x2a2e29[_0x2e47('0x4c')]);}else if(this[_0x2e47('0x8')][_0x2a2e29['transfererlinkedid']]){logger[_0x2e47('0x1c')](_0x2e47('0x4d'),JSON[_0x2e47('0x4e')](_0x2a2e29[_0x2e47('0x4f')]));this[_0x2e47('0x3f')](_0x2a2e29[_0x2e47('0x4f')]);}}catch(_0x4f6ade){logger[_0x2e47('0x1f')](_0x2e47('0x50'),_0x4f6ade[_0x2e47('0x32')]);}};Acw[_0x2e47('0x17')][_0x2e47('0xe')]=function(_0x5ca316){try{if(this['voiceQueues'][_0x5ca316[_0x2e47('0x2f')]]&&this[_0x2e47('0x5')][_0x5ca316[_0x2e47('0x2f')]]['autopause']==='all'){if(this[_0x2e47('0x6')][_0x5ca316[_0x2e47('0x3a')]]){logger[_0x2e47('0x1c')](_0x2e47('0x51'),_0x5ca316['uniqueid'],_0x5ca316[_0x2e47('0x3a')],_0x5ca316[_0x2e47('0x2f')]);return RpcUser[_0x2e47('0x29')](this[_0x2e47('0x6')][_0x5ca316[_0x2e47('0x3a')]],_0x2e47('0x52'),_0x5ca316['uniqueid']);}}}catch(_0x65c9eb){logger[_0x2e47('0x1f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x65c9eb[_0x2e47('0x32')]);}};module[_0x2e47('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d73cb9c..5417585 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b4e=['actionDeviceStateList','devicestatelist','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipPeerStatus','exports','asterisk-manager','bluebird','util','port','asterisk','username','password','keepConnected','Action','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x0b4e,0x1be));var _0xe0b4=function(_0x4a1e0a,_0x51a512){_0x4a1e0a=_0x4a1e0a-0x0;var _0x15c865=_0x0b4e[_0x4a1e0a];return _0x15c865;};'use strict';var Manager=require(_0xe0b4('0x0'));var BPromise=require(_0xe0b4('0x1'));var util=require(_0xe0b4('0x2'));var logger=require('../../config/logger')('ami');var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0xe0b4('0x3')],config[_0xe0b4('0x4')]['ip'],config[_0xe0b4('0x4')][_0xe0b4('0x5')],config[_0xe0b4('0x4')][_0xe0b4('0x6')],!![]);ami[_0xe0b4('0x7')]();ami[_0xe0b4('0x8')]=BPromise['promisify'](ami[_0xe0b4('0x9')]);function error(_0x367cca){logger[_0xe0b4('0xa')](util[_0xe0b4('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xe0b4('0x4')][_0xe0b4('0x5')],config[_0xe0b4('0x4')]['ip'],config['asterisk'][_0xe0b4('0x3')],util[_0xe0b4('0xc')](_0x367cca,![],null)));}function close(){logger['error'](util[_0xe0b4('0xb')](_0xe0b4('0xd'),config[_0xe0b4('0x4')][_0xe0b4('0x5')],config[_0xe0b4('0x4')]['ip'],config[_0xe0b4('0x4')][_0xe0b4('0x3')]));}ami[_0xe0b4('0xe')]=function(){return function(){return ami[_0xe0b4('0x8')]({'action':_0xe0b4('0xf')});};};ami[_0xe0b4('0x10')]=function(){return function(){return ami[_0xe0b4('0x8')]({'action':_0xe0b4('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b4('0x8')]({'action':_0xe0b4('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xe0b4('0x8')]({'action':_0xe0b4('0x13')});};};ami[_0xe0b4('0x14')]=function(){return function(){return ami[_0xe0b4('0x8')]({'action':_0xe0b4('0x15')});};};function connect(){logger[_0xe0b4('0x16')](util['format'](_0xe0b4('0x17'),config['asterisk'][_0xe0b4('0x5')],config[_0xe0b4('0x4')]['ip'],config[_0xe0b4('0x4')][_0xe0b4('0x3')]));ami[_0xe0b4('0x18')](_0xe0b4('0xa'),error);ami[_0xe0b4('0x18')](_0xe0b4('0x19'),close);}ami['on']('connect',connect);ami['on'](_0xe0b4('0x1a'),function(_0x28ebb4){logger[_0xe0b4('0x16')](util[_0xe0b4('0xb')](_0xe0b4('0x1b'),config[_0xe0b4('0x4')][_0xe0b4('0x5')],config['asterisk']['ip'],config[_0xe0b4('0x4')][_0xe0b4('0x3')],util['inspect'](_0x28ebb4,![],null)));});ami['on'](_0xe0b4('0x1c'),function(){logger[_0xe0b4('0x16')](util[_0xe0b4('0xb')](_0xe0b4('0x1d'),config['asterisk'][_0xe0b4('0x5')],config['asterisk']['ip'],config[_0xe0b4('0x4')][_0xe0b4('0x3')]));return Promise['resolve']()[_0xe0b4('0x1e')](ami[_0xe0b4('0xe')]())[_0xe0b4('0x1e')](ami['actionDeviceStateList']())['then'](ami[_0xe0b4('0x1f')]())[_0xe0b4('0x1e')](ami['actionQueueSummary']())['then'](ami[_0xe0b4('0x14')]())['catch'](function(_0x1627d8){logger[_0xe0b4('0xa')]('[ami.js][fullybooted]',util[_0xe0b4('0xc')](_0x1627d8,{'showHidden':![],'depth':null}));});});ami[_0xe0b4('0x18')]('error',error);ami['once'](_0xe0b4('0x19'),close);module[_0xe0b4('0x20')]=ami; \ No newline at end of file +var _0xea48=['actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','asterisk-manager','bluebird','../../config/logger','../../config/environment','port','asterisk','username','password','promisify','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus'];(function(_0x11499e,_0x301066){var _0x4244dc=function(_0xb73a7b){while(--_0xb73a7b){_0x11499e['push'](_0x11499e['shift']());}};_0x4244dc(++_0x301066);}(_0xea48,0xcd));var _0x8ea4=function(_0x285de3,_0x11d144){_0x285de3=_0x285de3-0x0;var _0x1482d5=_0xea48[_0x285de3];return _0x1482d5;};'use strict';var Manager=require(_0x8ea4('0x0'));var BPromise=require(_0x8ea4('0x1'));var util=require('util');var logger=require(_0x8ea4('0x2'))('ami');var config=require(_0x8ea4('0x3'));var ami=new Manager(config['asterisk'][_0x8ea4('0x4')],config[_0x8ea4('0x5')]['ip'],config[_0x8ea4('0x5')][_0x8ea4('0x6')],config[_0x8ea4('0x5')][_0x8ea4('0x7')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0x8ea4('0x8')](ami['action']);function error(_0xa08829){logger[_0x8ea4('0x9')](util[_0x8ea4('0xa')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8ea4('0x5')][_0x8ea4('0x6')],config['asterisk']['ip'],config[_0x8ea4('0x5')][_0x8ea4('0x4')],util[_0x8ea4('0xb')](_0xa08829,![],null)));}function close(){logger[_0x8ea4('0x9')](util[_0x8ea4('0xa')](_0x8ea4('0xc'),config[_0x8ea4('0x5')][_0x8ea4('0x6')],config[_0x8ea4('0x5')]['ip'],config['asterisk'][_0x8ea4('0x4')]));}ami[_0x8ea4('0xd')]=function(){return function(){return ami[_0x8ea4('0xe')]({'action':_0x8ea4('0xf')});};};ami[_0x8ea4('0x10')]=function(){return function(){return ami[_0x8ea4('0xe')]({'action':'devicestatelist'});};};ami[_0x8ea4('0x11')]=function(){return function(){return ami['Action']({'action':_0x8ea4('0x12')});};};ami[_0x8ea4('0x13')]=function(){return function(){return ami[_0x8ea4('0xe')]({'action':'queuesummary'});};};ami[_0x8ea4('0x14')]=function(){return function(){return ami[_0x8ea4('0xe')]({'action':_0x8ea4('0x15')});};};function connect(){logger['info'](util[_0x8ea4('0xa')](_0x8ea4('0x16'),config[_0x8ea4('0x5')][_0x8ea4('0x6')],config[_0x8ea4('0x5')]['ip'],config[_0x8ea4('0x5')][_0x8ea4('0x4')]));ami[_0x8ea4('0x17')](_0x8ea4('0x9'),error);ami[_0x8ea4('0x17')](_0x8ea4('0x18'),close);}ami['on'](_0x8ea4('0x19'),connect);ami['on'](_0x8ea4('0x1a'),function(_0x316794){logger['info'](util[_0x8ea4('0xa')](_0x8ea4('0x1b'),config['asterisk'][_0x8ea4('0x6')],config[_0x8ea4('0x5')]['ip'],config[_0x8ea4('0x5')]['port'],util[_0x8ea4('0xb')](_0x316794,![],null)));});ami['on']('fullybooted',function(){logger['info'](util[_0x8ea4('0xa')](_0x8ea4('0x1c'),config['asterisk'][_0x8ea4('0x6')],config[_0x8ea4('0x5')]['ip'],config[_0x8ea4('0x5')]['port']));return Promise[_0x8ea4('0x1d')]()['then'](ami[_0x8ea4('0xd')]())[_0x8ea4('0x1e')](ami[_0x8ea4('0x10')]())[_0x8ea4('0x1e')](ami['actionSipPeerStatus']())[_0x8ea4('0x1e')](ami[_0x8ea4('0x13')]())[_0x8ea4('0x1e')](ami[_0x8ea4('0x14')]())['catch'](function(_0xd6b90e){logger['error'](_0x8ea4('0x1f'),util[_0x8ea4('0xb')](_0xd6b90e,{'showHidden':![],'depth':null}));});});ami[_0x8ea4('0x17')](_0x8ea4('0x9'),error);ami[_0x8ea4('0x17')](_0x8ea4('0x18'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index b67bf65..2073730 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x143fcb,_0x1064c7){var _0x3889bc=function(_0x14b1ee){while(--_0x14b1ee){_0x143fcb['push'](_0x143fcb['shift']());}};_0x3889bc(++_0x1064c7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0xe706,0xa3));var _0x6e70=function(_0x35027c,_0x4af623){_0x35027c=_0x35027c-0x0;var _0x4bba7d=_0xe706[_0x35027c];return _0x4bba7d;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 6c3534e..e84f01e 100644 --- a/server/services/ami/dialer/index.js +++ b/server/services/ami/dialer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45e5=['membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','dialAMDActive','value','MACHINE','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countagentrejectretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','cause-txt','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','Unknow','running','statusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','undefined','sequence','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','dialQueueProject','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','extractCalleridName','variables','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','xcally-motion-dialer','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','handlePredictive','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','Predictive\x20after\x20first\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','unlockContact','outboundReCallsDay','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','queuemember','queuestatuscomplete','syncQueueStatusComplete','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','getSeconds','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','message','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','Error','prototype','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','timezones','content','indexOf','Action','true','catch','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','isIVRCampaignActive','sendMessageOneNotActive','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','\x20Interval\x20is\x20overtime:\x20','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueId','uniqueid','type','ivr','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','createHistory','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','CampaignId','starttime','calleridname','calleridnum','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','ListId','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','actions','channel','syncQueueMember','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','idHopper','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','exten','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD'];(function(_0x1cae02,_0x1de149){var _0x51d6bd=function(_0x12dd9c){while(--_0x12dd9c){_0x1cae02['push'](_0x1cae02['shift']());}};_0x51d6bd(++_0x1de149);}(_0x45e5,0x115));var _0x545e=function(_0x57dd0a,_0x3a2345){_0x57dd0a=_0x57dd0a-0x0;var _0x44a23e=_0x45e5[_0x57dd0a];return _0x44a23e;};'use strict';var util=require(_0x545e('0x0'));var _=require(_0x545e('0x1'));var uuid=require(_0x545e('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x545e('0x3'));var utils=require(_0x545e('0x4'));var hopperUtils=require(_0x545e('0x5'));var ut=require(_0x545e('0x6'));var config=require(_0x545e('0x7'));var logger=require('../../../config/logger')(_0x545e('0x8'));var loggerBooked=require(_0x545e('0x9'))(_0x545e('0xa'));var loggerPredictive=require(_0x545e('0x9'))(_0x545e('0xb'));var loggerPredictiveCalls=require(_0x545e('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x545e('0xc'));var ami=require(_0x545e('0xd'));config[_0x545e('0xe')]=_[_0x545e('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x545e('0x10'))(new Redis(config[_0x545e('0xe')]));var cmHopper=require(_0x545e('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x545e('0x12'));var Interval=require(_0x545e('0x13'));var Action=require(_0x545e('0x14'));var History=require(_0x545e('0x15'));var Final=require('./models/final');var AgentComplete=require(_0x545e('0x16'));var QueueCallerAbandon=require(_0x545e('0x17'));var Hangup=require(_0x545e('0x18'));var ipAgi=process['env'][_0x545e('0x19')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x5a55c4){this[_0x545e('0x1a')]=this[_0x545e('0x1a')]?this[_0x545e('0x1a')][_0x545e('0x1b')](_0x5a55c4):_0x5a55c4();};function Dialer(_0x177cf7,_0x263120){this['sequence']=new Sequence();this[_0x545e('0x1c')]=_0x263120;this[_0x545e('0x1d')]=_0x177cf7[_0x545e('0x1d')];this[_0x545e('0x1e')]=_0x177cf7[_0x545e('0x1e')];this[_0x545e('0x1f')]=_0x177cf7[_0x545e('0x1f')];this['trunks']=_0x177cf7[_0x545e('0x20')];this[_0x545e('0x21')]=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x545e('0x22')]={};this[_0x545e('0x23')]={};this[_0x545e('0x24')]={};this['queueBookedRR']={};this[_0x545e('0x25')]={};ami['on'](_0x545e('0x26'),this[_0x545e('0x27')]['bind'](this));ami['on'](_0x545e('0x28'),this[_0x545e('0x29')][_0x545e('0x2a')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x545e('0x2a')](this));ami['on'](_0x545e('0x2b'),this['syncAgentComplete'][_0x545e('0x2a')](this));ami['on'](_0x545e('0x2c'),this[_0x545e('0xc')][_0x545e('0x2a')](this));ami['on'](_0x545e('0x2d'),this[_0x545e('0x2e')][_0x545e('0x2a')](this));ami['on'](_0x545e('0x2f'),this[_0x545e('0x30')][_0x545e('0x2a')](this));ami['on'](_0x545e('0x31'),this[_0x545e('0x32')][_0x545e('0x2a')](this));ami['on']('varset',this['syncVarSet'][_0x545e('0x2a')](this));ami['on'](_0x545e('0x33'),this['syncQueueMember'][_0x545e('0x2a')](this));ami['on'](_0x545e('0x34'),this[_0x545e('0x35')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x545e('0x36')](function(_0x44f3c7){previewRecallmeReminderInterval=_0x44f3c7[_0x545e('0x37')];});}function isNotNull(_0x2a3643){return _0x2a3643!==null&&!_[_0x545e('0x38')](_0x2a3643);}function msgResponse(_0x5d121f,_0x5b951a,_0x2bfb3e){return{'action':_0x5d121f,'response':_0x5b951a,'message':_0x2bfb3e,'stack':_0x2bfb3e};}function emit(_0x9b3a1,_0x271913,_0x568d2c){io['to'](_0x9b3a1)[_0x545e('0x39')](_0x271913,_0x568d2c);}function emitOutboundVoiceQueueSummary(_0x2b52f3){if(_0x2b52f3['type']===_0x545e('0x3a')){logger['debug'](_0x545e('0x3b'),util[_0x545e('0x3c')](_0x2b52f3,{'showHidden':![],'depth':null}));emit(util[_0x545e('0x3d')](_0x545e('0x3e'),_0x2b52f3[_0x545e('0x3f')]),_0x545e('0x40'),_0x2b52f3);}}function checkGetDataPredictive(_0x22bfbb){if(isNotNull(_0x22bfbb)&&!_[_0x545e('0x41')](_0x22bfbb)){loggerPredictive[_0x545e('0x42')](_0x545e('0x43'));loggerPredictive[_0x545e('0x42')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22bfbb[_0x545e('0x44')]);loggerPredictive[_0x545e('0x42')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22bfbb['predictiveIntervalAnsweredCalls']);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22bfbb['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x545e('0x42')](_0x545e('0x45'),_0x22bfbb[_0x545e('0x46')]);loggerPredictive[_0x545e('0x42')](_0x545e('0x47'),_0x22bfbb['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x545e('0x42')](_0x545e('0x48'),_0x22bfbb[_0x545e('0x49')]);loggerPredictive[_0x545e('0x42')](_0x545e('0x4a'));if(_0x22bfbb[_0x545e('0x44')]>0x0){if(!_[_0x545e('0x38')](_0x22bfbb[_0x545e('0x49')])&&_0x22bfbb[_0x545e('0x49')]>0x0){return!![];}loggerPredictive[_0x545e('0x42')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x545e('0x38')](_0x22bfbb[_0x545e('0x4b')])&&_0x22bfbb[_0x545e('0x4b')]>0x0){return!![];}loggerPredictive[_0x545e('0x42')](_0x545e('0x4c'));}else{loggerPredictive[_0x545e('0x42')](_0x545e('0x4d'));}}else{loggerPredictive[_0x545e('0x42')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x8ba5c2){return function(_0x1678a7){loggerPredictive[_0x545e('0x42')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x545e('0x4e'),_0x1678a7[_0x545e('0x4f')]);loggerPredictive[_0x545e('0x42')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1678a7[_0x545e('0x50')]);loggerPredictive[_0x545e('0x42')](_0x545e('0x51'),_0x1678a7['erlangAbandonmentRate']);loggerPredictive[_0x545e('0x42')](_0x545e('0x52'),_0x1678a7[_0x545e('0x53')]);loggerPredictive[_0x545e('0x42')](_0x545e('0x51'),_0x1678a7[_0x545e('0x54')]);loggerPredictive[_0x545e('0x42')](_0x545e('0x4a'));_[_0x545e('0x55')](_0x8ba5c2,_0x1678a7);};}function ifInterval(_0x24c3cb,_0x3db2fb){if(_[_0x545e('0x38')](_0x3db2fb)){return![];}return utils[_0x545e('0x56')](undefined,_0x3db2fb)<_0x24c3cb*0x3c;}function clearPredictiveAttributes(_0x3d3d6b){if(_0x3d3d6b[_0x545e('0x22')]){_0x3d3d6b[_0x545e('0x22')]=undefined;loggerPredictive[_0x545e('0x57')](_0x3d3d6b[_0x545e('0x3f')],_0x545e('0x58'));}if(_0x3d3d6b[_0x545e('0x59')]){_0x3d3d6b[_0x545e('0x59')]=undefined;loggerPredictive['debug'](_0x3d3d6b[_0x545e('0x3f')],_0x545e('0x5a'));}if(_0x3d3d6b['handlePredictive']){clearInterval(_0x3d3d6b['handlePredictive']);_0x3d3d6b['handlePredictive']=undefined;loggerPredictive[_0x545e('0x57')](_0x3d3d6b[_0x545e('0x3f')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x37b386,_0x5c4249){return function(_0x68cd38){loggerPredictive[_0x545e('0x5b')](_0x5c4249[_0x545e('0x3f')],_0x37b386);loggerPredictive[_0x545e('0x5b')](_0x68cd38[_0x545e('0x5c')]);clearPredictiveAttributes(_0x5c4249);};}function loggerCatch(_0xc95b0f){return function(_0x41ac2f){logger[_0x545e('0x5b')](_0xc95b0f,util['inspect'](_0x41ac2f,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xccd874,_0x3a72b7,_0x4427ec){return function(_0x1c0c04){utils[_0x545e('0x5d')](_0x3a72b7,_0x4427ec,0x0);_0x3a72b7[_0x545e('0x5e')]=0x0;logger[_0x545e('0x5b')](_0xccd874,util[_0x545e('0x3c')](_0x1c0c04,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x495c34){return function(_0x59002c){if(isNotNull(_0x59002c)&&isNotNull(_0x59002c[0x0])){if(_0x59002c[0x0][_0x545e('0x5f')]>0x0){_0x495c34['message']=utils[_0x545e('0x60')][_0x545e('0x61')];logger[_0x545e('0x42')]('[getContactDialer2][ReScheduled]'+_0x495c34[_0x545e('0x3f')],_0x59002c[0x0][_0x545e('0x5f')],_0x545e('0x62'));}else{_0x495c34['message']=utils[_0x545e('0x60')]['NO_AVAILABLE_CONTACTS'];logger[_0x545e('0x42')]('[getContactDialer2][Empty]'+_0x495c34['name']);}}};}function createObjHistory(_0x285a8f,_0x4ae63b,_0xf46a6d,_0x182faa,_0x1fd572){_0x285a8f[_0x545e('0x63')]=_0xf46a6d;var _0x2d6f14=new Action(_0x285a8f,_0x4ae63b);var _0x51448d=new History(_0x2d6f14);_0x51448d[_0x545e('0x64')]=_0x182faa;_0x51448d[_0x545e('0x65')]=_0x1fd572;_0x51448d[_0x545e('0x66')]=_0x2d6f14['starttime'];return _0x51448d;}function unlockQueueStatus(_0x5d28e8,_0x50e63e){setTimeout(function(){if(_[_0x545e('0x38')](_0x5d28e8[_0x545e('0x67')])){loggerBooked[_0x545e('0x5b')](_0x545e('0x68'),_0x50e63e);}_0x5d28e8['queueStatusComplete']=!![];loggerBooked[_0x545e('0x42')]('[booked][unlockQueueStatus]',_0x50e63e,JSON[_0x545e('0x69')](_[_0x545e('0x6a')](_0x5d28e8,[_0x545e('0x3f'),_0x545e('0x67')])));},0x1f3);}function checkInterval(_0x3b8504){return function(){if(!isNotNull(_0x3b8504[_0x545e('0x6b')])){_0x3b8504[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x6c')];throw _0x3b8504['name']+_0x545e('0x6d');}if(!isNotNull(_0x3b8504[_0x545e('0x6b')][_0x545e('0x6e')])){_0x3b8504[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x6c')];throw _0x3b8504[_0x545e('0x3f')]+_0x545e('0x6d');}if(!isNotNull(_[_0x545e('0x41')](_0x3b8504['Interval'][_0x545e('0x6e')]))){_0x3b8504[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x6c')];throw _0x3b8504[_0x545e('0x3f')]+_0x545e('0x6d');}};}function checkIsIVRCampaignActive(_0x98575c){return function(){if(!utils['isIVRCampaignActive'](_0x98575c)){_0x98575c['message']=utils[_0x545e('0x60')][_0x545e('0x6f')];throw _0x98575c[_0x545e('0x3f')]+_0x545e('0x70');}};}function emitCampaignSummary(_0x21bcd1){if(utils[_0x545e('0x71')](_0x21bcd1)){emit(util[_0x545e('0x3d')]('campaign:ivr:%s',_0x21bcd1[_0x545e('0x3f')]),'campaign:save',_0x21bcd1);}}function loggerCatchQueueSummary(_0x5f51fe,_0x3aaa31){return function(_0x35174f){clearPredictiveAttributes(_0x3aaa31);emitCampaignSummary(_0x3aaa31);loggerSyncQueueSummary[_0x545e('0x57')](_0x5f51fe,util['inspect'](_0x35174f,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1f59c9){if(_0x1f59c9['sendMessageOneNotActive']){if(_0x1f59c9['originated']===0x0){_0x1f59c9['sendMessageOneNotActive']=![];_0x1f59c9['message']=utils[_0x545e('0x60')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0x545e('0x72'),_0x1f59c9[_0x545e('0x3f')],_0x545e('0x73'));}else{_0x1f59c9[_0x545e('0x63')]=utils['CAMPAIGN_STATUS'][_0x545e('0x74')];loggerSyncQueueSummary[_0x545e('0x57')](_0x545e('0x72'),_0x1f59c9[_0x545e('0x3f')],_0x545e('0x75'));}emitCampaignSummary(_0x1f59c9);}}function myreject(_0x21c3b2){return function(_0x533e93){return _0x21c3b2(msgResponse('[ifTime][Action]',_0x545e('0x76'),JSON['stringify'](_0x533e93)));};}Dialer[_0x545e('0x77')][_0x545e('0x78')]=function(_0xcc85a2){return!_['isUndefined'](_0xcc85a2)&&_0xcc85a2&&!_[_0x545e('0x38')](_0xcc85a2[_0x545e('0x3f')])&&!_[_0x545e('0x38')](_0xcc85a2[_0x545e('0x79')])&&_0xcc85a2[_0x545e('0x79')]&&(this[_0x545e('0x20')][util[_0x545e('0x3d')](_0x545e('0x7a'),_0xcc85a2[_0x545e('0x3f')])][_0x545e('0x7b')]===_0x545e('0x7c')||this['trunks'][util[_0x545e('0x3d')](_0x545e('0x7a'),_0xcc85a2['name'])][_0x545e('0x7b')]===_0x545e('0x7d'));};Dialer['prototype'][_0x545e('0x7e')]=function(_0x2f7ecc){var _0x28f72a=this;return function(){if(!_0x28f72a['isTrunkReachable'](_0x2f7ecc[_0x545e('0x7f')])){if(!_0x28f72a[_0x545e('0x78')](_0x2f7ecc[_0x545e('0x80')])){_0x2f7ecc[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x81')];throw _0x2f7ecc[_0x545e('0x3f')]+_0x545e('0x82');}}};};Dialer['prototype'][_0x545e('0x83')]=function(_0x30af45,_0xc68084,_0x260574,_0x41127f){var _0x2d42b7=this;return function(){var _0x471214=!![];return _0x2d42b7[_0x545e('0x84')](_0x30af45,_0xc68084,_0x260574,_0x41127f,_0x471214);};};Dialer[_0x545e('0x77')][_0x545e('0x85')]=function(_0x3ef20c,_0x11fe9e,_0xfde0a,_0x29a226){var _0x2eaa9b=this;return function(){var _0x399251=![];return _0x2eaa9b[_0x545e('0x84')](_0x3ef20c[_0x545e('0x6e')],_0x11fe9e,_0xfde0a,_0x29a226,_0x399251);};};Dialer[_0x545e('0x77')][_0x545e('0x84')]=function(_0x481347,_0xef0997,_0x4eeea0,_0xdd4492,_0x32370a){var _0x4800d8=[];return new Promise(function(_0x2ad4c2,_0x4a4d84){if(!isNotNull(_0x481347)){_0xdd4492[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x6c')];return _0x4a4d84(msgResponse(_0x545e('0x86'),_0x545e('0x87'),_0x4eeea0+_0x545e('0x88')));}if(_[_0x545e('0x41')](_0x481347)){_0xdd4492[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x89')];return _0x4a4d84(msgResponse('ifTime',_0x545e('0x87'),_0x4eeea0+_0x545e('0x8a')));}if(_0xef0997&&_['isUndefined'](config['timezones'][_0xef0997])){_0xdd4492[_0x545e('0x63')]=utils[_0x545e('0x60')]['UNKNOWN_TIMEZONE'];return _0x4a4d84(msgResponse('ifTime',_0x545e('0x87'),_0x4eeea0+_0x545e('0x8b')+_0xef0997));}if(_[_0x545e('0x8c')](_0x481347)){for(var _0x5bb111=0x0;_0x5bb111<_0x481347[_0x545e('0x8d')];_0x5bb111+=0x1){_0x4800d8[_0x545e('0x8e')](ami['Action']({'action':_0x545e('0x8f'),'command':util[_0x545e('0x3d')](_0x545e('0x90'),_0x481347[_0x5bb111][_0x545e('0x91')],!_[_0x545e('0x38')](config[_0x545e('0x92')][_0xef0997])?_0xef0997:'')})[_0x545e('0x36')](function(_0x2ad694){return _0x2ad694[_0x545e('0x93')][_0x545e('0x94')]('true')>=0x0;})['catch'](myreject(_0x4a4d84)));}}else{_0x4800d8[_0x545e('0x8e')](ami[_0x545e('0x95')]({'action':'command','command':util['format'](_0x545e('0x90'),_0x481347,!_[_0x545e('0x38')](config[_0x545e('0x92')][_0xef0997])?_0xef0997:'')})[_0x545e('0x36')](function(_0x115f16){return _0x115f16[_0x545e('0x93')][_0x545e('0x94')](_0x545e('0x96'))>=0x0;})[_0x545e('0x97')](myreject(_0x4a4d84)));}Promise[_0x545e('0x98')](_0x4800d8)['then'](function(_0x59b0ae){var _0x82bde5=_[_0x545e('0x99')](_0x59b0ae);if(_0x82bde5){return _0x2ad4c2(_0x82bde5);}else{_0xdd4492['message']=_0x32370a?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x545e('0x9a')];return _0x4a4d84(msgResponse(_0x545e('0x9b'),_0x545e('0x87'),_0x545e('0x9c')+_0x32370a+'\x20'+_0x4eeea0+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x481347,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0xef0997));}})[_0x545e('0x97')](function(_0x10eafe){return _0x4a4d84(msgResponse(_0x545e('0x86'),_0x545e('0x87'),JSON[_0x545e('0x69')](_0x10eafe)));});});};Dialer['prototype'][_0x545e('0x9d')]=function(){var _0x8ab7b5=this;return cmHopper[_0x545e('0x9e')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x8ab7b5['syncCampaigns']();},0x3e8);});};Dialer['prototype'][_0x545e('0x9f')]=function(){var _0x2e7839=this;var _0x419967;for(var _0x5e8c68 in this[_0x545e('0x1e')]){if(typeof this[_0x545e('0x1e')][_0x5e8c68]!=='undefined'){_0x419967=this[_0x545e('0x1e')][_0x5e8c68];if(utils['isIVRCampaign'](_0x419967)&&utils[_0x545e('0xa0')](_0x419967)){_0x419967[_0x545e('0xa1')]=!![];Promise[_0x545e('0xa2')]()['then'](checkIsIVRCampaignActive(_0x419967))[_0x545e('0x36')](checkInterval(_0x419967))['then'](_0x2e7839['checkIsTrunkReachable'](_0x419967))[_0x545e('0x36')](_0x2e7839[_0x545e('0x83')](_0x419967['dialGlobalInterval'],_0x419967[_0x545e('0xa3')],_0x419967['name'],_0x419967))[_0x545e('0x36')](_0x2e7839[_0x545e('0x85')](_0x419967['Interval'],_0x419967[_0x545e('0xa3')],_0x419967['name'],_0x419967))[_0x545e('0x36')](_0x2e7839[_0x545e('0xa4')](_0x419967))[_0x545e('0x97')](loggerCatchQueueSummary(_0x545e('0xa5'),_0x419967));}else{notSendMessagesCampaign(_0x419967);}}}};Dialer[_0x545e('0x77')][_0x545e('0xa6')]=function(_0x3a834d){if(_0x3a834d[_0x545e('0xa7')]!==_0x545e('0xb')){clearPredictiveAttributes(_0x3a834d);}switch(_0x3a834d[_0x545e('0xa7')]){case _0x545e('0xa8'):this[_0x545e('0xa9')](_0x3a834d,0x1);break;case'power':this[_0x545e('0xa9')](_0x3a834d,_0x3a834d['dialPowerLevel']);break;case'predictive':this[_0x545e('0xb')](_0x3a834d);break;case _0x545e('0xa'):this[_0x545e('0xa9')](_0x3a834d,0x1);break;default:logger['error']('Queue',_0x3a834d[_0x545e('0x3f')],_0x545e('0xaa'));}};Dialer['prototype']['ifTime']=function(_0x2b7f46,_0x1fd320){var _0x1be992=_0x2b7f46[_0x545e('0xa3')];var _0x55c790=_0x1fd320?_0x2b7f46[_0x545e('0xab')]:_0x2b7f46['Interval'][_0x545e('0x6e')];logger['silly'](_0x545e('0xac'),_0x55c790,_0x1be992,_0x2b7f46[_0x545e('0x3f')],util[_0x545e('0x3d')](_0x545e('0xad'),_0x2b7f46['name'],_0x2b7f46['id']));var _0x572376=null;return Interval['intervalIftime'](_0x55c790,_0x1be992)[_0x545e('0x36')](function(_0x418c24){if(_0x418c24===!![]){return _0x418c24;}else{_0x2b7f46[_0x545e('0x63')]=_0x1fd320?utils[_0x545e('0x60')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x545e('0x60')]['OVERTIME_INTERVAL'];_0x572376=msgResponse(_0x545e('0x9b'),'Failure',_0x545e('0x9c')+_0x1fd320+'\x20'+_0x2b7f46[_0x545e('0x3f')]+_0x545e('0xae')+util[_0x545e('0x3c')](_0x55c790,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1be992);}if(_0x572376!==null){logger['silly']('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x572376);_0x572376[_0x545e('0xaf')]=_0x1fd320;throw _0x572376;}})[_0x545e('0x97')](function(_0x3f78b4){logger[_0x545e('0x5b')](_0x545e('0xb0'),_0x3f78b4);throw msgResponse(_0x545e('0xb1'),'Error',util[_0x545e('0x3c')](_0x3f78b4,{'showHidden':![],'depth':null}));});};Dialer[_0x545e('0x77')][_0x545e('0x27')]=function(_0x31dd01){if(this[_0x545e('0x1d')][_0x31dd01[_0x545e('0xb2')]]){if(this[_0x545e('0xb3')][_0x31dd01[_0x545e('0xb4')]]&&this['uniqueId'][_0x31dd01[_0x545e('0xb4')]][_0x545e('0xb5')]!==_0x545e('0xb6')){this['updateOriginated'](this['voiceQueues'][_0x31dd01['queue']]);this[_0x545e('0xb3')][_0x31dd01[_0x545e('0xb4')]]['answertime']=moment()['format'](_0x545e('0xb7'));}}};Dialer[_0x545e('0x77')][_0x545e('0xb8')]=function(_0x46071a){var _0x53c0b3=this[_0x545e('0xb3')][_0x46071a[_0x545e('0xb4')]];if(this[_0x545e('0x1d')][_0x46071a[_0x545e('0xb2')]]){if(_0x53c0b3&&_0x53c0b3['type']!=='ivr'){delete this[_0x545e('0xb3')][_0x46071a['uniqueid']];this[_0x545e('0x1d')][_0x46071a[_0x545e('0xb2')]][_0x545e('0xb9')]+=0x1;var _0x2caec8=new AgentComplete(_0x53c0b3,_0x46071a);if(_0x46071a[_0x545e('0xba')]===_0x545e('0xbb')){_0x2caec8[_0x545e('0xbc')]=this[_0x545e('0x1d')][_0x46071a[_0x545e('0xb2')]][_0x545e('0xbd')]&&this['voiceQueues'][_0x46071a['queue']]['dialAgiAfterHangupAgent']?moment()[_0x545e('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x545e('0xbe')](_0x2caec8)[_0x545e('0x97')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x545e('0xbf')](_0x2caec8)[_0x545e('0x97')](loggerCatch(_0x545e('0xc0')));}}};Dialer[_0x545e('0x77')]['syncQueueCallerAbandon']=function(_0xfbd226){var _0x4d2536=this[_0x545e('0xb3')][_0xfbd226[_0x545e('0xb4')]];var _0x5d3aa6=this;var _0x27034f=![];var _0x52bb75;var _0x1ac345;if(this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]]){if(_0x4d2536&&_0x4d2536[_0x545e('0xb5')]!==_0x545e('0xb6')){delete this['uniqueId'][_0xfbd226['uniqueid']];this[_0x545e('0xc1')](this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]]);_0x4d2536[_0x545e('0xc2')]=moment()[_0x545e('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4621e9=new QueueCallerAbandon(_0x4d2536,_0xfbd226);if(utils[_0x545e('0x56')](_0x4d2536['droptime'],_0x4d2536[_0x545e('0xc3')])>=_0x4d2536[_0x545e('0xc4')]){this['voiceQueues'][_0xfbd226[_0x545e('0xb2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xc5')]+=0x1;this['voiceQueues'][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xc6')]+=0x1;_0x4621e9['state']=0xa;_0x4621e9[_0x545e('0x65')]=_0x545e('0xc7');_0x4621e9[_0x545e('0xc8')]='TIMEOUT';_0x4621e9[_0x545e('0xbc')]=this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xbd')]?moment()['format'](_0x545e('0xb7')):undefined;_0x4621e9[_0x545e('0xc9')]+=0x1;_0x4621e9[_0x545e('0xca')]+=0x1;_0x52bb75=this[_0x545e('0x1d')][_0xfbd226['queue']][_0x545e('0xcb')];_0x1ac345=this['voiceQueues'][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xcc')];hopperUtils[_0x545e('0xcd')](_0x4621e9,_0x4621e9[_0x545e('0x64')],_0x4d2536[_0x545e('0xce')])['then'](function(_0x498ad5){_0x27034f=_0x498ad5[_0x545e('0xcf')]==0x1;if(_0x4621e9[_0x545e('0xc9')]>=_0x5d3aa6[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]]['dialDropMaxRetry']){_0x5d3aa6[_0x545e('0xd0')](_0x4621e9,_0x498ad5[_0x545e('0xcf')]);}else{hopperUtils[_0x545e('0xd1')]({'active':![],'countdropretry':_0x4621e9['countdropretry'],'scheduledat':moment()[_0x545e('0xd2')](_0x5d3aa6[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xcb')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x4d2536[_0x545e('0xd4')],'ListId':_0x4d2536['ListId'],'VoiceQueueId':_0x4d2536['VoiceQueueId']||undefined,'CampaignId':_0x4d2536[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch('[rescheduleContact][Drop]'));var _0x3b73db=new History(_0x4621e9);_0x3b73db[_0x545e('0x64')]=0xa;_0x3b73db[_0x545e('0x65')]='Drop';_0x3b73db[_0x545e('0xd6')]=moment()[_0x545e('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b73db[_0x545e('0x66')]=_0x3b73db[_0x545e('0xd6')];_0x3b73db['calleridname']=_0x4621e9[_0x545e('0xd7')];_0x3b73db[_0x545e('0xd8')]=_0x4621e9[_0x545e('0xd8')];hopperUtils['createHistory'](_0x3b73db)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x545e('0x36')](function(){if(_0x27034f)hopperUtils['swapAdditionalPhones'](_0x4621e9,_0x52bb75,_0x1ac345)[_0x545e('0x36')](function(){return 0x1;});});}else{this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0x46')]+=0x1;this['voiceQueues'][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xd9')]+=0x1;_0x4621e9[_0x545e('0x64')]=0xb;_0x4621e9[_0x545e('0x65')]='Abandoned';_0x4621e9[_0x545e('0xc8')]=_0x545e('0xda');_0x4621e9[_0x545e('0xdb')]+=0x1;_0x4621e9['countglobal']+=0x1;_0x52bb75=this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xdc')];_0x1ac345=this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xcc')];hopperUtils[_0x545e('0xcd')](_0x4621e9,_0x4621e9['state'],_0x4d2536[_0x545e('0xce')])[_0x545e('0x36')](function(_0x59f22e){if(_0x4621e9[_0x545e('0xdb')]>=_0x5d3aa6[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xdd')]){_0x5d3aa6[_0x545e('0xd0')](_0x4621e9,_0x59f22e[_0x545e('0xcf')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x4621e9['countabandonedretry'],'scheduledat':moment()[_0x545e('0xd2')](_0x5d3aa6['voiceQueues'][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xdc')],'minutes')[_0x545e('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4d2536['ContactId'],'ListId':_0x4d2536[_0x545e('0xde')],'VoiceQueueId':_0x4d2536[_0x545e('0xdf')]||undefined,'CampaignId':_0x4d2536[_0x545e('0xd5')]||undefined})['catch'](loggerCatch(_0x545e('0xe0')));var _0x54685a=new History(_0x4621e9);_0x54685a[_0x545e('0x64')]=0xb;_0x54685a[_0x545e('0x65')]='Abandoned';_0x54685a['starttime']=moment()[_0x545e('0x3d')](_0x545e('0xb7'));_0x54685a[_0x545e('0x66')]=_0x54685a[_0x545e('0xd6')];_0x54685a[_0x545e('0xd7')]=_0x4621e9[_0x545e('0xd7')];_0x54685a[_0x545e('0xd8')]=_0x4621e9[_0x545e('0xd8')];hopperUtils[_0x545e('0xbe')](_0x54685a)[_0x545e('0x97')](loggerCatch(_0x545e('0xe1')));}})[_0x545e('0x36')](function(){if(_0x27034f)hopperUtils[_0x545e('0xe2')](_0x4621e9,_0x52bb75,_0x1ac345)[_0x545e('0x36')](function(){return 0x1;});});}}}};Dialer[_0x545e('0x77')]['syncNewExten']=function(_0xb80f22){if(this[_0x545e('0xe3')][_0xb80f22['uniqueid']]){this[_0x545e('0xe3')][_0xb80f22['uniqueid']][_0x545e('0xe4')]=_0xb80f22[_0x545e('0xe4')];}if(this['uniqueId'][_0xb80f22['uniqueid']]){this['uniqueId'][_0xb80f22[_0x545e('0xb4')]][_0x545e('0xe4')]=_0xb80f22[_0x545e('0xe4')];}};Dialer[_0x545e('0x77')][_0x545e('0xe5')]=function(_0x1243ff){if(!this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]]){return;}var _0x381a0d=this[_0x545e('0x1d')][this[_0x545e('0xe3')][_0x1243ff['actionid']][_0x545e('0xb2')]][_0x545e('0xe7')]||_0x545e('0xe8');if(_0x381a0d==='roundrobin'){if(this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]]&&_[_0x545e('0xe9')](this['actions'][_0x1243ff['actionid']][_0x545e('0xea')])&&_0x1243ff[_0x545e('0x7b')]==='1'&&_0x1243ff[_0x545e('0xeb')]==='0'){if(this[_0x545e('0x1f')][_0x1243ff[_0x545e('0xec')]]){if(!this['agents'][_0x1243ff[_0x545e('0xec')]]['locked']){this[_0x545e('0x1f')][_0x1243ff[_0x545e('0xec')]]['locked']=!![];this['actions'][_0x1243ff[_0x545e('0xe6')]]['locked']=!![];this['actions'][_0x1243ff[_0x545e('0xe6')]]['stateinterface']=_0x1243ff[_0x545e('0xec')];}}}}else if(_0x381a0d==='rrmemory'){if(this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]]){if(this['agents'][_0x1243ff[_0x545e('0xec')]]){this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]][_0x545e('0xec')]=_0x1243ff[_0x545e('0xec')];if(_['isNil'](this[_0x545e('0x24')][this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]][_0x545e('0xb2')]])){this['queueBooked'][this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]]['queue']]=[];}this[_0x545e('0x24')][this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]][_0x545e('0xb2')]]['push'](_[_0x545e('0x55')](_[_0x545e('0x6a')](this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]],[_0x545e('0xed'),_0x545e('0xec')]),{'status':_0x1243ff['status'],'paused':_0x1243ff[_0x545e('0xeb')]}));}}}};Dialer[_0x545e('0x77')][_0x545e('0x35')]=function(_0xaadc21){if(!this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]]){return;}var _0x5e1eb2=this;var _0x5567ef=this['voiceQueues'][this['actions'][_0xaadc21[_0x545e('0xe6')]]['queue']];var _0xd96b37=_0x5567ef['strategy']||_0x545e('0xe8');if(_0xd96b37===_0x545e('0xee')){if(this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]]&&this['actions'][_0xaadc21[_0x545e('0xe6')]]['stateinterface']){this[_0x545e('0x1c')][_0x545e('0xef')](this['actions'][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xed')],this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xec')])['catch'](function(_0x2b31aa){logger[_0x545e('0x5b')](_0x545e('0xf0'),util[_0x545e('0x3c')](_0x2b31aa,{'showHidden':![],'depth':null}));})[_0x545e('0x1b')](function(){_0x5e1eb2[_0x545e('0xc1')](_0x5e1eb2[_0x545e('0x1d')][_0x5e1eb2[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]]);_0x5e1eb2['agents'][_0x5e1eb2['actions'][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xec')]][_0x545e('0xea')]=![];delete _0x5e1eb2[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]];unlockQueueStatus(_0x5567ef);});}else{this['updateOriginated'](this[_0x545e('0x1d')][this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]]);hopperUtils[_0x545e('0xd1')]({'active':![],'ContactId':this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]]['ContactId'],'ListId':this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]]['ListId'],'VoiceQueueId':this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xdf')]||undefined,'CampaignId':this[_0x545e('0xe3')][_0xaadc21['actionid']][_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0xf1')));delete this[_0x545e('0xe3')][_0xaadc21['actionid']];unlockQueueStatus(_0x5567ef);}}else if(_0xd96b37===_0x545e('0xe8')){var _0x544cc3;if(this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]]&&!_[_0x545e('0x41')](this['queueBooked'][this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]])){if(this[_0x545e('0xf2')][_0x5e1eb2['actions'][_0xaadc21['actionid']][_0x545e('0xb2')]]){this[_0x545e('0xf2')][_0x5e1eb2['actions'][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]]=this[_0x545e('0xf2')][this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]]?this[_0x545e('0xf2')][this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]]:this[_0x545e('0x24')][this[_0x545e('0xe3')][_0xaadc21['actionid']][_0x545e('0xb2')]]?this[_0x545e('0x24')][this[_0x545e('0xe3')][_0xaadc21['actionid']][_0x545e('0xb2')]][_0x545e('0xf3')]||0x0:0x0;}this[_0x545e('0x24')][this['actions'][_0xaadc21['actionid']][_0x545e('0xb2')]][_0x545e('0xf3')]=this[_0x545e('0xf2')][this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]];for(var _0x2bda06=0x0;_0x2bda06=_0xf31db8[_0x545e('0x118')]){_0x39ce03['stateGlobal'](_0x2699ee,_0x2ecbce,_0x27a549,'reason19\x20machine....');}else{if(_0x2699ee['countmachineretry']>=_0xf31db8[_0x545e('0x119')]){_0x39ce03[_0x545e('0x11a')](_0x2699ee,_0x2ecbce,_0x27a549,_0x545e('0x11b'));}else{hopperUtils[_0x545e('0xd1')]({'active':![],'countmachineretry':_0x2699ee[_0x545e('0x111')],'scheduledat':moment()['add'](_0xf31db8[_0x545e('0x11c')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x2699ee[_0x545e('0xd4')],'ListId':_0x2699ee[_0x545e('0xde')],'VoiceQueueId':_0x2699ee[_0x545e('0xdf')]||undefined,'CampaignId':_0x2699ee[_0x545e('0xd5')]||undefined})['catch'](loggerCatch(_0x545e('0x11d')));_0x2ecbce({'reschedule':0x1});}}});}if(_0x31cb55[_0x545e('0xb5')]===_0x545e('0xb6')&&this[_0x545e('0x1e')][_0x31cb55[_0x545e('0xb2')]][_0x545e('0x10e')]&&_0x506607['value']===_0x545e('0x106')){delete this[_0x545e('0xb3')][_0x506607['uniqueid']];this[_0x545e('0xc1')](this[_0x545e('0x1e')][_0x31cb55[_0x545e('0xb2')]]);_0x55ad68=new Hangup(_0x31cb55,_0x506607);_0x55ad68['state']=0x12;_0x55ad68[_0x545e('0x65')]=_0x545e('0x108');_0x55ad68[_0x545e('0x109')]=_0x545e('0x10a');ami[_0x545e('0x39')](_0x545e('0x112'),ut[_0x545e('0x10b')](_0x55ad68,_0x545e('0x10c')));this[_0x545e('0x11e')](_0x55ad68,_0x545e('0x11f'),_0x545e('0x120'));}if(_0x31cb55['type']==='ivr'&&this['campaigns'][_0x31cb55['queue']]['dialAMDActive']&&_0x506607[_0x545e('0x10f')]==='MACHINE'){return new Promise(function(_0x53eb7b,_0x5b502a){delete _0x39ce03['uniqueId'][_0x506607[_0x545e('0xb4')]];_0x39ce03[_0x545e('0xc1')](_0x39ce03['campaigns'][_0x31cb55[_0x545e('0xb2')]]);_0x39ce03[_0x545e('0x1e')][_0x31cb55['queue']]['outboundAnswerCallsDay']+=0x1;_0x39ce03[_0x545e('0x1e')][_0x31cb55[_0x545e('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xcacd78=_0x39ce03['campaigns'][_0x31cb55['queue']];var _0x917127=new Hangup(_0x31cb55,_0x506607);_0x917127[_0x545e('0x64')]=0x13;_0x917127[_0x545e('0x65')]=_0x545e('0x121');_0x917127[_0x545e('0x109')]='AMD';_0x917127[_0x545e('0x111')]+=0x1;_0x917127[_0x545e('0xca')]+=0x1;_0x917127['amd']=!![];ami[_0x545e('0x39')](_0x545e('0x112'),ut[_0x545e('0x10b')](_0x917127,_0x545e('0x10c')));hopperUtils[_0x545e('0xbe')](_0x917127)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x917127[_0x545e('0x114')]+_0x917127['countcongestionretry']+_0x917127['countnoanswerretry']+_0x917127[_0x545e('0x117')]+_0x917127[_0x545e('0xc9')]+_0x917127[_0x545e('0xdb')]+_0x917127[_0x545e('0x111')]+_0x917127[_0x545e('0x122')]>=_0xcacd78[_0x545e('0x118')]){_0x39ce03[_0x545e('0x123')](_0x917127,_0x53eb7b,_0x5b502a,'reason19\x20machine....');}else{if(_0x917127['countmachineretry']>=_0xcacd78[_0x545e('0x119')]){_0x39ce03[_0x545e('0x11a')](_0x917127,_0x53eb7b,_0x5b502a,_0x545e('0x11b'));}else{hopperUtils[_0x545e('0xd1')]({'active':![],'countmachineretry':_0x917127['countmachineretry'],'scheduledat':moment()[_0x545e('0xd2')](_0xcacd78[_0x545e('0x11c')],'minutes')[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x917127[_0x545e('0xd4')],'ListId':_0x917127[_0x545e('0xde')],'VoiceQueueId':_0x917127[_0x545e('0xdf')]||undefined,'CampaignId':_0x917127['CampaignId']||undefined})[_0x545e('0x97')](loggerCatch('[rescheduleContact][Machine]'));_0x53eb7b({'reschedule':0x1});}}});}}};Dialer[_0x545e('0x77')]['syncHangup']=function(_0x4a82c0){var _0x11b3a6=this[_0x545e('0xb3')][_0x4a82c0[_0x545e('0xb4')]];var _0x575d23;if(_0x11b3a6&&_0x11b3a6[_0x545e('0xb5')]===_0x545e('0xb6')){delete this['uniqueId'][_0x4a82c0['uniqueid']];this[_0x545e('0xc1')](this['campaigns'][_0x11b3a6[_0x545e('0xb2')]]);this['campaigns'][_0x11b3a6[_0x545e('0xb2')]][_0x545e('0x124')]+=0x1;_0x575d23=new Hangup(_0x11b3a6,_0x4a82c0);hopperUtils[_0x545e('0xbe')](_0x575d23)[_0x545e('0x97')](loggerCatch(_0x545e('0x125')));hopperUtils[_0x545e('0xbf')](_0x575d23)[_0x545e('0x97')](loggerCatch(_0x545e('0x126')));}if(_0x11b3a6&&_0x11b3a6[_0x545e('0xb5')]!==_0x545e('0xb6')&&isNotNull(this['voiceQueues'][_0x11b3a6[_0x545e('0xb2')]]['dialQueueProject'])){delete this['uniqueId'][_0x4a82c0[_0x545e('0xb4')]];this[_0x545e('0xc1')](this['voiceQueues'][_0x11b3a6[_0x545e('0xb2')]]);this[_0x545e('0x1d')][_0x11b3a6[_0x545e('0xb2')]][_0x545e('0xb9')]+=0x1;this['voiceQueues'][_0x11b3a6[_0x545e('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x575d23=new Hangup(_0x11b3a6,_0x4a82c0);_0x575d23[_0x545e('0x64')]=0x10;_0x575d23[_0x545e('0x65')]=_0x545e('0x127');_0x575d23[_0x545e('0x109')]='AGI';hopperUtils['createHistory'](_0x575d23)['catch'](loggerCatch(_0x545e('0x125')));hopperUtils['moveContactManagedDialer'](_0x575d23)[_0x545e('0x97')](loggerCatch(_0x545e('0x126')));}if(_0x11b3a6&&_0x11b3a6[_0x545e('0xb5')]!==_0x545e('0xb6')&&!isNotNull(this[_0x545e('0x1d')][_0x11b3a6[_0x545e('0xb2')]]['dialQueueProject'])){if(_0x4a82c0[_0x545e('0x128')]==='Normal\x20Clearing'){delete this['uniqueId'][_0x4a82c0['uniqueid']];this['voiceQueues'][_0x11b3a6[_0x545e('0xb2')]]['outboundAnswerCallsDay']+=0x1;const _0xde5777=new AgentComplete(_0x11b3a6,_0x4a82c0);_0xde5777[_0x545e('0xd5')]=this[_0x545e('0x1d')][_0x11b3a6[_0x545e('0xb2')]]['id'];hopperUtils[_0x545e('0xbe')](_0xde5777)['catch'](loggerCatch(_0x545e('0x129')));hopperUtils[_0x545e('0xbf')](_0xde5777)['catch'](loggerCatch(_0x545e('0xc0')));}else{delete this[_0x545e('0xb3')][_0x4a82c0[_0x545e('0xb4')]];this[_0x545e('0xc1')](this['voiceQueues'][_0x11b3a6[_0x545e('0xb2')]]);this[_0x545e('0x1d')][_0x11b3a6[_0x545e('0xb2')]][_0x545e('0x12a')]+=0x1;_0x575d23=new Hangup(_0x11b3a6,_0x4a82c0);_0x575d23[_0x545e('0x64')]=0xc;_0x575d23[_0x545e('0x65')]=_0x4a82c0['cause-txt'];_0x575d23[_0x545e('0x109')]=_0x545e('0x12b');hopperUtils[_0x545e('0xbe')](_0x575d23)[_0x545e('0x97')](loggerCatch(_0x545e('0x125')));hopperUtils[_0x545e('0xbf')](_0x575d23)[_0x545e('0x97')](loggerCatch(_0x545e('0x126')));}}};Dialer[_0x545e('0x77')][_0x545e('0xc')]=function(_0x1406a6){var _0x35e01b=this;if(!_0x35e01b['queuesSummary'][_0x1406a6['name']]){_0x35e01b[_0x545e('0x25')][_0x1406a6[_0x545e('0x3f')]]={'running':![]};}else if(_0x35e01b[_0x545e('0x25')][_0x1406a6['name']][_0x545e('0x12c')]===!![]){return;}else if(_0x35e01b[_0x545e('0x25')][_0x1406a6[_0x545e('0x3f')]][_0x545e('0x12c')]===![]){_0x35e01b[_0x545e('0x25')][_0x1406a6[_0x545e('0x3f')]][_0x545e('0x12c')]=!![];}var _0x5c0bad=_0x35e01b['voiceQueues'][_0x1406a6['name']];var _0x1a4d45=_0x5c0bad['message']!==utils[_0x545e('0x60')][_0x545e('0x6f')];var _0x2d7b94=utils['isPreviewCampaign'](_0x5c0bad);_0x5c0bad['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x5c0bad,_0x35e01b[_0x545e('0x20')]);Promise['resolve']()[_0x545e('0x36')](function(){if(_0x5c0bad[_0x545e('0x12d')]===utils['CAMPAIGN_STATUS']['INACTIVE']){if(_0x1a4d45){clearPredictiveAttributes(_0x5c0bad);_0x1406a6[_0x545e('0x59')]=undefined;_0x1406a6[_0x545e('0x22')]=undefined;}if(_0x5c0bad[_0x545e('0x12d')]===utils[_0x545e('0x60')][_0x545e('0x6f')]){_0x1406a6[_0x545e('0x12e')]=0x0;_0x1406a6[_0x545e('0xeb')]=0x0;_0x1406a6[_0x545e('0x12f')]=0x0;_0x1406a6[_0x545e('0x130')]=0x0;_0x1406a6['pTalking']=0x0;}}else if(_0x5c0bad[_0x545e('0x12d')]===utils[_0x545e('0x60')][_0x545e('0x131')]&&!_0x2d7b94){return _0x35e01b['ifTime'](_0x5c0bad,!![])[_0x545e('0x36')](function(){return _0x35e01b[_0x545e('0x86')](_0x5c0bad,![]);})['then'](function(){return _0x35e01b[_0x545e('0xa6')](_0x5c0bad);})[_0x545e('0x97')](function(_0x2695f8){loggerSyncQueueSummary['debug'](_0x545e('0x132'),util[_0x545e('0x3c')](_0x2695f8,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5c0bad);});}else{clearPredictiveAttributes(_0x5c0bad);}})['then'](function(){var _0x3f6434=_0x1406a6[_0x545e('0x133')](_0x5c0bad);if(_0x3f6434||_0x5c0bad[_0x545e('0x134')]){_0x5c0bad['queueSummaryCountersUpdated']=![];_0x1406a6[_0x545e('0x135')](_0x5c0bad);Object[_0x545e('0x136')](_0x5c0bad,_0x1406a6);emitOutboundVoiceQueueSummary(_0x1406a6);}_0x35e01b['queuesSummary'][_0x5c0bad[_0x545e('0x3f')]][_0x545e('0x12c')]=![];})['catch'](function(_0x497626){logger[_0x545e('0x5b')](_0x545e('0x132'),util[_0x545e('0x3c')](_0x497626,{'showHidden':![],'depth':null}));_0x35e01b['queuesSummary'][_0x5c0bad['name']][_0x545e('0x12c')]=![];});};Dialer[_0x545e('0x77')][_0x545e('0x2e')]=_[_0x545e('0x137')](function(){var _0x403fef=_[_0x545e('0x138')](this['voiceQueues'],function(_0x19e475){return _0x19e475['dialPreviewRecallmeReminder'];});var _0x52219a=_['filter'](this[_0x545e('0x1f')],function(_0x56a508){return _0x56a508['online']&&_0x56a508['status']===_0x545e('0x7c');});if(_0x403fef[_0x545e('0x8d')]>0x0&&_0x52219a[_0x545e('0x8d')]>0x0){return Promise[_0x545e('0xa2')]()[_0x545e('0x36')](cmHopper[_0x545e('0x139')](_[_0x545e('0x13a')](_0x403fef,'id'),previewRecallmeReminderInterval,_[_0x545e('0x13a')](_0x52219a,'id')))[_0x545e('0x36')](function(_0x3b36b5){for(var _0x4542af=0x0;_0x4542af<_0x3b36b5[_0x545e('0x8d')];_0x4542af++){var _0x2ea2d7=_0x3b36b5[_0x4542af][_0x545e('0x13b')][_0x545e('0x3f')];if(_0x2ea2d7)io['to'](util[_0x545e('0x3d')](_0x545e('0x13c'),_0x2ea2d7))[_0x545e('0x39')](_0x545e('0x13d'),{'hopper':_0x3b36b5[_0x4542af]});}})[_0x545e('0x97')](function(_0x573486){logger[_0x545e('0x5b')](_0x545e('0x13e'),_0x573486);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x545e('0x13f')]=function(){var _0x436009=this;setInterval(function(){_0x436009[_0x545e('0x140')](_0x436009[_0x545e('0xb3')],_0x545e('0x141'));_0x436009[_0x545e('0x140')](_0x436009[_0x545e('0xe3')],_0x545e('0x142'));},0x32c8);};Dialer['prototype'][_0x545e('0x140')]=function(_0x2a032e,_0x4f3ac8){var _0xccb435=this;for(var _0x1109be in _0x2a032e){if(typeof _0x2a032e[_0x1109be]!==_0x545e('0x143')){this[_0x545e('0x144')][_0x545e('0x145')](function(){if(!_[_0x545e('0xe9')](_0x2a032e[_0x1109be])){return ami[_0x545e('0x95')]({'action':_0x545e('0x7b'),'channel':_0x2a032e[_0x1109be][_0x545e('0xe4')]})[_0x545e('0x97')](function(_0x24d5da){if(_0x24d5da[_0x545e('0x63')]===_0x545e('0x146')){setTimeout(function(){if(_0x2a032e[_0x1109be]&&_0x2a032e[_0x1109be][_0x545e('0xb5')]!==_0x545e('0xb6')){_0xccb435[_0x545e('0xc1')](_0xccb435[_0x545e('0x1d')][_0x2a032e[_0x1109be][_0x545e('0xb2')]]);logger[_0x545e('0x5b')](_0x545e('0x147'),_0x4f3ac8,_0x1109be,_0x2a032e[_0x1109be][_0x545e('0xb2')]);delete _0x2a032e[_0x1109be];}if(_0x2a032e[_0x1109be]&&_0x2a032e[_0x1109be][_0x545e('0xb5')]===_0x545e('0xb6')){_0xccb435[_0x545e('0xc1')](_0xccb435[_0x545e('0x1e')][_0x2a032e[_0x1109be][_0x545e('0xb2')]]);logger['error'](_0x545e('0x148'),_0x4f3ac8,_0x1109be,_0x2a032e[_0x1109be]['queue']);delete _0x2a032e[_0x1109be];}},0x2328);}});}});}}};Dialer[_0x545e('0x77')][_0x545e('0x149')]=function(_0x2b4949){return Promise[_0x545e('0xa2')]()['then'](voiceQueueRt[_0x545e('0x149')](_0x2b4949))[_0x545e('0x97')](loggerCatch(_0x545e('0x14a')));};Dialer[_0x545e('0x77')][_0x545e('0xc1')]=function(_0x5c91cb){if(!_[_0x545e('0x38')](_0x5c91cb)&&_0x5c91cb!==null){if(typeof _0x5c91cb['originated']!==_0x545e('0x143')){if(_0x5c91cb[_0x545e('0x14b')]>0x0){_0x5c91cb[_0x545e('0x14b')]-=0x1;}else{logger[_0x545e('0x5b')](_0x545e('0x14c'));}}}else{logger[_0x545e('0x5b')](_0x545e('0x14d'));}};Dialer[_0x545e('0x77')]['loggerHandler']=function(_0x36088f,_0x279a01){var _0x5ea5cf=this;return function(_0x1cffc1){_0x5ea5cf[_0x545e('0xc1')](_0x279a01);logger[_0x545e('0x5b')](_0x36088f,util[_0x545e('0x3c')](_0x1cffc1,{'showHidden':![],'depth':null}));};};Dialer[_0x545e('0x77')][_0x545e('0x14e')]=function(_0x643e41,_0x37d9a2,_0x5324a5){var _0x2e0c37={'state':0x19,'statedesc':_0x545e('0x14f')};this[_0x545e('0xc1')](_0x37d9a2);this['saveInDb'](_[_0x545e('0x55')](_0x2e0c37,_[_0x545e('0x6a')](_0x5324a5,['ContactId',_0x545e('0xde'),'UserId',_0x545e('0xdf'),'CampaignId'])),_0x545e('0x150'),_0x545e('0x151'));logger[_0x545e('0x5b')](_0x643e41);};Dialer[_0x545e('0x77')][_0x545e('0x11e')]=function(_0x50371a,_0x576d12,_0x3a5d02){hopperUtils[_0x545e('0xbe')](_0x50371a)[_0x545e('0x97')](loggerCatch(_0x576d12));hopperUtils[_0x545e('0xbf')](_0x50371a)[_0x545e('0x97')](loggerCatch(_0x3a5d02));};Dialer[_0x545e('0x77')][_0x545e('0xd0')]=function(_0x339459,_0x55250e){hopperUtils[_0x545e('0xbe')](_0x339459)[_0x545e('0x97')](loggerCatch(_0x545e('0x129')));if(_0x55250e==0x0){hopperUtils[_0x545e('0xbf')](_0x339459)[_0x545e('0x97')](loggerCatch(_0x545e('0x152')));}};Dialer['prototype'][_0x545e('0x13e')]=function(_0xaae781){return Promise[_0x545e('0xa2')]()[_0x545e('0x36')](cmHopper[_0x545e('0x139')](_0xaae781['id'],previewRecallmeReminderInterval))[_0x545e('0x36')](function(_0x426c93){for(var _0x367fc6=0x0;_0x367fc6<_0x426c93['length'];_0x367fc6++){var _0x3989bf=_0x426c93[_0x367fc6][_0x545e('0x13b')]['name'];if(_0x3989bf)io['to'](util[_0x545e('0x3d')]('user:%s',_0x3989bf))[_0x545e('0x39')]('user:dialPreviewRecallReminder',{'hopper':_0x426c93[_0x367fc6]});}})[_0x545e('0x97')](function(){});};Dialer['prototype'][_0x545e('0xa4')]=function(_0x20f3d3){var _0x589c52=this;return function(){_0x589c52[_0x545e('0x153')](_0x20f3d3);};};Dialer[_0x545e('0x77')][_0x545e('0x154')]=function(_0x4ae9dc,_0x3869de){var _0x568c89=this;var _0x20ea8a=uuid['v4']();this[_0x545e('0xe3')][_0x20ea8a]=new Action(_0x4ae9dc,_0x3869de,_0x20ea8a);return new Promise(function(_0x2e8fdf,_0x41943a){if(_[_0x545e('0x38')](_0x4ae9dc)&&typeof _0x4ae9dc!==_0x545e('0x155')){return _0x41943a(msgResponse('originate','Failure',_0x545e('0x156')));}if(_[_0x545e('0x38')](_0x3869de[_0x545e('0x157')])||_0x3869de['phone']===null){return _0x41943a(msgResponse(_0x545e('0x158'),'Failure',_0x545e('0x159')));}var _0x56ff07={'XMD-CALLERID':_0x568c89['actions'][_0x20ea8a][_0x545e('0x15a')](),'XMD-AGI':_0x4ae9dc[_0x545e('0x15b')]?util[_0x545e('0x3d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4ae9dc['dialQueueProject']):_0x545e('0x15c'),'XMD-AGIAFTER':_0x4ae9dc[_0x545e('0xbd')]?util[_0x545e('0x3d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4ae9dc[_0x545e('0xbd')]):'NONE','XMD-QUEUE':utils[_0x545e('0x15d')](_0x4ae9dc)?util[_0x545e('0x3d')](_0x545e('0x15e'),_0x4ae9dc['name'],_0x4ae9dc[_0x545e('0x15f')]||'',_0x4ae9dc[_0x545e('0x160')]?'c':'',_0x4ae9dc['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x3869de['ContactId'],'XMD-CDRTYPE':_0x545e('0x8'),'CALLERID(all)':_0x568c89[_0x545e('0xe3')][_0x20ea8a]['getCaller'](),'XMD-AMD':_0x4ae9dc[_0x545e('0x10e')]?_0x545e('0x131'):_0x545e('0x15c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4ae9dc[_0x545e('0x10e')]){_0x56ff07[_0x545e('0x161')]=_0x4ae9dc[_0x545e('0x162')]||0x9c4;_0x56ff07['XMD-AMDGREETING']=_0x4ae9dc[_0x545e('0x163')]||0x5dc;_0x56ff07['XMD-AMDAFTERGREETINGSILENCE']=_0x4ae9dc[_0x545e('0x164')]||0x320;_0x56ff07[_0x545e('0x165')]=_0x4ae9dc[_0x545e('0x166')]||0x1388;_0x56ff07[_0x545e('0x167')]=_0x4ae9dc[_0x545e('0x168')]||0x64;_0x56ff07[_0x545e('0x169')]=_0x4ae9dc['dialAMDBetweenWordsSilence']||0x32;_0x56ff07[_0x545e('0x16a')]=_0x4ae9dc[_0x545e('0x16b')]||0x3;_0x56ff07[_0x545e('0x16c')]=_0x4ae9dc[_0x545e('0x16d')]||0x100;_0x56ff07[_0x545e('0x16e')]=_0x4ae9dc[_0x545e('0x16f')]||0x1388;}if(utils['isOutboundQueue'](_0x4ae9dc)){_0x56ff07[_0x545e('0x170')]=_0x3869de[_0x545e('0xdf')];}else{_0x56ff07[_0x545e('0x171')]=_0x3869de[_0x545e('0xd5')];}var _0x404f3c=utils[_0x545e('0x172')](_0x3869de[_0x545e('0x173')]);Object[_0x545e('0x136')](_0x56ff07,_0x404f3c);var _0x10831c=_0x568c89[_0x545e('0x78')](_0x4ae9dc[_0x545e('0x7f')])?utils[_0x545e('0x174')](_0x4ae9dc[_0x545e('0x7f')][_0x545e('0x175')],_0x4ae9dc[_0x545e('0x176')],_0x4ae9dc[_0x545e('0x177')]>0x0?utils['getCallerIdRandom'](_0x4ae9dc[_0x545e('0x178')],_0x4ae9dc['dialRandomLastDigitCallerIdNumber']):_0x4ae9dc[_0x545e('0x178')]):utils['getCallerId'](_['isNil'](_0x4ae9dc[_0x545e('0x80')])?_0x4ae9dc['Trunk'][_0x545e('0x175')]:_0x4ae9dc[_0x545e('0x80')]['callerid'],_0x4ae9dc[_0x545e('0x176')],_0x4ae9dc[_0x545e('0x177')]>0x0?utils[_0x545e('0x179')](_0x4ae9dc[_0x545e('0x178')],_0x4ae9dc[_0x545e('0x177')]):_0x4ae9dc['dialOriginateCallerIdNumber']);if(_0x10831c){_0x56ff07[_0x545e('0x17a')]=_0x568c89['actions'][_0x20ea8a]['originatecalleridname']=utils[_0x545e('0x17b')](_0x10831c);_0x56ff07['XMD-ORIGINATECALLERIDNUM']=_0x3869de['phone'];}_0x4ae9dc[_0x545e('0x17c')]=_0x56ff07;return ami[_0x545e('0x95')]({'actionid':_0x20ea8a,'action':_0x545e('0x158'),'channel':_0x568c89[_0x545e('0x78')](_0x4ae9dc[_0x545e('0x7f')])?util[_0x545e('0x3d')]('SIP/%s/%s%s',_0x4ae9dc['Trunk']['name'],isNotNull(_0x4ae9dc[_0x545e('0x17d')])?_0x4ae9dc['dialPrefix'][_0x545e('0x17e')]()||'':'',_0x4ae9dc[_0x545e('0x17f')]>0x0?_0x3869de[_0x545e('0x157')]['substring'](_0x4ae9dc[_0x545e('0x17f')]):_0x3869de[_0x545e('0x157')]):util['format'](_0x545e('0x180'),_[_0x545e('0xe9')](_0x4ae9dc['TrunkBackup'])?_0x4ae9dc[_0x545e('0x7f')][_0x545e('0x3f')]:_0x4ae9dc[_0x545e('0x80')][_0x545e('0x3f')],isNotNull(_0x4ae9dc[_0x545e('0x17d')])?_0x4ae9dc[_0x545e('0x17d')][_0x545e('0x17e')]()||'':'',_0x4ae9dc[_0x545e('0x17f')]>0x0?_0x3869de[_0x545e('0x157')][_0x545e('0x181')](_0x4ae9dc[_0x545e('0x17f')]):_0x3869de[_0x545e('0x157')]),'callerid':_0x10831c,'Exten':_0x545e('0x182'),'Context':_0x545e('0x183'),'Priority':'1','variable':_0x56ff07,'timeout':(_0x4ae9dc[_0x545e('0x184')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20ea8a})[_0x545e('0x36')](function(_0x499de9){return _0x2e8fdf(_0x499de9);})[_0x545e('0x97')](function(_0x4e86e0){_0x4ae9dc[_0x545e('0x185')]+=0x1;var _0x18ad5a=new History(_0x568c89[_0x545e('0xe3')][_0x20ea8a]);logger[_0x545e('0x5b')](util[_0x545e('0x3d')](_0x545e('0x186'),JSON['stringify'](_0x4e86e0)));_0x18ad5a[_0x545e('0x64')]=0xe;_0x18ad5a[_0x545e('0x65')]='OriginateError';_0x18ad5a['starttime']=moment()['format'](_0x545e('0xb7'));_0x18ad5a[_0x545e('0x66')]=_0x18ad5a[_0x545e('0xd6')];hopperUtils['createHistory'](_0x18ad5a)[_0x545e('0x97')](loggerCatch('[originate][error]'));_0x568c89[_0x545e('0xbf')](_0x18ad5a)[_0x545e('0x97')](loggerCatch('[originate][error]'))[_0x545e('0x1b')](function(){delete _0x568c89[_0x545e('0xe3')][_0x20ea8a];return _0x41943a(msgResponse('originate','Error',_0x545e('0x187')));});});});};Dialer[_0x545e('0x77')]['checkRetriveMax']=function(_0x340310,_0x2fe3c7,_0x470562){var _0x5c496f=new History(_0x2fe3c7);if(_0x5c496f[_0x545e('0x114')]+_0x5c496f['countcongestionretry']+_0x5c496f[_0x545e('0x116')]+_0x5c496f[_0x545e('0x117')]+_0x5c496f[_0x545e('0xc9')]+_0x5c496f[_0x545e('0xdb')]+_0x5c496f[_0x545e('0x111')]+_0x5c496f[_0x545e('0x122')]>=_0x470562[_0x545e('0x118')]-0x1){return!![];}switch(_0x340310){case 0x3:if(_0x5c496f[_0x545e('0x116')]>=_0x470562[_0x545e('0x188')]-0x1){return!![];}hopperUtils[_0x545e('0xd1')]({'active':![],'countnoanswerretry':_0x5c496f[_0x545e('0x116')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0x189')],'minutes')[_0x545e('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f[_0x545e('0xde')],'VoiceQueueId':_0x5c496f['VoiceQueueId']||undefined,'CampaignId':_0x5c496f[_0x545e('0xd5')]||undefined})['catch'](loggerCatch(_0x545e('0x18a')));break;case 0x5:if(_0x5c496f[_0x545e('0x114')]>=_0x470562[_0x545e('0x18b')]-0x1){return!![];}hopperUtils[_0x545e('0xd1')]({'active':![],'countbusyretry':_0x5c496f[_0x545e('0x114')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0x18c')],_0x545e('0xd3'))['format'](_0x545e('0xb7')),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f[_0x545e('0xde')],'VoiceQueueId':_0x5c496f[_0x545e('0xdf')]||undefined,'CampaignId':_0x5c496f['CampaignId']||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x18d')));break;case 0x8:if(_0x5c496f[_0x545e('0x115')]>=_0x470562[_0x545e('0x18e')]-0x1){return!![];}hopperUtils[_0x545e('0xd1')]({'active':![],'countcongestionretry':_0x5c496f[_0x545e('0x115')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562['dialCongestionRetryFrequency'],'minutes')[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f['ContactId'],'ListId':_0x5c496f['ListId'],'VoiceQueueId':_0x5c496f[_0x545e('0xdf')]||undefined,'CampaignId':_0x5c496f[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x18f')));break;case 0x0:if(_0x5c496f[_0x545e('0x117')]>=_0x470562[_0x545e('0x190')]-0x1){return!![];}else{hopperUtils[_0x545e('0xd1')]({'active':![],'countnosuchnumberretry':_0x5c496f[_0x545e('0x117')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0x191')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f['ListId'],'VoiceQueueId':_0x5c496f[_0x545e('0xdf')]||undefined,'CampaignId':_0x5c496f['CampaignId']||undefined})[_0x545e('0x97')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x5c496f[_0x545e('0xc9')]>=_0x470562[_0x545e('0x192')]-0x1){return!![];}hopperUtils[_0x545e('0xd1')]({'active':![],'countdropretry':_0x5c496f[_0x545e('0xc9')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562['dialDropRetryFrequency'],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f['ContactId'],'ListId':_0x5c496f[_0x545e('0xde')],'VoiceQueueId':_0x5c496f['VoiceQueueId']||undefined,'CampaignId':_0x5c496f[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x193')));break;case 0xb:if(_0x5c496f[_0x545e('0xdb')]>=_0x470562[_0x545e('0xdd')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5c496f[_0x545e('0xdb')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0xdc')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f['ListId'],'VoiceQueueId':_0x5c496f[_0x545e('0xdf')]||undefined,'CampaignId':_0x5c496f[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0xe0')));break;case 0x13:if(_0x5c496f['countmachineretry']>=_0x470562[_0x545e('0x119')]-0x1){return!![];}hopperUtils[_0x545e('0xd1')]({'active':![],'countmachineretry':_0x5c496f[_0x545e('0x111')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0x11c')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f[_0x545e('0xde')],'VoiceQueueId':_0x5c496f['VoiceQueueId']||undefined,'CampaignId':_0x5c496f['CampaignId']||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x11d')));break;case 0x14:if(_0x5c496f[_0x545e('0x122')]>=_0x470562[_0x545e('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x5c496f[_0x545e('0x122')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0x195')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f[_0x545e('0xde')],'VoiceQueueId':_0x5c496f[_0x545e('0xdf')]||undefined,'CampaignId':_0x5c496f[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x545e('0x77')][_0x545e('0x101')]=function(_0x4fa293,_0x53be37,_0xee4a4e){var _0x1ac65c=this;var _0x9a062f=new History(_0x4fa293);var _0x5e7ed6=![];var _0x44b4d9;var _0xe6e331;return new Promise(function(_0x52b0d4,_0x34d5fe){if(_[_0x545e('0x38')](_0x53be37)&&typeof _0x53be37!==_0x545e('0x155')){return _0x34d5fe(msgResponse('[callProgressDetecting]',_0x545e('0x87'),'entity\x20is\x20undefine'));}if(_[_0x545e('0x38')](_0xee4a4e)&&typeof _0xee4a4e!==_0x545e('0x155')){return _0x34d5fe(msgResponse(_0x545e('0x196'),'Failure',_0x545e('0x197')));}hopperUtils[_0x545e('0xcd')](_0x9a062f,_0xee4a4e['reason'],_0x53be37)['then'](function(_0x2983a2){if(_0x2983a2[_0x545e('0xcf')]==0x1)_0x5e7ed6=!![];switch(_0xee4a4e['reason']){case'0':_0x53be37[_0x545e('0x198')]+=0x1;_0x9a062f[_0x545e('0x64')]=0x0;_0x9a062f[_0x545e('0x65')]=_0x545e('0x199');_0x9a062f[_0x545e('0x117')]+=0x1;_0x9a062f['countglobal']+=0x1;ami[_0x545e('0x39')](_0x545e('0x19a'),ut['buildObj'](_0x4fa293,_0x545e('0x19b')));_0x44b4d9=_0x53be37['dialNoSuchNumberRetryFrequency'];_0xe6e331=_0x53be37[_0x545e('0xcc')];hopperUtils[_0x545e('0xbe')](_0x9a062f)['catch'](loggerCatch(_0x545e('0x113')));if(_0x1ac65c[_0x545e('0x19c')](0x0,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f['countnosuchnumberretry']>=_0x53be37[_0x545e('0x190')]){_0x1ac65c['createStateFinal'](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x19d'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x19d'));}}break;case'3':_0x53be37[_0x545e('0x19e')]+=0x1;_0x9a062f[_0x545e('0x64')]=0x3;_0x9a062f['statedesc']=_0x545e('0x19f');_0x9a062f['countnoanswerretry']+=0x1;_0x9a062f['countglobal']+=0x1;var _0x37d7bf=ut[_0x545e('0x1a0')](_0x4fa293,_0x53be37);ami[_0x545e('0x39')]('custom:agentnoanswer',_0x37d7bf);_0x44b4d9=_0x53be37['dialNoAnswerRetryFrequency'];_0xe6e331=_0x53be37['callAdditionalPhoneAfterMin'];hopperUtils[_0x545e('0xbe')](_0x9a062f)[_0x545e('0x97')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1ac65c[_0x545e('0x19c')](0x3,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f[_0x545e('0x116')]>=_0x53be37[_0x545e('0x188')]){_0x1ac65c[_0x545e('0x11a')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1a1'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1a1'));}}break;case'5':_0x53be37[_0x545e('0x1a2')]+=0x1;_0x9a062f[_0x545e('0x64')]=0x5;_0x9a062f[_0x545e('0x65')]=_0x545e('0x1a3');_0x9a062f[_0x545e('0x114')]+=0x1;_0x9a062f[_0x545e('0xca')]+=0x1;ami['emit']('custom:agentbusy',ut['buildObj'](_0x4fa293,_0x545e('0x1a4')));_0x44b4d9=_0x53be37['dialBusyRetryFrequency'];_0xe6e331=_0x53be37[_0x545e('0xcc')];hopperUtils['createHistory'](_0x9a062f)['catch'](loggerCatch(_0x545e('0x1a5')));if(_0x1ac65c[_0x545e('0x19c')](0x5,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f[_0x545e('0x114')]>=_0x53be37[_0x545e('0x18b')]){_0x1ac65c[_0x545e('0x11a')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1a6'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1a6'));}}break;case'8':_0x53be37['outboundCongestionCallsDay']+=0x1;_0x9a062f[_0x545e('0x64')]=0x8;_0x9a062f[_0x545e('0x65')]='Congestion';_0x9a062f[_0x545e('0x115')]+=0x1;_0x9a062f[_0x545e('0xca')]+=0x1;_0x44b4d9=_0x53be37[_0x545e('0x1a7')];_0xe6e331=_0x53be37['callAdditionalPhoneAfterMin'];ami[_0x545e('0x39')](_0x545e('0x1a8'),ut[_0x545e('0x10b')](_0x4fa293,_0x545e('0x1a9')));hopperUtils[_0x545e('0xbe')](_0x9a062f)[_0x545e('0x97')](loggerCatch(_0x545e('0x1aa')));if(_0x1ac65c[_0x545e('0x19c')](0x8,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f[_0x545e('0x115')]>=_0x53be37[_0x545e('0x18e')]){_0x1ac65c[_0x545e('0x11a')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1ab'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1ab'));}}break;case'11':_0x53be37[_0x545e('0x1ac')]+=0x1;_0x9a062f['state']=0xb;_0x9a062f['statedesc']=_0x545e('0x1ad');_0x9a062f['countabandonedretry']+=0x1;_0x9a062f[_0x545e('0xca')]+=0x1;_0x44b4d9=_0x53be37['dialAbandonedRetryFrequency'];_0xe6e331=_0x53be37[_0x545e('0xcc')];hopperUtils[_0x545e('0xbe')](_0x9a062f)[_0x545e('0x97')](loggerCatch(_0x545e('0xe1')));if(_0x1ac65c[_0x545e('0x19c')](0xb,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f[_0x545e('0xdb')]>=_0x53be37[_0x545e('0xdd')]){_0x1ac65c[_0x545e('0x11a')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1ae'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1ae'));}}break;case'20':_0x53be37['outboundRejectCallsDay']+=0x1;_0x9a062f['state']=0x14;_0x9a062f[_0x545e('0x65')]=_0x545e('0x1af');_0x9a062f[_0x545e('0x122')]+=0x1;_0x9a062f[_0x545e('0xca')]+=0x1;_0x44b4d9=_0x53be37[_0x545e('0x195')];_0xe6e331=_0x53be37[_0x545e('0xcc')];ami[_0x545e('0x39')](_0x545e('0x1b0'),ut[_0x545e('0x10b')](_0x4fa293,_0x545e('0x1b1')));hopperUtils['createHistory'](_0x9a062f)[_0x545e('0x97')](loggerCatch(_0x545e('0x1b2')));if(_0x1ac65c[_0x545e('0x19c')](0x14,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f[_0x545e('0x122')]>=_0x53be37[_0x545e('0x194')]){_0x1ac65c[_0x545e('0x11a')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1b3'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1b3'));}}break;default:_0x53be37[_0x545e('0x12a')]+=0x1;_0x9a062f[_0x545e('0x64')]=0xc;_0x9a062f[_0x545e('0x65')]=_0xee4a4e[_0x545e('0xba')];_0x44b4d9=_0x53be37[_0x545e('0x195')];_0xe6e331=_0x53be37['callAdditionalPhoneAfterMin'];hopperUtils[_0x545e('0xbe')](_0x9a062f)[_0x545e('0x97')](loggerCatch(_0x545e('0x1b4')));if(_0x1ac65c[_0x545e('0x19c')](_0xee4a4e[_0x545e('0xba')],_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f['countbusyretry']+_0x9a062f[_0x545e('0x115')]+_0x9a062f[_0x545e('0x116')]+_0x9a062f[_0x545e('0x117')]+_0x9a062f[_0x545e('0xc9')]+_0x9a062f[_0x545e('0xdb')]+_0x9a062f['countmachineretry']+_0x9a062f[_0x545e('0x122')]>=_0x53be37[_0x545e('0x118')]){_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0xee4a4e[_0x545e('0xba')]);}else{_0x1ac65c['createStateFinal'](_0x9a062f,_0x52b0d4,_0x34d5fe,_0xee4a4e[_0x545e('0xba')]);}}}})[_0x545e('0x36')](function(){if(_0x5e7ed6){hopperUtils[_0x545e('0xe2')](_0x9a062f,_0x44b4d9,_0xe6e331)[_0x545e('0x36')](function(){return _0x52b0d4(0x1);});}});});};Dialer['prototype'][_0x545e('0x123')]=function(_0x1a6b5e,_0x5d57a5,_0xb98581,_0x1c7a39){var _0x4b3f78=new Final(_0x1a6b5e);_0x4b3f78[_0x545e('0x64')]=0xf;_0x4b3f78['statedesc']='Global';this['createStateFinal'](_0x4b3f78,_0x5d57a5,_0xb98581,_0x1c7a39);};Dialer[_0x545e('0x77')]['createStateFinal']=function(_0x2c77c9,_0x4d77ce,_0x212036,_0x286b2e){hopperUtils[_0x545e('0xbf')](_0x2c77c9)[_0x545e('0x36')](function(){return _0x4d77ce(msgResponse(_0x545e('0x196'),_0x545e('0x100'),_0x286b2e));})['catch'](function(){return _0x212036(msgResponse('[moveContactManagedDialer][0]',_0x545e('0x87'),_0x545e('0x1b5')));});};Dialer['prototype'][_0x545e('0xb')]=function(_0x4cc266){var _0x360593=_0x4cc266[_0x545e('0x1b6')]/0x64;var _0x7b7503=_0x4cc266[_0x545e('0xc5')]/(_0x4cc266[_0x545e('0xc5')]+_0x4cc266[_0x545e('0xb9')]);var _0x61b808=Math['round'](_0x4cc266[_0x545e('0x1b7')]*(_0x4cc266['predictiveIntervalMaxThreshold']/0x64));var _0xd166fe=Math[_0x545e('0x1b8')](_0x4cc266[_0x545e('0x1b7')]*(_0x4cc266[_0x545e('0x1b9')]/0x64));var _0x2d6ce7=_0x4cc266[_0x545e('0x12e')]+_0x4cc266[_0x545e('0x130')];var _0x11bfe3=Math['floor'](_0x4cc266['erlangCalls']*_0x4cc266[_0x545e('0x54')]*_0x4cc266[_0x545e('0x1ba')]*_0x4cc266[_0x545e('0x1bb')]);if(_[_0x545e('0x38')](_0x4cc266['startProgressive'])){if(!_[_0x545e('0x38')](_0x4cc266[_0x545e('0x59')])){_0x4cc266['startPredictive']=undefined;loggerPredictive[_0x545e('0x5b')](_0x545e('0x1bc'),_0x545e('0x1bd'));}if(!_[_0x545e('0x38')](_0x4cc266[_0x545e('0x1be')])){loggerPredictive[_0x545e('0x5b')](_0x545e('0x1bc'),_0x545e('0x1bf'));clearInterval(_0x4cc266[_0x545e('0x1be')]);_0x4cc266[_0x545e('0x1be')]=undefined;}_0x4cc266['startProgressive']=moment()[_0x545e('0x3d')](_0x545e('0xb7'));loggerPredictive[_0x545e('0x42')](_0x4cc266['name'],'collection\x20data\x20in\x20progressive\x20at',_0x4cc266[_0x545e('0x22')]);this[_0x545e('0xa9')](_0x4cc266,0x1);}else if(ifInterval(_0x4cc266[_0x545e('0x1c0')],_0x4cc266[_0x545e('0x22')])){this[_0x545e('0xa9')](_0x4cc266,0x1);loggerPredictiveCalls[_0x545e('0x42')](_0x545e('0x1c1'),_0x4cc266[_0x545e('0x22')],_0x4cc266[_0x545e('0x3f')]);_0x4cc266['erlangCalls']=0x0;_0x4cc266['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x360593<_0x7b7503&&_0x4cc266[_0x545e('0x1c2')]===_0x545e('0x1c3')){clearPredictiveAttributes(_0x4cc266);loggerPredictive[_0x545e('0x42')](_0x545e('0x1c4'),'Dropped\x20calls\x20day',_0x7b7503,_0x545e('0x22'),_0x4cc266[_0x545e('0x3f')]);}else if(_0x11bfe3<_0x4cc266[_0x545e('0xc6')]&&_0x4cc266[_0x545e('0x1c2')]===_0x545e('0x1c3')){clearPredictiveAttributes(_0x4cc266);loggerPredictive['info'](_0x545e('0x1c5'),_0x545e('0x1c6'),_0x11bfe3,_0x545e('0x1c7'),_0x4cc266[_0x545e('0xc6')],'startProgressive',_0x4cc266['name']);}else if(!ifInterval(_0x4cc266[_0x545e('0x1c0')],_0x4cc266['startProgressive'])&&_['isUndefined'](_0x4cc266[_0x545e('0x59')])&&!_[_0x545e('0x38')](_0x4cc266['startProgressive'])){_0x4cc266['startPredictive']=moment()[_0x545e('0x3d')](_0x545e('0xb7'));loggerPredictive[_0x545e('0x42')](_0x4cc266[_0x545e('0x3f')],'started\x20in\x20predictive\x20at',_0x4cc266[_0x545e('0x59')]);hopperUtils[_0x545e('0x1c8')](_0x4cc266['dialPredictiveInterval'])[_0x545e('0x36')](this['getDataPredictive'](_0x4cc266))[_0x545e('0x36')](mergeDataErlangB(_0x4cc266))[_0x545e('0x36')](this['startMethodPredictive'](_0x4cc266))[_0x545e('0x97')](loggerCatchPredictive(_0x545e('0x1c9'),_0x4cc266));}else if(!ifInterval(_0x4cc266[_0x545e('0x1c0')],_0x4cc266['startPredictive'])){_0x4cc266[_0x545e('0xc6')]=0x0;_0x4cc266[_0x545e('0x59')]=moment()[_0x545e('0x3d')](_0x545e('0xb7'));loggerPredictive[_0x545e('0x42')](_0x4cc266[_0x545e('0x3f')],'recalculate\x20predictive\x20at',_0x4cc266['startPredictive']);clearInterval(_0x4cc266[_0x545e('0x1be')]);_0x4cc266['handlePredictive']=undefined;hopperUtils[_0x545e('0x1c8')](_0x4cc266['dialPredictiveInterval'])[_0x545e('0x36')](this[_0x545e('0x1ca')](_0x4cc266))[_0x545e('0x36')](mergeDataErlangB(_0x4cc266))[_0x545e('0x36')](this[_0x545e('0x1cb')](_0x4cc266))['catch'](loggerCatchPredictive(_0x545e('0x1cc'),_0x4cc266));}else if(_0x4cc266[_0x545e('0x1b7')]&&_0x2d6ce7<_0x4cc266[_0x545e('0x1b7')]-_0xd166fe){clearPredictiveAttributes(_0x4cc266);loggerPredictive[_0x545e('0x42')](_0x4cc266['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2d6ce7,_0x545e('0x1cd'),_0x4cc266[_0x545e('0x1b7')],'-',_0xd166fe,'=',_0x4cc266['predictiveIntervalAvailable']-_0xd166fe,')');}else if(_0x4cc266[_0x545e('0x1b7')]&&_0x2d6ce7>_0x4cc266[_0x545e('0x1b7')]+_0x61b808){clearPredictiveAttributes(_0x4cc266);loggerPredictive['info'](_0x4cc266['name'],_0x545e('0x1ce'),_0x2d6ce7,_0x545e('0x1cf'),_0x4cc266[_0x545e('0x1b7')],'+',_0x61b808,'=',_0x4cc266[_0x545e('0x1b7')]+_0x61b808,')');}};Dialer[_0x545e('0x77')][_0x545e('0x1ca')]=function(_0x4b7515){var _0x7cbc11=this;return function(_0x39d7db){return new Promise(function(_0x5631a2,_0x4b6c7c){_[_0x545e('0x55')](_0x4b7515,_0x39d7db[0x0]);if(checkGetDataPredictive(_0x39d7db[0x0])){var _0x42b9d5=_0x4b7515['predictiveIntervalAvailable']=_0x4b7515['talking']+_0x4b7515['available'];var _0x29433c=_0x4b7515[_0x545e('0x1c0')]*0x3c;var _0x567f1f=_0x39d7db[0x0]['predictiveIntervalAvgTalktime']+_0x39d7db[0x0]['predictiveIntervalAvgHoldtime'];var _0x1c61df=(_0x39d7db[0x0][_0x545e('0x1d0')]+_0x39d7db[0x0][_0x545e('0x1d1')]+_0x39d7db[0x0][_0x545e('0x46')])/_0x39d7db[0x0][_0x545e('0x44')];_0x4b7515[_0x545e('0x1ba')]=_0x1c61df>0x0?_0x1c61df:0x1;switch(_0x4b7515[_0x545e('0x1c2')]){case _0x545e('0x1c3'):var _0xf0840=_0x4b7515['dialPredictiveOptimizationPercentage']/0x64;return _0x7cbc11[_0x545e('0x1d2')](_0x42b9d5,_0x29433c,_0x567f1f,_0x1c61df,_0xf0840)['then'](function(_0x47e304){return _0x5631a2(_0x47e304);});case _0x545e('0x1d3'):var _0x425c90=_0x4b7515[_0x545e('0x1b6')]/0x64;return _0x7cbc11[_0x545e('0x1d4')](_0x42b9d5,_0x29433c,_0x567f1f,_0x1c61df,_0x425c90)['then'](function(_0x2c74a5){return _0x5631a2(_0x2c74a5);});default:return _0x4b6c7c(msgResponse(_0x545e('0x1d5'),_0x545e('0x87'),_0x545e('0x1d6')));}}else{return _0x4b6c7c(msgResponse(_0x545e('0x1d5'),'Failure',_0x545e('0x1d7')));}});};};Dialer[_0x545e('0x77')][_0x545e('0x1d8')]=function(_0x162f29){var _0x34c5d6=this;return function(_0x362fb2){return new Promise(function(_0x458c97,_0x4dfd86){_[_0x545e('0x55')](_0x162f29,_0x362fb2[0x0]);if(checkGetDataPredictive(_0x362fb2[0x0])){loggerPredictive[_0x545e('0x42')](JSON[_0x545e('0x69')](_0x362fb2[0x0]));if(_0x162f29['dialPredictiveOptimization']===_0x545e('0x1c3')){return _0x34c5d6['getVoiceQueueRtPauses'](_0x162f29['id'])[_0x545e('0x36')](function(_0x4e9e8){var _0x2ed9de=_0x162f29[_0x545e('0x1d9')]-_0x4e9e8[0x0][_0x545e('0x1da')];var _0x4fdc12=_0x162f29[_0x545e('0x1c0')]*0x3c;var _0x2b880b=_0x362fb2[0x0][_0x545e('0x49')]+_0x362fb2[0x0]['predictiveIntervalAvgHoldtime'];var _0x545cad=(_0x362fb2[0x0][_0x545e('0x1d0')]+_0x362fb2[0x0][_0x545e('0x1d1')]+_0x362fb2[0x0][_0x545e('0x46')])/_0x362fb2[0x0]['predictiveIntervalTotalCalls'];var _0x3b3d70=_0x162f29['dialPredictiveOptimizationPercentage']/0x64;_0x162f29[_0x545e('0x1db')]=_0x4e9e8[0x0][_0x545e('0x1da')]||0x0;_0x162f29[_0x545e('0x1ba')]=_0x545cad>0x0?_0x545cad:0x1;return _0x34c5d6[_0x545e('0x1d2')](_0x2ed9de,_0x4fdc12,_0x2b880b,_0x545cad,_0x3b3d70);})[_0x545e('0x36')](function(_0x598f60){return _0x458c97(_0x598f60);})[_0x545e('0x97')](function(_0x1deab5){return _0x4dfd86(msgResponse(_0x545e('0x1dc'),'Failure',JSON['stringify'](_0x1deab5)));});}if(_0x162f29['dialPredictiveOptimization']==='agentBusyFactor'){return _0x34c5d6[_0x545e('0x149')](_0x162f29['id'])[_0x545e('0x36')](function(_0x12d2a7){var _0x21ff4b=_0x162f29['loggedIn']-_0x12d2a7[0x0][_0x545e('0x1da')];var _0x3928dc=_0x162f29[_0x545e('0x1c0')]*0x3c;var _0x34d2a3=_0x362fb2[0x0]['predictiveIntervalAvgTalktime']+_0x362fb2[0x0][_0x545e('0x4b')];var _0x49bce2=(_0x362fb2[0x0][_0x545e('0x1d0')]+_0x362fb2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x362fb2[0x0][_0x545e('0x46')])/_0x362fb2[0x0][_0x545e('0x44')];var _0x3cccfd=_0x162f29['dialPredictiveOptimizationPercentage']/0x64;_0x162f29[_0x545e('0x1db')]=_0x12d2a7[0x0][_0x545e('0x1da')]||0x0;_0x162f29[_0x545e('0x1ba')]=_0x49bce2>0x0?_0x49bce2:0x1;return _0x34c5d6[_0x545e('0x1d4')](_0x21ff4b,_0x3928dc,_0x34d2a3,_0x49bce2,_0x3cccfd);})[_0x545e('0x36')](function(_0x8852eb){return _0x458c97(_0x8852eb);})[_0x545e('0x97')](function(_0x210b32){return _0x4dfd86(msgResponse(_0x545e('0x1dc'),_0x545e('0x87'),JSON[_0x545e('0x69')](_0x210b32)));});}}else{return _0x4dfd86(msgResponse('[getDataPredictive]',_0x545e('0x87'),_0x545e('0x1d7')));}});};};Dialer[_0x545e('0x77')][_0x545e('0x1cb')]=function(_0x1cbe03){var _0x2cda14=this;return function(){var _0x32579d=0x0;var _0x2ded6f=Math[_0x545e('0x1dd')](_0x1cbe03[_0x545e('0x50')]*0x3e8);if(_0x2ded6f>0x0){_0x2ded6f=_0x2ded6f<0x64?0x64:_0x2ded6f;loggerPredictive['info'](_0x1cbe03[_0x545e('0x3f')],_0x545e('0x1de'),_0x2ded6f,_0x545e('0x1df'));_0x1cbe03[_0x545e('0x1be')]=setInterval(function(){_0x2cda14[_0x545e('0x1be')](_0x1cbe03);loggerPredictiveCalls[_0x545e('0x42')](_0x545e('0x1e0'),_0x32579d+=0x1);},_0x2ded6f);}else{loggerPredictive['info'](_0x1cbe03[_0x545e('0x3f')],_0x545e('0x1e1'));}};};Dialer['prototype'][_0x545e('0x1e2')]=function(_0x2be0c8,_0x577a6d){var _0x236b0c=this;return function(_0x5cce2f){if(_[_0x545e('0x41')](_0x5cce2f)){if(_[_0x545e('0xe9')](_0x577a6d[_0x545e('0x1e3')])||!_0x577a6d[_0x545e('0x1e4')]){if(_0x2be0c8['dialMethod']===_0x545e('0xa')){_0x2be0c8['queueStatusComplete']=_[_0x545e('0x38')](_0x2be0c8[_0x545e('0x67')])?!![]:_0x2be0c8[_0x545e('0x67')];var _0x44683d=uuid['v4']();_0x236b0c['actions'][_0x44683d]=new Action(_0x2be0c8,_0x577a6d,_0x44683d);loggerBooked[_0x545e('0x42')](_0x545e('0x1e5'),_0x44683d,_0x545e('0x1e6'),JSON[_0x545e('0x69')](_0x2be0c8[_0x545e('0x67')]),_0x545e('0x1e7'),_0x2be0c8[_0x545e('0x3f')]);if(_0x2be0c8['queueStatusComplete']){_0x2be0c8[_0x545e('0x67')]=![];_0x236b0c['queueBooked'][_0x236b0c['actions'][_0x44683d][_0x545e('0xb2')]]=[];ami[_0x545e('0x95')]({'actionid':_0x44683d,'action':_0x545e('0x1e8'),'queue':_0x2be0c8[_0x545e('0x3f')]})[_0x545e('0x97')](function(){_0x236b0c[_0x545e('0xc1')](_0x2be0c8);hopperUtils[_0x545e('0xd1')]({'active':![],'ContactId':_0x236b0c[_0x545e('0xe3')][_0x44683d]['ContactId'],'ListId':_0x236b0c['actions'][_0x44683d][_0x545e('0xde')],'VoiceQueueId':_0x236b0c[_0x545e('0xe3')][_0x44683d][_0x545e('0xdf')]||undefined,'CampaignId':_0x236b0c[_0x545e('0xe3')][_0x44683d][_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x1e9')));delete _0x236b0c[_0x545e('0xe3')][_0x44683d];});}else{loggerBooked[_0x545e('0x42')](_0x545e('0x1ea'),JSON[_0x545e('0x69')](_0x2be0c8['queueStatusComplete']),_0x545e('0x1e7'),_0x2be0c8['name']);_0x236b0c['updateOriginated'](_0x2be0c8);hopperUtils[_0x545e('0xd1')]({'active':![],'ContactId':_0x236b0c['actions'][_0x44683d][_0x545e('0xd4')],'ListId':_0x236b0c[_0x545e('0xe3')][_0x44683d][_0x545e('0xde')],'VoiceQueueId':_0x236b0c['actions'][_0x44683d][_0x545e('0xdf')]||undefined,'CampaignId':_0x236b0c[_0x545e('0xe3')][_0x44683d][_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x1e9')));delete _0x236b0c[_0x545e('0xe3')][_0x44683d];}}else{return _0x236b0c[_0x545e('0x154')](_0x2be0c8,_0x577a6d);}}else{if(utils[_0x545e('0x56')](undefined,_0x577a6d[_0x545e('0x1eb')])<_0x2be0c8['dialRecallMeTimeout']*0x3c){if(_0x577a6d['Agent']&&!_0x577a6d['Agent']['voicePause']){_0x236b0c['preview'][_0x545e('0xef')](_0x577a6d['id'])[_0x545e('0x1b')](function(){_0x236b0c[_0x545e('0xc1')](_0x2be0c8);});}else{hopperUtils[_0x545e('0x1ec')]({'active':![]},_0x577a6d['id'],0x1)[_0x545e('0x1b')](function(){_0x236b0c[_0x545e('0xc1')](_0x2be0c8);});}}else{_0x2be0c8[_0x545e('0x1ed')]+=0x1;_0x236b0c['updateOriginated'](_0x2be0c8);if(_0x2be0c8['dialRecallInQueue']){hopperUtils[_0x545e('0xd1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x577a6d[_0x545e('0xd4')],'ListId':_0x577a6d['ListId'],'VoiceQueueId':_0x577a6d[_0x545e('0xdf')]||undefined,'CampaignId':_0x577a6d[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils['createHistory'](createObjHistory(_0x2be0c8,_0x577a6d,utils[_0x545e('0x60')][_0x545e('0x1ee')],0x17,_0x545e('0x1ef')))[_0x545e('0x97')](loggerCatch(_0x545e('0x1f0')));}else{_0x236b0c[_0x545e('0x11e')](createObjHistory(_0x2be0c8,_0x577a6d,utils[_0x545e('0x60')]['RECALL_TIMEOUT'],0x16,'RecallFailedTimeout'),_0x545e('0x1f1'),'[Originate][HistoryRecallClose]');}}}}else{_0x2be0c8[_0x545e('0x1f2')]+=0x1;_0x236b0c[_0x545e('0x11e')](createObjHistory(_0x2be0c8,_0x577a6d,utils['CAMPAIGN_STATUS'][_0x545e('0x1f3')],0xd,_0x545e('0x1f4')),'[Originate][historyBlacklist]',_0x545e('0x1f5'));throw'inBlackList';}};};Dialer[_0x545e('0x77')][_0x545e('0x153')]=function(_0x53d865){var _0x5050bf=this;var _0xbb437e=_0x53d865[_0x545e('0x1f6')]-_0x53d865['originated'];emitCampaignSummary(_0x53d865);if(_0xbb437e>0x0&&_0x53d865[_0x545e('0x5e')]==0x0){if(_0xbb437e>this[_0x545e('0x21')]){_0xbb437e=this[_0x545e('0x21')];}_0x53d865[_0x545e('0x5e')]=0x1;hopperUtils[_0x545e('0x1f7')](_0x53d865,_0xbb437e)[_0x545e('0x36')](function(_0x5b6199){_0x53d865['temp']=0x0;if(_0x5b6199){if(!utils[_0x545e('0x1f8')](_0x5b6199)){_0x53d865[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x1f9')];logger[_0x545e('0x42')](_0x545e('0x1fa')+_0x53d865[_0x545e('0x3f')]);}else{_0x53d865[_0x545e('0x14b')]+=_0x5b6199[_0x545e('0x8d')];_0x53d865[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x1fb')];for(var _0x7c29b0=0x0;_0x7c29b0<_0x5b6199[_0x545e('0x8d')];_0x7c29b0+=0x1){_0x53d865[_0x545e('0x1fc')]+=0x1;if(_[_0x545e('0xe9')](_0x5b6199[_0x7c29b0])||_['isNil'](_0x5b6199[_0x7c29b0][_0x545e('0x173')])||_['isNil'](_0x5b6199[_0x7c29b0]['phone'])){_0x5050bf['emptyContact'](_0x545e('0x1fd'),_0x53d865,_0x5b6199[_0x7c29b0]);}else{hopperUtils[_0x545e('0x1fe')](_[_0x545e('0x6a')](_0x5b6199[_0x7c29b0],[_0x545e('0xd5'),_0x545e('0x157')]))['then'](_0x5050bf[_0x545e('0x1e2')](_0x53d865,_0x5b6199[_0x7c29b0]))['catch'](_0x5050bf[_0x545e('0x1ff')](_0x545e('0x200'),_0x53d865));}}}}})[_0x545e('0x97')](loggerGetContactDialer(_0x545e('0x201'),_0x53d865,_0xbb437e));}};Dialer[_0x545e('0x77')][_0x545e('0xa9')]=function(_0x4b72fc,_0x2581e1){var _0x13b0c6=this;var _0x379fab=[];if(_0x2581e1<0x1||_0x4b72fc['dialMethod']===_0x545e('0xa')){_0x2581e1=0x1;}var _0x352865=Math['floor'](_0x4b72fc[_0x545e('0x12e')]*_0x2581e1)-_0x4b72fc[_0x545e('0x14b')];if(_0x4b72fc[_0x545e('0x202')]>0x0){var _0x1fa8d5=_0x4b72fc['dialLimitQueue']-_0x4b72fc[_0x545e('0x14b')]-_0x4b72fc['talking']-_0x4b72fc[_0x545e('0x203')];if(_0x352865>_0x1fa8d5){_0x352865=_0x1fa8d5;}}if(_0x352865>0x0&&_0x4b72fc[_0x545e('0x5e')]==0x0){if(_0x4b72fc[_0x545e('0xa7')]===_0x545e('0xa')){_0x352865=0x1;}if(_0x352865>this[_0x545e('0x21')]){_0x352865=this['maxNumberOriginate'];}for(var _0x5a81d8 in this[_0x545e('0x1f')]){if(typeof this[_0x545e('0x1f')][_0x5a81d8]!==_0x545e('0x143')){if(this[_0x545e('0x1f')][_0x5a81d8]['state']===_0x545e('0x204')&&this[_0x545e('0x1f')][_0x5a81d8][_0x545e('0x7b')]===_0x545e('0x7c')){_0x379fab['push'](this[_0x545e('0x1f')][_0x5a81d8]['id']);}}}_0x4b72fc[_0x545e('0x5e')]=0x1;hopperUtils[_0x545e('0x205')](_0x4b72fc,_0x379fab,_0x352865)[_0x545e('0x36')](function(_0x107c49){_0x4b72fc[_0x545e('0x5e')]=0x0;if(_0x107c49){if(!utils[_0x545e('0x1f8')](_0x107c49)){hopperUtils[_0x545e('0x206')](_0x4b72fc)[_0x545e('0x36')](sendMessageReschedule(_0x4b72fc))[_0x545e('0x97')](loggerCatch('[countReScheduled]\x20'));}else{_0x4b72fc[_0x545e('0x14b')]+=_0x107c49[_0x545e('0x8d')];_0x4b72fc[_0x545e('0x63')]=_0x4b72fc[_0x545e('0xa7')]===_0x545e('0xa')?utils[_0x545e('0x60')][_0x545e('0x131')]:utils[_0x545e('0x60')][_0x545e('0x1fb')];for(var _0x126496=0x0;_0x126496<_0x107c49[_0x545e('0x8d')];_0x126496+=0x1){if(_[_0x545e('0xe9')](_0x107c49[_0x126496])||_[_0x545e('0xe9')](_0x107c49[_0x126496][_0x545e('0x173')])||_['isNil'](_0x107c49[_0x126496]['phone'])){_0x13b0c6[_0x545e('0x14e')](_0x545e('0x1fd'),_0x4b72fc,_0x107c49[_0x126496]);}else{hopperUtils[_0x545e('0x207')](_[_0x545e('0x6a')](_0x107c49[_0x126496],[_0x545e('0xdf'),'phone']))[_0x545e('0x36')](_0x13b0c6[_0x545e('0x1e2')](_0x4b72fc,_0x107c49[_0x126496]))[_0x545e('0x97')](_0x13b0c6['loggerHandler']('[actionOriginate]\x20',_0x4b72fc));}}}}})[_0x545e('0x97')](loggerGetContactDialer('[getContactDialer2]',_0x4b72fc,_0x352865));}};Dialer['prototype'][_0x545e('0x1be')]=function(_0x5fc583){if(_0x5fc583[_0x545e('0x202')]>0x0){var _0xd706c3=_0x5fc583[_0x545e('0x202')]-_0x5fc583[_0x545e('0x14b')]-_0x5fc583[_0x545e('0x130')];if(_0xd706c3>0x0&&_0x5fc583['temp']==0x0){this['tryOriginatePredictive'](_0x5fc583);}else{loggerPredictiveCalls[_0x545e('0x42')](_0x545e('0x208'));}}else{this[_0x545e('0x209')](_0x5fc583);}};Dialer[_0x545e('0x77')][_0x545e('0x209')]=function(_0x1c8e75){var _0x5ee96a=this;var _0x1eac26=[];_0x1c8e75['originated']+=0x1;for(var _0xdb6223 in this[_0x545e('0x1f')]){if(typeof this['agents'][_0xdb6223]!=='undefined'){if(this['agents'][_0xdb6223]['state']===_0x545e('0x204')&&this[_0x545e('0x1f')][_0xdb6223][_0x545e('0x7b')]===_0x545e('0x7c')){_0x1eac26[_0x545e('0x8e')](this[_0x545e('0x1f')][_0xdb6223]['id']);}}}_0x1c8e75[_0x545e('0x5e')]=0x1;return this[_0x545e('0x205')](_0x1c8e75['id'],_0x1eac26,0x1,_0x1c8e75[_0x545e('0x20a')],_0x1c8e75)['then'](function(_0x1d234f){_0x1c8e75[_0x545e('0x5e')]=0x1;if(_0x1d234f){if(!utils[_0x545e('0x1f8')](_0x1d234f)){utils[_0x545e('0x5d')](_0x1c8e75,0x1,0x0);return hopperUtils[_0x545e('0x206')](_0x1c8e75)[_0x545e('0x36')](sendMessageReschedule(_0x1c8e75))[_0x545e('0x97')](loggerCatch('[countReScheduled]\x20'));}else{_0x1c8e75[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x1fb')];if(_[_0x545e('0xe9')](_0x1d234f[0x0])||_[_0x545e('0xe9')](_0x1d234f[0x0][_0x545e('0x173')])||_[_0x545e('0xe9')](_0x1d234f[0x0][_0x545e('0x157')])){_0x5ee96a[_0x545e('0x14e')]('[actionOriginate]\x20',_0x1c8e75,_0x1d234f[0x0]);}else{return hopperUtils[_0x545e('0x207')](_[_0x545e('0x6a')](_0x1d234f[0x0],['VoiceQueueId',_0x545e('0x157')]))[_0x545e('0x36')](_0x5ee96a[_0x545e('0x1e2')](_0x1c8e75,_0x1d234f[0x0]))['catch'](_0x5ee96a[_0x545e('0x1ff')](_0x545e('0x20b'),_0x1c8e75));}}}})[_0x545e('0x97')](loggerGetContactDialer(_0x545e('0x20c'),_0x1c8e75,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x1a3941,_0x3995dc,_0x57f6db,_0x2b71ed,_0x39d306,_0x70098){loggerPredictive[_0x545e('0x42')](_0x545e('0x20d'));loggerPredictive[_0x545e('0x42')](_0x545e('0x20e'),_0x1a3941);loggerPredictive[_0x545e('0x42')](_0x545e('0x20f'),_0x3995dc);loggerPredictive[_0x545e('0x42')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x57f6db);loggerPredictive[_0x545e('0x42')](_0x545e('0x210'),_0x2b71ed);loggerPredictive[_0x545e('0x42')](_0x545e('0x211'),_0x39d306);loggerPredictive[_0x545e('0x42')]('---------------------------');return new Promise(function(_0x3ab2a4,_0x3699f5){if(_0x1a3941<=0x0||isNaN(_0x1a3941)){return _0x3699f5(msgResponse(_0x545e('0x212'),_0x545e('0x76'),_0x545e('0x213')+_0x1a3941));}if(_0x57f6db<=0x0||isNaN(_0x57f6db)){return _0x3699f5(msgResponse(_0x545e('0x212'),_0x545e('0x76'),'Ts\x20=\x20'+_0x57f6db));}if(_0x2b71ed<=0x0||isNaN(_0x2b71ed)){return _0x3699f5(msgResponse(_0x545e('0x212'),'Error',_0x545e('0x214')+_0x2b71ed));}if(_0x3995dc<=0x0||isNaN(_0x3995dc)){return _0x3699f5(msgResponse(_0x545e('0x212'),_0x545e('0x76'),_0x545e('0x215')+_0x3995dc));}if(_0x39d306<=0x0||isNaN(_0x39d306)){return _0x3699f5(msgResponse(_0x545e('0x212'),_0x545e('0x76'),_0x545e('0x216')+_0x39d306));}_0x70098=_0x70098||0x0;var _0x45cc11=0x1/_0x57f6db;var _0x2b1fe5=0x0;var _0x1839c9=0x0;var _0x3f4126=0x0;var _0x4fd8aa=0x0;for(var _0x493b1b=0x0;_0x3f4126<_0x39d306;_0x493b1b+=0x1){_0x1839c9=_0x493b1b/_0x3995dc;_0x2b1fe5=(_0x2b71ed*_0x1839c9+_0x70098)/_0x45cc11;_0x3f4126=utils[_0x545e('0x217')](_0x2b1fe5,_0x1a3941);_0x4fd8aa=_0x2b1fe5/_0x1a3941*(0x1-utils[_0x545e('0x217')](_0x2b1fe5,_0x1a3941));}return _0x3ab2a4({'erlangCalls':_0x493b1b,'erlangCallToSecond':_0x3995dc/_0x493b1b,'erlangAbandonmentRate':_0x3f4126,'erlangBusyFactor':_0x4fd8aa});});};Dialer[_0x545e('0x77')][_0x545e('0x1d4')]=function(_0x4f8a79,_0x40483b,_0x2cff32,_0x13f96d,_0x5e5eb0,_0x3cb256){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x545e('0x42')](_0x545e('0x20e'),_0x4f8a79);loggerPredictive[_0x545e('0x42')](_0x545e('0x20f'),_0x40483b);loggerPredictive['info'](_0x545e('0x218'),_0x2cff32);loggerPredictive[_0x545e('0x42')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x13f96d);loggerPredictive['info'](_0x545e('0x219'),_0x5e5eb0);loggerPredictive[_0x545e('0x42')](_0x545e('0x4a'));return new Promise(function(_0x4f1cbb,_0x4bbfe0){if(_0x4f8a79<=0x0||isNaN(_0x4f8a79)){return _0x4bbfe0(msgResponse(_0x545e('0x21a'),_0x545e('0x76'),_0x545e('0x213')+_0x4f8a79));}if(_0x2cff32<=0x0||isNaN(_0x2cff32)){return _0x4bbfe0(msgResponse('[busyFactor]','Error',_0x545e('0x21b')+_0x2cff32));}if(_0x13f96d<=0x0||isNaN(_0x13f96d)){return _0x4bbfe0(msgResponse(_0x545e('0x21a'),_0x545e('0x76'),'p\x20=\x20'+_0x13f96d));}if(_0x40483b<=0x0||isNaN(_0x40483b)){return _0x4bbfe0(msgResponse(_0x545e('0x21a'),_0x545e('0x76'),_0x545e('0x215')+_0x40483b));}if(_0x5e5eb0<=0x0||isNaN(_0x5e5eb0)){return _0x4bbfe0(msgResponse('[busyFactor]',_0x545e('0x76'),_0x545e('0x21c')+_0x5e5eb0));}_0x3cb256=_0x3cb256||0x0;var _0x3d264b=0x1/_0x2cff32;var _0x405ec4=0x0;var _0x4b148c=0x0;var _0xeabdd6=0x0;var _0x567b32=0x0;for(var _0x1456d8=0x0;_0x567b32<_0x5e5eb0;_0x1456d8+=0x1){_0x4b148c=_0x1456d8/_0x40483b;_0x405ec4=(_0x13f96d*_0x4b148c+_0x3cb256)/_0x3d264b;_0xeabdd6=utils['erlangb'](_0x405ec4,_0x4f8a79);_0x567b32=_0x405ec4/_0x4f8a79*(0x1-utils[_0x545e('0x217')](_0x405ec4,_0x4f8a79));}return _0x4f1cbb({'erlangCalls':_0x1456d8,'erlangCallToSecond':_0x40483b/_0x1456d8,'erlangAbandonmentRate':_0xeabdd6,'erlangBusyFactor':_0x567b32});});};module[_0x545e('0x21d')]=Dialer; \ No newline at end of file +var _0xf213=['XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','xcally-motion-dialer','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictive','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','abandonmentRate','busyFactor','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','maxNumberOriginate','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','syncQueueSummary','redis','defaults','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','message','[getContactDialer2][Empty]','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','Failure','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','all','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','loopCampaigns','resetActiveCalls','undefined','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','OVERTIME_INTERVAL','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','createHistory','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','state','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','endtime','[syncAgentComplete][createHistory][11]','actions','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','agents','stateinterface','paused','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','pick','contactAgent-idHopper:\x20','run','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','countbusyretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countcongestionretry','countagentrejectretry','reason19\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','cause-txt','Normal\x20Clearing','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','dialPreviewRecallmeReminder','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting'];(function(_0x6c09ff,_0x5bb501){var _0x3230ae=function(_0x42ee03){while(--_0x42ee03){_0x6c09ff['push'](_0x6c09ff['shift']());}};_0x3230ae(++_0x5bb501);}(_0xf213,0xb5));var _0x3f21=function(_0x275592,_0x48f004){_0x275592=_0x275592-0x0;var _0x5c474f=_0xf213[_0x275592];return _0x5c474f;};'use strict';var util=require(_0x3f21('0x0'));var _=require(_0x3f21('0x1'));var uuid=require(_0x3f21('0x2'));var moment=require(_0x3f21('0x3'));var rr=require('rr');var Redis=require(_0x3f21('0x4'));var utils=require('./utils');var hopperUtils=require(_0x3f21('0x5'));var ut=require(_0x3f21('0x6'));var config=require(_0x3f21('0x7'));var logger=require(_0x3f21('0x8'))(_0x3f21('0x9'));var loggerBooked=require('../../../config/logger')(_0x3f21('0xa'));var loggerPredictive=require(_0x3f21('0x8'))('predictive');var loggerPredictiveCalls=require(_0x3f21('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x3f21('0x8'))(_0x3f21('0xb'));var ami=require('../ami');config[_0x3f21('0xc')]=_[_0x3f21('0xd')](config[_0x3f21('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f21('0xc')]));var cmHopper=require(_0x3f21('0xe'));var voiceQueueRt=require(_0x3f21('0xf'));var RpcSetting=require(_0x3f21('0x10'));var Interval=require(_0x3f21('0x11'));var Action=require(_0x3f21('0x12'));var History=require(_0x3f21('0x13'));var Final=require(_0x3f21('0x14'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x3f21('0x15'));var ipAgi=process[_0x3f21('0x16')][_0x3f21('0x17')]||_0x3f21('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3f21('0x19')]['enqueue']=function(_0x1712b1){this[_0x3f21('0x1a')]=this[_0x3f21('0x1a')]?this[_0x3f21('0x1a')][_0x3f21('0x1b')](_0x1712b1):_0x1712b1();};function Dialer(_0x5ead32,_0x4c9c2c){this[_0x3f21('0x1c')]=new Sequence();this[_0x3f21('0x1d')]=_0x4c9c2c;this[_0x3f21('0x1e')]=_0x5ead32[_0x3f21('0x1e')];this['campaigns']=_0x5ead32[_0x3f21('0x1f')];this['agents']=_0x5ead32['agents'];this[_0x3f21('0x20')]=_0x5ead32[_0x3f21('0x20')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this[_0x3f21('0x21')]={};this[_0x3f21('0x22')]={};this[_0x3f21('0x23')]={};this[_0x3f21('0x24')]={};this[_0x3f21('0x25')]={};this[_0x3f21('0x26')]={};this[_0x3f21('0x27')]={};this[_0x3f21('0x28')]={};this[_0x3f21('0x29')]={};ami['on'](_0x3f21('0x2a'),this[_0x3f21('0x2b')][_0x3f21('0x2c')](this));ami['on'](_0x3f21('0x2d'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x3f21('0x2e'),this[_0x3f21('0x2f')][_0x3f21('0x2c')](this));ami['on'](_0x3f21('0x30'),this[_0x3f21('0x31')][_0x3f21('0x2c')](this));ami['on'](_0x3f21('0x32'),this[_0x3f21('0xb')][_0x3f21('0x2c')](this));ami['on'](_0x3f21('0x33'),this[_0x3f21('0x34')][_0x3f21('0x2c')](this));ami['on']('hangup',this[_0x3f21('0x35')]['bind'](this));ami['on'](_0x3f21('0x36'),this[_0x3f21('0x37')]['bind'](this));ami['on']('varset',this[_0x3f21('0x38')][_0x3f21('0x2c')](this));ami['on'](_0x3f21('0x39'),this[_0x3f21('0x3a')][_0x3f21('0x2c')](this));ami['on'](_0x3f21('0x3b'),this[_0x3f21('0x3c')][_0x3f21('0x2c')](this));this['loopCampaigns']();this[_0x3f21('0x3d')]();RpcSetting[_0x3f21('0x3e')]()[_0x3f21('0x3f')](function(_0x4f793c){previewRecallmeReminderInterval=_0x4f793c[_0x3f21('0x40')];});}function isNotNull(_0x19db8f){return _0x19db8f!==null&&!_[_0x3f21('0x41')](_0x19db8f);}function msgResponse(_0x254f14,_0xfe76e9,_0x3c1ece){return{'action':_0x254f14,'response':_0xfe76e9,'message':_0x3c1ece,'stack':_0x3c1ece};}function emit(_0x3ed6fa,_0x58beeb,_0x5c5ad9){io['to'](_0x3ed6fa)[_0x3f21('0x42')](_0x58beeb,_0x5c5ad9);}function emitOutboundVoiceQueueSummary(_0x6c32b1){if(_0x6c32b1[_0x3f21('0x43')]==='outbound'){logger[_0x3f21('0x44')](_0x3f21('0x45'),util[_0x3f21('0x46')](_0x6c32b1,{'showHidden':![],'depth':null}));emit(util[_0x3f21('0x47')](_0x3f21('0x48'),_0x6c32b1[_0x3f21('0x49')]),_0x3f21('0x4a'),_0x6c32b1);}}function checkGetDataPredictive(_0x3d783b){if(isNotNull(_0x3d783b)&&!_[_0x3f21('0x4b')](_0x3d783b)){loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x4d'));loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x4e'),_0x3d783b[_0x3f21('0x4f')]);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x50'),_0x3d783b[_0x3f21('0x51')]);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x52'),_0x3d783b['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x53'),_0x3d783b['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x3f21('0x4c')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d783b[_0x3f21('0x54')]);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x55'),_0x3d783b[_0x3f21('0x56')]);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x57'));if(_0x3d783b['predictiveIntervalTotalCalls']>0x0){if(!_[_0x3f21('0x41')](_0x3d783b['predictiveIntervalAvgTalktime'])&&_0x3d783b[_0x3f21('0x56')]>0x0){return!![];}loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x58'));if(!_[_0x3f21('0x41')](_0x3d783b[_0x3f21('0x54')])&&_0x3d783b[_0x3f21('0x54')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x59'));}}else{loggerPredictive[_0x3f21('0x4c')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x21afce){return function(_0x4e262f){loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x5a'));loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x5b'),_0x4e262f[_0x3f21('0x5c')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e262f[_0x3f21('0x5d')]);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x5e'),_0x4e262f['erlangAbandonmentRate']);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x5f'),_0x4e262f[_0x3f21('0x60')]);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x5e'),_0x4e262f['erlangAbandonmentRate']);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x57'));_[_0x3f21('0x61')](_0x21afce,_0x4e262f);};}function ifInterval(_0x46d719,_0xe8a403){if(_[_0x3f21('0x41')](_0xe8a403)){return![];}return utils[_0x3f21('0x62')](undefined,_0xe8a403)<_0x46d719*0x3c;}function clearPredictiveAttributes(_0x2979e9){if(_0x2979e9[_0x3f21('0x25')]){_0x2979e9[_0x3f21('0x25')]=undefined;loggerPredictive['debug'](_0x2979e9['name'],_0x3f21('0x63'));}if(_0x2979e9[_0x3f21('0x24')]){_0x2979e9[_0x3f21('0x24')]=undefined;loggerPredictive[_0x3f21('0x44')](_0x2979e9[_0x3f21('0x49')],_0x3f21('0x64'));}if(_0x2979e9[_0x3f21('0x65')]){clearInterval(_0x2979e9[_0x3f21('0x65')]);_0x2979e9[_0x3f21('0x65')]=undefined;loggerPredictive[_0x3f21('0x44')](_0x2979e9[_0x3f21('0x49')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x2065a7,_0x6f36a4){return function(_0x3e83e2){loggerPredictive[_0x3f21('0x66')](_0x6f36a4['name'],_0x2065a7);loggerPredictive['error'](_0x3e83e2['stack']);clearPredictiveAttributes(_0x6f36a4);};}function loggerCatch(_0x260e75){return function(_0x7dc621){logger[_0x3f21('0x66')](_0x260e75,util[_0x3f21('0x46')](_0x7dc621,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x307ca9,_0x19119f,_0x4d469b){return function(_0x1d6acf){utils[_0x3f21('0x67')](_0x19119f,_0x4d469b,0x0);_0x19119f[_0x3f21('0x68')]=0x0;logger[_0x3f21('0x66')](_0x307ca9,util['inspect'](_0x1d6acf,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5deb85){return function(_0x4b6fdf){if(isNotNull(_0x4b6fdf)&&isNotNull(_0x4b6fdf[0x0])){if(_0x4b6fdf[0x0][_0x3f21('0x69')]>0x0){_0x5deb85['message']=utils[_0x3f21('0x6a')][_0x3f21('0x6b')];logger[_0x3f21('0x4c')]('[getContactDialer2][ReScheduled]'+_0x5deb85[_0x3f21('0x49')],_0x4b6fdf[0x0][_0x3f21('0x69')],_0x3f21('0x6c'));}else{_0x5deb85[_0x3f21('0x6d')]=utils[_0x3f21('0x6a')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0x3f21('0x6e')+_0x5deb85['name']);}}};}function createObjHistory(_0x372588,_0xe48aa1,_0x1f33d9,_0x44fd99,_0x39a627){_0x372588['message']=_0x1f33d9;var _0x27585f=new Action(_0x372588,_0xe48aa1);var _0x4efbb9=new History(_0x27585f);_0x4efbb9['state']=_0x44fd99;_0x4efbb9[_0x3f21('0x6f')]=_0x39a627;_0x4efbb9['endtime']=_0x27585f[_0x3f21('0x70')];return _0x4efbb9;}function unlockQueueStatus(_0x4b04eb,_0x575819){setTimeout(function(){if(_[_0x3f21('0x41')](_0x4b04eb[_0x3f21('0x71')])){loggerBooked['error'](_0x3f21('0x72'),_0x575819);}_0x4b04eb['queueStatusComplete']=!![];loggerBooked[_0x3f21('0x4c')]('[booked][unlockQueueStatus]',_0x575819,JSON[_0x3f21('0x73')](_['pick'](_0x4b04eb,[_0x3f21('0x49'),_0x3f21('0x71')])));},0x1f3);}function checkInterval(_0x14e6b8){return function(){if(!isNotNull(_0x14e6b8[_0x3f21('0x74')])){_0x14e6b8[_0x3f21('0x6d')]=utils[_0x3f21('0x6a')][_0x3f21('0x75')];throw _0x14e6b8[_0x3f21('0x49')]+_0x3f21('0x76');}if(!isNotNull(_0x14e6b8['Interval']['Intervals'])){_0x14e6b8['message']=utils['CAMPAIGN_STATUS'][_0x3f21('0x75')];throw _0x14e6b8[_0x3f21('0x49')]+_0x3f21('0x76');}if(!isNotNull(_[_0x3f21('0x4b')](_0x14e6b8[_0x3f21('0x74')][_0x3f21('0x77')]))){_0x14e6b8[_0x3f21('0x6d')]=utils[_0x3f21('0x6a')]['NULL_INTERVAL'];throw _0x14e6b8[_0x3f21('0x49')]+_0x3f21('0x76');}};}function checkIsIVRCampaignActive(_0x1373da){return function(){if(!utils[_0x3f21('0x78')](_0x1373da)){_0x1373da[_0x3f21('0x6d')]=utils[_0x3f21('0x6a')]['INACTIVE'];throw _0x1373da[_0x3f21('0x49')]+_0x3f21('0x79');}};}function emitCampaignSummary(_0x583d37){if(utils[_0x3f21('0x7a')](_0x583d37)){emit(util[_0x3f21('0x47')](_0x3f21('0x7b'),_0x583d37[_0x3f21('0x49')]),_0x3f21('0x7c'),_0x583d37);}}function loggerCatchQueueSummary(_0x47bf32,_0x374a57){return function(_0x33866e){clearPredictiveAttributes(_0x374a57);emitCampaignSummary(_0x374a57);loggerSyncQueueSummary[_0x3f21('0x44')](_0x47bf32,util[_0x3f21('0x46')](_0x33866e,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1ee34a){if(_0x1ee34a[_0x3f21('0x7d')]){if(_0x1ee34a[_0x3f21('0x7e')]===0x0){_0x1ee34a[_0x3f21('0x7d')]=![];_0x1ee34a[_0x3f21('0x6d')]=utils[_0x3f21('0x6a')][_0x3f21('0x7f')];loggerSyncQueueSummary[_0x3f21('0x44')](_0x3f21('0x80'),_0x1ee34a[_0x3f21('0x49')],_0x3f21('0x81'));}else{_0x1ee34a[_0x3f21('0x6d')]=utils[_0x3f21('0x6a')][_0x3f21('0x82')];loggerSyncQueueSummary[_0x3f21('0x44')](_0x3f21('0x80'),_0x1ee34a[_0x3f21('0x49')],_0x3f21('0x83'));}emitCampaignSummary(_0x1ee34a);}}function myreject(_0x2413db){return function(_0x206950){return _0x2413db(msgResponse(_0x3f21('0x84'),'Error',JSON['stringify'](_0x206950)));};}Dialer[_0x3f21('0x19')][_0x3f21('0x85')]=function(_0x43f3b9){return!_[_0x3f21('0x41')](_0x43f3b9)&&_0x43f3b9&&!_[_0x3f21('0x41')](_0x43f3b9['name'])&&!_['isUndefined'](_0x43f3b9[_0x3f21('0x86')])&&_0x43f3b9[_0x3f21('0x86')]&&(this[_0x3f21('0x20')][util['format'](_0x3f21('0x87'),_0x43f3b9['name'])][_0x3f21('0x88')]===_0x3f21('0x89')||this['trunks'][util[_0x3f21('0x47')](_0x3f21('0x87'),_0x43f3b9[_0x3f21('0x49')])]['status']===_0x3f21('0x8a'));};Dialer[_0x3f21('0x19')][_0x3f21('0x8b')]=function(_0x20d0c7){var _0x4f0766=this;return function(){if(!_0x4f0766[_0x3f21('0x85')](_0x20d0c7[_0x3f21('0x8c')])){if(!_0x4f0766['isTrunkReachable'](_0x20d0c7[_0x3f21('0x8d')])){_0x20d0c7[_0x3f21('0x6d')]=utils[_0x3f21('0x6a')][_0x3f21('0x8e')];throw _0x20d0c7[_0x3f21('0x49')]+_0x3f21('0x8f');}}};};Dialer['prototype'][_0x3f21('0x90')]=function(_0x224649,_0x2ccd73,_0x1140ad,_0x35334e){var _0x4c3fb6=this;return function(){var _0xe52749=!![];return _0x4c3fb6[_0x3f21('0x91')](_0x224649,_0x2ccd73,_0x1140ad,_0x35334e,_0xe52749);};};Dialer[_0x3f21('0x19')][_0x3f21('0x92')]=function(_0x2ed7bf,_0x1e7d01,_0x1f7609,_0x3c32b3){var _0x2f7953=this;return function(){var _0x237fa2=![];return _0x2f7953['ifTimeIvr'](_0x2ed7bf['Intervals'],_0x1e7d01,_0x1f7609,_0x3c32b3,_0x237fa2);};};Dialer[_0x3f21('0x19')][_0x3f21('0x91')]=function(_0x1becd3,_0x1b4b9a,_0x18ebd2,_0x5ad38b,_0x3f71e4){var _0xcb0eee=[];return new Promise(function(_0x38185b,_0x38b798){if(!isNotNull(_0x1becd3)){_0x5ad38b[_0x3f21('0x6d')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0x38b798(msgResponse(_0x3f21('0x93'),'Failure',_0x18ebd2+_0x3f21('0x94')));}if(_[_0x3f21('0x4b')](_0x1becd3)){_0x5ad38b[_0x3f21('0x6d')]=utils[_0x3f21('0x6a')][_0x3f21('0x95')];return _0x38b798(msgResponse(_0x3f21('0x93'),'Failure',_0x18ebd2+_0x3f21('0x96')));}if(_0x1b4b9a&&_[_0x3f21('0x41')](config[_0x3f21('0x97')][_0x1b4b9a])){_0x5ad38b[_0x3f21('0x6d')]=utils['CAMPAIGN_STATUS'][_0x3f21('0x98')];return _0x38b798(msgResponse(_0x3f21('0x93'),_0x3f21('0x99'),_0x18ebd2+_0x3f21('0x9a')+_0x1b4b9a));}if(_[_0x3f21('0x9b')](_0x1becd3)){for(var _0x307174=0x0;_0x307174<_0x1becd3[_0x3f21('0x9c')];_0x307174+=0x1){_0xcb0eee[_0x3f21('0x9d')](ami[_0x3f21('0x9e')]({'action':_0x3f21('0x9f'),'command':util['format'](_0x3f21('0xa0'),_0x1becd3[_0x307174][_0x3f21('0xa1')],!_[_0x3f21('0x41')](config[_0x3f21('0x97')][_0x1b4b9a])?_0x1b4b9a:'')})[_0x3f21('0x3f')](function(_0x4b2f95){return _0x4b2f95[_0x3f21('0xa2')][_0x3f21('0xa3')](_0x3f21('0xa4'))>=0x0;})['catch'](myreject(_0x38b798)));}}else{_0xcb0eee['push'](ami['Action']({'action':_0x3f21('0x9f'),'command':util['format'](_0x3f21('0xa0'),_0x1becd3,!_[_0x3f21('0x41')](config['timezones'][_0x1b4b9a])?_0x1b4b9a:'')})[_0x3f21('0x3f')](function(_0x49158a){return _0x49158a[_0x3f21('0xa2')]['indexOf'](_0x3f21('0xa4'))>=0x0;})[_0x3f21('0xa5')](myreject(_0x38b798)));}Promise[_0x3f21('0xa6')](_0xcb0eee)[_0x3f21('0x3f')](function(_0x4c2dfb){var _0x3463ec=_['some'](_0x4c2dfb);if(_0x3463ec){return _0x38185b(_0x3463ec);}else{_0x5ad38b[_0x3f21('0x6d')]=_0x3f71e4?utils[_0x3f21('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x3f21('0x6a')]['OVERTIME_INTERVAL'];return _0x38b798(msgResponse(_0x3f21('0xa7'),_0x3f21('0x99'),_0x3f21('0xa8')+_0x3f71e4+'\x20'+_0x18ebd2+_0x3f21('0xa9')+util[_0x3f21('0x46')](_0x1becd3,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1b4b9a));}})['catch'](function(_0x2ab197){return _0x38b798(msgResponse(_0x3f21('0x93'),'Failure',JSON[_0x3f21('0x73')](_0x2ab197)));});});};Dialer[_0x3f21('0x19')][_0x3f21('0xaa')]=function(){var _0x596770=this;return cmHopper[_0x3f21('0xab')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x596770['syncCampaigns']();},0x3e8);});};Dialer[_0x3f21('0x19')]['syncCampaigns']=function(){var _0x565daa=this;var _0x1c2f58;for(var _0x547be6 in this[_0x3f21('0x1f')]){if(typeof this['campaigns'][_0x547be6]!==_0x3f21('0xac')){_0x1c2f58=this['campaigns'][_0x547be6];if(utils['isIVRCampaign'](_0x1c2f58)&&utils['isIVRCampaignActive'](_0x1c2f58)){_0x1c2f58[_0x3f21('0x7d')]=!![];Promise['resolve']()['then'](checkIsIVRCampaignActive(_0x1c2f58))[_0x3f21('0x3f')](checkInterval(_0x1c2f58))[_0x3f21('0x3f')](_0x565daa[_0x3f21('0x8b')](_0x1c2f58))[_0x3f21('0x3f')](_0x565daa[_0x3f21('0x90')](_0x1c2f58[_0x3f21('0xad')],_0x1c2f58[_0x3f21('0xae')],_0x1c2f58[_0x3f21('0x49')],_0x1c2f58))['then'](_0x565daa[_0x3f21('0x92')](_0x1c2f58[_0x3f21('0x74')],_0x1c2f58[_0x3f21('0xae')],_0x1c2f58['name'],_0x1c2f58))['then'](_0x565daa[_0x3f21('0xaf')](_0x1c2f58))['catch'](loggerCatchQueueSummary(_0x3f21('0xb0'),_0x1c2f58));}else{notSendMessagesCampaign(_0x1c2f58);}}}};Dialer[_0x3f21('0x19')][_0x3f21('0xb1')]=function(_0x51be69){if(_0x51be69[_0x3f21('0xb2')]!=='predictive'){clearPredictiveAttributes(_0x51be69);}switch(_0x51be69[_0x3f21('0xb2')]){case _0x3f21('0xb3'):this[_0x3f21('0xb4')](_0x51be69,0x1);break;case _0x3f21('0xb5'):this[_0x3f21('0xb4')](_0x51be69,_0x51be69['dialPowerLevel']);break;case'predictive':this['predictive'](_0x51be69);break;case _0x3f21('0xa'):this[_0x3f21('0xb4')](_0x51be69,0x1);break;default:logger[_0x3f21('0x66')](_0x3f21('0xb6'),_0x51be69[_0x3f21('0x49')],_0x3f21('0xb7'));}};Dialer[_0x3f21('0x19')][_0x3f21('0x93')]=function(_0x15697f,_0x290b8d){var _0x1428ae=_0x15697f['dialTimezone'];var _0x35c7f4=_0x290b8d?_0x15697f[_0x3f21('0xad')]:_0x15697f['Interval'][_0x3f21('0x77')];logger[_0x3f21('0xb8')](_0x3f21('0xb9'),_0x35c7f4,_0x1428ae,_0x15697f[_0x3f21('0x49')],util[_0x3f21('0x47')]('Voice\x20Queue\x20%s\x20$s',_0x15697f['name'],_0x15697f['id']));var _0x2ee8ca=null;return Interval['intervalIftime'](_0x35c7f4,_0x1428ae)['then'](function(_0x27fb81){if(_0x27fb81===!![]){return _0x27fb81;}else{_0x15697f['message']=_0x290b8d?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x3f21('0x6a')][_0x3f21('0xba')];_0x2ee8ca=msgResponse(_0x3f21('0xa7'),_0x3f21('0x99'),_0x3f21('0xa8')+_0x290b8d+'\x20'+_0x15697f[_0x3f21('0x49')]+_0x3f21('0xa9')+util['inspect'](_0x35c7f4,{'showHidden':![],'depth':null})+_0x3f21('0xbb')+_0x1428ae);}if(_0x2ee8ca!==null){logger['silly'](_0x3f21('0xbc'),_0x2ee8ca);_0x2ee8ca[_0x3f21('0xbd')]=_0x290b8d;throw _0x2ee8ca;}})[_0x3f21('0xa5')](function(_0x133201){logger[_0x3f21('0x66')](_0x3f21('0xbe'),_0x133201);throw msgResponse('[ifTime][Action]',_0x3f21('0xbf'),util[_0x3f21('0x46')](_0x133201,{'showHidden':![],'depth':null}));});};Dialer[_0x3f21('0x19')]['syncAgentConnect']=function(_0x549910){if(this['voiceQueues'][_0x549910[_0x3f21('0xc0')]]){if(this['uniqueId'][_0x549910[_0x3f21('0xc1')]]&&this[_0x3f21('0x22')][_0x549910[_0x3f21('0xc1')]][_0x3f21('0x43')]!==_0x3f21('0xc2')){this[_0x3f21('0xc3')](this[_0x3f21('0x1e')][_0x549910[_0x3f21('0xc0')]]);this[_0x3f21('0x22')][_0x549910[_0x3f21('0xc1')]][_0x3f21('0xc4')]=moment()[_0x3f21('0x47')](_0x3f21('0xc5'));}}};Dialer['prototype']['syncAgentComplete']=function(_0x4da739){var _0x428fd0=this[_0x3f21('0x22')][_0x4da739[_0x3f21('0xc1')]];if(this[_0x3f21('0x1e')][_0x4da739['queue']]){if(_0x428fd0&&_0x428fd0['type']!==_0x3f21('0xc2')){delete this[_0x3f21('0x22')][_0x4da739['uniqueid']];this[_0x3f21('0x1e')][_0x4da739[_0x3f21('0xc0')]][_0x3f21('0xc6')]+=0x1;var _0x233a20=new AgentComplete(_0x428fd0,_0x4da739);if(_0x4da739['reason']===_0x3f21('0xc7')){_0x233a20[_0x3f21('0xc8')]=this[_0x3f21('0x1e')][_0x4da739['queue']][_0x3f21('0xc9')]&&this[_0x3f21('0x1e')][_0x4da739[_0x3f21('0xc0')]]['dialAgiAfterHangupAgent']?moment()[_0x3f21('0x47')](_0x3f21('0xc5')):undefined;}hopperUtils[_0x3f21('0xca')](_0x233a20)[_0x3f21('0xa5')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x3f21('0xcb')](_0x233a20)[_0x3f21('0xa5')](loggerCatch(_0x3f21('0xcc')));}}};Dialer['prototype'][_0x3f21('0xcd')]=function(_0xb7dcf){var _0x161739=this[_0x3f21('0x22')][_0xb7dcf['uniqueid']];var _0x528820=this;var _0x3214ab=![];var _0x367e61;var _0x498351;if(this[_0x3f21('0x1e')][_0xb7dcf['queue']]){if(_0x161739&&_0x161739['type']!==_0x3f21('0xc2')){delete this[_0x3f21('0x22')][_0xb7dcf['uniqueid']];this[_0x3f21('0xc3')](this[_0x3f21('0x1e')][_0xb7dcf[_0x3f21('0xc0')]]);_0x161739[_0x3f21('0xce')]=moment()[_0x3f21('0x47')]('YYYY-MM-DD\x20HH:mm:ss');var _0x526948=new QueueCallerAbandon(_0x161739,_0xb7dcf);if(utils[_0x3f21('0x62')](_0x161739['droptime'],_0x161739[_0x3f21('0xcf')])>=_0x161739[_0x3f21('0xd0')]){this['voiceQueues'][_0xb7dcf['queue']][_0x3f21('0xd1')]+=0x1;this[_0x3f21('0x1e')][_0xb7dcf[_0x3f21('0xc0')]][_0x3f21('0xd2')]+=0x1;this[_0x3f21('0x1e')][_0xb7dcf[_0x3f21('0xc0')]][_0x3f21('0xd3')]+=0x1;_0x526948['state']=0xa;_0x526948['statedesc']=_0x3f21('0xd4');_0x526948[_0x3f21('0xd5')]='TIMEOUT';_0x526948['agiafterat']=this[_0x3f21('0x1e')][_0xb7dcf[_0x3f21('0xc0')]][_0x3f21('0xc9')]?moment()['format'](_0x3f21('0xc5')):undefined;_0x526948[_0x3f21('0xd6')]+=0x1;_0x526948[_0x3f21('0xd7')]+=0x1;_0x367e61=this[_0x3f21('0x1e')][_0xb7dcf[_0x3f21('0xc0')]]['dialDropRetryFrequency'];_0x498351=this['voiceQueues'][_0xb7dcf[_0x3f21('0xc0')]][_0x3f21('0xd8')];hopperUtils[_0x3f21('0xd9')](_0x526948,_0x526948['state'],_0x161739[_0x3f21('0xda')])[_0x3f21('0x3f')](function(_0x51ddc3){_0x3214ab=_0x51ddc3[_0x3f21('0xdb')]==0x1;if(_0x526948['countdropretry']>=_0x528820['voiceQueues'][_0xb7dcf['queue']][_0x3f21('0xdc')]){_0x528820[_0x3f21('0xdd')](_0x526948,_0x51ddc3[_0x3f21('0xdb')]);}else{hopperUtils[_0x3f21('0xde')]({'active':![],'countdropretry':_0x526948['countdropretry'],'scheduledat':moment()[_0x3f21('0xdf')](_0x528820['voiceQueues'][_0xb7dcf['queue']]['dialDropRetryFrequency'],_0x3f21('0xe0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x161739[_0x3f21('0xe1')],'ListId':_0x161739[_0x3f21('0xe2')],'VoiceQueueId':_0x161739[_0x3f21('0xe3')]||undefined,'CampaignId':_0x161739[_0x3f21('0xe4')]||undefined})[_0x3f21('0xa5')](loggerCatch(_0x3f21('0xe5')));var _0x1a24e0=new History(_0x526948);_0x1a24e0[_0x3f21('0xe6')]=0xa;_0x1a24e0[_0x3f21('0x6f')]=_0x3f21('0xd4');_0x1a24e0['starttime']=moment()[_0x3f21('0x47')](_0x3f21('0xc5'));_0x1a24e0['endtime']=_0x1a24e0[_0x3f21('0x70')];_0x1a24e0[_0x3f21('0xe7')]=_0x526948['calleridname'];_0x1a24e0[_0x3f21('0xe8')]=_0x526948['calleridnum'];hopperUtils[_0x3f21('0xca')](_0x1a24e0)['catch'](loggerCatch(_0x3f21('0xe9')));}})[_0x3f21('0x3f')](function(){if(_0x3214ab)hopperUtils[_0x3f21('0xea')](_0x526948,_0x367e61,_0x498351)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0xb7dcf[_0x3f21('0xc0')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x3f21('0x1e')][_0xb7dcf['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x526948[_0x3f21('0xe6')]=0xb;_0x526948[_0x3f21('0x6f')]='Abandoned';_0x526948[_0x3f21('0xd5')]='CALLEREXIT';_0x526948[_0x3f21('0xeb')]+=0x1;_0x526948[_0x3f21('0xd7')]+=0x1;_0x367e61=this['voiceQueues'][_0xb7dcf[_0x3f21('0xc0')]][_0x3f21('0xec')];_0x498351=this['voiceQueues'][_0xb7dcf[_0x3f21('0xc0')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x3f21('0xd9')](_0x526948,_0x526948[_0x3f21('0xe6')],_0x161739[_0x3f21('0xda')])[_0x3f21('0x3f')](function(_0x13e26f){if(_0x526948[_0x3f21('0xeb')]>=_0x528820['voiceQueues'][_0xb7dcf[_0x3f21('0xc0')]][_0x3f21('0xed')]){_0x528820[_0x3f21('0xdd')](_0x526948,_0x13e26f['additional']);}else{hopperUtils[_0x3f21('0xde')]({'active':![],'countabandonedretry':_0x526948['countabandonedretry'],'scheduledat':moment()['add'](_0x528820[_0x3f21('0x1e')][_0xb7dcf[_0x3f21('0xc0')]][_0x3f21('0xec')],_0x3f21('0xe0'))['format'](_0x3f21('0xc5')),'ContactId':_0x161739['ContactId'],'ListId':_0x161739[_0x3f21('0xe2')],'VoiceQueueId':_0x161739[_0x3f21('0xe3')]||undefined,'CampaignId':_0x161739[_0x3f21('0xe4')]||undefined})['catch'](loggerCatch(_0x3f21('0xee')));var _0x35408a=new History(_0x526948);_0x35408a[_0x3f21('0xe6')]=0xb;_0x35408a[_0x3f21('0x6f')]=_0x3f21('0xef');_0x35408a[_0x3f21('0x70')]=moment()['format'](_0x3f21('0xc5'));_0x35408a[_0x3f21('0xf0')]=_0x35408a[_0x3f21('0x70')];_0x35408a[_0x3f21('0xe7')]=_0x526948['calleridname'];_0x35408a['calleridnum']=_0x526948[_0x3f21('0xe8')];hopperUtils['createHistory'](_0x35408a)[_0x3f21('0xa5')](loggerCatch(_0x3f21('0xf1')));}})[_0x3f21('0x3f')](function(){if(_0x3214ab)hopperUtils['swapAdditionalPhones'](_0x526948,_0x367e61,_0x498351)['then'](function(){return 0x1;});});}}}};Dialer[_0x3f21('0x19')][_0x3f21('0x37')]=function(_0x117484){if(this['actions'][_0x117484[_0x3f21('0xc1')]]){this[_0x3f21('0xf2')][_0x117484[_0x3f21('0xc1')]]['channel']=_0x117484['channel'];}if(this[_0x3f21('0x22')][_0x117484[_0x3f21('0xc1')]]){this[_0x3f21('0x22')][_0x117484[_0x3f21('0xc1')]]['channel']=_0x117484[_0x3f21('0xf3')];}};Dialer[_0x3f21('0x19')][_0x3f21('0x3a')]=function(_0x212e03){if(!this[_0x3f21('0xf2')][_0x212e03[_0x3f21('0xf4')]]){return;}var _0xff6884=this[_0x3f21('0x1e')][this[_0x3f21('0xf2')][_0x212e03[_0x3f21('0xf4')]][_0x3f21('0xc0')]][_0x3f21('0xf5')]||_0x3f21('0xf6');if(_0xff6884===_0x3f21('0xf7')){if(this[_0x3f21('0xf2')][_0x212e03[_0x3f21('0xf4')]]&&_[_0x3f21('0xf8')](this[_0x3f21('0xf2')][_0x212e03[_0x3f21('0xf4')]][_0x3f21('0xf9')])&&_0x212e03[_0x3f21('0x88')]==='1'&&_0x212e03['paused']==='0'){if(this[_0x3f21('0xfa')][_0x212e03[_0x3f21('0xfb')]]){if(!this[_0x3f21('0xfa')][_0x212e03[_0x3f21('0xfb')]][_0x3f21('0xf9')]){this['agents'][_0x212e03[_0x3f21('0xfb')]][_0x3f21('0xf9')]=!![];this[_0x3f21('0xf2')][_0x212e03[_0x3f21('0xf4')]][_0x3f21('0xf9')]=!![];this['actions'][_0x212e03[_0x3f21('0xf4')]]['stateinterface']=_0x212e03[_0x3f21('0xfb')];}}}}else if(_0xff6884===_0x3f21('0xf6')){if(this[_0x3f21('0xf2')][_0x212e03['actionid']]){if(this['agents'][_0x212e03[_0x3f21('0xfb')]]){this[_0x3f21('0xf2')][_0x212e03[_0x3f21('0xf4')]][_0x3f21('0xfb')]=_0x212e03[_0x3f21('0xfb')];if(_[_0x3f21('0xf8')](this[_0x3f21('0x27')][this[_0x3f21('0xf2')][_0x212e03['actionid']][_0x3f21('0xc0')]])){this[_0x3f21('0x27')][this['actions'][_0x212e03[_0x3f21('0xf4')]][_0x3f21('0xc0')]]=[];}this['queueBooked'][this[_0x3f21('0xf2')][_0x212e03[_0x3f21('0xf4')]][_0x3f21('0xc0')]][_0x3f21('0x9d')](_[_0x3f21('0x61')](_['pick'](this[_0x3f21('0xf2')][_0x212e03[_0x3f21('0xf4')]],['idHopper',_0x3f21('0xfb')]),{'status':_0x212e03['status'],'paused':_0x212e03[_0x3f21('0xfc')]}));}}}};Dialer[_0x3f21('0x19')][_0x3f21('0x3c')]=function(_0x2e9351){if(!this[_0x3f21('0xf2')][_0x2e9351['actionid']]){return;}var _0x40fc68=this;var _0x5129a2=this['voiceQueues'][this[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xc0')]];var _0xad884a=_0x5129a2['strategy']||_0x3f21('0xf6');if(_0xad884a===_0x3f21('0xf7')){if(this[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]]&&this[_0x3f21('0xf2')][_0x2e9351['actionid']]['stateinterface']){this[_0x3f21('0x1d')]['run'](this[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xfd')],this[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xfb')])[_0x3f21('0xa5')](function(_0x2b6eb4){logger[_0x3f21('0x66')](_0x3f21('0xfe'),util[_0x3f21('0x46')](_0x2b6eb4,{'showHidden':![],'depth':null}));})[_0x3f21('0x1b')](function(){_0x40fc68[_0x3f21('0xc3')](_0x40fc68['voiceQueues'][_0x40fc68[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xc0')]]);_0x40fc68[_0x3f21('0xfa')][_0x40fc68[_0x3f21('0xf2')][_0x2e9351['actionid']]['stateinterface']][_0x3f21('0xf9')]=![];delete _0x40fc68[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]];unlockQueueStatus(_0x5129a2);});}else{this[_0x3f21('0xc3')](this[_0x3f21('0x1e')][this[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xc0')]]);hopperUtils[_0x3f21('0xde')]({'active':![],'ContactId':this['actions'][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xe1')],'ListId':this[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xe2')],'VoiceQueueId':this[_0x3f21('0xf2')][_0x2e9351['actionid']][_0x3f21('0xe3')]||undefined,'CampaignId':this[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xe4')]||undefined})[_0x3f21('0xa5')](loggerCatch(_0x3f21('0xff')));delete this['actions'][_0x2e9351[_0x3f21('0xf4')]];unlockQueueStatus(_0x5129a2);}}else if(_0xad884a===_0x3f21('0xf6')){var _0x2ad160;if(this['actions'][_0x2e9351['actionid']]&&!_[_0x3f21('0x4b')](this[_0x3f21('0x27')][this[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xc0')]])){if(this[_0x3f21('0x28')][_0x40fc68[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xc0')]]){this[_0x3f21('0x28')][_0x40fc68[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xc0')]]=this[_0x3f21('0x28')][this[_0x3f21('0xf2')][_0x2e9351['actionid']][_0x3f21('0xc0')]]?this[_0x3f21('0x28')][this[_0x3f21('0xf2')][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xc0')]]:this[_0x3f21('0x27')][this[_0x3f21('0xf2')][_0x2e9351['actionid']][_0x3f21('0xc0')]]?this['queueBooked'][this['actions'][_0x2e9351['actionid']][_0x3f21('0xc0')]]['_rr']||0x0:0x0;}this['queueBooked'][this['actions'][_0x2e9351['actionid']][_0x3f21('0xc0')]][_0x3f21('0x100')]=this[_0x3f21('0x28')][this['actions'][_0x2e9351[_0x3f21('0xf4')]][_0x3f21('0xc0')]];for(var _0xbfb673=0x0;_0xbfb673=_0x38738a[_0x3f21('0x123')]){_0x52cc41[_0x3f21('0x124')](_0x28058b,_0x926fa1,_0x565e02,'reason19\x20machine....');}else{if(_0x28058b[_0x3f21('0x11f')]>=_0x38738a[_0x3f21('0x125')]){_0x52cc41[_0x3f21('0x126')](_0x28058b,_0x926fa1,_0x565e02,_0x3f21('0x127'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x28058b[_0x3f21('0x11f')],'scheduledat':moment()[_0x3f21('0xdf')](_0x38738a['dialMachineRetryFrequency'],'minutes')[_0x3f21('0x47')](_0x3f21('0xc5')),'ContactId':_0x28058b[_0x3f21('0xe1')],'ListId':_0x28058b[_0x3f21('0xe2')],'VoiceQueueId':_0x28058b['VoiceQueueId']||undefined,'CampaignId':_0x28058b['CampaignId']||undefined})[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x128')));_0x926fa1({'reschedule':0x1});}}});}if(_0x22c550['type']==='ivr'&&this[_0x3f21('0x1f')][_0x22c550[_0x3f21('0xc0')]][_0x3f21('0x112')]&&_0x3db1a9[_0x3f21('0x113')]===_0x3f21('0x114')){delete this[_0x3f21('0x22')][_0x3db1a9[_0x3f21('0xc1')]];this['updateOriginated'](this[_0x3f21('0x1f')][_0x22c550[_0x3f21('0xc0')]]);_0x155b42=new Hangup(_0x22c550,_0x3db1a9);_0x155b42[_0x3f21('0xe6')]=0x12;_0x155b42[_0x3f21('0x6f')]=_0x3f21('0x129');_0x155b42[_0x3f21('0x116')]='AMD';ami['emit'](_0x3f21('0x118'),ut[_0x3f21('0x119')](_0x155b42,'amd'));this['saveInDb'](_0x155b42,_0x3f21('0x12a'),_0x3f21('0x12b'));}if(_0x22c550[_0x3f21('0x43')]===_0x3f21('0xc2')&&this[_0x3f21('0x1f')][_0x22c550[_0x3f21('0xc0')]][_0x3f21('0x112')]&&_0x3db1a9['value']===_0x3f21('0x11d')){return new Promise(function(_0x27cf70,_0x45126b){delete _0x52cc41[_0x3f21('0x22')][_0x3db1a9['uniqueid']];_0x52cc41[_0x3f21('0xc3')](_0x52cc41[_0x3f21('0x1f')][_0x22c550[_0x3f21('0xc0')]]);_0x52cc41[_0x3f21('0x1f')][_0x22c550[_0x3f21('0xc0')]]['outboundAnswerCallsDay']+=0x1;_0x52cc41[_0x3f21('0x1f')][_0x22c550[_0x3f21('0xc0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x5a1b19=_0x52cc41[_0x3f21('0x1f')][_0x22c550['queue']];var _0x2c1959=new Hangup(_0x22c550,_0x3db1a9);_0x2c1959[_0x3f21('0xe6')]=0x13;_0x2c1959[_0x3f21('0x6f')]=_0x3f21('0x11e');_0x2c1959[_0x3f21('0x116')]='AMD';_0x2c1959[_0x3f21('0x11f')]+=0x1;_0x2c1959[_0x3f21('0xd7')]+=0x1;_0x2c1959[_0x3f21('0x11a')]=!![];ami[_0x3f21('0x42')](_0x3f21('0x118'),ut[_0x3f21('0x119')](_0x2c1959,_0x3f21('0x11a')));hopperUtils[_0x3f21('0xca')](_0x2c1959)['catch'](loggerCatch(_0x3f21('0x12c')));if(_0x2c1959[_0x3f21('0x120')]+_0x2c1959[_0x3f21('0x12d')]+_0x2c1959[_0x3f21('0x121')]+_0x2c1959[_0x3f21('0x122')]+_0x2c1959['countdropretry']+_0x2c1959['countabandonedretry']+_0x2c1959['countmachineretry']+_0x2c1959[_0x3f21('0x12e')]>=_0x5a1b19['dialGlobalMaxRetry']){_0x52cc41[_0x3f21('0x124')](_0x2c1959,_0x27cf70,_0x45126b,_0x3f21('0x12f'));}else{if(_0x2c1959[_0x3f21('0x11f')]>=_0x5a1b19[_0x3f21('0x125')]){_0x52cc41['createStateFinal'](_0x2c1959,_0x27cf70,_0x45126b,_0x3f21('0x127'));}else{hopperUtils[_0x3f21('0xde')]({'active':![],'countmachineretry':_0x2c1959[_0x3f21('0x11f')],'scheduledat':moment()[_0x3f21('0xdf')](_0x5a1b19[_0x3f21('0x130')],_0x3f21('0xe0'))[_0x3f21('0x47')](_0x3f21('0xc5')),'ContactId':_0x2c1959['ContactId'],'ListId':_0x2c1959['ListId'],'VoiceQueueId':_0x2c1959[_0x3f21('0xe3')]||undefined,'CampaignId':_0x2c1959['CampaignId']||undefined})[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x128')));_0x27cf70({'reschedule':0x1});}}});}}};Dialer[_0x3f21('0x19')]['syncHangup']=function(_0x53f73c){var _0x1ed5d9=this[_0x3f21('0x22')][_0x53f73c[_0x3f21('0xc1')]];var _0x558cb0;if(_0x1ed5d9&&_0x1ed5d9['type']==='ivr'){delete this[_0x3f21('0x22')][_0x53f73c[_0x3f21('0xc1')]];this[_0x3f21('0xc3')](this[_0x3f21('0x1f')][_0x1ed5d9[_0x3f21('0xc0')]]);this[_0x3f21('0x1f')][_0x1ed5d9['queue']][_0x3f21('0x131')]+=0x1;_0x558cb0=new Hangup(_0x1ed5d9,_0x53f73c);hopperUtils[_0x3f21('0xca')](_0x558cb0)[_0x3f21('0xa5')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x3f21('0xcb')](_0x558cb0)[_0x3f21('0xa5')](loggerCatch('[syncHangupIvr]'));}if(_0x1ed5d9&&_0x1ed5d9['type']!==_0x3f21('0xc2')&&isNotNull(this[_0x3f21('0x1e')][_0x1ed5d9[_0x3f21('0xc0')]][_0x3f21('0x132')])){delete this[_0x3f21('0x22')][_0x53f73c[_0x3f21('0xc1')]];this[_0x3f21('0xc3')](this['voiceQueues'][_0x1ed5d9[_0x3f21('0xc0')]]);this[_0x3f21('0x1e')][_0x1ed5d9[_0x3f21('0xc0')]][_0x3f21('0xc6')]+=0x1;this[_0x3f21('0x1e')][_0x1ed5d9[_0x3f21('0xc0')]][_0x3f21('0x115')]+=0x1;_0x558cb0=new Hangup(_0x1ed5d9,_0x53f73c);_0x558cb0[_0x3f21('0xe6')]=0x10;_0x558cb0[_0x3f21('0x6f')]=_0x3f21('0x133');_0x558cb0[_0x3f21('0x116')]=_0x3f21('0x134');hopperUtils[_0x3f21('0xca')](_0x558cb0)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x558cb0)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x1ed5d9&&_0x1ed5d9['type']!=='ivr'&&!isNotNull(this[_0x3f21('0x1e')][_0x1ed5d9[_0x3f21('0xc0')]][_0x3f21('0x132')])){if(_0x53f73c[_0x3f21('0x135')]===_0x3f21('0x136')){delete this['uniqueId'][_0x53f73c['uniqueid']];this[_0x3f21('0x1e')][_0x1ed5d9['queue']][_0x3f21('0xc6')]+=0x1;const _0x1ec2aa=new AgentComplete(_0x1ed5d9,_0x53f73c);_0x1ec2aa[_0x3f21('0xe4')]=this[_0x3f21('0x1e')][_0x1ed5d9['queue']]['id'];hopperUtils[_0x3f21('0xca')](_0x1ec2aa)['catch'](loggerCatch(_0x3f21('0x137')));hopperUtils['moveContactManagedDialer'](_0x1ec2aa)['catch'](loggerCatch(_0x3f21('0xcc')));}else{delete this[_0x3f21('0x22')][_0x53f73c[_0x3f21('0xc1')]];this[_0x3f21('0xc3')](this[_0x3f21('0x1e')][_0x1ed5d9[_0x3f21('0xc0')]]);this[_0x3f21('0x1e')][_0x1ed5d9[_0x3f21('0xc0')]][_0x3f21('0x138')]+=0x1;_0x558cb0=new Hangup(_0x1ed5d9,_0x53f73c);_0x558cb0[_0x3f21('0xe6')]=0xc;_0x558cb0[_0x3f21('0x6f')]=_0x53f73c[_0x3f21('0x135')];_0x558cb0[_0x3f21('0x116')]='Unknow';hopperUtils['createHistory'](_0x558cb0)[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x139')));hopperUtils[_0x3f21('0xcb')](_0x558cb0)[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x13a')));}}};Dialer[_0x3f21('0x19')][_0x3f21('0xb')]=function(_0x331c32){var _0x303ccb=this;if(!_0x303ccb[_0x3f21('0x29')][_0x331c32['name']]){_0x303ccb[_0x3f21('0x29')][_0x331c32['name']]={'running':![]};}else if(_0x303ccb[_0x3f21('0x29')][_0x331c32[_0x3f21('0x49')]][_0x3f21('0x13b')]===!![]){return;}else if(_0x303ccb[_0x3f21('0x29')][_0x331c32[_0x3f21('0x49')]]['running']===![]){_0x303ccb[_0x3f21('0x29')][_0x331c32['name']]['running']=!![];}var _0x212b3f=_0x303ccb[_0x3f21('0x1e')][_0x331c32[_0x3f21('0x49')]];var _0x3ad1e5=_0x212b3f[_0x3f21('0x6d')]!==utils[_0x3f21('0x6a')][_0x3f21('0x7f')];var _0x11959a=utils[_0x3f21('0x13c')](_0x212b3f);_0x212b3f[_0x3f21('0x13d')]=utils[_0x3f21('0x13e')](_0x212b3f,_0x303ccb['trunks']);Promise[_0x3f21('0x13f')]()[_0x3f21('0x3f')](function(){if(_0x212b3f[_0x3f21('0x13d')]===utils[_0x3f21('0x6a')][_0x3f21('0x7f')]){if(_0x3ad1e5){clearPredictiveAttributes(_0x212b3f);_0x331c32['startPredictive']=undefined;_0x331c32[_0x3f21('0x25')]=undefined;}if(_0x212b3f['statusMessage']===utils['CAMPAIGN_STATUS'][_0x3f21('0x7f')]){_0x331c32[_0x3f21('0x140')]=0x0;_0x331c32['paused']=0x0;_0x331c32['inUse']=0x0;_0x331c32[_0x3f21('0x141')]=0x0;_0x331c32[_0x3f21('0x142')]=0x0;}}else if(_0x212b3f[_0x3f21('0x13d')]===utils[_0x3f21('0x6a')][_0x3f21('0x143')]&&!_0x11959a){return _0x303ccb['ifTime'](_0x212b3f,!![])[_0x3f21('0x3f')](function(){return _0x303ccb[_0x3f21('0x93')](_0x212b3f,![]);})['then'](function(){return _0x303ccb[_0x3f21('0xb1')](_0x212b3f);})[_0x3f21('0xa5')](function(_0x2d0c18){loggerSyncQueueSummary[_0x3f21('0x44')](_0x3f21('0x144'),util[_0x3f21('0x46')](_0x2d0c18,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x212b3f);});}else{clearPredictiveAttributes(_0x212b3f);}})[_0x3f21('0x3f')](function(){var _0x3039d0=_0x331c32[_0x3f21('0x145')](_0x212b3f);if(_0x3039d0||_0x212b3f[_0x3f21('0x146')]){_0x212b3f[_0x3f21('0x146')]=![];_0x331c32[_0x3f21('0x147')](_0x212b3f);Object[_0x3f21('0x148')](_0x212b3f,_0x331c32);emitOutboundVoiceQueueSummary(_0x331c32);}_0x303ccb[_0x3f21('0x29')][_0x212b3f[_0x3f21('0x49')]][_0x3f21('0x13b')]=![];})['catch'](function(_0x5b0be8){logger[_0x3f21('0x66')](_0x3f21('0x144'),util[_0x3f21('0x46')](_0x5b0be8,{'showHidden':![],'depth':null}));_0x303ccb[_0x3f21('0x29')][_0x212b3f[_0x3f21('0x49')]]['running']=![];});};Dialer[_0x3f21('0x19')]['syncQueueSummaryComplete']=_[_0x3f21('0x149')](function(){var _0xd9b0af=_['filter'](this[_0x3f21('0x1e')],function(_0x16b08e){return _0x16b08e[_0x3f21('0x14a')];});var _0x20dd4b=_[_0x3f21('0x14b')](this[_0x3f21('0xfa')],function(_0x5b4344){return _0x5b4344[_0x3f21('0x14c')]&&_0x5b4344['status']==='reachable';});if(_0xd9b0af[_0x3f21('0x9c')]>0x0&&_0x20dd4b[_0x3f21('0x9c')]>0x0){return Promise['resolve']()[_0x3f21('0x3f')](cmHopper['handlePreviewRecallNotifications'](_[_0x3f21('0x14d')](_0xd9b0af,'id'),previewRecallmeReminderInterval,_[_0x3f21('0x14d')](_0x20dd4b,'id')))[_0x3f21('0x3f')](function(_0xcd654a){for(var _0x289c28=0x0;_0x289c28<_0xcd654a[_0x3f21('0x9c')];_0x289c28++){var _0x39b223=_0xcd654a[_0x289c28][_0x3f21('0x14e')][_0x3f21('0x49')];if(_0x39b223)io['to'](util[_0x3f21('0x47')](_0x3f21('0x14f'),_0x39b223))[_0x3f21('0x42')](_0x3f21('0x150'),{'hopper':_0xcd654a[_0x289c28]});}})[_0x3f21('0xa5')](function(_0x328a33){logger[_0x3f21('0x66')](_0x3f21('0x151'),_0x328a33);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3f21('0x19')]['loopClearZombieChannels']=function(){var _0xcd965=this;setInterval(function(){_0xcd965[_0x3f21('0x152')](_0xcd965[_0x3f21('0x22')],_0x3f21('0x153'));_0xcd965[_0x3f21('0x152')](_0xcd965['actions'],_0x3f21('0x154'));},0x32c8);};Dialer[_0x3f21('0x19')][_0x3f21('0x152')]=function(_0x271a7f,_0x5e144e){var _0x359bfb=this;for(var _0x54d702 in _0x271a7f){if(typeof _0x271a7f[_0x54d702]!==_0x3f21('0xac')){this[_0x3f21('0x1c')]['enqueue'](function(){if(!_[_0x3f21('0xf8')](_0x271a7f[_0x54d702])){return ami[_0x3f21('0x9e')]({'action':_0x3f21('0x88'),'channel':_0x271a7f[_0x54d702][_0x3f21('0xf3')]})[_0x3f21('0xa5')](function(_0x55190c){if(_0x55190c[_0x3f21('0x6d')]===_0x3f21('0x155')){setTimeout(function(){if(_0x271a7f[_0x54d702]&&_0x271a7f[_0x54d702][_0x3f21('0x43')]!==_0x3f21('0xc2')){_0x359bfb[_0x3f21('0xc3')](_0x359bfb[_0x3f21('0x1e')][_0x271a7f[_0x54d702][_0x3f21('0xc0')]]);logger[_0x3f21('0x66')](_0x3f21('0x156'),_0x5e144e,_0x54d702,_0x271a7f[_0x54d702]['queue']);delete _0x271a7f[_0x54d702];}if(_0x271a7f[_0x54d702]&&_0x271a7f[_0x54d702][_0x3f21('0x43')]==='ivr'){_0x359bfb[_0x3f21('0xc3')](_0x359bfb[_0x3f21('0x1f')][_0x271a7f[_0x54d702][_0x3f21('0xc0')]]);logger['error'](_0x3f21('0x157'),_0x5e144e,_0x54d702,_0x271a7f[_0x54d702][_0x3f21('0xc0')]);delete _0x271a7f[_0x54d702];}},0x2328);}});}});}}};Dialer['prototype'][_0x3f21('0x158')]=function(_0x505a8b){return Promise['resolve']()[_0x3f21('0x3f')](voiceQueueRt['getVoiceQueueRtPauses'](_0x505a8b))[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x159')));};Dialer[_0x3f21('0x19')]['updateOriginated']=function(_0x390531){if(!_['isUndefined'](_0x390531)&&_0x390531!==null){if(typeof _0x390531[_0x3f21('0x7e')]!==_0x3f21('0xac')){if(_0x390531['originated']>0x0){_0x390531[_0x3f21('0x7e')]-=0x1;}else{logger['error'](_0x3f21('0x15a'));}}}else{logger[_0x3f21('0x66')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x3f21('0x19')][_0x3f21('0x15b')]=function(_0x26111e,_0x558582){var _0x28b8b1=this;return function(_0xfa1eeb){_0x28b8b1['updateOriginated'](_0x558582);logger[_0x3f21('0x66')](_0x26111e,util[_0x3f21('0x46')](_0xfa1eeb,{'showHidden':![],'depth':null}));};};Dialer[_0x3f21('0x19')][_0x3f21('0x15c')]=function(_0x14a1b8,_0x1d8067,_0x37f7c6){var _0x89fe51={'state':0x19,'statedesc':_0x3f21('0x15d')};this['updateOriginated'](_0x1d8067);this[_0x3f21('0x11b')](_[_0x3f21('0x61')](_0x89fe51,_[_0x3f21('0x104')](_0x37f7c6,[_0x3f21('0xe1'),_0x3f21('0xe2'),_0x3f21('0x15e'),'VoiceQueueId',_0x3f21('0xe4')])),_0x3f21('0x15f'),_0x3f21('0x160'));logger[_0x3f21('0x66')](_0x14a1b8);};Dialer[_0x3f21('0x19')][_0x3f21('0x11b')]=function(_0x2b0dcf,_0x229a8c,_0x43c9ac){hopperUtils[_0x3f21('0xca')](_0x2b0dcf)[_0x3f21('0xa5')](loggerCatch(_0x229a8c));hopperUtils[_0x3f21('0xcb')](_0x2b0dcf)[_0x3f21('0xa5')](loggerCatch(_0x43c9ac));};Dialer[_0x3f21('0x19')][_0x3f21('0xdd')]=function(_0xe1aca,_0x4a573b){hopperUtils['createHistory'](_0xe1aca)[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x137')));if(_0x4a573b==0x0){hopperUtils[_0x3f21('0xcb')](_0xe1aca)[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x161')));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x349b1c){return Promise[_0x3f21('0x13f')]()[_0x3f21('0x3f')](cmHopper[_0x3f21('0x162')](_0x349b1c['id'],previewRecallmeReminderInterval))['then'](function(_0x1b239e){for(var _0x5e2700=0x0;_0x5e2700<_0x1b239e['length'];_0x5e2700++){var _0x55de5f=_0x1b239e[_0x5e2700]['Agent']['name'];if(_0x55de5f)io['to'](util[_0x3f21('0x47')](_0x3f21('0x14f'),_0x55de5f))[_0x3f21('0x42')](_0x3f21('0x150'),{'hopper':_0x1b239e[_0x5e2700]});}})[_0x3f21('0xa5')](function(){});};Dialer[_0x3f21('0x19')][_0x3f21('0xaf')]=function(_0x30cf54){var _0x5e5d9b=this;return function(){_0x5e5d9b['handleIvr'](_0x30cf54);};};Dialer[_0x3f21('0x19')][_0x3f21('0x163')]=function(_0x1c9995,_0x1f3652){var _0x55fb75=this;var _0x2d9c1c=uuid['v4']();this['actions'][_0x2d9c1c]=new Action(_0x1c9995,_0x1f3652,_0x2d9c1c);return new Promise(function(_0x29719b,_0x139d0b){if(_['isUndefined'](_0x1c9995)&&typeof _0x1c9995!==_0x3f21('0x164')){return _0x139d0b(msgResponse('originate',_0x3f21('0x99'),_0x3f21('0x165')));}if(_[_0x3f21('0x41')](_0x1f3652[_0x3f21('0x166')])||_0x1f3652[_0x3f21('0x166')]===null){return _0x139d0b(msgResponse(_0x3f21('0x167'),_0x3f21('0x99'),_0x3f21('0x168')));}var _0x525f28={'XMD-CALLERID':_0x55fb75['actions'][_0x2d9c1c][_0x3f21('0x169')](),'XMD-AGI':_0x1c9995[_0x3f21('0x132')]?util['format'](_0x3f21('0x16a'),ipAgi,_0x1c9995[_0x3f21('0x132')]):_0x3f21('0x16b'),'XMD-AGIAFTER':_0x1c9995['dialQueueProject2']?util[_0x3f21('0x47')](_0x3f21('0x16a'),ipAgi,_0x1c9995[_0x3f21('0xc9')]):_0x3f21('0x16b'),'XMD-QUEUE':utils['isOutboundQueue'](_0x1c9995)?util[_0x3f21('0x47')](_0x3f21('0x16c'),_0x1c9995[_0x3f21('0x49')],_0x1c9995['dialQueueOptions']||'',_0x1c9995[_0x3f21('0x16d')]?'c':'',_0x1c9995['dialQueueTimeout']||0x3):_0x3f21('0x16b'),'XMD-CONTACTID':_0x1f3652['ContactId'],'XMD-CDRTYPE':_0x3f21('0x9'),'CALLERID(all)':_0x55fb75[_0x3f21('0xf2')][_0x2d9c1c][_0x3f21('0x169')](),'XMD-AMD':_0x1c9995[_0x3f21('0x112')]?_0x3f21('0x143'):_0x3f21('0x16b'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x1c9995[_0x3f21('0x112')]){_0x525f28[_0x3f21('0x16e')]=_0x1c9995[_0x3f21('0x16f')]||0x9c4;_0x525f28[_0x3f21('0x170')]=_0x1c9995[_0x3f21('0x171')]||0x5dc;_0x525f28[_0x3f21('0x172')]=_0x1c9995['dialAMDAfterGreetingSilence']||0x320;_0x525f28[_0x3f21('0x173')]=_0x1c9995[_0x3f21('0x174')]||0x1388;_0x525f28[_0x3f21('0x175')]=_0x1c9995[_0x3f21('0x176')]||0x64;_0x525f28[_0x3f21('0x177')]=_0x1c9995[_0x3f21('0x178')]||0x32;_0x525f28['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x1c9995['dialAMDMaximumNumberOfWords']||0x3;_0x525f28[_0x3f21('0x179')]=_0x1c9995[_0x3f21('0x17a')]||0x100;_0x525f28[_0x3f21('0x17b')]=_0x1c9995['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x3f21('0x17c')](_0x1c9995)){_0x525f28[_0x3f21('0x17d')]=_0x1f3652[_0x3f21('0xe3')];}else{_0x525f28[_0x3f21('0x17e')]=_0x1f3652[_0x3f21('0xe4')];}var _0x517774=utils[_0x3f21('0x17f')](_0x1f3652[_0x3f21('0x180')]);Object['assign'](_0x525f28,_0x517774);var _0x320305=_0x55fb75[_0x3f21('0x85')](_0x1c9995['Trunk'])?utils[_0x3f21('0x181')](_0x1c9995[_0x3f21('0x8c')][_0x3f21('0x182')],_0x1c9995[_0x3f21('0x183')],_0x1c9995[_0x3f21('0x184')]>0x0?utils[_0x3f21('0x185')](_0x1c9995[_0x3f21('0x186')],_0x1c9995[_0x3f21('0x184')]):_0x1c9995[_0x3f21('0x186')]):utils['getCallerId'](_[_0x3f21('0xf8')](_0x1c9995[_0x3f21('0x8d')])?_0x1c9995[_0x3f21('0x8c')][_0x3f21('0x182')]:_0x1c9995[_0x3f21('0x8d')][_0x3f21('0x182')],_0x1c9995['dialOriginateCallerIdName'],_0x1c9995[_0x3f21('0x184')]>0x0?utils[_0x3f21('0x185')](_0x1c9995[_0x3f21('0x186')],_0x1c9995[_0x3f21('0x184')]):_0x1c9995[_0x3f21('0x186')]);if(_0x320305){_0x525f28['XMD-ORIGINATECALLERIDNAME']=_0x55fb75[_0x3f21('0xf2')][_0x2d9c1c][_0x3f21('0x187')]=utils['extractCalleridName'](_0x320305);_0x525f28[_0x3f21('0x188')]=_0x1f3652[_0x3f21('0x166')];}_0x1c9995[_0x3f21('0x189')]=_0x525f28;return ami[_0x3f21('0x9e')]({'actionid':_0x2d9c1c,'action':_0x3f21('0x167'),'channel':_0x55fb75['isTrunkReachable'](_0x1c9995['Trunk'])?util[_0x3f21('0x47')](_0x3f21('0x18a'),_0x1c9995[_0x3f21('0x8c')][_0x3f21('0x49')],isNotNull(_0x1c9995['dialPrefix'])?_0x1c9995['dialPrefix'][_0x3f21('0x18b')]()||'':'',_0x1c9995[_0x3f21('0x18c')]>0x0?_0x1f3652[_0x3f21('0x166')]['substring'](_0x1c9995[_0x3f21('0x18c')]):_0x1f3652['phone']):util['format']('SIP/%s/%s%s',_[_0x3f21('0xf8')](_0x1c9995[_0x3f21('0x8d')])?_0x1c9995[_0x3f21('0x8c')][_0x3f21('0x49')]:_0x1c9995[_0x3f21('0x8d')][_0x3f21('0x49')],isNotNull(_0x1c9995[_0x3f21('0x18d')])?_0x1c9995[_0x3f21('0x18d')]['trim']()||'':'',_0x1c9995[_0x3f21('0x18c')]>0x0?_0x1f3652[_0x3f21('0x166')][_0x3f21('0x18e')](_0x1c9995[_0x3f21('0x18c')]):_0x1f3652['phone']),'callerid':_0x320305,'Exten':_0x3f21('0x18f'),'Context':_0x3f21('0x190'),'Priority':'1','variable':_0x525f28,'timeout':(_0x1c9995[_0x3f21('0x191')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2d9c1c})['then'](function(_0x7b2726){return _0x29719b(_0x7b2726);})[_0x3f21('0xa5')](function(_0x143646){_0x1c9995[_0x3f21('0x192')]+=0x1;var _0x3301d1=new History(_0x55fb75['actions'][_0x2d9c1c]);logger['error'](util['format'](_0x3f21('0x193'),JSON[_0x3f21('0x73')](_0x143646)));_0x3301d1['state']=0xe;_0x3301d1[_0x3f21('0x6f')]=_0x3f21('0x194');_0x3301d1[_0x3f21('0x70')]=moment()['format'](_0x3f21('0xc5'));_0x3301d1['endtime']=_0x3301d1['starttime'];hopperUtils[_0x3f21('0xca')](_0x3301d1)[_0x3f21('0xa5')](loggerCatch('[originate][error]'));_0x55fb75['moveContactManagedDialer'](_0x3301d1)[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x195')))['finally'](function(){delete _0x55fb75[_0x3f21('0xf2')][_0x2d9c1c];return _0x139d0b(msgResponse(_0x3f21('0x167'),_0x3f21('0xbf'),_0x3f21('0x196')));});});});};Dialer[_0x3f21('0x19')]['checkRetriveMax']=function(_0x182fb0,_0x481e90,_0x51652c){var _0x412e2b=new History(_0x481e90);if(_0x412e2b[_0x3f21('0x120')]+_0x412e2b['countcongestionretry']+_0x412e2b[_0x3f21('0x121')]+_0x412e2b[_0x3f21('0x122')]+_0x412e2b[_0x3f21('0xd6')]+_0x412e2b[_0x3f21('0xeb')]+_0x412e2b['countmachineretry']+_0x412e2b[_0x3f21('0x12e')]>=_0x51652c[_0x3f21('0x123')]-0x1){return!![];}switch(_0x182fb0){case 0x3:if(_0x412e2b[_0x3f21('0x121')]>=_0x51652c[_0x3f21('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x412e2b[_0x3f21('0x121')]+=0x1,'scheduledat':moment()[_0x3f21('0xdf')](_0x51652c[_0x3f21('0x198')],'minutes')[_0x3f21('0x47')](_0x3f21('0xc5')),'ContactId':_0x412e2b[_0x3f21('0xe1')],'ListId':_0x412e2b['ListId'],'VoiceQueueId':_0x412e2b['VoiceQueueId']||undefined,'CampaignId':_0x412e2b[_0x3f21('0xe4')]||undefined})[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x199')));break;case 0x5:if(_0x412e2b[_0x3f21('0x120')]>=_0x51652c[_0x3f21('0x19a')]-0x1){return!![];}hopperUtils[_0x3f21('0xde')]({'active':![],'countbusyretry':_0x412e2b[_0x3f21('0x120')]+=0x1,'scheduledat':moment()[_0x3f21('0xdf')](_0x51652c['dialBusyRetryFrequency'],'minutes')[_0x3f21('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x412e2b[_0x3f21('0xe1')],'ListId':_0x412e2b[_0x3f21('0xe2')],'VoiceQueueId':_0x412e2b[_0x3f21('0xe3')]||undefined,'CampaignId':_0x412e2b[_0x3f21('0xe4')]||undefined})[_0x3f21('0xa5')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x412e2b[_0x3f21('0x12d')]>=_0x51652c[_0x3f21('0x19b')]-0x1){return!![];}hopperUtils[_0x3f21('0xde')]({'active':![],'countcongestionretry':_0x412e2b[_0x3f21('0x12d')]+=0x1,'scheduledat':moment()[_0x3f21('0xdf')](_0x51652c[_0x3f21('0x19c')],_0x3f21('0xe0'))[_0x3f21('0x47')](_0x3f21('0xc5')),'ContactId':_0x412e2b[_0x3f21('0xe1')],'ListId':_0x412e2b['ListId'],'VoiceQueueId':_0x412e2b[_0x3f21('0xe3')]||undefined,'CampaignId':_0x412e2b['CampaignId']||undefined})['catch'](loggerCatch(_0x3f21('0x19d')));break;case 0x0:if(_0x412e2b[_0x3f21('0x122')]>=_0x51652c[_0x3f21('0x19e')]-0x1){return!![];}else{hopperUtils[_0x3f21('0xde')]({'active':![],'countnosuchnumberretry':_0x412e2b[_0x3f21('0x122')]+=0x1,'scheduledat':moment()['add'](_0x51652c[_0x3f21('0x19f')],'minutes')[_0x3f21('0x47')](_0x3f21('0xc5')),'ContactId':_0x412e2b[_0x3f21('0xe1')],'ListId':_0x412e2b[_0x3f21('0xe2')],'VoiceQueueId':_0x412e2b[_0x3f21('0xe3')]||undefined,'CampaignId':_0x412e2b[_0x3f21('0xe4')]||undefined})['catch'](loggerCatch(_0x3f21('0x1a0')));}break;case 0xa:if(_0x412e2b[_0x3f21('0xd6')]>=_0x51652c[_0x3f21('0xdc')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x412e2b[_0x3f21('0xd6')]+=0x1,'scheduledat':moment()[_0x3f21('0xdf')](_0x51652c[_0x3f21('0x1a1')],'minutes')[_0x3f21('0x47')](_0x3f21('0xc5')),'ContactId':_0x412e2b[_0x3f21('0xe1')],'ListId':_0x412e2b[_0x3f21('0xe2')],'VoiceQueueId':_0x412e2b[_0x3f21('0xe3')]||undefined,'CampaignId':_0x412e2b[_0x3f21('0xe4')]||undefined})[_0x3f21('0xa5')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x412e2b[_0x3f21('0xeb')]>=_0x51652c[_0x3f21('0xed')]-0x1){return!![];}hopperUtils[_0x3f21('0xde')]({'active':![],'countabandonedretry':_0x412e2b[_0x3f21('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x51652c['dialAbandonedRetryFrequency'],'minutes')['format'](_0x3f21('0xc5')),'ContactId':_0x412e2b['ContactId'],'ListId':_0x412e2b[_0x3f21('0xe2')],'VoiceQueueId':_0x412e2b[_0x3f21('0xe3')]||undefined,'CampaignId':_0x412e2b[_0x3f21('0xe4')]||undefined})[_0x3f21('0xa5')](loggerCatch(_0x3f21('0xee')));break;case 0x13:if(_0x412e2b['countmachineretry']>=_0x51652c[_0x3f21('0x125')]-0x1){return!![];}hopperUtils[_0x3f21('0xde')]({'active':![],'countmachineretry':_0x412e2b[_0x3f21('0x11f')]+=0x1,'scheduledat':moment()[_0x3f21('0xdf')](_0x51652c[_0x3f21('0x130')],_0x3f21('0xe0'))[_0x3f21('0x47')](_0x3f21('0xc5')),'ContactId':_0x412e2b[_0x3f21('0xe1')],'ListId':_0x412e2b['ListId'],'VoiceQueueId':_0x412e2b[_0x3f21('0xe3')]||undefined,'CampaignId':_0x412e2b[_0x3f21('0xe4')]||undefined})[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x128')));break;case 0x14:if(_0x412e2b[_0x3f21('0x12e')]>=_0x51652c['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x3f21('0xde')]({'active':![],'countagentrejectretry':_0x412e2b[_0x3f21('0x12e')]+=0x1,'scheduledat':moment()[_0x3f21('0xdf')](_0x51652c[_0x3f21('0x1a2')],_0x3f21('0xe0'))[_0x3f21('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x412e2b['ContactId'],'ListId':_0x412e2b[_0x3f21('0xe2')],'VoiceQueueId':_0x412e2b[_0x3f21('0xe3')]||undefined,'CampaignId':_0x412e2b[_0x3f21('0xe4')]||undefined})[_0x3f21('0xa5')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x47af22,_0x383806,_0x1d7d03){var _0x424798=this;var _0x23d60b=new History(_0x47af22);var _0x32d3e3=![];var _0x1401d3;var _0x2391fe;return new Promise(function(_0x579b80,_0x481c97){if(_['isUndefined'](_0x383806)&&typeof _0x383806!==_0x3f21('0x164')){return _0x481c97(msgResponse(_0x3f21('0x1a3'),_0x3f21('0x99'),'entity\x20is\x20undefine'));}if(_[_0x3f21('0x41')](_0x1d7d03)&&typeof _0x1d7d03!==_0x3f21('0x164')){return _0x481c97(msgResponse('[callProgressDetecting]',_0x3f21('0x99'),_0x3f21('0x1a4')));}hopperUtils['verifyAdditionalPhones'](_0x23d60b,_0x1d7d03[_0x3f21('0x1a5')],_0x383806)[_0x3f21('0x3f')](function(_0x4adc40){if(_0x4adc40[_0x3f21('0xdb')]==0x1)_0x32d3e3=!![];switch(_0x1d7d03['reason']){case'0':_0x383806[_0x3f21('0x1a6')]+=0x1;_0x23d60b[_0x3f21('0xe6')]=0x0;_0x23d60b['statedesc']=_0x3f21('0x1a7');_0x23d60b[_0x3f21('0x122')]+=0x1;_0x23d60b[_0x3f21('0xd7')]+=0x1;ami[_0x3f21('0x42')](_0x3f21('0x1a8'),ut[_0x3f21('0x119')](_0x47af22,_0x3f21('0x1a9')));_0x1401d3=_0x383806[_0x3f21('0x19f')];_0x2391fe=_0x383806[_0x3f21('0xd8')];hopperUtils[_0x3f21('0xca')](_0x23d60b)[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x12c')));if(_0x424798[_0x3f21('0x1aa')](0x0,_0x47af22,_0x383806)&&!_0x32d3e3){if(_0x23d60b['countnosuchnumberretry']>=_0x383806[_0x3f21('0x19e')]){_0x424798[_0x3f21('0x126')](_0x23d60b,_0x579b80,_0x481c97,'reason\x200\x20no\x20such\x20number....');}else{_0x424798['stateGlobal'](_0x23d60b,_0x579b80,_0x481c97,_0x3f21('0x1ab'));}}break;case'3':_0x383806[_0x3f21('0x1ac')]+=0x1;_0x23d60b[_0x3f21('0xe6')]=0x3;_0x23d60b[_0x3f21('0x6f')]=_0x3f21('0x1ad');_0x23d60b[_0x3f21('0x121')]+=0x1;_0x23d60b[_0x3f21('0xd7')]+=0x1;var _0x461c45=ut[_0x3f21('0x1ae')](_0x47af22,_0x383806);ami[_0x3f21('0x42')]('custom:agentnoanswer',_0x461c45);_0x1401d3=_0x383806['dialNoAnswerRetryFrequency'];_0x2391fe=_0x383806['callAdditionalPhoneAfterMin'];hopperUtils[_0x3f21('0xca')](_0x23d60b)[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x1af')));if(_0x424798[_0x3f21('0x1aa')](0x3,_0x47af22,_0x383806)&&!_0x32d3e3){if(_0x23d60b['countnoanswerretry']>=_0x383806[_0x3f21('0x197')]){_0x424798[_0x3f21('0x126')](_0x23d60b,_0x579b80,_0x481c97,_0x3f21('0x1b0'));}else{_0x424798[_0x3f21('0x124')](_0x23d60b,_0x579b80,_0x481c97,_0x3f21('0x1b0'));}}break;case'5':_0x383806[_0x3f21('0x1b1')]+=0x1;_0x23d60b[_0x3f21('0xe6')]=0x5;_0x23d60b[_0x3f21('0x6f')]=_0x3f21('0x1b2');_0x23d60b['countbusyretry']+=0x1;_0x23d60b[_0x3f21('0xd7')]+=0x1;ami[_0x3f21('0x42')]('custom:agentbusy',ut[_0x3f21('0x119')](_0x47af22,_0x3f21('0x1b3')));_0x1401d3=_0x383806[_0x3f21('0x1b4')];_0x2391fe=_0x383806['callAdditionalPhoneAfterMin'];hopperUtils[_0x3f21('0xca')](_0x23d60b)['catch'](loggerCatch(_0x3f21('0x1b5')));if(_0x424798[_0x3f21('0x1aa')](0x5,_0x47af22,_0x383806)&&!_0x32d3e3){if(_0x23d60b[_0x3f21('0x120')]>=_0x383806[_0x3f21('0x19a')]){_0x424798['createStateFinal'](_0x23d60b,_0x579b80,_0x481c97,_0x3f21('0x1b6'));}else{_0x424798['stateGlobal'](_0x23d60b,_0x579b80,_0x481c97,'reason\x205\x20busy');}}break;case'8':_0x383806['outboundCongestionCallsDay']+=0x1;_0x23d60b[_0x3f21('0xe6')]=0x8;_0x23d60b[_0x3f21('0x6f')]=_0x3f21('0x1b7');_0x23d60b[_0x3f21('0x12d')]+=0x1;_0x23d60b['countglobal']+=0x1;_0x1401d3=_0x383806[_0x3f21('0x19c')];_0x2391fe=_0x383806[_0x3f21('0xd8')];ami[_0x3f21('0x42')](_0x3f21('0x1b8'),ut[_0x3f21('0x119')](_0x47af22,_0x3f21('0x1b9')));hopperUtils[_0x3f21('0xca')](_0x23d60b)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x424798[_0x3f21('0x1aa')](0x8,_0x47af22,_0x383806)&&!_0x32d3e3){if(_0x23d60b[_0x3f21('0x12d')]>=_0x383806['dialCongestionMaxRetry']){_0x424798['createStateFinal'](_0x23d60b,_0x579b80,_0x481c97,_0x3f21('0x1ba'));}else{_0x424798[_0x3f21('0x124')](_0x23d60b,_0x579b80,_0x481c97,'reason\x208\x20congestion');}}break;case'11':_0x383806['outboundAbandonedCallsDay']+=0x1;_0x23d60b[_0x3f21('0xe6')]=0xb;_0x23d60b['statedesc']=_0x3f21('0xef');_0x23d60b['countabandonedretry']+=0x1;_0x23d60b['countglobal']+=0x1;_0x1401d3=_0x383806['dialAbandonedRetryFrequency'];_0x2391fe=_0x383806[_0x3f21('0xd8')];hopperUtils[_0x3f21('0xca')](_0x23d60b)[_0x3f21('0xa5')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x424798[_0x3f21('0x1aa')](0xb,_0x47af22,_0x383806)&&!_0x32d3e3){if(_0x23d60b[_0x3f21('0xeb')]>=_0x383806['dialAbandonedMaxRetry']){_0x424798[_0x3f21('0x126')](_0x23d60b,_0x579b80,_0x481c97,_0x3f21('0x1bb'));}else{_0x424798[_0x3f21('0x124')](_0x23d60b,_0x579b80,_0x481c97,'reason\x2011\x20abandoned');}}break;case'20':_0x383806[_0x3f21('0x1bc')]+=0x1;_0x23d60b[_0x3f21('0xe6')]=0x14;_0x23d60b['statedesc']=_0x3f21('0x1bd');_0x23d60b[_0x3f21('0x12e')]+=0x1;_0x23d60b[_0x3f21('0xd7')]+=0x1;_0x1401d3=_0x383806[_0x3f21('0x1a2')];_0x2391fe=_0x383806[_0x3f21('0xd8')];ami[_0x3f21('0x42')](_0x3f21('0x1be'),ut[_0x3f21('0x119')](_0x47af22,_0x3f21('0x1bf')));hopperUtils['createHistory'](_0x23d60b)[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x1c0')));if(_0x424798[_0x3f21('0x1aa')](0x14,_0x47af22,_0x383806)&&!_0x32d3e3){if(_0x23d60b[_0x3f21('0x12e')]>=_0x383806[_0x3f21('0x1c1')]){_0x424798['createStateFinal'](_0x23d60b,_0x579b80,_0x481c97,'reason\x2020\x20agentreject');}else{_0x424798[_0x3f21('0x124')](_0x23d60b,_0x579b80,_0x481c97,_0x3f21('0x1c2'));}}break;default:_0x383806[_0x3f21('0x138')]+=0x1;_0x23d60b[_0x3f21('0xe6')]=0xc;_0x23d60b[_0x3f21('0x6f')]=_0x1d7d03['reason'];_0x1401d3=_0x383806[_0x3f21('0x1a2')];_0x2391fe=_0x383806[_0x3f21('0xd8')];hopperUtils[_0x3f21('0xca')](_0x23d60b)[_0x3f21('0xa5')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x424798[_0x3f21('0x1aa')](_0x1d7d03['reason'],_0x47af22,_0x383806)&&!_0x32d3e3){if(_0x23d60b['countbusyretry']+_0x23d60b[_0x3f21('0x12d')]+_0x23d60b[_0x3f21('0x121')]+_0x23d60b[_0x3f21('0x122')]+_0x23d60b[_0x3f21('0xd6')]+_0x23d60b['countabandonedretry']+_0x23d60b['countmachineretry']+_0x23d60b['countagentrejectretry']>=_0x383806[_0x3f21('0x123')]){_0x424798[_0x3f21('0x124')](_0x23d60b,_0x579b80,_0x481c97,_0x1d7d03[_0x3f21('0x1a5')]);}else{_0x424798[_0x3f21('0x126')](_0x23d60b,_0x579b80,_0x481c97,_0x1d7d03['reason']);}}}})[_0x3f21('0x3f')](function(){if(_0x32d3e3){hopperUtils[_0x3f21('0xea')](_0x23d60b,_0x1401d3,_0x2391fe)[_0x3f21('0x3f')](function(){return _0x579b80(0x1);});}});});};Dialer[_0x3f21('0x19')][_0x3f21('0x124')]=function(_0xe3b2be,_0x4818c9,_0x5967c8,_0xdee5e1){var _0x5410ed=new Final(_0xe3b2be);_0x5410ed[_0x3f21('0xe6')]=0xf;_0x5410ed[_0x3f21('0x6f')]='Global';this[_0x3f21('0x126')](_0x5410ed,_0x4818c9,_0x5967c8,_0xdee5e1);};Dialer['prototype'][_0x3f21('0x126')]=function(_0x2130b3,_0x3f33cc,_0x9c7c5f,_0x70443d){hopperUtils[_0x3f21('0xcb')](_0x2130b3)['then'](function(){return _0x3f33cc(msgResponse(_0x3f21('0x1a3'),_0x3f21('0x10c'),_0x70443d));})['catch'](function(){return _0x9c7c5f(msgResponse(_0x3f21('0x1c3'),_0x3f21('0x99'),_0x3f21('0x1c4')));});};Dialer[_0x3f21('0x19')][_0x3f21('0x1c5')]=function(_0x11a95e){var _0x308e04=_0x11a95e[_0x3f21('0x1c6')]/0x64;var _0x3456ab=_0x11a95e[_0x3f21('0xd2')]/(_0x11a95e[_0x3f21('0xd2')]+_0x11a95e['outboundAnswerCallsDay']);var _0x3094b9=Math[_0x3f21('0x1c7')](_0x11a95e[_0x3f21('0x1c8')]*(_0x11a95e[_0x3f21('0x1c9')]/0x64));var _0x29482b=Math[_0x3f21('0x1c7')](_0x11a95e['predictiveIntervalAvailable']*(_0x11a95e[_0x3f21('0x1ca')]/0x64));var _0x56aad3=_0x11a95e[_0x3f21('0x140')]+_0x11a95e[_0x3f21('0x141')];var _0x259daa=Math['floor'](_0x11a95e[_0x3f21('0x5c')]*_0x11a95e['erlangAbandonmentRate']*_0x11a95e['predictiveIntervalHitRate']*_0x11a95e['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x11a95e['startProgressive'])){if(!_['isUndefined'](_0x11a95e[_0x3f21('0x24')])){_0x11a95e[_0x3f21('0x24')]=undefined;loggerPredictive['error'](_0x3f21('0x1cb'),_0x3f21('0x1cc'));}if(!_[_0x3f21('0x41')](_0x11a95e[_0x3f21('0x65')])){loggerPredictive[_0x3f21('0x66')](_0x3f21('0x1cb'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x11a95e['handlePredictive']);_0x11a95e[_0x3f21('0x65')]=undefined;}_0x11a95e[_0x3f21('0x25')]=moment()[_0x3f21('0x47')](_0x3f21('0xc5'));loggerPredictive[_0x3f21('0x4c')](_0x11a95e['name'],_0x3f21('0x1cd'),_0x11a95e[_0x3f21('0x25')]);this[_0x3f21('0xb4')](_0x11a95e,0x1);}else if(ifInterval(_0x11a95e[_0x3f21('0x1ce')],_0x11a95e['startProgressive'])){this['handlePower'](_0x11a95e,0x1);loggerPredictiveCalls[_0x3f21('0x4c')](_0x3f21('0x1cf'),_0x11a95e['startProgressive'],_0x11a95e['name']);_0x11a95e['erlangCalls']=0x0;_0x11a95e[_0x3f21('0xd3')]=0x0;}else if(_0x308e04<_0x3456ab&&_0x11a95e[_0x3f21('0x1d0')]===_0x3f21('0x1d1')){clearPredictiveAttributes(_0x11a95e);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x3456ab,'startProgressive',_0x11a95e['name']);}else if(_0x259daa<_0x11a95e['predictiveIntervalErlangCallsDroppedCalls']&&_0x11a95e[_0x3f21('0x1d0')]===_0x3f21('0x1d1')){clearPredictiveAttributes(_0x11a95e);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x259daa,_0x3f21('0x1d2'),_0x11a95e[_0x3f21('0xd3')],_0x3f21('0x25'),_0x11a95e[_0x3f21('0x49')]);}else if(!ifInterval(_0x11a95e[_0x3f21('0x1ce')],_0x11a95e[_0x3f21('0x25')])&&_[_0x3f21('0x41')](_0x11a95e['startPredictive'])&&!_[_0x3f21('0x41')](_0x11a95e[_0x3f21('0x25')])){_0x11a95e['startPredictive']=moment()[_0x3f21('0x47')](_0x3f21('0xc5'));loggerPredictive['info'](_0x11a95e[_0x3f21('0x49')],'started\x20in\x20predictive\x20at',_0x11a95e['startPredictive']);hopperUtils['avgHandleTime'](_0x11a95e[_0x3f21('0x1ce')])[_0x3f21('0x3f')](this[_0x3f21('0x1d3')](_0x11a95e))[_0x3f21('0x3f')](mergeDataErlangB(_0x11a95e))[_0x3f21('0x3f')](this[_0x3f21('0x1d4')](_0x11a95e))[_0x3f21('0xa5')](loggerCatchPredictive(_0x3f21('0x1d5'),_0x11a95e));}else if(!ifInterval(_0x11a95e['dialPredictiveInterval'],_0x11a95e[_0x3f21('0x24')])){_0x11a95e[_0x3f21('0xd3')]=0x0;_0x11a95e[_0x3f21('0x24')]=moment()[_0x3f21('0x47')](_0x3f21('0xc5'));loggerPredictive[_0x3f21('0x4c')](_0x11a95e[_0x3f21('0x49')],_0x3f21('0x1d6'),_0x11a95e[_0x3f21('0x24')]);clearInterval(_0x11a95e['handlePredictive']);_0x11a95e['handlePredictive']=undefined;hopperUtils[_0x3f21('0x1d7')](_0x11a95e[_0x3f21('0x1ce')])[_0x3f21('0x3f')](this['getDataPredictive'](_0x11a95e))[_0x3f21('0x3f')](mergeDataErlangB(_0x11a95e))['then'](this[_0x3f21('0x1d4')](_0x11a95e))[_0x3f21('0xa5')](loggerCatchPredictive(_0x3f21('0x1d8'),_0x11a95e));}else if(_0x11a95e['predictiveIntervalAvailable']&&_0x56aad3<_0x11a95e[_0x3f21('0x1c8')]-_0x29482b){clearPredictiveAttributes(_0x11a95e);loggerPredictive[_0x3f21('0x4c')](_0x11a95e['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x56aad3,_0x3f21('0x1d9'),_0x11a95e[_0x3f21('0x1c8')],'-',_0x29482b,'=',_0x11a95e[_0x3f21('0x1c8')]-_0x29482b,')');}else if(_0x11a95e['predictiveIntervalAvailable']&&_0x56aad3>_0x11a95e[_0x3f21('0x1c8')]+_0x3094b9){clearPredictiveAttributes(_0x11a95e);loggerPredictive[_0x3f21('0x4c')](_0x11a95e[_0x3f21('0x49')],_0x3f21('0x1da'),_0x56aad3,_0x3f21('0x1db'),_0x11a95e['predictiveIntervalAvailable'],'+',_0x3094b9,'=',_0x11a95e[_0x3f21('0x1c8')]+_0x3094b9,')');}};Dialer[_0x3f21('0x19')][_0x3f21('0x1d3')]=function(_0x3ce5af){var _0x1983aa=this;return function(_0x30af5a){return new Promise(function(_0x4f1655,_0x399cac){_[_0x3f21('0x61')](_0x3ce5af,_0x30af5a[0x0]);if(checkGetDataPredictive(_0x30af5a[0x0])){var _0x44b431=_0x3ce5af[_0x3f21('0x1c8')]=_0x3ce5af[_0x3f21('0x141')]+_0x3ce5af[_0x3f21('0x140')];var _0x185cfa=_0x3ce5af['dialPredictiveInterval']*0x3c;var _0x2198b9=_0x30af5a[0x0][_0x3f21('0x56')]+_0x30af5a[0x0][_0x3f21('0x54')];var _0x3ac604=(_0x30af5a[0x0][_0x3f21('0x51')]+_0x30af5a[0x0][_0x3f21('0xd1')]+_0x30af5a[0x0][_0x3f21('0x1dc')])/_0x30af5a[0x0][_0x3f21('0x4f')];_0x3ce5af[_0x3f21('0x1dd')]=_0x3ac604>0x0?_0x3ac604:0x1;switch(_0x3ce5af['dialPredictiveOptimization']){case _0x3f21('0x1d1'):var _0x1d4e54=_0x3ce5af['dialPredictiveOptimizationPercentage']/0x64;return _0x1983aa[_0x3f21('0x1de')](_0x44b431,_0x185cfa,_0x2198b9,_0x3ac604,_0x1d4e54)[_0x3f21('0x3f')](function(_0x1250b6){return _0x4f1655(_0x1250b6);});case'agentBusyFactor':var _0x4c2dc1=_0x3ce5af[_0x3f21('0x1c6')]/0x64;return _0x1983aa[_0x3f21('0x1df')](_0x44b431,_0x185cfa,_0x2198b9,_0x3ac604,_0x4c2dc1)[_0x3f21('0x3f')](function(_0x4dbcf1){return _0x4f1655(_0x4dbcf1);});default:return _0x399cac(msgResponse(_0x3f21('0x1e0'),_0x3f21('0x99'),'Unknown\x20Predictive'));}}else{return _0x399cac(msgResponse('[getDataPredictive]',_0x3f21('0x99'),'check\x20failure'));}});};};Dialer[_0x3f21('0x19')][_0x3f21('0x1e1')]=function(_0x19876b){var _0x37205c=this;return function(_0x54dfcb){return new Promise(function(_0x30fb53,_0x27df85){_[_0x3f21('0x61')](_0x19876b,_0x54dfcb[0x0]);if(checkGetDataPredictive(_0x54dfcb[0x0])){loggerPredictive[_0x3f21('0x4c')](JSON[_0x3f21('0x73')](_0x54dfcb[0x0]));if(_0x19876b[_0x3f21('0x1d0')]===_0x3f21('0x1d1')){return _0x37205c[_0x3f21('0x158')](_0x19876b['id'])[_0x3f21('0x3f')](function(_0x330aca){var _0x2e2751=_0x19876b[_0x3f21('0x1e2')]-_0x330aca[0x0][_0x3f21('0x1e3')];var _0x5294a2=_0x19876b['dialPredictiveInterval']*0x3c;var _0x22ddc7=_0x54dfcb[0x0][_0x3f21('0x56')]+_0x54dfcb[0x0][_0x3f21('0x54')];var _0x40a705=(_0x54dfcb[0x0][_0x3f21('0x51')]+_0x54dfcb[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x54dfcb[0x0][_0x3f21('0x1dc')])/_0x54dfcb[0x0][_0x3f21('0x4f')];var _0x4029a=_0x19876b[_0x3f21('0x1c6')]/0x64;_0x19876b[_0x3f21('0x1e4')]=_0x330aca[0x0][_0x3f21('0x1e3')]||0x0;_0x19876b[_0x3f21('0x1dd')]=_0x40a705>0x0?_0x40a705:0x1;return _0x37205c[_0x3f21('0x1de')](_0x2e2751,_0x5294a2,_0x22ddc7,_0x40a705,_0x4029a);})[_0x3f21('0x3f')](function(_0x3666a1){return _0x30fb53(_0x3666a1);})['catch'](function(_0xbed9a1){return _0x27df85(msgResponse('[CatchErlangB]',_0x3f21('0x99'),JSON[_0x3f21('0x73')](_0xbed9a1)));});}if(_0x19876b[_0x3f21('0x1d0')]==='agentBusyFactor'){return _0x37205c[_0x3f21('0x158')](_0x19876b['id'])[_0x3f21('0x3f')](function(_0x37029c){var _0x5edbc3=_0x19876b['loggedIn']-_0x37029c[0x0][_0x3f21('0x1e3')];var _0xfcfd7d=_0x19876b['dialPredictiveInterval']*0x3c;var _0x347674=_0x54dfcb[0x0]['predictiveIntervalAvgTalktime']+_0x54dfcb[0x0][_0x3f21('0x54')];var _0x543bc8=(_0x54dfcb[0x0][_0x3f21('0x51')]+_0x54dfcb[0x0][_0x3f21('0xd1')]+_0x54dfcb[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x54dfcb[0x0][_0x3f21('0x4f')];var _0x46e5ed=_0x19876b[_0x3f21('0x1c6')]/0x64;_0x19876b[_0x3f21('0x1e4')]=_0x37029c[0x0][_0x3f21('0x1e3')]||0x0;_0x19876b[_0x3f21('0x1dd')]=_0x543bc8>0x0?_0x543bc8:0x1;return _0x37205c['busyFactor'](_0x5edbc3,_0xfcfd7d,_0x347674,_0x543bc8,_0x46e5ed);})['then'](function(_0x3db584){return _0x30fb53(_0x3db584);})[_0x3f21('0xa5')](function(_0x299417){return _0x27df85(msgResponse(_0x3f21('0x1e5'),_0x3f21('0x99'),JSON[_0x3f21('0x73')](_0x299417)));});}}else{return _0x27df85(msgResponse(_0x3f21('0x1e0'),_0x3f21('0x99'),'check\x20failure'));}});};};Dialer[_0x3f21('0x19')][_0x3f21('0x1d4')]=function(_0x2d09d1){var _0x2fd646=this;return function(){var _0xb882b2=0x0;var _0x1eff30=Math[_0x3f21('0x1e6')](_0x2d09d1['erlangCallToSecond']*0x3e8);if(_0x1eff30>0x0){_0x1eff30=_0x1eff30<0x64?0x64:_0x1eff30;loggerPredictive['info'](_0x2d09d1[_0x3f21('0x49')],_0x3f21('0x1e7'),_0x1eff30,_0x3f21('0x1e8'));_0x2d09d1[_0x3f21('0x65')]=setInterval(function(){_0x2fd646[_0x3f21('0x65')](_0x2d09d1);loggerPredictiveCalls['info']('[handlePredictive]',_0xb882b2+=0x1);},_0x1eff30);}else{loggerPredictive[_0x3f21('0x4c')](_0x2d09d1[_0x3f21('0x49')],_0x3f21('0x1e9'));}};};Dialer[_0x3f21('0x19')][_0x3f21('0x1ea')]=function(_0x1faad4,_0x3dcb47){var _0x1a693a=this;return function(_0x1915f6){if(_[_0x3f21('0x4b')](_0x1915f6)){if(_[_0x3f21('0xf8')](_0x3dcb47['UserId'])||!_0x3dcb47[_0x3f21('0x1eb')]){if(_0x1faad4[_0x3f21('0xb2')]===_0x3f21('0xa')){_0x1faad4['queueStatusComplete']=_[_0x3f21('0x41')](_0x1faad4[_0x3f21('0x71')])?!![]:_0x1faad4[_0x3f21('0x71')];var _0x516d59=uuid['v4']();_0x1a693a[_0x3f21('0xf2')][_0x516d59]=new Action(_0x1faad4,_0x3dcb47,_0x516d59);loggerBooked[_0x3f21('0x4c')](_0x3f21('0x1ec'),_0x516d59,_0x3f21('0x1ed'),JSON[_0x3f21('0x73')](_0x1faad4[_0x3f21('0x71')]),_0x3f21('0x1ee'),_0x1faad4['name']);if(_0x1faad4[_0x3f21('0x71')]){_0x1faad4['queueStatusComplete']=![];_0x1a693a[_0x3f21('0x27')][_0x1a693a[_0x3f21('0xf2')][_0x516d59]['queue']]=[];ami[_0x3f21('0x9e')]({'actionid':_0x516d59,'action':_0x3f21('0x1ef'),'queue':_0x1faad4[_0x3f21('0x49')]})[_0x3f21('0xa5')](function(){_0x1a693a[_0x3f21('0xc3')](_0x1faad4);hopperUtils[_0x3f21('0xde')]({'active':![],'ContactId':_0x1a693a['actions'][_0x516d59]['ContactId'],'ListId':_0x1a693a['actions'][_0x516d59]['ListId'],'VoiceQueueId':_0x1a693a['actions'][_0x516d59]['VoiceQueueId']||undefined,'CampaignId':_0x1a693a[_0x3f21('0xf2')][_0x516d59][_0x3f21('0xe4')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1a693a[_0x3f21('0xf2')][_0x516d59];});}else{loggerBooked[_0x3f21('0x4c')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x1faad4[_0x3f21('0x71')]),_0x3f21('0x1ee'),_0x1faad4[_0x3f21('0x49')]);_0x1a693a[_0x3f21('0xc3')](_0x1faad4);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x1a693a['actions'][_0x516d59][_0x3f21('0xe1')],'ListId':_0x1a693a[_0x3f21('0xf2')][_0x516d59][_0x3f21('0xe2')],'VoiceQueueId':_0x1a693a[_0x3f21('0xf2')][_0x516d59][_0x3f21('0xe3')]||undefined,'CampaignId':_0x1a693a['actions'][_0x516d59]['CampaignId']||undefined})['catch'](loggerCatch(_0x3f21('0x1f0')));delete _0x1a693a[_0x3f21('0xf2')][_0x516d59];}}else{return _0x1a693a[_0x3f21('0x163')](_0x1faad4,_0x3dcb47);}}else{if(utils['getSeconds'](undefined,_0x3dcb47[_0x3f21('0x1f1')])<_0x1faad4[_0x3f21('0x1f2')]*0x3c){if(_0x3dcb47[_0x3f21('0x14e')]&&!_0x3dcb47[_0x3f21('0x14e')][_0x3f21('0x1f3')]){_0x1a693a[_0x3f21('0x1d')][_0x3f21('0x106')](_0x3dcb47['id'])[_0x3f21('0x1b')](function(){_0x1a693a[_0x3f21('0xc3')](_0x1faad4);});}else{hopperUtils[_0x3f21('0x1f4')]({'active':![]},_0x3dcb47['id'],0x1)[_0x3f21('0x1b')](function(){_0x1a693a['updateOriginated'](_0x1faad4);});}}else{_0x1faad4[_0x3f21('0x1f5')]+=0x1;_0x1a693a[_0x3f21('0xc3')](_0x1faad4);if(_0x1faad4[_0x3f21('0x1f6')]){hopperUtils[_0x3f21('0xde')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3dcb47['ContactId'],'ListId':_0x3dcb47[_0x3f21('0xe2')],'VoiceQueueId':_0x3dcb47[_0x3f21('0xe3')]||undefined,'CampaignId':_0x3dcb47['CampaignId']||undefined})[_0x3f21('0xa5')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x3f21('0xca')](createObjHistory(_0x1faad4,_0x3dcb47,utils[_0x3f21('0x6a')][_0x3f21('0x1f7')],0x17,_0x3f21('0x1f8')))['catch'](loggerCatch(_0x3f21('0x1f9')));}else{_0x1a693a[_0x3f21('0x11b')](createObjHistory(_0x1faad4,_0x3dcb47,utils[_0x3f21('0x6a')]['RECALL_TIMEOUT'],0x16,_0x3f21('0x1fa')),_0x3f21('0x1fb'),_0x3f21('0x1fc'));}}}}else{_0x1faad4['outboundBlacklistCallsDay']+=0x1;_0x1a693a[_0x3f21('0x11b')](createObjHistory(_0x1faad4,_0x3dcb47,utils[_0x3f21('0x6a')][_0x3f21('0x1fd')],0xd,'Blacklist'),_0x3f21('0x1fe'),_0x3f21('0x1ff'));throw _0x3f21('0x200');}};};Dialer[_0x3f21('0x19')]['handleIvr']=function(_0x22d864){var _0x334d3d=this;var _0x2722e7=_0x22d864[_0x3f21('0x201')]-_0x22d864[_0x3f21('0x7e')];emitCampaignSummary(_0x22d864);if(_0x2722e7>0x0&&_0x22d864[_0x3f21('0x68')]==0x0){if(_0x2722e7>this[_0x3f21('0x202')]){_0x2722e7=this[_0x3f21('0x202')];}_0x22d864['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x22d864,_0x2722e7)[_0x3f21('0x3f')](function(_0x31fb0a){_0x22d864[_0x3f21('0x68')]=0x0;if(_0x31fb0a){if(!utils['checkContactEmpty'](_0x31fb0a)){_0x22d864['message']=utils[_0x3f21('0x6a')][_0x3f21('0x203')];logger['info'](_0x3f21('0x204')+_0x22d864[_0x3f21('0x49')]);}else{_0x22d864[_0x3f21('0x7e')]+=_0x31fb0a['length'];_0x22d864['message']=utils[_0x3f21('0x6a')][_0x3f21('0x205')];for(var _0x2f523c=0x0;_0x2f523c<_0x31fb0a[_0x3f21('0x9c')];_0x2f523c+=0x1){_0x22d864[_0x3f21('0x206')]+=0x1;if(_['isNil'](_0x31fb0a[_0x2f523c])||_[_0x3f21('0xf8')](_0x31fb0a[_0x2f523c][_0x3f21('0x180')])||_['isNil'](_0x31fb0a[_0x2f523c]['phone'])){_0x334d3d[_0x3f21('0x15c')](_0x3f21('0x207'),_0x22d864,_0x31fb0a[_0x2f523c]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x3f21('0x104')](_0x31fb0a[_0x2f523c],[_0x3f21('0xe4'),_0x3f21('0x166')]))[_0x3f21('0x3f')](_0x334d3d[_0x3f21('0x1ea')](_0x22d864,_0x31fb0a[_0x2f523c]))[_0x3f21('0xa5')](_0x334d3d[_0x3f21('0x15b')](_0x3f21('0x208'),_0x22d864));}}}}})[_0x3f21('0xa5')](loggerGetContactDialer(_0x3f21('0x209'),_0x22d864,_0x2722e7));}};Dialer['prototype'][_0x3f21('0xb4')]=function(_0x48f24e,_0x5cb258){var _0x404769=this;var _0x1fb02c=[];if(_0x5cb258<0x1||_0x48f24e['dialMethod']===_0x3f21('0xa')){_0x5cb258=0x1;}var _0x193ded=Math['floor'](_0x48f24e[_0x3f21('0x140')]*_0x5cb258)-_0x48f24e[_0x3f21('0x7e')];if(_0x48f24e[_0x3f21('0x20a')]>0x0){var _0x247858=_0x48f24e['dialLimitQueue']-_0x48f24e[_0x3f21('0x7e')]-_0x48f24e[_0x3f21('0x141')]-_0x48f24e['pTalking'];if(_0x193ded>_0x247858){_0x193ded=_0x247858;}}if(_0x193ded>0x0&&_0x48f24e[_0x3f21('0x68')]==0x0){if(_0x48f24e[_0x3f21('0xb2')]===_0x3f21('0xa')){_0x193ded=0x1;}if(_0x193ded>this[_0x3f21('0x202')]){_0x193ded=this[_0x3f21('0x202')];}for(var _0x1e57ec in this['agents']){if(typeof this[_0x3f21('0xfa')][_0x1e57ec]!==_0x3f21('0xac')){if(this[_0x3f21('0xfa')][_0x1e57ec]['state']===_0x3f21('0x20b')&&this[_0x3f21('0xfa')][_0x1e57ec]['status']==='reachable'){_0x1fb02c[_0x3f21('0x9d')](this[_0x3f21('0xfa')][_0x1e57ec]['id']);}}}_0x48f24e[_0x3f21('0x68')]=0x1;hopperUtils[_0x3f21('0x20c')](_0x48f24e,_0x1fb02c,_0x193ded)['then'](function(_0x5946e7){_0x48f24e['temp']=0x0;if(_0x5946e7){if(!utils[_0x3f21('0x20d')](_0x5946e7)){hopperUtils[_0x3f21('0x20e')](_0x48f24e)['then'](sendMessageReschedule(_0x48f24e))[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x20f')));}else{_0x48f24e[_0x3f21('0x7e')]+=_0x5946e7['length'];_0x48f24e[_0x3f21('0x6d')]=_0x48f24e[_0x3f21('0xb2')]===_0x3f21('0xa')?utils[_0x3f21('0x6a')][_0x3f21('0x143')]:utils['CAMPAIGN_STATUS'][_0x3f21('0x205')];for(var _0x17ba30=0x0;_0x17ba30<_0x5946e7[_0x3f21('0x9c')];_0x17ba30+=0x1){if(_['isNil'](_0x5946e7[_0x17ba30])||_[_0x3f21('0xf8')](_0x5946e7[_0x17ba30][_0x3f21('0x180')])||_['isNil'](_0x5946e7[_0x17ba30][_0x3f21('0x166')])){_0x404769[_0x3f21('0x15c')](_0x3f21('0x207'),_0x48f24e,_0x5946e7[_0x17ba30]);}else{hopperUtils[_0x3f21('0x210')](_[_0x3f21('0x104')](_0x5946e7[_0x17ba30],[_0x3f21('0xe3'),_0x3f21('0x166')]))[_0x3f21('0x3f')](_0x404769[_0x3f21('0x1ea')](_0x48f24e,_0x5946e7[_0x17ba30]))[_0x3f21('0xa5')](_0x404769[_0x3f21('0x15b')](_0x3f21('0x207'),_0x48f24e));}}}}})[_0x3f21('0xa5')](loggerGetContactDialer(_0x3f21('0x211'),_0x48f24e,_0x193ded));}};Dialer[_0x3f21('0x19')][_0x3f21('0x65')]=function(_0x3fd98d){if(_0x3fd98d[_0x3f21('0x20a')]>0x0){var _0x1b80b3=_0x3fd98d[_0x3f21('0x20a')]-_0x3fd98d[_0x3f21('0x7e')]-_0x3fd98d[_0x3f21('0x141')];if(_0x1b80b3>0x0&&_0x3fd98d['temp']==0x0){this[_0x3f21('0x212')](_0x3fd98d);}else{loggerPredictiveCalls[_0x3f21('0x4c')](_0x3f21('0x213'));}}else{this[_0x3f21('0x212')](_0x3fd98d);}};Dialer['prototype'][_0x3f21('0x212')]=function(_0xc79240){var _0x5023a2=this;var _0x4aefa4=[];_0xc79240[_0x3f21('0x7e')]+=0x1;for(var _0xe13e1f in this['agents']){if(typeof this['agents'][_0xe13e1f]!==_0x3f21('0xac')){if(this[_0x3f21('0xfa')][_0xe13e1f][_0x3f21('0xe6')]===_0x3f21('0x20b')&&this[_0x3f21('0xfa')][_0xe13e1f][_0x3f21('0x88')]===_0x3f21('0x89')){_0x4aefa4[_0x3f21('0x9d')](this[_0x3f21('0xfa')][_0xe13e1f]['id']);}}}_0xc79240[_0x3f21('0x68')]=0x1;return this['getContactDialer'](_0xc79240['id'],_0x4aefa4,0x1,_0xc79240[_0x3f21('0x214')],_0xc79240)[_0x3f21('0x3f')](function(_0x5d7e73){_0xc79240[_0x3f21('0x68')]=0x1;if(_0x5d7e73){if(!utils[_0x3f21('0x20d')](_0x5d7e73)){utils[_0x3f21('0x67')](_0xc79240,0x1,0x0);return hopperUtils[_0x3f21('0x20e')](_0xc79240)[_0x3f21('0x3f')](sendMessageReschedule(_0xc79240))[_0x3f21('0xa5')](loggerCatch(_0x3f21('0x20f')));}else{_0xc79240[_0x3f21('0x6d')]=utils[_0x3f21('0x6a')][_0x3f21('0x205')];if(_[_0x3f21('0xf8')](_0x5d7e73[0x0])||_[_0x3f21('0xf8')](_0x5d7e73[0x0][_0x3f21('0x180')])||_[_0x3f21('0xf8')](_0x5d7e73[0x0][_0x3f21('0x166')])){_0x5023a2[_0x3f21('0x15c')](_0x3f21('0x207'),_0xc79240,_0x5d7e73[0x0]);}else{return hopperUtils[_0x3f21('0x210')](_[_0x3f21('0x104')](_0x5d7e73[0x0],[_0x3f21('0xe3'),_0x3f21('0x166')]))[_0x3f21('0x3f')](_0x5023a2[_0x3f21('0x1ea')](_0xc79240,_0x5d7e73[0x0]))[_0x3f21('0xa5')](_0x5023a2['loggerHandler'](_0x3f21('0x215'),_0xc79240));}}}})[_0x3f21('0xa5')](loggerGetContactDialer('[getContactDialerPredictive]',_0xc79240,0x1));};Dialer[_0x3f21('0x19')][_0x3f21('0x1de')]=function(_0x1c9868,_0x35b1e4,_0x12604d,_0x4ed373,_0x28e606,_0x3e9583){loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x216'));loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x217'),_0x1c9868);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x218'),_0x35b1e4);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x219'),_0x12604d);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x21a'),_0x4ed373);loggerPredictive['info'](_0x3f21('0x21b'),_0x28e606);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x57'));return new Promise(function(_0x5d8baf,_0x5e0237){if(_0x1c9868<=0x0||isNaN(_0x1c9868)){return _0x5e0237(msgResponse(_0x3f21('0x21c'),_0x3f21('0xbf'),'m\x20=\x20'+_0x1c9868));}if(_0x12604d<=0x0||isNaN(_0x12604d)){return _0x5e0237(msgResponse('[abandonmentRate]',_0x3f21('0xbf'),_0x3f21('0x21d')+_0x12604d));}if(_0x4ed373<=0x0||isNaN(_0x4ed373)){return _0x5e0237(msgResponse(_0x3f21('0x21c'),_0x3f21('0xbf'),_0x3f21('0x21e')+_0x4ed373));}if(_0x35b1e4<=0x0||isNaN(_0x35b1e4)){return _0x5e0237(msgResponse(_0x3f21('0x21c'),_0x3f21('0xbf'),'interval\x20=\x20'+_0x35b1e4));}if(_0x28e606<=0x0||isNaN(_0x28e606)){return _0x5e0237(msgResponse(_0x3f21('0x21c'),_0x3f21('0xbf'),'Amax\x20=\x20'+_0x28e606));}_0x3e9583=_0x3e9583||0x0;var _0x5f2aa0=0x1/_0x12604d;var _0x47c427=0x0;var _0x59e75d=0x0;var _0x574125=0x0;var _0x469ccb=0x0;for(var _0x4c4b9f=0x0;_0x574125<_0x28e606;_0x4c4b9f+=0x1){_0x59e75d=_0x4c4b9f/_0x35b1e4;_0x47c427=(_0x4ed373*_0x59e75d+_0x3e9583)/_0x5f2aa0;_0x574125=utils[_0x3f21('0x21f')](_0x47c427,_0x1c9868);_0x469ccb=_0x47c427/_0x1c9868*(0x1-utils[_0x3f21('0x21f')](_0x47c427,_0x1c9868));}return _0x5d8baf({'erlangCalls':_0x4c4b9f,'erlangCallToSecond':_0x35b1e4/_0x4c4b9f,'erlangAbandonmentRate':_0x574125,'erlangBusyFactor':_0x469ccb});});};Dialer[_0x3f21('0x19')][_0x3f21('0x1df')]=function(_0x5e4013,_0x42963d,_0x1d5848,_0x44acb1,_0x2e034b,_0x5322a3){loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x220'));loggerPredictive[_0x3f21('0x4c')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e4013);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x218'),_0x42963d);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x219'),_0x1d5848);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x21a'),_0x44acb1);loggerPredictive['info'](_0x3f21('0x221'),_0x2e034b);loggerPredictive[_0x3f21('0x4c')](_0x3f21('0x57'));return new Promise(function(_0x370f3a,_0x1712f3){if(_0x5e4013<=0x0||isNaN(_0x5e4013)){return _0x1712f3(msgResponse('[busyFactor]',_0x3f21('0xbf'),_0x3f21('0x222')+_0x5e4013));}if(_0x1d5848<=0x0||isNaN(_0x1d5848)){return _0x1712f3(msgResponse(_0x3f21('0x223'),_0x3f21('0xbf'),_0x3f21('0x21d')+_0x1d5848));}if(_0x44acb1<=0x0||isNaN(_0x44acb1)){return _0x1712f3(msgResponse('[busyFactor]','Error',_0x3f21('0x21e')+_0x44acb1));}if(_0x42963d<=0x0||isNaN(_0x42963d)){return _0x1712f3(msgResponse(_0x3f21('0x223'),_0x3f21('0xbf'),_0x3f21('0x224')+_0x42963d));}if(_0x2e034b<=0x0||isNaN(_0x2e034b)){return _0x1712f3(msgResponse(_0x3f21('0x223'),_0x3f21('0xbf'),_0x3f21('0x225')+_0x2e034b));}_0x5322a3=_0x5322a3||0x0;var _0x2015a0=0x1/_0x1d5848;var _0x19b504=0x0;var _0x16397a=0x0;var _0x2dd3d3=0x0;var _0x5407c8=0x0;for(var _0x2b0119=0x0;_0x5407c8<_0x2e034b;_0x2b0119+=0x1){_0x16397a=_0x2b0119/_0x42963d;_0x19b504=(_0x44acb1*_0x16397a+_0x5322a3)/_0x2015a0;_0x2dd3d3=utils[_0x3f21('0x21f')](_0x19b504,_0x5e4013);_0x5407c8=_0x19b504/_0x5e4013*(0x1-utils[_0x3f21('0x21f')](_0x19b504,_0x5e4013));}return _0x370f3a({'erlangCalls':_0x2b0119,'erlangCallToSecond':_0x42963d/_0x2b0119,'erlangAbandonmentRate':_0x2dd3d3,'erlangBusyFactor':_0x5407c8});});};module[_0x3f21('0x226')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index e1a10e8..6b0335a 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc4a=['VoiceQueueId','CampaignId','idHopper','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','substring','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x484bf4,_0x2b975c){var _0x31c683=function(_0x1cdda2){while(--_0x1cdda2){_0x484bf4['push'](_0x484bf4['shift']());}};_0x31c683(++_0x2b975c);}(_0xfc4a,0x18a));var _0xafc4=function(_0x25fd4c,_0x69a1a3){_0x25fd4c=_0x25fd4c-0x0;var _0x51bfd5=_0xfc4a[_0x25fd4c];return _0x51bfd5;};'use strict';var util=require('util');var _=require(_0xafc4('0x0'));var moment=require(_0xafc4('0x1'));function checkNameSurname(_0x5ebd90,_0xab449d,_0x557ca3){var _0x17bec0='';if(!_[_0xafc4('0x2')](_0xab449d)&&_0xafc4('0x3')===typeof _0xab449d){_0x17bec0+=_0xab449d;}if(!_['isNil'](_0x557ca3)&&_0xafc4('0x3')===typeof _0x557ca3){_0x17bec0+='\x20'+_0x557ca3;}if(_0x17bec0!==''){return _0x17bec0;}return _0x5ebd90;}function Action(_0x5e5db6,_0x3fff00,_0x18d1e0){this[_0xafc4('0x4')]=_0x5e5db6;this[_0xafc4('0x5')]=_0x18d1e0||undefined;this[_0xafc4('0x6')]=checkNameSurname(_0x3fff00['Contact'][_0xafc4('0x7')],_0x3fff00[_0xafc4('0x8')]['firstName'],_0x3fff00[_0xafc4('0x8')][_0xafc4('0x9')]);this[_0xafc4('0xa')]=_0x3fff00[_0xafc4('0x7')];this['queue']=_0x5e5db6[_0xafc4('0x6')];this[_0xafc4('0xb')]=_0x3fff00[_0xafc4('0xb')]||![];this[_0xafc4('0xc')]=_0x5e5db6[_0xafc4('0xc')];this[_0xafc4('0xd')]=_0x5e5db6[_0xafc4('0xd')]||0x3;this[_0xafc4('0xe')]=_0x3fff00[_0xafc4('0xe')];this[_0xafc4('0xf')]=_0x3fff00['countbusyretry'];this[_0xafc4('0x10')]=_0x3fff00['countcongestionretry'];this[_0xafc4('0x11')]=_0x3fff00[_0xafc4('0x11')];this[_0xafc4('0x12')]=_0x3fff00[_0xafc4('0x12')];this[_0xafc4('0x13')]=_0x3fff00[_0xafc4('0x13')];this['countabandonedretry']=_0x3fff00[_0xafc4('0x14')];this[_0xafc4('0x15')]=_0x3fff00[_0xafc4('0x15')];this[_0xafc4('0x16')]=_0x3fff00[_0xafc4('0x16')];this['ContactId']=_0x3fff00[_0xafc4('0x17')];this['ListId']=_0x3fff00[_0xafc4('0x18')];this[_0xafc4('0x19')]=_0x3fff00[_0xafc4('0x19')];this[_0xafc4('0x1a')]=_0x3fff00[_0xafc4('0x1a')];this[_0xafc4('0x1b')]=_0x3fff00[_0xafc4('0x1b')];this[_0xafc4('0x1c')]=_0x3fff00['id'];this['ContactFirstName']=_0x3fff00[_0xafc4('0x8')][_0xafc4('0x1d')]||'';this['starttime']=moment()[_0xafc4('0x1e')](_0xafc4('0x1f'));this[_0xafc4('0x20')]=_0x3fff00[_0xafc4('0x20')];this['callbackuniqueid']=_0x3fff00[_0xafc4('0x21')];this['callbackat']=_0x3fff00[_0xafc4('0x22')];this[_0xafc4('0x23')]=_0x3fff00['recallme'];this[_0xafc4('0x24')]='';this['originatecalleridname']='';}Action[_0xafc4('0x25')][_0xafc4('0x26')]=function(){return util[_0xafc4('0x1e')](_0xafc4('0x27'),this['name'],this[_0xafc4('0x4')]['dialCutDigit']>0x0?this[_0xafc4('0xa')][_0xafc4('0x28')](this['voiceQueue']['dialCutDigit']):this[_0xafc4('0xa')]);};Action[_0xafc4('0x25')]['getQueue']=function(){return this['queue'];};module[_0xafc4('0x29')]=Action; \ No newline at end of file +var _0x4d95=['\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','format'];(function(_0x45423e,_0x4cc862){var _0x3157c1=function(_0x5ddce4){while(--_0x5ddce4){_0x45423e['push'](_0x45423e['shift']());}};_0x3157c1(++_0x4cc862);}(_0x4d95,0x1f0));var _0x54d9=function(_0x44ec4a,_0x41cae8){_0x44ec4a=_0x44ec4a-0x0;var _0x1f9f8f=_0x4d95[_0x44ec4a];return _0x1f9f8f;};'use strict';var util=require(_0x54d9('0x0'));var _=require(_0x54d9('0x1'));var moment=require('moment');function checkNameSurname(_0x2c224a,_0x4981f9,_0x5dc042){var _0x16e183='';if(!_['isNil'](_0x4981f9)&&'string'===typeof _0x4981f9){_0x16e183+=_0x4981f9;}if(!_[_0x54d9('0x2')](_0x5dc042)&&_0x54d9('0x3')===typeof _0x5dc042){_0x16e183+='\x20'+_0x5dc042;}if(_0x16e183!==''){return _0x16e183;}return _0x2c224a;}function Action(_0x37acbd,_0x5628d9,_0x22ae5d){this[_0x54d9('0x4')]=_0x37acbd;this[_0x54d9('0x5')]=_0x22ae5d||undefined;this[_0x54d9('0x6')]=checkNameSurname(_0x5628d9[_0x54d9('0x7')]['phone'],_0x5628d9['Contact']['firstName'],_0x5628d9[_0x54d9('0x7')]['lastName']);this[_0x54d9('0x8')]=_0x5628d9['phone'];this[_0x54d9('0x9')]=_0x37acbd['name'];this['active']=_0x5628d9[_0x54d9('0xa')]||![];this[_0x54d9('0xb')]=_0x37acbd['type'];this['dialQueueTimeout']=_0x37acbd[_0x54d9('0xc')]||0x3;this[_0x54d9('0xd')]=_0x5628d9[_0x54d9('0xd')];this[_0x54d9('0xe')]=_0x5628d9[_0x54d9('0xe')];this[_0x54d9('0xf')]=_0x5628d9[_0x54d9('0xf')];this[_0x54d9('0x10')]=_0x5628d9['countnoanswerretry'];this[_0x54d9('0x11')]=_0x5628d9[_0x54d9('0x11')];this['countdropretry']=_0x5628d9[_0x54d9('0x12')];this['countabandonedretry']=_0x5628d9[_0x54d9('0x13')];this['countmachineretry']=_0x5628d9[_0x54d9('0x14')];this[_0x54d9('0x15')]=_0x5628d9['countagentrejectretry'];this[_0x54d9('0x16')]=_0x5628d9[_0x54d9('0x16')];this[_0x54d9('0x17')]=_0x5628d9[_0x54d9('0x17')];this[_0x54d9('0x18')]=_0x5628d9[_0x54d9('0x18')];this[_0x54d9('0x19')]=_0x5628d9['VoiceQueueId'];this['CampaignId']=_0x5628d9['CampaignId'];this[_0x54d9('0x1a')]=_0x5628d9['id'];this[_0x54d9('0x1b')]=_0x5628d9['Contact']['firstName']||'';this['starttime']=moment()['format'](_0x54d9('0x1c'));this[_0x54d9('0x1d')]=_0x5628d9[_0x54d9('0x1d')];this['callbackuniqueid']=_0x5628d9[_0x54d9('0x1e')];this[_0x54d9('0x1f')]=_0x5628d9[_0x54d9('0x1f')];this[_0x54d9('0x20')]=_0x5628d9[_0x54d9('0x20')];this[_0x54d9('0x21')]='';this['originatecalleridname']='';}Action[_0x54d9('0x22')][_0x54d9('0x23')]=function(){return util[_0x54d9('0x24')](_0x54d9('0x25'),this[_0x54d9('0x6')],this[_0x54d9('0x4')][_0x54d9('0x26')]>0x0?this[_0x54d9('0x8')]['substring'](this[_0x54d9('0x4')][_0x54d9('0x26')]):this[_0x54d9('0x8')]);};Action[_0x54d9('0x22')][_0x54d9('0x27')]=function(){return this[_0x54d9('0x9')];};module[_0x54d9('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index ebf6dd2..14e1148 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89eb=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','ringtime','getSeconds','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x1c26d1,_0x3b247b){var _0x10fdb7=function(_0x4dbe30){while(--_0x4dbe30){_0x1c26d1['push'](_0x1c26d1['shift']());}};_0x10fdb7(++_0x3b247b);}(_0x89eb,0x181));var _0xb89e=function(_0x5c93cd,_0x1da315){_0x5c93cd=_0x5c93cd-0x0;var _0x563412=_0x89eb[_0x5c93cd];return _0x563412;};'use strict';var moment=require(_0xb89e('0x0'));var utils=require(_0xb89e('0x1'));function AgentComplete(_0x329e40,_0x29cff8){this[_0xb89e('0x2')]=0x4;this[_0xb89e('0x3')]='Answer';this[_0xb89e('0x4')]=_0x329e40[_0xb89e('0x4')];this['type']=_0x329e40[_0xb89e('0x5')];this['campaigntype']=_0x329e40[_0xb89e('0x5')]==='outbound'?'queue':_0x329e40[_0xb89e('0x5')];this[_0xb89e('0x6')]=_0x329e40['countbusyretry'];this[_0xb89e('0x7')]=_0x329e40[_0xb89e('0x7')];this['countnoanswerretry']=_0x329e40[_0xb89e('0x8')];this[_0xb89e('0x9')]=_0x329e40[_0xb89e('0x6')]+_0x329e40[_0xb89e('0x7')]+_0x329e40[_0xb89e('0x8')]+_0x329e40[_0xb89e('0xa')]+_0x329e40[_0xb89e('0xb')]+_0x329e40[_0xb89e('0xc')]+_0x329e40[_0xb89e('0xd')]+_0x329e40[_0xb89e('0xe')];this[_0xb89e('0xa')]=_0x329e40['countnosuchnumberretry'];this[_0xb89e('0xb')]=_0x329e40['countdropretry'];this[_0xb89e('0xc')]=_0x329e40[_0xb89e('0xc')];this[_0xb89e('0xd')]=_0x329e40[_0xb89e('0xd')];this[_0xb89e('0xe')]=_0x329e40[_0xb89e('0xe')];this['uniqueid']=_0x29cff8['uniqueid'];this[_0xb89e('0xf')]=_0x329e40[_0xb89e('0x10')];this[_0xb89e('0x11')]=_0x329e40[_0xb89e('0x12')];this[_0xb89e('0x13')]=_0x329e40[_0xb89e('0x13')];this['responsetime']=_0x329e40[_0xb89e('0x14')];this[_0xb89e('0x15')]=_0x329e40[_0xb89e('0x15')];this['endtime']=moment()[_0xb89e('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb89e('0x17')]=utils[_0xb89e('0x18')](_0x329e40['responsetime'],_0x329e40['starttime']);this['holdtime']=utils[_0xb89e('0x18')](_0x329e40[_0xb89e('0x15')],_0x329e40[_0xb89e('0x14')]);this['talktime']=utils[_0xb89e('0x18')](this[_0xb89e('0x19')],_0x329e40[_0xb89e('0x15')]);this[_0xb89e('0x1a')]=_0x29cff8[_0xb89e('0x1a')];this[_0xb89e('0x1b')]=_0x29cff8[_0xb89e('0x1b')];this['reason']=_0x29cff8[_0xb89e('0x1c')];this[_0xb89e('0x1d')]=_0x329e40[_0xb89e('0x1d')];this[_0xb89e('0x1e')]=_0x329e40[_0xb89e('0x1e')];this[_0xb89e('0x1f')]=_0x329e40['callbackat'];this[_0xb89e('0x20')]=_0x329e40[_0xb89e('0x20')];this[_0xb89e('0x21')]=_0x329e40['ContactId'];this[_0xb89e('0x22')]=_0x329e40[_0xb89e('0x22')];this['UserId']=_0x329e40[_0xb89e('0x23')];this[_0xb89e('0x24')]=_0x329e40[_0xb89e('0x24')];this[_0xb89e('0x25')]=_0x329e40[_0xb89e('0x25')];this['originatecalleridnum']=_0x329e40[_0xb89e('0x26')]||'';this[_0xb89e('0x27')]=_0x329e40[_0xb89e('0x27')]||'';this['agiafterat']=_0x329e40[_0xb89e('0x28')];}module[_0xb89e('0x29')]=AgentComplete; \ No newline at end of file +var _0xb994=['scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','getSeconds','holdtime','endtime','queue','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','Answer'];(function(_0x52ae1d,_0x32366d){var _0x13703a=function(_0x318d2f){while(--_0x318d2f){_0x52ae1d['push'](_0x52ae1d['shift']());}};_0x13703a(++_0x32366d);}(_0xb994,0x79));var _0x4b99=function(_0x12d573,_0x20ae28){_0x12d573=_0x12d573-0x0;var _0x5c7071=_0xb994[_0x12d573];return _0x5c7071;};'use strict';var moment=require(_0x4b99('0x0'));var utils=require(_0x4b99('0x1'));function AgentComplete(_0x3a400f,_0x8902cd){this[_0x4b99('0x2')]=0x4;this[_0x4b99('0x3')]=_0x4b99('0x4');this[_0x4b99('0x5')]=_0x3a400f[_0x4b99('0x5')];this[_0x4b99('0x6')]=_0x3a400f['type'];this[_0x4b99('0x7')]=_0x3a400f[_0x4b99('0x6')]===_0x4b99('0x8')?'queue':_0x3a400f[_0x4b99('0x6')];this[_0x4b99('0x9')]=_0x3a400f[_0x4b99('0x9')];this['countcongestionretry']=_0x3a400f['countcongestionretry'];this['countnoanswerretry']=_0x3a400f[_0x4b99('0xa')];this[_0x4b99('0xb')]=_0x3a400f[_0x4b99('0x9')]+_0x3a400f[_0x4b99('0xc')]+_0x3a400f[_0x4b99('0xa')]+_0x3a400f[_0x4b99('0xd')]+_0x3a400f[_0x4b99('0xe')]+_0x3a400f['countabandonedretry']+_0x3a400f[_0x4b99('0xf')]+_0x3a400f[_0x4b99('0x10')];this['countnosuchnumberretry']=_0x3a400f['countnosuchnumberretry'];this['countdropretry']=_0x3a400f[_0x4b99('0xe')];this[_0x4b99('0x11')]=_0x3a400f[_0x4b99('0x11')];this[_0x4b99('0xf')]=_0x3a400f['countmachineretry'];this[_0x4b99('0x10')]=_0x3a400f[_0x4b99('0x10')];this[_0x4b99('0x12')]=_0x8902cd[_0x4b99('0x12')];this[_0x4b99('0x13')]=_0x3a400f[_0x4b99('0x14')];this['calleridnum']=_0x3a400f[_0x4b99('0x15')];this['starttime']=_0x3a400f[_0x4b99('0x16')];this[_0x4b99('0x17')]=_0x3a400f[_0x4b99('0x17')];this[_0x4b99('0x18')]=_0x3a400f['answertime'];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0x4b99('0x19')](_0x3a400f[_0x4b99('0x17')],_0x3a400f['starttime']);this[_0x4b99('0x1a')]=utils[_0x4b99('0x19')](_0x3a400f[_0x4b99('0x18')],_0x3a400f['responsetime']);this['talktime']=utils[_0x4b99('0x19')](this[_0x4b99('0x1b')],_0x3a400f[_0x4b99('0x18')]);this[_0x4b99('0x1c')]=_0x8902cd[_0x4b99('0x1c')];this[_0x4b99('0x1d')]=_0x8902cd[_0x4b99('0x1d')];this[_0x4b99('0x1e')]=_0x8902cd[_0x4b99('0x1e')];this[_0x4b99('0x1f')]=_0x3a400f[_0x4b99('0x1f')];this[_0x4b99('0x20')]=_0x3a400f[_0x4b99('0x20')];this['callbackat']=_0x3a400f['callbackat'];this[_0x4b99('0x21')]=_0x3a400f[_0x4b99('0x21')];this[_0x4b99('0x22')]=_0x3a400f[_0x4b99('0x22')];this['ListId']=_0x3a400f[_0x4b99('0x23')];this['UserId']=_0x3a400f[_0x4b99('0x24')];this[_0x4b99('0x25')]=_0x3a400f['VoiceQueueId'];this[_0x4b99('0x26')]=_0x3a400f[_0x4b99('0x26')];this[_0x4b99('0x27')]=_0x3a400f[_0x4b99('0x27')]||'';this[_0x4b99('0x28')]=_0x3a400f[_0x4b99('0x28')]||'';this[_0x4b99('0x29')]=_0x3a400f[_0x4b99('0x29')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 17c04a3..6afb9bb 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65bc=['calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname'];(function(_0x5d180a,_0x403fba){var _0x3089eb=function(_0x4d76bd){while(--_0x4d76bd){_0x5d180a['push'](_0x5d180a['shift']());}};_0x3089eb(++_0x403fba);}(_0x65bc,0x173));var _0xc65b=function(_0x9fe643,_0x8622b4){_0x9fe643=_0x9fe643-0x0;var _0x41800d=_0x65bc[_0x9fe643];return _0x41800d;};'use strict';function Final(_0x2e8e50){this[_0xc65b('0x0')]=_0x2e8e50[_0xc65b('0x0')];this[_0xc65b('0x1')]=_0x2e8e50[_0xc65b('0x1')];this[_0xc65b('0x2')]=_0x2e8e50[_0xc65b('0x2')];this['campaigntype']=_0x2e8e50[_0xc65b('0x2')]==='outbound'?_0xc65b('0x3'):_0x2e8e50[_0xc65b('0x2')];this[_0xc65b('0x4')]=_0x2e8e50[_0xc65b('0x4')];this[_0xc65b('0x5')]=_0x2e8e50[_0xc65b('0x5')];this[_0xc65b('0x6')]=_0x2e8e50['countnoanswerretry'];this[_0xc65b('0x7')]=_0x2e8e50[_0xc65b('0x4')]+_0x2e8e50['countcongestionretry']+_0x2e8e50[_0xc65b('0x6')]+_0x2e8e50[_0xc65b('0x8')]+_0x2e8e50['countdropretry']+_0x2e8e50['countabandonedretry']+_0x2e8e50[_0xc65b('0x9')]+_0x2e8e50[_0xc65b('0xa')];this[_0xc65b('0x8')]=_0x2e8e50[_0xc65b('0x8')];this['countdropretry']=_0x2e8e50[_0xc65b('0xb')];this[_0xc65b('0xc')]=_0x2e8e50[_0xc65b('0xc')];this['countmachineretry']=_0x2e8e50[_0xc65b('0x9')];this[_0xc65b('0xa')]=_0x2e8e50[_0xc65b('0xa')];this[_0xc65b('0x3')]=_0x2e8e50[_0xc65b('0x3')];this['calleridname']=_0x2e8e50[_0xc65b('0xd')];this[_0xc65b('0xe')]=_0x2e8e50[_0xc65b('0xe')];this[_0xc65b('0xf')]=_0x2e8e50['starttime'];this['responsetime']=_0x2e8e50[_0xc65b('0x10')];this[_0xc65b('0x11')]=_0x2e8e50[_0xc65b('0x10')];this['ringtime']=_0x2e8e50[_0xc65b('0x12')]||0x0;this[_0xc65b('0x13')]=_0x2e8e50['holdtime']||0x0;this[_0xc65b('0x14')]=_0x2e8e50[_0xc65b('0x14')]||0x0;this[_0xc65b('0x15')]=_0x2e8e50['callback'];this[_0xc65b('0x16')]=_0x2e8e50[_0xc65b('0x16')];this[_0xc65b('0x17')]=_0x2e8e50[_0xc65b('0x17')];this[_0xc65b('0x18')]=_0x2e8e50[_0xc65b('0x18')];this[_0xc65b('0x19')]=_0x2e8e50[_0xc65b('0x19')];this[_0xc65b('0x1a')]=_0x2e8e50['ListId'];this[_0xc65b('0x1b')]=_0x2e8e50[_0xc65b('0x1b')];this[_0xc65b('0x1c')]=_0x2e8e50[_0xc65b('0x1c')];this[_0xc65b('0x1d')]=_0x2e8e50['CampaignId'];this[_0xc65b('0x1e')]=_0x2e8e50[_0xc65b('0x1e')]||'';this[_0xc65b('0x1f')]=_0x2e8e50['originatecalleridname']||'';this[_0xc65b('0x20')]=_0x2e8e50[_0xc65b('0x20')];this[_0xc65b('0x21')]=_0x2e8e50[_0xc65b('0x21')];}module[_0xc65b('0x22')]=Final; \ No newline at end of file +var _0x2899=['ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x3284fc,_0x3ec534){var _0x1ca4e3=function(_0x597ccb){while(--_0x597ccb){_0x3284fc['push'](_0x3284fc['shift']());}};_0x1ca4e3(++_0x3ec534);}(_0x2899,0x1ad));var _0x9289=function(_0x331aa0,_0x3a6c0b){_0x331aa0=_0x331aa0-0x0;var _0x3b3d2f=_0x2899[_0x331aa0];return _0x3b3d2f;};'use strict';function Final(_0x4eed6e){this[_0x9289('0x0')]=_0x4eed6e[_0x9289('0x0')];this[_0x9289('0x1')]=_0x4eed6e[_0x9289('0x1')];this[_0x9289('0x2')]=_0x4eed6e[_0x9289('0x2')];this[_0x9289('0x3')]=_0x4eed6e[_0x9289('0x2')]===_0x9289('0x4')?_0x9289('0x5'):_0x4eed6e[_0x9289('0x2')];this[_0x9289('0x6')]=_0x4eed6e[_0x9289('0x6')];this[_0x9289('0x7')]=_0x4eed6e[_0x9289('0x7')];this[_0x9289('0x8')]=_0x4eed6e[_0x9289('0x8')];this['countglobal']=_0x4eed6e[_0x9289('0x6')]+_0x4eed6e['countcongestionretry']+_0x4eed6e['countnoanswerretry']+_0x4eed6e['countnosuchnumberretry']+_0x4eed6e['countdropretry']+_0x4eed6e['countabandonedretry']+_0x4eed6e[_0x9289('0x9')]+_0x4eed6e[_0x9289('0xa')];this[_0x9289('0xb')]=_0x4eed6e['countnosuchnumberretry'];this[_0x9289('0xc')]=_0x4eed6e[_0x9289('0xc')];this[_0x9289('0xd')]=_0x4eed6e[_0x9289('0xd')];this[_0x9289('0x9')]=_0x4eed6e['countmachineretry'];this[_0x9289('0xa')]=_0x4eed6e[_0x9289('0xa')];this[_0x9289('0x5')]=_0x4eed6e['queue'];this['calleridname']=_0x4eed6e[_0x9289('0xe')];this[_0x9289('0xf')]=_0x4eed6e[_0x9289('0xf')];this[_0x9289('0x10')]=_0x4eed6e[_0x9289('0x10')];this[_0x9289('0x11')]=_0x4eed6e[_0x9289('0x11')];this[_0x9289('0x12')]=_0x4eed6e[_0x9289('0x11')];this[_0x9289('0x13')]=_0x4eed6e[_0x9289('0x13')]||0x0;this[_0x9289('0x14')]=_0x4eed6e[_0x9289('0x14')]||0x0;this[_0x9289('0x15')]=_0x4eed6e[_0x9289('0x15')]||0x0;this[_0x9289('0x16')]=_0x4eed6e[_0x9289('0x16')];this[_0x9289('0x17')]=_0x4eed6e[_0x9289('0x17')];this[_0x9289('0x18')]=_0x4eed6e['callbackat'];this[_0x9289('0x19')]=_0x4eed6e[_0x9289('0x19')];this['ContactId']=_0x4eed6e[_0x9289('0x1a')];this['ListId']=_0x4eed6e['ListId'];this[_0x9289('0x1b')]=_0x4eed6e[_0x9289('0x1b')];this[_0x9289('0x1c')]=_0x4eed6e[_0x9289('0x1c')];this[_0x9289('0x1d')]=_0x4eed6e[_0x9289('0x1d')];this['originatecalleridnum']=_0x4eed6e[_0x9289('0x1e')]||'';this[_0x9289('0x1f')]=_0x4eed6e[_0x9289('0x1f')]||'';this[_0x9289('0x20')]=_0x4eed6e[_0x9289('0x20')];this[_0x9289('0x21')]=_0x4eed6e[_0x9289('0x21')];}module[_0x9289('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index bf5f8f6..6569c3e 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7edf=['moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','uniqueid','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','membername','IVR','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports'];(function(_0x165ca9,_0x36e359){var _0x25f49a=function(_0x3da5e5){while(--_0x3da5e5){_0x165ca9['push'](_0x165ca9['shift']());}};_0x25f49a(++_0x36e359);}(_0x7edf,0x17a));var _0xf7ed=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x7edf[_0x50aa2e];return _0x5e07f0;};'use strict';var moment=require(_0xf7ed('0x0'));var utils=require(_0xf7ed('0x1'));function Hangup(_0x3bc981,_0x57be7e){this[_0xf7ed('0x2')]=0x4;this[_0xf7ed('0x3')]=_0xf7ed('0x4');this[_0xf7ed('0x5')]=_0x3bc981['scheduledat'];this[_0xf7ed('0x6')]=_0x3bc981[_0xf7ed('0x6')];this[_0xf7ed('0x7')]=_0x3bc981['type']===_0xf7ed('0x8')?_0xf7ed('0x9'):_0x3bc981[_0xf7ed('0x6')];this[_0xf7ed('0xa')]=_0x3bc981[_0xf7ed('0xa')]||![];this[_0xf7ed('0xb')]=_0x3bc981[_0xf7ed('0xb')];this['countcongestionretry']=_0x3bc981[_0xf7ed('0xc')];this[_0xf7ed('0xd')]=_0x3bc981[_0xf7ed('0xd')];this['countglobal']=_0x3bc981[_0xf7ed('0xb')]+_0x3bc981['countcongestionretry']+_0x3bc981[_0xf7ed('0xd')]+_0x3bc981['countnosuchnumberretry']+_0x3bc981[_0xf7ed('0xe')]+_0x3bc981['countabandonedretry']+_0x3bc981['countmachineretry']+_0x3bc981[_0xf7ed('0xf')];this[_0xf7ed('0x10')]=_0x3bc981[_0xf7ed('0x10')];this[_0xf7ed('0xe')]=_0x3bc981[_0xf7ed('0xe')];this['countabandonedretry']=_0x3bc981[_0xf7ed('0x11')];this[_0xf7ed('0x12')]=_0x3bc981[_0xf7ed('0x12')];this[_0xf7ed('0xf')]=_0x3bc981['countagentrejectretry'];this['uniqueid']=_0x57be7e[_0xf7ed('0x13')];this['calleridname']=_0x3bc981['name'];this[_0xf7ed('0x14')]=_0x3bc981[_0xf7ed('0x15')];this[_0xf7ed('0x16')]=_0x3bc981[_0xf7ed('0x16')];this['responsetime']=_0x3bc981['responsetime'];this[_0xf7ed('0x17')]=moment()[_0xf7ed('0x18')](_0xf7ed('0x19'));this[_0xf7ed('0x1a')]=utils[_0xf7ed('0x1b')](_0x3bc981[_0xf7ed('0x1c')],_0x3bc981['starttime']);this[_0xf7ed('0x1d')]=0x0;this['talktime']=utils['getSeconds'](this['endtime'],_0x3bc981[_0xf7ed('0x1c')]);this[_0xf7ed('0x9')]=_0x3bc981[_0xf7ed('0x9')];this[_0xf7ed('0x1e')]=_0xf7ed('0x1f');this[_0xf7ed('0x20')]=_0x57be7e['cause-txt'];this['callback']=_0x3bc981['callback'];this[_0xf7ed('0x21')]=_0x3bc981[_0xf7ed('0x21')];this['callbackat']=_0x3bc981[_0xf7ed('0x22')];this[_0xf7ed('0x23')]=_0x3bc981['recallme'];this[_0xf7ed('0x24')]=_0x3bc981[_0xf7ed('0x24')];this[_0xf7ed('0x25')]=_0x3bc981['ListId'];this[_0xf7ed('0x26')]=_0x3bc981[_0xf7ed('0x26')];this[_0xf7ed('0x27')]=_0x3bc981[_0xf7ed('0x27')];this['CampaignId']=_0x3bc981[_0xf7ed('0x28')];}module[_0xf7ed('0x29')]=Hangup; \ No newline at end of file +var _0x57cf=['YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','format'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x57cf,0x11b));var _0xf57c=function(_0x3df93e,_0x5af13a){_0x3df93e=_0x3df93e-0x0;var _0x2d4f2a=_0x57cf[_0x3df93e];return _0x2d4f2a;};'use strict';var moment=require(_0xf57c('0x0'));var utils=require(_0xf57c('0x1'));function Hangup(_0x41b0b8,_0x182ad5){this[_0xf57c('0x2')]=0x4;this[_0xf57c('0x3')]=_0xf57c('0x4');this[_0xf57c('0x5')]=_0x41b0b8[_0xf57c('0x5')];this[_0xf57c('0x6')]=_0x41b0b8['type'];this[_0xf57c('0x7')]=_0x41b0b8['type']===_0xf57c('0x8')?'queue':_0x41b0b8['type'];this[_0xf57c('0x9')]=_0x41b0b8['amd']||![];this[_0xf57c('0xa')]=_0x41b0b8[_0xf57c('0xa')];this['countcongestionretry']=_0x41b0b8['countcongestionretry'];this[_0xf57c('0xb')]=_0x41b0b8[_0xf57c('0xb')];this[_0xf57c('0xc')]=_0x41b0b8[_0xf57c('0xa')]+_0x41b0b8['countcongestionretry']+_0x41b0b8[_0xf57c('0xb')]+_0x41b0b8[_0xf57c('0xd')]+_0x41b0b8[_0xf57c('0xe')]+_0x41b0b8['countabandonedretry']+_0x41b0b8[_0xf57c('0xf')]+_0x41b0b8['countagentrejectretry'];this[_0xf57c('0xd')]=_0x41b0b8[_0xf57c('0xd')];this['countdropretry']=_0x41b0b8[_0xf57c('0xe')];this['countabandonedretry']=_0x41b0b8[_0xf57c('0x10')];this['countmachineretry']=_0x41b0b8[_0xf57c('0xf')];this[_0xf57c('0x11')]=_0x41b0b8[_0xf57c('0x11')];this[_0xf57c('0x12')]=_0x182ad5[_0xf57c('0x12')];this[_0xf57c('0x13')]=_0x41b0b8[_0xf57c('0x14')];this[_0xf57c('0x15')]=_0x41b0b8['number'];this[_0xf57c('0x16')]=_0x41b0b8['starttime'];this[_0xf57c('0x17')]=_0x41b0b8[_0xf57c('0x17')];this['endtime']=moment()[_0xf57c('0x18')](_0xf57c('0x19'));this[_0xf57c('0x1a')]=utils[_0xf57c('0x1b')](_0x41b0b8[_0xf57c('0x17')],_0x41b0b8['starttime']);this[_0xf57c('0x1c')]=0x0;this[_0xf57c('0x1d')]=utils[_0xf57c('0x1b')](this['endtime'],_0x41b0b8['responsetime']);this[_0xf57c('0x1e')]=_0x41b0b8[_0xf57c('0x1e')];this[_0xf57c('0x1f')]=_0xf57c('0x20');this[_0xf57c('0x21')]=_0x182ad5[_0xf57c('0x22')];this[_0xf57c('0x23')]=_0x41b0b8[_0xf57c('0x23')];this[_0xf57c('0x24')]=_0x41b0b8['callbackuniqueid'];this[_0xf57c('0x25')]=_0x41b0b8[_0xf57c('0x25')];this['recallme']=_0x41b0b8['recallme'];this[_0xf57c('0x26')]=_0x41b0b8['ContactId'];this[_0xf57c('0x27')]=_0x41b0b8[_0xf57c('0x27')];this[_0xf57c('0x28')]=_0x41b0b8['UserId'];this[_0xf57c('0x29')]=_0x41b0b8[_0xf57c('0x29')];this['CampaignId']=_0x41b0b8[_0xf57c('0x2a')];}module[_0xf57c('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 51e43a0..9c2df78 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10c6=['name','calleridnum','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x10c6,0x122));var _0x610c=function(_0x3a0100,_0x507e94){_0x3a0100=_0x3a0100-0x0;var _0x38d8db=_0x10c6[_0x3a0100];return _0x38d8db;};'use strict';var utils=require(_0x610c('0x0'));function History(_0x15d410){this[_0x610c('0x1')]=_0x15d410[_0x610c('0x1')];this[_0x610c('0x2')]=_0x15d410[_0x610c('0x2')]||undefined;this[_0x610c('0x3')]=_0x15d410[_0x610c('0x3')];this[_0x610c('0x4')]=_0x15d410[_0x610c('0x3')]===_0x610c('0x5')?_0x610c('0x6'):_0x15d410['type'];this[_0x610c('0x7')]=_0x15d410[_0x610c('0x7')];this[_0x610c('0x8')]=_0x15d410[_0x610c('0x8')];this[_0x610c('0x9')]=_0x15d410[_0x610c('0x9')];this[_0x610c('0xa')]=_0x15d410['countbusyretry']+_0x15d410['countcongestionretry']+_0x15d410[_0x610c('0x9')]+_0x15d410[_0x610c('0xb')]+_0x15d410['countdropretry']+_0x15d410[_0x610c('0xc')]+_0x15d410[_0x610c('0xd')]+_0x15d410[_0x610c('0xe')];this[_0x610c('0xb')]=_0x15d410[_0x610c('0xb')];this[_0x610c('0xf')]=_0x15d410['countdropretry'];this[_0x610c('0xc')]=_0x15d410[_0x610c('0xc')];this[_0x610c('0xd')]=_0x15d410[_0x610c('0xd')];this[_0x610c('0xe')]=_0x15d410[_0x610c('0xe')];this[_0x610c('0x6')]=_0x15d410[_0x610c('0x6')];this['calleridname']=_0x15d410[_0x610c('0x10')];this[_0x610c('0x11')]=_0x15d410[_0x610c('0x12')];this[_0x610c('0x13')]=_0x15d410[_0x610c('0x13')];this[_0x610c('0x14')]=_0x15d410[_0x610c('0x14')];this[_0x610c('0x15')]=_0x15d410['responsetime'];this['ringtime']=utils['getSeconds'](_0x15d410['responsetime'],_0x15d410['starttime']);this['holdtime']=0x0;this[_0x610c('0x16')]=0x0;this['callback']=_0x15d410[_0x610c('0x17')];this[_0x610c('0x18')]=_0x15d410[_0x610c('0x18')];this['callbackat']=_0x15d410['callbackat'];this[_0x610c('0x19')]=_0x15d410[_0x610c('0x19')];this[_0x610c('0x1a')]=_0x15d410['ContactId'];this['ListId']=_0x15d410[_0x610c('0x1b')];this[_0x610c('0x1c')]=_0x15d410[_0x610c('0x1c')];this['VoiceQueueId']=_0x15d410['VoiceQueueId'];this[_0x610c('0x1d')]=_0x15d410['CampaignId'];this[_0x610c('0x1e')]=_0x15d410[_0x610c('0x1e')]||'';this[_0x610c('0x1f')]=_0x15d410[_0x610c('0x1f')]||'';this[_0x610c('0x20')]=_0x15d410[_0x610c('0x20')];this[_0x610c('0x21')]=_0x15d410[_0x610c('0x21')];}module['exports']=History; \ No newline at end of file +var _0x0b9e=['recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x3f975a,_0xf22b0b){var _0x512370=function(_0x3d3ddd){while(--_0x3d3ddd){_0x3f975a['push'](_0x3f975a['shift']());}};_0x512370(++_0xf22b0b);}(_0x0b9e,0x9d));var _0xe0b9=function(_0x2d6df3,_0x1a8c5c){_0x2d6df3=_0x2d6df3-0x0;var _0x5d2b9c=_0x0b9e[_0x2d6df3];return _0x5d2b9c;};'use strict';var utils=require(_0xe0b9('0x0'));function History(_0x6685d1){this[_0xe0b9('0x1')]=_0x6685d1[_0xe0b9('0x1')];this['scheduledat']=_0x6685d1[_0xe0b9('0x2')]||undefined;this[_0xe0b9('0x3')]=_0x6685d1[_0xe0b9('0x3')];this[_0xe0b9('0x4')]=_0x6685d1[_0xe0b9('0x3')]===_0xe0b9('0x5')?_0xe0b9('0x6'):_0x6685d1[_0xe0b9('0x3')];this[_0xe0b9('0x7')]=_0x6685d1[_0xe0b9('0x7')];this[_0xe0b9('0x8')]=_0x6685d1['countcongestionretry'];this['countnoanswerretry']=_0x6685d1['countnoanswerretry'];this['countglobal']=_0x6685d1['countbusyretry']+_0x6685d1['countcongestionretry']+_0x6685d1[_0xe0b9('0x9')]+_0x6685d1[_0xe0b9('0xa')]+_0x6685d1[_0xe0b9('0xb')]+_0x6685d1['countabandonedretry']+_0x6685d1[_0xe0b9('0xc')]+_0x6685d1[_0xe0b9('0xd')];this[_0xe0b9('0xa')]=_0x6685d1[_0xe0b9('0xa')];this[_0xe0b9('0xb')]=_0x6685d1[_0xe0b9('0xb')];this[_0xe0b9('0xe')]=_0x6685d1['countabandonedretry'];this[_0xe0b9('0xc')]=_0x6685d1[_0xe0b9('0xc')];this[_0xe0b9('0xd')]=_0x6685d1['countagentrejectretry'];this[_0xe0b9('0x6')]=_0x6685d1[_0xe0b9('0x6')];this[_0xe0b9('0xf')]=_0x6685d1[_0xe0b9('0x10')];this[_0xe0b9('0x11')]=_0x6685d1[_0xe0b9('0x12')];this[_0xe0b9('0x13')]=_0x6685d1[_0xe0b9('0x13')];this[_0xe0b9('0x14')]=_0x6685d1['responsetime'];this['endtime']=_0x6685d1[_0xe0b9('0x14')];this[_0xe0b9('0x15')]=utils[_0xe0b9('0x16')](_0x6685d1[_0xe0b9('0x14')],_0x6685d1[_0xe0b9('0x13')]);this[_0xe0b9('0x17')]=0x0;this[_0xe0b9('0x18')]=0x0;this[_0xe0b9('0x19')]=_0x6685d1[_0xe0b9('0x19')];this[_0xe0b9('0x1a')]=_0x6685d1['callbackuniqueid'];this[_0xe0b9('0x1b')]=_0x6685d1[_0xe0b9('0x1b')];this[_0xe0b9('0x1c')]=_0x6685d1[_0xe0b9('0x1c')];this[_0xe0b9('0x1d')]=_0x6685d1[_0xe0b9('0x1d')];this[_0xe0b9('0x1e')]=_0x6685d1['ListId'];this['UserId']=_0x6685d1['UserId'];this[_0xe0b9('0x1f')]=_0x6685d1[_0xe0b9('0x1f')];this[_0xe0b9('0x20')]=_0x6685d1[_0xe0b9('0x20')];this[_0xe0b9('0x21')]=_0x6685d1[_0xe0b9('0x21')]||'';this['originatecalleridname']=_0x6685d1['originatecalleridname']||'';this[_0xe0b9('0x22')]=_0x6685d1[_0xe0b9('0x22')];this[_0xe0b9('0x23')]=_0x6685d1['statedesc'];}module[_0xe0b9('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 9283263..eb42b31 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3233=['ringtime','holdtime','getSeconds','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime'];(function(_0xc4c171,_0x5eebe5){var _0x45e4cc=function(_0x287b90){while(--_0x287b90){_0xc4c171['push'](_0xc4c171['shift']());}};_0x45e4cc(++_0x5eebe5);}(_0x3233,0xc5));var _0x3323=function(_0x30ae11,_0x140efc){_0x30ae11=_0x30ae11-0x0;var _0x22a0f3=_0x3233[_0x30ae11];return _0x22a0f3;};'use strict';var utils=require(_0x3323('0x0'));function QueueCallerAbandon(_0x36fb8c,_0x401830){this[_0x3323('0x1')]=_0x36fb8c[_0x3323('0x1')];this[_0x3323('0x2')]=_0x36fb8c[_0x3323('0x2')];this['campaigntype']=_0x36fb8c[_0x3323('0x2')]===_0x3323('0x3')?'queue':_0x36fb8c[_0x3323('0x2')];this['countbusyretry']=_0x36fb8c[_0x3323('0x4')];this[_0x3323('0x5')]=_0x36fb8c['countcongestionretry'];this[_0x3323('0x6')]=_0x36fb8c[_0x3323('0x6')];this[_0x3323('0x7')]=_0x36fb8c[_0x3323('0x4')]+_0x36fb8c[_0x3323('0x5')]+_0x36fb8c[_0x3323('0x6')]+_0x36fb8c['countnosuchnumberretry']+_0x36fb8c[_0x3323('0x8')]+_0x36fb8c[_0x3323('0x9')]+_0x36fb8c['countmachineretry']+_0x36fb8c['countagentrejectretry'];this[_0x3323('0xa')]=_0x36fb8c[_0x3323('0xa')];this[_0x3323('0x8')]=_0x36fb8c[_0x3323('0x8')];this[_0x3323('0x9')]=_0x36fb8c[_0x3323('0x9')];this[_0x3323('0xb')]=_0x36fb8c['countmachineretry'];this[_0x3323('0xc')]=_0x36fb8c[_0x3323('0xc')];this[_0x3323('0xd')]=_0x401830[_0x3323('0xd')];this[_0x3323('0xe')]=_0x36fb8c[_0x3323('0xf')];this[_0x3323('0x10')]=_0x36fb8c[_0x3323('0x11')];this[_0x3323('0x12')]=_0x36fb8c['starttime'];this[_0x3323('0x13')]=_0x36fb8c[_0x3323('0x13')];this[_0x3323('0x14')]=_0x36fb8c[_0x3323('0x14')];this[_0x3323('0x15')]=_0x36fb8c['dropreason'];this[_0x3323('0x16')]=this[_0x3323('0x14')];this[_0x3323('0x17')]=utils['getSeconds'](_0x36fb8c[_0x3323('0x13')],_0x36fb8c['starttime']);this[_0x3323('0x18')]=utils[_0x3323('0x19')](this[_0x3323('0x14')],_0x36fb8c[_0x3323('0x13')]);this[_0x3323('0x1a')]=0x0;this[_0x3323('0x1b')]=_0x401830[_0x3323('0x1b')];this['membername']=_0x401830[_0x3323('0x1c')];this[_0x3323('0x1d')]=_0x401830['reason'];this[_0x3323('0x1e')]=_0x36fb8c[_0x3323('0x1e')];this[_0x3323('0x1f')]=_0x36fb8c[_0x3323('0x1f')];this[_0x3323('0x20')]=_0x36fb8c['callbackat'];this['recallme']=_0x36fb8c['recallme'];this['ContactId']=_0x36fb8c[_0x3323('0x21')];this[_0x3323('0x22')]=_0x36fb8c[_0x3323('0x22')];this['UserId']=_0x36fb8c[_0x3323('0x23')];this[_0x3323('0x24')]=_0x36fb8c[_0x3323('0x24')];this[_0x3323('0x25')]=_0x36fb8c[_0x3323('0x25')];this[_0x3323('0x26')]=_0x36fb8c['originatecalleridnum']||'';this[_0x3323('0x27')]=_0x36fb8c[_0x3323('0x27')]||'';this['agiafterat']=_0x36fb8c[_0x3323('0x28')];this['state']=_0x36fb8c[_0x3323('0x29')];this[_0x3323('0x2a')]=_0x36fb8c[_0x3323('0x2a')];}module[_0x3323('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xb561=['getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb561,0x184));var _0x1b56=function(_0x4fca7a,_0x12aa50){_0x4fca7a=_0x4fca7a-0x0;var _0x3d414d=_0xb561[_0x4fca7a];return _0x3d414d;};'use strict';var utils=require(_0x1b56('0x0'));function QueueCallerAbandon(_0x13820e,_0x3f64d4){this[_0x1b56('0x1')]=_0x13820e[_0x1b56('0x1')];this[_0x1b56('0x2')]=_0x13820e[_0x1b56('0x2')];this[_0x1b56('0x3')]=_0x13820e[_0x1b56('0x2')]===_0x1b56('0x4')?_0x1b56('0x5'):_0x13820e[_0x1b56('0x2')];this[_0x1b56('0x6')]=_0x13820e[_0x1b56('0x6')];this[_0x1b56('0x7')]=_0x13820e[_0x1b56('0x7')];this[_0x1b56('0x8')]=_0x13820e[_0x1b56('0x8')];this[_0x1b56('0x9')]=_0x13820e['countbusyretry']+_0x13820e[_0x1b56('0x7')]+_0x13820e['countnoanswerretry']+_0x13820e[_0x1b56('0xa')]+_0x13820e[_0x1b56('0xb')]+_0x13820e[_0x1b56('0xc')]+_0x13820e[_0x1b56('0xd')]+_0x13820e['countagentrejectretry'];this[_0x1b56('0xa')]=_0x13820e[_0x1b56('0xa')];this[_0x1b56('0xb')]=_0x13820e['countdropretry'];this[_0x1b56('0xc')]=_0x13820e[_0x1b56('0xc')];this[_0x1b56('0xd')]=_0x13820e[_0x1b56('0xd')];this[_0x1b56('0xe')]=_0x13820e[_0x1b56('0xe')];this[_0x1b56('0xf')]=_0x3f64d4[_0x1b56('0xf')];this[_0x1b56('0x10')]=_0x13820e[_0x1b56('0x11')];this[_0x1b56('0x12')]=_0x13820e[_0x1b56('0x13')];this[_0x1b56('0x14')]=_0x13820e['starttime'];this['responsetime']=_0x13820e[_0x1b56('0x15')];this[_0x1b56('0x16')]=_0x13820e[_0x1b56('0x16')];this[_0x1b56('0x17')]=_0x13820e['dropreason'];this[_0x1b56('0x18')]=this[_0x1b56('0x16')];this[_0x1b56('0x19')]=utils[_0x1b56('0x1a')](_0x13820e[_0x1b56('0x15')],_0x13820e[_0x1b56('0x14')]);this['holdtime']=utils[_0x1b56('0x1a')](this[_0x1b56('0x16')],_0x13820e[_0x1b56('0x15')]);this[_0x1b56('0x1b')]=0x0;this[_0x1b56('0x5')]=_0x3f64d4[_0x1b56('0x5')];this[_0x1b56('0x1c')]=_0x3f64d4[_0x1b56('0x1d')];this['reason']=_0x3f64d4[_0x1b56('0x1e')];this['callback']=_0x13820e[_0x1b56('0x1f')];this[_0x1b56('0x20')]=_0x13820e[_0x1b56('0x20')];this[_0x1b56('0x21')]=_0x13820e[_0x1b56('0x21')];this[_0x1b56('0x22')]=_0x13820e['recallme'];this['ContactId']=_0x13820e[_0x1b56('0x23')];this[_0x1b56('0x24')]=_0x13820e[_0x1b56('0x24')];this['UserId']=_0x13820e[_0x1b56('0x25')];this[_0x1b56('0x26')]=_0x13820e['VoiceQueueId'];this[_0x1b56('0x27')]=_0x13820e[_0x1b56('0x27')];this['originatecalleridnum']=_0x13820e[_0x1b56('0x28')]||'';this[_0x1b56('0x29')]=_0x13820e['originatecalleridname']||'';this[_0x1b56('0x2a')]=_0x13820e['agiafterat'];this[_0x1b56('0x2b')]=_0x13820e[_0x1b56('0x2b')];this[_0x1b56('0x2c')]=_0x13820e[_0x1b56('0x2c')];}module[_0x1b56('0x2d')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 65dd92b..6841cd8 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687b=['checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','[createHistory]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[getContactDialerIvr]','countReScheduled','[rescheduleContact]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]'];(function(_0xf91413,_0xd22eab){var _0x193c80=function(_0x4f9f90){while(--_0x4f9f90){_0xf91413['push'](_0xf91413['shift']());}};_0x193c80(++_0xd22eab);}(_0x687b,0x14a));var _0xb687=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x687b[_0x3598bb];return _0x13c837;};'use strict';var util=require(_0xb687('0x0'));var logger=require(_0xb687('0x1'))(_0xb687('0x2'));var cmHopper=require(_0xb687('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xb687('0x4'));function inspectError(_0x2a4a7c){return util[_0xb687('0x5')](_0x2a4a7c,{'showHidden':![],'depth':null});}function getContactDialer(_0x31bd0d,_0x46e5b3,_0x194c55){return cmHopper[_0xb687('0x6')](_0x31bd0d['id'],_0x46e5b3,_0x194c55,_0x31bd0d[_0xb687('0x7')])[_0xb687('0x8')](function(_0x27b750){_0x31bd0d['temp']=0x0;logger[_0xb687('0x9')](_0xb687('0xa'),inspectError(_0x27b750));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1a99c5,_0x21e3ab){return cmHopper[_0xb687('0xb')](_0x1a99c5['id'],_0x21e3ab,_0x1a99c5[_0xb687('0x7')])[_0xb687('0x8')](function(_0x309d84){_0x1a99c5[_0xb687('0xc')]=0x0;logger[_0xb687('0x9')](_0xb687('0xd'),inspectError(_0x309d84));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x226e56){return cmHopper[_0xb687('0xe')](_0x226e56)[_0xb687('0x8')](function(_0x12a0be){logger['error']('[countReScheduled]',inspectError(_0x12a0be));});}exports[_0xb687('0xe')]=countReScheduled;function rescheduleContact(_0x155ebe){return cmHopper['rescheduleContact'](_0x155ebe)[_0xb687('0x8')](function(_0x2f1ac0){logger[_0xb687('0x9')](_0xb687('0xf'),inspectError(_0x2f1ac0));});}exports[_0xb687('0x10')]=rescheduleContact;function unlockContact(_0x3ab914,_0x30622f,_0x141375){return cmHopper[_0xb687('0x11')](_0x3ab914,_0x30622f,_0x141375)[_0xb687('0x8')](function(_0x25124a){logger[_0xb687('0x9')]('[unlockContact]',inspectError(_0x25124a));});}exports[_0xb687('0x11')]=unlockContact;function moveContactManagedDialer(_0x328301){return cmHopper[_0xb687('0x12')](_0x328301)['catch'](function(_0x48958d){logger[_0xb687('0x9')](_0xb687('0x13'),inspectError(_0x48958d));});}exports[_0xb687('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x4b593b){return cmHopperBlack[_0xb687('0x14')](_0x4b593b)['catch'](function(_0x1bd2bf){logger[_0xb687('0x9')](_0xb687('0x15'),inspectError(_0x1bd2bf));});}exports[_0xb687('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x49d5a1){return cmHopperBlack[_0xb687('0x16')](_0x49d5a1)['catch'](function(_0x335541){logger[_0xb687('0x9')](_0xb687('0x17'),inspectError(_0x335541));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1dc06b,_0x491623,_0xa95e91){return cmHopperAdditionalPhone[_0xb687('0x18')](_0x1dc06b,_0x491623,_0xa95e91)[_0xb687('0x8')](function(_0x38866c){logger[_0xb687('0x9')](_0xb687('0x19'),inspectError(_0x38866c));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xf45db0,_0x129347,_0x1c1585){return cmHopperAdditionalPhone[_0xb687('0x1a')](_0xf45db0,_0x129347,_0x1c1585)[_0xb687('0x8')](function(_0x4136c9){logger[_0xb687('0x9')](_0xb687('0x1b'),inspectError(_0x4136c9));});}exports[_0xb687('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x2e6185){return cmHopperHistory['avgHandleTime'](_0x2e6185)[_0xb687('0x8')](function(_0x192966){logger[_0xb687('0x9')](_0xb687('0x1c'),inspectError(_0x192966));});}exports[_0xb687('0x1d')]=avgHandleTime;function createHistory(_0x173c58){return cmHopperHistory['createHistory'](_0x173c58)[_0xb687('0x8')](function(_0x5143af){logger[_0xb687('0x9')](_0xb687('0x1e'),inspectError(_0x5143af));});}exports[_0xb687('0x1f')]=createHistory; \ No newline at end of file +var _0x6455=['[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones'];(function(_0x4d2b0a,_0x3fc6c5){var _0x2913de=function(_0x26a5ed){while(--_0x26a5ed){_0x4d2b0a['push'](_0x4d2b0a['shift']());}};_0x2913de(++_0x3fc6c5);}(_0x6455,0x97));var _0x5645=function(_0x2b5add,_0x114d90){_0x2b5add=_0x2b5add-0x0;var _0x2abb48=_0x6455[_0x2b5add];return _0x2abb48;};'use strict';var util=require(_0x5645('0x0'));var logger=require('../../../../config/logger')(_0x5645('0x1'));var cmHopper=require(_0x5645('0x2'));var cmHopperAdditionalPhone=require(_0x5645('0x3'));var cmHopperBlack=require(_0x5645('0x4'));var cmHopperHistory=require(_0x5645('0x5'));function inspectError(_0x35c21e){return util['inspect'](_0x35c21e,{'showHidden':![],'depth':null});}function getContactDialer(_0x233875,_0x29cefe,_0x282ef3){return cmHopper[_0x5645('0x6')](_0x233875['id'],_0x29cefe,_0x282ef3,_0x233875[_0x5645('0x7')])[_0x5645('0x8')](function(_0xa14a06){_0x233875[_0x5645('0x9')]=0x0;logger['error']('[getContactDialer]',inspectError(_0xa14a06));});}exports[_0x5645('0x6')]=getContactDialer;function getContactDialerIvr(_0x37c03a,_0x38c07a){return cmHopper[_0x5645('0xa')](_0x37c03a['id'],_0x38c07a,_0x37c03a[_0x5645('0x7')])[_0x5645('0x8')](function(_0x587c61){_0x37c03a[_0x5645('0x9')]=0x0;logger[_0x5645('0xb')](_0x5645('0xc'),inspectError(_0x587c61));});}exports[_0x5645('0xa')]=getContactDialerIvr;function countReScheduled(_0x5a6092){return cmHopper[_0x5645('0xd')](_0x5a6092)['catch'](function(_0x42f5cd){logger[_0x5645('0xb')](_0x5645('0xe'),inspectError(_0x42f5cd));});}exports[_0x5645('0xd')]=countReScheduled;function rescheduleContact(_0x2d982f){return cmHopper[_0x5645('0xf')](_0x2d982f)[_0x5645('0x8')](function(_0x2270a1){logger['error'](_0x5645('0x10'),inspectError(_0x2270a1));});}exports[_0x5645('0xf')]=rescheduleContact;function unlockContact(_0x25863f,_0x4cbd46,_0x4b3be6){return cmHopper[_0x5645('0x11')](_0x25863f,_0x4cbd46,_0x4b3be6)[_0x5645('0x8')](function(_0x511aed){logger[_0x5645('0xb')](_0x5645('0x12'),inspectError(_0x511aed));});}exports[_0x5645('0x11')]=unlockContact;function moveContactManagedDialer(_0x5179fd){return cmHopper[_0x5645('0x13')](_0x5179fd)[_0x5645('0x8')](function(_0x22a6cf){logger[_0x5645('0xb')]('[moveContactManagedDialer]',inspectError(_0x22a6cf));});}exports[_0x5645('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x52ac46){return cmHopperBlack['checkIsBlackList'](_0x52ac46)[_0x5645('0x8')](function(_0x1e2cba){logger[_0x5645('0xb')]('[checkIsBlackList]',inspectError(_0x1e2cba));});}exports[_0x5645('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x50ed38){return cmHopperBlack[_0x5645('0x15')](_0x50ed38)['catch'](function(_0x4f82d0){logger[_0x5645('0xb')]('[checkIsBlackListIvr]',inspectError(_0x4f82d0));});}exports[_0x5645('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x379cbd,_0x502c2e,_0x18680f){return cmHopperAdditionalPhone[_0x5645('0x16')](_0x379cbd,_0x502c2e,_0x18680f)[_0x5645('0x8')](function(_0x50fa82){logger[_0x5645('0xb')](_0x5645('0x17'),inspectError(_0x50fa82));});}exports[_0x5645('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x46b33a,_0x568fd6,_0x4bc484){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46b33a,_0x568fd6,_0x4bc484)['catch'](function(_0x472982){logger['error']('[swapAdditionalPhone]',inspectError(_0x472982));});}exports[_0x5645('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x12f43a){return cmHopperHistory[_0x5645('0x19')](_0x12f43a)[_0x5645('0x8')](function(_0x3a5c61){logger[_0x5645('0xb')](_0x5645('0x1a'),inspectError(_0x3a5c61));});}exports[_0x5645('0x19')]=avgHandleTime;function createHistory(_0x4493e6){return cmHopperHistory[_0x5645('0x1b')](_0x4493e6)[_0x5645('0x8')](function(_0x2154a7){logger[_0x5645('0xb')](_0x5645('0x1c'),inspectError(_0x2154a7));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 07ae191..30dad62 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa38b=['RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isIVRCampaign','type','isOutboundQueue','isIVRCampaignActive','milliseconds','diff','seconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','substring','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME'];(function(_0x4d17e8,_0x1deb64){var _0x1868d4=function(_0x46ea22){while(--_0x46ea22){_0x4d17e8['push'](_0x4d17e8['shift']());}};_0x1868d4(++_0x1deb64);}(_0xa38b,0x13e));var _0xba38=function(_0x398828,_0x52119b){_0x398828=_0x398828-0x0;var _0x399ce8=_0xa38b[_0x398828];return _0x399ce8;};'use strict';var _=require(_0xba38('0x0'));var moment=require(_0xba38('0x1'));var util=require(_0xba38('0x2'));var logger=require(_0xba38('0x3'))(_0xba38('0x4'));var timezones=require('../../../../config/environment/shared')[_0xba38('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xba38('0x6'),'BLACKLIST':_0xba38('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xba38('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xba38('0x9'),'NO_AGENTS_LOGGED':_0xba38('0xa'),'NO_AVAILABLE_CONTACTS':_0xba38('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xba38('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xba38('0xd'),'QUEUE_RECALL':_0xba38('0xe'),'RECALL_TIMEOUT':_0xba38('0xf'),'RUNNING':_0xba38('0x10'),'UNKNOWN_TIMEZONE':_0xba38('0x11'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xba38('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0xc2d83a){return _0xc2d83a[_0xba38('0x13')]===_0xba38('0x14');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x4af04a){return _0x4af04a['type']==='ivr';}exports[_0xba38('0x15')]=isIVRCampaign;function isOutboundQueue(_0x4998f8){return _0x4998f8[_0xba38('0x16')]==='outbound';}exports[_0xba38('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x4c0934){return _0x4c0934['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x34058c){return _0x34058c['active'];}exports[_0xba38('0x18')]=isIVRCampaignActive;function getSeconds(_0x5bb715,_0x3f1242){var _0x29fa44=moment(_0x5bb715)[_0xba38('0x19')](0x0);var _0x3e233b=moment(_0x3f1242)[_0xba38('0x19')](0x0);return _0x29fa44[_0xba38('0x1a')](_0x3e233b,_0xba38('0x1b'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x37444d,_0x203f0e){var _0xf19a08=![];var _0x31ceda=_0x37444d['dialMethod']!==_0x203f0e[_0xba38('0x13')]||_0x37444d[_0xba38('0x1c')]!==_0x203f0e['dialActive']||_0x37444d[_0xba38('0x1d')]!==_0x203f0e[_0xba38('0x1d')];var _0x4e2708=_0x37444d[_0xba38('0x1e')]!==_0x203f0e[_0xba38('0x1e')]||_0x37444d[_0xba38('0x1f')]!==_0x203f0e['loggedIn']||_0x37444d[_0xba38('0x20')]!==_0x203f0e[_0xba38('0x20')]||_0x37444d[_0xba38('0x21')]!==_0x203f0e['paused']||_0x37444d['talking']!==_0x203f0e[_0xba38('0x22')]||_0x37444d[_0xba38('0x23')]!==_0x203f0e['pTalking']||_0x37444d[_0xba38('0x24')]!==_0x203f0e[_0xba38('0x24')]||_0x37444d[_0xba38('0x25')]!==_0x203f0e['inUse']||_0x37444d[_0xba38('0x26')]!==_0x203f0e[_0xba38('0x26')];if(_0x37444d[_0xba38('0x27')]&&_0x203f0e[_0xba38('0x27')]){_0xf19a08=_0x37444d[_0xba38('0x27')][_0xba38('0x28')]!==_0x203f0e['Trunk']['name']||_0x37444d[_0xba38('0x27')]['active']!==_0x203f0e[_0xba38('0x27')][_0xba38('0x29')];}return _0x31ceda||_0x4e2708||_0xf19a08;}exports[_0xba38('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x54a6bf){var _0x3942f6=null;var _0xddf813=_0x54a6bf['dialTimezone'];if(_[_0xba38('0x2b')](_0x54a6bf[_0xba38('0x2c')])||_[_0xba38('0x2b')](_0x54a6bf[_0xba38('0x2d')])||_[_0xba38('0x2b')](_0x54a6bf['Interval'][_0xba38('0x2e')])){_0x3942f6=CAMPAIGN_STATUS[_0xba38('0x2f')];}else if(_['isEmpty'](_0x54a6bf[_0xba38('0x2c')])||_[_0xba38('0x30')](_0x54a6bf['Interval'][_0xba38('0x2e')])){_0x3942f6=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0xddf813&&!timezones[_0xddf813]){_0x3942f6=CAMPAIGN_STATUS[_0xba38('0x31')];}return _0x3942f6;}function checkAnyValidTrunk(_0x5d966c,_0x285978){var _0x4fcb5e=null;var _0x3272a4='SIP/';var _0x4e63f3=['reachable',_0xba38('0x32')];var _0x5d7716=!![];if(_0x5d966c[_0xba38('0x27')]&&_0x5d966c[_0xba38('0x27')][_0xba38('0x29')]){_0x3272a4+=_0x5d966c[_0xba38('0x27')][_0xba38('0x28')];_0x4fcb5e=_0x285978[_0x3272a4];_0x5d7716=_0x4e63f3[_0xba38('0x33')](_0x4fcb5e[_0xba38('0x34')]);}else if(_0x5d966c[_0xba38('0x35')]&&_0x5d966c[_0xba38('0x35')][_0xba38('0x29')]){_0x3272a4+=_0x5d966c['TrunkBackup'][_0xba38('0x28')];_0x4fcb5e=_0x285978[_0x3272a4];_0x5d7716=_0x4e63f3[_0xba38('0x33')](_0x4fcb5e['status']);}return _0x5d7716;}function getQueueCampaignStatusMessage(_0x2cdf5c,_0x2d6b9f){var _0x55cd80=CAMPAIGN_STATUS[_0xba38('0x6')];var _0x58d486=isPreviewCampaign(_0x2cdf5c);if(!isQueueCampaignActive(_0x2cdf5c)){if(_0x58d486){_0x55cd80=CAMPAIGN_STATUS[_0xba38('0x36')];}else{if(_0x2cdf5c[_0xba38('0x26')]===0x0&&_0x2cdf5c['talking']===0x0&&_0x2cdf5c[_0xba38('0x24')]===0x0&&(_0x2cdf5c[_0xba38('0x23')]||0x0)===0x0){_0x55cd80=CAMPAIGN_STATUS['INACTIVE'];}else{_0x55cd80=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x2cdf5c['loggedIn']===0x0){_0x55cd80=CAMPAIGN_STATUS[_0xba38('0x37')];}else if(!checkAnyValidTrunk(_0x2cdf5c,_0x2d6b9f)){_0x55cd80=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x2cdf5c)){var _0x288097=checkAnyValidQueueCampaignInterval(_0x2cdf5c);if(_0x288097){_0x55cd80=_0x288097;}}return _0x55cd80;}exports[_0xba38('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xa74a60){var _0x1a466c=CAMPAIGN_STATUS['DISACTIVED'];if(_0xa74a60[_0xba38('0x26')]===0x0&&_0xa74a60[_0xba38('0x22')]===0x0&&_0xa74a60[_0xba38('0x24')]===0x0&&(_0xa74a60[_0xba38('0x23')]||0x0)===0x0){_0x1a466c=CAMPAIGN_STATUS[_0xba38('0x36')];}return _0x1a466c;}exports[_0xba38('0x39')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x424aa7){var _0x5af337=_0x424aa7['match'](/"(.*?)"/);return _0x5af337?_0x5af337[0x1]:_0x424aa7;}exports[_0xba38('0x3a')]=extractCalleridName;function getCallerId(_0x358fa1,_0x403ff0,_0x141242){if(!_[_0xba38('0x3b')](_0x141242)&&typeof _0x141242===_0xba38('0x3c')&&!_[_0xba38('0x30')](_0x141242)){if(!_['isUndefined'](_0x403ff0)&&typeof _0x403ff0===_0xba38('0x3c')&&!_[_0xba38('0x30')](_0x403ff0)){return util['format']('\x22%s\x22\x20<%s>',_0x403ff0,_0x141242);}return util[_0xba38('0x3d')](_0xba38('0x3e'),_0x141242,_0x141242);}if(!_[_0xba38('0x3b')](_0x358fa1)&&typeof _0x358fa1==='string'&&!_[_0xba38('0x30')](_0x358fa1)){return _0x358fa1;}return _0xba38('0x3f');}exports[_0xba38('0x40')]=getCallerId;function getCallerIdRandom(_0x4425d2,_0xcdc0ba){var _0x397882;var _0x3d24f3;var _0x413cc7;if(_0xcdc0ba<=0x0){_0xcdc0ba=0x1;}_0x397882=new RegExp('\x5cw{0,'+_0xcdc0ba+'}$');_0x3d24f3=Math['pow'](0xa,_0xcdc0ba-0x1);_0x413cc7=Math[_0xba38('0x41')](0xa,_0xcdc0ba)-0x1;return util[_0xba38('0x3d')]('%s',_[_0xba38('0x42')](_0x4425d2,_0x397882,_[_0xba38('0x43')](_0x3d24f3,_0x413cc7)[_0xba38('0x44')]()));}exports[_0xba38('0x45')]=getCallerIdRandom;function decrementOriginate(_0x1e2276){if(_0x1e2276[_0xba38('0x26')]&&_0x1e2276[_0xba38('0x26')]>0x0){_0x1e2276[_0xba38('0x26')]-=0x1;}else{logger[_0xba38('0x46')](_0xba38('0x47'));}}exports[_0xba38('0x48')]=decrementOriginate;function checkContactEmpty(_0x89bd94){return _0x89bd94&&_0x89bd94[_0xba38('0x49')]>0x0;}exports[_0xba38('0x4a')]=checkContactEmpty;function erlangb(_0x53286a,_0x227d76){if(_0x227d76===0x0){return 0x0;}var _0x2f056a=0x1;for(var _0xda81ef=0x1;_0xda81ef<=_0x227d76;_0xda81ef+=0x1){_0x2f056a=0x1+_0x2f056a*_0xda81ef/_0x53286a;}return 0x1/_0x2f056a;}exports[_0xba38('0x4b')]=erlangb;function checkContactLowerLimitOriginate(_0x33f401,_0x461d81,_0x458974){if(_0x461d81>_0x458974){for(var _0x14f99c=0x0;_0x14f99c<_0x461d81-_0x458974;_0x14f99c+=0x1){decrementOriginate(_0x33f401);}}}exports[_0xba38('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x16a06f){var _0x144225={};var _0x18410d=['id',_0xba38('0x4d'),_0xba38('0x4e'),_0xba38('0x4f')];const _0x269287=0xfa;if(_0x16a06f){for(var _0xe646ab in _0x16a06f){if(typeof _0x16a06f[_0xe646ab]!=='undefined'){if(!_['isNil'](_0x16a06f[_0xe646ab])&&!_0x18410d[_0xba38('0x33')](_0xe646ab)){if(_0xe646ab==='description'&&_0x16a06f[_0xe646ab][_0xba38('0x49')]>_0x269287){_0x144225['XMD-'+_0xe646ab['toUpperCase']()]=_0x16a06f[_0xe646ab]['toString']()[_0xba38('0x50')](0x0,_0x269287);}else{_0x144225['XMD-'+_0xe646ab[_0xba38('0x51')]()]=_0x16a06f[_0xe646ab];}}}}}return _0x144225;}exports[_0xba38('0x52')]=setXMDContactVariables; \ No newline at end of file +var _0x05ae=['includes','TrunkBackup','status','originated','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','talking','INACTIVE','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','format','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','tags','updatedAt','description','toUpperCase','substring','setXMDContactVariables','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','preview','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','pTalking','waiting','inUse','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored'];(function(_0x245edd,_0x222dde){var _0x2284c2=function(_0x27d4aa){while(--_0x27d4aa){_0x245edd['push'](_0x245edd['shift']());}};_0x2284c2(++_0x222dde);}(_0x05ae,0x1df));var _0xe05a=function(_0x5eb0bd,_0x659c4b){_0x5eb0bd=_0x5eb0bd-0x0;var _0x211c89=_0x05ae[_0x5eb0bd];return _0x211c89;};'use strict';var _=require(_0xe05a('0x0'));var moment=require(_0xe05a('0x1'));var util=require('util');var logger=require(_0xe05a('0x2'))(_0xe05a('0x3'));var timezones=require(_0xe05a('0x4'))[_0xe05a('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xe05a('0x6'),'BLACKLIST':_0xe05a('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xe05a('0x8'),'DISACTIVED':_0xe05a('0x9'),'EMPTY_INTERVAL':_0xe05a('0xa'),'INACTIVE':_0xe05a('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xe05a('0xc'),'NULL_INTERVAL':_0xe05a('0xd'),'OVERTIME_INTERVAL':_0xe05a('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0xe05a('0xf'),'QUEUE_RECALL':_0xe05a('0x10'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xe05a('0x11'),'UNKNOWN_TIMEZONE':_0xe05a('0x12'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x47d7a6){return _0x47d7a6['dialMethod']===_0xe05a('0x13');}exports[_0xe05a('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x542226){return _0x542226['type']===_0xe05a('0x15');}exports[_0xe05a('0x16')]=isIVRCampaign;function isOutboundQueue(_0x1f48e2){return _0x1f48e2[_0xe05a('0x17')]===_0xe05a('0x18');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x268149){return _0x268149[_0xe05a('0x19')];}exports[_0xe05a('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x461fae){return _0x461fae['active'];}exports[_0xe05a('0x1b')]=isIVRCampaignActive;function getSeconds(_0x2b0b20,_0x5796ee){var _0x3f1791=moment(_0x2b0b20)[_0xe05a('0x1c')](0x0);var _0x288b16=moment(_0x5796ee)[_0xe05a('0x1c')](0x0);return _0x3f1791[_0xe05a('0x1d')](_0x288b16,'seconds');}exports[_0xe05a('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x3987ce,_0x52cbee){var _0x3039a1=![];var _0x365e36=_0x3987ce['dialMethod']!==_0x52cbee[_0xe05a('0x1f')]||_0x3987ce[_0xe05a('0x19')]!==_0x52cbee['dialActive']||_0x3987ce['message']!==_0x52cbee[_0xe05a('0x20')];var _0x225662=_0x3987ce[_0xe05a('0x21')]!==_0x52cbee[_0xe05a('0x21')]||_0x3987ce[_0xe05a('0x22')]!==_0x52cbee[_0xe05a('0x22')]||_0x3987ce[_0xe05a('0x23')]!==_0x52cbee['loggedInDb']||_0x3987ce[_0xe05a('0x24')]!==_0x52cbee['paused']||_0x3987ce['talking']!==_0x52cbee['talking']||_0x3987ce[_0xe05a('0x25')]!==_0x52cbee[_0xe05a('0x25')]||_0x3987ce[_0xe05a('0x26')]!==_0x52cbee[_0xe05a('0x26')]||_0x3987ce[_0xe05a('0x27')]!==_0x52cbee[_0xe05a('0x27')]||_0x3987ce['originated']!==_0x52cbee['originated'];if(_0x3987ce[_0xe05a('0x28')]&&_0x52cbee[_0xe05a('0x28')]){_0x3039a1=_0x3987ce[_0xe05a('0x28')]['name']!==_0x52cbee[_0xe05a('0x28')][_0xe05a('0x29')]||_0x3987ce[_0xe05a('0x28')][_0xe05a('0x2a')]!==_0x52cbee['Trunk']['active'];}return _0x365e36||_0x225662||_0x3039a1;}exports[_0xe05a('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5a01aa){var _0x2f243d=null;var _0x2f187f=_0x5a01aa[_0xe05a('0x2c')];if(_[_0xe05a('0x2d')](_0x5a01aa[_0xe05a('0x2e')])||_[_0xe05a('0x2d')](_0x5a01aa[_0xe05a('0x2f')])||_[_0xe05a('0x2d')](_0x5a01aa[_0xe05a('0x2f')][_0xe05a('0x30')])){_0x2f243d=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_['isEmpty'](_0x5a01aa['dialGlobalInterval'])||_[_0xe05a('0x31')](_0x5a01aa[_0xe05a('0x2f')][_0xe05a('0x30')])){_0x2f243d=CAMPAIGN_STATUS[_0xe05a('0x32')];}else if(_0x2f187f&&!timezones[_0x2f187f]){_0x2f243d=CAMPAIGN_STATUS[_0xe05a('0x33')];}return _0x2f243d;}function checkAnyValidTrunk(_0x8c5666,_0x2a0fe6){var _0x4db885=null;var _0x4df893=_0xe05a('0x34');var _0x136f66=[_0xe05a('0x35'),_0xe05a('0x36')];var _0x2b21eb=!![];if(_0x8c5666['Trunk']&&_0x8c5666[_0xe05a('0x28')][_0xe05a('0x2a')]){_0x4df893+=_0x8c5666[_0xe05a('0x28')]['name'];_0x4db885=_0x2a0fe6[_0x4df893];_0x2b21eb=_0x136f66[_0xe05a('0x37')](_0x4db885['status']);}else if(_0x8c5666[_0xe05a('0x38')]&&_0x8c5666[_0xe05a('0x38')][_0xe05a('0x2a')]){_0x4df893+=_0x8c5666[_0xe05a('0x38')][_0xe05a('0x29')];_0x4db885=_0x2a0fe6[_0x4df893];_0x2b21eb=_0x136f66['includes'](_0x4db885[_0xe05a('0x39')]);}return _0x2b21eb;}function getQueueCampaignStatusMessage(_0x120a32,_0x52c9d3){var _0x372571=CAMPAIGN_STATUS[_0xe05a('0x6')];var _0x367c08=isPreviewCampaign(_0x120a32);if(!isQueueCampaignActive(_0x120a32)){if(_0x367c08){_0x372571=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x120a32[_0xe05a('0x3a')]===0x0&&_0x120a32['talking']===0x0&&_0x120a32['waiting']===0x0&&(_0x120a32['pTalking']||0x0)===0x0){_0x372571=CAMPAIGN_STATUS['INACTIVE'];}else{_0x372571=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x120a32[_0xe05a('0x22')]===0x0){_0x372571=CAMPAIGN_STATUS[_0xe05a('0x3b')];}else if(!checkAnyValidTrunk(_0x120a32,_0x52c9d3)){_0x372571=CAMPAIGN_STATUS[_0xe05a('0x3c')];}else if(!isPreviewCampaign(_0x120a32)){var _0x14cfec=checkAnyValidQueueCampaignInterval(_0x120a32);if(_0x14cfec){_0x372571=_0x14cfec;}}return _0x372571;}exports[_0xe05a('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x42adac){var _0x4a3c11=CAMPAIGN_STATUS[_0xe05a('0x3e')];if(_0x42adac['originated']===0x0&&_0x42adac[_0xe05a('0x3f')]===0x0&&_0x42adac[_0xe05a('0x26')]===0x0&&(_0x42adac[_0xe05a('0x25')]||0x0)===0x0){_0x4a3c11=CAMPAIGN_STATUS[_0xe05a('0x40')];}return _0x4a3c11;}exports[_0xe05a('0x41')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4d10e6){var _0x13ccff=_0x4d10e6[_0xe05a('0x42')](/"(.*?)"/);return _0x13ccff?_0x13ccff[0x1]:_0x4d10e6;}exports[_0xe05a('0x43')]=extractCalleridName;function getCallerId(_0x1f733b,_0xa75d55,_0x3d5ba9){if(!_[_0xe05a('0x44')](_0x3d5ba9)&&typeof _0x3d5ba9===_0xe05a('0x45')&&!_[_0xe05a('0x31')](_0x3d5ba9)){if(!_[_0xe05a('0x44')](_0xa75d55)&&typeof _0xa75d55===_0xe05a('0x45')&&!_['isEmpty'](_0xa75d55)){return util['format'](_0xe05a('0x46'),_0xa75d55,_0x3d5ba9);}return util['format'](_0xe05a('0x46'),_0x3d5ba9,_0x3d5ba9);}if(!_[_0xe05a('0x44')](_0x1f733b)&&typeof _0x1f733b==='string'&&!_['isEmpty'](_0x1f733b)){return _0x1f733b;}return _0xe05a('0x47');}exports[_0xe05a('0x48')]=getCallerId;function getCallerIdRandom(_0x2961cf,_0x5e192e){var _0x2c9433;var _0x48aca5;var _0x2233df;if(_0x5e192e<=0x0){_0x5e192e=0x1;}_0x2c9433=new RegExp(_0xe05a('0x49')+_0x5e192e+'}$');_0x48aca5=Math[_0xe05a('0x4a')](0xa,_0x5e192e-0x1);_0x2233df=Math[_0xe05a('0x4a')](0xa,_0x5e192e)-0x1;return util[_0xe05a('0x4b')]('%s',_['replace'](_0x2961cf,_0x2c9433,_[_0xe05a('0x4c')](_0x48aca5,_0x2233df)[_0xe05a('0x4d')]()));}exports[_0xe05a('0x4e')]=getCallerIdRandom;function decrementOriginate(_0x26b461){if(_0x26b461[_0xe05a('0x3a')]&&_0x26b461['originated']>0x0){_0x26b461[_0xe05a('0x3a')]-=0x1;}else{logger[_0xe05a('0x4f')](_0xe05a('0x50'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x597581){return _0x597581&&_0x597581[_0xe05a('0x51')]>0x0;}exports[_0xe05a('0x52')]=checkContactEmpty;function erlangb(_0x7d681a,_0x37217a){if(_0x37217a===0x0){return 0x0;}var _0x2ac2a1=0x1;for(var _0x4b3529=0x1;_0x4b3529<=_0x37217a;_0x4b3529+=0x1){_0x2ac2a1=0x1+_0x2ac2a1*_0x4b3529/_0x7d681a;}return 0x1/_0x2ac2a1;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x5461b9,_0x41e782,_0xce1835){if(_0x41e782>_0xce1835){for(var _0x44e04b=0x0;_0x44e04b<_0x41e782-_0xce1835;_0x44e04b+=0x1){decrementOriginate(_0x5461b9);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x21bf52){var _0x5ed7f4={};var _0x515d24=['id','createdAt',_0xe05a('0x53'),_0xe05a('0x54')];const _0x4e500a=0xfa;if(_0x21bf52){for(var _0x552944 in _0x21bf52){if(typeof _0x21bf52[_0x552944]!=='undefined'){if(!_[_0xe05a('0x2d')](_0x21bf52[_0x552944])&&!_0x515d24[_0xe05a('0x37')](_0x552944)){if(_0x552944===_0xe05a('0x55')&&_0x21bf52[_0x552944][_0xe05a('0x51')]>_0x4e500a){_0x5ed7f4['XMD-'+_0x552944[_0xe05a('0x56')]()]=_0x21bf52[_0x552944][_0xe05a('0x4d')]()[_0xe05a('0x57')](0x0,_0x4e500a);}else{_0x5ed7f4['XMD-'+_0x552944[_0xe05a('0x56')]()]=_0x21bf52[_0x552944];}}}}}return _0x5ed7f4;}exports[_0xe05a('0x58')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 10113e7..2d787ef 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x4628c6,_0x212c5e){var _0x181ddc=function(_0x36280a){while(--_0x36280a){_0x4628c6['push'](_0x4628c6['shift']());}};_0x181ddc(++_0x212c5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x400f7c,_0x2f7975){var _0x1917c1=function(_0x243904){while(--_0x243904){_0x400f7c['push'](_0x400f7c['shift']());}};_0x1917c1(++_0x2f7975);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 3dad377..39dc87f 100644 --- a/server/services/ami/fax/index.js +++ b/server/services/ami/fax/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x962f=['syncNewState','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','uniqueid','\x20syncNewchannel\x20','channel','info','syncVarSet','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','name','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','then','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','path','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset'];(function(_0x3c9cf4,_0x44bde0){var _0xc0cca7=function(_0x28b0a6){while(--_0x28b0a6){_0x3c9cf4['push'](_0x3c9cf4['shift']());}};_0xc0cca7(++_0x44bde0);}(_0x962f,0xc0));var _0xf962=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x962f[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xf962('0x0'));var _=require(_0xf962('0x1'));var BPromise=require(_0xf962('0x2'));var uuid=require('uuid');var moment=require(_0xf962('0x3'));var path=require('path');var tiff2pdf=require(_0xf962('0x4'));var gs=require(_0xf962('0x5'));var logger=require(_0xf962('0x6'))(_0xf962('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0xf962('0x8'));var ut=require(_0xf962('0x9'));var Action=require('./action');var faxAccount=require(_0xf962('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xf962('0xb'));function Fax(_0x10faa7){this[_0xf962('0xc')]={};this[_0xf962('0xd')]=_0x10faa7['faxAccounts'];this['trunks']=_0x10faa7[_0xf962('0xe')];this[_0xf962('0xf')]={};ami['on'](_0xf962('0x10'),this[_0xf962('0x11')][_0xf962('0x12')](this));ami['on'](_0xf962('0x13'),this['syncVarSet'][_0xf962('0x12')](this));ami['on']('newstate',this[_0xf962('0x14')][_0xf962('0x12')](this));ami['on']('newexten',this[_0xf962('0x15')][_0xf962('0x12')](this));ami['on'](_0xf962('0x16'),this[_0xf962('0x17')]['bind'](this));ami['on']('receivefax',this[_0xf962('0x18')][_0xf962('0x12')](this));ami['on']('hangup',this[_0xf962('0x19')][_0xf962('0x12')](this));ami['on']('originateresponse',this[_0xf962('0x1a')][_0xf962('0x12')](this));}Fax[_0xf962('0x1b')]['syncNewchannel']=function(_0x282323){if(_0x282323[_0xf962('0x1c')]===_0xf962('0x1d')){for(var _0x4a34da in this[_0xf962('0xd')]){if(this[_0xf962('0xd')][_0xf962('0x1e')](_0x4a34da)){if(_0x282323['exten']===this[_0xf962('0xd')][_0x4a34da]['localstationid']){this[_0xf962('0xc')][_0x282323['uniqueid']]={};this[_0xf962('0xc')][_0x282323[_0xf962('0x1f')]]['channel']=_0x282323['channel'];this[_0xf962('0xc')][_0x282323[_0xf962('0x1f')]]['id']=this[_0xf962('0xd')][_0x4a34da]['id'];this['channels'][_0x282323['uniqueid']]['name']=this[_0xf962('0xd')][_0x4a34da]['name'];logger['info'](_0x282323[_0xf962('0x1f')],_0xf962('0x20'));}}}}if(this[_0xf962('0xf')][_0x282323[_0xf962('0x1f')]]){this[_0xf962('0xc')][_0x282323[_0xf962('0x1f')]]={};this[_0xf962('0xc')][_0x282323[_0xf962('0x1f')]][_0xf962('0x21')]=_0x282323['channel'];logger[_0xf962('0x22')](_0x282323['uniqueid'],_0xf962('0x20'));}};Fax[_0xf962('0x1b')][_0xf962('0x23')]=function(_0x2c6900){if(this['channels'][_0x2c6900[_0xf962('0x1f')]]){for(var _0xcedebb in _0x2c6900['variable']){if(_0x2c6900['variable'][_0xf962('0x1e')](_0xcedebb)){this[_0xf962('0xc')][_0x2c6900[_0xf962('0x1f')]][_0xcedebb]=_0x2c6900['value'];}}}};Fax['prototype'][_0xf962('0x14')]=function(_0x17bdbb){if(this[_0xf962('0xc')][_0x17bdbb[_0xf962('0x1f')]]){this[_0xf962('0xc')][_0x17bdbb['uniqueid']][_0xf962('0x24')]=_0x17bdbb[_0xf962('0x24')];this[_0xf962('0xc')][_0x17bdbb['uniqueid']][_0xf962('0x25')]=_0x17bdbb[_0xf962('0x25')];}};Fax[_0xf962('0x1b')][_0xf962('0x15')]=function(_0xb0d4c3){if(this['channels'][_0xb0d4c3[_0xf962('0x1f')]]){for(var _0x242379 in _0xb0d4c3['variable']){if(_0xb0d4c3['variable']['hasOwnProperty'](_0x242379)){this[_0xf962('0xc')][_0xb0d4c3[_0xf962('0x1f')]][_0x242379]=_0xb0d4c3[_0xf962('0x26')];}}}};Fax[_0xf962('0x1b')]['syncFaxStatus']=function(_0x3065fb){if(this[_0xf962('0xc')][_0x3065fb[_0xf962('0x1f')]]){this[_0xf962('0xc')][_0x3065fb['uniqueid']][_0xf962('0x27')]=_0x3065fb[_0xf962('0x27')];this[_0xf962('0xc')][_0x3065fb[_0xf962('0x1f')]][_0xf962('0x28')]=_0x3065fb[_0xf962('0x28')];this[_0xf962('0xc')][_0x3065fb['uniqueid']][_0xf962('0x29')]=_0x3065fb[_0xf962('0x29')];this[_0xf962('0xc')][_0x3065fb[_0xf962('0x1f')]][_0xf962('0x2a')]=_0x3065fb['filename'];logger['info'](_0x3065fb[_0xf962('0x1f')],_0xf962('0x2b'));}};Fax['prototype'][_0xf962('0x18')]=function(_0x5087a4){var _0x5ae19d=this;if(this[_0xf962('0xc')][_0x5087a4[_0xf962('0x1f')]]){var _0xc251f=this[_0xf962('0xc')][_0x5087a4[_0xf962('0x1f')]]['id'];this[_0xf962('0xc')][_0x5087a4['uniqueid']][_0xf962('0x2c')]=_0x5087a4[_0xf962('0x2c')];this['channels'][_0x5087a4[_0xf962('0x1f')]][_0xf962('0x2d')]=_0x5087a4[_0xf962('0x2d')];this[_0xf962('0xc')][_0x5087a4[_0xf962('0x1f')]][_0xf962('0x29')]=_0x5087a4[_0xf962('0x29')];this[_0xf962('0xc')][_0x5087a4['uniqueid']]['resolution']=_0x5087a4['resolution'];this[_0xf962('0xc')][_0x5087a4[_0xf962('0x1f')]]['transferrate']=_0x5087a4[_0xf962('0x2e')];this[_0xf962('0xc')][_0x5087a4[_0xf962('0x1f')]]['filename']=_0x5087a4['filename'];this['channels'][_0x5087a4[_0xf962('0x1f')]][_0xf962('0x2f')]=_0x5087a4[_0xf962('0x2f')];if(this['channels'][_0x5087a4[_0xf962('0x1f')]][_0xf962('0x2d')]>0x0){tiff2pdf(_0x5087a4[_0xf962('0x2a')],_0xf962('0x30'),function(_0x392efe){logger[_0xf962('0x22')](_0x5087a4[_0xf962('0x1f')],'\x20result\x20conversion\x20file\x20',_0x392efe[_0xf962('0x31')]);attachment[_0xf962('0x32')]({'name':path[_0xf962('0x33')](_0x5087a4[_0xf962('0x2a')])[_0xf962('0x34')],'basename':path[_0xf962('0x33')](_0x5087a4[_0xf962('0x2a')])[_0xf962('0x34')]+_0xf962('0x35'),'type':'application/pdf'})['then'](function(_0x1708c1){faxAccount['notify'](_0xc251f,{'from':_0x5087a4[_0xf962('0x2f')],'mapKey':_0xf962('0x7'),'body':path[_0xf962('0x33')](_0x5087a4['filename'])['name']+'.pdf','AttachmentId':_0x1708c1['id']})[_0xf962('0x36')](function(_0x4562c6){logger['error'](_0x5087a4[_0xf962('0x1f')],_0xf962('0x37'),JSON[_0xf962('0x38')](_0x4562c6));});})['catch'](function(_0x4d1f60){logger[_0xf962('0x39')](_0x5087a4[_0xf962('0x1f')],_0xf962('0x3a'),JSON[_0xf962('0x38')](_0x4d1f60));});});}logger[_0xf962('0x22')](_0x5087a4['uniqueid'],_0xf962('0x3a'));}};Fax[_0xf962('0x1b')][_0xf962('0x1a')]=function(_0x29489a){if(this[_0xf962('0xf')][_0x29489a[_0xf962('0x1f')]]){_['merge'](this['channels'][_0x29489a[_0xf962('0x1f')]],_[_0xf962('0x3b')](_0x29489a,[_0xf962('0x3c'),_0xf962('0x3d')]));}};function updateStatus(_0x1988d3){if(_0x1988d3[_0xf962('0x3e')]){faxMessage[_0xf962('0x3f')](_0x1988d3[_0xf962('0x3e')],{'failMessage':_0xf962('0x40')})['then'](function(_0x53f2e5){ut[_0xf962('0x41')]('[Fax][Message][Error][Updated]',_0x53f2e5);})[_0xf962('0x36')](function(_0x58fd22){ut['logger'](_0xf962('0x42'),_0x58fd22);});}else{ut[_0xf962('0x41')](_0xf962('0x43'));}}Fax[_0xf962('0x1b')][_0xf962('0x44')]=function(_0x1617f3,_0x57436a,_0x436438){var _0x3a1ae8=this;var _0x4e8dac={};if(_0x57436a){_0x4e8dac={'read':_0x57436a};}else{_0x4e8dac={'failMessage':_0x436438};}if(this[_0xf962('0xf')][_0x1617f3][_0xf962('0x3e')]){faxMessage[_0xf962('0x3f')](this[_0xf962('0xf')][_0x1617f3][_0xf962('0x3e')],_0x4e8dac)['then'](function(_0x425575){ut['logger']('[Fax][Message][Updated]',_0x425575);})['catch'](function(_0x209783){ut[_0xf962('0x41')](_0xf962('0x45'),_0x209783);})['finally'](function(){delete _0x3a1ae8[_0xf962('0xc')][_0x1617f3];delete _0x3a1ae8[_0xf962('0xf')][_0x1617f3];});}else{ut[_0xf962('0x41')](_0xf962('0x46'));delete this[_0xf962('0xc')][_0x1617f3];delete this[_0xf962('0xf')][_0x1617f3];}};Fax['prototype'][_0xf962('0x19')]=function(_0x6cb6c1){var _0xd09c80=this;if(this['channels'][_0x6cb6c1[_0xf962('0x1f')]]){if(this['actions'][_0x6cb6c1[_0xf962('0x1f')]]){this['channels'][_0x6cb6c1['uniqueid']]['id']=this[_0xf962('0xf')][_0x6cb6c1[_0xf962('0x1f')]]['id'];this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]]['name']=this[_0xf962('0xf')][_0x6cb6c1['uniqueid']][_0xf962('0x34')];}logger[_0xf962('0x22')](_0x6cb6c1[_0xf962('0x1f')],this[_0xf962('0xf')][_0x6cb6c1['uniqueid']]?_0xf962('0x47'):_0xf962('0x48'),JSON[_0xf962('0x38')](this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]]));if(this[_0xf962('0xf')][_0x6cb6c1[_0xf962('0x1f')]]){if(this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]]['faxpages']>0x0&&this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]]['faxstatus']===_0xf962('0x49')){this[_0xf962('0x44')](_0x6cb6c1[_0xf962('0x1f')],!![]);}else{this[_0xf962('0x44')](_0x6cb6c1[_0xf962('0x1f')],![],this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]]['faxstatusstring']?_0xf962('0x4a')+this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]][_0xf962('0x4b')]:_0xf962('0x4c'));}}}};Fax[_0xf962('0x1b')]['send']=function(_0x5a653d){var _0x441454=this;return new BPromise(function(_0x2037de,_0xed71ae){_0x441454[_0xf962('0x4d')](_0x5a653d,_0x441454[_0xf962('0xd')][_0x5a653d[_0xf962('0x4e')]])[_0xf962('0x4f')](function(_0x47e564){ut[_0xf962('0x41')](_0xf962('0x50'),_0x47e564);_0x2037de(ut[_0xf962('0x31')](_0xf962('0x51')));})[_0xf962('0x36')](function(_0x2a638d){ut['logger'](_0xf962('0x52'),_0x2a638d);updateStatus(_0x5a653d);_0xed71ae(ut[_0xf962('0x31')](_0xf962('0x53')));});});};Fax[_0xf962('0x1b')][_0xf962('0x54')]=function(_0x1e7e2f){var _0x300d6a=this;return new BPromise(function(_0x53e23b,_0x2a4041){var _0x456700=_0x300d6a[_0xf962('0x55')](_0x300d6a[_0xf962('0xd')][_0x1e7e2f[_0xf962('0x4e')]][_0xf962('0x56')],_0x1e7e2f);if(_0x456700[_0xf962('0x57')]){_0x53e23b(ut[_0xf962('0x31')]('Trunk\x20Reachable'));}else{_0x2a4041(ut['message'](_0x456700[_0xf962('0x31')]));}});};function originate(_0xc10f89,_0x4bb9e4,_0x4ca5c4){return new BPromise(function(_0x20d161,_0x35ad9e){if(_0x4ca5c4){var _0x489bfb=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0xc10f89[_0xf962('0x58')])['name'],_0xc10f89[_0xf962('0x58')]);gs['execute'](_0x489bfb)['then'](function(){_0xc10f89[_0xf962('0x58')]=util[_0xf962('0x59')](_0xf962('0x5a'),path[_0xf962('0x33')](_0xc10f89[_0xf962('0x58')])[_0xf962('0x5b')],path[_0xf962('0x33')](_0xc10f89['path'])['name']);_0x4bb9e4[_0xf962('0x5c')]=_0xc10f89[_0xf962('0x58')];ut[_0xf962('0x41')](_0xf962('0x5d'),'');ami[_0xf962('0x5e')](ut[_0xf962('0x5f')](_0xc10f89,_0x4bb9e4))[_0xf962('0x4f')](function(_0x290d60){_0x20d161(_0x290d60);})[_0xf962('0x36')](function(_0x5ea1c7){_0x35ad9e(_0x5ea1c7);});})[_0xf962('0x36')](function(_0x20aa57){_0x35ad9e(_0x20aa57);});}else{ami[_0xf962('0x5e')](ut[_0xf962('0x5f')](_0xc10f89,_0x4bb9e4))[_0xf962('0x4f')](function(_0x408aa6){_0x20d161(_0x408aa6);})['catch'](function(_0x34fa29){_0x35ad9e(_0x34fa29);});}});}Fax[_0xf962('0x1b')][_0xf962('0x4d')]=function(_0x2085fb,_0x53fca1){var _0x4394bd=this;return new BPromise(function(_0x26d0eb,_0x326b29){var _0x367f2c=uuid['v4']();var _0x32f7d0=ut['addVariables'](_0x2085fb,_0x53fca1);_0x4394bd[_0xf962('0xf')][_0x367f2c]=new Action(_0x367f2c,_0x53fca1,_0x2085fb);var _0x1acf9e=_0x4394bd[_0xf962('0xf')][_0x367f2c];if(path['parse'](_0x2085fb[_0xf962('0x58')])[_0xf962('0x60')]===_0xf962('0x35')){originate(_0x1acf9e,_0x32f7d0,!![])[_0xf962('0x4f')](function(_0x4460a9){_0x26d0eb(_0x4460a9);})[_0xf962('0x36')](function(_0x4d295d){_0x326b29(_0x4d295d);});}else{originate(_0x1acf9e,_0x32f7d0,![])['then'](function(_0x4a3565){_0x26d0eb(_0x4a3565);})[_0xf962('0x36')](function(_0x1939a7){_0x326b29(_0x1939a7);});}});};Fax[_0xf962('0x1b')][_0xf962('0x61')]=function(_0x33b17e){return!_[_0xf962('0x62')](_0x33b17e)&&!_[_0xf962('0x62')](_0x33b17e[_0xf962('0x34')])&&!_[_0xf962('0x62')](_0x33b17e['active'])&&_0x33b17e[_0xf962('0x63')]&&!_[_0xf962('0x62')](this[_0xf962('0xe')][util['format']('SIP/%s',_0x33b17e[_0xf962('0x34')])])&&!_[_0xf962('0x62')](this[_0xf962('0xe')][util['format'](_0xf962('0x64'),_0x33b17e[_0xf962('0x34')])][_0xf962('0x28')])&&(this[_0xf962('0xe')][util[_0xf962('0x59')](_0xf962('0x64'),_0x33b17e['name'])][_0xf962('0x28')]==='reachable'||this[_0xf962('0xe')][util['format']('SIP/%s',_0x33b17e['name'])][_0xf962('0x28')]==='unmonitored');};Fax[_0xf962('0x1b')][_0xf962('0x55')]=function(_0x52084a,_0x17b53e){if(!this[_0xf962('0x61')](_0x52084a)){ut[_0xf962('0x41')](_0xf962('0x65'),_[_0xf962('0x62')](_0x52084a)?'':_0x52084a[_0xf962('0x34')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xf962('0x66')};}if(_[_0xf962('0x62')](_0x17b53e[_0xf962('0x7')])){ut['logger'](_0xf962('0x67'),JSON[_0xf962('0x38')](_0x17b53e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xf962('0x62')](_0x17b53e['path'])){ut['logger'](_0xf962('0x68'),JSON[_0xf962('0x38')](_0x17b53e));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xf962('0x69')};};module['exports']=Fax; \ No newline at end of file +var _0xe073=['channels','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','merge','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','syncHangup','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe073,0x1b6));var _0x3e07=function(_0x3292d2,_0x44ca80){_0x3292d2=_0x3292d2-0x0;var _0x2b6be4=_0xe073[_0x3292d2];return _0x2b6be4;};'use strict';var util=require(_0x3e07('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x3e07('0x1'));var moment=require(_0x3e07('0x2'));var path=require(_0x3e07('0x3'));var tiff2pdf=require(_0x3e07('0x4'));var gs=require('./util/gs');var logger=require(_0x3e07('0x5'))(_0x3e07('0x6'));var ami=require(_0x3e07('0x7'));var rpcDb=require(_0x3e07('0x8'));var Channel=require(_0x3e07('0x9'));var ut=require(_0x3e07('0xa'));var Action=require(_0x3e07('0xb'));var faxAccount=require(_0x3e07('0xc'));var attachment=require(_0x3e07('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0xc85504){this[_0x3e07('0xe')]={};this['faxAccounts']=_0xc85504[_0x3e07('0xf')];this[_0x3e07('0x10')]=_0xc85504['trunks'];this[_0x3e07('0x11')]={};ami['on'](_0x3e07('0x12'),this['syncNewchannel'][_0x3e07('0x13')](this));ami['on']('varset',this[_0x3e07('0x14')][_0x3e07('0x13')](this));ami['on'](_0x3e07('0x15'),this[_0x3e07('0x16')][_0x3e07('0x13')](this));ami['on'](_0x3e07('0x17'),this[_0x3e07('0x18')][_0x3e07('0x13')](this));ami['on'](_0x3e07('0x19'),this[_0x3e07('0x1a')][_0x3e07('0x13')](this));ami['on'](_0x3e07('0x1b'),this[_0x3e07('0x1c')][_0x3e07('0x13')](this));ami['on'](_0x3e07('0x1d'),this['syncHangup']['bind'](this));ami['on'](_0x3e07('0x1e'),this[_0x3e07('0x1f')][_0x3e07('0x13')](this));}Fax[_0x3e07('0x20')]['syncNewchannel']=function(_0x500e33){if(_0x500e33['context']===_0x3e07('0x21')){for(var _0x3f5993 in this[_0x3e07('0xf')]){if(this[_0x3e07('0xf')][_0x3e07('0x22')](_0x3f5993)){if(_0x500e33[_0x3e07('0x23')]===this[_0x3e07('0xf')][_0x3f5993][_0x3e07('0x24')]){this[_0x3e07('0xe')][_0x500e33[_0x3e07('0x25')]]={};this[_0x3e07('0xe')][_0x500e33['uniqueid']]['channel']=_0x500e33[_0x3e07('0x26')];this[_0x3e07('0xe')][_0x500e33['uniqueid']]['id']=this['faxAccounts'][_0x3f5993]['id'];this[_0x3e07('0xe')][_0x500e33['uniqueid']][_0x3e07('0x27')]=this[_0x3e07('0xf')][_0x3f5993]['name'];logger[_0x3e07('0x28')](_0x500e33[_0x3e07('0x25')],_0x3e07('0x29'));}}}}if(this['actions'][_0x500e33[_0x3e07('0x25')]]){this[_0x3e07('0xe')][_0x500e33[_0x3e07('0x25')]]={};this[_0x3e07('0xe')][_0x500e33[_0x3e07('0x25')]]['channel']=_0x500e33[_0x3e07('0x26')];logger[_0x3e07('0x28')](_0x500e33[_0x3e07('0x25')],_0x3e07('0x29'));}};Fax[_0x3e07('0x20')][_0x3e07('0x14')]=function(_0x1388c5){if(this[_0x3e07('0xe')][_0x1388c5[_0x3e07('0x25')]]){for(var _0x555b6b in _0x1388c5[_0x3e07('0x2a')]){if(_0x1388c5[_0x3e07('0x2a')]['hasOwnProperty'](_0x555b6b)){this['channels'][_0x1388c5[_0x3e07('0x25')]][_0x555b6b]=_0x1388c5[_0x3e07('0x2b')];}}}};Fax['prototype']['syncNewState']=function(_0x3a223e){if(this[_0x3e07('0xe')][_0x3a223e[_0x3e07('0x25')]]){this[_0x3e07('0xe')][_0x3a223e[_0x3e07('0x25')]][_0x3e07('0x2c')]=_0x3a223e[_0x3e07('0x2c')];this[_0x3e07('0xe')][_0x3a223e[_0x3e07('0x25')]][_0x3e07('0x2d')]=_0x3a223e[_0x3e07('0x2d')];}};Fax[_0x3e07('0x20')][_0x3e07('0x18')]=function(_0x58a2cc){if(this[_0x3e07('0xe')][_0x58a2cc[_0x3e07('0x25')]]){for(var _0x1cbbcd in _0x58a2cc['variable']){if(_0x58a2cc[_0x3e07('0x2a')][_0x3e07('0x22')](_0x1cbbcd)){this['channels'][_0x58a2cc['uniqueid']][_0x1cbbcd]=_0x58a2cc[_0x3e07('0x2b')];}}}};Fax[_0x3e07('0x20')][_0x3e07('0x1a')]=function(_0xcd78c3){if(this['channels'][_0xcd78c3[_0x3e07('0x25')]]){this[_0x3e07('0xe')][_0xcd78c3['uniqueid']]['operation']=_0xcd78c3[_0x3e07('0x2e')];this['channels'][_0xcd78c3[_0x3e07('0x25')]][_0x3e07('0x2f')]=_0xcd78c3['status'];this[_0x3e07('0xe')][_0xcd78c3[_0x3e07('0x25')]][_0x3e07('0x24')]=_0xcd78c3['localstationid'];this[_0x3e07('0xe')][_0xcd78c3[_0x3e07('0x25')]][_0x3e07('0x30')]=_0xcd78c3['filename'];logger[_0x3e07('0x28')](_0xcd78c3[_0x3e07('0x25')],_0x3e07('0x31'));}};Fax[_0x3e07('0x20')][_0x3e07('0x1c')]=function(_0x28b58a){var _0x510fd5=this;if(this[_0x3e07('0xe')][_0x28b58a['uniqueid']]){var _0x2e12ba=this[_0x3e07('0xe')][_0x28b58a[_0x3e07('0x25')]]['id'];this[_0x3e07('0xe')][_0x28b58a['uniqueid']]['remotestationid']=_0x28b58a[_0x3e07('0x32')];this['channels'][_0x28b58a[_0x3e07('0x25')]][_0x3e07('0x33')]=_0x28b58a['pagestransferred'];this['channels'][_0x28b58a[_0x3e07('0x25')]][_0x3e07('0x24')]=_0x28b58a[_0x3e07('0x24')];this[_0x3e07('0xe')][_0x28b58a[_0x3e07('0x25')]][_0x3e07('0x34')]=_0x28b58a['resolution'];this[_0x3e07('0xe')][_0x28b58a[_0x3e07('0x25')]][_0x3e07('0x35')]=_0x28b58a[_0x3e07('0x35')];this['channels'][_0x28b58a[_0x3e07('0x25')]][_0x3e07('0x30')]=_0x28b58a[_0x3e07('0x30')];this['channels'][_0x28b58a['uniqueid']][_0x3e07('0x36')]=_0x28b58a[_0x3e07('0x36')];if(this[_0x3e07('0xe')][_0x28b58a[_0x3e07('0x25')]][_0x3e07('0x33')]>0x0){tiff2pdf(_0x28b58a['filename'],_0x3e07('0x37'),function(_0xd5f0cc){logger[_0x3e07('0x28')](_0x28b58a[_0x3e07('0x25')],'\x20result\x20conversion\x20file\x20',_0xd5f0cc[_0x3e07('0x38')]);attachment[_0x3e07('0x39')]({'name':path[_0x3e07('0x3a')](_0x28b58a[_0x3e07('0x30')])[_0x3e07('0x27')],'basename':path[_0x3e07('0x3a')](_0x28b58a[_0x3e07('0x30')])[_0x3e07('0x27')]+_0x3e07('0x3b'),'type':_0x3e07('0x3c')})[_0x3e07('0x3d')](function(_0x1bc778){faxAccount['notify'](_0x2e12ba,{'from':_0x28b58a[_0x3e07('0x36')],'mapKey':'fax','body':path[_0x3e07('0x3a')](_0x28b58a[_0x3e07('0x30')])[_0x3e07('0x27')]+_0x3e07('0x3b'),'AttachmentId':_0x1bc778['id']})[_0x3e07('0x3e')](function(_0x3baba2){logger['error'](_0x28b58a[_0x3e07('0x25')],_0x3e07('0x3f'),JSON['stringify'](_0x3baba2));});})[_0x3e07('0x3e')](function(_0x1beeea){logger[_0x3e07('0x40')](_0x28b58a['uniqueid'],_0x3e07('0x41'),JSON[_0x3e07('0x42')](_0x1beeea));});});}logger[_0x3e07('0x28')](_0x28b58a[_0x3e07('0x25')],_0x3e07('0x41'));}};Fax[_0x3e07('0x20')][_0x3e07('0x1f')]=function(_0x47bdf4){if(this[_0x3e07('0x11')][_0x47bdf4['uniqueid']]){_[_0x3e07('0x43')](this['channels'][_0x47bdf4['uniqueid']],_['pick'](_0x47bdf4,[_0x3e07('0x44'),'reason']));}};function updateStatus(_0x47d743){if(_0x47d743[_0x3e07('0x45')]){faxMessage[_0x3e07('0x46')](_0x47d743[_0x3e07('0x45')],{'failMessage':_0x3e07('0x47')})[_0x3e07('0x3d')](function(_0x4b5f47){ut[_0x3e07('0x48')](_0x3e07('0x49'),_0x4b5f47);})[_0x3e07('0x3e')](function(_0x99c1d8){ut[_0x3e07('0x48')](_0x3e07('0x4a'),_0x99c1d8);});}else{ut[_0x3e07('0x48')](_0x3e07('0x4b'));}}Fax[_0x3e07('0x20')][_0x3e07('0x4c')]=function(_0x4cb847,_0x3d050,_0x5312d0){var _0x508bf9=this;var _0x36d85c={};if(_0x3d050){_0x36d85c={'read':_0x3d050};}else{_0x36d85c={'failMessage':_0x5312d0};}if(this[_0x3e07('0x11')][_0x4cb847]['AttachmentId']){faxMessage[_0x3e07('0x46')](this[_0x3e07('0x11')][_0x4cb847][_0x3e07('0x45')],_0x36d85c)[_0x3e07('0x3d')](function(_0x282242){ut[_0x3e07('0x48')]('[Fax][Message][Updated]',_0x282242);})[_0x3e07('0x3e')](function(_0x5f2d8b){ut[_0x3e07('0x48')]('[Fax][Message][NoUpdate1]',_0x5f2d8b);})[_0x3e07('0x4d')](function(){delete _0x508bf9[_0x3e07('0xe')][_0x4cb847];delete _0x508bf9[_0x3e07('0x11')][_0x4cb847];});}else{ut[_0x3e07('0x48')]('[Fax][Message][NoUpdate2]');delete this[_0x3e07('0xe')][_0x4cb847];delete this[_0x3e07('0x11')][_0x4cb847];}};Fax[_0x3e07('0x20')][_0x3e07('0x4e')]=function(_0x1b4dfa){var _0x5ecfa8=this;if(this['channels'][_0x1b4dfa['uniqueid']]){if(this['actions'][_0x1b4dfa['uniqueid']]){this['channels'][_0x1b4dfa['uniqueid']]['id']=this[_0x3e07('0x11')][_0x1b4dfa['uniqueid']]['id'];this['channels'][_0x1b4dfa[_0x3e07('0x25')]][_0x3e07('0x27')]=this[_0x3e07('0x11')][_0x1b4dfa['uniqueid']][_0x3e07('0x27')];}logger[_0x3e07('0x28')](_0x1b4dfa[_0x3e07('0x25')],this[_0x3e07('0x11')][_0x1b4dfa[_0x3e07('0x25')]]?'\x20hangup\x20sendFile\x20':_0x3e07('0x4f'),JSON[_0x3e07('0x42')](this[_0x3e07('0xe')][_0x1b4dfa[_0x3e07('0x25')]]));if(this[_0x3e07('0x11')][_0x1b4dfa[_0x3e07('0x25')]]){if(this[_0x3e07('0xe')][_0x1b4dfa[_0x3e07('0x25')]]['faxpages']>0x0&&this[_0x3e07('0xe')][_0x1b4dfa[_0x3e07('0x25')]]['faxstatus']===_0x3e07('0x50')){this[_0x3e07('0x4c')](_0x1b4dfa['uniqueid'],!![]);}else{this[_0x3e07('0x4c')](_0x1b4dfa['uniqueid'],![],this[_0x3e07('0xe')][_0x1b4dfa[_0x3e07('0x25')]][_0x3e07('0x51')]?_0x3e07('0x52')+this[_0x3e07('0xe')][_0x1b4dfa['uniqueid']][_0x3e07('0x51')]:_0x3e07('0x53'));}}}};Fax[_0x3e07('0x20')]['send']=function(_0x34f59a){var _0x2e256c=this;return new BPromise(function(_0x3dc0c2,_0x3e0deb){_0x2e256c[_0x3e07('0x54')](_0x34f59a,_0x2e256c[_0x3e07('0xf')][_0x34f59a['FaxAccountId']])[_0x3e07('0x3d')](function(_0x1b0d6a){ut[_0x3e07('0x48')](_0x3e07('0x55'),_0x1b0d6a);_0x3dc0c2(ut['message']('Fax\x20received'));})[_0x3e07('0x3e')](function(_0x1a198c){ut[_0x3e07('0x48')](_0x3e07('0x56'),_0x1a198c);updateStatus(_0x34f59a);_0x3e0deb(ut[_0x3e07('0x38')](_0x3e07('0x57')));});});};Fax[_0x3e07('0x20')][_0x3e07('0x58')]=function(_0x200d57){var _0x51f434=this;return new BPromise(function(_0x171c02,_0x560326){var _0x55ed7d=_0x51f434[_0x3e07('0x59')](_0x51f434['faxAccounts'][_0x200d57[_0x3e07('0x5a')]][_0x3e07('0x5b')],_0x200d57);if(_0x55ed7d[_0x3e07('0x5c')]){_0x171c02(ut[_0x3e07('0x38')]('Trunk\x20Reachable'));}else{_0x560326(ut[_0x3e07('0x38')](_0x55ed7d[_0x3e07('0x38')]));}});};function originate(_0x529330,_0x39ef95,_0x8fc858){return new BPromise(function(_0x2f9c95,_0x31a168){if(_0x8fc858){var _0xe8f1dc=util[_0x3e07('0x5d')](_0x3e07('0x5e'),path[_0x3e07('0x3a')](_0x529330[_0x3e07('0x3')])['name'],_0x529330[_0x3e07('0x3')]);gs[_0x3e07('0x5f')](_0xe8f1dc)['then'](function(){_0x529330[_0x3e07('0x3')]=util[_0x3e07('0x5d')]('%s/%s.tif',path[_0x3e07('0x3a')](_0x529330['path'])[_0x3e07('0x60')],path['parse'](_0x529330['path'])[_0x3e07('0x27')]);_0x39ef95[_0x3e07('0x61')]=_0x529330[_0x3e07('0x3')];ut['logger'](_0x3e07('0x62'),'');ami[_0x3e07('0x63')](ut[_0x3e07('0x64')](_0x529330,_0x39ef95))[_0x3e07('0x3d')](function(_0x26a0ee){_0x2f9c95(_0x26a0ee);})['catch'](function(_0xee3e58){_0x31a168(_0xee3e58);});})[_0x3e07('0x3e')](function(_0x572836){_0x31a168(_0x572836);});}else{ami['Action'](ut['variablesAction'](_0x529330,_0x39ef95))[_0x3e07('0x3d')](function(_0x54508a){_0x2f9c95(_0x54508a);})[_0x3e07('0x3e')](function(_0x1f7015){_0x31a168(_0x1f7015);});}});}Fax[_0x3e07('0x20')][_0x3e07('0x54')]=function(_0x15d483,_0x3ac181){var _0x537522=this;return new BPromise(function(_0x39d925,_0x5ec882){var _0x5c030b=uuid['v4']();var _0x52de81=ut[_0x3e07('0x65')](_0x15d483,_0x3ac181);_0x537522[_0x3e07('0x11')][_0x5c030b]=new Action(_0x5c030b,_0x3ac181,_0x15d483);var _0x354d96=_0x537522['actions'][_0x5c030b];if(path[_0x3e07('0x3a')](_0x15d483[_0x3e07('0x3')])[_0x3e07('0x66')]===_0x3e07('0x3b')){originate(_0x354d96,_0x52de81,!![])['then'](function(_0x5b94fd){_0x39d925(_0x5b94fd);})['catch'](function(_0x4bfb75){_0x5ec882(_0x4bfb75);});}else{originate(_0x354d96,_0x52de81,![])[_0x3e07('0x3d')](function(_0x279c97){_0x39d925(_0x279c97);})[_0x3e07('0x3e')](function(_0x1b9484){_0x5ec882(_0x1b9484);});}});};Fax[_0x3e07('0x20')][_0x3e07('0x67')]=function(_0x4991cf){return!_[_0x3e07('0x68')](_0x4991cf)&&!_[_0x3e07('0x68')](_0x4991cf[_0x3e07('0x27')])&&!_[_0x3e07('0x68')](_0x4991cf[_0x3e07('0x69')])&&_0x4991cf[_0x3e07('0x69')]&&!_[_0x3e07('0x68')](this[_0x3e07('0x10')][util[_0x3e07('0x5d')](_0x3e07('0x6a'),_0x4991cf[_0x3e07('0x27')])])&&!_[_0x3e07('0x68')](this[_0x3e07('0x10')][util[_0x3e07('0x5d')](_0x3e07('0x6a'),_0x4991cf[_0x3e07('0x27')])][_0x3e07('0x2f')])&&(this[_0x3e07('0x10')][util['format'](_0x3e07('0x6a'),_0x4991cf[_0x3e07('0x27')])][_0x3e07('0x2f')]===_0x3e07('0x6b')||this[_0x3e07('0x10')][util[_0x3e07('0x5d')]('SIP/%s',_0x4991cf[_0x3e07('0x27')])][_0x3e07('0x2f')]==='unmonitored');};Fax[_0x3e07('0x20')][_0x3e07('0x59')]=function(_0x469763,_0x4187b5){if(!this[_0x3e07('0x67')](_0x469763)){ut[_0x3e07('0x48')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x3e07('0x68')](_0x469763)?'':_0x469763[_0x3e07('0x27')]+_0x3e07('0x6c'));return{'isValid':![],'message':_0x3e07('0x6d')};}if(_[_0x3e07('0x68')](_0x4187b5[_0x3e07('0x6')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x4187b5));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x3e07('0x68')](_0x4187b5[_0x3e07('0x3')])){ut[_0x3e07('0x48')](_0x3e07('0x6e'),JSON['stringify'](_0x4187b5));return{'isValid':![],'message':_0x3e07('0x6f')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x3e07('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 459a57d..e99c2f6 100644 --- a/server/services/ami/fax/rpcDb.js +++ b/server/services/ami/fax/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab61=['error','inspect','then','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','../rpc/faxAccount'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0xab61,0x74));var _0x1ab6=function(_0x22084f,_0x38bf02){_0x22084f=_0x22084f-0x0;var _0x48d702=_0xab61[_0x22084f];return _0x48d702;};'use strict';var util=require(_0x1ab6('0x0'));var BPromise=require(_0x1ab6('0x1'));var logger=require(_0x1ab6('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0x1ab6('0x3'));function loggerCatch(_0x4e50d8){return function(_0x2c490a){logger[_0x1ab6('0x4')](_0x4e50d8,util[_0x1ab6('0x5')](_0x2c490a,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x22c15e,_0x547a66){return BPromise['resolve']()[_0x1ab6('0x6')](faxAccount[_0x1ab6('0x7')](_0x22c15e,_0x547a66))[_0x1ab6('0x8')](loggerCatch(_0x1ab6('0x9')));}; \ No newline at end of file +var _0x3367=['util','../../../config/logger','../rpc/faxAccount','inspect','notify','catch'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0x3367,0x138));var _0x7336=function(_0x2f09d9,_0x1be464){_0x2f09d9=_0x2f09d9-0x0;var _0x1208b9=_0x3367[_0x2f09d9];return _0x1208b9;};'use strict';var util=require(_0x7336('0x0'));var BPromise=require('bluebird');var logger=require(_0x7336('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0x7336('0x2'));function loggerCatch(_0x17d35b){return function(_0x2bb5c9){logger['error'](_0x17d35b,util[_0x7336('0x3')](_0x2bb5c9,{'showHidden':![],'depth':null}));};}exports[_0x7336('0x4')]=function(_0x19d442,_0x4326bb){return BPromise['resolve']()['then'](faxAccount[_0x7336('0x4')](_0x19d442,_0x4326bb))[_0x7336('0x5')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 3a782f5..497ae2a 100644 --- a/server/services/ami/fax/util/gs.js +++ b/server/services/ami/fax/util/gs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a0c=['execute','info','inspect','util','bluebird','child_process','exec'];(function(_0x1f5e61,_0xbfa7bf){var _0x3ceb35=function(_0x1dc7ff){while(--_0x1dc7ff){_0x1f5e61['push'](_0x1f5e61['shift']());}};_0x3ceb35(++_0xbfa7bf);}(_0x6a0c,0x161));var _0xc6a0=function(_0x233a59,_0x1e7693){_0x233a59=_0x233a59-0x0;var _0x25845a=_0x6a0c[_0x233a59];return _0x25845a;};'use strict';var util=require(_0xc6a0('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xc6a0('0x1'));var exec=require(_0xc6a0('0x2'))[_0xc6a0('0x3')];exports[_0xc6a0('0x4')]=function(_0x48f428){return new BPromise(function(_0x4037c3,_0x1b5323){exec(_0x48f428,function(_0x5dc5f9,_0x46bc83,_0x5c8312){logger[_0xc6a0('0x5')]('Exec\x20gs',_0x46bc83);if(_0x5dc5f9){logger[_0xc6a0('0x5')]('Exec\x20gs','\x20Error\x20:',util[_0xc6a0('0x6')](_0x5dc5f9,{'showHidden':![],'depth':null}),_0x46bc83,_0x5c8312);_0x1b5323(_0x5dc5f9);}_0x4037c3(_0x46bc83);});});}; \ No newline at end of file +var _0x77de=['info','\x20Error\x20:','inspect','../../../../config/logger','fax','child_process','exec','Exec\x20gs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77de,0xe3));var _0xe77d=function(_0x3d5f84,_0x569548){_0x3d5f84=_0x3d5f84-0x0;var _0x1981b8=_0x77de[_0x3d5f84];return _0x1981b8;};'use strict';var util=require('util');var logger=require(_0xe77d('0x0'))(_0xe77d('0x1'));var BPromise=require('bluebird');var exec=require(_0xe77d('0x2'))[_0xe77d('0x3')];exports['execute']=function(_0x25bf1b){return new BPromise(function(_0x431499,_0x285a80){exec(_0x25bf1b,function(_0x404533,_0x73096b,_0x2fad1c){logger['info'](_0xe77d('0x4'),_0x73096b);if(_0x404533){logger[_0xe77d('0x5')](_0xe77d('0x4'),_0xe77d('0x6'),util[_0xe77d('0x7')](_0x404533,{'showHidden':![],'depth':null}),_0x73096b,_0x2fad1c);_0x285a80(_0x404533);}_0x431499(_0x73096b);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index f643b26..92aa471 100644 --- a/server/services/ami/fax/util/util.js +++ b/server/services/ami/fax/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0830=['modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','message','logger','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22'];(function(_0x401c74,_0x5b5774){var _0xd2982c=function(_0x2f8d43){while(--_0x2f8d43){_0x401c74['push'](_0x401c74['shift']());}};_0xd2982c(++_0x5b5774);}(_0x0830,0xd0));var _0x0083=function(_0x2226c1,_0x2bed75){_0x2226c1=_0x2226c1-0x0;var _0x178716=_0x0830[_0x2226c1];return _0x178716;};'use strict';var util=require(_0x0083('0x0'));var _=require(_0x0083('0x1'));var moment=require('moment');var logger=require(_0x0083('0x2'))('fax');exports[_0x0083('0x3')]=function(_0x4530e8){return{'message':_0x4530e8};};exports[_0x0083('0x4')]=function(_0x487be8,_0x36248c){logger['info'](_0x487be8,util[_0x0083('0x5')](_0x36248c,{'showHidden':![],'depth':null}));};exports[_0x0083('0x6')]=function(_0x325a7a,_0x6c6d03){var _0x58db2f={'XMF-ECM':_0x6c6d03[_0x0083('0x7')],'XMF-HEADERINFO':_0x6c6d03[_0x0083('0x8')],'XMF-MINRATE':_0x6c6d03[_0x0083('0x9')],'XMF-MAXRATE':_0x6c6d03['maxrate'],'XMF-MODEM':util[_0x0083('0xa')](_0x0083('0xb'),_0x6c6d03[_0x0083('0xc')]),'XMF-GATEWAY':_0x6c6d03[_0x0083('0xd')],'XMF-FAXDETECT':_0x6c6d03[_0x0083('0xe')],'XMF-T38TIMEOUT':_0x6c6d03[_0x0083('0xf')],'XMF-LOCALSTATIONID':_0x6c6d03['localstationid'],'XMF-PATH':_0x325a7a[_0x0083('0x10')]};return _0x58db2f;};exports[_0x0083('0x11')]=function(_0x15f21e,_0x129646){return{'actionid':_0x15f21e[_0x0083('0x12')],'action':_0x0083('0x13'),'channel':_0x15f21e[_0x0083('0x14')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x0083('0xa')](_0x0083('0x15'),_0x15f21e[_0x0083('0x8')]?_0x15f21e['headerinfo']:'',_0x15f21e['localstationid']),'variable':_0x129646,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x15f21e[_0x0083('0x12')]};}; \ No newline at end of file +var _0xe026=['lodash','moment','../../../../config/logger','message','logger','info','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util'];(function(_0x67e20,_0x5c9a58){var _0x2aa936=function(_0x4dea61){while(--_0x4dea61){_0x67e20['push'](_0x67e20['shift']());}};_0x2aa936(++_0x5c9a58);}(_0xe026,0x11f));var _0x6e02=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xe026[_0x1969a7];return _0x3d665f;};'use strict';var util=require(_0x6e02('0x0'));var _=require(_0x6e02('0x1'));var moment=require(_0x6e02('0x2'));var logger=require(_0x6e02('0x3'))('fax');exports[_0x6e02('0x4')]=function(_0x638fce){return{'message':_0x638fce};};exports[_0x6e02('0x5')]=function(_0x49e6b0,_0x23ae90){logger[_0x6e02('0x6')](_0x49e6b0,util['inspect'](_0x23ae90,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x180c87,_0x3b465b){var _0x1912c0={'XMF-ECM':_0x3b465b[_0x6e02('0x7')],'XMF-HEADERINFO':_0x3b465b[_0x6e02('0x8')],'XMF-MINRATE':_0x3b465b[_0x6e02('0x9')],'XMF-MAXRATE':_0x3b465b[_0x6e02('0xa')],'XMF-MODEM':util[_0x6e02('0xb')](_0x6e02('0xc'),_0x3b465b[_0x6e02('0xd')]),'XMF-GATEWAY':_0x3b465b[_0x6e02('0xe')],'XMF-FAXDETECT':_0x3b465b[_0x6e02('0xf')],'XMF-T38TIMEOUT':_0x3b465b['t38timeout'],'XMF-LOCALSTATIONID':_0x3b465b[_0x6e02('0x10')],'XMF-PATH':_0x180c87['path']};return _0x1912c0;};exports[_0x6e02('0x11')]=function(_0x4e5579,_0x49a028){return{'actionid':_0x4e5579[_0x6e02('0x12')],'action':_0x6e02('0x13'),'channel':_0x4e5579[_0x6e02('0x14')],'Exten':_0x6e02('0x15'),'Context':_0x6e02('0x16'),'Priority':'1','callerid':util['format'](_0x6e02('0x17'),_0x4e5579[_0x6e02('0x8')]?_0x4e5579['headerinfo']:'',_0x4e5579['localstationid']),'variable':_0x49a028,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4e5579[_0x6e02('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 500a4a4..2df99df 100644 --- a/server/services/ami/index.js +++ b/server/services/ami/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85b3=['getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts'];(function(_0x3da9e9,_0x594346){var _0x1a3aee=function(_0x4d0771){while(--_0x4d0771){_0x3da9e9['push'](_0x3da9e9['shift']());}};_0x1a3aee(++_0x594346);}(_0x85b3,0xe9));var _0x385b=function(_0x3b8ec4,_0x483b74){_0x3b8ec4=_0x3b8ec4-0x0;var _0x28b9f7=_0x85b3[_0x3b8ec4];return _0x28b9f7;};'use strict';var util=require(_0x385b('0x0'));var moment=require(_0x385b('0x1'));var server=require(_0x385b('0x2'));var Realtime=require(_0x385b('0x3'));var Report=require(_0x385b('0x4'));var Acw=require(_0x385b('0x5'));var Trigger=require(_0x385b('0x6'));var Dialer=require(_0x385b('0x7'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x385b('0x8'));var voiceQueue=require(_0x385b('0x9'));var voiceQueueReport=require(_0x385b('0xa'));var voiceCallReport=require(_0x385b('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x385b('0xc'));var cmHopperHistory=require(_0x385b('0xd'));var campaign=require(_0x385b('0xe'));var voiceExtension=require(_0x385b('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x385b('0x10'));var salesforce=require(_0x385b('0x11'));var sugarcrm=require(_0x385b('0x12'));var freshdesk=require(_0x385b('0x13'));var desk=require(_0x385b('0x14'));var zoho=require(_0x385b('0x15'));var vtiger=require(_0x385b('0x16'));var freshsales=require(_0x385b('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x385b('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x385b('0x19'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x385b('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x385b('0x1a')](_0x385b('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x385b('0x1c')]()[_0x385b('0x1d')](user[_0x385b('0x1e')]())[_0x385b('0x1d')](realtime[_0x385b('0x1f')]())['then'](user['getTelephones']())[_0x385b('0x1d')](realtime['initTelephones']())[_0x385b('0x1d')](trunk[_0x385b('0x20')]())[_0x385b('0x1d')](realtime['initTrunks']())[_0x385b('0x1d')](voiceQueue[_0x385b('0x21')]())['then'](realtime[_0x385b('0x22')]())['then'](trigger[_0x385b('0x23')]())[_0x385b('0x1d')](realtime[_0x385b('0x24')]())[_0x385b('0x1d')](template[_0x385b('0x25')]())[_0x385b('0x1d')](realtime['initTemplates']())[_0x385b('0x1d')](zendesk[_0x385b('0x26')]())[_0x385b('0x1d')](realtime['initZendeskAccounts']())['then'](salesforce[_0x385b('0x27')]())[_0x385b('0x1d')](realtime[_0x385b('0x28')]())[_0x385b('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x385b('0x1d')](realtime[_0x385b('0x29')]())[_0x385b('0x1d')](freshdesk[_0x385b('0x2a')]())['then'](realtime['initFreshdeskAccounts']())[_0x385b('0x1d')](desk[_0x385b('0x2b')]())[_0x385b('0x1d')](realtime[_0x385b('0x2c')]())[_0x385b('0x1d')](zoho['getZohoAccounts']())[_0x385b('0x1d')](realtime[_0x385b('0x2d')]())['then'](vtiger[_0x385b('0x2e')]())[_0x385b('0x1d')](realtime[_0x385b('0x2f')]())['then'](freshsales[_0x385b('0x30')]())[_0x385b('0x1d')](realtime[_0x385b('0x31')]())[_0x385b('0x1d')](servicenow[_0x385b('0x32')]())['then'](realtime['initServicenowAccounts']())[_0x385b('0x1d')](dynamics365[_0x385b('0x33')]())[_0x385b('0x1d')](realtime['initDynamics365Accounts']())['then'](campaign[_0x385b('0x34')]())[_0x385b('0x1d')](realtime['initCampaigns']())[_0x385b('0x1d')](voiceExtension[_0x385b('0x35')]())[_0x385b('0x1d')](realtime[_0x385b('0x36')]())[_0x385b('0x1d')](faxAccount['getFaxAccounts']())[_0x385b('0x1d')](realtime[_0x385b('0x37')]())[_0x385b('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0x385b('0x1c')]()['then'](voiceQueueReport[_0x385b('0x38')]())[_0x385b('0x1d')](realtime[_0x385b('0x39')]())[_0x385b('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x385b('0x1d')](realtime[_0x385b('0x3a')]())[_0x385b('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0x385b('0x1d')](realtime[_0x385b('0x3b')]())[_0x385b('0x1d')](voiceCallReport[_0x385b('0x3c')]())['then'](realtime[_0x385b('0x3d')]())[_0x385b('0x3e')](function(_0x29a319){logger[_0x385b('0x3f')](_0x385b('0x40'),util[_0x385b('0x41')](_0x29a319,{'showHidden':![],'depth':null}));});}function main(){return server[_0x385b('0x42')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x385b('0x1d')](function(){return initParams();})[_0x385b('0x1d')](function(){report[_0x385b('0x43')]();setInterval(initRealtime,0x1388);})[_0x385b('0x3e')](function(_0x19fcb1){logger[_0x385b('0x3f')](_0x385b('0x44'),util['inspect'](_0x19fcb1,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x11d9=['./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./realtime','./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceCallReport'];(function(_0x187abb,_0x2c8a71){var _0x494276=function(_0x25bc86){while(--_0x25bc86){_0x187abb['push'](_0x187abb['shift']());}};_0x494276(++_0x2c8a71);}(_0x11d9,0x87));var _0x911d=function(_0xcd33cd,_0x4a2a5e){_0xcd33cd=_0xcd33cd-0x0;var _0x5bb82b=_0x11d9[_0xcd33cd];return _0x5bb82b;};'use strict';var util=require(_0x911d('0x0'));var moment=require(_0x911d('0x1'));var server=require('./server');var Realtime=require(_0x911d('0x2'));var Report=require('./report');var Acw=require(_0x911d('0x3'));var Trigger=require('./trigger');var Dialer=require(_0x911d('0x4'));var Preview=require(_0x911d('0x5'));var Fax=require(_0x911d('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x911d('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x911d('0x8'));var trunk=require(_0x911d('0x9'));var trigger=require('./rpc/trigger');var template=require(_0x911d('0xa'));var cmHopperHistory=require(_0x911d('0xb'));var campaign=require(_0x911d('0xc'));var voiceExtension=require(_0x911d('0xd'));var faxAccount=require(_0x911d('0xe'));var zendesk=require(_0x911d('0xf'));var salesforce=require(_0x911d('0x10'));var sugarcrm=require(_0x911d('0x11'));var freshdesk=require(_0x911d('0x12'));var desk=require(_0x911d('0x13'));var zoho=require(_0x911d('0x14'));var vtiger=require(_0x911d('0x15'));var freshsales=require(_0x911d('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x911d('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x911d('0x18'))(_0x911d('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x911d('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x911d('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x911d('0x1b')]()['then'](user[_0x911d('0x1c')]())[_0x911d('0x1d')](realtime[_0x911d('0x1e')]())[_0x911d('0x1d')](user[_0x911d('0x1f')]())[_0x911d('0x1d')](realtime[_0x911d('0x20')]())[_0x911d('0x1d')](trunk[_0x911d('0x21')]())[_0x911d('0x1d')](realtime[_0x911d('0x22')]())[_0x911d('0x1d')](voiceQueue[_0x911d('0x23')]())[_0x911d('0x1d')](realtime[_0x911d('0x24')]())[_0x911d('0x1d')](trigger[_0x911d('0x25')]())[_0x911d('0x1d')](realtime[_0x911d('0x26')]())['then'](template[_0x911d('0x27')]())['then'](realtime['initTemplates']())[_0x911d('0x1d')](zendesk[_0x911d('0x28')]())[_0x911d('0x1d')](realtime[_0x911d('0x29')]())[_0x911d('0x1d')](salesforce[_0x911d('0x2a')]())['then'](realtime[_0x911d('0x2b')]())[_0x911d('0x1d')](sugarcrm[_0x911d('0x2c')]())[_0x911d('0x1d')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x911d('0x2d')]())[_0x911d('0x1d')](realtime[_0x911d('0x2e')]())['then'](desk[_0x911d('0x2f')]())['then'](realtime['initDeskAccounts']())[_0x911d('0x1d')](zoho[_0x911d('0x30')]())[_0x911d('0x1d')](realtime[_0x911d('0x31')]())[_0x911d('0x1d')](vtiger['getVtigerAccounts']())[_0x911d('0x1d')](realtime[_0x911d('0x32')]())['then'](freshsales[_0x911d('0x33')]())[_0x911d('0x1d')](realtime['initFreshsalesAccounts']())[_0x911d('0x1d')](servicenow[_0x911d('0x34')]())[_0x911d('0x1d')](realtime[_0x911d('0x35')]())['then'](dynamics365[_0x911d('0x36')]())[_0x911d('0x1d')](realtime[_0x911d('0x37')]())[_0x911d('0x1d')](campaign[_0x911d('0x38')]())[_0x911d('0x1d')](realtime['initCampaigns']())[_0x911d('0x1d')](voiceExtension[_0x911d('0x39')]())['then'](realtime[_0x911d('0x3a')]())['then'](faxAccount[_0x911d('0x3b')]())['then'](realtime['initFaxAccounts']())[_0x911d('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0x911d('0x1b')]()[_0x911d('0x1d')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x911d('0x3c')]())[_0x911d('0x1d')](cmHopperHistory[_0x911d('0x3d')]())['then'](realtime[_0x911d('0x3e')]())[_0x911d('0x1d')](cmHopperHistory[_0x911d('0x3f')]())[_0x911d('0x1d')](realtime['initCampaignHopperHistory']())[_0x911d('0x1d')](voiceCallReport[_0x911d('0x40')]())[_0x911d('0x1d')](realtime[_0x911d('0x41')]())['catch'](function(_0x495c6c){logger[_0x911d('0x42')](_0x911d('0x43'),util[_0x911d('0x44')](_0x495c6c,{'showHidden':![],'depth':null}));});}function main(){return server[_0x911d('0x45')](realtime,preview,fax)[_0x911d('0x1d')](function(){return initRealtime();})[_0x911d('0x1d')](function(){return initParams();})['then'](function(){report[_0x911d('0x46')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x4900ba){logger['error'](_0x911d('0x47'),util[_0x911d('0x44')](_0x4900ba,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index cdfb01d..d5f5589 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a59=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','accountcode','fullname','state','stateTime','status','unknown','address','phone','mobile','online','onhold','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','voiceStatusTime','format','voiceStatusCallerIdNumber','voiceStatusQueue','interface','stringify','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','ioredis'];(function(_0x27faf7,_0x203c55){var _0xc69b2d=function(_0x5acecf){while(--_0x5acecf){_0x27faf7['push'](_0x27faf7['shift']());}};_0xc69b2d(++_0x203c55);}(_0x9a59,0x9c));var _0x99a5=function(_0x34e97a,_0x14c75e){_0x34e97a=_0x34e97a-0x0;var _0x407057=_0x9a59[_0x34e97a];return _0x407057;};'use strict';var _=require(_0x99a5('0x0'));var util=require(_0x99a5('0x1'));var moment=require(_0x99a5('0x2'));var md5=require('md5');var Redis=require(_0x99a5('0x3'));var config=require(_0x99a5('0x4'));config[_0x99a5('0x5')]=_[_0x99a5('0x6')](config[_0x99a5('0x5')],{'host':_0x99a5('0x7'),'port':0x18eb});var io=require(_0x99a5('0x8'))(new Redis(config[_0x99a5('0x5')]));function Agent(_0x5a46cc){this['id']=_0x5a46cc['id']||0x0;this[_0x99a5('0x9')]=_0x5a46cc[_0x99a5('0x9')]||'';this['email']=_0x5a46cc['email']||'';this[_0x99a5('0xa')]=_0x5a46cc[_0x99a5('0xa')]||'';this[_0x99a5('0xb')]=_0x5a46cc[_0x99a5('0xb')]||'';this[_0x99a5('0xc')]='unknown';this[_0x99a5('0xd')]=0x0;this[_0x99a5('0xe')]=_0x99a5('0xf');this[_0x99a5('0x10')]='';this[_0x99a5('0x11')]='';this[_0x99a5('0x12')]='';this['interface']='';this['online']=_0x5a46cc[_0x99a5('0x13')]||![];this['voiceStatus']='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x99a5('0x14')]=![];this['local']=![];this[_0x99a5('0x15')]='';}Agent[_0x99a5('0x16')][_0x99a5('0x17')]=function(_0x20a4c6){var _0x1db7b0;if(_0x20a4c6&&_0x20a4c6[_0x99a5('0xc')]){_0x1db7b0=_0x20a4c6[_0x99a5('0xc')][_0x99a5('0x18')]();switch(_0x1db7b0){case _0x99a5('0x19'):_0x1db7b0='idle';break;case _0x99a5('0x1a'):_0x1db7b0=_0x99a5('0x1b');break;}}if(_0x1db7b0&&this[_0x99a5('0x1c')]!==_0x1db7b0||_0x20a4c6['statePause']){this[_0x99a5('0x1d')]=_['toNumber'](moment()[_0x99a5('0x1e')]('x'));}if(_0x1db7b0){this['voiceStatus']=_0x1db7b0;}var _0x2c9d65={'id':this['id'],'name':this[_0x99a5('0x9')],'email':this['email'],'accountcode':this[_0x99a5('0xa')],'fullname':this['fullname'],'state':this[_0x99a5('0xc')],'stateTime':this[_0x99a5('0xd')],'status':this[_0x99a5('0xe')],'address':this[_0x99a5('0x10')],'online':this[_0x99a5('0x13')],'voiceStatus':this[_0x99a5('0x1c')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x99a5('0x1f')],'voiceStatusQueue':this[_0x99a5('0x20')],'interface':this[_0x99a5('0x21')],'onhold':this[_0x99a5('0x14')]};var _0x6a6e03=md5(JSON[_0x99a5('0x22')](_0x2c9d65));if(this[_0x99a5('0x15')]!==_0x6a6e03){this[_0x99a5('0x15')]=_0x6a6e03;io['to'](util[_0x99a5('0x1e')]('user:%s',_0x2c9d65[_0x99a5('0x9')]))[_0x99a5('0x23')](_0x99a5('0x24'),_[_0x99a5('0x25')](_0x2c9d65,['online']));io[_0x99a5('0x23')](_0x99a5('0x26'),_0x2c9d65);}};module[_0x99a5('0x27')]=Agent; \ No newline at end of file +var _0x5d88=['phone','online','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','voiceStatus','voiceStatusQueue','interface','stringify','format','user:ami:update','omit','emit','exports','lodash','util','md5','../../../config/environment','redis','defaults','name','email','accountcode','fullname','state','unknown','stateTime','status','address'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x5d88,0x102));var _0x85d8=function(_0x5df710,_0x273f53){_0x5df710=_0x5df710-0x0;var _0x5402bc=_0x5d88[_0x5df710];return _0x5402bc;};'use strict';var _=require(_0x85d8('0x0'));var util=require(_0x85d8('0x1'));var moment=require('moment');var md5=require(_0x85d8('0x2'));var Redis=require('ioredis');var config=require(_0x85d8('0x3'));config[_0x85d8('0x4')]=_[_0x85d8('0x5')](config[_0x85d8('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x85d8('0x4')]));function Agent(_0xfc70ba){this['id']=_0xfc70ba['id']||0x0;this[_0x85d8('0x6')]=_0xfc70ba['name']||'';this[_0x85d8('0x7')]=_0xfc70ba[_0x85d8('0x7')]||'';this[_0x85d8('0x8')]=_0xfc70ba[_0x85d8('0x8')]||'';this[_0x85d8('0x9')]=_0xfc70ba[_0x85d8('0x9')]||'';this[_0x85d8('0xa')]=_0x85d8('0xb');this[_0x85d8('0xc')]=0x0;this[_0x85d8('0xd')]=_0x85d8('0xb');this[_0x85d8('0xe')]='';this[_0x85d8('0xf')]='';this['mobile']='';this['interface']='';this['online']=_0xfc70ba[_0x85d8('0x10')]||![];this['voiceStatus']=_0x85d8('0xb');this[_0x85d8('0x11')]=0x0;this[_0x85d8('0x12')]='';this['voiceStatusQueue']='';this[_0x85d8('0x13')]=![];this[_0x85d8('0x14')]=![];this['md5']='';}Agent[_0x85d8('0x15')][_0x85d8('0x16')]=function(_0x5de2df){var _0x5a7392;if(_0x5de2df&&_0x5de2df[_0x85d8('0xa')]){_0x5a7392=_0x5de2df['state'][_0x85d8('0x17')]();switch(_0x5a7392){case _0x85d8('0x18'):_0x5a7392=_0x85d8('0x19');break;case _0x85d8('0x1a'):_0x5a7392=_0x85d8('0x1b');break;}}if(_0x5a7392&&this['voiceStatus']!==_0x5a7392||_0x5de2df[_0x85d8('0x1c')]){this[_0x85d8('0x11')]=_[_0x85d8('0x1d')](moment()['format']('x'));}if(_0x5a7392){this[_0x85d8('0x1e')]=_0x5a7392;}var _0x275832={'id':this['id'],'name':this[_0x85d8('0x6')],'email':this[_0x85d8('0x7')],'accountcode':this[_0x85d8('0x8')],'fullname':this[_0x85d8('0x9')],'state':this[_0x85d8('0xa')],'stateTime':this[_0x85d8('0xc')],'status':this[_0x85d8('0xd')],'address':this[_0x85d8('0xe')],'online':this['online'],'voiceStatus':this[_0x85d8('0x1e')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x85d8('0x12')],'voiceStatusQueue':this[_0x85d8('0x1f')],'interface':this[_0x85d8('0x20')],'onhold':this[_0x85d8('0x13')]};var _0x53ca99=md5(JSON[_0x85d8('0x21')](_0x275832));if(this[_0x85d8('0x2')]!==_0x53ca99){this[_0x85d8('0x2')]=_0x53ca99;io['to'](util[_0x85d8('0x22')]('user:%s',_0x275832[_0x85d8('0x6')]))['emit'](_0x85d8('0x23'),_[_0x85d8('0x24')](_0x275832,[_0x85d8('0x10')]));io[_0x85d8('0x25')]('user:presence',_0x275832);}};module[_0x85d8('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index d22feff..8a11f31 100644 --- a/server/services/ami/model/campaign.js +++ b/server/services/ami/model/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa26f=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0xa26f,0x131));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x308a5f){this['id']=_0x308a5f['id']||0x0;this[_0xfa26('0x0')]=_0x308a5f['name']||'';this[_0xfa26('0x1')]=_0x308a5f[_0xfa26('0x1')]||_0xfa26('0x2');this[_0xfa26('0x3')]=0x0;this['temp']=0x0;this[_0xfa26('0x4')]=0x0;this[_0xfa26('0x5')]=0x0;this[_0xfa26('0x6')]='';this[_0xfa26('0x7')]=!![];this['active']=_0x308a5f[_0xfa26('0x8')];this[_0xfa26('0x9')]=_0x308a5f[_0xfa26('0x9')];this[_0xfa26('0xa')]=_0x308a5f[_0xfa26('0xa')]||null;this[_0xfa26('0xb')]=_0x308a5f[_0xfa26('0xb')]?_0x308a5f[_0xfa26('0xb')]:null;this[_0xfa26('0xc')]=_0x308a5f['dialOriginateCallerIdName'];this[_0xfa26('0xd')]=_0x308a5f[_0xfa26('0xd')];this[_0xfa26('0xe')]=_0x308a5f[_0xfa26('0xe')]||0x1e;this[_0xfa26('0xf')]=_0x308a5f[_0xfa26('0xf')];this[_0xfa26('0x10')]=_0x308a5f['dialCongestionRetryFrequency'];this[_0xfa26('0x11')]=_0x308a5f[_0xfa26('0x11')];this[_0xfa26('0x12')]=_0x308a5f[_0xfa26('0x12')];this[_0xfa26('0x13')]=_0x308a5f[_0xfa26('0x13')];this[_0xfa26('0x14')]=_0x308a5f['dialNoAnswerRetryFrequency'];this[_0xfa26('0x15')]=_0x308a5f[_0xfa26('0x15')];this[_0xfa26('0x16')]=_0x308a5f[_0xfa26('0x16')]||0x3;this[_0xfa26('0x17')]=_0x308a5f[_0xfa26('0x17')]||0x96;this[_0xfa26('0x18')]=_0x308a5f['dialDropMaxRetry']||0x3;this[_0xfa26('0x19')]=_0x308a5f[_0xfa26('0x19')]||0x96;this[_0xfa26('0x1a')]=_0x308a5f[_0xfa26('0x1a')]||0x3;this[_0xfa26('0x1b')]=_0x308a5f[_0xfa26('0x1b')]||0x96;this[_0xfa26('0x1c')]=_0x308a5f[_0xfa26('0x1c')]||0x3;this[_0xfa26('0x1d')]=_0x308a5f[_0xfa26('0x1d')]||0x96;this[_0xfa26('0x1e')]=_0x308a5f[_0xfa26('0x1e')]||0x3;this[_0xfa26('0x1f')]=_0x308a5f[_0xfa26('0x1f')]||0x96;this[_0xfa26('0x20')]=_0x308a5f['dialOrderByScheduledAt']||_0xfa26('0x21');this[_0xfa26('0x22')]=_0x308a5f[_0xfa26('0x22')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x308a5f[_0xfa26('0x23')]||undefined;this['dialCutDigit']=_0x308a5f['dialCutDigit']||undefined;this[_0xfa26('0x24')]=_0x308a5f['TrunkBackup']?_0x308a5f[_0xfa26('0x24')]:undefined;this[_0xfa26('0x25')]=_0x308a5f[_0xfa26('0x25')]?_0x308a5f['Trunk']:undefined;this[_0xfa26('0x26')]=_0x308a5f[_0xfa26('0x26')]?_0x308a5f[_0xfa26('0x26')]:undefined;this['SquareProject']=_0x308a5f[_0xfa26('0x27')]?_0x308a5f[_0xfa26('0x27')]:undefined;this[_0xfa26('0x28')]=_0x308a5f['SquareProject']?_0x308a5f[_0xfa26('0x27')][_0xfa26('0x0')]:undefined;this['dialAMDActive']=_0x308a5f[_0xfa26('0x29')]||![];this[_0xfa26('0x2a')]=_0x308a5f[_0xfa26('0x2a')];this[_0xfa26('0x2b')]=_0x308a5f['dialAMDGreeting'];this[_0xfa26('0x2c')]=_0x308a5f['dialAMDAfterGreetingSilence'];this[_0xfa26('0x2d')]=_0x308a5f[_0xfa26('0x2d')];this[_0xfa26('0x2e')]=_0x308a5f[_0xfa26('0x2e')];this[_0xfa26('0x2f')]=_0x308a5f[_0xfa26('0x2f')];this[_0xfa26('0x30')]=_0x308a5f[_0xfa26('0x30')];this[_0xfa26('0x31')]=_0x308a5f[_0xfa26('0x31')];this['dialAMDMaximumWordLength']=_0x308a5f[_0xfa26('0x32')];}module[_0xfa26('0x33')]=Campaign; \ No newline at end of file +var _0x10d5=['ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x10d5,0x128));var _0x510d=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x10d5[_0x2f6f50];return _0x2cf365;};'use strict';function Campaign(_0x33eaa4){this['id']=_0x33eaa4['id']||0x0;this[_0x510d('0x0')]=_0x33eaa4['name']||'';this[_0x510d('0x1')]=_0x33eaa4[_0x510d('0x1')]||_0x510d('0x2');this[_0x510d('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x510d('0x4')]=0x0;this[_0x510d('0x5')]='';this[_0x510d('0x6')]=!![];this['active']=_0x33eaa4[_0x510d('0x7')];this[_0x510d('0x8')]=_0x33eaa4[_0x510d('0x8')];this[_0x510d('0x9')]=_0x33eaa4['dialTimezone']||null;this['dialGlobalInterval']=_0x33eaa4[_0x510d('0xa')]?_0x33eaa4[_0x510d('0xa')]:null;this[_0x510d('0xb')]=_0x33eaa4['dialOriginateCallerIdName'];this[_0x510d('0xc')]=_0x33eaa4[_0x510d('0xc')];this[_0x510d('0xd')]=_0x33eaa4['dialOriginateTimeout']||0x1e;this[_0x510d('0xe')]=_0x33eaa4[_0x510d('0xe')];this[_0x510d('0xf')]=_0x33eaa4[_0x510d('0xf')];this[_0x510d('0x10')]=_0x33eaa4['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x33eaa4[_0x510d('0x11')];this[_0x510d('0x12')]=_0x33eaa4[_0x510d('0x12')];this[_0x510d('0x13')]=_0x33eaa4[_0x510d('0x13')];this[_0x510d('0x14')]=_0x33eaa4[_0x510d('0x14')];this[_0x510d('0x15')]=_0x33eaa4[_0x510d('0x15')]||0x3;this[_0x510d('0x16')]=_0x33eaa4[_0x510d('0x16')]||0x96;this[_0x510d('0x17')]=_0x33eaa4[_0x510d('0x17')]||0x3;this[_0x510d('0x18')]=_0x33eaa4[_0x510d('0x18')]||0x96;this[_0x510d('0x19')]=_0x33eaa4['dialAbandonedMaxRetry']||0x3;this[_0x510d('0x1a')]=_0x33eaa4[_0x510d('0x1a')]||0x96;this[_0x510d('0x1b')]=_0x33eaa4[_0x510d('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x33eaa4[_0x510d('0x1c')]||0x96;this[_0x510d('0x1d')]=_0x33eaa4[_0x510d('0x1d')]||0x3;this[_0x510d('0x1e')]=_0x33eaa4[_0x510d('0x1e')]||0x96;this[_0x510d('0x1f')]=_0x33eaa4[_0x510d('0x1f')]||_0x510d('0x20');this[_0x510d('0x21')]=_0x33eaa4[_0x510d('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x33eaa4[_0x510d('0x22')]||undefined;this[_0x510d('0x23')]=_0x33eaa4[_0x510d('0x23')]||undefined;this[_0x510d('0x24')]=_0x33eaa4['TrunkBackup']?_0x33eaa4[_0x510d('0x24')]:undefined;this[_0x510d('0x25')]=_0x33eaa4[_0x510d('0x25')]?_0x33eaa4[_0x510d('0x25')]:undefined;this[_0x510d('0x26')]=_0x33eaa4[_0x510d('0x26')]?_0x33eaa4[_0x510d('0x26')]:undefined;this[_0x510d('0x27')]=_0x33eaa4[_0x510d('0x27')]?_0x33eaa4[_0x510d('0x27')]:undefined;this[_0x510d('0x28')]=_0x33eaa4[_0x510d('0x27')]?_0x33eaa4[_0x510d('0x27')]['name']:undefined;this[_0x510d('0x29')]=_0x33eaa4[_0x510d('0x29')]||![];this['dialAMDInitialSilence']=_0x33eaa4[_0x510d('0x2a')];this[_0x510d('0x2b')]=_0x33eaa4['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x33eaa4['dialAMDAfterGreetingSilence'];this[_0x510d('0x2c')]=_0x33eaa4[_0x510d('0x2c')];this[_0x510d('0x2d')]=_0x33eaa4[_0x510d('0x2d')];this['dialAMDBetweenWordsSilence']=_0x33eaa4['dialAMDBetweenWordsSilence'];this[_0x510d('0x2e')]=_0x33eaa4[_0x510d('0x2e')];this[_0x510d('0x2f')]=_0x33eaa4[_0x510d('0x2f')];this[_0x510d('0x30')]=_0x33eaa4[_0x510d('0x30')];}module[_0x510d('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 044282c..a6de76e 100644 --- a/server/services/ami/model/channel.js +++ b/server/services/ami/model/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0699=['endtime','unmanaged','abandoned','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime'];(function(_0x439b36,_0x5d6d64){var _0x5b7ace=function(_0x5e657c){while(--_0x5e657c){_0x439b36['push'](_0x439b36['shift']());}};_0x5b7ace(++_0x5d6d64);}(_0x0699,0x1db));var _0x9069=function(_0x45b329,_0x3dca4f){_0x45b329=_0x45b329-0x0;var _0x320361=_0x0699[_0x45b329];return _0x320361;};'use strict';function Channel(){this[_0x9069('0x0')]=null;this['channel']='';this[_0x9069('0x1')]='';this['calleridnum']=0x0;this[_0x9069('0x2')]='';this[_0x9069('0x3')]=undefined;this[_0x9069('0x4')]=undefined;this[_0x9069('0x5')]=0x0;this['context']='';this[_0x9069('0x6')]=0x0;this[_0x9069('0x7')]=0x0;this[_0x9069('0x8')]=0x0;this[_0x9069('0x9')]=![];this[_0x9069('0xa')]=null;this[_0x9069('0xb')]=null;this[_0x9069('0xc')]=![];this[_0x9069('0xd')]=![];this['lastapplication']='';this['lastdata']='';this[_0x9069('0xe')]=0x0;this[_0x9069('0xf')]=0x0;this[_0x9069('0x10')]=0x0;this[_0x9069('0x11')]=null;this['tag']=null;this[_0x9069('0x12')]=null;this[_0x9069('0x13')]=![];this[_0x9069('0x14')]=null;this[_0x9069('0x15')]=null;this[_0x9069('0x16')]=[];this[_0x9069('0x17')]=undefined;this[_0x9069('0x18')]=undefined;this[_0x9069('0x19')]=undefined;this[_0x9069('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x23b3=['context','uniqueid','linkedid','exten','answertime','unmanaged','abandoned','lastdata','duration','billableseconds','type','monitor','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode'];(function(_0x11c718,_0x1959c8){var _0x58c46a=function(_0xb76c88){while(--_0xb76c88){_0x11c718['push'](_0x11c718['shift']());}};_0x58c46a(++_0x1959c8);}(_0x23b3,0x101));var _0x323b=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0x23b3[_0x685346];return _0x52e15b;};'use strict';function Channel(){this[_0x323b('0x0')]=null;this[_0x323b('0x1')]='';this['destinationchannel']='';this[_0x323b('0x2')]=0x0;this[_0x323b('0x3')]='';this[_0x323b('0x4')]=undefined;this[_0x323b('0x5')]=undefined;this[_0x323b('0x6')]=0x0;this[_0x323b('0x7')]='';this[_0x323b('0x8')]=0x0;this[_0x323b('0x9')]=0x0;this[_0x323b('0xa')]=0x0;this['answered']=![];this[_0x323b('0xb')]=null;this['endtime']=null;this[_0x323b('0xc')]=![];this[_0x323b('0xd')]=![];this['lastapplication']='';this[_0x323b('0xe')]='';this[_0x323b('0xf')]=0x0;this[_0x323b('0x10')]=0x0;this['holdtime']=0x0;this[_0x323b('0x11')]=null;this['tag']=null;this['disposition']=null;this[_0x323b('0x12')]=![];this['monitorFilename']=null;this[_0x323b('0x13')]=null;this['monitors']=[];this[_0x323b('0x14')]=undefined;this[_0x323b('0x15')]=undefined;this[_0x323b('0x16')]=undefined;this[_0x323b('0x17')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 63505b7..da95eb2 100644 --- a/server/services/ami/model/deskAccount.js +++ b/server/services/ami/model/deskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00ca=['tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x00ca,0xa1));var _0xa00c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x00ca[_0x3947c9];return _0x2e7871;};'use strict';function DeskAccount(_0x30c5ee){this['id']=_0x30c5ee['id']||0x0;this[_0xa00c('0x0')]=_0x30c5ee[_0xa00c('0x0')]||'';this['username']=_0x30c5ee['username']||'';this[_0xa00c('0x1')]=_0x30c5ee[_0xa00c('0x1')]||'';this[_0xa00c('0x2')]=_0x30c5ee[_0xa00c('0x2')]||'';this[_0xa00c('0x3')]=_0x30c5ee['password']||'';this['consumerKey']=_0x30c5ee[_0xa00c('0x4')]||'';this['consumerSecret']=_0x30c5ee[_0xa00c('0x5')]||'';this['token']=_0x30c5ee[_0xa00c('0x6')]||'';this['tokenSecret']=_0x30c5ee[_0xa00c('0x7')]||'';this[_0xa00c('0x8')]=_0x30c5ee[_0xa00c('0x8')]||'';this[_0xa00c('0x9')]=_0x30c5ee[_0xa00c('0x9')]||'';this[_0xa00c('0xa')]=_0x30c5ee[_0xa00c('0xa')]||{};}module[_0xa00c('0xb')]=DeskAccount; \ No newline at end of file +var _0x34f0=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x2ab688,_0x5236dd){var _0xfb5b50=function(_0x23e2f5){while(--_0x23e2f5){_0x2ab688['push'](_0x2ab688['shift']());}};_0xfb5b50(++_0x5236dd);}(_0x34f0,0x74));var _0x034f=function(_0x3940eb,_0xc269d4){_0x3940eb=_0x3940eb-0x0;var _0x3832dc=_0x34f0[_0x3940eb];return _0x3832dc;};'use strict';function DeskAccount(_0x26fa33){this['id']=_0x26fa33['id']||0x0;this[_0x034f('0x0')]=_0x26fa33['name']||'';this[_0x034f('0x1')]=_0x26fa33['username']||'';this[_0x034f('0x2')]=_0x26fa33[_0x034f('0x2')]||'';this[_0x034f('0x3')]=_0x26fa33['authType']||'';this['password']=_0x26fa33[_0x034f('0x4')]||'';this[_0x034f('0x5')]=_0x26fa33[_0x034f('0x5')]||'';this[_0x034f('0x6')]=_0x26fa33['consumerSecret']||'';this[_0x034f('0x7')]=_0x26fa33[_0x034f('0x7')]||'';this[_0x034f('0x8')]=_0x26fa33[_0x034f('0x8')]||'';this['type']=_0x26fa33[_0x034f('0x9')]||'';this[_0x034f('0xa')]=_0x26fa33['serverUrl']||'';this['Configurations']=_0x26fa33[_0x034f('0xb')]||{};}module[_0x034f('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 60c0138..a522e6a 100644 --- a/server/services/ami/model/dynamics365Account.js +++ b/server/services/ami/model/dynamics365Account.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24fb=['clientSecret','serverUrl','modernAuthentication','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0xf45356,_0x4b231b){var _0x4a609c=function(_0x258d53){while(--_0x258d53){_0xf45356['push'](_0xf45356['shift']());}};_0x4a609c(++_0x4b231b);}(_0x24fb,0x10d));var _0xb24f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x24fb[_0xa464c9];return _0x3d73c4;};'use strict';function Dynamics365Account(_0x44943f){this['id']=_0x44943f['id']||0x0;this['name']=_0x44943f[_0xb24f('0x0')]||'';this[_0xb24f('0x1')]=_0x44943f['username']||'';this[_0xb24f('0x2')]=_0x44943f['password']||'';this[_0xb24f('0x3')]=_0x44943f[_0xb24f('0x3')]||'';this[_0xb24f('0x4')]=_0x44943f[_0xb24f('0x4')]||'';this[_0xb24f('0x5')]=_0x44943f[_0xb24f('0x5')]||'';this['clientSecret']=_0x44943f[_0xb24f('0x6')]||{};this['serverUrl']=_0x44943f[_0xb24f('0x7')]||'';this[_0xb24f('0x8')]=_0x44943f[_0xb24f('0x8')]||![];this['Configurations']=_0x44943f[_0xb24f('0x9')]||{};this['CloudProvider']=_0x44943f['CloudProvider']||{};}module[_0xb24f('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xb16b=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x26c87f,_0x3dcff5){var _0x13efe3=function(_0x44f4dd){while(--_0x44f4dd){_0x26c87f['push'](_0x26c87f['shift']());}};_0x13efe3(++_0x3dcff5);}(_0xb16b,0x10e));var _0xbb16=function(_0x39cff5,_0x234f0c){_0x39cff5=_0x39cff5-0x0;var _0x430437=_0xb16b[_0x39cff5];return _0x430437;};'use strict';function Dynamics365Account(_0x62ccbf){this['id']=_0x62ccbf['id']||0x0;this[_0xbb16('0x0')]=_0x62ccbf['name']||'';this[_0xbb16('0x1')]=_0x62ccbf['username']||'';this[_0xbb16('0x2')]=_0x62ccbf[_0xbb16('0x2')]||'';this[_0xbb16('0x3')]=_0x62ccbf['remoteUri']||'';this[_0xbb16('0x4')]=_0x62ccbf[_0xbb16('0x4')]||'';this['clientId']=_0x62ccbf[_0xbb16('0x5')]||'';this[_0xbb16('0x6')]=_0x62ccbf['clientSecret']||{};this['serverUrl']=_0x62ccbf[_0xbb16('0x7')]||'';this[_0xbb16('0x8')]=_0x62ccbf[_0xbb16('0x8')]||![];this[_0xbb16('0x9')]=_0x62ccbf[_0xbb16('0x9')]||{};this[_0xbb16('0xa')]=_0x62ccbf[_0xbb16('0xa')]||{};}module[_0xbb16('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f915bdc..ea06c1c 100644 --- a/server/services/ami/model/faxAccount.js +++ b/server/services/ami/model/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x591c=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description'];(function(_0x32f9e6,_0x55ed80){var _0x11a5ea=function(_0x1862ab){while(--_0x1862ab){_0x32f9e6['push'](_0x32f9e6['shift']());}};_0x11a5ea(++_0x55ed80);}(_0x591c,0x141));var _0xc591=function(_0x550326,_0x155be3){_0x550326=_0x550326-0x0;var _0x3c09df=_0x591c[_0x550326];return _0x3c09df;};'use strict';function FaxAccount(_0x112df4){this['id']=_0x112df4['id']||0x0;this['name']=_0x112df4[_0xc591('0x0')]||'';this['description']=_0x112df4[_0xc591('0x1')];this['ecm']=_0x112df4[_0xc591('0x2')];this[_0xc591('0x3')]=_0x112df4['headerinfo'];this[_0xc591('0x4')]=_0x112df4[_0xc591('0x4')];this[_0xc591('0x5')]=_0x112df4['minrate']||0x960;this[_0xc591('0x6')]=_0x112df4[_0xc591('0x6')]||0x3840;this['modem']=_0x112df4[_0xc591('0x7')]||_0xc591('0x8');this[_0xc591('0x9')]=_0x112df4[_0xc591('0x9')]||'no';this[_0xc591('0xa')]=_0x112df4[_0xc591('0xa')]||'no';this[_0xc591('0xb')]=_0x112df4[_0xc591('0xb')]||0x1388;this[_0xc591('0xc')]=_0x112df4['tech']||_0xc591('0xd');this[_0xc591('0xe')]=_0x112df4['Trunk']?_0x112df4['Trunk']:undefined;this[_0xc591('0xf')]=_0x112df4[_0xc591('0xf')];this['key']=_0x112df4[_0xc591('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x26e7=['t38timeout','tech','Trunk','ListId','key','name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x26e7,0xaa));var _0x726e=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x26e7[_0x5de532];return _0x4e9192;};'use strict';function FaxAccount(_0x44dce7){this['id']=_0x44dce7['id']||0x0;this['name']=_0x44dce7[_0x726e('0x0')]||'';this[_0x726e('0x1')]=_0x44dce7[_0x726e('0x1')];this[_0x726e('0x2')]=_0x44dce7[_0x726e('0x2')];this['headerinfo']=_0x44dce7['headerinfo'];this[_0x726e('0x3')]=_0x44dce7[_0x726e('0x3')];this[_0x726e('0x4')]=_0x44dce7[_0x726e('0x4')]||0x960;this['maxrate']=_0x44dce7[_0x726e('0x5')]||0x3840;this[_0x726e('0x6')]=_0x44dce7[_0x726e('0x6')]||_0x726e('0x7');this[_0x726e('0x8')]=_0x44dce7[_0x726e('0x8')]||'no';this[_0x726e('0x9')]=_0x44dce7[_0x726e('0x9')]||'no';this[_0x726e('0xa')]=_0x44dce7['t38timeout']||0x1388;this[_0x726e('0xb')]=_0x44dce7['tech']||'SIP';this[_0x726e('0xc')]=_0x44dce7['Trunk']?_0x44dce7[_0x726e('0xc')]:undefined;this[_0x726e('0xd')]=_0x44dce7[_0x726e('0xd')];this['key']=_0x44dce7[_0x726e('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 830b291..bb6acee 100644 --- a/server/services/ami/model/freshdeskAccount.js +++ b/server/services/ami/model/freshdeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bef=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x1a8f90,_0x4d8c68){var _0x307707=function(_0x48df41){while(--_0x48df41){_0x1a8f90['push'](_0x1a8f90['shift']());}};_0x307707(++_0x4d8c68);}(_0x8bef,0x72));var _0xf8be=function(_0xbab353,_0x37e159){_0xbab353=_0xbab353-0x0;var _0x56871e=_0x8bef[_0xbab353];return _0x56871e;};'use strict';function FreshdeskAccount(_0x2fa399){this['id']=_0x2fa399['id']||0x0;this[_0xf8be('0x0')]=_0x2fa399['name']||'';this[_0xf8be('0x1')]=_0x2fa399[_0xf8be('0x1')]||'';this[_0xf8be('0x2')]=_0x2fa399[_0xf8be('0x3')]||'';this['remoteUri']=_0x2fa399[_0xf8be('0x4')]||'';this['serverUrl']=_0x2fa399[_0xf8be('0x5')]||'';this['Configurations']=_0x2fa399[_0xf8be('0x6')]||{};}module[_0xf8be('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x9dce=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2fe51b,_0x3bb671){var _0x3465c8=function(_0x244ae4){while(--_0x244ae4){_0x2fe51b['push'](_0x2fe51b['shift']());}};_0x3465c8(++_0x3bb671);}(_0x9dce,0x177));var _0xe9dc=function(_0x281a7d,_0x416678){_0x281a7d=_0x281a7d-0x0;var _0x2fd7b5=_0x9dce[_0x281a7d];return _0x2fd7b5;};'use strict';function FreshdeskAccount(_0x48fb54){this['id']=_0x48fb54['id']||0x0;this['name']=_0x48fb54[_0xe9dc('0x0')]||'';this[_0xe9dc('0x1')]=_0x48fb54['username']||'';this[_0xe9dc('0x2')]=_0x48fb54[_0xe9dc('0x3')]||'';this['remoteUri']=_0x48fb54[_0xe9dc('0x4')]||'';this[_0xe9dc('0x5')]=_0x48fb54[_0xe9dc('0x5')]||'';this['Configurations']=_0x48fb54[_0xe9dc('0x6')]||{};}module[_0xe9dc('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 2a296f5..b7face9 100644 --- a/server/services/ami/model/freshsalesAccount.js +++ b/server/services/ami/model/freshsalesAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc46=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x1b889c,_0x54d817){var _0x326180=function(_0x3cdd5c){while(--_0x3cdd5c){_0x1b889c['push'](_0x1b889c['shift']());}};_0x326180(++_0x54d817);}(_0xfc46,0x9a));var _0x6fc4=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0xfc46[_0x5c2c7c];return _0xea7ffe;};'use strict';function FreshsalesAccount(_0x9cd497){this['id']=_0x9cd497['id']||0x0;this['name']=_0x9cd497[_0x6fc4('0x0')]||'';this[_0x6fc4('0x1')]=_0x9cd497[_0x6fc4('0x1')]||'';this['apiKey']=_0x9cd497[_0x6fc4('0x2')]||'';this[_0x6fc4('0x3')]=_0x9cd497[_0x6fc4('0x3')]||'';this[_0x6fc4('0x4')]=_0x9cd497['serverUrl']||'';this[_0x6fc4('0x5')]=_0x9cd497[_0x6fc4('0x5')]||{};}module[_0x6fc4('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x6726=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x181ef4,_0x4c25fc){var _0x410b3d=function(_0x353010){while(--_0x353010){_0x181ef4['push'](_0x181ef4['shift']());}};_0x410b3d(++_0x4c25fc);}(_0x6726,0xdb));var _0x6672=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x6726[_0x1fc84d];return _0x2658fa;};'use strict';function FreshsalesAccount(_0xc4b93b){this['id']=_0xc4b93b['id']||0x0;this[_0x6672('0x0')]=_0xc4b93b[_0x6672('0x0')]||'';this['username']=_0xc4b93b[_0x6672('0x1')]||'';this[_0x6672('0x2')]=_0xc4b93b['token']||'';this[_0x6672('0x3')]=_0xc4b93b['remoteUri']||'';this[_0x6672('0x4')]=_0xc4b93b[_0x6672('0x4')]||'';this[_0x6672('0x5')]=_0xc4b93b[_0x6672('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 811ed79..b2aaa16 100644 --- a/server/services/ami/model/queueReport.js +++ b/server/services/ami/model/queueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d76=['assigned','lastAssignedTo','voice','routealias','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinename','context','exten','priority','holdtime'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x6d76,0x181));var _0x66d7=function(_0x1b8b27,_0x204b53){_0x1b8b27=_0x1b8b27-0x0;var _0x257755=_0x6d76[_0x1b8b27];return _0x257755;};'use strict';function QueueReport(){this[_0x66d7('0x0')]=_0x66d7('0x1');this['uniqueid']='';this[_0x66d7('0x2')]='';this[_0x66d7('0x3')]='';this[_0x66d7('0x4')]='';this['queuecallerjoinAt']=null;this[_0x66d7('0x5')]=null;this[_0x66d7('0x6')]=0x1;this[_0x66d7('0x7')]=0x1;this[_0x66d7('0x8')]=![];this[_0x66d7('0x9')]=null;this[_0x66d7('0xa')]=![];this[_0x66d7('0xb')]=null;this[_0x66d7('0xc')]=![];this[_0x66d7('0xd')]=null;this['originalposition']=0x1;this[_0x66d7('0xe')]='';this['connectedlinenum']='';this[_0x66d7('0xf')]='';this['accountcode']='';this[_0x66d7('0x10')]='';this[_0x66d7('0x11')]='';this[_0x66d7('0x12')]='';this[_0x66d7('0x13')]=0x0;this[_0x66d7('0x14')]=![];this[_0x66d7('0x15')]='';this['motionChannel']=_0x66d7('0x16');this[_0x66d7('0x17')]=null;this[_0x66d7('0x18')]=0x0;this[_0x66d7('0x19')]={};}module[_0x66d7('0x1a')]=QueueReport; \ No newline at end of file +var _0x7723=['exten','holdtime','assigned','lastAssignedTo','routealias','mohtime','exports','type','inbound','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode'];(function(_0x5b6a86,_0x59489c){var _0x425888=function(_0x38fdfd){while(--_0x38fdfd){_0x5b6a86['push'](_0x5b6a86['shift']());}};_0x425888(++_0x59489c);}(_0x7723,0x75));var _0x3772=function(_0xccf6a7,_0x316308){_0xccf6a7=_0xccf6a7-0x0;var _0x19ab2d=_0x7723[_0xccf6a7];return _0x19ab2d;};'use strict';function QueueReport(){this[_0x3772('0x0')]=_0x3772('0x1');this['uniqueid']='';this[_0x3772('0x2')]='';this['calleridname']='';this[_0x3772('0x3')]='';this[_0x3772('0x4')]=null;this[_0x3772('0x5')]=null;this[_0x3772('0x6')]=0x1;this['count']=0x1;this[_0x3772('0x7')]=![];this[_0x3772('0x8')]=null;this[_0x3772('0x9')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x3772('0xa')]=null;this[_0x3772('0xb')]=0x1;this[_0x3772('0xc')]='';this['connectedlinenum']='';this[_0x3772('0xd')]='';this[_0x3772('0xe')]='';this['context']='';this[_0x3772('0xf')]='';this['priority']='';this[_0x3772('0x10')]=0x0;this[_0x3772('0x11')]=![];this[_0x3772('0x12')]='';this['motionChannel']='voice';this[_0x3772('0x13')]=null;this[_0x3772('0x14')]=0x0;this['variables']={};}module[_0x3772('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 63d794b..8d45e92 100644 --- a/server/services/ami/model/salesforceAccount.js +++ b/server/services/ami/model/salesforceAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5032=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x5032,0x90));var _0x2503=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5032[_0x5ddb1c];return _0x354adc;};'use strict';function SalesforceAccount(_0x1f0a42){this['id']=_0x1f0a42['id']||0x0;this[_0x2503('0x0')]=_0x1f0a42[_0x2503('0x0')]||'';this[_0x2503('0x1')]=_0x1f0a42[_0x2503('0x1')]||'';this[_0x2503('0x2')]=_0x1f0a42['remoteUri']||'';this[_0x2503('0x3')]=_0x1f0a42['password']||'';this[_0x2503('0x4')]=_0x1f0a42[_0x2503('0x4')]||'';this[_0x2503('0x5')]=_0x1f0a42[_0x2503('0x5')]||'';this[_0x2503('0x6')]=_0x1f0a42['securityToken']||'';this[_0x2503('0x7')]=_0x1f0a42[_0x2503('0x7')]||_0x2503('0x8');this[_0x2503('0x9')]=_0x1f0a42[_0x2503('0x9')]||'';this[_0x2503('0xa')]=_0x1f0a42[_0x2503('0xa')]||{};}module[_0x2503('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xe540=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xe540,0xe6));var _0x0e54=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xe540[_0x4ae6ef];return _0x3cbb4e;};'use strict';function SalesforceAccount(_0x5424d9){this['id']=_0x5424d9['id']||0x0;this[_0x0e54('0x0')]=_0x5424d9['name']||'';this[_0x0e54('0x1')]=_0x5424d9[_0x0e54('0x1')]||'';this[_0x0e54('0x2')]=_0x5424d9[_0x0e54('0x2')]||'';this[_0x0e54('0x3')]=_0x5424d9[_0x0e54('0x3')]||'';this[_0x0e54('0x4')]=_0x5424d9[_0x0e54('0x4')]||'';this[_0x0e54('0x5')]=_0x5424d9[_0x0e54('0x5')]||'';this['securityToken']=_0x5424d9[_0x0e54('0x6')]||'';this[_0x0e54('0x7')]=_0x5424d9[_0x0e54('0x7')]||_0x0e54('0x8');this['serverUrl']=_0x5424d9[_0x0e54('0x9')]||'';this[_0x0e54('0xa')]=_0x5424d9[_0x0e54('0xa')]||{};}module[_0x0e54('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index b67f739..5d6db78 100644 --- a/server/services/ami/model/servicenowAccount.js +++ b/server/services/ami/model/servicenowAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x708a=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x1ec552,_0x3c1f1e){var _0x286185=function(_0x372867){while(--_0x372867){_0x1ec552['push'](_0x1ec552['shift']());}};_0x286185(++_0x3c1f1e);}(_0x708a,0x13f));var _0xa708=function(_0x3e1f80,_0x52471c){_0x3e1f80=_0x3e1f80-0x0;var _0x2d3a67=_0x708a[_0x3e1f80];return _0x2d3a67;};'use strict';function ServicenowAccount(_0x23c735){this['id']=_0x23c735['id']||0x0;this['name']=_0x23c735[_0xa708('0x0')]||'';this[_0xa708('0x1')]=_0x23c735['username']||'';this['password']=_0x23c735[_0xa708('0x2')]||'';this[_0xa708('0x3')]=_0x23c735[_0xa708('0x3')]||'';this[_0xa708('0x4')]=_0x23c735[_0xa708('0x4')]||'';this[_0xa708('0x5')]=_0x23c735[_0xa708('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x470b=['remoteUri','serverUrl','exports','name','username','password'];(function(_0x239a37,_0x1675c8){var _0x46db3c=function(_0x3c02a2){while(--_0x3c02a2){_0x239a37['push'](_0x239a37['shift']());}};_0x46db3c(++_0x1675c8);}(_0x470b,0x141));var _0xb470=function(_0x5327fe,_0x18753c){_0x5327fe=_0x5327fe-0x0;var _0x504f13=_0x470b[_0x5327fe];return _0x504f13;};'use strict';function ServicenowAccount(_0x2c672e){this['id']=_0x2c672e['id']||0x0;this[_0xb470('0x0')]=_0x2c672e[_0xb470('0x0')]||'';this[_0xb470('0x1')]=_0x2c672e[_0xb470('0x1')]||'';this['password']=_0x2c672e[_0xb470('0x2')]||'';this[_0xb470('0x3')]=_0x2c672e[_0xb470('0x3')]||'';this['serverUrl']=_0x2c672e[_0xb470('0x4')]||'';this['Configurations']=_0x2c672e['Configurations']||{};}module[_0xb470('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index dd53d31..0371c8c 100644 --- a/server/services/ami/model/sugarcrmAccount.js +++ b/server/services/ami/model/sugarcrmAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x605e=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x35929b,_0x42c1db){var _0x44f9c0=function(_0x3041c2){while(--_0x3041c2){_0x35929b['push'](_0x35929b['shift']());}};_0x44f9c0(++_0x42c1db);}(_0x605e,0x1b8));var _0xe605=function(_0x529c0b,_0x23c6a8){_0x529c0b=_0x529c0b-0x0;var _0xd78059=_0x605e[_0x529c0b];return _0xd78059;};'use strict';function SugarcrmAccount(_0x4f9273){this['id']=_0x4f9273['id']||0x0;this[_0xe605('0x0')]=_0x4f9273['name']||'';this[_0xe605('0x1')]=_0x4f9273[_0xe605('0x1')]||'';this['password']=_0x4f9273['password']||'';this['remoteUri']=_0x4f9273[_0xe605('0x2')]||'';this[_0xe605('0x3')]=_0x4f9273[_0xe605('0x3')]||'';this['Configurations']=_0x4f9273[_0xe605('0x4')]||{};}module[_0xe605('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xebe7=['remoteUri','Configurations','exports','name','username','password'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0xebe7,0x165));var _0x7ebe=function(_0x44d0ff,_0x59fbb2){_0x44d0ff=_0x44d0ff-0x0;var _0x5e8a6c=_0xebe7[_0x44d0ff];return _0x5e8a6c;};'use strict';function SugarcrmAccount(_0x260981){this['id']=_0x260981['id']||0x0;this[_0x7ebe('0x0')]=_0x260981[_0x7ebe('0x0')]||'';this['username']=_0x260981[_0x7ebe('0x1')]||'';this[_0x7ebe('0x2')]=_0x260981['password']||'';this['remoteUri']=_0x260981[_0x7ebe('0x3')]||'';this['serverUrl']=_0x260981['serverUrl']||'';this[_0x7ebe('0x4')]=_0x260981['Configurations']||{};}module[_0x7ebe('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index fc1bf7f..f268af0 100644 --- a/server/services/ami/model/telephone.js +++ b/server/services/ami/model/telephone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe62=['stateTime','status','exports','name','unknown'];(function(_0x2a550b,_0x2ddce3){var _0x35480c=function(_0x153446){while(--_0x153446){_0x2a550b['push'](_0x2a550b['shift']());}};_0x35480c(++_0x2ddce3);}(_0xbe62,0x9e));var _0x2be6=function(_0x3ccca1,_0xe0ed0){_0x3ccca1=_0x3ccca1-0x0;var _0x2a26b3=_0xbe62[_0x3ccca1];return _0x2a26b3;};'use strict';function Telephone(_0x8c85de){this['id']=_0x8c85de['id']||0x0;this[_0x2be6('0x0')]=_0x8c85de['name']||'';this['accountcode']=_0x8c85de['accountcode']||'';this['state']=_0x2be6('0x1');this[_0x2be6('0x2')]=0x0;this[_0x2be6('0x3')]=_0x2be6('0x1');this['address']='';}module[_0x2be6('0x4')]=Telephone; \ No newline at end of file +var _0x3868=['name','accountcode','state','unknown','stateTime','status','exports'];(function(_0x461058,_0x37094f){var _0xa1003a=function(_0x2463e5){while(--_0x2463e5){_0x461058['push'](_0x461058['shift']());}};_0xa1003a(++_0x37094f);}(_0x3868,0x118));var _0x8386=function(_0x4eb582,_0x272ade){_0x4eb582=_0x4eb582-0x0;var _0x500011=_0x3868[_0x4eb582];return _0x500011;};'use strict';function Telephone(_0x4fde78){this['id']=_0x4fde78['id']||0x0;this[_0x8386('0x0')]=_0x4fde78[_0x8386('0x0')]||'';this[_0x8386('0x1')]=_0x4fde78[_0x8386('0x1')]||'';this[_0x8386('0x2')]=_0x8386('0x3');this[_0x8386('0x4')]=0x0;this[_0x8386('0x5')]=_0x8386('0x3');this['address']='';}module[_0x8386('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 1b63d1d..0148150 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x3324e6,_0x3ed3b3){var _0x18252b=function(_0x4c29b8){while(--_0x4c29b8){_0x3324e6['push'](_0x3324e6['shift']());}};_0x18252b(++_0x3ed3b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x5493d6,_0x3aea46){var _0x87d253=function(_0x3a7596){while(--_0x3a7596){_0x5493d6['push'](_0x5493d6['shift']());}};_0x87d253(++_0x3aea46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index eed252b..cd72e02 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x5cc5a8,_0x41b354){var _0x35f52c=function(_0x365552){while(--_0x365552){_0x5cc5a8['push'](_0x5cc5a8['shift']());}};_0x35f52c(++_0x41b354);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5e6ad4,_0x1f7d6c){_0x5e6ad4=_0x5e6ad4-0x0;var _0x43febd=_0x9ffd[_0x5e6ad4];return _0x43febd;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 4c53bb1..9cb7ff7 100644 --- a/server/services/ami/model/trunk.js +++ b/server/services/ami/model/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fb5=['address','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x5386e4,_0x3f17c0){var _0x3af1bc=function(_0x191f9d){while(--_0x191f9d){_0x5386e4['push'](_0x5386e4['shift']());}};_0x3af1bc(++_0x3f17c0);}(_0x4fb5,0x1e8));var _0x54fb=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x4fb5[_0x38537f];return _0x141e23;};'use strict';function Trunk(_0x553126){this['id']=_0x553126['id']||0x0;this['active']=_0x553126[_0x54fb('0x0')]||![];this[_0x54fb('0x1')]=_0x553126['name']||'';this[_0x54fb('0x2')]=_0x54fb('0x3');this[_0x54fb('0x4')]=0x0;this[_0x54fb('0x5')]=_0x54fb('0x3');this[_0x54fb('0x6')]=_0x553126['registry']&&_0x553126[_0x54fb('0x6')][_0x54fb('0x7')](':')?_0x553126[_0x54fb('0x6')][_0x54fb('0x8')](':')[0x0]:'';this[_0x54fb('0x9')]='';this[_0x54fb('0xa')]='';this[_0x54fb('0xb')]='';this[_0x54fb('0xc')]='';this[_0x54fb('0xd')]='';this[_0x54fb('0xe')]='unknown';this[_0x54fb('0xf')]='';this[_0x54fb('0x10')]='';this['defaultuser']=_0x553126['defaultuser']||'';}module[_0x54fb('0x11')]=Trunk; \ No newline at end of file +var _0x9f48=['stateTime','status','registry','indexOf','split','domain','domainport','refresh','stateRegistry','unknown','registrationtime','address','defaultuser','exports','active','name'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x9f48,0x19e));var _0x89f4=function(_0x2466ec,_0x4260dc){_0x2466ec=_0x2466ec-0x0;var _0x450c0b=_0x9f48[_0x2466ec];return _0x450c0b;};'use strict';function Trunk(_0x81287a){this['id']=_0x81287a['id']||0x0;this[_0x89f4('0x0')]=_0x81287a[_0x89f4('0x0')]||![];this['name']=_0x81287a[_0x89f4('0x1')]||'';this['state']='unknown';this[_0x89f4('0x2')]=0x0;this[_0x89f4('0x3')]='unknown';this['registry']=_0x81287a[_0x89f4('0x4')]&&_0x81287a['registry'][_0x89f4('0x5')](':')?_0x81287a[_0x89f4('0x4')][_0x89f4('0x6')](':')[0x0]:'';this['host']='';this['port']='';this[_0x89f4('0x7')]='';this[_0x89f4('0x8')]='';this[_0x89f4('0x9')]='';this[_0x89f4('0xa')]=_0x89f4('0xb');this[_0x89f4('0xc')]='';this[_0x89f4('0xd')]='';this[_0x89f4('0xe')]=_0x81287a[_0x89f4('0xe')]||'';}module[_0x89f4('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 79a57ac..7794649 100644 --- a/server/services/ami/model/voiceExtension.js +++ b/server/services/ami/model/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9263=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x9263,0xc9));var _0x3926=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x9263[_0x4b2863];return _0x567d67;};'use strict';function voiceExtension(_0x6f0325){this['id']=_0x6f0325['id']||0x0;this[_0x3926('0x0')]=_0x6f0325[_0x3926('0x0')]||'';this[_0x3926('0x1')]=_0x6f0325[_0x3926('0x1')]||'none';this['mandatoryDisposition']=_0x6f0325[_0x3926('0x2')]||![];}module[_0x3926('0x3')]=voiceExtension; \ No newline at end of file +var _0x1e3b=['mandatoryDisposition','exports','exten','none'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0x1e3b,0x1be));var _0xb1e3=function(_0x1736cd,_0x24bd0b){_0x1736cd=_0x1736cd-0x0;var _0x12c9da=_0x1e3b[_0x1736cd];return _0x12c9da;};'use strict';function voiceExtension(_0x429e99){this['id']=_0x429e99['id']||0x0;this[_0xb1e3('0x0')]=_0x429e99[_0xb1e3('0x0')]||'';this['recordingFormat']=_0x429e99['recordingFormat']||_0xb1e3('0x1');this[_0xb1e3('0x2')]=_0x429e99[_0xb1e3('0x2')]||![];}module[_0xb1e3('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 8ba2d8c..8334e36 100644 --- a/server/services/ami/model/voiceQueue.js +++ b/server/services/ami/model/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cc7=['outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','random','roundrobin','rrordered','wrandom','name','monitor_format','waiting','total','sumHoldTime','sumBillable','abandoned','invalid','loggedIn','notInUse','onHold','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x3cc7,0x11f));var _0x73cc=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0x3cc7[_0x36940e];return _0x3283f2;};'use strict';var monitorFormat={'wav':_0x73cc('0x0'),'wav49':_0x73cc('0x1'),'gsm':_0x73cc('0x2')};var strategy={'fewestcalls':_0x73cc('0x3'),'leastrecent':_0x73cc('0x4'),'linear':'linear','random':_0x73cc('0x5'),'ringall':'ringall','rr':_0x73cc('0x6'),'rrmemory':'rrmemory','rrordered':_0x73cc('0x7'),'wrandom':_0x73cc('0x8')};function VoiceQueue(_0x343002){this['id']=_0x343002['id']||0x0;this['name']=_0x343002[_0x73cc('0x9')]||'';this[_0x73cc('0xa')]=_0x343002[_0x73cc('0xa')]||'';this['type']=_0x343002['type']||'inbound';this[_0x73cc('0xb')]=0x0;this[_0x73cc('0xc')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x73cc('0xd')]=0x0;this[_0x73cc('0xe')]=0x0;this['unmanaged']=0x0;this[_0x73cc('0xf')]=0x0;this['available']=0x0;this['busy']=0x0;this['inUse']=0x0;this[_0x73cc('0x10')]=0x0;this[_0x73cc('0x11')]=0x0;this[_0x73cc('0x12')]=0x0;this[_0x73cc('0x13')]=0x0;this['paused']=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0x73cc('0x14')]=0x0;this[_0x73cc('0x15')]=0x0;this['unknown']=0x0;this[_0x73cc('0x16')]=_0x343002['acw']||![];this[_0x73cc('0x17')]=_0x343002[_0x73cc('0x17')]||0xa;this[_0x73cc('0x18')]=_0x343002[_0x73cc('0x18')]||'no';this[_0x73cc('0x19')]=!![];this['message']='';this[_0x73cc('0x1a')]='';this[_0x73cc('0x1b')]=0x0;this[_0x73cc('0x1c')]=0x0;this[_0x73cc('0x1d')]=_0x343002[_0x73cc('0x1d')]||null;this[_0x73cc('0x1e')]=_0x343002[_0x73cc('0x1e')]?_0x343002[_0x73cc('0x1e')]:null;this[_0x73cc('0x1f')]=_0x343002['dialActive'];this[_0x73cc('0x20')]=_0x343002[_0x73cc('0x20')]||_0x73cc('0x21');this[_0x73cc('0x22')]=_0x343002[_0x73cc('0x22')]||0x0;this[_0x73cc('0x23')]=_0x343002['dialLimitQueue']||0x0;this[_0x73cc('0x24')]=_0x343002['dialPowerLevel']||0x1;this[_0x73cc('0x25')]=_0x343002[_0x73cc('0x25')]||_0x73cc('0x26');this[_0x73cc('0x27')]=_0x343002[_0x73cc('0x27')]||0.03;this[_0x73cc('0x28')]=_0x343002[_0x73cc('0x28')]||0x258;this[_0x73cc('0x29')]=_0x343002['dialOriginateCallerIdName']||_0x73cc('0x2a');this[_0x73cc('0x2b')]=_0x343002['dialOriginateCallerIdNumber']||_0x73cc('0x2a');this[_0x73cc('0x2c')]=_0x343002[_0x73cc('0x2c')]||0x1e;this[_0x73cc('0x2d')]=_0x343002[_0x73cc('0x2d')]||_0x73cc('0x2e');this[_0x73cc('0x2f')]=_0x343002[_0x73cc('0x2f')]||0x3;this['dialQueueProject']=_0x343002['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x343002['dialCongestionMaxRetry']||0x3;this[_0x73cc('0x30')]=_0x343002[_0x73cc('0x30')]||0x96;this[_0x73cc('0x31')]=_0x343002[_0x73cc('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x343002[_0x73cc('0x32')]||0x96;this[_0x73cc('0x33')]=_0x343002[_0x73cc('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x343002['dialNoAnswerRetryFrequency']||0x96;this[_0x73cc('0x34')]=_0x343002[_0x73cc('0x34')]||0x3;this[_0x73cc('0x35')]=_0x343002['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x343002[_0x73cc('0x36')]||0x3;this[_0x73cc('0x37')]=_0x343002[_0x73cc('0x37')]||0x96;this[_0x73cc('0x38')]=_0x343002[_0x73cc('0x38')]||0x3;this[_0x73cc('0x39')]=_0x343002[_0x73cc('0x39')]||0x96;this[_0x73cc('0x3a')]=_0x343002[_0x73cc('0x3a')]||0x3;this[_0x73cc('0x3b')]=_0x343002[_0x73cc('0x3b')]||0x96;this[_0x73cc('0x3c')]=_0x343002[_0x73cc('0x3c')]||0x3;this[_0x73cc('0x3d')]=_0x343002[_0x73cc('0x3d')]||0x96;this[_0x73cc('0x3e')]=_0x343002['callAdditionalPhoneAfterMin']||0x3;this[_0x73cc('0x3f')]=_0x343002[_0x73cc('0x3f')]||0x4;this[_0x73cc('0x40')]=_0x343002[_0x73cc('0x40')]?_0x343002[_0x73cc('0x40')]:undefined;this[_0x73cc('0x41')]=_0x343002[_0x73cc('0x41')]?_0x343002[_0x73cc('0x41')]:undefined;this[_0x73cc('0x42')]=_0x343002[_0x73cc('0x42')]||undefined;this[_0x73cc('0x43')]=_0x343002[_0x73cc('0x43')]?_0x343002[_0x73cc('0x43')]:undefined;this[_0x73cc('0x44')]=_0x343002[_0x73cc('0x44')]||_0x73cc('0x45');this[_0x73cc('0x46')]=_0x343002[_0x73cc('0x46')]||undefined;this[_0x73cc('0x47')]=_0x343002[_0x73cc('0x47')]||undefined;this[_0x73cc('0x48')]=strategy[_0x343002[_0x73cc('0x48')]];this['queueStatusComplete']=!![];this[_0x73cc('0x49')]=_0x343002[_0x73cc('0x49')]||![];this[_0x73cc('0x4a')]=_0x343002[_0x73cc('0x4a')];this[_0x73cc('0x4b')]=_0x343002[_0x73cc('0x4b')];this[_0x73cc('0x4c')]=_0x343002[_0x73cc('0x4c')];this[_0x73cc('0x4d')]=_0x343002[_0x73cc('0x4d')];this['dialAMDMinWordLength']=_0x343002[_0x73cc('0x4e')];this[_0x73cc('0x4f')]=_0x343002['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x343002[_0x73cc('0x50')];this['dialAMDSilenceThreshold']=_0x343002[_0x73cc('0x51')];this[_0x73cc('0x52')]=_0x343002[_0x73cc('0x52')];this[_0x73cc('0x53')]=0x0;this[_0x73cc('0x54')]=0x0;this[_0x73cc('0x55')]=_0x343002[_0x73cc('0x55')];this[_0x73cc('0x56')]=0x0;this[_0x73cc('0x57')]=0x0;this[_0x73cc('0x58')]=0x0;this[_0x73cc('0x59')]=0x0;this[_0x73cc('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x73cc('0x5b')]=0x0;this[_0x73cc('0x5c')]=0x0;this[_0x73cc('0x5d')]=0x0;this[_0x73cc('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x73cc('0x5f')]=0x0;this[_0x73cc('0x60')]=undefined;this[_0x73cc('0x61')]=undefined;this[_0x73cc('0x62')]=undefined;this[_0x73cc('0x63')]=1.05;this[_0x73cc('0x64')]=0x0;this[_0x73cc('0x65')]=0x0;this[_0x73cc('0x66')]=0x0;this[_0x73cc('0x67')]=0x0;this[_0x73cc('0x68')]=0x0;this[_0x73cc('0x69')]=0x0;this[_0x73cc('0x6a')]=0x0;this[_0x73cc('0x6b')]=0x0;this[_0x73cc('0x6c')]=_0x343002['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x73cc('0x6d')]=_0x343002['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x73cc('0x6e')]=0x0;this[_0x73cc('0x6f')]=0x0;this[_0x73cc('0x70')]=0x1;this[_0x73cc('0x71')]=0x0;this[_0x73cc('0x72')]=0x0;this[_0x73cc('0x73')]=0x0;this[_0x73cc('0x74')]=0x0;this[_0x73cc('0x75')]=_0x343002[_0x73cc('0x75')]||0x1e;this[_0x73cc('0x76')]=_0x343002[_0x73cc('0x76')]||![];this['dialPreviewAutoRecallMe']=!!_0x343002[_0x73cc('0x77')]||![];this[_0x73cc('0x78')]=!!_0x343002[_0x73cc('0x78')]||![];this[_0x73cc('0x79')]=_0x343002[_0x73cc('0x79')]||undefined;this['dialAgiAfterHangupClient']=_0x343002['dialAgiAfterHangupClient']||![];this[_0x73cc('0x7a')]=_0x343002['dialAgiAfterHangupAgent']||![];this[_0x73cc('0xa')]=monitorFormat[_0x343002[_0x73cc('0xa')]]?monitorFormat[_0x343002[_0x73cc('0xa')]]:undefined;this[_0x73cc('0x7b')]=_0x343002[_0x73cc('0x7b')]||![];this[_0x73cc('0x7c')]=_0x343002[_0x73cc('0x7c')]?_0x343002[_0x73cc('0x7c')]:undefined;this[_0x73cc('0x7d')]=![];}module[_0x73cc('0x7e')]=VoiceQueue; \ No newline at end of file +var _0xc1dc=['leastrecent','random','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','invalid','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','gsm'];(function(_0x2acc06,_0x3f9dcf){var _0x18ad24=function(_0x440536){while(--_0x440536){_0x2acc06['push'](_0x2acc06['shift']());}};_0x18ad24(++_0x3f9dcf);}(_0xc1dc,0x84));var _0xcc1d=function(_0x261d3f,_0x11c164){_0x261d3f=_0x261d3f-0x0;var _0x2f25d1=_0xc1dc[_0x261d3f];return _0x2f25d1;};'use strict';var monitorFormat={'wav':_0xcc1d('0x0'),'wav49':_0xcc1d('0x1'),'gsm':_0xcc1d('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xcc1d('0x3'),'linear':'linear','random':_0xcc1d('0x4'),'ringall':_0xcc1d('0x5'),'rr':'roundrobin','rrmemory':_0xcc1d('0x6'),'rrordered':_0xcc1d('0x7'),'wrandom':_0xcc1d('0x8')};function VoiceQueue(_0x104603){this['id']=_0x104603['id']||0x0;this[_0xcc1d('0x9')]=_0x104603['name']||'';this['monitor_format']=_0x104603[_0xcc1d('0xa')]||'';this[_0xcc1d('0xb')]=_0x104603[_0xcc1d('0xb')]||_0xcc1d('0xc');this[_0xcc1d('0xd')]=0x0;this[_0xcc1d('0xe')]=0x0;this['answered']=0x0;this[_0xcc1d('0xf')]=0x0;this[_0xcc1d('0x10')]=0x0;this[_0xcc1d('0x11')]=0x0;this[_0xcc1d('0x12')]=0x0;this[_0xcc1d('0x13')]=0x0;this[_0xcc1d('0x14')]=0x0;this['busy']=0x0;this[_0xcc1d('0x15')]=0x0;this[_0xcc1d('0x16')]=0x0;this['loggedIn']=0x0;this[_0xcc1d('0x17')]=0x0;this[_0xcc1d('0x18')]=0x0;this[_0xcc1d('0x19')]=0x0;this[_0xcc1d('0x1a')]=0x0;this[_0xcc1d('0x1b')]=0x0;this[_0xcc1d('0x1c')]=0x0;this[_0xcc1d('0x1d')]=0x0;this['unknown']=0x0;this['acw']=_0x104603[_0xcc1d('0x1e')]||![];this['acwTimeout']=_0x104603[_0xcc1d('0x1f')]||0xa;this[_0xcc1d('0x20')]=_0x104603[_0xcc1d('0x20')]||'no';this[_0xcc1d('0x21')]=!![];this[_0xcc1d('0x22')]='';this[_0xcc1d('0x23')]='';this[_0xcc1d('0x24')]=0x0;this[_0xcc1d('0x25')]=0x0;this[_0xcc1d('0x26')]=_0x104603[_0xcc1d('0x26')]||null;this['dialGlobalInterval']=_0x104603['dialGlobalInterval']?_0x104603[_0xcc1d('0x27')]:null;this['dialActive']=_0x104603[_0xcc1d('0x28')];this[_0xcc1d('0x29')]=_0x104603[_0xcc1d('0x29')]||_0xcc1d('0x2a');this[_0xcc1d('0x2b')]=_0x104603[_0xcc1d('0x2b')]||0x0;this[_0xcc1d('0x2c')]=_0x104603[_0xcc1d('0x2c')]||0x0;this[_0xcc1d('0x2d')]=_0x104603['dialPowerLevel']||0x1;this[_0xcc1d('0x2e')]=_0x104603['dialPredictiveOptimization']||_0xcc1d('0x2f');this[_0xcc1d('0x30')]=_0x104603[_0xcc1d('0x30')]||0.03;this['dialPredictiveInterval']=_0x104603[_0xcc1d('0x31')]||0x258;this[_0xcc1d('0x32')]=_0x104603[_0xcc1d('0x32')]||_0xcc1d('0x33');this[_0xcc1d('0x34')]=_0x104603['dialOriginateCallerIdNumber']||_0xcc1d('0x33');this['dialOriginateTimeout']=_0x104603[_0xcc1d('0x35')]||0x1e;this[_0xcc1d('0x36')]=_0x104603[_0xcc1d('0x36')]||_0xcc1d('0x37');this[_0xcc1d('0x38')]=_0x104603['dialQueueTimeout']||0x3;this[_0xcc1d('0x39')]=_0x104603[_0xcc1d('0x39')]||undefined;this[_0xcc1d('0x3a')]=_0x104603['dialCongestionMaxRetry']||0x3;this[_0xcc1d('0x3b')]=_0x104603['dialCongestionRetryFrequency']||0x96;this[_0xcc1d('0x3c')]=_0x104603['dialBusyMaxRetry']||0x3;this[_0xcc1d('0x3d')]=_0x104603[_0xcc1d('0x3d')]||0x96;this[_0xcc1d('0x3e')]=_0x104603['dialNoAnswerMaxRetry']||0x3;this[_0xcc1d('0x3f')]=_0x104603[_0xcc1d('0x3f')]||0x96;this[_0xcc1d('0x40')]=_0x104603['dialNoSuchNumberMaxRetry']||0x3;this[_0xcc1d('0x41')]=_0x104603['dialNoSuchNumberRetryFrequency']||0x96;this[_0xcc1d('0x42')]=_0x104603[_0xcc1d('0x42')]||0x3;this[_0xcc1d('0x43')]=_0x104603[_0xcc1d('0x43')]||0x96;this[_0xcc1d('0x44')]=_0x104603['dialAbandonedMaxRetry']||0x3;this[_0xcc1d('0x45')]=_0x104603[_0xcc1d('0x45')]||0x96;this['dialMachineMaxRetry']=_0x104603[_0xcc1d('0x46')]||0x3;this['dialMachineRetryFrequency']=_0x104603[_0xcc1d('0x47')]||0x96;this['dialAgentRejectMaxRetry']=_0x104603['dialAgentRejectMaxRetry']||0x3;this[_0xcc1d('0x48')]=_0x104603['dialAgentRejectRetryFrequency']||0x96;this[_0xcc1d('0x49')]=_0x104603[_0xcc1d('0x49')]||0x3;this[_0xcc1d('0x4a')]=_0x104603[_0xcc1d('0x4a')]||0x4;this[_0xcc1d('0x4b')]=_0x104603[_0xcc1d('0x4b')]?_0x104603['Trunk']:undefined;this[_0xcc1d('0x4c')]=_0x104603['TrunkBackup']?_0x104603[_0xcc1d('0x4c')]:undefined;this[_0xcc1d('0x4d')]=_0x104603[_0xcc1d('0x4d')]||undefined;this[_0xcc1d('0x4e')]=_0x104603['Interval']?_0x104603[_0xcc1d('0x4e')]:undefined;this[_0xcc1d('0x4f')]=_0x104603[_0xcc1d('0x4f')]||_0xcc1d('0x50');this[_0xcc1d('0x51')]=_0x104603[_0xcc1d('0x51')]||undefined;this[_0xcc1d('0x52')]=_0x104603[_0xcc1d('0x52')]||undefined;this[_0xcc1d('0x53')]=strategy[_0x104603[_0xcc1d('0x53')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x104603[_0xcc1d('0x54')]||![];this[_0xcc1d('0x55')]=_0x104603['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x104603['dialAMDGreeting'];this[_0xcc1d('0x56')]=_0x104603[_0xcc1d('0x56')];this[_0xcc1d('0x57')]=_0x104603[_0xcc1d('0x57')];this[_0xcc1d('0x58')]=_0x104603[_0xcc1d('0x58')];this[_0xcc1d('0x59')]=_0x104603['dialAMDBetweenWordsSilence'];this[_0xcc1d('0x5a')]=_0x104603['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x104603['dialAMDSilenceThreshold'];this[_0xcc1d('0x5b')]=_0x104603[_0xcc1d('0x5b')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0xcc1d('0x5c')]=_0x104603['timeout'];this[_0xcc1d('0x5d')]=0x0;this[_0xcc1d('0x5e')]=0x0;this[_0xcc1d('0x5f')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xcc1d('0x60')]=0x0;this[_0xcc1d('0x61')]=0x0;this[_0xcc1d('0x62')]=0x0;this[_0xcc1d('0x63')]=0x0;this[_0xcc1d('0x64')]=0x0;this[_0xcc1d('0x65')]=0x0;this[_0xcc1d('0x66')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xcc1d('0x67')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xcc1d('0x68')]=undefined;this[_0xcc1d('0x69')]=undefined;this[_0xcc1d('0x6a')]=undefined;this[_0xcc1d('0x6b')]=1.05;this[_0xcc1d('0x6c')]=0x0;this[_0xcc1d('0x6d')]=0x0;this[_0xcc1d('0x6e')]=0x0;this[_0xcc1d('0x6f')]=0x0;this[_0xcc1d('0x70')]=0x0;this[_0xcc1d('0x71')]=0x0;this[_0xcc1d('0x72')]=0x0;this[_0xcc1d('0x73')]=0x0;this['predictiveIntervalMaxThreshold']=_0x104603[_0xcc1d('0x74')]||0x14;this[_0xcc1d('0x75')]=_0x104603[_0xcc1d('0x74')]||0xa;this[_0xcc1d('0x76')]=0x0;this[_0xcc1d('0x77')]=0x0;this[_0xcc1d('0x78')]=0x1;this[_0xcc1d('0x79')]=0x0;this[_0xcc1d('0x7a')]=0x0;this[_0xcc1d('0x7b')]=0x0;this[_0xcc1d('0x7c')]=0x0;this[_0xcc1d('0x7d')]=_0x104603['dialRecallMeTimeout']||0x1e;this[_0xcc1d('0x7e')]=_0x104603[_0xcc1d('0x7e')]||![];this[_0xcc1d('0x7f')]=!!_0x104603[_0xcc1d('0x7f')]||![];this[_0xcc1d('0x80')]=!!_0x104603[_0xcc1d('0x80')]||![];this[_0xcc1d('0x81')]=_0x104603[_0xcc1d('0x81')]||undefined;this[_0xcc1d('0x82')]=_0x104603[_0xcc1d('0x82')]||![];this[_0xcc1d('0x83')]=_0x104603[_0xcc1d('0x83')]||![];this[_0xcc1d('0xa')]=monitorFormat[_0x104603[_0xcc1d('0xa')]]?monitorFormat[_0x104603[_0xcc1d('0xa')]]:undefined;this[_0xcc1d('0x84')]=_0x104603[_0xcc1d('0x84')]||![];this[_0xcc1d('0x85')]=_0x104603[_0xcc1d('0x85')]?_0x104603[_0xcc1d('0x85')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xcc1d('0x86')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 2281739..6c1ad9f 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x308a=['startProgressive','statusMessage','Trunk','callerid','prototype','createReport','callers','length','SIP/','incall','status','booked','keys','queue','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','dialActive','message','active','updateReportFromOutboundQueue','outboundRejectCallsDay','preview','available','loggedInDb','paused','ringing','talking','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','total','type','unavailable','unknown','unmanaged','waiting','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive'];(function(_0x23e3b0,_0x5f2901){var _0x13c675=function(_0x4be356){while(--_0x4be356){_0x23e3b0['push'](_0x23e3b0['shift']());}};_0x13c675(++_0x5f2901);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var INBOUND_COUNTERS=[_0xa308('0x0'),'loggedIn',_0xa308('0x1'),_0xa308('0x2'),_0xa308('0x3'),_0xa308('0x4'),'waiting'];var OUTBOUND_COUNTERS=['available',_0xa308('0x5'),_0xa308('0x6'),_0xa308('0x7'),_0xa308('0x1'),_0xa308('0x8'),_0xa308('0x9'),_0xa308('0xa'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0xa308('0xb'),_0xa308('0xc'),'outboundNoSuchCallsDay',_0xa308('0xd'),'outboundRejectCallsDay',_0xa308('0xe'),'paused',_0xa308('0xf'),_0xa308('0x4'),'sumBillable',_0xa308('0x10'),'total','waiting'];function VoiceQueueSummary(_0x34061b){this['id']=_0x34061b['id'];this[_0xa308('0x11')]=_0x34061b[_0xa308('0x11')];this[_0xa308('0x12')]=_0x34061b[_0xa308('0x12')];this[_0xa308('0x13')]=_0x34061b['abandoned']||0x0;this[_0xa308('0x5')]=_0x34061b[_0xa308('0x5')]||0x0;this[_0xa308('0x0')]=_0x34061b[_0xa308('0x0')]||0x0;this[_0xa308('0x14')]=_0x34061b['busy']||0x0;this['inUse']=_0x34061b[_0xa308('0x6')]||0x0;this[_0xa308('0x15')]=_0x34061b[_0xa308('0x15')]||0x0;this[_0xa308('0x7')]=_0x34061b[_0xa308('0x7')]||0x0;this['loggedInDb']=_0x34061b[_0xa308('0x1')]||0x0;this[_0xa308('0x16')]=_0x34061b[_0xa308('0x16')]||0x0;this[_0xa308('0x17')]=_0x34061b[_0xa308('0x17')]||0x0;this[_0xa308('0x2')]=_0x34061b['paused']||0x0;this[_0xa308('0x3')]=_0x34061b[_0xa308('0x3')]||0x0;this[_0xa308('0x18')]=_0x34061b['ringInUse'];this[_0xa308('0x19')]=_0x34061b[_0xa308('0x19')];this[_0xa308('0x10')]=_0x34061b[_0xa308('0x10')];this[_0xa308('0x1a')]=_0x34061b[_0xa308('0x1a')]||0x0;this[_0xa308('0x4')]=_0x34061b['talking']||0x0;this[_0xa308('0x1b')]=_0x34061b[_0xa308('0x1b')]||0x0;this[_0xa308('0x1c')]=_0x34061b[_0xa308('0x1c')];this[_0xa308('0x1d')]=_0x34061b['unavailable']||0x0;this[_0xa308('0x1e')]=_0x34061b[_0xa308('0x1e')]||0x0;this[_0xa308('0x1f')]=_0x34061b[_0xa308('0x1f')]||0x0;this['waiting']=_0x34061b[_0xa308('0x20')]||0x0;if(_0x34061b[_0xa308('0x1c')]===_0xa308('0x21')){this['pTalking']=_0x34061b[_0xa308('0xf')]||0x0;this['dialActive']=_0x34061b['dialActive'];this[_0xa308('0x22')]=_0x34061b['dialMethod'];this['dialOriginateCallerIdName']=_0x34061b[_0xa308('0x23')];this[_0xa308('0x24')]=_0x34061b[_0xa308('0x24')];this['dialOriginateTimeout']=_0x34061b[_0xa308('0x25')];this[_0xa308('0x26')]=_0x34061b[_0xa308('0x26')];this[_0xa308('0x27')]=_0x34061b[_0xa308('0x27')];this[_0xa308('0x28')]=_0x34061b['outboundAnswerAgiCallsDay'];this[_0xa308('0xa')]=_0x34061b[_0xa308('0xa')];this[_0xa308('0x29')]=_0x34061b[_0xa308('0x29')];this[_0xa308('0x2a')]=_0x34061b[_0xa308('0x2a')];this['outboundCongestionCallsDay']=_0x34061b[_0xa308('0xb')];this[_0xa308('0x2b')]=_0x34061b[_0xa308('0x2b')];this['outboundDropCallsDayCallersExit']=_0x34061b[_0xa308('0x2c')];this['outboundDropCallsDayTimeout']=_0x34061b[_0xa308('0x2d')];this[_0xa308('0xc')]=_0x34061b[_0xa308('0xc')];this[_0xa308('0x2e')]=_0x34061b['outboundNoSuchCallsDay'];this[_0xa308('0x2f')]=_0x34061b[_0xa308('0x2f')];this[_0xa308('0xd')]=_0x34061b[_0xa308('0xd')];this['outboundRejectCallsDay']=_0x34061b['outboundRejectCallsDay'];this[_0xa308('0xe')]=_0x34061b[_0xa308('0xe')];this[_0xa308('0x30')]=_0x34061b['predictiveIntervalAnsweredCalls'];this[_0xa308('0x31')]=_0x34061b['predictiveIntervalAvgHoldtime'];this[_0xa308('0x32')]=_0x34061b[_0xa308('0x32')];this[_0xa308('0x33')]=_0x34061b[_0xa308('0x33')];this[_0xa308('0x34')]=_0x34061b[_0xa308('0x34')];this['predictiveIntervalErlangCalls']=_0x34061b[_0xa308('0x35')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x34061b['predictiveIntervalErlangCallsDroppedCalls'];this[_0xa308('0x36')]=_0x34061b['predictiveIntervalHitRate'];this[_0xa308('0x37')]=_0x34061b[_0xa308('0x37')];this[_0xa308('0x38')]=_0x34061b['predictiveIntervalPauses'];this[_0xa308('0x39')]=_0x34061b[_0xa308('0x39')];this[_0xa308('0x3a')]=_0x34061b[_0xa308('0x3a')];this[_0xa308('0x8')]=_0x34061b[_0xa308('0x8')];this[_0xa308('0x3b')]=_0x34061b[_0xa308('0x3b')];this[_0xa308('0x3c')]=_0x34061b['erlangCallToSecond'];this['erlangAbandonmentRate']=_0x34061b[_0xa308('0x3d')];this['erlangBusyFactor']=_0x34061b['erlangBusyFactor'];this[_0xa308('0x3e')]=_0x34061b[_0xa308('0x3e')];this[_0xa308('0x3f')]=_0x34061b[_0xa308('0x3f')];this['message']=_0x34061b['message'];this[_0xa308('0x40')]=_0x34061b['statusMessage'];}if(_0x34061b[_0xa308('0x41')]){this[_0xa308('0x41')]={'id':_0x34061b[_0xa308('0x41')]['id'],'name':_0x34061b[_0xa308('0x41')]['name'],'active':_0x34061b['Trunk']['active'],'callerid':_0x34061b['Trunk'][_0xa308('0x42')]};}}VoiceQueueSummary[_0xa308('0x43')][_0xa308('0x44')]=function(_0x35eac0,_0x55c49e,_0x59fb00,_0x218e4b){this['loggedInDb']=0x0;this[_0xa308('0x4')]=0x0;this[_0xa308('0x2')]=0x0;this[_0xa308('0x1e')]=0x0;this[_0xa308('0x17')]=0x0;this[_0xa308('0x6')]=0x0;this['busy']=0x0;this[_0xa308('0x15')]=0x0;this[_0xa308('0x1d')]=0x0;this[_0xa308('0x3')]=0x0;this[_0xa308('0x18')]=0x0;this['onHold']=0x0;if(_0x59fb00){if(_0x59fb00[_0xa308('0x0')]){this[_0xa308('0x0')]=Number(_0x59fb00[_0xa308('0x0')]);}if(_0x59fb00['loggedin']){this[_0xa308('0x7')]=Number(_0x59fb00['loggedin']);}if(_0x59fb00[_0xa308('0x45')]){this[_0xa308('0x20')]=Number(_0x59fb00[_0xa308('0x45')]);}}for(var _0x3e81b9=0x0;_0x3e81b9<_0x35eac0[_0xa308('0x46')];_0x3e81b9++){var _0x201781=_0x55c49e[_0xa308('0x47')+_0x35eac0[_0x3e81b9][_0xa308('0x11')]];if(_0x201781&&_0x201781['online']){this[_0xa308('0x1')]+=0x1;}if(_0x35eac0[_0x3e81b9][_0xa308('0x48')]==='1'){this[_0xa308('0x4')]+=0x1;}if(_0x35eac0[_0x3e81b9][_0xa308('0x2')]==='1'&&!['2','7','8']['includes'](_0x35eac0[_0x3e81b9]['status'])){this[_0xa308('0x2')]+=0x1;}switch(_0x35eac0[_0x3e81b9][_0xa308('0x49')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xa308('0x17')]+=0x1;break;case'2':this[_0xa308('0x6')]+=0x1;break;case'3':this[_0xa308('0x14')]+=0x1;break;case'4':this[_0xa308('0x15')]+=0x1;break;case'5':this[_0xa308('0x1d')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xa308('0x18')]+=0x1;break;case'8':this[_0xa308('0x16')]+=0x1;break;}}if(this[_0xa308('0x22')]===_0xa308('0x4a')){var _0x3a5de0=Object[_0xa308('0x4b')](_0x218e4b);for(var _0x234938=0x0;_0x234938<_0x3a5de0['length'];_0x234938++){var _0x406841=_0x3a5de0[_0x234938];var _0x54465d=_0x218e4b[_0x406841];if(_0x54465d[_0xa308('0x4c')]===this['name']&&_0x54465d[_0xa308('0x1c')]==='dialer'&&_0x54465d[_0xa308('0x4d')]===_0xa308('0x4e')){this['talking']+=0x1;}}if(this['talking']>this[_0xa308('0x6')]){this[_0xa308('0x4')]=this[_0xa308('0x6')];}this[_0xa308('0xf')]=0x0;}return this;};VoiceQueueSummary[_0xa308('0x43')][_0xa308('0x4f')]=function(_0x5d05a4){var _0x4239c4=![];if(_0x5d05a4){_0x4239c4=INBOUND_COUNTERS[_0xa308('0x50')](function(_0x20719f){return this[_0x20719f]!==_0x5d05a4[_0x20719f];},this);}return _0x4239c4;};VoiceQueueSummary['prototype'][_0xa308('0x51')]=function(_0x5e3778){var _0x1ac955=![];var _0x419ede=![];var _0x15739e=![];if(_0x5e3778){_0x1ac955=this['dialMethod']!==_0x5e3778[_0xa308('0x22')]||this[_0xa308('0x52')]!==_0x5e3778[_0xa308('0x52')]||this[_0xa308('0x53')]!==_0x5e3778[_0xa308('0x53')]||this[_0xa308('0x40')]!==_0x5e3778[_0xa308('0x40')];_0x419ede=OUTBOUND_COUNTERS[_0xa308('0x50')](function(_0x2107aa){return this[_0x2107aa]!==_0x5e3778[_0x2107aa];},this);if(this[_0xa308('0x41')]&&_0x5e3778[_0xa308('0x41')]){_0x15739e=this[_0xa308('0x41')][_0xa308('0x11')]!==_0x5e3778[_0xa308('0x41')]['name']||this['Trunk']['active']!==_0x5e3778[_0xa308('0x41')][_0xa308('0x54')];}}return _0x1ac955||_0x419ede||_0x15739e;};VoiceQueueSummary[_0xa308('0x43')][_0xa308('0x55')]=function(_0x15f13b){this[_0xa308('0x5')]=_0x15f13b['answered'];this[_0xa308('0x53')]=_0x15f13b[_0xa308('0x53')];this[_0xa308('0x40')]=_0x15f13b[_0xa308('0x40')];this[_0xa308('0x8')]=_0x15f13b[_0xa308('0x8')];this[_0xa308('0x9')]=_0x15f13b[_0xa308('0x9')];this[_0xa308('0xa')]=_0x15f13b['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x15f13b['outboundBlacklistCallsDay'];this[_0xa308('0x2a')]=_0x15f13b[_0xa308('0x2a')];this[_0xa308('0xb')]=_0x15f13b['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x15f13b['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x15f13b['outboundNoSuchCallsDay'];this[_0xa308('0xd')]=_0x15f13b['outboundReCallsDay'];this[_0xa308('0x56')]=_0x15f13b[_0xa308('0x56')];this['outboundUnknownCallsDay']=_0x15f13b[_0xa308('0xe')];this[_0xa308('0x19')]=_0x15f13b[_0xa308('0x19')];this[_0xa308('0x10')]=_0x15f13b[_0xa308('0x10')];this[_0xa308('0x1b')]=_0x15f13b['total'];if(this[_0xa308('0x22')]===_0xa308('0x57')){this[_0xa308('0xf')]=_0x15f13b[_0xa308('0xf')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x3fa4=['abandoned','busy','invalid','loggedInDb','onHold','paused','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','notInUse','loggedin','length','SIP/','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','prototype','preview','exports','available','ringing','talking','waiting','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x3fa4,0xf0));var _0x43fa=function(_0x2a5596,_0x42d66c){_0x2a5596=_0x2a5596-0x0;var _0x4c7986=_0x3fa4[_0x2a5596];return _0x4c7986;};'use strict';var INBOUND_COUNTERS=[_0x43fa('0x0'),'loggedIn','loggedInDb','paused',_0x43fa('0x1'),_0x43fa('0x2'),_0x43fa('0x3')];var OUTBOUND_COUNTERS=[_0x43fa('0x0'),_0x43fa('0x4'),_0x43fa('0x5'),_0x43fa('0x6'),'loggedInDb',_0x43fa('0x7'),_0x43fa('0x8'),_0x43fa('0x9'),'outboundBlacklistCallsDay',_0x43fa('0xa'),_0x43fa('0xb'),_0x43fa('0xc'),'outboundNoSuchCallsDay',_0x43fa('0xd'),_0x43fa('0xe'),'outboundUnknownCallsDay','paused',_0x43fa('0xf'),_0x43fa('0x2'),_0x43fa('0x10'),_0x43fa('0x11'),_0x43fa('0x12'),'waiting'];function VoiceQueueSummary(_0x464e7b){this['id']=_0x464e7b['id'];this[_0x43fa('0x13')]=_0x464e7b[_0x43fa('0x13')];this['strategy']=_0x464e7b[_0x43fa('0x14')];this[_0x43fa('0x15')]=_0x464e7b[_0x43fa('0x15')]||0x0;this['answered']=_0x464e7b[_0x43fa('0x4')]||0x0;this['available']=_0x464e7b['available']||0x0;this['busy']=_0x464e7b[_0x43fa('0x16')]||0x0;this['inUse']=_0x464e7b[_0x43fa('0x5')]||0x0;this[_0x43fa('0x17')]=_0x464e7b['invalid']||0x0;this[_0x43fa('0x6')]=_0x464e7b[_0x43fa('0x6')]||0x0;this[_0x43fa('0x18')]=_0x464e7b[_0x43fa('0x18')]||0x0;this[_0x43fa('0x19')]=_0x464e7b[_0x43fa('0x19')]||0x0;this['notInUse']=_0x464e7b['notInUse']||0x0;this[_0x43fa('0x1a')]=_0x464e7b[_0x43fa('0x1a')]||0x0;this[_0x43fa('0x1')]=_0x464e7b[_0x43fa('0x1')]||0x0;this[_0x43fa('0x1b')]=_0x464e7b[_0x43fa('0x1b')];this[_0x43fa('0x10')]=_0x464e7b[_0x43fa('0x10')];this[_0x43fa('0x11')]=_0x464e7b['sumDuration'];this[_0x43fa('0x1c')]=_0x464e7b[_0x43fa('0x1c')]||0x0;this[_0x43fa('0x2')]=_0x464e7b[_0x43fa('0x2')]||0x0;this[_0x43fa('0x12')]=_0x464e7b['total']||0x0;this[_0x43fa('0x1d')]=_0x464e7b[_0x43fa('0x1d')];this[_0x43fa('0x1e')]=_0x464e7b[_0x43fa('0x1e')]||0x0;this[_0x43fa('0x1f')]=_0x464e7b[_0x43fa('0x1f')]||0x0;this[_0x43fa('0x20')]=_0x464e7b[_0x43fa('0x20')]||0x0;this[_0x43fa('0x3')]=_0x464e7b['waiting']||0x0;if(_0x464e7b['type']===_0x43fa('0x21')){this[_0x43fa('0xf')]=_0x464e7b[_0x43fa('0xf')]||0x0;this[_0x43fa('0x22')]=_0x464e7b[_0x43fa('0x22')];this[_0x43fa('0x23')]=_0x464e7b['dialMethod'];this['dialOriginateCallerIdName']=_0x464e7b[_0x43fa('0x24')];this[_0x43fa('0x25')]=_0x464e7b[_0x43fa('0x25')];this[_0x43fa('0x26')]=_0x464e7b['dialOriginateTimeout'];this[_0x43fa('0x27')]=_0x464e7b[_0x43fa('0x27')];this[_0x43fa('0x28')]=_0x464e7b[_0x43fa('0x28')];this['outboundAnswerAgiCallsDay']=_0x464e7b[_0x43fa('0x29')];this[_0x43fa('0x9')]=_0x464e7b[_0x43fa('0x9')];this[_0x43fa('0x2a')]=_0x464e7b[_0x43fa('0x2a')];this[_0x43fa('0xa')]=_0x464e7b[_0x43fa('0xa')];this[_0x43fa('0xb')]=_0x464e7b[_0x43fa('0xb')];this[_0x43fa('0x2b')]=_0x464e7b[_0x43fa('0x2b')];this[_0x43fa('0x2c')]=_0x464e7b['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x464e7b[_0x43fa('0x2d')];this[_0x43fa('0xc')]=_0x464e7b[_0x43fa('0xc')];this[_0x43fa('0x2e')]=_0x464e7b['outboundNoSuchCallsDay'];this[_0x43fa('0x2f')]=_0x464e7b[_0x43fa('0x2f')];this[_0x43fa('0xd')]=_0x464e7b['outboundReCallsDay'];this[_0x43fa('0xe')]=_0x464e7b[_0x43fa('0xe')];this[_0x43fa('0x30')]=_0x464e7b[_0x43fa('0x30')];this['predictiveIntervalAnsweredCalls']=_0x464e7b[_0x43fa('0x31')];this['predictiveIntervalAvgHoldtime']=_0x464e7b[_0x43fa('0x32')];this[_0x43fa('0x33')]=_0x464e7b[_0x43fa('0x33')];this['predictiveIntervalDroppedCallsCallersExit']=_0x464e7b[_0x43fa('0x34')];this['predictiveIntervalDroppedCallsTimeout']=_0x464e7b['predictiveIntervalDroppedCallsTimeout'];this[_0x43fa('0x35')]=_0x464e7b[_0x43fa('0x35')];this[_0x43fa('0x36')]=_0x464e7b['predictiveIntervalErlangCallsDroppedCalls'];this[_0x43fa('0x37')]=_0x464e7b[_0x43fa('0x37')];this[_0x43fa('0x38')]=_0x464e7b[_0x43fa('0x38')];this[_0x43fa('0x39')]=_0x464e7b['predictiveIntervalPauses'];this[_0x43fa('0x3a')]=_0x464e7b[_0x43fa('0x3a')];this[_0x43fa('0x3b')]=_0x464e7b[_0x43fa('0x3b')];this['originated']=_0x464e7b['originated'];this[_0x43fa('0x3c')]=_0x464e7b[_0x43fa('0x3c')];this[_0x43fa('0x3d')]=_0x464e7b[_0x43fa('0x3d')];this[_0x43fa('0x3e')]=_0x464e7b['erlangAbandonmentRate'];this[_0x43fa('0x3f')]=_0x464e7b['erlangBusyFactor'];this['startPredictive']=_0x464e7b[_0x43fa('0x40')];this['startProgressive']=_0x464e7b[_0x43fa('0x41')];this[_0x43fa('0x42')]=_0x464e7b[_0x43fa('0x42')];this[_0x43fa('0x43')]=_0x464e7b['statusMessage'];}if(_0x464e7b['Trunk']){this['Trunk']={'id':_0x464e7b[_0x43fa('0x44')]['id'],'name':_0x464e7b[_0x43fa('0x44')]['name'],'active':_0x464e7b[_0x43fa('0x44')][_0x43fa('0x45')],'callerid':_0x464e7b[_0x43fa('0x44')][_0x43fa('0x46')]};}}VoiceQueueSummary['prototype'][_0x43fa('0x47')]=function(_0x23e156,_0x4ac89a,_0x5e453f,_0x21e7d6){this['loggedInDb']=0x0;this[_0x43fa('0x2')]=0x0;this[_0x43fa('0x1a')]=0x0;this['unknown']=0x0;this[_0x43fa('0x48')]=0x0;this['inUse']=0x0;this[_0x43fa('0x16')]=0x0;this[_0x43fa('0x17')]=0x0;this[_0x43fa('0x1e')]=0x0;this['ringing']=0x0;this[_0x43fa('0x1b')]=0x0;this[_0x43fa('0x19')]=0x0;if(_0x5e453f){if(_0x5e453f[_0x43fa('0x0')]){this[_0x43fa('0x0')]=Number(_0x5e453f[_0x43fa('0x0')]);}if(_0x5e453f[_0x43fa('0x49')]){this['loggedIn']=Number(_0x5e453f[_0x43fa('0x49')]);}if(_0x5e453f['callers']){this[_0x43fa('0x3')]=Number(_0x5e453f['callers']);}}for(var _0x1e6a3c=0x0;_0x1e6a3c<_0x23e156[_0x43fa('0x4a')];_0x1e6a3c++){var _0x132a0b=_0x4ac89a[_0x43fa('0x4b')+_0x23e156[_0x1e6a3c][_0x43fa('0x13')]];if(_0x132a0b&&_0x132a0b['online']){this[_0x43fa('0x18')]+=0x1;}if(_0x23e156[_0x1e6a3c]['incall']==='1'){this['talking']+=0x1;}if(_0x23e156[_0x1e6a3c]['paused']==='1'&&!['2','7','8'][_0x43fa('0x4c')](_0x23e156[_0x1e6a3c][_0x43fa('0x4d')])){this[_0x43fa('0x1a')]+=0x1;}switch(_0x23e156[_0x1e6a3c][_0x43fa('0x4d')]){case'0':this[_0x43fa('0x1f')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x43fa('0x5')]+=0x1;break;case'3':this[_0x43fa('0x16')]+=0x1;break;case'4':this[_0x43fa('0x17')]+=0x1;break;case'5':this[_0x43fa('0x1e')]+=0x1;break;case'6':this[_0x43fa('0x1')]+=0x1;break;case'7':this[_0x43fa('0x1b')]+=0x1;break;case'8':this[_0x43fa('0x19')]+=0x1;break;}}if(this[_0x43fa('0x23')]===_0x43fa('0x4e')){var _0x458e11=Object[_0x43fa('0x4f')](_0x21e7d6);for(var _0x52d66f=0x0;_0x52d66f<_0x458e11[_0x43fa('0x4a')];_0x52d66f++){var _0x2a06ff=_0x458e11[_0x52d66f];var _0x4b84f6=_0x21e7d6[_0x2a06ff];if(_0x4b84f6[_0x43fa('0x50')]===this['name']&&_0x4b84f6[_0x43fa('0x1d')]===_0x43fa('0x51')&&_0x4b84f6[_0x43fa('0x52')]===_0x43fa('0x53')){this[_0x43fa('0x2')]+=0x1;}}if(this['talking']>this[_0x43fa('0x5')]){this['talking']=this[_0x43fa('0x5')];}this[_0x43fa('0xf')]=0x0;}return this;};VoiceQueueSummary[_0x43fa('0x54')]['compareToInboundQueue']=function(_0x5cbcd9){var _0xc3f7aa=![];if(_0x5cbcd9){_0xc3f7aa=INBOUND_COUNTERS['some'](function(_0x2ca431){return this[_0x2ca431]!==_0x5cbcd9[_0x2ca431];},this);}return _0xc3f7aa;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x2228e0){var _0x393842=![];var _0x4c48b5=![];var _0x43f94c=![];if(_0x2228e0){_0x393842=this[_0x43fa('0x23')]!==_0x2228e0[_0x43fa('0x23')]||this[_0x43fa('0x22')]!==_0x2228e0['dialActive']||this[_0x43fa('0x42')]!==_0x2228e0[_0x43fa('0x42')]||this[_0x43fa('0x43')]!==_0x2228e0[_0x43fa('0x43')];_0x4c48b5=OUTBOUND_COUNTERS['some'](function(_0x4cdf94){return this[_0x4cdf94]!==_0x2228e0[_0x4cdf94];},this);if(this[_0x43fa('0x44')]&&_0x2228e0['Trunk']){_0x43f94c=this['Trunk']['name']!==_0x2228e0[_0x43fa('0x44')][_0x43fa('0x13')]||this[_0x43fa('0x44')][_0x43fa('0x45')]!==_0x2228e0[_0x43fa('0x44')][_0x43fa('0x45')];}}return _0x393842||_0x4c48b5||_0x43f94c;};VoiceQueueSummary[_0x43fa('0x54')]['updateReportFromOutboundQueue']=function(_0x41134e){this[_0x43fa('0x4')]=_0x41134e['answered'];this[_0x43fa('0x42')]=_0x41134e['message'];this[_0x43fa('0x43')]=_0x41134e[_0x43fa('0x43')];this[_0x43fa('0x7')]=_0x41134e[_0x43fa('0x7')];this['outboundAbandonedCallsDay']=_0x41134e['outboundAbandonedCallsDay'];this[_0x43fa('0x9')]=_0x41134e[_0x43fa('0x9')];this[_0x43fa('0x2a')]=_0x41134e[_0x43fa('0x2a')];this['outboundBusyCallsDay']=_0x41134e['outboundBusyCallsDay'];this[_0x43fa('0xb')]=_0x41134e['outboundCongestionCallsDay'];this[_0x43fa('0xc')]=_0x41134e[_0x43fa('0xc')];this[_0x43fa('0x2e')]=_0x41134e[_0x43fa('0x2e')];this['outboundReCallsDay']=_0x41134e['outboundReCallsDay'];this[_0x43fa('0xe')]=_0x41134e['outboundRejectCallsDay'];this[_0x43fa('0x30')]=_0x41134e[_0x43fa('0x30')];this[_0x43fa('0x10')]=_0x41134e[_0x43fa('0x10')];this[_0x43fa('0x11')]=_0x41134e[_0x43fa('0x11')];this[_0x43fa('0x12')]=_0x41134e['total'];if(this[_0x43fa('0x23')]===_0x43fa('0x55')){this[_0x43fa('0xf')]=_0x41134e[_0x43fa('0xf')];}};module[_0x43fa('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index c1dcf7e..81e169d 100644 --- a/server/services/ami/model/vtigerAccount.js +++ b/server/services/ami/model/vtigerAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa412=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x450082,_0x405da5){var _0x8308c0=function(_0x139fc4){while(--_0x139fc4){_0x450082['push'](_0x450082['shift']());}};_0x8308c0(++_0x405da5);}(_0xa412,0x1c3));var _0x2a41=function(_0x258bc6,_0x3fe539){_0x258bc6=_0x258bc6-0x0;var _0x19d493=_0xa412[_0x258bc6];return _0x19d493;};'use strict';function VtigerAccount(_0x1ea84c){this['id']=_0x1ea84c['id']||0x0;this[_0x2a41('0x0')]=_0x1ea84c[_0x2a41('0x0')]||'';this['username']=_0x1ea84c[_0x2a41('0x1')]||'';this['accessKey']=_0x1ea84c[_0x2a41('0x2')]||'';this[_0x2a41('0x3')]=_0x1ea84c[_0x2a41('0x3')]||'';this['serverUrl']=_0x1ea84c[_0x2a41('0x4')]||'';this[_0x2a41('0x5')]=_0x1ea84c[_0x2a41('0x5')]||{};}module[_0x2a41('0x6')]=VtigerAccount; \ No newline at end of file +var _0xf5dc=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2dab01,_0xceace5){var _0x292ff3=function(_0x493edc){while(--_0x493edc){_0x2dab01['push'](_0x2dab01['shift']());}};_0x292ff3(++_0xceace5);}(_0xf5dc,0x1be));var _0xcf5d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf5dc[_0xfae23b];return _0x200640;};'use strict';function VtigerAccount(_0x243f0a){this['id']=_0x243f0a['id']||0x0;this[_0xcf5d('0x0')]=_0x243f0a['name']||'';this[_0xcf5d('0x1')]=_0x243f0a['username']||'';this[_0xcf5d('0x2')]=_0x243f0a['accessKey']||'';this[_0xcf5d('0x3')]=_0x243f0a[_0xcf5d('0x3')]||'';this['serverUrl']=_0x243f0a[_0xcf5d('0x4')]||'';this[_0xcf5d('0x5')]=_0x243f0a['Configurations']||{};}module[_0xcf5d('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 2647624..7798a64 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5899=['exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5899,0x85));var _0x9589=function(_0x2c1693,_0x12055){_0x2c1693=_0x2c1693-0x0;var _0x1605bc=_0x5899[_0x2c1693];return _0x1605bc;};'use strict';function ZendeskAccount(_0x5a6a3d){this['id']=_0x5a6a3d['id']||0x0;this[_0x9589('0x0')]=_0x5a6a3d[_0x9589('0x0')]||'';this[_0x9589('0x1')]=_0x5a6a3d[_0x9589('0x1')]||'';this[_0x9589('0x2')]=_0x5a6a3d[_0x9589('0x2')]||'';this[_0x9589('0x3')]=_0x5a6a3d[_0x9589('0x3')]||'';this['remoteUri']=_0x5a6a3d[_0x9589('0x4')]||'';this[_0x9589('0x5')]=_0x5a6a3d[_0x9589('0x5')]||'';this[_0x9589('0x6')]=_0x5a6a3d[_0x9589('0x6')]||_0x9589('0x7');this[_0x9589('0x8')]=_0x5a6a3d[_0x9589('0x8')]||'';this[_0x9589('0x9')]=_0x5a6a3d['Configurations']||{};}module[_0x9589('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x5fc3=['name','username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5fc3,0x1e0));var _0x35fc=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0x5fc3[_0x13992d];return _0x3d15bf;};'use strict';function ZendeskAccount(_0x156930){this['id']=_0x156930['id']||0x0;this[_0x35fc('0x0')]=_0x156930['name']||'';this[_0x35fc('0x1')]=_0x156930[_0x35fc('0x1')]||'';this[_0x35fc('0x2')]=_0x156930[_0x35fc('0x2')]||'';this[_0x35fc('0x3')]=_0x156930[_0x35fc('0x3')]||'';this['remoteUri']=_0x156930[_0x35fc('0x4')]||'';this[_0x35fc('0x5')]=_0x156930[_0x35fc('0x5')]||'';this[_0x35fc('0x6')]=_0x156930[_0x35fc('0x6')]||'integrationTab';this[_0x35fc('0x7')]=_0x156930[_0x35fc('0x7')]||'';this[_0x35fc('0x8')]=_0x156930[_0x35fc('0x8')]||{};}module[_0x35fc('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a239038..29d2ceb 100644 --- a/server/services/ami/model/zohoAccount.js +++ b/server/services/ami/model/zohoAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x38bcdb,_0x36175e){var _0x25e102=function(_0x2d1372){while(--_0x2d1372){_0x38bcdb['push'](_0x38bcdb['shift']());}};_0x25e102(++_0x36175e);}(_0x2d17,0x147));var _0x72d1=function(_0x296487,_0x14eab5){_0x296487=_0x296487-0x0;var _0x4c7af7=_0x2d17[_0x296487];return _0x4c7af7;};'use strict';function ZohoAccount(_0x47174d){this['id']=_0x47174d['id']||0x0;this[_0x72d1('0x0')]=_0x47174d[_0x72d1('0x0')]||'';this[_0x72d1('0x1')]=_0x47174d[_0x72d1('0x1')]||'';this[_0x72d1('0x2')]=_0x47174d['host']||'';this[_0x72d1('0x3')]=_0x47174d['zone']||'';this[_0x72d1('0x4')]=_0x47174d[_0x72d1('0x4')]||'';this[_0x72d1('0x5')]=_0x47174d['clientSecret']||'';this[_0x72d1('0x6')]=_0x47174d['serverUrl']||'';this['code']=_0x47174d[_0x72d1('0x7')]||'';this[_0x72d1('0x8')]=_0x47174d[_0x72d1('0x8')]||'';this[_0x72d1('0x9')]=_0x47174d['Configurations']||{};}module[_0x72d1('0xa')]=ZohoAccount; \ No newline at end of file +var _0xf74c=['zone','clientId','clientSecret','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x4409e7,_0x5135be){var _0x280909=function(_0xb1e3e2){while(--_0xb1e3e2){_0x4409e7['push'](_0x4409e7['shift']());}};_0x280909(++_0x5135be);}(_0xf74c,0x1a1));var _0xcf74=function(_0x1d4b6c,_0x50eeb5){_0x1d4b6c=_0x1d4b6c-0x0;var _0x20e935=_0xf74c[_0x1d4b6c];return _0x20e935;};'use strict';function ZohoAccount(_0x5bc4ff){this['id']=_0x5bc4ff['id']||0x0;this[_0xcf74('0x0')]=_0x5bc4ff['name']||'';this[_0xcf74('0x1')]=_0x5bc4ff[_0xcf74('0x1')]||'';this[_0xcf74('0x2')]=_0x5bc4ff[_0xcf74('0x2')]||'';this[_0xcf74('0x3')]=_0x5bc4ff['zone']||'';this[_0xcf74('0x4')]=_0x5bc4ff[_0xcf74('0x4')]||'';this['clientSecret']=_0x5bc4ff[_0xcf74('0x5')]||'';this['serverUrl']=_0x5bc4ff['serverUrl']||'';this[_0xcf74('0x6')]=_0x5bc4ff[_0xcf74('0x6')]||'';this[_0xcf74('0x7')]=_0x5bc4ff['refreshToken']||'';this[_0xcf74('0x8')]=_0x5bc4ff['Configurations']||{};}module[_0xcf74('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 4795db2..466612c 100644 --- a/server/services/ami/preview/action.js +++ b/server/services/ami/preview/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe511=['name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','number','util','lodash','string','isNil','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0x5e0edb,_0x356b7f){var _0x7453b0=function(_0x97b222){while(--_0x97b222){_0x5e0edb['push'](_0x5e0edb['shift']());}};_0x7453b0(++_0x356b7f);}(_0xe511,0x16f));var _0x1e51=function(_0x1b982d,_0x184357){_0x1b982d=_0x1b982d-0x0;var _0x26e916=_0xe511[_0x1b982d];return _0x26e916;};'use strict';var util=require(_0x1e51('0x0'));var _=require(_0x1e51('0x1'));var moment=require('moment');function checkNameSurname(_0x2a5905,_0x5b9e45,_0x253e96){var _0xb75a96='';if(!_['isNil'](_0x5b9e45)&&_0x1e51('0x2')===typeof _0x5b9e45){_0xb75a96+=_0x5b9e45;}if(!_[_0x1e51('0x3')](_0x253e96)&&_0x1e51('0x2')===typeof _0x253e96){_0xb75a96+='\x20'+_0x253e96;}if(_0xb75a96!==''){return _0xb75a96;}return _0x2a5905;}function Action(_0x16ec99,_0x480cca,_0x26b22c,_0x21ed6b,_0x5c4590){this['uniqueid']=_0x26b22c||undefined;this[_0x1e51('0x4')]=_0x16ec99['id'];this[_0x1e51('0x5')]=_0x480cca['name'];this['type']=_0x480cca[_0x1e51('0x6')];this[_0x1e51('0x7')]=_0x1e51('0x5');this[_0x1e51('0x8')]=![];this[_0x1e51('0x9')]=_[_0x1e51('0x3')](_0x16ec99['Agent'])?undefined:_0x16ec99[_0x1e51('0xa')][_0x1e51('0xb')];this[_0x1e51('0xc')]=this[_0x1e51('0x9')]?util[_0x1e51('0xd')](_0x1e51('0xe'),this['membername']):_0x21ed6b||undefined;this[_0x1e51('0xf')]=checkNameSurname(_0x16ec99[_0x1e51('0x10')][_0x1e51('0x11')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x12')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x13')]);this[_0x1e51('0x14')]=_0x16ec99[_0x1e51('0x14')]||![];this[_0x1e51('0x15')]=_0x16ec99['phone'];this[_0x1e51('0x16')]=_0x16ec99[_0x1e51('0x16')];this[_0x1e51('0x17')]=_0x16ec99['countbusyretry']||0x0;this[_0x1e51('0x18')]=_0x16ec99['countcongestionretry']||0x0;this['countnoanswerretry']=_0x16ec99[_0x1e51('0x19')]||0x0;this[_0x1e51('0x1a')]=(_0x16ec99[_0x1e51('0x17')]||0x0)+(_0x16ec99[_0x1e51('0x18')]||0x0)+(_0x16ec99[_0x1e51('0x19')]||0x0)+(_0x16ec99[_0x1e51('0x1b')]||0x0)+(_0x16ec99['countdropretry']||0x0)+(_0x16ec99[_0x1e51('0x1c')]||0x0)+(_0x16ec99['countmachineretry']||0x0)+(_0x16ec99[_0x1e51('0x1d')]||0x0);this[_0x1e51('0x1b')]=_0x16ec99[_0x1e51('0x1b')]||0x0;this[_0x1e51('0x1e')]=_0x16ec99['countdropretry']||0x0;this['countabandonedretry']=_0x16ec99['countabandonedretry']||0x0;this['countmachineretry']=_0x16ec99[_0x1e51('0x1f')]||0x0;this['countagentrejectretry']=_0x16ec99[_0x1e51('0x1d')]||0x0;this[_0x1e51('0x20')]=_0x16ec99[_0x1e51('0x20')];this[_0x1e51('0x21')]=_0x16ec99[_0x1e51('0x21')];this[_0x1e51('0x22')]=_0x16ec99[_0x1e51('0x22')];this[_0x1e51('0x23')]=_0x16ec99['recallme'];this['ContactId']=_0x16ec99[_0x1e51('0x24')];this[_0x1e51('0x25')]=_0x16ec99[_0x1e51('0x25')];this[_0x1e51('0x26')]=_['isNil'](_0x16ec99['Agent'])?_0x16ec99['UserId']:_0x16ec99[_0x1e51('0xa')]['id'];this[_0x1e51('0x27')]=_0x16ec99[_0x1e51('0x27')];this['originatecalleridnum']='';this[_0x1e51('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x1e51('0xd')]('\x22%s\x22\x20<%s>',this[_0x1e51('0xf')],this[_0x1e51('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0xb44a=['recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','calleridname','number','exports','moment','isNil','string','uniqueid','idContact','queue','name','type','membername','Agent','channelAgent','format','SIP/%s','Contact','lastName','active','calleridnum','phone','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0xb44a,0x1c2));var _0xab44=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0xb44a[_0x1dfa63];return _0x26f2a9;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xab44('0x0'));function checkNameSurname(_0x492c1a,_0x186fec,_0x5c825d){var _0x50cb3c='';if(!_[_0xab44('0x1')](_0x186fec)&&'string'===typeof _0x186fec){_0x50cb3c+=_0x186fec;}if(!_[_0xab44('0x1')](_0x5c825d)&&_0xab44('0x2')===typeof _0x5c825d){_0x50cb3c+='\x20'+_0x5c825d;}if(_0x50cb3c!==''){return _0x50cb3c;}return _0x492c1a;}function Action(_0x2e3662,_0x28681a,_0x2f3948,_0x3303b1,_0x3ead8d){this[_0xab44('0x3')]=_0x2f3948||undefined;this[_0xab44('0x4')]=_0x2e3662['id'];this[_0xab44('0x5')]=_0x28681a[_0xab44('0x6')];this[_0xab44('0x7')]=_0x28681a[_0xab44('0x7')];this['campaigntype']=_0xab44('0x5');this['dialAnswer']=![];this[_0xab44('0x8')]=_['isNil'](_0x2e3662['Agent'])?undefined:_0x2e3662[_0xab44('0x9')][_0xab44('0x6')];this[_0xab44('0xa')]=this[_0xab44('0x8')]?util[_0xab44('0xb')](_0xab44('0xc'),this['membername']):_0x3303b1||undefined;this['calleridname']=checkNameSurname(_0x2e3662[_0xab44('0xd')]['phone'],_0x2e3662[_0xab44('0xd')]['firstName'],_0x2e3662[_0xab44('0xd')][_0xab44('0xe')]);this[_0xab44('0xf')]=_0x2e3662[_0xab44('0xf')]||![];this[_0xab44('0x10')]=_0x2e3662[_0xab44('0x11')];this['scheduledat']=_0x2e3662['scheduledat'];this[_0xab44('0x12')]=_0x2e3662[_0xab44('0x12')]||0x0;this[_0xab44('0x13')]=_0x2e3662[_0xab44('0x13')]||0x0;this[_0xab44('0x14')]=_0x2e3662[_0xab44('0x14')]||0x0;this[_0xab44('0x15')]=(_0x2e3662[_0xab44('0x12')]||0x0)+(_0x2e3662[_0xab44('0x13')]||0x0)+(_0x2e3662[_0xab44('0x14')]||0x0)+(_0x2e3662[_0xab44('0x16')]||0x0)+(_0x2e3662['countdropretry']||0x0)+(_0x2e3662[_0xab44('0x17')]||0x0)+(_0x2e3662[_0xab44('0x18')]||0x0)+(_0x2e3662[_0xab44('0x19')]||0x0);this[_0xab44('0x16')]=_0x2e3662[_0xab44('0x16')]||0x0;this['countdropretry']=_0x2e3662[_0xab44('0x1a')]||0x0;this['countabandonedretry']=_0x2e3662[_0xab44('0x17')]||0x0;this[_0xab44('0x18')]=_0x2e3662[_0xab44('0x18')]||0x0;this[_0xab44('0x19')]=_0x2e3662['countagentrejectretry']||0x0;this[_0xab44('0x1b')]=_0x2e3662[_0xab44('0x1b')];this[_0xab44('0x1c')]=_0x2e3662[_0xab44('0x1c')];this[_0xab44('0x1d')]=_0x2e3662[_0xab44('0x1d')];this[_0xab44('0x1e')]=_0x2e3662['recallme'];this['ContactId']=_0x2e3662[_0xab44('0x1f')];this['ListId']=_0x2e3662[_0xab44('0x20')];this['UserId']=_[_0xab44('0x1')](_0x2e3662['Agent'])?_0x2e3662['UserId']:_0x2e3662[_0xab44('0x9')]['id'];this[_0xab44('0x21')]=_0x2e3662[_0xab44('0x21')];this[_0xab44('0x22')]='';this[_0xab44('0x23')]='';}Action['prototype'][_0xab44('0x24')]=function(){return util[_0xab44('0xb')]('\x22%s\x22\x20<%s>',this[_0xab44('0x25')],this[_0xab44('0x26')]);};module[_0xab44('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 106ae1c..203b1ff 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x22bac1,_0x38b20e){var _0x41ef2d=function(_0x2a0e0d){while(--_0x2a0e0d){_0x22bac1['push'](_0x22bac1['shift']());}};_0x41ef2d(++_0x38b20e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x4a9a62,_0x121240){var _0x80411f=function(_0x730680){while(--_0x730680){_0x4a9a62['push'](_0x4a9a62['shift']());}};_0x80411f(++_0x121240);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index cf87032..12d192f 100644 --- a/server/services/ami/preview/rpcDb.js +++ b/server/services/ami/preview/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x689e=['then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve'];(function(_0x29ff8f,_0x4c4f8b){var _0x39c3ff=function(_0x4aa5cf){while(--_0x4aa5cf){_0x29ff8f['push'](_0x29ff8f['shift']());}};_0x39c3ff(++_0x4c4f8b);}(_0x689e,0x19b));var _0xe689=function(_0x1ef2d0,_0x4bdfbd){_0x1ef2d0=_0x1ef2d0-0x0;var _0x28f855=_0x689e[_0x1ef2d0];return _0x28f855;};'use strict';var util=require(_0xe689('0x0'));var BPromise=require('bluebird');var logger=require(_0xe689('0x1'))('preview');var cmHopper=require(_0xe689('0x2'));var cmHopperHistory=require(_0xe689('0x3'));var cmHopperBlack=require(_0xe689('0x4'));var agentReportPreview=require(_0xe689('0x5'));var voiceQueueReport=require(_0xe689('0x6'));function loggerCatch(_0x68b37c){return function(_0x1b7ea1){logger[_0xe689('0x7')](_0x68b37c,util[_0xe689('0x8')](_0x1b7ea1,{'showHidden':![],'depth':null}));};}function create(_0x3b94dd){return cmHopperHistory[_0xe689('0x9')](_0x3b94dd)[_0xe689('0xa')](loggerCatch(_0xe689('0xb')));}function createAgent(_0x5b37dd){return BPromise[_0xe689('0xc')]()[_0xe689('0xd')](agentReportPreview[_0xe689('0x9')](_0x5b37dd))[_0xe689('0xa')](loggerCatch(_0xe689('0xb')));}function moveContact(_0x412b8c){return cmHopper[_0xe689('0xe')](_0x412b8c,!![])[_0xe689('0xa')](loggerCatch(_0xe689('0xf')));}exports[_0xe689('0x10')]=function(_0x30a228){return cmHopperBlack[_0xe689('0x10')](_0x30a228)[_0xe689('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xe689('0x11')]=function(_0x87fbfb){return BPromise[_0xe689('0xc')]()[_0xe689('0xd')](cmHopper[_0xe689('0x11')](_0x87fbfb))['catch'](loggerCatch(_0xe689('0x12')));};exports['createHistory']=function(_0x12a2f1,_0xd98908){create(_0x12a2f1)[_0xe689('0xa')](loggerCatch(_0xd98908));moveContact(_0x12a2f1)[_0xe689('0xa')](loggerCatch(_0xd98908));};exports[_0xe689('0x13')]=function(_0x50ae08,_0x95c784){createAgent(_0x50ae08)['catch'](loggerCatch(_0x95c784));};exports[_0xe689('0x14')]=function(_0x33965b,_0x481cae){create(_0x33965b)[_0xe689('0xa')](loggerCatch(_0x481cae));};exports[_0xe689('0x15')]=function(_0x18deba,_0x21f682){moveContact(_0x18deba)[_0xe689('0xa')](loggerCatch(_0x21f682));};exports[_0xe689('0x16')]=function(_0x39a905,_0x427e90,_0x23821e){if(_0x427e90){_0x39a905[_0xe689('0x17')]=null;}if(_0x23821e){_0x39a905[_0xe689('0x18')]=![];}return cmHopper['rescheduleContact'](_0x39a905)[_0xe689('0xa')](loggerCatch(_0xe689('0x19')));};exports[_0xe689('0x1a')]=function(_0x5ca860){return cmHopper[_0xe689('0x1a')](_0x5ca860)[_0xe689('0xa')](loggerCatch(_0xe689('0x1b')));};exports[_0xe689('0x1c')]=function(_0x3cbdf6){return cmHopper['unlockContact']({'UserId':null},_0x3cbdf6,0x1)['catch'](loggerCatch(_0xe689('0x1d')));};exports['disableContact']=function(_0x3bf37d){return cmHopper['unlockContact']({'active':![]},_0x3bf37d,0x1)[_0xe689('0xa')](loggerCatch(_0xe689('0x1e')));};exports[_0xe689('0x1f')]=function(_0x38ff89){var _0x122f5e={};_0x122f5e[_0xe689('0x20')]=_0x38ff89['type'];_0x122f5e['uniqueid']=_0x38ff89[_0xe689('0x21')];_0x122f5e[_0xe689('0x22')]=_0x38ff89[_0xe689('0x22')];_0x122f5e['calleridname']=_0x38ff89['calleridname'];_0x122f5e[_0xe689('0x23')]=_0x38ff89[_0xe689('0x23')];_0x122f5e[_0xe689('0x24')]=_0x38ff89[_0xe689('0x25')];_0x122f5e[_0xe689('0x26')]=_0x38ff89[_0xe689('0x25')];_0x122f5e['queuecallercomplete']=0x1;_0x122f5e['queuecallercompleteAt']=_0x38ff89[_0xe689('0x27')];_0x122f5e['connectedlinename']=_0x38ff89['membername'];_0x122f5e[_0xe689('0x28')]=_0xe689('0x29');_0x122f5e[_0xe689('0x2a')]=_0xe689('0x2b');_0x122f5e['holdtime']=0x0;_0x122f5e[_0xe689('0x2c')]=0x1;_0x122f5e[_0xe689('0x2d')]=_0x38ff89[_0xe689('0x2e')];_0x122f5e[_0xe689('0x2f')]=_0xe689('0x30');return BPromise[_0xe689('0xc')]()[_0xe689('0xd')](voiceQueueReport[_0xe689('0x31')](_0x122f5e))[_0xe689('0xa')](loggerCatch(_0xe689('0x32')));};exports[_0xe689('0x33')]=function(_0x50a548,_0x317817){return BPromise[_0xe689('0xc')]()[_0xe689('0xd')](cmHopper[_0xe689('0x33')](_0x50a548,_0x317817))[_0xe689('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xe689('0x34')]=function(_0x41c608){return cmHopper[_0xe689('0x16')](_0x41c608,!![],!![])[_0xe689('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xd16c=['preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','createHistory','catch','resolve','then','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','active','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger'];(function(_0x1ca253,_0x53e908){var _0x1aa355=function(_0x1016df){while(--_0x1016df){_0x1ca253['push'](_0x1ca253['shift']());}};_0x1aa355(++_0x53e908);}(_0xd16c,0x142));var _0xcd16=function(_0x5c4f28,_0x27d574){_0x5c4f28=_0x5c4f28-0x0;var _0x3628e3=_0xd16c[_0x5c4f28];return _0x3628e3;};'use strict';var util=require('util');var BPromise=require(_0xcd16('0x0'));var logger=require(_0xcd16('0x1'))(_0xcd16('0x2'));var cmHopper=require(_0xcd16('0x3'));var cmHopperHistory=require(_0xcd16('0x4'));var cmHopperBlack=require(_0xcd16('0x5'));var agentReportPreview=require(_0xcd16('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0xeab8a){return function(_0x5bf48a){logger[_0xcd16('0x7')](_0xeab8a,util[_0xcd16('0x8')](_0x5bf48a,{'showHidden':![],'depth':null}));};}function create(_0x11b4d4){return cmHopperHistory[_0xcd16('0x9')](_0x11b4d4)[_0xcd16('0xa')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x5277ed){return BPromise[_0xcd16('0xb')]()[_0xcd16('0xc')](agentReportPreview[_0xcd16('0x9')](_0x5277ed))[_0xcd16('0xa')](loggerCatch(_0xcd16('0xd')));}function moveContact(_0x3a419e){return cmHopper[_0xcd16('0xe')](_0x3a419e,!![])[_0xcd16('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xcd16('0xf')]=function(_0x3d8b69){return cmHopperBlack[_0xcd16('0xf')](_0x3d8b69)['catch'](loggerCatch(_0xcd16('0x10')));};exports[_0xcd16('0x11')]=function(_0x91619e){return BPromise[_0xcd16('0xb')]()['then'](cmHopper[_0xcd16('0x11')](_0x91619e))[_0xcd16('0xa')](loggerCatch(_0xcd16('0x12')));};exports['createHistory']=function(_0x278cad,_0x5f334f){create(_0x278cad)[_0xcd16('0xa')](loggerCatch(_0x5f334f));moveContact(_0x278cad)[_0xcd16('0xa')](loggerCatch(_0x5f334f));};exports[_0xcd16('0x13')]=function(_0x1b2f95,_0x2a4ba0){createAgent(_0x1b2f95)['catch'](loggerCatch(_0x2a4ba0));};exports[_0xcd16('0x14')]=function(_0x4ad910,_0x2a33e1){create(_0x4ad910)['catch'](loggerCatch(_0x2a33e1));};exports[_0xcd16('0x15')]=function(_0x2d676b,_0xd6bc18){moveContact(_0x2d676b)[_0xcd16('0xa')](loggerCatch(_0xd6bc18));};exports['rescheduleContact']=function(_0x580b73,_0x49460a,_0x5423e3){if(_0x49460a){_0x580b73['UserId']=null;}if(_0x5423e3){_0x580b73[_0xcd16('0x16')]=![];}return cmHopper[_0xcd16('0x17')](_0x580b73)[_0xcd16('0xa')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xcd16('0x18')]=function(_0x4164ef){return cmHopper[_0xcd16('0x18')](_0x4164ef)['catch'](loggerCatch(_0xcd16('0x19')));};exports['unlockContact']=function(_0x461455){return cmHopper[_0xcd16('0x1a')]({'UserId':null},_0x461455,0x1)[_0xcd16('0xa')](loggerCatch(_0xcd16('0x1b')));};exports['disableContact']=function(_0x99e2d0){return cmHopper[_0xcd16('0x1a')]({'active':![]},_0x99e2d0,0x1)['catch'](loggerCatch(_0xcd16('0x1c')));};exports[_0xcd16('0x1d')]=function(_0x438462){var _0x9542ed={};_0x9542ed['type']=_0x438462[_0xcd16('0x1e')];_0x9542ed[_0xcd16('0x1f')]=_0x438462[_0xcd16('0x1f')];_0x9542ed[_0xcd16('0x20')]=_0x438462[_0xcd16('0x20')];_0x9542ed['calleridname']=_0x438462[_0xcd16('0x21')];_0x9542ed['queue']=_0x438462['queue'];_0x9542ed['queuecallerjoinAt']=_0x438462[_0xcd16('0x22')];_0x9542ed[_0xcd16('0x23')]=_0x438462[_0xcd16('0x22')];_0x9542ed[_0xcd16('0x24')]=0x1;_0x9542ed[_0xcd16('0x25')]=_0x438462[_0xcd16('0x26')];_0x9542ed[_0xcd16('0x27')]=_0x438462['membername'];_0x9542ed[_0xcd16('0x28')]=_0xcd16('0x29');_0x9542ed[_0xcd16('0x2a')]='xcally-motion-preview';_0x9542ed[_0xcd16('0x2b')]=0x0;_0x9542ed[_0xcd16('0x2c')]=0x1;_0x9542ed[_0xcd16('0x2d')]=_0x438462[_0xcd16('0x2e')];_0x9542ed[_0xcd16('0x2f')]='COMPLETED';return BPromise[_0xcd16('0xb')]()[_0xcd16('0xc')](voiceQueueReport[_0xcd16('0x30')](_0x9542ed))[_0xcd16('0xa')](loggerCatch(_0xcd16('0x31')));};exports[_0xcd16('0x32')]=function(_0x53a15d,_0x289998){return BPromise['resolve']()['then'](cmHopper[_0xcd16('0x32')](_0x53a15d,_0x289998))['catch'](loggerCatch(_0xcd16('0x33')));};exports[_0xcd16('0x34')]=function(_0x587125){return cmHopper['rescheduleContact'](_0x587125,!![],!![])[_0xcd16('0xa')](loggerCatch(_0xcd16('0x35')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 3cd517a..43ee6cd 100644 --- a/server/services/ami/preview/util/util.js +++ b/server/services/ami/preview/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5ba=['rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','pow','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','error','inspect','info','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','Blacklist','starttime','responsetime','logAgent','state','statedesc','ringtime','getSeconds','logLookAgent','logCustomer','endtime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','queue','type','dialAnswer','membername','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos'];(function(_0x1eb82d,_0x1e23cb){var _0x2c9502=function(_0x4a3500){while(--_0x4a3500){_0x1eb82d['push'](_0x1eb82d['shift']());}};_0x2c9502(++_0x1e23cb);}(_0xc5ba,0x134));var _0xac5b=function(_0x65d13d,_0x49e929){_0x65d13d=_0x65d13d-0x0;var _0x309bb3=_0xc5ba[_0x65d13d];return _0x309bb3;};'use strict';var util=require(_0xac5b('0x0'));var _=require(_0xac5b('0x1'));var moment=require(_0xac5b('0x2'));var logger=require(_0xac5b('0x3'))(_0xac5b('0x4'));var ipAgi=process[_0xac5b('0x5')][_0xac5b('0x6')]||_0xac5b('0x7');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x5a6b1a){return function(_0x334f67){logger[_0xac5b('0x8')](_0x5a6b1a,util[_0xac5b('0x9')](_0x334f67,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x3967fb,_0xfef92f){logger[_0xac5b('0xa')](_0x3967fb,util[_0xac5b('0x9')](_0xfef92f,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x479afb,_0x1f6ff5){logger[_0xac5b('0x8')](_0x479afb,util['inspect'](_0x1f6ff5,{'showHidden':![],'depth':null}));};exports[_0xac5b('0xb')]=function(_0x155e03){return function(_0x2711a2){logger[_0xac5b('0xa')](_0x155e03,util[_0xac5b('0x9')](_0x2711a2,{'showHidden':![],'depth':null}));};};exports[_0xac5b('0xc')]=function(_0x3c75da,_0x11ef6d,_0x24b94e){return{'message':_0x3c75da,'unlock':_0x11ef6d,'active':_0x24b94e};};exports['getCallerId']=function(_0x5e12f5,_0x12f1d5,_0x1e347e){if(!_[_0xac5b('0xd')](_0x1e347e)&&_0xac5b('0xe')===typeof _0x1e347e&&!_[_0xac5b('0xf')](_0x1e347e)){if(!_['isUndefined'](_0x12f1d5)&&'string'===typeof _0x12f1d5&&!_['isEmpty'](_0x12f1d5)){return util[_0xac5b('0x10')](_0xac5b('0x11'),_0x12f1d5,_0x1e347e);}return util[_0xac5b('0x10')](_0xac5b('0x11'),_0x1e347e,_0x1e347e);}if(!_['isUndefined'](_0x5e12f5)&&'string'===typeof _0x5e12f5&&!_[_0xac5b('0xf')](_0x5e12f5)){return _0x5e12f5;}return _0xac5b('0x12');};exports[_0xac5b('0x13')]=function(_0x19ce6e){if(_[_0xac5b('0x14')](_0x19ce6e)){return![];}return _0x19ce6e;};exports[_0xac5b('0x15')]=function(_0x1cb764,_0x41685c,_0x13476f,_0x373f43,_0x11b6b7,_0x3a46af){var _0x5a7fd8={'XMD-QUEUE':_0x41685c[_0xac5b('0x16')]?_0x41685c['Queue'][_0xac5b('0x17')]:'','XMD-CALLERID':_0x373f43,'XMD-CALLERID-PREVIEW':_0x3a46af?util[_0xac5b('0x10')](_0xac5b('0x11'),_0x3a46af[_0xac5b('0x18')],_0x3a46af[_0xac5b('0x19')]):_0x373f43,'XMD-DIALID':_0x11b6b7,'XMD-CONTACTID':_0x41685c[_0xac5b('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x373f43,'XMD-VOICEQUEUEID':_0x41685c[_0xac5b('0x1b')],'XMD-DIALCHANNEL':_0x13476f,'XMD-DIALTIMEOUT':_0x1cb764[_0xac5b('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xac5b('0x10')]('\x22rtTxX%s%s\x22',_0x1cb764['dialQueueProject2']?'g':'',_['isEmpty'](_0x1cb764['monitor_format'])?'':_0xac5b('0x1d')),'XMD-DIALURL':_0x1cb764[_0xac5b('0x1e')]||'','XMD-AGI':_0x1cb764[_0xac5b('0x1f')]?util[_0xac5b('0x10')](_0xac5b('0x20'),ipAgi,_0x1cb764[_0xac5b('0x1f')]):_0xac5b('0x21'),'XMD-AGIAFTER':_0x1cb764[_0xac5b('0x22')]?util[_0xac5b('0x10')](_0xac5b('0x20'),ipAgi,_0x1cb764[_0xac5b('0x22')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3a46af?_0x3a46af[_0xac5b('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3a46af?_0x3a46af[_0xac5b('0x24')]:'','XMD-DESTINATION':_0xac5b('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x1cb764[_0xac5b('0x26')])){_0x5a7fd8[util[_0xac5b('0x10')]('%s',_0xac5b('0x27'))]=_0x1cb764[_0xac5b('0x26')];_0x5a7fd8[util[_0xac5b('0x10')]('%s',_0xac5b('0x28'))]=_0x11b6b7;}return _0x5a7fd8;};exports['toLowerVariables']=function(_0xf30ca){var _0x2df5d0={};for(var _0x89f0f8 in _0xf30ca){if(_0xf30ca['hasOwnProperty'](_0x89f0f8)){_0x2df5d0[util[_0xac5b('0x10')]('%s',_[_0xac5b('0x29')](_0x89f0f8))]=_0xf30ca[_0x89f0f8];}}return{'variables':_0x2df5d0};};exports[_0xac5b('0x2a')]=function(_0x1dece5,_0x341b67){if(!_[_0xac5b('0x14')](_0x1dece5)){if(_0x1dece5[_0xac5b('0x2b')](_0xac5b('0x2c'))){if(_0x1dece5[_0xac5b('0x2c')]>0x0){_0x1dece5['originated']-=0x1;}else{logger[_0xac5b('0x8')](_0xac5b('0x2d'),_0x341b67);}}}else{logger[_0xac5b('0x8')](_0xac5b('0x2e'),_0x341b67);}};exports['logBlacklist']=function(_0x2f6bbb){var _0x34b5e0=moment()[_0xac5b('0x10')](_0xac5b('0x2f'));_0x2f6bbb['state']=0xd;_0x2f6bbb['statedesc']=_0xac5b('0x30');_0x2f6bbb[_0xac5b('0x31')]=_0x34b5e0;_0x2f6bbb[_0xac5b('0x32')]=_0x34b5e0;_0x2f6bbb['endtime']=_0x34b5e0;};exports[_0xac5b('0x33')]=function(_0x5adc94,_0x3c325d,_0x33e4ec){var _0x216ab8=moment()['format'](_0xac5b('0x2f'));_0x5adc94[_0xac5b('0x34')]=_0x3c325d;_0x5adc94[_0xac5b('0x35')]=_0x33e4ec;_0x5adc94[_0xac5b('0x32')]=_0x216ab8;_0x5adc94[_0xac5b('0x36')]=utils[_0xac5b('0x37')](_0x5adc94['responsetime'],_0x5adc94[_0xac5b('0x31')]);};exports[_0xac5b('0x38')]=function(_0x13cbe8,_0x3d636a,_0x519fac){_0x13cbe8['membername']=_0x3d636a;_0x13cbe8['UserId']=_0x519fac;};exports[_0xac5b('0x39')]=function(_0x3d1a07,_0x1acd05,_0x87bfe6){var _0xe642b=moment()['format'](_0xac5b('0x2f'));_0x3d1a07[_0xac5b('0x34')]=_0x1acd05;_0x3d1a07[_0xac5b('0x35')]=_0x87bfe6;_0x3d1a07[_0xac5b('0x32')]=_0x3d1a07[_0xac5b('0x32')]?_0x3d1a07[_0xac5b('0x32')]:_0xe642b;_0x3d1a07[_0xac5b('0x3a')]=_0x3d1a07[_0xac5b('0x3a')]?_0x3d1a07[_0xac5b('0x3a')]:_0xe642b;_0x3d1a07[_0xac5b('0x36')]=utils[_0xac5b('0x37')](_0x3d1a07[_0xac5b('0x32')]||0x0,_0x3d1a07['starttime']||0x0);_0x3d1a07['talktime']=_0x3d1a07[_0xac5b('0x3b')]?utils[_0xac5b('0x37')](_0x3d1a07[_0xac5b('0x3a')],_0x3d1a07[_0xac5b('0x3b')]):0x0;};exports[_0xac5b('0x3c')]=function(_0x5ce1e2){return _0x5ce1e2===_0xac5b('0x3d');};exports[_0xac5b('0x3e')]=function(_0x58900b,_0x435e4a,_0x45c891,_0x1572bf,_0x569fdf){var _0x83c9e1=_0x1572bf?_0xac5b('0x3f'):_0x58900b[_0xac5b('0x18')];_0x83c9e1=_0x569fdf?'BOOKED':_0x83c9e1;return{'actionid':_0x58900b[_0xac5b('0x40')],'action':'originate','channel':_0x58900b[_0xac5b('0x41')],'callerid':util[_0xac5b('0x10')](_0xac5b('0x11'),_0x83c9e1,_0x58900b[_0xac5b('0x19')]),'Exten':'xcally-motion-preview','Context':_0xac5b('0x42'),'Priority':'1','variable':_0x45c891,'timeout':(_0x435e4a[_0xac5b('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x58900b[_0xac5b('0x40')]};};exports[_0xac5b('0x44')]=function(_0x24ff64){return _0x24ff64['countbusyretry']+_0x24ff64[_0xac5b('0x45')]+_0x24ff64[_0xac5b('0x46')]+_0x24ff64[_0xac5b('0x47')]+_0x24ff64[_0xac5b('0x48')];};exports['cloneAction']=function(_0x2f45d1){var _0x140b92=_[_0xac5b('0x49')](_0x2f45d1);_0x140b92[_0xac5b('0x34')]=0xf;_0x140b92[_0xac5b('0x35')]=_0xac5b('0x4a');return _0x140b92;};exports[_0xac5b('0x4b')]=function(_0x412333,_0x2c3b58,_0x217092){var _0x8e472c={};_0x8e472c[_0x2c3b58]=_0x412333[_0x2c3b58];_0x8e472c[_0xac5b('0x4c')]=![];_0x8e472c[_0xac5b('0x4d')]=moment()[_0xac5b('0x4e')](_0x217092,_0xac5b('0x4f'))[_0xac5b('0x10')](_0xac5b('0x2f'));_0x8e472c[_0xac5b('0x1a')]=_0x412333[_0xac5b('0x1a')];_0x8e472c[_0xac5b('0x50')]=_0x412333[_0xac5b('0x50')];_0x8e472c[_0xac5b('0x1b')]=_0x412333['VoiceQueueId']||undefined;return _0x8e472c;};exports[_0xac5b('0x51')]=function(_0x3b0a64,_0x3e1ff6){if(!_[_0xac5b('0x14')](_0x3b0a64)){if(_0x3b0a64[_0xac5b('0x52')]>0x0){_0x3b0a64[_0xac5b('0x52')]-=0x1;}else{logger[_0xac5b('0x8')](_0x3e1ff6,_0xac5b('0x53'));}}else{logger[_0xac5b('0x8')](_0x3e1ff6,_0xac5b('0x54'));}};exports[_0xac5b('0x55')]=function(_0x3ce419){if(_0x3ce419<=0x0){return!![];}return![];};function buildObj(_0x3f4ecc,_0xa1dac9,_0x16e9b5){_0x3f4ecc['lastevent']=_0xa1dac9;_0x3f4ecc[_0xac5b('0x17')]=_0x3f4ecc['queue'];_0x3f4ecc[_0xac5b('0x56')]=_0x3f4ecc[_0xac5b('0x41')];_0x3f4ecc[_0xac5b('0x57')]=_0xac5b('0x58');if(_0x16e9b5){_0x3f4ecc[_0xac5b('0x59')]=_0x16e9b5[_0xac5b('0x59')];}return _0x3f4ecc;}exports[_0xac5b('0x5a')]=buildObj;exports[_0xac5b('0x5b')]=function(_0x5bee1){var _0x1ba822=[];for(var _0x5a3abc in _0x5bee1){if(_0x5bee1['hasOwnProperty'](_0x5a3abc)){if(!_[_0xac5b('0x14')](_0x5bee1[_0x5a3abc])&&_0x5bee1[_0x5a3abc]['state']===_0xac5b('0x5c')&&_0x5bee1[_0x5a3abc][_0xac5b('0x5d')]===_0xac5b('0x5e')){_0x1ba822[_0xac5b('0x5f')](_0x5bee1[_0x5a3abc]['id']);}}}return _0x1ba822;};exports[_0xac5b('0x60')]=function(_0x5f326a){var _0x369b76=moment()[_0xac5b('0x61')](0x0);var _0x6883ad=moment(_0x5f326a)[_0xac5b('0x61')](0x0);return _0x369b76[_0xac5b('0x62')](_0x6883ad,_0xac5b('0x63'));};exports[_0xac5b('0x64')]=function(_0x4fa2b5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4fa2b5[_0xac5b('0x1a')],'ListId':_0x4fa2b5[_0xac5b('0x50')],'VoiceQueueId':_0x4fa2b5['VoiceQueueId']||undefined,'CampaignId':_0x4fa2b5[_0xac5b('0x65')]||undefined};};exports[_0xac5b('0x66')]=function(_0x331e04){if(_0x331e04===_0xac5b('0x40')||_0x331e04==='idContact'||_0x331e04===_0xac5b('0x67')||_0x331e04===_0xac5b('0x68')||_0x331e04==='campaigntype'||_0x331e04===_0xac5b('0x69')||_0x331e04===_0xac5b('0x6a')||_0x331e04===_0xac5b('0x41')||_0x331e04===_0xac5b('0x18')||_0x331e04===_0xac5b('0x4c')||_0x331e04===_0xac5b('0x19')||_0x331e04===_0xac5b('0x4d')||_0x331e04===_0xac5b('0x6b')||_0x331e04===_0xac5b('0x45')||_0x331e04===_0xac5b('0x46')||_0x331e04===_0xac5b('0x6c')||_0x331e04===_0xac5b('0x6d')||_0x331e04===_0xac5b('0x6e')||_0x331e04===_0xac5b('0x6f')||_0x331e04===_0xac5b('0x70')||_0x331e04===_0xac5b('0x1a')||_0x331e04===_0xac5b('0x50')||_0x331e04===_0xac5b('0x71')||_0x331e04===_0xac5b('0x1b')||_0x331e04===_0xac5b('0x72')||_0x331e04===_0xac5b('0x73')||_0x331e04===_0xac5b('0x74')||_0x331e04===_0xac5b('0x75')||_0x331e04===_0xac5b('0x76')||_0x331e04===_0xac5b('0x77')||_0x331e04==='xmd-dialtimeout'||_0x331e04===_0xac5b('0x78')||_0x331e04==='xmd-dialid'||_0x331e04===_0xac5b('0x79')||_0x331e04===_0xac5b('0x7a')||_0x331e04===_0xac5b('0x7b')||_0x331e04===_0xac5b('0x7c')||_0x331e04==='xmd-agiafter'||_0x331e04===_0xac5b('0x7d')||_0x331e04===_0xac5b('0x7e')||_0x331e04===_0xac5b('0x7f')||_0x331e04===_0xac5b('0x80')||_0x331e04===_0xac5b('0x81')||_0x331e04===_0xac5b('0x82')||_0x331e04===_0xac5b('0x83')||_0x331e04==='rtpaudioqosrtt'||_0x331e04===_0xac5b('0x84')||_0x331e04==='rtpaudioqos'||_0x331e04===_0xac5b('0x7f')||_0x331e04===_0xac5b('0x80')||_0x331e04===_0xac5b('0x81')||_0x331e04===_0xac5b('0x82')||_0x331e04===_0xac5b('0x83')||_0x331e04===_0xac5b('0x85')||_0x331e04===_0xac5b('0x84')||_0x331e04===_0xac5b('0x86')||_0x331e04==='bridgepvtcallid'||_0x331e04===_0xac5b('0x34')||_0x331e04===_0xac5b('0x35')){return![];}return!![];};exports[_0xac5b('0x87')]=function(_0x5e29a8,_0x64bb65){var _0x202f24,_0x1f49a8,_0x5589bf;if(_0x64bb65<=0x0){_0x64bb65=0x1;}_0x202f24=new RegExp('\x5cw{0,'+_0x64bb65+'}$');_0x1f49a8=Math[_0xac5b('0x88')](0xa,_0x64bb65-0x1);_0x5589bf=Math['pow'](0xa,_0x64bb65)-0x1;return util['format']('%s',_['replace'](_0x5e29a8,_0x202f24,_['random'](_0x1f49a8,_0x5589bf)));};exports[_0xac5b('0x89')]=function(_0x495608){var _0x436cd5=_0x495608[_0xac5b('0x8a')](/"(.*?)"/);return _0x436cd5?_0x436cd5[0x1]:_0x495608;};exports[_0xac5b('0x8b')]=function(_0x117ddf){var _0x44637b=_0x117ddf[_0xac5b('0x8a')](/<(.*?)>/);return _0x44637b?_0x44637b[0x1]:_0x117ddf;};function buildNoAnswerEventPayload(_0x1f29c5,_0x465110){var _0x1eff57=buildObj(_0x1f29c5,_0xac5b('0x8c'));if(!_[_0xac5b('0xf')](_0x465110[_0xac5b('0x8d')])){Object[_0xac5b('0x8e')](_0x465110[_0xac5b('0x8d')])[_0xac5b('0x8f')](function(_0x37165c){_0x1eff57[_0x37165c['toLowerCase']()]=_0x465110[_0xac5b('0x8d')][_0x37165c];});}return _0x1eff57;}exports[_0xac5b('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x355e=['format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','state','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','originate','channelAgent','timeout','totalGlobal','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','queue','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','uniqueid','idContact','type','campaigntype','active','countbusyretry','countnoanswerretry','countglobal','callback','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','keys','variables','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','info','error','message','isUndefined','isEmpty','string'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x355e,0x79));var _0xe355=function(_0x2f651d,_0x7d2f88){_0x2f651d=_0x2f651d-0x0;var _0x249e3b=_0x355e[_0x2f651d];return _0x249e3b;};'use strict';var util=require(_0xe355('0x0'));var _=require(_0xe355('0x1'));var moment=require(_0xe355('0x2'));var logger=require(_0xe355('0x3'))(_0xe355('0x4'));var ipAgi=process['env'][_0xe355('0x5')]||_0xe355('0x6');var utils=require(_0xe355('0x7'));exports[_0xe355('0x8')]=function(_0x27020b){return function(_0x46a7d4){logger['error'](_0x27020b,util[_0xe355('0x9')](_0x46a7d4,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4049d5,_0x4404e3){logger[_0xe355('0xa')](_0x4049d5,util[_0xe355('0x9')](_0x4404e3,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xb6b489,_0x1a216a){logger[_0xe355('0xb')](_0xb6b489,util[_0xe355('0x9')](_0x1a216a,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x26632c){return function(_0x1f6867){logger[_0xe355('0xa')](_0x26632c,util[_0xe355('0x9')](_0x1f6867,{'showHidden':![],'depth':null}));};};exports[_0xe355('0xc')]=function(_0x4d1d6c,_0x4ecd0e,_0x659765){return{'message':_0x4d1d6c,'unlock':_0x4ecd0e,'active':_0x659765};};exports['getCallerId']=function(_0x4cb277,_0x2ca2fe,_0x519c1e){if(!_[_0xe355('0xd')](_0x519c1e)&&'string'===typeof _0x519c1e&&!_[_0xe355('0xe')](_0x519c1e)){if(!_['isUndefined'](_0x2ca2fe)&&_0xe355('0xf')===typeof _0x2ca2fe&&!_['isEmpty'](_0x2ca2fe)){return util[_0xe355('0x10')](_0xe355('0x11'),_0x2ca2fe,_0x519c1e);}return util[_0xe355('0x10')]('\x22%s\x22\x20<%s>',_0x519c1e,_0x519c1e);}if(!_[_0xe355('0xd')](_0x4cb277)&&_0xe355('0xf')===typeof _0x4cb277&&!_[_0xe355('0xe')](_0x4cb277)){return _0x4cb277;}return'\x22\x22\x20<>';};exports[_0xe355('0x12')]=function(_0x2f8d6e){if(_[_0xe355('0x13')](_0x2f8d6e)){return![];}return _0x2f8d6e;};exports[_0xe355('0x14')]=function(_0xd39713,_0x2c5312,_0xc45a82,_0x2fd70f,_0x1ed3ec,_0xa37f5a){var _0x48c089={'XMD-QUEUE':_0x2c5312[_0xe355('0x15')]?_0x2c5312[_0xe355('0x15')][_0xe355('0x16')]:'','XMD-CALLERID':_0x2fd70f,'XMD-CALLERID-PREVIEW':_0xa37f5a?util[_0xe355('0x10')]('\x22%s\x22\x20<%s>',_0xa37f5a[_0xe355('0x17')],_0xa37f5a[_0xe355('0x18')]):_0x2fd70f,'XMD-DIALID':_0x1ed3ec,'XMD-CONTACTID':_0x2c5312[_0xe355('0x19')],'XMD-CDRTYPE':_0xe355('0x1a'),'CALLERID(all)':_0x2fd70f,'XMD-VOICEQUEUEID':_0x2c5312[_0xe355('0x1b')],'XMD-DIALCHANNEL':_0xc45a82,'XMD-DIALTIMEOUT':_0xd39713[_0xe355('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xe355('0x10')](_0xe355('0x1d'),_0xd39713[_0xe355('0x1e')]?'g':'',_[_0xe355('0xe')](_0xd39713['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xd39713[_0xe355('0x1f')]||'','XMD-AGI':_0xd39713['dialQueueProject']?util['format'](_0xe355('0x20'),ipAgi,_0xd39713[_0xe355('0x21')]):'NONE','XMD-AGIAFTER':_0xd39713[_0xe355('0x1e')]?util[_0xe355('0x10')](_0xe355('0x20'),ipAgi,_0xd39713[_0xe355('0x1e')]):_0xe355('0x22'),'XMD-ORIGINATECALLERIDNUM':_0xa37f5a?_0xa37f5a['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0xa37f5a?_0xa37f5a[_0xe355('0x23')]:'','XMD-DESTINATION':_0xe355('0x24'),'SIPADDHEADER':_0xe355('0x25')};if(!_[_0xe355('0xe')](_0xd39713['monitor_format'])){_0x48c089[util[_0xe355('0x10')]('%s',_0xe355('0x26'))]=_0xd39713[_0xe355('0x27')];_0x48c089[util[_0xe355('0x10')]('%s',_0xe355('0x28'))]=_0x1ed3ec;}return _0x48c089;};exports[_0xe355('0x29')]=function(_0x43f98c){var _0x1ea8b={};for(var _0x528a3f in _0x43f98c){if(_0x43f98c[_0xe355('0x2a')](_0x528a3f)){_0x1ea8b[util['format']('%s',_[_0xe355('0x2b')](_0x528a3f))]=_0x43f98c[_0x528a3f];}}return{'variables':_0x1ea8b};};exports['updateOriginated']=function(_0x216126,_0x3fef3f){if(!_['isNil'](_0x216126)){if(_0x216126[_0xe355('0x2a')](_0xe355('0x2c'))){if(_0x216126[_0xe355('0x2c')]>0x0){_0x216126[_0xe355('0x2c')]-=0x1;}else{logger[_0xe355('0xb')](_0xe355('0x2d'),_0x3fef3f);}}}else{logger[_0xe355('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3fef3f);}};exports['logBlacklist']=function(_0x4bb9e9){var _0x4339d0=moment()['format'](_0xe355('0x2e'));_0x4bb9e9['state']=0xd;_0x4bb9e9[_0xe355('0x2f')]=_0xe355('0x30');_0x4bb9e9['starttime']=_0x4339d0;_0x4bb9e9[_0xe355('0x31')]=_0x4339d0;_0x4bb9e9[_0xe355('0x32')]=_0x4339d0;};exports['logAgent']=function(_0x40f18f,_0x625470,_0x1ff71a){var _0x27edff=moment()['format'](_0xe355('0x2e'));_0x40f18f[_0xe355('0x33')]=_0x625470;_0x40f18f[_0xe355('0x2f')]=_0x1ff71a;_0x40f18f[_0xe355('0x31')]=_0x27edff;_0x40f18f['ringtime']=utils[_0xe355('0x34')](_0x40f18f[_0xe355('0x31')],_0x40f18f[_0xe355('0x35')]);};exports[_0xe355('0x36')]=function(_0x1493be,_0x24e334,_0x4e56bc){_0x1493be[_0xe355('0x37')]=_0x24e334;_0x1493be[_0xe355('0x38')]=_0x4e56bc;};exports[_0xe355('0x39')]=function(_0x10bad7,_0x528851,_0x33e62c){var _0x25e83d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x10bad7[_0xe355('0x33')]=_0x528851;_0x10bad7[_0xe355('0x2f')]=_0x33e62c;_0x10bad7['responsetime']=_0x10bad7[_0xe355('0x31')]?_0x10bad7[_0xe355('0x31')]:_0x25e83d;_0x10bad7[_0xe355('0x32')]=_0x10bad7['endtime']?_0x10bad7[_0xe355('0x32')]:_0x25e83d;_0x10bad7['ringtime']=utils[_0xe355('0x34')](_0x10bad7[_0xe355('0x31')]||0x0,_0x10bad7['starttime']||0x0);_0x10bad7[_0xe355('0x3a')]=_0x10bad7[_0xe355('0x3b')]?utils[_0xe355('0x34')](_0x10bad7[_0xe355('0x32')],_0x10bad7[_0xe355('0x3b')]):0x0;};exports[_0xe355('0x3c')]=function(_0x22d6d9){return _0x22d6d9===_0xe355('0x3d');};exports[_0xe355('0x3e')]=function(_0xc45467,_0x561c7a,_0x27cfd6,_0x4ea734,_0x5cf605){var _0x29208a=_0x4ea734?'RECALL':_0xc45467[_0xe355('0x17')];_0x29208a=_0x5cf605?_0xe355('0x3f'):_0x29208a;return{'actionid':_0xc45467['uniqueid'],'action':_0xe355('0x40'),'channel':_0xc45467[_0xe355('0x41')],'callerid':util[_0xe355('0x10')](_0xe355('0x11'),_0x29208a,_0xc45467['calleridnum']),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x27cfd6,'timeout':(_0x561c7a[_0xe355('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0xc45467['uniqueid']};};exports[_0xe355('0x43')]=function(_0x2b8653){return _0x2b8653['countbusyretry']+_0x2b8653[_0xe355('0x44')]+_0x2b8653['countnoanswerretry']+_0x2b8653[_0xe355('0x45')]+_0x2b8653[_0xe355('0x46')];};exports[_0xe355('0x47')]=function(_0x2ee764){var _0x2e023=_[_0xe355('0x48')](_0x2ee764);_0x2e023['state']=0xf;_0x2e023[_0xe355('0x2f')]=_0xe355('0x49');return _0x2e023;};exports['scheduledAt']=function(_0x1cfdfc,_0x190eaa,_0x47144b){var _0x3e9dca={};_0x3e9dca[_0x190eaa]=_0x1cfdfc[_0x190eaa];_0x3e9dca['active']=![];_0x3e9dca[_0xe355('0x4a')]=moment()['add'](_0x47144b,_0xe355('0x4b'))[_0xe355('0x10')](_0xe355('0x2e'));_0x3e9dca[_0xe355('0x19')]=_0x1cfdfc[_0xe355('0x19')];_0x3e9dca[_0xe355('0x4c')]=_0x1cfdfc['ListId'];_0x3e9dca['VoiceQueueId']=_0x1cfdfc[_0xe355('0x1b')]||undefined;return _0x3e9dca;};exports[_0xe355('0x4d')]=function(_0x2421df,_0x2ac799){if(!_[_0xe355('0x13')](_0x2421df)){if(_0x2421df[_0xe355('0x4e')]>0x0){_0x2421df[_0xe355('0x4e')]-=0x1;}else{logger[_0xe355('0xb')](_0x2ac799,_0xe355('0x4f'));}}else{logger[_0xe355('0xb')](_0x2ac799,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xe355('0x50')]=function(_0x1dea36){if(_0x1dea36<=0x0){return!![];}return![];};function buildObj(_0x25d626,_0x50df69,_0x1c6b0b){_0x25d626['lastevent']=_0x50df69;_0x25d626[_0xe355('0x16')]=_0x25d626[_0xe355('0x51')];_0x25d626['interface']=_0x25d626['channelAgent'];_0x25d626[_0xe355('0x52')]=_0xe355('0x53');if(_0x1c6b0b){_0x25d626[_0xe355('0x54')]=_0x1c6b0b['mandatoryDisposition'];}return _0x25d626;}exports[_0xe355('0x55')]=buildObj;exports[_0xe355('0x56')]=function(_0xd6724){var _0x40bfd9=[];for(var _0x2906ff in _0xd6724){if(_0xd6724[_0xe355('0x2a')](_0x2906ff)){if(!_[_0xe355('0x13')](_0xd6724[_0x2906ff])&&_0xd6724[_0x2906ff][_0xe355('0x33')]==='not_inuse'&&_0xd6724[_0x2906ff][_0xe355('0x57')]===_0xe355('0x58')){_0x40bfd9[_0xe355('0x59')](_0xd6724[_0x2906ff]['id']);}}}return _0x40bfd9;};exports[_0xe355('0x5a')]=function(_0x151f28){var _0x53f4ac=moment()[_0xe355('0x5b')](0x0);var _0x5baa64=moment(_0x151f28)[_0xe355('0x5b')](0x0);return _0x53f4ac[_0xe355('0x5c')](_0x5baa64,'seconds');};exports[_0xe355('0x5d')]=function(_0x4bb993){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4bb993['ContactId'],'ListId':_0x4bb993['ListId'],'VoiceQueueId':_0x4bb993[_0xe355('0x1b')]||undefined,'CampaignId':_0x4bb993[_0xe355('0x5e')]||undefined};};exports[_0xe355('0x5f')]=function(_0x34d77a){if(_0x34d77a===_0xe355('0x60')||_0x34d77a===_0xe355('0x61')||_0x34d77a===_0xe355('0x51')||_0x34d77a===_0xe355('0x62')||_0x34d77a===_0xe355('0x63')||_0x34d77a==='dialAnswer'||_0x34d77a===_0xe355('0x37')||_0x34d77a===_0xe355('0x41')||_0x34d77a===_0xe355('0x17')||_0x34d77a===_0xe355('0x64')||_0x34d77a===_0xe355('0x18')||_0x34d77a===_0xe355('0x4a')||_0x34d77a===_0xe355('0x65')||_0x34d77a===_0xe355('0x44')||_0x34d77a===_0xe355('0x66')||_0x34d77a===_0xe355('0x67')||_0x34d77a===_0xe355('0x68')||_0x34d77a==='callbackuniqueid'||_0x34d77a===_0xe355('0x69')||_0x34d77a==='recallme'||_0x34d77a===_0xe355('0x19')||_0x34d77a==='ListId'||_0x34d77a===_0xe355('0x38')||_0x34d77a===_0xe355('0x1b')||_0x34d77a===_0xe355('0x6a')||_0x34d77a===_0xe355('0x6b')||_0x34d77a===_0xe355('0x6c')||_0x34d77a==='xmd-phone'||_0x34d77a===_0xe355('0x6d')||_0x34d77a==='xmd-dialurl'||_0x34d77a===_0xe355('0x6e')||_0x34d77a===_0xe355('0x6f')||_0x34d77a===_0xe355('0x70')||_0x34d77a===_0xe355('0x71')||_0x34d77a==='xmd-contactid'||_0x34d77a===_0xe355('0x72')||_0x34d77a===_0xe355('0x73')||_0x34d77a===_0xe355('0x74')||_0x34d77a==='xmd-agi'||_0x34d77a===_0xe355('0x75')||_0x34d77a===_0xe355('0x76')||_0x34d77a===_0xe355('0x77')||_0x34d77a==='rtpaudioqosjitterbridged'||_0x34d77a===_0xe355('0x78')||_0x34d77a==='rtpaudioqoslossbridged'||_0x34d77a===_0xe355('0x79')||_0x34d77a===_0xe355('0x7a')||_0x34d77a===_0xe355('0x75')||_0x34d77a===_0xe355('0x76')||_0x34d77a===_0xe355('0x77')||_0x34d77a==='rtpaudioqosjitterbridged'||_0x34d77a==='rtpaudioqosloss'||_0x34d77a===_0xe355('0x7b')||_0x34d77a==='rtpaudioqosrtt'||_0x34d77a===_0xe355('0x7a')||_0x34d77a===_0xe355('0x7c')||_0x34d77a===_0xe355('0x7d')||_0x34d77a===_0xe355('0x33')||_0x34d77a===_0xe355('0x2f')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x330d90,_0x4137dc){var _0x5402cb,_0x4cb392,_0x53a8fd;if(_0x4137dc<=0x0){_0x4137dc=0x1;}_0x5402cb=new RegExp(_0xe355('0x7e')+_0x4137dc+'}$');_0x4cb392=Math['pow'](0xa,_0x4137dc-0x1);_0x53a8fd=Math[_0xe355('0x7f')](0xa,_0x4137dc)-0x1;return util['format']('%s',_[_0xe355('0x80')](_0x330d90,_0x5402cb,_[_0xe355('0x81')](_0x4cb392,_0x53a8fd)));};exports[_0xe355('0x82')]=function(_0x5df145){var _0x304ed2=_0x5df145[_0xe355('0x83')](/"(.*?)"/);return _0x304ed2?_0x304ed2[0x1]:_0x5df145;};exports[_0xe355('0x84')]=function(_0x20dccb){var _0x3c9138=_0x20dccb[_0xe355('0x83')](/<(.*?)>/);return _0x3c9138?_0x3c9138[0x1]:_0x20dccb;};function buildNoAnswerEventPayload(_0x3d8d0e,_0xd3fb36){var _0x2e628c=buildObj(_0x3d8d0e,'noanswer');if(!_[_0xe355('0xe')](_0xd3fb36['variables'])){Object[_0xe355('0x85')](_0xd3fb36[_0xe355('0x86')])['forEach'](function(_0x45cb7f){_0x2e628c[_0x45cb7f[_0xe355('0x87')]()]=_0xd3fb36[_0xe355('0x86')][_0x45cb7f];});}return _0x2e628c;}exports[_0xe355('0x88')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index ba7fa1b..3c73e4a 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9620=['queueadd','string','number','boolean','queueremove','queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0x9620,0x17c));var _0x0962=function(_0x1573ec,_0x38d0c6){_0x1573ec=_0x1573ec-0x0;var _0x27e321=_0x9620[_0x1573ec];return _0x27e321;};'use strict';exports[_0x0962('0x0')]={'queue':{'type':_0x0962('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x0962('0x1'),'required':!![]},'penalty':{'type':_0x0962('0x2'),'required':![]},'paused':{'type':_0x0962('0x3'),'required':![]}};exports[_0x0962('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0962('0x1'),'required':!![]}};exports[_0x0962('0x5')]={'interface':{'type':_0x0962('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x0962('0x1'),'required':![]}};exports[_0x0962('0x6')]={'module':{'type':_0x0962('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x0962('0x1'),'required':!![]}};exports[_0x0962('0x7')]={'uniqueid':{'type':_0x0962('0x1'),'required':!![]},'filename':{'type':_0x0962('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x0962('0x1')}};exports[_0x0962('0x8')]={'uniqueid':{'type':_0x0962('0x1'),'required':!![]}};exports[_0x0962('0x9')]={'uniqueid':{'type':_0x0962('0x1'),'required':!![]},'exten':{'type':_0x0962('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x82a5=['voicechannel','voicequeuechannelredirect','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x3b4585,_0x16a9c2){var _0x551be9=function(_0x5cea93){while(--_0x5cea93){_0x3b4585['push'](_0x3b4585['shift']());}};_0x551be9(++_0x16a9c2);}(_0x82a5,0x6e));var _0x582a=function(_0xba82a,_0x3e1a7c){_0xba82a=_0xba82a-0x0;var _0x2a397b=_0x82a5[_0xba82a];return _0x2a397b;};'use strict';exports['queueadd']={'queue':{'type':_0x582a('0x0'),'required':!![]},'interface':{'type':_0x582a('0x0'),'required':!![]},'membername':{'type':_0x582a('0x0'),'required':!![]},'penalty':{'type':_0x582a('0x1'),'required':![]},'paused':{'type':_0x582a('0x2'),'required':![]}};exports[_0x582a('0x3')]={'queue':{'type':_0x582a('0x0'),'required':!![]},'interface':{'type':_0x582a('0x0'),'required':!![]}};exports[_0x582a('0x4')]={'interface':{'type':_0x582a('0x0'),'required':!![]},'paused':{'type':_0x582a('0x2')},'reason':{'type':_0x582a('0x0'),'required':![]}};exports[_0x582a('0x5')]={'module':{'type':_0x582a('0x0'),'required':![]}};exports[_0x582a('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x582a('0x7')]={'uniqueid':{'type':_0x582a('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x582a('0x0')},'mixmonitorid':{'type':_0x582a('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x582a('0x0'),'required':!![]}};exports[_0x582a('0x8')]={'uniqueid':{'type':_0x582a('0x0'),'required':!![]},'exten':{'type':_0x582a('0x0'),'required':!![]},'context':{'type':_0x582a('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b978574..9b5c70e 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x0b0e[_0x2d91c6];return _0x3a8d19;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x579a39,_0x1cfa9a){var _0x7a47b1=function(_0x4e2a2e){while(--_0x4e2a2e){_0x579a39['push'](_0x579a39['shift']());}};_0x7a47b1(++_0x1cfa9a);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index efcb1ce..a57b292 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5ac=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x427214,_0xaa01af){var _0x4a9fe0=function(_0x6ab42){while(--_0x6ab42){_0x427214['push'](_0x427214['shift']());}};_0x4a9fe0(++_0xaa01af);}(_0xe5ac,0x133));var _0xce5a=function(_0x3762e8,_0x2e116a){_0x3762e8=_0x3762e8-0x0;var _0x4503e9=_0xe5ac[_0x3762e8];return _0x4503e9;};'use strict';function mergeDBDataToRealtime(_0x232e63,_0x181811){var _0x204c5c=Object[_0xce5a('0x0')]({},_0x232e63);for(var _0x33284d in _0x181811){if(_0x204c5c[_0xce5a('0x1')](_0x33284d)){_0x204c5c[_0x33284d]=_0x181811[_0x33284d];}}return _0x204c5c;}exports[_0xce5a('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x3218=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x15ff2c,_0x305de2){var _0x594127=function(_0x327592){while(--_0x327592){_0x15ff2c['push'](_0x15ff2c['shift']());}};_0x594127(++_0x305de2);}(_0x3218,0x1c3));var _0x8321=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0x3218[_0x541260];return _0x1dd2b5;};'use strict';function mergeDBDataToRealtime(_0x38c355,_0x43e5c4){var _0x25c654=Object[_0x8321('0x0')]({},_0x38c355);for(var _0xeb2d4d in _0x43e5c4){if(_0x25c654[_0x8321('0x1')](_0xeb2d4d)){_0x25c654[_0xeb2d4d]=_0x43e5c4[_0xeb2d4d];}}return _0x25c654;}exports[_0x8321('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 5697ef8..768af13 100644 --- a/server/services/ami/report/index.js +++ b/server/services/ami/report/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01c9=['name','find','interface','SIP/%s','assigned','lastAssignedTo','isNil','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','match','keys','getCallType','channel','split','calleridnum','outbound','internal','voiceCallReport','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','destination','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','getAgentByInternal','membername','create','length','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','bind','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode'];(function(_0x427f56,_0x3cee2b){var _0xdaf7e3=function(_0xee2ec4){while(--_0xee2ec4){_0x427f56['push'](_0x427f56['shift']());}};_0xdaf7e3(++_0x3cee2b);}(_0x01c9,0x1bd));var _0x901c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01c9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901c('0x0'));var moment=require('moment');var util=require(_0x901c('0x1'));var config=require(_0x901c('0x2'));var ami=require(_0x901c('0x3'));var RpcVoiceAgentReport=require(_0x901c('0x4'));var RpcVoiceCallReport=require(_0x901c('0x5'));var RpcVoiceDialReport=require(_0x901c('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x901c('0x7'));var RpcVoiceTransferReport=require(_0x901c('0x8'));var VoiceQueueReport=require(_0x901c('0x9'));var VoiceCallReport=require(_0x901c('0xa'));var VoiceAgentReport=require(_0x901c('0xb'));var VoiceDialReport=require(_0x901c('0xc'));var UserReport=require(_0x901c('0xd'));function Report(_0x9a403){this[_0x901c('0xe')]=_0x9a403;this[_0x901c('0xf')]=_0x9a403[_0x901c('0xf')];this[_0x901c('0x10')]=_0x9a403['telephones'];}Report[_0x901c('0x11')][_0x901c('0x12')]=function(_0x3b06fa){var _0x36496e=new VoiceQueueReport(this[_0x901c('0xe')]);var _0x3ad636=new VoiceAgentReport(this[_0x901c('0xe')]);var _0x95db88=new VoiceDialReport(this[_0x901c('0xe')]);var _0x33960b=new VoiceCallReport(this['realtime']);var _0x193900=new UserReport(this['realtime']);if(config['xdr']&&config[_0x901c('0x13')]['disabled']){ami['on'](_0x901c('0x14'),this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x901c('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0x901c('0x16')][_0x901c('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x901c('0x17')]['bind'](this));ami['on'](_0x901c('0x18'),this[_0x901c('0x19')][_0x901c('0x15')](this));ami['on'](_0x901c('0x1a'),this[_0x901c('0x1b')][_0x901c('0x15')](this));}};Report[_0x901c('0x11')][_0x901c('0x1c')]=function(_0x34c6e2){var _0x3e3962;_0x3e3962=_['find'](this[_0x901c('0xf')],function(_0x4c0371){return _0x4c0371[_0x901c('0x1d')]==_0x34c6e2||_0x4c0371[_0x901c('0x1e')]==_0x34c6e2;});if(_['isNil'](_0x3e3962)){var _0x5d9b1d=_[_0x901c('0x1f')](this[_0x901c('0x10')],function(_0x1fe7b0){return _0x1fe7b0[_0x901c('0x1d')]==_0x34c6e2||_0x1fe7b0[_0x901c('0x1e')]==_0x34c6e2;});if(_0x5d9b1d){_0x3e3962=_[_0x901c('0x1f')](this[_0x901c('0xf')],function(_0xbffe0e){return _0xbffe0e[_0x901c('0x20')]==util['format'](_0x901c('0x21'),_0x5d9b1d[_0x901c('0x1e')]);});}}return _0x3e3962;};Report['prototype']['voiceQueueReport']=function(_0x1cb2cf){for(var _0x5243d8=0x0;_0x5243d8<_0x1cb2cf['length'];_0x5243d8+=0x1){var _0x481cff=this[_0x901c('0x1c')](_0x1cb2cf[_0x5243d8]['connectedlinenum']);if(_0x481cff){_0x1cb2cf[_0x5243d8][_0x901c('0x1d')]=_0x481cff[_0x901c('0x1d')];_0x1cb2cf[_0x5243d8][_0x901c('0x22')]=!![];_0x1cb2cf[_0x5243d8][_0x901c('0x23')]=_0x481cff[_0x901c('0x1e')];_0x1cb2cf[_0x5243d8][_0x901c('0x20')]=_[_0x901c('0x24')](_0x481cff[_0x901c('0x20')])?util[_0x901c('0x25')](_0x901c('0x21'),_0x481cff[_0x901c('0x1e')]):_0x481cff[_0x901c('0x20')];if(_0x1cb2cf[_0x5243d8][_0x901c('0x26')]){_0x1cb2cf[_0x5243d8][_0x901c('0x27')]=moment()[_0x901c('0x25')](_0x901c('0x28'));}if(_0x1cb2cf[_0x5243d8][_0x901c('0x29')]){_0x1cb2cf[_0x5243d8][_0x901c('0x2a')]=moment()['format'](_0x901c('0x28'));}RpcMemberReport[_0x901c('0x2b')](_0x1cb2cf[_0x5243d8]);}RpcVoiceQueueReport['create'](_0x1cb2cf[_0x5243d8]);}};function extractCalleridNumber(_0x779da8){var _0x59526b=_0x779da8[_0x901c('0x2c')](/<(.*?)>/);return _0x59526b?_0x59526b[0x1]:_0x779da8;}Report['prototype']['getAgentByInternal']=function(_0x2919d0){for(var _0x2d0b77=0x0;_0x2d0b77','transfers','linkedid','transfereelinkedid','UserId','membername','create','monitor','monitorFilename','monitors','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents'];(function(_0x526589,_0x5b9207){var _0x4ea997=function(_0x524516){while(--_0x524516){_0x526589['push'](_0x526589['shift']());}};_0x4ea997(++_0x5b9207);}(_0x8f3e,0x1cb));var _0xe8f3=function(_0x1c5319,_0x3a5250){_0x1c5319=_0x1c5319-0x0;var _0x540520=_0x8f3e[_0x1c5319];return _0x540520;};'use strict';var _=require(_0xe8f3('0x0'));var moment=require(_0xe8f3('0x1'));var util=require(_0xe8f3('0x2'));var config=require(_0xe8f3('0x3'));var ami=require(_0xe8f3('0x4'));var RpcVoiceAgentReport=require(_0xe8f3('0x5'));var RpcVoiceCallReport=require(_0xe8f3('0x6'));var RpcVoiceDialReport=require(_0xe8f3('0x7'));var RpcMemberReport=require(_0xe8f3('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xe8f3('0x9'));var RpcVoiceTransferReport=require(_0xe8f3('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xe8f3('0xb'));var VoiceDialReport=require(_0xe8f3('0xc'));var UserReport=require(_0xe8f3('0xd'));function Report(_0x45228d){this[_0xe8f3('0xe')]=_0x45228d;this['agents']=_0x45228d[_0xe8f3('0xf')];this[_0xe8f3('0x10')]=_0x45228d[_0xe8f3('0x10')];}Report[_0xe8f3('0x11')][_0xe8f3('0x12')]=function(_0x1c076a){var _0xbd62a0=new VoiceQueueReport(this[_0xe8f3('0xe')]);var _0x29bdd0=new VoiceAgentReport(this[_0xe8f3('0xe')]);var _0x4d0e9e=new VoiceDialReport(this[_0xe8f3('0xe')]);var _0x2e8c8b=new VoiceCallReport(this[_0xe8f3('0xe')]);var _0x35ead9=new UserReport(this[_0xe8f3('0xe')]);if(config[_0xe8f3('0x13')]&&config['xdr'][_0xe8f3('0x14')]){ami['on'](_0xe8f3('0x15'),this[_0xe8f3('0x16')][_0xe8f3('0x17')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0xe8f3('0x17')](this));ami['on'](_0xe8f3('0x18'),this['voiceAgentReport'][_0xe8f3('0x17')](this));ami['on'](_0xe8f3('0x19'),this[_0xe8f3('0x1a')][_0xe8f3('0x17')](this));ami['on'](_0xe8f3('0x1b'),this[_0xe8f3('0x1c')][_0xe8f3('0x17')](this));ami['on'](_0xe8f3('0x1d'),this[_0xe8f3('0x1e')][_0xe8f3('0x17')](this));}};Report[_0xe8f3('0x11')][_0xe8f3('0x1f')]=function(_0xebebdc){var _0xa146af;_0xa146af=_[_0xe8f3('0x20')](this[_0xe8f3('0xf')],function(_0x2c15c7){return _0x2c15c7[_0xe8f3('0x21')]==_0xebebdc||_0x2c15c7[_0xe8f3('0x22')]==_0xebebdc;});if(_['isNil'](_0xa146af)){var _0x3a6f53=_['find'](this['telephones'],function(_0x2c0149){return _0x2c0149['accountcode']==_0xebebdc||_0x2c0149[_0xe8f3('0x22')]==_0xebebdc;});if(_0x3a6f53){_0xa146af=_['find'](this[_0xe8f3('0xf')],function(_0x2e989c){return _0x2e989c['interface']==util[_0xe8f3('0x23')](_0xe8f3('0x24'),_0x3a6f53['name']);});}}return _0xa146af;};Report['prototype'][_0xe8f3('0x16')]=function(_0x12a0d1){for(var _0x4b90fd=0x0;_0x4b90fd<_0x12a0d1['length'];_0x4b90fd+=0x1){var _0x4e4b71=this[_0xe8f3('0x1f')](_0x12a0d1[_0x4b90fd]['connectedlinenum']);if(_0x4e4b71){_0x12a0d1[_0x4b90fd][_0xe8f3('0x21')]=_0x4e4b71[_0xe8f3('0x21')];_0x12a0d1[_0x4b90fd][_0xe8f3('0x25')]=!![];_0x12a0d1[_0x4b90fd][_0xe8f3('0x26')]=_0x4e4b71[_0xe8f3('0x22')];_0x12a0d1[_0x4b90fd][_0xe8f3('0x27')]=_[_0xe8f3('0x28')](_0x4e4b71[_0xe8f3('0x27')])?util[_0xe8f3('0x23')](_0xe8f3('0x24'),_0x4e4b71[_0xe8f3('0x22')]):_0x4e4b71['interface'];if(_0x12a0d1[_0x4b90fd][_0xe8f3('0x29')]){_0x12a0d1[_0x4b90fd][_0xe8f3('0x2a')]=moment()[_0xe8f3('0x23')](_0xe8f3('0x2b'));}if(_0x12a0d1[_0x4b90fd][_0xe8f3('0x2c')]){_0x12a0d1[_0x4b90fd]['queuecallerexitAt']=moment()[_0xe8f3('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xe8f3('0x16')](_0x12a0d1[_0x4b90fd]);}RpcVoiceQueueReport['create'](_0x12a0d1[_0x4b90fd]);}};function extractCalleridNumber(_0x9aadff){var _0x5cf43e=_0x9aadff[_0xe8f3('0x2d')](/<(.*?)>/);return _0x5cf43e?_0x5cf43e[0x1]:_0x9aadff;}Report[_0xe8f3('0x11')][_0xe8f3('0x2e')]=function(_0x1e3ac9){for(var _0x4ba83a=0x0;_0x4ba83a0x0?!![]:![];if(!_0x371c29){return this[_0x9dc1('0x14')](this[_0x9dc1('0x49')][_0x9dc1('0x74')]);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0x2a5a6f){var _0x4d5068=this[_0x9dc1('0x49')]['id'];if(this[_0x9dc1('0x49')][_0x9dc1('0x67')][_0x4d5068]&&this[_0x9dc1('0x49')][_0x9dc1('0x67')][_0x4d5068][_0x2a5a6f[_0x9dc1('0x65')]]){this[_0x9dc1('0x49')][_0x9dc1('0x67')][_0x4d5068][_0x2a5a6f[_0x9dc1('0x65')]]['agents'][_0x9dc1('0x75')](_0x2a5a6f);}};VoiceQueueReport['prototype'][_0x9dc1('0x76')]=function(_0x2115fd){var _0x3d5e89=this;try{if(this[_0x9dc1('0x61')](_0x2115fd)&&this[_0x9dc1('0x61')](_0x2115fd[_0x9dc1('0x52')])){logger[_0x9dc1('0x55')](_0x9dc1('0x77'),util[_0x9dc1('0x40')](_0x2115fd,{'showHidden':![],'depth':null}));var _0x2bdecf=this[_0x9dc1('0x48')][_0x2115fd[_0x9dc1('0x52')]];if(_0x2bdecf){logger[_0x9dc1('0x55')](_0x9dc1('0x78'),_0x2bdecf[_0x9dc1('0x5f')]);this[_0x9dc1('0x49')][_0x9dc1('0x6a')][_0x2bdecf[_0x9dc1('0x5f')]]={'summaryEvent':_0x2115fd};this['summary']['statusRequests']+=0x1;return ami[_0x9dc1('0x39')]({'action':'queuestatus','queue':_0x2bdecf[_0x9dc1('0x5f')]})['then'](function(_0x4a6e90){if(!_0x3d5e89['summary'][_0x9dc1('0x67')][_0x2115fd[_0x9dc1('0x65')]]){_0x3d5e89[_0x9dc1('0x49')]['queuestatus'][_0x2115fd[_0x9dc1('0x65')]]={};}_0x3d5e89[_0x9dc1('0x49')][_0x9dc1('0x67')][_0x2115fd[_0x9dc1('0x65')]][_0x4a6e90[_0x9dc1('0x65')]]={'queue':_0x2bdecf[_0x9dc1('0x5f')],'agents':[]};})[_0x9dc1('0x63')](function(_0x577070){throw _0x577070;});}}}catch(_0x212360){logger[_0x9dc1('0x3e')](_0x9dc1('0x68'),util[_0x9dc1('0x40')](_0x212360,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9dc1('0xa')][_0x9dc1('0x14')]=function(_0x2d6090){if(this['summary'][_0x9dc1('0x73')]>0x0){this[_0x9dc1('0x49')]['completeEvent']=_0x2d6090;return;}logger[_0x9dc1('0x55')](_0x9dc1('0x79'),util[_0x9dc1('0x40')](_0x2d6090,{'showHidden':![],'depth':null}));this[_0x9dc1('0x49')]=initializeSummary();ami['emit'](_0x9dc1('0x7a'),{});};VoiceQueueReport['prototype'][_0x9dc1('0x1b')]=function(_0x5c8397){try{if(this[_0x9dc1('0x61')](_0x5c8397)){logger['debug'](_0x9dc1('0x7b'),_0x5c8397['uniqueid'],util[_0x9dc1('0x40')](_0x5c8397,{'showHidden':![],'depth':null}));if(_[_0x9dc1('0x62')](this['queueReports'][_0x5c8397[_0x9dc1('0x50')]])){this[_0x9dc1('0x41')][_0x5c8397[_0x9dc1('0x50')]]=[];}if(_[_0x9dc1('0x62')](this[_0x9dc1('0x37')][_0x5c8397[_0x9dc1('0x50')]])){this[_0x9dc1('0x37')][_0x5c8397[_0x9dc1('0x50')]]={};}var _0x462a8b=new QueueReport();_0x462a8b[_0x9dc1('0x52')]=_0x5c8397[_0x9dc1('0x52')];_0x462a8b[_0x9dc1('0x70')]=this['voiceQueues'][_0x462a8b[_0x9dc1('0x52')]]&&this['voiceQueues'][_0x462a8b['queue']][_0x9dc1('0x70')]?this[_0x9dc1('0x48')][_0x462a8b[_0x9dc1('0x52')]][_0x9dc1('0x70')]||_0x9dc1('0x5d'):_0x9dc1('0x5d');_0x462a8b[_0x9dc1('0x7c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x462a8b[_0x9dc1('0x7d')]=_0x5c8397[_0x9dc1('0x7d')];_0x462a8b['count']=_0x5c8397['count'];_0x462a8b['uniqueid']=_0x5c8397[_0x9dc1('0x50')];_0x462a8b[_0x9dc1('0x7e')]=this[_0x9dc1('0x37')][_0x5c8397[_0x9dc1('0x50')]][_0x9dc1('0x7e')];logger[_0x9dc1('0x7f')](_0x9dc1('0x80'),_0x462a8b[_0x9dc1('0x52')],_0x462a8b['type']);Object[_0x9dc1('0x6f')](_0x462a8b,_[_0x9dc1('0x81')](_0x5c8397,_[_0x9dc1('0x82')](_0x462a8b)));this['queueReports'][_0x5c8397[_0x9dc1('0x50')]][_0x9dc1('0x75')](_0x462a8b);this[_0x9dc1('0x37')][_0x5c8397['uniqueid']]=_0x462a8b;this[_0x9dc1('0x4d')](_0x462a8b,_0x9dc1('0x1a'));}}catch(_0x3b7fab){logger[_0x9dc1('0x3e')](_0x9dc1('0x7b'),_0x5c8397[_0x9dc1('0x50')],util['inspect'](_0x3b7fab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9dc1('0xa')][_0x9dc1('0x1d')]=function(_0x39179c){try{if(this[_0x9dc1('0x61')](_0x39179c)){logger[_0x9dc1('0x55')](_0x9dc1('0x83'),_0x39179c[_0x9dc1('0x50')],util[_0x9dc1('0x40')](_0x39179c,{'showHidden':![],'depth':null}));if(this[_0x9dc1('0x41')][_0x39179c[_0x9dc1('0x50')]]){var _0x32b70a=_['last'](this['queueReports'][_0x39179c[_0x9dc1('0x50')]]);_0x32b70a[_0x9dc1('0x84')]=![];_0x32b70a[_0x9dc1('0x85')]=null;_0x32b70a['holdtime']=_0x39179c['holdtime'];_0x32b70a[_0x9dc1('0x86')]=_0x39179c[_0x9dc1('0x86')];_0x32b70a[_0x9dc1('0x1c')]=!![];_0x32b70a['queuecallerabandonAt']=moment()[_0x9dc1('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x32b70a['queuecallerexitreason']='ABANDONED';_0x32b70a[_0x9dc1('0x87')]=null;logger[_0x9dc1('0x7f')](_0x9dc1('0x88'),_0x32b70a[_0x9dc1('0x52')],_0x32b70a['type']);this['channels'][_0x39179c[_0x9dc1('0x50')]]=_0x32b70a;this['emitVoiceQueueChannelRemove'](_0x32b70a,_0x9dc1('0x1c'));}}}catch(_0x56b116){logger[_0x9dc1('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x39179c['uniqueid'],util[_0x9dc1('0x40')](_0x56b116,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9dc1('0xa')]['syncQueueCallerLeave']=function(_0xc1dcf1){try{if(this[_0x9dc1('0x61')](_0xc1dcf1)){logger[_0x9dc1('0x55')](_0x9dc1('0x89'),_0xc1dcf1[_0x9dc1('0x50')],util['inspect'](_0xc1dcf1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xc1dcf1[_0x9dc1('0x50')]]){var _0x197f33=_[_0x9dc1('0x8a')](this[_0x9dc1('0x41')][_0xc1dcf1[_0x9dc1('0x50')]]);_0x197f33[_0x9dc1('0x8b')]=moment()[_0x9dc1('0x51')](_0x9dc1('0x8c'));_0x197f33[_0x9dc1('0x8d')]=_0xc1dcf1[_0x9dc1('0x8d')];_0x197f33[_0x9dc1('0x8e')]=_0xc1dcf1[_0x9dc1('0x8e')];logger['info'](_0x9dc1('0x8f'),_0x197f33[_0x9dc1('0x52')],_0x197f33[_0x9dc1('0x70')],_0xc1dcf1[_0x9dc1('0x8d')],_0xc1dcf1[_0x9dc1('0x8e')]);this[_0x9dc1('0x37')][_0xc1dcf1[_0x9dc1('0x50')]]=_0x197f33;this['emitVoiceQueueChannelSave'](_0x197f33,'queuecallerleave');}}}catch(_0x400181){logger[_0x9dc1('0x3e')](_0x9dc1('0x89'),_0xc1dcf1[_0x9dc1('0x50')],util[_0x9dc1('0x40')](_0x400181,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9dc1('0x22')]=function(_0x1fe08e){try{if(this[_0x9dc1('0x61')](_0x1fe08e)){logger[_0x9dc1('0x55')](_0x9dc1('0x90'),_0x1fe08e['uniqueid'],util[_0x9dc1('0x40')](_0x1fe08e,{'showHidden':![],'depth':null}));if(this[_0x9dc1('0x41')][_0x1fe08e['uniqueid']]){var _0x4881de=_[_0x9dc1('0x8a')](this[_0x9dc1('0x41')][_0x1fe08e[_0x9dc1('0x50')]]);_0x4881de['queuecallercomplete']=!![];_0x4881de[_0x9dc1('0x57')]=_0x9dc1('0x91');logger[_0x9dc1('0x7f')](_0x9dc1('0x92'),_0x4881de[_0x9dc1('0x52')],_0x4881de[_0x9dc1('0x70')]);}}}catch(_0x34be2f){logger[_0x9dc1('0x3e')](_0x9dc1('0x90'),_0x1fe08e[_0x9dc1('0x50')],util['inspect'](_0x34be2f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x5bac96){try{if(this[_0x9dc1('0x61')](_0x5bac96)){logger[_0x9dc1('0x55')](_0x9dc1('0x93'),_0x5bac96[_0x9dc1('0x50')],util[_0x9dc1('0x40')](_0x5bac96,{'showHidden':![],'depth':null}));if(this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x50')]]){var _0x5408ed=_[_0x9dc1('0x8a')](this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x50')]]);_0x5408ed[_0x9dc1('0x1c')]=![];_0x5408ed[_0x9dc1('0x94')]=null;_0x5408ed['assigned']=!![];_0x5408ed[_0x9dc1('0x87')]=_0x5bac96['membername'];_0x5408ed[_0x9dc1('0x95')]=_0x5bac96[_0x9dc1('0x95')];_0x5408ed[_0x9dc1('0x84')]=!![];_0x5408ed['queuecallerexit']=![];_0x5408ed[_0x9dc1('0x96')]=null;if(!_0x5408ed[_0x9dc1('0x97')]){if(_0x5bac96[_0x9dc1('0x98')]==_0x9dc1('0x97')){_0x5408ed[_0x9dc1('0x57')]='COMPLETED';logger[_0x9dc1('0x7f')](_0x9dc1('0x99'),_0x5408ed[_0x9dc1('0x52')],_0x5408ed['type']);}else{if(_[_0x9dc1('0x9a')](_0x5bac96[_0x9dc1('0x3b')][_0x9dc1('0x9b')](),_0x9dc1('0x9c'))){if(this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x9d')]]){var _0x213e81=_[_0x9dc1('0x8a')](this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x9d')]]);_0x213e81['queuecallercomplete']=![];_0x213e81[_0x9dc1('0x9e')]=!![];_0x213e81[_0x9dc1('0x96')]=moment(_0x5408ed[_0x9dc1('0x7c')])['add'](_0x5bac96[_0x9dc1('0x95')],_0x9dc1('0x9f'))['format'](_0x9dc1('0x8c'));_0x213e81[_0x9dc1('0x57')]='FORWARDTRANSFER';_0x213e81[_0x9dc1('0x97')]=!![];_0x213e81[_0x9dc1('0xa0')]='FORWARD';_0x213e81[_0x9dc1('0xa1')]=_0x5bac96[_0x9dc1('0xa2')];_0x213e81[_0x9dc1('0xa3')]=_0x5bac96['uniqueid'];logger[_0x9dc1('0x7f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x213e81[_0x9dc1('0x52')],_0x213e81[_0x9dc1('0x70')]);var _0x315acf=this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x9d')]];this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x9d')]]=this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x50')]];this[_0x9dc1('0x41')][_0x5bac96['uniqueid']]=_0x315acf;}}else{_0x5408ed[_0x9dc1('0x57')]=_0x9dc1('0xa4')+_0x5bac96['reason'][_0x9dc1('0xa5')]();logger[_0x9dc1('0x7f')](_0x9dc1('0xa6'),_0x5408ed['queue'],_0x5408ed['type'],_0x5408ed[_0x9dc1('0x57')]);}}}this[_0x9dc1('0x37')][_0x5bac96[_0x9dc1('0x50')]]=_0x5408ed;}}}catch(_0x1bf93a){logger['error'](_0x9dc1('0x93'),_0x5bac96['uniqueid'],util[_0x9dc1('0x40')](_0x1bf93a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9dc1('0xa')][_0x9dc1('0x24')]=function(_0x3761f5){try{if(this['isNotNull'](_0x3761f5)){logger[_0x9dc1('0x55')](_0x9dc1('0xa7'),_0x3761f5[_0x9dc1('0x50')],util[_0x9dc1('0x40')](_0x3761f5,{'showHidden':![],'depth':null}));this[_0x9dc1('0xa8')](_0x3761f5[_0x9dc1('0x50')],_[_0x9dc1('0x82')](_0x3761f5[_0x9dc1('0xa9')])[0x0],_0x3761f5['value']);if(this[_0x9dc1('0x41')][_0x3761f5['uniqueid']]){var _0x4a5a59=_[_0x9dc1('0x8a')](this[_0x9dc1('0x41')][_0x3761f5[_0x9dc1('0x50')]]);if(_0x4a5a59){if(this[_0x9dc1('0x61')](_0x3761f5[_0x9dc1('0xa9')])&&this[_0x9dc1('0x61')](_0x3761f5[_0x9dc1('0xa9')][_0x9dc1('0x67')])){switch(_0x3761f5[_0x9dc1('0xaa')]){case'CONTINUE':_0x4a5a59['queuecallerexit']=![];_0x4a5a59[_0x9dc1('0x96')]=null;break;case _0x9dc1('0xab'):_0x4a5a59[_0x9dc1('0xac')]=_0x9dc1('0xad');_0x4a5a59[_0x9dc1('0x9e')]=!![];_0x4a5a59[_0x9dc1('0x96')]=moment()[_0x9dc1('0x51')](_0x9dc1('0x8c'));_0x4a5a59['queuecallerleaveAt']=moment()['format'](_0x9dc1('0x8c'));logger['debug'](_0x9dc1('0xae'),_0x3761f5[_0x9dc1('0x50')],util[_0x9dc1('0x40')](_0x4a5a59,{'showHidden':![],'depth':null}));ami['emit'](_0x9dc1('0xaf'),_0x4a5a59);break;default:_0x4a5a59[_0x9dc1('0x9e')]=!![];_0x4a5a59['queuecallerexitAt']=moment()['format'](_0x9dc1('0x8c'));_0x4a5a59[_0x9dc1('0x8b')]=moment()[_0x9dc1('0x51')](_0x9dc1('0x8c'));}_0x4a5a59[_0x9dc1('0x1c')]=![];_0x4a5a59['queuecallerabandonAt']=null;_0x4a5a59['queuecallerexitreason']=_0x3761f5['value'];this[_0x9dc1('0x37')][_0x3761f5[_0x9dc1('0x50')]]=_0x4a5a59;this['emitVoiceQueueChannelRemove'](_0x4a5a59,'varset');}else if(this[_0x9dc1('0x61')](_0x3761f5[_0x9dc1('0xa9')])&&this[_0x9dc1('0x61')](_0x3761f5[_0x9dc1('0xa9')]['queueposition'])){if(!_0x4a5a59[_0x9dc1('0x1c')]){_0x4a5a59[_0x9dc1('0x9e')]=!![];_0x4a5a59[_0x9dc1('0x96')]=moment()[_0x9dc1('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a5a59[_0x9dc1('0x57')]=_0x9dc1('0xb0');_0x4a5a59['queuecallerleaveAt']=moment()[_0x9dc1('0x51')](_0x9dc1('0x8c'));this[_0x9dc1('0x37')][_0x3761f5[_0x9dc1('0x50')]]=_0x4a5a59;}}logger[_0x9dc1('0x7f')](_0x9dc1('0xb1'),_0x3761f5[_0x9dc1('0x50')],_0x4a5a59['queue'],_0x4a5a59[_0x9dc1('0x70')],_['keys'](_0x3761f5[_0x9dc1('0xa9')])[0x0],_0x3761f5['value']);_0x4a5a59[_0x9dc1('0x43')]=this['variables'][_0x3761f5[_0x9dc1('0x50')]];}}}}catch(_0x11053f){logger[_0x9dc1('0x3e')](_0x9dc1('0xa7'),_0x3761f5[_0x9dc1('0x50')],util['inspect'](_0x11053f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9dc1('0xa8')]=function(_0x3554eb,_0x3b9b93,_0x54252a){var _0x5eb264=['rtpaudioqos',_0x9dc1('0xb2'),_0x9dc1('0xb3'),_0x9dc1('0xb4'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x9dc1('0xb5'),_0x9dc1('0xb6'),'sipcallid',_0x9dc1('0xb7'),_0x9dc1('0xb8'),_0x9dc1('0xb9'),'membercalls',_0x9dc1('0xba'),'memberinterface',_0x9dc1('0xbb'),_0x9dc1('0xbc'),_0x9dc1('0xbd'),_0x9dc1('0xbe')];if(!_[_0x9dc1('0xbf')](_0x3b9b93)&&!_[_0x9dc1('0xc0')](_0x5eb264,_0x3b9b93)){if(_[_0x9dc1('0x62')](this[_0x9dc1('0x43')][_0x3554eb])){this['variables'][_0x3554eb]={};}this[_0x9dc1('0x43')][_0x3554eb][_0x3b9b93]=_0x54252a;}};VoiceQueueReport[_0x9dc1('0xa')]['handleHangup']=function(_0x3d98c8,_0x31f353,_0x32d43b){try{var _0x2ab5ce={};if(this[_0x9dc1('0x41')][_0x3d98c8]){for(var _0x49175f=0x0;_0x49175f0x0?!![]:![];if(!_0x39e6d2){return this['syncQueueSummaryComplete'](this[_0xd7b7('0x13')][_0xd7b7('0x70')]);}};VoiceQueueReport[_0xd7b7('0x47')][_0xd7b7('0x16')]=function(_0x18de02){var _0x2f645d=this[_0xd7b7('0x13')]['id'];if(this[_0xd7b7('0x13')][_0xd7b7('0x6d')][_0x2f645d]&&this[_0xd7b7('0x13')]['queuestatus'][_0x2f645d][_0x18de02[_0xd7b7('0x65')]]){this['summary'][_0xd7b7('0x6d')][_0x2f645d][_0x18de02['actionid']][_0xd7b7('0xf')]['push'](_0x18de02);}};VoiceQueueReport[_0xd7b7('0x47')]['syncQueueSummary']=function(_0x5f32c4){var _0xf8bf60=this;try{if(this['isNotNull'](_0x5f32c4)&&this[_0xd7b7('0x60')](_0x5f32c4[_0xd7b7('0x52')])){logger[_0xd7b7('0x4e')]('[voiceQueueReport][queuesummary]\x20event:',util[_0xd7b7('0x44')](_0x5f32c4,{'showHidden':![],'depth':null}));var _0x526998=this[_0xd7b7('0x11')][_0x5f32c4[_0xd7b7('0x52')]];if(_0x526998){logger[_0xd7b7('0x4e')](_0xd7b7('0x71'),_0x526998[_0xd7b7('0x68')]);this[_0xd7b7('0x13')]['queues'][_0x526998[_0xd7b7('0x68')]]={'summaryEvent':_0x5f32c4};this[_0xd7b7('0x13')][_0xd7b7('0x6f')]+=0x1;return ami[_0xd7b7('0x3a')]({'action':_0xd7b7('0x6d'),'queue':_0x526998['name']})[_0xd7b7('0x64')](function(_0x1bb62d){if(!_0xf8bf60['summary'][_0xd7b7('0x6d')][_0x5f32c4[_0xd7b7('0x65')]]){_0xf8bf60[_0xd7b7('0x13')][_0xd7b7('0x6d')][_0x5f32c4[_0xd7b7('0x65')]]={};}_0xf8bf60[_0xd7b7('0x13')][_0xd7b7('0x6d')][_0x5f32c4[_0xd7b7('0x65')]][_0x1bb62d[_0xd7b7('0x65')]]={'queue':_0x526998[_0xd7b7('0x68')],'agents':[]};})['catch'](function(_0x58d57a){throw _0x58d57a;});}}}catch(_0x574687){logger['error'](_0xd7b7('0x66'),util[_0xd7b7('0x44')](_0x574687,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd7b7('0x47')][_0xd7b7('0x15')]=function(_0x106564){if(this[_0xd7b7('0x13')]['statusRequests']>0x0){this[_0xd7b7('0x13')][_0xd7b7('0x70')]=_0x106564;return;}logger[_0xd7b7('0x4e')](_0xd7b7('0x72'),util[_0xd7b7('0x44')](_0x106564,{'showHidden':![],'depth':null}));this[_0xd7b7('0x13')]=initializeSummary();ami[_0xd7b7('0x4c')](_0xd7b7('0x73'),{});};VoiceQueueReport[_0xd7b7('0x47')][_0xd7b7('0x19')]=function(_0x5480d9){try{if(this[_0xd7b7('0x60')](_0x5480d9)){logger[_0xd7b7('0x4e')](_0xd7b7('0x74'),_0x5480d9['uniqueid'],util[_0xd7b7('0x44')](_0x5480d9,{'showHidden':![],'depth':null}));if(_[_0xd7b7('0x75')](this[_0xd7b7('0x42')][_0x5480d9[_0xd7b7('0x57')]])){this[_0xd7b7('0x42')][_0x5480d9[_0xd7b7('0x57')]]=[];}if(_[_0xd7b7('0x75')](this[_0xd7b7('0x10')][_0x5480d9['uniqueid']])){this[_0xd7b7('0x10')][_0x5480d9['uniqueid']]={};}var _0x33f0b5=new QueueReport();_0x33f0b5[_0xd7b7('0x52')]=_0x5480d9[_0xd7b7('0x52')];_0x33f0b5['type']=this['voiceQueues'][_0x33f0b5[_0xd7b7('0x52')]]&&this[_0xd7b7('0x11')][_0x33f0b5['queue']][_0xd7b7('0x5d')]?this[_0xd7b7('0x11')][_0x33f0b5[_0xd7b7('0x52')]][_0xd7b7('0x5d')]||'inbound':_0xd7b7('0x5e');_0x33f0b5[_0xd7b7('0x76')]=moment()[_0xd7b7('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x33f0b5['position']=_0x5480d9['position'];_0x33f0b5['count']=_0x5480d9[_0xd7b7('0x77')];_0x33f0b5[_0xd7b7('0x57')]=_0x5480d9['uniqueid'];_0x33f0b5[_0xd7b7('0x78')]=this['channels'][_0x5480d9[_0xd7b7('0x57')]][_0xd7b7('0x78')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x33f0b5[_0xd7b7('0x52')],_0x33f0b5[_0xd7b7('0x5d')]);Object[_0xd7b7('0x6c')](_0x33f0b5,_[_0xd7b7('0x79')](_0x5480d9,_['keys'](_0x33f0b5)));this[_0xd7b7('0x42')][_0x5480d9['uniqueid']][_0xd7b7('0x7a')](_0x33f0b5);this[_0xd7b7('0x10')][_0x5480d9[_0xd7b7('0x57')]]=_0x33f0b5;this[_0xd7b7('0x4d')](_0x33f0b5,_0xd7b7('0x18'));}}catch(_0x23a1ea){logger[_0xd7b7('0x40')](_0xd7b7('0x74'),_0x5480d9['uniqueid'],util[_0xd7b7('0x44')](_0x23a1ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd7b7('0x47')][_0xd7b7('0x1b')]=function(_0xb7e180){try{if(this['isNotNull'](_0xb7e180)){logger['debug'](_0xd7b7('0x7b'),_0xb7e180[_0xd7b7('0x57')],util[_0xd7b7('0x44')](_0xb7e180,{'showHidden':![],'depth':null}));if(this[_0xd7b7('0x42')][_0xb7e180['uniqueid']]){var _0xbf9b77=_[_0xd7b7('0x7c')](this[_0xd7b7('0x42')][_0xb7e180[_0xd7b7('0x57')]]);_0xbf9b77['queuecallercomplete']=![];_0xbf9b77[_0xd7b7('0x7d')]=null;_0xbf9b77[_0xd7b7('0x7e')]=_0xb7e180[_0xd7b7('0x7e')];_0xbf9b77[_0xd7b7('0x7f')]=_0xb7e180[_0xd7b7('0x7f')];_0xbf9b77[_0xd7b7('0x1a')]=!![];_0xbf9b77[_0xd7b7('0x80')]=moment()[_0xd7b7('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0xbf9b77[_0xd7b7('0x58')]='ABANDONED';_0xbf9b77[_0xd7b7('0x81')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0xbf9b77[_0xd7b7('0x52')],_0xbf9b77[_0xd7b7('0x5d')]);this[_0xd7b7('0x10')][_0xb7e180['uniqueid']]=_0xbf9b77;this[_0xd7b7('0x4a')](_0xbf9b77,_0xd7b7('0x1a'));}}}catch(_0x2cadbc){logger['error'](_0xd7b7('0x7b'),_0xb7e180['uniqueid'],util['inspect'](_0x2cadbc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd7b7('0x47')][_0xd7b7('0x1d')]=function(_0x1deff9){try{if(this[_0xd7b7('0x60')](_0x1deff9)){logger[_0xd7b7('0x4e')](_0xd7b7('0x82'),_0x1deff9[_0xd7b7('0x57')],util['inspect'](_0x1deff9,{'showHidden':![],'depth':null}));if(this[_0xd7b7('0x42')][_0x1deff9[_0xd7b7('0x57')]]){var _0x278938=_[_0xd7b7('0x7c')](this[_0xd7b7('0x42')][_0x1deff9[_0xd7b7('0x57')]]);_0x278938[_0xd7b7('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x278938['connectedlinenum']=_0x1deff9[_0xd7b7('0x84')];_0x278938['connectedlinename']=_0x1deff9[_0xd7b7('0x85')];logger[_0xd7b7('0x86')](_0xd7b7('0x87'),_0x278938['queue'],_0x278938[_0xd7b7('0x5d')],_0x1deff9[_0xd7b7('0x84')],_0x1deff9['connectedlinename']);this[_0xd7b7('0x10')][_0x1deff9[_0xd7b7('0x57')]]=_0x278938;this[_0xd7b7('0x4d')](_0x278938,_0xd7b7('0x1c'));}}}catch(_0x34b34b){logger[_0xd7b7('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x1deff9['uniqueid'],util[_0xd7b7('0x44')](_0x34b34b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd7b7('0x21')]=function(_0x1ea003){try{if(this[_0xd7b7('0x60')](_0x1ea003)){logger[_0xd7b7('0x4e')](_0xd7b7('0x88'),_0x1ea003['uniqueid'],util[_0xd7b7('0x44')](_0x1ea003,{'showHidden':![],'depth':null}));if(this[_0xd7b7('0x42')][_0x1ea003[_0xd7b7('0x57')]]){var _0xa75d5b=_[_0xd7b7('0x7c')](this[_0xd7b7('0x42')][_0x1ea003['uniqueid']]);_0xa75d5b[_0xd7b7('0x36')]=!![];_0xa75d5b[_0xd7b7('0x58')]=_0xd7b7('0x89');logger[_0xd7b7('0x86')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0xa75d5b[_0xd7b7('0x52')],_0xa75d5b[_0xd7b7('0x5d')]);}}}catch(_0x5aa00f){logger[_0xd7b7('0x40')]('[%s][voiceQueueReport][agentconnect]',_0x1ea003[_0xd7b7('0x57')],util[_0xd7b7('0x44')](_0x5aa00f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd7b7('0x47')][_0xd7b7('0x1f')]=function(_0x1743fe){try{if(this[_0xd7b7('0x60')](_0x1743fe)){logger[_0xd7b7('0x4e')](_0xd7b7('0x8a'),_0x1743fe[_0xd7b7('0x57')],util[_0xd7b7('0x44')](_0x1743fe,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1743fe[_0xd7b7('0x57')]]){var _0x356264=_[_0xd7b7('0x7c')](this['queueReports'][_0x1743fe[_0xd7b7('0x57')]]);_0x356264[_0xd7b7('0x1a')]=![];_0x356264[_0xd7b7('0x80')]=null;_0x356264['assigned']=!![];_0x356264['lastAssignedTo']=_0x1743fe[_0xd7b7('0x8b')];_0x356264[_0xd7b7('0x7e')]=_0x1743fe[_0xd7b7('0x7e')];_0x356264['queuecallercomplete']=!![];_0x356264['queuecallerexit']=![];_0x356264[_0xd7b7('0x8c')]=null;if(!_0x356264[_0xd7b7('0x8d')]){if(_0x1743fe[_0xd7b7('0x8e')]=='transfer'){_0x356264[_0xd7b7('0x58')]=_0xd7b7('0x8f');logger[_0xd7b7('0x86')](_0xd7b7('0x90'),_0x356264[_0xd7b7('0x52')],_0x356264[_0xd7b7('0x5d')]);}else{if(_['startsWith'](_0x1743fe['channel'][_0xd7b7('0x91')](),_0xd7b7('0x92'))){if(this[_0xd7b7('0x42')][_0x1743fe[_0xd7b7('0x93')]]){var _0x2ae191=_[_0xd7b7('0x7c')](this[_0xd7b7('0x42')][_0x1743fe[_0xd7b7('0x93')]]);_0x2ae191[_0xd7b7('0x36')]=![];_0x2ae191[_0xd7b7('0x35')]=!![];_0x2ae191[_0xd7b7('0x8c')]=moment(_0x356264[_0xd7b7('0x76')])['add'](_0x1743fe[_0xd7b7('0x7e')],_0xd7b7('0x94'))[_0xd7b7('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ae191[_0xd7b7('0x58')]=_0xd7b7('0x95');_0x2ae191[_0xd7b7('0x8d')]=!![];_0x2ae191[_0xd7b7('0x96')]='FORWARD';_0x2ae191[_0xd7b7('0x97')]=_0x1743fe['destexten'];_0x2ae191[_0xd7b7('0x98')]=_0x1743fe[_0xd7b7('0x57')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x2ae191[_0xd7b7('0x52')],_0x2ae191[_0xd7b7('0x5d')]);var _0x374a14=this['queueReports'][_0x1743fe[_0xd7b7('0x93')]];this[_0xd7b7('0x42')][_0x1743fe[_0xd7b7('0x93')]]=this['queueReports'][_0x1743fe[_0xd7b7('0x57')]];this[_0xd7b7('0x42')][_0x1743fe[_0xd7b7('0x57')]]=_0x374a14;}}else{_0x356264['queuecallerexitreason']='COMPLETEDBY'+_0x1743fe[_0xd7b7('0x8e')][_0xd7b7('0x99')]();logger[_0xd7b7('0x86')](_0xd7b7('0x9a'),_0x356264[_0xd7b7('0x52')],_0x356264[_0xd7b7('0x5d')],_0x356264[_0xd7b7('0x58')]);}}}this[_0xd7b7('0x10')][_0x1743fe[_0xd7b7('0x57')]]=_0x356264;}}}catch(_0xd09198){logger[_0xd7b7('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x1743fe[_0xd7b7('0x57')],util[_0xd7b7('0x44')](_0xd09198,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd7b7('0x47')][_0xd7b7('0x9b')]=function(_0xb6f32a){try{if(this[_0xd7b7('0x60')](_0xb6f32a)){logger[_0xd7b7('0x4e')](_0xd7b7('0x9c'),_0xb6f32a['uniqueid'],util[_0xd7b7('0x44')](_0xb6f32a,{'showHidden':![],'depth':null}));this[_0xd7b7('0x9d')](_0xb6f32a[_0xd7b7('0x57')],_['keys'](_0xb6f32a[_0xd7b7('0x9e')])[0x0],_0xb6f32a['value']);if(this[_0xd7b7('0x42')][_0xb6f32a[_0xd7b7('0x57')]]){var _0x4005ad=_[_0xd7b7('0x7c')](this[_0xd7b7('0x42')][_0xb6f32a[_0xd7b7('0x57')]]);if(_0x4005ad){if(this[_0xd7b7('0x60')](_0xb6f32a[_0xd7b7('0x9e')])&&this[_0xd7b7('0x60')](_0xb6f32a[_0xd7b7('0x9e')][_0xd7b7('0x6d')])){switch(_0xb6f32a[_0xd7b7('0x9f')]){case _0xd7b7('0xa0'):_0x4005ad[_0xd7b7('0x35')]=![];_0x4005ad[_0xd7b7('0x8c')]=null;break;case _0xd7b7('0xa1'):_0x4005ad['lastevent']=_0xd7b7('0xa2');_0x4005ad[_0xd7b7('0x35')]=!![];_0x4005ad[_0xd7b7('0x8c')]=moment()[_0xd7b7('0x50')](_0xd7b7('0xa3'));_0x4005ad[_0xd7b7('0x83')]=moment()[_0xd7b7('0x50')](_0xd7b7('0xa3'));logger[_0xd7b7('0x4e')](_0xd7b7('0xa4'),_0xb6f32a[_0xd7b7('0x57')],util[_0xd7b7('0x44')](_0x4005ad,{'showHidden':![],'depth':null}));ami[_0xd7b7('0x4c')](_0xd7b7('0xa5'),_0x4005ad);break;default:_0x4005ad[_0xd7b7('0x35')]=!![];_0x4005ad['queuecallerexitAt']=moment()['format'](_0xd7b7('0xa3'));_0x4005ad[_0xd7b7('0x83')]=moment()[_0xd7b7('0x50')](_0xd7b7('0xa3'));}_0x4005ad[_0xd7b7('0x1a')]=![];_0x4005ad[_0xd7b7('0x80')]=null;_0x4005ad[_0xd7b7('0x58')]=_0xb6f32a[_0xd7b7('0x9f')];this['channels'][_0xb6f32a[_0xd7b7('0x57')]]=_0x4005ad;this[_0xd7b7('0x4a')](_0x4005ad,_0xd7b7('0x22'));}else if(this[_0xd7b7('0x60')](_0xb6f32a[_0xd7b7('0x9e')])&&this[_0xd7b7('0x60')](_0xb6f32a[_0xd7b7('0x9e')][_0xd7b7('0xa6')])){if(!_0x4005ad[_0xd7b7('0x1a')]){_0x4005ad[_0xd7b7('0x35')]=!![];_0x4005ad[_0xd7b7('0x8c')]=moment()[_0xd7b7('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x4005ad['queuecallerexitreason']=_0xd7b7('0xa7');_0x4005ad[_0xd7b7('0x83')]=moment()['format'](_0xd7b7('0xa3'));this[_0xd7b7('0x10')][_0xb6f32a[_0xd7b7('0x57')]]=_0x4005ad;}}logger[_0xd7b7('0x86')](_0xd7b7('0xa8'),_0xb6f32a[_0xd7b7('0x57')],_0x4005ad['queue'],_0x4005ad[_0xd7b7('0x5d')],_[_0xd7b7('0xa9')](_0xb6f32a[_0xd7b7('0x9e')])[0x0],_0xb6f32a[_0xd7b7('0x9f')]);_0x4005ad[_0xd7b7('0x45')]=this[_0xd7b7('0x45')][_0xb6f32a[_0xd7b7('0x57')]];}}}}catch(_0x369eee){logger[_0xd7b7('0x40')](_0xd7b7('0x9c'),_0xb6f32a[_0xd7b7('0x57')],util[_0xd7b7('0x44')](_0x369eee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd7b7('0x47')]['addVariable']=function(_0xc64b46,_0x2440bc,_0x5eac97){var _0x5aa850=[_0xd7b7('0xaa'),_0xd7b7('0xab'),_0xd7b7('0xac'),_0xd7b7('0xad'),'rtpaudioqosloss',_0xd7b7('0xae'),_0xd7b7('0xaf'),_0xd7b7('0xb0'),_0xd7b7('0xb1'),'sipuri',_0xd7b7('0xb2'),_0xd7b7('0xb3'),_0xd7b7('0xb4'),_0xd7b7('0xb5'),_0xd7b7('0xb6'),_0xd7b7('0xb7'),'membername',_0xd7b7('0xb8'),_0xd7b7('0xb9')];if(!_['isNil'](_0x2440bc)&&!_[_0xd7b7('0xba')](_0x5aa850,_0x2440bc)){if(_[_0xd7b7('0x75')](this[_0xd7b7('0x45')][_0xc64b46])){this[_0xd7b7('0x45')][_0xc64b46]={};}this[_0xd7b7('0x45')][_0xc64b46][_0x2440bc]=_0x5eac97;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x2256cd,_0x24de25,_0x396afd){try{var _0x155349={};if(this[_0xd7b7('0x42')][_0x2256cd]){for(var _0x3c385a=0x0;_0x3c385a=0x0?moment(_0x129f40[_0xb18c('0x15')])['diff'](_0x129f40['starttime'],_0xb18c('0x17')):null,'data1':'outbound','data2':_0x129f40[_0xb18c('0xf')],'data3':_0x129f40['exten'],'data4':_0x129f40[_0xb18c('0x18')]||null,'role':'agent','internal':_0x129f40[_0xb18c('0xf')]?_[_0xb18c('0x19')](_0x129f40[_0xb18c('0xf')]):undefined,'uniqueid':_0x129f40[_0xb18c('0x10')]},'log':_0xb18c('0x11')});}; \ No newline at end of file +var _0xf4b9=['diff','starttime','seconds','outbound','uniqueid','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','format','SIP/%s','queuecallerleaveAt','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','membername','interface','endtime'];(function(_0x4cea42,_0x3f4a68){var _0x55ea67=function(_0x4da306){while(--_0x4da306){_0x4cea42['push'](_0x4cea42['shift']());}};_0x55ea67(++_0x3f4a68);}(_0xf4b9,0x71));var _0x9f4b=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf4b9[_0x199572];return _0x13cfa3;};'use strict';var moment=require(_0x9f4b('0x0'));var _=require(_0x9f4b('0x1'));var util=require(_0x9f4b('0x2'));var client=require(_0x9f4b('0x3'));exports[_0x9f4b('0x4')]=function(_0x30e1e1){var _0xe0be61=_0x30e1e1['queuecallercompleteAt']||_0x30e1e1[_0x9f4b('0x5')];return client['Request'](_0x9f4b('0x6'),{'body':{'channel':_0x9f4b('0x7'),'membername':_0x30e1e1[_0x9f4b('0x8')],'interface':_['isNil'](_0x30e1e1['interface'])?util[_0x9f4b('0x9')](_0x9f4b('0xa'),_0x30e1e1['lastAssignedTo']):_0x30e1e1['interface'],'type':'TALKING','enterAt':_0x30e1e1[_0x9f4b('0xb')],'exitAt':_0xe0be61,'duration':moment(_0xe0be61)['diff'](_0x30e1e1[_0x9f4b('0xb')],'seconds'),'data1':_0x9f4b('0xc'),'data2':_0x30e1e1[_0x9f4b('0xd')],'data3':_0x30e1e1[_0x9f4b('0xe')],'data4':null,'data5':_0x30e1e1[_0x9f4b('0xf')],'role':_0x9f4b('0x10'),'internal':_0x30e1e1[_0x9f4b('0x11')]?_[_0x9f4b('0x12')](_0x30e1e1[_0x9f4b('0x11')]):undefined,'uniqueid':_0x30e1e1['uniqueid']},'log':_0x9f4b('0x6')});};exports['voiceDialReport']=function(_0xe84cf4){return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0xe84cf4[_0x9f4b('0x13')],'interface':_0xe84cf4[_0x9f4b('0x14')],'type':'TALKING','enterAt':_0xe84cf4['starttime'],'exitAt':_0xe84cf4[_0x9f4b('0x15')],'duration':moment(_0xe84cf4['endtime'])[_0x9f4b('0x16')](_0xe84cf4[_0x9f4b('0x17')],'seconds')>=0x0?moment(_0xe84cf4[_0x9f4b('0x15')])[_0x9f4b('0x16')](_0xe84cf4[_0x9f4b('0x17')],_0x9f4b('0x18')):null,'data1':_0x9f4b('0x19'),'data2':_0xe84cf4[_0x9f4b('0x11')],'data3':_0xe84cf4[_0x9f4b('0xe')],'data4':_0xe84cf4['dialstring']||null,'role':_0x9f4b('0x10'),'internal':_0xe84cf4[_0x9f4b('0x11')]?_[_0x9f4b('0x12')](_0xe84cf4['accountcode']):undefined,'uniqueid':_0xe84cf4[_0x9f4b('0x1a')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 2de24b9..e151a04 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc222=['previewRecallmeReminderInterval','../client','getSettings','ShowSetting'];(function(_0x5930f9,_0x4c0de3){var _0x4e9d74=function(_0x2896a0){while(--_0x2896a0){_0x5930f9['push'](_0x5930f9['shift']());}};_0x4e9d74(++_0x4c0de3);}(_0xc222,0x75));var _0x2c22=function(_0x2ad588,_0x17e951){_0x2ad588=_0x2ad588-0x0;var _0x37ab25=_0xc222[_0x2ad588];return _0x37ab25;};'use strict';var client=require(_0x2c22('0x0'));exports[_0x2c22('0x1')]=function(){return client['Request'](_0x2c22('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x2c22('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xd6dc=['previewRecallmeReminderInterval','../client','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x24b41a,_0x45754d){var _0x136fad=function(_0x183125){while(--_0x183125){_0x24b41a['push'](_0x24b41a['shift']());}};_0x136fad(++_0x45754d);}(_0xd6dc,0x1d7));var _0xcd6d=function(_0x128978,_0x5cdb7d){_0x128978=_0x128978-0x0;var _0x32c9f7=_0xd6dc[_0x128978];return _0x32c9f7;};'use strict';var client=require(_0xcd6d('0x0'));exports['getSettings']=function(){return client[_0xcd6d('0x1')](_0xcd6d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xcd6d('0x3'),_0xcd6d('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b47acc8..d3b2daa 100644 --- a/server/services/ami/rpc/template.js +++ b/server/services/ami/rpc/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5480=['GetTemplate','html','../client','getTemplates'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0x5480,0x18a));var _0x0548=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x5480[_0xd39959];return _0x1ff69c;};'use strict';var client=require(_0x0548('0x0'));exports[_0x0548('0x1')]=function(_0x20544f){return function(_0x5d22f8){return client['Request'](_0x0548('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x0548('0x3')]},'log':_0x0548('0x2')});};}; \ No newline at end of file +var _0x1159=['html','../client','getTemplates','Request','name'];(function(_0x1b6a26,_0x1b2d97){var _0x365501=function(_0x4238dc){while(--_0x4238dc){_0x1b6a26['push'](_0x1b6a26['shift']());}};_0x365501(++_0x1b2d97);}(_0x1159,0x119));var _0x9115=function(_0x339030,_0x297c40){_0x339030=_0x339030-0x0;var _0x2fbf28=_0x1159[_0x339030];return _0x2fbf28;};'use strict';var client=require(_0x9115('0x0'));exports[_0x9115('0x1')]=function(_0x1751e6){return function(_0x3e322e){return client[_0x9115('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x9115('0x3'),_0x9115('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 622b460..7e06582 100644 --- a/server/services/ami/rpc/trigger.js +++ b/server/services/ami/rpc/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf56e=['Actions','data1','data3','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf56e,0x1ba));var _0xef56=function(_0x14ec1f,_0x59ef2f){_0x14ec1f=_0x14ec1f-0x0;var _0x5cecb3=_0xf56e[_0x14ec1f];return _0x5cecb3;};'use strict';var client=require(_0xef56('0x0'));exports[_0xef56('0x1')]=function(_0x4717bd){return function(_0x5a581e){return client[_0xef56('0x2')](_0xef56('0x3'),{'options':{'raw':![],'attributes':['id',_0xef56('0x4'),_0xef56('0x5'),_0xef56('0x6')],'include':[{'model':_0xef56('0x7'),'as':_0xef56('0x8'),'attributes':['id','field',_0xef56('0x9'),_0xef56('0xa')]},{'model':_0xef56('0x7'),'as':_0xef56('0xb'),'attributes':['id',_0xef56('0xc'),_0xef56('0x9'),_0xef56('0xa')]},{'model':_0xef56('0xd'),'as':_0xef56('0xe'),'attributes':['id','action',_0xef56('0xf'),'data2',_0xef56('0x10'),'data4','data5',_0xef56('0x11'),_0xef56('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xe5ee=['channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','data2','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name'];(function(_0x238831,_0x138f83){var _0x10733d=function(_0x5b6c93){while(--_0x5b6c93){_0x238831['push'](_0x238831['shift']());}};_0x10733d(++_0x138f83);}(_0xe5ee,0x1ea));var _0xee5e=function(_0x8ab6b3,_0x1de6c5){_0x8ab6b3=_0x8ab6b3-0x0;var _0x4d3eab=_0xe5ee[_0x8ab6b3];return _0x4d3eab;};'use strict';var client=require(_0xee5e('0x0'));exports[_0xee5e('0x1')]=function(_0x5ba387){return function(_0x1f00f0){return client['Request'](_0xee5e('0x2'),{'options':{'raw':![],'attributes':['id',_0xee5e('0x3'),_0xee5e('0x4'),_0xee5e('0x5')],'include':[{'model':_0xee5e('0x6'),'as':_0xee5e('0x7'),'attributes':['id','field',_0xee5e('0x8'),_0xee5e('0x9')]},{'model':_0xee5e('0x6'),'as':_0xee5e('0xa'),'attributes':['id',_0xee5e('0xb'),_0xee5e('0x8'),_0xee5e('0x9')]},{'model':_0xee5e('0xc'),'as':'Actions','attributes':['id','action','data1',_0xee5e('0xd'),_0xee5e('0xe'),_0xee5e('0xf'),_0xee5e('0x10'),_0xee5e('0x11'),_0xee5e('0x12')]}]},'log':_0xee5e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index b7560e7..da30a36 100644 --- a/server/services/ami/rpc/trunk.js +++ b/server/services/ami/rpc/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6737=['registry','getTrunks','Request','GetTrunk','name'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x6737,0xe2));var _0x7673=function(_0x143db0,_0x542e28){_0x143db0=_0x143db0-0x0;var _0x38080b=_0x6737[_0x143db0];return _0x38080b;};'use strict';var client=require('../client');exports[_0x7673('0x0')]=function(_0x2634c4){return function(_0x5aa730){return client[_0x7673('0x1')](_0x7673('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7673('0x3'),_0x7673('0x4'),'defaultuser']},'log':_0x7673('0x2')});};}; \ No newline at end of file +var _0x8c39=['Request','GetTrunk','name','defaultuser','../client'];(function(_0x366d19,_0x2f7045){var _0x34425d=function(_0xb3be93){while(--_0xb3be93){_0x366d19['push'](_0x366d19['shift']());}};_0x34425d(++_0x2f7045);}(_0x8c39,0x1df));var _0x98c3=function(_0x22e380,_0x18498e){_0x22e380=_0x22e380-0x0;var _0x4c2854=_0x8c39[_0x22e380];return _0x4c2854;};'use strict';var client=require(_0x98c3('0x0'));exports['getTrunks']=function(_0x1b1b94){return function(_0x116f3d){return client[_0x98c3('0x1')](_0x98c3('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x98c3('0x3'),'registry',_0x98c3('0x4')]},'log':_0x98c3('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index ed4e6f9..8dc921f 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x17e017,_0x5b6cd3){var _0x1c0650=function(_0x240248){while(--_0x240248){_0x17e017['push'](_0x17e017['shift']());}};_0x1c0650(++_0x5b6cd3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xcb91[_0x6cf19c];return _0xce14f3;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x32274a,_0x23a5dd){var _0x1e7dd8=function(_0x176708){while(--_0x176708){_0x32274a['push'](_0x32274a['shift']());}};_0x1e7dd8(++_0x23a5dd);}(_0xedd9,0xfc));var _0x9edd=function(_0x595267,_0x571349){_0x595267=_0x595267-0x0;var _0x58d166=_0xedd9[_0x595267];return _0x58d166;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index d92d7c1..152e4c4 100644 --- a/server/services/ami/rpc/voiceAgentReport.js +++ b/server/services/ami/rpc/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe40=['update','UpdateVoiceAgentReport','Request','CreateVoiceAgentReport'];(function(_0x1e1ce6,_0x328143){var _0x5b0248=function(_0x104213){while(--_0x104213){_0x1e1ce6['push'](_0x1e1ce6['shift']());}};_0x5b0248(++_0x328143);}(_0xbe40,0x136));var _0x0be4=function(_0x4d14cf,_0x3e82f3){_0x4d14cf=_0x4d14cf-0x0;var _0x27bd03=_0xbe40[_0x4d14cf];return _0x27bd03;};'use strict';var client=require('../client');exports['create']=function(_0x22b7b6){return client[_0x0be4('0x0')]('CreateVoiceAgentReport',{'body':_0x22b7b6,'log':_0x0be4('0x1')});};exports[_0x0be4('0x2')]=function(_0xa849e6,_0x2a0b59,_0x1b1f9e){return client[_0x0be4('0x0')](_0x0be4('0x3'),{'body':_0xa849e6,'options':{'where':{'uniqueid':_0x2a0b59,'interface':_0x1b1f9e,'agentcomplete':!![]}},'log':_0x0be4('0x3')});}; \ No newline at end of file +var _0x8aaa=['Request','UpdateVoiceAgentReport','create','CreateVoiceAgentReport'];(function(_0x31a012,_0x95d918){var _0x3be42d=function(_0x352787){while(--_0x352787){_0x31a012['push'](_0x31a012['shift']());}};_0x3be42d(++_0x95d918);}(_0x8aaa,0x18e));var _0xa8aa=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8aaa[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports[_0xa8aa('0x0')]=function(_0x36299c){return client['Request']('CreateVoiceAgentReport',{'body':_0x36299c,'log':_0xa8aa('0x1')});};exports['update']=function(_0x5236b7,_0x4e5559,_0x5b8c05){return client[_0xa8aa('0x2')](_0xa8aa('0x3'),{'body':_0x5236b7,'options':{'where':{'uniqueid':_0x4e5559,'interface':_0x5b8c05,'agentcomplete':!![]}},'log':_0xa8aa('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7955f39..e4eefa4 100644 --- a/server/services/ami/rpc/voiceCallReport.js +++ b/server/services/ami/rpc/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b9c=['disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x1bf839,_0x3c51a1){var _0x2ceb01=function(_0x133226){while(--_0x133226){_0x1bf839['push'](_0x1bf839['shift']());}};_0x2ceb01(++_0x3c51a1);}(_0x7b9c,0x154));var _0xc7b9=function(_0x4a70ce,_0x4c70ef){_0x4a70ce=_0x4a70ce-0x0;var _0x477b48=_0x7b9c[_0x4a70ce];return _0x477b48;};'use strict';var moment=require(_0xc7b9('0x0'));var util=require(_0xc7b9('0x1'));var _=require(_0xc7b9('0x2'));var client=require(_0xc7b9('0x3'));exports['create']=function(_0x56a7b4){return client[_0xc7b9('0x4')](_0xc7b9('0x5'),{'body':_['merge'](_0x56a7b4,{'source':_0x56a7b4[_0xc7b9('0x6')],'destinationcontext':_0x56a7b4[_0xc7b9('0x7')],'callerid':_0x56a7b4[_0xc7b9('0x8')],'amaflags':_0xc7b9('0x9')}),'log':_0xc7b9('0x5')});};exports[_0xc7b9('0xa')]=function(){return function(){return client[_0xc7b9('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xc7b9('0xb')],'createdAt':{'$between':[moment()[_0xc7b9('0xc')](_0xc7b9('0xd'))[_0xc7b9('0xe')](_0xc7b9('0xf')),moment()[_0xc7b9('0x10')]('day')[_0xc7b9('0xe')](_0xc7b9('0xf'))]}},'attributes':['type',_0xc7b9('0x11'),_0xc7b9('0x12'),_0xc7b9('0x13')]},'log':_0xc7b9('0x14')});};}; \ No newline at end of file +var _0xdc60=['GetVoiceCallReport','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','GetVoiceCallReports','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0xdc60,0x129));var _0x0dc6=function(_0x5cc533,_0x22f53a){_0x5cc533=_0x5cc533-0x0;var _0x3b1674=_0xdc60[_0x5cc533];return _0x3b1674;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require('../client');exports[_0x0dc6('0x0')]=function(_0x1553b4){return client[_0x0dc6('0x1')](_0x0dc6('0x2'),{'body':_[_0x0dc6('0x3')](_0x1553b4,{'source':_0x1553b4[_0x0dc6('0x4')],'destinationcontext':_0x1553b4[_0x0dc6('0x5')],'callerid':_0x1553b4[_0x0dc6('0x6')],'amaflags':_0x0dc6('0x7')}),'log':_0x0dc6('0x2')});};exports[_0x0dc6('0x8')]=function(){return function(){return client[_0x0dc6('0x1')](_0x0dc6('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x0dc6('0xa')]('day')['format'](_0x0dc6('0xb')),moment()[_0x0dc6('0xc')](_0x0dc6('0xd'))['format'](_0x0dc6('0xb'))]}},'attributes':[_0x0dc6('0xe'),_0x0dc6('0xf'),_0x0dc6('0x10'),'billableseconds']},'log':_0x0dc6('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index bb067ff..71dd858 100644 --- a/server/services/ami/rpc/voiceDialReport.js +++ b/server/services/ami/rpc/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67a3=['Request','CreateVoiceDialReport','create'];(function(_0x410986,_0x54606e){var _0x5d5031=function(_0x59778e){while(--_0x59778e){_0x410986['push'](_0x410986['shift']());}};_0x5d5031(++_0x54606e);}(_0x67a3,0x17c));var _0x367a=function(_0x27cfc5,_0x630ac4){_0x27cfc5=_0x27cfc5-0x0;var _0x21eb36=_0x67a3[_0x27cfc5];return _0x21eb36;};'use strict';var client=require('../client');exports[_0x367a('0x0')]=function(_0x2fd0a2){return client[_0x367a('0x1')]('CreateVoiceDialReport',{'body':_0x2fd0a2,'log':_0x367a('0x2')});}; \ No newline at end of file +var _0xa312=['Request','CreateVoiceDialReport','create'];(function(_0x5b5cff,_0x51296e){var _0x16d46b=function(_0x170af5){while(--_0x170af5){_0x5b5cff['push'](_0x5b5cff['shift']());}};_0x16d46b(++_0x51296e);}(_0xa312,0x113));var _0x2a31=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0xa312[_0x358806];return _0x19fdcb;};'use strict';var client=require('../client');exports[_0x2a31('0x0')]=function(_0x269a2f){return client[_0x2a31('0x1')](_0x2a31('0x2'),{'body':_0x269a2f,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5292175..922a600 100644 --- a/server/services/ami/rpc/voiceExtension.js +++ b/server/services/ami/rpc/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb248=['GetVoiceExtension','exten','recordingFormat','../client','Request'];(function(_0x3901b1,_0x58e36a){var _0x5f300f=function(_0x256ef0){while(--_0x256ef0){_0x3901b1['push'](_0x3901b1['shift']());}};_0x5f300f(++_0x58e36a);}(_0xb248,0xc6));var _0x8b24=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb248[_0x45d55e];return _0x29812a;};'use strict';var client=require(_0x8b24('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x8b24('0x1')](_0x8b24('0x2'),{'options':{'raw':!![],'attributes':['id',_0x8b24('0x3'),_0x8b24('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x7a72=['Request','exten','getVoiceExtensions'];(function(_0x47837f,_0x507e0b){var _0x1af92f=function(_0x1482ea){while(--_0x1482ea){_0x47837f['push'](_0x47837f['shift']());}};_0x1af92f(++_0x507e0b);}(_0x7a72,0x1be));var _0x27a7=function(_0x2ed00e,_0xd05221){_0x2ed00e=_0x2ed00e-0x0;var _0x22c9ad=_0x7a72[_0x2ed00e];return _0x22c9ad;};'use strict';var client=require('../client');exports[_0x27a7('0x0')]=function(){return function(){return client[_0x27a7('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x27a7('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x27a7('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 34309b5..71e3d15 100644 --- a/server/services/ami/rpc/voiceQueue.js +++ b/server/services/ami/rpc/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb8c=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','TrunkBackup','callerid','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency'];(function(_0x1a422a,_0x3468fd){var _0x4dcab4=function(_0x24b700){while(--_0x24b700){_0x1a422a['push'](_0x1a422a['shift']());}};_0x4dcab4(++_0x3468fd);}(_0xfb8c,0x14d));var _0xcfb8=function(_0x45820d,_0x1775a8){_0x45820d=_0x45820d-0x0;var _0x48a392=_0xfb8c[_0x45820d];return _0x48a392;};'use strict';var client=require(_0xcfb8('0x0'));exports[_0xcfb8('0x1')]=function(){return function(){return client[_0xcfb8('0x2')](_0xcfb8('0x3'),{'options':{'raw':![],'attributes':['id',_0xcfb8('0x4'),_0xcfb8('0x5'),'acwTimeout',_0xcfb8('0x6'),_0xcfb8('0x7'),_0xcfb8('0x8'),_0xcfb8('0x9'),'dialMethod',_0xcfb8('0xa'),'dialLimitQueue',_0xcfb8('0xb'),_0xcfb8('0xc'),'dialPredictiveOptimizationPercentage',_0xcfb8('0xd'),_0xcfb8('0xe'),_0xcfb8('0xf'),_0xcfb8('0x10'),_0xcfb8('0x11'),'dialQueueTimeout',_0xcfb8('0x12'),_0xcfb8('0x13'),_0xcfb8('0x14'),_0xcfb8('0x15'),_0xcfb8('0x16'),_0xcfb8('0x17'),_0xcfb8('0x18'),_0xcfb8('0x19'),_0xcfb8('0x1a'),_0xcfb8('0x1b'),_0xcfb8('0x1c'),'dialCheckDuplicateType',_0xcfb8('0x1d'),_0xcfb8('0x1e'),'dialAMDGreeting',_0xcfb8('0x1f'),_0xcfb8('0x20'),_0xcfb8('0x21'),'dialAMDBetweenWordsSilence',_0xcfb8('0x22'),_0xcfb8('0x23'),_0xcfb8('0x24'),_0xcfb8('0x25'),_0xcfb8('0x26'),_0xcfb8('0x27'),_0xcfb8('0x28'),'dialAgiAfterHangupAgent',_0xcfb8('0x29'),_0xcfb8('0x2a'),_0xcfb8('0x7'),_0xcfb8('0x2b'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0xcfb8('0x2c'),'dialNoSuchNumberRetryFrequency',_0xcfb8('0x2d'),_0xcfb8('0x2e'),_0xcfb8('0x2f'),'dialAbandonedRetryFrequency',_0xcfb8('0x30'),_0xcfb8('0x31'),'dialAgentRejectMaxRetry',_0xcfb8('0x32'),_0xcfb8('0x33'),_0xcfb8('0x34'),_0xcfb8('0x35'),_0xcfb8('0x36'),_0xcfb8('0x37')],'include':[{'model':_0xcfb8('0x38'),'as':_0xcfb8('0x38'),'attributes':['id','name','callerid',_0xcfb8('0x39')]},{'model':_0xcfb8('0x3a'),'as':'mandatoryDispositionPause','attributes':['id',_0xcfb8('0x4')]},{'model':'Trunk','as':_0xcfb8('0x3b'),'attributes':['id',_0xcfb8('0x4'),_0xcfb8('0x3c'),_0xcfb8('0x39')]},{'model':_0xcfb8('0x3d'),'as':_0xcfb8('0x3d'),'attributes':['id',_0xcfb8('0x4')],'include':[{'model':_0xcfb8('0x3d'),'as':_0xcfb8('0x3e'),'attributes':['id','name',_0xcfb8('0x3f')]}]}]},'log':_0xcfb8('0x1')});};}; \ No newline at end of file +var _0xb4b6=['dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','monitor_format','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','timeout','dialRecallMeTimeout','dialOrderByScheduledAt'];(function(_0x4789cd,_0x1d18d6){var _0x39f810=function(_0x2bee8b){while(--_0x2bee8b){_0x4789cd['push'](_0x4789cd['shift']());}};_0x39f810(++_0x1d18d6);}(_0xb4b6,0x115));var _0x6b4b=function(_0x46307f,_0x1518e9){_0x46307f=_0x46307f-0x0;var _0x1c47a6=_0xb4b6[_0x46307f];return _0x1c47a6;};'use strict';var client=require(_0x6b4b('0x0'));exports[_0x6b4b('0x1')]=function(){return function(){return client[_0x6b4b('0x2')](_0x6b4b('0x3'),{'options':{'raw':![],'attributes':['id',_0x6b4b('0x4'),'acw',_0x6b4b('0x5'),'autopause',_0x6b4b('0x6'),'type',_0x6b4b('0x7'),_0x6b4b('0x8'),'dialLimitChannel',_0x6b4b('0x9'),_0x6b4b('0xa'),_0x6b4b('0xb'),_0x6b4b('0xc'),_0x6b4b('0xd'),_0x6b4b('0xe'),_0x6b4b('0xf'),_0x6b4b('0x10'),'dialQueueOptions',_0x6b4b('0x11'),_0x6b4b('0x12'),_0x6b4b('0x13'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x6b4b('0x14'),'dialNoAnswerMaxRetry',_0x6b4b('0x15'),_0x6b4b('0x16'),_0x6b4b('0x17'),_0x6b4b('0x18'),_0x6b4b('0x19'),_0x6b4b('0x1a'),_0x6b4b('0x1b'),_0x6b4b('0x1c'),_0x6b4b('0x1d'),_0x6b4b('0x1e'),_0x6b4b('0x1f'),_0x6b4b('0x20'),_0x6b4b('0x21'),_0x6b4b('0x22'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x6b4b('0x23'),_0x6b4b('0x24'),'dialRecallInQueue',_0x6b4b('0x25'),_0x6b4b('0x26'),_0x6b4b('0x27'),_0x6b4b('0x28'),_0x6b4b('0x6'),_0x6b4b('0x29'),_0x6b4b('0x2a'),_0x6b4b('0x2b'),'dialNoSuchNumberMaxRetry',_0x6b4b('0x2c'),_0x6b4b('0x2d'),_0x6b4b('0x2e'),_0x6b4b('0x2f'),_0x6b4b('0x30'),_0x6b4b('0x31'),_0x6b4b('0x32'),_0x6b4b('0x33'),'dialAgentRejectRetryFrequency',_0x6b4b('0x34'),_0x6b4b('0x35'),_0x6b4b('0x36'),'dialPreviewAutoRecallMe',_0x6b4b('0x37')],'include':[{'model':_0x6b4b('0x38'),'as':'Trunk','attributes':['id','name',_0x6b4b('0x39'),_0x6b4b('0x3a')]},{'model':_0x6b4b('0x3b'),'as':'mandatoryDispositionPause','attributes':['id',_0x6b4b('0x4')]},{'model':_0x6b4b('0x38'),'as':_0x6b4b('0x3c'),'attributes':['id','name','callerid',_0x6b4b('0x3a')]},{'model':_0x6b4b('0x3d'),'as':_0x6b4b('0x3d'),'attributes':['id','name'],'include':[{'model':_0x6b4b('0x3d'),'as':_0x6b4b('0x3e'),'attributes':['id',_0x6b4b('0x4'),'interval']}]}]},'log':_0x6b4b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f1b8f56..17c6f13 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x2252b9,_0x48bba6){var _0x1d2db9=function(_0x2557e9){while(--_0x2557e9){_0x2252b9['push'](_0x2252b9['shift']());}};_0x1d2db9(++_0x48bba6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x5524b5,_0xf646f5){var _0x392465=function(_0x1d09d9){while(--_0x1d09d9){_0x5524b5['push'](_0x5524b5['shift']());}};_0x392465(++_0xf646f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index c50edfc..65669d0 100644 --- a/server/services/ami/rpc/voiceQueueRt.js +++ b/server/services/ami/rpc/voiceQueueRt.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf40=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x469bae,_0x1e34f4){var _0x563ad6=function(_0x91ba7){while(--_0x91ba7){_0x469bae['push'](_0x469bae['shift']());}};_0x563ad6(++_0x1e34f4);}(_0xdf40,0x19f));var _0x0df4=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0xdf40[_0x2e53e1];return _0x3a23de;};'use strict';var client=require(_0x0df4('0x0'));exports[_0x0df4('0x1')]=function(_0x698ae9){return function(){return client[_0x0df4('0x2')](_0x0df4('0x3'),{'options':{'where':{'VoiceQueueId':_0x698ae9,'paused':!![]},'raw':!![]},'log':_0x0df4('0x1')});};}; \ No newline at end of file +var _0x871c=['getVoiceQueueRtPauses','Request'];(function(_0x27206a,_0x20be04){var _0x2169d8=function(_0x436faa){while(--_0x436faa){_0x27206a['push'](_0x27206a['shift']());}};_0x2169d8(++_0x20be04);}(_0x871c,0x1e8));var _0xc871=function(_0xf6a17c,_0x316841){_0xf6a17c=_0xf6a17c-0x0;var _0x525df0=_0x871c[_0xf6a17c];return _0x525df0;};'use strict';var client=require('../client');exports[_0xc871('0x0')]=function(_0xbbf548){return function(){return client[_0xc871('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0xbbf548,'paused':!![]},'raw':!![]},'log':_0xc871('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 5fb6003..e5c97da 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x12b97a,_0x1c95d7){var _0x3e6453=function(_0x107049){while(--_0x107049){_0x12b97a['push'](_0x12b97a['shift']());}};_0x3e6453(++_0x1c95d7);}(_0x7a54,0x106));var _0x47a5=function(_0x44ec44,_0x1326cb){_0x44ec44=_0x44ec44-0x0;var _0x112f2a=_0x7a54[_0x44ec44];return _0x112f2a;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x515c50,_0x58460c){var _0x56e8fe=function(_0x41631b){while(--_0x41631b){_0x515c50['push'](_0x515c50['shift']());}};_0x56e8fe(++_0x58460c);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index e6efd0b..057ce48 100644 --- a/server/services/ami/rpc/voiceTransferReport.js +++ b/server/services/ami/rpc/voiceTransferReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a9e=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridnum'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x4a9e,0xfe));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe4a9('0x0'));exports['transfers']={};exports[_0xe4a9('0x1')]=function(_0x219d48){return client[_0xe4a9('0x2')](_0xe4a9('0x3'),{'body':{'result':_0x219d48[_0xe4a9('0x4')],'transfererchannel':_0x219d48[_0xe4a9('0x5')],'transferercalleridnum':_0x219d48[_0xe4a9('0x6')],'transferercalleridname':_0x219d48[_0xe4a9('0x7')],'transfererconnectedlinenum':_0x219d48[_0xe4a9('0x8')],'transfererconnectedlinename':_0x219d48['transfererconnectedlinename'],'transfereraccountcode':_0x219d48['transfereraccountcode'],'transferercontext':_0x219d48[_0xe4a9('0x9')],'transfererexten':_0x219d48[_0xe4a9('0xa')],'transfererlinkedid':_0x219d48[_0xe4a9('0xb')],'transfereechannel':_0x219d48[_0xe4a9('0xc')],'transfereecalleridnum':_0x219d48[_0xe4a9('0xd')],'transfereecalleridname':_0x219d48[_0xe4a9('0xe')],'transfereeconnectedlinenum':_0x219d48['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x219d48[_0xe4a9('0xf')],'transfereeaccountcode':_0x219d48[_0xe4a9('0x10')],'transfereecontext':_0x219d48[_0xe4a9('0x11')],'transfereeexten':_0x219d48[_0xe4a9('0x12')],'transfereelinkedid':_0x219d48[_0xe4a9('0x13')],'isexternal':_0x219d48[_0xe4a9('0x14')],'context':_0x219d48[_0xe4a9('0x15')],'extension':_0x219d48[_0xe4a9('0x16')],'type':_0xe4a9('0x17')},'log':_0xe4a9('0x3')});};exports[_0xe4a9('0x18')]=function(_0x524223){return client[_0xe4a9('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x524223['result'],'transfererchannel':_0x524223['origtransfererchannel'],'transferercalleridnum':_0x524223[_0xe4a9('0x19')],'transferercalleridname':_0x524223[_0xe4a9('0x1a')],'transfererconnectedlinenum':_0x524223[_0xe4a9('0x1b')],'transfererconnectedlinename':_0x524223[_0xe4a9('0x1c')],'transfereraccountcode':_0x524223[_0xe4a9('0x1d')],'transferercontext':_0x524223[_0xe4a9('0x1e')],'transfererexten':_0x524223['secondtransfererexten'],'transfererlinkedid':_0x524223[_0xe4a9('0x1f')],'transfereechannel':_0x524223['transfertargetchannel'],'transfereecalleridnum':_0x524223[_0xe4a9('0x20')],'transfereecalleridname':_0x524223[_0xe4a9('0x21')],'transfereeconnectedlinenum':_0x524223[_0xe4a9('0x22')],'transfereeconnectedlinename':_0x524223[_0xe4a9('0x23')],'transfereeaccountcode':_0x524223[_0xe4a9('0x24')],'transfereecontext':_0x524223[_0xe4a9('0x25')],'transfereeexten':_0x524223['transfertargetexten'],'transfereelinkedid':_0x524223[_0xe4a9('0x26')],'isexternal':_0x524223[_0xe4a9('0x14')],'context':_0x524223['origtransferercontext'],'extension':_0x524223[_0xe4a9('0x27')],'type':'attended'},'log':_0xe4a9('0x3')});}; \ No newline at end of file +var _0xfb66=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid'];(function(_0x28cb85,_0x2e100c){var _0x225eef=function(_0x1948de){while(--_0x1948de){_0x28cb85['push'](_0x28cb85['shift']());}};_0x225eef(++_0x2e100c);}(_0xfb66,0x1e7));var _0x6fb6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xfb66[_0x173441];return _0x2423a8;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x6fb6('0x0')]=function(_0x145d7c){return client[_0x6fb6('0x1')](_0x6fb6('0x2'),{'body':{'result':_0x145d7c[_0x6fb6('0x3')],'transfererchannel':_0x145d7c[_0x6fb6('0x4')],'transferercalleridnum':_0x145d7c['transferercalleridnum'],'transferercalleridname':_0x145d7c[_0x6fb6('0x5')],'transfererconnectedlinenum':_0x145d7c[_0x6fb6('0x6')],'transfererconnectedlinename':_0x145d7c['transfererconnectedlinename'],'transfereraccountcode':_0x145d7c[_0x6fb6('0x7')],'transferercontext':_0x145d7c[_0x6fb6('0x8')],'transfererexten':_0x145d7c['transfererexten'],'transfererlinkedid':_0x145d7c[_0x6fb6('0x9')],'transfereechannel':_0x145d7c[_0x6fb6('0xa')],'transfereecalleridnum':_0x145d7c['transfereecalleridnum'],'transfereecalleridname':_0x145d7c['transfereecalleridname'],'transfereeconnectedlinenum':_0x145d7c[_0x6fb6('0xb')],'transfereeconnectedlinename':_0x145d7c['transfereeconnectedlinename'],'transfereeaccountcode':_0x145d7c[_0x6fb6('0xc')],'transfereecontext':_0x145d7c['transfereecontext'],'transfereeexten':_0x145d7c[_0x6fb6('0xd')],'transfereelinkedid':_0x145d7c['transfereelinkedid'],'isexternal':_0x145d7c[_0x6fb6('0xe')],'context':_0x145d7c[_0x6fb6('0xf')],'extension':_0x145d7c[_0x6fb6('0x10')],'type':_0x6fb6('0x11')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x572632){return client[_0x6fb6('0x1')](_0x6fb6('0x2'),{'body':{'result':_0x572632['result'],'transfererchannel':_0x572632[_0x6fb6('0x12')],'transferercalleridnum':_0x572632[_0x6fb6('0x13')],'transferercalleridname':_0x572632['origtransferercalleridname'],'transfererconnectedlinenum':_0x572632[_0x6fb6('0x14')],'transfererconnectedlinename':_0x572632['secondtransfererconnectedlinename'],'transfereraccountcode':_0x572632[_0x6fb6('0x15')],'transferercontext':_0x572632[_0x6fb6('0x16')],'transfererexten':_0x572632[_0x6fb6('0x17')],'transfererlinkedid':_0x572632[_0x6fb6('0x18')],'transfereechannel':_0x572632['transfertargetchannel'],'transfereecalleridnum':_0x572632[_0x6fb6('0x19')],'transfereecalleridname':_0x572632[_0x6fb6('0x1a')],'transfereeconnectedlinenum':_0x572632['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x572632['transfertargetconnectedlinename'],'transfereeaccountcode':_0x572632[_0x6fb6('0x1b')],'transfereecontext':_0x572632[_0x6fb6('0x1c')],'transfereeexten':_0x572632['transfertargetexten'],'transfereelinkedid':_0x572632[_0x6fb6('0x1d')],'isexternal':_0x572632[_0x6fb6('0xe')],'context':_0x572632['origtransferercontext'],'extension':_0x572632[_0x6fb6('0x1e')],'type':_0x6fb6('0x1f')},'log':_0x6fb6('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 123a3fb..1cd6e27 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0xab2890,_0xefb07c){var _0x2a348c=function(_0x386270){while(--_0x386270){_0xab2890['push'](_0xab2890['shift']());}};_0x2a348c(++_0xefb07c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2226c1,_0x2bed75){_0x2226c1=_0x2226c1-0x0;var _0x178716=_0xb10b[_0x2226c1];return _0x178716;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x47f4b0,_0x18a2db){var _0x484b9c=function(_0x2ca88e){while(--_0x2ca88e){_0x47f4b0['push'](_0x47f4b0['shift']());}};_0x484b9c(++_0x18a2db);}(_0xb10b,0x12a));var _0xbb10=function(_0x99d37,_0x4e7974){_0x99d37=_0x99d37-0x0;var _0x2db098=_0xb10b[_0x99d37];return _0x2db098;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index fa921eb..c2d7d6e 100644 --- a/server/services/ami/trigger/cmContact/index.js +++ b/server/services/ami/trigger/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5cd=['[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','resolve','createContact','[CM][%s][%s]\x20Contact\x20created:%s','info','push','user:%s','trigger:%s','toLowerCase','merge','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter'];(function(_0x34f3a7,_0x29557e){var _0x499f15=function(_0x5b41a7){while(--_0x5b41a7){_0x34f3a7['push'](_0x34f3a7['shift']());}};_0x499f15(++_0x29557e);}(_0xa5cd,0xd3));var _0xda5c=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xa5cd[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0xda5c('0x0'));var util=require(_0xda5c('0x1'));var config=require(_0xda5c('0x2'));var logger=require('../../../../config/logger')(_0xda5c('0x3'));var cmContactRpc=require(_0xda5c('0x4'));config[_0xda5c('0x5')]=_[_0xda5c('0x6')](config[_0xda5c('0x5')],{'host':_0xda5c('0x7'),'port':0x18eb});var io=require(_0xda5c('0x8'))(new Redis(config['redis']));function emit(_0x7006b3,_0x3c2094,_0x2df01d,_0xa18ef3,_0x4ee173){logger['info'](_0xda5c('0x9'),_0x7006b3,_0x3c2094['id'],_0x2df01d,_0xa18ef3,JSON[_0xda5c('0xa')](_0x4ee173));io['to'](_0x2df01d)[_0xda5c('0xb')](_0xa18ef3,_0x4ee173);}exports['exec']=function(_0x260deb,_0x379589,_0x589607,_0x58711f){var _0x8bcbd4,_0x34fdf4;var _0x19064e={};var _0x4e88da;var _0x365102=Number(_0x589607[_0xda5c('0xc')]);var _0x5bf7b9=_0x589607[_0xda5c('0xd')]?Boolean(Number(_0x589607[_0xda5c('0xd')])):![];var _0x8197a6;var _0x5b5c68=![];if(!_[_0xda5c('0xe')](_0x589607[_0xda5c('0xf')])){if(_0x589607[_0xda5c('0xf')]=='1')_0x5b5c68=!![];}if(!_0x5b5c68){if(_0x58711f[_0xda5c('0x10')]){_0x19064e['id']=_0x58711f['xmd-contactid'];}}if(!_0x19064e['id']){_0x19064e[_0xda5c('0x11')]=_0x365102;_0x8197a6=_0x589607['data3']&&_0x589607[_0xda5c('0x12')]!=='0'?_0x589607['data3'][_0xda5c('0x13')](','):['phone'];_0x19064e[_0xda5c('0x14')]=_['map'](_0x8197a6,function(_0x236ad5){var _0x44dae0={};_0x44dae0[_0x236ad5]=_0x58711f[_0xda5c('0x15')]?_0x58711f[_0xda5c('0x16')]:_0x58711f[_0xda5c('0x17')];return _0x44dae0;});_0x4e88da=_0x58711f['routeId']?_0x58711f[_0xda5c('0x16')]:_0x58711f[_0xda5c('0x17')];}var _0x1ab310=['id',_0xda5c('0x18'),_0xda5c('0x19'),_0xda5c('0x1a'),_0xda5c('0x1b'),_0xda5c('0x1c'),_0xda5c('0x11'),_0xda5c('0x1d'),_0xda5c('0x1e'),_0xda5c('0x1f')];var _0x5dea88=_[_0xda5c('0x20')](_0x1ab310,_0x8197a6);BPromise['resolve']()['then'](cmContactRpc['getContacts']({'attributes':_0x5dea88,'where':_0x19064e,'phone':_0x4e88da}))[_0xda5c('0x21')](function(_0xe03191){_0x34fdf4=_0xe03191;if(!_[_0xda5c('0x22')](_0x34fdf4)){if(_0x34fdf4[_0xda5c('0x23')]===0x1){_0x8bcbd4=_0x34fdf4[0x0];logger['info'](_0xda5c('0x24'),_0x58711f[_0xda5c('0x25')],_0x379589['id'],_0x8bcbd4['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x58711f[_0xda5c('0x25')],_0x379589['id'],_[_0xda5c('0x26')](_0x34fdf4,'id')[_0xda5c('0x27')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x58711f['uniqueid'],_0x379589['id']);var _0x190a6f={'ListId':_0x365102};var _0x14e06f=_0x589607[_0xda5c('0x28')]&&_0x589607['data4']!=='0'?_0x589607[_0xda5c('0x28')]:_0xda5c('0x1a');if(_0x5bf7b9){logger['info'](_0xda5c('0x29'),_0x58711f[_0xda5c('0x25')],_0x379589['id']);_0x190a6f[_0x14e06f]=_[_0xda5c('0xe')](_0x58711f['routeId'])?_0x58711f[_0xda5c('0x17')]:_0x58711f['destcalleridnum'];if(_[_0xda5c('0xe')](_0x58711f[_0xda5c('0x15')])){_0x190a6f[_0xda5c('0x18')]=_0x58711f[_0xda5c('0x2a')]&&_0x58711f[_0xda5c('0x2a')]!==_0xda5c('0x2b')?_0x58711f[_0xda5c('0x2a')]:'Unknown';}else{_0x190a6f[_0xda5c('0x18')]=_0x58711f[_0xda5c('0x2c')]&&_0x58711f[_0xda5c('0x2c')]!==_0xda5c('0x2b')?_0x58711f[_0xda5c('0x2c')]:_0xda5c('0x2d');}return BPromise[_0xda5c('0x2e')]()[_0xda5c('0x21')](cmContactRpc[_0xda5c('0x2f')](_0x190a6f))[_0xda5c('0x21')](function(_0x235a9f){_0x8bcbd4=_0x235a9f;_0x34fdf4['push'](_0x235a9f);if(_0x8bcbd4){logger['info'](_0xda5c('0x30'),_0x58711f['uniqueid'],_0x379589['id'],_0x8bcbd4['id']);}return;});}else{logger[_0xda5c('0x31')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x58711f['uniqueid'],_0x379589['id']);_0x190a6f[_0x14e06f]=_[_0xda5c('0xe')](_0x58711f[_0xda5c('0x15')])?_0x58711f['calleridnum']:_0x58711f[_0xda5c('0x16')];if(_[_0xda5c('0xe')](_0x58711f[_0xda5c('0x15')])){_0x190a6f[_0xda5c('0x18')]=_0x58711f[_0xda5c('0x2a')]&&_0x58711f[_0xda5c('0x2a')]!==_0xda5c('0x2b')?_0x58711f['calleridname']:'Unknown';}else{_0x190a6f[_0xda5c('0x18')]=_0x58711f[_0xda5c('0x2c')]&&_0x58711f[_0xda5c('0x2c')]!==''?_0x58711f['destcalleridname']:_0xda5c('0x2d');}_0x8bcbd4=_0x190a6f;_0x34fdf4[_0xda5c('0x32')](_0x190a6f);return;}}})[_0xda5c('0x21')](function(){if(_0x260deb){emit(_0x58711f[_0xda5c('0x25')],_0x379589,util['format'](_0xda5c('0x33'),_0x260deb['name']),util['format'](_0xda5c('0x34'),_0x589607['action'][_0xda5c('0x35')]()),{'evt':_[_0xda5c('0x36')](_0x58711f,{'autoCreate':_0x5bf7b9}),'contact':_0x8bcbd4===undefined?{}:_0x8bcbd4,'contacts':_0x34fdf4['length']===0x0?undefined:_0x34fdf4});}});}; \ No newline at end of file +var _0x30a8=['bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','createdAt','scheduledAt','updatedAt','union','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','calleridname','','Unknown','destcalleridname','resolve','createContact','format','user:%s','trigger:%s','action','toLowerCase','merge'];(function(_0x29bd91,_0x3065ff){var _0x37b6eb=function(_0x4882e0){while(--_0x4882e0){_0x29bd91['push'](_0x29bd91['shift']());}};_0x37b6eb(++_0x3065ff);}(_0x30a8,0xab));var _0x830a=function(_0x5b70f5,_0x5ce103){_0x5b70f5=_0x5b70f5-0x0;var _0x54cbfe=_0x30a8[_0x5b70f5];return _0x54cbfe;};'use strict';var _=require('lodash');var BPromise=require(_0x830a('0x0'));var Redis=require(_0x830a('0x1'));var util=require(_0x830a('0x2'));var config=require(_0x830a('0x3'));var logger=require(_0x830a('0x4'))(_0x830a('0x5'));var cmContactRpc=require(_0x830a('0x6'));config[_0x830a('0x7')]=_[_0x830a('0x8')](config['redis'],{'host':_0x830a('0x9'),'port':0x18eb});var io=require(_0x830a('0xa'))(new Redis(config[_0x830a('0x7')]));function emit(_0x260723,_0x3e5f8d,_0x183598,_0x4ab5e3,_0x5bf26c){logger[_0x830a('0xb')](_0x830a('0xc'),_0x260723,_0x3e5f8d['id'],_0x183598,_0x4ab5e3,JSON[_0x830a('0xd')](_0x5bf26c));io['to'](_0x183598)[_0x830a('0xe')](_0x4ab5e3,_0x5bf26c);}exports[_0x830a('0xf')]=function(_0x1eaa7b,_0x2cd1fe,_0x579562,_0x19c4eb){var _0xd93456,_0x5d1c51;var _0x2d348a={};var _0x40c8eb;var _0xb0b327=Number(_0x579562[_0x830a('0x10')]);var _0x17eb01=_0x579562[_0x830a('0x11')]?Boolean(Number(_0x579562[_0x830a('0x11')])):![];var _0x766341;var _0x18ae41=![];if(!_[_0x830a('0x12')](_0x579562[_0x830a('0x13')])){if(_0x579562[_0x830a('0x13')]=='1')_0x18ae41=!![];}if(!_0x18ae41){if(_0x19c4eb[_0x830a('0x14')]){_0x2d348a['id']=_0x19c4eb[_0x830a('0x14')];}}if(!_0x2d348a['id']){_0x2d348a[_0x830a('0x15')]=_0xb0b327;_0x766341=_0x579562[_0x830a('0x16')]&&_0x579562[_0x830a('0x16')]!=='0'?_0x579562['data3'][_0x830a('0x17')](','):['phone'];_0x2d348a[_0x830a('0x18')]=_[_0x830a('0x19')](_0x766341,function(_0x177045){var _0x5a3d30={};_0x5a3d30[_0x177045]=_0x19c4eb[_0x830a('0x1a')]?_0x19c4eb[_0x830a('0x1b')]:_0x19c4eb['calleridnum'];return _0x5a3d30;});_0x40c8eb=_0x19c4eb[_0x830a('0x1a')]?_0x19c4eb[_0x830a('0x1b')]:_0x19c4eb[_0x830a('0x1c')];}var _0x40aa10=['id',_0x830a('0x1d'),_0x830a('0x1e'),_0x830a('0x1f'),_0x830a('0x20'),'fax',_0x830a('0x15'),_0x830a('0x21'),_0x830a('0x22'),_0x830a('0x23')];var _0x397699=_[_0x830a('0x24')](_0x40aa10,_0x766341);BPromise['resolve']()[_0x830a('0x25')](cmContactRpc['getContacts']({'attributes':_0x397699,'where':_0x2d348a,'phone':_0x40c8eb}))[_0x830a('0x25')](function(_0x447764){_0x5d1c51=_0x447764;if(!_[_0x830a('0x26')](_0x5d1c51)){if(_0x5d1c51[_0x830a('0x27')]===0x1){_0xd93456=_0x5d1c51[0x0];logger[_0x830a('0xb')](_0x830a('0x28'),_0x19c4eb[_0x830a('0x29')],_0x2cd1fe['id'],_0xd93456['id']);}else{logger['info'](_0x830a('0x2a'),_0x19c4eb['uniqueid'],_0x2cd1fe['id'],_['map'](_0x5d1c51,'id')[_0x830a('0x2b')](','));}return;}else{logger[_0x830a('0xb')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x19c4eb[_0x830a('0x29')],_0x2cd1fe['id']);var _0xe7181c={'ListId':_0xb0b327};var _0x5d99fc=_0x579562[_0x830a('0x2c')]&&_0x579562[_0x830a('0x2c')]!=='0'?_0x579562[_0x830a('0x2c')]:_0x830a('0x1f');if(_0x17eb01){logger[_0x830a('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x19c4eb['uniqueid'],_0x2cd1fe['id']);_0xe7181c[_0x5d99fc]=_[_0x830a('0x12')](_0x19c4eb[_0x830a('0x1a')])?_0x19c4eb[_0x830a('0x1c')]:_0x19c4eb[_0x830a('0x1b')];if(_[_0x830a('0x12')](_0x19c4eb[_0x830a('0x1a')])){_0xe7181c[_0x830a('0x1d')]=_0x19c4eb[_0x830a('0x2d')]&&_0x19c4eb[_0x830a('0x2d')]!==_0x830a('0x2e')?_0x19c4eb[_0x830a('0x2d')]:_0x830a('0x2f');}else{_0xe7181c[_0x830a('0x1d')]=_0x19c4eb[_0x830a('0x30')]&&_0x19c4eb[_0x830a('0x30')]!==_0x830a('0x2e')?_0x19c4eb['destcalleridname']:_0x830a('0x2f');}return BPromise[_0x830a('0x31')]()[_0x830a('0x25')](cmContactRpc[_0x830a('0x32')](_0xe7181c))[_0x830a('0x25')](function(_0x5df0e7){_0xd93456=_0x5df0e7;_0x5d1c51['push'](_0x5df0e7);if(_0xd93456){logger[_0x830a('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x19c4eb[_0x830a('0x29')],_0x2cd1fe['id'],_0xd93456['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x19c4eb['uniqueid'],_0x2cd1fe['id']);_0xe7181c[_0x5d99fc]=_[_0x830a('0x12')](_0x19c4eb['routeId'])?_0x19c4eb['calleridnum']:_0x19c4eb['destcalleridnum'];if(_[_0x830a('0x12')](_0x19c4eb[_0x830a('0x1a')])){_0xe7181c[_0x830a('0x1d')]=_0x19c4eb['calleridname']&&_0x19c4eb[_0x830a('0x2d')]!==_0x830a('0x2e')?_0x19c4eb['calleridname']:_0x830a('0x2f');}else{_0xe7181c[_0x830a('0x1d')]=_0x19c4eb[_0x830a('0x30')]&&_0x19c4eb[_0x830a('0x30')]!==_0x830a('0x2e')?_0x19c4eb['destcalleridname']:_0x830a('0x2f');}_0xd93456=_0xe7181c;_0x5d1c51['push'](_0xe7181c);return;}}})['then'](function(){if(_0x1eaa7b){emit(_0x19c4eb['uniqueid'],_0x2cd1fe,util[_0x830a('0x33')](_0x830a('0x34'),_0x1eaa7b['name']),util[_0x830a('0x33')](_0x830a('0x35'),_0x579562[_0x830a('0x36')][_0x830a('0x37')]()),{'evt':_[_0x830a('0x38')](_0x19c4eb,{'autoCreate':_0x17eb01}),'contact':_0xd93456===undefined?{}:_0xd93456,'contacts':_0x5d1c51[_0x830a('0x27')]===0x0?undefined:_0x5d1c51});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ef6ab9a..93bc21a 100644 --- a/server/services/ami/trigger/index.js +++ b/server/services/ami/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdae6=['isNil','data3','data4','uriLocation','data5','800','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','trigger:%s','exec','integration','urlforward','buildUri','parse','query','search','channel','motionChannel','AllConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','checkConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','queue','agent','membername','lastevent','routeId','mailSubstatus','undefined','substatus','offlineMessage','equals','exports','lodash','url','mustache','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','prototype','emit','info','stringify','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','length','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found'];(function(_0xa29f61,_0x2ccfa8){var _0x32b823=function(_0x2b47b1){while(--_0x2b47b1){_0xa29f61['push'](_0xa29f61['shift']());}};_0x32b823(++_0x2ccfa8);}(_0xdae6,0x1a8));var _0x6dae=function(_0x5a2a15,_0x2bb7ec){_0x5a2a15=_0x5a2a15-0x0;var _0x4b2701=_0xdae6[_0x5a2a15];return _0x4b2701;};'use strict';var util=require('util');var _=require(_0x6dae('0x0'));var url=require(_0x6dae('0x1'));var Mustache=require(_0x6dae('0x2'));var Redis=require('ioredis');var urlforward=require(_0x6dae('0x3'));var integration=require(_0x6dae('0x4'));var cmContact=require('./cmContact');var script=require(_0x6dae('0x5'));var config=require(_0x6dae('0x6'));var logger=require(_0x6dae('0x7'))(_0x6dae('0x8'));var ami=require(_0x6dae('0x9'));config[_0x6dae('0xa')]=_['defaults'](config[_0x6dae('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x6dae('0xb'))(new Redis(config['redis']));var operators={'equals':function(_0x1bfb89,_0x2df80e){return _0x1bfb89==_0x2df80e;},'not_equals':function(_0x2199c6,_0x52cf33){return _0x2199c6!=_0x52cf33;}};var barAndWebActions=[_0x6dae('0xc'),_0x6dae('0x1'),_0x6dae('0xd')];function Trigger(_0x23a528){this[_0x6dae('0xe')]=_0x23a528['triggers'];this[_0x6dae('0xf')]=_0x23a528[_0x6dae('0xf')];this[_0x6dae('0x10')]=_0x23a528[_0x6dae('0x10')];this[_0x6dae('0x11')]=_0x23a528[_0x6dae('0x11')];this[_0x6dae('0x12')]=_0x23a528[_0x6dae('0x12')];this[_0x6dae('0x13')]=_0x23a528[_0x6dae('0x13')];this[_0x6dae('0x14')]=_0x23a528[_0x6dae('0x14')];this[_0x6dae('0x15')]=_0x23a528[_0x6dae('0x15')];this['sugarcrmAccounts']=_0x23a528[_0x6dae('0x16')];this[_0x6dae('0x17')]=_0x23a528[_0x6dae('0x17')];this['deskAccounts']=_0x23a528[_0x6dae('0x18')];this[_0x6dae('0x19')]=_0x23a528[_0x6dae('0x19')];this[_0x6dae('0x1a')]=_0x23a528[_0x6dae('0x1a')];this[_0x6dae('0x1b')]=_0x23a528['dynamics365Accounts'];this[_0x6dae('0x1c')]=_0x23a528[_0x6dae('0x1c')];this[_0x6dae('0x1d')]={'zendesk':this[_0x6dae('0x13')],'salesforce':this[_0x6dae('0x15')],'freshdesk':this[_0x6dae('0x14')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x6dae('0x17')],'desk':this[_0x6dae('0x18')],'vtiger':this[_0x6dae('0x19')],'dynamics365':this[_0x6dae('0x1b')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x6dae('0x1a')]};ami['on'](_0x6dae('0x1e'),this[_0x6dae('0x1f')]['bind'](this));ami['on']('custom:agentconnect',this[_0x6dae('0x1f')][_0x6dae('0x20')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentcomplete',this[_0x6dae('0x1f')][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x21'),this[_0x6dae('0x1f')][_0x6dae('0x20')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x22'),this['syncCustomEvent'][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x23'),this[_0x6dae('0x1f')][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x24'),this[_0x6dae('0x1f')][_0x6dae('0x20')](this));ami['on']('custom:amd',this[_0x6dae('0x1f')][_0x6dae('0x20')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x25'),this[_0x6dae('0x1f')][_0x6dae('0x20')](this));ami['on']('custom:dialbegin',this[_0x6dae('0x26')][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x27'),this[_0x6dae('0x26')][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x28'),this[_0x6dae('0x26')][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x29'),this[_0x6dae('0x1f')][_0x6dae('0x20')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x2a'),this['syncCustomEvent'][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x2b'),this['syncCustomEvent'][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x2c'),this[_0x6dae('0x1f')][_0x6dae('0x20')](this));ami['on'](_0x6dae('0x2d'),this[_0x6dae('0x1f')]['bind'](this));ami['on']('custom:rejectmessage',this['syncCustomEvent']['bind'](this));ami['on']('custom:offlineMessage',this[_0x6dae('0x1f')][_0x6dae('0x20')](this));}Trigger[_0x6dae('0x2e')][_0x6dae('0x2f')]=function(_0xcb4190,_0x218446,_0x52d5af){logger[_0x6dae('0x30')](_0xcb4190,_0x218446,JSON[_0x6dae('0x31')](_0x52d5af));io['to'](_0xcb4190)['emit'](_0x218446,_0x52d5af);};Trigger[_0x6dae('0x2e')]['syncCustomEvent']=function(_0x1f9f3d){var _0x14eac8=_['clone'](_0x1f9f3d);if(typeof _0x14eac8['motionChannel']==='undefined'){_0x14eac8['motionChannel']=_0x6dae('0x32');}logger[_0x6dae('0x33')](_0x6dae('0x1f'),util[_0x6dae('0x34')](_0x14eac8,{'showHidden':!![],'depth':null}));this[_0x6dae('0x35')](_0x14eac8);};Trigger[_0x6dae('0x2e')][_0x6dae('0x26')]=function(_0xd7371e){if(this[_0x6dae('0xf')][_0xd7371e[_0x6dae('0x36')]]){this[_0x6dae('0x1f')](_0xd7371e);}};Trigger['prototype']['checkTriggers']=function(_0x30a0e7){var _0x3ecd07;for(var _0x349972 in this['triggers']){if(this['triggers'][_0x6dae('0x37')](_0x349972)){if(this['triggers'][_0x349972]['status']){_0x3ecd07=this[_0x6dae('0x38')](this['triggers'][_0x349972],_0x30a0e7);if(_0x3ecd07){_[_0x6dae('0x39')](_0x30a0e7,_0x30a0e7[_0x6dae('0x3a')]);for(var _0x5607d6=0x0,_0x36c5b7,_0x4c138c,_0x30727c;_0x5607d60x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x4c2cfb,_0x4b936b){var _0x575307=function(_0x41ebb6){while(--_0x41ebb6){_0x4c2cfb['push'](_0x4c2cfb['shift']());}};_0x575307(++_0x4b936b);}(_0x55ca,0x126));var _0xa55c=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0x55ca[_0x4c2f30];return _0xb8854d;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 62080ab..7c3668a 100644 --- a/server/services/ami/trigger/integration/dynamics365.js +++ b/server/services/ami/trigger/integration/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4a8=['type','nameField','customField','idField','substring','indexOf','incident','assign','getString','Descriptions','Fields','ticketType','phonecall','callDirection','queue','/contacts(','phonecalls','Subjects','calleridnum','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','data2','CloudProvider','data5','POST','password','then','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','userId','outbound','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','catch','toLowerCase','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing','toUpperCase',']\x20Enduser\x20created!','forEach','includes','string','picklist'];(function(_0x1634b7,_0xa6002c){var _0x28f3c4=function(_0x4c00df){while(--_0x4c00df){_0x1634b7['push'](_0x1634b7['shift']());}};_0x28f3c4(++_0xa6002c);}(_0xe4a8,0x186));var _0x8e4a=function(_0x4f8b2b,_0x1dc8dd){_0x4f8b2b=_0x4f8b2b-0x0;var _0x2f230a=_0xe4a8[_0x4f8b2b];return _0x2f230a;};'use strict';var _=require(_0x8e4a('0x0'));var rp=require(_0x8e4a('0x1'));var util=require(_0x8e4a('0x2'));var intUtil=require(_0x8e4a('0x3'));var md5=require('md5');var Redis=require(_0x8e4a('0x4'));var logger=require(_0x8e4a('0x5'))(_0x8e4a('0x6'));var config=require(_0x8e4a('0x7'));config[_0x8e4a('0x8')]=_[_0x8e4a('0x9')](config[_0x8e4a('0x8')],{'host':_0x8e4a('0xa'),'port':0x18eb});var io=require(_0x8e4a('0xb'))(new Redis(config[_0x8e4a('0x8')]));function getAuthToken(_0x3682e5,_0x3762c5,_0x4465bb){if(_0x3682e5[_0x8e4a('0xc')]){_0x3682e5[_0x8e4a('0xd')]=_0x3682e5['CloudProvider'][_0x8e4a('0xe')];_0x3682e5[_0x8e4a('0xf')]=_0x3682e5['CloudProvider'][_0x8e4a('0x10')];return Promise['resolve'](_0x3682e5[_0x8e4a('0x11')][_0x8e4a('0x12')]);}var _0x2ee4df={'method':_0x8e4a('0x13'),'uri':_0x3762c5,'form':{'client_id':_0x3682e5['clientId'],'resource':_0x3682e5[_0x8e4a('0xd')],'username':_0x3682e5['username'],'password':_0x3682e5[_0x8e4a('0x14')],'grant_type':'password','client_secret':_0x3682e5['clientSecret']},'json':!![]};return rp(_0x2ee4df)[_0x8e4a('0x15')](function(_0x21ea10){return _0x21ea10['access_token'];})['catch'](function(_0x57d825){logger[_0x8e4a('0x16')]('['+[_0x4465bb['toUpperCase']()]+_0x8e4a('0x17'));return _0x57d825[_0x8e4a('0x18')];});}function getUser(_0x4d3681,_0xfa2d71,_0x1fdcf4,_0x2bc62d,_0x3615ca,_0x17d7d7){return new Promise(function(_0x397add,_0x2339df){return getAuthToken(_0xfa2d71,_0x2bc62d,_0x17d7d7)[_0x8e4a('0x15')](function(_0x50145b){var _0x1e0a24={'method':_0x8e4a('0x19'),'uri':_0x3615ca+_0x8e4a('0x1a'),'headers':{'Authorization':_0x8e4a('0x1b')+_0x50145b,'OData-Version':_0x8e4a('0x1c')},'json':!![]};return rp(_0x1e0a24);})[_0x8e4a('0x15')](function(_0x521bfa){var _0x2e57ba=_0x521bfa[_0x8e4a('0x1d')];var _0x27e51c=![];var _0x5ec4ae=null;if(!_[_0x8e4a('0x1e')](_0x1fdcf4)){if(intUtil[_0x8e4a('0x1f')](_0x1fdcf4[_0x8e4a('0x20')])){_0x4d3681['userEmail']=_0x1fdcf4['email'];for(_0x5ec4ae=0x0;_0x5ec4ae<_0x2e57ba[_0x8e4a('0x21')];_0x5ec4ae++){if(_0x2e57ba[_0x5ec4ae][_0x8e4a('0x22')]===_0x1fdcf4[_0x8e4a('0x20')]&&!_0x2e57ba[_0x5ec4ae][_0x8e4a('0x23')]){_0x27e51c=!![];logger[_0x8e4a('0x24')]('['+[_0x17d7d7['toUpperCase']()]+_0x8e4a('0x25')+_0x2e57ba[_0x5ec4ae][_0x8e4a('0x26')]+'!');_0x4d3681['userId']=_0x2e57ba[_0x5ec4ae]['systemuserid'];}}}}if(!_0x27e51c){logger[_0x8e4a('0x24')]('['+[_0x17d7d7['toUpperCase']()]+_0x8e4a('0x27'));_0x4d3681['userEmail']=_0xfa2d71[_0x8e4a('0x28')];for(_0x5ec4ae=0x0;_0x5ec4ae<_0x2e57ba[_0x8e4a('0x21')];_0x5ec4ae++){if(_0x2e57ba[_0x5ec4ae]['internalemailaddress']===_0xfa2d71['username']){_0x4d3681[_0x8e4a('0x29')]=_0x2e57ba[_0x5ec4ae][_0x8e4a('0x26')];}}}_0x397add(_0x4d3681);})['catch'](function(_0x353d7a){_0x2339df(_0x353d7a['message']);});});}function createEndUser(_0x557bd2,_0x200ec1,_0x2c9b8e,_0x205662,_0x49314a,_0x2fcabc,_0x1d9015){return new Promise(function(_0x172efc,_0x2797fa){return getAuthToken(_0x200ec1,_0x2c9b8e,_0x2fcabc)[_0x8e4a('0x15')](function(_0x5a6415){var _0x2d2c39=_0x2fcabc['toLowerCase']()===_0x8e4a('0x2a')?_0x49314a[_0x8e4a('0x2b')]:_0x49314a['calleridnum'];var _0x52388f={'method':'POST','uri':_0x205662+_0x8e4a('0x2c'),'body':{'fullname':_0x2d2c39,'firstname':_0x2d2c39,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8e4a('0x2d')+_0x557bd2[_0x8e4a('0x29')]+')'},'headers':{'Authorization':_0x8e4a('0x1b')+_0x5a6415,'OData-Version':_0x8e4a('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x52388f['body'][_0x1d9015]=_0x2d2c39;return rp(_0x52388f);})[_0x8e4a('0x15')](function(_0x1f38ff){var _0x1d45c6=_0x1f38ff[_0x8e4a('0x2e')][_0x8e4a('0x2f')];var _0x5759f5=_0x1d45c6['substring'](_0x1d45c6[_0x8e4a('0x30')]('(')+0x1,_0x1d45c6[_0x8e4a('0x30')](')'));_0x557bd2[_0x8e4a('0x31')]=_0x5759f5;_0x172efc(_0x557bd2);})[_0x8e4a('0x32')](function(_0x4f2580){_0x2797fa(_0x4f2580[_0x8e4a('0x18')]);});});}function getEndUser(_0x8100d4,_0x161c30,_0x387d3d,_0x28d344,_0x34e8e3,_0x2eaa42,_0x5e94fb,_0x186322){var _0x1c6a69=_0x2eaa42[_0x8e4a('0x33')]()==='outbound'?_0x34e8e3[_0x8e4a('0x2b')]:_0x34e8e3['calleridnum'];return getAuthToken(_0x161c30,_0x387d3d,_0x2eaa42)[_0x8e4a('0x15')](function(_0x2117dd){_0x186322=_0x186322?_0x186322:_0x8e4a('0x34');var _0x1e0199={'method':'GET','uri':_0x28d344+_0x8e4a('0x35')+_0x186322+_0x8e4a('0x36')+_0x186322+_0x8e4a('0x37')+_0x1c6a69[_0x8e4a('0x38')]('+',_0x8e4a('0x39'))+'\x27','headers':{'Authorization':_0x8e4a('0x1b')+_0x2117dd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e0199);})[_0x8e4a('0x15')](function(_0xeb953a){var _0x2d0139=![];if(!_0xeb953a)return _0x2d0139;var _0x2b9520=_0xeb953a[_0x8e4a('0x1d')];for(var _0x581115=0x0;_0x581115<_0x2b9520[_0x8e4a('0x21')];_0x581115++){if(_0x2b9520[_0x581115][_0x186322]===_0x1c6a69){_0x2d0139=!![];_0x8100d4['enduserId']=_0x2b9520[_0x581115][_0x8e4a('0x3a')];}}return _0x2d0139;})[_0x8e4a('0x15')](function(_0x198f24){if(_0x198f24)return _0x8100d4;if(_0x5e94fb===_0x8e4a('0x3b')){logger[_0x8e4a('0x24')]('['+[_0x2eaa42[_0x8e4a('0x3c')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x8100d4;}return createEndUser(_0x8100d4,_0x161c30,_0x387d3d,_0x28d344,_0x34e8e3,_0x2eaa42,_0x186322)[_0x8e4a('0x15')](function(_0x400df4){logger[_0x8e4a('0x24')]('['+[_0x2eaa42['toUpperCase']()]+_0x8e4a('0x3d'),_0x400df4['enduserId']);return _0x400df4;});});}function getCustomFields(_0x3677e0,_0x3c0460,_0xea8c85){var _0x77487e={};if(_0x3677e0['length']>0x0){_[_0x8e4a('0x3e')](_0x3677e0,function(_0x1cffd4){if(_[_0x8e4a('0x3f')]([_0x8e4a('0x40'),_0x8e4a('0x41')],_0x1cffd4[_0x8e4a('0x42')])&&_0x1cffd4[_0x8e4a('0x43')]&&!_0x1cffd4[_0x8e4a('0x44')]){var _0xd0ed4f=_0x1cffd4[_0x8e4a('0x45')][_0x8e4a('0x33')]();var _0x14c902=_0xd0ed4f[_0x8e4a('0x46')](0x0,_0xd0ed4f[_0x8e4a('0x47')]('_'));var _0x21fc6=_0xd0ed4f[_0x8e4a('0x46')](_0xd0ed4f[_0x8e4a('0x47')]('_')+0x1);if(_0x14c902===_0xea8c85){_0x77487e[_0x21fc6]=_0x1cffd4['content'];}}});}return _0x77487e;}function getTicket(_0x221fd8,_0x5b44ed,_0x5f520d,_0x54cd78,_0x448981,_0x339536,_0x4c89d9){return new Promise(function(_0x49a2e6,_0x12984d){var _0x1f8098;return getAuthToken(_0x5b44ed,_0x5f520d,_0x4c89d9)[_0x8e4a('0x15')](function(_0x4d21b4){if(_0x339536['ticketType']===_0x8e4a('0x48')){_0x1f8098={'method':_0x8e4a('0x13'),'uri':_0x54cd78+'incidents','body':Object[_0x8e4a('0x49')]({},{'title':intUtil[_0x8e4a('0x4a')](_0x339536['Subjects'],_0x448981,'\x20'),'description':intUtil[_0x8e4a('0x4a')](_0x339536[_0x8e4a('0x4b')],_0x448981,'\x0a'),'customerid_contact@odata.bind':_0x221fd8['enduserId']?'/contacts('+_0x221fd8['enduserId']+')':undefined,'ownerid@odata.bind':_0x8e4a('0x2d')+_0x221fd8[_0x8e4a('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x339536[_0x8e4a('0x4c')],_0x448981,_0x339536['ticketType'])),'headers':{'Authorization':_0x8e4a('0x1b')+_0x4d21b4,'OData-Version':_0x8e4a('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x339536[_0x8e4a('0x4d')]===_0x8e4a('0x4e')){var _0x2190fb=_0x221fd8[_0x8e4a('0x31')]?[{'partyid_systemuser@odata.bind':_0x8e4a('0x2d')+_0x221fd8[_0x8e4a('0x29')]+')','participationtypemask':_0x221fd8[_0x8e4a('0x4f')]===_0x8e4a('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0x8e4a('0x51')+_0x221fd8[_0x8e4a('0x31')]+')','participationtypemask':_0x221fd8[_0x8e4a('0x4f')]===_0x8e4a('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x8e4a('0x2d')+_0x221fd8[_0x8e4a('0x29')]+')','participationtypemask':_0x221fd8[_0x8e4a('0x4f')]===_0x8e4a('0x50')?0x2:0x1}];_0x1f8098={'method':_0x8e4a('0x13'),'uri':_0x54cd78+_0x8e4a('0x52'),'body':Object[_0x8e4a('0x49')]({},{'subject':intUtil[_0x8e4a('0x4a')](_0x339536[_0x8e4a('0x53')],_0x448981,'\x20'),'phonenumber':String(_0x448981[_0x8e4a('0x54')]),'description':intUtil[_0x8e4a('0x4a')](_0x339536[_0x8e4a('0x4b')],_0x448981,'\x0a'),'regardingobjectid_contact@odata.bind':_0x221fd8['enduserId']?_0x8e4a('0x51')+_0x221fd8['enduserId']+')':undefined,'ownerid@odata.bind':_0x8e4a('0x2d')+_0x221fd8['userId']+')','directioncode':_0x221fd8['callDirection']===_0x8e4a('0x50')?![]:!![],'phonecall_activity_parties':_0x2190fb},getCustomFields(_0x339536['Fields'],_0x448981,_0x339536[_0x8e4a('0x4d')])),'headers':{'Authorization':_0x8e4a('0x1b')+_0x4d21b4,'OData-Version':_0x8e4a('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1f8098);})['then'](function(_0x36e994){var _0x2d544d=_0x36e994[_0x8e4a('0x2e')][_0x8e4a('0x2f')];var _0xd6213a=_0x2d544d[_0x8e4a('0x46')](_0x2d544d[_0x8e4a('0x30')]('(')+0x1,_0x2d544d[_0x8e4a('0x30')](')'));_0x221fd8[_0x8e4a('0x55')]=_0xd6213a;_0x49a2e6(_0x221fd8);})[_0x8e4a('0x32')](function(_0x3e87da){_0x12984d(_0x3e87da[_0x8e4a('0x18')]);});});}function emit(_0x5a25f7,_0x12bc29,_0x336f65,_0x453a89){var _0x2fdfaa={'uri':util[_0x8e4a('0x56')](_0x8e4a('0x57'),_0x5a25f7,_0x336f65,_0x453a89)};io['to'](util['format'](_0x8e4a('0x58'),_0x12bc29))['emit'](_0x8e4a('0x59'),_0x2fdfaa);}exports['cs']=function(_0x15581c,_0x1df5b8,_0x887c73,_0x44613f,_0xf904a9,_0x180454,_0x582b08,_0x2364d9){var _0x43bd90={};_0x180454[_0x8e4a('0xd')]=_0x180454[_0x8e4a('0xc')]?intUtil[_0x8e4a('0x5a')](_0x180454[_0x8e4a('0x11')][_0x8e4a('0xe')]):intUtil[_0x8e4a('0x5a')](_0x180454[_0x8e4a('0xd')]);_0x180454['serverUrl']=intUtil[_0x8e4a('0x5a')](_0x180454['serverUrl']);_0x43bd90[_0x8e4a('0x4f')]=_0x2364d9===_0x8e4a('0x50')||_0x2364d9==='unmanaged'?_0x8e4a('0x50'):'outbound';var _0x23608b=_0x180454[_0x8e4a('0xc')]?util[_0x8e4a('0x56')](_0x8e4a('0x5b'),_0x180454[_0x8e4a('0x11')][_0x8e4a('0xe')]):util[_0x8e4a('0x56')](_0x8e4a('0x5b'),_0x180454[_0x8e4a('0xd')]);var _0x2a51dc=util[_0x8e4a('0x56')](_0x8e4a('0x5c'),_0x180454['tenantId']);var _0x2bae16=util[_0x8e4a('0x56')](_0x8e4a('0x5d'),_0x180454[_0x8e4a('0x5e')],_0x1df5b8[_0x8e4a('0x5f')],md5(_0x1df5b8[_0x8e4a('0x5f')]));if(_0xf904a9&&_0xf904a9[_0x8e4a('0x60')]){logger[_0x8e4a('0x24')](_0x8e4a('0x61'),_0x8e4a('0x62'));_0x1df5b8[_0x8e4a('0x63')]=_0x2bae16;}else if(_0x582b08&&_0x582b08[_0x8e4a('0x64')]&&_0x582b08[_0x8e4a('0x64')]!==_0x8e4a('0x65')){logger['info'](_0x8e4a('0x66'),'Recording\x20is\x20enabled!');_0x1df5b8[_0x8e4a('0x63')]=_0x2bae16;}else{_0x1df5b8[_0x8e4a('0x63')]='';}return getUser(_0x43bd90,_0x180454,_0x44613f,_0x2a51dc,_0x23608b,_0x2364d9)['then'](function(_0x44b705){logger[_0x8e4a('0x24')]('['+_0x2364d9[_0x8e4a('0x3c')]()+_0x8e4a('0x67'),_0x44b705['userId']);logger[_0x8e4a('0x24')]('['+_0x2364d9[_0x8e4a('0x3c')]()+_0x8e4a('0x68'),_0x44b705[_0x8e4a('0x69')]);return getEndUser(_0x44b705,_0x180454,_0x2a51dc,_0x23608b,_0x1df5b8,_0x2364d9,_0x887c73[_0x8e4a('0x6a')],_0x887c73[_0x8e4a('0x6b')]);})[_0x8e4a('0x15')](function(_0x58ace4){logger[_0x8e4a('0x24')]('['+_0x2364d9[_0x8e4a('0x3c')]()+_0x8e4a('0x6c'),_0x58ace4[_0x8e4a('0x31')]);logger[_0x8e4a('0x24')]('['+_0x2364d9[_0x8e4a('0x3c')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1df5b8['calleridnum']);return getTicket(_0x58ace4,_0x180454,_0x2a51dc,_0x23608b,_0x1df5b8,_0x887c73,_0x2364d9);})[_0x8e4a('0x15')](function(_0x1fefc1){logger['info'](util[_0x8e4a('0x56')]('['+_0x2364d9[_0x8e4a('0x3c')]()+_0x8e4a('0x6d'),_0x887c73[_0x8e4a('0x4d')],_0x1fefc1[_0x8e4a('0x55')]));logger[_0x8e4a('0x24')](util[_0x8e4a('0x56')]('['+_0x2364d9['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x2364d9));if(_0x2364d9!=='unmanaged'&&_0x887c73[_0x8e4a('0x6e')]){logger[_0x8e4a('0x24')]('['+_0x2364d9[_0x8e4a('0x3c')]()+']',_0x8e4a('0x6f'));emit(_0x180454[_0x8e4a('0xd')],_0x44613f[_0x8e4a('0x70')],_0x887c73[_0x8e4a('0x4d')],_0x1fefc1[_0x8e4a('0x55')]);}})[_0x8e4a('0x32')](function(_0x238db4){logger[_0x8e4a('0x16')]('['+_0x2364d9[_0x8e4a('0x3c')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x238db4[_0x8e4a('0x18')]);console[_0x8e4a('0x16')](_0x8e4a('0x71'),_0x238db4);});}; \ No newline at end of file +var _0xcb3f=['\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','nameField','customField','indexOf','ticketType','incidents','assign','getString','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','Subjects','Descriptions','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','data5','POST','clientId','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','userEmail','email','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','username','length','catch','message','destcalleridnum','calleridnum','contacts','4.0','body','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','outbound','contacts?$select=','&$filter='];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xcb3f,0x9f));var _0xfcb3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcb3f[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var rp=require(_0xfcb3('0x0'));var util=require(_0xfcb3('0x1'));var intUtil=require(_0xfcb3('0x2'));var md5=require(_0xfcb3('0x3'));var Redis=require(_0xfcb3('0x4'));var logger=require(_0xfcb3('0x5'))(_0xfcb3('0x6'));var config=require(_0xfcb3('0x7'));config[_0xfcb3('0x8')]=_[_0xfcb3('0x9')](config[_0xfcb3('0x8')],{'host':_0xfcb3('0xa'),'port':0x18eb});var io=require(_0xfcb3('0xb'))(new Redis(config[_0xfcb3('0x8')]));function getAuthToken(_0x1709f1,_0x586a2e,_0x4eb898){if(_0x1709f1[_0xfcb3('0xc')]){_0x1709f1[_0xfcb3('0xd')]=_0x1709f1[_0xfcb3('0xe')][_0xfcb3('0xf')];_0x1709f1[_0xfcb3('0x10')]=_0x1709f1[_0xfcb3('0xe')][_0xfcb3('0x11')];return Promise['resolve'](_0x1709f1[_0xfcb3('0xe')][_0xfcb3('0x12')]);}var _0x40bb3b={'method':_0xfcb3('0x13'),'uri':_0x586a2e,'form':{'client_id':_0x1709f1[_0xfcb3('0x14')],'resource':_0x1709f1[_0xfcb3('0xd')],'username':_0x1709f1['username'],'password':_0x1709f1['password'],'grant_type':_0xfcb3('0x15'),'client_secret':_0x1709f1[_0xfcb3('0x16')]},'json':!![]};return rp(_0x40bb3b)[_0xfcb3('0x17')](function(_0xed740){return _0xed740[_0xfcb3('0x18')];})['catch'](function(_0x2ba786){logger[_0xfcb3('0x19')]('['+[_0x4eb898['toUpperCase']()]+_0xfcb3('0x1a'));return _0x2ba786['message'];});}function getUser(_0x3de37f,_0x2daf5f,_0x509935,_0x4f6f0b,_0x120345,_0x1b4a0d){return new Promise(function(_0x3314d5,_0x2b15c2){return getAuthToken(_0x2daf5f,_0x4f6f0b,_0x1b4a0d)[_0xfcb3('0x17')](function(_0x4b4b75){var _0x5c3d72={'method':_0xfcb3('0x1b'),'uri':_0x120345+_0xfcb3('0x1c'),'headers':{'Authorization':_0xfcb3('0x1d')+_0x4b4b75,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c3d72);})['then'](function(_0x1b44f1){var _0x14cad5=_0x1b44f1[_0xfcb3('0x1e')];var _0x4aead4=![];var _0x443214=null;if(!_[_0xfcb3('0x1f')](_0x509935)){if(intUtil['validateEmail'](_0x509935['email'])){_0x3de37f[_0xfcb3('0x20')]=_0x509935[_0xfcb3('0x21')];for(_0x443214=0x0;_0x443214<_0x14cad5['length'];_0x443214++){if(_0x14cad5[_0x443214][_0xfcb3('0x22')]===_0x509935['email']&&!_0x14cad5[_0x443214]['isdisabled']){_0x4aead4=!![];logger[_0xfcb3('0x23')]('['+[_0x1b4a0d[_0xfcb3('0x24')]()]+_0xfcb3('0x25')+_0x14cad5[_0x443214][_0xfcb3('0x26')]+'!');_0x3de37f[_0xfcb3('0x27')]=_0x14cad5[_0x443214][_0xfcb3('0x26')];}}}}if(!_0x4aead4){logger[_0xfcb3('0x23')]('['+[_0x1b4a0d['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3de37f[_0xfcb3('0x20')]=_0x2daf5f[_0xfcb3('0x28')];for(_0x443214=0x0;_0x443214<_0x14cad5[_0xfcb3('0x29')];_0x443214++){if(_0x14cad5[_0x443214][_0xfcb3('0x22')]===_0x2daf5f[_0xfcb3('0x28')]){_0x3de37f[_0xfcb3('0x27')]=_0x14cad5[_0x443214][_0xfcb3('0x26')];}}}_0x3314d5(_0x3de37f);})[_0xfcb3('0x2a')](function(_0x31bc62){_0x2b15c2(_0x31bc62[_0xfcb3('0x2b')]);});});}function createEndUser(_0x3a49e8,_0x2a3ecf,_0x2ba749,_0x17fcea,_0x3e7717,_0x55d8b8,_0x5d9125){return new Promise(function(_0x865ffe,_0x28124c){return getAuthToken(_0x2a3ecf,_0x2ba749,_0x55d8b8)['then'](function(_0x235aad){var _0xa83900=_0x55d8b8['toLowerCase']()==='outbound'?_0x3e7717[_0xfcb3('0x2c')]:_0x3e7717[_0xfcb3('0x2d')];var _0x38e59b={'method':'POST','uri':_0x17fcea+_0xfcb3('0x2e'),'body':{'fullname':_0xa83900,'firstname':_0xa83900,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3a49e8['userId']+')'},'headers':{'Authorization':_0xfcb3('0x1d')+_0x235aad,'OData-Version':_0xfcb3('0x2f')},'json':!![],'resolveWithFullResponse':!![]};_0x38e59b[_0xfcb3('0x30')][_0x5d9125]=_0xa83900;return rp(_0x38e59b);})[_0xfcb3('0x17')](function(_0x56c029){var _0xc06789=_0x56c029['headers'][_0xfcb3('0x31')];var _0x421eb7=_0xc06789[_0xfcb3('0x32')](_0xc06789[_0xfcb3('0x33')]('(')+0x1,_0xc06789[_0xfcb3('0x33')](')'));_0x3a49e8[_0xfcb3('0x34')]=_0x421eb7;_0x865ffe(_0x3a49e8);})[_0xfcb3('0x2a')](function(_0x21d431){_0x28124c(_0x21d431[_0xfcb3('0x2b')]);});});}function getEndUser(_0x5bba2a,_0x3d4e2b,_0x3f83de,_0x32b4f5,_0x250830,_0x161ca6,_0x5d1e7d,_0x53b483){var _0x1d337f=_0x161ca6[_0xfcb3('0x35')]()===_0xfcb3('0x36')?_0x250830[_0xfcb3('0x2c')]:_0x250830[_0xfcb3('0x2d')];return getAuthToken(_0x3d4e2b,_0x3f83de,_0x161ca6)[_0xfcb3('0x17')](function(_0x4349f0){_0x53b483=_0x53b483?_0x53b483:'telephone1';var _0x29127f={'method':_0xfcb3('0x1b'),'uri':_0x32b4f5+_0xfcb3('0x37')+_0x53b483+_0xfcb3('0x38')+_0x53b483+_0xfcb3('0x39')+_0x1d337f[_0xfcb3('0x3a')]('+',_0xfcb3('0x3b'))+'\x27','headers':{'Authorization':_0xfcb3('0x1d')+_0x4349f0,'If-None-Match':null,'OData-Version':_0xfcb3('0x2f')},'json':!![]};return rp(_0x29127f);})['then'](function(_0x2f4f21){var _0x1c5486=![];if(!_0x2f4f21)return _0x1c5486;var _0x3554c5=_0x2f4f21['value'];for(var _0x3807f8=0x0;_0x3807f8<_0x3554c5[_0xfcb3('0x29')];_0x3807f8++){if(_0x3554c5[_0x3807f8][_0x53b483]===_0x1d337f){_0x1c5486=!![];_0x5bba2a[_0xfcb3('0x34')]=_0x3554c5[_0x3807f8]['contactid'];}}return _0x1c5486;})[_0xfcb3('0x17')](function(_0xae600d){if(_0xae600d)return _0x5bba2a;if(_0x5d1e7d===_0xfcb3('0x3c')){logger[_0xfcb3('0x23')]('['+[_0x161ca6[_0xfcb3('0x24')]()]+_0xfcb3('0x3d'));return _0x5bba2a;}return createEndUser(_0x5bba2a,_0x3d4e2b,_0x3f83de,_0x32b4f5,_0x250830,_0x161ca6,_0x53b483)['then'](function(_0x3eab83){logger[_0xfcb3('0x23')]('['+[_0x161ca6[_0xfcb3('0x24')]()]+']\x20Enduser\x20created!',_0x3eab83[_0xfcb3('0x34')]);return _0x3eab83;});});}function getCustomFields(_0x1fb971,_0x593658,_0x55a772){var _0x34e9a3={};if(_0x1fb971[_0xfcb3('0x29')]>0x0){_[_0xfcb3('0x3e')](_0x1fb971,function(_0x2daf04){if(_[_0xfcb3('0x3f')]([_0xfcb3('0x40'),_0xfcb3('0x41')],_0x2daf04[_0xfcb3('0x42')])&&_0x2daf04[_0xfcb3('0x43')]&&!_0x2daf04[_0xfcb3('0x44')]){var _0x490462=_0x2daf04['idField'][_0xfcb3('0x35')]();var _0x273456=_0x490462[_0xfcb3('0x32')](0x0,_0x490462[_0xfcb3('0x45')]('_'));var _0x168ee2=_0x490462[_0xfcb3('0x32')](_0x490462['indexOf']('_')+0x1);if(_0x273456===_0x55a772){_0x34e9a3[_0x168ee2]=_0x2daf04['content'];}}});}return _0x34e9a3;}function getTicket(_0xa0909f,_0xc0893e,_0x4319fa,_0x6c5a9e,_0x1b2b96,_0x22c6d4,_0x759b65){return new Promise(function(_0x284984,_0x19f78f){var _0x138c7e;return getAuthToken(_0xc0893e,_0x4319fa,_0x759b65)[_0xfcb3('0x17')](function(_0x102868){if(_0x22c6d4[_0xfcb3('0x46')]==='incident'){_0x138c7e={'method':_0xfcb3('0x13'),'uri':_0x6c5a9e+_0xfcb3('0x47'),'body':Object[_0xfcb3('0x48')]({},{'title':intUtil[_0xfcb3('0x49')](_0x22c6d4['Subjects'],_0x1b2b96,'\x20'),'description':intUtil[_0xfcb3('0x49')](_0x22c6d4['Descriptions'],_0x1b2b96,'\x0a'),'customerid_contact@odata.bind':_0xa0909f['enduserId']?_0xfcb3('0x4a')+_0xa0909f[_0xfcb3('0x34')]+')':undefined,'ownerid@odata.bind':_0xfcb3('0x4b')+_0xa0909f[_0xfcb3('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x22c6d4[_0xfcb3('0x4c')],_0x1b2b96,_0x22c6d4[_0xfcb3('0x46')])),'headers':{'Authorization':_0xfcb3('0x1d')+_0x102868,'OData-Version':_0xfcb3('0x2f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x22c6d4[_0xfcb3('0x46')]===_0xfcb3('0x4d')){var _0x37450e=_0xa0909f[_0xfcb3('0x34')]?[{'partyid_systemuser@odata.bind':_0xfcb3('0x4b')+_0xa0909f[_0xfcb3('0x27')]+')','participationtypemask':_0xa0909f[_0xfcb3('0x4e')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xfcb3('0x4a')+_0xa0909f[_0xfcb3('0x34')]+')','participationtypemask':_0xa0909f[_0xfcb3('0x4e')]===_0xfcb3('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xfcb3('0x4b')+_0xa0909f[_0xfcb3('0x27')]+')','participationtypemask':_0xa0909f[_0xfcb3('0x4e')]==='queue'?0x2:0x1}];_0x138c7e={'method':_0xfcb3('0x13'),'uri':_0x6c5a9e+_0xfcb3('0x50'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x22c6d4[_0xfcb3('0x51')],_0x1b2b96,'\x20'),'phonenumber':String(_0x1b2b96[_0xfcb3('0x2d')]),'description':intUtil['getString'](_0x22c6d4[_0xfcb3('0x52')],_0x1b2b96,'\x0a'),'regardingobjectid_contact@odata.bind':_0xa0909f[_0xfcb3('0x34')]?'/contacts('+_0xa0909f[_0xfcb3('0x34')]+')':undefined,'ownerid@odata.bind':_0xfcb3('0x4b')+_0xa0909f['userId']+')','directioncode':_0xa0909f['callDirection']===_0xfcb3('0x4f')?![]:!![],'phonecall_activity_parties':_0x37450e},getCustomFields(_0x22c6d4[_0xfcb3('0x4c')],_0x1b2b96,_0x22c6d4[_0xfcb3('0x46')])),'headers':{'Authorization':_0xfcb3('0x1d')+_0x102868,'OData-Version':_0xfcb3('0x2f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x138c7e);})[_0xfcb3('0x17')](function(_0xf25dfb){var _0x36e0fe=_0xf25dfb['headers'][_0xfcb3('0x31')];var _0x558263=_0x36e0fe[_0xfcb3('0x32')](_0x36e0fe['lastIndexOf']('(')+0x1,_0x36e0fe[_0xfcb3('0x33')](')'));_0xa0909f['ticketId']=_0x558263;_0x284984(_0xa0909f);})['catch'](function(_0x437a1d){_0x19f78f(_0x437a1d[_0xfcb3('0x2b')]);});});}function emit(_0xeeb49e,_0x39b8eb,_0x587ddd,_0x1a0b89){var _0x4e0f43={'uri':util[_0xfcb3('0x53')](_0xfcb3('0x54'),_0xeeb49e,_0x587ddd,_0x1a0b89)};io['to'](util['format']('user:%s',_0x39b8eb))[_0xfcb3('0x55')](_0xfcb3('0x56'),_0x4e0f43);}exports['cs']=function(_0x1b952d,_0x52fbe0,_0x4cba34,_0x4c0477,_0x31b9a7,_0x25586b,_0x5d6b1b,_0x357afa){var _0x5e445c={};_0x25586b['remoteUri']=_0x25586b[_0xfcb3('0xc')]?intUtil[_0xfcb3('0x57')](_0x25586b[_0xfcb3('0xe')]['data7']):intUtil[_0xfcb3('0x57')](_0x25586b[_0xfcb3('0xd')]);_0x25586b[_0xfcb3('0x58')]=intUtil[_0xfcb3('0x57')](_0x25586b[_0xfcb3('0x58')]);_0x5e445c[_0xfcb3('0x4e')]=_0x357afa===_0xfcb3('0x4f')||_0x357afa===_0xfcb3('0x59')?_0xfcb3('0x4f'):_0xfcb3('0x36');var _0x54aa94=_0x25586b[_0xfcb3('0xc')]?util[_0xfcb3('0x53')](_0xfcb3('0x5a'),_0x25586b[_0xfcb3('0xe')]['data7']):util[_0xfcb3('0x53')](_0xfcb3('0x5a'),_0x25586b['remoteUri']);var _0x110d22=util[_0xfcb3('0x53')]('https://login.microsoftonline.com/%s/oauth2/token',_0x25586b[_0xfcb3('0x10')]);var _0x541e51=util[_0xfcb3('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25586b[_0xfcb3('0x58')],_0x52fbe0[_0xfcb3('0x5b')],md5(_0x52fbe0[_0xfcb3('0x5b')]));if(_0x31b9a7&&_0x31b9a7['monitor_format']){logger[_0xfcb3('0x23')]('[QUEUE]','Recording\x20is\x20enabled!');_0x52fbe0['recordingURL']=_0x541e51;}else if(_0x5d6b1b&&_0x5d6b1b[_0xfcb3('0x5c')]&&_0x5d6b1b[_0xfcb3('0x5c')]!=='none'){logger[_0xfcb3('0x23')](_0xfcb3('0x5d'),_0xfcb3('0x5e'));_0x52fbe0[_0xfcb3('0x5f')]=_0x541e51;}else{_0x52fbe0['recordingURL']='';}return getUser(_0x5e445c,_0x25586b,_0x4c0477,_0x110d22,_0x54aa94,_0x357afa)[_0xfcb3('0x17')](function(_0x7c3425){logger[_0xfcb3('0x23')]('['+_0x357afa['toUpperCase']()+_0xfcb3('0x60'),_0x7c3425['userId']);logger[_0xfcb3('0x23')]('['+_0x357afa['toUpperCase']()+_0xfcb3('0x61'),_0x7c3425['userEmail']);return getEndUser(_0x7c3425,_0x25586b,_0x110d22,_0x54aa94,_0x52fbe0,_0x357afa,_0x4cba34['moduleCreate'],_0x4cba34[_0xfcb3('0x62')]);})[_0xfcb3('0x17')](function(_0x422943){logger[_0xfcb3('0x23')]('['+_0x357afa[_0xfcb3('0x24')]()+_0xfcb3('0x63'),_0x422943[_0xfcb3('0x34')]);logger['info']('['+_0x357afa[_0xfcb3('0x24')]()+_0xfcb3('0x64'),_0x52fbe0[_0xfcb3('0x2d')]);return getTicket(_0x422943,_0x25586b,_0x110d22,_0x54aa94,_0x52fbe0,_0x4cba34,_0x357afa);})[_0xfcb3('0x17')](function(_0x28384b){logger['info'](util['format']('['+_0x357afa[_0xfcb3('0x24')]()+_0xfcb3('0x65'),_0x4cba34[_0xfcb3('0x46')],_0x28384b[_0xfcb3('0x66')]));logger['info'](util[_0xfcb3('0x53')]('['+_0x357afa[_0xfcb3('0x24')]()+_0xfcb3('0x67'),_0x357afa));if(_0x357afa!==_0xfcb3('0x59')&&_0x4cba34[_0xfcb3('0x68')]){logger['info']('['+_0x357afa['toUpperCase']()+']',_0xfcb3('0x69'));emit(_0x25586b[_0xfcb3('0xd')],_0x4c0477[_0xfcb3('0x6a')],_0x4cba34[_0xfcb3('0x46')],_0x28384b[_0xfcb3('0x66')]);}})[_0xfcb3('0x2a')](function(_0x37d3b9){logger[_0xfcb3('0x19')]('['+_0x357afa['toUpperCase']()+_0xfcb3('0x6b'),_0x37d3b9[_0xfcb3('0x2b')]);console[_0xfcb3('0x19')]('Error\x20running\x20Dynamics365\x20integration',_0x37d3b9);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 22ca5d8..c4c4e73 100644 --- a/server/services/ami/trigger/integration/freshdesk.js +++ b/server/services/ami/trigger/integration/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb393=['Authorization','calleridname','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','stringify','lastevent','toUpperCase','calleridnum','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Subjects','
','name','Fields','custom_fields','keyBy','remoteUri','POST','then','Ticket\x20created!','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','string','idField','content','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x4adb7f,_0x3634fa){var _0x238df9=function(_0x14f6a8){while(--_0x14f6a8){_0x4adb7f['push'](_0x4adb7f['shift']());}};_0x238df9(++_0x3634fa);}(_0xb393,0xcc));var _0x3b39=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb393[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b39('0x0'));var rp=require(_0x3b39('0x1'));var md5=require(_0x3b39('0x2'));var util=require(_0x3b39('0x3'));var Redis=require('ioredis');var intUtil=require(_0x3b39('0x4'));var config=require(_0x3b39('0x5'));var logger=require(_0x3b39('0x6'))(_0x3b39('0x7'));config[_0x3b39('0x8')]=_['defaults'](config[_0x3b39('0x8')],{'host':_0x3b39('0x9'),'port':0x18eb});var io=require(_0x3b39('0xa'))(new Redis(config[_0x3b39('0x8')]));var headers={'Content-Type':_0x3b39('0xb'),'Accept':_0x3b39('0xb')};function emit(_0xd05dc5,_0x57e3ba,_0xa197c1){io['to'](_0xd05dc5)[_0x3b39('0xc')](_0x57e3ba,_0xa197c1);}function getTicket(_0x4c3340,_0x113cd2,_0x4054c7,_0x4305b2,_0x1ba5e1){logger[_0x3b39('0xd')](_0x3b39('0xe'));var _0x1e8b21=_[_0x3b39('0xf')]({'responder_id':_0x113cd2['id'],'requester_id':_0x4054c7['id'],'name':util[_0x3b39('0x10')](_0x3b39('0x11'),_0x1ba5e1['calleridname']),'phone':_0x1ba5e1['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x3b39('0x12')](_0x4305b2[_0x3b39('0x13')],_0x1ba5e1,'\x20'),'description':intUtil[_0x3b39('0x12')](_0x4305b2['Descriptions'],_0x1ba5e1,_0x3b39('0x14')),'tags':getTags(_0x4305b2['Tags'],_0x3b39('0x15'))},getCustomFields(_0x4305b2[_0x3b39('0x16')],_0x1ba5e1));_0x1e8b21[_0x3b39('0x17')]=_['mapValues'](_[_0x3b39('0x18')](_0x1e8b21[_0x3b39('0x17')],'id'),'value');return request({'uri':util[_0x3b39('0x10')]('%s/api/v2/tickets',_0x4c3340[_0x3b39('0x19')]),'method':_0x3b39('0x1a'),'body':_0x1e8b21})[_0x3b39('0x1b')](function(_0x359dbb){logger[_0x3b39('0xd')](_0x3b39('0x1c'));return _0x359dbb;});}function getUser(_0x248ea5,_0x5c0de7){if(intUtil['validateEmail'](_0x5c0de7)){return request({'uri':util['format']('%s/api/v2/agents',_0x248ea5[_0x3b39('0x19')]),'qs':{'email':_0x5c0de7}})[_0x3b39('0x1b')](function(_0x3dc5bd){if(_0x3dc5bd[_0x3b39('0x1d')]){logger[_0x3b39('0xd')](_0x3b39('0x1e'));return _[_0x3b39('0x1f')](_0x3dc5bd,function(_0x15afa1){return _0x15afa1['contact'][_0x3b39('0x20')]===_0x5c0de7;});}else{logger[_0x3b39('0xd')](_0x3b39('0x21'));return request({'uri':util[_0x3b39('0x10')](_0x3b39('0x22'),_0x248ea5[_0x3b39('0x19')])})[_0x3b39('0x1b')](function(_0x49d756){logger[_0x3b39('0xd')](_0x3b39('0x23'));return _0x49d756;});}});}else{logger['info'](_0x3b39('0x24'));return request({'uri':util['format'](_0x3b39('0x22'),_0x248ea5['remoteUri'])})[_0x3b39('0x1b')](function(_0x9d274a){logger['info'](_0x3b39('0x23'));return _0x9d274a;});}}function getEndUser(_0x3b6089,_0x539e0c,_0x1ed6a6){logger[_0x3b39('0xd')]('Searching\x20enduser\x20with\x20phone',_0x1ed6a6);return request({'uri':util[_0x3b39('0x10')](_0x3b39('0x25'),_0x3b6089['remoteUri']),'qs':{'phone':_0x1ed6a6}})['then'](function(_0x403e80){if(_0x403e80[_0x3b39('0x1d')]){logger[_0x3b39('0xd')]('Enduser\x20found!');return _[_0x3b39('0x1f')](_0x403e80,{'phone':_0x1ed6a6});}else{logger['info'](_0x3b39('0x26'));return request({'uri':util[_0x3b39('0x10')](_0x3b39('0x25'),_0x3b6089['remoteUri']),'method':'POST','body':{'name':_0x539e0c,'phone':_0x1ed6a6}})[_0x3b39('0x1b')](function(_0x1da36e){logger['info'](_0x3b39('0x27'));return _0x1da36e;});}});}function getAuth(_0x5a9019){return util[_0x3b39('0x10')]('Basic\x20%s',new Buffer(_0x5a9019[_0x3b39('0x28')]+':X')[_0x3b39('0x29')](_0x3b39('0x2a')));}function request(_0x3768e2){logger[_0x3b39('0x2b')]('[HTTP]',JSON['stringify'](_0x3768e2));return rp(_['defaults'](_0x3768e2,{'method':_0x3b39('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x4b52a7,_0x1b090f){var _0x59022d=[];if(_0x4b52a7&&_0x4b52a7['length']>0x0){_0x59022d=_[_0x3b39('0x2d')](_0x4b52a7,_0x1b090f);}return _0x59022d;}function getCustomFields(_0x5bb3f0,_0x1f8ed6){var _0x2cbbb2=[];var _0x435124={'custom_fields':[]};if(_0x5bb3f0['length']>0x0){_[_0x3b39('0x2e')](_0x5bb3f0,function(_0x44298c){if(_[_0x3b39('0x2f')](['string',_0x3b39('0x30')],_0x44298c[_0x3b39('0x31')])&&_0x44298c[_0x3b39('0x32')]&&!_0x44298c[_0x3b39('0x33')]){_0x435124[_0x44298c[_0x3b39('0x32')][_0x3b39('0x34')]()]=_0x44298c['content'][_0x3b39('0x29')]();}else if(_[_0x3b39('0x2f')]([_0x3b39('0x35'),_0x3b39('0x30')],_0x44298c[_0x3b39('0x31')])&&_0x44298c[_0x3b39('0x36')]&&_0x44298c[_0x3b39('0x33')]){_0x435124[_0x3b39('0x17')]['push']({'id':_0x44298c['idField'],'value':_0x44298c[_0x3b39('0x37')]['toString']()});}else if(_0x44298c['type']===_0x3b39('0x38')&&_0x44298c['variableName']&&_0x44298c[_0x3b39('0x36')]&&_0x44298c[_0x3b39('0x33')]){_0x1f8ed6[_0x44298c[_0x3b39('0x39')]]&&_0x435124[_0x3b39('0x17')][_0x3b39('0x3a')]({'id':_0x44298c[_0x3b39('0x36')],'value':_0x1f8ed6[_0x44298c[_0x3b39('0x39')]][_0x3b39('0x29')]()});}else if(_0x44298c[_0x3b39('0x31')]===_0x3b39('0x3b')&&_0x44298c[_0x3b39('0x3c')]&&_0x44298c[_0x3b39('0x3c')][_0x3b39('0x15')]&&_0x44298c['idField']&&_0x44298c[_0x3b39('0x33')]){_0x1f8ed6[_0x44298c['Variable'][_0x3b39('0x15')]['toLowerCase']()]&&_0x435124[_0x3b39('0x17')]['push']({'id':_0x44298c[_0x3b39('0x36')],'value':_0x1f8ed6[_0x44298c[_0x3b39('0x3c')][_0x3b39('0x15')][_0x3b39('0x34')]()][_0x3b39('0x29')]()});}});}return _0x435124;}exports[_0x3b39('0x3d')]=function(_0x47b6e7,_0x4bd81f,_0x5dfe8d,_0x502366,_0x51f4af,_0x504e38){var _0x21ca3f,_0x33c045;_0x504e38[_0x3b39('0x19')]=intUtil[_0x3b39('0x3e')](_0x504e38['remoteUri']);_0x504e38[_0x3b39('0x3f')]=intUtil[_0x3b39('0x3e')](_0x504e38['serverUrl']);if(_0x51f4af&&_0x51f4af[_0x3b39('0x40')]){logger[_0x3b39('0xd')](_0x3b39('0x41'),_0x3b39('0x42'));_0x4bd81f[_0x3b39('0x43')]=util[_0x3b39('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x504e38[_0x3b39('0x3f')],_0x4bd81f[_0x3b39('0x44')],md5(_0x4bd81f[_0x3b39('0x44')]));}else{_0x4bd81f[_0x3b39('0x43')]='';}headers[_0x3b39('0x45')]=getAuth(_0x504e38);return getUser(_0x504e38,_0x502366[_0x3b39('0x20')])[_0x3b39('0x1b')](function(_0x12b0d2){_0x21ca3f=_0x12b0d2;logger[_0x3b39('0xd')]('The\x20User\x20ID\x20is:',_0x21ca3f['id']);return getEndUser(_0x504e38,_0x4bd81f[_0x3b39('0x46')],_0x4bd81f['calleridnum']);})[_0x3b39('0x1b')](function(_0x39bbc3){_0x33c045=_0x39bbc3;logger['info']('The\x20Enduser\x20ID\x20is:',_0x33c045['id']);return getTicket(_0x504e38,_0x21ca3f,_0x33c045,_0x5dfe8d,_0x4bd81f);})['then'](function(_0x4b448f){if(_0x4b448f&&_0x4b448f['id']){logger['info'](_0x3b39('0x1c'));logger[_0x3b39('0xd')](_0x3b39('0x47'),_0x4b448f['id']);logger[_0x3b39('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x502366[_0x3b39('0x15')]),_0x3b39('0x48'),{'uri':util[_0x3b39('0x10')](_0x3b39('0x49'),_0x504e38[_0x3b39('0x19')],_0x4b448f['id'])});}})[_0x3b39('0x4a')](function(_0xfb56e3){logger[_0x3b39('0x4b')](_0x3b39('0x41'),JSON['stringify'](_0xfb56e3));});};exports[_0x3b39('0x4c')]=function(_0x48acbc,_0x2a5a79,_0x2ac215,_0x270ed9,_0x4ba9ba,_0x597418,_0x32f889){var _0x48c5eb,_0x43a6a6;_0x597418['remoteUri']=intUtil[_0x3b39('0x3e')](_0x597418[_0x3b39('0x19')]);_0x597418[_0x3b39('0x3f')]=intUtil[_0x3b39('0x3e')](_0x597418[_0x3b39('0x3f')]);if(_0x32f889&&_0x32f889[_0x3b39('0x4d')]&&_0x32f889[_0x3b39('0x4d')]!==_0x3b39('0x4e')){logger[_0x3b39('0xd')](_0x3b39('0x4f'),_0x3b39('0x42'));_0x2a5a79[_0x3b39('0x43')]=util[_0x3b39('0x10')](_0x3b39('0x50'),_0x597418['serverUrl'],_0x2a5a79[_0x3b39('0x44')],md5(_0x2a5a79['uniqueid']));}headers[_0x3b39('0x45')]=getAuth(_0x597418);return getUser(_0x597418,_0x270ed9[_0x3b39('0x20')])['then'](function(_0x58da3c){_0x48c5eb=_0x58da3c;logger['info'](_0x3b39('0x51'),_0x48c5eb['id']);return getEndUser(_0x597418,_0x2a5a79[_0x3b39('0x52')],_0x2a5a79[_0x3b39('0x53')]);})[_0x3b39('0x1b')](function(_0x5291ff){_0x43a6a6=_0x5291ff;logger[_0x3b39('0xd')](_0x3b39('0x54'),_0x43a6a6['id']);return getTicket(_0x597418,_0x48c5eb,_0x43a6a6,_0x2ac215,_0x2a5a79);})[_0x3b39('0x1b')](function(_0x32464d){if(_0x32464d&&_0x32464d['id']){logger[_0x3b39('0xd')](_0x3b39('0x1c'));logger[_0x3b39('0xd')](_0x3b39('0x47'),_0x32464d['id']);logger[_0x3b39('0xd')]('[OUTBOUND]',_0x3b39('0x55'));emit(util[_0x3b39('0x10')](_0x3b39('0x56'),_0x270ed9['name']),_0x3b39('0x48'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x597418[_0x3b39('0x19')],_0x32464d['id'])});}})['catch'](function(_0x555c43){logger[_0x3b39('0x4b')]('[OUTBOUND]',JSON[_0x3b39('0x57')](_0x555c43));});};exports['unmanaged']=function(_0xca0b54,_0x1391ed,_0x1ee355,_0x5e73a3,_0x5cc839,_0x5b389a){var _0x3eeaed,_0x101993;_0x5b389a['remoteUri']=intUtil[_0x3b39('0x3e')](_0x5b389a['remoteUri']);_0x5b389a[_0x3b39('0x3f')]=intUtil[_0x3b39('0x3e')](_0x5b389a['serverUrl']);if(_0x5cc839&&_0x5cc839[_0x3b39('0x40')]){logger[_0x3b39('0xd')]('['+_0x1391ed[_0x3b39('0x58')][_0x3b39('0x59')]()+']',_0x3b39('0x42'));_0x1391ed[_0x3b39('0x43')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b389a[_0x3b39('0x3f')],_0x1391ed[_0x3b39('0x44')],md5(_0x1391ed[_0x3b39('0x44')]));}else{_0x1391ed['recordingURL']='';}headers[_0x3b39('0x45')]=getAuth(_0x5b389a);return getUser(_0x5b389a,'')[_0x3b39('0x1b')](function(_0x250869){_0x3eeaed=_0x250869;logger[_0x3b39('0xd')](_0x3b39('0x51'),_0x3eeaed['id']);return getEndUser(_0x5b389a,_0x1391ed[_0x3b39('0x46')],_0x1391ed[_0x3b39('0x5a')]);})['then'](function(_0x3f5ebc){_0x101993=_0x3f5ebc;logger[_0x3b39('0xd')]('The\x20Enduser\x20ID\x20is:',_0x101993['id']);return getTicket(_0x5b389a,_0x3eeaed,_0x101993,_0x1ee355,_0x1391ed);})[_0x3b39('0x1b')](function(_0x176b80){if(_0x176b80){logger['info'](_0x3b39('0x1c'));logger[_0x3b39('0xd')](_0x3b39('0x47'),_0x176b80['id']);}})['catch'](function(_0x36adcf){logger[_0x3b39('0x4b')]('['+_0x1391ed[_0x3b39('0x58')][_0x3b39('0x59')]()+']',JSON['stringify'](_0x36adcf));});}; \ No newline at end of file +var _0x0410=['defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','Subjects','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','stringify','outbound','recordingFormat','none','Authorization','destcalleridname','trigger:browser:url','%s/helpdesk/tickets/%d','catch','[OUTBOUND]','unmanaged','toUpperCase','calleridname','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','freshdesk','redis'];(function(_0x5be327,_0x4ad045){var _0x1db0b9=function(_0x46dcde){while(--_0x46dcde){_0x5be327['push'](_0x5be327['shift']());}};_0x1db0b9(++_0x4ad045);}(_0x0410,0x169));var _0x0041=function(_0x48113d,_0x18174f){_0x48113d=_0x48113d-0x0;var _0xbf60ab=_0x0410[_0x48113d];return _0xbf60ab;};'use strict';var _=require(_0x0041('0x0'));var rp=require(_0x0041('0x1'));var md5=require(_0x0041('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0041('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0041('0x4'))(_0x0041('0x5'));config[_0x0041('0x6')]=_[_0x0041('0x7')](config[_0x0041('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0041('0x8'))(new Redis(config[_0x0041('0x6')]));var headers={'Content-Type':_0x0041('0x9'),'Accept':'application/json'};function emit(_0x2577a6,_0x265db2,_0x54d2be){io['to'](_0x2577a6)[_0x0041('0xa')](_0x265db2,_0x54d2be);}function getTicket(_0x5be36a,_0xfeae24,_0x129b24,_0x97b396,_0x4b16af){logger[_0x0041('0xb')](_0x0041('0xc'));var _0x31399e=_['merge']({'responder_id':_0xfeae24['id'],'requester_id':_0x129b24['id'],'name':util[_0x0041('0xd')](_0x0041('0xe'),_0x4b16af['calleridname']),'phone':_0x4b16af[_0x0041('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x97b396[_0x0041('0x10')],_0x4b16af,'\x20'),'description':intUtil[_0x0041('0x11')](_0x97b396['Descriptions'],_0x4b16af,_0x0041('0x12')),'tags':getTags(_0x97b396[_0x0041('0x13')],_0x0041('0x14'))},getCustomFields(_0x97b396[_0x0041('0x15')],_0x4b16af));_0x31399e[_0x0041('0x16')]=_[_0x0041('0x17')](_[_0x0041('0x18')](_0x31399e[_0x0041('0x16')],'id'),_0x0041('0x19'));return request({'uri':util['format']('%s/api/v2/tickets',_0x5be36a[_0x0041('0x1a')]),'method':'POST','body':_0x31399e})[_0x0041('0x1b')](function(_0x3e755e){logger[_0x0041('0xb')](_0x0041('0x1c'));return _0x3e755e;});}function getUser(_0x84244a,_0x5c522d){if(intUtil[_0x0041('0x1d')](_0x5c522d)){return request({'uri':util[_0x0041('0xd')]('%s/api/v2/agents',_0x84244a[_0x0041('0x1a')]),'qs':{'email':_0x5c522d}})[_0x0041('0x1b')](function(_0x165a34){if(_0x165a34[_0x0041('0x1e')]){logger[_0x0041('0xb')](_0x0041('0x1f'));return _[_0x0041('0x20')](_0x165a34,function(_0x54b267){return _0x54b267['contact'][_0x0041('0x21')]===_0x5c522d;});}else{logger[_0x0041('0xb')](_0x0041('0x22'));return request({'uri':util[_0x0041('0xd')](_0x0041('0x23'),_0x84244a['remoteUri'])})[_0x0041('0x1b')](function(_0x57bb55){logger[_0x0041('0xb')](_0x0041('0x24'));return _0x57bb55;});}});}else{logger[_0x0041('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x0041('0xd')](_0x0041('0x23'),_0x84244a[_0x0041('0x1a')])})[_0x0041('0x1b')](function(_0x40221b){logger['info'](_0x0041('0x24'));return _0x40221b;});}}function getEndUser(_0x41d6d1,_0x1f528a,_0x4c59e1){logger['info']('Searching\x20enduser\x20with\x20phone',_0x4c59e1);return request({'uri':util[_0x0041('0xd')](_0x0041('0x25'),_0x41d6d1[_0x0041('0x1a')]),'qs':{'phone':_0x4c59e1}})['then'](function(_0x3ea57e){if(_0x3ea57e[_0x0041('0x1e')]){logger[_0x0041('0xb')](_0x0041('0x26'));return _[_0x0041('0x20')](_0x3ea57e,{'phone':_0x4c59e1});}else{logger[_0x0041('0xb')](_0x0041('0x27'));return request({'uri':util['format']('%s/api/v2/contacts',_0x41d6d1[_0x0041('0x1a')]),'method':_0x0041('0x28'),'body':{'name':_0x1f528a,'phone':_0x4c59e1}})['then'](function(_0x4ea8a7){logger[_0x0041('0xb')](_0x0041('0x29'));return _0x4ea8a7;});}});}function getAuth(_0x4dd8bc){return util['format']('Basic\x20%s',new Buffer(_0x4dd8bc[_0x0041('0x2a')]+':X')[_0x0041('0x2b')](_0x0041('0x2c')));}function request(_0x31751b){logger[_0x0041('0x2d')](_0x0041('0x2e'),JSON['stringify'](_0x31751b));return rp(_[_0x0041('0x7')](_0x31751b,{'method':_0x0041('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x19606e,_0x5da55c){var _0x4763c8=[];if(_0x19606e&&_0x19606e[_0x0041('0x1e')]>0x0){_0x4763c8=_[_0x0041('0x30')](_0x19606e,_0x5da55c);}return _0x4763c8;}function getCustomFields(_0x46a2c8,_0x1fe123){var _0x383c0a=[];var _0x40a4bd={'custom_fields':[]};if(_0x46a2c8['length']>0x0){_[_0x0041('0x31')](_0x46a2c8,function(_0x542220){if(_['includes']([_0x0041('0x32'),_0x0041('0x33')],_0x542220[_0x0041('0x34')])&&_0x542220[_0x0041('0x35')]&&!_0x542220[_0x0041('0x36')]){_0x40a4bd[_0x542220['nameField'][_0x0041('0x37')]()]=_0x542220[_0x0041('0x38')][_0x0041('0x2b')]();}else if(_[_0x0041('0x39')]([_0x0041('0x32'),_0x0041('0x33')],_0x542220[_0x0041('0x34')])&&_0x542220[_0x0041('0x3a')]&&_0x542220[_0x0041('0x36')]){_0x40a4bd[_0x0041('0x16')][_0x0041('0x3b')]({'id':_0x542220[_0x0041('0x3a')],'value':_0x542220['content'][_0x0041('0x2b')]()});}else if(_0x542220['type']===_0x0041('0x3c')&&_0x542220[_0x0041('0x3d')]&&_0x542220[_0x0041('0x3a')]&&_0x542220['customField']){_0x1fe123[_0x542220['variableName']]&&_0x40a4bd['custom_fields']['push']({'id':_0x542220[_0x0041('0x3a')],'value':_0x1fe123[_0x542220[_0x0041('0x3d')]]['toString']()});}else if(_0x542220[_0x0041('0x34')]==='customVariable'&&_0x542220[_0x0041('0x3e')]&&_0x542220['Variable']['name']&&_0x542220[_0x0041('0x3a')]&&_0x542220[_0x0041('0x36')]){_0x1fe123[_0x542220[_0x0041('0x3e')][_0x0041('0x14')][_0x0041('0x37')]()]&&_0x40a4bd[_0x0041('0x16')][_0x0041('0x3b')]({'id':_0x542220['idField'],'value':_0x1fe123[_0x542220[_0x0041('0x3e')][_0x0041('0x14')][_0x0041('0x37')]()][_0x0041('0x2b')]()});}});}return _0x40a4bd;}exports[_0x0041('0x3f')]=function(_0xf1ec30,_0x2a5b01,_0x4f938d,_0x37c30e,_0x3c522e,_0x230578){var _0x8c67d4,_0x590ee2;_0x230578[_0x0041('0x1a')]=intUtil[_0x0041('0x40')](_0x230578[_0x0041('0x1a')]);_0x230578[_0x0041('0x41')]=intUtil[_0x0041('0x40')](_0x230578[_0x0041('0x41')]);if(_0x3c522e&&_0x3c522e[_0x0041('0x42')]){logger['info']('[QUEUE]',_0x0041('0x43'));_0x2a5b01[_0x0041('0x44')]=util[_0x0041('0xd')](_0x0041('0x45'),_0x230578[_0x0041('0x41')],_0x2a5b01[_0x0041('0x46')],md5(_0x2a5b01[_0x0041('0x46')]));}else{_0x2a5b01['recordingURL']='';}headers['Authorization']=getAuth(_0x230578);return getUser(_0x230578,_0x37c30e[_0x0041('0x21')])[_0x0041('0x1b')](function(_0x362d1d){_0x8c67d4=_0x362d1d;logger[_0x0041('0xb')](_0x0041('0x47'),_0x8c67d4['id']);return getEndUser(_0x230578,_0x2a5b01['calleridname'],_0x2a5b01['calleridnum']);})[_0x0041('0x1b')](function(_0x1f1e21){_0x590ee2=_0x1f1e21;logger[_0x0041('0xb')](_0x0041('0x48'),_0x590ee2['id']);return getTicket(_0x230578,_0x8c67d4,_0x590ee2,_0x4f938d,_0x2a5b01);})['then'](function(_0x12b2b9){if(_0x12b2b9&&_0x12b2b9['id']){logger['info'](_0x0041('0x1c'));logger[_0x0041('0xb')](_0x0041('0x49'),_0x12b2b9['id']);logger[_0x0041('0xb')](_0x0041('0x4a'),_0x0041('0x4b'));emit(util[_0x0041('0xd')](_0x0041('0x4c'),_0x37c30e[_0x0041('0x14')]),'trigger:browser:url',{'uri':util[_0x0041('0xd')]('%s/helpdesk/tickets/%d',_0x230578[_0x0041('0x1a')],_0x12b2b9['id'])});}})['catch'](function(_0x2d8b7b){logger[_0x0041('0x4d')]('[QUEUE]',JSON[_0x0041('0x4e')](_0x2d8b7b));});};exports[_0x0041('0x4f')]=function(_0x55e77e,_0x34d8f4,_0x276c3d,_0x5d4f1a,_0x37edbf,_0x1b89fe,_0x435935){var _0x5de1bd,_0x9b1f3a;_0x1b89fe[_0x0041('0x1a')]=intUtil[_0x0041('0x40')](_0x1b89fe[_0x0041('0x1a')]);_0x1b89fe[_0x0041('0x41')]=intUtil[_0x0041('0x40')](_0x1b89fe[_0x0041('0x41')]);if(_0x435935&&_0x435935[_0x0041('0x50')]&&_0x435935[_0x0041('0x50')]!==_0x0041('0x51')){logger[_0x0041('0xb')]('[OUTBOUND]',_0x0041('0x43'));_0x34d8f4[_0x0041('0x44')]=util[_0x0041('0xd')](_0x0041('0x45'),_0x1b89fe['serverUrl'],_0x34d8f4[_0x0041('0x46')],md5(_0x34d8f4['uniqueid']));}headers[_0x0041('0x52')]=getAuth(_0x1b89fe);return getUser(_0x1b89fe,_0x5d4f1a[_0x0041('0x21')])[_0x0041('0x1b')](function(_0xc08b84){_0x5de1bd=_0xc08b84;logger['info']('The\x20User\x20ID\x20is:',_0x5de1bd['id']);return getEndUser(_0x1b89fe,_0x34d8f4[_0x0041('0x53')],_0x34d8f4['destcalleridnum']);})[_0x0041('0x1b')](function(_0x5d5400){_0x9b1f3a=_0x5d5400;logger['info'](_0x0041('0x48'),_0x9b1f3a['id']);return getTicket(_0x1b89fe,_0x5de1bd,_0x9b1f3a,_0x276c3d,_0x34d8f4);})['then'](function(_0x5bb32f){if(_0x5bb32f&&_0x5bb32f['id']){logger[_0x0041('0xb')](_0x0041('0x1c'));logger[_0x0041('0xb')](_0x0041('0x49'),_0x5bb32f['id']);logger['info']('[OUTBOUND]',_0x0041('0x4b'));emit(util[_0x0041('0xd')](_0x0041('0x4c'),_0x5d4f1a['name']),_0x0041('0x54'),{'uri':util[_0x0041('0xd')](_0x0041('0x55'),_0x1b89fe[_0x0041('0x1a')],_0x5bb32f['id'])});}})[_0x0041('0x56')](function(_0x33ca5a){logger['error'](_0x0041('0x57'),JSON['stringify'](_0x33ca5a));});};exports[_0x0041('0x58')]=function(_0x226588,_0x4729b5,_0x10ecc7,_0x5d24c5,_0x15e239,_0x4a76bb){var _0x2a98f5,_0xd789f4;_0x4a76bb['remoteUri']=intUtil['stripTrailingSlash'](_0x4a76bb[_0x0041('0x1a')]);_0x4a76bb[_0x0041('0x41')]=intUtil[_0x0041('0x40')](_0x4a76bb[_0x0041('0x41')]);if(_0x15e239&&_0x15e239[_0x0041('0x42')]){logger[_0x0041('0xb')]('['+_0x4729b5['lastevent'][_0x0041('0x59')]()+']','Recording\x20is\x20enabled!');_0x4729b5[_0x0041('0x44')]=util[_0x0041('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a76bb[_0x0041('0x41')],_0x4729b5['uniqueid'],md5(_0x4729b5[_0x0041('0x46')]));}else{_0x4729b5['recordingURL']='';}headers[_0x0041('0x52')]=getAuth(_0x4a76bb);return getUser(_0x4a76bb,'')[_0x0041('0x1b')](function(_0x53e529){_0x2a98f5=_0x53e529;logger['info']('The\x20User\x20ID\x20is:',_0x2a98f5['id']);return getEndUser(_0x4a76bb,_0x4729b5[_0x0041('0x5a')],_0x4729b5[_0x0041('0xf')]);})['then'](function(_0x2fea04){_0xd789f4=_0x2fea04;logger[_0x0041('0xb')](_0x0041('0x48'),_0xd789f4['id']);return getTicket(_0x4a76bb,_0x2a98f5,_0xd789f4,_0x10ecc7,_0x4729b5);})[_0x0041('0x1b')](function(_0x1095a3){if(_0x1095a3){logger[_0x0041('0xb')](_0x0041('0x1c'));logger[_0x0041('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1095a3['id']);}})[_0x0041('0x56')](function(_0x11d6ac){logger[_0x0041('0x4d')]('['+_0x4729b5[_0x0041('0x5b')][_0x0041('0x59')]()+']',JSON['stringify'](_0x11d6ac));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 82c6ba4..1bc695f 100644 --- a/server/services/ami/trigger/integration/freshsales.js +++ b/server/services/ami/trigger/integration/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c34=['Contact\x20found\x20work_number:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','task','Task\x20created:','ticketId','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','userEmail','email','userId','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number'];(function(_0x285b5e,_0x5cf0ac){var _0x13fa28=function(_0x3d9e3a){while(--_0x3d9e3a){_0x285b5e['push'](_0x285b5e['shift']());}};_0x13fa28(++_0x5cf0ac);}(_0x2c34,0x1bb));var _0x42c3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2c34[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x42c3('0x0'));var rp=require(_0x42c3('0x1'));var md5=require('md5');var util=require(_0x42c3('0x2'));var moment=require('moment');var Promise=require(_0x42c3('0x3'));var Redis=require('ioredis');var intUtil=require(_0x42c3('0x4'));var config=require(_0x42c3('0x5'));var logger=require(_0x42c3('0x6'))(_0x42c3('0x7'));config[_0x42c3('0x8')]=_[_0x42c3('0x9')](config['redis'],{'host':_0x42c3('0xa'),'port':0x18eb});var io=require(_0x42c3('0xb'))(new Redis(config[_0x42c3('0x8')]));function getAdminId(_0x32f058,_0x290e74,_0x57224f,_0x5c13eb){return new Promise(function(_0x136402,_0x2b876e){var _0x35003e=![];var _0x2b4109={'method':_0x42c3('0xc'),'uri':_0x5c13eb+'/api/selector/owners','json':!![]};_0x2b4109[_0x42c3('0xd')]=_0x57224f;logger[_0x42c3('0xe')]('Getting\x20admin\x20information');return rp(_0x2b4109)[_0x42c3('0xf')](function(_0x55e878){if(_0x55e878){var _0x41af2e=_0x55e878[_0x42c3('0x10')];var _0x5ede25=null;for(_0x5ede25=0x0;_0x5ede25<_0x41af2e[_0x42c3('0x11')];_0x5ede25++){if(_0x41af2e[_0x5ede25]['email']===_0x32f058[_0x42c3('0x12')]){_0x32f058[_0x42c3('0x13')]=_0x41af2e[_0x5ede25]['id'];_0x35003e=!![];}}if(_0x35003e){logger['info'](_0x42c3('0x14'),_0x32f058['adminId']);_0x136402(_0x32f058);}else{_0x2b876e({'statusCode':0x194,'message':_0x42c3('0x15')});}}else{_0x2b876e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x42c3('0x16')](function(_0x1a496d){logger[_0x42c3('0x17')]('['+[_0x290e74[_0x42c3('0x18')]()]+']',_0x1a496d[_0x42c3('0x19')]);_0x2b876e(_0x1a496d);});});}function getUser(_0x777f8,_0x187c62,_0x2257ab){return function(_0x422641){return new Promise(function(_0x3a2145,_0x4eb389){var _0x22f8ff={'method':'GET','uri':_0x2257ab+_0x42c3('0x1a'),'json':!![]};_0x22f8ff[_0x42c3('0xd')]=_0x187c62;logger[_0x42c3('0xe')](_0x42c3('0x1b'));return rp(_0x22f8ff)['then'](function(_0x1b64c1){if(_0x1b64c1){var _0x44a8fe=_0x1b64c1[_0x42c3('0x10')];var _0x101686=![];var _0x5f3db5=null;if(_0x422641[_0x42c3('0x1c')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x422641[_0x42c3('0x1c')]);_0x422641[_0x42c3('0x1d')]=_0x422641[_0x42c3('0x1c')];for(_0x5f3db5=0x0;_0x5f3db5<_0x44a8fe[_0x42c3('0x11')];_0x5f3db5++){if(_0x44a8fe[_0x5f3db5][_0x42c3('0x1e')]===_0x422641[_0x42c3('0x1c')]){_0x101686=!![];_0x422641[_0x42c3('0x1f')]=_0x44a8fe[_0x5f3db5]['id'];logger['info']('User\x20found:',_0x422641[_0x42c3('0x1f')]);}}}if(!_0x101686){logger[_0x42c3('0xe')]('Admin\x20selected');_0x422641[_0x42c3('0x1d')]=_0x422641[_0x42c3('0x12')];_0x422641[_0x42c3('0x1f')]=_0x422641['adminId'];_0x101686=!![];}if(_0x101686){_0x3a2145(_0x422641);}else{_0x4eb389({'statusCode':0x194,'message':_0x42c3('0x15')});}}else{_0x4eb389({'statusCode':0x194,'message':_0x42c3('0x15')});}})[_0x42c3('0x16')](function(_0x44761d){logger[_0x42c3('0x17')]('['+[_0x777f8['toUpperCase']()]+']',_0x44761d[_0x42c3('0x19')]);_0x4eb389(_0x44761d);});});};}function searchContact(_0x30b894,_0x36e5a2,_0x470793,_0x44d8a6){return new Promise(function(_0x2e85fb,_0x2b503a){var _0x2fe695={'method':_0x42c3('0xc'),'headers':_0x36e5a2,'uri':_0x30b894+_0x42c3('0x20')+_0x44d8a6+_0x42c3('0x21')+_0x470793+'&entities=contact','json':!![]};rp(_0x2fe695)[_0x42c3('0xf')](function(_0x467629){var _0x3a818e=_[_0x42c3('0x22')](_0x467629[_0x42c3('0x23')][_0x42c3('0x23')],[_0x470793,_0x44d8a6]);_0x2e85fb(_0x3a818e);})[_0x42c3('0x16')](function(_0x3a4cc1){_0x2b503a(_0x3a4cc1);});});}function getEndUser(_0x119d85,_0x5b5ca4,_0x4f3990){return function(_0x41303c){return new Promise(function(_0x4f72ad,_0x301869){logger[_0x42c3('0xe')](util[_0x42c3('0x24')](_0x42c3('0x25'),_0x41303c[_0x42c3('0x26')]));searchContact(_0x4f3990,_0x5b5ca4,_0x42c3('0x27'),_0x41303c[_0x42c3('0x26')])[_0x42c3('0xf')](function(_0x2a4380){if(_0x2a4380){_0x41303c['endUserId']=_0x2a4380['id'];logger[_0x42c3('0xe')](_0x42c3('0x28'),_0x41303c[_0x42c3('0x29')]);return _0x4f72ad(_0x41303c);}searchContact(_0x4f3990,_0x5b5ca4,_0x42c3('0x2a'),_0x41303c['contactNumber'])[_0x42c3('0xf')](function(_0x516125){if(_0x516125){_0x41303c[_0x42c3('0x29')]=_0x516125['id'];logger[_0x42c3('0xe')](_0x42c3('0x2b'),_0x41303c[_0x42c3('0x29')]);return _0x4f72ad(_0x41303c);}createEndUser(_0x41303c,_0x119d85,_0x5b5ca4,_0x4f3990)[_0x42c3('0xf')](function(_0x141d3f){logger[_0x42c3('0xe')]('Contact\x20created:',_0x141d3f[_0x42c3('0x29')]);return _0x4f72ad(_0x141d3f);});});})['catch'](function(_0x758abd){_0x301869(_0x758abd);});});};}function createEndUser(_0x10d1ae,_0x936731,_0x4a8b3b,_0x287a12){return new Promise(function(_0x35a637,_0x51f3e5){var _0x3fa6b9=moment();var _0x54f020={'method':'POST','uri':_0x287a12+_0x42c3('0x2c'),'body':{'contact':{'last_name':_0x10d1ae[_0x42c3('0x26')],'work_number':_0x10d1ae[_0x42c3('0x26')],'mobile_number':_0x10d1ae[_0x42c3('0x26')],'owner_id':_0x10d1ae['userId'],'created_at':_0x3fa6b9[_0x42c3('0x24')](_0x42c3('0x2d'))}},'json':!![]};_0x54f020['headers']=_0x4a8b3b;logger['info'](_0x42c3('0x2e'));return rp(_0x54f020)['then'](function(_0x2a52ec){_0x10d1ae[_0x42c3('0x29')]=_0x2a52ec[_0x42c3('0x2f')]['id'];_0x35a637(_0x10d1ae);})[_0x42c3('0x16')](function(_0x5c2f5c){logger[_0x42c3('0x17')]('['+[_0x936731[_0x42c3('0x18')]()]+']',_0x5c2f5c[_0x42c3('0x19')]);_0x51f3e5(_0x5c2f5c[_0x42c3('0x19')]);});});}function getTicket(_0x4d28d9,_0x23ba8a,_0x3b8c15,_0x52f9d1,_0x55a056){return function(_0x3e37cc){logger[_0x42c3('0xe')](_0x42c3('0x30'));return new Promise(function(_0x1cf282,_0x44d2b8){var _0x115250=moment();var _0x1ef090={'method':_0x42c3('0x31'),'uri':_0x3b8c15+_0x42c3('0x32'),'body':{'title':intUtil[_0x42c3('0x33')](_0x52f9d1[_0x42c3('0x34')],_0x55a056,'\x20'),'description':intUtil['getString'](_0x52f9d1[_0x42c3('0x35')],_0x55a056,'\x0a'),'owner_id':_0x3e37cc[_0x42c3('0x1f')],'creater_id':_0x3e37cc['adminId'],'targetable_id':_0x3e37cc[_0x42c3('0x29')],'targetable_type':_0x42c3('0x36'),'created_at':_0x115250[_0x42c3('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x115250[_0x42c3('0x37')](0x1e,'m')[_0x42c3('0x24')](_0x42c3('0x2d'))},'json':!![]};_0x1ef090[_0x42c3('0xd')]=_0x23ba8a;return rp(_0x1ef090)[_0x42c3('0xf')](function(_0xf32997){_0x3e37cc['ticketId']=_0xf32997[_0x42c3('0x38')]['id'];logger[_0x42c3('0xe')](_0x42c3('0x39'),_0x3e37cc[_0x42c3('0x3a')]);_0x1cf282(_0x3e37cc);})[_0x42c3('0x16')](function(_0x2361f0){logger[_0x42c3('0x17')]('['+[_0x4d28d9[_0x42c3('0x18')]()]+']',_0x2361f0[_0x42c3('0x19')]);_0x44d2b8(_0x2361f0['message']);});});};}function emit(_0x2bf3a1,_0x3cb583,_0x1ae556){var _0x1dd8e7={'uri':_0x2bf3a1+'/contacts/'+_0x1ae556};io['to'](util['format']('user:%s',_0x3cb583))[_0x42c3('0x3b')]('trigger:browser:url',_0x1dd8e7);}exports['cs']=function(_0xcef7c5,_0x52b191,_0xac0871,_0x46e3e9,_0x44e6a7,_0x336726,_0xea88bd,_0x377316){var _0x2887d1={};var _0x4d529c={'Authorization':_0x42c3('0x3c')+_0x336726[_0x42c3('0x3d')]};_0x336726[_0x42c3('0x3e')]=intUtil[_0x42c3('0x3f')](_0x336726['remoteUri']);_0x336726[_0x42c3('0x40')]=intUtil[_0x42c3('0x3f')](_0x336726[_0x42c3('0x40')]);var _0x457c9e=_0x336726[_0x42c3('0x3e')];_0x2887d1[_0x42c3('0x12')]=_0x336726[_0x42c3('0x41')];_0x2887d1[_0x42c3('0x26')]=_0x377316[_0x42c3('0x42')]()===_0x42c3('0x43')?_0x52b191['destcalleridnum']:_0x52b191[_0x42c3('0x44')];_0x2887d1[_0x42c3('0x45')]=_0x377316===_0x42c3('0x46')||_0x377316===_0x42c3('0x47')?_0x42c3('0x46'):'outbound';if(_0x46e3e9){_0x2887d1['agentEmail']=_0x46e3e9['email'];}var _0x332f68=util[_0x42c3('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x336726[_0x42c3('0x40')],_0x52b191[_0x42c3('0x48')],md5(_0x52b191['uniqueid']));if(_0x44e6a7&&_0x44e6a7['monitor_format']){logger[_0x42c3('0xe')]('[QUEUE]',_0x42c3('0x49'));_0x52b191[_0x42c3('0x4a')]=_0x332f68;}else if(_0xea88bd&&_0xea88bd[_0x42c3('0x4b')]&&_0xea88bd[_0x42c3('0x4b')]!=='none'){logger[_0x42c3('0xe')]('[OUTBOUND]',_0x42c3('0x49'));_0x52b191[_0x42c3('0x4a')]=_0x332f68;}else{_0x52b191[_0x42c3('0x4a')]='';}return getAdminId(_0x2887d1,_0x377316,_0x4d529c,_0x457c9e)[_0x42c3('0xf')](getUser(_0x377316,_0x4d529c,_0x457c9e))['then'](getEndUser(_0x377316,_0x4d529c,_0x457c9e))[_0x42c3('0xf')](getTicket(_0x377316,_0x4d529c,_0x457c9e,_0xac0871,_0x52b191))[_0x42c3('0xf')](function(_0x64b65c){logger['info'](util[_0x42c3('0x24')](_0x42c3('0x4c'),_0x64b65c['ticketId']));if(_0x377316!==_0x42c3('0x47')){logger['info']('['+[_0x377316[_0x42c3('0x18')]()]+']',_0x42c3('0x4d'));emit(_0x457c9e,_0x46e3e9[_0x42c3('0x4e')],_0x64b65c[_0x42c3('0x29')]);}})['catch'](function(_0x1e9279){logger[_0x42c3('0x17')]('['+[_0x377316[_0x42c3('0x18')]()]+_0x42c3('0x4f'),util[_0x42c3('0x50')](_0x1e9279,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2343=['toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','Admin\x20selected','userEmail','GET','&f=','find','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','task','ticketId','/contacts/','user:%s','emit','apiKey','remoteUri','stripTrailingSlash','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0x2343,0x87));var _0x3234=function(_0x5e2751,_0x518a55){_0x5e2751=_0x5e2751-0x0;var _0x139a39=_0x2343[_0x5e2751];return _0x139a39;};'use strict';var _=require(_0x3234('0x0'));var rp=require(_0x3234('0x1'));var md5=require(_0x3234('0x2'));var util=require(_0x3234('0x3'));var moment=require(_0x3234('0x4'));var Promise=require(_0x3234('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x3234('0x6'));var logger=require(_0x3234('0x7'))(_0x3234('0x8'));config[_0x3234('0x9')]=_[_0x3234('0xa')](config['redis'],{'host':_0x3234('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3234('0x9')]));function getAdminId(_0x318565,_0x51e91b,_0x3d11db,_0x13857c){return new Promise(function(_0x196e47,_0x399647){var _0x3cfa6c=![];var _0x2ece31={'method':'GET','uri':_0x13857c+'/api/selector/owners','json':!![]};_0x2ece31[_0x3234('0xc')]=_0x3d11db;logger[_0x3234('0xd')](_0x3234('0xe'));return rp(_0x2ece31)[_0x3234('0xf')](function(_0x3841c3){if(_0x3841c3){var _0x247d57=_0x3841c3[_0x3234('0x10')];var _0x375315=null;for(_0x375315=0x0;_0x375315<_0x247d57[_0x3234('0x11')];_0x375315++){if(_0x247d57[_0x375315][_0x3234('0x12')]===_0x318565[_0x3234('0x13')]){_0x318565[_0x3234('0x14')]=_0x247d57[_0x375315]['id'];_0x3cfa6c=!![];}}if(_0x3cfa6c){logger[_0x3234('0xd')](_0x3234('0x15'),_0x318565['adminId']);_0x196e47(_0x318565);}else{_0x399647({'statusCode':0x194,'message':_0x3234('0x16')});}}else{_0x399647({'statusCode':0x194,'message':_0x3234('0x16')});}})[_0x3234('0x17')](function(_0x390e5b){logger[_0x3234('0x18')]('['+[_0x51e91b[_0x3234('0x19')]()]+']',_0x390e5b[_0x3234('0x1a')]);_0x399647(_0x390e5b);});});}function getUser(_0x20e35f,_0x2456dc,_0x556866){return function(_0x42aecb){return new Promise(function(_0x547a8f,_0x4a4f44){var _0x2d5aef={'method':'GET','uri':_0x556866+'/api/selector/owners','json':!![]};_0x2d5aef[_0x3234('0xc')]=_0x2456dc;logger[_0x3234('0xd')](_0x3234('0x1b'));return rp(_0x2d5aef)[_0x3234('0xf')](function(_0x3785f0){if(_0x3785f0){var _0x8bc4d8=_0x3785f0['users'];var _0x148e46=![];var _0x29f685=null;if(_0x42aecb[_0x3234('0x1c')]!==null){logger[_0x3234('0xd')](_0x3234('0x1d'),_0x42aecb[_0x3234('0x1c')]);_0x42aecb['userEmail']=_0x42aecb[_0x3234('0x1c')];for(_0x29f685=0x0;_0x29f685<_0x8bc4d8[_0x3234('0x11')];_0x29f685++){if(_0x8bc4d8[_0x29f685][_0x3234('0x12')]===_0x42aecb['agentEmail']){_0x148e46=!![];_0x42aecb['userId']=_0x8bc4d8[_0x29f685]['id'];logger[_0x3234('0xd')](_0x3234('0x1e'),_0x42aecb[_0x3234('0x1f')]);}}}if(!_0x148e46){logger[_0x3234('0xd')](_0x3234('0x20'));_0x42aecb[_0x3234('0x21')]=_0x42aecb[_0x3234('0x13')];_0x42aecb[_0x3234('0x1f')]=_0x42aecb[_0x3234('0x14')];_0x148e46=!![];}if(_0x148e46){_0x547a8f(_0x42aecb);}else{_0x4a4f44({'statusCode':0x194,'message':_0x3234('0x16')});}}else{_0x4a4f44({'statusCode':0x194,'message':_0x3234('0x16')});}})[_0x3234('0x17')](function(_0x490279){logger['error']('['+[_0x20e35f[_0x3234('0x19')]()]+']',_0x490279[_0x3234('0x1a')]);_0x4a4f44(_0x490279);});});};}function searchContact(_0x4eb123,_0x181268,_0x38fd19,_0x54b413){return new Promise(function(_0x1bf8f2,_0x3cce4f){var _0x4a549d={'method':_0x3234('0x22'),'headers':_0x181268,'uri':_0x4eb123+'/api/lookup?q='+_0x54b413+_0x3234('0x23')+_0x38fd19+'&entities=contact','json':!![]};rp(_0x4a549d)[_0x3234('0xf')](function(_0x1bdb01){var _0x454172=_[_0x3234('0x24')](_0x1bdb01['contacts']['contacts'],[_0x38fd19,_0x54b413]);_0x1bf8f2(_0x454172);})[_0x3234('0x17')](function(_0x265676){_0x3cce4f(_0x265676);});});}function getEndUser(_0xecd1b2,_0xea8ad0,_0x28669c){return function(_0x1dbc11){return new Promise(function(_0x13bae4,_0x10fea7){logger['info'](util['format'](_0x3234('0x25'),_0x1dbc11[_0x3234('0x26')]));searchContact(_0x28669c,_0xea8ad0,_0x3234('0x27'),_0x1dbc11[_0x3234('0x26')])[_0x3234('0xf')](function(_0x3f1bb1){if(_0x3f1bb1){_0x1dbc11[_0x3234('0x28')]=_0x3f1bb1['id'];logger['info'](_0x3234('0x29'),_0x1dbc11[_0x3234('0x28')]);return _0x13bae4(_0x1dbc11);}searchContact(_0x28669c,_0xea8ad0,'work_number',_0x1dbc11[_0x3234('0x26')])['then'](function(_0x9de29b){if(_0x9de29b){_0x1dbc11[_0x3234('0x28')]=_0x9de29b['id'];logger[_0x3234('0xd')](_0x3234('0x2a'),_0x1dbc11['endUserId']);return _0x13bae4(_0x1dbc11);}createEndUser(_0x1dbc11,_0xecd1b2,_0xea8ad0,_0x28669c)['then'](function(_0x10190a){logger[_0x3234('0xd')](_0x3234('0x2b'),_0x10190a[_0x3234('0x28')]);return _0x13bae4(_0x10190a);});});})['catch'](function(_0x39eea0){_0x10fea7(_0x39eea0);});});};}function createEndUser(_0x364562,_0x52f453,_0x44d35e,_0x3c998f){return new Promise(function(_0x444fea,_0x6b42ee){var _0x37fc10=moment();var _0x1a8aaa={'method':'POST','uri':_0x3c998f+_0x3234('0x2c'),'body':{'contact':{'last_name':_0x364562['contactNumber'],'work_number':_0x364562[_0x3234('0x26')],'mobile_number':_0x364562[_0x3234('0x26')],'owner_id':_0x364562[_0x3234('0x1f')],'created_at':_0x37fc10[_0x3234('0x2d')](_0x3234('0x2e'))}},'json':!![]};_0x1a8aaa['headers']=_0x44d35e;logger[_0x3234('0xd')](_0x3234('0x2f'));return rp(_0x1a8aaa)[_0x3234('0xf')](function(_0x3bf6c7){_0x364562['endUserId']=_0x3bf6c7[_0x3234('0x30')]['id'];_0x444fea(_0x364562);})[_0x3234('0x17')](function(_0x5dc3c2){logger['error']('['+[_0x52f453[_0x3234('0x19')]()]+']',_0x5dc3c2[_0x3234('0x1a')]);_0x6b42ee(_0x5dc3c2[_0x3234('0x1a')]);});});}function getTicket(_0x37ba32,_0x56d624,_0xb68513,_0x30862c,_0x265187){return function(_0x1a174e){logger[_0x3234('0xd')](_0x3234('0x31'));return new Promise(function(_0x496e09,_0x589e18){var _0x1bdae4=moment();var _0x5d64cf={'method':'POST','uri':_0xb68513+_0x3234('0x32'),'body':{'title':intUtil[_0x3234('0x33')](_0x30862c['Subjects'],_0x265187,'\x20'),'description':intUtil[_0x3234('0x33')](_0x30862c[_0x3234('0x34')],_0x265187,'\x0a'),'owner_id':_0x1a174e[_0x3234('0x1f')],'creater_id':_0x1a174e[_0x3234('0x14')],'targetable_id':_0x1a174e[_0x3234('0x28')],'targetable_type':_0x3234('0x35'),'created_at':_0x1bdae4[_0x3234('0x2d')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x1bdae4[_0x3234('0x36')](0x1e,'m')[_0x3234('0x2d')](_0x3234('0x2e'))},'json':!![]};_0x5d64cf['headers']=_0x56d624;return rp(_0x5d64cf)[_0x3234('0xf')](function(_0x1853c8){_0x1a174e['ticketId']=_0x1853c8[_0x3234('0x37')]['id'];logger[_0x3234('0xd')]('Task\x20created:',_0x1a174e[_0x3234('0x38')]);_0x496e09(_0x1a174e);})['catch'](function(_0x54ad3f){logger[_0x3234('0x18')]('['+[_0x37ba32[_0x3234('0x19')]()]+']',_0x54ad3f[_0x3234('0x1a')]);_0x589e18(_0x54ad3f[_0x3234('0x1a')]);});});};}function emit(_0x5929e4,_0x50384d,_0x1e25bd){var _0x48da38={'uri':_0x5929e4+_0x3234('0x39')+_0x1e25bd};io['to'](util['format'](_0x3234('0x3a'),_0x50384d))[_0x3234('0x3b')]('trigger:browser:url',_0x48da38);}exports['cs']=function(_0x83ae46,_0x3072c3,_0xbb672e,_0x2fd2a0,_0x4c675d,_0x196245,_0x27a465,_0x56ada2){var _0x3957c6={};var _0x4b1bb8={'Authorization':'Token\x20token='+_0x196245[_0x3234('0x3c')]};_0x196245[_0x3234('0x3d')]=intUtil[_0x3234('0x3e')](_0x196245[_0x3234('0x3d')]);_0x196245['serverUrl']=intUtil[_0x3234('0x3e')](_0x196245['serverUrl']);var _0x44b5df=_0x196245[_0x3234('0x3d')];_0x3957c6[_0x3234('0x13')]=_0x196245['username'];_0x3957c6[_0x3234('0x26')]=_0x56ada2[_0x3234('0x3f')]()==='outbound'?_0x3072c3[_0x3234('0x40')]:_0x3072c3[_0x3234('0x41')];_0x3957c6[_0x3234('0x42')]=_0x56ada2===_0x3234('0x43')||_0x56ada2===_0x3234('0x44')?'queue':'outbound';if(_0x2fd2a0){_0x3957c6[_0x3234('0x1c')]=_0x2fd2a0[_0x3234('0x12')];}var _0x4d25ce=util[_0x3234('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x196245[_0x3234('0x45')],_0x3072c3['uniqueid'],md5(_0x3072c3[_0x3234('0x46')]));if(_0x4c675d&&_0x4c675d[_0x3234('0x47')]){logger[_0x3234('0xd')](_0x3234('0x48'),'Recording\x20is\x20enabled!');_0x3072c3['recordingURL']=_0x4d25ce;}else if(_0x27a465&&_0x27a465[_0x3234('0x49')]&&_0x27a465[_0x3234('0x49')]!=='none'){logger[_0x3234('0xd')](_0x3234('0x4a'),_0x3234('0x4b'));_0x3072c3[_0x3234('0x4c')]=_0x4d25ce;}else{_0x3072c3[_0x3234('0x4c')]='';}return getAdminId(_0x3957c6,_0x56ada2,_0x4b1bb8,_0x44b5df)[_0x3234('0xf')](getUser(_0x56ada2,_0x4b1bb8,_0x44b5df))[_0x3234('0xf')](getEndUser(_0x56ada2,_0x4b1bb8,_0x44b5df))[_0x3234('0xf')](getTicket(_0x56ada2,_0x4b1bb8,_0x44b5df,_0xbb672e,_0x3072c3))[_0x3234('0xf')](function(_0x3263dd){logger[_0x3234('0xd')](util['format'](_0x3234('0x4d'),_0x3263dd['ticketId']));if(_0x56ada2!==_0x3234('0x44')){logger[_0x3234('0xd')]('['+[_0x56ada2['toUpperCase']()]+']',_0x3234('0x4e'));emit(_0x44b5df,_0x2fd2a0['name'],_0x3263dd[_0x3234('0x28')]);}})[_0x3234('0x17')](function(_0x4003b1){logger[_0x3234('0x18')]('['+[_0x56ada2[_0x3234('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x3234('0x4f')](_0x4003b1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 9f9089e..d500d7e 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fe1=['zoho','desk','vtiger','servicenow','exec','toLowerCase','data1','find','Configurations','data3','routeId','outbound','log','unmanaged','sugarcrm','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','error','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','freshdesk'];(function(_0x1d6371,_0xbed0c2){var _0x186a8f=function(_0x1bcdcb){while(--_0x1bcdcb){_0x1d6371['push'](_0x1d6371['shift']());}};_0x186a8f(++_0xbed0c2);}(_0x6fe1,0x1b0));var _0x16fe=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0x6fe1[_0x3a78a0];return _0x48e917;};'use strict';var _=require(_0x16fe('0x0'));var util=require('util');var zendesk=require(_0x16fe('0x1'));var salesforce=require(_0x16fe('0x2'));var sugarcrm=require(_0x16fe('0x3'));var freshdesk=require(_0x16fe('0x4'));var zoho=require(_0x16fe('0x5'));var desk=require('./desk');var vtiger=require(_0x16fe('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x16fe('0x7'));var freshsales=require(_0x16fe('0x8'));var integrations=[_0x16fe('0x9'),_0x16fe('0xa'),'sugarcrm',_0x16fe('0xb'),_0x16fe('0xc'),_0x16fe('0xd'),_0x16fe('0xe'),'dynamics365','freshsales',_0x16fe('0xf')];exports[_0x16fe('0x10')]=function(_0x5c8aa1,_0x5f0cc4,_0x4b6ef1,_0x3ba86c,_0x3c5930,_0x6fa85){if(_0x4b6ef1){if(_['includes'](integrations,_0x5c8aa1['data1'][_0x16fe('0x11')]())){try{var _0x3ce559=null;var _0x3baf36='';var _0x1aaadf=_0x4b6ef1[_0x5c8aa1[_0x16fe('0x12')][_0x16fe('0x11')]()];if(_0x1aaadf){var _0x4e0919=_0x1aaadf[_0x5c8aa1['data2']];if(_0x4e0919){var _0x26d3cb=_[_0x16fe('0x13')](_0x4e0919[_0x16fe('0x14')],{'id':parseInt(_0x5c8aa1[_0x16fe('0x15')],0xa)});if(_0x26d3cb){if(_0x3ba86c){if(_0x3c5930&&_0x5f0cc4['queue']){_0x3baf36='queue';}else if(_0x5f0cc4[_0x16fe('0x16')]){_0x3baf36=_0x16fe('0x17');}else{console[_0x16fe('0x18')]('EVENT\x20UNKNOWN',_0x5f0cc4);}}else{_0x3baf36=_0x16fe('0x19');}switch(_0x5c8aa1[_0x16fe('0x12')][_0x16fe('0x11')]()){case _0x16fe('0x9'):zendesk[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0xa'):salesforce[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0x1a'):sugarcrm[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0xb'):freshdesk[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case'zoho':zoho[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0xd'):desk[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0xe'):vtiger[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0x1b'):freshsales['cs'](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85,_0x3baf36);break;case _0x16fe('0xf'):servicenow['cs'](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85,_0x3baf36);break;case _0x16fe('0x1c'):dynamics365['cs'](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85,_0x3baf36);break;default:console[_0x16fe('0x18')](_0x16fe('0x1d'));}}else{_0x3ce559=require(_0x16fe('0x1e'))(_0x5c8aa1[_0x16fe('0x12')]['toLowerCase']());_0x3ce559['error'](_0x16fe('0x1f'),util['format'](_0x16fe('0x20'),_0x5c8aa1[_0x16fe('0x12')][_0x16fe('0x11')](),_0x5c8aa1[_0x16fe('0x15')]));}}else{_0x3ce559=require(_0x16fe('0x1e'))(_0x5c8aa1[_0x16fe('0x12')][_0x16fe('0x11')]());_0x3ce559[_0x16fe('0x21')]('[EXEC]',util[_0x16fe('0x22')](_0x16fe('0x23'),_0x5c8aa1[_0x16fe('0x12')][_0x16fe('0x11')](),_0x5c8aa1[_0x16fe('0x24')]));}}else{}}catch(_0x398ab6){console[_0x16fe('0x21')](_0x398ab6);}}}}; \ No newline at end of file +var _0x0512=['./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','EVENT\x20UNKNOWN','dynamics365','log','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger'];(function(_0x5b2682,_0x24b4ce){var _0x30967f=function(_0x499d89){while(--_0x499d89){_0x5b2682['push'](_0x5b2682['shift']());}};_0x30967f(++_0x24b4ce);}(_0x0512,0x1e6));var _0x2051=function(_0x15ecbf,_0x25f928){_0x15ecbf=_0x15ecbf-0x0;var _0x43f192=_0x0512[_0x15ecbf];return _0x43f192;};'use strict';var _=require(_0x2051('0x0'));var util=require(_0x2051('0x1'));var zendesk=require(_0x2051('0x2'));var salesforce=require(_0x2051('0x3'));var sugarcrm=require(_0x2051('0x4'));var freshdesk=require(_0x2051('0x5'));var zoho=require('./zoho');var desk=require(_0x2051('0x6'));var vtiger=require(_0x2051('0x7'));var servicenow=require(_0x2051('0x8'));var dynamics365=require(_0x2051('0x9'));var freshsales=require(_0x2051('0xa'));var integrations=['zendesk','salesforce',_0x2051('0xb'),_0x2051('0xc'),_0x2051('0xd'),_0x2051('0xe'),_0x2051('0xf'),'dynamics365',_0x2051('0x10'),_0x2051('0x11')];exports['exec']=function(_0x2eb232,_0x211a2f,_0xc77ba8,_0x5983f3,_0x36f869,_0x20df34){if(_0xc77ba8){if(_[_0x2051('0x12')](integrations,_0x2eb232[_0x2051('0x13')][_0x2051('0x14')]())){try{var _0x435fa9=null;var _0xb23f69='';var _0x3c4427=_0xc77ba8[_0x2eb232[_0x2051('0x13')]['toLowerCase']()];if(_0x3c4427){var _0x545b16=_0x3c4427[_0x2eb232[_0x2051('0x15')]];if(_0x545b16){var _0x4a9943=_[_0x2051('0x16')](_0x545b16[_0x2051('0x17')],{'id':parseInt(_0x2eb232['data3'],0xa)});if(_0x4a9943){if(_0x5983f3){if(_0x36f869&&_0x211a2f[_0x2051('0x18')]){_0xb23f69='queue';}else if(_0x211a2f[_0x2051('0x19')]){_0xb23f69=_0x2051('0x1a');}else{console['log'](_0x2051('0x1b'),_0x211a2f);}}else{_0xb23f69='unmanaged';}switch(_0x2eb232[_0x2051('0x13')][_0x2051('0x14')]()){case'zendesk':zendesk[_0xb23f69](_0x2eb232,_0x211a2f,_0x4a9943,_0x5983f3,_0x36f869,_0x545b16,_0x20df34);break;case'salesforce':salesforce[_0xb23f69](_0x2eb232,_0x211a2f,_0x4a9943,_0x5983f3,_0x36f869,_0x545b16,_0x20df34);break;case _0x2051('0xb'):sugarcrm[_0xb23f69](_0x2eb232,_0x211a2f,_0x4a9943,_0x5983f3,_0x36f869,_0x545b16,_0x20df34);break;case _0x2051('0xc'):freshdesk[_0xb23f69](_0x2eb232,_0x211a2f,_0x4a9943,_0x5983f3,_0x36f869,_0x545b16,_0x20df34);break;case _0x2051('0xd'):zoho[_0xb23f69](_0x2eb232,_0x211a2f,_0x4a9943,_0x5983f3,_0x36f869,_0x545b16,_0x20df34);break;case _0x2051('0xe'):desk[_0xb23f69](_0x2eb232,_0x211a2f,_0x4a9943,_0x5983f3,_0x36f869,_0x545b16,_0x20df34);break;case _0x2051('0xf'):vtiger[_0xb23f69](_0x2eb232,_0x211a2f,_0x4a9943,_0x5983f3,_0x36f869,_0x545b16,_0x20df34);break;case _0x2051('0x10'):freshsales['cs'](_0x2eb232,_0x211a2f,_0x4a9943,_0x5983f3,_0x36f869,_0x545b16,_0x20df34,_0xb23f69);break;case _0x2051('0x11'):servicenow['cs'](_0x2eb232,_0x211a2f,_0x4a9943,_0x5983f3,_0x36f869,_0x545b16,_0x20df34,_0xb23f69);break;case _0x2051('0x1c'):dynamics365['cs'](_0x2eb232,_0x211a2f,_0x4a9943,_0x5983f3,_0x36f869,_0x545b16,_0x20df34,_0xb23f69);break;default:console[_0x2051('0x1d')](_0x2051('0x1e'));}}else{_0x435fa9=require('../../../../config/logger')(_0x2eb232[_0x2051('0x13')][_0x2051('0x14')]());_0x435fa9[_0x2051('0x1f')](_0x2051('0x20'),util[_0x2051('0x21')](_0x2051('0x22'),_0x2eb232[_0x2051('0x13')]['toLowerCase'](),_0x2eb232[_0x2051('0x23')]));}}else{_0x435fa9=require(_0x2051('0x24'))(_0x2eb232[_0x2051('0x13')]['toLowerCase']());_0x435fa9[_0x2051('0x1f')]('[EXEC]',util['format'](_0x2051('0x25'),_0x2eb232[_0x2051('0x13')][_0x2051('0x14')](),_0x2eb232['data2']));}}else{}}catch(_0x16669e){console[_0x2051('0x1f')](_0x16669e);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index b33d45e..f0f713e 100644 --- a/server/services/ami/trigger/integration/salesforce.js +++ b/server/services/ami/trigger/integration/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd834=['resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','Lead','additionalSearchAccount','Account','additionalSearchLead','Phone','attributes','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','password','concat','securityToken','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','./util','salesforce','redis','localhost','emit','assign','getString','Subjects','Descriptions','Task','utc','IsReminderSet','contact','endUserType','lead','WhoId','WhatId','ticketType','ContactId','account','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','info'];(function(_0x25a602,_0xa6d233){var _0x4ce791=function(_0x27e7c8){while(--_0x27e7c8){_0x25a602['push'](_0x25a602['shift']());}};_0x4ce791(++_0xa6d233);}(_0xd834,0xd3));var _0x4d83=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd834[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x4d83('0x0'));var rp=require(_0x4d83('0x1'));var moment=require(_0x4d83('0x2'));var BPromise=require(_0x4d83('0x3'));var md5=require('md5');var jsforce=require(_0x4d83('0x4'));var util=require(_0x4d83('0x5'));var Redis=require('ioredis');var intUtil=require(_0x4d83('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4d83('0x7'));config[_0x4d83('0x8')]=_['defaults'](config[_0x4d83('0x8')],{'host':_0x4d83('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4d83('0x8')]));function emit(_0x2132d8,_0x578716,_0x53dde7){io['to'](_0x2132d8)[_0x4d83('0xa')](_0x578716,_0x53dde7);}function getTicket(_0x1d35ca,_0xb131e9,_0x58b986,_0x17624d,_0x2f6bb3,_0x389cbe,_0x12aee8,_0x30bd56){var _0x429ccb=Object[_0x4d83('0xb')]({},{'OwnerId':_0xb131e9['id'],'Subject':intUtil[_0x4d83('0xc')](_0x17624d[_0x4d83('0xd')],_0x2f6bb3,'\x20'),'Description':intUtil['getString'](_0x17624d[_0x4d83('0xe')],_0x2f6bb3,'\x0a')},getCustomFields(_0x389cbe,_0x2f6bb3));if(_0x58b986){if(_0x17624d['ticketType']===_0x4d83('0xf')){_0x429ccb['ActivityDate']=moment[_0x4d83('0x10')]();_0x429ccb[_0x4d83('0x11')]=![];_0x429ccb['IsRecurrence']=![];if(_0x58b986['endUserType']===_0x4d83('0x12')||_0x58b986[_0x4d83('0x13')]===_0x4d83('0x14')){_0x429ccb[_0x4d83('0x15')]=_0x58b986['id'];}else if(_0x58b986[_0x4d83('0x13')]==='account'){_0x429ccb[_0x4d83('0x16')]=_0x58b986['id'];}}else if(_0x17624d[_0x4d83('0x17')]==='Case'){if(_0x58b986[_0x4d83('0x13')]===_0x4d83('0x12')){_0x429ccb[_0x4d83('0x18')]=_0x58b986['id'];}else if(_0x58b986['endUserType']===_0x4d83('0x19')){_0x429ccb[_0x4d83('0x1a')]=_0x58b986['id'];}else if(_0x58b986[_0x4d83('0x13')]==='lead'&&_0x17624d[_0x4d83('0x1b')]){_0x429ccb[_0x17624d[_0x4d83('0x1b')]]=_0x58b986['id'];}else{logger['info'](_0x4d83('0x1c'));}}}return _0x12aee8[_0x4d83('0x1d')](_0x17624d[_0x4d83('0x17')])[_0x4d83('0x1e')](_0x429ccb);}function getUser(_0x3eb31e,_0x2144af,_0x3650db){if(!_[_0x4d83('0x1f')](_0x2144af)&&intUtil[_0x4d83('0x20')](_0x2144af)){var _0x255116={'Email':_0x2144af};var _0x4bbda0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3650db[_0x4d83('0x1d')](_0x4d83('0x21'))[_0x4d83('0x22')](_0x255116,_0x4bbda0)['execute']()[_0x4d83('0x23')](function(_0xbeffee){if(_0xbeffee[_0x4d83('0x24')]){var _0x2eeba2=_[_0x4d83('0x22')](_0xbeffee,function(_0x1a0e14){return _0x1a0e14[_0x4d83('0x25')]===_0x2144af;});if(_0x2eeba2){logger[_0x4d83('0x26')]('Agent\x20%s\x20found.',_0x2144af);return BPromise[_0x4d83('0x27')]({'id':_0x2eeba2['Id'],'name':_0x2eeba2['Name']});}}else{logger[_0x4d83('0x26')](_0x4d83('0x28'),_0x2144af);return _0x3650db[_0x4d83('0x29')]()[_0x4d83('0x23')](function(_0x53069d){return BPromise[_0x4d83('0x27')]({'id':_0x53069d[_0x4d83('0x2a')],'name':_0x53069d['display_name']});});}});}else{logger[_0x4d83('0x26')](_0x4d83('0x28'),_0x2144af);return _0x3650db['identity']()[_0x4d83('0x23')](function(_0x3c61df){return BPromise['resolve']({'id':_0x3c61df[_0x4d83('0x2a')],'name':_0x3c61df[_0x4d83('0x2b')]});});}}function getEndUser(_0x38fa00,_0x439449,_0x4acd50,_0xea5049,_0x338633){var _0x2268b6={'$or':{'Phone':_0xea5049}};var _0x568b4f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x4d83('0x23')](function(){logger['info'](_0x4d83('0x2c'),_0xea5049,_0x439449[_0x4d83('0x2d')]);switch(_0x439449[_0x4d83('0x2d')]){case _0x4d83('0x2e'):var _0x5eae83=_[_0x4d83('0x2f')](_0x2268b6);if(_0x439449[_0x4d83('0x30')]){var _0x3f5daa={};_0x3f5daa[_0x439449['additionalSearchContact']]=_0xea5049;_[_0x4d83('0x31')](_0x5eae83[_0x4d83('0x32')],_0x3f5daa);}return _0x338633[_0x4d83('0x1d')](_0x4d83('0x33'))[_0x4d83('0x22')](_0x5eae83,_0x568b4f)[_0x4d83('0x34')]()['then'](function(_0x371047){if(_0x371047&&_0x371047[_0x4d83('0x24')]){return _0x371047;}else{var _0xe788aa=_[_0x4d83('0x2f')](_0x2268b6);if(_0x439449['additionalSearchLead']){var _0x534406={};_0x534406[_0x439449['additionalSearchLead']]=_0xea5049;_[_0x4d83('0x31')](_0xe788aa['$or'],_0x534406);}return _0x338633['sobject'](_0x4d83('0x35'))[_0x4d83('0x22')](_0xe788aa,_0x568b4f);}});case'account_contact_lead':var _0x59a683=_[_0x4d83('0x2f')](_0x2268b6);if(_0x439449[_0x4d83('0x36')]){var _0x3f5daa={};_0x3f5daa[_0x439449[_0x4d83('0x36')]]=_0xea5049;_[_0x4d83('0x31')](_0x59a683[_0x4d83('0x32')],_0x3f5daa);}return _0x338633[_0x4d83('0x1d')](_0x4d83('0x37'))[_0x4d83('0x22')](_0x59a683,_0x568b4f)['execute']()[_0x4d83('0x23')](function(_0x5dfda1){if(_0x5dfda1&&_0x5dfda1['length']){return _0x5dfda1;}else{var _0x308b28=_[_0x4d83('0x2f')](_0x2268b6);if(_0x439449[_0x4d83('0x30')]){var _0x798d0e={};_0x798d0e[_0x439449['additionalSearchContact']]=_0xea5049;_['merge'](_0x308b28[_0x4d83('0x32')],_0x798d0e);}return _0x338633['sobject'](_0x4d83('0x33'))[_0x4d83('0x22')](_0x308b28,_0x568b4f)[_0x4d83('0x23')](function(_0x3893ed){if(_0x3893ed&&_0x3893ed[_0x4d83('0x24')]){return _0x3893ed;}else{var _0xaafb8c=_['cloneDeep'](_0x2268b6);if(_0x439449['additionalSearchLead']){var _0x480989={};_0x480989[_0x439449[_0x4d83('0x38')]]=_0xea5049;_[_0x4d83('0x31')](_0xaafb8c[_0x4d83('0x32')],_0x480989);}return _0x338633[_0x4d83('0x1d')](_0x4d83('0x35'))[_0x4d83('0x22')](_0xaafb8c,_0x568b4f);}});}});case _0x4d83('0x12'):var _0x5eae83=_[_0x4d83('0x2f')](_0x2268b6);if(_0x439449[_0x4d83('0x30')]){var _0x3f5daa={};_0x3f5daa[_0x439449[_0x4d83('0x30')]]=_0xea5049;_[_0x4d83('0x31')](_0x5eae83['$or'],_0x3f5daa);}return _0x338633[_0x4d83('0x1d')](_0x4d83('0x33'))[_0x4d83('0x22')](_0x5eae83,_0x568b4f)[_0x4d83('0x34')]();case _0x4d83('0x14'):var _0x57569d=_['cloneDeep'](_0x2268b6);if(_0x439449[_0x4d83('0x38')]){var _0x3f5daa={};_0x3f5daa[_0x439449[_0x4d83('0x38')]]=_0xea5049;_[_0x4d83('0x31')](_0x57569d['$or'],_0x3f5daa);}return _0x338633['sobject']('Lead')[_0x4d83('0x22')](_0x57569d,_0x568b4f);case _0x4d83('0x19'):var _0x59a683=_['cloneDeep'](_0x2268b6);if(_0x439449[_0x4d83('0x36')]){var _0x3f5daa={};_0x3f5daa[_0x439449['additionalSearchAccount']]=_0xea5049;_[_0x4d83('0x31')](_0x59a683[_0x4d83('0x32')],_0x3f5daa);}return _0x338633[_0x4d83('0x1d')]('Account')[_0x4d83('0x22')](_0x59a683,_0x568b4f);default:return null;}})[_0x4d83('0x23')](function(_0x55beae){if(_0x55beae&&_0x55beae[_0x4d83('0x24')]){var _0xb9e012=_['first'](_0x55beae);if(_0xb9e012){return BPromise[_0x4d83('0x27')]({'id':_0xb9e012['Id'],'name':_0xb9e012['Name'],'phone':_0xb9e012[_0x4d83('0x39')],'endUserType':_0xb9e012[_0x4d83('0x3a')]['type']['toLowerCase']()});}}})['then'](function(_0x2e8cac){if(_0x2e8cac){logger[_0x4d83('0x26')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x2e8cac['endUserType'],_0xea5049);return BPromise[_0x4d83('0x27')](_0x2e8cac);}else{logger[_0x4d83('0x26')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0xea5049);var _0x4fc233={'Phone':_0xea5049};if(_0x439449[_0x4d83('0x3b')]){if(_0x439449[_0x4d83('0x3b')]==='contact'){logger['info'](_0x4d83('0x3c'),_0xea5049,_0x439449[_0x4d83('0x3b')]);_0x4fc233[_0x4d83('0x3d')]=_0x4acd50!==''?_0x4acd50:util[_0x4d83('0x3e')](_0x4d83('0x3f'),_0xea5049);}else if(_0x439449[_0x4d83('0x3b')]===_0x4d83('0x14')){logger['info'](_0x4d83('0x3c'),_0xea5049,_0x439449[_0x4d83('0x3b')]);_0x4fc233[_0x4d83('0x3d')]=_0x4acd50!==_0x4d83('0x40')?_0x4acd50:util[_0x4d83('0x3e')]('Caller\x20-\x20%s',_0xea5049);_0x4fc233[_0x4d83('0x41')]=_0x4d83('0x42');}else if(_0x439449['moduleCreate']===_0x4d83('0x19')){logger[_0x4d83('0x26')](_0x4d83('0x3c'),_0xea5049,_0x439449[_0x4d83('0x3b')]);_0x4fc233['Name']=_0x4acd50!==_0x4d83('0x40')?_0x4acd50:util[_0x4d83('0x3e')](_0x4d83('0x3f'),_0xea5049);}else{return null;}}return _0x338633[_0x4d83('0x1d')](_['upperFirst'](_0x439449[_0x4d83('0x3b')]))[_0x4d83('0x1e')](_0x4fc233)[_0x4d83('0x23')](function(_0x458ed1){return BPromise[_0x4d83('0x27')]({'id':_0x458ed1['id'],'endUserType':_0x439449[_0x4d83('0x3b')]});});}});}function getCustomFields(_0x2b5850,_0x14a31d){var _0x3f4142={};if(_0x2b5850[_0x4d83('0x24')]>0x0){_[_0x4d83('0x43')](_0x2b5850,function(_0x4bd0de){if(_[_0x4d83('0x44')]([_0x4d83('0x45'),'picklist'],_0x4bd0de[_0x4d83('0x46')])&&_0x4bd0de['idField']){_0x3f4142[_0x4bd0de[_0x4d83('0x47')]]=_0x4bd0de[_0x4d83('0x48')][_0x4d83('0x49')]();}else if(_0x4bd0de[_0x4d83('0x46')]===_0x4d83('0x4a')&&_0x4bd0de[_0x4d83('0x4b')]&&_0x4bd0de[_0x4d83('0x47')]){_0x14a31d[_0x4bd0de[_0x4d83('0x4b')]]&&(_0x3f4142[_0x4bd0de[_0x4d83('0x47')]]=_0x14a31d[_0x4bd0de[_0x4d83('0x4b')]][_0x4d83('0x49')]());}else if(_0x4bd0de[_0x4d83('0x46')]===_0x4d83('0x4c')&&_0x4bd0de['Variable']&&_0x4bd0de['Variable'][_0x4d83('0x4d')]&&_0x4bd0de[_0x4d83('0x47')]){_0x14a31d[_0x4bd0de[_0x4d83('0x4e')][_0x4d83('0x4d')][_0x4d83('0x4f')]()]&&(_0x3f4142[_0x4bd0de[_0x4d83('0x47')]]=_0x14a31d[_0x4bd0de[_0x4d83('0x4e')][_0x4d83('0x4d')]['toLowerCase']()][_0x4d83('0x49')]());}});}return _0x3f4142;}function getConnection(_0xabf9bf){var _0x174ec1=_0xabf9bf[_0x4d83('0x50')][_0x4d83('0x51')](_0xabf9bf[_0x4d83('0x52')]);var _0x2ed382=new jsforce['Connection']({'oauth2':{'loginUrl':_0xabf9bf['remoteUri']||_0x4d83('0x53'),'clientId':_0xabf9bf['clientId'],'clientSecret':_0xabf9bf[_0x4d83('0x54')]}});return _0x2ed382[_0x4d83('0x55')](_0xabf9bf[_0x4d83('0x56')],_0x174ec1)[_0x4d83('0x23')](function(){logger['info'](_0x4d83('0x57'));return _0x2ed382;});}exports[_0x4d83('0x58')]=function(_0x3afc48,_0x3238fb,_0x433771,_0x23f06b,_0x53bd7d,_0x40cd2a){var _0x128cce,_0x5ca195,_0xc677df,_0x30149f;_0x40cd2a[_0x4d83('0x59')]=intUtil[_0x4d83('0x5a')](_0x40cd2a[_0x4d83('0x59')]);_0x40cd2a[_0x4d83('0x5b')]=intUtil[_0x4d83('0x5a')](_0x40cd2a['remoteUri']);if(_0x53bd7d&&_0x53bd7d[_0x4d83('0x5c')]){logger['info'](_0x4d83('0x5d'),_0x4d83('0x5e'));_0x3238fb[_0x4d83('0x5f')]=util[_0x4d83('0x3e')](_0x4d83('0x60'),_0x40cd2a[_0x4d83('0x59')],_0x3238fb['uniqueid'],md5(_0x3238fb[_0x4d83('0x61')]));}else{_0x3238fb[_0x4d83('0x5f')]='';}return getConnection(_0x40cd2a)[_0x4d83('0x23')](function(_0x1b24ab){_0x30149f=_0x1b24ab;return getUser(_0x40cd2a,_0x23f06b[_0x4d83('0x62')],_0x30149f);})[_0x4d83('0x23')](function(_0x1d17df){_0x128cce=_0x1d17df;return getEndUser(_0x40cd2a,_0x433771,_0x3238fb['calleridname'],_0x3238fb['calleridnum'],_0x30149f);})['then'](function(_0x59bce3){_0x5ca195=_0x59bce3;return getTicket(_0x40cd2a,_0x128cce,_0x5ca195,_0x433771,_0x3238fb,_0x433771[_0x4d83('0x63')],_0x30149f,_0x4d83('0x58'));})[_0x4d83('0x23')](function(_0x418118){_0xc677df=_0x418118;logger['info'](_0x4d83('0x64'),_0xc677df['id']);logger[_0x4d83('0x26')](_0x4d83('0x65'),_0xc677df['id'],_0x23f06b[_0x4d83('0x4d')],_0x40cd2a['type']);switch(_0x40cd2a[_0x4d83('0x46')]){case'integrationTab':emit(util['format']('user:%s',_0x23f06b[_0x4d83('0x4d')]),_0x4d83('0x66'),{'recordId':_0xc677df['id']});break;case _0x4d83('0x67'):emit(util[_0x4d83('0x3e')](_0x4d83('0x68'),_0x23f06b['name']),'trigger:browser:url',{'uri':util[_0x4d83('0x3e')](_0x4d83('0x69'),_0x30149f[_0x4d83('0x6a')],_0xc677df['id'])});break;default:logger[_0x4d83('0x6b')](_0x4d83('0x6c'));}})[_0x4d83('0x6d')](function(_0x31bed5){logger[_0x4d83('0x6b')](_0x4d83('0x5d'),_0x31bed5);});};exports[_0x4d83('0x6e')]=function(_0x17e11a,_0x4314e9,_0x45ee87,_0xcc773d,_0x40daed,_0x4f2eba,_0x28105e){var _0x49c49a,_0x5081a8,_0x48b9d0,_0x2309d7;_0x4f2eba['serverUrl']=intUtil[_0x4d83('0x5a')](_0x4f2eba[_0x4d83('0x59')]);_0x4f2eba[_0x4d83('0x5b')]=intUtil['stripTrailingSlash'](_0x4f2eba['remoteUri']);if(_0x28105e&&_0x28105e[_0x4d83('0x6f')]&&_0x28105e[_0x4d83('0x6f')]!==_0x4d83('0x70')){logger[_0x4d83('0x26')](_0x4d83('0x71'),_0x4d83('0x5e'));_0x4314e9['recordingURL']=util[_0x4d83('0x3e')](_0x4d83('0x60'),_0x4f2eba[_0x4d83('0x59')],_0x4314e9['uniqueid'],md5(_0x4314e9[_0x4d83('0x61')]));}return getConnection(_0x4f2eba)[_0x4d83('0x23')](function(_0x23db53){_0x2309d7=_0x23db53;return getUser(_0x4f2eba,_0xcc773d[_0x4d83('0x62')],_0x2309d7);})['then'](function(_0x13af01){_0x49c49a=_0x13af01;return getEndUser(_0x4f2eba,_0x45ee87,_0x4314e9[_0x4d83('0x72')],_0x4314e9[_0x4d83('0x73')],_0x2309d7);})[_0x4d83('0x23')](function(_0x235b39){_0x5081a8=_0x235b39;return getTicket(_0x4f2eba,_0x49c49a,_0x5081a8,_0x45ee87,_0x4314e9,_0x45ee87[_0x4d83('0x63')],_0x2309d7,_0x4d83('0x6e'));})[_0x4d83('0x23')](function(_0x508420){_0x48b9d0=_0x508420;logger[_0x4d83('0x26')](_0x4d83('0x74'),_0x48b9d0['id']);logger[_0x4d83('0x26')](_0x4d83('0x75'),_0x48b9d0['id'],_0xcc773d[_0x4d83('0x4d')],_0x4f2eba[_0x4d83('0x46')]);switch(_0x4f2eba[_0x4d83('0x46')]){case'integrationTab':emit(util['format'](_0x4d83('0x68'),_0xcc773d[_0x4d83('0x4d')]),'trigger:salesforce:display',{'recordId':_0x48b9d0['id']});break;case _0x4d83('0x67'):emit(util['format'](_0x4d83('0x68'),_0xcc773d[_0x4d83('0x4d')]),_0x4d83('0x76'),{'uri':util['format'](_0x4d83('0x69'),_0x2309d7[_0x4d83('0x6a')],_0x48b9d0['id'])});break;default:logger[_0x4d83('0x6b')](_0x4d83('0x71'),_0x4d83('0x77'));}})[_0x4d83('0x6d')](function(_0x1dea34){logger[_0x4d83('0x6b')](_0x4d83('0x71'),_0x1dea34);});};exports[_0x4d83('0x78')]=function(_0x5e806d,_0x4f4aae,_0x3fa754,_0x14c97f,_0x50370e,_0x2d5c42){var _0x2f41ae,_0x1cdf09,_0x2d87ae,_0x3cffdb;_0x2d5c42[_0x4d83('0x59')]=intUtil[_0x4d83('0x5a')](_0x2d5c42[_0x4d83('0x59')]);_0x2d5c42[_0x4d83('0x5b')]=intUtil[_0x4d83('0x5a')](_0x2d5c42[_0x4d83('0x5b')]);if(_0x50370e&&_0x50370e[_0x4d83('0x5c')]){logger['info']('['+_0x4f4aae[_0x4d83('0x79')][_0x4d83('0x7a')]()+']',_0x4d83('0x5e'));_0x4f4aae[_0x4d83('0x5f')]=util['format'](_0x4d83('0x60'),_0x2d5c42[_0x4d83('0x59')],_0x4f4aae[_0x4d83('0x61')],md5(_0x4f4aae[_0x4d83('0x61')]));}else{_0x4f4aae[_0x4d83('0x5f')]='';}return getConnection(_0x2d5c42)[_0x4d83('0x23')](function(_0x5649f7){_0x3cffdb=_0x5649f7;if(!_['isNil'](_0x14c97f)){return getUser(_0x2d5c42,_0x14c97f['name'],_0x3cffdb);}else{return getUser(_0x2d5c42,null,_0x3cffdb);}})[_0x4d83('0x23')](function(_0x48ca2b){_0x2f41ae=_0x48ca2b;return getEndUser(_0x2d5c42,_0x3fa754,_0x4f4aae[_0x4d83('0x7b')],_0x4f4aae['calleridnum'],_0x3cffdb);})['then'](function(_0x4bf117){_0x1cdf09=_0x4bf117;return getTicket(_0x2d5c42,_0x2f41ae,_0x1cdf09,_0x3fa754,_0x4f4aae,_0x3fa754[_0x4d83('0x63')],_0x3cffdb);})[_0x4d83('0x23')](function(_0x360d8f){_0x2d87ae=_0x360d8f;logger[_0x4d83('0x26')]('['+_0x4f4aae[_0x4d83('0x79')][_0x4d83('0x7a')]()+']\x20Ticket\x20%s\x20created.',_0x2d87ae['id']);logger[_0x4d83('0x26')]('['+_0x4f4aae[_0x4d83('0x79')][_0x4d83('0x7a')]()+_0x4d83('0x7c'),_0x2d5c42[_0x4d83('0x46')]);})['catch'](function(_0x46876e){logger[_0x4d83('0x6b')]('['+_0x4f4aae[_0x4d83('0x79')][_0x4d83('0x7a')]()+']',_0x46876e);});}; \ No newline at end of file +var _0x957d=['login','username','serverUrl','stripTrailingSlash','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','Recording\x20is\x20enabled!','toUpperCase','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','localhost','socket.io-emitter','redis','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','find','execute','then','length','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','clientSecret'];(function(_0x1b26ac,_0x5ea577){var _0x2d88ec=function(_0x4d6110){while(--_0x4d6110){_0x1b26ac['push'](_0x1b26ac['shift']());}};_0x2d88ec(++_0x5ea577);}(_0x957d,0xaa));var _0xd957=function(_0x5d340f,_0x4bf781){_0x5d340f=_0x5d340f-0x0;var _0x59931c=_0x957d[_0x5d340f];return _0x59931c;};'use strict';var _=require('lodash');var rp=require(_0xd957('0x0'));var moment=require(_0xd957('0x1'));var BPromise=require(_0xd957('0x2'));var md5=require(_0xd957('0x3'));var jsforce=require(_0xd957('0x4'));var util=require(_0xd957('0x5'));var Redis=require(_0xd957('0x6'));var intUtil=require(_0xd957('0x7'));var config=require(_0xd957('0x8'));var logger=require(_0xd957('0x9'))(_0xd957('0xa'));config['redis']=_[_0xd957('0xb')](config['redis'],{'host':_0xd957('0xc'),'port':0x18eb});var io=require(_0xd957('0xd'))(new Redis(config[_0xd957('0xe')]));function emit(_0x307ad9,_0x586ef7,_0x34d107){io['to'](_0x307ad9)[_0xd957('0xf')](_0x586ef7,_0x34d107);}function getTicket(_0x198e7f,_0x4f02e9,_0x528b9d,_0x316f00,_0x540338,_0x17e9d6,_0x28f3b5,_0x5af8a){var _0x168dac=Object[_0xd957('0x10')]({},{'OwnerId':_0x4f02e9['id'],'Subject':intUtil[_0xd957('0x11')](_0x316f00[_0xd957('0x12')],_0x540338,'\x20'),'Description':intUtil['getString'](_0x316f00[_0xd957('0x13')],_0x540338,'\x0a')},getCustomFields(_0x17e9d6,_0x540338));if(_0x528b9d){if(_0x316f00[_0xd957('0x14')]==='Task'){_0x168dac[_0xd957('0x15')]=moment[_0xd957('0x16')]();_0x168dac[_0xd957('0x17')]=![];_0x168dac[_0xd957('0x18')]=![];if(_0x528b9d[_0xd957('0x19')]===_0xd957('0x1a')||_0x528b9d[_0xd957('0x19')]===_0xd957('0x1b')){_0x168dac[_0xd957('0x1c')]=_0x528b9d['id'];}else if(_0x528b9d[_0xd957('0x19')]===_0xd957('0x1d')){_0x168dac[_0xd957('0x1e')]=_0x528b9d['id'];}}else if(_0x316f00[_0xd957('0x14')]===_0xd957('0x1f')){if(_0x528b9d[_0xd957('0x19')]==='contact'){_0x168dac[_0xd957('0x20')]=_0x528b9d['id'];}else if(_0x528b9d[_0xd957('0x19')]===_0xd957('0x1d')){_0x168dac[_0xd957('0x21')]=_0x528b9d['id'];}else if(_0x528b9d[_0xd957('0x19')]===_0xd957('0x1b')&&_0x316f00[_0xd957('0x22')]){_0x168dac[_0x316f00[_0xd957('0x22')]]=_0x528b9d['id'];}else{logger[_0xd957('0x23')](_0xd957('0x24'));}}}return _0x28f3b5['sobject'](_0x316f00[_0xd957('0x14')])[_0xd957('0x25')](_0x168dac);}function getUser(_0x3fa29a,_0x2856c7,_0x7bb145){if(!_[_0xd957('0x26')](_0x2856c7)&&intUtil[_0xd957('0x27')](_0x2856c7)){var _0x494c1c={'Email':_0x2856c7};var _0x4fe5a2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x7bb145[_0xd957('0x28')]('User')[_0xd957('0x29')](_0x494c1c,_0x4fe5a2)[_0xd957('0x2a')]()[_0xd957('0x2b')](function(_0xbd5c57){if(_0xbd5c57[_0xd957('0x2c')]){var _0x4e76d6=_[_0xd957('0x29')](_0xbd5c57,function(_0xe674d9){return _0xe674d9['Email']===_0x2856c7;});if(_0x4e76d6){logger['info']('Agent\x20%s\x20found.',_0x2856c7);return BPromise[_0xd957('0x2d')]({'id':_0x4e76d6['Id'],'name':_0x4e76d6[_0xd957('0x2e')]});}}else{logger[_0xd957('0x23')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2856c7);return _0x7bb145[_0xd957('0x2f')]()[_0xd957('0x2b')](function(_0x407d7b){return BPromise[_0xd957('0x2d')]({'id':_0x407d7b[_0xd957('0x30')],'name':_0x407d7b[_0xd957('0x31')]});});}});}else{logger[_0xd957('0x23')](_0xd957('0x32'),_0x2856c7);return _0x7bb145['identity']()[_0xd957('0x2b')](function(_0x51da4e){return BPromise[_0xd957('0x2d')]({'id':_0x51da4e[_0xd957('0x30')],'name':_0x51da4e['display_name']});});}}function getEndUser(_0x260452,_0x559062,_0x262191,_0x27b392,_0x57bb92){var _0x610f7e={'$or':{'Phone':_0x27b392}};var _0x39061d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd957('0x2d')]()['then'](function(){logger[_0xd957('0x23')](_0xd957('0x33'),_0x27b392,_0x559062[_0xd957('0x34')]);switch(_0x559062[_0xd957('0x34')]){case _0xd957('0x35'):var _0x4261f2=_[_0xd957('0x36')](_0x610f7e);if(_0x559062['additionalSearchContact']){var _0x1e0263={};_0x1e0263[_0x559062[_0xd957('0x37')]]=_0x27b392;_[_0xd957('0x38')](_0x4261f2[_0xd957('0x39')],_0x1e0263);}return _0x57bb92[_0xd957('0x28')](_0xd957('0x3a'))[_0xd957('0x29')](_0x4261f2,_0x39061d)[_0xd957('0x2a')]()['then'](function(_0x42c423){if(_0x42c423&&_0x42c423[_0xd957('0x2c')]){return _0x42c423;}else{var _0x51674d=_[_0xd957('0x36')](_0x610f7e);if(_0x559062[_0xd957('0x3b')]){var _0x5ae287={};_0x5ae287[_0x559062[_0xd957('0x3b')]]=_0x27b392;_[_0xd957('0x38')](_0x51674d['$or'],_0x5ae287);}return _0x57bb92[_0xd957('0x28')](_0xd957('0x3c'))['find'](_0x51674d,_0x39061d);}});case _0xd957('0x3d'):var _0x1fde0b=_[_0xd957('0x36')](_0x610f7e);if(_0x559062[_0xd957('0x3e')]){var _0x1e0263={};_0x1e0263[_0x559062[_0xd957('0x3e')]]=_0x27b392;_[_0xd957('0x38')](_0x1fde0b[_0xd957('0x39')],_0x1e0263);}return _0x57bb92[_0xd957('0x28')]('Account')[_0xd957('0x29')](_0x1fde0b,_0x39061d)['execute']()['then'](function(_0x17a7fe){if(_0x17a7fe&&_0x17a7fe['length']){return _0x17a7fe;}else{var _0x4a5bba=_[_0xd957('0x36')](_0x610f7e);if(_0x559062[_0xd957('0x37')]){var _0x5151a3={};_0x5151a3[_0x559062[_0xd957('0x37')]]=_0x27b392;_[_0xd957('0x38')](_0x4a5bba[_0xd957('0x39')],_0x5151a3);}return _0x57bb92['sobject']('Contact')[_0xd957('0x29')](_0x4a5bba,_0x39061d)[_0xd957('0x2b')](function(_0x2d1b97){if(_0x2d1b97&&_0x2d1b97['length']){return _0x2d1b97;}else{var _0x5b2e66=_['cloneDeep'](_0x610f7e);if(_0x559062[_0xd957('0x3b')]){var _0x576e89={};_0x576e89[_0x559062[_0xd957('0x3b')]]=_0x27b392;_[_0xd957('0x38')](_0x5b2e66[_0xd957('0x39')],_0x576e89);}return _0x57bb92[_0xd957('0x28')](_0xd957('0x3c'))[_0xd957('0x29')](_0x5b2e66,_0x39061d);}});}});case'contact':var _0x4261f2=_['cloneDeep'](_0x610f7e);if(_0x559062['additionalSearchContact']){var _0x1e0263={};_0x1e0263[_0x559062['additionalSearchContact']]=_0x27b392;_[_0xd957('0x38')](_0x4261f2[_0xd957('0x39')],_0x1e0263);}return _0x57bb92['sobject'](_0xd957('0x3a'))['find'](_0x4261f2,_0x39061d)[_0xd957('0x2a')]();case'lead':var _0x73fa0d=_[_0xd957('0x36')](_0x610f7e);if(_0x559062['additionalSearchLead']){var _0x1e0263={};_0x1e0263[_0x559062[_0xd957('0x3b')]]=_0x27b392;_['merge'](_0x73fa0d[_0xd957('0x39')],_0x1e0263);}return _0x57bb92[_0xd957('0x28')](_0xd957('0x3c'))['find'](_0x73fa0d,_0x39061d);case _0xd957('0x1d'):var _0x1fde0b=_[_0xd957('0x36')](_0x610f7e);if(_0x559062['additionalSearchAccount']){var _0x1e0263={};_0x1e0263[_0x559062[_0xd957('0x3e')]]=_0x27b392;_['merge'](_0x1fde0b[_0xd957('0x39')],_0x1e0263);}return _0x57bb92[_0xd957('0x28')](_0xd957('0x3f'))[_0xd957('0x29')](_0x1fde0b,_0x39061d);default:return null;}})['then'](function(_0x28c68f){if(_0x28c68f&&_0x28c68f['length']){var _0x11d5d3=_[_0xd957('0x40')](_0x28c68f);if(_0x11d5d3){return BPromise[_0xd957('0x2d')]({'id':_0x11d5d3['Id'],'name':_0x11d5d3['Name'],'phone':_0x11d5d3[_0xd957('0x41')],'endUserType':_0x11d5d3[_0xd957('0x42')][_0xd957('0x43')][_0xd957('0x44')]()});}}})[_0xd957('0x2b')](function(_0x459aaf){if(_0x459aaf){logger['info'](_0xd957('0x45'),_0x459aaf[_0xd957('0x19')],_0x27b392);return BPromise['resolve'](_0x459aaf);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x27b392);var _0x45601d={'Phone':_0x27b392};if(_0x559062['moduleCreate']){if(_0x559062[_0xd957('0x46')]==='contact'){logger[_0xd957('0x23')](_0xd957('0x47'),_0x27b392,_0x559062[_0xd957('0x46')]);_0x45601d[_0xd957('0x48')]=_0x262191!==_0xd957('0x49')?_0x262191:util[_0xd957('0x4a')](_0xd957('0x4b'),_0x27b392);}else if(_0x559062[_0xd957('0x46')]==='lead'){logger[_0xd957('0x23')](_0xd957('0x47'),_0x27b392,_0x559062[_0xd957('0x46')]);_0x45601d['LastName']=_0x262191!==''?_0x262191:util[_0xd957('0x4a')](_0xd957('0x4b'),_0x27b392);_0x45601d[_0xd957('0x4c')]=_0xd957('0x4d');}else if(_0x559062[_0xd957('0x46')]===_0xd957('0x1d')){logger['info'](_0xd957('0x47'),_0x27b392,_0x559062[_0xd957('0x46')]);_0x45601d[_0xd957('0x2e')]=_0x262191!==_0xd957('0x49')?_0x262191:util[_0xd957('0x4a')]('Caller\x20-\x20%s',_0x27b392);}else{return null;}}return _0x57bb92['sobject'](_['upperFirst'](_0x559062['moduleCreate']))[_0xd957('0x25')](_0x45601d)['then'](function(_0x58c3f0){return BPromise[_0xd957('0x2d')]({'id':_0x58c3f0['id'],'endUserType':_0x559062[_0xd957('0x46')]});});}});}function getCustomFields(_0x5e2556,_0x29af23){var _0x4e08c1={};if(_0x5e2556[_0xd957('0x2c')]>0x0){_['forEach'](_0x5e2556,function(_0x8b702d){if(_[_0xd957('0x4e')]([_0xd957('0x4f'),_0xd957('0x50')],_0x8b702d[_0xd957('0x43')])&&_0x8b702d[_0xd957('0x51')]){_0x4e08c1[_0x8b702d[_0xd957('0x51')]]=_0x8b702d[_0xd957('0x52')][_0xd957('0x53')]();}else if(_0x8b702d[_0xd957('0x43')]===_0xd957('0x54')&&_0x8b702d[_0xd957('0x55')]&&_0x8b702d[_0xd957('0x51')]){_0x29af23[_0x8b702d[_0xd957('0x55')]]&&(_0x4e08c1[_0x8b702d['idField']]=_0x29af23[_0x8b702d[_0xd957('0x55')]]['toString']());}else if(_0x8b702d[_0xd957('0x43')]===_0xd957('0x56')&&_0x8b702d[_0xd957('0x57')]&&_0x8b702d[_0xd957('0x57')][_0xd957('0x58')]&&_0x8b702d[_0xd957('0x51')]){_0x29af23[_0x8b702d['Variable'][_0xd957('0x58')][_0xd957('0x44')]()]&&(_0x4e08c1[_0x8b702d[_0xd957('0x51')]]=_0x29af23[_0x8b702d['Variable'][_0xd957('0x58')][_0xd957('0x44')]()][_0xd957('0x53')]());}});}return _0x4e08c1;}function getConnection(_0x581f4c){var _0x5832dc=_0x581f4c[_0xd957('0x59')][_0xd957('0x5a')](_0x581f4c['securityToken']);var _0x58d23b=new jsforce[(_0xd957('0x5b'))]({'oauth2':{'loginUrl':_0x581f4c[_0xd957('0x5c')]||'https://login.salesforce.com','clientId':_0x581f4c['clientId'],'clientSecret':_0x581f4c[_0xd957('0x5d')]}});return _0x58d23b[_0xd957('0x5e')](_0x581f4c[_0xd957('0x5f')],_0x5832dc)[_0xd957('0x2b')](function(){logger['info']('Connection\x20established.');return _0x58d23b;});}exports['queue']=function(_0x41b365,_0x1e494f,_0x258f1e,_0x549dfc,_0x2e678d,_0x3ada97){var _0x2eaa8e,_0x53248c,_0x486cb8,_0x281997;_0x3ada97[_0xd957('0x60')]=intUtil[_0xd957('0x61')](_0x3ada97[_0xd957('0x60')]);_0x3ada97[_0xd957('0x5c')]=intUtil[_0xd957('0x61')](_0x3ada97[_0xd957('0x5c')]);if(_0x2e678d&&_0x2e678d['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x1e494f[_0xd957('0x62')]=util[_0xd957('0x4a')](_0xd957('0x63'),_0x3ada97[_0xd957('0x60')],_0x1e494f['uniqueid'],md5(_0x1e494f[_0xd957('0x64')]));}else{_0x1e494f[_0xd957('0x62')]='';}return getConnection(_0x3ada97)[_0xd957('0x2b')](function(_0x4c7c1){_0x281997=_0x4c7c1;return getUser(_0x3ada97,_0x549dfc[_0xd957('0x65')],_0x281997);})['then'](function(_0x29641f){_0x2eaa8e=_0x29641f;return getEndUser(_0x3ada97,_0x258f1e,_0x1e494f[_0xd957('0x66')],_0x1e494f[_0xd957('0x67')],_0x281997);})[_0xd957('0x2b')](function(_0x22641e){_0x53248c=_0x22641e;return getTicket(_0x3ada97,_0x2eaa8e,_0x53248c,_0x258f1e,_0x1e494f,_0x258f1e[_0xd957('0x68')],_0x281997,_0xd957('0x69'));})['then'](function(_0x2aae15){_0x486cb8=_0x2aae15;logger[_0xd957('0x23')](_0xd957('0x6a'),_0x486cb8['id']);logger[_0xd957('0x23')](_0xd957('0x6b'),_0x486cb8['id'],_0x549dfc[_0xd957('0x58')],_0x3ada97[_0xd957('0x43')]);switch(_0x3ada97[_0xd957('0x43')]){case'integrationTab':emit(util[_0xd957('0x4a')](_0xd957('0x6c'),_0x549dfc[_0xd957('0x58')]),'trigger:salesforce:display',{'recordId':_0x486cb8['id']});break;case _0xd957('0x6d'):emit(util['format'](_0xd957('0x6c'),_0x549dfc['name']),_0xd957('0x6e'),{'uri':util[_0xd957('0x4a')](_0xd957('0x6f'),_0x281997[_0xd957('0x70')],_0x486cb8['id'])});break;default:logger[_0xd957('0x71')](_0xd957('0x72'));}})[_0xd957('0x73')](function(_0x40f729){logger[_0xd957('0x71')](_0xd957('0x74'),_0x40f729);});};exports[_0xd957('0x75')]=function(_0x4c11f2,_0x21317f,_0x246819,_0x1ffeba,_0x56298a,_0x586e2b,_0x40542b){var _0x4140a4,_0x1a570a,_0x2ef6ec,_0x1eaed7;_0x586e2b[_0xd957('0x60')]=intUtil[_0xd957('0x61')](_0x586e2b[_0xd957('0x60')]);_0x586e2b['remoteUri']=intUtil[_0xd957('0x61')](_0x586e2b['remoteUri']);if(_0x40542b&&_0x40542b['recordingFormat']&&_0x40542b[_0xd957('0x76')]!==_0xd957('0x77')){logger[_0xd957('0x23')](_0xd957('0x78'),'Recording\x20is\x20enabled!');_0x21317f[_0xd957('0x62')]=util['format'](_0xd957('0x63'),_0x586e2b['serverUrl'],_0x21317f[_0xd957('0x64')],md5(_0x21317f[_0xd957('0x64')]));}return getConnection(_0x586e2b)[_0xd957('0x2b')](function(_0x246236){_0x1eaed7=_0x246236;return getUser(_0x586e2b,_0x1ffeba[_0xd957('0x65')],_0x1eaed7);})[_0xd957('0x2b')](function(_0x48b204){_0x4140a4=_0x48b204;return getEndUser(_0x586e2b,_0x246819,_0x21317f[_0xd957('0x79')],_0x21317f[_0xd957('0x7a')],_0x1eaed7);})['then'](function(_0x8340){_0x1a570a=_0x8340;return getTicket(_0x586e2b,_0x4140a4,_0x1a570a,_0x246819,_0x21317f,_0x246819[_0xd957('0x68')],_0x1eaed7,'outbound');})[_0xd957('0x2b')](function(_0x50d676){_0x2ef6ec=_0x50d676;logger[_0xd957('0x23')](_0xd957('0x7b'),_0x2ef6ec['id']);logger[_0xd957('0x23')](_0xd957('0x7c'),_0x2ef6ec['id'],_0x1ffeba['name'],_0x586e2b[_0xd957('0x43')]);switch(_0x586e2b[_0xd957('0x43')]){case _0xd957('0x7d'):emit(util['format']('user:%s',_0x1ffeba['name']),_0xd957('0x7e'),{'recordId':_0x2ef6ec['id']});break;case _0xd957('0x6d'):emit(util[_0xd957('0x4a')](_0xd957('0x6c'),_0x1ffeba['name']),_0xd957('0x6e'),{'uri':util[_0xd957('0x4a')](_0xd957('0x6f'),_0x1eaed7[_0xd957('0x70')],_0x2ef6ec['id'])});break;default:logger[_0xd957('0x71')]('[OUTBOUND]',_0xd957('0x7f'));}})[_0xd957('0x73')](function(_0x5cd609){logger[_0xd957('0x71')](_0xd957('0x78'),_0x5cd609);});};exports[_0xd957('0x80')]=function(_0x77ecea,_0x172cbd,_0x650a1d,_0x488b9d,_0x21ad87,_0x298d13){var _0x283665,_0x13c200,_0x301110,_0x1ef730;_0x298d13['serverUrl']=intUtil[_0xd957('0x61')](_0x298d13[_0xd957('0x60')]);_0x298d13[_0xd957('0x5c')]=intUtil['stripTrailingSlash'](_0x298d13[_0xd957('0x5c')]);if(_0x21ad87&&_0x21ad87['monitor_format']){logger[_0xd957('0x23')]('['+_0x172cbd[_0xd957('0x81')]['toUpperCase']()+']',_0xd957('0x82'));_0x172cbd['recordingURL']=util[_0xd957('0x4a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x298d13[_0xd957('0x60')],_0x172cbd['uniqueid'],md5(_0x172cbd[_0xd957('0x64')]));}else{_0x172cbd['recordingURL']='';}return getConnection(_0x298d13)[_0xd957('0x2b')](function(_0x11c520){_0x1ef730=_0x11c520;if(!_[_0xd957('0x26')](_0x488b9d)){return getUser(_0x298d13,_0x488b9d[_0xd957('0x58')],_0x1ef730);}else{return getUser(_0x298d13,null,_0x1ef730);}})[_0xd957('0x2b')](function(_0x366c1e){_0x283665=_0x366c1e;return getEndUser(_0x298d13,_0x650a1d,_0x172cbd[_0xd957('0x66')],_0x172cbd['calleridnum'],_0x1ef730);})[_0xd957('0x2b')](function(_0x2b000b){_0x13c200=_0x2b000b;return getTicket(_0x298d13,_0x283665,_0x13c200,_0x650a1d,_0x172cbd,_0x650a1d[_0xd957('0x68')],_0x1ef730);})[_0xd957('0x2b')](function(_0x29e310){_0x301110=_0x29e310;logger['info']('['+_0x172cbd['lastevent'][_0xd957('0x83')]()+']\x20Ticket\x20%s\x20created.',_0x301110['id']);logger[_0xd957('0x23')]('['+_0x172cbd[_0xd957('0x81')][_0xd957('0x83')]()+']\x20Integration\x20account\x20type\x20%s.',_0x298d13[_0xd957('0x43')]);})[_0xd957('0x73')](function(_0x5c45b5){logger[_0xd957('0x71')]('['+_0x172cbd[_0xd957('0x81')]['toUpperCase']()+']',_0x5c45b5);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 6b8e9e2..4f8db7f 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3c1=['sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','toLowerCase','content','toString','string','idField','customField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','label_entry','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0xb3c1,0xb5));var _0x1b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1b3c('0x0'));var Promise=require(_0x1b3c('0x1'));var rp=require(_0x1b3c('0x2'));var util=require(_0x1b3c('0x3'));var md5=require(_0x1b3c('0x4'));var Redis=require(_0x1b3c('0x5'));var intUtil=require(_0x1b3c('0x6'));var config=require(_0x1b3c('0x7'));var logger=require('../../../../config/logger')(_0x1b3c('0x8'));config[_0x1b3c('0x9')]=_['defaults'](config[_0x1b3c('0x9')],{'host':_0x1b3c('0xa'),'port':0x18eb});var io=require(_0x1b3c('0xb'))(new Redis(config['redis']));function getAdminUser(_0x3a3ef6,_0x45bc8e,_0x2a41c9,_0x287c85,_0x3b1920,_0x2ca6b0){return new Promise(function(_0x118ad9,_0x5e944){var _0xb7018e={'method':'GET','uri':_0x287c85+_0x1b3c('0xc')+'&'+_0x3b1920+'&'+_0x2ca6b0,'auth':_0x45bc8e,'json':!![]};return rp(_0xb7018e)['then'](function(_0x124613){if(_0x124613[_0x1b3c('0xd')][_0x1b3c('0xe')]>0x0){_0x2a41c9[_0x1b3c('0xf')]=_0x124613[_0x1b3c('0xd')][0x0][_0x1b3c('0x10')];}logger[_0x1b3c('0x11')]('['+[_0x3a3ef6[_0x1b3c('0x12')]()]+_0x1b3c('0x13'),_0x2a41c9);_0x118ad9(_0x2a41c9);})[_0x1b3c('0x14')](function(_0x526047){logger[_0x1b3c('0x15')]('['+[_0x3a3ef6['toUpperCase']()]+']',_0x526047['message']);_0x5e944(_0x526047[_0x1b3c('0x16')]);});});}function getUser(_0x17ff85,_0x3743d8,_0x202b6f,_0x1b91a6,_0x253dd2){return function(_0x4d7726){logger['info']('['+[_0x17ff85[_0x1b3c('0x12')]()]+_0x1b3c('0x17'),_0x4d7726);return new Promise(function(_0x4072f8,_0x2c3f16){if(intUtil[_0x1b3c('0x18')](_0x4d7726[_0x1b3c('0x19')])){var _0x5de931={'method':'GET','uri':_0x202b6f+_0x1b3c('0x1a')+_0x4d7726['userEmail']+'&'+_0x1b91a6+'&'+_0x253dd2,'auth':_0x3743d8,'json':!![]};logger['info']('['+[_0x17ff85[_0x1b3c('0x12')]()]+_0x1b3c('0x1b'),_0x5de931);return rp(_0x5de931)[_0x1b3c('0x1c')](function(_0x4f8d57){logger['info']('['+[_0x17ff85[_0x1b3c('0x12')]()]+_0x1b3c('0x1d'),_0x4f8d57);if(_0x4f8d57[_0x1b3c('0xd')][_0x1b3c('0xe')]>0x0&&String(_0x4f8d57['result'][0x0]['active'])===_0x1b3c('0x1e')){_0x4d7726[_0x1b3c('0x1f')]=_0x4f8d57[_0x1b3c('0xd')][0x0][_0x1b3c('0x10')];}else{_0x4d7726[_0x1b3c('0x1f')]=_0x4d7726['adminId'];_0x4d7726['userEmail']=_0x4d7726[_0x1b3c('0x20')];}logger[_0x1b3c('0x11')]('['+[_0x17ff85[_0x1b3c('0x12')]()]+_0x1b3c('0x21'),_0x4d7726);_0x4072f8(_0x4d7726);})[_0x1b3c('0x14')](function(_0x201f9f){logger[_0x1b3c('0x15')]('['+[_0x17ff85[_0x1b3c('0x12')]()]+']',_0x201f9f['message']);_0x2c3f16(_0x201f9f[_0x1b3c('0x16')]);});}else{logger[_0x1b3c('0x11')]('['+[_0x17ff85[_0x1b3c('0x12')]()]+_0x1b3c('0x22'));_0x4d7726['userId']=_0x4d7726['adminId'];_0x4d7726[_0x1b3c('0x19')]=_0x4d7726[_0x1b3c('0x20')];_0x4072f8(_0x4d7726);}});};}function createEndUser(_0x504a3d,_0x5e91dd,_0x2e7807,_0x560c0f,_0x545af4){logger[_0x1b3c('0x11')]('['+[_0x504a3d[_0x1b3c('0x12')]()]+'],\x20createEndUser\x20input\x20crm',_0x2e7807);return new Promise(function(_0x4a5909,_0x1b1145){var _0xe61023={'method':'POST','uri':_0x560c0f+_0x1b3c('0x23')+_0x545af4,'body':{'user_name':_0x2e7807[_0x1b3c('0x24')],'roles':_0x1b3c('0x25'),'first_name':_0x2e7807[_0x1b3c('0x24')],'active':_0x1b3c('0x1e'),'date_format':_0x1b3c('0x26'),'phone':_0x2e7807[_0x1b3c('0x24')]},'auth':_0x5e91dd,'json':!![]};return rp(_0xe61023)[_0x1b3c('0x1c')](function(_0x459e49){logger[_0x1b3c('0x11')]('['+[_0x504a3d[_0x1b3c('0x12')]()]+'],\x20EndUser\x20schema',_0x459e49[_0x1b3c('0xd')]);_0x2e7807[_0x1b3c('0x27')]=_0x459e49[_0x1b3c('0xd')][_0x1b3c('0x10')];_0x4a5909(_0x2e7807);})['catch'](function(_0x3197bf){logger['error']('['+[_0x504a3d['toUpperCase']()]+']',_0x3197bf['message']);_0x1b1145(_0x3197bf['message']);});});}function getEndUser(_0x25424b,_0x431430,_0x1733be,_0x135c0c,_0xd32b17){return function(_0x261eba){logger['info']('['+[_0x25424b[_0x1b3c('0x12')]()]+_0x1b3c('0x28'),_0x261eba);return new Promise(function(_0x8efe95,_0x16e206){var _0x485f63={'method':_0x1b3c('0x29'),'uri':_0x1733be+_0x1b3c('0x2a')+_0x261eba[_0x1b3c('0x24')]+'&'+_0x135c0c+'&'+_0xd32b17,'auth':_0x431430,'json':!![]};return rp(_0x485f63)['then'](function(_0x56df5c){if(_0x56df5c[_0x1b3c('0xd')][_0x1b3c('0xe')]>0x0){_0x261eba['endUserId']=_0x56df5c[_0x1b3c('0xd')][0x0][_0x1b3c('0x10')];logger[_0x1b3c('0x11')]('['+[_0x25424b[_0x1b3c('0x12')]()]+_0x1b3c('0x2b'),_0x261eba);_0x8efe95(_0x261eba);}else{return createEndUser(_0x25424b,_0x431430,_0x261eba,_0x1733be,_0x135c0c)[_0x1b3c('0x1c')](function(_0x5e6940){logger[_0x1b3c('0x11')]('['+[_0x25424b['toUpperCase']()]+_0x1b3c('0x2c'),_0x5e6940);_0x8efe95(_0x5e6940);});}})[_0x1b3c('0x14')](function(_0x2dd114){logger[_0x1b3c('0x15')]('['+[_0x25424b[_0x1b3c('0x12')]()]+']',_0x2dd114['message']);_0x16e206(_0x2dd114[_0x1b3c('0x16')]);});});};}function getCustomFields(_0x571957,_0x4890f9){var _0x22768a={};if(_0x571957['length']>0x0){_[_0x1b3c('0x2d')](_0x571957,function(_0x2a9c9e){if(_[_0x1b3c('0x2e')](['string',_0x1b3c('0x2f')],_0x2a9c9e[_0x1b3c('0x30')])&&_0x2a9c9e[_0x1b3c('0x31')]&&!_0x2a9c9e['customField']){_0x22768a[_0x2a9c9e['nameField'][_0x1b3c('0x32')]()]=_0x2a9c9e[_0x1b3c('0x33')][_0x1b3c('0x34')]();}else if(_[_0x1b3c('0x2e')]([_0x1b3c('0x35'),_0x1b3c('0x2f')],_0x2a9c9e[_0x1b3c('0x30')])&&_0x2a9c9e[_0x1b3c('0x36')]&&_0x2a9c9e[_0x1b3c('0x37')]){_0x22768a[_0x2a9c9e[_0x1b3c('0x36')][_0x1b3c('0x32')]()]=_0x2a9c9e[_0x1b3c('0x33')][_0x1b3c('0x34')]();}else if(_0x2a9c9e[_0x1b3c('0x30')]==='variable'&&_0x2a9c9e[_0x1b3c('0x38')]&&_0x2a9c9e[_0x1b3c('0x36')]&&_0x2a9c9e[_0x1b3c('0x37')]){_0x22768a[_0x2a9c9e[_0x1b3c('0x36')][_0x1b3c('0x32')]()]=_0x4890f9[_0x2a9c9e[_0x1b3c('0x38')]][_0x1b3c('0x34')]();}else if(_0x2a9c9e['type']===_0x1b3c('0x39')&&_0x2a9c9e[_0x1b3c('0x3a')]&&_0x2a9c9e[_0x1b3c('0x3a')][_0x1b3c('0x3b')]&&_0x2a9c9e[_0x1b3c('0x36')]&&_0x2a9c9e[_0x1b3c('0x37')]){_0x22768a[_0x2a9c9e[_0x1b3c('0x36')][_0x1b3c('0x32')]()]=_0x4890f9[_0x2a9c9e['Variable'][_0x1b3c('0x3b')][_0x1b3c('0x32')]()][_0x1b3c('0x34')]();}});}return _0x22768a;}function getTicket(_0x23c81b,_0x442298,_0x27abaa,_0x169786,_0x4c25d4,_0x377aa1){return function(_0x590f99){logger[_0x1b3c('0x11')]('['+[_0x23c81b['toUpperCase']()]+_0x1b3c('0x3c'),_0x590f99);return new Promise(function(_0x3d6d17,_0x3029b7){var _0x7ec99a=_0x23c81b['toLowerCase']()===_0x1b3c('0x3d')?_0x590f99['userId']:_0x590f99[_0x1b3c('0x27')];var _0x218fe2={'method':'POST','uri':_0x27abaa+_0x1b3c('0x3e')+'?'+_0x377aa1,'body':Object[_0x1b3c('0x3f')]({},{'active':_0x1b3c('0x1e'),'caller_id':_0x7ec99a,'assigned_to':_0x590f99['userId'],'short_description':intUtil[_0x1b3c('0x40')](_0x169786[_0x1b3c('0x41')],_0x4c25d4,'\x20'),'description':intUtil['getString'](_0x169786[_0x1b3c('0x42')],_0x4c25d4,'\x0a')},getCustomFields(_0x169786[_0x1b3c('0x43')],_0x4c25d4)),'auth':_0x442298,'json':!![]};return rp(_0x218fe2)['then'](function(_0x8330ae){logger[_0x1b3c('0x11')]('['+[_0x23c81b[_0x1b3c('0x12')]()]+_0x1b3c('0x44'),_0x8330ae['result']);_0x590f99[_0x1b3c('0x45')]=_0x8330ae['result']['sys_id'];_0x590f99['ticketNumber']=_0x8330ae[_0x1b3c('0xd')]['number'];logger[_0x1b3c('0x11')]('['+[_0x23c81b[_0x1b3c('0x12')]()]+_0x1b3c('0x46'),_0x590f99);_0x3d6d17(_0x590f99);})['catch'](function(_0x14905c){logger[_0x1b3c('0x15')]('['+[_0x23c81b[_0x1b3c('0x12')]()]+']',_0x14905c[_0x1b3c('0x16')]);_0x3029b7(_0x14905c[_0x1b3c('0x16')]);});});};}function createRemoteTag(_0x3baafc,_0x753dc3,_0x5f2471,_0x3e3306){return new Promise(function(_0x3dacaf,_0x57efe8){var _0x23e460={'method':'POST','uri':_0x5f2471+_0x1b3c('0x47')+'?'+_0x3e3306,'body':{'short_description':_0x3baafc,'global':!![],'active':!![],'name':_0x3baafc},'auth':_0x753dc3,'json':!![]};return rp(_0x23e460)[_0x1b3c('0x1c')](function(_0x479503){var _0x405638=_0x479503[_0x1b3c('0xd')][_0x1b3c('0x10')];_0x3dacaf(_0x405638);});});}function getRemoteTag(_0x2a81da,_0x474904,_0x5cccf2,_0x370ff0,_0x44f184){return new Promise(function(_0x2111e0,_0x12330a){var _0x21765a={'method':'GET','uri':_0x5cccf2+_0x1b3c('0x47')+'?sysparm_query=name%3D'+_0x2a81da+'&'+_0x370ff0,'auth':_0x474904,'json':!![]};return rp(_0x21765a)[_0x1b3c('0x1c')](function(_0x13865e){if(_0x13865e[_0x1b3c('0xd')][_0x1b3c('0xe')]>0x0){var _0x4500c0=_0x13865e['result'][0x0][_0x1b3c('0x10')];_0x2111e0(_0x4500c0);}else{return createRemoteTag(_0x2a81da,_0x474904,_0x5cccf2,_0x370ff0)[_0x1b3c('0x1c')](function(_0x4c4b3f){_0x2111e0(_0x4c4b3f);});}});});}function assignTagToIncident(_0x4797f7,_0x46a0a3,_0x2a1088,_0x208c58,_0x383ce0){return new Promise(function(_0x120d7a,_0x1dcc7c){var _0x4016d7={'method':'POST','uri':_0x2a1088+_0x1b3c('0x48')+'?'+_0x383ce0,'body':{'label':_0x4797f7,'table':_0x1b3c('0x3e'),'id_type':'Incident','table_key':_0x208c58[_0x1b3c('0x45')],'title':_0x1b3c('0x49')+_0x208c58['ticketNumber'],'id_display':_0x208c58[_0x1b3c('0x4a')]},'auth':_0x46a0a3,'json':!![]};return rp(_0x4016d7)['then'](function(_0x1e2968){_0x120d7a();})[_0x1b3c('0x14')](function(){_0x120d7a();});});}function manageTags(_0x1180b9,_0x52a9cf,_0x2dca8a,_0x39e15b,_0x571f77,_0x45ff2b,_0x159c00){return new Promise(function(_0x1dfe0f,_0x5f4f47){var _0x4255e7=[];_0x52a9cf[_0x1b3c('0x2d')](function(_0x245022){_0x4255e7[_0x1b3c('0x4b')](getRemoteTag(_0x245022,_0x2dca8a,_0x39e15b,_0x45ff2b,_0x159c00));});return Promise[_0x1b3c('0x4c')](_0x4255e7)['then'](function(_0x149d67){if(_0x149d67[_0x1b3c('0xe')]){logger[_0x1b3c('0x11')]('['+[_0x1180b9['toUpperCase']()]+_0x1b3c('0x4d'),_0x149d67);var _0xcfad1f=[];_0x149d67['forEach'](function(_0x3cd12e){_0xcfad1f[_0x1b3c('0x4b')](assignTagToIncident(_0x3cd12e,_0x2dca8a,_0x39e15b,_0x571f77,_0x45ff2b));});return Promise[_0x1b3c('0x4c')](_0xcfad1f)['then'](function(){_0x1dfe0f();})[_0x1b3c('0x14')](function(){_0x1dfe0f();});}else{_0x1dfe0f();}});});}function getTags(_0x11c752,_0x3e1931,_0x4c1523,_0x44a520,_0x1fcb06,_0x4d9550){return function(_0x5c796b){return new Promise(function(_0x527bce,_0x1b35e4){var _0x53fb0c=[];var _0x4daaf3=_0x44a520['Tags'];if(_0x4daaf3&&_0x4daaf3[_0x1b3c('0xe')]>0x0){_0x53fb0c=_[_0x1b3c('0x4e')](_0x4daaf3,'name');}if(_0x53fb0c[_0x1b3c('0xe')]>0x0){return manageTags(_0x11c752,_0x53fb0c,_0x3e1931,_0x4c1523,_0x5c796b,_0x1fcb06,_0x4d9550)[_0x1b3c('0x1c')](function(){_0x527bce(_0x5c796b);});}else{_0x527bce(_0x5c796b);}});};}function emit(_0x3a0a03,_0x4b9d92,_0x2b1bd2){var _0x454c30=_0x1b3c('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x1b3c('0x50')+_0x1b3c('0x51');var _0x47856e={'uri':_0x3a0a03+_0x1b3c('0x52')+_0x2b1bd2+_0x454c30};io['to'](util[_0x1b3c('0x53')](_0x1b3c('0x54'),_0x4b9d92))['emit']('trigger:browser:url',_0x47856e);}exports['cs']=function(_0x3a0fdb,_0x447ea5,_0x5f5386,_0x5e7327,_0xe7c518,_0x274b63,_0x4e1739,_0x49710f){var _0x440e2d={};var _0x579230={'user':_0x274b63[_0x1b3c('0x55')],'pass':_0x274b63['password']};var _0xdea741=_0x1b3c('0x56');var _0x459489=_0x1b3c('0x57');_0x274b63[_0x1b3c('0x58')]=intUtil[_0x1b3c('0x59')](_0x274b63[_0x1b3c('0x58')]);_0x274b63['serverUrl']=intUtil['stripTrailingSlash'](_0x274b63['serverUrl']);var _0x475f33=util[_0x1b3c('0x53')](_0x1b3c('0x5a'),_0x274b63['remoteUri']);_0x440e2d[_0x1b3c('0x19')]=!_[_0x1b3c('0x5b')](_0x5e7327)?_0x5e7327[_0x1b3c('0x5c')]:null;_0x440e2d[_0x1b3c('0x20')]=_0x274b63['email'];_0x440e2d[_0x1b3c('0x24')]=_0x49710f['toLowerCase']()==='outbound'?_0x447ea5['destcalleridnum']:_0x447ea5[_0x1b3c('0x5d')];_0x440e2d[_0x1b3c('0x5e')]=_0x49710f==='queue'||_0x49710f===_0x1b3c('0x5f')?_0x1b3c('0x60'):'outbound';var _0x46de13=util[_0x1b3c('0x53')](_0x1b3c('0x61'),_0x274b63['serverUrl'],_0x447ea5[_0x1b3c('0x62')],md5(_0x447ea5[_0x1b3c('0x62')]));if(_0xe7c518&&_0xe7c518['monitor_format']){logger['info'](_0x1b3c('0x63'),_0x1b3c('0x64'));_0x447ea5[_0x1b3c('0x65')]=_0x46de13;}else if(_0x4e1739&&_0x4e1739[_0x1b3c('0x66')]&&_0x4e1739[_0x1b3c('0x66')]!==_0x1b3c('0x67')){logger[_0x1b3c('0x11')](_0x1b3c('0x68'),_0x1b3c('0x64'));_0x447ea5['recordingURL']=_0x46de13;}else{_0x447ea5[_0x1b3c('0x65')]='';}return getAdminUser(_0x49710f,_0x579230,_0x440e2d,_0x475f33,_0x459489,_0xdea741)[_0x1b3c('0x1c')](getUser(_0x49710f,_0x579230,_0x475f33,_0x459489,_0xdea741))[_0x1b3c('0x1c')](getEndUser(_0x49710f,_0x579230,_0x475f33,_0x459489,_0xdea741))['then'](getTicket(_0x49710f,_0x579230,_0x475f33,_0x5f5386,_0x447ea5,_0x459489))[_0x1b3c('0x1c')](function(_0x3fce47){logger[_0x1b3c('0x11')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3fce47[_0x1b3c('0x45')]));logger[_0x1b3c('0x11')](util['format'](_0x1b3c('0x69'),_0x49710f));if(_0x49710f!==_0x1b3c('0x5f')){logger[_0x1b3c('0x11')]('['+[_0x49710f['toUpperCase']()]+']',_0x1b3c('0x6a'));emit(_0x274b63[_0x1b3c('0x58')],_0x5e7327[_0x1b3c('0x3b')],_0x3fce47[_0x1b3c('0x45')]);}})[_0x1b3c('0x14')](function(_0x5b4235){logger[_0x1b3c('0x15')]('['+[_0x49710f['toUpperCase']()]+_0x1b3c('0x6b'),util['inspect'](_0x5b4235,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x49d7=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','ticketId',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','md5','./util','../../../../config/logger','servicenow','redis','localhost','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','error','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','content','idField','toLowerCase','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','GET','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid'];(function(_0x563cca,_0x5beec6){var _0x4c9ddd=function(_0x108cf9){while(--_0x108cf9){_0x563cca['push'](_0x563cca['shift']());}};_0x4c9ddd(++_0x5beec6);}(_0x49d7,0x14e));var _0x749d=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0x49d7[_0x13992d];return _0x3d15bf;};'use strict';var _=require(_0x749d('0x0'));var Promise=require('bluebird');var rp=require(_0x749d('0x1'));var util=require('util');var md5=require(_0x749d('0x2'));var Redis=require('ioredis');var intUtil=require(_0x749d('0x3'));var config=require('../../../../config/environment');var logger=require(_0x749d('0x4'))(_0x749d('0x5'));config[_0x749d('0x6')]=_['defaults'](config[_0x749d('0x6')],{'host':_0x749d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x749d('0x6')]));function getAdminUser(_0x34901c,_0x4e2413,_0x4076f3,_0x45ac56,_0x20faeb,_0x36e0a6){return new Promise(function(_0x23f6c6,_0x2e80b6){var _0x24e397={'method':'GET','uri':_0x45ac56+_0x749d('0x8')+'&'+_0x20faeb+'&'+_0x36e0a6,'auth':_0x4e2413,'json':!![]};return rp(_0x24e397)['then'](function(_0x3c8b35){if(_0x3c8b35[_0x749d('0x9')][_0x749d('0xa')]>0x0){_0x4076f3[_0x749d('0xb')]=_0x3c8b35[_0x749d('0x9')][0x0][_0x749d('0xc')];}logger[_0x749d('0xd')]('['+[_0x34901c[_0x749d('0xe')]()]+_0x749d('0xf'),_0x4076f3);_0x23f6c6(_0x4076f3);})[_0x749d('0x10')](function(_0xf17b93){logger['error']('['+[_0x34901c[_0x749d('0xe')]()]+']',_0xf17b93['message']);_0x2e80b6(_0xf17b93[_0x749d('0x11')]);});});}function getUser(_0x1cd8f3,_0x459612,_0x1b0cbd,_0x5c1cdc,_0x585a3c){return function(_0x246166){logger[_0x749d('0xd')]('['+[_0x1cd8f3[_0x749d('0xe')]()]+_0x749d('0x12'),_0x246166);return new Promise(function(_0x27d0c2,_0x1344e4){if(intUtil[_0x749d('0x13')](_0x246166[_0x749d('0x14')])){var _0x4442ac={'method':'GET','uri':_0x1b0cbd+_0x749d('0x15')+_0x246166[_0x749d('0x14')]+'&'+_0x5c1cdc+'&'+_0x585a3c,'auth':_0x459612,'json':!![]};logger[_0x749d('0xd')]('['+[_0x1cd8f3[_0x749d('0xe')]()]+_0x749d('0x16'),_0x4442ac);return rp(_0x4442ac)[_0x749d('0x17')](function(_0x5ee9dc){logger['info']('['+[_0x1cd8f3[_0x749d('0xe')]()]+_0x749d('0x18'),_0x5ee9dc);if(_0x5ee9dc[_0x749d('0x9')][_0x749d('0xa')]>0x0&&String(_0x5ee9dc[_0x749d('0x9')][0x0][_0x749d('0x19')])===_0x749d('0x1a')){_0x246166[_0x749d('0x1b')]=_0x5ee9dc[_0x749d('0x9')][0x0][_0x749d('0xc')];}else{_0x246166[_0x749d('0x1b')]=_0x246166[_0x749d('0xb')];_0x246166[_0x749d('0x14')]=_0x246166[_0x749d('0x1c')];}logger[_0x749d('0xd')]('['+[_0x1cd8f3[_0x749d('0xe')]()]+_0x749d('0x1d'),_0x246166);_0x27d0c2(_0x246166);})[_0x749d('0x10')](function(_0x35161a){logger[_0x749d('0x1e')]('['+[_0x1cd8f3[_0x749d('0xe')]()]+']',_0x35161a[_0x749d('0x11')]);_0x1344e4(_0x35161a['message']);});}else{logger[_0x749d('0xd')]('['+[_0x1cd8f3[_0x749d('0xe')]()]+']\x20using\x20admin\x20profile');_0x246166[_0x749d('0x1b')]=_0x246166[_0x749d('0xb')];_0x246166[_0x749d('0x14')]=_0x246166[_0x749d('0x1c')];_0x27d0c2(_0x246166);}});};}function createEndUser(_0x38117a,_0x223411,_0x4f8779,_0x5e9cc6,_0x2c35ff){logger[_0x749d('0xd')]('['+[_0x38117a['toUpperCase']()]+_0x749d('0x1f'),_0x4f8779);return new Promise(function(_0x5af499,_0x3ceeb4){var _0x3ce992={'method':_0x749d('0x20'),'uri':_0x5e9cc6+_0x749d('0x21')+_0x2c35ff,'body':{'user_name':_0x4f8779[_0x749d('0x22')],'roles':'user','first_name':_0x4f8779[_0x749d('0x22')],'active':_0x749d('0x1a'),'date_format':_0x749d('0x23'),'phone':_0x4f8779[_0x749d('0x22')]},'auth':_0x223411,'json':!![]};return rp(_0x3ce992)['then'](function(_0x21e4b2){logger[_0x749d('0xd')]('['+[_0x38117a[_0x749d('0xe')]()]+_0x749d('0x24'),_0x21e4b2[_0x749d('0x9')]);_0x4f8779[_0x749d('0x25')]=_0x21e4b2['result'][_0x749d('0xc')];_0x5af499(_0x4f8779);})['catch'](function(_0x303a83){logger['error']('['+[_0x38117a[_0x749d('0xe')]()]+']',_0x303a83[_0x749d('0x11')]);_0x3ceeb4(_0x303a83[_0x749d('0x11')]);});});}function getEndUser(_0x32297f,_0x202b59,_0x3feaf9,_0x41e85f,_0x16e457){return function(_0x552fad){logger['info']('['+[_0x32297f[_0x749d('0xe')]()]+'],\x20getEndUser\x20input\x20crm',_0x552fad);return new Promise(function(_0x3c2684,_0x3e2490){var _0x36c99b={'method':'GET','uri':_0x3feaf9+_0x749d('0x26')+_0x552fad[_0x749d('0x22')]+'&'+_0x41e85f+'&'+_0x16e457,'auth':_0x202b59,'json':!![]};return rp(_0x36c99b)[_0x749d('0x17')](function(_0x2020c9){if(_0x2020c9[_0x749d('0x9')][_0x749d('0xa')]>0x0){_0x552fad[_0x749d('0x25')]=_0x2020c9[_0x749d('0x9')][0x0][_0x749d('0xc')];logger['info']('['+[_0x32297f[_0x749d('0xe')]()]+_0x749d('0x27'),_0x552fad);_0x3c2684(_0x552fad);}else{return createEndUser(_0x32297f,_0x202b59,_0x552fad,_0x3feaf9,_0x41e85f)['then'](function(_0x4dfdea){logger[_0x749d('0xd')]('['+[_0x32297f['toUpperCase']()]+_0x749d('0x28'),_0x4dfdea);_0x3c2684(_0x4dfdea);});}})['catch'](function(_0x36c648){logger[_0x749d('0x1e')]('['+[_0x32297f['toUpperCase']()]+']',_0x36c648[_0x749d('0x11')]);_0x3e2490(_0x36c648[_0x749d('0x11')]);});});};}function getCustomFields(_0x2c608b,_0xde7138){var _0x2e3531={};if(_0x2c608b[_0x749d('0xa')]>0x0){_[_0x749d('0x29')](_0x2c608b,function(_0x2ddef8){if(_[_0x749d('0x2a')]([_0x749d('0x2b'),_0x749d('0x2c')],_0x2ddef8[_0x749d('0x2d')])&&_0x2ddef8[_0x749d('0x2e')]&&!_0x2ddef8[_0x749d('0x2f')]){_0x2e3531[_0x2ddef8[_0x749d('0x2e')]['toLowerCase']()]=_0x2ddef8[_0x749d('0x30')]['toString']();}else if(_[_0x749d('0x2a')](['string',_0x749d('0x2c')],_0x2ddef8[_0x749d('0x2d')])&&_0x2ddef8[_0x749d('0x31')]&&_0x2ddef8[_0x749d('0x2f')]){_0x2e3531[_0x2ddef8['idField'][_0x749d('0x32')]()]=_0x2ddef8[_0x749d('0x30')][_0x749d('0x33')]();}else if(_0x2ddef8[_0x749d('0x2d')]===_0x749d('0x34')&&_0x2ddef8[_0x749d('0x35')]&&_0x2ddef8[_0x749d('0x31')]&&_0x2ddef8[_0x749d('0x2f')]){_0x2e3531[_0x2ddef8[_0x749d('0x31')][_0x749d('0x32')]()]=_0xde7138[_0x2ddef8[_0x749d('0x35')]][_0x749d('0x33')]();}else if(_0x2ddef8[_0x749d('0x2d')]===_0x749d('0x36')&&_0x2ddef8['Variable']&&_0x2ddef8[_0x749d('0x37')][_0x749d('0x38')]&&_0x2ddef8['idField']&&_0x2ddef8[_0x749d('0x2f')]){_0x2e3531[_0x2ddef8[_0x749d('0x31')][_0x749d('0x32')]()]=_0xde7138[_0x2ddef8[_0x749d('0x37')][_0x749d('0x38')][_0x749d('0x32')]()][_0x749d('0x33')]();}});}return _0x2e3531;}function getTicket(_0x5a7fad,_0x34747b,_0x57709d,_0x5f4b94,_0x53d1be,_0x57be61){return function(_0x429ae2){logger['info']('['+[_0x5a7fad[_0x749d('0xe')]()]+_0x749d('0x39'),_0x429ae2);return new Promise(function(_0x249d88,_0x42a33d){var _0x2742a7=_0x5a7fad['toLowerCase']()===_0x749d('0x3a')?_0x429ae2[_0x749d('0x1b')]:_0x429ae2[_0x749d('0x25')];var _0x58670e={'method':_0x749d('0x20'),'uri':_0x57709d+'incident'+'?'+_0x57be61,'body':Object['assign']({},{'active':'true','caller_id':_0x2742a7,'assigned_to':_0x429ae2[_0x749d('0x1b')],'short_description':intUtil[_0x749d('0x3b')](_0x5f4b94[_0x749d('0x3c')],_0x53d1be,'\x20'),'description':intUtil['getString'](_0x5f4b94[_0x749d('0x3d')],_0x53d1be,'\x0a')},getCustomFields(_0x5f4b94[_0x749d('0x3e')],_0x53d1be)),'auth':_0x34747b,'json':!![]};return rp(_0x58670e)[_0x749d('0x17')](function(_0x1eff86){logger['info']('['+[_0x5a7fad['toUpperCase']()]+_0x749d('0x3f'),_0x1eff86[_0x749d('0x9')]);_0x429ae2['ticketId']=_0x1eff86['result'][_0x749d('0xc')];_0x429ae2[_0x749d('0x40')]=_0x1eff86[_0x749d('0x9')][_0x749d('0x41')];logger[_0x749d('0xd')]('['+[_0x5a7fad[_0x749d('0xe')]()]+_0x749d('0x42'),_0x429ae2);_0x249d88(_0x429ae2);})[_0x749d('0x10')](function(_0xa5786c){logger['error']('['+[_0x5a7fad[_0x749d('0xe')]()]+']',_0xa5786c[_0x749d('0x11')]);_0x42a33d(_0xa5786c[_0x749d('0x11')]);});});};}function createRemoteTag(_0x35383c,_0x58c44,_0x52db6b,_0x6849ea){return new Promise(function(_0xbeb319,_0x302fdb){var _0x4d027d={'method':_0x749d('0x20'),'uri':_0x52db6b+_0x749d('0x43')+'?'+_0x6849ea,'body':{'short_description':_0x35383c,'global':!![],'active':!![],'name':_0x35383c},'auth':_0x58c44,'json':!![]};return rp(_0x4d027d)[_0x749d('0x17')](function(_0x1f3fbc){var _0x81de2=_0x1f3fbc['result'][_0x749d('0xc')];_0xbeb319(_0x81de2);});});}function getRemoteTag(_0x56b6dc,_0x4a2f79,_0x510b51,_0x46e97d,_0x178f26){return new Promise(function(_0x4209fc,_0x30a1a5){var _0x1fdb25={'method':_0x749d('0x44'),'uri':_0x510b51+_0x749d('0x43')+_0x749d('0x45')+_0x56b6dc+'&'+_0x46e97d,'auth':_0x4a2f79,'json':!![]};return rp(_0x1fdb25)[_0x749d('0x17')](function(_0x23c754){if(_0x23c754['result'][_0x749d('0xa')]>0x0){var _0x12f48e=_0x23c754[_0x749d('0x9')][0x0]['sys_id'];_0x4209fc(_0x12f48e);}else{return createRemoteTag(_0x56b6dc,_0x4a2f79,_0x510b51,_0x46e97d)[_0x749d('0x17')](function(_0x25519f){_0x4209fc(_0x25519f);});}});});}function assignTagToIncident(_0x26fa70,_0x574e61,_0x3c0e46,_0x513f77,_0x44decd){return new Promise(function(_0x24ea7d,_0x4d3ec8){var _0x5c0d60={'method':'POST','uri':_0x3c0e46+_0x749d('0x46')+'?'+_0x44decd,'body':{'label':_0x26fa70,'table':_0x749d('0x47'),'id_type':_0x749d('0x48'),'table_key':_0x513f77['ticketId'],'title':_0x749d('0x49')+_0x513f77[_0x749d('0x40')],'id_display':_0x513f77[_0x749d('0x40')]},'auth':_0x574e61,'json':!![]};return rp(_0x5c0d60)[_0x749d('0x17')](function(_0x426430){_0x24ea7d();})[_0x749d('0x10')](function(){_0x24ea7d();});});}function manageTags(_0xabc237,_0x35886c,_0x3ae0fc,_0x3decc5,_0x8ed4ae,_0x86d51e,_0xfe5a5c){return new Promise(function(_0x1ad3d8,_0x4c2477){var _0x3dc36e=[];_0x35886c[_0x749d('0x29')](function(_0x1cbee2){_0x3dc36e['push'](getRemoteTag(_0x1cbee2,_0x3ae0fc,_0x3decc5,_0x86d51e,_0xfe5a5c));});return Promise[_0x749d('0x4a')](_0x3dc36e)['then'](function(_0x8384c0){if(_0x8384c0[_0x749d('0xa')]){logger[_0x749d('0xd')]('['+[_0xabc237[_0x749d('0xe')]()]+_0x749d('0x4b'),_0x8384c0);var _0x24bcfa=[];_0x8384c0['forEach'](function(_0x40b9ed){_0x24bcfa[_0x749d('0x4c')](assignTagToIncident(_0x40b9ed,_0x3ae0fc,_0x3decc5,_0x8ed4ae,_0x86d51e));});return Promise['all'](_0x24bcfa)[_0x749d('0x17')](function(){_0x1ad3d8();})[_0x749d('0x10')](function(){_0x1ad3d8();});}else{_0x1ad3d8();}});});}function getTags(_0x4231f0,_0x2d83e4,_0x34981e,_0xa79105,_0x342cff,_0x184c21){return function(_0x4d3ca8){return new Promise(function(_0x1be808,_0x1959b3){var _0x12ff53=[];var _0x36b594=_0xa79105['Tags'];if(_0x36b594&&_0x36b594[_0x749d('0xa')]>0x0){_0x12ff53=_[_0x749d('0x4d')](_0x36b594,_0x749d('0x38'));}if(_0x12ff53[_0x749d('0xa')]>0x0){return manageTags(_0x4231f0,_0x12ff53,_0x2d83e4,_0x34981e,_0x4d3ca8,_0x342cff,_0x184c21)[_0x749d('0x17')](function(){_0x1be808(_0x4d3ca8);});}else{_0x1be808(_0x4d3ca8);}});};}function emit(_0x3af448,_0x2e9be9,_0x6a55ef){var _0x38da79='%26sysparm_record_target%3Dincident'+_0x749d('0x4e')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x749d('0x4f');var _0x3f10be={'uri':_0x3af448+_0x749d('0x50')+_0x6a55ef+_0x38da79};io['to'](util[_0x749d('0x51')](_0x749d('0x52'),_0x2e9be9))['emit'](_0x749d('0x53'),_0x3f10be);}exports['cs']=function(_0xba2082,_0x3bf5c0,_0x11073a,_0x4809b0,_0x256741,_0x54a84d,_0x2eafd8,_0x4292c5){var _0x197f11={};var _0x390760={'user':_0x54a84d[_0x749d('0x54')],'pass':_0x54a84d['password']};var _0x1277fc=_0x749d('0x55');var _0x46a0d3=_0x749d('0x56');_0x54a84d[_0x749d('0x57')]=intUtil['stripTrailingSlash'](_0x54a84d[_0x749d('0x57')]);_0x54a84d['serverUrl']=intUtil['stripTrailingSlash'](_0x54a84d['serverUrl']);var _0xa3851f=util[_0x749d('0x51')](_0x749d('0x58'),_0x54a84d['remoteUri']);_0x197f11['userEmail']=!_[_0x749d('0x59')](_0x4809b0)?_0x4809b0[_0x749d('0x5a')]:null;_0x197f11[_0x749d('0x1c')]=_0x54a84d[_0x749d('0x5a')];_0x197f11[_0x749d('0x22')]=_0x4292c5[_0x749d('0x32')]()===_0x749d('0x3a')?_0x3bf5c0[_0x749d('0x5b')]:_0x3bf5c0['calleridnum'];_0x197f11[_0x749d('0x5c')]=_0x4292c5===_0x749d('0x5d')||_0x4292c5===_0x749d('0x5e')?_0x749d('0x5d'):_0x749d('0x3a');var _0x477c78=util[_0x749d('0x51')](_0x749d('0x5f'),_0x54a84d[_0x749d('0x60')],_0x3bf5c0['uniqueid'],md5(_0x3bf5c0[_0x749d('0x61')]));if(_0x256741&&_0x256741['monitor_format']){logger[_0x749d('0xd')](_0x749d('0x62'),_0x749d('0x63'));_0x3bf5c0[_0x749d('0x64')]=_0x477c78;}else if(_0x2eafd8&&_0x2eafd8[_0x749d('0x65')]&&_0x2eafd8[_0x749d('0x65')]!==_0x749d('0x66')){logger[_0x749d('0xd')]('[OUTBOUND]',_0x749d('0x63'));_0x3bf5c0[_0x749d('0x64')]=_0x477c78;}else{_0x3bf5c0['recordingURL']='';}return getAdminUser(_0x4292c5,_0x390760,_0x197f11,_0xa3851f,_0x46a0d3,_0x1277fc)[_0x749d('0x17')](getUser(_0x4292c5,_0x390760,_0xa3851f,_0x46a0d3,_0x1277fc))[_0x749d('0x17')](getEndUser(_0x4292c5,_0x390760,_0xa3851f,_0x46a0d3,_0x1277fc))[_0x749d('0x17')](getTicket(_0x4292c5,_0x390760,_0xa3851f,_0x11073a,_0x3bf5c0,_0x46a0d3))[_0x749d('0x17')](function(_0x4a0781){logger[_0x749d('0xd')](util[_0x749d('0x51')](_0x749d('0x67'),_0x4a0781['ticketId']));logger[_0x749d('0xd')](util[_0x749d('0x51')](_0x749d('0x68'),_0x4292c5));if(_0x4292c5!=='unmanaged'){logger['info']('['+[_0x4292c5['toUpperCase']()]+']',_0x749d('0x69'));emit(_0x54a84d['remoteUri'],_0x4809b0[_0x749d('0x38')],_0x4a0781[_0x749d('0x6a')]);}})[_0x749d('0x10')](function(_0x3ae9ea){logger[_0x749d('0x1e')]('['+[_0x4292c5[_0x749d('0xe')]()]+_0x749d('0x6b'),util['inspect'](_0x3ae9ea,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index b7065d0..8e4d6af 100644 --- a/server/services/ami/trigger/integration/sugarcrm.js +++ b/server/services/ami/trigger/integration/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbadb=['Calls','format','Basic\x20%s','apiKey','get_server_info','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','string','nameField','toLowerCase','toString','type','custom_fields','content','variable','customField','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','lastevent','toUpperCase','isNil','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','push','idField','variableName','JSON','stringify'];(function(_0x2df578,_0x312ee6){var _0x319a3b=function(_0x1a1a17){while(--_0x1a1a17){_0x2df578['push'](_0x2df578['shift']());}};_0x319a3b(++_0x312ee6);}(_0xbadb,0x153));var _0xbbad=function(_0x1d1953,_0x202abd){_0x1d1953=_0x1d1953-0x0;var _0x188b44=_0xbadb[_0x1d1953];return _0x188b44;};'use strict';var _=require(_0xbbad('0x0'));var rp=require('request-promise');var BPromise=require(_0xbbad('0x1'));var md5=require(_0xbbad('0x2'));var util=require(_0xbbad('0x3'));var Redis=require(_0xbbad('0x4'));var intUtil=require(_0xbbad('0x5'));var config=require(_0xbbad('0x6'));var logger=require(_0xbbad('0x7'))(_0xbbad('0x8'));config[_0xbbad('0x9')]=_[_0xbbad('0xa')](config[_0xbbad('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xbbad('0xb'))(new Redis(config[_0xbbad('0x9')]));var def={'method':_0xbbad('0xc'),'json':!![]};function emit(_0x582a6c,_0x341b56,_0x2c0fa2){io['to'](_0x582a6c)[_0xbbad('0xd')](_0x341b56,_0x2c0fa2);}function getTicket(_0xd2f6d9,_0x260a33,_0x22e89a,_0x508549,_0x1d6537,_0x5a3ce5,_0x16d56a,_0x39d5ba){logger[_0xbbad('0xe')](_0xbbad('0xf'));var _0x28750f=new Date();var _0x3e28b9=[{'name':_0xbbad('0x10'),'value':intUtil[_0xbbad('0x11')](_0x508549[_0xbbad('0x12')],_0x1d6537,'\x20')},{'name':_0xbbad('0x13'),'value':_0x260a33['id']},{'name':'created_by','value':_0x260a33['id']},{'name':_0xbbad('0x14'),'value':intUtil['getString'](_0x508549[_0xbbad('0x15')],_0x1d6537,'\x0a')},{'name':'date_start','value':_0x28750f[_0xbbad('0x16')]()['slice'](0x0,0x13)[_0xbbad('0x17')]('T','\x20')},{'name':_0xbbad('0x18'),'value':'0'},{'name':_0xbbad('0x19'),'value':'15'},{'name':_0xbbad('0x1a'),'value':_0x22e89a['id']},{'name':_0xbbad('0x1b'),'value':'Contacts'},{'name':_0xbbad('0x1c'),'value':_0x22e89a[_0xbbad('0x10')]},{'name':_0xbbad('0x1d'),'value':_0x39d5ba}];if(_0x5a3ce5['length']){_[_0xbbad('0x1e')](_0x5a3ce5,function(_0x29214e){if(_0x1d6537[_0x29214e['variableName']]){_0x3e28b9[_0xbbad('0x1f')]({'name':_0x29214e[_0xbbad('0x20')],'value':_0x1d6537[_0x29214e[_0xbbad('0x21')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xbbad('0x22'),'response_type':_0xbbad('0x22'),'rest_data':JSON[_0xbbad('0x23')]({'session':_0x16d56a['id'],'module_name':_0xbbad('0x24'),'name_value_list':_0x3e28b9})}});}function getAuth(_0x2e9353){return util[_0xbbad('0x25')](_0xbbad('0x26'),new Buffer(_0x2e9353[_0xbbad('0x27')]+':X')['toString']('base64'));}function getServerInfo(_0xd0ac4c){return request({'form':{'method':_0xbbad('0x28'),'input_type':'JSON','response_type':_0xbbad('0x22'),'rest_data':JSON[_0xbbad('0x23')]({'session':_0xd0ac4c['id']})}});}function getUser(_0x3cee36,_0x58554f,_0x368a49){if(!_['isNil'](_0x58554f)){logger['info']('Getting\x20agent\x20with\x20name',_0x58554f);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xbbad('0x22'),'rest_data':JSON[_0xbbad('0x23')]({'session':_0x368a49['id'],'module_name':_0xbbad('0x29'),'query':util[_0xbbad('0x25')](_0xbbad('0x2a'),_0x58554f),'order_by':'','offset':'0','select_fields':['id',_0xbbad('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbbad('0x2b')](function(_0x4549b2){if(_0x4549b2[_0xbbad('0x2c')][_0xbbad('0x2d')]){var _0x4d1ca1=_[_0xbbad('0x2e')](_0x4549b2['entry_list'],function(_0x475510){return _0x475510[_0xbbad('0x2f')]['user_name'][_0xbbad('0x30')]===_0x58554f;});if(_0x4d1ca1){logger[_0xbbad('0xe')](_0xbbad('0x31'));return BPromise[_0xbbad('0x32')]({'id':_0x4d1ca1[_0xbbad('0x2f')]['id']['value'],'name':_0x4d1ca1['name_value_list'][_0xbbad('0x10')]['value']});}}logger[_0xbbad('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xbbad('0x32')]({'id':_0x368a49['name_value_list']['user_id']['value'],'name':_0x368a49[_0xbbad('0x2f')][_0xbbad('0x33')]['value']});});}else{logger[_0xbbad('0xe')](_0xbbad('0x34'));return BPromise[_0xbbad('0x32')]({'id':_0x368a49[_0xbbad('0x2f')][_0xbbad('0x35')]['value'],'name':_0x368a49[_0xbbad('0x2f')]['user_name'][_0xbbad('0x30')]});}}function getEndUser(_0x4eaedc,_0x43b602,_0x4d2959,_0x31b164){logger[_0xbbad('0xe')](_0xbbad('0x36'),_0x4d2959);return request({'form':{'method':_0xbbad('0x37'),'input_type':_0xbbad('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x31b164['id'],'module_name':_0xbbad('0x38'),'query':util[_0xbbad('0x25')](_0xbbad('0x39'),_0x4d2959),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3c34ac){if(_0x3c34ac[_0xbbad('0x2c')][_0xbbad('0x2d')]){var _0x3d7682=_[_0xbbad('0x2e')](_0x3c34ac['entry_list'],function(_0x10b466){return _0x10b466[_0xbbad('0x2f')][_0xbbad('0x3a')][_0xbbad('0x30')]===_0x4d2959;});if(_0x3d7682){logger[_0xbbad('0xe')](_0xbbad('0x3b'));return BPromise[_0xbbad('0x32')]({'id':_0x3d7682[_0xbbad('0x2f')]['id'][_0xbbad('0x30')],'name':_0x3d7682['name_value_list']['name'][_0xbbad('0x30')],'phone':_0x3d7682[_0xbbad('0x2f')]['phone_home']['value']});}}else{logger[_0xbbad('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xbbad('0x3c'),'input_type':_0xbbad('0x22'),'response_type':_0xbbad('0x22'),'rest_data':JSON[_0xbbad('0x23')]({'session':_0x31b164['id'],'module_name':'Contacts','name_value_list':[{'name':_0xbbad('0x3d'),'value':_0x43b602!==''?_0x43b602:util[_0xbbad('0x25')](_0xbbad('0x3e'),_0x4d2959)},{'name':'phone_home','value':_0x4d2959}]})}})['then'](function(_0x4682fc){logger[_0xbbad('0xe')](_0xbbad('0x3f'));return BPromise['resolve']({'id':_0x4682fc['id'],'name':_0x4682fc[_0xbbad('0x2c')][_0xbbad('0x3d')]['value'],'phone':_0x4682fc[_0xbbad('0x2c')][_0xbbad('0x3a')][_0xbbad('0x30')]});});}});}function request(_0x466664){logger[_0xbbad('0x40')](_0xbbad('0x41'),JSON[_0xbbad('0x23')](_0x466664));return rp(_[_0xbbad('0x42')](def,_0x466664));}function getTags(_0x1aef3c,_0x5483d7){var _0x345869=[];if(_0x1aef3c&&_0x1aef3c[_0xbbad('0x2d')]>0x0){_0x345869=_[_0xbbad('0x43')](_0x1aef3c,_0x5483d7);}return _0x345869;}function getCustomFields(_0x2f15fb,_0x55c97d){var _0x3de43a=[];var _0xa183c2={'custom_fields':[]};if(_0x2f15fb[_0xbbad('0x2d')]>0x0){_[_0xbbad('0x1e')](_0x2f15fb,function(_0x5e660c){if(_0x5e660c['type']===_0xbbad('0x44')&&_0x5e660c['nameField']&&!_0x5e660c['customField']){_0xa183c2[_0x5e660c[_0xbbad('0x45')][_0xbbad('0x46')]()]=_0x5e660c['content'][_0xbbad('0x47')]();}else if(_0x5e660c[_0xbbad('0x48')]===_0xbbad('0x44')&&_0x5e660c[_0xbbad('0x20')]&&_0x5e660c['customField']){_0xa183c2[_0xbbad('0x49')][_0xbbad('0x1f')]({'id':_0x5e660c[_0xbbad('0x20')],'value':_0x5e660c[_0xbbad('0x4a')][_0xbbad('0x47')]()});}else if(_0x5e660c[_0xbbad('0x48')]===_0xbbad('0x4b')&&_0x5e660c[_0xbbad('0x21')]&&_0x5e660c[_0xbbad('0x20')]&&_0x5e660c[_0xbbad('0x4c')]){_0x55c97d[_0x5e660c[_0xbbad('0x21')]]&&_0xa183c2['custom_fields'][_0xbbad('0x1f')]({'id':_0x5e660c[_0xbbad('0x20')],'value':_0x55c97d[_0x5e660c[_0xbbad('0x21')]][_0xbbad('0x47')]()});}else if(_0x5e660c[_0xbbad('0x48')]===_0xbbad('0x4d')&&_0x5e660c['Variable']&&_0x5e660c[_0xbbad('0x4e')][_0xbbad('0x10')]&&_0x5e660c['idField']&&_0x5e660c[_0xbbad('0x4c')]){_0x55c97d[_0x5e660c[_0xbbad('0x4e')]['name'][_0xbbad('0x46')]()]&&_0xa183c2[_0xbbad('0x49')]['push']({'id':_0x5e660c['idField'],'value':_0x55c97d[_0x5e660c[_0xbbad('0x4e')][_0xbbad('0x10')][_0xbbad('0x46')]()][_0xbbad('0x47')]()});}});}return _0xa183c2;}function getConnection(_0x4748a1){return request({'method':_0xbbad('0xc'),'form':{'method':_0xbbad('0x4f'),'input_type':_0xbbad('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4748a1['username'],'password':_0x4748a1[_0xbbad('0x50')],'encryption':_0xbbad('0x51')},'application':_0xbbad('0x52')})}})[_0xbbad('0x2b')](function(_0x41ffcb){var _0x5df1a8=_0x41ffcb;if(_0x5df1a8['id']){def[_0xbbad('0x53')]=_0x5df1a8['id'];return BPromise['resolve'](_0x5df1a8);}else{throw new Error(util[_0xbbad('0x25')](_0xbbad('0x54'),_0x4748a1['id']));}});}function setRelationship(_0x458c47,_0x1ce653,_0x3503b3,_0x30a1da){return request({'form':{'method':'set_relationship','input_type':_0xbbad('0x22'),'response_type':_0xbbad('0x22'),'rest_data':JSON[_0xbbad('0x23')]({'session':_0x458c47['id'],'module_name':'Calls','module_id':_0x3503b3['id'],'link_field_name':_0x30a1da,'related_ids':[_0x1ce653['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xbbad('0x55')]=function(_0xbe5719,_0x4048fe,_0x3f332a,_0x14c25a,_0x317542,_0x5dfd60){var _0x552e00,_0x3359f3,_0x3caf47,_0x465525;_0x5dfd60[_0xbbad('0x56')]=intUtil[_0xbbad('0x57')](_0x5dfd60[_0xbbad('0x56')]);_0x5dfd60[_0xbbad('0x58')]=intUtil[_0xbbad('0x57')](_0x5dfd60[_0xbbad('0x58')]);def[_0xbbad('0x59')]=util['format'](_0xbbad('0x5a'),_0x5dfd60[_0xbbad('0x56')]);if(_0x317542&&_0x317542[_0xbbad('0x5b')]){logger[_0xbbad('0xe')]('[QUEUE]',_0xbbad('0x5c'));_0x4048fe['recordingURL']=util[_0xbbad('0x25')](_0xbbad('0x5d'),_0x5dfd60[_0xbbad('0x58')],_0x4048fe[_0xbbad('0x5e')],md5(_0x4048fe[_0xbbad('0x5e')]));}else{_0x4048fe[_0xbbad('0x5f')]='';}return getConnection(_0x5dfd60)[_0xbbad('0x2b')](function(_0xedac3d){_0x465525=_0xedac3d;return getUser(_0x5dfd60,_0x14c25a[_0xbbad('0x10')],_0x465525);})[_0xbbad('0x2b')](function(_0x554b0a){_0x552e00=_0x554b0a;logger[_0xbbad('0xe')](_0xbbad('0x60'),_0x552e00['id']);return getEndUser(_0x5dfd60,_0x4048fe[_0xbbad('0x61')],_0x4048fe[_0xbbad('0x62')],_0x465525);})[_0xbbad('0x2b')](function(_0x29f7ce){_0x3359f3=_0x29f7ce;logger[_0xbbad('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3359f3['id']);return getTicket(_0x5dfd60,_0x552e00,_0x3359f3,_0x3f332a,_0x4048fe,_0x3f332a[_0xbbad('0x63')],_0x465525,_0xbbad('0x64'));})[_0xbbad('0x2b')](function(_0x38e774){_0x3caf47=_0x38e774;logger[_0xbbad('0xe')](_0xbbad('0x65'));logger['info'](_0xbbad('0x66'),_0x3caf47['id']);return setRelationship(_0x465525,_0x552e00,_0x3caf47,'users');})[_0xbbad('0x2b')](function(){return setRelationship(_0x465525,_0x3359f3,_0x3caf47,'contacts');})[_0xbbad('0x2b')](function(){return getServerInfo(_0x465525);})[_0xbbad('0x2b')](function(_0x5b5c42){var _0x582895=parseInt(_0x5b5c42[_0xbbad('0x67')][_0xbbad('0x68')](0x0));var _0x31c35f=util[_0xbbad('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5dfd60['remoteUri'],_0x3caf47['id']);if(_0x582895>0x6){_0x31c35f=util[_0xbbad('0x25')](_0xbbad('0x69'),_0x5dfd60['remoteUri'],_0x3caf47['id']);}logger[_0xbbad('0xe')](_0xbbad('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xbbad('0x6b'),_0x14c25a[_0xbbad('0x10')]),_0xbbad('0x6c'),{'uri':_0x31c35f});})[_0xbbad('0x6d')](function(_0x176c54){logger[_0xbbad('0x6e')](_0xbbad('0x6a'),JSON['stringify'](_0x176c54));});};exports[_0xbbad('0x6f')]=function(_0x5eacf4,_0x56a6b4,_0x1e0418,_0x23cafd,_0x3bd6a5,_0x585b89,_0x418c7a){var _0x475f81,_0x460dd5,_0x3e286f,_0x2473c2;_0x585b89[_0xbbad('0x56')]=intUtil[_0xbbad('0x57')](_0x585b89['remoteUri']);_0x585b89[_0xbbad('0x58')]=intUtil[_0xbbad('0x57')](_0x585b89[_0xbbad('0x58')]);def[_0xbbad('0x59')]=util[_0xbbad('0x25')](_0xbbad('0x5a'),_0x585b89[_0xbbad('0x56')]);if(_0x418c7a&&_0x418c7a[_0xbbad('0x70')]&&_0x418c7a[_0xbbad('0x70')]!==_0xbbad('0x71')){logger['info'](_0xbbad('0x72'),_0xbbad('0x5c'));_0x56a6b4['recordingURL']=util[_0xbbad('0x25')](_0xbbad('0x5d'),_0x585b89['serverUrl'],_0x56a6b4[_0xbbad('0x5e')],md5(_0x56a6b4['uniqueid']));}return getConnection(_0x585b89)[_0xbbad('0x2b')](function(_0x368aff){_0x2473c2=_0x368aff;return getUser(_0x585b89,_0x23cafd[_0xbbad('0x10')],_0x2473c2);})[_0xbbad('0x2b')](function(_0x3c0064){_0x475f81=_0x3c0064;logger[_0xbbad('0xe')](_0xbbad('0x60'),_0x475f81['id']);return getEndUser(_0x585b89,_0x56a6b4[_0xbbad('0x73')],_0x56a6b4[_0xbbad('0x74')],_0x2473c2);})[_0xbbad('0x2b')](function(_0x494a7d){_0x460dd5=_0x494a7d;logger[_0xbbad('0xe')](_0xbbad('0x75'),_0x460dd5['id']);return getTicket(_0x585b89,_0x475f81,_0x460dd5,_0x1e0418,_0x56a6b4,_0x1e0418['Fields'],_0x2473c2,_0xbbad('0x76'));})[_0xbbad('0x2b')](function(_0x3b1742){_0x3e286f=_0x3b1742;logger[_0xbbad('0xe')]('Ticket\x20created!');logger[_0xbbad('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3e286f['id']);return setRelationship(_0x2473c2,_0x475f81,_0x3e286f,_0xbbad('0x77'));})[_0xbbad('0x2b')](function(){return setRelationship(_0x2473c2,_0x460dd5,_0x3e286f,_0xbbad('0x78'));})['then'](function(){return getServerInfo(_0x2473c2);})[_0xbbad('0x2b')](function(_0xe30165){var _0x3dc3c6=parseInt(_0xe30165[_0xbbad('0x67')]['charAt'](0x0));var _0x3b84fb=util[_0xbbad('0x25')](_0xbbad('0x79'),_0x585b89[_0xbbad('0x56')],_0x3e286f['id']);if(_0x3dc3c6>0x6){_0x3b84fb=util[_0xbbad('0x25')](_0xbbad('0x69'),_0x585b89[_0xbbad('0x56')],_0x3e286f['id']);}logger[_0xbbad('0xe')](_0xbbad('0x72'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbbad('0x25')]('user:%s',_0x23cafd[_0xbbad('0x10')]),'trigger:browser:url',{'uri':_0x3b84fb});})[_0xbbad('0x6d')](function(_0x16435a){logger[_0xbbad('0x6e')]('[OUTBOUND]',JSON[_0xbbad('0x23')](_0x16435a));});};exports['unmanaged']=function(_0x3b2c78,_0x5c51ae,_0x396cf8,_0x830fa0,_0x131dda,_0x1d7ab2){var _0x19eef5,_0x39095c,_0x1ed6d0,_0x348dad;_0x1d7ab2[_0xbbad('0x56')]=intUtil[_0xbbad('0x57')](_0x1d7ab2[_0xbbad('0x56')]);_0x1d7ab2['serverUrl']=intUtil[_0xbbad('0x57')](_0x1d7ab2['serverUrl']);def[_0xbbad('0x59')]=util[_0xbbad('0x25')](_0xbbad('0x5a'),_0x1d7ab2['remoteUri']);if(_0x131dda&&_0x131dda[_0xbbad('0x5b')]){logger['info']('['+_0x5c51ae[_0xbbad('0x7a')][_0xbbad('0x7b')]()+']',_0xbbad('0x5c'));_0x5c51ae[_0xbbad('0x5f')]=util[_0xbbad('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d7ab2['serverUrl'],_0x5c51ae[_0xbbad('0x5e')],md5(_0x5c51ae[_0xbbad('0x5e')]));}else{_0x5c51ae[_0xbbad('0x5f')]='';}return getConnection(_0x1d7ab2)[_0xbbad('0x2b')](function(_0xae2cc1){_0x348dad=_0xae2cc1;if(!_[_0xbbad('0x7c')](_0x830fa0)){return getUser(_0x1d7ab2,_0x830fa0[_0xbbad('0x10')],_0x348dad);}else{return getUser(_0x1d7ab2,null,_0x348dad);}})['then'](function(_0x24b16e){_0x19eef5=_0x24b16e;logger['info']('The\x20User\x20ID\x20is:',_0x19eef5['id']);return getEndUser(_0x1d7ab2,_0x5c51ae[_0xbbad('0x61')],_0x5c51ae[_0xbbad('0x62')],_0x348dad);})[_0xbbad('0x2b')](function(_0x5aa425){_0x39095c=_0x5aa425;logger[_0xbbad('0xe')](_0xbbad('0x75'),_0x39095c['id']);return getTicket(_0x1d7ab2,_0x19eef5,_0x39095c,_0x396cf8,_0x5c51ae,_0x396cf8[_0xbbad('0x63')],_0x348dad,'Inbound');})[_0xbbad('0x2b')](function(_0x12db60){_0x1ed6d0=_0x12db60;logger[_0xbbad('0xe')](_0xbbad('0x65'));logger[_0xbbad('0xe')](_0xbbad('0x66'),_0x1ed6d0['id']);return setRelationship(_0x348dad,_0x19eef5,_0x1ed6d0,_0xbbad('0x77'));})['then'](function(){return setRelationship(_0x348dad,_0x39095c,_0x1ed6d0,'contacts');})['then'](function(){return getServerInfo(_0x348dad);})['catch'](function(_0xa645c5){logger[_0xbbad('0x6e')]('['+_0x5c51ae[_0xbbad('0x7a')][_0xbbad('0x7b')]()+']',JSON['stringify'](_0xa645c5));});}; \ No newline at end of file +var _0x3607=['duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','Enduser\x20created.','debug','[HTTP]','merge','type','string','customField','nameField','toLowerCase','push','content','variable','custom_fields','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','version','user:%s','trigger:browser:url','error','toUpperCase','lastevent','lodash','request-promise','bluebird','md5','util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours'];(function(_0x976e42,_0x2a5e83){var _0x450176=function(_0x315a35){while(--_0x315a35){_0x976e42['push'](_0x976e42['shift']());}};_0x450176(++_0x2a5e83);}(_0x3607,0xe1));var _0x7360=function(_0x2c5d33,_0x5228a9){_0x2c5d33=_0x2c5d33-0x0;var _0xaa8192=_0x3607[_0x2c5d33];return _0xaa8192;};'use strict';var _=require(_0x7360('0x0'));var rp=require(_0x7360('0x1'));var BPromise=require(_0x7360('0x2'));var md5=require(_0x7360('0x3'));var util=require(_0x7360('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x7360('0x5'));var logger=require(_0x7360('0x6'))(_0x7360('0x7'));config['redis']=_[_0x7360('0x8')](config[_0x7360('0x9')],{'host':_0x7360('0xa'),'port':0x18eb});var io=require(_0x7360('0xb'))(new Redis(config[_0x7360('0x9')]));var def={'method':_0x7360('0xc'),'json':!![]};function emit(_0x4828a2,_0x137015,_0x98aa3a){io['to'](_0x4828a2)[_0x7360('0xd')](_0x137015,_0x98aa3a);}function getTicket(_0x56422b,_0x42cad7,_0x41b635,_0x2b2520,_0x2143cc,_0x58a4b8,_0x1dcff8,_0x16db2b){logger[_0x7360('0xe')](_0x7360('0xf'));var _0x5825ba=new Date();var _0x43036b=[{'name':'name','value':intUtil[_0x7360('0x10')](_0x2b2520['Subjects'],_0x2143cc,'\x20')},{'name':'assigned_user_id','value':_0x42cad7['id']},{'name':_0x7360('0x11'),'value':_0x42cad7['id']},{'name':_0x7360('0x12'),'value':intUtil[_0x7360('0x10')](_0x2b2520[_0x7360('0x13')],_0x2143cc,'\x0a')},{'name':_0x7360('0x14'),'value':_0x5825ba[_0x7360('0x15')]()[_0x7360('0x16')](0x0,0x13)[_0x7360('0x17')]('T','\x20')},{'name':_0x7360('0x18'),'value':'0'},{'name':_0x7360('0x19'),'value':'15'},{'name':_0x7360('0x1a'),'value':_0x41b635['id']},{'name':_0x7360('0x1b'),'value':_0x7360('0x1c')},{'name':_0x7360('0x1d'),'value':_0x41b635['name']},{'name':'direction','value':_0x16db2b}];if(_0x58a4b8[_0x7360('0x1e')]){_[_0x7360('0x1f')](_0x58a4b8,function(_0x41b7fc){if(_0x2143cc[_0x41b7fc[_0x7360('0x20')]]){_0x43036b['push']({'name':_0x41b7fc[_0x7360('0x21')],'value':_0x2143cc[_0x41b7fc[_0x7360('0x20')]]});}});}return request({'form':{'method':_0x7360('0x22'),'input_type':_0x7360('0x23'),'response_type':_0x7360('0x23'),'rest_data':JSON[_0x7360('0x24')]({'session':_0x1dcff8['id'],'module_name':'Calls','name_value_list':_0x43036b})}});}function getAuth(_0x5403d6){return util[_0x7360('0x25')](_0x7360('0x26'),new Buffer(_0x5403d6[_0x7360('0x27')]+':X')[_0x7360('0x28')](_0x7360('0x29')));}function getServerInfo(_0x3a585d){return request({'form':{'method':_0x7360('0x2a'),'input_type':'JSON','response_type':_0x7360('0x23'),'rest_data':JSON[_0x7360('0x24')]({'session':_0x3a585d['id']})}});}function getUser(_0x34df4b,_0x25d97d,_0x453daf){if(!_[_0x7360('0x2b')](_0x25d97d)){logger[_0x7360('0xe')](_0x7360('0x2c'),_0x25d97d);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x7360('0x23'),'rest_data':JSON[_0x7360('0x24')]({'session':_0x453daf['id'],'module_name':_0x7360('0x2d'),'query':util[_0x7360('0x25')](_0x7360('0x2e'),_0x25d97d),'order_by':'','offset':'0','select_fields':['id',_0x7360('0x2f'),_0x7360('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7360('0x31')](function(_0x5eb110){if(_0x5eb110[_0x7360('0x32')][_0x7360('0x1e')]){var _0xe92e2c=_[_0x7360('0x33')](_0x5eb110[_0x7360('0x32')],function(_0x65d991){return _0x65d991['name_value_list']['user_name'][_0x7360('0x34')]===_0x25d97d;});if(_0xe92e2c){logger[_0x7360('0xe')](_0x7360('0x35'));return BPromise[_0x7360('0x36')]({'id':_0xe92e2c[_0x7360('0x37')]['id'][_0x7360('0x34')],'name':_0xe92e2c[_0x7360('0x37')]['name']['value']});}}logger['info'](_0x7360('0x38'));return BPromise[_0x7360('0x36')]({'id':_0x453daf[_0x7360('0x37')][_0x7360('0x39')][_0x7360('0x34')],'name':_0x453daf[_0x7360('0x37')][_0x7360('0x30')]['value']});});}else{logger[_0x7360('0xe')](_0x7360('0x3a'));return BPromise[_0x7360('0x36')]({'id':_0x453daf[_0x7360('0x37')][_0x7360('0x39')][_0x7360('0x34')],'name':_0x453daf[_0x7360('0x37')][_0x7360('0x30')]['value']});}}function getEndUser(_0x2d0e55,_0x5d74fa,_0x1f4b99,_0x5822cd){logger['info'](_0x7360('0x3b'),_0x1f4b99);return request({'form':{'method':_0x7360('0x3c'),'input_type':'JSON','response_type':_0x7360('0x23'),'rest_data':JSON[_0x7360('0x24')]({'session':_0x5822cd['id'],'module_name':_0x7360('0x1c'),'query':util['format'](_0x7360('0x3d'),_0x1f4b99),'order_by':'','offset':'0','select_fields':['id','name',_0x7360('0x3e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7360('0x31')](function(_0x19999d){if(_0x19999d[_0x7360('0x32')][_0x7360('0x1e')]){var _0x5d6f45=_['find'](_0x19999d['entry_list'],function(_0x27b7df){return _0x27b7df[_0x7360('0x37')][_0x7360('0x3e')][_0x7360('0x34')]===_0x1f4b99;});if(_0x5d6f45){logger[_0x7360('0xe')](_0x7360('0x3f'));return BPromise[_0x7360('0x36')]({'id':_0x5d6f45[_0x7360('0x37')]['id'][_0x7360('0x34')],'name':_0x5d6f45[_0x7360('0x37')][_0x7360('0x2f')][_0x7360('0x34')],'phone':_0x5d6f45[_0x7360('0x37')][_0x7360('0x3e')]['value']});}}else{logger[_0x7360('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x7360('0x22'),'input_type':_0x7360('0x23'),'response_type':_0x7360('0x23'),'rest_data':JSON[_0x7360('0x24')]({'session':_0x5822cd['id'],'module_name':'Contacts','name_value_list':[{'name':_0x7360('0x40'),'value':_0x5d74fa!==''?_0x5d74fa:util[_0x7360('0x25')]('Caller\x20-\x20%s',_0x1f4b99)},{'name':_0x7360('0x3e'),'value':_0x1f4b99}]})}})[_0x7360('0x31')](function(_0x1c5639){logger[_0x7360('0xe')](_0x7360('0x41'));return BPromise[_0x7360('0x36')]({'id':_0x1c5639['id'],'name':_0x1c5639[_0x7360('0x32')][_0x7360('0x40')][_0x7360('0x34')],'phone':_0x1c5639[_0x7360('0x32')][_0x7360('0x3e')][_0x7360('0x34')]});});}});}function request(_0x93321b){logger[_0x7360('0x42')](_0x7360('0x43'),JSON[_0x7360('0x24')](_0x93321b));return rp(_[_0x7360('0x44')](def,_0x93321b));}function getTags(_0x384c6c,_0x48b196){var _0x41cb90=[];if(_0x384c6c&&_0x384c6c[_0x7360('0x1e')]>0x0){_0x41cb90=_['map'](_0x384c6c,_0x48b196);}return _0x41cb90;}function getCustomFields(_0x3a96e2,_0x241641){var _0x1e4ba6=[];var _0x469d66={'custom_fields':[]};if(_0x3a96e2[_0x7360('0x1e')]>0x0){_[_0x7360('0x1f')](_0x3a96e2,function(_0x317aaa){if(_0x317aaa[_0x7360('0x45')]===_0x7360('0x46')&&_0x317aaa['nameField']&&!_0x317aaa[_0x7360('0x47')]){_0x469d66[_0x317aaa[_0x7360('0x48')][_0x7360('0x49')]()]=_0x317aaa['content'][_0x7360('0x28')]();}else if(_0x317aaa['type']===_0x7360('0x46')&&_0x317aaa[_0x7360('0x21')]&&_0x317aaa['customField']){_0x469d66['custom_fields'][_0x7360('0x4a')]({'id':_0x317aaa[_0x7360('0x21')],'value':_0x317aaa[_0x7360('0x4b')][_0x7360('0x28')]()});}else if(_0x317aaa['type']===_0x7360('0x4c')&&_0x317aaa['variableName']&&_0x317aaa[_0x7360('0x21')]&&_0x317aaa[_0x7360('0x47')]){_0x241641[_0x317aaa['variableName']]&&_0x469d66[_0x7360('0x4d')][_0x7360('0x4a')]({'id':_0x317aaa[_0x7360('0x21')],'value':_0x241641[_0x317aaa[_0x7360('0x20')]][_0x7360('0x28')]()});}else if(_0x317aaa[_0x7360('0x45')]==='customVariable'&&_0x317aaa['Variable']&&_0x317aaa[_0x7360('0x4e')][_0x7360('0x2f')]&&_0x317aaa[_0x7360('0x21')]&&_0x317aaa[_0x7360('0x47')]){_0x241641[_0x317aaa['Variable'][_0x7360('0x2f')][_0x7360('0x49')]()]&&_0x469d66[_0x7360('0x4d')]['push']({'id':_0x317aaa[_0x7360('0x21')],'value':_0x241641[_0x317aaa[_0x7360('0x4e')][_0x7360('0x2f')]['toLowerCase']()]['toString']()});}});}return _0x469d66;}function getConnection(_0x2f5fcd){return request({'method':_0x7360('0xc'),'form':{'method':_0x7360('0x4f'),'input_type':_0x7360('0x23'),'response_type':_0x7360('0x23'),'rest_data':JSON[_0x7360('0x24')]({'user_auth':{'user_name':_0x2f5fcd[_0x7360('0x50')],'password':_0x2f5fcd[_0x7360('0x51')],'encryption':_0x7360('0x52')},'application':_0x7360('0x53')})}})[_0x7360('0x31')](function(_0x49f6bc){var _0x5ae8c1=_0x49f6bc;if(_0x5ae8c1['id']){def[_0x7360('0x54')]=_0x5ae8c1['id'];return BPromise['resolve'](_0x5ae8c1);}else{throw new Error(util[_0x7360('0x25')](_0x7360('0x55'),_0x2f5fcd['id']));}});}function setRelationship(_0x1b380d,_0x3c515f,_0xb47e07,_0x5e8fe9){return request({'form':{'method':_0x7360('0x56'),'input_type':_0x7360('0x23'),'response_type':_0x7360('0x23'),'rest_data':JSON[_0x7360('0x24')]({'session':_0x1b380d['id'],'module_name':'Calls','module_id':_0xb47e07['id'],'link_field_name':_0x5e8fe9,'related_ids':[_0x3c515f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x7360('0x57')]=function(_0x4702bd,_0x42163c,_0x5a1a44,_0x25d9ed,_0x41a58a,_0x130fa5){var _0x123b4f,_0x5f10a5,_0xa7961f,_0x4134b5;_0x130fa5['remoteUri']=intUtil[_0x7360('0x58')](_0x130fa5['remoteUri']);_0x130fa5['serverUrl']=intUtil[_0x7360('0x58')](_0x130fa5[_0x7360('0x59')]);def[_0x7360('0x5a')]=util['format'](_0x7360('0x5b'),_0x130fa5[_0x7360('0x5c')]);if(_0x41a58a&&_0x41a58a[_0x7360('0x5d')]){logger[_0x7360('0xe')](_0x7360('0x5e'),_0x7360('0x5f'));_0x42163c[_0x7360('0x60')]=util[_0x7360('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x130fa5[_0x7360('0x59')],_0x42163c[_0x7360('0x61')],md5(_0x42163c[_0x7360('0x61')]));}else{_0x42163c[_0x7360('0x60')]='';}return getConnection(_0x130fa5)[_0x7360('0x31')](function(_0x21f60d){_0x4134b5=_0x21f60d;return getUser(_0x130fa5,_0x25d9ed['name'],_0x4134b5);})['then'](function(_0x26775e){_0x123b4f=_0x26775e;logger['info']('The\x20User\x20ID\x20is:',_0x123b4f['id']);return getEndUser(_0x130fa5,_0x42163c['calleridname'],_0x42163c[_0x7360('0x62')],_0x4134b5);})[_0x7360('0x31')](function(_0x4ef4c4){_0x5f10a5=_0x4ef4c4;logger[_0x7360('0xe')](_0x7360('0x63'),_0x5f10a5['id']);return getTicket(_0x130fa5,_0x123b4f,_0x5f10a5,_0x5a1a44,_0x42163c,_0x5a1a44[_0x7360('0x64')],_0x4134b5,_0x7360('0x65'));})[_0x7360('0x31')](function(_0x57798c){_0xa7961f=_0x57798c;logger[_0x7360('0xe')]('Ticket\x20created!');logger['info'](_0x7360('0x66'),_0xa7961f['id']);return setRelationship(_0x4134b5,_0x123b4f,_0xa7961f,_0x7360('0x67'));})[_0x7360('0x31')](function(){return setRelationship(_0x4134b5,_0x5f10a5,_0xa7961f,'contacts');})[_0x7360('0x31')](function(){return getServerInfo(_0x4134b5);})[_0x7360('0x31')](function(_0x4369e7){var _0x5155d4=parseInt(_0x4369e7['version'][_0x7360('0x68')](0x0));var _0x15fe4e=util[_0x7360('0x25')](_0x7360('0x69'),_0x130fa5[_0x7360('0x5c')],_0xa7961f['id']);if(_0x5155d4>0x6){_0x15fe4e=util[_0x7360('0x25')](_0x7360('0x6a'),_0x130fa5['remoteUri'],_0xa7961f['id']);}logger['info'](_0x7360('0x5e'),_0x7360('0x6b'));emit(util[_0x7360('0x25')]('user:%s',_0x25d9ed[_0x7360('0x2f')]),'trigger:browser:url',{'uri':_0x15fe4e});})[_0x7360('0x6c')](function(_0x465fcd){logger['error'](_0x7360('0x5e'),JSON[_0x7360('0x24')](_0x465fcd));});};exports[_0x7360('0x6d')]=function(_0x18e18c,_0x7f7b31,_0x39e0a3,_0x3bd7ad,_0xff8010,_0x554edf,_0x582bc1){var _0x109ce4,_0x1cf7df,_0x386b01,_0xf3d334;_0x554edf[_0x7360('0x5c')]=intUtil[_0x7360('0x58')](_0x554edf[_0x7360('0x5c')]);_0x554edf['serverUrl']=intUtil['stripTrailingSlash'](_0x554edf['serverUrl']);def[_0x7360('0x5a')]=util[_0x7360('0x25')](_0x7360('0x5b'),_0x554edf['remoteUri']);if(_0x582bc1&&_0x582bc1[_0x7360('0x6e')]&&_0x582bc1['recordingFormat']!==_0x7360('0x6f')){logger[_0x7360('0xe')](_0x7360('0x70'),_0x7360('0x5f'));_0x7f7b31[_0x7360('0x60')]=util[_0x7360('0x25')](_0x7360('0x71'),_0x554edf[_0x7360('0x59')],_0x7f7b31['uniqueid'],md5(_0x7f7b31['uniqueid']));}return getConnection(_0x554edf)[_0x7360('0x31')](function(_0x2bc983){_0xf3d334=_0x2bc983;return getUser(_0x554edf,_0x3bd7ad[_0x7360('0x2f')],_0xf3d334);})['then'](function(_0x3ba8ca){_0x109ce4=_0x3ba8ca;logger[_0x7360('0xe')](_0x7360('0x72'),_0x109ce4['id']);return getEndUser(_0x554edf,_0x7f7b31[_0x7360('0x73')],_0x7f7b31[_0x7360('0x74')],_0xf3d334);})[_0x7360('0x31')](function(_0x4671cd){_0x1cf7df=_0x4671cd;logger[_0x7360('0xe')](_0x7360('0x63'),_0x1cf7df['id']);return getTicket(_0x554edf,_0x109ce4,_0x1cf7df,_0x39e0a3,_0x7f7b31,_0x39e0a3['Fields'],_0xf3d334,_0x7360('0x75'));})['then'](function(_0x145c46){_0x386b01=_0x145c46;logger[_0x7360('0xe')](_0x7360('0x76'));logger[_0x7360('0xe')](_0x7360('0x66'),_0x386b01['id']);return setRelationship(_0xf3d334,_0x109ce4,_0x386b01,_0x7360('0x67'));})[_0x7360('0x31')](function(){return setRelationship(_0xf3d334,_0x1cf7df,_0x386b01,'contacts');})[_0x7360('0x31')](function(){return getServerInfo(_0xf3d334);})[_0x7360('0x31')](function(_0x12bdac){var _0xcdc80c=parseInt(_0x12bdac[_0x7360('0x77')][_0x7360('0x68')](0x0));var _0x4874e8=util['format'](_0x7360('0x69'),_0x554edf[_0x7360('0x5c')],_0x386b01['id']);if(_0xcdc80c>0x6){_0x4874e8=util[_0x7360('0x25')](_0x7360('0x6a'),_0x554edf[_0x7360('0x5c')],_0x386b01['id']);}logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7360('0x25')](_0x7360('0x78'),_0x3bd7ad['name']),_0x7360('0x79'),{'uri':_0x4874e8});})['catch'](function(_0x4ff835){logger[_0x7360('0x7a')](_0x7360('0x70'),JSON[_0x7360('0x24')](_0x4ff835));});};exports['unmanaged']=function(_0x28135a,_0x43ce28,_0x1d4cc8,_0xe003fb,_0x279d6d,_0x5940fd){var _0x139274,_0x4b7ccd,_0x3d7df2,_0x2e5b64;_0x5940fd[_0x7360('0x5c')]=intUtil[_0x7360('0x58')](_0x5940fd[_0x7360('0x5c')]);_0x5940fd[_0x7360('0x59')]=intUtil[_0x7360('0x58')](_0x5940fd['serverUrl']);def[_0x7360('0x5a')]=util[_0x7360('0x25')]('%s/service/v4_1/rest.php',_0x5940fd[_0x7360('0x5c')]);if(_0x279d6d&&_0x279d6d[_0x7360('0x5d')]){logger[_0x7360('0xe')]('['+_0x43ce28['lastevent'][_0x7360('0x7b')]()+']',_0x7360('0x5f'));_0x43ce28[_0x7360('0x60')]=util['format'](_0x7360('0x71'),_0x5940fd[_0x7360('0x59')],_0x43ce28[_0x7360('0x61')],md5(_0x43ce28[_0x7360('0x61')]));}else{_0x43ce28['recordingURL']='';}return getConnection(_0x5940fd)['then'](function(_0x118ad7){_0x2e5b64=_0x118ad7;if(!_[_0x7360('0x2b')](_0xe003fb)){return getUser(_0x5940fd,_0xe003fb['name'],_0x2e5b64);}else{return getUser(_0x5940fd,null,_0x2e5b64);}})[_0x7360('0x31')](function(_0x1fda83){_0x139274=_0x1fda83;logger[_0x7360('0xe')](_0x7360('0x72'),_0x139274['id']);return getEndUser(_0x5940fd,_0x43ce28['calleridname'],_0x43ce28[_0x7360('0x62')],_0x2e5b64);})[_0x7360('0x31')](function(_0x3b6a0d){_0x4b7ccd=_0x3b6a0d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4b7ccd['id']);return getTicket(_0x5940fd,_0x139274,_0x4b7ccd,_0x1d4cc8,_0x43ce28,_0x1d4cc8['Fields'],_0x2e5b64,_0x7360('0x65'));})['then'](function(_0xeafd98){_0x3d7df2=_0xeafd98;logger[_0x7360('0xe')](_0x7360('0x76'));logger['info'](_0x7360('0x66'),_0x3d7df2['id']);return setRelationship(_0x2e5b64,_0x139274,_0x3d7df2,'users');})[_0x7360('0x31')](function(){return setRelationship(_0x2e5b64,_0x4b7ccd,_0x3d7df2,'contacts');})[_0x7360('0x31')](function(){return getServerInfo(_0x2e5b64);})[_0x7360('0x6c')](function(_0x54e917){logger[_0x7360('0x7a')]('['+_0x43ce28[_0x7360('0x7c')][_0x7360('0x7b')]()+']',JSON[_0x7360('0x24')](_0x54e917));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 3918a50..18d746d 100644 --- a/server/services/ami/trigger/integration/util.js +++ b/server/services/ami/trigger/integration/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b45=['name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','sortBy','type','string','content','variable','variableName','push','toString','customVariable','Variable'];(function(_0xa6c837,_0x2eeaa5){var _0x5206dd=function(_0x1fb365){while(--_0x1fb365){_0xa6c837['push'](_0xa6c837['shift']());}};_0x5206dd(++_0x2eeaa5);}(_0x7b45,0x1cf));var _0x57b4=function(_0x5e10f8,_0x3a67bb){_0x5e10f8=_0x5e10f8-0x0;var _0x455320=_0x7b45[_0x5e10f8];return _0x455320;};'use strict';var _=require('lodash');var util=require(_0x57b4('0x0'));exports[_0x57b4('0x1')]=function(_0x2c1872,_0xd055f5,_0x3e76d7){var _0x669b0=[];if(_0x2c1872[_0x57b4('0x2')]>0x0){var _0x1b0f6b=_[_0x57b4('0x3')](_0x2c1872,['id']);for(var _0x1e72ee=0x0;_0x1e72ee<_0x1b0f6b[_0x57b4('0x2')];_0x1e72ee++){var _0x5bbbf1=_0x1b0f6b[_0x1e72ee];if(_0x5bbbf1[_0x57b4('0x4')]===_0x57b4('0x5')){_0x669b0['push'](_0x5bbbf1[_0x57b4('0x6')]);}else if(_0x5bbbf1[_0x57b4('0x4')]===_0x57b4('0x7')&&_0x5bbbf1[_0x57b4('0x8')]){_0xd055f5[_0x5bbbf1[_0x57b4('0x8')]]&&_0x669b0[_0x57b4('0x9')](_0xd055f5[_0x5bbbf1['variableName']][_0x57b4('0xa')]());}else if(_0x5bbbf1[_0x57b4('0x4')]===_0x57b4('0xb')&&_0x5bbbf1[_0x57b4('0xc')]&&_0x5bbbf1[_0x57b4('0xc')][_0x57b4('0xd')]){_0xd055f5[_0x5bbbf1[_0x57b4('0xc')][_0x57b4('0xd')]['toLowerCase']()]&&_0x669b0['push'](_0xd055f5[_0x5bbbf1['Variable'][_0x57b4('0xd')][_0x57b4('0xe')]()][_0x57b4('0xa')]());}else if(_0x5bbbf1[_0x57b4('0x4')]===_0x57b4('0xf')){if(_0x5bbbf1[_0x57b4('0x10')]===_0x57b4('0x5')&&_0x5bbbf1[_0x57b4('0x11')]){_0x669b0[_0x57b4('0x9')](util[_0x57b4('0x12')](_0x57b4('0x13'),_0x5bbbf1[_0x57b4('0x11')],_0x5bbbf1[_0x57b4('0x14')]));}else if(_0x5bbbf1[_0x57b4('0x10')]===_0x57b4('0x7')&&_0x5bbbf1[_0x57b4('0x8')]&&_0x5bbbf1[_0x57b4('0x11')]){_0xd055f5[_0x5bbbf1['variableName']]&&_0x669b0[_0x57b4('0x9')](util[_0x57b4('0x12')]('%s:\x20%s',_0x5bbbf1[_0x57b4('0x11')],_0xd055f5[_0x5bbbf1[_0x57b4('0x8')]]));}else if(_0x5bbbf1[_0x57b4('0x10')]===_0x57b4('0xb')&&_0x5bbbf1[_0x57b4('0xc')]&&_0x5bbbf1[_0x57b4('0xc')]['name']&&_0x5bbbf1[_0x57b4('0x11')]){_0xd055f5[_0x5bbbf1['Variable'][_0x57b4('0xd')][_0x57b4('0xe')]()]&&_0x669b0[_0x57b4('0x9')](util[_0x57b4('0x12')](_0x57b4('0x13'),_0x5bbbf1[_0x57b4('0x11')],_0xd055f5[_0x5bbbf1[_0x57b4('0xc')]['name'][_0x57b4('0xe')]()]));}}}}return _0x669b0['join'](_0x3e76d7);};exports[_0x57b4('0x15')]=function(_0x228fee){var _0x37b2f4=_0x228fee[_0x57b4('0x16')](-0x1);if(_0x37b2f4==='/'){_0x228fee=_0x228fee[_0x57b4('0x17')](0x0,_0x228fee[_0x57b4('0x18')](_0x37b2f4));}return _0x228fee;};exports[_0x57b4('0x19')]=function(_0x3a7c20){if(!_[_0x57b4('0x1a')](_0x3a7c20)&&_0x3a7c20!==''){var _0x2e7b4a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x2e7b4a[_0x57b4('0x1b')](String(_0x3a7c20)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xb5be=['type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','join','stripTrailingSlash','slice','substring','validateEmail','test','lodash','getString','sortBy','length'];(function(_0x26253d,_0x5dfc80){var _0x318a82=function(_0x22ae6a){while(--_0x22ae6a){_0x26253d['push'](_0x26253d['shift']());}};_0x318a82(++_0x5dfc80);}(_0xb5be,0x10f));var _0xeb5b=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb5be[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0xeb5b('0x0'));var util=require('util');exports[_0xeb5b('0x1')]=function(_0x57070c,_0x267181,_0x27f78d){var _0x11ffdc=[];if(_0x57070c['length']>0x0){var _0x218d1d=_[_0xeb5b('0x2')](_0x57070c,['id']);for(var _0x41eddb=0x0;_0x41eddb<_0x218d1d[_0xeb5b('0x3')];_0x41eddb++){var _0x1ebf3a=_0x218d1d[_0x41eddb];if(_0x1ebf3a[_0xeb5b('0x4')]===_0xeb5b('0x5')){_0x11ffdc[_0xeb5b('0x6')](_0x1ebf3a[_0xeb5b('0x7')]);}else if(_0x1ebf3a[_0xeb5b('0x4')]===_0xeb5b('0x8')&&_0x1ebf3a[_0xeb5b('0x9')]){_0x267181[_0x1ebf3a[_0xeb5b('0x9')]]&&_0x11ffdc['push'](_0x267181[_0x1ebf3a[_0xeb5b('0x9')]][_0xeb5b('0xa')]());}else if(_0x1ebf3a['type']===_0xeb5b('0xb')&&_0x1ebf3a['Variable']&&_0x1ebf3a[_0xeb5b('0xc')][_0xeb5b('0xd')]){_0x267181[_0x1ebf3a[_0xeb5b('0xc')][_0xeb5b('0xd')][_0xeb5b('0xe')]()]&&_0x11ffdc[_0xeb5b('0x6')](_0x267181[_0x1ebf3a['Variable'][_0xeb5b('0xd')]['toLowerCase']()][_0xeb5b('0xa')]());}else if(_0x1ebf3a['type']===_0xeb5b('0xf')){if(_0x1ebf3a[_0xeb5b('0x10')]===_0xeb5b('0x5')&&_0x1ebf3a[_0xeb5b('0x11')]){_0x11ffdc[_0xeb5b('0x6')](util[_0xeb5b('0x12')]('%s:\x20%s',_0x1ebf3a['key'],_0x1ebf3a['keyContent']));}else if(_0x1ebf3a[_0xeb5b('0x10')]===_0xeb5b('0x8')&&_0x1ebf3a[_0xeb5b('0x9')]&&_0x1ebf3a[_0xeb5b('0x11')]){_0x267181[_0x1ebf3a['variableName']]&&_0x11ffdc['push'](util[_0xeb5b('0x12')]('%s:\x20%s',_0x1ebf3a[_0xeb5b('0x11')],_0x267181[_0x1ebf3a['variableName']]));}else if(_0x1ebf3a[_0xeb5b('0x10')]==='customVariable'&&_0x1ebf3a[_0xeb5b('0xc')]&&_0x1ebf3a['Variable'][_0xeb5b('0xd')]&&_0x1ebf3a[_0xeb5b('0x11')]){_0x267181[_0x1ebf3a[_0xeb5b('0xc')]['name'][_0xeb5b('0xe')]()]&&_0x11ffdc[_0xeb5b('0x6')](util[_0xeb5b('0x12')]('%s:\x20%s',_0x1ebf3a['key'],_0x267181[_0x1ebf3a[_0xeb5b('0xc')][_0xeb5b('0xd')][_0xeb5b('0xe')]()]));}}}}return _0x11ffdc[_0xeb5b('0x13')](_0x27f78d);};exports[_0xeb5b('0x14')]=function(_0x288fca){var _0x45fe70=_0x288fca[_0xeb5b('0x15')](-0x1);if(_0x45fe70==='/'){_0x288fca=_0x288fca[_0xeb5b('0x16')](0x0,_0x288fca['lastIndexOf'](_0x45fe70));}return _0x288fca;};exports[_0xeb5b('0x17')]=function(_0x2e8cd3){if(!_['isNil'](_0x2e8cd3)&&_0x2e8cd3!==''){var _0x3580b1=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x3580b1[_0xeb5b('0x18')](String(_0x2e8cd3)[_0xeb5b('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index d9e905a..febd8cd 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x58966f,_0x5820f0){var _0xb0ec38=function(_0x5827ce){while(--_0x5827ce){_0x58966f['push'](_0x58966f['shift']());}};_0xb0ec38(++_0x5820f0);}(_0x34e8,0x12c));var _0x834e=function(_0x55f5fe,_0x2ec297){_0x55f5fe=_0x55f5fe-0x0;var _0x24f74f=_0x34e8[_0x55f5fe];return _0x24f74f;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x192036,_0x2e396b){var _0x16e607=function(_0x51174d){while(--_0x51174d){_0x192036['push'](_0x192036['shift']());}};_0x16e607(++_0x2e396b);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 9817402..9fa910d 100644 --- a/server/services/ami/trigger/integration/zendesk.js +++ b/server/services/ami/trigger/integration/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd889=['application/json','info','%s/tickets.json','name','getString','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','remoteUri','type:user\x20role:agent\x20email:%s','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','password','username','token','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','type','toLowerCase','content','toString','string','idField','customField','push','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit'];(function(_0x4cd97c,_0x14c3c0){var _0x56cd54=function(_0xb2772a){while(--_0xb2772a){_0x4cd97c['push'](_0x4cd97c['shift']());}};_0x56cd54(++_0x14c3c0);}(_0xd889,0x65));var _0x9d88=function(_0x1782dd,_0x5d7d27){_0x1782dd=_0x1782dd-0x0;var _0x446b7b=_0xd889[_0x1782dd];return _0x446b7b;};'use strict';var _=require(_0x9d88('0x0'));var rp=require(_0x9d88('0x1'));var md5=require(_0x9d88('0x2'));var util=require(_0x9d88('0x3'));var Redis=require(_0x9d88('0x4'));var intUtil=require(_0x9d88('0x5'));var config=require('../../../../config/environment');var logger=require(_0x9d88('0x6'))(_0x9d88('0x7'));config[_0x9d88('0x8')]=_[_0x9d88('0x9')](config[_0x9d88('0x8')],{'host':_0x9d88('0xa'),'port':0x18eb});var io=require(_0x9d88('0xb'))(new Redis(config[_0x9d88('0x8')]));function emit(_0x1cbfed,_0x563b93,_0x5d07d6){io['to'](_0x1cbfed)[_0x9d88('0xc')](_0x563b93,_0x5d07d6);}var headers={'Content-Type':_0x9d88('0xd'),'Accept':'application/json'};function getTicket(_0x45cc93,_0x16db6b,_0x24cd3d,_0x2e7b46,_0x1c79b9){logger[_0x9d88('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x9d88('0xf'),_0x45cc93['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x24cd3d['id'],'submitter_id':_0x16db6b?_0x16db6b['id']:undefined,'assignee_id':_0x16db6b?_0x16db6b['id']:undefined,'tags':getTags(_0x2e7b46['Tags'],_0x9d88('0x10')),'subject':intUtil[_0x9d88('0x11')](_0x2e7b46['Subjects'],_0x1c79b9,'\x20'),'description':intUtil['getString'](_0x2e7b46[_0x9d88('0x12')],_0x1c79b9,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9d88('0x11')](_0x2e7b46['Descriptions'],_0x1c79b9,'\x0a')}},getCustomFields(_0x2e7b46[_0x9d88('0x13')],_0x1c79b9))}})[_0x9d88('0x14')](function(_0x9c233a){logger[_0x9d88('0xe')]('Ticket\x20created!');return _0x9c233a[_0x9d88('0x15')];});}function getUser(_0x1c46ca,_0x4b74d3){if(intUtil[_0x9d88('0x16')](_0x4b74d3)){logger[_0x9d88('0xe')](_0x9d88('0x17'),_0x4b74d3);return request({'uri':util[_0x9d88('0x18')]('%s/search.json',_0x1c46ca[_0x9d88('0x19')]),'qs':{'query':util[_0x9d88('0x18')](_0x9d88('0x1a'),_0x4b74d3)}})['then'](function(_0x2fcb49){if(_0x2fcb49[_0x9d88('0x1b')]){logger[_0x9d88('0xe')]('Agent\x20found!');return _[_0x9d88('0x1c')](_0x2fcb49[_0x9d88('0x1d')],{'email':_0x4b74d3,'role':_0x9d88('0x1e')});}else{logger[_0x9d88('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9d88('0x18')](_0x9d88('0x1f'),_0x1c46ca[_0x9d88('0x19')])})[_0x9d88('0x14')](function(_0x4263dc){logger['info'](_0x9d88('0x20'));return _0x4263dc[_0x9d88('0x21')];});}});}else{logger['info'](_0x9d88('0x22'));return request({'uri':util[_0x9d88('0x18')](_0x9d88('0x1f'),_0x1c46ca[_0x9d88('0x19')])})['then'](function(_0x44ffb2){logger['info']('Admin\x20account\x20selected.');return _0x44ffb2[_0x9d88('0x21')];});}}function getEndUser(_0xd7780a,_0x591996,_0x2ff852){logger[_0x9d88('0xe')](_0x9d88('0x23'),_0x2ff852);return request({'uri':util['format'](_0x9d88('0x24'),_0xd7780a[_0x9d88('0x19')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x2ff852)}})[_0x9d88('0x14')](function(_0x1ec647){var _0xa4a16e;if(_0x1ec647['results'][_0x9d88('0x25')]){_0x1ec647[_0x9d88('0x1d')]=_[_0x9d88('0x26')](_0x1ec647[_0x9d88('0x1d')],{'suspended':![],'role':'end-user'});if(_0x1ec647[_0x9d88('0x1d')][_0x9d88('0x25')]){_0xa4a16e=_[_0x9d88('0x27')](_0x1ec647[_0x9d88('0x1d')]);}}if(_0xa4a16e){logger['info'](_0x9d88('0x28'));return _0xa4a16e;}else{logger[_0x9d88('0xe')](_0x9d88('0x29'));return request({'uri':util[_0x9d88('0x18')](_0x9d88('0x2a'),_0xd7780a[_0x9d88('0x19')]),'method':_0x9d88('0x2b'),'body':{'user':{'role':_0x9d88('0x2c'),'name':util[_0x9d88('0x18')](_0x9d88('0x2d'),_0x591996||_0x2ff852),'phone':_0x2ff852}}})[_0x9d88('0x14')](function(_0x85ec76){logger['info'](_0x9d88('0x2e'));return _0x85ec76[_0x9d88('0x21')];});}});}function getAuth(_0x3f5f11){var _0x2e1ccf;if(_0x3f5f11[_0x9d88('0x2f')]==='password'){_0x2e1ccf=util[_0x9d88('0x18')](_0x9d88('0x30'),_0x3f5f11['username'],_0x3f5f11[_0x9d88('0x31')]);}else if(_0x3f5f11[_0x9d88('0x2f')]==='token'){_0x2e1ccf=util[_0x9d88('0x18')]('%s/token:%s',_0x3f5f11[_0x9d88('0x32')],_0x3f5f11[_0x9d88('0x33')]);}return util[_0x9d88('0x18')]('Basic\x20%s',new Buffer(_0x2e1ccf)['toString'](_0x9d88('0x34')));}function request(_0x5eca35){logger[_0x9d88('0x35')](_0x9d88('0x36'),JSON[_0x9d88('0x37')](_0x5eca35));return rp(_[_0x9d88('0x9')](_0x5eca35,{'method':_0x9d88('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x4bd2f5,_0x1a6523){var _0x11a0bb=[];if(_0x4bd2f5&&_0x4bd2f5['length']>0x0){_0x11a0bb=_[_0x9d88('0x39')](_0x4bd2f5,_0x1a6523);}return _0x11a0bb;}function getCustomFields(_0x1aef77,_0x467a27){var _0x522792=[];var _0x564fc8={'custom_fields':[]};if(_0x1aef77[_0x9d88('0x25')]>0x0){_[_0x9d88('0x3a')](_0x1aef77,function(_0x19b4fc){if(_[_0x9d88('0x3b')](['string',_0x9d88('0x3c')],_0x19b4fc[_0x9d88('0x3d')])&&_0x19b4fc['nameField']&&!_0x19b4fc['customField']){_0x564fc8[_0x19b4fc['nameField'][_0x9d88('0x3e')]()]=_0x19b4fc[_0x9d88('0x3f')][_0x9d88('0x40')]();}else if(_[_0x9d88('0x3b')]([_0x9d88('0x41'),_0x9d88('0x3c')],_0x19b4fc[_0x9d88('0x3d')])&&_0x19b4fc[_0x9d88('0x42')]&&_0x19b4fc[_0x9d88('0x43')]){_0x564fc8['custom_fields'][_0x9d88('0x44')]({'id':_0x19b4fc[_0x9d88('0x42')],'value':_0x19b4fc[_0x9d88('0x3f')]['toString']()});}else if(_0x19b4fc[_0x9d88('0x3d')]==='variable'&&_0x19b4fc[_0x9d88('0x45')]&&_0x19b4fc[_0x9d88('0x42')]&&_0x19b4fc[_0x9d88('0x43')]){_0x467a27[_0x19b4fc[_0x9d88('0x45')]]&&_0x564fc8[_0x9d88('0x46')][_0x9d88('0x44')]({'id':_0x19b4fc[_0x9d88('0x42')],'value':_0x467a27[_0x19b4fc[_0x9d88('0x45')]][_0x9d88('0x40')]()});}else if(_0x19b4fc['type']===_0x9d88('0x47')&&_0x19b4fc[_0x9d88('0x48')]&&_0x19b4fc['Variable'][_0x9d88('0x10')]&&_0x19b4fc[_0x9d88('0x42')]&&_0x19b4fc[_0x9d88('0x43')]){_0x467a27[_0x19b4fc[_0x9d88('0x48')][_0x9d88('0x10')][_0x9d88('0x3e')]()]&&_0x564fc8['custom_fields']['push']({'id':_0x19b4fc[_0x9d88('0x42')],'value':_0x467a27[_0x19b4fc[_0x9d88('0x48')][_0x9d88('0x10')][_0x9d88('0x3e')]()]['toString']()});}});}return _0x564fc8;}exports[_0x9d88('0x49')]=function(_0x11023f,_0x253c7b,_0x16271e,_0x1f6e9f,_0x4329d9,_0x20d013){var _0x5809df,_0x185625;_0x20d013[_0x9d88('0x19')]=intUtil[_0x9d88('0x4a')](_0x20d013[_0x9d88('0x19')]);_0x20d013['serverUrl']=intUtil['stripTrailingSlash'](_0x20d013[_0x9d88('0x4b')]);if(_0x4329d9&&_0x4329d9[_0x9d88('0x4c')]){logger[_0x9d88('0xe')](_0x9d88('0x4d'),_0x9d88('0x4e'));_0x253c7b[_0x9d88('0x4f')]=util['format'](_0x9d88('0x50'),_0x20d013[_0x9d88('0x4b')],_0x253c7b[_0x9d88('0x51')],md5(_0x253c7b[_0x9d88('0x51')]));}else{_0x253c7b['recordingURL']='';}headers[_0x9d88('0x52')]=getAuth(_0x20d013);return getUser(_0x20d013,_0x1f6e9f[_0x9d88('0x53')])[_0x9d88('0x14')](function(_0x414567){_0x5809df=_0x414567;logger['info'](_0x9d88('0x54'),_0x5809df['id']);return getEndUser(_0x20d013,_0x253c7b[_0x9d88('0x55')],_0x253c7b[_0x9d88('0x56')]);})[_0x9d88('0x14')](function(_0x343766){_0x185625=_0x343766;logger[_0x9d88('0xe')](_0x9d88('0x57'),_0x185625['id']);return getTicket(_0x20d013,_0x5809df,_0x185625,_0x16271e,_0x253c7b);})['then'](function(_0x31f822){if(_0x31f822){logger['info'](_0x9d88('0x58'),_0x31f822['id']);switch(_0x20d013[_0x9d88('0x3d')]){case _0x9d88('0x59'):logger['info'](_0x9d88('0x4d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x9d88('0x18')](_0x9d88('0x5a'),_0x20d013['remoteUri'],_0x5809df['id'],_0x31f822['id']),'method':_0x9d88('0x2b')});case _0x9d88('0x5b'):logger[_0x9d88('0xe')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9d88('0x18')](_0x9d88('0x5c'),_0x1f6e9f[_0x9d88('0x10')]),_0x9d88('0x5d'),{'uri':util[_0x9d88('0x18')](_0x9d88('0x5e'),_0x20d013[_0x9d88('0x19')][_0x9d88('0x5f')](_0x9d88('0x60'),''),_0x31f822['id'])});break;default:logger[_0x9d88('0x61')]('[QUEUE]',_0x9d88('0x62'));}}})[_0x9d88('0x63')](function(_0x5a3336){logger[_0x9d88('0x61')](_0x9d88('0x64'),util['inspect'](_0x5a3336,{'showHidden':!![],'depth':null}));});};exports[_0x9d88('0x65')]=function(_0x2034d9,_0x396a71,_0x4d9dd0,_0xe0ad8d,_0x1b3453,_0x2b3a76,_0x36aa62){var _0x2a74bf,_0x3b9936;_0x2b3a76['remoteUri']=intUtil[_0x9d88('0x4a')](_0x2b3a76[_0x9d88('0x19')]);_0x2b3a76[_0x9d88('0x4b')]=intUtil[_0x9d88('0x4a')](_0x2b3a76[_0x9d88('0x4b')]);if(_0x36aa62&&_0x36aa62[_0x9d88('0x66')]&&_0x36aa62[_0x9d88('0x66')]!==_0x9d88('0x67')){logger[_0x9d88('0xe')]('[OUTBOUND]',_0x9d88('0x4e'));_0x396a71[_0x9d88('0x4f')]=util[_0x9d88('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b3a76[_0x9d88('0x4b')],_0x396a71['uniqueid'],md5(_0x396a71['uniqueid']));}headers[_0x9d88('0x52')]=getAuth(_0x2b3a76);return getUser(_0x2b3a76,_0xe0ad8d[_0x9d88('0x53')])[_0x9d88('0x14')](function(_0x288c94){_0x2a74bf=_0x288c94;logger['info'](_0x9d88('0x54'),_0x2a74bf['id']);return getEndUser(_0x2b3a76,_0x396a71[_0x9d88('0x68')],_0x396a71[_0x9d88('0x69')]);})['then'](function(_0x6158ba){_0x3b9936=_0x6158ba;logger[_0x9d88('0xe')](_0x9d88('0x57'),_0x3b9936['id']);return getTicket(_0x2b3a76,_0x2a74bf,_0x3b9936,_0x4d9dd0,_0x396a71);})[_0x9d88('0x14')](function(_0x682d64){if(_0x682d64){logger[_0x9d88('0xe')](_0x9d88('0x58'),_0x682d64['id']);switch(_0x2b3a76[_0x9d88('0x3d')]){case'integrationTab':logger[_0x9d88('0xe')](_0x9d88('0x6a'),_0x9d88('0x6b'));return request({'uri':util[_0x9d88('0x18')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2b3a76['remoteUri'],_0x2a74bf['id'],_0x682d64['id']),'method':_0x9d88('0x2b')});case _0x9d88('0x5b'):logger[_0x9d88('0xe')](_0x9d88('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9d88('0x18')](_0x9d88('0x5c'),_0xe0ad8d[_0x9d88('0x10')]),_0x9d88('0x5d'),{'uri':util[_0x9d88('0x18')](_0x9d88('0x5e'),_0x2b3a76['remoteUri'][_0x9d88('0x5f')](_0x9d88('0x60'),''),_0x682d64['id'])});break;default:logger[_0x9d88('0x61')](_0x9d88('0x6a'),_0x9d88('0x62'));}}})['catch'](function(_0x23f2a1){logger[_0x9d88('0x61')](_0x9d88('0x6c'),util[_0x9d88('0x6d')](_0x23f2a1,{'showHidden':!![],'depth':null}));});};exports[_0x9d88('0x6e')]=function(_0x3299bc,_0xdedb5e,_0x24f56d,_0x24b00f,_0x284ebd,_0x39b2bf){var _0x5e77ad,_0x1e8d79;_0x39b2bf[_0x9d88('0x19')]=intUtil['stripTrailingSlash'](_0x39b2bf[_0x9d88('0x19')]);_0x39b2bf[_0x9d88('0x4b')]=intUtil[_0x9d88('0x4a')](_0x39b2bf[_0x9d88('0x4b')]);if(_0x284ebd&&_0x284ebd[_0x9d88('0x4c')]){logger[_0x9d88('0xe')]('['+_0xdedb5e[_0x9d88('0x6f')][_0x9d88('0x70')]()+']',_0x9d88('0x4e'));_0xdedb5e['recordingURL']=util[_0x9d88('0x18')](_0x9d88('0x50'),_0x39b2bf[_0x9d88('0x4b')],_0xdedb5e[_0x9d88('0x51')],md5(_0xdedb5e[_0x9d88('0x51')]));}else{_0xdedb5e[_0x9d88('0x4f')]='';}headers[_0x9d88('0x52')]=getAuth(_0x39b2bf);return getUser(_0x39b2bf)[_0x9d88('0x14')](function(_0x19e03b){_0x5e77ad=_0x19e03b;logger[_0x9d88('0xe')](_0x9d88('0x54'),_0x5e77ad['id']);return getEndUser(_0x39b2bf,_0xdedb5e['calleridname'],_0xdedb5e['calleridnum']);})[_0x9d88('0x14')](function(_0x3d3410){_0x1e8d79=_0x3d3410;logger[_0x9d88('0xe')](_0x9d88('0x57'),_0x1e8d79['id']);return getTicket(_0x39b2bf,_0x5e77ad,_0x1e8d79,_0x24f56d,_0xdedb5e);})['then'](function(_0x2060f8){if(_0x2060f8){logger[_0x9d88('0xe')]('The\x20Ticket\x20ID\x20is:',_0x2060f8['id']);}})[_0x9d88('0x63')](function(_0x2ed053){logger[_0x9d88('0x61')]('['+_0xdedb5e[_0x9d88('0x6f')][_0x9d88('0x70')]()+']'+_0x9d88('0x71'),util[_0x9d88('0x6d')](_0x2ed053,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9b15=['integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','Recording\x20is\x20enabled!','email','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','newTab','trigger:browser:url','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','filter','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','%s:%s','username','password','token','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','includes','string','picklist','type','nameField','customField','content','idField','push','variable','variableName','customVariable','Variable','toLowerCase','custom_fields','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:'];(function(_0x1f6ab1,_0x251250){var _0x18e58a=function(_0x544c20){while(--_0x544c20){_0x1f6ab1['push'](_0x1f6ab1['shift']());}};_0x18e58a(++_0x251250);}(_0x9b15,0xf8));var _0x59b1=function(_0x38cfd9,_0xac652b){_0x38cfd9=_0x38cfd9-0x0;var _0x83c895=_0x9b15[_0x38cfd9];return _0x83c895;};'use strict';var _=require(_0x59b1('0x0'));var rp=require('request-promise');var md5=require(_0x59b1('0x1'));var util=require('util');var Redis=require(_0x59b1('0x2'));var intUtil=require('./util');var config=require(_0x59b1('0x3'));var logger=require(_0x59b1('0x4'))(_0x59b1('0x5'));config[_0x59b1('0x6')]=_[_0x59b1('0x7')](config[_0x59b1('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x59b1('0x8'))(new Redis(config[_0x59b1('0x6')]));function emit(_0xe6126b,_0x5d626c,_0x31e0b4){io['to'](_0xe6126b)[_0x59b1('0x9')](_0x5d626c,_0x31e0b4);}var headers={'Content-Type':'application/json','Accept':_0x59b1('0xa')};function getTicket(_0x30058e,_0x430458,_0x185d71,_0x598881,_0x251e86){logger[_0x59b1('0xb')](_0x59b1('0xc'));return request({'uri':util[_0x59b1('0xd')](_0x59b1('0xe'),_0x30058e[_0x59b1('0xf')]),'method':_0x59b1('0x10'),'body':{'ticket':_[_0x59b1('0x11')]({'requester_id':_0x185d71['id'],'submitter_id':_0x430458?_0x430458['id']:undefined,'assignee_id':_0x430458?_0x430458['id']:undefined,'tags':getTags(_0x598881[_0x59b1('0x12')],_0x59b1('0x13')),'subject':intUtil[_0x59b1('0x14')](_0x598881[_0x59b1('0x15')],_0x251e86,'\x20'),'description':intUtil['getString'](_0x598881[_0x59b1('0x16')],_0x251e86,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x598881[_0x59b1('0x16')],_0x251e86,'\x0a')}},getCustomFields(_0x598881[_0x59b1('0x17')],_0x251e86))}})[_0x59b1('0x18')](function(_0x36284f){logger[_0x59b1('0xb')](_0x59b1('0x19'));return _0x36284f[_0x59b1('0x1a')];});}function getUser(_0x149848,_0x22d213){if(intUtil[_0x59b1('0x1b')](_0x22d213)){logger['info'](_0x59b1('0x1c'),_0x22d213);return request({'uri':util[_0x59b1('0xd')](_0x59b1('0x1d'),_0x149848[_0x59b1('0xf')]),'qs':{'query':util['format'](_0x59b1('0x1e'),_0x22d213)}})['then'](function(_0x3080a4){if(_0x3080a4[_0x59b1('0x1f')]){logger[_0x59b1('0xb')]('Agent\x20found!');return _[_0x59b1('0x20')](_0x3080a4[_0x59b1('0x21')],{'email':_0x22d213,'role':_0x59b1('0x22')});}else{logger[_0x59b1('0xb')](_0x59b1('0x23'));return request({'uri':util['format'](_0x59b1('0x24'),_0x149848[_0x59b1('0xf')])})['then'](function(_0x4ed475){logger[_0x59b1('0xb')](_0x59b1('0x25'));return _0x4ed475['user'];});}});}else{logger['info'](_0x59b1('0x23'));return request({'uri':util['format'](_0x59b1('0x24'),_0x149848['remoteUri'])})[_0x59b1('0x18')](function(_0x35e060){logger[_0x59b1('0xb')](_0x59b1('0x25'));return _0x35e060[_0x59b1('0x26')];});}}function getEndUser(_0x57ece7,_0x9c1690,_0x240303){logger['info']('Searching\x20enduser\x20with\x20phone',_0x240303);return request({'uri':util[_0x59b1('0xd')](_0x59b1('0x1d'),_0x57ece7[_0x59b1('0xf')]),'qs':{'query':util[_0x59b1('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x240303)}})['then'](function(_0x13bf77){var _0x30e3e2;if(_0x13bf77[_0x59b1('0x21')]['length']){_0x13bf77[_0x59b1('0x21')]=_[_0x59b1('0x27')](_0x13bf77['results'],{'suspended':![],'role':_0x59b1('0x28')});if(_0x13bf77['results'][_0x59b1('0x29')]){_0x30e3e2=_[_0x59b1('0x2a')](_0x13bf77[_0x59b1('0x21')]);}}if(_0x30e3e2){logger[_0x59b1('0xb')]('Enduser\x20found!');return _0x30e3e2;}else{logger['info'](_0x59b1('0x2b'));return request({'uri':util['format'](_0x59b1('0x2c'),_0x57ece7['remoteUri']),'method':_0x59b1('0x10'),'body':{'user':{'role':'end-user','name':util['format'](_0x59b1('0x2d'),_0x9c1690||_0x240303),'phone':_0x240303}}})['then'](function(_0x1544ed){logger['info']('Enduser\x20created.');return _0x1544ed[_0x59b1('0x26')];});}});}function getAuth(_0x2180a0){var _0x13f497;if(_0x2180a0[_0x59b1('0x2e')]==='password'){_0x13f497=util[_0x59b1('0xd')](_0x59b1('0x2f'),_0x2180a0[_0x59b1('0x30')],_0x2180a0[_0x59b1('0x31')]);}else if(_0x2180a0[_0x59b1('0x2e')]===_0x59b1('0x32')){_0x13f497=util[_0x59b1('0xd')]('%s/token:%s',_0x2180a0[_0x59b1('0x30')],_0x2180a0[_0x59b1('0x32')]);}return util[_0x59b1('0xd')](_0x59b1('0x33'),new Buffer(_0x13f497)[_0x59b1('0x34')]('base64'));}function request(_0x14de0e){logger[_0x59b1('0x35')](_0x59b1('0x36'),JSON[_0x59b1('0x37')](_0x14de0e));return rp(_['defaults'](_0x14de0e,{'method':_0x59b1('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x555edb,_0x3722be){var _0x76ecb0=[];if(_0x555edb&&_0x555edb[_0x59b1('0x29')]>0x0){_0x76ecb0=_['map'](_0x555edb,_0x3722be);}return _0x76ecb0;}function getCustomFields(_0x3aa4a6,_0x1cd8e3){var _0xf69b52=[];var _0x4eaca8={'custom_fields':[]};if(_0x3aa4a6['length']>0x0){_['forEach'](_0x3aa4a6,function(_0x26d6c6){if(_[_0x59b1('0x39')]([_0x59b1('0x3a'),_0x59b1('0x3b')],_0x26d6c6[_0x59b1('0x3c')])&&_0x26d6c6[_0x59b1('0x3d')]&&!_0x26d6c6[_0x59b1('0x3e')]){_0x4eaca8[_0x26d6c6[_0x59b1('0x3d')]['toLowerCase']()]=_0x26d6c6[_0x59b1('0x3f')]['toString']();}else if(_['includes']([_0x59b1('0x3a'),_0x59b1('0x3b')],_0x26d6c6['type'])&&_0x26d6c6[_0x59b1('0x40')]&&_0x26d6c6['customField']){_0x4eaca8['custom_fields'][_0x59b1('0x41')]({'id':_0x26d6c6[_0x59b1('0x40')],'value':_0x26d6c6[_0x59b1('0x3f')][_0x59b1('0x34')]()});}else if(_0x26d6c6[_0x59b1('0x3c')]===_0x59b1('0x42')&&_0x26d6c6[_0x59b1('0x43')]&&_0x26d6c6[_0x59b1('0x40')]&&_0x26d6c6[_0x59b1('0x3e')]){_0x1cd8e3[_0x26d6c6[_0x59b1('0x43')]]&&_0x4eaca8['custom_fields'][_0x59b1('0x41')]({'id':_0x26d6c6[_0x59b1('0x40')],'value':_0x1cd8e3[_0x26d6c6[_0x59b1('0x43')]][_0x59b1('0x34')]()});}else if(_0x26d6c6['type']===_0x59b1('0x44')&&_0x26d6c6[_0x59b1('0x45')]&&_0x26d6c6[_0x59b1('0x45')][_0x59b1('0x13')]&&_0x26d6c6[_0x59b1('0x40')]&&_0x26d6c6['customField']){_0x1cd8e3[_0x26d6c6['Variable'][_0x59b1('0x13')][_0x59b1('0x46')]()]&&_0x4eaca8[_0x59b1('0x47')][_0x59b1('0x41')]({'id':_0x26d6c6[_0x59b1('0x40')],'value':_0x1cd8e3[_0x26d6c6[_0x59b1('0x45')][_0x59b1('0x13')]['toLowerCase']()][_0x59b1('0x34')]()});}});}return _0x4eaca8;}exports[_0x59b1('0x48')]=function(_0x55e63c,_0x33a95a,_0xdad03,_0x4448d9,_0x2c1b70,_0x5da272){var _0x42d392,_0x367a1c;_0x5da272[_0x59b1('0xf')]=intUtil['stripTrailingSlash'](_0x5da272['remoteUri']);_0x5da272['serverUrl']=intUtil[_0x59b1('0x49')](_0x5da272[_0x59b1('0x4a')]);if(_0x2c1b70&&_0x2c1b70[_0x59b1('0x4b')]){logger['info'](_0x59b1('0x4c'),'Recording\x20is\x20enabled!');_0x33a95a[_0x59b1('0x4d')]=util['format'](_0x59b1('0x4e'),_0x5da272[_0x59b1('0x4a')],_0x33a95a['uniqueid'],md5(_0x33a95a[_0x59b1('0x4f')]));}else{_0x33a95a[_0x59b1('0x4d')]='';}headers[_0x59b1('0x50')]=getAuth(_0x5da272);return getUser(_0x5da272,_0x4448d9['email'])[_0x59b1('0x18')](function(_0x4e3e8c){_0x42d392=_0x4e3e8c;logger[_0x59b1('0xb')]('The\x20User\x20ID\x20is:',_0x42d392['id']);return getEndUser(_0x5da272,_0x33a95a[_0x59b1('0x51')],_0x33a95a[_0x59b1('0x52')]);})[_0x59b1('0x18')](function(_0xdf6a84){_0x367a1c=_0xdf6a84;logger[_0x59b1('0xb')](_0x59b1('0x53'),_0x367a1c['id']);return getTicket(_0x5da272,_0x42d392,_0x367a1c,_0xdad03,_0x33a95a);})[_0x59b1('0x18')](function(_0x9a729){if(_0x9a729){logger['info'](_0x59b1('0x54'),_0x9a729['id']);switch(_0x5da272[_0x59b1('0x3c')]){case _0x59b1('0x55'):logger[_0x59b1('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x59b1('0xd')](_0x59b1('0x56'),_0x5da272['remoteUri'],_0x42d392['id'],_0x9a729['id']),'method':_0x59b1('0x10')});case'newTab':logger[_0x59b1('0xb')](_0x59b1('0x4c'),_0x59b1('0x57'));emit(util[_0x59b1('0xd')](_0x59b1('0x58'),_0x4448d9[_0x59b1('0x13')]),'trigger:browser:url',{'uri':util['format'](_0x59b1('0x59'),_0x5da272[_0x59b1('0xf')][_0x59b1('0x5a')]('/api/v2',''),_0x9a729['id'])});break;default:logger['error'](_0x59b1('0x4c'),_0x59b1('0x5b'));}}})[_0x59b1('0x5c')](function(_0xe2ef9c){logger[_0x59b1('0x5d')](_0x59b1('0x5e'),util[_0x59b1('0x5f')](_0xe2ef9c,{'showHidden':!![],'depth':null}));});};exports[_0x59b1('0x60')]=function(_0x2c9714,_0x416783,_0x18dee0,_0x5603ac,_0x53314a,_0x31ba56,_0x19fd9d){var _0x19d0e6,_0x307cfb;_0x31ba56['remoteUri']=intUtil[_0x59b1('0x49')](_0x31ba56[_0x59b1('0xf')]);_0x31ba56[_0x59b1('0x4a')]=intUtil[_0x59b1('0x49')](_0x31ba56[_0x59b1('0x4a')]);if(_0x19fd9d&&_0x19fd9d['recordingFormat']&&_0x19fd9d[_0x59b1('0x61')]!=='none'){logger[_0x59b1('0xb')]('[OUTBOUND]',_0x59b1('0x62'));_0x416783[_0x59b1('0x4d')]=util[_0x59b1('0xd')](_0x59b1('0x4e'),_0x31ba56[_0x59b1('0x4a')],_0x416783[_0x59b1('0x4f')],md5(_0x416783[_0x59b1('0x4f')]));}headers[_0x59b1('0x50')]=getAuth(_0x31ba56);return getUser(_0x31ba56,_0x5603ac[_0x59b1('0x63')])['then'](function(_0x16fa19){_0x19d0e6=_0x16fa19;logger[_0x59b1('0xb')](_0x59b1('0x64'),_0x19d0e6['id']);return getEndUser(_0x31ba56,_0x416783['destcalleridname'],_0x416783[_0x59b1('0x65')]);})[_0x59b1('0x18')](function(_0x1536ee){_0x307cfb=_0x1536ee;logger[_0x59b1('0xb')](_0x59b1('0x53'),_0x307cfb['id']);return getTicket(_0x31ba56,_0x19d0e6,_0x307cfb,_0x18dee0,_0x416783);})[_0x59b1('0x18')](function(_0x5465af){if(_0x5465af){logger[_0x59b1('0xb')](_0x59b1('0x54'),_0x5465af['id']);switch(_0x31ba56[_0x59b1('0x3c')]){case _0x59b1('0x55'):logger[_0x59b1('0xb')](_0x59b1('0x66'),_0x59b1('0x67'));return request({'uri':util[_0x59b1('0xd')](_0x59b1('0x56'),_0x31ba56[_0x59b1('0xf')],_0x19d0e6['id'],_0x5465af['id']),'method':_0x59b1('0x10')});case _0x59b1('0x68'):logger['info'](_0x59b1('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x59b1('0xd')](_0x59b1('0x58'),_0x5603ac[_0x59b1('0x13')]),_0x59b1('0x69'),{'uri':util['format']('%s/agent/tickets/%s',_0x31ba56['remoteUri']['replace'](_0x59b1('0x6a'),''),_0x5465af['id'])});break;default:logger[_0x59b1('0x5d')](_0x59b1('0x66'),_0x59b1('0x5b'));}}})[_0x59b1('0x5c')](function(_0x34856e){logger[_0x59b1('0x5d')](_0x59b1('0x6b'),util[_0x59b1('0x5f')](_0x34856e,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x2cdf93,_0x597b29,_0x4cb18d,_0x18a69e,_0x1a7f9d,_0x532f89){var _0x496e8e,_0x6c1f7c;_0x532f89[_0x59b1('0xf')]=intUtil[_0x59b1('0x49')](_0x532f89[_0x59b1('0xf')]);_0x532f89[_0x59b1('0x4a')]=intUtil[_0x59b1('0x49')](_0x532f89['serverUrl']);if(_0x1a7f9d&&_0x1a7f9d[_0x59b1('0x4b')]){logger[_0x59b1('0xb')]('['+_0x597b29[_0x59b1('0x6c')][_0x59b1('0x6d')]()+']',_0x59b1('0x62'));_0x597b29[_0x59b1('0x4d')]=util[_0x59b1('0xd')](_0x59b1('0x4e'),_0x532f89[_0x59b1('0x4a')],_0x597b29['uniqueid'],md5(_0x597b29[_0x59b1('0x4f')]));}else{_0x597b29[_0x59b1('0x4d')]='';}headers[_0x59b1('0x50')]=getAuth(_0x532f89);return getUser(_0x532f89)[_0x59b1('0x18')](function(_0x557964){_0x496e8e=_0x557964;logger[_0x59b1('0xb')](_0x59b1('0x64'),_0x496e8e['id']);return getEndUser(_0x532f89,_0x597b29[_0x59b1('0x51')],_0x597b29[_0x59b1('0x52')]);})['then'](function(_0x4b4910){_0x6c1f7c=_0x4b4910;logger[_0x59b1('0xb')](_0x59b1('0x53'),_0x6c1f7c['id']);return getTicket(_0x532f89,_0x496e8e,_0x6c1f7c,_0x4cb18d,_0x597b29);})[_0x59b1('0x18')](function(_0x3e8d70){if(_0x3e8d70){logger[_0x59b1('0xb')](_0x59b1('0x54'),_0x3e8d70['id']);}})[_0x59b1('0x5c')](function(_0x4aa1e7){logger[_0x59b1('0x5d')]('['+_0x597b29['lastevent'][_0x59b1('0x6d')]()+']'+_0x59b1('0x6e'),util[_0x59b1('0x5f')](_0x4aa1e7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 0349f35..57f4ffc 100644 --- a/server/services/ami/trigger/integration/zoho.js +++ b/server/services/ami/trigger/integration/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4e9=['/api/voice/recordings/','uniqueid','zoho.eu','com','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','user:%s','unmanaged','toUpperCase','calleridnum','lodash','request-promise','./util','ioredis','../../../../config/logger','zoho','socket.io-emitter','[HTTP]','length','forEach','picklist','type','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','POST','https://www.zohoapis.','/crm/v2/','moduleCreate','role','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','enduserType','startCase','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Owner','administrator','first_name','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','Answered','rejected','abandoned','timeout','Timeout','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x5da1c6,_0x36e363){var _0x1e7b10=function(_0x256fc0){while(--_0x256fc0){_0x5da1c6['push'](_0x5da1c6['shift']());}};_0x1e7b10(++_0x36e363);}(_0xa4e9,0x1c6));var _0x9a4e=function(_0x5f5dd3,_0x2ce595){_0x5f5dd3=_0x5f5dd3-0x0;var _0x7ec6bf=_0xa4e9[_0x5f5dd3];return _0x7ec6bf;};'use strict';var _=require(_0x9a4e('0x0'));var rp=require(_0x9a4e('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x9a4e('0x2'));var moment=require('moment');var Redis=require(_0x9a4e('0x3'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x9a4e('0x4'))(_0x9a4e('0x5'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9a4e('0x6'))(new Redis(config['redis']));function emit(_0x2c4483,_0x231eff,_0x30b4fe){io['to'](_0x2c4483)['emit'](_0x231eff,_0x30b4fe);}function request(_0xfec7bb){logger['debug'](_0x9a4e('0x7'),JSON['stringify'](_0xfec7bb));return rp(_0xfec7bb);}function getCustomFields(_0x766fd6,_0x462f72){var _0xfbea11={};if(_0x766fd6[_0x9a4e('0x8')]>0x0){_[_0x9a4e('0x9')](_0x766fd6,function(_0x2fd7bb){if(_['includes'](['string',_0x9a4e('0xa')],_0x2fd7bb[_0x9a4e('0xb')])&&_0x2fd7bb[_0x9a4e('0xc')]){_0xfbea11[_0x2fd7bb['idField']]=_0x2fd7bb['content'][_0x9a4e('0xd')]();}else if(_0x2fd7bb[_0x9a4e('0xb')]===_0x9a4e('0xe')&&_0x2fd7bb['variableName']&&_0x2fd7bb['idField']&&_0x462f72[_0x2fd7bb[_0x9a4e('0xf')]]){_0xfbea11[_0x2fd7bb['idField']]=_0x462f72[_0x2fd7bb[_0x9a4e('0xf')]]['toString']();}else if(_0x2fd7bb[_0x9a4e('0xb')]==='customVariable'&&_0x2fd7bb['Variable']&&_0x2fd7bb[_0x9a4e('0x10')]['name']&&_0x2fd7bb[_0x9a4e('0xc')]&&_0x462f72[_0x2fd7bb[_0x9a4e('0x10')][_0x9a4e('0x11')][_0x9a4e('0x12')]()]){_0xfbea11[_0x2fd7bb[_0x9a4e('0xc')]]=_0x462f72[_0x2fd7bb['Variable'][_0x9a4e('0x11')]['toLowerCase']()][_0x9a4e('0xd')]();}});}return _0xfbea11;}function getName(_0x56bf6e){if(_0x56bf6e[_0x9a4e('0x13')]('\x20')>0x0){var _0x498671=_0x56bf6e[_0x9a4e('0x14')](/ (.+)/);if(_0x498671[0x1]){return _0x498671;}}return[_0x56bf6e,_0x56bf6e];}var accountsTokens={};function getAccessToken(_0x315bda){return new Promise(function(_0x4b231b,_0x5af1c2){if(!_['isNil'](accountsTokens[_0x315bda['id']])&&!_[_0x9a4e('0x15')](accountsTokens[_0x315bda['id']][_0x9a4e('0x16')])){if(moment()['isBefore'](accountsTokens[_0x315bda['id']][_0x9a4e('0x17')])){_0x4b231b(accountsTokens[_0x315bda['id']][_0x9a4e('0x16')]);}}var _0x3b10f0;switch(_0x315bda['zone']){case'US':_0x3b10f0=_0x9a4e('0x18');break;case'AU':_0x3b10f0=_0x9a4e('0x19');break;case'EU':_0x3b10f0='https://accounts.zoho.eu';break;case'IN':_0x3b10f0=_0x9a4e('0x1a');break;case'CN':_0x3b10f0=_0x9a4e('0x1b');break;default:_0x3b10f0=_0x9a4e('0x1c');break;}var _0x336994={'method':'POST','uri':_0x3b10f0+_0x9a4e('0x1d'),'qs':{'refresh_token':_0x315bda[_0x9a4e('0x1e')],'client_id':_0x315bda[_0x9a4e('0x1f')],'client_secret':_0x315bda[_0x9a4e('0x20')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x336994)[_0x9a4e('0x21')](function(_0x6f453a){accountsTokens[_0x315bda['id']]={'access_token':_0x6f453a[_0x9a4e('0x16')],'expires_in':moment()[_0x9a4e('0x22')](_0x6f453a[_0x9a4e('0x17')],_0x9a4e('0x23'))};_0x4b231b(_0x6f453a[_0x9a4e('0x16')]);})['catch'](function(_0x57634e){logger[_0x9a4e('0x24')](_0x9a4e('0x25'),_0x57634e[_0x9a4e('0x26')]);_0x5af1c2(_0x57634e);});});}function getUser(_0x3540ac,_0xd45add,_0x3a2b77,_0x53ad39){logger[_0x9a4e('0x27')]('Search\x20user');return request({'method':_0x9a4e('0x28'),'uri':util[_0x9a4e('0x29')]('https://www.zohoapis.%s/crm/v2/users',_0xd45add),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3540ac},'json':!![]})[_0x9a4e('0x21')](function(_0x23d691){if(_0x23d691['users']){var _0x158c85=-0x1;if(_['isArrayLikeObject'](_0x23d691[_0x9a4e('0x2a')])){if(!_[_0x9a4e('0x15')](_0x53ad39)){_0x158c85=_[_0x9a4e('0x2b')](_0x23d691[_0x9a4e('0x2a')],function(_0x19e611){return _0x19e611[_0x9a4e('0x2c')]===_0x53ad39;});}if(_0x158c85>=0x0){logger[_0x9a4e('0x27')](_0x9a4e('0x2d'));}else{logger[_0x9a4e('0x27')](_0x9a4e('0x2e'));_0x158c85=_[_0x9a4e('0x2b')](_0x23d691[_0x9a4e('0x2a')],function(_0x31addd){return _0x31addd[_0x9a4e('0x2f')][_0x9a4e('0x11')]===_0x9a4e('0x30');});}return _0x23d691[_0x9a4e('0x2a')][_0x158c85];}else{if(_0x23d691[_0x9a4e('0x31')]['profile'][_0x9a4e('0x11')]===_0x9a4e('0x30')){logger[_0x9a4e('0x27')]('Using\x20the\x20admin\x20account!');user=_0x23d691[_0x9a4e('0x31')];return user;}else{logger[_0x9a4e('0x24')](_0x9a4e('0x32'),JSON[_0x9a4e('0x33')](_0x23d691));throw new Error(_0x9a4e('0x34')+JSON[_0x9a4e('0x33')](_0x23d691));}}}else{logger[_0x9a4e('0x24')](_0x9a4e('0x32'),JSON[_0x9a4e('0x33')](_0x23d691));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x23d691));}})[_0x9a4e('0x35')](function(_0x5ca614){console[_0x9a4e('0x24')](_0x5ca614);});}function getZohoUser(_0x1936ee,_0x2017f2){return new BPromise(function(_0x144ec0,_0x4004b9){request(_0x1936ee)[_0x9a4e('0x21')](function(_0x3cce83){var _0x357ccf=null;if(_0x3cce83){_0x357ccf=_0x3cce83[_0x9a4e('0x36')][0x0];_0x357ccf['enduserType']=_0x2017f2;}_0x144ec0(_0x357ccf);})['catch'](function(_0x45e954){_0x4004b9(_0x45e954);});});}function createEndUser(_0x205156,_0x419cca,_0x2bcf9a,_0x59caa4,_0x10fdcf,_0x40b5c5){var _0x2bcf9a=getName(_0x2bcf9a);return request({'method':_0x9a4e('0x37'),'uri':_0x9a4e('0x38')+_0x419cca+_0x9a4e('0x39')+_['startCase'](_0x40b5c5[_0x9a4e('0x3a')])+'s','body':{'data':[{'Last_Name':_0x2bcf9a[0x1],'First_Name':_0x2bcf9a[0x0],'Phone':_0x59caa4,'Owner':{'name':!_[_0x9a4e('0x15')](_0x10fdcf[_0x9a4e('0x3b')][_0x9a4e('0x11')])?_0x10fdcf[_0x9a4e('0x3b')][_0x9a4e('0x11')]:!_[_0x9a4e('0x15')](_0x10fdcf['first_name'])?_0x10fdcf['first_name']+'\x20'+_0x10fdcf[_0x9a4e('0x3c')]:_0x10fdcf[_0x9a4e('0x3c')],'id':_0x10fdcf['id']}}]},'headers':{'Authorization':_0x9a4e('0x3d')+_0x205156},'json':!![]})[_0x9a4e('0x21')](function(_0x179598){if(_0x179598&&_0x179598[_0x9a4e('0x36')][0x0][_0x9a4e('0x3e')]===_0x9a4e('0x3f')){var _0x33f5a2=_0x179598[_0x9a4e('0x36')][0x0][_0x9a4e('0x40')];_0x33f5a2[_0x9a4e('0x41')]=_[_0x9a4e('0x42')](_0x40b5c5[_0x9a4e('0x3a')])+'s';return _0x33f5a2;}logger[_0x9a4e('0x24')](_0x9a4e('0x32'),JSON['stringify'](data));throw new Error(_0x9a4e('0x43')+JSON['stringify'](data));})['catch'](function(_0x2d669e){console[_0x9a4e('0x44')](_0x9a4e('0x45'),_0x2d669e);});}function getEndUser(_0x15755c,_0x8553e,_0xef4a58,_0x5a0890,_0xc4f87c,_0x2eb5fc,_0x28a3b0){var _0x1363a1={'method':_0x9a4e('0x28'),'uri':'','headers':{'Authorization':_0x9a4e('0x3d')+_0x15755c},'json':!![]};switch(_0x28a3b0['moduleSearch']){case _0x9a4e('0x46'):_0x1363a1[_0x9a4e('0x47')]='https://www.zohoapis.'+_0x8553e+_0x9a4e('0x48')+_0xc4f87c+'))';return getZohoUser(_0x1363a1,_0x9a4e('0x49'))['then'](function(_0x6ba719){if(_0x6ba719)return _0x6ba719;_0x1363a1[_0x9a4e('0x47')]=_0x9a4e('0x38')+_0x8553e+_0x9a4e('0x4a')+_0xc4f87c+'))';return getZohoUser(_0x1363a1,_0x9a4e('0x4b'))[_0x9a4e('0x21')](function(_0x4f0d7f){if(_0x4f0d7f)return _0x4f0d7f;if(_0x28a3b0['moduleCreate']!=_0x9a4e('0x4c')){return createEndUser(_0x15755c,_0x8553e,_0x5a0890,_0xc4f87c,_0x2eb5fc,_0x28a3b0);}else{return{};}});});break;case _0x9a4e('0x4d'):_0x1363a1[_0x9a4e('0x47')]='https://www.zohoapis.'+_0x8553e+_0x9a4e('0x48')+_0xc4f87c+'))';return getZohoUser(_0x1363a1,_0x9a4e('0x49'))[_0x9a4e('0x21')](function(_0x49157f){if(_0x49157f)return _0x49157f;if(_0x28a3b0[_0x9a4e('0x3a')]!='nothing'){return createEndUser(_0x15755c,_0x8553e,_0x5a0890,_0xc4f87c,_0x2eb5fc,_0x28a3b0);}else{return{};}});break;case'lead':_0x1363a1['uri']=_0x9a4e('0x38')+_0x8553e+_0x9a4e('0x4a')+_0xc4f87c+'))';return getZohoUser(_0x1363a1,_0x9a4e('0x4b'))[_0x9a4e('0x21')](function(_0x21a294){if(_0x21a294)return _0x21a294;if(_0x28a3b0[_0x9a4e('0x3a')]!=_0x9a4e('0x4c')){return createEndUser(_0x15755c,_0x8553e,_0x5a0890,_0xc4f87c,_0x2eb5fc,_0x28a3b0);}else{return{};}});break;}}function getCall(_0x3d4546,_0x2a4526,_0x903c01,_0x1dde34,_0x372242,_0x3a814d,_0x267053,_0x5776aa){logger[_0x9a4e('0x27')]('Creating\x20new\x20call...');var _0x2011c4={};_0x2011c4[_0x9a4e('0x4e')]={'name':!_['isNil'](_0x1dde34[_0x9a4e('0x3b')][_0x9a4e('0x11')])&&!_[_0x9a4e('0x15')](_0x1dde34[_0x9a4e('0x2f')][_0x9a4e('0x11')])&&_0x1dde34[_0x9a4e('0x2f')][_0x9a4e('0x11')]===_0x9a4e('0x4f')?_0x1dde34['role'][_0x9a4e('0x11')]:!_['isNil'](_0x1dde34['first_name'])?_0x1dde34[_0x9a4e('0x50')]+'\x20'+_0x1dde34[_0x9a4e('0x3c')]:_0x1dde34[_0x9a4e('0x3c')],'id':_0x1dde34['id']};_0x2011c4[_0x9a4e('0x51')]=intUtil['getString'](_0x3a814d[_0x9a4e('0x52')],_0x267053,'\x20');_0x2011c4[_0x9a4e('0x53')]=intUtil[_0x9a4e('0x54')](_0x3a814d[_0x9a4e('0x55')],_0x267053,'\x0a');if(_0x372242[_0x9a4e('0x41')]===_0x9a4e('0x49')){_0x2011c4[_0x9a4e('0x56')]={'name':!_[_0x9a4e('0x15')](_0x372242['Full_Name'])?_0x372242[_0x9a4e('0x57')]:!_[_0x9a4e('0x15')](_0x372242[_0x9a4e('0x58')])?_0x372242[_0x9a4e('0x58')]+'\x20'+_0x372242[_0x9a4e('0x59')]:_0x372242[_0x9a4e('0x59')],'id':_0x372242['id']};}if(_0x372242[_0x9a4e('0x41')]==='Leads'){_0x2011c4[_0x9a4e('0x5a')]={'name':!_['isNil'](_0x372242[_0x9a4e('0x57')])?_0x372242[_0x9a4e('0x57')]:!_[_0x9a4e('0x15')](_0x372242['First_Name'])?_0x372242[_0x9a4e('0x58')]+'\x20'+_0x372242[_0x9a4e('0x59')]:_0x372242[_0x9a4e('0x59')],'id':_0x372242['id']};_0x2011c4[_0x9a4e('0x5b')]=_['startCase'](_0x372242['enduserType']);}if(_0x267053[_0x9a4e('0x5c')]){_0x2011c4[_0x9a4e('0x5d')]=moment[_0x9a4e('0x5e')](parseInt(_0x267053[_0x9a4e('0x5c')])*0x3e8)[_0x9a4e('0x29')](_0x9a4e('0x5f'));}else if(_0x267053[_0x9a4e('0x60')]&&_0x267053[_0x9a4e('0x61')]){_0x2011c4[_0x9a4e('0x5d')]=moment[_0x9a4e('0x5e')](moment(_0x267053['endtime'],_0x9a4e('0x62'))[_0x9a4e('0x63')](moment(_0x267053[_0x9a4e('0x64')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x9a4e('0x5f'));}switch(_0x267053[_0x9a4e('0x65')]){case _0x9a4e('0x66'):_0x2011c4[_0x9a4e('0x67')]=_0x9a4e('0x68');break;case _0x9a4e('0x69'):case'connect':_0x2011c4['Call_Result']=_0x9a4e('0x6a');break;case _0x9a4e('0x6b'):_0x2011c4[_0x9a4e('0x67')]='Rejected';break;case _0x9a4e('0x6c'):_0x2011c4[_0x9a4e('0x67')]='Abandoned';break;case _0x9a4e('0x6d'):_0x2011c4[_0x9a4e('0x67')]=_0x9a4e('0x6e');default:}_0x2011c4['Call_Start_Time']=(_0x5776aa==='outbound'?moment(_0x267053[_0x9a4e('0x64')])['format'](_0x9a4e('0x62')):moment(_0x267053['agentcalledAt'])['format'](_0x9a4e('0x62')))||moment()['format'](_0x9a4e('0x62'));_0x2011c4[_0x9a4e('0x6f')]=_0x5776aa||_0x9a4e('0x70');_0x2011c4=_[_0x9a4e('0x71')](_0x2011c4,getCustomFields(_0x3a814d[_0x9a4e('0x72')],_0x267053));return request({'method':_0x9a4e('0x37'),'uri':_0x9a4e('0x38')+_0x2a4526+_0x9a4e('0x73'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3d4546},'body':{'data':[_0x2011c4]},'json':!![]})[_0x9a4e('0x21')](function(_0x101135){if(_0x101135&&_0x101135[_0x9a4e('0x36')][0x0][_0x9a4e('0x3e')]===_0x9a4e('0x3f')){logger['info'](_0x9a4e('0x74'));return{'id':_0x101135[_0x9a4e('0x36')][0x0][_0x9a4e('0x40')]['id']};}})['catch'](function(_0x397486){logger[_0x9a4e('0x27')](_0x9a4e('0x75'),_0x397486[_0x9a4e('0x26')]);console['log']('err',_0x397486);});}exports[_0x9a4e('0x76')]=function(_0x317c42,_0x1e0560,_0x5b45ec,_0x91071c,_0x262622,_0x1999b5){var _0x732178,_0x19a8fc,_0xadef92;_0x1999b5[_0x9a4e('0x77')]=intUtil[_0x9a4e('0x78')](_0x1999b5[_0x9a4e('0x77')]);_0x1999b5['serverUrl']=intUtil[_0x9a4e('0x78')](_0x1999b5[_0x9a4e('0x79')]);if(_0x262622&&_0x262622[_0x9a4e('0x7a')]){logger[_0x9a4e('0x27')](_0x9a4e('0x7b'),_0x9a4e('0x7c'));_0x1e0560[_0x9a4e('0x7d')]=_0x1999b5[_0x9a4e('0x79')]+_0x9a4e('0x7e')+_0x1e0560[_0x9a4e('0x7f')]+'/downloads?type=uniqueid&token='+md5(_0x1e0560[_0x9a4e('0x7f')]);}else{_0x1e0560[_0x9a4e('0x7d')]='';}var _0x2a691e=_0x1999b5[_0x9a4e('0x77')]===_0x9a4e('0x80')?'eu':_0x9a4e('0x81');return getAccessToken(_0x1999b5)[_0x9a4e('0x21')](function(_0xf2e7a4){_0xadef92=_0xf2e7a4;return getUser(_0xadef92,_0x2a691e,_0x1999b5,_0x91071c[_0x9a4e('0x2c')]);})['then'](function(_0x1e025d){_0x732178=_0x1e025d;logger[_0x9a4e('0x27')]('The\x20User\x20ID\x20is:',_0x732178['id']);return getEndUser(_0xadef92,_0x2a691e,_0x1999b5,_0x1e0560[_0x9a4e('0x82')],_0x1e0560['calleridnum'],_0x732178,_0x5b45ec);})[_0x9a4e('0x21')](function(_0x6c513d){_0x19a8fc=_0x6c513d;return getCall(_0xadef92,_0x2a691e,_0x1999b5,_0x732178,_0x19a8fc,_0x5b45ec,_0x1e0560,_0x9a4e('0x70'));})[_0x9a4e('0x21')](function(_0x459090){if(_0x459090){logger[_0x9a4e('0x27')](_0x9a4e('0x83'),_0x459090['id']);logger[_0x9a4e('0x27')](_0x9a4e('0x7b'),_0x9a4e('0x84'));emit(util['format']('user:%s',_0x91071c['name']),_0x9a4e('0x85'),{'uri':'https://crm.'+_0x1999b5[_0x9a4e('0x77')]+_0x9a4e('0x86')+_0x459090['id']});}})[_0x9a4e('0x35')](function(_0x5c194f){logger[_0x9a4e('0x24')](_0x9a4e('0x7b'),JSON['stringify'](_0x5c194f));});};exports['outbound']=function(_0x5b015c,_0x57294c,_0xbabb5f,_0x2ba019,_0x37e970,_0x18081e,_0x3fda34){var _0x3c6ebc,_0x47607d,_0x425c51;_0x18081e[_0x9a4e('0x77')]=intUtil[_0x9a4e('0x78')](_0x18081e['host']);_0x18081e[_0x9a4e('0x79')]=intUtil[_0x9a4e('0x78')](_0x18081e[_0x9a4e('0x79')]);if(_0x3fda34&&_0x3fda34[_0x9a4e('0x87')]&&_0x3fda34[_0x9a4e('0x87')]!=='none'){logger['info'](_0x9a4e('0x88'),_0x9a4e('0x7c'));_0x57294c[_0x9a4e('0x7d')]=_0x18081e['serverUrl']+_0x9a4e('0x7e')+_0x57294c[_0x9a4e('0x7f')]+_0x9a4e('0x89')+md5(_0x57294c[_0x9a4e('0x7f')]);}var _0x585502=_0x18081e[_0x9a4e('0x77')]===_0x9a4e('0x80')?'eu':'com';return getAccessToken(_0x18081e)[_0x9a4e('0x21')](function(_0x4a6867){_0x425c51=_0x4a6867;return getUser(_0x425c51,_0x585502,_0x18081e,_0x2ba019[_0x9a4e('0x2c')]);})[_0x9a4e('0x21')](function(_0x58c1a5){_0x3c6ebc=_0x58c1a5;logger['info'](_0x9a4e('0x8a'),_0x3c6ebc['id']);return getEndUser(_0x425c51,_0x585502,_0x18081e,_0x57294c['destcalleridname'],_0x57294c[_0x9a4e('0x8b')],_0x3c6ebc,_0xbabb5f);})[_0x9a4e('0x21')](function(_0x1d6910){_0x47607d=_0x1d6910;return getCall(_0x425c51,_0x585502,_0x18081e,_0x3c6ebc,_0x47607d,_0xbabb5f,_0x57294c,_0x9a4e('0x8c'));})[_0x9a4e('0x21')](function(_0x5f3d99){if(_0x5f3d99){logger[_0x9a4e('0x27')](_0x9a4e('0x83'),_0x5f3d99['id']);logger[_0x9a4e('0x27')](_0x9a4e('0x88'),_0x9a4e('0x84'));emit(util['format'](_0x9a4e('0x8d'),_0x2ba019[_0x9a4e('0x11')]),_0x9a4e('0x85'),{'uri':'https://crm.'+_0x18081e[_0x9a4e('0x77')]+_0x9a4e('0x86')+_0x5f3d99['id']});}})[_0x9a4e('0x35')](function(_0x1858c2){logger['error'](_0x9a4e('0x88'),JSON['stringify'](_0x1858c2));});};exports[_0x9a4e('0x8e')]=function(_0x2f9d54,_0x34c0a1,_0x2a66ce,_0x5823ff,_0xe44ba3,_0x5659d6){var _0xbee9b5,_0x38446e,_0x567153;_0x5659d6['host']=intUtil[_0x9a4e('0x78')](_0x5659d6['host']);_0x5659d6[_0x9a4e('0x79')]=intUtil[_0x9a4e('0x78')](_0x5659d6[_0x9a4e('0x79')]);if(_0xe44ba3&&_0xe44ba3['monitor_format']){logger[_0x9a4e('0x27')]('['+_0x34c0a1[_0x9a4e('0x65')][_0x9a4e('0x8f')]()+']',_0x9a4e('0x7c'));_0x34c0a1[_0x9a4e('0x7d')]=_0x5659d6['serverUrl']+_0x9a4e('0x7e')+_0x34c0a1[_0x9a4e('0x7f')]+_0x9a4e('0x89')+md5(_0x34c0a1[_0x9a4e('0x7f')]);}else{_0x34c0a1[_0x9a4e('0x7d')]='';}var _0x499c99=_0x5659d6[_0x9a4e('0x77')]===_0x9a4e('0x80')?'eu':_0x9a4e('0x81');return getAccessToken(_0x5659d6)[_0x9a4e('0x21')](function(_0x41411c){_0x567153=_0x41411c;return getUser(_0x567153,_0x499c99,_0x5659d6);})[_0x9a4e('0x21')](function(_0x25afde){_0xbee9b5=_0x25afde;logger[_0x9a4e('0x27')](_0x9a4e('0x8a'),_0xbee9b5['id']);return getEndUser(_0x567153,_0x499c99,_0x5659d6,_0x34c0a1[_0x9a4e('0x82')],_0x34c0a1[_0x9a4e('0x90')],_0xbee9b5,_0x2a66ce);})[_0x9a4e('0x21')](function(_0x5b03f1){_0x38446e=_0x5b03f1;return getCall(_0x567153,_0x499c99,_0x5659d6,_0xbee9b5,_0x38446e,_0x2a66ce,_0x34c0a1,_0x9a4e('0x70'));})[_0x9a4e('0x21')](function(_0x49e1f8){if(_0x49e1f8){logger['info'](_0x9a4e('0x83'),_0x49e1f8['id']);}})['catch'](function(_0xce0e){logger['error']('['+_0x34c0a1[_0x9a4e('0x65')]['toUpperCase']()+']',JSON[_0x9a4e('0x33')](_0xce0e));});}; \ No newline at end of file +var _0xde2a=['Call_Start_Time','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','outbound','recordingFormat','none','zoho.eu','destcalleridname','Outbound','[OUTBOUND]','unmanaged','toUpperCase','calleridnum','lodash','md5','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','findIndex','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','format','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','abandoned','Abandoned','timeout'];(function(_0xdfaef5,_0x4c76ef){var _0x20286b=function(_0x51a2bc){while(--_0x51a2bc){_0xdfaef5['push'](_0xdfaef5['shift']());}};_0x20286b(++_0x4c76ef);}(_0xde2a,0x161));var _0xade2=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xde2a[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0xade2('0x0'));var rp=require('request-promise');var md5=require(_0xade2('0x1'));var util=require('util');var intUtil=require(_0xade2('0x2'));var moment=require('moment');var Redis=require(_0xade2('0x3'));var BPromise=require(_0xade2('0x4'));var config=require(_0xade2('0x5'));var logger=require(_0xade2('0x6'))(_0xade2('0x7'));config['redis']=_[_0xade2('0x8')](config[_0xade2('0x9')],{'host':_0xade2('0xa'),'port':0x18eb});var io=require(_0xade2('0xb'))(new Redis(config[_0xade2('0x9')]));function emit(_0x534fc5,_0x53e8b8,_0x34e6f4){io['to'](_0x534fc5)[_0xade2('0xc')](_0x53e8b8,_0x34e6f4);}function request(_0x49a1ef){logger[_0xade2('0xd')]('[HTTP]',JSON[_0xade2('0xe')](_0x49a1ef));return rp(_0x49a1ef);}function getCustomFields(_0x519c23,_0xcf64aa){var _0x539eed={};if(_0x519c23[_0xade2('0xf')]>0x0){_[_0xade2('0x10')](_0x519c23,function(_0x2cf56c){if(_[_0xade2('0x11')]([_0xade2('0x12'),'picklist'],_0x2cf56c[_0xade2('0x13')])&&_0x2cf56c[_0xade2('0x14')]){_0x539eed[_0x2cf56c['idField']]=_0x2cf56c[_0xade2('0x15')][_0xade2('0x16')]();}else if(_0x2cf56c['type']===_0xade2('0x17')&&_0x2cf56c[_0xade2('0x18')]&&_0x2cf56c[_0xade2('0x14')]&&_0xcf64aa[_0x2cf56c[_0xade2('0x18')]]){_0x539eed[_0x2cf56c[_0xade2('0x14')]]=_0xcf64aa[_0x2cf56c['variableName']]['toString']();}else if(_0x2cf56c[_0xade2('0x13')]===_0xade2('0x19')&&_0x2cf56c[_0xade2('0x1a')]&&_0x2cf56c[_0xade2('0x1a')][_0xade2('0x1b')]&&_0x2cf56c[_0xade2('0x14')]&&_0xcf64aa[_0x2cf56c[_0xade2('0x1a')][_0xade2('0x1b')]['toLowerCase']()]){_0x539eed[_0x2cf56c['idField']]=_0xcf64aa[_0x2cf56c[_0xade2('0x1a')][_0xade2('0x1b')][_0xade2('0x1c')]()][_0xade2('0x16')]();}});}return _0x539eed;}function getName(_0x3fce3b){if(_0x3fce3b[_0xade2('0x1d')]('\x20')>0x0){var _0x53c288=_0x3fce3b[_0xade2('0x1e')](/ (.+)/);if(_0x53c288[0x1]){return _0x53c288;}}return[_0x3fce3b,_0x3fce3b];}var accountsTokens={};function getAccessToken(_0x55254b){return new Promise(function(_0x5aafd0,_0x3c5a1b){if(!_[_0xade2('0x1f')](accountsTokens[_0x55254b['id']])&&!_[_0xade2('0x1f')](accountsTokens[_0x55254b['id']][_0xade2('0x20')])){if(moment()[_0xade2('0x21')](accountsTokens[_0x55254b['id']][_0xade2('0x22')])){_0x5aafd0(accountsTokens[_0x55254b['id']][_0xade2('0x20')]);}}var _0x139d03;switch(_0x55254b[_0xade2('0x23')]){case'US':_0x139d03='https://accounts.zoho.com';break;case'AU':_0x139d03=_0xade2('0x24');break;case'EU':_0x139d03=_0xade2('0x25');break;case'IN':_0x139d03='https://accounts.zoho.in';break;case'CN':_0x139d03='https://accounts.zoho.com.cn';break;default:_0x139d03=_0xade2('0x25');break;}var _0x35b3aa={'method':_0xade2('0x26'),'uri':_0x139d03+_0xade2('0x27'),'qs':{'refresh_token':_0x55254b[_0xade2('0x28')],'client_id':_0x55254b[_0xade2('0x29')],'client_secret':_0x55254b['clientSecret'],'grant_type':_0xade2('0x2a')},'json':!![]};return rp(_0x35b3aa)[_0xade2('0x2b')](function(_0x52537f){accountsTokens[_0x55254b['id']]={'access_token':_0x52537f['access_token'],'expires_in':moment()[_0xade2('0x2c')](_0x52537f[_0xade2('0x22')],_0xade2('0x2d'))};_0x5aafd0(_0x52537f[_0xade2('0x20')]);})['catch'](function(_0x5f06a3){logger[_0xade2('0x2e')](_0xade2('0x2f'),_0x5f06a3[_0xade2('0x30')]);_0x3c5a1b(_0x5f06a3);});});}function getUser(_0x3210f2,_0x4cf222,_0x40b660,_0x42f715){logger['info'](_0xade2('0x31'));return request({'method':_0xade2('0x32'),'uri':util['format'](_0xade2('0x33'),_0x4cf222),'qs':{'type':_0xade2('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3210f2},'json':!![]})[_0xade2('0x2b')](function(_0x38725b){if(_0x38725b[_0xade2('0x35')]){var _0x460e7a=-0x1;if(_['isArrayLikeObject'](_0x38725b[_0xade2('0x35')])){if(!_[_0xade2('0x1f')](_0x42f715)){_0x460e7a=_[_0xade2('0x36')](_0x38725b[_0xade2('0x35')],function(_0x28aa12){return _0x28aa12['email']===_0x42f715;});}if(_0x460e7a>=0x0){logger[_0xade2('0x37')]('Agent\x20found!');}else{logger[_0xade2('0x37')](_0xade2('0x38'));_0x460e7a=_[_0xade2('0x36')](_0x38725b['users'],function(_0x3eb61d){return _0x3eb61d[_0xade2('0x39')][_0xade2('0x1b')]===_0xade2('0x3a');});}return _0x38725b[_0xade2('0x35')][_0x460e7a];}else{if(_0x38725b['user']['profile'][_0xade2('0x1b')]===_0xade2('0x3a')){logger[_0xade2('0x37')]('Using\x20the\x20admin\x20account!');user=_0x38725b[_0xade2('0x3b')];return user;}else{logger[_0xade2('0x2e')](_0xade2('0x3c'),JSON[_0xade2('0xe')](_0x38725b));throw new Error(_0xade2('0x3d')+JSON[_0xade2('0xe')](_0x38725b));}}}else{logger[_0xade2('0x2e')](_0xade2('0x3c'),JSON[_0xade2('0xe')](_0x38725b));throw new Error(_0xade2('0x3d')+JSON[_0xade2('0xe')](_0x38725b));}})[_0xade2('0x3e')](function(_0x340d79){console[_0xade2('0x2e')](_0x340d79);});}function getZohoUser(_0x100f4c,_0x51d9a0){return new BPromise(function(_0xc81149,_0x967bb0){request(_0x100f4c)[_0xade2('0x2b')](function(_0x3536f7){var _0x3d7079=null;if(_0x3536f7){_0x3d7079=_0x3536f7['data'][0x0];_0x3d7079[_0xade2('0x3f')]=_0x51d9a0;}_0xc81149(_0x3d7079);})[_0xade2('0x3e')](function(_0x291717){_0x967bb0(_0x291717);});});}function createEndUser(_0x430b2c,_0x5cffa6,_0x173d05,_0x5414cc,_0x5bb95a,_0x32ecce){var _0x173d05=getName(_0x173d05);return request({'method':'POST','uri':_0xade2('0x40')+_0x5cffa6+_0xade2('0x41')+_[_0xade2('0x42')](_0x32ecce[_0xade2('0x43')])+'s','body':{'data':[{'Last_Name':_0x173d05[0x1],'First_Name':_0x173d05[0x0],'Phone':_0x5414cc,'Owner':{'name':!_[_0xade2('0x1f')](_0x5bb95a[_0xade2('0x44')]['name'])?_0x5bb95a[_0xade2('0x44')][_0xade2('0x1b')]:!_['isNil'](_0x5bb95a[_0xade2('0x45')])?_0x5bb95a[_0xade2('0x45')]+'\x20'+_0x5bb95a['last_name']:_0x5bb95a[_0xade2('0x46')],'id':_0x5bb95a['id']}}]},'headers':{'Authorization':_0xade2('0x47')+_0x430b2c},'json':!![]})[_0xade2('0x2b')](function(_0x8e2fa){if(_0x8e2fa&&_0x8e2fa[_0xade2('0x48')][0x0][_0xade2('0x49')]==='SUCCESS'){var _0x223f5d=_0x8e2fa[_0xade2('0x48')][0x0]['details'];_0x223f5d[_0xade2('0x3f')]=_[_0xade2('0x42')](_0x32ecce[_0xade2('0x43')])+'s';return _0x223f5d;}logger[_0xade2('0x2e')](_0xade2('0x3c'),JSON['stringify'](data));throw new Error(_0xade2('0x4a')+JSON[_0xade2('0xe')](data));})[_0xade2('0x3e')](function(_0x469fa5){console[_0xade2('0x4b')](_0xade2('0x4c'),_0x469fa5);});}function getEndUser(_0x4d298f,_0x529e25,_0x287869,_0x448841,_0x332e3a,_0x23905f,_0x3be933){var _0x493d87={'method':'GET','uri':'','headers':{'Authorization':_0xade2('0x47')+_0x4d298f},'json':!![]};switch(_0x3be933['moduleSearch']){case _0xade2('0x4d'):_0x493d87[_0xade2('0x4e')]=_0xade2('0x40')+_0x529e25+_0xade2('0x4f')+_0x332e3a+'))';return getZohoUser(_0x493d87,'Contacts')[_0xade2('0x2b')](function(_0xf84b46){if(_0xf84b46)return _0xf84b46;_0x493d87['uri']='https://www.zohoapis.'+_0x529e25+_0xade2('0x50')+_0x332e3a+'))';return getZohoUser(_0x493d87,_0xade2('0x51'))[_0xade2('0x2b')](function(_0x54621a){if(_0x54621a)return _0x54621a;if(_0x3be933['moduleCreate']!=_0xade2('0x52')){return createEndUser(_0x4d298f,_0x529e25,_0x448841,_0x332e3a,_0x23905f,_0x3be933);}else{return{};}});});break;case _0xade2('0x53'):_0x493d87[_0xade2('0x4e')]=_0xade2('0x40')+_0x529e25+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x332e3a+'))';return getZohoUser(_0x493d87,_0xade2('0x54'))[_0xade2('0x2b')](function(_0x5bd9ef){if(_0x5bd9ef)return _0x5bd9ef;if(_0x3be933[_0xade2('0x43')]!='nothing'){return createEndUser(_0x4d298f,_0x529e25,_0x448841,_0x332e3a,_0x23905f,_0x3be933);}else{return{};}});break;case _0xade2('0x55'):_0x493d87[_0xade2('0x4e')]='https://www.zohoapis.'+_0x529e25+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x332e3a+'))';return getZohoUser(_0x493d87,'Leads')['then'](function(_0x2a7f94){if(_0x2a7f94)return _0x2a7f94;if(_0x3be933[_0xade2('0x43')]!=_0xade2('0x52')){return createEndUser(_0x4d298f,_0x529e25,_0x448841,_0x332e3a,_0x23905f,_0x3be933);}else{return{};}});break;}}function getCall(_0x574020,_0x39648e,_0x2e48b4,_0x3b3612,_0x36c72f,_0x11001a,_0x5c4862,_0x5ac90e){logger[_0xade2('0x37')](_0xade2('0x56'));var _0x67f441={};_0x67f441[_0xade2('0x57')]={'name':!_[_0xade2('0x1f')](_0x3b3612[_0xade2('0x44')][_0xade2('0x1b')])&&!_['isNil'](_0x3b3612[_0xade2('0x39')][_0xade2('0x1b')])&&_0x3b3612[_0xade2('0x39')][_0xade2('0x1b')]==='administrator'?_0x3b3612[_0xade2('0x44')][_0xade2('0x1b')]:!_[_0xade2('0x1f')](_0x3b3612['first_name'])?_0x3b3612[_0xade2('0x45')]+'\x20'+_0x3b3612['last_name']:_0x3b3612['last_name'],'id':_0x3b3612['id']};_0x67f441[_0xade2('0x58')]=intUtil[_0xade2('0x59')](_0x11001a[_0xade2('0x5a')],_0x5c4862,'\x20');_0x67f441[_0xade2('0x5b')]=intUtil[_0xade2('0x59')](_0x11001a[_0xade2('0x5c')],_0x5c4862,'\x0a');if(_0x36c72f['enduserType']==='Contacts'){_0x67f441[_0xade2('0x5d')]={'name':!_[_0xade2('0x1f')](_0x36c72f[_0xade2('0x5e')])?_0x36c72f[_0xade2('0x5e')]:!_[_0xade2('0x1f')](_0x36c72f[_0xade2('0x5f')])?_0x36c72f[_0xade2('0x5f')]+'\x20'+_0x36c72f[_0xade2('0x60')]:_0x36c72f[_0xade2('0x60')],'id':_0x36c72f['id']};}if(_0x36c72f['enduserType']==='Leads'){_0x67f441['What_Id']={'name':!_[_0xade2('0x1f')](_0x36c72f[_0xade2('0x5e')])?_0x36c72f[_0xade2('0x5e')]:!_['isNil'](_0x36c72f['First_Name'])?_0x36c72f[_0xade2('0x5f')]+'\x20'+_0x36c72f[_0xade2('0x60')]:_0x36c72f[_0xade2('0x60')],'id':_0x36c72f['id']};_0x67f441[_0xade2('0x61')]=_[_0xade2('0x42')](_0x36c72f[_0xade2('0x3f')]);}if(_0x5c4862[_0xade2('0x62')]){_0x67f441[_0xade2('0x63')]=moment[_0xade2('0x64')](parseInt(_0x5c4862[_0xade2('0x62')])*0x3e8)[_0xade2('0x65')]('mm:ss');}else if(_0x5c4862[_0xade2('0x66')]&&_0x5c4862[_0xade2('0x67')]){_0x67f441[_0xade2('0x63')]=moment[_0xade2('0x64')](moment(_0x5c4862[_0xade2('0x67')],_0xade2('0x68'))[_0xade2('0x69')](moment(_0x5c4862[_0xade2('0x6a')],_0xade2('0x68'))))[_0xade2('0x65')](_0xade2('0x6b'));}switch(_0x5c4862[_0xade2('0x6c')]){case _0xade2('0x6d'):_0x67f441[_0xade2('0x6e')]=_0xade2('0x6f');break;case _0xade2('0x70'):case _0xade2('0x71'):_0x67f441[_0xade2('0x6e')]='Answered';break;case _0xade2('0x72'):_0x67f441[_0xade2('0x6e')]='Rejected';break;case _0xade2('0x73'):_0x67f441[_0xade2('0x6e')]=_0xade2('0x74');break;case _0xade2('0x75'):_0x67f441[_0xade2('0x6e')]='Timeout';default:}_0x67f441[_0xade2('0x76')]=(_0x5ac90e==='outbound'?moment(_0x5c4862[_0xade2('0x6a')])[_0xade2('0x65')](_0xade2('0x68')):moment(_0x5c4862[_0xade2('0x77')])[_0xade2('0x65')](_0xade2('0x68')))||moment()[_0xade2('0x65')](_0xade2('0x68'));_0x67f441['Call_Type']=_0x5ac90e||_0xade2('0x78');_0x67f441=_[_0xade2('0x79')](_0x67f441,getCustomFields(_0x11001a[_0xade2('0x7a')],_0x5c4862));return request({'method':_0xade2('0x26'),'uri':_0xade2('0x40')+_0x39648e+_0xade2('0x7b'),'headers':{'Authorization':_0xade2('0x47')+_0x574020},'body':{'data':[_0x67f441]},'json':!![]})[_0xade2('0x2b')](function(_0x5d3498){if(_0x5d3498&&_0x5d3498[_0xade2('0x48')][0x0][_0xade2('0x49')]===_0xade2('0x7c')){logger[_0xade2('0x37')]('Call\x20created!');return{'id':_0x5d3498[_0xade2('0x48')][0x0]['details']['id']};}})[_0xade2('0x3e')](function(_0x4c392e){logger[_0xade2('0x37')](_0xade2('0x7d'),_0x4c392e[_0xade2('0x30')]);console['log']('err',_0x4c392e);});}exports[_0xade2('0x7e')]=function(_0x8e831,_0x14f537,_0x4e211f,_0x110477,_0x1a71b6,_0x4540c5){var _0x564b08,_0x3aa070,_0x2dc84e;_0x4540c5[_0xade2('0x7f')]=intUtil[_0xade2('0x80')](_0x4540c5[_0xade2('0x7f')]);_0x4540c5[_0xade2('0x81')]=intUtil[_0xade2('0x80')](_0x4540c5[_0xade2('0x81')]);if(_0x1a71b6&&_0x1a71b6[_0xade2('0x82')]){logger[_0xade2('0x37')]('[QUEUE]',_0xade2('0x83'));_0x14f537[_0xade2('0x84')]=_0x4540c5[_0xade2('0x81')]+_0xade2('0x85')+_0x14f537[_0xade2('0x86')]+_0xade2('0x87')+md5(_0x14f537[_0xade2('0x86')]);}else{_0x14f537['recordingURL']='';}var _0x21f863=_0x4540c5[_0xade2('0x7f')]==='zoho.eu'?'eu':_0xade2('0x88');return getAccessToken(_0x4540c5)[_0xade2('0x2b')](function(_0x520ba3){_0x2dc84e=_0x520ba3;return getUser(_0x2dc84e,_0x21f863,_0x4540c5,_0x110477[_0xade2('0x89')]);})[_0xade2('0x2b')](function(_0x4238e6){_0x564b08=_0x4238e6;logger[_0xade2('0x37')](_0xade2('0x8a'),_0x564b08['id']);return getEndUser(_0x2dc84e,_0x21f863,_0x4540c5,_0x14f537[_0xade2('0x8b')],_0x14f537['calleridnum'],_0x564b08,_0x4e211f);})[_0xade2('0x2b')](function(_0x2c12e8){_0x3aa070=_0x2c12e8;return getCall(_0x2dc84e,_0x21f863,_0x4540c5,_0x564b08,_0x3aa070,_0x4e211f,_0x14f537,'Inbound');})[_0xade2('0x2b')](function(_0x33e362){if(_0x33e362){logger[_0xade2('0x37')](_0xade2('0x8c'),_0x33e362['id']);logger[_0xade2('0x37')]('[QUEUE]',_0xade2('0x8d'));emit(util[_0xade2('0x65')](_0xade2('0x8e'),_0x110477[_0xade2('0x1b')]),_0xade2('0x8f'),{'uri':_0xade2('0x90')+_0x4540c5[_0xade2('0x7f')]+_0xade2('0x91')+_0x33e362['id']});}})[_0xade2('0x3e')](function(_0x3a552e){logger[_0xade2('0x2e')](_0xade2('0x92'),JSON[_0xade2('0xe')](_0x3a552e));});};exports[_0xade2('0x93')]=function(_0x20018b,_0x3ac976,_0x344122,_0xc6d452,_0x4bc29d,_0x19a6e2,_0x543cfc){var _0xe20bc9,_0xed1c24,_0x25c2ce;_0x19a6e2['host']=intUtil[_0xade2('0x80')](_0x19a6e2[_0xade2('0x7f')]);_0x19a6e2[_0xade2('0x81')]=intUtil[_0xade2('0x80')](_0x19a6e2['serverUrl']);if(_0x543cfc&&_0x543cfc[_0xade2('0x94')]&&_0x543cfc[_0xade2('0x94')]!==_0xade2('0x95')){logger['info']('[OUTBOUND]',_0xade2('0x83'));_0x3ac976[_0xade2('0x84')]=_0x19a6e2['serverUrl']+_0xade2('0x85')+_0x3ac976[_0xade2('0x86')]+_0xade2('0x87')+md5(_0x3ac976[_0xade2('0x86')]);}var _0x1e4320=_0x19a6e2[_0xade2('0x7f')]===_0xade2('0x96')?'eu':'com';return getAccessToken(_0x19a6e2)[_0xade2('0x2b')](function(_0x1d58e3){_0x25c2ce=_0x1d58e3;return getUser(_0x25c2ce,_0x1e4320,_0x19a6e2,_0xc6d452[_0xade2('0x89')]);})['then'](function(_0x8a75d2){_0xe20bc9=_0x8a75d2;logger[_0xade2('0x37')](_0xade2('0x8a'),_0xe20bc9['id']);return getEndUser(_0x25c2ce,_0x1e4320,_0x19a6e2,_0x3ac976[_0xade2('0x97')],_0x3ac976['destcalleridnum'],_0xe20bc9,_0x344122);})[_0xade2('0x2b')](function(_0x395668){_0xed1c24=_0x395668;return getCall(_0x25c2ce,_0x1e4320,_0x19a6e2,_0xe20bc9,_0xed1c24,_0x344122,_0x3ac976,_0xade2('0x98'));})[_0xade2('0x2b')](function(_0xf90eec){if(_0xf90eec){logger[_0xade2('0x37')](_0xade2('0x8c'),_0xf90eec['id']);logger[_0xade2('0x37')]('[OUTBOUND]',_0xade2('0x8d'));emit(util['format'](_0xade2('0x8e'),_0xc6d452['name']),_0xade2('0x8f'),{'uri':_0xade2('0x90')+_0x19a6e2[_0xade2('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0xf90eec['id']});}})['catch'](function(_0x2cbb4a){logger[_0xade2('0x2e')](_0xade2('0x99'),JSON['stringify'](_0x2cbb4a));});};exports[_0xade2('0x9a')]=function(_0x1564ff,_0x34cf84,_0x319fa9,_0x4039c5,_0xc842ea,_0x4629e9){var _0x4b07ac,_0xe2fbeb,_0x11af95;_0x4629e9['host']=intUtil['stripTrailingSlash'](_0x4629e9[_0xade2('0x7f')]);_0x4629e9[_0xade2('0x81')]=intUtil['stripTrailingSlash'](_0x4629e9[_0xade2('0x81')]);if(_0xc842ea&&_0xc842ea[_0xade2('0x82')]){logger[_0xade2('0x37')]('['+_0x34cf84[_0xade2('0x6c')][_0xade2('0x9b')]()+']','Recording\x20is\x20enabled!');_0x34cf84[_0xade2('0x84')]=_0x4629e9[_0xade2('0x81')]+_0xade2('0x85')+_0x34cf84[_0xade2('0x86')]+_0xade2('0x87')+md5(_0x34cf84[_0xade2('0x86')]);}else{_0x34cf84[_0xade2('0x84')]='';}var _0x5642f6=_0x4629e9[_0xade2('0x7f')]==='zoho.eu'?'eu':_0xade2('0x88');return getAccessToken(_0x4629e9)[_0xade2('0x2b')](function(_0x3e1ced){_0x11af95=_0x3e1ced;return getUser(_0x11af95,_0x5642f6,_0x4629e9);})['then'](function(_0x56cbb4){_0x4b07ac=_0x56cbb4;logger[_0xade2('0x37')](_0xade2('0x8a'),_0x4b07ac['id']);return getEndUser(_0x11af95,_0x5642f6,_0x4629e9,_0x34cf84[_0xade2('0x8b')],_0x34cf84[_0xade2('0x9c')],_0x4b07ac,_0x319fa9);})[_0xade2('0x2b')](function(_0x1c1644){_0xe2fbeb=_0x1c1644;return getCall(_0x11af95,_0x5642f6,_0x4629e9,_0x4b07ac,_0xe2fbeb,_0x319fa9,_0x34cf84,_0xade2('0x78'));})[_0xade2('0x2b')](function(_0xe6fa4c){if(_0xe6fa4c){logger[_0xade2('0x37')]('The\x20Call\x20ID\x20is:',_0xe6fa4c['id']);}})['catch'](function(_0x246977){logger[_0xade2('0x2e')]('['+_0x34cf84[_0xade2('0x6c')][_0xade2('0x9b')]()+']',JSON[_0xade2('0xe')](_0x246977));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 77ae507..1127600 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c08=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1c08,0x1ee));var _0x81c0=function(_0x2fbb34,_0x358b15){_0x2fbb34=_0x2fbb34-0x0;var _0x26914a=_0x1c08[_0x2fbb34];return _0x26914a;};'use strict';var util=require(_0x81c0('0x0'));var sh=require(_0x81c0('0x1'));var Mustache=require(_0x81c0('0x2'));var logger=require(_0x81c0('0x3'))(_0x81c0('0x4'));exports[_0x81c0('0x5')]=function(_0x5599f7,_0x25f978){var _0x5e3dd2=_0x5599f7[_0x81c0('0x6')]?_0x5599f7[_0x81c0('0x6')]:_0x81c0('0x7');var _0x5b464b=_0x5599f7[_0x81c0('0x8')]?Mustache['render'](_0x5599f7['data3'],_0x25f978):_0x25f978;sh[_0x81c0('0x5')](_0x5b464b,function(_0x2c8fcd,_0x24c1c4,_0xd5efd6){if(_0x2c8fcd!==0x0){logger[_0x81c0('0x9')](util[_0x81c0('0xa')](_0x81c0('0xb'),_0x5e3dd2,_0x5b464b,_0x2c8fcd,_0xd5efd6));}else{logger[_0x81c0('0xc')](util[_0x81c0('0xa')](_0x81c0('0xd'),_0x5e3dd2,_0x5b464b,_0x24c1c4));}});}; \ No newline at end of file +var _0xf4d4=['error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','exec','data2','Script','data3'];(function(_0x9842fd,_0x35775c){var _0x52c713=function(_0x1a8aaf){while(--_0x1a8aaf){_0x9842fd['push'](_0x9842fd['shift']());}};_0x52c713(++_0x35775c);}(_0xf4d4,0xcc));var _0x4f4d=function(_0x3933f9,_0x89015){_0x3933f9=_0x3933f9-0x0;var _0x1534ad=_0xf4d4[_0x3933f9];return _0x1534ad;};'use strict';var util=require('util');var sh=require(_0x4f4d('0x0'));var Mustache=require(_0x4f4d('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0x4f4d('0x2')]=function(_0x4981a4,_0x5c8703){var _0x1dbda2=_0x4981a4[_0x4f4d('0x3')]?_0x4981a4[_0x4f4d('0x3')]:_0x4f4d('0x4');var _0x2c14e9=_0x4981a4[_0x4f4d('0x5')]?Mustache['render'](_0x4981a4[_0x4f4d('0x5')],_0x5c8703):_0x5c8703;sh[_0x4f4d('0x2')](_0x2c14e9,function(_0x15b64c,_0x475bd1,_0xf6eb98){if(_0x15b64c!==0x0){logger[_0x4f4d('0x6')](util[_0x4f4d('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x1dbda2,_0x2c14e9,_0x15b64c,_0xf6eb98));}else{logger[_0x4f4d('0x8')](util[_0x4f4d('0x7')](_0x4f4d('0x9'),_0x1dbda2,_0x2c14e9,_0x475bd1));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 5644398..06483a2 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5781=['lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','data6','error','stack','DELETE','PUT','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode','catch','name','message','request-promise','util'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x5781,0x127));var _0x1578=function(_0x4a2558,_0x4c0983){_0x4a2558=_0x4a2558-0x0;var _0x4f9ab5=_0x5781[_0x4a2558];return _0x4f9ab5;};'use strict';var rp=require(_0x1578('0x0'));var util=require(_0x1578('0x1'));var _=require(_0x1578('0x2'));var Mustache=require(_0x1578('0x3'));var logger=require('../../../../config/logger')(_0x1578('0x4'));exports[_0x1578('0x5')]=function(_0x3a5920,_0x259d3b){var _0x5163ca,_0x29f1c6;var _0x5eaaeb={'method':_0x3a5920[_0x1578('0x6')][_0x1578('0x7')](),'uri':Mustache[_0x1578('0x8')](_0x3a5920[_0x1578('0x9')],_0x259d3b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3a5920[_0x1578('0xa')])===_0x1578('0xb')&&parseInt(_0x3a5920[_0x1578('0xa')])>=0x1&&parseInt(_0x3a5920[_0x1578('0xa')])<=0xa?parseInt(_0x3a5920[_0x1578('0xa')])*0x3e8:0x5*0x3e8};try{_0x5eaaeb['headers']=_0x3a5920[_0x1578('0xc')]?JSON['parse'](Mustache[_0x1578('0x8')](_0x3a5920[_0x1578('0xc')],_0x259d3b)):{};}catch(_0x7bbf2e){logger[_0x1578('0xd')](_0x7bbf2e[_0x1578('0xe')]);}switch(_0x3a5920['data1'][_0x1578('0x7')]()){case'GET':case _0x1578('0xf'):_0x5163ca=null;_0x5eaaeb['qs']=_0x259d3b;break;case'POST':case _0x1578('0x10'):if(_0x3a5920['data7']){try{_0x5163ca=JSON[_0x1578('0x11')](Mustache[_0x1578('0x8')](_0x3a5920[_0x1578('0x12')],_0x259d3b));_0x5eaaeb[_0x1578('0x13')]=_0x5163ca;}catch(_0x1ab2f9){logger['error'](_0x1ab2f9[_0x1578('0xe')]);logger[_0x1578('0xd')](_0x1578('0x14'));}}else{_0x5163ca=_0x259d3b;_0x5eaaeb['body']=_0x5163ca;}break;}logger[_0x1578('0x15')](util[_0x1578('0x16')](_0x1578('0x17'),_0x3a5920[_0x1578('0x6')],_0x3a5920[_0x1578('0x9')],JSON[_0x1578('0x18')](_0x5eaaeb)));rp(_0x5eaaeb)[_0x1578('0x19')](function(_0x42b345){_0x5163ca=!_[_0x1578('0x1a')](_0x5163ca)?_0x1578('0x1b')+_0x5163ca:'';_0x29f1c6=typeof _0x42b345[_0x1578('0x13')]===_0x1578('0x1c')?JSON[_0x1578('0x18')](_0x42b345[_0x1578('0x13')]):_0x42b345['body'];logger[_0x1578('0x15')](util[_0x1578('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3a5920['data1'],_0x3a5920[_0x1578('0x9')],_0x42b345[_0x1578('0x1d')],_0x29f1c6));})[_0x1578('0x1e')](function(_0xb64d26){logger[_0x1578('0xd')](util[_0x1578('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3a5920['data1'],_0x3a5920[_0x1578('0x9')],_0xb64d26[_0x1578('0x1d')],_0xb64d26[_0x1578('0x1f')],_0xb64d26[_0x1578('0x20')]));});}; \ No newline at end of file +var _0x7b4d=['GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack'];(function(_0x29817e,_0xf1b822){var _0x5dccac=function(_0x54e4dc){while(--_0x54e4dc){_0x29817e['push'](_0x29817e['shift']());}};_0x5dccac(++_0xf1b822);}(_0x7b4d,0x91));var _0xd7b4=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x7b4d[_0x4c4037];return _0x357862;};'use strict';var rp=require(_0xd7b4('0x0'));var util=require(_0xd7b4('0x1'));var _=require(_0xd7b4('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports[_0xd7b4('0x3')]=function(_0x55299c,_0x48c941){var _0x46db86,_0x2a6121;var _0xd0fbf2={'method':_0x55299c[_0xd7b4('0x4')][_0xd7b4('0x5')](),'uri':Mustache[_0xd7b4('0x6')](_0x55299c[_0xd7b4('0x7')],_0x48c941),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x55299c[_0xd7b4('0x8')])===_0xd7b4('0x9')&&parseInt(_0x55299c['data5'])>=0x1&&parseInt(_0x55299c[_0xd7b4('0x8')])<=0xa?parseInt(_0x55299c[_0xd7b4('0x8')])*0x3e8:0x5*0x3e8};try{_0xd0fbf2[_0xd7b4('0xa')]=_0x55299c[_0xd7b4('0xb')]?JSON[_0xd7b4('0xc')](Mustache[_0xd7b4('0x6')](_0x55299c[_0xd7b4('0xb')],_0x48c941)):{};}catch(_0x2c09d3){logger[_0xd7b4('0xd')](_0x2c09d3[_0xd7b4('0xe')]);}switch(_0x55299c[_0xd7b4('0x4')][_0xd7b4('0x5')]()){case _0xd7b4('0xf'):case'DELETE':_0x46db86=null;_0xd0fbf2['qs']=_0x48c941;break;case _0xd7b4('0x10'):case _0xd7b4('0x11'):if(_0x55299c['data7']){try{_0x46db86=JSON[_0xd7b4('0xc')](Mustache['render'](_0x55299c[_0xd7b4('0x12')],_0x48c941));_0xd0fbf2[_0xd7b4('0x13')]=_0x46db86;}catch(_0x3c0c06){logger[_0xd7b4('0xd')](_0x3c0c06['stack']);logger['error'](_0xd7b4('0x14'));}}else{_0x46db86=_0x48c941;_0xd0fbf2[_0xd7b4('0x13')]=_0x46db86;}break;}logger[_0xd7b4('0x15')](util[_0xd7b4('0x16')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x55299c['data1'],_0x55299c[_0xd7b4('0x7')],JSON[_0xd7b4('0x17')](_0xd0fbf2)));rp(_0xd0fbf2)[_0xd7b4('0x18')](function(_0x3ddd88){_0x46db86=!_[_0xd7b4('0x19')](_0x46db86)?_0xd7b4('0x1a')+_0x46db86:'';_0x2a6121=typeof _0x3ddd88[_0xd7b4('0x13')]==='object'?JSON['stringify'](_0x3ddd88['body']):_0x3ddd88[_0xd7b4('0x13')];logger[_0xd7b4('0x15')](util['format'](_0xd7b4('0x1b'),_0x55299c[_0xd7b4('0x4')],_0x55299c[_0xd7b4('0x7')],_0x3ddd88[_0xd7b4('0x1c')],_0x2a6121));})['catch'](function(_0x3705e7){logger[_0xd7b4('0xd')](util['format'](_0xd7b4('0x1d'),_0x55299c['data1'],_0x55299c[_0xd7b4('0x7')],_0x3705e7[_0xd7b4('0x1c')],_0x3705e7[_0xd7b4('0x1e')],_0x3705e7[_0xd7b4('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b770f52..277bb40 100644 --- a/server/services/email/client.js +++ b/server/services/email/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd6e=['../../config/logger','client','Request','request','debug','rpc','routing','error','message','catch','exports','jayson/promise','bluebird'];(function(_0x315062,_0x3b97d7){var _0x1bea22=function(_0x3ceccb){while(--_0x3ceccb){_0x315062['push'](_0x315062['shift']());}};_0x1bea22(++_0x3b97d7);}(_0xfd6e,0x150));var _0xefd6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfd6e[_0x397e5f];return _0x5302b8;};'use strict';var jayson=require(_0xefd6('0x0'));var BPromise=require(_0xefd6('0x1'));var logger=require(_0xefd6('0x2'))('routing');var client=jayson[_0xefd6('0x3')]['http']({'port':0x2329});client[_0xefd6('0x4')]=function(_0x2392ec,_0x523779){return new BPromise(function(_0x27a4c3,_0x5ec947){return client[_0xefd6('0x5')](_0x2392ec,_0x523779)['then'](function(_0x18ebf1){logger[_0xefd6('0x6')](_0xefd6('0x7'),_0xefd6('0x8'),_0x2392ec,_0x523779,_0x18ebf1);if(_0x18ebf1['error']){logger[_0xefd6('0x9')](_0xefd6('0x7'),_0xefd6('0x8'),_0x2392ec,_0x18ebf1[_0xefd6('0x9')][_0xefd6('0xa')],_0x523779);return _0x5ec947(_0x18ebf1[_0xefd6('0x9')][_0xefd6('0xa')]);}else{return _0x27a4c3(_0x18ebf1['result']);}})[_0xefd6('0xb')](function(_0x30528a){logger[_0xefd6('0x9')]('rpc',_0xefd6('0x8'),_0x2392ec,_0x30528a,_0x523779);return _0x5ec947(_0x30528a);});});};module[_0xefd6('0xc')]=client; \ No newline at end of file +var _0xec6c=['routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0xec6c,0x1bf));var _0xcec6=function(_0x3d393f,_0x523ddc){_0x3d393f=_0x3d393f-0x0;var _0xd5cc33=_0xec6c[_0x3d393f];return _0xd5cc33;};'use strict';var jayson=require(_0xcec6('0x0'));var BPromise=require(_0xcec6('0x1'));var logger=require(_0xcec6('0x2'))(_0xcec6('0x3'));var client=jayson[_0xcec6('0x4')][_0xcec6('0x5')]({'port':0x2329});client[_0xcec6('0x6')]=function(_0x4c0951,_0x3a79af){return new BPromise(function(_0x2e62c9,_0x5ca210){return client[_0xcec6('0x7')](_0x4c0951,_0x3a79af)[_0xcec6('0x8')](function(_0x44705e){logger[_0xcec6('0x9')]('rpc','routing',_0x4c0951,_0x3a79af,_0x44705e);if(_0x44705e['error']){logger['error'](_0xcec6('0xa'),_0xcec6('0x3'),_0x4c0951,_0x44705e[_0xcec6('0xb')][_0xcec6('0xc')],_0x3a79af);return _0x5ca210(_0x44705e[_0xcec6('0xb')]['message']);}else{return _0x2e62c9(_0x44705e[_0xcec6('0xd')]);}})[_0xcec6('0xe')](function(_0x100d55){logger[_0xcec6('0xb')](_0xcec6('0xa'),_0xcec6('0x3'),_0x4c0951,_0x100d55,_0x3a79af);return _0x5ca210(_0x100d55);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 07b13d0..2ebdbe8 100644 --- a/server/services/email/index.js +++ b/server/services/email/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x158c=['./rpc/setting','../../config/logger','email','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','./server','./realtime','./rpc/mailAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x158c,0xed));var _0xc158=function(_0x26b7cd,_0x1f07e3){_0x26b7cd=_0x26b7cd-0x0;var _0x345648=_0x158c[_0x26b7cd];return _0x345648;};'use strict';var server=require(_0xc158('0x0'));var Realtime=require(_0xc158('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xc158('0x2'));var setting=require(_0xc158('0x3'));var logger=require(_0xc158('0x4'))(_0xc158('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc158('0x6')]()['then'](mailAccount[_0xc158('0x7')]())[_0xc158('0x8')](realtime[_0xc158('0x9')]())['then'](function(){email[_0xc158('0xa')](realtime[_0xc158('0xb')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xc158('0x8')](function(){return initRealtime();})[_0xc158('0x8')](function(){return setting[_0xc158('0xc')]();})[_0xc158('0x8')](function(_0x410b74){return setInterval(initRealtime,_0x410b74[_0xc158('0xd')]*0x3e8);})[_0xc158('0xe')](function(_0xde3b61){logger[_0xc158('0xf')]('Email\x20service\x20initialization',_0xde3b61);});}main(); \ No newline at end of file +var _0xc3a8=['./realtime','./lib/email','email','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server'];(function(_0x194cbb,_0x430593){var _0x1306e7=function(_0x40893b){while(--_0x40893b){_0x194cbb['push'](_0x194cbb['shift']());}};_0x1306e7(++_0x430593);}(_0xc3a8,0x16b));var _0x8c3a=function(_0xe1441d,_0x36fb8e){_0xe1441d=_0xe1441d-0x0;var _0x2ef242=_0xc3a8[_0xe1441d];return _0x2ef242;};'use strict';var server=require(_0x8c3a('0x0'));var Realtime=require(_0x8c3a('0x1'));var EmailChannel=require(_0x8c3a('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x8c3a('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x8c3a('0x4')](mailAccount[_0x8c3a('0x5')]())[_0x8c3a('0x4')](realtime[_0x8c3a('0x6')]())[_0x8c3a('0x4')](function(){email['refresh'](realtime[_0x8c3a('0x7')]);return realtime;});}function main(){return server[_0x8c3a('0x8')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x8c3a('0x9')]();})['then'](function(_0x4356e8){return setInterval(initRealtime,_0x4356e8[_0x8c3a('0xa')]*0x3e8);})[_0x8c3a('0xb')](function(_0x3c8f80){logger[_0x8c3a('0xc')](_0x8c3a('0xd'),_0x3c8f80);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 118b033..c4bf23a 100644 --- a/server/services/email/lib/email.js +++ b/server/services/email/lib/email.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x628a=['active','Imap','status','messageStatus','total','isNil','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','box','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','socket.io-emitter','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','name'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x628a,0x105));var _0xa628=function(_0x46e784,_0x5698f4){_0x46e784=_0x46e784-0x0;var _0x380c64=_0x628a[_0x46e784];return _0x380c64;};'use strict';var _=require(_0xa628('0x0'));var moment=require(_0xa628('0x1'));var BPromise=require(_0xa628('0x2'));var md5=require(_0xa628('0x3'));var Redis=require(_0xa628('0x4'));var config=require(_0xa628('0x5'));var logger=require('../../../config/logger')(_0xa628('0x6'));config[_0xa628('0x7')]=_[_0xa628('0x8')](config[_0xa628('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xa628('0x9'))(new Redis(config['redis']));var EmailImap=require(_0xa628('0xa'));var EmailSmtp=require(_0xa628('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x14ad21){logger[_0xa628('0xc')]('start\x20email\x20channel');this[_0xa628('0xd')]=_0x14ad21[_0xa628('0xd')];this[_0xa628('0xe')]={};this[_0xa628('0xf')]=new EmailSmtp();}EmailChannel[_0xa628('0x10')][_0xa628('0x11')]=function(_0x3954cf){var _0xe882e=this[_0xa628('0xd')][_0x3954cf];var _0x551051={'id':_0xe882e['id'],'name':_0xe882e[_0xa628('0x12')],'key':_0xe882e['key'],'active':_0xe882e[_0xa628('0x13')],'Imap':{'status':_0xe882e[_0xa628('0x14')][_0xa628('0x15')],'messageStatus':_0xe882e['Imap'][_0xa628('0x16')],'total':_0xe882e[_0xa628('0x14')][_0xa628('0x17')]}};if(_[_0xa628('0x18')](md5Accounts[_0x3954cf])){md5Accounts[_0x3954cf]={};}var _0x15a0b7=md5(JSON['stringify'](_0x551051));if(md5Accounts[_0x3954cf][_0xa628('0x3')]!==_0x15a0b7){md5Accounts[_0x3954cf][_0xa628('0x3')]=_0x15a0b7;io[_0xa628('0x11')](_0xa628('0x19'),_0x551051);}};EmailChannel['prototype'][_0xa628('0x1a')]=function(_0x25af60){for(var _0x45a145 in _0x25af60){if(_0x25af60[_0xa628('0x1b')](_0x45a145)){if(_0x25af60[_0x45a145]['Imap']&&_0x25af60[_0x45a145][_0xa628('0x13')]){var _0x54260f=_0x25af60[_0x45a145][_0xa628('0x14')];if(!_0x54260f['service']&&_0x25af60[_0x45a145][_0xa628('0x1c')]!==_0xa628('0x1d'))_0x54260f[_0xa628('0x1e')]=_0x25af60[_0x45a145]['provider'];if(!this[_0xa628('0xe')][_0xa628('0x1b')](_0x54260f['id'])){this[_0xa628('0xe')][_0x54260f['id']]=new EmailImap(_0x54260f,_0x25af60[_0x45a145]['email']);this[_0xa628('0xe')][_0x54260f['id']]['on'](_0xa628('0x1f'),this[_0xa628('0x20')]['bind'](this,_0x45a145));this[_0xa628('0xe')][_0x54260f['id']]['on'](_0xa628('0x6'),this[_0xa628('0x21')]['bind'](this,_0x45a145));this['imapAccounts'][_0x54260f['id']]['on'](_0xa628('0x22'),this[_0xa628('0x23')][_0xa628('0x24')](this,_0x45a145));this[_0xa628('0xe')][_0x54260f['id']]['on'](_0xa628('0x25'),this[_0xa628('0x26')][_0xa628('0x24')](this,_0x45a145));}}else{if(_[_0xa628('0x18')](this['mailAccounts'][_0x45a145][_0xa628('0x14')])){this['mailAccounts'][_0x45a145][_0xa628('0x14')]={};}this[_0xa628('0xd')][_0x45a145]['Imap'][_0xa628('0x15')]=_0xa628('0x27');this[_0xa628('0xd')][_0x45a145][_0xa628('0x14')][_0xa628('0x16')]='';this[_0xa628('0x11')](_0x45a145);}}}};EmailChannel[_0xa628('0x10')]['handleImapBox']=function(_0x5dc85c,_0x239b74){if(this[_0xa628('0xd')][_0x5dc85c]){this[_0xa628('0xd')][_0x5dc85c][_0xa628('0x14')][_0xa628('0x15')]=_0xa628('0x28');this[_0xa628('0xd')][_0x5dc85c][_0xa628('0x14')][_0xa628('0x16')]=_0x239b74[_0xa628('0x12')];if(_0x239b74['messages']){this[_0xa628('0xd')][_0x5dc85c][_0xa628('0x14')][_0xa628('0x17')]=_0x239b74[_0xa628('0x29')][_0xa628('0x17')];}return this['emit'](_0x5dc85c);}};EmailChannel[_0xa628('0x10')][_0xa628('0x21')]=function(_0x3c2711,_0x12ea80){logger['info'](_0xa628('0x2a'),_0x12ea80[_0xa628('0x2b')],_0x12ea80[_0xa628('0x2c')],_0x12ea80[_0xa628('0x2d')],_0x3c2711);if(this[_0xa628('0xd')][_0x3c2711]){return mailAccount[_0xa628('0x2e')](_0x3c2711,_0x12ea80)['then'](function(_0x33453b){if(_0x33453b){logger[_0xa628('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0xa628('0x2f')](function(_0x3e3ba4){logger[_0xa628('0x25')](_0xa628('0x30'),JSON['stringify'](_0x3e3ba4));});}};EmailChannel[_0xa628('0x10')]['handleImapEnd']=function(_0x1a0489){if(this[_0xa628('0xd')][_0x1a0489]&&this['mailAccounts'][_0x1a0489][_0xa628('0x14')]){if(this[_0xa628('0xe')][this[_0xa628('0xd')][_0x1a0489][_0xa628('0x14')]['id']]){delete this[_0xa628('0xe')][this[_0xa628('0xd')][_0x1a0489][_0xa628('0x14')]['id']];}this[_0xa628('0xd')][_0x1a0489][_0xa628('0x14')][_0xa628('0x31')]=moment();this['emit'](_0x1a0489);}};EmailChannel[_0xa628('0x10')]['handleImapError']=function(_0xa826d8,_0x5c0875){if(this[_0xa628('0xd')][_0xa826d8]){this[_0xa628('0xd')][_0xa826d8][_0xa628('0x14')][_0xa628('0x15')]=_0xa628('0x25');this[_0xa628('0xd')][_0xa826d8][_0xa628('0x14')][_0xa628('0x16')]=_0x5c0875;return this[_0xa628('0x11')](_0xa826d8);}};EmailChannel[_0xa628('0x10')][_0xa628('0x32')]=function(_0x4d5117,_0x442ddf){return this[_0xa628('0xf')]['send'](_0x4d5117,_0x442ddf);};EmailChannel[_0xa628('0x10')]['verifySmtp']=function(_0x46b649){var _0x24081c=this;if(this[_0xa628('0xd')][_0x46b649['id']]){if(_[_0xa628('0x18')](this[_0xa628('0xd')][_0x46b649['id']]['Smtp'])){this[_0xa628('0xd')][_0x46b649['id']]['Smtp']={};}this[_0xa628('0xd')][_0x46b649['id']][_0xa628('0x33')][_0xa628('0x31')]=moment();return new BPromise(function(_0x186dc3,_0x5e3eed){return _0x24081c[_0xa628('0xf')][_0xa628('0x34')](_0x46b649)[_0xa628('0x35')](function(_0x1357b2){_0x24081c[_0xa628('0xd')][_0x46b649['id']][_0xa628('0x33')][_0xa628('0x15')]=_0xa628('0x36');_0x24081c[_0xa628('0xd')][_0x46b649['id']]['Smtp'][_0xa628('0x16')]='';_0x24081c[_0xa628('0x11')](_0x46b649['id']);_0x186dc3(_0x1357b2);})['catch'](function(_0x256816){_0x24081c[_0xa628('0xd')][_0x46b649['id']][_0xa628('0x33')][_0xa628('0x15')]='error';_0x24081c[_0xa628('0xd')][_0x46b649['id']][_0xa628('0x33')][_0xa628('0x16')]=_0x256816;_0x24081c['emit'](_0x46b649['id']);_0x5e3eed(_0x256816);});});}return this[_0xa628('0xf')][_0xa628('0x34')](_0x46b649);};module[_0xa628('0x37')]=EmailChannel; \ No newline at end of file +var _0x5989=['key','active','Imap','status','messageStatus','total','isNil','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','messages','info','firstName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','send','verifySmtp','Smtp','lastSync','verify','verified','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5989,0x1a5));var _0x9598=function(_0x107df9,_0x4d1825){_0x107df9=_0x107df9-0x0;var _0x2df84a=_0x5989[_0x107df9];return _0x2df84a;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x9598('0x0'));var md5=require(_0x9598('0x1'));var Redis=require('ioredis');var config=require(_0x9598('0x2'));var logger=require(_0x9598('0x3'))(_0x9598('0x4'));config[_0x9598('0x5')]=_[_0x9598('0x6')](config[_0x9598('0x5')],{'host':_0x9598('0x7'),'port':0x18eb});var io=require(_0x9598('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x9598('0x9'));var EmailSmtp=require(_0x9598('0xa'));var mailAccount=require(_0x9598('0xb'));var md5Accounts={};function EmailChannel(_0x23f4fd){logger['info'](_0x9598('0xc'));this['mailAccounts']=_0x23f4fd[_0x9598('0xd')];this[_0x9598('0xe')]={};this[_0x9598('0xf')]=new EmailSmtp();}EmailChannel[_0x9598('0x10')][_0x9598('0x11')]=function(_0x14364d){var _0x51e28b=this[_0x9598('0xd')][_0x14364d];var _0x202664={'id':_0x51e28b['id'],'name':_0x51e28b[_0x9598('0x12')],'key':_0x51e28b[_0x9598('0x13')],'active':_0x51e28b[_0x9598('0x14')],'Imap':{'status':_0x51e28b[_0x9598('0x15')][_0x9598('0x16')],'messageStatus':_0x51e28b[_0x9598('0x15')][_0x9598('0x17')],'total':_0x51e28b[_0x9598('0x15')][_0x9598('0x18')]}};if(_[_0x9598('0x19')](md5Accounts[_0x14364d])){md5Accounts[_0x14364d]={};}var _0x14ec2d=md5(JSON['stringify'](_0x202664));if(md5Accounts[_0x14364d]['md5']!==_0x14ec2d){md5Accounts[_0x14364d][_0x9598('0x1')]=_0x14ec2d;io[_0x9598('0x11')](_0x9598('0x1a'),_0x202664);}};EmailChannel['prototype'][_0x9598('0x1b')]=function(_0xe564e5){for(var _0x5aff4a in _0xe564e5){if(_0xe564e5[_0x9598('0x1c')](_0x5aff4a)){if(_0xe564e5[_0x5aff4a][_0x9598('0x15')]&&_0xe564e5[_0x5aff4a]['active']){var _0x71f595=_0xe564e5[_0x5aff4a][_0x9598('0x15')];if(!_0x71f595[_0x9598('0x1d')]&&_0xe564e5[_0x5aff4a][_0x9598('0x1e')]!==_0x9598('0x1f'))_0x71f595[_0x9598('0x1d')]=_0xe564e5[_0x5aff4a][_0x9598('0x1e')];if(!this['imapAccounts'][_0x9598('0x1c')](_0x71f595['id'])){this[_0x9598('0xe')][_0x71f595['id']]=new EmailImap(_0x71f595,_0xe564e5[_0x5aff4a][_0x9598('0x4')]);this['imapAccounts'][_0x71f595['id']]['on'](_0x9598('0x20'),this[_0x9598('0x21')][_0x9598('0x22')](this,_0x5aff4a));this[_0x9598('0xe')][_0x71f595['id']]['on'](_0x9598('0x4'),this[_0x9598('0x23')][_0x9598('0x22')](this,_0x5aff4a));this[_0x9598('0xe')][_0x71f595['id']]['on']('end',this[_0x9598('0x24')][_0x9598('0x22')](this,_0x5aff4a));this['imapAccounts'][_0x71f595['id']]['on'](_0x9598('0x25'),this[_0x9598('0x26')][_0x9598('0x22')](this,_0x5aff4a));}}else{if(_['isNil'](this['mailAccounts'][_0x5aff4a]['Imap'])){this[_0x9598('0xd')][_0x5aff4a][_0x9598('0x15')]={};}this[_0x9598('0xd')][_0x5aff4a][_0x9598('0x15')][_0x9598('0x16')]=_0x9598('0x27');this[_0x9598('0xd')][_0x5aff4a]['Imap'][_0x9598('0x17')]='';this[_0x9598('0x11')](_0x5aff4a);}}}};EmailChannel[_0x9598('0x10')]['handleImapBox']=function(_0x55a830,_0x32c2de){if(this['mailAccounts'][_0x55a830]){this[_0x9598('0xd')][_0x55a830]['Imap'][_0x9598('0x16')]='connected';this[_0x9598('0xd')][_0x55a830][_0x9598('0x15')][_0x9598('0x17')]=_0x32c2de[_0x9598('0x12')];if(_0x32c2de[_0x9598('0x28')]){this[_0x9598('0xd')][_0x55a830][_0x9598('0x15')][_0x9598('0x18')]=_0x32c2de[_0x9598('0x28')][_0x9598('0x18')];}return this[_0x9598('0x11')](_0x55a830);}};EmailChannel[_0x9598('0x10')]['handleImapEmail']=function(_0x9b3c55,_0x7ef0f2){logger[_0x9598('0x29')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x7ef0f2[_0x9598('0x2a')],_0x7ef0f2['lastName'],_0x7ef0f2[_0x9598('0x2b')],_0x9b3c55);if(this[_0x9598('0xd')][_0x9b3c55]){return mailAccount[_0x9598('0x2c')](_0x9b3c55,_0x7ef0f2)[_0x9598('0x2d')](function(_0x17ab8a){if(_0x17ab8a){logger[_0x9598('0x29')]('Mail\x20accepted\x20from\x20routing');}})[_0x9598('0x2e')](function(_0x48c8ff){logger['error'](_0x9598('0x2f'),JSON[_0x9598('0x30')](_0x48c8ff));});}};EmailChannel[_0x9598('0x10')][_0x9598('0x24')]=function(_0x5655d9){if(this[_0x9598('0xd')][_0x5655d9]&&this[_0x9598('0xd')][_0x5655d9][_0x9598('0x15')]){if(this[_0x9598('0xe')][this[_0x9598('0xd')][_0x5655d9][_0x9598('0x15')]['id']]){delete this[_0x9598('0xe')][this[_0x9598('0xd')][_0x5655d9][_0x9598('0x15')]['id']];}this[_0x9598('0xd')][_0x5655d9][_0x9598('0x15')]['lastSync']=moment();this['emit'](_0x5655d9);}};EmailChannel[_0x9598('0x10')][_0x9598('0x26')]=function(_0x456bf8,_0x45c30a){if(this[_0x9598('0xd')][_0x456bf8]){this[_0x9598('0xd')][_0x456bf8]['Imap'][_0x9598('0x16')]='error';this[_0x9598('0xd')][_0x456bf8][_0x9598('0x15')][_0x9598('0x17')]=_0x45c30a;return this[_0x9598('0x11')](_0x456bf8);}};EmailChannel['prototype']['sendMail']=function(_0x563cd3,_0x539d20){return this[_0x9598('0xf')][_0x9598('0x31')](_0x563cd3,_0x539d20);};EmailChannel['prototype'][_0x9598('0x32')]=function(_0x3e5873){var _0x48784e=this;if(this['mailAccounts'][_0x3e5873['id']]){if(_['isNil'](this['mailAccounts'][_0x3e5873['id']][_0x9598('0x33')])){this[_0x9598('0xd')][_0x3e5873['id']]['Smtp']={};}this[_0x9598('0xd')][_0x3e5873['id']]['Smtp'][_0x9598('0x34')]=moment();return new BPromise(function(_0x2466b8,_0x27961b){return _0x48784e[_0x9598('0xf')][_0x9598('0x35')](_0x3e5873)[_0x9598('0x2d')](function(_0x24012c){_0x48784e['mailAccounts'][_0x3e5873['id']]['Smtp']['status']=_0x9598('0x36');_0x48784e[_0x9598('0xd')][_0x3e5873['id']][_0x9598('0x33')][_0x9598('0x17')]='';_0x48784e[_0x9598('0x11')](_0x3e5873['id']);_0x2466b8(_0x24012c);})[_0x9598('0x2e')](function(_0x5bcb0a){_0x48784e[_0x9598('0xd')][_0x3e5873['id']][_0x9598('0x33')]['status']=_0x9598('0x25');_0x48784e[_0x9598('0xd')][_0x3e5873['id']][_0x9598('0x33')][_0x9598('0x17')]=_0x5bcb0a;_0x48784e[_0x9598('0x11')](_0x3e5873['id']);_0x27961b(_0x5bcb0a);});});}return this[_0x9598('0xf')][_0x9598('0x35')](_0x3e5873);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a8d18ec..4050cdd 100644 --- a/server/services/email/lib/imap.js +++ b/server/services/email/lib/imap.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e96=['modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','mailparser','simpleParser','iconv','events','EventEmitter','../../../config/logger','mailbox','account','getAccount','imap','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0x0e96,0x69));var _0x60e9=function(_0x797fab,_0x3bd44f){_0x797fab=_0x797fab-0x0;var _0x502434=_0x0e96[_0x797fab];return _0x502434;};'use strict';var _=require(_0x60e9('0x0'));var util=require(_0x60e9('0x1'));var Imap=require('imap');var simpleParser=require(_0x60e9('0x2'))[_0x60e9('0x3')];var Iconv=require(_0x60e9('0x4'))['Iconv'];var EventEmitter=require(_0x60e9('0x5'))[_0x60e9('0x6')];var utils=require('./utils');var logger=require(_0x60e9('0x7'))('email');function EmailImap(_0x19b040,_0x4438c3){this[_0x60e9('0x8')]=_0x19b040[_0x60e9('0x8')];this[_0x60e9('0x9')]=this[_0x60e9('0xa')](_0x19b040,_0x4438c3);this[_0x60e9('0xb')]=new Imap(this['account']);this['imap']['once']('ready',this[_0x60e9('0xc')][_0x60e9('0xd')](this));this[_0x60e9('0xb')][_0x60e9('0xe')](_0x60e9('0xf'),this[_0x60e9('0x10')][_0x60e9('0xd')](this));this['imap']['on'](_0x60e9('0x11'),this[_0x60e9('0x12')][_0x60e9('0xd')](this));this[_0x60e9('0xb')]['connect']();}util[_0x60e9('0x13')](EmailImap,EventEmitter);EmailImap[_0x60e9('0x14')][_0x60e9('0xa')]=function(_0x1b5bb6,_0x96ecdf){var _0x4934a9={'connTimeout':_0x1b5bb6[_0x60e9('0x15')]?_0x1b5bb6[_0x60e9('0x15')]*0x3e8:0x2710,'authTimeout':_0x1b5bb6['authTimeout']?_0x1b5bb6[_0x60e9('0x16')]*0x3e8:0x1388};if(_0x1b5bb6[_0x60e9('0x17')]){_0x4934a9['user']=_0x1b5bb6[_0x60e9('0x18')];if(_0x1b5bb6[_0x60e9('0x19')]){_0x4934a9['xoauth2']=utils[_0x60e9('0x1a')](_0x1b5bb6[_0x60e9('0x1b')][_0x60e9('0x1c')],_0x1b5bb6['user']);}else{_0x4934a9['password']=_0x1b5bb6[_0x60e9('0x1d')];}}else{if(_0x1b5bb6[_0x60e9('0x1e')]){_0x4934a9[_0x60e9('0x18')]=_0x1b5bb6[_0x60e9('0x18')];_0x4934a9[_0x60e9('0x1d')]=_0x1b5bb6['password'];}}_0x4934a9[_0x60e9('0x1f')]=_0x96ecdf||_0x1b5bb6[_0x60e9('0x18')]||_0x60e9('0x20');_0x4934a9[_0x60e9('0x21')]=_0x1b5bb6['host'];_0x4934a9[_0x60e9('0x22')]=_0x1b5bb6['port']||0x3e1;if(_0x1b5bb6[_0x60e9('0x23')]){_0x4934a9['tls']=!![];}else{_0x4934a9[_0x60e9('0x23')]=![];_0x4934a9[_0x60e9('0x24')]=_0x60e9('0x25');}return _0x4934a9;};EmailImap[_0x60e9('0x14')][_0x60e9('0xc')]=function(){this[_0x60e9('0xb')][_0x60e9('0x26')](this[_0x60e9('0x8')],![],this[_0x60e9('0x27')][_0x60e9('0xd')](this));};EmailImap[_0x60e9('0x14')][_0x60e9('0x27')]=function(_0x2e6254,_0x2615a1){if(_0x2e6254){this['handleError'](_0x2e6254,!![]);}else{this['emit']('box',_0x2615a1);this[_0x60e9('0x28')]();}};EmailImap[_0x60e9('0x14')][_0x60e9('0x29')]=function(_0x549ec8){if(_0x549ec8){this[_0x60e9('0x12')](_0x549ec8,!![]);}else{this[_0x60e9('0xb')][_0x60e9('0xf')]();}};EmailImap[_0x60e9('0x14')]['readUnseen']=function(){this[_0x60e9('0xb')][_0x60e9('0x2a')]([_0x60e9('0x2b')],this[_0x60e9('0x2c')]['bind'](this));};EmailImap['prototype'][_0x60e9('0x2c')]=function(_0x1b9ace,_0x567353){if(_0x1b9ace){this[_0x60e9('0x12')](_0x1b9ace,!![]);}else{if(_0x567353[_0x60e9('0x2d')]){try{var _0x5d5097=this['imap'][_0x60e9('0x2e')](_0x567353,{'bodies':'','markSeen':!![]});_0x5d5097['on'](_0x60e9('0x2f'),this[_0x60e9('0x30')][_0x60e9('0xd')](this));_0x5d5097[_0x60e9('0xe')](_0x60e9('0x11'),this[_0x60e9('0x31')][_0x60e9('0xd')](this));_0x5d5097['once'](_0x60e9('0xf'),this[_0x60e9('0x32')]['bind'](this));}catch(_0x1e98ef){logger['error'](_0x1e98ef);}}else{this[_0x60e9('0xb')]['closeBox'](!![],this[_0x60e9('0x29')][_0x60e9('0xd')](this));}}};EmailImap[_0x60e9('0x14')][_0x60e9('0x30')]=function(_0x5ed26f){_0x5ed26f['on'](_0x60e9('0x33'),this[_0x60e9('0x34')][_0x60e9('0xd')](this));_0x5ed26f[_0x60e9('0xe')](_0x60e9('0x35'),this[_0x60e9('0x36')]['bind'](this));_0x5ed26f['once']('end',this[_0x60e9('0x37')][_0x60e9('0xd')](this));};EmailImap[_0x60e9('0x14')][_0x60e9('0x34')]=function(_0x41bb37){simpleParser(_0x41bb37,{'Iconv':Iconv},this[_0x60e9('0x38')][_0x60e9('0xd')](this));};EmailImap[_0x60e9('0x14')][_0x60e9('0x36')]=function(){};EmailImap[_0x60e9('0x14')][_0x60e9('0x37')]=function(){};EmailImap[_0x60e9('0x14')][_0x60e9('0x38')]=function(_0x39d508,_0x516f30){if(_0x39d508){logger[_0x60e9('0x11')](_0x39d508);}else{var _0x5c4f18=this;utils[_0x60e9('0x39')](this[_0x60e9('0x9')],_0x516f30,function(_0x4d217e){_0x5c4f18['emit'](_0x60e9('0x1f'),_0x4d217e);});}};EmailImap[_0x60e9('0x14')][_0x60e9('0x32')]=function(){this['imap'][_0x60e9('0x3a')](!![],this[_0x60e9('0x29')][_0x60e9('0xd')](this));};EmailImap['prototype'][_0x60e9('0x31')]=function(_0x29fb3e){this[_0x60e9('0x12')](_0x29fb3e);this[_0x60e9('0xb')][_0x60e9('0x3a')](!![],this[_0x60e9('0x29')]['bind'](this));};EmailImap[_0x60e9('0x14')][_0x60e9('0x10')]=function(){this[_0x60e9('0x3b')](_0x60e9('0xf'));};EmailImap['prototype'][_0x60e9('0x12')]=function(_0x818133,_0x3a246d){logger[_0x60e9('0x11')]('handleError',this[_0x60e9('0x9')][_0x60e9('0x1f')],JSON[_0x60e9('0x3c')](_0x818133));var _0x474777='';if(_0x818133){if(_0x818133[_0x60e9('0x3d')]){_0x474777=_0x818133['textCode'];}else{for(var _0x238487 in _0x818133){if(_0x818133[_0x60e9('0x3e')](_0x238487)){_0x474777+=_[_0x60e9('0x3f')](_0x238487)+':\x20'+_0x818133[_0x238487]+'\x0a';}}}}if(_0x3a246d){this[_0x60e9('0xb')]['end']();}else{this[_0x60e9('0x3b')]('error',_0x474777);this['emit']('end');}};module[_0x60e9('0x40')]=EmailImap; \ No newline at end of file +var _0x7517=['ready','handleReady','bind','end','handleEnd','handleError','inherits','connTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','anonymous@xcally.com','host','port','tls','required','handleOpenBox','emit','readUnseen','handleCloseBox','prototype','search','handleReadUnseen','length','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageEnd','handleSimpleParser','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7517,0x9d));var _0x7751=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7517[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0x7751('0x0'));var simpleParser=require(_0x7751('0x1'))[_0x7751('0x2')];var Iconv=require(_0x7751('0x3'))[_0x7751('0x4')];var EventEmitter=require(_0x7751('0x5'))[_0x7751('0x6')];var utils=require(_0x7751('0x7'));var logger=require(_0x7751('0x8'))(_0x7751('0x9'));function EmailImap(_0x23f5ef,_0x33cf50){this['mailbox']=_0x23f5ef[_0x7751('0xa')];this[_0x7751('0xb')]=this[_0x7751('0xc')](_0x23f5ef,_0x33cf50);this[_0x7751('0x0')]=new Imap(this[_0x7751('0xb')]);this[_0x7751('0x0')][_0x7751('0xd')](_0x7751('0xe'),this[_0x7751('0xf')][_0x7751('0x10')](this));this[_0x7751('0x0')][_0x7751('0xd')](_0x7751('0x11'),this[_0x7751('0x12')][_0x7751('0x10')](this));this['imap']['on']('error',this[_0x7751('0x13')][_0x7751('0x10')](this));this['imap']['connect']();}util[_0x7751('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x7751('0xc')]=function(_0x3bbe1f,_0x32bd4c){var _0x8d49e0={'connTimeout':_0x3bbe1f[_0x7751('0x15')]?_0x3bbe1f[_0x7751('0x15')]*0x3e8:0x2710,'authTimeout':_0x3bbe1f['authTimeout']?_0x3bbe1f['authTimeout']*0x3e8:0x1388};if(_0x3bbe1f[_0x7751('0x16')]){_0x8d49e0[_0x7751('0x17')]=_0x3bbe1f[_0x7751('0x17')];if(_0x3bbe1f['modernAuthentication']){_0x8d49e0[_0x7751('0x18')]=utils[_0x7751('0x19')](_0x3bbe1f[_0x7751('0x1a')][_0x7751('0x1b')],_0x3bbe1f[_0x7751('0x17')]);}else{_0x8d49e0[_0x7751('0x1c')]=_0x3bbe1f[_0x7751('0x1c')];}}else{if(_0x3bbe1f['authentication']){_0x8d49e0['user']=_0x3bbe1f['user'];_0x8d49e0['password']=_0x3bbe1f[_0x7751('0x1c')];}}_0x8d49e0[_0x7751('0x9')]=_0x32bd4c||_0x3bbe1f[_0x7751('0x17')]||_0x7751('0x1d');_0x8d49e0[_0x7751('0x1e')]=_0x3bbe1f['host'];_0x8d49e0[_0x7751('0x1f')]=_0x3bbe1f[_0x7751('0x1f')]||0x3e1;if(_0x3bbe1f[_0x7751('0x20')]){_0x8d49e0['tls']=!![];}else{_0x8d49e0[_0x7751('0x20')]=![];_0x8d49e0['autotls']=_0x7751('0x21');}return _0x8d49e0;};EmailImap['prototype']['handleReady']=function(){this[_0x7751('0x0')]['openBox'](this[_0x7751('0xa')],![],this[_0x7751('0x22')][_0x7751('0x10')](this));};EmailImap['prototype'][_0x7751('0x22')]=function(_0x3c29d0,_0x3d17d9){if(_0x3c29d0){this['handleError'](_0x3c29d0,!![]);}else{this[_0x7751('0x23')]('box',_0x3d17d9);this[_0x7751('0x24')]();}};EmailImap['prototype'][_0x7751('0x25')]=function(_0x2836a5){if(_0x2836a5){this[_0x7751('0x13')](_0x2836a5,!![]);}else{this[_0x7751('0x0')][_0x7751('0x11')]();}};EmailImap[_0x7751('0x26')][_0x7751('0x24')]=function(){this[_0x7751('0x0')][_0x7751('0x27')](['UNSEEN'],this[_0x7751('0x28')][_0x7751('0x10')](this));};EmailImap[_0x7751('0x26')][_0x7751('0x28')]=function(_0x1858bc,_0x5a3fef){if(_0x1858bc){this['handleError'](_0x1858bc,!![]);}else{if(_0x5a3fef[_0x7751('0x29')]){try{var _0x184d36=this[_0x7751('0x0')]['fetch'](_0x5a3fef,{'bodies':'','markSeen':!![]});_0x184d36['on'](_0x7751('0x2a'),this[_0x7751('0x2b')][_0x7751('0x10')](this));_0x184d36[_0x7751('0xd')](_0x7751('0x2c'),this[_0x7751('0x2d')][_0x7751('0x10')](this));_0x184d36[_0x7751('0xd')](_0x7751('0x11'),this[_0x7751('0x2e')][_0x7751('0x10')](this));}catch(_0x1e4aa4){logger['error'](_0x1e4aa4);}}else{this['imap'][_0x7751('0x2f')](!![],this[_0x7751('0x25')][_0x7751('0x10')](this));}}};EmailImap['prototype'][_0x7751('0x2b')]=function(_0x22cb7a){_0x22cb7a['on'](_0x7751('0x30'),this[_0x7751('0x31')][_0x7751('0x10')](this));_0x22cb7a[_0x7751('0xd')]('attributes',this['handleMessageAttributes']['bind'](this));_0x22cb7a[_0x7751('0xd')](_0x7751('0x11'),this[_0x7751('0x32')][_0x7751('0x10')](this));};EmailImap[_0x7751('0x26')][_0x7751('0x31')]=function(_0x44b8ef){simpleParser(_0x44b8ef,{'Iconv':Iconv},this[_0x7751('0x33')]['bind'](this));};EmailImap[_0x7751('0x26')]['handleMessageAttributes']=function(){};EmailImap[_0x7751('0x26')][_0x7751('0x32')]=function(){};EmailImap['prototype'][_0x7751('0x33')]=function(_0x4a1690,_0x3b2fb6){if(_0x4a1690){logger['error'](_0x4a1690);}else{var _0x206761=this;utils['parser'](this[_0x7751('0xb')],_0x3b2fb6,function(_0xcca58c){_0x206761[_0x7751('0x23')]('email',_0xcca58c);});}};EmailImap[_0x7751('0x26')]['handleFetchEnd']=function(){this[_0x7751('0x0')][_0x7751('0x2f')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x7751('0x26')]['handleFetchError']=function(_0x3a6b94){this[_0x7751('0x13')](_0x3a6b94);this[_0x7751('0x0')][_0x7751('0x2f')](!![],this[_0x7751('0x25')][_0x7751('0x10')](this));};EmailImap[_0x7751('0x26')][_0x7751('0x12')]=function(){this['emit'](_0x7751('0x11'));};EmailImap[_0x7751('0x26')][_0x7751('0x13')]=function(_0x393e8e,_0x2a6e3e){logger[_0x7751('0x2c')](_0x7751('0x13'),this[_0x7751('0xb')][_0x7751('0x9')],JSON[_0x7751('0x34')](_0x393e8e));var _0x5c947e='';if(_0x393e8e){if(_0x393e8e[_0x7751('0x35')]){_0x5c947e=_0x393e8e['textCode'];}else{for(var _0x26aeb1 in _0x393e8e){if(_0x393e8e[_0x7751('0x36')](_0x26aeb1)){_0x5c947e+=_[_0x7751('0x37')](_0x26aeb1)+':\x20'+_0x393e8e[_0x26aeb1]+'\x0a';}}}}if(_0x2a6e3e){this[_0x7751('0x0')]['end']();}else{this[_0x7751('0x23')](_0x7751('0x2c'),_0x5c947e);this[_0x7751('0x23')](_0x7751('0x11'));}};module[_0x7751('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index b50e9cb..ad0d42f 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5861=['use','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x37fbee,_0x437603){var _0x1df5ba=function(_0x4ce09f){while(--_0x4ce09f){_0x37fbee['push'](_0x37fbee['shift']());}};_0x1df5ba(++_0x437603);}(_0x5861,0xdc));var _0x1586=function(_0x256f75,_0x3f408b){_0x256f75=_0x256f75-0x0;var _0x4f6e0b=_0x5861[_0x256f75];return _0x4f6e0b;};'use strict';var nodemailer=require(_0x1586('0x0'));var inlineBase64=require(_0x1586('0x1'));function EmailSmtp(){}EmailSmtp[_0x1586('0x2')][_0x1586('0x3')]=function(_0x485d9d,_0xf5523d){return new Promise(function(_0xec2fae,_0x1d7ca4){var _0x5547e6=nodemailer[_0x1586('0x4')](_0x485d9d);_0x5547e6[_0x1586('0x5')]('compile',inlineBase64());_0x5547e6['sendMail'](_0xf5523d,function(_0x32e598,_0x263eee){if(_0x32e598){_0x1d7ca4(_0x32e598[_0x1586('0x6')]());}else{_0xec2fae(_0x263eee);}});});};EmailSmtp[_0x1586('0x2')][_0x1586('0x7')]=function(_0x2e38ef){return new Promise(function(_0x22670a,_0x20ff30){var _0x510716=nodemailer[_0x1586('0x4')](_0x2e38ef);_0x510716['verify'](function(_0x50b9fa,_0x594cc3){if(_0x50b9fa){_0x20ff30(_0x50b9fa[_0x1586('0x6')]());}else{if(_0x594cc3){_0x22670a(_0x594cc3);}else{_0x20ff30('Not\x20verifired');}}});});};module[_0x1586('0x8')]=EmailSmtp; \ No newline at end of file +var _0x45fa=['exports','prototype','send','createTransport','use','sendMail','toString','Not\x20verifired'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x45fa,0xf9));var _0xa45f=function(_0xfad00d,_0x311d9b){_0xfad00d=_0xfad00d-0x0;var _0x28328c=_0x45fa[_0xfad00d];return _0x28328c;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xa45f('0x0')][_0xa45f('0x1')]=function(_0x1b0a74,_0xff9eac){return new Promise(function(_0x432bd3,_0x270f7c){var _0x3e9b5a=nodemailer[_0xa45f('0x2')](_0x1b0a74);_0x3e9b5a[_0xa45f('0x3')]('compile',inlineBase64());_0x3e9b5a[_0xa45f('0x4')](_0xff9eac,function(_0x50d860,_0x4eb782){if(_0x50d860){_0x270f7c(_0x50d860['toString']());}else{_0x432bd3(_0x4eb782);}});});};EmailSmtp[_0xa45f('0x0')]['verify']=function(_0x52378e){return new Promise(function(_0x1034ef,_0x2d9544){var _0xbc08e1=nodemailer[_0xa45f('0x2')](_0x52378e);_0xbc08e1['verify'](function(_0x546cb0,_0x343a3b){if(_0x546cb0){_0x2d9544(_0x546cb0[_0xa45f('0x5')]());}else{if(_0x343a3b){_0x1034ef(_0x343a3b);}else{_0x2d9544(_0xa45f('0x6'));}}});});};module[_0xa45f('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 8ae3f86..4fe7306 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5922=['user=','base64','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','pop','isEmpty','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Data','generateXOAuth2Token'];(function(_0xad39f6,_0x129028){var _0x2eb864=function(_0xfc11bb){while(--_0xfc11bb){_0xad39f6['push'](_0xad39f6['shift']());}};_0x2eb864(++_0x129028);}(_0x5922,0x132));var _0x2592=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x5922[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var moment=require(_0x2592('0x0'));var random=require(_0x2592('0x1'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x2592('0x2'));var logger=require(_0x2592('0x3'))(_0x2592('0x4'));var config=require(_0x2592('0x5'));function getAddress(_0x3d8501){var _0x29eee8=_[_0x2592('0x6')](_0x3d8501[_0x2592('0x7')]);return _0x29eee8&&_0x29eee8[_0x2592('0x8')]?_0x29eee8[_0x2592('0x8')]:_0x2592('0x9')+random[_0x2592('0xa')](0x6)+_0x2592('0xb');}function getFirstName(_0x1b75bb){var _0x1f217d=_[_0x2592('0x6')](_0x1b75bb[_0x2592('0x7')]);if(_0x1f217d&&_0x1f217d[_0x2592('0xc')]){if(_0x1f217d['name']==_0x1f217d[_0x2592('0x8')]){return _0x1f217d[_0x2592('0xc')][_0x2592('0xd')](0x0,_0x1f217d[_0x2592('0xc')][_0x2592('0xe')]('@'));}var _0x51ec41=_0x1f217d[_0x2592('0xc')][_0x2592('0xf')](/\s+/);return _0x51ec41[_0x2592('0x10')]>0x1?_0x51ec41[_0x2592('0x11')](0x0,-0x1)[_0x2592('0x12')]('\x20'):_0x1f217d[_0x2592('0xc')];}return'Anonymous';}function getLastName(_0x38a446){var _0x224418=_['head'](_0x38a446[_0x2592('0x7')]);if(_0x224418&&_0x224418[_0x2592('0xc')]){var _0x2d33e2=_0x224418[_0x2592('0xc')]['split'](/\s+/);return _0x2d33e2['length']>0x1?_0x2d33e2[_0x2592('0x13')]():'';}return'';}function getMails(_0x3452bb,_0x297eb0){var _0x6ef5dc='';for(var _0x34f5c4=0x0;_0x34f5c4<_0x297eb0[_0x2592('0x7')][_0x2592('0x10')];_0x34f5c4+=0x1){if(_0x297eb0[_0x2592('0x7')][_0x34f5c4]['address']!==_0x3452bb){if(!_[_0x2592('0x14')](_0x6ef5dc)){_0x6ef5dc+=',';}_0x6ef5dc+=_0x297eb0[_0x2592('0x7')][_0x34f5c4][_0x2592('0xc')]||_0x297eb0['value'][_0x34f5c4]['address']||'';_0x6ef5dc+='\x20<';_0x6ef5dc+=_0x297eb0[_0x2592('0x7')][_0x34f5c4]['address']?_0x297eb0[_0x2592('0x7')][_0x34f5c4][_0x2592('0x8')]:'anonymous'+random[_0x2592('0xa')](0x6)+_0x2592('0xb');_0x6ef5dc+='>';}}return _0x6ef5dc;}function parseEmail(_0x1a97ca,_0x2f93fd,_0x337996){if(_0x2f93fd['html']){var _0x37dbbd=/)<[^<]*)*<\/script>/gi;while(_0x37dbbd[_0x2592('0x15')](_0x2f93fd[_0x2592('0x16')])){_0x2f93fd[_0x2592('0x16')]=_0x2f93fd[_0x2592('0x16')][_0x2592('0x17')](_0x37dbbd,'');}if(_0x2f93fd[_0x2592('0x16')][_0x2592('0x18')](_0x2592('0x19'))){var _0x5e52c5=[];_0x2f93fd['attachments'][_0x2592('0x1a')](_0x2b4413=>{_0x5e52c5[_0x2592('0x1b')](_0x2b4413[_0x2592('0x1c')]);});var _0x3864fa=/]+>/g;var _0x292f0b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x21c880=_0x2f93fd['html'][_0x2592('0x17')](_0x292f0b,_0x2592('0x1d'));var _0x120bab=_0x21c880['replace'](_0x3864fa,'_IMG');for(let _0xc3dbce=0x0;_0xc3dbce<_0x5e52c5[_0x2592('0x10')];_0xc3dbce++){var _0xe55950=_0x120bab['replace'](_0x2592('0x1e'),_0x2592('0x1f')+_0x5e52c5[_0xc3dbce]+_0x2592('0x20'));_0x120bab=_0xe55950;}_0x2f93fd[_0x2592('0x16')]=_0x120bab;}_0x337996[_0x2592('0x21')]=_0x2f93fd[_0x2592('0x16')];}else{_0x337996['body']=_0x2f93fd[_0x2592('0x22')];}if(_0x337996[_0x2592('0x21')]){_0x337996[_0x2592('0x21')]=_0x337996[_0x2592('0x21')][_0x2592('0x17')](/0x0){var _0x47efa7=[_0x2592('0x34'),_0x2592('0x35'),_0x2592('0x36')];for(var _0x2a05ae=0x0;_0x2a05ae<_0x2f93fd['headerLines'][_0x2592('0x10')];_0x2a05ae++){var _0x3a41bd=_[_0x2592('0xe')](_0x47efa7,_0x2f93fd[_0x2592('0x33')][_0x2a05ae][_0x2592('0x37')]);if(_0x3a41bd>=0x0){_0x337996[_0x2592('0x38')]=!![];}}}return _0x337996;}exports[_0x2592('0x39')]=function(_0x469401,_0x273cee,_0x53daee){var _0x55a4fc={'from':getAddress(_0x273cee[_0x2592('0x3a')]),'firstName':getFirstName(_0x273cee[_0x2592('0x3a')]),'lastName':getLastName(_0x273cee[_0x2592('0x3a')]),'mapKey':'email','message':{'from':getMails(_0x469401['email'],_0x273cee[_0x2592('0x3a')]),'to':_0x469401[_0x2592('0x4')],'cc':'','subject':_0x273cee[_0x2592('0x3b')]||'','messageId':_0x273cee[_0x2592('0x3c')],'inReplyTo':_0x273cee[_0x2592('0x3d')],'sentAt':moment(_0x273cee['date'])[_0x2592('0x2d')](_0x2592('0x3e')),'attach':![],'attachments':[]}};if(!_0x273cee[_0x2592('0x16')]&&!_0x273cee[_0x2592('0x22')]){var _0x3a1740=_[_0x2592('0x3f')](_0x273cee[_0x2592('0x28')],{'contentType':_0x2592('0x40')});if(_0x3a1740[_0x2592('0x10')]){logger[_0x2592('0x41')](util[_0x2592('0x2d')](_0x2592('0x42'),_0x273cee[_0x2592('0x3c')]));tnef[_0x2592('0x43')](_[_0x2592('0x44')](_0x3a1740)['content'],function(_0xba89b0,_0x2b110e){if(_0x2b110e){_0x273cee[_0x2592('0x16')]=_0x2b110e[_0x2592('0x45')]||_0x2592('0x46');if(_0x2b110e['Attachments']){for(var _0x151b1c=0x0;_0x151b1c<_0x2b110e[_0x2592('0x47')][_0x2592('0x10')];_0x151b1c++){var _0xcf4333=_0x2b110e[_0x2592('0x47')][_0x151b1c];_0x55a4fc[_0x2592('0x24')]['attachments']['push']({'filename':_0xcf4333['Title'],'content':Buffer[_0x2592('0x3a')](_0xcf4333[_0x2592('0x48')])});}}}_0x53daee(parseEmail(_0x469401,_0x273cee,_0x55a4fc));});}else{_0x273cee[_0x2592('0x16')]='

Empty\x20message

';_0x53daee(parseEmail(_0x469401,_0x273cee,_0x55a4fc));}}else{_0x53daee(parseEmail(_0x469401,_0x273cee,_0x55a4fc));}};exports[_0x2592('0x49')]=function(_0x3c76db,_0x1ef00b){var _0x2a6272=[_0x2592('0x4a')+(_0x1ef00b||''),'auth=Bearer\x20'+_0x3c76db,'',''];return Buffer['from'](_0x2a6272[_0x2592('0x12')](''),'utf-8')['toString'](_0x2592('0x4b'));}; \ No newline at end of file +var _0xc554=['message','originTo','isEmpty','originCc','includes','bcc','attachment','format','now','server/files/attachments/','content','headerLines','Precedence:\x20auto_reply','line','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','toString','base64','lodash','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','test','html','replace','\x20[Attachment:\x20','body'];(function(_0x5278c9,_0x192e9e){var _0x3a3a09=function(_0x5ab67f){while(--_0x5ab67f){_0x5278c9['push'](_0x5278c9['shift']());}};_0x3a3a09(++_0x192e9e);}(_0xc554,0x133));var _0x4c55=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0xc554[_0x45cd35];return _0x16db84;};'use strict';var _=require(_0x4c55('0x0'));var moment=require(_0x4c55('0x1'));var random=require(_0x4c55('0x2'));var fs=require('fs');var path=require(_0x4c55('0x3'));var util=require(_0x4c55('0x4'));var tnef=require(_0x4c55('0x5'));var logger=require('../../../config/logger')(_0x4c55('0x6'));var config=require(_0x4c55('0x7'));function getAddress(_0x1a9be6){var _0x5b05fe=_[_0x4c55('0x8')](_0x1a9be6[_0x4c55('0x9')]);return _0x5b05fe&&_0x5b05fe[_0x4c55('0xa')]?_0x5b05fe[_0x4c55('0xa')]:_0x4c55('0xb')+random[_0x4c55('0xc')](0x6)+_0x4c55('0xd');}function getFirstName(_0x2698bf){var _0x125c12=_['head'](_0x2698bf[_0x4c55('0x9')]);if(_0x125c12&&_0x125c12[_0x4c55('0xe')]){if(_0x125c12[_0x4c55('0xe')]==_0x125c12['address']){return _0x125c12[_0x4c55('0xe')][_0x4c55('0xf')](0x0,_0x125c12['name'][_0x4c55('0x10')]('@'));}var _0x52ea61=_0x125c12[_0x4c55('0xe')][_0x4c55('0x11')](/\s+/);return _0x52ea61[_0x4c55('0x12')]>0x1?_0x52ea61[_0x4c55('0x13')](0x0,-0x1)[_0x4c55('0x14')]('\x20'):_0x125c12[_0x4c55('0xe')];}return _0x4c55('0x15');}function getLastName(_0x2b9462){var _0x249317=_[_0x4c55('0x8')](_0x2b9462[_0x4c55('0x9')]);if(_0x249317&&_0x249317[_0x4c55('0xe')]){var _0x22860e=_0x249317[_0x4c55('0xe')][_0x4c55('0x11')](/\s+/);return _0x22860e[_0x4c55('0x12')]>0x1?_0x22860e[_0x4c55('0x16')]():'';}return'';}function getMails(_0x1ab657,_0x3f7a17){var _0x429433='';for(var _0x4fd2fc=0x0;_0x4fd2fc<_0x3f7a17[_0x4c55('0x9')]['length'];_0x4fd2fc+=0x1){if(_0x3f7a17[_0x4c55('0x9')][_0x4fd2fc][_0x4c55('0xa')]!==_0x1ab657){if(!_['isEmpty'](_0x429433)){_0x429433+=',';}_0x429433+=_0x3f7a17[_0x4c55('0x9')][_0x4fd2fc]['name']||_0x3f7a17[_0x4c55('0x9')][_0x4fd2fc][_0x4c55('0xa')]||'';_0x429433+='\x20<';_0x429433+=_0x3f7a17[_0x4c55('0x9')][_0x4fd2fc][_0x4c55('0xa')]?_0x3f7a17[_0x4c55('0x9')][_0x4fd2fc][_0x4c55('0xa')]:'anonymous'+random[_0x4c55('0xc')](0x6)+_0x4c55('0xd');_0x429433+='>';}}return _0x429433;}function parseEmail(_0x6e22c2,_0x4941c1,_0x42addd){if(_0x4941c1['html']){var _0x5e5aef=/)<[^<]*)*<\/script>/gi;while(_0x5e5aef[_0x4c55('0x17')](_0x4941c1[_0x4c55('0x18')])){_0x4941c1[_0x4c55('0x18')]=_0x4941c1['html'][_0x4c55('0x19')](_0x5e5aef,'');}if(_0x4941c1[_0x4c55('0x18')]['includes'](_0x4c55('0x1a'))){var _0x26d6d1=[];_0x4941c1[_0x4c55('0x1b')][_0x4c55('0x1c')](_0x4c3381=>{_0x26d6d1[_0x4c55('0x1d')](_0x4c3381['filename']);});var _0x47777a=/]+>/g;var _0x2832f9=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4be6d0=_0x4941c1['html'][_0x4c55('0x19')](_0x2832f9,'_SRC');var _0xfdef51=_0x4be6d0[_0x4c55('0x19')](_0x47777a,_0x4c55('0x1e'));for(let _0x4dc504=0x0;_0x4dc504<_0x26d6d1[_0x4c55('0x12')];_0x4dc504++){var _0x5e420d=_0xfdef51[_0x4c55('0x19')](_0x4c55('0x1e'),_0x4c55('0x1f')+_0x26d6d1[_0x4dc504]+'\x20]');_0xfdef51=_0x5e420d;}_0x4941c1[_0x4c55('0x18')]=_0xfdef51;}_0x42addd[_0x4c55('0x20')]=_0x4941c1[_0x4c55('0x18')];}else{_0x42addd[_0x4c55('0x20')]=_0x4941c1['textAsHtml'];}if(_0x42addd[_0x4c55('0x20')]){_0x42addd['body']=_0x42addd['body'][_0x4c55('0x19')](/0x0){var _0x4a2fb7=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x4c55('0x2d')];for(var _0x5147ba=0x0;_0x5147ba<_0x4941c1['headerLines'][_0x4c55('0x12')];_0x5147ba++){var _0x475ac5=_[_0x4c55('0x10')](_0x4a2fb7,_0x4941c1[_0x4c55('0x2c')][_0x5147ba][_0x4c55('0x2e')]);if(_0x475ac5>=0x0){_0x42addd['isAutoreply']=!![];}}}return _0x42addd;}exports['parser']=function(_0x5a1b06,_0xfc0fd7,_0x2bfddf){var _0x354177={'from':getAddress(_0xfc0fd7[_0x4c55('0x2f')]),'firstName':getFirstName(_0xfc0fd7[_0x4c55('0x2f')]),'lastName':getLastName(_0xfc0fd7['from']),'mapKey':_0x4c55('0x6'),'message':{'from':getMails(_0x5a1b06['email'],_0xfc0fd7[_0x4c55('0x2f')]),'to':_0x5a1b06['email'],'cc':'','subject':_0xfc0fd7[_0x4c55('0x30')]||'','messageId':_0xfc0fd7[_0x4c55('0x31')],'inReplyTo':_0xfc0fd7[_0x4c55('0x32')],'sentAt':moment(_0xfc0fd7[_0x4c55('0x33')])[_0x4c55('0x28')](_0x4c55('0x34')),'attach':![],'attachments':[]}};if(!_0xfc0fd7['html']&&!_0xfc0fd7[_0x4c55('0x35')]){var _0x2fe1c4=_[_0x4c55('0x36')](_0xfc0fd7['attachments'],{'contentType':'application/ms-tnef'});if(_0x2fe1c4['length']){logger[_0x4c55('0x37')](util[_0x4c55('0x28')](_0x4c55('0x38'),_0xfc0fd7['messageId']));tnef[_0x4c55('0x39')](_[_0x4c55('0x3a')](_0x2fe1c4)['content'],function(_0x27ca82,_0x14881c){if(_0x14881c){_0xfc0fd7[_0x4c55('0x18')]=_0x14881c[_0x4c55('0x3b')]||_0x4c55('0x3c');if(_0x14881c[_0x4c55('0x3d')]){for(var _0x4b1fa4=0x0;_0x4b1fa4<_0x14881c['Attachments'][_0x4c55('0x12')];_0x4b1fa4++){var _0x2190c2=_0x14881c['Attachments'][_0x4b1fa4];_0x354177[_0x4c55('0x21')]['attachments'][_0x4c55('0x1d')]({'filename':_0x2190c2[_0x4c55('0x3e')],'content':Buffer[_0x4c55('0x2f')](_0x2190c2[_0x4c55('0x3f')])});}}}_0x2bfddf(parseEmail(_0x5a1b06,_0xfc0fd7,_0x354177));});}else{_0xfc0fd7[_0x4c55('0x18')]=_0x4c55('0x3c');_0x2bfddf(parseEmail(_0x5a1b06,_0xfc0fd7,_0x354177));}}else{_0x2bfddf(parseEmail(_0x5a1b06,_0xfc0fd7,_0x354177));}};exports[_0x4c55('0x40')]=function(_0x2a6869,_0x4d6db0){var _0x381692=[_0x4c55('0x41')+(_0x4d6db0||''),'auth=Bearer\x20'+_0x2a6869,'',''];return Buffer['from'](_0x381692['join'](''),'utf-8')[_0x4c55('0x42')](_0x4c55('0x43'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b4b3e14..87981b3 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb868=['Imap','Smtp','exports','lodash','key','SERV','active'];(function(_0x24aeb1,_0xb208d9){var _0x555b85=function(_0x35aca9){while(--_0x35aca9){_0x24aeb1['push'](_0x24aeb1['shift']());}};_0x555b85(++_0xb208d9);}(_0xb868,0x1d1));var _0x8b86=function(_0x13696e,_0x150303){_0x13696e=_0x13696e-0x0;var _0x5a24bc=_0xb868[_0x13696e];return _0x5a24bc;};'use strict';var _=require(_0x8b86('0x0'));function MailAccount(_0x348652){this['id']=_0x348652['id']||0x0;this['name']=_0x348652['name']||'Service';this[_0x8b86('0x1')]=_0x348652[_0x8b86('0x1')]||_0x8b86('0x2');this[_0x8b86('0x3')]=_0x348652[_0x8b86('0x3')]||![];this[_0x8b86('0x4')]=_0x348652[_0x8b86('0x4')]||[];this[_0x8b86('0x5')]=_0x348652['Smtp']||[];}module[_0x8b86('0x6')]=MailAccount; \ No newline at end of file +var _0x991a=['Imap','Smtp','exports','lodash','Service','key','SERV','active'];(function(_0x461826,_0x5812ad){var _0x42cbd3=function(_0x21d928){while(--_0x21d928){_0x461826['push'](_0x461826['shift']());}};_0x42cbd3(++_0x5812ad);}(_0x991a,0x1b3));var _0xa991=function(_0x37eade,_0x4246f8){_0x37eade=_0x37eade-0x0;var _0x1b1156=_0x991a[_0x37eade];return _0x1b1156;};'use strict';var _=require(_0xa991('0x0'));function MailAccount(_0x288d33){this['id']=_0x288d33['id']||0x0;this['name']=_0x288d33['name']||_0xa991('0x1');this[_0xa991('0x2')]=_0x288d33[_0xa991('0x2')]||_0xa991('0x3');this[_0xa991('0x4')]=_0x288d33[_0xa991('0x4')]||![];this[_0xa991('0x5')]=_0x288d33['Imap']||[];this[_0xa991('0x6')]=_0x288d33['Smtp']||[];}module[_0xa991('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c6e82a8..2a7f233 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a3b=['mapKeys','prototype','mergeFromDatabase','hasOwnProperty','length','isUndefined','exports','../model/mailAccount','mailAccounts'];(function(_0x5784f6,_0x32a486){var _0x3b9711=function(_0x1c5a58){while(--_0x1c5a58){_0x5784f6['push'](_0x5784f6['shift']());}};_0x3b9711(++_0x32a486);}(_0x8a3b,0x1db));var _0xb8a3=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x8a3b[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var MailAccount=require(_0xb8a3('0x0'));var Realtime=function(){this[_0xb8a3('0x1')]={};};function freeIsNotKey(_0x141dec,_0x585e1a,_0x230c30){var _0x2775d0=_[_0xb8a3('0x2')](_0x141dec,function(_0x207592,_0x538cfa){return _0x207592[_0x230c30];});for(var _0x499437 in _0x585e1a){if(_0x585e1a['hasOwnProperty'](_0x499437)){if(!_0x2775d0[_0x499437]){delete _0x585e1a[_0x499437];}}}}Realtime[_0xb8a3('0x3')][_0xb8a3('0x4')]=function(_0x10ac98,_0x4aeb3a){for(var _0x3eece9 in _0x4aeb3a){if(_0x10ac98[_0xb8a3('0x5')](_0x3eece9)){_0x10ac98[_0x3eece9]=_0x4aeb3a[_0x3eece9];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x4e2acc=this;return function(_0x409197){if(_0x409197){freeIsNotKey(_0x409197,_0x4e2acc['mailAccounts'],'id');for(var _0x82e243=0x0,_0x130f86={},_0x54211f={};_0x82e243<_0x409197[_0xb8a3('0x6')];_0x82e243+=0x1){_0x130f86=_0x409197[_0x82e243];if(_[_0xb8a3('0x7')](_0x4e2acc[_0xb8a3('0x1')][_0x130f86['id']])){_0x4e2acc[_0xb8a3('0x1')][_0x130f86['id']]=new MailAccount(_0x130f86);}else{_['merge'](_0x4e2acc[_0xb8a3('0x1')][_0x130f86['id']],_0x130f86);}}}return _0x4e2acc[_0xb8a3('0x1')];};};module[_0xb8a3('0x8')]=Realtime; \ No newline at end of file +var _0x687c=['length','merge','exports','lodash','../model/mailAccount','prototype','mergeFromDatabase','initMailAccounts','mailAccounts'];(function(_0x1f0639,_0x306cfb){var _0x1080c2=function(_0x3d6490){while(--_0x3d6490){_0x1f0639['push'](_0x1f0639['shift']());}};_0x1080c2(++_0x306cfb);}(_0x687c,0x111));var _0xc687=function(_0x16515b,_0x5b0e2c){_0x16515b=_0x16515b-0x0;var _0x53c64d=_0x687c[_0x16515b];return _0x53c64d;};'use strict';var _=require(_0xc687('0x0'));var MailAccount=require(_0xc687('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4f86ef,_0x4bdd7b,_0x20f630){var _0x142831=_['mapKeys'](_0x4f86ef,function(_0x5f568a,_0x21ac99){return _0x5f568a[_0x20f630];});for(var _0x439c1a in _0x4bdd7b){if(_0x4bdd7b['hasOwnProperty'](_0x439c1a)){if(!_0x142831[_0x439c1a]){delete _0x4bdd7b[_0x439c1a];}}}}Realtime[_0xc687('0x2')][_0xc687('0x3')]=function(_0x5b0247,_0xfaeb73){for(var _0x2beb9c in _0xfaeb73){if(_0x5b0247['hasOwnProperty'](_0x2beb9c)){_0x5b0247[_0x2beb9c]=_0xfaeb73[_0x2beb9c];}}};Realtime[_0xc687('0x2')][_0xc687('0x4')]=function(){var _0x41c263=this;return function(_0xdc41ac){if(_0xdc41ac){freeIsNotKey(_0xdc41ac,_0x41c263[_0xc687('0x5')],'id');for(var _0x6e5a60=0x0,_0x3f2645={},_0x1bd1ca={};_0x6e5a60<_0xdc41ac[_0xc687('0x6')];_0x6e5a60+=0x1){_0x3f2645=_0xdc41ac[_0x6e5a60];if(_['isUndefined'](_0x41c263[_0xc687('0x5')][_0x3f2645['id']])){_0x41c263['mailAccounts'][_0x3f2645['id']]=new MailAccount(_0x3f2645);}else{_[_0xc687('0x7')](_0x41c263['mailAccounts'][_0x3f2645['id']],_0x3f2645);}}}return _0x41c263[_0xc687('0x5')];};};module[_0xc687('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 026ffb5..9e99f6c 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba6f=['data5','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','Smtp'];(function(_0x1f717b,_0x53cc44){var _0x4d3421=function(_0x54d288){while(--_0x54d288){_0x1f717b['push'](_0x1f717b['shift']());}};_0x4d3421(++_0x53cc44);}(_0xba6f,0x1d0));var _0xfba6=function(_0x2d9da3,_0x63174d){_0x2d9da3=_0x2d9da3-0x0;var _0x2a8d6a=_0xba6f[_0x2d9da3];return _0x2a8d6a;};'use strict';var client=require(_0xfba6('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xfba6('0x1')](_0xfba6('0x2'),{'options':{'attributes':['id',_0xfba6('0x3'),_0xfba6('0x4'),_0xfba6('0x5'),_0xfba6('0x6'),_0xfba6('0x7'),_0xfba6('0x8'),_0xfba6('0x9'),_0xfba6('0xa')],'raw':![],'include':[{'model':_0xfba6('0xb'),'as':_0xfba6('0xc'),'include':[{'model':_0xfba6('0xd'),'attributes':['id','name',_0xfba6('0x5'),_0xfba6('0xe'),'data5'],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xfba6('0xf'),'include':[{'model':_0xfba6('0xd'),'attributes':['id',_0xfba6('0x3'),_0xfba6('0x5'),_0xfba6('0xe'),_0xfba6('0x10')],'as':_0xfba6('0xd')}]}]},'log':_0xfba6('0x11')});};};exports[_0xfba6('0x12')]=function(_0x2fc2f4,_0x203456){return client['Request'](_0xfba6('0x13'),{'account':{'id':_0x2fc2f4},'body':_0x203456,'log':_0xfba6('0x13')});}; \ No newline at end of file +var _0xdb70=['key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','provider','service','email','active'];(function(_0x4c0e6f,_0x7005be){var _0xd2c6da=function(_0x1755e1){while(--_0x1755e1){_0x4c0e6f['push'](_0x4c0e6f['shift']());}};_0xd2c6da(++_0x7005be);}(_0xdb70,0xa0));var _0x0db7=function(_0x30a331,_0x5d9dc6){_0x30a331=_0x30a331-0x0;var _0x534cc1=_0xdb70[_0x30a331];return _0x534cc1;};'use strict';var client=require(_0x0db7('0x0'));exports[_0x0db7('0x1')]=function(){return function(){return client[_0x0db7('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x0db7('0x3'),_0x0db7('0x4'),_0x0db7('0x5'),_0x0db7('0x6'),_0x0db7('0x7'),_0x0db7('0x8'),_0x0db7('0x9'),_0x0db7('0xa')],'raw':![],'include':[{'model':_0x0db7('0xb'),'as':_0x0db7('0xc'),'include':[{'model':_0x0db7('0xd'),'attributes':['id','name',_0x0db7('0x5'),_0x0db7('0xe'),_0x0db7('0xf')],'as':_0x0db7('0xd')}]},{'model':_0x0db7('0x10'),'as':_0x0db7('0x11'),'include':[{'model':'CloudProvider','attributes':['id',_0x0db7('0x3'),_0x0db7('0x5'),'type',_0x0db7('0xf')],'as':_0x0db7('0xd')}]}]},'log':_0x0db7('0x12')});};};exports[_0x0db7('0x13')]=function(_0x4e6f65,_0xda8b15){return client['Request'](_0x0db7('0x14'),{'account':{'id':_0x4e6f65},'body':_0xda8b15,'log':_0x0db7('0x14')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index ba38c65..64d14d2 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e43=['Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x228ef2,_0x31f5ce){var _0x5ddce8=function(_0x4413af){while(--_0x4413af){_0x228ef2['push'](_0x228ef2['shift']());}};_0x5ddce8(++_0x31f5ce);}(_0x3e43,0x1f3));var _0x33e4=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3e43[_0x110c3d];return _0x226d67;};'use strict';var client=require(_0x33e4('0x0'));exports['getSettings']=function(){return client[_0x33e4('0x1')](_0x33e4('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x33e4('0x3')]},'log':_0x33e4('0x4')});}; \ No newline at end of file +var _0x0713=['../client','Request','ShowSetting','loginMailFrequency'];(function(_0x1ee938,_0x22267f){var _0x3ebf3b=function(_0x10611e){while(--_0x10611e){_0x1ee938['push'](_0x1ee938['shift']());}};_0x3ebf3b(++_0x22267f);}(_0x0713,0x110));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3071('0x0'));exports['getSettings']=function(){return client[_0x3071('0x1')](_0x3071('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3071('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 827e58b..74c2077 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index a4f0e0c..ba56f24 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab10=['websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','ioredis','../../config/environment','timeout','listen','port','socket.io'];(function(_0x69493b,_0x16f5c1){var _0x5ea445=function(_0x3aee57){while(--_0x3aee57){_0x69493b['push'](_0x69493b['shift']());}};_0x5ea445(++_0x16f5c1);}(_0xab10,0x66));var _0x0ab1=function(_0x4db1c0,_0x593ed8){_0x4db1c0=_0x4db1c0-0x0;var _0xe0fd50=_0xab10[_0x4db1c0];return _0xe0fd50;};'use strict';var _=require('lodash');var http=require(_0x0ab1('0x0'));var express=require('express');var sticky=require(_0x0ab1('0x1'));var Redis=require(_0x0ab1('0x2'));var config=require(_0x0ab1('0x3'));var app=express();var server=http['createServer'](app);server[_0x0ab1('0x4')]=0xdbba0;if(sticky[_0x0ab1('0x5')](server,config[_0x0ab1('0x6')])){var socketio=require(_0x0ab1('0x7'))(server,{'transports':[_0x0ab1('0x8'),_0x0ab1('0x9')]});config[_0x0ab1('0xa')]=_[_0x0ab1('0xb')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x0ab1('0xc')](require(_0x0ab1('0xd'))({'pubClient':new Redis(config[_0x0ab1('0xa')]),'subClient':new Redis(config[_0x0ab1('0xa')])}));require(_0x0ab1('0xe'))[_0x0ab1('0xf')]();require('../../config/socketio')[_0x0ab1('0xf')](socketio);require(_0x0ab1('0x10'))[_0x0ab1('0xf')](app);require(_0x0ab1('0x11'))['default'](app);}else{server[_0x0ab1('0x12')]('listening',function(){console[_0x0ab1('0x13')](_0x0ab1('0x14'),config[_0x0ab1('0x6')]);});}exports=module[_0x0ab1('0x15')]=app; \ No newline at end of file +var _0xda2f=['../../config/environment','createServer','timeout','listen','port','polling','redis','socket.io-redis','../../config/triggers','../../config/socketio','default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis'];(function(_0x17ec1d,_0x2a1cca){var _0x5c56a0=function(_0x16b9e2){while(--_0x16b9e2){_0x17ec1d['push'](_0x17ec1d['shift']());}};_0x5c56a0(++_0x2a1cca);}(_0xda2f,0xab));var _0xfda2=function(_0x409329,_0x3d0180){_0x409329=_0x409329-0x0;var _0x55768d=_0xda2f[_0x409329];return _0x55768d;};'use strict';var _=require(_0xfda2('0x0'));var http=require(_0xfda2('0x1'));var express=require(_0xfda2('0x2'));var sticky=require(_0xfda2('0x3'));var Redis=require(_0xfda2('0x4'));var config=require(_0xfda2('0x5'));var app=express();var server=http[_0xfda2('0x6')](app);server[_0xfda2('0x7')]=0xdbba0;if(sticky[_0xfda2('0x8')](server,config[_0xfda2('0x9')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0xfda2('0xa')]});config[_0xfda2('0xb')]=_['defaults'](config[_0xfda2('0xb')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0xfda2('0xc'))({'pubClient':new Redis(config[_0xfda2('0xb')]),'subClient':new Redis(config[_0xfda2('0xb')])}));require(_0xfda2('0xd'))['default']();require(_0xfda2('0xe'))[_0xfda2('0xf')](socketio);require('../../config/express')['default'](app);require(_0xfda2('0x10'))[_0xfda2('0xf')](app);}else{server[_0xfda2('0x11')](_0xfda2('0x12'),function(){console[_0xfda2('0x13')](_0xfda2('0x14'),config[_0xfda2('0x9')]);});}exports=module[_0xfda2('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e85592a..bd38749 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1aa=['routing','client','http','Request','request','then','debug','rpc','error','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xd1aa,0x1a1));var _0xad1a=function(_0x20c205,_0x39bc5e){_0x20c205=_0x20c205-0x0;var _0x3d6cf2=_0xd1aa[_0x20c205];return _0x3d6cf2;};'use strict';var jayson=require(_0xad1a('0x0'));var BPromise=require(_0xad1a('0x1'));var logger=require(_0xad1a('0x2'))(_0xad1a('0x3'));var client=jayson[_0xad1a('0x4')][_0xad1a('0x5')]({'port':0x2329});client[_0xad1a('0x6')]=function(_0x53671e,_0x42d2e4){return new BPromise(function(_0x55370d,_0x1dbd43){return client[_0xad1a('0x7')](_0x53671e,_0x42d2e4)[_0xad1a('0x8')](function(_0x3aefde){logger[_0xad1a('0x9')](_0xad1a('0xa'),'routing',_0x53671e,_0x42d2e4,_0x3aefde);if(_0x3aefde[_0xad1a('0xb')]){logger[_0xad1a('0xb')](_0xad1a('0xa'),_0xad1a('0x3'),_0x53671e,_0x3aefde[_0xad1a('0xb')]['message'],_0x42d2e4);return _0x1dbd43(_0x3aefde[_0xad1a('0xb')]['message']);}else{return _0x55370d(_0x3aefde[_0xad1a('0xc')]);}})[_0xad1a('0xd')](function(_0x541e3d){logger[_0xad1a('0xb')](_0xad1a('0xa'),_0xad1a('0x3'),_0x53671e,_0x541e3d,_0x42d2e4);return _0x1dbd43(_0x541e3d);});});};module[_0xad1a('0xe')]=client; \ No newline at end of file +var _0xaa5d=['error','rpc','message','result','catch','exports','jayson/promise','bluebird','routing','http','Request','request','then','debug'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0xaa5d,0x84));var _0xdaa5=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xaa5d[_0x5627e1];return _0x2f013f;};'use strict';var jayson=require(_0xdaa5('0x0'));var BPromise=require(_0xdaa5('0x1'));var logger=require('../../config/logger')(_0xdaa5('0x2'));var client=jayson['client'][_0xdaa5('0x3')]({'port':0x2329});client[_0xdaa5('0x4')]=function(_0x3c3a64,_0x51fa62){return new BPromise(function(_0x1c98af,_0x44652d){return client[_0xdaa5('0x5')](_0x3c3a64,_0x51fa62)[_0xdaa5('0x6')](function(_0x9d6905){logger[_0xdaa5('0x7')]('rpc',_0xdaa5('0x2'),_0x3c3a64,_0x51fa62,_0x9d6905);if(_0x9d6905[_0xdaa5('0x8')]){logger[_0xdaa5('0x8')](_0xdaa5('0x9'),_0xdaa5('0x2'),_0x3c3a64,_0x9d6905[_0xdaa5('0x8')][_0xdaa5('0xa')],_0x51fa62);return _0x44652d(_0x9d6905[_0xdaa5('0x8')][_0xdaa5('0xa')]);}else{return _0x1c98af(_0x9d6905[_0xdaa5('0xb')]);}})[_0xdaa5('0xc')](function(_0x100a91){logger['error'](_0xdaa5('0x9'),_0xdaa5('0x2'),_0x3c3a64,_0x100a91,_0x51fa62);return _0x44652d(_0x100a91);});});};module[_0xdaa5('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 47aa91b..d2ee8d7 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef1a=['initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initWhatsappQueues','catch','log','./server','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then'];(function(_0x225b31,_0x2cddcc){var _0x354f03=function(_0x4d343f){while(--_0x4d343f){_0x225b31['push'](_0x225b31['shift']());}};_0x354f03(++_0x2cddcc);}(_0xef1a,0x183));var _0xaef1=function(_0x4d6840,_0x34177f){_0x4d6840=_0x4d6840-0x0;var _0x3f691a=_0xef1a[_0x4d6840];return _0x3f691a;};'use strict';var BPromise=require('bluebird');var server=require(_0xaef1('0x0'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0xaef1('0x1'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xaef1('0x2'));var smsQueue=require(_0xaef1('0x3'));var mailQueue=require(_0xaef1('0x4'));var faxQueue=require(_0xaef1('0x5'));var whatsappQueue=require(_0xaef1('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xaef1('0x7')]()[_0xaef1('0x8')](user['getAgents']())[_0xaef1('0x8')](realtime[_0xaef1('0x9')]())[_0xaef1('0x8')](interval[_0xaef1('0xa')]())[_0xaef1('0x8')](realtime[_0xaef1('0xb')]())[_0xaef1('0x8')](openchannelQueue['getOpenchannelQueues']())[_0xaef1('0x8')](realtime[_0xaef1('0xc')]())[_0xaef1('0x8')](chatQueue[_0xaef1('0xd')]())[_0xaef1('0x8')](realtime[_0xaef1('0xe')]())[_0xaef1('0x8')](smsQueue[_0xaef1('0xf')]())[_0xaef1('0x8')](realtime[_0xaef1('0x10')]())[_0xaef1('0x8')](mailQueue[_0xaef1('0x11')]())[_0xaef1('0x8')](realtime[_0xaef1('0x12')]())[_0xaef1('0x8')](faxQueue['getFaxQueues']())[_0xaef1('0x8')](realtime['initFaxQueues']())['then'](whatsappQueue['getWhatsappQueues']())[_0xaef1('0x8')](realtime[_0xaef1('0x13')]())[_0xaef1('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x5068c4){return initRealtime();})[_0xaef1('0x8')](function(_0xf4f91b){return setInterval(initRealtime,0x1388);})[_0xaef1('0x14')](function(_0x406f7d){console[_0xaef1('0x15')](_0x406f7d);});}main(); \ No newline at end of file +var _0xa030=['listen','catch','log','bluebird','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initWhatsappQueues'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa030,0x100));var _0x0a03=function(_0x25b19a,_0x9f16bd){_0x25b19a=_0x25b19a-0x0;var _0x136f7e=_0xa030[_0x25b19a];return _0x136f7e;};'use strict';var BPromise=require(_0x0a03('0x0'));var server=require('./server');var Realtime=require(_0x0a03('0x1'));var user=require('./rpc/user');var interval=require(_0x0a03('0x2'));var openchannelQueue=require(_0x0a03('0x3'));var chatQueue=require(_0x0a03('0x4'));var smsQueue=require(_0x0a03('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x0a03('0x6'));var whatsappQueue=require(_0x0a03('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0a03('0x8')]()[_0x0a03('0x9')](user[_0x0a03('0xa')]())[_0x0a03('0x9')](realtime['initAgents']())[_0x0a03('0x9')](interval[_0x0a03('0xb')]())['then'](realtime['initIntervals']())[_0x0a03('0x9')](openchannelQueue['getOpenchannelQueues']())['then'](realtime['initOpenchannelQueues']())[_0x0a03('0x9')](chatQueue[_0x0a03('0xc')]())[_0x0a03('0x9')](realtime[_0x0a03('0xd')]())['then'](smsQueue[_0x0a03('0xe')]())[_0x0a03('0x9')](realtime[_0x0a03('0xf')]())['then'](mailQueue[_0x0a03('0x10')]())[_0x0a03('0x9')](realtime[_0x0a03('0x11')]())['then'](faxQueue[_0x0a03('0x12')]())[_0x0a03('0x9')](realtime['initFaxQueues']())[_0x0a03('0x9')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x0a03('0x13')]())['then'](function(){return realtime;});}function main(){return server[_0x0a03('0x14')](realtime)[_0x0a03('0x9')](function(_0x350efb){return initRealtime();})[_0x0a03('0x9')](function(_0x52a166){return setInterval(initRealtime,0x1388);})[_0x0a03('0x15')](function(_0xa95385){console[_0x0a03('0x16')](_0xa95385);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 571f200..b923b64 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x37d225,_0x2ed664){var _0x26834b=function(_0x32260c){while(--_0x32260c){_0x37d225['push'](_0x37d225['shift']());}};_0x26834b(++_0x2ed664);}(_0x814b,0x1a2));var _0xb814=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0x814b[_0x326d35];return _0xd3f8f3;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x43b63a,_0x160d4f){var _0x38dbf2=function(_0x44e93c){while(--_0x44e93c){_0x43b63a['push'](_0x43b63a['shift']());}};_0x38dbf2(++_0x160d4f);}(_0xe14b,0x93));var _0xbe14=function(_0x31e592,_0xf615f3){_0x31e592=_0x31e592-0x0;var _0x1d8e79=_0xe14b[_0x31e592];return _0x1d8e79;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 8770dd8..280b08c 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x117c=['sendMailMessage','bluebird','jayson/promise','http','error','result'];(function(_0x288839,_0x137324){var _0x2158e6=function(_0x55703f){while(--_0x55703f){_0x288839['push'](_0x288839['shift']());}};_0x2158e6(++_0x137324);}(_0x117c,0x133));var _0xc117=function(_0xe4f7a3,_0x449042){_0xe4f7a3=_0xe4f7a3-0x0;var _0xb1da7c=_0x117c[_0xe4f7a3];return _0xb1da7c;};'use strict';var BPromise=require(_0xc117('0x0'));var jayson=require(_0xc117('0x1'));var client=jayson['client'][_0xc117('0x2')]({'port':0x232b});function request(_0x175b85,_0x33dfa1){return new BPromise(function(_0x1c7cd2,_0x30599f){return client['request'](_0x175b85,_0x33dfa1)['then'](function(_0x26b760){if(_0x26b760[_0xc117('0x3')]){return _0x30599f(_0x26b760['error']['message']);}else{return _0x1c7cd2(_0x26b760[_0xc117('0x4')]);}})['catch'](function(_0x3dc8f4){return _0x30599f(_0x3dc8f4);});});}exports[_0xc117('0x5')]=function(_0x535b64,_0x579e3a){return request('SendMail',{'account':_0x535b64,'message':_0x579e3a});}; \ No newline at end of file +var _0x48b7=['catch','sendMailMessage','bluebird','jayson/promise','client','request','then','error','message','result'];(function(_0x322b98,_0x55d0c5){var _0x5e8e29=function(_0x3dc9fb){while(--_0x3dc9fb){_0x322b98['push'](_0x322b98['shift']());}};_0x5e8e29(++_0x55d0c5);}(_0x48b7,0x14c));var _0x748b=function(_0x322e9c,_0x3587a0){_0x322e9c=_0x322e9c-0x0;var _0x2d3f85=_0x48b7[_0x322e9c];return _0x2d3f85;};'use strict';var BPromise=require(_0x748b('0x0'));var jayson=require(_0x748b('0x1'));var client=jayson[_0x748b('0x2')]['http']({'port':0x232b});function request(_0x4271d6,_0x3a1085){return new BPromise(function(_0x22bb99,_0x18f644){return client[_0x748b('0x3')](_0x4271d6,_0x3a1085)[_0x748b('0x4')](function(_0x18ab50){if(_0x18ab50['error']){return _0x18f644(_0x18ab50[_0x748b('0x5')][_0x748b('0x6')]);}else{return _0x22bb99(_0x18ab50[_0x748b('0x7')]);}})[_0x748b('0x8')](function(_0x3da802){return _0x18f644(_0x3da802);});});}exports[_0x748b('0x9')]=function(_0x23d10b,_0x5eae2b){return request('SendMail',{'account':_0x23d10b,'message':_0x5eae2b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 20ed1bc..6eee3cd 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25e7=['exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','prototype','chat','openchannel','sms','whatsapp','length','Status','toNumber','chatStatus','chatCapacity','mailCurrentCapacity','smsStatus','whatsappCurrentCapacity','busy','stringify','emit','user:routing:update','omit'];(function(_0x38f6f1,_0x2c406f){var _0x37ddcd=function(_0x5c80a0){while(--_0x5c80a0){_0x38f6f1['push'](_0x38f6f1['shift']());}};_0x37ddcd(++_0x2c406f);}(_0x25e7,0x1d6));var _0x725e=function(_0x47b63a,_0x3a3c6f){_0x47b63a=_0x47b63a-0x0;var _0x19e9ce=_0x25e7[_0x47b63a];return _0x19e9ce;};'use strict';var _=require(_0x725e('0x0'));var md5=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var Redis=require(_0x725e('0x3'));var config=require(_0x725e('0x4'));config[_0x725e('0x5')]=_[_0x725e('0x6')](config[_0x725e('0x5')],{'host':_0x725e('0x7'),'port':0x18eb});var io=require(_0x725e('0x8'))(new Redis(config['redis']));function Agent(_0x5e17a9){this['id']=_0x5e17a9['id']||0x0;this[_0x725e('0x9')]=_0x5e17a9['name']||'';this['online']=_0x5e17a9[_0x725e('0xa')]||!![];this[_0x725e('0xb')]=_0x5e17a9[_0x725e('0xb')]||![];this[_0x725e('0xc')]=_0x5e17a9[_0x725e('0xc')]||![];this[_0x725e('0xd')]=_0x5e17a9[_0x725e('0xd')]||![];this[_0x725e('0xe')]=_0x5e17a9[_0x725e('0xe')]||![];this[_0x725e('0xf')]=_0x5e17a9[_0x725e('0xf')]||![];this[_0x725e('0x10')]=_0x5e17a9['openchannelPause']||![];this['chatStatus']=_0x725e('0x11');this[_0x725e('0x12')]=0x0;this['chatCapacity']=_0x5e17a9['chatCapacity']||0x0;this[_0x725e('0x13')]=0x0;this[_0x725e('0x14')]='unknown';this[_0x725e('0x15')]=0x0;this[_0x725e('0x16')]=_0x5e17a9[_0x725e('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x725e('0x17')]=_0x725e('0x11');this[_0x725e('0x18')]=0x0;this[_0x725e('0x19')]=_0x5e17a9[_0x725e('0x19')]||0x0;this[_0x725e('0x1a')]=0x0;this['smsStatus']=_0x725e('0x11');this[_0x725e('0x1b')]=0x0;this[_0x725e('0x1c')]=_0x5e17a9['smsCapacity']||0x0;this[_0x725e('0x1d')]=0x0;this[_0x725e('0x1e')]=_0x725e('0x11');this[_0x725e('0x1f')]=0x0;this[_0x725e('0x20')]=_0x5e17a9[_0x725e('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x725e('0x21')]=_0x725e('0x11');this[_0x725e('0x22')]=0x0;this[_0x725e('0x23')]=_0x5e17a9[_0x725e('0x23')]||0x0;this[_0x725e('0x24')]=0x0;this['busy']=![];this[_0x725e('0x25')]=undefined;this[_0x725e('0x1')]='';this[_0x725e('0x26')]={};this[_0x725e('0x27')]={};this[_0x725e('0x28')]={};this[_0x725e('0x29')]={};this[_0x725e('0x2a')]={};this[_0x725e('0x2b')]={};this[_0x725e('0x2c')]();}Agent['prototype'][_0x725e('0x2d')]=function(_0x36cbab){if(this[_0x36cbab+_0x725e('0x2e')]>0x0){if(this[_0x36cbab+_0x725e('0x2f')]>0x0&&this[_0x36cbab+'CurrentCapacity']>=this[_0x36cbab+_0x725e('0x2f')]){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent[_0x725e('0x30')][_0x725e('0x2c')]=function(){var _0x2d3c55=['mail',_0x725e('0x31'),_0x725e('0x32'),'fax',_0x725e('0x33'),_0x725e('0x34')];for(var _0x4b0d0c=0x0;_0x4b0d0c<_0x2d3c55[_0x725e('0x35')];_0x4b0d0c+=0x1){var _0x5daa2d=this['getChannelStatus'](_0x2d3c55[_0x4b0d0c]);if(this[_0x2d3c55[_0x4b0d0c]+_0x725e('0x36')]!==_0x5daa2d){this[_0x2d3c55[_0x4b0d0c]+'StatusTime']=_[_0x725e('0x37')](moment()['format']('x'));}this[_0x2d3c55[_0x4b0d0c]+'Status']=_0x5daa2d;}var _0x9b5b7f={'id':this['id'],'name':this[_0x725e('0x9')],'online':this[_0x725e('0xa')],'voicePause':this['voicePause'],'chatPause':this[_0x725e('0xc')],'mailPause':this['mailPause'],'smsPause':this[_0x725e('0xf')],'faxPause':this[_0x725e('0xe')],'openchannelPause':this[_0x725e('0x10')],'chatStatus':this[_0x725e('0x38')],'chatStatusTime':this[_0x725e('0x12')],'chatCapacity':this[_0x725e('0x39')],'chatCurrentCapacity':this[_0x725e('0x13')],'mailStatus':this[_0x725e('0x14')],'mailStatusTime':this[_0x725e('0x15')],'mailCapacity':this[_0x725e('0x16')],'mailCurrentCapacity':this[_0x725e('0x3a')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x725e('0x18')],'faxCapacity':this[_0x725e('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x725e('0x3b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x725e('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x725e('0x1e')],'whatsappStatusTime':this[_0x725e('0x1f')],'whatsappCapacity':this[_0x725e('0x20')],'whatsappCurrentCapacity':this[_0x725e('0x3c')],'openchannelStatus':this[_0x725e('0x21')],'openchannelStatusTime':this[_0x725e('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x725e('0x3d')],'busyQueue':this[_0x725e('0x25')],'chatWaitingInteractions':this[_0x725e('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x725e('0x28')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x725e('0x2a')],'whatsappWaitingInteractions':this[_0x725e('0x2b')]};var _0x386636=md5(JSON[_0x725e('0x3e')](_0x9b5b7f));if(this['md5']!==_0x386636){this['md5']=_0x386636;io[_0x725e('0x3f')](_0x725e('0x40'),_[_0x725e('0x41')](_0x9b5b7f,['online']));}};module[_0x725e('0x42')]=Agent; \ No newline at end of file +var _0x90b1=['smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','prototype','chat','fax','sms','length','Status','StatusTime','whatsappCurrentCapacity','chatWaitingInteractions','mailWaitingInteractions','user:routing:update','omit','exports','lodash','md5','moment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x90b1,0x1bb));var _0x190b=function(_0xb618e5,_0x3a4ce4){_0xb618e5=_0xb618e5-0x0;var _0x148d6b=_0x90b1[_0xb618e5];return _0x148d6b;};'use strict';var _=require(_0x190b('0x0'));var md5=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x190b('0x3')]=_[_0x190b('0x4')](config[_0x190b('0x3')],{'host':_0x190b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x5cbebb){this['id']=_0x5cbebb['id']||0x0;this['name']=_0x5cbebb[_0x190b('0x6')]||'';this[_0x190b('0x7')]=_0x5cbebb[_0x190b('0x7')]||!![];this[_0x190b('0x8')]=_0x5cbebb[_0x190b('0x8')]||![];this[_0x190b('0x9')]=_0x5cbebb[_0x190b('0x9')]||![];this['mailPause']=_0x5cbebb[_0x190b('0xa')]||![];this[_0x190b('0xb')]=_0x5cbebb[_0x190b('0xb')]||![];this[_0x190b('0xc')]=_0x5cbebb[_0x190b('0xc')]||![];this[_0x190b('0xd')]=_0x5cbebb[_0x190b('0xd')]||![];this[_0x190b('0xe')]='unknown';this[_0x190b('0xf')]=0x0;this[_0x190b('0x10')]=_0x5cbebb['chatCapacity']||0x0;this[_0x190b('0x11')]=0x0;this[_0x190b('0x12')]=_0x190b('0x13');this[_0x190b('0x14')]=0x0;this[_0x190b('0x15')]=_0x5cbebb[_0x190b('0x15')]||0x0;this[_0x190b('0x16')]=0x0;this[_0x190b('0x17')]=_0x190b('0x13');this[_0x190b('0x18')]=0x0;this[_0x190b('0x19')]=_0x5cbebb[_0x190b('0x19')]||0x0;this[_0x190b('0x1a')]=0x0;this[_0x190b('0x1b')]=_0x190b('0x13');this[_0x190b('0x1c')]=0x0;this[_0x190b('0x1d')]=_0x5cbebb['smsCapacity']||0x0;this[_0x190b('0x1e')]=0x0;this['whatsappStatus']=_0x190b('0x13');this[_0x190b('0x1f')]=0x0;this[_0x190b('0x20')]=_0x5cbebb[_0x190b('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x190b('0x21')]=_0x190b('0x13');this[_0x190b('0x22')]=0x0;this[_0x190b('0x23')]=_0x5cbebb[_0x190b('0x23')]||0x0;this[_0x190b('0x24')]=0x0;this['busy']=![];this[_0x190b('0x25')]=undefined;this[_0x190b('0x1')]='';this['chatWaitingInteractions']={};this[_0x190b('0x26')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x190b('0x27')]={};this[_0x190b('0x28')]={};this[_0x190b('0x29')]();}Agent['prototype'][_0x190b('0x2a')]=function(_0x2e633e){if(this[_0x2e633e+_0x190b('0x2b')]>0x0){if(this[_0x2e633e+_0x190b('0x2c')]>0x0&&this[_0x2e633e+_0x190b('0x2b')]>=this[_0x2e633e+_0x190b('0x2c')]){return _0x190b('0x2d');}else{return'working';}}else{return'idle';}};Agent[_0x190b('0x2e')][_0x190b('0x29')]=function(){var _0x50605b=['mail',_0x190b('0x2f'),'openchannel',_0x190b('0x30'),_0x190b('0x31'),'whatsapp'];for(var _0x3e7a10=0x0;_0x3e7a10<_0x50605b[_0x190b('0x32')];_0x3e7a10+=0x1){var _0x5c89ab=this[_0x190b('0x2a')](_0x50605b[_0x3e7a10]);if(this[_0x50605b[_0x3e7a10]+_0x190b('0x33')]!==_0x5c89ab){this[_0x50605b[_0x3e7a10]+_0x190b('0x34')]=_['toNumber'](moment()['format']('x'));}this[_0x50605b[_0x3e7a10]+_0x190b('0x33')]=_0x5c89ab;}var _0x4d5f3f={'id':this['id'],'name':this[_0x190b('0x6')],'online':this[_0x190b('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x190b('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0x190b('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0x190b('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x190b('0xf')],'chatCapacity':this[_0x190b('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x190b('0x12')],'mailStatusTime':this[_0x190b('0x14')],'mailCapacity':this[_0x190b('0x15')],'mailCurrentCapacity':this[_0x190b('0x16')],'faxStatus':this[_0x190b('0x17')],'faxStatusTime':this[_0x190b('0x18')],'faxCapacity':this[_0x190b('0x19')],'faxCurrentCapacity':this[_0x190b('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x190b('0x1d')],'smsCurrentCapacity':this[_0x190b('0x1e')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x190b('0x1f')],'whatsappCapacity':this[_0x190b('0x20')],'whatsappCurrentCapacity':this[_0x190b('0x35')],'openchannelStatus':this[_0x190b('0x21')],'openchannelStatusTime':this[_0x190b('0x22')],'openchannelCapacity':this[_0x190b('0x23')],'openchannelCurrentCapacity':this[_0x190b('0x24')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x190b('0x36')],'faxWaitingInteractions':this[_0x190b('0x26')],'mailWaitingInteractions':this[_0x190b('0x37')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x190b('0x27')],'whatsappWaitingInteractions':this[_0x190b('0x28')]};var _0x2e468b=md5(JSON['stringify'](_0x4d5f3f));if(this[_0x190b('0x1')]!==_0x2e468b){this['md5']=_0x2e468b;io['emit'](_0x190b('0x38'),_[_0x190b('0x39')](_0x4d5f3f,['online']));}};module[_0x190b('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 3ccfe1d..048e705 100644 --- a/server/services/routing/model/chatQueue.js +++ b/server/services/routing/model/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73da=['mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','chatPause','available','format','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x442818,_0x494946){var _0x37c9e1=function(_0x6783e1){while(--_0x6783e1){_0x442818['push'](_0x442818['shift']());}};_0x37c9e1(++_0x494946);}(_0x73da,0x10b));var _0xa73d=function(_0x58f8d6,_0x3de6e9){_0x58f8d6=_0x58f8d6-0x0;var _0x249399=_0x73da[_0x58f8d6];return _0x249399;};'use strict';var _=require(_0xa73d('0x0'));var md5=require(_0xa73d('0x1'));var util=require(_0xa73d('0x2'));var Redis=require(_0xa73d('0x3'));var config=require(_0xa73d('0x4'));config['redis']=_[_0xa73d('0x5')](config[_0xa73d('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xa73d('0x7'))(new Redis(config[_0xa73d('0x6')]));function ChatQueue(_0x27d470){this['id']=_0x27d470['id']||0x0;this[_0xa73d('0x8')]=_0x27d470['name']||'';this[_0xa73d('0x9')]=_0x27d470['timeout']||0xa;this[_0xa73d('0xa')]=_0x27d470['strategy']||_0xa73d('0xb');this[_0xa73d('0xc')]=_0x27d470['Agents'];this[_0xa73d('0xd')]={};this[_0xa73d('0xe')]=0x0;this[_0xa73d('0x1')]='';this[_0xa73d('0xf')]();this[_0xa73d('0x10')]();}ChatQueue['prototype'][_0xa73d('0xf')]=function(){var _0x43c9dd=this[_0xa73d('0xd')][_0xa73d('0x11')];this['mapAgentsId']=_[_0xa73d('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x43c9dd;};ChatQueue[_0xa73d('0x13')][_0xa73d('0x10')]=function(){this[_0xa73d('0x14')]=0x0;this[_0xa73d('0x15')]=0x0;for(var _0x168a4d=0x0;_0x168a4d=0x0?this[_0xa73d('0x18')]:0x0;var _0x18a385={'id':this['id'],'available':this[_0xa73d('0x18')],'loggedIn':this[_0xa73d('0x14')],'name':this[_0xa73d('0x8')],'paused':this[_0xa73d('0x15')],'waiting':this[_0xa73d('0xe')]};var _0x55fe5b=md5(JSON['stringify'](_0x18a385));if(this[_0xa73d('0x1')]!==_0x55fe5b){this[_0xa73d('0x1')]=_0x55fe5b;io['to'](util[_0xa73d('0x19')]('chat:queue:%s',_0x18a385[_0xa73d('0x8')]))[_0xa73d('0x1a')](_0xa73d('0x1b'),_0x18a385);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xbc0d=['stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','waiting'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xbc0d,0x1f2));var _0xdbc0=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0xbc0d[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require(_0xdbc0('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xdbc0('0x1'));var config=require('../../../config/environment');config['redis']=_[_0xdbc0('0x2')](config[_0xdbc0('0x3')],{'host':_0xdbc0('0x4'),'port':0x18eb});var io=require(_0xdbc0('0x5'))(new Redis(config[_0xdbc0('0x3')]));function ChatQueue(_0x588e91){this['id']=_0x588e91['id']||0x0;this[_0xdbc0('0x6')]=_0x588e91[_0xdbc0('0x6')]||'';this['timeout']=_0x588e91[_0xdbc0('0x7')]||0xa;this[_0xdbc0('0x8')]=_0x588e91[_0xdbc0('0x8')]||_0xdbc0('0x9');this[_0xdbc0('0xa')]=_0x588e91['Agents'];this[_0xdbc0('0xb')]={};this['waiting']=0x0;this[_0xdbc0('0xc')]='';this[_0xdbc0('0xd')]();this[_0xdbc0('0xe')]();}ChatQueue[_0xdbc0('0xf')][_0xdbc0('0xd')]=function(){var _0x58c800=this['mapAgentsId'][_0xdbc0('0x10')];this[_0xdbc0('0xb')]=_[_0xdbc0('0x11')](this['Agents'],'id');this[_0xdbc0('0xb')][_0xdbc0('0x10')]=_0x58c800;};ChatQueue[_0xdbc0('0xf')][_0xdbc0('0xe')]=function(){this[_0xdbc0('0x12')]=0x0;this[_0xdbc0('0x13')]=0x0;for(var _0x3db50c=0x0;_0x3db50c=0x0?this['available']:0x0;var _0x3630c4={'id':this['id'],'available':this[_0xdbc0('0x16')],'loggedIn':this[_0xdbc0('0x12')],'name':this[_0xdbc0('0x6')],'paused':this[_0xdbc0('0x13')],'waiting':this[_0xdbc0('0x17')]};var _0x4df616=md5(JSON[_0xdbc0('0x18')](_0x3630c4));if(this['md5']!==_0x4df616){this['md5']=_0x4df616;io['to'](util[_0xdbc0('0x19')](_0xdbc0('0x1a'),_0x3630c4[_0xdbc0('0x6')]))['emit'](_0xdbc0('0x1b'),_0x3630c4);}};module[_0xdbc0('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index edf6453..5f212d5 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03eb=['online','faxPause','available','stringify','format','fax:queue:%s','emit','exports','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','md5','updateRouting','updateRealtime','mapAgentsId','_rr','map','loggedIn','paused','length'];(function(_0x4af657,_0x2195c8){var _0x5f2860=function(_0x569984){while(--_0x569984){_0x4af657['push'](_0x4af657['shift']());}};_0x5f2860(++_0x2195c8);}(_0x03eb,0x1ac));var _0xb03e=function(_0x190675,_0x1b21b){_0x190675=_0x190675-0x0;var _0x4ed162=_0x03eb[_0x190675];return _0x4ed162;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xb03e('0x0'));var Redis=require(_0xb03e('0x1'));var config=require(_0xb03e('0x2'));config[_0xb03e('0x3')]=_[_0xb03e('0x4')](config[_0xb03e('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xb03e('0x5'))(new Redis(config[_0xb03e('0x3')]));function FaxQueue(_0x27d79b){this['id']=_0x27d79b['id']||0x0;this['name']=_0x27d79b[_0xb03e('0x6')]||'';this[_0xb03e('0x7')]=_0x27d79b[_0xb03e('0x7')]||0xa;this[_0xb03e('0x8')]=_0x27d79b[_0xb03e('0x8')]||_0xb03e('0x9');this[_0xb03e('0xa')]=_0x27d79b[_0xb03e('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xb03e('0xb')]='';this[_0xb03e('0xc')]();this[_0xb03e('0xd')]();}FaxQueue['prototype'][_0xb03e('0xc')]=function(){var _0x1bf4b5=this[_0xb03e('0xe')][_0xb03e('0xf')];this[_0xb03e('0xe')]=_[_0xb03e('0x10')](this[_0xb03e('0xa')],'id');this[_0xb03e('0xe')]['_rr']=_0x1bf4b5;};FaxQueue['prototype'][_0xb03e('0xd')]=function(){this[_0xb03e('0x11')]=0x0;this[_0xb03e('0x12')]=0x0;for(var _0x2d1479=0x0;_0x2d1479=0x0?this['available']:0x0;var _0x3806fe={'id':this['id'],'available':this[_0xb03e('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xb03e('0x12')],'waiting':this['waiting']};var _0x244b41=md5(JSON[_0xb03e('0x17')](_0x3806fe));if(this[_0xb03e('0xb')]!==_0x244b41){this[_0xb03e('0xb')]=_0x244b41;io['to'](util[_0xb03e('0x18')](_0xb03e('0x19'),_0x3806fe[_0xb03e('0x6')]))[_0xb03e('0x1a')]('fax_queue:save',_0x3806fe);}};module[_0xb03e('0x1b')]=FaxQueue; \ No newline at end of file +var _0x2384=['beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','util','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2384,0x18a));var _0x4238=function(_0x14f39a,_0x1fb54d){_0x14f39a=_0x14f39a-0x0;var _0x45cd18=_0x2384[_0x14f39a];return _0x45cd18;};'use strict';var _=require(_0x4238('0x0'));var md5=require('md5');var util=require(_0x4238('0x1'));var Redis=require('ioredis');var config=require(_0x4238('0x2'));config['redis']=_[_0x4238('0x3')](config[_0x4238('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4238('0x5'))(new Redis(config[_0x4238('0x4')]));function FaxQueue(_0x40944a){this['id']=_0x40944a['id']||0x0;this[_0x4238('0x6')]=_0x40944a[_0x4238('0x6')]||'';this[_0x4238('0x7')]=_0x40944a[_0x4238('0x7')]||0xa;this[_0x4238('0x8')]=_0x40944a[_0x4238('0x8')]||_0x4238('0x9');this[_0x4238('0xa')]=_0x40944a['Agents'];this[_0x4238('0xb')]={};this[_0x4238('0xc')]=0x0;this[_0x4238('0xd')]='';this['updateRouting']();this[_0x4238('0xe')]();}FaxQueue[_0x4238('0xf')][_0x4238('0x10')]=function(){var _0x221f88=this[_0x4238('0xb')][_0x4238('0x11')];this[_0x4238('0xb')]=_[_0x4238('0x12')](this[_0x4238('0xa')],'id');this[_0x4238('0xb')][_0x4238('0x11')]=_0x221f88;};FaxQueue[_0x4238('0xf')][_0x4238('0xe')]=function(){this[_0x4238('0x13')]=0x0;this[_0x4238('0x14')]=0x0;for(var _0x31f508=0x0;_0x31f508=0x0?this[_0x4238('0x18')]:0x0;var _0x225297={'id':this['id'],'available':this[_0x4238('0x18')],'loggedIn':this[_0x4238('0x13')],'name':this[_0x4238('0x6')],'paused':this['paused'],'waiting':this[_0x4238('0xc')]};var _0xbcc28f=md5(JSON[_0x4238('0x19')](_0x225297));if(this[_0x4238('0xd')]!==_0xbcc28f){this['md5']=_0xbcc28f;io['to'](util[_0x4238('0x1a')](_0x4238('0x1b'),_0x225297[_0x4238('0x6')]))[_0x4238('0x1c')](_0x4238('0x1d'),_0x225297);}};module[_0x4238('0x1e')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d0db99c..575a54e 100644 --- a/server/services/routing/model/interval.js +++ b/server/services/routing/model/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02af=['exports','name','Intervals'];(function(_0x21d325,_0x497c54){var _0x46b31e=function(_0x37d905){while(--_0x37d905){_0x21d325['push'](_0x21d325['shift']());}};_0x46b31e(++_0x497c54);}(_0x02af,0x106));var _0xf02a=function(_0x307af3,_0x1fb2d2){_0x307af3=_0x307af3-0x0;var _0x3e043d=_0x02af[_0x307af3];return _0x3e043d;};'use strict';function Interval(_0x5e65f5){this['id']=_0x5e65f5['id']||0x0;this[_0xf02a('0x0')]=_0x5e65f5[_0xf02a('0x0')]||'';this['Intervals']=_0x5e65f5[_0xf02a('0x1')]||{};}module[_0xf02a('0x2')]=Interval; \ No newline at end of file +var _0xb9c9=['exports','name','Intervals'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xb9c9,0x1a8));var _0x9b9c=function(_0x57f8fb,_0x5ddc02){_0x57f8fb=_0x57f8fb-0x0;var _0xe8cfee=_0xb9c9[_0x57f8fb];return _0xe8cfee;};'use strict';function Interval(_0xb334c3){this['id']=_0xb334c3['id']||0x0;this[_0x9b9c('0x0')]=_0xb334c3[_0x9b9c('0x0')]||'';this[_0x9b9c('0x1')]=_0xb334c3['Intervals']||{};}module[_0x9b9c('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index a1c153a..e88d4f7 100644 --- a/server/services/routing/model/mailQueue.js +++ b/server/services/routing/model/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd96e=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','loggedIn','paused','length','online','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','../../../config/environment','defaults','redis','localhost'];(function(_0x7ae629,_0x401741){var _0x46407e=function(_0x13bd42){while(--_0x13bd42){_0x7ae629['push'](_0x7ae629['shift']());}};_0x46407e(++_0x401741);}(_0xd96e,0x112));var _0xed96=function(_0x43d9ff,_0x5c8a80){_0x43d9ff=_0x43d9ff-0x0;var _0x4e038b=_0xd96e[_0x43d9ff];return _0x4e038b;};'use strict';var _=require(_0xed96('0x0'));var md5=require(_0xed96('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xed96('0x2'));config['redis']=_[_0xed96('0x3')](config[_0xed96('0x4')],{'host':_0xed96('0x5'),'port':0x18eb});var io=require(_0xed96('0x6'))(new Redis(config[_0xed96('0x4')]));function MailQueue(_0x5b3ceb){this['id']=_0x5b3ceb['id']||0x0;this[_0xed96('0x7')]=_0x5b3ceb[_0xed96('0x7')]||'';this[_0xed96('0x8')]=_0x5b3ceb['timeout']||0xa;this[_0xed96('0x9')]=_0x5b3ceb[_0xed96('0x9')]||_0xed96('0xa');this[_0xed96('0xb')]=_0x5b3ceb[_0xed96('0xb')];this[_0xed96('0xc')]={};this[_0xed96('0xd')]=0x0;this[_0xed96('0x1')]='';this[_0xed96('0xe')]();this['updateRealtime']();}MailQueue[_0xed96('0xf')][_0xed96('0xe')]=function(){var _0x495ae4=this[_0xed96('0xc')][_0xed96('0x10')];this[_0xed96('0xc')]=_['map'](this[_0xed96('0xb')],'id');this[_0xed96('0xc')][_0xed96('0x10')]=_0x495ae4;};MailQueue['prototype']['updateRealtime']=function(){this[_0xed96('0x11')]=0x0;this[_0xed96('0x12')]=0x0;for(var _0x17967a=0x0;_0x17967a=0x0?this[_0xed96('0x16')]:0x0;var _0x379589={'id':this['id'],'available':this[_0xed96('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xed96('0x7')],'paused':this[_0xed96('0x12')],'waiting':this['waiting']};var _0x24d4cf=md5(JSON['stringify'](_0x379589));if(this[_0xed96('0x1')]!==_0x24d4cf){this[_0xed96('0x1')]=_0x24d4cf;io['to'](util[_0xed96('0x17')](_0xed96('0x18'),_0x379589[_0xed96('0x7')]))[_0xed96('0x19')](_0xed96('0x1a'),_0x379589);}};module[_0xed96('0x1b')]=MailQueue; \ No newline at end of file +var _0xc8d6=['length','online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xc8d6,0x120));var _0x6c8d=function(_0x2207fc,_0x424044){_0x2207fc=_0x2207fc-0x0;var _0x3d7025=_0xc8d6[_0x2207fc];return _0x3d7025;};'use strict';var _=require('lodash');var md5=require(_0x6c8d('0x0'));var util=require(_0x6c8d('0x1'));var Redis=require(_0x6c8d('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x6c8d('0x3')](config[_0x6c8d('0x4')],{'host':_0x6c8d('0x5'),'port':0x18eb});var io=require(_0x6c8d('0x6'))(new Redis(config['redis']));function MailQueue(_0x210dbe){this['id']=_0x210dbe['id']||0x0;this['name']=_0x210dbe[_0x6c8d('0x7')]||'';this[_0x6c8d('0x8')]=_0x210dbe['timeout']||0xa;this[_0x6c8d('0x9')]=_0x210dbe[_0x6c8d('0x9')]||'beepall';this['Agents']=_0x210dbe[_0x6c8d('0xa')];this['mapAgentsId']={};this[_0x6c8d('0xb')]=0x0;this[_0x6c8d('0x0')]='';this[_0x6c8d('0xc')]();this[_0x6c8d('0xd')]();}MailQueue[_0x6c8d('0xe')][_0x6c8d('0xc')]=function(){var _0x1ad5bb=this['mapAgentsId'][_0x6c8d('0xf')];this[_0x6c8d('0x10')]=_[_0x6c8d('0x11')](this[_0x6c8d('0xa')],'id');this[_0x6c8d('0x10')][_0x6c8d('0xf')]=_0x1ad5bb;};MailQueue[_0x6c8d('0xe')][_0x6c8d('0xd')]=function(){this[_0x6c8d('0x12')]=0x0;this[_0x6c8d('0x13')]=0x0;for(var _0x59cc3a=0x0;_0x59cc3a=0x0?this[_0x6c8d('0x17')]:0x0;var _0x569160={'id':this['id'],'available':this[_0x6c8d('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x6c8d('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x3bd9b2=md5(JSON[_0x6c8d('0x18')](_0x569160));if(this[_0x6c8d('0x0')]!==_0x3bd9b2){this['md5']=_0x3bd9b2;io['to'](util['format'](_0x6c8d('0x19'),_0x569160[_0x6c8d('0x7')]))[_0x6c8d('0x1a')](_0x6c8d('0x1b'),_0x569160);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9f41420..e1b5b6f 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x326f,0xd1));var _0xf326=function(_0xf82981,_0xc48cad){_0xf82981=_0xf82981-0x0;var _0x1e7d92=_0x326f[_0xf82981];return _0x1e7d92;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x326f,0xd1));var _0xf326=function(_0xd94687,_0x1a09b9){_0xd94687=_0xd94687-0x0;var _0x4d4b3b=_0x326f[_0xd94687];return _0x4d4b3b;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b306e7f..fd1ee8d 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7764=['updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','smsPause','available','stringify','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1e8288,_0x5c6b05){var _0x52c5c5=function(_0x26a9e3){while(--_0x26a9e3){_0x1e8288['push'](_0x1e8288['shift']());}};_0x52c5c5(++_0x5c6b05);}(_0x7764,0xa4));var _0x4776=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0x7764[_0x555ebb];return _0x3c0a4a;};'use strict';var _=require(_0x4776('0x0'));var md5=require(_0x4776('0x1'));var util=require(_0x4776('0x2'));var Redis=require(_0x4776('0x3'));var config=require(_0x4776('0x4'));config[_0x4776('0x5')]=_[_0x4776('0x6')](config[_0x4776('0x5')],{'host':_0x4776('0x7'),'port':0x18eb});var io=require(_0x4776('0x8'))(new Redis(config['redis']));function SmsQueue(_0x5a1e38){this['id']=_0x5a1e38['id']||0x0;this[_0x4776('0x9')]=_0x5a1e38[_0x4776('0x9')]||'';this['timeout']=_0x5a1e38[_0x4776('0xa')]||0xa;this[_0x4776('0xb')]=_0x5a1e38['strategy']||'beepall';this[_0x4776('0xc')]=_0x5a1e38['Agents'];this[_0x4776('0xd')]={};this[_0x4776('0xe')]=0x0;this[_0x4776('0x1')]='';this[_0x4776('0xf')]();this[_0x4776('0x10')]();}SmsQueue[_0x4776('0x11')][_0x4776('0xf')]=function(){var _0x3fb889=this[_0x4776('0xd')][_0x4776('0x12')];this[_0x4776('0xd')]=_[_0x4776('0x13')](this[_0x4776('0xc')],'id');this[_0x4776('0xd')][_0x4776('0x12')]=_0x3fb889;};SmsQueue[_0x4776('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x4776('0x14')]=0x0;for(var _0x46429e=0x0;_0x46429e=0x0?this[_0x4776('0x19')]:0x0;var _0xed81b5={'id':this['id'],'available':this[_0x4776('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x4776('0x9')],'paused':this[_0x4776('0x14')],'waiting':this['waiting']};var _0x3659fa=md5(JSON[_0x4776('0x1a')](_0xed81b5));if(this[_0x4776('0x1')]!==_0x3659fa){this[_0x4776('0x1')]=_0x3659fa;io['to'](util['format'](_0x4776('0x1b'),_0xed81b5[_0x4776('0x9')]))[_0x4776('0x1c')](_0x4776('0x1d'),_0xed81b5);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x7d86=['Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall'];(function(_0x435fa1,_0x58550a){var _0x845f9f=function(_0x89867e){while(--_0x89867e){_0x435fa1['push'](_0x435fa1['shift']());}};_0x845f9f(++_0x58550a);}(_0x7d86,0x86));var _0x67d8=function(_0x4adf20,_0xe83351){_0x4adf20=_0x4adf20-0x0;var _0x4c8a9d=_0x7d86[_0x4adf20];return _0x4c8a9d;};'use strict';var _=require(_0x67d8('0x0'));var md5=require('md5');var util=require(_0x67d8('0x1'));var Redis=require(_0x67d8('0x2'));var config=require(_0x67d8('0x3'));config[_0x67d8('0x4')]=_[_0x67d8('0x5')](config[_0x67d8('0x4')],{'host':_0x67d8('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x67d8('0x4')]));function SmsQueue(_0x33de53){this['id']=_0x33de53['id']||0x0;this[_0x67d8('0x7')]=_0x33de53[_0x67d8('0x7')]||'';this[_0x67d8('0x8')]=_0x33de53[_0x67d8('0x8')]||0xa;this[_0x67d8('0x9')]=_0x33de53[_0x67d8('0x9')]||_0x67d8('0xa');this[_0x67d8('0xb')]=_0x33de53[_0x67d8('0xb')];this[_0x67d8('0xc')]={};this[_0x67d8('0xd')]=0x0;this[_0x67d8('0xe')]='';this[_0x67d8('0xf')]();this[_0x67d8('0x10')]();}SmsQueue[_0x67d8('0x11')][_0x67d8('0xf')]=function(){var _0x38107b=this[_0x67d8('0xc')][_0x67d8('0x12')];this['mapAgentsId']=_[_0x67d8('0x13')](this[_0x67d8('0xb')],'id');this[_0x67d8('0xc')]['_rr']=_0x38107b;};SmsQueue[_0x67d8('0x11')][_0x67d8('0x10')]=function(){this[_0x67d8('0x14')]=0x0;this[_0x67d8('0x15')]=0x0;for(var _0x2d54e6=0x0;_0x2d54e6=0x0?this[_0x67d8('0x18')]:0x0;var _0x23328d={'id':this['id'],'available':this[_0x67d8('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x67d8('0x7')],'paused':this[_0x67d8('0x15')],'waiting':this[_0x67d8('0xd')]};var _0x14a81f=md5(JSON[_0x67d8('0x19')](_0x23328d));if(this['md5']!==_0x14a81f){this[_0x67d8('0xe')]=_0x14a81f;io['to'](util[_0x67d8('0x1a')]('sms:queue:%s',_0x23328d['name']))[_0x67d8('0x1b')]('sms_queue:save',_0x23328d);}};module[_0x67d8('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 4ecfe68..d0b4d83 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6852=['prototype','_rr','map','loggedIn','paused','length','available','stringify','whatsapp_queue:save','exports','lodash','md5','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x114937,_0x45956b){var _0x5350af=function(_0x1cc369){while(--_0x1cc369){_0x114937['push'](_0x114937['shift']());}};_0x5350af(++_0x45956b);}(_0x6852,0x1a2));var _0x2685=function(_0x591450,_0xdbe254){_0x591450=_0x591450-0x0;var _0x3e37d8=_0x6852[_0x591450];return _0x3e37d8;};'use strict';var _=require(_0x2685('0x0'));var md5=require(_0x2685('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x2685('0x2')]=_['defaults'](config['redis'],{'host':_0x2685('0x3'),'port':0x18eb});var io=require(_0x2685('0x4'))(new Redis(config[_0x2685('0x2')]));function WhatsappQueue(_0x3f3f4f){this['id']=_0x3f3f4f['id']||0x0;this[_0x2685('0x5')]=_0x3f3f4f[_0x2685('0x5')]||'';this[_0x2685('0x6')]=_0x3f3f4f[_0x2685('0x6')]||0xa;this['strategy']=_0x3f3f4f[_0x2685('0x7')]||_0x2685('0x8');this[_0x2685('0x9')]=_0x3f3f4f[_0x2685('0x9')];this[_0x2685('0xa')]={};this[_0x2685('0xb')]=0x0;this[_0x2685('0x1')]='';this[_0x2685('0xc')]();this[_0x2685('0xd')]();}WhatsappQueue[_0x2685('0xe')][_0x2685('0xc')]=function(){var _0x47189c=this[_0x2685('0xa')][_0x2685('0xf')];this['mapAgentsId']=_[_0x2685('0x10')](this['Agents'],'id');this[_0x2685('0xa')]['_rr']=_0x47189c;};WhatsappQueue[_0x2685('0xe')][_0x2685('0xd')]=function(){this[_0x2685('0x11')]=0x0;this[_0x2685('0x12')]=0x0;for(var _0x5b0140=0x0;_0x5b0140=0x0?this[_0x2685('0x14')]:0x0;var _0x27b3b2={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2685('0x11')],'name':this[_0x2685('0x5')],'paused':this[_0x2685('0x12')],'waiting':this['waiting']};var _0x4992b2=md5(JSON[_0x2685('0x15')](_0x27b3b2));if(this[_0x2685('0x1')]!==_0x4992b2){this['md5']=_0x4992b2;io['to'](util['format']('whatsapp:queue:%s',_0x27b3b2['name']))['emit'](_0x2685('0x16'),_0x27b3b2);}};module[_0x2685('0x17')]=WhatsappQueue; \ No newline at end of file +var _0x70ca=['lodash','md5','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','loggedIn','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x70ca,0x64));var _0xa70c=function(_0x459e80,_0x5185dc){_0x459e80=_0x459e80-0x0;var _0x231a6e=_0x70ca[_0x459e80];return _0x231a6e;};'use strict';var _=require(_0xa70c('0x0'));var md5=require(_0xa70c('0x1'));var util=require('util');var Redis=require(_0xa70c('0x2'));var config=require('../../../config/environment');config[_0xa70c('0x3')]=_['defaults'](config[_0xa70c('0x3')],{'host':_0xa70c('0x4'),'port':0x18eb});var io=require(_0xa70c('0x5'))(new Redis(config[_0xa70c('0x3')]));function WhatsappQueue(_0x411f9b){this['id']=_0x411f9b['id']||0x0;this[_0xa70c('0x6')]=_0x411f9b['name']||'';this['timeout']=_0x411f9b[_0xa70c('0x7')]||0xa;this[_0xa70c('0x8')]=_0x411f9b[_0xa70c('0x8')]||'beepall';this[_0xa70c('0x9')]=_0x411f9b['Agents'];this[_0xa70c('0xa')]={};this[_0xa70c('0xb')]=0x0;this[_0xa70c('0x1')]='';this[_0xa70c('0xc')]();this[_0xa70c('0xd')]();}WhatsappQueue[_0xa70c('0xe')][_0xa70c('0xc')]=function(){var _0x4e8a92=this[_0xa70c('0xa')][_0xa70c('0xf')];this[_0xa70c('0xa')]=_[_0xa70c('0x10')](this[_0xa70c('0x9')],'id');this[_0xa70c('0xa')][_0xa70c('0xf')]=_0x4e8a92;};WhatsappQueue[_0xa70c('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xa70c('0x11')]=0x0;for(var _0x10ebb1=0x0;_0x10ebb1=0x0?this['available']:0x0;var _0xf54ee2={'id':this['id'],'available':this[_0xa70c('0x14')],'loggedIn':this[_0xa70c('0x13')],'name':this[_0xa70c('0x6')],'paused':this[_0xa70c('0x11')],'waiting':this[_0xa70c('0xb')]};var _0x2539f6=md5(JSON[_0xa70c('0x15')](_0xf54ee2));if(this[_0xa70c('0x1')]!==_0x2539f6){this['md5']=_0x2539f6;io['to'](util['format'](_0xa70c('0x16'),_0xf54ee2[_0xa70c('0x6')]))[_0xa70c('0x17')](_0xa70c('0x18'),_0xf54ee2);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 5708909..6fe15c8 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x2659c7,_0x6560f4){var _0x3c5567=function(_0x345486){while(--_0x345486){_0x2659c7['push'](_0x2659c7['shift']());}};_0x3c5567(++_0x6560f4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b2e8c,_0x54f172){_0x2b2e8c=_0x2b2e8c-0x0;var _0x4e8fac=_0xb10b[_0x2b2e8c];return _0x4e8fac;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 3979824..9a9f6c9 100644 --- a/server/services/routing/rpc/chatInteraction.js +++ b/server/services/routing/rpc/chatInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbccc=['updateChatInteraction','addTagsToChatInteraction','update','Request'];(function(_0x300860,_0x509371){var _0x2094ad=function(_0x2090a2){while(--_0x2090a2){_0x300860['push'](_0x300860['shift']());}};_0x2094ad(++_0x509371);}(_0xbccc,0x9a));var _0xcbcc=function(_0x1e3612,_0x12c432){_0x1e3612=_0x1e3612-0x0;var _0x4e5be2=_0xbccc[_0x1e3612];return _0x4e5be2;};'use strict';var client=require('../client');exports[_0xcbcc('0x0')]=function(_0x464b56,_0x46baa9){return client[_0xcbcc('0x1')]('UpdateChatInteraction',{'body':_0x46baa9,'options':{'where':{'id':_0x464b56}},'log':_0xcbcc('0x2')});};exports['addTags']=function(_0x5d47bb,_0x2e0978){return client['Request']('AddTagsToChatInteraction',{'body':_0x2e0978,'options':{'where':{'id':_0x5d47bb}},'log':_0xcbcc('0x3')});}; \ No newline at end of file +var _0x48c9=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','update','UpdateChatInteraction','addTags'];(function(_0x2a32fe,_0x5899f0){var _0x2e62da=function(_0x45e799){while(--_0x45e799){_0x2a32fe['push'](_0x2a32fe['shift']());}};_0x2e62da(++_0x5899f0);}(_0x48c9,0x105));var _0x948c=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0x48c9[_0x3b1e3f];return _0x3b1cd3;};'use strict';var client=require('../client');exports[_0x948c('0x0')]=function(_0x394dee,_0x362d0e){return client['Request'](_0x948c('0x1'),{'body':_0x362d0e,'options':{'where':{'id':_0x394dee}},'log':'updateChatInteraction'});};exports[_0x948c('0x2')]=function(_0x524c2a,_0x14963d){return client[_0x948c('0x3')](_0x948c('0x4'),{'body':_0x14963d,'options':{'where':{'id':_0x524c2a}},'log':_0x948c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 02245a2..22c5d15 100644 --- a/server/services/routing/rpc/chatMessage.js +++ b/server/services/routing/rpc/chatMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b5d=['../client','create','CreateChatMessage'];(function(_0x3005a6,_0x320826){var _0x2f7399=function(_0x210e82){while(--_0x210e82){_0x3005a6['push'](_0x3005a6['shift']());}};_0x2f7399(++_0x320826);}(_0x3b5d,0x1ce));var _0xd3b5=function(_0x38bce7,_0x366405){_0x38bce7=_0x38bce7-0x0;var _0x4f8b4e=_0x3b5d[_0x38bce7];return _0x4f8b4e;};'use strict';var client=require(_0xd3b5('0x0'));exports[_0xd3b5('0x1')]=function(_0x2d0bd6){return client['Request'](_0xd3b5('0x2'),{'body':_0x2d0bd6,'log':'createChatMessage'});}; \ No newline at end of file +var _0x4ff0=['../client','Request','CreateChatMessage','createChatMessage'];(function(_0x349915,_0x124261){var _0x8be4f3=function(_0x3a82a9){while(--_0x3a82a9){_0x349915['push'](_0x349915['shift']());}};_0x8be4f3(++_0x124261);}(_0x4ff0,0xfc));var _0x04ff=function(_0x24afd3,_0xcc36f0){_0x24afd3=_0x24afd3-0x0;var _0xffe96f=_0x4ff0[_0x24afd3];return _0xffe96f;};'use strict';var client=require(_0x04ff('0x0'));exports['create']=function(_0x5efcd6){return client[_0x04ff('0x1')](_0x04ff('0x2'),{'body':_0x5efcd6,'log':_0x04ff('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 51a8b2b..841e8b8 100644 --- a/server/services/routing/rpc/chatQueue.js +++ b/server/services/routing/rpc/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5447=['getChatQueues','../client','Request','GetChatQueue','timeout','User','Agents','name','online','chatPause'];(function(_0x5cce7f,_0x59e4bc){var _0x2698df=function(_0x219549){while(--_0x219549){_0x5cce7f['push'](_0x5cce7f['shift']());}};_0x2698df(++_0x59e4bc);}(_0x5447,0xf1));var _0x7544=function(_0x14a9fb,_0x82467d){_0x14a9fb=_0x14a9fb-0x0;var _0x2eee9c=_0x5447[_0x14a9fb];return _0x2eee9c;};'use strict';var client=require(_0x7544('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x7544('0x1')](_0x7544('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7544('0x3'),'strategy'],'include':[{'model':_0x7544('0x4'),'as':_0x7544('0x5'),'attributes':['id',_0x7544('0x6'),_0x7544('0x7'),_0x7544('0x8')]}]},'log':_0x7544('0x9')});};}; \ No newline at end of file +var _0x8c46=['../client','GetChatQueue','strategy','User','Agents','name','online','chatPause','getChatQueues'];(function(_0x489e87,_0xe1be00){var _0x44d28f=function(_0x54c8a4){while(--_0x54c8a4){_0x489e87['push'](_0x489e87['shift']());}};_0x44d28f(++_0xe1be00);}(_0x8c46,0x171));var _0x68c4=function(_0x4a8bc2,_0x4128e0){_0x4a8bc2=_0x4a8bc2-0x0;var _0x587b68=_0x8c46[_0x4a8bc2];return _0x587b68;};'use strict';var client=require(_0x68c4('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x68c4('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x68c4('0x2')],'include':[{'model':_0x68c4('0x3'),'as':_0x68c4('0x4'),'attributes':['id',_0x68c4('0x5'),_0x68c4('0x6'),_0x68c4('0x7')]}]},'log':_0x68c4('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 1b05326..79dbb5a 100644 --- a/server/services/routing/rpc/chatQueueReport.js +++ b/server/services/routing/rpc/chatQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54f3=['create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x54f3,0x120));var _0x354f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x54f3[_0x40a045];return _0x1a687c;};'use strict';var client=require('../client');exports[_0x354f('0x0')]=function(_0x344fae){return client[_0x354f('0x1')](_0x354f('0x2'),{'body':_0x344fae,'log':_0x354f('0x2')});};exports['update']=function(_0x48d7aa,_0xe4efe){return client[_0x354f('0x1')](_0x354f('0x3'),{'body':_0xe4efe,'options':{'where':{'uniqueid':_0x48d7aa},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xba33=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0xba33,0xf1));var _0x3ba3=function(_0x194e6d,_0x15e36a){_0x194e6d=_0x194e6d-0x0;var _0x437fd9=_0xba33[_0x194e6d];return _0x437fd9;};'use strict';var client=require(_0x3ba3('0x0'));exports[_0x3ba3('0x1')]=function(_0x385c61){return client[_0x3ba3('0x2')]('CreateChatQueueReport',{'body':_0x385c61,'log':_0x3ba3('0x3')});};exports[_0x3ba3('0x4')]=function(_0x12472e,_0x77ca36){return client[_0x3ba3('0x2')](_0x3ba3('0x5'),{'body':_0x77ca36,'options':{'where':{'uniqueid':_0x12472e},'order':[['id',_0x3ba3('0x6')]],'limit':0x1},'log':_0x3ba3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 937aced..b86449e 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4296ec,_0x1354bb){var _0x39147a=function(_0x3b12ae){while(--_0x3b12ae){_0x4296ec['push'](_0x4296ec['shift']());}};_0x39147a(++_0x1354bb);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x7a54,0x106));var _0x47a5=function(_0x5d71f6,_0x4d1928){_0x5d71f6=_0x5d71f6-0x0;var _0x2f1ee1=_0x7a54[_0x5d71f6];return _0x2f1ee1;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index af2c472..7d5a4f9 100644 --- a/server/services/routing/rpc/faxMessage.js +++ b/server/services/routing/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x094c=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x094c,0x1ec));var _0xc094=function(_0x1a0557,_0x2a0db7){_0x1a0557=_0x1a0557-0x0;var _0x1ad015=_0x094c[_0x1a0557];return _0x1ad015;};'use strict';var client=require('../client');exports['create']=function(_0x620879){return client[_0xc094('0x0')](_0xc094('0x1'),{'body':_0x620879,'log':_0xc094('0x2')});}; \ No newline at end of file +var _0x5c10=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x4e45f4,_0x370a01){var _0x1c6632=function(_0x575115){while(--_0x575115){_0x4e45f4['push'](_0x4e45f4['shift']());}};_0x1c6632(++_0x370a01);}(_0x5c10,0x1bf));var _0x05c1=function(_0x4ea349,_0x308124){_0x4ea349=_0x4ea349-0x0;var _0x79a8bd=_0x5c10[_0x4ea349];return _0x79a8bd;};'use strict';var client=require(_0x05c1('0x0'));exports['create']=function(_0x33ca06){return client[_0x05c1('0x1')](_0x05c1('0x2'),{'body':_0x33ca06,'log':_0x05c1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index ecf40e0..5611f49 100644 --- a/server/services/routing/rpc/faxQueue.js +++ b/server/services/routing/rpc/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8da3=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x560408,_0x45c914){var _0x3fd4da=function(_0x47e9a9){while(--_0x47e9a9){_0x560408['push'](_0x560408['shift']());}};_0x3fd4da(++_0x45c914);}(_0x8da3,0x19c));var _0x38da=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x8da3[_0x37bd26];return _0xe83dc4;};'use strict';var client=require(_0x38da('0x0'));exports[_0x38da('0x1')]=function(){return function(){return client[_0x38da('0x2')](_0x38da('0x3'),{'options':{'raw':![],'attributes':['id',_0x38da('0x4'),_0x38da('0x5'),_0x38da('0x6')],'include':[{'model':_0x38da('0x7'),'as':_0x38da('0x8'),'attributes':['id',_0x38da('0x4'),_0x38da('0x9'),_0x38da('0xa')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xe9d1=['GetFaxQueue','Agents','online','../client','getFaxQueues'];(function(_0x4a5356,_0x20f134){var _0x4beb93=function(_0x151541){while(--_0x151541){_0x4a5356['push'](_0x4a5356['shift']());}};_0x4beb93(++_0x20f134);}(_0xe9d1,0x1ac));var _0x1e9d=function(_0x5cc5cd,_0x4b19b2){_0x5cc5cd=_0x5cc5cd-0x0;var _0x44abe4=_0xe9d1[_0x5cc5cd];return _0x44abe4;};'use strict';var client=require(_0x1e9d('0x0'));exports[_0x1e9d('0x1')]=function(){return function(){return client['Request'](_0x1e9d('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':'User','as':_0x1e9d('0x3'),'attributes':['id','name',_0x1e9d('0x4'),'faxPause']}]},'log':_0x1e9d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2d3985f..b06a338 100644 --- a/server/services/routing/rpc/faxQueueReport.js +++ b/server/services/routing/rpc/faxQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3b4=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x1dbe31,_0x54c4ca){var _0x3ec4b1=function(_0x5c2aeb){while(--_0x5c2aeb){_0x1dbe31['push'](_0x1dbe31['shift']());}};_0x3ec4b1(++_0x54c4ca);}(_0xa3b4,0x130));var _0x4a3b=function(_0x23dae9,_0x4c0cfb){_0x23dae9=_0x23dae9-0x0;var _0x6bb8f0=_0xa3b4[_0x23dae9];return _0x6bb8f0;};'use strict';var client=require('../client');exports[_0x4a3b('0x0')]=function(_0x3fdc16){return client[_0x4a3b('0x1')](_0x4a3b('0x2'),{'body':_0x3fdc16,'log':_0x4a3b('0x2')});};exports[_0x4a3b('0x3')]=function(_0x4f3193,_0x541d47){return client[_0x4a3b('0x1')](_0x4a3b('0x4'),{'body':_0x541d47,'options':{'where':{'uniqueid':_0x4f3193},'order':[['id',_0x4a3b('0x5')]],'limit':0x1},'log':_0x4a3b('0x4')});}; \ No newline at end of file +var _0x75ca=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x398513,_0x4e8314){var _0x520c68=function(_0x4eb625){while(--_0x4eb625){_0x398513['push'](_0x398513['shift']());}};_0x520c68(++_0x4e8314);}(_0x75ca,0x13c));var _0xa75c=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x75ca[_0x9e0cb3];return _0x5926b7;};'use strict';var client=require(_0xa75c('0x0'));exports[_0xa75c('0x1')]=function(_0x17e706){return client[_0xa75c('0x2')]('CreateFaxQueueReport',{'body':_0x17e706,'log':_0xa75c('0x3')});};exports[_0xa75c('0x4')]=function(_0x4de49e,_0x236489){return client[_0xa75c('0x2')](_0xa75c('0x5'),{'body':_0x236489,'options':{'where':{'uniqueid':_0x4de49e},'order':[['id',_0xa75c('0x6')]],'limit':0x1},'log':_0xa75c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2214932..7a4fd3b 100644 --- a/server/services/routing/rpc/interval.js +++ b/server/services/routing/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b28=['Intervals','interval','getIntervals','Request','GetInterval','name','Interval'];(function(_0x40dcd1,_0x5cd1da){var _0x5c056b=function(_0x87a3a7){while(--_0x87a3a7){_0x40dcd1['push'](_0x40dcd1['shift']());}};_0x5c056b(++_0x5cd1da);}(_0x2b28,0x130));var _0x82b2=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x2b28[_0x3ce2c4];return _0x4047c1;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0x82b2('0x0')](_0x82b2('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x82b2('0x2')],'include':[{'model':_0x82b2('0x3'),'as':_0x82b2('0x4'),'attributes':['id',_0x82b2('0x2'),_0x82b2('0x5')]}]},'log':_0x82b2('0x6')});};}; \ No newline at end of file +var _0x27d6=['interval','getIntervals','../client','Request','GetInterval','name','Interval','Intervals'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x27d6,0x1ca));var _0x627d=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x27d6[_0x209941];return _0x1e8729;};'use strict';var client=require(_0x627d('0x0'));exports['getIntervals']=function(){return function(){return client[_0x627d('0x1')](_0x627d('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x627d('0x3')],'include':[{'model':_0x627d('0x4'),'as':_0x627d('0x5'),'attributes':['id',_0x627d('0x3'),_0x627d('0x6')]}]},'log':_0x627d('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ae2ebe9..5c2b8ad 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','Request','AddTagsToMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x106a19,_0x519ddb){_0x106a19=_0x106a19-0x0;var _0x1057d6=_0x2032[_0x106a19];return _0x1057d6;};'use strict';var client=require('../client');exports[_0x2203('0x0')]=function(_0x1e103d,_0xcd892f){return client['Request'](_0x2203('0x1'),{'body':_0xcd892f,'options':{'where':{'id':_0x1e103d}},'log':_0x2203('0x2')});};exports['addTags']=function(_0x46c49a,_0x880dcd){return client[_0x2203('0x3')](_0x2203('0x4'),{'body':_0x880dcd,'options':{'where':{'id':_0x46c49a}},'log':_0x2203('0x5')});}; \ No newline at end of file +var _0x4213=['../client','update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x406be2,_0x4cb62c){var _0x40a1a0=function(_0x39e78c){while(--_0x39e78c){_0x406be2['push'](_0x406be2['shift']());}};_0x40a1a0(++_0x4cb62c);}(_0x4213,0x77));var _0x3421=function(_0x3fcd88,_0x25eb71){_0x3fcd88=_0x3fcd88-0x0;var _0x3938cb=_0x4213[_0x3fcd88];return _0x3938cb;};'use strict';var client=require(_0x3421('0x0'));exports[_0x3421('0x1')]=function(_0x324515,_0x7870a4){return client[_0x3421('0x2')](_0x3421('0x3'),{'body':_0x7870a4,'options':{'where':{'id':_0x324515}},'log':_0x3421('0x4')});};exports['addTags']=function(_0xdbd54e,_0x5c3719){return client[_0x3421('0x2')](_0x3421('0x5'),{'body':_0x5c3719,'options':{'where':{'id':_0xdbd54e}},'log':_0x3421('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index e580875..0ab47a3 100644 --- a/server/services/routing/rpc/mailMessage.js +++ b/server/services/routing/rpc/mailMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe446=['Request','CreateMailMessage','createMailMessage','../client'];(function(_0x3d0882,_0x5c27a5){var _0xaef64=function(_0x297451){while(--_0x297451){_0x3d0882['push'](_0x3d0882['shift']());}};_0xaef64(++_0x5c27a5);}(_0xe446,0xfb));var _0x6e44=function(_0x4bc128,_0x85ba08){_0x4bc128=_0x4bc128-0x0;var _0xc82928=_0xe446[_0x4bc128];return _0xc82928;};'use strict';var client=require(_0x6e44('0x0'));exports['create']=function(_0x3161dc){return client[_0x6e44('0x1')](_0x6e44('0x2'),{'body':_0x3161dc,'log':_0x6e44('0x3')});}; \ No newline at end of file +var _0x1540=['Request','createMailMessage','../client','create'];(function(_0x2b8bd1,_0x5b154a){var _0x11e7c0=function(_0x48b8fd){while(--_0x48b8fd){_0x2b8bd1['push'](_0x2b8bd1['shift']());}};_0x11e7c0(++_0x5b154a);}(_0x1540,0x192));var _0x0154=function(_0x57990d,_0x15a98e){_0x57990d=_0x57990d-0x0;var _0x1bf6cf=_0x1540[_0x57990d];return _0x1bf6cf;};'use strict';var client=require(_0x0154('0x0'));exports[_0x0154('0x1')]=function(_0x4c480c){return client[_0x0154('0x2')]('CreateMailMessage',{'body':_0x4c480c,'log':_0x0154('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 9dd9146..c944df8 100644 --- a/server/services/routing/rpc/mailQueue.js +++ b/server/services/routing/rpc/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x109a=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User'];(function(_0x1201a4,_0xcdbe20){var _0x29a1d8=function(_0x1e6247){while(--_0x1e6247){_0x1201a4['push'](_0x1201a4['shift']());}};_0x29a1d8(++_0xcdbe20);}(_0x109a,0xd4));var _0xa109=function(_0x51f584,_0x35221e){_0x51f584=_0x51f584-0x0;var _0x72548b=_0x109a[_0x51f584];return _0x72548b;};'use strict';var client=require(_0xa109('0x0'));exports[_0xa109('0x1')]=function(){return function(){return client[_0xa109('0x2')](_0xa109('0x3'),{'options':{'raw':![],'attributes':['id',_0xa109('0x4'),_0xa109('0x5'),_0xa109('0x6')],'include':[{'model':_0xa109('0x7'),'as':'Agents','attributes':['id',_0xa109('0x4'),_0xa109('0x8'),_0xa109('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x2422=['name','timeout','Agents','online','../client','getMailQueues','Request','GetMailQueue'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x2422,0x1e4));var _0x2242=function(_0x2fca6b,_0x19a880){_0x2fca6b=_0x2fca6b-0x0;var _0x1f6a2c=_0x2422[_0x2fca6b];return _0x1f6a2c;};'use strict';var client=require(_0x2242('0x0'));exports[_0x2242('0x1')]=function(){return function(){return client[_0x2242('0x2')](_0x2242('0x3'),{'options':{'raw':![],'attributes':['id',_0x2242('0x4'),_0x2242('0x5'),'strategy'],'include':[{'model':'User','as':_0x2242('0x6'),'attributes':['id',_0x2242('0x4'),_0x2242('0x7'),'mailPause']}]},'log':_0x2242('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index acd0a3b..7f8ecf4 100644 --- a/server/services/routing/rpc/mailQueueReport.js +++ b/server/services/routing/rpc/mailQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x275e=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x25997b,_0xeddec4){var _0x43f8e1=function(_0x3a1005){while(--_0x3a1005){_0x25997b['push'](_0x25997b['shift']());}};_0x43f8e1(++_0xeddec4);}(_0x275e,0x13c));var _0xe275=function(_0xa95a5,_0x40586a){_0xa95a5=_0xa95a5-0x0;var _0x4a52c7=_0x275e[_0xa95a5];return _0x4a52c7;};'use strict';var client=require(_0xe275('0x0'));exports[_0xe275('0x1')]=function(_0x25fb4b){return client[_0xe275('0x2')](_0xe275('0x3'),{'body':_0x25fb4b,'log':_0xe275('0x3')});};exports[_0xe275('0x4')]=function(_0x5dd8cb,_0x4658ef){return client[_0xe275('0x2')](_0xe275('0x5'),{'body':_0x4658ef,'options':{'where':{'uniqueid':_0x5dd8cb},'order':[['id',_0xe275('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xf0c0=['UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport','update','Request'];(function(_0x10bced,_0x6d66e2){var _0x1f88b6=function(_0x1a7ce2){while(--_0x1a7ce2){_0x10bced['push'](_0x10bced['shift']());}};_0x1f88b6(++_0x6d66e2);}(_0xf0c0,0xe9));var _0x0f0c=function(_0x42d901,_0x53262e){_0x42d901=_0x42d901-0x0;var _0x3a8df6=_0xf0c0[_0x42d901];return _0x3a8df6;};'use strict';var client=require(_0x0f0c('0x0'));exports[_0x0f0c('0x1')]=function(_0xe6e47b){return client['Request'](_0x0f0c('0x2'),{'body':_0xe6e47b,'log':_0x0f0c('0x2')});};exports[_0x0f0c('0x3')]=function(_0x229f77,_0x251fc4){return client[_0x0f0c('0x4')](_0x0f0c('0x5'),{'body':_0x251fc4,'options':{'where':{'uniqueid':_0x229f77},'order':[['id',_0x0f0c('0x6')]],'limit':0x1},'log':_0x0f0c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e970882..8f20429 100644 --- a/server/services/routing/rpc/openchannelInteraction.js +++ b/server/services/routing/rpc/openchannelInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc92=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','../client'];(function(_0x239555,_0x59f04e){var _0x224fe3=function(_0x592bb0){while(--_0x592bb0){_0x239555['push'](_0x239555['shift']());}};_0x224fe3(++_0x59f04e);}(_0xcc92,0x1d9));var _0x2cc9=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xcc92[_0x5e36d1];return _0x950b9e;};'use strict';var client=require(_0x2cc9('0x0'));exports[_0x2cc9('0x1')]=function(_0x2ceea2,_0x23f8be){return client[_0x2cc9('0x2')](_0x2cc9('0x3'),{'body':_0x23f8be,'options':{'where':{'id':_0x2ceea2}},'log':_0x2cc9('0x4')});};exports[_0x2cc9('0x5')]=function(_0x4f8363,_0x2cd7d6){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x2cd7d6,'options':{'where':{'id':_0x4f8363}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6287=['addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x1669c3,_0x14f4da){var _0x56b5ba=function(_0x589bd2){while(--_0x589bd2){_0x1669c3['push'](_0x1669c3['shift']());}};_0x56b5ba(++_0x14f4da);}(_0x6287,0x14b));var _0x7628=function(_0x5d506b,_0x41b1ca){_0x5d506b=_0x5d506b-0x0;var _0x2a8f24=_0x6287[_0x5d506b];return _0x2a8f24;};'use strict';var client=require(_0x7628('0x0'));exports['update']=function(_0x3c5dba,_0x1bc6af){return client[_0x7628('0x1')](_0x7628('0x2'),{'body':_0x1bc6af,'options':{'where':{'id':_0x3c5dba}},'log':'updateOpenchannelInteraction'});};exports[_0x7628('0x3')]=function(_0x35fd2d,_0x25163f){return client[_0x7628('0x1')](_0x7628('0x4'),{'body':_0x25163f,'options':{'where':{'id':_0x35fd2d}},'log':_0x7628('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index bca9097..3351939 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda67=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0xda67,0x1e9));var _0x7da6=function(_0x4fe708,_0x2bf6d7){_0x4fe708=_0x4fe708-0x0;var _0x5791f3=_0xda67[_0x4fe708];return _0x5791f3;};'use strict';var client=require(_0x7da6('0x0'));exports[_0x7da6('0x1')]=function(_0xa506b4){return client[_0x7da6('0x2')](_0x7da6('0x3'),{'body':_0xa506b4,'log':_0x7da6('0x4')});}; \ No newline at end of file +var _0x3cf8=['create','createOpenchannelMessage'];(function(_0x1fac75,_0x2f233b){var _0x13abd7=function(_0x3f1ac5){while(--_0x3f1ac5){_0x1fac75['push'](_0x1fac75['shift']());}};_0x13abd7(++_0x2f233b);}(_0x3cf8,0x194));var _0x83cf=function(_0x51a004,_0x504f1b){_0x51a004=_0x51a004-0x0;var _0x4403a1=_0x3cf8[_0x51a004];return _0x4403a1;};'use strict';var client=require('../client');exports[_0x83cf('0x0')]=function(_0x3f8d0b){return client['Request']('CreateOpenchannelMessage',{'body':_0x3f8d0b,'log':_0x83cf('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 78432c2..f0dd4ef 100644 --- a/server/services/routing/rpc/openchannelQueue.js +++ b/server/services/routing/rpc/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc67a=['Request','GetOpenchannelQueue','timeout','strategy','Agents','name','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x3f4dbd,_0x3c20f6){var _0x3015b5=function(_0x5024b3){while(--_0x5024b3){_0x3f4dbd['push'](_0x3f4dbd['shift']());}};_0x3015b5(++_0x3c20f6);}(_0xc67a,0x134));var _0xac67=function(_0x29eff3,_0x35596c){_0x29eff3=_0x29eff3-0x0;var _0x126c5c=_0xc67a[_0x29eff3];return _0x126c5c;};'use strict';var client=require(_0xac67('0x0'));exports[_0xac67('0x1')]=function(){return function(){return client[_0xac67('0x2')](_0xac67('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xac67('0x4'),_0xac67('0x5')],'include':[{'model':'User','as':_0xac67('0x6'),'attributes':['id',_0xac67('0x7'),_0xac67('0x8'),_0xac67('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x7cbe=['../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause'];(function(_0x2ccbe6,_0x52449f){var _0x39fa8f=function(_0x422f49){while(--_0x422f49){_0x2ccbe6['push'](_0x2ccbe6['shift']());}};_0x39fa8f(++_0x52449f);}(_0x7cbe,0x19a));var _0xe7cb=function(_0x30f69d,_0xc75fdb){_0x30f69d=_0x30f69d-0x0;var _0x2bc4d4=_0x7cbe[_0x30f69d];return _0x2bc4d4;};'use strict';var client=require(_0xe7cb('0x0'));exports[_0xe7cb('0x1')]=function(){return function(){return client['Request'](_0xe7cb('0x2'),{'options':{'raw':![],'attributes':['id',_0xe7cb('0x3'),_0xe7cb('0x4'),_0xe7cb('0x5')],'include':[{'model':_0xe7cb('0x6'),'as':_0xe7cb('0x7'),'attributes':['id',_0xe7cb('0x3'),_0xe7cb('0x8'),_0xe7cb('0x9')]}]},'log':_0xe7cb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a61e80b..2b46f71 100644 --- a/server/services/routing/rpc/openchannelQueueReport.js +++ b/server/services/routing/rpc/openchannelQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf5c=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','create'];(function(_0x58fb84,_0x507bc5){var _0x19215a=function(_0x5420d5){while(--_0x5420d5){_0x58fb84['push'](_0x58fb84['shift']());}};_0x19215a(++_0x507bc5);}(_0xaf5c,0x161));var _0xcaf5=function(_0x1f2614,_0x2e14e1){_0x1f2614=_0x1f2614-0x0;var _0x62b194=_0xaf5c[_0x1f2614];return _0x62b194;};'use strict';var client=require('../client');exports[_0xcaf5('0x0')]=function(_0x7e5ff4){return client[_0xcaf5('0x1')](_0xcaf5('0x2'),{'body':_0x7e5ff4,'log':'CreateOpenchannelQueueReport'});};exports[_0xcaf5('0x3')]=function(_0x457519,_0x549b40){return client[_0xcaf5('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x549b40,'options':{'where':{'uniqueid':_0x457519},'order':[['id',_0xcaf5('0x4')]],'limit':0x1},'log':_0xcaf5('0x5')});}; \ No newline at end of file +var _0x8166=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','Request'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0x8166,0x100));var _0x6816=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x8166[_0x54de5d];return _0x1b349e;};'use strict';var client=require(_0x6816('0x0'));exports['create']=function(_0x1a09c8){return client[_0x6816('0x1')]('CreateOpenchannelQueueReport',{'body':_0x1a09c8,'log':_0x6816('0x2')});};exports[_0x6816('0x3')]=function(_0x3d107f,_0x254db1){return client['Request'](_0x6816('0x4'),{'body':_0x254db1,'options':{'where':{'uniqueid':_0x3d107f},'order':[['id',_0x6816('0x5')]],'limit':0x1},'log':_0x6816('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 3fcbea2..4ed55bb 100644 --- a/server/services/routing/rpc/smsInteraction.js +++ b/server/services/routing/rpc/smsInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb15=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','addTags'];(function(_0x51e51a,_0x2bfe6c){var _0x1e47cc=function(_0x5db8ec){while(--_0x5db8ec){_0x51e51a['push'](_0x51e51a['shift']());}};_0x1e47cc(++_0x2bfe6c);}(_0xfb15,0x12f));var _0x5fb1=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xfb15[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x5fb1('0x0'));exports[_0x5fb1('0x1')]=function(_0xecebe1,_0x33922b){return client[_0x5fb1('0x2')](_0x5fb1('0x3'),{'body':_0x33922b,'options':{'where':{'id':_0xecebe1}},'log':'updateSmsInteraction'});};exports[_0x5fb1('0x4')]=function(_0x253775,_0x3a82a1){return client[_0x5fb1('0x2')](_0x5fb1('0x5'),{'body':_0x3a82a1,'options':{'where':{'id':_0x253775}},'log':_0x5fb1('0x6')});}; \ No newline at end of file +var _0x2159=['UpdateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x3ca017,_0x54a7e1){var _0x3c2eca=function(_0x5d71a8){while(--_0x5d71a8){_0x3ca017['push'](_0x3ca017['shift']());}};_0x3c2eca(++_0x54a7e1);}(_0x2159,0x17f));var _0x9215=function(_0x28884c,_0x1ed6b4){_0x28884c=_0x28884c-0x0;var _0x654b52=_0x2159[_0x28884c];return _0x654b52;};'use strict';var client=require(_0x9215('0x0'));exports[_0x9215('0x1')]=function(_0x2b38be,_0x89e2e4){return client['Request'](_0x9215('0x2'),{'body':_0x89e2e4,'options':{'where':{'id':_0x2b38be}},'log':'updateSmsInteraction'});};exports[_0x9215('0x3')]=function(_0x3128f9,_0x202c8d){return client[_0x9215('0x4')](_0x9215('0x5'),{'body':_0x202c8d,'options':{'where':{'id':_0x3128f9}},'log':_0x9215('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d2f9f6a..2d0d343 100644 --- a/server/services/routing/rpc/smsMessage.js +++ b/server/services/routing/rpc/smsMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97b2=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0xe0d603,_0x4b4035){var _0x54ea1d=function(_0x5a0f39){while(--_0x5a0f39){_0xe0d603['push'](_0xe0d603['shift']());}};_0x54ea1d(++_0x4b4035);}(_0x97b2,0x18e));var _0x297b=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0x97b2[_0x5b5eb4];return _0x42af53;};'use strict';var client=require(_0x297b('0x0'));exports[_0x297b('0x1')]=function(_0x2ad7d0){return client[_0x297b('0x2')](_0x297b('0x3'),{'body':_0x2ad7d0,'log':_0x297b('0x4')});}; \ No newline at end of file +var _0x501a=['create','Request','CreateSmsMessage','../client'];(function(_0x27e36a,_0x44f308){var _0x108bb9=function(_0x2651ef){while(--_0x2651ef){_0x27e36a['push'](_0x27e36a['shift']());}};_0x108bb9(++_0x44f308);}(_0x501a,0x147));var _0xa501=function(_0x3c9def,_0x5384ea){_0x3c9def=_0x3c9def-0x0;var _0x591e39=_0x501a[_0x3c9def];return _0x591e39;};'use strict';var client=require(_0xa501('0x0'));exports[_0xa501('0x1')]=function(_0xb757b){return client[_0xa501('0x2')](_0xa501('0x3'),{'body':_0xb757b,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a8107b3..f71d0fa 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x2d29bd,_0x5515bc){var _0x30358e=function(_0x399f6b){while(--_0x399f6b){_0x2d29bd['push'](_0x2d29bd['shift']());}};_0x30358e(++_0x5515bc);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 7492ac9..6771732 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x3405ba,_0x10b568){var _0x3c4ce4=function(_0x37a551){while(--_0x37a551){_0x3405ba['push'](_0x3405ba['shift']());}};_0x3c4ce4(++_0x10b568);}(_0x70e0,0x17b));var _0x070e=function(_0x1c0b96,_0x382432){_0x1c0b96=_0x1c0b96-0x0;var _0x16a2bb=_0x70e0[_0x1c0b96];return _0x16a2bb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x4d34ad,_0x2f0773){var _0x14585a=function(_0x405554){while(--_0x405554){_0x4d34ad['push'](_0x4d34ad['shift']());}};_0x14585a(++_0x2f0773);}(_0x3e74,0x175));var _0x43e7=function(_0x5744b8,_0x1a065a){_0x5744b8=_0x5744b8-0x0;var _0x281635=_0x3e74[_0x5744b8];return _0x281635;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ac820cb..1d068b0 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x1cadd2,_0x314b05){var _0x5af1e0=function(_0x20a436){while(--_0x20a436){_0x1cadd2['push'](_0x1cadd2['shift']());}};_0x5af1e0(++_0x314b05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x3110d7,_0x1a9b39){var _0x21c07a=function(_0x59d4f6){while(--_0x59d4f6){_0x3110d7['push'](_0x3110d7['shift']());}};_0x21c07a(++_0x1a9b39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 6bf4fe1..7a18ab7 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7a3=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x3feab4,_0x43e82c){var _0x3bc3c7=function(_0x162ec8){while(--_0x162ec8){_0x3feab4['push'](_0x3feab4['shift']());}};_0x3bc3c7(++_0x43e82c);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x29af9c,_0xe09414){_0x29af9c=_0x29af9c-0x0;var _0x57d077=_0xc7a3[_0x29af9c];return _0x57d077;};'use strict';var client=require('../client');exports[_0x3c7a('0x0')]=function(_0x753b95,_0x73d51f){return client[_0x3c7a('0x1')](_0x3c7a('0x2'),{'body':_0x73d51f,'options':{'where':{'id':_0x753b95}},'log':_0x3c7a('0x3')});};exports['addTags']=function(_0x44fd47,_0x3e1c47){return client['Request'](_0x3c7a('0x4'),{'body':_0x3e1c47,'options':{'where':{'id':_0x44fd47}},'log':_0x3c7a('0x5')});}; \ No newline at end of file +var _0xce68=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0x2deb6f,_0x124efc){var _0x1bdcbe=function(_0x3883b5){while(--_0x3883b5){_0x2deb6f['push'](_0x2deb6f['shift']());}};_0x1bdcbe(++_0x124efc);}(_0xce68,0x10c));var _0x8ce6=function(_0xdca54b,_0x5f53f3){_0xdca54b=_0xdca54b-0x0;var _0x251436=_0xce68[_0xdca54b];return _0x251436;};'use strict';var client=require(_0x8ce6('0x0'));exports['update']=function(_0x30b0c9,_0x127429){return client[_0x8ce6('0x1')](_0x8ce6('0x2'),{'body':_0x127429,'options':{'where':{'id':_0x30b0c9}},'log':_0x8ce6('0x3')});};exports['addTags']=function(_0x439270,_0x79f353){return client[_0x8ce6('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x79f353,'options':{'where':{'id':_0x439270}},'log':_0x8ce6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 1e968ca..d8285e4 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3b1=['CreateWhatsappMessage','createWhatsappMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc3b1,0x154));var _0x1c3b=function(_0x2f99d8,_0x291cbb){_0x2f99d8=_0x2f99d8-0x0;var _0xf81fce=_0xc3b1[_0x2f99d8];return _0xf81fce;};'use strict';var client=require('../client');exports['create']=function(_0x5e2571){return client['Request'](_0x1c3b('0x0'),{'body':_0x5e2571,'log':_0x1c3b('0x1')});}; \ No newline at end of file +var _0x92c3=['../client','create','Request','CreateWhatsappMessage'];(function(_0x347280,_0x317f0a){var _0x19c853=function(_0x2a3020){while(--_0x2a3020){_0x347280['push'](_0x347280['shift']());}};_0x19c853(++_0x317f0a);}(_0x92c3,0x80));var _0x392c=function(_0x26025e,_0x41b0df){_0x26025e=_0x26025e-0x0;var _0x5d48fa=_0x92c3[_0x26025e];return _0x5d48fa;};'use strict';var client=require(_0x392c('0x0'));exports[_0x392c('0x1')]=function(_0xf4e181){return client[_0x392c('0x2')](_0x392c('0x3'),{'body':_0xf4e181,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index e2bcff0..7e2e20b 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb501=['name','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','User'];(function(_0x553f35,_0x18559e){var _0x1fa650=function(_0x592022){while(--_0x592022){_0x553f35['push'](_0x553f35['shift']());}};_0x1fa650(++_0x18559e);}(_0xb501,0x1d2));var _0x1b50=function(_0x2b190a,_0x14b59f){_0x2b190a=_0x2b190a-0x0;var _0x3b8b5f=_0xb501[_0x2b190a];return _0x3b8b5f;};'use strict';var client=require(_0x1b50('0x0'));exports[_0x1b50('0x1')]=function(){return function(){return client[_0x1b50('0x2')](_0x1b50('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x1b50('0x4'),'strategy'],'include':[{'model':_0x1b50('0x5'),'as':'Agents','attributes':['id',_0x1b50('0x6'),'online',_0x1b50('0x7')]}]},'log':_0x1b50('0x1')});};}; \ No newline at end of file +var _0xe4d4=['strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','name','timeout'];(function(_0x40500a,_0x5d0309){var _0x26e956=function(_0x577dfd){while(--_0x577dfd){_0x40500a['push'](_0x40500a['shift']());}};_0x26e956(++_0x5d0309);}(_0xe4d4,0x1d9));var _0x4e4d=function(_0x4081a8,_0x55a82c){_0x4081a8=_0x4081a8-0x0;var _0x438040=_0xe4d4[_0x4081a8];return _0x438040;};'use strict';var client=require(_0x4e4d('0x0'));exports[_0x4e4d('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x4e4d('0x2'),_0x4e4d('0x3'),_0x4e4d('0x4')],'include':[{'model':_0x4e4d('0x5'),'as':_0x4e4d('0x6'),'attributes':['id',_0x4e4d('0x2'),_0x4e4d('0x7'),_0x4e4d('0x8')]}]},'log':_0x4e4d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 9e7db0d..4f3c8bc 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa84=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0xa4aad6,_0x44f826){var _0x1acff2=function(_0x5f2704){while(--_0x5f2704){_0xa4aad6['push'](_0xa4aad6['shift']());}};_0x1acff2(++_0x44f826);}(_0xaa84,0x142));var _0x4aa8=function(_0x125223,_0x57ac63){_0x125223=_0x125223-0x0;var _0x30b294=_0xaa84[_0x125223];return _0x30b294;};'use strict';var client=require(_0x4aa8('0x0'));exports[_0x4aa8('0x1')]=function(_0x3868d8){return client[_0x4aa8('0x2')](_0x4aa8('0x3'),{'body':_0x3868d8,'log':'CreateWhatsappQueueReport'});};exports[_0x4aa8('0x4')]=function(_0x32794e,_0x35d20d){return client['Request'](_0x4aa8('0x5'),{'body':_0x35d20d,'options':{'where':{'uniqueid':_0x32794e},'order':[['id',_0x4aa8('0x6')]],'limit':0x1},'log':_0x4aa8('0x5')});}; \ No newline at end of file +var _0x8d21=['../client','create','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport'];(function(_0x8760b4,_0x4a1b0a){var _0xfd4277=function(_0x58464c){while(--_0x58464c){_0x8760b4['push'](_0x8760b4['shift']());}};_0xfd4277(++_0x4a1b0a);}(_0x8d21,0x1ea));var _0x18d2=function(_0x321034,_0x4fc8e3){_0x321034=_0x321034-0x0;var _0x1cf43f=_0x8d21[_0x321034];return _0x1cf43f;};'use strict';var client=require(_0x18d2('0x0'));exports[_0x18d2('0x1')]=function(_0x3c0380){return client[_0x18d2('0x2')](_0x18d2('0x3'),{'body':_0x3c0380,'log':_0x18d2('0x3')});};exports[_0x18d2('0x4')]=function(_0x218514,_0x51bdc6){return client[_0x18d2('0x2')]('UpdateWhatsappQueueReport',{'body':_0x51bdc6,'options':{'where':{'uniqueid':_0x218514},'order':[['id',_0x18d2('0x5')]],'limit':0x1},'log':_0x18d2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 68fc2ac..dce5e2d 100644 --- a/server/services/routing/server/applications/agent.js +++ b/server/services/routing/server/applications/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0097=['routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','map','message','join','stop','find','agents','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger'];(function(_0x1bca14,_0x42d99d){var _0x4c04da=function(_0x29a030){while(--_0x29a030){_0x1bca14['push'](_0x1bca14['shift']());}};_0x4c04da(++_0x42d99d);}(_0x0097,0x1c4));var _0x7009=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0097[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x7009('0x0'));var _=require(_0x7009('0x1'));var util=require(_0x7009('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x7009('0x3'))(_0x7009('0x4'));var strategy=require(_0x7009('0x5'));var queue=schema({'name':{'type':_0x7009('0x6'),'required':!![],'message':_0x7009('0x7')},'timeout':{'type':'number','message':_0x7009('0x8')}});function writeLog(_0x173600,_0x3685b4,_0x541b3e){return logger[_0x7009('0x9')](util[_0x7009('0xa')](_0x7009('0xb'),_0x173600,_0x3685b4[_0x7009('0xc')],_0x541b3e));}function handleFindAgent(_0x3aaf9c){return function(_0x53035f){return _0x53035f[_0x7009('0xc')]['toLowerCase']()===_0x3aaf9c[_0x7009('0xd')]();};}exports[_0x7009('0xe')]=function(_0x3fec28,_0x26fc6c,_0x5ad952,_0x9e15aa){return function(_0x2390ff){try{var _0x3bbb4b={'name':_0x26fc6c[0x0],'timeout':_0x26fc6c[0x1]};var _0x362cbf=queue[_0x7009('0x0')](_0x3bbb4b,{'typecast':!![]});if(_0x362cbf[_0x7009('0xf')]){logger['error']('[%s][AGENT]\x20%s',_0x3fec28,_[_0x7009('0x10')](_0x362cbf,_0x7009('0x11'))[_0x7009('0x12')](',\x20'));_0x2390ff[_0x7009('0x13')]();}else{var _0x44ffa1=_[_0x7009('0x14')](_0x5ad952[_0x7009('0x15')],handleFindAgent(_0x3bbb4b[_0x7009('0xc')]));if(_0x44ffa1){var _0x2593ff=(_0x3bbb4b['timeout']||0xa)*0x3e8;var _0x40a7ec,_0x577cf8;var _0x45012f=seqqueue[_0x7009('0x16')](_0x2593ff);_0x45012f['id']=_0x3fec28;_0x45012f[_0x7009('0x17')]=_0x2593ff;_0x45012f[_0x7009('0x18')]=_0x9e15aa[_0x7009('0x18')];writeLog(_0x3fec28,_0x44ffa1,util[_0x7009('0xa')](_0x7009('0x19'),_0x2593ff));_0x5ad952[_0x7009('0x1a')][_0x3fec28]['on'](_0x7009('0x1b'),function(){logger[_0x7009('0x9')](_0x7009('0x1c'),_0x3fec28);clearTimeout(_0x577cf8);_0x577cf8=undefined;_0x45012f[_0x7009('0x1d')]();if(_0x5ad952[_0x7009('0x1a')][_0x3fec28]){delete _0x5ad952[_0x7009('0x1a')][_0x3fec28];}_0x2390ff[_0x7009('0x13')]();});_0x5ad952[_0x7009('0x1a')][_0x3fec28]['on']('complete',function(){if(_0x5ad952[_0x7009('0x1a')][_0x3fec28]){delete _0x5ad952[_0x7009('0x1a')][_0x3fec28];}});_0x577cf8=setTimeout(function(){logger[_0x7009('0x9')](_0x7009('0x1e'),_0x3fec28);clearTimeout(_0x577cf8);_0x45012f[_0x7009('0x1d')]();_0x2390ff[_0x7009('0x1f')]();},_0x2593ff);strategy[_0x7009('0x20')](_0x45012f,_0x44ffa1,_0x5ad952,_0x9e15aa);}else{logger[_0x7009('0x21')](_0x7009('0x22'),_0x3fec28,_0x3bbb4b[_0x7009('0xc')]);_0x2390ff[_0x7009('0x13')]();}}}catch(_0x212750){console[_0x7009('0x23')](_0x212750);logger[_0x7009('0x21')](_0x7009('0x24'),_0x3fec28,_0x212750[_0x7009('0x25')]);_0x2390ff['stop']();}};}; \ No newline at end of file +var _0x8a72=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','channel','format','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','routing','string','timeout\x20is\x20a\x20number','info'];(function(_0x53bcb4,_0x290c5c){var _0x4502ad=function(_0x4a737b){while(--_0x4a737b){_0x53bcb4['push'](_0x53bcb4['shift']());}};_0x4502ad(++_0x290c5c);}(_0x8a72,0xe0));var _0x28a7=function(_0x434a17,_0x1fa202){_0x434a17=_0x434a17-0x0;var _0x1b9629=_0x8a72[_0x434a17];return _0x1b9629;};'use strict';var schema=require(_0x28a7('0x0'));var _=require(_0x28a7('0x1'));var util=require('util');var seqqueue=require(_0x28a7('0x2'));var logger=require('../../../../config/logger')(_0x28a7('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x28a7('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x28a7('0x5')}});function writeLog(_0x3f042e,_0x25595a,_0x6f6ef9){return logger[_0x28a7('0x6')](util['format'](_0x28a7('0x7'),_0x3f042e,_0x25595a[_0x28a7('0x8')],_0x6f6ef9));}function handleFindAgent(_0x62940e){return function(_0x831cac){return _0x831cac[_0x28a7('0x8')][_0x28a7('0x9')]()===_0x62940e[_0x28a7('0x9')]();};}exports['consequence']=function(_0x383502,_0xe3781d,_0x443932,_0x56c0e9){return function(_0x2db0a2){try{var _0x344ea1={'name':_0xe3781d[0x0],'timeout':_0xe3781d[0x1]};var _0x323fe4=queue[_0x28a7('0x0')](_0x344ea1,{'typecast':!![]});if(_0x323fe4['length']){logger[_0x28a7('0xa')](_0x28a7('0xb'),_0x383502,_[_0x28a7('0xc')](_0x323fe4,_0x28a7('0xd'))[_0x28a7('0xe')](',\x20'));_0x2db0a2[_0x28a7('0xf')]();}else{var _0x144e88=_[_0x28a7('0x10')](_0x443932['agents'],handleFindAgent(_0x344ea1['name']));if(_0x144e88){var _0x2cfd9c=(_0x344ea1[_0x28a7('0x11')]||0xa)*0x3e8;var _0x3f651e,_0x4501af;var _0x556faa=seqqueue[_0x28a7('0x12')](_0x2cfd9c);_0x556faa['id']=_0x383502;_0x556faa['atimeout']=_0x2cfd9c;_0x556faa[_0x28a7('0x13')]=_0x56c0e9[_0x28a7('0x13')];writeLog(_0x383502,_0x144e88,util[_0x28a7('0x14')](_0x28a7('0x15'),_0x2cfd9c));_0x443932[_0x28a7('0x16')][_0x383502]['on'](_0x28a7('0x17'),function(){logger[_0x28a7('0x6')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x383502);clearTimeout(_0x4501af);_0x4501af=undefined;_0x556faa[_0x28a7('0x18')]();if(_0x443932[_0x28a7('0x16')][_0x383502]){delete _0x443932['rules'][_0x383502];}_0x2db0a2['stop']();});_0x443932[_0x28a7('0x16')][_0x383502]['on'](_0x28a7('0x19'),function(){if(_0x443932[_0x28a7('0x16')][_0x383502]){delete _0x443932['rules'][_0x383502];}});_0x4501af=setTimeout(function(){logger[_0x28a7('0x6')](_0x28a7('0x1a'),_0x383502);clearTimeout(_0x4501af);_0x556faa[_0x28a7('0x18')]();_0x2db0a2[_0x28a7('0x1b')]();},_0x2cfd9c);strategy[_0x28a7('0x1c')](_0x556faa,_0x144e88,_0x443932,_0x56c0e9);}else{logger[_0x28a7('0xa')](_0x28a7('0x1d'),_0x383502,_0x344ea1[_0x28a7('0x8')]);_0x2db0a2[_0x28a7('0xf')]();}}}catch(_0x4d4f0c){console[_0x28a7('0x1e')](_0x4d4f0c);logger['error'](_0x28a7('0x1f'),_0x383502,_0x4d4f0c[_0x28a7('0x20')]);_0x2db0a2[_0x28a7('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index a23f46c..b7a67c5 100644 --- a/server/services/routing/server/applications/amazonlex.js +++ b/server/services/routing/server/applications/amazonlex.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf720=['../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','sms','whatsapp','channel','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x4d0bca,_0x4711aa){var _0x3a1dbd=function(_0x5a9c57){while(--_0x5a9c57){_0x4d0bca['push'](_0x4d0bca['shift']());}};_0x3a1dbd(++_0x4711aa);}(_0xf720,0x111));var _0x0f72=function(_0x4054c9,_0x31534f){_0x4054c9=_0x4054c9-0x0;var _0x3d7803=_0xf720[_0x4054c9];return _0x3d7803;};'use strict';var _=require(_0x0f72('0x0'));var moment=require(_0x0f72('0x1'));var AWS=require('aws-sdk');var utils=require(_0x0f72('0x2'));var logger=require(_0x0f72('0x3'))(_0x0f72('0x4'));var rpc={'chatMessage':require(_0x0f72('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0f72('0x6')),'smsMessage':require(_0x0f72('0x7')),'faxMessage':require(_0x0f72('0x8')),'whatsappMessage':require(_0x0f72('0x9'))};exports[_0x0f72('0xa')]=function(_0x433fb5,_0x5764a5){return function(_0x422bf7){try{if(!_['isNil'](this[_0x0f72('0xb')][_0x0f72('0xc')])){logger[_0x0f72('0xd')](_0x0f72('0xe'),_0x433fb5,_0x0f72('0xf'));return _0x422bf7[_0x0f72('0x10')]();}var _0x244e18={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x0f72('0x11')||this['channel']===_0x0f72('0x12')){_0x244e18['phone']=this[_0x0f72('0xb')]['phone'];}var _0x161118=this[_0x0f72('0x13')];if(_0x161118==='chat'){_0x244e18[_0x0f72('0x14')]=this[_0x0f72('0x15')]['id'];}else{_0x244e18[_[_0x0f72('0x16')](_0x161118)+'AccountId']=this['account']['id'];}_0x244e18[_[_0x0f72('0x16')](_0x161118)+_0x0f72('0x17')]=this[_0x0f72('0xb')]['id'];if(this[_0x0f72('0xb')][_0x0f72('0x18')]){var _0x25656e=_0x5764a5[0x4];if(!_[_0x0f72('0x19')](_0x25656e)){_0x244e18[_0x0f72('0x1a')]=utils[_0x0f72('0x1b')](_0x25656e,this);return rpc[_0x161118+_0x0f72('0x1c')][_0x0f72('0x1d')](_0x244e18)[_0x0f72('0x1e')](function(_0x30ca2a){logger[_0x0f72('0xd')]('[%s][AMAZONLEX]\x20%s',_0x433fb5,_0x244e18[_0x0f72('0x1a')]);})[_0x0f72('0x1f')](function(_0x2cb0f3){logger[_0x0f72('0x20')](_0x0f72('0xe'),_0x433fb5,JSON[_0x0f72('0x21')](_0x2cb0f3));})['finally'](function(){logger[_0x0f72('0xd')](_0x0f72('0x22'),_0x433fb5);_0x422bf7[_0x0f72('0x23')]();});}else{logger[_0x0f72('0xd')](_0x0f72('0x24'),_0x433fb5);_0x422bf7['stop']();}}else{var _0x5194f0=this;var _0x16448c=new AWS[(_0x0f72('0x25'))]({'accessKeyId':_0x5764a5[0x0],'secretAccessKey':_0x5764a5[0x1],'region':_0x5764a5[0x2]});var _0x18cf56={'botAlias':_0x0f72('0x26'),'botName':_0x5764a5[0x3],'inputText':this[_0x0f72('0x27')][_0x0f72('0x1a')],'userId':this['channel']+':'+this[_0x0f72('0xb')]['id'][_0x0f72('0x28')]()};_0x16448c[_0x0f72('0x29')](_0x18cf56,function(_0x35f8c0,_0x4d3a6b){if(_0x35f8c0){logger[_0x0f72('0x20')](_0x0f72('0xe'),_0x433fb5,_0x35f8c0[_0x0f72('0x27')]);_0x422bf7[_0x0f72('0x10')]();}else if(_0x4d3a6b&&_0x4d3a6b[_0x0f72('0x27')]){_0x5194f0[_0x0f72('0x1a')][_0x0f72('0x2a')]=_0x4d3a6b;_0x244e18[_0x0f72('0x1a')]=_0x4d3a6b[_0x0f72('0x27')];_0x244e18[_0x0f72('0x2b')]=_0x0f72('0x2a');_0x244e18[_0x0f72('0x2c')]=JSON['stringify'](_0x4d3a6b);return rpc[_0x161118+_0x0f72('0x1c')][_0x0f72('0x1d')](_0x244e18)['then'](function(_0x6c1b3d){logger[_0x0f72('0xd')]('[%s][AMAZONLEX]\x20%s',_0x433fb5,_0x244e18[_0x0f72('0x1a')]);if(_0x4d3a6b[_0x0f72('0x2d')]==_0x0f72('0x2e')){_0x422bf7['next']();}else{_0x422bf7[_0x0f72('0x23')]();}})[_0x0f72('0x1f')](function(_0x168027){logger['error']('[%s][AMAZONLEX]\x20%s',_0x433fb5,JSON[_0x0f72('0x21')](_0x168027));_0x422bf7[_0x0f72('0x10')]();});}else{_0x422bf7[_0x0f72('0x10')]();}});}}catch(_0x24ed5d){logger[_0x0f72('0x20')](_0x0f72('0xe'),_0x433fb5,JSON['stringify'](_0x24ed5d));_0x422bf7[_0x0f72('0x23')]();}};}; \ No newline at end of file +var _0xfa73=['lodash','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','message','next','providerName','amazonlex','providerResponse','stringify','dialogState'];(function(_0x32c384,_0x4e8067){var _0x4e0cdc=function(_0x456fb9){while(--_0x456fb9){_0x32c384['push'](_0x32c384['shift']());}};_0x4e0cdc(++_0x4e8067);}(_0xfa73,0x157));var _0x3fa7=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfa73[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x3fa7('0x0'));var moment=require('moment');var AWS=require(_0x3fa7('0x1'));var utils=require(_0x3fa7('0x2'));var logger=require('../../../../config/logger')(_0x3fa7('0x3'));var rpc={'chatMessage':require(_0x3fa7('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3fa7('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3fa7('0x6'))};exports[_0x3fa7('0x7')]=function(_0x21ef22,_0x252cdf){return function(_0x24f374){try{if(!_[_0x3fa7('0x8')](this[_0x3fa7('0x9')][_0x3fa7('0xa')])){logger['info'](_0x3fa7('0xb'),_0x21ef22,_0x3fa7('0xc'));return _0x24f374['next']();}var _0x1b5cdd={'ContactId':this[_0x3fa7('0xd')]['id'],'sentAt':moment()[_0x3fa7('0xe')](_0x3fa7('0xf')),'direction':_0x3fa7('0x10')};if(this[_0x3fa7('0x11')]==='sms'||this['channel']===_0x3fa7('0x12')){_0x1b5cdd[_0x3fa7('0x13')]=this['interaction']['phone'];}var _0x4ae9ad=this['channel'];if(_0x4ae9ad===_0x3fa7('0x14')){_0x1b5cdd[_0x3fa7('0x15')]=this[_0x3fa7('0x16')]['id'];}else{_0x1b5cdd[_[_0x3fa7('0x17')](_0x4ae9ad)+_0x3fa7('0x18')]=this['account']['id'];}_0x1b5cdd[_[_0x3fa7('0x17')](_0x4ae9ad)+_0x3fa7('0x19')]=this[_0x3fa7('0x9')]['id'];if(this[_0x3fa7('0x9')][_0x3fa7('0x1a')]){var _0x2110b6=_0x252cdf[0x4];if(!_[_0x3fa7('0x1b')](_0x2110b6)){_0x1b5cdd[_0x3fa7('0x1c')]=utils[_0x3fa7('0x1d')](_0x2110b6,this);return rpc[_0x4ae9ad+_0x3fa7('0x1e')][_0x3fa7('0x1f')](_0x1b5cdd)[_0x3fa7('0x20')](function(_0x34e3c9){logger[_0x3fa7('0x21')]('[%s][AMAZONLEX]\x20%s',_0x21ef22,_0x1b5cdd[_0x3fa7('0x1c')]);})[_0x3fa7('0x22')](function(_0x47ff6c){logger[_0x3fa7('0x23')]('[%s][AMAZONLEX]\x20%s',_0x21ef22,JSON['stringify'](_0x47ff6c));})[_0x3fa7('0x24')](function(){logger['info'](_0x3fa7('0x25'),_0x21ef22);_0x24f374[_0x3fa7('0x26')]();});}else{logger[_0x3fa7('0x21')](_0x3fa7('0x27'),_0x21ef22);_0x24f374['stop']();}}else{var _0x4bef99=this;var _0x241a1b=new AWS[(_0x3fa7('0x28'))]({'accessKeyId':_0x252cdf[0x0],'secretAccessKey':_0x252cdf[0x1],'region':_0x252cdf[0x2]});var _0x5da3bb={'botAlias':'$LATEST','botName':_0x252cdf[0x3],'inputText':this['message'][_0x3fa7('0x1c')],'userId':this['channel']+':'+this[_0x3fa7('0x9')]['id'][_0x3fa7('0x29')]()};_0x241a1b['postText'](_0x5da3bb,function(_0x2674c1,_0x5b2bc0){if(_0x2674c1){logger['error'](_0x3fa7('0xb'),_0x21ef22,_0x2674c1[_0x3fa7('0x2a')]);_0x24f374[_0x3fa7('0x2b')]();}else if(_0x5b2bc0&&_0x5b2bc0[_0x3fa7('0x2a')]){_0x4bef99[_0x3fa7('0x1c')]['amazonlex']=_0x5b2bc0;_0x1b5cdd[_0x3fa7('0x1c')]=_0x5b2bc0['message'];_0x1b5cdd[_0x3fa7('0x2c')]=_0x3fa7('0x2d');_0x1b5cdd[_0x3fa7('0x2e')]=JSON[_0x3fa7('0x2f')](_0x5b2bc0);return rpc[_0x4ae9ad+_0x3fa7('0x1e')][_0x3fa7('0x1f')](_0x1b5cdd)[_0x3fa7('0x20')](function(_0x29fdc3){logger[_0x3fa7('0x21')](_0x3fa7('0xb'),_0x21ef22,_0x1b5cdd[_0x3fa7('0x1c')]);if(_0x5b2bc0[_0x3fa7('0x30')]=='Failed'){_0x24f374[_0x3fa7('0x2b')]();}else{_0x24f374[_0x3fa7('0x26')]();}})[_0x3fa7('0x22')](function(_0x491ab1){logger[_0x3fa7('0x23')]('[%s][AMAZONLEX]\x20%s',_0x21ef22,JSON[_0x3fa7('0x2f')](_0x491ab1));_0x24f374[_0x3fa7('0x2b')]();});}else{_0x24f374[_0x3fa7('0x2b')]();}});}}catch(_0x294e5e){logger[_0x3fa7('0x23')](_0x3fa7('0xb'),_0x21ef22,JSON[_0x3fa7('0x2f')](_0x294e5e));_0x24f374[_0x3fa7('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index e494444..0bba8b2 100644 --- a/server/services/routing/server/applications/autoreply.js +++ b/server/services/routing/server/applications/autoreply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2c1=['then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','update','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','inReplyTo','messageId','','';_0x24c1e5[_0x1c2c('0x35')]={'Auto-Submitted':_0x1c2c('0x36'),'X-Auto-Response-Suppress':_0x1c2c('0x37'),'Precedence':_0x1c2c('0x38')};return mailRpc[_0x1c2c('0x39')](this[_0x1c2c('0x2e')][_0x1c2c('0x3a')],_0x24c1e5)['then'](function(_0x14cde3){logger[_0x1c2c('0x12')](_0x1c2c('0x3b'),_0x180456);_0x24c1e5[_0x1c2c('0x31')]=_0x14cde3[_0x1c2c('0x22')][_0x1c2c('0x31')];return rpc[_0x16a0d4+_0x1c2c('0x3c')]['create'](_0x24c1e5);})[_0x1c2c('0x3d')](function(_0x1c7db6){logger[_0x1c2c('0x12')](_0x1c2c('0x13'),_0x180456,JSON[_0x1c2c('0x3e')](_0x1c7db6));})[_0x1c2c('0x3f')](function(_0x1593be){logger[_0x1c2c('0x40')](_0x1c2c('0x41'),_0x180456,JSON[_0x1c2c('0x3e')](_0x1593be));})[_0x1c2c('0x42')](function(){Promise[_0x1c2c('0x43')]()['then'](function(){if(_0x16bada[0x0]!=='2'||_0x247344[_0x1c2c('0x19')])return;return rpc[_0x16a0d4+_0x1c2c('0x44')]['update'](_0x247344['id'],{'autoreplyExecuted':!![]})[_0x1c2c('0x3d')](function(_0x4153b1){logger[_0x1c2c('0x12')](_0x1c2c('0x1a'),_0x180456,JSON[_0x1c2c('0x3e')](_0x4153b1));})[_0x1c2c('0x3f')](function(_0x4efb43){logger[_0x1c2c('0x40')](_0x1c2c('0x45'),_0x180456,JSON[_0x1c2c('0x3e')](_0x4efb43));});})[_0x1c2c('0x3d')](function(){_0x118c70[_0x1c2c('0x14')]();});});}else{return rpc[this['channel']+_0x1c2c('0x3c')][_0x1c2c('0x46')](_0x24c1e5)[_0x1c2c('0x3d')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x180456,_0x24c1e5['body']);})[_0x1c2c('0x3f')](function(_0x32c4cb){logger[_0x1c2c('0x40')](_0x1c2c('0x13'),_0x180456,JSON[_0x1c2c('0x3e')](_0x32c4cb));})[_0x1c2c('0x42')](function(){Promise[_0x1c2c('0x43')]()[_0x1c2c('0x3d')](function(){if(_0x16bada[0x0]!=='2'||_0x247344['autoreplyExecuted'])return;return rpc[_0x16a0d4+_0x1c2c('0x44')][_0x1c2c('0x47')](_0x247344['id'],{'autoreplyExecuted':!![]})[_0x1c2c('0x3d')](function(_0x279263){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x180456,JSON['stringify'](_0x279263));})['catch'](function(_0xc004f6){logger[_0x1c2c('0x40')](_0x1c2c('0x45'),_0x180456,JSON[_0x1c2c('0x3e')](_0xc004f6));});})[_0x1c2c('0x3d')](function(){_0x118c70[_0x1c2c('0x14')]();});});}}}catch(_0x345b8b){logger[_0x1c2c('0x40')](_0x1c2c('0x13'),_0x180456,JSON[_0x1c2c('0x3e')](_0x345b8b));_0x118c70[_0x1c2c('0x48')]();}};}; \ No newline at end of file +var _0xc3ac=['./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','body','getMustacheRender','message','from','phone','read','subject','Re:','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','messageId','','replace','';_0x44f5c8[_0xcc3a('0x2d')]={'Auto-Submitted':_0xcc3a('0x2e'),'X-Auto-Response-Suppress':_0xcc3a('0x2f'),'Precedence':_0xcc3a('0x30')};return mailRpc[_0xcc3a('0x31')](this['account'][_0xcc3a('0x32')],_0x44f5c8)['then'](function(_0x3e27bd){logger[_0xcc3a('0xf')](_0xcc3a('0x33'),_0xda1523);_0x44f5c8[_0xcc3a('0x28')]=_0x3e27bd[_0xcc3a('0x1c')][_0xcc3a('0x28')];return rpc[_0x2e5ac8+'Message'][_0xcc3a('0x34')](_0x44f5c8);})[_0xcc3a('0x35')](function(_0x2a1970){logger[_0xcc3a('0xf')](_0xcc3a('0x10'),_0xda1523,JSON[_0xcc3a('0x36')](_0x2a1970));})[_0xcc3a('0x37')](function(_0x3e96eb){logger[_0xcc3a('0x38')]('[RPC][%s][AUTOREPLY]\x20%s',_0xda1523,JSON[_0xcc3a('0x36')](_0x3e96eb));})[_0xcc3a('0x39')](function(){Promise[_0xcc3a('0x3a')]()[_0xcc3a('0x35')](function(){if(_0x3008c4[0x0]!=='2'||_0x10843f['autoreplyExecuted'])return;return rpc[_0x2e5ac8+_0xcc3a('0x3b')][_0xcc3a('0x3c')](_0x10843f['id'],{'autoreplyExecuted':!![]})[_0xcc3a('0x35')](function(_0x52416b){logger[_0xcc3a('0xf')](_0xcc3a('0x3d'),_0xda1523,JSON[_0xcc3a('0x36')](_0x52416b));})[_0xcc3a('0x37')](function(_0x53ddbc){logger[_0xcc3a('0x38')](_0xcc3a('0x3e'),_0xda1523,JSON['stringify'](_0x53ddbc));});})[_0xcc3a('0x35')](function(){_0x12ce83[_0xcc3a('0x11')]();});});}else{return rpc[this['channel']+'Message'][_0xcc3a('0x34')](_0x44f5c8)[_0xcc3a('0x35')](function(){logger[_0xcc3a('0xf')](_0xcc3a('0x10'),_0xda1523,_0x44f5c8[_0xcc3a('0x1a')]);})[_0xcc3a('0x37')](function(_0x40dfae){logger['error']('[%s][AUTOREPLY]\x20%s',_0xda1523,JSON[_0xcc3a('0x36')](_0x40dfae));})['finally'](function(){Promise['resolve']()[_0xcc3a('0x35')](function(){if(_0x3008c4[0x0]!=='2'||_0x10843f[_0xcc3a('0x3f')])return;return rpc[_0x2e5ac8+_0xcc3a('0x3b')][_0xcc3a('0x3c')](_0x10843f['id'],{'autoreplyExecuted':!![]})[_0xcc3a('0x35')](function(_0x15b5cf){logger[_0xcc3a('0xf')](_0xcc3a('0x3d'),_0xda1523,JSON[_0xcc3a('0x36')](_0x15b5cf));})[_0xcc3a('0x37')](function(_0x579f18){logger[_0xcc3a('0x38')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xda1523,JSON[_0xcc3a('0x36')](_0x579f18));});})[_0xcc3a('0x35')](function(){_0x12ce83[_0xcc3a('0x11')]();});});}}}catch(_0x5c7f25){logger[_0xcc3a('0x38')](_0xcc3a('0x10'),_0xda1523,JSON[_0xcc3a('0x36')](_0x5c7f25));_0x12ce83[_0xcc3a('0x40')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index b3e2977..a6c6cff 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e0f=['update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','format','system','channel','Interaction'];(function(_0x298b4e,_0x44a36f){var _0xfba485=function(_0x591ae2){while(--_0x591ae2){_0x298b4e['push'](_0x298b4e['shift']());}};_0xfba485(++_0x44a36f);}(_0x9e0f,0xbd));var _0xf9e0=function(_0x1d6317,_0x3ddfcb){_0x1d6317=_0x1d6317-0x0;var _0x244707=_0x9e0f[_0x1d6317];return _0x244707;};'use strict';var moment=require(_0xf9e0('0x0'));var logger=require(_0xf9e0('0x1'))(_0xf9e0('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf9e0('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xf9e0('0x4')),'faxInteraction':require(_0xf9e0('0x5')),'whatsappInteraction':require(_0xf9e0('0x6'))};exports['consequence']=function(_0x146f73,_0x5f2b56,_0x5f2c99,_0x2ce44a){return function(_0x666c4){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x146f73,_0x5f2b56[0x0]);var _0x4efb45={'closed':0x1,'closedAt':moment()[_0xf9e0('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xf9e0('0x8'),'disposition':_0x5f2b56[0x0]};if(rpc[_0x2ce44a[_0xf9e0('0x9')]+_0xf9e0('0xa')]){rpc[_0x2ce44a[_0xf9e0('0x9')]+_0xf9e0('0xa')][_0xf9e0('0xb')](_0x2ce44a[_0xf9e0('0xc')]['id'],_0x4efb45)[_0xf9e0('0xd')](function(_0x45bc23){logger['info'](_0xf9e0('0xe'),_0x146f73,_0x2ce44a[_0xf9e0('0xc')]['id']);})['catch'](function(_0x1e3e08){logger[_0xf9e0('0xf')](_0xf9e0('0x10'),_0x146f73,JSON['stringify'](_0x1e3e08));})[_0xf9e0('0x11')](function(){_0x666c4[_0xf9e0('0x12')]();});}}catch(_0x1b9547){logger['error'](_0xf9e0('0x10'),_0x146f73,JSON[_0xf9e0('0x13')](_0x1b9547));_0x666c4[_0xf9e0('0x12')]();}};}; \ No newline at end of file +var _0x78bf=['error','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!'];(function(_0x154183,_0x25d4d2){var _0x579e8d=function(_0x34ed0c){while(--_0x34ed0c){_0x154183['push'](_0x154183['shift']());}};_0x579e8d(++_0x25d4d2);}(_0x78bf,0xbc));var _0xf78b=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0x78bf[_0x127a60];return _0xc1f6a3;};'use strict';var moment=require(_0xf78b('0x0'));var logger=require(_0xf78b('0x1'))(_0xf78b('0x2'));var rpc={'chatInteraction':require(_0xf78b('0x3')),'openchannelInteraction':require(_0xf78b('0x4')),'smsInteraction':require(_0xf78b('0x5')),'mailInteraction':require(_0xf78b('0x6')),'faxInteraction':require(_0xf78b('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xf78b('0x8')]=function(_0x49a634,_0x5edb8f,_0x33da1b,_0x55dcdb){return function(_0x1855a7){try{logger['info'](_0xf78b('0x9'),_0x49a634,_0x5edb8f[0x0]);var _0x531db6={'closed':0x1,'closedAt':moment()[_0xf78b('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xf78b('0xb'),'disposition':_0x5edb8f[0x0]};if(rpc[_0x55dcdb[_0xf78b('0xc')]+_0xf78b('0xd')]){rpc[_0x55dcdb[_0xf78b('0xc')]+_0xf78b('0xd')][_0xf78b('0xe')](_0x55dcdb[_0xf78b('0xf')]['id'],_0x531db6)[_0xf78b('0x10')](function(_0xf7ff30){logger[_0xf78b('0x11')](_0xf78b('0x12'),_0x49a634,_0x55dcdb[_0xf78b('0xf')]['id']);})['catch'](function(_0x11391a){logger[_0xf78b('0x13')]('[%s][CLOSE]\x20%s',_0x49a634,JSON[_0xf78b('0x14')](_0x11391a));})[_0xf78b('0x15')](function(){_0x1855a7[_0xf78b('0x16')]();});}}catch(_0x804d43){logger['error']('[%s][CLOSE]\x20%s',_0x49a634,JSON['stringify'](_0x804d43));_0x1855a7[_0xf78b('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 22e8509..1cc777b 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1fc=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','create','body','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','then','dialogflow','fulfillment','speech','providerName','providerResponse','result','metadata','message','moment','apiai-promise','./utils'];(function(_0x4775da,_0x1fc72a){var _0x1352ab=function(_0x345b76){while(--_0x345b76){_0x4775da['push'](_0x4775da['shift']());}};_0x1352ab(++_0x1fc72a);}(_0xc1fc,0x93));var _0xcc1f=function(_0x59b86f,_0x58a8d7){_0x59b86f=_0x59b86f-0x0;var _0x35d545=_0xc1fc[_0x59b86f];return _0x35d545;};'use strict';var _=require('lodash');var moment=require(_0xcc1f('0x0'));var apiai=require(_0xcc1f('0x1'));var md5=require('md5');var utils=require(_0xcc1f('0x2'));var logger=require(_0xcc1f('0x3'))(_0xcc1f('0x4'));var rpc={'chatMessage':require(_0xcc1f('0x5')),'openchannelMessage':require(_0xcc1f('0x6')),'mailMessage':require(_0xcc1f('0x7')),'smsMessage':require(_0xcc1f('0x8')),'faxMessage':require(_0xcc1f('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x376348,_0x4516e3){return function(_0x431ca8){try{if(!_[_0xcc1f('0xa')](this[_0xcc1f('0xb')]['UserId'])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x376348,_0xcc1f('0xc'));return _0x431ca8[_0xcc1f('0xd')]();}var _0x256283={'ContactId':this[_0xcc1f('0xe')]['id'],'sentAt':moment()[_0xcc1f('0xf')](_0xcc1f('0x10')),'direction':_0xcc1f('0x11')};if(this[_0xcc1f('0x12')]===_0xcc1f('0x13')||this['channel']===_0xcc1f('0x14')){_0x256283[_0xcc1f('0x15')]=this[_0xcc1f('0xb')][_0xcc1f('0x15')];}var _0x9842de=this[_0xcc1f('0x12')];if(_0x9842de===_0xcc1f('0x16')){_0x256283['ChatWebsiteId']=this[_0xcc1f('0x17')]['id'];}else{_0x256283[_[_0xcc1f('0x18')](_0x9842de)+_0xcc1f('0x19')]=this[_0xcc1f('0x17')]['id'];}_0x256283[_[_0xcc1f('0x18')](_0x9842de)+_0xcc1f('0x1a')]=this[_0xcc1f('0xb')]['id'];if(this[_0xcc1f('0xb')][_0xcc1f('0x1b')]){var _0x7bad52=_0x4516e3[0x2];if(!_['isEmpty'](_0x7bad52)){_0x256283['body']=utils[_0xcc1f('0x1c')](_0x7bad52,this);return rpc[_0x9842de+_0xcc1f('0x1d')][_0xcc1f('0x1e')](_0x256283)['then'](function(_0x314d9d){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x376348,_0x256283[_0xcc1f('0x1f')]);})[_0xcc1f('0x20')](function(_0x5ed11c){logger[_0xcc1f('0x21')](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x5ed11c));})[_0xcc1f('0x24')](function(){logger[_0xcc1f('0x25')](_0xcc1f('0x26'),_0x376348);_0x431ca8['stop']();});}else{logger[_0xcc1f('0x25')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x376348);_0x431ca8[_0xcc1f('0x27')]();}}else{var _0x310c2e=this;var _0x1a00d4=apiai(_0x4516e3[0x0],{'language':_0x4516e3[0x1]||'en'});return _0x1a00d4[_0xcc1f('0x28')](this['message'][_0xcc1f('0x1f')],{'sessionId':md5(this[_0xcc1f('0xb')]['id'])})[_0xcc1f('0x29')](function(_0x257e7f){_0x310c2e[_0xcc1f('0x1f')][_0xcc1f('0x2a')]=_0x257e7f;_0x256283[_0xcc1f('0x1f')]=_0x257e7f['result'][_0xcc1f('0x2b')][_0xcc1f('0x2c')];_0x256283[_0xcc1f('0x2d')]=_0xcc1f('0x2a');_0x256283[_0xcc1f('0x2e')]=JSON[_0xcc1f('0x23')](_0x257e7f);return rpc[_0x9842de+_0xcc1f('0x1d')][_0xcc1f('0x1e')](_0x256283)['then'](function(_0x4461d5){logger[_0xcc1f('0x25')](_0xcc1f('0x22'),_0x376348,_0x256283[_0xcc1f('0x1f')]);if(_0x257e7f[_0xcc1f('0x2f')][_0xcc1f('0x30')]['endConversation']){_0x431ca8[_0xcc1f('0xd')]();}else{_0x431ca8[_0xcc1f('0x27')]();}})['catch'](function(_0x3bd35c){logger['error'](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x3bd35c));_0x431ca8[_0xcc1f('0xd')]();});})[_0xcc1f('0x20')](function(_0x54211b){logger['error'](_0xcc1f('0x22'),_0x376348,_0x54211b[_0xcc1f('0x31')]);_0x431ca8[_0xcc1f('0xd')]();});}}catch(_0x53220d){logger[_0xcc1f('0x21')](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x53220d));_0x431ca8['stop']();}};}; \ No newline at end of file +var _0x31af=['info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','body','catch','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','endConversation','error','stop','lodash','moment','apiai-promise','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId'];(function(_0x3ebe02,_0x1d0d72){var _0x9e3bda=function(_0x3b4434){while(--_0x3b4434){_0x3ebe02['push'](_0x3ebe02['shift']());}};_0x9e3bda(++_0x1d0d72);}(_0x31af,0xde));var _0xf31a=function(_0x3395b1,_0x3dc307){_0x3395b1=_0x3395b1-0x0;var _0x5836b3=_0x31af[_0x3395b1];return _0x5836b3;};'use strict';var _=require(_0xf31a('0x0'));var moment=require(_0xf31a('0x1'));var apiai=require(_0xf31a('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require(_0xf31a('0x3'))('routing');var rpc={'chatMessage':require(_0xf31a('0x4')),'openchannelMessage':require(_0xf31a('0x5')),'mailMessage':require(_0xf31a('0x6')),'smsMessage':require(_0xf31a('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf31a('0x8'))};exports[_0xf31a('0x9')]=function(_0x405926,_0x1dc7cc){return function(_0x47b7a1){try{if(!_[_0xf31a('0xa')](this[_0xf31a('0xb')][_0xf31a('0xc')])){logger[_0xf31a('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x405926,_0xf31a('0xe'));return _0x47b7a1[_0xf31a('0xf')]();}var _0xcff55c={'ContactId':this[_0xf31a('0x10')]['id'],'sentAt':moment()[_0xf31a('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf31a('0x12')};if(this[_0xf31a('0x13')]===_0xf31a('0x14')||this[_0xf31a('0x13')]==='whatsapp'){_0xcff55c[_0xf31a('0x15')]=this[_0xf31a('0xb')]['phone'];}var _0x355f32=this[_0xf31a('0x13')];if(_0x355f32===_0xf31a('0x16')){_0xcff55c[_0xf31a('0x17')]=this[_0xf31a('0x18')]['id'];}else{_0xcff55c[_[_0xf31a('0x19')](_0x355f32)+_0xf31a('0x1a')]=this[_0xf31a('0x18')]['id'];}_0xcff55c[_[_0xf31a('0x19')](_0x355f32)+_0xf31a('0x1b')]=this[_0xf31a('0xb')]['id'];if(this[_0xf31a('0xb')][_0xf31a('0x1c')]){var _0xccfd8b=_0x1dc7cc[0x2];if(!_[_0xf31a('0x1d')](_0xccfd8b)){_0xcff55c['body']=utils[_0xf31a('0x1e')](_0xccfd8b,this);return rpc[_0x355f32+_0xf31a('0x1f')][_0xf31a('0x20')](_0xcff55c)[_0xf31a('0x21')](function(_0x4c3589){logger[_0xf31a('0xd')](_0xf31a('0x22'),_0x405926,_0xcff55c[_0xf31a('0x23')]);})[_0xf31a('0x24')](function(_0x18a97c){logger['error'](_0xf31a('0x22'),_0x405926,JSON[_0xf31a('0x25')](_0x18a97c));})['finally'](function(){logger[_0xf31a('0xd')](_0xf31a('0x26'),_0x405926);_0x47b7a1['stop']();});}else{logger[_0xf31a('0xd')](_0xf31a('0x27'),_0x405926);_0x47b7a1['stop']();}}else{var _0x5724b3=this;var _0x534317=apiai(_0x1dc7cc[0x0],{'language':_0x1dc7cc[0x1]||'en'});return _0x534317[_0xf31a('0x28')](this[_0xf31a('0x29')]['body'],{'sessionId':md5(this[_0xf31a('0xb')]['id'])})[_0xf31a('0x21')](function(_0x5d08ee){_0x5724b3[_0xf31a('0x23')]['dialogflow']=_0x5d08ee;_0xcff55c['body']=_0x5d08ee[_0xf31a('0x2a')][_0xf31a('0x2b')]['speech'];_0xcff55c['providerName']='dialogflow';_0xcff55c['providerResponse']=JSON[_0xf31a('0x25')](_0x5d08ee);return rpc[_0x355f32+_0xf31a('0x1f')][_0xf31a('0x20')](_0xcff55c)['then'](function(_0x2281c5){logger[_0xf31a('0xd')](_0xf31a('0x22'),_0x405926,_0xcff55c[_0xf31a('0x23')]);if(_0x5d08ee[_0xf31a('0x2a')]['metadata'][_0xf31a('0x2c')]){_0x47b7a1[_0xf31a('0xf')]();}else{_0x47b7a1['stop']();}})['catch'](function(_0x203f28){logger[_0xf31a('0x2d')]('[%s][DIALOGFLOW]\x20%s',_0x405926,JSON[_0xf31a('0x25')](_0x203f28));_0x47b7a1[_0xf31a('0xf')]();});})[_0xf31a('0x24')](function(_0x5385ba){logger[_0xf31a('0x2d')](_0xf31a('0x22'),_0x405926,_0x5385ba[_0xf31a('0x29')]);_0x47b7a1[_0xf31a('0xf')]();});}}catch(_0xbddc3b){logger[_0xf31a('0x2d')]('[%s][DIALOGFLOW]\x20%s',_0x405926,JSON[_0xf31a('0x25')](_0xbddc3b));_0x47b7a1[_0xf31a('0x2e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index f17a298..3404381 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6805=['end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','name','intent','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','queryText','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','stack','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields'];(function(_0x41f727,_0x3ae951){var _0x5783a6=function(_0x5b4d50){while(--_0x5b4d50){_0x41f727['push'](_0x41f727['shift']());}};_0x5783a6(++_0x3ae951);}(_0x6805,0x181));var _0x5680=function(_0x2cebb7,_0x4b1471){_0x2cebb7=_0x2cebb7-0x0;var _0x5acabe=_0x6805[_0x2cebb7];return _0x5acabe;};'use strict';var _=require(_0x5680('0x0'));var dialogflow=require(_0x5680('0x1'));var md5=require(_0x5680('0x2'));var moment=require('moment');var Promise=require(_0x5680('0x3'));var logger=require(_0x5680('0x4'))(_0x5680('0x5'));var utils=require(_0x5680('0x6'));var rpc={'chatMessage':require(_0x5680('0x7')),'openchannelMessage':require(_0x5680('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5680('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5680('0xa'))};function createMessage(_0x49b0ec,_0x1ef8cc,_0x368c19,_0xf12767){return new Promise(function(_0x20c856,_0x477774){var _0x3da8ed=_[_0x5680('0xb')](_0x368c19);_0x3da8ed['body']=_0xf12767;return rpc[_0x1ef8cc+_0x5680('0xc')]['create'](_0x3da8ed)[_0x5680('0xd')](function(){logger[_0x5680('0xe')](_0x5680('0xf'),_0x49b0ec,_0x3da8ed[_0x5680('0x10')]);_0x20c856();})[_0x5680('0x11')](function(_0x181389){logger[_0x5680('0x12')](_0x5680('0xf'),_0x49b0ec,JSON[_0x5680('0x13')](_0x181389));_0x477774(_0x181389);});});}exports[_0x5680('0x14')]=function(_0x482cd0,_0x1cac8f){return function(_0x35c35d){try{if(!_[_0x5680('0x15')](this[_0x5680('0x16')][_0x5680('0x17')])){logger[_0x5680('0xe')](_0x5680('0xf'),_0x482cd0,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x35c35d[_0x5680('0x18')]();}var _0x12538d={'ContactId':this[_0x5680('0x19')]['id'],'sentAt':moment()[_0x5680('0x1a')](_0x5680('0x1b')),'direction':_0x5680('0x1c')};if(this[_0x5680('0x1d')]==='sms'||this[_0x5680('0x1d')]===_0x5680('0x1e')){_0x12538d[_0x5680('0x1f')]=this[_0x5680('0x16')][_0x5680('0x1f')];}var _0x24430f=this['channel'];if(_0x24430f===_0x5680('0x20')){_0x12538d[_0x5680('0x21')]=this[_0x5680('0x22')]['id'];}else{_0x12538d[_[_0x5680('0x23')](_0x24430f)+_0x5680('0x24')]=this[_0x5680('0x22')]['id'];}_0x12538d[_['upperFirst'](_0x24430f)+'InteractionId']=this[_0x5680('0x16')]['id'];if(this[_0x5680('0x16')][_0x5680('0x25')]){var _0x4e483e=_0x1cac8f[0x4];if(!_[_0x5680('0x26')](_0x4e483e)){_0x12538d[_0x5680('0x10')]=utils[_0x5680('0x27')](_0x4e483e,this);return rpc[_0x24430f+_0x5680('0xc')]['create'](_0x12538d)[_0x5680('0xd')](function(_0x354a9e){logger[_0x5680('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x482cd0,_0x12538d['body']);})[_0x5680('0x11')](function(_0x24a196){logger[_0x5680('0x12')](_0x5680('0xf'),_0x482cd0,JSON[_0x5680('0x13')](_0x24a196));})[_0x5680('0x28')](function(){logger[_0x5680('0xe')](_0x5680('0x29'),_0x482cd0);_0x35c35d[_0x5680('0x2a')]();});}else{logger[_0x5680('0xe')](_0x5680('0x2b'),_0x482cd0);_0x35c35d[_0x5680('0x2a')]();}}else{var _0x2d8cff=this;var _0x174963=_0x1cac8f[0x2][_0x5680('0x2c')](/\\n/g,'\x0a');var _0xcc65c={'credentials':{'private_key':_0x174963,'client_email':_0x1cac8f[0x1]}};var _0x2f5baf=new dialogflow[(_0x5680('0x2d'))](_0xcc65c);var _0x3b0da4=_0x2f5baf[_0x5680('0x2e')](_0x1cac8f[0x0],md5(_0x2d8cff[_0x5680('0x16')]['id']));var _0x59574d={'session':_0x3b0da4,'queryInput':{'text':{'text':_0x2d8cff['message']['body'],'languageCode':_0x1cac8f[0x3]||'en'}}};return _0x2f5baf[_0x5680('0x2f')](_0x59574d)[_0x5680('0xd')](function(_0x473e00){if(_0x473e00&&_0x473e00[_0x5680('0x30')]){_0x2d8cff[_0x5680('0x10')][_0x5680('0x31')]=_0x473e00;var _0x3a14ec=_0x473e00[0x0];var _0x4d898f=_0x3a14ec[_0x5680('0x32')]['diagnosticInfo']&&_0x3a14ec[_0x5680('0x32')][_0x5680('0x33')][_0x5680('0x34')]?_0x3a14ec[_0x5680('0x32')]['diagnosticInfo'][_0x5680('0x34')][_0x5680('0x35')]['boolValue']:![];_0x2d8cff[_0x5680('0x10')][_0x5680('0x36')]=_0x3a14ec[_0x5680('0x32')][_0x5680('0x37')];_0x2d8cff['body'][_0x5680('0x38')]=_0x3a14ec['queryResult'][_0x5680('0x39')];_0x2d8cff[_0x5680('0x10')][_0x5680('0x3a')]=_0x3a14ec['queryResult']['diagnosticInfo']&&_0x3a14ec[_0x5680('0x32')]['diagnosticInfo']['fields']?_0x3a14ec[_0x5680('0x32')][_0x5680('0x33')][_0x5680('0x34')][_0x5680('0x35')][_0x5680('0x3b')]:![];_0x2d8cff[_0x5680('0x10')][_0x5680('0x3c')]=_0x3a14ec[_0x5680('0x32')]['intent'][_0x5680('0x3d')];_0x2d8cff['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3a14ec[_0x5680('0x32')][_0x5680('0x3e')]['displayName'];_0x2d8cff[_0x5680('0x10')][_0x5680('0x3f')]=_0x3a14ec['queryResult']['intent']['isFallback'];_0x2d8cff['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x3a14ec[_0x5680('0x32')][_0x5680('0x40')];_0x2d8cff['body']['DIALOGFLOWV2_QUERYTEXT']=_0x3a14ec['queryResult'][_0x5680('0x41')];_0x2d8cff[_0x5680('0x10')]['DIALOGFLOWV2_SCORE']=_0x3a14ec[_0x5680('0x32')][_0x5680('0x42')];_0x12538d[_0x5680('0x43')]=_0x5680('0x31');_0x12538d[_0x5680('0x44')]=JSON['stringify'](_0x473e00);var _0x44043b=[];for(var _0x29f913=0x0;_0x29f913<_0x473e00[_0x5680('0x30')];_0x29f913++){var _0x2e3fb2=_0x473e00[_0x29f913];if(_0x2e3fb2&&_0x2e3fb2[_0x5680('0x32')]&&_0x2e3fb2[_0x5680('0x32')]['fulfillmentText']){_0x44043b[_0x5680('0x45')](createMessage(_0x482cd0,_0x24430f,_0x12538d,_0x2e3fb2[_0x5680('0x32')][_0x5680('0x46')]));}}return Promise[_0x5680('0x47')](_0x44043b)[_0x5680('0xd')](function(){if(_0x4d898f){_0x35c35d[_0x5680('0x18')]();}else{_0x35c35d['stop']();}})[_0x5680('0x11')](function(_0x1dec8f){logger[_0x5680('0x12')](_0x5680('0xf'),_0x482cd0,JSON[_0x5680('0x13')](_0x1dec8f));_0x35c35d[_0x5680('0x18')]();});}})[_0x5680('0x11')](function(_0x513bdd){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x482cd0,_0x513bdd['message'],_0x513bdd[_0x5680('0x48')]);_0x35c35d[_0x5680('0x18')]();});}}catch(_0x69171b){logger['error'](_0x5680('0xf'),_0x482cd0,JSON[_0x5680('0x13')](_0x69171b));_0x35c35d[_0x5680('0x2a')]();}};}; \ No newline at end of file +var _0x9858=['DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','stack','md5','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','interaction','UserId','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','isEmpty','getMustacheRender','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent'];(function(_0x390307,_0x37bbfb){var _0x13853f=function(_0x3abb11){while(--_0x3abb11){_0x390307['push'](_0x390307['shift']());}};_0x13853f(++_0x37bbfb);}(_0x9858,0x1aa));var _0x8985=function(_0x589c02,_0x3dd046){_0x589c02=_0x589c02-0x0;var _0x533f81=_0x9858[_0x589c02];return _0x533f81;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x8985('0x0'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x8985('0x1'))(_0x8985('0x2'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x8985('0x3')),'mailMessage':require(_0x8985('0x4')),'smsMessage':require(_0x8985('0x5')),'faxMessage':require(_0x8985('0x6')),'whatsappMessage':require(_0x8985('0x7'))};function createMessage(_0x46eb2e,_0x48e615,_0x1acdf2,_0x424dde){return new Promise(function(_0x1371df,_0x585c97){var _0x40e45a=_['clone'](_0x1acdf2);_0x40e45a[_0x8985('0x8')]=_0x424dde;return rpc[_0x48e615+_0x8985('0x9')][_0x8985('0xa')](_0x40e45a)[_0x8985('0xb')](function(){logger[_0x8985('0xc')](_0x8985('0xd'),_0x46eb2e,_0x40e45a[_0x8985('0x8')]);_0x1371df();})[_0x8985('0xe')](function(_0x2a859f){logger[_0x8985('0xf')](_0x8985('0xd'),_0x46eb2e,JSON[_0x8985('0x10')](_0x2a859f));_0x585c97(_0x2a859f);});});}exports['consequence']=function(_0x20a6a3,_0x5609df){return function(_0x5df4f4){try{if(!_['isNil'](this[_0x8985('0x11')][_0x8985('0x12')])){logger[_0x8985('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x20a6a3,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5df4f4[_0x8985('0x13')]();}var _0x5b47f7={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8985('0x14')](_0x8985('0x15')),'direction':_0x8985('0x16')};if(this['channel']===_0x8985('0x17')||this[_0x8985('0x18')]===_0x8985('0x19')){_0x5b47f7[_0x8985('0x1a')]=this[_0x8985('0x11')]['phone'];}var _0x519333=this[_0x8985('0x18')];if(_0x519333==='chat'){_0x5b47f7[_0x8985('0x1b')]=this[_0x8985('0x1c')]['id'];}else{_0x5b47f7[_[_0x8985('0x1d')](_0x519333)+'AccountId']=this[_0x8985('0x1c')]['id'];}_0x5b47f7[_[_0x8985('0x1d')](_0x519333)+'InteractionId']=this[_0x8985('0x11')]['id'];if(this['interaction']['created']){var _0x3476c2=_0x5609df[0x4];if(!_[_0x8985('0x1e')](_0x3476c2)){_0x5b47f7[_0x8985('0x8')]=utils[_0x8985('0x1f')](_0x3476c2,this);return rpc[_0x519333+_0x8985('0x9')][_0x8985('0xa')](_0x5b47f7)[_0x8985('0xb')](function(_0x2a9477){logger['info'](_0x8985('0xd'),_0x20a6a3,_0x5b47f7['body']);})[_0x8985('0xe')](function(_0x1fd303){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x20a6a3,JSON[_0x8985('0x10')](_0x1fd303));})[_0x8985('0x20')](function(){logger[_0x8985('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x20a6a3);_0x5df4f4[_0x8985('0x21')]();});}else{logger[_0x8985('0xc')](_0x8985('0x22'),_0x20a6a3);_0x5df4f4[_0x8985('0x21')]();}}else{var _0x56c581=this;var _0x4a30e1=_0x5609df[0x2][_0x8985('0x23')](/\\n/g,'\x0a');var _0x19113c={'credentials':{'private_key':_0x4a30e1,'client_email':_0x5609df[0x1]}};var _0x2bd91d=new dialogflow['SessionsClient'](_0x19113c);var _0x43b5a9=_0x2bd91d[_0x8985('0x24')](_0x5609df[0x0],md5(_0x56c581[_0x8985('0x11')]['id']));var _0x1afced={'session':_0x43b5a9,'queryInput':{'text':{'text':_0x56c581[_0x8985('0x25')][_0x8985('0x8')],'languageCode':_0x5609df[0x3]||'en'}}};return _0x2bd91d[_0x8985('0x26')](_0x1afced)[_0x8985('0xb')](function(_0x351b92){if(_0x351b92&&_0x351b92[_0x8985('0x27')]){_0x56c581[_0x8985('0x8')][_0x8985('0x28')]=_0x351b92;var _0x368a30=_0x351b92[0x0];var _0xf00666=_0x368a30[_0x8985('0x29')][_0x8985('0x2a')]&&_0x368a30['queryResult'][_0x8985('0x2a')]['fields']?_0x368a30[_0x8985('0x29')]['diagnosticInfo'][_0x8985('0x2b')][_0x8985('0x2c')][_0x8985('0x2d')]:![];_0x56c581[_0x8985('0x8')][_0x8985('0x2e')]=_0x368a30[_0x8985('0x29')][_0x8985('0x2f')];_0x56c581['body'][_0x8985('0x30')]=_0x368a30[_0x8985('0x29')][_0x8985('0x31')];_0x56c581['body'][_0x8985('0x32')]=_0x368a30[_0x8985('0x29')][_0x8985('0x2a')]&&_0x368a30[_0x8985('0x29')][_0x8985('0x2a')][_0x8985('0x2b')]?_0x368a30[_0x8985('0x29')][_0x8985('0x2a')][_0x8985('0x2b')]['end_conversation'][_0x8985('0x2d')]:![];_0x56c581[_0x8985('0x8')][_0x8985('0x33')]=_0x368a30['queryResult'][_0x8985('0x34')][_0x8985('0x35')];_0x56c581['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x368a30[_0x8985('0x29')][_0x8985('0x34')][_0x8985('0x36')];_0x56c581['body'][_0x8985('0x37')]=_0x368a30[_0x8985('0x29')]['intent'][_0x8985('0x38')];_0x56c581[_0x8985('0x8')][_0x8985('0x39')]=_0x368a30[_0x8985('0x29')][_0x8985('0x3a')];_0x56c581[_0x8985('0x8')][_0x8985('0x3b')]=_0x368a30[_0x8985('0x29')][_0x8985('0x3c')];_0x56c581['body'][_0x8985('0x3d')]=_0x368a30[_0x8985('0x29')]['intentDetectionConfidence'];_0x5b47f7[_0x8985('0x3e')]=_0x8985('0x28');_0x5b47f7[_0x8985('0x3f')]=JSON[_0x8985('0x10')](_0x351b92);var _0x48edc9=[];for(var _0x995c25=0x0;_0x995c25<_0x351b92[_0x8985('0x27')];_0x995c25++){var _0x2a2ee9=_0x351b92[_0x995c25];if(_0x2a2ee9&&_0x2a2ee9['queryResult']&&_0x2a2ee9['queryResult'][_0x8985('0x40')]){_0x48edc9[_0x8985('0x41')](createMessage(_0x20a6a3,_0x519333,_0x5b47f7,_0x2a2ee9['queryResult']['fulfillmentText']));}}return Promise[_0x8985('0x42')](_0x48edc9)[_0x8985('0xb')](function(){if(_0xf00666){_0x5df4f4[_0x8985('0x13')]();}else{_0x5df4f4['stop']();}})['catch'](function(_0x5c5096){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x20a6a3,JSON[_0x8985('0x10')](_0x5c5096));_0x5df4f4[_0x8985('0x13')]();});}})[_0x8985('0xe')](function(_0x21869e){logger[_0x8985('0xf')](_0x8985('0xd'),_0x20a6a3,_0x21869e[_0x8985('0x25')],_0x21869e[_0x8985('0x43')]);_0x5df4f4[_0x8985('0x13')]();});}}catch(_0x254c9f){logger[_0x8985('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x20a6a3,JSON[_0x8985('0x10')](_0x254c9f));_0x5df4f4[_0x8985('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index e0c4296..a30f82b 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa77d=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','error','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0xdf1adb,_0x3c9512){var _0x16fe32=function(_0x474fd2){while(--_0x474fd2){_0xdf1adb['push'](_0xdf1adb['shift']());}};_0x16fe32(++_0x3c9512);}(_0xa77d,0xb9));var _0xda77=function(_0x4c057f,_0x1ed571){_0x4c057f=_0x4c057f-0x0;var _0x154bbd=_0xa77d[_0x4c057f];return _0x154bbd;};'use strict';var schema=require(_0xda77('0x0'));var _=require(_0xda77('0x1'));var htmlToText=require(_0xda77('0x2'));var utils=require('./utils');var logger=require(_0xda77('0x3'))(_0xda77('0x4'));var gotoif=schema({'condition':{'type':_0xda77('0x5'),'required':!![],'message':_0xda77('0x6')},'priorityTrue':{'type':_0xda77('0x7'),'message':_0xda77('0x8')},'priorityFalse':{'type':_0xda77('0x7'),'message':_0xda77('0x9')}});exports[_0xda77('0xa')]=function(_0x57c6e4,_0x15cbb1){return function(_0x29d90b){try{var _0x4ebf34={'condition':htmlToText[_0xda77('0xb')](utils[_0xda77('0xc')](_0x15cbb1[0x0],this),{'wordwrap':![]})[_0xda77('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x15cbb1[0x1],'priorityFalse':_0x15cbb1[0x2]};var _0x5cac8a=gotoif[_0xda77('0x0')](_0x4ebf34,{'typecast':!![]});if(_0x5cac8a[_0xda77('0xe')]){logger['error']('[%s][GOTOIF]\x20%s',_0x57c6e4,_[_0xda77('0xf')](_0x5cac8a,_0xda77('0x10'))[_0xda77('0x11')](',\x20'));_0x29d90b[_0xda77('0x12')]();}else{try{var _0x47489b=eval('('+_0x4ebf34[_0xda77('0x13')]+')');var _0xca4e89=_0x47489b?_0x4ebf34[_0xda77('0x14')]:_0x4ebf34['priorityFalse'];logger[_0xda77('0x15')](_0xda77('0x16'),_0x57c6e4,_0x4ebf34[_0xda77('0x13')],_0x47489b,_0xca4e89||_0xda77('0x17'));if(_0xca4e89){var _0x3d9c29=_['findIndex'](_0x29d90b['rules'](),{'p':_0xca4e89});if(_0x3d9c29>=0x0){logger[_0xda77('0x15')](_0xda77('0x18'),_0x57c6e4,_0xca4e89||_0xda77('0x17'),_0x3d9c29);_0x29d90b['next'](_0x3d9c29);}else{logger[_0xda77('0x15')](_0xda77('0x19'),_0x57c6e4,_0xca4e89||_0xda77('0x17'));_0x29d90b[_0xda77('0x12')]();}}else{_0x29d90b[_0xda77('0x17')]();}}catch(_0x1f71c2){logger['error'](_0xda77('0x1a'),_0x57c6e4,_0x1f71c2[_0xda77('0x10')]);_0x29d90b[_0xda77('0x12')]();}}}catch(_0x53250b){logger[_0xda77('0x1b')](_0xda77('0x1c'),_0x57c6e4,JSON[_0xda77('0x1d')](_0x53250b));_0x29d90b[_0xda77('0x12')]();}};}; \ No newline at end of file +var _0xed12=['[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','html-to-text','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','map','message','join','priorityTrue','priorityFalse','info'];(function(_0x4d9952,_0x53c3d1){var _0x18c159=function(_0x4a42ad){while(--_0x4a42ad){_0x4d9952['push'](_0x4d9952['shift']());}};_0x18c159(++_0x53c3d1);}(_0xed12,0xb7));var _0x2ed1=function(_0x38f702,_0x4d6717){_0x38f702=_0x38f702-0x0;var _0x1d39be=_0xed12[_0x38f702];return _0x1d39be;};'use strict';var schema=require('validate');var _=require(_0x2ed1('0x0'));var htmlToText=require(_0x2ed1('0x1'));var utils=require('./utils');var logger=require(_0x2ed1('0x2'))(_0x2ed1('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x2ed1('0x4')},'priorityTrue':{'type':_0x2ed1('0x5'),'message':_0x2ed1('0x6')},'priorityFalse':{'type':_0x2ed1('0x5'),'message':_0x2ed1('0x7')}});exports[_0x2ed1('0x8')]=function(_0x1239ae,_0x2e6c2f){return function(_0x565701){try{var _0x179acd={'condition':htmlToText[_0x2ed1('0x9')](utils[_0x2ed1('0xa')](_0x2e6c2f[0x0],this),{'wordwrap':![]})[_0x2ed1('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2e6c2f[0x1],'priorityFalse':_0x2e6c2f[0x2]};var _0x2d7ef0=gotoif[_0x2ed1('0xc')](_0x179acd,{'typecast':!![]});if(_0x2d7ef0[_0x2ed1('0xd')]){logger['error']('[%s][GOTOIF]\x20%s',_0x1239ae,_[_0x2ed1('0xe')](_0x2d7ef0,_0x2ed1('0xf'))[_0x2ed1('0x10')](',\x20'));_0x565701['stop']();}else{try{var _0x2cace6=eval('('+_0x179acd['condition']+')');var _0x15a666=_0x2cace6?_0x179acd[_0x2ed1('0x11')]:_0x179acd[_0x2ed1('0x12')];logger[_0x2ed1('0x13')](_0x2ed1('0x14'),_0x1239ae,_0x179acd[_0x2ed1('0x15')],_0x2cace6,_0x15a666||_0x2ed1('0x16'));if(_0x15a666){var _0x14fd49=_['findIndex'](_0x565701[_0x2ed1('0x17')](),{'p':_0x15a666});if(_0x14fd49>=0x0){logger['info'](_0x2ed1('0x18'),_0x1239ae,_0x15a666||_0x2ed1('0x16'),_0x14fd49);_0x565701[_0x2ed1('0x16')](_0x14fd49);}else{logger[_0x2ed1('0x13')](_0x2ed1('0x19'),_0x1239ae,_0x15a666||_0x2ed1('0x16'));_0x565701[_0x2ed1('0x1a')]();}}else{_0x565701[_0x2ed1('0x16')]();}}catch(_0x3abac1){logger[_0x2ed1('0x1b')](_0x2ed1('0x1c'),_0x1239ae,_0x3abac1[_0x2ed1('0xf')]);_0x565701[_0x2ed1('0x1a')]();}}}catch(_0xc6b115){logger['error']('[%s][GOTOIF]\x20%s',_0x1239ae,JSON['stringify'](_0xc6b115));_0x565701[_0x2ed1('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 1690ee2..ec91760 100644 --- a/server/services/routing/server/applications/gotop.js +++ b/server/services/routing/server/applications/gotop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3a6=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','message','join','stop','info','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','lodash','../../../../config/logger','number'];(function(_0x337a1e,_0x2b33ae){var _0x188c38=function(_0x42137d){while(--_0x42137d){_0x337a1e['push'](_0x337a1e['shift']());}};_0x188c38(++_0x2b33ae);}(_0xa3a6,0x174));var _0x6a3a=function(_0x5d2b9b,_0x4163d0){_0x5d2b9b=_0x5d2b9b-0x0;var _0x36cd86=_0xa3a6[_0x5d2b9b];return _0x36cd86;};'use strict';var schema=require('validate');var _=require(_0x6a3a('0x0'));var logger=require(_0x6a3a('0x1'))('routing');var gotop=schema({'priority':{'type':_0x6a3a('0x2'),'required':!![],'message':_0x6a3a('0x3')}});exports[_0x6a3a('0x4')]=function(_0x2e49e0,_0x57d21b){return function(_0x595cf1){try{var _0x432f01={'priority':_0x57d21b[0x0]};var _0x22c1f4=gotop['validate'](_0x432f01,{'typecast':!![]});if(_0x22c1f4['length']){logger[_0x6a3a('0x5')]('[%s][GOTOP]\x20%s',_0x2e49e0,_['map'](_0x22c1f4,_0x6a3a('0x6'))[_0x6a3a('0x7')](',\x20'));_0x595cf1[_0x6a3a('0x8')]();}else{logger[_0x6a3a('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x2e49e0,_0x432f01[_0x6a3a('0xa')]);if(_0x432f01[_0x6a3a('0xa')]){var _0x5f2213=_[_0x6a3a('0xb')](_0x595cf1['rules'](),{'p':_0x432f01[_0x6a3a('0xa')]});if(_0x5f2213>=0x0){logger[_0x6a3a('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2e49e0,_0x432f01[_0x6a3a('0xa')]||_0x6a3a('0xc'),_0x5f2213);_0x595cf1[_0x6a3a('0xc')](_0x5f2213);}else{logger[_0x6a3a('0x9')](_0x6a3a('0xd'),_0x2e49e0,_0x432f01[_0x6a3a('0xa')]||_0x6a3a('0xc'));_0x595cf1[_0x6a3a('0x8')]();}}else{_0x595cf1[_0x6a3a('0xc')]();}}}catch(_0xd56177){logger['error'](_0x6a3a('0xe'),_0x2e49e0,JSON['stringify'](_0xd56177));_0x595cf1['stop']();}};}; \ No newline at end of file +var _0xbed1=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','map','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','validate','number'];(function(_0x418c87,_0x10aade){var _0x1fe994=function(_0x147dd7){while(--_0x147dd7){_0x418c87['push'](_0x418c87['shift']());}};_0x1fe994(++_0x10aade);}(_0xbed1,0x1a2));var _0x1bed=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0xbed1[_0x5d07ff];return _0x5226ad;};'use strict';var schema=require(_0x1bed('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0x1bed('0x1'),'required':!![],'message':_0x1bed('0x2')}});exports['consequence']=function(_0x537a7d,_0x574fe4){return function(_0x9ad018){try{var _0x28bb44={'priority':_0x574fe4[0x0]};var _0x29b6de=gotop[_0x1bed('0x0')](_0x28bb44,{'typecast':!![]});if(_0x29b6de['length']){logger[_0x1bed('0x3')](_0x1bed('0x4'),_0x537a7d,_[_0x1bed('0x5')](_0x29b6de,'message')[_0x1bed('0x6')](',\x20'));_0x9ad018['stop']();}else{logger[_0x1bed('0x7')](_0x1bed('0x8'),_0x537a7d,_0x28bb44[_0x1bed('0x9')]);if(_0x28bb44['priority']){var _0xd3803c=_[_0x1bed('0xa')](_0x9ad018[_0x1bed('0xb')](),{'p':_0x28bb44['priority']});if(_0xd3803c>=0x0){logger['info'](_0x1bed('0xc'),_0x537a7d,_0x28bb44[_0x1bed('0x9')]||'next',_0xd3803c);_0x9ad018[_0x1bed('0xd')](_0xd3803c);}else{logger[_0x1bed('0x7')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x537a7d,_0x28bb44['priority']||_0x1bed('0xd'));_0x9ad018['stop']();}}else{_0x9ad018['next']();}}}catch(_0x227787){logger['error'](_0x1bed('0x4'),_0x537a7d,JSON['stringify'](_0x227787));_0x9ad018[_0x1bed('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index badf197..233bf59 100644 --- a/server/services/routing/server/applications/message.js +++ b/server/services/routing/server/applications/message.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ed=['body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','channel','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x53ed,0x76));var _0xd53e=function(_0x1d84b1,_0x599872){_0x1d84b1=_0x1d84b1-0x0;var _0x54fa39=_0x53ed[_0x1d84b1];return _0x54fa39;};'use strict';var _=require(_0xd53e('0x0'));var utils=require(_0xd53e('0x1'));var logger=require(_0xd53e('0x2'))(_0xd53e('0x3'));var rpc={'chatMessage':require(_0xd53e('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd53e('0x5')),'smsMessage':require(_0xd53e('0x6')),'faxMessage':require(_0xd53e('0x7')),'whatsappMessage':require(_0xd53e('0x8'))};exports['consequence']=function(_0x3a3666,_0x5079d2){return function(_0x462417){try{var _0xfc0b5a={'body':utils[_0xd53e('0x9')](_0x5079d2[0x0],this),'ContactId':this['contact']['id']};if(this[_0xd53e('0xa')]==='chat'){_0xfc0b5a[_0xd53e('0xb')]=this[_0xd53e('0xc')]['id'];}else{_0xfc0b5a[_['upperFirst'](this[_0xd53e('0xa')])+_0xd53e('0xd')]=this[_0xd53e('0xc')]['id'];}_0xfc0b5a[_[_0xd53e('0xe')](this[_0xd53e('0xa')])+_0xd53e('0xf')]=this[_0xd53e('0x10')]['id'];if(rpc[this[_0xd53e('0xa')]+_0xd53e('0x11')]){return rpc[this[_0xd53e('0xa')]+'Message'][_0xd53e('0x12')](_0xfc0b5a)[_0xd53e('0x13')](function(_0x14dc02){logger[_0xd53e('0x14')](_0xd53e('0x15'),_0x3a3666,_0xfc0b5a[_0xd53e('0x16')]);_0x462417[_0xd53e('0x17')]();})[_0xd53e('0x18')](function(_0x3bcb0b){logger[_0xd53e('0x19')](_0xd53e('0x15'),_0x3a3666,JSON[_0xd53e('0x1a')](_0x3bcb0b));_0x462417[_0xd53e('0x1b')]();});}}catch(_0x48c0f0){logger['error'](_0xd53e('0x15'),_0x3a3666,JSON[_0xd53e('0x1a')](_0x48c0f0));_0x462417[_0xd53e('0x1b')]();}};}; \ No newline at end of file +var _0x5eb8=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','create','then','body','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x337897,_0x17f2a3){var _0x326816=function(_0x3cca5e){while(--_0x3cca5e){_0x337897['push'](_0x337897['shift']());}};_0x326816(++_0x17f2a3);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0x5eb8[_0x2867d8];return _0x3b8176;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var rpc={'chatMessage':require(_0x85eb('0x2')),'openchannelMessage':require(_0x85eb('0x3')),'mailMessage':require(_0x85eb('0x4')),'smsMessage':require(_0x85eb('0x5')),'faxMessage':require(_0x85eb('0x6')),'whatsappMessage':require(_0x85eb('0x7'))};exports[_0x85eb('0x8')]=function(_0x1fde1a,_0x2bf83c){return function(_0x1ba1d8){try{var _0x4a8814={'body':utils[_0x85eb('0x9')](_0x2bf83c[0x0],this),'ContactId':this[_0x85eb('0xa')]['id']};if(this[_0x85eb('0xb')]==='chat'){_0x4a8814[_0x85eb('0xc')]=this['account']['id'];}else{_0x4a8814[_[_0x85eb('0xd')](this[_0x85eb('0xb')])+_0x85eb('0xe')]=this[_0x85eb('0xf')]['id'];}_0x4a8814[_[_0x85eb('0xd')](this[_0x85eb('0xb')])+_0x85eb('0x10')]=this['interaction']['id'];if(rpc[this[_0x85eb('0xb')]+_0x85eb('0x11')]){return rpc[this['channel']+_0x85eb('0x11')][_0x85eb('0x12')](_0x4a8814)[_0x85eb('0x13')](function(_0x259f72){logger['info']('[%s][MESSAGE]\x20%s',_0x1fde1a,_0x4a8814[_0x85eb('0x14')]);_0x1ba1d8['next']();})[_0x85eb('0x15')](function(_0x23a82a){logger[_0x85eb('0x16')](_0x85eb('0x17'),_0x1fde1a,JSON[_0x85eb('0x18')](_0x23a82a));_0x1ba1d8['stop']();});}}catch(_0x2e5c0a){logger['error'](_0x85eb('0x17'),_0x1fde1a,JSON[_0x85eb('0x18')](_0x2e5c0a));_0x1ba1d8[_0x85eb('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index c9c7172..79bd415 100644 --- a/server/services/routing/server/applications/noop.js +++ b/server/services/routing/server/applications/noop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5bd=['consequence','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stop','./utils','../../../../config/logger'];(function(_0x8ad4f9,_0x5366ad){var _0x575be6=function(_0x519a02){while(--_0x519a02){_0x8ad4f9['push'](_0x8ad4f9['shift']());}};_0x575be6(++_0x5366ad);}(_0xc5bd,0x1db));var _0xdc5b=function(_0x571877,_0x488521){_0x571877=_0x571877-0x0;var _0x37e2ba=_0xc5bd[_0x571877];return _0x37e2ba;};'use strict';var utils=require(_0xdc5b('0x0'));var logger=require(_0xdc5b('0x1'))('routing');exports[_0xdc5b('0x2')]=function(_0x3888b7,_0x39940d){return function(_0x4f09c4){try{logger[_0xdc5b('0x3')]('[%s][NOOP]\x20%s',_0x3888b7,utils[_0xdc5b('0x4')](_0x39940d[0x0],this));_0x4f09c4[_0xdc5b('0x5')]();}catch(_0x5add58){logger[_0xdc5b('0x6')](_0xdc5b('0x7'),_0x3888b7,JSON['stringify'](_0x5add58));_0x4f09c4[_0xdc5b('0x8')]();}};}; \ No newline at end of file +var _0xc8bc=['stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify'];(function(_0x589cdf,_0x53f463){var _0x5f0774=function(_0x530589){while(--_0x530589){_0x589cdf['push'](_0x589cdf['shift']());}};_0x5f0774(++_0x53f463);}(_0xc8bc,0x12d));var _0xcc8b=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xc8bc[_0x1793de];return _0x4f0309;};'use strict';var utils=require(_0xcc8b('0x0'));var logger=require(_0xcc8b('0x1'))(_0xcc8b('0x2'));exports[_0xcc8b('0x3')]=function(_0x3e910e,_0x358fef){return function(_0x3f9ea2){try{logger[_0xcc8b('0x4')](_0xcc8b('0x5'),_0x3e910e,utils[_0xcc8b('0x6')](_0x358fef[0x0],this));_0x3f9ea2['next']();}catch(_0x42638e){logger[_0xcc8b('0x7')]('[%s][NOOP]\x20%s',_0x3e910e,JSON[_0xcc8b('0x8')](_0x42638e));_0x3f9ea2[_0xcc8b('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index a0f1a3f..d0e166e 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23ca=['moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','queue_id','account','queue','joinAt','emit','clone','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','stop','find','Queues','createQueue','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util'];(function(_0x13bcbb,_0x2eb915){var _0x457c81=function(_0xf44477){while(--_0xf44477){_0x13bcbb['push'](_0x13bcbb['shift']());}};_0x457c81(++_0x2eb915);}(_0x23ca,0x102));var _0xa23c=function(_0x5cb537,_0x574c06){_0x5cb537=_0x5cb537-0x0;var _0x4eb6ec=_0x23ca[_0x5cb537];return _0x4eb6ec;};'use strict';var schema=require(_0xa23c('0x0'));var _=require(_0xa23c('0x1'));var util=require(_0xa23c('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xa23c('0x3'));var Redis=require('ioredis');var config=require(_0xa23c('0x4'));var logger=require(_0xa23c('0x5'))(_0xa23c('0x6'));var strategy=require(_0xa23c('0x7'));config['redis']=_['defaults'](config[_0xa23c('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa23c('0x8')]));var attributes=['id',_0xa23c('0x9'),_0xa23c('0xa'),_0xa23c('0xb'),'from',_0xa23c('0xc')];function emit(_0x271faf,_0x1b02aa,_0x429614){io['to'](_0x271faf)[_0xa23c('0xd')](_0x1b02aa,_0x429614);}function emitChannelQueueInteraction(_0x3785d7,_0xc6467f,_0x40db99,_0x38937a,_0xb0de91,_0xc58536,_0x228603,_0x1efd01){var _0x48e45b=_[_0xa23c('0xe')](_0x40db99);_0x48e45b['queue_id']=_0x1efd01;_0x48e45b[_0xa23c('0xb')]=_0xc6467f;_0x48e45b[_0xa23c('0xa')]=_0x38937a;_0x48e45b['id']=_0xb0de91;if(_0xc58536){attributes[_0xa23c('0xf')](_['capitalize'](_0x3785d7)+_0xa23c('0x10'));_0x228603[util[_0xa23c('0x11')](_0xa23c('0x12'),_0x3785d7)][_0xb0de91]=_[_0xa23c('0x13')](_0x48e45b,attributes);}else{delete _0x228603[util[_0xa23c('0x11')]('%sQueuesWaitingInteractions',_0x3785d7)][_0xb0de91];}emit(util['format'](_0xa23c('0x14'),_0x3785d7,_0xc6467f),util[_0xa23c('0x11')](_0xa23c('0x15'),_0x3785d7,_0xc58536?_0xa23c('0x16'):_0xa23c('0x17')),_[_0xa23c('0x13')](_0x48e45b,attributes));}var rpc={'openchannelQueueReport':require(_0xa23c('0x18')),'mailQueueReport':require(_0xa23c('0x19')),'chatQueueReport':require(_0xa23c('0x1a')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xa23c('0x1b')),'whatsappQueueReport':require(_0xa23c('0x1c')),'chatInteraction':require(_0xa23c('0x1d')),'faxInteraction':require(_0xa23c('0x1e')),'mailInteraction':require(_0xa23c('0x1f')),'openchannelInteraction':require(_0xa23c('0x20')),'smsInteraction':require(_0xa23c('0x21')),'whatsappInteraction':require(_0xa23c('0x22'))};var queue=schema({'name':{'type':_0xa23c('0x23'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xa23c('0x24'),'message':_0xa23c('0x25')}});function startRouting(_0x5203e1,_0x254241,_0xe00460,_0x30248b){if(_0x5203e1&&_0x254241&&_0xe00460){_0x254241[_0xa23c('0x26')]+=0x1;var _0x245290={'uniqueid':_0x5203e1,'from':_0xe00460['body']?_0xe00460[_0xa23c('0x27')][_0xa23c('0x28')]:'','joinAt':moment()['format'](_0xa23c('0x29')),'ContactId':_0xe00460['contact']?_0xe00460[_0xa23c('0x2a')]['id']:null,'ListId':_0xe00460['list']?_0xe00460[_0xa23c('0x2b')]['id']:null};_0x245290[_[_0xa23c('0x2c')](_0xe00460[_0xa23c('0x2d')])+_0xa23c('0x2e')]=_0x254241['id']||null;_0x245290[_[_0xa23c('0x2c')](_0xe00460[_0xa23c('0x2d')])+_0xa23c('0x10')]=_0xe00460['interaction']?_0xe00460[_0xa23c('0x2f')]['id']:null;_0x245290[_[_0xa23c('0x2c')](_0xe00460['channel'])+_0xa23c('0x30')]=_0xe00460['message']?_0xe00460[_0xa23c('0x31')]['id']:null;_0x245290[_[_0xa23c('0x2c')](_0xe00460[_0xa23c('0x2d')])+(_0xe00460[_0xa23c('0x2d')]!==_0xa23c('0x32')?_0xa23c('0x33'):_0xa23c('0x34'))]=_0xe00460[_0xa23c('0xa')]?_0xe00460[_0xa23c('0xa')]['id']:null;logger['info'](util['format'](_0xa23c('0x35'),_0x5203e1,_0x254241[_0xa23c('0x36')]));emitChannelQueueInteraction(_0xe00460[_0xa23c('0x2d')],_0x254241[_0xa23c('0x36')],_0x245290,_0xe00460[_0xa23c('0xa')][_0xa23c('0x36')],_0xe00460[_0xa23c('0x31')]['id'],!![],_0x30248b,_0x254241['id']);if(rpc[_0xe00460['channel']+_0xa23c('0x37')]){return rpc[_0xe00460[_0xa23c('0x2d')]+_0xa23c('0x37')][_0xa23c('0x38')](_0x245290)[_0xa23c('0x39')](function(_0x50613d){logger[_0xa23c('0x3a')](_0xa23c('0x3b'),_0x50613d);});}}}function stopRouting(_0xebff84,_0xf633c0,_0x740a6e,_0x1e2a47){if(_0xebff84&&_0xf633c0){_0xf633c0['waiting']-=0x1;var _0x32885c={'leaveAt':moment()[_0xa23c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xa23c('0x11')](_0xa23c('0x29')),'reason':'accepted'};logger[_0xa23c('0x3c')](util[_0xa23c('0x11')](_0xa23c('0x3d'),_0xebff84,_0xf633c0[_0xa23c('0x36')]));emitChannelQueueInteraction(_0x740a6e[_0xa23c('0x2d')],_0xf633c0['name'],_0x740a6e[_0xa23c('0x27')],_0x740a6e[_0xa23c('0xa')][_0xa23c('0x36')],_0x740a6e[_0xa23c('0x31')]['id'],![],_0x1e2a47,_0xf633c0['id']);return rpc[_0x740a6e[_0xa23c('0x2d')]+_0xa23c('0x3e')][_0xa23c('0x3f')](_0x740a6e[_0xa23c('0x2f')]['id'],{'queueId':_0xf633c0['id']})[_0xa23c('0x40')](function(){if(rpc[_0x740a6e[_0xa23c('0x2d')]+_0xa23c('0x37')]){return rpc[_0x740a6e[_0xa23c('0x2d')]+_0xa23c('0x37')]['update'](_0xebff84,_0x32885c)[_0xa23c('0x39')](function(_0x25c8ae){logger['error'](_0xa23c('0x41'),_0x25c8ae);});}});}}function endRouting(_0x543f97,_0x56bdc7,_0x135b40,_0x5382e9){if(_0x543f97&&_0x56bdc7){_0x56bdc7[_0xa23c('0x26')]-=0x1;var _0x2ddc2d={'leaveAt':moment()[_0xa23c('0x11')](_0xa23c('0x29')),'exitAt':moment()[_0xa23c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa23c('0x42')};logger[_0xa23c('0x3c')](util[_0xa23c('0x11')](_0xa23c('0x43'),_0x543f97,_0x56bdc7[_0xa23c('0x36')]));emitChannelQueueInteraction(_0x135b40[_0xa23c('0x2d')],_0x56bdc7['name'],_0x135b40['body'],_0x135b40['account']['name'],_0x135b40[_0xa23c('0x31')]['id'],![],_0x5382e9);if(rpc[_0x135b40[_0xa23c('0x2d')]+'QueueReport']){return rpc[_0x135b40[_0xa23c('0x2d')]+_0xa23c('0x37')][_0xa23c('0x3f')](_0x543f97,_0x2ddc2d)[_0xa23c('0x39')](function(_0x33ebcf){logger[_0xa23c('0x3a')](_0xa23c('0x41'),_0x33ebcf);});}}}function handleFindQueue(_0x1012e3){return function(_0x3f7c63){return _0x3f7c63[_0xa23c('0x36')][_0xa23c('0x44')]()===_0x1012e3[_0xa23c('0x44')]();};}exports[_0xa23c('0x45')]=function(_0x309ee9,_0x5aa0e2,_0x1b1afd,_0x2176f2){return function(_0x132bb9){try{var _0x3d7765={'name':_0x5aa0e2[0x0],'timeout':_0x5aa0e2[0x1]};var _0x360b8a=queue[_0xa23c('0x0')](_0x3d7765,{'typecast':!![]});if(_0x360b8a[_0xa23c('0x46')]){logger[_0xa23c('0x3a')](_0xa23c('0x47'),_0x309ee9,_['map'](_0x360b8a,_0xa23c('0x31'))['join'](',\x20'));_0x132bb9[_0xa23c('0x48')]();}else{var _0x1885e7=_[_0xa23c('0x49')](_0x1b1afd[_0x2176f2[_0xa23c('0x2d')]+_0xa23c('0x4a')],handleFindQueue(_0x3d7765['name']));if(_0x1885e7){startRouting(_0x309ee9,_0x1885e7,_0x2176f2,_0x1b1afd);var _0x682989=(_0x1885e7[_0xa23c('0x42')]||0xa)*0x3e8;var _0x3db5ec=(_0x3d7765[_0xa23c('0x42')]||0x14)*0x3e8;var _0x27b212;if(_0x682989>_0x3db5ec){_0x3db5ec=_0x682989;}var _0x2c1792=seqqueue[_0xa23c('0x4b')](_0x682989);_0x2c1792['id']=_0x309ee9;_0x2c1792[_0xa23c('0x4c')]=_0x682989;_0x2c1792['qtimeout']=_0x3db5ec;_0x2c1792[_0xa23c('0x2d')]=_0x2176f2[_0xa23c('0x2d')];_0x1b1afd['rules'][_0x309ee9]['on'](_0xa23c('0x4d'),function(){logger['info'](_0xa23c('0x4e'),_0x309ee9);stopRouting(_0x309ee9,_0x1885e7,_0x2176f2,_0x1b1afd);clearTimeout(_0x27b212);_0x27b212=undefined;_0x2c1792[_0xa23c('0x4f')](!![]);if(_0x1b1afd[_0xa23c('0x50')][_0x309ee9]){delete _0x1b1afd[_0xa23c('0x50')][_0x309ee9];}_0x132bb9[_0xa23c('0x48')]();});_0x1b1afd['rules'][_0x309ee9]['on'](_0xa23c('0x51'),function(){if(_0x1b1afd['rules'][_0x309ee9]){delete _0x1b1afd[_0xa23c('0x50')][_0x309ee9];}});_0x27b212=setTimeout(function(){logger[_0xa23c('0x3c')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x309ee9);endRouting(_0x309ee9,_0x1885e7,_0x2176f2,_0x1b1afd);clearTimeout(_0x27b212);_0x2c1792[_0xa23c('0x4f')](!![]);_0x132bb9[_0xa23c('0x52')]();},_0x3db5ec);switch(_0x1885e7['strategy']){case _0xa23c('0x53'):strategy[_0xa23c('0x53')](_0x2c1792,_0x1885e7,_0x1b1afd,_0x2176f2);break;default:strategy[_0xa23c('0x54')](_0x2c1792,_0x1885e7,_0x1b1afd,_0x2176f2);}}else{logger[_0xa23c('0x3a')](_0xa23c('0x55'),_0x309ee9,_0x3d7765['name']);_0x132bb9[_0xa23c('0x48')]();}}}catch(_0xc1bb66){logger[_0xa23c('0x3a')](_0xa23c('0x47'),_0x309ee9,_0xc1bb66[_0xa23c('0x56')]);_0x132bb9[_0xa23c('0x48')]();}};}; \ No newline at end of file +var _0x5eee=['Interaction','update','then','timeout','[%s][END:QUEUE][NAME:%s]','catch','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','stop','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','queue_id','account','joinAt','emit','queue','push','capitalize','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','timeout\x20is\x20a\x20number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]'];(function(_0x508662,_0x1bd735){var _0x30cc56=function(_0x56690e){while(--_0x56690e){_0x508662['push'](_0x508662['shift']());}};_0x30cc56(++_0x1bd735);}(_0x5eee,0xb9));var _0xe5ee=function(_0x2afcb6,_0x4b181b){_0x2afcb6=_0x2afcb6-0x0;var _0x5d5d68=_0x5eee[_0x2afcb6];return _0x5d5d68;};'use strict';var schema=require(_0xe5ee('0x0'));var _=require(_0xe5ee('0x1'));var util=require(_0xe5ee('0x2'));var seqqueue=require(_0xe5ee('0x3'));var moment=require(_0xe5ee('0x4'));var Redis=require(_0xe5ee('0x5'));var config=require(_0xe5ee('0x6'));var logger=require(_0xe5ee('0x7'))(_0xe5ee('0x8'));var strategy=require(_0xe5ee('0x9'));config['redis']=_[_0xe5ee('0xa')](config[_0xe5ee('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe5ee('0xb')]));var attributes=['id',_0xe5ee('0xc'),_0xe5ee('0xd'),'queue','from',_0xe5ee('0xe')];function emit(_0x200f3e,_0x5a2628,_0x37f145){io['to'](_0x200f3e)[_0xe5ee('0xf')](_0x5a2628,_0x37f145);}function emitChannelQueueInteraction(_0x1f38cf,_0x195ebf,_0x5988bb,_0x2eaeb2,_0x3de97e,_0x4bdf92,_0x5b35c7,_0x4cac33){var _0x1d44cc=_['clone'](_0x5988bb);_0x1d44cc['queue_id']=_0x4cac33;_0x1d44cc[_0xe5ee('0x10')]=_0x195ebf;_0x1d44cc[_0xe5ee('0xd')]=_0x2eaeb2;_0x1d44cc['id']=_0x3de97e;if(_0x4bdf92){attributes[_0xe5ee('0x11')](_[_0xe5ee('0x12')](_0x1f38cf)+'InteractionId');_0x5b35c7[util['format'](_0xe5ee('0x13'),_0x1f38cf)][_0x3de97e]=_[_0xe5ee('0x14')](_0x1d44cc,attributes);}else{delete _0x5b35c7[util[_0xe5ee('0x15')](_0xe5ee('0x13'),_0x1f38cf)][_0x3de97e];}emit(util[_0xe5ee('0x15')](_0xe5ee('0x16'),_0x1f38cf,_0x195ebf),util[_0xe5ee('0x15')](_0xe5ee('0x17'),_0x1f38cf,_0x4bdf92?_0xe5ee('0x18'):'remove'),_[_0xe5ee('0x14')](_0x1d44cc,attributes));}var rpc={'openchannelQueueReport':require(_0xe5ee('0x19')),'mailQueueReport':require(_0xe5ee('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xe5ee('0x1b')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xe5ee('0x1c')),'mailInteraction':require(_0xe5ee('0x1d')),'openchannelInteraction':require(_0xe5ee('0x1e')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0xe5ee('0x1f'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xe5ee('0x20')}});function startRouting(_0x477478,_0x3b0d23,_0x51c13b,_0x1c86d4){if(_0x477478&&_0x3b0d23&&_0x51c13b){_0x3b0d23['waiting']+=0x1;var _0x100ac9={'uniqueid':_0x477478,'from':_0x51c13b[_0xe5ee('0x21')]?_0x51c13b[_0xe5ee('0x21')][_0xe5ee('0x22')]:'','joinAt':moment()[_0xe5ee('0x15')](_0xe5ee('0x23')),'ContactId':_0x51c13b['contact']?_0x51c13b[_0xe5ee('0x24')]['id']:null,'ListId':_0x51c13b[_0xe5ee('0x25')]?_0x51c13b[_0xe5ee('0x25')]['id']:null};_0x100ac9[_['upperFirst'](_0x51c13b[_0xe5ee('0x26')])+_0xe5ee('0x27')]=_0x3b0d23['id']||null;_0x100ac9[_[_0xe5ee('0x28')](_0x51c13b[_0xe5ee('0x26')])+_0xe5ee('0x29')]=_0x51c13b[_0xe5ee('0x2a')]?_0x51c13b['interaction']['id']:null;_0x100ac9[_[_0xe5ee('0x28')](_0x51c13b[_0xe5ee('0x26')])+_0xe5ee('0x2b')]=_0x51c13b[_0xe5ee('0x2c')]?_0x51c13b[_0xe5ee('0x2c')]['id']:null;_0x100ac9[_[_0xe5ee('0x28')](_0x51c13b[_0xe5ee('0x26')])+(_0x51c13b[_0xe5ee('0x26')]!==_0xe5ee('0x2d')?_0xe5ee('0x2e'):_0xe5ee('0x2f'))]=_0x51c13b['account']?_0x51c13b[_0xe5ee('0xd')]['id']:null;logger[_0xe5ee('0x30')](util['format'](_0xe5ee('0x31'),_0x477478,_0x3b0d23[_0xe5ee('0x32')]));emitChannelQueueInteraction(_0x51c13b[_0xe5ee('0x26')],_0x3b0d23['name'],_0x100ac9,_0x51c13b['account'][_0xe5ee('0x32')],_0x51c13b['message']['id'],!![],_0x1c86d4,_0x3b0d23['id']);if(rpc[_0x51c13b[_0xe5ee('0x26')]+_0xe5ee('0x33')]){return rpc[_0x51c13b[_0xe5ee('0x26')]+_0xe5ee('0x33')][_0xe5ee('0x34')](_0x100ac9)['catch'](function(_0x94fd3a){logger[_0xe5ee('0x35')](_0xe5ee('0x36'),_0x94fd3a);});}}}function stopRouting(_0xbe0573,_0x25befb,_0x37cf55,_0xb53f91){if(_0xbe0573&&_0x25befb){_0x25befb[_0xe5ee('0x37')]-=0x1;var _0x56072d={'leaveAt':moment()[_0xe5ee('0x15')](_0xe5ee('0x23')),'acceptAt':moment()[_0xe5ee('0x15')](_0xe5ee('0x23')),'reason':_0xe5ee('0x38')};logger[_0xe5ee('0x30')](util[_0xe5ee('0x15')](_0xe5ee('0x39'),_0xbe0573,_0x25befb[_0xe5ee('0x32')]));emitChannelQueueInteraction(_0x37cf55[_0xe5ee('0x26')],_0x25befb[_0xe5ee('0x32')],_0x37cf55[_0xe5ee('0x21')],_0x37cf55[_0xe5ee('0xd')][_0xe5ee('0x32')],_0x37cf55['message']['id'],![],_0xb53f91,_0x25befb['id']);return rpc[_0x37cf55[_0xe5ee('0x26')]+_0xe5ee('0x3a')][_0xe5ee('0x3b')](_0x37cf55[_0xe5ee('0x2a')]['id'],{'queueId':_0x25befb['id']})[_0xe5ee('0x3c')](function(){if(rpc[_0x37cf55[_0xe5ee('0x26')]+_0xe5ee('0x33')]){return rpc[_0x37cf55['channel']+_0xe5ee('0x33')][_0xe5ee('0x3b')](_0xbe0573,_0x56072d)['catch'](function(_0x13fa57){logger[_0xe5ee('0x35')]('update\x20queue\x20report',_0x13fa57);});}});}}function endRouting(_0x345b2b,_0xa6221e,_0x2806e6,_0x2798de){if(_0x345b2b&&_0xa6221e){_0xa6221e[_0xe5ee('0x37')]-=0x1;var _0x259ab2={'leaveAt':moment()[_0xe5ee('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0xe5ee('0x23')),'reason':_0xe5ee('0x3d')};logger['info'](util[_0xe5ee('0x15')](_0xe5ee('0x3e'),_0x345b2b,_0xa6221e[_0xe5ee('0x32')]));emitChannelQueueInteraction(_0x2806e6[_0xe5ee('0x26')],_0xa6221e[_0xe5ee('0x32')],_0x2806e6['body'],_0x2806e6[_0xe5ee('0xd')][_0xe5ee('0x32')],_0x2806e6[_0xe5ee('0x2c')]['id'],![],_0x2798de);if(rpc[_0x2806e6[_0xe5ee('0x26')]+_0xe5ee('0x33')]){return rpc[_0x2806e6[_0xe5ee('0x26')]+'QueueReport']['update'](_0x345b2b,_0x259ab2)[_0xe5ee('0x3f')](function(_0x2c41ec){logger[_0xe5ee('0x35')](_0xe5ee('0x40'),_0x2c41ec);});}}}function handleFindQueue(_0x208799){return function(_0x5dee73){return _0x5dee73[_0xe5ee('0x32')][_0xe5ee('0x41')]()===_0x208799['toLowerCase']();};}exports['consequence']=function(_0x39e9b7,_0xd9f5a8,_0x5951ef,_0x32ffee){return function(_0x29be81){try{var _0x14639f={'name':_0xd9f5a8[0x0],'timeout':_0xd9f5a8[0x1]};var _0x107f9e=queue[_0xe5ee('0x0')](_0x14639f,{'typecast':!![]});if(_0x107f9e[_0xe5ee('0x42')]){logger[_0xe5ee('0x35')](_0xe5ee('0x43'),_0x39e9b7,_['map'](_0x107f9e,_0xe5ee('0x2c'))['join'](',\x20'));_0x29be81[_0xe5ee('0x44')]();}else{var _0xb204bb=_['find'](_0x5951ef[_0x32ffee[_0xe5ee('0x26')]+_0xe5ee('0x45')],handleFindQueue(_0x14639f[_0xe5ee('0x32')]));if(_0xb204bb){startRouting(_0x39e9b7,_0xb204bb,_0x32ffee,_0x5951ef);var _0x385b6f=(_0xb204bb[_0xe5ee('0x3d')]||0xa)*0x3e8;var _0x30b32c=(_0x14639f['timeout']||0x14)*0x3e8;var _0xffd955;if(_0x385b6f>_0x30b32c){_0x30b32c=_0x385b6f;}var _0x53e30c=seqqueue[_0xe5ee('0x46')](_0x385b6f);_0x53e30c['id']=_0x39e9b7;_0x53e30c['atimeout']=_0x385b6f;_0x53e30c[_0xe5ee('0x47')]=_0x30b32c;_0x53e30c['channel']=_0x32ffee[_0xe5ee('0x26')];_0x5951ef[_0xe5ee('0x48')][_0x39e9b7]['on'](_0xe5ee('0x49'),function(){logger[_0xe5ee('0x30')](_0xe5ee('0x4a'),_0x39e9b7);stopRouting(_0x39e9b7,_0xb204bb,_0x32ffee,_0x5951ef);clearTimeout(_0xffd955);_0xffd955=undefined;_0x53e30c[_0xe5ee('0x4b')](!![]);if(_0x5951ef[_0xe5ee('0x48')][_0x39e9b7]){delete _0x5951ef[_0xe5ee('0x48')][_0x39e9b7];}_0x29be81[_0xe5ee('0x44')]();});_0x5951ef[_0xe5ee('0x48')][_0x39e9b7]['on']('complete',function(){if(_0x5951ef[_0xe5ee('0x48')][_0x39e9b7]){delete _0x5951ef[_0xe5ee('0x48')][_0x39e9b7];}});_0xffd955=setTimeout(function(){logger[_0xe5ee('0x30')](_0xe5ee('0x4c'),_0x39e9b7);endRouting(_0x39e9b7,_0xb204bb,_0x32ffee,_0x5951ef);clearTimeout(_0xffd955);_0x53e30c['close'](!![]);_0x29be81[_0xe5ee('0x4d')]();},_0x30b32c);switch(_0xb204bb['strategy']){case _0xe5ee('0x4e'):strategy[_0xe5ee('0x4e')](_0x53e30c,_0xb204bb,_0x5951ef,_0x32ffee);break;default:strategy[_0xe5ee('0x4f')](_0x53e30c,_0xb204bb,_0x5951ef,_0x32ffee);}}else{logger[_0xe5ee('0x35')](_0xe5ee('0x50'),_0x39e9b7,_0x14639f[_0xe5ee('0x32')]);_0x29be81[_0xe5ee('0x44')]();}}}catch(_0x168874){logger[_0xe5ee('0x35')](_0xe5ee('0x43'),_0x39e9b7,_0x168874['stack']);_0x29be81[_0xe5ee('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index b6266fa..afa7175 100644 --- a/server/services/routing/server/applications/strategy/agent.js +++ b/server/services/routing/server/applications/strategy/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a8=['./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','drained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid'];(function(_0x27ebdb,_0x222493){var _0x4eb237=function(_0x240137){while(--_0x240137){_0x27ebdb['push'](_0x27ebdb['shift']());}};_0x4eb237(++_0x222493);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3dffe4,_0x9fbf66){_0x3dffe4=_0x3dffe4-0x0;var _0x5257ec=_0xa8a8[_0x3dffe4];return _0x5257ec;};'use strict';var _=require(_0x8a8a('0x0'));var uuid=require(_0x8a8a('0x1'));var util=require(_0x8a8a('0x2'));var logger=require(_0x8a8a('0x3'))('routing');var Agent=function(_0x2a2676,_0x3296a6,_0xf11a08,_0x3ed1de){this[_0x8a8a('0x4')]=uuid['v4']();this[_0x8a8a('0x5')]=_0x2a2676;this[_0x8a8a('0x6')]=_0x3296a6;this[_0x8a8a('0x7')]=_0xf11a08;this[_0x8a8a('0x8')]=_0x3ed1de;this[_0x8a8a('0x5')][_0x8a8a('0x9')](this[_0x8a8a('0xa')][_0x8a8a('0xb')](this),this[_0x8a8a('0xc')][_0x8a8a('0xb')](this));this['squeue']['on']('timeout',this[_0x8a8a('0xc')]['bind'](this));this[_0x8a8a('0x5')]['on'](_0x8a8a('0xd'),this['handleDrained'][_0x8a8a('0xb')](this));};Agent[_0x8a8a('0xe')][_0x8a8a('0x9')]=function(){this['squeue'][_0x8a8a('0x9')](this[_0x8a8a('0xa')][_0x8a8a('0xb')](this),this[_0x8a8a('0xc')]['bind'](this));};Agent[_0x8a8a('0xe')]['handleDrained']=function(){this[_0x8a8a('0xc')](!![]);};Agent[_0x8a8a('0xe')][_0x8a8a('0xa')]=function(){logger[_0x8a8a('0xf')](_0x8a8a('0x10'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);if(_['isNil'](this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']])){logger[_0x8a8a('0xf')](_0x8a8a('0x11'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);setTimeout(this['push'][_0x8a8a('0xb')](this),0x3e8);}else{if(this[_0x8a8a('0x8')][_0x8a8a('0x12')]||util[_0x8a8a('0x13')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')]['agents'][this['agent']['id']],this['squeue']['channel'],![])){this['realtime'][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x15')]=!![];this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x16')]=undefined;util[_0x8a8a('0x17')](this[_0x8a8a('0x7')],this[_0x8a8a('0x8')],this[_0x8a8a('0x6')],this[_0x8a8a('0x5')][_0x8a8a('0x18')]);util[_0x8a8a('0x19')](this[_0x8a8a('0x4')],this['squeue']['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']],null,this[_0x8a8a('0x8')]);util[_0x8a8a('0x1a')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']],_0x8a8a('0x1b')+(this[_0x8a8a('0x8')]['forcedOwnership']?':FORCED':''));}else{logger[_0x8a8a('0xf')](_0x8a8a('0x1c'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x8a8a('0xb')](this),0x3e8);}}};Agent['prototype'][_0x8a8a('0xc')]=function(_0xdd6221){if(_['isNil'](this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']])){return logger[_0x8a8a('0xf')](_0x8a8a('0x11'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);}else{logger[_0x8a8a('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util[_0x8a8a('0x1d')](this[_0x8a8a('0x4')],this['squeue']['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this['agent']['id']],null,this[_0x8a8a('0x8')]);this[_0x8a8a('0x7')][_0x8a8a('0x14')][this['agent']['id']]['busy']=![];this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x16')]=undefined;util[_0x8a8a('0x1e')](this[_0x8a8a('0x7')],this[_0x8a8a('0x8')],this[_0x8a8a('0x6')],this[_0x8a8a('0x5')][_0x8a8a('0x18')]);util[_0x8a8a('0x1a')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']],_0xdd6221?_0x8a8a('0x1f'):_0x8a8a('0x20'));}if(!_0xdd6221){setTimeout(this[_0x8a8a('0x9')][_0x8a8a('0xb')](this),0x3e8);}};function agent(_0x29d187,_0x4c8003,_0x4cc605,_0x53da01){return new Agent(_0x29d187,_0x4c8003,_0x4cc605,_0x53da01);}module[_0x8a8a('0x21')]=agent; \ No newline at end of file +var _0x04de=['uuid','./util','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','forcedOwnership','isAgentAvailable','realtime','channel','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','busyQueue','removeWaitingNotification','exports','lodash'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x04de,0x107));var _0xe04d=function(_0x488689,_0x3bb835){_0x488689=_0x488689-0x0;var _0x215ee4=_0x04de[_0x488689];return _0x215ee4;};'use strict';var _=require(_0xe04d('0x0'));var uuid=require(_0xe04d('0x1'));var util=require(_0xe04d('0x2'));var logger=require(_0xe04d('0x3'))(_0xe04d('0x4'));var Agent=function(_0x28f63f,_0x1113af,_0x43c4b1,_0x2593a4){this[_0xe04d('0x5')]=uuid['v4']();this[_0xe04d('0x6')]=_0x28f63f;this['agent']=_0x1113af;this['realtime']=_0x43c4b1;this['routing']=_0x2593a4;this['squeue'][_0xe04d('0x7')](this[_0xe04d('0x8')][_0xe04d('0x9')](this),this[_0xe04d('0xa')][_0xe04d('0x9')](this));this[_0xe04d('0x6')]['on'](_0xe04d('0xb'),this[_0xe04d('0xa')]['bind'](this));this[_0xe04d('0x6')]['on'](_0xe04d('0xc'),this[_0xe04d('0xd')][_0xe04d('0x9')](this));};Agent[_0xe04d('0xe')][_0xe04d('0x7')]=function(){this[_0xe04d('0x6')][_0xe04d('0x7')](this[_0xe04d('0x8')]['bind'](this),this[_0xe04d('0xa')][_0xe04d('0x9')](this));};Agent[_0xe04d('0xe')][_0xe04d('0xd')]=function(){this[_0xe04d('0xa')](!![]);};Agent[_0xe04d('0xe')][_0xe04d('0x8')]=function(){logger[_0xe04d('0xf')](_0xe04d('0x10'),this[_0xe04d('0x6')]['id'],this[_0xe04d('0x11')]['id']);if(_[_0xe04d('0x12')](this['realtime'][_0xe04d('0x13')][this['agent']['id']])){logger[_0xe04d('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xe04d('0x6')]['id'],this[_0xe04d('0x11')]['id']);setTimeout(this[_0xe04d('0x7')][_0xe04d('0x9')](this),0x3e8);}else{if(this[_0xe04d('0x4')][_0xe04d('0x14')]||util[_0xe04d('0x15')](this[_0xe04d('0x6')]['id'],this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']],this[_0xe04d('0x6')][_0xe04d('0x17')],![])){this[_0xe04d('0x16')][_0xe04d('0x13')][this[_0xe04d('0x11')]['id']]['busy']=!![];this[_0xe04d('0x16')][_0xe04d('0x13')][this['agent']['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this[_0xe04d('0x16')],this['routing'],this['agent'],this[_0xe04d('0x6')][_0xe04d('0x17')]);util['showNotification'](this[_0xe04d('0x5')],this['squeue']['id'],this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']],null,this[_0xe04d('0x4')]);util[_0xe04d('0x18')](this[_0xe04d('0x6')]['id'],this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']],_0xe04d('0x19')+(this[_0xe04d('0x4')][_0xe04d('0x14')]?':FORCED':''));}else{logger[_0xe04d('0xf')](_0xe04d('0x1a'),this[_0xe04d('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xe04d('0x7')]['bind'](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x25299b){if(_[_0xe04d('0x12')](this['realtime']['agents'][this[_0xe04d('0x11')]['id']])){return logger[_0xe04d('0xf')](_0xe04d('0x1b'),this['squeue']['id'],this[_0xe04d('0x11')]['id']);}else{logger[_0xe04d('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe04d('0x6')]['id'],this['agent']['id']);util[_0xe04d('0x1c')](this[_0xe04d('0x5')],this['squeue']['id'],this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']],null,this[_0xe04d('0x4')]);this[_0xe04d('0x16')][_0xe04d('0x13')][this[_0xe04d('0x11')]['id']][_0xe04d('0x1d')]=![];this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']][_0xe04d('0x1e')]=undefined;util[_0xe04d('0x1f')](this[_0xe04d('0x16')],this[_0xe04d('0x4')],this[_0xe04d('0x11')],this[_0xe04d('0x6')][_0xe04d('0x17')]);util[_0xe04d('0x18')](this['squeue']['id'],this[_0xe04d('0x16')]['agents'][this[_0xe04d('0x11')]['id']],_0x25299b?'STOP':'TIMEOUT');}if(!_0x25299b){setTimeout(this[_0xe04d('0x7')][_0xe04d('0x9')](this),0x3e8);}};function agent(_0x261116,_0x2ad374,_0x56e74d,_0xa202ee){return new Agent(_0x261116,_0x2ad374,_0x56e74d,_0xa202ee);}module[_0xe04d('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 66f0a55..b44bc60 100644 --- a/server/services/routing/server/applications/strategy/beepall.js +++ b/server/services/routing/server/applications/strategy/beepall.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9e1=['handleRun','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','busy','busyQueue','name','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','realtime','routing','push','bind','handleTimeout','drained','handleDrained','prototype'];(function(_0xc7ad08,_0x2ccd1f){var _0x5c16a4=function(_0x19c1f4){while(--_0x19c1f4){_0xc7ad08['push'](_0xc7ad08['shift']());}};_0x5c16a4(++_0x2ccd1f);}(_0xe9e1,0xe9));var _0x1e9e=function(_0x1b500c,_0x2baf7b){_0x1b500c=_0x1b500c-0x0;var _0x1e39f1=_0xe9e1[_0x1b500c];return _0x1e39f1;};'use strict';var _=require(_0x1e9e('0x0'));var uuid=require(_0x1e9e('0x1'));var util=require(_0x1e9e('0x2'));var logger=require(_0x1e9e('0x3'))('routing');var Beepall=function(_0xe972b9,_0x4d2148,_0x4467ba,_0x43a243){this[_0x1e9e('0x4')]=uuid['v4']();this[_0x1e9e('0x5')]=_0xe972b9;this[_0x1e9e('0x6')]=_0x4d2148;this[_0x1e9e('0x7')]=_0x4467ba;this[_0x1e9e('0x8')]=_0x43a243;this[_0x1e9e('0x5')][_0x1e9e('0x9')](this['handleRun'][_0x1e9e('0xa')](this),this[_0x1e9e('0xb')]['bind'](this));this['squeue']['on']('timeout',this['handleTimeout'][_0x1e9e('0xa')](this));this[_0x1e9e('0x5')]['on'](_0x1e9e('0xc'),this[_0x1e9e('0xd')][_0x1e9e('0xa')](this));};Beepall[_0x1e9e('0xe')][_0x1e9e('0x9')]=function(){this[_0x1e9e('0x5')]['push'](this[_0x1e9e('0xf')][_0x1e9e('0xa')](this),this[_0x1e9e('0xb')][_0x1e9e('0xa')](this));};Beepall[_0x1e9e('0xe')][_0x1e9e('0xd')]=function(){this[_0x1e9e('0xb')](!![]);};Beepall[_0x1e9e('0xe')][_0x1e9e('0xf')]=function(){var _0x4d1a2f=!![];if(!_[_0x1e9e('0x10')](this[_0x1e9e('0x6')])&&!_['isNil'](this[_0x1e9e('0x6')]['Agents'])&&this[_0x1e9e('0x6')][_0x1e9e('0x11')][_0x1e9e('0x12')]>0x0){for(var _0x5701db=0x0,_0x1d292c;_0x5701db0x0){for(var _0x57be31=0x0,_0xbf7334;_0x57be310x0&&_0x5e2803[_0x44a56e+_0xbb8c('0x24')]>=_0x5e2803[_0x44a56e+_0xbb8c('0x22')]){writeLog(_0x1a1e92,_0x5e2803,_0x44a56e[_0xbb8c('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xbb8c('0x26')]=function(_0x5f4f96,_0x4a5684,_0xe7475d,_0x4c9d82,_0x47fb37){return sendNotification(!![],_0x5f4f96,_0x4a5684,_0xe7475d,_0x4c9d82,_0x47fb37);};exports[_0xbb8c('0x27')]=function(_0x283ec3,_0x36d351,_0x4928e4,_0x5b8cd1,_0x17576b){return sendNotification(![],_0x283ec3,_0x36d351,_0x4928e4,_0x5b8cd1,_0x17576b);};exports[_0xbb8c('0x28')]=function(_0x4cb223,_0x26c8cd,_0x23bf3d){var _0x292f11=_0x26c8cd['interaction'][_0xbb8c('0x29')];if(!_0x292f11&&_0x23bf3d){_0x292f11=_0x23bf3d['id'];}var _0x1e0e3=_[_0xbb8c('0x2a')](_0x4cb223[_0x26c8cd[_0xbb8c('0x2b')]+_0xbb8c('0x2c')],function(_0x387aa7){var _0x2f3db6=_[_0xbb8c('0x2d')](_0x26c8cd[_0xbb8c('0x2b')])+_0xbb8c('0x2e');return _0x387aa7[_0x2f3db6]===_0x26c8cd['interaction']['id'];});if(!_0x1e0e3&&_0x292f11&&_0x4cb223['agents'][_0x292f11]){_0x1e0e3=_[_0xbb8c('0x2a')](_0x4cb223[_0xbb8c('0x2f')][_0x292f11][_0x26c8cd[_0xbb8c('0x2b')]+_0xbb8c('0x30')],function(_0x3f60fc){return _0x3f60fc['id']===_0x26c8cd['interaction']['id'];});}return _0x1e0e3;};exports[_0xbb8c('0x31')]=function(_0x1e850c,_0x88958d,_0x1bdf52,_0x19f14e){if(_0x1bdf52&&_0x1bdf52['id']&&_0x1e850c[_0xbb8c('0x2f')]&&_0x1e850c[_0xbb8c('0x2f')][_0x1bdf52['id']]){_0x1e850c[_0xbb8c('0x2f')][_0x1bdf52['id']][_0x19f14e+_0xbb8c('0x30')][_0x88958d['message']['id']]={'id':_0x88958d[_0xbb8c('0x32')]['id']};}};exports[_0xbb8c('0x33')]=function(_0x17ea9d,_0x4893ab,_0x5c0d51,_0x25156b){if(_0x5c0d51&&_0x5c0d51['id']&&_0x17ea9d[_0xbb8c('0x2f')]&&_0x17ea9d[_0xbb8c('0x2f')][_0x5c0d51['id']]){delete _0x17ea9d[_0xbb8c('0x2f')][_0x5c0d51['id']][_0x25156b+'WaitingInteractions'][_0x4893ab[_0xbb8c('0x17')]['id']];}};exports[_0xbb8c('0x34')]=writeLog; \ No newline at end of file +var _0x0ffc=['showNotification','hideNotification','checkWaitingNotifications','interaction','channel','QueuesWaitingInteractions','InteractionId','agents','some','WaitingInteractions','removeWaitingNotification','util','../utils','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','split','\x20interaction','notificationSound','notificationShake','body','queue','notificationTemplate','msg','error','format','[%s][QUEUE]\x20%s','message','user:%s','name','emit','notification:%s','save','debug','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY'];(function(_0x2bebb2,_0x321313){var _0x277503=function(_0x15c37e){while(--_0x15c37e){_0x2bebb2['push'](_0x2bebb2['shift']());}};_0x277503(++_0x321313);}(_0x0ffc,0x9e));var _0xc0ff=function(_0x79028a,_0x5e6a2a){_0x79028a=_0x79028a-0x0;var _0x1daa07=_0x0ffc[_0x79028a];return _0x1daa07;};'use strict';var _=require('lodash');var util=require(_0xc0ff('0x0'));var utils=require(_0xc0ff('0x1'));var Redis=require('ioredis');var config=require(_0xc0ff('0x2'));var logger=require('../../../../../config/logger')(_0xc0ff('0x3'));config[_0xc0ff('0x4')]=_[_0xc0ff('0x5')](config[_0xc0ff('0x4')],{'host':_0xc0ff('0x6'),'port':0x18eb});var io=require(_0xc0ff('0x7'))(new Redis(config[_0xc0ff('0x4')]));function sendNotification(_0x1b69a1,_0x245f10,_0x51695d,_0x29f9b7,_0x2d6559,_0x3799e5){var _0x3479de=_0x3799e5||{};var _0x2b6779=_0x51695d[_0xc0ff('0x8')]('.');var _0xd6241={'uniqueid':_0x245f10,'channel':_0x2b6779[0x0],'id':_0x2b6779[0x1],'title':_0x2b6779[0x0]+_0xc0ff('0x9'),'interactionId':_0x2b6779[0x2],'queue':_0x2d6559?_0x2d6559['name']:null,'sound':_0x3479de['account'][_0xc0ff('0xa')],'shake':_0x3479de['account'][_0xc0ff('0xb')]};try{if(!_0x3479de[_0xc0ff('0xc')]){_0x3479de[_0xc0ff('0xc')]={};}if(_0x2d6559){_0x3479de[_0xc0ff('0xc')]['queue']=_0x2d6559;}else if(_0x3479de[_0xc0ff('0xc')][_0xc0ff('0xd')]){delete _0x3479de['body'][_0xc0ff('0xd')];}_0xd6241['msg']=utils['getMustacheRender'](_0x3479de['account'][_0xc0ff('0xe')],_0x3479de);}catch(_0xa91369){_0xd6241[_0xc0ff('0xf')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xc0ff('0x10')](util[_0xc0ff('0x11')](_0xc0ff('0x12'),_0x245f10,_0xa91369[_0xc0ff('0x13')]));}io['to'](util[_0xc0ff('0x11')](_0xc0ff('0x14'),_0x29f9b7[_0xc0ff('0x15')]))[_0xc0ff('0x16')](util[_0xc0ff('0x11')](_0xc0ff('0x17'),_0x1b69a1?_0xc0ff('0x18'):'remove'),_0xd6241);}function writeLog(_0x21b852,_0x5939e9,_0x13b3f3){return logger[_0xc0ff('0x19')](util[_0xc0ff('0x11')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x21b852,_0x5939e9[_0xc0ff('0x15')],_0x13b3f3));}exports[_0xc0ff('0x1a')]=function(_0x423b17,_0x212e4f,_0x362db7,_0x1fd7ad){if(_0x212e4f[_0xc0ff('0x1b')]){writeLog(_0x423b17,_0x212e4f,_0xc0ff('0x1c'));return![];}if(!_0x212e4f[_0xc0ff('0x1d')]){writeLog(_0x423b17,_0x212e4f,_0xc0ff('0x1e'));return![];}if(_0x212e4f[_0x362db7+_0xc0ff('0x1f')]){writeLog(_0x423b17,_0x212e4f,_0xc0ff('0x20'));return![];}if(_0x1fd7ad&&_0x212e4f[_0xc0ff('0x21')](_0x362db7+_0xc0ff('0x22'))&&_0x212e4f[_0xc0ff('0x21')](_0x362db7+_0xc0ff('0x23'))){if(_0x212e4f[_0x362db7+'Capacity']>0x0&&_0x212e4f[_0x362db7+_0xc0ff('0x23')]>=_0x212e4f[_0x362db7+'Capacity']){writeLog(_0x423b17,_0x212e4f,_0x362db7[_0xc0ff('0x24')]()+_0xc0ff('0x25'));return![];}}return!![];};exports[_0xc0ff('0x26')]=function(_0x3fc9c3,_0x25f8a0,_0x3b4609,_0x4a62b4,_0x19220d){return sendNotification(!![],_0x3fc9c3,_0x25f8a0,_0x3b4609,_0x4a62b4,_0x19220d);};exports[_0xc0ff('0x27')]=function(_0x538f46,_0x59ce29,_0x37d97c,_0x1ea3a9,_0x2509ce){return sendNotification(![],_0x538f46,_0x59ce29,_0x37d97c,_0x1ea3a9,_0x2509ce);};exports[_0xc0ff('0x28')]=function(_0x2f590f,_0xd0115e,_0x3d5699){var _0xed7156=_0xd0115e[_0xc0ff('0x29')]['UserId'];if(!_0xed7156&&_0x3d5699){_0xed7156=_0x3d5699['id'];}var _0x4cbd46=_['some'](_0x2f590f[_0xd0115e[_0xc0ff('0x2a')]+_0xc0ff('0x2b')],function(_0x34a65c){var _0xf60f5a=_['capitalize'](_0xd0115e[_0xc0ff('0x2a')])+_0xc0ff('0x2c');return _0x34a65c[_0xf60f5a]===_0xd0115e[_0xc0ff('0x29')]['id'];});if(!_0x4cbd46&&_0xed7156&&_0x2f590f[_0xc0ff('0x2d')][_0xed7156]){_0x4cbd46=_[_0xc0ff('0x2e')](_0x2f590f[_0xc0ff('0x2d')][_0xed7156][_0xd0115e[_0xc0ff('0x2a')]+_0xc0ff('0x2f')],function(_0x5f5dbf){return _0x5f5dbf['id']===_0xd0115e[_0xc0ff('0x29')]['id'];});}return _0x4cbd46;};exports['saveWaitingNotification']=function(_0x4d5826,_0x431898,_0x13abef,_0x5651ba){if(_0x13abef&&_0x13abef['id']&&_0x4d5826[_0xc0ff('0x2d')]&&_0x4d5826[_0xc0ff('0x2d')][_0x13abef['id']]){_0x4d5826[_0xc0ff('0x2d')][_0x13abef['id']][_0x5651ba+_0xc0ff('0x2f')][_0x431898[_0xc0ff('0x13')]['id']]={'id':_0x431898[_0xc0ff('0x29')]['id']};}};exports[_0xc0ff('0x30')]=function(_0x5af683,_0x21e094,_0x22818,_0x5c944f){if(_0x22818&&_0x22818['id']&&_0x5af683[_0xc0ff('0x2d')]&&_0x5af683[_0xc0ff('0x2d')][_0x22818['id']]){delete _0x5af683[_0xc0ff('0x2d')][_0x22818['id']][_0x5c944f+_0xc0ff('0x2f')][_0x21e094[_0xc0ff('0x13')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 1c877ad..b055d88 100644 --- a/server/services/routing/server/applications/system.js +++ b/server/services/routing/server/applications/system.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7a2=['validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','isObject','stringify'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc7a2,0x118));var _0x2c7a=function(_0x347b96,_0x18ba98){_0x347b96=_0x347b96-0x0;var _0x19c17e=_0xc7a2[_0x347b96];return _0x19c17e;};'use strict';var schema=require(_0x2c7a('0x0'));var sh=require(_0x2c7a('0x1'));var _=require(_0x2c7a('0x2'));var utils=require(_0x2c7a('0x3'));var logger=require(_0x2c7a('0x4'))(_0x2c7a('0x5'));var system=schema({'command':{'type':_0x2c7a('0x6'),'required':!![],'message':_0x2c7a('0x7')}});exports[_0x2c7a('0x8')]=function(_0x302266,_0x430345){return function(_0x4b1a5b){try{var _0x1f8b14={'command':_0x430345[0x0]};var _0x241569=system[_0x2c7a('0x0')](_0x1f8b14,{'typecast':!![]});if(_0x241569[_0x2c7a('0x9')]){logger[_0x2c7a('0xa')](_0x2c7a('0xb'),_0x302266,_['map'](_0x241569,_0x2c7a('0xc'))[_0x2c7a('0xd')](',\x20'));logger[_0x2c7a('0xe')](_0x2c7a('0xf'),_0x302266);_0x4b1a5b[_0x2c7a('0x10')]();}else{var _0x43a8e3=this;var _0x4446c6=utils[_0x2c7a('0x11')](_0x430345[0x0],this);logger[_0x2c7a('0xe')](_0x2c7a('0x12'),_0x302266,_0x4446c6);sh[_0x2c7a('0x13')](_[_0x2c7a('0x14')](_0x4446c6),function(_0x47e23b,_0xa9ecc5){logger[_0x2c7a('0xe')](_0x2c7a('0x15'),_0x302266,_0x47e23b);if(_0x47e23b==0x0){var _0x5a5f5f=_0xa9ecc5[_0x2c7a('0x16')](/(\r\n|\n|\r)/gm,'');if(_[_0x2c7a('0x17')](_0x430345[0x1])||_[_0x2c7a('0x18')](_0x430345[0x1])){logger['info'](_0x2c7a('0x19'),_0x302266);_0x43a8e3['body'][_0x430345[0x1]]=_0x5a5f5f;}else{logger[_0x2c7a('0xe')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x302266,_0x430345[0x1],_0x5a5f5f);_0x43a8e3['body'][_0x430345[0x1]]=_0x5a5f5f;}}_0x4b1a5b[_0x2c7a('0x10')]();});}}catch(_0xe74d6f){logger['error'](_0x2c7a('0xb'),_0x302266,_[_0x2c7a('0x1a')](_0xe74d6f)?JSON[_0x2c7a('0x1b')](_0xe74d6f):_0xe74d6f);logger[_0x2c7a('0xe')](_0x2c7a('0xf'),_0x302266);_0x4b1a5b[_0x2c7a('0x10')]();}};}; \ No newline at end of file +var _0x1ef8=['body','next','[%s][SYSTEM]\x20%s','isObject','stringify','validate','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x429373,_0x3e3518){var _0x24ca95=function(_0x314cfb){while(--_0x314cfb){_0x429373['push'](_0x429373['shift']());}};_0x24ca95(++_0x3e3518);}(_0x1ef8,0xd5));var _0x81ef=function(_0x524d8f,_0x2a767f){_0x524d8f=_0x524d8f-0x0;var _0x2cf7eb=_0x1ef8[_0x524d8f];return _0x2cf7eb;};'use strict';var schema=require(_0x81ef('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x81ef('0x1'));var system=schema({'command':{'type':_0x81ef('0x2'),'required':!![],'message':_0x81ef('0x3')}});exports[_0x81ef('0x4')]=function(_0x28ed6e,_0x4cca02){return function(_0x5ad10c){try{var _0x4a92ea={'command':_0x4cca02[0x0]};var _0x4486ec=system[_0x81ef('0x0')](_0x4a92ea,{'typecast':!![]});if(_0x4486ec[_0x81ef('0x5')]){logger[_0x81ef('0x6')]('[%s][SYSTEM]\x20%s',_0x28ed6e,_[_0x81ef('0x7')](_0x4486ec,_0x81ef('0x8'))[_0x81ef('0x9')](',\x20'));logger[_0x81ef('0xa')](_0x81ef('0xb'),_0x28ed6e);_0x5ad10c['next']();}else{var _0x172a2b=this;var _0x162701=utils['getMustacheRender'](_0x4cca02[0x0],this);logger[_0x81ef('0xa')](_0x81ef('0xc'),_0x28ed6e,_0x162701);sh[_0x81ef('0xd')](_[_0x81ef('0xe')](_0x162701),function(_0x3264ad,_0x2d509d){logger[_0x81ef('0xa')](_0x81ef('0xf'),_0x28ed6e,_0x3264ad);if(_0x3264ad==0x0){var _0x20b1d4=_0x2d509d[_0x81ef('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x81ef('0x11')](_0x4cca02[0x1])||_[_0x81ef('0x12')](_0x4cca02[0x1])){logger[_0x81ef('0xa')](_0x81ef('0x13'),_0x28ed6e);_0x172a2b['body'][_0x4cca02[0x1]]=_0x20b1d4;}else{logger[_0x81ef('0xa')](_0x81ef('0x14'),_0x28ed6e,_0x4cca02[0x1],_0x20b1d4);_0x172a2b[_0x81ef('0x15')][_0x4cca02[0x1]]=_0x20b1d4;}}_0x5ad10c[_0x81ef('0x16')]();});}}catch(_0x1a4cb2){logger[_0x81ef('0x6')](_0x81ef('0x17'),_0x28ed6e,_[_0x81ef('0x18')](_0x1a4cb2)?JSON[_0x81ef('0x19')](_0x1a4cb2):_0x1a4cb2);logger['info'](_0x81ef('0xb'),_0x28ed6e);_0x5ad10c['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 11b3d3c..91c0112 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb86=['interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction'];(function(_0x233b17,_0x2a92dd){var _0x2a04a4=function(_0x344cad){while(--_0x344cad){_0x233b17['push'](_0x233b17['shift']());}};_0x2a04a4(++_0x2a92dd);}(_0xeb86,0x19e));var _0x6eb8=function(_0x1bb666,_0x34749a){_0x1bb666=_0x1bb666-0x0;var _0x3e85a8=_0xeb86[_0x1bb666];return _0x3e85a8;};'use strict';var schema=require(_0x6eb8('0x0'));var _=require(_0x6eb8('0x1'));var rpc={'chatInteraction':require(_0x6eb8('0x2')),'openchannelInteraction':require(_0x6eb8('0x3')),'smsInteraction':require(_0x6eb8('0x4')),'mailInteraction':require(_0x6eb8('0x5')),'faxInteraction':require(_0x6eb8('0x6')),'whatsappInteraction':require(_0x6eb8('0x7'))};var logger=require(_0x6eb8('0x8'))(_0x6eb8('0x9'));var tag=schema({'tag':{'type':_0x6eb8('0xa'),'required':!![],'message':_0x6eb8('0xb')}});exports[_0x6eb8('0xc')]=function(_0x215f13,_0x4f90dc,_0x13c9ca,_0x558f12){return function(_0x57c3ae){try{var _0x31a29f={'tag':_0x4f90dc[0x0]};var _0x354abb=tag[_0x6eb8('0x0')](_0x31a29f,{'typecast':!![]});if(_0x354abb[_0x6eb8('0xd')]){logger[_0x6eb8('0xe')]('[%s][TAG]\x20%s',_0x215f13,_['map'](_0x354abb,_0x6eb8('0xf'))[_0x6eb8('0x10')](',\x20'));logger['info'](_0x6eb8('0x11'),_0x215f13);_0x57c3ae[_0x6eb8('0x12')]();}else{var _0x4c836b={'ids':[_0x4f90dc[0x0]]};if(rpc[_0x558f12[_0x6eb8('0x13')]+_0x6eb8('0x14')]){rpc[_0x558f12['channel']+_0x6eb8('0x14')]['addTags'](_0x558f12[_0x6eb8('0x15')]['id'],_0x4c836b)[_0x6eb8('0x16')](function(_0xc307c4){logger[_0x6eb8('0x17')](_0x6eb8('0x18'),_0x215f13,_0x4f90dc[0x1],_0x558f12['channel'],_0x558f12['interaction']['id']);})[_0x6eb8('0x19')](function(_0x311ec8){logger[_0x6eb8('0xe')]('[%s][TAG]\x20%s',_0x215f13,JSON[_0x6eb8('0x1a')](_0x311ec8));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x215f13);})[_0x6eb8('0x1b')](function(){_0x57c3ae[_0x6eb8('0x12')]();});}}}catch(_0x465aba){logger[_0x6eb8('0xe')]('[%s][TAG]\x20%s',_0x215f13,_[_0x6eb8('0x1c')](_0x465aba)?JSON['stringify'](_0x465aba):_0x465aba);logger[_0x6eb8('0x17')](_0x6eb8('0x11'),_0x215f13);_0x57c3ae[_0x6eb8('0x12')]();}};}; \ No newline at end of file +var _0x562c=['isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','finally'];(function(_0x1259c3,_0x1c8103){var _0x527ff1=function(_0x1ce318){while(--_0x1ce318){_0x1259c3['push'](_0x1259c3['shift']());}};_0x527ff1(++_0x1c8103);}(_0x562c,0x16e));var _0xc562=function(_0x258b26,_0x5928fb){_0x258b26=_0x258b26-0x0;var _0x528924=_0x562c[_0x258b26];return _0x528924;};'use strict';var schema=require(_0xc562('0x0'));var _=require(_0xc562('0x1'));var rpc={'chatInteraction':require(_0xc562('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xc562('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xc562('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xc562('0x5'));var tag=schema({'tag':{'type':_0xc562('0x6'),'required':!![],'message':_0xc562('0x7')}});exports[_0xc562('0x8')]=function(_0x3ad7d2,_0x2d75ae,_0x1a7634,_0x414c33){return function(_0x20732f){try{var _0x34ef7d={'tag':_0x2d75ae[0x0]};var _0x402b7e=tag[_0xc562('0x0')](_0x34ef7d,{'typecast':!![]});if(_0x402b7e[_0xc562('0x9')]){logger[_0xc562('0xa')]('[%s][TAG]\x20%s',_0x3ad7d2,_[_0xc562('0xb')](_0x402b7e,'message')[_0xc562('0xc')](',\x20'));logger[_0xc562('0xd')](_0xc562('0xe'),_0x3ad7d2);_0x20732f[_0xc562('0xf')]();}else{var _0x224ec8={'ids':[_0x2d75ae[0x0]]};if(rpc[_0x414c33[_0xc562('0x10')]+_0xc562('0x11')]){rpc[_0x414c33['channel']+_0xc562('0x11')][_0xc562('0x12')](_0x414c33[_0xc562('0x13')]['id'],_0x224ec8)[_0xc562('0x14')](function(_0x5f57db){logger[_0xc562('0xd')](_0xc562('0x15'),_0x3ad7d2,_0x2d75ae[0x1],_0x414c33[_0xc562('0x10')],_0x414c33[_0xc562('0x13')]['id']);})['catch'](function(_0x32a73f){logger[_0xc562('0xa')](_0xc562('0x16'),_0x3ad7d2,JSON['stringify'](_0x32a73f));logger[_0xc562('0xd')](_0xc562('0xe'),_0x3ad7d2);})[_0xc562('0x17')](function(){_0x20732f[_0xc562('0xf')]();});}}}catch(_0x1712e2){logger[_0xc562('0xa')](_0xc562('0x16'),_0x3ad7d2,_[_0xc562('0x18')](_0x1712e2)?JSON[_0xc562('0x19')](_0x1712e2):_0x1712e2);logger[_0xc562('0xd')](_0xc562('0xe'),_0x3ad7d2);_0x20732f[_0xc562('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 72c56b0..6094cb7 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c51=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','stringify','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','replace','includes','?params=','urlOnRing','jsonrpc','method','login','push','utf8','POST','application/json-rpc','then','parse','result','logged'];(function(_0x56e310,_0xcfe4fb){var _0x3ad95f=function(_0x2e03aa){while(--_0x2e03aa){_0x56e310['push'](_0x56e310['shift']());}};_0x3ad95f(++_0xcfe4fb);}(_0x7c51,0xae));var _0x17c5=function(_0x517e5d,_0x2c1b7f){_0x517e5d=_0x517e5d-0x0;var _0x2967d8=_0x7c51[_0x517e5d];return _0x2967d8;};'use strict';var rp=require(_0x17c5('0x0'));var logger=require(_0x17c5('0x1'))(_0x17c5('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x2b2520,_0x245e72){return function(_0x407b27){var _0x24a6bb=_0x245e72[0xa];var _0x179d01=_0x245e72[0xb];var _0x57aadf=_0x245e72[0xc];var _0x2893b1=_0x245e72[0xd];var _0x212be6=_0x245e72[0xe];var _0x1b0385=_0x245e72[0xf][_0x17c5('0x3')](/\n/g,'\x20-\x20');var _0xf362d9=_0x245e72[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x17c5('0x4')](_0x179d01)){arr['push'](_0x179d01);var _0x776f49=_0x245e72[0x3];var _0x3ae93b=_0x245e72[0x4];var _0x4841b3=_0x245e72[0x1];var _0x429f61=_0x245e72[0x0];var _0x7962e9={};_0x7962e9['urlOnAnswer']=_0x245e72[0x8]+_0x17c5('0x5')+_0x57aadf+'|'+_0x24a6bb+'|'+_0x2893b1+'|'+_0x179d01+'|'+_0x212be6;_0x7962e9[_0x17c5('0x6')]=_0x245e72[0x7]+_0x17c5('0x5')+_0x57aadf+'|'+_0x24a6bb+'|'+_0x2893b1+'|'+_0x179d01+'|'+_0x212be6+'|'+_0x1b0385+'|'+_0xf362d9;_0x7962e9['title']=_0x245e72[0x9];var _0x524552={};_0x524552[_0x17c5('0x7')]='2.0';_0x524552[_0x17c5('0x8')]=_0x17c5('0x9');var _0x5cf8b6=[];_0x5cf8b6[_0x17c5('0xa')](_0x245e72[0x2]);_0x5cf8b6[_0x17c5('0xa')](_0x245e72[0x5]);_0x5cf8b6[_0x17c5('0xa')](_0x245e72[0x6]);_0x524552['params']=_0x5cf8b6;_0x524552['id']=0x1;var _0x2ac8c6=JSON['stringify'](_0x524552);var _0xe55c3f={'encoding':_0x17c5('0xb'),'method':_0x17c5('0xc'),'timeout':0x2710,'url':_0x776f49,'headers':{'Content-Type':_0x17c5('0xd')},'body':_0x2ac8c6};return rp(_0xe55c3f)[_0x17c5('0xe')](function(_0x220142){const _0x515020=JSON[_0x17c5('0xf')](_0x220142);if(!_0x515020[_0x17c5('0x10')][_0x17c5('0x11')]){throw new Error(_0x17c5('0x12'));}var _0x375775=_0x179d01;var _0x31bce2=_0x17c5('0x13')+_0x4841b3+_0x17c5('0x14')+_0x429f61+_0x17c5('0x15')+_0x375775+_0x17c5('0x16')+JSON['stringify'](_0x7962e9);var _0x5cefc6=_0x3ae93b+'?'+_0x31bce2;return rp(_0x5cefc6);})[_0x17c5('0xe')](function(_0x36514b){logger['info'](_0x17c5('0x17'),_0x2b2520,_0x36514b);_0x407b27[_0x17c5('0x18')]();})[_0x17c5('0x19')](function(_0x5aba55){logger[_0x17c5('0x1a')](_0x17c5('0x1b'),_0x2b2520,_['isObject'](_0x5aba55)?JSON[_0x17c5('0x1c')](_0x5aba55):_0x5aba55);_0x407b27[_0x17c5('0x18')]();});}else{logger[_0x17c5('0x1d')](_0x17c5('0x1e'),_0x2b2520);_0x407b27[_0x17c5('0x1f')]();}};}; \ No newline at end of file +var _0x4dd5=['title','jsonrpc','2.0','method','login','params','stringify','utf8','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','\x20-\x20','includes','push','?params='];(function(_0x48a7e5,_0x28e557){var _0x4bd8ea=function(_0x521291){while(--_0x521291){_0x48a7e5['push'](_0x48a7e5['shift']());}};_0x4bd8ea(++_0x28e557);}(_0x4dd5,0x107));var _0x54dd=function(_0x239546,_0x19def0){_0x239546=_0x239546-0x0;var _0x5a43b7=_0x4dd5[_0x239546];return _0x5a43b7;};'use strict';var rp=require(_0x54dd('0x0'));var logger=require(_0x54dd('0x1'))(_0x54dd('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x23416d,_0x1a0cd5){return function(_0x5268fb){var _0x3f5bda=_0x1a0cd5[0xa];var _0x26989e=_0x1a0cd5[0xb];var _0xf9778b=_0x1a0cd5[0xc];var _0x2b7966=_0x1a0cd5[0xd];var _0x40c398=_0x1a0cd5[0xe];var _0x49b0dd=_0x1a0cd5[0xf]['replace'](/\n/g,_0x54dd('0x3'));var _0x1087dd=_0x1a0cd5[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x54dd('0x4')](_0x26989e)){arr[_0x54dd('0x5')](_0x26989e);var _0x4520f0=_0x1a0cd5[0x3];var _0x2f006a=_0x1a0cd5[0x4];var _0x1e938b=_0x1a0cd5[0x1];var _0x16cdb4=_0x1a0cd5[0x0];var _0x4a3fd3={};_0x4a3fd3['urlOnAnswer']=_0x1a0cd5[0x8]+_0x54dd('0x6')+_0xf9778b+'|'+_0x3f5bda+'|'+_0x2b7966+'|'+_0x26989e+'|'+_0x40c398;_0x4a3fd3['urlOnRing']=_0x1a0cd5[0x7]+_0x54dd('0x6')+_0xf9778b+'|'+_0x3f5bda+'|'+_0x2b7966+'|'+_0x26989e+'|'+_0x40c398+'|'+_0x49b0dd+'|'+_0x1087dd;_0x4a3fd3[_0x54dd('0x7')]=_0x1a0cd5[0x9];var _0x32af3c={};_0x32af3c[_0x54dd('0x8')]=_0x54dd('0x9');_0x32af3c[_0x54dd('0xa')]=_0x54dd('0xb');var _0x251181=[];_0x251181[_0x54dd('0x5')](_0x1a0cd5[0x2]);_0x251181['push'](_0x1a0cd5[0x5]);_0x251181['push'](_0x1a0cd5[0x6]);_0x32af3c[_0x54dd('0xc')]=_0x251181;_0x32af3c['id']=0x1;var _0x2204ae=JSON[_0x54dd('0xd')](_0x32af3c);var _0x1a57bb={'encoding':_0x54dd('0xe'),'method':'POST','timeout':0x2710,'url':_0x4520f0,'headers':{'Content-Type':_0x54dd('0xf')},'body':_0x2204ae};return rp(_0x1a57bb)[_0x54dd('0x10')](function(_0x5a1345){const _0x4fdab9=JSON[_0x54dd('0x11')](_0x5a1345);if(!_0x4fdab9[_0x54dd('0x12')][_0x54dd('0x13')]){throw new Error(_0x54dd('0x14'));}var _0x3b1a90=_0x26989e;var _0x303095=_0x54dd('0x15')+_0x1e938b+_0x54dd('0x16')+_0x16cdb4+'&sessionId='+_0x3b1a90+_0x54dd('0x17')+JSON['stringify'](_0x4a3fd3);var _0x4036e0=_0x2f006a+'?'+_0x303095;return rp(_0x4036e0);})['then'](function(_0x150c62){logger[_0x54dd('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x23416d,_0x150c62);_0x5268fb[_0x54dd('0x19')]();})[_0x54dd('0x1a')](function(_0x152b27){logger[_0x54dd('0x1b')](_0x54dd('0x1c'),_0x23416d,_['isObject'](_0x152b27)?JSON['stringify'](_0x152b27):_0x152b27);_0x5268fb[_0x54dd('0x19')]();});}else{logger['info'](_0x54dd('0x1d'),_0x23416d);_0x5268fb['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index f08b11f..9609dcb 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x3ebf88,_0x557ffb){var _0x27be98=function(_0x515b57){while(--_0x515b57){_0x3ebf88['push'](_0x3ebf88['shift']());}};_0x27be98(++_0x557ffb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x22fa65,_0x34181f){var _0xf05b62=function(_0xbd0962){while(--_0xbd0962){_0x22fa65['push'](_0x22fa65['shift']());}};_0xf05b62(++_0x34181f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index e2642ca..5f15f80 100644 --- a/server/services/routing/server/index.js +++ b/server/services/routing/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b8e=['body','format','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','\x20|\x20','error','execute','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','appdata','push','slice','dialogflow','dialogflowv2','split','amazonlex','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x8b8e,0x108));var _0xe8b8=function(_0x29f905,_0x5d45a2){_0x29f905=_0x29f905-0x0;var _0x562d8a=_0x8b8e[_0x29f905];return _0x562d8a;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var path=require(_0xe8b8('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xe8b8('0x2'));var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require(_0xe8b8('0x3'))(_0xe8b8('0x4'));var rpc={'openchannelQueueReport':require(_0xe8b8('0x5')),'mailQueueReport':require(_0xe8b8('0x6')),'chatQueueReport':require(_0xe8b8('0x7')),'smsQueueReport':require(_0xe8b8('0x8')),'faxQueueReport':require(_0xe8b8('0x9')),'whatsappQueueReport':require(_0xe8b8('0xa'))};var RuleEngine=require(_0xe8b8('0xb'));function getId(_0x2540e3,_0x4ce796,_0x2a4ccd){return util['format'](_0xe8b8('0xc'),_0x2540e3,_0x4ce796||0x0,_0x2a4ccd||0x0);}function getIntervals(_0x4ea70a,_0x48b59f){var _0x2ccbeb=[];if(!_[_0xe8b8('0xd')](_0x48b59f['IntervalId'])&&!_['isNil'](_0x4ea70a[_0x48b59f[_0xe8b8('0xe')]])&&!_[_0xe8b8('0xd')](_0x4ea70a[_0x48b59f[_0xe8b8('0xe')]][_0xe8b8('0xf')])){_0x2ccbeb=_[_0xe8b8('0x10')](_0x4ea70a[_0x48b59f[_0xe8b8('0xe')]][_0xe8b8('0xf')],_0xe8b8('0x11'));}else if(!_[_0xe8b8('0xd')](_0x48b59f[_0xe8b8('0x11')])){_0x2ccbeb=[_0x48b59f[_0xe8b8('0x11')]];}return _0x2ccbeb;}exports[_0xe8b8('0x12')]=function(_0x30bfc7){_0x30bfc7[_0xe8b8('0x13')]={};return new BPromise(function(_0x4a3e9f,_0x3df267){var _0x52ff32={'Start':function(_0x282ea8){var _0x290c30=this;return new Promise(function(_0x288699,_0x36df40){if(_0x282ea8){try{var _0x3d9e34=[];var _0x2fdd5b=getId(_0x282ea8[_0xe8b8('0x14')],_0x282ea8[_0xe8b8('0x15')]?_0x282ea8[_0xe8b8('0x15')]['id']:0x0,_0x282ea8[_0xe8b8('0x16')]?_0x282ea8['interaction']['id']:0x0);var _0xbaca4a=sUtils[_0xe8b8('0x17')](_0x30bfc7,_0x282ea8);if(_0x282ea8['transfer']||!_0xbaca4a&&_0x282ea8[_0xe8b8('0x18')]&&_[_0xe8b8('0x19')](_0x282ea8[_0xe8b8('0x18')])&&_0x282ea8[_0xe8b8('0x18')][_0xe8b8('0x1a')]){for(var _0x23a0ad=0x0;_0x23a0ad<_0x282ea8[_0xe8b8('0x18')][_0xe8b8('0x1a')];_0x23a0ad+=0x1){var _0x29e96=_0x282ea8[_0xe8b8('0x18')][_0x23a0ad];if(fs[_0xe8b8('0x1b')](path[_0xe8b8('0x1c')](__dirname,_0xe8b8('0x18'),_0x29e96[_0xe8b8('0x1d')]+_0xe8b8('0x1e')))){var _0x838cd4=[];switch(_0x29e96[_0xe8b8('0x1d')]['toLowerCase']()){case'autoreply':var _0x566721=_0x29e96[_0xe8b8('0x1f')]['split'](',');if(_0x282ea8[_0xe8b8('0x14')]==='mail'){_0x838cd4[_0xe8b8('0x20')](_0x566721[0x0]);_0x838cd4[_0xe8b8('0x20')](_0x566721[0x1]);_0x838cd4['push'](_0x566721['slice'](0x2,_0x566721[_0xe8b8('0x1a')])[_0xe8b8('0x1c')](','));}else{_0x838cd4['push'](_0x566721[0x0]);_0x838cd4[_0xe8b8('0x20')](_0x566721[_0xe8b8('0x21')](0x1,_0x566721[_0xe8b8('0x1a')])[_0xe8b8('0x1c')](','));}break;case _0xe8b8('0x22'):var _0x4c2f6d=_0x29e96[_0xe8b8('0x1f')]['split'](',');_0x838cd4[_0xe8b8('0x20')](_0x4c2f6d[0x0]);_0x838cd4[_0xe8b8('0x20')](_0x4c2f6d[0x1]);_0x838cd4[_0xe8b8('0x20')](_0x4c2f6d[_0xe8b8('0x21')](0x2,_0x4c2f6d['length'])['join'](','));break;case _0xe8b8('0x23'):var _0x3e6014=_0x29e96[_0xe8b8('0x1f')][_0xe8b8('0x24')](',');_0x838cd4[_0xe8b8('0x20')](_0x3e6014[0x0]);_0x838cd4['push'](_0x3e6014[0x1]);_0x838cd4[_0xe8b8('0x20')](_0x3e6014[0x2]);_0x838cd4[_0xe8b8('0x20')](_0x3e6014[0x3]);_0x838cd4[_0xe8b8('0x20')](_0x3e6014[_0xe8b8('0x21')](0x4,_0x3e6014[_0xe8b8('0x1a')])[_0xe8b8('0x1c')](','));break;case _0xe8b8('0x25'):var _0x3c32a6=_0x29e96[_0xe8b8('0x1f')][_0xe8b8('0x24')](',');_0x838cd4[_0xe8b8('0x20')](_0x3c32a6[0x0]);_0x838cd4['push'](_0x3c32a6[0x1]);_0x838cd4[_0xe8b8('0x20')](_0x3c32a6[0x2]);_0x838cd4[_0xe8b8('0x20')](_0x3c32a6[0x3]);_0x838cd4[_0xe8b8('0x20')](_0x3c32a6['slice'](0x4,_0x3c32a6[_0xe8b8('0x1a')])[_0xe8b8('0x1c')](','));break;case _0xe8b8('0x15'):_0x838cd4[_0xe8b8('0x20')](_0x29e96[_0xe8b8('0x1f')]);break;case _0xe8b8('0x26'):_0x838cd4[_0xe8b8('0x20')](_0x29e96[_0xe8b8('0x27')]);_0x838cd4[_0xe8b8('0x20')](_0x29e96['appdata']);break;case _0xe8b8('0x28'):var _0x1b74c4=utils['getMustacheRender'](_0x282ea8[_0xe8b8('0x29')][_0xe8b8('0x2a')],_0x282ea8);var _0x332295=_0x29e96[_0xe8b8('0x1f')][_0xe8b8('0x24')](',');_0x838cd4['push'](_0x332295[0x0]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x1]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x2]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x3]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x4]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x5]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x6]);_0x838cd4['push'](_0x332295[0x7]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x8]);_0x838cd4['push'](_0x332295[0x9]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0xa]);_0x838cd4[_0xe8b8('0x20')](_0x282ea8['interaction']['id']);_0x838cd4['push'](_0x282ea8[_0xe8b8('0x15')]['id']);_0x838cd4[_0xe8b8('0x20')](_0x29e96[_0xe8b8('0x2b')]);_0x838cd4[_0xe8b8('0x20')](_0x282ea8['interaction'][_0xe8b8('0x2c')]);_0x838cd4[_0xe8b8('0x20')](_0x282ea8[_0xe8b8('0x2d')][_0xe8b8('0x2d')]);_0x838cd4[_0xe8b8('0x20')](_0x1b74c4);break;default:_0x838cd4=_[_0xe8b8('0xd')](_0x29e96[_0xe8b8('0x1f')])?[]:_0x29e96[_0xe8b8('0x1f')]['split'](',');}var _0x4d63a0={'id':util[_0xe8b8('0x2e')](_0xe8b8('0x2f'),_0x2fdd5b,_0x29e96['id'],_0x29e96[_0xe8b8('0x1d')]),'condition':require('./interval')[_0xe8b8('0x30')](_0x2fdd5b,getIntervals(_0x30bfc7[_0xe8b8('0x31')],_0x29e96),_0x30bfc7),'consequence':require(_0xe8b8('0x32')+_0x29e96[_0xe8b8('0x1d')])[_0xe8b8('0x33')](_0x2fdd5b,_0x838cd4,_0x30bfc7,_0x282ea8),'p':_0x29e96[_0xe8b8('0x34')]||0x0};logger[_0xe8b8('0x35')]('Push\x20new\x20rule',_0x4d63a0['id'],'on\x20interval',getIntervals(_0x30bfc7['intervals'],_0x29e96)[_0xe8b8('0x1c')](_0xe8b8('0x36')));_0x3d9e34[_0xe8b8('0x20')](_0x4d63a0);}else{logger[_0xe8b8('0x37')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xe8b8('0x1c')](__dirname,_0xe8b8('0x18'),_0x29e96[_0xe8b8('0x1d')]+_0xe8b8('0x1e')));}}_0x30bfc7['rules'][_0x2fdd5b]=new RuleEngine(_0x3d9e34);_0x30bfc7['rules'][_0x2fdd5b][_0xe8b8('0x38')](_0x282ea8,function(_0x376c8c){logger[_0xe8b8('0x35')]('Applications\x20executed',JSON[_0xe8b8('0x39')](_0x376c8c[_0xe8b8('0x3a')]));if(_0x30bfc7[_0xe8b8('0x13')][_0x2fdd5b]){_0x30bfc7[_0xe8b8('0x13')][_0x2fdd5b]['emit'](_0xe8b8('0x3b'));}});return _0x288699({'code':0xc8,'message':_0x282ea8});}else{if(_0xbaca4a){logger[_0xe8b8('0x35')](util[_0xe8b8('0x2e')](_0xe8b8('0x3c'),_0x2fdd5b));}else{logger[_0xe8b8('0x35')](_0xe8b8('0x3d'));}return _0x288699({'code':0xc8,'message':_0x282ea8});}}catch(_0x1a8380){logger[_0xe8b8('0x37')](_0x1a8380[_0xe8b8('0x3e')]);return _0x36df40(_0x290c30[_0xe8b8('0x37')](0x1f4,_0x1a8380));}}return _0x36df40(_0xe8b8('0x3f'));});},'AcceptMessage':function(_0xb51b61){var _0x562d50=this;return new Promise(function(_0x4e7cc8,_0x442c58){if(_0xb51b61[_0xe8b8('0x40')]&&_0xb51b61[_0xe8b8('0x40')]['id']){if(_0x30bfc7[_0xe8b8('0x41')][_0xb51b61[_0xe8b8('0x40')]['id']]){_0x30bfc7[_0xe8b8('0x41')][_0xb51b61[_0xe8b8('0x40')]['id']]['busy']=![];_0x30bfc7['agents'][_0xb51b61[_0xe8b8('0x40')]['id']][_0xe8b8('0x42')]=undefined;}}if(_0xb51b61['message']&&_0xb51b61[_0xe8b8('0x15')]['id']){try{var _0x1e61eb=getId(_0xb51b61[_0xe8b8('0x14')],_0xb51b61[_0xe8b8('0x15')]?_0xb51b61[_0xe8b8('0x15')]['id']:0x0,_0xb51b61[_0xe8b8('0x16')]?_0xb51b61[_0xe8b8('0x16')]['id']:0x0);if(_0x30bfc7[_0xe8b8('0x13')][_0x1e61eb]){_0x30bfc7[_0xe8b8('0x13')][_0x1e61eb][_0xe8b8('0x43')](_0xe8b8('0x44'));if(rpc[_0xb51b61[_0xe8b8('0x14')]+'QueueReport']){rpc[_0xb51b61[_0xe8b8('0x14')]+'QueueReport'][_0xe8b8('0x45')](_0x1e61eb,{'UserId':_0xb51b61[_0xe8b8('0x15')][_0xe8b8('0x46')]})[_0xe8b8('0x47')](function(){logger['error'](_0xe8b8('0x48'));});}}return _0x4e7cc8({'code':0xc8,'message':_0xb51b61});}catch(_0x250a2c){logger['error'](_0x250a2c[_0xe8b8('0x3e')]);return _0x442c58(_0x562d50[_0xe8b8('0x37')](0x1f4,_0x250a2c));}}logger[_0xe8b8('0x37')](_0xe8b8('0x49'));return _0x442c58(_0x562d50[_0xe8b8('0x37')](0x1f4,_0xe8b8('0x49')));});},'RejectMessage':function(_0x487e3a){var _0x163b6d=this;return new Promise(function(_0x4d9971,_0x53cef6){if(_0x487e3a[_0xe8b8('0x40')]&&_0x487e3a[_0xe8b8('0x40')]['id']){try{if(_0x30bfc7[_0xe8b8('0x41')][_0x487e3a[_0xe8b8('0x40')]['id']]){_0x30bfc7[_0xe8b8('0x41')][_0x487e3a[_0xe8b8('0x40')]['id']][_0xe8b8('0x4a')]=![];_0x30bfc7[_0xe8b8('0x41')][_0x487e3a[_0xe8b8('0x40')]['id']][_0xe8b8('0x42')]=undefined;}return _0x4d9971({'code':0xc8,'message':_0x487e3a});}catch(_0x1230e7){logger['error'](_0x1230e7[_0xe8b8('0x3e')]);return _0x53cef6(_0x163b6d[_0xe8b8('0x37')](0x1f4,_0x1230e7));}}logger[_0xe8b8('0x37')](_0xe8b8('0x49'));return _0x53cef6(_0x163b6d['error'](0x1f4,_0xe8b8('0x49')));});},'AbandonInteraction':function(_0x4c419a){var _0x385e35=this;return new Promise(function(_0x46ff8d,_0x4ab15e){if(_0x4c419a[_0xe8b8('0x14')]&&_0x4c419a['interaction']&&_0x4c419a[_0xe8b8('0x16')]['id']){try{var _0x38a515=getId(_0x4c419a[_0xe8b8('0x14')],_0x4c419a['message']?_0x4c419a[_0xe8b8('0x15')]['id']:0x0,_0x4c419a[_0xe8b8('0x16')]?_0x4c419a[_0xe8b8('0x16')]['id']:0x0);if(_0x30bfc7[_0xe8b8('0x13')][_0x38a515]){_0x30bfc7[_0xe8b8('0x13')][_0x38a515][_0xe8b8('0x43')]('end');}return _0x46ff8d({'code':0xc8,'message':_0x4c419a});}catch(_0xf1c20e){logger[_0xe8b8('0x37')](_0xf1c20e[_0xe8b8('0x3e')]);return _0x4ab15e(_0x385e35[_0xe8b8('0x37')](0x1f4,_0xf1c20e));}}logger[_0xe8b8('0x37')](_0xe8b8('0x49'));return _0x4ab15e(_0x385e35[_0xe8b8('0x37')](0x1f4,_0xe8b8('0x49')));});},'AgentCapacity':function(_0xf897ae){var _0x497844=this;return new Promise(function(_0x54a920,_0x5c880f){if(_0x30bfc7['agents'][_0xe8b8('0x4b')](_0xf897ae['id'])){for(var _0x40cd55 in _0xf897ae[_0xe8b8('0x4c')]){if(_0xf897ae[_0xe8b8('0x4c')][_0xe8b8('0x4b')](_0x40cd55)){if(_0x30bfc7[_0xe8b8('0x41')][_0xf897ae['id']][_0xe8b8('0x4b')](_0x40cd55+_0xe8b8('0x4d'))){_0x30bfc7[_0xe8b8('0x41')][_0xf897ae['id']][_0x40cd55+_0xe8b8('0x4d')]=parseInt(_0xf897ae[_0xe8b8('0x4c')][_0x40cd55],0xa);}}}_0x30bfc7[_0xe8b8('0x41')][_0xf897ae['id']][_0xe8b8('0x4e')]();return _0x54a920({'code':0xc8,'message':_0x30bfc7['agents'][_0xf897ae['id']]});}else{return _0x5c880f(_0x497844[_0xe8b8('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2826cc){return new Promise(function(_0x4e6ae7){var _0x260b5a=_[_0xe8b8('0x4f')](_0x30bfc7[_0xe8b8('0x41')]);if(_0x2826cc&&_0x2826cc['id']){var _0x261af8=_[_0xe8b8('0x50')](_0x260b5a,function(_0x52a434){return _0x52a434['id']===_0x2826cc['id'];});_0x4e6ae7(_0x261af8);}else{_0x4e6ae7({'count':_0x260b5a[_0xe8b8('0x1a')],'rows':_0x260b5a});}});},'ChatQueues':function(){return new Promise(function(_0x39c471){var _0x5ebee9=[];for(var _0x37cc43 in _0x30bfc7[_0xe8b8('0x51')]){if(_0x30bfc7['chatQueues'][_0xe8b8('0x4b')](_0x37cc43)){var _0x12f527=_0x30bfc7[_0xe8b8('0x51')][_0x37cc43];var _0x539e7f={'id':_0x12f527['id'],'available':_0x12f527[_0xe8b8('0x52')],'loggedIn':_0x12f527[_0xe8b8('0x53')],'name':_0x12f527[_0xe8b8('0x54')],'paused':_0x12f527[_0xe8b8('0x55')],'waiting':_0x12f527[_0xe8b8('0x56')]};_0x5ebee9[_0xe8b8('0x20')](_0x539e7f);}}_0x39c471({'count':_0x5ebee9[_0xe8b8('0x1a')],'rows':_0x5ebee9});});},'MailQueues':function(){return new Promise(function(_0x45f72d){var _0x214dbb=[];for(var _0x2b276c in _0x30bfc7[_0xe8b8('0x57')]){if(_0x30bfc7[_0xe8b8('0x57')][_0xe8b8('0x4b')](_0x2b276c)){var _0x118b6a=_0x30bfc7['mailQueues'][_0x2b276c];var _0x3f5a9f={'id':_0x118b6a['id'],'available':_0x118b6a['available'],'loggedIn':_0x118b6a['loggedIn'],'name':_0x118b6a['name'],'paused':_0x118b6a[_0xe8b8('0x55')],'waiting':_0x118b6a[_0xe8b8('0x56')]};_0x214dbb[_0xe8b8('0x20')](_0x3f5a9f);}}_0x45f72d({'count':_0x214dbb[_0xe8b8('0x1a')],'rows':_0x214dbb});});},'OpenchannelQueues':function(){return new Promise(function(_0x47f13e){var _0x3483ed=[];for(var _0x51c7fd in _0x30bfc7[_0xe8b8('0x58')]){if(_0x30bfc7['openchannelQueues'][_0xe8b8('0x4b')](_0x51c7fd)){var _0x26be5=_0x30bfc7[_0xe8b8('0x58')][_0x51c7fd];var _0x18faff={'id':_0x26be5['id'],'available':_0x26be5['available'],'loggedIn':_0x26be5[_0xe8b8('0x53')],'name':_0x26be5[_0xe8b8('0x54')],'paused':_0x26be5['paused'],'waiting':_0x26be5[_0xe8b8('0x56')]};_0x3483ed['push'](_0x18faff);}}_0x47f13e({'count':_0x3483ed['length'],'rows':_0x3483ed});});},'SmsQueues':function(){return new Promise(function(_0xe928e5){var _0x1fc527=[];for(var _0x342e28 in _0x30bfc7[_0xe8b8('0x59')]){if(_0x30bfc7[_0xe8b8('0x59')][_0xe8b8('0x4b')](_0x342e28)){var _0x1a0334=_0x30bfc7[_0xe8b8('0x59')][_0x342e28];var _0x45e0be={'id':_0x1a0334['id'],'available':_0x1a0334[_0xe8b8('0x52')],'loggedIn':_0x1a0334[_0xe8b8('0x53')],'name':_0x1a0334['name'],'paused':_0x1a0334[_0xe8b8('0x55')],'waiting':_0x1a0334[_0xe8b8('0x56')]};_0x1fc527['push'](_0x45e0be);}}_0xe928e5({'count':_0x1fc527[_0xe8b8('0x1a')],'rows':_0x1fc527});});},'FaxQueues':function(){return new Promise(function(_0x4ecc23){var _0x34dd5b=[];for(var _0x31587b in _0x30bfc7[_0xe8b8('0x5a')]){if(_0x30bfc7[_0xe8b8('0x5a')][_0xe8b8('0x4b')](_0x31587b)){var _0x33c765=_0x30bfc7['faxQueues'][_0x31587b];var _0x173236={'id':_0x33c765['id'],'available':_0x33c765[_0xe8b8('0x52')],'loggedIn':_0x33c765['loggedIn'],'name':_0x33c765[_0xe8b8('0x54')],'paused':_0x33c765[_0xe8b8('0x55')],'waiting':_0x33c765[_0xe8b8('0x56')]};_0x34dd5b[_0xe8b8('0x20')](_0x173236);}}_0x4ecc23({'count':_0x34dd5b['length'],'rows':_0x34dd5b});});},'WhatsappQueues':function(){return new Promise(function(_0x8eba01){var _0x486c42=[];for(var _0xa1be9b in _0x30bfc7[_0xe8b8('0x5b')]){if(_0x30bfc7['whatsappQueues'][_0xe8b8('0x4b')](_0xa1be9b)){var _0xd49faf=_0x30bfc7[_0xe8b8('0x5b')][_0xa1be9b];var _0xb3d267={'id':_0xd49faf['id'],'available':_0xd49faf['available'],'loggedIn':_0xd49faf['loggedIn'],'name':_0xd49faf['name'],'paused':_0xd49faf[_0xe8b8('0x55')],'waiting':_0xd49faf[_0xe8b8('0x56')]};_0x486c42[_0xe8b8('0x20')](_0xb3d267);}}_0x8eba01({'count':_0x486c42[_0xe8b8('0x1a')],'rows':_0x486c42});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x163a10){var _0x11550a=_['values'](_0x30bfc7[_0xe8b8('0x5c')]);_0x163a10({'count':_0x11550a['length'],'rows':_0x11550a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xd26530){var _0x279e9f=_['values'](_0x30bfc7[_0xe8b8('0x5d')]);_0xd26530({'count':_0x279e9f[_0xe8b8('0x1a')],'rows':_0x279e9f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x28f1c4){var _0x3268bf=_['values'](_0x30bfc7[_0xe8b8('0x5e')]);_0x28f1c4({'count':_0x3268bf[_0xe8b8('0x1a')],'rows':_0x3268bf});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x8515a9){var _0x536bc3=_['values'](_0x30bfc7['smsQueuesWaitingInteractions']);_0x8515a9({'count':_0x536bc3[_0xe8b8('0x1a')],'rows':_0x536bc3});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x106b10){var _0x1a5594=_[_0xe8b8('0x4f')](_0x30bfc7[_0xe8b8('0x5f')]);_0x106b10({'count':_0x1a5594[_0xe8b8('0x1a')],'rows':_0x1a5594});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3d7547){var _0x295f74=_[_0xe8b8('0x4f')](_0x30bfc7[_0xe8b8('0x60')]);_0x3d7547({'count':_0x295f74[_0xe8b8('0x1a')],'rows':_0x295f74});});}};var _0x5cd9f2=jayson[_0xe8b8('0x61')](_0x52ff32)[_0xe8b8('0x62')]();_0x5cd9f2['on'](_0xe8b8('0x37'),function(_0x536fa9){logger[_0xe8b8('0x37')](JSON['stringify'](_0x536fa9));return _0x3df267(_0x536fa9);});_0x5cd9f2[_0xe8b8('0x12')](0x232c,_0xe8b8('0x63'),function(){console[_0xe8b8('0x64')](_0xe8b8('0x65'),0x232c);return _0x4a3e9f(_0xe8b8('0x66')+0x232c);});});}; \ No newline at end of file +var _0x68bc=['format','IntervalId','isNil','map','interval','listen','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','join','app','.js','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','body','./interval','condition','intervals','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine'];(function(_0x2f9e74,_0x1212ac){var _0x4bf31d=function(_0x5c4107){while(--_0x5c4107){_0x2f9e74['push'](_0x2f9e74['shift']());}};_0x4bf31d(++_0x1212ac);}(_0x68bc,0xbc));var _0xc68b=function(_0x2e7877,_0x4df5d4){_0x2e7877=_0x2e7877-0x0;var _0x4e7197=_0x68bc[_0x2e7877];return _0x4e7197;};'use strict';var _=require(_0xc68b('0x0'));var util=require('util');var path=require(_0xc68b('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xc68b('0x2'));var utils=require(_0xc68b('0x3'));var sUtils=require(_0xc68b('0x4'));var logger=require('../../../config/logger')(_0xc68b('0x5'));var rpc={'openchannelQueueReport':require(_0xc68b('0x6')),'mailQueueReport':require(_0xc68b('0x7')),'chatQueueReport':require(_0xc68b('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xc68b('0x9')),'whatsappQueueReport':require(_0xc68b('0xa'))};var RuleEngine=require(_0xc68b('0xb'));function getId(_0x35b48a,_0x1367fc,_0x29035b){return util[_0xc68b('0xc')]('%s.%s.%s',_0x35b48a,_0x1367fc||0x0,_0x29035b||0x0);}function getIntervals(_0x158daa,_0x1098e4){var _0x3a6b4d=[];if(!_['isNil'](_0x1098e4[_0xc68b('0xd')])&&!_['isNil'](_0x158daa[_0x1098e4[_0xc68b('0xd')]])&&!_[_0xc68b('0xe')](_0x158daa[_0x1098e4[_0xc68b('0xd')]]['Intervals'])){_0x3a6b4d=_[_0xc68b('0xf')](_0x158daa[_0x1098e4[_0xc68b('0xd')]]['Intervals'],_0xc68b('0x10'));}else if(!_[_0xc68b('0xe')](_0x1098e4['interval'])){_0x3a6b4d=[_0x1098e4[_0xc68b('0x10')]];}return _0x3a6b4d;}exports[_0xc68b('0x11')]=function(_0x1616f9){_0x1616f9['rules']={};return new BPromise(function(_0x18b98c,_0x15fb7f){var _0x47e8f3={'Start':function(_0x5c1864){var _0x2a184f=this;return new Promise(function(_0x4a0d6a,_0x3a277f){if(_0x5c1864){try{var _0x35c984=[];var _0x1ac938=getId(_0x5c1864[_0xc68b('0x12')],_0x5c1864[_0xc68b('0x13')]?_0x5c1864[_0xc68b('0x13')]['id']:0x0,_0x5c1864['interaction']?_0x5c1864[_0xc68b('0x14')]['id']:0x0);var _0x19ef67=sUtils[_0xc68b('0x15')](_0x1616f9,_0x5c1864);if(_0x5c1864['transfer']||!_0x19ef67&&_0x5c1864[_0xc68b('0x16')]&&_[_0xc68b('0x17')](_0x5c1864[_0xc68b('0x16')])&&_0x5c1864[_0xc68b('0x16')][_0xc68b('0x18')]){for(var _0x23c62c=0x0;_0x23c62c<_0x5c1864[_0xc68b('0x16')]['length'];_0x23c62c+=0x1){var _0x30610f=_0x5c1864['applications'][_0x23c62c];if(fs['existsSync'](path[_0xc68b('0x19')](__dirname,_0xc68b('0x16'),_0x30610f[_0xc68b('0x1a')]+_0xc68b('0x1b')))){var _0x4b183=[];switch(_0x30610f[_0xc68b('0x1a')]['toLowerCase']()){case _0xc68b('0x1c'):var _0x4ee7b6=_0x30610f[_0xc68b('0x1d')][_0xc68b('0x1e')](',');if(_0x5c1864[_0xc68b('0x12')]==='mail'){_0x4b183[_0xc68b('0x1f')](_0x4ee7b6[0x0]);_0x4b183[_0xc68b('0x1f')](_0x4ee7b6[0x1]);_0x4b183[_0xc68b('0x1f')](_0x4ee7b6[_0xc68b('0x20')](0x2,_0x4ee7b6[_0xc68b('0x18')])['join'](','));}else{_0x4b183[_0xc68b('0x1f')](_0x4ee7b6[0x0]);_0x4b183['push'](_0x4ee7b6[_0xc68b('0x20')](0x1,_0x4ee7b6[_0xc68b('0x18')])[_0xc68b('0x19')](','));}break;case _0xc68b('0x21'):var _0x417533=_0x30610f[_0xc68b('0x1d')][_0xc68b('0x1e')](',');_0x4b183[_0xc68b('0x1f')](_0x417533[0x0]);_0x4b183[_0xc68b('0x1f')](_0x417533[0x1]);_0x4b183['push'](_0x417533[_0xc68b('0x20')](0x2,_0x417533[_0xc68b('0x18')])[_0xc68b('0x19')](','));break;case _0xc68b('0x22'):var _0x21ba01=_0x30610f[_0xc68b('0x1d')][_0xc68b('0x1e')](',');_0x4b183['push'](_0x21ba01[0x0]);_0x4b183[_0xc68b('0x1f')](_0x21ba01[0x1]);_0x4b183[_0xc68b('0x1f')](_0x21ba01[0x2]);_0x4b183[_0xc68b('0x1f')](_0x21ba01[0x3]);_0x4b183[_0xc68b('0x1f')](_0x21ba01['slice'](0x4,_0x21ba01[_0xc68b('0x18')])['join'](','));break;case _0xc68b('0x23'):var _0x1a22b0=_0x30610f['appdata'][_0xc68b('0x1e')](',');_0x4b183[_0xc68b('0x1f')](_0x1a22b0[0x0]);_0x4b183[_0xc68b('0x1f')](_0x1a22b0[0x1]);_0x4b183[_0xc68b('0x1f')](_0x1a22b0[0x2]);_0x4b183[_0xc68b('0x1f')](_0x1a22b0[0x3]);_0x4b183[_0xc68b('0x1f')](_0x1a22b0[_0xc68b('0x20')](0x4,_0x1a22b0[_0xc68b('0x18')])[_0xc68b('0x19')](','));break;case _0xc68b('0x13'):_0x4b183[_0xc68b('0x1f')](_0x30610f[_0xc68b('0x1d')]);break;case _0xc68b('0x24'):_0x4b183[_0xc68b('0x1f')](_0x30610f[_0xc68b('0x25')]);_0x4b183[_0xc68b('0x1f')](_0x30610f[_0xc68b('0x1d')]);break;case _0xc68b('0x26'):var _0x3b1d7f=utils[_0xc68b('0x27')](_0x5c1864[_0xc68b('0x28')]['notificationTemplate'],_0x5c1864);var _0xd8f813=_0x30610f['appdata'][_0xc68b('0x1e')](',');_0x4b183[_0xc68b('0x1f')](_0xd8f813[0x0]);_0x4b183[_0xc68b('0x1f')](_0xd8f813[0x1]);_0x4b183['push'](_0xd8f813[0x2]);_0x4b183[_0xc68b('0x1f')](_0xd8f813[0x3]);_0x4b183['push'](_0xd8f813[0x4]);_0x4b183[_0xc68b('0x1f')](_0xd8f813[0x5]);_0x4b183[_0xc68b('0x1f')](_0xd8f813[0x6]);_0x4b183[_0xc68b('0x1f')](_0xd8f813[0x7]);_0x4b183[_0xc68b('0x1f')](_0xd8f813[0x8]);_0x4b183[_0xc68b('0x1f')](_0xd8f813[0x9]);_0x4b183[_0xc68b('0x1f')](_0xd8f813[0xa]);_0x4b183[_0xc68b('0x1f')](_0x5c1864['interaction']['id']);_0x4b183[_0xc68b('0x1f')](_0x5c1864['message']['id']);_0x4b183[_0xc68b('0x1f')](_0x30610f[_0xc68b('0x29')]);_0x4b183[_0xc68b('0x1f')](_0x5c1864[_0xc68b('0x14')]['ContactId']);_0x4b183[_0xc68b('0x1f')](_0x5c1864[_0xc68b('0x2a')][_0xc68b('0x2a')]);_0x4b183['push'](_0x3b1d7f);break;default:_0x4b183=_[_0xc68b('0xe')](_0x30610f['appdata'])?[]:_0x30610f['appdata']['split'](',');}var _0x4baab8={'id':util[_0xc68b('0xc')]('%s:%s:%s',_0x1ac938,_0x30610f['id'],_0x30610f[_0xc68b('0x1a')]),'condition':require(_0xc68b('0x2b'))[_0xc68b('0x2c')](_0x1ac938,getIntervals(_0x1616f9[_0xc68b('0x2d')],_0x30610f),_0x1616f9),'consequence':require('./applications/'+_0x30610f[_0xc68b('0x1a')])['consequence'](_0x1ac938,_0x4b183,_0x1616f9,_0x5c1864),'p':_0x30610f['priority']||0x0};logger[_0xc68b('0x2e')](_0xc68b('0x2f'),_0x4baab8['id'],_0xc68b('0x30'),getIntervals(_0x1616f9[_0xc68b('0x2d')],_0x30610f)[_0xc68b('0x19')](_0xc68b('0x31')));_0x35c984['push'](_0x4baab8);}else{logger[_0xc68b('0x32')](_0xc68b('0x33'),path[_0xc68b('0x19')](__dirname,'applications',_0x30610f['app']+_0xc68b('0x1b')));}}_0x1616f9[_0xc68b('0x34')][_0x1ac938]=new RuleEngine(_0x35c984);_0x1616f9['rules'][_0x1ac938][_0xc68b('0x35')](_0x5c1864,function(_0x2f8a02){logger[_0xc68b('0x2e')](_0xc68b('0x36'),JSON[_0xc68b('0x37')](_0x2f8a02[_0xc68b('0x38')]));if(_0x1616f9[_0xc68b('0x34')][_0x1ac938]){_0x1616f9[_0xc68b('0x34')][_0x1ac938]['emit'](_0xc68b('0x39'));}});return _0x4a0d6a({'code':0xc8,'message':_0x5c1864});}else{if(_0x19ef67){logger[_0xc68b('0x2e')](util[_0xc68b('0xc')](_0xc68b('0x3a'),_0x1ac938));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x4a0d6a({'code':0xc8,'message':_0x5c1864});}}catch(_0xd588bf){logger['error'](_0xd588bf[_0xc68b('0x3b')]);return _0x3a277f(_0x2a184f[_0xc68b('0x32')](0x1f4,_0xd588bf));}}return _0x3a277f(_0xc68b('0x3c'));});},'AcceptMessage':function(_0x56187d){var _0x8fb2cc=this;return new Promise(function(_0x33021b,_0x4b09db){if(_0x56187d[_0xc68b('0x3d')]&&_0x56187d['agent']['id']){if(_0x1616f9[_0xc68b('0x3e')][_0x56187d[_0xc68b('0x3d')]['id']]){_0x1616f9[_0xc68b('0x3e')][_0x56187d[_0xc68b('0x3d')]['id']]['busy']=![];_0x1616f9[_0xc68b('0x3e')][_0x56187d[_0xc68b('0x3d')]['id']][_0xc68b('0x3f')]=undefined;}}if(_0x56187d[_0xc68b('0x13')]&&_0x56187d[_0xc68b('0x13')]['id']){try{var _0x4c997e=getId(_0x56187d[_0xc68b('0x12')],_0x56187d[_0xc68b('0x13')]?_0x56187d['message']['id']:0x0,_0x56187d[_0xc68b('0x14')]?_0x56187d[_0xc68b('0x14')]['id']:0x0);if(_0x1616f9['rules'][_0x4c997e]){_0x1616f9['rules'][_0x4c997e][_0xc68b('0x40')](_0xc68b('0x41'));if(rpc[_0x56187d[_0xc68b('0x12')]+'QueueReport']){rpc[_0x56187d[_0xc68b('0x12')]+_0xc68b('0x42')][_0xc68b('0x43')](_0x4c997e,{'UserId':_0x56187d[_0xc68b('0x13')][_0xc68b('0x44')]})[_0xc68b('0x45')](function(){logger['error'](_0xc68b('0x46'));});}}return _0x33021b({'code':0xc8,'message':_0x56187d});}catch(_0x50dd04){logger[_0xc68b('0x32')](_0x50dd04[_0xc68b('0x3b')]);return _0x4b09db(_0x8fb2cc[_0xc68b('0x32')](0x1f4,_0x50dd04));}}logger[_0xc68b('0x32')]('message\x20is\x20empty');return _0x4b09db(_0x8fb2cc[_0xc68b('0x32')](0x1f4,_0xc68b('0x47')));});},'RejectMessage':function(_0x40adf3){var _0x4780f0=this;return new Promise(function(_0x527ffb,_0x12d9b3){if(_0x40adf3['agent']&&_0x40adf3[_0xc68b('0x3d')]['id']){try{if(_0x1616f9[_0xc68b('0x3e')][_0x40adf3['agent']['id']]){_0x1616f9['agents'][_0x40adf3[_0xc68b('0x3d')]['id']][_0xc68b('0x48')]=![];_0x1616f9[_0xc68b('0x3e')][_0x40adf3[_0xc68b('0x3d')]['id']][_0xc68b('0x3f')]=undefined;}return _0x527ffb({'code':0xc8,'message':_0x40adf3});}catch(_0x33ce52){logger[_0xc68b('0x32')](_0x33ce52[_0xc68b('0x3b')]);return _0x12d9b3(_0x4780f0[_0xc68b('0x32')](0x1f4,_0x33ce52));}}logger[_0xc68b('0x32')]('message\x20is\x20empty');return _0x12d9b3(_0x4780f0['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x46b692){var _0x9e8759=this;return new Promise(function(_0x271576,_0x1996c5){if(_0x46b692[_0xc68b('0x12')]&&_0x46b692['interaction']&&_0x46b692[_0xc68b('0x14')]['id']){try{var _0x51f770=getId(_0x46b692[_0xc68b('0x12')],_0x46b692['message']?_0x46b692[_0xc68b('0x13')]['id']:0x0,_0x46b692['interaction']?_0x46b692['interaction']['id']:0x0);if(_0x1616f9[_0xc68b('0x34')][_0x51f770]){_0x1616f9['rules'][_0x51f770]['emit'](_0xc68b('0x41'));}return _0x271576({'code':0xc8,'message':_0x46b692});}catch(_0x3cb7f1){logger[_0xc68b('0x32')](_0x3cb7f1[_0xc68b('0x3b')]);return _0x1996c5(_0x9e8759[_0xc68b('0x32')](0x1f4,_0x3cb7f1));}}logger[_0xc68b('0x32')](_0xc68b('0x47'));return _0x1996c5(_0x9e8759[_0xc68b('0x32')](0x1f4,_0xc68b('0x47')));});},'AgentCapacity':function(_0x478d93){var _0x19916f=this;return new Promise(function(_0xee1d94,_0x50728f){if(_0x1616f9[_0xc68b('0x3e')][_0xc68b('0x49')](_0x478d93['id'])){for(var _0x2dc950 in _0x478d93[_0xc68b('0x4a')]){if(_0x478d93[_0xc68b('0x4a')][_0xc68b('0x49')](_0x2dc950)){if(_0x1616f9[_0xc68b('0x3e')][_0x478d93['id']][_0xc68b('0x49')](_0x2dc950+_0xc68b('0x4b'))){_0x1616f9[_0xc68b('0x3e')][_0x478d93['id']][_0x2dc950+_0xc68b('0x4b')]=parseInt(_0x478d93['capacity'][_0x2dc950],0xa);}}}_0x1616f9[_0xc68b('0x3e')][_0x478d93['id']][_0xc68b('0x4c')]();return _0xee1d94({'code':0xc8,'message':_0x1616f9[_0xc68b('0x3e')][_0x478d93['id']]});}else{return _0x50728f(_0x19916f[_0xc68b('0x32')](0x1f4,_0xc68b('0x4d')));}});},'Agents':function(_0x18e42f){return new Promise(function(_0x26ac2a){var _0x528b18=_[_0xc68b('0x4e')](_0x1616f9[_0xc68b('0x3e')]);if(_0x18e42f&&_0x18e42f['id']){var _0x58eba3=_[_0xc68b('0x4f')](_0x528b18,function(_0x2a9bb0){return _0x2a9bb0['id']===_0x18e42f['id'];});_0x26ac2a(_0x58eba3);}else{_0x26ac2a({'count':_0x528b18[_0xc68b('0x18')],'rows':_0x528b18});}});},'ChatQueues':function(){return new Promise(function(_0x18e217){var _0x567ae3=[];for(var _0x3ee3af in _0x1616f9[_0xc68b('0x50')]){if(_0x1616f9[_0xc68b('0x50')][_0xc68b('0x49')](_0x3ee3af)){var _0x129cb2=_0x1616f9['chatQueues'][_0x3ee3af];var _0x3b297f={'id':_0x129cb2['id'],'available':_0x129cb2[_0xc68b('0x51')],'loggedIn':_0x129cb2[_0xc68b('0x52')],'name':_0x129cb2[_0xc68b('0x53')],'paused':_0x129cb2[_0xc68b('0x54')],'waiting':_0x129cb2[_0xc68b('0x55')]};_0x567ae3[_0xc68b('0x1f')](_0x3b297f);}}_0x18e217({'count':_0x567ae3['length'],'rows':_0x567ae3});});},'MailQueues':function(){return new Promise(function(_0xe12d2f){var _0x2bb057=[];for(var _0x44ae03 in _0x1616f9['mailQueues']){if(_0x1616f9[_0xc68b('0x56')]['hasOwnProperty'](_0x44ae03)){var _0x168748=_0x1616f9[_0xc68b('0x56')][_0x44ae03];var _0x273b2a={'id':_0x168748['id'],'available':_0x168748[_0xc68b('0x51')],'loggedIn':_0x168748[_0xc68b('0x52')],'name':_0x168748[_0xc68b('0x53')],'paused':_0x168748['paused'],'waiting':_0x168748[_0xc68b('0x55')]};_0x2bb057[_0xc68b('0x1f')](_0x273b2a);}}_0xe12d2f({'count':_0x2bb057['length'],'rows':_0x2bb057});});},'OpenchannelQueues':function(){return new Promise(function(_0x5a71f4){var _0x584dac=[];for(var _0x4fae88 in _0x1616f9['openchannelQueues']){if(_0x1616f9[_0xc68b('0x57')][_0xc68b('0x49')](_0x4fae88)){var _0x273fc8=_0x1616f9[_0xc68b('0x57')][_0x4fae88];var _0x37e445={'id':_0x273fc8['id'],'available':_0x273fc8['available'],'loggedIn':_0x273fc8[_0xc68b('0x52')],'name':_0x273fc8[_0xc68b('0x53')],'paused':_0x273fc8[_0xc68b('0x54')],'waiting':_0x273fc8[_0xc68b('0x55')]};_0x584dac[_0xc68b('0x1f')](_0x37e445);}}_0x5a71f4({'count':_0x584dac[_0xc68b('0x18')],'rows':_0x584dac});});},'SmsQueues':function(){return new Promise(function(_0x8fe084){var _0x442bcd=[];for(var _0x5c428b in _0x1616f9['smsQueues']){if(_0x1616f9[_0xc68b('0x58')]['hasOwnProperty'](_0x5c428b)){var _0x40f6ac=_0x1616f9[_0xc68b('0x58')][_0x5c428b];var _0x4a930a={'id':_0x40f6ac['id'],'available':_0x40f6ac[_0xc68b('0x51')],'loggedIn':_0x40f6ac[_0xc68b('0x52')],'name':_0x40f6ac['name'],'paused':_0x40f6ac[_0xc68b('0x54')],'waiting':_0x40f6ac['waiting']};_0x442bcd[_0xc68b('0x1f')](_0x4a930a);}}_0x8fe084({'count':_0x442bcd[_0xc68b('0x18')],'rows':_0x442bcd});});},'FaxQueues':function(){return new Promise(function(_0x865c22){var _0x247a75=[];for(var _0x2a3e61 in _0x1616f9[_0xc68b('0x59')]){if(_0x1616f9[_0xc68b('0x59')][_0xc68b('0x49')](_0x2a3e61)){var _0x1daad3=_0x1616f9[_0xc68b('0x59')][_0x2a3e61];var _0x4fae48={'id':_0x1daad3['id'],'available':_0x1daad3[_0xc68b('0x51')],'loggedIn':_0x1daad3['loggedIn'],'name':_0x1daad3[_0xc68b('0x53')],'paused':_0x1daad3[_0xc68b('0x54')],'waiting':_0x1daad3[_0xc68b('0x55')]};_0x247a75['push'](_0x4fae48);}}_0x865c22({'count':_0x247a75['length'],'rows':_0x247a75});});},'WhatsappQueues':function(){return new Promise(function(_0x273660){var _0x617be5=[];for(var _0x16149d in _0x1616f9[_0xc68b('0x5a')]){if(_0x1616f9[_0xc68b('0x5a')]['hasOwnProperty'](_0x16149d)){var _0x2feed4=_0x1616f9['whatsappQueues'][_0x16149d];var _0x41c572={'id':_0x2feed4['id'],'available':_0x2feed4[_0xc68b('0x51')],'loggedIn':_0x2feed4['loggedIn'],'name':_0x2feed4[_0xc68b('0x53')],'paused':_0x2feed4[_0xc68b('0x54')],'waiting':_0x2feed4[_0xc68b('0x55')]};_0x617be5[_0xc68b('0x1f')](_0x41c572);}}_0x273660({'count':_0x617be5[_0xc68b('0x18')],'rows':_0x617be5});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x39318e){var _0xbab21c=_[_0xc68b('0x4e')](_0x1616f9[_0xc68b('0x5b')]);_0x39318e({'count':_0xbab21c[_0xc68b('0x18')],'rows':_0xbab21c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x444b8d){var _0x46018a=_[_0xc68b('0x4e')](_0x1616f9['mailQueuesWaitingInteractions']);_0x444b8d({'count':_0x46018a[_0xc68b('0x18')],'rows':_0x46018a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x137551){var _0x2f15be=_[_0xc68b('0x4e')](_0x1616f9[_0xc68b('0x5c')]);_0x137551({'count':_0x2f15be[_0xc68b('0x18')],'rows':_0x2f15be});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3209fc){var _0xdfe7b1=_[_0xc68b('0x4e')](_0x1616f9[_0xc68b('0x5d')]);_0x3209fc({'count':_0xdfe7b1[_0xc68b('0x18')],'rows':_0xdfe7b1});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2c17a1){var _0x4d9ccd=_[_0xc68b('0x4e')](_0x1616f9[_0xc68b('0x5e')]);_0x2c17a1({'count':_0x4d9ccd[_0xc68b('0x18')],'rows':_0x4d9ccd});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x12f038){var _0xb1aed=_[_0xc68b('0x4e')](_0x1616f9[_0xc68b('0x5f')]);_0x12f038({'count':_0xb1aed['length'],'rows':_0xb1aed});});}};var _0x133599=jayson['server'](_0x47e8f3)[_0xc68b('0x60')]();_0x133599['on']('error',function(_0x4f94ba){logger[_0xc68b('0x32')](JSON[_0xc68b('0x37')](_0x4f94ba));return _0x15fb7f(_0x4f94ba);});_0x133599[_0xc68b('0x11')](0x232c,_0xc68b('0x61'),function(){console[_0xc68b('0x62')](_0xc68b('0x63'),0x232c);return _0x18b98c('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 476b957..fd256b0 100644 --- a/server/services/routing/server/interval.js +++ b/server/services/routing/server/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6097=['[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','iftime','../../../config/logger','routing','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when'];(function(_0x3a8790,_0x462d64){var _0x23b409=function(_0x3da9aa){while(--_0x3da9aa){_0x3a8790['push'](_0x3a8790['shift']());}};_0x23b409(++_0x462d64);}(_0x6097,0x8d));var _0x7609=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0x6097[_0x2d48fa];return _0x4645b7;};'use strict';var _=require(_0x7609('0x0'));var iftime=require('../../../utils/iftime')[_0x7609('0x1')];var logger=require(_0x7609('0x2'))(_0x7609('0x3'));exports[_0x7609('0x4')]=function(_0x3bdd0a,_0x5685d9,_0x4962b1){return function(_0x3467e5){if(_0x4962b1['rules']&&!_0x4962b1['rules'][_0x3bdd0a]){logger[_0x7609('0x5')](_0x7609('0x6'),_0x3bdd0a);return _0x3467e5[_0x7609('0x7')]();}var _0xbc1bc=_0x5685d9[_0x7609('0x8')](function(_0x1fce19){return iftime(_0x1fce19);});var _0x405c91=_['some'](_0xbc1bc);if(_0x405c91){logger[_0x7609('0x5')](_0x7609('0x9'),_0x3bdd0a,_0x5685d9[_0x7609('0xa')](_0x7609('0xb')),_0x405c91);_0x3467e5[_0x7609('0xc')](_0x405c91);}else{logger['info'](_0x7609('0xd'),_0x3bdd0a,_0x5685d9[_0x7609('0xa')](_0x7609('0xb')));_0x3467e5[_0x7609('0x7')]();}};}; \ No newline at end of file +var _0x6713=['\x20|\x20','when','lodash','../../../utils/iftime','../../../config/logger','routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','map','some','join'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6713,0x147));var _0x3671=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x6713[_0x1d6a82];return _0x5834ac;};'use strict';var _=require(_0x3671('0x0'));var iftime=require(_0x3671('0x1'))['iftime'];var logger=require(_0x3671('0x2'))(_0x3671('0x3'));exports[_0x3671('0x4')]=function(_0x4d5597,_0x5158f0,_0x270c2d){return function(_0x502f69){if(_0x270c2d['rules']&&!_0x270c2d[_0x3671('0x5')][_0x4d5597]){logger[_0x3671('0x6')](_0x3671('0x7'),_0x4d5597);return _0x502f69['stop']();}var _0xed371e=_0x5158f0[_0x3671('0x8')](function(_0x1104a3){return iftime(_0x1104a3);});var _0x2199c8=_[_0x3671('0x9')](_0xed371e);if(_0x2199c8){logger[_0x3671('0x6')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x4d5597,_0x5158f0[_0x3671('0xa')](_0x3671('0xb')),_0x2199c8);_0x502f69[_0x3671('0xc')](_0x2199c8);}else{logger[_0x3671('0x6')]('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x4d5597,_0x5158f0[_0x3671('0xa')](_0x3671('0xb')));_0x502f69['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index cf3d44a..0969472 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswer','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','agentcalledAt','[%s][agents][attendedtransfer]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x50a794,_0x18326d){_0x50a794=_0x50a794-0x0;var _0x118132=_0x9ffd[_0x50a794];return _0x118132;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var utils=require(_0xd9ff('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5802a6,_0x3480c0){utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x5'),_0x5802a6['uniqueid'],_0x5802a6[_0xd9ff('0x6')],_0x5802a6[_0xd9ff('0x7')],_0x5802a6['membername'],_0x5802a6[_0xd9ff('0x8')],_0x5802a6[_0xd9ff('0x9')],_0x5802a6[_0xd9ff('0xa')],_0x5802a6[_0xd9ff('0xb')]));if(_0x5802a6[_0xd9ff('0x7')]){utils[_0xd9ff('0xc')](_0x5802a6[_0xd9ff('0x7')])[_0xd9ff('0xd')](function(_0x977487){if(_0x977487){_0x5802a6['type']=_0x977487['type'];_0x5802a6['agentacw']=_0x5802a6['agentcomplete']?_0x977487[_0xd9ff('0xe')]:![];_0x5802a6[_0xd9ff('0xf')]=_0x5802a6[_0xd9ff('0x10')]?_0x977487[_0xd9ff('0x11')]:0x0;}utils[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x5802a6);});}else{utils[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x5802a6);}if(_0x3480c0){delete transfers[_0x5802a6['uniqueid']];}else{delete agents[_0x5802a6['destuniqueid']];}}exports[_0xd9ff('0x14')]=function(_0x16a0d9){try{utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')](_0xd9ff('0x16'),_0x16a0d9['uniqueid']),_0x16a0d9);agents[_0x16a0d9[_0xd9ff('0x17')]]=_0x16a0d9;agents[_0x16a0d9[_0xd9ff('0x17')]]['agentcalledAt']=utils[_0xd9ff('0x18')]();agents[_0x16a0d9['destuniqueid']]['lastevent']='called';agents[_0x16a0d9['destuniqueid']][_0xd9ff('0xa')]=null;agents[_0x16a0d9['destuniqueid']][_0xd9ff('0x19')]=null;utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x1a'),_0x16a0d9[_0xd9ff('0x1b')],agents[_0x16a0d9[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x16a0d9[_0xd9ff('0x17')]));}catch(_0x182775){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x16'),_0x16a0d9[_0xd9ff('0x1b')]),_0x182775);}};exports['agentringnoanswer']=function(_0x4cf8ec){try{if(!_[_0xd9ff('0x1e')](agents[_0x4cf8ec[_0xd9ff('0x17')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x4cf8ec['uniqueid']),_0x4cf8ec);utils[_0xd9ff('0x3')](util['format'](_0xd9ff('0x1f'),_0x4cf8ec[_0xd9ff('0x1b')],agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x4cf8ec[_0xd9ff('0x17')]));agents[_0x4cf8ec[_0xd9ff('0x17')]]['agentringnoanswer']=!![];agents[_0x4cf8ec['destuniqueid']][_0xd9ff('0x20')]=utils['now']();agents[_0x4cf8ec[_0xd9ff('0x17')]]['lastevent']=_0xd9ff('0x21');agents[_0x4cf8ec['destuniqueid']][_0xd9ff('0x22')]=_0xd9ff('0x21');agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x23')]=_0x4cf8ec['ringtime']?parseInt(_0x4cf8ec[_0xd9ff('0x24')])/0x3e8:0x0;agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x25')]=0x0;unanswered[_0xd9ff('0x26')](_0x4cf8ec['destuniqueid']);}}catch(_0x1d3684){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x27'),_0x4cf8ec[_0xd9ff('0x1b')]),_0x1d3684);}};exports[_0xd9ff('0x28')]=function(_0x420ffa){try{_[_0xd9ff('0x29')](agents,function(_0x3dc443,_0x5706cf){if(_0x3dc443[_0xd9ff('0x1b')]==_0x420ffa['uniqueid']&&!_[_0xd9ff('0x2a')](unanswered,_0x3dc443[_0xd9ff('0x17')])){utils[_0xd9ff('0x15')](util['format'](_0xd9ff('0x2b'),_0x420ffa[_0xd9ff('0x1b')]),_0x420ffa);utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x420ffa[_0xd9ff('0x1b')],_0x3dc443['membername'],_0x3dc443[_0xd9ff('0x17')]));_0x3dc443[_0xd9ff('0x2c')]=!![];_0x3dc443[_0xd9ff('0x20')]=utils[_0xd9ff('0x18')]();_0x3dc443[_0xd9ff('0xb')]=_0xd9ff('0x2d');_0x3dc443[_0xd9ff('0x22')]=_0xd9ff('0x2d');_0x3dc443[_0xd9ff('0x23')]=_0x420ffa[_0xd9ff('0x23')];_0x3dc443[_0xd9ff('0x25')]=0x0;writeDB(_0x3dc443);}});}catch(_0x34e9a9){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')]('[%s][agents][queuecallerabandon]',_0x420ffa[_0xd9ff('0x1b')]),_0x34e9a9);}};exports[_0xd9ff('0x2e')]=function(_0x2bde85){try{if(agents[_0x2bde85['destuniqueid']]){utils[_0xd9ff('0x15')](util['format'](_0xd9ff('0x2f'),_0x2bde85['uniqueid']),_0x2bde85);utils[_0xd9ff('0x3')](util['format'](_0xd9ff('0x30'),_0x2bde85[_0xd9ff('0x1b')],agents[_0x2bde85[_0xd9ff('0x17')]]['membername'],_0x2bde85['destuniqueid']));agents[_0x2bde85['destuniqueid']][_0xd9ff('0x31')]=utils[_0xd9ff('0x18')]();agents[_0x2bde85[_0xd9ff('0x17')]][_0xd9ff('0xa')]=_0x2bde85[_0xd9ff('0xa')];agents[_0x2bde85[_0xd9ff('0x17')]]['connectedlinename']=_0x2bde85['connectedlinename'];agents[_0x2bde85['destuniqueid']][_0xd9ff('0x23')]=_0x2bde85[_0xd9ff('0x24')];agents[_0x2bde85[_0xd9ff('0x17')]][_0xd9ff('0xb')]='connect';_[_0xd9ff('0x29')](agents,function(_0x5b8e17,_0x3cff52){if(_0x5b8e17[_0xd9ff('0x17')]!=_0x2bde85[_0xd9ff('0x17')]&&_0x5b8e17[_0xd9ff('0x1b')]==_0x2bde85['uniqueid']){_0x5b8e17[_0xd9ff('0x25')]=0x0;_0x5b8e17[_0xd9ff('0x23')]=_0x2bde85['ringtime'];_0x5b8e17[_0xd9ff('0x2c')]=!![];_0x5b8e17[_0xd9ff('0x20')]=utils[_0xd9ff('0x18')]();_0x5b8e17[_0xd9ff('0xb')]=_0xd9ff('0x32');_0x5b8e17[_0xd9ff('0x22')]='answered_elsewhere';_0x5b8e17[_0xd9ff('0x33')]=_0x2bde85[_0xd9ff('0x17')];_0x5b8e17[_0xd9ff('0x34')]=_0x2bde85[_0xd9ff('0x1c')];writeDB(_0x5b8e17);}});}}catch(_0x472724){utils['error'](util[_0xd9ff('0x4')](_0xd9ff('0x2f'),_0x2bde85[_0xd9ff('0x1b')]),_0x472724);}};exports['agentcomplete']=function(_0x5d06dd){try{if(!_[_0xd9ff('0x1e')](agents[_0x5d06dd[_0xd9ff('0x17')]])){utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')](_0xd9ff('0x35'),_0x5d06dd[_0xd9ff('0x1b')]),_0x5d06dd);utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x36'),_0x5d06dd['uniqueid'],agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x5d06dd[_0xd9ff('0x17')]));agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x37')]=!![];agents[_0x5d06dd['destuniqueid']]['agentcompleteAt']=utils['now']();agents[_0x5d06dd[_0xd9ff('0x17')]]['talktime']=utils[_0xd9ff('0x38')](agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x39')],agents[_0x5d06dd['destuniqueid']][_0xd9ff('0x31')]);agents[_0x5d06dd[_0xd9ff('0x17')]]['reason']=_0x5d06dd[_0xd9ff('0x22')];agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0xb')]=_0xd9ff('0x3a');writeDB(agents[_0x5d06dd['destuniqueid']]);}}catch(_0x38b5b6){utils['error'](util[_0xd9ff('0x4')]('[%s][agents][agentcomplete]',_0x5d06dd[_0xd9ff('0x1b')]),_0x38b5b6);}};exports[_0xd9ff('0x3b')]=function(_0x2bf37a){try{if(!_[_0xd9ff('0x1e')](agents[_0x2bf37a[_0xd9ff('0x3c')]])){utils['debug'](util[_0xd9ff('0x4')](_0xd9ff('0x3d'),_0x2bf37a[_0xd9ff('0x1b')]),_0x2bf37a);utils[_0xd9ff('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2bf37a['uniqueid'],agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x1c')],agents[_0x2bf37a[_0xd9ff('0x3c')]]['uniqueid']));agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x3e')]=!![];agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x3f')]=_0xd9ff('0x40');agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x41')]=_0x2bf37a[_0xd9ff('0x42')];agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x43')]=agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x1b')];}}catch(_0x2533d7){utils['error'](util[_0xd9ff('0x4')]('[%s][agents][blindtransfer]',_0x2bf37a[_0xd9ff('0x1b')]),_0x2533d7);}};exports['attendedtransfer']=function(_0x2953d7){try{utils['debug'](util[_0xd9ff('0x4')]('[%s][agents][attendedtransfer]',_0x2953d7[_0xd9ff('0x44')]),_0x2953d7);if(_0x2953d7['origtransfereruniqueid']==_0x2953d7[_0xd9ff('0x45')]){if(!_['isNil'](agents[_0x2953d7[_0xd9ff('0x46')]])){utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x47'),_0x2953d7[_0xd9ff('0x44')],agents[_0x2953d7[_0xd9ff('0x46')]]['membername']));agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x3e')]=!![];agents[_0x2953d7[_0xd9ff('0x46')]]['transfertype']=_0xd9ff('0x48');agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x41')]=_0x2953d7[_0xd9ff('0x49')];agents[_0x2953d7[_0xd9ff('0x46')]]['transferuniqueid']=_0x2953d7[_0xd9ff('0x44')];}if(_0x2953d7[_0xd9ff('0x4a')]&&agents[_0x2953d7[_0xd9ff('0x4a')]]){agents[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x4b')]=0x1;transfers[_0x2953d7[_0xd9ff('0x4a')]]=_[_0xd9ff('0x4c')](agents[_0x2953d7['transfereeuniqueid']]);transfers[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x9')]=agents[_0x2953d7['secondtransfereruniqueid']][_0xd9ff('0x9')];transfers[_0x2953d7[_0xd9ff('0x4a')]]['calleridname']=agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x4d')];transfers[_0x2953d7[_0xd9ff('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x2953d7[_0xd9ff('0x4a')]]['agentconnectAt']=utils[_0xd9ff('0x18')]();transfers[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x23')]=0x0;transfers[_0x2953d7[_0xd9ff('0x4a')]]['agententerreason']=0x2;}}else if(_0x2953d7['secondtransfereruniqueid']==_0x2953d7['secondtransfererlinkedid']){if(!_[_0xd9ff('0x1e')](agents[_0x2953d7[_0xd9ff('0x44')]])){utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x47'),_0x2953d7['origtransfereruniqueid'],agents[_0x2953d7[_0xd9ff('0x44')]]['membername']));agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x3e')]=!![];agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x3f')]=_0xd9ff('0x48');agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x41')]=_0x2953d7[_0xd9ff('0x4e')];agents[_0x2953d7['origtransfereruniqueid']][_0xd9ff('0x43')]=_0x2953d7[_0xd9ff('0x46')];}if(_0x2953d7['transfertargetuniqueid']&&agents[_0x2953d7['transfertargetuniqueid']]){agents[_0x2953d7[_0xd9ff('0x4f')]]['agententerreason']=0x1;transfers[_0x2953d7[_0xd9ff('0x4f')]]=_[_0xd9ff('0x4c')](agents[_0x2953d7['transfertargetuniqueid']]);transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x9')]=agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x9')];transfers[_0x2953d7[_0xd9ff('0x4f')]]['calleridname']=agents[_0x2953d7[_0xd9ff('0x44')]]['calleridname'];transfers[_0x2953d7['transfertargetuniqueid']][_0xd9ff('0x50')]=utils[_0xd9ff('0x18')]();transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x31')]=utils['now']();transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x23')]=0x0;transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x4b')]=0x2;}}}catch(_0x1bb042){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x51'),_0x2953d7['origtransfereruniqueid']),_0x1bb042);}};exports['hangup']=function(_0x5e04d3){try{utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')]('[%s][agents][hangup]',_0x5e04d3[_0xd9ff('0x1b')]),_0x5e04d3);if(agents[_0x5e04d3[_0xd9ff('0x1b')]]&&agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]===_0xd9ff('0x21')){if(_0x5e04d3[_0xd9ff('0x52')]==='21'){agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]='rejected';agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]=_0xd9ff('0x53');}utils['info'](util[_0xd9ff('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5e04d3[_0xd9ff('0x1b')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],agents[_0x5e04d3['uniqueid']][_0xd9ff('0x22')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]));writeDB(agents[_0x5e04d3[_0xd9ff('0x1b')]]);var _0x56a74c=unanswered[_0xd9ff('0x54')](_0x5e04d3[_0xd9ff('0x1b')]);if(_0x56a74c>-0x1){unanswered[_0xd9ff('0x55')](_0x56a74c,0x1);}}if(transfers[_0x5e04d3['uniqueid']]){transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x37')]=!![];transfers[_0x5e04d3[_0xd9ff('0x1b')]]['agentcompleteAt']=utils[_0xd9ff('0x18')]();transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x25')]=utils[_0xd9ff('0x38')](transfers[_0x5e04d3[_0xd9ff('0x1b')]]['agentcompleteAt'],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x31')]);transfers[_0x5e04d3['uniqueid']][_0xd9ff('0x22')]=_0xd9ff('0x56');transfers[_0x5e04d3[_0xd9ff('0x1b')]]['lastevent']=_0xd9ff('0x3a');utils['info'](util[_0xd9ff('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5e04d3[_0xd9ff('0x1b')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]));writeDB(transfers[_0x5e04d3[_0xd9ff('0x1b')]],!![]);}if(agents[_0x5e04d3[_0xd9ff('0x1b')]]&&agents[_0x5e04d3[_0xd9ff('0x1b')]]['agentconnectAt']){agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x37')]=!![];agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x39')]=utils[_0xd9ff('0x18')]();agents[_0x5e04d3[_0xd9ff('0x1b')]]['talktime']=utils['diffTime'](agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x39')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x31')]);agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]=agents[_0x5e04d3['uniqueid']][_0xd9ff('0x3e')]?_0xd9ff('0x3e'):_0xd9ff('0x56');agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]=_0xd9ff('0x3a');utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x57'),_0x5e04d3[_0xd9ff('0x1b')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')],agents[_0x5e04d3[_0xd9ff('0x1b')]]['lastevent']));writeDB(agents[_0x5e04d3[_0xd9ff('0x1b')]]);}}catch(_0x4c2ad5){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x58'),_0x5e04d3[_0xd9ff('0x1b')]),_0x4c2ad5);}}; \ No newline at end of file +var _0xb9a7=['connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','transfereeuniqueid','calleridname','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','format','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','talktime','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connectedlinename'];(function(_0x214bb3,_0x235d59){var _0x50e1a0=function(_0x18ca99){while(--_0x18ca99){_0x214bb3['push'](_0x214bb3['shift']());}};_0x50e1a0(++_0x235d59);}(_0xb9a7,0x112));var _0x7b9a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xb9a7[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x563857,_0x5f1a52){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x2'),_0x563857[_0x7b9a('0x3')],_0x563857[_0x7b9a('0x4')],_0x563857[_0x7b9a('0x5')],_0x563857[_0x7b9a('0x6')],_0x563857[_0x7b9a('0x7')],_0x563857[_0x7b9a('0x8')],_0x563857[_0x7b9a('0x9')],_0x563857[_0x7b9a('0xa')]));if(_0x563857[_0x7b9a('0x5')]){utils['getVoiceQueueByName'](_0x563857[_0x7b9a('0x5')])[_0x7b9a('0xb')](function(_0x56a199){if(_0x56a199){_0x563857['type']=_0x56a199['type'];_0x563857[_0x7b9a('0xc')]=_0x563857[_0x7b9a('0xd')]?_0x56a199['acw']:![];_0x563857[_0x7b9a('0xe')]=_0x563857['agentacw']?_0x56a199[_0x7b9a('0xf')]:0x0;}utils['request'](_0x7b9a('0x10'),_0x563857);});}else{utils[_0x7b9a('0x11')](_0x7b9a('0x10'),_0x563857);}if(_0x5f1a52){delete transfers[_0x563857['uniqueid']];}else{delete agents[_0x563857[_0x7b9a('0x12')]];}}exports[_0x7b9a('0x13')]=function(_0x5e3875){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentcalled]',_0x5e3875[_0x7b9a('0x3')]),_0x5e3875);agents[_0x5e3875[_0x7b9a('0x12')]]=_0x5e3875;agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x18');agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinenum']=null;agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinename']=null;utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x19'),_0x5e3875[_0x7b9a('0x3')],agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x6')],_0x5e3875[_0x7b9a('0x12')]));}catch(_0x283cc3){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x1b'),_0x5e3875[_0x7b9a('0x3')]),_0x283cc3);}};exports[_0x7b9a('0x1c')]=function(_0x58aed7){try{if(!_[_0x7b9a('0x1d')](agents[_0x58aed7['destuniqueid']])){utils[_0x7b9a('0x14')](util['format'](_0x7b9a('0x1e'),_0x58aed7[_0x7b9a('0x3')]),_0x58aed7);utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x1f'),_0x58aed7[_0x7b9a('0x3')],agents[_0x58aed7['destuniqueid']][_0x7b9a('0x6')],_0x58aed7[_0x7b9a('0x12')]));agents[_0x58aed7[_0x7b9a('0x12')]][_0x7b9a('0x1c')]=!![];agents[_0x58aed7[_0x7b9a('0x12')]]['agentringnoanswerAt']=utils[_0x7b9a('0x17')]();agents[_0x58aed7[_0x7b9a('0x12')]]['lastevent']=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']][_0x7b9a('0x21')]=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']]['holdtime']=_0x58aed7[_0x7b9a('0x22')]?parseInt(_0x58aed7['ringtime'])/0x3e8:0x0;agents[_0x58aed7['destuniqueid']][_0x7b9a('0x23')]=0x0;unanswered['push'](_0x58aed7['destuniqueid']);}}catch(_0x3847b4){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x1e'),_0x58aed7['uniqueid']),_0x3847b4);}};exports[_0x7b9a('0x24')]=function(_0x2e6144){try{_[_0x7b9a('0x25')](agents,function(_0x5b64d7,_0x45ccf5){if(_0x5b64d7[_0x7b9a('0x3')]==_0x2e6144[_0x7b9a('0x3')]&&!_[_0x7b9a('0x26')](unanswered,_0x5b64d7[_0x7b9a('0x12')])){utils[_0x7b9a('0x14')](util['format']('[%s][agents][queuecallerabandon]',_0x2e6144[_0x7b9a('0x3')]),_0x2e6144);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e6144[_0x7b9a('0x3')],_0x5b64d7[_0x7b9a('0x6')],_0x5b64d7['destuniqueid']));_0x5b64d7['agentringnoanswer']=!![];_0x5b64d7[_0x7b9a('0x27')]=utils[_0x7b9a('0x17')]();_0x5b64d7['lastevent']=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x21')]=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x29')]=_0x2e6144[_0x7b9a('0x29')];_0x5b64d7['talktime']=0x0;writeDB(_0x5b64d7);}});}catch(_0x46bcd0){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x2a'),_0x2e6144[_0x7b9a('0x3')]),_0x46bcd0);}};exports[_0x7b9a('0x2b')]=function(_0x5f1da4){try{if(agents[_0x5f1da4['destuniqueid']]){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]',_0x5f1da4[_0x7b9a('0x3')]),_0x5f1da4);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5f1da4[_0x7b9a('0x3')],agents[_0x5f1da4[_0x7b9a('0x12')]]['membername'],_0x5f1da4['destuniqueid']));agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2c')]=utils[_0x7b9a('0x17')]();agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x9')]=_0x5f1da4[_0x7b9a('0x9')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2d')]=_0x5f1da4['connectedlinename'];agents[_0x5f1da4[_0x7b9a('0x12')]]['holdtime']=_0x5f1da4[_0x7b9a('0x22')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x2e');_[_0x7b9a('0x25')](agents,function(_0x89951b,_0x5e504f){if(_0x89951b[_0x7b9a('0x12')]!=_0x5f1da4[_0x7b9a('0x12')]&&_0x89951b[_0x7b9a('0x3')]==_0x5f1da4[_0x7b9a('0x3')]){_0x89951b['talktime']=0x0;_0x89951b[_0x7b9a('0x29')]=_0x5f1da4[_0x7b9a('0x22')];_0x89951b[_0x7b9a('0x1c')]=!![];_0x89951b[_0x7b9a('0x27')]=utils['now']();_0x89951b[_0x7b9a('0xa')]='answered_elsewhere';_0x89951b[_0x7b9a('0x21')]=_0x7b9a('0x2f');_0x89951b[_0x7b9a('0x30')]=_0x5f1da4[_0x7b9a('0x12')];_0x89951b[_0x7b9a('0x31')]=_0x5f1da4[_0x7b9a('0x6')];writeDB(_0x89951b);}});}}catch(_0x56e274){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x32'),_0x5f1da4['uniqueid']),_0x56e274);}};exports['agentcomplete']=function(_0x3724fe){try{if(!_[_0x7b9a('0x1d')](agents[_0x3724fe[_0x7b9a('0x12')]])){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe['uniqueid']),_0x3724fe);utils['info'](util['format'](_0x7b9a('0x34'),_0x3724fe[_0x7b9a('0x3')],agents[_0x3724fe['destuniqueid']][_0x7b9a('0x6')],_0x3724fe[_0x7b9a('0x12')]));agents[_0x3724fe[_0x7b9a('0x12')]]['agentcomplete']=!![];agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt']=utils[_0x7b9a('0x17')]();agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt'],agents[_0x3724fe[_0x7b9a('0x12')]]['agentconnectAt']);agents[_0x3724fe[_0x7b9a('0x12')]]['reason']=_0x3724fe['reason'];agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x36');writeDB(agents[_0x3724fe[_0x7b9a('0x12')]]);}}catch(_0x1cbd5a){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe[_0x7b9a('0x3')]),_0x1cbd5a);}};exports['blindtransfer']=function(_0x1d7957){try{if(!_[_0x7b9a('0x1d')](agents[_0x1d7957['transfereruniqueid']])){utils['debug'](util['format'](_0x7b9a('0x37'),_0x1d7957[_0x7b9a('0x3')]),_0x1d7957);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1d7957[_0x7b9a('0x3')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x6')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')]));agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x39')]=!![];agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x3b');agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3c')]=_0x1d7957['extension'];agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3d')]=agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')];}}catch(_0x2b0db5){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]',_0x1d7957['uniqueid']),_0x2b0db5);}};exports['attendedtransfer']=function(_0x12c5bf){try{utils[_0x7b9a('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf['origtransfereruniqueid']),_0x12c5bf);if(_0x12c5bf['origtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x3e')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf[_0x7b9a('0x3f')]])){utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x40'),_0x12c5bf[_0x7b9a('0x41')],agents[_0x12c5bf[_0x7b9a('0x3f')]]['membername']));agents[_0x12c5bf[_0x7b9a('0x3f')]]['transfer']=!![];agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3c')]=_0x12c5bf['origtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x3f')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x41')];}if(_0x12c5bf[_0x7b9a('0x43')]&&agents[_0x12c5bf[_0x7b9a('0x43')]]){agents[_0x12c5bf['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfereeuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x43')]]);transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x8')]=agents[_0x12c5bf['secondtransfereruniqueid']][_0x7b9a('0x8')];transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x44')]=agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x44')];transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x43')]]['agentconnectAt']=utils['now']();transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x45')]=0x2;}}else if(_0x12c5bf['secondtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x46')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf['origtransfereruniqueid']])){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x40'),_0x12c5bf['origtransfereruniqueid'],agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x6')]));agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x39')]=!![];agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x3c')]=_0x12c5bf['secondtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x41')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x3f')];}if(_0x12c5bf['transfertargetuniqueid']&&agents[_0x12c5bf[_0x7b9a('0x47')]]){agents[_0x12c5bf['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfertargetuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x47')]]);transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x8')]=agents[_0x12c5bf[_0x7b9a('0x41')]]['calleridnum'];transfers[_0x12c5bf[_0x7b9a('0x47')]]['calleridname']=agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x44')];transfers[_0x12c5bf['transfertargetuniqueid']]['agentcalledAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x47')]]['agentconnectAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf['transfertargetuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x45')]=0x2;}}}catch(_0x5118b3){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf[_0x7b9a('0x41')]),_0x5118b3);}};exports[_0x7b9a('0x48')]=function(_0x3fd697){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3fd697);if(agents[_0x3fd697['uniqueid']]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]==='timeout'){if(_0x3fd697[_0x7b9a('0x4a')]==='21'){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='rejected';agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x4b');}utils['info'](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x21')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);var _0x2090ef=unanswered['indexOf'](_0x3fd697['uniqueid']);if(_0x2090ef>-0x1){unanswered[_0x7b9a('0x4c')](_0x2090ef,0x1);}}if(transfers[_0x3fd697[_0x7b9a('0x3')]]){transfers[_0x3fd697['uniqueid']][_0x7b9a('0xd')]=!![];transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')]=utils['now']();transfers[_0x3fd697['uniqueid']][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],transfers[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='agent';transfers[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x36');utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],transfers[_0x3fd697[_0x7b9a('0x3')]]['membername'],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(transfers[_0x3fd697[_0x7b9a('0x3')]],!![]);}if(agents[_0x3fd697[_0x7b9a('0x3')]]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x2c')]){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xd')]=!![];agents[_0x3fd697[_0x7b9a('0x3')]]['agentcompleteAt']=utils['now']();agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x23')]=utils['diffTime'](agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]=agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x39')]?_0x7b9a('0x39'):_0x7b9a('0x4e');agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]='complete';utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x4f'),_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);}}catch(_0x3022e0){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3022e0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 19f3377..2c2f62a 100644 --- a/server/services/xdr/calls.controller.js +++ b/server/services/xdr/calls.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf59c=['OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','now','DOCUMENTATION','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','error','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmcs-queue','xmd-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','toLowerCase','cdr','appdata','split','substring','lastIndexOf','includes','noop','util','NO\x20ANSWER','BUSY','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','accountcode','UserId','request','CreateVoiceCallReport','linkedid'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf59c,0x188));var _0xcf59=function(_0x5bafd1,_0x3a6991){_0x5bafd1=_0x5bafd1-0x0;var _0x1f0e68=_0xf59c[_0x5bafd1];return _0x1f0e68;};'use strict';var _=require('lodash');var util=require(_0xcf59('0x0'));var utils=require('./utils');var dispositions=[_0xcf59('0x1'),'FAILED','FAILED','NO\x20ANSWER',_0xcf59('0x1'),_0xcf59('0x1'),'ANSWERED',_0xcf59('0x2'),_0xcf59('0x3'),_0xcf59('0x3'),_0xcf59('0x3')];var channels={};function writeDB(_0x34686c){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x6'),_0x34686c[_0xcf59('0x7')],_0x34686c[_0xcf59('0x8')],_0x34686c[_0xcf59('0x9')],_0x34686c['membername'],_0x34686c[_0xcf59('0xa')],_0x34686c['calleridnum'],_0x34686c['connectedlinenum'],_0x34686c['lastevent']));if(_0x34686c[_0xcf59('0xb')]){utils['getUserByInternal'](_0x34686c[_0xcf59('0xb')])['then'](function(_0x52b027){if(_0x52b027){_0x34686c[_0xcf59('0xc')]=_0x52b027['id'];}utils['request']('CreateVoiceCallReport',_0x34686c);});}else{utils[_0xcf59('0xd')](_0xcf59('0xe'),_0x34686c);}if(channels[_0x34686c[_0xcf59('0x7')]]){delete channels[_0x34686c[_0xcf59('0x7')]];}}exports['newchannel']=function(_0x1e4be7){try{utils['debug'](util[_0xcf59('0x5')]('[%s][calls][newchannel]',_0x1e4be7['uniqueid']),_0x1e4be7);if(_0x1e4be7[_0xcf59('0x7')]==_0x1e4be7[_0xcf59('0xf')]&&_0x1e4be7[_0xcf59('0x8')]!=_0xcf59('0x10')){utils['info'](util[_0xcf59('0x5')](_0xcf59('0x11'),_0x1e4be7[_0xcf59('0x7')],_0x1e4be7['context'],_0x1e4be7[_0xcf59('0x12')]));channels[_0x1e4be7[_0xcf59('0x7')]]={'uniqueid':_0x1e4be7['uniqueid'],'accountcode':_0x1e4be7[_0xcf59('0xb')],'source':_0x1e4be7[_0xcf59('0x13')],'destination':_0x1e4be7[_0xcf59('0x12')],'destinationcontext':_0x1e4be7[_0xcf59('0x14')],'channel':_0x1e4be7[_0xcf59('0x8')],'starttime':utils[_0xcf59('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xcf59('0x1'),'amaflags':_0xcf59('0x16')};}}catch(_0x295fbb){utils['error'](util[_0xcf59('0x5')](_0xcf59('0x17'),_0x1e4be7[_0xcf59('0x7')]),_0x295fbb);}};exports[_0xcf59('0x18')]=function(_0x1a4fa9){try{utils[_0xcf59('0x19')](util['format'](_0xcf59('0x1a'),_0x1a4fa9[_0xcf59('0x7')]),_0x1a4fa9);if(!_[_0xcf59('0x1b')](channels[_0x1a4fa9[_0xcf59('0x7')]])&&_0x1a4fa9[_0xcf59('0x1c')]==0x6){utils[_0xcf59('0x4')](util[_0xcf59('0x5')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x1a4fa9['uniqueid'],_0x1a4fa9[_0xcf59('0x14')],_0x1a4fa9[_0xcf59('0x8')]));if(_[_0xcf59('0x1b')](channels[_0x1a4fa9[_0xcf59('0x7')]][_0xcf59('0x1d')])){channels[_0x1a4fa9[_0xcf59('0x7')]][_0xcf59('0x1d')]=utils[_0xcf59('0x15')]();}}else if(!_[_0xcf59('0x1b')](channels[_0x1a4fa9[_0xcf59('0xf')]])&&_0x1a4fa9[_0xcf59('0x1c')]==0x6&&_0x1a4fa9[_0xcf59('0x14')]!=_0xcf59('0x1e')){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x1f'),_0x1a4fa9[_0xcf59('0x7')],_0x1a4fa9[_0xcf59('0xf')],_0x1a4fa9[_0xcf59('0x14')],_0x1a4fa9[_0xcf59('0x8')]));channels[_0x1a4fa9[_0xcf59('0xf')]][_0xcf59('0xb')]=_0x1a4fa9['accountcode'];channels[_0x1a4fa9['linkedid']][_0xcf59('0x20')]=_0x1a4fa9['channel'];if(_[_0xcf59('0x1b')](channels[_0x1a4fa9[_0xcf59('0xf')]][_0xcf59('0x21')])){channels[_0x1a4fa9['linkedid']][_0xcf59('0x21')]=utils['now']();}channels[_0x1a4fa9[_0xcf59('0xf')]][_0xcf59('0x22')]=dispositions[_[_0xcf59('0x23')](_0x1a4fa9[_0xcf59('0x1c')])]||_0xcf59('0x24');}}catch(_0x35f076){utils['error'](util[_0xcf59('0x5')](_0xcf59('0x1a'),_0x1a4fa9['uniqueid']),_0x35f076);}};exports[_0xcf59('0x25')]=function(_0x57fe1e){try{if(!_[_0xcf59('0x1b')](channels[_0x57fe1e[_0xcf59('0x7')]])){utils[_0xcf59('0x19')](util[_0xcf59('0x5')](_0xcf59('0x26'),_0x57fe1e[_0xcf59('0x7')]),_0x57fe1e);if(_[_0xcf59('0x1b')](channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x27')])){channels[_0x57fe1e['uniqueid']][_0xcf59('0x27')]=_0x57fe1e[_0xcf59('0x28')]+'\x20<'+_0x57fe1e['calleridnum']+'>';}utils[_0xcf59('0x4')](util['format'](_0xcf59('0x29'),_0x57fe1e[_0xcf59('0x7')],channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x27')],_0x57fe1e[_0xcf59('0x2a')]));channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x2b')]=utils[_0xcf59('0x15')]();channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x2c')]=utils[_0xcf59('0x2d')](channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x2b')],channels[_0x57fe1e['uniqueid']][_0xcf59('0x2e')]);channels[_0x57fe1e[_0xcf59('0x7')]]['billableseconds']=channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x21')]?utils['diffTime'](channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x2b')],channels[_0x57fe1e['uniqueid']][_0xcf59('0x21')]):0x0;writeDB(channels[_0x57fe1e[_0xcf59('0x7')]]);}}catch(_0x1773c4){utils[_0xcf59('0x2f')](util[_0xcf59('0x5')](_0xcf59('0x26'),_0x57fe1e[_0xcf59('0x7')]),_0x1773c4);}};exports['attendedtransfer']=function(_0x3a5d1f){try{if(!_[_0xcf59('0x1b')](channels[_0x3a5d1f[_0xcf59('0x30')]])){utils[_0xcf59('0x19')](util[_0xcf59('0x5')](_0xcf59('0x31'),_0x3a5d1f[_0xcf59('0x32')]),_0x3a5d1f);if(channels[_0x3a5d1f[_0xcf59('0x30')]][_0xcf59('0x8')]==_0x3a5d1f[_0xcf59('0x33')]){utils[_0xcf59('0x4')](util['format'](_0xcf59('0x34'),_0x3a5d1f[_0xcf59('0x32')],_0x3a5d1f[_0xcf59('0x30')],_0x3a5d1f[_0xcf59('0x35')]));channels[_0x3a5d1f['localtwolinkedid']][_0xcf59('0x20')]=_0x3a5d1f['secondtransfererchannel'];channels[_0x3a5d1f['localtwolinkedid']][_0xcf59('0x36')]='_attended';}else if(channels[_0x3a5d1f['localtwolinkedid']]['channel']=_0x3a5d1f[_0xcf59('0x37')]){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x34'),_0x3a5d1f[_0xcf59('0x32')],_0x3a5d1f[_0xcf59('0x30')],_0x3a5d1f[_0xcf59('0x38')]));channels[_0x3a5d1f['localtwolinkedid']][_0xcf59('0x20')]=_0x3a5d1f[_0xcf59('0x38')];channels[_0x3a5d1f[_0xcf59('0x30')]]['userfield']=_0xcf59('0x39');}}}catch(_0x118032){utils[_0xcf59('0x2f')](util[_0xcf59('0x5')](_0xcf59('0x31'),_0x3a5d1f['origtransfereruniqueid']),_0x118032);}};exports[_0xcf59('0x3a')]=function(_0x5a08e9){try{if(!_[_0xcf59('0x1b')](channels[_0x5a08e9[_0xcf59('0x7')]])){utils[_0xcf59('0x19')](util[_0xcf59('0x5')](_0xcf59('0x3b'),_0x5a08e9[_0xcf59('0x7')]),_0x5a08e9);channels[_0x5a08e9[_0xcf59('0x7')]][_0xcf59('0x3c')]=utils[_0xcf59('0x15')]();utils[_0xcf59('0x4')](util[_0xcf59('0x5')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5a08e9[_0xcf59('0x7')],channels[_0x5a08e9[_0xcf59('0x7')]][_0xcf59('0x3c')]));}}catch(_0x564070){utils[_0xcf59('0x2f')](util[_0xcf59('0x5')](_0xcf59('0x3b'),_0x5a08e9['uniqueid']),_0x564070);}};exports['musiconholdstop']=function(_0x3287ef){try{if(!_[_0xcf59('0x1b')](channels[_0x3287ef[_0xcf59('0x7')]])){utils[_0xcf59('0x19')](util[_0xcf59('0x5')](_0xcf59('0x3d'),_0x3287ef[_0xcf59('0x7')]),_0x3287ef);if(!_['isNil'](channels[_0x3287ef[_0xcf59('0x7')]][_0xcf59('0x3c')])){channels[_0x3287ef[_0xcf59('0x7')]][_0xcf59('0x3e')]+=utils[_0xcf59('0x2d')](utils[_0xcf59('0x15')](),channels[_0x3287ef[_0xcf59('0x7')]]['musiconholdstartAt']);utils[_0xcf59('0x4')](util[_0xcf59('0x5')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3287ef[_0xcf59('0x7')],channels[_0x3287ef['uniqueid']][_0xcf59('0x3e')]));delete channels[_0x3287ef[_0xcf59('0x7')]][_0xcf59('0x3c')];}}}catch(_0x3ae1c2){utils[_0xcf59('0x2f')](util[_0xcf59('0x5')](_0xcf59('0x3d'),_0x3287ef['uniqueid']),_0x3ae1c2);}};exports[_0xcf59('0x3f')]=function(_0x3258b9){try{if(!_['isNil'](channels[_0x3258b9['uniqueid']])){utils['debug'](util[_0xcf59('0x5')](_0xcf59('0x40'),_0x3258b9[_0xcf59('0x7')]),_0x3258b9);if(!_[_0xcf59('0x1b')](_0x3258b9['variable'][_0xcf59('0x41')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x42'),_0x3258b9['uniqueid'],_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9['uniqueid']]['source']=_0x3258b9[_0xcf59('0x43')];}if(!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x45')])){utils['info'](util[_0xcf59('0x5')](_0xcf59('0x46'),_0x3258b9[_0xcf59('0x7')],_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x47')]=_0x3258b9['value'];channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x27')]='\x22'+_0x3258b9['value']+'\x22\x20<'+_0x3258b9['value']+'>';}if(!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')]['xmd-callerid-preview'])||!_['isNil'](_0x3258b9[_0xcf59('0x44')]['xmd-callerid'])){utils[_0xcf59('0x4')](util['format'](_0xcf59('0x48'),_0x3258b9[_0xcf59('0x7')],!_['isNil'](_0x3258b9['variable'][_0xcf59('0x49')])?_0xcf59('0x49'):_0xcf59('0x4a'),_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9[_0xcf59('0x7')]]['callerid']=_0x3258b9[_0xcf59('0x43')];}if(!_['isNil'](_0x3258b9[_0xcf59('0x44')]['xmd-queue'])||!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x4b')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x48'),_0x3258b9[_0xcf59('0x7')],!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x4c')])?_0xcf59('0x4c'):_0xcf59('0x4b'),_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9[_0xcf59('0x7')]]['lastapplication']=_0xcf59('0x4d');channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x4e')]=_0x3258b9[_0xcf59('0x43')];channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x9')]=!![];}if(!_[_0xcf59('0x1b')](_0x3258b9['variable'][_0xcf59('0x4f')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x50'),_0x3258b9[_0xcf59('0x7')],_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9['uniqueid']][_0xcf59('0x51')]=_0x3258b9['value'];}if(!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x52')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x53'),_0x3258b9[_0xcf59('0x7')],_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x54')]=_0x3258b9[_0xcf59('0x43')];}if(!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x55')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x56'),_0x3258b9[_0xcf59('0x7')],_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9[_0xcf59('0x7')]]['routeid']=_0x3258b9['value'];}if(!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x57')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x58'),_0x3258b9[_0xcf59('0x7')],_0x3258b9['value']));channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x57')]=_0x3258b9[_0xcf59('0x43')];}}}catch(_0x29d75e){utils[_0xcf59('0x2f')](util['format'](_0xcf59('0x40'),_0x3258b9[_0xcf59('0x7')]),_0x29d75e);}};exports['newexten']=function(_0x1b3e6d){try{if(!_[_0xcf59('0x1b')](channels[_0x1b3e6d[_0xcf59('0x7')]])){utils[_0xcf59('0x19')](util['format'](_0xcf59('0x59'),_0x1b3e6d[_0xcf59('0x7')]),_0x1b3e6d);utils['info'](util[_0xcf59('0x5')](_0xcf59('0x5a'),_0x1b3e6d['uniqueid'],_0x1b3e6d[_0xcf59('0x5b')],_0x1b3e6d['appdata']));if(_0x1b3e6d[_0xcf59('0x5b')]['toLowerCase']()==_0xcf59('0x5c')&&_[_0xcf59('0x5d')](_0x1b3e6d['appdata'][_0xcf59('0x5e')](),_0xcf59('0x5f'))){var _0x34489d=_0x1b3e6d[_0xcf59('0x60')][_0xcf59('0x61')]('=');var _0x94c69b=_0x34489d[0x0][_0xcf59('0x62')](_0x34489d[0x0][_0xcf59('0x63')]('(')+0x1,_0x34489d[0x0][_0xcf59('0x63')](')'));var _0x174d79=_0x34489d[0x1];channels[_0x1b3e6d[_0xcf59('0x7')]][_0x94c69b]=_0x174d79;}if(!_[_0xcf59('0x64')]([_0xcf59('0x25'),_0xcf59('0x65'),'execif',_0xcf59('0x5c'),'gotoif'],_0x1b3e6d[_0xcf59('0x5b')][_0xcf59('0x5e')]())){channels[_0x1b3e6d[_0xcf59('0x7')]]['lastapplication']=_0x1b3e6d[_0xcf59('0x5b')];channels[_0x1b3e6d[_0xcf59('0x7')]][_0xcf59('0x4e')]=_0x1b3e6d[_0xcf59('0x60')];}}}catch(_0x5139c6){utils[_0xcf59('0x2f')](util[_0xcf59('0x5')](_0xcf59('0x59'),_0x1b3e6d['uniqueid']),_0x5139c6);}}; \ No newline at end of file +var _0x371d=['musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','application','appdata','set','startsWith','toLowerCase','split','noop','execif','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','format','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','debug','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel'];(function(_0x1c22f0,_0x1924e2){var _0x5a32d8=function(_0x3490e8){while(--_0x3490e8){_0x1c22f0['push'](_0x1c22f0['shift']());}};_0x5a32d8(++_0x1924e2);}(_0x371d,0xf4));var _0xd371=function(_0x1b6709,_0x89d9c){_0x1b6709=_0x1b6709-0x0;var _0xe2876=_0x371d[_0x1b6709];return _0xe2876;};'use strict';var _=require(_0xd371('0x0'));var util=require('util');var utils=require(_0xd371('0x1'));var dispositions=[_0xd371('0x2'),_0xd371('0x3'),_0xd371('0x3'),_0xd371('0x2'),_0xd371('0x2'),'NO\x20ANSWER',_0xd371('0x4'),_0xd371('0x5'),_0xd371('0x3'),_0xd371('0x3'),_0xd371('0x3')];var channels={};function writeDB(_0x4e9af9){utils['info'](util['format'](_0xd371('0x6'),_0x4e9af9[_0xd371('0x7')],_0x4e9af9[_0xd371('0x8')],_0x4e9af9['queue'],_0x4e9af9[_0xd371('0x9')],_0x4e9af9['interface'],_0x4e9af9[_0xd371('0xa')],_0x4e9af9[_0xd371('0xb')],_0x4e9af9[_0xd371('0xc')]));if(_0x4e9af9[_0xd371('0xd')]){utils[_0xd371('0xe')](_0x4e9af9[_0xd371('0xd')])[_0xd371('0xf')](function(_0x5cddbd){if(_0x5cddbd){_0x4e9af9[_0xd371('0x10')]=_0x5cddbd['id'];}utils[_0xd371('0x11')](_0xd371('0x12'),_0x4e9af9);});}else{utils[_0xd371('0x11')](_0xd371('0x12'),_0x4e9af9);}if(channels[_0x4e9af9[_0xd371('0x7')]]){delete channels[_0x4e9af9[_0xd371('0x7')]];}}exports[_0xd371('0x13')]=function(_0x49894d){try{utils['debug'](util['format'](_0xd371('0x14'),_0x49894d[_0xd371('0x7')]),_0x49894d);if(_0x49894d['uniqueid']==_0x49894d[_0xd371('0x15')]&&_0x49894d[_0xd371('0x8')]!='OutgoingSpoolFailed'){utils[_0xd371('0x16')](util['format'](_0xd371('0x17'),_0x49894d[_0xd371('0x7')],_0x49894d[_0xd371('0x18')],_0x49894d['exten']));channels[_0x49894d[_0xd371('0x7')]]={'uniqueid':_0x49894d[_0xd371('0x7')],'accountcode':_0x49894d[_0xd371('0xd')],'source':_0x49894d['calleridnum'],'destination':_0x49894d[_0xd371('0x19')],'destinationcontext':_0x49894d[_0xd371('0x18')],'channel':_0x49894d[_0xd371('0x8')],'starttime':utils[_0xd371('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd371('0x2'),'amaflags':_0xd371('0x1b')};}}catch(_0x5225e8){utils['error'](util[_0xd371('0x1c')](_0xd371('0x14'),_0x49894d[_0xd371('0x7')]),_0x5225e8);}};exports[_0xd371('0x1d')]=function(_0x40a367){try{utils['debug'](util[_0xd371('0x1c')](_0xd371('0x1e'),_0x40a367[_0xd371('0x7')]),_0x40a367);if(!_['isNil'](channels[_0x40a367[_0xd371('0x7')]])&&_0x40a367[_0xd371('0x1f')]==0x6){utils[_0xd371('0x16')](util['format'](_0xd371('0x20'),_0x40a367[_0xd371('0x7')],_0x40a367[_0xd371('0x18')],_0x40a367[_0xd371('0x8')]));if(_[_0xd371('0x21')](channels[_0x40a367[_0xd371('0x7')]]['systemanswertime'])){channels[_0x40a367['uniqueid']][_0xd371('0x22')]=utils[_0xd371('0x1a')]();}}else if(!_[_0xd371('0x21')](channels[_0x40a367[_0xd371('0x15')]])&&_0x40a367[_0xd371('0x1f')]==0x6&&_0x40a367[_0xd371('0x18')]!=_0xd371('0x23')){utils[_0xd371('0x16')](util[_0xd371('0x1c')](_0xd371('0x24'),_0x40a367[_0xd371('0x7')],_0x40a367['linkedid'],_0x40a367[_0xd371('0x18')],_0x40a367[_0xd371('0x8')]));channels[_0x40a367['linkedid']][_0xd371('0xd')]=_0x40a367[_0xd371('0xd')];channels[_0x40a367['linkedid']][_0xd371('0x25')]=_0x40a367[_0xd371('0x8')];if(_['isNil'](channels[_0x40a367[_0xd371('0x15')]][_0xd371('0x26')])){channels[_0x40a367[_0xd371('0x15')]][_0xd371('0x26')]=utils['now']();}channels[_0x40a367[_0xd371('0x15')]][_0xd371('0x27')]=dispositions[_[_0xd371('0x28')](_0x40a367[_0xd371('0x1f')])]||_0xd371('0x4');}}catch(_0x4a15d0){utils[_0xd371('0x29')](util['format'](_0xd371('0x1e'),_0x40a367[_0xd371('0x7')]),_0x4a15d0);}};exports[_0xd371('0x2a')]=function(_0x276411){try{if(!_[_0xd371('0x21')](channels[_0x276411[_0xd371('0x7')]])){utils[_0xd371('0x2b')](util['format'](_0xd371('0x2c'),_0x276411['uniqueid']),_0x276411);if(_[_0xd371('0x21')](channels[_0x276411[_0xd371('0x7')]][_0xd371('0x2d')])){channels[_0x276411[_0xd371('0x7')]][_0xd371('0x2d')]=_0x276411['calleridname']+'\x20<'+_0x276411['calleridnum']+'>';}utils[_0xd371('0x16')](util[_0xd371('0x1c')](_0xd371('0x2e'),_0x276411[_0xd371('0x7')],channels[_0x276411[_0xd371('0x7')]][_0xd371('0x2d')],_0x276411[_0xd371('0x2f')]));channels[_0x276411[_0xd371('0x7')]][_0xd371('0x30')]=utils[_0xd371('0x1a')]();channels[_0x276411[_0xd371('0x7')]][_0xd371('0x31')]=utils[_0xd371('0x32')](channels[_0x276411['uniqueid']][_0xd371('0x30')],channels[_0x276411[_0xd371('0x7')]][_0xd371('0x33')]);channels[_0x276411['uniqueid']]['billableseconds']=channels[_0x276411['uniqueid']]['answertime']?utils[_0xd371('0x32')](channels[_0x276411[_0xd371('0x7')]][_0xd371('0x30')],channels[_0x276411[_0xd371('0x7')]][_0xd371('0x26')]):0x0;writeDB(channels[_0x276411[_0xd371('0x7')]]);}}catch(_0xd196cb){utils[_0xd371('0x29')](util[_0xd371('0x1c')](_0xd371('0x2c'),_0x276411[_0xd371('0x7')]),_0xd196cb);}};exports[_0xd371('0x34')]=function(_0x3651fa){try{if(!_[_0xd371('0x21')](channels[_0x3651fa[_0xd371('0x35')]])){utils['debug'](util['format'](_0xd371('0x36'),_0x3651fa[_0xd371('0x37')]),_0x3651fa);if(channels[_0x3651fa[_0xd371('0x35')]][_0xd371('0x8')]==_0x3651fa[_0xd371('0x38')]){utils['info'](util[_0xd371('0x1c')](_0xd371('0x39'),_0x3651fa[_0xd371('0x37')],_0x3651fa[_0xd371('0x35')],_0x3651fa[_0xd371('0x3a')]));channels[_0x3651fa[_0xd371('0x35')]][_0xd371('0x25')]=_0x3651fa['secondtransfererchannel'];channels[_0x3651fa[_0xd371('0x35')]][_0xd371('0x3b')]=_0xd371('0x3c');}else if(channels[_0x3651fa['localtwolinkedid']][_0xd371('0x8')]=_0x3651fa['transfertargetchannel']){utils[_0xd371('0x16')](util['format'](_0xd371('0x39'),_0x3651fa[_0xd371('0x37')],_0x3651fa[_0xd371('0x35')],_0x3651fa['origtransfererchannel']));channels[_0x3651fa[_0xd371('0x35')]][_0xd371('0x25')]=_0x3651fa[_0xd371('0x3d')];channels[_0x3651fa[_0xd371('0x35')]][_0xd371('0x3b')]='_attended';}}}catch(_0xdb57eb){utils[_0xd371('0x29')](util[_0xd371('0x1c')](_0xd371('0x36'),_0x3651fa['origtransfereruniqueid']),_0xdb57eb);}};exports['musiconholdstart']=function(_0x3649bf){try{if(!_[_0xd371('0x21')](channels[_0x3649bf[_0xd371('0x7')]])){utils[_0xd371('0x2b')](util[_0xd371('0x1c')]('[%s][calls][musiconholdstart]',_0x3649bf[_0xd371('0x7')]),_0x3649bf);channels[_0x3649bf[_0xd371('0x7')]][_0xd371('0x3e')]=utils['now']();utils[_0xd371('0x16')](util[_0xd371('0x1c')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3649bf[_0xd371('0x7')],channels[_0x3649bf[_0xd371('0x7')]][_0xd371('0x3e')]));}}catch(_0x40bc14){utils['error'](util[_0xd371('0x1c')]('[%s][calls][musiconholdstart]',_0x3649bf[_0xd371('0x7')]),_0x40bc14);}};exports[_0xd371('0x3f')]=function(_0x33d7d7){try{if(!_['isNil'](channels[_0x33d7d7[_0xd371('0x7')]])){utils[_0xd371('0x2b')](util['format']('[%s][calls][musiconholdstop]',_0x33d7d7['uniqueid']),_0x33d7d7);if(!_[_0xd371('0x21')](channels[_0x33d7d7[_0xd371('0x7')]]['musiconholdstartAt'])){channels[_0x33d7d7[_0xd371('0x7')]][_0xd371('0x40')]+=utils[_0xd371('0x32')](utils[_0xd371('0x1a')](),channels[_0x33d7d7[_0xd371('0x7')]][_0xd371('0x3e')]);utils[_0xd371('0x16')](util[_0xd371('0x1c')](_0xd371('0x41'),_0x33d7d7[_0xd371('0x7')],channels[_0x33d7d7[_0xd371('0x7')]][_0xd371('0x40')]));delete channels[_0x33d7d7[_0xd371('0x7')]][_0xd371('0x3e')];}}}catch(_0xa1c3ed){utils['error'](util[_0xd371('0x1c')](_0xd371('0x42'),_0x33d7d7[_0xd371('0x7')]),_0xa1c3ed);}};exports[_0xd371('0x43')]=function(_0x5b2d26){try{if(!_['isNil'](channels[_0x5b2d26[_0xd371('0x7')]])){utils[_0xd371('0x2b')](util['format'](_0xd371('0x44'),_0x5b2d26[_0xd371('0x7')]),_0x5b2d26);if(!_[_0xd371('0x21')](_0x5b2d26[_0xd371('0x45')][_0xd371('0x46')])){utils['info'](util[_0xd371('0x1c')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5b2d26[_0xd371('0x7')],_0x5b2d26['value']));channels[_0x5b2d26['uniqueid']][_0xd371('0x47')]=_0x5b2d26[_0xd371('0x48')];}if(!_[_0xd371('0x21')](_0x5b2d26[_0xd371('0x45')][_0xd371('0x49')])){utils['info'](util['format'](_0xd371('0x4a'),_0x5b2d26[_0xd371('0x7')],_0x5b2d26[_0xd371('0x48')]));channels[_0x5b2d26[_0xd371('0x7')]][_0xd371('0x4b')]=_0x5b2d26['value'];channels[_0x5b2d26[_0xd371('0x7')]][_0xd371('0x2d')]='\x22'+_0x5b2d26[_0xd371('0x48')]+'\x22\x20<'+_0x5b2d26['value']+'>';}if(!_[_0xd371('0x21')](_0x5b2d26[_0xd371('0x45')][_0xd371('0x4c')])||!_[_0xd371('0x21')](_0x5b2d26[_0xd371('0x45')][_0xd371('0x4d')])){utils['info'](util[_0xd371('0x1c')](_0xd371('0x4e'),_0x5b2d26[_0xd371('0x7')],!_[_0xd371('0x21')](_0x5b2d26[_0xd371('0x45')][_0xd371('0x4c')])?_0xd371('0x4c'):_0xd371('0x4d'),_0x5b2d26[_0xd371('0x48')]));channels[_0x5b2d26[_0xd371('0x7')]][_0xd371('0x2d')]=_0x5b2d26['value'];}if(!_[_0xd371('0x21')](_0x5b2d26[_0xd371('0x45')][_0xd371('0x4f')])||!_[_0xd371('0x21')](_0x5b2d26[_0xd371('0x45')]['xmcs-queue'])){utils['info'](util[_0xd371('0x1c')](_0xd371('0x4e'),_0x5b2d26[_0xd371('0x7')],!_[_0xd371('0x21')](_0x5b2d26['variable'][_0xd371('0x4f')])?_0xd371('0x4f'):_0xd371('0x50'),_0x5b2d26[_0xd371('0x48')]));channels[_0x5b2d26[_0xd371('0x7')]][_0xd371('0x51')]='Queue';channels[_0x5b2d26[_0xd371('0x7')]][_0xd371('0x52')]=_0x5b2d26[_0xd371('0x48')];channels[_0x5b2d26[_0xd371('0x7')]]['queue']=!![];}if(!_[_0xd371('0x21')](_0x5b2d26[_0xd371('0x45')][_0xd371('0x53')])){utils[_0xd371('0x16')](util['format'](_0xd371('0x54'),_0x5b2d26[_0xd371('0x7')],_0x5b2d26[_0xd371('0x48')]));channels[_0x5b2d26[_0xd371('0x7')]][_0xd371('0x55')]=_0x5b2d26[_0xd371('0x48')];}if(!_[_0xd371('0x21')](_0x5b2d26[_0xd371('0x45')]['xmd-cdrtype'])){utils[_0xd371('0x16')](util[_0xd371('0x1c')](_0xd371('0x56'),_0x5b2d26['uniqueid'],_0x5b2d26[_0xd371('0x48')]));channels[_0x5b2d26[_0xd371('0x7')]][_0xd371('0x57')]=_0x5b2d26[_0xd371('0x48')];}if(!_['isNil'](_0x5b2d26[_0xd371('0x45')][_0xd371('0x58')])){utils[_0xd371('0x16')](util[_0xd371('0x1c')](_0xd371('0x59'),_0x5b2d26[_0xd371('0x7')],_0x5b2d26[_0xd371('0x48')]));channels[_0x5b2d26[_0xd371('0x7')]][_0xd371('0x5a')]=_0x5b2d26[_0xd371('0x48')];}if(!_[_0xd371('0x21')](_0x5b2d26['variable'][_0xd371('0x5b')])){utils[_0xd371('0x16')](util[_0xd371('0x1c')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5b2d26[_0xd371('0x7')],_0x5b2d26[_0xd371('0x48')]));channels[_0x5b2d26['uniqueid']][_0xd371('0x5b')]=_0x5b2d26[_0xd371('0x48')];}}}catch(_0x52f5b9){utils[_0xd371('0x29')](util['format']('[%s][calls][varset]',_0x5b2d26[_0xd371('0x7')]),_0x52f5b9);}};exports[_0xd371('0x5c')]=function(_0x35995a){try{if(!_[_0xd371('0x21')](channels[_0x35995a['uniqueid']])){utils[_0xd371('0x2b')](util[_0xd371('0x1c')](_0xd371('0x5d'),_0x35995a['uniqueid']),_0x35995a);utils['info'](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x35995a[_0xd371('0x7')],_0x35995a[_0xd371('0x5e')],_0x35995a[_0xd371('0x5f')]));if(_0x35995a['application']['toLowerCase']()==_0xd371('0x60')&&_[_0xd371('0x61')](_0x35995a[_0xd371('0x5f')][_0xd371('0x62')](),'cdr')){var _0x47247b=_0x35995a['appdata'][_0xd371('0x63')]('=');var _0x12685f=_0x47247b[0x0]['substring'](_0x47247b[0x0]['lastIndexOf']('(')+0x1,_0x47247b[0x0]['lastIndexOf'](')'));var _0x1827d7=_0x47247b[0x1];channels[_0x35995a[_0xd371('0x7')]][_0x12685f]=_0x1827d7;}if(!_['includes']([_0xd371('0x2a'),_0xd371('0x64'),_0xd371('0x65'),_0xd371('0x60'),'gotoif'],_0x35995a[_0xd371('0x5e')][_0xd371('0x62')]())){channels[_0x35995a[_0xd371('0x7')]]['lastapplication']=_0x35995a[_0xd371('0x5e')];channels[_0x35995a[_0xd371('0x7')]][_0xd371('0x52')]=_0x35995a['appdata'];}}}catch(_0x1dd66c){utils[_0xd371('0x29')](util[_0xd371('0x1c')](_0xd371('0x5d'),_0x35995a['uniqueid']),_0x1dd66c);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d3c0a1d..6ac1f69 100644 --- a/server/services/xdr/core.controller.js +++ b/server/services/xdr/core.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a8f=['fullybooted','[core]\x20fullybooted','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x5a8f,0x1be));var _0xf5a8=function(_0x17bec1,_0x5927a6){_0x17bec1=_0x17bec1-0x0;var _0x1502c8=_0x5a8f[_0x17bec1];return _0x1502c8;};'use strict';var utils=require(_0xf5a8('0x0'));exports[_0xf5a8('0x1')]=function(){utils[_0xf5a8('0x2')](_0xf5a8('0x3'));};exports['shutdown']=function(){utils[_0xf5a8('0x2')](_0xf5a8('0x4'));};exports[_0xf5a8('0x5')]=function(){utils[_0xf5a8('0x2')](_0xf5a8('0x6'));};exports['error']=function(_0x39ce05){utils['error'](_0xf5a8('0x7'),_0x39ce05);};exports[_0xf5a8('0x8')]=function(){utils[_0xf5a8('0x2')](_0xf5a8('0x9'));};exports[_0xf5a8('0xa')]=function(_0x27a31e){}; \ No newline at end of file +var _0x9812=['info','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x1b9a38,_0x81911a){var _0x1d4bc8=function(_0x50b228){while(--_0x50b228){_0x1b9a38['push'](_0x1b9a38['shift']());}};_0x1d4bc8(++_0x81911a);}(_0x9812,0x166));var _0x2981=function(_0x1506d4,_0x60586b){_0x1506d4=_0x1506d4-0x0;var _0x4cb87b=_0x9812[_0x1506d4];return _0x4cb87b;};'use strict';var utils=require(_0x2981('0x0'));exports[_0x2981('0x1')]=function(){utils['info']('[core]\x20connected');};exports['shutdown']=function(){utils[_0x2981('0x2')](_0x2981('0x3'));};exports[_0x2981('0x4')]=function(){utils['info']('[core]\x20fullybooted');};exports[_0x2981('0x5')]=function(_0x11e2cd){utils['error'](_0x2981('0x6'),_0x11e2cd);};exports[_0x2981('0x7')]=function(){utils[_0x2981('0x2')](_0x2981('0x8'));};exports[_0x2981('0x9')]=function(_0x56cb8a){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index a318c13..2821438 100644 --- a/server/services/xdr/dials.controller.js +++ b/server/services/xdr/dials.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab00=['startsWith','cdr(routeid)','varset','[%s][dials][varset]','variable','outboundrouteid','value','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','dialend','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','diffTime','endtime','holdtime','billableseconds','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab00,0x108));var _0x0ab0=function(_0x1b1e22,_0x885fd2){_0x1b1e22=_0x1b1e22-0x0;var _0x55939f=_0xab00[_0x1b1e22];return _0x55939f;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0ab0('0x0'));var dials={};function writeDB(_0x5d8a52){utils[_0x0ab0('0x1')](util[_0x0ab0('0x2')](_0x0ab0('0x3'),_0x5d8a52[_0x0ab0('0x4')],_0x5d8a52['channel'],_0x5d8a52['dialstring'],_0x5d8a52[_0x0ab0('0x5')],_0x5d8a52[_0x0ab0('0x6')],_0x5d8a52[_0x0ab0('0x7')]));utils[_0x0ab0('0x8')](_0x0ab0('0x9'),_0x5d8a52);delete dials[_0x5d8a52[_0x0ab0('0x4')]];}exports[_0x0ab0('0xa')]=function(_0x1042b0){try{utils[_0x0ab0('0xb')](util[_0x0ab0('0x2')](_0x0ab0('0xc'),_0x1042b0['uniqueid']),_0x1042b0);utils[_0x0ab0('0x1')](util[_0x0ab0('0x2')](_0x0ab0('0xd'),_0x1042b0[_0x0ab0('0x4')],_0x1042b0[_0x0ab0('0xe')],_0x1042b0[_0x0ab0('0xf')]));if(_0x1042b0[_0x0ab0('0xe')][_0x0ab0('0x10')]()==_0x0ab0('0x11')&&_[_0x0ab0('0x12')](_0x1042b0[_0x0ab0('0xf')][_0x0ab0('0x10')](),_0x0ab0('0x13'))){var _0x56ac6a=_0x1042b0[_0x0ab0('0xf')]['split']('=');dials[_0x1042b0['uniqueid']]={'routeId':_0x56ac6a[0x1]};}}catch(_0x3c117e){utils['error'](util['format'](_0x0ab0('0xc'),_0x1042b0['uniqueid']),_0x3c117e);}};exports[_0x0ab0('0x14')]=function(_0x139835){try{utils['debug'](util['format'](_0x0ab0('0x15'),_0x139835[_0x0ab0('0x4')]),_0x139835);if(!_['isNil'](_0x139835[_0x0ab0('0x16')][_0x0ab0('0x17')])){utils[_0x0ab0('0x1')](util[_0x0ab0('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x139835[_0x0ab0('0x4')],_0x139835[_0x0ab0('0x18')]));dials[_0x139835['uniqueid']]={'routeId':_0x139835[_0x0ab0('0x18')]};}}catch(_0x523daa){utils['error'](util[_0x0ab0('0x2')](_0x0ab0('0x15'),_0x139835['uniqueid']),_0x523daa);}};exports['dialbegin']=function(_0x521bb7){try{if(!_[_0x0ab0('0x19')](dials[_0x521bb7[_0x0ab0('0x4')]])){utils['debug'](util['format'](_0x0ab0('0x1a'),_0x521bb7[_0x0ab0('0x4')]),_0x521bb7);dials[_0x521bb7[_0x0ab0('0x4')]]=_[_0x0ab0('0x1b')](dials[_0x521bb7[_0x0ab0('0x4')]],_0x521bb7);dials[_0x521bb7['uniqueid']][_0x0ab0('0x1c')]=utils[_0x0ab0('0x1d')]();dials[_0x521bb7[_0x0ab0('0x4')]][_0x0ab0('0x1e')]='called';utils['info'](util['format'](_0x0ab0('0x1f'),_0x521bb7[_0x0ab0('0x4')],dials[_0x521bb7[_0x0ab0('0x4')]][_0x0ab0('0x1c')]));}}catch(_0xbef9dd){utils[_0x0ab0('0x20')](util['format'](_0x0ab0('0x1a'),_0x521bb7[_0x0ab0('0x4')]),_0xbef9dd);}};exports[_0x0ab0('0x21')]=function(_0x469ad9){try{if(!_[_0x0ab0('0x19')](dials[_0x469ad9[_0x0ab0('0x4')]])){utils['debug'](util['format']('[%s][dials][dialend]',_0x469ad9[_0x0ab0('0x4')]),_0x469ad9);dials[_0x469ad9[_0x0ab0('0x4')]]['dialstatus']=_0x469ad9[_0x0ab0('0x7')];if(_0x469ad9[_0x0ab0('0x7')]==_0x0ab0('0x22')){dials[_0x469ad9[_0x0ab0('0x4')]]=_[_0x0ab0('0x1b')](dials[_0x469ad9[_0x0ab0('0x4')]],_0x469ad9);dials[_0x469ad9[_0x0ab0('0x4')]][_0x0ab0('0x23')]=utils['now']();dials[_0x469ad9[_0x0ab0('0x4')]][_0x0ab0('0x1e')]='connect';utils[_0x0ab0('0x1')](util['format'](_0x0ab0('0x24'),_0x469ad9[_0x0ab0('0x4')],_0x469ad9[_0x0ab0('0x7')],dials[_0x469ad9['uniqueid']][_0x0ab0('0x23')]));}else{utils[_0x0ab0('0x1')](util['format'](_0x0ab0('0x25'),_0x469ad9['uniqueid'],_0x469ad9[_0x0ab0('0x7')]));}}}catch(_0x54072c){utils[_0x0ab0('0x20')](util[_0x0ab0('0x2')](_0x0ab0('0x26'),_0x469ad9[_0x0ab0('0x4')]),_0x54072c);}};exports['hangup']=function(_0x123288){try{if(!_[_0x0ab0('0x19')](dials[_0x123288['uniqueid']])){utils[_0x0ab0('0xb')](util[_0x0ab0('0x2')](_0x0ab0('0x27'),_0x123288['uniqueid']),_0x123288);utils['info'](util['format'](_0x0ab0('0x28'),_0x123288['uniqueid'],_0x123288[_0x0ab0('0x5')],_0x123288[_0x0ab0('0x29')],_0x123288[_0x0ab0('0x2a')]));dials[_0x123288['uniqueid']]=_[_0x0ab0('0x1b')](dials[_0x123288[_0x0ab0('0x4')]],{'endtime':utils[_0x0ab0('0x1d')](),'lastevent':'complete'});dials[_0x123288['uniqueid']]['duration']=utils[_0x0ab0('0x2b')](dials[_0x123288['uniqueid']][_0x0ab0('0x2c')],dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x1c')]);dials[_0x123288['uniqueid']][_0x0ab0('0x2d')]=utils[_0x0ab0('0x2b')](dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x23')]||dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x2c')],dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x1c')]);dials[_0x123288['uniqueid']][_0x0ab0('0x2e')]=dials[_0x123288[_0x0ab0('0x4')]]['answertime']?utils['diffTime'](dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x2c')],dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x23')]):0x0;writeDB(dials[_0x123288[_0x0ab0('0x4')]]);}}catch(_0x18a374){utils[_0x0ab0('0x20')](util[_0x0ab0('0x2')](_0x0ab0('0x27'),_0x123288['uniqueid']),_0x18a374);}}; \ No newline at end of file +var _0xd63f=['calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','[%s][dials][hangup]','lodash','util','format','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','varset','[%s][dials][varset]','variable','outboundrouteid','value','error','dialbegin','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','debug','ANSWER','assign','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0x2bdb2f,_0x548aaf){var _0x2de3ce=function(_0x11276d){while(--_0x11276d){_0x2bdb2f['push'](_0x2bdb2f['shift']());}};_0x2de3ce(++_0x548aaf);}(_0xd63f,0x9e));var _0xfd63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd63f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfd63('0x0'));var util=require(_0xfd63('0x1'));var utils=require('./utils');var dials={};function writeDB(_0xe3e766){utils['info'](util[_0xfd63('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0xe3e766['uniqueid'],_0xe3e766['channel'],_0xe3e766[_0xfd63('0x3')],_0xe3e766[_0xfd63('0x4')],_0xe3e766['connectedlinenum'],_0xe3e766[_0xfd63('0x5')]));utils[_0xfd63('0x6')](_0xfd63('0x7'),_0xe3e766);delete dials[_0xe3e766[_0xfd63('0x8')]];}exports[_0xfd63('0x9')]=function(_0x27fef6){try{utils['debug'](util[_0xfd63('0x2')](_0xfd63('0xa'),_0x27fef6[_0xfd63('0x8')]),_0x27fef6);utils[_0xfd63('0xb')](util[_0xfd63('0x2')](_0xfd63('0xc'),_0x27fef6[_0xfd63('0x8')],_0x27fef6[_0xfd63('0xd')],_0x27fef6[_0xfd63('0xe')]));if(_0x27fef6['application'][_0xfd63('0xf')]()=='set'&&_[_0xfd63('0x10')](_0x27fef6[_0xfd63('0xe')][_0xfd63('0xf')](),'cdr(routeid)')){var _0x5a8f67=_0x27fef6[_0xfd63('0xe')][_0xfd63('0x11')]('=');dials[_0x27fef6[_0xfd63('0x8')]]={'routeId':_0x5a8f67[0x1]};}}catch(_0x1a2805){utils['error'](util[_0xfd63('0x2')](_0xfd63('0xa'),_0x27fef6[_0xfd63('0x8')]),_0x1a2805);}};exports[_0xfd63('0x12')]=function(_0x4e4d0c){try{utils['debug'](util[_0xfd63('0x2')](_0xfd63('0x13'),_0x4e4d0c[_0xfd63('0x8')]),_0x4e4d0c);if(!_['isNil'](_0x4e4d0c[_0xfd63('0x14')][_0xfd63('0x15')])){utils[_0xfd63('0xb')](util[_0xfd63('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x4e4d0c[_0xfd63('0x8')],_0x4e4d0c['value']));dials[_0x4e4d0c['uniqueid']]={'routeId':_0x4e4d0c[_0xfd63('0x16')]};}}catch(_0x90327){utils[_0xfd63('0x17')](util[_0xfd63('0x2')](_0xfd63('0x13'),_0x4e4d0c[_0xfd63('0x8')]),_0x90327);}};exports[_0xfd63('0x18')]=function(_0x27a714){try{if(!_[_0xfd63('0x19')](dials[_0x27a714[_0xfd63('0x8')]])){utils['debug'](util[_0xfd63('0x2')](_0xfd63('0x1a'),_0x27a714[_0xfd63('0x8')]),_0x27a714);dials[_0x27a714[_0xfd63('0x8')]]=_['assign'](dials[_0x27a714[_0xfd63('0x8')]],_0x27a714);dials[_0x27a714[_0xfd63('0x8')]][_0xfd63('0x1b')]=utils[_0xfd63('0x1c')]();dials[_0x27a714[_0xfd63('0x8')]][_0xfd63('0x1d')]=_0xfd63('0x1e');utils['info'](util[_0xfd63('0x2')](_0xfd63('0x1f'),_0x27a714['uniqueid'],dials[_0x27a714['uniqueid']][_0xfd63('0x1b')]));}}catch(_0x4dcc2f){utils[_0xfd63('0x17')](util[_0xfd63('0x2')](_0xfd63('0x1a'),_0x27a714[_0xfd63('0x8')]),_0x4dcc2f);}};exports[_0xfd63('0x20')]=function(_0x3c130d){try{if(!_[_0xfd63('0x19')](dials[_0x3c130d['uniqueid']])){utils[_0xfd63('0x21')](util[_0xfd63('0x2')]('[%s][dials][dialend]',_0x3c130d['uniqueid']),_0x3c130d);dials[_0x3c130d['uniqueid']][_0xfd63('0x5')]=_0x3c130d[_0xfd63('0x5')];if(_0x3c130d[_0xfd63('0x5')]==_0xfd63('0x22')){dials[_0x3c130d[_0xfd63('0x8')]]=_[_0xfd63('0x23')](dials[_0x3c130d['uniqueid']],_0x3c130d);dials[_0x3c130d[_0xfd63('0x8')]]['answertime']=utils[_0xfd63('0x1c')]();dials[_0x3c130d[_0xfd63('0x8')]][_0xfd63('0x1d')]=_0xfd63('0x24');utils[_0xfd63('0xb')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3c130d[_0xfd63('0x8')],_0x3c130d[_0xfd63('0x5')],dials[_0x3c130d['uniqueid']][_0xfd63('0x25')]));}else{utils[_0xfd63('0xb')](util['format'](_0xfd63('0x26'),_0x3c130d[_0xfd63('0x8')],_0x3c130d[_0xfd63('0x5')]));}}}catch(_0x3f2392){utils[_0xfd63('0x17')](util['format'](_0xfd63('0x27'),_0x3c130d[_0xfd63('0x8')]),_0x3f2392);}};exports[_0xfd63('0x28')]=function(_0x43ac0b){try{if(!_[_0xfd63('0x19')](dials[_0x43ac0b['uniqueid']])){utils['debug'](util[_0xfd63('0x2')]('[%s][dials][hangup]',_0x43ac0b[_0xfd63('0x8')]),_0x43ac0b);utils[_0xfd63('0xb')](util['format'](_0xfd63('0x29'),_0x43ac0b['uniqueid'],_0x43ac0b[_0xfd63('0x4')],_0x43ac0b[_0xfd63('0x2a')],_0x43ac0b[_0xfd63('0x2b')]));dials[_0x43ac0b[_0xfd63('0x8')]]=_[_0xfd63('0x23')](dials[_0x43ac0b[_0xfd63('0x8')]],{'endtime':utils[_0xfd63('0x1c')](),'lastevent':_0xfd63('0x2c')});dials[_0x43ac0b['uniqueid']][_0xfd63('0x2d')]=utils[_0xfd63('0x2e')](dials[_0x43ac0b['uniqueid']][_0xfd63('0x2f')],dials[_0x43ac0b['uniqueid']][_0xfd63('0x1b')]);dials[_0x43ac0b['uniqueid']]['holdtime']=utils['diffTime'](dials[_0x43ac0b[_0xfd63('0x8')]][_0xfd63('0x25')]||dials[_0x43ac0b[_0xfd63('0x8')]][_0xfd63('0x2f')],dials[_0x43ac0b['uniqueid']]['starttime']);dials[_0x43ac0b[_0xfd63('0x8')]][_0xfd63('0x30')]=dials[_0x43ac0b[_0xfd63('0x8')]][_0xfd63('0x25')]?utils[_0xfd63('0x2e')](dials[_0x43ac0b[_0xfd63('0x8')]][_0xfd63('0x2f')],dials[_0x43ac0b[_0xfd63('0x8')]]['answertime']):0x0;writeDB(dials[_0x43ac0b[_0xfd63('0x8')]]);}}catch(_0x1a39a2){utils['error'](util['format'](_0xfd63('0x31'),_0x43ac0b[_0xfd63('0x8')]),_0x1a39a2);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6c48094..c278bd2 100644 --- a/server/services/xdr/index.js +++ b/server/services/xdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb989=['queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon'];(function(_0x4da3b6,_0x233aff){var _0x574d38=function(_0x4fa45b){while(--_0x4fa45b){_0x4da3b6['push'](_0x4da3b6['shift']());}};_0x574d38(++_0x233aff);}(_0xb989,0x64));var _0x9b98=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xb989[_0x8de54f];return _0x14cba4;};var AsteriskManager=require(_0x9b98('0x0'));var config=require(_0x9b98('0x1'));var utils=require(_0x9b98('0x2'));var util=require(_0x9b98('0x3'));var isXDREnabled=config[_0x9b98('0x4')]&&config[_0x9b98('0x4')]['disabled']?!config[_0x9b98('0x4')][_0x9b98('0x5')]:!![];var isProduction=config[_0x9b98('0x6')]===_0x9b98('0x7')||![];var isLocalAsterisk=config[_0x9b98('0x4')]&&config[_0x9b98('0x4')][_0x9b98('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x9b98('0x9')]['port'],config[_0x9b98('0x9')]['ip'],config[_0x9b98('0x9')][_0x9b98('0xa')],config['asterisk']['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x9b98('0xb')](_0x9b98('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x9b98('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x9b98('0xd'));var calls=require(_0x9b98('0xe'));var queues=require(_0x9b98('0xf'));var recordings=require(_0x9b98('0x10'));var members=require(_0x9b98('0x11'));var dials=require(_0x9b98('0x12'));var transfers=require(_0x9b98('0x13'));var core=require('./core.controller');ami['on'](_0x9b98('0x14'),core[_0x9b98('0x14')]);ami['on'](_0x9b98('0x15'),core[_0x9b98('0x15')]);ami['on'](_0x9b98('0x16'),core[_0x9b98('0x16')]);ami['on'](_0x9b98('0x17'),core['error']);ami['on'](_0x9b98('0x18'),core['close']);ami['on'](_0x9b98('0x19'),core[_0x9b98('0x19')]);ami['on'](_0x9b98('0x1a'),function(_0x25c717){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x1d'),_0x25c717[_0x9b98('0x1e')]),_0x25c717);members[_0x9b98('0x1a')](_0x25c717);}catch(_0x387721){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')]('[%s][index][devicestatechange]',_0x25c717['device']),_0x387721);}});ami['on'](_0x9b98('0x1f'),function(_0x366d31){try{utils['debug'](util[_0x9b98('0x1c')]('[%s][index][agentcalled]',_0x366d31[_0x9b98('0x20')]),_0x366d31);agents[_0x9b98('0x1f')](_0x366d31);}catch(_0x4e2175){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x21'),_0x366d31['uniqueid']),_0x4e2175);}});ami['on'](_0x9b98('0x22'),function(_0x285d3b){try{utils[_0x9b98('0x1b')](util['format'](_0x9b98('0x23'),_0x285d3b[_0x9b98('0x20')]),_0x285d3b);agents[_0x9b98('0x22')](_0x285d3b);}catch(_0x3a0662){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x23'),_0x285d3b[_0x9b98('0x20')]),_0x3a0662);}});ami['on'](_0x9b98('0x24'),function(_0x58e06a){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x25'),_0x58e06a[_0x9b98('0x20')]),_0x58e06a);agents[_0x9b98('0x24')](_0x58e06a);queues[_0x9b98('0x24')](_0x58e06a);}catch(_0x405356){utils[_0x9b98('0x17')](util['format']('[%s][index][agentconnect]',_0x58e06a[_0x9b98('0x20')]),_0x405356);}});ami['on'](_0x9b98('0x26'),function(_0x4e0f94){try{utils['debug'](util[_0x9b98('0x1c')](_0x9b98('0x27'),_0x4e0f94[_0x9b98('0x20')]),_0x4e0f94);agents[_0x9b98('0x26')](_0x4e0f94);queues['agentcomplete'](_0x4e0f94);members['agentcomplete'](_0x4e0f94);}catch(_0x31d06b){utils['error'](util[_0x9b98('0x1c')]('[%s][index][agentcomplete]',_0x4e0f94['uniqueid']),_0x31d06b);}});ami['on']('queuecallerabandon',function(_0x49620e){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x28'),_0x49620e['uniqueid']),_0x49620e);agents[_0x9b98('0x29')](_0x49620e);queues[_0x9b98('0x29')](_0x49620e);}catch(_0x50b73f){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')]('[%s][index][queuecallerabandon]',_0x49620e[_0x9b98('0x20')]),_0x50b73f);}});ami['on'](_0x9b98('0x2a'),function(_0x4ba4df){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x2b'),_0x4ba4df[_0x9b98('0x20')]),_0x4ba4df);queues[_0x9b98('0x2a')](_0x4ba4df);recordings[_0x9b98('0x2a')](_0x4ba4df);}catch(_0x36ec4d){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x2b'),_0x4ba4df[_0x9b98('0x20')]),_0x36ec4d);}});ami['on'](_0x9b98('0x2c'),function(_0x5dda6a){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')]('[%s][index][queuecallerleave]',_0x5dda6a[_0x9b98('0x20')]),_0x5dda6a);queues['queuecallerleave'](_0x5dda6a);}catch(_0x3d89c4){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x2d'),_0x5dda6a[_0x9b98('0x20')]),_0x3d89c4);}});ami['on'](_0x9b98('0x2e'),function(_0x3f9a72){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x2f'),_0x3f9a72[_0x9b98('0x20')]),_0x3f9a72);queues[_0x9b98('0x2e')](_0x3f9a72);calls['musiconholdstart'](_0x3f9a72);}catch(_0x523309){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')]('[%s][index][musiconholdstart]',_0x3f9a72['uniqueid']),_0x523309);}});ami['on'](_0x9b98('0x30'),function(_0x245019){try{utils['debug'](util[_0x9b98('0x1c')](_0x9b98('0x31'),_0x245019[_0x9b98('0x20')]),_0x245019);queues[_0x9b98('0x30')](_0x245019);calls[_0x9b98('0x30')](_0x245019);}catch(_0x241720){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x31'),_0x245019[_0x9b98('0x20')]),_0x241720);}});ami['on'](_0x9b98('0x32'),function(_0x3ec91b){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x33'),_0x3ec91b[_0x9b98('0x20')]),_0x3ec91b);calls['newstate'](_0x3ec91b);recordings[_0x9b98('0x32')](_0x3ec91b);}catch(_0x52ab79){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x33'),_0x3ec91b[_0x9b98('0x20')]),_0x52ab79);}});ami['on'](_0x9b98('0x34'),function(_0x17b75f){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x35'),_0x17b75f[_0x9b98('0x20')]),_0x17b75f);calls[_0x9b98('0x34')](_0x17b75f);recordings[_0x9b98('0x34')](_0x17b75f);dials['hangup'](_0x17b75f);agents[_0x9b98('0x34')](_0x17b75f);queues[_0x9b98('0x34')](_0x17b75f);}catch(_0x5e6122){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x35'),_0x17b75f[_0x9b98('0x20')]),_0x5e6122);}});ami['on']('cdr',function(_0x53a175){try{utils[_0x9b98('0x1b')](util['format'](_0x9b98('0x36'),_0x53a175['uniqueid']),_0x53a175);members[_0x9b98('0x37')](_0x53a175);}catch(_0x14d77e){utils[_0x9b98('0x17')](util['format'](_0x9b98('0x36'),_0x53a175[_0x9b98('0x20')]),_0x14d77e);}});ami['on'](_0x9b98('0x38'),function(_0x195b00){try{utils[_0x9b98('0x1b')](util['format'](_0x9b98('0x39'),_0x195b00[_0x9b98('0x20')]),_0x195b00);queues[_0x9b98('0x38')](_0x195b00);agents['blindtransfer'](_0x195b00);transfers[_0x9b98('0x38')](_0x195b00);}catch(_0x5da3a4){utils['error'](util['format'](_0x9b98('0x39'),_0x195b00[_0x9b98('0x20')]),_0x5da3a4);}});ami['on'](_0x9b98('0x3a'),function(_0x589abc){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')]('[%s][index][attendedtransfer]',_0x589abc[_0x9b98('0x3b')]),_0x589abc);queues[_0x9b98('0x3a')](_0x589abc);transfers[_0x9b98('0x3a')](_0x589abc);agents[_0x9b98('0x3a')](_0x589abc);calls[_0x9b98('0x3a')](_0x589abc);}catch(_0x3dab16){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')]('[%s][index][attendedtransfer]',_0x589abc[_0x9b98('0x3b')]),_0x3dab16);}});ami['on']('varset',function(_0x11bc3f){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x3c'),_0x11bc3f['uniqueid']),_0x11bc3f);queues[_0x9b98('0x3d')](_0x11bc3f);recordings['varset'](_0x11bc3f);calls[_0x9b98('0x3d')](_0x11bc3f);dials[_0x9b98('0x3d')](_0x11bc3f);}catch(_0xc0162d){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x3c'),_0x11bc3f[_0x9b98('0x20')]),_0xc0162d);}});ami['on'](_0x9b98('0x3e'),function(_0x4edb9e){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x3f'),_0x4edb9e[_0x9b98('0x20')]),_0x4edb9e);calls['newexten'](_0x4edb9e);recordings[_0x9b98('0x3e')](_0x4edb9e);dials[_0x9b98('0x3e')](_0x4edb9e);}catch(_0x30c005){utils['error'](util[_0x9b98('0x1c')](_0x9b98('0x3f'),_0x4edb9e[_0x9b98('0x20')]),_0x30c005);}});ami['on'](_0x9b98('0x40'),function(_0x53a958){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x41'),_0x53a958[_0x9b98('0x20')]),_0x53a958);calls[_0x9b98('0x40')](_0x53a958);recordings[_0x9b98('0x40')](_0x53a958);}catch(_0x46883b){utils['error'](util[_0x9b98('0x1c')]('[%s][index][newchannel]',_0x53a958[_0x9b98('0x20')]),_0x46883b);}});ami['on']('dialbegin',function(_0x2ea963){try{utils[_0x9b98('0x1b')](util['format'](_0x9b98('0x42'),_0x2ea963[_0x9b98('0x20')]),_0x2ea963);dials[_0x9b98('0x43')](_0x2ea963);}catch(_0x29e825){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x44'),_0x2ea963[_0x9b98('0x20')]),_0x29e825);}});ami['on'](_0x9b98('0x45'),function(_0x34e013){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x46'),_0x34e013[_0x9b98('0x20')]),_0x34e013);dials[_0x9b98('0x45')](_0x34e013);}catch(_0x2ba69f){utils['error'](util[_0x9b98('0x1c')]('[%s][index][dialend]',_0x34e013[_0x9b98('0x20')]),_0x2ba69f);}});} \ No newline at end of file +var _0x511c=['debug','format','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','dialbegin','dialend','[%s][index][dialend]','util','xdr','disabled','env','production','local','asterisk','port','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange'];(function(_0x20f4ab,_0x472de6){var _0x2a391d=function(_0x524eda){while(--_0x524eda){_0x20f4ab['push'](_0x20f4ab['shift']());}};_0x2a391d(++_0x472de6);}(_0x511c,0xaf));var _0xc511=function(_0x45f6e2,_0xe72d77){_0x45f6e2=_0x45f6e2-0x0;var _0x573b09=_0x511c[_0x45f6e2];return _0x573b09;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xc511('0x0'));var isXDREnabled=config[_0xc511('0x1')]&&config[_0xc511('0x1')][_0xc511('0x2')]?!config[_0xc511('0x1')][_0xc511('0x2')]:!![];var isProduction=config[_0xc511('0x3')]===_0xc511('0x4')||![];var isLocalAsterisk=config[_0xc511('0x1')]&&config[_0xc511('0x1')][_0xc511('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xc511('0x6')][_0xc511('0x7')],config[_0xc511('0x6')]['ip'],config[_0xc511('0x6')]['username'],config[_0xc511('0x6')]['password'],!![]);ami[_0xc511('0x8')]();if(!isXDREnabled){utils[_0xc511('0x9')](_0xc511('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xc511('0x9')](_0xc511('0xb'));}else{var agents=require(_0xc511('0xc'));var calls=require(_0xc511('0xd'));var queues=require('./queues.controller');var recordings=require(_0xc511('0xe'));var members=require(_0xc511('0xf'));var dials=require(_0xc511('0x10'));var transfers=require(_0xc511('0x11'));var core=require(_0xc511('0x12'));ami['on'](_0xc511('0x13'),core['connect']);ami['on'](_0xc511('0x14'),core['shutdown']);ami['on'](_0xc511('0x15'),core[_0xc511('0x15')]);ami['on'](_0xc511('0x16'),core[_0xc511('0x16')]);ami['on'](_0xc511('0x17'),core[_0xc511('0x17')]);ami['on'](_0xc511('0x18'),core[_0xc511('0x18')]);ami['on'](_0xc511('0x19'),function(_0x101013){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')]('[%s][index][devicestatechange]',_0x101013[_0xc511('0x1c')]),_0x101013);members[_0xc511('0x19')](_0x101013);}catch(_0x4688a8){utils[_0xc511('0x16')](util['format']('[%s][index][devicestatechange]',_0x101013[_0xc511('0x1c')]),_0x4688a8);}});ami['on']('agentcalled',function(_0x57dc9f){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')](_0xc511('0x1d'),_0x57dc9f[_0xc511('0x1e')]),_0x57dc9f);agents[_0xc511('0x1f')](_0x57dc9f);}catch(_0x506fd9){utils[_0xc511('0x16')](util['format'](_0xc511('0x1d'),_0x57dc9f[_0xc511('0x1e')]),_0x506fd9);}});ami['on'](_0xc511('0x20'),function(_0x42bdb3){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')]('[%s][index][agentringnoanswer]',_0x42bdb3[_0xc511('0x1e')]),_0x42bdb3);agents[_0xc511('0x20')](_0x42bdb3);}catch(_0xaa6c7b){utils['error'](util['format'](_0xc511('0x21'),_0x42bdb3[_0xc511('0x1e')]),_0xaa6c7b);}});ami['on'](_0xc511('0x22'),function(_0x283803){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')](_0xc511('0x23'),_0x283803[_0xc511('0x1e')]),_0x283803);agents[_0xc511('0x22')](_0x283803);queues[_0xc511('0x22')](_0x283803);}catch(_0x258031){utils['error'](util[_0xc511('0x1b')]('[%s][index][agentconnect]',_0x283803[_0xc511('0x1e')]),_0x258031);}});ami['on'](_0xc511('0x24'),function(_0x42b914){try{utils['debug'](util['format'](_0xc511('0x25'),_0x42b914['uniqueid']),_0x42b914);agents[_0xc511('0x24')](_0x42b914);queues[_0xc511('0x24')](_0x42b914);members[_0xc511('0x24')](_0x42b914);}catch(_0x556630){utils[_0xc511('0x16')](util['format']('[%s][index][agentcomplete]',_0x42b914[_0xc511('0x1e')]),_0x556630);}});ami['on'](_0xc511('0x26'),function(_0x3e732c){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')]('[%s][index][queuecallerabandon]',_0x3e732c[_0xc511('0x1e')]),_0x3e732c);agents['queuecallerabandon'](_0x3e732c);queues[_0xc511('0x26')](_0x3e732c);}catch(_0x2006dc){utils[_0xc511('0x16')](util[_0xc511('0x1b')](_0xc511('0x27'),_0x3e732c[_0xc511('0x1e')]),_0x2006dc);}});ami['on'](_0xc511('0x28'),function(_0x4e0702){try{utils[_0xc511('0x1a')](util['format'](_0xc511('0x29'),_0x4e0702[_0xc511('0x1e')]),_0x4e0702);queues[_0xc511('0x28')](_0x4e0702);recordings[_0xc511('0x28')](_0x4e0702);}catch(_0x45bf5f){utils[_0xc511('0x16')](util[_0xc511('0x1b')](_0xc511('0x29'),_0x4e0702['uniqueid']),_0x45bf5f);}});ami['on'](_0xc511('0x2a'),function(_0x6e455){try{utils['debug'](util['format']('[%s][index][queuecallerleave]',_0x6e455[_0xc511('0x1e')]),_0x6e455);queues[_0xc511('0x2a')](_0x6e455);}catch(_0x28e656){utils['error'](util[_0xc511('0x1b')]('[%s][index][queuecallerleave]',_0x6e455[_0xc511('0x1e')]),_0x28e656);}});ami['on'](_0xc511('0x2b'),function(_0x245446){try{utils['debug'](util[_0xc511('0x1b')]('[%s][index][musiconholdstart]',_0x245446[_0xc511('0x1e')]),_0x245446);queues[_0xc511('0x2b')](_0x245446);calls[_0xc511('0x2b')](_0x245446);}catch(_0x10f61d){utils[_0xc511('0x16')](util[_0xc511('0x1b')](_0xc511('0x2c'),_0x245446[_0xc511('0x1e')]),_0x10f61d);}});ami['on'](_0xc511('0x2d'),function(_0x223af6){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')]('[%s][index][musiconholdstop]',_0x223af6[_0xc511('0x1e')]),_0x223af6);queues[_0xc511('0x2d')](_0x223af6);calls[_0xc511('0x2d')](_0x223af6);}catch(_0x24ba52){utils[_0xc511('0x16')](util['format'](_0xc511('0x2e'),_0x223af6[_0xc511('0x1e')]),_0x24ba52);}});ami['on'](_0xc511('0x2f'),function(_0x3ea727){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')]('[%s][index][newstate]',_0x3ea727[_0xc511('0x1e')]),_0x3ea727);calls[_0xc511('0x2f')](_0x3ea727);recordings[_0xc511('0x2f')](_0x3ea727);}catch(_0xd8188d){utils[_0xc511('0x16')](util[_0xc511('0x1b')](_0xc511('0x30'),_0x3ea727[_0xc511('0x1e')]),_0xd8188d);}});ami['on']('hangup',function(_0xfe12ee){try{utils[_0xc511('0x1a')](util['format'](_0xc511('0x31'),_0xfe12ee[_0xc511('0x1e')]),_0xfe12ee);calls['hangup'](_0xfe12ee);recordings['hangup'](_0xfe12ee);dials[_0xc511('0x32')](_0xfe12ee);agents[_0xc511('0x32')](_0xfe12ee);queues['hangup'](_0xfe12ee);}catch(_0x3b54e9){utils[_0xc511('0x16')](util[_0xc511('0x1b')](_0xc511('0x31'),_0xfe12ee[_0xc511('0x1e')]),_0x3b54e9);}});ami['on'](_0xc511('0x33'),function(_0x589939){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')](_0xc511('0x34'),_0x589939['uniqueid']),_0x589939);members[_0xc511('0x33')](_0x589939);}catch(_0x2213fe){utils[_0xc511('0x16')](util[_0xc511('0x1b')](_0xc511('0x34'),_0x589939[_0xc511('0x1e')]),_0x2213fe);}});ami['on'](_0xc511('0x35'),function(_0x174aca){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')]('[%s][index][blindtransfer]',_0x174aca[_0xc511('0x1e')]),_0x174aca);queues[_0xc511('0x35')](_0x174aca);agents[_0xc511('0x35')](_0x174aca);transfers[_0xc511('0x35')](_0x174aca);}catch(_0xe143b7){utils[_0xc511('0x16')](util[_0xc511('0x1b')](_0xc511('0x36'),_0x174aca['uniqueid']),_0xe143b7);}});ami['on'](_0xc511('0x37'),function(_0x3741d7){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')](_0xc511('0x38'),_0x3741d7['origtransfereruniqueid']),_0x3741d7);queues[_0xc511('0x37')](_0x3741d7);transfers['attendedtransfer'](_0x3741d7);agents[_0xc511('0x37')](_0x3741d7);calls[_0xc511('0x37')](_0x3741d7);}catch(_0x1dafe3){utils['error'](util[_0xc511('0x1b')](_0xc511('0x38'),_0x3741d7[_0xc511('0x39')]),_0x1dafe3);}});ami['on'](_0xc511('0x3a'),function(_0x2a30bf){try{utils['debug'](util[_0xc511('0x1b')](_0xc511('0x3b'),_0x2a30bf['uniqueid']),_0x2a30bf);queues['varset'](_0x2a30bf);recordings['varset'](_0x2a30bf);calls[_0xc511('0x3a')](_0x2a30bf);dials[_0xc511('0x3a')](_0x2a30bf);}catch(_0x360389){utils['error'](util['format']('[%s][index][varset]',_0x2a30bf[_0xc511('0x1e')]),_0x360389);}});ami['on']('newexten',function(_0x4fcc73){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')](_0xc511('0x3c'),_0x4fcc73[_0xc511('0x1e')]),_0x4fcc73);calls['newexten'](_0x4fcc73);recordings[_0xc511('0x3d')](_0x4fcc73);dials[_0xc511('0x3d')](_0x4fcc73);}catch(_0x5db9e8){utils['error'](util[_0xc511('0x1b')]('[%s][index][newexten]',_0x4fcc73[_0xc511('0x1e')]),_0x5db9e8);}});ami['on']('newchannel',function(_0x376ef0){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')](_0xc511('0x3e'),_0x376ef0[_0xc511('0x1e')]),_0x376ef0);calls[_0xc511('0x3f')](_0x376ef0);recordings[_0xc511('0x3f')](_0x376ef0);}catch(_0x5fef64){utils[_0xc511('0x16')](util[_0xc511('0x1b')](_0xc511('0x3e'),_0x376ef0[_0xc511('0x1e')]),_0x5fef64);}});ami['on'](_0xc511('0x40'),function(_0xb3d3fd){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')]('[%s][index][dialbegin]',_0xb3d3fd[_0xc511('0x1e')]),_0xb3d3fd);dials['dialbegin'](_0xb3d3fd);}catch(_0x3c9683){utils[_0xc511('0x16')](util[_0xc511('0x1b')]('[%s]dialbegin',_0xb3d3fd['uniqueid']),_0x3c9683);}});ami['on'](_0xc511('0x41'),function(_0x43acff){try{utils[_0xc511('0x1a')](util[_0xc511('0x1b')](_0xc511('0x42'),_0x43acff[_0xc511('0x1e')]),_0x43acff);dials['dialend'](_0x43acff);}catch(_0x29aae0){utils['error'](util['format']('[%s][index][dialend]',_0x43acff[_0xc511('0x1e')]),_0x29aae0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index dfaf6c4..1ac5690 100644 --- a/server/services/xdr/members.controller.js +++ b/server/services/xdr/members.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4de5=['split','catch','error','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','now','agent','NOT_INUSE','isNil','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','data1','type','data2','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','exitAt','destinationchannel','source','destination','[%s][members][cdr]','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4de5,0xbb));var _0x54de=function(_0x58b4ec,_0x245d9a){_0x58b4ec=_0x58b4ec-0x0;var _0xff3daa=_0x4de5[_0x58b4ec];return _0xff3daa;};'use strict';var _=require('lodash');var util=require(_0x54de('0x0'));var utils=require('./utils');var members={};var exclude=[_0x54de('0x1'),_0x54de('0x2')];function writeDB(_0x3231e5){utils[_0x54de('0x3')](util[_0x54de('0x4')](_0x54de('0x5'),_0x3231e5[_0x54de('0x6')],_0x3231e5[_0x54de('0x7')],_0x3231e5[_0x54de('0x8')],_0x3231e5['data2'],_0x3231e5[_0x54de('0x9')],_0x3231e5['type']));if(_0x3231e5[_0x54de('0x7')]){utils[_0x54de('0xa')](_0x3231e5[_0x54de('0x7')])[_0x54de('0xb')](function(_0x1fa271){if(_0x1fa271){_0x3231e5[_0x54de('0x9')]=_0x1fa271[_0x54de('0xc')];_0x3231e5[_0x54de('0xd')]=_0x1fa271[_0x54de('0xd')];utils[_0x54de('0xe')](_0x54de('0xf'),_0x3231e5);}else{utils[_0x54de('0x10')](_0x3231e5['interface'][_0x54de('0x11')]('/')[0x1])[_0x54de('0xb')](function(_0xd26666){if(_0xd26666){_0x3231e5[_0x54de('0x9')]=_0xd26666['name'];_0x3231e5['internal']=_0xd26666['internal'];utils[_0x54de('0xe')](_0x54de('0xf'),_0x3231e5);}});}})[_0x54de('0x12')](function(_0x43e2e9){utils[_0x54de('0x13')](util['format'](_0x54de('0x14'),_0x3231e5[_0x54de('0x6')]),_0x43e2e9);});}delete members[_0x3231e5[_0x54de('0x7')]];}function startsWith(_0x1d3df9,_0x4adf6c){return _['some'](_0x1d3df9,function(_0x13884c){return _['startsWith'](_0x4adf6c,_0x13884c);});}exports[_0x54de('0x15')]=function(_0x4f7c7d){try{utils[_0x54de('0x16')](util[_0x54de('0x4')](_0x54de('0x17'),members[_0x4f7c7d[_0x54de('0x18')]]?members[_0x4f7c7d['device']][_0x54de('0x6')]:_0x4f7c7d[_0x54de('0x18')]),_0x4f7c7d);utils[_0x54de('0x3')](util[_0x54de('0x4')](_0x54de('0x19'),members[_0x4f7c7d[_0x54de('0x18')]]?members[_0x4f7c7d['device']][_0x54de('0x6')]:_0x4f7c7d['device'],_0x4f7c7d['state'],_0x4f7c7d[_0x54de('0x18')]));switch(_0x4f7c7d[_0x54de('0x1a')]){case _0x54de('0x1b'):case'BUSY':if(!startsWith(exclude,_0x4f7c7d['device'])){members[_0x4f7c7d['device']]={'channel':_0x54de('0x1c'),'interface':_0x4f7c7d[_0x54de('0x18')],'type':'TALKING','enterAt':utils[_0x54de('0x1d')](),'role':_0x54de('0x1e')};}break;case _0x54de('0x1f'):if(!_[_0x54de('0x20')](members[_0x4f7c7d['device']])){members[_0x4f7c7d[_0x54de('0x18')]]['exitAt']=utils[_0x54de('0x1d')]();members[_0x4f7c7d[_0x54de('0x18')]][_0x54de('0x21')]=utils[_0x54de('0x22')](members[_0x4f7c7d[_0x54de('0x18')]]['exitAt'],members[_0x4f7c7d['device']][_0x54de('0x23')]);if(members[_0x4f7c7d[_0x54de('0x18')]][_0x54de('0x6')]){writeDB(members[_0x4f7c7d['device']]);}}break;default:break;}}catch(_0x49d1fc){utils[_0x54de('0x13')](util[_0x54de('0x4')](_0x54de('0x17'),members[_0x4f7c7d[_0x54de('0x18')]]?members[_0x4f7c7d[_0x54de('0x18')]][_0x54de('0x6')]:_0x4f7c7d['device']),_0x49d1fc);}};exports[_0x54de('0x24')]=function(_0x5ef25a){try{if(!_[_0x54de('0x20')](members[_0x5ef25a[_0x54de('0x7')]])){utils[_0x54de('0x16')](util[_0x54de('0x4')](_0x54de('0x25'),_0x5ef25a['uniqueid']),_0x5ef25a);utils['info'](util['format'](_0x54de('0x26'),_0x5ef25a[_0x54de('0x6')],_0x5ef25a[_0x54de('0x7')],_0x5ef25a[_0x54de('0x27')]));members[_0x5ef25a[_0x54de('0x7')]]=_[_0x54de('0x28')](members[_0x5ef25a[_0x54de('0x7')]],{'data4':_0x5ef25a[_0x54de('0x27')],'uniqueid':_0x5ef25a[_0x54de('0x6')]});}}catch(_0x43213a){utils[_0x54de('0x13')](util[_0x54de('0x4')](_0x54de('0x25'),_0x5ef25a[_0x54de('0x6')]),_0x43213a);}};exports['cdr']=function(_0x536a1d){try{utils[_0x54de('0x16')](util[_0x54de('0x4')]('[%s][members][cdr]',_0x536a1d[_0x54de('0x6')]),_0x536a1d);if(_0x536a1d[_0x54de('0x8')]){var _0x54492f=_0x536a1d[_0x54de('0x8')][_0x54de('0x11')]('-')[0x0];if(!_[_0x54de('0x20')](members[_0x54492f])){members[_0x54492f]=_[_0x54de('0x28')](members[_0x54492f],{'data1':members[_0x54492f][_0x54de('0x29')]||_0x536a1d[_0x54de('0x2a')],'data2':members[_0x54492f][_0x54de('0x2b')]||_0x536a1d['source'],'data3':members[_0x54492f][_0x54de('0x2c')]||_0x536a1d['destination'],'uniqueid':members[_0x54492f][_0x54de('0x6')]||_0x536a1d['uniqueid']});utils[_0x54de('0x3')](util['format'](_0x54de('0x2d'),_0x536a1d[_0x54de('0x6')],members[_0x54492f][_0x54de('0x29')],members[_0x54492f][_0x54de('0x2b')],members[_0x54492f][_0x54de('0x2c')]));if(members[_0x54492f][_0x54de('0x2e')]){writeDB(members[_0x54492f]);}}}if(_0x536a1d[_0x54de('0x2f')]){var _0x5794b8=_0x536a1d['destinationchannel']['split']('-')[0x0];if(!_[_0x54de('0x20')](members[_0x5794b8])){members[_0x5794b8]=_['assign'](members[_0x5794b8],{'data1':members[_0x5794b8][_0x54de('0x29')]||_0x536a1d[_0x54de('0x2a')],'data2':members[_0x5794b8]['data2']||_0x536a1d[_0x54de('0x30')],'data3':members[_0x5794b8][_0x54de('0x2c')]||_0x536a1d[_0x54de('0x31')],'uniqueid':members[_0x5794b8][_0x54de('0x6')]||_0x536a1d['uniqueid']});utils[_0x54de('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x536a1d['uniqueid'],members[_0x5794b8][_0x54de('0x29')],members[_0x5794b8]['data2'],members[_0x5794b8][_0x54de('0x2c')]));if(members[_0x5794b8][_0x54de('0x2e')]){writeDB(members[_0x5794b8]);}}}}catch(_0x429de6){utils[_0x54de('0x13')](util[_0x54de('0x4')](_0x54de('0x32'),_0x536a1d[_0x54de('0x6')]),_0x429de6);}}; \ No newline at end of file +var _0x37b4=['[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','data2','type','getUserByInterface','then','name','internal','request','interface','split','CreateMemberReport','catch','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','channel','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','error','lodash','./utils','Local/_attended@transfer','Queue:','info','format'];(function(_0x22e751,_0x401a18){var _0x12db93=function(_0x5567f3){while(--_0x5567f3){_0x22e751['push'](_0x22e751['shift']());}};_0x12db93(++_0x401a18);}(_0x37b4,0xef));var _0x437b=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0x37b4[_0x3eb713];return _0x1d7128;};'use strict';var _=require(_0x437b('0x0'));var util=require('util');var utils=require(_0x437b('0x1'));var members={};var exclude=[_0x437b('0x2'),_0x437b('0x3')];function writeDB(_0x5bc1e3){utils[_0x437b('0x4')](util[_0x437b('0x5')](_0x437b('0x6'),_0x5bc1e3[_0x437b('0x7')],_0x5bc1e3['interface'],_0x5bc1e3['channel'],_0x5bc1e3[_0x437b('0x8')],_0x5bc1e3['membername'],_0x5bc1e3[_0x437b('0x9')]));if(_0x5bc1e3['interface']){utils[_0x437b('0xa')](_0x5bc1e3['interface'])[_0x437b('0xb')](function(_0x4eda92){if(_0x4eda92){_0x5bc1e3['membername']=_0x4eda92[_0x437b('0xc')];_0x5bc1e3[_0x437b('0xd')]=_0x4eda92['internal'];utils[_0x437b('0xe')]('CreateMemberReport',_0x5bc1e3);}else{utils['getUserByName'](_0x5bc1e3[_0x437b('0xf')][_0x437b('0x10')]('/')[0x1])[_0x437b('0xb')](function(_0x11e13c){if(_0x11e13c){_0x5bc1e3['membername']=_0x11e13c[_0x437b('0xc')];_0x5bc1e3[_0x437b('0xd')]=_0x11e13c[_0x437b('0xd')];utils['request'](_0x437b('0x11'),_0x5bc1e3);}});}})[_0x437b('0x12')](function(_0x42bcf9){utils['error'](util[_0x437b('0x5')]('[%s][members][writeDB]',_0x5bc1e3[_0x437b('0x7')]),_0x42bcf9);});}delete members[_0x5bc1e3[_0x437b('0xf')]];}function startsWith(_0x3cea79,_0x5f328b){return _[_0x437b('0x13')](_0x3cea79,function(_0x159076){return _[_0x437b('0x14')](_0x5f328b,_0x159076);});}exports[_0x437b('0x15')]=function(_0x1d31af){try{utils[_0x437b('0x16')](util['format'](_0x437b('0x17'),members[_0x1d31af['device']]?members[_0x1d31af[_0x437b('0x18')]][_0x437b('0x7')]:_0x1d31af[_0x437b('0x18')]),_0x1d31af);utils[_0x437b('0x4')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x1d31af['device']]?members[_0x1d31af['device']][_0x437b('0x7')]:_0x1d31af[_0x437b('0x18')],_0x1d31af['state'],_0x1d31af[_0x437b('0x18')]));switch(_0x1d31af['state']){case _0x437b('0x19'):case _0x437b('0x1a'):if(!startsWith(exclude,_0x1d31af[_0x437b('0x18')])){members[_0x1d31af['device']]={'channel':'voice','interface':_0x1d31af['device'],'type':_0x437b('0x1b'),'enterAt':utils[_0x437b('0x1c')](),'role':_0x437b('0x1d')};}break;case _0x437b('0x1e'):if(!_[_0x437b('0x1f')](members[_0x1d31af[_0x437b('0x18')]])){members[_0x1d31af[_0x437b('0x18')]][_0x437b('0x20')]=utils[_0x437b('0x1c')]();members[_0x1d31af[_0x437b('0x18')]][_0x437b('0x21')]=utils['diffTime'](members[_0x1d31af[_0x437b('0x18')]][_0x437b('0x20')],members[_0x1d31af[_0x437b('0x18')]][_0x437b('0x22')]);if(members[_0x1d31af[_0x437b('0x18')]]['uniqueid']){writeDB(members[_0x1d31af[_0x437b('0x18')]]);}}break;default:break;}}catch(_0x2dbeb6){utils['error'](util[_0x437b('0x5')]('[%s][members][devicestatechange]',members[_0x1d31af['device']]?members[_0x1d31af['device']][_0x437b('0x7')]:_0x1d31af['device']),_0x2dbeb6);}};exports[_0x437b('0x23')]=function(_0x10b01f){try{if(!_[_0x437b('0x1f')](members[_0x10b01f['interface']])){utils['debug'](util[_0x437b('0x5')](_0x437b('0x24'),_0x10b01f[_0x437b('0x7')]),_0x10b01f);utils[_0x437b('0x4')](util[_0x437b('0x5')](_0x437b('0x25'),_0x10b01f[_0x437b('0x7')],_0x10b01f[_0x437b('0xf')],_0x10b01f[_0x437b('0x26')]));members[_0x10b01f[_0x437b('0xf')]]=_[_0x437b('0x27')](members[_0x10b01f['interface']],{'data4':_0x10b01f[_0x437b('0x26')],'uniqueid':_0x10b01f[_0x437b('0x7')]});}}catch(_0x156773){utils['error'](util[_0x437b('0x5')](_0x437b('0x24'),_0x10b01f[_0x437b('0x7')]),_0x156773);}};exports['cdr']=function(_0x43015d){try{utils['debug'](util[_0x437b('0x5')](_0x437b('0x28'),_0x43015d[_0x437b('0x7')]),_0x43015d);if(_0x43015d[_0x437b('0x29')]){var _0x385a1d=_0x43015d[_0x437b('0x29')]['split']('-')[0x0];if(!_[_0x437b('0x1f')](members[_0x385a1d])){members[_0x385a1d]=_[_0x437b('0x27')](members[_0x385a1d],{'data1':members[_0x385a1d][_0x437b('0x2a')]||_0x43015d[_0x437b('0x9')],'data2':members[_0x385a1d][_0x437b('0x8')]||_0x43015d[_0x437b('0x2b')],'data3':members[_0x385a1d][_0x437b('0x2c')]||_0x43015d[_0x437b('0x2d')],'uniqueid':members[_0x385a1d][_0x437b('0x7')]||_0x43015d[_0x437b('0x7')]});utils[_0x437b('0x4')](util['format'](_0x437b('0x2e'),_0x43015d['uniqueid'],members[_0x385a1d][_0x437b('0x2a')],members[_0x385a1d]['data2'],members[_0x385a1d]['data3']));if(members[_0x385a1d][_0x437b('0x20')]){writeDB(members[_0x385a1d]);}}}if(_0x43015d[_0x437b('0x2f')]){var _0x3c1615=_0x43015d[_0x437b('0x2f')]['split']('-')[0x0];if(!_[_0x437b('0x1f')](members[_0x3c1615])){members[_0x3c1615]=_[_0x437b('0x27')](members[_0x3c1615],{'data1':members[_0x3c1615][_0x437b('0x2a')]||_0x43015d[_0x437b('0x9')],'data2':members[_0x3c1615]['data2']||_0x43015d['source'],'data3':members[_0x3c1615]['data3']||_0x43015d[_0x437b('0x2d')],'uniqueid':members[_0x3c1615][_0x437b('0x7')]||_0x43015d[_0x437b('0x7')]});utils[_0x437b('0x4')](util[_0x437b('0x5')](_0x437b('0x2e'),_0x43015d['uniqueid'],members[_0x3c1615][_0x437b('0x2a')],members[_0x3c1615][_0x437b('0x8')],members[_0x3c1615][_0x437b('0x2c')]));if(members[_0x3c1615]['exitAt']){writeDB(members[_0x3c1615]);}}}}catch(_0x34aee7){utils[_0x437b('0x30')](util['format']('[%s][members][cdr]',_0x43015d['uniqueid']),_0x34aee7);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2de5b08..573ac71 100644 --- a/server/services/xdr/queues.controller.js +++ b/server/services/xdr/queues.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf568=['queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','value','toUpperCase','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','queuecallercompleteAt','transfer','reason','[%s][queues][agentcomplete]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','mohtime','lodash','util','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon'];(function(_0x451976,_0x41e3fc){var _0x4b4a2e=function(_0x151c0e){while(--_0x151c0e){_0x451976['push'](_0x451976['shift']());}};_0x4b4a2e(++_0x41e3fc);}(_0xf568,0x116));var _0x8f56=function(_0x5cdea1,_0x19acc8){_0x5cdea1=_0x5cdea1-0x0;var _0x1f1aec=_0xf568[_0x5cdea1];return _0x1f1aec;};'use strict';var _=require(_0x8f56('0x0'));var util=require(_0x8f56('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x11e46b){utils['info'](util[_0x8f56('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x11e46b[_0x8f56('0x3')],_0x11e46b[_0x8f56('0x4')],_0x11e46b[_0x8f56('0x5')],_0x11e46b[_0x8f56('0x6')],_0x11e46b[_0x8f56('0x7')],_0x11e46b[_0x8f56('0x8')],_0x11e46b[_0x8f56('0x9')]));if(_0x11e46b[_0x8f56('0x5')]){utils['getVoiceQueueByName'](_0x11e46b[_0x8f56('0x5')])['then'](function(_0x30f3e1){if(_0x30f3e1){_0x11e46b[_0x8f56('0xa')]=_0x30f3e1['type'];}utils[_0x8f56('0xb')](_0x8f56('0xc'),_0x11e46b);});}else{utils['request'](_0x8f56('0xc'),_0x11e46b);}if(_0x11e46b[_0x8f56('0xd')]){delete queues[_0x11e46b[_0x8f56('0xd')]];}else{delete queues[_0x11e46b[_0x8f56('0x3')]];}}exports[_0x8f56('0xe')]=function(_0x37905b){try{utils[_0x8f56('0xf')](util[_0x8f56('0x2')](_0x8f56('0x10'),_0x37905b['uniqueid']),_0x37905b);utils['info'](util[_0x8f56('0x2')](_0x8f56('0x11'),_0x37905b[_0x8f56('0x3')],_0x37905b[_0x8f56('0x5')],_0x37905b[_0x8f56('0x12')]));queues[_0x37905b[_0x8f56('0x3')]]=_[_0x8f56('0x13')](_0x37905b,{'originalposition':_0x37905b['position'],'queuecallerjoinAt':utils[_0x8f56('0x14')](),'mohtime':0x0});}catch(_0x45afbe){utils[_0x8f56('0x15')](util[_0x8f56('0x2')](_0x8f56('0x10'),_0x37905b[_0x8f56('0x3')]),_0x45afbe);}};exports['hangup']=function(_0x57c643){try{if(!_['isNil'](queues[_0x57c643[_0x8f56('0x3')]])){utils[_0x8f56('0xf')](util[_0x8f56('0x2')](_0x8f56('0x16'),_0x57c643[_0x8f56('0x3')]),_0x57c643);if(queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0x17')]){if(!queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0x18')]&&!queues[_0x57c643['uniqueid']][_0x8f56('0x19')]){queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0x1a')]=!![];queues[_0x57c643[_0x8f56('0x3')]]['queuecallercompleteAt']=utils['now']();queues[_0x57c643['uniqueid']][_0x8f56('0x9')]=_0x8f56('0x1b');}utils[_0x8f56('0x1c')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x57c643[_0x8f56('0x3')],queues[_0x57c643[_0x8f56('0x3')]]['name'],queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0x9')]));writeDB(queues[_0x57c643['uniqueid']]);}else if(queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0xd')]){utils[_0x8f56('0x1c')](util['format'](_0x8f56('0x1d'),_0x57c643[_0x8f56('0x3')],queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0x1e')],queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0xd')]));queues[queues[_0x57c643['uniqueid']][_0x8f56('0xd')]]=queues[_0x57c643[_0x8f56('0x3')]];queues[queues[_0x57c643[_0x8f56('0x3')]]['transfereduniqueid']][_0x8f56('0x1f')]=0x2;delete queues[_0x57c643[_0x8f56('0x3')]];}}}catch(_0x238f28){utils['error'](util[_0x8f56('0x2')]('[%s][queues][hangup]',_0x57c643[_0x8f56('0x3')]),_0x238f28);}};exports[_0x8f56('0x20')]=function(_0x3afeb8){try{utils[_0x8f56('0xf')](util['format'](_0x8f56('0x21'),_0x3afeb8[_0x8f56('0x3')]),_0x3afeb8);if(!_[_0x8f56('0x22')](_0x3afeb8['variable']['queuestatus'])&&_0x3afeb8[_0x8f56('0x23')][_0x8f56('0x24')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x3afeb8[_0x8f56('0x3')]])){queues[_0x3afeb8[_0x8f56('0x3')]]['queuecallerabandon']=![];queues[_0x3afeb8['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3afeb8['uniqueid']]['queuecallerexit']=!![];queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x25')]=utils['now']();queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x9')]=_0x3afeb8[_0x8f56('0x23')]['toUpperCase']();utils[_0x8f56('0x1c')](util[_0x8f56('0x2')](_0x8f56('0x26'),_0x3afeb8[_0x8f56('0x3')],queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x1e')],_0x3afeb8[_0x8f56('0x23')],queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x9')]));writeDB(queues[_0x3afeb8['uniqueid']]);}}else if(!_['isNil'](_0x3afeb8[_0x8f56('0x27')][_0x8f56('0x28')])){if(!_[_0x8f56('0x22')](queues[_0x3afeb8[_0x8f56('0x3')]])&&!queues[_0x3afeb8['uniqueid']][_0x8f56('0x18')]){queues[_0x3afeb8[_0x8f56('0x3')]]['queuecallerabandon']=![];queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x29')]=null;queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x19')]=!![];queues[_0x3afeb8[_0x8f56('0x3')]]['queuecallerexitAt']=utils['now']();queues[_0x3afeb8['uniqueid']][_0x8f56('0x9')]=_0x8f56('0x2a');utils['info'](util[_0x8f56('0x2')](_0x8f56('0x2b'),_0x3afeb8[_0x8f56('0x3')],queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x1e')],_0x3afeb8[_0x8f56('0x23')],queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x9')]));}}}catch(_0x21696a){utils[_0x8f56('0x15')](util['format'](_0x8f56('0x21'),_0x3afeb8[_0x8f56('0x3')]),_0x21696a);}};exports[_0x8f56('0x18')]=function(_0x35a12){try{if(!_[_0x8f56('0x22')](queues[_0x35a12[_0x8f56('0x3')]])){utils[_0x8f56('0xf')](util['format'](_0x8f56('0x2c'),_0x35a12[_0x8f56('0x3')]),_0x35a12);queues[_0x35a12[_0x8f56('0x3')]][_0x8f56('0x19')]=![];queues[_0x35a12['uniqueid']][_0x8f56('0x25')]=null;queues[_0x35a12[_0x8f56('0x3')]][_0x8f56('0x18')]=!![];queues[_0x35a12[_0x8f56('0x3')]][_0x8f56('0x29')]=utils['now']();queues[_0x35a12['uniqueid']][_0x8f56('0x9')]=_0x8f56('0x2d');utils['info'](util[_0x8f56('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x35a12['uniqueid'],queues[_0x35a12[_0x8f56('0x3')]][_0x8f56('0x1e')],queues[_0x35a12[_0x8f56('0x3')]][_0x8f56('0x9')]));}}catch(_0x4b079b){utils[_0x8f56('0x15')](util['format'](_0x8f56('0x2c'),_0x35a12[_0x8f56('0x3')]),_0x4b079b);}};exports[_0x8f56('0x2e')]=function(_0x2c56a8){try{if(!_[_0x8f56('0x22')](queues[_0x2c56a8[_0x8f56('0x3')]])){utils[_0x8f56('0xf')](util['format'](_0x8f56('0x2f'),_0x2c56a8['uniqueid']),_0x2c56a8);utils[_0x8f56('0x1c')](util[_0x8f56('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2c56a8[_0x8f56('0x3')],queues[_0x2c56a8[_0x8f56('0x3')]][_0x8f56('0x1e')],_0x2c56a8[_0x8f56('0x30')],_0x2c56a8[_0x8f56('0x31')]));queues[_0x2c56a8[_0x8f56('0x3')]][_0x8f56('0x2e')]=!![];queues[_0x2c56a8[_0x8f56('0x3')]][_0x8f56('0x17')]=utils[_0x8f56('0x14')]();queues[_0x2c56a8[_0x8f56('0x3')]][_0x8f56('0x32')]=utils[_0x8f56('0x33')](queues[_0x2c56a8['uniqueid']]['queuecallerleaveAt'],queues[_0x2c56a8[_0x8f56('0x3')]]['queuecallerjoinAt']);queues[_0x2c56a8[_0x8f56('0x3')]][_0x8f56('0x12')]=_0x2c56a8['position'];queues[_0x2c56a8['uniqueid']][_0x8f56('0x34')]=_0x2c56a8[_0x8f56('0x34')];queues[_0x2c56a8['uniqueid']][_0x8f56('0x30')]=_0x2c56a8['connectedlinenum'];queues[_0x2c56a8[_0x8f56('0x3')]]['connectedlinename']=_0x2c56a8[_0x8f56('0x31')];}}catch(_0x13e326){utils['error'](util['format']('[%s][queues][queuecallerleave]',_0x2c56a8[_0x8f56('0x3')]),_0x13e326);}};exports[_0x8f56('0x35')]=function(_0x3a5226){try{if(!_['isNil'](queues[_0x3a5226['uniqueid']])){utils[_0x8f56('0xf')](util[_0x8f56('0x2')](_0x8f56('0x36'),_0x3a5226['uniqueid']),_0x3a5226);utils[_0x8f56('0x1c')](util['format'](_0x8f56('0x37'),_0x3a5226[_0x8f56('0x3')],queues[_0x3a5226['uniqueid']]['name'],_0x3a5226[_0x8f56('0x38')],_0x3a5226['destaccountcode']));queues[_0x3a5226['uniqueid']][_0x8f56('0x18')]=![];queues[_0x3a5226[_0x8f56('0x3')]][_0x8f56('0x18')]=![];queues[_0x3a5226[_0x8f56('0x3')]]['queuecallerabandonAt']=null;queues[_0x3a5226['uniqueid']][_0x8f56('0x19')]=![];queues[_0x3a5226[_0x8f56('0x3')]]['queuecallerexitreason']=null;queues[_0x3a5226[_0x8f56('0x3')]][_0x8f56('0x25')]=null;queues[_0x3a5226['uniqueid']][_0x8f56('0x39')]=!![];queues[_0x3a5226[_0x8f56('0x3')]][_0x8f56('0x8')]=_0x3a5226[_0x8f56('0x3a')];queues[_0x3a5226['uniqueid']][_0x8f56('0x6')]=_0x3a5226[_0x8f56('0x38')];}}catch(_0x89b460){utils[_0x8f56('0x15')](util[_0x8f56('0x2')]('[%s][queues][agentconnect]',_0x3a5226['uniqueid']),_0x89b460);}};exports[_0x8f56('0x3b')]=function(_0x518fa8){try{if(!_[_0x8f56('0x22')](queues[_0x518fa8['uniqueid']])){if(queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x17')]){utils['debug'](util[_0x8f56('0x2')]('[%s][queues][agentcomplete]',_0x518fa8['uniqueid']),_0x518fa8);queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x18')]=![];queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x18')]=![];queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x29')]=null;queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x19')]=![];queues[_0x518fa8[_0x8f56('0x3')]]['queuecallerexitAt']=null;queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x39')]=!![];queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x6')]=_0x518fa8[_0x8f56('0x38')];queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x1a')]=!![];queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x3c')]=utils['now']();if(_0x518fa8['reason']==_0x8f56('0x3d')){if(!queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x3d')]){queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x9')]='TRANSFER';}}else{queues[_0x518fa8[_0x8f56('0x3')]]['queuecallerexitreason']='COMPLETEDBY'+_0x518fa8[_0x8f56('0x3e')]['toUpperCase']();}utils['info'](util[_0x8f56('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x518fa8[_0x8f56('0x3')],queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x1e')],_0x518fa8[_0x8f56('0x38')],queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x9')]));writeDB(queues[_0x518fa8[_0x8f56('0x3')]]);}}}catch(_0x1e603a){utils[_0x8f56('0x15')](util[_0x8f56('0x2')](_0x8f56('0x3f'),_0x518fa8['uniqueid']),_0x1e603a);}};exports['blindtransfer']=function(_0x89e304){try{if(!_['isNil'](queues[_0x89e304[_0x8f56('0x40')]])){utils['debug'](util[_0x8f56('0x2')]('[%s][queues][blindtransfer]',_0x89e304[_0x8f56('0x3')]),_0x89e304);queues[_0x89e304[_0x8f56('0x40')]][_0x8f56('0x3d')]=!![];queues[_0x89e304[_0x8f56('0x40')]][_0x8f56('0x41')]=_0x8f56('0x42');queues[_0x89e304[_0x8f56('0x40')]][_0x8f56('0x43')]=_0x89e304[_0x8f56('0x44')];queues[_0x89e304[_0x8f56('0x40')]][_0x8f56('0x45')]=_0x89e304['transfereeuniqueid'];queues[_0x89e304[_0x8f56('0x40')]][_0x8f56('0x9')]=_0x8f56('0x46');utils[_0x8f56('0x1c')](util[_0x8f56('0x2')](_0x8f56('0x47'),_0x89e304['uniqueid'],queues[_0x89e304['transfereeuniqueid']]['name'],_0x89e304[_0x8f56('0x40')],_0x89e304['extension']));}}catch(_0x15b90a){utils['error'](util[_0x8f56('0x2')](_0x8f56('0x48'),_0x89e304[_0x8f56('0x3')]),_0x15b90a);}};exports[_0x8f56('0x49')]=function(_0x46a8fa){try{utils[_0x8f56('0xf')](util[_0x8f56('0x2')](_0x8f56('0x4a'),_0x46a8fa[_0x8f56('0x4b')]),_0x46a8fa);if(_0x46a8fa[_0x8f56('0x4b')]==_0x46a8fa[_0x8f56('0x4c')]){if(!_[_0x8f56('0x22')](queues[_0x46a8fa[_0x8f56('0x4d')]])){utils['info'](util[_0x8f56('0x2')](_0x8f56('0x4e'),_0x46a8fa[_0x8f56('0x4b')],queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x1e')],_0x46a8fa[_0x8f56('0x4f')]));queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x3d')]=!![];queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x41')]='ATTENDED';queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x43')]=_0x46a8fa[_0x8f56('0x4f')];queues[_0x46a8fa[_0x8f56('0x4d')]]['transferuniqueid']=_0x46a8fa[_0x8f56('0x4b')];queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x8f56('0x22')](queues[_0x46a8fa['origtransfererlinkedid']])){if(_0x46a8fa['transfereelinkedid']&&queues[_0x46a8fa[_0x8f56('0x50')]]){queues[_0x46a8fa[_0x8f56('0x50')]][_0x8f56('0x1f')]=0x1;queues[_0x46a8fa[_0x8f56('0x40')]]=_['clone'](queues[_0x46a8fa[_0x8f56('0x50')]]);queues[_0x46a8fa[_0x8f56('0x40')]]['transfereduniqueid']=_0x46a8fa[_0x8f56('0x51')];queues[_0x46a8fa['transfereeuniqueid']][_0x8f56('0x1f')]=0x2;queues[_0x46a8fa[_0x8f56('0x40')]][_0x8f56('0x7')]=queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x7')];queues[_0x46a8fa[_0x8f56('0x40')]][_0x8f56('0x52')]=queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x52')];queues[_0x46a8fa['transfereeuniqueid']][_0x8f56('0x53')]=utils[_0x8f56('0x14')]();queues[_0x46a8fa['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x8f56('0x14')]();queues[_0x46a8fa[_0x8f56('0x40')]]['holdtime']=0x0;queues[_0x46a8fa[_0x8f56('0x40')]]['mohtime']=0x0;utils[_0x8f56('0x1c')](util[_0x8f56('0x2')](_0x8f56('0x54'),_0x46a8fa[_0x8f56('0x4b')],queues[_0x46a8fa[_0x8f56('0x40')]]['name'],queues[_0x46a8fa[_0x8f56('0x40')]][_0x8f56('0x7')],queues[_0x46a8fa[_0x8f56('0x40')]][_0x8f56('0x52')]));}else{utils[_0x8f56('0x1c')](util[_0x8f56('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x46a8fa[_0x8f56('0x4b')],queues[_0x46a8fa[_0x8f56('0x4c')]]['name'],_0x46a8fa[_0x8f56('0x4d')]));queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0xd')]=_0x46a8fa[_0x8f56('0x4d')];}}}else if(_0x46a8fa[_0x8f56('0x55')]==_0x46a8fa[_0x8f56('0x4d')]){if(!_[_0x8f56('0x22')](queues[_0x46a8fa[_0x8f56('0x4c')]])){utils['info'](util[_0x8f56('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x46a8fa[_0x8f56('0x4b')],queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0x1e')],_0x46a8fa['secondtransfereruniqueid'],_0x46a8fa[_0x8f56('0x56')]));queues[_0x46a8fa[_0x8f56('0x4c')]]['transfer']=!![];queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0x41')]=_0x8f56('0x57');queues[_0x46a8fa['origtransfererlinkedid']][_0x8f56('0x43')]=_0x46a8fa[_0x8f56('0x56')];queues[_0x46a8fa[_0x8f56('0x4c')]]['transferuniqueid']=_0x46a8fa[_0x8f56('0x55')];queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0x9')]=_0x8f56('0x58');}if(!_[_0x8f56('0x22')](queues[_0x46a8fa[_0x8f56('0x4d')]])){if(_0x46a8fa[_0x8f56('0x59')]&&queues[_0x46a8fa[_0x8f56('0x59')]]){queues[_0x46a8fa[_0x8f56('0x59')]][_0x8f56('0x1f')]=0x1;queues[_0x46a8fa[_0x8f56('0x51')]]=_[_0x8f56('0x5a')](queues[_0x46a8fa[_0x8f56('0x59')]]);queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0xd')]=_0x46a8fa[_0x8f56('0x51')];queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x1f')]=0x2;queues[_0x46a8fa[_0x8f56('0x51')]]['calleridnum']=queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0x7')];queues[_0x46a8fa['transfertargetuniqueid']][_0x8f56('0x52')]=queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0x52')];queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x53')]=utils[_0x8f56('0x14')]();queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x17')]=utils['now']();queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x32')]=0x0;queues[_0x46a8fa[_0x8f56('0x51')]]['mohtime']=0x0;utils[_0x8f56('0x1c')](util['format'](_0x8f56('0x5b'),_0x46a8fa[_0x8f56('0x4b')],queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x1e')],queues[_0x46a8fa[_0x8f56('0x51')]]['transfereduniqueid'],queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x7')],queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x52')]));}else{utils[_0x8f56('0x1c')](util[_0x8f56('0x2')](_0x8f56('0x5c'),_0x46a8fa['origtransfereruniqueid'],queues[_0x46a8fa[_0x8f56('0x4d')]]['name'],_0x46a8fa[_0x8f56('0x4c')]));queues[_0x46a8fa['secondtransfererlinkedid']][_0x8f56('0xd')]=_0x46a8fa['origtransfererlinkedid'];}}}}catch(_0x132a14){utils[_0x8f56('0x15')](util[_0x8f56('0x2')](_0x8f56('0x4a'),_0x46a8fa[_0x8f56('0x4b')]),_0x132a14);}};exports[_0x8f56('0x5d')]=function(_0x32eed0){try{if(!_[_0x8f56('0x22')](queues[_0x32eed0[_0x8f56('0x3')]])){utils['debug'](util['format'](_0x8f56('0x5e'),_0x32eed0[_0x8f56('0x3')]),_0x32eed0);queues[_0x32eed0['uniqueid']]['musiconholdstartAt']=utils[_0x8f56('0x14')]();utils['info'](util['format'](_0x8f56('0x5f'),_0x32eed0[_0x8f56('0x3')],queues[_0x32eed0[_0x8f56('0x3')]][_0x8f56('0x1e')],queues[_0x32eed0[_0x8f56('0x3')]]['musiconholdstartAt']));}}catch(_0x28781e){utils['error'](util[_0x8f56('0x2')]('[%s][queues][musiconholdstart]',_0x32eed0[_0x8f56('0x3')]),_0x28781e);}};exports[_0x8f56('0x60')]=function(_0x41edac){try{if(!_[_0x8f56('0x22')](queues[_0x41edac[_0x8f56('0x3')]])){if(!_['isNil'](queues[_0x41edac['uniqueid']][_0x8f56('0x61')])){utils[_0x8f56('0xf')](util[_0x8f56('0x2')](_0x8f56('0x62'),_0x41edac[_0x8f56('0x3')]),_0x41edac);queues[_0x41edac[_0x8f56('0x3')]]['mohtime']+=utils['diffTime'](utils[_0x8f56('0x14')](),queues[_0x41edac['uniqueid']][_0x8f56('0x61')]);utils[_0x8f56('0x1c')](util['format'](_0x8f56('0x63'),_0x41edac[_0x8f56('0x3')],queues[_0x41edac[_0x8f56('0x3')]][_0x8f56('0x1e')],queues[_0x41edac[_0x8f56('0x3')]][_0x8f56('0x64')]));delete queues[_0x41edac[_0x8f56('0x3')]]['musiconholdstartAt'];}}}catch(_0x2499a5){utils[_0x8f56('0x15')](util['format'](_0x8f56('0x62'),_0x41edac[_0x8f56('0x3')]),_0x2499a5);}}; \ No newline at end of file +var _0xdb67=['mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','lastAssignedTo','accountcode','then','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','queuecallerabandonAt','queuecallerexitAt','value','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridnum','calleridname'];(function(_0x5de01f,_0x5a8eb7){var _0x50e509=function(_0x1e6e50){while(--_0x1e6e50){_0x5de01f['push'](_0x5de01f['shift']());}};_0x50e509(++_0x5a8eb7);}(_0xdb67,0x1a6));var _0x7db6=function(_0x1ff477,_0x189728){_0x1ff477=_0x1ff477-0x0;var _0x3dac5d=_0xdb67[_0x1ff477];return _0x3dac5d;};'use strict';var _=require(_0x7db6('0x0'));var util=require(_0x7db6('0x1'));var utils=require(_0x7db6('0x2'));var queues={};function writeDB(_0x12bcac){utils[_0x7db6('0x3')](util[_0x7db6('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x12bcac['uniqueid'],_0x12bcac['channel'],_0x12bcac['queue'],_0x12bcac[_0x7db6('0x5')],_0x12bcac['calleridnum'],_0x12bcac[_0x7db6('0x6')],_0x12bcac['queuecallerexitreason']));if(_0x12bcac['queue']){utils['getVoiceQueueByName'](_0x12bcac['queue'])[_0x7db6('0x7')](function(_0x27da78){if(_0x27da78){_0x12bcac['type']=_0x27da78['type'];}utils[_0x7db6('0x8')](_0x7db6('0x9'),_0x12bcac);});}else{utils[_0x7db6('0x8')](_0x7db6('0x9'),_0x12bcac);}if(_0x12bcac[_0x7db6('0xa')]){delete queues[_0x12bcac[_0x7db6('0xa')]];}else{delete queues[_0x12bcac[_0x7db6('0xb')]];}}exports[_0x7db6('0xc')]=function(_0x25da94){try{utils[_0x7db6('0xd')](util[_0x7db6('0x4')](_0x7db6('0xe'),_0x25da94[_0x7db6('0xb')]),_0x25da94);utils[_0x7db6('0x3')](util[_0x7db6('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x25da94[_0x7db6('0xb')],_0x25da94['queue'],_0x25da94[_0x7db6('0xf')]));queues[_0x25da94[_0x7db6('0xb')]]=_[_0x7db6('0x10')](_0x25da94,{'originalposition':_0x25da94[_0x7db6('0xf')],'queuecallerjoinAt':utils[_0x7db6('0x11')](),'mohtime':0x0});}catch(_0x45710a){utils[_0x7db6('0x12')](util[_0x7db6('0x4')](_0x7db6('0xe'),_0x25da94['uniqueid']),_0x45710a);}};exports[_0x7db6('0x13')]=function(_0x48be1e){try{if(!_[_0x7db6('0x14')](queues[_0x48be1e['uniqueid']])){utils[_0x7db6('0xd')](util[_0x7db6('0x4')](_0x7db6('0x15'),_0x48be1e[_0x7db6('0xb')]),_0x48be1e);if(queues[_0x48be1e[_0x7db6('0xb')]]['queuecallerleaveAt']){if(!queues[_0x48be1e[_0x7db6('0xb')]][_0x7db6('0x16')]&&!queues[_0x48be1e[_0x7db6('0xb')]][_0x7db6('0x17')]){queues[_0x48be1e['uniqueid']][_0x7db6('0x18')]=!![];queues[_0x48be1e[_0x7db6('0xb')]][_0x7db6('0x19')]=utils[_0x7db6('0x11')]();queues[_0x48be1e[_0x7db6('0xb')]][_0x7db6('0x1a')]=_0x7db6('0x1b');}utils[_0x7db6('0x3')](util[_0x7db6('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x48be1e[_0x7db6('0xb')],queues[_0x48be1e[_0x7db6('0xb')]][_0x7db6('0x1c')],queues[_0x48be1e['uniqueid']][_0x7db6('0x1a')]));writeDB(queues[_0x48be1e[_0x7db6('0xb')]]);}else if(queues[_0x48be1e[_0x7db6('0xb')]]['transfereduniqueid']){utils[_0x7db6('0x3')](util[_0x7db6('0x4')](_0x7db6('0x1d'),_0x48be1e[_0x7db6('0xb')],queues[_0x48be1e[_0x7db6('0xb')]][_0x7db6('0x1c')],queues[_0x48be1e[_0x7db6('0xb')]][_0x7db6('0xa')]));queues[queues[_0x48be1e[_0x7db6('0xb')]][_0x7db6('0xa')]]=queues[_0x48be1e[_0x7db6('0xb')]];queues[queues[_0x48be1e[_0x7db6('0xb')]]['transfereduniqueid']][_0x7db6('0x1e')]=0x2;delete queues[_0x48be1e[_0x7db6('0xb')]];}}}catch(_0x3ee509){utils[_0x7db6('0x12')](util['format'](_0x7db6('0x15'),_0x48be1e[_0x7db6('0xb')]),_0x3ee509);}};exports[_0x7db6('0x1f')]=function(_0x4ccf61){try{utils['debug'](util['format'](_0x7db6('0x20'),_0x4ccf61['uniqueid']),_0x4ccf61);if(!_[_0x7db6('0x14')](_0x4ccf61['variable'][_0x7db6('0x21')])&&_0x4ccf61['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0x7db6('0x14')](queues[_0x4ccf61['uniqueid']])){queues[_0x4ccf61['uniqueid']][_0x7db6('0x16')]=![];queues[_0x4ccf61[_0x7db6('0xb')]][_0x7db6('0x22')]=null;queues[_0x4ccf61[_0x7db6('0xb')]]['queuecallerexit']=!![];queues[_0x4ccf61[_0x7db6('0xb')]][_0x7db6('0x23')]=utils[_0x7db6('0x11')]();queues[_0x4ccf61[_0x7db6('0xb')]][_0x7db6('0x1a')]=_0x4ccf61[_0x7db6('0x24')]['toUpperCase']();utils[_0x7db6('0x3')](util[_0x7db6('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4ccf61['uniqueid'],queues[_0x4ccf61[_0x7db6('0xb')]][_0x7db6('0x1c')],_0x4ccf61['value'],queues[_0x4ccf61[_0x7db6('0xb')]]['queuecallerexitreason']));writeDB(queues[_0x4ccf61[_0x7db6('0xb')]]);}}else if(!_[_0x7db6('0x14')](_0x4ccf61[_0x7db6('0x25')][_0x7db6('0x26')])){if(!_['isNil'](queues[_0x4ccf61[_0x7db6('0xb')]])&&!queues[_0x4ccf61[_0x7db6('0xb')]][_0x7db6('0x16')]){queues[_0x4ccf61[_0x7db6('0xb')]]['queuecallerabandon']=![];queues[_0x4ccf61[_0x7db6('0xb')]][_0x7db6('0x22')]=null;queues[_0x4ccf61[_0x7db6('0xb')]][_0x7db6('0x17')]=!![];queues[_0x4ccf61[_0x7db6('0xb')]]['queuecallerexitAt']=utils['now']();queues[_0x4ccf61[_0x7db6('0xb')]][_0x7db6('0x1a')]=_0x7db6('0x27');utils['info'](util[_0x7db6('0x4')](_0x7db6('0x28'),_0x4ccf61[_0x7db6('0xb')],queues[_0x4ccf61[_0x7db6('0xb')]]['name'],_0x4ccf61['value'],queues[_0x4ccf61[_0x7db6('0xb')]][_0x7db6('0x1a')]));}}}catch(_0x3e3458){utils[_0x7db6('0x12')](util[_0x7db6('0x4')](_0x7db6('0x20'),_0x4ccf61[_0x7db6('0xb')]),_0x3e3458);}};exports[_0x7db6('0x16')]=function(_0x8c25b2){try{if(!_[_0x7db6('0x14')](queues[_0x8c25b2['uniqueid']])){utils[_0x7db6('0xd')](util[_0x7db6('0x4')](_0x7db6('0x29'),_0x8c25b2[_0x7db6('0xb')]),_0x8c25b2);queues[_0x8c25b2['uniqueid']]['queuecallerexit']=![];queues[_0x8c25b2[_0x7db6('0xb')]]['queuecallerexitAt']=null;queues[_0x8c25b2[_0x7db6('0xb')]]['queuecallerabandon']=!![];queues[_0x8c25b2['uniqueid']][_0x7db6('0x22')]=utils['now']();queues[_0x8c25b2[_0x7db6('0xb')]][_0x7db6('0x1a')]=_0x7db6('0x2a');utils[_0x7db6('0x3')](util[_0x7db6('0x4')](_0x7db6('0x2b'),_0x8c25b2[_0x7db6('0xb')],queues[_0x8c25b2[_0x7db6('0xb')]]['name'],queues[_0x8c25b2[_0x7db6('0xb')]][_0x7db6('0x1a')]));}}catch(_0x2b5fc6){utils[_0x7db6('0x12')](util[_0x7db6('0x4')](_0x7db6('0x29'),_0x8c25b2[_0x7db6('0xb')]),_0x2b5fc6);}};exports[_0x7db6('0x2c')]=function(_0x457b0d){try{if(!_['isNil'](queues[_0x457b0d[_0x7db6('0xb')]])){utils[_0x7db6('0xd')](util[_0x7db6('0x4')]('[%s][queues][queuecallerleave]',_0x457b0d[_0x7db6('0xb')]),_0x457b0d);utils['info'](util[_0x7db6('0x4')](_0x7db6('0x2d'),_0x457b0d[_0x7db6('0xb')],queues[_0x457b0d[_0x7db6('0xb')]]['name'],_0x457b0d[_0x7db6('0x2e')],_0x457b0d[_0x7db6('0x2f')]));queues[_0x457b0d[_0x7db6('0xb')]][_0x7db6('0x2c')]=!![];queues[_0x457b0d[_0x7db6('0xb')]][_0x7db6('0x30')]=utils[_0x7db6('0x11')]();queues[_0x457b0d[_0x7db6('0xb')]][_0x7db6('0x31')]=utils[_0x7db6('0x32')](queues[_0x457b0d[_0x7db6('0xb')]][_0x7db6('0x30')],queues[_0x457b0d[_0x7db6('0xb')]][_0x7db6('0x33')]);queues[_0x457b0d['uniqueid']]['position']=_0x457b0d[_0x7db6('0xf')];queues[_0x457b0d[_0x7db6('0xb')]]['count']=_0x457b0d[_0x7db6('0x34')];queues[_0x457b0d[_0x7db6('0xb')]][_0x7db6('0x2e')]=_0x457b0d[_0x7db6('0x2e')];queues[_0x457b0d['uniqueid']][_0x7db6('0x2f')]=_0x457b0d['connectedlinename'];}}catch(_0x4202c0){utils['error'](util['format'](_0x7db6('0x35'),_0x457b0d['uniqueid']),_0x4202c0);}};exports[_0x7db6('0x36')]=function(_0x29177b){try{if(!_['isNil'](queues[_0x29177b[_0x7db6('0xb')]])){utils[_0x7db6('0xd')](util['format'](_0x7db6('0x37'),_0x29177b[_0x7db6('0xb')]),_0x29177b);utils[_0x7db6('0x3')](util[_0x7db6('0x4')](_0x7db6('0x38'),_0x29177b[_0x7db6('0xb')],queues[_0x29177b[_0x7db6('0xb')]][_0x7db6('0x1c')],_0x29177b[_0x7db6('0x39')],_0x29177b[_0x7db6('0x3a')]));queues[_0x29177b[_0x7db6('0xb')]][_0x7db6('0x16')]=![];queues[_0x29177b['uniqueid']][_0x7db6('0x16')]=![];queues[_0x29177b[_0x7db6('0xb')]][_0x7db6('0x22')]=null;queues[_0x29177b['uniqueid']]['queuecallerexit']=![];queues[_0x29177b['uniqueid']][_0x7db6('0x1a')]=null;queues[_0x29177b[_0x7db6('0xb')]]['queuecallerexitAt']=null;queues[_0x29177b[_0x7db6('0xb')]][_0x7db6('0x3b')]=!![];queues[_0x29177b[_0x7db6('0xb')]][_0x7db6('0x6')]=_0x29177b['destaccountcode'];queues[_0x29177b[_0x7db6('0xb')]]['lastAssignedTo']=_0x29177b['membername'];}}catch(_0x172087){utils['error'](util[_0x7db6('0x4')]('[%s][queues][agentconnect]',_0x29177b[_0x7db6('0xb')]),_0x172087);}};exports[_0x7db6('0x3c')]=function(_0x41265d){try{if(!_[_0x7db6('0x14')](queues[_0x41265d[_0x7db6('0xb')]])){if(queues[_0x41265d['uniqueid']][_0x7db6('0x30')]){utils[_0x7db6('0xd')](util[_0x7db6('0x4')](_0x7db6('0x3d'),_0x41265d['uniqueid']),_0x41265d);queues[_0x41265d[_0x7db6('0xb')]][_0x7db6('0x16')]=![];queues[_0x41265d['uniqueid']][_0x7db6('0x16')]=![];queues[_0x41265d['uniqueid']][_0x7db6('0x22')]=null;queues[_0x41265d[_0x7db6('0xb')]][_0x7db6('0x17')]=![];queues[_0x41265d[_0x7db6('0xb')]][_0x7db6('0x23')]=null;queues[_0x41265d[_0x7db6('0xb')]][_0x7db6('0x3b')]=!![];queues[_0x41265d[_0x7db6('0xb')]][_0x7db6('0x5')]=_0x41265d[_0x7db6('0x39')];queues[_0x41265d['uniqueid']]['queuecallercomplete']=!![];queues[_0x41265d[_0x7db6('0xb')]][_0x7db6('0x19')]=utils[_0x7db6('0x11')]();if(_0x41265d[_0x7db6('0x3e')]==_0x7db6('0x3f')){if(!queues[_0x41265d['uniqueid']][_0x7db6('0x3f')]){queues[_0x41265d[_0x7db6('0xb')]]['queuecallerexitreason']=_0x7db6('0x40');}}else{queues[_0x41265d[_0x7db6('0xb')]][_0x7db6('0x1a')]=_0x7db6('0x41')+_0x41265d[_0x7db6('0x3e')][_0x7db6('0x42')]();}utils[_0x7db6('0x3')](util[_0x7db6('0x4')](_0x7db6('0x43'),_0x41265d[_0x7db6('0xb')],queues[_0x41265d[_0x7db6('0xb')]][_0x7db6('0x1c')],_0x41265d['membername'],queues[_0x41265d[_0x7db6('0xb')]][_0x7db6('0x1a')]));writeDB(queues[_0x41265d[_0x7db6('0xb')]]);}}}catch(_0x586212){utils[_0x7db6('0x12')](util[_0x7db6('0x4')](_0x7db6('0x3d'),_0x41265d[_0x7db6('0xb')]),_0x586212);}};exports[_0x7db6('0x44')]=function(_0x142faa){try{if(!_[_0x7db6('0x14')](queues[_0x142faa[_0x7db6('0x45')]])){utils[_0x7db6('0xd')](util[_0x7db6('0x4')](_0x7db6('0x46'),_0x142faa['uniqueid']),_0x142faa);queues[_0x142faa[_0x7db6('0x45')]]['transfer']=!![];queues[_0x142faa[_0x7db6('0x45')]][_0x7db6('0x47')]='BLIND';queues[_0x142faa[_0x7db6('0x45')]][_0x7db6('0x48')]=_0x142faa[_0x7db6('0x49')];queues[_0x142faa[_0x7db6('0x45')]][_0x7db6('0x4a')]=_0x142faa[_0x7db6('0x45')];queues[_0x142faa[_0x7db6('0x45')]][_0x7db6('0x1a')]=_0x7db6('0x4b');utils[_0x7db6('0x3')](util[_0x7db6('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x142faa[_0x7db6('0xb')],queues[_0x142faa[_0x7db6('0x45')]][_0x7db6('0x1c')],_0x142faa[_0x7db6('0x45')],_0x142faa[_0x7db6('0x49')]));}}catch(_0x37252a){utils[_0x7db6('0x12')](util['format'](_0x7db6('0x46'),_0x142faa[_0x7db6('0xb')]),_0x37252a);}};exports['attendedtransfer']=function(_0x3639d7){try{utils['debug'](util['format'](_0x7db6('0x4c'),_0x3639d7[_0x7db6('0x4d')]),_0x3639d7);if(_0x3639d7[_0x7db6('0x4d')]==_0x3639d7[_0x7db6('0x4e')]){if(!_[_0x7db6('0x14')](queues[_0x3639d7[_0x7db6('0x4f')]])){utils['info'](util[_0x7db6('0x4')](_0x7db6('0x50'),_0x3639d7[_0x7db6('0x4d')],queues[_0x3639d7['secondtransfererlinkedid']]['name'],_0x3639d7['origtransfererexten']));queues[_0x3639d7[_0x7db6('0x4f')]][_0x7db6('0x3f')]=!![];queues[_0x3639d7[_0x7db6('0x4f')]][_0x7db6('0x47')]=_0x7db6('0x51');queues[_0x3639d7[_0x7db6('0x4f')]][_0x7db6('0x48')]=_0x3639d7[_0x7db6('0x52')];queues[_0x3639d7[_0x7db6('0x4f')]][_0x7db6('0x4a')]=_0x3639d7[_0x7db6('0x4d')];queues[_0x3639d7[_0x7db6('0x4f')]][_0x7db6('0x1a')]=_0x7db6('0x53');}if(!_[_0x7db6('0x14')](queues[_0x3639d7[_0x7db6('0x4e')]])){if(_0x3639d7[_0x7db6('0x54')]&&queues[_0x3639d7[_0x7db6('0x54')]]){queues[_0x3639d7[_0x7db6('0x54')]][_0x7db6('0x1e')]=0x1;queues[_0x3639d7['transfereeuniqueid']]=_[_0x7db6('0x55')](queues[_0x3639d7[_0x7db6('0x54')]]);queues[_0x3639d7['transfereeuniqueid']][_0x7db6('0xa')]=_0x3639d7['transfertargetuniqueid'];queues[_0x3639d7['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3639d7[_0x7db6('0x45')]][_0x7db6('0x56')]=queues[_0x3639d7[_0x7db6('0x4f')]][_0x7db6('0x56')];queues[_0x3639d7[_0x7db6('0x45')]][_0x7db6('0x57')]=queues[_0x3639d7[_0x7db6('0x4f')]][_0x7db6('0x57')];queues[_0x3639d7['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0x7db6('0x11')]();queues[_0x3639d7['transfereeuniqueid']][_0x7db6('0x30')]=utils[_0x7db6('0x11')]();queues[_0x3639d7[_0x7db6('0x45')]][_0x7db6('0x31')]=0x0;queues[_0x3639d7[_0x7db6('0x45')]][_0x7db6('0x58')]=0x0;utils[_0x7db6('0x3')](util[_0x7db6('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3639d7['origtransfereruniqueid'],queues[_0x3639d7[_0x7db6('0x45')]]['name'],queues[_0x3639d7[_0x7db6('0x45')]][_0x7db6('0x56')],queues[_0x3639d7['transfereeuniqueid']][_0x7db6('0x57')]));}else{utils['info'](util[_0x7db6('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3639d7['origtransfereruniqueid'],queues[_0x3639d7[_0x7db6('0x4e')]]['name'],_0x3639d7[_0x7db6('0x4f')]));queues[_0x3639d7[_0x7db6('0x4e')]][_0x7db6('0xa')]=_0x3639d7[_0x7db6('0x4f')];}}}else if(_0x3639d7[_0x7db6('0x59')]==_0x3639d7[_0x7db6('0x4f')]){if(!_[_0x7db6('0x14')](queues[_0x3639d7[_0x7db6('0x4e')]])){utils['info'](util['format'](_0x7db6('0x5a'),_0x3639d7[_0x7db6('0x4d')],queues[_0x3639d7['origtransfererlinkedid']][_0x7db6('0x1c')],_0x3639d7[_0x7db6('0x59')],_0x3639d7[_0x7db6('0x5b')]));queues[_0x3639d7[_0x7db6('0x4e')]][_0x7db6('0x3f')]=!![];queues[_0x3639d7[_0x7db6('0x4e')]][_0x7db6('0x47')]=_0x7db6('0x51');queues[_0x3639d7[_0x7db6('0x4e')]][_0x7db6('0x48')]=_0x3639d7[_0x7db6('0x5b')];queues[_0x3639d7[_0x7db6('0x4e')]][_0x7db6('0x4a')]=_0x3639d7[_0x7db6('0x59')];queues[_0x3639d7[_0x7db6('0x4e')]][_0x7db6('0x1a')]='ATTENDEDTRANSFER';}if(!_[_0x7db6('0x14')](queues[_0x3639d7[_0x7db6('0x4f')]])){if(_0x3639d7[_0x7db6('0x5c')]&&queues[_0x3639d7[_0x7db6('0x5c')]]){queues[_0x3639d7['transfertargetlinkedid']][_0x7db6('0x1e')]=0x1;queues[_0x3639d7[_0x7db6('0x5d')]]=_['clone'](queues[_0x3639d7[_0x7db6('0x5c')]]);queues[_0x3639d7['transfertargetuniqueid']][_0x7db6('0xa')]=_0x3639d7[_0x7db6('0x5d')];queues[_0x3639d7[_0x7db6('0x5d')]][_0x7db6('0x1e')]=0x2;queues[_0x3639d7['transfertargetuniqueid']][_0x7db6('0x56')]=queues[_0x3639d7[_0x7db6('0x4e')]][_0x7db6('0x56')];queues[_0x3639d7[_0x7db6('0x5d')]][_0x7db6('0x57')]=queues[_0x3639d7['origtransfererlinkedid']]['calleridname'];queues[_0x3639d7['transfertargetuniqueid']][_0x7db6('0x33')]=utils['now']();queues[_0x3639d7[_0x7db6('0x5d')]][_0x7db6('0x30')]=utils[_0x7db6('0x11')]();queues[_0x3639d7[_0x7db6('0x5d')]][_0x7db6('0x31')]=0x0;queues[_0x3639d7[_0x7db6('0x5d')]][_0x7db6('0x58')]=0x0;utils[_0x7db6('0x3')](util[_0x7db6('0x4')](_0x7db6('0x5e'),_0x3639d7['origtransfereruniqueid'],queues[_0x3639d7[_0x7db6('0x5d')]][_0x7db6('0x1c')],queues[_0x3639d7[_0x7db6('0x5d')]][_0x7db6('0xa')],queues[_0x3639d7['transfertargetuniqueid']]['calleridnum'],queues[_0x3639d7[_0x7db6('0x5d')]][_0x7db6('0x57')]));}else{utils[_0x7db6('0x3')](util[_0x7db6('0x4')](_0x7db6('0x5f'),_0x3639d7[_0x7db6('0x4d')],queues[_0x3639d7['secondtransfererlinkedid']]['name'],_0x3639d7['origtransfererlinkedid']));queues[_0x3639d7[_0x7db6('0x4f')]][_0x7db6('0xa')]=_0x3639d7[_0x7db6('0x4e')];}}}}catch(_0xd8744b){utils['error'](util[_0x7db6('0x4')]('[%s][queues][attendedtransfer]',_0x3639d7['origtransfereruniqueid']),_0xd8744b);}};exports['musiconholdstart']=function(_0x467bf4){try{if(!_['isNil'](queues[_0x467bf4['uniqueid']])){utils[_0x7db6('0xd')](util['format'](_0x7db6('0x60'),_0x467bf4[_0x7db6('0xb')]),_0x467bf4);queues[_0x467bf4[_0x7db6('0xb')]]['musiconholdstartAt']=utils[_0x7db6('0x11')]();utils[_0x7db6('0x3')](util['format'](_0x7db6('0x61'),_0x467bf4['uniqueid'],queues[_0x467bf4[_0x7db6('0xb')]][_0x7db6('0x1c')],queues[_0x467bf4[_0x7db6('0xb')]][_0x7db6('0x62')]));}}catch(_0x5c7177){utils[_0x7db6('0x12')](util[_0x7db6('0x4')]('[%s][queues][musiconholdstart]',_0x467bf4[_0x7db6('0xb')]),_0x5c7177);}};exports[_0x7db6('0x63')]=function(_0x22bbf6){try{if(!_[_0x7db6('0x14')](queues[_0x22bbf6['uniqueid']])){if(!_[_0x7db6('0x14')](queues[_0x22bbf6[_0x7db6('0xb')]][_0x7db6('0x62')])){utils[_0x7db6('0xd')](util[_0x7db6('0x4')](_0x7db6('0x64'),_0x22bbf6[_0x7db6('0xb')]),_0x22bbf6);queues[_0x22bbf6[_0x7db6('0xb')]]['mohtime']+=utils[_0x7db6('0x32')](utils['now'](),queues[_0x22bbf6['uniqueid']][_0x7db6('0x62')]);utils[_0x7db6('0x3')](util['format'](_0x7db6('0x65'),_0x22bbf6['uniqueid'],queues[_0x22bbf6['uniqueid']][_0x7db6('0x1c')],queues[_0x22bbf6[_0x7db6('0xb')]][_0x7db6('0x58')]));delete queues[_0x22bbf6[_0x7db6('0xb')]]['musiconholdstartAt'];}}}catch(_0xe11d68){utils['error'](util['format'](_0x7db6('0x64'),_0x22bbf6[_0x7db6('0xb')]),_0xe11d68);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index fc6f92a..d671254 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63f1=['variable','value','endsWith','.wav49','.WAV','monitors','[%s][recordings][varset]','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','util','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset'];(function(_0x510dd7,_0x172971){var _0x375722=function(_0x4c0a1a){while(--_0x4c0a1a){_0x510dd7['push'](_0x510dd7['shift']());}};_0x375722(++_0x172971);}(_0x63f1,0x145));var _0x163f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x63f1[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x163f('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x2eedef){utils[_0x163f('0x1')](util[_0x163f('0x2')](_0x163f('0x3'),_0x2eedef[_0x163f('0x4')]));if(_0x2eedef['accountcode']){utils['getUserByInternal'](_0x2eedef[_0x163f('0x5')])[_0x163f('0x6')](function(_0x3e6040){if(_0x3e6040){_0x2eedef[_0x163f('0x7')]=_0x3e6040[_0x163f('0x8')];_0x2eedef[_0x163f('0x9')]=_0x3e6040['id'];}utils[_0x163f('0xa')]('CreateVoiceRecording',_0x2eedef);});}else{utils[_0x163f('0xa')](_0x163f('0xb'),_0x2eedef);}}exports[_0x163f('0xc')]=function(_0x1e6885){try{utils[_0x163f('0xd')](util[_0x163f('0x2')](_0x163f('0xe'),_0x1e6885[_0x163f('0x4')]),_0x1e6885);if(_0x1e6885[_0x163f('0x4')]==_0x1e6885[_0x163f('0xf')]){utils[_0x163f('0x1')](util[_0x163f('0x2')](_0x163f('0x10'),_0x1e6885[_0x163f('0x4')],_0x1e6885['context'],_0x1e6885[_0x163f('0x11')]));recordings[_0x1e6885[_0x163f('0x4')]]={'uniqueid':_0x1e6885[_0x163f('0x4')],'accountcode':_0x1e6885[_0x163f('0x5')],'exten':_0x1e6885['exten'],'context':_0x1e6885[_0x163f('0x12')],'channel':_0x1e6885[_0x163f('0x13')],'monitors':[]};}}catch(_0x56d009){utils[_0x163f('0x14')](util['format']('[%s][recordings][newchannel]',_0x1e6885[_0x163f('0x4')]),_0x56d009);}};exports[_0x163f('0x15')]=function(_0x9ea649){try{utils[_0x163f('0xd')](util[_0x163f('0x2')](_0x163f('0x16'),_0x9ea649[_0x163f('0x4')]),_0x9ea649);if(!_['isNil'](recordings[_0x9ea649['uniqueid']])&&_0x9ea649[_0x163f('0x17')]==0x6){utils['info'](util[_0x163f('0x2')](_0x163f('0x18'),_0x9ea649[_0x163f('0x4')],_0x9ea649[_0x163f('0x12')],_0x9ea649[_0x163f('0x13')]));}else if(!_[_0x163f('0x19')](recordings[_0x9ea649[_0x163f('0xf')]])&&_0x9ea649[_0x163f('0x17')]==0x6&&_0x9ea649[_0x163f('0x12')]!=_0x163f('0x1a')){utils[_0x163f('0x1')](util['format'](_0x163f('0x1b'),_0x9ea649[_0x163f('0x4')],_0x9ea649[_0x163f('0xf')],_0x9ea649[_0x163f('0x12')],_0x9ea649[_0x163f('0x13')]));recordings[_0x9ea649[_0x163f('0xf')]]['accountcode']=_0x9ea649[_0x163f('0x5')];}}catch(_0x20c2f2){utils['error'](util[_0x163f('0x2')](_0x163f('0x16'),_0x9ea649[_0x163f('0x4')]),_0x20c2f2);}};exports[_0x163f('0x1c')]=function(_0x1a58a8){try{if(!_['isNil'](_0x1a58a8[_0x163f('0x1d')])&&!_['isNil'](_0x1a58a8['variable']['mixmonitor_filename'])){utils[_0x163f('0xd')](util[_0x163f('0x2')]('[%s][recordings][varset]',_0x1a58a8[_0x163f('0x4')]),_0x1a58a8);utils[_0x163f('0x1')](util[_0x163f('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x1a58a8[_0x163f('0x4')],_0x1a58a8[_0x163f('0x1d')],_0x1a58a8[_0x163f('0x1e')]));if(_[_0x163f('0x1f')](_0x1a58a8[_0x163f('0x1e')],'.wav49')){_0x1a58a8[_0x163f('0x1e')]=_0x1a58a8[_0x163f('0x1e')]['replace'](_0x163f('0x20'),_0x163f('0x21'));}if(recordings[_0x1a58a8[_0x163f('0xf')]]){var _0x661ede=_['find'](recordings[_0x1a58a8['linkedid']]['monitors'],{'value':_0x1a58a8[_0x163f('0x1e')]});if(_[_0x163f('0x19')](_0x661ede)){recordings[_0x1a58a8[_0x163f('0xf')]][_0x163f('0x22')]['push']({'value':_0x1a58a8[_0x163f('0x1e')]});}}}}catch(_0x20eae1){utils[_0x163f('0x14')](util['format'](_0x163f('0x23'),_0x1a58a8[_0x163f('0x4')]),_0x20eae1);}};exports[_0x163f('0x24')]=function(_0x53ac89){try{if(!_['isNil'](recordings[_0x53ac89['uniqueid']])){utils['debug'](util[_0x163f('0x2')]('[%s][recordings][hangup]',_0x53ac89[_0x163f('0x4')]),_0x53ac89);utils[_0x163f('0x1')](util[_0x163f('0x2')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x53ac89['uniqueid'],_0x53ac89[_0x163f('0x25')],_0x53ac89[_0x163f('0x26')],_0x53ac89[_0x163f('0x27')]));recordings[_0x53ac89['uniqueid']]['calleridnum']=_0x53ac89['calleridnum'];recordings[_0x53ac89[_0x163f('0x4')]]['calleridname']=_0x53ac89[_0x163f('0x26')];recordings[_0x53ac89[_0x163f('0x4')]][_0x163f('0x28')]=_0x53ac89[_0x163f('0x28')];recordings[_0x53ac89['uniqueid']]['connectedlinename']=_0x53ac89[_0x163f('0x29')];if(recordings[_0x53ac89[_0x163f('0x4')]]['type']==_0x163f('0x2a')&&recordings[_0x53ac89['uniqueid']][_0x163f('0x5')]){recordings[_0x53ac89[_0x163f('0x4')]][_0x163f('0x28')]=recordings[_0x53ac89[_0x163f('0x4')]][_0x163f('0x5')];recordings[_0x53ac89['uniqueid']][_0x163f('0x29')]='';}recordings[_0x53ac89[_0x163f('0x4')]][_0x163f('0x22')][_0x163f('0x2b')](function(_0x19c3fa){var _0x36cb73=_[_0x163f('0x2c')](recordings[_0x53ac89['uniqueid']]);_0x36cb73[_0x163f('0x1e')]=_0x19c3fa['value'];writeDB(_0x36cb73);});delete recordings[_0x53ac89[_0x163f('0x4')]];}}catch(_0xa7ed2f){utils['error'](util['format'](_0x163f('0x2d'),_0x53ac89['uniqueid']),_0xa7ed2f);}};exports[_0x163f('0x2e')]=function(_0x21e0d9){try{if(!_[_0x163f('0x19')](recordings[_0x21e0d9['uniqueid']])){utils[_0x163f('0xd')](util[_0x163f('0x2')](_0x163f('0x2f'),_0x21e0d9[_0x163f('0x4')]),_0x21e0d9);utils['info'](util[_0x163f('0x2')](_0x163f('0x30'),_0x21e0d9[_0x163f('0x4')],_0x21e0d9[_0x163f('0x31')],_0x21e0d9[_0x163f('0x32')]));if(_0x21e0d9[_0x163f('0x31')][_0x163f('0x33')]()=='set'&&_[_0x163f('0x34')](_0x21e0d9[_0x163f('0x32')][_0x163f('0x33')](),'cdr')){var _0x8d22d=_0x21e0d9[_0x163f('0x32')][_0x163f('0x35')]('=');var _0x47cc82=_0x8d22d[0x0][_0x163f('0x36')](_0x8d22d[0x0][_0x163f('0x37')]('(')+0x1,_0x8d22d[0x0][_0x163f('0x37')](')'));var _0x1cbbc0=_0x8d22d[0x1];recordings[_0x21e0d9[_0x163f('0x4')]][_0x47cc82]=_0x1cbbc0;}}}catch(_0x148257){utils[_0x163f('0x14')](util[_0x163f('0x2')](_0x163f('0x2f'),_0x21e0d9['uniqueid']),_0x148257);}};exports[_0x163f('0x38')]=function(_0x3c3d5c){try{if(!_[_0x163f('0x19')](recordings[_0x3c3d5c[_0x163f('0x4')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x3c3d5c[_0x163f('0x4')]),_0x3c3d5c);utils[_0x163f('0x1')](util[_0x163f('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x3c3d5c[_0x163f('0x4')],_0x3c3d5c['queue']));recordings[_0x3c3d5c['uniqueid']][_0x163f('0x39')]=_0x3c3d5c[_0x163f('0x39')];}}catch(_0x4b3819){utils[_0x163f('0x14')](util['format'](_0x163f('0x3a'),_0x3c3d5c[_0x163f('0x4')]),_0x4b3819);}}; \ No newline at end of file +var _0x1d51=['[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','format','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','error','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','info'];(function(_0x495c18,_0xae1131){var _0x27b50d=function(_0x44fbaf){while(--_0x44fbaf){_0x495c18['push'](_0x495c18['shift']());}};_0x27b50d(++_0xae1131);}(_0x1d51,0x13c));var _0x11d5=function(_0x3b1e15,_0x23e39e){_0x3b1e15=_0x3b1e15-0x0;var _0x5f28f0=_0x1d51[_0x3b1e15];return _0x5f28f0;};'use strict';var _=require(_0x11d5('0x0'));var util=require(_0x11d5('0x1'));var utils=require(_0x11d5('0x2'));var recordings={};function writeDB(_0x28a48a){utils[_0x11d5('0x3')](util['format'](_0x11d5('0x4'),_0x28a48a['uniqueid']));if(_0x28a48a[_0x11d5('0x5')]){utils[_0x11d5('0x6')](_0x28a48a[_0x11d5('0x5')])[_0x11d5('0x7')](function(_0x269138){if(_0x269138){_0x28a48a[_0x11d5('0x8')]=_0x269138['name'];_0x28a48a[_0x11d5('0x9')]=_0x269138['id'];}utils[_0x11d5('0xa')](_0x11d5('0xb'),_0x28a48a);});}else{utils['request'](_0x11d5('0xb'),_0x28a48a);}}exports[_0x11d5('0xc')]=function(_0x52ae11){try{utils[_0x11d5('0xd')](util[_0x11d5('0xe')]('[%s][recordings][newchannel]',_0x52ae11[_0x11d5('0xf')]),_0x52ae11);if(_0x52ae11['uniqueid']==_0x52ae11[_0x11d5('0x10')]){utils[_0x11d5('0x3')](util['format'](_0x11d5('0x11'),_0x52ae11[_0x11d5('0xf')],_0x52ae11[_0x11d5('0x12')],_0x52ae11[_0x11d5('0x13')]));recordings[_0x52ae11[_0x11d5('0xf')]]={'uniqueid':_0x52ae11[_0x11d5('0xf')],'accountcode':_0x52ae11[_0x11d5('0x5')],'exten':_0x52ae11['exten'],'context':_0x52ae11[_0x11d5('0x12')],'channel':_0x52ae11[_0x11d5('0x14')],'monitors':[]};}}catch(_0x2ad13b){utils['error'](util[_0x11d5('0xe')](_0x11d5('0x15'),_0x52ae11[_0x11d5('0xf')]),_0x2ad13b);}};exports[_0x11d5('0x16')]=function(_0x1cf7a7){try{utils['debug'](util[_0x11d5('0xe')](_0x11d5('0x17'),_0x1cf7a7[_0x11d5('0xf')]),_0x1cf7a7);if(!_[_0x11d5('0x18')](recordings[_0x1cf7a7['uniqueid']])&&_0x1cf7a7[_0x11d5('0x19')]==0x6){utils[_0x11d5('0x3')](util[_0x11d5('0xe')](_0x11d5('0x1a'),_0x1cf7a7[_0x11d5('0xf')],_0x1cf7a7[_0x11d5('0x12')],_0x1cf7a7[_0x11d5('0x14')]));}else if(!_[_0x11d5('0x18')](recordings[_0x1cf7a7['linkedid']])&&_0x1cf7a7[_0x11d5('0x19')]==0x6&&_0x1cf7a7['context']!='transfer'){utils['info'](util[_0x11d5('0xe')](_0x11d5('0x1b'),_0x1cf7a7[_0x11d5('0xf')],_0x1cf7a7['linkedid'],_0x1cf7a7['context'],_0x1cf7a7[_0x11d5('0x14')]));recordings[_0x1cf7a7['linkedid']][_0x11d5('0x5')]=_0x1cf7a7[_0x11d5('0x5')];}}catch(_0xf28c0f){utils['error'](util['format']('[%s][recordings][newstate]',_0x1cf7a7[_0x11d5('0xf')]),_0xf28c0f);}};exports[_0x11d5('0x1c')]=function(_0x4e15e3){try{if(!_[_0x11d5('0x18')](_0x4e15e3[_0x11d5('0x1d')])&&!_[_0x11d5('0x18')](_0x4e15e3[_0x11d5('0x1d')][_0x11d5('0x1e')])){utils[_0x11d5('0xd')](util[_0x11d5('0xe')]('[%s][recordings][varset]',_0x4e15e3['uniqueid']),_0x4e15e3);utils['info'](util['format'](_0x11d5('0x1f'),_0x4e15e3[_0x11d5('0xf')],_0x4e15e3[_0x11d5('0x1d')],_0x4e15e3[_0x11d5('0x20')]));if(_[_0x11d5('0x21')](_0x4e15e3[_0x11d5('0x20')],_0x11d5('0x22'))){_0x4e15e3[_0x11d5('0x20')]=_0x4e15e3['value'][_0x11d5('0x23')]('.wav49',_0x11d5('0x24'));}if(recordings[_0x4e15e3[_0x11d5('0x10')]]){var _0x287113=_['find'](recordings[_0x4e15e3[_0x11d5('0x10')]][_0x11d5('0x25')],{'value':_0x4e15e3[_0x11d5('0x20')]});if(_[_0x11d5('0x18')](_0x287113)){recordings[_0x4e15e3[_0x11d5('0x10')]]['monitors'][_0x11d5('0x26')]({'value':_0x4e15e3[_0x11d5('0x20')]});}}}}catch(_0x320c05){utils[_0x11d5('0x27')](util[_0x11d5('0xe')]('[%s][recordings][varset]',_0x4e15e3[_0x11d5('0xf')]),_0x320c05);}};exports['hangup']=function(_0x55b07e){try{if(!_[_0x11d5('0x18')](recordings[_0x55b07e[_0x11d5('0xf')]])){utils[_0x11d5('0xd')](util['format'](_0x11d5('0x28'),_0x55b07e[_0x11d5('0xf')]),_0x55b07e);utils[_0x11d5('0x3')](util[_0x11d5('0xe')](_0x11d5('0x29'),_0x55b07e[_0x11d5('0xf')],_0x55b07e[_0x11d5('0x2a')],_0x55b07e[_0x11d5('0x2b')],_0x55b07e[_0x11d5('0x2c')]));recordings[_0x55b07e[_0x11d5('0xf')]]['calleridnum']=_0x55b07e[_0x11d5('0x2a')];recordings[_0x55b07e[_0x11d5('0xf')]][_0x11d5('0x2b')]=_0x55b07e[_0x11d5('0x2b')];recordings[_0x55b07e['uniqueid']][_0x11d5('0x2d')]=_0x55b07e[_0x11d5('0x2d')];recordings[_0x55b07e[_0x11d5('0xf')]]['connectedlinename']=_0x55b07e[_0x11d5('0x2e')];if(recordings[_0x55b07e[_0x11d5('0xf')]][_0x11d5('0x2f')]==_0x11d5('0x30')&&recordings[_0x55b07e[_0x11d5('0xf')]]['accountcode']){recordings[_0x55b07e[_0x11d5('0xf')]]['connectedlinenum']=recordings[_0x55b07e['uniqueid']]['accountcode'];recordings[_0x55b07e[_0x11d5('0xf')]][_0x11d5('0x2e')]='';}recordings[_0x55b07e['uniqueid']]['monitors'][_0x11d5('0x31')](function(_0x58209a){var _0x298cd8=_['clone'](recordings[_0x55b07e[_0x11d5('0xf')]]);_0x298cd8[_0x11d5('0x20')]=_0x58209a[_0x11d5('0x20')];writeDB(_0x298cd8);});delete recordings[_0x55b07e['uniqueid']];}}catch(_0x4bfb05){utils[_0x11d5('0x27')](util[_0x11d5('0xe')](_0x11d5('0x28'),_0x55b07e['uniqueid']),_0x4bfb05);}};exports[_0x11d5('0x32')]=function(_0x343f9c){try{if(!_[_0x11d5('0x18')](recordings[_0x343f9c[_0x11d5('0xf')]])){utils['debug'](util[_0x11d5('0xe')](_0x11d5('0x33'),_0x343f9c[_0x11d5('0xf')]),_0x343f9c);utils[_0x11d5('0x3')](util[_0x11d5('0xe')](_0x11d5('0x34'),_0x343f9c[_0x11d5('0xf')],_0x343f9c[_0x11d5('0x35')],_0x343f9c[_0x11d5('0x36')]));if(_0x343f9c[_0x11d5('0x35')][_0x11d5('0x37')]()==_0x11d5('0x38')&&_[_0x11d5('0x39')](_0x343f9c[_0x11d5('0x36')][_0x11d5('0x37')](),_0x11d5('0x3a'))){var _0x46ec6c=_0x343f9c[_0x11d5('0x36')]['split']('=');var _0x3f448f=_0x46ec6c[0x0]['substring'](_0x46ec6c[0x0][_0x11d5('0x3b')]('(')+0x1,_0x46ec6c[0x0][_0x11d5('0x3b')](')'));var _0x3dce8c=_0x46ec6c[0x1];recordings[_0x343f9c['uniqueid']][_0x3f448f]=_0x3dce8c;}}}catch(_0x597f18){utils[_0x11d5('0x27')](util['format'](_0x11d5('0x33'),_0x343f9c[_0x11d5('0xf')]),_0x597f18);}};exports[_0x11d5('0x3c')]=function(_0x88cb9){try{if(!_[_0x11d5('0x18')](recordings[_0x88cb9['uniqueid']])){utils[_0x11d5('0xd')](util[_0x11d5('0xe')]('[%s][recordings][queuecallerjoin]',_0x88cb9[_0x11d5('0xf')]),_0x88cb9);utils['info'](util['format'](_0x11d5('0x3d'),_0x88cb9[_0x11d5('0xf')],_0x88cb9[_0x11d5('0x3e')]));recordings[_0x88cb9['uniqueid']][_0x11d5('0x3e')]=_0x88cb9[_0x11d5('0x3e')];}}catch(_0x303a50){utils[_0x11d5('0x27')](util['format'](_0x11d5('0x3f'),_0x88cb9[_0x11d5('0xf')]),_0x303a50);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 1c6f67c..dc59520 100644 --- a/server/services/xdr/transfers.controller.js +++ b/server/services/xdr/transfers.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a45=['transfereecalleridnum','blind','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','format','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname'];(function(_0x4ffe90,_0x53b725){var _0x34f3a4=function(_0x213be5){while(--_0x213be5){_0x4ffe90['push'](_0x4ffe90['shift']());}};_0x34f3a4(++_0x53b725);}(_0x4a45,0x6b));var _0x54a4=function(_0x2b0c69,_0x4e1243){_0x2b0c69=_0x2b0c69-0x0;var _0x29e062=_0x4a45[_0x2b0c69];return _0x29e062;};'use strict';var _=require(_0x54a4('0x0'));var util=require(_0x54a4('0x1'));var utils=require(_0x54a4('0x2'));function writeDB(_0x4691b0){utils[_0x54a4('0x3')](util['format'](_0x54a4('0x4'),_0x4691b0[_0x54a4('0x5')]===_0x54a4('0x6')?_0x4691b0[_0x54a4('0x7')]:_0x4691b0[_0x54a4('0x8')],_0x4691b0['type']));utils[_0x54a4('0x9')](_0x54a4('0xa'),_0x4691b0);}exports[_0x54a4('0xb')]=function(_0x5d8ac2){try{utils['debug'](util[_0x54a4('0xc')](_0x54a4('0xd'),_0x5d8ac2[_0x54a4('0x8')]),_0x5d8ac2);utils[_0x54a4('0x3')](util[_0x54a4('0xc')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5d8ac2[_0x54a4('0x8')],_0x5d8ac2[_0x54a4('0xe')],_0x5d8ac2[_0x54a4('0xf')],_0x5d8ac2[_0x54a4('0x10')],_0x5d8ac2['transfereecalleridname']));_0x5d8ac2['type']=_0x54a4('0x11');writeDB(_0x5d8ac2);}catch(_0xd4bec7){utils[_0x54a4('0x12')](util['format'](_0x54a4('0xd'),_0x5d8ac2[_0x54a4('0x8')]),_0xd4bec7);}};exports[_0x54a4('0x13')]=function(_0x497368){try{utils[_0x54a4('0x14')](util[_0x54a4('0xc')](_0x54a4('0x15'),_0x497368[_0x54a4('0x7')]),_0x497368);utils[_0x54a4('0x3')](util['format'](_0x54a4('0x16'),_0x497368[_0x54a4('0x7')],_0x497368['origtransferercalleridnum'],_0x497368[_0x54a4('0x17')],_0x497368[_0x54a4('0x18')],_0x497368[_0x54a4('0x19')]));_0x497368=_[_0x54a4('0x1a')](_0x497368,{'transfererchannel':_0x497368['origtransfererchannel'],'transferercalleridnum':_0x497368[_0x54a4('0x1b')],'transferercalleridname':_0x497368[_0x54a4('0x17')],'transfererconnectedlinenum':_0x497368['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x497368['secondtransfererconnectedlinename'],'transfereraccountcode':_0x497368[_0x54a4('0x1c')],'transferercontext':_0x497368[_0x54a4('0x1d')],'transfererexten':_0x497368[_0x54a4('0x1e')],'transfererlinkedid':_0x497368[_0x54a4('0x1f')],'context':_0x497368[_0x54a4('0x20')],'extension':_0x497368[_0x54a4('0x21')],'type':_0x54a4('0x6')});if(_[_0x54a4('0x22')](_0x497368[_0x54a4('0x23')])){_0x497368=_[_0x54a4('0x1a')](_0x497368,{'transfereechannel':_0x497368[_0x54a4('0x24')],'transfereecalleridnum':_0x497368[_0x54a4('0x18')],'transfereecalleridname':_0x497368[_0x54a4('0x19')],'transfereeconnectedlinenum':_0x497368['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x497368[_0x54a4('0x25')],'transfereeaccountcode':_0x497368['transfertargetaccountcode'],'transfereecontext':_0x497368[_0x54a4('0x26')],'transfereeexten':_0x497368[_0x54a4('0x27')],'transfereelinkedid':_0x497368[_0x54a4('0x28')]});}writeDB(_0x497368);}catch(_0x37d2db){utils['error'](util['format']('[%s][transfers][attendedtransfer]',_0x497368[_0x54a4('0x7')]),_0x37d2db);}}; \ No newline at end of file +var _0x54e3=['lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid'];(function(_0x335236,_0x12ea97){var _0x51ac14=function(_0xa818f1){while(--_0xa818f1){_0x335236['push'](_0x335236['shift']());}};_0x51ac14(++_0x12ea97);}(_0x54e3,0x118));var _0x354e=function(_0x44ae3c,_0x44abc9){_0x44ae3c=_0x44ae3c-0x0;var _0x5295fe=_0x54e3[_0x44ae3c];return _0x5295fe;};'use strict';var _=require(_0x354e('0x0'));var util=require('util');var utils=require(_0x354e('0x1'));function writeDB(_0x3dbb2d){utils['info'](util[_0x354e('0x2')](_0x354e('0x3'),_0x3dbb2d[_0x354e('0x4')]===_0x354e('0x5')?_0x3dbb2d['origtransfereruniqueid']:_0x3dbb2d[_0x354e('0x6')],_0x3dbb2d[_0x354e('0x4')]));utils[_0x354e('0x7')](_0x354e('0x8'),_0x3dbb2d);}exports['blindtransfer']=function(_0x173ac1){try{utils[_0x354e('0x9')](util[_0x354e('0x2')](_0x354e('0xa'),_0x173ac1[_0x354e('0x6')]),_0x173ac1);utils['info'](util[_0x354e('0x2')](_0x354e('0xb'),_0x173ac1[_0x354e('0x6')],_0x173ac1[_0x354e('0xc')],_0x173ac1[_0x354e('0xd')],_0x173ac1[_0x354e('0xe')],_0x173ac1[_0x354e('0xf')]));_0x173ac1[_0x354e('0x4')]=_0x354e('0x10');writeDB(_0x173ac1);}catch(_0x342558){utils[_0x354e('0x11')](util[_0x354e('0x2')](_0x354e('0xa'),_0x173ac1[_0x354e('0x6')]),_0x342558);}};exports[_0x354e('0x12')]=function(_0x2b1a67){try{utils[_0x354e('0x9')](util[_0x354e('0x2')](_0x354e('0x13'),_0x2b1a67[_0x354e('0x14')]),_0x2b1a67);utils['info'](util[_0x354e('0x2')](_0x354e('0x15'),_0x2b1a67[_0x354e('0x14')],_0x2b1a67[_0x354e('0x16')],_0x2b1a67[_0x354e('0x17')],_0x2b1a67[_0x354e('0x18')],_0x2b1a67[_0x354e('0x19')]));_0x2b1a67=_['assign'](_0x2b1a67,{'transfererchannel':_0x2b1a67[_0x354e('0x1a')],'transferercalleridnum':_0x2b1a67[_0x354e('0x16')],'transferercalleridname':_0x2b1a67[_0x354e('0x17')],'transfererconnectedlinenum':_0x2b1a67[_0x354e('0x1b')],'transfererconnectedlinename':_0x2b1a67['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2b1a67[_0x354e('0x1c')],'transferercontext':_0x2b1a67[_0x354e('0x1d')],'transfererexten':_0x2b1a67[_0x354e('0x1e')],'transfererlinkedid':_0x2b1a67['origtransfererlinkedid'],'context':_0x2b1a67[_0x354e('0x1f')],'extension':_0x2b1a67[_0x354e('0x20')],'type':_0x354e('0x5')});if(_[_0x354e('0x21')](_0x2b1a67[_0x354e('0x22')])){_0x2b1a67=_[_0x354e('0x23')](_0x2b1a67,{'transfereechannel':_0x2b1a67[_0x354e('0x24')],'transfereecalleridnum':_0x2b1a67[_0x354e('0x18')],'transfereecalleridname':_0x2b1a67[_0x354e('0x19')],'transfereeconnectedlinenum':_0x2b1a67['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2b1a67[_0x354e('0x25')],'transfereeaccountcode':_0x2b1a67['transfertargetaccountcode'],'transfereecontext':_0x2b1a67['transfertargetcontext'],'transfereeexten':_0x2b1a67[_0x354e('0x26')],'transfereelinkedid':_0x2b1a67[_0x354e('0x27')]});}writeDB(_0x2b1a67);}catch(_0x1d8328){utils[_0x354e('0x11')](util['format']('[%s][transfers][attendedtransfer]',_0x2b1a67[_0x354e('0x14')]),_0x1d8328);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ea2a271..be2b420 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb22e=['error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','xdr','info','inspect','debug'];(function(_0x2d0e42,_0x1de981){var _0x49a81d=function(_0x17f80b){while(--_0x17f80b){_0x2d0e42['push'](_0x2d0e42['shift']());}};_0x49a81d(++_0x1de981);}(_0xb22e,0x87));var _0xeb22=function(_0x1962aa,_0x282a58){_0x1962aa=_0x1962aa-0x0;var _0x9dd61c=_0xb22e[_0x1962aa];return _0x9dd61c;};'use strict';var BPromise=require(_0xeb22('0x0'));var jayson=require(_0xeb22('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0xeb22('0x2')][_0xeb22('0x3')]({'port':0x2329});var logger=require(_0xeb22('0x4'))(_0xeb22('0x5'));exports['info']=function(_0x4ab940,_0x55a7db){logger[_0xeb22('0x6')](_0x4ab940,_0x55a7db?util[_0xeb22('0x7')](_0x55a7db,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x584bba,_0x4ea280){logger[_0xeb22('0x8')](_0x584bba,_0x4ea280?util[_0xeb22('0x7')](_0x4ea280,{'showHidden':![],'depth':null}):'');};exports[_0xeb22('0x9')]=function(_0x31bebd,_0x3d8d4f){logger[_0xeb22('0x9')](_0x31bebd,_0x3d8d4f?util['inspect'](_0x3d8d4f,{'showHidden':![],'depth':null}):'');};exports[_0xeb22('0xa')]=function(_0x5a5447,_0x1d57c4){return client[_0xeb22('0xa')](_0x5a5447,{'body':_0x1d57c4})[_0xeb22('0xb')](function(_0x590d82){logger['debug'](_0xeb22('0xc'),_0x5a5447,_0x590d82?util['inspect'](_0x590d82,{'showHidden':![],'depth':null}):'');})[_0xeb22('0xd')](function(_0x292757){logger[_0xeb22('0x9')](_0xeb22('0xc'),_0x5a5447,_0x292757?util[_0xeb22('0x7')](_0x292757,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1ef0a4){return client[_0xeb22('0xa')](_0xeb22('0xe'),{'options':{'raw':!![],'attributes':['id',_0xeb22('0xf'),_0xeb22('0x10'),_0xeb22('0x11')],'where':_0x1ef0a4,'limit':0x1}})['then'](function(_0xa88d1){logger[_0xeb22('0x8')](_0xeb22('0x12'),JSON[_0xeb22('0x13')](_0x1ef0a4),_0xa88d1?util[_0xeb22('0x7')](_0xa88d1,{'showHidden':![],'depth':null}):'');return _0xa88d1[_0xeb22('0x14')][_0xeb22('0x15')]?_0xa88d1[_0xeb22('0x14')][0x0]:null;});}exports[_0xeb22('0x16')]=function(_0x43c790){return new BPromise(function(_0x2d74d0,_0x26de67){if(_0x43c790){return getUser({'internal':_0x43c790})[_0xeb22('0xb')](function(_0x4deeff){logger['info'](_0xeb22('0x17'),_0x43c790,_0x4deeff?_0xeb22('0x18'):_0xeb22('0x19'));return _0x2d74d0(_0x4deeff);})[_0xeb22('0xd')](function(_0x3dd596){logger[_0xeb22('0x9')]('[utils][getUserByInternal]',_0x3dd596?util[_0xeb22('0x7')](_0x3dd596,{'showHidden':![],'depth':null}):'');return _0x2d74d0(null);});}return _0x2d74d0(null);});};exports[_0xeb22('0x1a')]=function(_0x3e3704){return new BPromise(function(_0x477242,_0x3926bf){if(_0x3e3704){return getUser({'interface':_0x3e3704})['then'](function(_0x52c0a3){logger[_0xeb22('0x6')](_0xeb22('0x1b'),_0x3e3704,_0x52c0a3?_0xeb22('0x18'):'notfound');return _0x477242(_0x52c0a3);})[_0xeb22('0xd')](function(_0x47f456){logger[_0xeb22('0x9')](_0xeb22('0x1c'),_0x47f456?util[_0xeb22('0x7')](_0x47f456,{'showHidden':![],'depth':null}):'');return _0x477242(null);});}return _0x477242(null);});};exports['getUserByName']=function(_0x2d0ccc){return new BPromise(function(_0x41b548,_0x32be46){if(_0x2d0ccc){return getUser({'name':_0x2d0ccc})[_0xeb22('0xb')](function(_0x37dc6b){logger[_0xeb22('0x6')](_0xeb22('0x1d'),_0x2d0ccc,_0x37dc6b?_0xeb22('0x18'):'notfound');return _0x41b548(_0x37dc6b);})[_0xeb22('0xd')](function(_0x5329bd){logger['error'](_0xeb22('0x1e'),_0x5329bd?util[_0xeb22('0x7')](_0x5329bd,{'showHidden':![],'depth':null}):'');return _0x41b548(null);});}return _0x41b548(null);});};exports[_0xeb22('0x1f')]=function(_0x20e02b){return new BPromise(function(_0x364acf,_0x14c751){if(_0x20e02b){return client['request'](_0xeb22('0x20'),{'options':{'raw':!![],'attributes':['id',_0xeb22('0x10'),_0xeb22('0x21'),_0xeb22('0x22'),_0xeb22('0x23')],'where':{'name':_0x20e02b},'limit':0x1}})[_0xeb22('0xb')](function(_0xf75882){logger[_0xeb22('0x8')](_0xeb22('0x24'),_0x20e02b,_0xf75882?util['inspect'](_0xf75882,{'showHidden':![],'depth':null}):'');logger[_0xeb22('0x6')](_0xeb22('0x25'),_0x20e02b,_0xf75882?_0xeb22('0x18'):'notfound');return _0x364acf(_0xf75882[_0xeb22('0x14')][_0xeb22('0x15')]?_0xf75882[_0xeb22('0x14')][0x0]:null);})[_0xeb22('0xd')](function(_0x1d325e){logger[_0xeb22('0x9')]('[utils][getVoiceQueueByName]',_0x1d325e?util[_0xeb22('0x7')](_0x1d325e,{'showHidden':![],'depth':null}):'');return _0x364acf(null);});}return _0x364acf(null);});};exports['addTime']=function(_0x5de785,_0x26b0a9){return moment(_0x5de785)['add'](_0x26b0a9,'seconds')[_0xeb22('0x26')](_0xeb22('0x27'));};exports[_0xeb22('0x28')]=function(_0x3785f0,_0x19ef8f){return moment(_0x3785f0)['subtract'](_0x19ef8f,_0xeb22('0x29'))[_0xeb22('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xeb22('0x2a')]=function(_0x2b8bbb,_0x27a1c8){return moment(_0x2b8bbb)[_0xeb22('0x2b')](moment(_0x27a1c8),_0xeb22('0x29'));};exports[_0xeb22('0x2c')]=function(_0x36e642,_0x6c6315){return parseInt(_0x36e642,0xa)+parseInt(_0x6c6315,0xa);};exports[_0xeb22('0x2d')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xeb22('0x2e')]=function(_0x3b9409,_0x52c995){if(_0x52c995){return moment(_0x3b9409)[_0xeb22('0x2e')](_0x52c995);}return!![];};exports[_0xeb22('0x2f')]=function(_0x506288,_0x4381ac){if(_0x4381ac){return moment(_0x506288)[_0xeb22('0x2f')](_0x4381ac);}else if(_0x506288){return!![];}return![];}; \ No newline at end of file +var _0x5923=['GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','diff','sumTime','isAfter','isBefore','bluebird','moment','util','client','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName'];(function(_0x540314,_0x30e8a5){var _0xff9b2a=function(_0x292a71){while(--_0x292a71){_0x540314['push'](_0x540314['shift']());}};_0xff9b2a(++_0x30e8a5);}(_0x5923,0x12b));var _0x3592=function(_0x57c0f5,_0x4d1bdf){_0x57c0f5=_0x57c0f5-0x0;var _0x2ffea1=_0x5923[_0x57c0f5];return _0x2ffea1;};'use strict';var BPromise=require(_0x3592('0x0'));var jayson=require('jayson/promise');var moment=require(_0x3592('0x1'));var util=require(_0x3592('0x2'));var client=jayson[_0x3592('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x3592('0x4'));exports[_0x3592('0x5')]=function(_0x219274,_0x356ebf){logger['info'](_0x219274,_0x356ebf?util[_0x3592('0x6')](_0x356ebf,{'showHidden':![],'depth':null}):'');};exports[_0x3592('0x7')]=function(_0x1ac7b6,_0x2fb28a){logger[_0x3592('0x7')](_0x1ac7b6,_0x2fb28a?util[_0x3592('0x6')](_0x2fb28a,{'showHidden':![],'depth':null}):'');};exports[_0x3592('0x8')]=function(_0x3d24f2,_0x518907){logger['error'](_0x3d24f2,_0x518907?util[_0x3592('0x6')](_0x518907,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x548fe9,_0x2d9561){return client[_0x3592('0x9')](_0x548fe9,{'body':_0x2d9561})[_0x3592('0xa')](function(_0x458ff0){logger[_0x3592('0x7')](_0x3592('0xb'),_0x548fe9,_0x458ff0?util[_0x3592('0x6')](_0x458ff0,{'showHidden':![],'depth':null}):'');})[_0x3592('0xc')](function(_0x423290){logger[_0x3592('0x8')](_0x3592('0xb'),_0x548fe9,_0x423290?util[_0x3592('0x6')](_0x423290,{'showHidden':![],'depth':null}):'');});};function getUser(_0x49843e){return client[_0x3592('0x9')](_0x3592('0xd'),{'options':{'raw':!![],'attributes':['id',_0x3592('0xe'),_0x3592('0xf'),_0x3592('0x10')],'where':_0x49843e,'limit':0x1}})[_0x3592('0xa')](function(_0x1da463){logger[_0x3592('0x7')]('[utils][getUser]\x20where:%s',JSON[_0x3592('0x11')](_0x49843e),_0x1da463?util['inspect'](_0x1da463,{'showHidden':![],'depth':null}):'');return _0x1da463['result']['length']?_0x1da463[_0x3592('0x12')][0x0]:null;});}exports[_0x3592('0x13')]=function(_0x4e54b1){return new BPromise(function(_0x5d33c4,_0x58b0ed){if(_0x4e54b1){return getUser({'internal':_0x4e54b1})[_0x3592('0xa')](function(_0x453cc9){logger[_0x3592('0x5')](_0x3592('0x14'),_0x4e54b1,_0x453cc9?_0x3592('0x15'):_0x3592('0x16'));return _0x5d33c4(_0x453cc9);})[_0x3592('0xc')](function(_0x5393e3){logger[_0x3592('0x8')](_0x3592('0x17'),_0x5393e3?util['inspect'](_0x5393e3,{'showHidden':![],'depth':null}):'');return _0x5d33c4(null);});}return _0x5d33c4(null);});};exports[_0x3592('0x18')]=function(_0x2743b5){return new BPromise(function(_0xce8b81,_0x522a56){if(_0x2743b5){return getUser({'interface':_0x2743b5})['then'](function(_0x1b9154){logger[_0x3592('0x5')](_0x3592('0x19'),_0x2743b5,_0x1b9154?_0x3592('0x15'):_0x3592('0x16'));return _0xce8b81(_0x1b9154);})[_0x3592('0xc')](function(_0x2defac){logger['error'](_0x3592('0x1a'),_0x2defac?util['inspect'](_0x2defac,{'showHidden':![],'depth':null}):'');return _0xce8b81(null);});}return _0xce8b81(null);});};exports[_0x3592('0x1b')]=function(_0x117939){return new BPromise(function(_0x39f278,_0x383fa0){if(_0x117939){return getUser({'name':_0x117939})[_0x3592('0xa')](function(_0x7ff6cb){logger[_0x3592('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x117939,_0x7ff6cb?_0x3592('0x15'):_0x3592('0x16'));return _0x39f278(_0x7ff6cb);})['catch'](function(_0x17a805){logger['error'](_0x3592('0x1c'),_0x17a805?util[_0x3592('0x6')](_0x17a805,{'showHidden':![],'depth':null}):'');return _0x39f278(null);});}return _0x39f278(null);});};exports[_0x3592('0x1d')]=function(_0x40e1e1){return new BPromise(function(_0xd66af,_0x1ba058){if(_0x40e1e1){return client[_0x3592('0x9')](_0x3592('0x1e'),{'options':{'raw':!![],'attributes':['id','name','type',_0x3592('0x1f'),'acwTimeout'],'where':{'name':_0x40e1e1},'limit':0x1}})[_0x3592('0xa')](function(_0x3d611c){logger[_0x3592('0x7')](_0x3592('0x20'),_0x40e1e1,_0x3d611c?util[_0x3592('0x6')](_0x3d611c,{'showHidden':![],'depth':null}):'');logger[_0x3592('0x5')](_0x3592('0x21'),_0x40e1e1,_0x3d611c?_0x3592('0x15'):'notfound');return _0xd66af(_0x3d611c[_0x3592('0x12')][_0x3592('0x22')]?_0x3d611c[_0x3592('0x12')][0x0]:null);})[_0x3592('0xc')](function(_0x5ca596){logger[_0x3592('0x8')](_0x3592('0x23'),_0x5ca596?util[_0x3592('0x6')](_0x5ca596,{'showHidden':![],'depth':null}):'');return _0xd66af(null);});}return _0xd66af(null);});};exports[_0x3592('0x24')]=function(_0x3c1d7d,_0xea4844){return moment(_0x3c1d7d)[_0x3592('0x25')](_0xea4844,_0x3592('0x26'))['format'](_0x3592('0x27'));};exports[_0x3592('0x28')]=function(_0x21bbfd,_0x409eb0){return moment(_0x21bbfd)['subtract'](_0x409eb0,_0x3592('0x26'))[_0x3592('0x29')](_0x3592('0x27'));};exports[_0x3592('0x2a')]=function(_0x4b17e9,_0x3075ac){return moment(_0x4b17e9)[_0x3592('0x2b')](moment(_0x3075ac),_0x3592('0x26'));};exports[_0x3592('0x2c')]=function(_0x40d9d3,_0x10bfc4){return parseInt(_0x40d9d3,0xa)+parseInt(_0x10bfc4,0xa);};exports['now']=function(){return moment()[_0x3592('0x29')](_0x3592('0x27'));};exports[_0x3592('0x2d')]=function(_0x5f28e4,_0x219fd4){if(_0x219fd4){return moment(_0x5f28e4)[_0x3592('0x2d')](_0x219fd4);}return!![];};exports[_0x3592('0x2e')]=function(_0x30f19d,_0x21e23c){if(_0x21e23c){return moment(_0x30f19d)[_0x3592('0x2e')](_0x21e23c);}else if(_0x30f19d){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index d8300c0..c79108d 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb716=['x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','device','agent_name','setupLoggers','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','join','client','role','name','ensureDir','then','log','user','no-user','data','timestamp','catch','api','client-side-logger','logger','isEmpty','body','\x20body=%s','method','headers'];(function(_0x38e0f7,_0x4f0895){var _0x2a4c31=function(_0x250097){while(--_0x250097){_0x38e0f7['push'](_0x38e0f7['shift']());}};_0x2a4c31(++_0x4f0895);}(_0xb716,0xb5));var _0x6b71=function(_0x20f694,_0x192fd4){_0x20f694=_0x20f694-0x0;var _0x2452e0=_0xb716[_0x20f694];return _0x2452e0;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require(_0x6b71('0x0'));var path=require(_0x6b71('0x1'));var util=require(_0x6b71('0x2'));var fileLogger=require(_0x6b71('0x3'))['fileLogger'];var safeTemplate=require(_0x6b71('0x4'))[_0x6b71('0x5')];var maskSensitiveData=require(_0x6b71('0x6'))[_0x6b71('0x7')];function ClientSideLogger(){function _0x398124(_0x41bc84){var _0x3b1c1=path['join'](_0x6b71('0x8'),'log','xcally');var _0x2507b9=path[_0x6b71('0x9')](_0x6b71('0xa'),_0x41bc84[_0x6b71('0xb')]+'-'+_0x41bc84[_0x6b71('0xc')]);return fs[_0x6b71('0xd')](path['join'](_0x3b1c1,_0x2507b9))[_0x6b71('0xe')](function(){var _0x356b32=fileLogger('client',path[_0x6b71('0x9')](_0x3b1c1,_0x2507b9));return _0x356b32;})['catch'](function(_0x14cbc5){throw _0x14cbc5;});}this[_0x6b71('0xf')]=function(_0x3ea439,_0x407090,_0x15dabc,_0x4780aa){return _0x398124(_0x3ea439[_0x6b71('0x10')])[_0x6b71('0xe')](function(_0x48c0ff){var _0x13f31c=_0x48c0ff[_0x407090];return _0x13f31c;})[_0x6b71('0xe')](function(_0x2dd6e4){var _0x411ad1=_0x3ea439[_0x6b71('0x10')]?_0x3ea439[_0x6b71('0x10')]['id']:_0x6b71('0x11');var _0x53ee15=_0x4780aa[_0x6b71('0x12')];var _0x444b05=_0x4780aa[_0x6b71('0x13')];var _0x2ea398=new Date(Number(_0x444b05));return _0x2dd6e4(_0x411ad1,_0x2ea398,_0x15dabc,_0x53ee15);})[_0x6b71('0x14')](function(_0x5b3c31){fileLogger(_0x6b71('0xa'))['error'](_0x5b3c31);});};}function setupLoggers(_0x1f09d9){return new Promise(function(_0x4ba1dc){var _0x5d8b84=new ClientSideLogger();var _0x5e8b89=fileLogger(_0x6b71('0x15'));var _0x492bf5=fileLogger('auth');_0x1f09d9['set'](_0x6b71('0x16'),_0x5d8b84);_0x1f09d9['use'](ewinston[_0x6b71('0x17')]({'winstonInstance':_0x5e8b89,'meta':![],'statusLevels':!![],'msg':function(_0x4e67d8,_0x7c5980){var _0x1d90b7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x6b71('0x18')](_0x4e67d8[_0x6b71('0x19')])){_0x1d90b7+=_0x6b71('0x1a');var _0x19a25a=_0x4e67d8[_0x6b71('0x19')];maskSensitiveData(_0x19a25a);}return safeTemplate(util['format'](_0x1d90b7,_0x4e67d8[_0x6b71('0x1b')],_0x4e67d8[_0x6b71('0x1c')][_0x6b71('0x1d')]?_0x4e67d8[_0x6b71('0x1c')][_0x6b71('0x1d')]:_0x4e67d8[_0x6b71('0x1e')][_0x6b71('0x1f')]||_0x4e67d8['ip'],_0x4e67d8[_0x6b71('0x20')],_0x7c5980[_0x6b71('0x21')],_0x7c5980[_0x6b71('0x22')],_0x4e67d8[_0x6b71('0x10')]?_0x4e67d8[_0x6b71('0x10')]['id']:null,_0x4e67d8['user']?_0x4e67d8[_0x6b71('0x10')][_0x6b71('0xc')]:null,_0x4e67d8[_0x6b71('0x10')]?_0x4e67d8[_0x6b71('0x10')][_0x6b71('0xb')]:null,_0x19a25a?util[_0x6b71('0x23')](_0x19a25a,![],null):''));}}));_0x1f09d9[_0x6b71('0x24')](ewinston[_0x6b71('0x17')]({'winstonInstance':_0x492bf5,'meta':![],'statusLevels':!![],'msg':function(_0x4613ad,_0x251f2a){var _0x200a04=_0x6b71('0x25');if(_0x4613ad['body']&&_0x4613ad[_0x6b71('0x19')]['device']&&_0x4613ad[_0x6b71('0x19')][_0x6b71('0x26')]){_0x200a04='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x200a04,_0x4613ad[_0x6b71('0x1b')],_0x4613ad[_0x6b71('0x1c')][_0x6b71('0x1d')]?_0x4613ad['headers'][_0x6b71('0x1d')]:_0x4613ad[_0x6b71('0x1e')][_0x6b71('0x1f')]||_0x4613ad['ip'],_0x4613ad['url'],_0x251f2a[_0x6b71('0x21')],_0x251f2a[_0x6b71('0x22')],_0x4613ad['user']?_0x4613ad['user']['id']:null,_0x4613ad[_0x6b71('0x10')]?_0x4613ad['user'][_0x6b71('0xc')]:null,_0x4613ad[_0x6b71('0x10')]?_0x4613ad[_0x6b71('0x10')][_0x6b71('0xb')]:null,_0x4613ad[_0x6b71('0x19')]&&_0x4613ad[_0x6b71('0x19')][_0x6b71('0x27')]?_0x4613ad['body'][_0x6b71('0x27')]:'other',_0x4613ad[_0x6b71('0x19')]&&_0x4613ad[_0x6b71('0x19')][_0x6b71('0x26')]?_0x4613ad[_0x6b71('0x19')]['agent_id']:'',_0x4613ad[_0x6b71('0x19')]&&_0x4613ad[_0x6b71('0x19')]['agent_name']?_0x4613ad[_0x6b71('0x19')][_0x6b71('0x28')]:'');},'ignoreRoute':function(_0x282117){var _0x2860a0=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2860a0['test'](_0x282117['url']);}}));return _0x4ba1dc();});}exports[_0x6b71('0x29')]=setupLoggers; \ No newline at end of file +var _0xa215=['fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','name','ensureDir','catch','user','no-user','data','timestamp','error','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','responseTime','other','agent_name','test','setupLoggers'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa215,0x1b9));var _0x5a21=function(_0x96c15f,_0x538403){_0x96c15f=_0x96c15f-0x0;var _0x202a78=_0xa215[_0x96c15f];return _0x202a78;};var fs=require(_0x5a21('0x0'));var _=require(_0x5a21('0x1'));var ewinston=require(_0x5a21('0x2'));var path=require(_0x5a21('0x3'));var util=require(_0x5a21('0x4'));var fileLogger=require(_0x5a21('0x5'))[_0x5a21('0x6')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x5a21('0x7'))[_0x5a21('0x8')];function ClientSideLogger(){function _0x2aad1a(_0x45d085){var _0x2ecb2b=path[_0x5a21('0x9')](_0x5a21('0xa'),_0x5a21('0xb'),_0x5a21('0xc'));var _0x4f21c1=path[_0x5a21('0x9')](_0x5a21('0xd'),_0x45d085['role']+'-'+_0x45d085[_0x5a21('0xe')]);return fs[_0x5a21('0xf')](path[_0x5a21('0x9')](_0x2ecb2b,_0x4f21c1))['then'](function(){var _0x165967=fileLogger('client',path[_0x5a21('0x9')](_0x2ecb2b,_0x4f21c1));return _0x165967;})[_0x5a21('0x10')](function(_0x3f81da){throw _0x3f81da;});}this[_0x5a21('0xb')]=function(_0xb46c11,_0x45bed0,_0x19bf26,_0x4b55ab){return _0x2aad1a(_0xb46c11['user'])['then'](function(_0x2c3bfd){var _0x1e13b8=_0x2c3bfd[_0x45bed0];return _0x1e13b8;})['then'](function(_0x50fa41){var _0x55baa1=_0xb46c11[_0x5a21('0x11')]?_0xb46c11[_0x5a21('0x11')]['id']:_0x5a21('0x12');var _0x5056b6=_0x4b55ab[_0x5a21('0x13')];var _0x4fe8db=_0x4b55ab[_0x5a21('0x14')];var _0x1e02b9=new Date(Number(_0x4fe8db));return _0x50fa41(_0x55baa1,_0x1e02b9,_0x19bf26,_0x5056b6);})[_0x5a21('0x10')](function(_0x1cad4c){fileLogger('client')[_0x5a21('0x15')](_0x1cad4c);});};}function setupLoggers(_0x13e80e){return new Promise(function(_0x470336){var _0x8a32e5=new ClientSideLogger();var _0x21f554=fileLogger(_0x5a21('0x16'));var _0x9ad147=fileLogger(_0x5a21('0x17'));_0x13e80e['set'](_0x5a21('0x18'),_0x8a32e5);_0x13e80e[_0x5a21('0x19')](ewinston[_0x5a21('0x1a')]({'winstonInstance':_0x21f554,'meta':![],'statusLevels':!![],'msg':function(_0x8d910c,_0x143b7a){var _0x4ee72c=_0x5a21('0x1b');if(!_[_0x5a21('0x1c')](_0x8d910c[_0x5a21('0x1d')])){_0x4ee72c+=_0x5a21('0x1e');var _0x484ede=_0x8d910c[_0x5a21('0x1d')];maskSensitiveData(_0x484ede);}return safeTemplate(util[_0x5a21('0x1f')](_0x4ee72c,_0x8d910c[_0x5a21('0x20')],_0x8d910c[_0x5a21('0x21')][_0x5a21('0x22')]?_0x8d910c[_0x5a21('0x21')][_0x5a21('0x22')]:_0x8d910c[_0x5a21('0x23')][_0x5a21('0x24')]||_0x8d910c['ip'],_0x8d910c['url'],_0x143b7a[_0x5a21('0x25')],_0x143b7a['responseTime'],_0x8d910c[_0x5a21('0x11')]?_0x8d910c['user']['id']:null,_0x8d910c[_0x5a21('0x11')]?_0x8d910c['user'][_0x5a21('0xe')]:null,_0x8d910c[_0x5a21('0x11')]?_0x8d910c['user'][_0x5a21('0x26')]:null,_0x484ede?util[_0x5a21('0x27')](_0x484ede,![],null):''));}}));_0x13e80e[_0x5a21('0x19')](ewinston[_0x5a21('0x1a')]({'winstonInstance':_0x9ad147,'meta':![],'statusLevels':!![],'msg':function(_0x1dedb5,_0x14c421){var _0x59a6b1=_0x5a21('0x28');if(_0x1dedb5[_0x5a21('0x1d')]&&_0x1dedb5[_0x5a21('0x1d')]['device']&&_0x1dedb5[_0x5a21('0x1d')][_0x5a21('0x29')]){_0x59a6b1=_0x5a21('0x2a');}return util[_0x5a21('0x1f')](_0x59a6b1,_0x1dedb5['method'],_0x1dedb5['headers']['x-forwarded-for']?_0x1dedb5['headers'][_0x5a21('0x22')]:_0x1dedb5[_0x5a21('0x23')][_0x5a21('0x24')]||_0x1dedb5['ip'],_0x1dedb5[_0x5a21('0x2b')],_0x14c421[_0x5a21('0x25')],_0x14c421[_0x5a21('0x2c')],_0x1dedb5[_0x5a21('0x11')]?_0x1dedb5['user']['id']:null,_0x1dedb5[_0x5a21('0x11')]?_0x1dedb5['user'][_0x5a21('0xe')]:null,_0x1dedb5[_0x5a21('0x11')]?_0x1dedb5[_0x5a21('0x11')][_0x5a21('0x26')]:null,_0x1dedb5[_0x5a21('0x1d')]&&_0x1dedb5['body']['device']?_0x1dedb5['body']['device']:_0x5a21('0x2d'),_0x1dedb5[_0x5a21('0x1d')]&&_0x1dedb5[_0x5a21('0x1d')][_0x5a21('0x29')]?_0x1dedb5[_0x5a21('0x1d')][_0x5a21('0x29')]:'',_0x1dedb5[_0x5a21('0x1d')]&&_0x1dedb5['body'][_0x5a21('0x2e')]?_0x1dedb5[_0x5a21('0x1d')][_0x5a21('0x2e')]:'');},'ignoreRoute':function(_0x23bdcd){var _0x5b263a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5b263a[_0x5a21('0x2f')](_0x23bdcd[_0x5a21('0x2b')]);}}));return _0x470336();});}exports[_0x5a21('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index f427f98..9be26b4 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30b3=['indexOf','slice','exports','circularDoWInterval','monthsShort','toLowerCase','concat','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','monthCompare','guess','isMoment','length','padStart','map','source','join','Interval\x20string\x20not\x20valid','split','weekdaysShort','locale'];(function(_0x4a43db,_0x75359){var _0x41d350=function(_0x571851){while(--_0x571851){_0x4a43db['push'](_0x4a43db['shift']());}};_0x41d350(++_0x75359);}(_0x30b3,0x190));var _0x330b=function(_0x3655bd,_0x5da5f1){_0x3655bd=_0x3655bd-0x0;var _0x3a69e4=_0x30b3[_0x3655bd];return _0x3a69e4;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x330b('0x0')](function(_0xc82094){return _0xc82094[_0x330b('0x1')];})[_0x330b('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x330b('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x381095){if(!_0x381095['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x58597b){var _0x320066=_0x58597b[_0x330b('0x4')](':')[_0x330b('0x0')](function(_0x3280ce){return parseInt(_0x3280ce,0xa);});var _0x96c837=_0x320066[0x0];var _0x5a042c=_0x320066[0x1];if(_0x96c837<0x0||_0x96c837>0x17||_0x5a042c<0x0||_0x5a042c>0x3b){throw new Error(EINVALID_DATE);}return[_0x96c837,_0x5a042c];}function circularDoWInterval(_0x979f9d,_0x4065ca){if(_0x979f9d===_0x4065ca){return[_0x979f9d];}else{var _0x354d37=moment['locale']();moment['locale']('en');var _0x40d3f7=moment[_0x330b('0x5')]()[_0x330b('0x0')](function(_0x5eb387){return _0x5eb387['toLowerCase']();});moment[_0x330b('0x6')](_0x354d37);var _0x557b56=_0x40d3f7[_0x330b('0x7')](_0x979f9d);var _0x2fb37c=_0x40d3f7[_0x330b('0x7')](_0x4065ca);if(_0x2fb37c>_0x557b56){return _0x40d3f7[_0x330b('0x8')](_0x557b56,_0x2fb37c+0x1);}else{var _0x2129fd=_0x40d3f7[_0x330b('0x8')](0x0,_0x2fb37c+0x1);var _0x526d8e=_0x40d3f7[_0x330b('0x8')](_0x557b56);return _0x526d8e['concat'](_0x2129fd);}}}module[_0x330b('0x9')][_0x330b('0xa')]=circularDoWInterval;function circularMonthInterval(_0x1ad501,_0x3e551a){if(_0x1ad501===_0x3e551a){return[_0x1ad501];}else{var _0x66b901=moment[_0x330b('0x6')]();moment[_0x330b('0x6')]('en');var _0x56bed2=moment[_0x330b('0xb')]()[_0x330b('0x0')](function(_0x12625d){return _0x12625d[_0x330b('0xc')]();});moment[_0x330b('0x6')](_0x66b901);var _0x115610=_0x56bed2[_0x330b('0x7')](_0x1ad501);var _0x1ab65f=_0x56bed2[_0x330b('0x7')](_0x3e551a);if(_0x1ab65f>_0x115610){return _0x56bed2['slice'](_0x115610,_0x1ab65f+0x1);}else{var _0x29680b=_0x56bed2[_0x330b('0x8')](0x0,_0x1ab65f+0x1);var _0x110631=_0x56bed2[_0x330b('0x8')](_0x115610);return _0x110631[_0x330b('0xd')](_0x29680b);}}}module[_0x330b('0x9')][_0x330b('0xe')]=circularMonthInterval;function parseDom(_0x12e40d){var _0x179dc6=parseInt(_0x12e40d,0xa);if(_0x179dc6<0x1||_0x179dc6>0x1f){throw new Error(EINVALID_DATE);}return _0x179dc6;}function timeCompare(_0x10d764,_0x159af6,_0x556259){var _0x1e7182=_0x10d764[_0x330b('0xf')]();var _0x404471=extractTime(_0x159af6);var _0x3039ce=_0x404471[0x0];var _0xc08444=_0x404471[0x1];var _0xcba000=_0x10d764[_0x330b('0xf')]()[_0x330b('0x10')](_0x3039ce)[_0x330b('0x11')](_0xc08444);throwIfDateNotValid(_0xcba000);var _0x57da20=extractTime(_0x556259);var _0x5017de=_0x57da20[0x0];var _0x2d9eb8=_0x57da20[0x1];var _0x1f430c=_0x10d764[_0x330b('0xf')]()[_0x330b('0x10')](_0x5017de)[_0x330b('0x11')](_0x2d9eb8);throwIfDateNotValid(_0x1f430c);if(_0x1f430c[_0x330b('0x12')](_0xcba000)){var _0x1c0a73=_0x1e7182['clone']()[_0x330b('0x13')](_0x330b('0x14'));var _0x5eab15=_0x1e7182[_0x330b('0xf')]()['endOf'](_0x330b('0x14'));return _0x1e7182[_0x330b('0x15')](_0xcba000,_0x5eab15,undefined,'[]')||_0x1e7182[_0x330b('0x15')](_0x1c0a73,_0x1f430c,undefined,'[]');}else{return _0x1e7182[_0x330b('0x15')](_0xcba000,_0x1f430c,undefined,'[]');}}module[_0x330b('0x9')][_0x330b('0x16')]=timeCompare;function dowCompare(_0x299afd,_0x1f6c24,_0x10d571){var _0x428cfc=_0x299afd[_0x330b('0x6')]('en')[_0x330b('0x17')](_0x330b('0x18'))['toLowerCase']();return circularDoWInterval(_0x1f6c24,_0x10d571)[_0x330b('0x19')](_0x428cfc);}module[_0x330b('0x9')][_0x330b('0x1a')]=dowCompare;function domCompare(_0x1f8780,_0xbe9f9a,_0x2299be){var _0x3dc740=_0x1f8780[_0x330b('0x1b')]();if(_0xbe9f9a===_0x2299be){return _0x3dc740===_0xbe9f9a;}else{var _0x1fd80d=_0x1f8780[_0x330b('0x1c')]();var _0x4e027a=_0xbe9f9a<_0x2299be;let _0xa5e78b=![];var _0x2bc4f4=0x0;var _0x395c5f=0x0;if(_0x4e027a){_0x2bc4f4=Math[_0x330b('0x1d')](0x1,_0xbe9f9a);_0x395c5f=Math[_0x330b('0x1e')](_0x2299be,_0x1fd80d);_0xa5e78b=_0x3dc740>=_0x2bc4f4&&_0x3dc740<=_0x395c5f;}else{_0x2bc4f4=Math[_0x330b('0x1e')](_0xbe9f9a,_0x1fd80d);_0x395c5f=Math[_0x330b('0x1d')](0x1,_0x2299be);_0xa5e78b=_0x3dc740>=_0x2bc4f4||_0x3dc740<=_0x395c5f;}return _0xa5e78b;}}module[_0x330b('0x9')][_0x330b('0x1f')]=domCompare;function monthCompare(_0x15dbe7,_0x50daf8,_0x3fbc7d){var _0x395d6e=_0x15dbe7[_0x330b('0x6')]('en')[_0x330b('0x17')]('MMM')[_0x330b('0xc')]();return circularMonthInterval(_0x50daf8,_0x3fbc7d)[_0x330b('0x19')](_0x395d6e);}module[_0x330b('0x9')][_0x330b('0x20')]=monthCompare;function iftime(_0xe97907,_0x3afe3e=moment['tz'][_0x330b('0x21')](),_0x3c04ed=moment()){if(!validateRx['test'](_0xe97907)){throw new Error(EINVALID_STRING);}else{var _0x1c8e43=(moment[_0x330b('0x22')](_0x3c04ed)?_0x3c04ed[_0x330b('0xf')]():moment(_0x3c04ed))['tz'](_0x3afe3e)[_0x330b('0x6')]('en');throwIfDateNotValid(_0x1c8e43);var _0x2b5317=_0xe97907['split'](',');var _0x570199=_0x2b5317[0x0];var _0xf71083=_0x2b5317[0x1];var _0x3ad1ad=_0x2b5317[0x2];var _0x5c66eb=_0x2b5317[0x3];let _0x5c2d63=!![];if(_0x570199!=='*'){var _0x1ec85a=_0x570199[_0x330b('0x4')]('-');var _0x3b76b3=_['padStart'](_0x1ec85a[0x0],0x5,'0');var _0x3c477f=_0x1ec85a[_0x330b('0x23')]===0x2?_[_0x330b('0x24')](_0x1ec85a[0x1],0x5,'0'):_0x3b76b3;_0x5c2d63=timeCompare(_0x1c8e43,_0x3b76b3,_0x3c477f);}let _0x461342=!![];if(_0xf71083!=='*'){var _0xb443fd=_0xf71083['split']('-');var _0x1fa724=_0xb443fd[0x0];var _0x2c431d=_0xb443fd[_0x330b('0x23')]===0x2?_0xb443fd[0x1]:_0x1fa724;_0x461342=dowCompare(_0x1c8e43,_0x1fa724,_0x2c431d);}let _0x59df84=!![];if(_0x3ad1ad!=='*'){var _0x563688=_0x3ad1ad['split']('-');var _0x2791e0=parseDom(_0x563688[0x0]);var _0x3f186e=_0x563688[_0x330b('0x23')]===0x2?parseDom(_0x563688[0x1]):_0x2791e0;_0x59df84=domCompare(_0x1c8e43,_0x2791e0,_0x3f186e);}let _0x5260fa=!![];if(_0x5c66eb!=='*'){var _0x14e577=_0x5c66eb[_0x330b('0x4')]('-');var _0x3baf80=_0x14e577[0x0];var _0x8046ee=_0x14e577[_0x330b('0x23')]===0x2?_0x14e577[0x1]:_0x14e577[0x0];_0x5260fa=monthCompare(_0x1c8e43,_0x3baf80,_0x8046ee);}return _0x5c2d63&&_0x461342&&_0x59df84&&_0x5260fa;}}module[_0x330b('0x9')]['iftime']=iftime; \ No newline at end of file +var _0x7104=['startOf','day','isBetween','format','ddd','includes','dowCompare','date','daysInMonth','min','max','domCompare','MMM','guess','test','isMoment','split','padStart','length','iftime','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','toLowerCase','slice','concat','exports','circularDoWInterval','indexOf','clone','hours','minutes','isBefore'];(function(_0x29696a,_0x504c71){var _0x1cb7fd=function(_0x1d0f2c){while(--_0x1d0f2c){_0x29696a['push'](_0x29696a['shift']());}};_0x1cb7fd(++_0x504c71);}(_0x7104,0x14c));var _0x4710=function(_0x32e878,_0x3d8e58){_0x32e878=_0x32e878-0x0;var _0x592df3=_0x7104[_0x32e878];return _0x592df3;};var _=require(_0x4710('0x0'));var moment=require(_0x4710('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x4710('0x2')](function(_0x1c45e8){return _0x1c45e8['source'];})[_0x4710('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x4710('0x4');var EINVALID_DATE=_0x4710('0x5');function throwIfDateNotValid(_0x1e1af1){if(!_0x1e1af1[_0x4710('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5dddeb){var _0x3b5d9e=_0x5dddeb['split'](':')[_0x4710('0x2')](function(_0x22b34f){return parseInt(_0x22b34f,0xa);});var _0x1fe632=_0x3b5d9e[0x0];var _0x3a99f1=_0x3b5d9e[0x1];if(_0x1fe632<0x0||_0x1fe632>0x17||_0x3a99f1<0x0||_0x3a99f1>0x3b){throw new Error(EINVALID_DATE);}return[_0x1fe632,_0x3a99f1];}function circularDoWInterval(_0x557244,_0x4977e1){if(_0x557244===_0x4977e1){return[_0x557244];}else{var _0x550f57=moment[_0x4710('0x7')]();moment['locale']('en');var _0x2ad1b1=moment[_0x4710('0x8')]()[_0x4710('0x2')](function(_0x2ead43){return _0x2ead43[_0x4710('0x9')]();});moment[_0x4710('0x7')](_0x550f57);var _0x3c1109=_0x2ad1b1['indexOf'](_0x557244);var _0x3f5281=_0x2ad1b1['indexOf'](_0x4977e1);if(_0x3f5281>_0x3c1109){return _0x2ad1b1['slice'](_0x3c1109,_0x3f5281+0x1);}else{var _0x1cffcb=_0x2ad1b1[_0x4710('0xa')](0x0,_0x3f5281+0x1);var _0xe4a690=_0x2ad1b1['slice'](_0x3c1109);return _0xe4a690[_0x4710('0xb')](_0x1cffcb);}}}module[_0x4710('0xc')][_0x4710('0xd')]=circularDoWInterval;function circularMonthInterval(_0x222d62,_0xcb5b4d){if(_0x222d62===_0xcb5b4d){return[_0x222d62];}else{var _0x1db7f3=moment[_0x4710('0x7')]();moment[_0x4710('0x7')]('en');var _0x4b877b=moment['monthsShort']()[_0x4710('0x2')](function(_0xb6cef2){return _0xb6cef2[_0x4710('0x9')]();});moment['locale'](_0x1db7f3);var _0x4bcc57=_0x4b877b[_0x4710('0xe')](_0x222d62);var _0x290d8b=_0x4b877b[_0x4710('0xe')](_0xcb5b4d);if(_0x290d8b>_0x4bcc57){return _0x4b877b[_0x4710('0xa')](_0x4bcc57,_0x290d8b+0x1);}else{var _0x248839=_0x4b877b[_0x4710('0xa')](0x0,_0x290d8b+0x1);var _0x20359b=_0x4b877b['slice'](_0x4bcc57);return _0x20359b[_0x4710('0xb')](_0x248839);}}}module[_0x4710('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x4b083b){var _0x4693f2=parseInt(_0x4b083b,0xa);if(_0x4693f2<0x1||_0x4693f2>0x1f){throw new Error(EINVALID_DATE);}return _0x4693f2;}function timeCompare(_0x438df4,_0x2466fb,_0x4a8a3f){var _0x179a40=_0x438df4[_0x4710('0xf')]();var _0x220011=extractTime(_0x2466fb);var _0xeca6ef=_0x220011[0x0];var _0x58b934=_0x220011[0x1];var _0x396aa8=_0x438df4['clone']()[_0x4710('0x10')](_0xeca6ef)[_0x4710('0x11')](_0x58b934);throwIfDateNotValid(_0x396aa8);var _0x227f25=extractTime(_0x4a8a3f);var _0x49cf74=_0x227f25[0x0];var _0x176ff1=_0x227f25[0x1];var _0x3f2f56=_0x438df4[_0x4710('0xf')]()[_0x4710('0x10')](_0x49cf74)[_0x4710('0x11')](_0x176ff1);throwIfDateNotValid(_0x3f2f56);if(_0x3f2f56[_0x4710('0x12')](_0x396aa8)){var _0x3b2bfd=_0x179a40[_0x4710('0xf')]()[_0x4710('0x13')](_0x4710('0x14'));var _0xc6eb9b=_0x179a40['clone']()['endOf']('day');return _0x179a40['isBetween'](_0x396aa8,_0xc6eb9b,undefined,'[]')||_0x179a40[_0x4710('0x15')](_0x3b2bfd,_0x3f2f56,undefined,'[]');}else{return _0x179a40['isBetween'](_0x396aa8,_0x3f2f56,undefined,'[]');}}module[_0x4710('0xc')]['timeCompare']=timeCompare;function dowCompare(_0x2273d8,_0x27971c,_0x4f4747){var _0x8f5017=_0x2273d8[_0x4710('0x7')]('en')[_0x4710('0x16')](_0x4710('0x17'))[_0x4710('0x9')]();return circularDoWInterval(_0x27971c,_0x4f4747)[_0x4710('0x18')](_0x8f5017);}module['exports'][_0x4710('0x19')]=dowCompare;function domCompare(_0x306064,_0x5d3328,_0x4ee53d){var _0xc5518c=_0x306064[_0x4710('0x1a')]();if(_0x5d3328===_0x4ee53d){return _0xc5518c===_0x5d3328;}else{var _0x134e38=_0x306064[_0x4710('0x1b')]();var _0x321292=_0x5d3328<_0x4ee53d;let _0x4d5bdd=![];var _0x5ba10d=0x0;var _0x5266c6=0x0;if(_0x321292){_0x5ba10d=Math['max'](0x1,_0x5d3328);_0x5266c6=Math[_0x4710('0x1c')](_0x4ee53d,_0x134e38);_0x4d5bdd=_0xc5518c>=_0x5ba10d&&_0xc5518c<=_0x5266c6;}else{_0x5ba10d=Math[_0x4710('0x1c')](_0x5d3328,_0x134e38);_0x5266c6=Math[_0x4710('0x1d')](0x1,_0x4ee53d);_0x4d5bdd=_0xc5518c>=_0x5ba10d||_0xc5518c<=_0x5266c6;}return _0x4d5bdd;}}module[_0x4710('0xc')][_0x4710('0x1e')]=domCompare;function monthCompare(_0x19efa5,_0x57b6fa,_0xb71474){var _0x4ed849=_0x19efa5[_0x4710('0x7')]('en')[_0x4710('0x16')](_0x4710('0x1f'))[_0x4710('0x9')]();return circularMonthInterval(_0x57b6fa,_0xb71474)[_0x4710('0x18')](_0x4ed849);}module['exports']['monthCompare']=monthCompare;function iftime(_0x531e1c,_0x32b239=moment['tz'][_0x4710('0x20')](),_0x28a1e8=moment()){if(!validateRx[_0x4710('0x21')](_0x531e1c)){throw new Error(EINVALID_STRING);}else{var _0x314ffa=(moment[_0x4710('0x22')](_0x28a1e8)?_0x28a1e8[_0x4710('0xf')]():moment(_0x28a1e8))['tz'](_0x32b239)[_0x4710('0x7')]('en');throwIfDateNotValid(_0x314ffa);var _0x3c3fe3=_0x531e1c['split'](',');var _0x35e4dc=_0x3c3fe3[0x0];var _0x3f9191=_0x3c3fe3[0x1];var _0xcfe95c=_0x3c3fe3[0x2];var _0x3cdfca=_0x3c3fe3[0x3];let _0x2a5a63=!![];if(_0x35e4dc!=='*'){var _0x4e2f5a=_0x35e4dc[_0x4710('0x23')]('-');var _0x1fca9e=_[_0x4710('0x24')](_0x4e2f5a[0x0],0x5,'0');var _0x382b53=_0x4e2f5a['length']===0x2?_[_0x4710('0x24')](_0x4e2f5a[0x1],0x5,'0'):_0x1fca9e;_0x2a5a63=timeCompare(_0x314ffa,_0x1fca9e,_0x382b53);}let _0x1cbe26=!![];if(_0x3f9191!=='*'){var _0x506df7=_0x3f9191['split']('-');var _0xe9c3ea=_0x506df7[0x0];var _0x2216e7=_0x506df7[_0x4710('0x25')]===0x2?_0x506df7[0x1]:_0xe9c3ea;_0x1cbe26=dowCompare(_0x314ffa,_0xe9c3ea,_0x2216e7);}let _0x243b44=!![];if(_0xcfe95c!=='*'){var _0x12f850=_0xcfe95c[_0x4710('0x23')]('-');var _0x3feace=parseDom(_0x12f850[0x0]);var _0x59a68d=_0x12f850[_0x4710('0x25')]===0x2?parseDom(_0x12f850[0x1]):_0x3feace;_0x243b44=domCompare(_0x314ffa,_0x3feace,_0x59a68d);}let _0x28869b=!![];if(_0x3cdfca!=='*'){var _0x1b7d51=_0x3cdfca['split']('-');var _0x382d73=_0x1b7d51[0x0];var _0x4eeac5=_0x1b7d51[_0x4710('0x25')]===0x2?_0x1b7d51[0x1]:_0x1b7d51[0x0];_0x28869b=monthCompare(_0x314ffa,_0x382d73,_0x4eeac5);}return _0x2a5a63&&_0x1cbe26&&_0x243b44&&_0x28869b;}}module[_0x4710('0xc')][_0x4710('0x26')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 3663614..743d11d 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b4a=['white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','addColors','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','File','error','%s-%s','Console','warn','consoleLogger','fileLogger','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow'];(function(_0x350dc6,_0x36ab14){var _0x2e5887=function(_0x5370ad){while(--_0x5370ad){_0x350dc6['push'](_0x350dc6['shift']());}};_0x2e5887(++_0x36ab14);}(_0x9b4a,0x175));var _0xa9b4=function(_0x29a8e0,_0x1cfe44){_0x29a8e0=_0x29a8e0-0x0;var _0x42ea7c=_0x9b4a[_0x29a8e0];return _0x42ea7c;};'use strict';var path=require('path');var util=require('util');var moment=require('moment');var winston=require(_0xa9b4('0x0'));var config=require(_0xa9b4('0x1'));var debugLevel=config[_0xa9b4('0x2')]?config[_0xa9b4('0x2')][_0xa9b4('0x3')]():_0xa9b4('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xa9b4('0x5'),'warn':_0xa9b4('0x6'),'info':_0xa9b4('0x7'),'print':_0xa9b4('0x8'),'success':_0xa9b4('0x9'),'http':'gray','verbose':_0xa9b4('0xa'),'debug':_0xa9b4('0xb'),'silly':'bold\x20cyan'};winston[_0xa9b4('0xc')](XC_LOG_COLORS);function getLogFileName(_0x9f0a0f,_0xf19b02,_0x306b41){var _0x2cdd61=_0x9f0a0f||'/var/log/xcally';return path[_0xa9b4('0xd')](_0x2cdd61,util[_0xa9b4('0xe')](_0xa9b4('0xf'),_0xf19b02,_0x306b41));}function formatter(_0xd2cf8f,_0x262ceb){_0x262ceb[_0xa9b4('0x10')]=_0x262ceb[_0xa9b4('0x10')][_0xa9b4('0x11')](/@@{/g,_0xa9b4('0x12'))['replace'](/}@@/g,_0xa9b4('0x13'))[_0xa9b4('0x11')](/@{/g,'{{')[_0xa9b4('0x11')](/}@/g,'}}');return util['format'](_0xa9b4('0x14'),moment()[_0xa9b4('0xe')](_0xa9b4('0x15')),_0x262ceb[_0xa9b4('0x16')][_0xa9b4('0x17')](),_0xd2cf8f,_0x262ceb[_0xa9b4('0x10')]);}function fileFormat(_0x34b469,_0xba0685){_0xba0685[_0xa9b4('0x10')]=_0xba0685[_0xa9b4('0x10')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0xa9b4('0x11')](/@{/g,'{{')[_0xa9b4('0x11')](/}@/g,'}}');var _0x486f59=_0xba0685['meta']&&Object[_0xa9b4('0x18')](_0xba0685[_0xa9b4('0x19')])[_0xa9b4('0x1a')]?'\x0a\x09'+JSON[_0xa9b4('0x1b')](_0xba0685[_0xa9b4('0x19')]):'';return util['format'](_0xa9b4('0x1c'),moment()[_0xa9b4('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),_0xba0685[_0xa9b4('0x16')]['toUpperCase'](),_0x34b469,_0xba0685[_0xa9b4('0x10')],_0x486f59);}function consoleLogger(){var _0x4c116d=new winston[(_0xa9b4('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa9b4('0x1e'))]['Console']({'level':'warn','json':![],'formatter':function(_0x16d908){return formatter('',_0x16d908);}})]});return _0x4c116d;}function fileLogger(_0x2bea3e,_0x34d738){var _0x465488=new winston[(_0xa9b4('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xa9b4('0x1f'))]({'name':util['format']('%s-%s',_0x2bea3e,_0xa9b4('0x20')),'filename':getLogFileName(_0x34d738,_0x2bea3e,_0xa9b4('0x20')),'level':_0xa9b4('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48c98c){return fileFormat(_0x2bea3e,_0x48c98c);}}),new winston[(_0xa9b4('0x1e'))][(_0xa9b4('0x1f'))]({'name':util[_0xa9b4('0xe')](_0xa9b4('0x21'),_0x2bea3e,debugLevel),'filename':getLogFileName(_0x34d738,_0x2bea3e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x54f353){return fileFormat(_0x2bea3e,_0x54f353);}}),new winston[(_0xa9b4('0x1e'))][(_0xa9b4('0x22'))]({'level':_0xa9b4('0x23'),'json':![],'formatter':function(_0x89e5c2){return fileFormat(_0x2bea3e,_0x89e5c2);}})]});return _0x465488;}exports[_0xa9b4('0x24')]=consoleLogger;exports[_0xa9b4('0x25')]=fileLogger; \ No newline at end of file +var _0x3e03=['level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','warn','transports','File','%s-%s','error','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','/var/log/xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x3e03,0x1d6));var _0x33e0=function(_0x134bfc,_0x144d5f){_0x134bfc=_0x134bfc-0x0;var _0x2f4dcc=_0x3e03[_0x134bfc];return _0x2f4dcc;};'use strict';var path=require(_0x33e0('0x0'));var util=require(_0x33e0('0x1'));var moment=require('moment');var winston=require(_0x33e0('0x2'));var config=require(_0x33e0('0x3'));var debugLevel=config['debugLevel']?config[_0x33e0('0x4')][_0x33e0('0x5')]():_0x33e0('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x33e0('0x7'),'error':_0x33e0('0x8'),'warn':_0x33e0('0x9'),'info':_0x33e0('0xa'),'print':_0x33e0('0xb'),'success':_0x33e0('0xc'),'http':_0x33e0('0xd'),'verbose':_0x33e0('0xe'),'debug':'bold\x20blue','silly':_0x33e0('0xf')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x467ba1,_0x2e14c0,_0x5548cf){var _0x19a10a=_0x467ba1||_0x33e0('0x10');return path['join'](_0x19a10a,util[_0x33e0('0x11')](_0x33e0('0x12'),_0x2e14c0,_0x5548cf));}function formatter(_0x164e49,_0x43d19f){_0x43d19f[_0x33e0('0x13')]=_0x43d19f[_0x33e0('0x13')][_0x33e0('0x14')](/@@{/g,'{{{')['replace'](/}@@/g,_0x33e0('0x15'))[_0x33e0('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x33e0('0x11')](_0x33e0('0x16'),moment()[_0x33e0('0x11')](_0x33e0('0x17')),_0x43d19f[_0x33e0('0x18')][_0x33e0('0x19')](),_0x164e49,_0x43d19f[_0x33e0('0x13')]);}function fileFormat(_0x5ae257,_0x56807f){_0x56807f['message']=_0x56807f['message'][_0x33e0('0x14')](/@@{/g,'{{{')['replace'](/}@@/g,_0x33e0('0x15'))[_0x33e0('0x14')](/@{/g,'{{')[_0x33e0('0x14')](/}@/g,'}}');var _0x4cf542=_0x56807f[_0x33e0('0x1a')]&&Object['keys'](_0x56807f['meta'])[_0x33e0('0x1b')]?'\x0a\x09'+JSON[_0x33e0('0x1c')](_0x56807f[_0x33e0('0x1a')]):'';return util[_0x33e0('0x11')](_0x33e0('0x1d'),moment()[_0x33e0('0x11')](_0x33e0('0x17')),_0x56807f[_0x33e0('0x18')]['toUpperCase'](),_0x5ae257,_0x56807f['message'],_0x4cf542);}function consoleLogger(){var _0x35bbc9=new winston[(_0x33e0('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x33e0('0x1f'),'json':![],'formatter':function(_0x2928f7){return formatter('',_0x2928f7);}})]});return _0x35bbc9;}function fileLogger(_0x23c126,_0xab58cc){var _0x4ea911=new winston[(_0x33e0('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x33e0('0x20'))][(_0x33e0('0x21'))]({'name':util[_0x33e0('0x11')](_0x33e0('0x22'),_0x23c126,_0x33e0('0x23')),'filename':getLogFileName(_0xab58cc,_0x23c126,_0x33e0('0x23')),'level':_0x33e0('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b2d1f){return fileFormat(_0x23c126,_0x3b2d1f);}}),new winston[(_0x33e0('0x20'))]['File']({'name':util['format'](_0x33e0('0x22'),_0x23c126,debugLevel),'filename':getLogFileName(_0xab58cc,_0x23c126,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x47d42f){return fileFormat(_0x23c126,_0x47d42f);}}),new winston['transports']['Console']({'level':'warn','json':![],'formatter':function(_0x27041e){return fileFormat(_0x23c126,_0x27041e);}})]});return _0x4ea911;}exports[_0x33e0('0x24')]=consoleLogger;exports[_0x33e0('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index f9c4f34..453f362 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x5950bd,_0x15f6b5){_0x5950bd=_0x5950bd-0x0;var _0x43515e=_0x7a54[_0x5950bd];return _0x43515e;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x56629e,_0x3873b2){var _0x2e56e4=function(_0x3376fd){while(--_0x3376fd){_0x56629e['push'](_0x56629e['shift']());}};_0x2e56e4(++_0x3873b2);}(_0x66fa,0x117));var _0xa66f=function(_0x23d9f3,_0x9aaee5){_0x23d9f3=_0x23d9f3-0x0;var _0x2b5dcb=_0x66fa[_0x23d9f3];return _0x2b5dcb;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 10015d8..b6307c9 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x4bac5d,_0x1007cc){var _0x7eb121=function(_0xbec03c){while(--_0xbec03c){_0x4bac5d['push'](_0x4bac5d['shift']());}};_0x7eb121(++_0x1007cc);}(_0xb688,0xcf));var _0x8b68=function(_0x3349c5,_0x31fa66){_0x3349c5=_0x3349c5-0x0;var _0x180bd5=_0xb688[_0x3349c5];return _0x180bd5;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x39c8c5){return _0x39c8c5==='{{'?_0x8b68('0x0'):_0x8b68('0x1');}function safeTemplate(_0x1080e8){var _0x23bbaa=_0x1080e8;if(typeof _0x1080e8===_0x8b68('0x2')){_0x23bbaa=_0x1080e8['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8b68('0x3')](_0x1080e8)){_0x23bbaa=_0x1080e8[_0x8b68('0x4')](function(_0x30f33d){return safeTemplate(_0x30f33d);});}else if(_[_0x8b68('0x5')](_0x1080e8)){_0x23bbaa=Object['keys'](_0x1080e8)[_0x8b68('0x6')](function(_0x57ee56,_0x37677d){_0x57ee56[_0x37677d]=safeTemplate(_0x1080e8[_0x37677d]);return _0x57ee56;},{});}return _0x23bbaa;}module[_0x8b68('0x7')][_0x8b68('0x8')]=safeTemplate; \ No newline at end of file +var _0xda2d=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','map','isPlainObject','keys','reduce'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xda2d,0x102));var _0xdda2=function(_0x3e4319,_0x296389){_0x3e4319=_0x3e4319-0x0;var _0x2ef87b=_0xda2d[_0x3e4319];return _0x2ef87b;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x14e970){return _0x14e970==='{{'?_0xdda2('0x0'):_0xdda2('0x1');}function safeTemplate(_0x1f1fcc){var _0x329c5e=_0x1f1fcc;if(typeof _0x1f1fcc==='string'){_0x329c5e=_0x1f1fcc['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x1f1fcc)){_0x329c5e=_0x1f1fcc[_0xdda2('0x2')](function(_0x319129){return safeTemplate(_0x319129);});}else if(_[_0xdda2('0x3')](_0x1f1fcc)){_0x329c5e=Object[_0xdda2('0x4')](_0x1f1fcc)[_0xdda2('0x5')](function(_0xf38e58,_0x2f55dc){_0xf38e58[_0x2f55dc]=safeTemplate(_0x1f1fcc[_0x2f55dc]);return _0xf38e58;},{});}return _0x329c5e;}module[_0xdda2('0x6')][_0xdda2('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index d9d3861..4ec9cbb 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3d5=['env','string','pathExists','readJSON','then','updated','info','writeJSON','exports','fs-extra','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2'];(function(_0x174710,_0x2ced56){var _0x53d04c=function(_0x48d17e){while(--_0x48d17e){_0x174710['push'](_0x174710['shift']());}};_0x53d04c(++_0x2ced56);}(_0xc3d5,0xbd));var _0x5c3d=function(_0x2d9dab,_0x1a45a6){_0x2d9dab=_0x2d9dab-0x0;var _0x373f8=_0xc3d5[_0x2d9dab];return _0x373f8;};var fs=require(_0x5c3d('0x0'));var path=require('path');var config=require(_0x5c3d('0x1'));var root=config[_0x5c3d('0x2')];var APP_JSON_PATH=path[_0x5c3d('0x3')](root,_0x5c3d('0x4'));var NODEPATH=path['resolve'](root,_0x5c3d('0x5'));function setLegacyLibsNodeEnvPath(_0x517204){let _0x3f862d=![];if(Array[_0x5c3d('0x6')](_0x517204[_0x5c3d('0x7')])){var _0x4b9b6b=_0x517204[_0x5c3d('0x7')][_0x5c3d('0x8')](function(_0x118570){return _0x118570[_0x5c3d('0x9')]===_0x5c3d('0xa');});if(_0x4b9b6b>-0x1){var _0x1b2498=_0x517204[_0x5c3d('0x7')][_0x4b9b6b];if(typeof _0x1b2498[_0x5c3d('0xb')]['NODE_PATH']!==_0x5c3d('0xc')){_0x1b2498[_0x5c3d('0xb')]['NODE_PATH']=NODEPATH;_0x3f862d=!![];}}return{'appConfig':_0x517204,'updated':_0x3f862d};}}function updateAppConfig(_0x35973b){return fs[_0x5c3d('0xd')](APP_JSON_PATH)['then'](function(_0x4347d4){if(_0x4347d4){return fs[_0x5c3d('0xe')](APP_JSON_PATH)[_0x5c3d('0xf')](function(_0x28fbb5){var _0x45aac1=setLegacyLibsNodeEnvPath(_0x28fbb5);if(_0x45aac1[_0x5c3d('0x10')]){_0x35973b[_0x5c3d('0x11')]('Updating\x20app.json');return fs[_0x5c3d('0x12')](APP_JSON_PATH,_0x28fbb5,{'spaces':0x2});}else{return Promise[_0x5c3d('0x3')]();}});}else{return Promise[_0x5c3d('0x3')]();}});}module[_0x5c3d('0x13')]=updateAppConfig; \ No newline at end of file +var _0xd350=['string','pathExists','then','readJSON','updated','info','Updating\x20app.json','exports','path','../config/environment','root','resolve','legacy-libs','apps','findIndex','name','motion2','env'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xd350,0x15e));var _0x0d35=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0xd350[_0x239b31];return _0x41c8be;};var fs=require('fs-extra');var path=require(_0x0d35('0x0'));var config=require(_0x0d35('0x1'));var root=config[_0x0d35('0x2')];var APP_JSON_PATH=path[_0x0d35('0x3')](root,'server/app.json');var NODEPATH=path[_0x0d35('0x3')](root,_0x0d35('0x4'));function setLegacyLibsNodeEnvPath(_0x30fd56){let _0x5b9f85=![];if(Array['isArray'](_0x30fd56['apps'])){var _0x420179=_0x30fd56[_0x0d35('0x5')][_0x0d35('0x6')](function(_0x598f35){return _0x598f35[_0x0d35('0x7')]===_0x0d35('0x8');});if(_0x420179>-0x1){var _0x71bfda=_0x30fd56[_0x0d35('0x5')][_0x420179];if(typeof _0x71bfda[_0x0d35('0x9')]['NODE_PATH']!==_0x0d35('0xa')){_0x71bfda['env']['NODE_PATH']=NODEPATH;_0x5b9f85=!![];}}return{'appConfig':_0x30fd56,'updated':_0x5b9f85};}}function updateAppConfig(_0x3ed222){return fs[_0x0d35('0xb')](APP_JSON_PATH)[_0x0d35('0xc')](function(_0x2f731d){if(_0x2f731d){return fs[_0x0d35('0xd')](APP_JSON_PATH)['then'](function(_0x519c2f){var _0x53a393=setLegacyLibsNodeEnvPath(_0x519c2f);if(_0x53a393[_0x0d35('0xe')]){_0x3ed222[_0x0d35('0xf')](_0x0d35('0x10'));return fs['writeJSON'](APP_JSON_PATH,_0x519c2f,{'spaces':0x2});}else{return Promise[_0x0d35('0x3')]();}});}else{return Promise['resolve']();}});}module[_0x0d35('0x11')]=updateAppConfig; \ No newline at end of file